diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000000..21454a9af0 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,64 @@ +# Maintenance notes: +# - change dotnet-version to 8.0.x once tML updates (keep doing this so long as tML updates .NET), +# - if/when we un-ignore the .csproj, get rid of creating one in this script. + +name: .NET Linter + +on: + push: + branches: + - "*" + pull_request: + branches: + - "*" + +jobs: + lint: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Setup .NET + uses: actions/setup-dotnet@v3 + with: + dotnet-version: 6.0.x + + - name: Restore dependencies + run: | + touch CalamityMod.csproj + echo ' + + + + CalamityMod + net6.0 + AnyCPU + latest + + + + + ' > CalamityMod.csproj + + dotnet restore + + - name: Pull TML + run: | + cd .. + mkdir ./tmod + touch tModLoader.targets + + echo ' + + ' > tModLoader.targets + + cd ./tmod + wget https://github.com/tModLoader/tModLoader/releases/latest/download/tModLoader.zip + unzip tModLoader.zip + cd .. + cd ./CalamityMod + + - name: Lint + run: | + dotnet format style CalamityMod.csproj --verify-no-changes diff --git a/Backgrounds/AstralDesertSurfaceBGStyle.cs b/Backgrounds/AstralDesertSurfaceBGStyle.cs index 51d1c01ef7..181f0d7222 100644 --- a/Backgrounds/AstralDesertSurfaceBGStyle.cs +++ b/Backgrounds/AstralDesertSurfaceBGStyle.cs @@ -1,22 +1,23 @@ -using Terraria.ModLoader; +using Microsoft.Xna.Framework.Graphics; +using System.Reflection; +using System; +using Terraria.Graphics.Effects; +using Terraria; +using Terraria.ModLoader; +using Microsoft.Xna.Framework; namespace CalamityMod.Backgrounds { public class AstralDesertSurfaceBGStyle : ModSurfaceBackgroundStyle { - public override int ChooseFarTexture() => BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/BlankPixel"); - - public override int ChooseMiddleTexture() => BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/BlankPixel"); - - public override int ChooseCloseTexture(ref float scale, ref double parallax, ref float a, ref float b) - { - b -= 75f; - return BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/BlankPixel"); - } + internal static readonly FieldInfo screenOffField = typeof(Main).GetField("screenOff", BindingFlags.Instance | BindingFlags.NonPublic); + internal static readonly FieldInfo scAdjField = typeof(Main).GetField("scAdj", BindingFlags.Instance | BindingFlags.NonPublic); + internal static readonly FieldInfo COSBMAplhaField = typeof(Main).GetField("ColorOfSurfaceBackgroundsModified", BindingFlags.Static | BindingFlags.NonPublic); + readonly int CloseBGYOffset = 475; + readonly int MiddleBGYOffset = 475; public override void ModifyFarFades(float[] fades, float transitionSpeed) { - // This just fades in the background and fades out other backgrounds. for (int i = 0; i < fades.Length; i++) { if (i == Slot) @@ -33,5 +34,90 @@ namespace CalamityMod.Backgrounds } } } + + public override int ChooseFarTexture() => BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/AstralSurfaceHorizon"); + + public override int ChooseMiddleTexture() => BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/AstralDesertSurfaceFar"); + + public override int ChooseCloseTexture(ref float scale, ref double parallax, ref float a, ref float b) => BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Skies/AstralDesertSurfaceMiddle"); + + public override bool PreDrawCloseBackground(SpriteBatch spriteBatch) + { + //Please see AstralSurfaceBGStyle for comments, code is pretty much identical here + float screenOff = (float)screenOffField.GetValue(Main.instance); + float scAdj = (float)scAdjField.GetValue(Main.instance); + Color COSBMAplha = (Color)COSBMAplhaField.GetValue(null); + Color ColorOfSurfaceBackgroundsModified = new Color(63, 51, 90, COSBMAplha.A); + bool canBGDraw = false; + if ((!Main.remixWorld || (Main.gameMenu && !WorldGen.remixWorldGen)) && (!WorldGen.remixWorldGen || !WorldGen.drunkWorldGen)) + canBGDraw = true; + if (Main.mapFullscreen) + canBGDraw = false; + int offset = 30; + if (Main.gameMenu) + offset = 0; + if (WorldGen.drunkWorldGen) + offset = -180; + float surfacePosition = (float)Main.worldSurface; + if (surfacePosition == 0f) + surfacePosition = 1f; + float screenPosition = Main.screenPosition.Y + (float)(Main.screenHeight / 2) - 600f; + double backgroundTopMagicNumber = (0f - screenPosition + screenOff / 2f) / (surfacePosition * 16f); + float bgGlobalScaleMultiplier = 2f; + int pushBGTopHack; + int offset2 = -180; + int menuOffset = 0; + if (Main.gameMenu) + { + menuOffset -= offset2; + } + pushBGTopHack = menuOffset; + pushBGTopHack += offset; + pushBGTopHack += offset2; + if (canBGDraw) + { + var bgScale = 1.25f; + var bgParallax = 0.4; + var bgTopY = (int)(backgroundTopMagicNumber * 1800.0 + 1500.0) + (int)scAdj + pushBGTopHack; + bgScale *= bgGlobalScaleMultiplier; + var bgWidthScaled = (int)((float)CalamityMod.AstralDesertSurfaceMiddle.Width * bgScale); + SkyManager.Instance.DrawToDepth(Main.spriteBatch, 1.2f / (float)bgParallax); + var bgStartX = (int)(0.0 - Math.IEEERemainder((double)Main.screenPosition.X * bgParallax, bgWidthScaled) - (double)(bgWidthScaled / 2)); + if (Main.gameMenu) + bgTopY = 320 + pushBGTopHack; + + var bgLoops = Main.screenWidth / bgWidthScaled + 2; + if ((double)Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0) + { + for (int i = 0; i < bgLoops; i++) + { + Main.spriteBatch.Draw(CalamityMod.AstralDesertSurfaceMiddle, new Vector2(bgStartX + bgWidthScaled * i, bgTopY + MiddleBGYOffset), new Rectangle(0, 0, CalamityMod.AstralDesertSurfaceMiddle.Width, CalamityMod.AstralDesertSurfaceMiddle.Height), ColorOfSurfaceBackgroundsModified, 0f, default(Vector2), bgScale, SpriteEffects.None, 0f); + } + } + + bgScale = 1.31f; + bgParallax = 0.43; + bgTopY = (int)(backgroundTopMagicNumber * 1950.0 + 1750.0) + (int)scAdj + pushBGTopHack; + bgScale *= bgGlobalScaleMultiplier; + bgWidthScaled = (int)((float)CalamityMod.AstralDesertSurfaceClose.Width * bgScale); + SkyManager.Instance.DrawToDepth(Main.spriteBatch, 1f / (float)bgParallax); + bgStartX = (int)(0.0 - Math.IEEERemainder((double)Main.screenPosition.X * bgParallax, bgWidthScaled) - (double)(bgWidthScaled / 2)); + if (Main.gameMenu) + { + bgTopY = 400 + pushBGTopHack; + bgStartX -= 80; + } + + bgLoops = Main.screenWidth / bgWidthScaled + 2; + if ((double)Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0) + { + for (int i = 0; i < bgLoops; i++) + { + Main.spriteBatch.Draw(CalamityMod.AstralDesertSurfaceClose, new Vector2(bgStartX + bgWidthScaled * i, bgTopY + CloseBGYOffset), new Rectangle(0, 0, CalamityMod.AstralDesertSurfaceClose.Width, CalamityMod.AstralDesertSurfaceClose.Height), ColorOfSurfaceBackgroundsModified, 0f, default(Vector2), bgScale, SpriteEffects.None, 0f); + } + } + } + return false; + } } } diff --git a/Backgrounds/AstralDesertSurfaceFar.png b/Backgrounds/AstralDesertSurfaceFar.png index a2337a7d8f..e8b7a01e29 100644 Binary files a/Backgrounds/AstralDesertSurfaceFar.png and b/Backgrounds/AstralDesertSurfaceFar.png differ diff --git a/Backgrounds/AstralSnowSurfaceBGStyle.cs b/Backgrounds/AstralSnowSurfaceBGStyle.cs index 993decd710..239fc427b3 100644 --- a/Backgrounds/AstralSnowSurfaceBGStyle.cs +++ b/Backgrounds/AstralSnowSurfaceBGStyle.cs @@ -1,18 +1,25 @@ -using Terraria.ModLoader; +using Microsoft.Xna.Framework.Graphics; +using System.Reflection; +using System; +using Terraria.Graphics.Effects; +using Terraria; +using Terraria.ModLoader; +using Microsoft.Xna.Framework; +using Terraria.GameContent.UI.States; namespace CalamityMod.Backgrounds { public class AstralSnowSurfaceBGStyle : ModSurfaceBackgroundStyle { - public override int ChooseFarTexture() => BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/BlankPixel"); - - public override int ChooseMiddleTexture() => BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/BlankPixel"); - - public override int ChooseCloseTexture(ref float scale, ref double parallax, ref float a, ref float b) => BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/BlankPixel"); + internal static readonly FieldInfo screenOffField = typeof(Main).GetField("screenOff", BindingFlags.Instance | BindingFlags.NonPublic); + internal static readonly FieldInfo scAdjField = typeof(Main).GetField("scAdj", BindingFlags.Instance | BindingFlags.NonPublic); + internal static readonly FieldInfo COSBMAplhaField = typeof(Main).GetField("ColorOfSurfaceBackgroundsModified", BindingFlags.Static | BindingFlags.NonPublic); + readonly int FrontBGYOffset = 275; + readonly int CloseBGYOffset = 175; + readonly int MiddleBGYOffset = 475; public override void ModifyFarFades(float[] fades, float transitionSpeed) { - // This just fades in the background and fades out other backgrounds. for (int i = 0; i < fades.Length; i++) { if (i == Slot) @@ -29,5 +36,113 @@ namespace CalamityMod.Backgrounds } } } + + public override int ChooseFarTexture() => BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/AstralSurfaceHorizon"); + + public override int ChooseMiddleTexture() => BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/AstralSurfaceFar"); + + public override int ChooseCloseTexture(ref float scale, ref double parallax, ref float a, ref float b) => BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Skies/AstralSnowSurfaceMiddle"); + + public override bool PreDrawCloseBackground(SpriteBatch spriteBatch) + { + //Please see AstralSurfaceBGStyle for comments, code is pretty much identical here + float screenOff = (float)screenOffField.GetValue(Main.instance); + float scAdj = (float)scAdjField.GetValue(Main.instance); + Color COSBMAplha = (Color)COSBMAplhaField.GetValue(null); + Color ColorOfSurfaceBackgroundsModified = new Color(63, 51, 90, COSBMAplha.A); + bool canBGDraw = false; + if ((!Main.remixWorld || (Main.gameMenu && !WorldGen.remixWorldGen)) && (!WorldGen.remixWorldGen || !WorldGen.drunkWorldGen)) + canBGDraw = true; + if (Main.mapFullscreen) + canBGDraw = false; + int offset = 30; + if (Main.gameMenu) + offset = 0; + if (WorldGen.drunkWorldGen) + offset = -180; + float surfacePosition = (float)Main.worldSurface; + if (surfacePosition == 0f) + surfacePosition = 1f; + float screenPosition = Main.screenPosition.Y + (float)(Main.screenHeight / 2) - 600f; + double backgroundTopMagicNumber = (0f - screenPosition + screenOff / 2f) / (surfacePosition * 16f); + float bgGlobalScaleMultiplier = 2f; + int pushBGTopHack; + int offset2 = -180; + int menuOffset = 0; + if (Main.gameMenu) + { + menuOffset -= offset2; + } + pushBGTopHack = menuOffset; + pushBGTopHack += offset; + pushBGTopHack += offset2; + if (canBGDraw) + { + var bgScale = 1.25f; + var bgParallax = 0.4; + var bgTopY = (int)(backgroundTopMagicNumber * 1800.0 + 1500.0) + (int)scAdj + pushBGTopHack; + bgScale *= bgGlobalScaleMultiplier; + var bgWidthScaled = (int)((float)CalamityMod.AstralSnowSurfaceMiddle.Width * bgScale); + SkyManager.Instance.DrawToDepth(Main.spriteBatch, 1.2f / (float)bgParallax); + var bgStartX = (int)(0.0 - Math.IEEERemainder((double)Main.screenPosition.X * bgParallax, bgWidthScaled) - (double)(bgWidthScaled / 2)); + if (Main.gameMenu) + bgTopY = 320 + pushBGTopHack; + + var bgLoops = Main.screenWidth / bgWidthScaled + 2; + if ((double)Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0) + { + for (int i = 0; i < bgLoops; i++) + { + Main.spriteBatch.Draw(CalamityMod.AstralSnowSurfaceMiddle, new Vector2(bgStartX + bgWidthScaled * i, bgTopY + MiddleBGYOffset), new Rectangle(0, 0, CalamityMod.AstralSnowSurfaceMiddle.Width, CalamityMod.AstralSnowSurfaceMiddle.Height), ColorOfSurfaceBackgroundsModified, 0f, default(Vector2), bgScale, SpriteEffects.None, 0f); + } + } + + bgScale = 1.31f; + bgParallax = 0.43; + bgTopY = (int)(backgroundTopMagicNumber * 1950.0 + 1750.0) + (int)scAdj + pushBGTopHack; + bgScale *= bgGlobalScaleMultiplier; + bgWidthScaled = (int)((float)CalamityMod.AstralSurfaceClose.Width * bgScale); + SkyManager.Instance.DrawToDepth(Main.spriteBatch, 1f / (float)bgParallax); + bgStartX = (int)(0.0 - Math.IEEERemainder((double)Main.screenPosition.X * bgParallax, bgWidthScaled) - (double)(bgWidthScaled / 2)); + if (Main.gameMenu) + { + bgTopY = 400 + pushBGTopHack; + bgStartX -= 80; + } + + bgLoops = Main.screenWidth / bgWidthScaled + 2; + if ((double)Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0) + { + for (int i = 0; i < bgLoops; i++) + { + Main.spriteBatch.Draw(CalamityMod.AstralSurfaceClose, new Vector2(bgStartX + bgWidthScaled * i, bgTopY + CloseBGYOffset), new Rectangle(0, 0, CalamityMod.AstralSurfaceClose.Width, CalamityMod.AstralSurfaceClose.Height), ColorOfSurfaceBackgroundsModified, 0f, default(Vector2), bgScale, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(CalamityMod.AstralSurfaceCloseGlow, new Vector2(bgStartX + bgWidthScaled * i, bgTopY + CloseBGYOffset), new Rectangle(0, 0, CalamityMod.AstralSurfaceCloseGlow.Width, CalamityMod.AstralSurfaceCloseGlow.Height), new Color(Color.White.R * 0.7f, Color.White.G * 0.7f, Color.White.B * 0.7f, COSBMAplha.A), 0f, default(Vector2), bgScale, SpriteEffects.None, 0f); + } + } + bgScale = 1.34f; + bgParallax = 0.49; + bgTopY = (int)(backgroundTopMagicNumber * 2100.0 + 2000.0) + (int)scAdj + pushBGTopHack; + bgScale *= bgGlobalScaleMultiplier; + bgWidthScaled = (int)(CalamityMod.AstralSurfaceFront.Width * bgScale); + SkyManager.Instance.DrawToDepth(Main.spriteBatch, 1f / (float)bgParallax); + bgStartX = (int)(0.0 - Math.IEEERemainder((double)Main.screenPosition.X * bgParallax, bgWidthScaled) - (double)(bgWidthScaled / 2)); + if (Main.gameMenu) + { + bgTopY = 480 + pushBGTopHack; + bgStartX -= 120; + } + + bgLoops = Main.screenWidth / bgWidthScaled + 2; + if ((double)Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0) + { + for (int i = 0; i < bgLoops; i++) + { + Main.spriteBatch.Draw(CalamityMod.AstralSurfaceFront, new Vector2(bgStartX + bgWidthScaled * i, bgTopY + FrontBGYOffset), new Rectangle(0, 0, CalamityMod.AstralSurfaceFront.Width, CalamityMod.AstralSurfaceFront.Height), ColorOfSurfaceBackgroundsModified, 0f, default(Vector2), bgScale, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(CalamityMod.AstralSurfaceFrontGlow, new Vector2(bgStartX + bgWidthScaled * i, bgTopY + FrontBGYOffset), new Rectangle(0, 0, CalamityMod.AstralSurfaceFrontGlow.Width, CalamityMod.AstralSurfaceFrontGlow.Height), new Color(Color.White.R * 0.9f, Color.White.G * 0.9f, Color.White.B * 0.9f, COSBMAplha.A), 0f, default(Vector2), bgScale, SpriteEffects.None, 0f); + } + } + } + return false; + } } } diff --git a/Backgrounds/AstralSnowSurfaceFar.png b/Backgrounds/AstralSnowSurfaceFar.png deleted file mode 100644 index e1b3614aa8..0000000000 Binary files a/Backgrounds/AstralSnowSurfaceFar.png and /dev/null differ diff --git a/Backgrounds/AstralSnowSurfaceMiddle.png b/Backgrounds/AstralSnowSurfaceMiddle.png index fc7c678756..ff4e5fc236 100644 Binary files a/Backgrounds/AstralSnowSurfaceMiddle.png and b/Backgrounds/AstralSnowSurfaceMiddle.png differ diff --git a/Backgrounds/AstralSurfaceBGStyle.cs b/Backgrounds/AstralSurfaceBGStyle.cs index 8c8a7ee21c..c89092d701 100644 --- a/Backgrounds/AstralSurfaceBGStyle.cs +++ b/Backgrounds/AstralSurfaceBGStyle.cs @@ -1,22 +1,24 @@ -using Terraria.ModLoader; +using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework; +using System.Reflection; +using System; +using Terraria.Graphics.Effects; +using Terraria; +using Terraria.ModLoader; namespace CalamityMod.Backgrounds { public class AstralSurfaceBGStyle : ModSurfaceBackgroundStyle { - public override int ChooseFarTexture() => BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/BlankPixel"); - - public override int ChooseMiddleTexture() => BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/BlankPixel"); - - public override int ChooseCloseTexture(ref float scale, ref double parallax, ref float a, ref float b) - { - scale *= 0.75f; - return BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/BlankPixel"); - } + internal static readonly FieldInfo screenOffField = typeof(Main).GetField("screenOff", BindingFlags.Instance | BindingFlags.NonPublic); + internal static readonly FieldInfo scAdjField = typeof(Main).GetField("scAdj", BindingFlags.Instance | BindingFlags.NonPublic); + internal static readonly FieldInfo COSBMAplhaField = typeof(Main).GetField("ColorOfSurfaceBackgroundsModified", BindingFlags.Static | BindingFlags.NonPublic); + readonly int FrontBGYOffset = 275; //Offsets for the height positioning. Make these 0 for backgrounds that want to be the same as treeline backgrounds (backgrounds that have the front 3 layers as trees) + readonly int CloseBGYOffset = 175; + readonly int MiddleBGYOffset = 475; public override void ModifyFarFades(float[] fades, float transitionSpeed) { - // This just fades in the background and fades out other backgrounds. for (int i = 0; i < fades.Length; i++) { if (i == Slot) @@ -33,5 +35,120 @@ namespace CalamityMod.Backgrounds } } } + + public override int ChooseFarTexture() => BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/AstralSurfaceHorizon"); //5th layer (Horizon) + + public override int ChooseMiddleTexture() => BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/AstralSurfaceFar"); //4th layer (Far) + + public override int ChooseCloseTexture(ref float scale, ref double parallax, ref float a, ref float b) => BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Skies/AstralSurfaceMiddle"); //Fallback texture, not nessesarily needed since predraw returns false + + public override bool PreDrawCloseBackground(SpriteBatch spriteBatch) //Taken from vanilla to draw the front 3 layers, edited to fit tmod and astral background needs + { + float screenOff = (float)screenOffField.GetValue(Main.instance); + float scAdj = (float)scAdjField.GetValue(Main.instance); + Color COSBMAplha = (Color)COSBMAplhaField.GetValue(null); + Color ColorOfSurfaceBackgroundsModified = new Color(63, 51, 90, COSBMAplha.A); //Astral Biome Coloration with the alpha as the background fade + bool canBGDraw = false; + if ((!Main.remixWorld || (Main.gameMenu && !WorldGen.remixWorldGen)) && (!WorldGen.remixWorldGen || !WorldGen.drunkWorldGen)) + canBGDraw = true; + if (Main.mapFullscreen) + canBGDraw = false; + int offset = 30; + if (Main.gameMenu) + offset = 0; + if (WorldGen.drunkWorldGen) + offset = -180; + float surfacePosition = (float)Main.worldSurface; + if (surfacePosition == 0f) + surfacePosition = 1f; + float screenPosition = Main.screenPosition.Y + (float)(Main.screenHeight / 2) - 600f; + double backgroundTopMagicNumber = (0f - screenPosition + screenOff / 2f) / (surfacePosition * 16f); + float bgGlobalScaleMultiplier = 2f; + int pushBGTopHack; + int offset2 = -180; + int menuOffset = 0; + if (Main.gameMenu) + { + menuOffset -= offset2; + } + pushBGTopHack = menuOffset; + pushBGTopHack += offset; + pushBGTopHack += offset2; //Offsets to the background placement + if (canBGDraw) //If the background can draw (player is not in a remix world or is not in a map). This can probably be removed since backgrounds already go through these checks + { + //3rd layer (Middle) + var bgScale = 1.25f; //Scale of the furthest of the closest background layers (3rd layer) + var bgParallax = 0.4; //The parallax of the background layer + var bgTopY = (int)(backgroundTopMagicNumber * 1800.0 + 1500.0) + (int)scAdj + pushBGTopHack; //the Y position of the background + bgScale *= bgGlobalScaleMultiplier; //Scale of the background + var bgWidthScaled = (int)((float)CalamityMod.AstralSurfaceMiddle.Width * bgScale); //The Width of the bg texture scaled to the correct size + SkyManager.Instance.DrawToDepth(Main.spriteBatch, 1.2f / (float)bgParallax); + var bgStartX = (int)(0.0 - Math.IEEERemainder((double)Main.screenPosition.X * bgParallax, bgWidthScaled) - (double)(bgWidthScaled / 2)); //The starting position of the background layer + if (Main.gameMenu) + bgTopY = 320 + pushBGTopHack; //increases the height in the main menu + + var bgLoops = Main.screenWidth / bgWidthScaled + 2; + if ((double)Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0) + { + for (int i = 0; i < bgLoops; i++) + { + //Draw the texture and its glowmask to each loop of the texture + Main.spriteBatch.Draw(CalamityMod.AstralSurfaceMiddle, new Vector2(bgStartX + bgWidthScaled * i, bgTopY + MiddleBGYOffset), new Rectangle(0, 0, CalamityMod.AstralSurfaceMiddle.Width, CalamityMod.AstralSurfaceMiddle.Height), ColorOfSurfaceBackgroundsModified, 0f, default(Vector2), bgScale, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(CalamityMod.AstralSurfaceMiddleGlow, new Vector2(bgStartX + bgWidthScaled * i, bgTopY + MiddleBGYOffset), new Rectangle(0, 0, CalamityMod.AstralSurfaceMiddleGlow.Width, CalamityMod.AstralSurfaceMiddleGlow.Height), new Color(Color.White.R * 0.5f, Color.White.G * 0.5f, Color.White.B * 0.5f, COSBMAplha.A), 0f, default(Vector2), bgScale, SpriteEffects.None, 0f); + } + } + + //2nd layer (Close) + //Repeat of above with slight changes to variables + bgScale = 1.31f; + bgParallax = 0.43; + bgTopY = (int)(backgroundTopMagicNumber * 1950.0 + 1750.0) + (int)scAdj + pushBGTopHack; + bgScale *= bgGlobalScaleMultiplier; + bgWidthScaled = (int)((float)CalamityMod.AstralSurfaceClose.Width * bgScale); + SkyManager.Instance.DrawToDepth(Main.spriteBatch, 1f / (float)bgParallax); + bgStartX = (int)(0.0 - Math.IEEERemainder((double)Main.screenPosition.X * bgParallax, bgWidthScaled) - (double)(bgWidthScaled / 2)); + if (Main.gameMenu) + { + bgTopY = 400 + pushBGTopHack; + bgStartX -= 80; //the initial postion of where the background starts in the main menu is pushed back to not be directly ontop, mostly for tree bgs that use the same treeline texture but faded + } + + bgLoops = Main.screenWidth / bgWidthScaled + 2; + if ((double)Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0) + { + for (int i = 0; i < bgLoops; i++) + { + Main.spriteBatch.Draw(CalamityMod.AstralSurfaceClose, new Vector2(bgStartX + bgWidthScaled * i, bgTopY + CloseBGYOffset), new Rectangle(0, 0, CalamityMod.AstralSurfaceClose.Width, CalamityMod.AstralSurfaceClose.Height), ColorOfSurfaceBackgroundsModified, 0f, default(Vector2), bgScale, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(CalamityMod.AstralSurfaceCloseGlow, new Vector2(bgStartX + bgWidthScaled * i, bgTopY + CloseBGYOffset), new Rectangle(0, 0, CalamityMod.AstralSurfaceCloseGlow.Width, CalamityMod.AstralSurfaceCloseGlow.Height), new Color(Color.White.R * 0.7f, Color.White.G * 0.7f, Color.White.B * 0.7f, COSBMAplha.A), 0f, default(Vector2), bgScale, SpriteEffects.None, 0f); + } + } + + //1st layer (Front) + //Repeat of above with slight changes to variables + bgScale = 1.34f; + bgParallax = 0.49; + bgTopY = (int)(backgroundTopMagicNumber * 2100.0 + 2000.0) + (int)scAdj + pushBGTopHack; + bgScale *= bgGlobalScaleMultiplier; + bgWidthScaled = (int)(CalamityMod.AstralSurfaceFront.Width * bgScale); + SkyManager.Instance.DrawToDepth(Main.spriteBatch, 1f / (float)bgParallax); + bgStartX = (int)(0.0 - Math.IEEERemainder((double)Main.screenPosition.X * bgParallax, bgWidthScaled) - (double)(bgWidthScaled / 2)); + if (Main.gameMenu) + { + bgTopY = 480 + pushBGTopHack; + bgStartX -= 120; + } + + bgLoops = Main.screenWidth / bgWidthScaled + 2; + if ((double)Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0) + { + for (int i = 0; i < bgLoops; i++) + { + Main.spriteBatch.Draw(CalamityMod.AstralSurfaceFront, new Vector2(bgStartX + bgWidthScaled * i, bgTopY + FrontBGYOffset), new Rectangle(0, 0, CalamityMod.AstralSurfaceFront.Width, CalamityMod.AstralSurfaceFront.Height), ColorOfSurfaceBackgroundsModified, 0f, default(Vector2), bgScale, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(CalamityMod.AstralSurfaceFrontGlow, new Vector2(bgStartX + bgWidthScaled * i, bgTopY + FrontBGYOffset), new Rectangle(0, 0, CalamityMod.AstralSurfaceFrontGlow.Width, CalamityMod.AstralSurfaceFrontGlow.Height), new Color(Color.White.R * 0.9f, Color.White.G * 0.9f, Color.White.B * 0.9f, COSBMAplha.A), 0f, default(Vector2), bgScale, SpriteEffects.None, 0f); + } + } + } + return false; //Stop the drawing of the base close background texture (note: does NOT stop the drawing of the Middle and Far textures because tmodloader is slight stupid :blushing:) + } } } diff --git a/Backgrounds/AstralSurfaceClose.png b/Backgrounds/AstralSurfaceClose.png index 6701b9a71c..166e8bc48d 100644 Binary files a/Backgrounds/AstralSurfaceClose.png and b/Backgrounds/AstralSurfaceClose.png differ diff --git a/Skies/AstralSurfaceCloseGlow.png b/Backgrounds/AstralSurfaceCloseGlow.png similarity index 100% rename from Skies/AstralSurfaceCloseGlow.png rename to Backgrounds/AstralSurfaceCloseGlow.png diff --git a/Backgrounds/AstralSurfaceFar.png b/Backgrounds/AstralSurfaceFar.png index 9285cefdae..6e90155b16 100644 Binary files a/Backgrounds/AstralSurfaceFar.png and b/Backgrounds/AstralSurfaceFar.png differ diff --git a/Backgrounds/AstralSurfaceFogBGStyle.cs b/Backgrounds/AstralSurfaceFogBGStyle.cs deleted file mode 100644 index aab1ea3fba..0000000000 --- a/Backgrounds/AstralSurfaceFogBGStyle.cs +++ /dev/null @@ -1,37 +0,0 @@ -using Terraria.ModLoader; - -namespace CalamityMod.Backgrounds -{ - public class AstralSurfaceFogBGStyle : ModSurfaceBackgroundStyle - { - public override int ChooseFarTexture() => BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/BlankPixel"); - - public override int ChooseMiddleTexture() => BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/BlankPixel"); - - public override int ChooseCloseTexture(ref float scale, ref double parallax, ref float a, ref float b) - { - scale *= 0.75f; - return BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/BlankPixel"); - } - - public override void ModifyFarFades(float[] fades, float transitionSpeed) - { - // This just fades in the background and fades out other backgrounds. - for (int i = 0; i < fades.Length; i++) - { - if (i == Slot) - { - 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/AstralSurfaceFront.png b/Backgrounds/AstralSurfaceFront.png new file mode 100644 index 0000000000..5d603a737b Binary files /dev/null and b/Backgrounds/AstralSurfaceFront.png differ diff --git a/Skies/AstralSurfaceFrontGlow.png b/Backgrounds/AstralSurfaceFrontGlow.png similarity index 100% rename from Skies/AstralSurfaceFrontGlow.png rename to Backgrounds/AstralSurfaceFrontGlow.png diff --git a/Backgrounds/AstralSurfaceHorizon.png b/Backgrounds/AstralSurfaceHorizon.png new file mode 100644 index 0000000000..fa58141a90 Binary files /dev/null and b/Backgrounds/AstralSurfaceHorizon.png differ diff --git a/Backgrounds/AstralSurfaceMiddle.png b/Backgrounds/AstralSurfaceMiddle.png index 89b568c3be..d3f984c001 100644 Binary files a/Backgrounds/AstralSurfaceMiddle.png and b/Backgrounds/AstralSurfaceMiddle.png differ diff --git a/Skies/AstralSurfaceMiddleGlow.png b/Backgrounds/AstralSurfaceMiddleGlow.png similarity index 100% rename from Skies/AstralSurfaceMiddleGlow.png rename to Backgrounds/AstralSurfaceMiddleGlow.png diff --git a/Backgrounds/AstralUG4_0.png b/Backgrounds/AstralUG4_0.png new file mode 100644 index 0000000000..73f3bad550 Binary files /dev/null and b/Backgrounds/AstralUG4_0.png differ diff --git a/Backgrounds/AstralUG4_1.png b/Backgrounds/AstralUG4_1.png new file mode 100644 index 0000000000..bf9978ceeb Binary files /dev/null and b/Backgrounds/AstralUG4_1.png differ diff --git a/Backgrounds/AstralUG4_2.png b/Backgrounds/AstralUG4_2.png new file mode 100644 index 0000000000..b36e95b213 Binary files /dev/null and b/Backgrounds/AstralUG4_2.png differ diff --git a/Backgrounds/AstralUndergroundBGStyle.cs b/Backgrounds/AstralUndergroundBGStyle.cs index 71f1ec2c50..f3c9455798 100644 --- a/Backgrounds/AstralUndergroundBGStyle.cs +++ b/Backgrounds/AstralUndergroundBGStyle.cs @@ -1,4 +1,5 @@ -using Terraria.ModLoader; +using Terraria; +using Terraria.ModLoader; namespace CalamityMod.Backgrounds { @@ -6,8 +7,8 @@ namespace CalamityMod.Backgrounds { public override void FillTextureArray(int[] textureSlots) { - for (int i = 0; i <= 3; i++) - textureSlots[i] = BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/AstralUG" + i.ToString()); + for (int i = 0; i <= 4; i++) + textureSlots[i] = BackgroundTextureLoader.GetBackgroundSlot(i == 4 ? "CalamityMod/Backgrounds/AstralUG" + i.ToString() + "_" + Main.hellBackStyle : "CalamityMod/Backgrounds/AstralUG" + i.ToString()); } } } diff --git a/Backgrounds/SunkenSeaBGStyle.cs b/Backgrounds/SunkenSeaBGStyle.cs index 7079491989..8911537bb3 100644 --- a/Backgrounds/SunkenSeaBGStyle.cs +++ b/Backgrounds/SunkenSeaBGStyle.cs @@ -10,4 +10,4 @@ namespace CalamityMod.Backgrounds textureSlots[i] = BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/SunkenSeaBG" + i.ToString()); } } -} \ No newline at end of file +} diff --git a/Balancing/BalancingChangesManager.cs b/Balancing/BalancingChangesManager.cs index 338820b1f8..3daca26a39 100644 --- a/Balancing/BalancingChangesManager.cs +++ b/Balancing/BalancingChangesManager.cs @@ -1,27 +1,28 @@ -using CalamityMod.NPCs.AstrumAureus; +using System.Collections.Generic; +using System.Linq; +using CalamityMod.NPCs.AstrumAureus; using CalamityMod.NPCs.CeaselessVoid; using CalamityMod.NPCs.Crabulon; using CalamityMod.NPCs.ExoMechs.Apollo; using CalamityMod.NPCs.ExoMechs.Artemis; using CalamityMod.NPCs.OldDuke; +using CalamityMod.NPCs.ProfanedGuardians; using CalamityMod.NPCs.Providence; using CalamityMod.NPCs.Ravager; using CalamityMod.NPCs.SupremeCalamitas; +using CalamityMod.NPCs.Yharon; +using CalamityMod.Projectiles.DraedonsArsenal; using CalamityMod.Projectiles.Magic; using CalamityMod.Projectiles.Melee; using CalamityMod.Projectiles.Ranged; using CalamityMod.Projectiles.Rogue; using CalamityMod.Projectiles.Summon; +using CalamityMod.Projectiles.Summon.MirrorofKalandraMinions; using CalamityMod.Projectiles.Typeless; -using CalamityMod.Projectiles.DraedonsArsenal; -using System.Collections.Generic; -using System.Linq; using Terraria; using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; -using CalamityMod.NPCs.ProfanedGuardians; -using CalamityMod.NPCs.Yharon; namespace CalamityMod.Balancing { @@ -61,6 +62,10 @@ namespace CalamityMod.Balancing UniversalBalancingChanges = new List() { + // Nerf Crystal bullet shards by 45% + // Currently crystal bullet projectiles deal 50% of the bullet's damage which is absurd in vanilla, this nerfs them to 27.5% + Do(new ProjectileResistBalancingRule(0.55f, ProjectileID.CrystalShard)), + // Nerf Luminite Arrow trails by 50%. Do(new ProjectileResistBalancingRule(0.5f, ProjectileID.MoonlordArrowTrail)), @@ -75,6 +80,7 @@ namespace CalamityMod.Balancing // Nerf Spectre Mask set bonus projectiles by 30%. Do(new ProjectileSpecificRequirementBalancingRule(0.7f, SpectreMaskSetBonusFilter)), + }; NPCSpecificBalancingChanges = new List(); @@ -93,7 +99,7 @@ namespace CalamityMod.Balancing // 50% resist to true melee. NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCID.Creeper, Do(ResistTrueMelee(0.5f)))); - // 50% resist to Demon Scythes. + // 50% resist to Demon Scythe. NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCID.Creeper, Do(new ProjectileResistBalancingRule(0.5f, ProjectileID.DemonScythe)))); #endregion @@ -101,14 +107,11 @@ namespace CalamityMod.Balancing // 50% resist to true melee. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.EaterofWorldsIDs, Do(ResistTrueMelee(0.5f)))); - // 50% resist to Demon Scythes. + // 50% resist to Demon Scythe. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.EaterofWorldsIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileID.DemonScythe)))); // 40% resist to Sky Glaze. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.EaterofWorldsIDs, Do(new ProjectileResistBalancingRule(0.6f, ProjectileType())))); - - // 30% resist to Jester Arrows. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.EaterofWorldsIDs, Do(new ProjectileResistBalancingRule(0.7f, ProjectileID.JestersArrow)))); #endregion #region The Perforators @@ -116,98 +119,164 @@ namespace CalamityMod.Balancing NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.PerforatorIDs, Do(ResistTrueMelee(0.5f)))); #endregion + #region Wall of Flesh + // 40% resist to Corro/Crimslime Staff. + NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCID.WallofFleshEye, Do(new ProjectileResistBalancingRule(0.6f, ProjectileType(), ProjectileType())))); + #endregion + #region Aquatic Scourge // 50% resist to true melee. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AquaticScourgeIDs, Do(ResistTrueMelee(0.5f)))); - // 50% resist to Dormant Brimseekers. + // 50% resist to Adamantite Throwing Axe's lightning. + // Twisting Thunder and Gael's Greatsword use this projectile too, but they are far beyond progression, so who cares! + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AquaticScourgeIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileID.CultistBossLightningOrbArc)))); + + // 50% resist to Dormant Brimseeker. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AquaticScourgeIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); + // 50% resist to Mounted Scanner. + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AquaticScourgeIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); + // 40% resist to Cryophobia. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AquaticScourgeIDs, Do(new ProjectileResistBalancingRule(0.6f, ProjectileType())))); + // 40% resist to SHPC. + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AquaticScourgeIDs, Do(new ProjectileResistBalancingRule(0.6f, ProjectileType())))); + // 30% resist to Meowthrower. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AquaticScourgeIDs, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType())))); + + // 25% resist to Snowstorm Staff. + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AquaticScourgeIDs, Do(new ProjectileResistBalancingRule(0.75f, ProjectileType(), ProjectileType())))); #endregion #region The Destroyer // 50% resist to true melee. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DestroyerIDs, Do(ResistTrueMelee(0.5f)))); - // 50% resist to Dormant Brimseekers. + // 50% resist to Adamantite Throwing Axe's lightning. + // See Aquatic Scourge comment. + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DestroyerIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileID.CultistBossLightningOrbArc)))); + + // 50% resist to Aftershock's rocks. + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DestroyerIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); + + // 50% resist to Avalanche's Ice Bombs and shards. + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DestroyerIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType(), ProjectileType())))); + + // 50% resist to Dormant Brimseeker. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DestroyerIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); - // 40% resist to Cryophobia. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DestroyerIDs, Do(new ProjectileResistBalancingRule(0.6f, ProjectileType())))); + // 45% resist to Mounted Scanner. + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DestroyerIDs, Do(new ProjectileResistBalancingRule(0.55f, ProjectileType())))); // 40% resist to Meowthrower. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DestroyerIDs, Do(new ProjectileResistBalancingRule(0.6f, ProjectileType())))); - // 15% resist to Mineral Mortar's Projectile. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DestroyerIDs, Do(new ProjectileResistBalancingRule(0.85f, ProjectileType())))); + // 25% resist to SHPC. + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DestroyerIDs, Do(new ProjectileResistBalancingRule(0.75f, ProjectileType())))); - // 15% resist to Snowstorm Staff. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DestroyerIDs, Do(new ProjectileResistBalancingRule(0.85f, ProjectileType())))); + // 25% resist to Snowstorm Staff. + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DestroyerIDs, Do(new ProjectileResistBalancingRule(0.75f, ProjectileType(), ProjectileType())))); #endregion #region Astrum Aureus - // 35% resist to The Ballista's greatarrows. - NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), Do(new ProjectileResistBalancingRule(0.65f, ProjectileType())))); + // 30% resist to The Ballista's greatarrows. + NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), Do(new ProjectileResistBalancingRule(0.7f, ProjectileType())))); #endregion #region Ravager // 50% resist to true melee. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.RavagerIDs, Do(ResistTrueMelee(0.5f)))); - // 40% resist to Flying Dragon. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.RavagerIDs, Do(new ProjectileResistBalancingRule(0.6f, ProjectileID.DD2SquireSonicBoom)))); + // 50% resist to Aegis Blade's explosions because the true melee resist ain't enough. + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.RavagerIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); + // 50% resist to Icicle Arrows. + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.RavagerIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); + + // 35% resist to Flying Dragon. + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.RavagerIDs, Do(new ProjectileResistBalancingRule(0.65f, ProjectileID.DD2SquireSonicBoom)))); + + // 30% resist to Aurora Blazer. + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.RavagerIDs, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType())))); + + // 30% resist to Flak Kraken. + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.RavagerIDs, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType())))); + + // 25% resist to Lucrecia. + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.RavagerIDs, Do(new ProjectileResistBalancingRule(0.75f, ProjectileType())))); + + // 20% resist to The Hive. + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.RavagerIDs, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType(), ProjectileType())))); #endregion #region Duke Fishron + // 20% vulnerability to The Hive's bees. + NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCID.DukeFishron, Do(new ProjectileResistBalancingRule(1.2f, ProjectileType())))); + // 35% vulnerability to Resurrection Butterfly. NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCID.DukeFishron, Do(new ProjectileResistBalancingRule(1.35f, ProjectileType(), ProjectileType())))); #endregion #region Empress of Light + // 25% resist to Abyss Blade's blade. + NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCID.HallowBoss, Do(new ProjectileResistBalancingRule(0.75f, ProjectileType())))); + // 20% resist to Plague Tainted SMG's drones. NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCID.HallowBoss, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType())))); #endregion #region Lunatic Cultist - // 25% resist to Resurrection Butterfly. - NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCID.CultistBoss, Do(new ProjectileResistBalancingRule(0.75f, ProjectileType(), ProjectileType())))); + // 50% resist to Aegis Blade's explosions. + NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCID.CultistBoss, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); + + // 35% resist to Subduction Slicer's flame pillars. + NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCID.CultistBoss, Do(new ProjectileResistBalancingRule(0.65f, ProjectileType())))); // 20% resist to Art Attack. NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCID.CultistBoss, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType())))); // 20% resist to Nightglow. NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCID.CultistBoss, Do(new ProjectileResistBalancingRule(0.8f, ProjectileID.FairyQueenMagicItemShot)))); + + // 20% resist to Resurrection Butterfly. + NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCID.CultistBoss, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType(), ProjectileType())))); #endregion #region Astrum Deus // 75% resist to Plaguenades. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AstrumDeusIDs, Do(new ProjectileResistBalancingRule(0.25f, ProjectileType(), ProjectileType())))); - // 70% resist to the Stardust Dragon. + // 70% resist to Stardust Dragon Staff. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AstrumDeusIDs, Do(new ProjectileResistBalancingRule(0.3f, ProjectileID.StardustDragon1, ProjectileID.StardustDragon2, ProjectileID.StardustDragon3, ProjectileID.StardustDragon4)))); - // 70% resist to Aurora Blazer. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AstrumDeusIDs, Do(new ProjectileResistBalancingRule(0.3f, ProjectileType())))); + // 70% resist to Charged Blaster Cannon. + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AstrumDeusIDs, Do(new ProjectileResistBalancingRule(0.3f, ProjectileID.ChargedBlasterLaser)))); + + // 60% resist to Aurora Blazer. + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AstrumDeusIDs, Do(new ProjectileResistBalancingRule(0.4f, ProjectileType())))); + + // 55% resist to Flak Kraken. + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AstrumDeusIDs, Do(new ProjectileResistBalancingRule(0.45f, ProjectileType())))); // 50% resist to true melee. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AstrumDeusIDs, Do(ResistTrueMelee(0.5f)))); - // 25% resist to Resurrection Butterfly. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AstrumDeusIDs, Do(new ProjectileResistBalancingRule(0.75f, ProjectileType(), ProjectileType())))); + // 35% resist to Icicle Arrows. + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AstrumDeusIDs, Do(new ProjectileResistBalancingRule(0.65f, ProjectileType())))); + + // 20% resist to Cluster Fragments. + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AstrumDeusIDs, Do(new ProjectileResistBalancingRule(0.8f, ProjectileID.ClusterFragmentsI, ProjectileID.ClusterFragmentsII)))); #endregion #region Moon Lord - // 90% resist to Mercurial Tides (True Biome Blade). - NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCID.MoonLordCore, Do(new ProjectileResistBalancingRule(0.1f, ProjectileType(), ProjectileType(), ProjectileType())))); + // 20% resist to Mercurial Tides (True Biome Blade). + NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCID.MoonLordCore, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType(), ProjectileType(), ProjectileType())))); - // 15% resist to Pestilent Defiler. - NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCID.MoonLordCore, Do(new ProjectileResistBalancingRule(0.85f, ProjectileType(), ProjectileType())))); + // 20% resist to The Hive's nuke. + NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCID.MoonLordCore, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType())))); #endregion #region Profaned Guardians @@ -218,52 +287,54 @@ namespace CalamityMod.Balancing #region Providence // 80% resist to Hell's Sun. NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), new ProjectileResistBalancingRule(0.2f, ProjectileType()))); + + // 35% resist to Elemental Lance. This thing desperately needs a rework. + NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), new ProjectileResistBalancingRule(0.65f, ProjectileType(), ProjectileType(), ProjectileType(), ProjectileType()))); #endregion #region Ceaseless Void: Dark Energies // 50% resist to true melee. NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), ResistTrueMelee(0.5f))); + + // 40% resist to Stellar Torus Staff. + NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), new ProjectileResistBalancingRule(0.6f, ProjectileType()))); #endregion #region Storm Weaver // 50% resist to true melee. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.StormWeaverIDs, Do(ResistTrueMelee(0.5f)))); - // 50% resist to Dazzling Stabbers. + // 50% resist to Dazzling Stabber Staff. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.StormWeaverIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); - // 50% resist to Elemental Axes. + // 50% resist to Elemental Axe. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.StormWeaverIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); // 50% resist to Pristine Fury's alt fire. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.StormWeaverIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); - // 50% resist to Tactician's Trump Card explosions. + // 50% resist to Tactician's Trump Card's explosions. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.StormWeaverIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); - // 25% resist to Molten Amputator blobs. + // 25% resist to Molten Amputator's blobs. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.StormWeaverIDs, Do(new ProjectileResistBalancingRule(0.75f, ProjectileType())))); #endregion #region Old Duke - // 60% resist to Last Mourning. - // This will technically catch pumpkins from the Horseman's Blade but that shouldn't really matter. - NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), new ProjectileResistBalancingRule(0.4f, ProjectileType(), ProjectileID.FlamingJack))); - // 20% resist to Time Bolt. NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), new ProjectileResistBalancingRule(0.8f, ProjectileType()))); #endregion #region The Devourer of Gods + // 80% resist to Wave Pounder. + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DevourerOfGodsIDs, Do(new ProjectileResistBalancingRule(0.2f, ProjectileType())))); + // 50% resist to Eidolic Wail. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DevourerOfGodsIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); - // 40% resist to Wave Pounder. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DevourerOfGodsIDs, Do(new ProjectileResistBalancingRule(0.6f, ProjectileType())))); - // 35% resist to Venusian Trident's explosions. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DevourerOfGodsIDs, Do(new ProjectileResistBalancingRule(0.65f, ProjectileType(), ProjectileType())))); - + // 20% resist to Valediction's typhoons; will catch Nuclear Fury as well but that doesn't matter. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DevourerOfGodsIDs, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType())))); @@ -295,17 +366,14 @@ namespace CalamityMod.Balancing // 20% resist to Eclipse's Fall. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AresIDs, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType(), ProjectileType())))); + // 20% resist to Rancor. + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AresIDs, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType())))); + // 20% resist to Yharim's Crystal. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AresIDs, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType())))); // 20% resist to Zenith. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AresIDs, Do(new ProjectileResistBalancingRule(0.8f, ProjectileID.FinalFractal)))); - - // 15% resist to Enforcer projectiles. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AresIDs, Do(new ProjectileResistBalancingRule(0.85f, ProjectileType())))); - - // 15% resist to Murasama. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AresIDs, Do(new ProjectileResistBalancingRule(0.85f, ProjectileType())))); #endregion #region Exo Mechs: Artemis and Apollo @@ -313,7 +381,7 @@ namespace CalamityMod.Balancing // TODO -- NPC sets (mostly worm bosses) should probably be their own holding class. int[] exoTwins = new int[] { NPCType(), NPCType() }; - // 10% resist to Eclipse's Fall stealth strike. + // 10% resist to Eclipse's Fall's mini spears. NPCSpecificBalancingChanges.AddRange(Bundle(exoTwins, Do(new ProjectileResistBalancingRule(0.9f, ProjectileType())))); #endregion @@ -321,10 +389,13 @@ namespace CalamityMod.Balancing // 65% resist to true melee. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(ResistTrueMelee(0.35f)))); - // 65% resist to Enforcer projectiles. + // 65% resist to Stellar Torus Staff. + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.35f, ProjectileType())))); + + // 65% resist to The Enforcer's projectiles. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.35f, ProjectileType())))); - // 65% resist to Final Dawn lunge. + // 65% resist to The Final Dawn's lunge. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.35f, ProjectileType())))); // 60% resist to Dynamic Pursuer. @@ -333,37 +404,37 @@ namespace CalamityMod.Balancing // 50% resist to Chicken Cannon. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); - // 50% resist to Tarragon Throwing Darts Thorns. (LOL) + // 50% resist to Rancor. + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); + + // 50% resist to Tarragon Throwing Dart's thorns. (LOL) NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); - // 50% resist to Vehemence skulls. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType(), ProjectileType())))); + // 50% resist to Omicron's beam. + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); + + // 50% resist to Vehemence's skulls. + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); // 50% resist to Yharim's Crystal. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); - // 45% resist to Wrathwing stealth strike's fireballs. + // 45% resist to Wrathwing's stealth strike fireballs. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.55f, ProjectileType())))); - // 40% resist to Rancor. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.6f, ProjectileType())))); + // 35% resist to Prismatic Breaker's laser beam. + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.65f, ProjectileType())))); - // 35% resist to Anomaly's Nanogun bomb explosions. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.65f, ProjectileType())))); - - // 30% resist to Eclipse Fall. + // 30% resist to Eclipse's Fall. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType())))); - // 30% resist to Prismatic Breaker's laser beam. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType())))); - - // 30% resist to Pulse Rifle. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType())))); - // 30% resist to Sirius. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType())))); - // 30% resist to Dragon Scales and The Wand's tornadoes + // 30% resist to Ultima's rays. + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType())))); + + // 30% resist to Dragon Scales and The Wand's tornadoes. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType(), ProjectileType())))); // 25% resist to the Spin Throw part of the Ark of the Cosmos' combo. @@ -375,25 +446,34 @@ namespace CalamityMod.Balancing // 25% resist to Gael's Greatsword's big skulls. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileSpecificRequirementBalancingRule(0.75f, BigGaelsSkullFilter)))); + // 25% resist to Mirror of Kalandra's Paradoxica minion. + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.75f, ProjectileType())))); + // 25% resist to Zenith. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.75f, ProjectileID.FinalFractal)))); - // 20% resist to Blood Boiler fire. + // 20% resist to The Anomaly's Nanogun's bomb explosions. + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType())))); + + // 20% resist to Ariane's aura (Lilies of Finality). + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType())))); + + // 20% resist to Blood Boiler. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType())))); - // 20% resist to Eradicator beams. + // 20% resist to Eradicator's beams. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType())))); - // 20% resist to Plasma Grenade and Dynamic Pursuer's explosions - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType(),ProjectileType(), ProjectileType())))); + // 20% resist to Plasma Grenade and Dynamic Pursuer's explosions. + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType(), ProjectileType(), ProjectileType())))); // 20% resist to Voltaic Climax / Void Vortex hitscan beams. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType())))); - // 15% resist to Final Dawn AoE sweep flames. + // 15% resist to The Final Dawn's AoE sweep flames. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.85f, ProjectileType())))); - // 15% resist to Godslayer Slugs. + // 15% resist to God Slayer Slugs. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.85f, ProjectileType())))); // 15% resist to Gruesome Eminence. @@ -407,6 +487,9 @@ namespace CalamityMod.Balancing // 30% resist to Surge Driver's alt click comets. NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), new ProjectileResistBalancingRule(0.7f, ProjectileType()))); + // 30% resist to Supernova + NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), new ProjectileResistBalancingRule(0.7f, ProjectileType(), ProjectileType()))); + // 20% resist to Executioner's Blade stealth strikes. NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), new ProjectileResistBalancingRule(0.8f, ProjectileType()))); #endregion @@ -418,6 +501,9 @@ namespace CalamityMod.Balancing // 50% resist to Subsuming Vortex. NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), new ProjectileResistBalancingRule(0.5f, ProjectileType(), ProjectileType(), ProjectileType()))); + // 40% resist to Supernova + NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), new ProjectileResistBalancingRule(0.6f, ProjectileType(), ProjectileType()))); + // 30% resist to Zenith. NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), new ProjectileResistBalancingRule(0.7f, ProjectileID.FinalFractal))); @@ -429,7 +515,7 @@ namespace CalamityMod.Balancing // 10% resist to Executioner's Blade stealth strikes. NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), new ProjectileResistBalancingRule(0.9f, ProjectileType()))); - + // 10% resist to Surge Driver's alt click comets. NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), new ProjectileResistBalancingRule(0.9f, ProjectileType()))); diff --git a/Balancing/BalancingConstants.cs b/Balancing/BalancingConstants.cs index f23d2281f1..dc64bb8899 100644 --- a/Balancing/BalancingConstants.cs +++ b/Balancing/BalancingConstants.cs @@ -2,6 +2,7 @@ { public static class BalancingConstants { + #region Movement // When the relevant config is enabled: Gives the player a substantial +50% move speed boost at all times internal static readonly float DefaultMoveSpeedBoost = 0.5f; @@ -15,13 +16,21 @@ // Altered jump speed boost provided by Shiny Red Balloon via IL edit // This is a const because it replaces a hardcoded value in vanilla internal const float BalloonJumpSpeedBoost = 0.75f; + #endregion - // Altered default damage deviation - internal const int NewDefaultDamageVariationPercent = 5; + #region Immunity Frames + // Default immunity frame rules + internal const int VanillaDefaultIFrames = 40; + internal const int VanillaParryIFrames = 60; + internal const int VanillaDodgeIFrames = 80; - // Sharpening Station grants this much armor penetration to melee weapons. - internal const float SharpeningStationArmorPenetration = 5f; + // In vanilla, the Cross Necklace grants +40 iframes to all hits except for in PvP (where it does nothing) + // and Brand of the Inferno (where it only gives +30 instead). + internal const int CrossNecklaceIFrameBoost = 40; + internal const int CrossNecklaceIFrameBoost_Parry = 30; + #endregion + #region Dashes and Dodges // Dash cooldowns (in frames) internal const int UniversalDashCooldown = 30; internal const int UniversalShieldSlamCooldown = 30; @@ -36,14 +45,35 @@ // Dodge cooldowns (in frames) // TODO -- Some of these could be moved to the respective item files - internal static readonly int BeltDodgeCooldown = 5400; - internal static readonly int BrainDodgeCooldown = 5400; - internal static readonly int AmalgamDodgeCooldown = 5400; - internal static readonly int MirrorDodgeCooldown = 5400; - internal static readonly int DaedalusReflectCooldown = 5400; - internal static readonly int EvolutionReflectCooldown = 5400; + internal static readonly int BeltDodgeCooldownMin = 900; + internal static readonly int BeltDodgeCooldownMax = 5400; + internal static readonly int BrainDodgeCooldownMin = 900; + internal static readonly int BrainDodgeCooldownMax = 5400; + internal static readonly int AmalgamDodgeCooldownMin = 900; + internal static readonly int AmalgamDodgeCooldownMax = 5400; + internal static readonly int MirrorDodgeCooldownMin = 900; + internal static readonly int MirrorDodgeCooldownMax = 5400; + internal static readonly int DaedalusReflectCooldownMin = 900; + internal static readonly int DaedalusReflectCooldownMax = 5400; + internal static readonly int EvolutionReflectCooldownMin = 900; + internal static readonly int EvolutionReflectCooldownMax = 5400; + #endregion - // Internal vanilla item damage variables + #region Damage + // Altered default damage deviation + internal const int NewDefaultDamageVariationPercent = 5; + + // Summoner cross class nerf + internal static readonly float SummonerCrossClassNerf = 0.75f; + + // Summon damage bonuses counting less towards "scales with your best class" + internal static readonly float SummonAllClassScalingFactor = 0.75f; + + // Minimum and maximum allowed attack speed ratios when using Calamity Global Item Tweaks + internal static readonly float MinimumAllowedAttackSpeed = 0.25f; + internal static readonly float MaximumAllowedAttackSpeed = 10f; + + // Internal vanilla whip damage variables internal static readonly float LeatherWhipTagDamageMultiplier = 1.08f; internal static readonly float SnapthornTagDamageMultiplier = 1.04f; internal static readonly float SpinalTapTagDamageMultiplier = 1.08f; @@ -53,10 +83,72 @@ internal static readonly float MorningStarTagDamageMultiplier = 1.11f; internal static readonly float KaleidoscopeTagDamageMultiplier = 1.12f; - // Summoner cross class nerf - internal static readonly float SummonerCrossClassNerf = 0.75f; + // Sharpening Station grants this much armor penetration to melee weapons. + internal const float SharpeningStationArmorPenetration = 5f; - // Rogue stealth + // Beetle Scale Mail stats + internal static readonly float BeetleScaleMailMeleeDamagePerBeetle = 0.1f; + internal static readonly float BeetleScaleMailMeleeSpeedPerBeetle = 0.05f; + + // Nebula Armor Damage Booster + internal static readonly float NebulaDamagePerBooster = 0.075f; // 0.15f in vanilla + + // Nebula Armor Mana Booster + // nothing here yet + #endregion + + #region Life Steal + // Life steal cap + internal static readonly int LifeStealCap = 100; + + // Life steal accessories require a more strict cooldown due to their ease of use and global application + internal static readonly float LifeStealAccessoryCooldownMultiplier = 3f; + + // Life steal cooldown multipliers used for armor set bonuses + internal static readonly float LifeStealSetBonusCooldownMultiplier = 2f; + internal static readonly float LifeStealReaverTankCooldownMultiplier = 4f; + + // The range was buffed in vanilla from 1200 to 3000 in 1.4.4, and I agree with that decision + internal static readonly float LifeStealRange = 3000f; + + // Life steal caps (aka, how much life steal the player is allowed before it goes on cooldown) + internal static readonly float LifeStealCap_Classic = 60f; + internal static readonly float LifeStealCap_Expert = 50f; + internal static readonly float LifeStealCap_Revengeance = 40f; + internal static readonly float LifeStealCap_Death = 30f; + + // Master nerfs the life steal cap by 10, resulting in 40 in non-Rev Master, 30 in Rev Master, and 20 in Death Master + internal static readonly float LifeStealCapReduction_Master = 10f; + + // The base life steal cooldowns from vanilla + internal static readonly float LifeStealRecoveryRate_Classic = 0.6f; + internal static readonly float LifeStealRecoveryRate_Expert = 0.5f; + + // The calculations below show the time (in frames) for 10 life steal cooldown to recover in each difficulty + // Classic: 10 / 0.2 = 50 + // Expert: 10 / 0.15 = 66.667 + // Revengeance: 10 / 0.125 = 80 + // Death: 10 / 0.1 = 100 + // Master: 10 / 0.1 = 100 + // Revengeance Master: 10 / 0.075 = 133.333 + // Death Master: 10 / 0.05 = 200 + // Nerfs the life steal recovery rate in Classic from 0.6/s to 0.2/s + internal static readonly float LifeStealRecoveryRateReduction_Classic = 0.4f; + + // Nerfs the life steal recovery rate in Expert from 0.5/s to 0.15/s + internal static readonly float LifeStealRecoveryRateReduction_Expert = 0.35f; + + // Nerfs the life steal recovery rate in Revengeance from 0.5/s to 0.125/s + internal static readonly float LifeStealRecoveryRateReduction_Revengeance = 0.375f; + + // Nerfs the life steal recovery rate in Death from 0.5/s to 0.1/s + internal static readonly float LifeStealRecoveryRateReduction_Death = 0.4f; + + // Nerfs the life steal recovery rate in Master by 0.05/s, resulting in 0.1/s in non-Rev Master, 0.075/s in Rev Master, and 0.05/s in Death Master + internal static readonly float LifeStealRecoveryRateReduction_Master = 0.05f; + #endregion + + #region Rogue Base Stats // If stealth is too weak, increase this number. If stealth is too strong, decrease this number. // This value is intentionally not readonly. public static double UniversalStealthStrikeDamageFactor = 0.42; @@ -67,37 +159,32 @@ internal static readonly float BaseStealthGenTime = 4f; // 4 seconds internal static readonly float MovingStealthGenRatio = 0.5f; + #endregion - // Rage - internal static readonly int DefaultRageDuration = CalamityUtils.SecondsToFrames(9); // Rage lasts 9 seconds by default. - internal static readonly int RageDurationPerBooster = CalamityUtils.SecondsToFrames(1); // Each booster is +1 second: 10, 11, 12. - internal static readonly int RageCombatDelayTime = CalamityUtils.SecondsToFrames(10); - internal static readonly int RageFadeTime = CalamityUtils.SecondsToFrames(30); - internal static readonly float DefaultRageDamageBoost = 0.35f; // +35% + #region Defense, Health and Mana (Armor set stuff) + // Beetle Shell's multiplicative DR is removed by Calamity. In compensation, you get this much regular DR per beetle. + internal static readonly float BeetleShellDRPerBeetle = 0.1f; - // Proximity Rage - // These variables should be used in general to classify "enemies" vs "non-enemies" as well. - // See NPCUtils.IsAnEnemy - internal const int TinyHealthThreshold = 5; - internal const int TinyDamageThreshold = 5; - // If an enemy has more health than this, they are considered an enemy even if they have 0 contact damage - internal const int NoContactDamageHealthThreshold = 3000; - internal const int UnreasonableHealthThreshold = 25000000; // 25 million + // Solar Flare Armor's multiplicative DR is removed by Calamity. In compensation, you get this much DR from having at least one solar shield up. + internal static readonly float SolarFlareShieldDR = 0.25f; - // Adrenaline - internal static readonly float AdrenalineDamageBoost = 2f; // +200% - internal static readonly float AdrenalineDamagePerBooster = 0.15f; // +15% - internal static readonly float FullAdrenalineDR = 0.5f; // 50% - internal static readonly float AdrenalineDRPerBooster = 0.05f; // +5% per booster + // Nebula Armor Life Regen + internal static readonly int NebulaLifeRegenPerBooster = 4; // 6 in vanilla - // Summon damage bonuses counting less towards "scales with your best class" - internal static readonly float SummonAllClassScalingFactor = 0.75f; + // Nebula Armor Mana Regen + // This value works differently than you might expect. Raising it actually nerfs the mana regeneration of Nebula Armor + // Every frame, Terraria adds 1 to a counter for each Mana Booster the player has. + // If this counter reaches the below threshold, that player gains 1 mana. + // By default, it's 6, which has the following effects: + // 1 booster = +1 mana every 6 frames = +10 mana per second + // 2 boosters = +1 mana every 3 frames = +20 mana per second + // 3 boosters = +1 mana every 2 frames = +30 mana per second + // + // Calamity just halves this, that's probably good enough. + internal static readonly int NebulaManaRegenFrameCounterThreshold = 12; // 6 in vanilla + #endregion - // Minimum and maximum allowed attack speed ratios when using Calamity Global Item Tweaks - internal static readonly float MinimumAllowedAttackSpeed = 0.25f; - internal static readonly float MaximumAllowedAttackSpeed = 10f; - - // Defense Damage + #region Defense Damage internal const double DefaultDefenseDamageRatio = 0.3333; // Defense damage floor: PHM | HM | PML @@ -107,15 +194,46 @@ // Death Mode: 5 | 12 | 24 // Boss Rush: 25 internal static readonly int DefenseDamageFloor_NormalPHM = 3; - internal static readonly int DefenseDamageFloor_NormalHM = 8; + internal static readonly int DefenseDamageFloor_NormalHM = 8; internal static readonly int DefenseDamageFloor_NormalPML = 16; - internal static readonly int DefenseDamageFloor_RevPHM = 4; - internal static readonly int DefenseDamageFloor_RevHM = 10; - internal static readonly int DefenseDamageFloor_RevPML = 20; - internal static readonly int DefenseDamageFloor_DeathPHM = 5; - internal static readonly int DefenseDamageFloor_DeathHM = 12; - internal static readonly int DefenseDamageFloor_DeathPML = 24; - internal static readonly int DefenseDamageFloor_BossRush = 25; + internal static readonly int DefenseDamageFloor_RevPHM = 4; + internal static readonly int DefenseDamageFloor_RevHM = 10; + internal static readonly int DefenseDamageFloor_RevPML = 20; + internal static readonly int DefenseDamageFloor_DeathPHM = 5; + internal static readonly int DefenseDamageFloor_DeathHM = 12; + internal static readonly int DefenseDamageFloor_DeathPML = 24; + internal static readonly int DefenseDamageFloor_BossRush = 25; + #endregion + + #region Rage and Adrenaline (Rippers) + internal static readonly int DefaultRageDuration = CalamityUtils.SecondsToFrames(9); // Rage lasts 9 seconds by default. + internal static readonly int RageDurationPerBooster = CalamityUtils.SecondsToFrames(1); // Each booster is +1 second: 10, 11, 12. + internal static readonly int RageCombatDelayTime = CalamityUtils.SecondsToFrames(10); + internal static readonly int RageFadeTime = CalamityUtils.SecondsToFrames(30); + internal static readonly float DefaultRageDamageBoost = 0.35f; // +35% + + internal static readonly float AdrenalineDamageBoost = 1.5f; // +150% + internal static readonly float AdrenalineDamagePerBooster = 0.2f; // +20% + internal static readonly float FullAdrenalineDR = 0.5f; // 50% + internal static readonly float AdrenalineDRPerBooster = 0.05f; // +5% per booster + + internal static readonly int AdrenalinePauseAfterDamage = CalamityUtils.SecondsToFrames(1); + internal static readonly float MinimumAdrenalineLoss = 0.25f; // No matter how small a hit, you will always lose at least 25% current Adrenaline + internal static readonly float AdrenalineFalloffTinyHitHealthRatio = 0.05f; // Hits for 5% max HP or less result in less Adrenaline loss + + internal static readonly float TrueMeleeRipperReductionFactor = 0.5f; // True melee benefits less from rippers to prevent excessive melting. + #endregion + + // TODO -- NPC classification is not done consistently with predictable thresholds. + // These variables should be used in general to classify "enemies" vs "non-enemies" as well. + // See NPCUtils.IsAnEnemy + #region NPC Classification + internal const int TinyHealthThreshold = 5; + internal const int TinyDamageThreshold = 5; + // If an enemy has more health than this, they are considered an enemy even if they have 0 contact damage + internal const int NoContactDamageHealthThreshold = 3000; + internal const int UnreasonableHealthThreshold = 25000000; // 25 million + #endregion // TODO -- Add all balance related constants here that don't belong in other files. // Review all constants and static readonlys in the entire mod to find things to add. diff --git a/Balancing/NPCBalancingChange.cs b/Balancing/NPCBalancingChange.cs index 400e6c1a3d..f59f527a83 100644 --- a/Balancing/NPCBalancingChange.cs +++ b/Balancing/NPCBalancingChange.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Balancing +namespace CalamityMod.Balancing { public struct NPCBalancingChange { diff --git a/BiomeManagers/AbovegroundAstralBiome.cs b/BiomeManagers/AbovegroundAstralBiome.cs deleted file mode 100644 index aea59f5567..0000000000 --- a/BiomeManagers/AbovegroundAstralBiome.cs +++ /dev/null @@ -1,34 +0,0 @@ -using CalamityMod.Items.Placeables.Furniture; -using CalamityMod.Systems; -using Terraria; -using Terraria.Graphics.Effects; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.BiomeManagers -{ - public class AbovegroundAstralBiome : ModBiome - { - public override ModWaterStyle WaterStyle => ModContent.Find("CalamityMod/AstralWater"); - public override ModSurfaceBackgroundStyle SurfaceBackgroundStyle => ModContent.Find("CalamityMod/AstralSurfaceFogBGStyle"); - public override ModUndergroundBackgroundStyle UndergroundBackgroundStyle => ModContent.Find("CalamityMod/AstralUndergroundBGStyle"); - public override int BiomeTorchItemType => ModContent.ItemType(); - public override SceneEffectPriority Priority => SceneEffectPriority.BiomeHigh; - public override string BestiaryIcon => "CalamityMod/BiomeManagers/AbovegroundAstralBiomeIcon"; - public override string BackgroundPath => "CalamityMod/Backgrounds/MapBackgrounds/AstralBG"; - public override string MapBackground => "CalamityMod/Backgrounds/MapBackgrounds/AstralBG"; - - public override int Music => CalamityMod.Instance.GetMusicFromMusicMod("AstralInfection") ?? MusicID.Space; - - public override bool IsBiomeActive(Player player) - { - return !player.ZoneDungeon && BiomeTileCounterSystem.AstralTiles > 950; - } - - public override void SpecialVisuals(Player player, bool isActive) - { - player.ManageSpecialBiomeVisuals("CalamityMod:Astral", isActive); - - } - } -} diff --git a/BiomeManagers/AbovegroundAstralBiomeSurface.cs b/BiomeManagers/AbovegroundAstralBiomeSurface.cs deleted file mode 100644 index d68e9ed700..0000000000 --- a/BiomeManagers/AbovegroundAstralBiomeSurface.cs +++ /dev/null @@ -1,41 +0,0 @@ -using CalamityMod.Items.Placeables.Furniture; -using CalamityMod.Systems; -using Terraria; -using Terraria.Graphics.Effects; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.BiomeManagers -{ - public class AbovegroundAstralBiomeSurface : ModBiome - { - public override ModWaterStyle WaterStyle => ModContent.Find("CalamityMod/AstralWater"); - public override ModSurfaceBackgroundStyle SurfaceBackgroundStyle => ModContent.Find("CalamityMod/AstralSurfaceBGStyle"); - public override int BiomeTorchItemType => ModContent.ItemType(); - public override SceneEffectPriority Priority => SceneEffectPriority.BiomeHigh; - public override string MapBackground => "CalamityMod/Backgrounds/MapBackgrounds/AstralBG"; - - public override int Music => CalamityMod.Instance.GetMusicFromMusicMod("AstralInfection") ?? MusicID.Space; - - public override bool IsBiomeActive(Player player) - { - return !player.ZoneDungeon && BiomeTileCounterSystem.AstralTiles > 950 && !player.ZoneSnow && !player.ZoneDesert; - } - - public override void SpecialVisuals(Player player, bool isActive) - { - if (SkyManager.Instance["CalamityMod:AstralSurface"] != null && isActive != SkyManager.Instance["CalamityMod:AstralSurface"].IsActive()) - { - if (isActive) - { - SkyManager.Instance.Activate("CalamityMod:AstralSurface"); - } - else - { - SkyManager.Instance.Deactivate("CalamityMod:AstralSurface"); - } - } - } - - } -} diff --git a/BiomeManagers/AbovegroundAstralDesertBiome.cs b/BiomeManagers/AbovegroundAstralDesertBiome.cs deleted file mode 100644 index a4941079c7..0000000000 --- a/BiomeManagers/AbovegroundAstralDesertBiome.cs +++ /dev/null @@ -1,42 +0,0 @@ -using CalamityMod.Items.Placeables.Furniture; -using CalamityMod.Systems; -using Terraria; -using Terraria.Graphics.Effects; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.BiomeManagers -{ - public class AbovegroundAstralDesertBiome : ModBiome - { - public override ModWaterStyle WaterStyle => ModContent.Find("CalamityMod/AstralWater"); - public override ModSurfaceBackgroundStyle SurfaceBackgroundStyle => ModContent.Find("CalamityMod/AstralDesertSurfaceBGStyle"); - public override int BiomeTorchItemType => ModContent.ItemType(); - public override SceneEffectPriority Priority => SceneEffectPriority.BiomeHigh; - public override string BestiaryIcon => "CalamityMod/BiomeManagers/AstralDesertIcon"; - // Could use its own unique background - public override string BackgroundPath => "CalamityMod/Backgrounds/MapBackgrounds/AstralBG"; - public override string MapBackground => "CalamityMod/Backgrounds/MapBackgrounds/AstralBG"; - public override int Music => CalamityMod.Instance.GetMusicFromMusicMod("AstralInfection") ?? MusicID.Space; - - public override bool IsBiomeActive(Player player) - { - return !player.ZoneDungeon && BiomeTileCounterSystem.AstralTiles > 950 && player.ZoneDesert && !player.ZoneSnow; - } - - public override void SpecialVisuals(Player player, bool isActive) - { - if (SkyManager.Instance["CalamityMod:AstralDesert"] != null && isActive != SkyManager.Instance["CalamityMod:AstralDesert"].IsActive()) - { - if (isActive) - { - SkyManager.Instance.Activate("CalamityMod:AstralDesert"); - } - else - { - SkyManager.Instance.Deactivate("CalamityMod:AstralDesert"); - } - } - } - } -} diff --git a/BiomeManagers/AbovegroundAstralSnowBiome.cs b/BiomeManagers/AbovegroundAstralSnowBiome.cs deleted file mode 100644 index 029513ce91..0000000000 --- a/BiomeManagers/AbovegroundAstralSnowBiome.cs +++ /dev/null @@ -1,41 +0,0 @@ -using CalamityMod.Items.Placeables.Furniture; -using CalamityMod.Systems; -using Terraria; -using Terraria.Graphics.Effects; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.BiomeManagers -{ - public class AbovegroundAstralSnowBiome : ModBiome - { - public override ModWaterStyle WaterStyle => ModContent.Find("CalamityMod/AstralWater"); - public override ModSurfaceBackgroundStyle SurfaceBackgroundStyle => ModContent.Find("CalamityMod/AstralSnowSurfaceBGStyle"); - public override int BiomeTorchItemType => ModContent.ItemType(); - public override SceneEffectPriority Priority => SceneEffectPriority.BiomeHigh; - public override string MapBackground => "CalamityMod/Backgrounds/MapBackgrounds/AstralBG"; - - public override int Music => CalamityMod.Instance.GetMusicFromMusicMod("AstralInfection") ?? MusicID.Space; - - public override bool IsBiomeActive(Player player) - { - return !player.ZoneDungeon && BiomeTileCounterSystem.AstralTiles > 950 && player.ZoneSnow; - } - - public override void SpecialVisuals(Player player, bool isActive) - { - if (SkyManager.Instance["CalamityMod:AstralSnow"] != null && isActive != SkyManager.Instance["CalamityMod:AstralSnow"].IsActive()) - { - if (isActive) - { - SkyManager.Instance.Activate("CalamityMod:AstralSnow"); - } - else - { - SkyManager.Instance.Deactivate("CalamityMod:AstralSnow"); - } - } - } - - } -} diff --git a/BiomeManagers/AbyssLayer1Biome.cs b/BiomeManagers/AbyssLayer1Biome.cs index 0a682e224a..a3b73e8f4b 100644 --- a/BiomeManagers/AbyssLayer1Biome.cs +++ b/BiomeManagers/AbyssLayer1Biome.cs @@ -1,7 +1,7 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Placeables.FurnitureAbyss; -using CalamityMod.World; using CalamityMod.Systems; +using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -42,7 +42,7 @@ namespace CalamityMod.BiomeManagers if (Main.remixWorld) return !player.lavaWet && !player.honeyWet && abyssPosX && playerYTileCoords < abyssStartHeight; - return !player.lavaWet && !player.honeyWet && abyssPosX && playerYTileCoords >= abyssStartHeight && playerYTileCoords <= Main.maxTilesY - 200; + return !player.lavaWet && !player.honeyWet && abyssPosX && playerYTileCoords >= abyssStartHeight && playerYTileCoords <= Main.UnderworldLayer; } // Temporarily use sulphur for now diff --git a/BiomeManagers/AbyssLayer2Biome.cs b/BiomeManagers/AbyssLayer2Biome.cs index f4d123ec1c..cf20c66664 100644 --- a/BiomeManagers/AbyssLayer2Biome.cs +++ b/BiomeManagers/AbyssLayer2Biome.cs @@ -32,10 +32,10 @@ namespace CalamityMod.BiomeManagers if (Main.remixWorld) { return AbyssLayer1Biome.MeetsBaseAbyssRequirement(player, out int playerYTileCoords) && BiomeTileCounterSystem.Layer2Tiles >= 200 && - playerYTileCoords <= SulphurousSea.YStart - (int)((Main.maxTilesY - 200) * 0.2f) && playerYTileCoords > SulphurousSea.YStart - (int)((Main.maxTilesY - 200) * 0.4f); + playerYTileCoords <= SulphurousSea.YStart - (int)(Main.UnderworldLayer * 0.2f) && playerYTileCoords > SulphurousSea.YStart - (int)(Main.UnderworldLayer * 0.4f); } - return AbyssLayer1Biome.MeetsBaseAbyssRequirement(player, out int playerYTileCoords2) && BiomeTileCounterSystem.Layer2Tiles >= 200 && + return AbyssLayer1Biome.MeetsBaseAbyssRequirement(player, out int playerYTileCoords2) && BiomeTileCounterSystem.Layer2Tiles >= 200 && playerYTileCoords2 > Main.rockLayer - 10 && playerYTileCoords2 <= Main.rockLayer + Main.maxTilesY * 0.143; } } diff --git a/BiomeManagers/AbyssLayer3Biome.cs b/BiomeManagers/AbyssLayer3Biome.cs index 536a17d861..5fa549ef5b 100644 --- a/BiomeManagers/AbyssLayer3Biome.cs +++ b/BiomeManagers/AbyssLayer3Biome.cs @@ -32,7 +32,7 @@ namespace CalamityMod.BiomeManagers if (Main.remixWorld) { return AbyssLayer1Biome.MeetsBaseAbyssRequirement(player, out int playerYTileCoords) && BiomeTileCounterSystem.Layer3Tiles >= 200 && - playerYTileCoords <= SulphurousSea.YStart - (int)((Main.maxTilesY - 200) * 0.4f) && playerYTileCoords > SulphurousSea.YStart - (int)((Main.maxTilesY - 200) * 0.6f); + playerYTileCoords <= SulphurousSea.YStart - (int)(Main.UnderworldLayer * 0.4f) && playerYTileCoords > SulphurousSea.YStart - (int)(Main.UnderworldLayer * 0.6f); } return AbyssLayer1Biome.MeetsBaseAbyssRequirement(player, out int playerYTileCoords2) && BiomeTileCounterSystem.Layer3Tiles >= 200 && diff --git a/BiomeManagers/AbyssLayer4Biome.cs b/BiomeManagers/AbyssLayer4Biome.cs index 3bc3bceff3..de29933f2d 100644 --- a/BiomeManagers/AbyssLayer4Biome.cs +++ b/BiomeManagers/AbyssLayer4Biome.cs @@ -32,7 +32,7 @@ namespace CalamityMod.BiomeManagers if (Main.remixWorld) { return AbyssLayer1Biome.MeetsBaseAbyssRequirement(player, out int playerYTileCoords) && BiomeTileCounterSystem.Layer4Tiles >= 200 && - playerYTileCoords <= SulphurousSea.YStart - (int)((Main.maxTilesY - 200) * 0.6f); + playerYTileCoords <= SulphurousSea.YStart - (int)(Main.UnderworldLayer * 0.6f); } return AbyssLayer1Biome.MeetsBaseAbyssRequirement(player, out int playerYTileCoords2) && BiomeTileCounterSystem.Layer4Tiles >= 200 && diff --git a/BiomeManagers/ArsenalLabBiome.cs b/BiomeManagers/ArsenalLabBiome.cs index 649978519a..f7d93fb0ee 100644 --- a/BiomeManagers/ArsenalLabBiome.cs +++ b/BiomeManagers/ArsenalLabBiome.cs @@ -5,7 +5,7 @@ namespace CalamityMod.BiomeManagers public class ArsenalLabBiome : ModBiome { public override string BestiaryIcon => "CalamityMod/BiomeManagers/LaboratoryIcon"; - // Could use its own unique background if someone even bothers + // Could use its own unique background if someone even bothers public override string BackgroundPath => "Terraria/Images/MapBG32"; //Does this even need proper detection, this file solely exists for a few critter entries and the detection code is done elsewhere diff --git a/BiomeManagers/AstralInfectionBiome.cs b/BiomeManagers/AstralInfectionBiome.cs new file mode 100644 index 0000000000..264845baae --- /dev/null +++ b/BiomeManagers/AstralInfectionBiome.cs @@ -0,0 +1,94 @@ +using CalamityMod.Items.Placeables.Furniture; +using CalamityMod.Systems; +using Terraria; +using Terraria.Graphics.Effects; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.BiomeManagers +{ + public class AstralInfectionBiome : ModBiome + { + public override ModWaterStyle WaterStyle => ModContent.Find("CalamityMod/AstralWater"); + public override ModSurfaceBackgroundStyle SurfaceBackgroundStyle + { + get + { + if (Main.LocalPlayer.ZoneSnow) //Snow + { + return ModContent.Find("CalamityMod/AstralSnowSurfaceBGStyle"); + } + else if (Main.LocalPlayer.ZoneDesert && !Main.LocalPlayer.ZoneSnow) //Desert + { + return ModContent.Find("CalamityMod/AstralDesertSurfaceBGStyle"); + } + else //surface + { + return ModContent.Find("CalamityMod/AstralSurfaceBGStyle"); + } + } + } + + public override ModUndergroundBackgroundStyle UndergroundBackgroundStyle + { + get + { + if (Main.LocalPlayer.ZoneSnow) + { + return ModContent.Find("CalamityMod/AstralUndergroundBGStyle"); // Could use its own unique background + } + return ModContent.Find("CalamityMod/AstralUndergroundBGStyle"); + } + } + + public override int BiomeTorchItemType => ModContent.ItemType(); + public override SceneEffectPriority Priority => SceneEffectPriority.BiomeHigh; + public override string BestiaryIcon => "CalamityMod/BiomeManagers/AbovegroundAstralBiomeIcon"; + public override string BackgroundPath + { + get { + if (Main.LocalPlayer.ZoneDesert && !Main.LocalPlayer.ZoneSnow) + { + //desert + return "CalamityMod/Backgrounds/MapBackgrounds/AstralBG"; // Could use its own unique background + } + else if (Main.LocalPlayer.ZoneDirtLayerHeight || Main.LocalPlayer.ZoneRockLayerHeight || Main.LocalPlayer.ZoneUnderworldHeight) + { + //underground + return "CalamityMod/Backgrounds/MapBackgrounds/AstralBG"; // Could use its own unique background + } + else + { + return "CalamityMod/Backgrounds/MapBackgrounds/AstralBG"; + } + } + } + public override string MapBackground => "CalamityMod/Backgrounds/MapBackgrounds/AstralBG"; + + public override int Music + { + get + { + if (Main.LocalPlayer.ZoneDirtLayerHeight || Main.LocalPlayer.ZoneRockLayerHeight || Main.LocalPlayer.ZoneUnderworldHeight) + { + return CalamityMod.Instance.GetMusicFromMusicMod("AstralInfectionUnderground") ?? MusicID.Space; + } + return CalamityMod.Instance.GetMusicFromMusicMod("AstralInfection") ?? MusicID.Space; + } + } + + public override bool IsBiomeActive(Player player) + { + return !player.ZoneDungeon && BiomeTileCounterSystem.AstralTiles > 950; + } + + public override void SpecialVisuals(Player player, bool isActive) + { + player.ManageSpecialBiomeVisuals("CalamityMod:Astral", isActive); + if (Main.LocalPlayer.ZoneDirtLayerHeight || Main.LocalPlayer.ZoneRockLayerHeight || Main.LocalPlayer.ZoneUnderworldHeight) + { + player.ManageSpecialBiomeVisuals("CalamityMod:Astral", isActive); //underground + } + } + } +} diff --git a/BiomeManagers/AcidRainBiome.cs b/BiomeManagers/BestiaryCategories/AcidRainBiome.cs similarity index 100% rename from BiomeManagers/AcidRainBiome.cs rename to BiomeManagers/BestiaryCategories/AcidRainBiome.cs diff --git a/BiomeManagers/BestiaryCategories/AstralCaveDesert.cs b/BiomeManagers/BestiaryCategories/AstralCaveDesert.cs new file mode 100644 index 0000000000..8f7d2a9a30 --- /dev/null +++ b/BiomeManagers/BestiaryCategories/AstralCaveDesert.cs @@ -0,0 +1,11 @@ +using Terraria.ModLoader; + +namespace CalamityMod.BiomeManagers.BestiaryCategories +{ + public class AstralCaveDesert : ModBiome //Unused, currently + { + public override string BestiaryIcon => "CalamityMod/BiomeManagers/AstralCaveDesertIcon"; + + public override string MapBackground => "CalamityMod/Backgrounds/MapBackgrounds/AstralBG"; + } +} diff --git a/BiomeManagers/BestiaryCategories/AstralDesert.cs b/BiomeManagers/BestiaryCategories/AstralDesert.cs new file mode 100644 index 0000000000..29b0a3f907 --- /dev/null +++ b/BiomeManagers/BestiaryCategories/AstralDesert.cs @@ -0,0 +1,11 @@ +using Terraria.ModLoader; + +namespace CalamityMod.BiomeManagers.BestiaryCategories +{ + public class AstralDesert : ModBiome + { + public override string BestiaryIcon => "CalamityMod/BiomeManagers/AstralDesertIcon"; + + public override string MapBackground => "CalamityMod/Backgrounds/MapBackgrounds/AstralBG"; + } +} diff --git a/BiomeManagers/BestiaryCategories/AstralIce.cs b/BiomeManagers/BestiaryCategories/AstralIce.cs new file mode 100644 index 0000000000..f478ae1ee9 --- /dev/null +++ b/BiomeManagers/BestiaryCategories/AstralIce.cs @@ -0,0 +1,11 @@ +using Terraria.ModLoader; + +namespace CalamityMod.BiomeManagers.BestiaryCategories +{ + public class AstralIce : ModBiome //Unused, currently + { + public override string BestiaryIcon => "CalamityMod/BiomeManagers/AstralIceIcon"; + + public override string MapBackground => "CalamityMod/Backgrounds/MapBackgrounds/AstralBG"; + } +} diff --git a/BiomeManagers/BestiaryCategories/AstralUnderground.cs b/BiomeManagers/BestiaryCategories/AstralUnderground.cs new file mode 100644 index 0000000000..42d924fd5b --- /dev/null +++ b/BiomeManagers/BestiaryCategories/AstralUnderground.cs @@ -0,0 +1,11 @@ +using Terraria.ModLoader; + +namespace CalamityMod.BiomeManagers.BestiaryCategories +{ + public class AstralUnderground : ModBiome + { + public override string BestiaryIcon => "CalamityMod/BiomeManagers/UndergroundAstralIcon"; + + public override string MapBackground => "CalamityMod/Backgrounds/MapBackgrounds/AstralBG"; + } +} diff --git a/BiomeManagers/SulphurousSeaBiome.cs b/BiomeManagers/SulphurousSeaBiome.cs index ece1c0c2b6..fb170f3449 100644 --- a/BiomeManagers/SulphurousSeaBiome.cs +++ b/BiomeManagers/SulphurousSeaBiome.cs @@ -15,7 +15,7 @@ namespace CalamityMod.BiomeManagers public class SulphurousSeaBiome : ModBiome { public override ModWaterStyle WaterStyle => Main.zenithWorld ? ModContent.Find("CalamityMod/PissWater") : ModContent.Find("CalamityMod/SulphuricWater"); - public override ModSurfaceBackgroundStyle SurfaceBackgroundStyle => Main.zenithWorld ?ModContent.Find("CalamityMod/PissSeaSurfaceBGStyle") : ModContent.Find("CalamityMod/SulphurSeaSurfaceBGStyle"); + public override ModSurfaceBackgroundStyle SurfaceBackgroundStyle => Main.zenithWorld ? ModContent.Find("CalamityMod/PissSeaSurfaceBGStyle") : ModContent.Find("CalamityMod/SulphurSeaSurfaceBGStyle"); public override int BiomeTorchItemType => ModContent.ItemType(); public override SceneEffectPriority Priority => SceneEffectPriority.BiomeHigh; public override string BestiaryIcon => "CalamityMod/BiomeManagers/SulphurousSeaIcon"; @@ -45,7 +45,7 @@ namespace CalamityMod.BiomeManagers ? CalamityMod.Instance.GetMusicFromMusicMod("SulphurousSeaNight") ?? MusicID.Desert // Nighttime : CalamityMod.Instance.GetMusicFromMusicMod("SulphurousSeaDay") ?? MusicID.Desert; // Daytime } - + return music; } } @@ -69,13 +69,13 @@ namespace CalamityMod.BiomeManagers sulphurPosX = true; } } - + if (Main.remixWorld) - return (BiomeTileCounterSystem.SulphurTiles >= 300 || (point.Y > SulphurousSea.YStart && point.Y < Main.maxTilesY - 200 && sulphurPosX && !WeakReferenceSupport.InAnySubworld())) && !player.Calamity().ZoneAbyss; + return (BiomeTileCounterSystem.SulphurTiles >= 300 || (point.Y > SulphurousSea.YStart && point.Y < Main.UnderworldLayer && sulphurPosX && !WeakReferenceSupport.InAnySubworld())) && !player.Calamity().ZoneAbyss; return (BiomeTileCounterSystem.SulphurTiles >= 300 || (point.Y < (Main.rockLayer - Main.maxTilesY / 13) && sulphurPosX && !WeakReferenceSupport.InAnySubworld())) && !player.Calamity().ZoneAbyss; } - + public override void SpecialVisuals(Player player, bool isActive) { string biomeName = "CalamityMod:SulphurSea"; diff --git a/BiomeManagers/SunkenSeaBiome.cs b/BiomeManagers/SunkenSeaBiome.cs index 1d3078e3dd..394241a43b 100644 --- a/BiomeManagers/SunkenSeaBiome.cs +++ b/BiomeManagers/SunkenSeaBiome.cs @@ -14,7 +14,7 @@ namespace CalamityMod.BiomeManagers public override int Music => CalamityMod.Instance.GetMusicFromMusicMod("SunkenSea") ?? MusicID.OceanNight; public override SceneEffectPriority Priority => SceneEffectPriority.BiomeHigh; public override string BestiaryIcon => "CalamityMod/BiomeManagers/SunkenSeaIcon"; - // Placeholder until we get a dedicated Sunken Sea background + // 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"; diff --git a/BiomeManagers/UndergroundAstralBiome.cs b/BiomeManagers/UndergroundAstralBiome.cs deleted file mode 100644 index f3d0ac4197..0000000000 --- a/BiomeManagers/UndergroundAstralBiome.cs +++ /dev/null @@ -1,33 +0,0 @@ -using CalamityMod.Systems; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.BiomeManagers -{ - public class UndergroundAstralBiome : ModBiome - { - public override ModWaterStyle WaterStyle => ModContent.Find("CalamityMod/AstralWater"); - public override ModUndergroundBackgroundStyle UndergroundBackgroundStyle => ModContent.Find("CalamityMod/AstralUndergroundBGStyle"); - public override SceneEffectPriority Priority => SceneEffectPriority.BiomeHigh; - public override string BestiaryIcon => "CalamityMod/BiomeManagers/UndergroundAstralIcon"; - // Could use its own unique background - public override string BackgroundPath => "CalamityMod/Backgrounds/MapBackgrounds/AstralBG"; - public override string MapBackground => "CalamityMod/Backgrounds/MapBackgrounds/AstralBG"; - - public override int Music => CalamityMod.Instance.GetMusicFromMusicMod("AstralInfectionUnderground") ?? MusicID.Space; - - public override bool IsBiomeActive(Player player) - { - return !player.ZoneDungeon && BiomeTileCounterSystem.AstralTiles > 950 && (player.ZoneDirtLayerHeight || player.ZoneRockLayerHeight || player.ZoneUnderworldHeight); - } - - public override void SpecialVisuals(Player player, bool isActive) - { - player.ManageSpecialBiomeVisuals("CalamityMod:Astral", isActive); - } - - // Just slightly above the above-ground astral biomes. - public override float GetWeight(Player player) => 0.51f; - } -} diff --git a/Buffs/Alcohol/AlcoholPoisoning.cs b/Buffs/Alcohol/AlcoholPoisoning.cs index 1cd54aafbf..d130aaf523 100644 --- a/Buffs/Alcohol/AlcoholPoisoning.cs +++ b/Buffs/Alcohol/AlcoholPoisoning.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Buffs/Alcohol/CaribbeanRumBuff.cs b/Buffs/Alcohol/CaribbeanRumBuff.cs index 6889e04475..f20c460c74 100644 --- a/Buffs/Alcohol/CaribbeanRumBuff.cs +++ b/Buffs/Alcohol/CaribbeanRumBuff.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Buffs/Alcohol/CinnamonRollBuff.cs b/Buffs/Alcohol/CinnamonRollBuff.cs index 4d7afaa059..3d4daff7ea 100644 --- a/Buffs/Alcohol/CinnamonRollBuff.cs +++ b/Buffs/Alcohol/CinnamonRollBuff.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Buffs/Alcohol/EverclearBuff.cs b/Buffs/Alcohol/EverclearBuff.cs index 15941b549c..eed852d449 100644 --- a/Buffs/Alcohol/EverclearBuff.cs +++ b/Buffs/Alcohol/EverclearBuff.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Buffs/Alcohol/FabsolVodkaBuff.cs b/Buffs/Alcohol/FabsolVodkaBuff.cs index 9b4178915d..b74e8639c1 100644 --- a/Buffs/Alcohol/FabsolVodkaBuff.cs +++ b/Buffs/Alcohol/FabsolVodkaBuff.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Buffs/Alcohol/FireballBuff.cs b/Buffs/Alcohol/FireballBuff.cs index 0ba5b1e676..aa2e9e9f96 100644 --- a/Buffs/Alcohol/FireballBuff.cs +++ b/Buffs/Alcohol/FireballBuff.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Buffs/Alcohol/MargaritaBuff.cs b/Buffs/Alcohol/MargaritaBuff.cs index 03f843a8c3..fb43c678dc 100644 --- a/Buffs/Alcohol/MargaritaBuff.cs +++ b/Buffs/Alcohol/MargaritaBuff.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Buffs/Alcohol/MoonshineBuff.cs b/Buffs/Alcohol/MoonshineBuff.cs index 47723c0ed2..d9ce511042 100644 --- a/Buffs/Alcohol/MoonshineBuff.cs +++ b/Buffs/Alcohol/MoonshineBuff.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Buffs/Alcohol/MoscowMuleBuff.cs b/Buffs/Alcohol/MoscowMuleBuff.cs index 8c38f67a11..577fe35a1c 100644 --- a/Buffs/Alcohol/MoscowMuleBuff.cs +++ b/Buffs/Alcohol/MoscowMuleBuff.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Buffs/Alcohol/RedWineBuff.cs b/Buffs/Alcohol/RedWineBuff.cs index 77ad1a63fb..bad080168d 100644 --- a/Buffs/Alcohol/RedWineBuff.cs +++ b/Buffs/Alcohol/RedWineBuff.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Buffs/Alcohol/RumBuff.cs b/Buffs/Alcohol/RumBuff.cs index 8b446acddf..dac1bd0d2a 100644 --- a/Buffs/Alcohol/RumBuff.cs +++ b/Buffs/Alcohol/RumBuff.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Buffs/Alcohol/ScrewdriverBuff.cs b/Buffs/Alcohol/ScrewdriverBuff.cs index 5c1f314079..1487717507 100644 --- a/Buffs/Alcohol/ScrewdriverBuff.cs +++ b/Buffs/Alcohol/ScrewdriverBuff.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Buffs/Alcohol/StarBeamRyeBuff.cs b/Buffs/Alcohol/StarBeamRyeBuff.cs index 14a15bb41f..e8dde8ea60 100644 --- a/Buffs/Alcohol/StarBeamRyeBuff.cs +++ b/Buffs/Alcohol/StarBeamRyeBuff.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Buffs/Alcohol/TequilaBuff.cs b/Buffs/Alcohol/TequilaBuff.cs index f49d1c7fa9..ac8b8cb4c0 100644 --- a/Buffs/Alcohol/TequilaBuff.cs +++ b/Buffs/Alcohol/TequilaBuff.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Buffs/Alcohol/TequilaSunriseBuff.cs b/Buffs/Alcohol/TequilaSunriseBuff.cs index ec85e2e852..1fd115ce63 100644 --- a/Buffs/Alcohol/TequilaSunriseBuff.cs +++ b/Buffs/Alcohol/TequilaSunriseBuff.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Buffs/Alcohol/Trippy.cs b/Buffs/Alcohol/Trippy.cs index 6c31ff9dad..e791bdd796 100644 --- a/Buffs/Alcohol/Trippy.cs +++ b/Buffs/Alcohol/Trippy.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Alcohol diff --git a/Buffs/Alcohol/VodkaBuff.cs b/Buffs/Alcohol/VodkaBuff.cs index 26f2140fdb..851c0cecca 100644 --- a/Buffs/Alcohol/VodkaBuff.cs +++ b/Buffs/Alcohol/VodkaBuff.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Buffs/Alcohol/WhiskeyBuff.cs b/Buffs/Alcohol/WhiskeyBuff.cs index ea3c7bfa12..a496f75f18 100644 --- a/Buffs/Alcohol/WhiskeyBuff.cs +++ b/Buffs/Alcohol/WhiskeyBuff.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Buffs/Alcohol/WhiteWineBuff.cs b/Buffs/Alcohol/WhiteWineBuff.cs index 277a60405e..c4781b20ef 100644 --- a/Buffs/Alcohol/WhiteWineBuff.cs +++ b/Buffs/Alcohol/WhiteWineBuff.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Buffs/CalamityGlobalBuff.cs b/Buffs/CalamityGlobalBuff.cs index 0beee06514..93d68380d4 100644 --- a/Buffs/CalamityGlobalBuff.cs +++ b/Buffs/CalamityGlobalBuff.cs @@ -1,6 +1,6 @@ -using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Balancing; +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.NPCs; -using System.Text; using Terraria; using Terraria.ID; using Terraria.Localization; @@ -26,6 +26,11 @@ namespace CalamityMod.Buffs { player.GetDamage() -= 0.1f; } + else if (type == BuffID.Clairvoyance) + { + player.GetDamage() -= 0.02f; + player.GetCritChance() -= 2; + } else if (type == BuffID.Panic) { player.moveSpeed -= 0.6f; @@ -68,11 +73,22 @@ namespace CalamityMod.Buffs { player.endurance -= 0.1f; } - else if (type >= BuffID.NebulaUpDmg1 && type <= BuffID.NebulaUpDmg3) + + // Beetle Shell DR is a full compensation, as the vanilla multiplicative DR is removed entirely. + else if (type >= BuffID.BeetleEndurance1 && type <= BuffID.BeetleEndurance3 && player.beetleDefense) { - float nebulaDamage = 0.075f * player.nebulaLevelDamage; // 15% to 45% changed to 7.5% to 22.5% - player.GetDamage() -= nebulaDamage; + int orbsToGrant = player.beetleOrbs < 0 ? 0 : player.beetleOrbs; + if (orbsToGrant > 3) + orbsToGrant = 3; + player.endurance += BalancingConstants.BeetleShellDRPerBeetle * orbsToGrant; } + + // Solar Flare DR is a full compensation, as the vanilla multiplicative DR is removed entirely. + else if (type >= BuffID.SolarShield1 && type <= BuffID.SolarShield3) + { + player.endurance += BalancingConstants.SolarFlareShieldDR; + } + else if (type == BuffID.Warmth) { player.buffImmune[ModContent.BuffType()] = true; @@ -83,18 +99,6 @@ namespace CalamityMod.Buffs { player.GetDamage() -= 0.2f; } - else if (type == BuffID.BeetleMight1) - { - player.GetAttackSpeed() -= 0.05f; - } - else if (type == BuffID.BeetleMight2) - { - player.GetAttackSpeed() -= 0.1f; - } - else if (type == BuffID.BeetleMight3) - { - player.GetAttackSpeed() -= 0.15f; - } } public override void Update(int type, NPC npc, ref int buffIndex) @@ -182,7 +186,7 @@ namespace CalamityMod.Buffs case BuffID.Mining: tip = tip.Replace("25", "15"); break; - + case BuffID.MonsterBanner: //Vanilla's wording is unclear and nondescript var tooltipLines = tip.Split("\n"); var result = ""; @@ -195,7 +199,7 @@ namespace CalamityMod.Buffs } tip = result; break; - + case BuffID.NebulaUpDmg1: tip = tip.Replace("15", "7.5"); break; diff --git a/Buffs/Cooldowns/Withered.cs b/Buffs/Cooldowns/Withered.cs index f2974463d0..8bcf884976 100644 --- a/Buffs/Cooldowns/Withered.cs +++ b/Buffs/Cooldowns/Withered.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Buffs/DamageOverTime/BanishingFire.cs b/Buffs/DamageOverTime/BanishingFire.cs index dc79b2c678..0e01549c42 100644 --- a/Buffs/DamageOverTime/BanishingFire.cs +++ b/Buffs/DamageOverTime/BanishingFire.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Buffs/DamageOverTime/BanishingFire.png b/Buffs/DamageOverTime/BanishingFire.png index 27e513237a..2ee38df14e 100644 Binary files a/Buffs/DamageOverTime/BanishingFire.png and b/Buffs/DamageOverTime/BanishingFire.png differ diff --git a/Buffs/DamageOverTime/BurningBlood.png b/Buffs/DamageOverTime/BurningBlood.png index 908f334063..0c10087577 100644 Binary files a/Buffs/DamageOverTime/BurningBlood.png and b/Buffs/DamageOverTime/BurningBlood.png differ diff --git a/Buffs/DamageOverTime/CrushDepth.png b/Buffs/DamageOverTime/CrushDepth.png index 8a03a35601..2f8caad4f7 100644 Binary files a/Buffs/DamageOverTime/CrushDepth.png and b/Buffs/DamageOverTime/CrushDepth.png differ diff --git a/Buffs/DamageOverTime/ElementalMix.cs b/Buffs/DamageOverTime/ElementalMix.cs index d206bffc57..6f64dace2c 100644 --- a/Buffs/DamageOverTime/ElementalMix.cs +++ b/Buffs/DamageOverTime/ElementalMix.cs @@ -68,9 +68,9 @@ namespace CalamityMod.Buffs.DamageOverTime }; Vector2 npcSize = npc.Center + new Vector2(Main.rand.NextFloat(-npc.width / 2, npc.width / 2), Main.rand.NextFloat(-npc.height / 2, npc.height / 2)); Vector2 speed = new Vector2(Main.rand.NextFloat(-3f, 3f), Main.rand.NextFloat(-2.5f, -8.3f)); - + GeneralParticleHandler.SpawnParticle(new TechyHoloysquareParticle(npcSize, speed, Main.rand.NextFloat(1.2f, 3.1f), effectcolor, Main.rand.Next(8, 14))); - + int dustType = Main.rand.NextBool() ? 66 : 247; Dust dust = Dust.NewDustPerfect(npcSize, dustType); dust.scale = (dustType == 66 ? 1.4f : 1.2f); diff --git a/Buffs/DamageOverTime/GodSlayerInferno.png b/Buffs/DamageOverTime/GodSlayerInferno.png index 640a264705..01a444251f 100644 Binary files a/Buffs/DamageOverTime/GodSlayerInferno.png and b/Buffs/DamageOverTime/GodSlayerInferno.png differ diff --git a/Buffs/DamageOverTime/HolyFlames.cs b/Buffs/DamageOverTime/HolyFlames.cs index daedd07c02..eb50771d81 100644 --- a/Buffs/DamageOverTime/HolyFlames.cs +++ b/Buffs/DamageOverTime/HolyFlames.cs @@ -45,7 +45,7 @@ namespace CalamityMod.Buffs.DamageOverTime { Vector2 dustCorner = Player.position - 2f * Vector2.One; Vector2 dustVel = Player.velocity + new Vector2(0f, Main.rand.NextFloat(-5f, -1f)); - int d = Dust.NewDust(dustCorner, Player.width + 4, Player.height + 4, 87, dustVel.X, dustVel.Y); + int d = Dust.NewDust(dustCorner, Player.width + 4, Player.height + 4, DustID.GemTopaz, dustVel.X, dustVel.Y); Main.dust[d].noGravity = true; Main.dust[d].scale = hasDebuffResistance ? Main.rand.NextFloat(0.3f, 0.5f) : Main.rand.NextFloat(0.7f, 1.2f); Main.dust[d].alpha = 235; @@ -66,7 +66,7 @@ namespace CalamityMod.Buffs.DamageOverTime { Vector2 dustCorner = npc.position - 2f * Vector2.One; Vector2 dustVel = npc.velocity + new Vector2(0f, Main.rand.NextFloat(-5f, -1f)); - int d = Dust.NewDust(dustCorner, npc.width + 4, npc.height + 4, 87, dustVel.X, dustVel.Y); + int d = Dust.NewDust(dustCorner, npc.width + 4, npc.height + 4, DustID.GemTopaz, dustVel.X, dustVel.Y); Main.dust[d].noGravity = true; Main.dust[d].scale = Main.rand.NextFloat(0.7f, 1.2f); Main.dust[d].alpha = 235; diff --git a/Buffs/DamageOverTime/HolyFlames.png b/Buffs/DamageOverTime/HolyFlames.png index 81e6eb32ae..8202b95adc 100644 Binary files a/Buffs/DamageOverTime/HolyFlames.png and b/Buffs/DamageOverTime/HolyFlames.png differ diff --git a/Buffs/DamageOverTime/HolyInferno.cs b/Buffs/DamageOverTime/HolyInferno.cs index e3a37a900a..1cf1741ee8 100644 --- a/Buffs/DamageOverTime/HolyInferno.cs +++ b/Buffs/DamageOverTime/HolyInferno.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Buffs/DamageOverTime/MiracleBlight.cs b/Buffs/DamageOverTime/MiracleBlight.cs index 1fee9f02c9..df93272cbd 100644 --- a/Buffs/DamageOverTime/MiracleBlight.cs +++ b/Buffs/DamageOverTime/MiracleBlight.cs @@ -44,10 +44,10 @@ namespace CalamityMod.Buffs.DamageOverTime if (Main.rand.NextBool(2)) { - Dust dust = Dust.NewDustPerfect(Player.Calamity().RandomDebuffVisualSpot, 278, CalamityUtils.RandomVelocity(100f, 70f, 150f, 0.04f)); + Dust dust = Dust.NewDustPerfect(Player.Calamity().RandomDebuffVisualSpot, 66, CalamityUtils.RandomVelocity(100f, 70f, 150f, 0.04f)); dust.noGravity = true; dust.scale = Main.rand.NextFloat(0.7f, 0.85f); - dust.color = sparkColor * 0.45f; + dust.color = sparkColor; } float numberOfDusts = 1f; @@ -57,7 +57,7 @@ namespace CalamityMod.Buffs.DamageOverTime float rot = MathHelper.ToRadians(i * rotFactor); Vector2 velOffset = CalamityUtils.RandomVelocity(100f, 70f, 150f, 0.04f); velOffset *= Main.rand.NextFloat(2, 13); - SquishyLightParticle exoEnergy = new(Player.Center + Player.velocity * 3 + velOffset * 1.5f, -velOffset * 0.25f, 0.3f, sparkColor, 8); + Particle exoEnergy = new GlowSparkParticle(Player.Center + Player.velocity * 3 + velOffset * 1.5f, -velOffset * 0.25f, false, 4, 0.008f, sparkColor, new Vector2(0.6f, 1.2f)); GeneralParticleHandler.SpawnParticle(exoEnergy); } } @@ -73,26 +73,24 @@ namespace CalamityMod.Buffs.DamageOverTime _ => Color.LawnGreen, }; - if (Main.rand.NextBool(3)) + if (Main.rand.NextBool(4)) { - Dust dust = Dust.NewDustPerfect(npcSize, 278, CalamityUtils.RandomVelocity(100f, 70f, 150f, 0.04f)); + Dust dust = Dust.NewDustPerfect(npcSize, 66, CalamityUtils.RandomVelocity(100f, 70f, 150f, 0.04f)); dust.noGravity = true; dust.scale = Main.rand.NextFloat(0.7f, 0.85f) + (0.0000007f * npc.width * npc.height); - dust.color = sparkColor * 0.45f; + dust.color = sparkColor; } - float numberOfDusts = 1f; - float rotFactor = 360f / numberOfDusts; - if (Main.rand.NextBool()) + + float rotFactor = 360f; + if (Main.rand.NextBool(3)) { - for (int i = 0; i < numberOfDusts; i++) - { - float rot = MathHelper.ToRadians(i * rotFactor); - Vector2 velOffset = CalamityUtils.RandomVelocity(100f, 70f, 150f, 0.04f); - velOffset *= Main.rand.NextFloat(1, 9) + (0.0002f * npc.width * npc.height); - SquishyLightParticle exoEnergy = new(npc.Center + npc.velocity * 3 + velOffset * 1.5f, -velOffset * 0.25f, 0.3f, sparkColor, 8); - GeneralParticleHandler.SpawnParticle(exoEnergy); - } + float rot = MathHelper.ToRadians(rotFactor); + Vector2 velOffset = CalamityUtils.RandomVelocity(100f, 70f, 150f, 0.04f); + velOffset *= Main.rand.NextFloat(5, 9) + (0.0002f * npc.width * npc.height); + + Particle exoEnergy = new GlowSparkParticle(npc.Center + npc.velocity * 3 + velOffset * 1.5f, -velOffset * 0.25f, false, 4, 0.008f, sparkColor, new Vector2(0.6f, 1.2f)); + GeneralParticleHandler.SpawnParticle(exoEnergy); } } } diff --git a/Buffs/DamageOverTime/Plague.png b/Buffs/DamageOverTime/Plague.png index 16de187484..c9c78b18aa 100644 Binary files a/Buffs/DamageOverTime/Plague.png and b/Buffs/DamageOverTime/Plague.png differ diff --git a/Buffs/DamageOverTime/RiptideDebuff.cs b/Buffs/DamageOverTime/RiptideDebuff.cs index 8d6e12d4c7..0de09111d2 100644 --- a/Buffs/DamageOverTime/RiptideDebuff.cs +++ b/Buffs/DamageOverTime/RiptideDebuff.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Buffs.DamageOverTime if (Main.rand.NextBool(7)) { - int dust = Dust.NewDust(drawInfo.Position - new Vector2(2f), Player.width + 4, Player.height + 4, 165, Player.velocity.X * 0.4f, Player.velocity.Y * 0.4f, 100, default, 1f); + int dust = Dust.NewDust(drawInfo.Position - new Vector2(2f), Player.width + 4, Player.height + 4, DustID.FungiHit, Player.velocity.X * 0.4f, Player.velocity.Y * 0.4f, 100, default, 1f); Main.dust[dust].noGravity = false; Main.dust[dust].velocity *= 1.2f; Main.dust[dust].velocity.Y += 0.8f; @@ -47,7 +47,7 @@ namespace CalamityMod.Buffs.DamageOverTime { if (Main.rand.Next(7) < 3) { - int dust = Dust.NewDust(npc.position - new Vector2(2f, 2f), npc.width + 4, npc.height + 4, 165, npc.velocity.X * 0.4f, npc.velocity.Y * 0.4f, 100, default, 1f); + int dust = Dust.NewDust(npc.position - new Vector2(2f, 2f), npc.width + 4, npc.height + 4, DustID.FungiHit, npc.velocity.X * 0.4f, npc.velocity.Y * 0.4f, 100, default, 1f); Main.dust[dust].noGravity = false; Main.dust[dust].velocity *= 1.2f; Main.dust[dust].velocity.Y += 0.5f; diff --git a/Buffs/DamageOverTime/RiptideDebuff.png b/Buffs/DamageOverTime/RiptideDebuff.png index e61eb2a105..b7397c5c44 100644 Binary files a/Buffs/DamageOverTime/RiptideDebuff.png and b/Buffs/DamageOverTime/RiptideDebuff.png differ diff --git a/Buffs/DamageOverTime/SagePoison.cs b/Buffs/DamageOverTime/SagePoison.cs index 73f881b617..623c95a1a5 100644 --- a/Buffs/DamageOverTime/SagePoison.cs +++ b/Buffs/DamageOverTime/SagePoison.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.DamageOverTime diff --git a/Buffs/DamageOverTime/Shadowflame.cs b/Buffs/DamageOverTime/Shadowflame.cs index 312bc3f930..c67307c354 100644 --- a/Buffs/DamageOverTime/Shadowflame.cs +++ b/Buffs/DamageOverTime/Shadowflame.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Buffs.DamageOverTime if (Main.rand.Next(5) < 4) { - int dust = Dust.NewDust(drawInfo.Position - new Vector2(2f), Player.width + 4, Player.height + 4, 27, Player.velocity.X * 0.4f, Player.velocity.Y * 0.4f, 100, default, 1.1f); + int dust = Dust.NewDust(drawInfo.Position - new Vector2(2f), Player.width + 4, Player.height + 4, DustID.Shadowflame, Player.velocity.X * 0.4f, Player.velocity.Y * 0.4f, 100, default, 1.1f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 0.75f; Main.dust[dust].velocity.X = Main.dust[dust].velocity.X * 0.75f; diff --git a/Buffs/DamageOverTime/ShellfishClaps.cs b/Buffs/DamageOverTime/ShellfishClaps.cs index df8d42e45f..697a8f241b 100644 --- a/Buffs/DamageOverTime/ShellfishClaps.cs +++ b/Buffs/DamageOverTime/ShellfishClaps.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.DamageOverTime diff --git a/Buffs/DamageOverTime/SulphuricPoisoning.cs b/Buffs/DamageOverTime/SulphuricPoisoning.cs index 1e0943f932..ebf3b5af1d 100644 --- a/Buffs/DamageOverTime/SulphuricPoisoning.cs +++ b/Buffs/DamageOverTime/SulphuricPoisoning.cs @@ -45,7 +45,7 @@ namespace CalamityMod.Buffs.DamageOverTime if (Main.rand.Next(5) < 4) { - int dust = Dust.NewDust(drawInfo.Position - new Vector2(2f), Player.width + 4, Player.height + 4, 298, Player.velocity.X * 0.4f, Player.velocity.Y * 0.4f, 100, default, 0.6f); + int dust = Dust.NewDust(drawInfo.Position - new Vector2(2f), Player.width + 4, Player.height + 4, DustID.JungleTorch, Player.velocity.X * 0.4f, Player.velocity.Y * 0.4f, 100, default, 0.6f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 0.75f; Main.dust[dust].velocity.X = Main.dust[dust].velocity.X * 0.75f; @@ -68,7 +68,7 @@ namespace CalamityMod.Buffs.DamageOverTime if (Main.rand.NextBool()) { Vector2 npcSize = npc.Center + new Vector2(Main.rand.NextFloat(-npc.width / 2, npc.width / 2), Main.rand.NextFloat(-npc.height / 2, npc.height / 2)); - int dust = Dust.NewDust(npc.position - new Vector2(2f), npc.width + 4, npc.height + 4, 298, npc.velocity.X * 0.4f, npc.velocity.Y * 0.4f, 100, default, 1.2f + +(0.000003f * npc.width * npc.height)); + int dust = Dust.NewDust(npc.position - new Vector2(2f), npc.width + 4, npc.height + 4, DustID.JungleTorch, npc.velocity.X * 0.4f, npc.velocity.Y * 0.4f, 100, default, 1.2f + +(0.000003f * npc.width * npc.height)); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 0.75f; Main.dust[dust].velocity.X = Main.dust[dust].velocity.X * 0.75f; diff --git a/Buffs/DamageOverTime/VulnerabilityHex.cs b/Buffs/DamageOverTime/VulnerabilityHex.cs index 0cf450b4db..6ea2f5c298 100644 --- a/Buffs/DamageOverTime/VulnerabilityHex.cs +++ b/Buffs/DamageOverTime/VulnerabilityHex.cs @@ -1,7 +1,12 @@ -using CalamityMod.NPCs; +using CalamityMod.NPCs; +using CalamityMod.Particles; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using Microsoft.Xna.Framework; +using ReLogic.Utilities; +using CalamityMod.Dusts; namespace CalamityMod.Buffs.DamageOverTime { @@ -46,5 +51,22 @@ namespace CalamityMod.Buffs.DamageOverTime npc.DelBuff(buffIndex); buffIndex--; } + internal static void DrawEffects(PlayerDrawSet drawInfo) + { + Player Player = drawInfo.drawPlayer; + + if (Main.rand.NextBool()) + { + VoidSparkParticle spark2 = new VoidSparkParticle(Player.Calamity().RandomDebuffVisualSpot, new Vector2(0, Main.rand.NextFloat(-6f, -10f)), false, Main.rand.Next(18, 27), Main.rand.NextFloat(0.015f, 0.045f), Main.rand.NextBool() ? Color.Red : Color.Lerp(Color.Red, Color.Magenta, 0.65f)); + GeneralParticleHandler.SpawnParticle(spark2); + } + + Dust dust = Dust.NewDustPerfect(Player.Calamity().RandomDebuffVisualSpot, Main.rand.NextBool() ? 261 :(int)CalamityDusts.Brimstone); + dust.scale = Main.rand.NextFloat(0.4f, 0.5f); + dust.velocity = new Vector2(0, Main.rand.NextFloat(-0.5f, -2.5f)).RotatedByRandom(0.6f); + if (dust.type == 261) + dust.color = Color.Lerp(Color.Red, Color.Magenta, 0.65f); + + } } } diff --git a/Buffs/DamageOverTime/VulnerabilityHex.png b/Buffs/DamageOverTime/VulnerabilityHex.png index c547bc2e18..2793cfdc04 100644 Binary files a/Buffs/DamageOverTime/VulnerabilityHex.png and b/Buffs/DamageOverTime/VulnerabilityHex.png differ diff --git a/Buffs/DamageOverTime/WeakBrimstoneFlames.cs b/Buffs/DamageOverTime/WeakBrimstoneFlames.cs index 4a6614eed4..026531e132 100644 --- a/Buffs/DamageOverTime/WeakBrimstoneFlames.cs +++ b/Buffs/DamageOverTime/WeakBrimstoneFlames.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.DamageOverTime diff --git a/Buffs/Mounts/AlicornBuff.cs b/Buffs/Mounts/AlicornBuff.cs index 9d1d24d1e4..34dad87b5a 100644 --- a/Buffs/Mounts/AlicornBuff.cs +++ b/Buffs/Mounts/AlicornBuff.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Mounts; +using CalamityMod.Items.Mounts; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Mounts diff --git a/Buffs/Mounts/AndromedaBuff.cs b/Buffs/Mounts/AndromedaBuff.cs index bf9f865570..e352ea4940 100644 --- a/Buffs/Mounts/AndromedaBuff.cs +++ b/Buffs/Mounts/AndromedaBuff.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Mounts diff --git a/Buffs/Mounts/AndromedaSmallBuff.cs b/Buffs/Mounts/AndromedaSmallBuff.cs index af2ed2e41e..d7b33799d2 100644 --- a/Buffs/Mounts/AndromedaSmallBuff.cs +++ b/Buffs/Mounts/AndromedaSmallBuff.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Mounts diff --git a/Buffs/Mounts/BrimroseMount.cs b/Buffs/Mounts/BrimroseMount.cs index e696caca98..787bc90c18 100644 --- a/Buffs/Mounts/BrimroseMount.cs +++ b/Buffs/Mounts/BrimroseMount.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Mounts; +using CalamityMod.Items.Mounts; using Terraria; using Terraria.ModLoader; diff --git a/Buffs/Mounts/DraedonGamerChairBuff.cs b/Buffs/Mounts/DraedonGamerChairBuff.cs index f6a0cafe86..6c23e863c0 100644 --- a/Buffs/Mounts/DraedonGamerChairBuff.cs +++ b/Buffs/Mounts/DraedonGamerChairBuff.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Mounts; +using CalamityMod.Items.Mounts; using Terraria; using Terraria.ModLoader; diff --git a/Buffs/Mounts/GazeOfCrysthamyrBuff.cs b/Buffs/Mounts/GazeOfCrysthamyrBuff.cs index 9a613c5b22..41e85be969 100644 --- a/Buffs/Mounts/GazeOfCrysthamyrBuff.cs +++ b/Buffs/Mounts/GazeOfCrysthamyrBuff.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Mounts; +using CalamityMod.Items.Mounts; using Terraria; using Terraria.ModLoader; diff --git a/Buffs/Mounts/MarniteLiftBuff.cs b/Buffs/Mounts/MarniteLiftBuff.cs index abd329f20d..9bb8b0917a 100644 --- a/Buffs/Mounts/MarniteLiftBuff.cs +++ b/Buffs/Mounts/MarniteLiftBuff.cs @@ -1,7 +1,7 @@ -using CalamityMod.Items.Mounts; +using CalamityMod.Items.Armor.MarniteArchitect; +using CalamityMod.Items.Mounts; using Terraria; using Terraria.ModLoader; -using CalamityMod.Items.Armor.MarniteArchitect; namespace CalamityMod.Buffs.Mounts { diff --git a/Buffs/Mounts/OnyxExcavatorBuff.cs b/Buffs/Mounts/OnyxExcavatorBuff.cs index 4002ec02e6..fb2b2d0cd7 100644 --- a/Buffs/Mounts/OnyxExcavatorBuff.cs +++ b/Buffs/Mounts/OnyxExcavatorBuff.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Mounts; +using CalamityMod.Items.Mounts; using Terraria; using Terraria.ModLoader; diff --git a/Buffs/Mounts/SquishyBeanBuff.cs b/Buffs/Mounts/SquishyBeanBuff.cs index 06fd60ea2a..51347665c5 100644 --- a/Buffs/Mounts/SquishyBeanBuff.cs +++ b/Buffs/Mounts/SquishyBeanBuff.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Mounts; +using CalamityMod.Items.Mounts; using Terraria; using Terraria.ModLoader; diff --git a/Buffs/Pets/ArcherofLunamoon.cs b/Buffs/Pets/ArcherofLunamoon.cs index 053255cfab..d030819e3c 100644 --- a/Buffs/Pets/ArcherofLunamoon.cs +++ b/Buffs/Pets/ArcherofLunamoon.cs @@ -1,4 +1,4 @@ -using CalamityMod.Projectiles.Pets; +using CalamityMod.Projectiles.Pets; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; diff --git a/Buffs/Pets/BloodBound.cs b/Buffs/Pets/BloodBound.cs index 7ecaf77732..898fa327a0 100644 --- a/Buffs/Pets/BloodBound.cs +++ b/Buffs/Pets/BloodBound.cs @@ -1,4 +1,4 @@ -using CalamityMod.Projectiles.Pets; +using CalamityMod.Projectiles.Pets; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; diff --git a/Buffs/Pets/BrimlingBuff.cs b/Buffs/Pets/BrimlingBuff.cs index 49f6276df7..c494fa44d9 100644 --- a/Buffs/Pets/BrimlingBuff.cs +++ b/Buffs/Pets/BrimlingBuff.cs @@ -1,4 +1,4 @@ -using CalamityMod.Projectiles.Pets; +using CalamityMod.Projectiles.Pets; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; diff --git a/Buffs/Pets/ChibiiDoGBuff.cs b/Buffs/Pets/ChibiiDoGBuff.cs index 290d40641f..9521145c2b 100644 --- a/Buffs/Pets/ChibiiDoGBuff.cs +++ b/Buffs/Pets/ChibiiDoGBuff.cs @@ -1,4 +1,4 @@ -using CalamityMod.Projectiles.Pets; +using CalamityMod.Projectiles.Pets; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; diff --git a/Buffs/Pets/DannyDevito.cs b/Buffs/Pets/DannyDevito.cs index f70e08dc31..58db4de5cd 100644 --- a/Buffs/Pets/DannyDevito.cs +++ b/Buffs/Pets/DannyDevito.cs @@ -1,4 +1,4 @@ -using CalamityMod.Projectiles.Pets; +using CalamityMod.Projectiles.Pets; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; diff --git a/Buffs/Pets/EidolonSnailBuff.cs b/Buffs/Pets/EidolonSnailBuff.cs index 08f49bd8e0..6029ad0795 100644 --- a/Buffs/Pets/EidolonSnailBuff.cs +++ b/Buffs/Pets/EidolonSnailBuff.cs @@ -1,4 +1,4 @@ -using CalamityMod.Projectiles.Pets; +using CalamityMod.Projectiles.Pets; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; diff --git a/Buffs/Pets/EidolonSnailBuff.png b/Buffs/Pets/EidolonSnailBuff.png index 6cc347ab66..d237231cbd 100644 Binary files a/Buffs/Pets/EidolonSnailBuff.png and b/Buffs/Pets/EidolonSnailBuff.png differ diff --git a/Buffs/Pets/ElectricTroublemaker.cs b/Buffs/Pets/ElectricTroublemaker.cs index 263a81f484..dc920e9c2f 100644 --- a/Buffs/Pets/ElectricTroublemaker.cs +++ b/Buffs/Pets/ElectricTroublemaker.cs @@ -1,4 +1,4 @@ -using CalamityMod.Projectiles.Pets; +using CalamityMod.Projectiles.Pets; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; diff --git a/Buffs/Pets/FlakHermitBuff.cs b/Buffs/Pets/FlakHermitBuff.cs index 92fc8e2c26..08e6a6ca6a 100644 --- a/Buffs/Pets/FlakHermitBuff.cs +++ b/Buffs/Pets/FlakHermitBuff.cs @@ -1,4 +1,4 @@ -using CalamityMod.Projectiles.Pets; +using CalamityMod.Projectiles.Pets; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; diff --git a/Buffs/Pets/FoxPetBuff.cs b/Buffs/Pets/FoxPetBuff.cs index 09211e2fb7..34b8520912 100644 --- a/Buffs/Pets/FoxPetBuff.cs +++ b/Buffs/Pets/FoxPetBuff.cs @@ -1,4 +1,4 @@ -using CalamityMod.Projectiles.Pets; +using CalamityMod.Projectiles.Pets; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; diff --git a/Buffs/Pets/FurtasticDuoBuff.cs b/Buffs/Pets/FurtasticDuoBuff.cs index 84411bc7c9..806da56a53 100644 --- a/Buffs/Pets/FurtasticDuoBuff.cs +++ b/Buffs/Pets/FurtasticDuoBuff.cs @@ -1,6 +1,6 @@ +using System.Collections.Generic; using CalamityMod.Projectiles.Pets; using Microsoft.Xna.Framework; -using System.Collections.Generic; using Terraria; using Terraria.ModLoader; diff --git a/Buffs/Pets/GoldieBuff.cs b/Buffs/Pets/GoldieBuff.cs index 01d28e19ac..c07dc13656 100644 --- a/Buffs/Pets/GoldieBuff.cs +++ b/Buffs/Pets/GoldieBuff.cs @@ -1,4 +1,4 @@ -using CalamityMod.Projectiles.Pets; +using CalamityMod.Projectiles.Pets; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; diff --git a/Buffs/Pets/Kendra.cs b/Buffs/Pets/Kendra.cs index e0fb0edf7b..ff7b55ff92 100644 --- a/Buffs/Pets/Kendra.cs +++ b/Buffs/Pets/Kendra.cs @@ -1,4 +1,4 @@ -using CalamityMod.Projectiles.Pets; +using CalamityMod.Projectiles.Pets; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; diff --git a/Buffs/Pets/LadBuff.cs b/Buffs/Pets/LadBuff.cs index 9f8a2a68e1..58f41bd126 100644 --- a/Buffs/Pets/LadBuff.cs +++ b/Buffs/Pets/LadBuff.cs @@ -1,4 +1,4 @@ -using CalamityMod.Projectiles.Pets; +using CalamityMod.Projectiles.Pets; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; diff --git a/Buffs/Pets/LeviBuff.cs b/Buffs/Pets/LeviBuff.cs index 8d2d3c42e9..48f89cbe24 100644 --- a/Buffs/Pets/LeviBuff.cs +++ b/Buffs/Pets/LeviBuff.cs @@ -1,4 +1,4 @@ -using CalamityMod.Projectiles.Pets; +using CalamityMod.Projectiles.Pets; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; diff --git a/Buffs/Pets/LittleLightBuff.cs b/Buffs/Pets/LittleLightBuff.cs index be418a26e5..17bf5d0737 100644 --- a/Buffs/Pets/LittleLightBuff.cs +++ b/Buffs/Pets/LittleLightBuff.cs @@ -1,4 +1,4 @@ -using CalamityMod.Projectiles.Pets; +using CalamityMod.Projectiles.Pets; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; diff --git a/Buffs/Pets/LordeBuff.cs b/Buffs/Pets/LordeBuff.cs index 06a0bbc274..5320ede32b 100644 --- a/Buffs/Pets/LordeBuff.cs +++ b/Buffs/Pets/LordeBuff.cs @@ -1,4 +1,4 @@ -using CalamityMod.Projectiles.Pets; +using CalamityMod.Projectiles.Pets; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; diff --git a/Buffs/Pets/MiniMindBuff.cs b/Buffs/Pets/MiniMindBuff.cs index 3dab266aea..78ad2aad9d 100644 --- a/Buffs/Pets/MiniMindBuff.cs +++ b/Buffs/Pets/MiniMindBuff.cs @@ -1,4 +1,4 @@ -using CalamityMod.Projectiles.Pets; +using CalamityMod.Projectiles.Pets; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; diff --git a/Buffs/Pets/OceanSpiritBuff.cs b/Buffs/Pets/OceanSpiritBuff.cs index b7f3807e5b..2215cb2ba5 100644 --- a/Buffs/Pets/OceanSpiritBuff.cs +++ b/Buffs/Pets/OceanSpiritBuff.cs @@ -1,4 +1,4 @@ -using CalamityMod.Projectiles.Pets; +using CalamityMod.Projectiles.Pets; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; diff --git a/Buffs/Pets/PineappleBuff.cs b/Buffs/Pets/PineappleBuff.cs index 91ec7eb33d..ff78529513 100644 --- a/Buffs/Pets/PineappleBuff.cs +++ b/Buffs/Pets/PineappleBuff.cs @@ -1,4 +1,4 @@ -using CalamityMod.Projectiles.Pets; +using CalamityMod.Projectiles.Pets; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; diff --git a/Buffs/Pets/PlaguebringerBabBuff.cs b/Buffs/Pets/PlaguebringerBabBuff.cs index f4881c12a1..2d6224adab 100644 --- a/Buffs/Pets/PlaguebringerBabBuff.cs +++ b/Buffs/Pets/PlaguebringerBabBuff.cs @@ -1,4 +1,4 @@ -using CalamityMod.Projectiles.Pets; +using CalamityMod.Projectiles.Pets; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; diff --git a/Buffs/Pets/RadiatorBuff.cs b/Buffs/Pets/RadiatorBuff.cs index c7e4810f47..654f42e0c7 100644 --- a/Buffs/Pets/RadiatorBuff.cs +++ b/Buffs/Pets/RadiatorBuff.cs @@ -1,4 +1,4 @@ -using CalamityMod.Projectiles.Pets; +using CalamityMod.Projectiles.Pets; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; diff --git a/Buffs/Pets/ReaverOrbBuff.cs b/Buffs/Pets/ReaverOrbBuff.cs index a9f27d4f4e..3be4f5a02b 100644 --- a/Buffs/Pets/ReaverOrbBuff.cs +++ b/Buffs/Pets/ReaverOrbBuff.cs @@ -1,4 +1,4 @@ -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Typeless; using Terraria; using Terraria.ModLoader; diff --git a/Buffs/Pets/SparksBuff.cs b/Buffs/Pets/SparksBuff.cs index bdd642fc05..d081130acd 100644 --- a/Buffs/Pets/SparksBuff.cs +++ b/Buffs/Pets/SparksBuff.cs @@ -1,4 +1,4 @@ -using CalamityMod.Projectiles.Pets; +using CalamityMod.Projectiles.Pets; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; diff --git a/Buffs/Pets/ThirdSageBuff.cs b/Buffs/Pets/ThirdSageBuff.cs index cc95682e72..f8aa396cbe 100644 --- a/Buffs/Pets/ThirdSageBuff.cs +++ b/Buffs/Pets/ThirdSageBuff.cs @@ -1,4 +1,4 @@ -using CalamityMod.Projectiles.Pets; +using CalamityMod.Projectiles.Pets; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; diff --git a/Buffs/Pets/YharonSonBuff.cs b/Buffs/Pets/YharonSonBuff.cs index 1bf982ec08..06a3aa955c 100644 --- a/Buffs/Pets/YharonSonBuff.cs +++ b/Buffs/Pets/YharonSonBuff.cs @@ -1,4 +1,4 @@ -using CalamityMod.Projectiles.Pets; +using CalamityMod.Projectiles.Pets; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; diff --git a/Buffs/Placeables/ChaosCandleBuff.cs b/Buffs/Placeables/ChaosCandleBuff.cs index bbef38e859..08fb2df6fc 100644 --- a/Buffs/Placeables/ChaosCandleBuff.cs +++ b/Buffs/Placeables/ChaosCandleBuff.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Buffs/Placeables/CirrusPinkCandleBuff.cs b/Buffs/Placeables/CirrusPinkCandleBuff.cs index 93d389d70c..eaeb003cbc 100644 --- a/Buffs/Placeables/CirrusPinkCandleBuff.cs +++ b/Buffs/Placeables/CirrusPinkCandleBuff.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Buffs/Placeables/CirrusPurpleCandleBuff.cs b/Buffs/Placeables/CirrusPurpleCandleBuff.cs index 7b41d4dcb4..1d50225a40 100644 --- a/Buffs/Placeables/CirrusPurpleCandleBuff.cs +++ b/Buffs/Placeables/CirrusPurpleCandleBuff.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Placeables public class CirrusPurpleCandleBuff : ModBuff { public static float DefenseRatioBonus = 0.15f; - + public override void SetStaticDefaults() { Main.buffNoTimeDisplay[Type] = true; diff --git a/Buffs/Placeables/CorruptionEffigyBuff.cs b/Buffs/Placeables/CorruptionEffigyBuff.cs index 681aa3b727..e4d2e0a39f 100644 --- a/Buffs/Placeables/CorruptionEffigyBuff.cs +++ b/Buffs/Placeables/CorruptionEffigyBuff.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Placeables diff --git a/Buffs/Placeables/CrimsonEffigyBuff.cs b/Buffs/Placeables/CrimsonEffigyBuff.cs index c42b55817c..a26c9e3f4e 100644 --- a/Buffs/Placeables/CrimsonEffigyBuff.cs +++ b/Buffs/Placeables/CrimsonEffigyBuff.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Placeables diff --git a/Buffs/Placeables/EffigyOfDecayBuff.cs b/Buffs/Placeables/EffigyOfDecayBuff.cs index b82d6b9d71..516fbd554c 100644 --- a/Buffs/Placeables/EffigyOfDecayBuff.cs +++ b/Buffs/Placeables/EffigyOfDecayBuff.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Placeables diff --git a/Buffs/Placeables/TranquilityCandleBuff.cs b/Buffs/Placeables/TranquilityCandleBuff.cs index b825436a5e..481538bdfd 100644 --- a/Buffs/Placeables/TranquilityCandleBuff.cs +++ b/Buffs/Placeables/TranquilityCandleBuff.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Buffs/PopoBuff.cs b/Buffs/PopoBuff.cs index 540a5bd24c..f5d8e36d54 100644 --- a/Buffs/PopoBuff.cs +++ b/Buffs/PopoBuff.cs @@ -1,4 +1,4 @@ -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Buffs/PopoNoselessBuff.cs b/Buffs/PopoNoselessBuff.cs index bdbec706fe..ed87c9db8d 100644 --- a/Buffs/PopoNoselessBuff.cs +++ b/Buffs/PopoNoselessBuff.cs @@ -1,4 +1,4 @@ -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Buffs/Potions/AstralInjectionBuff.cs b/Buffs/Potions/AstralInjectionBuff.cs index 58f8669529..850dea5e0e 100644 --- a/Buffs/Potions/AstralInjectionBuff.cs +++ b/Buffs/Potions/AstralInjectionBuff.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Potions diff --git a/Buffs/Potions/BaguetteBuff.cs b/Buffs/Potions/BaguetteBuff.cs index 5c167f527f..878bca7213 100644 --- a/Buffs/Potions/BaguetteBuff.cs +++ b/Buffs/Potions/BaguetteBuff.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Potions diff --git a/Buffs/Potions/BloodfinBoost.cs b/Buffs/Potions/BloodfinBoost.cs index 5e8bef54f0..fb1070b016 100644 --- a/Buffs/Potions/BloodfinBoost.cs +++ b/Buffs/Potions/BloodfinBoost.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Potions diff --git a/Buffs/Potions/BoundingBuff.cs b/Buffs/Potions/BoundingBuff.cs index ff03aa6304..4e400c5201 100644 --- a/Buffs/Potions/BoundingBuff.cs +++ b/Buffs/Potions/BoundingBuff.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Potions diff --git a/Buffs/Potions/CalciumBuff.cs b/Buffs/Potions/CalciumBuff.cs index 036bbbf871..0a55b80590 100644 --- a/Buffs/Potions/CalciumBuff.cs +++ b/Buffs/Potions/CalciumBuff.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Potions diff --git a/Buffs/Potions/CeaselessHunger.cs b/Buffs/Potions/CeaselessHunger.cs index f9ebdb134d..6d88f7b282 100644 --- a/Buffs/Potions/CeaselessHunger.cs +++ b/Buffs/Potions/CeaselessHunger.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Potions diff --git a/Buffs/Potions/GravityNormalizerBuff.cs b/Buffs/Potions/GravityNormalizerBuff.cs index 3fb764bf53..d7c3944202 100644 --- a/Buffs/Potions/GravityNormalizerBuff.cs +++ b/Buffs/Potions/GravityNormalizerBuff.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Potions diff --git a/Buffs/Potions/Omniscience.cs b/Buffs/Potions/Omniscience.cs index d7c2cbcc9e..a659d3b09e 100644 --- a/Buffs/Potions/Omniscience.cs +++ b/Buffs/Potions/Omniscience.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Potions diff --git a/Buffs/Potions/PhotosynthesisBuff.cs b/Buffs/Potions/PhotosynthesisBuff.cs index 5f4ab2eaba..202952cb86 100644 --- a/Buffs/Potions/PhotosynthesisBuff.cs +++ b/Buffs/Potions/PhotosynthesisBuff.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Potions diff --git a/Buffs/Potions/Soaring.cs b/Buffs/Potions/Soaring.cs index 43a3b9b853..bb5e481442 100644 --- a/Buffs/Potions/Soaring.cs +++ b/Buffs/Potions/Soaring.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Potions diff --git a/Buffs/Potions/SulphurskinBuff.cs b/Buffs/Potions/SulphurskinBuff.cs index dea0a58c2e..b4c54fd728 100644 --- a/Buffs/Potions/SulphurskinBuff.cs +++ b/Buffs/Potions/SulphurskinBuff.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Potions diff --git a/Buffs/Potions/TeslaBuff.cs b/Buffs/Potions/TeslaBuff.cs index c2cf1e9778..e5a8fac63b 100644 --- a/Buffs/Potions/TeslaBuff.cs +++ b/Buffs/Potions/TeslaBuff.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Potions diff --git a/Buffs/Potions/WeaponImbueCrumbling.cs b/Buffs/Potions/WeaponImbueCrumbling.cs index af06afa89f..30eca383e3 100644 --- a/Buffs/Potions/WeaponImbueCrumbling.cs +++ b/Buffs/Potions/WeaponImbueCrumbling.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Buffs/Potions/WeaponImbueHolyFlames.cs b/Buffs/Potions/WeaponImbueHolyFlames.cs index ee7a8e221c..b1f3edb733 100644 --- a/Buffs/Potions/WeaponImbueHolyFlames.cs +++ b/Buffs/Potions/WeaponImbueHolyFlames.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Buffs/Potions/Zen.cs b/Buffs/Potions/Zen.cs index e0aa64166a..06534582e9 100644 --- a/Buffs/Potions/Zen.cs +++ b/Buffs/Potions/Zen.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Potions diff --git a/Buffs/Potions/Zerg.cs b/Buffs/Potions/Zerg.cs index 241f6dbb18..494404d3f1 100644 --- a/Buffs/Potions/Zerg.cs +++ b/Buffs/Potions/Zerg.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Potions diff --git a/Buffs/StatBuffs/AbyssalDivingSuitBuff.cs b/Buffs/StatBuffs/AbyssalDivingSuitBuff.cs index c385db4eec..92cab6a912 100644 --- a/Buffs/StatBuffs/AbyssalDivingSuitBuff.cs +++ b/Buffs/StatBuffs/AbyssalDivingSuitBuff.cs @@ -1,4 +1,4 @@ -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -20,7 +20,8 @@ namespace CalamityMod.Buffs.StatBuffs CalamityPlayer modPlayer = player.Calamity(); if (modPlayer.abyssalDivingSuitPrevious) { - player.gills = true; + if (player.IsUnderwater()) + player.gills = true; modPlayer.abyssalDivingSuitPower = true; modPlayer.depthCharm = true; modPlayer.jellyfishNecklace = true; diff --git a/Buffs/StatBuffs/AbyssalDivingSuitPlates.cs b/Buffs/StatBuffs/AbyssalDivingSuitPlates.cs index 537e2fac7f..41164d0898 100644 --- a/Buffs/StatBuffs/AbyssalDivingSuitPlates.cs +++ b/Buffs/StatBuffs/AbyssalDivingSuitPlates.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.StatBuffs diff --git a/Buffs/StatBuffs/AbyssalMadness.cs b/Buffs/StatBuffs/AbyssalMadness.cs index f1370a9848..1851277c44 100644 --- a/Buffs/StatBuffs/AbyssalMadness.cs +++ b/Buffs/StatBuffs/AbyssalMadness.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Buffs/StatBuffs/AdrenalineMode.png b/Buffs/StatBuffs/AdrenalineMode.png index bedcc91f12..b4e6dd7722 100644 Binary files a/Buffs/StatBuffs/AdrenalineMode.png and b/Buffs/StatBuffs/AdrenalineMode.png differ diff --git a/Buffs/StatBuffs/AvertorBonus.cs b/Buffs/StatBuffs/AvertorBonus.cs index e49fc0e27c..9922849fcd 100644 --- a/Buffs/StatBuffs/AvertorBonus.cs +++ b/Buffs/StatBuffs/AvertorBonus.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.StatBuffs diff --git a/Buffs/StatBuffs/BloodflareBloodFrenzy.cs b/Buffs/StatBuffs/BloodflareBloodFrenzy.cs index 89bed17cde..05ecf22acc 100644 --- a/Buffs/StatBuffs/BloodflareBloodFrenzy.cs +++ b/Buffs/StatBuffs/BloodflareBloodFrenzy.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Buffs/StatBuffs/BrimflameFrenzyBuff.cs b/Buffs/StatBuffs/BrimflameFrenzyBuff.cs index 4280220e7e..abfddde155 100644 --- a/Buffs/StatBuffs/BrimflameFrenzyBuff.cs +++ b/Buffs/StatBuffs/BrimflameFrenzyBuff.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.StatBuffs diff --git a/Buffs/StatBuffs/BrutalCarnage.cs b/Buffs/StatBuffs/BrutalCarnage.cs index 8479469036..fc1c643160 100644 --- a/Buffs/StatBuffs/BrutalCarnage.cs +++ b/Buffs/StatBuffs/BrutalCarnage.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.StatBuffs diff --git a/Buffs/StatBuffs/CoralSymbiosis.cs b/Buffs/StatBuffs/CoralSymbiosis.cs index 49995df268..0a3e8851bf 100644 --- a/Buffs/StatBuffs/CoralSymbiosis.cs +++ b/Buffs/StatBuffs/CoralSymbiosis.cs @@ -1,6 +1,6 @@ -using Terraria; +using CalamityMod.Items.Weapons.Magic; +using Terraria; using Terraria.ModLoader; -using CalamityMod.Items.Weapons.Magic; namespace CalamityMod.Buffs.StatBuffs { diff --git a/Buffs/StatBuffs/CosmicFreeze.cs b/Buffs/StatBuffs/CosmicFreeze.cs index fe3a7fd275..5d8d0be350 100644 --- a/Buffs/StatBuffs/CosmicFreeze.cs +++ b/Buffs/StatBuffs/CosmicFreeze.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.StatBuffs diff --git a/Buffs/StatBuffs/DivineBless.cs b/Buffs/StatBuffs/DivineBless.cs index 255d5e3ed9..d54db228c5 100644 --- a/Buffs/StatBuffs/DivineBless.cs +++ b/Buffs/StatBuffs/DivineBless.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Buffs/StatBuffs/DivineBless.png b/Buffs/StatBuffs/DivineBless.png index 3d9c73ec00..80bdca5019 100644 Binary files a/Buffs/StatBuffs/DivineBless.png and b/Buffs/StatBuffs/DivineBless.png differ diff --git a/Buffs/StatBuffs/EmpyreanRage.cs b/Buffs/StatBuffs/EmpyreanRage.cs index 2440bb9bb9..9315409e24 100644 --- a/Buffs/StatBuffs/EmpyreanRage.cs +++ b/Buffs/StatBuffs/EmpyreanRage.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.StatBuffs diff --git a/Buffs/StatBuffs/EmpyreanWrath.cs b/Buffs/StatBuffs/EmpyreanWrath.cs index 99c8d49dde..f74123f6b9 100644 --- a/Buffs/StatBuffs/EmpyreanWrath.cs +++ b/Buffs/StatBuffs/EmpyreanWrath.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.StatBuffs diff --git a/Buffs/StatBuffs/Encased.cs b/Buffs/StatBuffs/Encased.cs index 25a9de731b..251d0489a8 100644 --- a/Buffs/StatBuffs/Encased.cs +++ b/Buffs/StatBuffs/Encased.cs @@ -1,4 +1,6 @@ -using Terraria; +using CalamityMod.Balancing; +using CalamityMod.Items.Accessories; +using Terraria; using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -20,7 +22,10 @@ namespace CalamityMod.Buffs.StatBuffs if (player.buffTime[buffIndex] == 2) { SoundEngine.PlaySound(SoundID.Item27, player.Center); - player.GiveIFrames(90, true); + + // 17APR2024: Ozzatron: Permafrost's Concoction gives true invulnerability to everything and is boosted by Cross Necklace. + int encasedIFrames = PermafrostsConcoction.EncasedIFrames + (player.longInvince ? BalancingConstants.CrossNecklaceIFrameBoost : 0); + player.GiveUniversalIFrames(encasedIFrames, true); } } } diff --git a/Buffs/StatBuffs/GraxBoost.cs b/Buffs/StatBuffs/GraxBoost.cs index 6e43a78270..49814f6e22 100644 --- a/Buffs/StatBuffs/GraxBoost.cs +++ b/Buffs/StatBuffs/GraxBoost.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.StatBuffs diff --git a/Buffs/StatBuffs/HallowedRunePower.cs b/Buffs/StatBuffs/HallowedRunePower.cs index 8e18ca572f..227723e448 100644 --- a/Buffs/StatBuffs/HallowedRunePower.cs +++ b/Buffs/StatBuffs/HallowedRunePower.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.StatBuffs diff --git a/Buffs/StatBuffs/HallowedRuneRegeneration.cs b/Buffs/StatBuffs/HallowedRuneRegeneration.cs index 10c92c5cbc..eb42a16d7c 100644 --- a/Buffs/StatBuffs/HallowedRuneRegeneration.cs +++ b/Buffs/StatBuffs/HallowedRuneRegeneration.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.StatBuffs diff --git a/Buffs/StatBuffs/PolarisBuff.cs b/Buffs/StatBuffs/Haste.cs similarity index 61% rename from Buffs/StatBuffs/PolarisBuff.cs rename to Buffs/StatBuffs/Haste.cs index 9ffe439cb5..e4fa6b578c 100644 --- a/Buffs/StatBuffs/PolarisBuff.cs +++ b/Buffs/StatBuffs/Haste.cs @@ -1,9 +1,9 @@ -using Terraria; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.StatBuffs { - public class PolarisBuff : ModBuff + public class Haste : ModBuff { public override void SetStaticDefaults() { @@ -15,7 +15,11 @@ namespace CalamityMod.Buffs.StatBuffs public override void Update(Player player, ref int buffIndex) { - player.Calamity().polarisBoost = true; + // keep the buff active as long as the player's haste level is up + if (player.Calamity().hasteLevel > 0) + { + player.buffTime[buffIndex] = 60; + } } } } diff --git a/Buffs/StatBuffs/Haste.png b/Buffs/StatBuffs/Haste.png new file mode 100644 index 0000000000..b0e7aebaac Binary files /dev/null and b/Buffs/StatBuffs/Haste.png differ diff --git a/Buffs/StatBuffs/KamiBuff.cs b/Buffs/StatBuffs/KamiBuff.cs index 10cc0726e4..00520d718e 100644 --- a/Buffs/StatBuffs/KamiBuff.cs +++ b/Buffs/StatBuffs/KamiBuff.cs @@ -1,7 +1,7 @@ -using Terraria; +using CalamityMod.Items.Weapons.Typeless; +using Terraria; using Terraria.Audio; using Terraria.ModLoader; -using CalamityMod.Items.Weapons.Typeless; namespace CalamityMod.Buffs.StatBuffs { diff --git a/Buffs/StatBuffs/PolarisBuff.png b/Buffs/StatBuffs/PolarisBuff.png deleted file mode 100644 index fcad4dcc2e..0000000000 Binary files a/Buffs/StatBuffs/PolarisBuff.png and /dev/null differ diff --git a/Buffs/StatBuffs/RageMode.png b/Buffs/StatBuffs/RageMode.png index d9a80f785b..f4ce650e26 100644 Binary files a/Buffs/StatBuffs/RageMode.png and b/Buffs/StatBuffs/RageMode.png differ diff --git a/Buffs/StatBuffs/SilvaRevival.cs b/Buffs/StatBuffs/SilvaRevival.cs index a89e494f23..8743919bf0 100644 --- a/Buffs/StatBuffs/SilvaRevival.cs +++ b/Buffs/StatBuffs/SilvaRevival.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Buffs/StatBuffs/SpiritPower.cs b/Buffs/StatBuffs/SpiritPower.cs index 49b845fb8f..abc18fed2b 100644 --- a/Buffs/StatBuffs/SpiritPower.cs +++ b/Buffs/StatBuffs/SpiritPower.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.StatBuffs diff --git a/Buffs/StatBuffs/SpiritRegen.cs b/Buffs/StatBuffs/SpiritRegen.cs index 941c1abc30..748113d4c9 100644 --- a/Buffs/StatBuffs/SpiritRegen.cs +++ b/Buffs/StatBuffs/SpiritRegen.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.StatBuffs diff --git a/Buffs/StatBuffs/TarraLifeRegen.cs b/Buffs/StatBuffs/TarraLifeRegen.cs index e4306c77ab..c2e48518e0 100644 --- a/Buffs/StatBuffs/TarraLifeRegen.cs +++ b/Buffs/StatBuffs/TarraLifeRegen.cs @@ -1,6 +1,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Buffs.StatBuffs @@ -25,7 +26,7 @@ namespace CalamityMod.Buffs.StatBuffs if (Main.rand.NextBool(10)) { - int dust = Dust.NewDust(drawInfo.Position - new Vector2(2f), Player.width + 4, Player.height + 4, 107, Player.velocity.X * 0.4f, Player.velocity.Y * 0.4f, 100, default, 1f); + int dust = Dust.NewDust(drawInfo.Position - new Vector2(2f), Player.width + 4, Player.height + 4, DustID.TerraBlade, Player.velocity.X * 0.4f, Player.velocity.Y * 0.4f, 100, default, 1f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 0.75f; Main.dust[dust].velocity.Y -= 0.35f; diff --git a/Buffs/StatBuffs/TarragonCloak.cs b/Buffs/StatBuffs/TarragonCloak.cs index 25a9a14eef..7c8b6be557 100644 --- a/Buffs/StatBuffs/TarragonCloak.cs +++ b/Buffs/StatBuffs/TarragonCloak.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Buffs/StatBuffs/TarragonImmunity.cs b/Buffs/StatBuffs/TarragonImmunity.cs index a69d8c6a86..134c46efbf 100644 --- a/Buffs/StatBuffs/TarragonImmunity.cs +++ b/Buffs/StatBuffs/TarragonImmunity.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Buffs/StatDebuffs/AbsorberAffliction.png b/Buffs/StatDebuffs/AbsorberAffliction.png index 6453bad23c..a62688efe0 100644 Binary files a/Buffs/StatDebuffs/AbsorberAffliction.png and b/Buffs/StatDebuffs/AbsorberAffliction.png differ diff --git a/Buffs/StatDebuffs/AndromedaCripple.cs b/Buffs/StatDebuffs/AndromedaCripple.cs index 214efa2fff..5340bb6979 100644 --- a/Buffs/StatDebuffs/AndromedaCripple.cs +++ b/Buffs/StatDebuffs/AndromedaCripple.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Buffs/StatDebuffs/ArmorCrunch.cs b/Buffs/StatDebuffs/ArmorCrunch.cs index 76bac57e11..d01829fdb0 100644 --- a/Buffs/StatDebuffs/ArmorCrunch.cs +++ b/Buffs/StatDebuffs/ArmorCrunch.cs @@ -7,9 +7,9 @@ namespace CalamityMod.Buffs.StatDebuffs public class ArmorCrunch : ModBuff { public static int DefenseReduction = 15; - public static float MultiplicativeDamageReductionPlayer = 0.33f; - //20% dr reduction - public static float MultiplicativeDamageReductionEnemy = 0.80f; + public static float MultiplicativeDamageReductionPlayer = 0.5f; + // 15% DR reduction + public static float MultiplicativeDamageReductionEnemy = 0.85f; public override void SetStaticDefaults() { diff --git a/Buffs/StatDebuffs/Clamity.cs b/Buffs/StatDebuffs/Clamity.cs index 983aaee923..7f65c36295 100644 --- a/Buffs/StatDebuffs/Clamity.cs +++ b/Buffs/StatDebuffs/Clamity.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Buffs/StatDebuffs/Crumbling.cs b/Buffs/StatDebuffs/Crumbling.cs index ecc06ca622..2173cf756b 100644 --- a/Buffs/StatDebuffs/Crumbling.cs +++ b/Buffs/StatDebuffs/Crumbling.cs @@ -7,9 +7,9 @@ namespace CalamityMod.Buffs.StatDebuffs public class Crumbling : ModBuff { public static int DefenseReduction = 10; - public static float MultiplicativeDamageReductionPlayer = 0.55f; - //12% dr reduction - public static float MultiplicativeDamageReductionEnemy = 0.88f; + public static float MultiplicativeDamageReductionPlayer = 0.7f; + // 8% DR reduction + public static float MultiplicativeDamageReductionEnemy = 0.92f; public override void SetStaticDefaults() { diff --git a/Buffs/StatDebuffs/DoGExtremeGravity.png b/Buffs/StatDebuffs/DoGExtremeGravity.png index 43a2f353d7..b9de9c3774 100644 Binary files a/Buffs/StatDebuffs/DoGExtremeGravity.png and b/Buffs/StatDebuffs/DoGExtremeGravity.png differ diff --git a/Buffs/StatDebuffs/FishAlert.cs b/Buffs/StatDebuffs/FishAlert.cs index 019a05d27d..8324217abf 100644 --- a/Buffs/StatDebuffs/FishAlert.cs +++ b/Buffs/StatDebuffs/FishAlert.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Buffs/StatDebuffs/FrozenLungs.cs b/Buffs/StatDebuffs/FrozenLungs.cs index 8793026e05..4a7e8fb6ca 100644 --- a/Buffs/StatDebuffs/FrozenLungs.cs +++ b/Buffs/StatDebuffs/FrozenLungs.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.StatDebuffs diff --git a/Buffs/StatDebuffs/FrozenLungs.png b/Buffs/StatDebuffs/FrozenLungs.png index c44a4a4a0f..62fea4a1b6 100644 Binary files a/Buffs/StatDebuffs/FrozenLungs.png and b/Buffs/StatDebuffs/FrozenLungs.png differ diff --git a/Buffs/StatDebuffs/GalvanicCorrosion.cs b/Buffs/StatDebuffs/GalvanicCorrosion.cs index 067b246fdc..0d6639ee28 100644 --- a/Buffs/StatDebuffs/GalvanicCorrosion.cs +++ b/Buffs/StatDebuffs/GalvanicCorrosion.cs @@ -1,4 +1,4 @@ -using CalamityMod.NPCs; +using CalamityMod.NPCs; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Buffs/StatDebuffs/GalvanicCorrosion.png b/Buffs/StatDebuffs/GalvanicCorrosion.png index 97136a54fe..aa5182d8fb 100644 Binary files a/Buffs/StatDebuffs/GalvanicCorrosion.png and b/Buffs/StatDebuffs/GalvanicCorrosion.png differ diff --git a/Buffs/StatDebuffs/GlacialState.cs b/Buffs/StatDebuffs/GlacialState.cs index 0e8a44b893..d1c0ed7639 100644 --- a/Buffs/StatDebuffs/GlacialState.cs +++ b/Buffs/StatDebuffs/GlacialState.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Buffs.StatDebuffs if (Main.rand.NextBool(4)) { - Dust d = Dust.NewDustDirect(Player.Center - 10 * Vector2.One, 20, 20, 137); + Dust d = Dust.NewDustDirect(Player.Center - 10 * Vector2.One, 20, 20, DustID.IcyMerman); d.noGravity = Main.rand.NextBool(); d.noLight = false; d.velocity *= 0.2f; diff --git a/Buffs/StatDebuffs/Irradiated.cs b/Buffs/StatDebuffs/Irradiated.cs index e3402c5462..ca52ae932a 100644 --- a/Buffs/StatDebuffs/Irradiated.cs +++ b/Buffs/StatDebuffs/Irradiated.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Buffs/StatDebuffs/Irradiated.png b/Buffs/StatDebuffs/Irradiated.png index 60106814b8..0cc69ed972 100644 Binary files a/Buffs/StatDebuffs/Irradiated.png and b/Buffs/StatDebuffs/Irradiated.png differ diff --git a/Buffs/StatDebuffs/KamiFlu.cs b/Buffs/StatDebuffs/KamiFlu.cs index e0183a327f..859091d167 100644 --- a/Buffs/StatDebuffs/KamiFlu.cs +++ b/Buffs/StatDebuffs/KamiFlu.cs @@ -1,4 +1,4 @@ -using CalamityMod.NPCs; +using CalamityMod.NPCs; using Terraria; using Terraria.ModLoader; diff --git a/Buffs/StatDebuffs/NOU.cs b/Buffs/StatDebuffs/NOU.cs index 3516443177..1682bb88c0 100644 --- a/Buffs/StatDebuffs/NOU.cs +++ b/Buffs/StatDebuffs/NOU.cs @@ -5,20 +5,20 @@ using Terraria.ModLoader; namespace CalamityMod.Buffs.StatDebuffs { - public class NOU : ModBuff - { - public override void SetStaticDefaults() - { + public class NOU : ModBuff + { + public override void SetStaticDefaults() + { Main.debuff[Type] = true; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; BuffID.Sets.NurseCannotRemoveDebuff[Type] = true; BuffID.Sets.LongerExpertDebuff[Type] = true; - } - - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().NOU = true; - } - } + } + + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().NOU = true; + } + } } diff --git a/Buffs/StatDebuffs/PearlAura.cs b/Buffs/StatDebuffs/PearlAura.cs index 6ba8ccd2f8..b7b27ee3df 100644 --- a/Buffs/StatDebuffs/PearlAura.cs +++ b/Buffs/StatDebuffs/PearlAura.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.StatDebuffs diff --git a/Buffs/StatDebuffs/ProfanedWeakness.cs b/Buffs/StatDebuffs/ProfanedWeakness.cs index f9a26c3229..4a2a558c3b 100644 --- a/Buffs/StatDebuffs/ProfanedWeakness.cs +++ b/Buffs/StatDebuffs/ProfanedWeakness.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.StatDebuffs diff --git a/Buffs/StatDebuffs/TemporalSadness.png b/Buffs/StatDebuffs/TemporalSadness.png index 48d71f8a78..d3109f21fe 100644 Binary files a/Buffs/StatDebuffs/TemporalSadness.png and b/Buffs/StatDebuffs/TemporalSadness.png differ diff --git a/Buffs/StatDebuffs/Warped.cs b/Buffs/StatDebuffs/Warped.cs index f44996b349..fe16e114cf 100644 --- a/Buffs/StatDebuffs/Warped.cs +++ b/Buffs/StatDebuffs/Warped.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Buffs/StatDebuffs/Warped.png b/Buffs/StatDebuffs/Warped.png index d17c7e236f..b2b033b09a 100644 Binary files a/Buffs/StatDebuffs/Warped.png and b/Buffs/StatDebuffs/Warped.png differ diff --git a/Buffs/StatDebuffs/WeakPetrification.cs b/Buffs/StatDebuffs/WeakPetrification.cs index 76726def20..03192ceed1 100644 --- a/Buffs/StatDebuffs/WeakPetrification.cs +++ b/Buffs/StatDebuffs/WeakPetrification.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Buffs/StatDebuffs/WitherDebuff.cs b/Buffs/StatDebuffs/WitherDebuff.cs index c59f4518e6..9a0a5a9e55 100644 --- a/Buffs/StatDebuffs/WitherDebuff.cs +++ b/Buffs/StatDebuffs/WitherDebuff.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Buffs/Summon/BelladonnaSpiritBuff.cs b/Buffs/Summon/BelladonnaSpiritBuff.cs index 64789cef04..61ba9bfa29 100644 --- a/Buffs/Summon/BelladonnaSpiritBuff.cs +++ b/Buffs/Summon/BelladonnaSpiritBuff.cs @@ -1,4 +1,4 @@ -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; using Terraria; using Terraria.ModLoader; diff --git a/Buffs/Summon/BlackHawkBuff.cs b/Buffs/Summon/BlackHawkBuff.cs index 4d69ef6a07..5ec4851c76 100644 --- a/Buffs/Summon/BlackHawkBuff.cs +++ b/Buffs/Summon/BlackHawkBuff.cs @@ -1,4 +1,4 @@ -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; using Terraria; using Terraria.ModLoader; diff --git a/Buffs/Summon/BrimstoneWaifu.cs b/Buffs/Summon/BrimstoneWaifu.cs index c4cd69c4db..73e099a09a 100644 --- a/Buffs/Summon/BrimstoneWaifu.cs +++ b/Buffs/Summon/BrimstoneWaifu.cs @@ -1,4 +1,4 @@ -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; using Terraria; using Terraria.ModLoader; diff --git a/Buffs/Summon/CausticStaffBuff.cs b/Buffs/Summon/CausticStaffBuff.cs index 7df8d2add6..25a4672d32 100644 --- a/Buffs/Summon/CausticStaffBuff.cs +++ b/Buffs/Summon/CausticStaffBuff.cs @@ -1,4 +1,4 @@ -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; using Terraria; using Terraria.ModLoader; diff --git a/Buffs/Summon/CinderBlossomBuff.cs b/Buffs/Summon/CinderBlossomBuff.cs index 71408b4f61..8133494739 100644 --- a/Buffs/Summon/CinderBlossomBuff.cs +++ b/Buffs/Summon/CinderBlossomBuff.cs @@ -1,4 +1,4 @@ -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; using Terraria; using Terraria.ModLoader; diff --git a/Buffs/Summon/CloudyWaifu.cs b/Buffs/Summon/CloudyWaifu.cs index a1a4863ae9..0cb6162e05 100644 --- a/Buffs/Summon/CloudyWaifu.cs +++ b/Buffs/Summon/CloudyWaifu.cs @@ -1,4 +1,4 @@ -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; using Terraria; using Terraria.ModLoader; diff --git a/Buffs/Summon/Corroslime.cs b/Buffs/Summon/Corroslime.cs index 2c55b75da5..c8c15edb91 100644 --- a/Buffs/Summon/Corroslime.cs +++ b/Buffs/Summon/Corroslime.cs @@ -1,4 +1,4 @@ -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; using Terraria; using Terraria.ModLoader; diff --git a/Buffs/Summon/CorvidHarbringerBuff.cs b/Buffs/Summon/CorvidHarbringerBuff.cs index 6d108a4850..504458767f 100644 --- a/Buffs/Summon/CorvidHarbringerBuff.cs +++ b/Buffs/Summon/CorvidHarbringerBuff.cs @@ -1,4 +1,4 @@ -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; using Terraria; using Terraria.ModLoader; diff --git a/Buffs/Summon/CosmicEnergy.cs b/Buffs/Summon/CosmicEnergy.cs index ff9d82c5f0..bd29028601 100644 --- a/Buffs/Summon/CosmicEnergy.cs +++ b/Buffs/Summon/CosmicEnergy.cs @@ -1,4 +1,4 @@ -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; using Terraria; using Terraria.ModLoader; diff --git a/Buffs/Summon/CosmicViperEngineBuff.cs b/Buffs/Summon/CosmicViperEngineBuff.cs index 2b5e78e712..836dc2da24 100644 --- a/Buffs/Summon/CosmicViperEngineBuff.cs +++ b/Buffs/Summon/CosmicViperEngineBuff.cs @@ -1,4 +1,4 @@ -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; using Terraria; using Terraria.ModLoader; diff --git a/Buffs/Summon/CosmilampBuff.cs b/Buffs/Summon/CosmilampBuff.cs index d8dccbd28d..635914f27e 100644 --- a/Buffs/Summon/CosmilampBuff.cs +++ b/Buffs/Summon/CosmilampBuff.cs @@ -1,4 +1,4 @@ -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; using Terraria; using Terraria.ModLoader; diff --git a/Buffs/Summon/Crimslime.cs b/Buffs/Summon/Crimslime.cs index 6916252d70..b6d36ff83e 100644 --- a/Buffs/Summon/Crimslime.cs +++ b/Buffs/Summon/Crimslime.cs @@ -1,4 +1,4 @@ -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; using Terraria; using Terraria.ModLoader; diff --git a/Buffs/Summon/DaedalusGolemBuff.cs b/Buffs/Summon/DaedalusGolemBuff.cs index b57a4c1918..ca584568e4 100644 --- a/Buffs/Summon/DaedalusGolemBuff.cs +++ b/Buffs/Summon/DaedalusGolemBuff.cs @@ -1,4 +1,4 @@ -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; using Terraria; using Terraria.ModLoader; diff --git a/Buffs/Summon/DankCreeperBuff.cs b/Buffs/Summon/DankCreeperBuff.cs index 58f791d441..bac55737b5 100644 --- a/Buffs/Summon/DankCreeperBuff.cs +++ b/Buffs/Summon/DankCreeperBuff.cs @@ -1,4 +1,4 @@ -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; using Terraria; using Terraria.ModLoader; diff --git a/Buffs/Summon/DazzlingStabberBuff.cs b/Buffs/Summon/DazzlingStabberBuff.cs index 571cab3aa1..a2a20e32df 100644 --- a/Buffs/Summon/DazzlingStabberBuff.cs +++ b/Buffs/Summon/DazzlingStabberBuff.cs @@ -1,4 +1,4 @@ -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; using Terraria; using Terraria.ModLoader; diff --git a/Buffs/Summon/ElementalAxeBuff.cs b/Buffs/Summon/ElementalAxeBuff.cs index 53c28533c0..1454140e20 100644 --- a/Buffs/Summon/ElementalAxeBuff.cs +++ b/Buffs/Summon/ElementalAxeBuff.cs @@ -1,4 +1,4 @@ -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; using Terraria; using Terraria.ModLoader; diff --git a/Buffs/Summon/EndoCooperBuff.cs b/Buffs/Summon/EndoCooperBuff.cs index 2db03538e7..325948b2b1 100644 --- a/Buffs/Summon/EndoCooperBuff.cs +++ b/Buffs/Summon/EndoCooperBuff.cs @@ -1,4 +1,4 @@ -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; using Terraria; using Terraria.ModLoader; diff --git a/Buffs/Summon/EndoHydraBuff.cs b/Buffs/Summon/EndoHydraBuff.cs index 1ed17226df..0bb3a54736 100644 --- a/Buffs/Summon/EndoHydraBuff.cs +++ b/Buffs/Summon/EndoHydraBuff.cs @@ -1,4 +1,4 @@ -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; using Terraria; using Terraria.ModLoader; diff --git a/Buffs/Summon/EyeOfNightBuff.cs b/Buffs/Summon/EyeOfNightBuff.cs index 0d008806c2..871b2d486f 100644 --- a/Buffs/Summon/EyeOfNightBuff.cs +++ b/Buffs/Summon/EyeOfNightBuff.cs @@ -1,4 +1,4 @@ -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; using Terraria; using Terraria.ModLoader; diff --git a/Buffs/Summon/FlowersOfMortalityBuff.cs b/Buffs/Summon/FlowersOfMortalityBuff.cs index 25b5e97695..a89d37c19a 100644 --- a/Buffs/Summon/FlowersOfMortalityBuff.cs +++ b/Buffs/Summon/FlowersOfMortalityBuff.cs @@ -1,4 +1,4 @@ -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; using Terraria; using Terraria.ModLoader; diff --git a/Buffs/Summon/FrostBlossomBuff.cs b/Buffs/Summon/FrostBlossomBuff.cs index be2b0adbad..8f21d5f3e8 100644 --- a/Buffs/Summon/FrostBlossomBuff.cs +++ b/Buffs/Summon/FrostBlossomBuff.cs @@ -1,4 +1,4 @@ -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; using Terraria; using Terraria.ModLoader; diff --git a/Buffs/Summon/FungalClumpBuff.cs b/Buffs/Summon/FungalClumpBuff.cs index 24c9f1082a..c8a3a4549e 100644 --- a/Buffs/Summon/FungalClumpBuff.cs +++ b/Buffs/Summon/FungalClumpBuff.cs @@ -1,4 +1,4 @@ -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Typeless; using Terraria; using Terraria.ModLoader; diff --git a/Buffs/Summon/GlacialEmbraceBuff.cs b/Buffs/Summon/GlacialEmbraceBuff.cs index 283c0cb8cb..f1502f9c41 100644 --- a/Buffs/Summon/GlacialEmbraceBuff.cs +++ b/Buffs/Summon/GlacialEmbraceBuff.cs @@ -1,4 +1,4 @@ -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; using Terraria; using Terraria.ModLoader; diff --git a/Buffs/Summon/HauntedDishesBuff.cs b/Buffs/Summon/HauntedDishesBuff.cs index 671a679e28..d46bd34697 100644 --- a/Buffs/Summon/HauntedDishesBuff.cs +++ b/Buffs/Summon/HauntedDishesBuff.cs @@ -1,4 +1,4 @@ -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; using Terraria; using Terraria.ModLoader; diff --git a/Buffs/Summon/HermitCrab.cs b/Buffs/Summon/HermitCrab.cs index 29b18f71d9..56b92d5bea 100644 --- a/Buffs/Summon/HermitCrab.cs +++ b/Buffs/Summon/HermitCrab.cs @@ -1,4 +1,4 @@ -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; using Terraria; using Terraria.ModLoader; diff --git a/Buffs/Summon/HotE.cs b/Buffs/Summon/HotE.cs index a32e13b2ed..99bd030f4d 100644 --- a/Buffs/Summon/HotE.cs +++ b/Buffs/Summon/HotE.cs @@ -1,4 +1,4 @@ -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon diff --git a/Buffs/Summon/HowlTrio.cs b/Buffs/Summon/HowlTrio.cs index ef406b5193..262846cd50 100644 --- a/Buffs/Summon/HowlTrio.cs +++ b/Buffs/Summon/HowlTrio.cs @@ -1,4 +1,4 @@ -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; using Terraria; using Terraria.ModLoader; diff --git a/Buffs/Summon/IceClasperBuff.cs b/Buffs/Summon/IceClasperBuff.cs index d7c5d328a7..8c25f49849 100644 --- a/Buffs/Summon/IceClasperBuff.cs +++ b/Buffs/Summon/IceClasperBuff.cs @@ -1,4 +1,4 @@ -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; using Terraria; using Terraria.ModLoader; diff --git a/Buffs/Summon/IgneousExaltationBuff.cs b/Buffs/Summon/IgneousExaltationBuff.cs index c5bc844922..3c12f97a0c 100644 --- a/Buffs/Summon/IgneousExaltationBuff.cs +++ b/Buffs/Summon/IgneousExaltationBuff.cs @@ -1,4 +1,4 @@ -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; using Terraria; using Terraria.ModLoader; diff --git a/Buffs/Summon/LiliesOfFinalityBuff.cs b/Buffs/Summon/LiliesOfFinalityBuff.cs new file mode 100644 index 0000000000..77fe068705 --- /dev/null +++ b/Buffs/Summon/LiliesOfFinalityBuff.cs @@ -0,0 +1,31 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Projectiles.Summon; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Summon +{ + public class LiliesOfFinalityBuff : ModBuff + { + public override void SetStaticDefaults() + { + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.Calamity(); + if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) + modPlayer.LiliesOfFinalityBool = true; + + if (!modPlayer.LiliesOfFinalityBool) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + player.buffTime[buffIndex] = 18000; + } + } +} diff --git a/Buffs/Summon/LiliesOfFinalityBuff.png b/Buffs/Summon/LiliesOfFinalityBuff.png new file mode 100644 index 0000000000..8099f3addf Binary files /dev/null and b/Buffs/Summon/LiliesOfFinalityBuff.png differ diff --git a/Buffs/Summon/MagicHatBuff.cs b/Buffs/Summon/MagicHatBuff.cs index 764c20904f..c0533f5edd 100644 --- a/Buffs/Summon/MagicHatBuff.cs +++ b/Buffs/Summon/MagicHatBuff.cs @@ -1,4 +1,4 @@ -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon.Umbrella; using Terraria; using Terraria.ModLoader; diff --git a/Buffs/Summon/Mechworm.cs b/Buffs/Summon/Mechworm.cs index f501330b53..8bfb0258da 100644 --- a/Buffs/Summon/Mechworm.cs +++ b/Buffs/Summon/Mechworm.cs @@ -1,4 +1,4 @@ -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; using Terraria; using Terraria.ModLoader; diff --git a/Buffs/Summon/MidnightSunBuff.cs b/Buffs/Summon/MidnightSunBuff.cs index 69b89c6824..60b6001716 100644 --- a/Buffs/Summon/MidnightSunBuff.cs +++ b/Buffs/Summon/MidnightSunBuff.cs @@ -1,4 +1,4 @@ -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; using Terraria; using Terraria.ModLoader; diff --git a/Buffs/Summon/MiniatureEyeofCthulhu.cs b/Buffs/Summon/MiniatureEyeofCthulhu.cs index 4fe8ff53f2..26b7572d75 100644 --- a/Buffs/Summon/MiniatureEyeofCthulhu.cs +++ b/Buffs/Summon/MiniatureEyeofCthulhu.cs @@ -1,4 +1,4 @@ -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; using Terraria; using Terraria.ModLoader; diff --git a/Buffs/Summon/MiniatureEyeofCthulhu.png b/Buffs/Summon/MiniatureEyeofCthulhu.png index 8085911d76..654ec5ca3d 100644 Binary files a/Buffs/Summon/MiniatureEyeofCthulhu.png and b/Buffs/Summon/MiniatureEyeofCthulhu.png differ diff --git a/Buffs/Summon/MountedScannerBuff.cs b/Buffs/Summon/MountedScannerBuff.cs index 384adb80ff..9331a145d5 100644 --- a/Buffs/Summon/MountedScannerBuff.cs +++ b/Buffs/Summon/MountedScannerBuff.cs @@ -1,4 +1,4 @@ -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; using CalamityMod.Projectiles.DraedonsArsenal; using Terraria; using Terraria.ModLoader; diff --git a/Buffs/Summon/PerditionBuff.cs b/Buffs/Summon/PerditionBuff.cs index 93fee4039e..adbde7de97 100644 --- a/Buffs/Summon/PerditionBuff.cs +++ b/Buffs/Summon/PerditionBuff.cs @@ -1,4 +1,4 @@ -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; using Terraria; using Terraria.ModLoader; diff --git a/Buffs/Summon/Phantom.cs b/Buffs/Summon/Phantom.cs index 207bf90424..3c81ee95a1 100644 --- a/Buffs/Summon/Phantom.cs +++ b/Buffs/Summon/Phantom.cs @@ -1,4 +1,4 @@ -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; using Terraria; using Terraria.ModLoader; diff --git a/Buffs/Summon/ProfanedSoulGuardians.cs b/Buffs/Summon/ProfanedSoulGuardians.cs index 06c742fc52..f2f6e8c700 100644 --- a/Buffs/Summon/ProfanedSoulGuardians.cs +++ b/Buffs/Summon/ProfanedSoulGuardians.cs @@ -1,10 +1,10 @@ -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class ProfanedSoulGuardians : ModBuff + public class ProfanedSoulGuardians : ModBuff { public override void SetStaticDefaults() { diff --git a/Buffs/Summon/PuffWarriorBuff.cs b/Buffs/Summon/PuffWarriorBuff.cs index de4215a5ba..9636a62808 100644 --- a/Buffs/Summon/PuffWarriorBuff.cs +++ b/Buffs/Summon/PuffWarriorBuff.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Buffs.Summon { Main.buffNoTimeDisplay[Type] = true; Main.buffNoSave[Type] = true; - } + } public override void Update(Player player, ref int buffIndex) { diff --git a/Buffs/Summon/ResurrectionButterflyBuff.cs b/Buffs/Summon/ResurrectionButterflyBuff.cs index 538b0288d9..96a073b840 100644 --- a/Buffs/Summon/ResurrectionButterflyBuff.cs +++ b/Buffs/Summon/ResurrectionButterflyBuff.cs @@ -1,4 +1,4 @@ -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; using Terraria; using Terraria.ModLoader; diff --git a/Buffs/Summon/SageSpiritBuff.cs b/Buffs/Summon/SageSpiritBuff.cs index 3f780b7503..d015b77085 100644 --- a/Buffs/Summon/SageSpiritBuff.cs +++ b/Buffs/Summon/SageSpiritBuff.cs @@ -1,4 +1,4 @@ -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; using Terraria; using Terraria.ModLoader; diff --git a/Buffs/Summon/Sandnado.cs b/Buffs/Summon/Sandnado.cs index db41c09f0b..1d9377bc51 100644 --- a/Buffs/Summon/Sandnado.cs +++ b/Buffs/Summon/Sandnado.cs @@ -1,4 +1,4 @@ -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; using Terraria; using Terraria.ModLoader; diff --git a/Buffs/Summon/SandyHealingWaifu.cs b/Buffs/Summon/SandyHealingWaifu.cs index 8c77bfccdd..810741be2a 100644 --- a/Buffs/Summon/SandyHealingWaifu.cs +++ b/Buffs/Summon/SandyHealingWaifu.cs @@ -1,4 +1,4 @@ -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; using Terraria; using Terraria.ModLoader; diff --git a/Buffs/Summon/SandyWaifu.cs b/Buffs/Summon/SandyWaifu.cs index b68a20b4ba..6fd6d1e31c 100644 --- a/Buffs/Summon/SandyWaifu.cs +++ b/Buffs/Summon/SandyWaifu.cs @@ -1,4 +1,4 @@ -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; using Terraria; using Terraria.ModLoader; diff --git a/Buffs/Summon/SeaSnailBuff.cs b/Buffs/Summon/SeaSnailBuff.cs index 79d5efbdd7..0068dd0252 100644 --- a/Buffs/Summon/SeaSnailBuff.cs +++ b/Buffs/Summon/SeaSnailBuff.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Buffs.Summon { CalamityPlayer modPlayer = player.Calamity(); - + if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) { modPlayer.victideSnail = true; diff --git a/Buffs/Summon/ShellfishBuff.cs b/Buffs/Summon/ShellfishBuff.cs index 66aa820207..816d6898ec 100644 --- a/Buffs/Summon/ShellfishBuff.cs +++ b/Buffs/Summon/ShellfishBuff.cs @@ -1,4 +1,4 @@ -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; using Terraria; using Terraria.ModLoader; diff --git a/Buffs/Summon/SiriusBuff.cs b/Buffs/Summon/SiriusBuff.cs index 99a2714334..8f4ebc9d7f 100644 --- a/Buffs/Summon/SiriusBuff.cs +++ b/Buffs/Summon/SiriusBuff.cs @@ -1,4 +1,4 @@ -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; using Terraria; using Terraria.ModLoader; diff --git a/Buffs/Summon/SolarSpirit.cs b/Buffs/Summon/SolarSpirit.cs index d84273dc16..c7f813a3eb 100644 --- a/Buffs/Summon/SolarSpirit.cs +++ b/Buffs/Summon/SolarSpirit.cs @@ -1,4 +1,4 @@ -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; using Terraria; using Terraria.ModLoader; diff --git a/Buffs/Summon/SoulSeekerBuff.cs b/Buffs/Summon/SoulSeekerBuff.cs index 26827e137a..b4ffd374ba 100644 --- a/Buffs/Summon/SoulSeekerBuff.cs +++ b/Buffs/Summon/SoulSeekerBuff.cs @@ -1,4 +1,4 @@ -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; using Terraria; using Terraria.ModLoader; diff --git a/Buffs/Summon/StarSwallowerBuff.cs b/Buffs/Summon/StarSwallowerBuff.cs index 799bf4f7e8..dc4183712e 100644 --- a/Buffs/Summon/StarSwallowerBuff.cs +++ b/Buffs/Summon/StarSwallowerBuff.cs @@ -1,4 +1,4 @@ -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; using CalamityMod.Projectiles.DraedonsArsenal; using Terraria; using Terraria.ModLoader; diff --git a/Buffs/Summon/TacticalPlagueEngineBuff.cs b/Buffs/Summon/TacticalPlagueEngineBuff.cs index d7ffff36db..f4f6c8c00e 100644 --- a/Buffs/Summon/TacticalPlagueEngineBuff.cs +++ b/Buffs/Summon/TacticalPlagueEngineBuff.cs @@ -1,4 +1,4 @@ -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; using Terraria; using Terraria.ModLoader; diff --git a/Buffs/Summon/TundraFlameBlossomsBuff.cs b/Buffs/Summon/TundraFlameBlossomsBuff.cs index 3618235ef3..d9494c1f34 100644 --- a/Buffs/Summon/TundraFlameBlossomsBuff.cs +++ b/Buffs/Summon/TundraFlameBlossomsBuff.cs @@ -1,4 +1,4 @@ -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; using Terraria; using Terraria.ModLoader; diff --git a/Buffs/Summon/VileFeederBuff.cs b/Buffs/Summon/VileFeederBuff.cs index a96acab0d8..abfd558b11 100644 --- a/Buffs/Summon/VileFeederBuff.cs +++ b/Buffs/Summon/VileFeederBuff.cs @@ -1,4 +1,4 @@ -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; using Terraria; using Terraria.ModLoader; diff --git a/Buffs/Summon/ViridVanguardBuff.cs b/Buffs/Summon/ViridVanguardBuff.cs index fcf7262700..8e26caefc8 100644 --- a/Buffs/Summon/ViridVanguardBuff.cs +++ b/Buffs/Summon/ViridVanguardBuff.cs @@ -1,4 +1,4 @@ -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; using Terraria; using Terraria.ModLoader; diff --git a/Buffs/Summon/WaterWaifu.cs b/Buffs/Summon/WaterWaifu.cs index de681d9fca..49a08c65cd 100644 --- a/Buffs/Summon/WaterWaifu.cs +++ b/Buffs/Summon/WaterWaifu.cs @@ -1,4 +1,4 @@ -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; using Terraria; using Terraria.ModLoader; diff --git a/Buffs/Summon/Whips/ProfanedCrystalWhipBuff.cs b/Buffs/Summon/Whips/ProfanedCrystalWhipBuff.cs index ce02a61469..8d52209e5a 100644 --- a/Buffs/Summon/Whips/ProfanedCrystalWhipBuff.cs +++ b/Buffs/Summon/Whips/ProfanedCrystalWhipBuff.cs @@ -1,7 +1,7 @@ -using static CalamityMod.Items.Accessories.ProfanedSoulCrystal; -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; +using static CalamityMod.Items.Accessories.ProfanedSoulCrystal; namespace CalamityMod.Buffs.Summon.Whips { @@ -31,7 +31,7 @@ namespace CalamityMod.Buffs.Summon.Whips player.ClearBuff(Type); return; } - + var whipBuffs = new int[] { BuffID.CoolWhipPlayerBuff, BuffID.ScytheWhipPlayerBuff, BuffID.SwordWhipPlayerBuff, diff --git a/Buffs/Summon/Whips/ProfanedCrystalWhipDebuff.cs b/Buffs/Summon/Whips/ProfanedCrystalWhipDebuff.cs index c4eb8cca5d..77d46fce81 100644 --- a/Buffs/Summon/Whips/ProfanedCrystalWhipDebuff.cs +++ b/Buffs/Summon/Whips/ProfanedCrystalWhipDebuff.cs @@ -24,13 +24,13 @@ namespace CalamityMod.Buffs.Summon.Whips BuffID.ScytheWhipEnemyDebuff, BuffID.CoolWhipNPCDebuff, BuffID.MaceWhipNPCDebuff, BuffID.RainbowWhipNPCDebuff, BuffID.SwordWhipNPCDebuff, BuffID.ThornWhipNPCDebuff }; - + //kill whip stacking for psc purposes // 29SEP2023: Ozzatron: this won't kill stacking with other mod whips. need a generalized system for this for (int buff = 0; buff < NPC.maxBuffs; buff++) { int buffID = npc.buffType[buff]; - if(npc.buffTime[buff] > 0 && whipBuffs.Contains(buffID) && npc.buffType[buff] != Type) + if (npc.buffTime[buff] > 0 && whipBuffs.Contains(buffID) && npc.buffType[buff] != Type) npc.RequestBuffRemoval(npc.buffType[buff]); } } diff --git a/Buffs/Summon/WitherBlossomsBuff.cs b/Buffs/Summon/WitherBlossomsBuff.cs index fd00d764f8..297bb0468a 100644 --- a/Buffs/Summon/WitherBlossomsBuff.cs +++ b/Buffs/Summon/WitherBlossomsBuff.cs @@ -1,4 +1,4 @@ -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; using Terraria; using Terraria.ModLoader; diff --git a/Buffs/Summon/WulfrumDroidBuff.cs b/Buffs/Summon/WulfrumDroidBuff.cs index d19c5c5102..feb60ab4a4 100644 --- a/Buffs/Summon/WulfrumDroidBuff.cs +++ b/Buffs/Summon/WulfrumDroidBuff.cs @@ -1,4 +1,4 @@ -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; using Terraria; using Terraria.ModLoader; diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 5dc5c9c044..e505c7e3b9 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -30,7 +30,6 @@ using CalamityMod.Items.TreasureBags.MiscGrabBags; using CalamityMod.Items.VanillaArmorChanges; using CalamityMod.Items.Weapons.DraedonsArsenal; using CalamityMod.Items.Weapons.Melee; -using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Items.Weapons.Summon; using CalamityMod.NPCs; @@ -79,7 +78,6 @@ namespace CalamityMod.CalPlayer public bool killSpikyBalls = false; public float KameiTrailXScale = 0.1f; public int KameiBladeUseDelay = 0; - public int SpeedBlasterDashDelayCooldown = 0; public Vector2[] OldPositions = new Vector2[4]; public double contactDamageReduction = 0D; public double projectileDamageReduction = 0D; @@ -192,8 +190,8 @@ namespace CalamityMod.CalPlayer public int PHAThammer = 0; public int StellarHammer = 0; public int GalaxyHammer = 0; + public int NorfleetCounter = 0; public int hideOfDeusMeleeBoostTimer = 0; - public int nebulaManaNerfCounter = 0; public int alcoholPoisonLevel = 0; public int modStealthTimer; public int dashTimeMod; @@ -203,7 +201,6 @@ namespace CalamityMod.CalPlayer public int brimLoreInfernoTimer = 0; public int tarraLifeAuraTimer = 0; public int bloodflareHeartTimer = 300; - public int polarisBoostCounter = 0; public int dragonRageHits = 0; public int dragonRageCooldown = 0; public float modStealth = 1f; @@ -230,6 +227,7 @@ namespace CalamityMod.CalPlayer public int spiritOriginBullseyeShootCountdown = 0; public int spiritOriginConvertedCrit = 0; public int RustyMedallionCooldown = 0; + public int MiniSwamerCooldown = 0; public float SulphWaterPoisoningLevel; public float holyInfernoFadeIntensity; public NPC unstableSelectedTarget; @@ -310,7 +308,6 @@ namespace CalamityMod.CalPlayer #region Pet public bool thirdSage = false; - public bool thirdSageH = false; public bool perfmini = false; public bool akato = false; public bool yharonPet = false; @@ -359,6 +356,7 @@ namespace CalamityMod.CalPlayer public bool AdrenalineTrail = false; public float adrenaline = 0f; public float adrenalineMax = 100f; // 0 to 100% by default + public int adrenalinePauseTimer = 0; public int AdrenalineDuration = CalamityUtils.SecondsToFrames(5); public int AdrenalineChargeTime = CalamityUtils.SecondsToFrames(30); public int AdrenalineFadeTime = CalamityUtils.SecondsToFrames(2); @@ -436,7 +434,7 @@ namespace CalamityMod.CalPlayer // Lunic Corps shield comes from an armor set and its visibility is non optional internal float lunicCorpsShieldPartialRechargeProgress = 0f; internal bool playedLunicCorpsShieldSound = false; - + //Profaned soul shield applies to psa and psc, with differing max hps for each public int pSoulShieldDurability = 0; public bool pSoulShieldVisible = false; @@ -497,7 +495,6 @@ namespace CalamityMod.CalPlayer public bool laudanum = false; public bool heartOfDarkness = false; public bool draedonsHeart = false; - public int nanomachinesLockoutTimer = 0; public bool vexation = false; public bool dodgeScarf = false; public bool evasionScarf = false; @@ -524,6 +521,7 @@ namespace CalamityMod.CalPlayer public bool transformer = false; public bool hideOfDeus = false; public bool dAmulet = false; + public bool rampartOfDeities = false; public bool gShell = false; public bool lAmbergris = false; public bool tortShell = false; @@ -580,10 +578,12 @@ namespace CalamityMod.CalPlayer public bool chaliceOfTheBloodGod = false; public double chaliceBleedoutBuffer = 0D; public double chaliceDamagePointPartialProgress = 0D; + public int chaliceHitOriginalDamage = 0; public bool elementalHeart = false; public bool crownJewel = false; public bool infectedJewel = false; public bool purity = false; + public bool eleResist = false; public int PurityHealSlowdownFrames = 0; public bool harpyRing = false; public bool angelTreads = false; @@ -594,6 +594,8 @@ namespace CalamityMod.CalPlayer public bool anechoicPlating = false; public bool jellyfishNecklace = false; public bool fairyBoots = false; + public bool flameWakerBoots = false; + public int bootLevel = 0; //Used to prevent Flame Waker and Hellfire Treads stacking public bool hellfireTreads = false; public bool abyssalAmulet = false; public bool lumenousAmulet = false; @@ -685,6 +687,7 @@ namespace CalamityMod.CalPlayer public bool silvaWings = false; public int icicleCooldown = 0; public bool RustyMedallionDroplets = false; + public bool MiniSwarmers = false; public bool noStupidNaturalARSpawns = false; public int voidFrameCounter = 0; public int voidFrame = 0; @@ -716,8 +719,8 @@ namespace CalamityMod.CalPlayer public bool frostSet = false; //vanilla armor public bool victideSet = false; public bool victideSummoner = false; - public bool sulfurSet = false; - public bool sulfurJump = false; + public bool sulphurSet = false; + public bool sulphurJump = false; public int sulphurBubbleCooldown = 0; public bool aeroSet = false; public bool statigelSet = false; @@ -726,7 +729,6 @@ namespace CalamityMod.CalPlayer public bool tarragonCloak = false; public int tarraDefenseTime = 600; public bool tarraMage = false; - public int tarraMageHealCooldown = 0; public int tarraCrits = 0; public bool tarraRanged = false; public int tarraRangedCooldown = 0; @@ -966,10 +968,8 @@ namespace CalamityMod.CalPlayer public double pinkCandleHealFraction = 0D; public bool yellowCandle = false; public bool trippy = false; + public int trippyLevel = 1; public bool amidiasBlessing = false; - public bool polarisBoost = false; - public bool polarisBoostTwo = false; - public bool polarisBoostThree = false; public bool bloodfinBoost = false; public int bloodfinTimer = 30; public bool hallowedRegen = false; @@ -978,6 +978,8 @@ namespace CalamityMod.CalPlayer public bool avertorBonus = false; public bool divineBless = false; public bool infiniteFlight = false; + public int hasteCounter = 0; + public int hasteLevel = 0; #endregion #region Minion @@ -1082,14 +1084,12 @@ namespace CalamityMod.CalPlayer public bool celestialDragons = false; public bool KalandraMirror = false; public bool StellarTorus = false; + public bool LiliesOfFinalityBool = false; #endregion #region Biome public bool ZoneCalamity => Player.InModBiome(ModContent.GetInstance()); - public bool ZoneAstral => (Player.InModBiome(ModContent.GetInstance()) || - Player.InModBiome(ModContent.GetInstance()) || - Player.InModBiome(ModContent.GetInstance()) || - Player.InModBiome(ModContent.GetInstance())) && !ZoneAbyss; + public bool ZoneAstral => Player.InModBiome(ModContent.GetInstance()) && !ZoneAbyss; public bool ZoneSunkenSea => Player.InModBiome(ModContent.GetInstance()); public bool ZoneSulphur => Player.InModBiome(ModContent.GetInstance()); public bool ZoneAbyss => ZoneAbyssLayer1 || ZoneAbyssLayer2 || ZoneAbyssLayer3 || ZoneAbyssLayer4; @@ -1177,11 +1177,34 @@ namespace CalamityMod.CalPlayer public Vector2 FireDrawerPosition; public int monolithAccursedShader = 0; + + public int monolithBossRushShader = 0; + + public int monolithExoShader = 0; + + public int monolithLeviathanShader = 0; + + public int monolithPlagueShader = 0; + + public int monolithCryogenShader = 0; + + public int monolithAstralShader = 0; + + public int monolithDevourerBShader = 0; + + public int monolithDevourerPShader = 0; + + public int monolithYharonShader = 0; + + // This may seem like a scuffed setup, but a simple bool will have ordering issues when it comes to drawing. + // Until ModSceneMetrics gets implemented, this works for now. + public int BrimstoneLavaFountainCounter = 0; #endregion Draw Effects #region Draedon Summoning public bool AbleToSelectExoMech = false; public bool HasTalkedAtCodebreaker = false; + public bool HasCraftedDraedonsForge = false; public List SeenDraedonDialogs = new(); #endregion Draedon Summoning @@ -1232,7 +1255,6 @@ namespace CalamityMod.CalPlayer adrenalineBoostThree = false; drawBossHPBar = true; shouldDrawSmallText = true; - healToFull = false; newMerchantInventory = false; newPainterInventory = false; @@ -1285,7 +1307,6 @@ namespace CalamityMod.CalPlayer boost.AddWithCondition("adrenalineThree", adrenalineBoostThree); boost.AddWithCondition("bossHPBar", drawBossHPBar); boost.AddWithCondition("drawSmallText", shouldDrawSmallText); - boost.AddWithCondition("fullHPRespawn", healToFull); boost.AddWithCondition("newMerchantInventory", newMerchantInventory); boost.AddWithCondition("newPainterInventory", newPainterInventory); @@ -1316,6 +1337,7 @@ namespace CalamityMod.CalPlayer boost.AddWithCondition("newCalamitasInventory", newCalamitasInventory); boost.AddWithCondition("GivenBrimstoneLocus", GivenBrimstoneLocus); boost.AddWithCondition("HasTalkedAtCodebreaker", HasTalkedAtCodebreaker); + boost.AddWithCondition("HasCraftedDraedonsForge", HasCraftedDraedonsForge); // Calculate the new total time of all sessions at the instant of this player save. TimeSpan newSessionTotal = previousSessionTotal.Add(CalamityMod.SpeedrunTimer.Elapsed); @@ -1375,7 +1397,6 @@ namespace CalamityMod.CalPlayer adrenalineBoostThree = boost.Contains("adrenalineThree"); drawBossHPBar = boost.Contains("bossHPBar"); shouldDrawSmallText = boost.Contains("drawSmallText"); - healToFull = boost.Contains("fullHPRespawn"); newMerchantInventory = boost.Contains("newMerchantInventory"); newPainterInventory = boost.Contains("newPainterInventory"); @@ -1406,6 +1427,7 @@ namespace CalamityMod.CalPlayer newCalamitasInventory = boost.Contains("newCalamitasInventory"); GivenBrimstoneLocus = boost.Contains("GivenBrimstoneLocus"); HasTalkedAtCodebreaker = boost.Contains("HasTalkedAtCodebreaker"); + HasCraftedDraedonsForge = boost.Contains("HasCraftedDraedonsForge"); // Load rage if it's there, which it will be for any players saved with 1.5. // Older players have "stress" instead, which will be ignored. This is intentional. @@ -1654,6 +1676,7 @@ namespace CalamityMod.CalPlayer transformer = false; hideOfDeus = false; dAmulet = false; + rampartOfDeities = false; gShell = false; lAmbergris = false; tortShell = false; @@ -1753,6 +1776,7 @@ namespace CalamityMod.CalPlayer silvaWings = false; corrosiveSpine = false; RustyMedallionDroplets = false; + MiniSwarmers = false; noStupidNaturalARSpawns = false; rottenDogTooth = false; angelicAlliance = false; @@ -1791,6 +1815,7 @@ namespace CalamityMod.CalPlayer anechoicPlating = false; jellyfishNecklace = false; fairyBoots = false; + flameWakerBoots = false; hellfireTreads = false; abyssalAmulet = false; lumenousAmulet = false; @@ -1822,7 +1847,7 @@ namespace CalamityMod.CalPlayer victideSet = false; victideSummoner = false; - sulfurSet = false; + sulphurSet = false; aeroSet = false; @@ -1969,9 +1994,6 @@ namespace CalamityMod.CalPlayer AbsorberRegen = false; cFreeze = false; tRegen = false; - polarisBoost = false; - polarisBoostTwo = false; - polarisBoostThree = false; bloodfinBoost = false; divineBless = false; @@ -2123,12 +2145,15 @@ namespace CalamityMod.CalPlayer celestialDragons = false; KalandraMirror = false; StellarTorus = false; + LiliesOfFinalityBool = false; + /* disableVoodooSpawns = false; disablePerfCystSpawns = false; disableHiveCystSpawns = false; disableNaturalScourgeSpawns = false; disableAnahitaSpawns = false; + */ abyssalDivingSuitPrevious = abyssalDivingSuit; abyssalDivingSuit = abyssalDivingSuitHide = abyssalDivingSuitForce = abyssalDivingSuitPower = false; @@ -2201,13 +2226,13 @@ namespace CalamityMod.CalPlayer #region Screen Position Movements public override void ModifyScreenPosition() { - if (!CalamityConfig.Instance.Screenshake) + if (CalamityConfig.Instance.ScreenshakePower == 0) return; if (GeneralScreenShakePower > 0f) { - Main.screenPosition += Main.rand.NextVector2Circular(GeneralScreenShakePower, GeneralScreenShakePower); - GeneralScreenShakePower = MathHelper.Clamp(GeneralScreenShakePower - 0.185f, 0f, 20f); + Main.screenPosition += Main.rand.NextVector2Circular(GeneralScreenShakePower * CalamityConfig.Instance.ScreenshakePower, GeneralScreenShakePower * CalamityConfig.Instance.ScreenshakePower); + GeneralScreenShakePower = MathHelper.Clamp(GeneralScreenShakePower - 0.185f, 0f, 20f * CalamityConfig.Instance.ScreenshakePower); } } #endregion @@ -2285,11 +2310,9 @@ namespace CalamityMod.CalPlayer silvaMageCooldown = 0; bloodflareMageCooldown = 0; tarraRangedCooldown = 0; - tarraMageHealCooldown = 0; hideOfDeusMeleeBoostTimer = 0; externalAbyssLight = 0; externalColdImmunity = externalHeatImmunity = false; - polarisBoostCounter = 0; dragonRageHits = 0; dragonRageCooldown = 0; spectralVeilImmunity = 0; @@ -2408,7 +2431,7 @@ namespace CalamityMod.CalPlayer soaring = false; bounding = false; shadow = false; - nanomachinesLockoutTimer = 0; + adrenalinePauseTimer = 0; photosynthesis = false; astralInjection = false; gravityNormalizer = false; @@ -2457,10 +2480,8 @@ namespace CalamityMod.CalPlayer pinkCandleHealFraction = 0D; yellowCandle = false; trippy = false; + trippyLevel = 1; amidiasBlessing = false; - polarisBoost = false; - polarisBoostTwo = false; - polarisBoostThree = false; bloodfinBoost = false; bloodfinTimer = 0; healCounter = 300; @@ -2469,6 +2490,8 @@ namespace CalamityMod.CalPlayer healingPotionMultiplier = 1f; avertorBonus = false; divineBless = false; + hasteLevel = 0; + hasteCounter = 0; #endregion #region Armor Set Bonuses @@ -2554,7 +2577,7 @@ namespace CalamityMod.CalPlayer frostSet = false; //vanilla armor victideSet = false; aeroSet = false; - sulfurSet = false; + sulphurSet = false; statigelSet = false; tarraSet = false; tarraMelee = false; @@ -2619,6 +2642,7 @@ namespace CalamityMod.CalPlayer chaliceBleedoutBuffer = 0D; chaliceDamagePointPartialProgress = 0D; + chaliceHitOriginalDamage = 0; if (BossRushEvent.BossRushActive) { @@ -2741,6 +2765,8 @@ namespace CalamityMod.CalPlayer Projectile.NewProjectile(source, new Vector2((int)(Player.Center.X + (Math.Sin(projIndex * start) * 300)), (int)(Player.Center.Y + (Math.Cos(projIndex * start) * 300))), Vector2.Zero, ModContent.ProjectileType(), damage, proj.knockBack / 10f, Player.whoAmI, Main.rand.Next(180), projIndex * start); Player.statLife += 2; Player.HealEffect(2); + if (Player.statLife > Player.statLifeMax2) + Player.statLife = Player.statLifeMax2; } } if (CalamityKeybinds.SandCloakHotkey.JustPressed && sandCloak && Main.myPlayer == Player.whoAmI && rogueStealth >= rogueStealthMax * 0.1f && @@ -2792,12 +2818,12 @@ namespace CalamityMod.CalPlayer Vector2 step = teleportOffset / numDust; for (int i = 0; i < numDust; i++) { - int dustIndex = Dust.NewDust(Player.Center - (step * i), 1, 1, 21, step.X, step.Y); + int dustIndex = Dust.NewDust(Player.Center - (step * i), 1, 1, DustID.VilePowder, step.X, step.Y); Main.dust[dustIndex].noGravity = true; Main.dust[dustIndex].noLight = true; } - spectralVeilImmunity = 45; + spectralVeilImmunity = SpectralVeil.VeilIFrames; } } } @@ -2865,7 +2891,7 @@ namespace CalamityMod.CalPlayer SoundEngine.PlaySound(BloodflareHeadRanged.ActivationSound, Player.Center); for (int d = 0; d < 64; d++) { - int dust = Dust.NewDust(new Vector2(Player.position.X, Player.position.Y + 16f), Player.width, Player.height - 16, (int)CalamityDusts.Polterplasm, 0f, 0f, 0, default, 1f); + int dust = Dust.NewDust(new Vector2(Player.position.X, Player.position.Y + 16f), Player.width, Player.height - 16, (int)CalamityDusts.Necroplasm, 0f, 0f, 0, default, 1f); Main.dust[dust].velocity *= 3f; Main.dust[dust].scale *= 1.15f; } @@ -2875,7 +2901,7 @@ namespace CalamityMod.CalPlayer Vector2 source = Vector2.Normalize(Player.velocity) * new Vector2((float)Player.width / 2f, (float)Player.height) * 0.75f; source = source.RotatedBy((double)((float)(d - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + Player.Center; Vector2 dustVel = source - Player.Center; - int phanto = Dust.NewDust(source + dustVel, 0, 0, (int)CalamityDusts.Polterplasm, dustVel.X * 1.5f, dustVel.Y * 1.5f, 100, default, 1.4f); + int phanto = Dust.NewDust(source + dustVel, 0, 0, (int)CalamityDusts.Necroplasm, dustVel.X * 1.5f, dustVel.Y * 1.5f, 100, default, 1.4f); Main.dust[phanto].noGravity = true; Main.dust[phanto].noLight = true; Main.dust[phanto].velocity = dustVel; @@ -2916,7 +2942,7 @@ namespace CalamityMod.CalPlayer SoundEngine.PlaySound(OmegaBlueHelmet.ActivationSound, Player.Center); for (int i = 0; i < 66; i++) { - int d = Dust.NewDust(Player.position, Player.width, Player.height, 20, 0, 0, 100, Color.Transparent, 2.6f); + int d = Dust.NewDust(Player.position, Player.width, Player.height, DustID.PurificationPowder, 0, 0, 100, Color.Transparent, 2.6f); Main.dust[d].noGravity = true; Main.dust[d].noLight = true; Main.dust[d].fadeIn = 1f; @@ -3040,10 +3066,11 @@ namespace CalamityMod.CalPlayer //Right click dash on Speed Blaster if (sBlasterDashActivated == true) { - if ((Player.controlUp || Player.controlDown || Player.controlLeft || Player.controlRight) && !Player.pulley && Player.grappling[0] == -1 && !Player.tongued && !Player.mount.Active && SpeedBlasterDashDelayCooldown == SpeedBlaster.DashCooldown && Player.dashDelay == 0) + if ((Player.controlUp || Player.controlDown || Player.controlLeft || Player.controlRight) && !Player.pulley && Player.grappling[0] == -1 && !Player.tongued && !Player.mount.Active && Player.HasCooldown(Cooldowns.SpeedBlasterBoost.ID) && Player.dashDelay == 0) { SpeedBlasterDashStarted = true; } + sBlasterDashActivated = false; } if (Player.Calamity().SpeedBlasterDashStarted || (Player.dashDelay != 0 && Player.Calamity().LastUsedDashID == SpeedBlasterDash.ID)) @@ -3061,17 +3088,17 @@ namespace CalamityMod.CalPlayer SoundEngine.PlaySound(SilvaHeadSummon.DispelSound, Player.Center); for (int i = 0; i < 3; i++) - Dust.NewDust(Player.position, 120, 120, 218, 0f, 0f, 100, default, 1.5f); + Dust.NewDust(Player.position, 120, 120, DustID.Rain_BloodMoon, 0f, 0f, 100, default, 1.5f); for (int i = 0; i < 30; i++) { float angle = MathHelper.TwoPi * i / 30f; - int dustIndex = Dust.NewDust(Player.position, 120, 120, 218, 0f, 0f, 0, default, 2f); + int dustIndex = Dust.NewDust(Player.position, 120, 120, DustID.Rain_BloodMoon, 0f, 0f, 0, default, 2f); Main.dust[dustIndex].noGravity = true; Main.dust[dustIndex].velocity *= 4f; - dustIndex = Dust.NewDust(Player.position, 120, 120, 218, 0f, 0f, 100, default, 1f); + dustIndex = Dust.NewDust(Player.position, 120, 120, DustID.Rain_BloodMoon, 0f, 0f, 100, default, 1f); Main.dust[dustIndex].velocity *= 2.25f; Main.dust[dustIndex].noGravity = true; - Dust.NewDust(Player.Center + angle.ToRotationVector2() * 160f, 0, 0, 218, 0f, 0f, 100, default, 1f); + Dust.NewDust(Player.Center + angle.ToRotationVector2() * 160f, 0, 0, DustID.Rain_BloodMoon, 0f, 0f, 100, default, 1f); } // https://github.com/tModLoader/tModLoader/wiki/IEntitySource#detailed-list @@ -3079,7 +3106,7 @@ namespace CalamityMod.CalPlayer float rageRatio = rage / rageMax; float baseDamage = rageRatio * GaelsGreatsword.SkullsplosionDamageMultiplier * GaelsGreatsword.BaseDamage; int damage = (int)Player.GetTotalDamage().ApplyTo(baseDamage); - float skullCount = 20f; + float skullCount = 14f + (rageBoostOne ? 4f : 0f) + (rageBoostTwo ? 4f : 0f) + (rageBoostThree ? 4f : 0f); float skullSpeed = 12f; for (float i = 0; i < skullCount; i += 1f) { @@ -3243,13 +3270,13 @@ namespace CalamityMod.CalPlayer // Make some dust for (int index = 0; index < 100; ++index) { - Main.dust[Dust.NewDust(player.position, player.width, player.height, 164, player.velocity.X * 0.2f, player.velocity.Y * 0.2f, 150, Color.Cyan, 1.2f)].velocity *= 0.5f; + Main.dust[Dust.NewDust(player.position, player.width, player.height, DustID.TeleportationPotion, player.velocity.X * 0.2f, player.velocity.Y * 0.2f, 150, Color.Cyan, 1.2f)].velocity *= 0.5f; } Rectangle rect = player.getRect(); int dustAmt = rect.Width * rect.Height / 5; for (int k = 0; k < dustAmt; k++) { - int idx = Dust.NewDust(new Vector2(rect.X, rect.Y), rect.Width, rect.Height, 164); + int idx = Dust.NewDust(new Vector2(rect.X, rect.Y), rect.Width, rect.Height, DustID.TeleportationPotion); Main.dust[idx].scale = Main.rand.NextFloat(0.2f, 0.7f); if (k < 10) Main.dust[idx].scale += 0.25f; @@ -3258,7 +3285,7 @@ namespace CalamityMod.CalPlayer } for (int k = 0; k < 50; k++) { - int idx = Dust.NewDust(new Vector2(rect.X, rect.Y), rect.Width, rect.Height, 180); + int idx = Dust.NewDust(new Vector2(rect.X, rect.Y), rect.Width, rect.Height, DustID.DungeonSpirit); Main.dust[idx].noGravity = true; for (int i = 0; i < 5; i++) { @@ -3294,6 +3321,9 @@ namespace CalamityMod.CalPlayer // TODO -- why is boss health bar code in Player.UpdateEquips and not a ModSystem CalamityConfig.Instance.BossHealthBarExtraInfo = shouldDrawSmallText; + // Putting this in GlobalItem will run multiple times for each slot, which this system already does, creating a slew of problems. + VanillaArmorChangeManager.ApplyPotentialEffectsTo(Player); + // If the config is enabled, vastly increase the player's base tile and wall placement speeds // This stacks with the Brick Layer and Portable Cement Mixer if (CalamityConfig.Instance.FasterTilePlacement) @@ -3586,17 +3616,27 @@ namespace CalamityMod.CalPlayer } } - // Add a cooldown display for the vanilla lifesteal cooldown, which is active when negative - if (Player.whoAmI == Main.myPlayer && Player.lifeSteal < 0f) + // Add a cooldown display for the vanilla lifesteal cooldown, which is active when negative. + if (Player.whoAmI == Main.myPlayer) { - float duration = Player.lifeSteal; - float baseCooldown = Main.expertMode ? 0.5f : 0.6f; - float lifeStealNerf = BossRushEvent.BossRushActive ? 0.3f : CalamityWorld.death ? 0.25f : CalamityWorld.revenge ? 0.2f : Main.expertMode ? 0.15f : 0.1f; - duration /= baseCooldown - lifeStealNerf; - duration *= -1f; + float baseRecoveryRate = Main.expertMode ? BalancingConstants.LifeStealRecoveryRate_Expert : BalancingConstants.LifeStealRecoveryRate_Classic; - if (!Player.HasCooldown(LifeSteal.ID) || (cooldowns[LifeSteal.ID].duration < (int)duration)) - Player.AddCooldown(LifeSteal.ID, (int)duration); + float lifeStealRecoveryRateReduction = + CalamityWorld.death ? BalancingConstants.LifeStealRecoveryRateReduction_Death : + CalamityWorld.revenge ? BalancingConstants.LifeStealRecoveryRateReduction_Revengeance : + Main.expertMode ? BalancingConstants.LifeStealRecoveryRateReduction_Expert : + BalancingConstants.LifeStealRecoveryRateReduction_Classic; + + if (Main.masterMode) + lifeStealRecoveryRateReduction += BalancingConstants.LifeStealRecoveryRateReduction_Master; + + float lifeStealRecoveryRate = baseRecoveryRate - lifeStealRecoveryRateReduction; + if (Player.lifeSteal < -lifeStealRecoveryRate) + { + int duration = (int)Math.Ceiling(Math.Abs(Player.lifeSteal) / lifeStealRecoveryRate); + if (!Player.HasCooldown(LifeSteal.ID) || (cooldowns[LifeSteal.ID].duration < duration)) + Player.AddCooldown(LifeSteal.ID, duration); + } } ForceVariousEffects(); @@ -3608,7 +3648,7 @@ namespace CalamityMod.CalPlayer { // True melee damage from various vanilla equipment placed here. - // Titan Glove and ALL upgrades + // Titan Glove and ALL upgrades. if (Player.kbGlove) Player.GetDamage() += 0.1f; @@ -3618,11 +3658,9 @@ namespace CalamityMod.CalPlayer if (gSabatonTempJumpSpeed > 0) { gSabatonTempJumpSpeed--; - //Only give temporary jump speed if Gravistar Sabaton is equipped, but still decrement the time so that you can't store it for later + // Only give temporary jump speed if Gravistar Sabaton is equipped, but still decrement the time so that you can't store it for later. if (gSabaton && Player.whoAmI == Main.myPlayer) - { Player.jumpSpeedBoost += 2f; - } } } #endregion @@ -3649,14 +3687,14 @@ namespace CalamityMod.CalPlayer (stressPills ? 0.05f : 0f) + ((abyssalDivingSuit && Player.IsUnderwater()) ? 0.05f : 0f) + (aquaticHeartWaterBuff ? 0.15f : 0f) + - ((frostFlare && Player.statLife < (int)(Player.statLifeMax2 * 0.25)) ? 0.15f : 0f) + + ((frostFlare && Player.statLife <= (int)(Player.statLifeMax2 * 0.5)) ? 0.15f : 0f) + (dragonScales ? 0.1f : 0f) + (kamiBoost ? KamiBuff.RunAccelerationBoost : 0f) + (CobaltSet ? CobaltArmorSetChange.SpeedBoostSetBonusPercentage * 0.01f : 0f) + (silvaSet ? 0.05f : 0f) + (blueCandle ? 0.05f : 0f) + (planarSpeedBoost > 0 ? (0.01f * planarSpeedBoost) : 0f) + - ((deepDiver && Player.IsUnderwater()) ? 0.15f : 0f); + (hasteLevel * 0.05f); float runSpeedMult = 1f + (lunicCorpsLegs ? 0.1f : 0f) + @@ -3664,13 +3702,13 @@ namespace CalamityMod.CalPlayer (stressPills ? 0.05f : 0f) + ((abyssalDivingSuit && Player.IsUnderwater()) ? 0.05f : 0f) + (aquaticHeartWaterBuff ? 0.15f : 0f) + - ((frostFlare && Player.statLife < (int)(Player.statLifeMax2 * 0.25)) ? 0.15f : 0f) + + ((frostFlare && Player.statLife <= (int)(Player.statLifeMax2 * 0.5)) ? 0.15f : 0f) + (dragonScales ? 0.1f : 0f) + (kamiBoost ? KamiBuff.RunSpeedBoost : 0f) + (CobaltSet ? CobaltArmorSetChange.SpeedBoostSetBonusPercentage * 0.01f : 0f) + (silvaSet ? 0.05f : 0f) + (planarSpeedBoost > 0 ? (0.01f * planarSpeedBoost) : 0f) + - ((deepDiver && Player.IsUnderwater()) ? 0.15f : 0f); + (hasteLevel * 0.05f); if ((Player.slippy || Player.slippy2) && Player.iceSkate) runAccMult *= 0.6f; @@ -3718,8 +3756,7 @@ namespace CalamityMod.CalPlayer #region On Respawn public override void OnRespawn() { - if (healToFull) - thirdSageH = true; + healToFull = true; // The player rotation can be off if the player dies at the right time when using Final Dawn. Player.fullRotation = 0f; @@ -3787,9 +3824,9 @@ namespace CalamityMod.CalPlayer #region Modify Mana Cost public override void ModifyManaCost(Item item, ref float reduce, ref float mult) { - if (item.type == ItemID.SpaceGun && meteorSet) + if (CalamityLists.MagicGunIDs.Contains(item.type) && meteorSet) { - mult *= 0.5f; + mult *= 0.33f; } } #endregion @@ -3917,7 +3954,7 @@ namespace CalamityMod.CalPlayer { if (Main.rand.NextBool(3)) { - int element = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 66, Player.velocity.X * 0.2f + Player.direction * 3f, Player.velocity.Y * 0.2f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.25f); + int element = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, DustID.RainbowTorch, Player.velocity.X * 0.2f + Player.direction * 3f, Player.velocity.Y * 0.2f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.25f); Main.dust[element].noGravity = true; } } @@ -3925,21 +3962,21 @@ namespace CalamityMod.CalPlayer { if (Main.rand.NextBool(3)) { - Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 67, Player.velocity.X * 0.2f + Player.direction * 3f, Player.velocity.Y * 0.2f, 100, default, 0.75f); + Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, DustID.IceRod, Player.velocity.X * 0.2f + Player.direction * 3f, Player.velocity.Y * 0.2f, 100, default, 0.75f); } } if (xerocSet) { if (Main.rand.NextBool(3)) { - Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 58, Player.velocity.X * 0.2f + Player.direction * 3f, Player.velocity.Y * 0.2f, 100, default, 1.25f); + Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, DustID.Enchanted_Pink, Player.velocity.X * 0.2f + Player.direction * 3f, Player.velocity.Y * 0.2f, 100, default, 1.25f); } } if (dsSetBonus) { if (Main.rand.NextBool(3)) { - Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 27, Player.velocity.X * 0.2f + Player.direction * 3f, Player.velocity.Y * 0.2f, 100, default, 2.5f); + Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, DustID.Shadowflame, Player.velocity.X * 0.2f + Player.direction * 3f, Player.velocity.Y * 0.2f, 100, default, 2.5f); } } } @@ -4010,7 +4047,7 @@ namespace CalamityMod.CalPlayer } // Handle AI edge-cases. These are like overlapping projectiles and the projectile not spawning at all - if (item.type == ModContent.ItemType()) + if (item.type == ModContent.ItemType()) Main.projectile[p].ai[1] = 1f; //MUST BE 1 OTHERWISE CLONES GENERATE STEALTH AAAAAAAAAAA if (item.type == ModContent.ItemType()) Main.projectile[p].ai[0] = -1f; @@ -4046,9 +4083,9 @@ namespace CalamityMod.CalPlayer int d = (int)Player.GetTotalDamage().ApplyTo(RustyMedallion.AcidDropBaseDamage); d = Player.ApplyArmorAccDamageBonusesTo(d); - Vector2 startingPosition = Main.MouseWorld - Vector2.UnitY.RotatedByRandom(0.4f) * 1250f; - Vector2 directionToMouse = (Main.MouseWorld - startingPosition).SafeNormalize(Vector2.UnitY).RotatedByRandom(0.1f); - int drop = Projectile.NewProjectile(source, startingPosition, directionToMouse * 15f, ModContent.ProjectileType(), d, 0f, Player.whoAmI); + Vector2 startingPosition = Main.MouseWorld - Vector2.UnitY.RotatedByRandom(0.3f) * 1250f; + Vector2 directionToMouse = (Main.MouseWorld - startingPosition).SafeNormalize(Vector2.UnitX); + int drop = Projectile.NewProjectile(source, startingPosition, directionToMouse * 15f, ModContent.ProjectileType(), d, 0f, Player.whoAmI, 3); if (drop.WithinBounds(Main.maxProjectiles)) { Main.projectile[drop].penetrate = 2; @@ -4058,6 +4095,17 @@ namespace CalamityMod.CalPlayer } } + if (MiniSwarmers && MiniSwamerCooldown <= 0) + { + if (item.CountsAsClass() && !item.channel) + { + int newDamage = (int)(damage * (6 - 5 * (item.useTime >= 25 ? 1 : item.useTime / 25))); + newDamage = Player.ApplyArmorAccDamageBonusesTo(newDamage); + Projectile.NewProjectile(source, position, velocity * 1.25f, ModContent.ProjectileType(), newDamage, 2f, Player.whoAmI); + + MiniSwamerCooldown = DynamoStemCells.MiniSwamerCooldown; + } + } return true; } #endregion @@ -4674,7 +4722,7 @@ namespace CalamityMod.CalPlayer return rogueStealth >= rogueStealthMax * consumptionMult; } - internal void ConsumeStealthByAttacking() + public void ConsumeStealthByAttacking() { stealthStrikeThisFrame = true; stealthAcceleration = 1f; // Reset acceleration when you attack @@ -4716,14 +4764,14 @@ namespace CalamityMod.CalPlayer if (Player.whoAmI == Main.myPlayer && !endoCooper && randAmt > 0 && Main.rand.NextBool(randAmt) && chaseable) { int spearsFired = 0; - + for (int i = 0; i < Main.projectile.Length; i++) { if (spearsFired == 2) break; if (Main.projectile[i].owner == Player.whoAmI && Main.projectile[i].friendly) { - bool attack = Main.projectile[i].owner == Player.whoAmI && Main.projectile[i].type == ModContent.ProjectileType(); + bool attack = Main.projectile[i].owner == Player.whoAmI && Main.projectile[i].type == ModContent.ProjectileType(); if (attack) { int numSpears = profanedCrystalBuffs ? 12 : 6; @@ -4813,8 +4861,15 @@ namespace CalamityMod.CalPlayer if (CalamityConfig.Instance.SpeedrunTimer) CalamityMod.SpeedrunTimer.Restart(); - // Set a random delay between 12 and 20 seconds. When this delay hits zero, the music mod and wiki reminder messages display - if ((CalamityMod.Instance.musicMod is null && CalamityConfig.Instance.MusicModReminderMessage) || CalamityConfig.Instance.WikiStatusMessage) + // + // 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) { startMessageDisplayDelay = Main.rand.Next(CalamityUtils.SecondsToFrames(12), CalamityUtils.SecondsToFrames(20) + 1); } diff --git a/CalPlayer/CalamityPlayerDashEffects.cs b/CalPlayer/CalamityPlayerDashEffects.cs index 0a5cce0e2e..302f69fc37 100644 --- a/CalPlayer/CalamityPlayerDashEffects.cs +++ b/CalPlayer/CalamityPlayerDashEffects.cs @@ -1,10 +1,10 @@ -using CalamityMod.Balancing; +using System; +using CalamityMod.Balancing; using CalamityMod.CalPlayer.Dashes; using CalamityMod.EntitySources; using CalamityMod.Enums; using CalamityMod.Items.Mounts; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -27,10 +27,10 @@ namespace CalamityMod.CalPlayer set => dashID = value; } - public string DeferredDashID; + public string DeferredDashID; public string LastUsedDashID; - + public PlayerDashEffect UsedDash { get @@ -127,7 +127,9 @@ namespace CalamityMod.CalPlayer dashDelayToApply = BalancingConstants.UniversalShieldSlamCooldown; else if (UsedDash.CollisionType == DashCollisionType.ShieldBonk) dashDelayToApply = BalancingConstants.UniversalShieldBonkCooldown; - + if (DashID == "Deep Diver") + dashDelayToApply = 23; + float dashSpeed = 12f; float dashSpeedDecelerationFactor = 0.985f; float runSpeed = Math.Max(Player.accRunSpeed, Player.maxRunSpeed); @@ -564,8 +566,10 @@ namespace CalamityMod.CalPlayer if (Player.whoAmI == Main.myPlayer) Player.ApplyDamageToNPC(n, (int)Damage, Knockback, hitDirection, false); + // 17APR2024: Ozzatron: Dash iframes are not boosted by Cross Necklace at all and are fixed. n.Calamity().dashImmunityTime[Player.whoAmI] = NPCImmuneTime; - Player.GiveIFrames(PlayerImmuneTime, false); + Player.GiveUniversalIFrames(PlayerImmuneTime, false); + totalHurtNPCs++; break; } diff --git a/CalPlayer/CalamityPlayerDrawEffects.cs b/CalPlayer/CalamityPlayerDrawEffects.cs index eaf39cd6f5..d5326f5e54 100644 --- a/CalPlayer/CalamityPlayerDrawEffects.cs +++ b/CalPlayer/CalamityPlayerDrawEffects.cs @@ -62,7 +62,7 @@ namespace CalamityMod.CalPlayer Rectangle screenArea = new Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 50, Main.screenWidth + 1000, Main.screenHeight + 100); int dustDrawn = 0; float maxShroomDust = Main.maxDustToDraw / 2; - Color shroomColor = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, 0); + Color shroomColor = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, Main.DiscoR); for (int i = 0; i < Main.maxDustToDraw; i++) { Dust dust = Main.dust[i]; @@ -104,6 +104,10 @@ namespace CalamityMod.CalPlayer } } } + else // This is such a stupid way to reset this but you can't just put it in ResetEffects + { + calamityPlayer.trippyLevel = 1; + } // TODO -- rogue stealth visuals are an utter catastrophe and should be fully destroyed on next stealth rework if (calamityPlayer.rogueStealth > 0f && calamityPlayer.rogueStealthMax > 0f && Player.townNPCs < 3f && CalamityConfig.Instance.StealthInvisibility) @@ -127,7 +131,7 @@ namespace CalamityMod.CalPlayer { if (Main.rand.NextBool()) { - int dust = Dust.NewDust(drawInfo.Position - new Vector2(2f), Player.width + 4, Player.height + 4, 229, Player.velocity.X * 0.4f, Player.velocity.Y * 0.4f, 100, default, 1f); + int dust = Dust.NewDust(drawInfo.Position - new Vector2(2f), Player.width + 4, Player.height + 4, DustID.Vortex, Player.velocity.X * 0.4f, Player.velocity.Y * 0.4f, 100, default, 1f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 0.5f; drawInfo.DustCache.Add(dust); @@ -142,7 +146,7 @@ namespace CalamityMod.CalPlayer { if (Main.rand.NextBool()) { - int dust = Dust.NewDust(drawInfo.Position - new Vector2(2f), Player.width + 4, Player.height + 4, 246, Player.velocity.X * 0.4f, Player.velocity.Y * 0.4f, 100, default, 1f); + int dust = Dust.NewDust(drawInfo.Position - new Vector2(2f), Player.width + 4, Player.height + 4, DustID.GoldCoin, Player.velocity.X * 0.4f, Player.velocity.Y * 0.4f, 100, default, 1f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 0.5f; drawInfo.DustCache.Add(dust); @@ -162,7 +166,7 @@ namespace CalamityMod.CalPlayer { if (Main.rand.NextBool()) { - int dust = Dust.NewDust(drawInfo.Position - new Vector2(2f), Player.width + 4, Player.height + 4, 27, Player.velocity.X * 0.4f, Player.velocity.Y * 0.4f, 100, default, 1.5f); + int dust = Dust.NewDust(drawInfo.Position - new Vector2(2f), Player.width + 4, Player.height + 4, DustID.Shadowflame, Player.velocity.X * 0.4f, Player.velocity.Y * 0.4f, 100, default, 1.5f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 0.5f; drawInfo.DustCache.Add(dust); @@ -176,25 +180,14 @@ namespace CalamityMod.CalPlayer { if (Player != null && !Player.dead) { - Lighting.AddLight((int)Player.Center.X / 16, (int)Player.Center.Y / 16, 31 / 235f, 170 / 235f, 222 / 235f); - if (!Player.mount.Active) - { - if (Main.rand.NextBool(14)) - { - int dust = Dust.NewDust(drawInfo.Position - new Vector2(2f), Player.width + 8, Player.height + 8, 206, Player.velocity.X * 0.4f, Player.velocity.Y * 0.4f, 100, default, 1.5f); - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity *= 1f; - drawInfo.DustCache.Add(dust); - } - } + Lighting.AddLight(Player.Center, Color.Lerp(Color.Cyan, Color.White, 0.7f).ToVector3()); if (!Player.StandingStill() && !Player.mount.Active) { - if (Main.rand.NextBool(8)) + if (Main.rand.NextBool()) { - int de_dust2 = Dust.NewDust(drawInfo.Position - new Vector2(2f), Player.width + 4, Player.height + 4, Main.rand.NextBool() ? 204 : 213, Player.velocity.X * 0.4f, Player.velocity.Y * 0.4f, 100, default, 1.5f); - Main.dust[de_dust2].noGravity = true; - Main.dust[de_dust2].velocity *= 0.5f; - drawInfo.DustCache.Add(de_dust2); + Vector2 velocity = -Player.velocity.SafeNormalize(Vector2.UnitY) * Main.rand.NextFloat(1, 3); + Particle nanoDust = new NanoParticle(drawInfo.Position + new Vector2(Main.rand.Next(Player.width + 1), Main.rand.Next(Player.height + 1)), velocity, (Main.rand.NextBool(3) ? Color.RoyalBlue : Color.Cyan) * 0.9f, Main.rand.NextFloat(0.2f, 0.7f), 9, false, true); + GeneralParticleHandler.SpawnParticle(nanoDust); } } } @@ -291,6 +284,9 @@ namespace CalamityMod.CalPlayer if (calamityPlayer.vaporfied && drawInfo.shadow == 0f) Vaporfied.DrawEffects(drawInfo); + + if (calamityPlayer.vHex && drawInfo.shadow == 0f) + VulnerabilityHex.DrawEffects(drawInfo); #endregion if (calamityPlayer.PinkJellyRegen && drawInfo.shadow == 0f) @@ -427,7 +423,7 @@ namespace CalamityMod.CalPlayer ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType(), + ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), @@ -443,10 +439,10 @@ namespace CalamityMod.CalPlayer ModContent.Request("CalamityMod/CalPlayer/DrawLayers/Backpack_HalleysInferno").Value, ModContent.Request("CalamityMod/CalPlayer/DrawLayers/Backpack_CleansingBlaze").Value, ModContent.Request("CalamityMod/CalPlayer/DrawLayers/Backpack_ElementalEruption").Value, - ModContent.Request("CalamityMod/CalPlayer/DrawLayers/Backpack_TheEmpyrean").Value, + ModContent.Request("CalamityMod/CalPlayer/DrawLayers/Backpack_DeadSunsWind").Value, ModContent.Request("CalamityMod/CalPlayer/DrawLayers/Backpack_Meowthrower").Value, ModContent.Request("CalamityMod/CalPlayer/DrawLayers/Backpack_OverloadedBlaster").Value, - ModContent.Request("CalamityMod/CalPlayer/DrawLayers/Backpack_TerraFlameburster").Value, + ModContent.Request("CalamityMod/CalPlayer/DrawLayers/Backpack_WildfireBloom").Value, ModContent.Request("CalamityMod/CalPlayer/DrawLayers/Backpack_Photoviscerator").Value, ModContent.Request("CalamityMod/CalPlayer/DrawLayers/Backpack_Shadethrower").Value, ModContent.Request("CalamityMod/CalPlayer/DrawLayers/Backpack_BloodBoiler").Value, @@ -475,8 +471,14 @@ namespace CalamityMod.CalPlayer SpriteEffects spriteEffects = Player.direction == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + int xOffset = 9; + // Photoviscerator's tank is extended a bit more out + if (thingToDraw == ModContent.Request("CalamityMod/CalPlayer/DrawLayers/Backpack_Photoviscerator").Value) + { + xOffset = 16; + } DrawData howDoIDrawThings = new DrawData(thingToDraw, - new Vector2((int)(drawPlayer.position.X - Main.screenPosition.X + (drawPlayer.width / 2) - (9 * drawPlayer.direction)) - 4f * drawPlayer.direction, (int)(drawPlayer.position.Y - Main.screenPosition.Y + (drawPlayer.height / 2) + 2f * drawPlayer.gravDir - 8f * drawPlayer.gravDir)), + new Vector2((int)(drawPlayer.position.X - Main.screenPosition.X + (drawPlayer.width / 2) - (xOffset * drawPlayer.direction)) - 4f * drawPlayer.direction, (int)(drawPlayer.position.Y - Main.screenPosition.Y + (drawPlayer.height / 2) + 2f * drawPlayer.gravDir - 8f * drawPlayer.gravDir + drawPlayer.gfxOffY)), new Rectangle(0, 0, thingToDraw.Width, thingToDraw.Height), drawInfo.colorArmorBody, drawPlayer.bodyRotation, diff --git a/CalPlayer/CalamityPlayerFishing.cs b/CalPlayer/CalamityPlayerFishing.cs index bffea92b00..b43276306b 100644 --- a/CalPlayer/CalamityPlayerFishing.cs +++ b/CalPlayer/CalamityPlayerFishing.cs @@ -1,5 +1,7 @@ -using CalamityMod.Items.Accessories; +using System.Collections.Generic; +using System.Linq; using CalamityMod.Events; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Fishing; using CalamityMod.Items.Fishing.AstralCatches; using CalamityMod.Items.Fishing.BrimstoneCragCatches; @@ -15,8 +17,6 @@ using CalamityMod.NPCs; using CalamityMod.NPCs.OldDuke; using CalamityMod.World; using Microsoft.Xna.Framework; -using System.Collections.Generic; -using System.Linq; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -38,11 +38,11 @@ namespace CalamityMod.CalPlayer bool lava = attempt.inLava; bool honey = attempt.inHoney; - // If vanilla catches an enemy, just cancel - if (npcSpawn > 0) - return; + // If vanilla catches an enemy, just cancel + if (npcSpawn > 0) + return; - // Set up for allowing fishing in the Sulphurous Sea + // Set up for allowing fishing in the Sulphurous Sea Point point = Player.Center.ToTileCoordinates(); bool canSulphurFish = false; if (Abyss.AtLeftSideOfWorld) @@ -64,13 +64,13 @@ namespace CalamityMod.CalPlayer CalamityGlobalNPC.OldDukeSpawn(Player.whoAmI, ModContent.NPCType(), bait); } - // Don't do anything if you can't fish in lava - if (!attempt.CanFishInLava && lava) - return; + // Don't do anything if you can't fish in lava + if (!attempt.CanFishInLava && lava) + return; - // If you caught junk, then ignore all Calamity catches - if (itemDrop == ItemID.OldShoe || itemDrop == ItemID.FishingSeaweed || itemDrop == ItemID.TinCan) - return; + // If you caught junk, then ignore all Calamity catches + if (itemDrop == ItemID.OldShoe || itemDrop == ItemID.FishingSeaweed || itemDrop == ItemID.TinCan) + return; // Handle our modded Quest Fish, You can catch these in any liquid... because I don't care if you can if (ZoneSunkenSea && questFish == ModContent.ItemType() && attempt.uncommon) @@ -99,7 +99,7 @@ namespace CalamityMod.CalPlayer return; } - // Handle Alluring Bait's increased chance for Potion Material fish + // Handle Alluring Bait's increased chance for Potion Material fish if (alluringBait) { int chanceForPotionFish = 1000 / power; @@ -154,7 +154,7 @@ namespace CalamityMod.CalPlayer } } - // Handle the increased chance of crates from Enchanted Pearl and the Supreme Fishing Station + // Handle the increased chance of crates from Enchanted Pearl and the Supreme Fishing Station if (enchantedPearl || fishingStation) { int chanceForCrates = (enchantedPearl ? 10 : 0) + @@ -190,9 +190,13 @@ namespace CalamityMod.CalPlayer if (Main.rand.NextBool(chanceForBiomeCrate)) { if (ZoneCalamity) - itemDrop = ModContent.ItemType(); - else - itemDrop = Main.hardMode ? ItemID.LavaCrateHard : ItemID.LavaCrate; + itemDrop = Main.hardMode ? ModContent.ItemType() : ModContent.ItemType(); + else + itemDrop = Main.hardMode ? ItemID.LavaCrateHard : ItemID.LavaCrate; + } + if ((Main.rand.NextBool(chanceForRareItems) && enchantedPearl && fishingStation && Player.cratePotion) && ZoneCalamity) + { + itemDrop = ModContent.ItemType(); } } } @@ -234,7 +238,7 @@ namespace CalamityMod.CalPlayer } if (ZoneSunkenSea) { - switch (Main.rand.Next(2)) + switch (Main.rand.Next(3)) { case 0: rareItemList.Add(ModContent.ItemType()); @@ -242,6 +246,9 @@ namespace CalamityMod.CalPlayer case 1: rareItemList.Add(ModContent.ItemType()); break; + case 2: + rareItemList.Add(ModContent.ItemType()); + break; } } if (Player.ZoneSnow && Player.ZoneRockLayerHeight && (Player.ZoneCorrupt || Player.ZoneCrimson || Player.ZoneHallow)) @@ -267,9 +274,9 @@ namespace CalamityMod.CalPlayer { List biomeCrateList = new List(); - biomeCrateList.AddWithCondition(ModContent.ItemType(), ZoneAstral); - biomeCrateList.AddWithCondition(ModContent.ItemType(), ZoneSunkenSea); - biomeCrateList.AddWithCondition(ModContent.ItemType(), canSulphurFish); + biomeCrateList.AddWithCondition(Main.hardMode ? ModContent.ItemType() : ModContent.ItemType(), ZoneAstral); + biomeCrateList.AddWithCondition(Main.hardMode ? ModContent.ItemType() : ModContent.ItemType(), ZoneSunkenSea); + biomeCrateList.AddWithCondition(Main.hardMode ? ModContent.ItemType() : ModContent.ItemType(), canSulphurFish); biomeCrateList.AddWithCondition(Main.hardMode ? ItemID.CorruptFishingCrateHard : ItemID.CorruptFishingCrate, Player.ZoneCorrupt); biomeCrateList.AddWithCondition(Main.hardMode ? ItemID.CrimsonFishingCrateHard : ItemID.CrimsonFishingCrate, Player.ZoneCrimson); biomeCrateList.AddWithCondition(Main.hardMode ? ItemID.HallowedFishingCrateHard : ItemID.HallowedFishingCrate, Player.ZoneHallow); @@ -302,59 +309,59 @@ namespace CalamityMod.CalPlayer if (water) { - // Handle Calamity's crates, veryrare and legendary means it's a Golden Crate - if (attempt.crate) - { - if (attempt.rare && !attempt.veryrare && !attempt.legendary) - { - if (ZoneAstral) - { - itemDrop = ModContent.ItemType(); - } - if (ZoneSunkenSea) - { - itemDrop = ModContent.ItemType(); - } - if (canSulphurFish) - { - itemDrop = ModContent.ItemType(); - } - } - return; - } + // Handle Calamity's crates, veryrare and legendary means it's a Golden Crate + if (attempt.crate) + { + if (attempt.rare && !attempt.veryrare && !attempt.legendary) + { + if (ZoneAstral) + { + itemDrop = Main.hardMode ? ModContent.ItemType() : ModContent.ItemType(); + } + if (ZoneSunkenSea) + { + itemDrop = Main.hardMode ? ModContent.ItemType() : ModContent.ItemType(); + } + if (canSulphurFish) + { + itemDrop = Main.hardMode ? ModContent.ItemType() : ModContent.ItemType(); + } + } + return; + } - // Don't override the vanilla crates or any special vanilla fishing loot - List keepCatchList = new List() - { - ItemID.WoodenCrate, - ItemID.WoodenCrateHard, - ItemID.IronCrate, - ItemID.IronCrateHard, - ItemID.GoldenCrate, - ItemID.GoldenCrateHard, - ItemID.FrogLeg, - ItemID.BalloonPufferfish, - ItemID.ZephyrFish, - ItemID.CombatBook, - ItemID.CorruptFishingCrate, - ItemID.CorruptFishingCrateHard, - ItemID.CrimsonFishingCrate, - ItemID.CrimsonFishingCrateHard, - ItemID.HallowedFishingCrate, - ItemID.HallowedFishingCrateHard, - ItemID.DungeonFishingCrate, - ItemID.DungeonFishingCrateHard, - ItemID.JungleFishingCrate, - ItemID.JungleFishingCrateHard, - ItemID.FloatingIslandFishingCrate, - ItemID.FloatingIslandFishingCrateHard, - ItemID.FrozenCrate, - ItemID.FrozenCrateHard, - ItemID.OasisCrate, - ItemID.OasisCrateHard, - ItemID.OceanCrate, - ItemID.OceanCrateHard - }; + // Don't override the vanilla crates or any special vanilla fishing loot + List keepCatchList = new List() + { + ItemID.WoodenCrate, + ItemID.WoodenCrateHard, + ItemID.IronCrate, + ItemID.IronCrateHard, + ItemID.GoldenCrate, + ItemID.GoldenCrateHard, + ItemID.FrogLeg, + ItemID.BalloonPufferfish, + ItemID.ZephyrFish, + ItemID.CombatBook, + ItemID.CorruptFishingCrate, + ItemID.CorruptFishingCrateHard, + ItemID.CrimsonFishingCrate, + ItemID.CrimsonFishingCrateHard, + ItemID.HallowedFishingCrate, + ItemID.HallowedFishingCrateHard, + ItemID.DungeonFishingCrate, + ItemID.DungeonFishingCrateHard, + ItemID.JungleFishingCrate, + ItemID.JungleFishingCrateHard, + ItemID.FloatingIslandFishingCrate, + ItemID.FloatingIslandFishingCrateHard, + ItemID.FrozenCrate, + ItemID.FrozenCrateHard, + ItemID.OasisCrate, + ItemID.OasisCrateHard, + ItemID.OceanCrate, + ItemID.OceanCrateHard + }; if (keepCatchList.Contains(itemDrop)) { return; @@ -384,10 +391,10 @@ namespace CalamityMod.CalPlayer } } - // Increased chance of Enchanted Starfish if you don't have maximum mana + // Increased chance of Enchanted Starfish if you don't have maximum mana if (Player.ZoneOverworldHeight && !Main.dayTime) { - int chance = Player.statManaMax < 200 ? 5 : 20; + int chance = Player.statManaMax < 200 ? 5 : 20; if (attempt.uncommon && Main.rand.NextBool(chance)) { itemDrop = ModContent.ItemType(); @@ -426,17 +433,17 @@ namespace CalamityMod.CalPlayer } } - // Lower chance of Spadefish in Hardmode + // Lower chance of Spadefish in Hardmode if (Player.ZoneDirtLayerHeight) { - int chance = Main.hardMode ? 10 : 2; + int chance = Main.hardMode ? 10 : 2; if (attempt.veryrare && Main.rand.NextBool(chance)) { itemDrop = ModContent.ItemType(); } } - if (Player.FindBuffIndex(BuffID.Gills) > -1 && DownedBossSystem.downedCalamitasClone && (attempt.legendary || (attempt.veryrare && Main.rand.NextBool()))) + if (Player.FindBuffIndex(BuffID.Gills) > -1 && DownedBossSystem.downedLeviathan && (attempt.legendary || (attempt.veryrare && Main.rand.NextBool()))) { itemDrop = ModContent.ItemType(); } @@ -451,27 +458,27 @@ namespace CalamityMod.CalPlayer if (ZoneAstral) // Astral Infection, fishing in water { - if (attempt.legendary) + if (attempt.legendary) { - int legendaryCatch = Utils.SelectRandom(Main.rand, new int[] - { - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType() - }); + int legendaryCatch = Utils.SelectRandom(Main.rand, new int[] + { + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType() + }); itemDrop = legendaryCatch; } - else if (attempt.uncommon || attempt.rare || attempt.veryrare) + else if (attempt.uncommon || attempt.rare || attempt.veryrare) { - int uncommonCatch = Utils.SelectRandom(Main.rand, new int[] - { - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType() - }); + int uncommonCatch = Utils.SelectRandom(Main.rand, new int[] + { + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType() + }); itemDrop = uncommonCatch; } - else + else { itemDrop = ModContent.ItemType(); return; @@ -480,29 +487,32 @@ namespace CalamityMod.CalPlayer if (ZoneSunkenSea) // Sunken Sea, fishing in water { - if (attempt.legendary) + if (attempt.legendary) { - List legendaryCatches = new List() - { - ModContent.ItemType(), - ModContent.ItemType() - }; + List legendaryCatches = new List() + { + ModContent.ItemType() + }; legendaryCatches.AddWithCondition(ModContent.ItemType(), DownedBossSystem.downedDesertScourge); legendaryCatches.AddWithCondition(ModContent.ItemType(), Main.hardMode); - itemDrop = legendaryCatches[Main.rand.Next(legendaryCatches.Count)]; + itemDrop = legendaryCatches[Main.rand.Next(legendaryCatches.Count)]; } - else if (attempt.uncommon || attempt.rare || attempt.veryrare) + else if (attempt.veryrare) + { + itemDrop = ModContent.ItemType(); + } + else if (attempt.uncommon || attempt.rare) { itemDrop = ModContent.ItemType(); } - else + else { itemDrop = ModContent.ItemType(); return; } } - // There is no complete fishing pool here, so most of it is vanilla default + // There is no complete fishing pool here, so most of it is vanilla default if (canSulphurFish) // Sulphurous Sea, fishing in water { if (attempt.legendary || (attempt.veryrare && Main.rand.NextBool())) @@ -544,39 +554,38 @@ namespace CalamityMod.CalPlayer { if (ZoneCalamity) // Brimstone Crags, fishing in lava { - if (attempt.crate) + if (attempt.crate) { - itemDrop = ModContent.ItemType(); + itemDrop = Main.hardMode ? ModContent.ItemType() : ModContent.ItemType(); } - else if (attempt.legendary) + else if (attempt.legendary) { - List legendaryCatches = new List() - { - ModContent.ItemType(), - ModContent.ItemType() - }; - itemDrop = legendaryCatches[Main.rand.Next(legendaryCatches.Count)]; - } - // Increased chance of Dragoon Drizzlefish in Prehardmode - else if (attempt.veryrare && !Main.hardMode) - { itemDrop = ModContent.ItemType(); - } - else if ((attempt.rare || attempt.veryrare) && DownedBossSystem.downedProvidence && Main.rand.Next(3) >= 2) - { - itemDrop = ModContent.ItemType(); - } - else if (attempt.uncommon || attempt.rare || attempt.veryrare) - { - List uncommonCatches = new List() - { - ModContent.ItemType(), - ModContent.ItemType() - }; - uncommonCatches.AddWithCondition(ModContent.ItemType(), Main.hardMode); - itemDrop = uncommonCatches[Main.rand.Next(uncommonCatches.Count)]; } - else + // Increased chance of Dragoon Drizzlefish in Prehardmode + else if (attempt.veryrare && !Main.hardMode) + { + itemDrop = ModContent.ItemType(); + } + else if (attempt.veryrare) + { + itemDrop = ModContent.ItemType(); + } + else if ((attempt.rare || attempt.veryrare) && DownedBossSystem.downedProvidence && Main.rand.Next(3) >= 2) + { + itemDrop = ModContent.ItemType(); + } + else if (attempt.uncommon || attempt.rare) + { + List uncommonCatches = new List() + { + ModContent.ItemType(), + ModContent.ItemType() + }; + uncommonCatches.AddWithCondition(ModContent.ItemType(), Main.hardMode); + itemDrop = uncommonCatches[Main.rand.Next(uncommonCatches.Count)]; + } + else { itemDrop = ModContent.ItemType(); } @@ -595,7 +604,7 @@ namespace CalamityMod.CalPlayer if (Player.ZoneSkyHeight && fishingRod.type == ModContent.ItemType()) fishingLevel = fishingLevel * 1.1f; - // Prevent the player from fishing if they have the Bloodworm + // Prevent the player from fishing if they have the Bloodworm if (bait.type == ModContent.ItemType()) { Point point = Player.Center.ToTileCoordinates(); @@ -618,9 +627,9 @@ namespace CalamityMod.CalPlayer if (!canSulphurFish || item.fishingPole <= 0 || item.holdStyle != 1) fishingLevel = -1; - // If your bait is the Bloodworm, set the Fisherman's Pocket Guide to display Warning! - // This only happens when a fishing bobber projectile exists - Player.displayedFishingInfo = Language.GetTextValue("GameUI.FishingWarning"); + // If your bait is the Bloodworm, set the Fisherman's Pocket Guide to display Warning! + // This only happens when a fishing bobber projectile exists + Player.displayedFishingInfo = Language.GetTextValue("GameUI.FishingWarning"); } } #endregion @@ -630,34 +639,34 @@ namespace CalamityMod.CalPlayer { if (alluringBait) { - List fishList = new List() - { - ItemID.FlarefinKoi, - ItemID.Obsidifish, - ItemID.ArmoredCavefish, - ItemID.Stinkfish, - ItemID.SpecularFish, - ItemID.ChaosFish, - ItemID.VariegatedLardfish, - ItemID.DoubleCod, - ItemID.FrostMinnow, - ItemID.Ebonkoi, - ItemID.CrimsonTigerfish, - ItemID.Hemopiranha, - ItemID.PrincessFish, - ItemID.Prismite, - ItemID.Damselfish, - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - }; + List fishList = new List() + { + ItemID.FlarefinKoi, + ItemID.Obsidifish, + ItemID.ArmoredCavefish, + ItemID.Stinkfish, + ItemID.SpecularFish, + ItemID.ChaosFish, + ItemID.VariegatedLardfish, + ItemID.DoubleCod, + ItemID.FrostMinnow, + ItemID.Ebonkoi, + ItemID.CrimsonTigerfish, + ItemID.Hemopiranha, + ItemID.PrincessFish, + ItemID.Prismite, + ItemID.Damselfish, + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + }; - if (fishList.Contains(fish.type)) - { - // Increase the yield by 1 or 2 - fish.stack += Main.rand.NextBool() ? 1 : 2; - } + if (fishList.Contains(fish.type)) + { + // Increase the yield by 1 or 2 + fish.stack += Main.rand.NextBool() ? 1 : 2; + } } } #endregion diff --git a/CalPlayer/CalamityPlayerHitHurt.cs b/CalPlayer/CalamityPlayerHitHurt.cs index ab15a94dc9..9a80787960 100644 --- a/CalPlayer/CalamityPlayerHitHurt.cs +++ b/CalPlayer/CalamityPlayerHitHurt.cs @@ -22,7 +22,6 @@ using CalamityMod.Items.VanillaArmorChanges; using CalamityMod.Items.Weapons.Melee; using CalamityMod.NPCs; using CalamityMod.NPCs.Abyss; -using CalamityMod.NPCs.ExoMechs.Apollo; using CalamityMod.NPCs.NormalNPCs; using CalamityMod.NPCs.Other; using CalamityMod.NPCs.ProfanedGuardians; @@ -55,7 +54,9 @@ namespace CalamityMod.CalPlayer #region Dodges private void SpectralVeilDodge() { - Player.GiveIFrames(spectralVeilImmunity, true); //Set immunity before setting this variable to 0 + // 17APR2024: Ozzatron: Spectral Veil counts as a dodge. It uses vanilla dodge iframes and benefits from Cross Necklace. + int spectralVeilIFrames = spectralVeilImmunity + (Player.longInvince ? BalancingConstants.CrossNecklaceIFrameBoost : 0); + Player.GiveUniversalIFrames(spectralVeilIFrames, true); rogueStealth = rogueStealthMax; spectralVeilImmunity = 0; @@ -65,8 +66,8 @@ namespace CalamityMod.CalPlayer for (int j = 0; j < 20; j++) { - int sVeilDustIndex1 = Dust.NewDust(Player.Center, 1, 1, 21, sVeilDustDir.X * j, sVeilDustDir.Y * j); - int sVeilDustIndex2 = Dust.NewDust(Player.Center, 1, 1, 21, -sVeilDustDir.X * j, -sVeilDustDir.Y * j); + int sVeilDustIndex1 = Dust.NewDust(Player.Center, 1, 1, DustID.VilePowder, sVeilDustDir.X * j, sVeilDustDir.Y * j); + int sVeilDustIndex2 = Dust.NewDust(Player.Center, 1, 1, DustID.VilePowder, -sVeilDustDir.X * j, -sVeilDustDir.Y * j); Main.dust[sVeilDustIndex1].noGravity = false; Main.dust[sVeilDustIndex1].noLight = false; Main.dust[sVeilDustIndex2].noGravity = false; @@ -80,7 +81,10 @@ namespace CalamityMod.CalPlayer private void GodSlayerDodge() { - Player.GiveIFrames(Player.longInvince ? 100 : 60, true); + // 17APR2024: Ozzatron: God Slayer Dodge is a dodge. It uses vanilla dodge iframes and benefits from Cross Necklace. + int godSlayerDodgeIFrames = Player.ComputeDodgeIFrames(); + Player.GiveUniversalIFrames(godSlayerDodgeIFrames, true); + SoundEngine.PlaySound(SoundID.Item67, Player.Center); for (int j = 0; j < 30; j++) @@ -115,11 +119,13 @@ namespace CalamityMod.CalPlayer Player.AddCooldown(Cooldowns.CounterScarf.ID, duration); } - Player.GiveIFrames(Player.longInvince ? 100 : 60, true); + // 17APR2024: Ozzatron: Counter Scarf is a dodge. It uses vanilla dodge iframes and benefits from Cross Necklace. + int counterScarfIFrames = Player.ComputeDodgeIFrames(); + Player.GiveUniversalIFrames(counterScarfIFrames, true); for (int j = 0; j < 100; j++) { - int scarfDodgeDust = Dust.NewDust(Player.position, Player.width, Player.height, 235, 0f, 0f, 100, default, 2f); + int scarfDodgeDust = Dust.NewDust(Player.position, Player.width, Player.height, DustID.LifeDrain, 0f, 0f, 100, default, 2f); Dust dust = Main.dust[scarfDodgeDust]; dust.position.X += Main.rand.Next(-20, 21); dust.position.Y += Main.rand.Next(-20, 21); @@ -136,16 +142,26 @@ namespace CalamityMod.CalPlayer NetMessage.SendData(MessageID.Dodge, -1, -1, null, Player.whoAmI, 1f, 0f, 0f, 0, 0, 0); } - public void AbyssMirrorDodge() + public void AbyssMirrorDodge(double dodgeDamageGateValuePercent, int dodgeDamageGateValue, int hitDamage) { + double maxCooldownDurationDamagePercent = 0.5; + int maxCooldownDurationDamageValue = (int)Math.Round(Player.statLifeMax2 * (maxCooldownDurationDamagePercent - dodgeDamageGateValuePercent)); + + // Just in case... + if (maxCooldownDurationDamageValue <= 0) + maxCooldownDurationDamageValue = 1; + + float cooldownDurationScalar = MathHelper.Clamp((hitDamage - dodgeDamageGateValue) / (float)maxCooldownDurationDamageValue, 0f, 1f); + if (Player.whoAmI == Main.myPlayer && abyssalMirror && !eclipseMirror) { - Player.AddCooldown(GlobalDodge.ID, BalancingConstants.MirrorDodgeCooldown, true, "abyssmirror"); + int cooldownDuration = (int)MathHelper.Lerp(BalancingConstants.MirrorDodgeCooldownMin, BalancingConstants.MirrorDodgeCooldownMax, cooldownDurationScalar); + Player.AddCooldown(GlobalDodge.ID, cooldownDuration, true, "abyssmirror"); - // TODO -- why is this here? - Player.noKnockback = true; + // 17APR2024: Ozzatron: Abyssal Mirror is a dodge. It uses vanilla dodge iframes and benefits from Cross Necklace. + int abyssalMirrorDodgeIFrames = Player.ComputeDodgeIFrames(); + Player.GiveUniversalIFrames(abyssalMirrorDodgeIFrames, true); - Player.GiveIFrames(Player.longInvince ? 100 : 60, true); rogueStealth += 0.5f; SoundEngine.PlaySound(SilvaHeadSummon.ActivationSound, Player.Center); @@ -170,17 +186,27 @@ namespace CalamityMod.CalPlayer } } - public void EclipseMirrorDodge() + public void EclipseMirrorDodge(double dodgeDamageGateValuePercent, int dodgeDamageGateValue, int hitDamage) { + double maxCooldownDurationDamagePercent = 0.5; + int maxCooldownDurationDamageValue = (int)Math.Round(Player.statLifeMax2 * (maxCooldownDurationDamagePercent - dodgeDamageGateValuePercent)); + + // Just in case... + if (maxCooldownDurationDamageValue <= 0) + maxCooldownDurationDamageValue = 1; + + float cooldownDurationScalar = MathHelper.Clamp((hitDamage - dodgeDamageGateValue) / (float)maxCooldownDurationDamageValue, 0f, 1f); + if (Player.whoAmI == Main.myPlayer && eclipseMirror) { - Player.AddCooldown(GlobalDodge.ID, BalancingConstants.MirrorDodgeCooldown, true, "eclipsemirror"); + int cooldownDuration = (int)MathHelper.Lerp(BalancingConstants.MirrorDodgeCooldownMin, BalancingConstants.MirrorDodgeCooldownMax, cooldownDurationScalar); + Player.AddCooldown(GlobalDodge.ID, cooldownDuration, true, "eclipsemirror"); - // TODO -- why is this here? - Player.noKnockback = true; + // 17APR2024: Ozzatron: Eclipse Mirror is a dodge. It uses vanilla dodge iframes and benefits from Cross Necklace. + int eclipseMirrorDodgeIFrames = Player.ComputeDodgeIFrames(); + Player.GiveUniversalIFrames(eclipseMirrorDodgeIFrames, true); - Player.GiveIFrames(Player.longInvince ? 100 : 60, true); - rogueStealth = rogueStealthMax; + rogueStealth += 0.5f; SoundEngine.PlaySound(SoundID.Item68, Player.Center); var source = Player.GetSource_Accessory(FindAccessory(ModContent.ItemType())); @@ -237,7 +263,7 @@ namespace CalamityMod.CalPlayer for (int j = 0; j < 50; j++) { - int nebulousReviveDust = Dust.NewDust(Player.position, Player.width, Player.height, 173, 0f, 0f, 100, default, 2f); + int nebulousReviveDust = Dust.NewDust(Player.position, Player.width, Player.height, DustID.ShadowbeamStaff, 0f, 0f, 100, default, 2f); Dust dust = Main.dust[nebulousReviveDust]; dust.position.X += Main.rand.Next(-20, 21); dust.position.Y += Main.rand.Next(-20, 21); @@ -331,7 +357,7 @@ namespace CalamityMod.CalPlayer for (int i = 0; i < 60; i++) { - int d = Dust.NewDust(Player.position, Player.width, Player.height, 88, 0f, 0f, 0, default, 2.5f); + int d = Dust.NewDust(Player.position, Player.width, Player.height, DustID.GemSapphire, 0f, 0f, 0, default, 2.5f); Main.dust[d].noGravity = true; Main.dust[d].velocity *= 5f; } @@ -464,6 +490,10 @@ namespace CalamityMod.CalPlayer if (Main.zenithWorld) SoundEngine.PlaySound(LeonDeathNoiseRE4_ForGFB, Player.Center); + if (NorfleetCounter >= 3 && NorfleetCounter < 1000) + damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.Norfleet").Format(Player.name)); + NorfleetCounter = 0; + if (NPC.AnyNPCs(ModContent.NPCType())) { if (sCalDeathCount < 51) @@ -629,6 +659,7 @@ namespace CalamityMod.CalPlayer Item heldItem = Player.ActiveItem(); bool wearingForbiddenSet = Player.armor[0].type == ItemID.AncientBattleArmorHat && Player.armor[1].type == ItemID.AncientBattleArmorShirt && Player.armor[2].type == ItemID.AncientBattleArmorPants; + bool forbiddenWithMagicWeapon = wearingForbiddenSet && heldItem.CountsAsClass(); bool gemTechBlueGem = GemTechSet && GemTechState.IsBlueGemActive; @@ -741,35 +772,10 @@ namespace CalamityMod.CalPlayer // The amount of damage that will be dealt is yet to be determined. // - if (areThereAnyDamnBosses && CalamityMod.bossVelocityDamageScaleValues.ContainsKey(npc.type)) - { - CalamityMod.bossVelocityDamageScaleValues.TryGetValue(npc.type, out float velocityScalar); - - if (((npc.type == NPCID.EyeofCthulhu || npc.type == NPCID.Spazmatism) && npc.ai[0] >= 2f) || (npc.type == NPCID.Plantera && npc.life / (float)npc.lifeMax <= 0.5f) || - (npc.type == ModContent.NPCType() && npc.life / (float)npc.lifeMax < 0.6f)) - velocityScalar = CalamityMod.bitingEnemeyVelocityScale; - - if (npc.velocity == Vector2.Zero) - { - contactDamageReduction += 1f - velocityScalar; - } - else - { - float amount = npc.velocity.Length() / (npc.Calamity().maxVelocity * 0.5f); - if (amount > 1f) - amount = 1f; - - float damageReduction = MathHelper.Lerp(velocityScalar, 1f, amount); - if (damageReduction < 1f) - contactDamageReduction += 1f - damageReduction; - } - } - if (transformer) { - if (npc.type == NPCID.BlueJellyfish || npc.type == NPCID.PinkJellyfish || npc.type == NPCID.GreenJellyfish || - npc.type == NPCID.FungoFish || npc.type == NPCID.BloodJelly || npc.type == NPCID.AngryNimbus || npc.type == NPCID.GigaZapper || - npc.type == NPCID.MartianTurret || npc.type == ModContent.NPCType() || npc.type == ModContent.NPCType() || npc.type == ModContent.NPCType()) + if (npc.type == NPCID.BlueJellyfish || npc.type == NPCID.PinkJellyfish || npc.type == NPCID.GreenJellyfish || npc.type == NPCID.FungoFish || + npc.type == NPCID.BloodJelly || npc.type == ModContent.NPCType() || npc.type == ModContent.NPCType() || npc.type == ModContent.NPCType()) contactDamageReduction += 0.5; } @@ -897,9 +903,21 @@ namespace CalamityMod.CalPlayer // This should probably be changed so that when the evolution reflects it gives you 1 frame of guaranteed free dodging everything. if (CalamityLists.projectileDestroyExceptionList.TrueForAll(x => proj.type != x) && proj.active && !proj.friendly && proj.hostile && proj.damage > 0) { + double dodgeDamageGateValuePercent = 0.05; + int dodgeDamageGateValue = (int)Math.Round(Player.statLifeMax2 * dodgeDamageGateValuePercent); + // Reflects count as dodges. They share the timer and can be disabled by Armageddon right click. - if (!disableAllDodges && !Player.HasCooldown(GlobalDodge.ID)) + if (!disableAllDodges && !Player.HasCooldown(GlobalDodge.ID) && proj.damage >= dodgeDamageGateValue) { + double maxCooldownDurationDamagePercent = 0.5; + int maxCooldownDurationDamageValue = (int)Math.Round(Player.statLifeMax2 * (maxCooldownDurationDamagePercent - dodgeDamageGateValuePercent)); + + // Just in case... + if (maxCooldownDurationDamageValue <= 0) + maxCooldownDurationDamageValue = 1; + + float cooldownDurationScalar = MathHelper.Clamp((proj.damage - dodgeDamageGateValue) / (float)maxCooldownDurationDamageValue, 0f, 1f); + // The Evolution if (evolution) { @@ -908,13 +926,18 @@ namespace CalamityMod.CalPlayer proj.velocity *= -2f; proj.extraUpdates += 1; proj.penetrate = 1; - Player.GiveIFrames(20, false); + + // 17APR2024: Ozzatron: The Evolution is a reflect which also functions as a dodge. It uses vanilla dodge iframes and benefits from Cross Necklace. + int evolutionIFrames = Player.ComputeReflectIFrames(); + Player.GiveUniversalIFrames(evolutionIFrames, true); modifiers.SetMaxDamage(1); evolutionLifeRegenCounter = 300; projTypeJustHitBy = proj.type; - Player.AddCooldown(GlobalDodge.ID, BalancingConstants.EvolutionReflectCooldown); + int cooldownDuration = (int)MathHelper.Lerp(BalancingConstants.EvolutionReflectCooldownMin, BalancingConstants.EvolutionReflectCooldownMax, cooldownDurationScalar); + Player.AddCooldown(GlobalDodge.ID, cooldownDuration); + return; } } @@ -969,35 +992,6 @@ namespace CalamityMod.CalPlayer modifiers.SourceDamage *= 0.6f; } - if (CalamityWorld.revenge) - { - double damageMultiplier = 1D; - bool containsProjectile = false; - if (CalamityLists.revengeanceProjectileBuffList25Percent.Contains(proj.type)) - { - damageMultiplier += 0.25; - containsProjectile = true; - } - else if (CalamityLists.revengeanceProjectileBuffList20Percent.Contains(proj.type)) - { - damageMultiplier += 0.2; - containsProjectile = true; - } - else if (CalamityLists.revengeanceProjectileBuffList15Percent.Contains(proj.type)) - { - damageMultiplier += 0.15; - containsProjectile = true; - } - - if (containsProjectile) - { - if (CalamityWorld.death) - damageMultiplier += (damageMultiplier - 1D) * 0.6; - - modifiers.SourceDamage *= (float)damageMultiplier; - } - } - // Reduce damage dealt by rainbow trails depending on how faded they are. if (proj.type == ProjectileID.HallowBossLastingRainbow) { @@ -1234,7 +1228,7 @@ namespace CalamityMod.CalPlayer if (!hasIFrames && !Player.creativeGodMode) nextHitDealsDefenseDamage |= proj.Calamity().DealsDefenseDamage; - if (sulfurSet && !proj.friendly && hurtInfo.Damage > 0) + if (sulphurSet && !proj.friendly && hurtInfo.Damage > 0) { if (Main.player[proj.owner] is null) { @@ -1308,23 +1302,44 @@ namespace CalamityMod.CalPlayer } else if (proj.type == ProjectileID.FrostBeam && !Player.frozen && !gState) { - Player.AddBuff(ModContent.BuffType(), 120); + Player.AddBuff(ModContent.BuffType(), 60); } - else if (proj.type == ProjectileID.DeathLaser || proj.type == ProjectileID.RocketSkeleton) + else if (proj.type == ProjectileID.DeathLaser || proj.type == ProjectileID.RocketSkeleton || proj.type == ProjectileID.BombSkeletronPrime) { - Player.AddBuff(BuffID.OnFire, 240); + Player.AddBuff(BuffID.OnFire, 180); } else if (proj.type == ProjectileID.Skull) { - Player.AddBuff(BuffID.Weak, 300); + Player.AddBuff(BuffID.Weak, 180); + } + else if (proj.type == ProjectileID.CursedFlameHostile || proj.type == ProjectileID.EyeFire) + { + // Guaranteed Cursed Inferno for 1 second (vanilla also has a 68.75% chance of Cursed Inferno for 2 to 3 seconds) + Player.AddBuff(BuffID.CursedInferno, 60); + } + else if (proj.type == ProjectileID.Stinger || proj.type == ProjectileID.QueenBeeStinger) + { + // 66.6% chance of Poison for 3 seconds, 1 guaranteed second of Poison otherwise (vanilla also has a 33.3% chance of Poison for 10 seconds) + if (Main.rand.Next(3) > 0) + Player.AddBuff(BuffID.Poisoned, 180); + else + Player.AddBuff(BuffID.Poisoned, 60); + } + else if (proj.type == ProjectileID.PoisonSeedPlantera) + { + // 75% chance of Poison for 3 to 5 seconds, guaranteed Poison for 2 seconds (vanilla also has a 50% chance of Poison for 3 to 7 seconds) + if (Main.rand.Next(4) > 0) + Player.AddBuff(BuffID.Poisoned, Main.rand.Next(180, 301)); + else + Player.AddBuff(BuffID.Poisoned, 120); } else if (proj.type == ProjectileID.ThornBall) { - Player.AddBuff(BuffID.Poisoned, 480); + Player.AddBuff(BuffID.Poisoned, 300); } else if (proj.type == ProjectileID.CultistBossIceMist) { - Player.AddBuff(BuffID.Frozen, 90); + Player.AddBuff(BuffID.Frozen, 60); Player.AddBuff(BuffID.Chilled, 180); } else if (proj.type == ProjectileID.CultistBossLightningOrbArc) @@ -1341,35 +1356,35 @@ namespace CalamityMod.CalPlayer } else if (proj.type == ProjectileID.PhantasmalBolt || proj.type == ProjectileID.PhantasmalEye) { - Player.AddBuff(ModContent.BuffType(), 120); + Player.AddBuff(ModContent.BuffType(), 60); } else if (proj.type == ProjectileID.PhantasmalSphere) { - Player.AddBuff(ModContent.BuffType(), 240); + Player.AddBuff(ModContent.BuffType(), 120); } else if (proj.type == ProjectileID.PhantasmalDeathray) { - Player.AddBuff(ModContent.BuffType(), 400); + Player.AddBuff(ModContent.BuffType(), 300); } else if (proj.type == ProjectileID.FairyQueenLance || proj.type == ProjectileID.HallowBossRainbowStreak || proj.type == ProjectileID.HallowBossSplitShotCore) { - Player.AddBuff(Main.dayTime ? ModContent.BuffType() : ModContent.BuffType(), 120); + Player.AddBuff(NPC.ShouldEmpressBeEnraged() ? ModContent.BuffType() : ModContent.BuffType(), 60); } else if (proj.type == ProjectileID.HallowBossLastingRainbow) { - Player.AddBuff(Main.dayTime ? ModContent.BuffType() : ModContent.BuffType(), 160); + Player.AddBuff(NPC.ShouldEmpressBeEnraged() ? ModContent.BuffType() : ModContent.BuffType(), 120); } else if (proj.type == ProjectileID.FairyQueenSunDance) { - Player.AddBuff(Main.dayTime ? ModContent.BuffType() : ModContent.BuffType(), 200); + Player.AddBuff(NPC.ShouldEmpressBeEnraged() ? ModContent.BuffType() : ModContent.BuffType(), 180); } else if (proj.type == ProjectileID.BloodNautilusShot) { - Player.AddBuff(ModContent.BuffType(), 240); + Player.AddBuff(ModContent.BuffType(), 120); } else if (proj.type == ProjectileID.BloodShot) { - Player.AddBuff(ModContent.BuffType(), 180); + Player.AddBuff(ModContent.BuffType(), 60); } else if (proj.type == ProjectileID.RuneBlast && Main.zenithWorld) { @@ -1390,21 +1405,41 @@ namespace CalamityMod.CalPlayer proj.velocity *= -1f; proj.damage = (int)Player.GetBestClassDamage().ApplyTo(proj.damage * 8); proj.penetrate = 1; - Player.GiveIFrames(20, false); + + // 17APR2024: Ozzatron: The Transformer is a reflect which also functions as a dodge. It uses vanilla dodge iframes and benefits from Cross Necklace. + int transformerIFrames = Player.ComputeReflectIFrames(); + Player.GiveUniversalIFrames(transformerIFrames, true); } } + double dodgeDamageGateValuePercent = 0.05; + int dodgeDamageGateValue = (int)Math.Round(Player.statLifeMax2 * dodgeDamageGateValuePercent); + // Reflects count as dodges. They share the timer and can be disabled by global dodge disabling effects. - if (!disableAllDodges && !Player.HasCooldown(GlobalDodge.ID)) + if (!disableAllDodges && !Player.HasCooldown(GlobalDodge.ID) && proj.damage >= dodgeDamageGateValue) { + double maxCooldownDurationDamagePercent = 0.5; + int maxCooldownDurationDamageValue = (int)Math.Round(Player.statLifeMax2 * (maxCooldownDurationDamagePercent - dodgeDamageGateValuePercent)); + + // Just in case... + if (maxCooldownDurationDamageValue <= 0) + maxCooldownDurationDamageValue = 1; + + float cooldownDurationScalar = MathHelper.Clamp((proj.damage - dodgeDamageGateValue) / (float)maxCooldownDurationDamageValue, 0f, 1f); + if (daedalusReflect && !evolution) { proj.hostile = false; proj.friendly = true; proj.velocity *= -1f; proj.penetrate = 1; - Player.GiveIFrames(20, false); - Player.AddCooldown(GlobalDodge.ID, BalancingConstants.DaedalusReflectCooldown); + + // 17APR2024: Ozzatron: The Daedalus Reflect set bonus also functions as a dodge. It uses vanilla dodge iframes and benefits from Cross Necklace. + int daedalusReflectIFrames = Player.ComputeReflectIFrames(); + Player.GiveUniversalIFrames(daedalusReflectIFrames, true); + + int cooldownDuration = (int)MathHelper.Lerp(BalancingConstants.DaedalusReflectCooldownMin, BalancingConstants.DaedalusReflectCooldownMax, cooldownDurationScalar); + Player.AddCooldown(GlobalDodge.ID, cooldownDuration); } } } @@ -1423,10 +1458,14 @@ namespace CalamityMod.CalPlayer if (info.Damage < 1 /* || (godSlayerDamage && info.Damage <= 80) */) return true; - // If this hit was marked to be completely ignored due to shield absorption, then ignore it. + // If this hit was marked to be completely ignored due to shield absorption, then process Adrenaline changes and ignore it. if (freeDodgeFromShieldAbsorption) { freeDodgeFromShieldAbsorption = false; + + // 20FEB2024: Ozzatron: Hits fully absorbed by shields remove half of your current Adrenaline. + // If using Draedon's Heart, it pauses for half the typical duration. + LoseAdrenalineOnHurt(info, true); return true; } @@ -1451,8 +1490,11 @@ namespace CalamityMod.CalPlayer Projectile.NewProjectile(Player.GetSource_FromThis(), n.Center, Vector2.Zero, ModContent.ProjectileType(), damage, 0, Main.myPlayer); + // 17APR2024: Ozzatron: Gravistar Sabaton gives iframes when passing through enemies for projectile safety. + // This is a fixed and intentionally very low number of iframes, and is not boosted by Cross Necklace. n.Calamity().dashImmunityTime[Player.whoAmI] = 4; - Player.GiveIFrames(5, false); + Player.GiveUniversalIFrames(GravistarSabaton.PassthroughIFrames, false); + return true; } } @@ -1466,13 +1508,26 @@ namespace CalamityMod.CalPlayer public override bool ConsumableDodge(Player.HurtInfo info) { // Vanilla dodges are gated behind the global dodge cooldown - if (!Player.HasCooldown(GlobalDodge.ID)) + // The dodges will only trigger if the player has taken greater than or equal to 5% of their max HP in damage + double dodgeDamageGateValuePercent = 0.05; + int dodgeDamageGateValue = (int)Math.Round(Player.statLifeMax2 * dodgeDamageGateValuePercent); + if (!Player.HasCooldown(GlobalDodge.ID) && info.Damage >= dodgeDamageGateValue) { + double maxCooldownDurationDamagePercent = 0.5; + int maxCooldownDurationDamageValue = (int)Math.Round(Player.statLifeMax2 * (maxCooldownDurationDamagePercent - dodgeDamageGateValuePercent)); + + // Just in case... + if (maxCooldownDurationDamageValue <= 0) + maxCooldownDurationDamageValue = 1; + + float cooldownDurationScalar = MathHelper.Clamp((info.Damage - dodgeDamageGateValue) / (float)maxCooldownDurationDamageValue, 0f, 1f); + // Re-implementation of vanilla item Black Belt as a consumable dodge if (Player.whoAmI == Main.myPlayer && Player.blackBelt) { Player.NinjaDodge(); - Player.AddCooldown(GlobalDodge.ID, BalancingConstants.BeltDodgeCooldown); + int cooldownDuration = (int)MathHelper.Lerp(BalancingConstants.BeltDodgeCooldownMin, BalancingConstants.BeltDodgeCooldownMax, cooldownDurationScalar); + Player.AddCooldown(GlobalDodge.ID, cooldownDuration); return true; } @@ -1480,7 +1535,9 @@ namespace CalamityMod.CalPlayer if (Player.whoAmI == Main.myPlayer && Player.brainOfConfusionItem != null && !Player.brainOfConfusionItem.IsAir) { Player.BrainOfConfusionDodge(); - int cooldownTime = amalgam ? BalancingConstants.AmalgamDodgeCooldown : BalancingConstants.BrainDodgeCooldown; + int cooldownTime = amalgam ? + (int)MathHelper.Lerp(BalancingConstants.AmalgamDodgeCooldownMin, BalancingConstants.AmalgamDodgeCooldownMax, cooldownDurationScalar) : + (int)MathHelper.Lerp(BalancingConstants.BrainDodgeCooldownMin, BalancingConstants.BrainDodgeCooldownMax, cooldownDurationScalar); Player.AddCooldown(GlobalDodge.ID, cooldownTime); return true; } @@ -1504,16 +1561,16 @@ namespace CalamityMod.CalPlayer return true; // Mirror evades do not work if the global dodge cooldown is active. This cooldown can be triggered by either mirror. - if (!Player.HasCooldown(GlobalDodge.ID)) + if (!Player.HasCooldown(GlobalDodge.ID) && info.Damage >= dodgeDamageGateValue) { if (eclipseMirror) { - EclipseMirrorDodge(); + EclipseMirrorDodge(dodgeDamageGateValuePercent, dodgeDamageGateValue, info.Damage); return true; } else if (abyssalMirror) { - AbyssMirrorDodge(); + AbyssMirrorDodge(dodgeDamageGateValuePercent, dodgeDamageGateValue, info.Damage); return true; } } @@ -1568,7 +1625,7 @@ namespace CalamityMod.CalPlayer SoundEngine.PlaySound(SoundID.NPCHit4, Player.Center); //metal hit noise hurtSoundTimer = 10; } - else if ((aquaticHeartPower || aquaticHeartForce) && !aquaticHeartHide) + else if (((aquaticHeartPower || aquaticHeartForce) && !aquaticHeartHide) || Player.GetModPlayer().vanityEquipped) { modifiers.DisableSound(); SoundEngine.PlaySound(SoundID.FemaleHit, Player.Center); //female hit noise @@ -1602,11 +1659,6 @@ namespace CalamityMod.CalPlayer if (enraged) // Demonshade Enrage increases incoming damage by 25%. damageMult += 0.25; - // Add 5% damage multiplier for each Beetle Shell beetle that is active, thus reducing the DR from 10% to 5% per stack. - // TODO -- Remove this when the new DR scaling system is implemented. - if (Player.beetleDefense && Player.beetleOrbs > 0) - damageMult += 0.05 * Player.beetleOrbs; - modifiers.SourceDamage *= (float)damageMult; #endregion @@ -1621,8 +1673,12 @@ namespace CalamityMod.CalPlayer { if (!Player.HasCooldown(ParryCooldown.ID)) { - Player.GiveIFrames(60, true); + // 17APR2024: Ozzatron: Blazing Core is a parry. It uses vanilla parry iframes and benefits from Cross Necklace. + int blazingCoreParryIFrames = Player.ComputeParryIFrames(); + Player.GiveUniversalIFrames(blazingCoreParryIFrames, true); + blazingCoreEmpoweredParry = true; + modifiers.SetMaxDamage(1); //ONLY REDUCE DAMAGE IF NOT ON COOLDOWN modifiers.DisableSound(); //prevents hurt sound from playing, had no idea this was a thing } @@ -1641,8 +1697,12 @@ namespace CalamityMod.CalPlayer { if (!Player.HasCooldown(ParryCooldown.ID)) { - Player.GiveIFrames(60, true); + // 17APR2024: Ozzatron: Flame-Licked Shell is a parry. It uses vanilla parry iframes and benefits from Cross Necklace. + int flameLickedShellParryIFrames = Player.ComputeParryIFrames(); + Player.GiveUniversalIFrames(flameLickedShellParryIFrames, true); + flameLickedShellEmpoweredParry = true; + modifiers.FinalDamage *= 0.1f; //90% dr modifiers.DisableSound(); } @@ -1678,9 +1738,9 @@ namespace CalamityMod.CalPlayer // If the shield(s) completely absorb the hit, iframes are granted on the spot and the hit is marked to be dodged. // Shields are drained in order of progression, so your weaker shields will break first. // Damage can and will be blocked by multiple shields if it has to be. + bool shieldsFullyAbsorbedHit = false; if (HasAnyEnergyShield) { - bool shieldsFullyAbsorbedHit = false; bool shieldsTookHit = false; bool anyShieldBroke = false; int totalDamageBlocked = 0; @@ -1750,7 +1810,7 @@ namespace CalamityMod.CalPlayer // Actually remove damage from the incoming hit, so that later shields have less damage incoming. info.Damage -= masterChefDamageBlocked; } - + // PSA if (pSoulArtifact && pSoulShieldDurability > 0 && !shieldsFullyAbsorbedHit) { @@ -1825,8 +1885,9 @@ namespace CalamityMod.CalPlayer Rectangle location = new Rectangle((int)Player.position.X, (int)Player.position.Y - 16, Player.width, Player.height); CombatText.NewText(location, Color.LightBlue, Language.GetTextValue(shieldDamageText)); - // Give the player iframes for taking the a shield hit, regardless of whether or not the shields broke - Player.GiveIFrames(Player.longInvince ? 100 : 60, true); + // Give the player iframes for taking a shield hit, regardless of whether or not the shields broke. + int shieldHitIFrames = Player.ComputeHitIFrames(info); + Player.GiveIFrames(info.CooldownCounter, shieldHitIFrames, true); // Spawn particles when hit with the shields up, regardless of whether or not the shields broke. // More particles spawn if a shield broke. @@ -1868,7 +1929,7 @@ namespace CalamityMod.CalPlayer masterChefDurabilityCD.timeLeft = LunicCorpsShieldDurability; // Update PSA/PSC durability on the cooldown rack - if ((pSoulArtifact && (!profanedCrystal || profanedCrystalBuffs)) && cooldowns.TryGetValue(Cooldowns.ProfanedSoulShield.ID, out var profanedSoulDurabilityCD)) + if (pSoulArtifact && (!profanedCrystal || profanedCrystalBuffs) && cooldowns.TryGetValue(Cooldowns.ProfanedSoulShield.ID, out var profanedSoulDurabilityCD)) profanedSoulDurabilityCD.timeLeft = pSoulShieldDurability; // Update Sponge durability on the cooldown rack. @@ -1890,13 +1951,13 @@ namespace CalamityMod.CalPlayer if (pSoulArtifact && (!profanedCrystal || profanedCrystalBuffs)) Player.AddCooldown(ProfanedSoulShieldRecharge.ID, profanedCrystalBuffs ? (60 * 5) : (60 * 10), true); // 5 seconds psc, 10 seconds psa - + // Set The Sponge's recharge delay to full. Override any existing cooldown instance. if (sponge) Player.AddCooldown(SpongeRecharge.ID, TheSponge.ShieldRechargeDelay, true); } - // If the shields completely absorbed the hit, mark the player as dodging this damage instance later down the chain with a "Free Dodge". + // If the shields completely absorbed the hit, then delete the hit using reflection. if (shieldsFullyAbsorbedHit) { freeDodgeFromShieldAbsorption = true; @@ -1912,12 +1973,16 @@ namespace CalamityMod.CalPlayer // Otherwise, it reduces the damage of any hit to 5, which allows for full iframes. // It then applies the full hit (minus that 5 damage) to its own bleedout buffer. // Hits for less than 5 damage are ignored entirely and allowed to strike the player as normal. - if (chaliceOfTheBloodGod && !freeDodgeFromShieldAbsorption && info.Damage > ChaliceOfTheBloodGod.MinAllowedDamage) + if (chaliceOfTheBloodGod && !shieldsFullyAbsorbedHit && info.Damage > ChaliceOfTheBloodGod.MinAllowedDamage) { int bleedoutToApply = info.Damage - ChaliceOfTheBloodGod.MinAllowedDamage; chaliceBleedoutBuffer += bleedoutToApply; + chaliceHitOriginalDamage = info.Damage; info.Damage = ChaliceOfTheBloodGod.MinAllowedDamage; + // Defense damage is applied here. + DealDefenseDamage(info, bleedoutToApply); + // Display text indicating that damage was transferred to bleedout. string text = $"({-bleedoutToApply})"; Rectangle location = new Rectangle((int)Player.position.X + 4, (int)Player.position.Y - 3, Player.width - 4, Player.height - 4); @@ -1940,9 +2005,10 @@ namespace CalamityMod.CalPlayer // If the player was just hit by something capable of dealing defense damage, then apply defense damage. // Bloodflare Core makes every hit deal defense damage (to enable its function). // Defense damage is not applied if the player has iframes. + // This function will be ignored if the player is wearing Chalice, as it handles its defense damage elsewhere. bool hitCanApplyDefenseDamage = nextHitDealsDefenseDamage || bloodflareCore; - if (hitCanApplyDefenseDamage && !hasIFrames && !Player.creativeGodMode) + if (hitCanApplyDefenseDamage && !chaliceOfTheBloodGod && !hasIFrames && !Player.creativeGodMode) { double halfDefense = Player.statDefense / 2.0; int netMitigation = hurtInfo.SourceDamage - hurtInfo.Damage; @@ -1964,7 +2030,7 @@ namespace CalamityMod.CalPlayer { float speed = Main.rand.NextFloat(1.8f, 8f); Vector2 dustVel = new Vector2(speed, speed); - Dust d = Dust.NewDustDirect(Player.position, Player.width, Player.height, 90); + Dust d = Dust.NewDustDirect(Player.position, Player.width, Player.height, DustID.GemRuby); d.velocity = dustVel; d.noGravity = true; d.scale *= Main.rand.NextFloat(1.1f, 1.4f); @@ -2011,8 +2077,8 @@ namespace CalamityMod.CalPlayer if (hideOfDeus) { hideOfDeusMeleeBoostTimer += 3 * hurtInfo.Damage; - if (hideOfDeusMeleeBoostTimer > 900) - hideOfDeusMeleeBoostTimer = 900; + if (hideOfDeusMeleeBoostTimer > 600) + hideOfDeusMeleeBoostTimer = 600; } if (Player.whoAmI == Main.myPlayer) @@ -2064,21 +2130,7 @@ namespace CalamityMod.CalPlayer // Lose adrenaline on hit, unless using Draedon's Heart. if (AdrenalineEnabled) { - // Being hit for zero from Paladin's Shield damage share does not cancel Adrenaline. - // Adrenaline is not lost when hit if using Draedon's Heart. - // Adrenaline is not lost when an empowered parry is performed with blazing core (reduces damage to 1, but not 0) - if (!draedonsHeart && !blazingCoreEmpoweredParry && !adrenalineModeActive && hurtInfo.Damage > 0) - { - if (adrenaline >= adrenalineMax) - { - SoundEngine.PlaySound(AdrenalineHurtSound, Player.Center); - } - adrenaline = 0f; - } - - // If using Draedon's Heart and not actively healing with Nanomachines, pause generation briefly. - if (draedonsHeart && !adrenalineModeActive) - nanomachinesLockoutTimer = DraedonsHeart.NanomachinePauseAfterDamage; + LoseAdrenalineOnHurt(hurtInfo, false); } if (evilSmasherBoost > 0) @@ -2155,7 +2207,7 @@ namespace CalamityMod.CalPlayer for (int d = 0; d < 20; d++) { - int dust = Dust.NewDust(Player.position, Player.width, Player.height, 31, 0f, 0f, 100, default, 2f); + int dust = Dust.NewDust(Player.position, Player.width, Player.height, DustID.Smoke, 0f, 0f, 100, default, 2f); Main.dust[dust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -2166,10 +2218,10 @@ namespace CalamityMod.CalPlayer for (int d = 0; d < 35; d++) { - int fire = Dust.NewDust(Player.position, Player.width, Player.height, 6, 0f, 0f, 100, default, 3f); + int fire = Dust.NewDust(Player.position, Player.width, Player.height, DustID.Torch, 0f, 0f, 100, default, 3f); Main.dust[fire].noGravity = true; Main.dust[fire].velocity *= 5f; - fire = Dust.NewDust(Player.position, Player.width, Player.height, 6, 0f, 0f, 100, default, 2f); + fire = Dust.NewDust(Player.position, Player.width, Player.height, DustID.Torch, 0f, 0f, 100, default, 2f); Main.dust[fire].velocity *= 2f; } } @@ -2182,7 +2234,7 @@ namespace CalamityMod.CalPlayer for (int d = 0; d < 10; d++) { - int ice = Dust.NewDust(Player.position, Player.width, Player.height, 67, 0f, 0f, 100, default, 2f); + int ice = Dust.NewDust(Player.position, Player.width, Player.height, DustID.IceRod, 0f, 0f, 100, default, 2f); Main.dust[ice].velocity *= 3f; if (Main.rand.NextBool()) { @@ -2192,18 +2244,17 @@ namespace CalamityMod.CalPlayer } for (int d = 0; d < 15; d++) { - int ice = Dust.NewDust(Player.position, Player.width, Player.height, 67, 0f, 0f, 100, default, 3f); + int ice = Dust.NewDust(Player.position, Player.width, Player.height, DustID.IceRod, 0f, 0f, 100, default, 3f); Main.dust[ice].noGravity = true; Main.dust[ice].velocity *= 5f; - ice = Dust.NewDust(Player.position, Player.width, Player.height, 67, 0f, 0f, 100, default, 2f); + ice = Dust.NewDust(Player.position, Player.width, Player.height, DustID.IceRod, 0f, 0f, 100, default, 2f); Main.dust[ice].velocity *= 2f; } } if (tarraMelee) { - if (Main.rand.NextBool(4)) - Player.AddBuff(ModContent.BuffType(), 120); + Player.AddBuff(ModContent.BuffType(), 120); } else if (xerocSet) { @@ -2212,11 +2263,10 @@ namespace CalamityMod.CalPlayer } else if (reaverDefense) { - if (Main.rand.NextBool(4)) - Player.AddBuff(ModContent.BuffType(), 180); + Player.AddBuff(ModContent.BuffType(), 180); } - if ((fBarrier || (aquaticHeart && NPC.downedBoss3)) && !areThereAnyDamnBosses) + if (fBarrier || (aquaticHeart && NPC.downedBoss3)) { SoundEngine.PlaySound(SoundID.Item27, Player.Center); for (int m = 0; m < Main.maxNPCs; m++) @@ -2226,17 +2276,13 @@ namespace CalamityMod.CalPlayer continue; float npcDist = (npc.Center - Player.Center).Length(); - float freezeDist = Main.rand.Next(200 + (int)hurtInfo.Damage / 2, 301 + (int)hurtInfo.Damage * 2); + float freezeDist = 300 + (int)hurtInfo.Damage * 2; if (freezeDist > 500f) - freezeDist = 500f + (freezeDist - 500f) * 0.75f; - if (freezeDist > 700f) - freezeDist = 700f + (freezeDist - 700f) * 0.5f; - if (freezeDist > 900f) - freezeDist = 900f + (freezeDist - 900f) * 0.25f; + freezeDist = 500f + (freezeDist - 500f) * 0.5f; if (npcDist < freezeDist) { - float duration = Main.rand.Next(10 + (int)hurtInfo.Damage / 4, 20 + (int)hurtInfo.Damage / 3); + float duration = Main.rand.Next(10 + (int)hurtInfo.Damage / 2, 20 + (int)hurtInfo.Damage); if (duration > 120) duration = 120; @@ -2284,29 +2330,6 @@ namespace CalamityMod.CalPlayer var source = Player.GetSource_Accessory(FindAccessory(ModContent.ItemType())); Projectile.NewProjectile(source, Player.Center.X + Main.rand.Next(-40, 40), Player.Center.Y - Main.rand.Next(20, 60), Player.velocity.X * 0.3f, Player.velocity.Y * 0.3f, ProjectileID.BrainOfConfusion, 0, 0f, Player.whoAmI); } - - if (polarisBoost) - { - polarisBoostCounter -= 10; - if (polarisBoostCounter < 0) - polarisBoostCounter = 0; - - if (polarisBoostCounter >= 20) - { - polarisBoostTwo = false; - polarisBoostThree = true; - } - else if (polarisBoostCounter >= 10) - { - polarisBoostTwo = true; - polarisBoostThree = false; - } - else - { - polarisBoostThree = false; - polarisBoostTwo = false; - } - } } if (Player.ownedProjectileCounts[ModContent.ProjectileType()] != 0) @@ -2355,29 +2378,8 @@ namespace CalamityMod.CalPlayer if (Player.whoAmI == Main.myPlayer) { - int iFramesToAdd = 0; - if (tracersSeraph && hurtInfo.Damage > 200) - iFramesToAdd += 30; - if (godSlayerThrowing && hurtInfo.Damage > 80) - iFramesToAdd += 30; - if (statigelSet && hurtInfo.Damage > 100) - iFramesToAdd += 30; - - if (dAmulet) - { - if (hurtInfo.Damage == 1) - iFramesToAdd += 5; - else - iFramesToAdd += 10; - } - - if (fabsolVodka) - { - if (hurtInfo.Damage == 1) - iFramesToAdd += 5; - else - iFramesToAdd += 10; - } + // Add extra iframes on hit based on various Calamity effects. + int iFramesToAdd = Player.GetExtraHitIFrames(hurtInfo); // Give bonus immunity frames based on the type of damage dealt if (hurtInfo.CooldownCounter != -1) @@ -2391,7 +2393,7 @@ namespace CalamityMod.CalPlayer var source = Player.GetSource_OnHurt(hurtInfo.DamageSource, AerospecBreastplate.FeatherEntitySourceContext); for (int n = 0; n < 4; n++) { - int featherDamage = (int)Player.GetBestClassDamage().ApplyTo(65); + int featherDamage = (int)Player.GetBestClassDamage().ApplyTo(35); featherDamage = Player.ApplyArmorAccDamageBonusesTo(featherDamage); CalamityUtils.ProjectileRain(source, Player.Center, 400f, 100f, 500f, 800f, 20f, ModContent.ProjectileType(), featherDamage, 1f, Player.whoAmI); @@ -2408,12 +2410,13 @@ namespace CalamityMod.CalPlayer int astralStarDamage = (int)Player.GetBestClassDamage().ApplyTo(320); astralStarDamage = Player.ApplyArmorAccDamageBonusesTo(astralStarDamage); - Projectile.NewProjectile(source, Player.Center.X, Player.Center.Y, 0f, 0f, ModContent.ProjectileType(), blazeDamage, 5f, Player.whoAmI, 0f, 1f); + Projectile.NewProjectile(source, Player.Center.X, Player.Center.Y, 0f, 0f, ModContent.ProjectileType(), blazeDamage, 5f, Player.whoAmI, 0f, 1f); for (int n = 0; n < 12; n++) { CalamityUtils.ProjectileRain(source, Player.Center, 400f, 100f, 500f, 800f, 29f, ModContent.ProjectileType(), astralStarDamage, 5f, Player.whoAmI); } } + // TODO -- Make Deific Amulet and Rampart of Deities' retaliation effects way cooler if (dAmulet) { var source = Player.GetSource_Accessory(FindAccessory(ModContent.ItemType())); @@ -2669,7 +2672,7 @@ namespace CalamityMod.CalPlayer } for (int j = 0; j < 100; j++) { - Dust.NewDust(Player.position, Player.width, Player.height, 235, (float)(2 * 0), -2f, 0, default, 1f); + Dust.NewDust(Player.position, Player.width, Player.height, DustID.LifeDrain, (float)(2 * 0), -2f, 0, default, 1f); } Player.mount.Dismount(Player); Player.dead = true; @@ -2748,6 +2751,31 @@ namespace CalamityMod.CalPlayer DealDefenseDamage(incomingDamageToUse, false); } + /// + /// Deals Calamity defense damage to a player, specifically built to handle Chalice of the Blood God's bleedout. + /// + /// HurtInfo of the incoming strike to the player. + /// The bleedout applied on this specific hit. Used for reducing the defense damage inflicted. + public void DealDefenseDamage(Player.HurtInfo hurtInfo, int bleedoutApplied) + { + // Legacy safeguard: Skip defense damage if the player is somehow "hit for zero" (this should never happen). + if (hurtInfo.Damage <= 0 || hurtInfo.SourceDamage <= 0) + return; + + // Under typical circumstances, defense damage scales with "net mitigation", aka how much damage the player DIDN'T take. + // Thematically, this means it scales with how much damage the player's defense took instead of them. + + CalamityPlayer modPlayer = Player.Calamity(); + + // Subtract the bleedout applied on this hit from the net mitigation. + // This prevents Chalice from making the player take much more defense damage than intended. + int netMitigation = hurtInfo.SourceDamage - (hurtInfo.Damage + bleedoutApplied); + int incomingDamageToUse = netMitigation <= 0 ? 0 : netMitigation; + + // Leave it to the direct function to determine how much defense damage is taken. Use standard ratios. + DealDefenseDamage(incomingDamageToUse, false); + } + /// /// Deals Calamity defense damage to a player. This is the direct function, for unusual sources of defense damage. /// @@ -2835,7 +2863,13 @@ namespace CalamityMod.CalPlayer // Play a sound from taking defense damage. if (hurtSoundTimer == 0 && Main.myPlayer == Player.whoAmI) { - SoundEngine.PlaySound(DefenseDamageSound with { Volume = DefenseDamageSound.Volume * 0.75f }, Player.Center); + double maxVolumeDefenseDamageScalar = Main.masterMode ? 0.7 : CalamityWorld.death ? 0.6 : CalamityWorld.revenge ? 0.55 : Main.expertMode ? 0.5 : 0.4; + float maxVolumeDefenseDamage = (float)Math.Round(Player.statDefense * maxVolumeDefenseDamageScalar); + float minVolume = 0.5f; + float maxVolume = 1f; + float lerpAmount = MathHelper.Clamp(defenseDamage / maxVolumeDefenseDamage, 0f, 1f); + float defenseDamageSoundVolumeMultiplier = MathHelper.Lerp(minVolume, maxVolume, lerpAmount); + SoundEngine.PlaySound(DefenseDamageSound with { Volume = DefenseDamageSound.Volume * defenseDamageSoundVolumeMultiplier }, Player.Center); hurtSoundTimer = 30; } @@ -2846,5 +2880,72 @@ namespace CalamityMod.CalPlayer CombatText.NewText(location, messageColor, Language.GetTextValue(text)); } #endregion + + #region Adrenaline Loss Function + /// + /// Causes the player to lose Adrenaline based on an incoming hit. The behavior differs based on energy shields or Draedon's Heart. + /// + /// The incoming damage event to the player. + /// Whether or not the hit was fully absorbed by one or more energy shields. Tends to halve Adrenaline loss. + private void LoseAdrenalineOnHurt(Player.HurtInfo hurtInfo, bool fullyAbsorbedByShield = false) + { + // Being hit for zero from Paladin's Shield damage share has no effects on Adrenaline, regardless of all other circumstances. + // Likewise, being struck while Adrenaline is actively burning has no effects on Adrenaline. + if (hurtInfo.Damage <= 0 || adrenalineModeActive) + return; + + // Draedon's Heart pauses for half the usual duration on a shield hit. + // Otherwise, nothing happens here because no Adrenaline is actually lost. + if (draedonsHeart) + { + int pauseTime = fullyAbsorbedByShield ? DraedonsHeart.NanomachinePauseAfterShieldDamage : DraedonsHeart.NanomachinePauseAfterDamage; + adrenalinePauseTimer += pauseTime; + } + + // Standard Adrenaline behavior + else + { + // Regular Adrenaline pauses on any hit, even if you lose all Adrenaline. + adrenalinePauseTimer += BalancingConstants.AdrenalinePauseAfterDamage; + + // Play a sound if Adrenaline was lost from full (this means Adrenaline DR helped mitigate the hit). + // If this occurs, since Adrenaline DR helped mitigate the hit's damage, we can't allow the amount of Adrenaline lost to actually be reduced. + bool hitAtFullAdrenaline = adrenaline >= adrenalineMax; + if (hitAtFullAdrenaline) + { + SoundEngine.PlaySound(AdrenalineHurtSound, Player.Center); + adrenaline = 0f; + return; + } + + // 19MAR2024: Ozzatron: Chalice makes you lose adrenaline based on the damage you would have suffered in total. + int damageToUse = hurtInfo.Damage; + if (chaliceOfTheBloodGod && chaliceHitOriginalDamage > 0) + { + damageToUse = chaliceHitOriginalDamage; + // Maybe at some point in the future, tracking this value will be useful elsewhere. Until then, it's only used here, so it is reset here. + chaliceHitOriginalDamage = 0; + } + + // Calculate the amount of Adrenaline to lose. This is done in 3 steps: + // 1. Find out how much %HP the player lost (or was absorbed by a shield). + // 2. Use an inverse lerp to calculate the Adrenaline loss scaling down for very small hits (5% HP or less). + // 3. Re-scale the lerp result into a % of Adrenaline loss from 10% (min loss) to 100%. + float damageMaxHPRatio = (float)damageToUse / Player.statLifeMax2; + float smallHitAdrenalineLossRatio = (float)Utils.GetLerpValue(0f, BalancingConstants.AdrenalineFalloffTinyHitHealthRatio, damageMaxHPRatio, true); + float adrenalineLossFraction = MathHelper.Lerp(BalancingConstants.MinimumAdrenalineLoss, 1f, smallHitAdrenalineLossRatio); + float adrenalineToLose = adrenaline * adrenalineLossFraction; + + // If the hit was fully absorbed by a shield, then lose half that much instead. + if (fullyAbsorbedByShield) + adrenalineToLose /= 2f; + + // Actually subtract Adrenaline. + adrenaline -= adrenalineToLose; + if (adrenaline < 0f) + adrenaline = 0f; + } + } + #endregion } } diff --git a/CalPlayer/CalamityPlayerLifeRegen.cs b/CalPlayer/CalamityPlayerLifeRegen.cs index c7ec23ee84..73a7ec8f66 100644 --- a/CalPlayer/CalamityPlayerLifeRegen.cs +++ b/CalPlayer/CalamityPlayerLifeRegen.cs @@ -64,9 +64,9 @@ namespace CalamityMod.CalPlayer if (Player.electrified && !purity) { - totalVanillaDoT += 8; + totalVanillaDoT += eleResist ? 4 : 8; if (Player.controlLeft || Player.controlRight) - totalVanillaDoT += 32; + totalVanillaDoT += eleResist ? 16 : 32; } // Tally up total current vanilla DoT so it can be added as extra DoT from Death Mode @@ -92,7 +92,7 @@ namespace CalamityMod.CalPlayer ApplyDoTDebuff(wDeath, 0); ApplyDoTDebuff(irradiated, 4, purity); - int sulphurDoT = 6 - (sulfurSet ? 2 : 0) - (sulphurskin ? 2 : 0); + int sulphurDoT = 6 - (sulphurSet ? 2 : 0) - (sulphurskin ? 2 : 0); ApplyDoTDebuff(sulphurPoison, sulphurDoT, purity); ApplyDoTDebuff(rTide, 6, purity); ApplyDoTDebuff(weakBrimstoneFlames, 7); @@ -103,7 +103,7 @@ namespace CalamityMod.CalPlayer ApplyDoTDebuff(bFlames, abaddon ? 10 : 30, purity); ApplyDoTDebuff(nightwither, reducedNightwitherDamage ? 20 : 40, purity); ApplyDoTDebuff(hFlames, reducedHolyFlamesDamage ? 20 : 40, purity); - ApplyDoTDebuff(vHex, 30); + ApplyDoTDebuff(vHex, 35); ApplyDoTDebuff(cDepth, 18, purity); ApplyDoTDebuff(astralInfection, 24, infectedJewel || purity); ApplyDoTDebuff(pFlames, 30, purity); @@ -111,7 +111,7 @@ namespace CalamityMod.CalPlayer ApplyDoTDebuff(shadowflame, 30, purity); // Profaned Soul Crystal turns you into Providence, a God, and you take more damage from God Slayer Inferno ApplyDoTDebuff(gsInferno, profanedCrystalBuffs ? 60 : 50); - ApplyDoTDebuff(dragonFire, 60); + ApplyDoTDebuff(dragonFire, dynamoStemCells ? 30 : 60); ApplyDoTDebuff(miracleBlight, 80); ApplyDoTDebuff(banishingFire, 60); @@ -123,7 +123,7 @@ namespace CalamityMod.CalPlayer if (Vector2.Distance(Player.Center.ToTileCoordinates().ToVector2(), closestSafeZone.ToVector2()) < SulphuricWaterSafeZoneSystem.NearbySafeTiles[closestSafeZone] * 17f) nearSafeZone = true; } - + float ASPoisonLevel = 0f; if (CalamityGlobalNPC.aquaticScourge >= 0 && Main.zenithWorld) { @@ -142,7 +142,7 @@ namespace CalamityMod.CalPlayer increment *= 4f + (8f * ASPoisonLevel); if (sulphurskin && !ASPoisoning) increment *= 0.5f; - if (sulfurSet && !ASPoisoning) + if (sulphurSet && !ASPoisoning) increment *= 0.5f; SulphWaterPoisoningLevel = MathHelper.Clamp(SulphWaterPoisoningLevel + increment, 0f, 1f); @@ -264,6 +264,7 @@ namespace CalamityMod.CalPlayer if (alcoholPoisonLevel > (cirrusDress ? 5 : 3)) { + // Independently of Calamity's nerfs to Nebula life regen, it is disabled entirely by alcohol poisoning. Player.nebulaLevelLife = 0; if (Player.whoAmI == Main.myPlayer) @@ -287,7 +288,7 @@ namespace CalamityMod.CalPlayer { Player.manaRegen = 0; Player.manaRegenBonus = 0; - Player.manaRegenDelay = (int) Player.maxRegenDelay; + Player.manaRegenDelay = (int)Player.maxRegenDelay; if (Player.lifeRegen > 0) Player.lifeRegen = 0; totalNegativeLifeRegen += 42; //the meaning of death @@ -422,7 +423,7 @@ namespace CalamityMod.CalPlayer { float missingLifeRatio = (Player.statLifeMax2 - Player.statLife) / Player.statLifeMax2; //Ambrosial Ampule and ooze give between 2 and 6 hp/s, Purity gives between 3 and 7 hp/s - float lifeRegenToGive = MathHelper.Lerp( purity ? 6f : 4f, purity ? 14f : 12f, missingLifeRatio); + float lifeRegenToGive = MathHelper.Lerp(purity ? 6f : 4f, purity ? 14f : 12f, missingLifeRatio); Player.lifeRegen += (int)lifeRegenToGive; } @@ -535,6 +536,8 @@ namespace CalamityMod.CalPlayer // 3. Air drowning in the Abyss // + // All forms of overtly disabling life regeneration disable Nebula Life boosters as well. + if (noLifeRegen) { Player.nebulaLevelLife = 0; @@ -646,7 +649,6 @@ namespace CalamityMod.CalPlayer if (trinketOfChi || chiRegen) Player.lifeRegen += 2; - if (ursaSergeant) { if (Player.statLife <= (int)(actualMaxLife * 0.15)) @@ -666,12 +668,6 @@ namespace CalamityMod.CalPlayer } } - if (polarisBoost) - { - Player.lifeRegen += 1; - Player.lifeRegenTime += 1; - } - if (evolutionLifeRegenCounter > 0) { Player.lifeRegenTime += 2; @@ -689,7 +685,7 @@ namespace CalamityMod.CalPlayer Player.lifeRegen += 2; if (Main.rand.NextBool()) { - int regen = Dust.NewDust(Player.position, Player.width, Player.height, 5, 0f, 0f, 200, new Color(99, 54, 84), 2f); + int regen = Dust.NewDust(Player.position, Player.width, Player.height, DustID.Blood, 0f, 0f, 200, new Color(99, 54, 84), 2f); Main.dust[regen].noGravity = true; Main.dust[regen].fadeIn = 1.3f; Vector2 velocity = CalamityUtils.RandomVelocity(100f, 50f, 100f, 0.04f); @@ -779,7 +775,7 @@ namespace CalamityMod.CalPlayer #region Standing Still Life Regen // Standing still healing bonuses (all are exclusive with vanilla Shiny Stone, but all function similarly) if (!Player.shinyStone && Player.StandingStill() && Player.velocity.Y == 0 && Player.itemAnimation == 0) - { + { bool honeyDewWorking = honeyTurboRegen && Player.honeyWet; bool anyStandingStillLifeRegen = shadeRegen || cFreeze || honeyDewWorking || photosynthesis || aAmpoule || purity; bool onlyPhotosynthesisAtNight = !shadeRegen && !cFreeze && !honeyDewWorking && photosynthesis && !Main.dayTime; @@ -787,7 +783,7 @@ namespace CalamityMod.CalPlayer // Divides all negative life regen by two before applying any other effects. if (anyStandingStillLifeRegen && Player.lifeRegen < 0) Player.lifeRegen /= 2; - + // Spawn dust of some flavor while actually regenerating, aAmpule and purity have a slightly different looking style if (Player.lifeRegen > 0 && Player.statLife < actualMaxLife) { @@ -838,7 +834,7 @@ namespace CalamityMod.CalPlayer if (Main.rand.Next(30000) < Player.lifeRegenTime || Main.rand.NextBool()) { - int regen = Dust.NewDust(Player.position, Player.width, Player.height, 12, 0f, 0f, 200, Color.OrangeRed, 1f); + int regen = Dust.NewDust(Player.position, Player.width, Player.height, DustID.HeartCrystal, 0f, 0f, 200, Color.OrangeRed, 1f); Main.dust[regen].noGravity = true; Main.dust[regen].fadeIn = 1.3f; Vector2 velocity = CalamityUtils.RandomVelocity(100f, 50f, 100f, 0.04f); diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 9338322a15..0dd1e07164 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -51,6 +51,7 @@ using CalamityMod.Projectiles.Summon; using CalamityMod.Projectiles.Typeless; using CalamityMod.Systems; using CalamityMod.Tiles.Abyss.AbyssAmbient; +using CalamityMod.Tiles.FurnitureAuric; using CalamityMod.Tiles.Ores; using CalamityMod.UI; using CalamityMod.World; @@ -282,7 +283,7 @@ namespace CalamityMod.CalPlayer Player.endurance += 0.1f; if (!HasReducedDashFirstFrame) // Dash isn't reduced, this is used to determine the first frame of dashing { - SoundEngine.PlaySound(SoundID.DD2_BetsyFireballImpact with { Volume = 0.4f , PitchVariance = 0.4f }, Player.Center); + SoundEngine.PlaySound(SoundID.DD2_BetsyFireballImpact with { Volume = 0.4f, PitchVariance = 0.4f }, Player.Center); int damage = Player.ApplyArmorAccDamageBonusesTo(Player.GetBestClassDamage().ApplyTo(67)); Projectile.NewProjectile(Player.GetSource_FromThis(), Player.Center + Player.velocity * 1.5f, Vector2.Zero, ModContent.ProjectileType(), damage, 16f, Player.whoAmI); @@ -293,15 +294,15 @@ namespace CalamityMod.CalPlayer for (int i = 0; i < numberOfDusts; i++) { float rot = MathHelper.ToRadians(i * rotFactor); - Vector2 offset = new Vector2(Player.velocity.X * Player.direction * 0.7f + 8f, 0).RotatedBy(rot * Main.rand.NextFloat(4f, 5f)); + Vector2 offset = new Vector2(MathF.Min(Player.velocity.X * Player.direction * 0.7f + 8f, 20f), 0).RotatedBy(rot * Main.rand.NextFloat(4f, 5f)); Vector2 velOffset = Vector2.Zero; Dust dust = Dust.NewDustPerfect(Player.Center + offset + Player.velocity, Main.rand.NextBool() ? 35 : 127, new Vector2(velOffset.X, velOffset.Y)); dust.noGravity = true; dust.velocity = velOffset; dust.alpha = 100; - dust.scale = (Player.velocity.X * Player.direction * 0.08f); + dust.scale = MathF.Min(Player.velocity.X * Player.direction * 0.08f, 1.2f); } - float sparkscale = (Player.velocity.X * Player.direction * 0.08f); + float sparkscale = MathF.Min(Player.velocity.X * Player.direction * 0.08f, 1.2f); Vector2 SparkVelocity1 = Player.velocity.RotatedBy(Player.direction * -3, default) * 0.1f - Player.velocity / 2f; SparkParticle spark = new SparkParticle(Player.Center + Player.velocity.RotatedBy(2f * Player.direction) * 1.5f, SparkVelocity1, false, Main.rand.Next(11, 13), sparkscale, Main.rand.NextBool() ? Color.DarkOrange : Color.OrangeRed); GeneralParticleHandler.SpawnParticle(spark); @@ -363,11 +364,6 @@ namespace CalamityMod.CalPlayer { if (CalamityWorld.revenge) { - // Adjusts the life steal cap in rev/death - float lifeStealCap = BossRushEvent.BossRushActive ? 30f : CalamityWorld.death ? 45f : 60f; - if (Player.lifeSteal > lifeStealCap) - Player.lifeSteal = lifeStealCap; - if (Player.whoAmI == Main.myPlayer) { // Hallowed Armor nerf @@ -459,7 +455,7 @@ namespace CalamityMod.CalPlayer for (int i = 0; i < Main.maxNPCs; ++i) { NPC npc = Main.npc[i]; - if (npc is null || npc.type == 0 || !npc.IsAnEnemy() || !npc.Calamity().ProvidesProximityRage) + if (npc is null || npc.type == NPCID.None || !npc.IsAnEnemy() || !npc.Calamity().ProvidesProximityRage) continue; // Take the longer of the two directions for the NPC's hitbox to be generous. @@ -555,7 +551,7 @@ namespace CalamityMod.CalPlayer #region Adrenaline // This is how much Adrenaline will be changed by this frame. float adrenalineDiff = 0; - bool wofAndNotHell = Main.wofNPCIndex >= 0 && Player.position.Y < (float)((Main.maxTilesY - 200) * 16); + bool wofAndNotHell = Main.wofNPCIndex >= 0 && Player.position.Y < (float)(Main.UnderworldLayer * 16); // If Adrenaline Mode is currently active, you smoothly lose all adrenaline over the duration. if (adrenalineModeActive) @@ -607,11 +603,11 @@ namespace CalamityMod.CalPlayer // Apply the adrenaline change and cap adrenaline in both directions. // Changes are only applied if the Adrenaline mechanic is available. - if (AdrenalineEnabled && nanomachinesLockoutTimer == 0) + if (AdrenalineEnabled && adrenalinePauseTimer == 0) { adrenaline += adrenalineDiff; - if (adrenaline < 0) - adrenaline = 0; + if (adrenaline < 0f) + adrenaline = 0f; if (adrenaline >= adrenalineMax) { @@ -628,8 +624,8 @@ namespace CalamityMod.CalPlayer playFullAdrenalineSound = true; } - if (nanomachinesLockoutTimer > 0) - nanomachinesLockoutTimer--; + if (adrenalinePauseTimer > 0) + adrenalinePauseTimer--; #endregion } #endregion @@ -639,6 +635,7 @@ namespace CalamityMod.CalPlayer { int astralOreID = ModContent.TileType(); int auricOreID = ModContent.TileType(); + int auricRepulserID = ModContent.TileType(); int scoriaOreID = ModContent.TileType(); int abyssKelpID = ModContent.TileType(); @@ -660,7 +657,7 @@ namespace CalamityMod.CalPlayer return; Dust dust; - dust = Main.dust[Dust.NewDust(Player.Center, 16, 16, 304, 0.23255825f, 10f, 0, new Color(117, 55, 15), 1.5116279f)]; + dust = Main.dust[Dust.NewDust(Player.Center, 16, 16, DustID.Firefly, 0.23255825f, 10f, 0, new Color(117, 55, 15), 1.5116279f)]; dust.noGravity = true; dust.noLight = true; dust.fadeIn = 2.5813954f; @@ -668,31 +665,37 @@ namespace CalamityMod.CalPlayer // Ores below here // Seraph Tracers give immunity to block contact effects - if (tracersSeraph) - return; + if (!tracersSeraph) + { + // Astral Ore inflicts Astral Infection briefly on contact + if (tile.TileType == astralOreID) + Player.AddBuff(ModContent.BuffType(), 2); - // Astral Ore inflicts Astral Infection briefly on contact - if (tile.TileType == astralOreID) - Player.AddBuff(ModContent.BuffType(), 2); - - // You will need to set each resistant item here for burning as it gets bypassed for somereason - if (tile.TileType == scoriaOreID && !Player.fireWalk) - Player.AddBuff(BuffID.Burning, 2); + // You will need to set each resistant item here for burning as it gets bypassed for somereason + if (tile.TileType == scoriaOreID && !Player.fireWalk) + Player.AddBuff(BuffID.Burning, 2); + } // Auric Ore causes an Auric Rejection unless you are wearing Auric Armor // Auric Rejection causes an electrical explosion that yeets the player a considerable distance - else if (tile.TileType == auricOreID && !auricSet) + if ((tile.TileType == auricOreID && !(auricSet || tracersSeraph)) || tile.TileType == auricRepulserID) { // Cut grappling hooks so the player is surely thrown Player.RemoveAllGrapplingHooks(); // Force Auric Ore to animate with its crackling electricity - AuricOre.Animate = true; + if (tile.TileType == auricOreID) + { + AuricOre.Animate = true; + } var yeetVec = Vector2.Normalize(Player.Center - touchedTile.ToWorldCoordinates()); Player.velocity += yeetVec * auricRejectionKB; - Player.Hurt(PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.AuricRejection").Format(Player.name)), auricRejectionDamage, 0); - Player.AddBuff(BuffID.Electrified, 300); + if (tile.TileType == auricOreID) + { + Player.Hurt(PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.AuricRejection").Format(Player.name)), auricRejectionDamage, 0); + Player.AddBuff(BuffID.Electrified, 300); + } SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/ExoMechs/TeslaShoot1")); } } @@ -742,7 +745,7 @@ namespace CalamityMod.CalPlayer // Make some fancy dust to indicate damage is being done. for (int j = 0; j < 12; j++) { - Dust fire = Dust.NewDustDirect(target.position, target.width, target.height, 267); + Dust fire = Dust.NewDustDirect(target.position, target.width, target.height, DustID.RainbowMk2); fire.velocity = Vector2.UnitY * -Main.rand.NextFloat(2f, 3.45f); fire.scale = 1f + fire.velocity.Length() / 6f; fire.color = Color.Lerp(Color.Orange, Color.Red, Main.rand.NextFloat(0.85f)); @@ -883,30 +886,37 @@ namespace CalamityMod.CalPlayer } } - // Life Steal nerf - // Reduces Normal Mode life steal recovery rate from 0.6/s to 0.5/s - // Reduces Expert Mode life steal recovery rate from 0.5/s to 0.35/s - // Revengeance Mode recovery rate is 0.3/s - // Death Mode recovery rate is 0.25/s - // Boss Rush recovery rate is 0.2/s - float lifeStealCooldown = BossRushEvent.BossRushActive ? 0.3f : CalamityWorld.death ? 0.25f : CalamityWorld.revenge ? 0.2f : Main.expertMode ? 0.15f : 0.1f; - Player.lifeSteal -= lifeStealCooldown; + // Life Steal nerf in difficulties above Expert + // Reduces the max possible life steal before the cooldown occurs (this mostly just nerfs how much life steal the player can get in bursts) + // Master Mode nerfs this by an additional 10 + float lifeStealCap = + CalamityWorld.death ? BalancingConstants.LifeStealCap_Death : + CalamityWorld.revenge ? BalancingConstants.LifeStealCap_Revengeance : + Main.expertMode ? BalancingConstants.LifeStealCap_Expert : + BalancingConstants.LifeStealCap_Classic; - // Nebula Armor nerf - if (Player.nebulaLevelMana > 0 && Player.statMana < Player.statManaMax2) - { - int num = 12; - nebulaManaNerfCounter += Player.nebulaLevelMana; - if (nebulaManaNerfCounter >= num) - { - nebulaManaNerfCounter -= num; - Player.statMana--; - if (Player.statMana < 0) - Player.statMana = 0; - } - } - else - nebulaManaNerfCounter = 0; + if (Main.masterMode) + lifeStealCap -= BalancingConstants.LifeStealCapReduction_Master; + + if (Player.lifeSteal > lifeStealCap) + Player.lifeSteal = lifeStealCap; + + // Normal Mode life steal recovery rate is 0.2/s + // Expert Mode life steal recovery rate is 0.15/s + // Revengeance Mode life steal recovery rate is 0.125/s + // Death Mode life steal recovery rate is 0.1/s + // Master Mode life steal recovery rate is nerfed by an additional 0.05/s + float lifeStealRecoveryRateReduction = + CalamityWorld.death ? BalancingConstants.LifeStealRecoveryRateReduction_Death : + CalamityWorld.revenge ? BalancingConstants.LifeStealRecoveryRateReduction_Revengeance : + Main.expertMode ? BalancingConstants.LifeStealRecoveryRateReduction_Expert : + BalancingConstants.LifeStealRecoveryRateReduction_Classic; + + if (Main.masterMode) + lifeStealRecoveryRateReduction += BalancingConstants.LifeStealRecoveryRateReduction_Master; + + if (Player.lifeSteal < lifeStealCap) + Player.lifeSteal -= lifeStealRecoveryRateReduction; // Bool for drawing boss health bar small text or not if (Main.myPlayer == Player.whoAmI) @@ -945,7 +955,7 @@ namespace CalamityMod.CalPlayer { if (!Main.rand.NextBool(3)) continue; - + Dust holyCinder = Dust.NewDustDirect(Player.position, Player.width, Player.height, (int)CalamityDusts.ProfanedFire); holyCinder.velocity = Main.rand.NextVector2Circular(3.5f, 3.5f); holyCinder.velocity.Y -= Main.rand.NextFloat(1f, 3f); @@ -981,14 +991,12 @@ namespace CalamityMod.CalPlayer if (Player.IsUnderwater()) { if (Main.myPlayer == Player.whoAmI) - { Player.AddBuff(ModContent.BuffType(), 2, false); - } } } if (iCantBreathe) { - if (Player.breath > 0) + if (Player.breath > 0 && Player.miscCounter % 2 == 0) Player.breath--; } } @@ -1017,7 +1025,7 @@ namespace CalamityMod.CalPlayer Vector2 spawnPoint = new Vector2(Player.Center.X + Main.rand.Next(-1000, 1001), Player.Center.Y - Main.rand.Next(700, 801)); if (Player.miscCounter % slimeRainRate == 0f) - { + { if (DownedBossSystem.downedAquaticScourge && !DownedBossSystem.downedPolterghast && Main.rand.NextBool(12)) { NPC.NewNPC(new EntitySource_SpawnNPC(), (int)spawnPoint.X, (int)spawnPoint.Y, ModContent.NPCType()); @@ -1111,7 +1119,7 @@ namespace CalamityMod.CalPlayer { Player.velocity.Y += Player.gravity * Player.gravDir * (BalancingConstants.HoldingDownGravityMultiplier - 1f); if (Player.Calamity().gSabaton) - { + { Player.maxFallSpeed *= 1.5f; } if (Player.velocity.Y * Player.gravDir > Player.maxFallSpeed) @@ -1121,7 +1129,7 @@ namespace CalamityMod.CalPlayer } else { - if (Player.mount.Type == MountID.Slime) + if (Player.mount.Type == MountID.Slime || Player.mount.Type == MountID.PogoStick) Player.velocity.X *= 0.91f; else if (Player.mount.Type == MountID.QueenSlime) Player.velocity.X *= 0.95f; @@ -1185,6 +1193,8 @@ namespace CalamityMod.CalPlayer { Player.statLife += 15; Player.HealEffect(15); + if (Player.statLife > Player.statLifeMax2) + Player.statLife = Player.statLifeMax2; if (profanedCrystal) { @@ -1211,7 +1221,7 @@ namespace CalamityMod.CalPlayer if (i % dustDivisor == 0) { currentDustPos = Vector2.Lerp(dustLineStart, dustLineEnd, i / (float)maxHealDustIterations); - int holyDust = Dust.NewDust(currentDustPos, 0, 0, 267, 0f, 0f, 0, dustColor, 1f); + int holyDust = Dust.NewDust(currentDustPos, 0, 0, DustID.RainbowMk2, 0f, 0f, 0, dustColor, 1f); Main.dust[holyDust].position = currentDustPos; Main.dust[holyDust].velocity = spinningpoint.RotatedBy(MathHelper.TwoPi * i / maxHealDustIterations) * healerDustVel * (0.8f + Main.rand.NextFloat() * 0.4f) + Player.velocity; Main.dust[holyDust].noGravity = true; @@ -1251,7 +1261,7 @@ namespace CalamityMod.CalPlayer } } - if (target > 0) + if (target > 0) { unstableSelectedTarget = Main.npc[target]; unstableSelectedTarget.Calamity().arcZapCooldown = 18; @@ -1352,8 +1362,6 @@ namespace CalamityMod.CalPlayer phantomicBulwarkCooldown--; if (KameiBladeUseDelay > 0) KameiBladeUseDelay--; - if (SpeedBlasterDashDelayCooldown > 0) - SpeedBlasterDashDelayCooldown--; if (galileoCooldown > 0) galileoCooldown--; if (dragonRageCooldown > 0) @@ -1376,8 +1384,6 @@ namespace CalamityMod.CalPlayer bloodflareMageCooldown--; if (silvaMageCooldown > 0) silvaMageCooldown--; - if (tarraMageHealCooldown > 0) - tarraMageHealCooldown--; if (scuttlerCooldown > 0) scuttlerCooldown--; if (rogueCrownCooldown > 0) @@ -1471,7 +1477,7 @@ namespace CalamityMod.CalPlayer auralisAurora--; if (auralisAuroraCooldown > 0) auralisAuroraCooldown--; - + if (blazingCore) { if (blazingCoreSuccessfulParry > 0) @@ -1483,7 +1489,7 @@ namespace CalamityMod.CalPlayer { FlameLickedShell.HandleParryCountdown(Player); } - + // Silver Armor "Medkit" effect if (silverMedkitTimer > 0) { @@ -1514,10 +1520,33 @@ namespace CalamityMod.CalPlayer ChlorophyteHealDelay--; if (monolithAccursedShader > 0) monolithAccursedShader--; + if (monolithBossRushShader > 0) + monolithBossRushShader--; + if (monolithExoShader > 0) + monolithExoShader--; + if (monolithLeviathanShader > 0) + monolithLeviathanShader--; + if (monolithCryogenShader > 0) + monolithCryogenShader--; + if (monolithDevourerBShader > 0) + monolithDevourerBShader--; + if (monolithDevourerPShader > 0) + monolithDevourerPShader--; + if (monolithYharonShader > 0) + monolithYharonShader--; + if (monolithPlagueShader > 0) + monolithPlagueShader--; + if (monolithAstralShader > 0) + monolithAstralShader--; + if (BrimstoneLavaFountainCounter > 0) + BrimstoneLavaFountainCounter--; + if (miningSetCooldown > 0) miningSetCooldown--; if (RustyMedallionCooldown > 0) RustyMedallionCooldown--; + if (MiniSwamerCooldown > 0) + MiniSwamerCooldown--; // God Slayer Armor dash debuff immunity if (DashID == GodSlayerDash.ID && Player.dashDelay < 0) @@ -1564,7 +1593,7 @@ namespace CalamityMod.CalPlayer int sparkCreationChance = (int)MathHelper.Lerp(15f, 50f, Utils.GetLerpValue(4f, 1f, auricDyeCount, true)); if (Main.rand.NextBool(sparkCreationChance)) { - Dust spark = Dust.NewDustDirect(Player.position, Player.width, Player.height, 267); + Dust spark = Dust.NewDustDirect(Player.position, Player.width, Player.height, DustID.RainbowMk2); spark.color = Color.Lerp(Color.Cyan, Color.SeaGreen, Main.rand.NextFloat(0.5f)); spark.velocity = -Vector2.UnitY.RotatedByRandom(MathHelper.PiOver2 * 1.33f) * Main.rand.NextFloat(2f, 5.4f); spark.noGravity = true; @@ -1602,7 +1631,7 @@ namespace CalamityMod.CalPlayer for (int j = 0; j < 2; j++) { - int green = Dust.NewDust(Player.position, Player.width, Player.height, 157, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 2f); + int green = Dust.NewDust(Player.position, Player.width, Player.height, DustID.ChlorophyteWeapon, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 2f); Main.dust[green].position.X += (float)Main.rand.Next(-20, 21); Main.dust[green].position.Y += (float)Main.rand.Next(-20, 21); Main.dust[green].velocity *= 0.9f; @@ -1632,8 +1661,7 @@ namespace CalamityMod.CalPlayer for (int j = 0; j < 2; j++) { - int green = Dust.NewDust(new Vector2(Player.position.X, Player.position.Y), Player.width, Player.height, 157, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 2f); - Dust dust = Main.dust[green]; + Dust dust = Dust.NewDustDirect(Player.position, Player.width, Player.height, DustID.ChlorophyteWeapon, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 2f); dust.position.X += (float)Main.rand.Next(-20, 21); dust.position.Y += (float)Main.rand.Next(-20, 21); dust.velocity *= 0.9f; @@ -1649,8 +1677,10 @@ namespace CalamityMod.CalPlayer if (tarraThrowing) { // The iframes from the evasion are disabled by dodge disabling effects. + // 17APR2024: Ozzatron: Tarragon Immunity is meant to be a full invulnerability effect, so universal iframes are granted throughout its duration. + // It has no interaction with Cross Necklace. if (tarragonImmunity && !disableAllDodges) - Player.GiveIFrames(2, true); + Player.GiveUniversalIFrames(2, true); if (tarraThrowingCrits >= 50) { @@ -1719,9 +1749,7 @@ namespace CalamityMod.CalPlayer // Raider Talisman bonus if (raiderTalisman && !StealthStrikeAvailable()) - { Player.GetCritChance() += raiderCritBonus; - } if (kamiBoost) Player.GetDamage() += 0.15f; @@ -1729,6 +1757,10 @@ namespace CalamityMod.CalPlayer if (avertorBonus) Player.GetDamage() += 0.1f; + // Reduce Ichor debuff defense reduction from -15 to -10 + if (Player.ichor) + Player.statDefense += 5; + // Fairy Boots bonus if (fairyBoots) { @@ -1803,7 +1835,7 @@ namespace CalamityMod.CalPlayer Player.velocity.X = 0f; Player.velocity.Y = -0.4f; // Should negate gravity - int ice = Dust.NewDust(Player.position, Player.width, Player.height, 88); + int ice = Dust.NewDust(Player.position, Player.width, Player.height, DustID.GemSapphire); Main.dust[ice].noGravity = true; Main.dust[ice].velocity *= 2f; @@ -1844,24 +1876,24 @@ namespace CalamityMod.CalPlayer Player.GetCritChance() -= (int)((1f - Player.stealth) * 5f); // Change 20 to 15 } - // Polaris fish stuff - if (!polarisBoost || Player.ActiveItem().type != ModContent.ItemType()) + // Haste buff + if (hasteLevel > 0) { - polarisBoost = false; - if (Player.FindBuffIndex(ModContent.BuffType()) > -1) - Player.ClearBuff(ModContent.BuffType()); - - polarisBoostCounter = 0; - polarisBoostTwo = false; - polarisBoostThree = false; + // capped out at 3 + if (hasteLevel > 3) + hasteLevel = 3; + // if the haste counter hits 5 seconds, subtract a haste level, and if there are none left afterwards, delete the buff + if (++hasteCounter == 300) + { + hasteLevel--; + if (hasteLevel <= 0) + { + if (Player.FindBuffIndex(ModContent.BuffType()) > -1) + Player.ClearBuff(ModContent.BuffType()); + } + hasteCounter = 0; + } } - if (polarisBoostCounter >= 20) - { - polarisBoostTwo = false; - polarisBoostThree = true; - } - else if (polarisBoostCounter >= 10) - polarisBoostTwo = true; // Calcium Potion buff if (calcium) @@ -1934,7 +1966,7 @@ namespace CalamityMod.CalPlayer if (blunderBooster) { - int lightningCount = Main.rand.Next(5,7); + int lightningCount = Main.rand.Next(5, 7); var source = Player.GetSource_Accessory(FindAccessory(ModContent.ItemType())); for (int i = 0; i < lightningCount; i++) { @@ -1952,7 +1984,7 @@ namespace CalamityMod.CalPlayer for (int i = 0; i < 3; i++) { - int dust = Dust.NewDust(Player.Center, 1, 1, 60, Player.velocity.X * -0.1f, Player.velocity.Y * -0.1f, 100, default, 3.5f); + int dust = Dust.NewDust(Player.Center, 1, 1, DustID.RedTorch, Player.velocity.X * -0.1f, Player.velocity.Y * -0.1f, 100, default, 3.5f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 1.2f; Main.dust[dust].velocity.Y -= 0.15f; @@ -1978,7 +2010,7 @@ namespace CalamityMod.CalPlayer for (int i = 0; i < 3; i++) { - int dust = Dust.NewDust(Player.Center, 1, 1, 89, Player.velocity.X * -0.1f, Player.velocity.Y * -0.1f, 100, default, 3.5f); + int dust = Dust.NewDust(Player.Center, 1, 1, DustID.GemEmerald, Player.velocity.X * -0.1f, Player.velocity.Y * -0.1f, 100, default, 3.5f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 1.2f; Main.dust[dust].velocity.Y -= 0.15f; @@ -2376,7 +2408,7 @@ namespace CalamityMod.CalPlayer Player.moveSpeed -= (1f - aquaticBoost * 0.0001f) * 0.1f; } else - aquaticBoost = aquaticBoostMax;modStealth = 1f; + aquaticBoost = aquaticBoostMax; modStealth = 1f; if (Player.ActiveItem().type == ModContent.ItemType() && Player.StandingStill(0.1f)) { @@ -2433,7 +2465,7 @@ namespace CalamityMod.CalPlayer Vector2 source = Vector2.Normalize(Player.velocity) * new Vector2((float)Player.width / 2f, (float)Player.height) * 1f; //0.75 source = source.RotatedBy((double)((float)(d - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + Player.Center; Vector2 dustVel = source - Player.Center; - int blue = Dust.NewDust(source + dustVel, 0, 0, 229, dustVel.X, dustVel.Y, 100, default, 1.2f); + int blue = Dust.NewDust(source + dustVel, 0, 0, DustID.Vortex, dustVel.X, dustVel.Y, 100, default, 1.2f); Main.dust[blue].noGravity = true; Main.dust[blue].noLight = false; Main.dust[blue].velocity = dustVel; @@ -2443,7 +2475,7 @@ namespace CalamityMod.CalPlayer Vector2 source = Vector2.Normalize(Player.velocity) * new Vector2((float)Player.width / 2f, (float)Player.height) * 0.75f; source = source.RotatedBy((double)((float)(d - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + Player.Center; Vector2 dustVel = source - Player.Center; - int green = Dust.NewDust(source + dustVel, 0, 0, 107, dustVel.X, dustVel.Y, 100, default, 1.2f); + int green = Dust.NewDust(source + dustVel, 0, 0, DustID.TerraBlade, dustVel.X, dustVel.Y, 100, default, 1.2f); Main.dust[green].noGravity = true; Main.dust[green].noLight = false; Main.dust[green].velocity = dustVel; @@ -2480,7 +2512,7 @@ namespace CalamityMod.CalPlayer if (decayEffigy) { Player.buffImmune[ModContent.BuffType()] = true; - if (!ZoneAbyss) + if (!ZoneAbyss && Player.IsUnderwater()) { Player.gills = true; } @@ -2507,7 +2539,7 @@ namespace CalamityMod.CalPlayer if (rRage) { - Player.GetDamage() += 0.3f; + Player.GetDamage() += 0.1f; Player.statDefense += 5; } @@ -2526,8 +2558,7 @@ namespace CalamityMod.CalPlayer if (brutalCarnage) { - Player.GetDamage() += 0.25f; - Player.GetCritChance() += 10; + Player.GetDamage() += 0.2f; } // Trinket of Chi bonus @@ -2564,10 +2595,8 @@ namespace CalamityMod.CalPlayer if (aeroStone && !Player.slowFall && Player.wingTime < Player.wingTimeMax) { - if (!Player.controlJump && Player.miscCounter % 5 == 0) - { + if (!Player.controlJump && Player.miscCounter % 4 == 0) Player.wingTime += 1; - } } if (gShell) @@ -2577,7 +2606,7 @@ namespace CalamityMod.CalPlayer if (giantShellPostHit > 0) { - Player.statDefense -= 5; + Player.statDefense -= 3; giantShellPostHit--; } if (giantShellPostHit < 0) @@ -2629,6 +2658,8 @@ namespace CalamityMod.CalPlayer { Player.statLife += 1; Player.HealEffect(1, false); + if (Player.statLife > Player.statLifeMax2) + Player.statLife = Player.statLifeMax2; // Produce an implosion of blood themed dust so it's obvious an effect is occurring for (int i = 0; i < 3; ++i) @@ -2636,7 +2667,7 @@ namespace CalamityMod.CalPlayer Vector2 offset = Main.rand.NextVector2Unit() * Main.rand.NextFloat(23f, 33f); Vector2 dustPos = Player.Center + offset; Vector2 dustVel = offset * -0.08f; - Dust d = Dust.NewDustDirect(dustPos, 0, 0, 90, 0.08f, 0.08f); + Dust d = Dust.NewDustDirect(dustPos, 0, 0, DustID.GemRuby, 0.08f, 0.08f); d.velocity = dustVel; d.noGravity = true; } @@ -2650,6 +2681,11 @@ namespace CalamityMod.CalPlayer if (CalamityMod.Instance.overhaul is null && CalamityConfig.Instance.FasterBaseSpeed) Player.moveSpeed += BalancingConstants.DefaultMoveSpeedBoost; + // Reduce how slow Chilled makes the player, because it's cancerous right now + // The moveSpeed multiplier for Chilled in vanilla is 0.75, so we just multiply by 1.166667 here to make it 0.875, effectively cutting the reduction in half + if (Player.chilled) + Player.moveSpeed *= 1f + (1f / 6f); + if (cirrusDress) Player.moveSpeed -= 0.2f; @@ -2759,9 +2795,6 @@ namespace CalamityMod.CalPlayer } } - if (CalamityLists.scopedWeaponList.Contains(Player.ActiveItem().type)) - Player.scope = true; - if (CalamityLists.highTestFishList.Contains(Player.ActiveItem().type)) Player.accFishingLine = true; @@ -2827,7 +2860,7 @@ namespace CalamityMod.CalPlayer // Reaver Tank set nuke flight time if (reaverDefense) - flightTimeMult -= 0.2f; + flightTimeMult -= 0.3f; // Increase wing time if (Player.wingTimeMax > 0) @@ -2835,7 +2868,6 @@ namespace CalamityMod.CalPlayer if (vHex) { - Player.blind = true; Player.statDefense -= 20; if (Player.wingTimeMax < 0) @@ -2951,9 +2983,9 @@ namespace CalamityMod.CalPlayer // The player's true max life value with Calamity adjustments actualMaxLife = Player.statLifeMax2; - if (thirdSageH && !Player.dead && healToFull) + if (!Player.dead && healToFull) { - thirdSageH = false; + healToFull = false; Player.statLife = actualMaxLife; } @@ -2985,9 +3017,9 @@ namespace CalamityMod.CalPlayer Player.buffImmune[BuffID.Chilled] = true; Player.buffImmune[BuffID.Frozen] = true; - if (Player.statLife > (int)(Player.statLifeMax2 * 0.75)) + if (Player.statLife > (int)(Player.statLifeMax2 * 0.5)) Player.GetDamage() += 0.1f; - if (Player.statLife < (int)(Player.statLifeMax2 * 0.25)) + if (Player.statLife <= (int)(Player.statLifeMax2 * 0.5)) Player.statDefense += 20; } @@ -3071,13 +3103,6 @@ namespace CalamityMod.CalPlayer } } - if (deepDiver && Player.IsUnderwater()) - { - Player.GetDamage() += 0.15f; - Player.statDefense += 15; - Player.moveSpeed += 0.15f; - } - if (abyssalDivingSuit && !Player.IsUnderwater()) { float moveSpeedLoss = (3 - abyssalDivingSuitPlateHits) * 0.2f; @@ -3118,7 +3143,7 @@ namespace CalamityMod.CalPlayer for (int i = 0; i < Main.maxNPCs; ++i) { NPC npc = Main.npc[i]; - if (!npc.active || npc.friendly || npc.damage <= 0 || npc.dontTakeDamage) + if (!npc.active || npc.friendly || npc.dontTakeDamage) continue; if (Vector2.Distance(Player.Center, npc.Center) <= range) @@ -3254,7 +3279,7 @@ namespace CalamityMod.CalPlayer var babH = Projectile.NewProjectileDirect(source, Player.Center, Vector2.UnitY * -6f, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, babCheck); babH.originalDamage = babDamage; } - + if (Player.ownedProjectileCounts[ModContent.ProjectileType()] < guardianAmt) { @@ -3303,7 +3328,7 @@ namespace CalamityMod.CalPlayer bool enrage = pscState >= (int)ProfanedSoulCrystal.ProfanedSoulCrystalState.Enraged; if (!ZoneAbyss) //No abyss memes. Lighting.AddLight(Player.Center, enrage ? 1.2f : offenseBuffs ? 1f : 0.2f, enrage ? 0.21f : offenseBuffs ? 0.2f : 0.01f, 0); - + } } @@ -3372,19 +3397,40 @@ namespace CalamityMod.CalPlayer if (Player.whoAmI == Main.myPlayer) { // Reduce the buffTime of Electrified. + bool reduceElectrifiedDuration = false; for (int l = 0; l < Player.MaxBuffs; l++) { - bool electrified = Player.buffType[l] == BuffID.Electrified; - if (Player.buffTime[l] > 2 && electrified) - Player.buffTime[l]--; + if (Player.buffType[l] == ModContent.BuffType()) + { + if (Player.buffTime[l] >= 5) + reduceElectrifiedDuration = true; + } } - // Summon the aura. - // https://github.com/tModLoader/tModLoader/wiki/IEntitySource#detailed-list - var source = Player.GetSource_Buff(Player.FindBuffIndex(ModContent.BuffType())); - int damage = (int)Player.GetBestClassDamage().ApplyTo(10); - if (Player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) - Projectile.NewProjectile(source, Player.Center, Vector2.Zero, ModContent.ProjectileType(), damage, 0f, Player.whoAmI); + if (reduceElectrifiedDuration) + { + for (int l = 0; l < Player.MaxBuffs; l++) + { + if (Player.buffType[l] == BuffID.Electrified) + { + if (Player.buffTime[l] > 2) + { + Player.buffTime[l]--; + break; + } + } + } + } + + // Summon the aura (this check is here to prevent out of bounds errors). + if (reduceElectrifiedDuration) + { + // https://github.com/tModLoader/tModLoader/wiki/IEntitySource#detailed-list + var source = Player.GetSource_Buff(Player.FindBuffIndex(ModContent.BuffType())); + int damage = (int)Player.GetBestClassDamage().ApplyTo(10); + if (Player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) + Projectile.NewProjectile(source, Player.Center, Vector2.Zero, ModContent.ProjectileType(), damage, 0f, Player.whoAmI); + } } } else if (Player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) @@ -3509,7 +3555,7 @@ namespace CalamityMod.CalPlayer Vector2 source = Vector2.Normalize(Player.velocity) * new Vector2(Player.width / 2f, Player.height) * 0.75f; source = source.RotatedBy((dustIndex - (dustAmt / 2 - 1)) * MathHelper.TwoPi / dustAmt, default) + Player.Center; Vector2 dustVel = source - Player.Center; - int dusty = Dust.NewDust(source + dustVel, 0, 0, 267, dustVel.X * 1f, dustVel.Y * 1f, 100, color, 1f); + int dusty = Dust.NewDust(source + dustVel, 0, 0, DustID.RainbowMk2, dustVel.X * 1f, dustVel.Y * 1f, 100, color, 1f); Main.dust[dusty].noGravity = true; Main.dust[dusty].noLight = true; Main.dust[dusty].velocity = dustVel; @@ -3655,7 +3701,7 @@ namespace CalamityMod.CalPlayer int numDust = 2; for (int i = 0; i < numDust; i++) { - int dustIndex = Dust.NewDust(Player.position, Player.width, Player.height, 21, 0f, 0f); + int dustIndex = Dust.NewDust(Player.position, Player.width, Player.height, DustID.VilePowder, 0f, 0f); Dust dust = Main.dust[dustIndex]; dust.position.X += Main.rand.Next(-5, 6); dust.position.Y += Main.rand.Next(-5, 6); @@ -3738,7 +3784,7 @@ namespace CalamityMod.CalPlayer { if (cooldowns.TryGetValue(Cooldowns.ProfanedSoulShield.ID, out var cdDurability)) cdDurability.timeLeft = 0; - + // As PSA/PSC's shield can be left in a partially recharged state, this is for safety. // If the player does not have the accessory equipped for even one frame, discharge all shields. pSoulShieldDurability = 0; @@ -3757,17 +3803,17 @@ namespace CalamityMod.CalPlayer int totalRecharge = profanedCrystalBuffs ? ProfanedSoulCrystal.TotalShieldRechargeTime : ProfanedSoulArtifact.TotalShieldRechargeTime; - + if (pSoulShieldDurability == 0 && !cooldowns.ContainsKey(Cooldowns.ProfanedSoulShieldRecharge.ID)) Player.AddCooldown(ProfanedSoulShieldRecharge.ID, delay); - + // If the shield has greater than zero durability but that durability is not on the cooldown rack, add it to the cooldown rack. if (pSoulShieldDurability > 0 && !cooldowns.ContainsKey(Cooldowns.ProfanedSoulShield.ID)) { var durabilityCooldown = Player.AddCooldown(Cooldowns.ProfanedSoulShield.ID, maxDurability); durabilityCooldown.timeLeft = pSoulShieldDurability; } - + // If the shield has greater than zero durability and isn't in its recharge delay, actively replenish shield points. // Play a sound on the first frame this occurs. if (pSoulShieldDurability > 0 && !cooldowns.ContainsKey(ProfanedSoulShieldRecharge.ID)) @@ -3781,7 +3827,7 @@ namespace CalamityMod.CalPlayer // Floor the value to get whole number of shield points recharged this frame. int pointsActuallyRecharged = (int)MathF.Floor(pSoulShieldPartialRechargeProgress); - + // Give those points to the real shield durability, capping the result. Then remove them from recharge progress. pSoulShieldDurability = Math.Min(pSoulShieldDurability + pointsActuallyRecharged, maxDurability); pSoulShieldPartialRechargeProgress -= pointsActuallyRecharged; @@ -3906,62 +3952,51 @@ namespace CalamityMod.CalPlayer // Defense damage does not heal during iframes, and has a delay after they end before it starts recovering. if (totalDefenseDamage > 0) { - // If a Full Cleanse is in effect, then cleanse all defense damage and don't do anything else. - if (CleansingEffect == 1) - { - totalDefenseDamage = 0; - defenseDamageRecoveryFrames = 0; - totalDefenseDamageRecoveryFrames = DefenseDamageBaseRecoveryTime; - defenseDamageDelayFrames = 0; - CleansingEffect = 0; - } - else - { - // Defense damage is capped at your maximum defense, except in GFB. - if (!Main.getGoodWorld && totalDefenseDamage > Player.statDefense) - totalDefenseDamage = Player.statDefense; + // Defense damage is capped at your maximum defense, except in GFB. + if (!Main.getGoodWorld && totalDefenseDamage > Player.statDefense) + totalDefenseDamage = Player.statDefense; - // You cannot begin recovering from defense damage until your iframes wear off. - if (!Player.HasIFrames()) + // You cannot begin recovering from defense damage until your iframes wear off. + if (!Player.HasIFrames()) + { + // Delay before defense damage recovery can start. While this delay is ticking down, defense damage doesn't recover at all. + if (defenseDamageDelayFrames > 0) + --defenseDamageDelayFrames; + + // Once the delay is up, defense damage recovery actually occurs. + else if (defenseDamageDelayFrames <= 0) { - // Delay before defense damage recovery can start. While this delay is ticking down, defense damage doesn't recover at all. - if (defenseDamageDelayFrames > 0) - --defenseDamageDelayFrames; + // Make one frame's worth of progress towards recovery. + --defenseDamageRecoveryFrames; - // Once the delay is up, defense damage recovery actually occurs. - else if (defenseDamageDelayFrames <= 0) + // If completely recovered, reset defense damage to nothing. + if (defenseDamageRecoveryFrames <= 0) { - // Make one frame's worth of progress towards recovery. - --defenseDamageRecoveryFrames; - - // If completely recovered, reset defense damage to nothing. - if (defenseDamageRecoveryFrames <= 0) - { - totalDefenseDamage = 0; - defenseDamageRecoveryFrames = 0; - totalDefenseDamageRecoveryFrames = DefenseDamageBaseRecoveryTime; - defenseDamageDelayFrames = 0; - } + totalDefenseDamage = 0; + defenseDamageRecoveryFrames = 0; + totalDefenseDamageRecoveryFrames = DefenseDamageBaseRecoveryTime; + defenseDamageDelayFrames = 0; } } - - // Get current amount of defense damage to apply this frame. - int currentDefenseDamage = CurrentDefenseDamage; - - // Apply DR Damage. - // - // DR Damage is applied at exactly the same ratio as defense damage; - // if you lose half your defense to defense damage, you also lose half your DR. - // This is applied first because the math would be wrong if the player's defense was already reduced by defense damage. - if (Player.statDefense > 0 && Player.endurance > 0f) - { - float drDamageRatio = currentDefenseDamage / (float)Player.statDefense; - Player.endurance *= 1f - drDamageRatio; - } - - // Apply defense damage - Player.statDefense -= currentDefenseDamage; } + + // Get current amount of defense damage to apply this frame. + int currentDefenseDamage = CurrentDefenseDamage; + + // Apply DR Damage. + // + // DR Damage is applied at exactly the same ratio as defense damage; + // if you lose half your defense to defense damage, you also lose half your DR. + // This is applied first because the math would be wrong if the player's defense was already reduced by defense damage. + if (Player.statDefense > 0 && Player.endurance > 0f) + { + float drDamageRatio = currentDefenseDamage / (float)Player.statDefense; + Player.endurance *= 1f - drDamageRatio; + } + + // Apply defense damage + Player.statDefense -= currentDefenseDamage; + } // Defense can never be reduced below zero, no matter what @@ -3973,7 +4008,7 @@ namespace CalamityMod.CalPlayer if (fabsolVodka) { if (Player.statDefense > 0) - Player.statDefense -= (int)(Player.statDefense * 0.1); + Player.statDefense -= (int)(Player.statDefense * 0.05); } if (vodka) @@ -4118,10 +4153,9 @@ namespace CalamityMod.CalPlayer CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.Misc.WikiStatus1"); CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.Misc.WikiStatus2"); } - if (CalamityMod.Instance.musicMod is null && CalamityConfig.Instance.MusicModReminderMessage) - { - CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.Misc.MusicModReminder"); - } + + // 04JAN2024: Ozzatron: Plushie message always appears. + CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.Misc.GimmeSwagPlushieCampaign"); } --startMessageDisplayDelay; @@ -4186,10 +4220,21 @@ namespace CalamityMod.CalPlayer for (int i = 0; i < Main.maxNPCs; i++) { NPC npc = Main.npc[i]; - if (npc is null || !npc.active) - return; + if (npc is null || !npc.active || npc.type != ModContent.NPCType()) + continue; bool holdingsol = ((Player.HeldItem.type >= ItemID.GreenSolution && Player.HeldItem.type <= ItemID.RedSolution) || (Player.HeldItem.type >= ItemID.SandSolution && Player.HeldItem.type <= ItemID.DirtSolution) || Player.HeldItem.type == ModContent.ItemType()); + int heldType = -1; + for (int e = 0; e < AndroombaFriendly.customConversionTypes.Count; e++) + { + var entry = AndroombaFriendly.customConversionTypes[e]; + if (Player.HeldItem.type == entry.Item1) + { + holdingsol = true; + heldType = e; + break; + } + } if (npc.Hitbox.Contains(Main.MouseWorld.ToPoint()) && holdingsol && Player.Distance(npc.Center) < 450) { Player.cursorItemIconEnabled = true; @@ -4234,6 +4279,9 @@ namespace CalamityMod.CalPlayer case ItemID.DirtSolution: soltype = 7; break; + default: + soltype = heldType + 9; + break; } } if (npc.ai[3] != soltype || npc.ai[0] == 0) diff --git a/CalPlayer/CalamityPlayerNetcode.cs b/CalPlayer/CalamityPlayerNetcode.cs index c4cc862875..16df37c22c 100644 --- a/CalPlayer/CalamityPlayerNetcode.cs +++ b/CalPlayer/CalamityPlayerNetcode.cs @@ -1,6 +1,6 @@ -using CalamityMod.Cooldowns; -using System.Collections.Generic; +using System.Collections.Generic; using System.IO; +using CalamityMod.Cooldowns; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/CalPlayer/CalamityPlayerOnHit.cs b/CalPlayer/CalamityPlayerOnHit.cs index a6e99b607d..a2d6e81a56 100644 --- a/CalPlayer/CalamityPlayerOnHit.cs +++ b/CalPlayer/CalamityPlayerOnHit.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.Linq; using CalamityMod.Balancing; using CalamityMod.Buffs.DamageOverTime; @@ -15,6 +16,7 @@ using CalamityMod.Items.VanillaArmorChanges; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.NPCs; using CalamityMod.NPCs.NormalNPCs; +using CalamityMod.Particles; using CalamityMod.Projectiles; using CalamityMod.Projectiles.Healing; using CalamityMod.Projectiles.Magic; @@ -23,6 +25,7 @@ using CalamityMod.Projectiles.Ranged; using CalamityMod.Projectiles.Rogue; using CalamityMod.Projectiles.Summon; using CalamityMod.Projectiles.Typeless; +using CalamityMod.Systems; using Microsoft.Xna.Framework; using MonoMod.Cil; using Terraria; @@ -66,7 +69,7 @@ namespace CalamityMod.CalPlayer if (flamingItemEnchant) target.AddBuff(BuffType(), VulnerabilityHex.AflameDuration); - + target.Calamity().IncreasedColdEffects_EskimoSet = eskimoSet; target.Calamity().IncreasedColdEffects_CryoStone = CryoStone; @@ -74,6 +77,7 @@ namespace CalamityMod.CalPlayer target.Calamity().IncreasedHeatEffects_Fireball = fireball; target.Calamity().IncreasedHeatEffects_CinnamonRoll = cinnamonRoll; + target.Calamity().IncreasedHeatEffects_FlameWakerBoots = flameWakerBoots; target.Calamity().IncreasedHeatEffects_HellfireTreads = hellfireTreads; target.Calamity().IncreasedSicknessEffects_ToxicHeart = toxicHeart; @@ -84,16 +88,18 @@ namespace CalamityMod.CalPlayer { case ItemID.CobaltSword: target.Calamity().miscDefenseLoss = (int)(target.defense * 0.25); + target.Calamity().isNerfedByCobalt = true; break; case ItemID.PalladiumSword: - if (!target.canGhostHeal || Player.moonLeech) + if (Player.moonLeech) return; Player.lifeRegenTime += 2; break; case ItemID.MythrilSword: target.damage = (int)(target.defDamage * 0.9); + target.Calamity().isNerfedByMythril = true; break; case ItemID.OrichalcumSword: @@ -109,10 +115,17 @@ namespace CalamityMod.CalPlayer break; case ItemID.CandyCaneSword: - if (!target.canGhostHeal || Player.moonLeech) + + if (Player.moonLeech || Player.lifeSteal <= 0f || target.lifeMax <= 5) return; - Player.statLife += 2; - Player.HealEffect(2); + + int heal = 2; + Player.lifeSteal -= heal; + Player.statLife += heal; + Player.HealEffect(heal); + if (Player.statLife > Player.statLifeMax2) + Player.statLife = Player.statLifeMax2; + break; case ItemID.DeathSickle: @@ -120,9 +133,14 @@ namespace CalamityMod.CalPlayer break; case ItemID.BeeKeeper: + case ItemID.BladeofGrass: target.AddBuff(BuffID.Poisoned, 240); break; + case ItemID.FieryGreatsword: + target.AddBuff(BuffID.OnFire3, 180); + break; + case ItemID.IceSickle: case ItemID.Frostbrand: target.AddBuff(BuffID.Frostburn2, 300); @@ -138,6 +156,9 @@ namespace CalamityMod.CalPlayer break; } + if (flameWakerBoots) + target.AddBuff(BuffID.OnFire, 120); + if (hellfireTreads) { if (Main.rand.NextBool(4)) @@ -155,6 +176,7 @@ namespace CalamityMod.CalPlayer // Shattered Community tracks all damage dealt with Rage Mode (ignoring dummies). if (target.type == NPCID.TargetDummy || target.type == NPCType()) return; + if (rageModeActive && shatteredCommunity) Player.GetModPlayer().AccumulateRageDamage(damageDone); } @@ -187,7 +209,7 @@ namespace CalamityMod.CalPlayer cgn.IncreasedColdEffects_CryoStone = CryoStone; cgn.IncreasedElectricityEffects_Transformer = transformer; - + cgn.IncreasedHeatEffects_Fireball = fireball; cgn.IncreasedHeatEffects_CinnamonRoll = cinnamonRoll; cgn.IncreasedHeatEffects_HellfireTreads = hellfireTreads; @@ -200,16 +222,18 @@ namespace CalamityMod.CalPlayer { case ProjectileID.CobaltNaginata: target.Calamity().miscDefenseLoss = (int)(target.defense * 0.25); + target.Calamity().isNerfedByCobalt = true; break; case ProjectileID.PalladiumPike: - if (!target.canGhostHeal || Player.moonLeech) + if (Player.moonLeech) return; Player.lifeRegenTime += 2; break; case ProjectileID.MythrilHalberd: target.damage = (int)(target.defDamage * 0.9); + target.Calamity().isNerfedByMythril = true; break; case ProjectileID.OrichalcumHalberd: @@ -225,10 +249,17 @@ namespace CalamityMod.CalPlayer break; case ProjectileID.FruitcakeChakram: - if (!target.canGhostHeal || Player.moonLeech) + + if (Player.moonLeech || Main.player[Main.myPlayer].lifeSteal <= 0f || target.lifeMax <= 5) return; - Player.statLife += 2; - Player.HealEffect(2); + + int heal = 2; + Main.player[Main.myPlayer].lifeSteal -= heal; + Player.statLife += heal; + Player.HealEffect(heal); + if (Player.statLife > Player.statLifeMax2) + Player.statLife = Player.statLifeMax2; + break; case ProjectileID.ObsidianSwordfish: @@ -245,6 +276,7 @@ namespace CalamityMod.CalPlayer case ProjectileID.Bee: case ProjectileID.GiantBee: + case ProjectileID.BladeOfGrass: target.AddBuff(BuffID.Poisoned, 120); break; @@ -277,6 +309,9 @@ namespace CalamityMod.CalPlayer break; } + if (flameWakerBoots) + target.AddBuff(BuffID.OnFire, 120); + if ((proj.arrow && Player.hasMoltenQuiver) || hellfireTreads) { if (Main.rand.NextBool(4)) @@ -301,6 +336,167 @@ namespace CalamityMod.CalPlayer cgn.somaShredApplicator = Player.whoAmI; } + // Similarly, all shots from Animosity are also marked + if (cgp.brimstoneBullets) + { + target.AddBuff(BuffType(), 90); + + // Music easter egg in GFB + if (Main.zenithWorld) + GungeonMusicSystem.GUN(); + } + + if (cgp.fireBullet) + { + target.AddBuff(BuffID.OnFire3, 60); + if (proj.numHits == 0) + { + for (int i = 0; i < 3; i++) + { + CritSpark spark = new CritSpark(proj.Center, proj.velocity.RotatedByRandom(0.4) * Main.rand.NextFloat(0.8f, 1.5f), Main.rand.NextBool() ? Color.Orange : Color.OrangeRed, Color.Yellow, Main.rand.NextFloat(0.4f, 0.6f), 15, Main.rand.NextFloat(-2f, 2f), 1.5f); + GeneralParticleHandler.SpawnParticle(spark); + } + SoundEngine.PlaySound(SoundID.DD2_BetsyFireballImpact with { Volume = 0.3f, Pitch = 1f }, proj.Center); + } + } + + if (cgp.iceBullet) + { + target.AddBuff(BuffID.Frostburn2, 60); + if (proj.numHits == 0) + { + for (int i = 0; i < 3; i++) + { + CritSpark spark = new CritSpark(proj.Center, proj.velocity.RotatedByRandom(0.4) * Main.rand.NextFloat(0.8f, 1.5f), Main.rand.NextBool() ? Color.DeepSkyBlue : Color.LightSkyBlue, Color.White, Main.rand.NextFloat(0.4f, 0.6f), 15, Main.rand.NextFloat(-2f, 2f), 1.5f); + GeneralParticleHandler.SpawnParticle(spark); + } + SoundEngine.PlaySound(SoundID.Item27 with { Volume = 0.3f, Pitch = 0.8f }, proj.Center); + } + } + + if (cgp.shockBullet) + { + target.AddBuff(BuffID.Electrified, 180); + + if (proj.numHits == 0) + { + CustomPulse spark = new CustomPulse(proj.Center, Vector2.Zero, Color.Turquoise, "CalamityMod/Particles/PlasmaExplosion", new Vector2(1, 1), Main.rand.NextFloat(-2f, 2f), 0.005f, Main.rand.NextFloat(0.048f, 0.055f), 14); + GeneralParticleHandler.SpawnParticle(spark); + int points = 6; + float radians = MathHelper.TwoPi / points; + Vector2 spinningPoint = Vector2.Normalize(new Vector2(-1f, -1f)); + float rotRando = Main.rand.NextFloat(0.1f, 2.5f); + for (int k = 0; k < points; k++) + { + Vector2 velocity = spinningPoint.RotatedBy(radians * k).RotatedBy(-0.45f * rotRando); + SparkParticle subTrail = new SparkParticle(proj.Center + velocity * 4.5f, velocity * 8, false, 13, 0.85f, Color.Turquoise); + GeneralParticleHandler.SpawnParticle(subTrail); + } + for (int i = 0; i <= 12; i++) + { + Dust dust2 = Dust.NewDustPerfect(proj.Center, 278, new Vector2(4, 4).RotatedByRandom(100f) * Main.rand.NextFloat(0.1f, 2.9f)); + dust2.noGravity = false; + dust2.scale = Main.rand.NextFloat(0.3f, 0.9f); + dust2.color = Color.Turquoise; + } + + int onHitDamage = Player.CalcIntDamage(0.2f * proj.damage); + Player.ApplyDamageToNPC(target, onHitDamage, 0f, 0, false); + + SoundStyle hitSound = new("CalamityMod/Sounds/Item/ElectricHit"); + SoundEngine.PlaySound(hitSound with { Volume = 0.2f, Pitch = 0.7f, PitchVariance = 0.2f }, proj.Center); + } + } + + if ((cgp.pearlBullet1 || cgp.pearlBullet2 || cgp.pearlBullet3) && proj.numHits == 0) + { + Color color = cgp.pearlBullet1 ? Color.LightBlue : cgp.pearlBullet2 ? Color.LightPink : Color.Khaki; + Vector2 spinningPoint = Vector2.Normalize(new Vector2(-1f, -1f)); + float radians = MathHelper.TwoPi / 3; + + Vector2 Position = target.Center + spinningPoint.RotatedBy(radians * (cgp.pearlBullet1 ? 0 : cgp.pearlBullet2 ? 1 : 2)).RotatedBy(-0.45f) * 55; + int bulletType = (cgp.pearlBullet1 ? 0 : cgp.pearlBullet2 ? 1 : 2); + + CustomPulse spark = new CustomPulse(target.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/HighResHollowCircleHardEdge", new Vector2(1, 1), Main.rand.NextFloat(-2f, 2f), 0.005f, 0.035f + 0.018f * bulletType, 14 + bulletType); + GeneralParticleHandler.SpawnParticle(spark); + CustomPulse spark2 = new CustomPulse(Position, Vector2.Zero, color, "CalamityMod/Particles/HighResFoggyCircleHardEdge", new Vector2(1, 1), Main.rand.NextFloat(-2f, 2f), 0.005f, 0.06f, 17); + GeneralParticleHandler.SpawnParticle(spark2); + + int points = 6; + radians = MathHelper.TwoPi / points; + spinningPoint = Vector2.Normalize(new Vector2(-1f, -1f)); + float rotRando = Main.rand.NextFloat(0.1f, 2.5f); + for (int k = 0; k < points; k++) + { + Vector2 velocity = spinningPoint.RotatedBy(radians * k).RotatedBy(-0.45f * rotRando); + Particle subTrail = new GlowSparkParticle(Position + velocity * 10f, velocity * 15, false, 12, 0.03f, color, new Vector2(1.35f, 0.5f), true); + GeneralParticleHandler.SpawnParticle(subTrail); + } + + int pearls = (int)(MathHelper.Clamp(7 - (int)(proj.numHits * 0.5f), 2, 7)); + for (int k = 0; k < pearls; k++) + { + Vector2 velocity = new Vector2(1, 1).RotatedByRandom(100) * Main.rand.NextFloat(0.7f, 1.2f); + PearlParticle subTrail = new PearlParticle(Position + velocity * 11f, velocity * 10, true, 50, 0.85f, color, 0.95f, Main.rand.NextFloat(2, -2), true); + GeneralParticleHandler.SpawnParticle(subTrail); + } + int dusts = (int)(MathHelper.Clamp(10 - (int)(proj.numHits * 0.5f), 2, 10)); + for (int i = 0; i <= dusts; i++) + { + Dust dust2 = Dust.NewDustPerfect(Position, 278, new Vector2(5, 5).RotatedByRandom(100f) * Main.rand.NextFloat(0.1f, 2.9f)); + dust2.noGravity = false; + dust2.scale = Main.rand.NextFloat(0.3f, 0.8f); + dust2.color = color; + } + + int onHitDamage = Player.CalcIntDamage(0.2f * proj.damage); + Player.ApplyDamageToNPC(target, onHitDamage, 0f, 0, false); + + SoundStyle hitSound = new("CalamityMod/Sounds/Item/HadalUrnClose"); + SoundEngine.PlaySound(hitSound with { Volume = 0.4f, Pitch = 0.4f, PitchVariance = 0.2f }, proj.Center); + } + + + if (cgp.lifeBullet && proj.numHits == 0) + { + int points = 10; + for (int k = 0; k < points; k++) + { + Vector2 velocity = proj.velocity.RotatedByRandom(0.7f) * Main.rand.NextFloat(0.3f, 0.8f); + LineParticle orb = new LineParticle(proj.Center + velocity * 1.5f, velocity * Main.rand.NextFloat(1f, 2f), false, 18, Main.rand.NextFloat(0.4f, 0.7f), Color.White * 0.85f); + GeneralParticleHandler.SpawnParticle(orb); + } + + int heal = (int)Math.Round(hit.Damage * 0.035); + if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) + return; + + CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, Main.player[proj.owner], heal, ModContent.ProjectileType(), BalancingConstants.LifeStealRange); + } + + if ((cgp.betterLifeBullet1 || cgp.betterLifeBullet2) && proj.numHits == 0) + { + int points = 12; + for (int k = 0; k < points; k++) + { + int randomColor = Main.rand.Next(1, 3 + 1); + Color color = randomColor == 1 ? Color.LightBlue : randomColor == 2 ? Color.LightPink : Color.Khaki; + + Vector2 velocity = proj.velocity.RotatedByRandom(0.6f) * Main.rand.NextFloat(0.3f, 0.8f); + LineParticle orb = new LineParticle(proj.Center + velocity * 1.5f, velocity * Main.rand.NextFloat(1f, 3f), false, 18, Main.rand.NextFloat(0.4f, 0.7f), color); + GeneralParticleHandler.SpawnParticle(orb); + } + + int heal = (int)Math.Round(hit.Damage * 0.01); + if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) + return; + + for (int i = 0; i <= 2; i++) + { + CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, Main.player[proj.owner], heal, ModContent.ProjectileType(), BalancingConstants.LifeStealRange); + } + } + ProjLifesteal(target, proj, damageDone, hit.Crit); ProjOnHit(proj, target.Center, hit.Crit, target.IsAnEnemy(false)); NPCDebuffs(target, proj.CountsAsClass(), proj.CountsAsClass(), proj.CountsAsClass(), proj.CountsAsClass(), proj.CountsAsClass(), proj.CountsAsClass(), true, proj.noEnchantments); @@ -544,10 +740,6 @@ namespace CalamityMod.CalPlayer } } } - if (proj.type == ProjectileType()) - { - polarisBoostCounter += 1; - } } } #endregion @@ -591,7 +783,7 @@ namespace CalamityMod.CalPlayer if (silvaMage && silvaMageCooldown <= 0 && (proj.penetrate == 1 || proj.timeLeft <= 5)) { silvaMageCooldown = 300; - SoundEngine.PlaySound(SoundID.Zombie103 , proj.Center); //So scuffed, just because zombie sounds werent ported normally + SoundEngine.PlaySound(SoundID.Zombie103, proj.Center); //So scuffed, just because zombie sounds werent ported normally // Silva Mage Blasts: 800 + 60%, softcap on the whole combined thing starts at 1400 int silvaBurstDamage = Player.ApplyArmorAccDamageBonusesTo(CalamityUtils.DamageSoftCap(800.0 + 0.6 * proj.damage, 1400)); Projectile.NewProjectile(source, proj.Center, Vector2.Zero, ProjectileType(), silvaBurstDamage, 8f, Player.whoAmI); @@ -738,7 +930,7 @@ namespace CalamityMod.CalPlayer { var spawnSource = proj.GetSource_FromThis(); int Type = ProjectileType(); - if (modProj.stealthStrike && dragonScales && Main.projectile.Count(proj => proj.type == Type && proj.active) < 1) + if (modProj.stealthStrike && dragonScales && Main.projectile.Count(proj => proj.type == Type && proj.active) < 1) { int damage = (int)Player.GetTotalDamage().ApplyTo(DragonScales.TornadoBaseDamage); damage = Player.ApplyArmorAccDamageBonusesTo(damage); @@ -881,7 +1073,7 @@ namespace CalamityMod.CalPlayer titanCooldown = 15; } - if (corrosiveSpine && modProj.stealthStrikeHitCount < 3) + if (corrosiveSpine && modProj.stealthStrikeHitCount < 3 && (Player.ownedProjectileCounts[ProjectileType()] + Player.ownedProjectileCounts[ProjectileType()] + Player.ownedProjectileCounts[ProjectileType()]) < 3) { for (int i = 0; i < 3; i++) { @@ -903,7 +1095,7 @@ namespace CalamityMod.CalPlayer if (type != -1) { - int damage = (int)Player.GetTotalDamage().ApplyTo(24); + int damage = (int)Player.GetTotalDamage().ApplyTo(22); damage = Player.ApplyArmorAccDamageBonusesTo(damage); float speed = Main.rand.NextFloat(5f, 11f); @@ -977,10 +1169,6 @@ namespace CalamityMod.CalPlayer { CalamityUtils.Inflict246DebuffsNPC(target, ModContent.BuffType()); } - if (cryogenSoul) - { - CalamityUtils.Inflict246DebuffsNPC(target, BuffID.Frostburn); - } if (ataxiaFire) { CalamityUtils.Inflict246DebuffsNPC(target, BuffID.OnFire3, 4f); @@ -1081,7 +1269,7 @@ namespace CalamityMod.CalPlayer CalamityUtils.Inflict246DebuffsNPC(target, BuffID.Frostburn2); if (omegaBlueChestplate) target.AddBuff(BuffType(), 180); - if (sulfurSet) + if (sulphurSet) target.AddBuff(BuffID.Poisoned, 120); if (abyssalAmulet) { @@ -1112,35 +1300,7 @@ namespace CalamityMod.CalPlayer { CalamityGlobalProjectile modProj = proj.Calamity(); - // Spectre Damage set and Nebula set work on enemies which are "immune to lifesteal" - if (!target.canGhostHeal) - { - if (Player.ghostHurt) - { - proj.ghostHurt(damage, target.Center, target); - } - - if (Player.setNebula && Player.nebulaCD == 0 && Main.rand.NextBool(3)) - { - Player.nebulaCD = 30; - int boosterType = Utils.SelectRandom(Main.rand, new int[] - { - ItemID.NebulaPickup1, - ItemID.NebulaPickup2, - ItemID.NebulaPickup3 - }); - var source = Player.GetSource_Misc("1"); - int nebulaBooster = Item.NewItem(source, target.Center, target.Size, boosterType, 1, false, 0, false, false); - Main.item[nebulaBooster].velocity.Y = Main.rand.Next(-20, 1) * 0.2f; - Main.item[nebulaBooster].velocity.X = Main.rand.Next(10, 31) * 0.2f * proj.direction; - if (Main.netMode == NetmodeID.MultiplayerClient) - { - NetMessage.SendData(MessageID.SyncItem, -1, -1, null, nebulaBooster, 0f, 0f, 0f, 0, 0, 0); - } - } - } - - if (bloodflareSet && !target.IsAnEnemy(false) && !Player.moonLeech) + if (bloodflareSet && !target.IsAnEnemy(false) && !Player.moonLeech && target.lifeMax > 5) { if ((target.life < target.lifeMax * 0.5) && bloodflareHeartTimer <= 0) { @@ -1149,17 +1309,18 @@ namespace CalamityMod.CalPlayer } } - if (gladiatorSword && target.IsAnEnemy(false) && target.life <= 0 && target.Calamity().gladiatorOnKill) + if (gladiatorSword && target.IsAnEnemy(false) && target.life <= 0 && target.Calamity().gladiatorOnKill && target.lifeMax > 5) { target.Calamity().gladiatorOnKill = false; Projectile.NewProjectile(Player.GetSource_FromThis(), target.Center.X, target.Center.Y, target.velocity.X / 2, target.velocity.Y / 2, ModContent.ProjectileType(), 0, 0f); } - if (Main.player[Main.myPlayer].lifeSteal > 0f && target.canGhostHeal && !Player.moonLeech) + if (Main.player[Main.myPlayer].lifeSteal > 0f && !Player.moonLeech && target.lifeMax > 5) { // Increases the degree to which Spectre Healing set contributes to the lifesteal cap if (Player.ghostHeal && proj.CountsAsClass()) { + // This doesn't use Math.Round because it doesn't in vanilla float cooldownMult = 0.2f; cooldownMult -= proj.numHits * 0.05f; if (cooldownMult < 0f) @@ -1169,192 +1330,104 @@ namespace CalamityMod.CalPlayer Main.player[Main.myPlayer].lifeSteal -= cooldown; } - // Increases the degree to which Vampire Knives contribute to the lifesteal cap - if (proj.type == ProjectileID.VampireKnife) - { - float cooldown = damage * 0.075f; - if (cooldown < 0f) - cooldown = 0f; - - Main.player[Main.myPlayer].lifeSteal -= cooldown; - } - if (vampiricTalisman && proj.CountsAsClass() && crit) { - float heal = MathHelper.Clamp(damage * 0.011f, 0f, 5f); - if ((int)heal > 0) - { - CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, Player, heal, ProjectileID.VampireHeal, 1200f, 3f); - float cooldown = heal * 2f; - Main.player[Main.myPlayer].lifeSteal -= cooldown; - } + int heal = (int)Math.Round(damage * 0.015); + if (heal > BalancingConstants.LifeStealCap) + heal = BalancingConstants.LifeStealCap; + + if (CalamityGlobalProjectile.CanSpawnLifeStealProjectile(1f, heal)) + CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, Player, heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange, BalancingConstants.LifeStealAccessoryCooldownMultiplier); } if (bloodyGlove && proj.CountsAsClass() && modProj.stealthStrike) - { - float cooldown = 20; - Player.statLife += 2; - Player.HealEffect(2); - Main.player[Main.myPlayer].lifeSteal -= cooldown; - } + CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, Player, 2, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange, BalancingConstants.LifeStealAccessoryCooldownMultiplier); if (target.IsAnEnemy(false)) { - if (bloodflareThrowing && proj.CountsAsClass() && crit && Main.rand.NextBool()) - { - float projHitMult = 0.03f; - projHitMult -= proj.numHits * 0.015f; - if (projHitMult < 0f) - projHitMult = 0f; - - float cooldownMult = damage * projHitMult; - if (cooldownMult < 0f) - cooldownMult = 0f; - - if (Player.lifeSteal > 0f) - { - Player.statLife += 1; - Player.HealEffect(1); - Player.lifeSteal -= cooldownMult * 2f; - } - } + if (bloodflareThrowing && proj.CountsAsClass() && crit) + CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, Player, 2, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange, BalancingConstants.LifeStealSetBonusCooldownMultiplier); if (bloodflareMelee && proj.IsTrueMelee()) - { - int healAmount = Main.rand.Next(2) + 1; - Player.statLife += healAmount; - Player.HealEffect(healAmount); - } + CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, Player, 2, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange, BalancingConstants.LifeStealSetBonusCooldownMultiplier); } - bool otherHealTypes = auricSet || silvaSet || tarraMage || ataxiaMage; - if (proj.CountsAsClass() && Player.ActiveItem().CountsAsClass()) { - if (manaOverloader && otherHealTypes) + if (manaOverloader) { - if (Main.rand.NextBool()) - { - float healMult = 0.2f; - healMult -= proj.numHits * 0.05f; - float heal = damage * healMult * (Player.statMana / (float)Player.statManaMax2); + double healMult = 0.2; + healMult -= proj.numHits * healMult * 0.25; + int heal = (int)Math.Round(damage * healMult * (Player.statMana / (double)Player.statManaMax2)); + if (heal > BalancingConstants.LifeStealCap) + heal = BalancingConstants.LifeStealCap; - if (heal > CalamityMod.lifeStealCap) - heal = CalamityMod.lifeStealCap; - - if (!CalamityGlobalProjectile.CanSpawnLifeStealProjectile(healMult, heal)) - return; - - CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, Player, heal, ProjectileType(), 1200f, 3f); - } + if (CalamityGlobalProjectile.CanSpawnLifeStealProjectile(healMult, heal)) + CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, Player, heal, ProjectileType(), BalancingConstants.LifeStealRange, BalancingConstants.LifeStealAccessoryCooldownMultiplier); } } if (silvaSet) { - float healMult = 0.03f; - healMult -= proj.numHits * 0.015f; - float heal = damage * healMult; + double healMult = 0.1; + healMult -= proj.numHits * healMult * 0.5; + int heal = (int)Math.Round(damage * healMult); + if (heal > BalancingConstants.LifeStealCap) + heal = BalancingConstants.LifeStealCap; - if (heal > CalamityMod.lifeStealCap) - heal = CalamityMod.lifeStealCap; - - if (!CalamityGlobalProjectile.CanSpawnLifeStealProjectile(healMult, heal)) - return; - - CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, Player, heal, ProjectileType(), 1200f, 3f); + if (CalamityGlobalProjectile.CanSpawnLifeStealProjectile(healMult, heal)) + CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, Player, heal, ProjectileType(), BalancingConstants.LifeStealRange, BalancingConstants.LifeStealSetBonusCooldownMultiplier); } else if (proj.CountsAsClass() && Player.ActiveItem().CountsAsClass()) { - if (manaOverloader) - { - float healMult = 0.2f; - healMult -= proj.numHits * 0.05f; - float heal = damage * healMult * (Player.statMana / (float)Player.statManaMax2); - - if (heal > CalamityMod.lifeStealCap) - heal = CalamityMod.lifeStealCap; - - if (!CalamityGlobalProjectile.CanSpawnLifeStealProjectile(healMult, heal)) - return; - - CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, Player, heal, ProjectileType(), 1200f, 3f); - } - if (tarraMage) { - if (tarraMageHealCooldown <= 0) - { - tarraMageHealCooldown = 90; + double healMult = 0.1; + healMult -= proj.numHits * healMult * 0.5; + int heal = (int)Math.Round(damage * healMult); + if (heal > BalancingConstants.LifeStealCap) + heal = BalancingConstants.LifeStealCap; - float healMult = 0.1f; - healMult -= proj.numHits * 0.05f; - float heal = damage * healMult; - - if (heal > CalamityMod.lifeStealCap) - heal = CalamityMod.lifeStealCap; - - if (!CalamityGlobalProjectile.CanSpawnLifeStealProjectile(healMult, heal)) - return; - - Main.player[Main.myPlayer].lifeSteal -= heal * 6f; - - int healAmount = (int)heal; - Player.statLife += healAmount; - Player.HealEffect(healAmount); - - if (Player.statLife > Player.statLifeMax2) - Player.statLife = Player.statLifeMax2; - } + if (CalamityGlobalProjectile.CanSpawnLifeStealProjectile(healMult, heal)) + CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, Player, heal, ProjectileType(), BalancingConstants.LifeStealRange, BalancingConstants.LifeStealSetBonusCooldownMultiplier); } else if (ataxiaMage) { - float healMult = 0.1f; - healMult -= proj.numHits * 0.05f; - float heal = damage * healMult; + double healMult = 0.1; + healMult -= proj.numHits * healMult * 0.5; + int heal = (int)Math.Round(damage * healMult); + if (heal > BalancingConstants.LifeStealCap) + heal = BalancingConstants.LifeStealCap; - if (heal > CalamityMod.lifeStealCap) - heal = CalamityMod.lifeStealCap; - - if (!CalamityGlobalProjectile.CanSpawnLifeStealProjectile(healMult, heal)) - return; - - CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, Player, heal, ProjectileType(), 1200f, 3f); + if (CalamityGlobalProjectile.CanSpawnLifeStealProjectile(healMult, heal)) + CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, Player, heal, ProjectileType(), BalancingConstants.LifeStealRange, BalancingConstants.LifeStealSetBonusCooldownMultiplier); } } if (reaverDefense) { - float healMult = 0.2f; - healMult -= proj.numHits * 0.05f; - float heal = damage * healMult; + double healMult = 0.1; + healMult -= proj.numHits * healMult * 0.5; + int heal = (int)Math.Round(damage * healMult); + if (heal > BalancingConstants.LifeStealCap) + heal = BalancingConstants.LifeStealCap; - if (heal > CalamityMod.lifeStealCap) - heal = CalamityMod.lifeStealCap; - if (Main.rand.Next(10) > 0) - heal = 0; - - if (!CalamityGlobalProjectile.CanSpawnLifeStealProjectile(healMult, heal)) - return; - - CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, Player, heal, ProjectileType(), 1200f, 3f); + if (CalamityGlobalProjectile.CanSpawnLifeStealProjectile(healMult, heal)) + CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, Player, heal, ProjectileType(), BalancingConstants.LifeStealRange, BalancingConstants.LifeStealReaverTankCooldownMultiplier); } if (proj.CountsAsClass()) { if (xerocSet && xerocDmg <= 0 && Player.ownedProjectileCounts[ProjectileType()] < 3 && Player.ownedProjectileCounts[ProjectileType()] < 3) { - float healMult = 0.06f; - healMult -= proj.numHits * 0.015f; - float heal = damage * healMult; + double healMult = 0.1; + healMult -= proj.numHits * healMult * 0.5; + int heal = (int)Math.Round(damage * healMult); + if (heal > BalancingConstants.LifeStealCap) + heal = BalancingConstants.LifeStealCap; - if (heal > CalamityMod.lifeStealCap) - heal = CalamityMod.lifeStealCap; - - if (!CalamityGlobalProjectile.CanSpawnLifeStealProjectile(healMult, heal)) - return; - - CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, Player, heal, ProjectileType(), 1200f, 3f); + if (CalamityGlobalProjectile.CanSpawnLifeStealProjectile(healMult, heal)) + CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, Player, heal, ProjectileType(), BalancingConstants.LifeStealRange, BalancingConstants.LifeStealSetBonusCooldownMultiplier); } } } @@ -1362,7 +1435,7 @@ namespace CalamityMod.CalPlayer public void ItemLifesteal(NPC target, Item item, int damage) { - if (bloodflareSet && target.IsAnEnemy(false)) + if (bloodflareSet && target.IsAnEnemy(false) && target.lifeMax > 5) { if ((target.life < target.lifeMax * 0.5) && bloodflareHeartTimer <= 0) { @@ -1371,37 +1444,14 @@ namespace CalamityMod.CalPlayer } } - if (target.IsAnEnemy(false) && target.canGhostHeal && !Player.moonLeech) + if (bloodflareMelee && item.CountsAsClass() && target.lifeMax > 5) { - if (bloodflareMelee && item.CountsAsClass()) + if (target.IsAnEnemy(false) && Main.player[Main.myPlayer].lifeSteal > 0f && !Player.moonLeech) { - int healAmount = Main.rand.Next(2) + 1; - Player.statLife += healAmount; - Player.HealEffect(healAmount); - } - } - - if (gladiatorSword && target.IsAnEnemy(false) && target.life <= 0 && target.Calamity().gladiatorOnKill) - { - target.Calamity().gladiatorOnKill = false; - Projectile.NewProjectile(Player.GetSource_FromThis(), target.Center.X, target.Center.Y, target.velocity.X / 2, target.velocity.Y / 2, ModContent.ProjectileType(), 0, 0f); - } - - if (reaverDefense) - { - if (Main.player[Main.myPlayer].lifeSteal > 0f && target.canGhostHeal && !Player.moonLeech) - { - float healMult = 0.2f; - float heal = damage * healMult; - - if (heal > CalamityMod.lifeStealCap) - heal = CalamityMod.lifeStealCap; - if (Main.rand.Next(10) > 0) - heal = 0; - - if ((int)heal > 0 && !Main.player[Main.myPlayer].moonLeech) + int heal = 4; + if (!Main.player[Main.myPlayer].moonLeech) { - Main.player[Main.myPlayer].lifeSteal -= heal * 3f; + Main.player[Main.myPlayer].lifeSteal -= heal * BalancingConstants.LifeStealSetBonusCooldownMultiplier; float lowestHealthCheck = 0f; int healTarget = Player.whoAmI; @@ -1411,7 +1461,49 @@ namespace CalamityMod.CalPlayer if (otherPlayer.active && !otherPlayer.dead && ((!Player.hostile && !otherPlayer.hostile) || Player.team == otherPlayer.team)) { float playerDist = Vector2.Distance(target.Center, otherPlayer.Center); - if (playerDist < 1200f && (otherPlayer.statLifeMax2 - otherPlayer.statLife) > lowestHealthCheck) + if (playerDist < BalancingConstants.LifeStealRange && (otherPlayer.statLifeMax2 - otherPlayer.statLife) > lowestHealthCheck) + { + lowestHealthCheck = otherPlayer.statLifeMax2 - otherPlayer.statLife; + healTarget = i; + } + } + } + + // https://github.com/tModLoader/tModLoader/wiki/IEntitySource#detailed-list + var source = Player.GetSource_FromThis(ReaverHeadTank.HealOrbEntitySourceContext); + Projectile.NewProjectile(source, target.Center, Vector2.Zero, ProjectileID.VampireHeal, 0, 0f, Player.whoAmI, healTarget, heal); + } + } + } + + if (gladiatorSword && target.IsAnEnemy(false) && target.life <= 0 && target.Calamity().gladiatorOnKill && target.lifeMax > 5) + { + target.Calamity().gladiatorOnKill = false; + Projectile.NewProjectile(Player.GetSource_FromThis(), target.Center, target.velocity * 0.5f, ModContent.ProjectileType(), 0, 0f); + } + + if (reaverDefense) + { + if (Main.player[Main.myPlayer].lifeSteal > 0f && !Player.moonLeech && target.lifeMax > 5) + { + double healMult = 0.1; + int heal = (int)Math.Round(damage * healMult); + if (heal > BalancingConstants.LifeStealCap) + heal = BalancingConstants.LifeStealCap; + + if (heal > 0 && !Main.player[Main.myPlayer].moonLeech) + { + Main.player[Main.myPlayer].lifeSteal -= heal * BalancingConstants.LifeStealReaverTankCooldownMultiplier; + + float lowestHealthCheck = 0f; + int healTarget = Player.whoAmI; + for (int i = 0; i < Main.maxPlayers; i++) + { + Player otherPlayer = Main.player[i]; + if (otherPlayer.active && !otherPlayer.dead && ((!Player.hostile && !otherPlayer.hostile) || Player.team == otherPlayer.team)) + { + float playerDist = Vector2.Distance(target.Center, otherPlayer.Center); + if (playerDist < BalancingConstants.LifeStealRange && (otherPlayer.statLifeMax2 - otherPlayer.statLife) > lowestHealthCheck) { lowestHealthCheck = otherPlayer.statLifeMax2 - otherPlayer.statLife; healTarget = i; diff --git a/CalPlayer/Dashes/AsgardsValorDash.cs b/CalPlayer/Dashes/AsgardsValorDash.cs index 88e18d10f1..499d16ebcb 100644 --- a/CalPlayer/Dashes/AsgardsValorDash.cs +++ b/CalPlayer/Dashes/AsgardsValorDash.cs @@ -75,17 +75,17 @@ namespace CalamityMod.CalPlayer.Dashes Dust dust = Dust.NewDustPerfect(npc.Center, 296, velocity * 3f, 0, default, 2.5f); dust.noGravity = true; dust.shader = GameShaders.Armor.GetSecondaryShader(player.cShield, player); - + Dust dust2 = Dust.NewDustPerfect(npc.Center, 158, velocity * 5f, 0, default, 2.2f); dust2.noGravity = true; dust2.shader = GameShaders.Armor.GetSecondaryShader(player.cShield, player); dust2.color = Color.Salmon; - + Dust dust3 = Dust.NewDustPerfect(npc.Center, 169, velocity * 7f, 0, default, 1.9f); dust3.noGravity = true; dust3.shader = GameShaders.Armor.GetSecondaryShader(player.cShield, player); dust3.color = Color.SandyBrown; - + } for (int k = 0; k < 5; k++) { @@ -93,7 +93,7 @@ namespace CalamityMod.CalPlayer.Dashes dust.noGravity = false; dust.shader = GameShaders.Armor.GetSecondaryShader(player.cShield, player); } - SoundEngine.PlaySound(SoundID.Item62 with { Volume = 0.6f, PitchVariance = 0.3f }, npc.position); + SoundEngine.PlaySound(SoundID.Item62 with { Volume = 0.6f, PitchVariance = 0.3f }, npc.Center); } } } diff --git a/CalPlayer/Dashes/CounterScarfDash.cs b/CalPlayer/Dashes/CounterScarfDash.cs index b93758bbf0..ad2f8027e2 100644 --- a/CalPlayer/Dashes/CounterScarfDash.cs +++ b/CalPlayer/Dashes/CounterScarfDash.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.Graphics.Shaders; +using Terraria.ID; namespace CalamityMod.CalPlayer.Dashes { @@ -19,7 +20,7 @@ namespace CalamityMod.CalPlayer.Dashes { for (int d = 0; d < 20; d++) { - Dust redDashDust = Dust.NewDustDirect(player.position, player.width, player.height, 235, 0f, 0f, 100, default, 2f); + Dust redDashDust = Dust.NewDustDirect(player.position, player.width, player.height, DustID.LifeDrain, 0f, 0f, 100, default, 2f); redDashDust.position += Main.rand.NextVector2Square(-5f, 5f); redDashDust.velocity *= 0.2f; redDashDust.scale *= Main.rand.NextFloat(1f, 1.2f); @@ -41,7 +42,7 @@ namespace CalamityMod.CalPlayer.Dashes } Vector2 dustSpawnPosition = new Vector2(player.position.X, dustSpawnTop); - Dust redDashDust = Dust.NewDustDirect(dustSpawnPosition, player.width, dustSpawnHeight, 235, 0f, 0f, 100, default, 1.4f); + Dust redDashDust = Dust.NewDustDirect(dustSpawnPosition, player.width, dustSpawnHeight, DustID.LifeDrain, 0f, 0f, 100, default, 1.4f); redDashDust.velocity *= 0.1f; redDashDust.scale *= Main.rand.NextFloat(1f, 1.2f); redDashDust.shader = GameShaders.Armor.GetSecondaryShader(player.cNeck, player); diff --git a/CalPlayer/Dashes/DeepDiverDash.cs b/CalPlayer/Dashes/DeepDiverDash.cs index 61d2d5ab11..6ec6a025e8 100644 --- a/CalPlayer/Dashes/DeepDiverDash.cs +++ b/CalPlayer/Dashes/DeepDiverDash.cs @@ -1,7 +1,14 @@ -using CalamityMod.Enums; +using System; +using CalamityMod.Enums; +using CalamityMod.Items.Accessories; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Particles; +using Terraria.Audio; namespace CalamityMod.CalPlayer.Dashes { @@ -9,42 +16,94 @@ namespace CalamityMod.CalPlayer.Dashes { public static new string ID => "Deep Diver"; - public override DashCollisionType CollisionType => DashCollisionType.NoCollision; + public override DashCollisionType CollisionType => DashCollisionType.ShieldSlam; public override bool IsOmnidirectional => false; - public override float CalculateDashSpeed(Player player) => 25.9f; + public override float CalculateDashSpeed(Player player) => 20f; + public int Time = 0; public override void OnDashEffects(Player player) { - for (int d = 0; d < 60; d++) + Time = 0; + for (int m = 0; m < 3; m++) { - Dust iceDashDust = Dust.NewDustDirect(player.position, player.width, player.height, 33, 0f, 0f, 100, default, 1.25f); - iceDashDust.position += Main.rand.NextVector2Square(-5f, 5f); - iceDashDust.velocity *= 0.2f; - iceDashDust.scale *= Main.rand.NextFloat(1f, 1.2f); - iceDashDust.shader = GameShaders.Armor.GetSecondaryShader(player.cShield, player); - iceDashDust.noGravity = true; - iceDashDust.fadeIn = 0.5f; + PointParticle spark = new PointParticle(player.Center - player.velocity, -player.velocity * (0.08f * m), false, 25, 4f - (0.5f * m), (Main.rand.NextBool() ? Color.Aqua : Color.DodgerBlue) * 0.4f); + GeneralParticleHandler.SpawnParticle(spark); } } public override void MidDashEffects(Player player, ref float dashSpeed, ref float dashSpeedDecelerationFactor, ref float runSpeedDecelerationFactor) { - for (int m = 0; m < 24; m++) + Time++; + for (int m = 0; m < 5; m++) { - Dust iceDashDust = Dust.NewDustDirect(player.position + Vector2.UnitY * 4f, player.width, player.height - 8, 33, 0f, 0f, 100, default, 1.25f); - iceDashDust.position += Main.rand.NextVector2Square(-5f, 5f); - iceDashDust.velocity *= 0.2f; - iceDashDust.scale *= Main.rand.NextFloat(1f, 1.2f); - iceDashDust.shader = GameShaders.Armor.GetSecondaryShader(player.cShield, player); - iceDashDust.noGravity = true; - if (Main.rand.NextBool()) - iceDashDust.fadeIn = 0.5f; + Vector2 dustVel3 = -player.velocity.RotatedBy(Main.rand.NextFloat(-0.3f, 0.3f)) * Main.rand.NextFloat(0.03f, 0.2f); + Dust dust = Dust.NewDustPerfect(player.Center + new Vector2(Main.rand.NextFloat(-6f, 6f), Main.rand.NextFloat(-15f, 15f)) - (player.velocity * 1.7f), Main.rand.NextBool(7) ? 278 : 80, dustVel3); + if (dust.type == 278) + { + dust.scale = 1.2f; + dust.velocity = Vector2.Zero; + dust.noGravity = false; + dust.color = Main.rand.NextBool() ? Color.Aqua : Color.DodgerBlue; + } + else + { + dust.scale = Main.rand.NextFloat(0.6f, 1.8f); + dust.alpha = 125; + dust.noGravity = true; + } + dust.shader = GameShaders.Armor.GetSecondaryShader(player.cShield, player); + } + if (Time % 2 == 0) + { + Vector2 dustVel = -player.velocity.RotatedBy(0.05f + MathHelper.Clamp(Time * 0.03f, 0, 0.55f)) * 0.75f; + Vector2 dustVel2 = -player.velocity.RotatedBy(-0.05f - MathHelper.Clamp(Time * 0.03f, 0, 0.55f)) * 0.75f; + + PointParticle spark = new PointParticle(player.Center + new Vector2(0, -15 * player.direction) + dustVel, dustVel, false, 8, 1.4f, (Main.rand.NextBool() ? Color.Aqua : Color.DodgerBlue) * 0.5f); + GeneralParticleHandler.SpawnParticle(spark); + PointParticle spark2 = new PointParticle(player.Center + new Vector2(0, 15 * player.direction) + dustVel2, dustVel2, false, 8, 1.4f, (Main.rand.NextBool() ? Color.Aqua : Color.DodgerBlue) * 0.5f); + GeneralParticleHandler.SpawnParticle(spark2); } + player.velocity.X *= 0.967f; + // Dash at a faster speed than the default value. - dashSpeed = 18f; + dashSpeed = 25f; + } + + public override void OnHitEffects(Player player, NPC npc, IEntitySource source, ref DashHitContext hitContext) + { + SoundStyle hit = new("CalamityMod/Sounds/NPCHit/PerfSmallHit3"); + SoundEngine.PlaySound(hit with { Pitch = 0.7f, Volume = 0.4f }, player.Center); + for (int i = 0; i <= 6; i++) + { + Dust dust = Dust.NewDustPerfect(player.Center, Main.rand.NextBool() ? 278 : 132, player.velocity.RotatedByRandom(0.7f) * Main.rand.NextFloat(0.5f, 1f) + new Vector2(0, -3f)); + if (dust.type == 278) + { + dust.scale = 1.2f; + dust.color = Main.rand.NextBool() ? Color.Aqua : Color.DodgerBlue; + } + else + { + dust.scale = 0.9f; + } + dust.noGravity = false; + dust.shader = GameShaders.Armor.GetSecondaryShader(player.cShield, player); + } + + // Define hit context variables. + int hitDirection = player.direction; + if (player.velocity.X != 0f) + hitDirection = Math.Sign(player.velocity.X); + hitContext.HitDirection = hitDirection; + hitContext.PlayerImmunityFrames = DeepDiver.ShieldSlamIFrames; + + // Define damage parameters. + int dashDamage = DeepDiver.ShieldSlamDamage; + hitContext.damageClass = DamageClass.Melee; + hitContext.BaseDamage = player.ApplyArmorAccDamageBonusesTo(dashDamage); + hitContext.BaseKnockback = DeepDiver.ShieldSlamKnockback; } } } diff --git a/CalPlayer/Dashes/GodslayerArmorDash.cs b/CalPlayer/Dashes/GodslayerArmorDash.cs index 8d0b178b12..d06e8a5402 100644 --- a/CalPlayer/Dashes/GodslayerArmorDash.cs +++ b/CalPlayer/Dashes/GodslayerArmorDash.cs @@ -27,7 +27,7 @@ namespace CalamityMod.CalPlayer.Dashes public override DashCollisionType CollisionType => DashCollisionType.ShieldSlam; public override bool IsOmnidirectional => true; - + public int Time = 0; public float Size = 2.2f; public bool SoundOnce = true; diff --git a/CalPlayer/Dashes/OrnateShieldDash.cs b/CalPlayer/Dashes/OrnateShieldDash.cs index 807f3c0757..16da12241f 100644 --- a/CalPlayer/Dashes/OrnateShieldDash.cs +++ b/CalPlayer/Dashes/OrnateShieldDash.cs @@ -29,7 +29,7 @@ namespace CalamityMod.CalPlayer.Dashes { for (int d = 0; d < 3; d++) { - Dust iceDashDust = Dust.NewDustPerfect(player.Center + new Vector2 (Main.rand.NextFloat(-6f, 6f), Main.rand.NextFloat(-15f, 15f)) - (player.velocity * 1.7f), Main.rand.NextBool(8) ? 223 : 180, -player.velocity.RotatedByRandom(MathHelper.ToRadians(10f)) * Main.rand.NextFloat(0.1f, 0.8f), 0, default, Main.rand.NextFloat(0.6f, 0.8f)); + Dust iceDashDust = Dust.NewDustPerfect(player.Center + new Vector2(Main.rand.NextFloat(-6f, 6f), Main.rand.NextFloat(-15f, 15f)) - (player.velocity * 1.7f), Main.rand.NextBool(8) ? 223 : 180, -player.velocity.RotatedByRandom(MathHelper.ToRadians(10f)) * Main.rand.NextFloat(0.1f, 0.8f), 0, default, Main.rand.NextFloat(0.6f, 0.8f)); iceDashDust.shader = GameShaders.Armor.GetSecondaryShader(player.cShield, player); iceDashDust.noGravity = true; iceDashDust.fadeIn = 0.5f; diff --git a/CalPlayer/Dashes/PlaguebringerArmorDash.cs b/CalPlayer/Dashes/PlaguebringerArmorDash.cs index dfbf5c3d9f..82d5619337 100644 --- a/CalPlayer/Dashes/PlaguebringerArmorDash.cs +++ b/CalPlayer/Dashes/PlaguebringerArmorDash.cs @@ -5,6 +5,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; using Terraria.Graphics.Shaders; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.CalPlayer.Dashes @@ -24,7 +25,7 @@ namespace CalamityMod.CalPlayer.Dashes // Spawn plague dust around the player's body. for (int d = 0; d < 60; d++) { - Dust dust = Dust.NewDustDirect(player.position, player.width, player.height, 89, 0f, 0f, 100, default, 1.25f); + Dust dust = Dust.NewDustDirect(player.position, player.width, player.height, DustID.GemEmerald, 0f, 0f, 100, default, 1.25f); dust.position.X += Main.rand.NextFloat(-5f, 5f); dust.position.Y += Main.rand.NextFloat(-5f, 5f); dust.velocity *= 0.2f; @@ -40,7 +41,7 @@ namespace CalamityMod.CalPlayer.Dashes // Spawn plague dust around the player's body. for (int m = 0; m < 24; m++) { - Dust plagueDashDust = Dust.NewDustDirect(new Vector2(player.position.X, player.position.Y + 4f), player.width, player.height - 8, 89, 0f, 0f, 100, default, 1f); + Dust plagueDashDust = Dust.NewDustDirect(new Vector2(player.position.X, player.position.Y + 4f), player.width, player.height - 8, DustID.GemEmerald, 0f, 0f, 100, default, 1f); plagueDashDust.velocity *= 0.1f; plagueDashDust.scale *= Main.rand.NextFloat(1f, 1.2f); plagueDashDust.shader = GameShaders.Armor.GetSecondaryShader(player.ArmorSetDye(), player); diff --git a/CalPlayer/Dashes/PlayerDashManager.cs b/CalPlayer/Dashes/PlayerDashManager.cs index d28827ea6d..724292f85f 100644 --- a/CalPlayer/Dashes/PlayerDashManager.cs +++ b/CalPlayer/Dashes/PlayerDashManager.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using Terraria; +using Terraria.ModLoader.Core; namespace CalamityMod.CalPlayer.Dashes { @@ -44,7 +45,8 @@ namespace CalamityMod.CalPlayer.Dashes { DashIdentificationTable = new(); Type baseType = typeof(PlayerDashEffect); - foreach (Type type in CalamityMod.Instance.Code.GetTypes()) + Type[] types = AssemblyManager.GetLoadableTypes(CalamityMod.Instance.Code); + foreach (Type type in types) { // Ignore any types which are not dash effects or are abstract. // This eliminates the PlayerDashEffect template type, which cannot have instances. diff --git a/CalPlayer/Dashes/StatisVoidSashDash.cs b/CalPlayer/Dashes/StatisVoidSashDash.cs index 483d5c9bad..4a09578ad0 100644 --- a/CalPlayer/Dashes/StatisVoidSashDash.cs +++ b/CalPlayer/Dashes/StatisVoidSashDash.cs @@ -43,7 +43,7 @@ namespace CalamityMod.CalPlayer.Dashes int scytheDamage = (int)player.GetBestClassDamage().ApplyTo(250); scytheDamage = player.ApplyArmorAccDamageBonusesTo(scytheDamage); - int scythe = Projectile.NewProjectile(player.GetSource_FromAI(), player.Center, player.velocity.RotatedBy(player.direction * (AngleSwap ? 30 : -30), default) * 0.1f - player.velocity / 2f, ModContent.ProjectileType(), scytheDamage, 5f, player.whoAmI);; + int scythe = Projectile.NewProjectile(player.GetSource_FromAI(), player.Center, player.velocity.RotatedBy(player.direction * (AngleSwap ? 30 : -30), default) * 0.1f - player.velocity / 2f, ModContent.ProjectileType(), scytheDamage, 5f, player.whoAmI); ; if (scythe.WithinBounds(Main.maxProjectiles)) { Main.projectile[scythe].DamageType = DamageClass.Generic; @@ -52,7 +52,7 @@ namespace CalamityMod.CalPlayer.Dashes } AngleSwap = !AngleSwap; - + } // Dash at a faster speed than the default value. diff --git a/CalPlayer/DrawLayers/AuricSetTrailLayer.cs b/CalPlayer/DrawLayers/AuricSetTrailLayer.cs index 2ba962f104..985f590c07 100644 --- a/CalPlayer/DrawLayers/AuricSetTrailLayer.cs +++ b/CalPlayer/DrawLayers/AuricSetTrailLayer.cs @@ -25,11 +25,11 @@ namespace CalamityMod.CalPlayer.DrawLayers Player drawPlayer = drawInfo.drawPlayer; List existingDrawData = drawInfo.DrawDataCache; float movementSpeedInterpolant = CobaltArmorSetChange.CalculateMovementSpeedInterpolant(drawPlayer); - for (float i = 0f; i < drawPlayer.Calamity().OldPositions.Length; i += 0.8f) + for (float i = 0f; i < drawPlayer.Calamity().OldPositions.Length; i += 1.7f) { float completionRatio = i / (float)drawPlayer.Calamity().OldPositions.Length; - float scale = MathHelper.Lerp(1f, 0.7f, completionRatio); - float opacity = MathHelper.Lerp(0.18f, 0.06f, completionRatio) * movementSpeedInterpolant; + float scale = MathHelper.Lerp(1f, 0.6f, completionRatio); + float opacity = MathHelper.Lerp(0.12f, 0.03f, completionRatio) * movementSpeedInterpolant; List afterimages = new List(); for (int j = 0; j < existingDrawData.Count; j++) { diff --git a/CalPlayer/DrawLayers/Backpack_TheEmpyrean.png b/CalPlayer/DrawLayers/Backpack_DeadSunsWind.png similarity index 100% rename from CalPlayer/DrawLayers/Backpack_TheEmpyrean.png rename to CalPlayer/DrawLayers/Backpack_DeadSunsWind.png diff --git a/CalPlayer/DrawLayers/Backpack_Photoviscerator.png b/CalPlayer/DrawLayers/Backpack_Photoviscerator.png index aa94ab14fd..5eb58e0d3e 100644 Binary files a/CalPlayer/DrawLayers/Backpack_Photoviscerator.png and b/CalPlayer/DrawLayers/Backpack_Photoviscerator.png differ diff --git a/CalPlayer/DrawLayers/Backpack_TerraFlameburster.png b/CalPlayer/DrawLayers/Backpack_TerraFlameburster.png deleted file mode 100644 index a494e4aeca..0000000000 Binary files a/CalPlayer/DrawLayers/Backpack_TerraFlameburster.png and /dev/null differ diff --git a/CalPlayer/DrawLayers/Backpack_WildfireBloom.png b/CalPlayer/DrawLayers/Backpack_WildfireBloom.png new file mode 100644 index 0000000000..e03ecd37e8 Binary files /dev/null and b/CalPlayer/DrawLayers/Backpack_WildfireBloom.png differ diff --git a/CalPlayer/DrawLayers/BodyBulkLayer.cs b/CalPlayer/DrawLayers/BodyBulkLayer.cs index fa3543838d..4050a8ef63 100644 --- a/CalPlayer/DrawLayers/BodyBulkLayer.cs +++ b/CalPlayer/DrawLayers/BodyBulkLayer.cs @@ -1,8 +1,8 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; -using Terraria.ID; using Terraria.DataStructures; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.CalPlayer.DrawLayers diff --git a/CalPlayer/DrawLayers/CobaltSetTrailLayer.cs b/CalPlayer/DrawLayers/CobaltSetTrailLayer.cs index 06da8a818e..6c348fd81c 100644 --- a/CalPlayer/DrawLayers/CobaltSetTrailLayer.cs +++ b/CalPlayer/DrawLayers/CobaltSetTrailLayer.cs @@ -36,7 +36,7 @@ namespace CalamityMod.CalPlayer.DrawLayers var drawData = existingDrawData[j]; drawData.position = existingDrawData[j].position - drawPlayer.position + drawPlayer.oldPosition; drawData.color = new Color(100, 164, 219) * opacity; - drawData.color.B = (byte)(drawData.color.B * 1.4); + drawData.color.B = (byte)(drawData.color.B * 1.4); drawData.scale = new Vector2(scale); afterimages.Add(drawData); } diff --git a/CalPlayer/DrawLayers/EncasementParryLayer.cs b/CalPlayer/DrawLayers/EncasementParryLayer.cs index 6ab71706c2..28e75b3674 100644 --- a/CalPlayer/DrawLayers/EncasementParryLayer.cs +++ b/CalPlayer/DrawLayers/EncasementParryLayer.cs @@ -63,13 +63,13 @@ namespace CalamityMod.CalPlayer.DrawLayers scale = 0f; break; } - + Texture2D texture = ModContent.Request(tex).Value; Vector2 drawPos = drawInfo.Center - Main.screenPosition + new Vector2(0f, drawPlayer.gfxOffY); drawPos.Y += 15f; drawPos.X += 15f; - - + + int maxParry = 30; //all parries use thirty seconds as a max at this point in time, if this changes, this too should change float colorIntensity = currentParry >= 18 ? defaultOpacity : 1f - Utils.GetLerpValue(maxParry, 0f, currentParry, true); SpriteEffects spriteEffects = drawPlayer.direction != -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; diff --git a/CalPlayer/DrawLayers/FrontArmOverShoulderpadLayer.cs b/CalPlayer/DrawLayers/FrontArmOverShoulderpadLayer.cs index cda0f5d872..e1c8e967a2 100644 --- a/CalPlayer/DrawLayers/FrontArmOverShoulderpadLayer.cs +++ b/CalPlayer/DrawLayers/FrontArmOverShoulderpadLayer.cs @@ -1,8 +1,8 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; -using Terraria.ID; using Terraria.DataStructures; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.CalPlayer.DrawLayers diff --git a/CalPlayer/DrawLayers/HatExtensionLayer.cs b/CalPlayer/DrawLayers/HatExtensionLayer.cs index 158ac2ef32..b2231f0f0a 100644 --- a/CalPlayer/DrawLayers/HatExtensionLayer.cs +++ b/CalPlayer/DrawLayers/HatExtensionLayer.cs @@ -1,10 +1,10 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Items.Accessories.Vanity; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; -using Terraria.ID; using Terraria.DataStructures; +using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Items.Accessories.Vanity; namespace CalamityMod.CalPlayer.DrawLayers { diff --git a/CalPlayer/DrawLayers/HeldItemGlowMaskLayer.cs b/CalPlayer/DrawLayers/HeldItemGlowMaskLayer.cs new file mode 100644 index 0000000000..6e956ede84 --- /dev/null +++ b/CalPlayer/DrawLayers/HeldItemGlowMaskLayer.cs @@ -0,0 +1,274 @@ +using System; +using System.Collections.Generic; +using CalamityMod.Items.SummonItems; +using CalamityMod.Items.Weapons.DraedonsArsenal; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Items.Weapons.Summon; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.UI; + +namespace CalamityMod.CalPlayer.DrawLayers +{ + public class HeldItemGlowMaskLayer : PlayerDrawLayer + { + public override Position GetDefaultPosition() => new AfterParent(PlayerDrawLayers.HeldItem); + + protected override void Draw(ref PlayerDrawSet drawInfo) + { + Player drawPlayer = drawInfo.drawPlayer; + List existingDrawData = drawInfo.DrawDataCache; + + if (drawPlayer.JustDroppedAnItem) + return; + + Item heldItem = drawInfo.heldItem; + int itemType = heldItem.type; + + if (itemType < ItemID.Count) + return; + + // This is ugly and I don't give a fuck. + // If you want it to look better, do it yourself. + Texture2D glowMask = default; + if (itemType == ModContent.ItemType()) + glowMask = ModContent.Request("CalamityMod/Items/Weapons/Magic/AbyssShocker_mask").Value; + else if (itemType == ModContent.ItemType()) + glowMask = ModContent.Request("CalamityMod/Items/Weapons/Magic/ApotheosisGlow").Value; + else if (itemType == ModContent.ItemType()) + glowMask = ModContent.Request("CalamityMod/Items/Weapons/Ranged/AuralisGlow").Value; + else if (itemType == ModContent.ItemType()) + glowMask = ModContent.Request("CalamityMod/Items/Weapons/Ranged/AuroraBlazerGlow").Value; + else if (itemType == ModContent.ItemType()) + glowMask = ModContent.Request("CalamityMod/Items/Weapons/Ranged/CleansingBlazeGlow").Value; + else if (itemType == ModContent.ItemType()) + glowMask = ModContent.Request("CalamityMod/Items/Weapons/Summon/CosmicImmaterializerGlow").Value; + else if (itemType == ModContent.ItemType()) + glowMask = ModContent.Request("CalamityMod/Items/Weapons/Magic/DeathhailStaffGlow").Value; + else if (itemType == ModContent.ItemType()) + glowMask = ModContent.Request("CalamityMod/Items/Weapons/Ranged/DeathwindGlow").Value; + else if (itemType == ModContent.ItemType()) + glowMask = ModContent.Request("CalamityMod/Items/Weapons/Melee/EssenceFlayerGlow").Value; + else if (itemType == ModContent.ItemType()) + glowMask = ModContent.Request("CalamityMod/Items/Weapons/Summon/EtherealSubjugatorGlow").Value; + else if (itemType == ModContent.ItemType()) + glowMask = ModContent.Request("CalamityMod/Items/Weapons/Melee/ExcelsusGlow").Value; + else if (itemType == ModContent.ItemType()) + glowMask = ModContent.Request("CalamityMod/Items/Weapons/Melee/IridescentExcaliburGlow").Value; + else if (itemType == ModContent.ItemType()) + glowMask = ModContent.Request("CalamityMod/Items/Weapons/Magic/FatesRevealGlow").Value; + else if (itemType == ModContent.ItemType()) + glowMask = ModContent.Request("CalamityMod/Items/Weapons/Melee/GrandGuardianGlow").Value; + else if (itemType == ModContent.ItemType()) + glowMask = ModContent.Request("CalamityMod/Items/Weapons/Melee/GreatswordofJudgementGlow").Value; + else if (itemType == ModContent.ItemType()) + glowMask = ModContent.Request("CalamityMod/Items/Weapons/Melee/MajesticGuardGlow").Value; + else if (itemType == ModContent.ItemType()) + glowMask = ModContent.Request("CalamityMod/Items/SummonItems/NecroplasmicBeaconGlow").Value; + else if (itemType == ModContent.ItemType()) + glowMask = ModContent.Request("CalamityMod/Items/Weapons/Melee/OrderbringerGlow").Value; + else if (itemType == ModContent.ItemType()) + glowMask = ModContent.Request("CalamityMod/Items/Weapons/Magic/PhotosynthesisGlow").Value; + else if (itemType == ModContent.ItemType()) + glowMask = ModContent.Request("CalamityMod/Items/Weapons/Summon/PlantationStaffGlow").Value; + else if (itemType == ModContent.ItemType()) + glowMask = ModContent.Request("CalamityMod/Items/Weapons/Melee/PrismaticBreakerGlow").Value; + else if (itemType == ModContent.ItemType()) + glowMask = ModContent.Request("CalamityMod/Items/Weapons/DraedonsArsenal/PulseRifleGlow").Value; + else if (itemType == ModContent.ItemType()) + glowMask = ModContent.Request("CalamityMod/Items/Weapons/Magic/SoulPiercerGlow").Value; + else if (itemType == ModContent.ItemType()) + glowMask = ModContent.Request("CalamityMod/Items/Weapons/Magic/SubsumingVortexGlow").Value; + else if (itemType == ModContent.ItemType()) + glowMask = ModContent.Request("CalamityMod/Items/Weapons/Melee/TerrorBladeGlow").Value; + else if (itemType == ModContent.ItemType()) + glowMask = ModContent.Request("CalamityMod/Items/Weapons/Melee/TheEnforcerGlow").Value; + else if (itemType == ModContent.ItemType()) + glowMask = ModContent.Request("CalamityMod/Items/Weapons/Ranged/VernalBolterGlow").Value; + else if (itemType == ModContent.ItemType()) + glowMask = ModContent.Request("CalamityMod/Items/Weapons/Magic/VividClarityGlow").Value; + + if (glowMask == default) + return; + + if (drawPlayer.heldProj >= 0 && drawInfo.shadow == 0f && !drawInfo.heldProjOverHand) + drawInfo.projectileDrawPosition = existingDrawData.Count; + + float adjustedItemScale = drawPlayer.GetAdjustedItemScale(heldItem); + //Main.instance.LoadItem(num); + Vector2 position = new Vector2((int)(drawInfo.ItemLocation.X - Main.screenPosition.X), (int)(drawInfo.ItemLocation.Y - Main.screenPosition.Y)); + Rectangle itemDrawFrame = drawPlayer.GetItemDrawFrame(itemType); + drawInfo.itemColor = Lighting.GetColor((int)((double)drawInfo.Position.X + (double)drawPlayer.width * 0.5) / 16, (int)(((double)drawInfo.Position.Y + (double)drawPlayer.height * 0.5) / 16D)); + + if (drawPlayer.shroomiteStealth && heldItem.CountsAsClass()) + { + float stealth = drawPlayer.stealth; + if ((double)stealth < 0.03) + stealth = 0.03f; + + float stealthColorScale = (1f + stealth * 10f) / 11f; + drawInfo.itemColor = new Color((byte)((float)(int)drawInfo.itemColor.R * stealth), (byte)((float)(int)drawInfo.itemColor.G * stealth), (byte)((float)(int)drawInfo.itemColor.B * stealthColorScale), (byte)((float)(int)drawInfo.itemColor.A * stealth)); + } + + if (drawPlayer.setVortex && heldItem.CountsAsClass()) + { + float stealth = drawPlayer.stealth; + if ((double)stealth < 0.03) + stealth = 0.03f; + + drawInfo.itemColor = drawInfo.itemColor.MultiplyRGBA(new Color(Vector4.Lerp(Vector4.One, new Vector4(0f, 0.12f, 0.16f, 0f), 1f - stealth))); + } + + bool inUse = drawPlayer.itemAnimation > 0 && heldItem.useStyle != 0; + bool visuallyHeld = heldItem.holdStyle != 0 && !drawPlayer.pulley; + if (!drawPlayer.CanVisuallyHoldItem(heldItem)) + visuallyHeld = false; + + if (drawInfo.shadow != 0f || drawPlayer.frozen || !(inUse || visuallyHeld) || itemType <= 0 || drawPlayer.dead || heldItem.noUseGraphic || (drawPlayer.wet && heldItem.noWet) || (drawPlayer.happyFunTorchTime && drawPlayer.inventory[drawPlayer.selectedItem].createTile == TileID.Torches && drawPlayer.itemAnimation == 0)) + return; + + Color color = new Color(250, 250, 250, heldItem.alpha); + Vector2 originOffset = Vector2.Zero; + + // Use to adjust glow mask draw offset and color. + switch (itemType) + { + default: + break; + + // Keeping these commented here as examples. + /*case ItemID.TheBreaker: + case ItemID.TentacleSpike: + case ItemID.LucyTheAxe: + originOffset = new Vector2(4f, -4f) * drawPlayer.Directions; + break; + + case ItemID.BreakerBlade: + case ItemID.FleshGrinder: + case ItemID.SpectrePickaxe: + case ItemID.HamBat: + case ItemID.BatBat: + originOffset = new Vector2(6f, -6f) * drawPlayer.Directions; + break; + + case ItemID.LightsBane: + { + float amount = Utils.Remap(drawInfo.itemColor.ToVector3().Length() / 1.731f, 0.3f, 0.5f, 1f, 0f); + color = Color.Lerp(Color.Transparent, new Color(255, 255, 255, 127) * 0.7f, amount); + break; + } + + case ItemID.MeteorHamaxe: + originOffset = new Vector2(4f, -6f) * drawPlayer.Directions; + break; + + case ItemID.DyeTradersScimitar: + originOffset = new Vector2(2f, -2f) * drawPlayer.Directions; + break;*/ + } + + if (itemType == ModContent.ItemType()) + { + color = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, heldItem.alpha); + } + + Vector2 origin = new Vector2((float)itemDrawFrame.Width * 0.5f - (float)itemDrawFrame.Width * 0.5f * (float)drawPlayer.direction, itemDrawFrame.Height); + if (heldItem.useStyle == ItemUseStyleID.DrinkLiquid && drawPlayer.itemAnimation > 0) + { + Vector2 vector2 = new Vector2(0.5f, 0.4f); + origin = itemDrawFrame.Size() * vector2; + } + + if (drawPlayer.gravDir == -1f) + origin.Y = (float)itemDrawFrame.Height - origin.Y; + + origin += originOffset; + float itemRotation = drawPlayer.itemRotation; + + if (heldItem.useStyle == ItemUseStyleID.GolfPlay) + { + ref float xPos = ref position.X; + float xOffset = xPos; + xPos = xOffset - 0f; + itemRotation -= MathHelper.PiOver2 * (float)drawPlayer.direction; + origin.Y = 2f; + origin.X += 2 * drawPlayer.direction; + } + + ItemSlot.GetItemLight(ref drawInfo.itemColor, heldItem); + DrawData item; + + if (heldItem.useStyle == ItemUseStyleID.Shoot) + { + if (Item.staff[itemType]) + { + float staffRotation = drawPlayer.itemRotation + MathHelper.PiOver4 * (float)drawPlayer.direction; + float staffXOffset = 0f; + float staffYOffset = 0f; + Vector2 staffOrigin = new Vector2(0f, itemDrawFrame.Height); + + if (drawPlayer.gravDir == -1f) + { + if (drawPlayer.direction == -1) + { + staffRotation += MathHelper.PiOver2; + staffOrigin = new Vector2(itemDrawFrame.Width, 0f); + staffXOffset -= (float)itemDrawFrame.Width; + } + else + { + staffRotation -= MathHelper.PiOver2; + staffOrigin = Vector2.Zero; + } + } + + // Extra patch context. + else if (drawPlayer.direction == -1) + { + staffOrigin = new Vector2(itemDrawFrame.Width, itemDrawFrame.Height); + staffXOffset -= (float)itemDrawFrame.Width; + } + + ItemLoader.HoldoutOrigin(drawPlayer, ref staffOrigin); + + item = new DrawData(glowMask, new Vector2((int)(drawInfo.ItemLocation.X - Main.screenPosition.X + staffOrigin.X + staffXOffset), (int)(drawInfo.ItemLocation.Y - Main.screenPosition.Y + staffYOffset)), itemDrawFrame, color, staffRotation, staffOrigin, adjustedItemScale, drawInfo.itemEffect); + existingDrawData.Add(item); + + return; + } + + int xOffset = 10; + Vector2 offset = new Vector2(itemDrawFrame.Width / 2, itemDrawFrame.Height / 2); + Vector2 directionalOffset = Main.DrawPlayerItemPos(drawPlayer.gravDir, itemType); + xOffset = (int)directionalOffset.X; + offset.Y = directionalOffset.Y; + Vector2 drawOrigin = new Vector2(-xOffset, itemDrawFrame.Height / 2); + if (drawPlayer.direction == -1) + drawOrigin = new Vector2(itemDrawFrame.Width + xOffset, itemDrawFrame.Height / 2); + + item = new DrawData(glowMask, new Vector2((int)(drawInfo.ItemLocation.X - Main.screenPosition.X + offset.X), (int)(drawInfo.ItemLocation.Y - Main.screenPosition.Y + offset.Y)) - new Vector2(glowMask.Width * 0.5f, 0), itemDrawFrame, new Color(250, 250, 250, heldItem.alpha), drawPlayer.itemRotation, drawOrigin, adjustedItemScale, drawInfo.itemEffect); + existingDrawData.Add(item); + + return; + } + + if (drawPlayer.gravDir == -1f) + { + item = new DrawData(glowMask, position, itemDrawFrame, new Color(250, 250, 250, heldItem.alpha), itemRotation, origin, adjustedItemScale, drawInfo.itemEffect); + existingDrawData.Add(item); + + return; + } + + item = new DrawData(glowMask, position, itemDrawFrame, color, itemRotation, origin, adjustedItemScale, drawInfo.itemEffect); + existingDrawData.Add(item); + } + } +} diff --git a/CalPlayer/DrawLayers/IBulkyArmor.cs b/CalPlayer/DrawLayers/IBulkyArmor.cs index cc8abac148..076611fcad 100644 --- a/CalPlayer/DrawLayers/IBulkyArmor.cs +++ b/CalPlayer/DrawLayers/IBulkyArmor.cs @@ -1,6 +1,6 @@ using Microsoft.Xna.Framework; -using Terraria.DataStructures; using Terraria; +using Terraria.DataStructures; /// /// Interface that can be used by chestplates to appear extra bulky, by drawing partly over the players helmet with an extra layer diff --git a/CalPlayer/DrawLayers/IDrawArmOverShoulderpad.cs b/CalPlayer/DrawLayers/IDrawArmOverShoulderpad.cs index 6864017b3b..d4ce3f3ef5 100644 --- a/CalPlayer/DrawLayers/IDrawArmOverShoulderpad.cs +++ b/CalPlayer/DrawLayers/IDrawArmOverShoulderpad.cs @@ -1,6 +1,6 @@ using Microsoft.Xna.Framework; -using Terraria.DataStructures; using Terraria; +using Terraria.DataStructures; /// /// Interface that can be used by chestplates that need their front arm (when walking) to go over the shoulderpads diff --git a/CalPlayer/DrawLayers/IExtendedHat.cs b/CalPlayer/DrawLayers/IExtendedHat.cs index 499f7415e5..641fda9511 100644 --- a/CalPlayer/DrawLayers/IExtendedHat.cs +++ b/CalPlayer/DrawLayers/IExtendedHat.cs @@ -1,6 +1,6 @@ using Microsoft.Xna.Framework; -using Terraria.DataStructures; using Terraria; +using Terraria.DataStructures; public interface IExtendedHat { diff --git a/CalPlayer/DrawLayers/IHideFrontArm.cs b/CalPlayer/DrawLayers/IHideFrontArm.cs index b91fff9550..440dc4452e 100644 --- a/CalPlayer/DrawLayers/IHideFrontArm.cs +++ b/CalPlayer/DrawLayers/IHideFrontArm.cs @@ -1,6 +1,6 @@ using Microsoft.Xna.Framework; -using Terraria.DataStructures; using Terraria; +using Terraria.DataStructures; /// /// Interface that can be used by items that need to hide the players front arm when held. diff --git a/CalamityConfig.cs b/CalamityConfig.cs index 71e05ac8c9..eedd4de7ed 100644 --- a/CalamityConfig.cs +++ b/CalamityConfig.cs @@ -35,13 +35,17 @@ namespace CalamityMod [DefaultValue(true)] public bool Afterimages { get; set; } - private const int MinParticleLimit = 100; - private const int MaxParticleLimit = 2000; - + [BackgroundColor(192, 54, 64, 192)] + [DefaultValue(true)] + public bool NewVanillaTextures { get; set; } + + private const int MinParticleLimit = 500; + private const int MaxParticleLimit = 10000; + [BackgroundColor(192, 54, 64, 192)] [SliderColor(224, 165, 56, 128)] [Range(MinParticleLimit, MaxParticleLimit)] - [DefaultValue(500)] + [DefaultValue(5000)] public int ParticleLimit { get; set; } [BackgroundColor(192, 54, 64, 192)] @@ -49,8 +53,10 @@ namespace CalamityMod public bool BossesStopWeather { get; set; } [BackgroundColor(192, 54, 64, 192)] - [DefaultValue(true)] - public bool Screenshake { get; set; } + [SliderColor(224, 165, 56, 128)] + [Range(0f, 10f)] + [DefaultValue(1f)] + public float ScreenshakePower { get; set; } [BackgroundColor(192, 54, 64, 192)] [DefaultValue(true)] @@ -60,10 +66,6 @@ namespace CalamityMod #region UI Changes [Header("UI")] - [BackgroundColor(192, 54, 64, 192)] - [DefaultValue(true)] - public bool MusicModReminderMessage { get; set; } - [BackgroundColor(192, 54, 64, 192)] [DefaultValue(true)] public bool WikiStatusMessage { get; set; } @@ -155,7 +157,7 @@ namespace CalamityMod [Range(0f, 100f)] [DefaultValue(SpeedrunTimerUI.DefaultTimerPosY)] public float SpeedrunTimerPosY { get; set; } - + [BackgroundColor(192, 54, 64, 192)] [DefaultValue(true)] public bool FlightBar { get; set; } @@ -267,6 +269,10 @@ namespace CalamityMod [DefaultValue(true)] public bool ChilledWaterRework { get; set; } + [BackgroundColor(192, 54, 64, 192)] + [DefaultValue(true)] + public bool RemoveLavaDropsFromLavaSlimes { get; set; } + [BackgroundColor(192, 54, 64, 192)] [DefaultValue(false)] public bool ForceTownSafety { get; set; } diff --git a/CalamityKeybinds.cs b/CalamityKeybinds.cs index 9f320901ea..9c86183e9e 100644 --- a/CalamityKeybinds.cs +++ b/CalamityKeybinds.cs @@ -31,11 +31,11 @@ namespace CalamityMod DashHotkey = KeybindLoader.RegisterKeybind(Mod, "DashDoubleTapOverride", "F"); ExoChairSlowdownHotkey = KeybindLoader.RegisterKeybind(Mod, "ExoChairSlowDown", "RightShift"); GodSlayerDashHotKey = KeybindLoader.RegisterKeybind(Mod, "GodSlayerDash", "H"); - GravistarSabatonHotkey = KeybindLoader.RegisterKeybind(Mod, "GravistarSabatonHotkey", "X"); + GravistarSabatonHotkey = KeybindLoader.RegisterKeybind(Mod, "GravistarSabatonHotkey", "X"); NormalityRelocatorHotKey = KeybindLoader.RegisterKeybind(Mod, "NormalityRelocator", "Z"); RageHotKey = KeybindLoader.RegisterKeybind(Mod, "RageMode", "V"); SandCloakHotkey = KeybindLoader.RegisterKeybind(Mod, "SandCloakEffect", "C"); - SpectralVeilHotKey = KeybindLoader.RegisterKeybind(Mod, "SpectralVeilTeleport", "Z"); + SpectralVeilHotKey = KeybindLoader.RegisterKeybind(Mod, "SpectralVeilTeleport", "Z"); } public override void Unload() diff --git a/CalamityLists.cs b/CalamityLists.cs index 542979c4d3..0e29515d35 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -14,6 +14,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; using CalamityMod.Items.Placeables.Furniture.Trophies; using CalamityMod.Items.TreasureBags; +using CalamityMod.Items.Weapons.DraedonsArsenal; using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; @@ -84,7 +85,6 @@ namespace CalamityMod public static List dungeonProjectileBuffList; public static List bossHPScaleList; public static List friendlyBeeList; - public static List hardModeNerfList; public static List debuffList; public static List fireDebuffList; public static List sicknessDebuffList; @@ -94,14 +94,6 @@ namespace CalamityMod public static List frostMoonBuffList; public static List eclipseBuffList; public static List eventProjectileBuffList; - public static List revengeanceEnemyBuffList25Percent; - public static List revengeanceEnemyBuffList20Percent; - public static List revengeanceEnemyBuffList15Percent; - public static List revengeanceEnemyBuffList10Percent; - public static List revengeanceProjectileBuffList25Percent; - public static List revengeanceProjectileBuffList20Percent; - public static List revengeanceProjectileBuffList15Percent; - public static List revengeanceLifeStealExceptionList; public static List noRageWormSegmentList; public static List needsDebuffIconDisplayList; public static List scopedWeaponList; @@ -110,6 +102,7 @@ namespace CalamityMod public static List livingFireBlockList; public static List amalgamBuffList; public static List persistentBuffList; + public static List MagicGunIDs; public static List MushroomWeaponIDs; public static List MushroomProjectileIDs; @@ -120,10 +113,10 @@ namespace CalamityMod public static List angryBonesList; public static List hornetList; public static List mossHornetList; - public static List bossMinionList; public static List minibossList; public static List pierceResistList; + public static List pierceResistExceptionLeviAureusList; public static List pierceResistExceptionList; public static List AstrumDeusIDs; @@ -848,7 +841,7 @@ namespace CalamityMod ProjectileType(), ProjectileType(), ProjectileType(), - ProjectileType(), + ProjectileType(), ProjectileType(), ProjectileType(), ProjectileType(), @@ -873,7 +866,7 @@ namespace CalamityMod ProjectileType(), ProjectileType(), - ProjectileType(), + ProjectileType(), ProjectileType(), ProjectileType(), ProjectileType(), @@ -908,12 +901,16 @@ namespace CalamityMod enemyImmunityList = new List() { NPCID.KingSlime, + NPCType(), + NPCType(), + NPCType(), NPCID.EaterofWorldsHead, NPCID.EaterofWorldsBody, NPCID.EaterofWorldsTail, NPCID.BrainofCthulhu, NPCID.Creeper, NPCID.EyeofCthulhu, + NPCType(), NPCID.QueenBee, NPCID.SkeletronHead, NPCID.SkeletronHand, @@ -926,6 +923,7 @@ namespace CalamityMod NPCID.Retinazer, NPCID.Spazmatism, NPCID.SkeletronPrime, + NPCType(), NPCID.PrimeCannon, NPCID.PrimeSaw, NPCID.PrimeLaser, @@ -984,6 +982,9 @@ namespace CalamityMod NPCType(), NPCType(), NPCType(), + NPCType(), + NPCType(), + NPCType(), NPCType(), NPCType(), NPCType(), @@ -1021,6 +1022,8 @@ namespace CalamityMod NPCType(), NPCType(), NPCType(), + NPCType(), + NPCType(), NPCType(), NPCType(), NPCType(), @@ -1142,25 +1145,6 @@ namespace CalamityMod ProjectileType() }; - hardModeNerfList = new List() - { - ProjectileID.PinkLaser, - ProjectileID.FrostBlastHostile, - ProjectileID.GoldenShowerHostile, - ProjectileID.RainNimbus, - ProjectileID.FlamingArrow, - ProjectileID.BulletDeadeye, - ProjectileID.CannonballHostile, - ProjectileID.UnholyTridentHostile, - ProjectileID.FrostBeam, - ProjectileID.CursedFlameHostile, - ProjectileID.Stinger, - ProjectileID.BloodShot, - ProjectileID.BloodNautilusTears, - ProjectileID.BloodNautilusShot, - ProjectileID.RockGolemRock - }; - debuffList = new List() { BuffID.Poisoned, @@ -1388,173 +1372,6 @@ namespace CalamityMod ProjectileID.DrManFlyFlask }; - // Enemies that inflict an average of 1 to 50 damage in Expert Mode - revengeanceEnemyBuffList25Percent = new List() - { - NPCID.GiantWormHead, - NPCID.BlazingWheel, - NPCType(), - NPCType(), - NPCType() - }; - - // Enemies that inflict an average of 51 to 100 damage in Expert Mode - revengeanceEnemyBuffList20Percent = new List() - { - NPCID.DevourerHead, - NPCID.MeteorHead, - NPCID.BoneSerpentHead, - NPCID.ManEater, - NPCID.Snatcher, - NPCID.Piranha, - NPCID.Shark, - NPCID.SpikeBall, - NPCID.DiggerHead, - NPCID.WallCreeper, - NPCID.WallCreeperWall, - NPCID.Lihzahrd, - NPCID.Pumpking, - NPCID.SlimeSpiked, - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType() - }; - - // Enemies that inflict an average of 101 to 200 damage in Expert Mode - revengeanceEnemyBuffList15Percent = new List() - { - NPCID.DD2Betsy, - NPCID.Mimic, - NPCID.WyvernHead, - NPCID.SeekerHead, - NPCID.AnglerFish, - NPCID.Werewolf, - NPCID.Wraith, - NPCID.Arapaima, - NPCID.BlackRecluse, - NPCID.BlackRecluseWall, - NPCID.AngryTrapper, - NPCID.LihzahrdCrawler, - NPCID.PirateCaptain, - NPCID.FlyingSnake, - NPCID.Reaper, - NPCID.Paladin, - NPCID.BoneLee, - NPCID.MourningWood, - NPCID.PumpkingBlade, - NPCID.PresentMimic, - NPCID.Everscream, - NPCID.IceQueen, - NPCID.SantaNK1, - NPCID.StardustWormHead, - NPCID.Butcher, - NPCID.Psycho, - NPCID.DeadlySphere, - NPCID.BigMimicCorruption, - NPCID.BigMimicCrimson, - NPCID.BigMimicHallow, - NPCID.Mothron, - NPCID.DuneSplicerHead, - NPCID.SandShark, - NPCID.SandsharkCorrupt, - NPCID.SandsharkCrimson, - NPCID.SandsharkHallow, - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType() - }; - - // Enemies that inflict an average of 201 to 400 damage in Expert Mode - revengeanceEnemyBuffList10Percent = new List() - { - NPCID.SolarCrawltipedeHead, - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType() - }; - - revengeanceProjectileBuffList25Percent = new List() - { - ProjectileID.SandBallFalling, - ProjectileID.AshBallFalling, - ProjectileID.EbonsandBallFalling, - ProjectileID.PearlSandBallFalling, - ProjectileID.CrimsandBallFalling, - ProjectileID.GeyserTrap - }; - - revengeanceProjectileBuffList20Percent = new List() - { - ProjectileID.PoisonDartTrap, - ProjectileID.DemonSickle, - ProjectileID.SandnadoHostile, - ProjectileID.DD2BetsyFireball, - ProjectileID.DD2BetsyFlameBreath - }; - - revengeanceProjectileBuffList15Percent = new List() - { - ProjectileID.SpikyBallTrap, - ProjectileID.SpearTrap, - ProjectileID.FlamethrowerTrap, - ProjectileID.FlamesTrap, - ProjectileID.PaladinsHammerHostile, - ProjectileID.FlamingWood, - ProjectileID.FlamingScythe, - ProjectileID.FrostWave, - ProjectileID.Present, - ProjectileID.Spike, - ProjectileID.SaucerDeathray, - ProjectileID.NebulaBolt, - ProjectileID.NebulaSphere, - ProjectileID.NebulaLaser, - ProjectileID.StardustSoldierLaser, - ProjectileID.VortexLaser, - ProjectileID.VortexVortexLightning, - ProjectileID.VortexLightning, - ProjectileID.VortexAcid, - ProjectileType(), - ProjectileType() - }; - - revengeanceLifeStealExceptionList = new List() - { - NPCID.Probe, - NPCID.CultistDragonHead, - NPCID.CultistDragonBody1, - NPCID.CultistDragonBody2, - NPCID.CultistDragonBody3, - NPCID.CultistDragonBody4, - NPCID.CultistDragonTail, - NPCID.AncientCultistSquidhead, - NPCID.AncientLight, - NPCID.Sharkron, - NPCID.Sharkron2, - NPCID.PlanterasTentacle, - NPCType(), - NPCID.Spore, - NPCID.TheHungryII, - NPCID.LeechHead, - NPCID.LeechBody, - NPCID.LeechTail, - NPCID.QueenSlimeMinionBlue, - NPCID.QueenSlimeMinionPink, - NPCID.QueenSlimeMinionPurple, - NPCID.TheDestroyerBody, - NPCID.TheDestroyerTail, - NPCID.EaterofWorldsBody, - NPCID.EaterofWorldsTail, - NPCID.MoonLordCore - }; - noRageWormSegmentList = new List() { NPCType(), @@ -1584,17 +1401,7 @@ namespace CalamityMod NPCType() }; - // TODO -- override HoldItem => Player.scope = true; on these items - scopedWeaponList = new List() - { - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType() - }; - + // TODO -- override HoldItem => Player.accFishingLine = true; on these items, just like the scope fix... highTestFishList = new List() { ItemID.GoldenFishingRod, @@ -1800,6 +1607,47 @@ namespace CalamityMod BuffID.WeaponImbuePoison }; + MagicGunIDs = new List() + { + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemID.BeeGun, + ItemID.BubbleGun, + ItemID.ChargedBlasterCannon, + ItemID.HeatRay, + ItemID.LaserMachinegun, + ItemID.LaserRifle, + ItemID.LeafBlower, + ItemID.RainbowGun, + ItemID.SpaceGun, + ItemID.WaspGun, + ItemID.ZapinatorGray, + ItemID.ZapinatorOrange + }; + MushroomWeaponIDs = new List() { ItemType(), @@ -2039,11 +1887,22 @@ namespace CalamityMod NPCType() }; + pierceResistExceptionLeviAureusList = new List() + { + ProjectileID.NettleBurstEnd, + ProjectileID.NettleBurstLeft, + ProjectileID.NettleBurstRight, + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType() + }; + pierceResistExceptionList = new List() { ProjectileID.Arkhalis, ProjectileID.ChargedBlasterLaser, - ProjectileID.ClingerStaff, + ProjectileID.ClingerStaff, ProjectileID.FinalFractal, ProjectileID.FlyingKnife, ProjectileID.LastPrismLaser, @@ -2052,14 +1911,12 @@ namespace CalamityMod ProjectileID.PiercingStarlight, ProjectileID.Terragrim, ProjectileType(), - ProjectileType(), ProjectileType(), ProjectileType(), ProjectileType(), ProjectileType(), ProjectileType(), ProjectileType(), - ProjectileType(), ProjectileType(), ProjectileType(), ProjectileType(), @@ -2068,11 +1925,11 @@ namespace CalamityMod ProjectileType(), ProjectileType(), ProjectileType(), - ProjectileType(), ProjectileType(), ProjectileType(), ProjectileType(), ProjectileType(), + ProjectileType(), ProjectileType(), ProjectileType(), ProjectileType(), @@ -2096,6 +1953,7 @@ namespace CalamityMod ProjectileType(), ProjectileType(), ProjectileType(), + ProjectileType(), ProjectileType(), ProjectileType(), ProjectileType(), @@ -2215,6 +2073,7 @@ namespace CalamityMod SkeletronPrimeIDs = new List { NPCID.SkeletronPrime, + NPCType(), NPCID.PrimeCannon, NPCID.PrimeLaser, NPCID.PrimeSaw, @@ -2272,6 +2131,22 @@ namespace CalamityMod ZeroContactDamageNPCList = new List { + NPCID.Harpy, + NPCID.Salamander, + NPCID.Salamander2, + NPCID.Salamander3, + NPCID.Salamander4, + NPCID.Salamander5, + NPCID.Salamander6, + NPCID.Salamander7, + NPCID.Salamander8, + NPCID.Salamander9, + NPCID.GiantCursedSkull, + NPCID.FungiBulb, + NPCID.GiantFungiBulb, + NPCID.IcyMerman, + NPCID.AngryNimbus, + NPCID.SandElemental, NPCID.DarkCaster, NPCID.FireImp, NPCID.Tim, @@ -2303,12 +2178,23 @@ namespace CalamityMod NPCID.DrManFly, NPCID.Eyezor, NPCID.Nailhead, + NPCID.BrainScrambler, + NPCID.GigaZapper, + NPCID.RayGunner, + NPCID.ScutlixRider, NPCID.MartianWalker, NPCID.MartianTurret, NPCID.ElfCopter, NPCID.ElfArcher, NPCID.NebulaBrain, + NPCID.NebulaSoldier, + NPCID.StardustCellSmall, NPCID.StardustJellyfishBig, + NPCID.StardustSoldier, + NPCID.StardustSpiderBig, + NPCID.VortexHornetQueen, + NPCID.VortexRifleman, + NPCID.VortexSoldier, NPCID.PirateShipCannon, NPCID.MartianSaucer, NPCID.MartianSaucerCannon, @@ -2316,11 +2202,67 @@ namespace CalamityMod NPCID.MartianSaucerTurret, NPCID.Probe, NPCID.CultistBoss, + NPCID.GolemHead, NPCID.GolemHeadFree, NPCID.MoonLordFreeEye, NPCID.BloodSquid, NPCID.PlanterasHook, - NPCID.Dandelion + NPCID.Dandelion, + NPCID.DD2DarkMageT1, + NPCID.DD2DarkMageT3, + NPCID.DD2OgreT2, + NPCID.DD2OgreT3, + NPCID.DD2GoblinBomberT1, + NPCID.DD2GoblinBomberT2, + NPCID.DD2GoblinBomberT3, + NPCID.DD2JavelinstT1, + NPCID.DD2JavelinstT2, + NPCID.DD2JavelinstT3, + NPCID.DD2KoboldWalkerT2, + NPCID.DD2KoboldWalkerT3, + NPCID.DD2DrakinT2, + NPCID.DD2DrakinT3, + NPCID.DD2KoboldFlyerT2, + NPCID.DD2KoboldFlyerT3, + NPCID.DD2WitherBeastT2, + NPCID.DD2WitherBeastT3, + NPCID.DD2LightningBugT3, + NPCID.MourningWood, + NPCID.Pumpking, + NPCID.Everscream, + NPCID.IceQueen, + NPCID.SantaNK1, + NPCID.DevourerBody, + NPCID.DevourerTail, + NPCID.DiggerBody, + NPCID.DiggerTail, + NPCID.TombCrawlerBody, + NPCID.TombCrawlerTail, + NPCID.DuneSplicerBody, + NPCID.DuneSplicerTail, + NPCID.GiantWormBody, + NPCID.GiantWormTail, + NPCID.LeechBody, + NPCID.LeechTail, + NPCID.StardustWormBody, + NPCID.StardustWormTail, + NPCID.SeekerBody, + NPCID.SeekerTail, + NPCID.BoneSerpentBody, + NPCID.BoneSerpentTail, + NPCID.WyvernBody, + NPCID.WyvernTail, + NPCID.WyvernBody2, + NPCID.WyvernBody3, + NPCID.WyvernLegs, + NPCID.CultistDragonBody1, + NPCID.CultistDragonBody2, + NPCID.CultistDragonBody3, + NPCID.CultistDragonBody4, + NPCID.CultistDragonTail, + NPCID.BloodEelBody, + NPCID.BloodEelTail, + NPCID.AncientDoom }; // Reduce contact damage by 25% @@ -2355,27 +2297,20 @@ namespace CalamityMod NPCID.Derpling, NPCID.Herpling, NPCID.DiggerHead, - NPCID.DiggerBody, - NPCID.DiggerTail, NPCID.DesertGhoul, NPCID.DesertGhoulCorruption, NPCID.DesertGhoulCrimson, NPCID.DesertGhoulHallow, NPCID.DuneSplicerHead, - NPCID.DuneSplicerBody, - NPCID.DuneSplicerTail, NPCID.EnchantedSword, NPCID.FloatyGross, NPCID.GiantBat, NPCID.GiantFlyingFox, - NPCID.GiantFungiBulb, NPCID.FungiSpore, NPCID.GiantTortoise, NPCID.IceTortoise, NPCID.HoppinJack, NPCID.Mimic, - NPCID.IchorSticker, - NPCID.IcyMerman, NPCID.IlluminantBat, NPCID.IlluminantSlime, NPCID.JungleCreeper, @@ -2404,12 +2339,8 @@ namespace CalamityMod NPCID.Werewolf, NPCID.Wolf, NPCID.SeekerHead, - NPCID.SeekerBody, - NPCID.SeekerTail, NPCID.Wraith, NPCID.ChatteringTeethBomb, - NPCID.Clown, - NPCID.AngryNimbus, NPCID.IceGolem, NPCID.RainbowSlime, NPCID.SandShark, @@ -2430,8 +2361,6 @@ namespace CalamityMod NPCID.HellArmoredBonesSpikeShield, NPCID.HellArmoredBonesSword, NPCID.MisterStabby, - NPCID.SnowBalla, - NPCID.SnowmanGangsta, NPCID.Butcher, NPCID.CreatureFromTheDeep, NPCID.DeadlySphere, @@ -2468,8 +2397,6 @@ namespace CalamityMod NPCID.ZombieElfBeard, NPCID.ZombieElfGirl, NPCID.BloodEelHead, - NPCID.BloodEelBody, - NPCID.BloodEelTail, NPCID.GoblinShark, NPCID.EyeballFlyingFish, NPCID.ZombieMerman @@ -2501,9 +2428,13 @@ namespace CalamityMod { NPCID.UmbrellaSlime, 5400 }, { NPCID.RainbowSlime, 30000 }, { NPCID.Pinky, 15000 }, + { NPCType(), 21000 }, + { NPCType(), 18000 }, + { NPCType(), 24000 }, { NPCID.EyeofCthulhu, 450000 }, // 30 seconds { NPCID.ServantofCthulhu, 6000 }, + { NPCType(), 12000 }, { NPCID.EaterofWorldsHead, 10000 }, // 30 seconds + immunity timer at start { NPCID.EaterofWorldsBody, 10000 }, @@ -2513,6 +2444,11 @@ namespace CalamityMod { NPCID.Creeper, 10000 }, { NPCID.QueenBee, 315000 }, // 30 seconds + { NPCID.Bee, 3000 }, + { NPCID.BeeSmall, 2000 }, + { NPCID.BigHornetHoney, 10000 }, + { NPCID.HornetHoney, 7500 }, + { NPCID.LittleHornetHoney, 5000 }, { NPCID.Deerclops, 315000 }, // 30 seconds @@ -2521,6 +2457,11 @@ namespace CalamityMod { NPCID.WallofFlesh, 450000 }, // 30 seconds { NPCID.WallofFleshEye, 450000 }, + { NPCID.TheHungry, 10000 }, + { NPCID.TheHungryII, 5000 }, + { NPCID.LeechHead, 5000 }, + { NPCID.LeechBody, 5000 }, + { NPCID.LeechTail, 5000 }, // Tier 2 { NPCID.QueenSlimeBoss, 150000 }, // 30 seconds @@ -2534,16 +2475,18 @@ namespace CalamityMod { NPCID.TheDestroyer, 250000 }, // 30 seconds + immunity timer at start { NPCID.TheDestroyerBody, 250000 }, { NPCID.TheDestroyerTail, 250000 }, - { NPCID.Probe, 10000 }, + { NPCID.Probe, 5000 }, { NPCID.SkeletronPrime, 160000 }, // 30 seconds + { NPCType(), 160000 }, { NPCID.PrimeVice, 54000 }, { NPCID.PrimeCannon, 45000 }, { NPCID.PrimeSaw, 45000 }, { NPCID.PrimeLaser, 38000 }, { NPCID.Plantera, 160000 }, // 30 seconds - { NPCID.PlanterasTentacle, 40000 }, + { NPCID.PlanterasTentacle, 5000 }, + { NPCType(), 5000 }, // Tier 3 { NPCID.Golem, 50000 }, // 30 seconds @@ -2651,113 +2594,6 @@ namespace CalamityMod { NPCID.Deerclops, 44 } }; - bossMinionList = new List() - { - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCID.SlimeSpiked, - NPCID.ServantofCthulhu, - NPCType(), - NPCID.EaterofWorldsHead, - NPCID.EaterofWorldsBody, - NPCID.EaterofWorldsTail, - NPCID.Creeper, - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCID.SkeletronHand, - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCID.LeechHead, - NPCID.LeechBody, - NPCID.LeechTail, - NPCID.WallofFleshEye, - NPCID.TheHungry, - NPCID.TheHungryII, - NPCID.QueenSlimeMinionBlue, - NPCID.QueenSlimeMinionPink, - NPCID.QueenSlimeMinionPurple, - NPCType(), - NPCID.PrimeCannon, - NPCID.PrimeLaser, - NPCID.PrimeSaw, - NPCID.PrimeVice, - NPCType(), - NPCID.Probe, - NPCID.TheDestroyer, - NPCID.TheDestroyerBody, - NPCID.TheDestroyerTail, - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCID.PlanterasTentacle, - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCID.Spore, - NPCID.GolemHead, - NPCID.GolemHeadFree, - NPCID.GolemFistLeft, - NPCID.GolemFistRight, - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCID.CultistDragonHead, - NPCID.CultistDragonBody1, - NPCID.CultistDragonBody2, - NPCID.CultistDragonBody3, - NPCID.CultistDragonBody4, - NPCID.CultistDragonTail, - NPCID.AncientCultistSquidhead, - NPCID.AncientDoom, - NPCID.MoonLordLeechBlob, - NPCID.MoonLordFreeEye, - NPCID.MoonLordHand, - NPCID.MoonLordHead, - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType() - }; - legOverrideList = new List() { EquipLoader.GetEquipSlot(CalamityMod.Instance, "ProfanedSoulCrystal", EquipType.Legs), @@ -2809,7 +2645,6 @@ namespace CalamityMod dungeonProjectileBuffList = null; bossHPScaleList = null; friendlyBeeList = null; - hardModeNerfList = null; debuffList = null; fireDebuffList = null; sicknessDebuffList = null; @@ -2819,14 +2654,6 @@ namespace CalamityMod frostMoonBuffList = null; eclipseBuffList = null; eventProjectileBuffList = null; - revengeanceEnemyBuffList25Percent = null; - revengeanceEnemyBuffList20Percent = null; - revengeanceEnemyBuffList15Percent = null; - revengeanceEnemyBuffList10Percent = null; - revengeanceProjectileBuffList25Percent = null; - revengeanceProjectileBuffList20Percent = null; - revengeanceProjectileBuffList15Percent = null; - revengeanceLifeStealExceptionList = null; noRageWormSegmentList = null; needsDebuffIconDisplayList = null; scopedWeaponList = null; @@ -2835,6 +2662,7 @@ namespace CalamityMod livingFireBlockList = null; amalgamBuffList = null; persistentBuffList = null; + MagicGunIDs = null; MushroomWeaponIDs = null; MushroomProjectileIDs = null; @@ -2844,9 +2672,9 @@ namespace CalamityMod angryBonesList = null; hornetList = null; mossHornetList = null; - bossMinionList = null; minibossList = null; pierceResistList = null; + pierceResistExceptionLeviAureusList = null; pierceResistExceptionList = null; AstrumDeusIDs = null; diff --git a/CalamityMod.cs b/CalamityMod.cs index ba1d615544..62b15634c1 100644 --- a/CalamityMod.cs +++ b/CalamityMod.cs @@ -5,8 +5,6 @@ using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using CalamityMod.Balancing; -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; using CalamityMod.CalPlayer; using CalamityMod.CalPlayer.Dashes; using CalamityMod.Cooldowns; @@ -14,6 +12,7 @@ using CalamityMod.DataStructures; using CalamityMod.Effects; using CalamityMod.Events; using CalamityMod.FluidSimulation; +using CalamityMod.Graphics.Primitives; using CalamityMod.Items; using CalamityMod.Items.Dyes.HairDye; using CalamityMod.Items.VanillaArmorChanges; @@ -34,7 +33,6 @@ using CalamityMod.NPCs.ExoMechs.Artemis; using CalamityMod.NPCs.ExoMechs.Thanatos; using CalamityMod.NPCs.HiveMind; using CalamityMod.NPCs.Leviathan; -using CalamityMod.NPCs.NormalNPCs; using CalamityMod.NPCs.OldDuke; using CalamityMod.NPCs.Perforator; using CalamityMod.NPCs.PlaguebringerGoliath; @@ -86,7 +84,7 @@ namespace CalamityMod public static Asset carpetOriginal; - //Astral Sky/BG + // Astral Sky/BG public static Texture2D AstralSky; public static Texture2D AstralSurfaceFront; public static Texture2D AstralSurfaceFrontGlow; @@ -94,39 +92,43 @@ namespace CalamityMod public static Texture2D AstralSurfaceCloseGlow; public static Texture2D AstralSurfaceMiddle; public static Texture2D AstralSurfaceMiddleGlow; - public static Texture2D AstralSurfaceFar; - public static Texture2D AstralSurfaceHorizon; - //Astral Desert Sky/BG + // Astral Desert Sky/BG public static Texture2D AstralDesertSurfaceClose; public static Texture2D AstralDesertSurfaceMiddle; - public static Texture2D AstralDesertSurfaceFar; - //Astral Snow Sky/BG + // Astral Snow Sky/BG public static Texture2D AstralSnowSurfaceMiddle; - //Sulpher Sea Sky/BG + // Sulpher Sea Sky/BG public static Texture2D SulphurSeaSky; public static Texture2D SulphurSeaSkyFront; public static Texture2D SulphurSeaSurface; + // Destroyer glowmasks + public static Asset[] DestroyerGlowmasks = new Asset[3]; + + // Wall of Flesh glowmasks + public static Asset WallOfFleshEyeGlowmask; + public static Asset WallOfFleshDemonSickleTexture; + + // Master Rev+ Skeletron Prime + public static Asset ChadPrime; + public static Asset ChadPrimeEyeGlowmask; + // DR data structure public static SortedDictionary DRValues; // Boss Kill Time data structure public static SortedDictionary bossKillTimes; - // Boss velocity scaling data structure - public static SortedDictionary bossVelocityDamageScaleValues; - public const float velocityScaleMin = 0.5f; - public const float bitingEnemeyVelocityScale = 0.8f; - - // Life steal cap - public const int lifeStealCap = 10; - // Speedrun timer internal static Stopwatch SpeedrunTimer = new Stopwatch(); + // External flag to disable non-Revengeance boss AI edits + // This can be edited by other mods using reflection to prevent compatibility issues + public static bool ExternalFlag_DisableNonRevBossAI = false; + internal static CalamityMod Instance; // TODO -- Mod references should be contained in a ModSystem (example name "ModLoadedChecker") @@ -136,9 +138,11 @@ namespace CalamityMod // Please keep this in alphabetical order so it's easy to read internal Mod ancientsAwakened = null; internal Mod bossChecklist = null; + internal Mod coloredDamageTypes = null; internal Mod crouchMod = null; internal Mod dialogueTweak = null; internal Mod fargos = null; + internal Mod luminance = null; internal Mod magicStorage = null; internal Mod overhaul = null; internal Mod redemption = null; @@ -166,12 +170,16 @@ namespace CalamityMod ModLoader.TryGetMod("AAMod", out ancientsAwakened); bossChecklist = null; ModLoader.TryGetMod("BossChecklist", out bossChecklist); + coloredDamageTypes = null; + ModLoader.TryGetMod("ColoredDamageTypes", out coloredDamageTypes); crouchMod = null; ModLoader.TryGetMod("CrouchMod", out crouchMod); dialogueTweak = null; ModLoader.TryGetMod("DialogueTweak", out dialogueTweak); fargos = null; ModLoader.TryGetMod("Fargowiltas", out fargos); + luminance = null; + ModLoader.TryGetMod("Luminance", out luminance); magicStorage = null; ModLoader.TryGetMod("MagicStorage", out magicStorage); overhaul = null; @@ -209,14 +217,15 @@ namespace CalamityMod Mount.drillPickPower = 225; // Make Graveyard biomes require more Gravestones - SceneMetrics.GraveyardTileMax = 88; - SceneMetrics.GraveyardTileMin = 68; - SceneMetrics.GraveyardTileThreshold = 80; + SceneMetrics.GraveyardTileMax = 60; + SceneMetrics.GraveyardTileMin = 40; + SceneMetrics.GraveyardTileThreshold = 52; if (!Main.dedServ) { LoadClient(); GeneralParticleHandler.Load(); + PrimitiveRenderer.Initialize(); ForegroundDrawing.ForegroundManager.Load(); // Wikithis support @@ -231,7 +240,6 @@ namespace CalamityMod VanillaArmorChangeManager.Load(); SetupVanillaDR(); SetupBossKillTimes(); - SetupBossVelocityScalingValues(); SchematicManager.Load(); CustomLavaManagement.Load(); Attunement.Load(); @@ -265,30 +273,40 @@ namespace CalamityMod private void LoadClient() { - //Astral Sky/BG + // Astral Sky/BG AstralSky = ModContent.Request("CalamityMod/Skies/AstralSky", AssetRequestMode.ImmediateLoad).Value; - AstralSurfaceFront = ModContent.Request("CalamityMod/Skies/AstralSurfaceFront", AssetRequestMode.ImmediateLoad).Value; - AstralSurfaceFrontGlow = ModContent.Request("CalamityMod/Skies/AstralSurfaceFrontGlow", AssetRequestMode.ImmediateLoad).Value; - AstralSurfaceClose = ModContent.Request("CalamityMod/Skies/AstralSurfaceClose", AssetRequestMode.ImmediateLoad).Value; - AstralSurfaceCloseGlow = ModContent.Request("CalamityMod/Skies/AstralSurfaceCloseGlow", AssetRequestMode.ImmediateLoad).Value; - AstralSurfaceMiddle = ModContent.Request("CalamityMod/Skies/AstralSurfaceMiddle", AssetRequestMode.ImmediateLoad).Value; - AstralSurfaceMiddleGlow = ModContent.Request("CalamityMod/Skies/AstralSurfaceMiddleGlow", AssetRequestMode.ImmediateLoad).Value; - AstralSurfaceFar = ModContent.Request("CalamityMod/Skies/AstralSurfaceFar", AssetRequestMode.ImmediateLoad).Value; - AstralSurfaceHorizon = ModContent.Request("CalamityMod/Skies/AstralSurfaceHorizon", AssetRequestMode.ImmediateLoad).Value; + AstralSurfaceFront = ModContent.Request("CalamityMod/Backgrounds/AstralSurfaceFront", AssetRequestMode.ImmediateLoad).Value; + AstralSurfaceFrontGlow = ModContent.Request("CalamityMod/Backgrounds/AstralSurfaceFrontGlow", AssetRequestMode.ImmediateLoad).Value; + AstralSurfaceClose = ModContent.Request("CalamityMod/Backgrounds/AstralSurfaceClose", AssetRequestMode.ImmediateLoad).Value; + AstralSurfaceCloseGlow = ModContent.Request("CalamityMod/Backgrounds/AstralSurfaceCloseGlow", AssetRequestMode.ImmediateLoad).Value; + AstralSurfaceMiddle = ModContent.Request("CalamityMod/Backgrounds/AstralSurfaceMiddle", AssetRequestMode.ImmediateLoad).Value; + AstralSurfaceMiddleGlow = ModContent.Request("CalamityMod/Backgrounds/AstralSurfaceMiddleGlow", AssetRequestMode.ImmediateLoad).Value; //Astral Desert Sky/BG - AstralDesertSurfaceClose = ModContent.Request("CalamityMod/Skies/AstralDesertSurfaceClose", AssetRequestMode.ImmediateLoad).Value; - AstralDesertSurfaceMiddle = ModContent.Request("CalamityMod/Skies/AstralDesertSurfaceMiddle", AssetRequestMode.ImmediateLoad).Value; - AstralDesertSurfaceFar = ModContent.Request("CalamityMod/Skies/AstralDesertSurfaceFar", AssetRequestMode.ImmediateLoad).Value; + AstralDesertSurfaceClose = ModContent.Request("CalamityMod/Backgrounds/AstralDesertSurfaceClose", AssetRequestMode.ImmediateLoad).Value; + AstralDesertSurfaceMiddle = ModContent.Request("CalamityMod/Backgrounds/AstralDesertSurfaceMiddle", AssetRequestMode.ImmediateLoad).Value; //Astral Snow Sky/BG - AstralSnowSurfaceMiddle = ModContent.Request("CalamityMod/Skies/AstralSnowSurfaceMiddle", AssetRequestMode.ImmediateLoad).Value; + AstralSnowSurfaceMiddle = ModContent.Request("CalamityMod/Backgrounds/AstralSnowSurfaceMiddle", AssetRequestMode.ImmediateLoad).Value; - //Sulpher Sea Sky/BG + // Sulpher Sea Sky/BG SulphurSeaSky = ModContent.Request("CalamityMod/Skies/SulphurSeaSky", AssetRequestMode.ImmediateLoad).Value; SulphurSeaSkyFront = ModContent.Request("CalamityMod/Skies/SulphurSeaSkyFront", AssetRequestMode.ImmediateLoad).Value; SulphurSeaSurface = ModContent.Request("CalamityMod/Skies/SulphurSeaSurface", AssetRequestMode.ImmediateLoad).Value; + // Destroyer glowmasks + DestroyerGlowmasks[0] = ModContent.Request("CalamityMod/ExtraTextures/VanillaBossGlowmasks/DestroyerHeadGlow", AssetRequestMode.AsyncLoad); + DestroyerGlowmasks[1] = ModContent.Request("CalamityMod/ExtraTextures/VanillaBossGlowmasks/DestroyerBodyGlow", AssetRequestMode.AsyncLoad); + DestroyerGlowmasks[2] = ModContent.Request("CalamityMod/ExtraTextures/VanillaBossGlowmasks/DestroyerTailGlow", AssetRequestMode.AsyncLoad); + + // Wall of Flesh glowmasks + WallOfFleshEyeGlowmask = ModContent.Request("CalamityMod/ExtraTextures/VanillaBossGlowmasks/WallOfFleshEyeTelegraphGlow", AssetRequestMode.AsyncLoad); + WallOfFleshDemonSickleTexture = ModContent.Request("CalamityMod/Projectiles/Melee/ForbiddenOathbladeProjectile", AssetRequestMode.AsyncLoad); + + // Master Rev+ Skeletron Prime textures + ChadPrime = ModContent.Request("CalamityMod/ExtraTextures/ChadPrime", AssetRequestMode.AsyncLoad); + ChadPrimeEyeGlowmask = ModContent.Request("CalamityMod/ExtraTextures/ChadPrimeHeadGlow", AssetRequestMode.AsyncLoad); + // TODO -- Sky shaders should probably be loaded in a ModSystem Filters.Scene["CalamityMod:DevourerofGodsHead"] = new Filter(new DoGScreenShaderData("FilterMiniTower").UseColor(0.4f, 0.1f, 1.0f).UseOpacity(0.5f), EffectPriority.VeryHigh); SkyManager.Instance["CalamityMod:DevourerofGodsHead"] = new DoGSky(); @@ -305,7 +323,7 @@ namespace CalamityMod Filters.Scene["CalamityMod:Leviathan"] = new Filter(new LevScreenShaderData("FilterMiniTower").UseColor(0f, 0f, 0.5f).UseOpacity(0.5f), EffectPriority.VeryHigh); SkyManager.Instance["CalamityMod:Leviathan"] = new LevSky(); - Filters.Scene["CalamityMod:SupremeCalamitas"] = new Filter(new SCalScreenShaderData("FilterMiniTower").UseColor(1.1f, 0.3f, 0.3f).UseOpacity(0.65f), EffectPriority.VeryHigh); + Filters.Scene["CalamityMod:SupremeCalamitas"] = new Filter(new SCalScreenShaderData("FilterMiniTower").UseColor(Color.Transparent).UseOpacity(0f), EffectPriority.VeryHigh); SkyManager.Instance["CalamityMod:SupremeCalamitas"] = new SCalSky(); Filters.Scene["CalamityMod:Signus"] = new Filter(new SignusScreenShaderData("FilterMiniTower").UseColor(0.35f, 0.1f, 0.55f).UseOpacity(0.35f), EffectPriority.VeryHigh); @@ -328,9 +346,6 @@ namespace CalamityMod SkyManager.Instance["CalamityMod:BrimstoneCrag"] = new BrimstoneCragSky(); SkyManager.Instance["CalamityMod:Astral"] = new AstralSky(); - SkyManager.Instance["CalamityMod:AstralSurface"] = new AstralSkySurface(); - SkyManager.Instance["CalamityMod:AstralDesert"] = new AstralSkyDesert(); - SkyManager.Instance["CalamityMod:AstralSnow"] = new AstralSkySnow(); SkyManager.Instance["CalamityMod:SulphurSea"] = new SulphurSeaSky(); SkyManager.Instance["CalamityMod:Cryogen"] = new CryogenSky(); SkyManager.Instance["CalamityMod:StormWeaverFlash"] = new StormWeaverFlashSky(); @@ -389,7 +404,6 @@ namespace CalamityMod return Color.Lerp(player.hairColor, new Color(186, 85, 211), stealthInterpolant); })); - PopupGUIManager.LoadGUIs(); InvasionProgressUIManager.LoadGUIs(); } #endregion @@ -401,9 +415,11 @@ namespace CalamityMod ancientsAwakened = null; bossChecklist = null; + coloredDamageTypes = null; crouchMod = null; dialogueTweak = null; fargos = null; + luminance = null; magicStorage = null; overhaul = null; redemption = null; @@ -420,8 +436,6 @@ namespace CalamityMod DRValues = null; bossKillTimes?.Clear(); bossKillTimes = null; - bossVelocityDamageScaleValues?.Clear(); - bossVelocityDamageScaleValues = null; BalancingChangesManager.Unload(); Attunement.Unload(); @@ -646,12 +660,12 @@ namespace CalamityMod // // VANILLA BOSSES // - { NPCID.KingSlime, 3600 }, // 1:00 (60 seconds) + { NPCID.KingSlime, 5400 }, // 1:30 (90 seconds) { NPCID.EyeofCthulhu, 5400 }, // 1:30 (90 seconds) { NPCID.EaterofWorldsHead, 7200 }, // 2:00 (120 seconds) { NPCID.EaterofWorldsBody, 7200 }, { NPCID.EaterofWorldsTail, 7200 }, - { NPCID.BrainofCthulhu, 5400 }, // 1:30 (90 seconds, total length of fight including Creepers phase) + { NPCID.BrainofCthulhu, 7200 }, // 2:00 (120 seconds, total length of fight including Creepers phase) { NPCID.Creeper, 1800 }, // 0:30 (30 seconds, length of Creepers phase) { NPCID.Deerclops, 5400 }, // 1:30 (90 seconds) { NPCID.QueenBee, 7200 }, // 2:00 (120 seconds) @@ -678,9 +692,9 @@ namespace CalamityMod // // CALAMITY BOSSES // - { ModContent.NPCType(), 3600 }, // 1:00 (60 seconds) - { ModContent.NPCType(), 3600 }, - { ModContent.NPCType(), 3600 }, + { ModContent.NPCType(), 5400 }, // 1:30 (90 seconds) + { ModContent.NPCType(), 5400 }, + { ModContent.NPCType(), 5400 }, { ModContent.NPCType(), 5400 }, // 1:30 (90 seconds) { ModContent.NPCType(), 7200 }, // 2:00 (120 seconds) { ModContent.NPCType(), 7200 }, // 2:00 (120 seconds) @@ -736,126 +750,6 @@ namespace CalamityMod } #endregion - #region Boss Velocity Contact Damage Scale Values - private void SetupBossVelocityScalingValues() - { - bossVelocityDamageScaleValues = new SortedDictionary { - { NPCID.KingSlime, velocityScaleMin }, - { NPCID.EyeofCthulhu, velocityScaleMin }, // Increases in phase 2 - { NPCID.EaterofWorldsHead, bitingEnemeyVelocityScale }, - { NPCID.EaterofWorldsBody, velocityScaleMin }, - { NPCID.EaterofWorldsTail, velocityScaleMin }, - { NPCID.Creeper, velocityScaleMin }, - { NPCID.BrainofCthulhu, velocityScaleMin }, - { NPCID.QueenBee, velocityScaleMin }, - { NPCID.SkeletronHead, velocityScaleMin }, - { NPCID.SkeletronHand, velocityScaleMin }, - { NPCID.TheHungry, bitingEnemeyVelocityScale }, - { NPCID.TheHungryII, bitingEnemeyVelocityScale }, - { NPCID.LeechHead, bitingEnemeyVelocityScale }, - { NPCID.LeechBody, velocityScaleMin }, - { NPCID.LeechTail, velocityScaleMin }, - { NPCID.QueenSlimeBoss, velocityScaleMin }, - { NPCID.Spazmatism, velocityScaleMin }, // Increases in phase 2 - { NPCID.Retinazer, velocityScaleMin }, - { NPCID.TheDestroyer, bitingEnemeyVelocityScale }, - { NPCID.TheDestroyerBody, velocityScaleMin }, - { NPCID.TheDestroyerTail, velocityScaleMin }, - { NPCID.SkeletronPrime, velocityScaleMin }, - { NPCID.PrimeCannon, velocityScaleMin }, - { NPCID.PrimeLaser, velocityScaleMin }, - { NPCID.PrimeSaw, velocityScaleMin }, - { NPCID.PrimeVice, velocityScaleMin }, - { NPCID.Plantera, velocityScaleMin }, // Increases in phase 2 - { NPCID.PlanterasTentacle, bitingEnemeyVelocityScale }, - { ModContent.NPCType(), bitingEnemeyVelocityScale }, - { NPCID.HallowBoss, velocityScaleMin }, - { NPCID.Golem, velocityScaleMin }, - { NPCID.GolemFistLeft, velocityScaleMin }, - { NPCID.GolemFistRight, velocityScaleMin }, - { NPCID.GolemHead, velocityScaleMin }, - { NPCID.DukeFishron, velocityScaleMin }, - { ModContent.NPCType(), bitingEnemeyVelocityScale }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), bitingEnemeyVelocityScale }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), bitingEnemeyVelocityScale }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), bitingEnemeyVelocityScale }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), bitingEnemeyVelocityScale }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), bitingEnemeyVelocityScale }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), bitingEnemeyVelocityScale }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), bitingEnemeyVelocityScale }, - { ModContent.NPCType(), bitingEnemeyVelocityScale }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), bitingEnemeyVelocityScale }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), bitingEnemeyVelocityScale }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), bitingEnemeyVelocityScale }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), bitingEnemeyVelocityScale }, - { ModContent.NPCType(), bitingEnemeyVelocityScale }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), bitingEnemeyVelocityScale }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), bitingEnemeyVelocityScale }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, // Increases in phase 2 - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), bitingEnemeyVelocityScale }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), bitingEnemeyVelocityScale } - }; - } - #endregion - #region Music // This function returns an available Calamity Music Mod track, or null if the Calamity Music Mod is not available. diff --git a/CalamityNetcode.cs b/CalamityNetcode.cs index dd9088655a..a75cbdfe5c 100644 --- a/CalamityNetcode.cs +++ b/CalamityNetcode.cs @@ -1,4 +1,6 @@ -using CalamityMod.Events; +using System; +using System.IO; +using CalamityMod.Events; using CalamityMod.Items; using CalamityMod.NPCs; using CalamityMod.NPCs.NormalNPCs; @@ -7,8 +9,6 @@ using CalamityMod.NPCs.TownNPCs; using CalamityMod.TileEntities; using CalamityMod.World; using Microsoft.Xna.Framework; -using System; -using System.IO; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -52,6 +52,19 @@ namespace CalamityMod // Syncs for specific bosses or entities // + case CalamityModMessageType.SyncDestroyerLaserColor: + byte npcIdx3 = reader.ReadByte(); + int laserColor = reader.ReadInt32(); + + // If the NPC in question isn't valid, don't do anything. + NPC npc3 = Main.npc[npcIdx3]; + if (!npc3.active) + break; + + CalamityGlobalNPC cgn3 = npc3.Calamity(); + cgn3.destroyerLaserColor = laserColor; + break; + // This code has been edited to fail gracefully when trying to provide data for an invalid NPC. case CalamityModMessageType.SyncCalamityNPCAIArray: // Read the entire packet regardless of anything @@ -72,6 +85,7 @@ namespace CalamityMod cgn.newAI[2] = ai2; cgn.newAI[3] = ai3; break; + case CalamityModMessageType.SyncVanillaNPCLocalAIArray: // Read the entire packet regardless of anything byte npcIdx2 = reader.ReadByte(); @@ -90,6 +104,7 @@ namespace CalamityMod npc2.localAI[2] = localAI2; npc2.localAI[3] = localAI3; break; + case CalamityModMessageType.SpawnSuperDummy: int x = reader.ReadInt32(); int y = reader.ReadInt32(); @@ -97,34 +112,52 @@ namespace CalamityMod if (Main.netMode != NetmodeID.MultiplayerClient) NPC.NewNPC(new EntitySource_WorldEvent(), x, y, ModContent.NPCType()); break; + case CalamityModMessageType.DeleteAllSuperDummies: if (Main.netMode != NetmodeID.MultiplayerClient) SuperDummy.DeleteDummies(); break; + case CalamityModMessageType.SyncAndroombaSolution: int index = reader.ReadInt32(); int solType = reader.ReadInt32(); if (Main.netMode != NetmodeID.MultiplayerClient) AndroombaFriendly.SwapSolution(index, solType); break; + case CalamityModMessageType.SyncAndroombaAI: - int idx = reader.ReadInt32(); - int phase = reader.ReadInt32(); - if (Main.netMode != NetmodeID.MultiplayerClient) - AndroombaFriendly.ChangeAI(idx, phase); + { + int idx = reader.ReadInt32(); + int phase = reader.ReadInt32(); + if (Main.netMode != NetmodeID.MultiplayerClient) + AndroombaFriendly.ChangeAI(idx, phase); + } break; + + case CalamityModMessageType.SyncSlabCrabAI: + { + int idx = reader.ReadInt32(); + int phase = reader.ReadInt32(); + if (Main.netMode != NetmodeID.MultiplayerClient) + AndroombaFriendly.ChangeAI(idx, phase); + } + break; + case CalamityModMessageType.ServersideSpawnOldDuke: byte playerIndex2 = reader.ReadByte(); CalamityUtils.SpawnOldDuke(playerIndex2); break; + case CalamityModMessageType.ArmoredDiggerCountdownSync: int countdown5 = reader.ReadInt32(); CalamityWorld.ArmoredDiggerSpawnCooldown = countdown5; break; + case CalamityModMessageType.ProvidenceDyeConditionSync: byte npcIndex3 = reader.ReadByte(); (Main.npc[npcIndex3].ModNPC as Providence).hasTakenDaytimeDamage = reader.ReadBoolean(); break; + case CalamityModMessageType.PSCChallengeSync: byte npcIndex4 = reader.ReadByte(); (Main.npc[npcIndex4].ModNPC as Providence).challenge = reader.ReadBoolean(); @@ -146,6 +179,7 @@ namespace CalamityMod NetMessage.SendData(MessageID.SyncNPC, -1, player, null, spawnedNPC); } break; + case CalamityModMessageType.SyncNPCMotionDataToServer: int npcIndex = reader.ReadInt32(); Vector2 center = reader.ReadVector2(); @@ -338,12 +372,14 @@ namespace CalamityMod SyncCooldownDictionary, // Syncs for specific bosses or entities + SyncDestroyerLaserColor, SyncCalamityNPCAIArray, SyncVanillaNPCLocalAIArray, SpawnSuperDummy, DeleteAllSuperDummies, SyncAndroombaSolution, SyncAndroombaAI, + SyncSlabCrabAI, ServersideSpawnOldDuke, ArmoredDiggerCountdownSync, // TODO -- remove this mechanic entirely ProvidenceDyeConditionSync, // TODO -- this packetstorms if you hit Provi with spam weapons. It should ONLY send a packet if the status changes. diff --git a/Cooldowns/AquaticHeartIceShield.cs b/Cooldowns/AquaticHeartIceShield.cs index ee22188cbd..56bcd61b18 100644 --- a/Cooldowns/AquaticHeartIceShield.cs +++ b/Cooldowns/AquaticHeartIceShield.cs @@ -1,5 +1,5 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; using Terraria.Localization; diff --git a/Cooldowns/Cooldown.cs b/Cooldowns/Cooldown.cs index 8c674a4b6e..3c1c6a1928 100644 --- a/Cooldowns/Cooldown.cs +++ b/Cooldowns/Cooldown.cs @@ -30,6 +30,6 @@ // The differences between all the cooldowns are implemented as various subclasses of CooldownHandler. public class Cooldown : Cooldown where T : CooldownHandler { - internal Cooldown(string id, ushort nid) : base(id, nid) {} + internal Cooldown(string id, ushort nid) : base(id, nid) { } } } diff --git a/Cooldowns/CooldownHandler.cs b/Cooldowns/CooldownHandler.cs index f9d83b7837..1d8edf5baf 100644 --- a/Cooldowns/CooldownHandler.cs +++ b/Cooldowns/CooldownHandler.cs @@ -1,10 +1,10 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; -using Terraria.Localization; using Terraria.Audio; using Terraria.Graphics.Shaders; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Cooldowns diff --git a/Cooldowns/CooldownInstance.cs b/Cooldowns/CooldownInstance.cs index 7a71c25f61..b21e8f7c15 100644 --- a/Cooldowns/CooldownInstance.cs +++ b/Cooldowns/CooldownInstance.cs @@ -1,8 +1,8 @@ using System; using System.IO; +using CalamityMod.UI; using Terraria; using Terraria.ModLoader.IO; -using CalamityMod.UI; namespace CalamityMod.Cooldowns { diff --git a/Cooldowns/CooldownRegistry.cs b/Cooldowns/CooldownRegistry.cs index 28504bc654..53822657c1 100644 --- a/Cooldowns/CooldownRegistry.cs +++ b/Cooldowns/CooldownRegistry.cs @@ -23,9 +23,6 @@ namespace CalamityMod.Cooldowns registry = new Cooldown[defaultSize]; nameToNetID = new Dictionary(defaultSize); - // TODO -- CooldownHandlers should be ILoadable in 1.4 - RegisterModCooldowns(CalamityMod.Instance); - #region Unused manual registration left here as backup // Vanilla cooldowns represented by the interface //var potionSickness = Register(PotionSickness.ID); @@ -63,26 +60,29 @@ namespace CalamityMod.Cooldowns #endregion } - public static void RegisterModCooldowns(Mod mod) + public static void RegisterModCooldowns() { Type baseHandlerType = typeof(CooldownHandler); - foreach (Type type in AssemblyManager.GetLoadableTypes(mod.Code)) + foreach (Mod mod in ModLoader.Mods) { - if (type.IsSubclassOf(baseHandlerType) && !type.IsAbstract && type != baseHandlerType) + foreach (Type type in AssemblyManager.GetLoadableTypes(mod.Code)) { - //Get the static property ID of the handler - string handlerID = (string)type.GetProperty("ID").GetValue(null); + if (type.IsSubclassOf(baseHandlerType) && !type.IsAbstract && type != baseHandlerType) + { + //Get the static property ID of the handler + string handlerID = (string)type.GetProperty("ID").GetValue(null); - //If for whatever reason the ID is not set, create an ID from the mod and handler name - if (handlerID == null) - handlerID = mod.Name + "_" + type.Name; + //If for whatever reason the ID is not set, create an ID from the mod and handler name + if (handlerID == null) + handlerID = mod.Name + "_" + type.Name; - //Use reflection to call the method. You can't use the type as the generic type argument of register here - MethodInfo methodInfo = typeof(CooldownRegistry).GetMethod("Register", BindingFlags.Public | BindingFlags.Static); - Type[] genericArguments = new Type[] { type }; + //Use reflection to call the method. You can't use the type as the generic type argument of register here + MethodInfo methodInfo = typeof(CooldownRegistry).GetMethod("Register", BindingFlags.Public | BindingFlags.Static); + Type[] genericArguments = new Type[] { type }; - MethodInfo genericRegister = methodInfo.MakeGenericMethod(genericArguments); - genericRegister.Invoke(null, new object[] { handlerID }); + MethodInfo genericRegister = methodInfo.MakeGenericMethod(genericArguments); + genericRegister.Invoke(null, new object[] { handlerID }); + } } } } diff --git a/Cooldowns/CounterScarf.cs b/Cooldowns/CounterScarf.cs index 133a2ee36f..ddb548d6b2 100644 --- a/Cooldowns/CounterScarf.cs +++ b/Cooldowns/CounterScarf.cs @@ -1,5 +1,5 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; using Terraria.Localization; diff --git a/Cooldowns/DivineBless.cs b/Cooldowns/DivineBless.cs index 4c7acd8641..adab8f14c4 100644 --- a/Cooldowns/DivineBless.cs +++ b/Cooldowns/DivineBless.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Cooldowns public override bool ShouldDisplay => true; public override LocalizedText DisplayName => CalamityUtils.GetText($"UI.Cooldowns.{ID}"); public override string Texture => "CalamityMod/Cooldowns/DivineBless"; - public override Color OutlineColor => new Color(233, 192, 68); + public override Color OutlineColor => new Color(233, 192, 68); public override Color CooldownStartColor => new Color(177, 105, 33); public override Color CooldownEndColor => new Color(233, 192, 68); diff --git a/Cooldowns/EvasionScarf.cs b/Cooldowns/EvasionScarf.cs index 27a0ffbc89..14b4aae1a2 100644 --- a/Cooldowns/EvasionScarf.cs +++ b/Cooldowns/EvasionScarf.cs @@ -1,5 +1,5 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; using Terraria.Localization; diff --git a/Cooldowns/GaelsRage.cs b/Cooldowns/GaelsRage.cs index 115d83a357..203f4c598d 100644 --- a/Cooldowns/GaelsRage.cs +++ b/Cooldowns/GaelsRage.cs @@ -1,5 +1,5 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; using Terraria.Localization; diff --git a/Cooldowns/LifeSteal.cs b/Cooldowns/LifeSteal.cs index 2e7c6fe571..560e78b220 100644 --- a/Cooldowns/LifeSteal.cs +++ b/Cooldowns/LifeSteal.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria.Localization; namespace CalamityMod.Cooldowns diff --git a/Cooldowns/OmegaBlue.cs b/Cooldowns/OmegaBlue.cs index 3b564fa1a5..179509e020 100644 --- a/Cooldowns/OmegaBlue.cs +++ b/Cooldowns/OmegaBlue.cs @@ -1,9 +1,10 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.Audio; using Terraria.Graphics.Shaders; +using Terraria.ID; using Terraria.Localization; using static Terraria.ModLoader.ModContent; @@ -26,7 +27,7 @@ namespace CalamityMod.Cooldowns { for (int i = 0; i < 66; i++) { - int d = Dust.NewDust(instance.player.position, instance.player.width, instance.player.height, 20, 0, 0, 100, Color.Transparent, 2.6f); + int d = Dust.NewDust(instance.player.position, instance.player.width, instance.player.height, DustID.PurificationPowder, 0, 0, 100, Color.Transparent, 2.6f); Main.dust[d].noGravity = true; Main.dust[d].noLight = true; Main.dust[d].fadeIn = 1f; diff --git a/Cooldowns/ParryCooldown.cs b/Cooldowns/ParryCooldown.cs index 47a8fef129..e7cdbb218b 100644 --- a/Cooldowns/ParryCooldown.cs +++ b/Cooldowns/ParryCooldown.cs @@ -12,13 +12,13 @@ namespace CalamityMod.Cooldowns public override Color OutlineColor => outlineColor; public override Color CooldownStartColor => cooldownColorStart; public override Color CooldownEndColor => cooldownColorEnd; - + //It's the same cooldown with different skins each time, basically. public string skinTexture; public Color outlineColor; public Color cooldownColorStart; public Color cooldownColorEnd; - + public ParryCooldown() : this("") { } public ParryCooldown(string skin) { @@ -30,7 +30,7 @@ namespace CalamityMod.Cooldowns cooldownColorStart = new Color(181, 136, 177); cooldownColorEnd = new Color(255, 194, 161); break; - + //readd if spritework for the cooldown is done at a later point /*case "flamelickedshell": skinTexture = "FlameLickedShellParry"; diff --git a/Cooldowns/PlagueBlackout.cs b/Cooldowns/PlagueBlackout.cs index 5bf62e24e6..e63253123b 100644 --- a/Cooldowns/PlagueBlackout.cs +++ b/Cooldowns/PlagueBlackout.cs @@ -1,9 +1,10 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.Audio; using Terraria.Graphics.Shaders; +using Terraria.ID; using Terraria.Localization; using static Terraria.ModLoader.ModContent; @@ -27,7 +28,7 @@ namespace CalamityMod.Cooldowns int h = instance.player.height; for (int i = 0; i < 66; i++) { - int d = Dust.NewDust(pos, w, h, 89, 0, 0, 100, default, 1.5f); + int d = Dust.NewDust(pos, w, h, DustID.GemEmerald, 0, 0, 100, default, 1.5f); Main.dust[d].noGravity = true; Main.dust[d].velocity *= 6.6f; } diff --git a/Cooldowns/ProfanedSoulShield.cs b/Cooldowns/ProfanedSoulShield.cs index 2955b1b30d..c209dc63ad 100644 --- a/Cooldowns/ProfanedSoulShield.cs +++ b/Cooldowns/ProfanedSoulShield.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Cooldowns { public class ProfanedSoulShield : CooldownHandler { - + private CalamityPlayer CalPlayer => instance.player.Calamity(); private int CorrectMaxDurability => CalPlayer.profanedCrystalBuffs ? ProfanedSoulCrystal.ShieldDurabilityMax @@ -36,7 +36,7 @@ namespace CalamityMod.Cooldowns } return result; } - + private float AdjustedCompletion => instance.timeLeft / (float)CorrectMaxDurability; public static new string ID => "ProfanedSoulShieldDurability"; @@ -108,7 +108,7 @@ namespace CalamityMod.Cooldowns public override Color OutlineColor => new Color(57, 195, 237); public override Color CooldownStartColor => Color.Lerp(ringColorLerpStart, ringColorLerpEnd, instance.Completion); public override Color CooldownEndColor => Color.Lerp(ringColorLerpStart, ringColorLerpEnd, instance.Completion); - + public override void Tick() => instance.player.Calamity().playedProfanedSoulShieldSound = false; public override SoundStyle? EndSound => Providence.BurnStartSound; diff --git a/Cooldowns/SandsmokeBomb.cs b/Cooldowns/SandsmokeBomb.cs index 971383af77..913f444ade 100644 --- a/Cooldowns/SandsmokeBomb.cs +++ b/Cooldowns/SandsmokeBomb.cs @@ -1,14 +1,14 @@ -using Microsoft.Xna.Framework; +using System; +using CalamityMod.Items.Armor.DesertProwler; +using CalamityMod.Particles; +using CalamityMod.UI; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.Audio; using Terraria.Graphics.Shaders; using Terraria.Localization; using static Terraria.ModLoader.ModContent; -using CalamityMod.Items.Armor.DesertProwler; -using CalamityMod.Particles; -using CalamityMod.UI; namespace CalamityMod.Cooldowns { diff --git a/Cooldowns/SpeedBlasterBoost.cs b/Cooldowns/SpeedBlasterBoost.cs new file mode 100644 index 0000000000..b12f4dd065 --- /dev/null +++ b/Cooldowns/SpeedBlasterBoost.cs @@ -0,0 +1,19 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.Localization; +using static CalamityMod.CalamityUtils; + +namespace CalamityMod.Cooldowns +{ + public class SpeedBlasterBoost : CooldownHandler + { + public static new string ID => "SpeedBlasterBoost"; + public override bool ShouldDisplay => true; + public override LocalizedText DisplayName => CalamityUtils.GetText($"UI.Cooldowns.{ID}"); + public override string Texture => "CalamityMod/Cooldowns/SpeedBlasterBoost"; + public override Color OutlineColor => new Color(207, 207, 207); + public override Color CooldownStartColor => new Color(235, 33, 130); + public override Color CooldownEndColor => new Color(39, 227, 208); + } +} diff --git a/Cooldowns/SpeedBlasterBoost.png b/Cooldowns/SpeedBlasterBoost.png new file mode 100644 index 0000000000..1f97a07996 Binary files /dev/null and b/Cooldowns/SpeedBlasterBoost.png differ diff --git a/Cooldowns/SpeedBlasterBoostOutline.png b/Cooldowns/SpeedBlasterBoostOutline.png new file mode 100644 index 0000000000..245f680cb5 Binary files /dev/null and b/Cooldowns/SpeedBlasterBoostOutline.png differ diff --git a/Cooldowns/SpeedBlasterBoostOverlay.png b/Cooldowns/SpeedBlasterBoostOverlay.png new file mode 100644 index 0000000000..da21d02b34 Binary files /dev/null and b/Cooldowns/SpeedBlasterBoostOverlay.png differ diff --git a/Cooldowns/WulfrumBastion.cs b/Cooldowns/WulfrumBastion.cs index 835e2cb3e9..c86f277c1b 100644 --- a/Cooldowns/WulfrumBastion.cs +++ b/Cooldowns/WulfrumBastion.cs @@ -1,13 +1,13 @@ -using Microsoft.Xna.Framework; +using System; +using CalamityMod.Items.Armor.Wulfrum; +using CalamityMod.UI; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.Audio; using Terraria.Graphics.Shaders; using Terraria.Localization; using static Terraria.ModLoader.ModContent; -using CalamityMod.Items.Armor.Wulfrum; -using CalamityMod.UI; namespace CalamityMod.Cooldowns { diff --git a/CustomRecipes/ArsenalTierGatedRecipe.cs b/CustomRecipes/ArsenalTierGatedRecipe.cs index 8909f71566..84f83c9513 100644 --- a/CustomRecipes/ArsenalTierGatedRecipe.cs +++ b/CustomRecipes/ArsenalTierGatedRecipe.cs @@ -8,7 +8,7 @@ namespace CalamityMod.CustomRecipes { public static LocalizedText ConstructRecipeCondition(int tier, out Func condition) { - condition = new Func(()=>HasTierBeenLearned(tier)); + condition = new Func(() => HasTierBeenLearned(tier)); return Language.GetOrRegister($"Mods.CalamityMod.Misc.Tier{tier}ArsenalRecipeCondition"); } diff --git a/DamageClasses/AverageDamageClass.cs b/DamageClasses/AverageDamageClass.cs index 4f8eeb796f..a5e8870d30 100644 --- a/DamageClasses/AverageDamageClass.cs +++ b/DamageClasses/AverageDamageClass.cs @@ -6,7 +6,7 @@ namespace CalamityMod { internal static AverageDamageClass Instance; - internal static readonly StatInheritanceData TwentyPercentBoost = new (0.2f, 0.2f, 0.2f, 0.2f, 0.2f); + internal static readonly StatInheritanceData TwentyPercentBoost = new(0.2f, 0.2f, 0.2f, 0.2f, 0.2f); public override void Load() => Instance = this; public override void Unload() => Instance = null; diff --git a/DataStructures/Attunement.cs b/DataStructures/Attunement.cs index 815290b206..10b5087a54 100644 --- a/DataStructures/Attunement.cs +++ b/DataStructures/Attunement.cs @@ -26,7 +26,7 @@ namespace CalamityMod.DataStructures public static void Load() { - attunementArray = new Attunement[] { + attunementArray = new Attunement[] { new DefaultAttunement(), new HotAttunement(), new ColdAttunement(), new TropicalAttunement(), new EvilAttunement(), new TrueDefaultAttunement(), new TrueHotAttunement(), new TrueColdAttunement(), new TrueTropicalAttunement(), new TrueEvilAttunement(), new HolyAttunement(), new AstralAttunement(), new MarineAttunement(), new WhirlwindAttunement(), new FlailBladeAttunement(), new SuperPogoAttunement(), new ShockwaveAttunement(), @@ -508,7 +508,7 @@ namespace CalamityMod.DataStructures public override void PassiveEffect(Player player, IEntitySource source, ref int UseTimer, ref bool Procced, Projectile projectile = null) { - if (UseTimer % 30 == 29 && Main.rand.Next(2) == 0) + if (UseTimer % 30 == 29 && Main.rand.NextBool(2)) { SoundEngine.PlaySound(SoundID.Item78); int damage = (int)player.GetTotalDamage().ApplyTo(OmegaBiomeBlade.WhirlwindAttunement_PassiveBaseDamage); diff --git a/DataStructures/BaseBossSpawnContext.cs b/DataStructures/BaseBossSpawnContext.cs index 6fcbce1d88..da85e2a168 100644 --- a/DataStructures/BaseBossSpawnContext.cs +++ b/DataStructures/BaseBossSpawnContext.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; namespace CalamityMod.DataStructures { diff --git a/DataStructures/BezierCurve.cs b/DataStructures/BezierCurve.cs index 983bdde572..0ce330772d 100644 --- a/DataStructures/BezierCurve.cs +++ b/DataStructures/BezierCurve.cs @@ -1,5 +1,5 @@ -using Microsoft.Xna.Framework; -using System.Collections.Generic; +using System.Collections.Generic; +using Microsoft.Xna.Framework; namespace CalamityMod.DataStructures { diff --git a/DataStructures/Circle.cs b/DataStructures/Circle.cs index 778fd6c1a6..70a5e852d6 100644 --- a/DataStructures/Circle.cs +++ b/DataStructures/Circle.cs @@ -1,5 +1,5 @@ +using System; using Microsoft.Xna.Framework; -using System; using Terraria; namespace CalamityMod.DataStructures diff --git a/DataStructures/DoGCartSegment.cs b/DataStructures/DoGCartSegment.cs index e2f3ef6ba8..e765db0187 100644 --- a/DataStructures/DoGCartSegment.cs +++ b/DataStructures/DoGCartSegment.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; namespace CalamityMod.DataStructures diff --git a/DataStructures/ExactPositionBossSpawnContext.cs b/DataStructures/ExactPositionBossSpawnContext.cs index f5c81f9b5b..6b4bd61ef4 100644 --- a/DataStructures/ExactPositionBossSpawnContext.cs +++ b/DataStructures/ExactPositionBossSpawnContext.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; namespace CalamityMod.DataStructures { diff --git a/DataStructures/GemTechArmorState.cs b/DataStructures/GemTechArmorState.cs index c9648e5931..8cdc3cc0d4 100644 --- a/DataStructures/GemTechArmorState.cs +++ b/DataStructures/GemTechArmorState.cs @@ -1,13 +1,15 @@ -using CalamityMod.Projectiles.Melee; +using CalamityMod.CalPlayer; +using CalamityMod.Items.Accessories; +using CalamityMod.Items.Armor.GemTech; +using CalamityMod.Items.Potions.Alcohol; +using CalamityMod.Projectiles.Melee; using CalamityMod.Projectiles.Ranged; using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using CalamityMod.Items.Armor.GemTech; -using CalamityMod.Items.Potions.Alcohol; namespace CalamityMod.DataStructures { @@ -207,12 +209,17 @@ namespace CalamityMod.DataStructures public void PlayerOnHitEffects(int hitDamage) { // Don't do anything if the player is not wearing the Gem Tech set. - if (!Owner.Calamity().GemTechSet) + var cgp = Owner.Calamity(); + if (!cgp.GemTechSet) return; bool gemWasLost = false; int gemDamage = 0; - if (hitDamage >= GemTechHeadgear.GemBreakDamageLowerBound) + bool largeEnoughRegularHit = hitDamage >= GemTechHeadgear.GemBreakDamageLowerBound; + // 09FEB2024: Ozzatron: chalice of the blood god no longer protects you when using gem tech armor. + // It is now slightly anti-synergetic, in that taking tiny hits when you're already bleeding will make you keep losing gems. + bool largeEnoughChaliceHit = cgp.chaliceOfTheBloodGod && hitDamage == ChaliceOfTheBloodGod.MinAllowedDamage && cgp.chaliceBleedoutBuffer >= GemTechHeadgear.GemBreakDamageLowerBound; + if (largeEnoughRegularHit || largeEnoughChaliceHit) { // Destroy the rogue gem. if (GemIsActive(GemTechArmorGemType.Rogue) && GemThatShouldBeLost == GemTechArmorGemType.Rogue) diff --git a/DataStructures/NPCStats.cs b/DataStructures/NPCStats.cs index 0166b9138e..4c0a22518d 100644 --- a/DataStructures/NPCStats.cs +++ b/DataStructures/NPCStats.cs @@ -1,4 +1,6 @@ -using CalamityMod.NPCs.PrimordialWyrm; +using System; +using System.Collections.Generic; +using CalamityMod.NPCs.AcidRain; using CalamityMod.NPCs.AquaticScourge; using CalamityMod.NPCs.AstrumAureus; using CalamityMod.NPCs.AstrumDeus; @@ -11,8 +13,8 @@ using CalamityMod.NPCs.Cryogen; using CalamityMod.NPCs.DesertScourge; using CalamityMod.NPCs.DevourerofGods; using CalamityMod.NPCs.ExoMechs.Apollo; -using CalamityMod.NPCs.ExoMechs.Artemis; using CalamityMod.NPCs.ExoMechs.Ares; +using CalamityMod.NPCs.ExoMechs.Artemis; using CalamityMod.NPCs.ExoMechs.Thanatos; using CalamityMod.NPCs.HiveMind; using CalamityMod.NPCs.Leviathan; @@ -21,6 +23,7 @@ using CalamityMod.NPCs.OldDuke; using CalamityMod.NPCs.Perforator; using CalamityMod.NPCs.PlaguebringerGoliath; using CalamityMod.NPCs.Polterghast; +using CalamityMod.NPCs.PrimordialWyrm; using CalamityMod.NPCs.ProfanedGuardians; using CalamityMod.NPCs.Providence; using CalamityMod.NPCs.Ravager; @@ -32,12 +35,9 @@ using CalamityMod.NPCs.Yharon; using CalamityMod.Projectiles.Boss; using CalamityMod.Projectiles.Enemy; using CalamityMod.World; -using System; -using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.NPCs.AcidRain; namespace CalamityMod { @@ -182,8 +182,6 @@ namespace CalamityMod { NPCID.BrainofCthulhu, 0.9 }, - { NPCID.Deerclops, 1 }, - { ModContent.NPCType(), 0.9 }, { ModContent.NPCType(), 0.9 }, @@ -198,8 +196,6 @@ namespace CalamityMod { NPCID.WallofFlesh, 1.5 }, { NPCID.WallofFleshEye, 1.5 }, - { NPCID.QueenSlimeBoss, 1 }, - { ModContent.NPCType(), 1.15 }, { NPCID.Spazmatism, 0.85 }, @@ -217,6 +213,7 @@ namespace CalamityMod { ModContent.NPCType(), 0.8 }, { NPCID.SkeletronPrime, 0.85 }, + { ModContent.NPCType(), 0.85 }, { NPCID.PrimeCannon, 0.85 }, { NPCID.PrimeLaser, 0.85 }, { NPCID.PrimeSaw, 0.85 }, @@ -297,114 +294,121 @@ namespace CalamityMod EnemyStats.ContactDamageValues = new SortedDictionary { - { NPCID.KingSlime, new int[] { 40, 64, 80, 88, 96 } }, + { NPCID.KingSlime, new int[] { 40, 64, 80, 96, 144 } }, + { ModContent.NPCType(), new int[] { 30, 44, 60, 76, 114 } }, - { ModContent.NPCType(), new int[] { 30, 66, 88, 99, 132 } }, - { ModContent.NPCType(), new int[] { 16, 32, 40, 44, 60 } }, - { ModContent.NPCType(), new int[] { 12, 24, 30, 32, 42 } }, - { ModContent.NPCType(), new int[] { 20, 44, 60, 70, 90 } }, - { ModContent.NPCType(), new int[] { 14, 28, 32, 36, 45 } }, - { ModContent.NPCType(), new int[] { 8, 16, 20, 24, 30 } }, + { ModContent.NPCType(), new int[] { 45, 66, 88, 110, 165 } }, + { ModContent.NPCType(), new int[] { 24, 32, 40, 48, 72 } }, + { ModContent.NPCType(), new int[] { 18, 24, 30, 36, 54 } }, + { ModContent.NPCType(), new int[] { 30, 44, 60, 76, 114 } }, + { ModContent.NPCType(), new int[] { 21, 28, 32, 36, 63 } }, + { ModContent.NPCType(), new int[] { 12, 16, 20, 24, 36 } }, + { ModContent.NPCType(), new int[] { 30, 44, 60, 76, 114 } }, + { ModContent.NPCType(), new int[] { 21, 28, 32, 36, 63 } }, + { ModContent.NPCType(), new int[] { 12, 16, 20, 24, 36 } }, { NPCID.EyeofCthulhu, new int[] { - 15, // 23 in phase 2 - 30, // 36 in phase 2, 40 in phase 3 + 24, // 36 in phase 2 + 30, // 45 in phase 2 40, // 48 in phase 2, 56 in phase 3 - 60, // Same for all phases - 51 } }, // Vanilla: 54 in phase 2, 60 in phase 3; Rev: 61 in phase 2, 71 in phase 3; Death: 71 at all times - { NPCID.ServantofCthulhu, new int[] { 12, 24, 30, 34, 42 } }, + 50, // 60 in phase 2, 70 in phase 3 + 75 } }, // Vanilla: 113 in phase 2; Rev+: 90 in phase 2, 105 in phase 3 + { NPCID.ServantofCthulhu, new int[] { 18, 24, 30, 36, 54 } }, + { ModContent.NPCType(), new int[] { 20, 26, 34, 42, 63 } }, // In phase 2: 26, 34, 44, 55, 82 - { ModContent.NPCType(), new int[] { 40, 64, 80, 88, 120 } }, - { ModContent.NPCType(), new int[] { 25, 50, 62, 70, 75 } }, + { ModContent.NPCType(), new int[] { 40, 64, 80, 96, 144 } }, + { ModContent.NPCType(), new int[] { 25, 50, 62, 74, 111 } }, - { NPCID.EaterofWorldsHead, new int[] { 25, 55, 77, 88, 132 } }, - { NPCID.EaterofWorldsBody, new int[] { 15, 24, 32, 40, 60 } }, - { NPCID.EaterofWorldsTail, new int[] { 10, 16, 24, 32, 42 } }, + { NPCID.EaterofWorldsHead, new int[] { 38, 55, 77, 99, 165 } }, + { NPCID.EaterofWorldsBody, new int[] { 18, 24, 32, 40, 60 } }, + { NPCID.EaterofWorldsTail, new int[] { 12, 16, 24, 32, 48 } }, { NPCID.VileSpitEaterOfWorlds, new int[] { -1, 64, 64, 64, 96 } }, - { NPCID.BrainofCthulhu, new int[] { 30, 54, 81, 99, 135 } }, - { NPCID.Creeper, new int[] { 20, 36, 54, 72, 90 } }, + { NPCID.BrainofCthulhu, new int[] { 36, 54, 81, 108, 162 } }, + { NPCID.Creeper, new int[] { 24, 36, 66, 96, 144 } }, - { ModContent.NPCType(), new int[] { 35, 63, 81, 90, 135 } }, - { ModContent.NPCType(), new int[] { 25, 50, 62, 68, 90 } }, + { ModContent.NPCType(), new int[] { 42, 63, 81, 99, 162 } }, + { ModContent.NPCType(), new int[] { 30, 50, 62, 74, 111 } }, - { ModContent.NPCType(), new int[] { 30, 54, 63, 72, 108 } }, - { ModContent.NPCType(), new int[] { 45, 90, 108, 118, 150 } }, - { ModContent.NPCType(), new int[] { 24, 48, 56, 60, 75 } }, - { ModContent.NPCType(), new int[] { 18, 36, 42, 46, 60 } }, - { ModContent.NPCType(), new int[] { 35, 70, 84, 92, 126 } }, - { ModContent.NPCType(), new int[] { 21, 42, 50, 54, 69 } }, - { ModContent.NPCType(), new int[] { 14, 28, 34, 38, 54 } }, - { ModContent.NPCType(), new int[] { 30, 60, 72, 80, 102 } }, - { ModContent.NPCType(), new int[] { 18, 36, 42, 46, 60 } }, - { ModContent.NPCType(), new int[] { 10, 20, 26, 30, 45 } }, + { ModContent.NPCType(), new int[] { 36, 54, 63, 72, 108 } }, + { ModContent.NPCType(), new int[] { 54, 90, 108, 126, 189 } }, + { ModContent.NPCType(), new int[] { 28, 48, 56, 64, 96 } }, + { ModContent.NPCType(), new int[] { 22, 36, 42, 48, 72 } }, + { ModContent.NPCType(), new int[] { 42, 70, 84, 98, 147 } }, + { ModContent.NPCType(), new int[] { 24, 42, 50, 58, 87 } }, + { ModContent.NPCType(), new int[] { 18, 28, 34, 40, 60 } }, + { ModContent.NPCType(), new int[] { 36, 60, 72, 84, 126 } }, + { ModContent.NPCType(), new int[] { 20, 36, 42, 48, 72 } }, + { ModContent.NPCType(), new int[] { 14, 20, 26, 32, 48 } }, - { NPCID.QueenBee, new int[] { 30, 54, 81, 99, 135 } }, - { NPCID.Bee, new int[] { 20, 24, 30, 36, 54 } }, - { NPCID.BeeSmall, new int[] { 15, 18, 24, 30, 45 } }, + { NPCID.QueenBee, new int[] { 36, 54, 81, 108, 162 } }, + { NPCID.Bee, new int[] { 20, 24, 48, 72, 108 } }, + { NPCID.BeeSmall, new int[] { 15, 18, 36, 54, 81 } }, { NPCID.SkeletronHead, new int[] { - 35, // Same for all phases + 42, // 55 while spinning 77, // 100 while spinning 88, // 114 while spinning 99, // 128 while spinning - 132 } }, // 171 while spinning - { NPCID.SkeletronHand, new int[] { 20, 44, 55, 66, 99 } }, - { NPCID.ChaosBall, new int[] { -1, -1, -1, 40, 60 } }, + 165 } }, // 215 while spinning + { NPCID.SkeletronHand, new int[] { 32, 44, 77, 110, 165 } }, - { NPCID.Deerclops, new int[] { 20, 40, 50, 60, 80 } }, + { NPCID.Deerclops, new int[] { 20, 40, 50, 60, 90 } }, - { ModContent.NPCType(), new int[] { 40, 80, 96, 104, 135 } }, - { ModContent.NPCType(), new int[] { 45, 90, 108, 118, 150 } }, - { ModContent.NPCType(), new int[] { 40, 80, 96, 104, 135 } }, - { ModContent.NPCType(), new int[] { 50, 100, 120, 130, 171 } }, - { ModContent.NPCType(), new int[] { 45, 90, 108, 118, 150 } }, - { ModContent.NPCType(), new int[] { 30, 60, 72, 78, 99 } }, - { ModContent.NPCType(), new int[] { 20, 40, 48, 52, 66 } }, - { ModContent.NPCType(), new int[] { 35, 70, 84, 92, 120 } }, - { ModContent.NPCType(), new int[] { 25, 50, 60, 66, 84 } }, + { ModContent.NPCType(), new int[] { 48, 80, 96, 112, 168 } }, + { ModContent.NPCType(), new int[] { 54, 90, 108, 126, 189 } }, + { ModContent.NPCType(), new int[] { 48, 80, 96, 112, 168 } }, + { ModContent.NPCType(), new int[] { 60, 100, 120, 140, 210 } }, + { ModContent.NPCType(), new int[] { 54, 90, 108, 126, 189 } }, + { ModContent.NPCType(), new int[] { 36, 60, 72, 84, 126 } }, + { ModContent.NPCType(), new int[] { 24, 40, 48, 56, 84 } }, + { ModContent.NPCType(), new int[] { 42, 70, 84, 98, 147 } }, + { ModContent.NPCType(), new int[] { 30, 50, 60, 70, 105 } }, - { NPCID.WallofFlesh, new int[] { 50, 150, 180, 195, 225 } }, - { NPCID.WallofFleshEye, new int[] { 50, 150, 180, 195, 225 } }, + { NPCID.WallofFlesh, new int[] { 100, 150, 180, 210, 315 } }, + { NPCID.WallofFleshEye, new int[] { 100, 150, 180, 210, 315 } }, { NPCID.TheHungry, new int[] { 30, // Ranges from 30 to 75 depending on WoF life 60, // Ranges from 60 to 150 depending on WoF life 60, // Ranges from 60 to 150 depending on WoF life 60, // Ranges from 60 to 150 depending on WoF life 90 } }, // Ranges from 90 to 225 depending on WoF life - { NPCID.TheHungryII, new int[] { 30, 60, 74, 80, 90 } }, - { NPCID.LeechHead, new int[] { 26, 52, 62, 68, 78 } }, - { NPCID.LeechBody, new int[] { 22, 44, 52, 56, 66 } }, - { NPCID.LeechTail, new int[] { 18, 36, 42, 44, 54 } }, + { NPCID.TheHungryII, new int[] { 30, 60, 74, 88, 132 } }, + { NPCID.LeechHead, new int[] { 26, 52, 62, 72, 108 } }, + { NPCID.LeechBody, new int[] { 22, 44, 52, 60, 90 } }, + { NPCID.LeechTail, new int[] { 18, 36, 42, 48, 72 } }, - { NPCID.QueenSlimeBoss, new int[] { 60, 120, 150, 170, 240 } }, + { NPCID.QueenSlimeBoss, new int[] { 80, 120, 150, 180, 270 } }, + { NPCID.QueenSlimeMinionBlue, new int[] { 60, 80, 100, 120, 180 } }, + { NPCID.QueenSlimeMinionPink, new int[] { 60, 80, 100, 120, 180 } }, + { NPCID.QueenSlimeMinionPurple, new int[] { 70, 100, 120, 140, 210 } }, - { ModContent.NPCType(), new int[] { 60, 138, 161, 184, 276 } }, - { ModContent.NPCType(), new int[] { 60, 120, 138, 158, 216 } }, + { ModContent.NPCType(), new int[] { 90, 138, 161, 184, 276 } }, + { ModContent.NPCType(), new int[] { 80, 120, 138, 156, 240 } }, { NPCID.Spazmatism, new int[] { - 60, // 90 in phase 2 + 70, // 105 in phase 2 102, // 153 in phase 2 119, // 178 in phase 2 136, // 204 in phase 2 204 } }, // 306 in phase 2 { NPCID.Retinazer, new int[] { - 50, // 75 in phase 2 + 55, // 83 in phase 2 85, // 127 in phase 2 102, // 153 in phase 2 119, // 178 in phase 2 153 } }, // 229 in phase 2 - { ModContent.NPCType(), new int[] { 80, 176, 187, 198, 264 } }, - { ModContent.NPCType(), new int[] { 70, 112, 136, 144, 180 } }, - { ModContent.NPCType(), new int[] { 65, 104, 112, 136, 168 } }, - { ModContent.NPCType(), new int[] { 60, 96, 104, 112, 156 } }, + { ModContent.NPCType(), new int[] { 110, 176, 187, 198, 330 } }, + { ModContent.NPCType(), new int[] { 75, 112, 136, 160, 240 } }, + { ModContent.NPCType(), new int[] { 70, 104, 112, 120, 192 } }, + { ModContent.NPCType(), new int[] { 65, 96, 104, 112, 168 } }, - { NPCID.TheDestroyer, new int[] { 70, 280, 300, 320, 420 } }, - { NPCID.TheDestroyerBody, new int[] { 60, 102, 136, 153, 204 } }, - { NPCID.TheDestroyerTail, new int[] { 40, 68, 102, 136, 153 } }, + { NPCID.TheDestroyer, new int[] { 140, 280, 300, 320, 480 } }, + { NPCID.TheDestroyerBody, new int[] { 70, 102, 136, 170, 255 } }, + { NPCID.TheDestroyerTail, new int[] { 45, 68, 102, 136, 204 } }, - { ModContent.NPCType(), new int[] { 70, 112, 136, 144, 180 } }, + { ModContent.NPCType(), new int[] { 75, 112, 136, 160, 240 } }, { NPCID.SkeletronPrime, new int[] { 50, // 100 while spinning @@ -412,435 +416,443 @@ namespace CalamityMod 102, // 204 while spinning 119, // 238 while spinning 153 } }, // 306 while spinning - { NPCID.PrimeVice, new int[] { 60, 102, 136, 153, 204 } }, - { NPCID.PrimeSaw, new int[] { 60, 102, 136, 153, 204 } }, + { ModContent.NPCType(), new int[] { + 50, // 100 while spinning + 85, // 170 while spinning + 102, // 204 while spinning + 119, // 238 while spinning + 153 } }, // 306 while spinning + { NPCID.PrimeVice, new int[] { 70, 102, 136, 170, 255 } }, + { NPCID.PrimeSaw, new int[] { 70, 102, 136, 170, 255 } }, { NPCID.PrimeCannon, new int[] { 30, 51, 68, 85, 102 } }, { NPCID.PrimeLaser, new int[] { 30, 51, 68, 85, 102 } }, - { ModContent.NPCType(), new int[] { 90, 144, 168, 176, 240 } }, - { ModContent.NPCType(), new int[] { 60, 120, 138, 148, 198 } }, - { ModContent.NPCType(), new int[] { 65, 130, 150, 162, 216 } }, + { ModContent.NPCType(), new int[] { 95, 144, 168, 192, 288 } }, + { ModContent.NPCType(), new int[] { 80, 120, 138, 156, 240 } }, + { ModContent.NPCType(), new int[] { 85, 130, 150, 170, 255 } }, { NPCID.Plantera, new int[] { - 50, // 70 in phase 2, vanilla is retarded and doesn't use the expert multiplier for plantera's damage - 100, // 140 in phase 2, vanilla is retarded and doesn't use the expert multiplier for plantera's damage + 70, // 98 in phase 2 + 100, // 140 in phase 2 138, // 193 in phase 2 - 161, // 225 in phase 2 - 207 } }, // Vanilla: Is retarded, so plantera does 150 in phase 1 and 210 in phase 2; Rev and Death: 289 in phase 2 - { NPCID.PlanterasTentacle, new int[] { 60, 138, 161, 207, 276 } }, - { ModContent.NPCType(), new int[] { 60, 138, 161, 207, 276 } }, - { NPCID.Spore, new int[] { 70, 140, 160, 170, 210 } }, + 176, // 246 in phase 2 + 276 } }, // 386 in phase 2 + { NPCID.PlanterasTentacle, new int[] { 90, 138, 161, 184, 276 } }, + { ModContent.NPCType(), new int[] { 90, 138, 161, 184, 276 } }, + { NPCID.Spore, new int[] { 90, 140, 160, 180, 270 } }, { NPCID.HallowBoss, new int[] { 80, // 120 during charge 110, // 165 during charge - 143, // 214 during charge - 154, // 231 during charge - 198 } }, // 297 during charge + 143, // 215 during charge + 176, // 264 during charge + 264 } }, // 396 during charge - { ModContent.NPCType(), new int[] { 90, 216, 240, 252, 324 } }, + { ModContent.NPCType(), new int[] { 140, 216, 240, 264, 414 } }, { ModContent.NPCType(), new int[] { - 70, // 105 during charge + 75, // 113 during charge 112, // 168 during charge 136, // 204 during charge - 144, // 216 during charge - 192 } }, // 288 during charge - { ModContent.NPCType(), new int[] { 55, 110, 126, 136, 165 } }, - { NPCID.DetonatingBubble, new int[] { 100, 150, 180, 195, 225 } }, - { ModContent.NPCType(), new int[] { 70, 140, 160, 170, 210 } }, + 160, // 240 during charge + 240 } }, // 360 during charge + { ModContent.NPCType(), new int[] { 70, 110, 126, 142, 210 } }, + { NPCID.DetonatingBubble, new int[] { 100, 150, 180, 210, 315 } }, + { ModContent.NPCType(), new int[] { 90, 140, 160, 180, 270 } }, - { ModContent.NPCType(), new int[] { 100, 220, 242, 253, 330 } }, - { ModContent.NPCType(), new int[] { 66, 112, 128, 138, 180 } }, + { ModContent.NPCType(), new int[] { 145, 220, 242, 264, 429 } }, + { ModContent.NPCType(), new int[] { 75, 112, 128, 144, 225 } }, - { NPCID.Golem, new int[] { 90, 144, 176, 192, 240 } }, - { NPCID.GolemHead, new int[] { 80, 128, 144, 160, 192 } }, - { NPCID.GolemFistLeft, new int[] { 70, 112, 144, 160, 180 } }, - { NPCID.GolemFistRight, new int[] { 70, 112, 144, 160, 180 } }, + { NPCID.Golem, new int[] { 95, 144, 176, 208, 312 } }, + { NPCID.GolemHead, new int[] { 85, 128, 144, 160, 240 } }, + { NPCID.GolemFistLeft, new int[] { 75, 112, 144, 176, 264 } }, + { NPCID.GolemFistRight, new int[] { 75, 112, 144, 176, 264 } }, - { ModContent.NPCType(), new int[] { 100, 180, 216, 234, 297 } }, - { ModContent.NPCType(), new int[] { 90, 180, 210, 224, 270 } }, - { ModContent.NPCType(), new int[] { 100, 200, 240, 260, 330 } }, + { ModContent.NPCType(), new int[] { 120, 180, 216, 252, 378 } }, + { ModContent.NPCType(), new int[] { 120, 180, 210, 240, 360 } }, + { ModContent.NPCType(), new int[] { 130, 200, 240, 280, 420 } }, { NPCID.DukeFishron, new int[] { 100, // 120 in phase 2 - 140, // 201 in phase 2, 184 in phase 3 - 168, // 241 in phase 2, 221 in phase 3 - 182, // 262 in phase 2, 240 in phase 3 - 210 } }, // 302 in phase 2, 277 in phase 3 - { NPCID.Sharkron, new int[] { 100, 150, 180, 195, 225 } }, - { NPCID.Sharkron2, new int[] { 120, 180, 210, 225, 270 } }, + 140, // 202 in phase 2, 185 in phase 3 + 168, // 242 in phase 2, 222 in phase 3 + 196, // 282 in phase 2, 259 in phase 3 + 294 } }, // 423 in phase 2, 388 in phase 3 + { NPCID.Sharkron, new int[] { 100, 150, 180, 210, 315 } }, + { NPCID.Sharkron2, new int[] { 120, 180, 210, 240, 360 } }, - { ModContent.NPCType(), new int[] { 120, 192, 224, 232, 288 } }, - { ModContent.NPCType(), new int[] { 80, 160, 180, 200, 240 } }, - { ModContent.NPCType(), new int[] { 80, 160, 180, 200, 240 } }, - { ModContent.NPCType(), new int[] { 120, 192, 224, 232, 288 } }, - { ModContent.NPCType(), new int[] { 100, 160, 192, 200, 216 } }, + { ModContent.NPCType(), new int[] { 130, 192, 224, 256, 384 } }, + { ModContent.NPCType(), new int[] { 105, 160, 180, 200, 315 } }, + { ModContent.NPCType(), new int[] { 105, 160, 180, 200, 315 } }, + { ModContent.NPCType(), new int[] { 130, 192, 224, 256, 390 } }, + { ModContent.NPCType(), new int[] { 105, 160, 192, 224, 336 } }, - { NPCID.CultistDragonHead, new int[] { 120, 180, 210, 225, 270 } }, - { NPCID.CultistDragonBody1, new int[] { 60, 90, 105, 120, 135 } }, - { NPCID.CultistDragonBody2, new int[] { 60, 90, 105, 120, 135 } }, - { NPCID.CultistDragonBody3, new int[] { 60, 90, 105, 120, 135 } }, - { NPCID.CultistDragonBody4, new int[] { 60, 90, 105, 120, 135 } }, - { NPCID.CultistDragonTail, new int[] { 60, 90, 105, 120, 135 } }, - { NPCID.AncientCultistSquidhead, new int[] { 90, 180, 210, 225, 270 } }, - { NPCID.AncientDoom, new int[] { 30, 45, 0, 0, 90 } }, // Vanilla: 90 in Master Mode; Rev and Death: 0 in Master Mode - { NPCID.AncientLight, new int[] { 120, 180, 210, 225, 270 } }, + { NPCID.CultistDragonHead, new int[] { 120, 180, 210, 240, 360 } }, + { NPCID.CultistDragonBody1, new int[] { 60, 90, 105, 120, 180 } }, + { NPCID.CultistDragonBody2, new int[] { 60, 90, 105, 120, 180 } }, + { NPCID.CultistDragonBody3, new int[] { 60, 90, 105, 120, 180 } }, + { NPCID.CultistDragonBody4, new int[] { 60, 90, 105, 120, 180 } }, + { NPCID.CultistDragonTail, new int[] { 60, 90, 105, 120, 180 } }, + { NPCID.AncientCultistSquidhead, new int[] { 120, 180, 210, 240, 360 } }, + { NPCID.AncientLight, new int[] { 120, 180, 210, 240, 360 } }, - { ModContent.NPCType(), new int[] { 120, 240, 268, 280, 360 } }, - { ModContent.NPCType(), new int[] { 100, 160, 192, 200, 240 } }, - { ModContent.NPCType(), new int[] { 80, 128, 160, 168, 192 } }, + { ModContent.NPCType(), new int[] { 160, 240, 268, 296, 480 } }, + { ModContent.NPCType(), new int[] { 105, 160, 192, 224, 336 } }, + { ModContent.NPCType(), new int[] { 85, 128, 160, 192, 288 } }, - { ModContent.NPCType(), new int[] { 140, 224, 256, 280, 336 } }, - { ModContent.NPCType(), new int[] { 120, 240, 264, 278, 336 } }, - { ModContent.NPCType(), new int[] { 100, 200, 220, 232, 270 } }, + { ModContent.NPCType(), new int[] { 150, 224, 256, 288, 444 } }, + { ModContent.NPCType(), new int[] { 160, 240, 264, 288, 405 } }, + { ModContent.NPCType(), new int[] { 100, 200, 220, 240, 300 } }, - { ModContent.NPCType(), new int[] { 160, 256, 288, 304, 384 } }, - { ModContent.NPCType(), new int[] { 110, 220, 242, 256, 330 } }, + { ModContent.NPCType(), new int[] { 170, 256, 288, 320, 504 } }, + { ModContent.NPCType(), new int[] { 145, 220, 242, 264, 435 } }, - { ModContent.NPCType(), new int[] { 120, 240, 264, 278, 336 } }, - { ModContent.NPCType(), new int[] { 100, 200, 220, 232, 270 } }, - { ModContent.NPCType(), new int[] { 100, 200, 220, 232, 270 } }, + { ModContent.NPCType(), new int[] { 120, 240, 264, 278, 360 } }, + { ModContent.NPCType(), new int[] { 100, 200, 220, 232, 300 } }, + { ModContent.NPCType(), new int[] { 100, 200, 220, 232, 300 } }, - { ModContent.NPCType(), new int[] { 150, 300, 330, 348, 450 } }, - { ModContent.NPCType(), new int[] { 130, 260, 288, 304, 390 } }, + { ModContent.NPCType(), new int[] { 240, 360, 396, 432, 720 } }, + { ModContent.NPCType(), new int[] { 175, 260, 288, 316, 525 } }, - { ModContent.NPCType(), new int[] { 180, 360, 396, 418, 540 } }, - { ModContent.NPCType(), new int[] { 120, 192, 224, 250, 330 } }, - { ModContent.NPCType(), new int[] { 100, 160, 192, 210, 270 } }, + { ModContent.NPCType(), new int[] { 240, 360, 396, 432, 720 } }, + { ModContent.NPCType(), new int[] { 125, 192, 224, 256, 372 } }, + { ModContent.NPCType(), new int[] { 105, 160, 192, 224, 312 } }, - { ModContent.NPCType(), new int[] { 175, 315, 351, 369, 459 } }, - { ModContent.NPCType(), new int[] { 130, 260, 288, 304, 390 } }, - { ModContent.NPCType(), new int[] { 140, 280, 300, 320, 390 } }, + { ModContent.NPCType(), new int[] { 210, 315, 351, 387, 621 } }, + { ModContent.NPCType(), new int[] { 175, 260, 288, 316, 525 } }, + { ModContent.NPCType(), new int[] { 190, 280, 300, 320, 570 } }, { ModContent.NPCType(), new int[] { - 150, // 180 in phase 2, 210 in phase 3 + 160, // 192 in phase 2, 224 in phase 3 240, // 288 in phase 2, 336 in phase 3 - 264, // 316 in phase 2, 369 in phase 3 - 280, // 336 in phase 2, 392 in phase 3 - 384 } }, // 460 in phase 2, 537 in phase 3 - { ModContent.NPCType(), new int[] { 210, 336, 360, 392, 528 } }, + 264, // 317 in phase 2, 370 in phase 3 + 288, // 346 in phase 2, 403 in phase 3 + 480 } }, // 576 in phase 2, 672 in phase 3 + { ModContent.NPCType(), new int[] { 224, 336, 370, 403, 672 } }, { ModContent.NPCType(), new int[] { - 160, // 176 in phase 2, 192 in phase 3 - 288, // 316 in phase 2, 345 in phase 3 - 324, // 356 in phase 2, 388 in phase 3 - 342, // 376 in phase 2, 410 in phase 3 - 432 } }, // 475 in phase 2, 518 in phase 3 - { ModContent.NPCType(), new int[] { 180, 288, 328, 344, 432 } }, - { ModContent.NPCType(), new int[] { 180, 288, 328, 344, 432 } }, + 192, // 211 in phase 2, 230 in phase 3 + 288, // 317 in phase 2, 346 in phase 3 + 324, // 356 in phase 2, 389 in phase 3 + 360, // 396 in phase 2, 432 in phase 3 + 567 } }, // 624 in phase 2, 680 in phase 3 + { ModContent.NPCType(), new int[] { 192, 288, 328, 368, 576 } }, + { ModContent.NPCType(), new int[] { 192, 288, 328, 368, 576 } }, - { ModContent.NPCType(), new int[] { 350, 700, 750, 780, 880 } }, - { ModContent.NPCType(), new int[] { 220, 374, 425, 442, 561 } }, - { ModContent.NPCType(), new int[] { 180, 306, 340, 357, 459 } }, - { ModContent.NPCType(), new int[] { 180, 360, 396, 420, 510 } }, - { ModContent.NPCType(), new int[] { 130, 260, 290, 320, 420 } }, - { ModContent.NPCType(), new int[] { 100, 200, 230, 260, 330 } }, + { ModContent.NPCType(), new int[] { 470, 700, 750, 800, 1410 } }, + { ModContent.NPCType(), new int[] { 250, 374, 425, 476, 714 } }, + { ModContent.NPCType(), new int[] { 204, 306, 340, 374, 612 } }, + { ModContent.NPCType(), new int[] { 240, 360, 396, 432, 720 } }, + { ModContent.NPCType(), new int[] { 175, 260, 290, 320, 525 } }, + { ModContent.NPCType(), new int[] { 135, 200, 230, 260, 405 } }, - { ModContent.NPCType(), new int[] { 280, 448, 480, 512, 624 } }, + { ModContent.NPCType(), new int[] { 300, 448, 480, 512, 900 } }, - { ModContent.NPCType(), new int[] { 320, 512, 544, 560, 696 } }, + { ModContent.NPCType(), new int[] { 340, 512, 544, 576, 1020 } }, - { ModContent.NPCType(), new int[] { 320, 512, 544, 560, 696 } }, - { ModContent.NPCType(), new int[] { 300, 480, 512, 528, 660 } }, + { ModContent.NPCType(), new int[] { 340, 512, 544, 576, 1020 } }, + { ModContent.NPCType(), new int[] { 320, 480, 512, 544, 960 } }, - { ModContent.NPCType(), new int[] { 350, 560, 592, 608, 756 } }, - { ModContent.NPCType(), new int[] { 300, 480, 512, 528, 660 } }, - { ModContent.NPCType(), new int[] { 300, 480, 512, 528, 660 } }, - { ModContent.NPCType(), new int[] { 250, 400, 424, 440, 552 } }, + { ModContent.NPCType(), new int[] { 375, 560, 592, 624, 1116 } }, + { ModContent.NPCType(), new int[] { 320, 480, 512, 544, 960 } }, + { ModContent.NPCType(), new int[] { 320, 480, 512, 544, 960 } }, + { ModContent.NPCType(), new int[] { 270, 400, 424, 448, 804 } }, - { ModContent.NPCType(), new int[] { 400, 800, 850, 880, 1000 } } + { ModContent.NPCType(), new int[] { 535, 800, 850, 900, 1596 } } }; EnemyStats.ProjectileDamageValues = new SortedDictionary, int[]> { - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 22, 36, 44, 48, 66 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 26, 36, 44, 52, 84 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 26, 44, 60, 68, 90 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 26, 44, 60, 68, 90 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 26, 36, 44, 52, 84 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 26, 36, 44, 52, 84 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 32, 48, 60, 68, 90 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 32, 48, 60, 68, 90 } }, + { new Tuple(NPCID.EyeofCthulhu, ProjectileID.BloodNautilusShot), new int[] { 26, 44, 60, 76, 114 } }, + { new Tuple(ModContent.NPCType(), ProjectileID.BloodShot), new int[] { 26, 36, 44, 52, 84 } }, - { new Tuple(NPCID.EaterofWorldsHead, ProjectileID.CursedFlameHostile), new int[] { 32, 48, 60, 68, 90 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 32, 48, 60, 72, 108 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 32, 48, 60, 72, 108 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 36, 56, 68, 76, 102 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 36, 56, 68, 76, 102 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 36, 56, 68, 76, 102 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 30, 48, 60, 68, 90 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 30, 48, 60, 68, 90 } }, + { new Tuple(NPCID.EaterofWorldsHead, ProjectileID.CursedFlameHostile), new int[] { 26, 44, 60, 76, 114 } }, + { new Tuple(NPCID.EaterofWorldsHead, ModContent.ProjectileType()), new int[] { 26, 36, 44, 52, 84 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 36, 56, 68, 76, 102 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 36, 56, 68, 76, 102 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 36, 56, 68, 76, 102 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 36, 56, 68, 76, 102 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 36, 56, 68, 76, 102 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 36, 56, 68, 76, 102 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 22, 36, 44, 48, 66 } }, + { new Tuple(NPCID.BrainofCthulhu, ProjectileID.BloodNautilusShot), new int[] { 36, 56, 68, 80, 120 } }, + { new Tuple(NPCID.BrainofCthulhu, ProjectileID.BloodShot), new int[] { 26, 44, 60, 76, 114 } }, + { new Tuple(NPCID.Creeper, ProjectileID.BloodShot), new int[] { 26, 44, 60, 76, 114 } }, - { new Tuple(NPCID.QueenBee, ProjectileID.QueenBeeStinger), new int[] { 22, 44, 64, 72, 96 } }, // 66 damage in non-rev master mode + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 36, 56, 68, 80, 120 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 36, 56, 68, 80, 120 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 36, 56, 68, 80, 120 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 30, 48, 60, 72, 108 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 30, 48, 60, 72, 108 } }, - { new Tuple(NPCID.SkeletronHead, ProjectileID.Skull), new int[] { 46, 68, 84, 92, 126 } }, // 102 damage in non-rev master mode + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 36, 56, 68, 80, 120 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 36, 56, 68, 80, 120 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 36, 56, 68, 80, 120 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 36, 56, 68, 80, 120 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 36, 56, 68, 80, 120 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 36, 56, 68, 80, 120 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 22, 36, 44, 52, 84 } }, - { new Tuple(NPCID.Deerclops, ProjectileID.DeerclopsIceSpike), new int[] { 26, 52, 76, 84, 114 } }, // 78 damage in non-rev master mode - { new Tuple(NPCID.Deerclops, ProjectileID.DeerclopsRangedProjectile), new int[] { 36, 72, 88, 96, 132 } }, // 108 damage in non-rev master mode - { new Tuple(NPCID.Deerclops, ProjectileID.InsanityShadowHostile), new int[] { 20, 40, 60, 68, 90 } }, // 60 damage in non-rev master mode + { new Tuple(NPCID.QueenBee, ProjectileID.QueenBeeStinger), new int[] { 22, 44, 64, 84, 126 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 42, 68, 84, 92, 126 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 38, 60, 76, 84, 114 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 42, 68, 84, 92, 126 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 38, 60, 76, 84, 114 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 38, 60, 76, 84, 114 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 34, 52, 68, 74, 102 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 36, 56, 68, 76, 102 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 24, 48, 60, 68, 90 } }, + { new Tuple(NPCID.SkeletronHead, ProjectileID.Skull), new int[] { 46, 72, 84, 96, 144 } }, + { new Tuple(NPCID.SkeletronHead, ProjectileID.Shadowflames), new int[] { 36, 72, 88, 104, 156 } }, + { new Tuple(NPCID.SkeletronHand, ProjectileID.Skull), new int[] { 36, 56, 68, 80, 120 } }, - { new Tuple(NPCID.WallofFleshEye, ProjectileID.EyeLaser), new int[] { - 22, // 22 to 30, depending on life - 44, // 44 to 60, depending on life - 68, - 76, - 102 } }, // 66 to 90, depending on life - { new Tuple(NPCID.WallofFleshEye, ProjectileID.DeathLaser), new int[] { 40, 72, 88, 96, 132 } }, - { new Tuple(NPCID.WallofFlesh, ProjectileID.DemonSickle), new int[] { 52, 92, 112, 124, 168 } }, + { new Tuple(NPCID.Deerclops, ProjectileID.DeerclopsIceSpike), new int[] { 26, 52, 76, 100, 150 } }, + { new Tuple(NPCID.Deerclops, ProjectileID.DeerclopsRangedProjectile), new int[] { 36, 72, 88, 104, 156 } }, + { new Tuple(NPCID.Deerclops, ProjectileID.InsanityShadowHostile), new int[] { 20, 40, 60, 80, 120 } }, - { new Tuple(NPCID.QueenSlimeBoss, ProjectileID.QueenSlimeGelAttack), new int[] { 60, 120, 136, 152, 210 } }, - { new Tuple(NPCID.QueenSlimeBoss, ProjectileID.QueenSlimeSmash), new int[] { 80, 160, 188, 200, 270 } }, - { new Tuple(NPCID.QueenSlimeBoss, ProjectileID.QueenSlimeMinionBlueSpike), new int[] { 0, 0, 112, 124, 168 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 42, 68, 84, 100, 150 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 38, 60, 76, 92, 138 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 42, 68, 84, 100, 150 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 38, 60, 76, 92, 138 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 38, 60, 76, 92, 138 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 34, 52, 68, 80, 120 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 36, 56, 68, 80, 120 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 24, 48, 60, 72, 108 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 52, 92, 112, 124, 168 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 70, 120, 136, 152, 210 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 60, 100, 120, 132, 180 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 52, 92, 112, 124, 168 } }, + { new Tuple(NPCID.WallofFleshEye, ProjectileID.EyeLaser), new int[] { 36, 72, 88, 104, 156 } }, + { new Tuple(NPCID.WallofFlesh, ProjectileID.DemonSickle), new int[] { 52, 92, 112, 132, 198 } }, + { new Tuple(NPCID.WallofFlesh, ProjectileID.Fireball), new int[] { 36, 72, 88, 104, 156 } }, - { new Tuple(NPCID.Retinazer, ProjectileID.EyeLaser), new int[] { 40, 76, 116, 128, 174 } }, // 114 damage in non-rev master mode + { new Tuple(NPCID.QueenSlimeBoss, ProjectileID.QueenSlimeGelAttack), new int[] { 60, 120, 136, 152, 228 } }, + { new Tuple(NPCID.QueenSlimeBoss, ProjectileID.QueenSlimeSmash), new int[] { 80, 160, 188, 216, 324 } }, + { new Tuple(NPCID.QueenSlimeBoss, ProjectileID.QueenSlimeMinionBlueSpike), new int[] { 52, 92, 112, 132, 198 } }, + { new Tuple(NPCID.QueenSlimeMinionBlue, ProjectileID.QueenSlimeMinionBlueSpike), new int[] { 52, 92, 112, 132, 198 } }, + { new Tuple(NPCID.QueenSlimeMinionPink, ProjectileID.QueenSlimeMinionPinkBall), new int[] { 52, 92, 112, 132, 198 } }, + + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 52, 92, 112, 132, 198 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 70, 120, 136, 152, 228 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 60, 100, 120, 140, 210 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 52, 92, 112, 132, 198 } }, + + { new Tuple(NPCID.Retinazer, ProjectileID.EyeLaser), new int[] { 40, 92, 116, 140, 210 } }, { new Tuple(NPCID.Retinazer, ProjectileID.DeathLaser), new int[] { - 50, // 36 in rapid fire - 92, // 68 in rapid fire - 124, // 93 in rapid fire - 136, // 102 in rapid fire - 186 } }, // 139 in rapid fire; 138 in non-rev master mode, 102 in rapid fire in non-rev master mode - { new Tuple(NPCID.Retinazer, ModContent.ProjectileType()), new int[] { 70, 120, 136, 152, 210 } }, - { new Tuple(NPCID.Spazmatism, ProjectileID.CursedFlameHostile), new int[] { 50, 88, 120, 132, 180 } }, // 132 in non-rev master mode - { new Tuple(NPCID.Spazmatism, ProjectileID.EyeFire), new int[] { 60, 108, 0, 0, 162 } }, // Only used in non-rev modes - { new Tuple(NPCID.Spazmatism, ModContent.ProjectileType()), new int[] { 70, 120, 148, 160, 222 } }, - { new Tuple(NPCID.Spazmatism, ModContent.ProjectileType()), new int[] { 60, 100, 128, 140, 192 } }, + 50, // 38 in rapid fire + 108, // 81 in rapid fire + 132, // 99 in rapid fire + 156, // 117 in rapid fire + 234 } }, // 176 in rapid fire + { new Tuple(NPCID.Retinazer, ModContent.ProjectileType()), new int[] { 70, 120, 136, 152, 228 } }, + { new Tuple(NPCID.Spazmatism, ProjectileID.CursedFlameHostile), new int[] { 50, 100, 120, 140, 210 } }, + { new Tuple(NPCID.Spazmatism, ProjectileID.EyeFire), new int[] { 60, 120, 148, 176, 264 } }, + { new Tuple(NPCID.Spazmatism, ModContent.ProjectileType()), new int[] { 70, 120, 148, 176, 264 } }, + { new Tuple(NPCID.Spazmatism, ModContent.ProjectileType()), new int[] { 60, 100, 128, 156, 234 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 60, 100, 120, 132, 180 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 70, 120, 136, 152, 210 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 80, 140, 160, 176, 234 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 66, 112, 128, 140, 192 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 60, 100, 120, 140, 210 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 70, 120, 136, 152, 228 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 80, 140, 160, 180, 270 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 66, 112, 128, 144, 216 } }, - { new Tuple(NPCID.TheDestroyer, ProjectileID.DeathLaser), new int[] { 0, 0, 0, 152, 210 } }, - { new Tuple(NPCID.TheDestroyerBody, ProjectileID.DeathLaser), new int[] { 44, 72, 116, 128, 174 } }, // 108 in non-rev master mode - { new Tuple(NPCID.TheDestroyerBody, ModContent.ProjectileType()), new int[] { 46, 76, 128, 140, 186 } }, - { new Tuple(NPCID.TheDestroyerBody, ModContent.ProjectileType()), new int[] { 48, 80, 136, 152, 210 } }, - { new Tuple(NPCID.TheDestroyerBody, ProjectileID.EyeLaser), new int[] { 40, 68, 100, 112, 144 } }, - { new Tuple(NPCID.Probe, ProjectileID.PinkLaser), new int[] { 50, 88, 100, 112, 144 } }, // 132 in non-rev master mode + { new Tuple(NPCID.TheDestroyer, ProjectileID.DeathLaser), new int[] { 44, 96, 116, 136, 204 } }, + { new Tuple(NPCID.TheDestroyer, ModContent.ProjectileType()), new int[] { 46, 108, 128, 148, 222 } }, + { new Tuple(NPCID.TheDestroyer, ModContent.ProjectileType()), new int[] { 48, 116, 136, 156, 234 } }, + { new Tuple(NPCID.TheDestroyerBody, ProjectileID.DeathLaser), new int[] { 44, 96, 116, 136, 204 } }, + { new Tuple(NPCID.TheDestroyerBody, ModContent.ProjectileType()), new int[] { 46, 108, 128, 148, 222 } }, + { new Tuple(NPCID.TheDestroyerBody, ModContent.ProjectileType()), new int[] { 48, 116, 136, 156, 234 } }, + { new Tuple(NPCID.Probe, ProjectileID.PinkLaser), new int[] { 50, 88, 100, 112, 168 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 80, 140, 160, 176, 234 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 70, 112, 128, 140, 192 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 80, 140, 160, 176, 234 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 120, 200, 240, 252, 342 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 80, 140, 160, 176, 234 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 70, 112, 128, 140, 192 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 80, 140, 160, 180, 270 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 70, 112, 128, 144, 216 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 80, 140, 160, 180, 270 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 120, 200, 240, 280, 420 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 80, 140, 160, 180, 270 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 70, 112, 128, 144, 216 } }, - { new Tuple(NPCID.SkeletronPrime, ProjectileID.Skull), new int[] { 50, 100, 124, 136, 186 } }, - { new Tuple(NPCID.SkeletronPrime, ProjectileID.DeathLaser), new int[] { 50, 100, 124, 136, 186 } }, - { new Tuple(NPCID.SkeletronPrime, ProjectileID.RocketSkeleton), new int[] { 60, 120, 148, 160, 222 } }, - { new Tuple(NPCID.PrimeCannon, ProjectileID.RocketSkeleton), new int[] { 60, 120, 148, 160, 222 } }, - { new Tuple(NPCID.PrimeCannon, ProjectileID.BombSkeletronPrime), new int[] { 80, 160, 0, 0, 240 } }, - { new Tuple(NPCID.PrimeLaser, ProjectileID.DeathLaser), new int[] { 50, 100, 124, 136, 186 } }, // 150 in non-rev master mode + { new Tuple(NPCID.SkeletronPrime, ProjectileID.Skull), new int[] { 50, 108, 124, 140, 210 } }, + { new Tuple(NPCID.SkeletronPrime, ProjectileID.DeathLaser), new int[] { 50, 108, 124, 140, 210 } }, + { new Tuple(NPCID.SkeletronPrime, ProjectileID.RocketSkeleton), new int[] { 60, 120, 148, 176, 264 } }, + { new Tuple(ModContent.NPCType(), ProjectileID.Skull), new int[] { 50, 108, 124, 140, 210 } }, + { new Tuple(ModContent.NPCType(), ProjectileID.BombSkeletronPrime), new int[] { 80, 160, 180, 200, 300 } }, + { new Tuple(ModContent.NPCType(), ProjectileID.FrostBeam), new int[] { 50, 108, 124, 140, 210 } }, + { new Tuple(NPCID.PrimeCannon, ProjectileID.RocketSkeleton), new int[] { 60, 120, 148, 176, 264 } }, + { new Tuple(NPCID.PrimeCannon, ProjectileID.BombSkeletronPrime), new int[] { 80, 160, 0, 0, 300 } }, + { new Tuple(NPCID.PrimeLaser, ProjectileID.DeathLaser), new int[] { 50, 108, 124, 140, 210 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 80, 140, 160, 176, 234 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 80, 140, 160, 176, 234 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 80, 140, 160, 176, 234 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 80, 140, 160, 176, 234 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 70, 112, 128, 140, 192 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 80, 140, 160, 176, 234 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 70, 112, 128, 140, 192 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 70, 112, 128, 140, 192 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 80, 140, 160, 180, 270 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 80, 140, 160, 180, 270 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 80, 140, 160, 180, 270 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 80, 140, 160, 180, 270 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 70, 112, 128, 144, 216 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 80, 140, 160, 180, 270 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 70, 112, 128, 144, 216 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 70, 112, 128, 144, 216 } }, - { new Tuple(NPCID.Plantera, ProjectileID.SeedPlantera), new int[] { 44, 76, 128, 140, 186 } }, // 114 in non-rev master mode - { new Tuple(NPCID.Plantera, ProjectileID.PoisonSeedPlantera), new int[] { 54, 96, 136, 152, 210 } }, // 144 in non-rev master mode - { new Tuple(NPCID.Plantera, ProjectileID.ThornBall), new int[] { 62, 108, 160, 176, 234 } }, // 162 in non-rev master mode - { new Tuple(NPCID.Plantera, ModContent.ProjectileType()), new int[] { 80, 140, 160, 176, 234 } }, - { new Tuple(NPCID.Plantera, ModContent.ProjectileType()), new int[] { 80, 140, 160, 176, 234 } }, + { new Tuple(NPCID.Plantera, ProjectileID.SeedPlantera), new int[] { 52, 96, 128, 160, 240 } }, + { new Tuple(NPCID.Plantera, ProjectileID.PoisonSeedPlantera), new int[] { 62, 116, 144, 172, 258 } }, + { new Tuple(NPCID.Plantera, ProjectileID.ThornBall), new int[] { 72, 132, 160, 188, 282 } }, + { new Tuple(NPCID.Plantera, ModContent.ProjectileType()), new int[] { 80, 140, 160, 180, 270 } }, + { new Tuple(NPCID.Plantera, ModContent.ProjectileType()), new int[] { 80, 140, 160, 180, 270 } }, - { new Tuple(NPCID.HallowBoss, ProjectileID.HallowBossRainbowStreak), new int[] { 90, 120, 160, 176, 234 } }, - { new Tuple(NPCID.HallowBoss, ProjectileID.FairyQueenSunDance), new int[] { 100, 140, 184, 200, 270 } }, - { new Tuple(NPCID.HallowBoss, ProjectileID.HallowBossLastingRainbow), new int[] { 90, 120, 160, 176, 234 } }, - { new Tuple(NPCID.HallowBoss, ProjectileID.FairyQueenLance), new int[] { 100, 120, 160, 176, 234 } }, + { new Tuple(NPCID.HallowBoss, ProjectileID.HallowBossRainbowStreak), new int[] { 100, 152, 172, 192, 300 } }, + { new Tuple(NPCID.HallowBoss, ProjectileID.FairyQueenSunDance), new int[] { 120, 180, 204, 228, 360 } }, + { new Tuple(NPCID.HallowBoss, ProjectileID.HallowBossLastingRainbow), new int[] { 100, 152, 172, 192, 300 } }, + { new Tuple(NPCID.HallowBoss, ProjectileID.FairyQueenLance), new int[] { 130, 196, 216, 236, 390 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 100, 172, 208, 228, 300 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 80, 140, 160, 176, 234 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 84, 148, 172, 188, 252 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 88, 156, 184, 200, 270 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 100, 172, 208, 244, 366 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 80, 140, 160, 180, 270 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 84, 148, 172, 196, 294 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 88, 156, 184, 212, 318 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 88, 156, 184, 200, 270 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 100, 172, 208, 228, 300 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 88, 156, 184, 200, 270 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 88, 156, 184, 212, 318 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 100, 172, 208, 244, 366 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 88, 156, 184, 212, 318 } }, - { new Tuple(NPCID.Golem, ProjectileID.Fireball), new int[] { 58, 116, 160, 176, 234 } }, - { new Tuple(NPCID.Golem, ProjectileID.EyeBeam), new int[] { 56, 112, 172, 188, 252 } }, - { new Tuple(NPCID.GolemHead, ProjectileID.Fireball), new int[] { - 36, // 36 to 58 depending on life - 72, // 72 to 116 depending on life - 160, - 176, - 234 } }, // 108 to 174 depending on life in non-rev master mode - { new Tuple(NPCID.GolemHead, ProjectileID.EyeBeam), new int[] { 56, 112, 172, 188, 252 } }, // 168 in non-rev master mode - { new Tuple(NPCID.GolemHeadFree, ProjectileID.Fireball), new int[] { - 36, // 36 to 58 depending on life - 72, // 72 to 116 depending on life - 160, - 176, - 234 } }, // 108 to 174 depending on life in non-rev master mode - { new Tuple(NPCID.GolemHeadFree, ProjectileID.EyeBeam), new int[] { 56, 112, 172, 188, 252 } }, // 168 in non-rev master mode - { new Tuple(NPCID.GolemHeadFree, ProjectileID.InfernoHostileBolt), new int[] { 64, 128, 184, 200, 270 } }, + { new Tuple(NPCID.Golem, ProjectileID.Fireball), new int[] { 72, 132, 160, 188, 282 } }, + { new Tuple(NPCID.Golem, ProjectileID.EyeBeam), new int[] { 80, 140, 172, 204, 306 } }, + { new Tuple(NPCID.GolemHead, ProjectileID.Fireball), new int[] { 60, 120, 160, 200, 300 } }, + { new Tuple(NPCID.GolemHead, ProjectileID.EyeBeam), new int[] { 80, 140, 172, 204, 306 } }, + { new Tuple(NPCID.GolemFistLeft, ProjectileID.InfernoHostileBolt), new int[] { 88, 156, 184, 212, 318 } }, + { new Tuple(NPCID.GolemFistRight, ProjectileID.InfernoHostileBolt), new int[] { 88, 156, 184, 212, 318 } }, + { new Tuple(NPCID.GolemHeadFree, ProjectileID.Fireball), new int[] { 60, 120, 160, 200, 300 } }, + { new Tuple(NPCID.GolemHeadFree, ProjectileID.EyeBeam), new int[] { 80, 140, 172, 204, 306 } }, + { new Tuple(NPCID.GolemHeadFree, ProjectileID.InfernoHostileBolt), new int[] { 88, 156, 184, 212, 318 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 88, 156, 184, 200, 270 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 88, 156, 184, 200, 270 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 120, 192, 220, 240, 330 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 88, 156, 184, 212, 318 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 88, 156, 184, 212, 318 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 120, 192, 220, 248, 372 } }, - { new Tuple(NPCID.DukeFishron, ProjectileID.Sharknado), new int[] { 80, 100, 184, 200, 270 } }, // 150 in non-rev master mode - { new Tuple(NPCID.DukeFishron, ProjectileID.Cthulunado), new int[] { 160, 200, 232, 248, 348 } }, // 300 in non-rev master mode + { new Tuple(NPCID.DukeFishron, ProjectileID.Sharknado), new int[] { 80, 100, 150, 200, 300 } }, + { new Tuple(NPCID.DukeFishron, ProjectileID.Cthulunado), new int[] { 160, 200, 232, 264, 480 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 120, 180, 208, 224, 312 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 120, 180, 208, 224, 312 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 90, 144, 172, 188, 258 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 120, 180, 208, 224, 312 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 90, 144, 172, 188, 258 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 120, 180, 208, 236, 360 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 120, 180, 208, 236, 360 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 90, 144, 172, 200, 300 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 120, 180, 208, 236, 360 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 90, 144, 172, 200, 300 } }, - { new Tuple(NPCID.CultistBoss, ProjectileID.CultistBossFireBall), new int[] { 60, 80, 184, 200, 270 } }, // 80 in non-rev master mode - { new Tuple(NPCID.CultistBoss, ProjectileID.CultistBossIceMist), new int[] { 70, 100, 208, 224, 312 } }, // 100 in non-rev master mode - { new Tuple(NPCID.CultistBoss, ProjectileID.CultistBossLightningOrb), new int[] { 90, 120, 220, 240, 330 } }, // 120 in non-rev master mode - { new Tuple(NPCID.CultistBossClone, ProjectileID.CultistBossFireBallClone), new int[] { 36, 72, 172, 188, 258 } }, // 72 in non-rev master mode - { new Tuple(NPCID.AncientDoom, ProjectileID.AncientDoomProjectile), new int[] { 60, 180, 184, 200, 270 } }, // 402 in non-rev master mode + { new Tuple(NPCID.CultistBoss, ProjectileID.CultistBossFireBall), new int[] { 88, 156, 184, 212, 318 } }, + { new Tuple(NPCID.CultistBoss, ProjectileID.CultistBossIceMist), new int[] { 120, 180, 208, 236, 360 } }, + { new Tuple(NPCID.CultistBoss, ProjectileID.CultistBossLightningOrb), new int[] { 120, 192, 220, 248, 372 } }, + { new Tuple(NPCID.CultistBossClone, ProjectileID.CultistBossFireBallClone), new int[] { 90, 144, 172, 200, 300 } }, + { new Tuple(NPCID.AncientDoom, ProjectileID.AncientDoomProjectile), new int[] { 88, 156, 184, 212, 318 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 90, 152, 176, 188, 264 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 120, 180, 208, 224, 312 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 100, 172, 192, 204, 288 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 90, 152, 176, 200, 300 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 120, 180, 208, 236, 360 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 100, 172, 192, 212, 318 } }, - { new Tuple(NPCID.MoonLordHead, ProjectileID.PhantasmalDeathray), new int[] { 150, 300, 380, 420, 570 } }, // 450 in non-rev master mode - { new Tuple(NPCID.MoonLordHead, ProjectileID.PhantasmalBolt), new int[] { 60, 120, 160, 176, 240 } }, // 180 in non-rev master mode - { new Tuple(NPCID.MoonLordHand, ProjectileID.PhantasmalEye), new int[] { 60, 120, 160, 176, 240 } }, // 180 in non-rev master mode - { new Tuple(NPCID.MoonLordHand, ProjectileID.PhantasmalSphere), new int[] { 80, 160, 260, 284, 390 } }, // 240 in non-rev master mode - { new Tuple(NPCID.MoonLordHand, ProjectileID.PhantasmalBolt), new int[] { 60, 120, 160, 176, 240 } }, // 180 in non-rev master mode - { new Tuple(NPCID.MoonLordFreeEye, ProjectileID.PhantasmalBolt), new int[] { 70, 140, 180, 200, 270 } }, // 210 in non-rev master mode - { new Tuple(NPCID.MoonLordFreeEye, ProjectileID.PhantasmalEye), new int[] { 70, 140, 180, 200, 270 } }, // 210 in non-rev master mode - { new Tuple(NPCID.MoonLordFreeEye, ProjectileID.PhantasmalSphere), new int[] { 88, 176, 260, 284, 390 } }, // 264 in non-rev master mode - { new Tuple(NPCID.MoonLordFreeEye, ProjectileID.PhantasmalDeathray), new int[] { 100, 200, 260, 284, 390 } }, // 300 in non-rev master mode + { new Tuple(NPCID.MoonLordHead, ProjectileID.PhantasmalDeathray), new int[] { 200, 300, 380, 460, 690 } }, + { new Tuple(NPCID.MoonLordHead, ProjectileID.PhantasmalBolt), new int[] { 90, 120, 160, 200, 300 } }, + { new Tuple(NPCID.MoonLordHand, ProjectileID.PhantasmalEye), new int[] { 90, 120, 160, 200, 300 } }, + { new Tuple(NPCID.MoonLordHand, ProjectileID.PhantasmalSphere), new int[] { 120, 160, 220, 280, 420 } }, + { new Tuple(NPCID.MoonLordHand, ProjectileID.PhantasmalBolt), new int[] { 90, 120, 160, 200, 300 } }, + { new Tuple(NPCID.MoonLordFreeEye, ProjectileID.PhantasmalBolt), new int[] { 100, 140, 180, 220, 330 } }, + { new Tuple(NPCID.MoonLordFreeEye, ProjectileID.PhantasmalEye), new int[] { 100, 140, 180, 220, 330 } }, + { new Tuple(NPCID.MoonLordFreeEye, ProjectileID.PhantasmalSphere), new int[] { 132, 176, 220, 264, 396 } }, + { new Tuple(NPCID.MoonLordFreeEye, ProjectileID.PhantasmalDeathray), new int[] { 150, 200, 260, 320, 480 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 220, 244, 256, 366 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 220, 244, 256, 366 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 220, 244, 256, 366 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 120, 192, 220, 236, 330 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 120, 192, 220, 236, 330 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 160, 320, 352, 370, 528 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 220, 244, 256, 366 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 105, 171, 189, 198, 284 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 228, 252, 264, 378 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 105, 171, 189, 198, 284 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 220, 244, 256, 366 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 120, 192, 220, 236, 330 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 220, 244, 268, 420 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 220, 244, 268, 420 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 220, 244, 268, 420 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 120, 192, 220, 248, 360 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 120, 192, 220, 248, 360 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 160, 320, 352, 384, 480 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 220, 244, 268, 420 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 105, 171, 189, 207, 315 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 228, 252, 276, 420 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 105, 171, 189, 207, 315 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 220, 244, 268, 420 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 120, 192, 220, 248, 360 } }, { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 35, 50, 50, 0, 0 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 220, 244, 256, 366 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 200, 300, 332, 356, 498 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 220, 244, 268, 420 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 200, 300, 332, 364, 600 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 150, 264, 288, 300, 432 } }, // Split holy fire does: 113, 198, 216, 225, 324 - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 120, 192, 220, 236, 330 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 120, 192, 220, 236, 330 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 220, 244, 256, 366 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 150, 264, 288, 312, 450 } }, // Split holy fire does: 113, 198, 216, 234, 338 + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 120, 192, 220, 248, 360 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 120, 192, 220, 248, 360 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 220, 244, 268, 420 } }, { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 35, 50, 50, 0, 0 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 228, 252, 264, 378 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 105, 171, 189, 198, 284 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 228, 252, 264, 378 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 105, 171, 189, 198, 284 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 220, 244, 256, 366 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 228, 252, 264, 378 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 228, 252, 264, 378 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 200, 400, 440, 464, 660 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 228, 252, 276, 420 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 105, 171, 189, 207, 315 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 228, 252, 276, 420 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 105, 171, 189, 207, 315 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 220, 244, 268, 420 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 228, 252, 276, 420 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 228, 252, 276, 420 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 200, 400, 440, 480, 600 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 240, 264, 280, 396 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 240, 264, 280, 396 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 240, 264, 280, 396 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 240, 264, 288, 420 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 240, 264, 288, 420 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 240, 264, 288, 420 } }, - { new Tuple(ModContent.NPCType(), ProjectileID.CultistBossLightningOrbArc), new int[] { 150, 264, 288, 300, 432 } }, - { new Tuple(ModContent.NPCType(), ProjectileID.FrostWave), new int[] { 150, 264, 288, 300, 432 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 160, 276, 304, 320, 456 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 240, 264, 280, 396 } }, - { new Tuple(ModContent.NPCType(), ProjectileID.CultistBossLightningOrb), new int[] { 150, 264, 288, 300, 432 } }, + { new Tuple(ModContent.NPCType(), ProjectileID.CultistBossLightningOrbArc), new int[] { 150, 264, 288, 312, 450 } }, + { new Tuple(ModContent.NPCType(), ProjectileID.FrostWave), new int[] { 150, 264, 288, 312, 450 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 160, 276, 304, 332, 480 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 240, 264, 288, 420 } }, + { new Tuple(ModContent.NPCType(), ProjectileID.CultistBossLightningOrb), new int[] { 150, 264, 288, 312, 450 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 240, 264, 280, 396 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 240, 264, 280, 396 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 240, 264, 288, 420 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 240, 264, 288, 420 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 240, 264, 280, 396 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 150, 264, 288, 300, 432 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 150, 264, 288, 300, 432 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 160, 276, 304, 320, 456 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 240, 264, 280, 396 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 170, 296, 324, 340, 462 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 150, 264, 288, 300, 432 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 240, 264, 288, 420 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 150, 264, 288, 312, 450 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 150, 264, 288, 312, 450 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 160, 276, 304, 332, 480 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 240, 264, 288, 420 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 170, 296, 324, 352, 510 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 150, 264, 288, 312, 450 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 220, 220, 220, 220 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 220, 220, 220, 220 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 220, 244, 264, 420 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 220, 244, 264, 420 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 170, 296, 324, 340, 462 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 280, 400, 440, 464, 660 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 170, 296, 324, 340, 462 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 180, 316, 348, 364, 492 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 170, 296, 324, 340, 462 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 170, 296, 324, 352, 510 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 280, 420, 460, 500, 840 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 170, 296, 324, 352, 510 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 180, 316, 348, 380, 540 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 170, 296, 324, 352, 510 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 180, 316, 348, 364, 492 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 200, 340, 376, 396, 564 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 180, 316, 348, 364, 492 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 180, 316, 348, 380, 540 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 200, 340, 376, 412, 600 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 180, 316, 348, 380, 540 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 300, 520, 548, 564, 822 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 220, 384, 424, 444, 600 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 250, 440, 464, 476, 696 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 250, 440, 464, 476, 696 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 250, 440, 464, 476, 696 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 220, 384, 424, 444, 600 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 220, 384, 424, 444, 600 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 220, 384, 424, 444, 600 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 250, 440, 464, 476, 696 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 300, 520, 548, 576, 900 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 220, 384, 424, 464, 660 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 250, 440, 464, 488, 750 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 250, 440, 464, 488, 750 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 250, 440, 464, 488, 750 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 220, 384, 424, 464, 660 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 220, 384, 424, 464, 660 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 220, 384, 424, 464, 660 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 250, 440, 464, 488, 750 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 280, 476, 484, 500, 726 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 280, 476, 484, 500, 726 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 300, 508, 528, 544, 780 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 350, 592, 624, 656, 918 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 280, 476, 484, 500, 726 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 250, 440, 464, 476, 696 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 280, 476, 484, 500, 726 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 250, 440, 464, 476, 696 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 250, 440, 464, 476, 696 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 280, 476, 484, 500, 726 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 250, 440, 464, 476, 696 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 280, 476, 484, 500, 726 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 250, 440, 464, 476, 696 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 280, 468, 484, 500, 840 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 280, 468, 484, 500, 840 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 300, 508, 528, 548, 900 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 350, 592, 624, 656, 1050 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 280, 468, 484, 500, 840 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 250, 440, 464, 488, 750 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 280, 468, 484, 500, 840 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 250, 440, 464, 488, 750 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 250, 440, 464, 488, 750 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 280, 468, 484, 500, 840 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 250, 440, 464, 488, 750 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 280, 468, 484, 500, 840 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 250, 440, 464, 488, 750 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 300, 508, 528, 544, 780 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 240, 408, 432, 456, 630 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 240, 408, 432, 456, 630 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 280, 476, 484, 500, 726 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 300, 508, 528, 548, 900 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 240, 408, 432, 456, 720 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 240, 408, 432, 456, 720 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 280, 468, 484, 500, 840 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 350, 592, 624, 656, 918 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 240, 408, 432, 456, 630 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 240, 408, 432, 456, 630 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 240, 408, 432, 456, 630 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 240, 408, 432, 456, 630 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 350, 592, 624, 656, 1050 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 240, 408, 432, 456, 720 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 240, 408, 432, 456, 720 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 240, 408, 432, 456, 720 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 240, 408, 432, 456, 720 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 300, 508, 528, 544, 780 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 300, 508, 528, 544, 780 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 240, 408, 432, 456, 630 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 240, 408, 432, 456, 630 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 240, 408, 432, 456, 630 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 400, 608, 640, 658, 960 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 300, 508, 528, 548, 900 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 300, 508, 528, 548, 900 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 240, 408, 432, 456, 720 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 240, 408, 432, 456, 720 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 240, 408, 432, 456, 720 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 400, 608, 640, 672, 1200 } }, - { new Tuple(ModContent.NPCType(), ProjectileID.CultistBossIceMist), new int[] { 400, 600, 632, 648, 948 } }, - { new Tuple(ModContent.NPCType(), ProjectileID.CultistBossLightningOrbArc), new int[] { 500, 752, 788, 808, 1182 } }, - { new Tuple(ModContent.NPCType(), ProjectileID.AncientDoomProjectile), new int[] { 400, 600, 632, 648, 948 } }, - { new Tuple(ModContent.NPCType(), ProjectileID.CultistBossFireBallClone), new int[] { 400, 600, 632, 648, 948 } } + { new Tuple(ModContent.NPCType(), ProjectileID.CultistBossIceMist), new int[] { 400, 600, 632, 664, 1200 } }, + { new Tuple(ModContent.NPCType(), ProjectileID.CultistBossLightningOrbArc), new int[] { 500, 752, 788, 824, 1500 } }, + { new Tuple(ModContent.NPCType(), ProjectileID.AncientDoomProjectile), new int[] { 400, 600, 632, 664, 1200 } }, + { new Tuple(ModContent.NPCType(), ProjectileID.CultistBossFireBallClone), new int[] { 400, 600, 632, 664, 1200 } } }; } diff --git a/DataStructures/OffscreenBossSpawnContext.cs b/DataStructures/OffscreenBossSpawnContext.cs index 005ebeb21c..f0d2caba3c 100644 --- a/DataStructures/OffscreenBossSpawnContext.cs +++ b/DataStructures/OffscreenBossSpawnContext.cs @@ -1,5 +1,5 @@ +using System; using Microsoft.Xna.Framework; -using System; using Terraria; namespace CalamityMod.DataStructures diff --git a/DataStructures/VerletSimulatedSegments.cs b/DataStructures/VerletSimulatedSegments.cs index 8f9a1d031e..7654bdb27e 100644 --- a/DataStructures/VerletSimulatedSegments.cs +++ b/DataStructures/VerletSimulatedSegments.cs @@ -1,5 +1,5 @@ -using Microsoft.Xna.Framework; -using System.Collections.Generic; +using System.Collections.Generic; +using Microsoft.Xna.Framework; namespace CalamityMod.DataStructures { diff --git a/Dusts/AstralBasic.cs b/Dusts/AstralBasic.cs index d9abf93c5b..36939606ee 100644 --- a/Dusts/AstralBasic.cs +++ b/Dusts/AstralBasic.cs @@ -1,4 +1,4 @@ - + using Terraria; using Terraria.ModLoader; diff --git a/Dusts/AstralBlue.cs b/Dusts/AstralBlue.cs index 6959c9022b..2493200de1 100644 --- a/Dusts/AstralBlue.cs +++ b/Dusts/AstralBlue.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; diff --git a/Dusts/AstralChunkDust.cs b/Dusts/AstralChunkDust.cs index f99c7069cf..db8227a4d6 100644 --- a/Dusts/AstralChunkDust.cs +++ b/Dusts/AstralChunkDust.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Dusts diff --git a/Dusts/AstralEnemy.cs b/Dusts/AstralEnemy.cs index e1db77d6c1..797f8c44de 100644 --- a/Dusts/AstralEnemy.cs +++ b/Dusts/AstralEnemy.cs @@ -1,4 +1,4 @@ - + using Terraria; using Terraria.ModLoader; diff --git a/Dusts/AstralOrange.cs b/Dusts/AstralOrange.cs index 30ef63ef02..65b0917591 100644 --- a/Dusts/AstralOrange.cs +++ b/Dusts/AstralOrange.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; diff --git a/Dusts/AuricBarDust.cs b/Dusts/AuricBarDust.cs index fa19c6edfe..e6673233ec 100644 --- a/Dusts/AuricBarDust.cs +++ b/Dusts/AuricBarDust.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Dusts diff --git a/Dusts/BrimstoneFlame.cs b/Dusts/BrimstoneFlame.cs index 803ec53dfa..1c48e1fb01 100644 --- a/Dusts/BrimstoneFlame.cs +++ b/Dusts/BrimstoneFlame.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; diff --git a/Dusts/CalamityDusts.cs b/Dusts/CalamityDusts.cs index 702f83fc3c..ca8f4e92b7 100644 --- a/Dusts/CalamityDusts.cs +++ b/Dusts/CalamityDusts.cs @@ -6,10 +6,10 @@ // 1. Their internal value is not constant, meaning it cannot be used in this enum, and // 2. It's a custom dust. - SulfurousSeaAcid = 75, + SulphurousSeaAcid = 75, Brimstone = 235, Ectoplasm = 180, - Polterplasm = 60, + Necroplasm = 60, Plague = 46, ProfanedFire = 244, Nightwither = 185, diff --git a/Dusts/CeaselessDust.cs b/Dusts/CeaselessDust.cs index 8c6c28a062..dc4fece525 100644 --- a/Dusts/CeaselessDust.cs +++ b/Dusts/CeaselessDust.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; diff --git a/Dusts/CinderBlossomDust.cs b/Dusts/CinderBlossomDust.cs index 2b23116d6d..167d6c6310 100644 --- a/Dusts/CinderBlossomDust.cs +++ b/Dusts/CinderBlossomDust.cs @@ -1,11 +1,11 @@ +using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; -using Microsoft.Xna.Framework; namespace CalamityMod.Dusts { - public class CinderBlossomDust : ModDust - { + public class CinderBlossomDust : ModDust + { public override void OnSpawn(Dust dust) { dust.velocity *= 0.05f; @@ -22,12 +22,12 @@ namespace CalamityMod.Dusts float strength = dust.scale * 1.4f; Lighting.AddLight(dust.position, 0.025f * strength, 0.1f * strength, 0.1f * strength); - if (Main.rand.Next(20) == 0) + if (Main.rand.NextBool(20)) { dust.alpha += 5; } - if (Main.rand.Next(12) == 0) + if (Main.rand.NextBool(12)) { dust.velocity.X += Main.rand.NextFloat(-0.1f, 0.1f); dust.velocity.Y += Main.rand.NextFloat(0.02f, 0.08f); @@ -43,4 +43,4 @@ namespace CalamityMod.Dusts return false; } } -} \ No newline at end of file +} diff --git a/Dusts/CosmiliteBarDust.cs b/Dusts/CosmiliteBarDust.cs index cc6e05f481..ada17db17f 100644 --- a/Dusts/CosmiliteBarDust.cs +++ b/Dusts/CosmiliteBarDust.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Dusts diff --git a/Dusts/FinalFlame.cs b/Dusts/FinalFlame.cs index 80bf5dd36d..70cae96879 100644 --- a/Dusts/FinalFlame.cs +++ b/Dusts/FinalFlame.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; diff --git a/Dusts/Furniture/BloomTileGold.cs b/Dusts/Furniture/BloomTileGold.cs index da2687ecc0..1972b6bfd9 100644 --- a/Dusts/Furniture/BloomTileGold.cs +++ b/Dusts/Furniture/BloomTileGold.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Dusts.Furniture diff --git a/Dusts/Furniture/BloomTileLeaves.cs b/Dusts/Furniture/BloomTileLeaves.cs index d83b864c1e..dcc7d56338 100644 --- a/Dusts/Furniture/BloomTileLeaves.cs +++ b/Dusts/Furniture/BloomTileLeaves.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Dusts.Furniture diff --git a/Dusts/Furniture/OtherworldlyTileCloth.cs b/Dusts/Furniture/OtherworldlyTileCloth.cs index fcda395add..81421db554 100644 --- a/Dusts/Furniture/OtherworldlyTileCloth.cs +++ b/Dusts/Furniture/OtherworldlyTileCloth.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Dusts.Furniture diff --git a/Dusts/Furniture/ProfanedTileRock.cs b/Dusts/Furniture/ProfanedTileRock.cs index 4c8dcaf6a1..e663611069 100644 --- a/Dusts/Furniture/ProfanedTileRock.cs +++ b/Dusts/Furniture/ProfanedTileRock.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Dusts.Furniture diff --git a/Dusts/Furniture/SilvaTileGold.cs b/Dusts/Furniture/SilvaTileGold.cs index 8f1b944372..324adf59fc 100644 --- a/Dusts/Furniture/SilvaTileGold.cs +++ b/Dusts/Furniture/SilvaTileGold.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Dusts.Furniture diff --git a/Dusts/HBSparkle.cs b/Dusts/HBSparkle.cs index 78a86c1b35..9c4b5071cb 100644 --- a/Dusts/HBSparkle.cs +++ b/Dusts/HBSparkle.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Dusts diff --git a/Dusts/HolyFireDust.cs b/Dusts/HolyFireDust.cs index 2f8cf021b4..cfa57c182e 100644 --- a/Dusts/HolyFireDust.cs +++ b/Dusts/HolyFireDust.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; diff --git a/Dusts/OMGWTHSparkle.cs b/Dusts/OMGWTHSparkle.cs index fe847ae16d..c4c7a4519a 100644 --- a/Dusts/OMGWTHSparkle.cs +++ b/Dusts/OMGWTHSparkle.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Dusts diff --git a/Dusts/RosePiece.cs b/Dusts/RosePiece.cs index b995413d7b..96e9eb615f 100644 --- a/Dusts/RosePiece.cs +++ b/Dusts/RosePiece.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; diff --git a/Dusts/ShadowspecBarDust.cs b/Dusts/ShadowspecBarDust.cs index 31c0122bf0..a9ac1fbeef 100644 --- a/Dusts/ShadowspecBarDust.cs +++ b/Dusts/ShadowspecBarDust.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Dusts diff --git a/Effects/CalamityShaders.cs b/Effects/CalamityShaders.cs index edd6b46474..c98734482d 100644 --- a/Effects/CalamityShaders.cs +++ b/Effects/CalamityShaders.cs @@ -179,6 +179,7 @@ namespace CalamityMod.Effects #region Aqua's Shaders internal static Effect CircularGradientWithEdge; internal static Effect WavyOpacity; + internal static Effect HellBall; #endregion // @@ -192,6 +193,10 @@ namespace CalamityMod.Effects internal static Effect DeerclopsShadowShader; #endregion + #region YuH's Shaders + internal static Effect TeslaTrailShader; + #endregion + // Shorthand to register a loaded shader in Terraria's graphics engine // All shaders registered this way are accessible under GameShaders.Misc // They will use the prefix described above @@ -393,6 +398,8 @@ namespace CalamityMod.Effects RegisterMiscShader(CircularGradientWithEdge, "CircularGradientWithEdgePass", "CircularGradientWithEdge"); WavyOpacity = LoadShader("WavyOpacity"); RegisterMiscShader(WavyOpacity, "WavyOpacityPass", "WavyOpacity"); + HellBall = LoadShader("HellBall"); + RegisterScreenShader(HellBall, "HellBallPass", "HellBall"); #endregion #region Loading Amber's Shaders @@ -406,6 +413,11 @@ namespace CalamityMod.Effects RegisterMiscShader(DeerclopsShadowShader, "ShadowPass", "DeerclopsShadowShader"); #endregion + + #region Loading YuH's Shaders + TeslaTrailShader = LoadShader("TeslaTrail"); + RegisterMiscShader(TeslaTrailShader, "TrailPass", "TeslaTrail"); + #endregion } } } diff --git a/Effects/Dyes/PolterplasmDyeShader.fx b/Effects/Dyes/NecroplasmicDyeShader.fx similarity index 100% rename from Effects/Dyes/PolterplasmDyeShader.fx rename to Effects/Dyes/NecroplasmicDyeShader.fx diff --git a/Effects/Dyes/PolterplasmDyeShader.xnb b/Effects/Dyes/NecroplasmicDyeShader.xnb similarity index 100% rename from Effects/Dyes/PolterplasmDyeShader.xnb rename to Effects/Dyes/NecroplasmicDyeShader.xnb diff --git a/Effects/HellBall.fx b/Effects/HellBall.fx new file mode 100644 index 0000000000..66eccc5134 --- /dev/null +++ b/Effects/HellBall.fx @@ -0,0 +1,53 @@ +float time; +float blowUpPower; //The power the blow up effect is set as. Ideally betwen 0 and 1 +float blowUpSize; //The strenght of the expansion caused by the blow up effect +float3 shieldColor; +float shieldOpacity; +float3 shieldEdgeColor; +float shieldEdgeBlendStrenght; +float noiseScale; +float resolution; + +texture sampleTexture; +sampler2D Texture1Sampler = sampler_state { texture = ; magfilter = LINEAR; minfilter = LINEAR; mipfilter = LINEAR; AddressU = wrap; AddressV = wrap; }; + +float4 main(float2 uv : TEXCOORD) : COLOR +{ + //Pixelate? + //uv.x -= uv.x % (1 / resolution); + //uv.y -= uv.y % (1 / resolution); + + //Crop in a circle + float distanceFromCenter = length(uv - float2(0.5, 0.5)) * 2; + if (distanceFromCenter > 1) + return float4(0, 0, 0, 0); + + //"Blow up" the noise map so it looks circular. + float blownUpUVX = pow((abs(uv.x - 0.5)) * 2, blowUpPower); + float blownUpUVY = pow((abs(uv.y - 0.5)) * 2, blowUpPower); + float2 blownUpUV = float2(-blownUpUVY * blowUpSize * 0.5 + uv.x * (1 + blownUpUVY * blowUpSize), -blownUpUVX * blowUpSize * 0.5 + uv.y * (1 + blownUpUVX * blowUpSize)); + + //Rescale + blownUpUV *= noiseScale; + //Scroll effect + blownUpUV.y = (blownUpUV.y + time) % 1; + + //Get the noise color + float4 noiseColor = tex2D(Texture1Sampler, blownUpUV); + + //Apply a layers of fake fresnel + noiseColor += pow(distanceFromCenter, 6); // + pow(distanceFromCenter, 3) * 0.6; <- Brings us over into ps 3.0 territory if we have pixelation on. + //Fade the edges + if (distanceFromCenter > 0.95) + noiseColor *= (1 - ((distanceFromCenter - 0.95) / 0.05)); + + return noiseColor * float4(lerp(shieldColor, shieldEdgeColor, pow(distanceFromCenter, shieldEdgeBlendStrenght)), shieldOpacity); +} + +technique Technique1 +{ + pass HellBallPass + { + PixelShader = compile ps_2_0 main(); + } +} \ No newline at end of file diff --git a/Effects/HellBall.xnb b/Effects/HellBall.xnb new file mode 100644 index 0000000000..28ed20114e Binary files /dev/null and b/Effects/HellBall.xnb differ diff --git a/Effects/TeslaTrail.fx b/Effects/TeslaTrail.fx new file mode 100644 index 0000000000..3d1e36fe99 --- /dev/null +++ b/Effects/TeslaTrail.fx @@ -0,0 +1,56 @@ +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; +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; +} + +float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0 +{ + return input.Color; +} + +technique Technique1 +{ + pass TrailPass + { + VertexShader = compile vs_2_0 VertexShaderFunction(); + PixelShader = compile ps_2_0 PixelShaderFunction(); + } +} diff --git a/Effects/TeslaTrail.xnb b/Effects/TeslaTrail.xnb new file mode 100644 index 0000000000..dddb5a1b3a Binary files /dev/null and b/Effects/TeslaTrail.xnb differ diff --git a/Events/AcidRainEvent.cs b/Events/AcidRainEvent.cs index d946bc32a9..0536f96f59 100644 --- a/Events/AcidRainEvent.cs +++ b/Events/AcidRainEvent.cs @@ -1,12 +1,12 @@ -using CalamityMod.NPCs.AcidRain; +using System; +using System.Collections.Generic; +using System.Linq; +using CalamityMod.NPCs.AcidRain; using CalamityMod.NPCs.OldDuke; using CalamityMod.Projectiles.Boss; using CalamityMod.UI; using CalamityMod.World; using Microsoft.Xna.Framework; -using System; -using System.Collections.Generic; -using System.Linq; using Terraria; using Terraria.DataStructures; using Terraria.ID; diff --git a/Events/BossRushEvent.cs b/Events/BossRushEvent.cs index d1bb856f19..628a809bcf 100644 --- a/Events/BossRushEvent.cs +++ b/Events/BossRushEvent.cs @@ -150,17 +150,19 @@ namespace CalamityMod.Events DownedBossSystem.startedBossRushAtLeastOnce = true; }, permittedNPCs: new int[] { NPCID.BlueSlime, NPCID.YellowSlime, NPCID.PurpleSlime, NPCID.RedSlime, NPCID.GreenSlime, NPCID.RedSlime, - NPCID.IceSlime, NPCID.UmbrellaSlime, NPCID.Pinky, NPCID.SlimeSpiked, NPCID.RainbowSlime, ModContent.NPCType() }), + NPCID.IceSlime, NPCID.UmbrellaSlime, NPCID.Pinky, NPCID.SlimeSpiked, NPCID.RainbowSlime, ModContent.NPCType(), + ModContent.NPCType(), ModContent.NPCType() }), new Boss(ModContent.NPCType(), spawnContext: type => { NPC.SpawnOnPlayer(ClosestPlayerToWorldCenter, ModContent.NPCType()); 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(), + ModContent.NPCType(), ModContent.NPCType() }), - new Boss(NPCID.EyeofCthulhu, TimeChangeContext.Night, permittedNPCs: NPCID.ServantofCthulhu), + new Boss(NPCID.EyeofCthulhu, TimeChangeContext.Night, permittedNPCs: new int[] { NPCID.ServantofCthulhu, ModContent.NPCType() }), new Boss(ModContent.NPCType(), TimeChangeContext.Day, type => { @@ -180,7 +182,7 @@ namespace CalamityMod.Events ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType() ,ModContent.NPCType() }), - new Boss(NPCID.QueenBee, permittedNPCs: new int[] { NPCID.Bee, NPCID.BeeSmall }), + new Boss(NPCID.QueenBee, permittedNPCs: new int[] { NPCID.Bee, NPCID.BeeSmall, NPCID.LittleHornetHoney, NPCID.HornetHoney, NPCID.BigHornetHoney }), new Boss(NPCID.Deerclops), @@ -217,7 +219,7 @@ namespace CalamityMod.Events new Boss(ModContent.NPCType(), TimeChangeContext.Day, permittedNPCs: ModContent.NPCType()), - new Boss(NPCID.SkeletronPrime, TimeChangeContext.Night, permittedNPCs: new int[] { NPCID.PrimeCannon, NPCID.PrimeSaw, NPCID.PrimeVice, NPCID.PrimeLaser, NPCID.Probe }), + new Boss(NPCID.SkeletronPrime, TimeChangeContext.Night, permittedNPCs: new int[] { ModContent.NPCType(), NPCID.PrimeCannon, NPCID.PrimeSaw, NPCID.PrimeVice, NPCID.PrimeLaser, NPCID.Probe }), new Boss(ModContent.NPCType(), TimeChangeContext.Night, dimnessFactor: 0.6f, permittedNPCs: new int[] { ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType() }), @@ -487,12 +489,16 @@ namespace CalamityMod.Events { get { + if (!BossRushActive) + { + return -1; + } int tier = CurrentTier; if (CalamityMod.Instance.musicMod != null) { - // Boss Rush music for tiers 4 and 5 don't exist - if (tier > 3) - tier = 3; + // Boss Rush music for tier 5 doesn't exist + if (tier > 4) + tier = 4; return CalamityMod.Instance.GetMusicFromMusicMod($"BossRushTier{tier}") ?? 0; } @@ -587,7 +593,7 @@ namespace CalamityMod.Events // Increase cooldown post-Moon Lord. if (BossRushStage >= Bosses.FindIndex(boss => boss.EntityID == NPCID.MoonLordCore)) - BossRushSpawnCountdown += 300; + BossRushSpawnCountdown += 180; // Override the spawn countdown if specified. if (BossRushStage < Bosses.Count - 1 && Bosses[BossRushStage + 1].SpecialSpawnCountdown != -1) @@ -757,7 +763,7 @@ namespace CalamityMod.Events BossDeathEffects[npc.type].Invoke(npc); } - if (npc.type == Bosses[Bosses.Count -1].EntityID) + if (npc.type == Bosses[Bosses.Count - 1].EntityID) { // Mark Boss Rush as complete DownedBossSystem.downedBossRush = true; diff --git a/ExtraJumps/StatigelJump.cs b/ExtraJumps/StatigelJump.cs index 4f7433a313..a933dc82ef 100644 --- a/ExtraJumps/StatigelJump.cs +++ b/ExtraJumps/StatigelJump.cs @@ -1,5 +1,5 @@ -using Microsoft.Xna.Framework; -using CalamityMod.Particles; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; @@ -47,7 +47,7 @@ namespace CalamityMod.ExtraJumps Dust dust = Dust.NewDustPerfect(pulsePosition, Main.rand.NextBool() ? 243 : 56, pulseVelocity, 100, default, Main.rand.NextFloat(0.6f, 0.9f)); dust.noGravity = false; dust.alpha = 190; - Dust dust2 = Dust.NewDustPerfect(pulsePosition, Main.rand.NextBool() ? 242 : 135, pulseVelocity * 0.9f , 100, default, Main.rand.NextFloat(1.2f, 1.9f)); + Dust dust2 = Dust.NewDustPerfect(pulsePosition, Main.rand.NextBool() ? 242 : 135, pulseVelocity * 0.9f, 100, default, Main.rand.NextFloat(1.2f, 1.9f)); dust2.noGravity = true; } } diff --git a/ExtraTextures/ArianeAndElsterBlink_FirstEye.png b/ExtraTextures/ArianeAndElsterBlink_FirstEye.png new file mode 100644 index 0000000000..f0cc1123a6 Binary files /dev/null and b/ExtraTextures/ArianeAndElsterBlink_FirstEye.png differ diff --git a/ExtraTextures/ArianeAndElsterBlink_SecondEye.png b/ExtraTextures/ArianeAndElsterBlink_SecondEye.png new file mode 100644 index 0000000000..2e89b36c65 Binary files /dev/null and b/ExtraTextures/ArianeAndElsterBlink_SecondEye.png differ diff --git a/ExtraTextures/Bestiary/DesertNuisance_Bestiary.png b/ExtraTextures/Bestiary/DesertNuisance_Bestiary.png index d4a35a1775..c592bad6ce 100644 Binary files a/ExtraTextures/Bestiary/DesertNuisance_Bestiary.png and b/ExtraTextures/Bestiary/DesertNuisance_Bestiary.png differ diff --git a/ExtraTextures/Bestiary/DesertPest_Bestiary.png b/ExtraTextures/Bestiary/DesertPest_Bestiary.png new file mode 100644 index 0000000000..a2641ce82d Binary files /dev/null and b/ExtraTextures/Bestiary/DesertPest_Bestiary.png differ diff --git a/ExtraTextures/Bestiary/DesertScourge_Bestiary.png b/ExtraTextures/Bestiary/DesertScourge_Bestiary.png index 911ec44270..4b36bd6565 100644 Binary files a/ExtraTextures/Bestiary/DesertScourge_Bestiary.png and b/ExtraTextures/Bestiary/DesertScourge_Bestiary.png differ diff --git a/ExtraTextures/ChadPrime.png b/ExtraTextures/ChadPrime.png new file mode 100644 index 0000000000..3bbc5902b0 Binary files /dev/null and b/ExtraTextures/ChadPrime.png differ diff --git a/ExtraTextures/ChadPrimeHeadGlow.png b/ExtraTextures/ChadPrimeHeadGlow.png new file mode 100644 index 0000000000..e8b25ba236 Binary files /dev/null and b/ExtraTextures/ChadPrimeHeadGlow.png differ diff --git a/ExtraTextures/Lasers/ThanatosBeamEnd.png b/ExtraTextures/Lasers/ThanatosBeamEnd.png index 09aae21f06..cfd7f8cdd1 100644 Binary files a/ExtraTextures/Lasers/ThanatosBeamEnd.png and b/ExtraTextures/Lasers/ThanatosBeamEnd.png differ diff --git a/ExtraTextures/Lasers/ThanatosBeamMiddle.png b/ExtraTextures/Lasers/ThanatosBeamMiddle.png index 0d1e82c2a6..f1c5834ef9 100644 Binary files a/ExtraTextures/Lasers/ThanatosBeamMiddle.png and b/ExtraTextures/Lasers/ThanatosBeamMiddle.png differ diff --git a/ExtraTextures/LineFade.png b/ExtraTextures/LineFade.png new file mode 100644 index 0000000000..2fbccf4dac Binary files /dev/null and b/ExtraTextures/LineFade.png differ diff --git a/ExtraTextures/ScreamyFace.png b/ExtraTextures/ScreamyFace.png new file mode 100644 index 0000000000..712955d4f7 Binary files /dev/null and b/ExtraTextures/ScreamyFace.png differ diff --git a/ExtraTextures/SkeletronPrime2HeadGlow.png b/ExtraTextures/SkeletronPrime2HeadGlow.png new file mode 100644 index 0000000000..7054e2945d Binary files /dev/null and b/ExtraTextures/SkeletronPrime2HeadGlow.png differ diff --git a/ExtraTextures/SoulVortex.png b/ExtraTextures/SoulVortex.png new file mode 100644 index 0000000000..3450a057bd Binary files /dev/null and b/ExtraTextures/SoulVortex.png differ diff --git a/ExtraTextures/VanillaBossGlowmasks/DestroyerBodyGlow.png b/ExtraTextures/VanillaBossGlowmasks/DestroyerBodyGlow.png new file mode 100644 index 0000000000..3e2235cd1d Binary files /dev/null and b/ExtraTextures/VanillaBossGlowmasks/DestroyerBodyGlow.png differ diff --git a/ExtraTextures/VanillaBossGlowmasks/DestroyerHeadGlow.png b/ExtraTextures/VanillaBossGlowmasks/DestroyerHeadGlow.png new file mode 100644 index 0000000000..4530739af2 Binary files /dev/null and b/ExtraTextures/VanillaBossGlowmasks/DestroyerHeadGlow.png differ diff --git a/ExtraTextures/VanillaBossGlowmasks/DestroyerTailGlow.png b/ExtraTextures/VanillaBossGlowmasks/DestroyerTailGlow.png new file mode 100644 index 0000000000..2fcbcceb81 Binary files /dev/null and b/ExtraTextures/VanillaBossGlowmasks/DestroyerTailGlow.png differ diff --git a/ExtraTextures/VanillaBossGlowmasks/SkeletronPrimeHeadGlow.png b/ExtraTextures/VanillaBossGlowmasks/SkeletronPrimeHeadGlow.png new file mode 100644 index 0000000000..a988d2bbdc Binary files /dev/null and b/ExtraTextures/VanillaBossGlowmasks/SkeletronPrimeHeadGlow.png differ diff --git a/ExtraTextures/VanillaBossGlowmasks/WallOfFleshEyeTelegraphGlow.png b/ExtraTextures/VanillaBossGlowmasks/WallOfFleshEyeTelegraphGlow.png new file mode 100644 index 0000000000..2f52bdb33a Binary files /dev/null and b/ExtraTextures/VanillaBossGlowmasks/WallOfFleshEyeTelegraphGlow.png differ diff --git a/ExtraTextures/VanillaBuffs/BetsysCurse.png b/ExtraTextures/VanillaBuffs/BetsysCurse.png new file mode 100644 index 0000000000..975456cdf9 Binary files /dev/null and b/ExtraTextures/VanillaBuffs/BetsysCurse.png differ diff --git a/ExtraTextures/VanillaBuffs/Celled.png b/ExtraTextures/VanillaBuffs/Celled.png new file mode 100644 index 0000000000..1c5cf64505 Binary files /dev/null and b/ExtraTextures/VanillaBuffs/Celled.png differ diff --git a/ExtraTextures/VanillaBuffs/Daybroken.png b/ExtraTextures/VanillaBuffs/Daybroken.png new file mode 100644 index 0000000000..75a39b21ca Binary files /dev/null and b/ExtraTextures/VanillaBuffs/Daybroken.png differ diff --git a/ExtraTextures/VanillaBuffs/DryadsBane.png b/ExtraTextures/VanillaBuffs/DryadsBane.png new file mode 100644 index 0000000000..0f5d6b84c7 Binary files /dev/null and b/ExtraTextures/VanillaBuffs/DryadsBane.png differ diff --git a/ExtraTextures/VanillaBuffs/Frostbite.png b/ExtraTextures/VanillaBuffs/Frostbite.png new file mode 100644 index 0000000000..901a3795b8 Binary files /dev/null and b/ExtraTextures/VanillaBuffs/Frostbite.png differ diff --git a/ExtraTextures/VanillaBuffs/Hellfire.png b/ExtraTextures/VanillaBuffs/Hellfire.png new file mode 100644 index 0000000000..c392c1b234 Binary files /dev/null and b/ExtraTextures/VanillaBuffs/Hellfire.png differ diff --git a/ExtraTextures/VanillaBuffs/Oiled.png b/ExtraTextures/VanillaBuffs/Oiled.png new file mode 100644 index 0000000000..89cff3505e Binary files /dev/null and b/ExtraTextures/VanillaBuffs/Oiled.png differ diff --git a/FluidSimulation/FluidField.cs b/FluidSimulation/FluidField.cs index 0e8b96419c..03910f257f 100644 --- a/FluidSimulation/FluidField.cs +++ b/FluidSimulation/FluidField.cs @@ -258,7 +258,7 @@ namespace CalamityMod.FluidSimulation CalculateDiffusion(Viscosity, VelocityField); if (!ShouldSkipDivergenceClearingStep) ClearDivergence(VelocityField.NextState); - + CalculateAdvection(VelocityField.NextState, VelocityField.PreviousState, VelocityField.PreviousState); if (!ShouldSkipDivergenceClearingStep) ClearDivergence(VelocityField.NextState); diff --git a/ForegroundDrawing/ForegroundManager.cs b/ForegroundDrawing/ForegroundManager.cs index 01c279313a..88259a63b5 100644 --- a/ForegroundDrawing/ForegroundManager.cs +++ b/ForegroundDrawing/ForegroundManager.cs @@ -1,10 +1,10 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using ReLogic.Content; -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Runtime.Serialization; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.ModLoader; using Terraria.ModLoader.Core; diff --git a/Gores/AcidRain/SulfurousSkaterGore.png b/Gores/AcidRain/SulphurousSkaterGore.png similarity index 100% rename from Gores/AcidRain/SulfurousSkaterGore.png rename to Gores/AcidRain/SulphurousSkaterGore.png diff --git a/Gores/AcidRain/SulfurousSkaterGore2.png b/Gores/AcidRain/SulphurousSkaterGore2.png similarity index 100% rename from Gores/AcidRain/SulfurousSkaterGore2.png rename to Gores/AcidRain/SulphurousSkaterGore2.png diff --git a/Gores/AcidRain/SulfurousSkaterGore3.png b/Gores/AcidRain/SulphurousSkaterGore3.png similarity index 100% rename from Gores/AcidRain/SulfurousSkaterGore3.png rename to Gores/AcidRain/SulphurousSkaterGore3.png diff --git a/Gores/AstralWaterDroplet.cs b/Gores/AstralWaterDroplet.cs index 9eb6588b4d..0022de1b56 100644 --- a/Gores/AstralWaterDroplet.cs +++ b/Gores/AstralWaterDroplet.cs @@ -1,16 +1,22 @@ using Microsoft.Xna.Framework; using Terraria; -using Terraria.GameContent.Shaders; -using Terraria.Graphics.Effects; -using Terraria.ModLoader; -using Terraria.ID; using Terraria.Audio; using Terraria.DataStructures; +using Terraria.GameContent; +using Terraria.GameContent.Shaders; +using Terraria.Graphics.Effects; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Gores { public class AstralWaterDroplet : ModGore { + public override void SetStaticDefaults() + { + ChildSafety.SafeGore[Type] = true; + } + public override void OnSpawn(Gore gore, IEntitySource source) { gore.numFrames = 15; diff --git a/Gores/EmptyAnimosityShell.png b/Gores/EmptyAnimosityShell.png new file mode 100644 index 0000000000..79237b2015 Binary files /dev/null and b/Gores/EmptyAnimosityShell.png differ diff --git a/Gores/EmptyAnimosityShell2.png b/Gores/EmptyAnimosityShell2.png new file mode 100644 index 0000000000..cd36f17ad8 Binary files /dev/null and b/Gores/EmptyAnimosityShell2.png differ diff --git a/Gores/HarvestStaffGores/PumpkinGore1.png b/Gores/HarvestStaffGores/PumpkinGore1.png new file mode 100644 index 0000000000..2cf4881baa Binary files /dev/null and b/Gores/HarvestStaffGores/PumpkinGore1.png differ diff --git a/Gores/HarvestStaffGores/PumpkinGore2.png b/Gores/HarvestStaffGores/PumpkinGore2.png new file mode 100644 index 0000000000..005e5c8d6c Binary files /dev/null and b/Gores/HarvestStaffGores/PumpkinGore2.png differ diff --git a/Gores/HarvestStaffGores/PumpkinGore3.png b/Gores/HarvestStaffGores/PumpkinGore3.png new file mode 100644 index 0000000000..3b19395b52 Binary files /dev/null and b/Gores/HarvestStaffGores/PumpkinGore3.png differ diff --git a/Gores/HarvestStaffGores/PumpkinGore4.png b/Gores/HarvestStaffGores/PumpkinGore4.png new file mode 100644 index 0000000000..327c2eb5d7 Binary files /dev/null and b/Gores/HarvestStaffGores/PumpkinGore4.png differ diff --git a/Gores/HarvestStaffGores/PumpkinGore5.png b/Gores/HarvestStaffGores/PumpkinGore5.png new file mode 100644 index 0000000000..859a2b9d21 Binary files /dev/null and b/Gores/HarvestStaffGores/PumpkinGore5.png differ diff --git a/Gores/HarvestStaffGores/PumpkinGore6.png b/Gores/HarvestStaffGores/PumpkinGore6.png new file mode 100644 index 0000000000..a54d4c9452 Binary files /dev/null and b/Gores/HarvestStaffGores/PumpkinGore6.png differ diff --git a/Gores/Rotdog/Rotdog1.png b/Gores/Rotdog/Rotdog1.png new file mode 100644 index 0000000000..a7b1a625c3 Binary files /dev/null and b/Gores/Rotdog/Rotdog1.png differ diff --git a/Gores/Rotdog/Rotdog2.png b/Gores/Rotdog/Rotdog2.png new file mode 100644 index 0000000000..ff18b4f9fa Binary files /dev/null and b/Gores/Rotdog/Rotdog2.png differ diff --git a/Gores/Rotdog/Rotdog3.png b/Gores/Rotdog/Rotdog3.png new file mode 100644 index 0000000000..79a07bbb78 Binary files /dev/null and b/Gores/Rotdog/Rotdog3.png differ diff --git a/Gores/Rotdog/Rotdog4.png b/Gores/Rotdog/Rotdog4.png new file mode 100644 index 0000000000..d1730ad346 Binary files /dev/null and b/Gores/Rotdog/Rotdog4.png differ diff --git a/Gores/ScourgeBody.png b/Gores/ScourgeBody.png index accaf65b82..a2f3d2d311 100644 Binary files a/Gores/ScourgeBody.png and b/Gores/ScourgeBody.png differ diff --git a/Gores/ScourgeBody2.png b/Gores/ScourgeBody2.png index b794713f53..eeaebc2314 100644 Binary files a/Gores/ScourgeBody2.png and b/Gores/ScourgeBody2.png differ diff --git a/Gores/ScourgeBody3.png b/Gores/ScourgeBody3.png index dac9809a08..b19c571370 100644 Binary files a/Gores/ScourgeBody3.png and b/Gores/ScourgeBody3.png differ diff --git a/Gores/ScourgeBody4.png b/Gores/ScourgeBody4.png new file mode 100644 index 0000000000..a6260dc14b Binary files /dev/null and b/Gores/ScourgeBody4.png differ diff --git a/Gores/ScourgeBody5.png b/Gores/ScourgeBody5.png new file mode 100644 index 0000000000..1c5cc5c959 Binary files /dev/null and b/Gores/ScourgeBody5.png differ diff --git a/Gores/ScourgeHead.png b/Gores/ScourgeHead.png index e8d61d2dc7..27d89de361 100644 Binary files a/Gores/ScourgeHead.png and b/Gores/ScourgeHead.png differ diff --git a/Gores/ScourgeHead2.png b/Gores/ScourgeHead2.png index 8510307c09..bf40772330 100644 Binary files a/Gores/ScourgeHead2.png and b/Gores/ScourgeHead2.png differ diff --git a/Gores/ScourgeHead3.png b/Gores/ScourgeHead3.png new file mode 100644 index 0000000000..93af69d947 Binary files /dev/null and b/Gores/ScourgeHead3.png differ diff --git a/Gores/ScourgeNuisance2Body.png b/Gores/ScourgeNuisance2Body.png new file mode 100644 index 0000000000..fc0d902bc4 Binary files /dev/null and b/Gores/ScourgeNuisance2Body.png differ diff --git a/Gores/ScourgeNuisance2Body2.png b/Gores/ScourgeNuisance2Body2.png new file mode 100644 index 0000000000..f9a1ff5528 Binary files /dev/null and b/Gores/ScourgeNuisance2Body2.png differ diff --git a/Gores/ScourgeNuisance2Body3.png b/Gores/ScourgeNuisance2Body3.png new file mode 100644 index 0000000000..899345e378 Binary files /dev/null and b/Gores/ScourgeNuisance2Body3.png differ diff --git a/Gores/ScourgeNuisance2Body4.png b/Gores/ScourgeNuisance2Body4.png new file mode 100644 index 0000000000..d7f84f5b23 Binary files /dev/null and b/Gores/ScourgeNuisance2Body4.png differ diff --git a/Gores/ScourgeNuisance2Head.png b/Gores/ScourgeNuisance2Head.png new file mode 100644 index 0000000000..21d4c058fa Binary files /dev/null and b/Gores/ScourgeNuisance2Head.png differ diff --git a/Gores/ScourgeNuisance2Tail.png b/Gores/ScourgeNuisance2Tail.png new file mode 100644 index 0000000000..e120482403 Binary files /dev/null and b/Gores/ScourgeNuisance2Tail.png differ diff --git a/Gores/ScourgeNuisanceBody.png b/Gores/ScourgeNuisanceBody.png new file mode 100644 index 0000000000..991f581dc3 Binary files /dev/null and b/Gores/ScourgeNuisanceBody.png differ diff --git a/Gores/ScourgeNuisanceBody2.png b/Gores/ScourgeNuisanceBody2.png new file mode 100644 index 0000000000..b39b721bfb Binary files /dev/null and b/Gores/ScourgeNuisanceBody2.png differ diff --git a/Gores/ScourgeNuisanceBody3.png b/Gores/ScourgeNuisanceBody3.png new file mode 100644 index 0000000000..09faf4f834 Binary files /dev/null and b/Gores/ScourgeNuisanceBody3.png differ diff --git a/Gores/ScourgeNuisanceBody4.png b/Gores/ScourgeNuisanceBody4.png new file mode 100644 index 0000000000..1bf3cf5c0f Binary files /dev/null and b/Gores/ScourgeNuisanceBody4.png differ diff --git a/Gores/ScourgeNuisanceHead.png b/Gores/ScourgeNuisanceHead.png new file mode 100644 index 0000000000..a79bd4df83 Binary files /dev/null and b/Gores/ScourgeNuisanceHead.png differ diff --git a/Gores/ScourgeNuisanceTail.png b/Gores/ScourgeNuisanceTail.png new file mode 100644 index 0000000000..bb867d7c1e Binary files /dev/null and b/Gores/ScourgeNuisanceTail.png differ diff --git a/Gores/ScourgePestBody.png b/Gores/ScourgePestBody.png new file mode 100644 index 0000000000..e120f5edc7 Binary files /dev/null and b/Gores/ScourgePestBody.png differ diff --git a/Gores/ScourgePestBody2.png b/Gores/ScourgePestBody2.png new file mode 100644 index 0000000000..8e07accb80 Binary files /dev/null and b/Gores/ScourgePestBody2.png differ diff --git a/Gores/ScourgePestBody3.png b/Gores/ScourgePestBody3.png new file mode 100644 index 0000000000..adedc10e2f Binary files /dev/null and b/Gores/ScourgePestBody3.png differ diff --git a/Gores/ScourgePestBody4.png b/Gores/ScourgePestBody4.png new file mode 100644 index 0000000000..7b3f75ea31 Binary files /dev/null and b/Gores/ScourgePestBody4.png differ diff --git a/Gores/ScourgePestHead.png b/Gores/ScourgePestHead.png new file mode 100644 index 0000000000..b0be38f842 Binary files /dev/null and b/Gores/ScourgePestHead.png differ diff --git a/Gores/ScourgePestTail.png b/Gores/ScourgePestTail.png new file mode 100644 index 0000000000..39e6906844 Binary files /dev/null and b/Gores/ScourgePestTail.png differ diff --git a/Gores/ScourgeTail.png b/Gores/ScourgeTail.png index 6c89dc8498..0d034bfcee 100644 Binary files a/Gores/ScourgeTail.png and b/Gores/ScourgeTail.png differ diff --git a/Gores/SlabCrab/SlabCrab1.png b/Gores/SlabCrab/SlabCrab1.png new file mode 100644 index 0000000000..627ee10eb0 Binary files /dev/null and b/Gores/SlabCrab/SlabCrab1.png differ diff --git a/Gores/SlabCrab/SlabCrab2.png b/Gores/SlabCrab/SlabCrab2.png new file mode 100644 index 0000000000..0dac1306b7 Binary files /dev/null and b/Gores/SlabCrab/SlabCrab2.png differ diff --git a/Gores/SlabCrab/SlabCrab3.png b/Gores/SlabCrab/SlabCrab3.png new file mode 100644 index 0000000000..03afc901c2 Binary files /dev/null and b/Gores/SlabCrab/SlabCrab3.png differ diff --git a/Gores/SlabCrab/SlabCrab4.png b/Gores/SlabCrab/SlabCrab4.png new file mode 100644 index 0000000000..a3c328cbb3 Binary files /dev/null and b/Gores/SlabCrab/SlabCrab4.png differ diff --git a/Gores/Trees/AstralLeaf.cs b/Gores/Trees/AstralLeaf.cs index 546ba9c563..5af4544b8a 100644 --- a/Gores/Trees/AstralLeaf.cs +++ b/Gores/Trees/AstralLeaf.cs @@ -1,21 +1,26 @@ +using Microsoft.Xna.Framework; using Terraria; -using Terraria.ModLoader; -using Terraria.GameContent; using Terraria.DataStructures; -using Microsoft.Xna.Framework; +using Terraria.GameContent; +using Terraria.ModLoader; namespace CalamityMod.Gores.Trees { - public class AstralLeaf : ModGore - { - public override void OnSpawn(Gore gore, IEntitySource source) - { - ChildSafety.SafeGore[gore.type] = true; - gore.velocity = new Vector2(Main.rand.NextFloat() - 0.5f, Main.rand.NextFloat() * MathHelper.TwoPi); - gore.numFrames = 8; - gore.frame = (byte)Main.rand.Next(8); - gore.frameCounter = (byte)Main.rand.Next(8); - UpdateType = 910; - } - } -} \ No newline at end of file + public class AstralLeaf : ModGore + { + public override void SetStaticDefaults() + { + ChildSafety.SafeGore[Type] = true; + } + + public override void OnSpawn(Gore gore, IEntitySource source) + { + ChildSafety.SafeGore[gore.type] = true; + gore.velocity = new Vector2(Main.rand.NextFloat() - 0.5f, Main.rand.NextFloat() * MathHelper.TwoPi); + gore.numFrames = 8; + gore.frame = (byte)Main.rand.Next(8); + gore.frameCounter = (byte)Main.rand.Next(8); + UpdateType = 910; + } + } +} diff --git a/Gores/Trees/SulphurLeaf.cs b/Gores/Trees/SulphurLeaf.cs index 2d081a4f47..01a45d2ce8 100644 --- a/Gores/Trees/SulphurLeaf.cs +++ b/Gores/Trees/SulphurLeaf.cs @@ -1,21 +1,26 @@ +using Microsoft.Xna.Framework; using Terraria; -using Terraria.ModLoader; -using Terraria.GameContent; using Terraria.DataStructures; -using Microsoft.Xna.Framework; +using Terraria.GameContent; +using Terraria.ModLoader; namespace CalamityMod.Gores.Trees { - public class SulphurLeaf : ModGore - { - public override void OnSpawn(Gore gore, IEntitySource source) - { - ChildSafety.SafeGore[gore.type] = true; - gore.velocity = new Vector2(Main.rand.NextFloat() - 0.5f, Main.rand.NextFloat() * MathHelper.TwoPi); - gore.numFrames = 8; - gore.frame = (byte)Main.rand.Next(8); - gore.frameCounter = (byte)Main.rand.Next(8); - UpdateType = 910; - } - } -} \ No newline at end of file + public class SulphurLeaf : ModGore + { + public override void SetStaticDefaults() + { + ChildSafety.SafeGore[Type] = true; + } + + public override void OnSpawn(Gore gore, IEntitySource source) + { + ChildSafety.SafeGore[gore.type] = true; + gore.velocity = new Vector2(Main.rand.NextFloat() - 0.5f, Main.rand.NextFloat() * MathHelper.TwoPi); + gore.numFrames = 8; + gore.frame = (byte)Main.rand.Next(8); + gore.frameCounter = (byte)Main.rand.Next(8); + UpdateType = 910; + } + } +} diff --git a/Graphics/ManagedRenderTarget.cs b/Graphics/ManagedRenderTarget.cs index 2d219019d3..f69b815ca7 100644 --- a/Graphics/ManagedRenderTarget.cs +++ b/Graphics/ManagedRenderTarget.cs @@ -1,6 +1,6 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; namespace CalamityMod.Graphics diff --git a/Graphics/Metaballs/PaintMetaballs.cs b/Graphics/Metaballs/PaintMetaballs.cs index bfe0fc2cc7..0501af90ff 100644 --- a/Graphics/Metaballs/PaintMetaballs.cs +++ b/Graphics/Metaballs/PaintMetaballs.cs @@ -1,8 +1,8 @@ -using CalamityMod.Effects; +using System.Collections.Generic; +using System.Linq; +using CalamityMod.Effects; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System.Collections.Generic; -using System.Linq; using Terraria; using Terraria.ModLoader; diff --git a/Graphics/Metaballs/PhotoMetaball.cs b/Graphics/Metaballs/PhotoMetaball.cs index 528537a831..6d3447dd90 100644 --- a/Graphics/Metaballs/PhotoMetaball.cs +++ b/Graphics/Metaballs/PhotoMetaball.cs @@ -55,7 +55,7 @@ namespace CalamityMod.Graphics.Metaballs } public override MetaballDrawLayer DrawContext => MetaballDrawLayer.AfterProjectiles; - + public Color sparkColor; public int Time = 0; public override Color EdgeColor => sparkColor; diff --git a/Graphics/Metaballs/PhotoMetaball2.cs b/Graphics/Metaballs/PhotoMetaball2.cs index 98a189e8cf..f1cdc7737f 100644 --- a/Graphics/Metaballs/PhotoMetaball2.cs +++ b/Graphics/Metaballs/PhotoMetaball2.cs @@ -55,7 +55,7 @@ namespace CalamityMod.Graphics.Metaballs } public override MetaballDrawLayer DrawContext => MetaballDrawLayer.AfterProjectiles; - + public Color sparkColor; public int Time; public override Color EdgeColor => sparkColor * 5; diff --git a/Graphics/Metaballs/PhotoMetaball3.cs b/Graphics/Metaballs/PhotoMetaball3.cs index 95f2645dfc..9ddc7f2e1c 100644 --- a/Graphics/Metaballs/PhotoMetaball3.cs +++ b/Graphics/Metaballs/PhotoMetaball3.cs @@ -48,7 +48,7 @@ namespace CalamityMod.Graphics.Metaballs } public override MetaballDrawLayer DrawContext => MetaballDrawLayer.AfterProjectiles; - + public Color sparkColor; public int Time = 0; public override Color EdgeColor => sparkColor; diff --git a/Graphics/Metaballs/PhotoMetaball4.cs b/Graphics/Metaballs/PhotoMetaball4.cs index 8aa4e991a5..2df1a25d8b 100644 --- a/Graphics/Metaballs/PhotoMetaball4.cs +++ b/Graphics/Metaballs/PhotoMetaball4.cs @@ -48,7 +48,7 @@ namespace CalamityMod.Graphics.Metaballs } public override MetaballDrawLayer DrawContext => MetaballDrawLayer.AfterProjectiles; - + public Color sparkColor; public int Time; public override Color EdgeColor => sparkColor * 5; diff --git a/Graphics/Metaballs/RancorLavaMetaball.cs b/Graphics/Metaballs/RancorLavaMetaball.cs index 60882cf578..ef0d3c6124 100644 --- a/Graphics/Metaballs/RancorLavaMetaball.cs +++ b/Graphics/Metaballs/RancorLavaMetaball.cs @@ -1,11 +1,11 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria.ModLoader; -using Terraria; +using System; using System.Collections.Generic; using System.Linq; using CalamityMod.Effects; -using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; namespace CalamityMod.Graphics.Metaballs { diff --git a/Graphics/Primitives/PrimitiveRenderer.cs b/Graphics/Primitives/PrimitiveRenderer.cs index a8f360899f..928c64bfd4 100644 --- a/Graphics/Primitives/PrimitiveRenderer.cs +++ b/Graphics/Primitives/PrimitiveRenderer.cs @@ -46,7 +46,7 @@ namespace CalamityMod.Graphics.Primitives private static short IndicesIndex; - static PrimitiveRenderer() + internal static void Initialize() { Main.QueueMainThreadAction(() => { @@ -162,7 +162,13 @@ namespace CalamityMod.Graphics.Primitives int currentIndex = (int)(completionRatio * (positions.Length - 1)); Vector2 currentPoint = positions[currentIndex]; Vector2 nextPoint = positions[(currentIndex + 1) % positions.Length]; - MainPositions[PositionsIndex] = Vector2.Lerp(currentPoint, nextPoint, completionRatio * (positions.Length - 1) % 0.99999f) - Main.screenPosition; + + // 29FEB2024: Ozzatron: offset function needs to apply even in cases where smoothing is off. + Vector2 finalPos = Vector2.Lerp(currentPoint, nextPoint, completionRatio * (positions.Length - 1) % 0.99999f) - Main.screenPosition; + if (settings.OffsetFunction != null) + finalPos += settings.OffsetFunction(completionRatio); + + MainPositions[PositionsIndex] = finalPos; PositionsIndex++; } return true; diff --git a/Graphics/RenderTargetManager.cs b/Graphics/RenderTargetManager.cs index 1234fe0490..5c4888044c 100644 --- a/Graphics/RenderTargetManager.cs +++ b/Graphics/RenderTargetManager.cs @@ -1,6 +1,6 @@ -using Microsoft.Xna.Framework; +using System.Collections.Generic; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System.Collections.Generic; using Terraria; using Terraria.ModLoader; diff --git a/Graphics/Renderers/CalamityRenderers/DeerclopsShadowRenderer.cs b/Graphics/Renderers/CalamityRenderers/DeerclopsShadowRenderer.cs index 06675a2b5e..94905b59fc 100644 --- a/Graphics/Renderers/CalamityRenderers/DeerclopsShadowRenderer.cs +++ b/Graphics/Renderers/CalamityRenderers/DeerclopsShadowRenderer.cs @@ -1,4 +1,4 @@ -using CalamityMod.NPCs.VanillaNPCOverrides.Bosses; +using CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; diff --git a/Graphics/Renderers/CalamityRenderers/DyeableShadersRenderer.cs b/Graphics/Renderers/CalamityRenderers/DyeableShadersRenderer.cs index cef3849b1a..f01c539a2f 100644 --- a/Graphics/Renderers/CalamityRenderers/DyeableShadersRenderer.cs +++ b/Graphics/Renderers/CalamityRenderers/DyeableShadersRenderer.cs @@ -91,7 +91,7 @@ namespace CalamityMod.Graphics.Renderers.CalamityRenderers if (head.ModItem != null && head.ModItem.IsArmorSet(head, body, legs) && head.ModItem is IDyeableShaderRenderer renderer) MarkAsValid(renderer); - + if (body.ModItem != null && body.ModItem.IsArmorSet(head, body, legs) && body.ModItem is IDyeableShaderRenderer renderer2) MarkAsValid(renderer2); diff --git a/Graphics/Renderers/CalamityRenderers/HolyInfernoRenderer.cs b/Graphics/Renderers/CalamityRenderers/HolyInfernoRenderer.cs index 79dd43ab77..239947daaa 100644 --- a/Graphics/Renderers/CalamityRenderers/HolyInfernoRenderer.cs +++ b/Graphics/Renderers/CalamityRenderers/HolyInfernoRenderer.cs @@ -15,7 +15,22 @@ namespace CalamityMod.Graphics.Renderers.CalamityRenderers public override DrawLayer Layer => DrawLayer.BeforeTiles; - public static Providence Provi => Main.npc[CalamityGlobalNPC.holyBoss].ModNPC as Providence; + public static Providence Provi + { + get + { + if (!Main.npc.IndexInRange(CalamityGlobalNPC.holyBoss)) + return null; + if (Main.npc[CalamityGlobalNPC.holyBoss].type != ModContent.NPCType()) + return null; + + if (Main.npc[CalamityGlobalNPC.holyBoss].ModNPC is not null && + Main.npc[CalamityGlobalNPC.holyBoss].ModNPC is Providence provi) + return provi; + + return null; + } + } //Should only draw if not in the main menu, provi is active and the boolean for drawing the border is true. public override bool ShouldDraw => !Main.gameMenu && CalamityGlobalNPC.holyBoss != -1 && @@ -33,6 +48,8 @@ namespace CalamityMod.Graphics.Renderers.CalamityRenderers var target = Main.player[Main.myPlayer]; var holyInfernoIntensity = target.Calamity().holyInfernoFadeIntensity; var prov = Provi; + if (prov == null) + return; //Begin drawing the inferno var blackTile = TextureAssets.MagicPixel; @@ -48,7 +65,7 @@ namespace CalamityMod.Graphics.Renderers.CalamityRenderers } var shader = GameShaders.Misc["CalamityMod:HolyInfernoShader"].Shader; - shader.Parameters["colorMult"].SetValue(Main.dayTime ? 7.35f : 7.65f); //I want you to know it took considerable restraint to deliberately misspell colour. + shader.Parameters["colorMult"].SetValue(Main.IsItDay() ? 7.35f : 7.65f); //I want you to know it took considerable restraint to deliberately misspell colour. shader.Parameters["time"].SetValue(Main.GlobalTimeWrappedHourly); shader.Parameters["radius"].SetValue(borderDistance); shader.Parameters["anchorPoint"].SetValue(npc.Center); @@ -57,7 +74,7 @@ namespace CalamityMod.Graphics.Renderers.CalamityRenderers shader.Parameters["burnIntensity"].SetValue(holyInfernoIntensity); shader.Parameters["playerPosition"].SetValue(target.Center); shader.Parameters["maxOpacity"].SetValue(maxOpacity); - shader.Parameters["day"].SetValue(Main.dayTime); + shader.Parameters["day"].SetValue(Main.IsItDay()); spriteBatch.GraphicsDevice.Textures[1] = diagonalNoise.Value; spriteBatch.GraphicsDevice.Textures[2] = upwardNoise.Value; diff --git a/ILEditing/BalancingILChanges.cs b/ILEditing/BalancingILChanges.cs index fbb1cbd80c..0d4956e672 100644 --- a/ILEditing/BalancingILChanges.cs +++ b/ILEditing/BalancingILChanges.cs @@ -1,9 +1,6 @@ using System; using CalamityMod.Balancing; using CalamityMod.Items.Accessories; -using CalamityMod.Items.Placeables.FurniturePlagued; -using CalamityMod.Items.Potions; -using CalamityMod.NPCs.DraedonLabThings; using Mono.Cecil.Cil; using MonoMod.Cil; using Terraria; @@ -27,9 +24,9 @@ namespace CalamityMod.ILEditing return orig(type); } - + #endregion - + #region Soaring Insignia Changes private static void RemoveSoaringInsigniaInfiniteWingTime(ILContext il) { @@ -48,7 +45,7 @@ namespace CalamityMod.ILEditing private static void NerfSoaringInsigniaRunAcceleration(ILContext il) { - // Nerf the run acceleration boost from 2x to 1.1x. + // Nerf the run acceleration boost from 1.75x to 1.1x. var cursor = new ILCursor(il); if (!cursor.TryGotoNext(MoveType.After, i => i.MatchLdfld("empressBrooch"))) { @@ -112,6 +109,7 @@ namespace CalamityMod.ILEditing cursor.Emit(OpCodes.Ldc_R4, 0.5f); // Decrease to 0.5f. // Find the Frog Leg jump speed bonus and reduce it to 1.2f. + // I don't know if this fucking does anything anymore, but I'm leaving it in just in case. if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdcR4(2.4f))) { LogFailure("Jump Height Boost Fixes", "Could not locate Frog Leg jump speed boost value."); @@ -351,11 +349,11 @@ namespace CalamityMod.ILEditing /* Prehardmode = 2 * Hardmode = 3 * Post-Moon Lord = 4 - * Post-DoG = 6 + * Post-DoG = 5 */ if (DownedBossSystem.downedDoG) - self.statDefense += 4; + self.statDefense += 3; else if (NPC.downedMoonlord) self.statDefense += 2; else if (Main.hardMode) @@ -366,34 +364,34 @@ namespace CalamityMod.ILEditing if (item.prefix == PrefixID.Armored) { /* Prehardmode = 3 - * Hardmode = 5 - * Post-Moon Lord = 6 - * Post-DoG = 8 + * Hardmode = 4 + * Post-Moon Lord = 5 + * Post-DoG = 6 */ if (DownedBossSystem.downedDoG) - self.statDefense += 5; - else if (NPC.downedMoonlord) self.statDefense += 3; - else if (Main.hardMode) + else if (NPC.downedMoonlord) self.statDefense += 2; + else if (Main.hardMode) + self.statDefense += 1; self.endurance += 0.0075f; } if (item.prefix == PrefixID.Warding) { /* Prehardmode = 4 - * Hardmode = 6 - * Post-Moon Lord = 8 - * Post-DoG = 10 + * Hardmode = 5 + * Post-Moon Lord = 6 + * Post-DoG = 7 */ if (DownedBossSystem.downedDoG) - self.statDefense += 6; + self.statDefense += 3; else if (NPC.downedMoonlord) - self.statDefense += 4; - else if (Main.hardMode) self.statDefense += 2; + else if (Main.hardMode) + self.statDefense += 1; self.endurance += 0.01f; } @@ -429,34 +427,6 @@ namespace CalamityMod.ILEditing } #endregion - #region Chlorophyte Bullet Speed Nerfs - private static void AdjustChlorophyteBullets(ILContext il) - { - // Reduce dust from 10 to 5 and homing range. - var cursor = new ILCursor(il); - if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdcI4(ProjectileID.ChlorophyteBullet))) - { - LogFailure("Chlorophyte Bullet AI", "Could not locate the bullet ID."); - return; - } - if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdcI4(10))) // The number of dust spawned by the bullet. - { - LogFailure("Chlorophyte Bullet AI", "Could not locate the dust quantity."); - return; - } - cursor.Remove(); - cursor.Emit(OpCodes.Ldc_I4_5); // Decrease dust to 5. - - if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdcR4(300f))) // The 300 unit distance required to home in. - { - LogFailure("Chlorophyte Bullet AI", "Could not locate the homing range."); - return; - } - cursor.Remove(); - cursor.Emit(OpCodes.Ldc_R4, 150f); // Reduce homing range by 50%. - } - #endregion - #region Terrarian Projectile Limitation for Extra Updates private static void LimitTerrarianProjectiles(ILContext il) { @@ -496,6 +466,148 @@ namespace CalamityMod.ILEditing } #endregion + #region Beetle Scale Mail (DPS chestplate) Nerf + private static void NerfBeetleScaleMail(ILContext il) + { + // Adjust melee damage from the Beetle Might buff. + var cursor = new ILCursor(il); + if (!cursor.TryGotoNext(MoveType.After, i => i.MatchLdcI4(BuffID.BeetleMight1))) + { + LogFailure("Beetle Scale Mail Nerf", "Could not locate the Beetle Might buff ID."); + return; + } + if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdcR4(0.1f))) // The amount of melee damage to grant. + { + LogFailure("Beetle Scale Mail Nerf", "Could not locate the amount of melee damage granted."); + return; + } + + // Replace the value entirely. + cursor.Remove(); + cursor.Emit(OpCodes.Ldc_R4, BalancingConstants.BeetleScaleMailMeleeDamagePerBeetle); + + cursor.GotoNext(); + + // Adjust melee speed from the Beetle Might buff. + if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdcR4(0.1f))) // The amount of melee speed to grant. + { + LogFailure("Beetle Scale Mail Nerf", "Could not locate the amount of melee speed granted."); + return; + } + + // Replace the value entirely. + cursor.Remove(); + cursor.Emit(OpCodes.Ldc_R4, BalancingConstants.BeetleScaleMailMeleeSpeedPerBeetle); + } + #endregion + + #region Nebula Armor Nerfs + private static void NerfNebulaArmorBaseLifeRegenAndDamage(ILContext il) + { + // Nebula's buffs are processed in the order Mana, Life, Damage + // The mana buff is merely tracked and updated in this function, so it is not IL edited here. + var cursor = new ILCursor(il); + + // Adjust life regen from the Nebula Life Boosters. + if (!cursor.TryGotoNext(MoveType.After, i => i.MatchLdcI4(BuffID.NebulaUpLife1))) + { + LogFailure("Nebula Armor Nerf", "Could not locate the Nebula Life buff ID."); + return; + } + if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdfld("lifeRegen"))) + { + LogFailure("Nebula Armor Nerf", "Could not locate the player's life regen being loaded."); + return; + } + if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdcI4(6))) + { + LogFailure("Nebula Armor Nerf", "Could not locate the amount of life regen to grant."); + return; + } + + // Replace the constant "load 6" opcode with a regular integer load with Calamity's value. + cursor.Remove(); + cursor.Emit(OpCodes.Ldc_I4, BalancingConstants.NebulaLifeRegenPerBooster); + + // Adjust damage from Nebula Damage Boosters. + if (!cursor.TryGotoNext(MoveType.After, i => i.MatchLdcI4(BuffID.NebulaUpDmg1))) + { + LogFailure("Nebula Armor Nerf", "Could not locate the Nebula Damage buff ID."); + return; + } + if (!cursor.TryGotoNext(MoveType.AfterLabel, i => i.MatchLdcR4(0.15f))) + { + LogFailure("Nebula Armor Nerf", "Could not locate the amount of damage to grant."); + return; + } + + // There are multiple branches pointing to this instruction, so it cannot be removed. Instead, swap its value directly. + cursor.Next.Operand = BalancingConstants.NebulaDamagePerBooster; + } + + private static void RemoveNebulaLifeBoosterDoTImmunity(ILContext il) + { + // Prevent Nebula Life Boosters from canceling out all DoT debuff damage. + var cursor = new ILCursor(il); + if (!cursor.TryGotoNext(MoveType.After, i => i.MatchLdfld("nebulaLevelLife"))) + { + LogFailure("Nebula Armor DoT Ignoring Nerf", "Could not locate the Nebula Armor Life Booster variable."); + return; + } + + // Pop this value off the stack and replace it with a zero. + // Zero will never be greater than zero, so negative life regen will never be canceled out. + cursor.Emit(OpCodes.Pop); + cursor.Emit(OpCodes.Ldc_I4_0); + } + + private static void NerfNebulaArmorManaRegen(ILContext il) + { + // Reduce Nebula armor mana regen. + // The regen is controlled by a frame counter threshold right at the top of the function, typically 6. + // 1 value is added to the counter for every Mana Booster you have. + // If the value reaches the threshold, you gain 1 mana. + // All that needs to be done is raising the threshold, so it takes more frames to get each point of mana. + var cursor = new ILCursor(il); + if (!cursor.TryGotoNext(MoveType.AfterLabel, i => i.MatchLdcI4(6))) + { + LogFailure("Nebula Armor Mana Regen Nerf", "Could not locate the Nebula Armor mana regeneration frame counter threshold."); + return; + } + + // Swap the threshold with Calamity's value. + cursor.Next.Operand = BalancingConstants.NebulaManaRegenFrameCounterThreshold; + } + #endregion + + #region Remove Melee Armor (Beetle Shell + Solar Flare) Multiplicative DR + private static void RemoveBeetleAndSolarFlareMultiplicativeDR(ILContext il) + { + // Remove the multiplicative DR from Solar Flare armor's Solar Shields + var cursor = new ILCursor(il); + if (!cursor.TryGotoNext(MoveType.After, i => i.MatchLdfld("setSolar"))) + { + LogFailure("Melee Multiplicative DR Removal", "Could not locate the Solar Flare set bonus field."); + return; + } + + // AND with 0 (false) so that the Solar Flare set bonus is never considered to be active. This stops the multiplicative DR from applying. + cursor.Emit(OpCodes.Ldc_I4_0); + cursor.Emit(OpCodes.And); + + // Remove the multiplicative DR from Beetle Shell's beetles + if (!cursor.TryGotoNext(MoveType.After, i => i.MatchLdfld("beetleDefense"))) + { + LogFailure("Melee Multiplicative DR Removal", "Could not locate the Beetle Shell set bonus field."); + return; + } + + // AND with 0 (false) so that the Beetle Shell set bonus is never considered to be active. This stops the multiplicative DR from applying. + cursor.Emit(OpCodes.Ldc_I4_0); + cursor.Emit(OpCodes.And); + } + #endregion + #region Remove Lunatic Cultist Homing Resist private static void RemoveLunaticCultistHomingResist(ILContext il) { diff --git a/ILEditing/ILChangesLoading.cs b/ILEditing/ILChangesLoading.cs index 4493392853..2c8fb20700 100644 --- a/ILEditing/ILChangesLoading.cs +++ b/ILEditing/ILChangesLoading.cs @@ -1,8 +1,6 @@ using System; using System.Reflection; using CalamityMod.Graphics.Renderers.CalamityRenderers; -using CalamityMod.Items.Accessories; -using CalamityMod.Items.Armor.LunicCorps; using CalamityMod.Tiles.DraedonStructures; using CalamityMod.Tiles.FurnitureExo; using Terraria; @@ -12,8 +10,10 @@ using Terraria.GameContent.Drawing; using Terraria.GameContent.Events; using Terraria.GameContent.ItemDropRules; using Terraria.GameContent.Liquid; +using Terraria.GameContent.UI.Elements; using Terraria.GameContent.UI.States; using Terraria.Graphics.Light; +using Terraria.Map; using Terraria.ModLoader; namespace CalamityMod.ILEditing @@ -82,6 +82,8 @@ namespace CalamityMod.ILEditing On_NPC.Collision_DecideFallThroughPlatforms += EnableCalamityBossPlatformCollision; IL_Wiring.HitWireSingle += AddTwinklersToStatue; On_Player.UpdateItemDye += FindCalamityItemDyeShader; + On_AWorldListItem.GetDifficulty += GetDifficultyOverride; + On_Item.GetShimmered += ShimmerEffectEdits; // Mana Burn (Chaos Stone) and Chalice of the Blood God IL_Player.ApplyLifeAndOrMana += ManaSicknessAndChaliceBufferHeal; @@ -95,9 +97,11 @@ namespace CalamityMod.ILEditing // Damage and health balance On_Main.DamageVar_float_int_float += AdjustDamageVariance; IL_NPC.ScaleStats_ApplyExpertTweaks += RemoveExpertHardmodeScaling; - IL_Projectile.AI_001 += AdjustChlorophyteBullets; IL_Projectile.AI_099_2 += LimitTerrarianProjectiles; IL_Player.UpdateBuffs += NerfSharpeningStation; + IL_Player.UpdateBuffs += NerfBeetleScaleMail; + IL_Player.UpdateBuffs += NerfNebulaArmorBaseLifeRegenAndDamage; + IL_Player.ApplyVanillaHurtEffectModifiers += RemoveBeetleAndSolarFlareMultiplicativeDR; // Movement speed balance IL_Player.UpdateJumpHeight += FixJumpHeightBoosts; @@ -108,10 +112,12 @@ namespace CalamityMod.ILEditing // Life regen balance IL_Player.UpdateLifeRegen += PreventWellFedFromBeingRequiredInExpertModeForFullLifeRegen; + IL_Player.UpdateLifeRegen += RemoveNebulaLifeBoosterDoTImmunity; // Mana regen balance IL_Player.Update += ManaRegenDelayAdjustment; IL_Player.UpdateManaRegen += ManaRegenAdjustment; + IL_Player.UpdateManaRegen += NerfNebulaArmorManaRegen; // Item prefix changes On_Player.GrantPrefixBenefits += PrefixChanges; @@ -139,8 +145,6 @@ namespace CalamityMod.ILEditing On_NPC.SlimeRainSpawns += PreventBossSlimeRainSpawns; On_ShimmerTransforms.IsItemTransformLocked += AdjustShimmerRequirements; - // TODO -- Beat Lava Slimes once and for all - // IL.Terraria.NPC.VanillaHitEffect += RemoveLavaDropsFromExpertLavaSlimes; IL_Projectile.CanExplodeTile += MakeMeteoriteExplodable; IL_Main.UpdateWindyDayState += MakeWindyDayMusicPlayLessOften; IL_Main.UpdateTime_StartNight += BloodMoonsRequire200MaxLife; @@ -157,6 +161,9 @@ namespace CalamityMod.ILEditing // Fix vanilla not accounting for multiple bobbers when fishing with truffle worm IL_Player.ItemCheck_CheckFishingBobbers += FixTruffleWormFishing; + + // Allow specified walls to be visible through water on the map + IL_MapHelper.CreateMapTile += UseVisibleThroughWaterMapTile; //Additional detours that are in their own item files given they are only relevant to these specific items: //Rover drive detours on Player.DrawInfernoRings to draw its shield diff --git a/ILEditing/ILHelperMethods.cs b/ILEditing/ILHelperMethods.cs index e497cd1e46..01f2379f0e 100644 --- a/ILEditing/ILHelperMethods.cs +++ b/ILEditing/ILHelperMethods.cs @@ -1,15 +1,15 @@ -using CalamityMod.Waters; +using System.Collections.Generic; +using System.Linq; +using CalamityMod.Systems; +using CalamityMod.Waters; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework.Input; using MonoMod.Cil; using Terraria; -using Terraria.ID; using Terraria.Audio; -using CalamityMod.Systems; using Terraria.Graphics; -using System.Collections.Generic; -using System.Linq; -using Microsoft.Xna.Framework.Input; +using Terraria.ID; namespace CalamityMod.ILEditing { @@ -75,7 +75,7 @@ namespace CalamityMod.ILEditing if (cachedLavaStyle == default) return initialTexture; - + switch (type) { case LiquidTileType.Block: @@ -103,7 +103,7 @@ namespace CalamityMod.ILEditing // No lava style to draw? Then skip. if (cachedLavaStyle == default) return initialColor; - + cachedLavaStyle.SelectLightColor(ref initialColor.TopLeftColor); cachedLavaStyle.SelectLightColor(ref initialColor.TopRightColor); cachedLavaStyle.SelectLightColor(ref initialColor.BottomLeftColor); @@ -173,7 +173,7 @@ namespace CalamityMod.ILEditing default: break; - } + } } } diff --git a/ILEditing/MechanicILChanges.cs b/ILEditing/MechanicILChanges.cs index a36155c22a..37bdeebdbd 100644 --- a/ILEditing/MechanicILChanges.cs +++ b/ILEditing/MechanicILChanges.cs @@ -9,7 +9,9 @@ using CalamityMod.Events; using CalamityMod.FluidSimulation; using CalamityMod.ForegroundDrawing; using CalamityMod.Items.Accessories; +using CalamityMod.Items.Accessories.Vanity; using CalamityMod.Items.Dyes; +using CalamityMod.Items.Potions.Alcohol; using CalamityMod.NPCs; using CalamityMod.NPCs.Astral; using CalamityMod.NPCs.AstrumAureus; @@ -29,16 +31,20 @@ using ReLogic.Content; using Terraria; using Terraria.DataStructures; using Terraria.GameContent; +using Terraria.GameContent.Achievements; using Terraria.GameContent.Drawing; using Terraria.GameContent.Events; using Terraria.GameContent.Liquid; +using Terraria.GameContent.UI.Elements; using Terraria.GameInput; using Terraria.Graphics; using Terraria.Graphics.Light; using Terraria.Graphics.Shaders; using Terraria.ID; +using Terraria.IO; using Terraria.Localization; using Terraria.ModLoader; +using Terraria.ModLoader.IO; using Terraria.UI.Gamepad; namespace CalamityMod.ILEditing @@ -78,7 +84,8 @@ namespace CalamityMod.ILEditing cursor.Remove(); // Emit a delegate which calls the Calamity utility to consistently provide iframes. - cursor.EmitDelegate>((p, frames) => CalamityUtils.GiveIFrames(p, frames, false)); + // 17APR2024: Ozzatron: Consistent shield slam iframes are not boosted by Cross Necklace at all and are fixed. + cursor.EmitDelegate>((p, frames) => CalamityUtils.GiveUniversalIFrames(p, frames, false)); } private static readonly Func CalamityDashEquipped = (Player p) => p.Calamity().HasCustomDash ? 1 : 0; @@ -284,7 +291,7 @@ namespace CalamityMod.ILEditing #region Allow Empress to Enrage in Boss Rush private static bool AllowEmpressToEnrageInBossRush(Terraria.On_NPC.orig_ShouldEmpressBeEnraged orig) { - if (Main.dayTime || BossRushEvent.BossRushActive) + if (BossRushEvent.BossRushActive) return true; return orig(); @@ -512,13 +519,15 @@ namespace CalamityMod.ILEditing return; } - // Load the player onto the stack for use in the following delegate. + // Load the player and the healing potion used onto the stack for use in the following delegate. cursor.Emit(OpCodes.Ldarg_0); + cursor.Emit(OpCodes.Ldarg_1); // Insert a delegate which applies Chalice of the Blood God's function as appropriate. - cursor.EmitDelegate>(player => + cursor.EmitDelegate>((player, potion) => { - if (!player.active || player.dead) + // If the consumed item heals 0 health, don't bother. + if (!player.active || player.dead || potion.healLife <= 0) return; CalamityPlayer modPlayer = player.Calamity(); @@ -527,10 +536,13 @@ namespace CalamityMod.ILEditing if (modPlayer.chaliceOfTheBloodGod && modPlayer.chaliceBleedoutBuffer > 0D) { - int amountOfBleedToClear = (int)(modPlayer.chaliceBleedoutBuffer * (1f - ChaliceOfTheBloodGod.HealingPotionBufferClear)); + // 20FEB2024: Ozzatron: to prevent abuse, buffer clearing is now 50% of the potion instead of 50% of your buffer + float amountOfBleedToClear = ChaliceOfTheBloodGod.HealingPotionRatioForBufferClear * player.GetHealLife(potion, true); + + // Actually clear the buffer modPlayer.chaliceBleedoutBuffer -= amountOfBleedToClear; - // Display text indicating that damage was transferred to bleedout. + // Display text indicating that healing was applied to the bleedout buffer. if (Main.netMode != NetmodeID.Server) { string text = $"(+{amountOfBleedToClear})"; @@ -785,7 +797,7 @@ namespace CalamityMod.ILEditing cachedLavaStyle = default; orig(self); } - + private static void DrawCustomLava(Terraria.GameContent.Drawing.On_TileDrawing.orig_DrawPartialLiquid orig, TileDrawing self, bool behindBlocks, Tile tileCache, ref Vector2 position, ref Rectangle liquidSize, int liquidType, ref VertexColors colors) { if (liquidType != 1) @@ -856,7 +868,7 @@ namespace CalamityMod.ILEditing cursor.Emit(OpCodes.Ldloc, 8); cursor.Emit(OpCodes.Ldloc, 3); cursor.Emit(OpCodes.Ldloc, 4); - + // Caching these values can save a LOT of overhead at runtime. ModWaterStyle sunkenSeaWater = ModContent.GetInstance(); ModWaterStyle sulphuricWater = ModContent.GetInstance(); @@ -864,7 +876,7 @@ namespace CalamityMod.ILEditing ModWaterStyle upperAbyssWater = ModContent.GetInstance(); ModWaterStyle middleAbyssWater = ModContent.GetInstance(); ModWaterStyle voidWater = ModContent.GetInstance(); - + cursor.EmitDelegate>((initialColor, initialTexture, liquidType, x, y) => { // Don't bother changing the color if the cached drawing style is null. @@ -1355,5 +1367,69 @@ namespace CalamityMod.ILEditing // The next (untouched) instruction stores this value into Player.scope. } #endregion + + #region Custom world selection difficulties + internal static void GetDifficultyOverride(Terraria.GameContent.UI.Elements.On_AWorldListItem.orig_GetDifficulty orig, AWorldListItem self, out string expertText, out Color gameModeColor) + { + // Run the original code and pull out the original text and text color + orig(self, out expertText, out gameModeColor); + + string difficultyText = expertText; + Color difficultyColor = gameModeColor; + + // Journey Mode takes ultimate priority + if (difficultyColor == Main.creativeModeColor) + { + return; + } + + // Go through the World Selection Difficulty System's World Difficulty list backwards and choose the latest difficulty that applies + for (int i = WorldSelectionDifficultySystem.WorldDifficulties.Count - 1; i >= 0; i--) + { + WorldSelectionDifficultySystem.WorldDifficulty d = WorldSelectionDifficultySystem.WorldDifficulties[i]; + { + if (d.function(self)) + { + difficultyText = d.name; + difficultyColor = d.color; + break; + } + } + } + + // Set the text and text color + expertText = difficultyText; + gameModeColor = difficultyColor; + } + #endregion + + #region Shimmer effect edits + public static void ShimmerEffectEdits(Terraria.On_Item.orig_GetShimmered orig, Item self) + { + // Don't keep the original stack amount when shimmering Fabsol's Vodka into Crystal Heart Vodka + if (self.type == ModContent.ItemType()) + { + self.SetDefaults(ModContent.ItemType()); + self.shimmered = true; + self.shimmerWet = true; + self.wet = true; + self.velocity *= 0.1f; + if (Main.netMode == 0) + { + Item.ShimmerEffect(self.Center); + } + else + { + NetMessage.SendData(146, -1, -1, null, 0, (int)self.Center.X, (int)self.Center.Y); + NetMessage.SendData(145, -1, -1, null, self.whoAmI, 1f); + } + AchievementsHelper.NotifyProgressionEvent(27); + } + else + { + orig(self); + } + } + #endregion } } diff --git a/ILEditing/VanillaBugfixingILChanges.cs b/ILEditing/VanillaBugfixingILChanges.cs index 3675d4c63b..69df735490 100644 --- a/ILEditing/VanillaBugfixingILChanges.cs +++ b/ILEditing/VanillaBugfixingILChanges.cs @@ -1,8 +1,8 @@ -using CalamityMod.NPCs; +using System; +using CalamityMod.NPCs; using Microsoft.Xna.Framework.Graphics; using Mono.Cecil.Cil; using MonoMod.Cil; -using System; using Terraria; using Terraria.DataStructures; using Terraria.Graphics.Renderers; diff --git a/ILEditing/VanillaStupidityFixingILChanges.cs b/ILEditing/VanillaStupidityFixingILChanges.cs index a6d129466d..11e06f825f 100644 --- a/ILEditing/VanillaStupidityFixingILChanges.cs +++ b/ILEditing/VanillaStupidityFixingILChanges.cs @@ -1,18 +1,20 @@ -using CalamityMod.Balancing; +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; using CalamityMod.NPCs.AcidRain; using CalamityMod.NPCs.NormalNPCs; +using CalamityMod.Walls; using Microsoft.Xna.Framework; using Mono.Cecil.Cil; using MonoMod.Cil; -using System; -using System.Collections.Generic; -using System.Reflection; using Terraria; using Terraria.DataStructures; using Terraria.ID; +using Terraria.Map; using Terraria.ModLoader; namespace CalamityMod.ILEditing @@ -137,26 +139,6 @@ namespace CalamityMod.ILEditing } #endregion - #region Disabling of Lava Slime Lava Creation - private static void RemoveLavaDropsFromExpertLavaSlimes(ILContext il) - { - // Prevent Lava Slimes from dropping lava. - var cursor = new ILCursor(il); - if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchCallOrCallvirt("SquareTileFrame"))) // The only SquareTileFrame call in HitEffect. - { - LogFailure("Remove Lava Drops From Expert Lava Slimes", "Could not locate the SquareTileFrame function call."); - return; - } - if (!cursor.TryGotoPrev(MoveType.Before, i => i.MatchLdcI4(NPCID.LavaSlime))) // The ID of Lava Slimes. - { - LogFailure("Remove Lava Drops From Expert Lava Slimes", "Could not locate the Lava Slime ID variable."); - return; - } - cursor.Remove(); - cursor.Emit(OpCodes.Ldc_I4, 0); // Change to an impossible scenario. - } - #endregion Disabling of Lava Slime Lava Creation - #region Make Meteorite Explodable private static void MakeMeteoriteExplodable(ILContext il) { @@ -918,5 +900,62 @@ namespace CalamityMod.ILEditing } } #endregion + + #region Render Special Map Colors + private static void UseVisibleThroughWaterMapTile(ILContext il) + { + var c = new ILCursor(il); + + if (!c.TryGotoNext(x => x.MatchCall("get_Item"))) + { + LogFailure("Use VisibleThroughWater Map Tile", "Could not locate call to Terraria.Map.TileMap::get_Item."); + return; + } + + int tileIndex = -1; + if (!c.TryGotoNext(x => x.MatchStloc(out tileIndex)) || tileIndex == -1) + { + LogFailure("Use VisibleThroughWater Map Tile", "Could not determine the local variable index tile is pushed to."); + return; + } + + if (!c.TryGotoNext(x => x.MatchCall("liquidType"))) + { + LogFailure("Use VisibleThroughWater Map Tile", "Could not locate call to Terraria.Tile::liquidType."); + return; + } + + int liquidTypeIndex = -1; + if (!c.TryGotoNext(x => x.MatchStloc(out liquidTypeIndex)) || liquidTypeIndex == -1) + { + LogFailure("Use VisibleThroughWater Map Tile", "Could not determine the local variable index liquidType is pushed to."); + return; + } + + int relativeMapTypeIndex = -1; + if (!c.TryGotoNext(MoveType.After, x => x.MatchStloc(out relativeMapTypeIndex)) || relativeMapTypeIndex == -1) + { + LogFailure("Use VisibleThroughWater Map Tile", "Could not determine the local variable index of the relative map type."); + return; + } + + c.Emit(OpCodes.Ldloc_0); + c.Emit(OpCodes.Ldloc, relativeMapTypeIndex); + c.Emit(OpCodes.Ldloc, liquidTypeIndex); + c.EmitDelegate( + (Tile tile, int relativeMapType, int liquidType) => + { + if (liquidType != LiquidID.Water) + return relativeMapType; + + if (WallLoader.GetWall(tile.WallType) is IVisibleThroughWater visibleThroughWater) + return visibleThroughWater.WaterMapEntry; + + return relativeMapType; + } + ); + c.Emit(OpCodes.Stloc, relativeMapTypeIndex); + } + #endregion } } diff --git a/ILEditing/WorldgenILChanges.cs b/ILEditing/WorldgenILChanges.cs index c8e7266d16..67f4682353 100644 --- a/ILEditing/WorldgenILChanges.cs +++ b/ILEditing/WorldgenILChanges.cs @@ -1,14 +1,14 @@ -using CalamityMod.World; +using System; +using System.Linq; +using CalamityMod.Systems; +using CalamityMod.World; using Microsoft.Xna.Framework; using Mono.Cecil.Cil; using MonoMod.Cil; -using System; using Terraria; using Terraria.GameContent.UI.States; using Terraria.ID; using Terraria.WorldBuilding; -using CalamityMod.Systems; -using System.Linq; namespace CalamityMod.ILEditing { @@ -118,16 +118,16 @@ namespace CalamityMod.ILEditing // Objective 1: Pop value '0' off the stack and emit value '2'. This changes the enum used for setting the default world size. // Objective 2: Invoke UpdatePreviewPlate at the end of the method and set _optionSize to Large. var c = new ILCursor(il); - + // OBJECTIVE 1 - + // Find and anchor ourselves at roughly the start of the first for loop of this method. if (!c.TryGotoNext(x => x.MatchBr(out _))) { LogFailure("Change Default World Size", "Could not match start of branched for loop."); return; } - + // Position ourselves directly after where '0' is pushed. if (!c.TryGotoNext(MoveType.After, x => x.MatchLdcI4(0))) { @@ -137,10 +137,10 @@ namespace CalamityMod.ILEditing // Pop original value off. c.Emit(OpCodes.Pop); - + // Push '2' to the stack. c.Emit(OpCodes.Ldc_I4_2); - + // OBJECTIVE 2 // Match right before the method returns. @@ -149,7 +149,7 @@ namespace CalamityMod.ILEditing LogFailure("Change Default World Size", "Could not match end of method."); return; } - + // Set _optionSize to Large. c.Emit(OpCodes.Ldarg_0); // this c.Emit(OpCodes.Ldc_I4_2); // '2' @@ -178,7 +178,7 @@ namespace CalamityMod.ILEditing } // Pop original value off. c.Emit(OpCodes.Pop); - + // Emit our new string "Mods.CalamityMod.UI.SmallWorldWarning". c.Emit(OpCodes.Ldstr, "Mods.CalamityMod.UI.SmallWorldWarning"); } diff --git a/InverseKinematics/CyclicCoordinateDescentUpdateRule.cs b/InverseKinematics/CyclicCoordinateDescentUpdateRule.cs index 4ba0b13b44..a1736bbc7a 100644 --- a/InverseKinematics/CyclicCoordinateDescentUpdateRule.cs +++ b/InverseKinematics/CyclicCoordinateDescentUpdateRule.cs @@ -1,5 +1,5 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; namespace CalamityMod.InverseKinematics diff --git a/InverseKinematics/LimbCollection.cs b/InverseKinematics/LimbCollection.cs index 071baa3122..06529e1568 100644 --- a/InverseKinematics/LimbCollection.cs +++ b/InverseKinematics/LimbCollection.cs @@ -1,5 +1,5 @@ -using Microsoft.Xna.Framework; -using System.Linq; +using System.Linq; +using Microsoft.Xna.Framework; namespace CalamityMod.InverseKinematics { diff --git a/Items/Accessories/Abaddon.cs b/Items/Accessories/Abaddon.cs index f88596d263..6c0fe97557 100644 --- a/Items/Accessories/Abaddon.cs +++ b/Items/Accessories/Abaddon.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 26; Item.height = 26; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.accessory = true; } diff --git a/Items/Accessories/AbyssalAmulet.cs b/Items/Accessories/AbyssalAmulet.cs index 86c23b4bb4..e060bee4ed 100644 --- a/Items/Accessories/AbyssalAmulet.cs +++ b/Items/Accessories/AbyssalAmulet.cs @@ -1,8 +1,8 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.CalPlayer; using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { @@ -14,8 +14,8 @@ namespace CalamityMod.Items.Accessories { Item.width = 26; Item.height = 26; - Item.value = CalamityGlobalItem.Rarity3BuyPrice; - Item.rare = ItemRarityID.Orange; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; + Item.rare = ItemRarityID.Green; Item.accessory = true; } diff --git a/Items/Accessories/AbyssalDivingGear.cs b/Items/Accessories/AbyssalDivingGear.cs index 90261cb9a5..440cfaa92c 100644 --- a/Items/Accessories/AbyssalDivingGear.cs +++ b/Items/Accessories/AbyssalDivingGear.cs @@ -15,8 +15,8 @@ namespace CalamityMod.Items.Accessories if (Main.netMode != NetmodeID.Server) { int equipSlot = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Face); - ArmorIDs.Face.Sets.PreventHairDraw[equipSlot] = true; - ArmorIDs.Face.Sets.OverrideHelmet[equipSlot] = true; + ArmorIDs.Face.Sets.PreventHairDraw[equipSlot] = true; + ArmorIDs.Face.Sets.OverrideHelmet[equipSlot] = true; } } @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 26; Item.height = 26; - Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; Item.accessory = true; } diff --git a/Items/Accessories/AbyssalDivingSuit.cs b/Items/Accessories/AbyssalDivingSuit.cs index d16b9be024..fd672d8313 100644 --- a/Items/Accessories/AbyssalDivingSuit.cs +++ b/Items/Accessories/AbyssalDivingSuit.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Accessories Item.width = 18; Item.height = 18; Item.accessory = true; - Item.value = CalamityGlobalItem.Rarity11BuyPrice; + Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; Item.rare = ItemRarityID.Purple; if (Main.netMode != NetmodeID.Server) diff --git a/Items/Accessories/AbyssalMirror.cs b/Items/Accessories/AbyssalMirror.cs index 1267a16fdb..03ec3d4a34 100644 --- a/Items/Accessories/AbyssalMirror.cs +++ b/Items/Accessories/AbyssalMirror.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 30; Item.height = 38; - Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; Item.accessory = true; } diff --git a/Items/Accessories/AeroStone.cs b/Items/Accessories/AeroStone.cs index 8b3d64b3da..93676815e0 100644 --- a/Items/Accessories/AeroStone.cs +++ b/Items/Accessories/AeroStone.cs @@ -1,16 +1,17 @@ -using Terraria; -using Terraria.DataStructures; -using Terraria.ModLoader; -using Terraria.ID; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { public class AeroStone : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; + public override void SetStaticDefaults() { Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(4, 8)); @@ -21,16 +22,15 @@ namespace CalamityMod.Items.Accessories { Item.width = 40; Item.height = 50; - Item.value = CalamityGlobalItem.Rarity3BuyPrice; - Item.rare = ItemRarityID.Orange; + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; + Item.rare = ItemRarityID.LightRed; Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) { player.Calamity().aeroStone = true; - player.wingTimeMax += 25; - + player.wingTimeMax += 50; } public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) diff --git a/Items/Accessories/Affliction.cs b/Items/Accessories/Affliction.cs index d34fe7d220..be8a8b917a 100644 --- a/Items/Accessories/Affliction.cs +++ b/Items/Accessories/Affliction.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Accessories Item.width = 38; Item.height = 44; Item.accessory = true; - Item.value = CalamityGlobalItem.Rarity13BuyPrice; + Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; Item.rare = ModContent.RarityType(); } diff --git a/Items/Accessories/AlchemicalFlask.cs b/Items/Accessories/AlchemicalFlask.cs index 4335564627..909aa4106f 100644 --- a/Items/Accessories/AlchemicalFlask.cs +++ b/Items/Accessories/AlchemicalFlask.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 26; Item.height = 26; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; Item.accessory = true; } diff --git a/Items/Accessories/AlluringBait.cs b/Items/Accessories/AlluringBait.cs index a5b786e80a..1a5383e4b1 100644 --- a/Items/Accessories/AlluringBait.cs +++ b/Items/Accessories/AlluringBait.cs @@ -1,6 +1,6 @@ using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { @@ -11,8 +11,8 @@ namespace CalamityMod.Items.Accessories { Item.width = 26; Item.height = 26; - Item.value = CalamityGlobalItem.Rarity1BuyPrice; - Item.rare = ItemRarityID.Blue; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; + Item.rare = ItemRarityID.Green; Item.accessory = true; } diff --git a/Items/Accessories/AmalgamatedBrain.cs b/Items/Accessories/AmalgamatedBrain.cs index 6850ade31a..5979cb98e6 100644 --- a/Items/Accessories/AmalgamatedBrain.cs +++ b/Items/Accessories/AmalgamatedBrain.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 34; Item.height = 34; - Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; Item.accessory = true; } diff --git a/Items/Accessories/AmbrosialAmpoule.cs b/Items/Accessories/AmbrosialAmpoule.cs index 0836aa2a59..ae0904ba07 100644 --- a/Items/Accessories/AmbrosialAmpoule.cs +++ b/Items/Accessories/AmbrosialAmpoule.cs @@ -14,8 +14,8 @@ namespace CalamityMod.Items.Accessories { Item.width = 20; Item.height = 20; - Item.value = CalamityGlobalItem.Rarity9BuyPrice; - Item.rare = ItemRarityID.Cyan; + Item.value = CalamityGlobalItem.RarityRedBuyPrice; + Item.rare = ItemRarityID.Red; Item.accessory = true; } diff --git a/Items/Accessories/AmidiasPendant.cs b/Items/Accessories/AmidiasPendant.cs index 5f2a744be8..12e0ce87ad 100644 --- a/Items/Accessories/AmidiasPendant.cs +++ b/Items/Accessories/AmidiasPendant.cs @@ -1,9 +1,9 @@ -using CalamityMod.Projectiles.Typeless; +using CalamityMod.Items.Potions.Alcohol; +using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Terraria; -using Terraria.ModLoader; using Terraria.ID; -using CalamityMod.Items.Potions.Alcohol; +using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 26; Item.height = 46; - Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; Item.accessory = true; } @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Accessories } if (ShardCountdown > 0) { - ShardCountdown -= Main.rand.Next(1,4); + ShardCountdown -= Main.rand.Next(1, 4); if (ShardCountdown <= 0) { if (player.whoAmI == Main.myPlayer) diff --git a/Items/Accessories/AmidiasSpark.cs b/Items/Accessories/AmidiasSpark.cs index 480eea757c..e15f15b358 100644 --- a/Items/Accessories/AmidiasSpark.cs +++ b/Items/Accessories/AmidiasSpark.cs @@ -1,7 +1,7 @@ using CalamityMod.CalPlayer; using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 26; Item.height = 26; - Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.rare = ItemRarityID.Blue; Item.accessory = true; } diff --git a/Items/Accessories/AncientFossil.cs b/Items/Accessories/AncientFossil.cs index c17e1cddd6..09447e3273 100644 --- a/Items/Accessories/AncientFossil.cs +++ b/Items/Accessories/AncientFossil.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 26; Item.height = 26; - Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.rare = ItemRarityID.Blue; Item.accessory = true; } diff --git a/Items/Accessories/AnechoicPlating.cs b/Items/Accessories/AnechoicPlating.cs index 77358ce953..ccadb15281 100644 --- a/Items/Accessories/AnechoicPlating.cs +++ b/Items/Accessories/AnechoicPlating.cs @@ -1,18 +1,22 @@ using CalamityMod.CalPlayer; using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { public class AnechoicPlating : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; + public override void SetStaticDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { Item.width = 26; Item.height = 26; - Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; Item.accessory = true; } diff --git a/Items/Accessories/AngelTreads.cs b/Items/Accessories/AngelTreads.cs index 4cbebbe838..bf1b3b87a0 100644 --- a/Items/Accessories/AngelTreads.cs +++ b/Items/Accessories/AngelTreads.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 32; Item.height = 36; - Item.value = CalamityGlobalItem.Rarity6BuyPrice; + Item.value = CalamityGlobalItem.RarityLightPurpleBuyPrice; Item.rare = ItemRarityID.LightPurple; Item.accessory = true; } diff --git a/Items/Accessories/AngelicAlliance.cs b/Items/Accessories/AngelicAlliance.cs index aa7c22ee77..e1b1cdfc06 100644 --- a/Items/Accessories/AngelicAlliance.cs +++ b/Items/Accessories/AngelicAlliance.cs @@ -1,8 +1,8 @@ -using CalamityMod.CalPlayer; +using System.Collections.Generic; +using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; -using System.Collections.Generic; using Terraria; using Terraria.Audio; using Terraria.ID; diff --git a/Items/Accessories/AquaticEmblem.cs b/Items/Accessories/AquaticEmblem.cs index bc9a9983b9..7171d7c9d2 100644 --- a/Items/Accessories/AquaticEmblem.cs +++ b/Items/Accessories/AquaticEmblem.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 18; Item.height = 26; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.accessory = true; } @@ -26,7 +26,8 @@ namespace CalamityMod.Items.Accessories player.npcTypeNoAggro[NPCID.PinkJellyfish] = true; player.npcTypeNoAggro[NPCID.Crab] = true; player.npcTypeNoAggro[NPCID.Squid] = true; - player.gills = true; + if (player.IsUnderwater()) + player.gills = true; } } } diff --git a/Items/Accessories/AquaticHeart.cs b/Items/Accessories/AquaticHeart.cs index 1a2c5b18b9..c4bc403163 100644 --- a/Items/Accessories/AquaticHeart.cs +++ b/Items/Accessories/AquaticHeart.cs @@ -1,7 +1,7 @@ using CalamityMod.CalPlayer; using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { @@ -40,7 +40,7 @@ namespace CalamityMod.Items.Accessories Item.width = 18; Item.height = 18; Item.accessory = true; - Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; } diff --git a/Items/Accessories/ArchaicPowder.cs b/Items/Accessories/ArchaicPowder.cs index 393d31ff3b..e75019f9d7 100644 --- a/Items/Accessories/ArchaicPowder.cs +++ b/Items/Accessories/ArchaicPowder.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 20; Item.height = 20; - Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; Item.accessory = true; } diff --git a/Items/Accessories/AscendantInsignia.cs b/Items/Accessories/AscendantInsignia.cs index e4e038587d..11023258b1 100644 --- a/Items/Accessories/AscendantInsignia.cs +++ b/Items/Accessories/AscendantInsignia.cs @@ -1,13 +1,13 @@ -using CalamityMod.CalPlayer; +using System; +using System.Collections.Generic; +using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Ores; using CalamityMod.Rarities; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using System; -using System.Collections.Generic; -using CalamityMod.Items.Placeables.Ores; -using CalamityMod.Items.Placeables; namespace CalamityMod.Items.Accessories { @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 46; Item.height = 36; - Item.value = CalamityGlobalItem.Rarity13BuyPrice; + Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; Item.accessory = true; Item.rare = ModContent.RarityType(); } diff --git a/Items/Accessories/AsgardianAegis.cs b/Items/Accessories/AsgardianAegis.cs index 2193cc3dc8..4bffcce0e7 100644 --- a/Items/Accessories/AsgardianAegis.cs +++ b/Items/Accessories/AsgardianAegis.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 60; Item.height = 54; - Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.defense = 20; Item.accessory = true; Item.rare = ModContent.RarityType(); diff --git a/Items/Accessories/AsgardsValor.cs b/Items/Accessories/AsgardsValor.cs index a1ec856b4c..e2aacf1b97 100644 --- a/Items/Accessories/AsgardsValor.cs +++ b/Items/Accessories/AsgardsValor.cs @@ -1,10 +1,10 @@ -using CalamityMod.CalPlayer; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer.Dashes; using CalamityMod.Items.Materials; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer.Dashes; -using CalamityMod.Buffs.DamageOverTime; namespace CalamityMod.Items.Accessories { @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 38; Item.height = 44; - Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; Item.defense = 12; // we buff Ankh Shield to 12 Item.accessory = true; diff --git a/Items/Accessories/GodlySoulArtifact.cs b/Items/Accessories/AuricSoulArtifact.cs similarity index 86% rename from Items/Accessories/GodlySoulArtifact.cs rename to Items/Accessories/AuricSoulArtifact.cs index f96d973034..2a2702982b 100644 --- a/Items/Accessories/GodlySoulArtifact.cs +++ b/Items/Accessories/AuricSoulArtifact.cs @@ -1,7 +1,7 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.Plates; using CalamityMod.Items.Placeables.Ores; +using CalamityMod.Items.Placeables.Plates; using CalamityMod.Rarities; using Terraria; using Terraria.ID; @@ -9,7 +9,8 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { - public class GodlySoulArtifact : ModItem, ILocalizedModType + [LegacyName("GodlySoulArtifact")] + public class AuricSoulArtifact : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; public override void SetDefaults() @@ -18,7 +19,7 @@ namespace CalamityMod.Items.Accessories Item.height = 28; Item.accessory = true; Item.rare = ModContent.RarityType(); - Item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.value = CalamityGlobalItem.RarityVioletBuyPrice; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/GodlySoulArtifact.png b/Items/Accessories/AuricSoulArtifact.png similarity index 100% rename from Items/Accessories/GodlySoulArtifact.png rename to Items/Accessories/AuricSoulArtifact.png diff --git a/Items/Accessories/BadgeofBravery.cs b/Items/Accessories/BadgeofBravery.cs index cc5cd5d03a..8f68dd37c7 100644 --- a/Items/Accessories/BadgeofBravery.cs +++ b/Items/Accessories/BadgeofBravery.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 30; Item.height = 30; - Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.accessory = true; Item.rare = ModContent.RarityType(); } @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.FeralClaws). + AddIngredient(ItemID.WarriorEmblem). AddIngredient(2). AddTile(TileID.LunarCraftingStation). Register(); diff --git a/Items/Accessories/Baroclaw.cs b/Items/Accessories/Baroclaw.cs index f7fa268081..bbc971ac6a 100644 --- a/Items/Accessories/Baroclaw.cs +++ b/Items/Accessories/Baroclaw.cs @@ -1,8 +1,8 @@ -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 40; Item.height = 26; - Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; Item.accessory = true; } diff --git a/Items/Accessories/BlazingCore.cs b/Items/Accessories/BlazingCore.cs index 3b4a1aa57e..b481df9a76 100644 --- a/Items/Accessories/BlazingCore.cs +++ b/Items/Accessories/BlazingCore.cs @@ -17,10 +17,10 @@ namespace CalamityMod.Items.Accessories public new string LocalizationCategory => "Items.Accessories"; private static float offset = 0f; - - public static readonly SoundStyle ParryActivateSound = new("CalamityMod/Sounds/Item/BlazingCoreParryActivate") { Volume = 0.7f}; - public static readonly SoundStyle ParrySuccessSound = new("CalamityMod/Sounds/Item/BlazingCoreParry") { Volume = 0.6f}; - + + public static readonly SoundStyle ParryActivateSound = new("CalamityMod/Sounds/Item/BlazingCoreParryActivate") { Volume = 0.7f }; + public static readonly SoundStyle ParrySuccessSound = new("CalamityMod/Sounds/Item/BlazingCoreParry") { Volume = 0.6f }; + public override void SetStaticDefaults() { Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(5, 6)); @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Accessories Item.width = 42; Item.height = 46; Item.accessory = true; - Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); } @@ -50,13 +50,13 @@ namespace CalamityMod.Items.Accessories int chains = 3; float interval = totalFlameProjectiles / chains * divisor; double patternInterval = Math.Floor(player.Calamity().blazingCoreSuccessfulParry / interval); - + if (player.Calamity().blazingCoreSuccessfulParry % 4 == 0) //play sound every 4 frames { SoundEngine.PlaySound(SoundID.DD2_BetsyFireballImpact, player.Center); } - + if (patternInterval % 2 == 0) { double radians = MathHelper.TwoPi / chains; @@ -72,7 +72,7 @@ namespace CalamityMod.Items.Accessories { projectileType = ModContent.ProjectileType(); } - + Vector2 vector2 = spinningPoint.RotatedBy(radians * i + MathHelper.ToRadians(offset)); //not sure if this is correct, will see in testing if (!Main.dedServ) @@ -85,7 +85,7 @@ namespace CalamityMod.Items.Accessories } offset += 10f; } - + player.Calamity().blazingCoreSuccessfulParry--; if (player.Calamity().blazingCoreSuccessfulParry <= 0) { @@ -117,7 +117,7 @@ namespace CalamityMod.Items.Accessories { for (int i = 0; i < 8; i++) { - int theDust = Dust.NewDust(player.position, player.width, player.height, 205, 0f, 0f, 100, new Color(255, 255, 255), 2f); + int theDust = Dust.NewDust(player.position, player.width, player.height, DustID.VenomStaff, 0f, 0f, 100, new Color(255, 255, 255), 2f); Main.dust[theDust].noGravity = true; } } diff --git a/Items/Accessories/BloodPact.cs b/Items/Accessories/BloodPact.cs index 62b606c59f..7c5896228e 100644 --- a/Items/Accessories/BloodPact.cs +++ b/Items/Accessories/BloodPact.cs @@ -1,7 +1,7 @@ using CalamityMod.CalPlayer; using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Accessories Item.width = 26; Item.height = 26; Item.rare = ItemRarityID.Yellow; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.accessory = true; } diff --git a/Items/Accessories/BloodflareCore.cs b/Items/Accessories/BloodflareCore.cs index 0fa24e92eb..0cc9b6c92a 100644 --- a/Items/Accessories/BloodflareCore.cs +++ b/Items/Accessories/BloodflareCore.cs @@ -8,13 +8,13 @@ namespace CalamityMod.Items.Accessories public class BloodflareCore : ModItem, ILocalizedModType { internal static readonly int HealFrameCooldown = 6; - + public new string LocalizationCategory => "Items.Accessories"; public override void SetDefaults() { Item.width = 26; Item.height = 26; - Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); Item.accessory = true; } diff --git a/Items/Accessories/BloodstainedGlove.cs b/Items/Accessories/BloodstainedGlove.cs index 582360ae99..075af22adf 100644 --- a/Items/Accessories/BloodstainedGlove.cs +++ b/Items/Accessories/BloodstainedGlove.cs @@ -1,12 +1,12 @@ -using CalamityMod.Items.Materials; -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; +using CalamityMod.Items.Materials; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { - [AutoloadEquip(new EquipType[] { EquipType.HandsOn, EquipType.HandsOff } )] + [AutoloadEquip(new EquipType[] { EquipType.HandsOn, EquipType.HandsOff })] public class BloodstainedGlove : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 26; Item.height = 36; - Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.accessory = true; Item.rare = ItemRarityID.Orange; } diff --git a/Items/Accessories/BloodyWormScarf.cs b/Items/Accessories/BloodyWormScarf.cs index 2b30c00c21..8399ef805a 100644 --- a/Items/Accessories/BloodyWormScarf.cs +++ b/Items/Accessories/BloodyWormScarf.cs @@ -11,10 +11,10 @@ namespace CalamityMod.Items.Accessories public new string LocalizationCategory => "Items.Accessories"; public override void SetDefaults() { - Item.defense = 7; Item.width = 26; Item.height = 42; - Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.defense = 7; + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; Item.accessory = true; } @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Accessories { CalamityPlayer modPlayer = player.Calamity(); modPlayer.bloodyWormTooth = true; - player.endurance += 0.07f; + player.endurance += 0.1f; } public override void AddRecipes() diff --git a/Items/Accessories/BloodyWormTooth.cs b/Items/Accessories/BloodyWormTooth.cs index c43f0d66ed..4c6ef7f45c 100644 --- a/Items/Accessories/BloodyWormTooth.cs +++ b/Items/Accessories/BloodyWormTooth.cs @@ -1,7 +1,7 @@ using CalamityMod.CalPlayer; using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { @@ -10,10 +10,10 @@ namespace CalamityMod.Items.Accessories public new string LocalizationCategory => "Items.Accessories"; public override void SetDefaults() { - Item.defense = 7; Item.width = 12; Item.height = 15; - Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.defense = 7; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; Item.accessory = true; } diff --git a/Items/Accessories/BloomStone.cs b/Items/Accessories/BloomStone.cs index d016818e8c..6858aaff91 100644 --- a/Items/Accessories/BloomStone.cs +++ b/Items/Accessories/BloomStone.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 38; Item.height = 54; - Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; Item.accessory = true; } diff --git a/Items/Accessories/BlunderBooster.cs b/Items/Accessories/BlunderBooster.cs index 5599ea10aa..c8cdba9e89 100644 --- a/Items/Accessories/BlunderBooster.cs +++ b/Items/Accessories/BlunderBooster.cs @@ -1,5 +1,5 @@ -using CalamityMod.Items.Materials; -using System.Collections.Generic; +using System.Collections.Generic; +using CalamityMod.Items.Materials; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 30; Item.height = 38; - Item.value = CalamityGlobalItem.Rarity11BuyPrice; + Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; Item.rare = ItemRarityID.Purple; Item.accessory = true; } diff --git a/Items/Accessories/ChaliceOfTheBloodGod.cs b/Items/Accessories/ChaliceOfTheBloodGod.cs index 2303243d48..edc3fe6b1c 100644 --- a/Items/Accessories/ChaliceOfTheBloodGod.cs +++ b/Items/Accessories/ChaliceOfTheBloodGod.cs @@ -22,13 +22,13 @@ namespace CalamityMod.Items.Accessories // Dying to this sudden last few points of health loss has a special death message. internal static readonly int MinAllowedDamage = 5; - // Drinking a healing potion clears 50% of the bleedout buffer. - internal const float HealingPotionBufferClear = 0.5f; + // Drinking a healing potion helps clear your bleedout buffer. + internal const float HealingPotionRatioForBufferClear = 0.5f; // This is per frame. The ideal is 50% per second, so it's 0.83% per frame. internal static readonly double BleedoutExponentialDecay = 0.0083333333333; internal static readonly Color BleedoutBufferDamageTextColor = new(230, 40, 100); - + public new string LocalizationCategory => "Items.Accessories"; public override void SetStaticDefaults() { @@ -40,7 +40,7 @@ namespace CalamityMod.Items.Accessories { Item.width = Item.height = 32; Item.accessory = true; - Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.rare = ModContent.RarityType(); } @@ -48,8 +48,12 @@ namespace CalamityMod.Items.Accessories { CalamityPlayer modPlayer = player.Calamity(); + player.pStone = true; + player.lifeRegen += 4; + // This applies the +25% health boost and the bleedout buffer effect. // Health boost intentionally stacks with Blood Pact. + // This accessory's bleedout buffer clearing effect intentionally stacks with Blood Pact's healing potion boost. modPlayer.chaliceOfTheBloodGod = true; } @@ -57,6 +61,7 @@ namespace CalamityMod.Items.Accessories { CreateRecipe(). AddIngredient(). + AddIngredient(ItemID.CharmofMyths). AddIngredient(5). AddIngredient(4). AddTile(). @@ -87,7 +92,7 @@ namespace CalamityMod.Items.Accessories // If this reduces the player's health to zero, make sure they actually die. if (player.statLife <= 0) { - player.KillMe(PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.ChaliceOfTheBloodGod" + Main.rand.Next(1, 4 + 1)).Format(player.name)), modPlayer.chaliceBleedoutBuffer, 0, false); + player.KillMe(PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.ChaliceOfTheBloodGod" + Main.rand.Next(1, 18 + 1)).Format(player.name)), modPlayer.chaliceBleedoutBuffer, 0, false); } } diff --git a/Items/Accessories/ChaosStone.cs b/Items/Accessories/ChaosStone.cs index 79e9693ba6..89b7f583a6 100644 --- a/Items/Accessories/ChaosStone.cs +++ b/Items/Accessories/ChaosStone.cs @@ -1,7 +1,7 @@ using Terraria; using Terraria.DataStructures; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 20; Item.height = 20; - Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; Item.accessory = true; } diff --git a/Items/Accessories/CleansingJelly.cs b/Items/Accessories/CleansingJelly.cs index 108837fd19..4e8df9627e 100644 --- a/Items/Accessories/CleansingJelly.cs +++ b/Items/Accessories/CleansingJelly.cs @@ -1,8 +1,8 @@ using System; -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; using CalamityMod.CalPlayer; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 18; Item.height = 40; - Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.rare = ItemRarityID.Blue; Item.accessory = true; } diff --git a/Items/Accessories/CoinofDeceit.cs b/Items/Accessories/CoinofDeceit.cs index 9b7f537321..694429bc96 100644 --- a/Items/Accessories/CoinofDeceit.cs +++ b/Items/Accessories/CoinofDeceit.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 20; Item.height = 22; - Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.accessory = true; Item.rare = ItemRarityID.Blue; } diff --git a/Items/Accessories/CorrosiveSpine.cs b/Items/Accessories/CorrosiveSpine.cs index 6987583dfe..6f99322f4d 100644 --- a/Items/Accessories/CorrosiveSpine.cs +++ b/Items/Accessories/CorrosiveSpine.cs @@ -1,8 +1,8 @@ using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 18; Item.height = 46; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.defense = 4; Item.accessory = true; @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Accessories if (Main.rand.NextBool(15)) { var source = player.GetSource_Accessory(Item); - int cloudCount = Main.rand.Next(2,5); + int cloudCount = Main.rand.Next(2, 5); for (int i = 0; i < cloudCount; i++) { int type = Utils.SelectRandom(Main.rand, new int[] diff --git a/Items/Accessories/CorruptFlask.cs b/Items/Accessories/CorruptFlask.cs index 8aadb6e4ac..db6a38b7fb 100644 --- a/Items/Accessories/CorruptFlask.cs +++ b/Items/Accessories/CorruptFlask.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 20; Item.height = 20; - Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; Item.accessory = true; } diff --git a/Items/Accessories/CounterScarf.cs b/Items/Accessories/CounterScarf.cs index dc226e9d17..1f36cadfd2 100644 --- a/Items/Accessories/CounterScarf.cs +++ b/Items/Accessories/CounterScarf.cs @@ -1,8 +1,8 @@ using CalamityMod.CalPlayer; -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; using CalamityMod.CalPlayer.Dashes; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 30; Item.height = 38; - Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; Item.accessory = true; } diff --git a/Items/Accessories/CrawCarapace.cs b/Items/Accessories/CrawCarapace.cs index b66e9f9f1d..fcb357da8a 100644 --- a/Items/Accessories/CrawCarapace.cs +++ b/Items/Accessories/CrawCarapace.cs @@ -1,7 +1,7 @@ -using Terraria; -using Terraria.ModLoader; +using CalamityMod.CalPlayer; +using Terraria; using Terraria.ID; -using CalamityMod.CalPlayer; +using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 28; Item.height = 28; - Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.rare = ItemRarityID.Blue; Item.accessory = true; } diff --git a/Items/Accessories/CrimsonFlask.cs b/Items/Accessories/CrimsonFlask.cs index 74a238a4a6..dc1d4c038c 100644 --- a/Items/Accessories/CrimsonFlask.cs +++ b/Items/Accessories/CrimsonFlask.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 20; Item.height = 20; - Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; Item.accessory = true; } diff --git a/Items/Accessories/CrownJewel.cs b/Items/Accessories/CrownJewel.cs index 75b74c27da..1c85ffd2fe 100644 --- a/Items/Accessories/CrownJewel.cs +++ b/Items/Accessories/CrownJewel.cs @@ -1,7 +1,7 @@ using CalamityMod.CalPlayer; using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { @@ -10,10 +10,10 @@ namespace CalamityMod.Items.Accessories public new string LocalizationCategory => "Items.Accessories"; public override void SetDefaults() { - Item.defense = 4; Item.width = 26; Item.height = 26; - Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.defense = 4; + Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.rare = ItemRarityID.Blue; Item.accessory = true; } diff --git a/Items/Accessories/CryoStone.cs b/Items/Accessories/CryoStone.cs index 98883c4d04..bf6e2deb08 100644 --- a/Items/Accessories/CryoStone.cs +++ b/Items/Accessories/CryoStone.cs @@ -1,7 +1,7 @@ using Terraria; using Terraria.DataStructures; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 40; Item.height = 40; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.accessory = true; } diff --git a/Items/Accessories/DaawnlightSpiritOrigin.cs b/Items/Accessories/DaawnlightSpiritOrigin.cs index f3a805bce2..e37ec2dcc2 100644 --- a/Items/Accessories/DaawnlightSpiritOrigin.cs +++ b/Items/Accessories/DaawnlightSpiritOrigin.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Accessories // Regular crits are intentionally weak, especially because they rarely happen (your crit chance gets murdered). // Bullseyes should be doing all the work. private const float OriginBullseyeCritRatio = 3.5f; // Bullseye crits deal x3.5 damage instead of x2. - private const float RicoshotBullseyeCritRatio = 2.4f; // If you use Ricoshot mechanics to "force" a bullseye, you get less of a reward. + private const float ForcedCritBullseyeCritRatio = 2.4f; // If your projectile is forced to crit, you get less of a reward. private const float StoredCritConversionRatio = 0.01f; // Add +1% more damage to crits for every 1% critical chance the player would have had. private const float MinUseTimeForSlowBonus = 11f; @@ -39,8 +39,8 @@ namespace CalamityMod.Items.Accessories if (hitBullseye) { // Bullseye crits are weaker if the projectile was already a forced crit. - // This currently only occurs due to ULTRAKILL-style ricoshots. - baseCritMult = wasForcedCrit ? RicoshotBullseyeCritRatio : OriginBullseyeCritRatio; + // This is currently implemented for ULTRAKILL-style ricoshots and for Heavenly Gale's lightning. + baseCritMult = wasForcedCrit ? ForcedCritBullseyeCritRatio : OriginBullseyeCritRatio; } // Factor in the critical strike chance the player isn't getting to use. @@ -57,7 +57,7 @@ namespace CalamityMod.Items.Accessories Item.height = 38; Item.accessory = true; Item.rare = ItemRarityID.Purple; - Item.value = CalamityGlobalItem.Rarity11BuyPrice; + Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; Item.Calamity().donorItem = true; } diff --git a/Items/Accessories/DarkMatterSheath.cs b/Items/Accessories/DarkMatterSheath.cs index c52b1649e1..c77de6db38 100644 --- a/Items/Accessories/DarkMatterSheath.cs +++ b/Items/Accessories/DarkMatterSheath.cs @@ -14,8 +14,8 @@ namespace CalamityMod.Items.Accessories { Item.width = 48; Item.height = 62; - Item.value = CalamityGlobalItem.Rarity9BuyPrice; - Item.rare = ItemRarityID.Cyan; + Item.value = CalamityGlobalItem.RarityRedBuyPrice; + Item.rare = ItemRarityID.Red; Item.accessory = true; } diff --git a/Items/Accessories/DarkSunRing.cs b/Items/Accessories/DarkSunRing.cs index 2347055318..0a06a8e9a8 100644 --- a/Items/Accessories/DarkSunRing.cs +++ b/Items/Accessories/DarkSunRing.cs @@ -2,13 +2,13 @@ using CalamityMod.Items.Materials; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; -using Microsoft.Xna.Framework.Graphics; -using Microsoft.Xna.Framework; -using Terraria.GameContent; namespace CalamityMod.Items.Accessories { @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 42; Item.height = 60; - Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.defense = 10; Item.lifeRegen = 1; Item.accessory = true; diff --git a/Items/Accessories/DeadshotBrooch.cs b/Items/Accessories/DeadshotBrooch.cs index 34016c2470..1e1ec3c3ad 100644 --- a/Items/Accessories/DeadshotBrooch.cs +++ b/Items/Accessories/DeadshotBrooch.cs @@ -13,8 +13,8 @@ namespace CalamityMod.Items.Accessories { Item.width = 46; Item.height = 40; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; - Item.rare = ItemRarityID.Yellow; + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; + Item.rare = ItemRarityID.Lime; Item.accessory = true; } diff --git a/Items/Accessories/DeepDiver.cs b/Items/Accessories/DeepDiver.cs index c714f8f6fa..33537b3241 100644 --- a/Items/Accessories/DeepDiver.cs +++ b/Items/Accessories/DeepDiver.cs @@ -1,33 +1,44 @@ using CalamityMod.CalPlayer; -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; using CalamityMod.CalPlayer.Dashes; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables; namespace CalamityMod.Items.Accessories { public class DeepDiver : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; + public const int ShieldSlamDamage = 35; + public const float ShieldSlamKnockback = 0.2f; + public const int ShieldSlamIFrames = 16; public override void SetDefaults() { Item.width = 24; Item.height = 28; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; - Item.rare = ItemRarityID.Pink; - Item.defense = 8; + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; + Item.rare = ItemRarityID.LightRed; Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) { - if (player.IsUnderwater()) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.deepDiver = true; - modPlayer.DashID = DeepDiverDash.ID; - player.dashType = 0; - } + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.deepDiver = true; + modPlayer.DashID = DeepDiverDash.ID; + player.dashType = 0; + player.ignoreWater = true; // Mobility in water + } + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(25). + AddIngredient(5). + AddRecipeGroup("AnyCobaltBar", 10). + AddTile(TileID.Anvils). + Register(); } } } diff --git a/Items/Accessories/DeificAmulet.cs b/Items/Accessories/DeificAmulet.cs index 5688bc5e50..22d188bd58 100644 --- a/Items/Accessories/DeificAmulet.cs +++ b/Items/Accessories/DeificAmulet.cs @@ -10,28 +10,28 @@ namespace CalamityMod.Items.Accessories public class DeificAmulet : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; + + public static readonly int MaxBonusIFrames = 30; + public override void SetDefaults() { Item.width = 26; Item.height = 26; Item.rare = ItemRarityID.Cyan; - Item.value = CalamityGlobalItem.Rarity9BuyPrice; + Item.value = CalamityGlobalItem.RarityCyanBuyPrice; Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.dAmulet = true; player.longInvince = true; - player.pStone = true; - player.lifeRegen += 1; + modPlayer.dAmulet = true; } public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.CharmofMyths). AddIngredient(ItemID.StarVeil). AddIngredient(10). AddIngredient(15). diff --git a/Items/Accessories/DepthCharm.cs b/Items/Accessories/DepthCharm.cs index bd24061306..0ec3e73774 100644 --- a/Items/Accessories/DepthCharm.cs +++ b/Items/Accessories/DepthCharm.cs @@ -1,7 +1,7 @@ using CalamityMod.CalPlayer; using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { @@ -9,11 +9,15 @@ namespace CalamityMod.Items.Accessories public class DepthCharm : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; + public override void SetStaticDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { Item.width = 26; Item.height = 26; - Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; Item.accessory = true; } diff --git a/Items/Accessories/DimensionalSoulArtifact.cs b/Items/Accessories/DimensionalSoulArtifact.cs index ef3e52e266..f874e3229a 100644 --- a/Items/Accessories/DimensionalSoulArtifact.cs +++ b/Items/Accessories/DimensionalSoulArtifact.cs @@ -1,7 +1,7 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.Plates; using CalamityMod.Items.Placeables.Ores; +using CalamityMod.Items.Placeables.Plates; using CalamityMod.Rarities; using Terraria; using Terraria.ID; @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Accessories Item.height = 28; Item.accessory = true; Item.rare = ModContent.RarityType(); - Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/DraedonsHeart.cs b/Items/Accessories/DraedonsHeart.cs index 5f6523feba..75479538ad 100644 --- a/Items/Accessories/DraedonsHeart.cs +++ b/Items/Accessories/DraedonsHeart.cs @@ -1,8 +1,8 @@ -using CalamityMod.Balancing; +using System.Collections.Generic; +using CalamityMod.Balancing; using CalamityMod.CalPlayer; using CalamityMod.Rarities; using CalamityMod.World; -using System.Collections.Generic; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -15,18 +15,19 @@ namespace CalamityMod.Items.Accessories { public new string LocalizationCategory => "Items.Accessories"; private const double ContactDamageReduction = 0.15D; - public const double DefenseDamageMultiplier = 0.5D; // Duration of Nanomachines in frames. internal static readonly int NanomachinesDuration = 120; // Health gained per frame while using Nanomachines. internal static readonly int NanomachinesHealPerFrame = 3; + // Duration of time where Nanomachines won't accumulate after taking damage, in frames. internal static readonly int NanomachinePauseAfterDamage = 60; + // Same as above, but for hits that are fully absorbed by a shield. + internal static readonly int NanomachinePauseAfterShieldDamage = 30; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs( (ContactDamageReduction * 100).ToString("N0"), - (100 - (DefenseDamageMultiplier * 100)).ToString("N0"), NanomachinesHealPerFrame * NanomachinesDuration, NanomachinesDuration / 60); @@ -59,9 +60,6 @@ namespace CalamityMod.Items.Accessories modPlayer.hadNanomachinesLastFrame = true; modPlayer.AdrenalineDuration = NanomachinesDuration; modPlayer.contactDamageReduction += ContactDamageReduction; - - // Multiplies the player's defense damage ratio directly, instead of being hardcoded into various places - modPlayer.defenseDamageRatio *= DefenseDamageMultiplier; } public override void ModifyTooltips(List list) diff --git a/Items/Accessories/DragonScales.cs b/Items/Accessories/DragonScales.cs index 7368dcb571..766939ee78 100644 --- a/Items/Accessories/DragonScales.cs +++ b/Items/Accessories/DragonScales.cs @@ -12,12 +12,12 @@ namespace CalamityMod.Items.Accessories public new string LocalizationCategory => "Items.Accessories"; public static int ShitBaseDamage = 57; public static int TornadoBaseDamage = 210; - + public override void SetDefaults() { Item.width = 32; Item.height = 34; - Item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.rare = ModContent.RarityType(); Item.accessory = true; } diff --git a/Items/Accessories/DynamoStemCells.cs b/Items/Accessories/DynamoStemCells.cs index 8b65bb0e1d..6d5188e971 100644 --- a/Items/Accessories/DynamoStemCells.cs +++ b/Items/Accessories/DynamoStemCells.cs @@ -1,17 +1,19 @@ using CalamityMod.Buffs.DamageOverTime; -using Terraria; -using Terraria.ID; -using Terraria.DataStructures; -using Terraria.ModLoader; -using Microsoft.Xna.Framework.Graphics; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { public class DynamoStemCells : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; + public const int MiniSwamerCooldown = 180; public override void SetStaticDefaults() { Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(6, 5)); @@ -22,7 +24,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 20; Item.height = 20; - Item.value = CalamityGlobalItem.Rarity11BuyPrice; + Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; Item.rare = ItemRarityID.Purple; Item.accessory = true; } @@ -30,9 +32,10 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { player.Calamity().dynamoStemCells = true; + player.Calamity().MiniSwarmers = true; + player.GetDamage() += 0.1f; player.moveSpeed += 0.1f; - player.buffImmune[BuffID.Electrified] = true; - player.buffImmune[ModContent.BuffType()] = true; + player.Calamity().eleResist = true; } public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) diff --git a/Items/Accessories/EclipseMirror.cs b/Items/Accessories/EclipseMirror.cs index c96bc0e7e5..c3e975502e 100644 --- a/Items/Accessories/EclipseMirror.cs +++ b/Items/Accessories/EclipseMirror.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 30; Item.height = 46; - Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.rare = ModContent.RarityType(); Item.accessory = true; } diff --git a/Items/Accessories/EldritchSoulArtifact.cs b/Items/Accessories/EldritchSoulArtifact.cs index 6ce853aca8..91df6f15a8 100644 --- a/Items/Accessories/EldritchSoulArtifact.cs +++ b/Items/Accessories/EldritchSoulArtifact.cs @@ -1,8 +1,8 @@ using CalamityMod.Buffs.StatDebuffs; using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.Plates; using CalamityMod.Items.Placeables.Ores; +using CalamityMod.Items.Placeables.Plates; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Accessories Item.width = 64; Item.height = 58; Item.accessory = true; - Item.value = CalamityGlobalItem.Rarity11BuyPrice; + Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; Item.rare = ItemRarityID.Purple; } @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Accessories CreateRecipe(). AddIngredient(25). AddIngredient(25). - AddIngredient(5). + AddIngredient(5). AddTile(TileID.DemonAltar). Register(); } diff --git a/Items/Accessories/ElectriciansGlove.cs b/Items/Accessories/ElectriciansGlove.cs index 5667414917..f47b586c7f 100644 --- a/Items/Accessories/ElectriciansGlove.cs +++ b/Items/Accessories/ElectriciansGlove.cs @@ -5,7 +5,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { - [AutoloadEquip(new EquipType[] { EquipType.HandsOn, EquipType.HandsOff } )] + [AutoloadEquip(new EquipType[] { EquipType.HandsOn, EquipType.HandsOff })] public class ElectriciansGlove : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 24; Item.height = 40; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.accessory = true; Item.rare = ItemRarityID.Pink; } diff --git a/Items/Accessories/ElementalGauntlet.cs b/Items/Accessories/ElementalGauntlet.cs index 54c6c96e52..bc5bd995c6 100644 --- a/Items/Accessories/ElementalGauntlet.cs +++ b/Items/Accessories/ElementalGauntlet.cs @@ -8,7 +8,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { - [AutoloadEquip(new EquipType[] { EquipType.HandsOn, EquipType.HandsOff } )] + [AutoloadEquip(new EquipType[] { EquipType.HandsOn, EquipType.HandsOff })] public class ElementalGauntlet : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 22; Item.height = 38; - Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.accessory = true; Item.rare = ModContent.RarityType(); } diff --git a/Items/Accessories/ElementalQuiver.cs b/Items/Accessories/ElementalQuiver.cs index 225c75cbeb..b586332d81 100644 --- a/Items/Accessories/ElementalQuiver.cs +++ b/Items/Accessories/ElementalQuiver.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 28; Item.height = 32; - Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.accessory = true; Item.rare = ModContent.RarityType(); } diff --git a/Items/Accessories/ElysianAegis.cs b/Items/Accessories/ElysianAegis.cs index 379a59615a..a7231b9b11 100644 --- a/Items/Accessories/ElysianAegis.cs +++ b/Items/Accessories/ElysianAegis.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 48; Item.height = 42; - Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); Item.defense = 16; Item.accessory = true; diff --git a/Items/Accessories/EnchantedPearl.cs b/Items/Accessories/EnchantedPearl.cs index b17cd5d903..9025eb04c2 100644 --- a/Items/Accessories/EnchantedPearl.cs +++ b/Items/Accessories/EnchantedPearl.cs @@ -1,8 +1,8 @@ -using Terraria; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables; namespace CalamityMod.Items.Accessories { @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 26; Item.height = 26; - Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; Item.accessory = true; } diff --git a/Items/Accessories/EtherealExtorter.cs b/Items/Accessories/EtherealExtorter.cs index bc662702f0..c963385ea8 100644 --- a/Items/Accessories/EtherealExtorter.cs +++ b/Items/Accessories/EtherealExtorter.cs @@ -1,7 +1,7 @@ using CalamityMod.CalPlayer; using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Accessories Item.width = 28; Item.height = 32; Item.accessory = true; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; } diff --git a/Items/Accessories/EtherealTalisman.cs b/Items/Accessories/EtherealTalisman.cs index c8c04b4150..7e53c9baa6 100644 --- a/Items/Accessories/EtherealTalisman.cs +++ b/Items/Accessories/EtherealTalisman.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 28; Item.height = 32; - Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.accessory = true; Item.rare = ModContent.RarityType(); } diff --git a/Items/Accessories/EvasionScarf.cs b/Items/Accessories/EvasionScarf.cs index d75a8975cd..cf9f6bdeef 100644 --- a/Items/Accessories/EvasionScarf.cs +++ b/Items/Accessories/EvasionScarf.cs @@ -1,8 +1,8 @@ using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer.Dashes; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer.Dashes; namespace CalamityMod.Items.Accessories { @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Accessories Item.width = 26; Item.height = 26; Item.accessory = true; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.Calamity().donorItem = true; } diff --git a/Items/Accessories/EyeoftheStorm.cs b/Items/Accessories/EyeoftheStorm.cs index 132b79a4ca..d0db6cd67c 100644 --- a/Items/Accessories/EyeoftheStorm.cs +++ b/Items/Accessories/EyeoftheStorm.cs @@ -1,11 +1,11 @@ using CalamityMod.Buffs.Summon; using CalamityMod.CalPlayer; -using CalamityMod.Projectiles.Summon; -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; -using Microsoft.Xna.Framework; using CalamityMod.Items.Potions.Alcohol; +using CalamityMod.Projectiles.Summon; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 20; Item.height = 26; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.accessory = true; } diff --git a/Items/Accessories/FeatherCrown.cs b/Items/Accessories/FeatherCrown.cs index 9f96ae244d..fc1e5de671 100644 --- a/Items/Accessories/FeatherCrown.cs +++ b/Items/Accessories/FeatherCrown.cs @@ -12,11 +12,11 @@ namespace CalamityMod.Items.Accessories public new string LocalizationCategory => "Items.Accessories"; public override void SetStaticDefaults() { - + if (Main.netMode != NetmodeID.Server) { int equipSlot = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Face); - ArmorIDs.Face.Sets.OverrideHelmet[equipSlot] = true; + ArmorIDs.Face.Sets.OverrideHelmet[equipSlot] = true; } } @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 44; Item.height = 38; - Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; Item.accessory = true; } diff --git a/Items/Accessories/FilthyGlove.cs b/Items/Accessories/FilthyGlove.cs index adaec5e09c..905d4c0ccb 100644 --- a/Items/Accessories/FilthyGlove.cs +++ b/Items/Accessories/FilthyGlove.cs @@ -1,12 +1,12 @@ -using CalamityMod.Items.Materials; -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; +using CalamityMod.Items.Materials; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { - [AutoloadEquip(new EquipType[] { EquipType.HandsOn, EquipType.HandsOff } )] + [AutoloadEquip(new EquipType[] { EquipType.HandsOn, EquipType.HandsOff })] public class FilthyGlove : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 24; Item.height = 38; - Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.accessory = true; Item.rare = ItemRarityID.Orange; } diff --git a/Items/Accessories/FlameLickedShell.cs b/Items/Accessories/FlameLickedShell.cs index 3ec4ea4013..cbf6b96a33 100644 --- a/Items/Accessories/FlameLickedShell.cs +++ b/Items/Accessories/FlameLickedShell.cs @@ -2,13 +2,13 @@ using System.Collections.Generic; using CalamityMod.CalPlayer; using CalamityMod.Dusts; +using CalamityMod.Items.Potions.Alcohol; using CalamityMod.Projectiles.Boss; using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Terraria; -using Terraria.ModLoader; using Terraria.ID; -using CalamityMod.Items.Potions.Alcohol; +using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { @@ -18,12 +18,12 @@ namespace CalamityMod.Items.Accessories public new string LocalizationCategory => "Items.Accessories"; internal const int flameLickedParry = 30; public override void ModifyTooltips(List list) => list.IntegrateHotkey(CalamityKeybinds.AccessoryParryHotKey); - + public override void SetDefaults() { Item.width = 36; Item.height = 42; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.accessory = true; } @@ -38,14 +38,14 @@ namespace CalamityMod.Items.Accessories { var calPlayer = player.Calamity(); var empowered = calPlayer.flameLickedShellEmpoweredParry; - + NPC target = player.Center.ClosestNPCAt(1300f, true, true); Vector2 targetPosition = target?.Center ?? Main.MouseWorld; float projectileSpeed = 8f; float radialOffset = 0.2f; float diameter = 80f; - + Vector2 projectileVelocity = targetPosition - player.Center; projectileVelocity = Vector2.Normalize(projectileVelocity) * projectileSpeed; @@ -90,10 +90,10 @@ namespace CalamityMod.Items.Accessories calPlayer.flameLickedShellEmpoweredParry = false; } - + public static void HandleParryCountdown(Player player) { - + player.Calamity().flameLickedShellParry--; if (player.Calamity().flameLickedShellParry > 0) diff --git a/Items/Accessories/FleshTotem.cs b/Items/Accessories/FleshTotem.cs index a841b42a9c..43a6d21ea8 100644 --- a/Items/Accessories/FleshTotem.cs +++ b/Items/Accessories/FleshTotem.cs @@ -1,7 +1,7 @@ using CalamityMod.CalPlayer; using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Accessories Item.width = 26; Item.height = 26; Item.rare = ItemRarityID.Yellow; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.accessory = true; } diff --git a/Items/Accessories/FrostBarrier.cs b/Items/Accessories/FrostBarrier.cs index 54b11a4bf0..0b961d17d4 100644 --- a/Items/Accessories/FrostBarrier.cs +++ b/Items/Accessories/FrostBarrier.cs @@ -10,10 +10,10 @@ namespace CalamityMod.Items.Accessories public new string LocalizationCategory => "Items.Accessories"; public override void SetDefaults() { - Item.defense = 4; Item.width = 20; Item.height = 24; - Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.defense = 10; + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; Item.accessory = true; } @@ -23,6 +23,7 @@ namespace CalamityMod.Items.Accessories CalamityPlayer modPlayer = player.Calamity(); modPlayer.fBarrier = true; player.buffImmune[BuffID.Chilled] = true; + player.buffImmune[BuffID.Frostburn] = true; } } } diff --git a/Items/Accessories/FrostFlare.cs b/Items/Accessories/FrostFlare.cs index d93792e7c0..647d427878 100644 --- a/Items/Accessories/FrostFlare.cs +++ b/Items/Accessories/FrostFlare.cs @@ -1,8 +1,8 @@ using CalamityMod.CalPlayer; using Terraria; using Terraria.DataStructures; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 20; Item.height = 24; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.accessory = true; } diff --git a/Items/Accessories/FungalClump.cs b/Items/Accessories/FungalClump.cs index 37b51c914a..e65ca7c7b0 100644 --- a/Items/Accessories/FungalClump.cs +++ b/Items/Accessories/FungalClump.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 38; Item.height = 42; - Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; Item.accessory = true; } diff --git a/Items/Accessories/FungalSymbiote.cs b/Items/Accessories/FungalSymbiote.cs index 0bb68851dc..8f020a1998 100644 --- a/Items/Accessories/FungalSymbiote.cs +++ b/Items/Accessories/FungalSymbiote.cs @@ -1,7 +1,7 @@ using CalamityMod.CalPlayer; using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 38; Item.height = 36; - Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; Item.accessory = true; } diff --git a/Items/Accessories/GiantPearl.cs b/Items/Accessories/GiantPearl.cs index bf87a0baaa..e1e9e339a4 100644 --- a/Items/Accessories/GiantPearl.cs +++ b/Items/Accessories/GiantPearl.cs @@ -1,7 +1,7 @@ using CalamityMod.CalPlayer; using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 42; Item.height = 32; - Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; Item.accessory = true; } diff --git a/Items/Accessories/GiantShell.cs b/Items/Accessories/GiantShell.cs index 3d6c009bac..52297d4d96 100644 --- a/Items/Accessories/GiantShell.cs +++ b/Items/Accessories/GiantShell.cs @@ -1,7 +1,7 @@ using CalamityMod.CalPlayer; using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { @@ -11,10 +11,10 @@ namespace CalamityMod.Items.Accessories public new string LocalizationCategory => "Items.Accessories"; public override void SetDefaults() { - Item.defense = 10; Item.width = 30; Item.height = 28; - Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.defense = 6; + Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.rare = ItemRarityID.Blue; Item.accessory = true; } diff --git a/Items/Accessories/GiantTortoiseShell.cs b/Items/Accessories/GiantTortoiseShell.cs index b058933739..579d15d32f 100644 --- a/Items/Accessories/GiantTortoiseShell.cs +++ b/Items/Accessories/GiantTortoiseShell.cs @@ -1,9 +1,7 @@ -using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.CalPlayer; using Terraria; -using Terraria.ModLoader; using Terraria.ID; -using CalamityMod.Items.Materials; -using CalamityMod.CalPlayer; +using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { @@ -12,10 +10,10 @@ namespace CalamityMod.Items.Accessories public new string LocalizationCategory => "Items.Accessories"; public override void SetDefaults() { + Item.width = 46; + Item.height = 30; Item.defense = 15; - Item.width = 20; - Item.height = 24; - Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; Item.accessory = true; } @@ -23,6 +21,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); + player.noKnockback = true; modPlayer.tortShell = true; } public override void AddRecipes() diff --git a/Items/Accessories/GiantTortoiseShell.png b/Items/Accessories/GiantTortoiseShell.png index abe75a1733..3390080cd0 100644 Binary files a/Items/Accessories/GiantTortoiseShell.png and b/Items/Accessories/GiantTortoiseShell.png differ diff --git a/Items/Accessories/GladiatorsLocket.cs b/Items/Accessories/GladiatorsLocket.cs index b926ee3e95..8b56b94464 100644 --- a/Items/Accessories/GladiatorsLocket.cs +++ b/Items/Accessories/GladiatorsLocket.cs @@ -3,8 +3,8 @@ using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 42; Item.height = 36; - Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; Item.defense = 5; Item.accessory = true; diff --git a/Items/Accessories/GloveOfRecklessness.cs b/Items/Accessories/GloveOfRecklessness.cs index d2293ed4b0..bcf12ea981 100644 --- a/Items/Accessories/GloveOfRecklessness.cs +++ b/Items/Accessories/GloveOfRecklessness.cs @@ -1,11 +1,11 @@ using CalamityMod.CalPlayer; using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { - [AutoloadEquip(new EquipType[] { EquipType.HandsOn, EquipType.HandsOff } )] + [AutoloadEquip(new EquipType[] { EquipType.HandsOn, EquipType.HandsOff })] public class GloveOfRecklessness : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 28; Item.height = 36; - Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.accessory = true; Item.rare = ItemRarityID.Lime; } diff --git a/Items/Accessories/GloveofPrecision.cs b/Items/Accessories/GloveofPrecision.cs index 47c01a918a..9cb6f21173 100644 --- a/Items/Accessories/GloveofPrecision.cs +++ b/Items/Accessories/GloveofPrecision.cs @@ -1,11 +1,11 @@ using CalamityMod.CalPlayer; using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { - [AutoloadEquip(new EquipType[] { EquipType.HandsOn, EquipType.HandsOff } )] + [AutoloadEquip(new EquipType[] { EquipType.HandsOn, EquipType.HandsOff })] public class GloveOfPrecision : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 24; Item.height = 40; - Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.accessory = true; Item.rare = ItemRarityID.Lime; } diff --git a/Items/Accessories/GrandGelatin.cs b/Items/Accessories/GrandGelatin.cs index 17aa96c5d1..48540432a4 100644 --- a/Items/Accessories/GrandGelatin.cs +++ b/Items/Accessories/GrandGelatin.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 34; Item.height = 52; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.accessory = true; } diff --git a/Items/Accessories/GravistarSabaton.cs b/Items/Accessories/GravistarSabaton.cs index 32519e51f3..93913e2744 100644 --- a/Items/Accessories/GravistarSabaton.cs +++ b/Items/Accessories/GravistarSabaton.cs @@ -1,7 +1,7 @@ -using Terraria; -using Terraria.ModLoader; +using System.Collections.Generic; +using Terraria; using Terraria.ID; -using System.Collections.Generic; +using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { @@ -11,12 +11,13 @@ namespace CalamityMod.Items.Accessories public static readonly int PassthroughDamage = 150; public static readonly int SlamDamage = 300; + public static readonly int PassthroughIFrames = 5; public override void SetDefaults() { Item.width = 20; Item.height = 22; - Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.accessory = true; Item.rare = ItemRarityID.Lime; } diff --git a/Items/Accessories/HallowedRune.cs b/Items/Accessories/HallowedRune.cs index f1ab3e0f1f..74226ce8d0 100644 --- a/Items/Accessories/HallowedRune.cs +++ b/Items/Accessories/HallowedRune.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 26; Item.height = 26; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.accessory = true; } diff --git a/Items/Accessories/HarpyRing.cs b/Items/Accessories/HarpyRing.cs index fc30d1aaba..927a30b43a 100644 --- a/Items/Accessories/HarpyRing.cs +++ b/Items/Accessories/HarpyRing.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 20; Item.height = 22; - Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; Item.accessory = true; } diff --git a/Items/Accessories/HeartofDarkness.cs b/Items/Accessories/HeartofDarkness.cs index 1b8a76d29b..fe40492178 100644 --- a/Items/Accessories/HeartofDarkness.cs +++ b/Items/Accessories/HeartofDarkness.cs @@ -1,11 +1,11 @@ using CalamityMod.CalPlayer; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.GameContent; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 46; Item.height = 66; - Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; Item.accessory = true; } diff --git a/Items/Accessories/HeartoftheElements.cs b/Items/Accessories/HeartoftheElements.cs index a5bf28af39..536236e269 100644 --- a/Items/Accessories/HeartoftheElements.cs +++ b/Items/Accessories/HeartoftheElements.cs @@ -26,9 +26,9 @@ namespace CalamityMod.Items.Accessories { Item.width = 20; Item.height = 20; - Item.value = CalamityGlobalItem.Rarity9BuyPrice; + Item.value = CalamityGlobalItem.RarityCyanBuyPrice; Item.accessory = true; - Item.rare = ModContent.RarityType(); + Item.rare = ItemRarityID.Red; } public override bool CanEquipAccessory(Player player, int slot, bool modded) diff --git a/Items/Accessories/HideofAstrumDeus.cs b/Items/Accessories/HideofAstrumDeus.cs index 3e66faa753..b59cc97768 100644 --- a/Items/Accessories/HideofAstrumDeus.cs +++ b/Items/Accessories/HideofAstrumDeus.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 26; Item.height = 26; - Item.value = CalamityGlobalItem.Rarity9BuyPrice; + Item.value = CalamityGlobalItem.RarityCyanBuyPrice; Item.rare = ItemRarityID.Cyan; Item.accessory = true; } @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Accessories player.buffImmune[ModContent.BuffType()] = true; modPlayer.hideOfDeus = true; if (modPlayer.hideOfDeusMeleeBoostTimer > 0) - player.GetDamage() += 0.5f; + player.GetDamage() += 0.3f; player.buffImmune[BuffID.CursedInferno] = true; player.buffImmune[BuffID.OnFire] = true; player.buffImmune[BuffID.Frostburn] = true; diff --git a/Items/Accessories/HoneyDew.cs b/Items/Accessories/HoneyDew.cs index 247b8ed539..f0bd6da006 100644 --- a/Items/Accessories/HoneyDew.cs +++ b/Items/Accessories/HoneyDew.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 20; Item.height = 20; - Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; Item.accessory = true; } diff --git a/Items/Accessories/HowlsHeart.cs b/Items/Accessories/HowlsHeart.cs index 89ca8485e3..9397e5a300 100644 --- a/Items/Accessories/HowlsHeart.cs +++ b/Items/Accessories/HowlsHeart.cs @@ -5,12 +5,10 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; -using Terraria.GameContent; - using static Terraria.ModLoader.ModContent; -using CalamityMod.Items.Potions.Alcohol; namespace CalamityMod.Items.Accessories { @@ -31,8 +29,8 @@ namespace CalamityMod.Items.Accessories Item.height = 26; Item.accessory = true; - Item.value = CalamityGlobalItem.Rarity4BuyPrice; - Item.rare = ItemRarityID.Red; + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; + Item.rare = ItemRarityID.LightRed; Item.Calamity().donorItem = true; } diff --git a/Items/Accessories/InfectedJewel.cs b/Items/Accessories/InfectedJewel.cs index cd5e261296..c5c18c08f6 100644 --- a/Items/Accessories/InfectedJewel.cs +++ b/Items/Accessories/InfectedJewel.cs @@ -13,10 +13,10 @@ namespace CalamityMod.Items.Accessories public new string LocalizationCategory => "Items.Accessories"; public override void SetDefaults() { - Item.defense = 6; Item.width = 26; Item.height = 26; - Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.defense = 6; + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; Item.accessory = true; } @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Accessories CreateRecipe(). AddIngredient(). AddIngredient(10). - AddIngredient(25). + AddIngredient(25). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Accessories/InkBomb.cs b/Items/Accessories/InkBomb.cs index 14c7f24097..6ed93531bb 100644 --- a/Items/Accessories/InkBomb.cs +++ b/Items/Accessories/InkBomb.cs @@ -1,7 +1,7 @@ using CalamityMod.CalPlayer; using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 22; Item.height = 50; - Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; Item.accessory = true; } diff --git a/Items/Accessories/IronBoots.cs b/Items/Accessories/IronBoots.cs index 1ca7b5f98a..a87ec69437 100644 --- a/Items/Accessories/IronBoots.cs +++ b/Items/Accessories/IronBoots.cs @@ -1,7 +1,7 @@ using CalamityMod.CalPlayer; using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { @@ -9,11 +9,15 @@ namespace CalamityMod.Items.Accessories public class IronBoots : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; + public override void SetStaticDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { Item.width = 26; Item.height = 26; - Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; Item.accessory = true; } diff --git a/Items/Accessories/JellyChargedBattery.cs b/Items/Accessories/JellyChargedBattery.cs index b3edd9c9e6..a10d8a46be 100644 --- a/Items/Accessories/JellyChargedBattery.cs +++ b/Items/Accessories/JellyChargedBattery.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 20; Item.height = 22; - Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.accessory = true; Item.rare = ItemRarityID.LightRed; } diff --git a/Items/Accessories/Laudanum.cs b/Items/Accessories/Laudanum.cs index 29eb533a53..34e65e548b 100644 --- a/Items/Accessories/Laudanum.cs +++ b/Items/Accessories/Laudanum.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 26; Item.height = 26; - Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; Item.accessory = true; } diff --git a/Items/Accessories/LeviathanAmbergris.cs b/Items/Accessories/LeviathanAmbergris.cs index c707a8e9c3..3b3ef45fa7 100644 --- a/Items/Accessories/LeviathanAmbergris.cs +++ b/Items/Accessories/LeviathanAmbergris.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 20; Item.height = 22; - Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.accessory = true; Item.rare = ItemRarityID.Lime; } diff --git a/Items/Accessories/LifeJelly.cs b/Items/Accessories/LifeJelly.cs index fc53a320f1..5b953ac31a 100644 --- a/Items/Accessories/LifeJelly.cs +++ b/Items/Accessories/LifeJelly.cs @@ -1,8 +1,8 @@ using System; -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; using CalamityMod.CalPlayer; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 18; Item.height = 40; - Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.rare = ItemRarityID.Blue; Item.accessory = true; } diff --git a/Items/Accessories/LivingDew.cs b/Items/Accessories/LivingDew.cs index 1ef0b8db2c..741b41a753 100644 --- a/Items/Accessories/LivingDew.cs +++ b/Items/Accessories/LivingDew.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 34; Item.height = 22; - Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; Item.accessory = true; } diff --git a/Items/Accessories/LumenousAmulet.cs b/Items/Accessories/LumenousAmulet.cs index efc6a1e410..99f96bc469 100644 --- a/Items/Accessories/LumenousAmulet.cs +++ b/Items/Accessories/LumenousAmulet.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 26; Item.height = 26; - Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; Item.accessory = true; } diff --git a/Items/Accessories/LuxorsGift.cs b/Items/Accessories/LuxorsGift.cs index 55663e06c1..bd3acd5dff 100644 --- a/Items/Accessories/LuxorsGift.cs +++ b/Items/Accessories/LuxorsGift.cs @@ -1,7 +1,7 @@ using CalamityMod.CalPlayer; using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 58; Item.height = 48; - Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; Item.accessory = true; } diff --git a/Items/Accessories/ManaPolarizer.cs b/Items/Accessories/ManaPolarizer.cs index c83b5e7d8b..95e449d742 100644 --- a/Items/Accessories/ManaPolarizer.cs +++ b/Items/Accessories/ManaPolarizer.cs @@ -1,7 +1,7 @@ using CalamityMod.CalPlayer; using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 30; Item.height = 30; - Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; Item.accessory = true; } diff --git a/Items/Accessories/MarniteRepulsionShield.cs b/Items/Accessories/MarniteRepulsionShield.cs index f260508392..722a59065d 100644 --- a/Items/Accessories/MarniteRepulsionShield.cs +++ b/Items/Accessories/MarniteRepulsionShield.cs @@ -1,16 +1,16 @@ -using CalamityMod.CalPlayer; +using System; +using System.Collections.Generic; +using System.Linq; +using CalamityMod.CalPlayer; +using CalamityMod.Items.Potions.Alcohol; using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using System; -using Microsoft.Xna.Framework.Graphics; -using ReLogic.Content; -using System.Collections.Generic; -using System.Linq; using static CalamityMod.CalamityUtils; -using CalamityMod.Items.Potions.Alcohol; namespace CalamityMod.Items.Accessories { @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Accessories Item.width = 24; Item.height = 30; Item.rare = ItemRarityID.Blue; - Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.accessory = true; Item.defense = 2; } @@ -127,7 +127,7 @@ namespace CalamityMod.Items.Accessories } public override bool? CanHitNPC(NPC target) - { + { //Only enemies that are behind the player (shouldn't happen but just in case if (Math.Sign((Owner.Center - target.Center).X) != Owner.direction) return false; diff --git a/Items/Accessories/MirageMirror.cs b/Items/Accessories/MirageMirror.cs index 72db294d5b..6db96c7e11 100644 --- a/Items/Accessories/MirageMirror.cs +++ b/Items/Accessories/MirageMirror.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 30; Item.height = 30; - Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; Item.accessory = true; } diff --git a/Items/Accessories/MoonstoneCrown.cs b/Items/Accessories/MoonstoneCrown.cs index 92764d3743..67ce61386b 100644 --- a/Items/Accessories/MoonstoneCrown.cs +++ b/Items/Accessories/MoonstoneCrown.cs @@ -15,11 +15,11 @@ namespace CalamityMod.Items.Accessories public override void SetStaticDefaults() { - + if (Main.netMode != NetmodeID.Server) { int equipSlot = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Face); - ArmorIDs.Face.Sets.OverrideHelmet[equipSlot] = true; + ArmorIDs.Face.Sets.OverrideHelmet[equipSlot] = true; } } @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 46; Item.height = 40; - Item.value = CalamityGlobalItem.Rarity11BuyPrice; + Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; Item.rare = ItemRarityID.Purple; Item.accessory = true; } diff --git a/Items/Accessories/Nanotech.cs b/Items/Accessories/Nanotech.cs index 0b630f0da3..882bf3a32a 100644 --- a/Items/Accessories/Nanotech.cs +++ b/Items/Accessories/Nanotech.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 46; Item.height = 46; - Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.accessory = true; Item.rare = ModContent.RarityType(); } diff --git a/Items/Accessories/NebulousCore.cs b/Items/Accessories/NebulousCore.cs index bc9c165501..fcbb9e69d8 100644 --- a/Items/Accessories/NebulousCore.cs +++ b/Items/Accessories/NebulousCore.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Accessories Item.width = 16; Item.height = 14; Item.accessory = true; - Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.rare = ModContent.RarityType(); } diff --git a/Items/Accessories/NecklaceofVexation.cs b/Items/Accessories/NecklaceofVexation.cs index dd827c0595..8b0b948c8a 100644 --- a/Items/Accessories/NecklaceofVexation.cs +++ b/Items/Accessories/NecklaceofVexation.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 26; Item.height = 34; - Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; Item.accessory = true; } diff --git a/Items/Accessories/NuclearFuelRod.cs b/Items/Accessories/NuclearFuelRod.cs index d9197d9c22..9b0bdbc502 100644 --- a/Items/Accessories/NuclearFuelRod.cs +++ b/Items/Accessories/NuclearFuelRod.cs @@ -1,7 +1,7 @@ using CalamityMod.Buffs.StatDebuffs; using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 28; Item.height = 32; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.accessory = true; } diff --git a/Items/Accessories/Nucleogenesis.cs b/Items/Accessories/Nucleogenesis.cs index 283e14002a..19a5c50e6f 100644 --- a/Items/Accessories/Nucleogenesis.cs +++ b/Items/Accessories/Nucleogenesis.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 50; Item.height = 52; - Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.accessory = true; Item.rare = ModContent.RarityType(); } diff --git a/Items/Accessories/OccultSkullCrown.cs b/Items/Accessories/OccultSkullCrown.cs index 5d40e71556..00acd223fa 100644 --- a/Items/Accessories/OccultSkullCrown.cs +++ b/Items/Accessories/OccultSkullCrown.cs @@ -13,12 +13,12 @@ namespace CalamityMod.Items.Accessories public new string LocalizationCategory => "Items.Accessories"; public override void SetStaticDefaults() { - + if (Main.netMode != NetmodeID.Server) { int equipSlot = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Face); - ArmorIDs.Face.Sets.PreventHairDraw[equipSlot] = true; - ArmorIDs.Face.Sets.OverrideHelmet[equipSlot] = true; + ArmorIDs.Face.Sets.PreventHairDraw[equipSlot] = true; + ArmorIDs.Face.Sets.OverrideHelmet[equipSlot] = true; } } @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Accessories Item.height = 62; Item.defense = 5; Item.rare = ModContent.RarityType(); - Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.accessory = true; } diff --git a/Items/Accessories/OceanCrest.cs b/Items/Accessories/OceanCrest.cs index 8fd47147aa..9266827683 100644 --- a/Items/Accessories/OceanCrest.cs +++ b/Items/Accessories/OceanCrest.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 18; Item.height = 26; - Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; Item.accessory = true; } diff --git a/Items/Accessories/OldDie.cs b/Items/Accessories/OldDie.cs index 603b6d58a1..24d1c36c04 100644 --- a/Items/Accessories/OldDie.cs +++ b/Items/Accessories/OldDie.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Accessories Item.width = 24; Item.height = 26; Item.rare = ItemRarityID.Orange; - Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.accessory = true; } diff --git a/Items/Accessories/OldDukeScales.cs b/Items/Accessories/OldDukeScales.cs index 0a63f55118..43a9746187 100644 --- a/Items/Accessories/OldDukeScales.cs +++ b/Items/Accessories/OldDukeScales.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Accessories Item.width = 28; Item.height = 26; Item.accessory = true; - Item.value = CalamityGlobalItem.Rarity13BuyPrice; + Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; Item.rare = ModContent.RarityType(); } @@ -49,7 +49,7 @@ namespace CalamityMod.Items.Accessories // Show the bar if the player doesn't have it. if (!Player.HasCooldown(OldDukeScalesFatigue.ID)) Player.AddCooldown(OldDukeScalesFatigue.ID, OldDukeScales.MaxFatigue); - + if (!IsTired) { // +10% DR. diff --git a/Items/Accessories/OrnateShield.cs b/Items/Accessories/OrnateShield.cs index 21337c5858..4591e8c680 100644 --- a/Items/Accessories/OrnateShield.cs +++ b/Items/Accessories/OrnateShield.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 36; Item.height = 32; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.defense = 8; Item.accessory = true; diff --git a/Items/Accessories/PearlofEnthrallment.cs b/Items/Accessories/PearlofEnthrallment.cs index f034650c90..a6069a3b59 100644 --- a/Items/Accessories/PearlofEnthrallment.cs +++ b/Items/Accessories/PearlofEnthrallment.cs @@ -1,11 +1,11 @@ using CalamityMod.Buffs.Summon; using CalamityMod.CalPlayer; -using CalamityMod.Projectiles.Summon; -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; -using Microsoft.Xna.Framework; using CalamityMod.Items.Potions.Alcohol; +using CalamityMod.Projectiles.Summon; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 56; Item.height = 56; - Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; Item.accessory = true; } diff --git a/Items/Accessories/PermafrostsConcoction.cs b/Items/Accessories/PermafrostsConcoction.cs index 7bfeb1e2b5..e52819bd0c 100644 --- a/Items/Accessories/PermafrostsConcoction.cs +++ b/Items/Accessories/PermafrostsConcoction.cs @@ -1,18 +1,21 @@ using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { public class PermafrostsConcoction : ModItem, ILocalizedModType { + // Boosted by Cross Necklace. + internal static readonly int EncasedIFrames = 90; + public new string LocalizationCategory => "Items.Accessories"; public override void SetDefaults() { - Item.accessory = true; Item.width = 36; Item.height = 34; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.accessory = true; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; } diff --git a/Items/Accessories/PhantomicArtifact.cs b/Items/Accessories/PhantomicArtifact.cs index 74368d77d6..dd4a41cd4f 100644 --- a/Items/Accessories/PhantomicArtifact.cs +++ b/Items/Accessories/PhantomicArtifact.cs @@ -2,13 +2,13 @@ using CalamityMod.Items.Placeables.Ores; using CalamityMod.Items.Placeables.Plates; using CalamityMod.Rarities; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.GameContent; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { diff --git a/Items/Accessories/PlagueHive.cs b/Items/Accessories/PlagueHive.cs index cc65b39a37..c0bc650ec9 100644 --- a/Items/Accessories/PlagueHive.cs +++ b/Items/Accessories/PlagueHive.cs @@ -13,8 +13,8 @@ namespace CalamityMod.Items.Accessories { Item.width = 42; Item.height = 48; - Item.value = CalamityGlobalItem.Rarity9BuyPrice; - Item.rare = ItemRarityID.Cyan; + Item.value = CalamityGlobalItem.RarityRedBuyPrice; + Item.rare = ItemRarityID.Red; Item.accessory = true; } diff --git a/Items/Accessories/PlaguedFuelPack.cs b/Items/Accessories/PlaguedFuelPack.cs index b3db25045f..7ba1dcb02f 100644 --- a/Items/Accessories/PlaguedFuelPack.cs +++ b/Items/Accessories/PlaguedFuelPack.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 20; Item.height = 36; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; Item.accessory = true; } diff --git a/Items/Accessories/ProfanedSoulArtifact.cs b/Items/Accessories/ProfanedSoulArtifact.cs index 73435d4366..1823d0a29b 100644 --- a/Items/Accessories/ProfanedSoulArtifact.cs +++ b/Items/Accessories/ProfanedSoulArtifact.cs @@ -1,14 +1,16 @@ -using CalamityMod.CalPlayer; +using System; +using System.Collections.Generic; +using System.Linq; +using CalamityMod.CalPlayer; using CalamityMod.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Ores; using CalamityMod.Items.Placeables.Plates; using CalamityMod.Rarities; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; -using System; -using System.Linq; using Terraria; using Terraria.DataStructures; using Terraria.Graphics.Effects; @@ -22,7 +24,7 @@ namespace CalamityMod.Items.Accessories { public new string LocalizationCategory => "Items.Accessories"; public static Asset HeatTex; - + public static int ShieldRechargeDelay = CalamityUtils.SecondsToFrames(5); public static int TotalShieldRechargeTime = CalamityUtils.SecondsToFrames(2); @@ -68,7 +70,7 @@ namespace CalamityMod.Items.Accessories Item.width = 32; Item.height = 40; Item.accessory = true; - Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; } @@ -90,6 +92,12 @@ namespace CalamityMod.Items.Accessories player.Calamity().pSoulShieldVisible = true; } + public override void ModifyTooltips(List tooltips) + { + string adrenTooltip = CalamityWorld.revenge ? this.GetLocalizedValue("ShieldAdren") : ""; + tooltips.FindAndReplace("[ADREN]", adrenTooltip); + } + public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Accessories/ProfanedSoulCrystal.cs b/Items/Accessories/ProfanedSoulCrystal.cs index 2e1ec84035..e04ec73a75 100644 --- a/Items/Accessories/ProfanedSoulCrystal.cs +++ b/Items/Accessories/ProfanedSoulCrystal.cs @@ -1,4 +1,7 @@ -using CalamityMod.Buffs.StatBuffs; +using System; +using System.Collections.Generic; +using System.Linq; +using CalamityMod.Buffs.StatBuffs; using CalamityMod.Buffs.Summon.Whips; using CalamityMod.CalPlayer; using CalamityMod.DataStructures; @@ -8,9 +11,6 @@ using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.Collections.Generic; -using System.Linq; using Terraria; using Terraria.Audio; using Terraria.DataStructures; @@ -25,10 +25,10 @@ namespace CalamityMod.Items.Accessories public static string[] contributorNames = new[] { "IbanPlay", "Chen", "Nincity", "Amber", "Mishiro", "LordMetarex", "Memes" }; public static int ShieldDurabilityMax = 125; public new string LocalizationCategory => "Items.Accessories"; - + public static int ShieldRechargeDelay = CalamityUtils.SecondsToFrames(5); public static int TotalShieldRechargeTime = CalamityUtils.SecondsToFrames(4); - + public const int maxMinionRequirement = 10; public const int maxPscAnimTime = 120; @@ -75,7 +75,7 @@ namespace CalamityMod.Items.Accessories { if (!player.Calamity().profanedCrystalBuffs && !ignoreNoBuffs) return ProfanedSoulCrystalState.Vanity; //vanity if no buffs - + //vanity check during animation if (ignoreNoBuffs && (!DownedBossSystem.downedCalamitas || !DownedBossSystem.downedExoMechs || @@ -84,12 +84,12 @@ namespace CalamityMod.Items.Accessories { return ProfanedSoulCrystalState.Vanity; //failsafe for vanity } - + var noMinions = player.slotsMinions == 0; var noSentries = !Main.projectile.Any(proj => proj.active && proj.owner == player.whoAmI && proj.sentry); if (noMinions && noSentries) return ProfanedSoulCrystalState.Empowered; //immediately check for empowered as it overrides everything else - + return !Main.dayTime ? ProfanedSoulCrystalState.Enraged : //check for enrage ProfanedSoulCrystalState.Buffs; //return buffs as the sole remaining option } @@ -110,7 +110,7 @@ namespace CalamityMod.Items.Accessories { if (calPlayer.pscLerpColor != Color.White) return calPlayer.pscLerpColor; //already set the lerp colour this frame, calculating it again is redundant - + bool day = Main.dayTime; double totalTime = Main.dayTime ? Main.dayLength : Main.dayLength + Main.nightLength; double currentTime = Main.time; @@ -139,12 +139,12 @@ namespace CalamityMod.Items.Accessories { result = Color.Lerp(nonTargetColor, targetColor, (Main.time < midday ? 2f : 0f) - (float)interpolant); } - + calPlayer.pscLerpColor = result; return result; } - + /** * Notes: Drops from providence if the only damage source during the fight is from typeless damage or the profaned soul and the owners of those babs do not have profaned crystal. * All projectiles are in ProfanedSoulCrystalProjectiles.cs in the summon projectile directory @@ -237,11 +237,11 @@ namespace CalamityMod.Items.Accessories modPlayer.profanedCrystalAnim = maxPscAnimTime; Projectile.NewProjectile(player.GetSource_FromThis(), player.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, player.whoAmI); } - + modPlayer.profanedCrystalHide = hideVisual || modPlayer.profanedCrystalAnim > 0; modPlayer.pSoulShieldVisible = !hideVisual; - + DetermineTransformationEligibility(player); } @@ -254,7 +254,7 @@ namespace CalamityMod.Items.Accessories internal static void DetermineTransformationEligibility(Player player) { //short circuit immediately if profanedcrystalbuffs has already been set - + if (!player.Calamity().profanedCrystalBuffs && player.Calamity().profanedCrystalAnim == -1 && DownedBossSystem.downedCalamitas && DownedBossSystem.downedExoMechs && (player.maxMinions - player.slotsMinions) >= maxMinionRequirement && !player.Calamity().profanedCrystalForce && player.HasBuff()) { player.Calamity().profanedCrystalBuffs = true; @@ -269,10 +269,10 @@ namespace CalamityMod.Items.Accessories return false; var source = player.GetSource_ItemUse(item); - int weaponType = item.CountsAsClass() ? 1 : - item.CountsAsClass() ? 2 : + int weaponType = item.CountsAsClass() ? 1 : + item.CountsAsClass() ? 2 : item.CountsAsClass() ? 3 : - item.CountsAsClass() ? 4 : + item.CountsAsClass() ? 4 : item.CountsAsClass() ? 5 : -1; if (weaponType > 0) { @@ -418,7 +418,7 @@ namespace CalamityMod.Items.Accessories { player.Calamity().profanedSoulWeaponUsage = 0; } - + if (player.Calamity().profanedSoulWeaponUsage >= (empowered ? 120 : 360)) { float crystalCount = 36f; diff --git a/Items/Accessories/QuiverofNihility.cs b/Items/Accessories/QuiverofNihility.cs index 91d920b014..cc419a93c1 100644 --- a/Items/Accessories/QuiverofNihility.cs +++ b/Items/Accessories/QuiverofNihility.cs @@ -5,9 +5,9 @@ using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; -using Terraria.GameContent; namespace CalamityMod.Items.Accessories { @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 42; Item.height = 36; - Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; Item.accessory = true; diff --git a/Items/Accessories/Purity.cs b/Items/Accessories/Radiance.cs similarity index 92% rename from Items/Accessories/Purity.cs rename to Items/Accessories/Radiance.cs index 0a42bf5800..b8f71335c4 100644 --- a/Items/Accessories/Purity.cs +++ b/Items/Accessories/Radiance.cs @@ -10,8 +10,8 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { - [LegacyName("AstralArcanum")] - public class Purity : ModItem, ILocalizedModType + [LegacyName("AstralArcanum", "Purity")] + public class Radiance : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; public override void SetStaticDefaults() @@ -22,11 +22,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - Item.defense = 8; Item.width = 18; Item.height = 44; + Item.defense = 8; Item.accessory = true; - Item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.rare = ModContent.RarityType(); } diff --git a/Items/Accessories/Purity.png b/Items/Accessories/Radiance.png similarity index 100% rename from Items/Accessories/Purity.png rename to Items/Accessories/Radiance.png diff --git a/Items/Accessories/RadiantOoze.cs b/Items/Accessories/RadiantOoze.cs index 58f33eec38..42f5a8a1de 100644 --- a/Items/Accessories/RadiantOoze.cs +++ b/Items/Accessories/RadiantOoze.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 20; Item.height = 20; - Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; Item.accessory = true; } diff --git a/Items/Accessories/RaidersTalisman.cs b/Items/Accessories/RaidersTalisman.cs index 428be470ae..9181a9e2ea 100644 --- a/Items/Accessories/RaidersTalisman.cs +++ b/Items/Accessories/RaidersTalisman.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 30; Item.height = 36; - Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; Item.accessory = true; } diff --git a/Items/Accessories/RampartofDeities.cs b/Items/Accessories/RampartofDeities.cs index 24f98f4393..04b7481d08 100644 --- a/Items/Accessories/RampartofDeities.cs +++ b/Items/Accessories/RampartofDeities.cs @@ -1,8 +1,8 @@ -using CalamityMod.CalPlayer; +using System; +using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 64; Item.height = 62; - Item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.defense = 18; Item.accessory = true; Item.rare = ModContent.RarityType(); @@ -26,15 +26,22 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.dAmulet = true; - player.longInvince = true; - player.pStone = true; - player.lifeRegen += 1; + // Directly inherits both Cross Necklace and Deific Amulet iframe boosts + player.longInvince = true; + modPlayer.dAmulet = true; + + // Large hit iframe effect taken from Seraph Tracers + modPlayer.rampartOfDeities = true; + + // Ice Barrier buff inherited from Frozen Turtle Shell if (player.statLife <= player.statLifeMax2 * 0.5) player.AddBuff(BuffID.IceBarrier, 5); + // Knockback immunity inherited from Paladin's Shield player.noKnockback = true; + + // Paladin's Shield application if (player.statLife > player.statLifeMax2 * 0.25f) { player.hasPaladinShield = true; diff --git a/Items/Accessories/ReaperToothNecklace.cs b/Items/Accessories/ReaperToothNecklace.cs index 401ddee52d..7fc403aa83 100644 --- a/Items/Accessories/ReaperToothNecklace.cs +++ b/Items/Accessories/ReaperToothNecklace.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Accessories Item.width = 44; Item.height = 50; Item.accessory = true; - Item.value = CalamityGlobalItem.Rarity13BuyPrice; + Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; Item.rare = ModContent.RarityType(); } diff --git a/Items/Accessories/Regenator.cs b/Items/Accessories/Regenator.cs index ccdcb40e89..292b762fa4 100644 --- a/Items/Accessories/Regenator.cs +++ b/Items/Accessories/Regenator.cs @@ -1,7 +1,7 @@ using CalamityMod.CalPlayer; using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 34; Item.height = 56; - Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; Item.defense = 10; Item.accessory = true; @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Accessories //No lifesteal, no regen, no healing pots if (player.statLife >= (int)(player.statLifeMax2 * 0.5f)) { - player.statLife = (int)(player.statLifeMax2 * 0.5f); + player.statLife = (int)(player.statLifeMax2 * 0.5f); player.moonLeech = true; modPlayer.healingPotionMultiplier = 0; diff --git a/Items/Accessories/RogueEmblem.cs b/Items/Accessories/RogueEmblem.cs index e546e7fee7..e418c24675 100644 --- a/Items/Accessories/RogueEmblem.cs +++ b/Items/Accessories/RogueEmblem.cs @@ -1,6 +1,6 @@ using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 24; Item.height = 24; - Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; Item.accessory = true; } diff --git a/Items/Accessories/RoseStone.cs b/Items/Accessories/RoseStone.cs index 4b7e5ea685..d2f21afb82 100644 --- a/Items/Accessories/RoseStone.cs +++ b/Items/Accessories/RoseStone.cs @@ -1,10 +1,10 @@ using CalamityMod.Buffs.Summon; using CalamityMod.CalPlayer; +using CalamityMod.Items.Potions.Alcohol; using CalamityMod.Projectiles.Summon; using Terraria; -using Terraria.ModLoader; using Terraria.ID; -using CalamityMod.Items.Potions.Alcohol; +using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 20; Item.height = 20; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.accessory = true; } diff --git a/Items/Accessories/RottenBrain.cs b/Items/Accessories/RottenBrain.cs index aabf2757c0..783cdf7762 100644 --- a/Items/Accessories/RottenBrain.cs +++ b/Items/Accessories/RottenBrain.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 34; Item.height = 34; - Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; Item.accessory = true; } diff --git a/Items/Accessories/RottenDogtooth.cs b/Items/Accessories/RottenDogtooth.cs index efde40675e..7dad00cdc3 100644 --- a/Items/Accessories/RottenDogtooth.cs +++ b/Items/Accessories/RottenDogtooth.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 14; Item.height = 22; - Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.rare = ItemRarityID.Blue; Item.accessory = true; } diff --git a/Items/Accessories/RottenDogtooth.png b/Items/Accessories/RottenDogtooth.png index 8a542b03b6..83d5f2370d 100644 Binary files a/Items/Accessories/RottenDogtooth.png and b/Items/Accessories/RottenDogtooth.png differ diff --git a/Items/Accessories/RoverDrive.cs b/Items/Accessories/RoverDrive.cs index cb944d74ce..92b08066ed 100644 --- a/Items/Accessories/RoverDrive.cs +++ b/Items/Accessories/RoverDrive.cs @@ -1,10 +1,12 @@ -using CalamityMod.CalPlayer; +using System; +using System.Collections.Generic; +using CalamityMod.CalPlayer; using CalamityMod.DataStructures; using CalamityMod.Items.Materials; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; -using System; using Terraria; using Terraria.Audio; using Terraria.Graphics.Effects; @@ -40,7 +42,7 @@ namespace CalamityMod.Items.Accessories { Player player = Main.player[i]; if (player is null || !player.active || player.outOfRange || player.dead) - continue; + continue; CalamityPlayer modPlayer = player.Calamity(); @@ -61,7 +63,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 38; Item.height = 26; - Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.rare = ItemRarityID.Blue; Item.accessory = true; Item.MakeUsableWithChlorophyteExtractinator(); @@ -81,6 +83,12 @@ namespace CalamityMod.Items.Accessories // In vanity, provides a visual shield but no actual functionality public override void UpdateVanity(Player player) => player.Calamity().roverDriveShieldVisible = true; + public override void ModifyTooltips(List tooltips) + { + string adrenTooltip = CalamityWorld.revenge ? this.GetLocalizedValue("ShieldAdren") : ""; + tooltips.FindAndReplace("[ADREN]", adrenTooltip); + } + // Scrappable for 3-5 wulfrum scrap or a 20% chance to get an energy core public override void ExtractinatorUse(int extractinatorBlockType, ref int resultType, ref int resultStack) { @@ -154,7 +162,7 @@ namespace CalamityMod.Items.Accessories Color wulfGreen = new Color(194, 255, 67) * 0.8f; Color edgeColor = CalamityUtils.MulticolorLerp(Main.GlobalTimeWrappedHourly * 0.2f, blueTint, cyanTint, wulfGreen); Color shieldColor = blueTint; - + // Define shader parameters for shield color shieldEffect.Parameters["shieldColor"].SetValue(shieldColor.ToVector3()); diff --git a/Items/Accessories/RuinMedallion.cs b/Items/Accessories/RuinMedallion.cs index f7a853f3f6..5238582827 100644 --- a/Items/Accessories/RuinMedallion.cs +++ b/Items/Accessories/RuinMedallion.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 20; Item.height = 28; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.accessory = true; } diff --git a/Items/Accessories/RustyMedallion.cs b/Items/Accessories/RustyMedallion.cs index 24fdd0847b..4f7c014cc6 100644 --- a/Items/Accessories/RustyMedallion.cs +++ b/Items/Accessories/RustyMedallion.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Accessories Item.width = 18; Item.height = 32; Item.rare = ItemRarityID.Blue; - Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.accessory = true; } diff --git a/Items/Accessories/SandCloak.cs b/Items/Accessories/SandCloak.cs index 5cf41613f3..9097563d19 100644 --- a/Items/Accessories/SandCloak.cs +++ b/Items/Accessories/SandCloak.cs @@ -1,18 +1,20 @@ using System.Collections.Generic; using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { public class SandCloak : ModItem, ILocalizedModType { + public static float KnockbackStrength = 0.3f; + public new string LocalizationCategory => "Items.Accessories"; public override void SetDefaults() { Item.width = 30; Item.height = 44; - Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; Item.accessory = true; Item.defense = 2; diff --git a/Items/Accessories/SandSharkToothNecklace.cs b/Items/Accessories/SandSharkToothNecklace.cs index 54c83b11e0..c18875f349 100644 --- a/Items/Accessories/SandSharkToothNecklace.cs +++ b/Items/Accessories/SandSharkToothNecklace.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Accessories Item.width = 32; Item.height = 44; Item.accessory = true; - Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; } diff --git a/Items/Accessories/ScuttlersJewel.cs b/Items/Accessories/ScuttlersJewel.cs index 09d47cc20e..5a24199168 100644 --- a/Items/Accessories/ScuttlersJewel.cs +++ b/Items/Accessories/ScuttlersJewel.cs @@ -1,7 +1,7 @@ using CalamityMod.CalPlayer; using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 26; Item.height = 26; - Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.rare = ItemRarityID.Blue; Item.accessory = true; Item.MakeUsableWithChlorophyteExtractinator(); diff --git a/Items/Accessories/ShatteredCommunity.cs b/Items/Accessories/ShatteredCommunity.cs index d276b38d14..90455d11b0 100644 --- a/Items/Accessories/ShatteredCommunity.cs +++ b/Items/Accessories/ShatteredCommunity.cs @@ -1,17 +1,17 @@ -using CalamityMod.CalPlayer; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using CalamityMod.CalPlayer; using CalamityMod.Rarities; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; using Terraria; using Terraria.Audio; using Terraria.DataStructures; -using Terraria.ID; using Terraria.GameContent; +using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.IO; diff --git a/Items/Accessories/ShieldoftheHighRuler.cs b/Items/Accessories/ShieldoftheHighRuler.cs index 95fa31d798..f717c20560 100644 --- a/Items/Accessories/ShieldoftheHighRuler.cs +++ b/Items/Accessories/ShieldoftheHighRuler.cs @@ -17,12 +17,12 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { + Item.width = 36; + Item.height = 38; Item.DamageType = DamageClass.MeleeNoSpeed; Item.damage = 30; Item.knockBack = 9f; - Item.width = 36; - Item.height = 38; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; Item.Calamity().donorItem = true; Item.defense = 12; diff --git a/Items/Accessories/ShieldoftheOcean.cs b/Items/Accessories/ShieldoftheOcean.cs index ad1523137a..9db1a74924 100644 --- a/Items/Accessories/ShieldoftheOcean.cs +++ b/Items/Accessories/ShieldoftheOcean.cs @@ -1,5 +1,5 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Items.Armor.Victide; +using CalamityMod.Items.Armor.Victide; +using CalamityMod.Items.Materials; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 24; Item.height = 28; - Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; Item.defense = 2; Item.accessory = true; diff --git a/Items/Accessories/SigilofCalamitas.cs b/Items/Accessories/SigilofCalamitas.cs index 464b2168b0..eb3ff6f32b 100644 --- a/Items/Accessories/SigilofCalamitas.cs +++ b/Items/Accessories/SigilofCalamitas.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 28; Item.height = 32; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; Item.accessory = true; } diff --git a/Items/Accessories/SilencingSheath.cs b/Items/Accessories/SilencingSheath.cs index 0bfbad71c6..e2299267cc 100644 --- a/Items/Accessories/SilencingSheath.cs +++ b/Items/Accessories/SilencingSheath.cs @@ -12,8 +12,8 @@ namespace CalamityMod.Items.Accessories { Item.width = 32; Item.height = 34; - Item.value = CalamityGlobalItem.Rarity3BuyPrice; - Item.rare = ItemRarityID.Orange; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; + Item.rare = ItemRarityID.Green; Item.accessory = true; } diff --git a/Items/Accessories/SlagsplitterPauldron.cs b/Items/Accessories/SlagsplitterPauldron.cs index 51b372fa39..5180da893b 100644 --- a/Items/Accessories/SlagsplitterPauldron.cs +++ b/Items/Accessories/SlagsplitterPauldron.cs @@ -1,14 +1,14 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables; using CalamityMod.Projectiles.Typeless; using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; -using Terraria.GameContent; -using CalamityMod.Items.Placeables; namespace CalamityMod.Items.Accessories { @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 54; Item.height = 56; - Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; Item.accessory = true; } diff --git a/Items/Accessories/SpectralVeil.cs b/Items/Accessories/SpectralVeil.cs index f0fd52a994..c2c749190f 100644 --- a/Items/Accessories/SpectralVeil.cs +++ b/Items/Accessories/SpectralVeil.cs @@ -1,7 +1,7 @@ -using CalamityMod.Rarities; -using System.Collections.Generic; +using System.Collections.Generic; +using CalamityMod.Balancing; +using CalamityMod.Rarities; using Terraria; -using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Accessories @@ -10,11 +10,15 @@ namespace CalamityMod.Items.Accessories { public new string LocalizationCategory => "Items.Accessories"; public const float TeleportRange = 845f; + + // Boosted by Cross Necklace. + internal static readonly int VeilIFrames = BalancingConstants.VanillaDodgeIFrames; + public override void SetDefaults() { Item.width = 30; Item.height = 38; - Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); Item.accessory = true; } diff --git a/Items/Accessories/SpelunkersAmulet.cs b/Items/Accessories/SpelunkersAmulet.cs index 35f172cbc5..d7029c4e28 100644 --- a/Items/Accessories/SpelunkersAmulet.cs +++ b/Items/Accessories/SpelunkersAmulet.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 22; Item.height = 32; - Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; Item.accessory = true; } diff --git a/Items/Accessories/SpiritGlyph.cs b/Items/Accessories/SpiritGlyph.cs index e795cd09d2..7537625a42 100644 --- a/Items/Accessories/SpiritGlyph.cs +++ b/Items/Accessories/SpiritGlyph.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 24; Item.height = 30; - Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; Item.accessory = true; } diff --git a/Items/Accessories/StarTaintedGenerator.cs b/Items/Accessories/StarTaintedGenerator.cs index 144a1f31d0..994e56cdfc 100644 --- a/Items/Accessories/StarTaintedGenerator.cs +++ b/Items/Accessories/StarTaintedGenerator.cs @@ -1,11 +1,11 @@ using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Materials; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.GameContent; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Accessories Item.width = 38; Item.height = 60; Item.accessory = true; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; } diff --git a/Items/Accessories/StarbusterCore.cs b/Items/Accessories/StarbusterCore.cs index 199c191ca3..be1707868b 100644 --- a/Items/Accessories/StarbusterCore.cs +++ b/Items/Accessories/StarbusterCore.cs @@ -1,6 +1,6 @@ using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 28; Item.height = 32; - Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; Item.accessory = true; } diff --git a/Items/Accessories/StatMeter.cs b/Items/Accessories/StatMeter.cs index dcbdad27bd..9fc54df8eb 100644 --- a/Items/Accessories/StatMeter.cs +++ b/Items/Accessories/StatMeter.cs @@ -1,8 +1,8 @@ -using CalamityMod.Balancing; +using System; +using System.Collections.Generic; +using CalamityMod.Balancing; using CalamityMod.CalPlayer; using CalamityMod.World; -using System; -using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 26; Item.height = 26; - Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; Item.accessory = true; } @@ -38,7 +38,7 @@ namespace CalamityMod.Items.Accessories Item heldItem = null; if (player.selectedItem >= 0 && player.selectedItem < Main.InventorySlotsTotal) heldItem = player.ActiveItem(); - + static string OnePlace(float f) => f.ToString("n1"); static string TwoPlaces(float f) => f.ToString("n2"); @@ -63,13 +63,13 @@ namespace CalamityMod.Items.Accessories if (heldItem != null && !heldItem.IsAir) { // If block/wall, add respective placement stats, and ignore all combat stats - if (heldItem.createWall >= 0 || heldItem.createTile >= 0) + if (heldItem.createWall >= 0 || heldItem.createTile >= TileID.Dirt) { int extraBlockRangeX = player.blockRange + Player.tileRangeX - 5; int extraBlockRangeY = player.blockRange + Player.tileRangeY - 4; stats2 += "\n" + this.GetLocalization("PlacementRange").Format(Sign(extraBlockRangeX) + extraBlockRangeX, Sign(extraBlockRangeY) + extraBlockRangeY); - if (heldItem.createTile >= 0 && player.tileSpeed != 0f) + if (heldItem.createTile >= TileID.Dirt && player.tileSpeed != 0f) { float tileSpeed = (1f / player.tileSpeed) - 1f; stats2 += this.GetLocalization("TileSpeed").Format(Sign(tileSpeed) + OnePlace(100f * tileSpeed)); @@ -164,7 +164,7 @@ namespace CalamityMod.Items.Accessories // If summon, or any direct subclass thereof, AND NOT A WHIP, display minion/sentry slots if (dc != DamageClass.SummonMeleeSpeed && (dc == DamageClass.Summon || dc.GetModifierInheritance(DamageClass.Summon).Equals(StatInheritanceData.Full))) stats2 += "\n" + this.GetLocalization("SummonStats").Format(player.maxMinions, player.maxTurrets); - + // If whip, show whip range float whipRange = player.whipRangeMultiplier - 1f; if (dc == DamageClass.SummonMeleeSpeed || dc.GetModifierInheritance(DamageClass.SummonMeleeSpeed).Equals(StatInheritanceData.Full)) diff --git a/Items/Accessories/StatisBlessing.cs b/Items/Accessories/StatisBlessing.cs index 8e01b530f4..72fa58ce65 100644 --- a/Items/Accessories/StatisBlessing.cs +++ b/Items/Accessories/StatisBlessing.cs @@ -14,8 +14,8 @@ namespace CalamityMod.Items.Accessories { Item.width = 28; Item.height = 32; - Item.value = CalamityGlobalItem.Rarity7BuyPrice; - Item.rare = ItemRarityID.Lime; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; + Item.rare = ItemRarityID.Yellow; Item.accessory = true; } diff --git a/Items/Accessories/StatisCurse.cs b/Items/Accessories/StatisCurse.cs index 3a325984c3..e16ebd5b2e 100644 --- a/Items/Accessories/StatisCurse.cs +++ b/Items/Accessories/StatisCurse.cs @@ -4,9 +4,9 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; -using Terraria.GameContent; namespace CalamityMod.Items.Accessories { @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 28; Item.height = 32; - Item.value = CalamityGlobalItem.Rarity10BuyPrice; + Item.value = CalamityGlobalItem.RarityRedBuyPrice; Item.rare = ItemRarityID.Red; Item.accessory = true; } diff --git a/Items/Accessories/StatisNinjaBelt.cs b/Items/Accessories/StatisNinjaBelt.cs index acd6cc63b5..a0990135cd 100644 --- a/Items/Accessories/StatisNinjaBelt.cs +++ b/Items/Accessories/StatisNinjaBelt.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 30; Item.height = 26; - Item.value = CalamityGlobalItem.Rarity11BuyPrice; + Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; Item.rare = ItemRarityID.Purple; Item.accessory = true; } @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { player.autoJump = true; - player.jumpSpeedBoost += 0.3f; + player.jumpSpeedBoost += 1.6f; player.extraFall += 35; player.blackBelt = true; player.dashType = 1; @@ -38,11 +38,22 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { + // 20FEB2024: Ozzatron: used to have one recipe which was MNG + Frog Gear. This requires 2 Tiger Climbing Gear. + // There are now two recipes depending on whether you made Frog Gear or Master Ninja Gear. CreateRecipe(). AddIngredient(ItemID.MasterNinjaGear). + AddIngredient(ItemID.FrogFlipper). + AddIngredient(50). + AddIngredient(5). + AddTile(TileID.LunarCraftingStation). + Register(); + + CreateRecipe(). + AddIngredient(ItemID.Tabi). + AddIngredient(ItemID.BlackBelt). AddIngredient(ItemID.FrogGear). AddIngredient(50). - AddIngredient(5). + AddIngredient(5). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Accessories/StatisVoidSash.cs b/Items/Accessories/StatisVoidSash.cs index 61a24863a2..1606ad6e1f 100644 --- a/Items/Accessories/StatisVoidSash.cs +++ b/Items/Accessories/StatisVoidSash.cs @@ -3,13 +3,13 @@ using CalamityMod.CalPlayer.Dashes; using CalamityMod.Items.Materials; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.GameContent; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Accessories Item.width = 28; Item.height = 32; Item.accessory = true; - Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.rare = ModContent.RarityType(); } @@ -36,7 +36,7 @@ namespace CalamityMod.Items.Accessories { CalamityPlayer modPlayer = player.Calamity(); player.autoJump = true; - player.jumpSpeedBoost += 0.6f; + player.jumpSpeedBoost += 1.6f; player.noFallDmg = true; player.blackBelt = true; modPlayer.DashID = StatisVoidSashDash.ID; diff --git a/Items/Accessories/StressPills.cs b/Items/Accessories/StressPills.cs index 910e496684..3a921fcb3d 100644 --- a/Items/Accessories/StressPills.cs +++ b/Items/Accessories/StressPills.cs @@ -12,13 +12,13 @@ namespace CalamityMod.Items.Accessories { ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); } - + public override void SetDefaults() { Item.width = 26; Item.height = 26; Item.defense = 4; - Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; Item.accessory = true; } diff --git a/Items/Accessories/SupremeBaitTackleBoxFishingStation.cs b/Items/Accessories/SupremeBaitTackleBoxFishingStation.cs index 064312a4fa..bf385bc526 100644 --- a/Items/Accessories/SupremeBaitTackleBoxFishingStation.cs +++ b/Items/Accessories/SupremeBaitTackleBoxFishingStation.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 46; Item.height = 52; - Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; Item.accessory = true; } diff --git a/Items/Accessories/TheAbsorber.cs b/Items/Accessories/TheAbsorber.cs index 508d72d7fc..cd3aa3500e 100644 --- a/Items/Accessories/TheAbsorber.cs +++ b/Items/Accessories/TheAbsorber.cs @@ -1,7 +1,5 @@ -using CalamityMod.Buffs.StatDebuffs; -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -13,17 +11,18 @@ namespace CalamityMod.Items.Accessories public new string LocalizationCategory => "Items.Accessories"; public override void SetDefaults() { - Item.defense = 15; Item.width = 20; Item.height = 24; - Item.value = CalamityGlobalItem.Rarity9BuyPrice; - Item.rare = ItemRarityID.Cyan; + Item.defense = 15; + Item.value = CalamityGlobalItem.RarityRedBuyPrice; + Item.rare = ItemRarityID.Red; Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); + player.noKnockback = true; // Inherited from Giant Tortoise Shell modPlayer.absorber = true; } diff --git a/Items/Accessories/TheAmalgam.cs b/Items/Accessories/TheAmalgam.cs index e191f1cba1..b9c4afea7e 100644 --- a/Items/Accessories/TheAmalgam.cs +++ b/Items/Accessories/TheAmalgam.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Accessories Item.width = 34; Item.height = 34; Item.accessory = true; - Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.rare = RarityType(); } @@ -65,7 +65,7 @@ namespace CalamityMod.Items.Accessories AddIngredient(). AddIngredient(5). AddIngredient(10). - AddIngredient(15). + AddIngredient(15). AddIngredient(15). AddIngredient(5). AddIngredient(4). diff --git a/Items/Accessories/TheBee.cs b/Items/Accessories/TheBee.cs index a8e525ce5d..8d9aac1e0c 100644 --- a/Items/Accessories/TheBee.cs +++ b/Items/Accessories/TheBee.cs @@ -1,7 +1,7 @@ using CalamityMod.CalPlayer; using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 24; Item.height = 28; - Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; Item.accessory = true; } diff --git a/Items/Accessories/TheCamper.cs b/Items/Accessories/TheCamper.cs index ec7a9d6d49..430535724a 100644 --- a/Items/Accessories/TheCamper.cs +++ b/Items/Accessories/TheCamper.cs @@ -18,8 +18,8 @@ namespace CalamityMod.Items.Accessories { Item.width = 26; Item.height = 26; - Item.value = CalamityGlobalItem.Rarity7BuyPrice; - Item.rare = ItemRarityID.Lime; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; + Item.rare = ItemRarityID.Yellow; Item.accessory = true; Item.defense = 10; } @@ -46,7 +46,7 @@ namespace CalamityMod.Items.Accessories player.buffTime[l] = 80; } } - + Lighting.AddLight(player.Center, 0.825f, 0.66f, 0f); if (Main.myPlayer == player.whoAmI) { diff --git a/Items/Accessories/TheCommunity.cs b/Items/Accessories/TheCommunity.cs index 416d820142..7aeffc057c 100644 --- a/Items/Accessories/TheCommunity.cs +++ b/Items/Accessories/TheCommunity.cs @@ -1,14 +1,14 @@ -using CalamityMod.CalPlayer; +using System.Collections.Generic; +using System.Linq; +using CalamityMod.CalPlayer; using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System.Collections.Generic; -using System.Linq; using Terraria; using Terraria.DataStructures; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; -using Terraria.GameContent; namespace CalamityMod.Items.Accessories { @@ -25,9 +25,9 @@ namespace CalamityMod.Items.Accessories { Item.width = 34; Item.height = 64; - Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.accessory = true; - Item.rare = ModContent.RarityType(); + Item.rare = ItemRarityID.Lime; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -106,7 +106,7 @@ namespace CalamityMod.Items.Accessories // Mobility stat boosts public const float SpeedMultiplier = 0.5f; // 2.5% to 10% (x100) public const float FlightMultiplier = 1f; // 5% to 20% (x100) - + public override void ModifyTooltips(List list) { float power = CalculatePower(); diff --git a/Items/Accessories/TheEvolution.cs b/Items/Accessories/TheEvolution.cs index f7cae5cd24..7f0dff4b8a 100644 --- a/Items/Accessories/TheEvolution.cs +++ b/Items/Accessories/TheEvolution.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 58; Item.height = 44; - Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); Item.accessory = true; } diff --git a/Items/Accessories/TheFirstShadowflame.cs b/Items/Accessories/TheFirstShadowflame.cs index 1715ac0e4a..9e041957c1 100644 --- a/Items/Accessories/TheFirstShadowflame.cs +++ b/Items/Accessories/TheFirstShadowflame.cs @@ -1,12 +1,12 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.CalPlayer; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; -using Terraria.ModLoader; -using Terraria.ID; -using Microsoft.Xna.Framework.Graphics; -using Microsoft.Xna.Framework; using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 32; Item.height = 48; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.accessory = true; } diff --git a/Items/Accessories/TheSponge.cs b/Items/Accessories/TheSponge.cs index 0c105a0a3d..16fe75addd 100644 --- a/Items/Accessories/TheSponge.cs +++ b/Items/Accessories/TheSponge.cs @@ -1,9 +1,11 @@ using System; +using System.Collections.Generic; using CalamityMod.CalPlayer; using CalamityMod.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; @@ -63,7 +65,6 @@ namespace CalamityMod.Items.Accessories } } - public override void SetStaticDefaults() { Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(5, 30)); @@ -74,7 +75,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 20; Item.height = 20; - Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.accessory = true; Item.rare = ModContent.RarityType(); } @@ -95,6 +96,12 @@ namespace CalamityMod.Items.Accessories // In vanity, provides a visual shield but no actual functionality public override void UpdateVanity(Player player) => player.Calamity().spongeShieldVisible = true; + public override void ModifyTooltips(List tooltips) + { + string adrenTooltip = CalamityWorld.revenge ? this.GetLocalizedValue("ShieldAdren") : ""; + tooltips.FindAndReplace("[ADREN]", adrenTooltip); + } + // Renders the bubble shield over the item in the world. public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { @@ -102,7 +109,7 @@ namespace CalamityMod.Items.Accessories if (Texture == "CalamityMod/Items/Accessories/TheSponge") { Texture2D tex = ModContent.Request("CalamityMod/Items/Accessories/TheSpongeShield").Value; - spriteBatch.Draw(tex, Item.Center - Main.screenPosition + new Vector2(0f, 0f), Main.itemAnimations[Item.type].GetFrame(tex), Color.Cyan * 0.5f, 0f, new Vector2(tex.Width / 2f, (tex.Height / 30f ) * 0.8f), 1f, SpriteEffects.None, 0); + spriteBatch.Draw(tex, Item.Center - Main.screenPosition + new Vector2(0f, 0f), Main.itemAnimations[Item.type].GetFrame(tex), Color.Cyan * 0.5f, 0f, new Vector2(tex.Width / 2f, (tex.Height / 30f) * 0.8f), 1f, SpriteEffects.None, 0); } } diff --git a/Items/Accessories/TheTransformer.cs b/Items/Accessories/TheTransformer.cs index cf26d29d44..d5df8d20d1 100644 --- a/Items/Accessories/TheTransformer.cs +++ b/Items/Accessories/TheTransformer.cs @@ -1,11 +1,11 @@ using CalamityMod.CalPlayer; -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; -using Terraria.DataStructures; -using Terraria.GameContent; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 42; Item.height = 56; - Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; Item.accessory = true; } diff --git a/Items/Accessories/ToxicHeart.cs b/Items/Accessories/ToxicHeart.cs index f93462c333..b5cbd57c43 100644 --- a/Items/Accessories/ToxicHeart.cs +++ b/Items/Accessories/ToxicHeart.cs @@ -1,11 +1,11 @@ using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Projectiles.Typeless; using CalamityMod.CalPlayer; +using CalamityMod.Items.Potions.Alcohol; +using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Terraria; -using Terraria.ModLoader; using Terraria.ID; -using CalamityMod.Items.Potions.Alcohol; +using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 28; Item.height = 32; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; Item.accessory = true; } diff --git a/Items/Accessories/TrinketofChi.cs b/Items/Accessories/TrinketofChi.cs index 72fa81d1c4..aaba2c7446 100644 --- a/Items/Accessories/TrinketofChi.cs +++ b/Items/Accessories/TrinketofChi.cs @@ -1,8 +1,8 @@ -using CalamityMod.CalPlayer; +using CalamityMod.Buffs.StatBuffs; +using CalamityMod.CalPlayer; using Terraria; -using Terraria.ModLoader; using Terraria.ID; -using CalamityMod.Buffs.StatBuffs; +using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 34; Item.height = 32; - Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; Item.accessory = true; } diff --git a/Items/Accessories/UnstableGraniteCore.cs b/Items/Accessories/UnstableGraniteCore.cs index 448d9e0d04..c6c5779487 100644 --- a/Items/Accessories/UnstableGraniteCore.cs +++ b/Items/Accessories/UnstableGraniteCore.cs @@ -1,8 +1,8 @@ using CalamityMod.CalPlayer; using Terraria; -using Terraria.ModLoader; -using Terraria.ID; using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 40; Item.height = 44; - Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; Item.accessory = true; } diff --git a/Items/Accessories/VampiricTalisman.cs b/Items/Accessories/VampiricTalisman.cs index 6f1c62e81e..4f6d09983b 100644 --- a/Items/Accessories/VampiricTalisman.cs +++ b/Items/Accessories/VampiricTalisman.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 86; Item.height = 48; - Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.accessory = true; Item.rare = ItemRarityID.Lime; } diff --git a/Items/Accessories/Vanity/AbandonedWulfrumHelmet.cs b/Items/Accessories/Vanity/AbandonedWulfrumHelmet.cs index 0f997beb35..5e8b8ae18d 100644 --- a/Items/Accessories/Vanity/AbandonedWulfrumHelmet.cs +++ b/Items/Accessories/Vanity/AbandonedWulfrumHelmet.cs @@ -1,9 +1,9 @@ using CalamityMod.CalPlayer; using Terraria; +using Terraria.Audio; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Items.Accessories.Vanity { @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Accessories.Vanity public override void SetStaticDefaults() { - + if (Main.netMode == NetmodeID.Server) return; @@ -54,7 +54,7 @@ namespace CalamityMod.Items.Accessories.Vanity Item.width = 26; Item.height = 30; Item.accessory = true; - Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.rare = ItemRarityID.Green; Item.vanity = true; } diff --git a/Items/Accessories/Vanity/CocosFeather.cs b/Items/Accessories/Vanity/CocosFeather.cs index d19b6eafd7..4e55c0074d 100644 --- a/Items/Accessories/Vanity/CocosFeather.cs +++ b/Items/Accessories/Vanity/CocosFeather.cs @@ -1,11 +1,11 @@ -using CalamityMod.CalPlayer; +using CalamityMod; +using CalamityMod.CalPlayer; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using Microsoft.Xna.Framework; -using CalamityMod; namespace CalamityMod.Items.Accessories.Vanity @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Accessories.Vanity public override void SetStaticDefaults() { - + if (Main.netMode == NetmodeID.Server) return; @@ -45,7 +45,7 @@ namespace CalamityMod.Items.Accessories.Vanity Item.width = 42; Item.height = 38; Item.accessory = true; - Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; Item.vanity = true; Item.Calamity().devItem = true; diff --git a/Items/Accessories/Vanity/CrystalHeartVodka.cs b/Items/Accessories/Vanity/CrystalHeartVodka.cs new file mode 100644 index 0000000000..880b01da73 --- /dev/null +++ b/Items/Accessories/Vanity/CrystalHeartVodka.cs @@ -0,0 +1,86 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Accessories.Vanity +{ + public class CrystalHeartVodka : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Accessories"; + + public override void Load() + { + if (Main.netMode != NetmodeID.Server) + { + EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Fabsol_Head", EquipType.Head, this); + EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Fabsol_Body", EquipType.Body, this); + EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Fabsol_Legs", EquipType.Legs, this); + EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Fabsol_Back", EquipType.Back, this); + } + } + + public override void SetStaticDefaults() + { + if (Main.netMode == NetmodeID.Server) + return; + + int equipSlotHead = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Head); + ArmorIDs.Head.Sets.DrawHead[equipSlotHead] = false; + + int equipSlotBody = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Body); + ArmorIDs.Body.Sets.HidesTopSkin[equipSlotBody] = true; + ArmorIDs.Body.Sets.HidesArms[equipSlotBody] = true; + + int equipSlotLegs = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Legs); + ArmorIDs.Legs.Sets.HidesBottomSkin[equipSlotLegs] = true; + } + + public override void SetDefaults() + { + Item.width = 22; + Item.height = 30; + Item.accessory = true; + + // Same as Fabsol's Vodka, due to the obtainment method being shimmering Fabsol's Vodka. + Item.value = Item.buyPrice(0, 2, 60, 0); + Item.rare = ItemRarityID.LightRed; + + Item.vanity = true; + Item.Calamity().devItem = true; + } + + public override void UpdateVanity(Player player) + { + player.GetModPlayer().vanityEquipped = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + if (!hideVisual) + player.GetModPlayer().vanityEquipped = true; + } + } + + public class CrystalHeartVodkaPlayer : ModPlayer + { + public bool vanityEquipped = false; + + public override void ResetEffects() + { + vanityEquipped = false; + } + + public override void FrameEffects() + { + if (vanityEquipped) + { + Player.back = EquipLoader.GetEquipSlot(Mod, "CrystalHeartVodka", EquipType.Back); + Player.legs = EquipLoader.GetEquipSlot(Mod, "CrystalHeartVodka", EquipType.Legs); + Player.body = EquipLoader.GetEquipSlot(Mod, "CrystalHeartVodka", EquipType.Body); + Player.head = EquipLoader.GetEquipSlot(Mod, "CrystalHeartVodka", EquipType.Head); + + //Player.HideAccessories(); + } + } + } +} diff --git a/Items/Accessories/Vanity/CrystalHeartVodka.png b/Items/Accessories/Vanity/CrystalHeartVodka.png new file mode 100644 index 0000000000..d0faf45977 Binary files /dev/null and b/Items/Accessories/Vanity/CrystalHeartVodka.png differ diff --git a/Items/Accessories/Vanity/Fabsol_Back.png b/Items/Accessories/Vanity/Fabsol_Back.png new file mode 100644 index 0000000000..1563280bdc Binary files /dev/null and b/Items/Accessories/Vanity/Fabsol_Back.png differ diff --git a/Items/Accessories/Vanity/Fabsol_Body.png b/Items/Accessories/Vanity/Fabsol_Body.png new file mode 100644 index 0000000000..d98fdec79c Binary files /dev/null and b/Items/Accessories/Vanity/Fabsol_Body.png differ diff --git a/Items/Accessories/Vanity/Fabsol_Head.png b/Items/Accessories/Vanity/Fabsol_Head.png new file mode 100644 index 0000000000..bf96b48a95 Binary files /dev/null and b/Items/Accessories/Vanity/Fabsol_Head.png differ diff --git a/Items/Accessories/Vanity/Fabsol_Legs.png b/Items/Accessories/Vanity/Fabsol_Legs.png new file mode 100644 index 0000000000..1156798b60 Binary files /dev/null and b/Items/Accessories/Vanity/Fabsol_Legs.png differ diff --git a/Items/Accessories/Vanity/HapuFruit.cs b/Items/Accessories/Vanity/HapuFruit.cs index ab3e54ae9f..30f2a7fefa 100644 --- a/Items/Accessories/Vanity/HapuFruit.cs +++ b/Items/Accessories/Vanity/HapuFruit.cs @@ -1,9 +1,9 @@ using CalamityMod.CalPlayer; using Terraria; +using Terraria.Audio; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Items.Accessories.Vanity { @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Accessories.Vanity public override void SetStaticDefaults() { - + if (Main.netMode == NetmodeID.Server) return; @@ -43,7 +43,7 @@ namespace CalamityMod.Items.Accessories.Vanity Item.width = 22; Item.height = 30; Item.accessory = true; - Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; Item.vanity = true; Item.Calamity().devItem = true; diff --git a/Items/Accessories/Vanity/OracleHeadphones.cs b/Items/Accessories/Vanity/OracleHeadphones.cs index ee34bff70b..b6997d3609 100644 --- a/Items/Accessories/Vanity/OracleHeadphones.cs +++ b/Items/Accessories/Vanity/OracleHeadphones.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Accessories.Vanity public override void SetStaticDefaults() { - + if (Main.netMode == NetmodeID.Server) return; @@ -40,7 +40,7 @@ namespace CalamityMod.Items.Accessories.Vanity Item.width = 22; Item.height = 30; Item.accessory = true; - Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; Item.vanity = true; Item.Calamity().devItem = true; diff --git a/Items/Accessories/Vanity/Popo.cs b/Items/Accessories/Vanity/Popo.cs index dd3101f43c..f78f57563a 100644 --- a/Items/Accessories/Vanity/Popo.cs +++ b/Items/Accessories/Vanity/Popo.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Items.Accessories.Vanity Item.width = 36; Item.height = 44; Item.accessory = true; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.Calamity().devItem = true; } diff --git a/Items/Accessories/Vanity/RedBow.cs b/Items/Accessories/Vanity/RedBow.cs index fb79ae25f4..a336b99bdf 100644 --- a/Items/Accessories/Vanity/RedBow.cs +++ b/Items/Accessories/Vanity/RedBow.cs @@ -4,9 +4,9 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Accessories.Vanity { - public class RedBow : ModItem, ILocalizedModType + public class RedBow : ModItem, ILocalizedModType { - + public new string LocalizationCategory => "Items.Accessories"; public override void Load() { @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Accessories.Vanity public override void SetStaticDefaults() { - + if (Main.netMode == NetmodeID.Server) return; @@ -40,7 +40,7 @@ namespace CalamityMod.Items.Accessories.Vanity Item.width = 22; Item.height = 30; Item.accessory = true; - Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; Item.vanity = true; Item.Calamity().devItem = true; @@ -58,7 +58,7 @@ namespace CalamityMod.Items.Accessories.Vanity player.Calamity().redBow = true; } } - + public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Accessories/VeneratedLocket.cs b/Items/Accessories/VeneratedLocket.cs index 0153e53579..612d021444 100644 --- a/Items/Accessories/VeneratedLocket.cs +++ b/Items/Accessories/VeneratedLocket.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 34; Item.height = 36; - Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.rare = ModContent.RarityType(); Item.accessory = true; } diff --git a/Items/Accessories/VitalJelly.cs b/Items/Accessories/VitalJelly.cs index 53f47b3a40..5c18a64de3 100644 --- a/Items/Accessories/VitalJelly.cs +++ b/Items/Accessories/VitalJelly.cs @@ -1,6 +1,6 @@ using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 18; Item.height = 40; - Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.rare = ItemRarityID.Blue; Item.accessory = true; } diff --git a/Items/Accessories/VoidofCalamity.cs b/Items/Accessories/VoidofCalamity.cs index fcb0250f8c..b9e35b78cb 100644 --- a/Items/Accessories/VoidofCalamity.cs +++ b/Items/Accessories/VoidofCalamity.cs @@ -1,9 +1,9 @@ using CalamityMod.CalPlayer; +using CalamityMod.Items.Potions.Alcohol; using CalamityMod.Projectiles.Typeless; using Terraria; -using Terraria.ModLoader; using Terraria.ID; -using CalamityMod.Items.Potions.Alcohol; +using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 20; Item.height = 22; - Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; Item.accessory = true; } diff --git a/Items/Accessories/VoidofExtinction.cs b/Items/Accessories/VoidofExtinction.cs index e21abda4b0..b892b0268b 100644 --- a/Items/Accessories/VoidofExtinction.cs +++ b/Items/Accessories/VoidofExtinction.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 26; Item.height = 26; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; Item.accessory = true; } diff --git a/Items/Accessories/VoltaicJelly.cs b/Items/Accessories/VoltaicJelly.cs index ce00824566..e341b82c80 100644 --- a/Items/Accessories/VoltaicJelly.cs +++ b/Items/Accessories/VoltaicJelly.cs @@ -1,6 +1,6 @@ using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 20; Item.height = 22; - Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.accessory = true; Item.rare = ItemRarityID.Green; } diff --git a/Items/Accessories/WarbanneroftheSun.cs b/Items/Accessories/WarbanneroftheSun.cs index 793f4ead92..3b16c87ca2 100644 --- a/Items/Accessories/WarbanneroftheSun.cs +++ b/Items/Accessories/WarbanneroftheSun.cs @@ -4,9 +4,9 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; -using Terraria.GameContent; namespace CalamityMod.Items.Accessories { @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 32; Item.height = 78; - Item.value = CalamityGlobalItem.Rarity11BuyPrice; + Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; Item.rare = ItemRarityID.Purple; Item.accessory = true; } diff --git a/Items/Accessories/WifeinaBottle.cs b/Items/Accessories/WifeinaBottle.cs index 7cd28bbe25..7954944e71 100644 --- a/Items/Accessories/WifeinaBottle.cs +++ b/Items/Accessories/WifeinaBottle.cs @@ -1,11 +1,11 @@ using CalamityMod.Buffs.Summon; using CalamityMod.CalPlayer; +using CalamityMod.Items.Potions.Alcohol; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; -using Terraria.ModLoader; using Terraria.ID; -using CalamityMod.Items.Potions.Alcohol; +using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 20; Item.height = 26; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.accessory = true; } diff --git a/Items/Accessories/WifeinaBottlewithBoobs.cs b/Items/Accessories/WifeinaBottlewithBoobs.cs index 5e8968c9e4..40bf02662e 100644 --- a/Items/Accessories/WifeinaBottlewithBoobs.cs +++ b/Items/Accessories/WifeinaBottlewithBoobs.cs @@ -1,11 +1,11 @@ using CalamityMod.Buffs.Summon; using CalamityMod.CalPlayer; -using CalamityMod.Projectiles.Summon; -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; -using Microsoft.Xna.Framework; using CalamityMod.Items.Potions.Alcohol; +using CalamityMod.Projectiles.Summon; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 20; Item.height = 26; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.accessory = true; } diff --git a/Items/Accessories/Wings/AureateBooster.cs b/Items/Accessories/Wings/AureateBooster.cs index 5e659207b6..1207c6432b 100644 --- a/Items/Accessories/Wings/AureateBooster.cs +++ b/Items/Accessories/Wings/AureateBooster.cs @@ -1,11 +1,11 @@ using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using Terraria.DataStructures; namespace CalamityMod.Items.Accessories.Wings { @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Accessories.Wings { Item.width = 54; Item.height = 26; - Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; Item.accessory = true; } diff --git a/Items/Accessories/Wings/DrewsWings.cs b/Items/Accessories/Wings/DrewsWings.cs index cb05b0c66b..30ec3ec6d8 100644 --- a/Items/Accessories/Wings/DrewsWings.cs +++ b/Items/Accessories/Wings/DrewsWings.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Accessories.Wings { Item.width = 22; Item.height = 20; - Item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.rare = ModContent.RarityType(); Item.accessory = true; } @@ -36,7 +36,7 @@ namespace CalamityMod.Items.Accessories.Wings { dustXOffset = -40; } - int flightDust = Dust.NewDust(new Vector2(player.position.X + (float)(player.width / 2) + (float)dustXOffset, player.position.Y + (float)(player.height / 2) - 15f), 30, 30, 91, 0f, 0f, 100, default, 2.4f); + int flightDust = Dust.NewDust(new Vector2(player.position.X + (float)(player.width / 2) + (float)dustXOffset, player.position.Y + (float)(player.height / 2) - 15f), 30, 30, DustID.GemDiamond, 0f, 0f, 100, default, 2.4f); Main.dust[flightDust].noGravity = true; Main.dust[flightDust].velocity *= 0.3f; if (Main.rand.NextBool(10)) diff --git a/Items/Accessories/Wings/ElysianWings.cs b/Items/Accessories/Wings/ElysianWings.cs index f0a92e6256..11f81e5059 100644 --- a/Items/Accessories/Wings/ElysianWings.cs +++ b/Items/Accessories/Wings/ElysianWings.cs @@ -19,9 +19,9 @@ namespace CalamityMod.Items.Accessories.Wings public override void SetDefaults() { - Item.width = 36; - Item.height = 32; - Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.width = 48; + Item.height = 50; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); Item.accessory = true; } diff --git a/Items/Accessories/Wings/ElysianWings.png b/Items/Accessories/Wings/ElysianWings.png index 8cacde9f58..5a00931264 100644 Binary files a/Items/Accessories/Wings/ElysianWings.png and b/Items/Accessories/Wings/ElysianWings.png differ diff --git a/Items/Accessories/Wings/ExodusWings.cs b/Items/Accessories/Wings/ExodusWings.cs index 8f46294655..549f1ae5e8 100644 --- a/Items/Accessories/Wings/ExodusWings.cs +++ b/Items/Accessories/Wings/ExodusWings.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Accessories.Wings { Item.width = 22; Item.height = 20; - Item.value = CalamityGlobalItem.Rarity9BuyPrice; + Item.value = CalamityGlobalItem.RarityCyanBuyPrice; Item.rare = ItemRarityID.Red; Item.accessory = true; } @@ -43,7 +43,7 @@ namespace CalamityMod.Items.Accessories.Wings { xOffset = -40f; } - int index = Dust.NewDust(new Vector2(player.Center.X + xOffset, player.Center.Y - 15f), 30, 30, 62, 0f, 0f, 100, default, 2.4f); + int index = Dust.NewDust(new Vector2(player.Center.X + xOffset, player.Center.Y - 15f), 30, 30, DustID.PurpleTorch, 0f, 0f, 100, default, 2.4f); Main.dust[index].noGravity = true; Main.dust[index].velocity *= 0.3f; if (Main.rand.NextBool(10)) @@ -69,7 +69,7 @@ namespace CalamityMod.Items.Accessories.Wings { CreateRecipe(). AddIngredient(ItemID.SoulofFlight, 20). - AddIngredient(14). + AddIngredient(14). AddIngredient(ItemID.LunarBar, 10). AddTile(TileID.LunarCraftingStation). Register(); diff --git a/Items/Accessories/Wings/HadalMantle.cs b/Items/Accessories/Wings/HadalMantle.cs index a751b2333b..9bcf25930c 100644 --- a/Items/Accessories/Wings/HadalMantle.cs +++ b/Items/Accessories/Wings/HadalMantle.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Accessories.Wings { Item.width = 22; Item.height = 20; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; Item.accessory = true; } @@ -45,7 +45,7 @@ namespace CalamityMod.Items.Accessories.Wings { dustXOffset = -40; } - int flightDust = Dust.NewDust(new Vector2(player.position.X + (float)(player.width / 2) + (float)dustXOffset, player.position.Y + (float)(player.height / 2) - 15f), 30, 30, 6, 0f, 0f, 100, default, 2.4f); + int flightDust = Dust.NewDust(new Vector2(player.position.X + (float)(player.width / 2) + (float)dustXOffset, player.position.Y + (float)(player.height / 2) - 15f), 30, 30, DustID.Torch, 0f, 0f, 100, default, 2.4f); Main.dust[flightDust].noGravity = true; Main.dust[flightDust].velocity *= 0.3f; if (Main.rand.NextBool(10)) diff --git a/Items/Accessories/Wings/HadarianWings.cs b/Items/Accessories/Wings/HadarianWings.cs index f27c478516..8d3ff62629 100644 --- a/Items/Accessories/Wings/HadarianWings.cs +++ b/Items/Accessories/Wings/HadarianWings.cs @@ -1,7 +1,7 @@ -using CalamityMod.Dusts; -using Microsoft.Xna.Framework; -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; using Terraria.Graphics.Shaders; @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Accessories.Wings { Item.width = 24; Item.height = 36; - Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; Item.accessory = true; } diff --git a/Items/Accessories/Wings/MOAB.cs b/Items/Accessories/Wings/MOAB.cs index 4fa0599fa1..694ddaab3b 100644 --- a/Items/Accessories/Wings/MOAB.cs +++ b/Items/Accessories/Wings/MOAB.cs @@ -1,10 +1,10 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using Terraria.DataStructures; namespace CalamityMod.Items.Accessories.Wings { @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Accessories.Wings { Item.width = 28; Item.height = 32; - Item.value = CalamityGlobalItem.Rarity6BuyPrice; + Item.value = CalamityGlobalItem.RarityLightPurpleBuyPrice; Item.rare = ItemRarityID.LightPurple; Item.accessory = true; } @@ -89,7 +89,7 @@ namespace CalamityMod.Items.Accessories.Wings player.jumpBoost = true; player.autoJump = true; player.noFallDmg = true; - player.jumpSpeedBoost += 0.5f; + player.jumpSpeedBoost += 1.6f; player.luck += 0.05f; } diff --git a/Items/Accessories/Wings/SilvaWings.cs b/Items/Accessories/Wings/SilvaWings.cs index 0b24869c64..b00db4d361 100644 --- a/Items/Accessories/Wings/SilvaWings.cs +++ b/Items/Accessories/Wings/SilvaWings.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Accessories.Wings { Item.width = 22; Item.height = 20; - Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.rare = ModContent.RarityType(); Item.accessory = true; } @@ -46,7 +46,7 @@ namespace CalamityMod.Items.Accessories.Wings { dustXOffset = -40; } - int flightDust = Dust.NewDust(new Vector2(player.position.X + (float)(player.width / 2) + (float)dustXOffset, player.position.Y + (float)(player.height / 2) - 15f), 30, 30, 157, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f); + int flightDust = Dust.NewDust(new Vector2(player.position.X + (float)(player.width / 2) + (float)dustXOffset, player.position.Y + (float)(player.height / 2) - 15f), 30, 30, DustID.ChlorophyteWeapon, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f); Main.dust[flightDust].noGravity = true; Main.dust[flightDust].velocity *= 0.3f; if (Main.rand.NextBool(10)) diff --git a/Items/Accessories/Wings/SkylineWings.cs b/Items/Accessories/Wings/SkylineWings.cs index c46b662d53..58ab67d809 100644 --- a/Items/Accessories/Wings/SkylineWings.cs +++ b/Items/Accessories/Wings/SkylineWings.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Accessories.Wings { Item.width = 22; Item.height = 20; - Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; Item.accessory = true; } diff --git a/Items/Accessories/Wings/SoulofCryogen.cs b/Items/Accessories/Wings/SoulofCryogen.cs index 6138988d28..cfc3f82932 100644 --- a/Items/Accessories/Wings/SoulofCryogen.cs +++ b/Items/Accessories/Wings/SoulofCryogen.cs @@ -1,13 +1,13 @@ using CalamityMod.CalPlayer; +using CalamityMod.Items.Potions.Alcohol; using CalamityMod.Projectiles.Rogue; -using Terraria; -using Terraria.DataStructures; -using Terraria.ModLoader; -using Terraria.ID; -using Terraria.GameContent; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using CalamityMod.Items.Potions.Alcohol; +using Terraria; +using Terraria.DataStructures; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Accessories.Wings { @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Accessories.Wings { Item.width = 26; Item.height = 26; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.accessory = true; } @@ -59,7 +59,7 @@ namespace CalamityMod.Items.Accessories.Wings if (player.controlJump && player.jump == 0 && player.velocity.Y != 0f && !player.mount.Active && !player.mount.Cart) { var source = player.GetSource_Accessory(Item); - int damage = (int)player.GetBestClassDamage().ApplyTo(25); + int damage = (int)player.GetBestClassDamage().ApplyTo(32); damage = player.ApplyArmorAccDamageBonusesTo(damage); int p = Projectile.NewProjectile(source, player.Center.X, player.Center.Y, player.velocity.X * 0f, 2f, ModContent.ProjectileType(), damage, 3f, player.whoAmI, 1f); @@ -68,7 +68,7 @@ namespace CalamityMod.Items.Accessories.Wings Main.projectile[p].DamageType = DamageClass.Generic; Main.projectile[p].frame = Main.rand.Next(5); } - modPlayer.icicleCooldown = 10; + modPlayer.icicleCooldown = 7; } } } diff --git a/Items/Accessories/Wings/StarlightWings.cs b/Items/Accessories/Wings/StarlightWings.cs index 1f05487c5a..f80f8c7a98 100644 --- a/Items/Accessories/Wings/StarlightWings.cs +++ b/Items/Accessories/Wings/StarlightWings.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Accessories.Wings { Item.width = 22; Item.height = 20; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.accessory = true; } @@ -45,7 +45,7 @@ namespace CalamityMod.Items.Accessories.Wings { dustXOffset = -40; } - int flightDust = Dust.NewDust(new Vector2(player.position.X + (float)(player.width / 2) + (float)dustXOffset, player.position.Y + (float)(player.height / 2) - 15f), 30, 30, 173, 0f, 0f, 100, default, 2.4f); + int flightDust = Dust.NewDust(new Vector2(player.position.X + (float)(player.width / 2) + (float)dustXOffset, player.position.Y + (float)(player.height / 2) - 15f), 30, 30, DustID.ShadowbeamStaff, 0f, 0f, 100, default, 2.4f); Main.dust[flightDust].noGravity = true; Main.dust[flightDust].velocity *= 0.3f; if (Main.rand.NextBool(10)) diff --git a/Items/Accessories/Wings/TarragonWings.cs b/Items/Accessories/Wings/TarragonWings.cs index b64b5c2d6e..e30e73c6bd 100644 --- a/Items/Accessories/Wings/TarragonWings.cs +++ b/Items/Accessories/Wings/TarragonWings.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Accessories.Wings { Item.width = 22; Item.height = 20; - Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); Item.accessory = true; } @@ -48,7 +48,7 @@ namespace CalamityMod.Items.Accessories.Wings { dustXOffset = -40; } - int flightDust = Dust.NewDust(new Vector2(player.position.X + (float)(player.width / 2) + (float)dustXOffset, player.position.Y + (float)(player.height / 2) - 15f), 30, 30, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default, 2.4f); + int flightDust = Dust.NewDust(new Vector2(player.position.X + (float)(player.width / 2) + (float)dustXOffset, player.position.Y + (float)(player.height / 2) - 15f), 30, 30, (int)CalamityDusts.SulphurousSeaAcid, 0f, 0f, 100, default, 2.4f); Main.dust[flightDust].noGravity = true; Main.dust[flightDust].velocity *= 0.3f; if (Main.rand.NextBool(10)) diff --git a/Items/Accessories/Wings/TracersCelestial.cs b/Items/Accessories/Wings/TracersCelestial.cs index c40e9d5f4a..5ff8fee788 100644 --- a/Items/Accessories/Wings/TracersCelestial.cs +++ b/Items/Accessories/Wings/TracersCelestial.cs @@ -3,10 +3,10 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; +using Terraria.GameContent; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; -using Terraria.GameContent; namespace CalamityMod.Items.Accessories.Wings { @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Accessories.Wings { Item.width = 36; Item.height = 32; - Item.value = CalamityGlobalItem.Rarity10BuyPrice; + Item.value = CalamityGlobalItem.RarityRedBuyPrice; Item.rare = ItemRarityID.Red; Item.accessory = true; } @@ -39,7 +39,7 @@ namespace CalamityMod.Items.Accessories.Wings { dustXOffset = -40; } - int flightDust = Dust.NewDust(new Vector2(player.position.X + (float)(player.width / 2) + (float)dustXOffset, player.position.Y + (float)(player.height / 2) - 15f), 30, 30, 107, 0f, 0f, 100, default, 2.4f); + int flightDust = Dust.NewDust(new Vector2(player.position.X + (float)(player.width / 2) + (float)dustXOffset, player.position.Y + (float)(player.height / 2) - 15f), 30, 30, DustID.TerraBlade, 0f, 0f, 100, default, 2.4f); Main.dust[flightDust].noGravity = true; Main.dust[flightDust].velocity *= 0.3f; if (Main.rand.NextBool(10)) diff --git a/Items/Accessories/Wings/TracersElysian.cs b/Items/Accessories/Wings/TracersElysian.cs index bf270f6390..41740f0d71 100644 --- a/Items/Accessories/Wings/TracersElysian.cs +++ b/Items/Accessories/Wings/TracersElysian.cs @@ -5,11 +5,11 @@ using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.DataStructures; +using Terraria.GameContent; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; -using Terraria.DataStructures; -using Terraria.GameContent; namespace CalamityMod.Items.Accessories.Wings { @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Accessories.Wings { Item.width = 36; Item.height = 32; - Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.accessory = true; Item.rare = ModContent.RarityType(); } diff --git a/Items/Accessories/Wings/TracersSeraph.cs b/Items/Accessories/Wings/TracersSeraph.cs index 55063ce270..21303ea750 100644 --- a/Items/Accessories/Wings/TracersSeraph.cs +++ b/Items/Accessories/Wings/TracersSeraph.cs @@ -6,10 +6,10 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; +using Terraria.GameContent; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; -using Terraria.GameContent; namespace CalamityMod.Items.Accessories.Wings { @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Accessories.Wings { Item.width = 36; Item.height = 32; - Item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.accessory = true; Item.rare = ModContent.RarityType(); } @@ -42,7 +42,7 @@ namespace CalamityMod.Items.Accessories.Wings { dustXOffset = -40; } - int flightDust = Dust.NewDust(new Vector2(player.position.X + (float)(player.width / 2) + (float)dustXOffset, player.position.Y + (float)(player.height / 2) - 15f), 30, 30, 91, 0f, 0f, 100, default, 2.4f); + int flightDust = Dust.NewDust(new Vector2(player.position.X + (float)(player.width / 2) + (float)dustXOffset, player.position.Y + (float)(player.height / 2) - 15f), 30, 30, DustID.GemDiamond, 0f, 0f, 100, default, 2.4f); Main.dust[flightDust].noGravity = true; Main.dust[flightDust].velocity *= 0.3f; if (Main.rand.NextBool(10)) @@ -62,7 +62,7 @@ namespace CalamityMod.Items.Accessories.Wings player.noFallDmg = true; modPlayer.tracersDust = !hideVisual; modPlayer.elysianWingsDust = !hideVisual; - modPlayer.tracersSeraph = true; + modPlayer.tracersSeraph = true; // Grants immunity to Auric Rejection and other walk-on-block effects } public override void VerticalWingSpeeds(Player player, ref float ascentWhenFalling, ref float ascentWhenRising, ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend) diff --git a/Items/Accessories/WulfrumAcrobaticsPack.cs b/Items/Accessories/WulfrumAcrobaticsPack.cs index c25f090ead..0558fdda00 100644 --- a/Items/Accessories/WulfrumAcrobaticsPack.cs +++ b/Items/Accessories/WulfrumAcrobaticsPack.cs @@ -1,11 +1,11 @@ -using CalamityMod.DataStructures; +using System; +using System.Collections.Generic; +using System.Linq; +using CalamityMod.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Typeless; using CalamityMod.Sounds; using Microsoft.Xna.Framework; -using System; -using System.Collections.Generic; -using System.Linq; using Terraria; using Terraria.Audio; using Terraria.DataStructures; @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Accessories public class WulfrumAcrobaticsPack : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; - public static readonly SoundStyle ShootSound = new("CalamityMod/Sounds/Custom/WulfrumHookShoot") { Volume = 0.7f, MaxInstances = 1, SoundLimitBehavior = SoundLimitBehavior.ReplaceOldest}; + public static readonly SoundStyle ShootSound = new("CalamityMod/Sounds/Custom/WulfrumHookShoot") { Volume = 0.7f, MaxInstances = 1, SoundLimitBehavior = SoundLimitBehavior.ReplaceOldest }; public static readonly SoundStyle GrabSound = new("CalamityMod/Sounds/Custom/WulfrumHookGrapple") { Volume = 0.7f, MaxInstances = 1, SoundLimitBehavior = SoundLimitBehavior.ReplaceOldest }; public static readonly SoundStyle ReleaseSound = new("CalamityMod/Sounds/Custom/WulfrumHookDisengage") { Volume = 0.7f, MaxInstances = 1, SoundLimitBehavior = SoundLimitBehavior.ReplaceOldest }; @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 20; Item.height = 22; - Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.accessory = true; Item.rare = ItemRarityID.Blue; } @@ -40,7 +40,7 @@ namespace CalamityMod.Items.Accessories player.GetModPlayer().WulfrumPackEquipped = true; player.GetModPlayer().PackItem = Item; - Lighting.AddLight(player.Center, Color.Lerp(Color.DeepSkyBlue,Color.GreenYellow, (float)Math.Sin( Main.GlobalTimeWrappedHourly * 2f) * 0.5f + 0.5f).ToVector3()); + Lighting.AddLight(player.Center, Color.Lerp(Color.DeepSkyBlue, Color.GreenYellow, (float)Math.Sin(Main.GlobalTimeWrappedHourly * 2f) * 0.5f + 0.5f).ToVector3()); } public override void AddRecipes() @@ -155,7 +155,7 @@ namespace CalamityMod.Items.Accessories public static float SafetyHookAngle = MathHelper.PiOver2 * 1.2f; public static float SafetyHookAngleResolution = 50f; - public bool PlayerOnGround => Collision.SolidCollision(Player.position + Vector2.UnitY* 2f * Player.gravDir, Player.width, Player.height, false); + public bool PlayerOnGround => Collision.SolidCollision(Player.position + Vector2.UnitY * 2f * Player.gravDir, Player.width, Player.height, false); public override void ResetEffects() { @@ -341,7 +341,7 @@ namespace CalamityMod.Items.Accessories for (float angle = -halfSpread; angle < halfSpread; angle += SafetyHookAngle / SafetyHookAngleResolution) { - for (int i = 0; i < (int)(WulfrumHook.MaxReach / 16f); i++ ) + for (int i = 0; i < (int)(WulfrumHook.MaxReach / 16f); i++) { Vector2 checkSpot = Player.Center + (-Vector2.UnitY * Player.gravDir * i * 16f).RotatedBy(angle); Point tilePos = checkSpot.ToSafeTileCoordinates(); @@ -456,7 +456,7 @@ namespace CalamityMod.Items.Accessories float angleToUpright = (Player.Center - p.Center).AngleBetween(-Vector2.UnitY); bool canJumpOffHook = angleToUpright > MathHelper.PiOver2 || Player.Distance(p.Center) < 38;// Don't do any jump stuff if the player is jumping from above the hook. - if (canJumpOffHook) + if (canJumpOffHook) { Vector2 velocityBoost = Vector2.Zero; diff --git a/Items/Accessories/WulfrumBattery.cs b/Items/Accessories/WulfrumBattery.cs index 178922a042..ea1aaca730 100644 --- a/Items/Accessories/WulfrumBattery.cs +++ b/Items/Accessories/WulfrumBattery.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Accessories public override void SetStaticDefaults() { - + ItemID.Sets.ExtractinatorMode[Item.type] = Item.type; } @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 20; Item.height = 22; - Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.accessory = true; Item.rare = ItemRarityID.Blue; diff --git a/Items/Accessories/YharimsGift.cs b/Items/Accessories/YharimsGift.cs index 196026a136..6f5cc3c2e9 100644 --- a/Items/Accessories/YharimsGift.cs +++ b/Items/Accessories/YharimsGift.cs @@ -1,11 +1,11 @@ -using CalamityMod.Projectiles.Typeless; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Potions.Alcohol; +using CalamityMod.Projectiles.Typeless; using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; -using Terraria.ModLoader; using Terraria.ID; -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Items.Potions.Alcohol; +using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { @@ -16,11 +16,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - Item.defense = 30; Item.width = 20; Item.height = 22; + Item.defense = 30; Item.accessory = true; - Item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.rare = ModContent.RarityType(); } diff --git a/Items/AlicornonaStick.png b/Items/AlicornonaStick.png index 53356027c2..b09e99c934 100644 Binary files a/Items/AlicornonaStick.png and b/Items/AlicornonaStick.png differ diff --git a/Items/Ammo/AccelerationRound.cs b/Items/Ammo/AccelerationRound.cs deleted file mode 100644 index 7d95498944..0000000000 --- a/Items/Ammo/AccelerationRound.cs +++ /dev/null @@ -1,43 +0,0 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Ranged; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Ammo -{ - [LegacyName("AccelerationBullet")] - public class AccelerationRound : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Ammo"; - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 99; - } - - public override void SetDefaults() - { - Item.damage = 10; - Item.DamageType = DamageClass.Ranged; - Item.width = 10; - Item.height = 16; - Item.maxStack = 9999; - Item.consumable = true; - Item.knockBack = 1.25f; - Item.value = Item.sellPrice(copper: 2); - Item.rare = ItemRarityID.Green; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 1f; - Item.ammo = AmmoID.Bullet; - } - - public override void AddRecipes() - { - CreateRecipe(150). - AddIngredient(ItemID.MusketBall, 150). - AddIngredient(). - AddTile(TileID.Anvils). - Register(); - } - } -} diff --git a/Items/Ammo/AccelerationRound.png b/Items/Ammo/AccelerationRound.png deleted file mode 100644 index c2c6a926ad..0000000000 Binary files a/Items/Ammo/AccelerationRound.png and /dev/null differ diff --git a/Items/Ammo/ArcticArrow.png b/Items/Ammo/ArcticArrow.png deleted file mode 100644 index 5fcacaa5de..0000000000 Binary files a/Items/Ammo/ArcticArrow.png and /dev/null differ diff --git a/Items/Ammo/AstralSolution.cs b/Items/Ammo/AstralSolution.cs index fd60fa75a0..d45fe7c8d1 100644 --- a/Items/Ammo/AstralSolution.cs +++ b/Items/Ammo/AstralSolution.cs @@ -11,15 +11,15 @@ namespace CalamityMod.Items.Ammo public override void SetStaticDefaults() { Item.ResearchUnlockCount = 99; - ItemID.Sets.SortingPriorityTerraforming[Type] = 95; // Red Solution + ItemID.Sets.SortingPriorityTerraforming[Type] = 95; // Red Solution } public override void SetDefaults() { - Item.ammo = AmmoID.Solution; - Item.shoot = ModContent.ProjectileType() - ProjectileID.PureSpray; Item.width = 10; Item.height = 12; + Item.ammo = AmmoID.Solution; + Item.shoot = ModContent.ProjectileType() - ProjectileID.PureSpray; Item.value = Item.buyPrice(silver: 15); Item.rare = ItemRarityID.Orange; Item.maxStack = 9999; @@ -27,10 +27,10 @@ namespace CalamityMod.Items.Ammo return; } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.Solutions; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.Solutions; + } public override bool CanConsumeAmmo(Item ammo, Player player) { diff --git a/Items/Ammo/BloodRune.cs b/Items/Ammo/BloodRune.cs index c75549b116..d6e658a5d1 100644 --- a/Items/Ammo/BloodRune.cs +++ b/Items/Ammo/BloodRune.cs @@ -11,13 +11,13 @@ namespace CalamityMod.Items.Ammo public override void SetStaticDefaults() { Item.ResearchUnlockCount = 99; - } + } public override void SetDefaults() { - Item.damage = 1; Item.width = 22; Item.height = 24; + Item.damage = 1; Item.maxStack = 9999; Item.consumable = true; Item.knockBack = 10f; diff --git a/Items/Ammo/BloodfireArrow.cs b/Items/Ammo/BloodfireArrow.cs index 28f4609606..c91cf6a8a8 100644 --- a/Items/Ammo/BloodfireArrow.cs +++ b/Items/Ammo/BloodfireArrow.cs @@ -17,10 +17,10 @@ namespace CalamityMod.Items.Ammo public override void SetDefaults() { - Item.damage = 29; - Item.DamageType = DamageClass.Ranged; Item.width = 14; Item.height = 36; + Item.damage = 30; + Item.DamageType = DamageClass.Ranged; Item.maxStack = 9999; Item.consumable = true; Item.knockBack = 3.5f; diff --git a/Items/Ammo/BloodfireBullet.cs b/Items/Ammo/BloodfireBullet.cs index c9f22aa10b..0bc134e56f 100644 --- a/Items/Ammo/BloodfireBullet.cs +++ b/Items/Ammo/BloodfireBullet.cs @@ -17,17 +17,17 @@ namespace CalamityMod.Items.Ammo public override void SetDefaults() { - Item.damage = 26; - Item.DamageType = DamageClass.Ranged; Item.width = 14; Item.height = 30; + Item.damage = 27; + Item.DamageType = DamageClass.Ranged; Item.maxStack = 9999; Item.consumable = true; Item.knockBack = 4.5f; Item.value = Item.sellPrice(copper: 24); Item.rare = ModContent.RarityType(); Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 4.8f; + Item.shootSpeed = 0.1f; Item.ammo = ItemID.MusketBall; } diff --git a/Items/Ammo/BubonicRound.cs b/Items/Ammo/BubonicRound.cs index de2def4611..d9953922fc 100644 --- a/Items/Ammo/BubonicRound.cs +++ b/Items/Ammo/BubonicRound.cs @@ -14,10 +14,10 @@ namespace CalamityMod.Items.Ammo public override void SetDefaults() { - Item.damage = 20; - Item.DamageType = DamageClass.Ranged; Item.width = 8; Item.height = 8; + Item.damage = 16; + Item.DamageType = DamageClass.Ranged; Item.maxStack = 9999; Item.consumable = true; Item.knockBack = 1.5f; diff --git a/Items/Ammo/ArcticArrow.cs b/Items/Ammo/CinderArrow.cs similarity index 73% rename from Items/Ammo/ArcticArrow.cs rename to Items/Ammo/CinderArrow.cs index fc6bf5e2de..ffe4a68740 100644 --- a/Items/Ammo/ArcticArrow.cs +++ b/Items/Ammo/CinderArrow.cs @@ -6,7 +6,8 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Ammo { - public class ArcticArrow : ModItem, ILocalizedModType + [LegacyName("NapalmArrow")] + public class CinderArrow : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Ammo"; public override void SetStaticDefaults() @@ -16,16 +17,16 @@ namespace CalamityMod.Items.Ammo public override void SetDefaults() { - Item.damage = 18; - Item.DamageType = DamageClass.Ranged; Item.width = 22; Item.height = 36; + Item.damage = 12; + Item.DamageType = DamageClass.Ranged; Item.maxStack = 9999; Item.consumable = true; Item.knockBack = 1.5f; Item.value = Item.sellPrice(copper: 12); Item.rare = ItemRarityID.Pink; - Item.shoot = ModContent.ProjectileType(); + Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 13f; Item.ammo = AmmoID.Arrow; } @@ -33,8 +34,9 @@ namespace CalamityMod.Items.Ammo public override void AddRecipes() { CreateRecipe(250). - AddIngredient(). - AddTile(TileID.IceMachine). + AddIngredient(ItemID.HellfireArrow, 250). + AddIngredient(). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Ammo/CinderArrow.png b/Items/Ammo/CinderArrow.png new file mode 100644 index 0000000000..e7775584ab Binary files /dev/null and b/Items/Ammo/CinderArrow.png differ diff --git a/Items/Ammo/TerraBullet.cs b/Items/Ammo/DryadsTear.cs similarity index 82% rename from Items/Ammo/TerraBullet.cs rename to Items/Ammo/DryadsTear.cs index 17e769941d..657029031b 100644 --- a/Items/Ammo/TerraBullet.cs +++ b/Items/Ammo/DryadsTear.cs @@ -6,7 +6,8 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Ammo { - public class TerraBullet : ModItem, ILocalizedModType + [LegacyName("TerraBullet")] + public class DryadsTear : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Ammo"; public override void SetStaticDefaults() @@ -16,17 +17,17 @@ namespace CalamityMod.Items.Ammo public override void SetDefaults() { - Item.damage = 9; - Item.DamageType = DamageClass.Ranged; Item.width = 8; Item.height = 8; + Item.damage = 8; + Item.DamageType = DamageClass.Ranged; Item.maxStack = 9999; Item.consumable = true; Item.knockBack = 1.25f; Item.value = Item.sellPrice(copper: 16); Item.rare = ItemRarityID.Lime; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 10f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 2f; Item.ammo = AmmoID.Bullet; } diff --git a/Items/Ammo/DryadsTear.png b/Items/Ammo/DryadsTear.png new file mode 100644 index 0000000000..05f96745e8 Binary files /dev/null and b/Items/Ammo/DryadsTear.png differ diff --git a/Items/Ammo/ElysianArrow.cs b/Items/Ammo/ElysianArrow.cs index eef5249bcc..bb2d94cce2 100644 --- a/Items/Ammo/ElysianArrow.cs +++ b/Items/Ammo/ElysianArrow.cs @@ -16,10 +16,10 @@ namespace CalamityMod.Items.Ammo public override void SetDefaults() { - Item.damage = 20; - Item.DamageType = DamageClass.Ranged; Item.width = 22; Item.height = 36; + Item.damage = 17; + Item.DamageType = DamageClass.Ranged; Item.maxStack = 9999; Item.consumable = true; Item.knockBack = 3f; diff --git a/Items/Ammo/ElysianArrow.png b/Items/Ammo/ElysianArrow.png index e0936c2556..a724665e76 100644 Binary files a/Items/Ammo/ElysianArrow.png and b/Items/Ammo/ElysianArrow.png differ diff --git a/Items/Ammo/EnhancedNanoRound.png b/Items/Ammo/EnhancedNanoRound.png deleted file mode 100644 index 5360301646..0000000000 Binary files a/Items/Ammo/EnhancedNanoRound.png and /dev/null differ diff --git a/Items/Ammo/FlashRound.cs b/Items/Ammo/FlashRound.cs index e2911f64da..7dded9c0da 100644 --- a/Items/Ammo/FlashRound.cs +++ b/Items/Ammo/FlashRound.cs @@ -16,10 +16,10 @@ namespace CalamityMod.Items.Ammo public override void SetDefaults() { - Item.damage = 5; - Item.DamageType = DamageClass.Ranged; Item.width = 12; Item.height = 18; + Item.damage = 5; + Item.DamageType = DamageClass.Ranged; Item.maxStack = 9999; Item.consumable = true; Item.knockBack = 1.15f; diff --git a/Items/Ammo/GodSlayerSlug.cs b/Items/Ammo/GodSlayerSlug.cs index f02ab07af8..dbf30390f4 100644 --- a/Items/Ammo/GodSlayerSlug.cs +++ b/Items/Ammo/GodSlayerSlug.cs @@ -14,14 +14,14 @@ namespace CalamityMod.Items.Ammo public override void SetStaticDefaults() { Item.ResearchUnlockCount = 99; - } + } public override void SetDefaults() { - Item.damage = 28; - Item.DamageType = DamageClass.Ranged; Item.width = 22; Item.height = 22; + Item.damage = 28; + Item.DamageType = DamageClass.Ranged; Item.maxStack = 9999; Item.consumable = true; Item.knockBack = 3f; diff --git a/Items/Ammo/IcyBullet.cs b/Items/Ammo/HailstormBullet.cs similarity index 71% rename from Items/Ammo/IcyBullet.cs rename to Items/Ammo/HailstormBullet.cs index 56a6be49a7..0c36e71d85 100644 --- a/Items/Ammo/IcyBullet.cs +++ b/Items/Ammo/HailstormBullet.cs @@ -5,7 +5,8 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Ammo { - public class IcyBullet : ModItem, ILocalizedModType + [LegacyName("IcyBullet")] + public class HailstormBullet : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Ammo"; public override void SetStaticDefaults() @@ -14,16 +15,16 @@ namespace CalamityMod.Items.Ammo } public override void SetDefaults() { - Item.damage = 10; - Item.DamageType = DamageClass.Ranged; - Item.consumable = true; Item.width = 14; Item.height = 20; + Item.damage = 12; + Item.DamageType = DamageClass.Ranged; + Item.consumable = true; Item.knockBack = 2f; Item.value = Item.buyPrice(0, 0, 0, 80); - Item.rare = ItemRarityID.LightPurple; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 5f; + Item.rare = ItemRarityID.Yellow; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 0.3f; Item.ammo = AmmoID.Bullet; Item.maxStack = 9999; } diff --git a/Items/Ammo/IcyBullet.png b/Items/Ammo/HailstormBullet.png similarity index 100% rename from Items/Ammo/IcyBullet.png rename to Items/Ammo/HailstormBullet.png diff --git a/Items/Ammo/EnhancedNanoRound.cs b/Items/Ammo/HallowPointRound.cs similarity index 50% rename from Items/Ammo/EnhancedNanoRound.cs rename to Items/Ammo/HallowPointRound.cs index 0d1fb2e7a9..56d140b143 100644 --- a/Items/Ammo/EnhancedNanoRound.cs +++ b/Items/Ammo/HallowPointRound.cs @@ -1,14 +1,17 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Ranged; +using CalamityMod.Projectiles.Ranged; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Ammo { - public class EnhancedNanoRound : ModItem, ILocalizedModType + public class HallowPointRound : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Ammo"; + + public static int BaseDamage = 12; + public static int BonusDamageOnHit = 6; // 12 + 6 = 18 + public override void SetStaticDefaults() { Item.ResearchUnlockCount = 99; @@ -16,25 +19,25 @@ namespace CalamityMod.Items.Ammo public override void SetDefaults() { - Item.damage = 12; - Item.DamageType = DamageClass.Ranged; Item.width = 8; - Item.height = 8; + Item.height = 18; + Item.damage = BaseDamage; + Item.DamageType = DamageClass.Ranged; Item.maxStack = 9999; Item.consumable = true; - Item.knockBack = 5.5f; - Item.value = Item.sellPrice(copper: 16); - Item.rare = ItemRarityID.Lime; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 8f; + Item.knockBack = 3f; + Item.value = Item.sellPrice(copper: 12); + Item.rare = ItemRarityID.Pink; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 6f; Item.ammo = AmmoID.Bullet; } public override void AddRecipes() { - CreateRecipe(250). - AddIngredient(ItemID.NanoBullet, 250). - AddIngredient(). + CreateRecipe(100). + AddIngredient(ItemID.EmptyBullet, 100). + AddIngredient(ItemID.HallowedBar). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Ammo/HallowPointRound.png b/Items/Ammo/HallowPointRound.png new file mode 100644 index 0000000000..9a7162fe95 Binary files /dev/null and b/Items/Ammo/HallowPointRound.png differ diff --git a/Items/Ammo/HolyFireBullet.cs b/Items/Ammo/HolyFireBullet.cs index f6de63be57..9135150910 100644 --- a/Items/Ammo/HolyFireBullet.cs +++ b/Items/Ammo/HolyFireBullet.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -10,7 +11,7 @@ namespace CalamityMod.Items.Ammo { public new string LocalizationCategory => "Items.Ammo"; internal const float ExplosionMultiplier = 0.33f; - + public static readonly SoundStyle Explosion = new("CalamityMod/Sounds/Item/HolyFireBulletExplosion") { PitchVariance = 0.2f, Volume = 0.6f }; public override void SetStaticDefaults() { Item.ResearchUnlockCount = 99; @@ -18,17 +19,17 @@ namespace CalamityMod.Items.Ammo public override void SetDefaults() { - Item.damage = 22; - Item.DamageType = DamageClass.Ranged; Item.width = 22; Item.height = 22; + Item.damage = 22; + Item.DamageType = DamageClass.Ranged; Item.maxStack = 9999; Item.consumable = true; Item.knockBack = 2f; Item.value = Item.sellPrice(copper: 24); Item.rare = ItemRarityID.Purple; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 6f; + Item.shootSpeed = 1f; Item.ammo = AmmoID.Bullet; } diff --git a/Items/Ammo/HyperiusBullet.cs b/Items/Ammo/HyperiusBullet.cs index b9b5329f6b..39653cceb2 100644 --- a/Items/Ammo/HyperiusBullet.cs +++ b/Items/Ammo/HyperiusBullet.cs @@ -9,6 +9,9 @@ namespace CalamityMod.Items.Ammo public class HyperiusBullet : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Ammo"; + + public static int SplitBulletBonusDamage = 10; + public override void SetStaticDefaults() { Item.ResearchUnlockCount = 99; @@ -16,17 +19,17 @@ namespace CalamityMod.Items.Ammo public override void SetDefaults() { - Item.damage = 18; - Item.DamageType = DamageClass.Ranged; Item.width = 24; Item.height = 30; + Item.damage = 13; + Item.DamageType = DamageClass.Ranged; Item.maxStack = 9999; Item.consumable = true; Item.knockBack = 1.5f; Item.value = Item.sellPrice(copper: 16); - Item.rare = ItemRarityID.Cyan; + Item.rare = ItemRarityID.Yellow; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 16f; + Item.shootSpeed = 5f; Item.ammo = AmmoID.Bullet; } diff --git a/Items/Ammo/IcicleArrow.cs b/Items/Ammo/IcicleArrow.cs index 5deab0d326..17f271b6b4 100644 --- a/Items/Ammo/IcicleArrow.cs +++ b/Items/Ammo/IcicleArrow.cs @@ -15,16 +15,16 @@ namespace CalamityMod.Items.Ammo public override void SetDefaults() { - Item.damage = 15; - Item.DamageType = DamageClass.Ranged; - Item.consumable = true; Item.width = 18; Item.height = 50; + Item.damage = 6; + Item.DamageType = DamageClass.Ranged; + Item.consumable = true; Item.knockBack = 2.5f; Item.value = Item.buyPrice(0, 0, 0, 80); - Item.rare = ItemRarityID.LightPurple; + Item.rare = ItemRarityID.Yellow; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 1.0f; + Item.shootSpeed = 0.2f; Item.ammo = AmmoID.Arrow; Item.maxStack = 9999; } diff --git a/Items/Ammo/MarksmanRound.cs b/Items/Ammo/MarksmanRound.cs index c69885685c..40ddb78f95 100644 --- a/Items/Ammo/MarksmanRound.cs +++ b/Items/Ammo/MarksmanRound.cs @@ -11,14 +11,14 @@ namespace CalamityMod.Items.Ammo public override void SetStaticDefaults() { Item.ResearchUnlockCount = 99; - } + } public override void SetDefaults() { - Item.damage = 12; - Item.DamageType = DamageClass.Ranged; Item.width = 12; Item.height = 26; + Item.damage = 12; + Item.DamageType = DamageClass.Ranged; Item.maxStack = 9999; Item.consumable = true; Item.knockBack = 2.25f; diff --git a/Items/Ammo/MortarRound.cs b/Items/Ammo/MortarRound.cs index b4d74f867d..e9892bf3af 100644 --- a/Items/Ammo/MortarRound.cs +++ b/Items/Ammo/MortarRound.cs @@ -18,10 +18,10 @@ namespace CalamityMod.Items.Ammo public override void SetDefaults() { - Item.damage = 20; - Item.DamageType = DamageClass.Ranged; Item.width = 20; Item.height = 14; + Item.damage = 20; + Item.DamageType = DamageClass.Ranged; Item.maxStack = 9999; Item.consumable = true; Item.knockBack = 7f; diff --git a/Items/Ammo/NapalmArrow.cs b/Items/Ammo/NapalmArrow.cs deleted file mode 100644 index a690854d7e..0000000000 --- a/Items/Ammo/NapalmArrow.cs +++ /dev/null @@ -1,43 +0,0 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Ranged; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Ammo -{ - public class NapalmArrow : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Ammo"; - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 99; - } - - public override void SetDefaults() - { - Item.damage = 11; - Item.DamageType = DamageClass.Ranged; - Item.width = 22; - Item.height = 36; - Item.maxStack = 9999; - Item.consumable = true; - Item.knockBack = 1.5f; - Item.value = Item.sellPrice(copper: 12); - Item.rare = ItemRarityID.LightRed; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 13f; - Item.ammo = AmmoID.Arrow; - } - - public override void AddRecipes() - { - CreateRecipe(250). - AddIngredient(ItemID.WoodenArrow, 250). - AddIngredient(). - AddIngredient(ItemID.Torch). - AddTile(TileID.Anvils). - Register(); - } - } -} diff --git a/Items/Ammo/NapalmArrow.png b/Items/Ammo/NapalmArrow.png deleted file mode 100644 index 48ef48d4c4..0000000000 Binary files a/Items/Ammo/NapalmArrow.png and /dev/null differ diff --git a/Items/Ammo/RubberMortarRound.cs b/Items/Ammo/RubberMortarRound.cs index 0c328d44a9..117ba2780f 100644 --- a/Items/Ammo/RubberMortarRound.cs +++ b/Items/Ammo/RubberMortarRound.cs @@ -12,10 +12,10 @@ namespace CalamityMod.Items.Ammo public override void SetDefaults() { - Item.damage = 20; - Item.DamageType = DamageClass.Ranged; Item.width = 20; Item.height = 14; + Item.damage = 20; + Item.DamageType = DamageClass.Ranged; Item.maxStack = 9999; Item.consumable = true; Item.knockBack = 7f; diff --git a/Items/Ammo/TerraArrow.cs b/Items/Ammo/SproutingArrow.cs similarity index 86% rename from Items/Ammo/TerraArrow.cs rename to Items/Ammo/SproutingArrow.cs index d7081253a6..aa48c93a5d 100644 --- a/Items/Ammo/TerraArrow.cs +++ b/Items/Ammo/SproutingArrow.cs @@ -6,7 +6,8 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Ammo { - public class TerraArrow : ModItem, ILocalizedModType + [LegacyName("TerraArrow")] + public class SproutingArrow : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Ammo"; public override void SetStaticDefaults() @@ -16,16 +17,16 @@ namespace CalamityMod.Items.Ammo public override void SetDefaults() { - Item.damage = 15; - Item.DamageType = DamageClass.Ranged; Item.width = 22; Item.height = 36; + Item.damage = 15; + Item.DamageType = DamageClass.Ranged; Item.maxStack = 9999; Item.consumable = true; Item.knockBack = 1.5f; Item.value = Item.sellPrice(copper: 20); Item.rare = ItemRarityID.Lime; - Item.shoot = ModContent.ProjectileType(); + Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 15f; Item.ammo = AmmoID.Arrow; } diff --git a/Items/Ammo/SproutingArrow.png b/Items/Ammo/SproutingArrow.png new file mode 100644 index 0000000000..0b38fd9cb5 Binary files /dev/null and b/Items/Ammo/SproutingArrow.png differ diff --git a/Items/Ammo/SuperballBullet.cs b/Items/Ammo/SuperballBullet.cs deleted file mode 100644 index 468faabb68..0000000000 --- a/Items/Ammo/SuperballBullet.cs +++ /dev/null @@ -1,42 +0,0 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Ranged; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Ammo -{ - public class SuperballBullet : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Ammo"; - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 99; - } - - public override void SetDefaults() - { - Item.damage = 6; - Item.DamageType = DamageClass.Ranged; - Item.width = 8; - Item.height = 8; - Item.maxStack = 9999; - Item.consumable = true; - Item.knockBack = 1.5f; - Item.value = Item.sellPrice(copper: 2); - Item.rare = ItemRarityID.Green; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 1f; - Item.ammo = AmmoID.Bullet; - } - - public override void AddRecipes() - { - CreateRecipe(150). - AddIngredient(ItemID.MeteorShot, 150). - AddIngredient(). - AddTile(TileID.Anvils). - Register(); - } - } -} diff --git a/Items/Ammo/SuperballBullet.png b/Items/Ammo/SuperballBullet.png deleted file mode 100644 index d0b2597f20..0000000000 Binary files a/Items/Ammo/SuperballBullet.png and /dev/null differ diff --git a/Items/Ammo/TerraArrow.png b/Items/Ammo/TerraArrow.png deleted file mode 100644 index 2fba9fd97b..0000000000 Binary files a/Items/Ammo/TerraArrow.png and /dev/null differ diff --git a/Items/Ammo/TerraBullet.png b/Items/Ammo/TerraBullet.png deleted file mode 100644 index 1b78972e17..0000000000 Binary files a/Items/Ammo/TerraBullet.png and /dev/null differ diff --git a/Items/Ammo/VanquisherArrow.cs b/Items/Ammo/VanquisherArrow.cs index 80a47308c6..3b55ab5e88 100644 --- a/Items/Ammo/VanquisherArrow.cs +++ b/Items/Ammo/VanquisherArrow.cs @@ -16,20 +16,20 @@ namespace CalamityMod.Items.Ammo public override void SetStaticDefaults() { Item.ResearchUnlockCount = 99; - } + } public override void SetDefaults() { - Item.damage = 24; - Item.DamageType = DamageClass.Ranged; Item.width = 22; Item.height = 46; + Item.damage = 30; + Item.DamageType = DamageClass.Ranged; Item.maxStack = 9999; Item.consumable = true; Item.knockBack = 3.5f; Item.value = Item.sellPrice(copper: 28); - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 10f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 0.1f; Item.ammo = AmmoID.Arrow; Item.rare = ModContent.RarityType(); } diff --git a/Items/Ammo/VanquisherArrow.png b/Items/Ammo/VanquisherArrow.png index 2f3dbd1a2a..17d51653cd 100644 Binary files a/Items/Ammo/VanquisherArrow.png and b/Items/Ammo/VanquisherArrow.png differ diff --git a/Items/Ammo/VanquisherArrowGlow.png b/Items/Ammo/VanquisherArrowGlow.png index aa85107a6c..0db572e079 100644 Binary files a/Items/Ammo/VanquisherArrowGlow.png and b/Items/Ammo/VanquisherArrowGlow.png differ diff --git a/Items/Ammo/VeriumBullet.cs b/Items/Ammo/VeriumBolt.cs similarity index 75% rename from Items/Ammo/VeriumBullet.cs rename to Items/Ammo/VeriumBolt.cs index a9c32aa693..b2a1adb08a 100644 --- a/Items/Ammo/VeriumBullet.cs +++ b/Items/Ammo/VeriumBolt.cs @@ -6,34 +6,35 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Ammo { - public class VeriumBullet : ModItem, ILocalizedModType + [LegacyName("ArcticArrow", "VeriumBullet")] + public class VeriumBolt : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Ammo"; public override void SetStaticDefaults() { Item.ResearchUnlockCount = 99; - } + } public override void SetDefaults() { - Item.damage = 8; - Item.DamageType = DamageClass.Ranged; Item.width = 8; Item.height = 8; + Item.damage = 7; + Item.DamageType = DamageClass.Ranged; Item.maxStack = 9999; Item.consumable = true; Item.knockBack = 1.25f; Item.value = Item.sellPrice(copper: 12); Item.rare = ItemRarityID.Pink; - Item.shoot = ModContent.ProjectileType(); + Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 16f; - Item.ammo = AmmoID.Bullet; + Item.ammo = AmmoID.Arrow; } public override void AddRecipes() { CreateRecipe(100). - AddIngredient(ItemID.MusketBall, 100). + AddIngredient(ItemID.WoodenArrow, 100). AddIngredient(). AddTile(TileID.MythrilAnvil). Register(); diff --git a/Items/Ammo/VeriumBolt.png b/Items/Ammo/VeriumBolt.png new file mode 100644 index 0000000000..e386399fea Binary files /dev/null and b/Items/Ammo/VeriumBolt.png differ diff --git a/Items/Ammo/VeriumBullet.png b/Items/Ammo/VeriumBullet.png deleted file mode 100644 index 4c287996d9..0000000000 Binary files a/Items/Ammo/VeriumBullet.png and /dev/null differ diff --git a/Items/AntiCystOintment.cs b/Items/AntiCystOintment.cs index 9d2273e4d0..c109169272 100644 --- a/Items/AntiCystOintment.cs +++ b/Items/AntiCystOintment.cs @@ -1,31 +1,95 @@ -using Terraria.ID; -using Terraria; +using Terraria; +using Terraria.ID; using Terraria.ModLoader; +using System.Collections.Generic; +using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework; +using static CalamityMod.CalamityUtils; namespace CalamityMod.Items { public class AntiCystOintment : ModItem, ILocalizedModType { + public static bool state = false; public new string LocalizationCategory => "Items.Misc"; public override void SetDefaults() { Item.width = 44; Item.height = 34; - Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.rare = ItemRarityID.Blue; } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.SpawnPrevention; - } - - public override void UpdateInventory(Player player) + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) { - if (Item.favorited) - player.Calamity().disablePerfCystSpawns = true; + itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.SpawnPrevention; } + public override bool CanRightClick() => true; + + public override void RightClick(Player player) + { + if (player.Calamity().disablePerfCystSpawns == true) + player.Calamity().disablePerfCystSpawns = false; + else + player.Calamity().disablePerfCystSpawns = true; + Item.NetStateChanged(); + state = player.Calamity().disablePerfCystSpawns; + + bool favorited = Item.favorited; + Item.SetDefaults(ModContent.ItemType()); + Item.stack++; + Item.favorited = favorited; + } + + /* + public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frameI, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + Texture2D texture; + + if (state) + { + //Replace with enabled texture + texture = ModContent.Request("CalamityMod/Items/AntiCystOintment").Value; + spriteBatch.Draw(texture, position, null, Color.White, 0f, origin, scale, SpriteEffects.None, 0); + } + else + { + texture = ModContent.Request("CalamityMod/Items/AntiCystOintment").Value; + spriteBatch.Draw(texture, position, null, Color.White, 0f, origin, scale, SpriteEffects.None, 0); + } + + return false; + } + + public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) + { + Texture2D texture; + + if (state) + { + //Replace with enabled texture + texture = ModContent.Request("CalamityMod/Items/AntiCystOintment").Value; + spriteBatch.Draw(texture, Item.position - Main.screenPosition, null, lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); + } + else + { + texture = ModContent.Request("CalamityMod/Items/AntiCystOintment").Value; + spriteBatch.Draw(texture, Item.position - Main.screenPosition, null, lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); + } + return false; + } + */ + + public override void ModifyTooltips(List tooltips) + { + string text; + if (state == true) + text = GetTextValue("Items.Misc.SpawnBlockersOn"); + else + text = GetTextValue("Items.Misc.SpawnBlockersOff"); + tooltips.FindAndReplace("[STATE]", text); + } public override void AddRecipes() { CreateRecipe(). diff --git a/Items/AntiTumorOintment.cs b/Items/AntiTumorOintment.cs index b1998194ee..1ee5b62e48 100644 --- a/Items/AntiTumorOintment.cs +++ b/Items/AntiTumorOintment.cs @@ -1,29 +1,93 @@ -using Terraria.ID; -using Terraria; +using Terraria; +using Terraria.ID; using Terraria.ModLoader; +using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework; +using System.Collections.Generic; +using static CalamityMod.CalamityUtils; namespace CalamityMod.Items { public class AntiTumorOintment : ModItem, ILocalizedModType { + public static bool state = false; public new string LocalizationCategory => "Items.Misc"; public override void SetDefaults() { Item.width = 44; Item.height = 34; - Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.rare = ItemRarityID.Blue; } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.SpawnPrevention; - } - - public override void UpdateInventory(Player player) + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) { - if (Item.favorited) + itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.SpawnPrevention; + } + + public override bool CanRightClick() => true; + + public override void RightClick(Player player) + { + if (player.Calamity().disableHiveCystSpawns == true) + player.Calamity().disableHiveCystSpawns = false; + else player.Calamity().disableHiveCystSpawns = true; + Item.NetStateChanged(); + state = player.Calamity().disableHiveCystSpawns; + + bool favorited = Item.favorited; + Item.SetDefaults(ModContent.ItemType()); + Item.stack++; + Item.favorited = favorited; + } + /* + public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frameI, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + Texture2D texture; + + if (state) + { + //Replace with enabled texture + texture = ModContent.Request("CalamityMod/Items/AntiTumorOintment").Value; + spriteBatch.Draw(texture, position, null, Color.White, 0f, origin, scale, SpriteEffects.None, 0); + } + else + { + texture = ModContent.Request("CalamityMod/Items/AntiTumorOintment").Value; + spriteBatch.Draw(texture, position, null, Color.White, 0f, origin, scale, SpriteEffects.None, 0); + } + + return false; + } + + public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) + { + Texture2D texture; + + if (state) + { + //Replace with enabled texture + texture = ModContent.Request("CalamityMod/Items/AntiTumorOintment").Value; + spriteBatch.Draw(texture, Item.position - Main.screenPosition, null, lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); + } + else + { + texture = ModContent.Request("CalamityMod/Items/AntiTumorOintment").Value; + spriteBatch.Draw(texture, Item.position - Main.screenPosition, null, lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); + } + return false; + } + */ + + public override void ModifyTooltips(List tooltips) + { + string text; + if (state == true) + text = GetTextValue("Items.Misc.SpawnBlockersOn"); + else + text = GetTextValue("Items.Misc.SpawnBlockersOff"); + tooltips.FindAndReplace("[STATE]", text); } public override void AddRecipes() diff --git a/Items/Armor/Aerospec/AerospecBreastplate.cs b/Items/Armor/Aerospec/AerospecBreastplate.cs index 464e58a29f..0379cb9b0f 100644 --- a/Items/Armor/Aerospec/AerospecBreastplate.cs +++ b/Items/Armor/Aerospec/AerospecBreastplate.cs @@ -15,12 +15,16 @@ namespace CalamityMod.Items.Armor.Aerospec { Item.width = 18; Item.height = 18; - Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; Item.defense = 7; } - public override void UpdateEquip(Player player) => player.GetCritChance() += 3; + public override void UpdateEquip(Player player) + { + player.GetDamage() += 0.03f; + player.GetCritChance() += 3; + } public override void AddRecipes() { diff --git a/Items/Armor/Aerospec/AerospecHat.cs b/Items/Armor/Aerospec/AerospecHat.cs index 4f2840128b..5fb0715309 100644 --- a/Items/Armor/Aerospec/AerospecHat.cs +++ b/Items/Armor/Aerospec/AerospecHat.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Armor.Aerospec { Item.width = 18; Item.height = 18; - Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; Item.defense = 3; //15 } @@ -36,13 +36,14 @@ namespace CalamityMod.Items.Armor.Aerospec modPlayer.aeroSet = true; player.noFallDmg = true; player.moveSpeed += 0.05f; + player.manaCost -= 0.08f; player.GetCritChance() += 5; } public override void UpdateEquip(Player player) { - player.GetDamage() += 0.08f; - player.statManaMax2 += 20; + player.GetDamage() += 0.1f; + player.statManaMax2 += 30; } public override void AddRecipes() diff --git a/Items/Armor/Aerospec/AerospecHeadgear.cs b/Items/Armor/Aerospec/AerospecHeadgear.cs index 1694d60e9d..ed6ec52e82 100644 --- a/Items/Armor/Aerospec/AerospecHeadgear.cs +++ b/Items/Armor/Aerospec/AerospecHeadgear.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Armor.Aerospec { Item.width = 18; Item.height = 18; - Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; Item.defense = 4; //17 } @@ -50,7 +50,7 @@ namespace CalamityMod.Items.Armor.Aerospec public override void UpdateEquip(Player player) { - player.GetDamage() += 0.08f; + player.GetDamage() += 0.1f; player.moveSpeed += 0.05f; } diff --git a/Items/Armor/Aerospec/AerospecHelm.cs b/Items/Armor/Aerospec/AerospecHelm.cs index 66c8272e2f..bf10c1b5b2 100644 --- a/Items/Armor/Aerospec/AerospecHelm.cs +++ b/Items/Armor/Aerospec/AerospecHelm.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Armor.Aerospec { Item.width = 18; Item.height = 18; - Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; Item.defense = 7; //20 } @@ -42,7 +42,7 @@ namespace CalamityMod.Items.Armor.Aerospec public override void UpdateEquip(Player player) { - player.GetDamage() += 0.08f; + player.GetDamage() += 0.1f; } public override void AddRecipes() diff --git a/Items/Armor/Aerospec/AerospecHelmet.cs b/Items/Armor/Aerospec/AerospecHelmet.cs index 435f3f39f8..688945d746 100644 --- a/Items/Armor/Aerospec/AerospecHelmet.cs +++ b/Items/Armor/Aerospec/AerospecHelmet.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Armor.Aerospec { Item.width = 18; Item.height = 18; - Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; Item.defense = 2; //13 } @@ -64,7 +64,7 @@ namespace CalamityMod.Items.Armor.Aerospec public override void UpdateEquip(Player player) { player.moveSpeed += 0.05f; - player.GetDamage() += 0.05f; + player.GetDamage() += 0.1f; } public override void AddRecipes() diff --git a/Items/Armor/Aerospec/AerospecHood.cs b/Items/Armor/Aerospec/AerospecHood.cs index 4d11017c6b..1d18851f55 100644 --- a/Items/Armor/Aerospec/AerospecHood.cs +++ b/Items/Armor/Aerospec/AerospecHood.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Armor.Aerospec { Item.width = 18; Item.height = 18; - Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; Item.defense = 5; //18 } @@ -41,7 +41,7 @@ namespace CalamityMod.Items.Armor.Aerospec public override void UpdateEquip(Player player) { - player.GetDamage() += 0.08f; + player.GetDamage() += 0.1f; } public override void AddRecipes() diff --git a/Items/Armor/Aerospec/AerospecLeggings.cs b/Items/Armor/Aerospec/AerospecLeggings.cs index 745218ba4a..2cb02ee477 100644 --- a/Items/Armor/Aerospec/AerospecLeggings.cs +++ b/Items/Armor/Aerospec/AerospecLeggings.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Armor.Aerospec { Item.width = 18; Item.height = 18; - Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; Item.defense = 6; } diff --git a/Items/Armor/Astral/AstralBreastplate.cs b/Items/Armor/Astral/AstralBreastplate.cs index 05a5a60592..4b71e1d7bf 100644 --- a/Items/Armor/Astral/AstralBreastplate.cs +++ b/Items/Armor/Astral/AstralBreastplate.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Armor.Astral { Item.width = 18; Item.height = 18; - Item.value = CalamityGlobalItem.Rarity9BuyPrice; + Item.value = CalamityGlobalItem.RarityCyanBuyPrice; Item.rare = ItemRarityID.Cyan; Item.defense = 25; } diff --git a/Items/Armor/Astral/AstralHelm.cs b/Items/Armor/Astral/AstralHelm.cs index 412d23e441..7df783d9e1 100644 --- a/Items/Armor/Astral/AstralHelm.cs +++ b/Items/Armor/Astral/AstralHelm.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Armor.Astral { Item.width = 18; Item.height = 18; - Item.value = CalamityGlobalItem.Rarity9BuyPrice; + Item.value = CalamityGlobalItem.RarityCyanBuyPrice; Item.rare = ItemRarityID.Cyan; Item.defense = 17; //63 } diff --git a/Items/Armor/Astral/AstralLeggings.cs b/Items/Armor/Astral/AstralLeggings.cs index 935aed9d67..ff3e4af4a0 100644 --- a/Items/Armor/Astral/AstralLeggings.cs +++ b/Items/Armor/Astral/AstralLeggings.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Armor.Astral { Item.width = 18; Item.height = 18; - Item.value = CalamityGlobalItem.Rarity9BuyPrice; + Item.value = CalamityGlobalItem.RarityCyanBuyPrice; Item.rare = ItemRarityID.Cyan; Item.defense = 21; } diff --git a/Items/Armor/Auric/AuricTeslaBodyArmor.cs b/Items/Armor/Auric/AuricTeslaBodyArmor.cs index 6bdf9b5265..91ccc4cd61 100644 --- a/Items/Armor/Auric/AuricTeslaBodyArmor.cs +++ b/Items/Armor/Auric/AuricTeslaBodyArmor.cs @@ -1,14 +1,14 @@ using CalamityMod.CalPlayer; -using CalamityMod.Items.Materials; -using CalamityMod.Rarities; -using CalamityMod.Tiles.Furniture.CraftingStations; -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; using CalamityMod.Items.Armor.Bloodflare; using CalamityMod.Items.Armor.GodSlayer; using CalamityMod.Items.Armor.Silva; using CalamityMod.Items.Armor.Tarragon; +using CalamityMod.Items.Materials; +using CalamityMod.Rarities; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Auric { @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Armor.Auric { Item.width = 38; Item.height = 34; - Item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.defense = 48; Item.rare = ModContent.RarityType(); } diff --git a/Items/Armor/Auric/AuricTeslaCuisses.cs b/Items/Armor/Auric/AuricTeslaCuisses.cs index 265557d2ea..1cb579a498 100644 --- a/Items/Armor/Auric/AuricTeslaCuisses.cs +++ b/Items/Armor/Auric/AuricTeslaCuisses.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Armor.Auric { Item.width = 18; Item.height = 18; - Item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.defense = 44; Item.rare = ModContent.RarityType(); } diff --git a/Items/Armor/Auric/AuricTeslaHoodedFacemask.cs b/Items/Armor/Auric/AuricTeslaHoodedFacemask.cs index c18f9e687b..e78c7cebc2 100644 --- a/Items/Armor/Auric/AuricTeslaHoodedFacemask.cs +++ b/Items/Armor/Auric/AuricTeslaHoodedFacemask.cs @@ -1,14 +1,14 @@ using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer.Dashes; using CalamityMod.Items.Accessories; +using CalamityMod.Items.Armor.Bloodflare; +using CalamityMod.Items.Armor.GodSlayer; +using CalamityMod.Items.Armor.Tarragon; using CalamityMod.Items.Materials; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer.Dashes; -using CalamityMod.Items.Armor.Bloodflare; -using CalamityMod.Items.Armor.GodSlayer; -using CalamityMod.Items.Armor.Tarragon; namespace CalamityMod.Items.Armor.Auric { @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Armor.Auric { Item.width = 18; Item.height = 18; - Item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.defense = 40; //132 Item.rare = ModContent.RarityType(); } diff --git a/Items/Armor/Auric/AuricTeslaPlumedHelm.cs b/Items/Armor/Auric/AuricTeslaPlumedHelm.cs index 5af6a2563f..8c5b0367f3 100644 --- a/Items/Armor/Auric/AuricTeslaPlumedHelm.cs +++ b/Items/Armor/Auric/AuricTeslaPlumedHelm.cs @@ -1,13 +1,13 @@ -using CalamityMod.Items.Accessories; +using CalamityMod.CalPlayer.Dashes; +using CalamityMod.Items.Accessories; +using CalamityMod.Items.Armor.Bloodflare; +using CalamityMod.Items.Armor.GodSlayer; +using CalamityMod.Items.Armor.Tarragon; using CalamityMod.Items.Materials; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer.Dashes; -using CalamityMod.Items.Armor.Bloodflare; -using CalamityMod.Items.Armor.GodSlayer; -using CalamityMod.Items.Armor.Tarragon; namespace CalamityMod.Items.Armor.Auric { @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Armor.Auric { Item.width = 18; Item.height = 18; - Item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.defense = 34; //132 Item.rare = ModContent.RarityType(); } diff --git a/Items/Armor/Auric/AuricTeslaRoyalHelm.cs b/Items/Armor/Auric/AuricTeslaRoyalHelm.cs index 19984be002..cc0549db06 100644 --- a/Items/Armor/Auric/AuricTeslaRoyalHelm.cs +++ b/Items/Armor/Auric/AuricTeslaRoyalHelm.cs @@ -1,14 +1,14 @@ using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer.Dashes; using CalamityMod.Items.Accessories; +using CalamityMod.Items.Armor.Bloodflare; +using CalamityMod.Items.Armor.GodSlayer; +using CalamityMod.Items.Armor.Tarragon; using CalamityMod.Items.Materials; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer.Dashes; -using CalamityMod.Items.Armor.Bloodflare; -using CalamityMod.Items.Armor.GodSlayer; -using CalamityMod.Items.Armor.Tarragon; namespace CalamityMod.Items.Armor.Auric { @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Armor.Auric { Item.width = 18; Item.height = 18; - Item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.defense = 54; //132 Item.rare = ModContent.RarityType(); } diff --git a/Items/Armor/Auric/AuricTeslaSpaceHelmet.cs b/Items/Armor/Auric/AuricTeslaSpaceHelmet.cs index f87dff2725..7fbb0f8dd4 100644 --- a/Items/Armor/Auric/AuricTeslaSpaceHelmet.cs +++ b/Items/Armor/Auric/AuricTeslaSpaceHelmet.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Armor.Auric { Item.width = 18; Item.height = 18; - Item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.defense = 12; //132 Item.rare = ModContent.RarityType(); } @@ -62,10 +62,10 @@ namespace CalamityMod.Items.Armor.Auric } if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) { - var damage = (int)player.GetTotalDamage().ApplyTo(1200); + var damage = (int)player.GetTotalDamage().ApplyTo(750); var p = Projectile.NewProjectile(source, player.Center.X, player.Center.Y, 0f, -1f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, -20f, 0f); if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = 1200; + Main.projectile[p].originalDamage = 750; } } } diff --git a/Items/Armor/Auric/AuricTeslaWireHemmedVisage.cs b/Items/Armor/Auric/AuricTeslaWireHemmedVisage.cs index 899c364ec7..a2e4802bd0 100644 --- a/Items/Armor/Auric/AuricTeslaWireHemmedVisage.cs +++ b/Items/Armor/Auric/AuricTeslaWireHemmedVisage.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Armor.Auric { Item.width = 18; Item.height = 18; - Item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.defense = 24; //132 Item.rare = ModContent.RarityType(); } diff --git a/Items/Armor/Bloodflare/BloodflareBodyArmor.cs b/Items/Armor/Bloodflare/BloodflareBodyArmor.cs index 321d4059c8..7139b25e18 100644 --- a/Items/Armor/Bloodflare/BloodflareBodyArmor.cs +++ b/Items/Armor/Bloodflare/BloodflareBodyArmor.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Armor.Bloodflare { Item.width = 18; Item.height = 18; - Item.value = CalamityGlobalItem.Rarity13BuyPrice; + Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; Item.defense = 35; Item.rare = ModContent.RarityType(); } diff --git a/Items/Armor/Bloodflare/BloodflareCuisses.cs b/Items/Armor/Bloodflare/BloodflareCuisses.cs index 23fbd56398..a34517488d 100644 --- a/Items/Armor/Bloodflare/BloodflareCuisses.cs +++ b/Items/Armor/Bloodflare/BloodflareCuisses.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Armor.Bloodflare { Item.width = 18; Item.height = 18; - Item.value = CalamityGlobalItem.Rarity13BuyPrice; + Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; Item.defense = 29; Item.rare = ModContent.RarityType(); } diff --git a/Items/Armor/Bloodflare/BloodflareHeadMagic.cs b/Items/Armor/Bloodflare/BloodflareHeadMagic.cs index 2eeff0a658..92f840986d 100644 --- a/Items/Armor/Bloodflare/BloodflareHeadMagic.cs +++ b/Items/Armor/Bloodflare/BloodflareHeadMagic.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Armor.Bloodflare { Item.width = 18; Item.height = 18; - Item.value = CalamityGlobalItem.Rarity13BuyPrice; + Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; Item.defense = 22; //85 Item.rare = ModContent.RarityType(); } diff --git a/Items/Armor/Bloodflare/BloodflareHeadMelee.cs b/Items/Armor/Bloodflare/BloodflareHeadMelee.cs index efaefaeab8..52523c67d6 100644 --- a/Items/Armor/Bloodflare/BloodflareHeadMelee.cs +++ b/Items/Armor/Bloodflare/BloodflareHeadMelee.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Armor.Bloodflare { Item.width = 18; Item.height = 18; - Item.value = CalamityGlobalItem.Rarity13BuyPrice; + Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; Item.defense = 49; //85 Item.rare = ModContent.RarityType(); } diff --git a/Items/Armor/Bloodflare/BloodflareHeadRanged.cs b/Items/Armor/Bloodflare/BloodflareHeadRanged.cs index cf3c67d80e..df4841eaa7 100644 --- a/Items/Armor/Bloodflare/BloodflareHeadRanged.cs +++ b/Items/Armor/Bloodflare/BloodflareHeadRanged.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Armor.Bloodflare { Item.width = 18; Item.height = 18; - Item.value = CalamityGlobalItem.Rarity13BuyPrice; + Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; Item.defense = 34; //85 Item.rare = ModContent.RarityType(); } diff --git a/Items/Armor/Bloodflare/BloodflareHeadRogue.cs b/Items/Armor/Bloodflare/BloodflareHeadRogue.cs index d9277c9e52..a9460e2066 100644 --- a/Items/Armor/Bloodflare/BloodflareHeadRogue.cs +++ b/Items/Armor/Bloodflare/BloodflareHeadRogue.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Armor.Bloodflare { Item.width = 18; Item.height = 18; - Item.value = CalamityGlobalItem.Rarity13BuyPrice; + Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; Item.defense = 28; //85 Item.rare = ModContent.RarityType(); } diff --git a/Items/Armor/Bloodflare/BloodflareHeadSummon.cs b/Items/Armor/Bloodflare/BloodflareHeadSummon.cs index 5e5c5001ac..1cb061cd35 100644 --- a/Items/Armor/Bloodflare/BloodflareHeadSummon.cs +++ b/Items/Armor/Bloodflare/BloodflareHeadSummon.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Armor.Bloodflare { Item.width = 18; Item.height = 18; - Item.value = CalamityGlobalItem.Rarity13BuyPrice; + Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; Item.defense = 16; //85 Item.rare = ModContent.RarityType(); } diff --git a/Items/Armor/Brimflame/BrimflameScowl.cs b/Items/Armor/Brimflame/BrimflameScowl.cs index 38df7bb7a5..3f6d5cae92 100644 --- a/Items/Armor/Brimflame/BrimflameScowl.cs +++ b/Items/Armor/Brimflame/BrimflameScowl.cs @@ -3,9 +3,9 @@ using CalamityMod.CalPlayer; using CalamityMod.Cooldowns; using CalamityMod.Items.Materials; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Items.Armor.Brimflame { diff --git a/Items/Armor/CirrusDress.cs b/Items/Armor/CirrusDress.cs index 7458e9e7f3..4da0b51cd9 100644 --- a/Items/Armor/CirrusDress.cs +++ b/Items/Armor/CirrusDress.cs @@ -22,10 +22,10 @@ namespace CalamityMod.Items.Armor EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Armor/CirrusDress_Legs", EquipType.Legs, this); } } - + public override void SetStaticDefaults() { - + if (Main.netMode == NetmodeID.Server) return; int equipSlot = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Body); @@ -36,7 +36,7 @@ namespace CalamityMod.Items.Armor { Item.width = 18; Item.height = 18; - Item.value = CalamityGlobalItem.Rarity16BuyPrice; + Item.value = CalamityGlobalItem.RarityHotPinkBuyPrice; Item.rare = ModContent.RarityType(); Item.Calamity().devItem = true; Item.defense = 8; diff --git a/Items/Armor/Daedalus/DaedalusBreastplate.cs b/Items/Armor/Daedalus/DaedalusBreastplate.cs index 8775e33ecc..99653f3213 100644 --- a/Items/Armor/Daedalus/DaedalusBreastplate.cs +++ b/Items/Armor/Daedalus/DaedalusBreastplate.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Armor.Daedalus { Item.width = 18; Item.height = 18; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.defense = 19; //41 } diff --git a/Items/Armor/Daedalus/DaedalusHeadMagic.cs b/Items/Armor/Daedalus/DaedalusHeadMagic.cs index bb2b4abe1b..175ea3b048 100644 --- a/Items/Armor/Daedalus/DaedalusHeadMagic.cs +++ b/Items/Armor/Daedalus/DaedalusHeadMagic.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Armor.Daedalus { Item.width = 18; Item.height = 18; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.defense = 5; //35 } diff --git a/Items/Armor/Daedalus/DaedalusHeadMelee.cs b/Items/Armor/Daedalus/DaedalusHeadMelee.cs index efc5faa87c..f7fc612265 100644 --- a/Items/Armor/Daedalus/DaedalusHeadMelee.cs +++ b/Items/Armor/Daedalus/DaedalusHeadMelee.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Armor.Daedalus { Item.width = 18; Item.height = 18; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.defense = 21; //51 } diff --git a/Items/Armor/Daedalus/DaedalusHeadRanged.cs b/Items/Armor/Daedalus/DaedalusHeadRanged.cs index fb9cf3a62e..1209a9ebc0 100644 --- a/Items/Armor/Daedalus/DaedalusHeadRanged.cs +++ b/Items/Armor/Daedalus/DaedalusHeadRanged.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Armor.Daedalus { Item.width = 18; Item.height = 18; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.defense = 9; //39 } diff --git a/Items/Armor/Daedalus/DaedalusHeadRogue.cs b/Items/Armor/Daedalus/DaedalusHeadRogue.cs index 390f68944a..67bcabda36 100644 --- a/Items/Armor/Daedalus/DaedalusHeadRogue.cs +++ b/Items/Armor/Daedalus/DaedalusHeadRogue.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Armor.Daedalus { Item.width = 18; Item.height = 18; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.defense = 7; //37 } diff --git a/Items/Armor/Daedalus/DaedalusHeadSummon.cs b/Items/Armor/Daedalus/DaedalusHeadSummon.cs index f308960c51..5f85a4c3ef 100644 --- a/Items/Armor/Daedalus/DaedalusHeadSummon.cs +++ b/Items/Armor/Daedalus/DaedalusHeadSummon.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Armor.Daedalus { Item.width = 18; Item.height = 18; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.defense = 3; //33 } diff --git a/Items/Armor/Daedalus/DaedalusLeggings.cs b/Items/Armor/Daedalus/DaedalusLeggings.cs index 1b59a641f8..023629f0c4 100644 --- a/Items/Armor/Daedalus/DaedalusLeggings.cs +++ b/Items/Armor/Daedalus/DaedalusLeggings.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Armor.Daedalus { Item.width = 18; Item.height = 18; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.defense = 15; //41 } diff --git a/Items/Armor/Demonshade/DemonshadeBreastplate.cs b/Items/Armor/Demonshade/DemonshadeBreastplate.cs index a27a5fff84..dec634e4f4 100644 --- a/Items/Armor/Demonshade/DemonshadeBreastplate.cs +++ b/Items/Armor/Demonshade/DemonshadeBreastplate.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Armor.Demonshade Item.width = 18; Item.height = 18; Item.defense = 50; - Item.value = CalamityGlobalItem.Rarity16BuyPrice; + Item.value = CalamityGlobalItem.RarityHotPinkBuyPrice; Item.rare = ModContent.RarityType(); Item.Calamity().devItem = true; } diff --git a/Items/Armor/Demonshade/DemonshadeGreaves.cs b/Items/Armor/Demonshade/DemonshadeGreaves.cs index b0f04a3d73..013b25a960 100644 --- a/Items/Armor/Demonshade/DemonshadeGreaves.cs +++ b/Items/Armor/Demonshade/DemonshadeGreaves.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Armor.Demonshade Item.height = 18; Item.defense = 50; - Item.value = CalamityGlobalItem.Rarity16BuyPrice; + Item.value = CalamityGlobalItem.RarityHotPinkBuyPrice; Item.rare = ModContent.RarityType(); Item.Calamity().devItem = true; } diff --git a/Items/Armor/Demonshade/DemonshadeHelm.cs b/Items/Armor/Demonshade/DemonshadeHelm.cs index e2e89a9a38..1abc0de932 100644 --- a/Items/Armor/Demonshade/DemonshadeHelm.cs +++ b/Items/Armor/Demonshade/DemonshadeHelm.cs @@ -1,15 +1,15 @@ using CalamityMod.Buffs.Summon; using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; +using CalamityMod.Items.Potions.Alcohol; using CalamityMod.Projectiles.Typeless; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; -using Terraria.ModLoader; using Terraria.DataStructures; -using CalamityMod.Items.Potions.Alcohol; +using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Demonshade { @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Armor.Demonshade Item.width = 18; Item.height = 18; Item.defense = 50; - Item.value = CalamityGlobalItem.Rarity16BuyPrice; + Item.value = CalamityGlobalItem.RarityHotPinkBuyPrice; Item.rare = ModContent.RarityType(); Item.Calamity().devItem = true; } diff --git a/Items/Armor/DesertProwler/DesertProwlerSet.cs b/Items/Armor/DesertProwler/DesertProwlerSet.cs index 98c95440f8..d2afe3d3aa 100644 --- a/Items/Armor/DesertProwler/DesertProwlerSet.cs +++ b/Items/Armor/DesertProwler/DesertProwlerSet.cs @@ -1,21 +1,21 @@ -using CalamityMod.CalPlayer; -using CalamityMod.Items.Materials; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Cooldowns; -using static Terraria.ModLoader.ModContent; -using Microsoft.Xna.Framework; +using System; using System.Collections.Generic; -using CalamityMod.Particles; -using System; -using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.CalPlayer; +using CalamityMod.Cooldowns; +using CalamityMod.Dusts; +using CalamityMod.Items.Materials; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using ReLogic.Utilities; +using Terraria; using Terraria.Audio; using Terraria.DataStructures; -using CalamityMod.Dusts; -using ReLogic.Utilities; +using Terraria.ID; using Terraria.Localization; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; namespace CalamityMod.Items.Armor.DesertProwler { @@ -64,7 +64,7 @@ namespace CalamityMod.Items.Armor.DesertProwler { Item.width = 18; Item.height = 18; - Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.rare = ItemRarityID.Blue; Item.defense = 1; //6 } @@ -77,7 +77,7 @@ namespace CalamityMod.Items.Armor.DesertProwler public override void UpdateArmorSet(Player player) - { + { player.setBonus = this.GetLocalization("SetBonus").Format(FlatDamageBonus); //More gets edited in elsewhere player.GetDamage().Flat += FlatDamageBonus; @@ -88,7 +88,7 @@ namespace CalamityMod.Items.Armor.DesertProwler { if (cd.timeLeft == SmokeCooldown + SmokeDuration) armorPlayer.SetBonusStartEffect(); - + player.moveSpeed *= 1.5f; player.invis = true; player.aggro = (int)(player.aggro * 0.5f); @@ -218,7 +218,7 @@ namespace CalamityMod.Items.Armor.DesertProwler { Item.width = 18; Item.height = 18; - Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.rare = ItemRarityID.Blue; Item.defense = 3; } @@ -248,7 +248,7 @@ namespace CalamityMod.Items.Armor.DesertProwler { Item.width = 18; Item.height = 18; - Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.rare = ItemRarityID.Blue; Item.defense = 2; } @@ -301,7 +301,7 @@ namespace CalamityMod.Items.Armor.DesertProwler } if (cd.timeLeft == DesertProwlerHat.SmokeCooldown) - SetBonusEndEffect(); + SetBonusEndEffect(); } } @@ -354,7 +354,7 @@ namespace CalamityMod.Items.Armor.DesertProwler for (int j = 0; j < 1; j++) { - Dust miniDust = Dust.NewDustDirect(dustPos, 32, 32, 124, dustVel.X, dustVel.Y * 0.3f, 150, default(Color), 1f); + Dust miniDust = Dust.NewDustDirect(dustPos, 32, 32, DustID.SandstormInABottle, dustVel.X, dustVel.Y * 0.3f, 150, default(Color), 1f); miniDust.fadeIn = 1.5f; } } @@ -420,7 +420,7 @@ namespace CalamityMod.Items.Armor.DesertProwler projectile.CritChance += ExtraCrit; - projectile.Calamity().supercritHits = 1; + projectile.Calamity().supercritHits = 1; LightsOut = true; Main.player[projectile.owner].GetModPlayer().stopSmokeBomb = true; } diff --git a/Items/Armor/Empyrean/EmpyreanCloak.cs b/Items/Armor/Empyrean/EmpyreanCloak.cs index 14af6e6ad4..1cb1f1d103 100644 --- a/Items/Armor/Empyrean/EmpyreanCloak.cs +++ b/Items/Armor/Empyrean/EmpyreanCloak.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Armor.Empyrean public override void SetStaticDefaults() { - + if (Main.netMode != NetmodeID.Server) { var equipSlot = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Body); @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Armor.Empyrean { Item.width = 18; Item.height = 18; - Item.value = CalamityGlobalItem.Rarity10BuyPrice; + Item.value = CalamityGlobalItem.RarityRedBuyPrice; Item.rare = ItemRarityID.Red; Item.defense = 27; } diff --git a/Items/Armor/Empyrean/EmpyreanCuisses.cs b/Items/Armor/Empyrean/EmpyreanCuisses.cs index 5e47bef699..9480df2faf 100644 --- a/Items/Armor/Empyrean/EmpyreanCuisses.cs +++ b/Items/Armor/Empyrean/EmpyreanCuisses.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Armor.Empyrean { Item.width = 18; Item.height = 18; - Item.value = CalamityGlobalItem.Rarity10BuyPrice; + Item.value = CalamityGlobalItem.RarityRedBuyPrice; Item.rare = ItemRarityID.Red; Item.defense = 24; } diff --git a/Items/Armor/Empyrean/EmpyreanMask.cs b/Items/Armor/Empyrean/EmpyreanMask.cs index 3fef9a2634..2dcd7472d1 100644 --- a/Items/Armor/Empyrean/EmpyreanMask.cs +++ b/Items/Armor/Empyrean/EmpyreanMask.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Items.Armor.Empyrean { Item.width = 18; Item.height = 18; - Item.value = CalamityGlobalItem.Rarity10BuyPrice; + Item.value = CalamityGlobalItem.RarityRedBuyPrice; Item.rare = ItemRarityID.Red; Item.defense = 20; //71 } diff --git a/Items/Armor/FathomSwarmer/FathomSwarmerBoots.cs b/Items/Armor/FathomSwarmer/FathomSwarmerBoots.cs index 0f4b041251..cf89c37fa3 100644 --- a/Items/Armor/FathomSwarmer/FathomSwarmerBoots.cs +++ b/Items/Armor/FathomSwarmer/FathomSwarmerBoots.cs @@ -16,12 +16,12 @@ namespace CalamityMod.Items.Armor.FathomSwarmer Item.height = 18; Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; - Item.defense = 15; + Item.defense = 13; } public override void UpdateEquip(Player player) { - player.GetDamage() += 0.04f; + player.GetDamage() += 0.08f; if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) { player.moveSpeed += 0.4f; @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Armor.FathomSwarmer } - + public override void AddRecipes() { diff --git a/Items/Armor/FathomSwarmer/FathomSwarmerBreastplate.cs b/Items/Armor/FathomSwarmer/FathomSwarmerBreastplate.cs index 5ea0df2717..f606b5f05e 100644 --- a/Items/Armor/FathomSwarmer/FathomSwarmerBreastplate.cs +++ b/Items/Armor/FathomSwarmer/FathomSwarmerBreastplate.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Armor.FathomSwarmer public new string LocalizationCategory => "Items.Armor.Hardmode"; public override void SetStaticDefaults() { - + if (Main.netMode == NetmodeID.Server) return; @@ -28,18 +28,14 @@ namespace CalamityMod.Items.Armor.FathomSwarmer Item.height = 18; Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; - Item.defense = 22; + Item.defense = 20; } public override void UpdateEquip(Player player) { - player.GetDamage() += 0.06f; + player.GetDamage() += 0.1f; player.endurance += 0.06f; - if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) - { - player.statDefense += 10; - player.lifeRegen += 5; - } + player.maxMinions += 1; player.Calamity().fathomSwarmerBreastplate = true; } diff --git a/Items/Armor/FathomSwarmer/FathomSwarmerVisage.cs b/Items/Armor/FathomSwarmer/FathomSwarmerVisage.cs index 92de3cad77..0b1ccd16b7 100644 --- a/Items/Armor/FathomSwarmer/FathomSwarmerVisage.cs +++ b/Items/Armor/FathomSwarmer/FathomSwarmerVisage.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Armor.FathomSwarmer Item.height = 18; Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; - Item.defense = 10; //47 +10 underwater + Item.defense = 8; //41 +10 underwater } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -40,14 +40,17 @@ namespace CalamityMod.Items.Armor.FathomSwarmer player.GetDamage() += 0.1f; if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) { - player.GetDamage() += 0.3f; + player.GetDamage() += 0.2f; + player.statDefense += 10; + player.lifeRegen += 5; } } public override void UpdateEquip(Player player) { var modPlayer = player.Calamity(); - player.GetDamage() += 0.05f; + player.GetDamage() += 0.08f; + player.maxMinions += 1; if (player.breath <= player.breathMax + 2 && !modPlayer.ZoneAbyss) { player.breath = player.breathMax + 3; diff --git a/Items/Armor/Fearmonger/FearmongerGreathelm.cs b/Items/Armor/Fearmonger/FearmongerGreathelm.cs index 61f4091029..4454c1f4c7 100644 --- a/Items/Armor/Fearmonger/FearmongerGreathelm.cs +++ b/Items/Armor/Fearmonger/FearmongerGreathelm.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Armor.Fearmonger { Item.width = 18; Item.height = 18; - Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.defense = 38; // 132 total Item.rare = ModContent.RarityType(); } diff --git a/Items/Armor/Fearmonger/FearmongerGreaves.cs b/Items/Armor/Fearmonger/FearmongerGreaves.cs index 008027b09e..ae1a160f5a 100644 --- a/Items/Armor/Fearmonger/FearmongerGreaves.cs +++ b/Items/Armor/Fearmonger/FearmongerGreaves.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Armor.Fearmonger { Item.width = 18; Item.height = 18; - Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.defense = 44; Item.rare = ModContent.RarityType(); } diff --git a/Items/Armor/Fearmonger/FearmongerPlateMail.cs b/Items/Armor/Fearmonger/FearmongerPlateMail.cs index 18966d1f20..2429a23224 100644 --- a/Items/Armor/Fearmonger/FearmongerPlateMail.cs +++ b/Items/Armor/Fearmonger/FearmongerPlateMail.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Armor.Fearmonger { Item.width = 18; Item.height = 18; - Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.defense = 50; Item.rare = ModContent.RarityType(); } diff --git a/Items/Armor/GemTech/GemTechBodyArmor.cs b/Items/Armor/GemTech/GemTechBodyArmor.cs index 5983837f0e..7b76249015 100644 --- a/Items/Armor/GemTech/GemTechBodyArmor.cs +++ b/Items/Armor/GemTech/GemTechBodyArmor.cs @@ -1,7 +1,7 @@ -using CalamityMod.Items.Materials; +using System.Collections.Generic; +using CalamityMod.Items.Materials; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; -using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Armor.GemTech Item.width = 48; Item.height = 32; Item.defense = 31; - Item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; } diff --git a/Items/Armor/GemTech/GemTechHeadgear.cs b/Items/Armor/GemTech/GemTechHeadgear.cs index 8a0b35a901..006989a52d 100644 --- a/Items/Armor/GemTech/GemTechHeadgear.cs +++ b/Items/Armor/GemTech/GemTechHeadgear.cs @@ -1,10 +1,10 @@ -using CalamityMod.Items.Materials; +using System; +using System.Collections.Generic; +using System.Linq; +using CalamityMod.Items.Materials; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; -using System; -using System.Collections.Generic; -using System.Linq; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -60,7 +60,7 @@ namespace CalamityMod.Items.Armor.GemTech Item.width = 40; Item.height = 32; Item.defense = 14; - Item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; } diff --git a/Items/Armor/GemTech/GemTechSchynbaulds.cs b/Items/Armor/GemTech/GemTechSchynbaulds.cs index 7288d53222..cc5f3f3323 100644 --- a/Items/Armor/GemTech/GemTechSchynbaulds.cs +++ b/Items/Armor/GemTech/GemTechSchynbaulds.cs @@ -1,7 +1,7 @@ -using CalamityMod.Items.Materials; +using System.Collections.Generic; +using CalamityMod.Items.Materials; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; -using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Armor.GemTech Item.width = 28; Item.height = 26; Item.defense = 24; - Item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; } diff --git a/Items/Armor/GodSlayer/GodSlayerChestplate.cs b/Items/Armor/GodSlayer/GodSlayerChestplate.cs index fc58217de3..fae0a56ad4 100644 --- a/Items/Armor/GodSlayer/GodSlayerChestplate.cs +++ b/Items/Armor/GodSlayer/GodSlayerChestplate.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Armor.GodSlayer { Item.width = 18; Item.height = 18; - Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.defense = 41; Item.rare = ModContent.RarityType(); } diff --git a/Items/Armor/GodSlayer/GodSlayerHeadMelee.cs b/Items/Armor/GodSlayer/GodSlayerHeadMelee.cs index 567a039311..251f1f7b3a 100644 --- a/Items/Armor/GodSlayer/GodSlayerHeadMelee.cs +++ b/Items/Armor/GodSlayer/GodSlayerHeadMelee.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Armor.GodSlayer { Item.width = 18; Item.height = 18; - Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.defense = 48; //96 Item.rare = ModContent.RarityType(); } diff --git a/Items/Armor/GodSlayer/GodSlayerHeadRanged.cs b/Items/Armor/GodSlayer/GodSlayerHeadRanged.cs index 60e0d5650b..f5fcdee6ef 100644 --- a/Items/Armor/GodSlayer/GodSlayerHeadRanged.cs +++ b/Items/Armor/GodSlayer/GodSlayerHeadRanged.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Armor.GodSlayer { Item.width = 18; Item.height = 18; - Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.defense = 35; //96 Item.rare = ModContent.RarityType(); } diff --git a/Items/Armor/GodSlayer/GodSlayerHeadRogue.cs b/Items/Armor/GodSlayer/GodSlayerHeadRogue.cs index 288baab07a..5aa027e58f 100644 --- a/Items/Armor/GodSlayer/GodSlayerHeadRogue.cs +++ b/Items/Armor/GodSlayer/GodSlayerHeadRogue.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Armor.GodSlayer { Item.width = 18; Item.height = 18; - Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.defense = 29; //96 Item.rare = ModContent.RarityType(); } diff --git a/Items/Armor/GodSlayer/GodSlayerLeggings.cs b/Items/Armor/GodSlayer/GodSlayerLeggings.cs index 1b5a1fe56f..2e74e4c676 100644 --- a/Items/Armor/GodSlayer/GodSlayerLeggings.cs +++ b/Items/Armor/GodSlayer/GodSlayerLeggings.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Armor.GodSlayer { Item.width = 18; Item.height = 18; - Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.defense = 35; Item.rare = ModContent.RarityType(); } diff --git a/Items/Armor/Hydrothermic/HydrothermicArmor.cs b/Items/Armor/Hydrothermic/HydrothermicArmor.cs index b376339703..9dcc979f64 100644 --- a/Items/Armor/Hydrothermic/HydrothermicArmor.cs +++ b/Items/Armor/Hydrothermic/HydrothermicArmor.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Armor.Hydrothermic { Item.width = 18; Item.height = 18; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; Item.defense = 20; } diff --git a/Items/Armor/Hydrothermic/HydrothermicHeadMagic.cs b/Items/Armor/Hydrothermic/HydrothermicHeadMagic.cs index d4d495576a..75ac9ea103 100644 --- a/Items/Armor/Hydrothermic/HydrothermicHeadMagic.cs +++ b/Items/Armor/Hydrothermic/HydrothermicHeadMagic.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Armor.Hydrothermic { Item.width = 18; Item.height = 18; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; Item.defense = 9; //45 } diff --git a/Items/Armor/Hydrothermic/HydrothermicHeadMelee.cs b/Items/Armor/Hydrothermic/HydrothermicHeadMelee.cs index 46f81e0fab..33fbbab286 100644 --- a/Items/Armor/Hydrothermic/HydrothermicHeadMelee.cs +++ b/Items/Armor/Hydrothermic/HydrothermicHeadMelee.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Armor.Hydrothermic { Item.width = 18; Item.height = 18; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; Item.defense = 33; //67 } diff --git a/Items/Armor/Hydrothermic/HydrothermicHeadRanged.cs b/Items/Armor/Hydrothermic/HydrothermicHeadRanged.cs index 02ab1549f8..e62bf09a14 100644 --- a/Items/Armor/Hydrothermic/HydrothermicHeadRanged.cs +++ b/Items/Armor/Hydrothermic/HydrothermicHeadRanged.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Armor.Hydrothermic { Item.width = 18; Item.height = 18; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; Item.defense = 15; //53 } diff --git a/Items/Armor/Hydrothermic/HydrothermicHeadRogue.cs b/Items/Armor/Hydrothermic/HydrothermicHeadRogue.cs index cc88018fc7..5abfac1be7 100644 --- a/Items/Armor/Hydrothermic/HydrothermicHeadRogue.cs +++ b/Items/Armor/Hydrothermic/HydrothermicHeadRogue.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Armor.Hydrothermic { Item.width = 18; Item.height = 18; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; Item.defense = 12; //49 } diff --git a/Items/Armor/Hydrothermic/HydrothermicHeadSummon.cs b/Items/Armor/Hydrothermic/HydrothermicHeadSummon.cs index 333a631d2b..b246aae0eb 100644 --- a/Items/Armor/Hydrothermic/HydrothermicHeadSummon.cs +++ b/Items/Armor/Hydrothermic/HydrothermicHeadSummon.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Armor.Hydrothermic { Item.width = 18; Item.height = 18; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; Item.defense = 6; //40 } diff --git a/Items/Armor/Hydrothermic/HydrothermicSubligar.cs b/Items/Armor/Hydrothermic/HydrothermicSubligar.cs index bff64a0dc8..95b528c3c7 100644 --- a/Items/Armor/Hydrothermic/HydrothermicSubligar.cs +++ b/Items/Armor/Hydrothermic/HydrothermicSubligar.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Armor.Hydrothermic { Item.width = 18; Item.height = 18; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; Item.defense = 14; } diff --git a/Items/Armor/LunicCorps/LunicCorpsBoots.cs b/Items/Armor/LunicCorps/LunicCorpsBoots.cs index ac7b8791d8..aee18ca025 100644 --- a/Items/Armor/LunicCorps/LunicCorpsBoots.cs +++ b/Items/Armor/LunicCorps/LunicCorpsBoots.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Armor.LunicCorps { Item.width = 18; Item.height = 18; - Item.value = CalamityGlobalItem.Rarity9BuyPrice; + Item.value = CalamityGlobalItem.RarityCyanBuyPrice; Item.defense = 18; Item.rare = ItemRarityID.Cyan; Item.Calamity().donorItem = true; diff --git a/Items/Armor/LunicCorps/LunicCorpsHelmet.cs b/Items/Armor/LunicCorps/LunicCorpsHelmet.cs index 58a4fa7c33..f8c38f6f04 100644 --- a/Items/Armor/LunicCorps/LunicCorpsHelmet.cs +++ b/Items/Armor/LunicCorps/LunicCorpsHelmet.cs @@ -2,6 +2,7 @@ using CalamityMod.CalPlayer; using CalamityMod.DataStructures; using CalamityMod.Items.Materials; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; @@ -61,7 +62,7 @@ namespace CalamityMod.Items.Armor.LunicCorps { Item.width = 18; Item.height = 18; - Item.value = CalamityGlobalItem.Rarity9BuyPrice; + Item.value = CalamityGlobalItem.RarityCyanBuyPrice; Item.defense = 14; Item.rare = ItemRarityID.Cyan; Item.Calamity().donorItem = true; @@ -76,7 +77,10 @@ namespace CalamityMod.Items.Armor.LunicCorps { var modPlayer = player.Calamity(); modPlayer.lunicCorpsSet = true; - player.setBonus = this.GetLocalizedValue("SetBonus"); + + // The localization is formatted strangely, but attempting to put the {0} on its own line will leave a blank space if given an empty string + string adrenTooltip = CalamityWorld.revenge ? "\n" + this.GetLocalizedValue("ShieldAdren") : ""; + player.setBonus = this.GetLocalization("SetBonus").Format(adrenTooltip); player.bulletDamage += 0.1f; player.specialistDamage += 0.1f; diff --git a/Items/Armor/LunicCorps/LunicCorpsVest.cs b/Items/Armor/LunicCorps/LunicCorpsVest.cs index ea9c757be5..104d829934 100644 --- a/Items/Armor/LunicCorps/LunicCorpsVest.cs +++ b/Items/Armor/LunicCorps/LunicCorpsVest.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Armor.LunicCorps { Item.width = 18; Item.height = 18; - Item.value = CalamityGlobalItem.Rarity9BuyPrice; + Item.value = CalamityGlobalItem.RarityCyanBuyPrice; Item.defense = 20; Item.rare = ItemRarityID.Cyan; Item.Calamity().donorItem = true; diff --git a/Items/Armor/MarniteArchitect/MarniteArchitectSet.cs b/Items/Armor/MarniteArchitect/MarniteArchitectSet.cs index 3d5973538d..711995fa8f 100644 --- a/Items/Armor/MarniteArchitect/MarniteArchitectSet.cs +++ b/Items/Armor/MarniteArchitect/MarniteArchitectSet.cs @@ -1,4 +1,7 @@ -using CalamityMod.Buffs.Mounts; +using System; +using System.Collections.Generic; +using System.Linq; +using CalamityMod.Buffs.Mounts; using CalamityMod.CalPlayer; using CalamityMod.Cooldowns; using CalamityMod.Items.Accessories.Vanity; @@ -8,15 +11,12 @@ using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Utilities; -using System; -using System.Collections.Generic; -using System.Linq; using Terraria; using Terraria.Audio; using Terraria.DataStructures; +using Terraria.GameInput; using Terraria.ID; using Terraria.ModLoader; -using Terraria.GameInput; using static Microsoft.Xna.Framework.Input.Keys; using static Terraria.ModLoader.ModContent; @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Armor.MarniteArchitect public static readonly SoundStyle LiftSpawnSound = new("CalamityMod/Sounds/Item/MarniteLiftSummon"); public static readonly SoundStyle LiftGoAwaySound = new("CalamityMod/Sounds/Item/MarniteLiftUnsummon"); - public static readonly SoundStyle LiftHummSound = new("CalamityMod/Sounds/Item/MarniteLiftHumm") { IsLooped = true}; + public static readonly SoundStyle LiftHummSound = new("CalamityMod/Sounds/Item/MarniteLiftHumm") { IsLooped = true }; public static float LiftRaiseSpeed = 2f; public static float MaxLiftHeight = 138f; @@ -53,7 +53,7 @@ namespace CalamityMod.Items.Armor.MarniteArchitect { Item.width = 18; Item.height = 18; - Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.rare = ItemRarityID.Blue; Item.defense = 0; } @@ -153,7 +153,7 @@ namespace CalamityMod.Items.Armor.MarniteArchitect { Item.width = 18; Item.height = 18; - Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.rare = ItemRarityID.Blue; Item.defense = 1; } @@ -292,7 +292,7 @@ namespace CalamityMod.Items.Armor.MarniteArchitect if (distanceToGround >= 0) { - float newVelocity; + float newVelocity; if (Player.controlUp || Player.controlJump) { @@ -382,7 +382,7 @@ namespace CalamityMod.Items.Armor.MarniteArchitect if (Main.rand.NextFloat() > (centerDistance / MarniteArchitectHeadgear.MaxLiftHeight) * 0.6f && Main.rand.NextBool()) { float scale = 1.2f - (centerDistance / MarniteArchitectHeadgear.MaxLiftHeight) * 0.7f; - Dust dust = Dust.NewDustPerfect(player.Bottom + Vector2.UnitY * centerDistance + Vector2.UnitX * Main.rand.Next(-16, 16), 31, new Vector2((Main.rand.NextFloat(-8, 8) * scale) - player.velocity.X, Main.rand.NextFloat(-1, 1)), 120, Scale : scale * 1.5f); + Dust dust = Dust.NewDustPerfect(player.Bottom + Vector2.UnitY * centerDistance + Vector2.UnitX * Main.rand.Next(-16, 16), 31, new Vector2((Main.rand.NextFloat(-8, 8) * scale) - player.velocity.X, Main.rand.NextFloat(-1, 1)), 120, Scale: scale * 1.5f); } } @@ -425,7 +425,7 @@ namespace CalamityMod.Items.Armor.MarniteArchitect public override bool Draw(List playerDrawData, int drawType, Player drawPlayer, ref Texture2D texture, ref Texture2D glowTexture, ref Vector2 drawPosition, ref Rectangle frame, ref Color drawColor, ref Color glowColor, ref float rotation, ref SpriteEffects spriteEffects, ref Vector2 drawOrigin, ref float drawScale, float shadow) { - rotation = MathHelper.Clamp(drawPlayer.velocity.X * 0.03f, - MathHelper.ToRadians(7f), MathHelper.ToRadians(7f)); + rotation = MathHelper.Clamp(drawPlayer.velocity.X * 0.03f, -MathHelper.ToRadians(7f), MathHelper.ToRadians(7f)); drawPlayer.fullRotation = rotation; // Draw is called for each mount texture we provide, so we check drawType to avoid duplicate draws. @@ -447,7 +447,7 @@ namespace CalamityMod.Items.Armor.MarniteArchitect playerDrawData.Add(new DrawData(fireTex, drawPosition + new Vector2(0, 8), new Rectangle(0, 0, fireTex.Width, fireTex.Height), fireColor, drawPlayer.fullRotation, fireOrigin, fireScale * drawScale, SpriteEffects.None, 0)); } - + playerDrawData.Add(new DrawData(platformTex, drawPosition, new Rectangle(0, 0, platformTex.Width, platformTex.Height), drawColor, drawPlayer.fullRotation, platformTex.Size() / 2f, drawScale, SpriteEffects.None, 0)); } diff --git a/Items/Armor/Mollusk/MolluskShelleggings.cs b/Items/Armor/Mollusk/MolluskShelleggings.cs index c78d3af5d2..ed92e3077d 100644 --- a/Items/Armor/Mollusk/MolluskShelleggings.cs +++ b/Items/Armor/Mollusk/MolluskShelleggings.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Armor.Mollusk { Item.width = 22; Item.height = 18; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.defense = 15; } diff --git a/Items/Armor/Mollusk/MolluskShellmet.cs b/Items/Armor/Mollusk/MolluskShellmet.cs index 139d19f421..ac81a9a397 100644 --- a/Items/Armor/Mollusk/MolluskShellmet.cs +++ b/Items/Armor/Mollusk/MolluskShellmet.cs @@ -2,12 +2,12 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; +using CalamityMod.Items.Potions.Alcohol; using CalamityMod.Projectiles.Summon; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using Microsoft.Xna.Framework; -using CalamityMod.Items.Potions.Alcohol; namespace CalamityMod.Items.Armor.Mollusk { @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Armor.Mollusk { Item.width = 22; Item.height = 22; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.defense = 18; } diff --git a/Items/Armor/Mollusk/MolluskShellplate.cs b/Items/Armor/Mollusk/MolluskShellplate.cs index 8c77ec27e2..f8813d3250 100644 --- a/Items/Armor/Mollusk/MolluskShellplate.cs +++ b/Items/Armor/Mollusk/MolluskShellplate.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Armor.Mollusk { Item.width = 30; Item.height = 22; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.defense = 22; } diff --git a/Items/Armor/OmegaBlue/OmegaBlueChestplate.cs b/Items/Armor/OmegaBlue/OmegaBlueChestplate.cs index 293a930e7e..cd1bde96a9 100644 --- a/Items/Armor/OmegaBlue/OmegaBlueChestplate.cs +++ b/Items/Armor/OmegaBlue/OmegaBlueChestplate.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Armor.OmegaBlue { Item.width = 18; Item.height = 18; - Item.value = CalamityGlobalItem.Rarity13BuyPrice; + Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; Item.defense = 28; Item.rare = ModContent.RarityType(); } @@ -44,7 +44,7 @@ namespace CalamityMod.Items.Armor.OmegaBlue public override void AddRecipes() { CreateRecipe(). - AddIngredient(12). + AddIngredient(5). AddIngredient(18). AddIngredient(3). AddTile(TileID.LunarCraftingStation). diff --git a/Items/Armor/OmegaBlue/OmegaBlueHelmet.cs b/Items/Armor/OmegaBlue/OmegaBlueHelmet.cs index 5376157e1f..c346df4cee 100644 --- a/Items/Armor/OmegaBlue/OmegaBlueHelmet.cs +++ b/Items/Armor/OmegaBlue/OmegaBlueHelmet.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Items.Armor.OmegaBlue { Item.width = 18; Item.height = 18; - Item.value = CalamityGlobalItem.Rarity13BuyPrice; + Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; Item.defense = 19; Item.rare = ModContent.RarityType(); } @@ -79,7 +79,7 @@ namespace CalamityMod.Items.Armor.OmegaBlue var hasOmegaBlueCooldown = mp.cooldowns.TryGetValue(Cooldowns.OmegaBlue.ID, out var cd); if (hasOmegaBlueCooldown && cd.timeLeft > 1500) { - var d = Dust.NewDust(player.position, player.width, player.height, 20, 0, 0, 100, Color.Transparent, 1.6f); + var d = Dust.NewDust(player.position, player.width, player.height, DustID.PurificationPowder, 0, 0, 100, Color.Transparent, 1.6f); Main.dust[d].noGravity = true; Main.dust[d].noLight = true; Main.dust[d].fadeIn = 1f; @@ -90,7 +90,7 @@ namespace CalamityMod.Items.Armor.OmegaBlue public override void AddRecipes() { CreateRecipe(). - AddIngredient(8). + AddIngredient(3). AddIngredient(12). AddIngredient(). AddTile(TileID.LunarCraftingStation). diff --git a/Items/Armor/OmegaBlue/OmegaBlueTentacles.cs b/Items/Armor/OmegaBlue/OmegaBlueTentacles.cs index 5c9a3d609f..444b81aa4e 100644 --- a/Items/Armor/OmegaBlue/OmegaBlueTentacles.cs +++ b/Items/Armor/OmegaBlue/OmegaBlueTentacles.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Armor.OmegaBlue { Item.width = 18; Item.height = 18; - Item.value = CalamityGlobalItem.Rarity13BuyPrice; + Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; Item.defense = 22; Item.rare = ModContent.RarityType(); } @@ -41,7 +41,7 @@ namespace CalamityMod.Items.Armor.OmegaBlue public override void AddRecipes() { CreateRecipe(). - AddIngredient(10). + AddIngredient(4). AddIngredient(15). AddIngredient(2). AddTile(TileID.LunarCraftingStation). diff --git a/Items/Armor/PlagueReaper/PlagueReaperMask.cs b/Items/Armor/PlagueReaper/PlagueReaperMask.cs index 9608c7e2a3..743937c551 100644 --- a/Items/Armor/PlagueReaper/PlagueReaperMask.cs +++ b/Items/Armor/PlagueReaper/PlagueReaperMask.cs @@ -1,12 +1,12 @@ using CalamityMod.CalPlayer; using CalamityMod.Cooldowns; using CalamityMod.Items.Materials; +using CalamityMod.Items.Potions.Alcohol; using CalamityMod.Projectiles.Rogue; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using CalamityMod.Items.Potions.Alcohol; namespace CalamityMod.Items.Armor.PlagueReaper { @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Armor.PlagueReaper { Item.width = 18; Item.height = 18; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; Item.defense = 9; //35 } diff --git a/Items/Armor/PlagueReaper/PlagueReaperStriders.cs b/Items/Armor/PlagueReaper/PlagueReaperStriders.cs index 88975e4674..4b2492d575 100644 --- a/Items/Armor/PlagueReaper/PlagueReaperStriders.cs +++ b/Items/Armor/PlagueReaper/PlagueReaperStriders.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Armor.PlagueReaper { Item.width = 18; Item.height = 18; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; Item.defense = 11; } diff --git a/Items/Armor/PlagueReaper/PlagueReaperVest.cs b/Items/Armor/PlagueReaper/PlagueReaperVest.cs index 61520f4325..02b6c3132a 100644 --- a/Items/Armor/PlagueReaper/PlagueReaperVest.cs +++ b/Items/Armor/PlagueReaper/PlagueReaperVest.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Armor.PlagueReaper { Item.width = 18; Item.height = 18; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; Item.defense = 14; } diff --git a/Items/Armor/Plaguebringer/PlaguebringerCarapace.cs b/Items/Armor/Plaguebringer/PlaguebringerCarapace.cs index 31b001d949..b2aa04d2b7 100644 --- a/Items/Armor/Plaguebringer/PlaguebringerCarapace.cs +++ b/Items/Armor/Plaguebringer/PlaguebringerCarapace.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Armor.Plaguebringer Item.width = 18; Item.height = 18; Item.defense = 17; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; Item.Calamity().donorItem = true; } diff --git a/Items/Armor/Plaguebringer/PlaguebringerPistons.cs b/Items/Armor/Plaguebringer/PlaguebringerPistons.cs index 2c0b2541d0..005095a0fa 100644 --- a/Items/Armor/Plaguebringer/PlaguebringerPistons.cs +++ b/Items/Armor/Plaguebringer/PlaguebringerPistons.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Armor.Plaguebringer Item.width = 18; Item.height = 18; Item.defense = 8; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; Item.Calamity().donorItem = true; } diff --git a/Items/Armor/Plaguebringer/PlaguebringerVisor.cs b/Items/Armor/Plaguebringer/PlaguebringerVisor.cs index 98fc7d8e53..b176b70614 100644 --- a/Items/Armor/Plaguebringer/PlaguebringerVisor.cs +++ b/Items/Armor/Plaguebringer/PlaguebringerVisor.cs @@ -1,11 +1,11 @@ using CalamityMod.Buffs.Summon; -using CalamityMod.Projectiles.Summon; +using CalamityMod.CalPlayer.Dashes; using CalamityMod.Items.Materials; +using CalamityMod.Items.Potions.Alcohol; +using CalamityMod.Projectiles.Summon; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer.Dashes; -using CalamityMod.Items.Potions.Alcohol; namespace CalamityMod.Items.Armor.Plaguebringer { @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Armor.Plaguebringer Item.width = 18; Item.height = 18; Item.defense = 7; // 32 total - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; Item.Calamity().donorItem = true; } diff --git a/Items/Armor/Prismatic/PrismaticGreaves.cs b/Items/Armor/Prismatic/PrismaticGreaves.cs index 16a09757bd..ea73d76edf 100644 --- a/Items/Armor/Prismatic/PrismaticGreaves.cs +++ b/Items/Armor/Prismatic/PrismaticGreaves.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Armor.Prismatic Item.height = 18; Item.defense = 21; - Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; } diff --git a/Items/Armor/Prismatic/PrismaticHelmet.cs b/Items/Armor/Prismatic/PrismaticHelmet.cs index e86a745d94..cb71e7273a 100644 --- a/Items/Armor/Prismatic/PrismaticHelmet.cs +++ b/Items/Armor/Prismatic/PrismaticHelmet.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Armor.Prismatic Item.height = 18; Item.defense = 18; //71 - Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; } diff --git a/Items/Armor/Prismatic/PrismaticRegalia.cs b/Items/Armor/Prismatic/PrismaticRegalia.cs index c2695ef7cf..cf33906e55 100644 --- a/Items/Armor/Prismatic/PrismaticRegalia.cs +++ b/Items/Armor/Prismatic/PrismaticRegalia.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Armor.Prismatic public new string LocalizationCategory => "Items.Armor.PostMoonLord"; public override void SetStaticDefaults() { - + if (Main.netMode == NetmodeID.Server) return; @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Armor.Prismatic Item.height = 18; Item.defense = 33; - Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; } diff --git a/Items/Armor/Reaver/ReaverHeadTank.cs b/Items/Armor/Reaver/ReaverHeadTank.cs index 2970ae04c9..77d56d0339 100644 --- a/Items/Armor/Reaver/ReaverHeadTank.cs +++ b/Items/Armor/Reaver/ReaverHeadTank.cs @@ -38,14 +38,14 @@ namespace CalamityMod.Items.Armor.Reaver { var modPlayer = player.Calamity(); player.thorns += 0.33f; - player.moveSpeed -= 0.2f; + player.moveSpeed -= 0.3f; player.statDefense += 10; player.lifeRegen += 3; player.aggro += 600; modPlayer.reaverDefense = true; modPlayer.wearingRogueArmor = true; player.setBonus = this.GetLocalizedValue("SetBonus"); - //Reaver Rage provides 30% damage to offset the helm "bonus", 5 def, and 5% melee speed. + // Reaver Rage provides 10% damage, 5 def, and 5% melee speed. } public override void UpdateEquip(Player player) diff --git a/Items/Armor/Reaver/ReaverScaleMail.cs b/Items/Armor/Reaver/ReaverScaleMail.cs index 5cb16b2fd9..ef24dc9ec5 100644 --- a/Items/Armor/Reaver/ReaverScaleMail.cs +++ b/Items/Armor/Reaver/ReaverScaleMail.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Armor.Reaver public new string LocalizationCategory => "Items.Armor.Hardmode"; public override void SetStaticDefaults() { - + if (Main.netMode == NetmodeID.Server) return; diff --git a/Items/Armor/Silva/SilvaArmor.cs b/Items/Armor/Silva/SilvaArmor.cs index ccfb997b04..c9f6fa1c0a 100644 --- a/Items/Armor/Silva/SilvaArmor.cs +++ b/Items/Armor/Silva/SilvaArmor.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Armor.Silva { Item.width = 24; Item.height = 24; - Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.defense = 44; Item.rare = ModContent.RarityType(); } diff --git a/Items/Armor/Silva/SilvaHeadMagic.cs b/Items/Armor/Silva/SilvaHeadMagic.cs index 249483a7c4..f74ca35b2b 100644 --- a/Items/Armor/Silva/SilvaHeadMagic.cs +++ b/Items/Armor/Silva/SilvaHeadMagic.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Armor.Silva { Item.width = 24; Item.height = 22; - Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.defense = 21; //110 Item.rare = ModContent.RarityType(); } @@ -53,7 +53,7 @@ namespace CalamityMod.Items.Armor.Silva { CreateRecipe(). AddIngredient(6). - AddIngredient(5). + AddIngredient(5). AddIngredient(2). AddTile(). Register(); diff --git a/Items/Armor/Silva/SilvaHeadSummon.cs b/Items/Armor/Silva/SilvaHeadSummon.cs index e38fc5b498..f5c274ca52 100644 --- a/Items/Armor/Silva/SilvaHeadSummon.cs +++ b/Items/Armor/Silva/SilvaHeadSummon.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Armor.Silva { Item.width = 28; Item.height = 24; - Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.defense = 13; //110 Item.rare = ModContent.RarityType(); } @@ -62,7 +62,7 @@ namespace CalamityMod.Items.Armor.Silva var p = Projectile.NewProjectile(source, player.Center.X, player.Center.Y, 0f, -1f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, -20f, 0f); if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = baseDamage; + Main.projectile[p].originalDamage = 600; } } player.GetDamage() += 0.65f; diff --git a/Items/Armor/Silva/SilvaLeggings.cs b/Items/Armor/Silva/SilvaLeggings.cs index 8f82dd0c23..887ee8d864 100644 --- a/Items/Armor/Silva/SilvaLeggings.cs +++ b/Items/Armor/Silva/SilvaLeggings.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Armor.Silva { Item.width = 22; Item.height = 18; - Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.defense = 39; Item.rare = ModContent.RarityType(); } diff --git a/Items/Armor/SnowRuffian/SnowRuffianChestplate.cs b/Items/Armor/SnowRuffian/SnowRuffianChestplate.cs index 810f342215..cc726ffdc5 100644 --- a/Items/Armor/SnowRuffian/SnowRuffianChestplate.cs +++ b/Items/Armor/SnowRuffian/SnowRuffianChestplate.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Armor.SnowRuffian { Item.width = 18; Item.height = 18; - Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.rare = ItemRarityID.Blue; Item.defense = 4; //9 } diff --git a/Items/Armor/SnowRuffian/SnowRuffianGreaves.cs b/Items/Armor/SnowRuffian/SnowRuffianGreaves.cs index 0461fd1662..5e4137d56e 100644 --- a/Items/Armor/SnowRuffian/SnowRuffianGreaves.cs +++ b/Items/Armor/SnowRuffian/SnowRuffianGreaves.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Armor.SnowRuffian { Item.width = 18; Item.height = 18; - Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.rare = ItemRarityID.Blue; Item.defense = 3; //9 } diff --git a/Items/Armor/SnowRuffian/SnowRuffianMask.cs b/Items/Armor/SnowRuffian/SnowRuffianMask.cs index c11953eef2..f995a21e32 100644 --- a/Items/Armor/SnowRuffian/SnowRuffianMask.cs +++ b/Items/Armor/SnowRuffian/SnowRuffianMask.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Armor.SnowRuffian { Item.width = 18; Item.height = 18; - Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.rare = ItemRarityID.Blue; Item.defense = 2; //9 } diff --git a/Items/Armor/Statigel/StatigelHeadMagic.cs b/Items/Armor/Statigel/StatigelHeadMagic.cs index 8cb8afdfc2..c5539d4e86 100644 --- a/Items/Armor/Statigel/StatigelHeadMagic.cs +++ b/Items/Armor/Statigel/StatigelHeadMagic.cs @@ -41,7 +41,7 @@ namespace CalamityMod.Items.Armor.Statigel player.GetDamage() += 0.1f; player.GetCritChance() += 7; player.manaCost *= 0.9f; - player.statManaMax2 += 30; + player.statManaMax2 += 40; } public override void AddRecipes() diff --git a/Items/Armor/Statigel/StatigelHeadSummon.cs b/Items/Armor/Statigel/StatigelHeadSummon.cs index 9b46cbd14f..e6cbde0e68 100644 --- a/Items/Armor/Statigel/StatigelHeadSummon.cs +++ b/Items/Armor/Statigel/StatigelHeadSummon.cs @@ -52,7 +52,7 @@ namespace CalamityMod.Items.Armor.Statigel var minionID = -1; // 08DEC2023: Ozzatron: Corruption and Crimson Slimes spawned with Old Fashioned active will retain their bonus damage indefinitely. Oops. Don't care. - var baseDamage = player.ApplyArmorAccDamageBonusesTo(33); + var baseDamage = player.ApplyArmorAccDamageBonusesTo(18); var minionDamage = (int)player.GetTotalDamage().ApplyTo(baseDamage); if (WorldGen.crimson && player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) diff --git a/Items/Armor/Sulphurous/SulphurousBreastplate.cs b/Items/Armor/Sulphurous/SulphurousBreastplate.cs index 9be6207852..ee6c63df21 100644 --- a/Items/Armor/Sulphurous/SulphurousBreastplate.cs +++ b/Items/Armor/Sulphurous/SulphurousBreastplate.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Armor.Sulphurous { Item.width = 24; Item.height = 20; - Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.defense = 6; Item.rare = ItemRarityID.Green; } diff --git a/Items/Armor/Sulphurous/SulphurousHelmet.cs b/Items/Armor/Sulphurous/SulphurousHelmet.cs index ce99062974..b2b6e7b765 100644 --- a/Items/Armor/Sulphurous/SulphurousHelmet.cs +++ b/Items/Armor/Sulphurous/SulphurousHelmet.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Armor.Sulphurous { Item.width = 26; Item.height = 26; - Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; Item.defense = 5; } @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Armor.Sulphurous { player.setBonus = this.GetLocalizedValue("SetBonus"); var modPlayer = player.Calamity(); - modPlayer.sulfurSet = true; + modPlayer.sulphurSet = true; player.GetJumpState().Enable(); modPlayer.rogueStealthMax += 0.7f; modPlayer.wearingRogueArmor = true; @@ -42,7 +42,8 @@ namespace CalamityMod.Items.Armor.Sulphurous { player.GetDamage() += 0.04f; player.GetCritChance() += 2; - player.gills = true; + if (player.IsUnderwater()) + player.gills = true; } public override void AddRecipes() diff --git a/Items/Armor/Sulphurous/SulphurousLeggings.cs b/Items/Armor/Sulphurous/SulphurousLeggings.cs index 26b48c9a11..5968958d92 100644 --- a/Items/Armor/Sulphurous/SulphurousLeggings.cs +++ b/Items/Armor/Sulphurous/SulphurousLeggings.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Armor.Sulphurous { Item.width = 22; Item.height = 16; - Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.defense = 5; Item.rare = ItemRarityID.Green; } diff --git a/Items/Armor/Tarragon/TarragonBreastplate.cs b/Items/Armor/Tarragon/TarragonBreastplate.cs index 8218d79977..0596b39c82 100644 --- a/Items/Armor/Tarragon/TarragonBreastplate.cs +++ b/Items/Armor/Tarragon/TarragonBreastplate.cs @@ -14,8 +14,8 @@ namespace CalamityMod.Items.Armor.Tarragon { Item.width = 18; Item.height = 18; - Item.lifeRegen = 2; - Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.lifeRegen = 3; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.defense = 37; Item.rare = ModContent.RarityType(); } diff --git a/Items/Armor/Tarragon/TarragonHeadMagic.cs b/Items/Armor/Tarragon/TarragonHeadMagic.cs index 38ad105e8d..b46d33d1a1 100644 --- a/Items/Armor/Tarragon/TarragonHeadMagic.cs +++ b/Items/Armor/Tarragon/TarragonHeadMagic.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Armor.Tarragon { Item.width = 18; Item.height = 18; - Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.defense = 10; //98 Item.rare = ModContent.RarityType(); } @@ -43,9 +43,9 @@ namespace CalamityMod.Items.Armor.Tarragon public override void UpdateEquip(Player player) { player.manaCost *= 0.85f; - player.GetDamage() += 0.2f; + player.GetDamage() += 0.15f; player.GetCritChance() += 10; - player.endurance += 0.05f; + player.endurance += 0.1f; player.statManaMax2 += 100; } diff --git a/Items/Armor/Tarragon/TarragonHeadMelee.cs b/Items/Armor/Tarragon/TarragonHeadMelee.cs index df7b75c2d8..a4318fd9fa 100644 --- a/Items/Armor/Tarragon/TarragonHeadMelee.cs +++ b/Items/Armor/Tarragon/TarragonHeadMelee.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Armor.Tarragon { Item.width = 18; Item.height = 18; - Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.defense = 33; //98 Item.rare = ModContent.RarityType(); } @@ -45,9 +45,9 @@ namespace CalamityMod.Items.Armor.Tarragon public override void UpdateEquip(Player player) { - player.GetDamage() += 0.1f; - player.GetCritChance() += 5; - player.endurance += 0.05f; + player.GetDamage() += 0.12f; + player.GetCritChance() += 10; + player.endurance += 0.1f; } public override void AddRecipes() diff --git a/Items/Armor/Tarragon/TarragonHeadRanged.cs b/Items/Armor/Tarragon/TarragonHeadRanged.cs index 23faee24f2..792ea770cb 100644 --- a/Items/Armor/Tarragon/TarragonHeadRanged.cs +++ b/Items/Armor/Tarragon/TarragonHeadRanged.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Armor.Tarragon { Item.width = 18; Item.height = 18; - Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.defense = 21; //98 Item.rare = ModContent.RarityType(); } @@ -44,7 +44,7 @@ namespace CalamityMod.Items.Armor.Tarragon { player.GetDamage() += 0.1f; player.GetCritChance() += 10; - player.endurance += 0.05f; + player.endurance += 0.1f; } public override void AddRecipes() diff --git a/Items/Armor/Tarragon/TarragonHeadRogue.cs b/Items/Armor/Tarragon/TarragonHeadRogue.cs index 6141a20d97..f23bb9b49f 100644 --- a/Items/Armor/Tarragon/TarragonHeadRogue.cs +++ b/Items/Armor/Tarragon/TarragonHeadRogue.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Armor.Tarragon { Item.width = 18; Item.height = 18; - Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.defense = 15; //98 Item.rare = ModContent.RarityType(); } @@ -47,7 +47,7 @@ namespace CalamityMod.Items.Armor.Tarragon player.GetDamage() += 0.1f; player.GetCritChance() += 10; player.moveSpeed += 0.05f; - player.endurance += 0.05f; + player.endurance += 0.1f; } public override void AddRecipes() diff --git a/Items/Armor/Tarragon/TarragonHeadSummon.cs b/Items/Armor/Tarragon/TarragonHeadSummon.cs index 8658aeaae4..c7cccc2570 100644 --- a/Items/Armor/Tarragon/TarragonHeadSummon.cs +++ b/Items/Armor/Tarragon/TarragonHeadSummon.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Armor.Tarragon { Item.width = 18; Item.height = 18; - Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.defense = 3; //98 Item.rare = ModContent.RarityType(); } @@ -47,7 +47,7 @@ namespace CalamityMod.Items.Armor.Tarragon public override void UpdateEquip(Player player) { - player.endurance += 0.05f; + player.endurance += 0.1f; player.GetDamage() += 0.05f; } diff --git a/Items/Armor/Tarragon/TarragonLeggings.cs b/Items/Armor/Tarragon/TarragonLeggings.cs index 91df12647d..4aeeca59c1 100644 --- a/Items/Armor/Tarragon/TarragonLeggings.cs +++ b/Items/Armor/Tarragon/TarragonLeggings.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Armor.Tarragon { Item.width = 18; Item.height = 18; - Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.defense = 32; Item.rare = ModContent.RarityType(); } diff --git a/Items/Armor/TitanHeart/TitanHeartMantle.cs b/Items/Armor/TitanHeart/TitanHeartMantle.cs index e591138bba..cc8ca16d7c 100644 --- a/Items/Armor/TitanHeart/TitanHeartMantle.cs +++ b/Items/Armor/TitanHeart/TitanHeartMantle.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Armor.TitanHeart public new string LocalizationCategory => "Items.Armor.Hardmode"; public override void SetStaticDefaults() { - + if (Main.netMode == NetmodeID.Server) return; diff --git a/Items/Armor/Vanity/AnahitaMask.cs b/Items/Armor/Vanity/AnahitaMask.cs index 12c9c8438c..4db1f50099 100644 --- a/Items/Armor/Vanity/AnahitaMask.cs +++ b/Items/Armor/Vanity/AnahitaMask.cs @@ -1,6 +1,6 @@ using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Vanity { diff --git a/Items/Armor/Vanity/ApolloMask.cs b/Items/Armor/Vanity/ApolloMask.cs index 48028d4ea2..4fa5fab09d 100644 --- a/Items/Armor/Vanity/ApolloMask.cs +++ b/Items/Armor/Vanity/ApolloMask.cs @@ -1,8 +1,8 @@ -using Terraria.ModLoader; +using Microsoft.Xna.Framework; using Terraria; -using Terraria.ID; -using Microsoft.Xna.Framework; using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Vanity { diff --git a/Items/Armor/Vanity/AquaticScourgeMask.cs b/Items/Armor/Vanity/AquaticScourgeMask.cs index 40a5fa8584..be678d7788 100644 --- a/Items/Armor/Vanity/AquaticScourgeMask.cs +++ b/Items/Armor/Vanity/AquaticScourgeMask.cs @@ -1,6 +1,6 @@ using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Vanity { diff --git a/Items/Armor/Vanity/AresMask.cs b/Items/Armor/Vanity/AresMask.cs index bf51d095ff..aa5580989e 100644 --- a/Items/Armor/Vanity/AresMask.cs +++ b/Items/Armor/Vanity/AresMask.cs @@ -1,6 +1,6 @@ using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Vanity { diff --git a/Items/Armor/Vanity/ArtemisMask.cs b/Items/Armor/Vanity/ArtemisMask.cs index 9a6f06f45c..b7566aee1f 100644 --- a/Items/Armor/Vanity/ArtemisMask.cs +++ b/Items/Armor/Vanity/ArtemisMask.cs @@ -1,8 +1,8 @@ -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using Terraria; using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Vanity { diff --git a/Items/Armor/Vanity/AstrumAureusMask.cs b/Items/Armor/Vanity/AstrumAureusMask.cs index f7c1826af1..e1fef0a232 100644 --- a/Items/Armor/Vanity/AstrumAureusMask.cs +++ b/Items/Armor/Vanity/AstrumAureusMask.cs @@ -1,6 +1,6 @@ using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Vanity { diff --git a/Items/Armor/Vanity/AstrumDeusMask.cs b/Items/Armor/Vanity/AstrumDeusMask.cs index e5aefaf5b4..02f8e896a6 100644 --- a/Items/Armor/Vanity/AstrumDeusMask.cs +++ b/Items/Armor/Vanity/AstrumDeusMask.cs @@ -1,6 +1,6 @@ using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Vanity { diff --git a/Items/Armor/Vanity/BrimstoneWaifuMask.cs b/Items/Armor/Vanity/BrimstoneWaifuMask.cs index 9eea35d098..0b924dfe7e 100644 --- a/Items/Armor/Vanity/BrimstoneWaifuMask.cs +++ b/Items/Armor/Vanity/BrimstoneWaifuMask.cs @@ -1,6 +1,6 @@ using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Vanity { diff --git a/Items/Armor/Vanity/BumblefuckMask.cs b/Items/Armor/Vanity/BumblefuckMask.cs index 8c15d17861..daa49fa6a4 100644 --- a/Items/Armor/Vanity/BumblefuckMask.cs +++ b/Items/Armor/Vanity/BumblefuckMask.cs @@ -1,6 +1,6 @@ using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Vanity { diff --git a/Items/Armor/Vanity/CalamitasCloneMask.cs b/Items/Armor/Vanity/CalamitasCloneMask.cs index d021f357d1..70e99716a0 100644 --- a/Items/Armor/Vanity/CalamitasCloneMask.cs +++ b/Items/Armor/Vanity/CalamitasCloneMask.cs @@ -1,6 +1,6 @@ using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Vanity { diff --git a/Items/Armor/Vanity/CeaselessVoidMask.cs b/Items/Armor/Vanity/CeaselessVoidMask.cs index 8285241225..b904b2dc40 100644 --- a/Items/Armor/Vanity/CeaselessVoidMask.cs +++ b/Items/Armor/Vanity/CeaselessVoidMask.cs @@ -1,6 +1,6 @@ using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Vanity { diff --git a/Items/Armor/Vanity/CrabulonMask.cs b/Items/Armor/Vanity/CrabulonMask.cs index 714afe8c42..9762528cb5 100644 --- a/Items/Armor/Vanity/CrabulonMask.cs +++ b/Items/Armor/Vanity/CrabulonMask.cs @@ -1,6 +1,6 @@ using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Vanity { diff --git a/Items/Armor/Vanity/CryogenMask.cs b/Items/Armor/Vanity/CryogenMask.cs index 83598324fa..f040947bf1 100644 --- a/Items/Armor/Vanity/CryogenMask.cs +++ b/Items/Armor/Vanity/CryogenMask.cs @@ -1,6 +1,6 @@ using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Vanity { diff --git a/Items/Armor/Vanity/DesertScourgeMask.cs b/Items/Armor/Vanity/DesertScourgeMask.cs index 85cecc90a6..2f02591f1b 100644 --- a/Items/Armor/Vanity/DesertScourgeMask.cs +++ b/Items/Armor/Vanity/DesertScourgeMask.cs @@ -1,6 +1,6 @@ using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Vanity { diff --git a/Items/Armor/Vanity/DesertScourgeMask.png b/Items/Armor/Vanity/DesertScourgeMask.png index 5073e234f6..9d24c112c7 100644 Binary files a/Items/Armor/Vanity/DesertScourgeMask.png and b/Items/Armor/Vanity/DesertScourgeMask.png differ diff --git a/Items/Armor/Vanity/DesertScourgeMask_Head.png b/Items/Armor/Vanity/DesertScourgeMask_Head.png index f3b8e9cf1b..12f879dea7 100644 Binary files a/Items/Armor/Vanity/DesertScourgeMask_Head.png and b/Items/Armor/Vanity/DesertScourgeMask_Head.png differ diff --git a/Items/Armor/Vanity/DevourerofGodsMask.cs b/Items/Armor/Vanity/DevourerofGodsMask.cs index 8e074655ba..66d8800593 100644 --- a/Items/Armor/Vanity/DevourerofGodsMask.cs +++ b/Items/Armor/Vanity/DevourerofGodsMask.cs @@ -1,6 +1,6 @@ using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Vanity { diff --git a/Items/Armor/Vanity/DraedonMask.cs b/Items/Armor/Vanity/DraedonMask.cs index 371229f763..cdc742b38c 100644 --- a/Items/Armor/Vanity/DraedonMask.cs +++ b/Items/Armor/Vanity/DraedonMask.cs @@ -1,6 +1,6 @@ using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Vanity { diff --git a/Items/Armor/Vanity/HiveMindMask.cs b/Items/Armor/Vanity/HiveMindMask.cs index 84e020aebd..31ff5b076d 100644 --- a/Items/Armor/Vanity/HiveMindMask.cs +++ b/Items/Armor/Vanity/HiveMindMask.cs @@ -1,6 +1,6 @@ using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Vanity { diff --git a/Items/Armor/Vanity/LeviathanMask.cs b/Items/Armor/Vanity/LeviathanMask.cs index 3e0cd91a91..8b3f4008f9 100644 --- a/Items/Armor/Vanity/LeviathanMask.cs +++ b/Items/Armor/Vanity/LeviathanMask.cs @@ -1,6 +1,6 @@ using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Vanity { @@ -10,9 +10,7 @@ namespace CalamityMod.Items.Armor.Vanity public new string LocalizationCategory => "Items.Armor.Vanity"; public override void SetStaticDefaults() { - - if (Main.netMode != NetmodeID.Server) - ArmorIDs.Head.Sets.DrawHead[Item.headSlot] = false; + ArmorIDs.Head.Sets.DrawHatHair[Item.headSlot] = true; } public override void SetDefaults() diff --git a/Items/Armor/Vanity/OldDukeMask.cs b/Items/Armor/Vanity/OldDukeMask.cs index 75ee16e8dd..03c00611bb 100644 --- a/Items/Armor/Vanity/OldDukeMask.cs +++ b/Items/Armor/Vanity/OldDukeMask.cs @@ -1,6 +1,6 @@ using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Vanity { diff --git a/Items/Armor/Vanity/OldHunterSet.cs b/Items/Armor/Vanity/OldHunterSet.cs index ef8f2955ad..03471b531d 100644 --- a/Items/Armor/Vanity/OldHunterSet.cs +++ b/Items/Armor/Vanity/OldHunterSet.cs @@ -1,9 +1,9 @@ using CalamityMod.CalPlayer; +using CalamityMod.Items.Armor.DesertProwler; using CalamityMod.Items.Materials; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Items.Armor.DesertProwler; namespace CalamityMod.Items.Armor.Vanity { @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Armor.Vanity { Item.width = 18; Item.height = 18; - Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.rare = ItemRarityID.Blue; Item.vanity = true; } @@ -60,7 +60,7 @@ namespace CalamityMod.Items.Armor.Vanity { Item.width = 18; Item.height = 18; - Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.rare = ItemRarityID.Blue; Item.vanity = true; } @@ -89,7 +89,7 @@ namespace CalamityMod.Items.Armor.Vanity { Item.width = 18; Item.height = 18; - Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.rare = ItemRarityID.Blue; Item.vanity = true; } diff --git a/Items/Armor/Vanity/PerforatorMask.cs b/Items/Armor/Vanity/PerforatorMask.cs index 1d60bd3f10..03148413bf 100644 --- a/Items/Armor/Vanity/PerforatorMask.cs +++ b/Items/Armor/Vanity/PerforatorMask.cs @@ -1,6 +1,6 @@ using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Vanity { diff --git a/Items/Armor/Vanity/PlaguebringerGoliathMask.cs b/Items/Armor/Vanity/PlaguebringerGoliathMask.cs index 71e05fb635..148f99be3e 100644 --- a/Items/Armor/Vanity/PlaguebringerGoliathMask.cs +++ b/Items/Armor/Vanity/PlaguebringerGoliathMask.cs @@ -1,6 +1,6 @@ using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Vanity { diff --git a/Items/Armor/Vanity/PolterghastMask.cs b/Items/Armor/Vanity/PolterghastMask.cs index 0acab66bf3..e0b4a533ff 100644 --- a/Items/Armor/Vanity/PolterghastMask.cs +++ b/Items/Armor/Vanity/PolterghastMask.cs @@ -1,6 +1,6 @@ using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Vanity { diff --git a/Items/Armor/Vanity/ProfanedGuardianMask.cs b/Items/Armor/Vanity/ProfanedGuardianMask.cs index eb4377c855..02e6f1d34c 100644 --- a/Items/Armor/Vanity/ProfanedGuardianMask.cs +++ b/Items/Armor/Vanity/ProfanedGuardianMask.cs @@ -1,6 +1,6 @@ using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Vanity { diff --git a/Items/Armor/Vanity/ProvidenceMask.cs b/Items/Armor/Vanity/ProvidenceMask.cs index 4f5932903e..289def74b9 100644 --- a/Items/Armor/Vanity/ProvidenceMask.cs +++ b/Items/Armor/Vanity/ProvidenceMask.cs @@ -1,6 +1,6 @@ using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Vanity { diff --git a/Items/Armor/Vanity/RavagerMask.cs b/Items/Armor/Vanity/RavagerMask.cs index a521d00053..6e7c7352a2 100644 --- a/Items/Armor/Vanity/RavagerMask.cs +++ b/Items/Armor/Vanity/RavagerMask.cs @@ -1,6 +1,6 @@ using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Vanity { diff --git a/Items/Armor/Vanity/SCalBoots.cs b/Items/Armor/Vanity/SCalBoots.cs index cac1f85078..c8211831dd 100644 --- a/Items/Armor/Vanity/SCalBoots.cs +++ b/Items/Armor/Vanity/SCalBoots.cs @@ -1,5 +1,5 @@ -using Terraria.ModLoader; -using Terraria.ID; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Vanity { diff --git a/Items/Armor/Vanity/SCalMask.cs b/Items/Armor/Vanity/SCalMask.cs index a6974d19b8..a83226b508 100644 --- a/Items/Armor/Vanity/SCalMask.cs +++ b/Items/Armor/Vanity/SCalMask.cs @@ -1,6 +1,6 @@ using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Vanity { diff --git a/Items/Armor/Vanity/SCalRobes.cs b/Items/Armor/Vanity/SCalRobes.cs index 0f1235542b..fb1ccb4200 100644 --- a/Items/Armor/Vanity/SCalRobes.cs +++ b/Items/Armor/Vanity/SCalRobes.cs @@ -1,6 +1,6 @@ -using Terraria.ModLoader; +using Terraria; using Terraria.ID; -using Terraria; +using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Vanity { diff --git a/Items/Armor/Vanity/SignusMask.cs b/Items/Armor/Vanity/SignusMask.cs index e0507e14b9..6936aac06e 100644 --- a/Items/Armor/Vanity/SignusMask.cs +++ b/Items/Armor/Vanity/SignusMask.cs @@ -1,6 +1,6 @@ using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Vanity { diff --git a/Items/Armor/Vanity/SlimeGodMask.cs b/Items/Armor/Vanity/SlimeGodMask.cs index 314999df7e..163b2e0864 100644 --- a/Items/Armor/Vanity/SlimeGodMask.cs +++ b/Items/Armor/Vanity/SlimeGodMask.cs @@ -1,6 +1,6 @@ using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Vanity { diff --git a/Items/Armor/Vanity/SlimeGodMask2.cs b/Items/Armor/Vanity/SlimeGodMask2.cs index 1320436b52..1c773f2cb4 100644 --- a/Items/Armor/Vanity/SlimeGodMask2.cs +++ b/Items/Armor/Vanity/SlimeGodMask2.cs @@ -1,6 +1,6 @@ using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Vanity { diff --git a/Items/Armor/Vanity/StormWeaverMask.cs b/Items/Armor/Vanity/StormWeaverMask.cs index 80ac66de93..c588118a60 100644 --- a/Items/Armor/Vanity/StormWeaverMask.cs +++ b/Items/Armor/Vanity/StormWeaverMask.cs @@ -1,6 +1,6 @@ using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Vanity { diff --git a/Items/Armor/Vanity/ThanatosMask.cs b/Items/Armor/Vanity/ThanatosMask.cs index aa11300444..eced97d9d5 100644 --- a/Items/Armor/Vanity/ThanatosMask.cs +++ b/Items/Armor/Vanity/ThanatosMask.cs @@ -1,6 +1,6 @@ using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Vanity { @@ -10,9 +10,7 @@ namespace CalamityMod.Items.Armor.Vanity public new string LocalizationCategory => "Items.Armor.Vanity"; public override void SetStaticDefaults() { - - if (Main.netMode != NetmodeID.Server) - ArmorIDs.Head.Sets.DrawHead[Item.headSlot] = false; + ArmorIDs.Head.Sets.DrawHatHair[Item.headSlot] = true; } public override void SetDefaults() diff --git a/Items/Armor/Victide/VictideBreastplate.cs b/Items/Armor/Victide/VictideBreastplate.cs index b4b3f2c2be..f8e6c751c8 100644 --- a/Items/Armor/Victide/VictideBreastplate.cs +++ b/Items/Armor/Victide/VictideBreastplate.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Armor.Victide public override void SetStaticDefaults() { - + if (Main.netMode != NetmodeID.Server) { var equipSlot = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Body); @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Armor.Victide { Item.width = 18; Item.height = 18; - Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; Item.defense = 5; //9 } diff --git a/Items/Armor/Victide/VictideGreaves.cs b/Items/Armor/Victide/VictideGreaves.cs index 42139b4c67..a9a702b35b 100644 --- a/Items/Armor/Victide/VictideGreaves.cs +++ b/Items/Armor/Victide/VictideGreaves.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Armor.Victide public new string LocalizationCategory => "Items.Armor.PreHardmode"; public override void SetStaticDefaults() { - + if (Main.netMode != NetmodeID.Server) { var equipSlot = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Legs); @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Armor.Victide { Item.width = 18; Item.height = 18; - Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; Item.defense = 4; //9 } diff --git a/Items/Armor/Victide/VictideHeadMagic.cs b/Items/Armor/Victide/VictideHeadMagic.cs index 373bae8101..c7401a7cac 100644 --- a/Items/Armor/Victide/VictideHeadMagic.cs +++ b/Items/Armor/Victide/VictideHeadMagic.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Armor.Victide { Item.width = 18; Item.height = 18; - Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; Item.defense = 2; //9 } diff --git a/Items/Armor/Victide/VictideHeadMelee.cs b/Items/Armor/Victide/VictideHeadMelee.cs index b88b84eaea..213c0a8720 100644 --- a/Items/Armor/Victide/VictideHeadMelee.cs +++ b/Items/Armor/Victide/VictideHeadMelee.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Armor.Victide { Item.width = 18; Item.height = 18; - Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; Item.defense = 4; //11 } diff --git a/Items/Armor/Victide/VictideHeadRanged.cs b/Items/Armor/Victide/VictideHeadRanged.cs index 5750ea0860..c320003da6 100644 --- a/Items/Armor/Victide/VictideHeadRanged.cs +++ b/Items/Armor/Victide/VictideHeadRanged.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Armor.Victide { Item.width = 18; Item.height = 18; - Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; Item.defense = 3; //10 } diff --git a/Items/Armor/Victide/VictideHeadRogue.cs b/Items/Armor/Victide/VictideHeadRogue.cs index c791620ab4..b08263d4e0 100644 --- a/Items/Armor/Victide/VictideHeadRogue.cs +++ b/Items/Armor/Victide/VictideHeadRogue.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Armor.Victide { Item.width = 18; Item.height = 18; - Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; Item.defense = 3; //10 } diff --git a/Items/Armor/Victide/VictideHeadSummon.cs b/Items/Armor/Victide/VictideHeadSummon.cs index d92eb63686..48ca1c5af8 100644 --- a/Items/Armor/Victide/VictideHeadSummon.cs +++ b/Items/Armor/Victide/VictideHeadSummon.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Armor.Victide { Item.width = 18; Item.height = 18; - Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; Item.defense = 1; //8 } diff --git a/Items/Armor/Wulfrum/WulfrumFusionCannon.cs b/Items/Armor/Wulfrum/WulfrumFusionCannon.cs index f9d1f1e19d..1f362e3ed1 100644 --- a/Items/Armor/Wulfrum/WulfrumFusionCannon.cs +++ b/Items/Armor/Wulfrum/WulfrumFusionCannon.cs @@ -26,11 +26,11 @@ namespace CalamityMod.Items.Armor.Wulfrum public override void SetDefaults() { + Item.width = 34; + Item.height = 42; Item.damage = 6; Item.ArmorPenetration = 10; Item.DamageType = DamageClass.Summon; - Item.width = 34; - Item.height = 42; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2; @@ -63,7 +63,7 @@ namespace CalamityMod.Items.Armor.Wulfrum { if (!WulfrumHat.HasArmorSet(player)) { - Item.type = 0; + Item.type = ItemID.None; Item.SetDefaults(0); Item.stack = 0; @@ -73,7 +73,7 @@ namespace CalamityMod.Items.Armor.Wulfrum Item.noUseGraphic = false; if (!player.Calamity().cooldowns.TryGetValue(WulfrumBastion.ID, out var cd) || cd.timeLeft > WulfrumHat.BastionCooldown + WulfrumHat.BastionTime - WulfrumHat.BastionBuildTime) - Item.noUseGraphic = true; + Item.noUseGraphic = true; } @@ -131,7 +131,7 @@ namespace CalamityMod.Items.Armor.Wulfrum //Shakezzz itemPosition += Main.rand.NextVector2Circular(2f, 2f) * (1 - animProgress); - + Vector2 itemSize = new Vector2(38, 18); Vector2 itemOrigin = new Vector2(-12, 0); diff --git a/Items/Armor/Wulfrum/WulfrumSet.cs b/Items/Armor/Wulfrum/WulfrumSet.cs index ba09a085ab..6d5858ea5e 100644 --- a/Items/Armor/Wulfrum/WulfrumSet.cs +++ b/Items/Armor/Wulfrum/WulfrumSet.cs @@ -1,16 +1,16 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Particles; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Microsoft.Xna.Framework; -using Terraria.DataStructures; -using CalamityMod.Items.Accessories.Vanity; -using CalamityMod.Cooldowns; -using Terraria.Audio; -using System; +using System; using System.Collections.Generic; +using CalamityMod.Cooldowns; +using CalamityMod.Items.Accessories.Vanity; +using CalamityMod.Items.Materials; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.ID; using Terraria.Localization; +using Terraria.ModLoader; using static Microsoft.Xna.Framework.Input.Keys; using static Terraria.ModLoader.ModContent; @@ -55,7 +55,7 @@ namespace CalamityMod.Items.Armor.Wulfrum { if (Main.netMode != NetmodeID.Server) { - EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Armor/Wulfrum/WulfrumHat_FemaleHead", EquipType.Head, name : "WulfrumHatFemale"); + EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Armor/Wulfrum/WulfrumHat_FemaleHead", EquipType.Head, name: "WulfrumHatFemale"); } Terraria.On_Player.KeyDoubleTap += ActivateSetBonus; @@ -116,11 +116,11 @@ namespace CalamityMod.Items.Armor.Wulfrum { Item.width = 18; Item.height = 18; - Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.rare = ItemRarityID.Blue; } - public override bool IsArmorSet(Item head, Item body, Item legs) => body.type == ItemType() && legs.type == ItemType(); + public override bool IsArmorSet(Item head, Item body, Item legs) => body.type == ItemType() && legs.type == ItemType(); public static bool HasArmorSet(Player player) => player.armor[0].type == ItemType() && player.armor[1].type == ItemType() && player.armor[2].type == ItemType(); public bool IsPartOfSet(Item item) => item.type == ItemType() || item.type == ItemType() || @@ -147,7 +147,7 @@ namespace CalamityMod.Items.Armor.Wulfrum player.endurance += 0.05f; //10% Dr in total with the chestplate //Can't account for previous fullbody transformations but at this point, whatever. - Item headItem = player.armor[10].type != 0 ? player.armor[10] : player.armor[0]; + Item headItem = player.armor[10].type != ItemID.None ? player.armor[10] : player.armor[0]; bool hatVisible = !transformationPlayer.transformationActive && headItem.type == ItemType(); //Spawn the hat @@ -286,7 +286,7 @@ namespace CalamityMod.Items.Armor.Wulfrum { Item.width = 18; Item.height = 18; - Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.rare = ItemRarityID.Blue; Item.defense = 2; } @@ -314,7 +314,7 @@ namespace CalamityMod.Items.Armor.Wulfrum { Item.width = 18; Item.height = 18; - Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.rare = ItemRarityID.Blue; Item.defense = 1; @@ -348,7 +348,7 @@ namespace CalamityMod.Items.Armor.Wulfrum public static int BastionShootTime = 10; public bool wulfrumSet = false; - + public override void ResetEffects() { wulfrumSet = false; diff --git a/Items/BaseItems/HeldOnlyItem.cs b/Items/BaseItems/HeldOnlyItem.cs index 80ddb78e85..10c21c5113 100644 --- a/Items/BaseItems/HeldOnlyItem.cs +++ b/Items/BaseItems/HeldOnlyItem.cs @@ -1,11 +1,11 @@ -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; -using Terraria.DataStructures; -using Terraria.Audio; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.BaseItems { @@ -34,12 +34,12 @@ namespace CalamityMod.Items.BaseItems public override void PostUpdate() { //Die if in the world - Item.type = 0; + Item.type = ItemID.None; Item.stack = 0; } public override bool CanPickup(Player player) => false; - + private void LockMouseToSpecialItem(Terraria.UI.On_ItemSlot.orig_LeftClick_ItemArray_int_int orig, Item[] inv, int context, int slot) { if (!(Main.mouseItem.ModItem is HeldOnlyItem)) diff --git a/Items/BleachBall.cs b/Items/BleachBall.cs index 2fef70d3d2..72c06d37a5 100644 --- a/Items/BleachBall.cs +++ b/Items/BleachBall.cs @@ -1,30 +1,95 @@ -using Terraria.ID; -using Terraria; -using Terraria.ModLoader; +using System.Collections.Generic; using CalamityMod.Items.Materials; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using static CalamityMod.CalamityUtils; namespace CalamityMod.Items { public class BleachBall : ModItem, ILocalizedModType { + public static bool state = false; public new string LocalizationCategory => "Items.Misc"; public override void SetDefaults() { Item.width = 38; Item.height = 46; - Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.rare = ItemRarityID.Blue; } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.SpawnPrevention; - } - - public override void UpdateInventory(Player player) + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) { - if (Item.favorited) + itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.SpawnPrevention; + } + + public override bool CanRightClick() => true; + + public override void RightClick(Player player) + { + if (player.Calamity().disableNaturalScourgeSpawns == true) + player.Calamity().disableNaturalScourgeSpawns = false; + else player.Calamity().disableNaturalScourgeSpawns = true; + Item.NetStateChanged(); + state = player.Calamity().disableNaturalScourgeSpawns; + + bool favorited = Item.favorited; + Item.SetDefaults(ModContent.ItemType()); + Item.stack++; + Item.favorited = favorited; + } + + /* + public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frameI, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + Texture2D texture; + + if (state) + { + //Replace with enabled texture + texture = ModContent.Request("CalamityMod/Items/BleachBall").Value; + spriteBatch.Draw(texture, position, null, Color.White, 0f, origin, scale, SpriteEffects.None, 0); + } + else + { + texture = ModContent.Request("CalamityMod/Items/BleachBall").Value; + spriteBatch.Draw(texture, position, null, Color.White, 0f, origin, scale, SpriteEffects.None, 0); + } + + return false; + } + + public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) + { + Texture2D texture; + + if (state) + { + //Replace with enabled texture + texture = ModContent.Request("CalamityMod/Items/BleachBall").Value; + spriteBatch.Draw(texture, Item.position - Main.screenPosition, null, lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); + } + else + { + texture = ModContent.Request("CalamityMod/Items/BleachBall").Value; + spriteBatch.Draw(texture, Item.position - Main.screenPosition, null, lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); + } + return false; + } + */ + + public override void ModifyTooltips(List tooltips) + { + string text; + if (state == true) + text = GetTextValue("Items.Misc.SpawnBlockersOn"); + else + text = GetTextValue("Items.Misc.SpawnBlockersOff"); + tooltips.FindAndReplace("[STATE]", text); } public override void AddRecipes() diff --git a/Items/BrimstoneLocus.cs b/Items/BrimstoneLocus.cs index 8a883d04e5..cb7ab3a98b 100644 --- a/Items/BrimstoneLocus.cs +++ b/Items/BrimstoneLocus.cs @@ -16,10 +16,10 @@ namespace CalamityMod.Items Item.value = 0; } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.ToolsOther; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.ToolsOther; + } public override void AddRecipes() { diff --git a/Items/BrokenWaterFilter.cs b/Items/BrokenWaterFilter.cs index 7bde69df31..c4fe0204bc 100644 --- a/Items/BrokenWaterFilter.cs +++ b/Items/BrokenWaterFilter.cs @@ -1,30 +1,95 @@ using CalamityMod.Items.Materials; -using Terraria.ID; using Terraria; +using Terraria.ID; using Terraria.ModLoader; +using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework; +using System.Collections.Generic; +using static CalamityMod.CalamityUtils; namespace CalamityMod.Items { public class BrokenWaterFilter : ModItem, ILocalizedModType { + public static bool state = false; public new string LocalizationCategory => "Items.Misc"; public override void SetDefaults() { Item.width = 32; Item.height = 34; - Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.rare = ItemRarityID.Blue; } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.SpawnPrevention; - } - - public override void UpdateInventory(Player player) + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) { - if (Item.favorited) + itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.SpawnPrevention; + } + + public override bool CanRightClick() => true; + + public override void RightClick(Player player) + { + if (player.Calamity().noStupidNaturalARSpawns == true) + player.Calamity().noStupidNaturalARSpawns = false; + else player.Calamity().noStupidNaturalARSpawns = true; + Item.NetStateChanged(); + state = player.Calamity().noStupidNaturalARSpawns; + + bool favorited = Item.favorited; + Item.SetDefaults(ModContent.ItemType()); + Item.stack++; + Item.favorited = favorited; + } + + /* + public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frameI, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + Texture2D texture; + + if (state) + { + //Replace with enabled texture + texture = ModContent.Request("CalamityMod/Items/BrokenWaterFilter").Value; + spriteBatch.Draw(texture, position, null, Color.White, 0f, origin, scale, SpriteEffects.None, 0); + } + else + { + texture = ModContent.Request("CalamityMod/Items/BrokenWaterFilter").Value; + spriteBatch.Draw(texture, position, null, Color.White, 0f, origin, scale, SpriteEffects.None, 0); + } + + return false; + } + + public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) + { + Texture2D texture; + + if (state) + { + //Replace with enabled texture + texture = ModContent.Request("CalamityMod/Items/BrokenWaterFilter").Value; + spriteBatch.Draw(texture, Item.position - Main.screenPosition, null, lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); + } + else + { + texture = ModContent.Request("CalamityMod/Items/BrokenWaterFilter").Value; + spriteBatch.Draw(texture, Item.position - Main.screenPosition, null, lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); + } + return false; + } + */ + + public override void ModifyTooltips(List tooltips) + { + string text; + if (state == true) + text = GetTextValue("Items.Misc.SpawnBlockersOn"); + else + text = GetTextValue("Items.Misc.SpawnBlockersOff"); + tooltips.FindAndReplace("[STATE]", text); } public override void AddRecipes() diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index d1bf4f9242..3aa3cafddf 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -1,12 +1,11 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.Potions; +using System; +using System.IO; using CalamityMod.Buffs.StatBuffs; +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.CalPlayer; using CalamityMod.Enums; using CalamityMod.Events; using CalamityMod.Items.Accessories; -using CalamityMod.Items.Placeables; -using CalamityMod.Items.Potions; using CalamityMod.Items.VanillaArmorChanges; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Summon; @@ -25,9 +24,6 @@ using CalamityMod.UI.CalamitasEnchants; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; -using CalamityMod.Buffs.StatDebuffs; using Terraria; using Terraria.Audio; using Terraria.DataStructures; @@ -36,7 +32,6 @@ using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.IO; using Terraria.Utilities; -using CalamityMod.Items.Potions.Alcohol; namespace CalamityMod.Items { @@ -45,7 +40,6 @@ namespace CalamityMod.Items public override bool InstancePerEntity => true; // TODO -- split out a separate GlobalItem for rogue behavior? - internal float StealthGenBonus; internal float StealthStrikePrefixBonus; #region Chargeable Item Variables @@ -93,7 +87,6 @@ namespace CalamityMod.Items public CalamityGlobalItem() { - StealthGenBonus = 1f; StealthStrikePrefixBonus = 0f; } @@ -109,7 +102,6 @@ namespace CalamityMod.Items CalamityGlobalItem myClone = (CalamityGlobalItem)base.Clone(item, itemClone); // Rogue - myClone.StealthGenBonus = StealthGenBonus; myClone.StealthStrikePrefixBonus = StealthStrikePrefixBonus; // Charge (Draedon's Arsenal) @@ -168,6 +160,10 @@ namespace CalamityMod.Items if (item.type == ItemID.PearlwoodBow || item.type == ItemID.PearlwoodHammer || item.type == ItemID.PearlwoodSword) item.rare = ItemRarityID.LightRed; + //Flame Waker Boots are no longer just vanity and therefore lose the vanity tooltip. + if (item.type == ItemID.FlameWakerBoots) + item.vanity = false; + // Volatile Gelatin is pre-mech post-WoF so it should use the pink rarity. if (item.type == ItemID.VolatileGelatin) item.rare = ItemRarityID.Pink; @@ -204,6 +200,10 @@ namespace CalamityMod.Items break; } + // Allow Beam Sword to change direction when it fires, because vanilla disables it for some reason. + if (item.type == ItemID.BeamSword) + item.ChangePlayerDirectionOnShoot = true; + // Apply Calamity Global Item Tweaks. SetDefaults_ApplyTweaks(item); @@ -437,20 +437,20 @@ namespace CalamityMod.Items modPlayer.canFireAtaxiaRogueProjectile = false; int flareID = ModContent.ProjectileType(); - // Ataxia Rogue Flares: 8 x 50%, soft cap starts at 120 base damage - int flareDamage = CalamityUtils.DamageSoftCap(damage * 0.5, 120); + // Ataxia Rogue Flares: 6 x 50%, soft cap starts at 90 base damage + int flareDamage = CalamityUtils.DamageSoftCap(damage * 0.5, 90); flareDamage = player.ApplyArmorAccDamageBonusesTo(flareDamage); if (player.whoAmI == Main.myPlayer) { SoundEngine.PlaySound(SoundID.Item20, player.Center); - float spread = 45f * 0.0174f; + float spread = 60f * 0.0174f; double startAngle = Math.Atan2(player.velocity.X, player.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; + double deltaAngle = spread / 6f; double offsetAngle; - for (int i = 0; i < 4; i++) + for (int i = 0; i < 3; i++) { - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; + offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 30f * i; Projectile.NewProjectile(source, player.Center.X, player.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), flareID, flareDamage, 1f, player.whoAmI); Projectile.NewProjectile(source, player.Center.X, player.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), flareID, flareDamage, 1f, player.whoAmI); } @@ -473,25 +473,6 @@ namespace CalamityMod.Items } } } - if (modPlayer.dynamoStemCells) - { - if (item.CountsAsClass() && Main.rand.NextBool(20) && !item.channel) - { - double damageMult = item.useTime / 30D; - if (damageMult < 0.35) - damageMult = 0.35; - - int newDamage = (int)(damage * 2 * damageMult); - newDamage = player.ApplyArmorAccDamageBonusesTo(newDamage); - - if (player.whoAmI == Main.myPlayer) - { - int projectile = Projectile.NewProjectile(source, position, velocity * 1.25f, ModContent.ProjectileType(), newDamage, 2f, player.whoAmI); - if (projectile.WithinBounds(Main.maxProjectiles)) - Main.projectile[projectile].DamageType = DamageClass.Generic; - } - } - } if (modPlayer.prismaticRegalia) { if (item.CountsAsClass() && Main.rand.NextBool(20) && !item.channel) @@ -503,7 +484,8 @@ namespace CalamityMod.Items if (i != 0) { Vector2 perturbedSpeed = velocity.RotatedBy(MathHelper.ToRadians(i)); - int rocket = Projectile.NewProjectile(source, position, perturbedSpeed, ModContent.ProjectileType(), (int)(damage * 0.25), 2f, player.whoAmI); + int rocket = Projectile.NewProjectile(source, position, perturbedSpeed, ModContent.ProjectileType(), (int)(damage * 0.25), 2f, player.whoAmI, 0, 12f); + //First extra value is rocket type which I just used 0 to get the default, second is the velocity I went with my gut feeling and got quite close to Scorpio's velocity with Rockets I if (rocket.WithinBounds(Main.maxProjectiles)) Main.projectile[rocket].DamageType = DamageClass.Generic; } @@ -511,14 +493,14 @@ namespace CalamityMod.Items } } } - if (modPlayer.harpyWingBoost && modPlayer.harpyRing) + if (modPlayer.harpyWingBoost && (modPlayer.harpyRing || modPlayer.angelTreads)) { if (Main.rand.NextBool(5) && !item.channel) { if (player.whoAmI == Main.myPlayer) { float spreadX = velocity.X + Main.rand.NextFloat(-0.75f, 0.75f); - float spreadY = velocity.X + Main.rand.NextFloat(-0.75f, 0.75f); + float spreadY = velocity.Y + Main.rand.NextFloat(-0.75f, 0.75f); int feather = Projectile.NewProjectile(source, position, new Vector2(spreadX, spreadY) * 1.25f, ModContent.ProjectileType(), (int)(damage * 0.3), 2f, player.whoAmI); if (feather.WithinBounds(Main.maxProjectiles)) { @@ -662,6 +644,28 @@ namespace CalamityMod.Items NetMessage.SendData(MessageID.MoonlordHorror, -1, -1, null, NPC.MoonLordCountdown); } + // Staff/Axe of Regrowth growing Calamity grass + if (item.type == ItemID.StaffofRegrowth || item.type == ItemID.AcornAxe) + { + Tile tile = Framing.GetTileSafely(Player.tileTargetX, Player.tileTargetY); + Tile tileAbove = Framing.GetTileSafely(Player.tileTargetX, Player.tileTargetY - 1); + + if (tile.HasTile && !tileAbove.HasTile && tileAbove.LiquidAmount == 0 && tile.TileType == ModContent.TileType() && player.IsInTileInteractionRange(Player.tileTargetX, Player.tileTargetY, TileReachCheckSettings.Simple)) + { + Main.tile[Player.tileTargetX, Player.tileTargetY].TileType = (ushort)ModContent.TileType(); + + SoundEngine.PlaySound(SoundID.Dig, player.Center); + return true; + } + else if (tile.HasTile && tile.TileType == ModContent.TileType() && player.IsInTileInteractionRange(Player.tileTargetX, Player.tileTargetY, TileReachCheckSettings.Simple)) + { + Main.tile[Player.tileTargetX, Player.tileTargetY].TileType = (ushort)ModContent.TileType(); + + SoundEngine.PlaySound(SoundID.Dig, player.Center); + return true; + } + } + return base.UseItem(item, player); } @@ -918,12 +922,22 @@ namespace CalamityMod.Items return MathHelper.Lerp(DischargeEnchantMinDamageFactor, DischargeEnchantMaxDamageFactor, interpolant); } - // This formula gives a slightly higher value than 1.0 above 85% charge, and a slightly lower value than 0.0 at 0% charge. - // Specifically, it gives 0.0 or less at 0.36% charge or lower. This is fine because the result is immediately clamped. + // 07MAY2024: Ozzatron: adjusted charge formula again to more closely match previous behavior + // old formula: 1.087 - 0.08 / (x + 0.07) + // new formula: 1.08 - 0.04 / (x + 0.06) + // + // Intended behavior: Any charge above 50% guarantees 100% damage, so charge weapons are easy to use + // Actual behavior: + // 44%+ charge = 100% damage + // 20% charge = 92.6% damage + // 10% charge = 83% damage + // 0% charge = 41.33% damage + // + // Fabsol - I changed this formula because it was bad and confusing, and I had promised to do so a while ago. internal float ChargeDamageFormula() { float x = MathHelper.Clamp(ChargeRatio, 0f, 1f); - float y = 1.087f - 0.08f / (x + 0.07f); + float y = 1.08f - 0.04f / (x + 0.06f); return MathHelper.Clamp(y, 0f, 1f); } #endregion @@ -935,6 +949,10 @@ namespace CalamityMod.Items if (!string.IsNullOrEmpty(managedArmorSetName)) return managedArmorSetName; + if (head.type == ItemID.WizardHat && (body.type == ItemID.AmethystRobe || body.type == ItemID.TopazRobe || body.type == ItemID.SapphireRobe || body.type == ItemID.EmeraldRobe || body.type == ItemID.RubyRobe || body.type == ItemID.DiamondRobe || body.type == ItemID.AmberRobe)) + return "WizardHat"; + if (head.type == ItemID.MagicHat && (body.type == ItemID.AmethystRobe || body.type == ItemID.TopazRobe || body.type == ItemID.SapphireRobe || body.type == ItemID.EmeraldRobe || body.type == ItemID.RubyRobe || body.type == ItemID.DiamondRobe || body.type == ItemID.AmberRobe)) + return "MagicHat"; if (head.type == ItemID.CrystalNinjaHelmet && body.type == ItemID.CrystalNinjaChestplate && legs.type == ItemID.CrystalNinjaLeggings) return "CrystalAssassin"; if (head.type == ItemID.SquireGreatHelm && body.type == ItemID.SquirePlating && legs.type == ItemID.SquireGreaves) @@ -962,8 +980,17 @@ namespace CalamityMod.Items { CalamityPlayer modPlayer = player.Calamity(); VanillaArmorChangeManager.CreateTooltipManuallyAsNecessary(player); - VanillaArmorChangeManager.ApplyPotentialEffectsTo(player); + if (set == "WizardHat") + { + player.GetCritChance() -= 6; + player.setBonus = CalamityUtils.GetTextValue("Vanilla.Armor.SetBonus.Wizard"); + } + if (set == "MagicHat") + { + player.statManaMax2 -= 20; + player.setBonus = CalamityUtils.GetTextValue("Vanilla.Armor.SetBonus.MagicHat"); + } if (set == "CrystalAssassin") { player.setBonus = CalamityUtils.GetTextValue("Vanilla.Armor.SetBonus.CrystalAssassin"); @@ -1017,11 +1044,15 @@ namespace CalamityMod.Items } else if (set == "SpectreHealing") { - player.GetDamage() += 0.2f; + player.GetDamage() += 0.4f; player.setBonus = CalamityUtils.GetTextValue("Vanilla.Armor.SetBonus.SpectreHealing"); } else if (set == "SolarFlare") { + // Cancel out the base 12% DR + player.endurance -= 0.12f; + + // Solar Flare armor dash overrides modded dashes by default if (player.solarShields > 0) modPlayer.DashID = string.Empty; } @@ -1034,8 +1065,35 @@ namespace CalamityMod.Items switch (item.type) { case ItemID.MagicHat: - player.GetDamage() -= 0.01f; - player.GetCritChance() -= 1; + player.GetDamage() -= 0.06f; + break; + + case ItemID.AmethystRobe: + player.manaCost += 0.01f; // 5% to 4% + break; + + case ItemID.TopazRobe: + player.statManaMax2 -= 20; + player.manaCost += 0.02f; // 7% to 5% + break; + + case ItemID.SapphireRobe: + player.manaCost += 0.03f; // 9% to 6% + break; + + case ItemID.EmeraldRobe: + player.statManaMax2 -= 20; + player.manaCost += 0.04f; // 11% to 7% + break; + + case ItemID.RubyRobe: + case ItemID.AmberRobe: + player.manaCost += 0.05f; // 13% to 8% + break; + + case ItemID.DiamondRobe: + player.statManaMax2 -= 20; + player.manaCost += 0.06f; // 15% to 9% break; case ItemID.Gi: @@ -1099,6 +1157,15 @@ namespace CalamityMod.Items player.GetDamage() -= 0.1f; player.GetCritChance() -= 15; break; + + case ItemID.SolarFlareHelmet: + player.GetCritChance() -= 6; + break; + + case ItemID.VortexHelmet: + player.GetDamage() -= 0.06f; + player.GetCritChance() -= 2; + break; } } #endregion @@ -1108,15 +1175,6 @@ namespace CalamityMod.Items { CalamityPlayer modPlayer = player.Calamity(); - if (item.prefix > 0) - { - float stealthGenBoost = item.Calamity().StealthGenBonus - 1f; - if (stealthGenBoost > 0) - { - modPlayer.accStealthGenBoost += stealthGenBoost; - } - } - // Obsidian Skull and its upgrades make you immune to On Fire! if (item.type == ItemID.ObsidianSkull || item.type == ItemID.ObsidianHorseshoe || item.type == ItemID.ObsidianShield || item.type == ItemID.ObsidianWaterWalkingBoots || item.type == ItemID.LavaWaders || item.type == ItemID.ObsidianSkullRose || item.type == ItemID.MoltenCharm || item.type == ItemID.LavaSkull || item.type == ItemID.MoltenSkullRose || item.type == ItemID.AnkhShield) player.buffImmune[BuffID.OnFire] = true; @@ -1125,9 +1183,18 @@ namespace CalamityMod.Items if (item.type == ItemID.AnkhShield) player.buffImmune[BuffID.WindPushed] = true; + if (item.type == ItemID.FlameWakerBoots) + { + modPlayer.flameWakerBoots = true; + if (modPlayer.bootLevel < 1) + modPlayer.bootLevel = 1; + } + if (item.type == ItemID.HellfireTreads) { modPlayer.hellfireTreads = true; + if (modPlayer.bootLevel < 2) + modPlayer.bootLevel = 2; player.buffImmune[BuffID.OnFire] = true; } @@ -1145,9 +1212,13 @@ namespace CalamityMod.Items if (item.type == ItemID.FairyBoots) modPlayer.fairyBoots = true; - // Arcane and Magnet Flower buffs - if (item.type == ItemID.ArcaneFlower || item.type == ItemID.MagnetFlower) + // Mana Flower tinker buffs + if (item.type == ItemID.MagnetFlower) + player.manaCost -= 0.02f; + if (item.type == ItemID.ArcaneFlower || item.type == ItemID.ManaCloak) player.manaCost -= 0.04f; + if (item.type == ItemID.ArcaneFlower) + player.GetDamage() += 0.05f; if (item.type == ItemID.SniperScope) { @@ -1165,7 +1236,7 @@ namespace CalamityMod.Items { player.GetDamage() += 0.02f; } - + // Feral Claws line melee speed adjustments and nonstacking // First removes all their melee speed so it can be given based on which you wear without stacking if (item.type == ItemID.FeralClaws) @@ -1203,39 +1274,39 @@ namespace CalamityMod.Items if (item.type == ItemID.SunStone) { if (Main.dayTime) - player.GetAttackSpeed() -= 0.1f; + player.GetAttackSpeed() -= 0.1f; } - + if (item.type == ItemID.MoonStone) { if (!Main.dayTime) - player.GetAttackSpeed() -= 0.1f; + player.GetAttackSpeed() -= 0.1f; } - + if (item.type == ItemID.CelestialStone) { player.GetAttackSpeed() -= 0.1f; } - + if (item.type == ItemID.CelestialShell) { player.GetAttackSpeed() -= 0.1f; if (!Main.dayTime) - player.GetAttackSpeed() -= 0.051f; + player.GetAttackSpeed() -= 0.051f; } //Moon Charm and Moon Shell melee speed removal - + if (item.type == ItemID.MoonCharm) - { + { if (!Main.dayTime) - player.GetAttackSpeed() -= 0.051f; + player.GetAttackSpeed() -= 0.051f; } if (item.type == ItemID.MoonShell) - { + { if (!Main.dayTime) - player.GetAttackSpeed() -= 0.051f; + player.GetAttackSpeed() -= 0.051f; } if (item.type == ItemID.TerrasparkBoots) @@ -1256,7 +1327,8 @@ namespace CalamityMod.Items } else if (item.type == ItemID.FinWings) // Boosted water abilities, faster fall in water { - player.gills = true; + if (player.IsUnderwater()) + player.gills = true; player.ignoreWater = true; player.noFallDmg = true; if (!player.mount.Active) @@ -1384,7 +1456,7 @@ namespace CalamityMod.Items player.AddBuff(BuffID.DryadsWard, 5, true); // Dryad's Blessing } } - else if (item.type == ItemID.FestiveWings) // Drop powerful homing christmas tree bulbs while in flight + else if (item.type == ItemID.FestiveWings) // Drop homing christmas tree bulbs while in flight { player.noFallDmg = true; player.statLifeMax2 += 40; @@ -1393,13 +1465,13 @@ namespace CalamityMod.Items var source = player.GetSource_Accessory(item); if (player.controlJump && player.jump == 0 && player.velocity.Y != 0f && !player.mount.Active && !player.mount.Cart) { - int ornamentDamage = (int)player.GetBestClassDamage().ApplyTo(100); + int ornamentDamage = (int)player.GetBestClassDamage().ApplyTo(50); int p = Projectile.NewProjectile(source, player.Center, Vector2.UnitY * 2f, ProjectileID.OrnamentFriendly, ornamentDamage, 5f, player.whoAmI); if (p.WithinBounds(Main.maxProjectiles)) { Main.projectile[p].DamageType = DamageClass.Generic; Main.projectile[p].Calamity().lineColor = 1; - modPlayer.icicleCooldown = 10; + modPlayer.icicleCooldown = 15; } } } @@ -1480,7 +1552,7 @@ namespace CalamityMod.Items modPlayer.fleshKnuckles = true; if (item.type == ItemID.WormScarf) - player.endurance -= 0.07f; + player.endurance -= 0.03f; if (item.type == ItemID.RoyalGel) modPlayer.royalGel = true; @@ -1528,29 +1600,6 @@ namespace CalamityMod.Items #endregion #region Ammo - public override void PickAmmo(Item weapon, Item ammo, Player player, ref int type, ref float speed, ref StatModifier damage, ref float knockback) - { - // Sandgun with Calamity sands work like vanilla non-plain sand, +5 flat damage - if (weapon.type == ItemID.Sandgun) - { - if (ammo.type == ModContent.ItemType()) - { - type = ModContent.ProjectileType(); - damage.Flat += 5; - } - else if (ammo.type == ModContent.ItemType()) - { - type = ModContent.ProjectileType(); - damage.Flat += 5; - } - else if (ammo.type == ModContent.ItemType()) - { - type = ModContent.ProjectileType(); - damage.Flat += 5; - } - } - } - public override bool CanConsumeAmmo(Item weapon, Item ammo, Player player) => Main.rand.NextFloat() <= player.Calamity().rangedAmmoCost; public static bool HasEnoughAmmo(Player player, Item item, int ammoConsumed) @@ -1683,8 +1732,8 @@ namespace CalamityMod.Items #region On Create public override void OnCreated(Item item, ItemCreationContext context) { - // ChoosePrefix also happens on craft so go reset it here too - storedPrefix = -1; + // ChoosePrefix also happens on craft so go reset it here too + storedPrefix = -1; } #endregion @@ -1692,7 +1741,6 @@ namespace CalamityMod.Items private static int storedPrefix = -1; public override void PreReforge(Item item) { - StealthGenBonus = 1f; StealthStrikePrefixBonus = 0f; storedPrefix = item.prefix; } @@ -1702,14 +1750,14 @@ namespace CalamityMod.Items // removed data saved on items; reforging is now a coalescing flowchart that has no RNG public override int ChoosePrefix(Item item, UnifiedRandom rand) { - if (storedPrefix == -1 && item.CountsAsClass() && (item.maxStack == 1 || item.AllowReforgeForStackableItem)) - { - // Crafting (or first reforge of) a rogue weapon has a 75% chance for a random modifier, this check is done by vanilla - // Negative modifiers have a 66.66% chance of being voided, Annoying modifier is intentionally ignored by vanilla - int prefix = CalamityUtils.RandomRoguePrefix(); - bool keepPrefix = !CalamityUtils.NegativeRoguePrefix(prefix) || Main.rand.NextBool(3); - return keepPrefix ? prefix : 0; - } + if (storedPrefix == -1 && item.CountsAsClass() && (item.maxStack == 1 || item.AllowReforgeForStackableItem)) + { + // Crafting (or first reforge of) a rogue weapon has a 75% chance for a random modifier, this check is done by vanilla + // Negative modifiers have a 66.66% chance of being voided, Annoying modifier is intentionally ignored by vanilla + int prefix = CalamityUtils.RandomRoguePrefix(); + bool keepPrefix = !CalamityUtils.NegativeRoguePrefix(prefix) || Main.rand.NextBool(3); + return keepPrefix ? prefix : 0; + } if (!CalamityConfig.Instance.RemoveReforgeRNG || Main.gameMenu || storedPrefix == -1) return -1; @@ -1739,91 +1787,103 @@ namespace CalamityMod.Items } #endregion - #region Money From Rarity - public static readonly int Rarity0BuyPrice = Item.buyPrice(0, 0, 50, 0); - public static readonly int Rarity1BuyPrice = Item.buyPrice(0, 1, 0, 0); - public static readonly int Rarity2BuyPrice = Item.buyPrice(0, 2, 0, 0); - public static readonly int Rarity3BuyPrice = Item.buyPrice(0, 4, 0, 0); - public static readonly int Rarity4BuyPrice = Item.buyPrice(0, 12, 0, 0); - public static readonly int Rarity5BuyPrice = Item.buyPrice(0, 24, 0, 0); - public static readonly int Rarity6BuyPrice = Item.buyPrice(0, 36, 0, 0); - public static readonly int Rarity7BuyPrice = Item.buyPrice(0, 48, 0, 0); - public static readonly int Rarity8BuyPrice = Item.buyPrice(0, 60, 0, 0); - public static readonly int Rarity9BuyPrice = Item.buyPrice(0, 80, 0, 0); - public static readonly int Rarity10BuyPrice = Item.buyPrice(1, 0, 0, 0); - public static readonly int Rarity11BuyPrice = Item.buyPrice(1, 10, 0, 0); - public static readonly int Rarity12BuyPrice = Item.buyPrice(1, 20, 0, 0); - public static readonly int Rarity13BuyPrice = Item.buyPrice(1, 30, 0, 0); - public static readonly int Rarity14BuyPrice = Item.buyPrice(1, 40, 0, 0); - public static readonly int Rarity15BuyPrice = Item.buyPrice(1, 50, 0, 0); - public static readonly int Rarity16BuyPrice = Item.buyPrice(2, 0, 0, 0); + #region Rarity Price Table + // Base numeric rarity pricing guide. + private static readonly int Rarity0BuyPrice = Item.buyPrice(0, 0, 50, 0); + private static readonly int Rarity1BuyPrice = Item.buyPrice(0, 1, 0, 0); + private static readonly int Rarity2BuyPrice = Item.buyPrice(0, 2, 0, 0); + private static readonly int Rarity3BuyPrice = Item.buyPrice(0, 4, 0, 0); + private static readonly int Rarity4BuyPrice = Item.buyPrice(0, 12, 0, 0); + private static readonly int Rarity5BuyPrice = Item.buyPrice(0, 24, 0, 0); + private static readonly int Rarity6BuyPrice = Item.buyPrice(0, 36, 0, 0); + private static readonly int Rarity7BuyPrice = Item.buyPrice(0, 48, 0, 0); + private static readonly int Rarity8BuyPrice = Item.buyPrice(0, 60, 0, 0); + private static readonly int Rarity9BuyPrice = Item.buyPrice(0, 80, 0, 0); + private static readonly int Rarity10BuyPrice = Item.buyPrice(1, 0, 0, 0); // Highest raw rarity used by vanilla items (ML drops) + private static readonly int Rarity11BuyPrice = Item.buyPrice(1, 20, 0, 0); // End of vanilla rarities + private static readonly int Rarity12BuyPrice = Item.buyPrice(1, 50, 0, 0); + private static readonly int Rarity13BuyPrice = Item.buyPrice(1, 75, 0, 0); + private static readonly int Rarity14BuyPrice = Item.buyPrice(2, 0, 0, 0); + private static readonly int Rarity15BuyPrice = Item.buyPrice(2, 40, 0, 0); + private static readonly int Rarity16BuyPrice = Item.buyPrice(2, 80, 0, 0); + private static readonly int Rarity17BuyPrice = Item.buyPrice(3, 20, 0, 0); // This is Calamity's "plus" rarity (similar to vanilla 11 / Purple). Nothing uses it. - public static readonly int RarityWhiteBuyPrice = Item.buyPrice(0, 0, 50, 0); - public static readonly int RarityBlueBuyPrice = Item.buyPrice(0, 1, 0, 0); - public static readonly int RarityGreenBuyPrice = Item.buyPrice(0, 2, 0, 0); - public static readonly int RarityOrangeBuyPrice = Item.buyPrice(0, 4, 0, 0); - public static readonly int RarityLightRedBuyPrice = Item.buyPrice(0, 12, 0, 0); - public static readonly int RarityPinkBuyPrice = Item.buyPrice(0, 24, 0, 0); - public static readonly int RarityLightPurpleBuyPrice = Item.buyPrice(0, 36, 0, 0); - public static readonly int RarityLimeBuyPrice = Item.buyPrice(0, 48, 0, 0); - public static readonly int RarityYellowBuyPrice = Item.buyPrice(0, 60, 0, 0); - public static readonly int RarityCyanBuyPrice = Item.buyPrice(0, 80, 0, 0); - public static readonly int RarityRedBuyPrice = Item.buyPrice(1, 0, 0, 0); - public static readonly int RarityPurpleBuyPrice = Item.buyPrice(1, 10, 0, 0); - public static readonly int RarityTurquoiseBuyPrice = Item.buyPrice(1, 20, 0, 0); - public static readonly int RarityPureGreenBuyPrice = Item.buyPrice(1, 30, 0, 0); - public static readonly int RarityDarkBlueBuyPrice = Item.buyPrice(1, 40, 0, 0); - public static readonly int RarityVioletBuyPrice = Item.buyPrice(1, 50, 0, 0); - public static readonly int RarityHotPinkBuyPrice = Item.buyPrice(2, 0, 0, 0); + private static readonly int[] RarityBuyPriceArray = new int[] { + Rarity0BuyPrice, + Rarity1BuyPrice, + Rarity2BuyPrice, + Rarity3BuyPrice, + Rarity4BuyPrice, + Rarity5BuyPrice, + Rarity6BuyPrice, + Rarity7BuyPrice, + Rarity8BuyPrice, + Rarity9BuyPrice, + Rarity10BuyPrice, + Rarity11BuyPrice, + Rarity12BuyPrice, + Rarity13BuyPrice, + Rarity14BuyPrice, + Rarity15BuyPrice, + Rarity16BuyPrice, + Rarity17BuyPrice, + }; + // Canonical names which are implemented as properties that reference the base numeric rarity prices. + // Also serves as a convenient counter for the number of items Calamity adds of each rarity. + public static int RarityWhiteBuyPrice => Rarity0BuyPrice; + public static int RarityBlueBuyPrice => Rarity1BuyPrice; + public static int RarityGreenBuyPrice => Rarity2BuyPrice; + public static int RarityOrangeBuyPrice => Rarity3BuyPrice; + public static int RarityLightRedBuyPrice => Rarity4BuyPrice; + public static int RarityPinkBuyPrice => Rarity5BuyPrice; + public static int RarityLightPurpleBuyPrice => Rarity6BuyPrice; + public static int RarityLimeBuyPrice => Rarity7BuyPrice; + public static int RarityYellowBuyPrice => Rarity8BuyPrice; + public static int RarityCyanBuyPrice => Rarity9BuyPrice; + public static int RarityRedBuyPrice => Rarity10BuyPrice; + public static int RarityPurpleBuyPrice => Rarity11BuyPrice; + public static int RarityTurquoiseBuyPrice => Rarity12BuyPrice; + public static int RarityPureGreenBuyPrice => Rarity13BuyPrice; + public static int RarityDarkBlueBuyPrice => Rarity14BuyPrice; + public static int RarityVioletBuyPrice => Rarity15BuyPrice; + public static int RarityHotPinkBuyPrice => Rarity16BuyPrice; + public static int RarityCalamityRedBuyPrice => Rarity17BuyPrice; + #endregion + + // + // !! WARNING !! + // + // 17APR2024: Ozzatron: + // THESE FUNCTIONS MAY SHOW ZERO REFERENCES BUT ARE ACTIVELY USED BY MULTIPLE CALAMITY ADDONS, INCLUDING CATALYST. + // DO NOT TOUCH. IF YOU DO, THESE ADDONS WILL BREAK! + // + #region Rarity / Price Helper Functions public static int GetBuyPrice(int rarity) { - switch (rarity) - { - case 0: - return Rarity0BuyPrice; - case 1: - return Rarity1BuyPrice; - case 2: - return Rarity2BuyPrice; - case 3: - return Rarity3BuyPrice; - case 4: - return Rarity4BuyPrice; - case 5: - return Rarity5BuyPrice; - case 6: - return Rarity6BuyPrice; - case 7: - return Rarity7BuyPrice; - case 8: - return Rarity8BuyPrice; - case 9: - return Rarity9BuyPrice; - case 10: - return Rarity10BuyPrice; - case 11: - return Rarity11BuyPrice; - } - if (rarity == ModContent.RarityType()) - return RarityTurquoiseBuyPrice; - if (rarity == ModContent.RarityType()) - return RarityPureGreenBuyPrice; - if (rarity == ModContent.RarityType()) - return RarityDarkBlueBuyPrice; - if (rarity == ModContent.RarityType()) - return RarityVioletBuyPrice; - if (rarity == ModContent.RarityType()) - return RarityHotPinkBuyPrice; + // Vanilla rarities go directly to the array. + if (rarity >= ItemRarityID.White && rarity <= ItemRarityID.Purple) + return RarityBuyPriceArray[rarity]; - // Return 0 if it's not a progression based or other mod's rarity - return 0; + // Calamity rarities aren't guaranteed to have the monotonic IDs, so they're handled directly. + if (rarity == ModContent.RarityType()) + return RarityTurquoiseBuyPrice; + if (rarity == ModContent.RarityType()) + return RarityPureGreenBuyPrice; + if (rarity == ModContent.RarityType()) + return RarityDarkBlueBuyPrice; + if (rarity == ModContent.RarityType()) + return RarityVioletBuyPrice; + if (rarity == ModContent.RarityType()) + return RarityHotPinkBuyPrice; + if (rarity == ModContent.RarityType()) + return RarityCalamityRedBuyPrice; + + // Return 0 if it's not a progression based or other mod's rarity + return 0; } - public static int GetBuyPrice(Item item) - { - return GetBuyPrice(item.rare); - } + public static int GetBuyPrice(Item item) => GetBuyPrice(item.rare); #endregion } } diff --git a/Items/CalamityGlobalItemLoot.cs b/Items/CalamityGlobalItemLoot.cs index 43a2861c81..12b004b8cd 100644 --- a/Items/CalamityGlobalItemLoot.cs +++ b/Items/CalamityGlobalItemLoot.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items return false; return (NPC.downedMechBoss1.ToInt() + NPC.downedMechBoss2.ToInt() + NPC.downedMechBoss3.ToInt()) >= 2; } - + switch (item.type) { #region Boss Treasure Bags @@ -132,6 +132,7 @@ namespace CalamityMod.Items case ItemID.QueenSlimeBossBag: loot.Add(ItemID.SoulofLight, 1, 15, 20); // 100% 15-20 Soul of Light + loot.Add(ItemID.PinkGel, 1, 15, 20); // 100% 15-20 Pink Gel loot.AddRevBagAccessories(); loot.Add(ModContent.ItemType(), ThankYouPainting.DropInt); break; @@ -263,8 +264,8 @@ namespace CalamityMod.Items loot.AddRevBagAccessories(); loot.Add(ModContent.ItemType(), ThankYouPainting.DropInt); - // The Celestial Onion only drops if the player hasn't used one. - loot.AddIf((info) => !info.player.Calamity().extraAccessoryML, ModContent.ItemType()); + // The Celestial Onion only drops if the player hasn't used one, or if the world is not in Master Mode. + loot.AddIf((info) => !info.player.Calamity().extraAccessoryML && !Main.masterMode, ModContent.ItemType()); break; #endregion @@ -309,7 +310,7 @@ namespace CalamityMod.Items case ItemID.DungeonFishingCrate: case ItemID.DungeonFishingCrateHard: loot.AddIf(() => NPC.downedPlantBoss, ItemID.Ectoplasm, 10, 1, 5); // 10% 1-5 Ectoplasm - loot.AddIf(() => DownedBossSystem.downedPolterghast, ModContent.ItemType(), 10, 1, 5); // 10% 1-5 Polterplasm + loot.AddIf(() => DownedBossSystem.downedPolterghast, ModContent.ItemType(), 10, 1, 5); // 10% 1-5 Necroplasm break; case ItemID.JungleFishingCrate: @@ -362,7 +363,7 @@ namespace CalamityMod.Items case ItemID.GoodieBag: RemoveBatHookFromGoodieBag(loot); break; - #endregion + #endregion } } #endregion diff --git a/Items/CalamityGlobalItemTooltip.cs b/Items/CalamityGlobalItemTooltip.cs index d30d1425f6..cd54a2ced8 100644 --- a/Items/CalamityGlobalItemTooltip.cs +++ b/Items/CalamityGlobalItemTooltip.cs @@ -1,4 +1,8 @@ -using CalamityMod.Balancing; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using CalamityMod.Balancing; using CalamityMod.CustomRecipes; using CalamityMod.Items.Accessories; using CalamityMod.Items.Armor.Demonshade; @@ -12,10 +16,6 @@ using CalamityMod.Items.Weapons.Summon; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; using Terraria; using Terraria.ID; using Terraria.Localization; @@ -37,10 +37,6 @@ namespace CalamityMod.Items // Modify all vanilla tooltips before appending mod mechanics (if any). ModifyVanillaTooltips(item, tooltips); - // If the item has a stealth generation prefix, show that on the tooltip. - // This is placed between vanilla tooltip edits and mod mechanics because it can apply to vanilla items. - StealthGenAccessoryTooltip(item, tooltips); - // Adds "Does extra damage to enemies shot at point-blank range" to weapons capable of it. if (canFirePointBlankShots) { @@ -48,9 +44,6 @@ namespace CalamityMod.Items tooltips.Add(line); } - // If the item has a stealth strike damage prefix, show that on the tooltip. - StealthWeaponTooltip(item, tooltips); - // 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); @@ -92,7 +85,13 @@ namespace CalamityMod.Items #region Rarity Coloration private void ApplyRarityColor(Item item, TooltipLine nameLine) { - #region Uniquely Colored Developer Items + #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()) + nameLine.OverrideColor = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB); + + // Developer items if (item.type == ModContent.ItemType()) nameLine.OverrideColor = new Color(Main.DiscoR, 100, 255); if (item.type == ModContent.ItemType()) @@ -259,6 +258,10 @@ namespace CalamityMod.Items // Numerous random tooltip edits which don't fit into another category #region Various Tooltip Edits + // Lilies of Finality 512 edit + if (item.type == ModContent.ItemType()) + EditTooltipByName("Damage", (line) => line.Text = LiliesOfFinality.TheNumber + " summon damage"); + // 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)) @@ -284,22 +287,11 @@ namespace CalamityMod.Items if (item.type == ItemID.AnkhShield) EditTooltipByNum(1, (line) => line.Text += ", including Mighty Wind"); - // Water removing items cannot be used in the Abyss - string noAbyssLine = "\nCannot be used in the Abyss"; - if (item.type == ItemID.SuperAbsorbantSponge) - EditTooltipByNum(0, (line) => line.Text += noAbyssLine); - if (item.type == ItemID.EmptyBucket) - EditTooltipByName("Defense", (line) => line.Text += noAbyssLine); - // If Early Hardmode Rework is enabled: Remind users that ores will NOT spawn when an altar is smashed. if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && (item.type == ItemID.Pwnhammer || item.type == ItemID.Hammush)) EditTooltipByNum(0, (line) => line.Text += "\nDemon Altars now drop Souls of Night instead of generating ores when destroyed" + "\nHardmode ores now generate after defeating Mechanical Bosses for the first time"); - // Bottled Honey gives the Honey buff - if (item.type == ItemID.BottledHoney) - EditTooltipByName("HealLife", (line) => line.Text += "\nGrants the Honey buff for 2 minutes"); - // Warmth Potion provides debuff immunities if (item.type == ItemID.WarmthPotion) { @@ -350,11 +342,6 @@ namespace CalamityMod.Items // I think this fits the miscellaneous category? Not seeing anything like this elsewhere. - Tomat EditTooltipByName("Speed", (line) => RedistributeSpeedTooltips(item, line)); - if (item.type == ItemID.SpaceGun) - { - int cost = (int)(item.mana * Main.LocalPlayer.manaCost * 0.5f); - EditTooltipByName("UseMana", (line) => line.Text = $"Uses {cost} mana"); - } if (item.healLife > 0 && Main.LocalPlayer.Calamity().healingPotionMultiplier != 1f) { int healAmt = (int)(item.healLife * Main.LocalPlayer.Calamity().healingPotionMultiplier); @@ -421,14 +408,18 @@ namespace CalamityMod.Items // Brain of Confusion, Black Belt and Master Ninja Gear have guaranteed dodges with a fixed cooldown. #region Guaranteed Dodge Tooltips string beltDodgeLine = "Grants the ability to dodge attacks\n" + - $"The dodge has a {BalancingConstants.BeltDodgeCooldown / 60} second cooldown which is shared with all other dodges and reflects"; + "Attacks that deal less than 5% of your max life in damage will not be dodged\n" + + $"The dodge has a cooldown that ranges between {BalancingConstants.BeltDodgeCooldownMin / 60 } and {BalancingConstants.BeltDodgeCooldownMax / 60} seconds depending on the dodged attack's damage\n" + + "The cooldown is shared with all other dodges and reflects"; if (item.type == ItemID.BlackBelt) EditTooltipByNum(0, (line) => line.Text = beltDodgeLine); if (item.type == ItemID.MasterNinjaGear) EditTooltipByNum(1, (line) => line.Text = beltDodgeLine); string brainDodgeLine = "Grants the ability to dodge attacks\n" + - $"The dodge has a {BalancingConstants.BrainDodgeCooldown / 60} second cooldown which is shared with all other dodges and reflects"; + "Attacks that deal less than 5% of your max life in damage will not be dodged\n" + + $"The dodge has a cooldown that ranges between {BalancingConstants.BrainDodgeCooldownMin / 60} and {BalancingConstants.BrainDodgeCooldownMax / 60} seconds depending on the dodged attack's damage\n" + + "The cooldown is shared with all other dodges and reflects"; if (item.type == ItemID.BrainOfConfusion) EditTooltipByNum(0, (line) => line.Text = brainDodgeLine); #endregion @@ -438,7 +429,7 @@ namespace CalamityMod.Items // Cobalt if (item.type == ItemID.CobaltSword || item.type == ItemID.CobaltNaginata) - EditTooltipByName("Knockback", (line) => line.Text += "\nDecreases enemy defense by 25% on hit"); + EditTooltipByName("Knockback", (line) => line.Text += "\nPermanently decreases enemy defense by 25% on hit"); // Palladium if (item.type == ItemID.PalladiumSword || item.type == ItemID.PalladiumPike) @@ -446,23 +437,29 @@ namespace CalamityMod.Items // Mythril if (item.type == ItemID.MythrilSword || item.type == ItemID.MythrilHalberd) - EditTooltipByName("Knockback", (line) => line.Text += "\nDecreases enemy contact damage by 10% on hit"); + EditTooltipByName("Knockback", (line) => line.Text += "\nPermanently decreases enemy contact damage by 10% on hit"); // Orichalcum if (item.type == ItemID.OrichalcumSword || item.type == ItemID.OrichalcumHalberd) EditTooltipByName("Knockback", (line) => line.Text += "\nIncreases how frequently the Orichalcum set bonus triggers on hit"); // Adamantite - if (item.type == ItemID.AdamantiteSword || item.type == ItemID.AdamantiteGlaive) + if (item.type == ItemID.AdamantiteSword) + EditTooltipByName("Material", (line) => line.Text += "\nSlows enemies on hit"); + + if (item.type == ItemID.AdamantiteGlaive) EditTooltipByName("Knockback", (line) => line.Text += "\nSlows enemies on hit"); // Titanium - if (item.type == ItemID.TitaniumSword || item.type == ItemID.TitaniumTrident) + if (item.type == ItemID.TitaniumSword) + EditTooltipByName("Material", (line) => line.Text += "\nDeals increased damage to enemies with high knockback resistance"); + + if (item.type == ItemID.TitaniumTrident) EditTooltipByName("Knockback", (line) => line.Text += "\nDeals increased damage to enemies with high knockback resistance"); // Hallowed (and True Excalibur) if (item.type == ItemID.Excalibur || item.type == ItemID.Gungnir || item.type == ItemID.TrueExcalibur) - EditTooltipByName("Knockback", (line) => line.Text += "\nDeals double damage to enemies above 75% life"); + EditTooltipByName("Material", (line) => line.Text += "\nDeals double damage to enemies above 75% life"); #endregion // Other melee weapon tooltips @@ -471,13 +468,21 @@ namespace CalamityMod.Items if (item.type == ItemID.CandyCaneSword || item.type == ItemID.FruitcakeChakram) EditTooltipByName("Knockback", (line) => line.Text += "\nHeals you on hit"); - // Stylish Scissors, all Phaseblades, and all Phasesabers - if (item.type == ItemID.StylistKilLaKillScissorsIWish || (item.type >= ItemID.BluePhaseblade && item.type <= ItemID.YellowPhaseblade) || (item.type >= ItemID.BluePhasesaber && item.type <= ItemID.YellowPhasesaber) || item.type == ItemID.OrangePhaseblade || item.type == ItemID.OrangePhasesaber) + // Stylish Scissors, all Phaseblades, and all Phasesabers ignore 100% of defense + if (item.type == ItemID.StylistKilLaKillScissorsIWish || (item.type >= ItemID.BluePhasesaber && item.type <= ItemID.YellowPhasesaber) || item.type == ItemID.OrangePhasesaber) EditTooltipByName("Knockback", (line) => line.Text += "\nIgnores 100% of enemy defense"); + // Phaseblades are done separately to ensure it appears under the Material line + if (item.type >= ItemID.BluePhaseblade && item.type <= ItemID.YellowPhaseblade || item.type == ItemID.OrangePhaseblade) + EditTooltipByName("Material", (line) => line.Text += "\nIgnores 100% of enemy defense"); - if (item.type == ItemID.AntlionClaw || item.type == ItemID.BoneSword || item.type == ItemID.BreakerBlade) + // Bone Sword, Breaker Blade, and Mandible Blade ignore 50% of defense + if (item.type == ItemID.BoneSword || item.type == ItemID.BreakerBlade) EditTooltipByName("Knockback", (line) => line.Text += "\nIgnores 50% of enemy defense"); + // Mandible Blade is done separately to ensure it appears under the Material line + if (item.type == ItemID.AntlionClaw) + EditTooltipByName("Material", (line) => line.Text += "\nIgnores 50% of enemy defense"); + // Death Sickle inflict Whispering Death if (item.type == ItemID.DeathSickle) EditTooltipByNum(0, (line) => line.Text += "\nInflicts Whispering Death on hit"); #endregion @@ -570,15 +575,27 @@ namespace CalamityMod.Items if (item.type == ItemID.FrozenShield) EditTooltipByNum(1, (line) => line.Text = "Puts a shell around the owner when below 50% life that reduces damage by 15%"); - // Ale and Sake rebalance. + // Ale and Sake rebalance and Alcohol Poisoning. if (item.type == ItemID.Ale || item.type == ItemID.Sake) - EditTooltipByNum(0, (line) => line.Text = "Increases melee damage by 10% and reduces defense by 5%"); + { + EditTooltipByNum(0, (line) => line.Text = "Increases melee damage by 10% and reduces defense by 5%\n" + + "Counts as an alcohol for Alcohol Poisoning\n" + + "Drinking more than 3 different alcohols might not end well with your liver"); + } + + //Flame Waker Boots buff. + if (item.type == ItemID.FlameWakerBoots) + { + 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"); + } // Hellfire Treads buff. if (item.type == ItemID.HellfireTreads) { EditTooltipByNum(1, (line) => line.Text = line.Text.Replace("fire blocks", "the Burning and On Fire! debuffs")); - EditTooltipByNum(3, (line) => line.Text += "\nMultiplies all fire-based debuff damage by 1.5\n" + + EditTooltipByNum(2, (line) => line.Text += "\nMultiplies all fire-based debuff damage by 1.5, does not stack with downgrades\n" + "All attacks inflict Hellfire"); } @@ -588,10 +605,6 @@ namespace CalamityMod.Items "Nearby fairies grant +2 HP/s life regen, 10 defense and 10% movement speed\n" + "Fairies are immune to damage and will no longer flee"); - // Armor Crunch immunity pre-Golem. - if (item.type == ItemID.ArmorPolish || item.type == ItemID.ArmorBracing) - EditTooltipByNum(0, (line) => line.Text += " and Armor Crunch"); - // Reduced Nightwither and Holy Flames damage, and melee speed removal. if (item.type == ItemID.MoonStone) { @@ -614,9 +627,13 @@ namespace CalamityMod.Items EditTooltipByNum(2, (line) => line.Text = line.Text.Replace(" melee speed,", "")); } - // Arcane and Magnet Flower buffs. - if (item.type == ItemID.ArcaneFlower || item.type == ItemID.MagnetFlower) - EditTooltipByNum(0, (line) => line.Text = "12% reduced mana usage"); + // Mana Flower tinker buffs. + if (item.type == ItemID.MagnetFlower) + EditTooltipByNum(0, (line) => line.Text = "10% reduced mana cost"); + if (item.type == ItemID.ArcaneFlower || item.type == ItemID.ManaCloak) + EditTooltipByNum(0, (line) => line.Text = "12% reduced mana cost"); + if (item.type == ItemID.ArcaneFlower) + EditTooltipByNum(2, (line) => line.Text += "\n5% increased magic damage"); // Magiluminescence nerf and clear explanation of what it actually does. if (item.type == ItemID.Magiluminescence) @@ -630,9 +647,24 @@ namespace CalamityMod.Items EditTooltipByNum(1, (line) => line.Text = "Increases movement and jump speed by 10% and acceleration by 1.1x"); } - // Sniper Scope + // Rifle Scope visibility change + if (item.type == ItemID.RifleScope) + { + EditTooltipByNum(0, (line) => line.Text = "Increase view range for guns (Right click to zoom out)"); + EditTooltipByNum(1, (line) => line.Text = "The scope effect can be toggled with visibility"); + } + + // Sniper Scope rebalance and visibility change if (item.type == ItemID.SniperScope) + { EditTooltipByNum(1, (line) => line.Text = "7% increased ranged damage and critical strike chance"); + EditTooltipByNum(0, (line) => line.Text += "\nThe scope effect can be toggled with visibility"); + } + + // Recon Scope visibility change + if (item.type == ItemID.ReconScope) + EditTooltipByNum(0, (line) => line.Text += "\nThe scope effect can be toggled with visibility"); + // Magic Quiver if (item.type == ItemID.MagicQuiver) @@ -655,11 +687,34 @@ namespace CalamityMod.Items // Magic Hat nerf if (item.type == ItemID.MagicHat) - EditTooltipByNum(0, (line) => line.Text = "5% increased magic damage and critical strike chance"); + EditTooltipByNum(0, (line) => line.Text = "6% increased magic critical strike chance"); - // Worm Scarf only gives 10% DR instead of 17% + // Gem Robe nerfs + if (item.type == ItemID.AmethystRobe) + EditTooltipByNum(1, (line) => line.Text = line.Text.Replace("5%", "4%")); + if (item.type == ItemID.TopazRobe) + { + EditTooltipByNum(0, (line) => line.Text = line.Text.Replace("40", "20")); + EditTooltipByNum(1, (line) => line.Text = line.Text.Replace("7%", "5%")); + } + if (item.type == ItemID.SapphireRobe) + EditTooltipByNum(1, (line) => line.Text = line.Text.Replace("9%", "6%")); + if (item.type == ItemID.EmeraldRobe) + { + EditTooltipByNum(0, (line) => line.Text = line.Text.Replace("60", "40")); + EditTooltipByNum(1, (line) => line.Text = line.Text.Replace("11%", "7%")); + } + if (item.type == ItemID.RubyRobe || item.type == ItemID.AmberRobe) + EditTooltipByNum(1, (line) => line.Text = line.Text.Replace("13%", "8%")); + if (item.type == ItemID.DiamondRobe) + { + EditTooltipByNum(0, (line) => line.Text = line.Text.Replace("80", "60")); + EditTooltipByNum(1, (line) => line.Text = line.Text.Replace("15%", "9%")); + } + + // Worm Scarf only gives 14% DR instead of 17% if (item.type == ItemID.WormScarf) - EditTooltipByNum(0, (line) => line.Text = line.Text.Replace("17%", "10%")); + EditTooltipByNum(0, (line) => line.Text = line.Text.Replace("17%", "14%")); // Feral Claws line melee speed and true melee damage changes if (item.type == ItemID.FeralClaws) @@ -681,10 +736,9 @@ namespace CalamityMod.Items if (item.type == ItemID.MechanicalGlove) { - string extraLine = "\n12% increased melee speed, does not stack with downgrades"; - EditTooltipByNum(1, (line) => line.Text = "12% increased melee damage" + extraLine); - EditTooltipByNum(1, (line) => line.Text = line.Text.Replace("12% increased melee speed", "12% increased melee speed, does not stack with downgrades")); - EditTooltipByNum(0, (line) => line.Text += "\n10% increased true melee damage"); + string extraLine = "\n10% increased true melee damage"; + string extraLine2 = "\n12% increased melee speed, does not stack with downgrades" + extraLine; + EditTooltipByNum(1, (line) => line.Text = "12% increased melee damage" + extraLine2); } if (item.type == ItemID.FireGauntlet) @@ -706,7 +760,7 @@ namespace CalamityMod.Items EditTooltipByNum(3, (line) => line.Text += "\nImmunity to the On Fire! debuff"); // Ozzatron 23NOV2023: Removed tooltip edits for Magma Skull and Molten Skull Rose, as they were invalid after vanilla tooltip changes. - + // Yoyo Glove/Bag apply a 0.5x damage multiplier on the second yoyo if (item.type == ItemID.YoyoBag || item.type == ItemID.YoYoGlove) EditTooltipByNum(0, (line) => line.Text += "\nSecondary yoyos will do 50% less damage"); @@ -774,10 +828,19 @@ namespace CalamityMod.Items if (item.type == ItemID.PlatinumHelmet) AddTooltip("6% increased damage"); if (item.type == ItemID.PlatinumChainmail) - AddTooltip("5% increased critical strike chance"); + AddTooltip("3% increased critical strike chance"); if (item.type == ItemID.PlatinumGreaves) AddTooltip("10% increased movement speed"); + // Jungle + if (item.type == ItemID.JungleHat || item.type == ItemID.AncientCobaltHelmet) + { + EditTooltipByNum(0, (line) => line.Text = line.Text.Replace("40", "20")); + EditTooltipByNum(1, (line) => line.Text = line.Text.Replace("6%", "3%")); + } + if (item.type == ItemID.JunglePants || item.type == ItemID.AncientCobaltLeggings) + EditTooltipByNum(1, (line) => line.Text = line.Text.Replace("6%", "3%")); + // Shadow if (item.type == ItemID.ShadowHelmet || item.type == ItemID.AncientShadowHelmet || item.type == ItemID.ShadowScalemail || item.type == ItemID.AncientShadowScalemail || item.type == ItemID.ShadowGreaves || item.type == ItemID.AncientShadowGreaves) EditTooltipByNum(0, (line) => line.Text = "5% increased damage and 7% increased jump speed"); @@ -785,15 +848,20 @@ namespace CalamityMod.Items // Crimson if (item.type == ItemID.CrimsonHelmet || item.type == ItemID.CrimsonScalemail || item.type == ItemID.CrimsonGreaves) { - EditTooltipByNum(0, (line) => { - string newTooltip = line.Text.Replace("2%", "5%"); + EditTooltipByNum(0, (line) => + { + string newTooltip = line.Text.Replace("3%", "5%"); newTooltip += "\n+0.5 HP/s life regen"; line.Text = newTooltip; }); } + + // Meteor + if (item.type == ItemID.MeteorHelmet || item.type == ItemID.MeteorSuit || item.type == ItemID.MeteorLeggings) + EditTooltipByNum(0, (line) => line.Text = line.Text.Replace("9%", "8%")); #endregion - // Hardmode ore armor tooltip edits + // Hardmode armor tooltip edits #region Hardmode Ore Armor // Cobalt if (item.type == ItemID.CobaltHat) @@ -820,6 +888,17 @@ namespace CalamityMod.Items // Titanium if (item.type == ItemID.TitaniumMask) EditTooltipByNum(1, (line) => line.Text = line.Text.Replace("9", "14")); + + // Solar Flare + if (item.type == ItemID.SolarFlareHelmet) + EditTooltipByNum(0, (line) => line.Text = line.Text.Replace("26%", "20%")); + + // Vortex + if (item.type == ItemID.VortexHelmet) + { + EditTooltipByNum(0, (line) => line.Text = line.Text.Replace("16%", "10%")); + EditTooltipByNum(1, (line) => line.Text = line.Text.Replace("7%", "5%")); + } #endregion // DD2 armor tooltip edits @@ -895,9 +974,11 @@ namespace CalamityMod.Items if (item.type == ItemID.Picksaw) EditTooltipByNum(0, (line) => line.Text += "\nCan mine Scoria Ore located in the Abyss"); - if (item.type == ItemID.SolarFlarePickaxe || item.type == ItemID.VortexPickaxe || item.type == ItemID.NebulaPickaxe || item.type == ItemID.StardustPickaxe - || item.type == ItemID.SolarFlareDrill || item.type == ItemID.VortexDrill || item.type == ItemID.NebulaDrill || item.type == ItemID.StardustDrill) - EditTooltipByName("Knockback", (line) => line.Text += "\nCan mine Uelibloom Ore"); + if (item.type == ItemID.SolarFlarePickaxe || item.type == ItemID.VortexPickaxe || item.type == ItemID.NebulaPickaxe || item.type == ItemID.StardustPickaxe) + EditTooltipByName("Material", (line) => line.Text += "\nCan mine Uelibloom Ore"); + + if (item.type == ItemID.SolarFlareDrill || item.type == ItemID.VortexDrill || item.type == ItemID.NebulaDrill || item.type == ItemID.StardustDrill) + EditTooltipByName("TileBoost", (line) => line.Text += "\nCan mine Uelibloom Ore"); #endregion // Rebalances and information about vanilla set bonuses @@ -1226,69 +1307,8 @@ namespace CalamityMod.Items } #endregion - #region Stealth Generation Prefix Accessory Tooltip - private void StealthGenAccessoryTooltip(Item item, IList tooltips) - { - if (!item.accessory || item.social || item.prefix <= 0) - return; - - float stealthGenBoost = item.Calamity().StealthGenBonus - 1f; - if (stealthGenBoost > 0) - { - TooltipLine line = tooltips.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Expert"); - if (line == null) - line = tooltips.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Price"); - - TooltipLine StealthGen = new TooltipLine(Mod, "PrefixStealthGenBoost", "+" + Math.Round(stealthGenBoost * 100f) + "% stealth generation") - { - IsModifier = true - }; - - if (line == null) - tooltips.Add(StealthGen); - else - tooltips.Insert(tooltips.IndexOf(line), StealthGen); - } - } - #endregion - - #region Stealth Strike Damage Prefix Weapon Tooltip - private void StealthWeaponTooltip(Item item, IList tooltips) - { - if (!item.CountsAsClass() || item.accessory || item.prefix <= 0) - return; - - float stealthDmgBonus = item.Calamity().StealthStrikePrefixBonus - 1f; - if (stealthDmgBonus > 0) - { - TooltipLine line = tooltips.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "PrefixShootSpeed"); - if (line == null) - line = tooltips.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "PrefixCritChance"); - else if (line == null) - line = tooltips.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "PrefixSpeed"); - else if (line == null) - line = tooltips.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "PrefixDamage"); - TooltipLine line2 = tooltips.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Expert"); - if (line2 == null) - line2 = tooltips.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Price"); - - TooltipLine StealthDmg = new TooltipLine(Mod, "PrefixStealthDamageBoost", "+" + Math.Round(stealthDmgBonus * 100f) + "% stealth strike damage") - { - IsModifier = true - }; - - // If price/expert line doesn't exist, just add it to the end - if (line2 == null) - tooltips.Add(StealthDmg); - // Otherwise, insert it right before the sell price (or expert line) - else - tooltips.Insert(tooltips.IndexOf(line2), StealthDmg); - } - } - #endregion - #region Speed Tooltips - + // TODO: Investigate using a SortedDictionary instead? May be slower, but removes the need for carefully adding KVPs. /// /// This dictionary handles easily retrieving tooltip text based on a numerical threshold.
diff --git a/Items/CalamityGlobalItemTweaks.cs b/Items/CalamityGlobalItemTweaks.cs index a89edf5cad..4b73cceaba 100644 --- a/Items/CalamityGlobalItemTweaks.cs +++ b/Items/CalamityGlobalItemTweaks.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items { // Various shorthands for items which receive very simple changes, such as setting one flag. IItemTweak[] trueMelee = Do(TrueMelee); - IItemTweak[] trueMeleeNoSpeed = Do(TrueMeleeNoSpeed); + IItemTweak[] trueMeleeNoSpeed = Do(TrueMeleeNoSpeed); IItemTweak[] pointBlank = Do(PointBlank); IItemTweak[] autoReuse = Do(AutoReuse); IItemTweak[] nonConsumableBossSummon = Do(MaxStack(1), NotConsumable, UseTimeExact(10)); @@ -37,76 +37,76 @@ namespace CalamityMod.Items #region CATEGORY 1: Weapon Balancing { ItemID.AdamantiteGlaive, Do(AutoReuse, TrueMelee, UseRatio(0.8f), DamageExact(65), ShootSpeedRatio(1.25f)) }, { ItemID.AdamantiteRepeater, Do(PointBlank, UseExact(14)) }, - { ItemID.AdamantiteSword, Do(UseTurn, ScaleRatio(1.45f), DamageExact(77)) }, + { ItemID.AdamantiteSword, Do(UseTurn, DamageExact(77)) }, { ItemID.AmberStaff, Do(UseTimeExact(15), UseAnimationExact(45), ReuseDelayExact(15)) }, { ItemID.AmethystStaff, Do(ManaExact(2)) }, { ItemID.Anchor, Do(DamageExact(107), UseExact(30)) }, { ItemID.AntlionClaw, Do(UseExact(14)) }, // Mandible Blade { ItemID.Bananarang, Do(DamageExact(76), UseExact(14)) }, { ItemID.BatScepter, Do(DamageExact(56)) }, - { ItemID.BeamSword, Do(UseMeleeSpeed, UseTurn, DamageExact(180), UseAnimationExact(60), ShootSpeedExact(23f)) }, - { ItemID.BeeGun, Do(DamageExact(11)) }, + { 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.Bladetongue, Do(UseTurn, UseRatio(0.8f), DamageExact(120), ScaleRatio(1.75f)) }, + { ItemID.Bladetongue, Do(UseTurn, UseRatio(0.8f), DamageExact(120)) }, { ItemID.BlizzardStaff, Do(DamageExact(41), ManaExact(7)) }, { ItemID.BloodyMachete, Do(AutoReuse, DamageExact(24)) }, { ItemID.Blowgun, Do(PointBlank, DamageExact(40)) }, { ItemID.BluePhaseblade, Do(AutoReuse, UseTurn, DamageExact(32)) }, - { ItemID.BluePhasesaber, Do(ScaleRatio(1.5f), DamageExact(60)) }, + { ItemID.BluePhasesaber, Do(DamageExact(60)) }, { ItemID.BookofSkulls, Do(ManaExact(12), ShootSpeedExact(5.5f)) }, { ItemID.BookStaff, Do(ManaExact(14)) }, // Tome of Infinite Wisdom { ItemID.Boomstick, Do(PointBlank, DamageExact(11)) }, - { ItemID.BreakerBlade, Do(AutoReuse, UseTurn, ScaleRatio(1.4f), DamageExact(97)) }, + { ItemID.BreakerBlade, Do(AutoReuse, UseTurn, DamageExact(97)) }, { ItemID.CandyCornRifle, Do(PointBlank, DamageExact(66)) }, { ItemID.Cascade, Do(AutoReuse, DamageExact(30)) }, { ItemID.ChainGuillotines, Do(DamageExact(100)) }, + { ItemID.ChainGun, Do(PointBlank, DamageExact(35)) }, { ItemID.ChainKnife, Do(AutoReuse, DamageRatio(1.34f)) }, // Uses ratios due to remix seed - // Charged Blaster Cannon is now an earlier Last Prism-like, so it will probably need careful balance attention. - // { ItemID.ChargedBlasterCannon, Do(DamageRatio(1.33f)) }, - { ItemID.ChlorophyteClaymore, Do(UseMeleeSpeed) }, + { ItemID.ChlorophyteClaymore, Do(UseMeleeSpeed, DamageExact(176), UseExact(35), UseAnimationExact(45), ShootSpeedExact(22f)) }, { ItemID.ChlorophytePartisan, Do(AutoReuse, UseMeleeSpeed, UseRatio(0.8f), DamageExact(70)) }, { ItemID.ChlorophyteSaber, Do(UseMeleeSpeed, DamageExact(80), UseExact(10)) }, { ItemID.ChristmasTreeSword, Do(AutoReuse, UseTurn, UseMeleeSpeed, DamageExact(80), UseExact(30)) }, - { ItemID.ClingerStaff, Do(DamageExact(96)) }, + { ItemID.ClingerStaff, Do(DamageExact(63)) }, { ItemID.ClockworkAssaultRifle, Do(PointBlank, DamageExact(21)) }, { ItemID.CobaltNaginata, Do(AutoReuse, TrueMelee, UseRatio(0.8f), DamageExact(90)) }, { ItemID.CobaltRepeater, Do(PointBlank, UseExact(18)) }, - { ItemID.CobaltSword, Do(UseTurn, ScaleRatio(1.4f), DamageExact(80)) }, + { ItemID.CobaltSword, Do(UseTurn, DamageExact(80)) }, { ItemID.Code2, Do(AutoReuse, DamageExact(43)) }, { ItemID.CorruptYoyo, Do(AutoReuse, DamageExact(20)) }, // Malaise { ItemID.CrimsonYoyo, Do(AutoReuse, DamageExact(20)) }, // Artery + { ItemID.CrystalBullet, Do(DamageExact(8)) }, { ItemID.CrystalDart, Do(DamageExact(20)) }, { ItemID.CrystalSerpent, Do(DamageExact(45)) }, - { ItemID.CrystalStorm, Do(DamageExact(40))}, + { ItemID.CrystalStorm, Do(DamageExact(40)) }, + { ItemID.CursedArrow, Do(DamageExact(14)) }, { ItemID.CursedDart, Do(DamageExact(25)) }, - { ItemID.Cutlass, Do(UseRatio(0.9f), DamageRatio(1.85f)) }, + { ItemID.Cutlass, Do(UseRatio(0.9f), DamageExact(90)) }, { ItemID.DaedalusStormbow, Do(DamageExact(30)) }, { ItemID.DaoofPow, Do(DamageExact(160)) }, { ItemID.DarkLance, Do(AutoReuse, TrueMelee, DamageExact(45)) }, { ItemID.DartRifle, Do(PointBlank, DamageExact(58)) }, { ItemID.DayBreak, Do(DamageExact(125), UseExact(20)) }, - { ItemID.DD2BetsyBow, Do(DamageRatio(1.1f)) }, // Aerial Bane's ridiculous multiplier is removed, so this compensates for that + { ItemID.DD2BetsyBow, Do(DamageExact(42)) }, // Aerial Bane's ridiculous multiplier is removed, so this compensates for that { ItemID.DD2SquireBetsySword, Do(UseMeleeSpeed, DamageExact(150)) }, // Flying Dragon { ItemID.DD2SquireDemonSword, Do(DamageExact(110), UseExact(25)) }, // Brand of the Inferno { ItemID.DeathSickle, Do(UseMeleeSpeed, DamageExact(82), ShootSpeedExact(15f)) }, { ItemID.DemonBow, Do(PointBlank, DamageExact(12), AutoReuse) }, { ItemID.DemonScythe, Do(AutoReuse, DamageExact(33)) }, { ItemID.DyeTradersScimitar, Do(AutoReuse, UseTurn, DamageExact(24)) }, // Exotic Scimitar - { ItemID.ElectrosphereLauncher, Do(DamageRatio(1.1f)) }, + { ItemID.ElectrosphereLauncher, Do(DamageExact(44)) }, { ItemID.ElfMelter, Do(ShootSpeedDelta(+5f)) }, { ItemID.EmeraldStaff, Do(DamageExact(27)) }, { ItemID.EmpressBlade, Do(AutoReuse, DamageExact(60), UseExact(20)) }, // Terraprisma { ItemID.EnchantedBoomerang, Do(DamageExact(24)) }, { ItemID.EnchantedSword, Do(UseMeleeSpeed, DamageExact(30), ShootSpeedExact(15f)) }, - { ItemID.Excalibur, Do(TrueMelee, ScaleRatio(1.2f), UseRatio(0.8f), DamageExact(125), UseAnimationExact(45)) }, + { ItemID.Excalibur, Do(TrueMelee, UseRatio(0.8f), DamageExact(125), UseAnimationExact(45)) }, { ItemID.FairyQueenMagicItem, Do(DamageExact(54)) }, // Nightglow - { ItemID.FairyQueenRangedItem, Do(PointBlank, DamageExact(42))}, //Eventide { ItemID.FalconBlade, Do(UseTurn, UseExact(15)) }, - // Unsure what to do with Celebration. Should it be treated as a serious weapon or not? Currently not changing it from vanilla. - // { ItemID.FireworksLauncher, Do(DamageRatio(2f)) }, // Celebration + // For now, I think I will balance Celebration like a serious weapon. -CIT + { ItemID.FireworksLauncher, Do(DamageExact(50), UseExact(25)) }, // Celebration { ItemID.Flairon, Do(DamageExact(73)) }, - { ItemID.Flamarang, Do(DamageExact(43)) }, - { ItemID.Flamelash, Do(DamageRatio(1.25f)) }, + { ItemID.Flamarang, Do(DamageExact(40)) }, + { ItemID.Flamelash, Do(DamageExact(40)) }, { ItemID.Flamethrower, Do(DamageExact(21), ShootSpeedDelta(+3f)) }, { ItemID.FlowerofFire, Do(AutoReuse, ManaExact(7), UseRatio(0.88f), DamageRatio(0.65f)) }, // Uses ratios due to remix seed { ItemID.FlowerofFrost, Do(AutoReuse, ManaExact(7), UseExact(22), DamageExact(70), ShootSpeedExact(14)) }, @@ -114,67 +114,76 @@ namespace CalamityMod.Items { ItemID.Frostbrand, Do(UseMeleeSpeed, DamageExact(88)) }, { ItemID.FrostStaff, Do(DamageExact(160), UseExact(37), ShootSpeedExact(20f)) }, // has 1 extra update { ItemID.Gatligator, Do(PointBlank, UseExact(6)) }, - { ItemID.GoldenShower, Do(DamageExact(44)) }, + { ItemID.GoldenShower, Do(DamageExact(39)) }, { ItemID.GoldShortsword, Do(AutoReuse, TrueMelee, DamageExact(17)) }, { ItemID.GolemFist, Do(DamageExact(150)) }, { ItemID.Gradient, Do(AutoReuse, DamageExact(39)) }, { ItemID.GreenPhaseblade, Do(AutoReuse, UseTurn, DamageExact(32)) }, - { ItemID.GreenPhasesaber, Do(ScaleRatio(1.5f), DamageExact(60)) }, - { ItemID.GrenadeLauncher, Do(DamageRatio(1.5f)) }, + { ItemID.GreenPhasesaber, Do(DamageExact(60)) }, + { ItemID.GrenadeLauncher, Do(DamageExact(112)) }, { ItemID.Gungnir, Do(AutoReuse, TrueMelee, UseRatio(0.8f), DamageExact(92), ShootSpeedRatio(1.25f)) }, { ItemID.HallowedRepeater, Do(PointBlank, UseExact(12)) }, { ItemID.Handgun, Do(PointBlank, UseExact(22), DamageExact(36)) }, { ItemID.HellwingBow, Do(PointBlank, DamageExact(16)) }, - { ItemID.HighVelocityBullet, Do(DamageExact(15)) }, + { ItemID.HighVelocityBullet, Do(DamageExact(13)) }, + { ItemID.HiveFive, Do(AutoReuse, DamageExact(26)) }, + { ItemID.HornetStaff, Do(AutoReuse, DamageExact(13), UseExact(30)) }, { ItemID.IceBlade, Do(UseMeleeSpeed) }, { ItemID.IceBoomerang, Do(UseExact(25), ShootSpeedExact(9)) }, { ItemID.IceRod, Do(UseExact(6), DamageExact(30), ShootSpeedExact(20)) }, { ItemID.IceSickle, Do(AutoReuse, UseMeleeSpeed, DamageExact(75), ShootSpeedExact(20f)) }, + { ItemID.IchorArrow, Do(DamageExact(13)) }, + { ItemID.IchorBullet, Do(DamageExact(11)) }, { ItemID.ImpStaff, Do(AutoReuse, UseExact(30), DamageExact(25)) }, - { ItemID.InfernoFork, Do(DamageRatio(1.2f)) }, + { ItemID.InfernoFork, Do(DamageExact(99), ShootSpeedExact(11)) }, { ItemID.InfluxWaver, Do(UseMeleeSpeed, DamageExact(80), UseExact(25)) }, { ItemID.IronShortsword, Do(AutoReuse, TrueMelee, DamageExact(10)) }, - { ItemID.JestersArrow, Do(DamageExact(6)) }, - { ItemID.Keybrand, Do(UseTurn, ScaleRatio(1.5f)) }, // Uses ratios due to remix seed + { ItemID.Keybrand, Do(UseTurn) }, { ItemID.Kraken, Do(AutoReuse, DamageExact(85)) }, { ItemID.KOCannon, Do(DamageRatio(2.65f)) }, // Uses ratios due to remix seed + { ItemID.LaserMachinegun, Do(DamageExact(49)) }, { ItemID.LaserRifle, Do(DamageExact(46), UseExact(10), ManaExact(4)) }, { ItemID.LastPrism, Do(DamageExact(57), ManaExact(10)) }, { ItemID.LeadShortsword, Do(AutoReuse, TrueMelee, DamageExact(11)) }, { ItemID.LightDisc, Do(DamageExact(128), ShootSpeedExact(18)) }, - { ItemID.LunarFlareBook, Do(DamageRatio(1.2f)) }, + { ItemID.LunarFlareBook, Do(DamageExact(120)) }, { ItemID.MagicalHarp, Do(DamageExact(50), ShootSpeedExact(12f)) }, { ItemID.MagicDagger, Do(DamageRatio(1.8f), UseRatio(1.88f), ShootSpeedExact(30)) }, // Uses ratios due to remix seed { ItemID.MagicMissile, Do(DamageExact(23), ManaExact(10), UseAnimationExact(20), UseTimeExact(10)) }, - { ItemID.MagnetSphere, Do(DamageRatio(1.1f)) }, + { ItemID.MagnetSphere, Do(DamageExact(52)) }, { ItemID.Marrow, Do(PointBlank, DamageExact(69)) }, - { ItemID.MedusaHead, Do(ManaExact(6), DamageRatio(1.2f)) }, - { ItemID.Meowmere, Do(UseMeleeSpeed, DamageExact(240)/*, DamageRatio(1.33f) */) }, + { ItemID.MedusaHead, Do(ManaExact(6), DamageExact(48)) }, + { ItemID.Meowmere, Do(UseMeleeSpeed, DamageExact(240)) }, { ItemID.MeteorStaff, Do(DamageExact(58), ManaExact(7), ShootSpeedExact(13f)) }, + { ItemID.MiniNukeI, Do(DamageExact(90)) }, + { ItemID.MiniNukeII, Do(DamageExact(90)) }, { ItemID.Minishark, Do(PointBlank, DamageExact(4)) }, { ItemID.MoltenFury, Do(PointBlank, UseExact(29), AutoReuse) }, { ItemID.MonkStaffT1, Do(TrueMeleeNoSpeed, DamageExact(83)) }, // Sleepy Octopod - { ItemID.MonkStaffT2, Do(AutoReuse, TrueMelee, DamageRatio(2f)) }, // Ghastly Glaive + { ItemID.MonkStaffT2, Do(AutoReuse, TrueMelee, DamageExact(90)) }, // Ghastly Glaive { ItemID.MonkStaffT3, Do(DamageExact(225)) }, // Sky Dragon's Fury + { ItemID.MoonlordTurretStaff, Do(DamageExact(50), UseExact(15)) }, //Lunar Portal Staff { ItemID.Muramasa, Do(CritDelta(+20)) }, { ItemID.MushroomSpear, Do(AutoReuse, TrueMelee, UseRatio(0.8f), DamageExact(100)) }, { ItemID.Musket, Do(PointBlank, DamageExact(22)) }, { ItemID.MythrilHalberd, Do(AutoReuse, TrueMelee, UseRatio(0.8f), DamageExact(95), ShootSpeedRatio(1.25f)) }, { ItemID.MythrilRepeater, Do(PointBlank, UseExact(16)) }, - { ItemID.MythrilSword, Do(UseTurn, ScaleRatio(1.45f), DamageExact(100)) }, + { ItemID.MythrilSword, Do(UseTurn, DamageExact(100)) }, + { ItemID.NettleBurst, Do(ManaExact(10), DamageExact(70)) }, + { ItemID.NightsEdge, Do(TrueMelee, DamageExact(45)) }, { ItemID.NorthPole, Do(AutoReuse, UseMeleeSpeed) }, { ItemID.OrangePhaseblade, Do(AutoReuse, UseTurn, DamageExact(32)) }, - { ItemID.OrangePhasesaber, Do(ScaleRatio(1.5f), DamageExact(60)) }, + { ItemID.OrangePhasesaber, Do(DamageExact(60)) }, { ItemID.OrichalcumHalberd, Do(AutoReuse, TrueMelee, UseRatio(0.8f), DamageExact(98), ShootSpeedRatio(1.25f)) }, { ItemID.OrichalcumRepeater, Do(PointBlank, DamageExact(48)) }, - { ItemID.OrichalcumSword, Do(UseTurn, ScaleRatio(1.45f), DamageExact(82)) }, + { ItemID.OrichalcumSword, Do(UseTurn, DamageExact(82)) }, { ItemID.PainterPaintballGun, Do(PointBlank, DamageExact(8)) }, { ItemID.PaladinsHammer, Do(DamageExact(100), ShootSpeedExact(23)) }, { ItemID.PalladiumPike, Do(AutoReuse, TrueMelee, UseRatio(0.8f), DamageExact(96)) }, { ItemID.PalladiumRepeater, Do(PointBlank, DamageExact(45)) }, - { ItemID.PalladiumSword, Do(UseTurn, ScaleRatio(1.4f), DamageExact(100)) }, - { ItemID.PearlwoodBow, Do(AutoReuse, PointBlank, DamageRatio(2.31f), UseDelta(+8), ShootSpeedDelta(+3.4f), KnockbackDelta(+1f)) }, - { ItemID.PearlwoodSword, Do(UseTurn, DamageRatio(1.5f)) }, + { 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.Phantasm, Do(PointBlank, DamageExact(48)) }, { ItemID.PhoenixBlaster, Do(AutoReuse, PointBlank, UseExact(18)) }, @@ -183,10 +192,12 @@ namespace CalamityMod.Items { ItemID.PlatinumShortsword, Do(AutoReuse, TrueMelee, DamageExact(18)) }, { ItemID.PoisonStaff, Do(DamageExact(57)) }, { ItemID.PossessedHatchet, Do(DamageExact(135)) }, - { ItemID.PsychoKnife, Do(UseTurn, UseExact(11), DamageRatio(3f)) }, - { ItemID.PurpleClubberfish, Do(UseTurn, ScaleRatio(1.2f), KnockbackExact(10f)) }, + { ItemID.PsychoKnife, Do(UseTurn, UseExact(11), DamageExact(255)) }, + { ItemID.PurpleClubberfish, Do(UseTurn, KnockbackExact(10f)) }, { ItemID.PurplePhaseblade, Do(AutoReuse, UseTurn, DamageExact(32)) }, - { ItemID.PurplePhasesaber, Do(ScaleRatio(1.5f), DamageExact(60)) }, + { ItemID.PurplePhasesaber, Do(DamageExact(60)) }, + { ItemID.PygmyStaff, Do(AutoReuse, UseExact(20), DamageExact(70)) }, + { ItemID.QuadBarrelShotgun, Do(PointBlank, DamageExact(11)) }, { ItemID.RainbowRod, Do(DamageExact(35), ManaExact(15)) }, { ItemID.Rally, Do(AutoReuse, DamageExact(18)) }, { ItemID.RainbowGun, Do(DamageExact(60), ManaExact(40)) }, @@ -194,11 +205,10 @@ namespace CalamityMod.Items { ItemID.RazorbladeTyphoon, Do(DamageExact(103)) }, { ItemID.Razorpine, Do(DamageExact(40)) }, { ItemID.RedPhaseblade, Do(AutoReuse, UseTurn, DamageExact(32)) }, - { ItemID.RedPhasesaber, Do(ScaleRatio(1.5f), DamageExact(60)) }, + { ItemID.RedPhasesaber, Do(DamageExact(60)) }, { ItemID.RedRyder, Do(PointBlank, DamageExact(24)) }, - { ItemID.RedsYoyo, Do(AutoReuse, DamageExact(48)) }, // Red's throw and valkyrie's yoyo are the same weapon - { ItemID.RocketIII, Do(DamageRatio(0.75f)) }, - { ItemID.RocketIV, Do(DamageRatio(0.75f)) }, + { ItemID.RedsYoyo, Do(AutoReuse, DamageExact(48)) }, // Red's Throw and Valkyrie Yoyo have the same stats + { ItemID.RocketLauncher, Do(DamageExact(70)) }, { ItemID.Sandgun, Do(PointBlank, DamageExact(22), UseExact(20)) }, { ItemID.SapphireStaff, Do(DamageExact(25)) }, { ItemID.SDMG, Do(PointBlank, DamageExact(80)) }, @@ -213,24 +223,23 @@ namespace CalamityMod.Items { ItemID.SilverBullet, Do(DamageExact(8)) }, { ItemID.SilverShortsword, Do(AutoReuse, TrueMelee, DamageExact(14)) }, { ItemID.SkyFracture, Do(DamageExact(54), ShootSpeedExact(30f)) }, - { ItemID.SlapHand, Do(UseTurn, ScaleRatio(1.5f), DamageExact(120)) }, + { ItemID.SlapHand, Do(UseTurn, DamageExact(120)) }, { ItemID.Smolstar, Do(DamageExact(9), AutoReuse, UseExact(25)) }, // Blade Staff - { ItemID.SolarEruption, Do(DamageRatio(1.5f)) }, - // Life Drain could probably get a bigger buff - { ItemID.SoulDrain, Do(DamageRatio(1.1f)) }, // Life Drain + { ItemID.SolarEruption, Do(DamageExact(157)) }, + { ItemID.SoulDrain, Do(DamageExact(38)) }, // Life Drain { ItemID.SpaceGun, Do(DamageExact(25)) }, { ItemID.Spear, Do(AutoReuse, TrueMelee, DamageExact(14)) }, - { ItemID.SpectreStaff, Do(DamageRatio(1.2f)) }, + { ItemID.SpectreStaff, Do(DamageExact(78)) }, { ItemID.SpiritFlame, Do(UseExact(20), ManaExact(11), ShootSpeedExact(2f)) }, - { ItemID.StaffofEarth, Do(DamageRatio(1.2f)) }, + { ItemID.StaffofEarth, Do(DamageExact(150)) }, { ItemID.StarCannon, Do(DamageExact(25)) }, { ItemID.StardustDragonStaff, Do(AutoReuse, DamageExact(20), UseExact(19)) }, { ItemID.StormTigerStaff, Do(AutoReuse, DamageExact(49), UseExact(20)) }, // Desert Tiger Staff { ItemID.StylistKilLaKillScissorsIWish, Do(AutoReuse, UseTurn, DamageExact(18)) }, // Stylish Scissors { ItemID.Stynger, Do(DamageExact(75)) }, { ItemID.Swordfish, Do(AutoReuse, TrueMelee, DamageExact(24)) }, - { ItemID.TacticalShotgun, Do(PointBlank, DamageRatio(1.2f)) }, - { ItemID.TaxCollectorsStickOfDoom, Do(AutoReuse, UseTurn, ScaleRatio(1.5f), UseRatio(0.8f), DamageExact(70)) }, + { ItemID.TacticalShotgun, Do(PointBlank, DamageExact(34)) }, + { ItemID.TaxCollectorsStickOfDoom, Do(AutoReuse, UseTurn, UseRatio(0.8f), DamageExact(70)) }, // Classy Cane { ItemID.TendonBow, Do(PointBlank, DamageExact(17), AutoReuse) }, { ItemID.TerraBlade, Do(DamageExact(122)) }, // Vanilla damage 190. After fixing iframes so yoyo and shots can hit simultaneously, @@ -240,32 +249,34 @@ namespace CalamityMod.Items { ItemID.TheRottedFork, Do(AutoReuse, TrueMelee, DamageExact(20)) }, { ItemID.TheUndertaker, Do(PointBlank, AutoReuse, DamageExact(15)) }, { ItemID.ThunderSpear, Do(AutoReuse, UseMeleeSpeed) }, // Storm Spear + { ItemID.ThunderStaff, Do(DamageExact(18)) }, //Thunder Zapper { ItemID.TitaniumRepeater, Do(PointBlank, DamageExact(52)) }, - { ItemID.TitaniumSword, Do(UseTurn, ScaleRatio(1.45f), DamageExact(77)) }, + { ItemID.TitaniumSword, Do(UseTurn, DamageExact(77)) }, { ItemID.TitaniumTrident, Do(AutoReuse, TrueMelee, UseRatio(0.8f), DamageExact(72), ShootSpeedRatio(1.25f)) }, { ItemID.TopazStaff, Do(ManaExact(2)) }, { ItemID.Toxikarp, Do(UseTimeExact(7), UseAnimationExact(14)) }, { ItemID.Trident, Do(AutoReuse, TrueMelee, DamageExact(20)) }, { ItemID.Trimarang, Do(DamageExact(24)) }, { ItemID.TrueExcalibur, Do(TrueMelee, DamageExact(107)) }, - { ItemID.TrueNightsEdge, Do(DamageExact(105), ScaleRatio(1.2f)) }, + { ItemID.TrueNightsEdge, Do(DamageExact(105)) }, { ItemID.Tsunami, Do(PointBlank, DamageExact(49)) }, + { ItemID.TungstenBullet, Do(DamageExact(8)) }, { ItemID.TungstenShortsword, Do(AutoReuse, TrueMelee, DamageExact(15)) }, { ItemID.UnholyArrow, Do(DamageExact(11)) }, { ItemID.UnholyTrident, Do(ManaRatio(0.78f), DamageRatio(0.91f)) }, // Uses ratios due to remix seed - { ItemID.VampireKnives, Do(DamageRatio(1.33f)) }, - { ItemID.ValkyrieYoyo, Do(AutoReuse, DamageExact(48)) }, // Red's Throw and Valkyrie Yoyo are the same weapon basically - { ItemID.VenomStaff, Do(DamageRatio(1.25f)) }, - { ItemID.WaspGun, Do(UseExact(11)) }, + { ItemID.VampireKnives, Do(DamageExact(38)) }, + { ItemID.ValkyrieYoyo, Do(AutoReuse, DamageExact(48)) }, // Red's Throw and Valkyrie Yoyo have the same stats + { ItemID.VenomStaff, Do(DamageExact(55)) }, + { ItemID.WaspGun, Do(UseExact(11), DamageExact(58)) }, { ItemID.WaterBolt, Do(DamageExact(23)) }, { ItemID.WhitePhaseblade, Do(AutoReuse, UseTurn, DamageExact(32)) }, - { ItemID.WhitePhasesaber, Do(ScaleRatio(1.5f), DamageExact(60)) }, - { ItemID.WoodenBoomerang, Do(DamageRatio(2f), Value(Item.sellPrice(copper: 20))) }, + { ItemID.WhitePhasesaber, Do(DamageExact(60)) }, + { ItemID.WoodenBoomerang, Do(DamageExact(16), Value(Item.sellPrice(copper: 20))) }, { ItemID.Yelets, Do(AutoReuse, DamageExact(53)) }, { ItemID.YellowPhaseblade, Do(AutoReuse, UseTurn, DamageExact(32)) }, - { ItemID.YellowPhasesaber, Do(ScaleRatio(1.5f), DamageExact(60)) }, + { ItemID.YellowPhasesaber, Do(DamageExact(60)) }, { ItemID.Zenith, Do(DamageExact(210)) }, - { ItemID.ZombieArm, Do(AutoReuse, UseTurn, ScaleRatio(1.25f), KnockbackExact(12f)) }, + { ItemID.ZombieArm, Do(AutoReuse, UseTurn, KnockbackExact(12f)) }, #endregion #region CATEGORY 2: Defense Balancing @@ -307,7 +318,7 @@ namespace CalamityMod.Items { ItemID.BloodLustCluster, Do(AxePower(100), UseTimeExact(13), TileBoostExact(+0)) }, { ItemID.BonePickaxe, Do(PickPower(55), UseTimeExact(6)) }, { ItemID.BorealWoodHammer, Do(HammerPower(25), UseTimeExact(11), TileBoostExact(+0)) }, - { ItemID.ButchersChainsaw, Do(TrueMeleeNoSpeed, AxePower(150), UseTimeExact(3), TileBoostExact(+0), DamageExact(194)) }, + { ItemID.ButchersChainsaw, Do(TrueMeleeNoSpeed, AxePower(150), UseTimeExact(3), TileBoostExact(+0), DamageExact(177)) }, { ItemID.CactusPickaxe, Do(PickPower(34), UseTimeExact(9)) }, { ItemID.CnadyCanePickaxe, Do(PickPower(55), UseTimeExact(9), TileBoostExact(+1)) }, // Candy Cane Pickaxe { ItemID.ChlorophyteChainsaw, Do(TrueMeleeNoSpeed, AxePower(120), UseTimeExact(3), TileBoostExact(+0), DamageExact(112)) }, @@ -352,7 +363,6 @@ namespace CalamityMod.Items { ItemID.MythrilWaraxe, Do(AxePower(140), UseTimeExact(11), TileBoostExact(+0)) }, { ItemID.NebulaDrill, Do(TrueMeleeNoSpeed, PickPower(225), UseTimeExact(3), TileBoostExact(+4), DamageExact(95)) }, { ItemID.NebulaPickaxe, Do(PickPower(225), UseTimeExact(6), TileBoostExact(+4)) }, - { ItemID.NettleBurst, Do(ManaExact(10), DamageExact(43)) }, { ItemID.NightmarePickaxe, Do(PickPower(66), UseTimeExact(9)) }, { ItemID.OrichalcumChainsaw, Do(TrueMeleeNoSpeed, AxePower(80), UseTimeExact(4), TileBoostExact(-1), DamageExact(63)) }, { ItemID.OrichalcumDrill, Do(TrueMeleeNoSpeed, PickPower(160), UseTimeExact(4), DamageExact(26)) }, @@ -363,7 +373,7 @@ namespace CalamityMod.Items { ItemID.PalladiumPickaxe, Do(PickPower(130), UseTimeExact(9)) }, { ItemID.PalladiumWaraxe, Do(AxePower(125), UseTimeExact(12), TileBoostExact(+0)) }, { ItemID.PalmWoodHammer, Do(HammerPower(25), UseTimeExact(11), TileBoostExact(+0)) }, - { ItemID.PearlwoodHammer, Do(HammerPower(25), UseTimeExact(4), UseAnimationExact(20), DamageRatio(4f), TileBoostExact(+0)) }, + { ItemID.PearlwoodHammer, Do(HammerPower(25), UseTimeExact(4), UseAnimationExact(20), DamageExact(36), TileBoostExact(+0)) }, { ItemID.PickaxeAxe, Do(PickPower(200), AxePower(110), UseTimeExact(7), TileBoostExact(+1)) }, { ItemID.Picksaw, Do(PickPower(210), AxePower(125), UseTimeExact(6), TileBoostExact(+1)) }, { ItemID.PlatinumAxe, Do(AxePower(80), UseTimeExact(14), TileBoostExact(+0)) }, @@ -410,7 +420,6 @@ namespace CalamityMod.Items { ItemID.HallowJoustingLance, trueMelee }, { ItemID.JoustingLance, trueMelee }, { ItemID.NebulaChainsaw, trueMeleeNoSpeed }, - { ItemID.NightsEdge, trueMelee }, { ItemID.ObsidianSwordfish, Do(AutoReuse, TrueMelee) }, { ItemID.PiercingStarlight, trueMelee }, // Starlight { ItemID.Ruler, trueMelee }, @@ -426,12 +435,12 @@ namespace CalamityMod.Items #region CATEGORY 5: Point Blank support { ItemID.Blowpipe, pointBlank }, { ItemID.BorealWoodBow, pointBlank }, - { ItemID.ChainGun, pointBlank }, { ItemID.ChlorophyteShotbow, pointBlank }, { ItemID.CopperBow, pointBlank }, { ItemID.DartPistol, pointBlank }, { ItemID.DD2PhoenixBow, pointBlank }, // Phantom Phoenix { ItemID.EbonwoodBow, pointBlank }, + { ItemID.FairyQueenRangedItem, pointBlank }, //Eventide { ItemID.FlintlockPistol, pointBlank }, { ItemID.FlareGun, Do(PointBlank, Value(Item.sellPrice(silver: 10))) }, { ItemID.GoldBow, pointBlank }, @@ -443,7 +452,6 @@ namespace CalamityMod.Items { ItemID.OnyxBlaster, pointBlank }, { ItemID.PalmWoodBow, pointBlank }, { ItemID.PulseBow, pointBlank }, - { ItemID.QuadBarrelShotgun, pointBlank }, { ItemID.Revolver, Do(PointBlank, AutoReuse) }, { ItemID.RichMahoganyBow, pointBlank }, { ItemID.ShadewoodBow, pointBlank }, @@ -480,12 +488,9 @@ namespace CalamityMod.Items { ItemID.DeadlySphereStaff, Do(AutoReuse, UseExact(20)) }, { ItemID.FireWhip, autoReuse }, // Firecracker { ItemID.FlinxStaff, Do(AutoReuse, UseExact(35)) }, - { ItemID.HornetStaff, Do(AutoReuse, UseExact(30)) }, { ItemID.MaceWhip, autoReuse }, // Morning Star - { ItemID.MoonlordTurretStaff, Do(UseExact(15)) }, // Lunar Portal Staff { ItemID.OpticStaff, Do(AutoReuse, UseExact(25)) }, { ItemID.PirateStaff, Do(AutoReuse, UseExact(25)) }, - { ItemID.PygmyStaff, Do(AutoReuse, UseExact(20)) }, { ItemID.QueenSpiderStaff, Do(UseExact(25)) }, { ItemID.RainbowCrystalStaff, Do(UseExact(15)) }, { ItemID.RainbowWhip, autoReuse }, // Kaleidoscope @@ -498,7 +503,7 @@ namespace CalamityMod.Items { ItemID.SwordWhip, autoReuse }, // Durendal { ItemID.TempestStaff, Do(AutoReuse, UseExact(20)) }, { ItemID.ThornWhip, autoReuse }, // Snapthorn - { ItemID.VampireFrogStaff, Do(AutoReuse, UseExact(30)) }, + { ItemID.VampireFrogStaff, Do(AutoReuse, UseExact(30)) }, { ItemID.XenoStaff, Do(AutoReuse, UseExact(20)) }, #endregion @@ -520,7 +525,6 @@ namespace CalamityMod.Items { ItemID.FormatC, autoReuse }, { ItemID.GoldBroadsword, Do(AutoReuse, UseTurn) }, { ItemID.HelFire, autoReuse }, - { ItemID.HiveFive, autoReuse }, { ItemID.IronBroadsword, Do(AutoReuse, UseTurn) }, { ItemID.JungleYoyo, autoReuse }, // Amazon { ItemID.LifeCrystal, autoReuse }, @@ -597,6 +601,7 @@ namespace CalamityMod.Items { ItemID.SpicyPepper, Do(Value(Item.sellPrice(copper: 40))) }, { ItemID.Starfruit, Do(Value(Item.sellPrice(copper: 40))) }, { ItemID.PortableStool, Do(Value(Item.sellPrice(copper: 20))) }, // Step Stool + { ItemID.UncumberingStone, Do(Worthless) }, { ItemID.ViciousMushroom, Do(Worthless) }, { ItemID.VileMushroom, Do(Worthless) }, #endregion diff --git a/Items/CalamityResearchSorting.cs b/Items/CalamityResearchSorting.cs index 61d0f24227..ab78927f29 100644 --- a/Items/CalamityResearchSorting.cs +++ b/Items/CalamityResearchSorting.cs @@ -1,11 +1,11 @@ -namespace CalamityMod.Items +namespace CalamityMod.Items { public enum CalamityResearchSorting : int { - SpawnPrevention = 92, // After Event Items - RogueWeapon = 570, // After Summon Weapons - ClasslessWeapon = 580, // After Rogue Weapons - ToolsOther = 820, // Between Light Pets and Golf + SpawnPrevention = 92, // After Event Items + RogueWeapon = 570, // After Summon Weapons + ClasslessWeapon = 580, // After Rogue Weapons + ToolsOther = 820, // Between Light Pets and Golf LoreItems = 12000, // After everything else } } diff --git a/Items/Critters/AndroombaItem.cs b/Items/Critters/AndroombaItem.cs index 4bed1f2c7d..f425e0e5aa 100644 --- a/Items/Critters/AndroombaItem.cs +++ b/Items/Critters/AndroombaItem.cs @@ -17,6 +17,8 @@ namespace CalamityMod.Items.Critters public override void SetDefaults() { + Item.width = 36; + Item.height = 16; Item.useStyle = ItemUseStyleID.Swing; Item.autoReuse = true; Item.useTurn = true; @@ -26,8 +28,6 @@ namespace CalamityMod.Items.Critters Item.consumable = true; Item.noUseGraphic = true; Item.value = Item.buyPrice(0, 0, 30, 0); - Item.width = 36; - Item.height = 16; Item.makeNPC = (short)ModContent.NPCType(); Item.rare = ModContent.RarityType(); } diff --git a/Items/Critters/BabyCannonballJellyfishItem.cs b/Items/Critters/BabyCannonballJellyfishItem.cs index 511727fc22..0bd52d01a3 100644 --- a/Items/Critters/BabyCannonballJellyfishItem.cs +++ b/Items/Critters/BabyCannonballJellyfishItem.cs @@ -1,7 +1,7 @@ using CalamityMod.NPCs.Abyss; using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Critters { @@ -15,6 +15,8 @@ namespace CalamityMod.Items.Critters //Intentionally NOT bait due to bestiary entry on them being used as ammunition, although dynamite fishing in terraria does sound pretty fun public override void SetDefaults() { + Item.width = 26; + Item.height = 24; Item.useStyle = ItemUseStyleID.Swing; Item.autoReuse = true; Item.useTurn = true; @@ -24,8 +26,6 @@ namespace CalamityMod.Items.Critters Item.consumable = true; Item.noUseGraphic = true; Item.value = Item.buyPrice(0, 0, 30, 0); - Item.width = 26; - Item.height = 24; Item.makeNPC = (short)ModContent.NPCType(); Item.rare = ItemRarityID.Green; } diff --git a/Items/Critters/BabyFlakCrabItem.cs b/Items/Critters/BabyFlakCrabItem.cs index 45e68b27e6..f5ba7ddaac 100644 --- a/Items/Critters/BabyFlakCrabItem.cs +++ b/Items/Critters/BabyFlakCrabItem.cs @@ -1,7 +1,7 @@ using CalamityMod.NPCs.AcidRain; using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Critters { @@ -15,6 +15,8 @@ namespace CalamityMod.Items.Critters public override void SetDefaults() { + Item.width = 26; + Item.height = 24; Item.useStyle = ItemUseStyleID.Swing; Item.autoReuse = true; Item.useTurn = true; @@ -25,8 +27,6 @@ namespace CalamityMod.Items.Critters Item.noUseGraphic = true; Item.value = Item.buyPrice(0, 0, 30, 0); //item.CloneDefaults(2004); //Lightning Bug item - Item.width = 26; - Item.height = 24; Item.makeNPC = (short)ModContent.NPCType(); Item.rare = ItemRarityID.LightPurple; } diff --git a/Items/Critters/BabyGhostBellItem.cs b/Items/Critters/BabyGhostBellItem.cs index e7a81dd2b7..0c24b987a1 100644 --- a/Items/Critters/BabyGhostBellItem.cs +++ b/Items/Critters/BabyGhostBellItem.cs @@ -1,7 +1,7 @@ using CalamityMod.NPCs.SunkenSea; using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Critters { @@ -15,6 +15,8 @@ namespace CalamityMod.Items.Critters public override void SetDefaults() { + Item.width = 26; + Item.height = 24; Item.useStyle = ItemUseStyleID.Swing; Item.autoReuse = true; Item.useTurn = true; @@ -24,8 +26,6 @@ namespace CalamityMod.Items.Critters Item.consumable = true; Item.noUseGraphic = true; Item.value = Item.buyPrice(0, 0, 30, 0); - Item.width = 26; - Item.height = 24; Item.bait = 20; Item.makeNPC = (short)ModContent.NPCType(); Item.rare = ItemRarityID.Green; diff --git a/Items/Critters/NanodroidDysfunctionalItem.cs b/Items/Critters/NanodroidDysfunctionalItem.cs index d6ce71dafc..40ea800eed 100644 --- a/Items/Critters/NanodroidDysfunctionalItem.cs +++ b/Items/Critters/NanodroidDysfunctionalItem.cs @@ -16,6 +16,8 @@ namespace CalamityMod.Items.Critters public override void SetDefaults() { + Item.width = 16; + Item.height = 10; Item.useStyle = ItemUseStyleID.Swing; Item.autoReuse = true; Item.useTurn = true; @@ -25,8 +27,6 @@ namespace CalamityMod.Items.Critters Item.consumable = true; Item.noUseGraphic = true; Item.value = Item.buyPrice(0, 0, 30); - Item.width = 16; - Item.height = 10; Item.makeNPC = (short)ModContent.NPCType(); Item.rare = ModContent.RarityType(); } diff --git a/Items/Critters/NanodroidItem.cs b/Items/Critters/NanodroidItem.cs index 7b07171129..f6cb353171 100644 --- a/Items/Critters/NanodroidItem.cs +++ b/Items/Critters/NanodroidItem.cs @@ -16,6 +16,8 @@ namespace CalamityMod.Items.Critters public override void SetDefaults() { + Item.width = 16; + Item.height = 10; Item.useStyle = ItemUseStyleID.Swing; Item.autoReuse = true; Item.useTurn = true; @@ -25,8 +27,6 @@ namespace CalamityMod.Items.Critters Item.consumable = true; Item.noUseGraphic = true; Item.value = Item.buyPrice(0, 0, 30); - Item.width = 16; - Item.height = 10; Item.makeNPC = (short)ModContent.NPCType(); Item.rare = ModContent.RarityType(); } diff --git a/Items/Critters/NanodroidPlagueGreenItem.cs b/Items/Critters/NanodroidPlagueGreenItem.cs index 8f61e02540..7b9c9b8dcb 100644 --- a/Items/Critters/NanodroidPlagueGreenItem.cs +++ b/Items/Critters/NanodroidPlagueGreenItem.cs @@ -16,6 +16,8 @@ namespace CalamityMod.Items.Critters public override void SetDefaults() { + Item.width = 16; + Item.height = 10; Item.useStyle = ItemUseStyleID.Swing; Item.autoReuse = true; Item.useTurn = true; @@ -25,8 +27,6 @@ namespace CalamityMod.Items.Critters Item.consumable = true; Item.noUseGraphic = true; Item.value = Item.buyPrice(0, 0, 30); - Item.width = 16; - Item.height = 10; Item.makeNPC = (short)ModContent.NPCType(); Item.rare = ModContent.RarityType(); } diff --git a/Items/Critters/NanodroidPlagueRedItem.cs b/Items/Critters/NanodroidPlagueRedItem.cs index 576830f5f0..7e402536ff 100644 --- a/Items/Critters/NanodroidPlagueRedItem.cs +++ b/Items/Critters/NanodroidPlagueRedItem.cs @@ -16,6 +16,8 @@ namespace CalamityMod.Items.Critters public override void SetDefaults() { + Item.width = 16; + Item.height = 10; Item.useStyle = ItemUseStyleID.Swing; Item.autoReuse = true; Item.useTurn = true; @@ -25,8 +27,6 @@ namespace CalamityMod.Items.Critters Item.consumable = true; Item.noUseGraphic = true; Item.value = Item.buyPrice(0, 0, 30); - Item.width = 16; - Item.height = 10; Item.makeNPC = (short)ModContent.NPCType(); Item.rare = ModContent.RarityType(); } diff --git a/Items/Critters/PiggyItem.cs b/Items/Critters/PiggyItem.cs index a9af735a4b..10c728c170 100644 --- a/Items/Critters/PiggyItem.cs +++ b/Items/Critters/PiggyItem.cs @@ -15,6 +15,8 @@ namespace CalamityMod.Items.Critters public override void SetDefaults() { + Item.width = 26; + Item.height = 24; Item.useStyle = ItemUseStyleID.Swing; Item.autoReuse = true; Item.useTurn = true; @@ -23,8 +25,6 @@ namespace CalamityMod.Items.Critters Item.maxStack = 9999; Item.consumable = true; Item.noUseGraphic = true; - Item.width = 26; - Item.height = 24; Item.makeNPC = (short)ModContent.NPCType(); Item.value = Item.sellPrice(gold: 10); diff --git a/Items/Critters/RepairUnitItem.cs b/Items/Critters/RepairUnitItem.cs index 11120e24fa..637035c1b2 100644 --- a/Items/Critters/RepairUnitItem.cs +++ b/Items/Critters/RepairUnitItem.cs @@ -1,4 +1,4 @@ -using CalamityMod.NPCs.DraedonLabThings; +using CalamityMod.NPCs.DraedonLabThings; using CalamityMod.Rarities; using Terraria; using Terraria.ID; @@ -16,6 +16,8 @@ namespace CalamityMod.Items.Critters public override void SetDefaults() { + Item.width = 38; + Item.height = 24; Item.useStyle = ItemUseStyleID.Swing; Item.autoReuse = true; Item.useTurn = true; @@ -25,8 +27,6 @@ namespace CalamityMod.Items.Critters Item.consumable = true; Item.noUseGraphic = true; Item.value = Item.buyPrice(0, 0, 30, 0); - Item.width = 38; - Item.height = 24; Item.makeNPC = (short)ModContent.NPCType(); Item.rare = ModContent.RarityType(); } diff --git a/Items/Critters/SeaMinnowItem.cs b/Items/Critters/SeaMinnowItem.cs index 7b4fa60aa8..03cd070d1f 100644 --- a/Items/Critters/SeaMinnowItem.cs +++ b/Items/Critters/SeaMinnowItem.cs @@ -15,6 +15,8 @@ namespace CalamityMod.Items.Critters public override void SetDefaults() { + Item.width = 26; + Item.height = 24; Item.useStyle = ItemUseStyleID.Swing; Item.autoReuse = true; Item.useTurn = true; @@ -24,8 +26,6 @@ namespace CalamityMod.Items.Critters Item.consumable = true; Item.noUseGraphic = true; Item.value = Item.buyPrice(0, 0, 30, 0); - Item.width = 26; - Item.height = 24; Item.bait = 20; Item.makeNPC = (short)ModContent.NPCType(); Item.rare = ItemRarityID.Green; diff --git a/Items/Critters/TwinklerItem.cs b/Items/Critters/TwinklerItem.cs index c42dbc2601..67aaf2fc4c 100644 --- a/Items/Critters/TwinklerItem.cs +++ b/Items/Critters/TwinklerItem.cs @@ -15,6 +15,8 @@ namespace CalamityMod.Items.Critters public override void SetDefaults() { + Item.width = 26; + Item.height = 24; Item.useStyle = ItemUseStyleID.Swing; Item.autoReuse = true; Item.useTurn = true; @@ -25,8 +27,6 @@ namespace CalamityMod.Items.Critters Item.noUseGraphic = true; Item.value = Item.buyPrice(0, 0, 40, 0); //item.CloneDefaults(2004); //Lightning Bug item - Item.width = 26; - Item.height = 24; Item.bait = 40; Item.makeNPC = (short)ModContent.NPCType(); Item.rare = ItemRarityID.Green; diff --git a/Items/DifficultyItems/BallAndChain.cs b/Items/DifficultyItems/BallAndChain.cs index e30e3c98ba..46062dabac 100644 --- a/Items/DifficultyItems/BallAndChain.cs +++ b/Items/DifficultyItems/BallAndChain.cs @@ -14,10 +14,10 @@ namespace CalamityMod.Items.DifficultyItems Item.rare = ItemRarityID.Blue; } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.ToolsOther; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.ToolsOther; + } public override bool CanUseItem(Player player) => false; diff --git a/Items/DraedonMisc/AdvancedDisplay.cs b/Items/DraedonMisc/AdvancedDisplay.cs index 70a7c9858e..b0b9e79122 100644 --- a/Items/DraedonMisc/AdvancedDisplay.cs +++ b/Items/DraedonMisc/AdvancedDisplay.cs @@ -1,14 +1,14 @@ -using CalamityMod.Items.Materials; +using System; +using System.Collections.Generic; +using CalamityMod.CustomRecipes; +using CalamityMod.Items.Materials; +using CalamityMod.TileEntities; using CalamityMod.Tiles.DraedonSummoner; +using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Microsoft.Xna.Framework; -using CalamityMod.TileEntities; -using CalamityMod.CustomRecipes; -using System.Collections.Generic; -using System; namespace CalamityMod.Items.DraedonMisc { diff --git a/Items/DraedonMisc/AuricQuantumCoolingCell.cs b/Items/DraedonMisc/AuricQuantumCoolingCell.cs index 3f4add02e9..65bd24df8e 100644 --- a/Items/DraedonMisc/AuricQuantumCoolingCell.cs +++ b/Items/DraedonMisc/AuricQuantumCoolingCell.cs @@ -1,17 +1,17 @@ -using CalamityMod.CustomRecipes; +using System; +using System.Collections.Generic; +using System.Linq; +using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; using CalamityMod.Rarities; using CalamityMod.TileEntities; using CalamityMod.Tiles.DraedonSummoner; using CalamityMod.Tiles.Furniture.CraftingStations; +using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Microsoft.Xna.Framework; -using System.Collections.Generic; -using System.Linq; -using System; namespace CalamityMod.Items.DraedonMisc { @@ -65,7 +65,7 @@ namespace CalamityMod.Items.DraedonMisc public override void AddRecipes() { CreateRecipe(). - AddIngredient(2). + AddIngredient(5). AddIngredient(8). AddIngredient(8). AddIngredient(40). diff --git a/Items/DraedonMisc/CodebreakerBase.cs b/Items/DraedonMisc/CodebreakerBase.cs index beacd29e70..ed098bacda 100644 --- a/Items/DraedonMisc/CodebreakerBase.cs +++ b/Items/DraedonMisc/CodebreakerBase.cs @@ -1,8 +1,8 @@ -using Terraria.ModLoader; -using Terraria.ID; -using CalamityMod.Items.Materials; -using CalamityMod.Tiles.DraedonSummoner; +using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.DraedonStructures; +using CalamityMod.Tiles.DraedonSummoner; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.DraedonMisc { @@ -11,16 +11,16 @@ namespace CalamityMod.Items.DraedonMisc public new string LocalizationCategory => "Items.DraedonItems"; public override void SetDefaults() { + Item.width = 42; + Item.height = 32; Item.useStyle = ItemUseStyleID.Swing; Item.useTurn = true; Item.useAnimation = 15; Item.useTime = 10; Item.autoReuse = true; Item.consumable = true; - Item.width = 42; - Item.height = 32; Item.maxStack = 9999; - Item.rare = ItemRarityID.Orange; + Item.rare = ItemRarityID.Green; Item.createTile = ModContent.TileType(); } diff --git a/Items/DraedonMisc/DecryptionComputer.cs b/Items/DraedonMisc/DecryptionComputer.cs index bd2a756a19..4fe0a20244 100644 --- a/Items/DraedonMisc/DecryptionComputer.cs +++ b/Items/DraedonMisc/DecryptionComputer.cs @@ -1,14 +1,14 @@ -using CalamityMod.Items.Materials; +using System; +using System.Collections.Generic; +using CalamityMod.CustomRecipes; +using CalamityMod.Items.Materials; +using CalamityMod.TileEntities; using CalamityMod.Tiles.DraedonSummoner; +using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Microsoft.Xna.Framework; -using CalamityMod.TileEntities; -using CalamityMod.CustomRecipes; -using System.Collections.Generic; -using System; namespace CalamityMod.Items.DraedonMisc { diff --git a/Items/DraedonMisc/EncryptedSchematicHell.cs b/Items/DraedonMisc/EncryptedSchematicHell.cs index c724c2ac72..73fc317a35 100644 --- a/Items/DraedonMisc/EncryptedSchematicHell.cs +++ b/Items/DraedonMisc/EncryptedSchematicHell.cs @@ -1,17 +1,17 @@ -using CalamityMod.CustomRecipes; -using CalamityMod.Items.Materials; -using CalamityMod.Rarities; -using CalamityMod.Items.Weapons.DraedonsArsenal; -using CalamityMod.Items.DraedonMisc; -using CalamityMod.UI; -using System; +using System; using System.Collections.Generic; using System.Linq; +using CalamityMod.CustomRecipes; +using CalamityMod.Items.DraedonMisc; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Weapons.DraedonsArsenal; +using CalamityMod.Rarities; +using CalamityMod.UI; +using CalamityMod.UI.DraedonLogs; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.UI.DraedonLogs; namespace CalamityMod.Items.DraedonMisc { diff --git a/Items/DraedonMisc/EncryptedSchematicIce.cs b/Items/DraedonMisc/EncryptedSchematicIce.cs index 1ad91ecacb..f77253fff3 100644 --- a/Items/DraedonMisc/EncryptedSchematicIce.cs +++ b/Items/DraedonMisc/EncryptedSchematicIce.cs @@ -1,17 +1,17 @@ -using CalamityMod.CustomRecipes; -using CalamityMod.Items.Materials; -using CalamityMod.Items.Weapons.DraedonsArsenal; -using CalamityMod.Items.DraedonMisc; -using CalamityMod.Rarities; -using CalamityMod.UI; -using System; +using System; using System.Collections.Generic; using System.Linq; +using CalamityMod.CustomRecipes; +using CalamityMod.Items.DraedonMisc; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Weapons.DraedonsArsenal; +using CalamityMod.Rarities; +using CalamityMod.UI; +using CalamityMod.UI.DraedonLogs; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.UI.DraedonLogs; namespace CalamityMod.Items.DraedonMisc { diff --git a/Items/DraedonMisc/EncryptedSchematicJungle.cs b/Items/DraedonMisc/EncryptedSchematicJungle.cs index 83155ef887..f7d3b4bb8b 100644 --- a/Items/DraedonMisc/EncryptedSchematicJungle.cs +++ b/Items/DraedonMisc/EncryptedSchematicJungle.cs @@ -1,18 +1,18 @@ -using CalamityMod.CustomRecipes; -using CalamityMod.Items.Materials; -using CalamityMod.Items.Weapons.DraedonsArsenal; -using CalamityMod.Items.DraedonMisc; -using CalamityMod.Items.Placeables.PlaceableTurrets; -using CalamityMod.Rarities; -using CalamityMod.UI; -using System; +using System; using System.Collections.Generic; using System.Linq; +using CalamityMod.CustomRecipes; +using CalamityMod.Items.DraedonMisc; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.PlaceableTurrets; +using CalamityMod.Items.Weapons.DraedonsArsenal; +using CalamityMod.Rarities; +using CalamityMod.UI; +using CalamityMod.UI.DraedonLogs; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.UI.DraedonLogs; namespace CalamityMod.Items.DraedonMisc { diff --git a/Items/DraedonMisc/EncryptedSchematicPlanetoid.cs b/Items/DraedonMisc/EncryptedSchematicPlanetoid.cs index e62dc18893..eb3cc04462 100644 --- a/Items/DraedonMisc/EncryptedSchematicPlanetoid.cs +++ b/Items/DraedonMisc/EncryptedSchematicPlanetoid.cs @@ -1,18 +1,18 @@ -using CalamityMod.CustomRecipes; -using CalamityMod.Items.Materials; -using CalamityMod.Items.Weapons.DraedonsArsenal; -using CalamityMod.Items.DraedonMisc; -using CalamityMod.Items.Placeables.PlaceableTurrets; -using CalamityMod.Rarities; -using CalamityMod.UI; -using System; +using System; using System.Collections.Generic; using System.Linq; +using CalamityMod.CustomRecipes; +using CalamityMod.Items.DraedonMisc; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.PlaceableTurrets; +using CalamityMod.Items.Weapons.DraedonsArsenal; +using CalamityMod.Rarities; +using CalamityMod.UI; +using CalamityMod.UI.DraedonLogs; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.UI.DraedonLogs; namespace CalamityMod.Items.DraedonMisc { diff --git a/Items/DraedonMisc/EncryptedSchematicSunkenSea.cs b/Items/DraedonMisc/EncryptedSchematicSunkenSea.cs index ade641ff6b..01e8c386a2 100644 --- a/Items/DraedonMisc/EncryptedSchematicSunkenSea.cs +++ b/Items/DraedonMisc/EncryptedSchematicSunkenSea.cs @@ -1,18 +1,18 @@ -using CalamityMod.CustomRecipes; -using CalamityMod.Items.Materials; -using CalamityMod.Items.Weapons.DraedonsArsenal; -using CalamityMod.Items.DraedonMisc; -using CalamityMod.Items.Placeables.PlaceableTurrets; -using CalamityMod.UI; -using CalamityMod.Rarities; -using System; +using System; using System.Collections.Generic; using System.Linq; +using CalamityMod.CustomRecipes; +using CalamityMod.Items.DraedonMisc; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.PlaceableTurrets; +using CalamityMod.Items.Weapons.DraedonsArsenal; +using CalamityMod.Rarities; +using CalamityMod.UI; +using CalamityMod.UI.DraedonLogs; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.UI.DraedonLogs; namespace CalamityMod.Items.DraedonMisc { diff --git a/Items/DraedonMisc/LongRangedSensorArray.cs b/Items/DraedonMisc/LongRangedSensorArray.cs index 466d3d8b5c..3f0475db85 100644 --- a/Items/DraedonMisc/LongRangedSensorArray.cs +++ b/Items/DraedonMisc/LongRangedSensorArray.cs @@ -1,14 +1,14 @@ -using CalamityMod.Items.Materials; +using System; +using System.Collections.Generic; +using CalamityMod.CustomRecipes; +using CalamityMod.Items.Materials; +using CalamityMod.TileEntities; using CalamityMod.Tiles.DraedonSummoner; +using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Microsoft.Xna.Framework; -using CalamityMod.TileEntities; -using CalamityMod.CustomRecipes; -using System.Collections.Generic; -using System; namespace CalamityMod.Items.DraedonMisc { diff --git a/Items/DraedonMisc/VoltageRegulationSystem.cs b/Items/DraedonMisc/VoltageRegulationSystem.cs index 9419da3929..54508adb22 100644 --- a/Items/DraedonMisc/VoltageRegulationSystem.cs +++ b/Items/DraedonMisc/VoltageRegulationSystem.cs @@ -1,11 +1,11 @@ -using CalamityMod.CustomRecipes; +using System; +using System.Collections.Generic; +using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; using CalamityMod.Rarities; using CalamityMod.TileEntities; using CalamityMod.Tiles.DraedonSummoner; using Microsoft.Xna.Framework; -using System; -using System.Collections.Generic; using Terraria; using Terraria.Audio; using Terraria.ID; diff --git a/Items/Dyes/AerialiteDye.cs b/Items/Dyes/AerialiteDye.cs index 82ba14bdc8..c79e33ffbf 100644 --- a/Items/Dyes/AerialiteDye.cs +++ b/Items/Dyes/AerialiteDye.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Dyes { public class AerialiteDye : BaseDye { - public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(Mod.Assets.Request("Effects/Dyes/AerialiteDyeShader", AssetRequestMode.ImmediateLoad).Value), "DyePass"). + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(Mod.Assets.Request("Effects/Dyes/AerialiteDyeShader"), "DyePass"). UseColor(new Color(153, 200, 193)).UseSecondaryColor(new Color(236, 244, 213)).UseImage("Images/Misc/Perlin"); public override void SafeSetStaticDefaults() { diff --git a/Items/Dyes/AstralBlueDye.cs b/Items/Dyes/AstralBlueDye.cs index 228964ac7d..bbd2493650 100644 --- a/Items/Dyes/AstralBlueDye.cs +++ b/Items/Dyes/AstralBlueDye.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Dyes { public class AstralBlueDye : BaseDye { - public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(Mod.Assets.Request("Effects/Dyes/AstralBlueDyeShader", AssetRequestMode.ImmediateLoad).Value), "DyePass"). + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(Mod.Assets.Request("Effects/Dyes/AstralBlueDyeShader"), "DyePass"). UseColor(new Color(109, 242, 197)).UseSecondaryColor(new Color(42, 147, 154)); public override void SafeSetStaticDefaults() { diff --git a/Items/Dyes/AstralDye.cs b/Items/Dyes/AstralDye.cs index c7ec46f3f0..d3ef186e68 100644 --- a/Items/Dyes/AstralDye.cs +++ b/Items/Dyes/AstralDye.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Dyes { public class AstralDye : BaseDye { - public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(Mod.Assets.Request("Effects/Dyes/AstralDyeShader", AssetRequestMode.ImmediateLoad).Value), "DyePass"). + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(Mod.Assets.Request("Effects/Dyes/AstralDyeShader"), "DyePass"). UseColor(new Color(123, 99, 130)).UseSecondaryColor(new Color(189, 66, 84)).UseImage("Images/Misc/Perlin"); public override void SafeSetStaticDefaults() { diff --git a/Items/Dyes/AstralOrangeDye.cs b/Items/Dyes/AstralOrangeDye.cs index 038d6502e0..31a185e49c 100644 --- a/Items/Dyes/AstralOrangeDye.cs +++ b/Items/Dyes/AstralOrangeDye.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Dyes { public class AstralOrangeDye : BaseDye { - public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(Mod.Assets.Request("Effects/Dyes/AstralOrangeDyeShader", AssetRequestMode.ImmediateLoad).Value), "DyePass"). + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(Mod.Assets.Request("Effects/Dyes/AstralOrangeDyeShader"), "DyePass"). UseColor(new Color(255, 166, 94)).UseSecondaryColor(new Color(238, 93, 82)); public override void SafeSetStaticDefaults() { diff --git a/Items/Dyes/AstralSwirlDye.cs b/Items/Dyes/AstralSwirlDye.cs index 8247b06930..a72c796fa1 100644 --- a/Items/Dyes/AstralSwirlDye.cs +++ b/Items/Dyes/AstralSwirlDye.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Items.Dyes { public class AstralSwirlDye : BaseDye { - public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(Mod.Assets.Request("Effects/Dyes/AstralSwirlDyeShader", AssetRequestMode.ImmediateLoad).Value), "DyePass"). + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(Mod.Assets.Request("Effects/Dyes/AstralSwirlDyeShader"), "DyePass"). UseColor(new Color(42, 147, 154)).UseSecondaryColor(new Color(238, 93, 82)).UseImage("Images/Misc/Perlin"); public override void SafeSetStaticDefaults() { diff --git a/Items/Dyes/AuricDye.cs b/Items/Dyes/AuricDye.cs index c21b2620bc..0de8e802d1 100644 --- a/Items/Dyes/AuricDye.cs +++ b/Items/Dyes/AuricDye.cs @@ -12,8 +12,8 @@ namespace CalamityMod.Items.Dyes { public class AuricDye : BaseDye { - public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(Mod.Assets.Request("Effects/Dyes/AuricDyeShader", AssetRequestMode.ImmediateLoad).Value), "DyePass"). - UseColor(new Color(170, 96, 60)).UseSecondaryColor(new Color(226, 196, 106)).SetShaderTextureArmor(ModContent.Request("CalamityMod/ExtraTextures/GreyscaleGradients/SharpNoise", AssetRequestMode.ImmediateLoad)); + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(Mod.Assets.Request("Effects/Dyes/AuricDyeShader"), "DyePass"). + UseColor(new Color(170, 96, 60)).UseSecondaryColor(new Color(226, 196, 106)).SetShaderTextureArmor(ModContent.Request("CalamityMod/ExtraTextures/GreyscaleGradients/SharpNoise")); public override void SafeSetStaticDefaults() { Item.ResearchUnlockCount = 3; diff --git a/Items/Dyes/BloodflareDye.cs b/Items/Dyes/BloodflareDye.cs index 6b3756cf31..3fd574d142 100644 --- a/Items/Dyes/BloodflareDye.cs +++ b/Items/Dyes/BloodflareDye.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Dyes { public class BloodflareDye : BaseDye { - public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(Mod.Assets.Request("Effects/Dyes/BloodflareDyeShader", AssetRequestMode.ImmediateLoad).Value), "DyePass"). + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(Mod.Assets.Request("Effects/Dyes/BloodflareDyeShader"), "DyePass"). UseColor(new Color(122, 10, 60)).UseSecondaryColor(new Color(219, 102, 106)).UseImage("Images/Misc/Perlin"); public override void SafeSetStaticDefaults() { diff --git a/Items/Dyes/BlueCosmicFlameDye.cs b/Items/Dyes/BlueCosmicFlameDye.cs index 4e4b16743c..8dc622dd73 100644 --- a/Items/Dyes/BlueCosmicFlameDye.cs +++ b/Items/Dyes/BlueCosmicFlameDye.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Dyes { public class BlueCosmicFlameDye : BaseDye { - public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(Mod.Assets.Request("Effects/Dyes/CosmicFlameShader", AssetRequestMode.ImmediateLoad).Value), "DyePass"). + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(Mod.Assets.Request("Effects/Dyes/CosmicFlameShader"), "DyePass"). UseColor(new Color(52, 212, 229)).UseSecondaryColor(new Color(52, 212, 229)).UseImage("Images/Misc/noise").UseSaturation(0f); public override void SafeSetStaticDefaults() { diff --git a/Items/Dyes/BlueStatigelDye.cs b/Items/Dyes/BlueStatigelDye.cs index 6cdec2e56c..41980c70b0 100644 --- a/Items/Dyes/BlueStatigelDye.cs +++ b/Items/Dyes/BlueStatigelDye.cs @@ -1,17 +1,17 @@ using CalamityMod.Items.Materials; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; +using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Graphics.Shaders; -using Microsoft.Xna.Framework; -using ReLogic.Content; namespace CalamityMod.Items.Dyes { public class BlueStatigelDye : BaseDye { - public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(Mod.Assets.Request("Effects/Dyes/SlimeGodDyeShader", AssetRequestMode.ImmediateLoad).Value), "DyePass"). + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(Mod.Assets.Request("Effects/Dyes/SlimeGodDyeShader"), "DyePass"). UseColor(new Color(80, 170, 206)).UseSecondaryColor(new Color(81, 87, 119)).UseImage("Images/Misc/Perlin"); public override void SafeSetStaticDefaults() { diff --git a/Items/Dyes/BrimflameDye.cs b/Items/Dyes/BrimflameDye.cs index 18c62dda02..a73183ac1f 100644 --- a/Items/Dyes/BrimflameDye.cs +++ b/Items/Dyes/BrimflameDye.cs @@ -1,17 +1,17 @@ -using Microsoft.Xna.Framework.Graphics; +using CalamityMod.Items.Placeables; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; +using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Graphics.Shaders; -using Microsoft.Xna.Framework; -using CalamityMod.Items.Placeables; -using ReLogic.Content; namespace CalamityMod.Items.Dyes { public class BrimflameDye : BaseDye { - public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(Mod.Assets.Request("Effects/Dyes/BrimflameDyeShader", AssetRequestMode.ImmediateLoad).Value), "DyePass"). + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(Mod.Assets.Request("Effects/Dyes/BrimflameDyeShader"), "DyePass"). UseColor(new Color(252, 147, 34)).UseSecondaryColor(new Color(216, 41, 26)).UseImage("Images/Misc/Perlin"); public override void SafeSetStaticDefaults() { diff --git a/Items/Dyes/CalamitousDye.cs b/Items/Dyes/CalamitousDye.cs index b75c4069ec..7c6bdeef74 100644 --- a/Items/Dyes/CalamitousDye.cs +++ b/Items/Dyes/CalamitousDye.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Dyes { public class CalamitousDye : BaseDye { - public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(Mod.Assets.Request("Effects/Dyes/CalamitousDyeShader", AssetRequestMode.ImmediateLoad).Value), "DyePass"). + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(Mod.Assets.Request("Effects/Dyes/CalamitousDyeShader"), "DyePass"). UseColor(new Color(227, 79, 79)).UseSecondaryColor(new Color(145, 27, 135)).UseImage("Images/Misc/Perlin"); public override void SafeSetStaticDefaults() { diff --git a/Items/Dyes/CeaselessDye.cs b/Items/Dyes/CeaselessDye.cs index 45399c642e..42544392b3 100644 --- a/Items/Dyes/CeaselessDye.cs +++ b/Items/Dyes/CeaselessDye.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Dyes { public class CeaselessDye : BaseDye { - public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(Mod.Assets.Request("Effects/Dyes/CeaselessDyeShader", AssetRequestMode.ImmediateLoad).Value), "DyePass"); + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(Mod.Assets.Request("Effects/Dyes/CeaselessDyeShader"), "DyePass"); public override void SafeSetStaticDefaults() { Item.ResearchUnlockCount = 3; diff --git a/Items/Dyes/CosmiliteDye.cs b/Items/Dyes/CosmiliteDye.cs index 3e4b6f5d72..ea020175c2 100644 --- a/Items/Dyes/CosmiliteDye.cs +++ b/Items/Dyes/CosmiliteDye.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Dyes { public class CosmiliteDye : BaseDye { - public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(Mod.Assets.Request("Effects/Dyes/CosmiliteDyeShader", AssetRequestMode.ImmediateLoad).Value), "DyePass"). + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(Mod.Assets.Request("Effects/Dyes/CosmiliteDyeShader"), "DyePass"). UseColor(new Color(154, 140, 191)).UseSecondaryColor(new Color(249, 109, 235)).UseImage("Images/Misc/Perlin"); public override void SafeSetStaticDefaults() { diff --git a/Items/Dyes/CryonicDye.cs b/Items/Dyes/CryonicDye.cs index e802e10642..b30a59f52d 100644 --- a/Items/Dyes/CryonicDye.cs +++ b/Items/Dyes/CryonicDye.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Dyes { public class CryonicDye : BaseDye { - public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(Mod.Assets.Request("Effects/Dyes/CryonicDyeShader", AssetRequestMode.ImmediateLoad).Value), "DyePass"). + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(Mod.Assets.Request("Effects/Dyes/CryonicDyeShader"), "DyePass"). UseColor(new Color(138, 225, 255)).UseSecondaryColor(new Color(90, 90, 204)).UseImage("Images/Misc/Perlin"); public override void SafeSetStaticDefaults() { diff --git a/Items/Dyes/DefiledFlameDye.cs b/Items/Dyes/DefiledFlameDye.cs index b0cd3b41e0..1e8fe79c46 100644 --- a/Items/Dyes/DefiledFlameDye.cs +++ b/Items/Dyes/DefiledFlameDye.cs @@ -1,15 +1,15 @@ -using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Graphics.Shaders; -using Microsoft.Xna.Framework; using Terraria.ID; -using ReLogic.Content; namespace CalamityMod.Items.Dyes { public class DefiledFlameDye : BaseDye { - public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(Mod.Assets.Request("Effects/Dyes/DefiledFlameDyeShader", AssetRequestMode.ImmediateLoad).Value), "DyePass"). + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(Mod.Assets.Request("Effects/Dyes/DefiledFlameDyeShader"), "DyePass"). UseColor(new Color(106, 190, 48)).UseSecondaryColor(new Color(204, 248, 48)).UseImage("Images/Misc/Perlin"); public override void SafeSetStaticDefaults() { @@ -19,7 +19,8 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { Item.rare = ItemRarityID.LightRed; - Item.value = CalamityGlobalItem.Rarity4BuyPrice; + //Light red is 12 gold, and this is purchased with 10 gold, this would make it sell for 6 gold, still far more expensive than vanilla dyes + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice/2; } } } diff --git a/Items/Dyes/DragonSoulDye.cs b/Items/Dyes/DragonSoulDye.cs index 6bbe32b3de..70db1abca8 100644 --- a/Items/Dyes/DragonSoulDye.cs +++ b/Items/Dyes/DragonSoulDye.cs @@ -1,17 +1,17 @@ using CalamityMod.Items.Materials; using CalamityMod.Rarities; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; +using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Graphics.Shaders; -using ReLogic.Content; namespace CalamityMod.Items.Dyes { public class DragonSoulDye : BaseDye { - public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(Mod.Assets.Request("Effects/Dyes/DragonSoulDyeShader", AssetRequestMode.ImmediateLoad).Value), "DyePass"); + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(Mod.Assets.Request("Effects/Dyes/DragonSoulDyeShader"), "DyePass"); public override void SafeSetStaticDefaults() { Item.ResearchUnlockCount = 3; diff --git a/Items/Dyes/ElementalDye.cs b/Items/Dyes/ElementalDye.cs index 7f289c7822..6bd1a311a2 100644 --- a/Items/Dyes/ElementalDye.cs +++ b/Items/Dyes/ElementalDye.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Items.Dyes { public class ElementalDye : BaseDye { - public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(Mod.Assets.Request("Effects/Dyes/ElementalDyeShader", AssetRequestMode.ImmediateLoad).Value), "DyePass").UseImage("Images/Misc/Perlin"); + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(Mod.Assets.Request("Effects/Dyes/ElementalDyeShader"), "DyePass").UseImage("Images/Misc/Perlin"); public override void SafeSetStaticDefaults() { Item.ResearchUnlockCount = 3; diff --git a/Items/Dyes/EndothermicDye.cs b/Items/Dyes/EndothermicDye.cs index 044768bbce..2209ece7a6 100644 --- a/Items/Dyes/EndothermicDye.cs +++ b/Items/Dyes/EndothermicDye.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Dyes { public class EndothermicDye : BaseDye { - public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(Mod.Assets.Request("Effects/Dyes/EndothermicDyeShader", AssetRequestMode.ImmediateLoad).Value), "DyePass"). + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(Mod.Assets.Request("Effects/Dyes/EndothermicDyeShader"), "DyePass"). UseColor(new Color(123, 205, 237)).UseSecondaryColor(new Color(85, 85, 171)); public override void SafeSetStaticDefaults() { diff --git a/Items/Dyes/ExoDye.cs b/Items/Dyes/ExoDye.cs index 41c57a208f..6c6c61cbce 100644 --- a/Items/Dyes/ExoDye.cs +++ b/Items/Dyes/ExoDye.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Dyes { public override ArmorShaderData ShaderDataToBind { - get => new ArmorShaderData(new Ref(Mod.Assets.Request("Effects/Dyes/ExoDyeShader", AssetRequestMode.ImmediateLoad).Value), "DyePass").UseImage("Images/Misc/Perlin"); + get => new ArmorShaderData(Mod.Assets.Request("Effects/Dyes/ExoDyeShader"), "DyePass").UseImage("Images/Misc/Perlin"); } public override void SafeSetStaticDefaults() diff --git a/Items/Dyes/PolterplasmDye.cs b/Items/Dyes/NecroplasmicDye.cs similarity index 77% rename from Items/Dyes/PolterplasmDye.cs rename to Items/Dyes/NecroplasmicDye.cs index 3841428464..8c9c1dd00d 100644 --- a/Items/Dyes/PolterplasmDye.cs +++ b/Items/Dyes/NecroplasmicDye.cs @@ -1,18 +1,18 @@ using CalamityMod.Items.Materials; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; +using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Graphics.Shaders; -using Microsoft.Xna.Framework; -using ReLogic.Content; namespace CalamityMod.Items.Dyes { - [LegacyName("PhantoplasmDye")] - public class PolterplasmDye : BaseDye + [LegacyName("PhantoplasmDye", "PolterplasmDye")] + public class NecroplasmicDye : BaseDye { - public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(Mod.Assets.Request("Effects/Dyes/PolterplasmDyeShader", AssetRequestMode.ImmediateLoad).Value), "DyePass"). + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(Mod.Assets.Request("Effects/Dyes/NecroplasmicDyeShader"), "DyePass"). UseColor(new Color(245, 143, 182)).UseSecondaryColor(new Color(119, 238, 255)).UseImage("Images/Misc/Perlin"); public override void SafeSetStaticDefaults() @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Dyes { CreateRecipe(2). AddIngredient(ItemID.BottledWater, 2). - AddIngredient(3). + AddIngredient(3). AddTile(TileID.DyeVat). Register(); } diff --git a/Items/Dyes/PolterplasmDye.png b/Items/Dyes/NecroplasmicDye.png similarity index 100% rename from Items/Dyes/PolterplasmDye.png rename to Items/Dyes/NecroplasmicDye.png diff --git a/Items/Dyes/NightmareDye.cs b/Items/Dyes/NightmareDye.cs index a9aa8402a6..0363f95a00 100644 --- a/Items/Dyes/NightmareDye.cs +++ b/Items/Dyes/NightmareDye.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Dyes { public class NightmareDye : BaseDye { - public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(Mod.Assets.Request("Effects/Dyes/NightmareDyeShader", AssetRequestMode.ImmediateLoad).Value), "DyePass"). + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(Mod.Assets.Request("Effects/Dyes/NightmareDyeShader"), "DyePass"). UseColor(new Color(249, 81, 0)).UseSecondaryColor(new Color(255, 203, 106)); public override void SafeSetStaticDefaults() { diff --git a/Items/Dyes/PinkCosmicFlameDye.cs b/Items/Dyes/PinkCosmicFlameDye.cs index 1b6c4d3362..91fefe5734 100644 --- a/Items/Dyes/PinkCosmicFlameDye.cs +++ b/Items/Dyes/PinkCosmicFlameDye.cs @@ -4,15 +4,15 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; using Terraria; +using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Graphics.Shaders; namespace CalamityMod.Items.Dyes { public class PinkCosmicFlameDye : BaseDye { - public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(Mod.Assets.Request("Effects/Dyes/CosmicFlameShader", AssetRequestMode.ImmediateLoad).Value), "DyePass"). + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(Mod.Assets.Request("Effects/Dyes/CosmicFlameShader"), "DyePass"). UseColor(new Color(255, 115, 221)).UseSecondaryColor(new Color(255, 115, 221)).UseImage("Images/Misc/noise").UseSaturation(0f); public override void SafeSetStaticDefaults() { diff --git a/Items/Dyes/PinkStatigelDye.cs b/Items/Dyes/PinkStatigelDye.cs index 923e20fb5e..85581e23fc 100644 --- a/Items/Dyes/PinkStatigelDye.cs +++ b/Items/Dyes/PinkStatigelDye.cs @@ -1,17 +1,17 @@ using CalamityMod.Items.Materials; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; +using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Graphics.Shaders; -using Microsoft.Xna.Framework; -using ReLogic.Content; namespace CalamityMod.Items.Dyes { public class PinkStatigelDye : BaseDye { - public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(Mod.Assets.Request("Effects/Dyes/SlimeGodDyeShader", AssetRequestMode.ImmediateLoad).Value), "DyePass"). + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(Mod.Assets.Request("Effects/Dyes/SlimeGodDyeShader"), "DyePass"). UseColor(new Color(249, 129, 185)).UseSecondaryColor(new Color(131, 58, 103)).UseImage("Images/Misc/Perlin"); public override void SafeSetStaticDefaults() { diff --git a/Items/Dyes/ProfanedFlameDye.cs b/Items/Dyes/ProfanedFlameDye.cs index 54fc313f5e..cbb8be5523 100644 --- a/Items/Dyes/ProfanedFlameDye.cs +++ b/Items/Dyes/ProfanedFlameDye.cs @@ -1,17 +1,17 @@ using CalamityMod.Items.Materials; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; +using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Graphics.Shaders; -using Microsoft.Xna.Framework; -using ReLogic.Content; namespace CalamityMod.Items.Dyes { public class ProfanedFlameDye : BaseDye { - public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(Mod.Assets.Request("Effects/Dyes/ProfanedFlameDyeShader", AssetRequestMode.ImmediateLoad).Value), "DyePass"). + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(Mod.Assets.Request("Effects/Dyes/ProfanedFlameDyeShader"), "DyePass"). UseColor(new Color(255, 191, 73)).UseSecondaryColor(new Color(255, 255, 186)).UseImage("Images/Misc/Perlin"); public override void SafeSetStaticDefaults() { diff --git a/Items/Dyes/ProfanedMoonlightDye.cs b/Items/Dyes/ProfanedMoonlightDye.cs index 7fcf1f715f..3292d085fa 100644 --- a/Items/Dyes/ProfanedMoonlightDye.cs +++ b/Items/Dyes/ProfanedMoonlightDye.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Items.Dyes { public class ProfanedMoonlightDye : BaseDye { - public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(Mod.Assets.Request("Effects/Dyes/ProfanedMoonlightDye", AssetRequestMode.ImmediateLoad).Value), "DyePass"); + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(Mod.Assets.Request("Effects/Dyes/ProfanedMoonlightDye"), "DyePass"); public override void SafeSetStaticDefaults() { Item.ResearchUnlockCount = 3; diff --git a/Items/Dyes/ReaverDye.cs b/Items/Dyes/ReaverDye.cs index 76d97dfb86..1c6cebc090 100644 --- a/Items/Dyes/ReaverDye.cs +++ b/Items/Dyes/ReaverDye.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Dyes { public class ReaverDye : BaseDye { - public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(Mod.Assets.Request("Effects/Dyes/ReaverDyeShader", AssetRequestMode.ImmediateLoad).Value), "DyePass"). + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(Mod.Assets.Request("Effects/Dyes/ReaverDyeShader"), "DyePass"). UseColor(new Color(54, 164, 66)).UseSecondaryColor(new Color(224, 115, 65)); public override void SafeSetStaticDefaults() { diff --git a/Items/Dyes/ShadowspecDye.cs b/Items/Dyes/ShadowspecDye.cs index de232f5f93..f0986a270d 100644 --- a/Items/Dyes/ShadowspecDye.cs +++ b/Items/Dyes/ShadowspecDye.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Dyes { public class ShadowspecDye : BaseDye { - public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(Mod.Assets.Request("Effects/Dyes/ShadowspecDyeShader", AssetRequestMode.ImmediateLoad).Value), "DyePass"). + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(Mod.Assets.Request("Effects/Dyes/ShadowspecDyeShader"), "DyePass"). UseColor(new Color(46, 27, 60)).UseSecondaryColor(new Color(132, 142, 191)).UseImage("Images/Misc/Perlin"); public override void SafeSetStaticDefaults() { diff --git a/Items/Dyes/SlimeGodDye.cs b/Items/Dyes/SlimeGodDye.cs index 2e25e75fae..787ee03fa9 100644 --- a/Items/Dyes/SlimeGodDye.cs +++ b/Items/Dyes/SlimeGodDye.cs @@ -1,16 +1,16 @@ -using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; +using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Graphics.Shaders; -using Microsoft.Xna.Framework; -using ReLogic.Content; namespace CalamityMod.Items.Dyes { public class SlimeGodDye : BaseDye { - public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(Mod.Assets.Request("Effects/Dyes/SlimeGodDyeShader", AssetRequestMode.ImmediateLoad).Value), "DyePass"). + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(Mod.Assets.Request("Effects/Dyes/SlimeGodDyeShader"), "DyePass"). UseColor(new Color(80, 170, 206)).UseSecondaryColor(new Color(131, 58, 103)).UseImage("Images/Misc/Perlin"); public override void SafeSetStaticDefaults() { diff --git a/Items/Dyes/StratusDye.cs b/Items/Dyes/StratusDye.cs index f50cb97277..e1eb845d40 100644 --- a/Items/Dyes/StratusDye.cs +++ b/Items/Dyes/StratusDye.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Dyes { public class StratusDye : BaseDye { - public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(Mod.Assets.Request("Effects/Dyes/StratusDyeShader", AssetRequestMode.ImmediateLoad).Value), "DyePass"). + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(Mod.Assets.Request("Effects/Dyes/StratusDyeShader"), "DyePass"). UseColor(new Color(36, 86, 163)).UseSecondaryColor(new Color(124, 204, 223)).UseImage("Images/Misc/Perlin"); public override void SafeSetStaticDefaults() { diff --git a/Items/Dyes/SwirlingCosmicFlameDye.cs b/Items/Dyes/SwirlingCosmicFlameDye.cs index 965c99ca4d..73493fadce 100644 --- a/Items/Dyes/SwirlingCosmicFlameDye.cs +++ b/Items/Dyes/SwirlingCosmicFlameDye.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Dyes { public class SwirlingCosmicFlameDye : BaseDye { - public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(Mod.Assets.Request("Effects/Dyes/CosmicFlameShader", AssetRequestMode.ImmediateLoad).Value), "DyePass"). + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(Mod.Assets.Request("Effects/Dyes/CosmicFlameShader"), "DyePass"). UseColor(new Color(52, 212, 229)).UseSecondaryColor(new Color(255, 115, 221)).UseImage("Images/Misc/noise").UseSaturation(1f); public override void SafeSetStaticDefaults() { diff --git a/Items/Fishing/AstralCatches/AldebaranAlewife.cs b/Items/Fishing/AstralCatches/AldebaranAlewife.cs index 8837af0729..2573a20c7f 100644 --- a/Items/Fishing/AstralCatches/AldebaranAlewife.cs +++ b/Items/Fishing/AstralCatches/AldebaranAlewife.cs @@ -1,6 +1,6 @@ using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Fishing.AstralCatches { @@ -22,9 +22,9 @@ namespace CalamityMod.Items.Fishing.AstralCatches Item.rare = ItemRarityID.Blue; } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.Fish; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.Fish; + } } } diff --git a/Items/Fishing/AstralCatches/ArcturusAstroidean.cs b/Items/Fishing/AstralCatches/ArcturusAstroidean.cs index f76889af48..6149190827 100644 --- a/Items/Fishing/AstralCatches/ArcturusAstroidean.cs +++ b/Items/Fishing/AstralCatches/ArcturusAstroidean.cs @@ -1,6 +1,6 @@ using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Fishing.AstralCatches { @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Fishing.AstralCatches Item.maxStack = 9999; Item.value = Item.sellPrice(silver: 10); Item.rare = ItemRarityID.Orange; - Item.bait = 40; + Item.bait = 40; } } } diff --git a/Items/Fishing/AstralCatches/AstralCrate.cs b/Items/Fishing/AstralCatches/AstralCrate.cs index e2d9075e80..690c4c8e8b 100644 --- a/Items/Fishing/AstralCatches/AstralCrate.cs +++ b/Items/Fishing/AstralCatches/AstralCrate.cs @@ -24,14 +24,15 @@ namespace CalamityMod.Items.Fishing.AstralCatches Item.ResearchUnlockCount = 5; ItemID.Sets.IsFishingCrate[Type] = true; ItemID.Sets.IsFishingCrateHardmode[Type] = true; + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); } public override void SetDefaults() { - Item.maxStack = 9999; - Item.consumable = true; Item.width = 32; Item.height = 32; + Item.maxStack = 9999; + Item.consumable = true; Item.rare = ItemRarityID.Green; Item.value = Item.sellPrice(gold: 1); Item.createTile = ModContent.TileType(); @@ -42,10 +43,10 @@ namespace CalamityMod.Items.Fishing.AstralCatches Item.useStyle = ItemUseStyleID.Swing; } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.Crates; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.Crates; + } public override bool CanRightClick() => true; public override void ModifyItemLoot(ItemLoot itemLoot) @@ -54,7 +55,7 @@ namespace CalamityMod.Items.Fishing.AstralCatches var postAstrumDeus = itemLoot.DefineConditionalDropSet(() => DownedBossSystem.downedAstrumDeus); // Materials - itemLoot.Add(ModContent.ItemType(), 1, 5, 10); + itemLoot.Add(ModContent.ItemType(), 1, 5, 10); itemLoot.Add(ItemID.FallenStar, 1, 5, 10); itemLoot.Add(ItemID.Meteorite, 5, 10, 20); itemLoot.Add(ItemID.MeteoriteBar, 10, 1, 3); diff --git a/Items/Fishing/AstralCatches/MonolithCrate.cs b/Items/Fishing/AstralCatches/MonolithCrate.cs new file mode 100644 index 0000000000..060d03675b --- /dev/null +++ b/Items/Fishing/AstralCatches/MonolithCrate.cs @@ -0,0 +1,65 @@ +using CalamityMod.Items.Critters; +using CalamityMod.Tiles.Astral; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Fishing.AstralCatches +{ + public class MonolithCrate : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Fishing"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 5; + ItemID.Sets.IsFishingCrate[Type] = true; + } + + public override void SetDefaults() + { + Item.width = 32; + Item.height = 32; + Item.maxStack = 9999; + Item.consumable = true; + Item.rare = ItemRarityID.Green; + Item.value = Item.sellPrice(gold: 1); + Item.createTile = ModContent.TileType(); + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + } + + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.Crates; + } + + public override bool CanRightClick() => true; + public override void ModifyItemLoot(ItemLoot itemLoot) + { + // Materials + itemLoot.Add(ItemID.FallenStar, 1, 5, 10); + itemLoot.Add(ItemID.Meteorite, 5, 10, 20); + itemLoot.Add(ItemID.MeteoriteBar, 10, 1, 3); + + // Pet + itemLoot.Add(ModContent.ItemType(), 10); + + // Bait + itemLoot.Add(ModContent.ItemType(), 5, 1, 3); + itemLoot.Add(ItemID.EnchantedNightcrawler, 5, 1, 3); + itemLoot.Add(ModContent.ItemType(), 5, 1, 3); + + itemLoot.Add(ItemID.Firefly, 3, 1, 3); + + // Potions + itemLoot.AddCratePotionRules(false); + + // Money + itemLoot.Add(ItemID.SilverCoin, 1, 10, 90); + itemLoot.Add(ItemID.GoldCoin, 2, 1, 5); + } + } +} diff --git a/Items/Fishing/AstralCatches/MonolithCrate.png b/Items/Fishing/AstralCatches/MonolithCrate.png new file mode 100644 index 0000000000..a361991305 Binary files /dev/null and b/Items/Fishing/AstralCatches/MonolithCrate.png differ diff --git a/Items/Fishing/AstralCatches/ProcyonidPrawn.cs b/Items/Fishing/AstralCatches/ProcyonidPrawn.cs index 7f169b54b1..c560f5dba4 100644 --- a/Items/Fishing/AstralCatches/ProcyonidPrawn.cs +++ b/Items/Fishing/AstralCatches/ProcyonidPrawn.cs @@ -1,6 +1,6 @@ using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Fishing.AstralCatches { @@ -22,9 +22,9 @@ namespace CalamityMod.Items.Fishing.AstralCatches Item.rare = ItemRarityID.Blue; } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.Fish; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.Fish; + } } } diff --git a/Items/Fishing/AstralCatches/TwinklingPollox.cs b/Items/Fishing/AstralCatches/TwinklingPollox.cs index 236148fdb5..5f77a94a91 100644 --- a/Items/Fishing/AstralCatches/TwinklingPollox.cs +++ b/Items/Fishing/AstralCatches/TwinklingPollox.cs @@ -1,6 +1,6 @@ using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Fishing.AstralCatches { @@ -22,9 +22,9 @@ namespace CalamityMod.Items.Fishing.AstralCatches Item.rare = ItemRarityID.Blue; } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.Fish; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.Fish; + } } } diff --git a/Items/Fishing/AstralCatches/UrsaSergeant.cs b/Items/Fishing/AstralCatches/UrsaSergeant.cs index 0d98e694da..f9743d26be 100644 --- a/Items/Fishing/AstralCatches/UrsaSergeant.cs +++ b/Items/Fishing/AstralCatches/UrsaSergeant.cs @@ -11,10 +11,10 @@ namespace CalamityMod.Items.Fishing.AstralCatches public new string LocalizationCategory => "Items.Fishing"; public override void SetDefaults() { - Item.defense = 20; Item.width = 36; Item.height = 26; - Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.defense = 20; + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; Item.accessory = true; } diff --git a/Items/Fishing/BrimstoneCragCatches/BrimstoneCrate.cs b/Items/Fishing/BrimstoneCragCatches/BrimstoneCrate.cs index 9c955d3f6b..6a0413d264 100644 --- a/Items/Fishing/BrimstoneCragCatches/BrimstoneCrate.cs +++ b/Items/Fishing/BrimstoneCragCatches/BrimstoneCrate.cs @@ -14,14 +14,16 @@ namespace CalamityMod.Items.Fishing.BrimstoneCragCatches { Item.ResearchUnlockCount = 5; ItemID.Sets.IsFishingCrate[Type] = true; + ItemID.Sets.IsFishingCrateHardmode[Type] = true; + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); } public override void SetDefaults() { - Item.maxStack = 9999; - Item.consumable = true; Item.width = 32; Item.height = 32; + Item.maxStack = 9999; + Item.consumable = true; Item.rare = ItemRarityID.Green; Item.value = Item.sellPrice(gold: 1); Item.createTile = ModContent.TileType(); @@ -32,10 +34,10 @@ namespace CalamityMod.Items.Fishing.BrimstoneCragCatches Item.useStyle = ItemUseStyleID.Swing; } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.Crates; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.Crates; + } public override bool CanRightClick() => true; public override void ModifyItemLoot(ItemLoot itemLoot) diff --git a/Items/Fishing/BrimstoneCragCatches/CharredLasher.cs b/Items/Fishing/BrimstoneCragCatches/CharredLasher.cs index 8e5877e565..db8bc64626 100644 --- a/Items/Fishing/BrimstoneCragCatches/CharredLasher.cs +++ b/Items/Fishing/BrimstoneCragCatches/CharredLasher.cs @@ -1,6 +1,6 @@ using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Fishing.BrimstoneCragCatches { @@ -22,9 +22,9 @@ namespace CalamityMod.Items.Fishing.BrimstoneCragCatches Item.rare = ItemRarityID.Orange; } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.Fish; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.Fish; + } } } diff --git a/Items/Fishing/BrimstoneCragCatches/CoastalDemonfish.cs b/Items/Fishing/BrimstoneCragCatches/CoastalDemonfish.cs index f15cb1d252..8d29188f52 100644 --- a/Items/Fishing/BrimstoneCragCatches/CoastalDemonfish.cs +++ b/Items/Fishing/BrimstoneCragCatches/CoastalDemonfish.cs @@ -1,6 +1,6 @@ using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Fishing.BrimstoneCragCatches { @@ -22,9 +22,9 @@ namespace CalamityMod.Items.Fishing.BrimstoneCragCatches Item.rare = ItemRarityID.Blue; } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.Fish; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.Fish; + } } } diff --git a/Items/Fishing/BrimstoneCragCatches/CragBullhead.cs b/Items/Fishing/BrimstoneCragCatches/CragBullhead.cs index 34cbac3247..ee7ec5f6cf 100644 --- a/Items/Fishing/BrimstoneCragCatches/CragBullhead.cs +++ b/Items/Fishing/BrimstoneCragCatches/CragBullhead.cs @@ -1,6 +1,6 @@ using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Fishing.BrimstoneCragCatches { @@ -22,9 +22,9 @@ namespace CalamityMod.Items.Fishing.BrimstoneCragCatches Item.rare = ItemRarityID.Blue; } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.Fish; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.Fish; + } } } diff --git a/Items/Fishing/BrimstoneCragCatches/DragoonDrizzlefish.cs b/Items/Fishing/BrimstoneCragCatches/DragoonDrizzlefish.cs index 4b57794be1..892b507f4e 100644 --- a/Items/Fishing/BrimstoneCragCatches/DragoonDrizzlefish.cs +++ b/Items/Fishing/BrimstoneCragCatches/DragoonDrizzlefish.cs @@ -19,21 +19,22 @@ namespace CalamityMod.Items.Fishing.BrimstoneCragCatches public int shotCounter = 0; public override void SetStaticDefaults() { + ItemID.Sets.IsRangedSpecialistWeapon[Item.type] = true; Item.staff[Item.type] = true; //so it doesn't look weird af when holding it } public override void SetDefaults() { - Item.damage = 18; - Item.DamageType = DamageClass.Ranged; Item.width = 42; Item.height = 38; + Item.damage = 18; + Item.DamageType = DamageClass.Ranged; Item.useTime = 20; Item.useAnimation = 20; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 1.1f; - Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; Item.UseSound = SoundID.Item20; Item.autoReuse = true; @@ -118,7 +119,7 @@ namespace CalamityMod.Items.Fishing.BrimstoneCragCatches return false; } } - + velocity = velocity.RotatedByRandom(MathHelper.ToRadians(5.5f)); int shotType = ModContent.ProjectileType(); if (shotCounter < 3) @@ -133,7 +134,7 @@ namespace CalamityMod.Items.Fishing.BrimstoneCragCatches } Projectile.NewProjectile(source, position, velocity, shotType, damage, knockback, player.whoAmI, 0f, Main.rand.Next(2)); } - + return false; } } diff --git a/Items/Fishing/BrimstoneCragCatches/Havocfish.cs b/Items/Fishing/BrimstoneCragCatches/Havocfish.cs index f72718ba3b..59f5b99abf 100644 --- a/Items/Fishing/BrimstoneCragCatches/Havocfish.cs +++ b/Items/Fishing/BrimstoneCragCatches/Havocfish.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Fishing.BrimstoneCragCatches public new string LocalizationCategory => "Items.Fishing"; public override void SetStaticDefaults() { - Item.ResearchUnlockCount = 10; + Item.ResearchUnlockCount = 10; ItemID.Sets.CanBePlacedOnWeaponRacks[Item.type] = true; } @@ -25,10 +25,10 @@ namespace CalamityMod.Items.Fishing.BrimstoneCragCatches Item.rare = ItemRarityID.Green; } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.GoodieBags; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.GoodieBags; + } public override bool CanRightClick() => true; public override void ModifyItemLoot(ItemLoot itemLoot) => itemLoot.Add(ModContent.ItemType(), 1, 5, 10); diff --git a/Items/Fishing/BrimstoneCragCatches/Shadowfish.cs b/Items/Fishing/BrimstoneCragCatches/Shadowfish.cs index 8c89ca9990..29fc9f4a47 100644 --- a/Items/Fishing/BrimstoneCragCatches/Shadowfish.cs +++ b/Items/Fishing/BrimstoneCragCatches/Shadowfish.cs @@ -1,6 +1,6 @@ using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Fishing.BrimstoneCragCatches { @@ -22,9 +22,9 @@ namespace CalamityMod.Items.Fishing.BrimstoneCragCatches Item.rare = ItemRarityID.Blue; } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.Fish; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.Fish; + } } } diff --git a/Items/Fishing/BrimstoneCragCatches/SlagCrate.cs b/Items/Fishing/BrimstoneCragCatches/SlagCrate.cs new file mode 100644 index 0000000000..55ff0e63e7 --- /dev/null +++ b/Items/Fishing/BrimstoneCragCatches/SlagCrate.cs @@ -0,0 +1,64 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Tiles.Crags; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Fishing.BrimstoneCragCatches +{ + public class SlagCrate : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Fishing"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 5; + ItemID.Sets.IsFishingCrate[Type] = true; + } + + public override void SetDefaults() + { + Item.width = 32; + Item.height = 32; + Item.maxStack = 9999; + Item.consumable = true; + Item.rare = ItemRarityID.Green; + Item.value = Item.sellPrice(gold: 1); + Item.createTile = ModContent.TileType(); + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + } + + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.Crates; + } + + public override bool CanRightClick() => true; + public override void ModifyItemLoot(ItemLoot itemLoot) + { + // Materials + itemLoot.Add(ItemID.Obsidian, 1, 2, 5); + itemLoot.Add(ItemID.Hellstone, 4, 2, 5); + itemLoot.Add(ItemID.HellstoneBar, 10, 1, 3); + itemLoot.Add(ModContent.ItemType(), 1, 1, 4); + + // Weapons (none) + + // Bait + itemLoot.Add(ItemID.MasterBait, 10, 1, 2); + itemLoot.Add(ItemID.JourneymanBait, 5, 1, 3); + itemLoot.Add(ItemID.ApprenticeBait, 3, 2, 3); + + // Potions + itemLoot.Add(ItemID.InfernoPotion, 10, 1, 3); + itemLoot.AddCratePotionRules(false); + + // Money + itemLoot.Add(ItemID.SilverCoin, 1, 10, 90); + itemLoot.Add(ItemID.GoldCoin, 2, 1, 5); + } + } +} diff --git a/Items/Fishing/BrimstoneCragCatches/SlagCrate.png b/Items/Fishing/BrimstoneCragCatches/SlagCrate.png new file mode 100644 index 0000000000..b69cdfa6ba Binary files /dev/null and b/Items/Fishing/BrimstoneCragCatches/SlagCrate.png differ diff --git a/Items/Fishing/EnchantedStarfish.cs b/Items/Fishing/EnchantedStarfish.cs index e1d2d14c97..2109fcecc4 100644 --- a/Items/Fishing/EnchantedStarfish.cs +++ b/Items/Fishing/EnchantedStarfish.cs @@ -1,7 +1,7 @@ using Terraria; +using Terraria.GameContent.Achievements; using Terraria.ID; using Terraria.ModLoader; -using Terraria.GameContent.Achievements; namespace CalamityMod.Items.Fishing { @@ -13,14 +13,14 @@ namespace CalamityMod.Items.Fishing Item.ResearchUnlockCount = 10; ItemID.Sets.CanBePlacedOnWeaponRacks[Item.type] = true; // For some reason Life/Mana boosting items are in this set (along with Magic Mirror+) - ItemID.Sets.SortingPriorityBossSpawns[Type] = 19; // Mana Crystal + ItemID.Sets.SortingPriorityBossSpawns[Type] = 19; // Mana Crystal } public override void SetDefaults() { - Item.rare = ItemRarityID.Green; Item.width = 30; Item.height = 26; + Item.rare = ItemRarityID.Green; Item.useAnimation = 30; Item.useTime = 30; Item.useStyle = ItemUseStyleID.HoldUp; diff --git a/Items/Fishing/FishingRods/EarlyBloomRod.cs b/Items/Fishing/FishingRods/EarlyBloomRod.cs index 4df6dcc264..2c536a12f5 100644 --- a/Items/Fishing/FishingRods/EarlyBloomRod.cs +++ b/Items/Fishing/FishingRods/EarlyBloomRod.cs @@ -23,21 +23,25 @@ namespace CalamityMod.Items.Fishing.FishingRods Item.fishingPole = 60; Item.shootSpeed = 18f; Item.shoot = ModContent.ProjectileType(); - Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - for (int index = 0; index < 6; ++index) + for (int i = 0; i < 6; i++) { - float SpeedX = velocity.X + Main.rand.NextFloat(-3.75f, 3.75f); - float SpeedY = velocity.Y + Main.rand.NextFloat(-3.75f, 3.75f); - Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, 0, 0f, player.whoAmI); + Projectile.NewProjectile(source, position, velocity.RotatedByRandom(MathHelper.ToRadians(18f)), type, 0, 0f, player.whoAmI); } return false; } + public override void ModifyFishingLine(Projectile bobber, ref Vector2 lineOriginOffset, ref Color lineColor) + { + lineOriginOffset = new Vector2(50f, -33f); + lineColor = new Color(190, 140, 69, 100); + } + public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Fishing/FishingRods/FeralDoubleRod.cs b/Items/Fishing/FishingRods/FeralDoubleRod.cs index 3e6a8f9ce9..cf8ad0dc8e 100644 --- a/Items/Fishing/FishingRods/FeralDoubleRod.cs +++ b/Items/Fishing/FishingRods/FeralDoubleRod.cs @@ -1,10 +1,10 @@ -using CalamityMod.Projectiles.Typeless; +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Items.Materials; -using Terraria.DataStructures; namespace CalamityMod.Items.Fishing.FishingRods { @@ -22,21 +22,25 @@ namespace CalamityMod.Items.Fishing.FishingRods Item.fishingPole = 40; Item.shootSpeed = 16f; Item.shoot = ModContent.ProjectileType(); - Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - for (int index = 0; index < 2; ++index) + for (int i = 0; i < 2; i++) { - float SpeedX = velocity.X + Main.rand.NextFloat(-3.75f, 3.75f); - float SpeedY = velocity.Y + Main.rand.NextFloat(-3.75f, 3.75f); - Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, 0, 0f, player.whoAmI); + Projectile.NewProjectile(source, position, velocity.RotatedByRandom(MathHelper.ToRadians(18f)), type, 0, 0f, player.whoAmI); } return false; } + public override void ModifyFishingLine(Projectile bobber, ref Vector2 lineOriginOffset, ref Color lineColor) + { + lineOriginOffset = new Vector2(43f, -29f); + lineColor = new Color(220, 20, 60, 100); + } + public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Fishing/FishingRods/HeronRod.cs b/Items/Fishing/FishingRods/HeronRod.cs index 256d87f721..be764e8289 100644 --- a/Items/Fishing/FishingRods/HeronRod.cs +++ b/Items/Fishing/FishingRods/HeronRod.cs @@ -1,8 +1,9 @@ -using CalamityMod.Projectiles.Typeless; +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Items.Materials; namespace CalamityMod.Items.Fishing.FishingRods { @@ -20,10 +21,16 @@ namespace CalamityMod.Items.Fishing.FishingRods Item.fishingPole = 25; Item.shootSpeed = 14.5f; Item.shoot = ModContent.ProjectileType(); - Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; } + public override void ModifyFishingLine(Projectile bobber, ref Vector2 lineOriginOffset, ref Color lineColor) + { + lineOriginOffset = new Vector2(47f, -33f); + lineColor = new Color(101, 149, 154, 100); + } + public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Fishing/FishingRods/NavyFishingRod.cs b/Items/Fishing/FishingRods/NavyFishingRod.cs index ab48420982..6b6eb6d7f4 100644 --- a/Items/Fishing/FishingRods/NavyFishingRod.cs +++ b/Items/Fishing/FishingRods/NavyFishingRod.cs @@ -1,6 +1,7 @@ -using CalamityMod.Items.Placeables; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables; using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -21,10 +22,16 @@ namespace CalamityMod.Items.Fishing.FishingRods Item.fishingPole = 20; Item.shootSpeed = 13f; Item.shoot = ModContent.ProjectileType(); - Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; } + public override void ModifyFishingLine(Projectile bobber, ref Vector2 lineOriginOffset, ref Color lineColor) + { + lineOriginOffset = new Vector2(56f, -37f); + lineColor = new Color(36, 61, 111, 100); + } + public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Fishing/FishingRods/RiftReeler.cs b/Items/Fishing/FishingRods/RiftReeler.cs index 0e9f6dc1fa..6bbe1e7441 100644 --- a/Items/Fishing/FishingRods/RiftReeler.cs +++ b/Items/Fishing/FishingRods/RiftReeler.cs @@ -1,10 +1,10 @@ -using CalamityMod.Projectiles.Typeless; +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Items.Materials; -using Terraria.DataStructures; namespace CalamityMod.Items.Fishing.FishingRods { @@ -15,8 +15,7 @@ namespace CalamityMod.Items.Fishing.FishingRods public override void SetStaticDefaults() { ItemID.Sets.CanFishInLava[Item.type] = true; - - } + } public override void SetDefaults() { @@ -29,21 +28,28 @@ namespace CalamityMod.Items.Fishing.FishingRods Item.fishingPole = 45; Item.shootSpeed = 17f; Item.shoot = ModContent.ProjectileType(); - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; } - + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - for (int index = 0; index < Main.rand.Next(3,6); ++index) //3 to 5 bobbers + for (int i = 0; i < Main.rand.Next(3, 6); i++) //3 to 5 bobbers { - float SpeedX = velocity.X + Main.rand.NextFloat(-3.75f, 3.75f); - float SpeedY = velocity.Y + Main.rand.NextFloat(-3.75f, 3.75f); - Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, 0, 0f, player.whoAmI); + Projectile.NewProjectile(source, position, velocity.RotatedByRandom(MathHelper.ToRadians(18f)), type, 0, 0f, player.whoAmI, ai2: Main.rand.Next(2)); } return false; } + public override void ModifyFishingLine(Projectile bobber, ref Vector2 lineOriginOffset, ref Color lineColor) + { + lineOriginOffset = new Vector2(67f, -33f); + if (bobber.ai[2] == 0f) + lineColor = new Color(255, 165, 0, 100); + else + lineColor = new Color(0, 206, 209, 100); + } + public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Fishing/FishingRods/SlurperPole.cs b/Items/Fishing/FishingRods/SlurperPole.cs index 58f97aeb39..b8462e6e00 100644 --- a/Items/Fishing/FishingRods/SlurperPole.cs +++ b/Items/Fishing/FishingRods/SlurperPole.cs @@ -1,4 +1,5 @@ using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -11,8 +12,7 @@ namespace CalamityMod.Items.Fishing.FishingRods public override void SetStaticDefaults() { ItemID.Sets.CanFishInLava[Item.type] = true; - - } + } public override void SetDefaults() { @@ -25,8 +25,14 @@ namespace CalamityMod.Items.Fishing.FishingRods Item.fishingPole = 25; Item.shootSpeed = 14f; Item.shoot = ModContent.ProjectileType(); - Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; } + + public override void ModifyFishingLine(Projectile bobber, ref Vector2 lineOriginOffset, ref Color lineColor) + { + lineOriginOffset = new Vector2(45f, -43f); + lineColor = new Color(227, 79, 79, 100); + } } } diff --git a/Items/Fishing/FishingRods/TheDevourerofCods.cs b/Items/Fishing/FishingRods/TheDevourerofCods.cs index e2fa73fdd5..6a4f028556 100644 --- a/Items/Fishing/FishingRods/TheDevourerofCods.cs +++ b/Items/Fishing/FishingRods/TheDevourerofCods.cs @@ -4,11 +4,10 @@ using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using Terraria.DataStructures; - namespace CalamityMod.Items.Fishing.FishingRods { public class TheDevourerofCods : ModItem, ILocalizedModType @@ -17,8 +16,7 @@ namespace CalamityMod.Items.Fishing.FishingRods public override void SetStaticDefaults() { ItemID.Sets.CanFishInLava[Item.type] = true; - - } + } public override void SetDefaults() { @@ -31,21 +29,28 @@ namespace CalamityMod.Items.Fishing.FishingRods Item.fishingPole = 75; Item.shootSpeed = 20f; Item.shoot = ModContent.ProjectileType(); - Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.rare = ModContent.RarityType(); } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - for (int index = 0; index < 10; ++index) + for (int i = 0; i < 10; i++) { - float SpeedX = velocity.X + Main.rand.NextFloat(-3.75f, 3.75f); - float SpeedY = velocity.Y + Main.rand.NextFloat(-3.75f, 3.75f); - Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, 0, 0f, player.whoAmI); + Projectile.NewProjectile(source, position, velocity.RotatedByRandom(MathHelper.ToRadians(18f)), type, 0, 0f, player.whoAmI, ai2: Main.rand.Next(2)); } return false; } + public override void ModifyFishingLine(Projectile bobber, ref Vector2 lineOriginOffset, ref Color lineColor) + { + lineOriginOffset = new Vector2(53f, -33f); + if (bobber.ai[2] == 0f) + lineColor = new Color(252, 109, 202, 100); + else + lineColor = new Color(39, 151, 171, 100); + } + public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Fishing/FishingRods/VerstaltiteFishingRod.cs b/Items/Fishing/FishingRods/VerstaltiteFishingRod.cs index 6121a9dae3..e89239b189 100644 --- a/Items/Fishing/FishingRods/VerstaltiteFishingRod.cs +++ b/Items/Fishing/FishingRods/VerstaltiteFishingRod.cs @@ -1,8 +1,9 @@ -using CalamityMod.Projectiles.Typeless; +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Items.Materials; namespace CalamityMod.Items.Fishing.FishingRods { @@ -20,10 +21,15 @@ namespace CalamityMod.Items.Fishing.FishingRods Item.fishingPole = 35; Item.shootSpeed = 15f; Item.shoot = ModContent.ProjectileType(); - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; } + public override void ModifyFishingLine(Projectile bobber, ref Vector2 lineOriginOffset, ref Color lineColor) + { + lineOriginOffset = new Vector2(43f, -36f); + lineColor = new Color(95, 158, 160, 100); + } public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Fishing/FishingRods/WulfrumRod.cs b/Items/Fishing/FishingRods/WulfrumRod.cs index cc1c43198b..d7309b4449 100644 --- a/Items/Fishing/FishingRods/WulfrumRod.cs +++ b/Items/Fishing/FishingRods/WulfrumRod.cs @@ -1,8 +1,9 @@ -using CalamityMod.Projectiles.Typeless; +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Items.Materials; namespace CalamityMod.Items.Fishing.FishingRods { @@ -21,7 +22,13 @@ namespace CalamityMod.Items.Fishing.FishingRods Item.fishingPole = 10; Item.shootSpeed = 10f; Item.shoot = ModContent.ProjectileType(); - Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.value = CalamityGlobalItem.RarityBlueBuyPrice; + } + + public override void ModifyFishingLine(Projectile bobber, ref Vector2 lineOriginOffset, ref Color lineColor) + { + lineOriginOffset = new Vector2(35f, -27f); + lineColor = new Color(200, 200, 200, 100); } public override void AddRecipes() diff --git a/Items/Fishing/FishofEleum.cs b/Items/Fishing/FishofEleum.cs index de9c0800fc..47d60bf462 100644 --- a/Items/Fishing/FishofEleum.cs +++ b/Items/Fishing/FishofEleum.cs @@ -24,10 +24,10 @@ namespace CalamityMod.Items.Fishing Item.rare = ItemRarityID.Green; } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.GoodieBags; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.GoodieBags; + } public override bool CanRightClick() => true; public override void ModifyItemLoot(ItemLoot itemLoot) => itemLoot.Add(ModContent.ItemType(), 1, 5, 10); diff --git a/Items/Fishing/FishofFlight.cs b/Items/Fishing/FishofFlight.cs index 307a6a0942..747c8543bb 100644 --- a/Items/Fishing/FishofFlight.cs +++ b/Items/Fishing/FishofFlight.cs @@ -15,18 +15,18 @@ namespace CalamityMod.Items.Fishing public override void SetDefaults() { - Item.maxStack = 9999; - Item.consumable = true; Item.width = 30; Item.height = 30; + Item.maxStack = 9999; + Item.consumable = true; Item.rare = ItemRarityID.Orange; Item.value = Item.sellPrice(gold: 1); } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.GoodieBags; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.GoodieBags; + } public override bool CanRightClick() => true; public override void ModifyItemLoot(ItemLoot itemLoot) => itemLoot.Add(ItemID.SoulofFlight, 1, 5, 8); diff --git a/Items/Fishing/FishofLight.cs b/Items/Fishing/FishofLight.cs index 4885eef818..1d9f09c1fd 100644 --- a/Items/Fishing/FishofLight.cs +++ b/Items/Fishing/FishofLight.cs @@ -15,18 +15,18 @@ namespace CalamityMod.Items.Fishing public override void SetDefaults() { - Item.maxStack = 9999; - Item.consumable = true; Item.width = 34; Item.height = 34; + Item.maxStack = 9999; + Item.consumable = true; Item.rare = ItemRarityID.Orange; Item.value = Item.sellPrice(gold: 1); } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.GoodieBags; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.GoodieBags; + } public override bool CanRightClick() => true; public override void ModifyItemLoot(ItemLoot itemLoot) => itemLoot.Add(ItemID.SoulofLight, 1, 2, 5); diff --git a/Items/Fishing/FishofNight.cs b/Items/Fishing/FishofNight.cs index b1802f12fc..de282cc972 100644 --- a/Items/Fishing/FishofNight.cs +++ b/Items/Fishing/FishofNight.cs @@ -15,18 +15,18 @@ namespace CalamityMod.Items.Fishing public override void SetDefaults() { - Item.maxStack = 9999; - Item.consumable = true; Item.width = 34; Item.height = 34; + Item.maxStack = 9999; + Item.consumable = true; Item.rare = ItemRarityID.Orange; Item.value = Item.sellPrice(gold: 1); } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.GoodieBags; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.GoodieBags; + } public override bool CanRightClick() => true; public override void ModifyItemLoot(ItemLoot itemLoot) => itemLoot.Add(ItemID.SoulofNight, 1, 2, 5); diff --git a/Items/Fishing/GlimmeringGemfish.cs b/Items/Fishing/GlimmeringGemfish.cs index 1bc74322ed..fd508e54bf 100644 --- a/Items/Fishing/GlimmeringGemfish.cs +++ b/Items/Fishing/GlimmeringGemfish.cs @@ -15,10 +15,10 @@ namespace CalamityMod.Items.Fishing public override void SetDefaults() { - Item.maxStack = 9999; - Item.consumable = true; Item.width = 34; Item.height = 30; + Item.maxStack = 9999; + Item.consumable = true; Item.rare = ItemRarityID.Green; Item.value = Item.sellPrice(silver: 50); } diff --git a/Items/Fishing/Gorecodile.cs b/Items/Fishing/Gorecodile.cs index f756447618..dec49381cc 100644 --- a/Items/Fishing/Gorecodile.cs +++ b/Items/Fishing/Gorecodile.cs @@ -25,10 +25,10 @@ namespace CalamityMod.Items.Fishing Item.rare = ItemRarityID.Green; } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.GoodieBags; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.GoodieBags; + } public override bool CanRightClick() => true; public override void ModifyItemLoot(ItemLoot itemLoot) => itemLoot.Add(ModContent.ItemType(), 1, 5, 15); diff --git a/Items/Fishing/GrandMarquisBait.cs b/Items/Fishing/GrandMarquisBait.cs index 60cabebca2..be370af1e8 100644 --- a/Items/Fishing/GrandMarquisBait.cs +++ b/Items/Fishing/GrandMarquisBait.cs @@ -26,9 +26,9 @@ namespace CalamityMod.Items.Fishing Item.consumable = true; } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.FishingBait; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.FishingBait; + } } } diff --git a/Items/Fishing/Spadefish.cs b/Items/Fishing/Spadefish.cs index 76cd9622c0..481b516ad1 100644 --- a/Items/Fishing/Spadefish.cs +++ b/Items/Fishing/Spadefish.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Items.Fishing public new string LocalizationCategory => "Items.Fishing"; public override void SetDefaults() { + Item.width = 46; + Item.height = 44; Item.damage = 15; Item.knockBack = 2f; Item.useTime = 7; @@ -16,11 +18,9 @@ namespace CalamityMod.Items.Fishing Item.pick = 34; Item.DamageType = DamageClass.Melee; - Item.width = 46; - Item.height = 44; Item.useTurn = true; Item.useStyle = ItemUseStyleID.Swing; - Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; Item.UseSound = SoundID.Item1; Item.autoReuse = true; diff --git a/Items/Fishing/StuffedFish.cs b/Items/Fishing/StuffedFish.cs index 5cf244045b..bcfa647ef7 100644 --- a/Items/Fishing/StuffedFish.cs +++ b/Items/Fishing/StuffedFish.cs @@ -15,10 +15,10 @@ namespace CalamityMod.Items.Fishing public override void SetDefaults() { - Item.maxStack = 9999; - Item.consumable = true; Item.width = 34; Item.height = 30; + Item.maxStack = 9999; + Item.consumable = true; Item.rare = ItemRarityID.Green; Item.value = Item.sellPrice(silver: 50); } @@ -61,9 +61,9 @@ namespace CalamityMod.Items.Fishing itemLoot.Add(ItemID.PumpkinSeed, 20, seedMin, seedMax); // Biome grass seeds - itemLoot.AddIf(() => !WorldGen.crimson , ItemID.CorruptSeeds, 20, seedMin, seedMax); - itemLoot.AddIf(() => WorldGen.crimson , ItemID.CrimsonSeeds, 20, seedMin, seedMax); - itemLoot.AddIf(() => Main.hardMode , ItemID.HallowedSeeds, 20, seedMin, seedMax); + itemLoot.AddIf(() => !WorldGen.crimson, ItemID.CorruptSeeds, 20, seedMin, seedMax); + itemLoot.AddIf(() => WorldGen.crimson, ItemID.CrimsonSeeds, 20, seedMin, seedMax); + itemLoot.AddIf(() => Main.hardMode, ItemID.HallowedSeeds, 20, seedMin, seedMax); // Add Thorium Marine Kelp if Thorium is loaded. Mod thorium = CalamityMod.Instance.thorium; diff --git a/Items/Fishing/SulphurCatches/HydrothermalCrate.cs b/Items/Fishing/SulphurCatches/HydrothermalCrate.cs new file mode 100644 index 0000000000..52dad8a28b --- /dev/null +++ b/Items/Fishing/SulphurCatches/HydrothermalCrate.cs @@ -0,0 +1,122 @@ +using CalamityMod.Items.Accessories; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Pets; +using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Ores; +using CalamityMod.Items.Potions; +using CalamityMod.Items.Tools.ClimateChange; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Items.Weapons.Summon; +using CalamityMod.Tiles.Abyss; +using Terraria; +using Terraria.GameContent.ItemDropRules; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Fishing.SulphurCatches +{ + public class HydrothermalCrate : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Fishing"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 5; + ItemID.Sets.IsFishingCrate[Type] = true; + ItemID.Sets.IsFishingCrateHardmode[Type] = true; + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } + + public override void SetDefaults() + { + Item.width = 32; + Item.height = 32; + Item.maxStack = 9999; + Item.consumable = true; + Item.rare = ItemRarityID.Green; + Item.value = Item.sellPrice(gold: 1); + Item.createTile = ModContent.TileType(); + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + } + + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.Crates; + } + + public override bool CanRightClick() => true; + public override void ModifyItemLoot(ItemLoot itemLoot) + { + // The contents of this crate depend massively on progression, so it uses a large number of LeadingConditionRules. + var tier1AbyssAvailable = itemLoot.DefineConditionalDropSet(() => DownedBossSystem.downedSlimeGod || Main.hardMode); + var tier2AbyssAvailable = itemLoot.DefineConditionalDropSet(() => DownedBossSystem.downedLeviathan); + var scoriaAvailable = itemLoot.DefineConditionalDropSet(() => NPC.downedGolemBoss); + var tier1AcidRain = itemLoot.DefineConditionalDropSet(() => DownedBossSystem.downedEoCAcidRain); + var tier2AcidRain = itemLoot.DefineConditionalDropSet(() => DownedBossSystem.downedAquaticScourgeAcidRain); + var tier3AcidRain = itemLoot.DefineConditionalDropSet(() => DownedBossSystem.downedPolterghast && DownedBossSystem.downedBoomerDuke); + + // Materials + itemLoot.Add(ModContent.ItemType(), 1, 5, 10); + itemLoot.Add(ModContent.ItemType(), 1, 5, 10); + itemLoot.Add(ModContent.ItemType(), 1, 5, 10); + itemLoot.Add(ModContent.ItemType(), 1, 5, 10); + + tier1AcidRain.Add(ModContent.ItemType(), 10, 1, 3); + tier2AcidRain.Add(ModContent.ItemType(), 10, 1, 3); + tier2AbyssAvailable.Add(ModContent.ItemType(), 5, 2, 5); + tier2AbyssAvailable.Add(ModContent.ItemType(), 5, 2, 5); + tier2AbyssAvailable.Add(ModContent.ItemType(), 5, 2, 5); + scoriaAvailable.Add(ModContent.ItemType(), 5, 16, 28); + scoriaAvailable.Add(ModContent.ItemType(), new Fraction(15, 100), 4, 7); + tier3AcidRain.Add(ModContent.ItemType(), 10, 1, 5); + + // Pre-HM Abyss Weapons + tier1AbyssAvailable.Add(new OneFromOptionsDropRule(10, 1, + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType() + )); + + // Post-AS Acid Rain Weapons (and Nuclear Rod) + tier2AcidRain.Add(new OneFromOptionsDropRule(10, 1, + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType() + )); + + // Pre-HM Abyss Equipment (and Torrential Tear) + tier1AbyssAvailable.Add(new OneFromOptionsDropRule(4, 1, + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType() + )); + + // Bait + itemLoot.Add(ItemID.MasterBait, 10, 1, 2); + itemLoot.Add(ItemID.JourneymanBait, 5, 1, 3); + itemLoot.Add(ItemID.ApprenticeBait, 3, 2, 3); + + // Potions + itemLoot.Add(ModContent.ItemType(), 10, 1, 3); + itemLoot.AddCratePotionRules(); + + // Money + itemLoot.Add(ItemID.SilverCoin, 1, 10, 90); + itemLoot.Add(ItemID.GoldCoin, 2, 1, 5); + } + } +} diff --git a/Items/Fishing/SulphurCatches/HydrothermalCrate.png b/Items/Fishing/SulphurCatches/HydrothermalCrate.png new file mode 100644 index 0000000000..9597cd29af Binary files /dev/null and b/Items/Fishing/SulphurCatches/HydrothermalCrate.png differ diff --git a/Items/Fishing/SulphurCatches/SulphurousCrate.cs b/Items/Fishing/SulphurCatches/SulphurousCrate.cs index 706968c7cb..98d8b825e3 100644 --- a/Items/Fishing/SulphurCatches/SulphurousCrate.cs +++ b/Items/Fishing/SulphurCatches/SulphurousCrate.cs @@ -1,5 +1,5 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Items.Accessories; +using CalamityMod.Items.Accessories; +using CalamityMod.Items.Materials; using CalamityMod.Items.Pets; using CalamityMod.Items.Placeables; using CalamityMod.Items.Potions; @@ -9,12 +9,10 @@ using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Items.Weapons.Summon; -using CalamityMod.Items.Placeables.Ores; using Terraria; +using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; -using Terraria.GameContent.ItemDropRules; - using CrateTile = CalamityMod.Tiles.Abyss.SulphurousCrateTile; namespace CalamityMod.Items.Fishing.SulphurCatches @@ -31,10 +29,10 @@ namespace CalamityMod.Items.Fishing.SulphurCatches public override void SetDefaults() { - Item.maxStack = 9999; - Item.consumable = true; Item.width = 32; Item.height = 32; + Item.maxStack = 9999; + Item.consumable = true; Item.rare = ItemRarityID.Green; Item.value = Item.sellPrice(gold: 1); Item.createTile = ModContent.TileType(); @@ -45,21 +43,16 @@ namespace CalamityMod.Items.Fishing.SulphurCatches Item.useStyle = ItemUseStyleID.Swing; } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.Crates; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.Crates; + } public override bool CanRightClick() => true; public override void ModifyItemLoot(ItemLoot itemLoot) { - // The contents of this crate depend massively on progression, so it uses a large number of LeadingConditionRules. var tier1AbyssAvailable = itemLoot.DefineConditionalDropSet(() => DownedBossSystem.downedSlimeGod || Main.hardMode); - var tier2AbyssAvailable = itemLoot.DefineConditionalDropSet(() => DownedBossSystem.downedCalamitasClone); - var scoriaAvailable = itemLoot.DefineConditionalDropSet(() => NPC.downedGolemBoss); var tier1AcidRain = itemLoot.DefineConditionalDropSet(() => DownedBossSystem.downedEoCAcidRain); - var tier2AcidRain = itemLoot.DefineConditionalDropSet(() => DownedBossSystem.downedAquaticScourgeAcidRain); - var tier3AcidRain = itemLoot.DefineConditionalDropSet(() => DownedBossSystem.downedPolterghast && DownedBossSystem.downedBoomerDuke); // Materials itemLoot.Add(ModContent.ItemType(), 1, 5, 10); @@ -68,13 +61,6 @@ namespace CalamityMod.Items.Fishing.SulphurCatches itemLoot.Add(ModContent.ItemType(), 1, 5, 10); tier1AcidRain.Add(ModContent.ItemType(), 10, 1, 3); - tier2AcidRain.Add(ModContent.ItemType(), 10, 1, 3); - tier2AbyssAvailable.Add(ModContent.ItemType(), 5, 2, 5); - tier2AbyssAvailable.Add(ModContent.ItemType(), 5, 2, 5); - tier2AbyssAvailable.Add(ModContent.ItemType(), 5, 2, 5); - scoriaAvailable.Add(ModContent.ItemType(), 5, 16, 28); - scoriaAvailable.Add(ModContent.ItemType(), new Fraction(15, 100), 4, 7); - tier3AcidRain.Add(ModContent.ItemType(), 10, 1, 5); // Pre-HM Abyss Weapons tier1AbyssAvailable.Add(new OneFromOptionsDropRule(10, 1, @@ -85,17 +71,6 @@ namespace CalamityMod.Items.Fishing.SulphurCatches ModContent.ItemType() )); - // Post-AS Acid Rain Weapons (and Nuclear Rod) - tier2AcidRain.Add(new OneFromOptionsDropRule(10, 1, - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType() - )); - // Pre-HM Abyss Equipment (and Torrential Tear) tier1AbyssAvailable.Add(new OneFromOptionsDropRule(4, 1, ModContent.ItemType(), @@ -112,7 +87,7 @@ namespace CalamityMod.Items.Fishing.SulphurCatches // Potions itemLoot.Add(ModContent.ItemType(), 10, 1, 3); - itemLoot.AddCratePotionRules(); + itemLoot.AddCratePotionRules(false); // Money itemLoot.Add(ItemID.SilverCoin, 1, 10, 90); diff --git a/Items/Fishing/SunbeamFish.cs b/Items/Fishing/SunbeamFish.cs index 777b2e5df9..dff792e6eb 100644 --- a/Items/Fishing/SunbeamFish.cs +++ b/Items/Fishing/SunbeamFish.cs @@ -24,10 +24,10 @@ namespace CalamityMod.Items.Fishing Item.rare = ItemRarityID.Green; } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.GoodieBags; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.GoodieBags; + } public override bool CanRightClick() => true; public override void ModifyItemLoot(ItemLoot itemLoot) => itemLoot.Add(ModContent.ItemType(), 1, 5, 10); diff --git a/Items/Fishing/SunkenSeaCatches/EutrophicCrate.cs b/Items/Fishing/SunkenSeaCatches/EutrophicCrate.cs new file mode 100644 index 0000000000..c2c7f48aec --- /dev/null +++ b/Items/Fishing/SunkenSeaCatches/EutrophicCrate.cs @@ -0,0 +1,71 @@ +using CalamityMod.Items.Critters; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Items.Weapons.Summon; +using Terraria; +using Terraria.GameContent.ItemDropRules; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Fishing.SunkenSeaCatches +{ + [LegacyName("SunkenCrate")] + public class EutrophicCrate : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Fishing"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 5; + ItemID.Sets.IsFishingCrate[Type] = true; + } + + public override void SetDefaults() + { + Item.width = 32; + Item.height = 32; + Item.maxStack = 9999; + Item.consumable = true; + Item.rare = ItemRarityID.Green; + Item.value = Item.sellPrice(gold: 1); + Item.createTile = ModContent.TileType(); + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + } + + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.Crates; + } + + public override bool CanRightClick() => true; + public override void ModifyItemLoot(ItemLoot itemLoot) + { + var postDesertScourge = itemLoot.DefineConditionalDropSet(() => DownedBossSystem.downedDesertScourge); + + // Materials + itemLoot.Add(ModContent.ItemType(), 1, 10, 30); + itemLoot.Add(ModContent.ItemType(), 1, 10, 30); + postDesertScourge.Add(ModContent.ItemType(), 1, 5, 10); + postDesertScourge.Add(ModContent.ItemType(), 5, 2, 5); + + // Bait + itemLoot.Add(ItemID.MasterBait, 10, 1, 2); + itemLoot.Add(ItemID.JourneymanBait, 5, 1, 3); + itemLoot.Add(ModContent.ItemType(), 5, 1, 3); + itemLoot.Add(ItemID.ApprenticeBait, 3, 2, 3); + + // Potions + itemLoot.AddCratePotionRules(false); + + // Money + itemLoot.Add(ItemID.SilverCoin, 1, 10, 90); + itemLoot.Add(ItemID.GoldCoin, 2, 1, 5); + } + } +} diff --git a/Items/Fishing/SunkenSeaCatches/EutrophicCrate.png b/Items/Fishing/SunkenSeaCatches/EutrophicCrate.png new file mode 100644 index 0000000000..cdf1b87ab6 Binary files /dev/null and b/Items/Fishing/SunkenSeaCatches/EutrophicCrate.png differ diff --git a/Items/Fishing/SunkenSeaCatches/GreenwaveLoach.cs b/Items/Fishing/SunkenSeaCatches/GreenwaveLoach.cs index 03ef2e661f..e245ff9a2d 100644 --- a/Items/Fishing/SunkenSeaCatches/GreenwaveLoach.cs +++ b/Items/Fishing/SunkenSeaCatches/GreenwaveLoach.cs @@ -1,6 +1,6 @@ using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Fishing.SunkenSeaCatches { @@ -22,9 +22,9 @@ namespace CalamityMod.Items.Fishing.SunkenSeaCatches Item.rare = ItemRarityID.Orange; } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.Fish; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.Fish; + } } } diff --git a/Items/Fishing/SunkenSeaCatches/SunkenCrate.cs b/Items/Fishing/SunkenSeaCatches/PrismCrate.cs similarity index 85% rename from Items/Fishing/SunkenSeaCatches/SunkenCrate.cs rename to Items/Fishing/SunkenSeaCatches/PrismCrate.cs index b48bebaf5e..ecf064395c 100644 --- a/Items/Fishing/SunkenSeaCatches/SunkenCrate.cs +++ b/Items/Fishing/SunkenSeaCatches/PrismCrate.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Critters; +using CalamityMod.Items.Fishing.BrimstoneCragCatches; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; using CalamityMod.Items.Weapons.Magic; @@ -12,24 +13,26 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Fishing.SunkenSeaCatches { - public class SunkenCrate : ModItem, ILocalizedModType + public class PrismCrate : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Fishing"; public override void SetStaticDefaults() { Item.ResearchUnlockCount = 5; ItemID.Sets.IsFishingCrate[Type] = true; + ItemID.Sets.IsFishingCrateHardmode[Type] = true; + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); } public override void SetDefaults() { - Item.maxStack = 9999; - Item.consumable = true; Item.width = 32; Item.height = 32; + Item.maxStack = 9999; + Item.consumable = true; Item.rare = ItemRarityID.Green; Item.value = Item.sellPrice(gold: 1); - Item.createTile = ModContent.TileType(); + Item.createTile = ModContent.TileType(); Item.useTurn = true; Item.autoReuse = true; Item.useAnimation = 15; @@ -37,10 +40,10 @@ namespace CalamityMod.Items.Fishing.SunkenSeaCatches Item.useStyle = ItemUseStyleID.Swing; } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.Crates; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.Crates; + } public override bool CanRightClick() => true; public override void ModifyItemLoot(ItemLoot itemLoot) diff --git a/Items/Fishing/SunkenSeaCatches/PrismCrate.png b/Items/Fishing/SunkenSeaCatches/PrismCrate.png new file mode 100644 index 0000000000..cb1cfc1fbc Binary files /dev/null and b/Items/Fishing/SunkenSeaCatches/PrismCrate.png differ diff --git a/Items/Fishing/SunkenSeaCatches/PrismaticGuppy.cs b/Items/Fishing/SunkenSeaCatches/PrismaticGuppy.cs index ccb814d971..66ca1687ad 100644 --- a/Items/Fishing/SunkenSeaCatches/PrismaticGuppy.cs +++ b/Items/Fishing/SunkenSeaCatches/PrismaticGuppy.cs @@ -1,6 +1,6 @@ using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Fishing.SunkenSeaCatches { @@ -22,9 +22,9 @@ namespace CalamityMod.Items.Fishing.SunkenSeaCatches Item.rare = ItemRarityID.Green; } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.Fish; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.Fish; + } } } diff --git a/Items/Fishing/SunkenSeaCatches/SerpentsBite.cs b/Items/Fishing/SunkenSeaCatches/SerpentsBite.cs index 365e77ba2a..51ce7fc457 100644 --- a/Items/Fishing/SunkenSeaCatches/SerpentsBite.cs +++ b/Items/Fishing/SunkenSeaCatches/SerpentsBite.cs @@ -1,7 +1,7 @@ -using Terraria.ID; +using CalamityMod.Projectiles.Typeless; +using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; -using CalamityMod.Projectiles.Typeless; namespace CalamityMod.Items.Fishing.SunkenSeaCatches { @@ -12,12 +12,12 @@ namespace CalamityMod.Items.Fishing.SunkenSeaCatches { // Instead of copying these values, we can clone and modify the ones we want to copy Item.CloneDefaults(ItemID.AmethystHook); - Item.shootSpeed = SerpentsBiteHook.LaunchSpeed; // how quickly the hook is shot. - Item.shoot = ProjectileType(); - Item.value = CalamityGlobalItem.Rarity4BuyPrice; - Item.rare = ItemRarityID.LightRed; Item.width = 30; Item.height = 32; + Item.shootSpeed = SerpentsBiteHook.LaunchSpeed; // how quickly the hook is shot. + Item.shoot = ProjectileType(); + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; + Item.rare = ItemRarityID.LightRed; } } } diff --git a/Items/Fishing/SunkenSeaCatches/SparklingEmpress.cs b/Items/Fishing/SunkenSeaCatches/SparklingEmpress.cs index 573b72ba83..1688295a81 100644 --- a/Items/Fishing/SunkenSeaCatches/SparklingEmpress.cs +++ b/Items/Fishing/SunkenSeaCatches/SparklingEmpress.cs @@ -1,8 +1,8 @@ using CalamityMod.Projectiles.Magic; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using Microsoft.Xna.Framework; namespace CalamityMod.Items.Fishing.SunkenSeaCatches { @@ -13,26 +13,26 @@ namespace CalamityMod.Items.Fishing.SunkenSeaCatches public override void SetStaticDefaults() { - Item.staff[Item.type] = true; //so it doesn't look weird af when holding it + Item.staff[Item.type] = true; //so it doesn't look weird af when holding it } public override void SetDefaults() { + Item.width = 44; + Item.height = 44; Item.damage = BaseDamage; Item.noMelee = true; Item.DamageType = DamageClass.Magic; Item.channel = true; //Channel so that you can hold the weapon [Important] Item.rare = ItemRarityID.Green; Item.mana = 5; - Item.width = 44; - Item.height = 44; Item.useTime = 20; Item.useAnimation = 20; Item.UseSound = SoundID.Item13; Item.useStyle = ItemUseStyleID.Shoot; Item.shootSpeed = 14f; Item.shoot = ModContent.ProjectileType(); - Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; } //Looks scuffed with the laser when there is offset diff --git a/Items/Fishing/SunkenSeaCatches/SunkenCrate.png b/Items/Fishing/SunkenSeaCatches/SunkenCrate.png deleted file mode 100644 index 134f920a56..0000000000 Binary files a/Items/Fishing/SunkenSeaCatches/SunkenCrate.png and /dev/null differ diff --git a/Items/Fishing/SunkenSeaCatches/SunkenSailfish.cs b/Items/Fishing/SunkenSeaCatches/SunkenSailfish.cs index bee38cbeac..c77c2ee007 100644 --- a/Items/Fishing/SunkenSeaCatches/SunkenSailfish.cs +++ b/Items/Fishing/SunkenSeaCatches/SunkenSailfish.cs @@ -1,6 +1,6 @@ using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Fishing.SunkenSeaCatches { @@ -22,9 +22,9 @@ namespace CalamityMod.Items.Fishing.SunkenSeaCatches Item.rare = ItemRarityID.Green; } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.Fish; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.Fish; + } } } diff --git a/Items/LoreItems/LoreDesertScourge.png b/Items/LoreItems/LoreDesertScourge.png index f8f66e4666..6e4de8ca51 100644 Binary files a/Items/LoreItems/LoreDesertScourge.png and b/Items/LoreItems/LoreDesertScourge.png differ diff --git a/Items/Materials/AerialiteBar.cs b/Items/Materials/AerialiteBar.cs index 76f241f6d1..b434352eae 100644 --- a/Items/Materials/AerialiteBar.cs +++ b/Items/Materials/AerialiteBar.cs @@ -12,14 +12,14 @@ namespace CalamityMod.Items.Materials public override void SetStaticDefaults() { Item.ResearchUnlockCount = 25; - ItemID.Sets.SortingPriorityMaterials[Type] = 69; // Hellstone + ItemID.Sets.SortingPriorityMaterials[Type] = 69; // Hellstone } public override void SetDefaults() { - Item.createTile = ModContent.TileType(); Item.width = 30; Item.height = 24; + Item.createTile = ModContent.TileType(); Item.maxStack = 9999; Item.value = Item.sellPrice(silver: 30); Item.rare = ItemRarityID.Orange; diff --git a/Items/Materials/AerialiteBar.png b/Items/Materials/AerialiteBar.png index 1f020023f9..f4d39aa5e7 100644 Binary files a/Items/Materials/AerialiteBar.png and b/Items/Materials/AerialiteBar.png differ diff --git a/Items/Materials/AncientBoneDust.cs b/Items/Materials/AncientBoneDust.cs index bf72ee2d80..c4ece734a8 100644 --- a/Items/Materials/AncientBoneDust.cs +++ b/Items/Materials/AncientBoneDust.cs @@ -1,6 +1,6 @@ using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Materials { diff --git a/Items/Materials/ArmoredShell.cs b/Items/Materials/ArmoredShell.cs index 3831295056..c19623da99 100644 --- a/Items/Materials/ArmoredShell.cs +++ b/Items/Materials/ArmoredShell.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Materials public override void SetStaticDefaults() { Item.ResearchUnlockCount = 5; - ItemID.Sets.SortingPriorityMaterials[Type] = 107; + ItemID.Sets.SortingPriorityMaterials[Type] = 107; } public override void SetDefaults() @@ -21,5 +21,6 @@ namespace CalamityMod.Items.Materials Item.maxStack = 9999; Item.value = Item.buyPrice(0, 7, 0, 0); Item.rare = ModContent.RarityType(); - } } + } + } } diff --git a/Items/Materials/AscendantSpiritEssence.cs b/Items/Materials/AscendantSpiritEssence.cs index db0a2a70ed..1182826311 100644 --- a/Items/Materials/AscendantSpiritEssence.cs +++ b/Items/Materials/AscendantSpiritEssence.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Materials Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(6, 6)); ItemID.Sets.AnimatesAsSoul[Type] = true; ItemID.Sets.ItemNoGravity[Item.type] = true; - ItemID.Sets.SortingPriorityMaterials[Type] = 118; + ItemID.Sets.SortingPriorityMaterials[Type] = 118; } public override void SetDefaults() @@ -53,7 +53,7 @@ namespace CalamityMod.Items.Materials public override void AddRecipes() { CreateRecipe(). - AddIngredient(2). + AddIngredient(2). AddIngredient(5). AddIngredient(5). AddIngredient(2). diff --git a/Items/Materials/AshesofAnnihilation.cs b/Items/Materials/AshesofAnnihilation.cs index 7f78bed34a..2497d12064 100644 --- a/Items/Materials/AshesofAnnihilation.cs +++ b/Items/Materials/AshesofAnnihilation.cs @@ -1,7 +1,7 @@ -using CalamityMod.Rarities; +using System; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.DataStructures; using Terraria.GameContent; @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Materials Item.ResearchUnlockCount = 25; Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(7, 6)); ItemID.Sets.AnimatesAsSoul[Type] = true; - ItemID.Sets.SortingPriorityMaterials[Type] = 123; + ItemID.Sets.SortingPriorityMaterials[Type] = 123; } public override void SetDefaults() diff --git a/Items/Materials/AshesofCalamity.cs b/Items/Materials/AshesofCalamity.cs index 4edb13ab97..91816a8ea7 100644 --- a/Items/Materials/AshesofCalamity.cs +++ b/Items/Materials/AshesofCalamity.cs @@ -1,7 +1,7 @@ using Terraria; -using Terraria.ModLoader; -using Terraria.ID; using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Materials { diff --git a/Items/Materials/AstralBar.cs b/Items/Materials/AstralBar.cs index ed755cf911..d9b21326f3 100644 --- a/Items/Materials/AstralBar.cs +++ b/Items/Materials/AstralBar.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Materials public override void SetStaticDefaults() { Item.ResearchUnlockCount = 25; - ItemID.Sets.SortingPriorityMaterials[Type] = 99; // Luminite + ItemID.Sets.SortingPriorityMaterials[Type] = 99; // Luminite ItemID.Sets.AnimatesAsSoul[Type] = true; Main.RegisterItemAnimation(Type, new DrawAnimationVertical(5, 12)); } @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Materials public override void AddRecipes() { CreateRecipe(). - AddIngredient(3). + AddIngredient(3). AddIngredient(2). AddTile(TileID.LunarCraftingStation). Register(); diff --git a/Items/Materials/AuricBar.cs b/Items/Materials/AuricBar.cs index f3a124da28..689186cc7a 100644 --- a/Items/Materials/AuricBar.cs +++ b/Items/Materials/AuricBar.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Materials public override void SetStaticDefaults() { Item.ResearchUnlockCount = 25; - ItemID.Sets.SortingPriorityMaterials[Type] = 120; + ItemID.Sets.SortingPriorityMaterials[Type] = 120; ItemID.Sets.AnimatesAsSoul[Type] = true; ItemID.Sets.ItemNoGravity[Item.type] = true; Main.RegisterItemAnimation(Type, new DrawAnimationVertical(5, 12)); @@ -56,7 +56,7 @@ namespace CalamityMod.Items.Materials { CalamityUtils.DrawInventoryCustomScale( spriteBatch, - texture: TextureAssets.Item[Type].Value, + texture: TextureAssets.Item[Type].Value, position, frame, drawColor, diff --git a/Items/Materials/BlightedGel.cs b/Items/Materials/BlightedGel.cs index e3295162e7..6585cfd403 100644 --- a/Items/Materials/BlightedGel.cs +++ b/Items/Materials/BlightedGel.cs @@ -1,8 +1,8 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Materials { diff --git a/Items/Materials/BloodOrb.cs b/Items/Materials/BloodOrb.cs index 5effa0aca0..ee1993eccb 100644 --- a/Items/Materials/BloodOrb.cs +++ b/Items/Materials/BloodOrb.cs @@ -1,7 +1,7 @@ using Terraria; using Terraria.DataStructures; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Materials { diff --git a/Items/Materials/BloodSample.cs b/Items/Materials/BloodSample.cs index 943bae2bba..81ab3ccdc8 100644 --- a/Items/Materials/BloodSample.cs +++ b/Items/Materials/BloodSample.cs @@ -1,6 +1,6 @@ using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Materials { @@ -10,7 +10,7 @@ namespace CalamityMod.Items.Materials public override void SetStaticDefaults() { Item.ResearchUnlockCount = 25; - ItemID.Sets.SortingPriorityMaterials[Type] = 68; // Sturdy Fossil + ItemID.Sets.SortingPriorityMaterials[Type] = 68; // Sturdy Fossil } public override void SetDefaults() @@ -20,5 +20,6 @@ namespace CalamityMod.Items.Materials Item.maxStack = 9999; Item.value = Item.buyPrice(0, 0, 50, 0); Item.rare = ItemRarityID.Orange; - } } + } + } } diff --git a/Items/Materials/Bloodstone.cs b/Items/Materials/Bloodstone.cs index 3dc49f80e7..33ccdc5e36 100644 --- a/Items/Materials/Bloodstone.cs +++ b/Items/Materials/Bloodstone.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Materials public override void SetStaticDefaults() { Item.ResearchUnlockCount = 100; - ItemID.Sets.SortingPriorityMaterials[Type] = 112; + ItemID.Sets.SortingPriorityMaterials[Type] = 112; } public override void SetDefaults() diff --git a/Items/Materials/BloodstoneCore.cs b/Items/Materials/BloodstoneCore.cs index 1c74a7bd0d..4dd5376703 100644 --- a/Items/Materials/BloodstoneCore.cs +++ b/Items/Materials/BloodstoneCore.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Materials public override void SetStaticDefaults() { Item.ResearchUnlockCount = 25; - ItemID.Sets.SortingPriorityMaterials[Type] = 113; + ItemID.Sets.SortingPriorityMaterials[Type] = 113; } public override void SetDefaults() @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Materials CreateRecipe(2). AddIngredient(5). AddIngredient(). - AddIngredient(). + AddIngredient(). AddTile(TileID.AdamantiteForge). Register(); } diff --git a/Items/Materials/CoreofEleum.cs b/Items/Materials/CoreofEleum.cs index c52b4d764f..9c7ca3df82 100644 --- a/Items/Materials/CoreofEleum.cs +++ b/Items/Materials/CoreofEleum.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Materials Item.ResearchUnlockCount = 25; ItemID.Sets.ItemNoGravity[Item.type] = true; - ItemID.Sets.SortingPriorityMaterials[Type] = 94; // Spectre Bar + ItemID.Sets.SortingPriorityMaterials[Type] = 94; // Spectre Bar } public override void SetDefaults() diff --git a/Items/Materials/CoreofHavoc.cs b/Items/Materials/CoreofHavoc.cs index 52227c05b9..4adf30e98d 100644 --- a/Items/Materials/CoreofHavoc.cs +++ b/Items/Materials/CoreofHavoc.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Materials Item.ResearchUnlockCount = 25; ItemID.Sets.ItemNoGravity[Item.type] = true; - ItemID.Sets.SortingPriorityMaterials[Type] = 94; // Spectre Bar + ItemID.Sets.SortingPriorityMaterials[Type] = 94; // Spectre Bar } public override void SetDefaults() diff --git a/Items/Materials/CoreofSunlight.cs b/Items/Materials/CoreofSunlight.cs index e3b76a57b4..2c8330cebc 100644 --- a/Items/Materials/CoreofSunlight.cs +++ b/Items/Materials/CoreofSunlight.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Materials Item.ResearchUnlockCount = 25; ItemID.Sets.ItemNoGravity[Item.type] = true; - ItemID.Sets.SortingPriorityMaterials[Type] = 94; // Spectre Bar + ItemID.Sets.SortingPriorityMaterials[Type] = 94; // Spectre Bar } public override void SetDefaults() diff --git a/Items/Materials/CorrodedFossil.cs b/Items/Materials/CorrodedFossil.cs index bde4d6e78b..b8e33f9dd6 100644 --- a/Items/Materials/CorrodedFossil.cs +++ b/Items/Materials/CorrodedFossil.cs @@ -1,6 +1,6 @@ using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Materials { @@ -19,5 +19,6 @@ namespace CalamityMod.Items.Materials Item.maxStack = 9999; Item.value = Item.buyPrice(0, 3, 0, 0); Item.rare = ItemRarityID.Pink; - } } + } + } } diff --git a/Items/Materials/CosmiliteBar.cs b/Items/Materials/CosmiliteBar.cs index aa6c6b9327..1982eb858b 100644 --- a/Items/Materials/CosmiliteBar.cs +++ b/Items/Materials/CosmiliteBar.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Materials public override void SetStaticDefaults() { Item.ResearchUnlockCount = 25; - ItemID.Sets.SortingPriorityMaterials[Type] = 114; + ItemID.Sets.SortingPriorityMaterials[Type] = 114; ItemID.Sets.AnimatesAsSoul[Type] = true; Main.RegisterItemAnimation(Type, new DrawAnimationVertical(6, 10)); } diff --git a/Items/Materials/CryonicBar.cs b/Items/Materials/CryonicBar.cs index ff661d3e58..0a13d1fb45 100644 --- a/Items/Materials/CryonicBar.cs +++ b/Items/Materials/CryonicBar.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Materials Item.ResearchUnlockCount = 25; - ItemID.Sets.SortingPriorityMaterials[Type] = 90; // Chlorophyte Ore + ItemID.Sets.SortingPriorityMaterials[Type] = 90; // Chlorophyte Ore } public override void SetDefaults() diff --git a/Items/Materials/DarkPlasma.cs b/Items/Materials/DarkPlasma.cs index ca39e1fd37..2ee15aeb17 100644 --- a/Items/Materials/DarkPlasma.cs +++ b/Items/Materials/DarkPlasma.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Materials Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(7, 4)); ItemID.Sets.AnimatesAsSoul[Type] = true; ItemID.Sets.ItemNoGravity[Item.type] = true; - ItemID.Sets.SortingPriorityMaterials[Type] = 108; + ItemID.Sets.SortingPriorityMaterials[Type] = 108; } public override void SetDefaults() diff --git a/Items/Materials/DarksunFragment.cs b/Items/Materials/DarksunFragment.cs index cf5da790ce..5fc79ea76a 100644 --- a/Items/Materials/DarksunFragment.cs +++ b/Items/Materials/DarksunFragment.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Materials Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(6, 8)); ItemID.Sets.AnimatesAsSoul[Type] = true; ItemID.Sets.ItemNoGravity[Item.type] = true; - ItemID.Sets.SortingPriorityMaterials[Type] = 117; + ItemID.Sets.SortingPriorityMaterials[Type] = 117; } public override void SetDefaults() diff --git a/Items/Materials/DemonicBoneAsh.cs b/Items/Materials/DemonicBoneAsh.cs index ebea423757..b0fa0cfcb9 100644 --- a/Items/Materials/DemonicBoneAsh.cs +++ b/Items/Materials/DemonicBoneAsh.cs @@ -1,6 +1,6 @@ using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Materials { diff --git a/Items/Materials/DemonicBoneAsh.png b/Items/Materials/DemonicBoneAsh.png index c00a297f79..82628c60a7 100644 Binary files a/Items/Materials/DemonicBoneAsh.png and b/Items/Materials/DemonicBoneAsh.png differ diff --git a/Items/Materials/DepthCells.cs b/Items/Materials/DepthCells.cs index d3ff3e0b98..ef981b8c83 100644 --- a/Items/Materials/DepthCells.cs +++ b/Items/Materials/DepthCells.cs @@ -1,6 +1,6 @@ using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Materials { @@ -19,5 +19,6 @@ namespace CalamityMod.Items.Materials Item.maxStack = 9999; Item.value = Item.sellPrice(silver: 80); Item.rare = ItemRarityID.Lime; - } } + } + } } diff --git a/Items/Materials/DivineGeode.cs b/Items/Materials/DivineGeode.cs index 2f6acbc13d..10ef67e8ff 100644 --- a/Items/Materials/DivineGeode.cs +++ b/Items/Materials/DivineGeode.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Materials public override void SetStaticDefaults() { Item.ResearchUnlockCount = 25; - ItemID.Sets.SortingPriorityMaterials[Type] = 104; + ItemID.Sets.SortingPriorityMaterials[Type] = 104; } public override void SetDefaults() diff --git a/Items/Materials/DubiousPlating.cs b/Items/Materials/DubiousPlating.cs index 3010d7f6d3..40f9827755 100644 --- a/Items/Materials/DubiousPlating.cs +++ b/Items/Materials/DubiousPlating.cs @@ -20,5 +20,6 @@ namespace CalamityMod.Items.Materials Item.maxStack = 9999; Item.rare = ModContent.RarityType(); Item.value = Item.sellPrice(silver: 6); - } } + } + } } diff --git a/Items/Materials/EffulgentFeather.cs b/Items/Materials/EffulgentFeather.cs index 746fba0187..82228a5e76 100644 --- a/Items/Materials/EffulgentFeather.cs +++ b/Items/Materials/EffulgentFeather.cs @@ -1,6 +1,6 @@ using Terraria; -using Terraria.ID; using Terraria.DataStructures; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Materials @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Materials Item.ResearchUnlockCount = 25; Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(3, 11)); ItemID.Sets.AnimatesAsSoul[Type] = true; - ItemID.Sets.SortingPriorityMaterials[Type] = 102; + ItemID.Sets.SortingPriorityMaterials[Type] = 102; } public override void SetDefaults() diff --git a/Items/Materials/EndothermicEnergy.cs b/Items/Materials/EndothermicEnergy.cs index b2cef8749b..68f6661d81 100644 --- a/Items/Materials/EndothermicEnergy.cs +++ b/Items/Materials/EndothermicEnergy.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Materials Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(6, 6)); ItemID.Sets.AnimatesAsSoul[Type] = true; ItemID.Sets.ItemNoGravity[Item.type] = true; - ItemID.Sets.SortingPriorityMaterials[Type] = 116; + ItemID.Sets.SortingPriorityMaterials[Type] = 116; } public override void SetDefaults() diff --git a/Items/Materials/EnergyCore.cs b/Items/Materials/EnergyCore.cs index e1199e2a0c..70a5a726dc 100644 --- a/Items/Materials/EnergyCore.cs +++ b/Items/Materials/EnergyCore.cs @@ -1,6 +1,6 @@ using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Materials { diff --git a/Items/Materials/EssenceofEleum.cs b/Items/Materials/EssenceofEleum.cs index f071a3244f..2e2594eafd 100644 --- a/Items/Materials/EssenceofEleum.cs +++ b/Items/Materials/EssenceofEleum.cs @@ -1,9 +1,9 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; -using Terraria.ModLoader; -using Terraria.ID; using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Materials { @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Materials Item.ResearchUnlockCount = 25; ItemID.Sets.ItemNoGravity[Item.type] = true; - ItemID.Sets.SortingPriorityMaterials[Type] = 71; // Soul of Light + ItemID.Sets.SortingPriorityMaterials[Type] = 71; // Soul of Light } public override void SetDefaults() diff --git a/Items/Materials/EssenceofHavoc.cs b/Items/Materials/EssenceofHavoc.cs index 73ae565e42..6966670aec 100644 --- a/Items/Materials/EssenceofHavoc.cs +++ b/Items/Materials/EssenceofHavoc.cs @@ -1,9 +1,9 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; -using Terraria.ModLoader; -using Terraria.ID; using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Materials { @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Materials Item.ResearchUnlockCount = 25; ItemID.Sets.ItemNoGravity[Item.type] = true; - ItemID.Sets.SortingPriorityMaterials[Type] = 71; // Soul of Light + ItemID.Sets.SortingPriorityMaterials[Type] = 71; // Soul of Light } public override void SetDefaults() diff --git a/Items/Materials/EssenceofSunlight.cs b/Items/Materials/EssenceofSunlight.cs index f937d9cfba..72c482ee4b 100644 --- a/Items/Materials/EssenceofSunlight.cs +++ b/Items/Materials/EssenceofSunlight.cs @@ -1,9 +1,9 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; -using Terraria.ModLoader; -using Terraria.ID; using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Materials { @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Materials Item.ResearchUnlockCount = 25; ItemID.Sets.ItemNoGravity[Item.type] = true; - ItemID.Sets.SortingPriorityMaterials[Type] = 71; // Soul of Light + ItemID.Sets.SortingPriorityMaterials[Type] = 71; // Soul of Light } public override void SetDefaults() diff --git a/Items/Materials/ExoPrism.cs b/Items/Materials/ExoPrism.cs index d3dc3348ef..217a71ef3a 100644 --- a/Items/Materials/ExoPrism.cs +++ b/Items/Materials/ExoPrism.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Materials public override void SetStaticDefaults() { Item.ResearchUnlockCount = 25; - ItemID.Sets.SortingPriorityMaterials[Type] = 121; + ItemID.Sets.SortingPriorityMaterials[Type] = 121; } public override void SetDefaults() @@ -55,7 +55,7 @@ namespace CalamityMod.Items.Materials if (Main.rand.NextBool(3)) { - Dust exoShine = Dust.NewDustDirect(Item.position, (int)(Item.width * Item.scale), (int)(Item.height * Item.scale * 0.6f), 204); + Dust exoShine = Dust.NewDustDirect(Item.position, (int)(Item.width * Item.scale), (int)(Item.height * Item.scale * 0.6f), DustID.TreasureSparkle); exoShine.velocity = Vector2.Lerp(Main.rand.NextVector2Unit(), -Vector2.UnitY, 0.5f) * Main.rand.NextFloat(1.2f, 1.8f); exoShine.fadeIn = 0.7f; exoShine.noGravity = true; diff --git a/Items/Materials/GalacticaSingularity.cs b/Items/Materials/GalacticaSingularity.cs index 5dc2bc2dd8..b006b43111 100644 --- a/Items/Materials/GalacticaSingularity.cs +++ b/Items/Materials/GalacticaSingularity.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Materials Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(4, 24)); ItemID.Sets.AnimatesAsSoul[Type] = true; ItemID.Sets.ItemNoGravity[Item.type] = true; - ItemID.Sets.SortingPriorityMaterials[Type] = 99; // Luminite + ItemID.Sets.SortingPriorityMaterials[Type] = 99; // Luminite } public override void SetDefaults() diff --git a/Items/Materials/GrandScale.cs b/Items/Materials/GrandScale.cs index 555313d41d..ac0c71598e 100644 --- a/Items/Materials/GrandScale.cs +++ b/Items/Materials/GrandScale.cs @@ -1,6 +1,6 @@ using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Materials { diff --git a/Items/Materials/InfectedArmorPlating.cs b/Items/Materials/InfectedArmorPlating.cs index 23148aebec..c5d9ce788f 100644 --- a/Items/Materials/InfectedArmorPlating.cs +++ b/Items/Materials/InfectedArmorPlating.cs @@ -1,6 +1,6 @@ using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Materials { @@ -19,5 +19,6 @@ namespace CalamityMod.Items.Materials Item.maxStack = 9999; Item.value = Item.buyPrice(0, 5, 0, 0); Item.rare = ItemRarityID.Yellow; - } } + } + } } diff --git a/Items/Materials/LivingShard.cs b/Items/Materials/LivingShard.cs index f1b0f721cf..91b85e7819 100644 --- a/Items/Materials/LivingShard.cs +++ b/Items/Materials/LivingShard.cs @@ -1,6 +1,6 @@ using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Materials { @@ -19,5 +19,6 @@ namespace CalamityMod.Items.Materials Item.maxStack = 9999; Item.value = Item.sellPrice(silver: 80); Item.rare = ItemRarityID.Lime; - } } + } + } } diff --git a/Items/Materials/Lumenyl.cs b/Items/Materials/Lumenyl.cs index 3cc7456d23..307abbd6b5 100644 --- a/Items/Materials/Lumenyl.cs +++ b/Items/Materials/Lumenyl.cs @@ -16,6 +16,8 @@ namespace CalamityMod.Items.Materials public override void SetDefaults() { + Item.width = 26; + Item.height = 26; Item.createTile = ModContent.TileType(); Item.useStyle = ItemUseStyleID.Swing; Item.useTurn = true; @@ -23,8 +25,6 @@ namespace CalamityMod.Items.Materials Item.useTime = 10; Item.autoReuse = true; Item.consumable = true; - Item.width = 26; - Item.height = 26; Item.maxStack = 9999; Item.value = Item.sellPrice(silver: 80); Item.rare = ItemRarityID.Lime; diff --git a/Items/Materials/MeldBlob.cs b/Items/Materials/MeldBlob.cs index c77c7d11a1..63d2a1da1e 100644 --- a/Items/Materials/MeldBlob.cs +++ b/Items/Materials/MeldBlob.cs @@ -1,6 +1,6 @@ using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Materials { @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Materials Item.height = 14; Item.maxStack = 9999; Item.value = Item.sellPrice(silver: 20); - Item.rare = ItemRarityID.Cyan; + Item.rare = ItemRarityID.Red; } } } diff --git a/Items/Materials/MeldConstruct.cs b/Items/Materials/MeldConstruct.cs index 7f89b3bc3a..feded67f84 100644 --- a/Items/Materials/MeldConstruct.cs +++ b/Items/Materials/MeldConstruct.cs @@ -19,13 +19,13 @@ namespace CalamityMod.Items.Materials Item.height = 12; Item.maxStack = 9999; Item.value = Item.sellPrice(gold: 1, silver: 20); - Item.rare = ItemRarityID.Cyan; + Item.rare = ItemRarityID.Red; } public override void AddRecipes() { CreateRecipe(3). AddIngredient(6). - AddIngredient(3). + AddIngredient(3). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Materials/MiracleMatter.cs b/Items/Materials/MiracleMatter.cs index 0e77633698..c980c8ef48 100644 --- a/Items/Materials/MiracleMatter.cs +++ b/Items/Materials/MiracleMatter.cs @@ -1,8 +1,8 @@ -using CalamityMod.Rarities; +using System; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.GameContent; using Terraria.ID; @@ -16,13 +16,13 @@ namespace CalamityMod.Items.Materials public override void SetStaticDefaults() { Item.ResearchUnlockCount = 5; - ItemID.Sets.SortingPriorityMaterials[Type] = 122; + ItemID.Sets.SortingPriorityMaterials[Type] = 122; } public override void SetDefaults() { - Item.width = 46; - Item.height = 64; + Item.width = 70; + Item.height = 80; Item.maxStack = 9999; Item.value = Item.sellPrice(platinum: 6, gold: 50); Item.rare = ModContent.RarityType(); @@ -73,7 +73,7 @@ namespace CalamityMod.Items.Materials if (Main.rand.NextBool(3)) { - Dust exoFlame = Dust.NewDustDirect(Item.position, (int)(Item.width * Item.scale), (int)(Item.height * Item.scale * 0.6f), 6); + Dust exoFlame = Dust.NewDustDirect(Item.position, (int)(Item.width * Item.scale), (int)(Item.height * Item.scale * 0.6f), DustID.Torch); exoFlame.velocity = Vector2.Lerp(Main.rand.NextVector2Unit(), -Vector2.UnitY, 0.5f) * Main.rand.NextFloat(1.8f, 2.6f); exoFlame.scale *= Main.rand.NextFloat(0.85f, 1.15f); exoFlame.fadeIn = 0.9f; diff --git a/Items/Materials/MiracleMatter.png b/Items/Materials/MiracleMatter.png index a313570748..4ffb2ac9ca 100644 Binary files a/Items/Materials/MiracleMatter.png and b/Items/Materials/MiracleMatter.png differ diff --git a/Items/Materials/MolluskHusk.cs b/Items/Materials/MolluskHusk.cs index 0bae5b3ef0..e7a45fb325 100644 --- a/Items/Materials/MolluskHusk.cs +++ b/Items/Materials/MolluskHusk.cs @@ -1,6 +1,6 @@ using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Materials { @@ -19,5 +19,6 @@ namespace CalamityMod.Items.Materials Item.maxStack = 9999; Item.value = Item.buyPrice(0, 3, 0, 0); Item.rare = ItemRarityID.Pink; - } } + } + } } diff --git a/Items/Materials/MurkyPaste.cs b/Items/Materials/MurkyPaste.cs index 204b2c23f2..060bd0cb08 100644 --- a/Items/Materials/MurkyPaste.cs +++ b/Items/Materials/MurkyPaste.cs @@ -1,6 +1,6 @@ using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Materials { diff --git a/Items/Materials/MysteriousCircuitry.cs b/Items/Materials/MysteriousCircuitry.cs index 80c022b853..aa904fc5f5 100644 --- a/Items/Materials/MysteriousCircuitry.cs +++ b/Items/Materials/MysteriousCircuitry.cs @@ -20,5 +20,6 @@ namespace CalamityMod.Items.Materials Item.maxStack = 9999; Item.rare = ModContent.RarityType(); Item.value = Item.sellPrice(silver: 6); - } } + } + } } diff --git a/Items/Materials/Polterplasm.cs b/Items/Materials/Necroplasm.cs similarity index 83% rename from Items/Materials/Polterplasm.cs rename to Items/Materials/Necroplasm.cs index 6a55c5c4f0..4a64871a61 100644 --- a/Items/Materials/Polterplasm.cs +++ b/Items/Materials/Necroplasm.cs @@ -1,13 +1,13 @@ using Microsoft.Xna.Framework; using Terraria; -using Terraria.ID; using Terraria.DataStructures; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Materials { - [LegacyName("Phantoplasm")] - public class Polterplasm : ModItem, ILocalizedModType + [LegacyName("Phantoplasm", "Polterplasm")] + public class Necroplasm : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Materials"; @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Materials Item.ResearchUnlockCount = 25; Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(5, 6)); ItemID.Sets.AnimatesAsSoul[Type] = true; - ItemID.Sets.SortingPriorityMaterials[Type] = 110; + ItemID.Sets.SortingPriorityMaterials[Type] = 110; } public override void SetDefaults() diff --git a/Items/Materials/Polterplasm.png b/Items/Materials/Necroplasm.png similarity index 100% rename from Items/Materials/Polterplasm.png rename to Items/Materials/Necroplasm.png diff --git a/Items/Materials/NightmareFuel.cs b/Items/Materials/NightmareFuel.cs index e6834f594a..441d58d716 100644 --- a/Items/Materials/NightmareFuel.cs +++ b/Items/Materials/NightmareFuel.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Materials Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(6, 6)); ItemID.Sets.AnimatesAsSoul[Type] = true; ItemID.Sets.ItemNoGravity[Item.type] = true; - ItemID.Sets.SortingPriorityMaterials[Type] = 115; + ItemID.Sets.SortingPriorityMaterials[Type] = 115; } public override void SetDefaults() diff --git a/Items/Materials/PearlShard.cs b/Items/Materials/PearlShard.cs index 84d81bf148..15fdd26495 100644 --- a/Items/Materials/PearlShard.cs +++ b/Items/Materials/PearlShard.cs @@ -1,6 +1,6 @@ using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Materials { @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Materials public override void SetStaticDefaults() { Item.ResearchUnlockCount = 25; - ItemID.Sets.SortingPriorityMaterials[Type] = 60; // Meteorite + ItemID.Sets.SortingPriorityMaterials[Type] = 60; // Meteorite } public override void SetDefaults() @@ -21,5 +21,6 @@ namespace CalamityMod.Items.Materials Item.maxStack = 9999; Item.value = Item.sellPrice(silver: 3); Item.rare = ItemRarityID.Green; - } } + } + } } diff --git a/Items/Materials/PerennialBar.cs b/Items/Materials/PerennialBar.cs index 6d5d354bf2..b6da5b5fab 100644 --- a/Items/Materials/PerennialBar.cs +++ b/Items/Materials/PerennialBar.cs @@ -13,11 +13,13 @@ namespace CalamityMod.Items.Materials public override void SetStaticDefaults() { Item.ResearchUnlockCount = 25; - ItemID.Sets.SortingPriorityMaterials[Type] = 92; // Shroomite Bar + ItemID.Sets.SortingPriorityMaterials[Type] = 92; // Shroomite Bar } public override void SetDefaults() { + Item.width = 30; + Item.height = 24; Item.createTile = ModContent.TileType(); Item.useStyle = ItemUseStyleID.Swing; Item.useTurn = true; @@ -25,8 +27,6 @@ namespace CalamityMod.Items.Materials Item.useTime = 10; Item.autoReuse = true; Item.consumable = true; - Item.width = 30; - Item.height = 24; Item.maxStack = 9999; Item.value = Item.sellPrice(gold: 1); Item.rare = ItemRarityID.Lime; diff --git a/Items/Materials/PlagueCellCanister.cs b/Items/Materials/PlagueCellCanister.cs index a5f33b1465..4dc0f81339 100644 --- a/Items/Materials/PlagueCellCanister.cs +++ b/Items/Materials/PlagueCellCanister.cs @@ -1,6 +1,6 @@ using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Materials { @@ -20,5 +20,6 @@ namespace CalamityMod.Items.Materials Item.maxStack = 9999; Item.value = Item.buyPrice(0, 5, 0, 0); Item.rare = ItemRarityID.Yellow; - } } + } + } } diff --git a/Items/Materials/PlasmaDriveCore.cs b/Items/Materials/PlasmaDriveCore.cs index aded54296f..c58829e8a4 100644 --- a/Items/Materials/PlasmaDriveCore.cs +++ b/Items/Materials/PlasmaDriveCore.cs @@ -1,7 +1,7 @@ -using CalamityMod.Rarities; +using System; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.GameContent; using Terraria.Graphics.Shaders; @@ -41,7 +41,7 @@ namespace CalamityMod.Items.Materials for (float i = 0; i < 1; i += 0.25f) { - spriteBatch.Draw(tex, position + (i * MathHelper.TwoPi).ToRotationVector2() * positionOffset, frame, outlineColor, 0f, origin, scale, 0f, 0f); + spriteBatch.Draw(tex, position + (i * MathHelper.TwoPi).ToRotationVector2() * positionOffset, frame, outlineColor, 0f, origin, scale, 0f, 0f); } spriteBatch.End(); diff --git a/Items/Materials/PurifiedGel.cs b/Items/Materials/PurifiedGel.cs index 5698ffcbac..e1b068b15b 100644 --- a/Items/Materials/PurifiedGel.cs +++ b/Items/Materials/PurifiedGel.cs @@ -1,6 +1,6 @@ using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Materials { @@ -10,7 +10,7 @@ namespace CalamityMod.Items.Materials public override void SetStaticDefaults() { Item.ResearchUnlockCount = 25; - ItemID.Sets.SortingPriorityMaterials[Type] = 71; // Soul of Light + ItemID.Sets.SortingPriorityMaterials[Type] = 71; // Soul of Light } public override void SetDefaults() @@ -20,5 +20,6 @@ namespace CalamityMod.Items.Materials Item.maxStack = 9999; Item.value = Item.buyPrice(0, 2, 50, 0); Item.rare = ItemRarityID.LightRed; - } } + } + } } diff --git a/Items/Materials/RottenMatter.cs b/Items/Materials/RottenMatter.cs index 6a1c0b8262..e47baf25b3 100644 --- a/Items/Materials/RottenMatter.cs +++ b/Items/Materials/RottenMatter.cs @@ -1,6 +1,6 @@ using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Materials { @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Materials public override void SetStaticDefaults() { Item.ResearchUnlockCount = 25; - ItemID.Sets.SortingPriorityMaterials[Type] = 65; // Crimtane Ore + ItemID.Sets.SortingPriorityMaterials[Type] = 65; // Crimtane Ore } public override void SetDefaults() diff --git a/Items/Materials/RuinousSoul.cs b/Items/Materials/RuinousSoul.cs index 6d32d61f03..b02274801b 100644 --- a/Items/Materials/RuinousSoul.cs +++ b/Items/Materials/RuinousSoul.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Materials Item.ResearchUnlockCount = 25; Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(6, 6)); ItemID.Sets.AnimatesAsSoul[Type] = true; - ItemID.Sets.SortingPriorityMaterials[Type] = 111; + ItemID.Sets.SortingPriorityMaterials[Type] = 111; } public override void SetDefaults() diff --git a/Items/Materials/SeaRemains.cs b/Items/Materials/SeaRemains.cs index 7383f99937..8c050cca09 100644 --- a/Items/Materials/SeaRemains.cs +++ b/Items/Materials/SeaRemains.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Materials public override void SetStaticDefaults() { Item.ResearchUnlockCount = 25; - ItemID.Sets.SortingPriorityMaterials[Type] = 60; // Meteorite + ItemID.Sets.SortingPriorityMaterials[Type] = 60; // Meteorite } public override void SetDefaults() diff --git a/Items/Materials/SolarVeil.cs b/Items/Materials/SolarVeil.cs index 04edd464ad..6cf4c98a11 100644 --- a/Items/Materials/SolarVeil.cs +++ b/Items/Materials/SolarVeil.cs @@ -1,6 +1,6 @@ using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Materials { @@ -19,5 +19,6 @@ namespace CalamityMod.Items.Materials Item.maxStack = 9999; Item.value = Item.sellPrice(silver: 80); Item.rare = ItemRarityID.Lime; - } } + } + } } diff --git a/Items/Materials/Stardust.cs b/Items/Materials/StarblightSoot.cs similarity index 86% rename from Items/Materials/Stardust.cs rename to Items/Materials/StarblightSoot.cs index d4918489f7..a22b09e580 100644 --- a/Items/Materials/Stardust.cs +++ b/Items/Materials/StarblightSoot.cs @@ -1,10 +1,11 @@ using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Materials { - public class Stardust : ModItem, ILocalizedModType + [LegacyName("Stardust")] + public class StarblightSoot : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Materials"; public override void SetStaticDefaults() diff --git a/Items/Materials/Stardust.png b/Items/Materials/StarblightSoot.png similarity index 100% rename from Items/Materials/Stardust.png rename to Items/Materials/StarblightSoot.png diff --git a/Items/Materials/StormlionMandible.cs b/Items/Materials/StormlionMandible.cs index 0d41f3d2f8..597fc42f75 100644 --- a/Items/Materials/StormlionMandible.cs +++ b/Items/Materials/StormlionMandible.cs @@ -1,7 +1,7 @@ using Terraria; -using Terraria.ModLoader; -using Terraria.ID; using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Materials { diff --git a/Items/Materials/SulphuricScale.cs b/Items/Materials/SulphuricScale.cs index 58bdb17209..5ced553ffa 100644 --- a/Items/Materials/SulphuricScale.cs +++ b/Items/Materials/SulphuricScale.cs @@ -1,6 +1,6 @@ using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Materials { diff --git a/Items/Materials/SuspiciousScrap.cs b/Items/Materials/SuspiciousScrap.cs index ec193faf5f..5abbf4b4c5 100644 --- a/Items/Materials/SuspiciousScrap.cs +++ b/Items/Materials/SuspiciousScrap.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Materials public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) { Texture2D tex = TextureAssets.Item[Item.type].Value; - Vector2 positionDisplace = new Vector2( 32 , 32 ) * scale; + Vector2 positionDisplace = new Vector2(32, 32) * scale; Rectangle variant = new Rectangle(CalamityWorld.OreTypes[0] == TileID.Tin ? 0 : 32, CalamityWorld.OreTypes[1] == TileID.Lead ? 0 : 32, 30, 30); spriteBatch.Draw(tex, position + positionDisplace, variant, drawColor, 0f, origin, scale * 2f, 0f, 0f); return false; @@ -38,7 +38,7 @@ namespace CalamityMod.Items.Materials { Texture2D tex = TextureAssets.Item[Item.type].Value; Rectangle variant = new Rectangle(CalamityWorld.OreTypes[0] == TileID.Tin ? 0 : 32, CalamityWorld.OreTypes[1] == TileID.Lead ? 0 : 32, 30, 30); - Vector2 positionDisplace = new Vector2( 16 , 16 ) * scale; + Vector2 positionDisplace = new Vector2(16, 16) * scale; spriteBatch.Draw(tex, Item.position + positionDisplace - Main.screenPosition, variant, lightColor, rotation, variant.Size() / 2f, scale, 0f, 0f); return false; diff --git a/Items/Materials/TitanHeart.cs b/Items/Materials/TitanHeart.cs index 02be81e919..2e928d8b45 100644 --- a/Items/Materials/TitanHeart.cs +++ b/Items/Materials/TitanHeart.cs @@ -1,6 +1,6 @@ using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Materials { @@ -19,5 +19,6 @@ namespace CalamityMod.Items.Materials Item.maxStack = 9999; Item.value = Item.sellPrice(gold: 1); Item.rare = ItemRarityID.LightRed; - } } + } + } } diff --git a/Items/Materials/TrapperBulb.cs b/Items/Materials/TrapperBulb.cs index 8871e45749..b787880bc2 100644 --- a/Items/Materials/TrapperBulb.cs +++ b/Items/Materials/TrapperBulb.cs @@ -1,6 +1,6 @@ using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Materials { diff --git a/Items/Materials/TwistingNether.cs b/Items/Materials/TwistingNether.cs index e8b3336095..64dd4ce51a 100644 --- a/Items/Materials/TwistingNether.cs +++ b/Items/Materials/TwistingNether.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Materials Item.ResearchUnlockCount = 5; ItemID.Sets.ItemNoGravity[Item.type] = true; - ItemID.Sets.SortingPriorityMaterials[Type] = 109; + ItemID.Sets.SortingPriorityMaterials[Type] = 109; } public override void SetDefaults() diff --git a/Items/Materials/UelibloomBar.cs b/Items/Materials/UelibloomBar.cs index acd83d75dd..64c2c1f34e 100644 --- a/Items/Materials/UelibloomBar.cs +++ b/Items/Materials/UelibloomBar.cs @@ -14,14 +14,14 @@ namespace CalamityMod.Items.Materials public override void SetStaticDefaults() { Item.ResearchUnlockCount = 25; - ItemID.Sets.SortingPriorityMaterials[Type] = 106; + ItemID.Sets.SortingPriorityMaterials[Type] = 106; } public override void SetDefaults() { - Item.createTile = ModContent.TileType(); Item.width = 15; Item.height = 12; + Item.createTile = ModContent.TileType(); Item.maxStack = 9999; Item.value = Item.sellPrice(gold: 5); Item.rare = ModContent.RarityType(); diff --git a/Items/Materials/UnholyCore.cs b/Items/Materials/UnholyCore.cs index 4962d54429..8939d792ce 100644 --- a/Items/Materials/UnholyCore.cs +++ b/Items/Materials/UnholyCore.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Materials public override void SetStaticDefaults() { Item.ResearchUnlockCount = 25; - ItemID.Sets.SortingPriorityMaterials[Type] = 90; // Chlorophyte Ore + ItemID.Sets.SortingPriorityMaterials[Type] = 90; // Chlorophyte Ore } public override void SetDefaults() diff --git a/Items/Materials/UnholyEssence.cs b/Items/Materials/UnholyEssence.cs index 217be5e725..1f79451f27 100644 --- a/Items/Materials/UnholyEssence.cs +++ b/Items/Materials/UnholyEssence.cs @@ -1,6 +1,6 @@ using Terraria; -using Terraria.ID; using Terraria.DataStructures; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Materials @@ -11,16 +11,16 @@ namespace CalamityMod.Items.Materials public override void SetStaticDefaults() { Item.ResearchUnlockCount = 25; - Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(6, 5)); + Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(5, 7)); ItemID.Sets.AnimatesAsSoul[Type] = true; ItemID.Sets.ItemNoGravity[Item.type] = true; - ItemID.Sets.SortingPriorityMaterials[Type] = 103; + ItemID.Sets.SortingPriorityMaterials[Type] = 103; } public override void SetDefaults() { - Item.width = 15; - Item.height = 12; + Item.width = 28; + Item.height = 36; Item.maxStack = 9999; Item.rare = ItemRarityID.Purple; Item.value = Item.buyPrice(0, 6, 50, 0); diff --git a/Items/Materials/UnholyEssence.png b/Items/Materials/UnholyEssence.png index 5034dde2c1..269a1fdaf4 100644 Binary files a/Items/Materials/UnholyEssence.png and b/Items/Materials/UnholyEssence.png differ diff --git a/Items/Materials/WulfrumMetalScrap.cs b/Items/Materials/WulfrumMetalScrap.cs index 5752684df2..bd5a55c188 100644 --- a/Items/Materials/WulfrumMetalScrap.cs +++ b/Items/Materials/WulfrumMetalScrap.cs @@ -1,11 +1,11 @@ -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; -using Terraria.DataStructures; +using CalamityMod.Cooldowns; using CalamityMod.Items.Accessories; using CalamityMod.Items.Armor.Wulfrum; +using Terraria; using Terraria.Audio; -using CalamityMod.Cooldowns; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; using static CalamityMod.CalamityUtils; namespace CalamityMod.Items.Materials @@ -30,10 +30,10 @@ namespace CalamityMod.Items.Materials Item.ammo = Item.type; } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.Material; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.Material; + } public override void OnSpawn(IEntitySource source) { diff --git a/Items/MomentumCapacitor.cs b/Items/MomentumCapacitor.cs index 75eda13454..5f95ff78f8 100644 --- a/Items/MomentumCapacitor.cs +++ b/Items/MomentumCapacitor.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items { Item.width = 28; Item.height = 32; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.useStyle = ItemUseStyleID.HoldUp; @@ -28,10 +28,10 @@ namespace CalamityMod.Items Item.useTurn = true; } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.ToolsOther; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.ToolsOther; + } public override bool? UseItem(Player player) { diff --git a/Items/Mounts/AlicornMount.cs b/Items/Mounts/AlicornMount.cs index 3e03ae4e5b..7db85ed596 100644 --- a/Items/Mounts/AlicornMount.cs +++ b/Items/Mounts/AlicornMount.cs @@ -2,11 +2,11 @@ using CalamityMod.CalPlayer; using CalamityMod.NPCs.TownNPCs; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Microsoft.Xna.Framework.Graphics; -using Terraria.Audio; namespace CalamityMod.Items.Mounts { @@ -134,7 +134,7 @@ namespace CalamityMod.Items.Mounts meme = new Color(25, 105, 255); } Rectangle rect = player.getRect(); - int dust = Dust.NewDust(new Vector2(rect.X, rect.Y), rect.Width, rect.Height, 234, 0, 0, 0, meme); + int dust = Dust.NewDust(new Vector2(rect.X, rect.Y), rect.Width, rect.Height, DustID.BoneTorch, 0, 0, 0, meme); Main.dust[dust].noGravity = true; } diff --git a/Items/Mounts/Crysthamyr.cs b/Items/Mounts/Crysthamyr.cs index 96a42a0293..874cf573de 100644 --- a/Items/Mounts/Crysthamyr.cs +++ b/Items/Mounts/Crysthamyr.cs @@ -1,11 +1,11 @@ -using CalamityMod.Buffs.Mounts; +using System; +using CalamityMod.Buffs.Mounts; using Microsoft.Xna.Framework; -using System; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Microsoft.Xna.Framework.Graphics; -using Terraria.Audio; namespace CalamityMod.Items.Mounts { diff --git a/Items/Mounts/DraedonGamerChairMount.cs b/Items/Mounts/DraedonGamerChairMount.cs index ed2c648d57..ce820837b9 100644 --- a/Items/Mounts/DraedonGamerChairMount.cs +++ b/Items/Mounts/DraedonGamerChairMount.cs @@ -1,7 +1,7 @@ -using CalamityMod.Buffs.Mounts; +using System.Collections.Generic; +using CalamityMod.Buffs.Mounts; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System.Collections.Generic; using Terraria; using Terraria.DataStructures; using Terraria.ID; diff --git a/Items/Mounts/ExoThrone.cs b/Items/Mounts/ExoThrone.cs index 28cae8a07d..e88ceae633 100644 --- a/Items/Mounts/ExoThrone.cs +++ b/Items/Mounts/ExoThrone.cs @@ -1,5 +1,5 @@ -using CalamityMod.Rarities; -using System.Collections.Generic; +using System.Collections.Generic; +using CalamityMod.Rarities; using Terraria.ID; using Terraria.ModLoader; diff --git a/Items/Mounts/GazeOfCrysthamyr.cs b/Items/Mounts/GazeOfCrysthamyr.cs index f1bdc5d5c7..e456334b0e 100644 --- a/Items/Mounts/GazeOfCrysthamyr.cs +++ b/Items/Mounts/GazeOfCrysthamyr.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Mounts public new string LocalizationCategory => "Items.Mounts"; public override void SetStaticDefaults() { - + } public override void SetDefaults() @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Mounts Item.useAnimation = 20; Item.useStyle = ItemUseStyleID.HoldUp; - Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; diff --git a/Items/Mounts/Minecarts/DoGCartMount.cs b/Items/Mounts/Minecarts/DoGCartMount.cs index 8dfb0d71fb..175584992d 100644 --- a/Items/Mounts/Minecarts/DoGCartMount.cs +++ b/Items/Mounts/Minecarts/DoGCartMount.cs @@ -1,9 +1,9 @@ -using CalamityMod.Buffs.Mounts; +using System; +using System.Collections.Generic; +using CalamityMod.Buffs.Mounts; using CalamityMod.DataStructures; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.Collections.Generic; using Terraria; using Terraria.DataStructures; using Terraria.ID; diff --git a/Items/Mounts/OnyxExcavator.cs b/Items/Mounts/OnyxExcavator.cs index 3cbce8a8f1..52aa5d8846 100644 --- a/Items/Mounts/OnyxExcavator.cs +++ b/Items/Mounts/OnyxExcavator.cs @@ -1,14 +1,14 @@ -using CalamityMod.Buffs.Mounts; +using System; +using System.Collections.Generic; +using CalamityMod.Buffs.Mounts; using CalamityMod.Tiles.Abyss; using Microsoft.Xna.Framework; -using System; -using System.Collections.Generic; +using Microsoft.Xna.Framework.Graphics; using Terraria; //using Terraria.GameContent.Achievements; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; -using Microsoft.Xna.Framework.Graphics; namespace CalamityMod.Items.Mounts { @@ -74,7 +74,7 @@ namespace CalamityMod.Items.Mounts { for (int i = 0; i < 2; i++) { - Dust dust = Dust.NewDustDirect(mountedPlayer.BottomLeft, mountedPlayer.width, 6, 192, 0f, 0f, 0, default, 1f); + Dust dust = Dust.NewDustDirect(mountedPlayer.BottomLeft, mountedPlayer.width, 6, DustID.Ghost, 0f, 0f, 0, default, 1f); dust.velocity = new Vector2(velocity.X * 0.15f, Main.rand.NextFloat() * -2f); dust.noLight = true; dust.scale = 0.2f + Main.rand.NextFloat() * 0.8f; diff --git a/Items/Mounts/PhuppersChair.cs b/Items/Mounts/PhuppersChair.cs index 2c297915f7..91f0c9d0f1 100644 --- a/Items/Mounts/PhuppersChair.cs +++ b/Items/Mounts/PhuppersChair.cs @@ -1,5 +1,5 @@ +using CalamityMod.Buffs.Mounts; using CalamityMod.Dusts; -using CalamityMod.Buffs.Mounts; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Items/Mounts/RimehoundMount.cs b/Items/Mounts/RimehoundMount.cs index 6d7bc3e580..e2d0d2da2f 100644 --- a/Items/Mounts/RimehoundMount.cs +++ b/Items/Mounts/RimehoundMount.cs @@ -1,6 +1,6 @@ -using CalamityMod.Buffs.Mounts; +using System; +using CalamityMod.Buffs.Mounts; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.Graphics.Shaders; using Terraria.ID; @@ -83,7 +83,7 @@ namespace CalamityMod.Items.Mounts { for (int i = 0; i < 2; i++) { - Dust expr_631 = Main.dust[Dust.NewDust(mountedPlayer.BottomLeft, mountedPlayer.width, 6, 192, 0f, 0f, 0, default, 1f)]; + Dust expr_631 = Main.dust[Dust.NewDust(mountedPlayer.BottomLeft, mountedPlayer.width, 6, DustID.Ghost, 0f, 0f, 0, default, 1f)]; expr_631.velocity = new Vector2(velocity.X * 0.15f, Main.rand.NextFloat() * -2f); expr_631.noLight = true; expr_631.scale = 0.2f + Main.rand.NextFloat() * 0.8f; @@ -101,7 +101,7 @@ namespace CalamityMod.Items.Mounts { for (int j = 0; j < (int)(3f * mountedPlayer.basiliskCharge); j++) { - Dust dust = Main.dust[Dust.NewDust(mountedPlayer.BottomLeft, mountedPlayer.width, 6, 67, 0f, 0f, 0, default, 1f)]; + Dust dust = Main.dust[Dust.NewDust(mountedPlayer.BottomLeft, mountedPlayer.width, 6, DustID.IceRod, 0f, 0f, 0, default, 1f)]; Vector2 dustVel = mountedPlayer.Center + new Vector2(direction * dustXOffset, dustYOffset); dust.position = mountedPlayer.Center + new Vector2(direction * (dustXOffset - 2f), dustYOffset - 6f + Main.rand.NextFloat() * 12f); dust.velocity = (dust.position - dustVel).SafeNormalize(Vector2.Zero) * (3.5f + Main.rand.NextFloat() * 0.5f); diff --git a/Items/Mounts/SuspiciousLookingJellyBean.cs b/Items/Mounts/SuspiciousLookingJellyBean.cs index 9f36867212..55f9597ad6 100644 --- a/Items/Mounts/SuspiciousLookingJellyBean.cs +++ b/Items/Mounts/SuspiciousLookingJellyBean.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Mounts Item.noMelee = true; Item.mountType = ModContent.MountType(); - Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; Item.Calamity().devItem = true; } diff --git a/Items/NormalityRelocator.cs b/Items/NormalityRelocator.cs index d6b3a81e34..2b37817793 100644 --- a/Items/NormalityRelocator.cs +++ b/Items/NormalityRelocator.cs @@ -1,7 +1,7 @@ -using CalamityMod.CalPlayer; -using CalamityMod.Items.Placeables.Plates; +using System.Collections.Generic; +using CalamityMod.CalPlayer; using CalamityMod.Items.Placeables.Ores; -using System.Collections.Generic; +using CalamityMod.Items.Placeables.Plates; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -22,17 +22,17 @@ namespace CalamityMod.Items { Item.width = 38; Item.height = 38; - Item.value = CalamityGlobalItem.Rarity10BuyPrice; + Item.value = CalamityGlobalItem.RarityRedBuyPrice; Item.rare = ItemRarityID.Red; Item.Calamity().donorItem = true; } public override void ModifyTooltips(List list) => list.IntegrateHotkey(CalamityKeybinds.NormalityRelocatorHotKey); - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.ToolsOther; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.ToolsOther; + } public override void UpdateInventory(Player player) { diff --git a/Items/PermanentBoosters/BloodOrange.cs b/Items/PermanentBoosters/BloodOrange.cs index 1393757629..ded6fe84a0 100644 --- a/Items/PermanentBoosters/BloodOrange.cs +++ b/Items/PermanentBoosters/BloodOrange.cs @@ -1,4 +1,6 @@ -using CalamityMod.CalPlayer; +using System.Collections.Generic; +using System.Linq; +using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; @@ -6,8 +8,6 @@ using Terraria.Audio; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; -using System.Linq; -using System.Collections.Generic; namespace CalamityMod.Items.PermanentBoosters { @@ -21,8 +21,8 @@ namespace CalamityMod.Items.PermanentBoosters public static readonly SoundStyle UseSound = new("CalamityMod/Sounds/Item/BloodOrangeConsume"); public override void SetStaticDefaults() { - // For some reason Life/Mana boosting items are in this set (along with Magic Mirror+) - ItemID.Sets.SortingPriorityBossSpawns[Type] = 20; // Life Fruit + // For some reason Life/Mana boosting items are in this set (along with Magic Mirror+) + ItemID.Sets.SortingPriorityBossSpawns[Type] = 20; // Life Fruit } public override void SetDefaults() diff --git a/Items/PermanentBoosters/CelestialOnion.cs b/Items/PermanentBoosters/CelestialOnion.cs index 191d97a3e9..4db480cb29 100644 --- a/Items/PermanentBoosters/CelestialOnion.cs +++ b/Items/PermanentBoosters/CelestialOnion.cs @@ -36,10 +36,6 @@ namespace CalamityMod.Items.PermanentBoosters { player.itemTime = Item.useTime; modPlayer.extraAccessoryML = true; - - // TODO -- remove "onionMode", it does nothing. It is the old internal name for "Prepare to Cry". - if (!CalamityWorld.onionMode) - CalamityWorld.onionMode = true; } return true; } @@ -54,7 +50,7 @@ namespace CalamityMod.Items.PermanentBoosters // We prematurely stop it from getting to that point if (!Player.active || Main.masterMode) return false; - + return Player.Calamity().extraAccessoryML; } public override bool IsHidden() => IsEmpty && !IsEnabled(); diff --git a/Items/PermanentBoosters/CometShard.cs b/Items/PermanentBoosters/CometShard.cs index ef8a295c62..90cd2c4417 100644 --- a/Items/PermanentBoosters/CometShard.cs +++ b/Items/PermanentBoosters/CometShard.cs @@ -1,13 +1,13 @@ -using CalamityMod.CalPlayer; +using System.Collections.Generic; +using System.Linq; +using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; -using Terraria.Audio; -using System.Linq; -using System.Collections.Generic; namespace CalamityMod.Items.PermanentBoosters { @@ -20,8 +20,8 @@ namespace CalamityMod.Items.PermanentBoosters public override void SetStaticDefaults() { - // For some reason Life/Mana boosting items are in this set (along with Magic Mirror+) - ItemID.Sets.SortingPriorityBossSpawns[Type] = 21; // Mana Crystal + // For some reason Life/Mana boosting items are in this set (along with Magic Mirror+) + ItemID.Sets.SortingPriorityBossSpawns[Type] = 21; // Mana Crystal } public override void SetDefaults() @@ -71,7 +71,7 @@ namespace CalamityMod.Items.PermanentBoosters CreateRecipe(). AddIngredient(ItemID.MeteoriteBar, 10). AddIngredient(ItemID.FallenStar, 10). - AddIngredient(50). + AddIngredient(50). AddTile(TileID.Anvils). Register(); } diff --git a/Items/PermanentBoosters/Dragonfruit.cs b/Items/PermanentBoosters/Dragonfruit.cs index 34d2b8884b..4f855ff8f6 100644 --- a/Items/PermanentBoosters/Dragonfruit.cs +++ b/Items/PermanentBoosters/Dragonfruit.cs @@ -1,4 +1,6 @@ -using CalamityMod.CalPlayer; +using System.Collections.Generic; +using System.Linq; +using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; @@ -8,8 +10,6 @@ using Terraria.Audio; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; -using System.Linq; -using System.Collections.Generic; namespace CalamityMod.Items.PermanentBoosters { @@ -23,8 +23,8 @@ namespace CalamityMod.Items.PermanentBoosters public static readonly SoundStyle UseSound = new("CalamityMod/Sounds/Item/DragonfruitConsume"); public override void SetStaticDefaults() { - // For some reason Life/Mana boosting items are in this set (along with Magic Mirror+) - ItemID.Sets.SortingPriorityBossSpawns[Type] = 20; // Life Fruit + // For some reason Life/Mana boosting items are in this set (along with Magic Mirror+) + ItemID.Sets.SortingPriorityBossSpawns[Type] = 20; // Life Fruit } public override void SetDefaults() diff --git a/Items/PermanentBoosters/Elderberry.cs b/Items/PermanentBoosters/Elderberry.cs index c8f5acb5c3..fef3e5ef5e 100644 --- a/Items/PermanentBoosters/Elderberry.cs +++ b/Items/PermanentBoosters/Elderberry.cs @@ -1,9 +1,9 @@ -using CalamityMod.CalPlayer; +using System.Collections.Generic; +using System.Linq; +using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; using CalamityMod.Rarities; using Microsoft.Xna.Framework; -using System.Linq; -using System.Collections.Generic; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -22,8 +22,8 @@ namespace CalamityMod.Items.PermanentBoosters public static readonly SoundStyle UseSound = new("CalamityMod/Sounds/Item/ElderberryConsume"); public override void SetStaticDefaults() { - // For some reason Life/Mana boosting items are in this set (along with Magic Mirror+) - ItemID.Sets.SortingPriorityBossSpawns[Type] = 20; // Life Fruit + // For some reason Life/Mana boosting items are in this set (along with Magic Mirror+) + ItemID.Sets.SortingPriorityBossSpawns[Type] = 20; // Life Fruit } public override void SetDefaults() diff --git a/Items/PermanentBoosters/EtherealCore.cs b/Items/PermanentBoosters/EtherealCore.cs index ad3cdba065..7d8e704212 100644 --- a/Items/PermanentBoosters/EtherealCore.cs +++ b/Items/PermanentBoosters/EtherealCore.cs @@ -1,13 +1,13 @@ -using CalamityMod.CalPlayer; +using System.Collections.Generic; +using System.Linq; +using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; -using Terraria.Audio; -using System.Linq; -using System.Collections.Generic; namespace CalamityMod.Items.PermanentBoosters { @@ -20,8 +20,8 @@ namespace CalamityMod.Items.PermanentBoosters public override void SetStaticDefaults() { - // For some reason Life/Mana boosting items are in this set (along with Magic Mirror+) - ItemID.Sets.SortingPriorityBossSpawns[Type] = 21; // Mana Crystal + // For some reason Life/Mana boosting items are in this set (along with Magic Mirror+) + ItemID.Sets.SortingPriorityBossSpawns[Type] = 21; // Mana Crystal } public override void SetDefaults() diff --git a/Items/PermanentBoosters/MiracleFruit.cs b/Items/PermanentBoosters/MiracleFruit.cs index 101152fb8d..8da3fc2267 100644 --- a/Items/PermanentBoosters/MiracleFruit.cs +++ b/Items/PermanentBoosters/MiracleFruit.cs @@ -1,4 +1,6 @@ -using CalamityMod.CalPlayer; +using System.Collections.Generic; +using System.Linq; +using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; @@ -6,8 +8,6 @@ using Terraria.Audio; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; -using System.Linq; -using System.Collections.Generic; namespace CalamityMod.Items.PermanentBoosters { @@ -21,8 +21,8 @@ namespace CalamityMod.Items.PermanentBoosters public static readonly SoundStyle UseSound = new("CalamityMod/Sounds/Item/MiracleFruitConsume"); public override void SetStaticDefaults() { - // For some reason Life/Mana boosting items are in this set (along with Magic Mirror+) - ItemID.Sets.SortingPriorityBossSpawns[Type] = 20; // Life Fruit + // For some reason Life/Mana boosting items are in this set (along with Magic Mirror+) + ItemID.Sets.SortingPriorityBossSpawns[Type] = 20; // Life Fruit } public override void SetDefaults() diff --git a/Items/PermanentBoosters/PhantomHeart.cs b/Items/PermanentBoosters/PhantomHeart.cs index 127a08a666..f5e37440dc 100644 --- a/Items/PermanentBoosters/PhantomHeart.cs +++ b/Items/PermanentBoosters/PhantomHeart.cs @@ -1,14 +1,14 @@ -using CalamityMod.CalPlayer; +using System.Collections.Generic; +using System.Linq; +using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; using CalamityMod.Rarities; using Microsoft.Xna.Framework; -using System.Linq; -using System.Collections.Generic; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Items.PermanentBoosters { @@ -21,8 +21,8 @@ namespace CalamityMod.Items.PermanentBoosters public override void SetStaticDefaults() { - // For some reason Life/Mana boosting items are in this set (along with Magic Mirror+) - ItemID.Sets.SortingPriorityBossSpawns[Type] = 21; // Mana Crystal + // For some reason Life/Mana boosting items are in this set (along with Magic Mirror+) + ItemID.Sets.SortingPriorityBossSpawns[Type] = 21; // Mana Crystal } public override void SetDefaults() @@ -71,7 +71,7 @@ namespace CalamityMod.Items.PermanentBoosters { CreateRecipe(). AddIngredient(5). - AddIngredient(25). + AddIngredient(25). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Pets/AbyssShellFossil.cs b/Items/Pets/AbyssShellFossil.cs index a7ae400135..48415c3dd9 100644 --- a/Items/Pets/AbyssShellFossil.cs +++ b/Items/Pets/AbyssShellFossil.cs @@ -13,16 +13,16 @@ namespace CalamityMod.Items.Pets public new string LocalizationCategory => "Items.Pets"; public override void SetDefaults() { - Item.damage = 0; Item.width = 42; Item.height = 30; + Item.damage = 0; Item.useAnimation = 20; Item.useTime = 20; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.value = Item.sellPrice(platinum: 1); - Item.rare = ModContent.RarityType(); + Item.rare = ItemRarityID.Cyan; Item.Calamity().devItem = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Pets/AbyssShellFossil.png b/Items/Pets/AbyssShellFossil.png index c8f41db315..327ace4d86 100644 Binary files a/Items/Pets/AbyssShellFossil.png and b/Items/Pets/AbyssShellFossil.png differ diff --git a/Items/Pets/BearsEye.cs b/Items/Pets/BearsEye.cs index c43308c405..866b98d124 100644 --- a/Items/Pets/BearsEye.cs +++ b/Items/Pets/BearsEye.cs @@ -16,13 +16,13 @@ namespace CalamityMod.Items.Pets } public override void SetDefaults() { + Item.width = 30; + Item.height = 30; Item.damage = 0; Item.useStyle = ItemUseStyleID.Swing; Item.useAnimation = 20; Item.useTime = 20; Item.noMelee = true; - Item.width = 30; - Item.height = 30; Item.value = Item.sellPrice(platinum: 1); Item.rare = ItemRarityID.Pink; diff --git a/Items/Pets/BloodyVein.cs b/Items/Pets/BloodyVein.cs index 2c93d6c61c..5fbbf788f6 100644 --- a/Items/Pets/BloodyVein.cs +++ b/Items/Pets/BloodyVein.cs @@ -12,13 +12,13 @@ namespace CalamityMod.Items.Pets public new string LocalizationCategory => "Items.Pets"; public override void SetDefaults() { + Item.width = 24; + Item.height = 48; Item.damage = 0; Item.useTime = 20; Item.useAnimation = 20; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; - Item.width = 24; - Item.height = 48; Item.UseSound = SoundID.NPCHit9; Item.shoot = ModContent.ProjectileType(); Item.buffType = ModContent.BuffType(); diff --git a/Items/Pets/CosmicPlushie.cs b/Items/Pets/CosmicPlushie.cs index 35a78424a9..cb08a601c2 100644 --- a/Items/Pets/CosmicPlushie.cs +++ b/Items/Pets/CosmicPlushie.cs @@ -13,13 +13,13 @@ namespace CalamityMod.Items.Pets public new string LocalizationCategory => "Items.Pets"; public override void SetDefaults() { + Item.width = 28; + Item.height = 36; Item.damage = 0; Item.useStyle = ItemUseStyleID.Swing; Item.useAnimation = 20; Item.useTime = 20; Item.noMelee = true; - Item.width = 28; - Item.height = 36; Item.shoot = ModContent.ProjectileType(); Item.buffType = ModContent.BuffType(); Item.UseSound = SoundID.Meowmere; diff --git a/Items/Pets/DesertMedallion.png b/Items/Pets/DesertMedallion.png new file mode 100644 index 0000000000..4d0163da83 Binary files /dev/null and b/Items/Pets/DesertMedallion.png differ diff --git a/Items/Pets/GeyserShell.cs b/Items/Pets/GeyserShell.cs index fdc6f7f5d6..cb7b110649 100644 --- a/Items/Pets/GeyserShell.cs +++ b/Items/Pets/GeyserShell.cs @@ -15,13 +15,13 @@ namespace CalamityMod.Items.Pets } public override void SetDefaults() { + Item.width = 30; + Item.height = 30; Item.damage = 0; Item.useStyle = ItemUseStyleID.Swing; Item.useAnimation = 20; Item.useTime = 20; Item.noMelee = true; - Item.width = 30; - Item.height = 30; Item.value = Item.sellPrice(0, 1, 50, 0); Item.shoot = ModContent.ProjectileType(); Item.buffType = ModContent.BuffType(); diff --git a/Items/Pets/HermitsBoxofOneHundredMedicines.cs b/Items/Pets/HermitsBoxofOneHundredMedicines.cs index 7564baf5b0..629e1afcc0 100644 --- a/Items/Pets/HermitsBoxofOneHundredMedicines.cs +++ b/Items/Pets/HermitsBoxofOneHundredMedicines.cs @@ -15,13 +15,13 @@ namespace CalamityMod.Items.Pets public new string LocalizationCategory => "Items.Pets"; public override void SetDefaults() { + Item.width = 36; + Item.height = 30; Item.damage = 0; Item.useTime = 20; Item.useAnimation = 20; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; - Item.width = 36; - Item.height = 30; Item.UseSound = SoundID.Item3; Item.shoot = ModContent.ProjectileType(); Item.buffType = ModContent.BuffType(); @@ -33,37 +33,6 @@ namespace CalamityMod.Items.Pets public override bool AltFunctionUse(Player player) => true; - public override void UseStyle(Player player, Rectangle heldItemFrame) - { - if (player.itemAnimation == (int)(player.itemAnimationMax * 0.5) && Main.myPlayer == player.whoAmI) - { - if (player.altFunctionUse == 2) - { - if (!player.Calamity().healToFull) - { - player.Calamity().healToFull = true; - string key = "Mods.CalamityMod.Misc.ThirdSageBlessingText"; - Color messageColor = Color.Violet; - Main.NewText(Language.GetTextValue(key), messageColor); - } - else - { - player.Calamity().healToFull = false; - string key2 = "Mods.CalamityMod.Misc.ThirdSageBlessingText2"; - Color messageColor2 = Color.Violet; - Main.NewText(Language.GetTextValue(key2), messageColor2); - } - } - else - { - if (player.whoAmI == Main.myPlayer && player.itemTime == 0) - { - player.AddBuff(Item.buffType, 3600, true); - } - } - } - } - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) => false; } } diff --git a/Items/Pets/JoyfulHeart.cs b/Items/Pets/JoyfulHeart.cs index 89dbda8fa9..f11ddda78b 100644 --- a/Items/Pets/JoyfulHeart.cs +++ b/Items/Pets/JoyfulHeart.cs @@ -15,13 +15,13 @@ namespace CalamityMod.Items.Pets } public override void SetDefaults() { + Item.width = 30; + Item.height = 30; Item.damage = 0; Item.useStyle = ItemUseStyleID.Swing; Item.useAnimation = 20; Item.useTime = 20; Item.noMelee = true; - Item.width = 30; - Item.height = 30; Item.value = Item.sellPrice(gold: 1); Item.rare = ItemRarityID.Pink; diff --git a/Items/Pets/PineapplePet.cs b/Items/Pets/PineapplePet.cs index 5276b3c799..5340c86a40 100644 --- a/Items/Pets/PineapplePet.cs +++ b/Items/Pets/PineapplePet.cs @@ -12,13 +12,13 @@ namespace CalamityMod.Items.Pets public new string LocalizationCategory => "Items.Pets"; public override void SetDefaults() { + Item.width = 32; + Item.height = 34; Item.damage = 0; Item.useTime = Item.useAnimation = 20; Item.shoot = ModContent.ProjectileType(); Item.buffType = ModContent.BuffType(); - Item.width = 32; - Item.height = 34; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.UseSound = SoundID.Item2; diff --git a/Items/Pets/PrimroseKeepsake.cs b/Items/Pets/PrimroseKeepsake.cs index e48e171896..07925e77be 100644 --- a/Items/Pets/PrimroseKeepsake.cs +++ b/Items/Pets/PrimroseKeepsake.cs @@ -1,7 +1,7 @@ -using CalamityMod.Buffs.Pets; +using System.Collections.Generic; +using CalamityMod.Buffs.Pets; using CalamityMod.Projectiles.Pets; using Microsoft.Xna.Framework; -using System.Collections.Generic; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -14,14 +14,14 @@ namespace CalamityMod.Items.Pets public new string LocalizationCategory => "Items.Pets"; public override void SetDefaults() { + Item.width = 30; + Item.height = 30; Item.damage = 0; Item.useStyle = ItemUseStyleID.Swing; Item.useAnimation = 20; Item.useTime = 20; Item.noMelee = true; - Item.width = 30; - Item.height = 30; - Item.shoot = ProjectileID.None; // neither kendra nor bear is the direct "shoot" + Item.shoot = ModContent.ProjectileType(); Item.buffType = ModContent.BuffType(); Item.UseSound = SoundID.Item44; @@ -41,7 +41,7 @@ namespace CalamityMod.Items.Pets public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { List pets = new List { ModContent.ProjectileType(), ModContent.ProjectileType() }; - foreach(int petProjID in pets) + foreach (int petProjID in pets) Projectile.NewProjectile(source, position, velocity, petProjID, damage, knockback, player.whoAmI); return false; } diff --git a/Items/Pets/RomajedaOrchid.cs b/Items/Pets/RomajedaOrchid.cs index a39d6d5796..dfe1676b91 100644 --- a/Items/Pets/RomajedaOrchid.cs +++ b/Items/Pets/RomajedaOrchid.cs @@ -12,13 +12,13 @@ namespace CalamityMod.Items.Pets public new string LocalizationCategory => "Items.Pets"; public override void SetDefaults() { + Item.width = 30; + Item.height = 30; Item.damage = 0; Item.useStyle = ItemUseStyleID.Swing; Item.useAnimation = 20; Item.useTime = 20; Item.noMelee = true; - Item.width = 30; - Item.height = 30; Item.shoot = ModContent.ProjectileType(); Item.buffType = ModContent.BuffType(); Item.UseSound = SoundID.Item44; diff --git a/Items/Pets/RottingEyeball.cs b/Items/Pets/RottingEyeball.cs index 539e7aa7e1..2764494b8a 100644 --- a/Items/Pets/RottingEyeball.cs +++ b/Items/Pets/RottingEyeball.cs @@ -14,15 +14,15 @@ namespace CalamityMod.Items.Pets { /*item.DefaultToVanitypet(ModContent.ProjectileType(), ModContent.BuffType()); item.rare = -13;*/ + Item.width = 16; + Item.height = 30; Item.value = Item.buyPrice(0, 4, 0, 0); Item.damage = 0; Item.useTime = Item.useAnimation = 20; - Item.useStyle = 1; + Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; - Item.width = 16; - Item.height = 30; Item.UseSound = SoundID.NPCHit2; - Item.rare = 3; + Item.rare = ItemRarityID.Orange; Item.shoot = ModContent.ProjectileType(); Item.buffType = ModContent.BuffType(); } diff --git a/Items/Pets/TheEtomer.cs b/Items/Pets/TheEtomer.cs index 25d4b905f3..355db1054d 100644 --- a/Items/Pets/TheEtomer.cs +++ b/Items/Pets/TheEtomer.cs @@ -1,7 +1,7 @@ using CalamityMod.Buffs.Pets; -using CalamityMod.Projectiles.Pets; -using CalamityMod.Items.Placeables; using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables; +using CalamityMod.Projectiles.Pets; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -16,13 +16,13 @@ namespace CalamityMod.Items.Pets public new string LocalizationCategory => "Items.Pets"; public override void SetDefaults() { + Item.width = 30; + Item.height = 34; Item.damage = 0; Item.useTime = Item.useAnimation = 20; Item.shoot = ModContent.ProjectileType(); Item.buffType = ModContent.BuffType(); - Item.width = 30; - Item.height = 34; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.UseSound = SoundID.Item113; diff --git a/Items/Pets/ThiefsDime.cs b/Items/Pets/ThiefsDime.cs index be3ad7e4e8..cd11c961fa 100644 --- a/Items/Pets/ThiefsDime.cs +++ b/Items/Pets/ThiefsDime.cs @@ -2,8 +2,8 @@ using CalamityMod.Projectiles.Pets; using Microsoft.Xna.Framework; using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Pets { diff --git a/Items/Pets/TrashmanTrashcan.cs b/Items/Pets/TrashmanTrashcan.cs index b7d46eb610..8daf1ec4dd 100644 --- a/Items/Pets/TrashmanTrashcan.cs +++ b/Items/Pets/TrashmanTrashcan.cs @@ -15,13 +15,13 @@ namespace CalamityMod.Items.Pets } public override void SetDefaults() { + Item.width = 30; + Item.height = 30; Item.damage = 0; Item.useStyle = ItemUseStyleID.Swing; Item.useAnimation = 20; Item.useTime = 20; Item.noMelee = true; - Item.width = 30; - Item.height = 30; Item.shoot = ModContent.ProjectileType(); Item.buffType = ModContent.BuffType(); Item.UseSound = SoundID.NPCDeath13; diff --git a/Items/Placeables/AbyssGravel.cs b/Items/Placeables/AbyssGravel.cs index b1a75cd520..c86b2612c8 100644 --- a/Items/Placeables/AbyssGravel.cs +++ b/Items/Placeables/AbyssGravel.cs @@ -14,6 +14,8 @@ namespace CalamityMod.Items.Placeables public override void SetDefaults() { + Item.width = 16; + Item.height = 16; Item.createTile = ModContent.TileType(); Item.useStyle = ItemUseStyleID.Swing; Item.useTurn = true; @@ -21,8 +23,6 @@ namespace CalamityMod.Items.Placeables Item.useTime = 10; Item.autoReuse = true; Item.consumable = true; - Item.width = 16; - Item.height = 16; Item.maxStack = 9999; } diff --git a/Items/Placeables/Acidwood.cs b/Items/Placeables/Acidwood.cs index 63aedc46c9..e507a7fec4 100644 --- a/Items/Placeables/Acidwood.cs +++ b/Items/Placeables/Acidwood.cs @@ -1,8 +1,8 @@ using CalamityMod.Items.Placeables.FurnitureAcidwood; +using CalamityMod.Items.Placeables.Walls; using CalamityMod.Tiles.Abyss; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Items.Placeables.Walls; namespace CalamityMod.Items.Placeables { @@ -29,10 +29,10 @@ namespace CalamityMod.Items.Placeables Item.createTile = ModContent.TileType(); } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.Wood; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.Wood; + } public override void AddRecipes() { diff --git a/Items/Placeables/AstralClay.cs b/Items/Placeables/AstralClay.cs index fc99c0e2fb..3cb89b4062 100644 --- a/Items/Placeables/AstralClay.cs +++ b/Items/Placeables/AstralClay.cs @@ -13,6 +13,8 @@ namespace CalamityMod.Items.Placeables public override void SetDefaults() { + Item.width = 16; + Item.height = 16; Item.createTile = ModContent.TileType(); Item.useStyle = ItemUseStyleID.Swing; Item.useTurn = true; @@ -20,8 +22,6 @@ namespace CalamityMod.Items.Placeables Item.useTime = 10; Item.autoReuse = true; Item.consumable = true; - Item.width = 16; - Item.height = 16; Item.maxStack = 9999; } } diff --git a/Items/Placeables/AstralDirt.cs b/Items/Placeables/AstralDirt.cs index a19890fb0c..e182fd3bbf 100644 --- a/Items/Placeables/AstralDirt.cs +++ b/Items/Placeables/AstralDirt.cs @@ -1,6 +1,6 @@ using CalamityMod.Items.Placeables.Walls; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables { @@ -14,6 +14,8 @@ namespace CalamityMod.Items.Placeables public override void SetDefaults() { + Item.width = 16; + Item.height = 16; Item.createTile = ModContent.TileType(); Item.useStyle = ItemUseStyleID.Swing; Item.useTurn = true; @@ -21,8 +23,6 @@ namespace CalamityMod.Items.Placeables Item.useTime = 10; Item.autoReuse = true; Item.consumable = true; - Item.width = 16; - Item.height = 16; Item.maxStack = 9999; } diff --git a/Items/Placeables/AstralGrassSeeds.cs b/Items/Placeables/AstralGrassSeeds.cs index 9dc4ab533a..a4a7907b77 100644 --- a/Items/Placeables/AstralGrassSeeds.cs +++ b/Items/Placeables/AstralGrassSeeds.cs @@ -1,8 +1,8 @@ using Terraria; +using Terraria.Audio; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Items.Placeables { @@ -10,37 +10,37 @@ namespace CalamityMod.Items.Placeables { public new string LocalizationCategory => "Items.Placeables"; public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 25; - } + { + Item.ResearchUnlockCount = 25; + } - public override void SetDefaults() - { - Item.useTurn = true; - Item.autoReuse = true; - Item.consumable = true; + public override void SetDefaults() + { Item.width = 16; - Item.height = 16; - Item.useTime = 10; - Item.useAnimation = 15; - Item.useStyle = ItemUseStyleID.Swing; - Item.maxStack = 9999; - } + Item.height = 16; + Item.useTurn = true; + Item.autoReuse = true; + Item.consumable = true; + Item.useTime = 10; + Item.useAnimation = 15; + Item.useStyle = ItemUseStyleID.Swing; + Item.maxStack = 9999; + } public override bool? UseItem(Player player) - { - Tile tile = Framing.GetTileSafely(Player.tileTargetX, Player.tileTargetY); - - if (tile.HasTile && tile.TileType == ModContent.TileType() && player.IsInTileInteractionRange(Player.tileTargetX, Player.tileTargetY, TileReachCheckSettings.Simple)) - { - Main.tile[Player.tileTargetX, Player.tileTargetY].TileType = (ushort)ModContent.TileType(); + { + Tile tile = Framing.GetTileSafely(Player.tileTargetX, Player.tileTargetY); - SoundEngine.PlaySound(SoundID.Dig, player.Center); + if (tile.HasTile && tile.TileType == ModContent.TileType() && player.IsInTileInteractionRange(Player.tileTargetX, Player.tileTargetY, TileReachCheckSettings.Simple)) + { + Main.tile[Player.tileTargetX, Player.tileTargetY].TileType = (ushort)ModContent.TileType(); - return true; - } + SoundEngine.PlaySound(SoundID.Dig, player.Center); - return false; - } + return true; + } + + return false; + } } } diff --git a/Items/Placeables/AstralIce.cs b/Items/Placeables/AstralIce.cs index 7026f63b56..608a38ae5d 100644 --- a/Items/Placeables/AstralIce.cs +++ b/Items/Placeables/AstralIce.cs @@ -1,6 +1,6 @@ using CalamityMod.Items.Placeables.Walls; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables { @@ -15,6 +15,8 @@ namespace CalamityMod.Items.Placeables public override void SetDefaults() { + Item.width = 16; + Item.height = 16; Item.createTile = ModContent.TileType(); Item.useStyle = ItemUseStyleID.Swing; Item.useTurn = true; @@ -22,8 +24,6 @@ namespace CalamityMod.Items.Placeables Item.useTime = 10; Item.autoReuse = true; Item.consumable = true; - Item.width = 16; - Item.height = 16; Item.maxStack = 9999; } diff --git a/Items/Placeables/AstralMonolith.cs b/Items/Placeables/AstralMonolith.cs index 14a8c0d441..dad285ae29 100644 --- a/Items/Placeables/AstralMonolith.cs +++ b/Items/Placeables/AstralMonolith.cs @@ -28,11 +28,11 @@ namespace CalamityMod.Items.Placeables Item.createTile = ModContent.TileType(); } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - // It's not really wood... but it comes from trees! - itemGroup = ContentSamples.CreativeHelper.ItemGroup.Wood; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + // It's not really wood... but it comes from trees! + itemGroup = ContentSamples.CreativeHelper.ItemGroup.Wood; + } public override void AddRecipes() { diff --git a/Items/Placeables/AstralSand.cs b/Items/Placeables/AstralSand.cs index f2ad9b633a..2a2e4f9987 100644 --- a/Items/Placeables/AstralSand.cs +++ b/Items/Placeables/AstralSand.cs @@ -10,6 +10,9 @@ namespace CalamityMod.Items.Placeables public override void SetStaticDefaults() { Item.ResearchUnlockCount = 100; + + // +5 flat damage, equal to other sand variants + ItemID.Sets.SandgunAmmoProjectileData[Type] = new(ModContent.ProjectileType(), 5); } public override void SetDefaults() diff --git a/Items/Placeables/AstralSandstone.cs b/Items/Placeables/AstralSandstone.cs index fdd8a7cc00..2537e7510e 100644 --- a/Items/Placeables/AstralSandstone.cs +++ b/Items/Placeables/AstralSandstone.cs @@ -1,6 +1,6 @@ using CalamityMod.Items.Placeables.Walls; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables { @@ -15,6 +15,8 @@ namespace CalamityMod.Items.Placeables public override void SetDefaults() { + Item.width = 16; + Item.height = 16; Item.createTile = ModContent.TileType(); Item.useStyle = ItemUseStyleID.Swing; Item.useTurn = true; @@ -22,8 +24,6 @@ namespace CalamityMod.Items.Placeables Item.useTime = 10; Item.autoReuse = true; Item.consumable = true; - Item.width = 16; - Item.height = 16; Item.maxStack = 9999; } diff --git a/Items/Placeables/AstralSnow.cs b/Items/Placeables/AstralSnow.cs index d67fd073a6..1da3544eb5 100644 --- a/Items/Placeables/AstralSnow.cs +++ b/Items/Placeables/AstralSnow.cs @@ -1,6 +1,6 @@ using CalamityMod.Items.Placeables.Walls; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables { @@ -14,6 +14,8 @@ namespace CalamityMod.Items.Placeables public override void SetDefaults() { + Item.width = 16; + Item.height = 16; Item.createTile = ModContent.TileType(); Item.useStyle = ItemUseStyleID.Swing; Item.useTurn = true; @@ -21,8 +23,6 @@ namespace CalamityMod.Items.Placeables Item.useTime = 10; Item.autoReuse = true; Item.consumable = true; - Item.width = 16; - Item.height = 16; Item.maxStack = 9999; } diff --git a/Items/Placeables/AstralStone.cs b/Items/Placeables/AstralStone.cs index f087a9f056..81e70c31ad 100644 --- a/Items/Placeables/AstralStone.cs +++ b/Items/Placeables/AstralStone.cs @@ -1,6 +1,6 @@ using CalamityMod.Items.Placeables.Walls; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables { @@ -14,6 +14,8 @@ namespace CalamityMod.Items.Placeables public override void SetDefaults() { + Item.width = 16; + Item.height = 16; Item.createTile = ModContent.TileType(); Item.useStyle = ItemUseStyleID.Swing; Item.useTurn = true; @@ -21,8 +23,6 @@ namespace CalamityMod.Items.Placeables Item.useTime = 10; Item.autoReuse = true; Item.consumable = true; - Item.width = 16; - Item.height = 16; Item.maxStack = 9999; } diff --git a/Items/Placeables/Banners/AcidEelBanner.cs b/Items/Placeables/Banners/AcidEelBanner.cs index 88fec4886e..0a3c76248c 100644 --- a/Items/Placeables/Banners/AcidEelBanner.cs +++ b/Items/Placeables/Banners/AcidEelBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class AcidEelBanner : BaseBanner { diff --git a/Items/Placeables/Banners/AeroSlimeBanner.cs b/Items/Placeables/Banners/AeroSlimeBanner.cs index b2778c5551..3500d82aaf 100644 --- a/Items/Placeables/Banners/AeroSlimeBanner.cs +++ b/Items/Placeables/Banners/AeroSlimeBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class AeroSlimeBanner : BaseBanner { diff --git a/Items/Placeables/Banners/AeroSlimeBanner.png b/Items/Placeables/Banners/AeroSlimeBanner.png index 319d6776a4..b964f3967a 100644 Binary files a/Items/Placeables/Banners/AeroSlimeBanner.png and b/Items/Placeables/Banners/AeroSlimeBanner.png differ diff --git a/Items/Placeables/Banners/AmberCrawlerBanner.cs b/Items/Placeables/Banners/AmberCrawlerBanner.cs index d11d224ce1..7c2d6ad0de 100644 --- a/Items/Placeables/Banners/AmberCrawlerBanner.cs +++ b/Items/Placeables/Banners/AmberCrawlerBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class AmberCrawlerBanner : BaseBanner { diff --git a/Items/Placeables/Banners/AmethystCrawlerBanner.cs b/Items/Placeables/Banners/AmethystCrawlerBanner.cs index 2c6614780d..0a4c3b551f 100644 --- a/Items/Placeables/Banners/AmethystCrawlerBanner.cs +++ b/Items/Placeables/Banners/AmethystCrawlerBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class AmethystCrawlerBanner : BaseBanner { diff --git a/Items/Placeables/Banners/AndroombaBanner.cs b/Items/Placeables/Banners/AndroombaBanner.cs index e6a042348c..8e78460db4 100644 --- a/Items/Placeables/Banners/AndroombaBanner.cs +++ b/Items/Placeables/Banners/AndroombaBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class AndroombaBanner : BaseBanner { diff --git a/Items/Placeables/Banners/AnthozoanCrabBanner.cs b/Items/Placeables/Banners/AnthozoanCrabBanner.cs index ef2e955fa7..007f95772f 100644 --- a/Items/Placeables/Banners/AnthozoanCrabBanner.cs +++ b/Items/Placeables/Banners/AnthozoanCrabBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class AnthozoanCrabBanner : BaseBanner { diff --git a/Items/Placeables/Banners/AquaticUrchinBanner.cs b/Items/Placeables/Banners/AquaticUrchinBanner.cs index 34644b80b4..43db4095ed 100644 --- a/Items/Placeables/Banners/AquaticUrchinBanner.cs +++ b/Items/Placeables/Banners/AquaticUrchinBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class AquaticUrchinBanner : BaseBanner { diff --git a/Items/Placeables/Banners/AriesBanner.cs b/Items/Placeables/Banners/AriesBanner.cs index 2997ae1a42..cd060d0fe7 100644 --- a/Items/Placeables/Banners/AriesBanner.cs +++ b/Items/Placeables/Banners/AriesBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class AriesBanner : BaseBanner { diff --git a/Items/Placeables/Banners/ArmoredDiggerBanner.cs b/Items/Placeables/Banners/ArmoredDiggerBanner.cs index b42b229429..f035d46d06 100644 --- a/Items/Placeables/Banners/ArmoredDiggerBanner.cs +++ b/Items/Placeables/Banners/ArmoredDiggerBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class ArmoredDiggerBanner : BaseBanner { diff --git a/Items/Placeables/Banners/AstralProbeBanner.cs b/Items/Placeables/Banners/AstralProbeBanner.cs index f56ea7bed2..6e126e7a2d 100644 --- a/Items/Placeables/Banners/AstralProbeBanner.cs +++ b/Items/Placeables/Banners/AstralProbeBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class AstralProbeBanner : BaseBanner { diff --git a/Items/Placeables/Banners/AstralSlimeBanner.cs b/Items/Placeables/Banners/AstralSlimeBanner.cs index 7165710f7c..cfcbb3a90c 100644 --- a/Items/Placeables/Banners/AstralSlimeBanner.cs +++ b/Items/Placeables/Banners/AstralSlimeBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class AstralSlimeBanner : BaseBanner { diff --git a/Items/Placeables/Banners/AstralachneaBanner.cs b/Items/Placeables/Banners/AstralachneaBanner.cs index 2a7aeac6bc..e3ff7751c3 100644 --- a/Items/Placeables/Banners/AstralachneaBanner.cs +++ b/Items/Placeables/Banners/AstralachneaBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class AstralachneaBanner : BaseBanner { diff --git a/Items/Placeables/Banners/AtlasBanner.cs b/Items/Placeables/Banners/AtlasBanner.cs index b5133603d3..c9682642b2 100644 --- a/Items/Placeables/Banners/AtlasBanner.cs +++ b/Items/Placeables/Banners/AtlasBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class AtlasBanner : BaseBanner { diff --git a/Items/Placeables/Banners/BelchingCoralBanner.cs b/Items/Placeables/Banners/BelchingCoralBanner.cs index 04e7ee3528..0a81b83312 100644 --- a/Items/Placeables/Banners/BelchingCoralBanner.cs +++ b/Items/Placeables/Banners/BelchingCoralBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class BelchingCoralBanner : BaseBanner { diff --git a/Items/Placeables/Banners/BlindedAnglerBanner.cs b/Items/Placeables/Banners/BlindedAnglerBanner.cs index cbfae4a6f7..a8cd03e747 100644 --- a/Items/Placeables/Banners/BlindedAnglerBanner.cs +++ b/Items/Placeables/Banners/BlindedAnglerBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class BlindedAnglerBanner : BaseBanner { diff --git a/Items/Placeables/Banners/BloatfishBanner.cs b/Items/Placeables/Banners/BloatfishBanner.cs index 6dfd772f21..f6730c6d4f 100644 --- a/Items/Placeables/Banners/BloatfishBanner.cs +++ b/Items/Placeables/Banners/BloatfishBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class BloatfishBanner : BaseBanner { diff --git a/Items/Placeables/Banners/BloomSlimeBanner.cs b/Items/Placeables/Banners/BloomSlimeBanner.cs index 1b287446aa..806dbdf37f 100644 --- a/Items/Placeables/Banners/BloomSlimeBanner.cs +++ b/Items/Placeables/Banners/BloomSlimeBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class BloomSlimeBanner : BaseBanner { diff --git a/Items/Placeables/Banners/BloomSlimeBanner.png b/Items/Placeables/Banners/BloomSlimeBanner.png index de0f083e77..f7357ea95b 100644 Binary files a/Items/Placeables/Banners/BloomSlimeBanner.png and b/Items/Placeables/Banners/BloomSlimeBanner.png differ diff --git a/Items/Placeables/Banners/BobbitWormBanner.cs b/Items/Placeables/Banners/BobbitWormBanner.cs index 1657f39dc1..95d220c5c4 100644 --- a/Items/Placeables/Banners/BobbitWormBanner.cs +++ b/Items/Placeables/Banners/BobbitWormBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class BobbitWormBanner : BaseBanner { diff --git a/Items/Placeables/Banners/BoxJellyfishBanner.cs b/Items/Placeables/Banners/BoxJellyfishBanner.cs index be2bd4fa84..4aac6abbfa 100644 --- a/Items/Placeables/Banners/BoxJellyfishBanner.cs +++ b/Items/Placeables/Banners/BoxJellyfishBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class BoxJellyfishBanner : BaseBanner { diff --git a/Items/Placeables/Banners/CalamityEyeBanner.cs b/Items/Placeables/Banners/CalamityEyeBanner.cs index a57a132962..6632891ab5 100644 --- a/Items/Placeables/Banners/CalamityEyeBanner.cs +++ b/Items/Placeables/Banners/CalamityEyeBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class CalamityEyeBanner : BaseBanner { diff --git a/Items/Placeables/Banners/CannonballJellyfishBanner.cs b/Items/Placeables/Banners/CannonballJellyfishBanner.cs index 076c6562ec..cba2c7e60c 100644 --- a/Items/Placeables/Banners/CannonballJellyfishBanner.cs +++ b/Items/Placeables/Banners/CannonballJellyfishBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class CannonballJellyfishBanner : BaseBanner { diff --git a/Items/Placeables/Banners/ChaoticPufferBanner.cs b/Items/Placeables/Banners/ChaoticPufferBanner.cs index 545753bf8a..19c4339adc 100644 --- a/Items/Placeables/Banners/ChaoticPufferBanner.cs +++ b/Items/Placeables/Banners/ChaoticPufferBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class ChaoticPufferBanner : BaseBanner { diff --git a/Items/Placeables/Banners/ClamBanner.cs b/Items/Placeables/Banners/ClamBanner.cs index 9cc5faa89d..6208ace8d5 100644 --- a/Items/Placeables/Banners/ClamBanner.cs +++ b/Items/Placeables/Banners/ClamBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class ClamBanner : BaseBanner { diff --git a/Items/Placeables/Banners/CloudElementalBanner.cs b/Items/Placeables/Banners/CloudElementalBanner.cs index 5e3d31df33..13658a57c7 100644 --- a/Items/Placeables/Banners/CloudElementalBanner.cs +++ b/Items/Placeables/Banners/CloudElementalBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class CloudElementalBanner : BaseBanner { diff --git a/Items/Placeables/Banners/CnidrionBanner.cs b/Items/Placeables/Banners/CnidrionBanner.cs index bcae4f4e2b..a62b861244 100644 --- a/Items/Placeables/Banners/CnidrionBanner.cs +++ b/Items/Placeables/Banners/CnidrionBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class CnidrionBanner : BaseBanner { diff --git a/Items/Placeables/Banners/ColossalSquidBanner.cs b/Items/Placeables/Banners/ColossalSquidBanner.cs index f87154aa5b..51242f4c9c 100644 --- a/Items/Placeables/Banners/ColossalSquidBanner.cs +++ b/Items/Placeables/Banners/ColossalSquidBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class ColossalSquidBanner : BaseBanner { diff --git a/Items/Placeables/Banners/CrimulanBlightSlimeBanner.cs b/Items/Placeables/Banners/CrimulanBlightSlimeBanner.cs index e89f70d8ff..2e0234872e 100644 --- a/Items/Placeables/Banners/CrimulanBlightSlimeBanner.cs +++ b/Items/Placeables/Banners/CrimulanBlightSlimeBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class CrimulanBlightSlimeBanner : BaseBanner { diff --git a/Items/Placeables/Banners/CrimulanBlightSlimeBanner.png b/Items/Placeables/Banners/CrimulanBlightSlimeBanner.png index 27628c35db..0416ee0d51 100644 Binary files a/Items/Placeables/Banners/CrimulanBlightSlimeBanner.png and b/Items/Placeables/Banners/CrimulanBlightSlimeBanner.png differ diff --git a/Items/Placeables/Banners/CryoSlimeBanner.cs b/Items/Placeables/Banners/CryoSlimeBanner.cs index 07b40b1347..debc8e8ce4 100644 --- a/Items/Placeables/Banners/CryoSlimeBanner.cs +++ b/Items/Placeables/Banners/CryoSlimeBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class CryoSlimeBanner : BaseBanner { diff --git a/Items/Placeables/Banners/CryonBanner.cs b/Items/Placeables/Banners/CryonBanner.cs index 7ed674cc43..cf32bfc46b 100644 --- a/Items/Placeables/Banners/CryonBanner.cs +++ b/Items/Placeables/Banners/CryonBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class CryonBanner : BaseBanner { diff --git a/Items/Placeables/Banners/CrystalCrawlerBanner.cs b/Items/Placeables/Banners/CrystalCrawlerBanner.cs index 64712d869f..ce17e06f93 100644 --- a/Items/Placeables/Banners/CrystalCrawlerBanner.cs +++ b/Items/Placeables/Banners/CrystalCrawlerBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class CrystalCrawlerBanner : BaseBanner { diff --git a/Items/Placeables/Banners/CrystalCrawlerBanner.png b/Items/Placeables/Banners/CrystalCrawlerBanner.png index a5b7b0b99c..26dde78749 100644 Binary files a/Items/Placeables/Banners/CrystalCrawlerBanner.png and b/Items/Placeables/Banners/CrystalCrawlerBanner.png differ diff --git a/Items/Placeables/Banners/CuttlefishBanner.cs b/Items/Placeables/Banners/CuttlefishBanner.cs index e403d42215..3127ffddc2 100644 --- a/Items/Placeables/Banners/CuttlefishBanner.cs +++ b/Items/Placeables/Banners/CuttlefishBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class CuttlefishBanner : BaseBanner { diff --git a/Items/Placeables/Banners/DespairStoneBanner.cs b/Items/Placeables/Banners/DespairStoneBanner.cs index e483776e11..f4ea7e5ab1 100644 --- a/Items/Placeables/Banners/DespairStoneBanner.cs +++ b/Items/Placeables/Banners/DespairStoneBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class DespairStoneBanner : BaseBanner { diff --git a/Items/Placeables/Banners/DevilFishBanner.cs b/Items/Placeables/Banners/DevilFishBanner.cs index e7ea2f6e86..a63f5db704 100644 --- a/Items/Placeables/Banners/DevilFishBanner.cs +++ b/Items/Placeables/Banners/DevilFishBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class DevilFishBanner : BaseBanner { diff --git a/Items/Placeables/Banners/DiamondCrawlerBanner.cs b/Items/Placeables/Banners/DiamondCrawlerBanner.cs index 3e430b778f..9512813a9e 100644 --- a/Items/Placeables/Banners/DiamondCrawlerBanner.cs +++ b/Items/Placeables/Banners/DiamondCrawlerBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class DiamondCrawlerBanner : BaseBanner { diff --git a/Items/Placeables/Banners/EarthElementalBanner.cs b/Items/Placeables/Banners/EarthElementalBanner.cs index 5be6e71eb5..730167f7b9 100644 --- a/Items/Placeables/Banners/EarthElementalBanner.cs +++ b/Items/Placeables/Banners/EarthElementalBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class EarthElementalBanner : BaseBanner { diff --git a/Items/Placeables/Banners/EbonianBlightSlimeBanner.cs b/Items/Placeables/Banners/EbonianBlightSlimeBanner.cs index a1f16713e8..ce4d914080 100644 --- a/Items/Placeables/Banners/EbonianBlightSlimeBanner.cs +++ b/Items/Placeables/Banners/EbonianBlightSlimeBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class EbonianBlightSlimeBanner : BaseBanner { diff --git a/Items/Placeables/Banners/EidolistBanner.cs b/Items/Placeables/Banners/EidolistBanner.cs index 0f5c7041cc..2010e2670f 100644 --- a/Items/Placeables/Banners/EidolistBanner.cs +++ b/Items/Placeables/Banners/EidolistBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class EidolistBanner : BaseBanner { diff --git a/Items/Placeables/Banners/EidolonWyrmJuvenileBanner.cs b/Items/Placeables/Banners/EidolonWyrmJuvenileBanner.cs index 20d5216297..92b349741a 100644 --- a/Items/Placeables/Banners/EidolonWyrmJuvenileBanner.cs +++ b/Items/Placeables/Banners/EidolonWyrmJuvenileBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class EidolonWyrmJuvenileBanner : BaseBanner { diff --git a/Items/Placeables/Banners/EmeraldCrawlerBanner.cs b/Items/Placeables/Banners/EmeraldCrawlerBanner.cs index fbedac9a21..9f1da1fd2d 100644 --- a/Items/Placeables/Banners/EmeraldCrawlerBanner.cs +++ b/Items/Placeables/Banners/EmeraldCrawlerBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class EmeraldCrawlerBanner : BaseBanner { diff --git a/Items/Placeables/Banners/EutrophicRayBanner.cs b/Items/Placeables/Banners/EutrophicRayBanner.cs index 1cb16ed146..ee3cbcd7ba 100644 --- a/Items/Placeables/Banners/EutrophicRayBanner.cs +++ b/Items/Placeables/Banners/EutrophicRayBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class EutrophicRayBanner : BaseBanner { diff --git a/Items/Placeables/Banners/FearlessGoldfishWarriorBanner.cs b/Items/Placeables/Banners/FearlessGoldfishWarriorBanner.cs index 235dab2f63..d9dd54cde4 100644 --- a/Items/Placeables/Banners/FearlessGoldfishWarriorBanner.cs +++ b/Items/Placeables/Banners/FearlessGoldfishWarriorBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class FearlessGoldfishWarriorBanner : BaseBanner { diff --git a/Items/Placeables/Banners/FlakCrabBanner.cs b/Items/Placeables/Banners/FlakCrabBanner.cs index 6dca9f6e8a..13ef6f8c48 100644 --- a/Items/Placeables/Banners/FlakCrabBanner.cs +++ b/Items/Placeables/Banners/FlakCrabBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class FlakCrabBanner : BaseBanner { diff --git a/Items/Placeables/Banners/FrogfishBanner.cs b/Items/Placeables/Banners/FrogfishBanner.cs index 5fdaeb9edd..a17cb7d65f 100644 --- a/Items/Placeables/Banners/FrogfishBanner.cs +++ b/Items/Placeables/Banners/FrogfishBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class FrogfishBanner : BaseBanner { diff --git a/Items/Placeables/Banners/FusionFeederBanner.cs b/Items/Placeables/Banners/FusionFeederBanner.cs index a388eb7079..810a66e1e9 100644 --- a/Items/Placeables/Banners/FusionFeederBanner.cs +++ b/Items/Placeables/Banners/FusionFeederBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class FusionFeederBanner : BaseBanner { diff --git a/Items/Placeables/Banners/GhostBellBanner.cs b/Items/Placeables/Banners/GhostBellBanner.cs index 3580c316f5..6262547ad9 100644 --- a/Items/Placeables/Banners/GhostBellBanner.cs +++ b/Items/Placeables/Banners/GhostBellBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class GhostBellBanner : BaseBanner { diff --git a/Items/Placeables/Banners/GiantSquidBanner.cs b/Items/Placeables/Banners/GiantSquidBanner.cs index 546633c414..48bd35c849 100644 --- a/Items/Placeables/Banners/GiantSquidBanner.cs +++ b/Items/Placeables/Banners/GiantSquidBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class GiantSquidBanner : BaseBanner { diff --git a/Items/Placeables/Banners/GnasherBanner.cs b/Items/Placeables/Banners/GnasherBanner.cs index 1c73a009a0..670a9b3eee 100644 --- a/Items/Placeables/Banners/GnasherBanner.cs +++ b/Items/Placeables/Banners/GnasherBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class GnasherBanner : BaseBanner { diff --git a/Items/Placeables/Banners/GulperEelBanner.cs b/Items/Placeables/Banners/GulperEelBanner.cs index 4fb18f7a78..85cd792ee5 100644 --- a/Items/Placeables/Banners/GulperEelBanner.cs +++ b/Items/Placeables/Banners/GulperEelBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class GulperEelBanner : BaseBanner { diff --git a/Items/Placeables/Banners/HadarianBanner.cs b/Items/Placeables/Banners/HadarianBanner.cs index de5da60d16..7d3b4cf4f9 100644 --- a/Items/Placeables/Banners/HadarianBanner.cs +++ b/Items/Placeables/Banners/HadarianBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class HadarianBanner : BaseBanner { diff --git a/Items/Placeables/Banners/HeatSpiritBanner.cs b/Items/Placeables/Banners/HeatSpiritBanner.cs index a93490a350..29c87d32d6 100644 --- a/Items/Placeables/Banners/HeatSpiritBanner.cs +++ b/Items/Placeables/Banners/HeatSpiritBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class HeatSpiritBanner : BaseBanner { diff --git a/Items/Placeables/Banners/HiveBanner.cs b/Items/Placeables/Banners/HiveBanner.cs index 8779150576..ccacb8cf92 100644 --- a/Items/Placeables/Banners/HiveBanner.cs +++ b/Items/Placeables/Banners/HiveBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class HiveBanner : BaseBanner { diff --git a/Items/Placeables/Banners/IceClasperBanner.cs b/Items/Placeables/Banners/IceClasperBanner.cs index 397b3a748f..db51caac38 100644 --- a/Items/Placeables/Banners/IceClasperBanner.cs +++ b/Items/Placeables/Banners/IceClasperBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class IceClasperBanner : BaseBanner { diff --git a/Items/Placeables/Banners/ImpiousImmolatorBanner.cs b/Items/Placeables/Banners/ImpiousImmolatorBanner.cs index 439fd9fd84..7801174f85 100644 --- a/Items/Placeables/Banners/ImpiousImmolatorBanner.cs +++ b/Items/Placeables/Banners/ImpiousImmolatorBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class ImpiousImmolatorBanner : BaseBanner { diff --git a/Items/Placeables/Banners/InfernalCongealmentBanner.cs b/Items/Placeables/Banners/InfernalCongealmentBanner.cs index 4a664f9147..14f2d76de8 100644 --- a/Items/Placeables/Banners/InfernalCongealmentBanner.cs +++ b/Items/Placeables/Banners/InfernalCongealmentBanner.cs @@ -1,4 +1,4 @@ -using Terraria.ModLoader; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { diff --git a/Items/Placeables/Banners/InfernalCongealmentBanner.png b/Items/Placeables/Banners/InfernalCongealmentBanner.png index cd27ab325c..bcfc7f2aa7 100644 Binary files a/Items/Placeables/Banners/InfernalCongealmentBanner.png and b/Items/Placeables/Banners/InfernalCongealmentBanner.png differ diff --git a/Items/Placeables/Banners/IrradiatedSlimeBanner.cs b/Items/Placeables/Banners/IrradiatedSlimeBanner.cs index 7e8706976e..cbc5908d82 100644 --- a/Items/Placeables/Banners/IrradiatedSlimeBanner.cs +++ b/Items/Placeables/Banners/IrradiatedSlimeBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class IrradiatedSlimeBanner : BaseBanner { diff --git a/Items/Placeables/Banners/LaserfishBanner.cs b/Items/Placeables/Banners/LaserfishBanner.cs index 2aea209960..b69d2b75f9 100644 --- a/Items/Placeables/Banners/LaserfishBanner.cs +++ b/Items/Placeables/Banners/LaserfishBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class LaserfishBanner : BaseBanner { diff --git a/Items/Placeables/Banners/LuminousCorvinaBanner.cs b/Items/Placeables/Banners/LuminousCorvinaBanner.cs index 6fc1a63669..3059d88d6b 100644 --- a/Items/Placeables/Banners/LuminousCorvinaBanner.cs +++ b/Items/Placeables/Banners/LuminousCorvinaBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class LuminousCorvinaBanner : BaseBanner { diff --git a/Items/Placeables/Banners/MantisBanner.cs b/Items/Placeables/Banners/MantisBanner.cs index 56dbd20cbb..d260d7e8a5 100644 --- a/Items/Placeables/Banners/MantisBanner.cs +++ b/Items/Placeables/Banners/MantisBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class MantisBanner : BaseBanner { diff --git a/Items/Placeables/Banners/MantisShrimpBanner.cs b/Items/Placeables/Banners/MantisShrimpBanner.cs index 831071d51f..37885af785 100644 --- a/Items/Placeables/Banners/MantisShrimpBanner.cs +++ b/Items/Placeables/Banners/MantisShrimpBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class MantisShrimpBanner : BaseBanner { diff --git a/Items/Placeables/Banners/MelterBanner.cs b/Items/Placeables/Banners/MelterBanner.cs index 9deadb816a..d198399687 100644 --- a/Items/Placeables/Banners/MelterBanner.cs +++ b/Items/Placeables/Banners/MelterBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class MelterBanner : BaseBanner { diff --git a/Items/Placeables/Banners/MirageJellyBanner.cs b/Items/Placeables/Banners/MirageJellyBanner.cs index 37e5a3bfdf..19d68a9fdb 100644 --- a/Items/Placeables/Banners/MirageJellyBanner.cs +++ b/Items/Placeables/Banners/MirageJellyBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class MirageJellyBanner : BaseBanner { diff --git a/Items/Placeables/Banners/MorayEelBanner.cs b/Items/Placeables/Banners/MorayEelBanner.cs index cc825ead47..bce818da5e 100644 --- a/Items/Placeables/Banners/MorayEelBanner.cs +++ b/Items/Placeables/Banners/MorayEelBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class MorayEelBanner : BaseBanner { diff --git a/Items/Placeables/Banners/NovaBanner.cs b/Items/Placeables/Banners/NovaBanner.cs index 4688fe2502..ed68ceb2b5 100644 --- a/Items/Placeables/Banners/NovaBanner.cs +++ b/Items/Placeables/Banners/NovaBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class NovaBanner : BaseBanner { diff --git a/Items/Placeables/Banners/NuclearToadBanner.cs b/Items/Placeables/Banners/NuclearToadBanner.cs index abb9af36b8..4888c85ecd 100644 --- a/Items/Placeables/Banners/NuclearToadBanner.cs +++ b/Items/Placeables/Banners/NuclearToadBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class NuclearToadBanner : BaseBanner { diff --git a/Items/Placeables/Banners/OarfishBanner.cs b/Items/Placeables/Banners/OarfishBanner.cs index 27bf834584..0e833ad6e5 100644 --- a/Items/Placeables/Banners/OarfishBanner.cs +++ b/Items/Placeables/Banners/OarfishBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class OarfishBanner : BaseBanner { diff --git a/Items/Placeables/Banners/OrthoceraBanner.cs b/Items/Placeables/Banners/OrthoceraBanner.cs index 6c7ee9f2ec..1eeec63d4c 100644 --- a/Items/Placeables/Banners/OrthoceraBanner.cs +++ b/Items/Placeables/Banners/OrthoceraBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class OrthoceraBanner : BaseBanner { diff --git a/Items/Placeables/Banners/OverloadedSoldierBanner.cs b/Items/Placeables/Banners/OverloadedSoldierBanner.cs index c0e4c0e528..101c6c636c 100644 --- a/Items/Placeables/Banners/OverloadedSoldierBanner.cs +++ b/Items/Placeables/Banners/OverloadedSoldierBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class OverloadedSoldierBanner : BaseBanner { diff --git a/Items/Placeables/Banners/PerennialSlimeBanner.cs b/Items/Placeables/Banners/PerennialSlimeBanner.cs index 5d4ff61be9..72293006e5 100644 --- a/Items/Placeables/Banners/PerennialSlimeBanner.cs +++ b/Items/Placeables/Banners/PerennialSlimeBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class PerennialSlimeBanner : BaseBanner { diff --git a/Items/Placeables/Banners/PestilentSlimeBanner.cs b/Items/Placeables/Banners/PestilentSlimeBanner.cs index c88c530456..3303d474f0 100644 --- a/Items/Placeables/Banners/PestilentSlimeBanner.cs +++ b/Items/Placeables/Banners/PestilentSlimeBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class PestilentSlimeBanner : BaseBanner { diff --git a/Items/Placeables/Banners/PhantomSpiritBanner.cs b/Items/Placeables/Banners/PhantomSpiritBanner.cs index bdc338e7b8..fa3bd1b836 100644 --- a/Items/Placeables/Banners/PhantomSpiritBanner.cs +++ b/Items/Placeables/Banners/PhantomSpiritBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class PhantomSpiritBanner : BaseBanner { diff --git a/Items/Placeables/Banners/PiggyBanner.cs b/Items/Placeables/Banners/PiggyBanner.cs index 7c89cef6cd..8b71b95bec 100644 --- a/Items/Placeables/Banners/PiggyBanner.cs +++ b/Items/Placeables/Banners/PiggyBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class PiggyBanner : BaseBanner { diff --git a/Items/Placeables/Banners/PlagueChargerBanner.cs b/Items/Placeables/Banners/PlagueChargerBanner.cs index cf3c2dbe88..de3d737f9a 100644 --- a/Items/Placeables/Banners/PlagueChargerBanner.cs +++ b/Items/Placeables/Banners/PlagueChargerBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class PlagueChargerBanner : BaseBanner { diff --git a/Items/Placeables/Banners/PlaguebringerBanner.cs b/Items/Placeables/Banners/PlaguebringerBanner.cs index ff750653f7..407c235710 100644 --- a/Items/Placeables/Banners/PlaguebringerBanner.cs +++ b/Items/Placeables/Banners/PlaguebringerBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class PlaguebringerBanner : BaseBanner { diff --git a/Items/Placeables/Banners/PlagueshellBanner.cs b/Items/Placeables/Banners/PlagueshellBanner.cs index 46c1e9046f..1ee3198904 100644 --- a/Items/Placeables/Banners/PlagueshellBanner.cs +++ b/Items/Placeables/Banners/PlagueshellBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class PlagueshellBanner : BaseBanner { diff --git a/Items/Placeables/Banners/ProfanedEnergyBanner.cs b/Items/Placeables/Banners/ProfanedEnergyBanner.cs index 60592f72cc..032d65aa3c 100644 --- a/Items/Placeables/Banners/ProfanedEnergyBanner.cs +++ b/Items/Placeables/Banners/ProfanedEnergyBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class ProfanedEnergyBanner : BaseBanner { diff --git a/Items/Placeables/Banners/RadiatorBanner.cs b/Items/Placeables/Banners/RadiatorBanner.cs index 98f9b98409..45e27a79bb 100644 --- a/Items/Placeables/Banners/RadiatorBanner.cs +++ b/Items/Placeables/Banners/RadiatorBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class RadiatorBanner : BaseBanner { diff --git a/Items/Placeables/Banners/ReaperSharkBanner.cs b/Items/Placeables/Banners/ReaperSharkBanner.cs index ff8163cfec..b02c759751 100644 --- a/Items/Placeables/Banners/ReaperSharkBanner.cs +++ b/Items/Placeables/Banners/ReaperSharkBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class ReaperSharkBanner : BaseBanner { diff --git a/Items/Placeables/Banners/RenegadeWarlockBanner.cs b/Items/Placeables/Banners/RenegadeWarlockBanner.cs index daa64176f7..b5f6f2b2a2 100644 --- a/Items/Placeables/Banners/RenegadeWarlockBanner.cs +++ b/Items/Placeables/Banners/RenegadeWarlockBanner.cs @@ -1,4 +1,4 @@ -using Terraria.ModLoader; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { diff --git a/Items/Placeables/Banners/RepairUnitBanner.cs b/Items/Placeables/Banners/RepairUnitBanner.cs index 54a24799fd..d4a18217e7 100644 --- a/Items/Placeables/Banners/RepairUnitBanner.cs +++ b/Items/Placeables/Banners/RepairUnitBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class RepairUnitBanner : BaseBanner { diff --git a/Items/Placeables/Banners/RotdogBanner.png b/Items/Placeables/Banners/RotdogBanner.png index 9e55ae8946..ea89ac5f16 100644 Binary files a/Items/Placeables/Banners/RotdogBanner.png and b/Items/Placeables/Banners/RotdogBanner.png differ diff --git a/Items/Placeables/Banners/RubyCrawlerBanner.cs b/Items/Placeables/Banners/RubyCrawlerBanner.cs index 09151a5d2e..e8d49cdb55 100644 --- a/Items/Placeables/Banners/RubyCrawlerBanner.cs +++ b/Items/Placeables/Banners/RubyCrawlerBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class RubyCrawlerBanner : BaseBanner { diff --git a/Items/Placeables/Banners/SapphireCrawlerBanner.cs b/Items/Placeables/Banners/SapphireCrawlerBanner.cs index 8cd671a452..ef4a47c06d 100644 --- a/Items/Placeables/Banners/SapphireCrawlerBanner.cs +++ b/Items/Placeables/Banners/SapphireCrawlerBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class SapphireCrawlerBanner : BaseBanner { diff --git a/Items/Placeables/Banners/ScornEaterBanner.cs b/Items/Placeables/Banners/ScornEaterBanner.cs index 8d93b9d7bb..32be0602b9 100644 --- a/Items/Placeables/Banners/ScornEaterBanner.cs +++ b/Items/Placeables/Banners/ScornEaterBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class ScornEaterBanner : BaseBanner { diff --git a/Items/Placeables/Banners/ScryllarBanner.cs b/Items/Placeables/Banners/ScryllarBanner.cs index da67c30519..e6086feb95 100644 --- a/Items/Placeables/Banners/ScryllarBanner.cs +++ b/Items/Placeables/Banners/ScryllarBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class ScryllarBanner : BaseBanner { diff --git a/Items/Placeables/Banners/SeaFloatyBanner.cs b/Items/Placeables/Banners/SeaFloatyBanner.cs index cbe0e4cf4a..8d56921b47 100644 --- a/Items/Placeables/Banners/SeaFloatyBanner.cs +++ b/Items/Placeables/Banners/SeaFloatyBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class SeaFloatyBanner : BaseBanner { diff --git a/Items/Placeables/Banners/SeaMinnowBanner.cs b/Items/Placeables/Banners/SeaMinnowBanner.cs index b4290524a0..2a8e192664 100644 --- a/Items/Placeables/Banners/SeaMinnowBanner.cs +++ b/Items/Placeables/Banners/SeaMinnowBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class SeaMinnowBanner : BaseBanner { diff --git a/Items/Placeables/Banners/SeaSerpentBanner.cs b/Items/Placeables/Banners/SeaSerpentBanner.cs index 5b9b87cfe0..ef12cc3ebc 100644 --- a/Items/Placeables/Banners/SeaSerpentBanner.cs +++ b/Items/Placeables/Banners/SeaSerpentBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class SeaSerpentBanner : BaseBanner { diff --git a/Items/Placeables/Banners/SeaUrchinBanner.cs b/Items/Placeables/Banners/SeaUrchinBanner.cs index a410711090..ea66b3e083 100644 --- a/Items/Placeables/Banners/SeaUrchinBanner.cs +++ b/Items/Placeables/Banners/SeaUrchinBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class SeaUrchinBanner : BaseBanner { diff --git a/Items/Placeables/Banners/ShockstormShuttleBanner.cs b/Items/Placeables/Banners/ShockstormShuttleBanner.cs index 3792cd65fb..85829f87ba 100644 --- a/Items/Placeables/Banners/ShockstormShuttleBanner.cs +++ b/Items/Placeables/Banners/ShockstormShuttleBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class ShockstormShuttleBanner : BaseBanner { diff --git a/Items/Placeables/Banners/SightseerColliderBanner.cs b/Items/Placeables/Banners/SightseerColliderBanner.cs index fba3258cac..a161f9a719 100644 --- a/Items/Placeables/Banners/SightseerColliderBanner.cs +++ b/Items/Placeables/Banners/SightseerColliderBanner.cs @@ -1,4 +1,4 @@ -using Terraria.ModLoader; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { diff --git a/Items/Placeables/Banners/SightseerSpitterBanner.cs b/Items/Placeables/Banners/SightseerSpitterBanner.cs index b9a451260e..f2c2182ca7 100644 --- a/Items/Placeables/Banners/SightseerSpitterBanner.cs +++ b/Items/Placeables/Banners/SightseerSpitterBanner.cs @@ -1,4 +1,4 @@ -using Terraria.ModLoader; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { diff --git a/Items/Placeables/Banners/SkyfinBanner.cs b/Items/Placeables/Banners/SkyfinBanner.cs index 93a15dcd5d..16b4b9cf5a 100644 --- a/Items/Placeables/Banners/SkyfinBanner.cs +++ b/Items/Placeables/Banners/SkyfinBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class SkyfinBanner : BaseBanner { diff --git a/Items/Placeables/Banners/SlabCrabBanner.cs b/Items/Placeables/Banners/SlabCrabBanner.cs new file mode 100644 index 0000000000..55579a31c3 --- /dev/null +++ b/Items/Placeables/Banners/SlabCrabBanner.cs @@ -0,0 +1,7 @@ +namespace CalamityMod.Items.Placeables.Banners +{ + public class SlabCrabBanner : BaseBanner + { + public override int BannerTileStyle => 5; + } +} diff --git a/Items/Placeables/Banners/SlabCrabBanner.png b/Items/Placeables/Banners/SlabCrabBanner.png new file mode 100644 index 0000000000..225fe1fc01 Binary files /dev/null and b/Items/Placeables/Banners/SlabCrabBanner.png differ diff --git a/Items/Placeables/Banners/SoulSluperBanner.cs b/Items/Placeables/Banners/SoulSluperBanner.cs index 1e0e988d38..701a372d78 100644 --- a/Items/Placeables/Banners/SoulSluperBanner.cs +++ b/Items/Placeables/Banners/SoulSluperBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class SoulSlurperBanner : BaseBanner { diff --git a/Items/Placeables/Banners/StellarCulexBanner.cs b/Items/Placeables/Banners/StellarCulexBanner.cs index bcf834ae1d..371b032896 100644 --- a/Items/Placeables/Banners/StellarCulexBanner.cs +++ b/Items/Placeables/Banners/StellarCulexBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class StellarCulexBanner : BaseBanner { diff --git a/Items/Placeables/Banners/StormlionBanner.cs b/Items/Placeables/Banners/StormlionBanner.cs index 3bec7011c7..6070c0fd30 100644 --- a/Items/Placeables/Banners/StormlionBanner.cs +++ b/Items/Placeables/Banners/StormlionBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class StormlionBanner : BaseBanner { diff --git a/Items/Placeables/Banners/SunskaterBanner.cs b/Items/Placeables/Banners/SunskaterBanner.cs index 1021713861..fce54dbcd4 100644 --- a/Items/Placeables/Banners/SunskaterBanner.cs +++ b/Items/Placeables/Banners/SunskaterBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class SunskaterBanner : BaseBanner { diff --git a/Items/Placeables/Banners/TopazCrawlerBanner.cs b/Items/Placeables/Banners/TopazCrawlerBanner.cs index cb0a05aeac..c8daeeb070 100644 --- a/Items/Placeables/Banners/TopazCrawlerBanner.cs +++ b/Items/Placeables/Banners/TopazCrawlerBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class TopazCrawlerBanner : BaseBanner { diff --git a/Items/Placeables/Banners/ToxicMinnowBanner.cs b/Items/Placeables/Banners/ToxicMinnowBanner.cs index e18ff9f968..b73170a4d3 100644 --- a/Items/Placeables/Banners/ToxicMinnowBanner.cs +++ b/Items/Placeables/Banners/ToxicMinnowBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class ToxicMinnowBanner : BaseBanner { diff --git a/Items/Placeables/Banners/TrasherBanner.cs b/Items/Placeables/Banners/TrasherBanner.cs index 0d76f17878..b89c3da943 100644 --- a/Items/Placeables/Banners/TrasherBanner.cs +++ b/Items/Placeables/Banners/TrasherBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class TrasherBanner : BaseBanner { diff --git a/Items/Placeables/Banners/TrilobiteBanner.cs b/Items/Placeables/Banners/TrilobiteBanner.cs index a753f8643f..30dc8d7e85 100644 --- a/Items/Placeables/Banners/TrilobiteBanner.cs +++ b/Items/Placeables/Banners/TrilobiteBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class TrilobiteBanner : BaseBanner { diff --git a/Items/Placeables/Banners/ViperfishBanner.cs b/Items/Placeables/Banners/ViperfishBanner.cs index 83c5d43309..655d01209a 100644 --- a/Items/Placeables/Banners/ViperfishBanner.cs +++ b/Items/Placeables/Banners/ViperfishBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class ViperfishBanner : BaseBanner { diff --git a/Items/Placeables/Banners/VirulingBanner.cs b/Items/Placeables/Banners/VirulingBanner.cs index 6a9c576ac4..5752b8ba5a 100644 --- a/Items/Placeables/Banners/VirulingBanner.cs +++ b/Items/Placeables/Banners/VirulingBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class VirulingBanner : BaseBanner { diff --git a/Items/Placeables/Banners/WulfrumAmplifierBanner.cs b/Items/Placeables/Banners/WulfrumAmplifierBanner.cs index a34084c7d2..203946b01f 100644 --- a/Items/Placeables/Banners/WulfrumAmplifierBanner.cs +++ b/Items/Placeables/Banners/WulfrumAmplifierBanner.cs @@ -1,4 +1,4 @@ -using Terraria.ModLoader; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { diff --git a/Items/Placeables/Banners/WulfrumDroneBanner.cs b/Items/Placeables/Banners/WulfrumDroneBanner.cs index 0b2c47d062..b9e0d15b54 100644 --- a/Items/Placeables/Banners/WulfrumDroneBanner.cs +++ b/Items/Placeables/Banners/WulfrumDroneBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class WulfrumDroneBanner : BaseBanner { diff --git a/Items/Placeables/Banners/WulfrumGyratorBanner.cs b/Items/Placeables/Banners/WulfrumGyratorBanner.cs index f9bb6078e7..f6dc624d86 100644 --- a/Items/Placeables/Banners/WulfrumGyratorBanner.cs +++ b/Items/Placeables/Banners/WulfrumGyratorBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class WulfrumGyratorBanner : BaseBanner { diff --git a/Items/Placeables/Banners/WulfrumHovercraftBanner.cs b/Items/Placeables/Banners/WulfrumHovercraftBanner.cs index 87c5873bd0..b4f6f649a5 100644 --- a/Items/Placeables/Banners/WulfrumHovercraftBanner.cs +++ b/Items/Placeables/Banners/WulfrumHovercraftBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class WulfrumHovercraftBanner : BaseBanner { diff --git a/Items/Placeables/Banners/WulfrumRoverBanner.cs b/Items/Placeables/Banners/WulfrumRoverBanner.cs index 2fb6eb3606..1606c4c795 100644 --- a/Items/Placeables/Banners/WulfrumRoverBanner.cs +++ b/Items/Placeables/Banners/WulfrumRoverBanner.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Banners { public class WulfrumRoverBanner : BaseBanner { diff --git a/Items/Placeables/BaseTiles/BaseBanner.cs b/Items/Placeables/BaseTiles/BaseBanner.cs index 33e9def6c3..ad75a29691 100644 --- a/Items/Placeables/BaseTiles/BaseBanner.cs +++ b/Items/Placeables/BaseTiles/BaseBanner.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles; +using CalamityMod.Tiles; using Terraria; using Terraria.ID; using Terraria.Localization; diff --git a/Items/Placeables/BrimstoneSlag.cs b/Items/Placeables/BrimstoneSlag.cs index 39201214b6..9f5e1ab97a 100644 --- a/Items/Placeables/BrimstoneSlag.cs +++ b/Items/Placeables/BrimstoneSlag.cs @@ -14,6 +14,8 @@ namespace CalamityMod.Items.Placeables public override void SetDefaults() { + Item.width = 13; + Item.height = 10; Item.createTile = ModContent.TileType(); Item.useStyle = ItemUseStyleID.Swing; Item.useTurn = true; @@ -21,8 +23,6 @@ namespace CalamityMod.Items.Placeables Item.useTime = 10; Item.autoReuse = true; Item.consumable = true; - Item.width = 13; - Item.height = 10; Item.maxStack = 9999; Item.value = 1000; } diff --git a/Items/Placeables/CelestialRemains.cs b/Items/Placeables/CelestialRemains.cs index 33ba920df3..c597021aad 100644 --- a/Items/Placeables/CelestialRemains.cs +++ b/Items/Placeables/CelestialRemains.cs @@ -13,11 +13,13 @@ namespace CalamityMod.Items.Placeables public override void SetStaticDefaults() { Item.ResearchUnlockCount = 200; - ItemID.Sets.SortingPriorityExtractibles[Type] = 3; // Desert Fossil + ItemID.Sets.SortingPriorityExtractibles[Type] = 3; // Desert Fossil } public override void SetDefaults() { + Item.width = 16; + Item.height = 16; ItemID.Sets.ExtractinatorMode[Item.type] = Item.type; Item.createTile = ModContent.TileType(); Item.useStyle = ItemUseStyleID.Swing; @@ -26,8 +28,6 @@ namespace CalamityMod.Items.Placeables Item.useTime = 10; Item.autoReuse = true; Item.consumable = true; - Item.width = 16; - Item.height = 16; Item.maxStack = 9999; } @@ -82,7 +82,7 @@ namespace CalamityMod.Items.Placeables } else if (val < 68.03f) { - resultType = ModContent.ItemType(); + resultType = ModContent.ItemType(); resultStack = Main.rand.Next(1, 11); } else if (val < 69.03f) diff --git a/Items/Placeables/CinderBlossomSeeds.cs b/Items/Placeables/CinderBlossomSeeds.cs index df4fb3f62b..769af80d4f 100644 --- a/Items/Placeables/CinderBlossomSeeds.cs +++ b/Items/Placeables/CinderBlossomSeeds.cs @@ -1,8 +1,8 @@ using Terraria; +using Terraria.Audio; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Items.Placeables { @@ -10,38 +10,38 @@ namespace CalamityMod.Items.Placeables { public new string LocalizationCategory => "Items.Placeables"; public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 25; - } + { + Item.ResearchUnlockCount = 25; + } - public override void SetDefaults() - { - Item.useTurn = true; - Item.autoReuse = true; - Item.consumable = true; + public override void SetDefaults() + { Item.width = 16; - Item.height = 16; - Item.useTime = 10; - Item.useAnimation = 15; - Item.useStyle = ItemUseStyleID.Swing; - Item.maxStack = 9999; - } + Item.height = 16; + Item.useTurn = true; + Item.autoReuse = true; + Item.consumable = true; + Item.useTime = 10; + Item.useAnimation = 15; + Item.useStyle = ItemUseStyleID.Swing; + Item.maxStack = 9999; + } public override bool? UseItem(Player player) - { - Tile tile = Framing.GetTileSafely(Player.tileTargetX, Player.tileTargetY); - Tile tileAbove = Framing.GetTileSafely(Player.tileTargetX, Player.tileTargetY - 1); - - if (tile.HasTile && !tileAbove.HasTile && tileAbove.LiquidAmount == 0 && tile.TileType == ModContent.TileType() && player.IsInTileInteractionRange(Player.tileTargetX, Player.tileTargetY, TileReachCheckSettings.Simple)) - { - Main.tile[Player.tileTargetX, Player.tileTargetY].TileType = (ushort)ModContent.TileType(); + { + Tile tile = Framing.GetTileSafely(Player.tileTargetX, Player.tileTargetY); + Tile tileAbove = Framing.GetTileSafely(Player.tileTargetX, Player.tileTargetY - 1); - SoundEngine.PlaySound(SoundID.Dig, player.Center); + if (tile.HasTile && !tileAbove.HasTile && tileAbove.LiquidAmount == 0 && tile.TileType == ModContent.TileType() && player.IsInTileInteractionRange(Player.tileTargetX, Player.tileTargetY, TileReachCheckSettings.Simple)) + { + Main.tile[Player.tileTargetX, Player.tileTargetY].TileType = (ushort)ModContent.TileType(); - return true; - } + SoundEngine.PlaySound(SoundID.Dig, player.Center); - return false; - } + return true; + } + + return false; + } } } diff --git a/Items/Placeables/DraedonStructures/AgedLaboratoryConsoleItem.cs b/Items/Placeables/DraedonStructures/AgedLaboratoryConsoleItem.cs index 5cab1510c4..0604c1ddbf 100644 --- a/Items/Placeables/DraedonStructures/AgedLaboratoryConsoleItem.cs +++ b/Items/Placeables/DraedonStructures/AgedLaboratoryConsoleItem.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.DraedonMisc; +using CalamityMod.Items.DraedonMisc; using CalamityMod.Items.Materials; using CalamityMod.Tiles.DraedonStructures; using Terraria.ID; diff --git a/Items/Placeables/DraedonStructures/AgedLaboratoryContainmentBoxItem.cs b/Items/Placeables/DraedonStructures/AgedLaboratoryContainmentBoxItem.cs index 21ede212d1..aee6927c2b 100644 --- a/Items/Placeables/DraedonStructures/AgedLaboratoryContainmentBoxItem.cs +++ b/Items/Placeables/DraedonStructures/AgedLaboratoryContainmentBoxItem.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Tiles.DraedonStructures; using Terraria.ID; using Terraria.ModLoader; diff --git a/Items/Placeables/DraedonStructures/AgedLaboratoryDisplayItem.cs b/Items/Placeables/DraedonStructures/AgedLaboratoryDisplayItem.cs index f6140ceaa3..c190137e4d 100644 --- a/Items/Placeables/DraedonStructures/AgedLaboratoryDisplayItem.cs +++ b/Items/Placeables/DraedonStructures/AgedLaboratoryDisplayItem.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Tiles.DraedonStructures; using Terraria.ID; using Terraria.ModLoader; diff --git a/Items/Placeables/DraedonStructures/AgedLaboratoryDoorItem.cs b/Items/Placeables/DraedonStructures/AgedLaboratoryDoorItem.cs index d1211b83e6..6b6e9fccf6 100644 --- a/Items/Placeables/DraedonStructures/AgedLaboratoryDoorItem.cs +++ b/Items/Placeables/DraedonStructures/AgedLaboratoryDoorItem.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Rarities; using CalamityMod.Tiles.DraedonStructures; using Terraria.ID; diff --git a/Items/Placeables/DraedonStructures/AgedLaboratoryScreenItem.cs b/Items/Placeables/DraedonStructures/AgedLaboratoryScreenItem.cs index ff1f5715f5..974ec83b61 100644 --- a/Items/Placeables/DraedonStructures/AgedLaboratoryScreenItem.cs +++ b/Items/Placeables/DraedonStructures/AgedLaboratoryScreenItem.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Tiles.DraedonStructures; using Terraria.ID; using Terraria.ModLoader; diff --git a/Items/Placeables/DraedonStructures/AgedLaboratoryServerItem.cs b/Items/Placeables/DraedonStructures/AgedLaboratoryServerItem.cs index b303c563cc..00c63cb85f 100644 --- a/Items/Placeables/DraedonStructures/AgedLaboratoryServerItem.cs +++ b/Items/Placeables/DraedonStructures/AgedLaboratoryServerItem.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.DraedonMisc; +using CalamityMod.Items.DraedonMisc; using CalamityMod.Items.Materials; using CalamityMod.Tiles.DraedonStructures; using Terraria.ID; diff --git a/Items/Placeables/DraedonStructures/AgedLaboratoryTerminalItem.cs b/Items/Placeables/DraedonStructures/AgedLaboratoryTerminalItem.cs index b887531a84..630222369e 100644 --- a/Items/Placeables/DraedonStructures/AgedLaboratoryTerminalItem.cs +++ b/Items/Placeables/DraedonStructures/AgedLaboratoryTerminalItem.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Tiles.DraedonStructures; using Terraria.ID; using Terraria.ModLoader; diff --git a/Items/Placeables/DraedonStructures/AgedReinforcedCrateItem.cs b/Items/Placeables/DraedonStructures/AgedReinforcedCrateItem.cs index 8ee9b84358..3d0c857aca 100644 --- a/Items/Placeables/DraedonStructures/AgedReinforcedCrateItem.cs +++ b/Items/Placeables/DraedonStructures/AgedReinforcedCrateItem.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Tiles.DraedonStructures; using Terraria.ID; using Terraria.ModLoader; diff --git a/Items/Placeables/DraedonStructures/ChargingStationItem.cs b/Items/Placeables/DraedonStructures/ChargingStationItem.cs index bd71be73f6..c78d2704b4 100644 --- a/Items/Placeables/DraedonStructures/ChargingStationItem.cs +++ b/Items/Placeables/DraedonStructures/ChargingStationItem.cs @@ -1,4 +1,4 @@ -using CalamityMod.Rarities; +using CalamityMod.Rarities; using CalamityMod.Tiles.DraedonStructures; using Terraria; using Terraria.ID; diff --git a/Items/Placeables/DraedonStructures/LabHologramProjectorItem.cs b/Items/Placeables/DraedonStructures/LabHologramProjectorItem.cs index e500dd70c5..60339f5bf4 100644 --- a/Items/Placeables/DraedonStructures/LabHologramProjectorItem.cs +++ b/Items/Placeables/DraedonStructures/LabHologramProjectorItem.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.DraedonMisc; +using CalamityMod.Items.DraedonMisc; using CalamityMod.Items.Materials; using CalamityMod.Rarities; using CalamityMod.Tiles.DraedonStructures; diff --git a/Items/Placeables/DraedonStructures/LaboratoryConsoleItem.cs b/Items/Placeables/DraedonStructures/LaboratoryConsoleItem.cs index d7ca8ffb20..7cfb4c4ec8 100644 --- a/Items/Placeables/DraedonStructures/LaboratoryConsoleItem.cs +++ b/Items/Placeables/DraedonStructures/LaboratoryConsoleItem.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.DraedonMisc; +using CalamityMod.Items.DraedonMisc; using CalamityMod.Items.Materials; using CalamityMod.Tiles.DraedonStructures; using Terraria.ID; diff --git a/Items/Placeables/DraedonStructures/LaboratoryContainmentBoxItem.cs b/Items/Placeables/DraedonStructures/LaboratoryContainmentBoxItem.cs index 2c4770240b..de0bec606d 100644 --- a/Items/Placeables/DraedonStructures/LaboratoryContainmentBoxItem.cs +++ b/Items/Placeables/DraedonStructures/LaboratoryContainmentBoxItem.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Tiles.DraedonStructures; using Terraria.ID; using Terraria.ModLoader; diff --git a/Items/Placeables/DraedonStructures/LaboratoryDisplayItem.cs b/Items/Placeables/DraedonStructures/LaboratoryDisplayItem.cs index 11b230952d..1a6be8f2f7 100644 --- a/Items/Placeables/DraedonStructures/LaboratoryDisplayItem.cs +++ b/Items/Placeables/DraedonStructures/LaboratoryDisplayItem.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Tiles.DraedonStructures; using Terraria.ID; using Terraria.ModLoader; diff --git a/Items/Placeables/DraedonStructures/LaboratoryDoorItem.cs b/Items/Placeables/DraedonStructures/LaboratoryDoorItem.cs index 89d96a5c81..5df83b46ac 100644 --- a/Items/Placeables/DraedonStructures/LaboratoryDoorItem.cs +++ b/Items/Placeables/DraedonStructures/LaboratoryDoorItem.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Rarities; using CalamityMod.Tiles.DraedonStructures; using Terraria.ID; diff --git a/Items/Placeables/DraedonStructures/LaboratoryPipePlating.cs b/Items/Placeables/DraedonStructures/LaboratoryPipePlating.cs index a829057c22..3241e0f293 100644 --- a/Items/Placeables/DraedonStructures/LaboratoryPipePlating.cs +++ b/Items/Placeables/DraedonStructures/LaboratoryPipePlating.cs @@ -1,4 +1,4 @@ -using Terraria.ID; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.DraedonStructures { diff --git a/Items/Placeables/DraedonStructures/LaboratoryScreenItem.cs b/Items/Placeables/DraedonStructures/LaboratoryScreenItem.cs index 777dc72b79..350647a132 100644 --- a/Items/Placeables/DraedonStructures/LaboratoryScreenItem.cs +++ b/Items/Placeables/DraedonStructures/LaboratoryScreenItem.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Tiles.DraedonStructures; using Terraria.ID; using Terraria.ModLoader; diff --git a/Items/Placeables/DraedonStructures/LaboratoryServerItem.cs b/Items/Placeables/DraedonStructures/LaboratoryServerItem.cs index 533e194f16..6568a5f044 100644 --- a/Items/Placeables/DraedonStructures/LaboratoryServerItem.cs +++ b/Items/Placeables/DraedonStructures/LaboratoryServerItem.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.DraedonMisc; +using CalamityMod.Items.DraedonMisc; using CalamityMod.Items.Materials; using CalamityMod.Tiles.DraedonStructures; using Terraria.ID; diff --git a/Items/Placeables/DraedonStructures/LaboratoryTerminalItem.cs b/Items/Placeables/DraedonStructures/LaboratoryTerminalItem.cs index 71e0da18ec..b54be8aed6 100644 --- a/Items/Placeables/DraedonStructures/LaboratoryTerminalItem.cs +++ b/Items/Placeables/DraedonStructures/LaboratoryTerminalItem.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Tiles.DraedonStructures; using Terraria.ID; using Terraria.ModLoader; diff --git a/Items/Placeables/DraedonStructures/PowerCellFactoryItem.cs b/Items/Placeables/DraedonStructures/PowerCellFactoryItem.cs index 9bd982db2d..835fccf8ad 100644 --- a/Items/Placeables/DraedonStructures/PowerCellFactoryItem.cs +++ b/Items/Placeables/DraedonStructures/PowerCellFactoryItem.cs @@ -1,4 +1,4 @@ -using CalamityMod.Rarities; +using CalamityMod.Rarities; using CalamityMod.Tiles.DraedonStructures; using Terraria; using Terraria.ID; diff --git a/Items/Placeables/DraedonStructures/ReinforcedCrateItem.cs b/Items/Placeables/DraedonStructures/ReinforcedCrateItem.cs index aaa9a38cc5..ae4b228a37 100644 --- a/Items/Placeables/DraedonStructures/ReinforcedCrateItem.cs +++ b/Items/Placeables/DraedonStructures/ReinforcedCrateItem.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Tiles.DraedonStructures; using Terraria.ID; using Terraria.ModLoader; diff --git a/Items/Placeables/EutrophicGlass.cs b/Items/Placeables/EutrophicGlass.cs index 7702b5ecd2..126ed8ebde 100644 --- a/Items/Placeables/EutrophicGlass.cs +++ b/Items/Placeables/EutrophicGlass.cs @@ -14,9 +14,9 @@ namespace CalamityMod.Items.Placeables public override void SetDefaults() { - Item.createTile = ModContent.TileType(); Item.width = 12; Item.height = 12; + Item.createTile = ModContent.TileType(); Item.maxStack = 9999; Item.useTurn = true; Item.autoReuse = true; diff --git a/Items/Placeables/EutrophicSand.cs b/Items/Placeables/EutrophicSand.cs index 25b1db4512..202584c1e0 100644 --- a/Items/Placeables/EutrophicSand.cs +++ b/Items/Placeables/EutrophicSand.cs @@ -1,8 +1,8 @@ using CalamityMod.Items.Placeables.Walls; using CalamityMod.Projectiles.Typeless; using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables { @@ -13,6 +13,9 @@ namespace CalamityMod.Items.Placeables { Item.ResearchUnlockCount = 100; ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + + // +5 flat damage, equal to other sand variants + ItemID.Sets.SandgunAmmoProjectileData[Type] = new(ModContent.ProjectileType(), 5); } public override void SetDefaults() diff --git a/Items/Placeables/Furniture/AlgalPrismTorch.cs b/Items/Placeables/Furniture/AlgalPrismTorch.cs index 9c97230936..7780704a03 100644 --- a/Items/Placeables/Furniture/AlgalPrismTorch.cs +++ b/Items/Placeables/Furniture/AlgalPrismTorch.cs @@ -11,9 +11,9 @@ namespace CalamityMod.Items.Placeables.Furniture public override void SetStaticDefaults() { Item.ResearchUnlockCount = 100; - ItemID.Sets.Torches[Item.type] = true; - ItemID.Sets.SingleUseInGamepad[Type] = true; - ItemID.Sets.WaterTorches[Item.type] = true; + ItemID.Sets.Torches[Item.type] = true; + ItemID.Sets.SingleUseInGamepad[Type] = true; + ItemID.Sets.WaterTorches[Item.type] = true; ItemID.Sets.ShimmerTransformToItem[Type] = ItemID.ShimmerTorch; } @@ -39,7 +39,7 @@ namespace CalamityMod.Items.Placeables.Furniture { if (Main.rand.NextBool(player.itemAnimation > 0 ? 10 : 20)) { - Dust.NewDust(new Vector2(player.itemLocation.X + 16f * player.direction, player.itemLocation.Y - 14f * player.gravDir), 4, 4, 68); + Dust.NewDust(new Vector2(player.itemLocation.X + 16f * player.direction, player.itemLocation.Y - 14f * player.gravDir), 4, 4, DustID.BlueCrystalShard); } Vector2 position = player.RotatedRelativePoint(new Vector2(player.itemLocation.X + 12f * player.direction + player.velocity.X, player.itemLocation.Y - 14f + player.velocity.Y), true); Lighting.AddLight(position, 0.7f, 1.2f, 0.9f); diff --git a/Items/Placeables/Furniture/AstralBeaconItem.cs b/Items/Placeables/Furniture/AstralBeaconItem.cs index b37df3c66a..0abe100357 100644 --- a/Items/Placeables/Furniture/AstralBeaconItem.cs +++ b/Items/Placeables/Furniture/AstralBeaconItem.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Items.Potions; using CalamityMod.Tiles.Astral; using Terraria.ID; @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Placeables.Furniture { CreateRecipe(). AddIngredient(5). - AddIngredient(20). + AddIngredient(20). AddIngredient(30). AddTile(TileID.LunarCraftingStation). Register(); diff --git a/Items/Placeables/Furniture/AstralChest.cs b/Items/Placeables/Furniture/AstralChest.cs index 256cc1b6d3..a57eec1816 100644 --- a/Items/Placeables/Furniture/AstralChest.cs +++ b/Items/Placeables/Furniture/AstralChest.cs @@ -1,6 +1,6 @@ -using CalamityMod.Tiles.Astral; -using Terraria.ModLoader; +using CalamityMod.Tiles.Astral; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture { diff --git a/Items/Placeables/Furniture/AstralTorch.cs b/Items/Placeables/Furniture/AstralTorch.cs index 78580acbd3..4a537b11e8 100644 --- a/Items/Placeables/Furniture/AstralTorch.cs +++ b/Items/Placeables/Furniture/AstralTorch.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Placeables.Furniture public override void SetStaticDefaults() { Item.ResearchUnlockCount = 100; - ItemID.Sets.Torches[Item.type] = true; + ItemID.Sets.Torches[Item.type] = true; ItemID.Sets.SingleUseInGamepad[Type] = true; ItemID.Sets.ShimmerTransformToItem[Type] = ItemID.ShimmerTorch; } @@ -44,7 +44,7 @@ namespace CalamityMod.Items.Placeables.Furniture Dust.NewDust(new Vector2(player.itemLocation.X + 16f * player.direction, player.itemLocation.Y - 14f * player.gravDir), 4, 4, ModContent.DustType()); } Vector2 position = player.RotatedRelativePoint(new Vector2(player.itemLocation.X + 12f * player.direction + player.velocity.X, player.itemLocation.Y - 14f + player.velocity.Y), true); - + if (!killTorch) Lighting.AddLight(position, 1.6f, 0.6f, 0.3f); } @@ -59,7 +59,7 @@ namespace CalamityMod.Items.Placeables.Furniture { CreateRecipe(3). AddIngredient(ItemID.Torch, 3). - AddIngredient(). + AddIngredient(). Register(); } } diff --git a/Items/Placeables/Furniture/BabyCannonballJellyfishBowl.cs b/Items/Placeables/Furniture/BabyCannonballJellyfishBowl.cs index 330d3a64b7..3a0a0c8851 100644 --- a/Items/Placeables/Furniture/BabyCannonballJellyfishBowl.cs +++ b/Items/Placeables/Furniture/BabyCannonballJellyfishBowl.cs @@ -1,5 +1,5 @@ +using CalamityMod.Items.Critters; using CalamityMod.Tiles.Furniture; -using CalamityMod.Items.Critters; using Terraria.ID; using Terraria.ModLoader; diff --git a/Items/Placeables/Furniture/BabyFlakCrabCage.cs b/Items/Placeables/Furniture/BabyFlakCrabCage.cs index 7687be3d07..4968edfbc9 100644 --- a/Items/Placeables/Furniture/BabyFlakCrabCage.cs +++ b/Items/Placeables/Furniture/BabyFlakCrabCage.cs @@ -1,5 +1,5 @@ -using CalamityMod.Tiles.Furniture; -using CalamityMod.Items.Critters; +using CalamityMod.Items.Critters; +using CalamityMod.Tiles.Furniture; using Terraria.ID; using Terraria.ModLoader; diff --git a/Items/Placeables/Furniture/BabyGhostBellJar.cs b/Items/Placeables/Furniture/BabyGhostBellJar.cs index 9e568a8417..9f734f992e 100644 --- a/Items/Placeables/Furniture/BabyGhostBellJar.cs +++ b/Items/Placeables/Furniture/BabyGhostBellJar.cs @@ -1,5 +1,5 @@ +using CalamityMod.Items.Critters; using CalamityMod.Tiles.Furniture; -using CalamityMod.Items.Critters; using Terraria.ID; using Terraria.ModLoader; diff --git a/Items/Placeables/Furniture/BossRelics/AquaticScourgeRelic.cs b/Items/Placeables/Furniture/BossRelics/AquaticScourgeRelic.cs index 8eb3dfd148..88f007c386 100644 --- a/Items/Placeables/Furniture/BossRelics/AquaticScourgeRelic.cs +++ b/Items/Placeables/Furniture/BossRelics/AquaticScourgeRelic.cs @@ -4,21 +4,21 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.BossRelics { - public class AquaticScourgeRelic : ModItem, ILocalizedModType + public class AquaticScourgeRelic : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; - public override void SetDefaults() - { - // Vanilla has many useful methods like these, use them! This substitutes setting Item.createTile and Item.placeStyle aswell as setting a few values that are common across all placeable items - Item.DefaultToPlaceableTile(ModContent.TileType(), 0); + public override void SetDefaults() + { + // Vanilla has many useful methods like these, use them! This substitutes setting Item.createTile and Item.placeStyle aswell as setting a few values that are common across all placeable items + Item.DefaultToPlaceableTile(ModContent.TileType(), 0); - Item.width = 30; - Item.height = 40; - Item.maxStack = 9999; - Item.rare = ItemRarityID.Master; - Item.master = true; // This makes sure that "Master" displays in the tooltip, as the rarity only changes the item name color - Item.value = Item.buyPrice(0, 5); - } - } + Item.width = 30; + Item.height = 40; + Item.maxStack = 9999; + Item.rare = ItemRarityID.Master; + Item.master = true; // This makes sure that "Master" displays in the tooltip, as the rarity only changes the item name color + Item.value = Item.buyPrice(0, 5); + } + } } diff --git a/Items/Placeables/Furniture/BossRelics/AstrumAureusRelic.cs b/Items/Placeables/Furniture/BossRelics/AstrumAureusRelic.cs index 8a3c7e6078..e428f6325b 100644 --- a/Items/Placeables/Furniture/BossRelics/AstrumAureusRelic.cs +++ b/Items/Placeables/Furniture/BossRelics/AstrumAureusRelic.cs @@ -4,21 +4,21 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.BossRelics { - public class AstrumAureusRelic : ModItem, ILocalizedModType + public class AstrumAureusRelic : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; - public override void SetDefaults() - { - // Vanilla has many useful methods like these, use them! This substitutes setting Item.createTile and Item.placeStyle aswell as setting a few values that are common across all placeable items - Item.DefaultToPlaceableTile(ModContent.TileType(), 0); + public override void SetDefaults() + { + // Vanilla has many useful methods like these, use them! This substitutes setting Item.createTile and Item.placeStyle aswell as setting a few values that are common across all placeable items + Item.DefaultToPlaceableTile(ModContent.TileType(), 0); - Item.width = 30; - Item.height = 40; - Item.maxStack = 9999; - Item.rare = ItemRarityID.Master; - Item.master = true; // This makes sure that "Master" displays in the tooltip, as the rarity only changes the item name color - Item.value = Item.buyPrice(0, 5); - } - } + Item.width = 30; + Item.height = 40; + Item.maxStack = 9999; + Item.rare = ItemRarityID.Master; + Item.master = true; // This makes sure that "Master" displays in the tooltip, as the rarity only changes the item name color + Item.value = Item.buyPrice(0, 5); + } + } } diff --git a/Items/Placeables/Furniture/BossRelics/AstrumDeusRelic.cs b/Items/Placeables/Furniture/BossRelics/AstrumDeusRelic.cs index 92534dbed9..f10cc394e5 100644 --- a/Items/Placeables/Furniture/BossRelics/AstrumDeusRelic.cs +++ b/Items/Placeables/Furniture/BossRelics/AstrumDeusRelic.cs @@ -4,21 +4,21 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.BossRelics { - public class AstrumDeusRelic : ModItem, ILocalizedModType + public class AstrumDeusRelic : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; - public override void SetDefaults() - { - // Vanilla has many useful methods like these, use them! This substitutes setting Item.createTile and Item.placeStyle aswell as setting a few values that are common across all placeable items - Item.DefaultToPlaceableTile(ModContent.TileType(), 0); + public override void SetDefaults() + { + // Vanilla has many useful methods like these, use them! This substitutes setting Item.createTile and Item.placeStyle aswell as setting a few values that are common across all placeable items + Item.DefaultToPlaceableTile(ModContent.TileType(), 0); - Item.width = 30; - Item.height = 40; - Item.maxStack = 9999; - Item.rare = ItemRarityID.Master; - Item.master = true; // This makes sure that "Master" displays in the tooltip, as the rarity only changes the item name color - Item.value = Item.buyPrice(0, 5); - } - } + Item.width = 30; + Item.height = 40; + Item.maxStack = 9999; + Item.rare = ItemRarityID.Master; + Item.master = true; // This makes sure that "Master" displays in the tooltip, as the rarity only changes the item name color + Item.value = Item.buyPrice(0, 5); + } + } } diff --git a/Items/Placeables/Furniture/BossRelics/BrimstoneElementalRelic.cs b/Items/Placeables/Furniture/BossRelics/BrimstoneElementalRelic.cs index 27c257b0b5..ebc31f9375 100644 --- a/Items/Placeables/Furniture/BossRelics/BrimstoneElementalRelic.cs +++ b/Items/Placeables/Furniture/BossRelics/BrimstoneElementalRelic.cs @@ -4,21 +4,21 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.BossRelics { - public class BrimstoneElementalRelic : ModItem, ILocalizedModType + public class BrimstoneElementalRelic : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; - public override void SetDefaults() - { - // Vanilla has many useful methods like these, use them! This substitutes setting Item.createTile and Item.placeStyle aswell as setting a few values that are common across all placeable items - Item.DefaultToPlaceableTile(ModContent.TileType(), 0); + public override void SetDefaults() + { + // Vanilla has many useful methods like these, use them! This substitutes setting Item.createTile and Item.placeStyle aswell as setting a few values that are common across all placeable items + Item.DefaultToPlaceableTile(ModContent.TileType(), 0); - Item.width = 30; - Item.height = 40; - Item.maxStack = 9999; - Item.rare = ItemRarityID.Master; - Item.master = true; // This makes sure that "Master" displays in the tooltip, as the rarity only changes the item name color - Item.value = Item.buyPrice(0, 5); - } - } + Item.width = 30; + Item.height = 40; + Item.maxStack = 9999; + Item.rare = ItemRarityID.Master; + Item.master = true; // This makes sure that "Master" displays in the tooltip, as the rarity only changes the item name color + Item.value = Item.buyPrice(0, 5); + } + } } diff --git a/Items/Placeables/Furniture/BossRelics/CalamitasCloneRelic.cs b/Items/Placeables/Furniture/BossRelics/CalamitasCloneRelic.cs index 44d4fc82bf..1e6f5d4ff2 100644 --- a/Items/Placeables/Furniture/BossRelics/CalamitasCloneRelic.cs +++ b/Items/Placeables/Furniture/BossRelics/CalamitasCloneRelic.cs @@ -4,21 +4,21 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.BossRelics { - public class CalamitasCloneRelic : ModItem, ILocalizedModType + public class CalamitasCloneRelic : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; - public override void SetDefaults() - { - // Vanilla has many useful methods like these, use them! This substitutes setting Item.createTile and Item.placeStyle aswell as setting a few values that are common across all placeable items - Item.DefaultToPlaceableTile(ModContent.TileType(), 0); + public override void SetDefaults() + { + // Vanilla has many useful methods like these, use them! This substitutes setting Item.createTile and Item.placeStyle aswell as setting a few values that are common across all placeable items + Item.DefaultToPlaceableTile(ModContent.TileType(), 0); - Item.width = 30; - Item.height = 40; - Item.maxStack = 9999; - Item.rare = ItemRarityID.Master; - Item.master = true; // This makes sure that "Master" displays in the tooltip, as the rarity only changes the item name color - Item.value = Item.buyPrice(0, 5); - } - } + Item.width = 30; + Item.height = 40; + Item.maxStack = 9999; + Item.rare = ItemRarityID.Master; + Item.master = true; // This makes sure that "Master" displays in the tooltip, as the rarity only changes the item name color + Item.value = Item.buyPrice(0, 5); + } + } } diff --git a/Items/Placeables/Furniture/BossRelics/CalamitasRelic.cs b/Items/Placeables/Furniture/BossRelics/CalamitasRelic.cs index 455818c738..942f26888e 100644 --- a/Items/Placeables/Furniture/BossRelics/CalamitasRelic.cs +++ b/Items/Placeables/Furniture/BossRelics/CalamitasRelic.cs @@ -4,21 +4,21 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.BossRelics { - public class CalamitasRelic : ModItem, ILocalizedModType + public class CalamitasRelic : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; - public override void SetDefaults() - { - // Vanilla has many useful methods like these, use them! This substitutes setting Item.createTile and Item.placeStyle aswell as setting a few values that are common across all placeable items - Item.DefaultToPlaceableTile(ModContent.TileType(), 0); + public override void SetDefaults() + { + // Vanilla has many useful methods like these, use them! This substitutes setting Item.createTile and Item.placeStyle aswell as setting a few values that are common across all placeable items + Item.DefaultToPlaceableTile(ModContent.TileType(), 0); - Item.width = 30; - Item.height = 40; - Item.maxStack = 9999; - Item.rare = ItemRarityID.Master; - Item.master = true; // This makes sure that "Master" displays in the tooltip, as the rarity only changes the item name color - Item.value = Item.buyPrice(0, 5); - } - } + Item.width = 30; + Item.height = 40; + Item.maxStack = 9999; + Item.rare = ItemRarityID.Master; + Item.master = true; // This makes sure that "Master" displays in the tooltip, as the rarity only changes the item name color + Item.value = Item.buyPrice(0, 5); + } + } } diff --git a/Items/Placeables/Furniture/BossRelics/CeaselessVoidRelic.cs b/Items/Placeables/Furniture/BossRelics/CeaselessVoidRelic.cs index 6291ccbb28..97bf66f10b 100644 --- a/Items/Placeables/Furniture/BossRelics/CeaselessVoidRelic.cs +++ b/Items/Placeables/Furniture/BossRelics/CeaselessVoidRelic.cs @@ -4,21 +4,21 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.BossRelics { - public class CeaselessVoidRelic : ModItem, ILocalizedModType + public class CeaselessVoidRelic : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; - public override void SetDefaults() - { - // Vanilla has many useful methods like these, use them! This substitutes setting Item.createTile and Item.placeStyle aswell as setting a few values that are common across all placeable items - Item.DefaultToPlaceableTile(ModContent.TileType(), 0); + public override void SetDefaults() + { + // Vanilla has many useful methods like these, use them! This substitutes setting Item.createTile and Item.placeStyle aswell as setting a few values that are common across all placeable items + Item.DefaultToPlaceableTile(ModContent.TileType(), 0); - Item.width = 30; - Item.height = 40; - Item.maxStack = 9999; - Item.rare = ItemRarityID.Master; - Item.master = true; // This makes sure that "Master" displays in the tooltip, as the rarity only changes the item name color - Item.value = Item.buyPrice(0, 5); - } - } + Item.width = 30; + Item.height = 40; + Item.maxStack = 9999; + Item.rare = ItemRarityID.Master; + Item.master = true; // This makes sure that "Master" displays in the tooltip, as the rarity only changes the item name color + Item.value = Item.buyPrice(0, 5); + } + } } diff --git a/Items/Placeables/Furniture/BossRelics/CrabulonRelic.cs b/Items/Placeables/Furniture/BossRelics/CrabulonRelic.cs index 04875bfb45..e23af28dde 100644 --- a/Items/Placeables/Furniture/BossRelics/CrabulonRelic.cs +++ b/Items/Placeables/Furniture/BossRelics/CrabulonRelic.cs @@ -4,21 +4,21 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.BossRelics { - public class CrabulonRelic : ModItem, ILocalizedModType + public class CrabulonRelic : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; - public override void SetDefaults() - { - // Vanilla has many useful methods like these, use them! This substitutes setting Item.createTile and Item.placeStyle aswell as setting a few values that are common across all placeable items - Item.DefaultToPlaceableTile(ModContent.TileType(), 0); + public override void SetDefaults() + { + // Vanilla has many useful methods like these, use them! This substitutes setting Item.createTile and Item.placeStyle aswell as setting a few values that are common across all placeable items + Item.DefaultToPlaceableTile(ModContent.TileType(), 0); - Item.width = 30; - Item.height = 40; - Item.maxStack = 9999; - Item.rare = ItemRarityID.Master; - Item.master = true; // This makes sure that "Master" displays in the tooltip, as the rarity only changes the item name color - Item.value = Item.buyPrice(0, 5); - } - } + Item.width = 30; + Item.height = 40; + Item.maxStack = 9999; + Item.rare = ItemRarityID.Master; + Item.master = true; // This makes sure that "Master" displays in the tooltip, as the rarity only changes the item name color + Item.value = Item.buyPrice(0, 5); + } + } } diff --git a/Items/Placeables/Furniture/BossRelics/CragmawMireRelic.cs b/Items/Placeables/Furniture/BossRelics/CragmawMireRelic.cs index c3feedde5a..7e480b4b73 100644 --- a/Items/Placeables/Furniture/BossRelics/CragmawMireRelic.cs +++ b/Items/Placeables/Furniture/BossRelics/CragmawMireRelic.cs @@ -4,21 +4,21 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.BossRelics { - public class CragmawMireRelic : ModItem, ILocalizedModType + public class CragmawMireRelic : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; - public override void SetDefaults() - { - // Vanilla has many useful methods like these, use them! This substitutes setting Item.createTile and Item.placeStyle aswell as setting a few values that are common across all placeable items - Item.DefaultToPlaceableTile(ModContent.TileType(), 0); + public override void SetDefaults() + { + // Vanilla has many useful methods like these, use them! This substitutes setting Item.createTile and Item.placeStyle aswell as setting a few values that are common across all placeable items + Item.DefaultToPlaceableTile(ModContent.TileType(), 0); - Item.width = 30; - Item.height = 40; - Item.maxStack = 9999; - Item.rare = ItemRarityID.Master; - Item.master = true; // This makes sure that "Master" displays in the tooltip, as the rarity only changes the item name color - Item.value = Item.buyPrice(0, 5); - } - } + Item.width = 30; + Item.height = 40; + Item.maxStack = 9999; + Item.rare = ItemRarityID.Master; + Item.master = true; // This makes sure that "Master" displays in the tooltip, as the rarity only changes the item name color + Item.value = Item.buyPrice(0, 5); + } + } } diff --git a/Items/Placeables/Furniture/BossRelics/CryogenRelic.cs b/Items/Placeables/Furniture/BossRelics/CryogenRelic.cs index 42f79fbd4f..0d794beaab 100644 --- a/Items/Placeables/Furniture/BossRelics/CryogenRelic.cs +++ b/Items/Placeables/Furniture/BossRelics/CryogenRelic.cs @@ -4,21 +4,21 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.BossRelics { - public class CryogenRelic : ModItem, ILocalizedModType + public class CryogenRelic : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; - public override void SetDefaults() - { - // Vanilla has many useful methods like these, use them! This substitutes setting Item.createTile and Item.placeStyle aswell as setting a few values that are common across all placeable items - Item.DefaultToPlaceableTile(ModContent.TileType(), 0); + public override void SetDefaults() + { + // Vanilla has many useful methods like these, use them! This substitutes setting Item.createTile and Item.placeStyle aswell as setting a few values that are common across all placeable items + Item.DefaultToPlaceableTile(ModContent.TileType(), 0); - Item.width = 30; - Item.height = 40; - Item.maxStack = 9999; - Item.rare = ItemRarityID.Master; - Item.master = true; // This makes sure that "Master" displays in the tooltip, as the rarity only changes the item name color - Item.value = Item.buyPrice(0, 5); - } - } + Item.width = 30; + Item.height = 40; + Item.maxStack = 9999; + Item.rare = ItemRarityID.Master; + Item.master = true; // This makes sure that "Master" displays in the tooltip, as the rarity only changes the item name color + Item.value = Item.buyPrice(0, 5); + } + } } diff --git a/Items/Placeables/Furniture/BossRelics/DesertScourgeRelic.cs b/Items/Placeables/Furniture/BossRelics/DesertScourgeRelic.cs index 1106f5a495..794cda7d04 100644 --- a/Items/Placeables/Furniture/BossRelics/DesertScourgeRelic.cs +++ b/Items/Placeables/Furniture/BossRelics/DesertScourgeRelic.cs @@ -4,21 +4,21 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.BossRelics { - public class DesertScourgeRelic : ModItem, ILocalizedModType + public class DesertScourgeRelic : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; - public override void SetDefaults() - { - // Vanilla has many useful methods like these, use them! This substitutes setting Item.createTile and Item.placeStyle aswell as setting a few values that are common across all placeable items - Item.DefaultToPlaceableTile(ModContent.TileType(), 0); + public override void SetDefaults() + { + // Vanilla has many useful methods like these, use them! This substitutes setting Item.createTile and Item.placeStyle aswell as setting a few values that are common across all placeable items + Item.DefaultToPlaceableTile(ModContent.TileType(), 0); - Item.width = 30; - Item.height = 40; - Item.maxStack = 9999; - Item.rare = ItemRarityID.Master; - Item.master = true; // This makes sure that "Master" displays in the tooltip, as the rarity only changes the item name color - Item.value = Item.buyPrice(0, 5); - } - } + Item.width = 30; + Item.height = 40; + Item.maxStack = 9999; + Item.rare = ItemRarityID.Master; + Item.master = true; // This makes sure that "Master" displays in the tooltip, as the rarity only changes the item name color + Item.value = Item.buyPrice(0, 5); + } + } } diff --git a/Items/Placeables/Furniture/BossRelics/DesertScourgeRelic.png b/Items/Placeables/Furniture/BossRelics/DesertScourgeRelic.png index b4262db63f..89cc28f16f 100644 Binary files a/Items/Placeables/Furniture/BossRelics/DesertScourgeRelic.png and b/Items/Placeables/Furniture/BossRelics/DesertScourgeRelic.png differ diff --git a/Items/Placeables/Furniture/BossRelics/DevourerOfGodsRelic.cs b/Items/Placeables/Furniture/BossRelics/DevourerOfGodsRelic.cs index fbe4388572..43c919c1c8 100644 --- a/Items/Placeables/Furniture/BossRelics/DevourerOfGodsRelic.cs +++ b/Items/Placeables/Furniture/BossRelics/DevourerOfGodsRelic.cs @@ -4,21 +4,21 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.BossRelics { - public class DevourerOfGodsRelic : ModItem, ILocalizedModType + public class DevourerOfGodsRelic : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; - public override void SetDefaults() - { - // Vanilla has many useful methods like these, use them! This substitutes setting Item.createTile and Item.placeStyle aswell as setting a few values that are common across all placeable items - Item.DefaultToPlaceableTile(ModContent.TileType(), 0); + public override void SetDefaults() + { + // Vanilla has many useful methods like these, use them! This substitutes setting Item.createTile and Item.placeStyle aswell as setting a few values that are common across all placeable items + Item.DefaultToPlaceableTile(ModContent.TileType(), 0); - Item.width = 30; - Item.height = 40; - Item.maxStack = 9999; - Item.rare = ItemRarityID.Master; - Item.master = true; // This makes sure that "Master" displays in the tooltip, as the rarity only changes the item name color - Item.value = Item.buyPrice(0, 5); - } - } + Item.width = 30; + Item.height = 40; + Item.maxStack = 9999; + Item.rare = ItemRarityID.Master; + Item.master = true; // This makes sure that "Master" displays in the tooltip, as the rarity only changes the item name color + Item.value = Item.buyPrice(0, 5); + } + } } diff --git a/Items/Placeables/Furniture/BossRelics/DraedonRelic.cs b/Items/Placeables/Furniture/BossRelics/DraedonRelic.cs index c7908283c8..efe67a3956 100644 --- a/Items/Placeables/Furniture/BossRelics/DraedonRelic.cs +++ b/Items/Placeables/Furniture/BossRelics/DraedonRelic.cs @@ -4,21 +4,21 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.BossRelics { - public class DraedonRelic : ModItem, ILocalizedModType + public class DraedonRelic : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; - public override void SetDefaults() - { - // Vanilla has many useful methods like these, use them! This substitutes setting Item.createTile and Item.placeStyle aswell as setting a few values that are common across all placeable items - Item.DefaultToPlaceableTile(ModContent.TileType(), 0); + public override void SetDefaults() + { + // Vanilla has many useful methods like these, use them! This substitutes setting Item.createTile and Item.placeStyle aswell as setting a few values that are common across all placeable items + Item.DefaultToPlaceableTile(ModContent.TileType(), 0); - Item.width = 30; - Item.height = 40; - Item.maxStack = 9999; - Item.rare = ItemRarityID.Master; - Item.master = true; // This makes sure that "Master" displays in the tooltip, as the rarity only changes the item name color - Item.value = Item.buyPrice(0, 5); - } - } + Item.width = 30; + Item.height = 40; + Item.maxStack = 9999; + Item.rare = ItemRarityID.Master; + Item.master = true; // This makes sure that "Master" displays in the tooltip, as the rarity only changes the item name color + Item.value = Item.buyPrice(0, 5); + } + } } diff --git a/Items/Placeables/Furniture/BossRelics/DragonfollyRelic.cs b/Items/Placeables/Furniture/BossRelics/DragonfollyRelic.cs index 13b2f04d03..f71ef88673 100644 --- a/Items/Placeables/Furniture/BossRelics/DragonfollyRelic.cs +++ b/Items/Placeables/Furniture/BossRelics/DragonfollyRelic.cs @@ -4,21 +4,21 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.BossRelics { - public class DragonfollyRelic : ModItem, ILocalizedModType + public class DragonfollyRelic : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; - public override void SetDefaults() - { - // Vanilla has many useful methods like these, use them! This substitutes setting Item.createTile and Item.placeStyle aswell as setting a few values that are common across all placeable items - Item.DefaultToPlaceableTile(ModContent.TileType(), 0); + public override void SetDefaults() + { + // Vanilla has many useful methods like these, use them! This substitutes setting Item.createTile and Item.placeStyle aswell as setting a few values that are common across all placeable items + Item.DefaultToPlaceableTile(ModContent.TileType(), 0); - Item.width = 30; - Item.height = 40; - Item.maxStack = 9999; - Item.rare = ItemRarityID.Master; - Item.master = true; // This makes sure that "Master" displays in the tooltip, as the rarity only changes the item name color - Item.value = Item.buyPrice(0, 5); - } - } + Item.width = 30; + Item.height = 40; + Item.maxStack = 9999; + Item.rare = ItemRarityID.Master; + Item.master = true; // This makes sure that "Master" displays in the tooltip, as the rarity only changes the item name color + Item.value = Item.buyPrice(0, 5); + } + } } diff --git a/Items/Placeables/Furniture/BossRelics/GiantClamRelic.cs b/Items/Placeables/Furniture/BossRelics/GiantClamRelic.cs index ab1eb80091..86edfee1f4 100644 --- a/Items/Placeables/Furniture/BossRelics/GiantClamRelic.cs +++ b/Items/Placeables/Furniture/BossRelics/GiantClamRelic.cs @@ -4,21 +4,21 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.BossRelics { - public class GiantClamRelic : ModItem, ILocalizedModType + public class GiantClamRelic : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; - public override void SetDefaults() - { - // Vanilla has many useful methods like these, use them! This substitutes setting Item.createTile and Item.placeStyle aswell as setting a few values that are common across all placeable items - Item.DefaultToPlaceableTile(ModContent.TileType(), 0); + public override void SetDefaults() + { + // Vanilla has many useful methods like these, use them! This substitutes setting Item.createTile and Item.placeStyle aswell as setting a few values that are common across all placeable items + Item.DefaultToPlaceableTile(ModContent.TileType(), 0); - Item.width = 30; - Item.height = 40; - Item.maxStack = 9999; - Item.rare = ItemRarityID.Master; - Item.master = true; // This makes sure that "Master" displays in the tooltip, as the rarity only changes the item name color - Item.value = Item.buyPrice(0, 5); - } - } + Item.width = 30; + Item.height = 40; + Item.maxStack = 9999; + Item.rare = ItemRarityID.Master; + Item.master = true; // This makes sure that "Master" displays in the tooltip, as the rarity only changes the item name color + Item.value = Item.buyPrice(0, 5); + } + } } diff --git a/Items/Placeables/Furniture/BossRelics/GreatSandSharkRelic.cs b/Items/Placeables/Furniture/BossRelics/GreatSandSharkRelic.cs index a64b41a28a..d286aa1ab6 100644 --- a/Items/Placeables/Furniture/BossRelics/GreatSandSharkRelic.cs +++ b/Items/Placeables/Furniture/BossRelics/GreatSandSharkRelic.cs @@ -4,21 +4,21 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.BossRelics { - public class GreatSandSharkRelic : ModItem, ILocalizedModType + public class GreatSandSharkRelic : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; - public override void SetDefaults() - { - // Vanilla has many useful methods like these, use them! This substitutes setting Item.createTile and Item.placeStyle aswell as setting a few values that are common across all placeable items - Item.DefaultToPlaceableTile(ModContent.TileType(), 0); + public override void SetDefaults() + { + // Vanilla has many useful methods like these, use them! This substitutes setting Item.createTile and Item.placeStyle aswell as setting a few values that are common across all placeable items + Item.DefaultToPlaceableTile(ModContent.TileType(), 0); - Item.width = 30; - Item.height = 40; - Item.maxStack = 9999; - Item.rare = ItemRarityID.Master; - Item.master = true; // This makes sure that "Master" displays in the tooltip, as the rarity only changes the item name color - Item.value = Item.buyPrice(0, 5); - } - } + Item.width = 30; + Item.height = 40; + Item.maxStack = 9999; + Item.rare = ItemRarityID.Master; + Item.master = true; // This makes sure that "Master" displays in the tooltip, as the rarity only changes the item name color + Item.value = Item.buyPrice(0, 5); + } + } } diff --git a/Items/Placeables/Furniture/BossRelics/HiveMindRelic.cs b/Items/Placeables/Furniture/BossRelics/HiveMindRelic.cs index bc3393c741..41f915c366 100644 --- a/Items/Placeables/Furniture/BossRelics/HiveMindRelic.cs +++ b/Items/Placeables/Furniture/BossRelics/HiveMindRelic.cs @@ -4,21 +4,21 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.BossRelics { - public class HiveMindRelic : ModItem, ILocalizedModType + public class HiveMindRelic : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; - public override void SetDefaults() - { - // Vanilla has many useful methods like these, use them! This substitutes setting Item.createTile and Item.placeStyle aswell as setting a few values that are common across all placeable items - Item.DefaultToPlaceableTile(ModContent.TileType(), 0); + public override void SetDefaults() + { + // Vanilla has many useful methods like these, use them! This substitutes setting Item.createTile and Item.placeStyle aswell as setting a few values that are common across all placeable items + Item.DefaultToPlaceableTile(ModContent.TileType(), 0); - Item.width = 30; - Item.height = 40; - Item.maxStack = 9999; - Item.rare = ItemRarityID.Master; - Item.master = true; // This makes sure that "Master" displays in the tooltip, as the rarity only changes the item name color - Item.value = Item.buyPrice(0, 5); - } - } + Item.width = 30; + Item.height = 40; + Item.maxStack = 9999; + Item.rare = ItemRarityID.Master; + Item.master = true; // This makes sure that "Master" displays in the tooltip, as the rarity only changes the item name color + Item.value = Item.buyPrice(0, 5); + } + } } diff --git a/Items/Placeables/Furniture/BossRelics/HiveMindRelic.png b/Items/Placeables/Furniture/BossRelics/HiveMindRelic.png index 4bf32047b0..61e4766e28 100644 Binary files a/Items/Placeables/Furniture/BossRelics/HiveMindRelic.png and b/Items/Placeables/Furniture/BossRelics/HiveMindRelic.png differ diff --git a/Items/Placeables/Furniture/BossRelics/LeviathanAnahitaRelic.cs b/Items/Placeables/Furniture/BossRelics/LeviathanAnahitaRelic.cs index c504d3266f..4f6b6bea5e 100644 --- a/Items/Placeables/Furniture/BossRelics/LeviathanAnahitaRelic.cs +++ b/Items/Placeables/Furniture/BossRelics/LeviathanAnahitaRelic.cs @@ -4,21 +4,21 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.BossRelics { - public class LeviathanAnahitaRelic : ModItem, ILocalizedModType + public class LeviathanAnahitaRelic : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; - public override void SetDefaults() - { - // Vanilla has many useful methods like these, use them! This substitutes setting Item.createTile and Item.placeStyle aswell as setting a few values that are common across all placeable items - Item.DefaultToPlaceableTile(ModContent.TileType(), 0); + public override void SetDefaults() + { + // Vanilla has many useful methods like these, use them! This substitutes setting Item.createTile and Item.placeStyle aswell as setting a few values that are common across all placeable items + Item.DefaultToPlaceableTile(ModContent.TileType(), 0); - Item.width = 30; - Item.height = 40; - Item.maxStack = 9999; - Item.rare = ItemRarityID.Master; - Item.master = true; // This makes sure that "Master" displays in the tooltip, as the rarity only changes the item name color - Item.value = Item.buyPrice(0, 5); - } - } + Item.width = 30; + Item.height = 40; + Item.maxStack = 9999; + Item.rare = ItemRarityID.Master; + Item.master = true; // This makes sure that "Master" displays in the tooltip, as the rarity only changes the item name color + Item.value = Item.buyPrice(0, 5); + } + } } diff --git a/Items/Placeables/Furniture/BossRelics/MaulerRelic.cs b/Items/Placeables/Furniture/BossRelics/MaulerRelic.cs index 66c2210eed..07b387e13c 100644 --- a/Items/Placeables/Furniture/BossRelics/MaulerRelic.cs +++ b/Items/Placeables/Furniture/BossRelics/MaulerRelic.cs @@ -4,21 +4,21 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.BossRelics { - public class MaulerRelic : ModItem, ILocalizedModType + public class MaulerRelic : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; - public override void SetDefaults() - { - // Vanilla has many useful methods like these, use them! This substitutes setting Item.createTile and Item.placeStyle aswell as setting a few values that are common across all placeable items - Item.DefaultToPlaceableTile(ModContent.TileType(), 0); + public override void SetDefaults() + { + // Vanilla has many useful methods like these, use them! This substitutes setting Item.createTile and Item.placeStyle aswell as setting a few values that are common across all placeable items + Item.DefaultToPlaceableTile(ModContent.TileType(), 0); - Item.width = 30; - Item.height = 40; - Item.maxStack = 9999; - Item.rare = ItemRarityID.Master; - Item.master = true; // This makes sure that "Master" displays in the tooltip, as the rarity only changes the item name color - Item.value = Item.buyPrice(0, 5); - } - } + Item.width = 30; + Item.height = 40; + Item.maxStack = 9999; + Item.rare = ItemRarityID.Master; + Item.master = true; // This makes sure that "Master" displays in the tooltip, as the rarity only changes the item name color + Item.value = Item.buyPrice(0, 5); + } + } } diff --git a/Items/Placeables/Furniture/BossRelics/NuclearTerrorRelic.cs b/Items/Placeables/Furniture/BossRelics/NuclearTerrorRelic.cs index cde4ecc804..0787647271 100644 --- a/Items/Placeables/Furniture/BossRelics/NuclearTerrorRelic.cs +++ b/Items/Placeables/Furniture/BossRelics/NuclearTerrorRelic.cs @@ -4,21 +4,21 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.BossRelics { - public class NuclearTerrorRelic : ModItem, ILocalizedModType + public class NuclearTerrorRelic : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; - public override void SetDefaults() - { - // Vanilla has many useful methods like these, use them! This substitutes setting Item.createTile and Item.placeStyle aswell as setting a few values that are common across all placeable items - Item.DefaultToPlaceableTile(ModContent.TileType(), 0); + public override void SetDefaults() + { + // Vanilla has many useful methods like these, use them! This substitutes setting Item.createTile and Item.placeStyle aswell as setting a few values that are common across all placeable items + Item.DefaultToPlaceableTile(ModContent.TileType(), 0); - Item.width = 30; - Item.height = 40; - Item.maxStack = 9999; - Item.rare = ItemRarityID.Master; - Item.master = true; // This makes sure that "Master" displays in the tooltip, as the rarity only changes the item name color - Item.value = Item.buyPrice(0, 5); - } - } + Item.width = 30; + Item.height = 40; + Item.maxStack = 9999; + Item.rare = ItemRarityID.Master; + Item.master = true; // This makes sure that "Master" displays in the tooltip, as the rarity only changes the item name color + Item.value = Item.buyPrice(0, 5); + } + } } diff --git a/Items/Placeables/Furniture/BossRelics/OldDukeRelic.cs b/Items/Placeables/Furniture/BossRelics/OldDukeRelic.cs index 0f3b54681c..205f6be8da 100644 --- a/Items/Placeables/Furniture/BossRelics/OldDukeRelic.cs +++ b/Items/Placeables/Furniture/BossRelics/OldDukeRelic.cs @@ -4,21 +4,21 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.BossRelics { - public class OldDukeRelic : ModItem, ILocalizedModType + public class OldDukeRelic : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; - public override void SetDefaults() - { - // Vanilla has many useful methods like these, use them! This substitutes setting Item.createTile and Item.placeStyle aswell as setting a few values that are common across all placeable items - Item.DefaultToPlaceableTile(ModContent.TileType(), 0); + public override void SetDefaults() + { + // Vanilla has many useful methods like these, use them! This substitutes setting Item.createTile and Item.placeStyle aswell as setting a few values that are common across all placeable items + Item.DefaultToPlaceableTile(ModContent.TileType(), 0); - Item.width = 30; - Item.height = 40; - Item.maxStack = 9999; - Item.rare = ItemRarityID.Master; - Item.master = true; // This makes sure that "Master" displays in the tooltip, as the rarity only changes the item name color - Item.value = Item.buyPrice(0, 5); - } - } + Item.width = 30; + Item.height = 40; + Item.maxStack = 9999; + Item.rare = ItemRarityID.Master; + Item.master = true; // This makes sure that "Master" displays in the tooltip, as the rarity only changes the item name color + Item.value = Item.buyPrice(0, 5); + } + } } diff --git a/Items/Placeables/Furniture/BossRelics/PerforatorsRelic.cs b/Items/Placeables/Furniture/BossRelics/PerforatorsRelic.cs index 7d12070df4..6867125e90 100644 --- a/Items/Placeables/Furniture/BossRelics/PerforatorsRelic.cs +++ b/Items/Placeables/Furniture/BossRelics/PerforatorsRelic.cs @@ -4,21 +4,21 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.BossRelics { - public class PerforatorsRelic : ModItem, ILocalizedModType + public class PerforatorsRelic : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; - public override void SetDefaults() - { - // Vanilla has many useful methods like these, use them! This substitutes setting Item.createTile and Item.placeStyle aswell as setting a few values that are common across all placeable items - Item.DefaultToPlaceableTile(ModContent.TileType(), 0); + public override void SetDefaults() + { + // Vanilla has many useful methods like these, use them! This substitutes setting Item.createTile and Item.placeStyle aswell as setting a few values that are common across all placeable items + Item.DefaultToPlaceableTile(ModContent.TileType(), 0); - Item.width = 30; - Item.height = 40; - Item.maxStack = 9999; - Item.rare = ItemRarityID.Master; - Item.master = true; // This makes sure that "Master" displays in the tooltip, as the rarity only changes the item name color - Item.value = Item.buyPrice(0, 5); - } - } + Item.width = 30; + Item.height = 40; + Item.maxStack = 9999; + Item.rare = ItemRarityID.Master; + Item.master = true; // This makes sure that "Master" displays in the tooltip, as the rarity only changes the item name color + Item.value = Item.buyPrice(0, 5); + } + } } diff --git a/Items/Placeables/Furniture/BossRelics/PerforatorsRelic.png b/Items/Placeables/Furniture/BossRelics/PerforatorsRelic.png index 32a6ac44cc..f0a356d064 100644 Binary files a/Items/Placeables/Furniture/BossRelics/PerforatorsRelic.png and b/Items/Placeables/Furniture/BossRelics/PerforatorsRelic.png differ diff --git a/Items/Placeables/Furniture/BossRelics/PlaguebringerGoliathRelic.cs b/Items/Placeables/Furniture/BossRelics/PlaguebringerGoliathRelic.cs index 87906c7d19..1711f71f19 100644 --- a/Items/Placeables/Furniture/BossRelics/PlaguebringerGoliathRelic.cs +++ b/Items/Placeables/Furniture/BossRelics/PlaguebringerGoliathRelic.cs @@ -4,21 +4,21 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.BossRelics { - public class PlaguebringerGoliathRelic : ModItem, ILocalizedModType + public class PlaguebringerGoliathRelic : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; - public override void SetDefaults() - { - // Vanilla has many useful methods like these, use them! This substitutes setting Item.createTile and Item.placeStyle aswell as setting a few values that are common across all placeable items - Item.DefaultToPlaceableTile(ModContent.TileType(), 0); + public override void SetDefaults() + { + // Vanilla has many useful methods like these, use them! This substitutes setting Item.createTile and Item.placeStyle aswell as setting a few values that are common across all placeable items + Item.DefaultToPlaceableTile(ModContent.TileType(), 0); - Item.width = 30; - Item.height = 40; - Item.maxStack = 9999; - Item.rare = ItemRarityID.Master; - Item.master = true; // This makes sure that "Master" displays in the tooltip, as the rarity only changes the item name color - Item.value = Item.buyPrice(0, 5); - } - } + Item.width = 30; + Item.height = 40; + Item.maxStack = 9999; + Item.rare = ItemRarityID.Master; + Item.master = true; // This makes sure that "Master" displays in the tooltip, as the rarity only changes the item name color + Item.value = Item.buyPrice(0, 5); + } + } } diff --git a/Items/Placeables/Furniture/BossRelics/PolterghastRelic.cs b/Items/Placeables/Furniture/BossRelics/PolterghastRelic.cs index 1591c2e485..166b62835d 100644 --- a/Items/Placeables/Furniture/BossRelics/PolterghastRelic.cs +++ b/Items/Placeables/Furniture/BossRelics/PolterghastRelic.cs @@ -4,20 +4,20 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.BossRelics { - public class PolterghastRelic : ModItem, ILocalizedModType + public class PolterghastRelic : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; - public override void SetDefaults() - { - // Vanilla has many useful methods like these, use them! This substitutes setting Item.createTile and Item.placeStyle aswell as setting a few values that are common across all placeable items - Item.DefaultToPlaceableTile(ModContent.TileType(), 0); - Item.width = 30; - Item.height = 40; - Item.maxStack = 9999; - Item.rare = ItemRarityID.Master; - Item.master = true; // This makes sure that "Master" displays in the tooltip, as the rarity only changes the item name color - Item.value = Item.buyPrice(0, 5); - } - } + public override void SetDefaults() + { + // Vanilla has many useful methods like these, use them! This substitutes setting Item.createTile and Item.placeStyle aswell as setting a few values that are common across all placeable items + Item.DefaultToPlaceableTile(ModContent.TileType(), 0); + Item.width = 30; + Item.height = 40; + Item.maxStack = 9999; + Item.rare = ItemRarityID.Master; + Item.master = true; // This makes sure that "Master" displays in the tooltip, as the rarity only changes the item name color + Item.value = Item.buyPrice(0, 5); + } + } } diff --git a/Items/Placeables/Furniture/BossRelics/ProfanedGuardiansRelic.cs b/Items/Placeables/Furniture/BossRelics/ProfanedGuardiansRelic.cs index 84efe76f7c..8c4e3a69e0 100644 --- a/Items/Placeables/Furniture/BossRelics/ProfanedGuardiansRelic.cs +++ b/Items/Placeables/Furniture/BossRelics/ProfanedGuardiansRelic.cs @@ -4,21 +4,21 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.BossRelics { - public class ProfanedGuardiansRelic : ModItem, ILocalizedModType + public class ProfanedGuardiansRelic : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; - public override void SetDefaults() - { - // Vanilla has many useful methods like these, use them! This substitutes setting Item.createTile and Item.placeStyle aswell as setting a few values that are common across all placeable items - Item.DefaultToPlaceableTile(ModContent.TileType(), 0); + public override void SetDefaults() + { + // Vanilla has many useful methods like these, use them! This substitutes setting Item.createTile and Item.placeStyle aswell as setting a few values that are common across all placeable items + Item.DefaultToPlaceableTile(ModContent.TileType(), 0); - Item.width = 30; - Item.height = 40; - Item.maxStack = 9999; - Item.rare = ItemRarityID.Master; - Item.master = true; // This makes sure that "Master" displays in the tooltip, as the rarity only changes the item name color - Item.value = Item.buyPrice(0, 5); - } - } + Item.width = 30; + Item.height = 40; + Item.maxStack = 9999; + Item.rare = ItemRarityID.Master; + Item.master = true; // This makes sure that "Master" displays in the tooltip, as the rarity only changes the item name color + Item.value = Item.buyPrice(0, 5); + } + } } diff --git a/Items/Placeables/Furniture/BossRelics/ProvidenceRelic.cs b/Items/Placeables/Furniture/BossRelics/ProvidenceRelic.cs index b99a4e9906..bea8a1144a 100644 --- a/Items/Placeables/Furniture/BossRelics/ProvidenceRelic.cs +++ b/Items/Placeables/Furniture/BossRelics/ProvidenceRelic.cs @@ -4,21 +4,21 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.BossRelics { - public class ProvidenceRelic : ModItem, ILocalizedModType + public class ProvidenceRelic : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; - public override void SetDefaults() - { - // Vanilla has many useful methods like these, use them! This substitutes setting Item.createTile and Item.placeStyle aswell as setting a few values that are common across all placeable items - Item.DefaultToPlaceableTile(ModContent.TileType(), 0); + public override void SetDefaults() + { + // Vanilla has many useful methods like these, use them! This substitutes setting Item.createTile and Item.placeStyle aswell as setting a few values that are common across all placeable items + Item.DefaultToPlaceableTile(ModContent.TileType(), 0); - Item.width = 30; - Item.height = 40; - Item.maxStack = 9999; - Item.rare = ItemRarityID.Master; - Item.master = true; // This makes sure that "Master" displays in the tooltip, as the rarity only changes the item name color - Item.value = Item.buyPrice(0, 5); - } - } + Item.width = 30; + Item.height = 40; + Item.maxStack = 9999; + Item.rare = ItemRarityID.Master; + Item.master = true; // This makes sure that "Master" displays in the tooltip, as the rarity only changes the item name color + Item.value = Item.buyPrice(0, 5); + } + } } diff --git a/Items/Placeables/Furniture/BossRelics/RavagerRelic.cs b/Items/Placeables/Furniture/BossRelics/RavagerRelic.cs index 921f87fc1d..528d0e53e1 100644 --- a/Items/Placeables/Furniture/BossRelics/RavagerRelic.cs +++ b/Items/Placeables/Furniture/BossRelics/RavagerRelic.cs @@ -4,22 +4,22 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.BossRelics { - public class RavagerRelic : ModItem, ILocalizedModType + public class RavagerRelic : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; - public override void SetDefaults() - { - // Vanilla has many useful methods like these, use them! This substitutes setting Item.createTile and Item.placeStyle aswell as setting a few values that are common across all placeable items - - Item.DefaultToPlaceableTile(ModContent.TileType(), 0); + public override void SetDefaults() + { + // Vanilla has many useful methods like these, use them! This substitutes setting Item.createTile and Item.placeStyle aswell as setting a few values that are common across all placeable items - Item.width = 30; - Item.height = 40; - Item.maxStack = 9999; - Item.rare = ItemRarityID.Master; - Item.master = true; // This makes sure that "Master" displays in the tooltip, as the rarity only changes the item name color - Item.value = Item.buyPrice(0, 5); - } - } + Item.DefaultToPlaceableTile(ModContent.TileType(), 0); + + Item.width = 30; + Item.height = 40; + Item.maxStack = 9999; + Item.rare = ItemRarityID.Master; + Item.master = true; // This makes sure that "Master" displays in the tooltip, as the rarity only changes the item name color + Item.value = Item.buyPrice(0, 5); + } + } } diff --git a/Items/Placeables/Furniture/BossRelics/SignusRelic.cs b/Items/Placeables/Furniture/BossRelics/SignusRelic.cs index c1e40d2fa2..de0e31627c 100644 --- a/Items/Placeables/Furniture/BossRelics/SignusRelic.cs +++ b/Items/Placeables/Furniture/BossRelics/SignusRelic.cs @@ -4,21 +4,21 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.BossRelics { - public class SignusRelic : ModItem, ILocalizedModType + public class SignusRelic : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; - public override void SetDefaults() - { - // Vanilla has many useful methods like these, use them! This substitutes setting Item.createTile and Item.placeStyle aswell as setting a few values that are common across all placeable items - Item.DefaultToPlaceableTile(ModContent.TileType(), 0); + public override void SetDefaults() + { + // Vanilla has many useful methods like these, use them! This substitutes setting Item.createTile and Item.placeStyle aswell as setting a few values that are common across all placeable items + Item.DefaultToPlaceableTile(ModContent.TileType(), 0); - Item.width = 30; - Item.height = 40; - Item.maxStack = 9999; - Item.rare = ItemRarityID.Master; - Item.master = true; // This makes sure that "Master" displays in the tooltip, as the rarity only changes the item name color - Item.value = Item.buyPrice(0, 5); - } - } + Item.width = 30; + Item.height = 40; + Item.maxStack = 9999; + Item.rare = ItemRarityID.Master; + Item.master = true; // This makes sure that "Master" displays in the tooltip, as the rarity only changes the item name color + Item.value = Item.buyPrice(0, 5); + } + } } diff --git a/Items/Placeables/Furniture/BossRelics/SlimeGodRelic.cs b/Items/Placeables/Furniture/BossRelics/SlimeGodRelic.cs index 9b10925ed0..da24cb9a5a 100644 --- a/Items/Placeables/Furniture/BossRelics/SlimeGodRelic.cs +++ b/Items/Placeables/Furniture/BossRelics/SlimeGodRelic.cs @@ -4,21 +4,21 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.BossRelics { - public class SlimeGodRelic : ModItem, ILocalizedModType + public class SlimeGodRelic : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; - public override void SetDefaults() - { - // Vanilla has many useful methods like these, use them! This substitutes setting Item.createTile and Item.placeStyle aswell as setting a few values that are common across all placeable items - Item.DefaultToPlaceableTile(ModContent.TileType(), 0); + public override void SetDefaults() + { + // Vanilla has many useful methods like these, use them! This substitutes setting Item.createTile and Item.placeStyle aswell as setting a few values that are common across all placeable items + Item.DefaultToPlaceableTile(ModContent.TileType(), 0); - Item.width = 30; - Item.height = 40; - Item.maxStack = 9999; - Item.rare = ItemRarityID.Master; - Item.master = true; // This makes sure that "Master" displays in the tooltip, as the rarity only changes the item name color - Item.value = Item.buyPrice(0, 5); - } - } + Item.width = 30; + Item.height = 40; + Item.maxStack = 9999; + Item.rare = ItemRarityID.Master; + Item.master = true; // This makes sure that "Master" displays in the tooltip, as the rarity only changes the item name color + Item.value = Item.buyPrice(0, 5); + } + } } diff --git a/Items/Placeables/Furniture/BossRelics/StormWeaverRelic.cs b/Items/Placeables/Furniture/BossRelics/StormWeaverRelic.cs index 70c3e2e348..5a30c826f0 100644 --- a/Items/Placeables/Furniture/BossRelics/StormWeaverRelic.cs +++ b/Items/Placeables/Furniture/BossRelics/StormWeaverRelic.cs @@ -4,21 +4,21 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.BossRelics { - public class StormWeaverRelic : ModItem, ILocalizedModType + public class StormWeaverRelic : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; - public override void SetDefaults() - { - // Vanilla has many useful methods like these, use them! This substitutes setting Item.createTile and Item.placeStyle aswell as setting a few values that are common across all placeable items - Item.DefaultToPlaceableTile(ModContent.TileType(), 0); + public override void SetDefaults() + { + // Vanilla has many useful methods like these, use them! This substitutes setting Item.createTile and Item.placeStyle aswell as setting a few values that are common across all placeable items + Item.DefaultToPlaceableTile(ModContent.TileType(), 0); - Item.width = 30; - Item.height = 40; - Item.maxStack = 9999; - Item.rare = ItemRarityID.Master; - Item.master = true; // This makes sure that "Master" displays in the tooltip, as the rarity only changes the item name color - Item.value = Item.buyPrice(0, 5); - } - } + Item.width = 30; + Item.height = 40; + Item.maxStack = 9999; + Item.rare = ItemRarityID.Master; + Item.master = true; // This makes sure that "Master" displays in the tooltip, as the rarity only changes the item name color + Item.value = Item.buyPrice(0, 5); + } + } } diff --git a/Items/Placeables/Furniture/BossRelics/YharonRelic.cs b/Items/Placeables/Furniture/BossRelics/YharonRelic.cs index 40c5213a2a..cf19d69d6f 100644 --- a/Items/Placeables/Furniture/BossRelics/YharonRelic.cs +++ b/Items/Placeables/Furniture/BossRelics/YharonRelic.cs @@ -4,21 +4,21 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.BossRelics { - public class YharonRelic : ModItem, ILocalizedModType + public class YharonRelic : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; - public override void SetDefaults() - { - // Vanilla has many useful methods like these, use them! This substitutes setting Item.createTile and Item.placeStyle aswell as setting a few values that are common across all placeable items - Item.DefaultToPlaceableTile(ModContent.TileType(), 0); + public override void SetDefaults() + { + // Vanilla has many useful methods like these, use them! This substitutes setting Item.createTile and Item.placeStyle aswell as setting a few values that are common across all placeable items + Item.DefaultToPlaceableTile(ModContent.TileType(), 0); - Item.width = 30; - Item.height = 40; - Item.maxStack = 9999; - Item.rare = ItemRarityID.Master; - Item.master = true; // This makes sure that "Master" displays in the tooltip, as the rarity only changes the item name color - Item.value = Item.buyPrice(0, 5); - } - } + Item.width = 30; + Item.height = 40; + Item.maxStack = 9999; + Item.rare = ItemRarityID.Master; + Item.master = true; // This makes sure that "Master" displays in the tooltip, as the rarity only changes the item name color + Item.value = Item.buyPrice(0, 5); + } + } } diff --git a/Items/Placeables/Furniture/ChaosCandle.cs b/Items/Placeables/Furniture/ChaosCandle.cs index b0caa6e3a7..a4c795b6a7 100644 --- a/Items/Placeables/Furniture/ChaosCandle.cs +++ b/Items/Placeables/Furniture/ChaosCandle.cs @@ -1,4 +1,4 @@ -using CalamityMod.Dusts; +using CalamityMod.Dusts; using CalamityMod.Items.Materials; using CalamityMod.Items.Potions; using Microsoft.Xna.Framework; @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Placeables.Furniture public override void HoldItem(Player player) { player.Calamity().chaosCandle = true; - if (Main.rand.Next(player.itemAnimation > 0 ? 10 : 20) == 0) + if (Main.rand.NextBool(player.itemAnimation > 0 ? 10 : 20)) { Dust.NewDust(new Vector2(player.itemLocation.X + 12f * player.direction, player.itemLocation.Y - 10f * player.gravDir), 4, 4, (int)CalamityDusts.Brimstone); } diff --git a/Items/Placeables/Furniture/CirrusCouch.cs b/Items/Placeables/Furniture/CirrusCouch.cs new file mode 100644 index 0000000000..a7c10b5b24 --- /dev/null +++ b/Items/Placeables/Furniture/CirrusCouch.cs @@ -0,0 +1,25 @@ +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Furniture +{ + public class CirrusCouch : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + Item.width = 28; + Item.height = 20; + Item.maxStack = 9999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.value = 0; + Item.createTile = ModContent.TileType(); + } + } +} diff --git a/Items/Placeables/Furniture/CirrusCouch.png b/Items/Placeables/Furniture/CirrusCouch.png new file mode 100644 index 0000000000..3d0e1a4ba3 Binary files /dev/null and b/Items/Placeables/Furniture/CirrusCouch.png differ diff --git a/Items/Placeables/Furniture/CorruptionEffigy.cs b/Items/Placeables/Furniture/CorruptionEffigy.cs index 5a9388117d..952ae9d7ad 100644 --- a/Items/Placeables/Furniture/CorruptionEffigy.cs +++ b/Items/Placeables/Furniture/CorruptionEffigy.cs @@ -1,6 +1,6 @@ -using Terraria; -using Terraria.ModLoader; +using Terraria; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture { diff --git a/Items/Placeables/Furniture/CraftingStations/AltarOfTheAccursedItem.cs b/Items/Placeables/Furniture/CraftingStations/AltarOfTheAccursedItem.cs index 1aabe77ba4..0e1096c6be 100644 --- a/Items/Placeables/Furniture/CraftingStations/AltarOfTheAccursedItem.cs +++ b/Items/Placeables/Furniture/CraftingStations/AltarOfTheAccursedItem.cs @@ -12,32 +12,32 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { + Item.width = 38; + Item.height = 32; Item.createTile = ModContent.TileType(); Item.useTurn = true; Item.useAnimation = 15; Item.useTime = 10; Item.autoReuse = true; Item.consumable = true; - Item.width = 38; - Item.height = 32; Item.maxStack = 9999; Item.useStyle = ItemUseStyleID.Swing; Item.rare = ModContent.RarityType(); } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.CraftingObjects; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.CraftingObjects; + } public override void AddRecipes() { CreateRecipe(). - AddIngredient(30). - AddIngredient(5). - AddIngredient(). - AddTile(). - Register(); + AddIngredient(30). + AddIngredient(5). + AddIngredient(). + AddTile(). + Register(); } } } diff --git a/Items/Placeables/Furniture/CraftingStations/AncientAltar.cs b/Items/Placeables/Furniture/CraftingStations/AncientAltar.cs index 1bb10b81a0..e4ac91aa4a 100644 --- a/Items/Placeables/Furniture/CraftingStations/AncientAltar.cs +++ b/Items/Placeables/Furniture/CraftingStations/AncientAltar.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Placeables.Ores; +using CalamityMod.Items.Placeables.Ores; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.CraftingStations @@ -22,10 +22,10 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations Item.createTile = ModContent.TileType(); } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.CraftingObjects; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.CraftingObjects; + } public override void AddRecipes() { diff --git a/Items/Placeables/Furniture/CraftingStations/AshenAltar.cs b/Items/Placeables/Furniture/CraftingStations/AshenAltar.cs index a09bb66da5..92482e3ed4 100644 --- a/Items/Placeables/Furniture/CraftingStations/AshenAltar.cs +++ b/Items/Placeables/Furniture/CraftingStations/AshenAltar.cs @@ -1,5 +1,6 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.FurnitureAshen; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.CraftingStations @@ -23,10 +24,10 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations Item.createTile = ModContent.TileType(); } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.CraftingObjects; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.CraftingObjects; + } public override void AddRecipes() { @@ -34,6 +35,7 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations AddIngredient(10). AddIngredient(10). AddTile(TileID.Anvils). + AddDecraftCondition(Condition.DownedMechBossAny). Register(); } } diff --git a/Items/Placeables/Furniture/CraftingStations/BotanicPlanter.cs b/Items/Placeables/Furniture/CraftingStations/BotanicPlanter.cs index 847804355e..f1b2837430 100644 --- a/Items/Placeables/Furniture/CraftingStations/BotanicPlanter.cs +++ b/Items/Placeables/Furniture/CraftingStations/BotanicPlanter.cs @@ -1,4 +1,4 @@ -using Terraria.ID; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.CraftingStations { @@ -20,10 +20,10 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations Item.createTile = ModContent.TileType(); } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.CraftingObjects; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.CraftingObjects; + } public override void AddRecipes() { diff --git a/Items/Placeables/Furniture/CraftingStations/CosmicAnvilItem.cs b/Items/Placeables/Furniture/CraftingStations/CosmicAnvilItem.cs index 362af0feea..8ab452233e 100644 --- a/Items/Placeables/Furniture/CraftingStations/CosmicAnvilItem.cs +++ b/Items/Placeables/Furniture/CraftingStations/CosmicAnvilItem.cs @@ -28,10 +28,10 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations Item.value = Item.sellPrice(platinum: 2, gold: 50); } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.CraftingObjects; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.CraftingObjects; + } public override void AddRecipes() { diff --git a/Items/Placeables/Furniture/CraftingStations/DraedonsForge.cs b/Items/Placeables/Furniture/CraftingStations/DraedonsForge.cs index 1ae99e3639..60d8f1eb10 100644 --- a/Items/Placeables/Furniture/CraftingStations/DraedonsForge.cs +++ b/Items/Placeables/Furniture/CraftingStations/DraedonsForge.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Rarities; using Terraria; using Terraria.ID; @@ -9,6 +9,20 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations public class DraedonsForge : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Terraria.On_Recipe.ConsumeForCraft += DraeforgeUnlockDetour; + } + + private static bool DraeforgeUnlockDetour(On_Recipe.orig_ConsumeForCraft orig, Recipe self, Item item, Item requiredItem, ref int stackRequired) + { + if (self.HasTile(ModContent.TileType())) + { + Main.LocalPlayer.Calamity().HasCraftedDraedonsForge = true; + } + return orig(self, item, requiredItem, ref stackRequired); + } + public override void SetDefaults() { Item.width = 58; @@ -26,10 +40,10 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations Item.value = Item.sellPrice(platinum: 27, gold: 50); } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.CraftingObjects; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.CraftingObjects; + } public override void AddRecipes() { diff --git a/Items/Placeables/Furniture/CraftingStations/EffulgentManipulator.cs b/Items/Placeables/Furniture/CraftingStations/EffulgentManipulator.cs index 49386cefc7..d630fca520 100644 --- a/Items/Placeables/Furniture/CraftingStations/EffulgentManipulator.cs +++ b/Items/Placeables/Furniture/CraftingStations/EffulgentManipulator.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Placeables.FurnitureSilva; +using CalamityMod.Items.Placeables.FurnitureSilva; using Terraria.ID; using Terraria.ModLoader; @@ -22,10 +22,10 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations Item.createTile = ModContent.TileType(); } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.CraftingObjects; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.CraftingObjects; + } public override void AddRecipes() { diff --git a/Items/Placeables/Furniture/CraftingStations/EutrophicShelf.cs b/Items/Placeables/Furniture/CraftingStations/EutrophicShelf.cs index 6331ae04f9..5d46aaacce 100644 --- a/Items/Placeables/Furniture/CraftingStations/EutrophicShelf.cs +++ b/Items/Placeables/Furniture/CraftingStations/EutrophicShelf.cs @@ -1,6 +1,6 @@ -using Terraria.ID; +using CalamityMod.Items.Materials; +using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Items.Materials; namespace CalamityMod.Items.Placeables.Furniture.CraftingStations { @@ -22,10 +22,10 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations Item.createTile = ModContent.TileType(); } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.CraftingObjects; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.CraftingObjects; + } public override void AddRecipes() { diff --git a/Items/Placeables/Furniture/CraftingStations/MonolithAmalgam.cs b/Items/Placeables/Furniture/CraftingStations/MonolithAmalgam.cs index 3e83c35213..7102134f8d 100644 --- a/Items/Placeables/Furniture/CraftingStations/MonolithAmalgam.cs +++ b/Items/Placeables/Furniture/CraftingStations/MonolithAmalgam.cs @@ -20,10 +20,10 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations Item.createTile = ModContent.TileType(); } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.CraftingObjects; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.CraftingObjects; + } public override void AddRecipes() { diff --git a/Items/Placeables/Furniture/CraftingStations/PlagueInfuser.cs b/Items/Placeables/Furniture/CraftingStations/PlagueInfuser.cs index 9789a78fcb..ce9464351d 100644 --- a/Items/Placeables/Furniture/CraftingStations/PlagueInfuser.cs +++ b/Items/Placeables/Furniture/CraftingStations/PlagueInfuser.cs @@ -20,10 +20,10 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations Item.createTile = ModContent.TileType(); } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.CraftingObjects; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.CraftingObjects; + } public override void AddRecipes() { diff --git a/Items/Placeables/Furniture/CraftingStations/ProfanedCrucible.cs b/Items/Placeables/Furniture/CraftingStations/ProfanedCrucible.cs index ac0f0247e3..765a4bcb90 100644 --- a/Items/Placeables/Furniture/CraftingStations/ProfanedCrucible.cs +++ b/Items/Placeables/Furniture/CraftingStations/ProfanedCrucible.cs @@ -22,10 +22,10 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations Item.createTile = ModContent.TileType(); } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.CraftingObjects; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.CraftingObjects; + } public override void AddRecipes() { diff --git a/Items/Placeables/Furniture/CraftingStations/StaticRefiner.cs b/Items/Placeables/Furniture/CraftingStations/StaticRefiner.cs index 67f120dc8a..48d3cee665 100644 --- a/Items/Placeables/Furniture/CraftingStations/StaticRefiner.cs +++ b/Items/Placeables/Furniture/CraftingStations/StaticRefiner.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.CraftingStations @@ -20,10 +20,10 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations Item.createTile = ModContent.TileType(); } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.CraftingObjects; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.CraftingObjects; + } public override void AddRecipes() { diff --git a/Items/Placeables/Furniture/CraftingStations/VoidCondenser.cs b/Items/Placeables/Furniture/CraftingStations/VoidCondenser.cs index 3b15a69545..26a24ddb01 100644 --- a/Items/Placeables/Furniture/CraftingStations/VoidCondenser.cs +++ b/Items/Placeables/Furniture/CraftingStations/VoidCondenser.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Placeables.FurnitureVoid; +using CalamityMod.Items.Placeables.FurnitureVoid; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.CraftingStations @@ -20,10 +20,10 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations Item.createTile = ModContent.TileType(); } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.CraftingObjects; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.CraftingObjects; + } public override void AddRecipes() { diff --git a/Items/Placeables/Furniture/CraftingStations/WulfrumLabstationItem.cs b/Items/Placeables/Furniture/CraftingStations/WulfrumLabstationItem.cs index 58c1286d9a..8685c7336b 100644 --- a/Items/Placeables/Furniture/CraftingStations/WulfrumLabstationItem.cs +++ b/Items/Placeables/Furniture/CraftingStations/WulfrumLabstationItem.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Placeables.FurnitureWulfrum; +using CalamityMod.Items.Placeables.FurnitureWulfrum; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.CraftingStations @@ -20,10 +20,10 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations Item.createTile = ModContent.TileType(); } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.CraftingObjects; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.CraftingObjects; + } public override void AddRecipes() { diff --git a/Items/Placeables/Furniture/CrimsonEffigy.cs b/Items/Placeables/Furniture/CrimsonEffigy.cs index 530dfac7e4..bcd700ffa9 100644 --- a/Items/Placeables/Furniture/CrimsonEffigy.cs +++ b/Items/Placeables/Furniture/CrimsonEffigy.cs @@ -1,6 +1,6 @@ -using Terraria; -using Terraria.ModLoader; +using Terraria; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture { diff --git a/Items/Placeables/Furniture/DevPaintings/ThankYouPainting.cs b/Items/Placeables/Furniture/DevPaintings/ThankYouPainting.cs index 7fbec72628..a59b553243 100644 --- a/Items/Placeables/Furniture/DevPaintings/ThankYouPainting.cs +++ b/Items/Placeables/Furniture/DevPaintings/ThankYouPainting.cs @@ -1,6 +1,6 @@ -using CalamityMod.Tiles.Furniture.DevPaintings; -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; +using CalamityMod.Tiles.Furniture.DevPaintings; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,197 +8,197 @@ using static Microsoft.Xna.Framework.Input.Keys; namespace CalamityMod.Items.Placeables.Furniture.DevPaintings { - public class ThankYouPainting : ModItem, ILocalizedModType + public class ThankYouPainting : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; - public const int DropInt = 100; + public const int DropInt = 100; - public override void SetDefaults() - { - Item.width = 96; - Item.height = 64; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.value = Item.buyPrice(0, 2, 0, 0);; - Item.rare = ItemRarityID.White; - Item.createTile = ModContent.TileType(); - Item.Calamity().donorItem = true; - } + public override void SetDefaults() + { + Item.width = 96; + Item.height = 64; + Item.maxStack = 9999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.value = Item.buyPrice(0, 2, 0, 0); ; + Item.rare = ItemRarityID.White; + Item.createTile = ModContent.TileType(); + Item.Calamity().donorItem = true; + } public override void ModifyTooltips(List tooltips) { - if (!Main.keyState.IsKeyDown(LeftShift)) - return; + if (!Main.keyState.IsKeyDown(LeftShift)) + return; - string tooltip = ""; + string tooltip = ""; - int namesPerLine = 5; - for (int i = 0; i < devList.Count; i++) - { - tooltip += devList[i]; + int namesPerLine = 5; + for (int i = 0; i < devList.Count; i++) + { + tooltip += devList[i]; - if (i == devList.Count - 1) - break; + if (i == devList.Count - 1) + break; - if (i % namesPerLine == 0) - tooltip += "\n"; + if (i % namesPerLine == 0) + tooltip += "\n"; - else - tooltip += ", "; - } + else + tooltip += ", "; + } - TooltipLine line = tooltips.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Tooltip2"); - if (line != null) - line.Text = tooltip; - } + TooltipLine line = tooltips.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Tooltip2"); + if (line != null) + line.Text = tooltip; + } public static IList devList = new List() - { - "Fabsol, the mod's founder and owner", // Fabsol gets a line to himself + { + "Fabsol, the mod's founder and owner", // Fabsol gets a line to himself "Altix", - "Angel", - "apotofkoolaid", - "AquaSG", - "Atalya", - "Ben-TK", - "Cei", - "CongratsIsTrash", - "Cooper", - "CosmaticMango", - "CrabBar", - "Dia", - "Done", - "DylanDoe21", - "Fluffi", - "HaguriHat", - "Heart Plus Up!", - "Hugekraken", - "Lilac Olligoci", - "LordMetarex", - "Memes", - "Mercutio 'Merkalto' Takle", - "Mishiro Usui", - "Moonburn", - "Mr.Small", - "nalyddd", - "Nycro", - "Ozzatron", - "Piky", - "PokerFace", - "Shade", - "SharZz", - "Shayy", - "Spider Prov", - "StipulateVenus", - "Tomat", - "Triangle", - "Uberransy", - "Xyk", - "YuH", - + "Angel", + "apotofkoolaid", + "AquaSG", + "Atalya", + "Ben-TK", + "Cei", + "CongratsIsTrash", + "Cooper", + "CosmaticMango", + "CrabBar", + "Dia", + "Done", + "DylanDoe21", + "enamoured", + "Fluffi", + "HaguriHat", + "Heart Plus Up!", + "Hugekraken", + "Lilac Olligoci", + "LordMetarex", + "Memes", + "Mercutio 'Merkalto' Takle", + "Mishiro Usui", + "Moonburn", + "Mr.Small", + "Nycro", + "Ozzatron", + "Piky", + "PokerFace", + "Shade", + "SharZz", + "Shayy", + "Spider Prov", + "StipulateVenus", + "Tomat", + "Triangle", + "Uncle Danny", + "Xyk", + "YuH", + // Former devs "Afzofa", - "AdipemDragon", - "Akeeli", - "Aleksh", - "Alphi", - "Altalyra", - "Amadis", - "AstroKnight", - "Blast", - "Blastitle", - "Blockaroz", - "Boffin", - "Bravioli", - "CDMusic", - "Chetto", - "Chill Dude", - "Cobalion", - "Daim", - "DarkTiny", - "Demik", - "DM Dokuro", - "Dominic Karma", - "Doog", - "drh", - "dwshin", - "Earth", - "EchoDuck", - "Ein", - "ENNWAY", - "Enreden", - "Epsilon", - "Fargowilta", - "Frous", - "Gahtao", - "Gamagamer64", - "GramOfSalt", - "Graydee", - "Grox the Great", - "Hectique", - "Huggles", - "Ian-1KV", - "IbanPlay", - "Inanis", - "JaceDaDorito", - "Jenosis", - "jontchua", - "Khaelis", - "KnightyKnight", - "L0st", - "Leon", - "Leviathan", - "Lompl Allimath", - "MarieArk", - "Minecat", - "Mrrp", - "Nao", - "Neverglide", - "Nincity", - "Niorin", - "Nitro", - "NyctoDarkMatter", - "PaleoStar", - "Pbtopacio", - "Phantasmal Deathray", - "Phupperbat", - "Pinkie Poss", - "pixlgray", - "Poly", - "Popo", - "President Waluigi", - "Puff", - "Purple Necromancer", - "RoverdriveX", - "Runefield", - "Sargassum", - "sentri", - "Shucks", - "Silver-Lord of Ash", - "SixteenInMono", - "Skeletony", - "Sok", - "spooktacular", - "Spoopyro", - "Svante", + "AdipemDragon", + "Akeeli", + "Aleksh", + "Alphi", + "Altalyra", + "Amadis", + "AstroKnight", + "Blast", + "Blastitle", + "Blockaroz", + "Boffin", + "Bravioli", + "CDMusic", + "Chetto", + "Chill Dude", + "Cobalion", + "Daim", + "DarkTiny", + "Demik", + "DM Dokuro", + "Dominic Karma", + "Doog", + "drh", + "dwshin", + "Earth", + "EchoDuck", + "Ein", + "ENNWAY", + "Enreden", + "Epsilon", + "Fargowilta", + "Frous", + "Gahtao", + "Gamagamer64", + "GramOfSalt", + "Graydee", + "Grox the Great", + "Hectique", + "Huggles", + "Ian-1KV", + "IbanPlay", + "Inanis", + "JaceDaDorito", + "Jenosis", + "jontchua", + "Khaelis", + "KnightyKnight", + "L0st", + "Leon", + "Leviathan", + "Lompl Allimath", + "MarieArk", + "Minecat", + "Mrrp", + "Nao", + "Neverglide", + "Nincity", + "Niorin", + "Nitro", + "NyctoDarkMatter", + "PaleoStar", + "Pbtopacio", + "Phantasmal Deathray", + "Phupperbat", + "Pinkie Poss", + "pixlgray", + "Poly", + "Popo", + "President Waluigi", + "Puff", + "Purple Necromancer", + "RoverdriveX", + "Runefield", + "Sargassum", + "sentri", + "Shucks", + "Silver-Lord of Ash", + "SixteenInMono", + "Skeletony", + "Sok", + "spooktacular", + "Spoopyro", + "Svante", "Sylvium", - "Teragat", - "Terry N. Muse", - "ThousandFields", - "TikiWiki", - "Tinymanx", - "Trivaxy", - "Uncle Danny", - "Vaikyia", - "Vladimier", - "Yatagarasu", - "Yuyutsu", - "Zach", - "Ziggums", - }; - } + "Teragat", + "Terry N. Muse", + "ThousandFields", + "TikiWiki", + "Tinymanx", + "Trivaxy", + "Uberransy", + "Vaikyia", + "Vladimier", + "Yatagarasu", + "Yuyutsu", + "Zach", + "Ziggums", + }; + } } diff --git a/Items/Placeables/Furniture/Fountains/AbyssFountainItem.cs b/Items/Placeables/Furniture/Fountains/AbyssFountainItem.cs index f2cc7750e0..3521c048f1 100644 --- a/Items/Placeables/Furniture/Fountains/AbyssFountainItem.cs +++ b/Items/Placeables/Furniture/Fountains/AbyssFountainItem.cs @@ -1,7 +1,7 @@ +using CalamityMod.Tiles.Furniture.Fountains; using Terraria; -using Terraria.ModLoader; -using CalamityMod.Tiles.Furniture.Fountains; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.Fountains { @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Fountains Item.useStyle = ItemUseStyleID.Swing; Item.consumable = true; Item.value = Item.buyPrice(0, 4, 0, 0); - Item.rare = ItemRarityID.White; + Item.rare = ItemRarityID.Blue; Item.createTile = ModContent.TileType(); } } diff --git a/Items/Placeables/Furniture/Fountains/AstralFountainItem.cs b/Items/Placeables/Furniture/Fountains/AstralFountainItem.cs index cdcbc97b4c..1ea7b38bb6 100644 --- a/Items/Placeables/Furniture/Fountains/AstralFountainItem.cs +++ b/Items/Placeables/Furniture/Fountains/AstralFountainItem.cs @@ -1,7 +1,7 @@ +using CalamityMod.Tiles.Furniture.Fountains; using Terraria; -using Terraria.ModLoader; -using CalamityMod.Tiles.Furniture.Fountains; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.Fountains { @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Fountains Item.useStyle = ItemUseStyleID.Swing; Item.consumable = true; Item.value = Item.buyPrice(0, 4, 0, 0); - Item.rare = ItemRarityID.White; + Item.rare = ItemRarityID.Blue; Item.createTile = ModContent.TileType(); } } diff --git a/Items/Placeables/Furniture/Fountains/BrimstoneLavaFountainItem.cs b/Items/Placeables/Furniture/Fountains/BrimstoneLavaFountainItem.cs new file mode 100644 index 0000000000..7f2295a155 --- /dev/null +++ b/Items/Placeables/Furniture/Fountains/BrimstoneLavaFountainItem.cs @@ -0,0 +1,27 @@ +using CalamityMod.Tiles.Furniture.Fountains; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Furniture.Fountains +{ + public class BrimstoneLavaFountainItem : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + Item.width = 22; + Item.height = 42; + Item.maxStack = 9999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.value = Item.buyPrice(0, 4, 0, 0); + Item.rare = ItemRarityID.Blue; + Item.createTile = ModContent.TileType(); + } + } +} diff --git a/Items/Placeables/Furniture/Fountains/BrimstoneLavaFountainItem.png b/Items/Placeables/Furniture/Fountains/BrimstoneLavaFountainItem.png new file mode 100644 index 0000000000..6e5bbcab48 Binary files /dev/null and b/Items/Placeables/Furniture/Fountains/BrimstoneLavaFountainItem.png differ diff --git a/Items/Placeables/Furniture/Fountains/SulphurousFountainItem.cs b/Items/Placeables/Furniture/Fountains/SulphurousFountainItem.cs index 84585a7a0a..082c262a4c 100644 --- a/Items/Placeables/Furniture/Fountains/SulphurousFountainItem.cs +++ b/Items/Placeables/Furniture/Fountains/SulphurousFountainItem.cs @@ -1,7 +1,7 @@ +using CalamityMod.Tiles.Furniture.Fountains; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Tiles.Furniture.Fountains; namespace CalamityMod.Items.Placeables.Furniture.Fountains { @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Fountains Item.useStyle = ItemUseStyleID.Swing; Item.consumable = true; Item.value = Item.buyPrice(0, 4, 0, 0); - Item.rare = ItemRarityID.White; + Item.rare = ItemRarityID.Blue; Item.createTile = ModContent.TileType(); } } diff --git a/Items/Placeables/Furniture/Fountains/SunkenSeaFountain.cs b/Items/Placeables/Furniture/Fountains/SunkenSeaFountain.cs index 59a01e8c77..b3c1b023f1 100644 --- a/Items/Placeables/Furniture/Fountains/SunkenSeaFountain.cs +++ b/Items/Placeables/Furniture/Fountains/SunkenSeaFountain.cs @@ -1,7 +1,7 @@ +using CalamityMod.Tiles.Furniture.Fountains; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Tiles.Furniture.Fountains; namespace CalamityMod.Items.Placeables.Furniture.Fountains { @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Fountains Item.useStyle = ItemUseStyleID.Swing; Item.consumable = true; Item.value = Item.buyPrice(0, 4, 0, 0); - Item.rare = ItemRarityID.White; + Item.rare = ItemRarityID.Blue; Item.createTile = ModContent.TileType(); } } diff --git a/Items/Placeables/Furniture/GloomTorch.cs b/Items/Placeables/Furniture/GloomTorch.cs index 0d73d4b150..ea1615efa1 100644 --- a/Items/Placeables/Furniture/GloomTorch.cs +++ b/Items/Placeables/Furniture/GloomTorch.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Placeables.Furniture public override void SetStaticDefaults() { Item.ResearchUnlockCount = 100; - ItemID.Sets.Torches[Item.type] = true; + ItemID.Sets.Torches[Item.type] = true; ItemID.Sets.SingleUseInGamepad[Type] = true; ItemID.Sets.ShimmerTransformToItem[Type] = ItemID.ShimmerTorch; } @@ -38,7 +38,7 @@ namespace CalamityMod.Items.Placeables.Furniture { bool killTorch = Collision.DrownCollision(player.position, player.width, player.height, player.gravDir) || Item.wet; Vector2 position = player.RotatedRelativePoint(new Vector2(player.itemLocation.X + 12f * player.direction + player.velocity.X, player.itemLocation.Y - 14f + player.velocity.Y), true); - + if (!killTorch) Lighting.AddLight(position, 0.9f, 1.2f, 0.3f); } diff --git a/Items/Placeables/Furniture/LanternCenter.cs b/Items/Placeables/Furniture/LanternCenter.cs index 52c00002f9..874a3ddbba 100644 --- a/Items/Placeables/Furniture/LanternCenter.cs +++ b/Items/Placeables/Furniture/LanternCenter.cs @@ -1,7 +1,7 @@ -using CalamityMod.Tiles.Furniture; +using CalamityMod.Tiles.Furniture; using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture { diff --git a/Items/Placeables/Furniture/Monoliths/AstralProjector.cs b/Items/Placeables/Furniture/Monoliths/AstralProjector.cs new file mode 100644 index 0000000000..f9df9d7b02 --- /dev/null +++ b/Items/Placeables/Furniture/Monoliths/AstralProjector.cs @@ -0,0 +1,49 @@ +using CalamityMod.Tiles.Furniture.Monoliths; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.Furniture.Monoliths +{ + public class AstralProjector : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + Item.width = 24; + Item.height = 28; + 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(); + Item.rare = ItemRarityID.LightRed; + Item.accessory = true; + Item.vanity = true; + } + + public override void UpdateEquip(Player player) + { + if (player.whoAmI == Main.myPlayer) + { + player.Calamity().monolithAstralShader = 30; + } + } + public override void UpdateVanity(Player player) + { + if (player.whoAmI == Main.myPlayer) + { + player.Calamity().monolithAstralShader = 30; + } + } + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(15). + AddTile(TileID.Anvils). + Register(); + } + } +} diff --git a/Items/Placeables/Furniture/Monoliths/AstralProjector.png b/Items/Placeables/Furniture/Monoliths/AstralProjector.png new file mode 100644 index 0000000000..fddbd284a2 Binary files /dev/null and b/Items/Placeables/Furniture/Monoliths/AstralProjector.png differ diff --git a/Items/Placeables/Furniture/Monoliths/BlueDistortedMonolith.cs b/Items/Placeables/Furniture/Monoliths/BlueDistortedMonolith.cs new file mode 100644 index 0000000000..aeffacdc72 --- /dev/null +++ b/Items/Placeables/Furniture/Monoliths/BlueDistortedMonolith.cs @@ -0,0 +1,52 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Rarities; +using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.Monoliths; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.Furniture.Monoliths +{ + public class BlueDistortedMonolith : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + Item.width = 24; + Item.height = 28; + 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(); + Item.rare = ModContent.RarityType(); + Item.accessory = true; + Item.vanity = true; + } + + public override void UpdateEquip(Player player) + { + if (player.whoAmI == Main.myPlayer) + { + player.Calamity().monolithDevourerBShader = 30; + } + } + public override void UpdateVanity(Player player) + { + if (player.whoAmI == Main.myPlayer) + { + player.Calamity().monolithDevourerBShader = 30; + } + } + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(15). + AddTile(). + Register(); + } + } +} diff --git a/Items/Placeables/Furniture/Monoliths/BlueDistortedMonolith.png b/Items/Placeables/Furniture/Monoliths/BlueDistortedMonolith.png new file mode 100644 index 0000000000..d71ec7bed3 Binary files /dev/null and b/Items/Placeables/Furniture/Monoliths/BlueDistortedMonolith.png differ diff --git a/Items/Placeables/Furniture/Monoliths/BossRushMonolith.cs b/Items/Placeables/Furniture/Monoliths/BossRushMonolith.cs new file mode 100644 index 0000000000..1a60e8a7ec --- /dev/null +++ b/Items/Placeables/Furniture/Monoliths/BossRushMonolith.cs @@ -0,0 +1,43 @@ +using CalamityMod.Rarities; +using CalamityMod.Tiles.Furniture.Monoliths; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.Furniture.Monoliths +{ + public class BossRushMonolith : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + Item.width = 24; + Item.height = 28; + 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(); + Item.rare = ModContent.RarityType(); + Item.accessory = true; + Item.vanity = true; + } + + public override void UpdateEquip(Player player) + { + if (player.whoAmI == Main.myPlayer) + { + player.Calamity().monolithBossRushShader = 30; + } + } + public override void UpdateVanity(Player player) + { + if (player.whoAmI == Main.myPlayer) + { + player.Calamity().monolithBossRushShader = 30; + } + } + } +} diff --git a/Items/Placeables/Furniture/Monoliths/BossRushMonolith.png b/Items/Placeables/Furniture/Monoliths/BossRushMonolith.png new file mode 100644 index 0000000000..d00e2fd304 Binary files /dev/null and b/Items/Placeables/Furniture/Monoliths/BossRushMonolith.png differ diff --git a/Items/Placeables/Furniture/Monoliths/DeepSeaAnchor.cs b/Items/Placeables/Furniture/Monoliths/DeepSeaAnchor.cs new file mode 100644 index 0000000000..13dce481a5 --- /dev/null +++ b/Items/Placeables/Furniture/Monoliths/DeepSeaAnchor.cs @@ -0,0 +1,43 @@ +using CalamityMod.Rarities; +using CalamityMod.Tiles.Furniture.Monoliths; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.Furniture.Monoliths +{ + public class DeepSeaAnchor : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + Item.width = 24; + Item.height = 28; + 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(); + Item.rare = ItemRarityID.Lime; + Item.accessory = true; + Item.vanity = true; + } + + public override void UpdateEquip(Player player) + { + if (player.whoAmI == Main.myPlayer) + { + player.Calamity().monolithLeviathanShader = 30; + } + } + public override void UpdateVanity(Player player) + { + if (player.whoAmI == Main.myPlayer) + { + player.Calamity().monolithLeviathanShader = 30; + } + } + } +} diff --git a/Items/Placeables/Furniture/Monoliths/DeepSeaAnchor.png b/Items/Placeables/Furniture/Monoliths/DeepSeaAnchor.png new file mode 100644 index 0000000000..e6b2968997 Binary files /dev/null and b/Items/Placeables/Furniture/Monoliths/DeepSeaAnchor.png differ diff --git a/Items/Placeables/Furniture/Monoliths/DraconicIncense.cs b/Items/Placeables/Furniture/Monoliths/DraconicIncense.cs new file mode 100644 index 0000000000..ab3b483412 --- /dev/null +++ b/Items/Placeables/Furniture/Monoliths/DraconicIncense.cs @@ -0,0 +1,52 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Rarities; +using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.Monoliths; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.Furniture.Monoliths +{ + public class DraconicIncense : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + Item.width = 24; + Item.height = 28; + 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(); + Item.rare = ModContent.RarityType(); + Item.accessory = true; + Item.vanity = true; + } + + public override void UpdateEquip(Player player) + { + if (player.whoAmI == Main.myPlayer) + { + player.Calamity().monolithYharonShader = 30; + } + } + public override void UpdateVanity(Player player) + { + if (player.whoAmI == Main.myPlayer) + { + player.Calamity().monolithYharonShader = 30; + } + } + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(15). + AddTile(). + Register(); + } + } +} diff --git a/Items/Placeables/Furniture/Monoliths/DraconicIncense.png b/Items/Placeables/Furniture/Monoliths/DraconicIncense.png new file mode 100644 index 0000000000..c01bdb3522 Binary files /dev/null and b/Items/Placeables/Furniture/Monoliths/DraconicIncense.png differ diff --git a/Items/Placeables/Furniture/Monoliths/ExoObelisk.cs b/Items/Placeables/Furniture/Monoliths/ExoObelisk.cs new file mode 100644 index 0000000000..3c7352e50f --- /dev/null +++ b/Items/Placeables/Furniture/Monoliths/ExoObelisk.cs @@ -0,0 +1,52 @@ +using CalamityMod.Items.Placeables.FurnitureExo; +using CalamityMod.Rarities; +using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.Monoliths; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.Furniture.Monoliths +{ + public class ExoObelisk : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + Item.width = 24; + Item.height = 28; + 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(); + Item.rare = ModContent.RarityType(); + Item.accessory = true; + Item.vanity = true; + } + + public override void UpdateEquip(Player player) + { + if (player.whoAmI == Main.myPlayer) + { + player.Calamity().monolithExoShader = 30; + } + } + public override void UpdateVanity(Player player) + { + if (player.whoAmI == Main.myPlayer) + { + player.Calamity().monolithExoShader = 30; + } + } + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(15). + AddTile(). + Register(); + } + } +} diff --git a/Items/Placeables/Furniture/Monoliths/ExoObelisk.png b/Items/Placeables/Furniture/Monoliths/ExoObelisk.png new file mode 100644 index 0000000000..73478f08f7 Binary files /dev/null and b/Items/Placeables/Furniture/Monoliths/ExoObelisk.png differ diff --git a/Items/Placeables/Furniture/Monoliths/FrigidMonolith.cs b/Items/Placeables/Furniture/Monoliths/FrigidMonolith.cs new file mode 100644 index 0000000000..a9f7bff28b --- /dev/null +++ b/Items/Placeables/Furniture/Monoliths/FrigidMonolith.cs @@ -0,0 +1,42 @@ +using CalamityMod.Tiles.Furniture.Monoliths; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.Furniture.Monoliths +{ + public class FrigidMonolith : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + Item.width = 24; + Item.height = 28; + 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(); + Item.rare = ItemRarityID.Pink; + Item.accessory = true; + Item.vanity = true; + } + + public override void UpdateEquip(Player player) + { + if (player.whoAmI == Main.myPlayer) + { + player.Calamity().monolithCryogenShader = 30; + } + } + public override void UpdateVanity(Player player) + { + if (player.whoAmI == Main.myPlayer) + { + player.Calamity().monolithCryogenShader = 30; + } + } + } +} diff --git a/Items/Placeables/Furniture/Monoliths/FrigidMonolith.png b/Items/Placeables/Furniture/Monoliths/FrigidMonolith.png new file mode 100644 index 0000000000..ede7749947 Binary files /dev/null and b/Items/Placeables/Furniture/Monoliths/FrigidMonolith.png differ diff --git a/Items/Placeables/Furniture/Monoliths/PlagueHumidifier.cs b/Items/Placeables/Furniture/Monoliths/PlagueHumidifier.cs new file mode 100644 index 0000000000..fa4da117ad --- /dev/null +++ b/Items/Placeables/Furniture/Monoliths/PlagueHumidifier.cs @@ -0,0 +1,52 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Rarities; +using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.Monoliths; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.Furniture.Monoliths +{ + public class PlagueHumidifier : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + Item.width = 24; + Item.height = 28; + 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(); + Item.rare = ItemRarityID.Yellow; + Item.accessory = true; + Item.vanity = true; + } + + public override void UpdateEquip(Player player) + { + if (player.whoAmI == Main.myPlayer) + { + player.Calamity().monolithPlagueShader = 30; + } + } + public override void UpdateVanity(Player player) + { + if (player.whoAmI == Main.myPlayer) + { + player.Calamity().monolithPlagueShader = 30; + } + } + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(15). + AddTile(TileID.MythrilAnvil). + Register(); + } + } +} diff --git a/Items/Placeables/Furniture/Monoliths/PlagueHumidifier.png b/Items/Placeables/Furniture/Monoliths/PlagueHumidifier.png new file mode 100644 index 0000000000..881c5f262e Binary files /dev/null and b/Items/Placeables/Furniture/Monoliths/PlagueHumidifier.png differ diff --git a/Items/Placeables/Furniture/Monoliths/PurpleDistortedMonolith.cs b/Items/Placeables/Furniture/Monoliths/PurpleDistortedMonolith.cs new file mode 100644 index 0000000000..a665e83478 --- /dev/null +++ b/Items/Placeables/Furniture/Monoliths/PurpleDistortedMonolith.cs @@ -0,0 +1,52 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Rarities; +using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.Monoliths; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.Furniture.Monoliths +{ + public class PurpleDistortedMonolith : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + Item.width = 24; + Item.height = 28; + 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(); + Item.rare = ModContent.RarityType(); + Item.accessory = true; + Item.vanity = true; + } + + public override void UpdateEquip(Player player) + { + if (player.whoAmI == Main.myPlayer) + { + player.Calamity().monolithDevourerPShader = 30; + } + } + public override void UpdateVanity(Player player) + { + if (player.whoAmI == Main.myPlayer) + { + player.Calamity().monolithDevourerPShader = 30; + } + } + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(15). + AddTile(). + Register(); + } + } +} diff --git a/Items/Placeables/Furniture/Monoliths/PurpleDistortedMonolith.png b/Items/Placeables/Furniture/Monoliths/PurpleDistortedMonolith.png new file mode 100644 index 0000000000..d71ec7bed3 Binary files /dev/null and b/Items/Placeables/Furniture/Monoliths/PurpleDistortedMonolith.png differ diff --git a/Items/Placeables/Furniture/NavyPrismTorch.cs b/Items/Placeables/Furniture/NavyPrismTorch.cs index 7d7fbc3705..d6aced4657 100644 --- a/Items/Placeables/Furniture/NavyPrismTorch.cs +++ b/Items/Placeables/Furniture/NavyPrismTorch.cs @@ -11,9 +11,9 @@ namespace CalamityMod.Items.Placeables.Furniture public override void SetStaticDefaults() { Item.ResearchUnlockCount = 100; - ItemID.Sets.Torches[Item.type] = true; - ItemID.Sets.SingleUseInGamepad[Type] = true; - ItemID.Sets.WaterTorches[Item.type] = true; + ItemID.Sets.Torches[Item.type] = true; + ItemID.Sets.SingleUseInGamepad[Type] = true; + ItemID.Sets.WaterTorches[Item.type] = true; ItemID.Sets.ShimmerTransformToItem[Type] = ItemID.ShimmerTorch; } @@ -39,7 +39,7 @@ namespace CalamityMod.Items.Placeables.Furniture { if (Main.rand.NextBool(player.itemAnimation > 0 ? 10 : 20)) { - Dust.NewDust(new Vector2(player.itemLocation.X + 16f * player.direction, player.itemLocation.Y - 14f * player.gravDir), 4, 4, 68); + Dust.NewDust(new Vector2(player.itemLocation.X + 16f * player.direction, player.itemLocation.Y - 14f * player.gravDir), 4, 4, DustID.BlueCrystalShard); } Vector2 position = player.RotatedRelativePoint(new Vector2(player.itemLocation.X + 12f * player.direction + player.velocity.X, player.itemLocation.Y - 14f + player.velocity.Y), true); Lighting.AddLight(position, 0.8f, 1.2f, 1.2f); diff --git a/Items/Placeables/Furniture/PiggyCage.cs b/Items/Placeables/Furniture/PiggyCage.cs index 141404fea4..68e62aed06 100644 --- a/Items/Placeables/Furniture/PiggyCage.cs +++ b/Items/Placeables/Furniture/PiggyCage.cs @@ -1,5 +1,5 @@ +using CalamityMod.Items.Critters; using CalamityMod.Tiles.Furniture; -using CalamityMod.Items.Critters; using Terraria.ID; using Terraria.ModLoader; diff --git a/Items/Placeables/Furniture/RefractivePrismTorch.cs b/Items/Placeables/Furniture/RefractivePrismTorch.cs index 89584fecb8..cd13a9a012 100644 --- a/Items/Placeables/Furniture/RefractivePrismTorch.cs +++ b/Items/Placeables/Furniture/RefractivePrismTorch.cs @@ -11,9 +11,9 @@ namespace CalamityMod.Items.Placeables.Furniture public override void SetStaticDefaults() { Item.ResearchUnlockCount = 100; - ItemID.Sets.Torches[Item.type] = true; - ItemID.Sets.SingleUseInGamepad[Type] = true; - ItemID.Sets.WaterTorches[Item.type] = true; + ItemID.Sets.Torches[Item.type] = true; + ItemID.Sets.SingleUseInGamepad[Type] = true; + ItemID.Sets.WaterTorches[Item.type] = true; ItemID.Sets.ShimmerTransformToItem[Type] = ItemID.ShimmerTorch; } diff --git a/Items/Placeables/Furniture/RustyChest.cs b/Items/Placeables/Furniture/RustyChest.cs index 8ce21131c9..87a5621a8c 100644 --- a/Items/Placeables/Furniture/RustyChest.cs +++ b/Items/Placeables/Furniture/RustyChest.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Tiles.Abyss; using Terraria.ID; using Terraria.ModLoader; diff --git a/Items/Placeables/Furniture/SeaMinnowJar.cs b/Items/Placeables/Furniture/SeaMinnowJar.cs index 37612db393..64aab3ff0c 100644 --- a/Items/Placeables/Furniture/SeaMinnowJar.cs +++ b/Items/Placeables/Furniture/SeaMinnowJar.cs @@ -1,5 +1,5 @@ +using CalamityMod.Items.Critters; using CalamityMod.Tiles.Furniture; -using CalamityMod.Items.Critters; using Terraria.ID; using Terraria.ModLoader; diff --git a/Items/Placeables/Furniture/SulphurousTorch.cs b/Items/Placeables/Furniture/SulphurousTorch.cs index cd36c726c1..677a60f597 100644 --- a/Items/Placeables/Furniture/SulphurousTorch.cs +++ b/Items/Placeables/Furniture/SulphurousTorch.cs @@ -11,9 +11,9 @@ namespace CalamityMod.Items.Placeables.Furniture public override void SetStaticDefaults() { Item.ResearchUnlockCount = 100; - ItemID.Sets.Torches[Item.type] = true; - ItemID.Sets.SingleUseInGamepad[Type] = true; - ItemID.Sets.WaterTorches[Item.type] = true; + ItemID.Sets.Torches[Item.type] = true; + ItemID.Sets.SingleUseInGamepad[Type] = true; + ItemID.Sets.WaterTorches[Item.type] = true; ItemID.Sets.ShimmerTransformToItem[Type] = ItemID.ShimmerTorch; } @@ -39,7 +39,7 @@ namespace CalamityMod.Items.Placeables.Furniture { if (Main.rand.NextBool(player.itemAnimation > 0 ? 10 : 20)) { - Dust.NewDust(new Vector2(player.itemLocation.X + 16f * player.direction, player.itemLocation.Y - 14f * player.gravDir), 4, 4, 78); + Dust.NewDust(new Vector2(player.itemLocation.X + 16f * player.direction, player.itemLocation.Y - 14f * player.gravDir), 4, 4, DustID.t_LivingWood); } Vector2 position = player.RotatedRelativePoint(new Vector2(player.itemLocation.X + 12f * player.direction + player.velocity.X, player.itemLocation.Y - 14f + player.velocity.Y), true); Lighting.AddLight(position, 0.9f, 1.2f, 0.3f); diff --git a/Items/Placeables/Furniture/ThaumaticChair.cs b/Items/Placeables/Furniture/ThaumaticChair.cs index a1d38ae32d..91e5a91fac 100644 --- a/Items/Placeables/Furniture/ThaumaticChair.cs +++ b/Items/Placeables/Furniture/ThaumaticChair.cs @@ -3,14 +3,15 @@ using CalamityMod.Items.Placeables.FurnitureAbyss; using CalamityMod.Items.Placeables.FurnitureAcidwood; using CalamityMod.Items.Placeables.FurnitureAncient; using CalamityMod.Items.Placeables.FurnitureAshen; -using CalamityMod.Items.Placeables.FurnitureMonolith; using CalamityMod.Items.Placeables.FurnitureBotanic; using CalamityMod.Items.Placeables.FurnitureCosmilite; using CalamityMod.Items.Placeables.FurnitureEutrophic; using CalamityMod.Items.Placeables.FurnitureExo; -using CalamityMod.Items.Placeables.FurnitureSacrilegious; +using CalamityMod.Items.Placeables.FurnitureMonolith; using CalamityMod.Items.Placeables.FurnitureOtherworldly; +using CalamityMod.Items.Placeables.FurniturePlagued; using CalamityMod.Items.Placeables.FurnitureProfaned; +using CalamityMod.Items.Placeables.FurnitureSacrilegious; using CalamityMod.Items.Placeables.FurnitureSilva; using CalamityMod.Items.Placeables.FurnitureStatigel; using CalamityMod.Items.Placeables.FurnitureStratus; @@ -21,7 +22,6 @@ using CalamityMod.Tiles.Furniture; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Items.Placeables.FurniturePlagued; namespace CalamityMod.Items.Placeables.Furniture { diff --git a/Items/Placeables/Furniture/TranquilityCandle.cs b/Items/Placeables/Furniture/TranquilityCandle.cs index 6dc51e8579..3b9f71c013 100644 --- a/Items/Placeables/Furniture/TranquilityCandle.cs +++ b/Items/Placeables/Furniture/TranquilityCandle.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Items.Potions; using Microsoft.Xna.Framework; using Terraria; @@ -30,9 +30,9 @@ namespace CalamityMod.Items.Placeables.Furniture public override void HoldItem(Player player) { player.Calamity().tranquilityCandle = true; - if (Main.rand.Next(player.itemAnimation > 0 ? 10 : 20) == 0) + if (Main.rand.NextBool(player.itemAnimation > 0 ? 10 : 20)) { - Dust.NewDust(new Vector2(player.itemLocation.X + 10f * player.direction, player.itemLocation.Y - 12f * player.gravDir), 4, 4, 62); + Dust.NewDust(new Vector2(player.itemLocation.X + 10f * player.direction, player.itemLocation.Y - 12f * player.gravDir), 4, 4, DustID.PurpleTorch); } player.itemLocation.Y += 8; Vector2 position = player.RotatedRelativePoint(new Vector2(player.itemLocation.X + 12f * player.direction + player.velocity.X, player.itemLocation.Y - 14f + player.velocity.Y), true); diff --git a/Items/Placeables/Furniture/Trophies/AnahitaTrophy.cs b/Items/Placeables/Furniture/Trophies/AnahitaTrophy.cs index 072abd3568..ea986b065d 100644 --- a/Items/Placeables/Furniture/Trophies/AnahitaTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/AnahitaTrophy.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.BossTrophies; +using CalamityMod.Tiles.Furniture.BossTrophies; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.Trophies diff --git a/Items/Placeables/Furniture/Trophies/ApolloTrophy.cs b/Items/Placeables/Furniture/Trophies/ApolloTrophy.cs index 393ba49a00..32897dc144 100644 --- a/Items/Placeables/Furniture/Trophies/ApolloTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/ApolloTrophy.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.BossTrophies; +using CalamityMod.Tiles.Furniture.BossTrophies; using Terraria.ID; using Terraria.ModLoader; diff --git a/Items/Placeables/Furniture/Trophies/AquaticScourgeTrophy.cs b/Items/Placeables/Furniture/Trophies/AquaticScourgeTrophy.cs index 599312ca1e..7a6f8aa3ec 100644 --- a/Items/Placeables/Furniture/Trophies/AquaticScourgeTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/AquaticScourgeTrophy.cs @@ -1,6 +1,6 @@ -using CalamityMod.Tiles.Furniture.BossTrophies; -using Terraria.ModLoader; +using CalamityMod.Tiles.Furniture.BossTrophies; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.Trophies { diff --git a/Items/Placeables/Furniture/Trophies/AresTrophy.cs b/Items/Placeables/Furniture/Trophies/AresTrophy.cs index 4e032c09ee..5c0ca6d07c 100644 --- a/Items/Placeables/Furniture/Trophies/AresTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/AresTrophy.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.BossTrophies; +using CalamityMod.Tiles.Furniture.BossTrophies; using Terraria.ID; using Terraria.ModLoader; diff --git a/Items/Placeables/Furniture/Trophies/ArtemisTrophy.cs b/Items/Placeables/Furniture/Trophies/ArtemisTrophy.cs index 2d72ad2380..19e3fddb96 100644 --- a/Items/Placeables/Furniture/Trophies/ArtemisTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/ArtemisTrophy.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.BossTrophies; +using CalamityMod.Tiles.Furniture.BossTrophies; using Terraria.ID; using Terraria.ModLoader; diff --git a/Items/Placeables/Furniture/Trophies/AstrumAureusTrophy.cs b/Items/Placeables/Furniture/Trophies/AstrumAureusTrophy.cs index 9b3d85035d..4ba7c71a61 100644 --- a/Items/Placeables/Furniture/Trophies/AstrumAureusTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/AstrumAureusTrophy.cs @@ -1,6 +1,6 @@ using CalamityMod.Tiles.Furniture.BossTrophies; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.Trophies { diff --git a/Items/Placeables/Furniture/Trophies/AstrumDeusTrophy.cs b/Items/Placeables/Furniture/Trophies/AstrumDeusTrophy.cs index 079ece18cd..c30eab2b41 100644 --- a/Items/Placeables/Furniture/Trophies/AstrumDeusTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/AstrumDeusTrophy.cs @@ -1,6 +1,6 @@ -using CalamityMod.Tiles.Furniture.BossTrophies; -using Terraria.ModLoader; +using CalamityMod.Tiles.Furniture.BossTrophies; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.Trophies { diff --git a/Items/Placeables/Furniture/Trophies/BrimstoneElementalTrophy.cs b/Items/Placeables/Furniture/Trophies/BrimstoneElementalTrophy.cs index d6dfc5586b..bac2b71071 100644 --- a/Items/Placeables/Furniture/Trophies/BrimstoneElementalTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/BrimstoneElementalTrophy.cs @@ -1,6 +1,6 @@ -using CalamityMod.Tiles.Furniture.BossTrophies; -using Terraria.ModLoader; +using CalamityMod.Tiles.Furniture.BossTrophies; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.Trophies { diff --git a/Items/Placeables/Furniture/Trophies/CalamitasCloneTrophy.cs b/Items/Placeables/Furniture/Trophies/CalamitasCloneTrophy.cs index 5491331c14..f2aa8eb0e5 100644 --- a/Items/Placeables/Furniture/Trophies/CalamitasCloneTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/CalamitasCloneTrophy.cs @@ -1,6 +1,6 @@ using CalamityMod.Tiles.Furniture.BossTrophies; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.Trophies { diff --git a/Items/Placeables/Furniture/Trophies/CataclysmTrophy.cs b/Items/Placeables/Furniture/Trophies/CataclysmTrophy.cs index 525146f058..58f754a68c 100644 --- a/Items/Placeables/Furniture/Trophies/CataclysmTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/CataclysmTrophy.cs @@ -1,6 +1,6 @@ -using CalamityMod.Tiles.Furniture.BossTrophies; -using Terraria.ModLoader; +using CalamityMod.Tiles.Furniture.BossTrophies; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.Trophies { diff --git a/Items/Placeables/Furniture/Trophies/CatastropheTrophy.cs b/Items/Placeables/Furniture/Trophies/CatastropheTrophy.cs index f36517865c..a860b29176 100644 --- a/Items/Placeables/Furniture/Trophies/CatastropheTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/CatastropheTrophy.cs @@ -1,6 +1,6 @@ -using CalamityMod.Tiles.Furniture.BossTrophies; -using Terraria.ModLoader; +using CalamityMod.Tiles.Furniture.BossTrophies; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.Trophies { diff --git a/Items/Placeables/Furniture/Trophies/CeaselessVoidTrophy.cs b/Items/Placeables/Furniture/Trophies/CeaselessVoidTrophy.cs index 6272b24e21..1df4f94c55 100644 --- a/Items/Placeables/Furniture/Trophies/CeaselessVoidTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/CeaselessVoidTrophy.cs @@ -1,6 +1,6 @@ -using CalamityMod.Tiles.Furniture.BossTrophies; -using Terraria.ModLoader; +using CalamityMod.Tiles.Furniture.BossTrophies; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.Trophies { diff --git a/Items/Placeables/Furniture/Trophies/CrabulonTrophy.cs b/Items/Placeables/Furniture/Trophies/CrabulonTrophy.cs index 6d6eb60343..29a51785be 100644 --- a/Items/Placeables/Furniture/Trophies/CrabulonTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/CrabulonTrophy.cs @@ -1,6 +1,6 @@ -using CalamityMod.Tiles.Furniture.BossTrophies; -using Terraria.ModLoader; +using CalamityMod.Tiles.Furniture.BossTrophies; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.Trophies { diff --git a/Items/Placeables/Furniture/Trophies/CragmawMireTrophy.cs b/Items/Placeables/Furniture/Trophies/CragmawMireTrophy.cs index ed1309e216..8f32f162b3 100644 --- a/Items/Placeables/Furniture/Trophies/CragmawMireTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/CragmawMireTrophy.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.BossTrophies; +using CalamityMod.Tiles.Furniture.BossTrophies; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.Trophies diff --git a/Items/Placeables/Furniture/Trophies/CryogenTrophy.cs b/Items/Placeables/Furniture/Trophies/CryogenTrophy.cs index 2fb9078ed9..c72e8b662e 100644 --- a/Items/Placeables/Furniture/Trophies/CryogenTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/CryogenTrophy.cs @@ -1,6 +1,6 @@ -using CalamityMod.Tiles.Furniture.BossTrophies; -using Terraria.ModLoader; +using CalamityMod.Tiles.Furniture.BossTrophies; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.Trophies { diff --git a/Items/Placeables/Furniture/Trophies/DesertScourgeTrophy.cs b/Items/Placeables/Furniture/Trophies/DesertScourgeTrophy.cs index a1e1b01b2d..613904b580 100644 --- a/Items/Placeables/Furniture/Trophies/DesertScourgeTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/DesertScourgeTrophy.cs @@ -1,6 +1,6 @@ -using CalamityMod.Tiles.Furniture.BossTrophies; -using Terraria.ModLoader; +using CalamityMod.Tiles.Furniture.BossTrophies; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.Trophies { diff --git a/Items/Placeables/Furniture/Trophies/DesertScourgeTrophy.png b/Items/Placeables/Furniture/Trophies/DesertScourgeTrophy.png index 4f1a13b03e..0366dc9851 100644 Binary files a/Items/Placeables/Furniture/Trophies/DesertScourgeTrophy.png and b/Items/Placeables/Furniture/Trophies/DesertScourgeTrophy.png differ diff --git a/Items/Placeables/Furniture/Trophies/DevourerofGodsTrophy.cs b/Items/Placeables/Furniture/Trophies/DevourerofGodsTrophy.cs index 2715fc6fed..2892308c30 100644 --- a/Items/Placeables/Furniture/Trophies/DevourerofGodsTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/DevourerofGodsTrophy.cs @@ -1,6 +1,6 @@ -using CalamityMod.Tiles.Furniture.BossTrophies; -using Terraria.ModLoader; +using CalamityMod.Tiles.Furniture.BossTrophies; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.Trophies { diff --git a/Items/Placeables/Furniture/Trophies/DragonfollyTrophy.cs b/Items/Placeables/Furniture/Trophies/DragonfollyTrophy.cs index cf7c80f40b..c17c2333e5 100644 --- a/Items/Placeables/Furniture/Trophies/DragonfollyTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/DragonfollyTrophy.cs @@ -1,6 +1,6 @@ using CalamityMod.Tiles.Furniture.BossTrophies; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.Trophies { diff --git a/Items/Placeables/Furniture/Trophies/GiantClamTrophy.cs b/Items/Placeables/Furniture/Trophies/GiantClamTrophy.cs index fa6484220e..0947634a28 100644 --- a/Items/Placeables/Furniture/Trophies/GiantClamTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/GiantClamTrophy.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.BossTrophies; +using CalamityMod.Tiles.Furniture.BossTrophies; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.Trophies diff --git a/Items/Placeables/Furniture/Trophies/GreatSandSharkTrophy.cs b/Items/Placeables/Furniture/Trophies/GreatSandSharkTrophy.cs index cfc34c1bce..0bda52bc05 100644 --- a/Items/Placeables/Furniture/Trophies/GreatSandSharkTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/GreatSandSharkTrophy.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.BossTrophies; +using CalamityMod.Tiles.Furniture.BossTrophies; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.Trophies diff --git a/Items/Placeables/Furniture/Trophies/HiveMindTrophy.cs b/Items/Placeables/Furniture/Trophies/HiveMindTrophy.cs index b8279470ea..df5b15c9da 100644 --- a/Items/Placeables/Furniture/Trophies/HiveMindTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/HiveMindTrophy.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.BossTrophies; +using CalamityMod.Tiles.Furniture.BossTrophies; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.Trophies diff --git a/Items/Placeables/Furniture/Trophies/LeviathanTrophy.cs b/Items/Placeables/Furniture/Trophies/LeviathanTrophy.cs index e915fb1a9b..6cbacf118c 100644 --- a/Items/Placeables/Furniture/Trophies/LeviathanTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/LeviathanTrophy.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.BossTrophies; +using CalamityMod.Tiles.Furniture.BossTrophies; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.Trophies diff --git a/Items/Placeables/Furniture/Trophies/MaulerTrophy.cs b/Items/Placeables/Furniture/Trophies/MaulerTrophy.cs index 6c418f945b..704f2aea3e 100644 --- a/Items/Placeables/Furniture/Trophies/MaulerTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/MaulerTrophy.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.BossTrophies; +using CalamityMod.Tiles.Furniture.BossTrophies; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.Trophies diff --git a/Items/Placeables/Furniture/Trophies/NuclearTerrorTrophy.cs b/Items/Placeables/Furniture/Trophies/NuclearTerrorTrophy.cs index ed38972b0d..fde2378249 100644 --- a/Items/Placeables/Furniture/Trophies/NuclearTerrorTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/NuclearTerrorTrophy.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.BossTrophies; +using CalamityMod.Tiles.Furniture.BossTrophies; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.Trophies diff --git a/Items/Placeables/Furniture/Trophies/OldDukeTrophy.cs b/Items/Placeables/Furniture/Trophies/OldDukeTrophy.cs index 64794ebf8c..dcf1c8874e 100644 --- a/Items/Placeables/Furniture/Trophies/OldDukeTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/OldDukeTrophy.cs @@ -1,6 +1,6 @@ -using CalamityMod.Tiles.Furniture.BossTrophies; -using Terraria.ModLoader; +using CalamityMod.Tiles.Furniture.BossTrophies; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.Trophies { public class OldDukeTrophy : ModItem, ILocalizedModType diff --git a/Items/Placeables/Furniture/Trophies/PerforatorTrophy.cs b/Items/Placeables/Furniture/Trophies/PerforatorTrophy.cs index 332c1815a8..e679dbd68e 100644 --- a/Items/Placeables/Furniture/Trophies/PerforatorTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/PerforatorTrophy.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.BossTrophies; +using CalamityMod.Tiles.Furniture.BossTrophies; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.Trophies diff --git a/Items/Placeables/Furniture/Trophies/PlaguebringerGoliathTrophy.cs b/Items/Placeables/Furniture/Trophies/PlaguebringerGoliathTrophy.cs index 88e1d8904e..0dda84c088 100644 --- a/Items/Placeables/Furniture/Trophies/PlaguebringerGoliathTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/PlaguebringerGoliathTrophy.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.BossTrophies; +using CalamityMod.Tiles.Furniture.BossTrophies; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.Trophies diff --git a/Items/Placeables/Furniture/Trophies/PolterghastTrophy.cs b/Items/Placeables/Furniture/Trophies/PolterghastTrophy.cs index 44ad49299e..d0080ba749 100644 --- a/Items/Placeables/Furniture/Trophies/PolterghastTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/PolterghastTrophy.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.BossTrophies; +using CalamityMod.Tiles.Furniture.BossTrophies; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.Trophies diff --git a/Items/Placeables/Furniture/Trophies/ProfanedGuardianTrophy.cs b/Items/Placeables/Furniture/Trophies/ProfanedGuardianTrophy.cs index e9d86746d3..f338d7481b 100644 --- a/Items/Placeables/Furniture/Trophies/ProfanedGuardianTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/ProfanedGuardianTrophy.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.BossTrophies; +using CalamityMod.Tiles.Furniture.BossTrophies; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.Trophies diff --git a/Items/Placeables/Furniture/Trophies/ProvidenceTrophy.cs b/Items/Placeables/Furniture/Trophies/ProvidenceTrophy.cs index 5da4223157..a524153732 100644 --- a/Items/Placeables/Furniture/Trophies/ProvidenceTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/ProvidenceTrophy.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.BossTrophies; +using CalamityMod.Tiles.Furniture.BossTrophies; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.Trophies diff --git a/Items/Placeables/Furniture/Trophies/RavagerTrophy.cs b/Items/Placeables/Furniture/Trophies/RavagerTrophy.cs index 9e62745abe..9b96ae3db7 100644 --- a/Items/Placeables/Furniture/Trophies/RavagerTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/RavagerTrophy.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.BossTrophies; +using CalamityMod.Tiles.Furniture.BossTrophies; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.Trophies diff --git a/Items/Placeables/Furniture/Trophies/SignusTrophy.cs b/Items/Placeables/Furniture/Trophies/SignusTrophy.cs index 504e2458cf..b17c44822d 100644 --- a/Items/Placeables/Furniture/Trophies/SignusTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/SignusTrophy.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.BossTrophies; +using CalamityMod.Tiles.Furniture.BossTrophies; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.Trophies diff --git a/Items/Placeables/Furniture/Trophies/SlimeGodTrophy.cs b/Items/Placeables/Furniture/Trophies/SlimeGodTrophy.cs index 3e2c01b583..f2e0a31790 100644 --- a/Items/Placeables/Furniture/Trophies/SlimeGodTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/SlimeGodTrophy.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.BossTrophies; +using CalamityMod.Tiles.Furniture.BossTrophies; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.Trophies diff --git a/Items/Placeables/Furniture/Trophies/SupremeCataclysmTrophy.cs b/Items/Placeables/Furniture/Trophies/SupremeCataclysmTrophy.cs index 8e193a75e3..089f2d4221 100644 --- a/Items/Placeables/Furniture/Trophies/SupremeCataclysmTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/SupremeCataclysmTrophy.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.BossTrophies; +using CalamityMod.Tiles.Furniture.BossTrophies; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.Trophies diff --git a/Items/Placeables/Furniture/Trophies/SupremeCatastropheTrophy.cs b/Items/Placeables/Furniture/Trophies/SupremeCatastropheTrophy.cs index caaa97aa2f..42ea79b24a 100644 --- a/Items/Placeables/Furniture/Trophies/SupremeCatastropheTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/SupremeCatastropheTrophy.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.BossTrophies; +using CalamityMod.Tiles.Furniture.BossTrophies; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.Trophies diff --git a/Items/Placeables/Furniture/Trophies/ThanatosTrophy.cs b/Items/Placeables/Furniture/Trophies/ThanatosTrophy.cs index 547124798c..948b972f35 100644 --- a/Items/Placeables/Furniture/Trophies/ThanatosTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/ThanatosTrophy.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.BossTrophies; +using CalamityMod.Tiles.Furniture.BossTrophies; using Terraria.ID; using Terraria.ModLoader; diff --git a/Items/Placeables/Furniture/Trophies/WeaverTrophy.cs b/Items/Placeables/Furniture/Trophies/WeaverTrophy.cs index be986cfe45..91c86f733e 100644 --- a/Items/Placeables/Furniture/Trophies/WeaverTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/WeaverTrophy.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.BossTrophies; +using CalamityMod.Tiles.Furniture.BossTrophies; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.Trophies diff --git a/Items/Placeables/Furniture/Trophies/YharonTrophy.cs b/Items/Placeables/Furniture/Trophies/YharonTrophy.cs index ea13779d09..5c83acf015 100644 --- a/Items/Placeables/Furniture/Trophies/YharonTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/YharonTrophy.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.BossTrophies; +using CalamityMod.Tiles.Furniture.BossTrophies; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.Trophies diff --git a/Items/Placeables/Furniture/TwinklerInABottle.cs b/Items/Placeables/Furniture/TwinklerInABottle.cs index 33209f0db3..afa0da06e3 100644 --- a/Items/Placeables/Furniture/TwinklerInABottle.cs +++ b/Items/Placeables/Furniture/TwinklerInABottle.cs @@ -1,5 +1,5 @@ +using CalamityMod.Items.Critters; using CalamityMod.Tiles.Furniture; -using CalamityMod.Items.Critters; using Terraria.ID; using Terraria.ModLoader; diff --git a/Items/Placeables/Furniture/WeightlessCandle.cs b/Items/Placeables/Furniture/WeightlessCandle.cs index 76d6f8db0c..903f707f04 100644 --- a/Items/Placeables/Furniture/WeightlessCandle.cs +++ b/Items/Placeables/Furniture/WeightlessCandle.cs @@ -1,6 +1,6 @@ using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture { diff --git a/Items/Placeables/Furniture/WulfrumLureItem.cs b/Items/Placeables/Furniture/WulfrumLureItem.cs index 4405bc0833..75205140eb 100644 --- a/Items/Placeables/Furniture/WulfrumLureItem.cs +++ b/Items/Placeables/Furniture/WulfrumLureItem.cs @@ -1,8 +1,8 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Items.Accessories; +using CalamityMod.Items.Accessories; +using CalamityMod.Items.Materials; +using CalamityMod.Tiles.Furniture; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Tiles.Furniture; namespace CalamityMod.Items.Placeables.Furniture { diff --git a/Items/Placeables/FurnitureAbyss/AbyssBathtub.cs b/Items/Placeables/FurnitureAbyss/AbyssBathtub.cs index 5ba5a5b9c8..7c54e2cd45 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssBathtub.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssBathtub.cs @@ -1,6 +1,6 @@ using CalamityMod.Tiles.Furniture.CraftingStations; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAbyss { diff --git a/Items/Placeables/FurnitureAbyss/AbyssBed.cs b/Items/Placeables/FurnitureAbyss/AbyssBed.cs index b70ff6dc2d..c808d797f2 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssBed.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssBed.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAbyss diff --git a/Items/Placeables/FurnitureAbyss/AbyssBookcase.cs b/Items/Placeables/FurnitureAbyss/AbyssBookcase.cs index 402dc8ba44..e69876ccf6 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssBookcase.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssBookcase.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAbyss diff --git a/Items/Placeables/FurnitureAbyss/AbyssCandelabra.cs b/Items/Placeables/FurnitureAbyss/AbyssCandelabra.cs index f9018968aa..1404b8bd30 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssCandelabra.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssCandelabra.cs @@ -1,6 +1,6 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; -using Terraria.ModLoader; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAbyss { diff --git a/Items/Placeables/FurnitureAbyss/AbyssCandle.cs b/Items/Placeables/FurnitureAbyss/AbyssCandle.cs index cb72118431..31dbe6c5cb 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssCandle.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssCandle.cs @@ -1,6 +1,6 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; -using Terraria.ModLoader; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAbyss { diff --git a/Items/Placeables/FurnitureAbyss/AbyssChair.cs b/Items/Placeables/FurnitureAbyss/AbyssChair.cs index 49a3652fc3..7796c00e0c 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssChair.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssChair.cs @@ -1,6 +1,6 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; -using Terraria.ModLoader; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAbyss { diff --git a/Items/Placeables/FurnitureAbyss/AbyssChandelier.cs b/Items/Placeables/FurnitureAbyss/AbyssChandelier.cs index 5c7f1a14a8..97f7b6636e 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssChandelier.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssChandelier.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAbyss diff --git a/Items/Placeables/FurnitureAbyss/AbyssDoor.cs b/Items/Placeables/FurnitureAbyss/AbyssDoor.cs index b20cd943b4..db631d892d 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssDoor.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssDoor.cs @@ -1,7 +1,7 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureAbyss; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAbyss { diff --git a/Items/Placeables/FurnitureAbyss/AbyssDresser.cs b/Items/Placeables/FurnitureAbyss/AbyssDresser.cs index f46182f671..605b0a20da 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssDresser.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssDresser.cs @@ -1,6 +1,6 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; -using Terraria.ModLoader; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAbyss { diff --git a/Items/Placeables/FurnitureAbyss/AbyssLamp.cs b/Items/Placeables/FurnitureAbyss/AbyssLamp.cs index f92d3e0fd6..72e8b90406 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssLamp.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssLamp.cs @@ -1,6 +1,6 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; -using Terraria.ModLoader; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAbyss { diff --git a/Items/Placeables/FurnitureAbyss/AbyssLantern.cs b/Items/Placeables/FurnitureAbyss/AbyssLantern.cs index 92b7dfb4d2..c1719fc5cb 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssLantern.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssLantern.cs @@ -1,6 +1,6 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; -using Terraria.ModLoader; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAbyss { diff --git a/Items/Placeables/FurnitureAbyss/AbyssSink.cs b/Items/Placeables/FurnitureAbyss/AbyssSink.cs index db6065572e..c9a9ece1d3 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssSink.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssSink.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAbyss diff --git a/Items/Placeables/FurnitureAbyss/AbyssSofa.cs b/Items/Placeables/FurnitureAbyss/AbyssSofa.cs index a463c66ec9..04bfeebc27 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssSofa.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssSofa.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAbyss diff --git a/Items/Placeables/FurnitureAbyss/AbyssTable.cs b/Items/Placeables/FurnitureAbyss/AbyssTable.cs index 7f901e49f0..d88e11ce8d 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssTable.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssTable.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; diff --git a/Items/Placeables/FurnitureAbyss/AbyssTorch.cs b/Items/Placeables/FurnitureAbyss/AbyssTorch.cs index 3da30b5c25..2d9c8903d3 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssTorch.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssTorch.cs @@ -12,9 +12,9 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss public override void SetStaticDefaults() { Item.ResearchUnlockCount = 100; - ItemID.Sets.Torches[Item.type] = true; - ItemID.Sets.SingleUseInGamepad[Type] = true; - ItemID.Sets.WaterTorches[Item.type] = true; + ItemID.Sets.Torches[Item.type] = true; + ItemID.Sets.SingleUseInGamepad[Type] = true; + ItemID.Sets.WaterTorches[Item.type] = true; ItemID.Sets.ShimmerTransformToItem[Type] = ItemID.ShimmerTorch; } @@ -40,7 +40,7 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss { if (Main.rand.NextBool(player.itemAnimation > 0 ? 10 : 20)) { - Dust.NewDust(new Vector2(player.itemLocation.X + 16f * player.direction, player.itemLocation.Y - 14f * player.gravDir), 4, 4, 180); + Dust.NewDust(new Vector2(player.itemLocation.X + 16f * player.direction, player.itemLocation.Y - 14f * player.gravDir), 4, 4, DustID.DungeonSpirit); } Vector2 position = player.RotatedRelativePoint(new Vector2(player.itemLocation.X + 12f * player.direction + player.velocity.X, player.itemLocation.Y - 14f + player.velocity.Y), true); Lighting.AddLight(position, 0.5f, 0.5f, 2f); diff --git a/Items/Placeables/FurnitureAcidwood/AcidwoodBathtub.cs b/Items/Placeables/FurnitureAcidwood/AcidwoodBathtub.cs index b1f62c2c22..933bf3b10e 100644 --- a/Items/Placeables/FurnitureAcidwood/AcidwoodBathtub.cs +++ b/Items/Placeables/FurnitureAcidwood/AcidwoodBathtub.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.FurnitureAcidwood; +using CalamityMod.Tiles.FurnitureAcidwood; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAcidwood diff --git a/Items/Placeables/FurnitureAcidwood/AcidwoodBed.cs b/Items/Placeables/FurnitureAcidwood/AcidwoodBed.cs index 12384c9c17..d51e2e3bc7 100644 --- a/Items/Placeables/FurnitureAcidwood/AcidwoodBed.cs +++ b/Items/Placeables/FurnitureAcidwood/AcidwoodBed.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.FurnitureAcidwood; +using CalamityMod.Tiles.FurnitureAcidwood; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAcidwood diff --git a/Items/Placeables/FurnitureAcidwood/AcidwoodBench.cs b/Items/Placeables/FurnitureAcidwood/AcidwoodBench.cs index 983a702d58..99b5988ae4 100644 --- a/Items/Placeables/FurnitureAcidwood/AcidwoodBench.cs +++ b/Items/Placeables/FurnitureAcidwood/AcidwoodBench.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.FurnitureAcidwood; +using CalamityMod.Tiles.FurnitureAcidwood; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAcidwood diff --git a/Items/Placeables/FurnitureAcidwood/AcidwoodBookcase.cs b/Items/Placeables/FurnitureAcidwood/AcidwoodBookcase.cs index d02f0406b5..067886fdf8 100644 --- a/Items/Placeables/FurnitureAcidwood/AcidwoodBookcase.cs +++ b/Items/Placeables/FurnitureAcidwood/AcidwoodBookcase.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.FurnitureAcidwood; +using CalamityMod.Tiles.FurnitureAcidwood; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAcidwood diff --git a/Items/Placeables/FurnitureAcidwood/AcidwoodCandelabra.cs b/Items/Placeables/FurnitureAcidwood/AcidwoodCandelabra.cs index 47e28e49f7..d90bed601d 100644 --- a/Items/Placeables/FurnitureAcidwood/AcidwoodCandelabra.cs +++ b/Items/Placeables/FurnitureAcidwood/AcidwoodCandelabra.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.FurnitureAcidwood; +using CalamityMod.Tiles.FurnitureAcidwood; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAcidwood diff --git a/Items/Placeables/FurnitureAcidwood/AcidwoodCandle.cs b/Items/Placeables/FurnitureAcidwood/AcidwoodCandle.cs index 6134ed78f7..896be25ba8 100644 --- a/Items/Placeables/FurnitureAcidwood/AcidwoodCandle.cs +++ b/Items/Placeables/FurnitureAcidwood/AcidwoodCandle.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.FurnitureAcidwood; +using CalamityMod.Tiles.FurnitureAcidwood; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAcidwood diff --git a/Items/Placeables/FurnitureAcidwood/AcidwoodChair.cs b/Items/Placeables/FurnitureAcidwood/AcidwoodChair.cs index a0be79e4ee..b190fa244e 100644 --- a/Items/Placeables/FurnitureAcidwood/AcidwoodChair.cs +++ b/Items/Placeables/FurnitureAcidwood/AcidwoodChair.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.FurnitureAcidwood; +using CalamityMod.Tiles.FurnitureAcidwood; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAcidwood diff --git a/Items/Placeables/FurnitureAcidwood/AcidwoodChandelier.cs b/Items/Placeables/FurnitureAcidwood/AcidwoodChandelier.cs index 0ef4aa7d26..c4f2074f05 100644 --- a/Items/Placeables/FurnitureAcidwood/AcidwoodChandelier.cs +++ b/Items/Placeables/FurnitureAcidwood/AcidwoodChandelier.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.FurnitureAcidwood; +using CalamityMod.Tiles.FurnitureAcidwood; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAcidwood diff --git a/Items/Placeables/FurnitureAcidwood/AcidwoodChest.cs b/Items/Placeables/FurnitureAcidwood/AcidwoodChest.cs index 6c0084ac39..34aa08d220 100644 --- a/Items/Placeables/FurnitureAcidwood/AcidwoodChest.cs +++ b/Items/Placeables/FurnitureAcidwood/AcidwoodChest.cs @@ -1,6 +1,6 @@ using CalamityMod.Tiles.FurnitureAcidwood; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAcidwood { public class AcidwoodChest : ModItem, ILocalizedModType diff --git a/Items/Placeables/FurnitureAcidwood/AcidwoodDoor.cs b/Items/Placeables/FurnitureAcidwood/AcidwoodDoor.cs index 07faf90801..11191f6251 100644 --- a/Items/Placeables/FurnitureAcidwood/AcidwoodDoor.cs +++ b/Items/Placeables/FurnitureAcidwood/AcidwoodDoor.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.FurnitureAcidwood; +using CalamityMod.Tiles.FurnitureAcidwood; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAcidwood diff --git a/Items/Placeables/FurnitureAcidwood/AcidwoodDresser.cs b/Items/Placeables/FurnitureAcidwood/AcidwoodDresser.cs index 2e245e02ac..961c718a8e 100644 --- a/Items/Placeables/FurnitureAcidwood/AcidwoodDresser.cs +++ b/Items/Placeables/FurnitureAcidwood/AcidwoodDresser.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.FurnitureAcidwood; +using CalamityMod.Tiles.FurnitureAcidwood; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAcidwood diff --git a/Items/Placeables/FurnitureAcidwood/AcidwoodLamp.cs b/Items/Placeables/FurnitureAcidwood/AcidwoodLamp.cs index d236d87902..1b72b87fbd 100644 --- a/Items/Placeables/FurnitureAcidwood/AcidwoodLamp.cs +++ b/Items/Placeables/FurnitureAcidwood/AcidwoodLamp.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.FurnitureAcidwood; +using CalamityMod.Tiles.FurnitureAcidwood; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAcidwood diff --git a/Items/Placeables/FurnitureAcidwood/AcidwoodLantern.cs b/Items/Placeables/FurnitureAcidwood/AcidwoodLantern.cs index 10065342ae..167c805c5a 100644 --- a/Items/Placeables/FurnitureAcidwood/AcidwoodLantern.cs +++ b/Items/Placeables/FurnitureAcidwood/AcidwoodLantern.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.FurnitureAcidwood; +using CalamityMod.Tiles.FurnitureAcidwood; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAcidwood diff --git a/Items/Placeables/FurnitureAcidwood/AcidwoodPiano.cs b/Items/Placeables/FurnitureAcidwood/AcidwoodPiano.cs index ab6172e5c6..a57ce93fb4 100644 --- a/Items/Placeables/FurnitureAcidwood/AcidwoodPiano.cs +++ b/Items/Placeables/FurnitureAcidwood/AcidwoodPiano.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.FurnitureAcidwood; +using CalamityMod.Tiles.FurnitureAcidwood; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAcidwood diff --git a/Items/Placeables/FurnitureAcidwood/AcidwoodSink.cs b/Items/Placeables/FurnitureAcidwood/AcidwoodSink.cs index f491ce63c4..4802b4a917 100644 --- a/Items/Placeables/FurnitureAcidwood/AcidwoodSink.cs +++ b/Items/Placeables/FurnitureAcidwood/AcidwoodSink.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.FurnitureAcidwood; +using CalamityMod.Tiles.FurnitureAcidwood; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAcidwood diff --git a/Items/Placeables/FurnitureAcidwood/AcidwoodTable.cs b/Items/Placeables/FurnitureAcidwood/AcidwoodTable.cs index 501ef588f9..d430c838c9 100644 --- a/Items/Placeables/FurnitureAcidwood/AcidwoodTable.cs +++ b/Items/Placeables/FurnitureAcidwood/AcidwoodTable.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.FurnitureAcidwood; +using CalamityMod.Tiles.FurnitureAcidwood; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAcidwood diff --git a/Items/Placeables/FurnitureAncient/AncientBasin.cs b/Items/Placeables/FurnitureAncient/AncientBasin.cs index 02413b96a4..7251f846dd 100644 --- a/Items/Placeables/FurnitureAncient/AncientBasin.cs +++ b/Items/Placeables/FurnitureAncient/AncientBasin.cs @@ -1,8 +1,8 @@ - + using CalamityMod.Items.Placeables.Ores; using CalamityMod.Tiles.Furniture.CraftingStations; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAncient { diff --git a/Items/Placeables/FurnitureAncient/AncientBathtub.cs b/Items/Placeables/FurnitureAncient/AncientBathtub.cs index cffe72882c..1793094e60 100644 --- a/Items/Placeables/FurnitureAncient/AncientBathtub.cs +++ b/Items/Placeables/FurnitureAncient/AncientBathtub.cs @@ -1,6 +1,6 @@ using CalamityMod.Tiles.Furniture.CraftingStations; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAncient { diff --git a/Items/Placeables/FurnitureAncient/AncientBed.cs b/Items/Placeables/FurnitureAncient/AncientBed.cs index b32db904c9..60d9354327 100644 --- a/Items/Placeables/FurnitureAncient/AncientBed.cs +++ b/Items/Placeables/FurnitureAncient/AncientBed.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAncient diff --git a/Items/Placeables/FurnitureAncient/AncientBookcase.cs b/Items/Placeables/FurnitureAncient/AncientBookcase.cs index 5b19b0d2d8..43d34274f3 100644 --- a/Items/Placeables/FurnitureAncient/AncientBookcase.cs +++ b/Items/Placeables/FurnitureAncient/AncientBookcase.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAncient diff --git a/Items/Placeables/FurnitureAncient/AncientChair.cs b/Items/Placeables/FurnitureAncient/AncientChair.cs index 151d355105..b6d68865ec 100644 --- a/Items/Placeables/FurnitureAncient/AncientChair.cs +++ b/Items/Placeables/FurnitureAncient/AncientChair.cs @@ -1,6 +1,6 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; -using Terraria.ModLoader; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAncient { diff --git a/Items/Placeables/FurnitureAncient/AncientChandelier.cs b/Items/Placeables/FurnitureAncient/AncientChandelier.cs index 014676241d..36f9673a3e 100644 --- a/Items/Placeables/FurnitureAncient/AncientChandelier.cs +++ b/Items/Placeables/FurnitureAncient/AncientChandelier.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAncient diff --git a/Items/Placeables/FurnitureAncient/AncientDoor.cs b/Items/Placeables/FurnitureAncient/AncientDoor.cs index ae255b2860..0b54afa0af 100644 --- a/Items/Placeables/FurnitureAncient/AncientDoor.cs +++ b/Items/Placeables/FurnitureAncient/AncientDoor.cs @@ -1,7 +1,7 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureAncient; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAncient { diff --git a/Items/Placeables/FurnitureAncient/AncientDresser.cs b/Items/Placeables/FurnitureAncient/AncientDresser.cs index 06b1f4309a..a634980cea 100644 --- a/Items/Placeables/FurnitureAncient/AncientDresser.cs +++ b/Items/Placeables/FurnitureAncient/AncientDresser.cs @@ -1,6 +1,6 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; -using Terraria.ModLoader; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAncient { diff --git a/Items/Placeables/FurnitureAncient/AncientLamp.cs b/Items/Placeables/FurnitureAncient/AncientLamp.cs index 4a186bf8cd..a51564d5e8 100644 --- a/Items/Placeables/FurnitureAncient/AncientLamp.cs +++ b/Items/Placeables/FurnitureAncient/AncientLamp.cs @@ -1,6 +1,6 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; -using Terraria.ModLoader; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAncient { diff --git a/Items/Placeables/FurnitureAncient/AncientLantern.cs b/Items/Placeables/FurnitureAncient/AncientLantern.cs index 9da1968674..d0a56bb96d 100644 --- a/Items/Placeables/FurnitureAncient/AncientLantern.cs +++ b/Items/Placeables/FurnitureAncient/AncientLantern.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAncient diff --git a/Items/Placeables/FurnitureAncient/AncientMonolith.cs b/Items/Placeables/FurnitureAncient/AncientMonolith.cs index 5e00320495..25f32136c7 100644 --- a/Items/Placeables/FurnitureAncient/AncientMonolith.cs +++ b/Items/Placeables/FurnitureAncient/AncientMonolith.cs @@ -1,6 +1,6 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; -using Terraria.ModLoader; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAncient { diff --git a/Items/Placeables/FurnitureAncient/AncientSink.cs b/Items/Placeables/FurnitureAncient/AncientSink.cs index 39fa874dfa..0c66ebc8d8 100644 --- a/Items/Placeables/FurnitureAncient/AncientSink.cs +++ b/Items/Placeables/FurnitureAncient/AncientSink.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAncient diff --git a/Items/Placeables/FurnitureAncient/AncientSofa.cs b/Items/Placeables/FurnitureAncient/AncientSofa.cs index 765aa29246..bf2224b9d0 100644 --- a/Items/Placeables/FurnitureAncient/AncientSofa.cs +++ b/Items/Placeables/FurnitureAncient/AncientSofa.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAncient diff --git a/Items/Placeables/FurnitureAncient/AncientTable.cs b/Items/Placeables/FurnitureAncient/AncientTable.cs index c2acfec7ec..9cdc9de4be 100644 --- a/Items/Placeables/FurnitureAncient/AncientTable.cs +++ b/Items/Placeables/FurnitureAncient/AncientTable.cs @@ -1,6 +1,6 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; -using Terraria.ModLoader; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAncient { diff --git a/Items/Placeables/FurnitureAncient/AncientWorkBench.cs b/Items/Placeables/FurnitureAncient/AncientWorkBench.cs index 33321d1ecd..1f781cbdb8 100644 --- a/Items/Placeables/FurnitureAncient/AncientWorkBench.cs +++ b/Items/Placeables/FurnitureAncient/AncientWorkBench.cs @@ -1,6 +1,6 @@ using CalamityMod.Tiles.Furniture.CraftingStations; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAncient { diff --git a/Items/Placeables/FurnitureAshen/AshenAccentSlab.cs b/Items/Placeables/FurnitureAshen/AshenAccentSlab.cs index 85b42ceab0..6ecb499c40 100644 --- a/Items/Placeables/FurnitureAshen/AshenAccentSlab.cs +++ b/Items/Placeables/FurnitureAshen/AshenAccentSlab.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen public override void SetStaticDefaults() { Item.ResearchUnlockCount = 100; - } + } public override void SetDefaults() { diff --git a/Items/Placeables/FurnitureAshen/AshenBasin.cs b/Items/Placeables/FurnitureAshen/AshenBasin.cs index ae11cf0880..f600afabb4 100644 --- a/Items/Placeables/FurnitureAshen/AshenBasin.cs +++ b/Items/Placeables/FurnitureAshen/AshenBasin.cs @@ -1,7 +1,8 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Tiles.Furniture.CraftingStations; -using Terraria.ModLoader; +using Terraria; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAshen { @@ -29,6 +30,7 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen AddIngredient(10). AddIngredient(5). AddTile(). + AddDecraftCondition(Condition.DownedMechBossAny). Register(); } } diff --git a/Items/Placeables/FurnitureAshen/AshenBathtub.cs b/Items/Placeables/FurnitureAshen/AshenBathtub.cs index eae7bbf1b6..eaaaef4f46 100644 --- a/Items/Placeables/FurnitureAshen/AshenBathtub.cs +++ b/Items/Placeables/FurnitureAshen/AshenBathtub.cs @@ -1,6 +1,6 @@ using CalamityMod.Tiles.Furniture.CraftingStations; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAshen { diff --git a/Items/Placeables/FurnitureAshen/AshenBed.cs b/Items/Placeables/FurnitureAshen/AshenBed.cs index a9328d4641..8bb7335a41 100644 --- a/Items/Placeables/FurnitureAshen/AshenBed.cs +++ b/Items/Placeables/FurnitureAshen/AshenBed.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAshen diff --git a/Items/Placeables/FurnitureAshen/AshenBookcase.cs b/Items/Placeables/FurnitureAshen/AshenBookcase.cs index 0d834395ef..612747bf6f 100644 --- a/Items/Placeables/FurnitureAshen/AshenBookcase.cs +++ b/Items/Placeables/FurnitureAshen/AshenBookcase.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAshen diff --git a/Items/Placeables/FurnitureAshen/AshenCandelabra.cs b/Items/Placeables/FurnitureAshen/AshenCandelabra.cs index 5c11053806..8139eab35c 100644 --- a/Items/Placeables/FurnitureAshen/AshenCandelabra.cs +++ b/Items/Placeables/FurnitureAshen/AshenCandelabra.cs @@ -1,6 +1,6 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; -using Terraria.ModLoader; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAshen { diff --git a/Items/Placeables/FurnitureAshen/AshenCandle.cs b/Items/Placeables/FurnitureAshen/AshenCandle.cs index cb77030cb3..071a940e80 100644 --- a/Items/Placeables/FurnitureAshen/AshenCandle.cs +++ b/Items/Placeables/FurnitureAshen/AshenCandle.cs @@ -1,6 +1,6 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; -using Terraria.ModLoader; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAshen { diff --git a/Items/Placeables/FurnitureAshen/AshenChair.cs b/Items/Placeables/FurnitureAshen/AshenChair.cs index 328870ff3f..8453fefe9e 100644 --- a/Items/Placeables/FurnitureAshen/AshenChair.cs +++ b/Items/Placeables/FurnitureAshen/AshenChair.cs @@ -1,6 +1,6 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; -using Terraria.ModLoader; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAshen { diff --git a/Items/Placeables/FurnitureAshen/AshenChandelier.cs b/Items/Placeables/FurnitureAshen/AshenChandelier.cs index 166e9ec271..4cf40a483b 100644 --- a/Items/Placeables/FurnitureAshen/AshenChandelier.cs +++ b/Items/Placeables/FurnitureAshen/AshenChandelier.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAshen diff --git a/Items/Placeables/FurnitureAshen/AshenDoor.cs b/Items/Placeables/FurnitureAshen/AshenDoor.cs index 0846e2b274..ef6f100b18 100644 --- a/Items/Placeables/FurnitureAshen/AshenDoor.cs +++ b/Items/Placeables/FurnitureAshen/AshenDoor.cs @@ -1,7 +1,7 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureAshen; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAshen { diff --git a/Items/Placeables/FurnitureAshen/AshenDresser.cs b/Items/Placeables/FurnitureAshen/AshenDresser.cs index f6306d753f..705894203a 100644 --- a/Items/Placeables/FurnitureAshen/AshenDresser.cs +++ b/Items/Placeables/FurnitureAshen/AshenDresser.cs @@ -1,6 +1,6 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; -using Terraria.ModLoader; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAshen { diff --git a/Items/Placeables/FurnitureAshen/AshenLamp.cs b/Items/Placeables/FurnitureAshen/AshenLamp.cs index 01bb17a9ee..71cec7023f 100644 --- a/Items/Placeables/FurnitureAshen/AshenLamp.cs +++ b/Items/Placeables/FurnitureAshen/AshenLamp.cs @@ -1,6 +1,6 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; -using Terraria.ModLoader; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAshen { diff --git a/Items/Placeables/FurnitureAshen/AshenLantern.cs b/Items/Placeables/FurnitureAshen/AshenLantern.cs index 2a8822801b..e8e9792e7d 100644 --- a/Items/Placeables/FurnitureAshen/AshenLantern.cs +++ b/Items/Placeables/FurnitureAshen/AshenLantern.cs @@ -1,6 +1,6 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; -using Terraria.ModLoader; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAshen { diff --git a/Items/Placeables/FurnitureAshen/AshenMonolith.cs b/Items/Placeables/FurnitureAshen/AshenMonolith.cs index c2c227e1ec..b6e754807f 100644 --- a/Items/Placeables/FurnitureAshen/AshenMonolith.cs +++ b/Items/Placeables/FurnitureAshen/AshenMonolith.cs @@ -1,6 +1,6 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; -using Terraria.ModLoader; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAshen { diff --git a/Items/Placeables/FurnitureAshen/AshenPlatform.cs b/Items/Placeables/FurnitureAshen/AshenPlatform.cs index 016d43f416..0efaa6cfe6 100644 --- a/Items/Placeables/FurnitureAshen/AshenPlatform.cs +++ b/Items/Placeables/FurnitureAshen/AshenPlatform.cs @@ -1,6 +1,6 @@ using CalamityMod.Tiles.Furniture.CraftingStations; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAshen { diff --git a/Items/Placeables/FurnitureAshen/AshenSink.cs b/Items/Placeables/FurnitureAshen/AshenSink.cs index 7454b9e380..3ca42ba058 100644 --- a/Items/Placeables/FurnitureAshen/AshenSink.cs +++ b/Items/Placeables/FurnitureAshen/AshenSink.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAshen diff --git a/Items/Placeables/FurnitureAshen/AshenSofa.cs b/Items/Placeables/FurnitureAshen/AshenSofa.cs index abf91bf752..e6a8db51b8 100644 --- a/Items/Placeables/FurnitureAshen/AshenSofa.cs +++ b/Items/Placeables/FurnitureAshen/AshenSofa.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAshen diff --git a/Items/Placeables/FurnitureAshen/AshenTable.cs b/Items/Placeables/FurnitureAshen/AshenTable.cs index 8ec459ad3c..32d69d841b 100644 --- a/Items/Placeables/FurnitureAshen/AshenTable.cs +++ b/Items/Placeables/FurnitureAshen/AshenTable.cs @@ -1,6 +1,6 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; -using Terraria.ModLoader; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAshen { diff --git a/Items/Placeables/FurnitureAshen/AshenWorkBench.cs b/Items/Placeables/FurnitureAshen/AshenWorkBench.cs index ee045e52b4..5fd0df5f9e 100644 --- a/Items/Placeables/FurnitureAshen/AshenWorkBench.cs +++ b/Items/Placeables/FurnitureAshen/AshenWorkBench.cs @@ -1,6 +1,6 @@ using CalamityMod.Tiles.Furniture.CraftingStations; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAshen { diff --git a/Items/Placeables/FurnitureAuric/ActivatedAuricPanel.cs b/Items/Placeables/FurnitureAuric/ActivatedAuricPanel.cs new file mode 100644 index 0000000000..b989ac4973 --- /dev/null +++ b/Items/Placeables/FurnitureAuric/ActivatedAuricPanel.cs @@ -0,0 +1,42 @@ +using CalamityMod.Items.Placeables.Ores; +using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.FurnitureAuric; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.FurnitureAuric +{ + public class ActivatedAuricPanel : 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(400). + AddRecipeGroup("AnyStoneBlock", 400). + AddIngredient(). + AddTile(). + Register(); + /*CreateRecipe(). + AddIngredient(4). + AddTile(TileID.WorkBenches). + Register();*/ + } + } +} diff --git a/Items/Placeables/FurnitureAuric/ActivatedAuricPanel.png b/Items/Placeables/FurnitureAuric/ActivatedAuricPanel.png new file mode 100644 index 0000000000..61a7434c8e Binary files /dev/null and b/Items/Placeables/FurnitureAuric/ActivatedAuricPanel.png differ diff --git a/Items/Placeables/FurnitureAuric/AuricAbsorber.cs b/Items/Placeables/FurnitureAuric/AuricAbsorber.cs new file mode 100644 index 0000000000..c6747122ed --- /dev/null +++ b/Items/Placeables/FurnitureAuric/AuricAbsorber.cs @@ -0,0 +1,40 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Ores; +using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.FurnitureAuric; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.FurnitureAuric +{ + public class AuricAbsorber : 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(400). + AddRecipeGroup("AnyStoneBlock", 400). + AddIngredient(). + AddIngredient(). + AddTile(). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureAuric/AuricAbsorber.png b/Items/Placeables/FurnitureAuric/AuricAbsorber.png new file mode 100644 index 0000000000..e1ba34282c Binary files /dev/null and b/Items/Placeables/FurnitureAuric/AuricAbsorber.png differ diff --git a/Items/Placeables/FurnitureAuric/AuricConsole.cs b/Items/Placeables/FurnitureAuric/AuricConsole.cs new file mode 100644 index 0000000000..4e33dbd08a --- /dev/null +++ b/Items/Placeables/FurnitureAuric/AuricConsole.cs @@ -0,0 +1,34 @@ +using CalamityMod.Items.DraedonMisc; +using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.FurnitureAuric; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.FurnitureAuric +{ + public class AuricConsole : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + 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(10). + AddIngredient(8). + AddTile(). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureAuric/AuricConsole.png b/Items/Placeables/FurnitureAuric/AuricConsole.png new file mode 100644 index 0000000000..88a2f071b7 Binary files /dev/null and b/Items/Placeables/FurnitureAuric/AuricConsole.png differ diff --git a/Items/Placeables/FurnitureAuric/AuricDisplay.cs b/Items/Placeables/FurnitureAuric/AuricDisplay.cs new file mode 100644 index 0000000000..dd3a605fb8 --- /dev/null +++ b/Items/Placeables/FurnitureAuric/AuricDisplay.cs @@ -0,0 +1,34 @@ +using CalamityMod.Items.DraedonMisc; +using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.FurnitureAuric; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.FurnitureAuric +{ + public class AuricDisplay : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + 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(15). + AddIngredient(5). + AddTile(). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureAuric/AuricDisplay.png b/Items/Placeables/FurnitureAuric/AuricDisplay.png new file mode 100644 index 0000000000..c720851fe6 Binary files /dev/null and b/Items/Placeables/FurnitureAuric/AuricDisplay.png differ diff --git a/Items/Placeables/FurnitureAuric/AuricPanel.cs b/Items/Placeables/FurnitureAuric/AuricPanel.cs new file mode 100644 index 0000000000..eb62611375 --- /dev/null +++ b/Items/Placeables/FurnitureAuric/AuricPanel.cs @@ -0,0 +1,45 @@ +using CalamityMod.Items.Placeables.Ores; +using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.FurnitureAuric; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.FurnitureAuric +{ + public class AuricPanel : 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(400). + AddRecipeGroup("AnyStoneBlock", 400). + AddIngredient(). + AddTile(). + Register(); + CreateRecipe(). + AddIngredient(2). + Register(); + /*CreateRecipe(). + AddIngredient(4). + AddTile(TileID.WorkBenches). + Register();*/ + } + } +} diff --git a/Items/Placeables/FurnitureAuric/AuricPanel.png b/Items/Placeables/FurnitureAuric/AuricPanel.png new file mode 100644 index 0000000000..befcaa7cc1 Binary files /dev/null and b/Items/Placeables/FurnitureAuric/AuricPanel.png differ diff --git a/Items/Placeables/FurnitureAuric/AuricPlatform.cs b/Items/Placeables/FurnitureAuric/AuricPlatform.cs new file mode 100644 index 0000000000..4a56e280e4 --- /dev/null +++ b/Items/Placeables/FurnitureAuric/AuricPlatform.cs @@ -0,0 +1,36 @@ +using CalamityMod.Tiles.FurnitureAuric; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.FurnitureAuric +{ + public class AuricPlatform : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 200; + } + + public override void SetDefaults() + { + Item.width = 8; + Item.height = 10; + 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(2). + AddIngredient(). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureAuric/AuricPlatform.png b/Items/Placeables/FurnitureAuric/AuricPlatform.png new file mode 100644 index 0000000000..6a5fa43e3c Binary files /dev/null and b/Items/Placeables/FurnitureAuric/AuricPlatform.png differ diff --git a/Items/Placeables/FurnitureAuric/AuricReinforcedCrate.cs b/Items/Placeables/FurnitureAuric/AuricReinforcedCrate.cs new file mode 100644 index 0000000000..accc587b17 --- /dev/null +++ b/Items/Placeables/FurnitureAuric/AuricReinforcedCrate.cs @@ -0,0 +1,35 @@ +using CalamityMod.Items.DraedonMisc; +using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.FurnitureAuric; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.FurnitureAuric +{ + public class AuricReinforcedCrate : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + 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(7). + AddIngredient(). + AddTile(). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureAuric/AuricReinforcedCrate.png b/Items/Placeables/FurnitureAuric/AuricReinforcedCrate.png new file mode 100644 index 0000000000..07863fdf93 Binary files /dev/null and b/Items/Placeables/FurnitureAuric/AuricReinforcedCrate.png differ diff --git a/Items/Placeables/FurnitureAuric/AuricRepulserPanel.cs b/Items/Placeables/FurnitureAuric/AuricRepulserPanel.cs new file mode 100644 index 0000000000..5c702a42a9 --- /dev/null +++ b/Items/Placeables/FurnitureAuric/AuricRepulserPanel.cs @@ -0,0 +1,38 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.FurnitureAuric; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.FurnitureAuric +{ + public class AuricRepulserPanel : 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(400). + AddIngredient(400). + AddIngredient(). + AddTile(). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureAuric/AuricRepulserPanel.png b/Items/Placeables/FurnitureAuric/AuricRepulserPanel.png new file mode 100644 index 0000000000..633c52209c Binary files /dev/null and b/Items/Placeables/FurnitureAuric/AuricRepulserPanel.png differ diff --git a/Items/Placeables/FurnitureAuric/AuricScreen.cs b/Items/Placeables/FurnitureAuric/AuricScreen.cs new file mode 100644 index 0000000000..0d0f814eac --- /dev/null +++ b/Items/Placeables/FurnitureAuric/AuricScreen.cs @@ -0,0 +1,34 @@ +using CalamityMod.Items.DraedonMisc; +using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.FurnitureAuric; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.FurnitureAuric +{ + public class AuricScreen : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + 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(10). + AddIngredient(3). + AddTile(). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureAuric/AuricScreen.png b/Items/Placeables/FurnitureAuric/AuricScreen.png new file mode 100644 index 0000000000..199491fc1e Binary files /dev/null and b/Items/Placeables/FurnitureAuric/AuricScreen.png differ diff --git a/Items/Placeables/FurnitureAuric/AuricServer.cs b/Items/Placeables/FurnitureAuric/AuricServer.cs new file mode 100644 index 0000000000..5f02f1bae5 --- /dev/null +++ b/Items/Placeables/FurnitureAuric/AuricServer.cs @@ -0,0 +1,34 @@ +using CalamityMod.Items.DraedonMisc; +using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.FurnitureAuric; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.FurnitureAuric +{ + public class AuricServer : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + 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(12). + AddIngredient(15). + AddTile(). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureAuric/AuricServer.png b/Items/Placeables/FurnitureAuric/AuricServer.png new file mode 100644 index 0000000000..c4ee75b74d Binary files /dev/null and b/Items/Placeables/FurnitureAuric/AuricServer.png differ diff --git a/Items/Placeables/FurnitureAuric/AuricTerminal.cs b/Items/Placeables/FurnitureAuric/AuricTerminal.cs new file mode 100644 index 0000000000..fc673ab4cc --- /dev/null +++ b/Items/Placeables/FurnitureAuric/AuricTerminal.cs @@ -0,0 +1,34 @@ +using CalamityMod.Items.DraedonMisc; +using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.FurnitureAuric; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.FurnitureAuric +{ + public class AuricTerminal : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + 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(15). + AddIngredient(5). + AddTile(). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureAuric/AuricTerminal.png b/Items/Placeables/FurnitureAuric/AuricTerminal.png new file mode 100644 index 0000000000..817b3fd706 Binary files /dev/null and b/Items/Placeables/FurnitureAuric/AuricTerminal.png differ diff --git a/Items/Placeables/Furniture/AuricToilet.cs b/Items/Placeables/FurnitureAuric/AuricToilet.cs similarity index 93% rename from Items/Placeables/Furniture/AuricToilet.cs rename to Items/Placeables/FurnitureAuric/AuricToilet.cs index dad94f2e84..94ad188083 100644 --- a/Items/Placeables/Furniture/AuricToilet.cs +++ b/Items/Placeables/FurnitureAuric/AuricToilet.cs @@ -3,11 +3,11 @@ using CalamityMod.Items.Placeables.FurnitureBotanic; using CalamityMod.Items.Placeables.FurnitureCosmilite; using CalamityMod.Items.Placeables.FurnitureSilva; using CalamityMod.Rarities; -using CalamityMod.Tiles.Furniture; using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.FurnitureAuric; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Items.Placeables.Furniture +namespace CalamityMod.Items.Placeables.FurnitureAuric { public class AuricToilet : ModItem, ILocalizedModType { diff --git a/Items/Placeables/Furniture/AuricToilet.png b/Items/Placeables/FurnitureAuric/AuricToilet.png similarity index 100% rename from Items/Placeables/Furniture/AuricToilet.png rename to Items/Placeables/FurnitureAuric/AuricToilet.png diff --git a/Items/Placeables/FurnitureAuric/ExoAuricPanel.cs b/Items/Placeables/FurnitureAuric/ExoAuricPanel.cs new file mode 100644 index 0000000000..3def8fb771 --- /dev/null +++ b/Items/Placeables/FurnitureAuric/ExoAuricPanel.cs @@ -0,0 +1,42 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.FurnitureAuric; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.FurnitureAuric +{ + public class ExoAuricPanel : 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(400). + AddIngredient(400). + AddIngredient(). + AddTile(). + Register(); + /*CreateRecipe(). + AddIngredient(4). + AddTile(TileID.WorkBenches). + Register();*/ + } + } +} diff --git a/Items/Placeables/FurnitureAuric/ExoAuricPanel.png b/Items/Placeables/FurnitureAuric/ExoAuricPanel.png new file mode 100644 index 0000000000..4eb51601f7 Binary files /dev/null and b/Items/Placeables/FurnitureAuric/ExoAuricPanel.png differ diff --git a/Items/Placeables/FurnitureBotanic/BotanicBathtub.cs b/Items/Placeables/FurnitureBotanic/BotanicBathtub.cs index 4f0d49f26d..0b4520c92a 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicBathtub.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicBathtub.cs @@ -1,6 +1,6 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; -using Terraria.ModLoader; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureBotanic { diff --git a/Items/Placeables/FurnitureBotanic/BotanicBed.cs b/Items/Placeables/FurnitureBotanic/BotanicBed.cs index 44ba3f67ec..d01928d0f6 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicBed.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicBed.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureBotanic diff --git a/Items/Placeables/FurnitureBotanic/BotanicBench.cs b/Items/Placeables/FurnitureBotanic/BotanicBench.cs index e90092d16a..6cfd546945 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicBench.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicBench.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureBotanic diff --git a/Items/Placeables/FurnitureBotanic/BotanicBookcase.cs b/Items/Placeables/FurnitureBotanic/BotanicBookcase.cs index ac3456673c..dee9a5bbd7 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicBookcase.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicBookcase.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureBotanic diff --git a/Items/Placeables/FurnitureBotanic/BotanicCandelabra.cs b/Items/Placeables/FurnitureBotanic/BotanicCandelabra.cs index 182140b816..24daac1110 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicCandelabra.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicCandelabra.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureBotanic diff --git a/Items/Placeables/FurnitureBotanic/BotanicCandle.cs b/Items/Placeables/FurnitureBotanic/BotanicCandle.cs index 5b54f4c5c0..40e28ea501 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicCandle.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicCandle.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureBotanic diff --git a/Items/Placeables/FurnitureBotanic/BotanicChair.cs b/Items/Placeables/FurnitureBotanic/BotanicChair.cs index 880d24fe42..06a47d3e42 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicChair.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicChair.cs @@ -1,6 +1,6 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; -using Terraria.ModLoader; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureBotanic { diff --git a/Items/Placeables/FurnitureBotanic/BotanicChandelier.cs b/Items/Placeables/FurnitureBotanic/BotanicChandelier.cs index 7f39370d6f..235d77ede1 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicChandelier.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicChandelier.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureBotanic diff --git a/Items/Placeables/FurnitureBotanic/BotanicDoor.cs b/Items/Placeables/FurnitureBotanic/BotanicDoor.cs index 48f82c4394..b05be6adda 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicDoor.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicDoor.cs @@ -1,7 +1,7 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureBotanic; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureBotanic { diff --git a/Items/Placeables/FurnitureBotanic/BotanicDresser.cs b/Items/Placeables/FurnitureBotanic/BotanicDresser.cs index 567a2d8144..3ecb84cc58 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicDresser.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicDresser.cs @@ -1,6 +1,6 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; -using Terraria.ModLoader; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureBotanic { diff --git a/Items/Placeables/FurnitureBotanic/BotanicLamp.cs b/Items/Placeables/FurnitureBotanic/BotanicLamp.cs index f3af84d841..0d7d62a0a6 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicLamp.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicLamp.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureBotanic diff --git a/Items/Placeables/FurnitureBotanic/BotanicLantern.cs b/Items/Placeables/FurnitureBotanic/BotanicLantern.cs index bb86900d8f..40d9807105 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicLantern.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicLantern.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureBotanic diff --git a/Items/Placeables/FurnitureBotanic/BotanicPiano.cs b/Items/Placeables/FurnitureBotanic/BotanicPiano.cs index a41434c5f7..5bd58b515b 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicPiano.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicPiano.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureBotanic diff --git a/Items/Placeables/FurnitureBotanic/BotanicPlatform.cs b/Items/Placeables/FurnitureBotanic/BotanicPlatform.cs index 711e8b6c1f..0dd631978f 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicPlatform.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicPlatform.cs @@ -1,6 +1,6 @@ using CalamityMod.Tiles.Furniture.CraftingStations; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureBotanic { diff --git a/Items/Placeables/FurnitureBotanic/BotanicSink.cs b/Items/Placeables/FurnitureBotanic/BotanicSink.cs index 77d1c3676d..d63113971f 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicSink.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicSink.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureBotanic diff --git a/Items/Placeables/FurnitureBotanic/BotanicTable.cs b/Items/Placeables/FurnitureBotanic/BotanicTable.cs index 51b8961d9f..5be85cd7f0 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicTable.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicTable.cs @@ -1,6 +1,6 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; -using Terraria.ModLoader; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureBotanic { diff --git a/Items/Placeables/FurnitureBotanic/BotanicWorkBench.cs b/Items/Placeables/FurnitureBotanic/BotanicWorkBench.cs index 47a53189c6..5a28af3d5b 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicWorkBench.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicWorkBench.cs @@ -1,6 +1,6 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; -using Terraria.ModLoader; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureBotanic { diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteBasin.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteBasin.cs index 3be4272d6e..eedbd4fe1d 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteBasin.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteBasin.cs @@ -1,7 +1,7 @@ -using Terraria.ID; -using Terraria.ModLoader; +using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureCosmilite; -using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureCosmilite { diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteBathtub.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteBathtub.cs index 09b332d21e..d364255cfb 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteBathtub.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteBathtub.cs @@ -1,6 +1,6 @@ using CalamityMod.Tiles.Furniture.CraftingStations; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureCosmilite { diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteBed.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteBed.cs index 5015f32366..032852aa40 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteBed.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteBed.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureCosmilite diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteBookcase.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteBookcase.cs index 2cc73eeaec..09ddddcfb5 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteBookcase.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteBookcase.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureCosmilite diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteCandelabra.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteCandelabra.cs index f709cf66fd..d231c10e28 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteCandelabra.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteCandelabra.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureCosmilite diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteCandle.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteCandle.cs index e5dd97bc9d..c01979a0bf 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteCandle.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteCandle.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureCosmilite diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteChair.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteChair.cs index 079160af1f..31854d565d 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteChair.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteChair.cs @@ -1,7 +1,7 @@ - + using CalamityMod.Tiles.Furniture.CraftingStations; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureCosmilite { diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteChandelier.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteChandelier.cs index 44da2c4320..d7b6ad33e4 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteChandelier.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteChandelier.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureCosmilite diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteDoor.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteDoor.cs index b9112098ec..2e323e9fc7 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteDoor.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteDoor.cs @@ -1,7 +1,7 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureCosmilite; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureCosmilite { diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteDresser.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteDresser.cs index 5ffd752f16..9d8b785b93 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteDresser.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteDresser.cs @@ -1,6 +1,6 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; -using Terraria.ModLoader; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureCosmilite { diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteLamp.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteLamp.cs index 661df9345e..6c3f082b66 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteLamp.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteLamp.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureCosmilite diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteLantern.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteLantern.cs index d370b7f202..2e6c148fb9 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteLantern.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteLantern.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureCosmilite diff --git a/Items/Placeables/FurnitureCosmilite/CosmilitePiano.cs b/Items/Placeables/FurnitureCosmilite/CosmilitePiano.cs index ef2b29f26c..b75b27aaff 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmilitePiano.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmilitePiano.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureCosmilite diff --git a/Items/Placeables/FurnitureCosmilite/CosmilitePlatform.cs b/Items/Placeables/FurnitureCosmilite/CosmilitePlatform.cs index 07a1f7f76c..8fa61f61e4 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmilitePlatform.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmilitePlatform.cs @@ -1,6 +1,6 @@ using CalamityMod.Tiles.Furniture.CraftingStations; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureCosmilite { diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteSconce.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteSconce.cs index baedc02e91..969d840ebf 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteSconce.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteSconce.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureCosmilite diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteSink.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteSink.cs index 577cd2c20a..b5784c100b 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteSink.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteSink.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureCosmilite diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteSofa.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteSofa.cs index f6891c7a2b..fb60b2dedd 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteSofa.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteSofa.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureCosmilite diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteTable.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteTable.cs index 12a8d92d94..cc87084155 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteTable.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteTable.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureCosmilite diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteWorkBench.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteWorkBench.cs index fa0b498411..36af66f363 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteWorkBench.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteWorkBench.cs @@ -1,6 +1,6 @@ using CalamityMod.Tiles.Furniture.CraftingStations; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureCosmilite { diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicBathtub.cs b/Items/Placeables/FurnitureEutrophic/EutrophicBathtub.cs index f1356bed29..2eb5d38886 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicBathtub.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicBathtub.cs @@ -1,6 +1,6 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; -using Terraria.ModLoader; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureEutrophic { diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicBench.cs b/Items/Placeables/FurnitureEutrophic/EutrophicBench.cs index 4fde8e8c9b..79a68d1b4b 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicBench.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicBench.cs @@ -1,6 +1,6 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; -using Terraria.ModLoader; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureEutrophic { diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicCandelabra.cs b/Items/Placeables/FurnitureEutrophic/EutrophicCandelabra.cs index 87ba66755f..04b3a6c54c 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicCandelabra.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicCandelabra.cs @@ -1,6 +1,6 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; -using Terraria.ModLoader; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureEutrophic { diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicCandle.cs b/Items/Placeables/FurnitureEutrophic/EutrophicCandle.cs index 89021095f0..57f0a0eff3 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicCandle.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicCandle.cs @@ -1,6 +1,6 @@ using CalamityMod.Tiles.Furniture.CraftingStations; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureEutrophic { diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicChair.cs b/Items/Placeables/FurnitureEutrophic/EutrophicChair.cs index d1a48fe5be..2f5f06c83f 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicChair.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicChair.cs @@ -1,6 +1,6 @@ using CalamityMod.Tiles.Furniture.CraftingStations; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureEutrophic { diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicChandelier.cs b/Items/Placeables/FurnitureEutrophic/EutrophicChandelier.cs index 3ea7519d03..acd06f8d87 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicChandelier.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicChandelier.cs @@ -1,6 +1,6 @@ using CalamityMod.Tiles.Furniture.CraftingStations; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureEutrophic { diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicChest.cs b/Items/Placeables/FurnitureEutrophic/EutrophicChest.cs index de3428e8dc..e8d07bb38d 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicChest.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicChest.cs @@ -1,6 +1,6 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; -using Terraria.ModLoader; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureEutrophic { diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicClock.cs b/Items/Placeables/FurnitureEutrophic/EutrophicClock.cs index 5309946caa..55afad4925 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicClock.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicClock.cs @@ -1,6 +1,6 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; -using Terraria.ModLoader; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureEutrophic { diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicDoor.cs b/Items/Placeables/FurnitureEutrophic/EutrophicDoor.cs index 75721e4f81..7873f04fee 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicDoor.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicDoor.cs @@ -1,7 +1,7 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureEutrophic; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureEutrophic { diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicDresser.cs b/Items/Placeables/FurnitureEutrophic/EutrophicDresser.cs index d868220076..2843e2c5f1 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicDresser.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicDresser.cs @@ -1,6 +1,6 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; -using Terraria.ModLoader; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureEutrophic { diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicLamp.cs b/Items/Placeables/FurnitureEutrophic/EutrophicLamp.cs index fdf88ca3ff..05dd7cd461 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicLamp.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicLamp.cs @@ -1,6 +1,6 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; -using Terraria.ModLoader; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureEutrophic { diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicLantern.cs b/Items/Placeables/FurnitureEutrophic/EutrophicLantern.cs index 6f50a687e5..ec361642e2 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicLantern.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicLantern.cs @@ -1,6 +1,6 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; -using Terraria.ModLoader; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureEutrophic { diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicPiano.cs b/Items/Placeables/FurnitureEutrophic/EutrophicPiano.cs index 5516f23471..ac38f76e80 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicPiano.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicPiano.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureEutrophic diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicPlatform.cs b/Items/Placeables/FurnitureEutrophic/EutrophicPlatform.cs index 5e4c60520e..16a4dada26 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicPlatform.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicPlatform.cs @@ -1,6 +1,6 @@ using CalamityMod.Tiles.Furniture.CraftingStations; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureEutrophic { diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicSink.cs b/Items/Placeables/FurnitureEutrophic/EutrophicSink.cs index efa6b43bf9..929895fd72 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicSink.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicSink.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureEutrophic diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicTable.cs b/Items/Placeables/FurnitureEutrophic/EutrophicTable.cs index f06886526f..0eae7507ee 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicTable.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicTable.cs @@ -1,6 +1,6 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; -using Terraria.ModLoader; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureEutrophic { diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicWorkBench.cs b/Items/Placeables/FurnitureEutrophic/EutrophicWorkBench.cs index 6c90305511..43f2f392fb 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicWorkBench.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicWorkBench.cs @@ -1,6 +1,6 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; -using Terraria.ModLoader; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureEutrophic { diff --git a/Items/Placeables/FurnitureExo/ExoBathtub.cs b/Items/Placeables/FurnitureExo/ExoBathtub.cs index 4a1a38a079..da15f4d711 100644 --- a/Items/Placeables/FurnitureExo/ExoBathtub.cs +++ b/Items/Placeables/FurnitureExo/ExoBathtub.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureExo; using Terraria.ID; using Terraria.ModLoader; diff --git a/Items/Placeables/FurnitureExo/ExoBed.cs b/Items/Placeables/FurnitureExo/ExoBed.cs index fb351adb25..c1ba4fe9f3 100644 --- a/Items/Placeables/FurnitureExo/ExoBed.cs +++ b/Items/Placeables/FurnitureExo/ExoBed.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureExo; using Terraria.ID; using Terraria.ModLoader; diff --git a/Items/Placeables/FurnitureExo/ExoBookcase.cs b/Items/Placeables/FurnitureExo/ExoBookcase.cs index 137610badc..b6653931c5 100644 --- a/Items/Placeables/FurnitureExo/ExoBookcase.cs +++ b/Items/Placeables/FurnitureExo/ExoBookcase.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureExo; using Terraria.ID; using Terraria.ModLoader; diff --git a/Items/Placeables/FurnitureExo/ExoCandelabra.cs b/Items/Placeables/FurnitureExo/ExoCandelabra.cs index 1abe5ced85..31277e70a0 100644 --- a/Items/Placeables/FurnitureExo/ExoCandelabra.cs +++ b/Items/Placeables/FurnitureExo/ExoCandelabra.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureExo; using Terraria.ID; using Terraria.ModLoader; diff --git a/Items/Placeables/FurnitureExo/ExoCandle.cs b/Items/Placeables/FurnitureExo/ExoCandle.cs index c1273ffbc5..841254adad 100644 --- a/Items/Placeables/FurnitureExo/ExoCandle.cs +++ b/Items/Placeables/FurnitureExo/ExoCandle.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureExo; using Terraria.ID; using Terraria.ModLoader; diff --git a/Items/Placeables/FurnitureExo/ExoChair.cs b/Items/Placeables/FurnitureExo/ExoChair.cs index 0b6a9bacd5..a6290afc50 100644 --- a/Items/Placeables/FurnitureExo/ExoChair.cs +++ b/Items/Placeables/FurnitureExo/ExoChair.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureExo; using Terraria.ID; using Terraria.ModLoader; diff --git a/Items/Placeables/FurnitureExo/ExoChandelier.cs b/Items/Placeables/FurnitureExo/ExoChandelier.cs index ee71b05efc..0a4e258f29 100644 --- a/Items/Placeables/FurnitureExo/ExoChandelier.cs +++ b/Items/Placeables/FurnitureExo/ExoChandelier.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureExo; using Terraria.ID; using Terraria.ModLoader; diff --git a/Items/Placeables/FurnitureExo/ExoConsole.cs b/Items/Placeables/FurnitureExo/ExoConsole.cs index c8dca656a9..4083dae865 100644 --- a/Items/Placeables/FurnitureExo/ExoConsole.cs +++ b/Items/Placeables/FurnitureExo/ExoConsole.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.DraedonMisc; +using CalamityMod.Items.DraedonMisc; using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureExo; using Terraria.ID; diff --git a/Items/Placeables/FurnitureExo/ExoDisplay.cs b/Items/Placeables/FurnitureExo/ExoDisplay.cs index f762eda3a9..9e74f970db 100644 --- a/Items/Placeables/FurnitureExo/ExoDisplay.cs +++ b/Items/Placeables/FurnitureExo/ExoDisplay.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.DraedonMisc; +using CalamityMod.Items.DraedonMisc; using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureExo; using Terraria.ID; diff --git a/Items/Placeables/FurnitureExo/ExoDoor.cs b/Items/Placeables/FurnitureExo/ExoDoor.cs index 9de3875a73..69934baca9 100644 --- a/Items/Placeables/FurnitureExo/ExoDoor.cs +++ b/Items/Placeables/FurnitureExo/ExoDoor.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureExo; using Terraria.ID; using Terraria.ModLoader; diff --git a/Items/Placeables/FurnitureExo/ExoDresser.cs b/Items/Placeables/FurnitureExo/ExoDresser.cs index 37a1584e0b..c8e495d245 100644 --- a/Items/Placeables/FurnitureExo/ExoDresser.cs +++ b/Items/Placeables/FurnitureExo/ExoDresser.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureExo; using Terraria.ID; using Terraria.ModLoader; diff --git a/Items/Placeables/FurnitureExo/ExoKeyboard.cs b/Items/Placeables/FurnitureExo/ExoKeyboard.cs index c9b3949cf6..3c1bb42936 100644 --- a/Items/Placeables/FurnitureExo/ExoKeyboard.cs +++ b/Items/Placeables/FurnitureExo/ExoKeyboard.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureExo; using Terraria.ID; using Terraria.ModLoader; diff --git a/Items/Placeables/FurnitureExo/ExoLamp.cs b/Items/Placeables/FurnitureExo/ExoLamp.cs index 3d35abaf3d..56eecb5c75 100644 --- a/Items/Placeables/FurnitureExo/ExoLamp.cs +++ b/Items/Placeables/FurnitureExo/ExoLamp.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureExo; using Terraria.ID; using Terraria.ModLoader; diff --git a/Items/Placeables/FurnitureExo/ExoLantern.cs b/Items/Placeables/FurnitureExo/ExoLantern.cs index c8227459e0..185ef69c61 100644 --- a/Items/Placeables/FurnitureExo/ExoLantern.cs +++ b/Items/Placeables/FurnitureExo/ExoLantern.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureExo; using Terraria.ID; using Terraria.ModLoader; diff --git a/Items/Placeables/FurnitureExo/ExoPlating.cs b/Items/Placeables/FurnitureExo/ExoPlating.cs index c92c32ff40..a0a28d30e3 100644 --- a/Items/Placeables/FurnitureExo/ExoPlating.cs +++ b/Items/Placeables/FurnitureExo/ExoPlating.cs @@ -11,6 +11,10 @@ namespace CalamityMod.Items.Placeables.FurnitureExo public class ExoPlating : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 100; + } public override void SetDefaults() { Item.width = 12; diff --git a/Items/Placeables/FurnitureExo/ExoScreen.cs b/Items/Placeables/FurnitureExo/ExoScreen.cs index d61d8189d9..6eb2cd9cd1 100644 --- a/Items/Placeables/FurnitureExo/ExoScreen.cs +++ b/Items/Placeables/FurnitureExo/ExoScreen.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.DraedonMisc; +using CalamityMod.Items.DraedonMisc; using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureExo; using Terraria.ID; diff --git a/Items/Placeables/FurnitureExo/ExoServer.cs b/Items/Placeables/FurnitureExo/ExoServer.cs index 27865932f3..619e66f1a0 100644 --- a/Items/Placeables/FurnitureExo/ExoServer.cs +++ b/Items/Placeables/FurnitureExo/ExoServer.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.DraedonMisc; +using CalamityMod.Items.DraedonMisc; using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureExo; using Terraria.ID; diff --git a/Items/Placeables/FurnitureExo/ExoSink.cs b/Items/Placeables/FurnitureExo/ExoSink.cs index 9cdcb68c04..636ae6eb52 100644 --- a/Items/Placeables/FurnitureExo/ExoSink.cs +++ b/Items/Placeables/FurnitureExo/ExoSink.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureExo; using Terraria.ID; using Terraria.ModLoader; diff --git a/Items/Placeables/FurnitureExo/ExoSofa.cs b/Items/Placeables/FurnitureExo/ExoSofa.cs index 82bc8be65c..34c3a9421b 100644 --- a/Items/Placeables/FurnitureExo/ExoSofa.cs +++ b/Items/Placeables/FurnitureExo/ExoSofa.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureExo; using Terraria.ID; using Terraria.ModLoader; diff --git a/Items/Placeables/FurnitureExo/ExoTable.cs b/Items/Placeables/FurnitureExo/ExoTable.cs index 80e2b702e9..ff46f03d01 100644 --- a/Items/Placeables/FurnitureExo/ExoTable.cs +++ b/Items/Placeables/FurnitureExo/ExoTable.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureExo; using Terraria.ID; using Terraria.ModLoader; diff --git a/Items/Placeables/FurnitureExo/ExoTerminal.cs b/Items/Placeables/FurnitureExo/ExoTerminal.cs index 89644e5c26..a295237ca3 100644 --- a/Items/Placeables/FurnitureExo/ExoTerminal.cs +++ b/Items/Placeables/FurnitureExo/ExoTerminal.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.DraedonMisc; +using CalamityMod.Items.DraedonMisc; using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureExo; using Terraria.ID; diff --git a/Items/Placeables/FurnitureExo/ExoToilet.cs b/Items/Placeables/FurnitureExo/ExoToilet.cs index 883f7a447d..4cd440f42e 100644 --- a/Items/Placeables/FurnitureExo/ExoToilet.cs +++ b/Items/Placeables/FurnitureExo/ExoToilet.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureExo; using Terraria.ID; using Terraria.ModLoader; diff --git a/Items/Placeables/FurnitureExo/ExoWorkBench.cs b/Items/Placeables/FurnitureExo/ExoWorkBench.cs index eeaf3f8ca5..d097d81061 100644 --- a/Items/Placeables/FurnitureExo/ExoWorkBench.cs +++ b/Items/Placeables/FurnitureExo/ExoWorkBench.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureExo; using Terraria.ID; using Terraria.ModLoader; diff --git a/Items/Placeables/FurnitureMonolith/MonolithBed.cs b/Items/Placeables/FurnitureMonolith/MonolithBed.cs index 057423a574..e1cd427153 100644 --- a/Items/Placeables/FurnitureMonolith/MonolithBed.cs +++ b/Items/Placeables/FurnitureMonolith/MonolithBed.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureMonolith diff --git a/Items/Placeables/FurnitureMonolith/MonolithBench.cs b/Items/Placeables/FurnitureMonolith/MonolithBench.cs index 6842a96dd6..a63601361f 100644 --- a/Items/Placeables/FurnitureMonolith/MonolithBench.cs +++ b/Items/Placeables/FurnitureMonolith/MonolithBench.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureMonolith diff --git a/Items/Placeables/FurnitureMonolith/MonolithBookcase.cs b/Items/Placeables/FurnitureMonolith/MonolithBookcase.cs index 7cf52ddb52..c044244871 100644 --- a/Items/Placeables/FurnitureMonolith/MonolithBookcase.cs +++ b/Items/Placeables/FurnitureMonolith/MonolithBookcase.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureMonolith diff --git a/Items/Placeables/FurnitureMonolith/MonolithCandelabra.cs b/Items/Placeables/FurnitureMonolith/MonolithCandelabra.cs index 7b5ede2bf1..cc7a0cbbb3 100644 --- a/Items/Placeables/FurnitureMonolith/MonolithCandelabra.cs +++ b/Items/Placeables/FurnitureMonolith/MonolithCandelabra.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureMonolith diff --git a/Items/Placeables/FurnitureMonolith/MonolithChair.cs b/Items/Placeables/FurnitureMonolith/MonolithChair.cs index 465644329e..280144c3cb 100644 --- a/Items/Placeables/FurnitureMonolith/MonolithChair.cs +++ b/Items/Placeables/FurnitureMonolith/MonolithChair.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureMonolith diff --git a/Items/Placeables/FurnitureMonolith/MonolithChandelier.cs b/Items/Placeables/FurnitureMonolith/MonolithChandelier.cs index 443016c50a..285b444f2e 100644 --- a/Items/Placeables/FurnitureMonolith/MonolithChandelier.cs +++ b/Items/Placeables/FurnitureMonolith/MonolithChandelier.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureMonolith diff --git a/Items/Placeables/FurnitureMonolith/MonolithChest.cs b/Items/Placeables/FurnitureMonolith/MonolithChest.cs index 5f42f39706..5e17e450d7 100644 --- a/Items/Placeables/FurnitureMonolith/MonolithChest.cs +++ b/Items/Placeables/FurnitureMonolith/MonolithChest.cs @@ -1,6 +1,6 @@ using CalamityMod.Tiles.Furniture.CraftingStations; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureMonolith { public class MonolithChest : ModItem, ILocalizedModType diff --git a/Items/Placeables/FurnitureMonolith/MonolithDoor.cs b/Items/Placeables/FurnitureMonolith/MonolithDoor.cs index 5bc39f8d15..8840647e44 100644 --- a/Items/Placeables/FurnitureMonolith/MonolithDoor.cs +++ b/Items/Placeables/FurnitureMonolith/MonolithDoor.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureMonolith diff --git a/Items/Placeables/FurnitureMonolith/MonolithDresser.cs b/Items/Placeables/FurnitureMonolith/MonolithDresser.cs index 0469b86eff..fb4ace6423 100644 --- a/Items/Placeables/FurnitureMonolith/MonolithDresser.cs +++ b/Items/Placeables/FurnitureMonolith/MonolithDresser.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureMonolith diff --git a/Items/Placeables/FurnitureMonolith/MonolithLamp.cs b/Items/Placeables/FurnitureMonolith/MonolithLamp.cs index 05856c4b43..34ee39420a 100644 --- a/Items/Placeables/FurnitureMonolith/MonolithLamp.cs +++ b/Items/Placeables/FurnitureMonolith/MonolithLamp.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureMonolith diff --git a/Items/Placeables/FurnitureMonolith/MonolithLantern.cs b/Items/Placeables/FurnitureMonolith/MonolithLantern.cs index f712faa5e4..819f420c7c 100644 --- a/Items/Placeables/FurnitureMonolith/MonolithLantern.cs +++ b/Items/Placeables/FurnitureMonolith/MonolithLantern.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureMonolith diff --git a/Items/Placeables/FurnitureMonolith/MonolithPiano.cs b/Items/Placeables/FurnitureMonolith/MonolithPiano.cs index ae75468f7e..4d672cc03d 100644 --- a/Items/Placeables/FurnitureMonolith/MonolithPiano.cs +++ b/Items/Placeables/FurnitureMonolith/MonolithPiano.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureMonolith diff --git a/Items/Placeables/FurnitureMonolith/MonolithSink.cs b/Items/Placeables/FurnitureMonolith/MonolithSink.cs index 2f4a06a6fd..d131fdac33 100644 --- a/Items/Placeables/FurnitureMonolith/MonolithSink.cs +++ b/Items/Placeables/FurnitureMonolith/MonolithSink.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureMonolith diff --git a/Items/Placeables/FurnitureMonolith/MonolithTable.cs b/Items/Placeables/FurnitureMonolith/MonolithTable.cs index 7f530e4f60..1e184ccbdd 100644 --- a/Items/Placeables/FurnitureMonolith/MonolithTable.cs +++ b/Items/Placeables/FurnitureMonolith/MonolithTable.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureMonolith diff --git a/Items/Placeables/FurnitureMonolith/MonolithWorkBench.cs b/Items/Placeables/FurnitureMonolith/MonolithWorkBench.cs index daf5508929..faa7778f48 100644 --- a/Items/Placeables/FurnitureMonolith/MonolithWorkBench.cs +++ b/Items/Placeables/FurnitureMonolith/MonolithWorkBench.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureMonolith diff --git a/Items/Placeables/FurnitureOtherworldly/OtherworldlyBathtub.cs b/Items/Placeables/FurnitureOtherworldly/OtherworldlyBathtub.cs index e26303dc92..6602e6f558 100644 --- a/Items/Placeables/FurnitureOtherworldly/OtherworldlyBathtub.cs +++ b/Items/Placeables/FurnitureOtherworldly/OtherworldlyBathtub.cs @@ -1,5 +1,5 @@ -using Terraria.ModLoader; -using Terraria.ID; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureOtherworldly { [LegacyName("OccultBathtub")] diff --git a/Items/Placeables/FurnitureOtherworldly/OtherworldlyCandelabra.cs b/Items/Placeables/FurnitureOtherworldly/OtherworldlyCandelabra.cs index 3a5e4e1c7d..89b392f08e 100644 --- a/Items/Placeables/FurnitureOtherworldly/OtherworldlyCandelabra.cs +++ b/Items/Placeables/FurnitureOtherworldly/OtherworldlyCandelabra.cs @@ -1,5 +1,5 @@ -using Terraria.ModLoader; -using Terraria.ID; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureOtherworldly { [LegacyName("OccultCandelabra")] diff --git a/Items/Placeables/FurnitureOtherworldly/OtherworldlyCandle.cs b/Items/Placeables/FurnitureOtherworldly/OtherworldlyCandle.cs index 6726aa1add..f76f0452f1 100644 --- a/Items/Placeables/FurnitureOtherworldly/OtherworldlyCandle.cs +++ b/Items/Placeables/FurnitureOtherworldly/OtherworldlyCandle.cs @@ -1,5 +1,5 @@ -using Terraria.ModLoader; -using Terraria.ID; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureOtherworldly { [LegacyName("OccultCandle")] diff --git a/Items/Placeables/FurnitureOtherworldly/OtherworldlyChair.cs b/Items/Placeables/FurnitureOtherworldly/OtherworldlyChair.cs index 405c9cf0aa..838f963157 100644 --- a/Items/Placeables/FurnitureOtherworldly/OtherworldlyChair.cs +++ b/Items/Placeables/FurnitureOtherworldly/OtherworldlyChair.cs @@ -1,5 +1,5 @@ -using Terraria.ModLoader; -using Terraria.ID; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureOtherworldly { [LegacyName("OccultChair")] diff --git a/Items/Placeables/FurnitureOtherworldly/OtherworldlyChandelier.cs b/Items/Placeables/FurnitureOtherworldly/OtherworldlyChandelier.cs index 30f5d51359..3ab62880da 100644 --- a/Items/Placeables/FurnitureOtherworldly/OtherworldlyChandelier.cs +++ b/Items/Placeables/FurnitureOtherworldly/OtherworldlyChandelier.cs @@ -1,5 +1,5 @@ -using Terraria.ModLoader; -using Terraria.ID; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureOtherworldly { [LegacyName("OccultChandelier")] diff --git a/Items/Placeables/FurnitureOtherworldly/OtherworldlyChest.cs b/Items/Placeables/FurnitureOtherworldly/OtherworldlyChest.cs index 5ba2647a33..03b6fc9d0d 100644 --- a/Items/Placeables/FurnitureOtherworldly/OtherworldlyChest.cs +++ b/Items/Placeables/FurnitureOtherworldly/OtherworldlyChest.cs @@ -1,5 +1,5 @@ -using Terraria.ModLoader; -using Terraria.ID; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureOtherworldly { [LegacyName("OccultChest")] diff --git a/Items/Placeables/FurnitureOtherworldly/OtherworldlyDoor.cs b/Items/Placeables/FurnitureOtherworldly/OtherworldlyDoor.cs index 86e7d60119..ef0c4af9b4 100644 --- a/Items/Placeables/FurnitureOtherworldly/OtherworldlyDoor.cs +++ b/Items/Placeables/FurnitureOtherworldly/OtherworldlyDoor.cs @@ -1,6 +1,6 @@ using CalamityMod.Tiles.FurnitureOtherworldly; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureOtherworldly { [LegacyName("OccultDoor")] diff --git a/Items/Placeables/FurnitureOtherworldly/OtherworldlyDresser.cs b/Items/Placeables/FurnitureOtherworldly/OtherworldlyDresser.cs index b40c696637..fede834ec4 100644 --- a/Items/Placeables/FurnitureOtherworldly/OtherworldlyDresser.cs +++ b/Items/Placeables/FurnitureOtherworldly/OtherworldlyDresser.cs @@ -1,5 +1,5 @@ -using Terraria.ModLoader; -using Terraria.ID; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureOtherworldly { [LegacyName("OccultDresser")] diff --git a/Items/Placeables/FurnitureOtherworldly/OtherworldlyLamp.cs b/Items/Placeables/FurnitureOtherworldly/OtherworldlyLamp.cs index 0f8aa1cd4c..596bec1851 100644 --- a/Items/Placeables/FurnitureOtherworldly/OtherworldlyLamp.cs +++ b/Items/Placeables/FurnitureOtherworldly/OtherworldlyLamp.cs @@ -1,5 +1,5 @@ -using Terraria.ModLoader; -using Terraria.ID; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureOtherworldly { [LegacyName("OccultLamp")] diff --git a/Items/Placeables/FurnitureOtherworldly/OtherworldlyLantern.cs b/Items/Placeables/FurnitureOtherworldly/OtherworldlyLantern.cs index ee1b5c6fdd..7b2e6eb73c 100644 --- a/Items/Placeables/FurnitureOtherworldly/OtherworldlyLantern.cs +++ b/Items/Placeables/FurnitureOtherworldly/OtherworldlyLantern.cs @@ -1,5 +1,5 @@ -using Terraria.ModLoader; -using Terraria.ID; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureOtherworldly { [LegacyName("OccultLantern")] diff --git a/Items/Placeables/FurnitureOtherworldly/OtherworldlyPlatform.cs b/Items/Placeables/FurnitureOtherworldly/OtherworldlyPlatform.cs index aa98f17b88..3d4cb4ca0a 100644 --- a/Items/Placeables/FurnitureOtherworldly/OtherworldlyPlatform.cs +++ b/Items/Placeables/FurnitureOtherworldly/OtherworldlyPlatform.cs @@ -1,5 +1,5 @@ -using Terraria.ModLoader; -using Terraria.ID; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureOtherworldly { [LegacyName("OccultPlatform")] diff --git a/Items/Placeables/FurniturePlagued/PlaguedPlateBathtub.cs b/Items/Placeables/FurniturePlagued/PlaguedPlateBathtub.cs index a1f2dc72ca..4ea41efc82 100644 --- a/Items/Placeables/FurniturePlagued/PlaguedPlateBathtub.cs +++ b/Items/Placeables/FurniturePlagued/PlaguedPlateBathtub.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurniturePlagued diff --git a/Items/Placeables/FurniturePlagued/PlaguedPlateBookcase.cs b/Items/Placeables/FurniturePlagued/PlaguedPlateBookcase.cs index b2b64b135a..76c7dce4fc 100644 --- a/Items/Placeables/FurniturePlagued/PlaguedPlateBookcase.cs +++ b/Items/Placeables/FurniturePlagued/PlaguedPlateBookcase.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurniturePlagued diff --git a/Items/Placeables/FurniturePlagued/PlaguedPlateCandelabra.cs b/Items/Placeables/FurniturePlagued/PlaguedPlateCandelabra.cs index b76136c7e8..8940952ade 100644 --- a/Items/Placeables/FurniturePlagued/PlaguedPlateCandelabra.cs +++ b/Items/Placeables/FurniturePlagued/PlaguedPlateCandelabra.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurniturePlagued diff --git a/Items/Placeables/FurniturePlagued/PlaguedPlateCandle.cs b/Items/Placeables/FurniturePlagued/PlaguedPlateCandle.cs index a354ed5af2..6b756628ad 100644 --- a/Items/Placeables/FurniturePlagued/PlaguedPlateCandle.cs +++ b/Items/Placeables/FurniturePlagued/PlaguedPlateCandle.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurniturePlagued diff --git a/Items/Placeables/FurniturePlagued/PlaguedPlateChair.cs b/Items/Placeables/FurniturePlagued/PlaguedPlateChair.cs index 4d6cfe0c53..3149937bde 100644 --- a/Items/Placeables/FurniturePlagued/PlaguedPlateChair.cs +++ b/Items/Placeables/FurniturePlagued/PlaguedPlateChair.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurniturePlagued diff --git a/Items/Placeables/FurniturePlagued/PlaguedPlateChandelier.cs b/Items/Placeables/FurniturePlagued/PlaguedPlateChandelier.cs index 89680bfa61..790bdc6492 100644 --- a/Items/Placeables/FurniturePlagued/PlaguedPlateChandelier.cs +++ b/Items/Placeables/FurniturePlagued/PlaguedPlateChandelier.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; diff --git a/Items/Placeables/FurniturePlagued/PlaguedPlateDoor.cs b/Items/Placeables/FurniturePlagued/PlaguedPlateDoor.cs index e54c57ff32..8281e94cb8 100644 --- a/Items/Placeables/FurniturePlagued/PlaguedPlateDoor.cs +++ b/Items/Placeables/FurniturePlagued/PlaguedPlateDoor.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurniturePlaguedPlate; using Terraria.ID; using Terraria.ModLoader; diff --git a/Items/Placeables/FurniturePlagued/PlaguedPlateDresser.cs b/Items/Placeables/FurniturePlagued/PlaguedPlateDresser.cs index 6c0a4823f3..769c43d917 100644 --- a/Items/Placeables/FurniturePlagued/PlaguedPlateDresser.cs +++ b/Items/Placeables/FurniturePlagued/PlaguedPlateDresser.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurniturePlagued diff --git a/Items/Placeables/FurniturePlagued/PlaguedPlateLamp.cs b/Items/Placeables/FurniturePlagued/PlaguedPlateLamp.cs index e41869d3f1..fd59e2249d 100644 --- a/Items/Placeables/FurniturePlagued/PlaguedPlateLamp.cs +++ b/Items/Placeables/FurniturePlagued/PlaguedPlateLamp.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurniturePlagued diff --git a/Items/Placeables/FurniturePlagued/PlaguedPlateLantern.cs b/Items/Placeables/FurniturePlagued/PlaguedPlateLantern.cs index 394c49c4ba..6214c98f48 100644 --- a/Items/Placeables/FurniturePlagued/PlaguedPlateLantern.cs +++ b/Items/Placeables/FurniturePlagued/PlaguedPlateLantern.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurniturePlagued diff --git a/Items/Placeables/FurniturePlagued/PlaguedPlatePiano.cs b/Items/Placeables/FurniturePlagued/PlaguedPlatePiano.cs index beed9cfc6f..aaa5c856d4 100644 --- a/Items/Placeables/FurniturePlagued/PlaguedPlatePiano.cs +++ b/Items/Placeables/FurniturePlagued/PlaguedPlatePiano.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurniturePlagued diff --git a/Items/Placeables/FurniturePlagued/PlaguedPlateSink.cs b/Items/Placeables/FurniturePlagued/PlaguedPlateSink.cs index 11dbf25bbf..c697683897 100644 --- a/Items/Placeables/FurniturePlagued/PlaguedPlateSink.cs +++ b/Items/Placeables/FurniturePlagued/PlaguedPlateSink.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurniturePlagued diff --git a/Items/Placeables/FurniturePlagued/PlaguedPlateSofa.cs b/Items/Placeables/FurniturePlagued/PlaguedPlateSofa.cs index 3122b914f9..fff1f76d97 100644 --- a/Items/Placeables/FurniturePlagued/PlaguedPlateSofa.cs +++ b/Items/Placeables/FurniturePlagued/PlaguedPlateSofa.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurniturePlagued diff --git a/Items/Placeables/FurniturePlagued/PlaguedPlateTable.cs b/Items/Placeables/FurniturePlagued/PlaguedPlateTable.cs index fd377261a1..09b5a697e4 100644 --- a/Items/Placeables/FurniturePlagued/PlaguedPlateTable.cs +++ b/Items/Placeables/FurniturePlagued/PlaguedPlateTable.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurniturePlagued diff --git a/Items/Placeables/FurnitureProfaned/ProfanedBed.cs b/Items/Placeables/FurnitureProfaned/ProfanedBed.cs index 32d8bf0fbb..f744787415 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedBed.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedBed.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureProfaned diff --git a/Items/Placeables/FurnitureProfaned/ProfanedBench.cs b/Items/Placeables/FurnitureProfaned/ProfanedBench.cs index e11d2cdb96..ce311f27e1 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedBench.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedBench.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureProfaned diff --git a/Items/Placeables/FurnitureProfaned/ProfanedBookcase.cs b/Items/Placeables/FurnitureProfaned/ProfanedBookcase.cs index 924678171a..d2e34418e7 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedBookcase.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedBookcase.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureProfaned diff --git a/Items/Placeables/FurnitureProfaned/ProfanedCandelabra.cs b/Items/Placeables/FurnitureProfaned/ProfanedCandelabra.cs index b0f8685235..eeca2f1673 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedCandelabra.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedCandelabra.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureProfaned diff --git a/Items/Placeables/FurnitureProfaned/ProfanedCandle.cs b/Items/Placeables/FurnitureProfaned/ProfanedCandle.cs index 1a847370b9..6edc8a0fa4 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedCandle.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedCandle.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureProfaned diff --git a/Items/Placeables/FurnitureProfaned/ProfanedChair.cs b/Items/Placeables/FurnitureProfaned/ProfanedChair.cs index 6fc8b30df3..302cebc5e0 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedChair.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedChair.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureProfaned diff --git a/Items/Placeables/FurnitureProfaned/ProfanedChandelier.cs b/Items/Placeables/FurnitureProfaned/ProfanedChandelier.cs index 538e3a7c87..a613d5ac04 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedChandelier.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedChandelier.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureProfaned diff --git a/Items/Placeables/FurnitureProfaned/ProfanedDoor.cs b/Items/Placeables/FurnitureProfaned/ProfanedDoor.cs index 33517007e3..b17ca58420 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedDoor.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedDoor.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureProfaned; using Terraria.ID; using Terraria.ModLoader; diff --git a/Items/Placeables/FurnitureProfaned/ProfanedDresser.cs b/Items/Placeables/FurnitureProfaned/ProfanedDresser.cs index 84bed5c7a1..79ac9bd95e 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedDresser.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedDresser.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureProfaned diff --git a/Items/Placeables/FurnitureProfaned/ProfanedLamp.cs b/Items/Placeables/FurnitureProfaned/ProfanedLamp.cs index 06c3c584a0..66e30ebc9b 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedLamp.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedLamp.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureProfaned diff --git a/Items/Placeables/FurnitureProfaned/ProfanedLantern.cs b/Items/Placeables/FurnitureProfaned/ProfanedLantern.cs index 433bafd168..052bd7c174 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedLantern.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedLantern.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureProfaned diff --git a/Items/Placeables/FurnitureProfaned/ProfanedPiano.cs b/Items/Placeables/FurnitureProfaned/ProfanedPiano.cs index 65c97e63f5..201a5d5d6e 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedPiano.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedPiano.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureProfaned diff --git a/Items/Placeables/FurnitureProfaned/ProfanedRock.cs b/Items/Placeables/FurnitureProfaned/ProfanedRock.cs index 2000669240..9c63f0a11b 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedRock.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedRock.cs @@ -7,6 +7,10 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned public class ProfanedRock : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 100; + } public override void SetDefaults() { Item.width = 12; diff --git a/Items/Placeables/FurnitureProfaned/ProfanedSink.cs b/Items/Placeables/FurnitureProfaned/ProfanedSink.cs index 3e81ebc75e..adc5f19e24 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedSink.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedSink.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureProfaned diff --git a/Items/Placeables/FurnitureProfaned/ProfanedTable.cs b/Items/Placeables/FurnitureProfaned/ProfanedTable.cs index 62ceaee710..960a5fc619 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedTable.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedTable.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureProfaned diff --git a/Items/Placeables/FurnitureSacrilegious/EyeOfTheAccursedBanner.cs b/Items/Placeables/FurnitureSacrilegious/EyeOfTheAccursedBanner.cs index 6d0ae3a749..5a618e9b93 100644 --- a/Items/Placeables/FurnitureSacrilegious/EyeOfTheAccursedBanner.cs +++ b/Items/Placeables/FurnitureSacrilegious/EyeOfTheAccursedBanner.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureSacrilegious; using Terraria; using Terraria.ID; @@ -27,10 +27,10 @@ namespace CalamityMod.Items.Placeables.FurnitureSacrilegious public override void AddRecipes() { CreateRecipe(). - AddIngredient(3). - AddIngredient(ItemID.Silk, 5). - AddTile(). - Register(); + AddIngredient(3). + AddIngredient(ItemID.Silk, 5). + AddTile(). + Register(); } } } diff --git a/Items/Placeables/FurnitureSacrilegious/LargeRitualCandle.cs b/Items/Placeables/FurnitureSacrilegious/LargeRitualCandle.cs index 9caa3ec20f..c9825c65e1 100644 --- a/Items/Placeables/FurnitureSacrilegious/LargeRitualCandle.cs +++ b/Items/Placeables/FurnitureSacrilegious/LargeRitualCandle.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureSacrilegious; using Terraria; using Terraria.ID; @@ -33,11 +33,11 @@ namespace CalamityMod.Items.Placeables.FurnitureSacrilegious { if (player.altFunctionUse == ItemAlternativeFunctionID.ActivatedAndUsed) { - Item.placeStyle = 1; + Item.placeStyle = 1; } else { - Item.placeStyle = 0; + Item.placeStyle = 0; } return base.CanUseItem(player); } @@ -45,10 +45,10 @@ namespace CalamityMod.Items.Placeables.FurnitureSacrilegious public override void AddRecipes() { CreateRecipe(). - AddIngredient(6). - AddIngredient(ItemID.Torch). - AddTile(). - Register(); + AddIngredient(6). + AddIngredient(ItemID.Torch). + AddTile(). + Register(); } } } diff --git a/Items/Placeables/FurnitureSacrilegious/MonolithOfTheAccursed.cs b/Items/Placeables/FurnitureSacrilegious/MonolithOfTheAccursed.cs index cfab492cb3..89edc10885 100644 --- a/Items/Placeables/FurnitureSacrilegious/MonolithOfTheAccursed.cs +++ b/Items/Placeables/FurnitureSacrilegious/MonolithOfTheAccursed.cs @@ -1,6 +1,7 @@ -using CalamityMod.Rarities; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureSacrilegious; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureSacrilegious @@ -20,15 +21,31 @@ namespace CalamityMod.Items.Placeables.FurnitureSacrilegious Item.useStyle = ItemUseStyleID.Swing; Item.consumable = true; Item.createTile = ModContent.TileType(); - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); + Item.accessory = true; + Item.vanity = true; + } + public override void UpdateEquip(Player player) + { + if (player.whoAmI == Main.myPlayer) + { + player.Calamity().monolithAccursedShader = 30; + } + } + public override void UpdateVanity(Player player) + { + if (player.whoAmI == Main.myPlayer) + { + player.Calamity().monolithAccursedShader = 30; + } } public override void AddRecipes() { CreateRecipe(). - AddIngredient(15). - AddTile(). - Register(); + AddIngredient(15). + AddTile(). + Register(); } } } diff --git a/Items/Placeables/FurnitureSacrilegious/OccultBrickItem.cs b/Items/Placeables/FurnitureSacrilegious/OccultBrickItem.cs index 27333ee8ee..943a36ae69 100644 --- a/Items/Placeables/FurnitureSacrilegious/OccultBrickItem.cs +++ b/Items/Placeables/FurnitureSacrilegious/OccultBrickItem.cs @@ -31,17 +31,17 @@ namespace CalamityMod.Items.Placeables.FurnitureSacrilegious public override void AddRecipes() { CreateRecipe(400). - AddRecipeGroup("AnyStoneBlock", 400). - AddIngredient(). - AddTile(). - Register(); + AddRecipeGroup("AnyStoneBlock", 400). + AddIngredient(). + AddTile(). + Register(); CreateRecipe(). - AddIngredient(2). - Register(); + AddIngredient(2). + Register(); CreateRecipe(). - AddIngredient(4). - AddTile(TileID.WorkBenches). - Register(); + AddIngredient(4). + AddTile(TileID.WorkBenches). + Register(); } } } diff --git a/Items/Placeables/FurnitureSacrilegious/OccultLegionnaireBanner.cs b/Items/Placeables/FurnitureSacrilegious/OccultLegionnaireBanner.cs index 243579dfbf..d578d21cda 100644 --- a/Items/Placeables/FurnitureSacrilegious/OccultLegionnaireBanner.cs +++ b/Items/Placeables/FurnitureSacrilegious/OccultLegionnaireBanner.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureSacrilegious; using Terraria; using Terraria.ID; @@ -27,10 +27,10 @@ namespace CalamityMod.Items.Placeables.FurnitureSacrilegious public override void AddRecipes() { CreateRecipe(). - AddIngredient(3). - AddIngredient(ItemID.Silk, 5). - AddTile(). - Register(); + AddIngredient(3). + AddIngredient(ItemID.Silk, 5). + AddTile(). + Register(); } } } diff --git a/Items/Placeables/FurnitureSacrilegious/RitualCandle.cs b/Items/Placeables/FurnitureSacrilegious/RitualCandle.cs index 7ffa440694..170fb8a81a 100644 --- a/Items/Placeables/FurnitureSacrilegious/RitualCandle.cs +++ b/Items/Placeables/FurnitureSacrilegious/RitualCandle.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureSacrilegious; using Terraria; using Terraria.ID; @@ -33,11 +33,11 @@ namespace CalamityMod.Items.Placeables.FurnitureSacrilegious { if (player.altFunctionUse == ItemAlternativeFunctionID.ActivatedAndUsed) { - Item.placeStyle = 1; + Item.placeStyle = 1; } else { - Item.placeStyle = 0; + Item.placeStyle = 0; } return base.CanUseItem(player); } @@ -45,10 +45,10 @@ namespace CalamityMod.Items.Placeables.FurnitureSacrilegious public override void AddRecipes() { CreateRecipe(). - AddIngredient(5). - AddIngredient(ItemID.Torch). - AddTile(). - Register(); + AddIngredient(5). + AddIngredient(ItemID.Torch). + AddTile(). + Register(); } } } diff --git a/Items/Placeables/FurnitureSacrilegious/SacrilegiousBathtub.cs b/Items/Placeables/FurnitureSacrilegious/SacrilegiousBathtub.cs index 825885335d..b83e03515b 100644 --- a/Items/Placeables/FurnitureSacrilegious/SacrilegiousBathtub.cs +++ b/Items/Placeables/FurnitureSacrilegious/SacrilegiousBathtub.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureSacrilegious; using Terraria.ID; using Terraria.ModLoader; @@ -24,9 +24,9 @@ namespace CalamityMod.Items.Placeables.FurnitureSacrilegious public override void AddRecipes() { CreateRecipe(). - AddIngredient(14). - AddTile(). - Register(); + AddIngredient(14). + AddTile(). + Register(); } } } diff --git a/Items/Placeables/FurnitureSacrilegious/SacrilegiousBed.cs b/Items/Placeables/FurnitureSacrilegious/SacrilegiousBed.cs index 0a811edf4a..d6b34a3164 100644 --- a/Items/Placeables/FurnitureSacrilegious/SacrilegiousBed.cs +++ b/Items/Placeables/FurnitureSacrilegious/SacrilegiousBed.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureSacrilegious; using Terraria.ID; using Terraria.ModLoader; @@ -24,10 +24,10 @@ namespace CalamityMod.Items.Placeables.FurnitureSacrilegious public override void AddRecipes() { CreateRecipe(). - AddIngredient(15). - AddIngredient(ItemID.Silk, 5). - AddTile(). - Register(); + AddIngredient(15). + AddIngredient(ItemID.Silk, 5). + AddTile(). + Register(); } } } diff --git a/Items/Placeables/FurnitureSacrilegious/SacrilegiousBench.cs b/Items/Placeables/FurnitureSacrilegious/SacrilegiousBench.cs index b7f075e655..0a91b8e4fb 100644 --- a/Items/Placeables/FurnitureSacrilegious/SacrilegiousBench.cs +++ b/Items/Placeables/FurnitureSacrilegious/SacrilegiousBench.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureSacrilegious; using Terraria.ID; using Terraria.ModLoader; @@ -24,9 +24,9 @@ namespace CalamityMod.Items.Placeables.FurnitureSacrilegious public override void AddRecipes() { CreateRecipe(). - AddIngredient(8). - AddTile(). - Register(); + AddIngredient(8). + AddTile(). + Register(); } } } diff --git a/Items/Placeables/FurnitureSacrilegious/SacrilegiousBookcase.cs b/Items/Placeables/FurnitureSacrilegious/SacrilegiousBookcase.cs index 37bd6c98d3..8f93f672a5 100644 --- a/Items/Placeables/FurnitureSacrilegious/SacrilegiousBookcase.cs +++ b/Items/Placeables/FurnitureSacrilegious/SacrilegiousBookcase.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureSacrilegious; using Terraria.ID; using Terraria.ModLoader; @@ -24,10 +24,10 @@ namespace CalamityMod.Items.Placeables.FurnitureSacrilegious public override void AddRecipes() { CreateRecipe(). - AddIngredient(20). - AddIngredient(ItemID.Book, 10). - AddTile(). - Register(); + AddIngredient(20). + AddIngredient(ItemID.Book, 10). + AddTile(). + Register(); } } } diff --git a/Items/Placeables/FurnitureSacrilegious/SacrilegiousCandelabra.cs b/Items/Placeables/FurnitureSacrilegious/SacrilegiousCandelabra.cs index 7fc524f981..20e1097ea4 100644 --- a/Items/Placeables/FurnitureSacrilegious/SacrilegiousCandelabra.cs +++ b/Items/Placeables/FurnitureSacrilegious/SacrilegiousCandelabra.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureSacrilegious; using Terraria.ID; using Terraria.ModLoader; @@ -24,10 +24,10 @@ namespace CalamityMod.Items.Placeables.FurnitureSacrilegious public override void AddRecipes() { CreateRecipe(). - AddIngredient(5). - AddIngredient(ItemID.Torch, 3). - AddTile(). - Register(); + AddIngredient(5). + AddIngredient(ItemID.Torch, 3). + AddTile(). + Register(); } } } diff --git a/Items/Placeables/FurnitureSacrilegious/SacrilegiousCandle.cs b/Items/Placeables/FurnitureSacrilegious/SacrilegiousCandle.cs index 9a9dcb934b..bc4dea6dcb 100644 --- a/Items/Placeables/FurnitureSacrilegious/SacrilegiousCandle.cs +++ b/Items/Placeables/FurnitureSacrilegious/SacrilegiousCandle.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureSacrilegious; using Terraria.ID; using Terraria.ModLoader; @@ -24,10 +24,10 @@ namespace CalamityMod.Items.Placeables.FurnitureSacrilegious public override void AddRecipes() { CreateRecipe(). - AddIngredient(4). - AddIngredient(ItemID.Torch). - AddTile(). - Register(); + AddIngredient(4). + AddIngredient(ItemID.Torch). + AddTile(). + Register(); } } } diff --git a/Items/Placeables/FurnitureSacrilegious/SacrilegiousChair.cs b/Items/Placeables/FurnitureSacrilegious/SacrilegiousChair.cs index dce4f15617..24c6f47afd 100644 --- a/Items/Placeables/FurnitureSacrilegious/SacrilegiousChair.cs +++ b/Items/Placeables/FurnitureSacrilegious/SacrilegiousChair.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureSacrilegious; using Terraria.ID; using Terraria.ModLoader; @@ -24,9 +24,9 @@ namespace CalamityMod.Items.Placeables.FurnitureSacrilegious public override void AddRecipes() { CreateRecipe(). - AddIngredient(4). - AddTile(). - Register(); + AddIngredient(4). + AddTile(). + Register(); } } } diff --git a/Items/Placeables/FurnitureSacrilegious/SacrilegiousChandelier.cs b/Items/Placeables/FurnitureSacrilegious/SacrilegiousChandelier.cs index ac03ee5154..e1825750fc 100644 --- a/Items/Placeables/FurnitureSacrilegious/SacrilegiousChandelier.cs +++ b/Items/Placeables/FurnitureSacrilegious/SacrilegiousChandelier.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureSacrilegious; using Terraria.ID; using Terraria.ModLoader; @@ -24,11 +24,11 @@ namespace CalamityMod.Items.Placeables.FurnitureSacrilegious public override void AddRecipes() { CreateRecipe(). - AddIngredient(4). - AddIngredient(ItemID.Torch, 4). + AddIngredient(4). + AddIngredient(ItemID.Torch, 4). AddIngredient(ItemID.Chain). - AddTile(). - Register(); + AddTile(). + Register(); } } } diff --git a/Items/Placeables/FurnitureSacrilegious/SacrilegiousDoor.cs b/Items/Placeables/FurnitureSacrilegious/SacrilegiousDoor.cs index 80ae165c2f..39658d8f4d 100644 --- a/Items/Placeables/FurnitureSacrilegious/SacrilegiousDoor.cs +++ b/Items/Placeables/FurnitureSacrilegious/SacrilegiousDoor.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureSacrilegious; using Terraria.ID; using Terraria.ModLoader; @@ -24,9 +24,9 @@ namespace CalamityMod.Items.Placeables.FurnitureSacrilegious public override void AddRecipes() { CreateRecipe(). - AddIngredient(6). - AddTile(). - Register(); + AddIngredient(6). + AddTile(). + Register(); } } } diff --git a/Items/Placeables/FurnitureSacrilegious/SacrilegiousDresser.cs b/Items/Placeables/FurnitureSacrilegious/SacrilegiousDresser.cs index 414f199815..73b5238afe 100644 --- a/Items/Placeables/FurnitureSacrilegious/SacrilegiousDresser.cs +++ b/Items/Placeables/FurnitureSacrilegious/SacrilegiousDresser.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureSacrilegious; using Terraria.ID; using Terraria.ModLoader; @@ -24,9 +24,9 @@ namespace CalamityMod.Items.Placeables.FurnitureSacrilegious public override void AddRecipes() { CreateRecipe(). - AddIngredient(16). - AddTile(). - Register(); + AddIngredient(16). + AddTile(). + Register(); } } } diff --git a/Items/Placeables/FurnitureSacrilegious/SacrilegiousLamp.cs b/Items/Placeables/FurnitureSacrilegious/SacrilegiousLamp.cs index f7f60a0583..a628258836 100644 --- a/Items/Placeables/FurnitureSacrilegious/SacrilegiousLamp.cs +++ b/Items/Placeables/FurnitureSacrilegious/SacrilegiousLamp.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureSacrilegious; using Terraria.ID; using Terraria.ModLoader; @@ -24,10 +24,10 @@ namespace CalamityMod.Items.Placeables.FurnitureSacrilegious public override void AddRecipes() { CreateRecipe(). - AddIngredient(3). - AddIngredient(ItemID.Torch). - AddTile(). - Register(); + AddIngredient(3). + AddIngredient(ItemID.Torch). + AddTile(). + Register(); } } } diff --git a/Items/Placeables/FurnitureSacrilegious/SacrilegiousLantern.cs b/Items/Placeables/FurnitureSacrilegious/SacrilegiousLantern.cs index afea907ca3..0aeeffab53 100644 --- a/Items/Placeables/FurnitureSacrilegious/SacrilegiousLantern.cs +++ b/Items/Placeables/FurnitureSacrilegious/SacrilegiousLantern.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureSacrilegious; using Terraria.ID; using Terraria.ModLoader; @@ -24,10 +24,10 @@ namespace CalamityMod.Items.Placeables.FurnitureSacrilegious public override void AddRecipes() { CreateRecipe(). - AddIngredient(6). - AddIngredient(ItemID.Torch). - AddTile(). - Register(); + AddIngredient(6). + AddIngredient(ItemID.Torch). + AddTile(). + Register(); } } } diff --git a/Items/Placeables/FurnitureSacrilegious/SacrilegiousOrgan.cs b/Items/Placeables/FurnitureSacrilegious/SacrilegiousOrgan.cs index afce5b799a..695256bc92 100644 --- a/Items/Placeables/FurnitureSacrilegious/SacrilegiousOrgan.cs +++ b/Items/Placeables/FurnitureSacrilegious/SacrilegiousOrgan.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureSacrilegious; using Terraria.ID; using Terraria.ModLoader; @@ -24,11 +24,11 @@ namespace CalamityMod.Items.Placeables.FurnitureSacrilegious public override void AddRecipes() { CreateRecipe(). - AddIngredient(15). + AddIngredient(15). AddIngredient(ItemID.Bone, 4). - AddIngredient(ItemID.Book). - AddTile(). - Register(); + AddIngredient(ItemID.Book). + AddTile(). + Register(); } } } diff --git a/Items/Placeables/FurnitureSacrilegious/SacrilegiousSink.cs b/Items/Placeables/FurnitureSacrilegious/SacrilegiousSink.cs index 6abb5d9afb..3c7661c61c 100644 --- a/Items/Placeables/FurnitureSacrilegious/SacrilegiousSink.cs +++ b/Items/Placeables/FurnitureSacrilegious/SacrilegiousSink.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureSacrilegious; using Terraria.ID; using Terraria.ModLoader; @@ -24,12 +24,12 @@ namespace CalamityMod.Items.Placeables.FurnitureSacrilegious public override void AddRecipes() { CreateRecipe(). - AddIngredient(6). - AddIngredient(ItemID.WaterBucket). - AddIngredient(ItemID.HoneyBucket). - AddIngredient(ItemID.LavaBucket). - AddTile(). - Register(); + AddIngredient(6). + AddIngredient(ItemID.WaterBucket). + AddIngredient(ItemID.HoneyBucket). + AddIngredient(ItemID.LavaBucket). + AddTile(). + Register(); } } } diff --git a/Items/Placeables/FurnitureSacrilegious/SacrilegiousTable.cs b/Items/Placeables/FurnitureSacrilegious/SacrilegiousTable.cs index 8a0feb77a6..376f985014 100644 --- a/Items/Placeables/FurnitureSacrilegious/SacrilegiousTable.cs +++ b/Items/Placeables/FurnitureSacrilegious/SacrilegiousTable.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureSacrilegious; using Terraria.ID; using Terraria.ModLoader; @@ -24,9 +24,9 @@ namespace CalamityMod.Items.Placeables.FurnitureSacrilegious public override void AddRecipes() { CreateRecipe(). - AddIngredient(8). - AddTile(). - Register(); + AddIngredient(8). + AddTile(). + Register(); } } } diff --git a/Items/Placeables/FurnitureSacrilegious/SacrilegiousWorkBench.cs b/Items/Placeables/FurnitureSacrilegious/SacrilegiousWorkBench.cs index 8e8aaca934..e2d4b4bf37 100644 --- a/Items/Placeables/FurnitureSacrilegious/SacrilegiousWorkBench.cs +++ b/Items/Placeables/FurnitureSacrilegious/SacrilegiousWorkBench.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureSacrilegious; using Terraria.ID; using Terraria.ModLoader; diff --git a/Items/Placeables/FurnitureSilva/SilvaBathtub.cs b/Items/Placeables/FurnitureSilva/SilvaBathtub.cs index 631f947244..e99ba3e55f 100644 --- a/Items/Placeables/FurnitureSilva/SilvaBathtub.cs +++ b/Items/Placeables/FurnitureSilva/SilvaBathtub.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureSilva diff --git a/Items/Placeables/FurnitureSilva/SilvaBed.cs b/Items/Placeables/FurnitureSilva/SilvaBed.cs index 53fe42458e..8eb7dec1ff 100644 --- a/Items/Placeables/FurnitureSilva/SilvaBed.cs +++ b/Items/Placeables/FurnitureSilva/SilvaBed.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureSilva diff --git a/Items/Placeables/FurnitureSilva/SilvaBench.cs b/Items/Placeables/FurnitureSilva/SilvaBench.cs index 25d0f46ef1..e7461c2f02 100644 --- a/Items/Placeables/FurnitureSilva/SilvaBench.cs +++ b/Items/Placeables/FurnitureSilva/SilvaBench.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureSilva diff --git a/Items/Placeables/FurnitureSilva/SilvaBookcase.cs b/Items/Placeables/FurnitureSilva/SilvaBookcase.cs index 0f4369a58d..383a307553 100644 --- a/Items/Placeables/FurnitureSilva/SilvaBookcase.cs +++ b/Items/Placeables/FurnitureSilva/SilvaBookcase.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureSilva diff --git a/Items/Placeables/FurnitureSilva/SilvaCandelabra.cs b/Items/Placeables/FurnitureSilva/SilvaCandelabra.cs index 136fcf776f..702798d59d 100644 --- a/Items/Placeables/FurnitureSilva/SilvaCandelabra.cs +++ b/Items/Placeables/FurnitureSilva/SilvaCandelabra.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureSilva diff --git a/Items/Placeables/FurnitureSilva/SilvaCandle.cs b/Items/Placeables/FurnitureSilva/SilvaCandle.cs index 8b3d1cb0b8..1fd440b8c6 100644 --- a/Items/Placeables/FurnitureSilva/SilvaCandle.cs +++ b/Items/Placeables/FurnitureSilva/SilvaCandle.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureSilva diff --git a/Items/Placeables/FurnitureSilva/SilvaChair.cs b/Items/Placeables/FurnitureSilva/SilvaChair.cs index df87ad8c5b..2961c44336 100644 --- a/Items/Placeables/FurnitureSilva/SilvaChair.cs +++ b/Items/Placeables/FurnitureSilva/SilvaChair.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureSilva diff --git a/Items/Placeables/FurnitureSilva/SilvaChandelier.cs b/Items/Placeables/FurnitureSilva/SilvaChandelier.cs index e9cb9515be..54988c8f24 100644 --- a/Items/Placeables/FurnitureSilva/SilvaChandelier.cs +++ b/Items/Placeables/FurnitureSilva/SilvaChandelier.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; diff --git a/Items/Placeables/FurnitureSilva/SilvaChest.cs b/Items/Placeables/FurnitureSilva/SilvaChest.cs index 0606199b6c..c4c4e3e9b4 100644 --- a/Items/Placeables/FurnitureSilva/SilvaChest.cs +++ b/Items/Placeables/FurnitureSilva/SilvaChest.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; diff --git a/Items/Placeables/FurnitureSilva/SilvaClock.cs b/Items/Placeables/FurnitureSilva/SilvaClock.cs index cc89150bfb..fcaf052fee 100644 --- a/Items/Placeables/FurnitureSilva/SilvaClock.cs +++ b/Items/Placeables/FurnitureSilva/SilvaClock.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureSilva diff --git a/Items/Placeables/FurnitureSilva/SilvaDoor.cs b/Items/Placeables/FurnitureSilva/SilvaDoor.cs index 20d3825ce7..5be1f1694b 100644 --- a/Items/Placeables/FurnitureSilva/SilvaDoor.cs +++ b/Items/Placeables/FurnitureSilva/SilvaDoor.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureSilva; using Terraria.ID; using Terraria.ModLoader; diff --git a/Items/Placeables/FurnitureSilva/SilvaDresser.cs b/Items/Placeables/FurnitureSilva/SilvaDresser.cs index a6c7690a16..d35ee4cee6 100644 --- a/Items/Placeables/FurnitureSilva/SilvaDresser.cs +++ b/Items/Placeables/FurnitureSilva/SilvaDresser.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureSilva diff --git a/Items/Placeables/FurnitureSilva/SilvaLamp.cs b/Items/Placeables/FurnitureSilva/SilvaLamp.cs index a455db8daa..a284f1be07 100644 --- a/Items/Placeables/FurnitureSilva/SilvaLamp.cs +++ b/Items/Placeables/FurnitureSilva/SilvaLamp.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureSilva diff --git a/Items/Placeables/FurnitureSilva/SilvaLantern.cs b/Items/Placeables/FurnitureSilva/SilvaLantern.cs index 7959bc19a1..92b6f3d5dc 100644 --- a/Items/Placeables/FurnitureSilva/SilvaLantern.cs +++ b/Items/Placeables/FurnitureSilva/SilvaLantern.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureSilva diff --git a/Items/Placeables/FurnitureSilva/SilvaPiano.cs b/Items/Placeables/FurnitureSilva/SilvaPiano.cs index e00929c12e..e720ec85e3 100644 --- a/Items/Placeables/FurnitureSilva/SilvaPiano.cs +++ b/Items/Placeables/FurnitureSilva/SilvaPiano.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureSilva diff --git a/Items/Placeables/FurnitureSilva/SilvaSink.cs b/Items/Placeables/FurnitureSilva/SilvaSink.cs index 2f4c1c67a4..19ad3be982 100644 --- a/Items/Placeables/FurnitureSilva/SilvaSink.cs +++ b/Items/Placeables/FurnitureSilva/SilvaSink.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureSilva diff --git a/Items/Placeables/FurnitureSilva/SilvaTable.cs b/Items/Placeables/FurnitureSilva/SilvaTable.cs index e6e9a04946..15b3849e45 100644 --- a/Items/Placeables/FurnitureSilva/SilvaTable.cs +++ b/Items/Placeables/FurnitureSilva/SilvaTable.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureSilva diff --git a/Items/Placeables/FurnitureSilva/SilvaWorkBench.cs b/Items/Placeables/FurnitureSilva/SilvaWorkBench.cs index 5d0df42dcd..50af2b0149 100644 --- a/Items/Placeables/FurnitureSilva/SilvaWorkBench.cs +++ b/Items/Placeables/FurnitureSilva/SilvaWorkBench.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureSilva diff --git a/Items/Placeables/FurnitureStatigel/StatigelBed.cs b/Items/Placeables/FurnitureStatigel/StatigelBed.cs index 79a49f9b11..d5e840f874 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelBed.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelBed.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStatigel diff --git a/Items/Placeables/FurnitureStatigel/StatigelBookcase.cs b/Items/Placeables/FurnitureStatigel/StatigelBookcase.cs index 32e7edbd4c..012af8b83b 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelBookcase.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelBookcase.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStatigel diff --git a/Items/Placeables/FurnitureStatigel/StatigelCandelabra.cs b/Items/Placeables/FurnitureStatigel/StatigelCandelabra.cs index 9ed75b25f0..4bf3d3fe60 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelCandelabra.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelCandelabra.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStatigel diff --git a/Items/Placeables/FurnitureStatigel/StatigelCandle.cs b/Items/Placeables/FurnitureStatigel/StatigelCandle.cs index 460e020af3..c90dd5894c 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelCandle.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelCandle.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStatigel diff --git a/Items/Placeables/FurnitureStatigel/StatigelChair.cs b/Items/Placeables/FurnitureStatigel/StatigelChair.cs index f12bcc9846..02d1ece838 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelChair.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelChair.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStatigel diff --git a/Items/Placeables/FurnitureStatigel/StatigelChandelier.cs b/Items/Placeables/FurnitureStatigel/StatigelChandelier.cs index e92b35cede..5e3f2daaae 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelChandelier.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelChandelier.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStatigel diff --git a/Items/Placeables/FurnitureStatigel/StatigelDoor.cs b/Items/Placeables/FurnitureStatigel/StatigelDoor.cs index 9c459f0784..f79fa59001 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelDoor.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelDoor.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureStatigel; using Terraria.ID; using Terraria.ModLoader; diff --git a/Items/Placeables/FurnitureStatigel/StatigelDresser.cs b/Items/Placeables/FurnitureStatigel/StatigelDresser.cs index 9c65777f8f..733bf50dac 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelDresser.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelDresser.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStatigel diff --git a/Items/Placeables/FurnitureStatigel/StatigelLamp.cs b/Items/Placeables/FurnitureStatigel/StatigelLamp.cs index 90a8e05247..6568d635fc 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelLamp.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelLamp.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStatigel diff --git a/Items/Placeables/FurnitureStatigel/StatigelLantern.cs b/Items/Placeables/FurnitureStatigel/StatigelLantern.cs index 8bbb5502ff..0e6231e388 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelLantern.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelLantern.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStatigel diff --git a/Items/Placeables/FurnitureStatigel/StatigelPiano.cs b/Items/Placeables/FurnitureStatigel/StatigelPiano.cs index 04e49bc682..c74d15a57d 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelPiano.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelPiano.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStatigel diff --git a/Items/Placeables/FurnitureStatigel/StatigelSink.cs b/Items/Placeables/FurnitureStatigel/StatigelSink.cs index 6c88278c85..357e41b7a2 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelSink.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelSink.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStatigel diff --git a/Items/Placeables/FurnitureStatigel/StatigelSofa.cs b/Items/Placeables/FurnitureStatigel/StatigelSofa.cs index 678b5a6633..77a4e14ae8 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelSofa.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelSofa.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStatigel diff --git a/Items/Placeables/FurnitureStatigel/StatigelTable.cs b/Items/Placeables/FurnitureStatigel/StatigelTable.cs index 9f84afe248..5c97c5f8b0 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelTable.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelTable.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStatigel diff --git a/Items/Placeables/FurnitureStratus/StratusBathtub.cs b/Items/Placeables/FurnitureStratus/StratusBathtub.cs index 0b5e69e5cb..44efc2eb82 100644 --- a/Items/Placeables/FurnitureStratus/StratusBathtub.cs +++ b/Items/Placeables/FurnitureStratus/StratusBathtub.cs @@ -1,4 +1,4 @@ -using Terraria.ID; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStratus { diff --git a/Items/Placeables/FurnitureStratus/StratusBed.cs b/Items/Placeables/FurnitureStratus/StratusBed.cs index cfa6577dd7..bce3b8fb72 100644 --- a/Items/Placeables/FurnitureStratus/StratusBed.cs +++ b/Items/Placeables/FurnitureStratus/StratusBed.cs @@ -1,4 +1,4 @@ -using Terraria.ID; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStratus { diff --git a/Items/Placeables/FurnitureStratus/StratusBookcase.cs b/Items/Placeables/FurnitureStratus/StratusBookcase.cs index 2726dc33e5..b3981d0083 100644 --- a/Items/Placeables/FurnitureStratus/StratusBookcase.cs +++ b/Items/Placeables/FurnitureStratus/StratusBookcase.cs @@ -1,4 +1,4 @@ -using Terraria.ID; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStratus { diff --git a/Items/Placeables/FurnitureStratus/StratusCandelabra.cs b/Items/Placeables/FurnitureStratus/StratusCandelabra.cs index a07ed25e8c..61368f0f86 100644 --- a/Items/Placeables/FurnitureStratus/StratusCandelabra.cs +++ b/Items/Placeables/FurnitureStratus/StratusCandelabra.cs @@ -1,4 +1,4 @@ -using Terraria.ID; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStratus { diff --git a/Items/Placeables/FurnitureStratus/StratusCandle.cs b/Items/Placeables/FurnitureStratus/StratusCandle.cs index e47be6dfe2..1422f98bc1 100644 --- a/Items/Placeables/FurnitureStratus/StratusCandle.cs +++ b/Items/Placeables/FurnitureStratus/StratusCandle.cs @@ -1,4 +1,4 @@ -using Terraria.ID; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStratus { diff --git a/Items/Placeables/FurnitureStratus/StratusChair.cs b/Items/Placeables/FurnitureStratus/StratusChair.cs index 3630b1e330..4663302a99 100644 --- a/Items/Placeables/FurnitureStratus/StratusChair.cs +++ b/Items/Placeables/FurnitureStratus/StratusChair.cs @@ -1,4 +1,4 @@ -using Terraria.ID; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStratus { diff --git a/Items/Placeables/FurnitureStratus/StratusChandelier.cs b/Items/Placeables/FurnitureStratus/StratusChandelier.cs index 6eed6230bf..ab431764e8 100644 --- a/Items/Placeables/FurnitureStratus/StratusChandelier.cs +++ b/Items/Placeables/FurnitureStratus/StratusChandelier.cs @@ -1,4 +1,4 @@ -using Terraria.ID; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStratus { diff --git a/Items/Placeables/FurnitureStratus/StratusDoor.cs b/Items/Placeables/FurnitureStratus/StratusDoor.cs index 902478b0c6..441fe59049 100644 --- a/Items/Placeables/FurnitureStratus/StratusDoor.cs +++ b/Items/Placeables/FurnitureStratus/StratusDoor.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.FurnitureStratus; +using CalamityMod.Tiles.FurnitureStratus; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStratus diff --git a/Items/Placeables/FurnitureStratus/StratusDresser.cs b/Items/Placeables/FurnitureStratus/StratusDresser.cs index 7d419bbaad..4b64df1890 100644 --- a/Items/Placeables/FurnitureStratus/StratusDresser.cs +++ b/Items/Placeables/FurnitureStratus/StratusDresser.cs @@ -1,4 +1,4 @@ -using Terraria.ID; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStratus { diff --git a/Items/Placeables/FurnitureStratus/StratusLamp.cs b/Items/Placeables/FurnitureStratus/StratusLamp.cs index 202145fb4a..45bd49e7dd 100644 --- a/Items/Placeables/FurnitureStratus/StratusLamp.cs +++ b/Items/Placeables/FurnitureStratus/StratusLamp.cs @@ -1,4 +1,4 @@ -using Terraria.ID; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStratus { diff --git a/Items/Placeables/FurnitureStratus/StratusLantern.cs b/Items/Placeables/FurnitureStratus/StratusLantern.cs index 1b7017fef4..5578768d87 100644 --- a/Items/Placeables/FurnitureStratus/StratusLantern.cs +++ b/Items/Placeables/FurnitureStratus/StratusLantern.cs @@ -1,4 +1,4 @@ -using Terraria.ID; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStratus { diff --git a/Items/Placeables/FurnitureStratus/StratusPiano.cs b/Items/Placeables/FurnitureStratus/StratusPiano.cs index 23cea86a5e..10f63c625a 100644 --- a/Items/Placeables/FurnitureStratus/StratusPiano.cs +++ b/Items/Placeables/FurnitureStratus/StratusPiano.cs @@ -1,4 +1,4 @@ -using Terraria.ID; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStratus { diff --git a/Items/Placeables/FurnitureStratus/StratusSink.cs b/Items/Placeables/FurnitureStratus/StratusSink.cs index bd09751c38..c0449bcf20 100644 --- a/Items/Placeables/FurnitureStratus/StratusSink.cs +++ b/Items/Placeables/FurnitureStratus/StratusSink.cs @@ -1,4 +1,4 @@ -using Terraria.ID; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStratus { diff --git a/Items/Placeables/FurnitureStratus/StratusSofa.cs b/Items/Placeables/FurnitureStratus/StratusSofa.cs index e4f2763f0b..9bcfe3b552 100644 --- a/Items/Placeables/FurnitureStratus/StratusSofa.cs +++ b/Items/Placeables/FurnitureStratus/StratusSofa.cs @@ -1,4 +1,4 @@ -using Terraria.ID; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStratus { diff --git a/Items/Placeables/FurnitureStratus/StratusTable.cs b/Items/Placeables/FurnitureStratus/StratusTable.cs index 2b1d74e6b9..1a21d4f7d4 100644 --- a/Items/Placeables/FurnitureStratus/StratusTable.cs +++ b/Items/Placeables/FurnitureStratus/StratusTable.cs @@ -1,4 +1,4 @@ -using Terraria.ID; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureStratus { diff --git a/Items/Placeables/FurnitureVoid/VoidBed.cs b/Items/Placeables/FurnitureVoid/VoidBed.cs index 91f60c9319..b2c9eb2f99 100644 --- a/Items/Placeables/FurnitureVoid/VoidBed.cs +++ b/Items/Placeables/FurnitureVoid/VoidBed.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureVoid diff --git a/Items/Placeables/FurnitureVoid/VoidBookcase.cs b/Items/Placeables/FurnitureVoid/VoidBookcase.cs index c3102fc73e..1be0081d6b 100644 --- a/Items/Placeables/FurnitureVoid/VoidBookcase.cs +++ b/Items/Placeables/FurnitureVoid/VoidBookcase.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureVoid diff --git a/Items/Placeables/FurnitureVoid/VoidCandelabra.cs b/Items/Placeables/FurnitureVoid/VoidCandelabra.cs index 2e0f52cf58..0cce6250db 100644 --- a/Items/Placeables/FurnitureVoid/VoidCandelabra.cs +++ b/Items/Placeables/FurnitureVoid/VoidCandelabra.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureVoid diff --git a/Items/Placeables/FurnitureVoid/VoidCandle.cs b/Items/Placeables/FurnitureVoid/VoidCandle.cs index 37c87bf0c3..0795cca240 100644 --- a/Items/Placeables/FurnitureVoid/VoidCandle.cs +++ b/Items/Placeables/FurnitureVoid/VoidCandle.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureVoid diff --git a/Items/Placeables/FurnitureVoid/VoidChair.cs b/Items/Placeables/FurnitureVoid/VoidChair.cs index cbe722ba02..6af4c4a6a0 100644 --- a/Items/Placeables/FurnitureVoid/VoidChair.cs +++ b/Items/Placeables/FurnitureVoid/VoidChair.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureVoid diff --git a/Items/Placeables/FurnitureVoid/VoidChandelier.cs b/Items/Placeables/FurnitureVoid/VoidChandelier.cs index 68728cfc4b..38e4f37bea 100644 --- a/Items/Placeables/FurnitureVoid/VoidChandelier.cs +++ b/Items/Placeables/FurnitureVoid/VoidChandelier.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureVoid diff --git a/Items/Placeables/FurnitureVoid/VoidDoor.cs b/Items/Placeables/FurnitureVoid/VoidDoor.cs index 69374c7266..a0aa337f78 100644 --- a/Items/Placeables/FurnitureVoid/VoidDoor.cs +++ b/Items/Placeables/FurnitureVoid/VoidDoor.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureVoid; using Terraria.ID; using Terraria.ModLoader; diff --git a/Items/Placeables/FurnitureVoid/VoidDresser.cs b/Items/Placeables/FurnitureVoid/VoidDresser.cs index b811d5ce09..0ec9368424 100644 --- a/Items/Placeables/FurnitureVoid/VoidDresser.cs +++ b/Items/Placeables/FurnitureVoid/VoidDresser.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureVoid diff --git a/Items/Placeables/FurnitureVoid/VoidLamp.cs b/Items/Placeables/FurnitureVoid/VoidLamp.cs index abea2e1a1f..8511c2c5db 100644 --- a/Items/Placeables/FurnitureVoid/VoidLamp.cs +++ b/Items/Placeables/FurnitureVoid/VoidLamp.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureVoid diff --git a/Items/Placeables/FurnitureVoid/VoidLantern.cs b/Items/Placeables/FurnitureVoid/VoidLantern.cs index 3401e94b3e..c06848e2a0 100644 --- a/Items/Placeables/FurnitureVoid/VoidLantern.cs +++ b/Items/Placeables/FurnitureVoid/VoidLantern.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureVoid diff --git a/Items/Placeables/FurnitureVoid/VoidPiano.cs b/Items/Placeables/FurnitureVoid/VoidPiano.cs index 7b567d8632..36eb360204 100644 --- a/Items/Placeables/FurnitureVoid/VoidPiano.cs +++ b/Items/Placeables/FurnitureVoid/VoidPiano.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureVoid diff --git a/Items/Placeables/FurnitureVoid/VoidSink.cs b/Items/Placeables/FurnitureVoid/VoidSink.cs index 03d40ced16..74967ccb8f 100644 --- a/Items/Placeables/FurnitureVoid/VoidSink.cs +++ b/Items/Placeables/FurnitureVoid/VoidSink.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureVoid diff --git a/Items/Placeables/FurnitureVoid/VoidSofa.cs b/Items/Placeables/FurnitureVoid/VoidSofa.cs index cd80526da2..4f07e6d093 100644 --- a/Items/Placeables/FurnitureVoid/VoidSofa.cs +++ b/Items/Placeables/FurnitureVoid/VoidSofa.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureVoid diff --git a/Items/Placeables/FurnitureVoid/VoidTable.cs b/Items/Placeables/FurnitureVoid/VoidTable.cs index c0f983b8a6..6756872f39 100644 --- a/Items/Placeables/FurnitureVoid/VoidTable.cs +++ b/Items/Placeables/FurnitureVoid/VoidTable.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureVoid diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumChest.cs b/Items/Placeables/FurnitureWulfrum/WulfrumChest.cs index 236ba44569..b9005512aa 100644 --- a/Items/Placeables/FurnitureWulfrum/WulfrumChest.cs +++ b/Items/Placeables/FurnitureWulfrum/WulfrumChest.cs @@ -36,4 +36,4 @@ namespace CalamityMod.Items.Placeables.FurnitureWulfrum Register(); } } -}*/ \ No newline at end of file +}*/ diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumPlating.cs b/Items/Placeables/FurnitureWulfrum/WulfrumPlating.cs index 1fecb1d01a..b907b16622 100644 --- a/Items/Placeables/FurnitureWulfrum/WulfrumPlating.cs +++ b/Items/Placeables/FurnitureWulfrum/WulfrumPlating.cs @@ -1,5 +1,5 @@ -using CalamityMod.Items.Placeables.Walls; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Walls; using Terraria.ID; using Terraria.ModLoader; @@ -34,10 +34,10 @@ namespace CalamityMod.Items.Placeables.FurnitureWulfrum AddIngredient(). AddTile(TileID.HeavyWorkBench). Register(); - //CreateRecipe(). - //AddIngredient(4). - //AddTile(TileID.WorkBenches). - //Register(); + CreateRecipe(). + AddIngredient(4). + AddTile(TileID.WorkBenches). + Register(); } } } diff --git a/Items/Placeables/HardenedAstralSand.cs b/Items/Placeables/HardenedAstralSand.cs index 7c3912e801..ba66ae62c3 100644 --- a/Items/Placeables/HardenedAstralSand.cs +++ b/Items/Placeables/HardenedAstralSand.cs @@ -14,6 +14,8 @@ namespace CalamityMod.Items.Placeables public override void SetDefaults() { + Item.width = 16; + Item.height = 16; Item.createTile = ModContent.TileType(); Item.useStyle = ItemUseStyleID.Swing; Item.useTurn = true; @@ -21,8 +23,6 @@ namespace CalamityMod.Items.Placeables Item.useTime = 10; Item.autoReuse = true; Item.consumable = true; - Item.width = 16; - Item.height = 16; Item.maxStack = 9999; } diff --git a/Items/Placeables/HardenedEutrophicSand.cs b/Items/Placeables/HardenedEutrophicSand.cs index fcc1c42067..d12f6498e8 100644 --- a/Items/Placeables/HardenedEutrophicSand.cs +++ b/Items/Placeables/HardenedEutrophicSand.cs @@ -1,6 +1,6 @@ using CalamityMod.Items.Placeables.Walls; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables { @@ -15,6 +15,8 @@ namespace CalamityMod.Items.Placeables public override void SetDefaults() { + Item.width = 13; + Item.height = 10; Item.createTile = ModContent.TileType(); Item.useStyle = ItemUseStyleID.Swing; Item.useTurn = true; @@ -22,8 +24,6 @@ namespace CalamityMod.Items.Placeables Item.useTime = 10; Item.autoReuse = true; Item.consumable = true; - Item.width = 13; - Item.height = 10; Item.maxStack = 9999; } diff --git a/Items/Placeables/HardenedSulphurousSandstone.cs b/Items/Placeables/HardenedSulphurousSandstone.cs index f526a33851..2262dd8e49 100644 --- a/Items/Placeables/HardenedSulphurousSandstone.cs +++ b/Items/Placeables/HardenedSulphurousSandstone.cs @@ -13,6 +13,8 @@ namespace CalamityMod.Items.Placeables public override void SetDefaults() { + Item.width = 16; + Item.height = 16; Item.createTile = ModContent.TileType(); Item.useStyle = ItemUseStyleID.Swing; Item.useTurn = true; @@ -20,8 +22,6 @@ namespace CalamityMod.Items.Placeables Item.useTime = 10; Item.autoReuse = true; Item.consumable = true; - Item.width = 16; - Item.height = 16; Item.maxStack = 9999; } diff --git a/Items/Placeables/LivingFire/LivingBrimstoneFireBlock.cs b/Items/Placeables/LivingFire/LivingBrimstoneFireBlock.cs index bbca7a2ad8..46fa5d8754 100644 --- a/Items/Placeables/LivingFire/LivingBrimstoneFireBlock.cs +++ b/Items/Placeables/LivingFire/LivingBrimstoneFireBlock.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.LivingFire; +using CalamityMod.Tiles.LivingFire; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Items/Placeables/LivingFire/LivingGodSlayerFireBlock.cs b/Items/Placeables/LivingFire/LivingGodSlayerFireBlock.cs index d1b943560a..afab6f7513 100644 --- a/Items/Placeables/LivingFire/LivingGodSlayerFireBlock.cs +++ b/Items/Placeables/LivingFire/LivingGodSlayerFireBlock.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Tiles.LivingFire; using Terraria; using Terraria.ID; diff --git a/Items/Placeables/LivingFire/LivingHolyFireBlock.cs b/Items/Placeables/LivingFire/LivingHolyFireBlock.cs index c62ef35709..edc5fc89e4 100644 --- a/Items/Placeables/LivingFire/LivingHolyFireBlock.cs +++ b/Items/Placeables/LivingFire/LivingHolyFireBlock.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Tiles.LivingFire; using Terraria; using Terraria.ID; diff --git a/Items/Placeables/MusicBoxes/DraedonsAmbienceMusicBox.cs b/Items/Placeables/MusicBoxes/DraedonExoSelectMusicBox.cs similarity index 72% rename from Items/Placeables/MusicBoxes/DraedonsAmbienceMusicBox.cs rename to Items/Placeables/MusicBoxes/DraedonExoSelectMusicBox.cs index c5218600e3..5203a79546 100644 --- a/Items/Placeables/MusicBoxes/DraedonsAmbienceMusicBox.cs +++ b/Items/Placeables/MusicBoxes/DraedonExoSelectMusicBox.cs @@ -1,10 +1,10 @@ using Terraria.ID; using Terraria.ModLoader; -using Terraria.Utilities; namespace CalamityMod.Items.Placeables.MusicBoxes { - public class DraedonsAmbienceMusicBox : ModItem, ILocalizedModType + [LegacyName("DraedonsAmbienceMusicBox")] + public class DraedonExoSelectMusicBox : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; @@ -14,6 +14,6 @@ namespace CalamityMod.Items.Placeables.MusicBoxes ItemID.Sets.ShimmerTransformToItem[Type] = ItemID.MusicBox; } - public override void SetDefaults() => Item.DefaultToMusicBox(ModContent.TileType(), 0); + public override void SetDefaults() => Item.DefaultToMusicBox(ModContent.TileType(), 0); } } diff --git a/Items/Placeables/MusicBoxes/DraedonsAmbienceMusicBox.png b/Items/Placeables/MusicBoxes/DraedonExoSelectMusicBox.png similarity index 100% rename from Items/Placeables/MusicBoxes/DraedonsAmbienceMusicBox.png rename to Items/Placeables/MusicBoxes/DraedonExoSelectMusicBox.png diff --git a/Items/Placeables/MusicBoxes/DraedonTalkMusicBox.cs b/Items/Placeables/MusicBoxes/DraedonTalkMusicBox.cs new file mode 100644 index 0000000000..339f207a1a --- /dev/null +++ b/Items/Placeables/MusicBoxes/DraedonTalkMusicBox.cs @@ -0,0 +1,18 @@ +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.MusicBoxes +{ + public class DraedonTalkMusicBox : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + + public override void SetStaticDefaults() + { + ItemID.Sets.CanGetPrefixes[Type] = false; + ItemID.Sets.ShimmerTransformToItem[Type] = ItemID.MusicBox; + } + + public override void SetDefaults() => Item.DefaultToMusicBox(ModContent.TileType(), 0); + } +} diff --git a/Items/Placeables/MusicBoxes/DraedonTalkMusicBox.png b/Items/Placeables/MusicBoxes/DraedonTalkMusicBox.png new file mode 100644 index 0000000000..5177be35c8 Binary files /dev/null and b/Items/Placeables/MusicBoxes/DraedonTalkMusicBox.png differ diff --git a/Items/Placeables/Navystone.cs b/Items/Placeables/Navystone.cs index 6ff97b4820..bb4af23fa1 100644 --- a/Items/Placeables/Navystone.cs +++ b/Items/Placeables/Navystone.cs @@ -16,6 +16,8 @@ namespace CalamityMod.Items.Placeables public override void SetDefaults() { + Item.width = 13; + Item.height = 10; Item.createTile = ModContent.TileType(); Item.useStyle = ItemUseStyleID.Swing; Item.useTurn = true; @@ -23,8 +25,6 @@ namespace CalamityMod.Items.Placeables Item.useTime = 10; Item.autoReuse = true; Item.consumable = true; - Item.width = 13; - Item.height = 10; Item.maxStack = 9999; } diff --git a/Items/Placeables/NovaeSlag.cs b/Items/Placeables/NovaeSlag.cs index 70d66f24f6..78983dd0f0 100644 --- a/Items/Placeables/NovaeSlag.cs +++ b/Items/Placeables/NovaeSlag.cs @@ -12,11 +12,13 @@ namespace CalamityMod.Items.Placeables public override void SetStaticDefaults() { Item.ResearchUnlockCount = 200; - ItemID.Sets.SortingPriorityExtractibles[Type] = 1; // Silt Block + ItemID.Sets.SortingPriorityExtractibles[Type] = 1; // Silt Block } public override void SetDefaults() { + Item.width = 16; + Item.height = 16; ItemID.Sets.ExtractinatorMode[Item.type] = Item.type; Item.createTile = ModContent.TileType(); Item.useStyle = ItemUseStyleID.Swing; @@ -25,8 +27,6 @@ namespace CalamityMod.Items.Placeables Item.useTime = 10; Item.autoReuse = true; Item.consumable = true; - Item.width = 16; - Item.height = 16; Item.maxStack = 9999; } public override void ExtractinatorUse(int extractinatorBlockType, ref int resultType, ref int resultStack) @@ -70,7 +70,7 @@ namespace CalamityMod.Items.Placeables } else if (val < 58.03f) { - resultType = ModContent.ItemType(); + resultType = ModContent.ItemType(); resultStack = Main.rand.Next(1, 21); } else if (val < 61.03f) diff --git a/Items/Placeables/Ores/AerialiteOre.cs b/Items/Placeables/Ores/AerialiteOre.cs index 09378cb76b..85218b62c2 100644 --- a/Items/Placeables/Ores/AerialiteOre.cs +++ b/Items/Placeables/Ores/AerialiteOre.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,11 +10,13 @@ namespace CalamityMod.Items.Placeables.Ores public override void SetStaticDefaults() { Item.ResearchUnlockCount = 100; - ItemID.Sets.SortingPriorityMaterials[Type] = 69; // Hellstone + ItemID.Sets.SortingPriorityMaterials[Type] = 69; // Hellstone } public override void SetDefaults() { + Item.width = 13; + Item.height = 10; Item.createTile = ModContent.TileType(); Item.useStyle = ItemUseStyleID.Swing; Item.useTurn = true; @@ -22,8 +24,6 @@ namespace CalamityMod.Items.Placeables.Ores Item.useTime = 10; Item.autoReuse = true; Item.consumable = true; - Item.width = 13; - Item.height = 10; Item.maxStack = 9999; Item.value = Item.sellPrice(silver: 6); Item.rare = ItemRarityID.Orange; diff --git a/Items/Placeables/Ores/AerialiteOreDisenchanted.cs b/Items/Placeables/Ores/AerialiteOreDisenchanted.cs index 12334b9f91..15a98f66f4 100644 --- a/Items/Placeables/Ores/AerialiteOreDisenchanted.cs +++ b/Items/Placeables/Ores/AerialiteOreDisenchanted.cs @@ -10,11 +10,13 @@ namespace CalamityMod.Items.Placeables.Ores public override void SetStaticDefaults() { Item.ResearchUnlockCount = 100; - ItemID.Sets.SortingPriorityMaterials[Type] = 69; // Hellstone + ItemID.Sets.SortingPriorityMaterials[Type] = 69; // Hellstone } public override void SetDefaults() { + Item.width = 13; + Item.height = 10; Item.createTile = ModContent.TileType(); Item.useStyle = ItemUseStyleID.Swing; Item.useTurn = true; @@ -22,8 +24,6 @@ namespace CalamityMod.Items.Placeables.Ores Item.useTime = 10; Item.autoReuse = true; Item.consumable = true; - Item.width = 13; - Item.height = 10; Item.maxStack = 9999; Item.value = Item.sellPrice(silver: 6); Item.rare = ItemRarityID.Orange; diff --git a/Items/Placeables/Ores/AstralOre.cs b/Items/Placeables/Ores/AstralOre.cs index 2205ddc8e7..6e3acc6cca 100644 --- a/Items/Placeables/Ores/AstralOre.cs +++ b/Items/Placeables/Ores/AstralOre.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,11 +10,13 @@ namespace CalamityMod.Items.Placeables.Ores public override void SetStaticDefaults() { Item.ResearchUnlockCount = 100; - ItemID.Sets.SortingPriorityMaterials[Type] = 99; // Luminite + ItemID.Sets.SortingPriorityMaterials[Type] = 99; // Luminite } public override void SetDefaults() { + Item.width = 22; + Item.height = 22; Item.createTile = ModContent.TileType(); Item.useStyle = ItemUseStyleID.Swing; Item.useTurn = true; @@ -22,8 +24,6 @@ namespace CalamityMod.Items.Placeables.Ores Item.useTime = 10; Item.autoReuse = true; Item.consumable = true; - Item.width = 22; - Item.height = 22; Item.maxStack = 9999; Item.value = Item.sellPrice(silver: 36); Item.rare = ItemRarityID.Cyan; diff --git a/Items/Placeables/Ores/AuricOre.cs b/Items/Placeables/Ores/AuricOre.cs index 158f5f0cac..b1e3ec05c6 100644 --- a/Items/Placeables/Ores/AuricOre.cs +++ b/Items/Placeables/Ores/AuricOre.cs @@ -11,11 +11,13 @@ namespace CalamityMod.Items.Placeables.Ores public override void SetStaticDefaults() { Item.ResearchUnlockCount = 100; - ItemID.Sets.SortingPriorityMaterials[Type] = 119; + ItemID.Sets.SortingPriorityMaterials[Type] = 119; } public override void SetDefaults() { + Item.width = 10; + Item.height = 10; Item.createTile = ModContent.TileType(); Item.useStyle = ItemUseStyleID.Swing; Item.useTurn = true; @@ -23,8 +25,6 @@ namespace CalamityMod.Items.Placeables.Ores Item.useTime = 10; Item.autoReuse = true; Item.consumable = true; - Item.width = 10; - Item.height = 10; Item.maxStack = 9999; Item.value = Item.sellPrice(gold: 4); Item.rare = ModContent.RarityType(); diff --git a/Items/Placeables/Ores/CryonicOre.cs b/Items/Placeables/Ores/CryonicOre.cs index 8a2f152ce3..808d5b4062 100644 --- a/Items/Placeables/Ores/CryonicOre.cs +++ b/Items/Placeables/Ores/CryonicOre.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,11 +10,13 @@ namespace CalamityMod.Items.Placeables.Ores public override void SetStaticDefaults() { Item.ResearchUnlockCount = 100; - ItemID.Sets.SortingPriorityMaterials[Type] = 90; // Chlorophyte Ore + ItemID.Sets.SortingPriorityMaterials[Type] = 90; // Chlorophyte Ore } public override void SetDefaults() { + Item.width = 13; + Item.height = 10; Item.createTile = ModContent.TileType(); Item.useStyle = ItemUseStyleID.Swing; Item.useTurn = true; @@ -22,8 +24,6 @@ namespace CalamityMod.Items.Placeables.Ores Item.useTime = 10; Item.autoReuse = true; Item.consumable = true; - Item.width = 13; - Item.height = 10; Item.maxStack = 9999; Item.value = Item.sellPrice(silver: 12); Item.rare = ItemRarityID.Pink; diff --git a/Items/Placeables/Ores/ExodiumCluster.cs b/Items/Placeables/Ores/ExodiumCluster.cs index f894b8691f..5a56926b8b 100644 --- a/Items/Placeables/Ores/ExodiumCluster.cs +++ b/Items/Placeables/Ores/ExodiumCluster.cs @@ -12,11 +12,13 @@ namespace CalamityMod.Items.Placeables.Ores public override void SetStaticDefaults() { Item.ResearchUnlockCount = 100; - ItemID.Sets.SortingPriorityMaterials[Type] = 101; + ItemID.Sets.SortingPriorityMaterials[Type] = 101; } public override void SetDefaults() { + Item.width = 13; + Item.height = 10; Item.createTile = ModContent.TileType(); Item.useStyle = ItemUseStyleID.Swing; Item.useTurn = true; @@ -24,8 +26,6 @@ namespace CalamityMod.Items.Placeables.Ores Item.useTime = 10; Item.autoReuse = true; Item.consumable = true; - Item.width = 13; - Item.height = 10; Item.maxStack = 9999; Item.value = Item.sellPrice(gold: 1, silver: 60); Item.rare = ItemRarityID.Red; diff --git a/Items/Placeables/Ores/HallowedOre.cs b/Items/Placeables/Ores/HallowedOre.cs index 7a46e72835..34abf9649b 100644 --- a/Items/Placeables/Ores/HallowedOre.cs +++ b/Items/Placeables/Ores/HallowedOre.cs @@ -10,11 +10,13 @@ namespace CalamityMod.Items.Placeables.Ores public override void SetStaticDefaults() { Item.ResearchUnlockCount = 100; - ItemID.Sets.SortingPriorityMaterials[Type] = 89; // Hallowed Bar + ItemID.Sets.SortingPriorityMaterials[Type] = 89; // Hallowed Bar } public override void SetDefaults() { + Item.width = 13; + Item.height = 10; Item.createTile = ModContent.TileType(); Item.useStyle = ItemUseStyleID.Swing; Item.useTurn = true; @@ -22,8 +24,6 @@ namespace CalamityMod.Items.Placeables.Ores Item.useTime = 10; Item.autoReuse = true; Item.consumable = true; - Item.width = 13; - Item.height = 10; Item.maxStack = 9999; Item.value = Item.sellPrice(silver: 12); Item.rare = ItemRarityID.Pink; diff --git a/Items/Placeables/Ores/InfernalSuevite.cs b/Items/Placeables/Ores/InfernalSuevite.cs index 4f85d90e90..f382f01c38 100644 --- a/Items/Placeables/Ores/InfernalSuevite.cs +++ b/Items/Placeables/Ores/InfernalSuevite.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -11,11 +11,13 @@ namespace CalamityMod.Items.Placeables.Ores public override void SetStaticDefaults() { Item.ResearchUnlockCount = 100; - ItemID.Sets.SortingPriorityMaterials[Type] = 90; // Chlorophyte Ore + ItemID.Sets.SortingPriorityMaterials[Type] = 90; // Chlorophyte Ore } public override void SetDefaults() { + Item.width = 16; + Item.height = 16; Item.createTile = ModContent.TileType(); Item.useStyle = ItemUseStyleID.Swing; Item.useTurn = true; @@ -23,8 +25,6 @@ namespace CalamityMod.Items.Placeables.Ores Item.useTime = 10; Item.autoReuse = true; Item.consumable = true; - Item.width = 16; - Item.height = 16; Item.maxStack = 9999; Item.value = Item.sellPrice(silver: 12); Item.rare = ItemRarityID.Pink; diff --git a/Items/Placeables/Ores/PerennialOre.cs b/Items/Placeables/Ores/PerennialOre.cs index 9250be654d..a97770a14c 100644 --- a/Items/Placeables/Ores/PerennialOre.cs +++ b/Items/Placeables/Ores/PerennialOre.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,11 +10,13 @@ namespace CalamityMod.Items.Placeables.Ores public override void SetStaticDefaults() { Item.ResearchUnlockCount = 100; - ItemID.Sets.SortingPriorityMaterials[Type] = 92; // Shroomite Bar + ItemID.Sets.SortingPriorityMaterials[Type] = 92; // Shroomite Bar } public override void SetDefaults() { + Item.width = 12; + Item.height = 10; Item.createTile = ModContent.TileType(); Item.useStyle = ItemUseStyleID.Swing; Item.useTurn = true; @@ -22,8 +24,6 @@ namespace CalamityMod.Items.Placeables.Ores Item.useTime = 10; Item.autoReuse = true; Item.consumable = true; - Item.width = 12; - Item.height = 10; Item.maxStack = 9999; Item.value = Item.sellPrice(silver: 18); Item.rare = ItemRarityID.Lime; diff --git a/Items/Placeables/Ores/ScoriaOre.cs b/Items/Placeables/Ores/ScoriaOre.cs index 43a977de3c..889fbacf99 100644 --- a/Items/Placeables/Ores/ScoriaOre.cs +++ b/Items/Placeables/Ores/ScoriaOre.cs @@ -11,11 +11,13 @@ namespace CalamityMod.Items.Placeables.Ores public override void SetStaticDefaults() { Item.ResearchUnlockCount = 100; - ItemID.Sets.SortingPriorityMaterials[Type] = 95; // Stardust Fragment + ItemID.Sets.SortingPriorityMaterials[Type] = 95; // Stardust Fragment } public override void SetDefaults() { + Item.width = 10; + Item.height = 10; Item.createTile = ModContent.TileType(); Item.useStyle = ItemUseStyleID.Swing; Item.useTurn = true; @@ -23,8 +25,6 @@ namespace CalamityMod.Items.Placeables.Ores Item.useTime = 10; Item.autoReuse = true; Item.consumable = true; - Item.width = 10; - Item.height = 10; Item.maxStack = 9999; Item.value = Item.sellPrice(silver: 24); Item.rare = ItemRarityID.Yellow; diff --git a/Items/Placeables/Ores/UelibloomOre.cs b/Items/Placeables/Ores/UelibloomOre.cs index 71c98433e8..1cbe71b9a4 100644 --- a/Items/Placeables/Ores/UelibloomOre.cs +++ b/Items/Placeables/Ores/UelibloomOre.cs @@ -11,11 +11,13 @@ namespace CalamityMod.Items.Placeables.Ores public override void SetStaticDefaults() { Item.ResearchUnlockCount = 100; - ItemID.Sets.SortingPriorityMaterials[Type] = 105; + ItemID.Sets.SortingPriorityMaterials[Type] = 105; } public override void SetDefaults() { + Item.width = 10; + Item.height = 10; Item.createTile = ModContent.TileType(); Item.useStyle = ItemUseStyleID.Swing; Item.useTurn = true; @@ -23,8 +25,6 @@ namespace CalamityMod.Items.Placeables.Ores Item.useTime = 10; Item.autoReuse = true; Item.consumable = true; - Item.width = 10; - Item.height = 10; Item.maxStack = 9999; Item.rare = ModContent.RarityType(); Item.value = Item.sellPrice(gold: 1); diff --git a/Items/Placeables/PlaceableTurrets/FireTurret.cs b/Items/Placeables/PlaceableTurrets/FireTurret.cs index 5295f1a951..8127d848a9 100644 --- a/Items/Placeables/PlaceableTurrets/FireTurret.cs +++ b/Items/Placeables/PlaceableTurrets/FireTurret.cs @@ -1,12 +1,12 @@ -using CalamityMod.Tiles.PlayerTurrets; +using System; +using System.Collections.Generic; +using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Plates; -using CalamityMod.CustomRecipes; +using CalamityMod.Tiles.PlayerTurrets; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using System; -using System.Collections.Generic; namespace CalamityMod.Items.Placeables.PlaceableTurrets { diff --git a/Items/Placeables/PlaceableTurrets/IceTurret.cs b/Items/Placeables/PlaceableTurrets/IceTurret.cs index 684dac4ba8..74996095c7 100644 --- a/Items/Placeables/PlaceableTurrets/IceTurret.cs +++ b/Items/Placeables/PlaceableTurrets/IceTurret.cs @@ -1,12 +1,12 @@ -using CalamityMod.Tiles.PlayerTurrets; +using System; +using System.Collections.Generic; +using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Plates; -using CalamityMod.CustomRecipes; +using CalamityMod.Tiles.PlayerTurrets; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using System; -using System.Collections.Generic; namespace CalamityMod.Items.Placeables.PlaceableTurrets { diff --git a/Items/Placeables/PlaceableTurrets/LabTurret.cs b/Items/Placeables/PlaceableTurrets/LabTurret.cs index 088905713f..309ea046d5 100644 --- a/Items/Placeables/PlaceableTurrets/LabTurret.cs +++ b/Items/Placeables/PlaceableTurrets/LabTurret.cs @@ -1,11 +1,11 @@ -using CalamityMod.Tiles.PlayerTurrets; -using CalamityMod.Items.Materials; +using System; +using System.Collections.Generic; using CalamityMod.CustomRecipes; +using CalamityMod.Items.Materials; +using CalamityMod.Tiles.PlayerTurrets; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using System; -using System.Collections.Generic; namespace CalamityMod.Items.Placeables.PlaceableTurrets { diff --git a/Items/Placeables/PlaceableTurrets/LaserTurret .cs b/Items/Placeables/PlaceableTurrets/LaserTurret .cs index 0cdb7a1028..bbfa32629c 100644 --- a/Items/Placeables/PlaceableTurrets/LaserTurret .cs +++ b/Items/Placeables/PlaceableTurrets/LaserTurret .cs @@ -1,12 +1,12 @@ -using CalamityMod.Tiles.PlayerTurrets; +using System; +using System.Collections.Generic; +using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Plates; -using CalamityMod.CustomRecipes; +using CalamityMod.Tiles.PlayerTurrets; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using System; -using System.Collections.Generic; namespace CalamityMod.Items.Placeables.PlaceableTurrets { diff --git a/Items/Placeables/PlaceableTurrets/OnyxTurret.cs b/Items/Placeables/PlaceableTurrets/OnyxTurret.cs index d4c7baae4b..94ee1a3708 100644 --- a/Items/Placeables/PlaceableTurrets/OnyxTurret.cs +++ b/Items/Placeables/PlaceableTurrets/OnyxTurret.cs @@ -1,12 +1,12 @@ -using CalamityMod.Tiles.PlayerTurrets; +using System; +using System.Collections.Generic; +using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Plates; -using CalamityMod.CustomRecipes; +using CalamityMod.Tiles.PlayerTurrets; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using System; -using System.Collections.Generic; namespace CalamityMod.Items.Placeables.PlaceableTurrets { diff --git a/Items/Placeables/PlaceableTurrets/PlagueTurret.cs b/Items/Placeables/PlaceableTurrets/PlagueTurret.cs index cc151f78c9..7fb7eb6eaf 100644 --- a/Items/Placeables/PlaceableTurrets/PlagueTurret.cs +++ b/Items/Placeables/PlaceableTurrets/PlagueTurret.cs @@ -1,12 +1,12 @@ -using CalamityMod.Tiles.PlayerTurrets; +using System; +using System.Collections.Generic; +using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Plates; -using CalamityMod.CustomRecipes; +using CalamityMod.Tiles.PlayerTurrets; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using System; -using System.Collections.Generic; namespace CalamityMod.Items.Placeables.PlaceableTurrets { diff --git a/Items/Placeables/PlaceableTurrets/WaterTurret.cs b/Items/Placeables/PlaceableTurrets/WaterTurret.cs index f4868d41a7..6eb12d47f0 100644 --- a/Items/Placeables/PlaceableTurrets/WaterTurret.cs +++ b/Items/Placeables/PlaceableTurrets/WaterTurret.cs @@ -1,12 +1,12 @@ -using CalamityMod.Tiles.PlayerTurrets; +using System; +using System.Collections.Generic; +using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Plates; -using CalamityMod.CustomRecipes; +using CalamityMod.Tiles.PlayerTurrets; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using System; -using System.Collections.Generic; namespace CalamityMod.Items.Placeables.PlaceableTurrets { diff --git a/Items/Placeables/PlantyMush.cs b/Items/Placeables/PlantyMush.cs index 20631ac927..e1477cf719 100644 --- a/Items/Placeables/PlantyMush.cs +++ b/Items/Placeables/PlantyMush.cs @@ -14,6 +14,8 @@ namespace CalamityMod.Items.Placeables public override void SetDefaults() { + Item.width = 13; + Item.height = 10; Item.createTile = ModContent.TileType(); Item.useStyle = ItemUseStyleID.Swing; Item.useTurn = true; @@ -21,8 +23,6 @@ namespace CalamityMod.Items.Placeables Item.useTime = 10; Item.autoReuse = true; Item.consumable = true; - Item.width = 13; - Item.height = 10; Item.maxStack = 9999; Item.value = Item.sellPrice(silver: 6); Item.rare = ItemRarityID.Orange; @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Placeables public override void CaughtFishStack(ref int stack) { - stack = Main.rand.Next(5,16); + stack = Main.rand.Next(5, 16); } } } diff --git a/Items/Placeables/Plates/Cinderplate.cs b/Items/Placeables/Plates/Cinderplate.cs index 9a918436d2..7d4b3976ca 100644 --- a/Items/Placeables/Plates/Cinderplate.cs +++ b/Items/Placeables/Plates/Cinderplate.cs @@ -1,5 +1,5 @@ -using CalamityMod.Items.Placeables.Walls; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Walls; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -17,6 +17,8 @@ namespace CalamityMod.Items.Placeables.Plates public override void SetDefaults() { + Item.width = 13; + Item.height = 10; Item.createTile = ModContent.TileType(); Item.useStyle = ItemUseStyleID.Swing; Item.useTurn = true; @@ -24,8 +26,6 @@ namespace CalamityMod.Items.Placeables.Plates Item.useTime = 10; Item.autoReuse = true; Item.consumable = true; - Item.width = 13; - Item.height = 10; Item.maxStack = 9999; Item.value = Item.sellPrice(silver: 3); Item.rare = ItemRarityID.Orange; diff --git a/Items/Placeables/Plates/Elumplate.cs b/Items/Placeables/Plates/Elumplate.cs index e7e58cafd9..f01666932c 100644 --- a/Items/Placeables/Plates/Elumplate.cs +++ b/Items/Placeables/Plates/Elumplate.cs @@ -1,5 +1,5 @@ -using CalamityMod.Items.Placeables.Walls; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Walls; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -17,6 +17,8 @@ namespace CalamityMod.Items.Placeables.Plates public override void SetDefaults() { + Item.width = 13; + Item.height = 10; Item.createTile = ModContent.TileType(); Item.useStyle = ItemUseStyleID.Swing; Item.useTurn = true; @@ -24,8 +26,6 @@ namespace CalamityMod.Items.Placeables.Plates Item.useTime = 10; Item.autoReuse = true; Item.consumable = true; - Item.width = 13; - Item.height = 10; Item.maxStack = 9999; Item.value = Item.sellPrice(silver: 3); Item.rare = ItemRarityID.Orange; diff --git a/Items/Placeables/Plates/Havocplate.cs b/Items/Placeables/Plates/Havocplate.cs index 4566c0d6f4..7493866f59 100644 --- a/Items/Placeables/Plates/Havocplate.cs +++ b/Items/Placeables/Plates/Havocplate.cs @@ -1,5 +1,5 @@ -using CalamityMod.Items.Placeables.Walls; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Walls; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -18,6 +18,8 @@ namespace CalamityMod.Items.Placeables.Plates public override void SetDefaults() { + Item.width = 13; + Item.height = 10; Item.createTile = ModContent.TileType(); Item.useStyle = ItemUseStyleID.Swing; Item.useTurn = true; @@ -25,8 +27,6 @@ namespace CalamityMod.Items.Placeables.Plates Item.useTime = 10; Item.autoReuse = true; Item.consumable = true; - Item.width = 13; - Item.height = 10; Item.maxStack = 9999; Item.value = Item.sellPrice(silver: 3); Item.rare = ItemRarityID.Orange; diff --git a/Items/Placeables/Plates/Navyplate.cs b/Items/Placeables/Plates/Navyplate.cs index b1a99031d1..0471f5826e 100644 --- a/Items/Placeables/Plates/Navyplate.cs +++ b/Items/Placeables/Plates/Navyplate.cs @@ -16,6 +16,8 @@ namespace CalamityMod.Items.Placeables.Plates public override void SetDefaults() { + Item.width = 13; + Item.height = 10; Item.createTile = ModContent.TileType(); Item.useStyle = ItemUseStyleID.Swing; Item.useTurn = true; @@ -23,8 +25,6 @@ namespace CalamityMod.Items.Placeables.Plates Item.useTime = 10; Item.autoReuse = true; Item.consumable = true; - Item.width = 13; - Item.height = 10; Item.maxStack = 9999; Item.value = Item.sellPrice(silver: 3); Item.rare = ItemRarityID.Orange; diff --git a/Items/Placeables/Plates/Onyxplate.cs b/Items/Placeables/Plates/Onyxplate.cs index 04b98c27c6..287167982e 100644 --- a/Items/Placeables/Plates/Onyxplate.cs +++ b/Items/Placeables/Plates/Onyxplate.cs @@ -1,5 +1,5 @@ -using CalamityMod.Items.Placeables.Walls; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Walls; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -17,6 +17,8 @@ namespace CalamityMod.Items.Placeables.Plates public override void SetDefaults() { + Item.width = 13; + Item.height = 10; Item.createTile = ModContent.TileType(); Item.useStyle = ItemUseStyleID.Swing; Item.useTurn = true; @@ -24,8 +26,6 @@ namespace CalamityMod.Items.Placeables.Plates Item.useTime = 10; Item.autoReuse = true; Item.consumable = true; - Item.width = 13; - Item.height = 10; Item.maxStack = 9999; Item.value = Item.sellPrice(silver: 3); Item.rare = ItemRarityID.Orange; diff --git a/Items/Placeables/Plates/Plagueplate.cs b/Items/Placeables/Plates/Plagueplate.cs index 25b0bcc07c..513a8efbed 100644 --- a/Items/Placeables/Plates/Plagueplate.cs +++ b/Items/Placeables/Plates/Plagueplate.cs @@ -1,5 +1,5 @@ -using CalamityMod.Items.Placeables.Walls; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Walls; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -18,6 +18,8 @@ namespace CalamityMod.Items.Placeables.Plates public override void SetDefaults() { + Item.width = 13; + Item.height = 10; Item.createTile = ModContent.TileType(); Item.useStyle = ItemUseStyleID.Swing; Item.useTurn = true; @@ -25,8 +27,6 @@ namespace CalamityMod.Items.Placeables.Plates Item.useTime = 10; Item.autoReuse = true; Item.consumable = true; - Item.width = 13; - Item.height = 10; Item.maxStack = 9999; Item.value = Item.sellPrice(silver: 3); Item.rare = ItemRarityID.Orange; diff --git a/Items/Placeables/PrismShard.cs b/Items/Placeables/PrismShard.cs index 8c502c8fdf..ba6cf09ed3 100644 --- a/Items/Placeables/PrismShard.cs +++ b/Items/Placeables/PrismShard.cs @@ -14,6 +14,8 @@ namespace CalamityMod.Items.Placeables public override void SetDefaults() { + Item.width = 26; + Item.height = 26; Item.createTile = ModContent.TileType(); Item.useStyle = ItemUseStyleID.Swing; Item.useTurn = true; @@ -21,8 +23,6 @@ namespace CalamityMod.Items.Placeables Item.useTime = 10; Item.autoReuse = true; Item.consumable = true; - Item.width = 26; - Item.height = 26; Item.maxStack = 9999; Item.value = Item.sellPrice(silver: 3); Item.rare = ItemRarityID.Green; diff --git a/Items/Placeables/ScorchedBone.cs b/Items/Placeables/ScorchedBone.cs index 571b0bb88b..6f141f5973 100644 --- a/Items/Placeables/ScorchedBone.cs +++ b/Items/Placeables/ScorchedBone.cs @@ -29,8 +29,8 @@ namespace CalamityMod.Items.Placeables } public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.Wood; + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.Wood; } public override void AddRecipes() diff --git a/Items/Placeables/ScorchedRemains.cs b/Items/Placeables/ScorchedRemains.cs index a8f7905609..864a890ab9 100644 --- a/Items/Placeables/ScorchedRemains.cs +++ b/Items/Placeables/ScorchedRemains.cs @@ -14,6 +14,8 @@ namespace CalamityMod.Items.Placeables public override void SetDefaults() { + Item.width = 13; + Item.height = 10; Item.createTile = ModContent.TileType(); Item.useStyle = ItemUseStyleID.Swing; Item.useTurn = true; @@ -21,8 +23,6 @@ namespace CalamityMod.Items.Placeables Item.useTime = 10; Item.autoReuse = true; Item.consumable = true; - Item.width = 13; - Item.height = 10; Item.maxStack = 9999; Item.value = 1000; Item.rare = ItemRarityID.Orange; diff --git a/Items/Placeables/SeaPrism.cs b/Items/Placeables/SeaPrism.cs index 32f35c6098..a2d6bda82f 100644 --- a/Items/Placeables/SeaPrism.cs +++ b/Items/Placeables/SeaPrism.cs @@ -14,6 +14,8 @@ namespace CalamityMod.Items.Placeables public override void SetDefaults() { + Item.width = 13; + Item.height = 10; Item.createTile = ModContent.TileType(); Item.useStyle = ItemUseStyleID.Swing; Item.useTurn = true; @@ -21,8 +23,6 @@ namespace CalamityMod.Items.Placeables Item.useTime = 10; Item.autoReuse = true; Item.consumable = true; - Item.width = 13; - Item.height = 10; Item.maxStack = 9999; Item.value = Item.sellPrice(silver: 10); Item.rare = ItemRarityID.Green; diff --git a/Items/Placeables/SeaPrismBrick.cs b/Items/Placeables/SeaPrismBrick.cs index 968074d1e4..f87e0cd49c 100644 --- a/Items/Placeables/SeaPrismBrick.cs +++ b/Items/Placeables/SeaPrismBrick.cs @@ -14,9 +14,9 @@ namespace CalamityMod.Items.Placeables public override void SetDefaults() { - Item.createTile = ModContent.TileType(); Item.width = 12; Item.height = 12; + Item.createTile = ModContent.TileType(); Item.maxStack = 9999; Item.useTurn = true; Item.autoReuse = true; diff --git a/Items/Placeables/SpineSapling.cs b/Items/Placeables/SpineSapling.cs index b349cc1624..2fc99a8ed9 100644 --- a/Items/Placeables/SpineSapling.cs +++ b/Items/Placeables/SpineSapling.cs @@ -14,6 +14,8 @@ namespace CalamityMod.Items.Placeables public override void SetDefaults() { + Item.width = 13; + Item.height = 10; Item.createTile = ModContent.TileType(); Item.useStyle = ItemUseStyleID.Swing; Item.useTurn = true; @@ -21,8 +23,6 @@ namespace CalamityMod.Items.Placeables Item.useTime = 10; Item.autoReuse = true; Item.consumable = true; - Item.width = 13; - Item.height = 10; Item.maxStack = 9999; } } diff --git a/Items/Placeables/SulphurousSand.cs b/Items/Placeables/SulphurousSand.cs index b2a11c34f1..0dbe2a305f 100644 --- a/Items/Placeables/SulphurousSand.cs +++ b/Items/Placeables/SulphurousSand.cs @@ -11,6 +11,9 @@ namespace CalamityMod.Items.Placeables { Item.ResearchUnlockCount = 100; ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + + // +5 flat damage, equal to other sand variants + ItemID.Sets.SandgunAmmoProjectileData[Type] = new(ModContent.ProjectileType(), 5); } public override void SetDefaults() diff --git a/Items/Placeables/SulphurousSandstone.cs b/Items/Placeables/SulphurousSandstone.cs index d65e841202..bcf4d5e091 100644 --- a/Items/Placeables/SulphurousSandstone.cs +++ b/Items/Placeables/SulphurousSandstone.cs @@ -13,6 +13,8 @@ namespace CalamityMod.Items.Placeables public override void SetDefaults() { + Item.width = 13; + Item.height = 10; Item.createTile = ModContent.TileType(); Item.useStyle = ItemUseStyleID.Swing; Item.useTurn = true; @@ -20,8 +22,6 @@ namespace CalamityMod.Items.Placeables Item.useTime = 10; Item.autoReuse = true; Item.consumable = true; - Item.width = 13; - Item.height = 10; Item.maxStack = 9999; } diff --git a/Items/Placeables/SulphurousShale.cs b/Items/Placeables/SulphurousShale.cs index 06604c463b..50a0f85292 100644 --- a/Items/Placeables/SulphurousShale.cs +++ b/Items/Placeables/SulphurousShale.cs @@ -13,6 +13,8 @@ namespace CalamityMod.Items.Placeables public override void SetDefaults() { + Item.width = 16; + Item.height = 16; Item.createTile = ModContent.TileType(); Item.useStyle = ItemUseStyleID.Swing; Item.useTurn = true; @@ -20,8 +22,6 @@ namespace CalamityMod.Items.Placeables Item.useTime = 10; Item.autoReuse = true; Item.consumable = true; - Item.width = 16; - Item.height = 16; Item.maxStack = 9999; } diff --git a/Items/Placeables/UelibloomBrick.cs b/Items/Placeables/UelibloomBrick.cs index 02f669a319..bc47762db3 100644 --- a/Items/Placeables/UelibloomBrick.cs +++ b/Items/Placeables/UelibloomBrick.cs @@ -1,7 +1,7 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Items.Placeables.FurnitureBotanic; using CalamityMod.Items.Placeables.Ores; using CalamityMod.Items.Placeables.Walls; -using CalamityMod.Items.Placeables.FurnitureBotanic; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables diff --git a/Items/Placeables/VernalSoil.cs b/Items/Placeables/VernalSoil.cs index 1e776ef4fa..04e7d27cc4 100644 --- a/Items/Placeables/VernalSoil.cs +++ b/Items/Placeables/VernalSoil.cs @@ -13,6 +13,8 @@ namespace CalamityMod.Items.Placeables public override void SetDefaults() { + Item.width = 16; + Item.height = 16; Item.createTile = ModContent.TileType(); Item.useStyle = ItemUseStyleID.Swing; Item.useTurn = true; @@ -20,8 +22,6 @@ namespace CalamityMod.Items.Placeables Item.useTime = 10; Item.autoReuse = true; Item.consumable = true; - Item.width = 16; - Item.height = 16; Item.maxStack = 9999; } } diff --git a/Items/Placeables/Walls/AbyssGravelWallItem.cs b/Items/Placeables/Walls/AbyssGravelWallItem.cs index 7c94f8fff4..4733ef5b8b 100644 --- a/Items/Placeables/Walls/AbyssGravelWallItem.cs +++ b/Items/Placeables/Walls/AbyssGravelWallItem.cs @@ -1,4 +1,4 @@ -using Terraria.ID; +using Terraria.ID; using Terraria.ModLoader; using WallTiles = CalamityMod.Walls; diff --git a/Items/Placeables/Walls/AcidwoodWallItem.cs b/Items/Placeables/Walls/AcidwoodWallItem.cs index e364cc8c30..a755a6c675 100644 --- a/Items/Placeables/Walls/AcidwoodWallItem.cs +++ b/Items/Placeables/Walls/AcidwoodWallItem.cs @@ -1,6 +1,6 @@ -using Terraria.ModLoader; +using Terraria.ID; +using Terraria.ModLoader; using WallTiles = CalamityMod.Walls; -using Terraria.ID; namespace CalamityMod.Items.Placeables.Walls { diff --git a/Items/Placeables/Walls/AerialiteBrickWall.cs b/Items/Placeables/Walls/AerialiteBrickWall.cs index 81ab577a08..a49136e248 100644 --- a/Items/Placeables/Walls/AerialiteBrickWall.cs +++ b/Items/Placeables/Walls/AerialiteBrickWall.cs @@ -1,6 +1,6 @@ +using Terraria.ID; using Terraria.ModLoader; using WallTiles = CalamityMod.Walls; -using Terraria.ID; namespace CalamityMod.Items.Placeables.Walls { diff --git a/Items/Placeables/Walls/AshenSlabWall.cs b/Items/Placeables/Walls/AshenSlabWall.cs index e42db4aa0f..6aff536c43 100644 --- a/Items/Placeables/Walls/AshenSlabWall.cs +++ b/Items/Placeables/Walls/AshenSlabWall.cs @@ -1,7 +1,7 @@ -using CalamityMod.Items.Placeables.FurnitureAshen; +using CalamityMod.Items.Placeables.FurnitureAshen; +using Terraria.ID; using Terraria.ModLoader; using WallTiles = CalamityMod.Walls; -using Terraria.ID; namespace CalamityMod.Items.Placeables.Walls { diff --git a/Items/Placeables/Walls/AstralBrickWall.cs b/Items/Placeables/Walls/AstralBrickWall.cs index 325f8b5162..e3c7958e7d 100644 --- a/Items/Placeables/Walls/AstralBrickWall.cs +++ b/Items/Placeables/Walls/AstralBrickWall.cs @@ -1,6 +1,6 @@ +using Terraria.ID; using Terraria.ModLoader; using WallTiles = CalamityMod.Walls; -using Terraria.ID; namespace CalamityMod.Items.Placeables.Walls { diff --git a/Items/Placeables/Walls/AstralDirtWall.cs b/Items/Placeables/Walls/AstralDirtWall.cs index a63ceec0f3..b9d55f4747 100644 --- a/Items/Placeables/Walls/AstralDirtWall.cs +++ b/Items/Placeables/Walls/AstralDirtWall.cs @@ -1,6 +1,6 @@ +using Terraria.ID; using Terraria.ModLoader; using WallTiles = CalamityMod.Walls; -using Terraria.ID; namespace CalamityMod.Items.Placeables.Walls { diff --git a/Items/Placeables/Walls/AstralGrassWall.cs b/Items/Placeables/Walls/AstralGrassWall.cs index 4535180bf9..0351a93277 100644 --- a/Items/Placeables/Walls/AstralGrassWall.cs +++ b/Items/Placeables/Walls/AstralGrassWall.cs @@ -1,6 +1,6 @@ +using Terraria.ID; using Terraria.ModLoader; using WallTiles = CalamityMod.Walls; -using Terraria.ID; namespace CalamityMod.Items.Placeables.Walls { diff --git a/Items/Placeables/Walls/AstralIceWall.cs b/Items/Placeables/Walls/AstralIceWall.cs index c6a5f6c0f4..c579ec979d 100644 --- a/Items/Placeables/Walls/AstralIceWall.cs +++ b/Items/Placeables/Walls/AstralIceWall.cs @@ -1,6 +1,6 @@ +using Terraria.ID; using Terraria.ModLoader; using WallTiles = CalamityMod.Walls; -using Terraria.ID; namespace CalamityMod.Items.Placeables.Walls { diff --git a/Items/Placeables/Walls/AstralMonolithWall.cs b/Items/Placeables/Walls/AstralMonolithWall.cs index 9fbc46e6f7..756cf24167 100644 --- a/Items/Placeables/Walls/AstralMonolithWall.cs +++ b/Items/Placeables/Walls/AstralMonolithWall.cs @@ -1,4 +1,4 @@ -using Terraria.ID; +using Terraria.ID; using Terraria.ModLoader; using WallTiles = CalamityMod.Walls; diff --git a/Items/Placeables/Walls/AstralSandstoneWall.cs b/Items/Placeables/Walls/AstralSandstoneWall.cs index c35264f8ce..3ac6117746 100644 --- a/Items/Placeables/Walls/AstralSandstoneWall.cs +++ b/Items/Placeables/Walls/AstralSandstoneWall.cs @@ -1,6 +1,6 @@ +using Terraria.ID; using Terraria.ModLoader; using WallTiles = CalamityMod.Walls; -using Terraria.ID; namespace CalamityMod.Items.Placeables.Walls { diff --git a/Items/Placeables/Walls/AstralSnowWall.cs b/Items/Placeables/Walls/AstralSnowWall.cs index 4dc59c8a13..d8c56c6d97 100644 --- a/Items/Placeables/Walls/AstralSnowWall.cs +++ b/Items/Placeables/Walls/AstralSnowWall.cs @@ -1,6 +1,6 @@ +using Terraria.ID; using Terraria.ModLoader; using WallTiles = CalamityMod.Walls; -using Terraria.ID; namespace CalamityMod.Items.Placeables.Walls { diff --git a/Items/Placeables/Walls/AstralStoneWall.cs b/Items/Placeables/Walls/AstralStoneWall.cs index 9a794b98cb..7391417a80 100644 --- a/Items/Placeables/Walls/AstralStoneWall.cs +++ b/Items/Placeables/Walls/AstralStoneWall.cs @@ -1,6 +1,6 @@ +using Terraria.ID; using Terraria.ModLoader; using WallTiles = CalamityMod.Walls; -using Terraria.ID; namespace CalamityMod.Items.Placeables.Walls { diff --git a/Items/Placeables/Walls/BrimstoneSlabWall.cs b/Items/Placeables/Walls/BrimstoneSlabWall.cs index 6238bcf14c..7ca2bcc0bf 100644 --- a/Items/Placeables/Walls/BrimstoneSlabWall.cs +++ b/Items/Placeables/Walls/BrimstoneSlabWall.cs @@ -1,6 +1,6 @@ -using Terraria.ModLoader; +using Terraria.ID; +using Terraria.ModLoader; using WallTiles = CalamityMod.Walls; -using Terraria.ID; namespace CalamityMod.Items.Placeables.Walls { @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Placeables.Walls Item.createWall = ModContent.WallType(); } - public override void AddRecipes() + public override void AddRecipes() { CreateRecipe(4). AddIngredient(). diff --git a/Items/Placeables/Walls/BrimstoneSlagWall.cs b/Items/Placeables/Walls/BrimstoneSlagWall.cs index a92faefd1a..5694ffc362 100644 --- a/Items/Placeables/Walls/BrimstoneSlagWall.cs +++ b/Items/Placeables/Walls/BrimstoneSlagWall.cs @@ -1,6 +1,6 @@ -using Terraria.ModLoader; +using Terraria.ID; +using Terraria.ModLoader; using WallTiles = CalamityMod.Walls; -using Terraria.ID; namespace CalamityMod.Items.Placeables.Walls { diff --git a/Items/Placeables/Walls/CelestialRemainsWall.cs b/Items/Placeables/Walls/CelestialRemainsWall.cs index a29cd838df..2c41dcb379 100644 --- a/Items/Placeables/Walls/CelestialRemainsWall.cs +++ b/Items/Placeables/Walls/CelestialRemainsWall.cs @@ -1,6 +1,6 @@ -using Terraria.ModLoader; +using Terraria.ID; +using Terraria.ModLoader; using WallTiles = CalamityMod.Walls; -using Terraria.ID; namespace CalamityMod.Items.Placeables.Walls { diff --git a/Items/Placeables/Walls/CinderplateWall.cs b/Items/Placeables/Walls/CinderplateWall.cs index d136d4532c..6b23fe0f91 100644 --- a/Items/Placeables/Walls/CinderplateWall.cs +++ b/Items/Placeables/Walls/CinderplateWall.cs @@ -1,6 +1,6 @@ +using Terraria.ID; using Terraria.ModLoader; using WallTiles = CalamityMod.Walls; -using Terraria.ID; namespace CalamityMod.Items.Placeables.Walls { diff --git a/Items/Placeables/Walls/CosmiliteBrickWall.cs b/Items/Placeables/Walls/CosmiliteBrickWall.cs index 7cd25d5089..b18e61237b 100644 --- a/Items/Placeables/Walls/CosmiliteBrickWall.cs +++ b/Items/Placeables/Walls/CosmiliteBrickWall.cs @@ -1,7 +1,7 @@ -using CalamityMod.Items.Placeables.FurnitureCosmilite; +using CalamityMod.Items.Placeables.FurnitureCosmilite; +using Terraria.ID; using Terraria.ModLoader; using WallTiles = CalamityMod.Walls; -using Terraria.ID; namespace CalamityMod.Items.Placeables.Walls { diff --git a/Items/Placeables/Walls/CryonicBrickWall.cs b/Items/Placeables/Walls/CryonicBrickWall.cs index d076139a2c..8d1275ffee 100644 --- a/Items/Placeables/Walls/CryonicBrickWall.cs +++ b/Items/Placeables/Walls/CryonicBrickWall.cs @@ -1,6 +1,6 @@ +using Terraria.ID; using Terraria.ModLoader; using WallTiles = CalamityMod.Walls; -using Terraria.ID; namespace CalamityMod.Items.Placeables.Walls { diff --git a/Items/Placeables/Walls/DraedonStructures/HazardChevronWall.cs b/Items/Placeables/Walls/DraedonStructures/HazardChevronWall.cs index 0dbb604623..0cb7c2efd2 100644 --- a/Items/Placeables/Walls/DraedonStructures/HazardChevronWall.cs +++ b/Items/Placeables/Walls/DraedonStructures/HazardChevronWall.cs @@ -1,7 +1,7 @@ +using Terraria.ID; using Terraria.ModLoader; -using WallTiles = CalamityMod.Walls.DraedonStructures; using TileItems = CalamityMod.Items.Placeables.DraedonStructures; -using Terraria.ID; +using WallTiles = CalamityMod.Walls.DraedonStructures; namespace CalamityMod.Items.Placeables.Walls.DraedonStructures { diff --git a/Items/Placeables/Walls/DraedonStructures/LaboratoryPanelWall.cs b/Items/Placeables/Walls/DraedonStructures/LaboratoryPanelWall.cs index 0de6bf8168..2a7771a90b 100644 --- a/Items/Placeables/Walls/DraedonStructures/LaboratoryPanelWall.cs +++ b/Items/Placeables/Walls/DraedonStructures/LaboratoryPanelWall.cs @@ -1,7 +1,7 @@ +using Terraria.ID; using Terraria.ModLoader; -using WallTiles = CalamityMod.Walls.DraedonStructures; using TileItems = CalamityMod.Items.Placeables.DraedonStructures; -using Terraria.ID; +using WallTiles = CalamityMod.Walls.DraedonStructures; namespace CalamityMod.Items.Placeables.Walls.DraedonStructures { diff --git a/Items/Placeables/Walls/DraedonStructures/LaboratoryPlateBeam.cs b/Items/Placeables/Walls/DraedonStructures/LaboratoryPlateBeam.cs index d837183bf5..bf55238513 100644 --- a/Items/Placeables/Walls/DraedonStructures/LaboratoryPlateBeam.cs +++ b/Items/Placeables/Walls/DraedonStructures/LaboratoryPlateBeam.cs @@ -1,7 +1,7 @@ +using Terraria.ID; using Terraria.ModLoader; -using WallTiles = CalamityMod.Walls.DraedonStructures; using TileItems = CalamityMod.Items.Placeables.DraedonStructures; -using Terraria.ID; +using WallTiles = CalamityMod.Walls.DraedonStructures; namespace CalamityMod.Items.Placeables.Walls.DraedonStructures { diff --git a/Items/Placeables/Walls/DraedonStructures/LaboratoryPlatePillar.cs b/Items/Placeables/Walls/DraedonStructures/LaboratoryPlatePillar.cs index 743414d719..fd1abf025c 100644 --- a/Items/Placeables/Walls/DraedonStructures/LaboratoryPlatePillar.cs +++ b/Items/Placeables/Walls/DraedonStructures/LaboratoryPlatePillar.cs @@ -1,7 +1,7 @@ +using Terraria.ID; using Terraria.ModLoader; -using WallTiles = CalamityMod.Walls.DraedonStructures; using TileItems = CalamityMod.Items.Placeables.DraedonStructures; -using Terraria.ID; +using WallTiles = CalamityMod.Walls.DraedonStructures; namespace CalamityMod.Items.Placeables.Walls.DraedonStructures { diff --git a/Items/Placeables/Walls/DraedonStructures/LaboratoryPlatingWall.cs b/Items/Placeables/Walls/DraedonStructures/LaboratoryPlatingWall.cs index a15f0ab40d..327f8dd6fc 100644 --- a/Items/Placeables/Walls/DraedonStructures/LaboratoryPlatingWall.cs +++ b/Items/Placeables/Walls/DraedonStructures/LaboratoryPlatingWall.cs @@ -1,7 +1,7 @@ +using Terraria.ID; using Terraria.ModLoader; -using WallTiles = CalamityMod.Walls.DraedonStructures; using TileItems = CalamityMod.Items.Placeables.DraedonStructures; -using Terraria.ID; +using WallTiles = CalamityMod.Walls.DraedonStructures; namespace CalamityMod.Items.Placeables.Walls.DraedonStructures { diff --git a/Items/Placeables/Walls/DraedonStructures/RustedPlateBeam.cs b/Items/Placeables/Walls/DraedonStructures/RustedPlateBeam.cs index 08960dd1ad..0e9159a2d8 100644 --- a/Items/Placeables/Walls/DraedonStructures/RustedPlateBeam.cs +++ b/Items/Placeables/Walls/DraedonStructures/RustedPlateBeam.cs @@ -1,7 +1,7 @@ +using Terraria.ID; using Terraria.ModLoader; -using WallTiles = CalamityMod.Walls.DraedonStructures; using TileItems = CalamityMod.Items.Placeables.DraedonStructures; -using Terraria.ID; +using WallTiles = CalamityMod.Walls.DraedonStructures; namespace CalamityMod.Items.Placeables.Walls.DraedonStructures { diff --git a/Items/Placeables/Walls/DraedonStructures/RustedPlatePillar.cs b/Items/Placeables/Walls/DraedonStructures/RustedPlatePillar.cs index 0789ea2ee9..76fb957605 100644 --- a/Items/Placeables/Walls/DraedonStructures/RustedPlatePillar.cs +++ b/Items/Placeables/Walls/DraedonStructures/RustedPlatePillar.cs @@ -1,7 +1,7 @@ +using Terraria.ID; using Terraria.ModLoader; -using WallTiles = CalamityMod.Walls.DraedonStructures; using TileItems = CalamityMod.Items.Placeables.DraedonStructures; -using Terraria.ID; +using WallTiles = CalamityMod.Walls.DraedonStructures; namespace CalamityMod.Items.Placeables.Walls.DraedonStructures { diff --git a/Items/Placeables/Walls/DraedonStructures/RustedPlatingWall.cs b/Items/Placeables/Walls/DraedonStructures/RustedPlatingWall.cs index e3456770ba..ed0c494ae5 100644 --- a/Items/Placeables/Walls/DraedonStructures/RustedPlatingWall.cs +++ b/Items/Placeables/Walls/DraedonStructures/RustedPlatingWall.cs @@ -1,7 +1,7 @@ +using Terraria.ID; using Terraria.ModLoader; -using WallTiles = CalamityMod.Walls.DraedonStructures; using TileItems = CalamityMod.Items.Placeables.DraedonStructures; -using Terraria.ID; +using WallTiles = CalamityMod.Walls.DraedonStructures; namespace CalamityMod.Items.Placeables.Walls.DraedonStructures { diff --git a/Items/Placeables/Walls/ElumplateWall.cs b/Items/Placeables/Walls/ElumplateWall.cs index b57e58deb0..a378abf53b 100644 --- a/Items/Placeables/Walls/ElumplateWall.cs +++ b/Items/Placeables/Walls/ElumplateWall.cs @@ -1,6 +1,6 @@ +using Terraria.ID; using Terraria.ModLoader; using WallTiles = CalamityMod.Walls; -using Terraria.ID; namespace CalamityMod.Items.Placeables.Walls { diff --git a/Items/Placeables/Walls/EutrophicSandWall.cs b/Items/Placeables/Walls/EutrophicSandWall.cs index 02e418d447..eca6ed6d28 100644 --- a/Items/Placeables/Walls/EutrophicSandWall.cs +++ b/Items/Placeables/Walls/EutrophicSandWall.cs @@ -1,6 +1,6 @@ +using Terraria.ID; using Terraria.ModLoader; using WallTiles = CalamityMod.Walls; -using Terraria.ID; namespace CalamityMod.Items.Placeables.Walls { @@ -10,6 +10,7 @@ namespace CalamityMod.Items.Placeables.Walls public override void SetStaticDefaults() { Item.ResearchUnlockCount = 400; + ItemID.Sets.DrawUnsafeIndicator[Type] = true; ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); } diff --git a/Items/Placeables/Walls/EutrophicSandWallSafe.cs b/Items/Placeables/Walls/EutrophicSandWallSafe.cs index 227b56710b..93a70fd1ba 100644 --- a/Items/Placeables/Walls/EutrophicSandWallSafe.cs +++ b/Items/Placeables/Walls/EutrophicSandWallSafe.cs @@ -1,6 +1,6 @@ +using Terraria.ID; using Terraria.ModLoader; using WallTiles = CalamityMod.Walls; -using Terraria.ID; namespace CalamityMod.Items.Placeables.Walls { diff --git a/Items/Placeables/Walls/ExoPlatingWallItem.cs b/Items/Placeables/Walls/ExoPlatingWallItem.cs index 8af968d3df..61feff30d1 100644 --- a/Items/Placeables/Walls/ExoPlatingWallItem.cs +++ b/Items/Placeables/Walls/ExoPlatingWallItem.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Placeables.FurnitureExo; +using CalamityMod.Items.Placeables.FurnitureExo; using CalamityMod.Walls; using Terraria.ID; using Terraria.ModLoader; diff --git a/Items/Placeables/Walls/ExoPrismPanelWallItem.cs b/Items/Placeables/Walls/ExoPrismPanelWallItem.cs index 745cf8c569..1b1677aee9 100644 --- a/Items/Placeables/Walls/ExoPrismPanelWallItem.cs +++ b/Items/Placeables/Walls/ExoPrismPanelWallItem.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Placeables.FurnitureExo; +using CalamityMod.Items.Placeables.FurnitureExo; using CalamityMod.Walls; using Terraria.ID; using Terraria.ModLoader; diff --git a/Items/Placeables/Walls/FloralWall.cs b/Items/Placeables/Walls/FloralWall.cs index 773c034878..7bc8af7813 100644 --- a/Items/Placeables/Walls/FloralWall.cs +++ b/Items/Placeables/Walls/FloralWall.cs @@ -1,6 +1,6 @@ +using Terraria.ID; using Terraria.ModLoader; using WallTiles = CalamityMod.Walls; -using Terraria.ID; namespace CalamityMod.Items.Placeables.Walls { public class FloralWall : ModItem, ILocalizedModType diff --git a/Items/Placeables/Walls/HardenedAstralSandWall.cs b/Items/Placeables/Walls/HardenedAstralSandWall.cs index adffbb5447..73f9e12ac8 100644 --- a/Items/Placeables/Walls/HardenedAstralSandWall.cs +++ b/Items/Placeables/Walls/HardenedAstralSandWall.cs @@ -1,4 +1,4 @@ -using Terraria.ID; +using Terraria.ID; using Terraria.ModLoader; using WallTiles = CalamityMod.Walls; namespace CalamityMod.Items.Placeables.Walls diff --git a/Items/Placeables/Walls/HardenedSulphurousSandstoneWall.cs b/Items/Placeables/Walls/HardenedSulphurousSandstoneWall.cs index f121fe47b1..3c737c6577 100644 --- a/Items/Placeables/Walls/HardenedSulphurousSandstoneWall.cs +++ b/Items/Placeables/Walls/HardenedSulphurousSandstoneWall.cs @@ -1,4 +1,4 @@ -using Terraria.ID; +using Terraria.ID; using Terraria.ModLoader; using WallTiles = CalamityMod.Walls; namespace CalamityMod.Items.Placeables.Walls diff --git a/Items/Placeables/Walls/HavocplateWall.cs b/Items/Placeables/Walls/HavocplateWall.cs index bb5e972fb7..ac15819ea7 100644 --- a/Items/Placeables/Walls/HavocplateWall.cs +++ b/Items/Placeables/Walls/HavocplateWall.cs @@ -1,6 +1,6 @@ -using Terraria.ModLoader; +using Terraria.ID; +using Terraria.ModLoader; using WallTiles = CalamityMod.Walls; -using Terraria.ID; namespace CalamityMod.Items.Placeables.Walls { diff --git a/Items/Placeables/Walls/NavyplateWall.cs b/Items/Placeables/Walls/NavyplateWall.cs index 12d42fda53..b0957f7a18 100644 --- a/Items/Placeables/Walls/NavyplateWall.cs +++ b/Items/Placeables/Walls/NavyplateWall.cs @@ -1,6 +1,6 @@ +using Terraria.ID; using Terraria.ModLoader; using WallTiles = CalamityMod.Walls; -using Terraria.ID; namespace CalamityMod.Items.Placeables.Walls { diff --git a/Items/Placeables/Walls/NavystoneWall.cs b/Items/Placeables/Walls/NavystoneWall.cs index 855ca72460..fa9fd011a1 100644 --- a/Items/Placeables/Walls/NavystoneWall.cs +++ b/Items/Placeables/Walls/NavystoneWall.cs @@ -1,6 +1,6 @@ +using Terraria.ID; using Terraria.ModLoader; using WallTiles = CalamityMod.Walls; -using Terraria.ID; namespace CalamityMod.Items.Placeables.Walls { public class NavystoneWall : ModItem, ILocalizedModType @@ -9,6 +9,7 @@ namespace CalamityMod.Items.Placeables.Walls public override void SetStaticDefaults() { Item.ResearchUnlockCount = 400; + ItemID.Sets.DrawUnsafeIndicator[Type] = true; ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); } diff --git a/Items/Placeables/Walls/NavystoneWallSafe.cs b/Items/Placeables/Walls/NavystoneWallSafe.cs index debecd90a3..b215b7f0a5 100644 --- a/Items/Placeables/Walls/NavystoneWallSafe.cs +++ b/Items/Placeables/Walls/NavystoneWallSafe.cs @@ -1,6 +1,6 @@ +using Terraria.ID; using Terraria.ModLoader; using WallTiles = CalamityMod.Walls; -using Terraria.ID; namespace CalamityMod.Items.Placeables.Walls { public class NavystoneWallSafe : ModItem, ILocalizedModType diff --git a/Items/Placeables/Walls/OnyxplateWall.cs b/Items/Placeables/Walls/OnyxplateWall.cs index 41df6298ca..9e73cc43b2 100644 --- a/Items/Placeables/Walls/OnyxplateWall.cs +++ b/Items/Placeables/Walls/OnyxplateWall.cs @@ -1,6 +1,6 @@ -using Terraria.ModLoader; +using Terraria.ID; +using Terraria.ModLoader; using WallTiles = CalamityMod.Walls; -using Terraria.ID; namespace CalamityMod.Items.Placeables.Walls { diff --git a/Items/Placeables/Walls/OtherworldlyStoneWall.cs b/Items/Placeables/Walls/OtherworldlyStoneWall.cs index 0d0ab39a3f..6515eb8168 100644 --- a/Items/Placeables/Walls/OtherworldlyStoneWall.cs +++ b/Items/Placeables/Walls/OtherworldlyStoneWall.cs @@ -1,7 +1,7 @@ using CalamityMod.Items.Placeables.FurnitureOtherworldly; +using Terraria.ID; using Terraria.ModLoader; using WallTiles = CalamityMod.Walls; -using Terraria.ID; namespace CalamityMod.Items.Placeables.Walls { [LegacyName("OccultStoneWall")] diff --git a/Items/Placeables/Walls/PerennialBrickWall.cs b/Items/Placeables/Walls/PerennialBrickWall.cs index af195f5816..60a6a4ccc9 100644 --- a/Items/Placeables/Walls/PerennialBrickWall.cs +++ b/Items/Placeables/Walls/PerennialBrickWall.cs @@ -1,6 +1,6 @@ +using Terraria.ID; using Terraria.ModLoader; using WallTiles = CalamityMod.Walls; -using Terraria.ID; namespace CalamityMod.Items.Placeables.Walls { public class PerennialBrickWall : ModItem, ILocalizedModType diff --git a/Items/Placeables/Walls/PlagueContainmentCellsWall.cs b/Items/Placeables/Walls/PlagueContainmentCellsWall.cs index 4922e91b27..fadb115b5b 100644 --- a/Items/Placeables/Walls/PlagueContainmentCellsWall.cs +++ b/Items/Placeables/Walls/PlagueContainmentCellsWall.cs @@ -1,6 +1,6 @@ +using Terraria.ID; using Terraria.ModLoader; using WallTiles = CalamityMod.Walls; -using Terraria.ID; namespace CalamityMod.Items.Placeables.Walls { diff --git a/Items/Placeables/Walls/PlaguedPlateWall.cs b/Items/Placeables/Walls/PlaguedPlateWall.cs index ac7cdadd62..c74807221d 100644 --- a/Items/Placeables/Walls/PlaguedPlateWall.cs +++ b/Items/Placeables/Walls/PlaguedPlateWall.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Placeables.FurniturePlagued; +using CalamityMod.Items.Placeables.FurniturePlagued; using Terraria.ID; using Terraria.ModLoader; using WallTiles = CalamityMod.Walls; diff --git a/Items/Placeables/Walls/ProfanedCrystalWall.cs b/Items/Placeables/Walls/ProfanedCrystalWall.cs index 3e16327cf6..48faf899a6 100644 --- a/Items/Placeables/Walls/ProfanedCrystalWall.cs +++ b/Items/Placeables/Walls/ProfanedCrystalWall.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Placeables.FurnitureProfaned; +using CalamityMod.Items.Placeables.FurnitureProfaned; using Terraria.ID; using Terraria.ModLoader; using WallTiles = CalamityMod.Walls; diff --git a/Items/Placeables/Walls/ProfanedRockWall.cs b/Items/Placeables/Walls/ProfanedRockWall.cs index e8f01d1926..b918c82db7 100644 --- a/Items/Placeables/Walls/ProfanedRockWall.cs +++ b/Items/Placeables/Walls/ProfanedRockWall.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Placeables.FurnitureProfaned; +using CalamityMod.Items.Placeables.FurnitureProfaned; using Terraria.ID; using Terraria.ModLoader; using WallTiles = CalamityMod.Walls; diff --git a/Items/Placeables/Walls/ProfanedSlabWall.cs b/Items/Placeables/Walls/ProfanedSlabWall.cs index ef37797769..16a4611a3b 100644 --- a/Items/Placeables/Walls/ProfanedSlabWall.cs +++ b/Items/Placeables/Walls/ProfanedSlabWall.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Placeables.FurnitureProfaned; +using CalamityMod.Items.Placeables.FurnitureProfaned; using Terraria.ID; using Terraria.ModLoader; using WallTiles = CalamityMod.Walls; diff --git a/Items/Placeables/Walls/RunicProfanedBrickWall.cs b/Items/Placeables/Walls/RunicProfanedBrickWall.cs index e39290ea73..01770e1243 100644 --- a/Items/Placeables/Walls/RunicProfanedBrickWall.cs +++ b/Items/Placeables/Walls/RunicProfanedBrickWall.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Placeables.FurnitureProfaned; +using CalamityMod.Items.Placeables.FurnitureProfaned; using Terraria.ID; using Terraria.ModLoader; using WallTiles = CalamityMod.Walls; diff --git a/Items/Placeables/Walls/ScorchedBoneWall.cs b/Items/Placeables/Walls/ScorchedBoneWall.cs index 59e2958de0..1406d975bd 100644 --- a/Items/Placeables/Walls/ScorchedBoneWall.cs +++ b/Items/Placeables/Walls/ScorchedBoneWall.cs @@ -1,6 +1,6 @@ -using Terraria.ModLoader; +using Terraria.ID; +using Terraria.ModLoader; using WallTiles = CalamityMod.Walls; -using Terraria.ID; namespace CalamityMod.Items.Placeables.Walls { diff --git a/Items/Placeables/Walls/ScoriaBrickWall.cs b/Items/Placeables/Walls/ScoriaBrickWall.cs index a17e3d0be2..96108f5683 100644 --- a/Items/Placeables/Walls/ScoriaBrickWall.cs +++ b/Items/Placeables/Walls/ScoriaBrickWall.cs @@ -1,6 +1,6 @@ -using Terraria.ModLoader; +using Terraria.ID; +using Terraria.ModLoader; using WallTiles = CalamityMod.Walls; -using Terraria.ID; namespace CalamityMod.Items.Placeables.Walls { diff --git a/Items/Placeables/Walls/SilvaWall.cs b/Items/Placeables/Walls/SilvaWall.cs index a8d99e3f24..564c8df5f8 100644 --- a/Items/Placeables/Walls/SilvaWall.cs +++ b/Items/Placeables/Walls/SilvaWall.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Placeables.FurnitureSilva; +using CalamityMod.Items.Placeables.FurnitureSilva; using Terraria.ID; using Terraria.ModLoader; using WallTiles = CalamityMod.Walls; diff --git a/Items/Placeables/Walls/SmoothAbyssGravelWall.cs b/Items/Placeables/Walls/SmoothAbyssGravelWall.cs index 467aebcdaa..e2fe9021f1 100644 --- a/Items/Placeables/Walls/SmoothAbyssGravelWall.cs +++ b/Items/Placeables/Walls/SmoothAbyssGravelWall.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Placeables.FurnitureAbyss; +using CalamityMod.Items.Placeables.FurnitureAbyss; using Terraria.ID; using Terraria.ModLoader; using WallTiles = CalamityMod.Walls; diff --git a/Items/Placeables/Walls/SmoothBrimstoneSlagWall.cs b/Items/Placeables/Walls/SmoothBrimstoneSlagWall.cs index 63ff6057bc..e9f5255376 100644 --- a/Items/Placeables/Walls/SmoothBrimstoneSlagWall.cs +++ b/Items/Placeables/Walls/SmoothBrimstoneSlagWall.cs @@ -1,6 +1,6 @@ -using CalamityMod.Items.Placeables.FurnitureAshen; -using Terraria.ModLoader; +using CalamityMod.Items.Placeables.FurnitureAshen; using Terraria.ID; +using Terraria.ModLoader; using WallTiles = CalamityMod.Walls; namespace CalamityMod.Items.Placeables.Walls { diff --git a/Items/Placeables/Walls/SmoothNavystoneWall.cs b/Items/Placeables/Walls/SmoothNavystoneWall.cs index 9846cfaae9..48313056c3 100644 --- a/Items/Placeables/Walls/SmoothNavystoneWall.cs +++ b/Items/Placeables/Walls/SmoothNavystoneWall.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Placeables.FurnitureEutrophic; +using CalamityMod.Items.Placeables.FurnitureEutrophic; using Terraria.ID; using Terraria.ModLoader; using WallTiles = CalamityMod.Walls; diff --git a/Items/Placeables/Walls/SmoothVoidstoneWall.cs b/Items/Placeables/Walls/SmoothVoidstoneWall.cs index a5e79b6f47..2595547146 100644 --- a/Items/Placeables/Walls/SmoothVoidstoneWall.cs +++ b/Items/Placeables/Walls/SmoothVoidstoneWall.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Placeables.FurnitureVoid; +using CalamityMod.Items.Placeables.FurnitureVoid; using Terraria.ID; using Terraria.ModLoader; using WallTiles = CalamityMod.Walls; diff --git a/Items/Placeables/Walls/StatigelWall.cs b/Items/Placeables/Walls/StatigelWall.cs index e4ad3af5ba..845cdcea41 100644 --- a/Items/Placeables/Walls/StatigelWall.cs +++ b/Items/Placeables/Walls/StatigelWall.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Placeables.FurnitureStatigel; +using CalamityMod.Items.Placeables.FurnitureStatigel; using Terraria.ID; using Terraria.ModLoader; using WallTiles = CalamityMod.Walls; diff --git a/Items/Placeables/Walls/StratusWall.cs b/Items/Placeables/Walls/StratusWall.cs index 803e5457db..55379b9b27 100644 --- a/Items/Placeables/Walls/StratusWall.cs +++ b/Items/Placeables/Walls/StratusWall.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Placeables.FurnitureStratus; +using CalamityMod.Items.Placeables.FurnitureStratus; using Terraria.ID; using Terraria.ModLoader; using WallTiles = CalamityMod.Walls; diff --git a/Items/Placeables/Walls/SulphurousSandWall.cs b/Items/Placeables/Walls/SulphurousSandWall.cs index 81f23b8a28..291ca0af8b 100644 --- a/Items/Placeables/Walls/SulphurousSandWall.cs +++ b/Items/Placeables/Walls/SulphurousSandWall.cs @@ -1,4 +1,4 @@ -using Terraria.ID; +using Terraria.ID; using Terraria.ModLoader; using WallTiles = CalamityMod.Walls; namespace CalamityMod.Items.Placeables.Walls diff --git a/Items/Placeables/Walls/SulphurousSandstoneWall.cs b/Items/Placeables/Walls/SulphurousSandstoneWall.cs index 38de15a367..fe332c889d 100644 --- a/Items/Placeables/Walls/SulphurousSandstoneWall.cs +++ b/Items/Placeables/Walls/SulphurousSandstoneWall.cs @@ -1,4 +1,4 @@ -using Terraria.ID; +using Terraria.ID; using Terraria.ModLoader; using WallTiles = CalamityMod.Walls; namespace CalamityMod.Items.Placeables.Walls diff --git a/Items/Placeables/Walls/UelibloomBrickWall.cs b/Items/Placeables/Walls/UelibloomBrickWall.cs index 2625e56ad9..e7248b1da9 100644 --- a/Items/Placeables/Walls/UelibloomBrickWall.cs +++ b/Items/Placeables/Walls/UelibloomBrickWall.cs @@ -1,4 +1,4 @@ -using Terraria.ID; +using Terraria.ID; using Terraria.ModLoader; using WallTiles = CalamityMod.Walls; namespace CalamityMod.Items.Placeables.Walls diff --git a/Items/Placeables/Walls/VoidstoneSlabWall.cs b/Items/Placeables/Walls/VoidstoneSlabWall.cs index 5a38fd7026..fdf6408814 100644 --- a/Items/Placeables/Walls/VoidstoneSlabWall.cs +++ b/Items/Placeables/Walls/VoidstoneSlabWall.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Placeables.FurnitureVoid; +using CalamityMod.Items.Placeables.FurnitureVoid; using Terraria.ID; using Terraria.ModLoader; using WallTiles = CalamityMod.Walls; diff --git a/Items/Placeables/Walls/VoidstoneWall.cs b/Items/Placeables/Walls/VoidstoneWall.cs index c3013a65f3..71d30faa61 100644 --- a/Items/Placeables/Walls/VoidstoneWall.cs +++ b/Items/Placeables/Walls/VoidstoneWall.cs @@ -1,4 +1,4 @@ -using Terraria.ID; +using Terraria.ID; using Terraria.ModLoader; using WallTiles = CalamityMod.Walls; namespace CalamityMod.Items.Placeables.Walls diff --git a/Items/Placeables/Walls/WulfrumPlatingWall.cs b/Items/Placeables/Walls/WulfrumPlatingWall.cs new file mode 100644 index 0000000000..5345aca21f --- /dev/null +++ b/Items/Placeables/Walls/WulfrumPlatingWall.cs @@ -0,0 +1,38 @@ +using CalamityMod.Items.Placeables.FurnitureWulfrum; +using Terraria.ID; +using Terraria.ModLoader; +using WallTiles = CalamityMod.Walls; + +namespace CalamityMod.Items.Placeables.Walls +{ + public class WulfrumPlatingWall : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 400; + } + + public override void SetDefaults() + { + Item.width = 32; + Item.height = 32; + 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/WulfrumPlatingWall.png b/Items/Placeables/Walls/WulfrumPlatingWall.png new file mode 100644 index 0000000000..22d0216af5 Binary files /dev/null and b/Items/Placeables/Walls/WulfrumPlatingWall.png differ diff --git a/Items/Potions/Alcohol/FabsolsVodka.cs b/Items/Potions/Alcohol/FabsolsVodka.cs index 4f29ab4f10..4ca2edb060 100644 --- a/Items/Potions/Alcohol/FabsolsVodka.cs +++ b/Items/Potions/Alcohol/FabsolsVodka.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories.Vanity; using CalamityMod.Items.Materials; using Terraria; using Terraria.ID; @@ -9,9 +10,11 @@ namespace CalamityMod.Items.Potions.Alcohol public class FabsolsVodka : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Potions"; + public override void SetStaticDefaults() { Item.ResearchUnlockCount = 5; + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); } public override void SetDefaults() diff --git a/Items/Potions/Alcohol/OddMushroom.cs b/Items/Potions/Alcohol/OddMushroom.cs index 6bb6eab159..6ef47a0421 100644 --- a/Items/Potions/Alcohol/OddMushroom.cs +++ b/Items/Potions/Alcohol/OddMushroom.cs @@ -29,5 +29,11 @@ namespace CalamityMod.Items.Potions.Alcohol Item.buffTime = CalamityUtils.SecondsToFrames(3600f); Item.value = Item.buyPrice(0, 50, 0, 0); } + + public override void OnConsumeItem(Player player) + { + if (player.Calamity().trippyLevel < 3) + player.Calamity().trippyLevel++; + } } } diff --git a/Items/Potions/Alcohol/Tequila.cs b/Items/Potions/Alcohol/Tequila.cs index ee22c707ff..ac1c240cc0 100644 --- a/Items/Potions/Alcohol/Tequila.cs +++ b/Items/Potions/Alcohol/Tequila.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Items.Potions.Alcohol { public new string LocalizationCategory => "Items.Potions"; internal static readonly int CritBoost = 4; - + public override void SetStaticDefaults() { Item.ResearchUnlockCount = 5; diff --git a/Items/Potions/Alcohol/Vodka.cs b/Items/Potions/Alcohol/Vodka.cs index f9170eaf2d..ce5fda48ed 100644 --- a/Items/Potions/Alcohol/Vodka.cs +++ b/Items/Potions/Alcohol/Vodka.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Items.Potions.Alcohol { public new string LocalizationCategory => "Items.Potions"; internal static readonly int CritBoost = 2; - + public override void SetStaticDefaults() { Item.ResearchUnlockCount = 5; diff --git a/Items/Potions/Alcohol/Whiskey.cs b/Items/Potions/Alcohol/Whiskey.cs index 418d3790ad..3a69589efd 100644 --- a/Items/Potions/Alcohol/Whiskey.cs +++ b/Items/Potions/Alcohol/Whiskey.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Items.Potions.Alcohol { public new string LocalizationCategory => "Items.Potions"; internal static readonly int CritBoost = 2; - + public override void SetStaticDefaults() { Item.ResearchUnlockCount = 5; diff --git a/Items/Potions/AstralInjection.cs b/Items/Potions/AstralInjection.cs index fd3aed69f5..682a341ce2 100644 --- a/Items/Potions/AstralInjection.cs +++ b/Items/Potions/AstralInjection.cs @@ -50,7 +50,7 @@ namespace CalamityMod.Items.Potions { CreateRecipe(15). AddIngredient(ItemID.BottledWater, 15). - AddIngredient(4). + AddIngredient(4). AddIngredient(). AddTile(TileID.AlchemyTable). AddConsumeItemCallback(Recipe.ConsumptionRules.Alchemy). diff --git a/Items/Potions/Baguette.cs b/Items/Potions/Baguette.cs index a3cb822ebb..406e1e1d26 100644 --- a/Items/Potions/Baguette.cs +++ b/Items/Potions/Baguette.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Items.Potions public new string LocalizationCategory => "Items.Potions"; public override void SetStaticDefaults() { - Item.ResearchUnlockCount = 5; + Item.ResearchUnlockCount = 5; } public override void SetDefaults() @@ -33,10 +33,10 @@ namespace CalamityMod.Items.Potions Item.buffTime = CalamityUtils.SecondsToFrames(300f); } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.Food; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.Food; + } public override void OnConsumeItem(Player player) { diff --git a/Items/Potions/CeaselessHungerPotion.cs b/Items/Potions/CeaselessHungerPotion.cs index 2df3ded02e..82b60bf13e 100644 --- a/Items/Potions/CeaselessHungerPotion.cs +++ b/Items/Potions/CeaselessHungerPotion.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Items.Potions AddIngredient(). AddIngredient(). AddTile(TileID.AlchemyTable). - AddConsumeItemCallback(Recipe.ConsumptionRules.Alchemy). + AddConsumeItemCallback(Recipe.ConsumptionRules.Alchemy). Register(); CreateRecipe(4). diff --git a/Items/Potions/FlaskOfCrumbling.png b/Items/Potions/FlaskOfCrumbling.png index fa9e4979a0..30eaf70e4b 100644 Binary files a/Items/Potions/FlaskOfCrumbling.png and b/Items/Potions/FlaskOfCrumbling.png differ diff --git a/Items/Potions/GravityNormalizerPotion.cs b/Items/Potions/GravityNormalizerPotion.cs index dfb1861fa0..1c45d08e64 100644 --- a/Items/Potions/GravityNormalizerPotion.cs +++ b/Items/Potions/GravityNormalizerPotion.cs @@ -1,6 +1,6 @@ using CalamityMod.Buffs.Potions; -using CalamityMod.Items.Materials; using CalamityMod.Items.Fishing.AstralCatches; +using CalamityMod.Items.Materials; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -39,7 +39,7 @@ namespace CalamityMod.Items.Potions AddIngredient(). AddIngredient(). AddTile(TileID.AlchemyTable). - AddConsumeItemCallback(Recipe.ConsumptionRules.Alchemy). + AddConsumeItemCallback(Recipe.ConsumptionRules.Alchemy). Register(); CreateRecipe(). diff --git a/Items/Potions/HadalStew.cs b/Items/Potions/HadalStew.cs index a4fbe61626..a901b1bcab 100644 --- a/Items/Potions/HadalStew.cs +++ b/Items/Potions/HadalStew.cs @@ -1,11 +1,11 @@ -using CalamityMod.Items.Placeables; +using System.Collections.Generic; +using System.Linq; using CalamityMod.Items.Fishing.BrimstoneCragCatches; -using System.Collections.Generic; +using CalamityMod.Items.Placeables; using Terraria; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; -using System.Linq; namespace CalamityMod.Items.Potions { diff --git a/Items/Potions/PhotosynthesisPotion.cs b/Items/Potions/PhotosynthesisPotion.cs index dbd2b5d766..4b52ece07f 100644 --- a/Items/Potions/PhotosynthesisPotion.cs +++ b/Items/Potions/PhotosynthesisPotion.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Potions public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; - } + } public override void SetDefaults() { @@ -38,7 +38,7 @@ namespace CalamityMod.Items.Potions AddIngredient(). AddIngredient(). AddTile(TileID.AlchemyTable). - AddConsumeItemCallback(Recipe.ConsumptionRules.Alchemy). + AddConsumeItemCallback(Recipe.ConsumptionRules.Alchemy). AddDecraftCondition(Condition.Hardmode). Register(); diff --git a/Items/Potions/ShadowPotion.png b/Items/Potions/ShadowPotion.png index e1bae342cf..cdab3aacd8 100644 Binary files a/Items/Potions/ShadowPotion.png and b/Items/Potions/ShadowPotion.png differ diff --git a/Items/Potions/SoaringPotion.cs b/Items/Potions/SoaringPotion.cs index f81d0932f3..59ca3fb070 100644 --- a/Items/Potions/SoaringPotion.cs +++ b/Items/Potions/SoaringPotion.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Potions public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; - } + } public override void SetDefaults() { @@ -40,7 +40,7 @@ namespace CalamityMod.Items.Potions AddIngredient(). AddIngredient(ItemID.SoulofFlight). AddTile(TileID.AlchemyTable). - AddConsumeItemCallback(Recipe.ConsumptionRules.Alchemy). + AddConsumeItemCallback(Recipe.ConsumptionRules.Alchemy). Register(); CreateRecipe(). diff --git a/Items/Potions/SulphurskinPotion.png b/Items/Potions/SulphurskinPotion.png index 4e3572581f..40a82d1ef6 100644 Binary files a/Items/Potions/SulphurskinPotion.png and b/Items/Potions/SulphurskinPotion.png differ diff --git a/Items/Potions/SupremeManaPotion.cs b/Items/Potions/SupremeManaPotion.cs index 581ee3f289..859ab69b80 100644 --- a/Items/Potions/SupremeManaPotion.cs +++ b/Items/Potions/SupremeManaPotion.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Potions { CreateRecipe(15). AddIngredient(ItemID.SuperManaPotion, 15). - AddIngredient(). + AddIngredient(). AddTile(TileID.Bottles). Register() .DisableDecraft(); diff --git a/Items/Potions/TeslaPotion.cs b/Items/Potions/TeslaPotion.cs index d1257d690e..c2d8e0142b 100644 --- a/Items/Potions/TeslaPotion.cs +++ b/Items/Potions/TeslaPotion.cs @@ -13,16 +13,16 @@ namespace CalamityMod.Items.Potions { public new string LocalizationCategory => "Items.Potions"; public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 20; - Main.RegisterItemAnimation(Type, new DrawAnimationVertical(6, 8)); + { + Item.ResearchUnlockCount = 20; + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(5, 14)); ItemID.Sets.AnimatesAsSoul[Type] = true; - } + } public override void SetDefaults() { - Item.width = 34; - Item.height = 34; + Item.width = 32; + Item.height = 32; Item.useTurn = true; Item.maxStack = 9999; Item.rare = ItemRarityID.Orange; @@ -38,6 +38,7 @@ namespace CalamityMod.Items.Potions public override void AddRecipes() { + Condition evil2Dead = new(CalamityUtils.GetText("Condition.DownedEvil2Boss"), () => DownedBossSystem.downedHiveMind || DownedBossSystem.downedPerforator); CreateRecipe(5). AddIngredient(ItemID.BottledWater). AddIngredient(2). @@ -45,6 +46,7 @@ namespace CalamityMod.Items.Potions AddIngredient(). AddIngredient(). AddTile(TileID.Bottles). + AddDecraftCondition(evil2Dead). Register(); CreateRecipe(). diff --git a/Items/Potions/TeslaPotion.png b/Items/Potions/TeslaPotion.png index b5fded3d89..1903d9e02c 100644 Binary files a/Items/Potions/TeslaPotion.png and b/Items/Potions/TeslaPotion.png differ diff --git a/Items/Potions/ZenPotion.cs b/Items/Potions/ZenPotion.cs index 71b78fc57a..c76f6c4d10 100644 --- a/Items/Potions/ZenPotion.cs +++ b/Items/Potions/ZenPotion.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Items.Potions AddIngredient(2). AddIngredient(ItemID.Daybloom, 3). AddTile(TileID.AlchemyTable). - AddConsumeItemCallback(Recipe.ConsumptionRules.Alchemy). + AddConsumeItemCallback(Recipe.ConsumptionRules.Alchemy). Register(); CreateRecipe(). diff --git a/Items/Potions/ZenPotion.png b/Items/Potions/ZenPotion.png index 41e4e11d8f..f5b451ffb2 100644 Binary files a/Items/Potions/ZenPotion.png and b/Items/Potions/ZenPotion.png differ diff --git a/Items/Potions/ZergPotion.cs b/Items/Potions/ZergPotion.cs index 2a335d22bc..144bbc6ce2 100644 --- a/Items/Potions/ZergPotion.cs +++ b/Items/Potions/ZergPotion.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Items.Potions AddIngredient(2). AddIngredient(). AddTile(TileID.AlchemyTable). - AddConsumeItemCallback(Recipe.ConsumptionRules.Alchemy). + AddConsumeItemCallback(Recipe.ConsumptionRules.Alchemy). Register(); CreateRecipe(). diff --git a/Items/RelicOfConvergence.cs b/Items/RelicOfConvergence.cs index 7308778fc9..4ed4266d9f 100644 --- a/Items/RelicOfConvergence.cs +++ b/Items/RelicOfConvergence.cs @@ -23,15 +23,15 @@ namespace CalamityMod.Items Item.noMelee = true; Item.noUseGraphic = true; Item.channel = true; - Item.value = CalamityGlobalItem.Rarity11BuyPrice; + Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; Item.rare = ItemRarityID.Purple; Item.shoot = ModContent.ProjectileType(); } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.ToolsOther; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.ToolsOther; + } public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0 && player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0; } diff --git a/Items/Rock.cs b/Items/Rock.cs index 9cb25efc5a..b74679d9e6 100644 --- a/Items/Rock.cs +++ b/Items/Rock.cs @@ -1,4 +1,5 @@ -using CalamityMod.Tiles; +using CalamityMod.Items.Placeables.Furniture.Monoliths; +using CalamityMod.Tiles; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -11,6 +12,7 @@ namespace CalamityMod.Items public override void SetStaticDefaults() { Item.ResearchUnlockCount = 0; + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); } public override void SetDefaults() diff --git a/Items/SirenproofEarMuffs.cs b/Items/SirenproofEarMuffs.cs index f98aef4a4e..b05a825f31 100644 --- a/Items/SirenproofEarMuffs.cs +++ b/Items/SirenproofEarMuffs.cs @@ -1,30 +1,95 @@ -using Terraria.ID; -using Terraria; -using Terraria.ModLoader; +using System.Collections.Generic; using CalamityMod.Items.Materials; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using static CalamityMod.CalamityUtils; namespace CalamityMod.Items { public class SirenproofEarMuffs : ModItem, ILocalizedModType { + public static bool state = false; public new string LocalizationCategory => "Items.Misc"; public override void SetDefaults() { Item.width = 44; Item.height = 34; - Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.rare = ItemRarityID.Blue; } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.SpawnPrevention; - } - - public override void UpdateInventory(Player player) + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) { - if (Item.favorited) + itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.SpawnPrevention; + } + + public override bool CanRightClick() => true; + + public override void RightClick(Player player) + { + if (player.Calamity().disableAnahitaSpawns == true) + player.Calamity().disableAnahitaSpawns = false; + else player.Calamity().disableAnahitaSpawns = true; + Item.NetStateChanged(); + state = player.Calamity().disableAnahitaSpawns; + + bool favorited = Item.favorited; + Item.SetDefaults(ModContent.ItemType()); + Item.stack++; + Item.favorited = favorited; + } + + /* + public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frameI, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + Texture2D texture; + + if (state) + { + //Replace with enabled texture + texture = ModContent.Request("CalamityMod/Items/SirenproofEarMuffs").Value; + spriteBatch.Draw(texture, position, null, Color.White, 0f, origin, scale, SpriteEffects.None, 0); + } + else + { + texture = ModContent.Request("CalamityMod/Items/SirenproofEarMuffs").Value; + spriteBatch.Draw(texture, position, null, Color.White, 0f, origin, scale, SpriteEffects.None, 0); + } + + return false; + } + + public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) + { + Texture2D texture; + + if (state) + { + //Replace with enabled texture + texture = ModContent.Request("CalamityMod/Items/SirenproofEarMuffs").Value; + spriteBatch.Draw(texture, Item.position - Main.screenPosition, null, lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); + } + else + { + texture = ModContent.Request("CalamityMod/Items/SirenproofEarMuffs").Value; + spriteBatch.Draw(texture, Item.position - Main.screenPosition, null, lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); + } + return false; + } + */ + + public override void ModifyTooltips(List tooltips) + { + string text; + if (state == true) + text = GetTextValue("Items.Misc.SpawnBlockersOn"); + else + text = GetTextValue("Items.Misc.SpawnBlockersOff"); + tooltips.FindAndReplace("[STATE]", text); } public override void AddRecipes() diff --git a/Items/SulphurousSeaWorldSideChanger.cs b/Items/SulphurousSeaWorldSideChanger.cs index ee39e8e060..5dd4542242 100644 --- a/Items/SulphurousSeaWorldSideChanger.cs +++ b/Items/SulphurousSeaWorldSideChanger.cs @@ -1,10 +1,10 @@ -using CalamityMod.Events; +using System; +using CalamityMod.Events; using CalamityMod.Rarities; using CalamityMod.World; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; -using Microsoft.Xna.Framework; -using System; using Terraria.ModLoader; namespace CalamityMod.Items @@ -26,7 +26,7 @@ namespace CalamityMod.Items Item.rare = ModContent.RarityType(); Item.value = 0; Item.autoReuse = false; - Item.useStyle = 4; + Item.useStyle = ItemUseStyleID.HoldUp; Item.UseSound = SoundID.Item111; } diff --git a/Items/SummonItems/Abombination.cs b/Items/SummonItems/Abombination.cs index 265b4e0081..8c3ec4b38b 100644 --- a/Items/SummonItems/Abombination.cs +++ b/Items/SummonItems/Abombination.cs @@ -2,9 +2,9 @@ using CalamityMod.Items.Materials; using CalamityMod.NPCs.PlaguebringerGoliath; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Items.SummonItems { @@ -15,7 +15,7 @@ namespace CalamityMod.Items.SummonItems public static readonly SoundStyle UseSound = new("CalamityMod/Sounds/Item/PBGSummon"); public override void SetStaticDefaults() { - ItemID.Sets.SortingPriorityBossSpawns[Type] = 17; // Solar Tablet (1 above Lihzahrd Power Cell) + ItemID.Sets.SortingPriorityBossSpawns[Type] = 17; // Solar Tablet (1 above Lihzahrd Power Cell) } public override void SetDefaults() @@ -29,10 +29,10 @@ namespace CalamityMod.Items.SummonItems Item.consumable = false; } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossItem; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossItem; + } public override bool CanUseItem(Player player) { diff --git a/Items/SummonItems/AstralChunk.cs b/Items/SummonItems/AstralChunk.cs index 42625f3778..c5094efa77 100644 --- a/Items/SummonItems/AstralChunk.cs +++ b/Items/SummonItems/AstralChunk.cs @@ -2,10 +2,10 @@ using CalamityMod.Items.Materials; using CalamityMod.NPCs.AstrumAureus; using Terraria; -using Terraria.ID; -using Terraria.ModLoader; using Terraria.Audio; using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.SummonItems { @@ -56,7 +56,7 @@ namespace CalamityMod.Items.SummonItems public override void AddRecipes() { CreateRecipe(). - AddIngredient(30). + AddIngredient(30). AddIngredient(ItemID.FallenStar, 20). AddTile(TileID.Anvils). Register(); diff --git a/Items/SummonItems/BloodwormItem.cs b/Items/SummonItems/BloodwormItem.cs index 4c64ab87fe..854fb89d77 100644 --- a/Items/SummonItems/BloodwormItem.cs +++ b/Items/SummonItems/BloodwormItem.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Items.SummonItems public new string LocalizationCategory => "Items.SummonItems"; public override void SetStaticDefaults() { - ItemID.Sets.SortingPriorityBossSpawns[Type] = 19; // Celestial Sigil + ItemID.Sets.SortingPriorityBossSpawns[Type] = 19; // Celestial Sigil } public override void SetDefaults() @@ -31,9 +31,9 @@ namespace CalamityMod.Items.SummonItems Item.ResearchUnlockCount = 3; } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossItem; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossItem; + } } } diff --git a/Items/SummonItems/BloodyWormFood.cs b/Items/SummonItems/BloodyWormFood.cs index afde718345..c5847c9316 100644 --- a/Items/SummonItems/BloodyWormFood.cs +++ b/Items/SummonItems/BloodyWormFood.cs @@ -2,9 +2,9 @@ using CalamityMod.Items.Materials; using CalamityMod.NPCs.Perforator; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Items.SummonItems { @@ -13,7 +13,7 @@ namespace CalamityMod.Items.SummonItems public new string LocalizationCategory => "Items.SummonItems"; public override void SetStaticDefaults() { - ItemID.Sets.SortingPriorityBossSpawns[Type] = 5; // Abeemination / Deer Thing + ItemID.Sets.SortingPriorityBossSpawns[Type] = 5; // Abeemination / Deer Thing } public override void SetDefaults() @@ -27,10 +27,10 @@ namespace CalamityMod.Items.SummonItems Item.consumable = false; } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossItem; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossItem; + } public override bool CanUseItem(Player player) { diff --git a/Items/SummonItems/CeremonialUrn.cs b/Items/SummonItems/CeremonialUrn.cs index 1c01b97018..b3dcdb5e58 100644 --- a/Items/SummonItems/CeremonialUrn.cs +++ b/Items/SummonItems/CeremonialUrn.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.SummonItems public new string LocalizationCategory => "Items.SummonItems"; public override void SetStaticDefaults() { - ItemID.Sets.SortingPriorityBossSpawns[Type] = 19; // Celestial Sigil + ItemID.Sets.SortingPriorityBossSpawns[Type] = 19; // Celestial Sigil } public override void SetDefaults() @@ -22,10 +22,10 @@ namespace CalamityMod.Items.SummonItems Item.rare = ModContent.RarityType(); } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossItem; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossItem; + } public override void AddRecipes() { diff --git a/Items/SummonItems/CharredIdol.cs b/Items/SummonItems/CharredIdol.cs index 847fdaa26d..69c33b9bfc 100644 --- a/Items/SummonItems/CharredIdol.cs +++ b/Items/SummonItems/CharredIdol.cs @@ -1,11 +1,11 @@ -using CalamityMod.Events; -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; +using CalamityMod.Events; using CalamityMod.Items.Materials; using CalamityMod.NPCs.BrimstoneElemental; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Items.SummonItems { @@ -14,7 +14,7 @@ namespace CalamityMod.Items.SummonItems public new string LocalizationCategory => "Items.SummonItems"; public override void SetStaticDefaults() { - ItemID.Sets.SortingPriorityBossSpawns[Type] = 9; // Mechanical Skull + ItemID.Sets.SortingPriorityBossSpawns[Type] = 9; // Mechanical Skull } public override void SetDefaults() @@ -28,10 +28,10 @@ namespace CalamityMod.Items.SummonItems Item.consumable = false; } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossItem; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossItem; + } public override bool CanUseItem(Player player) { diff --git a/Items/SummonItems/CosmicWorm.cs b/Items/SummonItems/CosmicWorm.cs index 48ae29c4c3..e5e38178b3 100644 --- a/Items/SummonItems/CosmicWorm.cs +++ b/Items/SummonItems/CosmicWorm.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.SummonItems public new string LocalizationCategory => "Items.SummonItems"; public override void SetStaticDefaults() { - ItemID.Sets.SortingPriorityBossSpawns[Type] = 19; // Celestial Sigil + ItemID.Sets.SortingPriorityBossSpawns[Type] = 19; // Celestial Sigil } public override void SetDefaults() @@ -29,10 +29,10 @@ namespace CalamityMod.Items.SummonItems Item.rare = ModContent.RarityType(); } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossItem; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossItem; + } public override bool CanUseItem(Player player) { @@ -68,7 +68,7 @@ namespace CalamityMod.Items.SummonItems CreateRecipe(). AddIngredient(ItemID.LunarBar, 40). AddIngredient(10). - AddIngredient(40). + AddIngredient(40). AddTile(TileID.LunarCraftingStation). Register() .DisableDecraft(); diff --git a/Items/SummonItems/CryoKey.cs b/Items/SummonItems/CryoKey.cs index 89a3e5a15c..6fee06e1f8 100644 --- a/Items/SummonItems/CryoKey.cs +++ b/Items/SummonItems/CryoKey.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.SummonItems public new string LocalizationCategory => "Items.SummonItems"; public override void SetStaticDefaults() { - ItemID.Sets.SortingPriorityBossSpawns[Type] = 7; // Mechanical Eye + ItemID.Sets.SortingPriorityBossSpawns[Type] = 7; // Mechanical Eye } public override void SetDefaults() @@ -31,10 +31,10 @@ namespace CalamityMod.Items.SummonItems Item.useStyle = ItemUseStyleID.HoldUp; } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossItem; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossItem; + } public override bool CanUseItem(Player player) { diff --git a/Items/SummonItems/DeathWhistle.cs b/Items/SummonItems/DeathWhistle.cs index 4c201436de..409ffefc3a 100644 --- a/Items/SummonItems/DeathWhistle.cs +++ b/Items/SummonItems/DeathWhistle.cs @@ -1,10 +1,10 @@ using CalamityMod.Events; using CalamityMod.NPCs.Ravager; using Terraria; -using Terraria.ID; -using Terraria.ModLoader; using Terraria.Audio; using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.SummonItems { @@ -14,7 +14,7 @@ namespace CalamityMod.Items.SummonItems public new string LocalizationCategory => "Items.SummonItems"; public override void SetStaticDefaults() { - ItemID.Sets.SortingPriorityBossSpawns[Type] = 17; // Solar Tablet (1 above Lihzahrd Power Cell) + ItemID.Sets.SortingPriorityBossSpawns[Type] = 17; // Solar Tablet (1 above Lihzahrd Power Cell) } public override void SetDefaults() @@ -28,10 +28,10 @@ namespace CalamityMod.Items.SummonItems Item.consumable = false; } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossItem; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossItem; + } public override bool CanUseItem(Player player) { diff --git a/Items/SummonItems/DecapoditaSprout.cs b/Items/SummonItems/DecapoditaSprout.cs index 7b561fd668..336ce1a51b 100644 --- a/Items/SummonItems/DecapoditaSprout.cs +++ b/Items/SummonItems/DecapoditaSprout.cs @@ -1,10 +1,10 @@ using CalamityMod.Events; using CalamityMod.NPCs.Crabulon; using Terraria; -using Terraria.ID; -using Terraria.ModLoader; using Terraria.Audio; using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.SummonItems { @@ -13,7 +13,7 @@ namespace CalamityMod.Items.SummonItems public new string LocalizationCategory => "Items.SummonItems"; public override void SetStaticDefaults() { - ItemID.Sets.SortingPriorityBossSpawns[Type] = 3; // Worm Food / Bloody Spine + ItemID.Sets.SortingPriorityBossSpawns[Type] = 3; // Worm Food / Bloody Spine } public override void SetDefaults() @@ -27,10 +27,10 @@ namespace CalamityMod.Items.SummonItems Item.consumable = false; } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossItem; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossItem; + } public override bool CanUseItem(Player player) { @@ -42,7 +42,7 @@ namespace CalamityMod.Items.SummonItems SoundEngine.PlaySound(SoundID.Roar, player.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { - int npc = NPC.NewNPC(new EntitySource_BossSpawn(player), (int)(player.position.X + Main.rand.Next(-250, 251)), (int)(player.position.Y - 500f), ModContent.NPCType(), 1); + int npc = NPC.NewNPC(new EntitySource_BossSpawn(player), (int)(player.position.X + Main.rand.Next(-160, 161)), (int)(player.position.Y - 320f), ModContent.NPCType(), 1); Main.npc[npc].timeLeft *= 20; CalamityUtils.BossAwakenMessage(npc); } diff --git a/Items/SummonItems/DesertMedallion.cs b/Items/SummonItems/DesertMedallion.cs index 9ffb9ca8a0..14d89b62de 100644 --- a/Items/SummonItems/DesertMedallion.cs +++ b/Items/SummonItems/DesertMedallion.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.SummonItems public new string LocalizationCategory => "Items.SummonItems"; public override void SetStaticDefaults() { - ItemID.Sets.SortingPriorityBossSpawns[Type] = 1; // Suspicious Looking Eye + ItemID.Sets.SortingPriorityBossSpawns[Type] = 1; // Suspicious Looking Eye } public override void SetDefaults() @@ -29,10 +29,10 @@ namespace CalamityMod.Items.SummonItems Item.consumable = false; } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossItem; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossItem; + } public override bool CanUseItem(Player player) { @@ -47,19 +47,6 @@ namespace CalamityMod.Items.SummonItems else NetMessage.SendData(MessageID.SpawnBossUseLicenseStartEvent, -1, -1, null, player.whoAmI, ModContent.NPCType()); - if (CalamityWorld.revenge) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); - else - NetMessage.SendData(MessageID.SpawnBossUseLicenseStartEvent, -1, -1, null, player.whoAmI, ModContent.NPCType()); - - if (Main.netMode != NetmodeID.MultiplayerClient) - NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); - else - NetMessage.SendData(MessageID.SpawnBossUseLicenseStartEvent, -1, -1, null, player.whoAmI, ModContent.NPCType()); - } - return true; } diff --git a/Items/SummonItems/EidolonTablet.cs b/Items/SummonItems/EidolonTablet.cs index 4d7ddb5646..bb9fe3513f 100644 --- a/Items/SummonItems/EidolonTablet.cs +++ b/Items/SummonItems/EidolonTablet.cs @@ -1,5 +1,5 @@ -using CalamityMod.Events; -using System; +using System; +using CalamityMod.Events; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -12,8 +12,8 @@ namespace CalamityMod.Items.SummonItems public new string LocalizationCategory => "Items.SummonItems"; public override void SetStaticDefaults() { - NPCID.Sets.MPAllowedEnemies[NPCID.CultistBoss] = true; - ItemID.Sets.SortingPriorityBossSpawns[Type] = 18; // Bloody Tear (1 below Celestial Sigil fsr) + NPCID.Sets.MPAllowedEnemies[NPCID.CultistBoss] = true; + ItemID.Sets.SortingPriorityBossSpawns[Type] = 18; // Bloody Tear (1 below Celestial Sigil fsr) } public override void SetDefaults() @@ -27,10 +27,10 @@ namespace CalamityMod.Items.SummonItems Item.consumable = false; } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossItem; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossItem; + } public override bool CanUseItem(Player player) { diff --git a/Items/SummonItems/ExoticPheromones.cs b/Items/SummonItems/ExoticPheromones.cs index 34661913b1..6e648cad2f 100644 --- a/Items/SummonItems/ExoticPheromones.cs +++ b/Items/SummonItems/ExoticPheromones.cs @@ -2,9 +2,9 @@ using CalamityMod.Items.Materials; using CalamityMod.NPCs.Bumblebirb; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Items.SummonItems { diff --git a/Items/SummonItems/EyeofDesolation.cs b/Items/SummonItems/EyeofDesolation.cs index dab9ba5b48..7e66341a3c 100644 --- a/Items/SummonItems/EyeofDesolation.cs +++ b/Items/SummonItems/EyeofDesolation.cs @@ -47,7 +47,7 @@ namespace CalamityMod.Items.SummonItems public override bool CanUseItem(Player player) { - return !Main.dayTime && !NPC.AnyNPCs(ModContent.NPCType()) && !BossRushEvent.BossRushActive; + return !Main.IsItDay() && !NPC.AnyNPCs(ModContent.NPCType()) && !BossRushEvent.BossRushActive; } public override bool? UseItem(Player player) diff --git a/Items/SummonItems/EyeofDesolation.png b/Items/SummonItems/EyeofDesolation.png index 2c653dc977..4041661161 100644 Binary files a/Items/SummonItems/EyeofDesolation.png and b/Items/SummonItems/EyeofDesolation.png differ diff --git a/Items/SummonItems/Invasion/CausticTear.cs b/Items/SummonItems/Invasion/CausticTear.cs index 849c8f6749..2de57c9d47 100644 --- a/Items/SummonItems/Invasion/CausticTear.cs +++ b/Items/SummonItems/Invasion/CausticTear.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.SummonItems.Invasion public new string LocalizationCategory => "Items.SummonItems"; public override void SetStaticDefaults() { - ItemID.Sets.SortingPriorityBossSpawns[Type] = 4; // Goblin Battle Standard + ItemID.Sets.SortingPriorityBossSpawns[Type] = 4; // Goblin Battle Standard } public override void SetDefaults() @@ -26,10 +26,10 @@ namespace CalamityMod.Items.SummonItems.Invasion Item.consumable = false; } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.EventItem; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.EventItem; + } public override bool CanUseItem(Player player) { diff --git a/Items/SummonItems/Invasion/MartianDistressRemote.cs b/Items/SummonItems/Invasion/MartianDistressRemote.cs index 623af8bdd5..965b1b0ff3 100644 --- a/Items/SummonItems/Invasion/MartianDistressRemote.cs +++ b/Items/SummonItems/Invasion/MartianDistressRemote.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.SummonItems.Invasion public int frame = 0; public override void SetStaticDefaults() { - ItemID.Sets.SortingPriorityBossSpawns[Type] = 17; // Solar Tablet (1 above Lihzahrd Power Cell) + ItemID.Sets.SortingPriorityBossSpawns[Type] = 17; // Solar Tablet (1 above Lihzahrd Power Cell) } public override void SetDefaults() @@ -27,12 +27,13 @@ namespace CalamityMod.Items.SummonItems.Invasion Item.useTime = 10; Item.useStyle = ItemUseStyleID.HoldUp; Item.consumable = false; + Item.UseSound = SoundID.Zombie67; } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.EventItem; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.EventItem; + } public override bool CanUseItem(Player player) => Main.invasionType == InvasionID.None; diff --git a/Items/SummonItems/NO.cs b/Items/SummonItems/NO.cs index 64e0ee699e..b3d12b72d4 100644 --- a/Items/SummonItems/NO.cs +++ b/Items/SummonItems/NO.cs @@ -1,11 +1,11 @@ using CalamityMod.Events; -using CalamityMod.Rarities; using CalamityMod.NPCs.Other; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Items.SummonItems { @@ -14,7 +14,7 @@ namespace CalamityMod.Items.SummonItems public new string LocalizationCategory => "Items.SummonItems"; public override void SetStaticDefaults() { - ItemID.Sets.SortingPriorityBossSpawns[Type] = 19; // Celestial Sigil + ItemID.Sets.SortingPriorityBossSpawns[Type] = 19; // Celestial Sigil } public override void SetDefaults() diff --git a/Items/SummonItems/NecroplasmicBeacon.cs b/Items/SummonItems/NecroplasmicBeacon.cs index 8519ceab3b..6cb20ea800 100644 --- a/Items/SummonItems/NecroplasmicBeacon.cs +++ b/Items/SummonItems/NecroplasmicBeacon.cs @@ -14,9 +14,10 @@ namespace CalamityMod.Items.SummonItems public class NecroplasmicBeacon : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.SummonItems"; + public override void SetStaticDefaults() { - ItemID.Sets.SortingPriorityBossSpawns[Type] = 19; // Celestial Sigil + ItemID.Sets.SortingPriorityBossSpawns[Type] = 19; // Celestial Sigil } public override void SetDefaults() @@ -30,10 +31,10 @@ namespace CalamityMod.Items.SummonItems Item.rare = ModContent.RarityType(); } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossItem; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossItem; + } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { @@ -60,7 +61,7 @@ namespace CalamityMod.Items.SummonItems { CreateRecipe(). AddRecipeGroup("Wood", 25). - AddIngredient(50). + AddIngredient(50). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/SummonItems/OldPowerCell.cs b/Items/SummonItems/OldPowerCell.cs index 8195e52b80..29ac9bf111 100644 --- a/Items/SummonItems/OldPowerCell.cs +++ b/Items/SummonItems/OldPowerCell.cs @@ -14,8 +14,8 @@ namespace CalamityMod.Items.SummonItems public override void SetStaticDefaults() { - NPCID.Sets.MPAllowedEnemies[NPCID.Golem] = true; - ItemID.Sets.SortingPriorityBossSpawns[Type] = 15; // Lihzahrd Power Cell + NPCID.Sets.MPAllowedEnemies[NPCID.Golem] = true; + ItemID.Sets.SortingPriorityBossSpawns[Type] = 15; // Lihzahrd Power Cell } public override void SetDefaults() @@ -29,10 +29,10 @@ namespace CalamityMod.Items.SummonItems Item.consumable = false; } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossItem; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossItem; + } public override bool CanUseItem(Player player) { diff --git a/Items/SummonItems/OverloadedSludge.cs b/Items/SummonItems/OverloadedSludge.cs index f334f3f32d..e13c873308 100644 --- a/Items/SummonItems/OverloadedSludge.cs +++ b/Items/SummonItems/OverloadedSludge.cs @@ -2,9 +2,9 @@ using CalamityMod.Items.Materials; using CalamityMod.NPCs.SlimeGod; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Items.SummonItems { @@ -13,7 +13,7 @@ namespace CalamityMod.Items.SummonItems public new string LocalizationCategory => "Items.SummonItems"; public override void SetStaticDefaults() { - ItemID.Sets.SortingPriorityBossSpawns[Type] = 5; // Abeemination / Deer Thing + ItemID.Sets.SortingPriorityBossSpawns[Type] = 5; // Abeemination / Deer Thing } public override void SetDefaults() @@ -27,10 +27,10 @@ namespace CalamityMod.Items.SummonItems Item.consumable = false; } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossItem; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossItem; + } public override bool CanUseItem(Player player) { diff --git a/Items/SummonItems/Portabulb.cs b/Items/SummonItems/Portabulb.cs index 7b514a59d0..0217cd7379 100644 --- a/Items/SummonItems/Portabulb.cs +++ b/Items/SummonItems/Portabulb.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.SummonItems public new string LocalizationCategory => "Items.SummonItems"; public override void SetStaticDefaults() { - NPCID.Sets.MPAllowedEnemies[NPCID.Plantera] = true; + NPCID.Sets.MPAllowedEnemies[NPCID.Plantera] = true; ItemID.Sets.SortingPriorityBossSpawns[Type] = 11; // Truffle Worm } diff --git a/Items/SummonItems/ProfanedCore.cs b/Items/SummonItems/ProfanedCore.cs index ff2949eb48..ae2034fd96 100644 --- a/Items/SummonItems/ProfanedCore.cs +++ b/Items/SummonItems/ProfanedCore.cs @@ -1,10 +1,10 @@ using CalamityMod.Events; using CalamityMod.NPCs.Providence; using Terraria; -using Terraria.ID; -using Terraria.ModLoader; using Terraria.Audio; using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.SummonItems { @@ -14,7 +14,7 @@ namespace CalamityMod.Items.SummonItems public new string LocalizationCategory => "Items.SummonItems"; public override void SetStaticDefaults() { - ItemID.Sets.SortingPriorityBossSpawns[Type] = 19; // Celestial Sigil + ItemID.Sets.SortingPriorityBossSpawns[Type] = 19; // Celestial Sigil } public override void SetDefaults() @@ -28,10 +28,10 @@ namespace CalamityMod.Items.SummonItems Item.rare = ItemRarityID.Purple; } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossItem; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossItem; + } public override bool CanUseItem(Player player) { diff --git a/Items/SummonItems/ProfanedShard.cs b/Items/SummonItems/ProfanedShard.cs index cbe912d819..f5e1076208 100644 --- a/Items/SummonItems/ProfanedShard.cs +++ b/Items/SummonItems/ProfanedShard.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.SummonItems public new string LocalizationCategory => "Items.SummonItems"; public override void SetStaticDefaults() { - ItemID.Sets.SortingPriorityBossSpawns[Type] = 19; // Celestial Sigil + ItemID.Sets.SortingPriorityBossSpawns[Type] = 19; // Celestial Sigil } public override void SetDefaults() @@ -29,10 +29,10 @@ namespace CalamityMod.Items.SummonItems Item.rare = ItemRarityID.Purple; } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossItem; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossItem; + } public override bool CanUseItem(Player player) { diff --git a/Items/SummonItems/RuneofKos.cs b/Items/SummonItems/RuneofKos.cs index a3b3a6d188..4e40c943d3 100644 --- a/Items/SummonItems/RuneofKos.cs +++ b/Items/SummonItems/RuneofKos.cs @@ -1,10 +1,10 @@ -using CalamityMod.Events; +using System.Collections.Generic; +using CalamityMod.Events; using CalamityMod.Items.Materials; using CalamityMod.NPCs.CeaselessVoid; using CalamityMod.NPCs.Signus; using CalamityMod.NPCs.StormWeaver; using CalamityMod.Rarities; -using System.Collections.Generic; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -21,7 +21,7 @@ namespace CalamityMod.Items.SummonItems public static readonly SoundStyle StormSound = new("CalamityMod/Sounds/Item/StormWeaverSpawn"); public override void SetStaticDefaults() { - ItemID.Sets.SortingPriorityBossSpawns[Type] = 19; // Celestial Sigil + ItemID.Sets.SortingPriorityBossSpawns[Type] = 19; // Celestial Sigil } public override void SetDefaults() @@ -36,10 +36,10 @@ namespace CalamityMod.Items.SummonItems Item.rare = ModContent.RarityType(); } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossItem; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossItem; + } public override bool CanUseItem(Player player) { diff --git a/Items/SummonItems/SandstormsCore.cs b/Items/SummonItems/SandstormsCore.cs index 2b3eca9770..1426db53d5 100644 --- a/Items/SummonItems/SandstormsCore.cs +++ b/Items/SummonItems/SandstormsCore.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.SummonItems public new string LocalizationCategory => "Items.SummonItems"; public override void SetStaticDefaults() { - ItemID.Sets.SortingPriorityBossSpawns[Type] = 12; // Frost Legion + ItemID.Sets.SortingPriorityBossSpawns[Type] = 12; // Frost Legion } public override void SetDefaults() @@ -29,10 +29,10 @@ namespace CalamityMod.Items.SummonItems Item.consumable = false; } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossItem; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossItem; + } public override bool CanUseItem(Player player) { diff --git a/Items/SummonItems/Seafood.cs b/Items/SummonItems/Seafood.cs index d802bb5a60..f6618275c1 100644 --- a/Items/SummonItems/Seafood.cs +++ b/Items/SummonItems/Seafood.cs @@ -3,9 +3,9 @@ using CalamityMod.Events; using CalamityMod.Items.Placeables; using CalamityMod.NPCs.AquaticScourge; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Items.SummonItems { @@ -14,7 +14,7 @@ namespace CalamityMod.Items.SummonItems public new string LocalizationCategory => "Items.SummonItems"; public override void SetStaticDefaults() { - ItemID.Sets.SortingPriorityBossSpawns[Type] = 8; // Mechanical Worm + ItemID.Sets.SortingPriorityBossSpawns[Type] = 8; // Mechanical Worm } public override void SetDefaults() @@ -28,10 +28,10 @@ namespace CalamityMod.Items.SummonItems Item.consumable = false; } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossItem; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossItem; + } public override bool CanUseItem(Player player) { diff --git a/Items/SummonItems/Starcore.cs b/Items/SummonItems/Starcore.cs index e4f2e63892..c1fb8b87ce 100644 --- a/Items/SummonItems/Starcore.cs +++ b/Items/SummonItems/Starcore.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Items.SummonItems public new string LocalizationCategory => "Items.SummonItems"; public override void SetStaticDefaults() { - ItemID.Sets.SortingPriorityBossSpawns[Type] = 18; // Bloody Tear (1 below Celestial Sigil fsr) + ItemID.Sets.SortingPriorityBossSpawns[Type] = 18; // Bloody Tear (1 below Celestial Sigil fsr) } public override void SetDefaults() @@ -20,15 +20,15 @@ namespace CalamityMod.Items.SummonItems Item.rare = ItemRarityID.Cyan; } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossItem; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossItem; + } public override void AddRecipes() { CreateRecipe(). - AddIngredient(25). + AddIngredient(25). AddIngredient(8). AddIngredient(4). AddTile(TileID.LunarCraftingStation). diff --git a/Items/SummonItems/Teratoma.cs b/Items/SummonItems/Teratoma.cs index 6f5f8f3247..7f3fee2cbf 100644 --- a/Items/SummonItems/Teratoma.cs +++ b/Items/SummonItems/Teratoma.cs @@ -2,9 +2,9 @@ using CalamityMod.Items.Materials; using CalamityMod.NPCs.HiveMind; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Items.SummonItems { @@ -13,7 +13,7 @@ namespace CalamityMod.Items.SummonItems public new string LocalizationCategory => "Items.SummonItems"; public override void SetStaticDefaults() { - ItemID.Sets.SortingPriorityBossSpawns[Type] = 5; // Abeemination / Deer Thing + ItemID.Sets.SortingPriorityBossSpawns[Type] = 5; // Abeemination / Deer Thing } public override void SetDefaults() @@ -27,10 +27,10 @@ namespace CalamityMod.Items.SummonItems Item.consumable = false; } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossItem; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossItem; + } public override bool CanUseItem(Player player) { @@ -55,7 +55,7 @@ namespace CalamityMod.Items.SummonItems AddIngredient(7). AddIngredient(ItemID.RottenChunk, 13). AddTile(TileID.DemonAltar). - AddDecraftCondition(Condition.Hardmode). + AddDecraftCondition(CalamityConditions.DownedHiveMind). Register(); } } diff --git a/Items/SummonItems/Terminus.cs b/Items/SummonItems/Terminus.cs index 5b1248c360..71f0b167e4 100644 --- a/Items/SummonItems/Terminus.cs +++ b/Items/SummonItems/Terminus.cs @@ -13,9 +13,9 @@ namespace CalamityMod.Items.SummonItems public new string LocalizationCategory => "Items.SummonItems"; public override void SetDefaults() { - Item.rare = ItemRarityID.Blue; Item.width = Main.zenithWorld ? 54 : 28; Item.height = Main.zenithWorld ? 78 : 28; + Item.rare = ItemRarityID.Blue; Item.useAnimation = 45; Item.useTime = 45; Item.channel = true; diff --git a/Items/SuperDummy.cs b/Items/SuperDummy.cs index 3e13915c33..ed1859f390 100644 --- a/Items/SuperDummy.cs +++ b/Items/SuperDummy.cs @@ -11,9 +11,9 @@ namespace CalamityMod.Items public new string LocalizationCategory => "Items.Misc"; public override void SetDefaults() { - Item.damage = 0; Item.width = 20; Item.height = 30; + Item.damage = 0; Item.useTime = 15; Item.useAnimation = 15; Item.useStyle = ItemUseStyleID.Swing; diff --git a/Items/Tools/AbyssalWarhammer.cs b/Items/Tools/AbyssalWarhammer.cs index efcbde0215..9339432c58 100644 --- a/Items/Tools/AbyssalWarhammer.cs +++ b/Items/Tools/AbyssalWarhammer.cs @@ -11,6 +11,8 @@ namespace CalamityMod.Items.Tools public new string LocalizationCategory => "Items.Tools"; public override void SetDefaults() { + Item.width = 70; + Item.height = 70; Item.damage = 42; Item.knockBack = 8f; Item.useTime = 10; @@ -19,11 +21,9 @@ namespace CalamityMod.Items.Tools Item.tileBoost += 1; Item.DamageType = DamageClass.Melee; - Item.width = 70; - Item.height = 70; Item.useTurn = true; Item.useStyle = ItemUseStyleID.Swing; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item1; Item.autoReuse = true; @@ -41,7 +41,7 @@ namespace CalamityMod.Items.Tools { if (Main.rand.NextBool(5)) { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 29); + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, DustID.WaterCandle); } } diff --git a/Items/Tools/AerialHamaxe.cs b/Items/Tools/AerialHamaxe.cs index d78bd3ef8e..7f257532ef 100644 --- a/Items/Tools/AerialHamaxe.cs +++ b/Items/Tools/AerialHamaxe.cs @@ -11,6 +11,8 @@ namespace CalamityMod.Items.Tools public new string LocalizationCategory => "Items.Tools"; public override void SetDefaults() { + Item.width = 44; + Item.height = 44; Item.damage = 20; Item.knockBack = 7f; Item.useTime = 16; @@ -20,11 +22,9 @@ namespace CalamityMod.Items.Tools Item.tileBoost += 1; Item.DamageType = DamageClass.Melee; - Item.width = 44; - Item.height = 44; Item.useTurn = true; Item.useStyle = ItemUseStyleID.Swing; - Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; Item.UseSound = SoundID.Item1; Item.autoReuse = true; @@ -43,7 +43,7 @@ namespace CalamityMod.Items.Tools { if (Main.rand.NextBool(3)) { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 59); + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, DustID.BlueTorch); } } } diff --git a/Items/Tools/AstralHamaxe.cs b/Items/Tools/AstralHamaxe.cs index c5d9095915..2b7ba2735c 100644 --- a/Items/Tools/AstralHamaxe.cs +++ b/Items/Tools/AstralHamaxe.cs @@ -13,6 +13,8 @@ namespace CalamityMod.Items.Tools public new string LocalizationCategory => "Items.Tools"; public override void SetDefaults() { + Item.width = 60; + Item.height = 70; Item.damage = 80; Item.knockBack = 5f; Item.useTime = 5; @@ -22,11 +24,9 @@ namespace CalamityMod.Items.Tools Item.tileBoost += 3; Item.DamageType = DamageClass.Melee; - Item.width = 60; - Item.height = 70; Item.useTurn = true; Item.useStyle = ItemUseStyleID.Swing; - Item.value = CalamityGlobalItem.Rarity9BuyPrice; + Item.value = CalamityGlobalItem.RarityCyanBuyPrice; Item.rare = ItemRarityID.Cyan; Item.UseSound = SoundID.Item1; Item.autoReuse = true; diff --git a/Items/Tools/AstralPickaxe.cs b/Items/Tools/AstralPickaxe.cs index 0d8198880f..5330fa612f 100644 --- a/Items/Tools/AstralPickaxe.cs +++ b/Items/Tools/AstralPickaxe.cs @@ -13,6 +13,8 @@ namespace CalamityMod.Items.Tools public new string LocalizationCategory => "Items.Tools"; public override void SetDefaults() { + Item.width = 50; + Item.height = 60; Item.damage = 65; Item.knockBack = 5f; Item.useTime = 6; @@ -21,11 +23,9 @@ namespace CalamityMod.Items.Tools Item.tileBoost += 3; Item.DamageType = DamageClass.Melee; - Item.width = 50; - Item.height = 60; Item.useTurn = true; Item.useStyle = ItemUseStyleID.Swing; - Item.value = CalamityGlobalItem.Rarity9BuyPrice; + Item.value = CalamityGlobalItem.RarityCyanBuyPrice; Item.rare = ItemRarityID.Cyan; Item.UseSound = SoundID.Item1; Item.autoReuse = true; diff --git a/Items/Tools/AxeofPurity.cs b/Items/Tools/AxeofPurity.cs index 336ab90644..abdf5aa8d7 100644 --- a/Items/Tools/AxeofPurity.cs +++ b/Items/Tools/AxeofPurity.cs @@ -15,11 +15,13 @@ namespace CalamityMod.Items.Tools public override void SetStaticDefaults() { - ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; + ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; } public override void SetDefaults() { + Item.width = 58; + Item.height = 54; Item.damage = 55; Item.knockBack = 5f; Item.useTime = 15; @@ -27,11 +29,9 @@ namespace CalamityMod.Items.Tools Item.axe = AxePower; Item.shoot = ProjectileID.PurificationPowder; Item.DamageType = DamageClass.Melee; - Item.width = 58; - Item.height = 54; Item.useTurn = true; Item.useStyle = ItemUseStyleID.Swing; - Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; Item.UseSound = SoundID.Item1; Item.autoReuse = true; @@ -71,7 +71,7 @@ namespace CalamityMod.Items.Tools { if (Main.rand.NextBool(5)) { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 58); + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, DustID.Enchanted_Pink); } } diff --git a/Items/Tools/BeastialPickaxe.cs b/Items/Tools/BeastialPickaxe.cs index 303549cf15..9269689fc5 100644 --- a/Items/Tools/BeastialPickaxe.cs +++ b/Items/Tools/BeastialPickaxe.cs @@ -11,6 +11,8 @@ namespace CalamityMod.Items.Tools public new string LocalizationCategory => "Items.Tools"; public override void SetDefaults() { + Item.width = 48; + Item.height = 46; Item.damage = 35; Item.knockBack = 4.5f; Item.useTime = 5; @@ -18,11 +20,9 @@ namespace CalamityMod.Items.Tools Item.pick = 200; Item.DamageType = DamageClass.Melee; - Item.width = 48; - Item.height = 46; Item.useTurn = true; Item.useStyle = ItemUseStyleID.Swing; - Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; Item.UseSound = SoundID.Item1; Item.autoReuse = true; @@ -40,7 +40,7 @@ namespace CalamityMod.Items.Tools { if (Main.rand.NextBool(5)) { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 61); + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, DustID.GreenTorch); } } diff --git a/Items/Tools/BerserkerWaraxe.cs b/Items/Tools/BerserkerWaraxe.cs index 0d682f9f43..9f08128517 100644 --- a/Items/Tools/BerserkerWaraxe.cs +++ b/Items/Tools/BerserkerWaraxe.cs @@ -11,6 +11,8 @@ namespace CalamityMod.Items.Tools public new string LocalizationCategory => "Items.Tools"; public override void SetDefaults() { + Item.width = 66; + Item.height = 56; Item.damage = 51; Item.knockBack = 8f; Item.useTime = 5; @@ -18,11 +20,9 @@ namespace CalamityMod.Items.Tools Item.axe = 180 / 5; Item.DamageType = DamageClass.Melee; - Item.width = 66; - Item.height = 56; Item.useTurn = true; Item.useStyle = ItemUseStyleID.Swing; - Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; Item.UseSound = SoundID.Item1; Item.autoReuse = true; @@ -40,7 +40,7 @@ namespace CalamityMod.Items.Tools { if (Main.rand.NextBool(5)) { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 61); + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, DustID.GreenTorch); } } diff --git a/Items/Tools/BlossomPickaxe.cs b/Items/Tools/BlossomPickaxe.cs index 182da2ac1b..6030917674 100644 --- a/Items/Tools/BlossomPickaxe.cs +++ b/Items/Tools/BlossomPickaxe.cs @@ -12,6 +12,8 @@ namespace CalamityMod.Items.Tools public new string LocalizationCategory => "Items.Tools"; public override void SetDefaults() { + Item.width = 50; + Item.height = 52; Item.damage = 92; Item.knockBack = 6.5f; Item.useTime = 4; @@ -20,11 +22,9 @@ namespace CalamityMod.Items.Tools Item.tileBoost += 5; Item.DamageType = DamageClass.Melee; - Item.width = 50; - Item.height = 52; Item.useTurn = true; Item.useStyle = ItemUseStyleID.Swing; - Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.rare = ModContent.RarityType(); @@ -42,7 +42,7 @@ namespace CalamityMod.Items.Tools { if (Main.rand.NextBool(5)) { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 75); + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, DustID.CursedTorch); } } } diff --git a/Items/Tools/BobbitHook.cs b/Items/Tools/BobbitHook.cs index 51e8056caa..f67d9f7fe3 100644 --- a/Items/Tools/BobbitHook.cs +++ b/Items/Tools/BobbitHook.cs @@ -15,12 +15,12 @@ namespace CalamityMod.Items.Tools { // Instead of copying these values, we can clone and modify the ones we want to copy Item.CloneDefaults(ItemID.AmethystHook); - Item.shootSpeed = BobbitHead.LaunchSpeed; // How quickly the hook is shot. - Item.shoot = ProjectileType(); - Item.value = CalamityGlobalItem.Rarity13BuyPrice; - Item.rare = ModContent.RarityType(); Item.width = 30; Item.height = 32; + Item.shootSpeed = BobbitHead.LaunchSpeed; // How quickly the hook is shot. + Item.shoot = ProjectileType(); + Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; + Item.rare = ModContent.RarityType(); } } } diff --git a/Items/Tools/ClimateChange/AridArtifact.cs b/Items/Tools/ClimateChange/AridArtifact.cs index 63c4f9532b..759f43754d 100644 --- a/Items/Tools/ClimateChange/AridArtifact.cs +++ b/Items/Tools/ClimateChange/AridArtifact.cs @@ -17,14 +17,14 @@ namespace CalamityMod.Items.Tools.ClimateChange Item.UseSound = SoundID.Item66; } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.EventItem; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.EventItem; + } public override bool CanUseItem(Player player) { - return DownedBossSystem.downedDesertScourge; + return DownedBossSystem.downedDesertScourge || Main.hardMode; } // this is extremely ugly and has to be fully qualified because we add an item called Sandstorm diff --git a/Items/Tools/ClimateChange/Cosmolight.cs b/Items/Tools/ClimateChange/Cosmolight.cs index 591cb26225..70705a1e1a 100644 --- a/Items/Tools/ClimateChange/Cosmolight.cs +++ b/Items/Tools/ClimateChange/Cosmolight.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Tools.ClimateChange // These are "halfway through day" and "halfway through night" respectively. private const int NoonCutoff = 27000; private const int MidnightCutoff = 16200; - + public override void SetDefaults() { Item.width = 20; diff --git a/Items/Tools/ClimateChange/TorrentialTear.cs b/Items/Tools/ClimateChange/TorrentialTear.cs index 61d7b3d1ae..fca095ca74 100644 --- a/Items/Tools/ClimateChange/TorrentialTear.cs +++ b/Items/Tools/ClimateChange/TorrentialTear.cs @@ -19,10 +19,10 @@ namespace CalamityMod.Items.Tools.ClimateChange Item.consumable = false; } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.EventItem; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.EventItem; + } public override bool CanUseItem(Player player) { @@ -60,21 +60,21 @@ namespace CalamityMod.Items.Tools.ClimateChange { if (Main.cloudBGActive >= 1f || (double)Main.numClouds > 150.0) { - if (Main.rand.Next(3) == 0) + if (Main.rand.NextBool(3)) Main.maxRaining = (float)Main.rand.Next(20, 90) * 0.01f; else Main.maxRaining = (float)Main.rand.Next(40, 90) * 0.01f; } else if ((double)Main.numClouds > 100.0) { - if (Main.rand.Next(3) == 0) + if (Main.rand.NextBool(3)) Main.maxRaining = (float)Main.rand.Next(10, 70) * 0.01f; else Main.maxRaining = (float)Main.rand.Next(20, 60) * 0.01f; } else { - if (Main.rand.Next(3) == 0) + if (Main.rand.NextBool(3)) Main.maxRaining = (float)Main.rand.Next(5, 40) * 0.01f; else Main.maxRaining = (float)Main.rand.Next(5, 30) * 0.01f; diff --git a/Items/Tools/CrystylCrusher.cs b/Items/Tools/CrystylCrusher.cs index a912247f69..43b4d0a156 100644 --- a/Items/Tools/CrystylCrusher.cs +++ b/Items/Tools/CrystylCrusher.cs @@ -1,10 +1,10 @@ -using CalamityMod.Items.Materials; +using System.Collections.Generic; +using System.Linq; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; -using System.Collections.Generic; -using System.Linq; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -28,6 +28,8 @@ namespace CalamityMod.Items.Tools public override void SetDefaults() { + Item.width = 70; + Item.height = 70; Item.damage = 400; Item.knockBack = 9f; Item.useTime = 1; @@ -37,14 +39,12 @@ namespace CalamityMod.Items.Tools Item.DamageType = DamageClass.Melee; Item.channel = true; - Item.width = 70; - Item.height = 70; Item.useStyle = ItemUseStyleID.Swing; Item.shootSpeed = LaserSpeed; Item.UseSound = SoundID.Item1; Item.shoot = ModContent.ProjectileType(); - Item.value = CalamityGlobalItem.Rarity16BuyPrice; + Item.value = CalamityGlobalItem.RarityHotPinkBuyPrice; Item.rare = ModContent.RarityType(); Item.Calamity().devItem = true; } diff --git a/Items/Tools/FellerofEvergreens.cs b/Items/Tools/FellerofEvergreens.cs index 8a4c67347f..8f6cffdec9 100644 --- a/Items/Tools/FellerofEvergreens.cs +++ b/Items/Tools/FellerofEvergreens.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Items.Tools public new string LocalizationCategory => "Items.Tools"; public override void SetDefaults() { + Item.width = 66; + Item.height = 66; Item.damage = 18; Item.knockBack = 5f; Item.useTime = 17; @@ -16,12 +18,9 @@ namespace CalamityMod.Items.Tools Item.axe = 100 / 5; Item.DamageType = DamageClass.Melee; - Item.width = 50; - Item.height = 46; - Item.scale = 1.5f; Item.useTurn = true; Item.useStyle = ItemUseStyleID.Swing; - Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; Item.UseSound = SoundID.Item1; Item.autoReuse = true; diff --git a/Items/Tools/FellerofEvergreens.png b/Items/Tools/FellerofEvergreens.png index 322c229f2e..e99305472f 100644 Binary files a/Items/Tools/FellerofEvergreens.png and b/Items/Tools/FellerofEvergreens.png differ diff --git a/Items/Tools/Gelpick.cs b/Items/Tools/Gelpick.cs index b4494aea18..8dddba14cd 100644 --- a/Items/Tools/Gelpick.cs +++ b/Items/Tools/Gelpick.cs @@ -12,6 +12,8 @@ namespace CalamityMod.Items.Tools public new string LocalizationCategory => "Items.Tools"; public override void SetDefaults() { + Item.width = 46; + Item.height = 48; Item.damage = 19; Item.knockBack = 2.5f; Item.useTime = 9; @@ -20,10 +22,8 @@ namespace CalamityMod.Items.Tools Item.tileBoost += 1; Item.DamageType = DamageClass.Melee; - Item.width = 46; - Item.height = 48; Item.useStyle = ItemUseStyleID.Swing; - Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; Item.UseSound = SoundID.Item1; Item.autoReuse = true; @@ -43,7 +43,7 @@ namespace CalamityMod.Items.Tools { if (Main.rand.NextBool(4)) { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 20); + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, DustID.PurificationPowder); } } diff --git a/Items/Tools/GenesisPickaxe.cs b/Items/Tools/GenesisPickaxe.cs index a500968183..731ed16653 100644 --- a/Items/Tools/GenesisPickaxe.cs +++ b/Items/Tools/GenesisPickaxe.cs @@ -13,6 +13,8 @@ namespace CalamityMod.Items.Tools public override void SetDefaults() { // These stats exactly match vanilla's Luminite pickaxes. + Item.width = 84; + Item.height = 80; Item.damage = 80; Item.knockBack = 5.5f; Item.useTime = 6; @@ -21,11 +23,9 @@ namespace CalamityMod.Items.Tools Item.tileBoost += 4; Item.DamageType = DamageClass.Melee; - Item.width = 84; - Item.height = 80; Item.useTurn = true; Item.useStyle = ItemUseStyleID.Swing; - Item.value = CalamityGlobalItem.Rarity10BuyPrice; + Item.value = CalamityGlobalItem.RarityRedBuyPrice; Item.rare = ItemRarityID.Red; Item.UseSound = SoundID.Item1; Item.autoReuse = true; @@ -45,7 +45,7 @@ namespace CalamityMod.Items.Tools { if (Main.rand.NextBool(5)) { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 62); + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, DustID.PurpleTorch); } } } diff --git a/Items/Tools/Grax.cs b/Items/Tools/Grax.cs index 39d14b1801..05a6a1d354 100644 --- a/Items/Tools/Grax.cs +++ b/Items/Tools/Grax.cs @@ -15,11 +15,13 @@ namespace CalamityMod.Items.Tools public override void SetStaticDefaults() { - ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; + ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; } public override void SetDefaults() { + Item.width = 62; + Item.height = 62; Item.damage = 472; Item.knockBack = 8f; Item.useTime = 4; @@ -27,16 +29,12 @@ namespace CalamityMod.Items.Tools Item.hammer = HammerPower; Item.axe = AxePower; Item.tileBoost += 5; - - Item.width = 62; - Item.height = 62; - Item.scale = 1.5f; Item.DamageType = DamageClass.Melee; Item.useStyle = ItemUseStyleID.Swing; Item.useTurn = true; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); } diff --git a/Items/Tools/GreatbayPickaxe.cs b/Items/Tools/GreatbayPickaxe.cs index 8d89b5b3ec..abc45a967d 100644 --- a/Items/Tools/GreatbayPickaxe.cs +++ b/Items/Tools/GreatbayPickaxe.cs @@ -10,6 +10,8 @@ namespace CalamityMod.Items.Tools public new string LocalizationCategory => "Items.Tools"; public override void SetDefaults() { + Item.width = 44; + Item.height = 44; Item.damage = 9; Item.knockBack = 2f; Item.useTime = 8; @@ -17,11 +19,9 @@ namespace CalamityMod.Items.Tools Item.pick = 55; Item.DamageType = DamageClass.Melee; - Item.width = 44; - Item.height = 44; Item.useTurn = true; Item.useStyle = ItemUseStyleID.Swing; - Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; Item.UseSound = SoundID.Item1; Item.autoReuse = true; diff --git a/Items/Tools/InfernaCutter.cs b/Items/Tools/InfernaCutter.cs index 227ccb8a6f..54feccc2ee 100644 --- a/Items/Tools/InfernaCutter.cs +++ b/Items/Tools/InfernaCutter.cs @@ -13,6 +13,8 @@ namespace CalamityMod.Items.Tools public new string LocalizationCategory => "Items.Tools"; public override void SetDefaults() { + Item.width = 80; + Item.height = 66; Item.damage = 110; Item.knockBack = 7f; Item.useTime = 8; @@ -21,11 +23,9 @@ namespace CalamityMod.Items.Tools Item.tileBoost += 1; Item.DamageType = DamageClass.Melee; - Item.width = 80; - Item.height = 66; Item.useTurn = true; Item.useStyle = ItemUseStyleID.Swing; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item1; Item.autoReuse = true; @@ -123,14 +123,10 @@ namespace CalamityMod.Items.Tools } if (Main.rand.NextBool(4)) { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 6); + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, DustID.Torch); } } - public override void ModifyHitNPC(Player player, NPC target, ref NPC.HitModifiers modifiers) - { - modifiers.CritDamage *= 0.5f; - } public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) { if (hit.Crit) diff --git a/Items/Tools/MarniteDeconstructor.cs b/Items/Tools/MarniteDeconstructor.cs index 464055b82d..a457d1cf24 100644 --- a/Items/Tools/MarniteDeconstructor.cs +++ b/Items/Tools/MarniteDeconstructor.cs @@ -1,8 +1,8 @@ using CalamityMod.Projectiles.Melee; -using Terraria.ID; -using Terraria.ModLoader; using Terraria; using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Tools { @@ -13,6 +13,8 @@ namespace CalamityMod.Items.Tools public new string LocalizationCategory => "Items.Tools"; public override void SetDefaults() { + Item.width = 36; + Item.height = 18; Item.damage = 6; Item.ArmorPenetration = 10; Item.knockBack = 0f; @@ -21,13 +23,11 @@ namespace CalamityMod.Items.Tools Item.hammer = 40; Item.DamageType = TrueMeleeNoSpeedDamageClass.Instance; - Item.width = 36; - Item.height = 18; Item.channel = true; Item.noUseGraphic = true; Item.noMelee = true; Item.useStyle = ItemUseStyleID.Shoot; - Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.rare = ItemRarityID.Blue; Item.UseSound = SoundID.Item23; Item.autoReuse = true; diff --git a/Items/Tools/MarniteObliterator.cs b/Items/Tools/MarniteObliterator.cs index 3ca54b02dd..f274cc24c1 100644 --- a/Items/Tools/MarniteObliterator.cs +++ b/Items/Tools/MarniteObliterator.cs @@ -1,8 +1,8 @@ using CalamityMod.Projectiles.Melee; -using Terraria.ID; -using Terraria.ModLoader; using Terraria; using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Tools { @@ -13,6 +13,8 @@ namespace CalamityMod.Items.Tools public override void SetDefaults() { + Item.width = 36; + Item.height = 18; Item.damage = 7; Item.ArmorPenetration = 5; Item.knockBack = 0f; @@ -21,13 +23,11 @@ namespace CalamityMod.Items.Tools Item.pick = 50; Item.DamageType = TrueMeleeNoSpeedDamageClass.Instance; - Item.width = 36; - Item.height = 18; Item.channel = true; Item.noUseGraphic = true; Item.noMelee = true; Item.useStyle = ItemUseStyleID.Shoot; - Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.rare = ItemRarityID.Blue; Item.UseSound = SoundID.Item23; Item.autoReuse = true; diff --git a/Items/Tools/ReefclawHamaxe.cs b/Items/Tools/ReefclawHamaxe.cs index 1da9236dd1..ac0cfd10aa 100644 --- a/Items/Tools/ReefclawHamaxe.cs +++ b/Items/Tools/ReefclawHamaxe.cs @@ -10,6 +10,8 @@ namespace CalamityMod.Items.Tools public new string LocalizationCategory => "Items.Tools"; public override void SetDefaults() { + Item.width = 44; + Item.height = 44; Item.damage = 15; Item.knockBack = 6f; Item.useTime = 11; @@ -18,11 +20,9 @@ namespace CalamityMod.Items.Tools Item.axe = 55 / 5; Item.DamageType = DamageClass.Melee; - Item.width = 44; - Item.height = 44; Item.useTurn = true; Item.useStyle = ItemUseStyleID.Swing; - Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; Item.UseSound = SoundID.Item1; Item.autoReuse = true; diff --git a/Items/Tools/SeismicHampick.cs b/Items/Tools/SeismicHampick.cs index bbfefe136e..1146ade1fc 100644 --- a/Items/Tools/SeismicHampick.cs +++ b/Items/Tools/SeismicHampick.cs @@ -20,6 +20,8 @@ namespace CalamityMod.Items.Tools public override void SetDefaults() { + Item.width = 52; + Item.height = 50; Item.damage = 58; Item.knockBack = 8f; Item.useTime = 6; @@ -29,11 +31,9 @@ namespace CalamityMod.Items.Tools Item.tileBoost += 2; Item.DamageType = DamageClass.Melee; - Item.width = 52; - Item.height = 50; Item.useTurn = true; Item.useStyle = ItemUseStyleID.Swing; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; Item.UseSound = SoundID.Item1; Item.autoReuse = true; diff --git a/Items/Tools/ShardlightPickaxe.cs b/Items/Tools/ShardlightPickaxe.cs index b7d726850a..019d52c300 100644 --- a/Items/Tools/ShardlightPickaxe.cs +++ b/Items/Tools/ShardlightPickaxe.cs @@ -11,6 +11,8 @@ namespace CalamityMod.Items.Tools public new string LocalizationCategory => "Items.Tools"; public override void SetDefaults() { + Item.width = 44; + Item.height = 44; Item.damage = 28; Item.knockBack = 4f; Item.useTime = 8; @@ -19,11 +21,9 @@ namespace CalamityMod.Items.Tools Item.tileBoost += 1; Item.DamageType = DamageClass.Melee; - Item.width = 44; - Item.height = 44; Item.useTurn = true; Item.useStyle = ItemUseStyleID.Swing; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item1; Item.autoReuse = true; @@ -41,7 +41,7 @@ namespace CalamityMod.Items.Tools { if (Main.rand.NextBool(5)) { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 29); + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, DustID.WaterCandle); } } diff --git a/Items/Tools/SkyfringePickaxe.cs b/Items/Tools/SkyfringePickaxe.cs index 9e9a90cdab..5bf89577f3 100644 --- a/Items/Tools/SkyfringePickaxe.cs +++ b/Items/Tools/SkyfringePickaxe.cs @@ -11,6 +11,8 @@ namespace CalamityMod.Items.Tools public new string LocalizationCategory => "Items.Tools"; public override void SetDefaults() { + Item.width = 44; + Item.height = 44; Item.damage = 12; Item.knockBack = 2.5f; Item.useTime = 12; @@ -19,11 +21,9 @@ namespace CalamityMod.Items.Tools Item.tileBoost += 1; Item.DamageType = DamageClass.Melee; - Item.width = 44; - Item.height = 44; Item.useTurn = true; Item.useStyle = ItemUseStyleID.Swing; - Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; Item.UseSound = SoundID.Item1; Item.autoReuse = true; @@ -42,7 +42,7 @@ namespace CalamityMod.Items.Tools { if (Main.rand.NextBool(3)) { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 59); + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, DustID.BlueTorch); } } } diff --git a/Items/Tools/TectonicTruncator.cs b/Items/Tools/TectonicTruncator.cs index 17403fa3e9..3f022a6ab5 100644 --- a/Items/Tools/TectonicTruncator.cs +++ b/Items/Tools/TectonicTruncator.cs @@ -12,6 +12,8 @@ namespace CalamityMod.Items.Tools public new string LocalizationCategory => "Items.Tools"; public override void SetDefaults() { + Item.width = 50; + Item.height = 50; Item.damage = 68; Item.knockBack = 7f; Item.useTime = 6; @@ -20,11 +22,9 @@ namespace CalamityMod.Items.Tools Item.tileBoost += 2; Item.DamageType = DamageClass.Melee; - Item.width = 50; - Item.height = 50; Item.useTurn = true; Item.useStyle = ItemUseStyleID.Swing; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; Item.UseSound = SoundID.Item1; Item.autoReuse = true; diff --git a/Items/Tools/WulfrumDiggingTurtle.cs b/Items/Tools/WulfrumDiggingTurtle.cs index 95718e8b63..2150a3403e 100644 --- a/Items/Tools/WulfrumDiggingTurtle.cs +++ b/Items/Tools/WulfrumDiggingTurtle.cs @@ -3,9 +3,9 @@ using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using Terraria.DataStructures; namespace CalamityMod.Items.Tools { @@ -14,18 +14,18 @@ namespace CalamityMod.Items.Tools public new string LocalizationCategory => "Items.Tools"; public override void SetStaticDefaults() { - Item.ResearchUnlockCount = 10; + Item.ResearchUnlockCount = 10; } public override void SetDefaults() { + Item.width = 30; + Item.height = 38; Item.useTime = Item.useAnimation = 8; Item.maxStack = 9999; Item.consumable = true; Item.shootSpeed = 20f; Item.shoot = ModContent.ProjectileType(); - Item.width = 30; - Item.height = 38; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.noUseGraphic = true; @@ -34,10 +34,10 @@ namespace CalamityMod.Items.Tools Item.rare = ItemRarityID.Blue; } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.ToolsOther; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.ToolsOther; + } public override bool AltFunctionUse(Player player) => true; diff --git a/Items/Tools/WulfrumDrill.cs b/Items/Tools/WulfrumDrill.cs index 483e7c7f9f..1a5508fe6d 100644 --- a/Items/Tools/WulfrumDrill.cs +++ b/Items/Tools/WulfrumDrill.cs @@ -1,8 +1,8 @@ using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Typeless; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Projectiles.Typeless; namespace CalamityMod.Items.Tools { @@ -12,6 +12,8 @@ namespace CalamityMod.Items.Tools public new string LocalizationCategory => "Items.Tools"; public override void SetDefaults() { + Item.width = 46; + Item.height = 38; Item.damage = 5; Item.knockBack = 0f; Item.useTime = 5; @@ -20,9 +22,7 @@ namespace CalamityMod.Items.Tools Item.tileBoost += 1; Item.DamageType = DamageClass.Melee; - Item.width = 46; - Item.height = 38; - Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.rare = ItemRarityID.Blue; Item.UseSound = SoundID.Item23; Item.autoReuse = true; diff --git a/Items/Tools/WulfrumScaffoldKit.cs b/Items/Tools/WulfrumScaffoldKit.cs index 22770fe83c..5214589d07 100644 --- a/Items/Tools/WulfrumScaffoldKit.cs +++ b/Items/Tools/WulfrumScaffoldKit.cs @@ -39,10 +39,10 @@ namespace CalamityMod.Items.Tools TileTime = 6 * 60; } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.ToolsOther; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.ToolsOther; + } public override void HoldItem(Player player) { diff --git a/Items/Tools/WulfrumTreasurePinger.cs b/Items/Tools/WulfrumTreasurePinger.cs index a223acfaba..8ccbada62e 100644 --- a/Items/Tools/WulfrumTreasurePinger.cs +++ b/Items/Tools/WulfrumTreasurePinger.cs @@ -41,10 +41,10 @@ namespace CalamityMod.Items.Tools timeBeforeBlast = breakTime; } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.ToolsOther; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.ToolsOther; + } public override void HoldItem(Player player) { @@ -287,5 +287,5 @@ namespace CalamityMod.Items.Tools } } - + } diff --git a/Items/TreasureBags/AquaticScourgeBag.cs b/Items/TreasureBags/AquaticScourgeBag.cs index 61eb6256af..052a8aaabd 100644 --- a/Items/TreasureBags/AquaticScourgeBag.cs +++ b/Items/TreasureBags/AquaticScourgeBag.cs @@ -23,33 +23,33 @@ namespace CalamityMod.Items.TreasureBags public override void SetStaticDefaults() { Item.ResearchUnlockCount = 3; - ItemID.Sets.BossBag[Item.type] = true; + ItemID.Sets.BossBag[Item.type] = true; } public override void SetDefaults() { - Item.maxStack = 9999; - Item.consumable = true; Item.width = 24; Item.height = 24; + Item.maxStack = 9999; + Item.consumable = true; Item.rare = ItemRarityID.Cyan; Item.expert = true; } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossBags; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossBags; + } public override bool CanRightClick() => true; - public override Color? GetAlpha(Color lightColor) => Color.Lerp(lightColor, Color.White, 0.4f); + public override Color? GetAlpha(Color lightColor) => Color.Lerp(lightColor, Color.White, 0.4f); public override void PostUpdate() - { - CalamityUtils.ForceItemIntoWorld(Item); - Item.TreasureBagLightAndDust(); - } + { + CalamityUtils.ForceItemIntoWorld(Item); + Item.TreasureBagLightAndDust(); + } public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) { @@ -58,8 +58,8 @@ namespace CalamityMod.Items.TreasureBags public override void ModifyItemLoot(ItemLoot itemLoot) { - // Money - itemLoot.Add(ItemDropRule.CoinsBasedOnNPCValue(ModContent.NPCType())); + // Money + itemLoot.Add(ItemDropRule.CoinsBasedOnNPCValue(ModContent.NPCType())); // Weapons itemLoot.Add(DropHelper.CalamityStyle(DropHelper.BagWeaponDropRateFraction, new int[] @@ -74,7 +74,6 @@ namespace CalamityMod.Items.TreasureBags // Equipment itemLoot.Add(ModContent.ItemType()); - itemLoot.Add(ModContent.ItemType(), 10); itemLoot.Add(ModContent.ItemType(), DropHelper.BagWeaponDropRateFraction); itemLoot.AddRevBagAccessories(); diff --git a/Items/TreasureBags/AstrumAureusBag.cs b/Items/TreasureBags/AstrumAureusBag.cs index 90cadb23f9..b94f45c744 100644 --- a/Items/TreasureBags/AstrumAureusBag.cs +++ b/Items/TreasureBags/AstrumAureusBag.cs @@ -28,27 +28,27 @@ namespace CalamityMod.Items.TreasureBags public override void SetStaticDefaults() { Item.ResearchUnlockCount = 3; - ItemID.Sets.BossBag[Item.type] = true; + ItemID.Sets.BossBag[Item.type] = true; } public override void SetDefaults() { - Item.maxStack = 9999; - Item.consumable = true; Item.width = 24; Item.height = 24; + Item.maxStack = 9999; + Item.consumable = true; Item.expert = true; Item.rare = ItemRarityID.Cyan; } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossBags; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossBags; + } public override bool CanRightClick() => true; - public override Color? GetAlpha(Color lightColor) => Color.Lerp(lightColor, Color.White, 0.4f); + public override Color? GetAlpha(Color lightColor) => Color.Lerp(lightColor, Color.White, 0.4f); public override void PostUpdate() => Item.TreasureBagLightAndDust(); @@ -59,12 +59,12 @@ namespace CalamityMod.Items.TreasureBags public override void ModifyItemLoot(ItemLoot itemLoot) { - // Money - itemLoot.Add(ItemDropRule.CoinsBasedOnNPCValue(ModContent.NPCType())); + // Money + itemLoot.Add(ItemDropRule.CoinsBasedOnNPCValue(ModContent.NPCType())); // Materials itemLoot.Add(ModContent.ItemType(), 1, 12, 16); - itemLoot.Add(ModContent.ItemType(), 1, 30, 40); + itemLoot.Add(ModContent.ItemType(), 1, 30, 40); itemLoot.Add(ItemID.FallenStar, 1, 20, 30); // Weapons diff --git a/Items/TreasureBags/AstrumDeusBag.cs b/Items/TreasureBags/AstrumDeusBag.cs index 9c88f5712e..0edb610266 100644 --- a/Items/TreasureBags/AstrumDeusBag.cs +++ b/Items/TreasureBags/AstrumDeusBag.cs @@ -24,33 +24,33 @@ namespace CalamityMod.Items.TreasureBags public override void SetStaticDefaults() { Item.ResearchUnlockCount = 3; - ItemID.Sets.BossBag[Item.type] = true; + ItemID.Sets.BossBag[Item.type] = true; } public override void SetDefaults() { - Item.maxStack = 9999; - Item.consumable = true; Item.width = 24; Item.height = 24; + Item.maxStack = 9999; + Item.consumable = true; Item.expert = true; Item.rare = ItemRarityID.Cyan; } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossBags; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossBags; + } public override bool CanRightClick() => true; - public override Color? GetAlpha(Color lightColor) => Color.Lerp(lightColor, Color.White, 0.4f); + public override Color? GetAlpha(Color lightColor) => Color.Lerp(lightColor, Color.White, 0.4f); public override void PostUpdate() - { - CalamityUtils.ForceItemIntoWorld(Item); - Item.TreasureBagLightAndDust(); - } + { + CalamityUtils.ForceItemIntoWorld(Item); + Item.TreasureBagLightAndDust(); + } public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) { @@ -59,11 +59,11 @@ namespace CalamityMod.Items.TreasureBags public override void ModifyItemLoot(ItemLoot itemLoot) { - // Money - itemLoot.Add(ItemDropRule.CoinsBasedOnNPCValue(ModContent.NPCType())); + // Money + itemLoot.Add(ItemDropRule.CoinsBasedOnNPCValue(ModContent.NPCType())); // Materials - itemLoot.Add(ModContent.ItemType(), 1, 60, 90); + itemLoot.Add(ModContent.ItemType(), 1, 60, 90); itemLoot.Add(ItemID.FallenStar, 1, 30, 50); // Weapons diff --git a/Items/TreasureBags/BrimstoneWaifuBag.cs b/Items/TreasureBags/BrimstoneWaifuBag.cs index be530b66c0..124589d49e 100644 --- a/Items/TreasureBags/BrimstoneWaifuBag.cs +++ b/Items/TreasureBags/BrimstoneWaifuBag.cs @@ -25,27 +25,27 @@ namespace CalamityMod.Items.TreasureBags public override void SetStaticDefaults() { Item.ResearchUnlockCount = 3; - ItemID.Sets.BossBag[Item.type] = true; + ItemID.Sets.BossBag[Item.type] = true; } public override void SetDefaults() { - Item.maxStack = 9999; - Item.consumable = true; Item.width = 24; Item.height = 24; + Item.maxStack = 9999; + Item.consumable = true; Item.expert = true; Item.rare = ItemRarityID.Cyan; } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossBags; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossBags; + } public override bool CanRightClick() => true; - public override Color? GetAlpha(Color lightColor) => Color.Lerp(lightColor, Color.White, 0.4f); + public override Color? GetAlpha(Color lightColor) => Color.Lerp(lightColor, Color.White, 0.4f); public override void PostUpdate() => Item.TreasureBagLightAndDust(); @@ -56,8 +56,8 @@ namespace CalamityMod.Items.TreasureBags public override void ModifyItemLoot(ItemLoot itemLoot) { - // Money - itemLoot.Add(ItemDropRule.CoinsBasedOnNPCValue(ModContent.NPCType())); + // Money + itemLoot.Add(ItemDropRule.CoinsBasedOnNPCValue(ModContent.NPCType())); // Materials itemLoot.Add(ModContent.ItemType(), 1, 10, 12); diff --git a/Items/TreasureBags/CalamitasCloneBag.cs b/Items/TreasureBags/CalamitasCloneBag.cs index 3504febd3e..45454a0eab 100644 --- a/Items/TreasureBags/CalamitasCloneBag.cs +++ b/Items/TreasureBags/CalamitasCloneBag.cs @@ -28,10 +28,10 @@ namespace CalamityMod.Items.TreasureBags public override void SetDefaults() { - Item.maxStack = 9999; - Item.consumable = true; Item.width = 24; Item.height = 24; + Item.maxStack = 9999; + Item.consumable = true; Item.rare = ItemRarityID.Cyan; Item.expert = true; } diff --git a/Items/TreasureBags/CalamitasCoffer.cs b/Items/TreasureBags/CalamitasCoffer.cs index 6eba333842..15d59ed0f2 100644 --- a/Items/TreasureBags/CalamitasCoffer.cs +++ b/Items/TreasureBags/CalamitasCoffer.cs @@ -30,10 +30,10 @@ namespace CalamityMod.Items.TreasureBags public override void SetDefaults() { - Item.maxStack = 9999; - Item.consumable = true; Item.width = 24; Item.height = 24; + Item.maxStack = 9999; + Item.consumable = true; Item.rare = ItemRarityID.Purple; Item.expert = true; } diff --git a/Items/TreasureBags/CeaselessVoidBag.cs b/Items/TreasureBags/CeaselessVoidBag.cs index 0adcda608a..4b7b168392 100644 --- a/Items/TreasureBags/CeaselessVoidBag.cs +++ b/Items/TreasureBags/CeaselessVoidBag.cs @@ -20,27 +20,27 @@ namespace CalamityMod.Items.TreasureBags public override void SetStaticDefaults() { Item.ResearchUnlockCount = 3; - ItemID.Sets.BossBag[Item.type] = true; + ItemID.Sets.BossBag[Item.type] = true; } public override void SetDefaults() { - Item.maxStack = 9999; - Item.consumable = true; Item.width = 24; Item.height = 24; + Item.maxStack = 9999; + Item.consumable = true; Item.rare = ItemRarityID.Cyan; Item.expert = true; } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossBags; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossBags; + } public override bool CanRightClick() => true; - public override Color? GetAlpha(Color lightColor) => Color.Lerp(lightColor, Color.White, 0.4f); + public override Color? GetAlpha(Color lightColor) => Color.Lerp(lightColor, Color.White, 0.4f); public override void PostUpdate() => Item.TreasureBagLightAndDust(); @@ -51,8 +51,8 @@ namespace CalamityMod.Items.TreasureBags public override void ModifyItemLoot(ItemLoot itemLoot) { - // Money - itemLoot.Add(ItemDropRule.CoinsBasedOnNPCValue(ModContent.NPCType())); + // Money + itemLoot.Add(ItemDropRule.CoinsBasedOnNPCValue(ModContent.NPCType())); // Materials itemLoot.Add(ModContent.ItemType(), 1, 6, 9); diff --git a/Items/TreasureBags/CrabulonBag.cs b/Items/TreasureBags/CrabulonBag.cs index 96547810fd..7d913160e9 100644 --- a/Items/TreasureBags/CrabulonBag.cs +++ b/Items/TreasureBags/CrabulonBag.cs @@ -24,28 +24,28 @@ namespace CalamityMod.Items.TreasureBags public override void SetStaticDefaults() { Item.ResearchUnlockCount = 3; - ItemID.Sets.BossBag[Item.type] = true; + ItemID.Sets.BossBag[Item.type] = true; ItemID.Sets.PreHardmodeLikeBossBag[Item.type] = true; } public override void SetDefaults() { - Item.maxStack = 9999; - Item.consumable = true; Item.width = 24; Item.height = 24; + Item.maxStack = 9999; + Item.consumable = true; Item.rare = ItemRarityID.Cyan; Item.expert = true; } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossBags; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossBags; + } public override bool CanRightClick() => true; - public override Color? GetAlpha(Color lightColor) => Color.Lerp(lightColor, Color.White, 0.4f); + public override Color? GetAlpha(Color lightColor) => Color.Lerp(lightColor, Color.White, 0.4f); public override void PostUpdate() => Item.TreasureBagLightAndDust(); @@ -56,8 +56,8 @@ namespace CalamityMod.Items.TreasureBags public override void ModifyItemLoot(ItemLoot itemLoot) { - // Money - itemLoot.Add(ItemDropRule.CoinsBasedOnNPCValue(ModContent.NPCType())); + // Money + itemLoot.Add(ItemDropRule.CoinsBasedOnNPCValue(ModContent.NPCType())); // Materials itemLoot.Add(ItemID.GlowingMushroom, 1, 25, 35); diff --git a/Items/TreasureBags/CryogenBag.cs b/Items/TreasureBags/CryogenBag.cs index 37823b8805..ac76a5f8c3 100644 --- a/Items/TreasureBags/CryogenBag.cs +++ b/Items/TreasureBags/CryogenBag.cs @@ -24,27 +24,27 @@ namespace CalamityMod.Items.TreasureBags public override void SetStaticDefaults() { Item.ResearchUnlockCount = 3; - ItemID.Sets.BossBag[Item.type] = true; + ItemID.Sets.BossBag[Item.type] = true; } public override void SetDefaults() { - Item.maxStack = 9999; - Item.consumable = true; Item.width = 24; Item.height = 24; + Item.maxStack = 9999; + Item.consumable = true; Item.rare = ItemRarityID.Cyan; Item.expert = true; } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossBags; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossBags; + } public override bool CanRightClick() => true; - public override Color? GetAlpha(Color lightColor) => Color.Lerp(lightColor, Color.White, 0.4f); + public override Color? GetAlpha(Color lightColor) => Color.Lerp(lightColor, Color.White, 0.4f); public override void PostUpdate() => Item.TreasureBagLightAndDust(); @@ -55,8 +55,8 @@ namespace CalamityMod.Items.TreasureBags public override void ModifyItemLoot(ItemLoot itemLoot) { - // Money - itemLoot.Add(ItemDropRule.CoinsBasedOnNPCValue(ModContent.NPCType())); + // Money + itemLoot.Add(ItemDropRule.CoinsBasedOnNPCValue(ModContent.NPCType())); // Materials itemLoot.Add(ModContent.ItemType(), 1, 10, 12); diff --git a/Items/TreasureBags/DesertScourgeBag.cs b/Items/TreasureBags/DesertScourgeBag.cs index f0198e955d..4f734a549f 100644 --- a/Items/TreasureBags/DesertScourgeBag.cs +++ b/Items/TreasureBags/DesertScourgeBag.cs @@ -24,28 +24,28 @@ namespace CalamityMod.Items.TreasureBags public override void SetStaticDefaults() { Item.ResearchUnlockCount = 3; - ItemID.Sets.BossBag[Item.type] = true; + ItemID.Sets.BossBag[Item.type] = true; ItemID.Sets.PreHardmodeLikeBossBag[Item.type] = true; } public override void SetDefaults() { - Item.maxStack = 9999; - Item.consumable = true; Item.width = 24; Item.height = 24; + Item.maxStack = 9999; + Item.consumable = true; Item.rare = ItemRarityID.Cyan; Item.expert = true; } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossBags; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossBags; + } public override bool CanRightClick() => true; - public override Color? GetAlpha(Color lightColor) => Color.Lerp(lightColor, Color.White, 0.4f); + public override Color? GetAlpha(Color lightColor) => Color.Lerp(lightColor, Color.White, 0.4f); public override void PostUpdate() => Item.TreasureBagLightAndDust(); @@ -56,8 +56,8 @@ namespace CalamityMod.Items.TreasureBags public override void ModifyItemLoot(ItemLoot itemLoot) { - // Money - itemLoot.Add(ItemDropRule.CoinsBasedOnNPCValue(ModContent.NPCType())); + // Money + itemLoot.Add(ItemDropRule.CoinsBasedOnNPCValue(ModContent.NPCType())); // Materials itemLoot.Add(ModContent.ItemType(), 1, 30, 40); @@ -77,7 +77,6 @@ namespace CalamityMod.Items.TreasureBags // Equipment itemLoot.Add(ModContent.ItemType()); - itemLoot.Add(ModContent.ItemType(), DropHelper.BagWeaponDropRateFraction); itemLoot.Add(ModContent.ItemType(), DropHelper.BagWeaponDropRateFraction); itemLoot.AddRevBagAccessories(); diff --git a/Items/TreasureBags/DevourerofGodsBag.cs b/Items/TreasureBags/DevourerofGodsBag.cs index 5cfc7410fb..c4f6fc619f 100644 --- a/Items/TreasureBags/DevourerofGodsBag.cs +++ b/Items/TreasureBags/DevourerofGodsBag.cs @@ -26,23 +26,23 @@ namespace CalamityMod.Items.TreasureBags public override void SetStaticDefaults() { Item.ResearchUnlockCount = 3; - ItemID.Sets.BossBag[Item.type] = true; + ItemID.Sets.BossBag[Item.type] = true; } public override void SetDefaults() { - Item.maxStack = 9999; - Item.consumable = true; Item.width = 36; Item.height = 34; + Item.maxStack = 9999; + Item.consumable = true; Item.rare = ItemRarityID.Cyan; Item.expert = true; } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossBags; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossBags; + } public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) { @@ -56,18 +56,18 @@ namespace CalamityMod.Items.TreasureBags public override bool CanRightClick() => true; - public override Color? GetAlpha(Color lightColor) => Color.Lerp(lightColor, Color.White, 0.4f); + public override Color? GetAlpha(Color lightColor) => Color.Lerp(lightColor, Color.White, 0.4f); public override void PostUpdate() - { - CalamityUtils.ForceItemIntoWorld(Item); - Item.TreasureBagLightAndDust(); - } + { + CalamityUtils.ForceItemIntoWorld(Item); + Item.TreasureBagLightAndDust(); + } public override void ModifyItemLoot(ItemLoot itemLoot) { - // Money - itemLoot.Add(ItemDropRule.CoinsBasedOnNPCValue(ModContent.NPCType())); + // Money + itemLoot.Add(ItemDropRule.CoinsBasedOnNPCValue(ModContent.NPCType())); // Materials itemLoot.Add(ModContent.ItemType(), 1, 55, 65); diff --git a/Items/TreasureBags/DraedonBag.cs b/Items/TreasureBags/DraedonBag.cs index ddd0bae133..b8d2456874 100644 --- a/Items/TreasureBags/DraedonBag.cs +++ b/Items/TreasureBags/DraedonBag.cs @@ -24,33 +24,33 @@ namespace CalamityMod.Items.TreasureBags public override void SetStaticDefaults() { Item.ResearchUnlockCount = 3; - ItemID.Sets.BossBag[Item.type] = true; + ItemID.Sets.BossBag[Item.type] = true; } public override void SetDefaults() { - Item.maxStack = 9999; - Item.consumable = true; Item.width = 24; Item.height = 24; + Item.maxStack = 9999; + Item.consumable = true; Item.rare = ItemRarityID.Cyan; Item.expert = true; } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossBags; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossBags; + } public override bool CanRightClick() => true; - public override Color? GetAlpha(Color lightColor) => Color.Lerp(lightColor, Color.White, 0.4f); + public override Color? GetAlpha(Color lightColor) => Color.Lerp(lightColor, Color.White, 0.4f); public override void PostUpdate() - { - CalamityUtils.ForceItemIntoWorld(Item); - Item.TreasureBagLightAndDust(); - } + { + CalamityUtils.ForceItemIntoWorld(Item); + Item.TreasureBagLightAndDust(); + } public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) { @@ -59,8 +59,8 @@ namespace CalamityMod.Items.TreasureBags public override void ModifyItemLoot(ItemLoot itemLoot) { - // Money - itemLoot.Add(ItemDropRule.CoinsBasedOnNPCValue(ModContent.NPCType())); + // Money + itemLoot.Add(ItemDropRule.CoinsBasedOnNPCValue(ModContent.NPCType())); // Originally, masks were 1/3.5, for whatever reason. Keeping it that way. Fraction maskFraction = new Fraction(2, 7); diff --git a/Items/TreasureBags/DragonfollyBag.cs b/Items/TreasureBags/DragonfollyBag.cs index c4be9e15e7..0cccdf84d8 100644 --- a/Items/TreasureBags/DragonfollyBag.cs +++ b/Items/TreasureBags/DragonfollyBag.cs @@ -25,27 +25,27 @@ namespace CalamityMod.Items.TreasureBags public override void SetStaticDefaults() { Item.ResearchUnlockCount = 3; - ItemID.Sets.BossBag[Item.type] = true; + ItemID.Sets.BossBag[Item.type] = true; } public override void SetDefaults() { - Item.maxStack = 9999; - Item.consumable = true; Item.width = 24; Item.height = 24; + Item.maxStack = 9999; + Item.consumable = true; Item.expert = true; Item.rare = ItemRarityID.Cyan; } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossBags; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossBags; + } public override bool CanRightClick() => true; - public override Color? GetAlpha(Color lightColor) => Color.Lerp(lightColor, Color.White, 0.4f); + public override Color? GetAlpha(Color lightColor) => Color.Lerp(lightColor, Color.White, 0.4f); public override void PostUpdate() => Item.TreasureBagLightAndDust(); @@ -56,8 +56,8 @@ namespace CalamityMod.Items.TreasureBags public override void ModifyItemLoot(ItemLoot itemLoot) { - // Money - itemLoot.Add(ItemDropRule.CoinsBasedOnNPCValue(ModContent.NPCType())); + // Money + itemLoot.Add(ItemDropRule.CoinsBasedOnNPCValue(ModContent.NPCType())); // Materials itemLoot.Add(ModContent.ItemType(), 1, 30, 35); diff --git a/Items/TreasureBags/HiveMindBag.cs b/Items/TreasureBags/HiveMindBag.cs index 60d17ac7b3..9a8f86fb84 100644 --- a/Items/TreasureBags/HiveMindBag.cs +++ b/Items/TreasureBags/HiveMindBag.cs @@ -24,28 +24,28 @@ namespace CalamityMod.Items.TreasureBags public override void SetStaticDefaults() { Item.ResearchUnlockCount = 3; - ItemID.Sets.BossBag[Item.type] = true; + ItemID.Sets.BossBag[Item.type] = true; ItemID.Sets.PreHardmodeLikeBossBag[Item.type] = true; } public override void SetDefaults() { - Item.maxStack = 9999; - Item.consumable = true; Item.width = 24; Item.height = 24; + Item.maxStack = 9999; + Item.consumable = true; Item.rare = ItemRarityID.Cyan; Item.expert = true; } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossBags; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossBags; + } public override bool CanRightClick() => true; - public override Color? GetAlpha(Color lightColor) => Color.Lerp(lightColor, Color.White, 0.4f); + public override Color? GetAlpha(Color lightColor) => Color.Lerp(lightColor, Color.White, 0.4f); public override void PostUpdate() => Item.TreasureBagLightAndDust(); @@ -56,8 +56,8 @@ namespace CalamityMod.Items.TreasureBags public override void ModifyItemLoot(ItemLoot itemLoot) { - // Money - itemLoot.Add(ItemDropRule.CoinsBasedOnNPCValue(ModContent.NPCType())); + // Money + itemLoot.Add(ItemDropRule.CoinsBasedOnNPCValue(ModContent.NPCType())); // Materials itemLoot.Add(ModContent.ItemType(), 1, 30, 40); diff --git a/Items/TreasureBags/LeviathanBag.cs b/Items/TreasureBags/LeviathanBag.cs index 114c6c2e91..a772eed178 100644 --- a/Items/TreasureBags/LeviathanBag.cs +++ b/Items/TreasureBags/LeviathanBag.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Accessories; using CalamityMod.Items.Armor.Vanity; using CalamityMod.Items.Placeables.Furniture.DevPaintings; +using CalamityMod.Items.Placeables.Furniture.Monoliths; using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; @@ -22,33 +23,33 @@ namespace CalamityMod.Items.TreasureBags public override void SetStaticDefaults() { Item.ResearchUnlockCount = 3; - ItemID.Sets.BossBag[Item.type] = true; + ItemID.Sets.BossBag[Item.type] = true; } public override void SetDefaults() { - Item.maxStack = 9999; - Item.consumable = true; Item.width = 24; Item.height = 24; + Item.maxStack = 9999; + Item.consumable = true; Item.rare = ItemRarityID.Cyan; Item.expert = true; } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossBags; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossBags; + } public override bool CanRightClick() => true; - public override Color? GetAlpha(Color lightColor) => Color.Lerp(lightColor, Color.White, 0.4f); + public override Color? GetAlpha(Color lightColor) => Color.Lerp(lightColor, Color.White, 0.4f); public override void PostUpdate() - { - CalamityUtils.ForceItemIntoWorld(Item); - Item.TreasureBagLightAndDust(); - } + { + CalamityUtils.ForceItemIntoWorld(Item); + Item.TreasureBagLightAndDust(); + } public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) { @@ -57,8 +58,8 @@ namespace CalamityMod.Items.TreasureBags public override void ModifyItemLoot(ItemLoot itemLoot) { - // Money - itemLoot.Add(ItemDropRule.CoinsBasedOnNPCValue(ModContent.NPCType())); + // Money + itemLoot.Add(ItemDropRule.CoinsBasedOnNPCValue(ModContent.NPCType())); // Weapons itemLoot.Add(DropHelper.CalamityStyle(DropHelper.BagWeaponDropRateFraction, new int[] @@ -81,6 +82,7 @@ namespace CalamityMod.Items.TreasureBags // Vanity itemLoot.Add(ModContent.ItemType(), 7); itemLoot.Add(ModContent.ItemType(), 7); + itemLoot.Add(ModContent.ItemType(), 15); itemLoot.Add(ModContent.ItemType(), ThankYouPainting.DropInt); } } diff --git a/Items/TreasureBags/MiscGrabBags/AbyssalTreasure.cs b/Items/TreasureBags/MiscGrabBags/AbyssalTreasure.cs index 8d48e3959a..f18d53077b 100644 --- a/Items/TreasureBags/MiscGrabBags/AbyssalTreasure.cs +++ b/Items/TreasureBags/MiscGrabBags/AbyssalTreasure.cs @@ -37,17 +37,17 @@ namespace CalamityMod.Items.TreasureBags.MiscGrabBags public override void SetDefaults() { - Item.maxStack = 9999; - Item.consumable = true; Item.width = 24; Item.height = 24; + Item.maxStack = 9999; + Item.consumable = true; Item.rare = ItemRarityID.Blue; //Blue for thematics } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { itemGroup = ContentSamples.CreativeHelper.ItemGroup.GoodieBags; - } + } public override bool CanRightClick() => true; diff --git a/Items/TreasureBags/MiscGrabBags/BleachedAnglingKit.cs b/Items/TreasureBags/MiscGrabBags/BleachedAnglingKit.cs index b9217b7821..a19f07bdda 100644 --- a/Items/TreasureBags/MiscGrabBags/BleachedAnglingKit.cs +++ b/Items/TreasureBags/MiscGrabBags/BleachedAnglingKit.cs @@ -10,23 +10,23 @@ namespace CalamityMod.Items.TreasureBags.MiscGrabBags public new string LocalizationCategory => "Items.TreasureBags"; public override void SetStaticDefaults() { - Item.ResearchUnlockCount = 10; + Item.ResearchUnlockCount = 10; ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); } public override void SetDefaults() { - Item.maxStack = 9999; - Item.consumable = true; Item.width = 24; Item.height = 24; + Item.maxStack = 9999; + Item.consumable = true; Item.rare = ItemRarityID.Pink; } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.GoodieBags; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.GoodieBags; + } public override bool CanRightClick() => true; diff --git a/Items/TreasureBags/MiscGrabBags/FleshyGeode.cs b/Items/TreasureBags/MiscGrabBags/FleshyGeode.cs index d63f8e7022..786b8c9f05 100644 --- a/Items/TreasureBags/MiscGrabBags/FleshyGeode.cs +++ b/Items/TreasureBags/MiscGrabBags/FleshyGeode.cs @@ -17,17 +17,17 @@ namespace CalamityMod.Items.TreasureBags.MiscGrabBags public override void SetDefaults() { - Item.maxStack = 9999; - Item.consumable = true; Item.width = 24; Item.height = 24; + Item.maxStack = 9999; + Item.consumable = true; Item.rare = ItemRarityID.Yellow; } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.GoodieBags; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.GoodieBags; + } public override bool CanRightClick() => true; diff --git a/Items/TreasureBags/MiscGrabBags/NecromanticGeode.cs b/Items/TreasureBags/MiscGrabBags/NecromanticGeode.cs index 8b414fbac6..c1fd5b146b 100644 --- a/Items/TreasureBags/MiscGrabBags/NecromanticGeode.cs +++ b/Items/TreasureBags/MiscGrabBags/NecromanticGeode.cs @@ -14,21 +14,22 @@ namespace CalamityMod.Items.TreasureBags.MiscGrabBags public override void SetStaticDefaults() { Item.ResearchUnlockCount = 10; + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); } public override void SetDefaults() { - Item.maxStack = 9999; - Item.consumable = true; Item.width = 24; Item.height = 24; + Item.maxStack = 9999; + Item.consumable = true; Item.rare = ModContent.RarityType(); } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.GoodieBags; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.GoodieBags; + } public override bool CanRightClick() => true; diff --git a/Items/TreasureBags/MiscGrabBags/SandyAnglingKit.cs b/Items/TreasureBags/MiscGrabBags/SandyAnglingKit.cs index ae8bf5b562..25dfb959cf 100644 --- a/Items/TreasureBags/MiscGrabBags/SandyAnglingKit.cs +++ b/Items/TreasureBags/MiscGrabBags/SandyAnglingKit.cs @@ -1,6 +1,6 @@ using Terraria; -using Terraria.ID; using Terraria.GameContent.ItemDropRules; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.TreasureBags.MiscGrabBags @@ -16,17 +16,17 @@ namespace CalamityMod.Items.TreasureBags.MiscGrabBags public override void SetDefaults() { - Item.maxStack = 9999; - Item.consumable = true; Item.width = 24; Item.height = 24; + Item.maxStack = 9999; + Item.consumable = true; Item.rare = ItemRarityID.Blue; } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.GoodieBags; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.GoodieBags; + } public override bool CanRightClick() => true; diff --git a/Items/TreasureBags/MiscGrabBags/StarterBag.cs b/Items/TreasureBags/MiscGrabBags/StarterBag.cs index f892d27066..54fe68cbde 100644 --- a/Items/TreasureBags/MiscGrabBags/StarterBag.cs +++ b/Items/TreasureBags/MiscGrabBags/StarterBag.cs @@ -20,9 +20,9 @@ namespace CalamityMod.Items.TreasureBags.MiscGrabBags public override void SetDefaults() { - Item.consumable = true; Item.width = 24; Item.height = 24; + Item.consumable = true; Item.rare = ItemRarityID.Blue; } @@ -89,7 +89,7 @@ namespace CalamityMod.Items.TreasureBags.MiscGrabBags return playerName == "Heart Plus Up"; }; itemLoot.AddIf(getsHapuFruit, ModContent.ItemType()); - + // Apelusa dev item // Name specific: "Pelusa" static bool getsRedBow(DropAttemptInfo info) @@ -99,7 +99,7 @@ namespace CalamityMod.Items.TreasureBags.MiscGrabBags } itemLoot.AddIf(getsRedBow, ModContent.ItemType()); - + // Mishiro dev vanity // Name specific: "Amber" or "Mishiro" static bool getsOracleHeadphones(DropAttemptInfo info) @@ -119,6 +119,16 @@ namespace CalamityMod.Items.TreasureBags.MiscGrabBags } itemLoot.AddIf(getsSakuraFeather, ModContent.ItemType()); + + // Fabsol dev item + // Name specific: "Fabsol" or "Cirrus" + static bool getsCrystalHeartVodka(DropAttemptInfo info) + { + string playerName = info.player.name; + return playerName is "Fabsol" or "Cirrus"; + } + + itemLoot.AddIf(getsCrystalHeartVodka, ModContent.ItemType()); } } } diff --git a/Items/TreasureBags/MiscGrabBags/SulphuricTreasure.cs b/Items/TreasureBags/MiscGrabBags/SulphuricTreasure.cs index 4b2c5177f3..5bf5ae2529 100644 --- a/Items/TreasureBags/MiscGrabBags/SulphuricTreasure.cs +++ b/Items/TreasureBags/MiscGrabBags/SulphuricTreasure.cs @@ -35,17 +35,17 @@ namespace CalamityMod.Items.TreasureBags.MiscGrabBags public override void SetDefaults() { - Item.maxStack = 9999; - Item.consumable = true; Item.width = 24; Item.height = 24; + Item.maxStack = 9999; + Item.consumable = true; Item.rare = ItemRarityID.Green; //Green for thematics } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { itemGroup = ContentSamples.CreativeHelper.ItemGroup.GoodieBags; - } + } public override bool CanRightClick() => true; diff --git a/Items/TreasureBags/OldDukeBag.cs b/Items/TreasureBags/OldDukeBag.cs index d391163214..14c7d1e91d 100644 --- a/Items/TreasureBags/OldDukeBag.cs +++ b/Items/TreasureBags/OldDukeBag.cs @@ -22,33 +22,33 @@ namespace CalamityMod.Items.TreasureBags public override void SetStaticDefaults() { Item.ResearchUnlockCount = 3; - ItemID.Sets.BossBag[Item.type] = true; + ItemID.Sets.BossBag[Item.type] = true; } public override void SetDefaults() { - Item.maxStack = 9999; - Item.consumable = true; Item.width = 24; Item.height = 24; + Item.maxStack = 9999; + Item.consumable = true; Item.expert = true; Item.rare = ItemRarityID.Red; } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossBags; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossBags; + } public override bool CanRightClick() => true; - public override Color? GetAlpha(Color lightColor) => Color.Lerp(lightColor, Color.White, 0.4f); + public override Color? GetAlpha(Color lightColor) => Color.Lerp(lightColor, Color.White, 0.4f); public override void PostUpdate() - { - CalamityUtils.ForceItemIntoWorld(Item); - Item.TreasureBagLightAndDust(); - } + { + CalamityUtils.ForceItemIntoWorld(Item); + Item.TreasureBagLightAndDust(); + } public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) { @@ -57,8 +57,8 @@ namespace CalamityMod.Items.TreasureBags public override void ModifyItemLoot(ItemLoot itemLoot) { - // Money - itemLoot.Add(ItemDropRule.CoinsBasedOnNPCValue(ModContent.NPCType())); + // Money + itemLoot.Add(ItemDropRule.CoinsBasedOnNPCValue(ModContent.NPCType())); // Weapons itemLoot.Add(DropHelper.CalamityStyle(DropHelper.BagWeaponDropRateFraction, new int[] diff --git a/Items/TreasureBags/PerforatorBag.cs b/Items/TreasureBags/PerforatorBag.cs index e227cb4e02..230ebe44c3 100644 --- a/Items/TreasureBags/PerforatorBag.cs +++ b/Items/TreasureBags/PerforatorBag.cs @@ -24,28 +24,28 @@ namespace CalamityMod.Items.TreasureBags public override void SetStaticDefaults() { Item.ResearchUnlockCount = 3; - ItemID.Sets.BossBag[Item.type] = true; + ItemID.Sets.BossBag[Item.type] = true; ItemID.Sets.PreHardmodeLikeBossBag[Item.type] = true; } public override void SetDefaults() { - Item.maxStack = 9999; - Item.consumable = true; Item.width = 24; Item.height = 24; + Item.maxStack = 9999; + Item.consumable = true; Item.rare = ItemRarityID.Cyan; Item.expert = true; } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossBags; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossBags; + } public override bool CanRightClick() => true; - public override Color? GetAlpha(Color lightColor) => Color.Lerp(lightColor, Color.White, 0.4f); + public override Color? GetAlpha(Color lightColor) => Color.Lerp(lightColor, Color.White, 0.4f); public override void PostUpdate() => Item.TreasureBagLightAndDust(); @@ -56,8 +56,8 @@ namespace CalamityMod.Items.TreasureBags public override void ModifyItemLoot(ItemLoot itemLoot) { - // Money - itemLoot.Add(ItemDropRule.CoinsBasedOnNPCValue(ModContent.NPCType())); + // Money + itemLoot.Add(ItemDropRule.CoinsBasedOnNPCValue(ModContent.NPCType())); // Materials itemLoot.Add(ModContent.ItemType(), 1, 30, 40); diff --git a/Items/TreasureBags/PlaguebringerGoliathBag.cs b/Items/TreasureBags/PlaguebringerGoliathBag.cs index 777d0932f2..9b81666b96 100644 --- a/Items/TreasureBags/PlaguebringerGoliathBag.cs +++ b/Items/TreasureBags/PlaguebringerGoliathBag.cs @@ -24,27 +24,27 @@ namespace CalamityMod.Items.TreasureBags public override void SetStaticDefaults() { Item.ResearchUnlockCount = 3; - ItemID.Sets.BossBag[Item.type] = true; + ItemID.Sets.BossBag[Item.type] = true; } public override void SetDefaults() { - Item.maxStack = 9999; - Item.consumable = true; Item.width = 24; Item.height = 24; + Item.maxStack = 9999; + Item.consumable = true; Item.rare = ItemRarityID.Cyan; Item.expert = true; } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossBags; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossBags; + } public override bool CanRightClick() => true; - public override Color? GetAlpha(Color lightColor) => Color.Lerp(lightColor, Color.White, 0.4f); + public override Color? GetAlpha(Color lightColor) => Color.Lerp(lightColor, Color.White, 0.4f); public override void PostUpdate() => Item.TreasureBagLightAndDust(); @@ -55,8 +55,8 @@ namespace CalamityMod.Items.TreasureBags public override void ModifyItemLoot(ItemLoot itemLoot) { - // Money - itemLoot.Add(ItemDropRule.CoinsBasedOnNPCValue(ModContent.NPCType())); + // Money + itemLoot.Add(ItemDropRule.CoinsBasedOnNPCValue(ModContent.NPCType())); // Materials itemLoot.Add(ModContent.ItemType(), 1, 25, 30); diff --git a/Items/TreasureBags/PolterghastBag.cs b/Items/TreasureBags/PolterghastBag.cs index c8dc0e1ae3..f1516c5f3c 100644 --- a/Items/TreasureBags/PolterghastBag.cs +++ b/Items/TreasureBags/PolterghastBag.cs @@ -25,27 +25,27 @@ namespace CalamityMod.Items.TreasureBags public override void SetStaticDefaults() { Item.ResearchUnlockCount = 3; - ItemID.Sets.BossBag[Item.type] = true; + ItemID.Sets.BossBag[Item.type] = true; } public override void SetDefaults() { - Item.maxStack = 9999; - Item.consumable = true; Item.width = 32; Item.height = 34; + Item.maxStack = 9999; + Item.consumable = true; Item.rare = ItemRarityID.Cyan; Item.expert = true; } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossBags; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossBags; + } public override bool CanRightClick() => true; - public override Color? GetAlpha(Color lightColor) => Color.Lerp(lightColor, Color.White, 0.4f); + public override Color? GetAlpha(Color lightColor) => Color.Lerp(lightColor, Color.White, 0.4f); public override void PostUpdate() => Item.TreasureBagLightAndDust(); @@ -61,12 +61,12 @@ namespace CalamityMod.Items.TreasureBags public override void ModifyItemLoot(ItemLoot itemLoot) { - // Money - itemLoot.Add(ItemDropRule.CoinsBasedOnNPCValue(ModContent.NPCType())); + // Money + itemLoot.Add(ItemDropRule.CoinsBasedOnNPCValue(ModContent.NPCType())); // Materials itemLoot.Add(ModContent.ItemType(), 1, 10, 20); - itemLoot.Add(ModContent.ItemType(), 1, 40, 50); + itemLoot.Add(ModContent.ItemType(), 1, 40, 50); // Weapons itemLoot.Add(DropHelper.CalamityStyle(DropHelper.BagWeaponDropRateFraction, new int[] diff --git a/Items/TreasureBags/ProvidenceBag.cs b/Items/TreasureBags/ProvidenceBag.cs index b785a95a90..4feb1ba07a 100644 --- a/Items/TreasureBags/ProvidenceBag.cs +++ b/Items/TreasureBags/ProvidenceBag.cs @@ -23,27 +23,27 @@ namespace CalamityMod.Items.TreasureBags public override void SetStaticDefaults() { Item.ResearchUnlockCount = 3; - ItemID.Sets.BossBag[Item.type] = true; + ItemID.Sets.BossBag[Item.type] = true; } public override void SetDefaults() { - Item.maxStack = 9999; - Item.consumable = true; Item.width = 24; Item.height = 24; + Item.maxStack = 9999; + Item.consumable = true; Item.rare = ItemRarityID.Cyan; Item.expert = true; } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossBags; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossBags; + } public override bool CanRightClick() => true; - public override Color? GetAlpha(Color lightColor) => Color.Lerp(lightColor, Color.White, 0.4f); + public override Color? GetAlpha(Color lightColor) => Color.Lerp(lightColor, Color.White, 0.4f); public override void PostUpdate() => Item.TreasureBagLightAndDust(); @@ -54,8 +54,8 @@ namespace CalamityMod.Items.TreasureBags public override void ModifyItemLoot(ItemLoot itemLoot) { - // Money - itemLoot.Add(ItemDropRule.CoinsBasedOnNPCValue(ModContent.NPCType())); + // Money + itemLoot.Add(ItemDropRule.CoinsBasedOnNPCValue(ModContent.NPCType())); // Materials itemLoot.Add(ModContent.ItemType(), 1, 25, 35); @@ -65,7 +65,7 @@ namespace CalamityMod.Items.TreasureBags itemLoot.Add(DropHelper.CalamityStyle(DropHelper.BagWeaponDropRateFraction, new int[] { ModContent.ItemType(), - ModContent.ItemType(), + ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), diff --git a/Items/TreasureBags/RavagerBag.cs b/Items/TreasureBags/RavagerBag.cs index 1f0752212c..909b7ac934 100644 --- a/Items/TreasureBags/RavagerBag.cs +++ b/Items/TreasureBags/RavagerBag.cs @@ -25,27 +25,27 @@ namespace CalamityMod.Items.TreasureBags public override void SetStaticDefaults() { Item.ResearchUnlockCount = 3; - ItemID.Sets.BossBag[Item.type] = true; + ItemID.Sets.BossBag[Item.type] = true; } public override void SetDefaults() { - Item.maxStack = 9999; - Item.consumable = true; Item.width = 24; Item.height = 24; + Item.maxStack = 9999; + Item.consumable = true; Item.expert = true; Item.rare = ItemRarityID.Cyan; } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossBags; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossBags; + } public override bool CanRightClick() => true; - public override Color? GetAlpha(Color lightColor) => Color.Lerp(lightColor, Color.White, 0.4f); + public override Color? GetAlpha(Color lightColor) => Color.Lerp(lightColor, Color.White, 0.4f); public override void PostUpdate() => Item.TreasureBagLightAndDust(); @@ -56,8 +56,8 @@ namespace CalamityMod.Items.TreasureBags public override void ModifyItemLoot(ItemLoot itemLoot) { - // Money - itemLoot.Add(ItemDropRule.CoinsBasedOnNPCValue(ModContent.NPCType())); + // Money + itemLoot.Add(ItemDropRule.CoinsBasedOnNPCValue(ModContent.NPCType())); // Materials (contained in Geodes to prevent overwhelming item floods) itemLoot.AddIf(() => !DownedBossSystem.downedProvidence, ModContent.ItemType()); diff --git a/Items/TreasureBags/SignusBag.cs b/Items/TreasureBags/SignusBag.cs index 205945f7ce..32d248e425 100644 --- a/Items/TreasureBags/SignusBag.cs +++ b/Items/TreasureBags/SignusBag.cs @@ -20,27 +20,27 @@ namespace CalamityMod.Items.TreasureBags public override void SetStaticDefaults() { Item.ResearchUnlockCount = 3; - ItemID.Sets.BossBag[Item.type] = true; + ItemID.Sets.BossBag[Item.type] = true; } public override void SetDefaults() { - Item.maxStack = 9999; - Item.consumable = true; Item.width = 24; Item.height = 24; + Item.maxStack = 9999; + Item.consumable = true; Item.rare = ItemRarityID.Cyan; Item.expert = true; } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossBags; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossBags; + } public override bool CanRightClick() => true; - public override Color? GetAlpha(Color lightColor) => Color.Lerp(lightColor, Color.White, 0.4f); + public override Color? GetAlpha(Color lightColor) => Color.Lerp(lightColor, Color.White, 0.4f); public override void PostUpdate() => Item.TreasureBagLightAndDust(); @@ -51,8 +51,8 @@ namespace CalamityMod.Items.TreasureBags public override void ModifyItemLoot(ItemLoot itemLoot) { - // Money - itemLoot.Add(ItemDropRule.CoinsBasedOnNPCValue(ModContent.NPCType())); + // Money + itemLoot.Add(ItemDropRule.CoinsBasedOnNPCValue(ModContent.NPCType())); // Materials itemLoot.Add(ModContent.ItemType(), 1, 6, 9); diff --git a/Items/TreasureBags/SlimeGodBag.cs b/Items/TreasureBags/SlimeGodBag.cs index ba255dbfdc..d14f85068d 100644 --- a/Items/TreasureBags/SlimeGodBag.cs +++ b/Items/TreasureBags/SlimeGodBag.cs @@ -23,28 +23,28 @@ namespace CalamityMod.Items.TreasureBags public override void SetStaticDefaults() { Item.ResearchUnlockCount = 3; - ItemID.Sets.BossBag[Item.type] = true; + ItemID.Sets.BossBag[Item.type] = true; ItemID.Sets.PreHardmodeLikeBossBag[Item.type] = true; } public override void SetDefaults() { - Item.maxStack = 9999; - Item.consumable = true; Item.width = 24; Item.height = 24; + Item.maxStack = 9999; + Item.consumable = true; Item.rare = ItemRarityID.Cyan; Item.expert = true; } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossBags; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossBags; + } public override bool CanRightClick() => true; - public override Color? GetAlpha(Color lightColor) => Color.Lerp(lightColor, Color.White, 0.4f); + public override Color? GetAlpha(Color lightColor) => Color.Lerp(lightColor, Color.White, 0.4f); public override void PostUpdate() => Item.TreasureBagLightAndDust(); @@ -55,8 +55,8 @@ namespace CalamityMod.Items.TreasureBags public override void ModifyItemLoot(ItemLoot itemLoot) { - // Money - itemLoot.Add(ItemDropRule.CoinsBasedOnNPCValue(ModContent.NPCType())); + // Money + itemLoot.Add(ItemDropRule.CoinsBasedOnNPCValue(ModContent.NPCType())); // Materials // No Gel is dropped here because the boss drops Gel directly diff --git a/Items/TreasureBags/StormWeaverBag.cs b/Items/TreasureBags/StormWeaverBag.cs index 99a1a91835..aa7d570dcb 100644 --- a/Items/TreasureBags/StormWeaverBag.cs +++ b/Items/TreasureBags/StormWeaverBag.cs @@ -20,27 +20,27 @@ namespace CalamityMod.Items.TreasureBags public override void SetStaticDefaults() { Item.ResearchUnlockCount = 3; - ItemID.Sets.BossBag[Item.type] = true; + ItemID.Sets.BossBag[Item.type] = true; } public override void SetDefaults() { - Item.maxStack = 9999; - Item.consumable = true; Item.width = 24; Item.height = 24; + Item.maxStack = 9999; + Item.consumable = true; Item.rare = ItemRarityID.Cyan; Item.expert = true; } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossBags; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossBags; + } public override bool CanRightClick() => true; - public override Color? GetAlpha(Color lightColor) => Color.Lerp(lightColor, Color.White, 0.4f); + public override Color? GetAlpha(Color lightColor) => Color.Lerp(lightColor, Color.White, 0.4f); public override void PostUpdate() => Item.TreasureBagLightAndDust(); @@ -51,8 +51,8 @@ namespace CalamityMod.Items.TreasureBags public override void ModifyItemLoot(ItemLoot itemLoot) { - // Money - itemLoot.Add(ItemDropRule.CoinsBasedOnNPCValue(ModContent.NPCType())); + // Money + itemLoot.Add(ItemDropRule.CoinsBasedOnNPCValue(ModContent.NPCType())); // Materials itemLoot.Add(ModContent.ItemType(), 1, 6, 9); diff --git a/Items/TreasureBags/YharonBag.cs b/Items/TreasureBags/YharonBag.cs index 48b749aea2..e56cc657c5 100644 --- a/Items/TreasureBags/YharonBag.cs +++ b/Items/TreasureBags/YharonBag.cs @@ -31,10 +31,10 @@ namespace CalamityMod.Items.TreasureBags public override void SetDefaults() { - Item.maxStack = 9999; - Item.consumable = true; Item.width = 24; Item.height = 24; + Item.maxStack = 9999; + Item.consumable = true; Item.rare = ItemRarityID.Cyan; Item.expert = true; } @@ -72,7 +72,7 @@ namespace CalamityMod.Items.TreasureBags ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType(), + ModContent.ItemType(), ModContent.ItemType(), })); itemLoot.Add(ModContent.ItemType(), 10); diff --git a/Items/VanillaArmorChanges/AdamantiteArmorSetChange.cs b/Items/VanillaArmorChanges/AdamantiteArmorSetChange.cs index 206ba17b4e..97b89059ef 100644 --- a/Items/VanillaArmorChanges/AdamantiteArmorSetChange.cs +++ b/Items/VanillaArmorChanges/AdamantiteArmorSetChange.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Items.VanillaArmorChanges { setBonusText = CalamityUtils.GetTextValue($"Vanilla.Armor.SetBonus.{ArmorSetName}.Melee"); } - + setBonusText += $"\n{CalamityUtils.GetText($"Vanilla.Armor.SetBonus.{ArmorSetName}").Format(DefenseBoostMax)}"; } diff --git a/Items/VanillaArmorChanges/ChlorophyteArmorSetChange.cs b/Items/VanillaArmorChanges/ChlorophyteArmorSetChange.cs index 6748ee267d..478e6ceca6 100644 --- a/Items/VanillaArmorChanges/ChlorophyteArmorSetChange.cs +++ b/Items/VanillaArmorChanges/ChlorophyteArmorSetChange.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.VanillaArmorChanges public override string ArmorSetName => "Chlorophyte"; - public const int AmountToHealPerPulse = 10; + public const int AmountToHealPerPulse = 5; public const int PulseReleaseRate = 300; diff --git a/Items/VanillaArmorChanges/CobaltArmorSetChange.cs b/Items/VanillaArmorChanges/CobaltArmorSetChange.cs index 738392cb4e..d8cd7c5c0f 100644 --- a/Items/VanillaArmorChanges/CobaltArmorSetChange.cs +++ b/Items/VanillaArmorChanges/CobaltArmorSetChange.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Items.VanillaArmorChanges { setBonusText = CalamityUtils.GetTextValue($"Vanilla.Armor.SetBonus.{ArmorSetName}.Melee"); } - + setBonusText += $"\n{CalamityUtils.GetText($"Vanilla.Armor.SetBonus.{ArmorSetName}").Format(SpeedBoostSetBonusPercentage)}"; } diff --git a/Items/VanillaArmorChanges/CrimsonArmorSetChange.cs b/Items/VanillaArmorChanges/CrimsonArmorSetChange.cs index 6a109faa4b..c8314dbaac 100644 --- a/Items/VanillaArmorChanges/CrimsonArmorSetChange.cs +++ b/Items/VanillaArmorChanges/CrimsonArmorSetChange.cs @@ -17,6 +17,13 @@ namespace CalamityMod.Items.VanillaArmorChanges public const float ArmorPieceDamage = 0.05f; public const int ArmorPieceLifeRegen = 1; + // Set bonus clarification + public override void UpdateSetBonusText(ref string setBonusText) + { + Player player = Main.LocalPlayer; + setBonusText = $"{CalamityUtils.GetTextValue($"Vanilla.Armor.SetBonus.{ArmorSetName}")}"; + } + private void ApplyAnyPieceEffect(Player player) { // Remove the vanilla +3% damage and add the new damage value at the same time @@ -31,7 +38,5 @@ namespace CalamityMod.Items.VanillaArmorChanges public override void ApplyBodyPieceEffect(Player player) => ApplyAnyPieceEffect(player); public override void ApplyLegPieceEffect(Player player) => ApplyAnyPieceEffect(player); - - // No changes to the set bonus } } diff --git a/Items/VanillaArmorChanges/FrostArmorSetChange.cs b/Items/VanillaArmorChanges/FrostArmorSetChange.cs index c3a71e8264..3466dba90e 100644 --- a/Items/VanillaArmorChanges/FrostArmorSetChange.cs +++ b/Items/VanillaArmorChanges/FrostArmorSetChange.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.VanillaArmorChanges public const float MaxDistance = 800f; public override void UpdateSetBonusText(ref string setBonusText) - { + { int PercentBoost = (int)Math.Round(ProximityBoost * 100); setBonusText = $"{CalamityUtils.GetText($"Vanilla.Armor.SetBonus.{ArmorSetName}").Format(PercentBoost)}"; } diff --git a/Items/VanillaArmorChanges/GoldArmorSetChange.cs b/Items/VanillaArmorChanges/GoldArmorSetChange.cs index d77ca4fd66..1cd9c38894 100644 --- a/Items/VanillaArmorChanges/GoldArmorSetChange.cs +++ b/Items/VanillaArmorChanges/GoldArmorSetChange.cs @@ -1,4 +1,4 @@ -using System.Text; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -20,9 +20,10 @@ namespace CalamityMod.Items.VanillaArmorChanges public const float HeadDamage = 0.06f; public const float ChestDR = 0.05f; public const float LegsMoveSpeed = 0.1f; - public const float GoldDropChanceFromEnemies = 0.04f; + public const float GoldDropChanceFromEnemies = 0.02f; public const int GoldFromBosses = 3; - public const float SetBonusCritPerGoldCoin = 0.2f; // 5 gold coins = +1% crit chance + public const float SetBonusCritPerGoldCoin = 0.1f; // 10 gold coins = +1% crit chance + public const float MaximumCritBonus = 9f; public override void ApplyHeadPieceEffect(Player player) => player.GetDamage() += HeadDamage; @@ -43,11 +44,13 @@ namespace CalamityMod.Items.VanillaArmorChanges // Give the crit chance from gold in inventory. // If you have any platinum, this guarantees the max boost. if (player.InventoryHas(ItemID.PlatinumCoin)) - critFromGold = 10f; + critFromGold = MaximumCritBonus; else { - int goldCoins = player.CountItem(ItemID.GoldCoin, 50); - critFromGold = goldCoins * SetBonusCritPerGoldCoin; + // 13FEB2024: Ozzatron: this function doesn't cap at its second argument, it just stops counting if it exceeds that number + // so this can give up to 100 gold coins + int goldCoins = player.CountItem(ItemID.GoldCoin, 90); + critFromGold = Math.Min(goldCoins * SetBonusCritPerGoldCoin, MaximumCritBonus); } player.GetCritChance() += critFromGold; diff --git a/Items/VanillaArmorChanges/JungleArmorSetChange.cs b/Items/VanillaArmorChanges/JungleArmorSetChange.cs new file mode 100644 index 0000000000..b37c7ea327 --- /dev/null +++ b/Items/VanillaArmorChanges/JungleArmorSetChange.cs @@ -0,0 +1,39 @@ +using System.Text; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.VanillaArmorChanges +{ + public class JungleArmorSetChange : VanillaArmorChange + { + public override int? HeadPieceID => ItemID.JungleHat; + + public override int? BodyPieceID => ItemID.JungleShirt; + + public override int? LegPieceID => ItemID.JunglePants; + + public override int[] AlternativeHeadPieceIDs => new int[] { ItemID.AncientCobaltHelmet }; + + public override int[] AlternativeBodyPieceIDs => new int[] { ItemID.AncientCobaltBreastplate }; + + public override int[] AlternativeLegPieceIDs => new int[] { ItemID.AncientCobaltLeggings }; + + public override string ArmorSetName => "Jungle"; + + public override void UpdateSetBonusText(ref string setBonusText) + { + setBonusText = $"{CalamityUtils.GetTextValue($"Vanilla.Armor.SetBonus.{ArmorSetName}")}"; + } + + public override void ApplyHeadPieceEffect(Player player) + { + player.statManaMax2 -= 20; + player.GetCritChance() -= 3; + } + + public override void ApplyLegPieceEffect(Player player) => player.GetCritChance() -= 3; + + public override void ApplyArmorSetBonus(Player player) => player.manaCost += 0.06f; // Reduces to -10% mana cost + } +} diff --git a/Items/VanillaArmorChanges/LeadArmorSetChange.cs b/Items/VanillaArmorChanges/LeadArmorSetChange.cs index fccf0e14f1..4fc7541f41 100644 --- a/Items/VanillaArmorChanges/LeadArmorSetChange.cs +++ b/Items/VanillaArmorChanges/LeadArmorSetChange.cs @@ -1,5 +1,4 @@ -using System.Text; -using Terraria; +using Terraria; using Terraria.ID; namespace CalamityMod.Items.VanillaArmorChanges @@ -14,8 +13,8 @@ namespace CalamityMod.Items.VanillaArmorChanges public override string ArmorSetName => "Lead"; - public const float ArmorPieceDR = 0.03f; - public const float SetBonusDR = 0.03f; + public const float ArmorPieceDR = 0.02f; + public const float SetBonusDR = 0.04f; public const int SetBonusLifeRegen = 1; public override void ApplyHeadPieceEffect(Player player) => player.endurance += ArmorPieceDR; diff --git a/Items/VanillaArmorChanges/MeteorArmorSetChange.cs b/Items/VanillaArmorChanges/MeteorArmorSetChange.cs index 2bc9b5f104..6aeb0b42be 100644 --- a/Items/VanillaArmorChanges/MeteorArmorSetChange.cs +++ b/Items/VanillaArmorChanges/MeteorArmorSetChange.cs @@ -1,5 +1,6 @@ using Terraria; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.VanillaArmorChanges { @@ -13,12 +14,20 @@ namespace CalamityMod.Items.VanillaArmorChanges public override string ArmorSetName => "Meteor"; - // Meteor Armor only makes space gun cost 50% instead of zero mana. public override void UpdateSetBonusText(ref string setBonusText) { setBonusText = $"{CalamityUtils.GetTextValue($"Vanilla.Armor.SetBonus.{ArmorSetName}")}"; } + // Reducing every piece's damage boost from 9% to 8% + private void ApplyAnyPieceEffect(Player player) => player.GetDamage() -= 0.01f; + + public override void ApplyHeadPieceEffect(Player player) => ApplyAnyPieceEffect(player); + + public override void ApplyBodyPieceEffect(Player player) => ApplyAnyPieceEffect(player); + + public override void ApplyLegPieceEffect(Player player) => ApplyAnyPieceEffect(player); + public override void ApplyArmorSetBonus(Player player) { player.Calamity().meteorSet = true; diff --git a/Items/VanillaArmorChanges/MoltenArmorSetChange.cs b/Items/VanillaArmorChanges/MoltenArmorSetChange.cs index f0504d0a97..62dac76d1c 100644 --- a/Items/VanillaArmorChanges/MoltenArmorSetChange.cs +++ b/Items/VanillaArmorChanges/MoltenArmorSetChange.cs @@ -1,5 +1,6 @@ using Terraria; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.VanillaArmorChanges { @@ -13,18 +14,19 @@ namespace CalamityMod.Items.VanillaArmorChanges public override string ArmorSetName => "Molten"; - public const int MiningSpeedPercentSetBonus = 10; - public override void UpdateSetBonusText(ref string setBonusText) { - setBonusText += $"\n{CalamityUtils.GetTextValue($"Vanilla.Armor.SetBonus.{ArmorSetName}")}"; + setBonusText = $"{CalamityUtils.GetTextValue($"Vanilla.Armor.SetBonus.{ArmorSetName}")}"; } public override void ApplyArmorSetBonus(Player player) { + // Nerf the set bonus damage slightly + player.GetDamage() -= 0.03f; + player.fireWalk = true; player.lavaMax += 300; - player.GetDamage() += 0.2f; + player.GetDamage() += 0.1f; } } } diff --git a/Items/VanillaArmorChanges/PlatinumArmorSetChange.cs b/Items/VanillaArmorChanges/PlatinumArmorSetChange.cs index 64a39bf6cb..d709df88d2 100644 --- a/Items/VanillaArmorChanges/PlatinumArmorSetChange.cs +++ b/Items/VanillaArmorChanges/PlatinumArmorSetChange.cs @@ -16,9 +16,8 @@ namespace CalamityMod.Items.VanillaArmorChanges public override string ArmorSetName => "Platinum"; public const float HeadDamage = 0.06f; - public const float ChestCrit = 5f; + public const float ChestCrit = 3f; public const float LegsMoveSpeed = 0.1f; - public const float SetBonusLifeRegenPerDefense = 0.1f; // 10 defense = +1 life regen public const float SetBonusDamagePerDefense = 0.001f; // 10 defense = +1% damage public const float SetBonusCritPerDefense = 0.1f; // 10 defense = +1% crit chance public const int SetBonusDefenseCap = 40; @@ -36,12 +35,15 @@ namespace CalamityMod.Items.VanillaArmorChanges public override void ApplyArmorSetBonus(Player player) { - int defense = player.statDefense; - if (defense > SetBonusDefenseCap) - defense = SetBonusDefenseCap; - player.lifeRegen += (int)(defense * SetBonusLifeRegenPerDefense); - player.GetDamage() += defense * SetBonusDamagePerDefense; - player.GetCritChance() += defense * SetBonusCritPerDefense; + // 07MAY2024: Ozzatron: Platinum armor doesn't count its own defense for its set bonus + int defenseBesidesThisArmor = player.statDefense - (4 + 6 + 4 + 4); + if (defenseBesidesThisArmor <= 0) + return; + + if (defenseBesidesThisArmor > SetBonusDefenseCap) + defenseBesidesThisArmor = SetBonusDefenseCap; + player.GetDamage() += defenseBesidesThisArmor * SetBonusDamagePerDefense; + player.GetCritChance() += defenseBesidesThisArmor * SetBonusCritPerDefense; } } } diff --git a/Items/VanillaArmorChanges/ShadowArmorSetChange.cs b/Items/VanillaArmorChanges/ShadowArmorSetChange.cs index 65a8fe70b1..b046bb9c76 100644 --- a/Items/VanillaArmorChanges/ShadowArmorSetChange.cs +++ b/Items/VanillaArmorChanges/ShadowArmorSetChange.cs @@ -20,12 +20,11 @@ namespace CalamityMod.Items.VanillaArmorChanges public const float ArmorPieceDamage = 0.05f; public const float ArmorPieceJumpBoost = 0.07f; - public const float SetBonusTrueMoveSpeed = 0.15f; private void ApplyAnyPieceEffect(Player player) { // Remove the vanilla crit chance buff and replace it with damage - player.GetCritChance() -= 0.05f; + player.GetCritChance() -= 5; player.GetDamage() += ArmorPieceDamage; // Give jump boost @@ -37,20 +36,5 @@ namespace CalamityMod.Items.VanillaArmorChanges public override void ApplyBodyPieceEffect(Player player) => ApplyAnyPieceEffect(player); public override void ApplyLegPieceEffect(Player player) => ApplyAnyPieceEffect(player); - - public override void UpdateSetBonusText(ref string setBonusText) - { - setBonusText = $"{CalamityUtils.GetTextValue($"Vanilla.Armor.SetBonus.{ArmorSetName}")}"; - } - - public override void ApplyArmorSetBonus(Player player) - { - // Remove the vanilla move speed boost - player.moveSpeed -= 0.15f; - - // Replace it with max move speed and acceleration - player.runAcceleration *= (1f + SetBonusTrueMoveSpeed); - player.maxRunSpeed *= (1f + SetBonusTrueMoveSpeed); - } } } diff --git a/Items/VanillaArmorChanges/SilverArmorSetChange.cs b/Items/VanillaArmorChanges/SilverArmorSetChange.cs index a2c696ced8..9c9bc580e9 100644 --- a/Items/VanillaArmorChanges/SilverArmorSetChange.cs +++ b/Items/VanillaArmorChanges/SilverArmorSetChange.cs @@ -1,5 +1,5 @@ -using Microsoft.Xna.Framework; -using System.Text; +using System.Text; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Items/VanillaArmorChanges/TungstenArmorSetChange.cs b/Items/VanillaArmorChanges/TungstenArmorSetChange.cs index 8ce52b2088..50c4be4121 100644 --- a/Items/VanillaArmorChanges/TungstenArmorSetChange.cs +++ b/Items/VanillaArmorChanges/TungstenArmorSetChange.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.VanillaArmorChanges Player player = Main.LocalPlayer; float kb = player.GetWeaponKnockback(player.ActiveItem()); float bonus = MathHelper.Clamp(kb, 0f, MaxKnockbackCritConversion); - + string bonusText = bonus.ToString("n2"); string kbText = kb.ToString("n2"); setBonusText += $"\n{CalamityUtils.GetText($"Vanilla.Armor.SetBonus.{ArmorSetName}").Format(bonusText, kbText)}"; diff --git a/Items/VanillaArmorChanges/VanillaArmorChange.cs b/Items/VanillaArmorChanges/VanillaArmorChange.cs index 52e756c7b2..7f83242922 100644 --- a/Items/VanillaArmorChanges/VanillaArmorChange.cs +++ b/Items/VanillaArmorChanges/VanillaArmorChange.cs @@ -1,4 +1,4 @@ -using System.Linq; +using System.Linq; using Terraria; using Terraria.ID; diff --git a/Items/VanillaArmorChanges/VanillaArmorChangeManager.cs b/Items/VanillaArmorChanges/VanillaArmorChangeManager.cs index ae22039d7d..fd242a29e5 100644 --- a/Items/VanillaArmorChanges/VanillaArmorChangeManager.cs +++ b/Items/VanillaArmorChanges/VanillaArmorChangeManager.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Runtime.Serialization; using Terraria; using Terraria.ID; +using Terraria.ModLoader.Core; namespace CalamityMod.Items.VanillaArmorChanges { @@ -15,7 +16,8 @@ namespace CalamityMod.Items.VanillaArmorChanges internal static void Load() { ArmorChanges = new List(); - foreach (Type type in CalamityMod.Instance.Code.GetTypes()) + Type[] types = AssemblyManager.GetLoadableTypes(CalamityMod.Instance.Code); + foreach (Type type in types) { if (!type.IsSubclassOf(typeof(VanillaArmorChange)) || type.IsAbstract) continue; diff --git a/Items/VoodooDemonVoodooDoll.cs b/Items/VoodooDemonVoodooDoll.cs index 2be133a986..c098d72199 100644 --- a/Items/VoodooDemonVoodooDoll.cs +++ b/Items/VoodooDemonVoodooDoll.cs @@ -1,18 +1,25 @@ -using Terraria.ID; -using Terraria; +using Terraria; +using Terraria.ID; using Terraria.ModLoader; +using System.Collections.Generic; +using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework; +using static CalamityMod.CalamityUtils; namespace CalamityMod.Items { public class VoodooDemonVoodooDoll : ModItem, ILocalizedModType { + public static bool state = false; public new string LocalizationCategory => "Items.Misc"; + public override void SetDefaults() { Item.width = 44; Item.height = 34; - Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.rare = ItemRarityID.Blue; + Item.consumable = false; } public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) @@ -20,10 +27,69 @@ namespace CalamityMod.Items itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.SpawnPrevention; } - public override void UpdateInventory(Player player) + public override bool CanRightClick() => true; + + public override void RightClick(Player player) { - if (Item.favorited) + if (player.Calamity().disableVoodooSpawns == true) + player.Calamity().disableVoodooSpawns = false; + else player.Calamity().disableVoodooSpawns = true; + Item.NetStateChanged(); + state = player.Calamity().disableVoodooSpawns; + bool favorited = Item.favorited; + Item.SetDefaults(ModContent.ItemType()); + Item.stack++; + Item.favorited = favorited; + } + + /* + public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frameI, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + Texture2D texture; + + if (state) + { + //Replace with enabled texture + texture = ModContent.Request("CalamityMod/Items/VoodooDemonVoodooDoll").Value; + spriteBatch.Draw(texture, position, null, Color.White, 0f, origin, scale, SpriteEffects.None, 0); + } + else + { + texture = ModContent.Request("CalamityMod/Items/VoodooDemonVoodooDoll").Value; + spriteBatch.Draw(texture, position, null, Color.White, 0f, origin, scale, SpriteEffects.None, 0); + } + + return false; + } + + public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) + { + Texture2D texture; + + if (state) + { + //Replace with enabled texture + texture = ModContent.Request("CalamityMod/Items/VoodooDemonVoodooDoll").Value; + spriteBatch.Draw(texture, Item.position - Main.screenPosition, null, lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); + } + else + { + texture = ModContent.Request("CalamityMod/Items/VoodooDemonVoodooDoll").Value; + spriteBatch.Draw(texture, Item.position - Main.screenPosition, null, lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); + } + return false; + } + */ + + public override void ModifyTooltips(List tooltips) + { + string text; + if (state == true) + text = GetTextValue("Items.Misc.SpawnBlockersOn"); + else + text = GetTextValue("Items.Misc.SpawnBlockersOff"); + tooltips.FindAndReplace("[STATE]", text); } public override void AddRecipes() diff --git a/Items/Weapons/DraedonsArsenal/FrequencyManipulator.cs b/Items/Weapons/DraedonsArsenal/FrequencyManipulator.cs index 0f9cd5c43d..12f8741267 100644 --- a/Items/Weapons/DraedonsArsenal/FrequencyManipulator.cs +++ b/Items/Weapons/DraedonsArsenal/FrequencyManipulator.cs @@ -1,10 +1,10 @@ -using CalamityMod.CustomRecipes; +using System; +using System.Collections.Generic; +using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Projectiles.DraedonsArsenal; using Microsoft.Xna.Framework; -using System; -using System.Collections.Generic; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -19,19 +19,19 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal { CalamityGlobalItem modItem = Item.Calamity(); + Item.width = 26; + Item.height = 44; Item.damage = 80; Item.DamageType = RogueDamageClass.Instance; Item.noMelee = true; Item.noUseGraphic = true; - Item.width = 26; - Item.height = 44; Item.useTime = 56; Item.useAnimation = 56; Item.autoReuse = true; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 5f; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item1; diff --git a/Items/Weapons/DraedonsArsenal/GalvanizingGlaive.cs b/Items/Weapons/DraedonsArsenal/GalvanizingGlaive.cs index 01fdbd65e6..ded5c99d03 100644 --- a/Items/Weapons/DraedonsArsenal/GalvanizingGlaive.cs +++ b/Items/Weapons/DraedonsArsenal/GalvanizingGlaive.cs @@ -1,9 +1,9 @@ -using CalamityMod.CustomRecipes; +using System; +using System.Collections.Generic; +using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.DraedonsArsenal; using Microsoft.Xna.Framework; -using System; -using System.Collections.Generic; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -37,7 +37,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.autoReuse = true; Item.rare = ItemRarityID.Yellow; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 21f; diff --git a/Items/Weapons/DraedonsArsenal/GatlingLaser.cs b/Items/Weapons/DraedonsArsenal/GatlingLaser.cs index 39862cc24f..c914d5e12b 100644 --- a/Items/Weapons/DraedonsArsenal/GatlingLaser.cs +++ b/Items/Weapons/DraedonsArsenal/GatlingLaser.cs @@ -1,14 +1,14 @@ -using CalamityMod.CustomRecipes; +using System; +using System.Collections.Generic; +using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.DraedonsArsenal; using Microsoft.Xna.Framework; -using System; -using System.Collections.Generic; using Terraria; +using Terraria.Audio; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Items.Weapons.DraedonsArsenal { @@ -43,7 +43,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.UseSound = FireSound; Item.noMelee = true; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/DraedonsArsenal/GaussDagger.cs b/Items/Weapons/DraedonsArsenal/GaussDagger.cs index 8a5dc65fed..98c8eac524 100644 --- a/Items/Weapons/DraedonsArsenal/GaussDagger.cs +++ b/Items/Weapons/DraedonsArsenal/GaussDagger.cs @@ -1,8 +1,8 @@ -using CalamityMod.Items.Materials; +using System.Collections.Generic; +using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; using CalamityMod.Projectiles.DraedonsArsenal; using Microsoft.Xna.Framework; -using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -12,23 +12,21 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public class GaussDagger : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.DraedonsArsenal"; - public const int HitsRequiredForFlux = 2; public override void SetDefaults() { CalamityGlobalItem modItem = Item.Calamity(); - Item.damage = 25; - Item.DamageType = DamageClass.Melee; Item.width = 26; Item.height = 26; - Item.scale = 1.5f; + Item.damage = 25; + Item.DamageType = DamageClass.Melee; Item.useTime = 24; Item.useAnimation = 24; Item.useStyle = ItemUseStyleID.Swing; Item.useTurn = true; Item.knockBack = 7f; - Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; Item.UseSound = SoundID.Item1; @@ -41,17 +39,11 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void ModifyTooltips(List tooltips) => CalamityGlobalItem.InsertKnowledgeTooltip(tooltips, 1); - public override void ModifyHitNPC(Player player, NPC target, ref NPC.HitModifiers modifiers) - { - modifiers.CritDamage *= 0.5f; - } - public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) { - target.Calamity().GaussFluxTimer += 50; - if (target.Calamity().GaussFluxTimer >= 30 * HitsRequiredForFlux) + if (target.Calamity().GaussFluxTimer == 0) { - target.Calamity().GaussFluxTimer = 0; + target.Calamity().GaussFluxTimer = 50; if (player.whoAmI == Main.myPlayer) { Projectile.NewProjectile(player.GetSource_ItemUse(Item), target.Center, Vector2.Zero, ModContent.ProjectileType(), Item.damage, 0f, player.whoAmI, 0f, target.whoAmI); diff --git a/Items/Weapons/DraedonsArsenal/GaussPistol.cs b/Items/Weapons/DraedonsArsenal/GaussPistol.cs index 2567575875..144e1db7c4 100644 --- a/Items/Weapons/DraedonsArsenal/GaussPistol.cs +++ b/Items/Weapons/DraedonsArsenal/GaussPistol.cs @@ -1,12 +1,12 @@ -using CalamityMod.CustomRecipes; +using System; +using System.Collections.Generic; +using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.DraedonsArsenal; -using System; -using System.Collections.Generic; +using CalamityMod.Sounds; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Sounds; namespace CalamityMod.Items.Weapons.DraedonsArsenal { @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.UseSound = CommonCalamitySounds.GaussWeaponFire; Item.noMelee = true; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/DraedonsArsenal/GaussRifle.cs b/Items/Weapons/DraedonsArsenal/GaussRifle.cs index 3d482648f5..7be5cf7369 100644 --- a/Items/Weapons/DraedonsArsenal/GaussRifle.cs +++ b/Items/Weapons/DraedonsArsenal/GaussRifle.cs @@ -1,10 +1,10 @@ -using CalamityMod.CustomRecipes; +using System; +using System.Collections.Generic; +using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.DraedonsArsenal; using CalamityMod.Sounds; using Microsoft.Xna.Framework; -using System; -using System.Collections.Generic; using Terraria; using Terraria.Audio; using Terraria.DataStructures; @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.UseSound = CommonCalamitySounds.GaussWeaponFire; Item.noMelee = true; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/DraedonsArsenal/HeavyLaserRifle.cs b/Items/Weapons/DraedonsArsenal/HeavyLaserRifle.cs index e4be470a45..01d8c9d04e 100644 --- a/Items/Weapons/DraedonsArsenal/HeavyLaserRifle.cs +++ b/Items/Weapons/DraedonsArsenal/HeavyLaserRifle.cs @@ -1,10 +1,10 @@ -using CalamityMod.CustomRecipes; +using System; +using System.Collections.Generic; +using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.DraedonsArsenal; using CalamityMod.Rarities; using Microsoft.Xna.Framework; -using System; -using System.Collections.Generic; using Terraria; using Terraria.Audio; using Terraria.DataStructures; diff --git a/Items/Weapons/DraedonsArsenal/HydraulicVoltCrasher.cs b/Items/Weapons/DraedonsArsenal/HydraulicVoltCrasher.cs index 2be1839038..6bcc75a4ce 100644 --- a/Items/Weapons/DraedonsArsenal/HydraulicVoltCrasher.cs +++ b/Items/Weapons/DraedonsArsenal/HydraulicVoltCrasher.cs @@ -1,8 +1,8 @@ -using CalamityMod.CustomRecipes; +using System; +using System.Collections.Generic; +using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.DraedonsArsenal; -using System; -using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -14,11 +14,17 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public new string LocalizationCategory => "Items.Weapons.DraedonsArsenal"; // This is the amount of charge consumed every frame the holdout projectile is summoned, i.e. the weapon is in use. public const float HoldoutChargeUse = 0.002f; + public override void SetStaticDefaults() + { + ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; + } public override void SetDefaults() { CalamityGlobalItem modItem = Item.Calamity(); + Item.width = 56; + Item.height = 24; Item.damage = 75; Item.knockBack = 12f; Item.useTime = 4; @@ -27,12 +33,10 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.useStyle = ItemUseStyleID.Shoot; Item.shootSpeed = 46f; - Item.width = 56; - Item.height = 24; Item.UseSound = SoundID.Item23; Item.shoot = ModContent.ProjectileType(); - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.noMelee = true; @@ -44,11 +48,27 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal modItem.MaxCharge = 85f; modItem.ChargePerUse = 0f; // This weapon is a holdout. Charge is consumed by the holdout projectile. } - - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0 && Item.Calamity().Charge > 0; + public override bool AltFunctionUse(Player player) => true; public override void ModifyTooltips(List tooltips) => CalamityGlobalItem.InsertKnowledgeTooltip(tooltips, 2); + public override bool CanUseItem(Player player) + { + if (player.altFunctionUse == 2) + { + Item.hammer = 0; + } + else + { + Item.hammer = 100; + } + return player.ownedProjectileCounts[Item.shoot] <= 0 && Item.Calamity().Charge > 0; + } + public override void HoldItem(Player player) + { + if (Main.myPlayer == player.whoAmI) + player.Calamity().rightClickListener = true; + } public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Weapons/DraedonsArsenal/MatterModulator.cs b/Items/Weapons/DraedonsArsenal/MatterModulator.cs index ad7eaed923..67952028d0 100644 --- a/Items/Weapons/DraedonsArsenal/MatterModulator.cs +++ b/Items/Weapons/DraedonsArsenal/MatterModulator.cs @@ -1,10 +1,10 @@ -using CalamityMod.CustomRecipes; +using System; +using System.Collections.Generic; +using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.DraedonsArsenal; using CalamityMod.Sounds; using Microsoft.Xna.Framework; -using System; -using System.Collections.Generic; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.UseSound = CommonCalamitySounds.PlasmaBoltSound; Item.noMelee = true; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/DraedonsArsenal/MountedScanner.cs b/Items/Weapons/DraedonsArsenal/MountedScanner.cs index 8c274a89b3..526fc38224 100644 --- a/Items/Weapons/DraedonsArsenal/MountedScanner.cs +++ b/Items/Weapons/DraedonsArsenal/MountedScanner.cs @@ -1,9 +1,9 @@ -using CalamityMod.CustomRecipes; +using System; +using System.Collections.Generic; +using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.DraedonsArsenal; using Microsoft.Xna.Framework; -using System; -using System.Collections.Generic; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.width = 26; Item.height = 26; Item.DamageType = DamageClass.Summon; - Item.damage = 41; + Item.damage = 24; Item.knockBack = 2f; Item.mana = 10; Item.useTime = Item.useAnimation = 24; @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.UseSound = SoundID.Item15; Item.noMelee = true; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/DraedonsArsenal/Phaseslayer.cs b/Items/Weapons/DraedonsArsenal/Phaseslayer.cs index d831ccb037..653ce53ecf 100644 --- a/Items/Weapons/DraedonsArsenal/Phaseslayer.cs +++ b/Items/Weapons/DraedonsArsenal/Phaseslayer.cs @@ -1,11 +1,11 @@ -using CalamityMod.CustomRecipes; +using System; +using System.Collections.Generic; +using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.DraedonsArsenal; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; -using System; -using System.Collections.Generic; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -16,7 +16,6 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public class Phaseslayer : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.DraedonsArsenal"; - public const int Damage = 980; // When below this percentage of charge, the sword is small instead of big. public const float SizeChargeThreshold = 0.25f; // The small sword barely affects damage on its own because damage is already dropping significantly at low charge. @@ -30,10 +29,10 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal { CalamityGlobalItem modItem = Item.Calamity(); - Item.damage = Damage; - Item.DamageType = DamageClass.MeleeNoSpeed; Item.width = 26; Item.height = 26; + Item.damage = 980; + Item.DamageType = DamageClass.MeleeNoSpeed; Item.useTime = 24; Item.useAnimation = 24; Item.useStyle = ItemUseStyleID.Shoot; @@ -42,7 +41,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.noUseGraphic = true; - Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item1; diff --git a/Items/Weapons/DraedonsArsenal/PlasmaCaster.cs b/Items/Weapons/DraedonsArsenal/PlasmaCaster.cs index d2c97b9b56..04a8bd9965 100644 --- a/Items/Weapons/DraedonsArsenal/PlasmaCaster.cs +++ b/Items/Weapons/DraedonsArsenal/PlasmaCaster.cs @@ -1,10 +1,10 @@ -using CalamityMod.CustomRecipes; +using System; +using System.Collections.Generic; +using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.DraedonsArsenal; using CalamityMod.Rarities; using Microsoft.Xna.Framework; -using System; -using System.Collections.Generic; using Terraria; using Terraria.Audio; using Terraria.DataStructures; @@ -18,11 +18,9 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal { public new string LocalizationCategory => "Items.Weapons.DraedonsArsenal"; public static readonly SoundStyle FireSound = new("CalamityMod/Sounds/Item/PlasmaCasterFire"); - - public const int BaseDamage = 705; public override void SetStaticDefaults() { - + ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; } @@ -33,7 +31,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.width = 62; Item.height = 30; Item.DamageType = DamageClass.Magic; - Item.damage = BaseDamage; + Item.damage = 705; Item.knockBack = 7f; Item.useTime = 45; Item.useAnimation = 45; diff --git a/Items/Weapons/DraedonsArsenal/PlasmaGrenade.cs b/Items/Weapons/DraedonsArsenal/PlasmaGrenade.cs index a3a0553cea..1a3f98583d 100644 --- a/Items/Weapons/DraedonsArsenal/PlasmaGrenade.cs +++ b/Items/Weapons/DraedonsArsenal/PlasmaGrenade.cs @@ -1,12 +1,12 @@ -using CalamityMod.CustomRecipes; +using System; +using System.Collections.Generic; +using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Projectiles.DraedonsArsenal; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; -using System; -using System.Collections.Generic; using Terraria; using Terraria.Audio; using Terraria.DataStructures; @@ -36,7 +36,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.rare = ModContent.RarityType(); Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/DraedonsArsenal/PoleWarper.cs b/Items/Weapons/DraedonsArsenal/PoleWarper.cs index dede135af4..83a8625855 100644 --- a/Items/Weapons/DraedonsArsenal/PoleWarper.cs +++ b/Items/Weapons/DraedonsArsenal/PoleWarper.cs @@ -1,11 +1,11 @@ -using CalamityMod.CustomRecipes; +using System; +using System.Collections.Generic; +using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.DraedonsArsenal; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; -using System; -using System.Collections.Generic; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -20,17 +20,17 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal { CalamityGlobalItem modItem = Item.Calamity(); + Item.width = 38; + Item.height = 24; Item.shootSpeed = 10f; Item.damage = 310; Item.mana = 12; - Item.width = 38; - Item.height = 24; Item.useTime = Item.useAnimation = 9; Item.useStyle = ItemUseStyleID.HoldUp; Item.noMelee = true; Item.knockBack = 8f; - Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item15; diff --git a/Items/Weapons/DraedonsArsenal/PulseDragon.cs b/Items/Weapons/DraedonsArsenal/PulseDragon.cs index d64b3f0fc4..25fd1376a2 100644 --- a/Items/Weapons/DraedonsArsenal/PulseDragon.cs +++ b/Items/Weapons/DraedonsArsenal/PulseDragon.cs @@ -1,10 +1,10 @@ -using CalamityMod.CustomRecipes; +using System; +using System.Collections.Generic; +using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.DraedonsArsenal; using CalamityMod.Rarities; using Microsoft.Xna.Framework; -using System; -using System.Collections.Generic; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -19,10 +19,10 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal { CalamityGlobalItem modItem = Item.Calamity(); - Item.damage = 300; - Item.DamageType = DamageClass.MeleeNoSpeed; Item.width = 30; Item.height = 10; + Item.damage = 300; + Item.DamageType = DamageClass.MeleeNoSpeed; Item.useTime = 20; Item.useAnimation = 20; Item.useStyle = ItemUseStyleID.Shoot; diff --git a/Items/Weapons/DraedonsArsenal/PulsePistol.cs b/Items/Weapons/DraedonsArsenal/PulsePistol.cs index a9df4834fb..04e2185db0 100644 --- a/Items/Weapons/DraedonsArsenal/PulsePistol.cs +++ b/Items/Weapons/DraedonsArsenal/PulsePistol.cs @@ -1,10 +1,10 @@ -using CalamityMod.CustomRecipes; +using System; +using System.Collections.Generic; +using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; using CalamityMod.Projectiles.DraedonsArsenal; using Microsoft.Xna.Framework; -using System; -using System.Collections.Generic; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -22,9 +22,9 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.width = 62; Item.height = 22; Item.DamageType = DamageClass.Magic; - Item.damage = 26; + Item.damage = 23; Item.knockBack = 0f; - Item.useTime = Item.useAnimation = 20; + Item.useTime = Item.useAnimation = 21; Item.autoReuse = true; Item.mana = 6; @@ -32,10 +32,10 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.UseSound = PulseRifle.FireSound; Item.noMelee = true; - Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; - Item.shoot = ModContent.ProjectileType(); + Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 5.2f; // This may seem low but the shot has 10 extra updates. modItem.UsesCharge = true; diff --git a/Items/Weapons/DraedonsArsenal/PulseRifle.cs b/Items/Weapons/DraedonsArsenal/PulseRifle.cs index d2684920b4..21190b3ab9 100644 --- a/Items/Weapons/DraedonsArsenal/PulseRifle.cs +++ b/Items/Weapons/DraedonsArsenal/PulseRifle.cs @@ -1,11 +1,12 @@ -using CalamityMod.CustomRecipes; +using System; +using System.Collections.Generic; +using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.DraedonsArsenal; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; -using System; -using System.Collections.Generic; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; using Terraria.DataStructures; @@ -17,28 +18,29 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public class PulseRifle : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.DraedonsArsenal"; - public static readonly SoundStyle FireSound = new("CalamityMod/Sounds/Item/PulseRifleFire"); + public static readonly SoundStyle FireSound = new("CalamityMod/Sounds/Item/PulseRifleFire") { Volume = 0.8f }; - private int BaseDamage = 1200; + private int BaseDamage = 990; + public int FiringTimer = 30; public override void SetDefaults() { CalamityGlobalItem modItem = Item.Calamity(); - Item.width = 62; - Item.height = 22; + Item.width = 98; + Item.height = 32; Item.DamageType = DamageClass.Ranged; Item.damage = BaseDamage; Item.knockBack = 0f; - Item.useTime = 35; - Item.useAnimation = 35; + Item.useTime = 55; + Item.useAnimation = 55; Item.autoReuse = true; Item.useStyle = ItemUseStyleID.Shoot; - Item.UseSound = FireSound; + Item.UseSound = null; Item.noMelee = true; - Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.rare = ModContent.RarityType(); Item.shoot = ModContent.ProjectileType(); @@ -51,20 +53,17 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - if (velocity.Length() > 5f) - { - velocity.Normalize(); - velocity *= 5f; - } + SoundEngine.PlaySound(FireSound); + Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 0f); - float SpeedX = velocity.X + (float)Main.rand.Next(-1, 2) * 0.05f; - float SpeedY = velocity.Y + (float)Main.rand.Next(-1, 2) * 0.05f; - - Projectile.NewProjectile(source, position, new Vector2(SpeedX, SpeedY), ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 0f); return false; } + 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/DraedonsArsenal/PulseRifleGlow").Value); + } - public override Vector2? HoldoutOffset() => new Vector2(-10, 0); + public override Vector2? HoldoutOffset() => new Vector2(-15, 0); public override void ModifyTooltips(List tooltips) => CalamityGlobalItem.InsertKnowledgeTooltip(tooltips, 5); diff --git a/Items/Weapons/DraedonsArsenal/PulseRifle.png b/Items/Weapons/DraedonsArsenal/PulseRifle.png index df7ca50eb2..4075f9d594 100644 Binary files a/Items/Weapons/DraedonsArsenal/PulseRifle.png and b/Items/Weapons/DraedonsArsenal/PulseRifle.png differ diff --git a/Items/Weapons/DraedonsArsenal/PulseRifleGlow.png b/Items/Weapons/DraedonsArsenal/PulseRifleGlow.png new file mode 100644 index 0000000000..8a109d4ccf Binary files /dev/null and b/Items/Weapons/DraedonsArsenal/PulseRifleGlow.png differ diff --git a/Items/Weapons/DraedonsArsenal/PulseTurretRemote.cs b/Items/Weapons/DraedonsArsenal/PulseTurretRemote.cs index feb40ddecb..15ca250bb3 100644 --- a/Items/Weapons/DraedonsArsenal/PulseTurretRemote.cs +++ b/Items/Weapons/DraedonsArsenal/PulseTurretRemote.cs @@ -1,9 +1,9 @@ -using CalamityMod.CustomRecipes; +using System; +using System.Collections.Generic; +using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.DraedonsArsenal; using Microsoft.Xna.Framework; -using System; -using System.Collections.Generic; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.UseSound = SoundID.Item15; Item.noMelee = true; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; Item.shoot = ModContent.ProjectileType(); @@ -47,7 +47,10 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { CalamityUtils.OnlyOneSentry(player, type); - int turret = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); + player.FindSentryRestingSpot(type, out int XPosition, out int YPosition, out int YOffset); + YOffset -= 15; + position = new Vector2((float)XPosition, (float)(YPosition - YOffset)); + int turret = Projectile.NewProjectile(source, position, Vector2.Zero, type, damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(turret)) Main.projectile[turret].originalDamage = Item.damage; diff --git a/Items/Weapons/DraedonsArsenal/SnakeEyes.cs b/Items/Weapons/DraedonsArsenal/SnakeEyes.cs index 7d171cf708..7e1b3d2566 100644 --- a/Items/Weapons/DraedonsArsenal/SnakeEyes.cs +++ b/Items/Weapons/DraedonsArsenal/SnakeEyes.cs @@ -24,10 +24,10 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void SetDefaults() { - Item.damage = 200; - Item.mana = 12; Item.width = 38; Item.height = 24; + Item.damage = 200; + Item.mana = 12; Item.useTime = Item.useAnimation = 14; Item.useStyle = ItemUseStyleID.HoldUp; Item.noMelee = true; diff --git a/Items/Weapons/DraedonsArsenal/StarSwallowerContainmentUnit.cs b/Items/Weapons/DraedonsArsenal/StarSwallowerContainmentUnit.cs index b3b4353d7a..6ae3f691fd 100644 --- a/Items/Weapons/DraedonsArsenal/StarSwallowerContainmentUnit.cs +++ b/Items/Weapons/DraedonsArsenal/StarSwallowerContainmentUnit.cs @@ -1,10 +1,10 @@ -using CalamityMod.CustomRecipes; +using System; +using System.Collections.Generic; +using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; using CalamityMod.Projectiles.DraedonsArsenal; using Microsoft.Xna.Framework; -using System; -using System.Collections.Generic; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -19,16 +19,16 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal { CalamityGlobalItem modItem = Item.Calamity(); + Item.width = 18; + Item.height = 28; Item.shootSpeed = 10f; Item.damage = 24; Item.mana = 10; - Item.width = 18; - Item.height = 28; Item.useTime = Item.useAnimation = 30; Item.useStyle = ItemUseStyleID.HoldUp; Item.noMelee = true; Item.knockBack = 2.25f; - Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; Item.UseSound = SoundID.Item15; Item.autoReuse = true; diff --git a/Items/Weapons/DraedonsArsenal/SystemBane.cs b/Items/Weapons/DraedonsArsenal/SystemBane.cs index 66bcbcbc81..fce888af9a 100644 --- a/Items/Weapons/DraedonsArsenal/SystemBane.cs +++ b/Items/Weapons/DraedonsArsenal/SystemBane.cs @@ -1,10 +1,10 @@ -using CalamityMod.CustomRecipes; +using System; +using System.Collections.Generic; +using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Projectiles.DraedonsArsenal; using Microsoft.Xna.Framework; -using System; -using System.Collections.Generic; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -21,18 +21,18 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal { CalamityGlobalItem modItem = Item.Calamity(); + Item.width = 42; + Item.height = 36; Item.damage = 45; Item.DamageType = RogueDamageClass.Instance; Item.noMelee = true; Item.noUseGraphic = true; - Item.width = 42; - Item.height = 36; Item.useTime = 15; Item.useAnimation = 15; Item.autoReuse = true; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 4f; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; Item.UseSound = SoundID.Item1; diff --git a/Items/Weapons/DraedonsArsenal/Taser.cs b/Items/Weapons/DraedonsArsenal/Taser.cs index 182ccb8217..52c92a47a3 100644 --- a/Items/Weapons/DraedonsArsenal/Taser.cs +++ b/Items/Weapons/DraedonsArsenal/Taser.cs @@ -1,10 +1,10 @@ -using CalamityMod.CustomRecipes; +using System; +using System.Collections.Generic; +using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; using CalamityMod.Projectiles.DraedonsArsenal; using CalamityMod.Sounds; -using System; -using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.UseSound = CommonCalamitySounds.PlasmaBoltSound; Item.noMelee = true; - Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/DraedonsArsenal/TeslaCannon.cs b/Items/Weapons/DraedonsArsenal/TeslaCannon.cs index d772febbae..53b5e7d0ee 100644 --- a/Items/Weapons/DraedonsArsenal/TeslaCannon.cs +++ b/Items/Weapons/DraedonsArsenal/TeslaCannon.cs @@ -1,11 +1,11 @@ -using CalamityMod.CustomRecipes; +using System; +using System.Collections.Generic; +using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.DraedonsArsenal; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; -using System; -using System.Collections.Generic; using Terraria; using Terraria.Audio; using Terraria.DataStructures; @@ -17,10 +17,9 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public class TeslaCannon : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.DraedonsArsenal"; - private int BaseDamage = 1220; public static readonly SoundStyle FireSound = new("CalamityMod/Sounds/Item/TeslaCannonFire"); - + public override void SetDefaults() { CalamityGlobalItem modItem = Item.Calamity(); @@ -28,7 +27,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.width = 78; Item.height = 28; Item.DamageType = DamageClass.Magic; - Item.damage = BaseDamage; + Item.damage = 1220; Item.knockBack = 10f; Item.useTime = 90; Item.useAnimation = 90; @@ -39,7 +38,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.UseSound = FireSound; Item.noMelee = true; - Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.rare = ModContent.RarityType(); Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/DraedonsArsenal/TheAnomalysNanogun.cs b/Items/Weapons/DraedonsArsenal/TheAnomalysNanogun.cs index 1fcb8ec3e7..99fe8347cd 100644 --- a/Items/Weapons/DraedonsArsenal/TheAnomalysNanogun.cs +++ b/Items/Weapons/DraedonsArsenal/TheAnomalysNanogun.cs @@ -1,12 +1,12 @@ -using CalamityMod.CustomRecipes; +using System; +using System.Collections.Generic; +using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.DraedonsArsenal; using CalamityMod.Projectiles.Ranged; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; -using System; -using System.Collections.Generic; using Terraria; using Terraria.Audio; using Terraria.DataStructures; @@ -27,12 +27,12 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal { CalamityGlobalItem modItem = Item.Calamity(); - Item.damage = 1850; + Item.width = 102; + Item.height = 44; + Item.damage = 1675; Item.knockBack = 4.5f; Item.useTime = Item.useAnimation = AnomalysNanogunHoldout.PlasmaFireTimer; Item.shootSpeed = 5f; - Item.width = 102; - Item.height = 44; Item.DamageType = DamageClass.Ranged; Item.useStyle = ItemUseStyleID.Shoot; Item.shoot = ModContent.ProjectileType(); @@ -44,8 +44,8 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal modItem.UsesCharge = true; modItem.MaxCharge = 250f; - modItem.ChargePerUse = 0.8f; - modItem.ChargePerAltUse = 0.375f; + modItem.ChargePerUse = 0.3f; + modItem.ChargePerAltUse = 0.15f; } public override void ModifyTooltips(List tooltips) => CalamityGlobalItem.InsertKnowledgeTooltip(tooltips, 4); @@ -73,8 +73,8 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal // Right click is the MPBF Devastator if (player.altFunctionUse == 2) { - damage = (int)(damage * 0.5f); - knockback *= 0.8f; + damage = (int)(damage * 0.77f); + knockback *= 5f; velocity = rotationVector * 13f; } } diff --git a/Items/Weapons/DraedonsArsenal/TrackingDisk.cs b/Items/Weapons/DraedonsArsenal/TrackingDisk.cs index 6e24249359..f69d253b41 100644 --- a/Items/Weapons/DraedonsArsenal/TrackingDisk.cs +++ b/Items/Weapons/DraedonsArsenal/TrackingDisk.cs @@ -1,11 +1,11 @@ -using CalamityMod.CustomRecipes; +using System; +using System.Collections.Generic; +using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Projectiles.DraedonsArsenal; using Microsoft.Xna.Framework; -using System; -using System.Collections.Generic; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -20,18 +20,17 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal { CalamityGlobalItem modItem = Item.Calamity(); - Item.damage = 16; - Item.DamageType = RogueDamageClass.Instance; - Item.width = 30; Item.height = 34; - Item.useTime = 45; - Item.useAnimation = 45; + Item.damage = 16; + Item.DamageType = RogueDamageClass.Instance; + Item.useTime = 40; + Item.useAnimation = 40; Item.useStyle = ItemUseStyleID.Swing; Item.useTurn = false; Item.knockBack = 3f; - Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; Item.noUseGraphic = true; @@ -40,11 +39,11 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 10f; + Item.shootSpeed = 8f; modItem.UsesCharge = true; modItem.MaxCharge = 50f; - modItem.ChargePerUse = 0.08f; + modItem.ChargePerUse = 0.07f; } 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/DraedonsArsenal/WavePounder.cs b/Items/Weapons/DraedonsArsenal/WavePounder.cs index d971b503de..96a3b2e987 100644 --- a/Items/Weapons/DraedonsArsenal/WavePounder.cs +++ b/Items/Weapons/DraedonsArsenal/WavePounder.cs @@ -1,11 +1,11 @@ -using CalamityMod.CustomRecipes; +using System; +using System.Collections.Generic; +using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Projectiles.DraedonsArsenal; using CalamityMod.Rarities; using Microsoft.Xna.Framework; -using System; -using System.Collections.Generic; using Terraria; using Terraria.DataStructures; using Terraria.ID; diff --git a/Items/Weapons/Magic/AbyssShocker.cs b/Items/Weapons/Magic/AbyssShocker.cs index 13990ac194..399ba5cb99 100644 --- a/Items/Weapons/Magic/AbyssShocker.cs +++ b/Items/Weapons/Magic/AbyssShocker.cs @@ -1,10 +1,10 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Projectiles.Magic; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Projectiles.Magic; namespace CalamityMod.Items.Weapons.Magic { @@ -13,19 +13,19 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetDefaults() { - Item.damage = 28; + Item.width = 86; + Item.height = 32; + Item.damage = 27; Item.noMelee = true; Item.DamageType = DamageClass.Magic; Item.channel = true; - Item.width = 86; - Item.height = 32; Item.useTime = 19; Item.useAnimation = 19; Item.UseSound = SoundID.Item13; Item.useStyle = ItemUseStyleID.Shoot; Item.mana = 10; - Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; Item.Calamity().donorItem = true; diff --git a/Items/Weapons/Magic/AbyssalTome.cs b/Items/Weapons/Magic/AbyssalTome.cs index c258fabe4d..12edcf818c 100644 --- a/Items/Weapons/Magic/AbyssalTome.cs +++ b/Items/Weapons/Magic/AbyssalTome.cs @@ -11,17 +11,17 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetDefaults() { - Item.damage = 33; - Item.DamageType = DamageClass.Magic; - Item.mana = 15; Item.width = 28; Item.height = 30; + Item.damage = 22; + Item.DamageType = DamageClass.Magic; + Item.mana = 15; Item.useTime = 25; Item.useAnimation = 25; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 6; - Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; Item.UseSound = SlimeGodCore.ShotSound; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/AcidGun.cs b/Items/Weapons/Magic/AcidGun.cs index b432f99433..712bb487fe 100644 --- a/Items/Weapons/Magic/AcidGun.cs +++ b/Items/Weapons/Magic/AcidGun.cs @@ -14,16 +14,16 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetDefaults() { + Item.width = 42; + Item.height = 28; Item.damage = 28; Item.DamageType = DamageClass.Magic; Item.mana = 9; - Item.width = 42; - Item.height = 28; Item.useTime = Item.useAnimation = 45; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 1.5f; - Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; Item.UseSound = SoundID.Item13; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/AetherfluxCannon.cs b/Items/Weapons/Magic/AetherfluxCannon.cs index 9e7e57759f..11d3ad3d29 100644 --- a/Items/Weapons/Magic/AetherfluxCannon.cs +++ b/Items/Weapons/Magic/AetherfluxCannon.cs @@ -18,11 +18,11 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { + Item.width = 94; + Item.height = 54; Item.damage = 285; Item.DamageType = DamageClass.Magic; Item.mana = 7; - Item.width = 94; - Item.height = 54; Item.useTime = Item.useAnimation = UseTime; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.shootSpeed = 24f; Item.rare = ModContent.RarityType(); - Item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.value = CalamityGlobalItem.RarityVioletBuyPrice; } public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; diff --git a/Items/Weapons/Magic/AethersWhisper.cs b/Items/Weapons/Magic/AethersWhisper.cs index 688ced3624..84c70e6b73 100644 --- a/Items/Weapons/Magic/AethersWhisper.cs +++ b/Items/Weapons/Magic/AethersWhisper.cs @@ -14,6 +14,8 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetDefaults() { + Item.width = 134; + Item.height = 44; Item.damage = 504; Item.knockBack = 5.5f; Item.useTime = Item.useAnimation = 24; @@ -23,13 +25,11 @@ namespace CalamityMod.Items.Weapons.Magic Item.DamageType = DamageClass.Magic; Item.autoReuse = true; - Item.width = 134; - Item.height = 44; Item.noMelee = true; Item.useStyle = ItemUseStyleID.Shoot; Item.UseSound = CommonCalamitySounds.LaserCannonSound; - Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); } diff --git a/Items/Weapons/Magic/AlphaRay.cs b/Items/Weapons/Magic/AlphaRay.cs deleted file mode 100644 index b4e96df9b2..0000000000 --- a/Items/Weapons/Magic/AlphaRay.cs +++ /dev/null @@ -1,97 +0,0 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Magic; -using CalamityMod.Rarities; -using CalamityMod.Tiles.Furniture.CraftingStations; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Magic -{ - public class AlphaRay : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Weapons.Magic"; - public override void SetStaticDefaults() - { - ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; - } - - - public override void SetDefaults() - { - Item.damage = 160; - Item.DamageType = DamageClass.Magic; - Item.mana = 8; - Item.width = 84; - Item.height = 74; - Item.useTime = Item.useAnimation = 4; - Item.useStyle = ItemUseStyleID.Shoot; - Item.noMelee = true; - Item.knockBack = 1.5f; - Item.value = CalamityGlobalItem.Rarity14BuyPrice; - Item.UseSound = SoundID.Item33; - Item.autoReuse = true; - Item.shootSpeed = 6f; - Item.shoot = ModContent.ProjectileType(); - Item.rare = ModContent.RarityType(); - } - - public override Vector2? HoldoutOffset() => new Vector2(-5, 0); - - public override bool AltFunctionUse(Player player) => true; - - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) - { - if (player.altFunctionUse == 2) - { - Projectile.NewProjectile(source, position.X, position.Y, velocity.X * 1.35f, velocity.Y * 1.35f, ModContent.ProjectileType(), (int)(damage * 1.6625), knockback, player.whoAmI); - int laserAmt = 3; - float SpeedX = velocity.X + Main.rand.NextFloat(-1f, 1f); - float SpeedY = velocity.Y + Main.rand.NextFloat(-1f, 1f); - for (int i = 0; i < laserAmt; ++i) - { - int laser = Projectile.NewProjectile(source, position.X, position.Y, SpeedX * 1.15f, SpeedY * 1.15f, ProjectileID.LaserMachinegunLaser, (int)(damage * 0.4), knockback * 0.4f, player.whoAmI); - Main.projectile[laser].timeLeft = 120; - Main.projectile[laser].tileCollide = false; - } - } - else - { - Vector2 laserSpawnPos = player.RotatedRelativePoint(player.MountedCenter, true); - float tenthPi = 0.314159274f; - int laserAmt = 3; - Vector2 laserVelocity = velocity; - laserVelocity.Normalize(); - laserVelocity *= 80f; - bool laserHitsTiles = Collision.CanHit(laserSpawnPos, 0, 0, laserSpawnPos + laserVelocity, 0, 0); - for (int i = 0; i < laserAmt; i++) - { - float laserOffset = (float)i - ((float)laserAmt - 1f) / 2f; - Vector2 offsetSpawnPos = laserVelocity.RotatedBy((double)(tenthPi * laserOffset), default); - if (!laserHitsTiles) - { - offsetSpawnPos -= laserVelocity; - } - Projectile.NewProjectile(source, laserSpawnPos.X + offsetSpawnPos.X, laserSpawnPos.Y + offsetSpawnPos.Y, velocity.X * 1.5f, velocity.Y * 1.5f, type, (int)(damage * 0.8), knockback, player.whoAmI); - int laser = Projectile.NewProjectile(source, laserSpawnPos.X + offsetSpawnPos.X, laserSpawnPos.Y + offsetSpawnPos.Y, velocity.X * 2f, velocity.Y * 2f, ProjectileID.LaserMachinegunLaser, (int)(damage * 0.4), knockback * 0.4f, player.whoAmI); - Main.projectile[laser].timeLeft = 120; - Main.projectile[laser].tileCollide = false; - } - } - return false; - } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(). - AddIngredient(2). - AddIngredient(5). - AddIngredient(10). - AddTile(). - Register(); - } - } -} diff --git a/Items/Weapons/Magic/AlphaRay.png b/Items/Weapons/Magic/AlphaRay.png deleted file mode 100644 index 429d526d81..0000000000 Binary files a/Items/Weapons/Magic/AlphaRay.png and /dev/null differ diff --git a/Items/Weapons/Magic/AlulaAustralis.cs b/Items/Weapons/Magic/AlulaAustralis.cs index 24d80dc5f4..8cb2b562d2 100644 --- a/Items/Weapons/Magic/AlulaAustralis.cs +++ b/Items/Weapons/Magic/AlulaAustralis.cs @@ -16,17 +16,17 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { + Item.width = 52; + Item.height = 52; Item.damage = 65; Item.DamageType = DamageClass.Magic; Item.mana = 8; - Item.width = 52; - Item.height = 52; Item.useTime = 17; Item.useAnimation = 17; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3f; - Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; Item.UseSound = SoundID.Item9; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/AnahitasArpeggio.cs b/Items/Weapons/Magic/AnahitasArpeggio.cs index 0d806501bc..d2cc58731e 100644 --- a/Items/Weapons/Magic/AnahitasArpeggio.cs +++ b/Items/Weapons/Magic/AnahitasArpeggio.cs @@ -13,17 +13,17 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetDefaults() { + Item.width = 56; + Item.height = 50; Item.damage = 92; Item.DamageType = DamageClass.Magic; Item.mana = 7; - Item.width = 56; - Item.height = 50; Item.useTime = 18; Item.useAnimation = 18; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 6.5f; - Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/ApoctosisArray.cs b/Items/Weapons/Magic/ApoctosisArray.cs index b2892f05d3..c376b5e698 100644 --- a/Items/Weapons/Magic/ApoctosisArray.cs +++ b/Items/Weapons/Magic/ApoctosisArray.cs @@ -12,9 +12,9 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetDefaults() { - Item.damage = 99; Item.width = 98; Item.height = 34; + Item.damage = 99; Item.DamageType = DamageClass.Magic; Item.mana = 12; Item.useAnimation = 7; @@ -24,16 +24,16 @@ namespace CalamityMod.Items.Weapons.Magic Item.UseSound = SoundID.Item91; Item.autoReuse = true; Item.noMelee = true; - Item.value = CalamityGlobalItem.Rarity10BuyPrice; - Item.rare = ItemRarityID.Red; + Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; + Item.rare = ItemRarityID.Purple; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 8f; } public override Vector2? HoldoutOffset() => new Vector2(-25, 0); - public override void ModifyShootStats(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) - { + public override void ModifyShootStats(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) + { float manaRatio = (float)player.statMana / player.statManaMax2; bool injectionNerf = player.Calamity().astralInjection; if (injectionNerf) @@ -42,7 +42,7 @@ namespace CalamityMod.Items.Weapons.Magic // 20% to 160% damage. Astral Injection caps it at 111% damage. float damageRatio = 0.2f + 1.4f * manaRatio; damage = (int)(damage * damageRatio); - } + } 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/Magic/Apotheosis.cs b/Items/Weapons/Magic/Apotheosis.cs index 387841d1f6..183b7f53cb 100644 --- a/Items/Weapons/Magic/Apotheosis.cs +++ b/Items/Weapons/Magic/Apotheosis.cs @@ -16,18 +16,18 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetDefaults() { + Item.width = 30; + Item.height = 34; Item.damage = 230; Item.DamageType = DamageClass.Magic; Item.mana = 42; - Item.width = 30; - Item.height = 34; - Item.useTime = Item.useAnimation = 177; + Item.useTime = Item.useAnimation = 167; Item.useStyle = ItemUseStyleID.Shoot; Item.useTurn = false; Item.noMelee = true; Item.knockBack = 6.9f; - Item.value = CalamityGlobalItem.Rarity16BuyPrice; + Item.value = CalamityGlobalItem.RarityHotPinkBuyPrice; Item.rare = ModContent.RarityType(); Item.Calamity().devItem = true; diff --git a/Items/Weapons/Magic/AquamarineStaff.cs b/Items/Weapons/Magic/AquamarineStaff.cs index f15835450c..1359f1b9fd 100644 --- a/Items/Weapons/Magic/AquamarineStaff.cs +++ b/Items/Weapons/Magic/AquamarineStaff.cs @@ -1,5 +1,5 @@ -using CalamityMod.Items.Placeables; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables; using CalamityMod.Projectiles.Magic; using Microsoft.Xna.Framework; using Terraria; @@ -19,17 +19,17 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { + Item.width = 38; + Item.height = 38; Item.damage = 17; Item.DamageType = DamageClass.Magic; Item.mana = 3; - Item.width = 38; - Item.height = 38; Item.useTime = 22; Item.useAnimation = 22; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2.5f; - Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; Item.UseSound = SoundID.Item43; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/ArchAmaryllis.cs b/Items/Weapons/Magic/ArchAmaryllis.cs index 80e5623abd..bbb0031196 100644 --- a/Items/Weapons/Magic/ArchAmaryllis.cs +++ b/Items/Weapons/Magic/ArchAmaryllis.cs @@ -1,8 +1,8 @@ using CalamityMod.Projectiles.Magic; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using Microsoft.Xna.Framework; namespace CalamityMod.Items.Weapons.Magic { @@ -16,17 +16,17 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { + Item.width = 66; + Item.height = 68; Item.damage = 58; Item.DamageType = DamageClass.Magic; Item.mana = 10; - Item.width = 66; - Item.height = 68; Item.useTime = 23; Item.useAnimation = 23; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 7.5f; - Item.value = CalamityGlobalItem.Rarity10BuyPrice; + Item.value = CalamityGlobalItem.RarityRedBuyPrice; Item.rare = ItemRarityID.Red; Item.UseSound = SoundID.Item109; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/ArcticBearPaw.cs b/Items/Weapons/Magic/ArcticBearPaw.cs index 8fdae0e307..467f1d0c4b 100644 --- a/Items/Weapons/Magic/ArcticBearPaw.cs +++ b/Items/Weapons/Magic/ArcticBearPaw.cs @@ -10,18 +10,18 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetDefaults() { + Item.width = 28; + Item.height = 24; Item.damage = 90; Item.DamageType = DamageClass.Magic; Item.mana = 18; - Item.width = 28; - Item.height = 24; Item.useTime = 28; Item.useAnimation = 28; Item.useStyle = ItemUseStyleID.Shoot; Item.useTurn = false; Item.noMelee = true; Item.knockBack = 10f; - Item.value = CalamityGlobalItem.Rarity6BuyPrice; + Item.value = CalamityGlobalItem.RarityLightPurpleBuyPrice; Item.rare = ItemRarityID.LightPurple; Item.UseSound = SoundID.Item8; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/ArtAttack.cs b/Items/Weapons/Magic/ArtAttack.cs index 5b5990ef4d..45d5c5bd1f 100644 --- a/Items/Weapons/Magic/ArtAttack.cs +++ b/Items/Weapons/Magic/ArtAttack.cs @@ -14,16 +14,16 @@ namespace CalamityMod.Items.Weapons.Magic public static readonly SoundStyle UseSound = new("CalamityMod/Sounds/Item/ArtAttackCast"); public override void SetDefaults() { + Item.width = 70; + Item.height = 70; Item.damage = 80; Item.DamageType = DamageClass.Magic; Item.mana = 20; - Item.width = 70; - Item.height = 70; Item.useTime = Item.useAnimation = 24; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2f; - Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; Item.UseSound = null; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/AsteroidStaff.cs b/Items/Weapons/Magic/AsteroidStaff.cs index ae19993ce5..f15b6fc41f 100644 --- a/Items/Weapons/Magic/AsteroidStaff.cs +++ b/Items/Weapons/Magic/AsteroidStaff.cs @@ -1,6 +1,6 @@ -using CalamityMod.Projectiles.Magic; +using System; +using CalamityMod.Projectiles.Magic; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -18,11 +18,11 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { + Item.width = 50; + Item.height = 50; Item.damage = 145; Item.DamageType = DamageClass.Magic; Item.mana = 18; - Item.width = 50; - Item.height = 50; Item.useTime = 10; Item.useAnimation = 10; Item.useStyle = ItemUseStyleID.Shoot; @@ -33,8 +33,8 @@ namespace CalamityMod.Items.Weapons.Magic Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 20f; - Item.value = CalamityGlobalItem.Rarity10BuyPrice; - Item.rare = ItemRarityID.Red; + Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; + Item.rare = ItemRarityID.Purple; } 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/Magic/AstralStaff.cs b/Items/Weapons/Magic/AstralStaff.cs index e657810bd8..6c2ca3d064 100644 --- a/Items/Weapons/Magic/AstralStaff.cs +++ b/Items/Weapons/Magic/AstralStaff.cs @@ -18,17 +18,17 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { + Item.width = 86; + Item.height = 72; Item.damage = 245; Item.DamageType = DamageClass.Magic; Item.mana = 26; - Item.width = 86; - Item.height = 72; Item.useTime = 18; Item.useAnimation = 18; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5f; - Item.value = CalamityGlobalItem.Rarity9BuyPrice; + Item.value = CalamityGlobalItem.RarityCyanBuyPrice; Item.rare = ItemRarityID.Cyan; Item.UseSound = SoundID.Item105; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/AstralachneaStaff.cs b/Items/Weapons/Magic/AstralachneaStaff.cs index a5f214272b..7317265a11 100644 --- a/Items/Weapons/Magic/AstralachneaStaff.cs +++ b/Items/Weapons/Magic/AstralachneaStaff.cs @@ -1,6 +1,6 @@ -using CalamityMod.Projectiles.Magic; +using System; +using CalamityMod.Projectiles.Magic; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -18,24 +18,24 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { + Item.width = 52; + Item.height = 52; Item.damage = 50; Item.DamageType = DamageClass.Magic; Item.mana = 19; - Item.width = 52; - Item.height = 52; Item.useTime = 21; Item.useAnimation = 21; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 6f; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; Item.UseSound = SoundID.Item46; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 13f; } - + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { Vector2 realPlayerPos = player.RotatedRelativePoint(player.MountedCenter, true); diff --git a/Items/Weapons/Magic/Atlantis.cs b/Items/Weapons/Magic/Atlantis.cs index fd7d2b965d..994882c2a9 100644 --- a/Items/Weapons/Magic/Atlantis.cs +++ b/Items/Weapons/Magic/Atlantis.cs @@ -1,6 +1,6 @@ -using CalamityMod.Projectiles.Magic; +using System.Collections.Generic; +using CalamityMod.Projectiles.Magic; using Microsoft.Xna.Framework; -using System.Collections.Generic; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -18,35 +18,35 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - Item.damage = 82; - Item.DamageType = DamageClass.Magic; - Item.mana = 12; Item.width = 28; Item.height = 30; + Item.damage = 86; + Item.DamageType = DamageClass.Magic; + Item.mana = 12; Item.useTime = 25; Item.useAnimation = 25; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5f; - Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; Item.UseSound = SoundID.Item34; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 32f; - } + } public override void ModifyWeaponDamage(Player player, ref StatModifier damage) { if (Main.zenithWorld) { bool devourer = DownedBossSystem.downedDoG; - float damageMult = 1f + (devourer ? (430f / 82f - 1f) : 0f); + float damageMult = 1f + (devourer ? (348f / 86f - 1f) : 0f); damage *= damageMult; } } public override float UseSpeedMultiplier(Player player) => (DownedBossSystem.downedDoG && Main.zenithWorld) ? 2.5f : 1f; - + public override void ModifyTooltips(List list) { bool devourer = DownedBossSystem.downedDoG; diff --git a/Items/Weapons/Magic/AuguroftheElements.cs b/Items/Weapons/Magic/AuguroftheElements.cs index 72f04b7502..ab2d7c028d 100644 --- a/Items/Weapons/Magic/AuguroftheElements.cs +++ b/Items/Weapons/Magic/AuguroftheElements.cs @@ -13,11 +13,11 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetDefaults() { + Item.width = 28; + Item.height = 30; Item.damage = 131; Item.DamageType = DamageClass.Magic; Item.mana = 14; - Item.width = 28; - Item.height = 30; Item.useTime = 2; Item.useAnimation = 10; Item.reuseDelay = 5; @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5.5f; - Item.value = CalamityGlobalItem.Rarity11BuyPrice; + Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; Item.rare = ItemRarityID.Purple; Item.UseSound = SoundID.Item103; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/BelchingSaxophone.cs b/Items/Weapons/Magic/BelchingSaxophone.cs index c72df30e95..f9e5d70960 100644 --- a/Items/Weapons/Magic/BelchingSaxophone.cs +++ b/Items/Weapons/Magic/BelchingSaxophone.cs @@ -1,6 +1,6 @@ -using CalamityMod.Projectiles.Magic; +using System; +using CalamityMod.Projectiles.Magic; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -16,17 +16,17 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { + Item.width = 46; + Item.height = 22; Item.damage = BaseDamage; Item.DamageType = DamageClass.Magic; Item.mana = 10; - Item.width = 46; - Item.height = 22; Item.useTime = 12; Item.useAnimation = 24; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2f; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/Biofusillade.cs b/Items/Weapons/Magic/Biofusillade.cs index 616c7b2bcd..e5f34f725b 100644 --- a/Items/Weapons/Magic/Biofusillade.cs +++ b/Items/Weapons/Magic/Biofusillade.cs @@ -12,17 +12,17 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetDefaults() { - Item.damage = 107; - Item.DamageType = DamageClass.Magic; - Item.mana = 4; Item.width = 28; Item.height = 30; + Item.damage = 118; + Item.DamageType = DamageClass.Magic; + Item.mana = 4; Item.useTime = 3; Item.useAnimation = 3; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3f; - Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.UseSound = SoundID.Item33; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/BlackAnurian.cs b/Items/Weapons/Magic/BlackAnurian.cs index 57cee2130c..3c40c780a5 100644 --- a/Items/Weapons/Magic/BlackAnurian.cs +++ b/Items/Weapons/Magic/BlackAnurian.cs @@ -12,17 +12,17 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetDefaults() { - Item.damage = 21; - Item.DamageType = DamageClass.Magic; - Item.mana = 10; Item.width = 58; Item.height = 38; - Item.useTime = 14; - Item.useAnimation = 14; + Item.damage = 21; + Item.DamageType = DamageClass.Magic; + Item.mana = 9; + Item.useTime = 18; + Item.useAnimation = 18; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2.75f; - Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; Item.UseSound = SoundID.Item111; Item.autoReuse = true; @@ -39,7 +39,7 @@ namespace CalamityMod.Items.Weapons.Magic { float SpeedX = velocity.X + (float)Main.rand.Next(-25, 26) * 0.05f; float SpeedY = velocity.Y + (float)Main.rand.Next(-25, 26) * 0.05f; - Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), (int)(damage * 0.75f), knockback, player.whoAmI); } Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); return false; diff --git a/Items/Weapons/Magic/BloodBath.cs b/Items/Weapons/Magic/BloodBath.cs index 7f291993cd..9a3faa1a1a 100644 --- a/Items/Weapons/Magic/BloodBath.cs +++ b/Items/Weapons/Magic/BloodBath.cs @@ -1,7 +1,7 @@ -using CalamityMod.Items.Materials; +using System; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -19,24 +19,24 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - Item.damage = 31; - Item.DamageType = DamageClass.Magic; - Item.mana = 10; Item.width = 52; Item.height = 50; + Item.damage = 25; + Item.DamageType = DamageClass.Magic; + Item.mana = 10; Item.useTime = 15; Item.useAnimation = 30; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5.75f; - Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; Item.UseSound = SoundID.Item21; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 9f; } - + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { @@ -65,10 +65,6 @@ namespace CalamityMod.Items.Weapons.Magic { bloodAmt++; } - if (Main.rand.NextBool(3)) - { - bloodAmt++; - } for (int i = 0; i < bloodAmt; i++) { realPlayerPos = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); diff --git a/Items/Weapons/Magic/BrimroseStaff.cs b/Items/Weapons/Magic/BrimroseStaff.cs index 16bd2b3d63..1982fc6d2e 100644 --- a/Items/Weapons/Magic/BrimroseStaff.cs +++ b/Items/Weapons/Magic/BrimroseStaff.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 7f; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item43; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/BurningSea.cs b/Items/Weapons/Magic/BurningSea.cs index 017d9b73d2..780927a80b 100644 --- a/Items/Weapons/Magic/BurningSea.cs +++ b/Items/Weapons/Magic/BurningSea.cs @@ -11,17 +11,17 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetDefaults() { + Item.width = 28; + Item.height = 30; Item.damage = 75; Item.DamageType = DamageClass.Magic; Item.mana = 15; - Item.width = 28; - Item.height = 30; Item.useTime = 20; Item.useAnimation = 20; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 6.5f; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item20; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/ChronomancersScythe.cs b/Items/Weapons/Magic/ChronomancersScythe.cs new file mode 100644 index 0000000000..a872675c83 --- /dev/null +++ b/Items/Weapons/Magic/ChronomancersScythe.cs @@ -0,0 +1,88 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Magic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Magic +{ + public class ChronomancersScythe : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Weapons.Magic"; + public override void SetStaticDefaults() + { + ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; + } + + public override void SetDefaults() + { + Item.width = 45; + Item.height = 45; + Item.DamageType = DamageClass.Magic; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.channel = true; + Item.damage = 159; + Item.knockBack = 4f; + Item.useAnimation = 25; + Item.useTime = 5; + Item.autoReuse = false; + Item.useStyle = ItemUseStyleID.Shoot; + Item.UseSound = SoundID.Item71; + Item.mana = 10; + + Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; + Item.rare = ItemRarityID.Purple; + Item.Calamity().donorItem = true; + + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 24f; + } + public override bool AltFunctionUse(Player player) => true; + + 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 p = Projectile.NewProjectile(source, position, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, Main.myPlayer, ai2: player.direction); + float rot = -MathHelper.PiOver2 + MathHelper.PiOver4; + Main.projectile[p].rotation = player.direction * rot; + return false; + } + else + { + return true; + } + } + + public override bool CanUseItem(Player player) + { + if (player.altFunctionUse == 2f) + { + Item.reuseDelay = 10; + Item.channel = false; + Item.useTurn = false; + } + else + { + Item.reuseDelay = 0; + Item.channel = true; + Item.useTurn = true; + } + return base.CanUseItem(player); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.IceSickle). + AddIngredient(ItemID.FastClock). + AddIngredient(ItemID.LunarBar, 10). + AddIngredient(6). + AddTile(TileID.LunarCraftingStation). + Register(); + } + } +} diff --git a/Items/Weapons/Magic/ChronomancersScythe.png b/Items/Weapons/Magic/ChronomancersScythe.png new file mode 100644 index 0000000000..60187a3259 Binary files /dev/null and b/Items/Weapons/Magic/ChronomancersScythe.png differ diff --git a/Items/Weapons/Magic/ClamorNoctus.cs b/Items/Weapons/Magic/ClamorNoctus.cs index fc307c109e..73f5b92166 100644 --- a/Items/Weapons/Magic/ClamorNoctus.cs +++ b/Items/Weapons/Magic/ClamorNoctus.cs @@ -1,9 +1,9 @@ -using CalamityMod.Items.Materials; +using System; +using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Ores; using CalamityMod.Projectiles.Magic; using CalamityMod.Rarities; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -21,17 +21,17 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { + Item.width = 52; + Item.height = 74; Item.damage = 270; Item.DamageType = DamageClass.Magic; Item.mana = 12; - Item.width = 52; - Item.height = 74; Item.useTime = 21; Item.useAnimation = 21; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5.2f; - Item.value = CalamityGlobalItem.Rarity13BuyPrice; + Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item105; Item.autoReuse = true; @@ -39,7 +39,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.shootSpeed = 25f; } - + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { float projSpeed = Item.shootSpeed; diff --git a/Items/Weapons/Magic/ClothiersWrath.cs b/Items/Weapons/Magic/ClothiersWrath.cs index e8e8fee307..8ef09521c1 100644 --- a/Items/Weapons/Magic/ClothiersWrath.cs +++ b/Items/Weapons/Magic/ClothiersWrath.cs @@ -11,17 +11,17 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetDefaults() { - Item.damage = 80; - Item.DamageType = DamageClass.Magic; - Item.mana = 15; Item.width = 28; Item.height = 30; + Item.damage = 36; + Item.DamageType = DamageClass.Magic; + Item.mana = 15; Item.useTime = 22; Item.useAnimation = 22; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3f; - Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; Item.UseSound = SoundID.Item8; Item.autoReuse = true; @@ -38,7 +38,12 @@ namespace CalamityMod.Items.Weapons.Magic Vector2 perturbedSpeed = velocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); int proj = Projectile.NewProjectile(source, position, perturbedSpeed, type, damage, knockback, player.whoAmI); if (proj.WithinBounds(Main.maxProjectiles)) + { Main.projectile[proj].DamageType = DamageClass.Magic; + Main.projectile[proj].penetrate = 3; + Main.projectile[proj].usesLocalNPCImmunity = true; + Main.projectile[proj].localNPCHitCooldown = -1; + } } return false; } diff --git a/Items/Weapons/Magic/CoralSpout.cs b/Items/Weapons/Magic/CoralSpout.cs index a2f77a3316..f0df8bd95b 100644 --- a/Items/Weapons/Magic/CoralSpout.cs +++ b/Items/Weapons/Magic/CoralSpout.cs @@ -21,18 +21,18 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { + Item.width = 28; + Item.height = 30; Item.damage = 8; Item.DamageType = DamageClass.Magic; Item.mana = 7; - Item.width = 28; - Item.height = 30; Item.useTime = 26; Item.useAnimation = 26; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.channel = true; Item.knockBack = 2f; - Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; Item.UseSound = SoundID.Item17; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/CosmicRainbow.cs b/Items/Weapons/Magic/CosmicRainbow.cs index b12a27a960..7c9c432dc1 100644 --- a/Items/Weapons/Magic/CosmicRainbow.cs +++ b/Items/Weapons/Magic/CosmicRainbow.cs @@ -1,6 +1,6 @@ -using CalamityMod.Items.Materials; +using System; +using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -13,18 +13,18 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetDefaults() { + Item.width = 26; + Item.height = 64; Item.damage = 105; Item.DamageType = DamageClass.Magic; Item.mana = 30; - Item.width = 26; - Item.height = 64; Item.useTime = 35; Item.useAnimation = 35; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 0f; - Item.value = CalamityGlobalItem.Rarity9BuyPrice; - Item.rare = ItemRarityID.Cyan; + Item.value = CalamityGlobalItem.RarityRedBuyPrice; + Item.rare = ItemRarityID.Red; Item.UseSound = SoundID.Item67; Item.autoReuse = true; Item.shoot = ProjectileID.RainbowFront; diff --git a/Items/Weapons/Magic/Cryophobia.cs b/Items/Weapons/Magic/Cryophobia.cs index aed0b384e3..cb6f719579 100644 --- a/Items/Weapons/Magic/Cryophobia.cs +++ b/Items/Weapons/Magic/Cryophobia.cs @@ -10,17 +10,17 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetDefaults() { + Item.width = 56; + Item.height = 34; Item.damage = 96; Item.DamageType = DamageClass.Magic; Item.mana = 18; - Item.width = 56; - Item.height = 34; Item.useTime = 40; Item.useAnimation = 40; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 1.5f; - Item.value = CalamityGlobalItem.Rarity6BuyPrice; + Item.value = CalamityGlobalItem.RarityLightPurpleBuyPrice; Item.rare = ItemRarityID.LightPurple; Item.UseSound = SoundID.Item117; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/DarkSpark.cs b/Items/Weapons/Magic/DarkSpark.cs index 1c43fb6ff3..f9013dad83 100644 --- a/Items/Weapons/Magic/DarkSpark.cs +++ b/Items/Weapons/Magic/DarkSpark.cs @@ -20,11 +20,11 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { + Item.width = 16; + Item.height = 16; Item.damage = 60; Item.DamageType = DamageClass.Magic; Item.mana = 10; - Item.width = 16; - Item.height = 16; Item.useTime = 10; Item.useAnimation = 10; Item.useStyle = ItemUseStyleID.HoldUp; @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.noUseGraphic = true; Item.channel = true; Item.knockBack = 0f; - Item.value = CalamityGlobalItem.Rarity13BuyPrice; + Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/DeathValleyDuster.cs b/Items/Weapons/Magic/DeathValleyDuster.cs index a82a27c64f..d028ceb6f6 100644 --- a/Items/Weapons/Magic/DeathValleyDuster.cs +++ b/Items/Weapons/Magic/DeathValleyDuster.cs @@ -11,17 +11,17 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetDefaults() { - Item.damage = 123; - Item.DamageType = DamageClass.Magic; - Item.mana = 9; Item.width = 36; Item.height = 40; + Item.damage = 83; + Item.DamageType = DamageClass.Magic; + Item.mana = 9; Item.useTime = 25; Item.useAnimation = 25; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5f; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item20; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/DeathhailStaff.cs b/Items/Weapons/Magic/DeathhailStaff.cs index 46292e4418..cbe31237bb 100644 --- a/Items/Weapons/Magic/DeathhailStaff.cs +++ b/Items/Weapons/Magic/DeathhailStaff.cs @@ -1,8 +1,8 @@ -using CalamityMod.Projectiles.Magic; +using System; +using CalamityMod.Projectiles.Magic; using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -15,22 +15,22 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetStaticDefaults() { - Item.staff[Item.type] = true; + Item.staff[Item.type] = true; } public override void SetDefaults() { + Item.width = 80; + Item.height = 84; Item.damage = 328; Item.DamageType = DamageClass.Magic; Item.mana = 16; - Item.width = 80; - Item.height = 84; Item.useTime = 11; Item.useAnimation = 22; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 4f; - Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item12; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/DivineRetribution.cs b/Items/Weapons/Magic/DivineRetribution.cs index 3393d825bf..a345625500 100644 --- a/Items/Weapons/Magic/DivineRetribution.cs +++ b/Items/Weapons/Magic/DivineRetribution.cs @@ -1,8 +1,8 @@ -using CalamityMod.Items.Materials; +using System; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; using CalamityMod.Rarities; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -20,18 +20,18 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { + Item.width = 66; + Item.height = 88; Item.damage = 48; Item.DamageType = DamageClass.Magic; Item.mana = 15; - Item.width = 66; - Item.height = 88; Item.useTime = 12; Item.useAnimation = 12; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3.5f; - Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; @@ -41,7 +41,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.shoot = ModContent.ProjectileType(); } - + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { float spearSpeed = Item.shootSpeed; diff --git a/Items/Weapons/Magic/Downpour.cs b/Items/Weapons/Magic/Downpour.cs index de58aebfd5..5e340743dc 100644 --- a/Items/Weapons/Magic/Downpour.cs +++ b/Items/Weapons/Magic/Downpour.cs @@ -17,17 +17,17 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { + Item.width = 42; + Item.height = 42; Item.damage = 50; Item.DamageType = DamageClass.Magic; Item.mana = 10; - Item.width = 42; - Item.height = 42; Item.useTime = 15; Item.useAnimation = 15; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3f; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item13; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/Effervescence.cs b/Items/Weapons/Magic/Effervescence.cs index 9ad52333c9..190e2321a1 100644 --- a/Items/Weapons/Magic/Effervescence.cs +++ b/Items/Weapons/Magic/Effervescence.cs @@ -13,18 +13,18 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetDefaults() { + Item.width = 56; + Item.height = 26; Item.damage = 60; Item.DamageType = DamageClass.Magic; Item.mana = 20; - Item.width = 56; - Item.height = 26; Item.useTime = 15; Item.useAnimation = 15; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3.75f; - Item.value = CalamityGlobalItem.Rarity10BuyPrice; - Item.rare = ItemRarityID.Red; + Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; + Item.rare = ItemRarityID.Purple; Item.UseSound = SoundID.Item95; Item.autoReuse = true; Item.shootSpeed = 13f; diff --git a/Items/Weapons/Magic/EidolicWail.cs b/Items/Weapons/Magic/EidolicWail.cs index 20906423f7..11291e2f1f 100644 --- a/Items/Weapons/Magic/EidolicWail.cs +++ b/Items/Weapons/Magic/EidolicWail.cs @@ -13,11 +13,11 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetDefaults() { + Item.width = 60; + Item.height = 60; Item.damage = 1248; Item.DamageType = DamageClass.Magic; Item.mana = 30; - Item.width = 60; - Item.height = 60; Item.useTime = 12; Item.useAnimation = 36; Item.reuseDelay = 30; @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 1f; - Item.value = CalamityGlobalItem.Rarity13BuyPrice; + Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; Item.UseSound = CommonCalamitySounds.WyrmScreamSound; Item.autoReuse = true; Item.shootSpeed = 14.5f; diff --git a/Items/Weapons/Magic/EidolonStaff.cs b/Items/Weapons/Magic/EidolonStaff.cs index b64847055f..45fa1b6e53 100644 --- a/Items/Weapons/Magic/EidolonStaff.cs +++ b/Items/Weapons/Magic/EidolonStaff.cs @@ -1,7 +1,7 @@ -using CalamityMod.Projectiles.Magic; +using System; +using CalamityMod.Projectiles.Magic; using CalamityMod.Rarities; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -15,22 +15,22 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetStaticDefaults() { - Item.staff[Item.type] = true; + Item.staff[Item.type] = true; } public override void SetDefaults() { + Item.width = 56; + Item.height = 56; Item.damage = 180; Item.DamageType = DamageClass.Magic; Item.mana = 20; - Item.width = 56; - Item.height = 56; Item.useTime = 18; Item.useAnimation = 18; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3f; - Item.value = CalamityGlobalItem.Rarity13BuyPrice; + Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item43; Item.autoReuse = true; @@ -38,7 +38,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.shootSpeed = 12f; } - + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { Vector2 realPlayerPos = player.RotatedRelativePoint(player.MountedCenter, true); diff --git a/Items/Weapons/Magic/EldritchTome.cs b/Items/Weapons/Magic/EldritchTome.cs index f22178553a..912d223f4b 100644 --- a/Items/Weapons/Magic/EldritchTome.cs +++ b/Items/Weapons/Magic/EldritchTome.cs @@ -12,17 +12,17 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetDefaults() { - Item.damage = 42; - Item.DamageType = DamageClass.Magic; - Item.mana = 7; Item.width = 28; Item.height = 30; + Item.damage = 32; + Item.DamageType = DamageClass.Magic; + Item.mana = 7; Item.useTime = 7; Item.useAnimation = 21; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3.5f; - Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; Item.UseSound = SoundID.Item103; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/ElementalRay.cs b/Items/Weapons/Magic/ElementalRay.cs index e70dffd0d3..8ef2de1e1c 100644 --- a/Items/Weapons/Magic/ElementalRay.cs +++ b/Items/Weapons/Magic/ElementalRay.cs @@ -18,11 +18,11 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { + Item.width = 62; + Item.height = 62; Item.damage = 70; Item.DamageType = DamageClass.Magic; Item.mana = 18; - Item.width = 62; - Item.height = 62; Item.useTime = 4; Item.useAnimation = 16; Item.reuseDelay = 14; @@ -30,15 +30,15 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 7.5f; - Item.value = CalamityGlobalItem.Rarity11BuyPrice; + Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; Item.rare = ItemRarityID.Purple; Item.UseSound = SoundID.Item60; Item.autoReuse = true; - Item.shoot = 1; + Item.shoot = ProjectileID.WoodenArrowFriendly; Item.shootSpeed = 6f; } - + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { float offsetAngle = MathHelper.TwoPi * player.itemAnimation / player.itemAnimationMax; @@ -78,7 +78,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { CreateRecipe(). - AddIngredient(). + AddIngredient(). AddIngredient(ItemID.LunarBar, 5). AddIngredient(5). AddIngredient(5). diff --git a/Items/Weapons/Magic/Eternity.cs b/Items/Weapons/Magic/Eternity.cs index 0455f21c83..0c119bc4cd 100644 --- a/Items/Weapons/Magic/Eternity.cs +++ b/Items/Weapons/Magic/Eternity.cs @@ -1,10 +1,10 @@ -using CalamityMod.Items.Materials; +using System.Collections.Generic; +using System.Linq; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; -using System.Collections.Generic; -using System.Linq; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -23,17 +23,17 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { + Item.width = 38; + Item.height = 40; Item.damage = BaseDamage; Item.DamageType = DamageClass.Magic; Item.mana = 30; - Item.width = 38; - Item.height = 40; Item.useTime = Item.useAnimation = 120; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 0f; - Item.value = CalamityGlobalItem.Rarity16BuyPrice; + Item.value = CalamityGlobalItem.RarityHotPinkBuyPrice; Item.rare = ModContent.RarityType(); Item.Calamity().devItem = true; diff --git a/Items/Weapons/Magic/EventHorizon.cs b/Items/Weapons/Magic/EventHorizon.cs index 5bd44b9a8e..bb80dcc498 100644 --- a/Items/Weapons/Magic/EventHorizon.cs +++ b/Items/Weapons/Magic/EventHorizon.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.autoReuse = true; - Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item84; diff --git a/Items/Weapons/Magic/EvergladeSpray.cs b/Items/Weapons/Magic/EvergladeSpray.cs index 50307c8c8b..d073842bf8 100644 --- a/Items/Weapons/Magic/EvergladeSpray.cs +++ b/Items/Weapons/Magic/EvergladeSpray.cs @@ -11,17 +11,17 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetDefaults() { + Item.width = 34; + Item.height = 30; Item.damage = 28; Item.DamageType = DamageClass.Magic; Item.mana = 8; - Item.width = 34; - Item.height = 30; Item.useTime = 6; Item.useAnimation = 18; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 4.5f; - Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; Item.UseSound = SoundID.Item13; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/Fabstaff.cs b/Items/Weapons/Magic/Fabstaff.cs index 518c973d80..72117d510f 100644 --- a/Items/Weapons/Magic/Fabstaff.cs +++ b/Items/Weapons/Magic/Fabstaff.cs @@ -19,18 +19,18 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { + Item.width = 84; + Item.height = 84; Item.damage = 125; Item.DamageType = DamageClass.Magic; Item.mana = 50; - Item.width = 84; - Item.height = 84; Item.useTime = 20; Item.useAnimation = 20; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5f; - Item.value = CalamityGlobalItem.Rarity16BuyPrice; + Item.value = CalamityGlobalItem.RarityHotPinkBuyPrice; Item.rare = ModContent.RarityType(); Item.Calamity().devItem = true; @@ -40,12 +40,12 @@ namespace CalamityMod.Items.Weapons.Magic Item.shootSpeed = 13.5f; } - + public override void AddRecipes() { CreateRecipe(). AddIngredient(ItemID.RainbowRod). - AddIngredient(10). + AddIngredient(10). AddIngredient(5). AddTile(). Register(); diff --git a/Items/Weapons/Magic/FaceMelter.cs b/Items/Weapons/Magic/FaceMelter.cs index 48e577ae14..951693e686 100644 --- a/Items/Weapons/Magic/FaceMelter.cs +++ b/Items/Weapons/Magic/FaceMelter.cs @@ -15,18 +15,18 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetDefaults() { + Item.width = 56; + Item.height = 50; Item.damage = 165; Item.DamageType = DamageClass.Magic; Item.mana = 10; - Item.width = 56; - Item.height = 50; Item.useTime = 5; Item.useAnimation = 10; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5f; - Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; diff --git a/Items/Weapons/Magic/FatesReveal.cs b/Items/Weapons/Magic/FatesReveal.cs index 07be0fb55d..bb490b7a17 100644 --- a/Items/Weapons/Magic/FatesReveal.cs +++ b/Items/Weapons/Magic/FatesReveal.cs @@ -1,8 +1,8 @@ -using CalamityMod.Projectiles.Magic; +using System; +using CalamityMod.Projectiles.Magic; using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -20,11 +20,11 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { + Item.width = 80; + Item.height = 86; Item.damage = 120; Item.DamageType = DamageClass.Magic; Item.mana = 20; - Item.width = 80; - Item.height = 86; Item.useTime = 16; Item.useAnimation = 16; Item.useStyle = ItemUseStyleID.Shoot; @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 1f; - Item.value = CalamityGlobalItem.Rarity13BuyPrice; + Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; Item.rare = ModContent.RarityType(); } diff --git a/Items/Weapons/Magic/FlareBolt.cs b/Items/Weapons/Magic/FlareBolt.cs index c69f600440..481eb7aab1 100644 --- a/Items/Weapons/Magic/FlareBolt.cs +++ b/Items/Weapons/Magic/FlareBolt.cs @@ -10,17 +10,17 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetDefaults() { - Item.damage = 42; - Item.DamageType = DamageClass.Magic; - Item.mana = 12; Item.width = 34; Item.height = 38; + Item.damage = 36; + Item.DamageType = DamageClass.Magic; + Item.mana = 12; Item.useTime = 30; Item.useAnimation = 30; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5.5f; - Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; Item.UseSound = SoundID.Item20; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/ForbiddenSun.cs b/Items/Weapons/Magic/ForbiddenSun.cs index 46a57eb643..ff631c0944 100644 --- a/Items/Weapons/Magic/ForbiddenSun.cs +++ b/Items/Weapons/Magic/ForbiddenSun.cs @@ -11,17 +11,17 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetDefaults() { + Item.width = 28; + Item.height = 30; Item.damage = 80; Item.DamageType = DamageClass.Magic; Item.mana = 33; - Item.width = 28; - Item.height = 30; Item.useTime = 30; Item.useAnimation = 30; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 7f; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/FrigidflashBolt.cs b/Items/Weapons/Magic/FrigidflashBolt.cs index 5281b0f870..e1df32d506 100644 --- a/Items/Weapons/Magic/FrigidflashBolt.cs +++ b/Items/Weapons/Magic/FrigidflashBolt.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -7,22 +8,25 @@ namespace CalamityMod.Items.Weapons.Magic { public class FrigidflashBolt : ModItem, ILocalizedModType { + public static readonly SoundStyle UseSound = new("CalamityMod/Sounds/Item/FrigidflashUse"); + public static readonly SoundStyle ProjDeathSound = new("CalamityMod/Sounds/Item/FrigidflashDeath"); + public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetDefaults() { + Item.width = 38; + Item.height = 42; Item.damage = 80; Item.DamageType = DamageClass.Magic; Item.mana = 13; - Item.width = 38; - Item.height = 42; Item.useTime = 20; Item.useAnimation = 20; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5.5f; - Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; - Item.UseSound = SoundID.Item21; + Item.UseSound = UseSound; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 9f; diff --git a/Items/Weapons/Magic/FrostBolt.cs b/Items/Weapons/Magic/FrostBolt.cs index 60a62611cc..489a233792 100644 --- a/Items/Weapons/Magic/FrostBolt.cs +++ b/Items/Weapons/Magic/FrostBolt.cs @@ -10,17 +10,17 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetDefaults() { + Item.width = 34; + Item.height = 38; Item.damage = 14; Item.DamageType = DamageClass.Magic; Item.mana = 6; - Item.width = 34; - Item.height = 38; Item.useTime = 20; Item.useAnimation = 20; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3.5f; - Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; Item.UseSound = SoundID.Item8; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/Genisis.cs b/Items/Weapons/Magic/Genesis.cs similarity index 50% rename from Items/Weapons/Magic/Genisis.cs rename to Items/Weapons/Magic/Genesis.cs index 401e372148..26a83161e8 100644 --- a/Items/Weapons/Magic/Genisis.cs +++ b/Items/Weapons/Magic/Genesis.cs @@ -8,48 +8,47 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Magic { - public class Genisis : ModItem, ILocalizedModType + [LegacyName("Genisis")] + public class Genesis : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetDefaults() { - Item.damage = 70; + Item.width = 108; + Item.height = 46; + Item.damage = 65; Item.DamageType = DamageClass.Magic; - Item.mana = 4; - Item.width = 74; - Item.height = 28; + Item.mana = 20; Item.useTime = 4; Item.useAnimation = 4; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 1.5f; - Item.value = CalamityGlobalItem.Rarity10BuyPrice; - Item.rare = ItemRarityID.Red; - Item.UseSound = SoundID.Item33; + Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; + Item.rare = ItemRarityID.Purple; + Item.UseSound = null; Item.autoReuse = true; Item.shootSpeed = 6f; - Item.shoot = ModContent.ProjectileType(); + Item.channel = true; + Item.noUseGraphic = true; + Item.shoot = ModContent.ProjectileType(); } - public override Vector2? HoldoutOffset() => new Vector2(-5, 0); + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; + // Makes the rotation of the mouse around the player sync in multiplayer. + public override void HoldItem(Player player) => player.Calamity().mouseRotationListener = 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, 0f, 0f); - float SpeedX = velocity.X + (float)Main.rand.Next(-20, 21) * 0.05f; - float SpeedY = velocity.Y + (float)Main.rand.Next(-20, 21) * 0.05f; - for (int index = 0; index < 3; ++index) - { - int projectile = Projectile.NewProjectile(source, position.X, position.Y, SpeedX * 1.05f, SpeedY * 1.05f, ProjectileID.LaserMachinegunLaser, (int)(damage * 0.65), knockback * 0.6f, player.whoAmI, 0f, 0f); - Main.projectile[projectile].timeLeft = 120; - } + Projectile holdout = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0, 0, 0); + holdout.velocity = (player.Calamity().mouseWorld - player.MountedCenter).SafeNormalize(Vector2.Zero); + return false; } - public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.LaserMachinegun). + AddIngredient(ItemID.LaserRifle). AddIngredient(ItemID.LunarBar, 5). AddIngredient(5). AddTile(TileID.LunarCraftingStation). diff --git a/Items/Weapons/Magic/Genesis.png b/Items/Weapons/Magic/Genesis.png new file mode 100644 index 0000000000..b009a20298 Binary files /dev/null and b/Items/Weapons/Magic/Genesis.png differ diff --git a/Items/Weapons/Magic/Genisis.png b/Items/Weapons/Magic/Genisis.png deleted file mode 100644 index a7d8fbdcca..0000000000 Binary files a/Items/Weapons/Magic/Genisis.png and /dev/null differ diff --git a/Items/Weapons/Magic/GhastlyVisage.cs b/Items/Weapons/Magic/GhastlyVisage.cs index b0a2093f18..086b54ccde 100644 --- a/Items/Weapons/Magic/GhastlyVisage.cs +++ b/Items/Weapons/Magic/GhastlyVisage.cs @@ -14,13 +14,13 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetDefaults() { + Item.width = 32; + Item.height = 36; Item.damage = 120; Item.DamageType = DamageClass.Magic; Item.noUseGraphic = true; Item.channel = true; Item.mana = 20; - Item.width = 32; - Item.height = 36; Item.useTime = 27; Item.useAnimation = 27; Item.useStyle = ItemUseStyleID.Shoot; @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.shootSpeed = 9f; Item.shoot = ModContent.ProjectileType(); - Item.value = CalamityGlobalItem.Rarity13BuyPrice; + Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; Item.rare = ModContent.RarityType(); } diff --git a/Items/Weapons/Magic/GleamingMagnolia.cs b/Items/Weapons/Magic/GleamingMagnolia.cs index 7307cc72d5..6ca12ba596 100644 --- a/Items/Weapons/Magic/GleamingMagnolia.cs +++ b/Items/Weapons/Magic/GleamingMagnolia.cs @@ -16,17 +16,17 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { + Item.width = 52; + Item.height = 54; Item.damage = 53; Item.DamageType = DamageClass.Magic; Item.mana = 11; - Item.width = 52; - Item.height = 54; Item.useTime = 27; Item.useAnimation = 27; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5.5f; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item109; Item.autoReuse = true; @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.shootSpeed = 14f; } - + public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Weapons/Magic/GloriousEnd.cs b/Items/Weapons/Magic/GloriousEnd.cs index c67fc720da..29c4d96f19 100644 --- a/Items/Weapons/Magic/GloriousEnd.cs +++ b/Items/Weapons/Magic/GloriousEnd.cs @@ -12,6 +12,8 @@ namespace CalamityMod.Items.Weapons.Magic public static int PlayerExplosionDmgMax = 60; public override void SetDefaults() { + Item.width = 30; + Item.height = 58; Item.damage = 120; Item.knockBack = 10f; Item.useTime = Item.useAnimation = 30; @@ -20,13 +22,10 @@ namespace CalamityMod.Items.Weapons.Magic Item.channel = true; Item.shootSpeed = 7f; Item.shoot = ModContent.ProjectileType(); - - Item.width = 30; - Item.height = 58; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.UseSound = SoundID.Item9; - Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; Item.Calamity().donorItem = true; } diff --git a/Items/Weapons/Magic/GruesomeEminence.cs b/Items/Weapons/Magic/GruesomeEminence.cs index 928015d4d8..684c53dd65 100644 --- a/Items/Weapons/Magic/GruesomeEminence.cs +++ b/Items/Weapons/Magic/GruesomeEminence.cs @@ -13,13 +13,13 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetDefaults() { + Item.width = 42; + Item.height = 74; Item.damage = 666; Item.DamageType = DamageClass.Magic; Item.noUseGraphic = true; Item.channel = true; - Item.mana = 8; - Item.width = 42; - Item.height = 74; + Item.mana = 400; Item.useTime = 27; Item.useAnimation = 27; Item.useStyle = ItemUseStyleID.Shoot; @@ -28,10 +28,10 @@ namespace CalamityMod.Items.Weapons.Magic Item.shootSpeed = 9f; Item.shoot = ModContent.ProjectileType(); - Item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.rare = ModContent.RarityType(); } - + public override void SetStaticDefaults() { ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); diff --git a/Items/Weapons/Magic/HadalUrn.cs b/Items/Weapons/Magic/HadalUrn.cs index d3278f442a..99191e7e68 100644 --- a/Items/Weapons/Magic/HadalUrn.cs +++ b/Items/Weapons/Magic/HadalUrn.cs @@ -16,17 +16,17 @@ namespace CalamityMod.Items.Weapons.Magic public static readonly SoundStyle ShootSound = new("CalamityMod/Sounds/Item/HadalUrnOpen"); public override void SetDefaults() { - Item.damage = 32; - Item.DamageType = DamageClass.Magic; - Item.mana = 10; Item.width = 58; Item.height = 38; - Item.useTime = 14; - Item.useAnimation = 14; + Item.damage = 37; + Item.DamageType = DamageClass.Magic; + Item.mana = 10; + Item.useTime = 16; + Item.useAnimation = 16; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2.75f; - Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; Item.Calamity().donorItem = true; Item.UseSound = ShootSound; diff --git a/Items/Weapons/Magic/HarvestStaff.cs b/Items/Weapons/Magic/HarvestStaff.cs deleted file mode 100644 index 0bcf1dc2ce..0000000000 --- a/Items/Weapons/Magic/HarvestStaff.cs +++ /dev/null @@ -1,49 +0,0 @@ -using CalamityMod.Projectiles.Magic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Magic -{ - public class HarvestStaff : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Weapons.Magic"; - public override void SetStaticDefaults() - { - Item.staff[Item.type] = true; - } - - public override void SetDefaults() - { - Item.damage = 26; - Item.DamageType = DamageClass.Magic; - Item.mana = 5; - Item.width = 46; - Item.height = 44; - Item.useTime = 23; - Item.useAnimation = 23; - Item.useStyle = ItemUseStyleID.Shoot; - Item.noMelee = true; - Item.knockBack = 5; - Item.value = CalamityGlobalItem.Rarity2BuyPrice; - Item.rare = ItemRarityID.Green; - Item.UseSound = SoundID.Item20; - Item.autoReuse = true; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 10f; - Item.scale = 0.9f; - } - - - public override void AddRecipes() - { - CreateRecipe(). - AddRecipeGroup("Wood", 20). - AddIngredient(ItemID.Pumpkin, 20). - AddIngredient(ItemID.PumpkinSeed, 5). - AddTile(TileID.Anvils). - Register(); - } - } -} diff --git a/Items/Weapons/Magic/HarvestStaff.png b/Items/Weapons/Magic/HarvestStaff.png deleted file mode 100644 index 0425b98351..0000000000 Binary files a/Items/Weapons/Magic/HarvestStaff.png and /dev/null differ diff --git a/Items/Weapons/Magic/HeliumFlash.cs b/Items/Weapons/Magic/HeliumFlash.cs index 1e59d3a127..bd5307fc53 100644 --- a/Items/Weapons/Magic/HeliumFlash.cs +++ b/Items/Weapons/Magic/HeliumFlash.cs @@ -1,9 +1,9 @@ -using CalamityMod.Items.Materials; +using System; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetStaticDefaults() { - Item.staff[Item.type] = true; + Item.staff[Item.type] = true; } public override void SetDefaults() @@ -37,7 +37,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.UseSound = SoundID.Item73; - Item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.rare = ModContent.RarityType(); Item.shoot = ModContent.ProjectileType(); @@ -91,7 +91,7 @@ namespace CalamityMod.Items.Weapons.Magic } return true; } - + public override void AddRecipes() { diff --git a/Items/Weapons/Magic/HellwingStaff.cs b/Items/Weapons/Magic/HellwingStaff.cs index 016d50affe..14d8c95b40 100644 --- a/Items/Weapons/Magic/HellwingStaff.cs +++ b/Items/Weapons/Magic/HellwingStaff.cs @@ -1,6 +1,6 @@ -using CalamityMod.Projectiles.Magic; +using System; +using CalamityMod.Projectiles.Magic; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -18,25 +18,25 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { + Item.width = 70; + Item.height = 60; Item.damage = 22; Item.DamageType = DamageClass.Magic; Item.mana = 18; - Item.width = 54; - Item.height = 52; Item.useTime = 30; Item.useAnimation = 30; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5; - Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; Item.UseSound = SoundID.Item43; Item.autoReuse = true; - Item.shoot = ModContent.ProjectileType(); + Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 9f; } - + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { float projSpeed = velocity.Length(); diff --git a/Items/Weapons/Magic/HellwingStaff.png b/Items/Weapons/Magic/HellwingStaff.png index ccef51f3a8..f31c0fe5ba 100644 Binary files a/Items/Weapons/Magic/HellwingStaff.png and b/Items/Weapons/Magic/HellwingStaff.png differ diff --git a/Items/Weapons/Magic/Hematemesis.cs b/Items/Weapons/Magic/Hematemesis.cs index efa21ded42..18c289a27f 100644 --- a/Items/Weapons/Magic/Hematemesis.cs +++ b/Items/Weapons/Magic/Hematemesis.cs @@ -17,25 +17,25 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { + Item.width = 48; + Item.height = 54; Item.damage = 75; Item.DamageType = DamageClass.Magic; Item.mana = 14; Item.rare = ItemRarityID.Yellow; - Item.width = 48; - Item.height = 54; Item.useTime = 22; Item.useAnimation = 22; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3.75f; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.UseSound = SoundID.Item21; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; } - + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { position = Main.MouseWorld; diff --git a/Items/Weapons/Magic/Heresy.cs b/Items/Weapons/Magic/Heresy.cs index af3dadaef4..77c4af47e3 100644 --- a/Items/Weapons/Magic/Heresy.cs +++ b/Items/Weapons/Magic/Heresy.cs @@ -18,18 +18,18 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { + Item.width = 38; + Item.height = 40; Item.damage = 960; Item.DamageType = DamageClass.Magic; Item.mana = 15; - Item.width = 38; - Item.height = 40; Item.useTime = Item.useAnimation = 120; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.UseSound = SoundID.DD2_EtherianPortalDryadTouch; Item.knockBack = 0f; - Item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.rare = ModContent.RarityType(); Item.autoReuse = true; diff --git a/Items/Weapons/Magic/HyphaeRod.cs b/Items/Weapons/Magic/HyphaeRod.cs index 957d90ee81..30bc37b713 100644 --- a/Items/Weapons/Magic/HyphaeRod.cs +++ b/Items/Weapons/Magic/HyphaeRod.cs @@ -16,17 +16,17 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { + Item.width = 34; + Item.height = 34; Item.damage = 22; Item.DamageType = DamageClass.Magic; Item.mana = 7; - Item.width = 34; - Item.height = 34; Item.useTime = 24; Item.useAnimation = 24; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2f; - Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; Item.UseSound = SoundID.Item8; Item.autoReuse = true; @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.shootSpeed = 1f; } - + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo projSource, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { float speed = Item.shootSpeed; diff --git a/Items/Weapons/Magic/IceBarrage.cs b/Items/Weapons/Magic/IceBarrage.cs index 59d80d7201..1d71b194b4 100644 --- a/Items/Weapons/Magic/IceBarrage.cs +++ b/Items/Weapons/Magic/IceBarrage.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.noMelee = true; Item.UseSound = CastSound; - Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; diff --git a/Items/Weapons/Magic/IcicleStaff.cs b/Items/Weapons/Magic/IcicleStaff.cs index 82a5db852d..6e5c822dab 100644 --- a/Items/Weapons/Magic/IcicleStaff.cs +++ b/Items/Weapons/Magic/IcicleStaff.cs @@ -1,6 +1,6 @@ -using CalamityMod.Projectiles.Magic; +using System; +using CalamityMod.Projectiles.Magic; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -18,17 +18,17 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { + Item.width = 38; + Item.height = 42; Item.damage = 10; Item.DamageType = DamageClass.Magic; Item.mana = 6; - Item.width = 38; - Item.height = 42; Item.useTime = 7; Item.useAnimation = 14; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2f; - Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.rare = ItemRarityID.Blue; Item.UseSound = SoundID.Item8; Item.autoReuse = true; @@ -36,7 +36,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.shootSpeed = 11f; } - + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { int i = Main.myPlayer; @@ -63,25 +63,25 @@ namespace CalamityMod.Items.Weapons.Magic mouseDistance = icicleSpeed / mouseDistance; } - realPlayerPos = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); - realPlayerPos.X = (realPlayerPos.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); - mouseXDist = (float)Main.mouseX + Main.screenPosition.X - realPlayerPos.X; - mouseYDist = (float)Main.mouseY + Main.screenPosition.Y - realPlayerPos.Y; - if (mouseYDist < 0f) - { - mouseYDist *= -1f; - } - if (mouseYDist < 20f) - { - mouseYDist = 20f; - } - mouseDistance = (float)Math.Sqrt((double)(mouseXDist * mouseXDist + mouseYDist * mouseYDist)); - mouseDistance = icicleSpeed / mouseDistance; - mouseXDist *= mouseDistance; - mouseYDist *= mouseDistance; - float speedX4 = mouseXDist; - float speedY5 = mouseYDist + (float)Main.rand.Next(-40, 41) * 0.02f; - Projectile.NewProjectile(source, realPlayerPos.X, realPlayerPos.Y, speedX4, speedY5, ModContent.ProjectileType(), damage, playerKnockback, i, 0f, (float)Main.rand.Next(10)); + realPlayerPos = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); + realPlayerPos.X = (realPlayerPos.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); + mouseXDist = (float)Main.mouseX + Main.screenPosition.X - realPlayerPos.X; + mouseYDist = (float)Main.mouseY + Main.screenPosition.Y - realPlayerPos.Y; + if (mouseYDist < 0f) + { + mouseYDist *= -1f; + } + if (mouseYDist < 20f) + { + mouseYDist = 20f; + } + mouseDistance = (float)Math.Sqrt((double)(mouseXDist * mouseXDist + mouseYDist * mouseYDist)); + mouseDistance = icicleSpeed / mouseDistance; + mouseXDist *= mouseDistance; + mouseYDist *= mouseDistance; + float speedX4 = mouseXDist; + float speedY5 = mouseYDist + (float)Main.rand.Next(-40, 41) * 0.02f; + Projectile.NewProjectile(source, realPlayerPos.X, realPlayerPos.Y, speedX4, speedY5, ModContent.ProjectileType(), damage, playerKnockback, i, 0f, (float)Main.rand.Next(10)); return false; } diff --git a/Items/Weapons/Magic/IcicleTrident.cs b/Items/Weapons/Magic/IcicleTrident.cs index f518b9bd43..206d0b3632 100644 --- a/Items/Weapons/Magic/IcicleTrident.cs +++ b/Items/Weapons/Magic/IcicleTrident.cs @@ -16,17 +16,17 @@ namespace CalamityMod.Items.Weapons.Magic } public override void SetDefaults() { + Item.width = Item.height = 44; Item.damage = 69; Item.DamageType = DamageClass.Magic; Item.mana = 21; - Item.width = Item.height = 44; Item.useTime = 25; Item.useAnimation = 25; Item.useStyle = ItemUseStyleID.Shoot; Item.useTurn = false; Item.noMelee = true; Item.knockBack = 7f; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item8; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/InfernalRift.cs b/Items/Weapons/Magic/InfernalRift.cs index 0b024aef5b..0fcf0fc8d6 100644 --- a/Items/Weapons/Magic/InfernalRift.cs +++ b/Items/Weapons/Magic/InfernalRift.cs @@ -18,11 +18,11 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { + Item.width = 16; + Item.height = 16; Item.damage = 50; Item.DamageType = DamageClass.Magic; Item.mana = 15; - Item.width = 16; - Item.height = 16; Item.useTime = 2; Item.useAnimation = 30; Item.reuseDelay = Item.useAnimation + 6; @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 7f; - Item.value = CalamityGlobalItem.Rarity6BuyPrice; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; Item.UseSound = SoundID.Item9; Item.autoReuse = true; @@ -41,7 +41,7 @@ namespace CalamityMod.Items.Weapons.Magic // Terraria seems to really dislike high crit values in SetDefaults public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 25; - + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { Vector2 realPlayerPos = player.RotatedRelativePoint(player.MountedCenter, true); diff --git a/Items/Weapons/Magic/IonBlaster.cs b/Items/Weapons/Magic/IonBlaster.cs index 4494f1760a..24dc94d772 100644 --- a/Items/Weapons/Magic/IonBlaster.cs +++ b/Items/Weapons/Magic/IonBlaster.cs @@ -12,9 +12,9 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetDefaults() { - Item.damage = 29; Item.width = 44; Item.height = 28; + Item.damage = 29; Item.DamageType = DamageClass.Magic; Item.mana = 10; Item.useAnimation = 10; @@ -27,14 +27,14 @@ namespace CalamityMod.Items.Weapons.Magic Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 3f; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; } public override Vector2? HoldoutOffset() => new Vector2(-5, 0); - public override void ModifyShootStats(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) - { + public override void ModifyShootStats(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) + { float manaRatio = (float)player.statMana / player.statManaMax2; bool injectionNerf = player.Calamity().astralInjection; if (injectionNerf) @@ -43,7 +43,7 @@ namespace CalamityMod.Items.Weapons.Magic // 20% to 160% damage. Astral Injection caps it at 111% damage. float damageRatio = 0.2f + 1.4f * manaRatio; damage = (int)(damage * damageRatio); - } + } 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/Magic/Keelhaul.cs b/Items/Weapons/Magic/Keelhaul.cs index 6ba766b7e2..5929c99224 100644 --- a/Items/Weapons/Magic/Keelhaul.cs +++ b/Items/Weapons/Magic/Keelhaul.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.UseSound = SoundID.Item102; Item.autoReuse = true; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; Item.Calamity().donorItem = true; diff --git a/Items/Weapons/Magic/LashesofChaos.cs b/Items/Weapons/Magic/LashesofChaos.cs index d5968d32e9..adeafbbd2a 100644 --- a/Items/Weapons/Magic/LashesofChaos.cs +++ b/Items/Weapons/Magic/LashesofChaos.cs @@ -11,17 +11,17 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetDefaults() { + Item.width = 28; + Item.height = 30; Item.damage = 65; Item.DamageType = DamageClass.Magic; Item.mana = 20; - Item.width = 28; - Item.height = 30; Item.useTime = 38; Item.useAnimation = 38; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 7.5f; - Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/Lazhar.cs b/Items/Weapons/Magic/Lazhar.cs index 50b80c1261..152ffbb9a2 100644 --- a/Items/Weapons/Magic/Lazhar.cs +++ b/Items/Weapons/Magic/Lazhar.cs @@ -11,17 +11,17 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetDefaults() { + Item.width = 42; + Item.height = 20; Item.damage = 76; Item.DamageType = DamageClass.Magic; Item.mana = 4; - Item.width = 42; - Item.height = 20; Item.useTime = 7; Item.useAnimation = 7; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5f; - Item.value = CalamityGlobalItem.Rarity10BuyPrice; + Item.value = CalamityGlobalItem.RarityRedBuyPrice; Item.rare = ItemRarityID.Red; Item.UseSound = SoundID.Item12; Item.autoReuse = true; @@ -31,11 +31,11 @@ namespace CalamityMod.Items.Weapons.Magic public override Vector2? HoldoutOffset() => new Vector2(-5, 0); - public override void ModifyShootStats(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) - { + public override void ModifyShootStats(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) + { velocity.X += (float)Main.rand.Next(-15, 16) * 0.05f; velocity.Y += (float)Main.rand.Next(-15, 16) * 0.05f; - } + } public override void AddRecipes() { diff --git a/Items/Weapons/Magic/LightGodsBrilliance.cs b/Items/Weapons/Magic/LightGodsBrilliance.cs index 94b7b99a31..a0ef23a3cb 100644 --- a/Items/Weapons/Magic/LightGodsBrilliance.cs +++ b/Items/Weapons/Magic/LightGodsBrilliance.cs @@ -14,11 +14,11 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetDefaults() { + Item.width = 42; + Item.height = 48; Item.damage = 111; Item.DamageType = DamageClass.Magic; Item.mana = 6; - Item.width = 42; - Item.height = 48; Item.useTime = Item.useAnimation = 4; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; @@ -46,7 +46,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { CreateRecipe(). - AddIngredient(). + AddIngredient(). AddIngredient(). AddIngredient(ItemID.HolyWater, 10). AddIngredient(ItemID.SoulofLight, 30). diff --git a/Items/Weapons/Magic/MadAlchemistsCocktailGlove.cs b/Items/Weapons/Magic/MadAlchemistsCocktailGlove.cs index 01cef66720..5c836aa917 100644 --- a/Items/Weapons/Magic/MadAlchemistsCocktailGlove.cs +++ b/Items/Weapons/Magic/MadAlchemistsCocktailGlove.cs @@ -48,15 +48,15 @@ namespace CalamityMod.Items.Weapons.Magic Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 19f; - Item.value = CalamityGlobalItem.Rarity11BuyPrice; + Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; Item.rare = ItemRarityID.Purple; Item.Calamity().donorItem = true; } public override bool AltFunctionUse(Player player) => true; - public override void ModifyShootStats(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) - { + public override void ModifyShootStats(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) + { if (player.altFunctionUse == 2) { type = flaskIDs[4]; @@ -67,7 +67,7 @@ namespace CalamityMod.Items.Weapons.Magic type = flaskIDs[flaskIndex++]; if (flaskIndex > 3) flaskIndex = 0; - } + } public override void AddRecipes() { diff --git a/Items/Weapons/Magic/MagneticMeltdown.cs b/Items/Weapons/Magic/MagneticMeltdown.cs index fafc5f8fb2..8ec34d604c 100644 --- a/Items/Weapons/Magic/MagneticMeltdown.cs +++ b/Items/Weapons/Magic/MagneticMeltdown.cs @@ -19,26 +19,26 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - Item.damage = 100; - Item.DamageType = DamageClass.Magic; - Item.mana = 40; Item.width = 78; Item.height = 78; - Item.useTime = 49; - Item.useAnimation = 49; + Item.damage = 200; + Item.DamageType = DamageClass.Magic; + Item.mana = 32; + Item.useTime = 37; + Item.useAnimation = 37; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 4f; Item.UseSound = SoundID.Item20; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 12f; + Item.shootSpeed = 18f; - Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); } - + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { Vector2 v = velocity; @@ -57,7 +57,7 @@ namespace CalamityMod.Items.Weapons.Magic CreateRecipe(). AddIngredient(ItemID.SpectreStaff). AddIngredient(ItemID.MagnetSphere). - AddIngredient(3). + AddIngredient(3). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Magic/ManaRose.cs b/Items/Weapons/Magic/ManaRose.cs index 2884d06b7f..898c4af8d1 100644 --- a/Items/Weapons/Magic/ManaRose.cs +++ b/Items/Weapons/Magic/ManaRose.cs @@ -16,17 +16,17 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { + Item.width = 38; + Item.height = 38; Item.damage = 20; Item.DamageType = DamageClass.Magic; Item.mana = 8; - Item.width = 38; - Item.height = 38; Item.useTime = 38; Item.useAnimation = 38; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3.25f; - Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; Item.UseSound = SoundID.Item109; Item.autoReuse = true; @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.shootSpeed = 10f; } - + public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Weapons/Magic/Miasma.cs b/Items/Weapons/Magic/Miasma.cs index 6adb635691..5a24f1a067 100644 --- a/Items/Weapons/Magic/Miasma.cs +++ b/Items/Weapons/Magic/Miasma.cs @@ -1,5 +1,5 @@ -using CalamityMod.Projectiles.Magic; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Magic; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -18,16 +18,16 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { + Item.width = 50; + Item.height = 64; Item.damage = 40; Item.DamageType = DamageClass.Magic; Item.mana = 16; - Item.width = 50; - Item.height = 64; Item.useTime = Item.useAnimation = 27; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3f; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item8; Item.autoReuse = true; @@ -37,7 +37,7 @@ namespace CalamityMod.Items.Weapons.Magic public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - int cloudAmt = Main.rand.Next(3, 5 + 1); + int cloudAmt = Main.rand.Next(3, 5 + 1); for (int i = 0; i < cloudAmt; i++) { Vector2 velocityReal = velocity * Main.rand.NextFloat(0.9f, 1.1f); diff --git a/Items/Weapons/Magic/Mistlestorm.cs b/Items/Weapons/Magic/Mistlestorm.cs index e4675f7a01..e2fa749681 100644 --- a/Items/Weapons/Magic/Mistlestorm.cs +++ b/Items/Weapons/Magic/Mistlestorm.cs @@ -18,17 +18,17 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { + Item.width = 48; + Item.height = 48; Item.damage = 54; Item.DamageType = DamageClass.Magic; Item.mana = 5; - Item.width = 48; - Item.height = 48; Item.useTime = 6; Item.useAnimation = 6; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3.5f; - Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item39; Item.autoReuse = true; @@ -36,7 +36,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.shootSpeed = 24f; } - + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { int projAmt = 2 + Main.rand.Next(3); diff --git a/Items/Weapons/Magic/NanoPurge.cs b/Items/Weapons/Magic/NanoPurge.cs index b1c5540417..558c24ab99 100644 --- a/Items/Weapons/Magic/NanoPurge.cs +++ b/Items/Weapons/Magic/NanoPurge.cs @@ -15,11 +15,11 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { + Item.width = 62; + Item.height = 34; Item.damage = 60; Item.DamageType = DamageClass.Magic; Item.mana = 8; - Item.width = 62; - Item.height = 34; Item.useTime = Item.useAnimation = UseTime; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.channel = true; Item.knockBack = 3f; Item.rare = ItemRarityID.Red; - Item.value = CalamityGlobalItem.Rarity10BuyPrice; + Item.value = CalamityGlobalItem.RarityRedBuyPrice; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 16f; diff --git a/Items/Weapons/Magic/NebulousCataclysm.cs b/Items/Weapons/Magic/NebulousCataclysm.cs index 499c9b7599..7a113fceae 100644 --- a/Items/Weapons/Magic/NebulousCataclysm.cs +++ b/Items/Weapons/Magic/NebulousCataclysm.cs @@ -15,11 +15,11 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetDefaults() { + Item.width = 120; + Item.height = 124; Item.damage = 510; Item.DamageType = DamageClass.Magic; Item.mana = 60; - Item.width = 120; - Item.height = 124; Item.useTime = 30; Item.useAnimation = 30; Item.useStyle = ItemUseStyleID.Shoot; @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.noUseGraphic = true; Item.channel = true; Item.knockBack = 6f; - Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/NightsRay.cs b/Items/Weapons/Magic/NightsRay.cs index 7607bcaa13..3b767eaa97 100644 --- a/Items/Weapons/Magic/NightsRay.cs +++ b/Items/Weapons/Magic/NightsRay.cs @@ -17,30 +17,30 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - Item.damage = 17; - Item.DamageType = DamageClass.Magic; - Item.mana = 10; Item.width = 58; Item.height = 54; + Item.damage = 20; + Item.DamageType = DamageClass.Magic; + Item.mana = 10; Item.useTime = 20; Item.useAnimation = 20; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3.25f; - Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; Item.UseSound = SoundID.Item72; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 6f; } - + public override void AddRecipes() { CreateRecipe(). AddIngredient(ItemID.Vilethorn). AddIngredient(ItemID.MagicMissile). - AddIngredient(ItemID.WandofSparking). + AddIngredient(ItemID.WandofFrosting). AddIngredient(ItemID.AmberStaff). AddIngredient(10). AddTile(TileID.DemonAltar). @@ -48,7 +48,7 @@ namespace CalamityMod.Items.Weapons.Magic CreateRecipe(). AddIngredient(ItemID.CrimsonRod). AddIngredient(ItemID.MagicMissile). - AddIngredient(ItemID.WandofSparking). + AddIngredient(ItemID.WandofFrosting). AddIngredient(ItemID.AmberStaff). AddIngredient(10). AddTile(TileID.DemonAltar). diff --git a/Items/Weapons/Magic/NuclearFury.cs b/Items/Weapons/Magic/NuclearFury.cs index 85d235df6e..15ccc2aacb 100644 --- a/Items/Weapons/Magic/NuclearFury.cs +++ b/Items/Weapons/Magic/NuclearFury.cs @@ -1,6 +1,6 @@ -using CalamityMod.Projectiles.Magic; +using System; +using CalamityMod.Projectiles.Magic; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -13,18 +13,18 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetDefaults() { + Item.width = 38; + Item.height = 40; Item.damage = 108; Item.DamageType = DamageClass.Magic; Item.mana = 22; - Item.width = 38; - Item.height = 40; Item.useTime = 25; Item.useAnimation = 25; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5f; - Item.value = CalamityGlobalItem.Rarity10BuyPrice; - Item.rare = ItemRarityID.Red; + Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; + Item.rare = ItemRarityID.Purple; Item.UseSound = SoundID.Item84; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/Omicron.cs b/Items/Weapons/Magic/Omicron.cs new file mode 100644 index 0000000000..5028c9f3a0 --- /dev/null +++ b/Items/Weapons/Magic/Omicron.cs @@ -0,0 +1,65 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Magic; +using CalamityMod.Rarities; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Magic +{ + public class Omicron : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Weapons.Magic"; + + public override void SetDefaults() + { + Item.width = 122; + Item.height = 54; + Item.damage = 82; + Item.DamageType = DamageClass.Magic; + Item.mana = 8; + Item.useTime = Item.useAnimation = 4; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 1.5f; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; + Item.UseSound = null; + Item.autoReuse = true; + Item.shootSpeed = 6f; + Item.channel = true; + Item.noUseGraphic = true; + Item.shoot = ModContent.ProjectileType(); + Item.rare = ModContent.RarityType(); + } + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0 && player.ownedProjectileCounts[ModContent.ProjectileType()] < 2; + + // Makes the rotation of the mouse around the player sync in multiplayer. + public override void HoldItem(Player player) => player.Calamity().mouseRotationListener = 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++) + { + Projectile holdout2 = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0, 0, i == 0 ? 1 : -1); + holdout2.velocity = (player.Calamity().mouseWorld - player.MountedCenter).SafeNormalize(Vector2.Zero); + } + + Projectile holdout = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0, 0, 0); + holdout.velocity = (player.Calamity().mouseWorld - player.MountedCenter).SafeNormalize(Vector2.Zero); + + return false; + } + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(). + AddIngredient(). + AddIngredient(5). + AddIngredient(10). + AddTile(). + Register(); + } + } +} diff --git a/Items/Weapons/Magic/Omicron.png b/Items/Weapons/Magic/Omicron.png new file mode 100644 index 0000000000..49a0e14e11 Binary files /dev/null and b/Items/Weapons/Magic/Omicron.png differ diff --git a/Items/Weapons/Magic/ParasiticSceptor.cs b/Items/Weapons/Magic/ParasiticSceptor.cs index fcea49bd79..a79fa58088 100644 --- a/Items/Weapons/Magic/ParasiticSceptor.cs +++ b/Items/Weapons/Magic/ParasiticSceptor.cs @@ -19,6 +19,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { + Item.width = Item.height = 52; Item.damage = 12; Item.knockBack = 3f; Item.mana = 10; @@ -28,15 +29,14 @@ namespace CalamityMod.Items.Weapons.Magic Item.shootSpeed = 10f; Item.shoot = ModContent.ProjectileType(); - Item.width = Item.height = 52; Item.UseSound = SoundID.Item46; Item.noMelee = true; Item.useStyle = ItemUseStyleID.Shoot; Item.rare = ItemRarityID.Green; - Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; } - + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { float speed = Item.shootSpeed; @@ -72,7 +72,7 @@ namespace CalamityMod.Items.Weapons.Magic } if (Main.rand.NextBool(5)) { - leechAmt ++; + leechAmt++; } for (int i = 0; i < leechAmt; i++) { diff --git a/Items/Weapons/Magic/PhantasmalFury.cs b/Items/Weapons/Magic/PhantasmalFury.cs index 5a582e413c..f50734ad0f 100644 --- a/Items/Weapons/Magic/PhantasmalFury.cs +++ b/Items/Weapons/Magic/PhantasmalFury.cs @@ -18,17 +18,17 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { + Item.width = 62; + Item.height = 60; Item.damage = 260; Item.DamageType = DamageClass.Magic; Item.mana = 20; - Item.width = 62; - Item.height = 60; Item.useTime = 20; Item.useAnimation = 20; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 7.5f; - Item.value = CalamityGlobalItem.Rarity13BuyPrice; + Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; Item.UseSound = SoundID.Item43; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); @@ -36,7 +36,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.rare = ModContent.RarityType(); } - + public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Weapons/Magic/PhoenixFlameBarrage.cs b/Items/Weapons/Magic/PhoenixFlameBarrage.cs index 8f2a6f1573..5f47966448 100644 --- a/Items/Weapons/Magic/PhoenixFlameBarrage.cs +++ b/Items/Weapons/Magic/PhoenixFlameBarrage.cs @@ -1,7 +1,7 @@ -using CalamityMod.Projectiles.Magic; +using System; +using CalamityMod.Projectiles.Magic; using CalamityMod.Rarities; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -14,22 +14,22 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetStaticDefaults() { - Item.staff[Item.type] = true; + Item.staff[Item.type] = true; } public override void SetDefaults() { + Item.width = 106; + Item.height = 140; Item.damage = 140; Item.DamageType = DamageClass.Magic; Item.mana = 35; - Item.width = 106; - Item.height = 140; Item.useTime = 15; Item.useAnimation = 30; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3.5f; - Item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item20; Item.autoReuse = true; @@ -37,7 +37,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.shootSpeed = 30f; } - + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { float flameSpeed = Item.shootSpeed; diff --git a/Items/Weapons/Magic/TerraRay.cs b/Items/Weapons/Magic/Photosynthesis.cs similarity index 67% rename from Items/Weapons/Magic/TerraRay.cs rename to Items/Weapons/Magic/Photosynthesis.cs index 0250a56571..d3bb5f9161 100644 --- a/Items/Weapons/Magic/TerraRay.cs +++ b/Items/Weapons/Magic/Photosynthesis.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -8,42 +9,48 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Magic { - public class TerraRay : ModItem, ILocalizedModType + [LegacyName("TerraRay")] + public class Photosynthesis : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetStaticDefaults() { - Item.staff[Item.type] = true; + Item.staff[Item.type] = true; } public override void SetDefaults() { + Item.width = 78; + Item.height = 78; Item.damage = 60; Item.DamageType = DamageClass.Magic; Item.mana = 10; - Item.width = 54; - Item.height = 54; Item.useTime = 24; Item.useAnimation = 24; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 4f; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; Item.UseSound = SoundID.Item60; Item.autoReuse = true; - Item.shoot = ModContent.ProjectileType(); + Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 6f; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { Vector2 shootVelocity = velocity; - Vector2 shootPosition = position + shootVelocity * 8f; + Vector2 shootPosition = position + shootVelocity * 12f; Projectile.NewProjectile(source, shootPosition, shootVelocity, type, damage, knockback, player.whoAmI); return false; } + 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/Magic/PhotosynthesisGlow").Value); + } + public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Weapons/Magic/Photosynthesis.png b/Items/Weapons/Magic/Photosynthesis.png new file mode 100644 index 0000000000..e449e8976d Binary files /dev/null and b/Items/Weapons/Magic/Photosynthesis.png differ diff --git a/Items/Weapons/Magic/PhotosynthesisGlow.png b/Items/Weapons/Magic/PhotosynthesisGlow.png new file mode 100644 index 0000000000..dc3a8eeab5 Binary files /dev/null and b/Items/Weapons/Magic/PhotosynthesisGlow.png differ diff --git a/Items/Weapons/Magic/PlagueStaff.cs b/Items/Weapons/Magic/PlagueStaff.cs index 8340e7a905..61462b4e87 100644 --- a/Items/Weapons/Magic/PlagueStaff.cs +++ b/Items/Weapons/Magic/PlagueStaff.cs @@ -17,17 +17,17 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { + Item.width = 46; + Item.height = 46; Item.damage = 70; Item.DamageType = DamageClass.Magic; Item.mana = 22; - Item.width = 46; - Item.height = 46; Item.useTime = 21; Item.useAnimation = 21; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 8f; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; Item.UseSound = SoundID.Item43; Item.autoReuse = true; @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.shootSpeed = 16f; } - + 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 < 3; i++) diff --git a/Items/Weapons/Magic/PlasmaRifle.cs b/Items/Weapons/Magic/PlasmaRifle.cs index 2f5f1f0980..24bb921c54 100644 --- a/Items/Weapons/Magic/PlasmaRifle.cs +++ b/Items/Weapons/Magic/PlasmaRifle.cs @@ -25,16 +25,16 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { + Item.width = 72; + Item.height = 20; Item.damage = 150; Item.mana = 40; Item.DamageType = DamageClass.Magic; - Item.width = 72; - Item.height = 20; Item.useTime = Item.useAnimation = 8; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 4f; - Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); Item.UseSound = CommonCalamitySounds.PlasmaBlastSound; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/PlasmaRod.cs b/Items/Weapons/Magic/PlasmaRod.cs index 8a40f9d43c..11b443fc00 100644 --- a/Items/Weapons/Magic/PlasmaRod.cs +++ b/Items/Weapons/Magic/PlasmaRod.cs @@ -11,22 +11,22 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetStaticDefaults() { - Item.staff[Item.type] = true; + Item.staff[Item.type] = true; } public override void SetDefaults() { + Item.width = 40; + Item.height = 40; Item.damage = 8; Item.DamageType = DamageClass.Magic; Item.mana = 10; - Item.width = 40; - Item.height = 40; Item.useTime = 20; Item.useAnimation = 20; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2.5f; - Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.rare = ItemRarityID.Blue; Item.UseSound = SoundID.Item109; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/Poseidon.cs b/Items/Weapons/Magic/Poseidon.cs index d8f8451f9a..d1de524308 100644 --- a/Items/Weapons/Magic/Poseidon.cs +++ b/Items/Weapons/Magic/Poseidon.cs @@ -12,17 +12,17 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetDefaults() { + Item.width = 28; + Item.height = 32; Item.damage = 52; Item.DamageType = DamageClass.Magic; Item.mana = 12; - Item.width = 28; - Item.height = 32; Item.useTime = 49; Item.useAnimation = 49; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 6f; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.UseSound = SoundID.Item84; Item.rare = ItemRarityID.Pink; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/PrimordialAncient.cs b/Items/Weapons/Magic/PrimordialAncient.cs index d5057c190a..0251a1c1d1 100644 --- a/Items/Weapons/Magic/PrimordialAncient.cs +++ b/Items/Weapons/Magic/PrimordialAncient.cs @@ -12,11 +12,11 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetDefaults() { + Item.width = 40; + Item.height = 56; Item.damage = 145; Item.DamageType = DamageClass.Magic; Item.mana = 16; - Item.width = 40; - Item.height = 56; Item.useTime = 18; Item.useAnimation = 18; Item.useStyle = ItemUseStyleID.Shoot; diff --git a/Items/Weapons/Magic/PrimordialEarth.cs b/Items/Weapons/Magic/PrimordialEarth.cs index d8bdc4063b..1e787d2d03 100644 --- a/Items/Weapons/Magic/PrimordialEarth.cs +++ b/Items/Weapons/Magic/PrimordialEarth.cs @@ -10,17 +10,17 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetDefaults() { + Item.width = 36; + Item.height = 42; Item.damage = 46; Item.DamageType = DamageClass.Magic; Item.mana = 19; - Item.width = 36; - Item.height = 42; Item.useTime = 20; Item.useAnimation = 20; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 7; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; Item.UseSound = SoundID.Item20; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/PurgeGuzzler.cs b/Items/Weapons/Magic/PurgeGuzzler.cs index e50400d2da..00e44ba34b 100644 --- a/Items/Weapons/Magic/PurgeGuzzler.cs +++ b/Items/Weapons/Magic/PurgeGuzzler.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 6f; - Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); } diff --git a/Items/Weapons/Magic/RainbowPartyCannon.cs b/Items/Weapons/Magic/RainbowPartyCannon.cs index 3e8c02c380..6eddc1e9c8 100644 --- a/Items/Weapons/Magic/RainbowPartyCannon.cs +++ b/Items/Weapons/Magic/RainbowPartyCannon.cs @@ -1,10 +1,10 @@ -using CalamityMod.Items.Materials; +using System.Collections.Generic; +using System.Linq; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; -using System.Collections.Generic; -using System.Linq; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -26,11 +26,11 @@ namespace CalamityMod.Items.Weapons.Magic }; public override void SetDefaults() { + Item.width = 52; + Item.height = 30; Item.damage = 225; Item.DamageType = DamageClass.Magic; Item.mana = 25; - Item.width = 52; - Item.height = 30; Item.crit += 4; Item.useTime = Item.useAnimation = 24; Item.useStyle = ItemUseStyleID.Shoot; diff --git a/Items/Weapons/Magic/Rancor.cs b/Items/Weapons/Magic/Rancor.cs index de80fd6cb6..67dcea1045 100644 --- a/Items/Weapons/Magic/Rancor.cs +++ b/Items/Weapons/Magic/Rancor.cs @@ -13,13 +13,13 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetDefaults() { - Item.damage = 220; + Item.width = 66; + Item.height = 82; + Item.damage = 290; Item.DamageType = DamageClass.Magic; Item.noUseGraphic = true; Item.channel = true; - Item.mana = 20; - Item.width = 66; - Item.height = 82; + Item.mana = 25; Item.useTime = 25; Item.useAnimation = 25; Item.useStyle = ItemUseStyleID.Shoot; @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.shootSpeed = 9f; Item.shoot = ModContent.ProjectileType(); - Item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.rare = ModContent.RarityType(); } diff --git a/Items/Weapons/Magic/RecitationoftheBeast.cs b/Items/Weapons/Magic/RecitationoftheBeast.cs index 35bf41c739..f3626fdbab 100644 --- a/Items/Weapons/Magic/RecitationoftheBeast.cs +++ b/Items/Weapons/Magic/RecitationoftheBeast.cs @@ -1,8 +1,8 @@ -using CalamityMod.Items.Materials; +using System; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; using CalamityMod.Rarities; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -15,10 +15,10 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetDefaults() { - Item.mana = 17; Item.width = 38; Item.height = 54; Item.damage = 128; + Item.mana = 17; Item.noMelee = true; Item.useAnimation = 18; Item.useStyle = ItemUseStyleID.Shoot; diff --git a/Items/Weapons/Magic/RelicofRuin.cs b/Items/Weapons/Magic/RelicofRuin.cs index ab12edf5c8..cae57f5144 100644 --- a/Items/Weapons/Magic/RelicofRuin.cs +++ b/Items/Weapons/Magic/RelicofRuin.cs @@ -12,17 +12,17 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetDefaults() { + Item.width = 34; + Item.height = 40; Item.damage = 21; Item.DamageType = DamageClass.Magic; Item.mana = 16; - Item.width = 34; - Item.height = 40; Item.useTime = 35; Item.useAnimation = 35; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 4.25f; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item84; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/RougeSlash.cs b/Items/Weapons/Magic/RougeSlash.cs index 786ae3db49..e9975d1d74 100644 --- a/Items/Weapons/Magic/RougeSlash.cs +++ b/Items/Weapons/Magic/RougeSlash.cs @@ -12,10 +12,10 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetDefaults() { - Item.damage = 119; - Item.DamageType = DamageClass.Magic; Item.mana = 30; Item.width = 28; + Item.damage = 119; + Item.DamageType = DamageClass.Magic; Item.height = 32; Item.useTime = 19; Item.useAnimation = 19; @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.noMelee = true; Item.knockBack = 7.5f; Item.UseSound = SoundID.Item91; - Item.value = CalamityGlobalItem.Rarity11BuyPrice; + Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; Item.rare = ItemRarityID.Purple; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/SHPC.cs b/Items/Weapons/Magic/SHPC.cs index 7d7ab604d2..0504374faf 100644 --- a/Items/Weapons/Magic/SHPC.cs +++ b/Items/Weapons/Magic/SHPC.cs @@ -1,12 +1,12 @@ -using CalamityMod.Items.Materials; +using System.Collections.Generic; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; +using CalamityMod.Sounds; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using System.Collections.Generic; -using CalamityMod.Sounds; namespace CalamityMod.Items.Weapons.Magic { @@ -15,16 +15,16 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetStaticDefaults() { - ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; + ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; } public override void SetDefaults() { - Item.damage = 18; - Item.DamageType = DamageClass.Magic; - Item.mana = 20; Item.width = 124; Item.height = 52; + Item.damage = 16; + Item.DamageType = DamageClass.Magic; + Item.mana = 20; Item.useTime = Item.useAnimation = 7; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 20f; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; } diff --git a/Items/Weapons/Magic/SandstreamScepter.cs b/Items/Weapons/Magic/SandstreamScepter.cs index 373bad9e2e..942ba48deb 100644 --- a/Items/Weapons/Magic/SandstreamScepter.cs +++ b/Items/Weapons/Magic/SandstreamScepter.cs @@ -18,17 +18,17 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { + Item.width = 46; + Item.height = 40; Item.damage = 16; Item.DamageType = DamageClass.Magic; Item.mana = 4; - Item.width = 46; - Item.height = 40; Item.useTime = 20; Item.useAnimation = 20; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 1f; - Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; Item.UseSound = SoundID.Item72; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/SanguineFlare.cs b/Items/Weapons/Magic/SanguineFlare.cs index 987fac7a18..23cb3d0aea 100644 --- a/Items/Weapons/Magic/SanguineFlare.cs +++ b/Items/Weapons/Magic/SanguineFlare.cs @@ -19,17 +19,17 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { + Item.width = 56; + Item.height = 60; Item.damage = 143; Item.DamageType = DamageClass.Magic; Item.mana = 22; - Item.width = 56; - Item.height = 60; Item.useTime = 25; Item.useAnimation = 25; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 8f; - Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item20; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/SeethingDischarge.cs b/Items/Weapons/Magic/SeethingDischarge.cs index 286e033820..ccb6632d8c 100644 --- a/Items/Weapons/Magic/SeethingDischarge.cs +++ b/Items/Weapons/Magic/SeethingDischarge.cs @@ -1,10 +1,10 @@ using CalamityMod.Projectiles.Magic; +using CalamityMod.Sounds; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Sounds; namespace CalamityMod.Items.Weapons.Magic { @@ -13,18 +13,18 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetDefaults() { + Item.width = 28; + Item.height = 32; Item.damage = 52; Item.DamageType = DamageClass.Magic; Item.mana = 15; - Item.width = 28; - Item.height = 32; Item.useTime = 24; Item.useAnimation = 24; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 6.75f; Item.UseSound = CommonCalamitySounds.FlareSound; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/Serpentine.cs b/Items/Weapons/Magic/Serpentine.cs index 79be20f88e..7753b8bbea 100644 --- a/Items/Weapons/Magic/Serpentine.cs +++ b/Items/Weapons/Magic/Serpentine.cs @@ -1,6 +1,6 @@ -using CalamityMod.Projectiles.Magic; +using System; +using CalamityMod.Projectiles.Magic; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -13,17 +13,17 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetDefaults() { + Item.width = 28; + Item.height = 32; Item.damage = 10; Item.DamageType = DamageClass.Magic; Item.mana = 20; - Item.width = 28; - Item.height = 32; Item.useTime = 35; Item.useAnimation = 35; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3f; - Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; Item.UseSound = SoundID.Item20; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/ShadecrystalTome.cs b/Items/Weapons/Magic/ShadecrystalBarrage.cs similarity index 53% rename from Items/Weapons/Magic/ShadecrystalTome.cs rename to Items/Weapons/Magic/ShadecrystalBarrage.cs index 974d0ea9f7..1858eb3dc1 100644 --- a/Items/Weapons/Magic/ShadecrystalTome.cs +++ b/Items/Weapons/Magic/ShadecrystalBarrage.cs @@ -8,37 +8,46 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Magic { - public class ShadecrystalTome : ModItem, ILocalizedModType + [LegacyName("ShadecrystalTome")] + public class ShadecrystalBarrage : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Magic"; + + internal const float ShootSpeed = 2f; + public override void SetDefaults() { - Item.damage = 25; - Item.DamageType = DamageClass.Magic; - Item.mana = 4; Item.width = 28; Item.height = 30; - Item.useTime = 6; - Item.useAnimation = 6; + Item.damage = 24; + Item.DamageType = DamageClass.Magic; + Item.mana = 10; + Item.useTime = 7; + Item.useAnimation = 14; + Item.reuseDelay = 49; + Item.useLimitPerAnimation = 3; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; - Item.knockBack = 5.5f; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.knockBack = 5f; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item9; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 16f; + Item.shootSpeed = ShootSpeed; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - int projAmt = Main.rand.Next(1, 3); - for (int index = 0; index < projAmt; ++index) + int projAmt = 6; + float maxSpread = ShootSpeed * 0.25f; + Vector2 cachedVelocity = velocity; + Vector2 newPosition = position + velocity.SafeNormalize(Vector2.UnitY) * 20f; + for (int index = 0; index < projAmt; index++) { - float SpeedX = velocity.X + Main.rand.Next(-40, 41) * 0.05f; - float SpeedY = velocity.Y + Main.rand.Next(-40, 41) * 0.05f; - Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI); + velocity += new Vector2(Main.rand.NextFloat(-maxSpread, maxSpread), Main.rand.NextFloat(-maxSpread, maxSpread)); + Projectile.NewProjectile(source, newPosition, velocity, type, damage, knockback, player.whoAmI, 0f, MathHelper.Lerp(1.04f, 1.09f, index / (float)(projAmt - 1))); + velocity = cachedVelocity; } return false; } diff --git a/Items/Weapons/Magic/ShadecrystalTome.png b/Items/Weapons/Magic/ShadecrystalBarrage.png similarity index 100% rename from Items/Weapons/Magic/ShadecrystalTome.png rename to Items/Weapons/Magic/ShadecrystalBarrage.png diff --git a/Items/Weapons/Magic/ShaderainStaff.cs b/Items/Weapons/Magic/ShaderainStaff.cs index 7619db4d7a..b77a1b5a43 100644 --- a/Items/Weapons/Magic/ShaderainStaff.cs +++ b/Items/Weapons/Magic/ShaderainStaff.cs @@ -14,14 +14,14 @@ namespace CalamityMod.Items.Weapons.Magic #region Other stats // Stats for the shaderain. - public const int RainAmount = 3; - public const float LesserRainVELMultiplier = 0.75f; // The lowest speed modifier the rain can get. - public const float HigherRainVELMultiplier = 1.25f; // The highest speed modifier the rain can get. + public const int RainAmount = 2; + public const float LesserRainVELMultiplier = 0.9f; // The lowest speed modifier the rain can get. + public const float HigherRainVELMultiplier = 1.2f; // The highest speed modifier the rain can get. public const float GravityStrenght = 0.15f; // Stats for the shade clouds. public const int FadeoutSpeed = 2; - public const float CloudDMGMultiplier = 1.25f; + public const float CloudDMGMultiplier = 1f; // Keeping this here in case it gets changed in the future public const float CloudVELMultiplier = 1.25f; public const float DeaccelerationStrenght = 0.95f; // A number lower than 1, non-including 1, changing it very slightly will have drastic results. @@ -34,20 +34,20 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - Item.damage = 21; - Item.shootSpeed = 10f; - Item.useTime = Item.useAnimation = 25; + Item.width = Item.height = 42; + Item.damage = 20; + Item.shootSpeed = 11f; + Item.useTime = Item.useAnimation = 30; Item.mana = 10; Item.knockBack = 0f; Item.shoot = ModContent.ProjectileType(); - Item.width = Item.height = 42; Item.DamageType = DamageClass.Magic; Item.useStyle = ItemUseStyleID.Shoot; Item.UseSound = SoundID.Item66; Item.rare = ItemRarityID.Orange; - Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.autoReuse = true; Item.noMelee = true; } diff --git a/Items/Weapons/Magic/ShadowboltStaff.cs b/Items/Weapons/Magic/ShadowboltStaff.cs index 755f497ea1..593ac52488 100644 --- a/Items/Weapons/Magic/ShadowboltStaff.cs +++ b/Items/Weapons/Magic/ShadowboltStaff.cs @@ -18,17 +18,17 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { + Item.width = 58; + Item.height = 56; Item.damage = 280; Item.DamageType = DamageClass.Magic; Item.mana = 20; - Item.width = 58; - Item.height = 56; Item.useTime = 14; Item.useAnimation = 14; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 8f; - Item.value = CalamityGlobalItem.Rarity13BuyPrice; + Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; Item.UseSound = SoundID.Item72; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/ShiftingSands.cs b/Items/Weapons/Magic/ShiftingSands.cs index 772baabb79..ca5991c6f6 100644 --- a/Items/Weapons/Magic/ShiftingSands.cs +++ b/Items/Weapons/Magic/ShiftingSands.cs @@ -11,6 +11,7 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetDefaults() { + Item.width = Item.height = 58; Item.damage = 76; Item.knockBack = 5f; Item.useTime = Item.useAnimation = 30; @@ -21,11 +22,10 @@ namespace CalamityMod.Items.Weapons.Magic Item.shootSpeed = 7f; Item.shoot = ModContent.ProjectileType(); - Item.width = Item.height = 58; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.UseSound = SoundID.Item20; - Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; } diff --git a/Items/Weapons/Magic/SkyGlaze.cs b/Items/Weapons/Magic/SkyGlaze.cs index 73c4148597..07705ba1b5 100644 --- a/Items/Weapons/Magic/SkyGlaze.cs +++ b/Items/Weapons/Magic/SkyGlaze.cs @@ -1,6 +1,6 @@ -using CalamityMod.Projectiles.Magic; +using System; +using CalamityMod.Projectiles.Magic; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -18,17 +18,17 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - Item.damage = 15; - Item.DamageType = DamageClass.Magic; - Item.mana = 8; Item.width = 52; Item.height = 74; + Item.damage = 8; + Item.DamageType = DamageClass.Magic; + Item.mana = 8; Item.useTime = 25; Item.useAnimation = 25; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3.5f; - Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.rare = ItemRarityID.Blue; Item.UseSound = SoundID.Item102; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/SlitheringEels.cs b/Items/Weapons/Magic/SlitheringEels.cs index 3b2001c678..64ddf0ec5d 100644 --- a/Items/Weapons/Magic/SlitheringEels.cs +++ b/Items/Weapons/Magic/SlitheringEels.cs @@ -12,16 +12,16 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetDefaults() { + Item.width = 34; + Item.height = 40; Item.damage = 50; Item.DamageType = DamageClass.Magic; Item.mana = 11; - Item.width = 34; - Item.height = 40; Item.useAnimation = Item.useTime = 40; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3f; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.NPCHit13; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/SnowstormStaff.cs b/Items/Weapons/Magic/SnowstormStaff.cs index 7635403a18..4d4c8e00f5 100644 --- a/Items/Weapons/Magic/SnowstormStaff.cs +++ b/Items/Weapons/Magic/SnowstormStaff.cs @@ -10,18 +10,18 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetDefaults() { - Item.damage = 49; - Item.DamageType = DamageClass.Magic; - Item.channel = true; - Item.mana = 13; Item.width = 66; Item.height = 66; - Item.useTime = 80; - Item.useAnimation = 80; + Item.damage = 39; + Item.DamageType = DamageClass.Magic; + Item.channel = true; + Item.mana = 18; + Item.useTime = 70; + Item.useAnimation = 70; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 5; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item46; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/SoulPiercer.cs b/Items/Weapons/Magic/SoulPiercer.cs index c0a66eb210..a0789ea6c9 100644 --- a/Items/Weapons/Magic/SoulPiercer.cs +++ b/Items/Weapons/Magic/SoulPiercer.cs @@ -20,11 +20,11 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { + Item.width = 64; + Item.height = 64; Item.damage = 310; Item.DamageType = DamageClass.Magic; Item.mana = 19; - Item.width = 64; - Item.height = 64; Item.useTime = Item.useAnimation = 25; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; diff --git a/Items/Weapons/Magic/StaffofBlushie.cs b/Items/Weapons/Magic/StaffofBlushie.cs index 16dbfa42f5..b8d8a4e951 100644 --- a/Items/Weapons/Magic/StaffofBlushie.cs +++ b/Items/Weapons/Magic/StaffofBlushie.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useTurn = false; Item.DamageType = DamageClass.Magic; - Item.value = CalamityGlobalItem.Rarity16BuyPrice; + Item.value = CalamityGlobalItem.RarityHotPinkBuyPrice; Item.rare = ModContent.RarityType(); Item.Calamity().devItem = true; @@ -39,7 +39,7 @@ namespace CalamityMod.Items.Weapons.Magic { CreateRecipe(). AddIngredient(ItemID.SapphireStaff). - AddIngredient(10). + AddIngredient(10). AddIngredient(5). AddTile(). Register(); diff --git a/Items/Weapons/Magic/StarShower.cs b/Items/Weapons/Magic/StarShower.cs index f18d8c054c..f1da7a9249 100644 --- a/Items/Weapons/Magic/StarShower.cs +++ b/Items/Weapons/Magic/StarShower.cs @@ -1,5 +1,6 @@ using CalamityMod.Projectiles.Magic; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -11,24 +12,27 @@ namespace CalamityMod.Items.Weapons.Magic public class StarShower : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Magic"; + + internal const float ShootSpeed = 28f; + public override void SetDefaults() { - Item.damage = 57; + Item.width = 38; + Item.height = 40; + Item.damage = 60; Item.DamageType = DamageClass.Magic; Item.mana = 15; Item.rare = ItemRarityID.Cyan; - Item.width = 38; - Item.height = 40; Item.useTime = 14; Item.useAnimation = 14; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3.25f; - Item.value = CalamityGlobalItem.Rarity9BuyPrice; + Item.value = CalamityGlobalItem.RarityCyanBuyPrice; Item.UseSound = SoundID.Item105; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 12f; + Item.shootSpeed = ShootSpeed; } // Terraria seems to really dislike high crit values in SetDefaults @@ -36,29 +40,18 @@ namespace CalamityMod.Items.Weapons.Magic public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - float starSpeed = Item.shootSpeed; - 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) + Vector2 destination = Main.MouseWorld; + position = destination - Vector2.UnitY * (Main.MouseWorld.Y - Main.screenPosition.Y + 80f); + Vector2 cachedPosition = position; + float maxRandomOffset = 16f; + int totalProjectiles = 5; + for (int i = 0; i < totalProjectiles; i++) { - mouseYDist = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - realPlayerPos.Y; - } - if ((float.IsNaN(mouseXDist) && float.IsNaN(mouseYDist)) || (mouseXDist == 0f && mouseYDist == 0f)) - { - mouseXDist = (float)player.direction; - mouseYDist = 0f; - } - float randXOffset = mouseXDist; - float randYOffset = mouseYDist; - randXOffset += (float)Main.rand.Next(-1, 2) * 0.5f; - randYOffset += (float)Main.rand.Next(-1, 2) * 0.5f; - realPlayerPos += new Vector2(randXOffset, randYOffset); - for (int i = 0; i < 5; i++) - { - float speedX4 = 2f + (float)Main.rand.Next(-8, 5); - float speedY5 = 15f + (float)Main.rand.Next(1, 6); - int star = Projectile.NewProjectile(source, realPlayerPos.X, realPlayerPos.Y, speedX4, speedY5, type, damage, knockback, player.whoAmI, 0f, 0f); + position.X += MathHelper.Lerp(-160f, 160f, i / (float)(totalProjectiles - 1)); + position += Main.rand.NextVector2Circular(maxRandomOffset, maxRandomOffset); + velocity = (Main.MouseWorld - position).SafeNormalize(Vector2.UnitY) * ShootSpeed * Main.rand.NextFloat(0.9f, 1.1f); + Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); + position = cachedPosition; } return false; } diff --git a/Items/Weapons/Magic/SubsumingVortex.cs b/Items/Weapons/Magic/SubsumingVortex.cs index 2d9b7816e3..debf53f5c6 100644 --- a/Items/Weapons/Magic/SubsumingVortex.cs +++ b/Items/Weapons/Magic/SubsumingVortex.cs @@ -7,9 +7,9 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; using Terraria.DataStructures; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; -using Terraria.GameContent; namespace CalamityMod.Items.Weapons.Magic { @@ -40,11 +40,13 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetStaticDefaults() { - ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; + ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; } public override void SetDefaults() { + Item.width = 86; + Item.height = 104; Item.damage = 466; Item.DamageType = DamageClass.Magic; Item.useTime = Item.useAnimation = 20; @@ -53,13 +55,10 @@ namespace CalamityMod.Items.Weapons.Magic Item.knockBack = 5f; Item.shoot = ModContent.ProjectileType(); - - Item.width = 86; - Item.height = 104; Item.useStyle = ItemUseStyleID.Shoot; Item.UseSound = SoundID.Item84; Item.rare = ModContent.RarityType(); - Item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.noMelee = true; Item.channel = true; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/TacticiansTrumpCard.cs b/Items/Weapons/Magic/TacticiansTrumpCard.cs index a3e4a5049e..59b23ff197 100644 --- a/Items/Weapons/Magic/TacticiansTrumpCard.cs +++ b/Items/Weapons/Magic/TacticiansTrumpCard.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.shoot = ModContent.ProjectileType(); Item.useStyle = ItemUseStyleID.Swing; Item.UseSound = SoundID.Item1; - Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; } diff --git a/Items/Weapons/Magic/TearsofHeaven.cs b/Items/Weapons/Magic/TearsofHeaven.cs index 176c36a0b0..142e3a62f1 100644 --- a/Items/Weapons/Magic/TearsofHeaven.cs +++ b/Items/Weapons/Magic/TearsofHeaven.cs @@ -3,6 +3,7 @@ using CalamityMod.Items.Placeables; using CalamityMod.Projectiles.Magic; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -11,22 +12,24 @@ namespace CalamityMod.Items.Weapons.Magic { public class TearsofHeaven : ModItem, ILocalizedModType { + public static readonly SoundStyle UseSound = new("CalamityMod/Sounds/Item/TearsOfHeavenUse"); + public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetDefaults() { + Item.width = 38; + Item.height = 48; Item.damage = 45; Item.DamageType = DamageClass.Magic; Item.mana = 18; - Item.width = 38; - Item.height = 48; Item.useTime = 20; Item.useAnimation = 20; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5.5f; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; - Item.UseSound = SoundID.Item8; + Item.UseSound = UseSound; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 5.5f; diff --git a/Items/Weapons/Magic/TerraRay.png b/Items/Weapons/Magic/TerraRay.png deleted file mode 100644 index ffeae7d03e..0000000000 Binary files a/Items/Weapons/Magic/TerraRay.png and /dev/null differ diff --git a/Items/Weapons/Magic/Teslastaff.cs b/Items/Weapons/Magic/Teslastaff.cs new file mode 100644 index 0000000000..2611504952 --- /dev/null +++ b/Items/Weapons/Magic/Teslastaff.cs @@ -0,0 +1,54 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Magic; +using CalamityMod.Rarities; +using CalamityMod.Sounds; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Magic +{ + public class Teslastaff : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Weapons.Magic"; + public override void SetStaticDefaults() + { + Item.staff[Type] = true; + } + + public override void SetDefaults() + { + Item.width = 38; + Item.height = 38; + Item.damage = 166; + Item.DamageType = DamageClass.Magic; + Item.mana = 10; + Item.useTime = 10; + Item.useAnimation = 10; + Item.useStyle = ItemUseStyleID.Shoot; + Item.UseSound = CommonCalamitySounds.LightningSound with { Pitch = 1.1f }; + Item.noMelee = true; + Item.channel = true; + Item.knockBack = 0f; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; + Item.rare = ModContent.RarityType(); + Item.Calamity().donorItem = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 30f; + Item.reuseDelay = 60; + } + + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.ThunderStaff). + AddRecipeGroup("AnyCopperBar", 20). + AddIngredient(2). + AddIngredient(6). + AddTile(TileID.LunarCraftingStation). + Register(); + } + } +} diff --git a/Items/Weapons/Magic/Teslastaff.png b/Items/Weapons/Magic/Teslastaff.png new file mode 100644 index 0000000000..d36c5aec94 Binary files /dev/null and b/Items/Weapons/Magic/Teslastaff.png differ diff --git a/Items/Weapons/Magic/TheDanceofLight.cs b/Items/Weapons/Magic/TheDanceofLight.cs index 2523050eee..347545910d 100644 --- a/Items/Weapons/Magic/TheDanceofLight.cs +++ b/Items/Weapons/Magic/TheDanceofLight.cs @@ -1,9 +1,9 @@ -using CalamityMod.Items.Materials; +using System; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -49,7 +49,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 14f; - Item.value = CalamityGlobalItem.Rarity16BuyPrice; + Item.value = CalamityGlobalItem.RarityHotPinkBuyPrice; Item.rare = ModContent.RarityType(); Item.Calamity().devItem = true; } diff --git a/Items/Weapons/Magic/ThePrince.cs b/Items/Weapons/Magic/ThePrince.cs index ee22757e76..d01a32eff6 100644 --- a/Items/Weapons/Magic/ThePrince.cs +++ b/Items/Weapons/Magic/ThePrince.cs @@ -15,19 +15,19 @@ namespace CalamityMod.Items.Weapons.Magic public const int FlameSplitCount = 6; public override void SetStaticDefaults() { - Item.staff[Item.type] = true; + Item.staff[Item.type] = true; } public override void SetDefaults() { + Item.width = 102; + Item.height = 112; Item.damage = 166; Item.knockBack = 4.25f; Item.shootSpeed = 23.5f; Item.DamageType = DamageClass.Magic; Item.noMelee = true; Item.mana = 12; - Item.width = 102; - Item.height = 112; Item.useTime = Item.useAnimation = 21; Item.useStyle = ItemUseStyleID.Shoot; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/TheSwarmer.cs b/Items/Weapons/Magic/TheSwarmer.cs index 26ae6be1e2..35d5d257f3 100644 --- a/Items/Weapons/Magic/TheSwarmer.cs +++ b/Items/Weapons/Magic/TheSwarmer.cs @@ -11,16 +11,16 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetDefaults() { + Item.width = 60; + Item.height = 52; Item.damage = 36; Item.DamageType = DamageClass.Magic; Item.mana = 14; - Item.width = 60; - Item.height = 52; Item.useTime = 12; Item.useAnimation = 12; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; - Item.value = CalamityGlobalItem.Rarity10BuyPrice; + Item.value = CalamityGlobalItem.RarityRedBuyPrice; Item.rare = ItemRarityID.Red; Item.UseSound = SoundID.Item11; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/TheWand.cs b/Items/Weapons/Magic/TheWand.cs index d6ef280c9e..38f0e17b33 100644 --- a/Items/Weapons/Magic/TheWand.cs +++ b/Items/Weapons/Magic/TheWand.cs @@ -23,6 +23,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { Item.width = 40; + Item.height = 36; Item.damage = 14; // same as 1.4 Wand of Sparking Item.mana = 150; Item.DamageType = DamageClass.Magic; @@ -34,8 +35,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.knockBack = 0.5f; Item.UseSound = SoundID.Item102; Item.autoReuse = true; - Item.height = 36; - Item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 24f; Item.rare = ModContent.RarityType(); @@ -52,7 +52,7 @@ namespace CalamityMod.Items.Weapons.Magic 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, 6); + Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, DustID.Torch); } public override void AddRecipes() diff --git a/Items/Weapons/Magic/ThornBlossom.cs b/Items/Weapons/Magic/ThornBlossom.cs index 8000a88fa3..0fe8425e06 100644 --- a/Items/Weapons/Magic/ThornBlossom.cs +++ b/Items/Weapons/Magic/ThornBlossom.cs @@ -19,17 +19,17 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - Item.damage = 90; - Item.DamageType = DamageClass.Magic; - Item.mana = 10; Item.width = 66; Item.height = 68; + Item.damage = 120; + Item.DamageType = DamageClass.Magic; + Item.mana = 10; Item.useTime = 23; Item.useAnimation = 23; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2f; - Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item109; Item.autoReuse = true; @@ -46,7 +46,7 @@ namespace CalamityMod.Items.Weapons.Magic } for (int index = 0; index < 3; ++index) { - Projectile.NewProjectile(source, position, velocity.RotatedByRandom(MathHelper.ToRadians(30f)) * 1.5f, ModContent.ProjectileType(), (int)(damage * 1.10), knockback, player.whoAmI); + Projectile.NewProjectile(source, position, velocity.RotatedByRandom(MathHelper.ToRadians(30f)) * 1.5f, ModContent.ProjectileType(), (int)(damage * 1.35), knockback, player.whoAmI); } Projectile.NewProjectile(source, position, velocity * 0.66f, type, damage, knockback, player.whoAmI, 1f); return false; diff --git a/Items/Weapons/Magic/Thunderstorm.cs b/Items/Weapons/Magic/Thunderstorm.cs index 35e4fe683a..2309058e6c 100644 --- a/Items/Weapons/Magic/Thunderstorm.cs +++ b/Items/Weapons/Magic/Thunderstorm.cs @@ -12,17 +12,17 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetDefaults() { + Item.width = 48; + Item.height = 22; Item.damage = 132; Item.mana = 50; Item.DamageType = DamageClass.Magic; - Item.width = 48; - Item.height = 22; Item.useTime = 24; Item.useAnimation = 24; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2f; - Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); Item.UseSound = CommonCalamitySounds.PlasmaBlastSound; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/TomeofFates.cs b/Items/Weapons/Magic/TomeofFates.cs index d8c61b2b77..b8e8d2c3de 100644 --- a/Items/Weapons/Magic/TomeofFates.cs +++ b/Items/Weapons/Magic/TomeofFates.cs @@ -13,18 +13,18 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetDefaults() { + Item.width = 28; + Item.height = 30; Item.damage = 110; Item.DamageType = DamageClass.Magic; Item.mana = 8; - Item.width = 28; - Item.height = 30; Item.useTime = 5; Item.useAnimation = 20; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3.5f; - Item.value = CalamityGlobalItem.Rarity9BuyPrice; - Item.rare = ItemRarityID.Cyan; + Item.value = CalamityGlobalItem.RarityRedBuyPrice; + Item.rare = ItemRarityID.Red; Item.UseSound = SoundID.Item103; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/Tradewinds.cs b/Items/Weapons/Magic/Tradewinds.cs index abfdeb482d..64a725372a 100644 --- a/Items/Weapons/Magic/Tradewinds.cs +++ b/Items/Weapons/Magic/Tradewinds.cs @@ -11,17 +11,17 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetDefaults() { - Item.damage = 25; - Item.DamageType = DamageClass.Magic; - Item.mana = 5; Item.width = 28; Item.height = 30; + Item.damage = 23; + Item.DamageType = DamageClass.Magic; + Item.mana = 5; Item.useTime = 12; Item.useAnimation = 12; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5; - Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; Item.UseSound = SoundID.Item7; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/UltraLiquidator.cs b/Items/Weapons/Magic/UltraLiquidator.cs index e10dbf1090..7e3fc41370 100644 --- a/Items/Weapons/Magic/UltraLiquidator.cs +++ b/Items/Weapons/Magic/UltraLiquidator.cs @@ -18,6 +18,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { + Item.width = Item.height = 70; Item.damage = 120; Item.knockBack = 5f; Item.useTime = 3; @@ -29,11 +30,10 @@ namespace CalamityMod.Items.Weapons.Magic Item.shootSpeed = 16f; Item.shoot = ModContent.ProjectileType(); - Item.width = Item.height = 70; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.UseSound = SoundID.Item9; - Item.value = CalamityGlobalItem.Rarity11BuyPrice; + Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; Item.rare = ItemRarityID.Purple; } diff --git a/Items/Weapons/Magic/UndinesRetribution.cs b/Items/Weapons/Magic/UndinesRetribution.cs index e075d8a142..85490b1564 100644 --- a/Items/Weapons/Magic/UndinesRetribution.cs +++ b/Items/Weapons/Magic/UndinesRetribution.cs @@ -1,8 +1,8 @@ -using CalamityMod.Items.Materials; +using System; +using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; using CalamityMod.Projectiles.Magic; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -20,17 +20,17 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - Item.damage = 38; - Item.DamageType = DamageClass.Magic; - Item.mana = 15; Item.width = 64; Item.height = 64; + Item.damage = 46; + Item.DamageType = DamageClass.Magic; + Item.mana = 15; Item.useTime = 18; Item.useAnimation = 18; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3.5f; - Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; Item.UseSound = SoundID.Item66; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/VeeringWind.cs b/Items/Weapons/Magic/VeeringWind.cs index 5e666556f9..7adc9d4a4d 100644 --- a/Items/Weapons/Magic/VeeringWind.cs +++ b/Items/Weapons/Magic/VeeringWind.cs @@ -1,6 +1,6 @@ -using CalamityMod.Projectiles.Magic; +using System; +using CalamityMod.Projectiles.Magic; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -19,16 +19,16 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - Item.damage = 15; - Item.DamageType = DamageClass.Magic; - Item.mana = 20; Item.width = 28; Item.height = 32; + Item.damage = 19; + Item.DamageType = DamageClass.Magic; + Item.mana = 14; Item.useTime = Item.useAnimation = 36; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 10f; - Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; Item.Calamity().donorItem = true; Item.UseSound = SoundID.Item66; @@ -47,6 +47,12 @@ namespace CalamityMod.Items.Weapons.Magic public override float UseSpeedMultiplier(Player player) => player.altFunctionUse == 2 ? 0.5f : 1f; + public override void ModifyManaCost(Player player, ref float reduce, ref float mult) + { + if (player.altFunctionUse == 2) + mult *= 2f; + } + public override void ModifyShootStats(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) { if (player.altFunctionUse == 2) @@ -59,7 +65,7 @@ namespace CalamityMod.Items.Weapons.Magic public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - int totalProjectiles = 24; + int totalProjectiles = 12; for (int i = 0; i < totalProjectiles; i++) { Vector2 waveVelocity = ((MathHelper.TwoPi * i / (float)totalProjectiles) + velocity.ToRotation()).ToRotationVector2() * velocity.Length(); diff --git a/Items/Weapons/Magic/Vehemence.cs b/Items/Weapons/Magic/Vehemence.cs index 46d0e759f9..f5304189d4 100644 --- a/Items/Weapons/Magic/Vehemence.cs +++ b/Items/Weapons/Magic/Vehemence.cs @@ -21,11 +21,11 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { + Item.width = 44; + Item.height = 44; Item.damage = 6666; Item.DamageType = DamageClass.Magic; Item.mana = 41; - Item.width = 44; - Item.height = 44; Item.useTime = Item.useAnimation = 43; Item.noUseGraphic = true; Item.channel = true; @@ -38,7 +38,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.shootSpeed = 16.5f; Item.rare = ModContent.RarityType(); - Item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.value = CalamityGlobalItem.RarityVioletBuyPrice; } 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/Magic/VenusianTrident.cs b/Items/Weapons/Magic/VenusianTrident.cs index 7f47f63025..275e0f2306 100644 --- a/Items/Weapons/Magic/VenusianTrident.cs +++ b/Items/Weapons/Magic/VenusianTrident.cs @@ -11,7 +11,6 @@ namespace CalamityMod.Items.Weapons.Magic public class VenusianTrident : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Magic"; - public static int BaseDamage = 256; public override void SetStaticDefaults() { @@ -20,17 +19,17 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - Item.damage = BaseDamage; - Item.DamageType = DamageClass.Magic; - Item.mana = 20; Item.width = 70; Item.height = 68; + Item.damage = 256; + Item.DamageType = DamageClass.Magic; + Item.mana = 20; Item.useTime = 25; Item.useAnimation = 25; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 9f; - Item.value = CalamityGlobalItem.Rarity13BuyPrice; + Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; Item.UseSound = SoundID.Item45; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/Vesuvius.cs b/Items/Weapons/Magic/Vesuvius.cs index ce81f4bfb9..3ed6924f0d 100644 --- a/Items/Weapons/Magic/Vesuvius.cs +++ b/Items/Weapons/Magic/Vesuvius.cs @@ -1,6 +1,6 @@ -using CalamityMod.Projectiles.Magic; +using System; +using CalamityMod.Projectiles.Magic; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -20,6 +20,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { Item.width = 62; + Item.height = 62; Item.damage = 50; Item.mana = 7; Item.DamageType = DamageClass.Magic; @@ -29,11 +30,10 @@ namespace CalamityMod.Items.Weapons.Magic Item.knockBack = 3f; Item.UseSound = SoundID.Item88; Item.autoReuse = true; - Item.height = 62; Item.shootSpeed = 20f; Item.shoot = ModContent.ProjectileType(); - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; } diff --git a/Items/Weapons/Magic/Viscera.cs b/Items/Weapons/Magic/Viscera.cs index 28a66b2938..f7c221a071 100644 --- a/Items/Weapons/Magic/Viscera.cs +++ b/Items/Weapons/Magic/Viscera.cs @@ -1,8 +1,11 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; +using CalamityMod.Projectiles.Ranged; using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -13,29 +16,46 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetStaticDefaults() { - Item.staff[Item.type] = true; + Item.staff[Item.type] = true; } + public const int BoomLifetime = 40; + public int Counter = 0; + public override void SetDefaults() { - Item.damage = 100; - Item.DamageType = DamageClass.Magic; - Item.mana = 15; Item.width = 50; Item.height = 52; - Item.useTime = 14; - Item.useAnimation = 14; + Item.damage = 229; + Item.DamageType = DamageClass.Magic; + Item.mana = 18; + Item.useTime = 7; + Item.useAnimation = 22; + Item.reuseDelay = 40; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; - Item.knockBack = 6f; - Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.knockBack = 5f; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); - Item.UseSound = SoundID.Item20; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 6f; } + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + { + Counter++; + SoundStyle fire = new("CalamityMod/Sounds/Item/MagnaCannonShot"); + SoundEngine.PlaySound(fire with { Volume = 0.2f, Pitch = 0.95f }, position); + position = position + velocity.RotatedBy(-0.75f * player.direction) * 1.8f; + + Projectile.NewProjectile(source, position, velocity.RotatedByRandom(0.025f), type, (int)(damage * (1 + (Counter - 1) * 0.2)), knockback, player.whoAmI, 0f, Counter == 4 ? 1 : 0); + if (Counter >= 4) + Counter = 0; + + return false; + } + public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Weapons/Magic/VitriolicViper.cs b/Items/Weapons/Magic/VitriolicViper.cs index 540eac5101..45cc02fd5a 100644 --- a/Items/Weapons/Magic/VitriolicViper.cs +++ b/Items/Weapons/Magic/VitriolicViper.cs @@ -18,11 +18,11 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { + Item.width = 60; + Item.height = 62; Item.damage = 93; Item.DamageType = DamageClass.Magic; Item.mana = 15; - Item.width = 60; - Item.height = 62; Item.useTime = Item.useAnimation = 16; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 20f; - Item.value = CalamityGlobalItem.Rarity13BuyPrice; + Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; Item.rare = ModContent.RarityType(); } diff --git a/Items/Weapons/Magic/VividClarity.cs b/Items/Weapons/Magic/VividClarity.cs index 209bd54617..0180a48fb2 100644 --- a/Items/Weapons/Magic/VividClarity.cs +++ b/Items/Weapons/Magic/VividClarity.cs @@ -3,6 +3,7 @@ using CalamityMod.Projectiles.Magic; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; using Terraria.DataStructures; @@ -24,11 +25,11 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { + Item.width = 140; + Item.height = 140; Item.damage = 133; Item.DamageType = DamageClass.Magic; Item.mana = 42; - Item.width = 90; - Item.height = 112; Item.useTime = 4; Item.useAnimation = 20; Item.reuseDelay = Item.useAnimation; @@ -36,7 +37,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 7.5f; - Item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.UseSound = UseSound; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); @@ -71,6 +72,11 @@ namespace CalamityMod.Items.Weapons.Magic return false; } + 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/Magic/VividClarityGlow").Value); + } + public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Weapons/Magic/VividClarity.png b/Items/Weapons/Magic/VividClarity.png index a09e59afd7..e0f181f0ed 100644 Binary files a/Items/Weapons/Magic/VividClarity.png and b/Items/Weapons/Magic/VividClarity.png differ diff --git a/Items/Weapons/Magic/VividClarityGlow.png b/Items/Weapons/Magic/VividClarityGlow.png new file mode 100644 index 0000000000..f404339f68 Binary files /dev/null and b/Items/Weapons/Magic/VividClarityGlow.png differ diff --git a/Items/Weapons/Magic/VoidVortex.cs b/Items/Weapons/Magic/VoidVortex.cs index b7b245e478..c60e56b414 100644 --- a/Items/Weapons/Magic/VoidVortex.cs +++ b/Items/Weapons/Magic/VoidVortex.cs @@ -13,7 +13,6 @@ namespace CalamityMod.Items.Weapons.Magic public class VoidVortex : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Magic"; - public const int OrbFireRate = 15; public override void SetStaticDefaults() { @@ -22,17 +21,17 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - Item.damage = 110; - Item.DamageType = DamageClass.Magic; - Item.mana = 60; Item.width = 130; Item.height = 130; - Item.useTime = 80; - Item.useAnimation = 80; + Item.damage = 210; + Item.DamageType = DamageClass.Magic; + Item.mana = 60; + Item.useTime = 49; + Item.useAnimation = 49; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 0f; - Item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item20; Item.autoReuse = true; @@ -44,21 +43,21 @@ namespace CalamityMod.Items.Weapons.Magic { int numOrbs = 12; Vector2 clickPos = Main.MouseWorld; - float orbDistance = 48f; - float orbSpeed = 5f; + float orbDistance = 90f; + float orbSpeed = 4f; float spinCoinflip = Main.rand.NextBool() ? -1f : 1f; Vector2 dir = Main.rand.NextVector2Unit(); for (int i = 0; i < numOrbs; i++) { Vector2 orbPos = clickPos + dir * orbDistance; - Vector2 vel = dir.RotatedBy(spinCoinflip * MathHelper.PiOver2) * orbSpeed; + Vector2 vel = dir.RotatedBy(spinCoinflip * -MathHelper.PiOver2) * orbSpeed; - // Choose random firing stagger values for each orb to create a desynchronized barrage of lasers - float timingStagger = Main.rand.Next(OrbFireRate); - Projectile.NewProjectile(source, orbPos, vel, type, damage, knockback, player.whoAmI, timingStagger, spinCoinflip); + Projectile.NewProjectile(source, orbPos, -vel, type, damage, knockback, player.whoAmI, i * 4, spinCoinflip); dir = dir.RotatedBy(MathHelper.TwoPi / numOrbs); } + // Big orb + Projectile.NewProjectile(source, clickPos, Vector2.Zero, type, damage * 4, 10, player.whoAmI, 0, spinCoinflip, 1); return false; } diff --git a/Items/Weapons/Magic/VoltaicClimax.cs b/Items/Weapons/Magic/VoltaicClimax.cs index 76e22c7213..a2bd468659 100644 --- a/Items/Weapons/Magic/VoltaicClimax.cs +++ b/Items/Weapons/Magic/VoltaicClimax.cs @@ -14,7 +14,6 @@ namespace CalamityMod.Items.Weapons.Magic public class VoltaicClimax : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Magic"; - public const int OrbFireRate = 10; public override void SetStaticDefaults() { @@ -23,17 +22,17 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - Item.damage = 104; - Item.DamageType = DamageClass.Magic; - Item.mana = 30; Item.width = 78; Item.height = 78; - Item.useTime = 33; - Item.useAnimation = 33; + Item.damage = 235; + Item.DamageType = DamageClass.Magic; + Item.mana = 32; + Item.useTime = 29; + Item.useAnimation = 29; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5f; - Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.UseSound = SoundID.Item20; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); @@ -43,15 +42,14 @@ namespace CalamityMod.Items.Weapons.Magic public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - int numOrbs = 8; + int numOrbs = 9; Vector2 clickPos = Main.MouseWorld; float orbSpeed = 14f; Vector2 vel = Main.rand.NextVector2CircularEdge(orbSpeed, orbSpeed); for (int i = 0; i < numOrbs; i++) { - // Choose random firing stagger values for each orb to create a desynchronized barrage of lasers - float timingStagger = Main.rand.Next(OrbFireRate); - Projectile.NewProjectile(source, clickPos, vel, type, damage, knockback, player.whoAmI, ai0: timingStagger); + float timingStagger = i * 2; + Projectile.NewProjectile(source, clickPos, vel, type, damage, knockback, player.whoAmI, timingStagger); vel = vel.RotatedBy(MathHelper.TwoPi / numOrbs); } diff --git a/Items/Weapons/Magic/Waywasher.cs b/Items/Weapons/Magic/Waywasher.cs index 1f96ab2463..add4b132bf 100644 --- a/Items/Weapons/Magic/Waywasher.cs +++ b/Items/Weapons/Magic/Waywasher.cs @@ -12,17 +12,17 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetDefaults() { + Item.width = 30; + Item.height = 30; Item.damage = 16; Item.DamageType = DamageClass.Magic; Item.mana = 4; - Item.width = 30; - Item.height = 30; Item.useTime = 15; Item.useAnimation = 15; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2.5f; - Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; Item.UseSound = SoundID.Item8; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/Wingman.cs b/Items/Weapons/Magic/Wingman.cs index 76d0eecf67..1526be5dd7 100644 --- a/Items/Weapons/Magic/Wingman.cs +++ b/Items/Weapons/Magic/Wingman.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Projectiles.Magic; +using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -11,31 +12,39 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetDefaults() { - Item.damage = 70; + Item.width = 44; + Item.height = 42; + Item.damage = 82; Item.DamageType = DamageClass.Magic; - Item.mana = 12; - Item.width = 42; - Item.height = 22; + Item.mana = 5; Item.useTime = 15; Item.useAnimation = 15; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; - Item.knockBack = 3f; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.knockBack = 1.5f; + Item.noUseGraphic = true; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; - Item.UseSound = SoundID.Item33; + Item.UseSound = null; Item.autoReuse = true; Item.shootSpeed = 25f; - Item.shoot = ProjectileID.LaserMachinegunLaser; + Item.shoot = ModContent.ProjectileType(); + Item.channel = true; } + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] < 2; + + // Makes the rotation of the mouse around the player sync in multiplayer. + public override void HoldItem(Player player) => player.Calamity().mouseRotationListener = true; + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - int beamAmt = 3; - for (int index = 0; index < beamAmt; ++index) + for (int i = 0; i < 2; i++) { - Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, 0f); + Projectile holdout = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0, 0, i == 0 ? 1 : -1); + holdout.velocity = (player.Calamity().mouseWorld - player.MountedCenter).SafeNormalize(Vector2.Zero); } + return false; } } diff --git a/Items/Weapons/Magic/Wingman.png b/Items/Weapons/Magic/Wingman.png index 05e9fe8993..f1030e5a6d 100644 Binary files a/Items/Weapons/Magic/Wingman.png and b/Items/Weapons/Magic/Wingman.png differ diff --git a/Items/Weapons/Magic/WingmanAlt.png b/Items/Weapons/Magic/WingmanAlt.png new file mode 100644 index 0000000000..bf6ca61d33 Binary files /dev/null and b/Items/Weapons/Magic/WingmanAlt.png differ diff --git a/Items/Weapons/Magic/WintersFury.cs b/Items/Weapons/Magic/WintersFury.cs index 3feb276886..73d7bf6a5e 100644 --- a/Items/Weapons/Magic/WintersFury.cs +++ b/Items/Weapons/Magic/WintersFury.cs @@ -1,7 +1,7 @@ -using CalamityMod.Projectiles.Magic; +using System; +using CalamityMod.Projectiles.Magic; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.Audio; using Terraria.DataStructures; @@ -16,28 +16,28 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { + Item.width = 36; + Item.height = 40; Item.damage = 70; Item.DamageType = DamageClass.Magic; Item.mana = 7; - Item.width = 36; - Item.height = 40; Item.useTime = 12; Item.useAnimation = 12; Item.useStyle = ItemUseStyleID.Shoot; Item.useTurn = false; Item.noMelee = true; Item.knockBack = 5f; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; Item.UseSound = SoundID.Item9; - Item.scale = 0.9f; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 15f; } + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - if (Main.rand.Next(4) != 0) + if (!Main.rand.NextBool(4)) { Vector2 speed = velocity.RotatedBy(MathHelper.ToRadians(Main.rand.Next(-15, 16))); speed.Normalize(); diff --git a/Items/Weapons/Magic/WrathoftheAncients.cs b/Items/Weapons/Magic/WrathoftheAncients.cs index 1f313c44bd..e7a48dcdec 100644 --- a/Items/Weapons/Magic/WrathoftheAncients.cs +++ b/Items/Weapons/Magic/WrathoftheAncients.cs @@ -11,17 +11,17 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetDefaults() { + Item.width = 28; + Item.height = 30; Item.damage = 47; Item.DamageType = DamageClass.Magic; Item.mana = 20; - Item.width = 28; - Item.height = 30; Item.useTime = 38; Item.useAnimation = 38; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 6f; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/WulfrumProsthesis.cs b/Items/Weapons/Magic/WulfrumProsthesis.cs index 826d3daaeb..359ed31119 100644 --- a/Items/Weapons/Magic/WulfrumProsthesis.cs +++ b/Items/Weapons/Magic/WulfrumProsthesis.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Magic { public new string LocalizationCategory => "Items.Weapons.Magic"; public static readonly SoundStyle ShootSound = new("CalamityMod/Sounds/Item/WulfrumProsthesisShoot") { PitchVariance = 0.1f, Volume = 0.55f }; - public static readonly SoundStyle HitSound = new("CalamityMod/Sounds/Item/WulfrumProsthesisHit") { PitchVariance = 0.1f, Volume = 0.75f , MaxInstances = 3}; + public static readonly SoundStyle HitSound = new("CalamityMod/Sounds/Item/WulfrumProsthesisHit") { PitchVariance = 0.1f, Volume = 0.75f, MaxInstances = 3 }; public static readonly SoundStyle SuckSound = new("CalamityMod/Sounds/Item/WulfrumProsthesisSucc") { Volume = 0.5f }; public static readonly SoundStyle SuckStopSound = new("CalamityMod/Sounds/Item/WulfrumProsthesisSuccStop") { Volume = 0.5f }; @@ -28,17 +28,17 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { + Item.width = 34; + Item.height = 42; Item.damage = 18; Item.DamageType = DamageClass.Magic; Item.mana = 5; - Item.width = 34; - Item.height = 42; Item.useTime = 24; Item.useAnimation = 24; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3; - Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.rare = ItemRarityID.Blue; Item.UseSound = ShootSound; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/WyvernsCall.cs b/Items/Weapons/Magic/WyvernsCall.cs index 17faebc105..36a2897fd8 100644 --- a/Items/Weapons/Magic/WyvernsCall.cs +++ b/Items/Weapons/Magic/WyvernsCall.cs @@ -1,6 +1,6 @@ -using CalamityMod.Projectiles.Magic; +using System; +using CalamityMod.Projectiles.Magic; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -18,17 +18,17 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { + Item.width = 52; + Item.height = 74; Item.damage = 65; Item.DamageType = DamageClass.Magic; Item.mana = 10; - Item.width = 52; - Item.height = 74; Item.useTime = 23; Item.useAnimation = 23; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 4.75f; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item102; Item.autoReuse = true; @@ -110,7 +110,7 @@ namespace CalamityMod.Items.Weapons.Magic CreateRecipe(). AddIngredient(). AddRecipeGroup("AnyMythrilBar", 5). - AddIngredient(ItemID.SoulofFlight, 15). + AddIngredient(ItemID.SoulofFlight, 15). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Magic/YharimsCrystal.cs b/Items/Weapons/Magic/YharimsCrystal.cs index 41281d23b1..d91a6096e9 100644 --- a/Items/Weapons/Magic/YharimsCrystal.cs +++ b/Items/Weapons/Magic/YharimsCrystal.cs @@ -16,11 +16,11 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetDefaults() { + Item.width = 16; + Item.height = 16; Item.damage = 65; Item.DamageType = DamageClass.Magic; Item.mana = 10; - Item.width = 16; - Item.height = 16; Item.useTime = Item.useAnimation = 10; Item.useStyle = ItemUseStyleID.Shoot; Item.UseSound = SoundID.Item13; @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 30f; - Item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.rare = ModContent.RarityType(); } diff --git a/Items/Weapons/Melee/AbsoluteZero.cs b/Items/Weapons/Melee/AbsoluteZero.cs index 8e6a019526..de9f7969e6 100644 --- a/Items/Weapons/Melee/AbsoluteZero.cs +++ b/Items/Weapons/Melee/AbsoluteZero.cs @@ -13,16 +13,16 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - Item.damage = 105; - Item.DamageType = DamageClass.Melee; Item.width = 58; Item.height = 58; + Item.damage = 75; + Item.DamageType = DamageClass.Melee; Item.useTime = 20; Item.useAnimation = 20; Item.useStyle = ItemUseStyleID.Swing; Item.useTurn = false; Item.knockBack = 4f; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; Item.UseSound = SoundID.Item1; Item.autoReuse = true; @@ -30,10 +30,6 @@ namespace CalamityMod.Items.Weapons.Melee Item.shootSpeed = 3f; } - public override void ModifyHitNPC(Player player, NPC target, ref NPC.HitModifiers modifiers) - { - modifiers.CritDamage *= 0.5f; - } public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(BuffID.Frostburn2, 300); diff --git a/Items/Weapons/Melee/AbyssBlade.cs b/Items/Weapons/Melee/AbyssBlade.cs index fc38d3a9f0..199a341c1a 100644 --- a/Items/Weapons/Melee/AbyssBlade.cs +++ b/Items/Weapons/Melee/AbyssBlade.cs @@ -4,6 +4,7 @@ using CalamityMod.Items.Placeables; using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -13,47 +14,27 @@ namespace CalamityMod.Items.Weapons.Melee public class AbyssBlade : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + public static readonly SoundStyle SpinSound = new("CalamityMod/Sounds/Item/SpinningWoosh") { Volume = 0.65f }; public override void SetDefaults() { Item.width = 74; Item.height = 74; - Item.damage = 130; + Item.damage = 140; + Item.knockBack = 7.5f; + Item.useTime = 65; + Item.useAnimation = 65; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 3f; + + Item.noMelee = true; + Item.noUseGraphic = true; Item.DamageType = DamageClass.Melee; - Item.useAnimation = 18; - Item.useTime = 18; - Item.useTurn = true; - Item.useStyle = ItemUseStyleID.Swing; - Item.knockBack = 8f; - Item.UseSound = SoundID.Item1; + Item.useStyle = ItemUseStyleID.Shoot; + Item.UseSound = null; Item.autoReuse = true; - Item.value = CalamityGlobalItem.Rarity7BuyPrice; + + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 9f; - } - - 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, (int)(damage * 0.75), knockback, player.whoAmI); - return false; - } - - 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, 33); - } - } - - public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 300); - } - - public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo) - { - target.AddBuff(ModContent.BuffType(), 300); } public override void AddRecipes() diff --git a/Items/Weapons/Melee/AegisBlade.cs b/Items/Weapons/Melee/AegisBlade.cs index 630cf718b5..9b76ece0bb 100644 --- a/Items/Weapons/Melee/AegisBlade.cs +++ b/Items/Weapons/Melee/AegisBlade.cs @@ -12,17 +12,16 @@ namespace CalamityMod.Items.Weapons.Melee public new string LocalizationCategory => "Items.Weapons.Melee"; public override void SetStaticDefaults() { - ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; + ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; } public override void SetDefaults() { Item.width = 72; Item.height = 72; - Item.scale = 1.2f; - Item.damage = 108; - Item.DamageType = DamageClass.Melee; - Item.useAnimation = Item.useTime = 15; + Item.damage = 152; + Item.DamageType = TrueMeleeDamageClass.Instance; + Item.useAnimation = Item.useTime = 16; Item.useTurn = true; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 4.25f; @@ -30,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.autoReuse = true; Item.shootSpeed = 14f; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; } @@ -43,12 +42,14 @@ namespace CalamityMod.Items.Weapons.Melee { if (player.altFunctionUse == 2) { + Item.DamageType = DamageClass.Melee; Item.noMelee = true; Item.UseSound = SoundID.Item73; Item.shoot = ModContent.ProjectileType(); } else { + Item.DamageType = TrueMeleeDamageClass.Instance; Item.noMelee = false; Item.UseSound = SoundID.Item1; Item.shoot = ProjectileID.None; @@ -56,13 +57,6 @@ namespace CalamityMod.Items.Weapons.Melee return base.CanUseItem(player); } - public override float UseSpeedMultiplier(Player player) - { - if (player.altFunctionUse != 2) - return 1f; - return 1.33f; - } - 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, ModContent.ProjectileType(), (int)(damage * 0.3), knockback, player.whoAmI); @@ -72,12 +66,7 @@ namespace CalamityMod.Items.Weapons.Melee 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, 246, 0f, 0f, 0, new Color(255, Main.DiscoG, 53)); - } - - public override void ModifyHitNPC(Player player, NPC target, ref NPC.HitModifiers modifiers) - { - modifiers.CritDamage *= 0.5f; + Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, DustID.GoldCoin, 0f, 0f, 0, new Color(255, Main.DiscoG, 53)); } public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) diff --git a/Items/Weapons/Melee/Aftershock.cs b/Items/Weapons/Melee/Aftershock.cs index 52de9634c0..aa4dcc8de9 100644 --- a/Items/Weapons/Melee/Aftershock.cs +++ b/Items/Weapons/Melee/Aftershock.cs @@ -1,7 +1,7 @@ -using CalamityMod.Buffs.StatDebuffs; +using System; +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -11,125 +11,45 @@ namespace CalamityMod.Items.Weapons.Melee public class Aftershock : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + + internal const float ShootSpeed = 12f; + public override void SetDefaults() { - Item.damage = 65; - Item.DamageType = DamageClass.Melee; Item.width = 54; Item.height = 58; - Item.scale = 1.75f; + Item.damage = 65; + Item.DamageType = DamageClass.Melee; Item.useTime = 28; Item.useAnimation = 28; Item.useTurn = true; Item.useStyle = ItemUseStyleID.Swing; - Item.knockBack = 7.5f; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.knockBack = 9f; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.shootSpeed = 12f; + Item.shootSpeed = ShootSpeed; } public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) { - var source = player.GetSource_ItemUse(Item); target.AddBuff(ModContent.BuffType(), 300); - float rockSpeed = Item.shootSpeed; - 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) - { - mouseYDist = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - realPlayerPos.Y; - } - float mouseDistance = (float)Math.Sqrt((double)(mouseXDist * mouseXDist + mouseYDist * mouseYDist)); - if ((float.IsNaN(mouseXDist) && float.IsNaN(mouseYDist)) || (mouseXDist == 0f && mouseYDist == 0f)) - { - mouseXDist = (float)player.direction; - mouseYDist = 0f; - mouseDistance = rockSpeed; - } - else - { - mouseDistance = rockSpeed / mouseDistance; - } - - realPlayerPos = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); - realPlayerPos.X = (realPlayerPos.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); - realPlayerPos.Y -= (float)100; - mouseXDist = (float)Main.mouseX + Main.screenPosition.X - realPlayerPos.X; - mouseYDist = (float)Main.mouseY + Main.screenPosition.Y - realPlayerPos.Y; - if (mouseYDist < 0f) - { - mouseYDist *= -1f; - } - if (mouseYDist < 20f) - { - mouseYDist = 20f; - } - mouseDistance = (float)Math.Sqrt((double)(mouseXDist * mouseXDist + mouseYDist * mouseYDist)); - mouseDistance = rockSpeed / mouseDistance; - mouseXDist *= mouseDistance; - mouseYDist *= mouseDistance; - float speedX4 = mouseXDist; - float speedY5 = mouseYDist + (float)Main.rand.Next(-10, 11) * 0.02f; + Vector2 destination = target.Center; + Vector2 position = destination - (Vector2.UnitY * (destination.Y - Main.screenPosition.Y + 80f)) + (Vector2.UnitX * Main.rand.Next(-160, 161)); + Vector2 velocity = (destination - position).SafeNormalize(Vector2.UnitY) * ShootSpeed * Main.rand.NextFloat(0.9f, 1.1f); int rockDamage = player.CalcIntDamage(Item.damage); - Projectile.NewProjectile(source, realPlayerPos.X, realPlayerPos.Y, speedX4, speedY5, ModContent.ProjectileType(), rockDamage, hit.Knockback, player.whoAmI, 0f, (float)Main.rand.Next(10)); + Projectile.NewProjectile(player.GetSource_ItemUse(Item), position, velocity, ModContent.ProjectileType(), rockDamage, hit.Knockback, player.whoAmI, 0f, (float)Main.rand.Next(10), target.Center.Y); } public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo) { - var source = player.GetSource_ItemUse(Item); target.AddBuff(ModContent.BuffType(), 300); - float rockSpeed = Item.shootSpeed; - 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) - { - mouseYDist = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - realPlayerPos.Y; - } - float mouseDistance = (float)Math.Sqrt((double)(mouseXDist * mouseXDist + mouseYDist * mouseYDist)); - if ((float.IsNaN(mouseXDist) && float.IsNaN(mouseYDist)) || (mouseXDist == 0f && mouseYDist == 0f)) - { - mouseXDist = (float)player.direction; - mouseYDist = 0f; - mouseDistance = rockSpeed; - } - else - { - mouseDistance = rockSpeed / mouseDistance; - } - - realPlayerPos = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); - realPlayerPos.X = (realPlayerPos.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); - realPlayerPos.Y -= (float)100; - mouseXDist = (float)Main.mouseX + Main.screenPosition.X - realPlayerPos.X; - mouseYDist = (float)Main.mouseY + Main.screenPosition.Y - realPlayerPos.Y; - if (mouseYDist < 0f) - { - mouseYDist *= -1f; - } - if (mouseYDist < 20f) - { - mouseYDist = 20f; - } - mouseDistance = (float)Math.Sqrt((double)(mouseXDist * mouseXDist + mouseYDist * mouseYDist)); - mouseDistance = rockSpeed / mouseDistance; - mouseXDist *= mouseDistance; - mouseYDist *= mouseDistance; - float speedX4 = mouseXDist; - float speedY5 = mouseYDist + (float)Main.rand.Next(-10, 11) * 0.02f; + Vector2 destination = target.Center; + Vector2 position = destination - (Vector2.UnitY * (destination.Y - Main.screenPosition.Y + 80f)) + (Vector2.UnitX * Main.rand.Next(-160, 161)); + Vector2 velocity = (destination - position).SafeNormalize(Vector2.UnitY) * ShootSpeed * Main.rand.NextFloat(0.9f, 1.1f); int rockDamage = player.CalcIntDamage(Item.damage); - Projectile.NewProjectile(source, realPlayerPos.X, realPlayerPos.Y, speedX4, speedY5, ModContent.ProjectileType(), rockDamage, Item.knockBack, player.whoAmI, 0f, (float)Main.rand.Next(10)); - } - - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool(5)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 32); - } + Projectile.NewProjectile(player.GetSource_ItemUse(Item), position, velocity, ModContent.ProjectileType(), rockDamage, Item.knockBack, player.whoAmI, 0f, (float)Main.rand.Next(10), target.Center.Y); } } } diff --git a/Items/Weapons/Melee/AirSpinner.cs b/Items/Weapons/Melee/AirSpinner.cs index 9f92c94c24..9fff13ee27 100644 --- a/Items/Weapons/Melee/AirSpinner.cs +++ b/Items/Weapons/Melee/AirSpinner.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Weapons.Melee public new string LocalizationCategory => "Items.Weapons.Melee"; public override void SetStaticDefaults() { - ItemID.Sets.Yoyo[Item.type] = true; + ItemID.Sets.Yoyo[Item.type] = true; ItemID.Sets.GamepadExtraRange[Item.type] = 15; ItemID.Sets.GamepadSmartQuickReach[Item.type] = true; } @@ -37,7 +37,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.shootSpeed = 14f; Item.rare = ItemRarityID.Orange; - Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; } public override void AddRecipes() diff --git a/Items/Weapons/Melee/AmidiasTrident.cs b/Items/Weapons/Melee/AmidiasTrident.cs index 1a717278bf..9624cbde95 100644 --- a/Items/Weapons/Melee/AmidiasTrident.cs +++ b/Items/Weapons/Melee/AmidiasTrident.cs @@ -16,6 +16,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { Item.width = 44; + Item.height = 44; Item.damage = 12; Item.DamageType = DamageClass.Melee; Item.noMelee = true; @@ -27,8 +28,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 4.5f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 44; - Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 6f; diff --git a/Items/Weapons/Melee/AnarchyBlade.cs b/Items/Weapons/Melee/AnarchyBlade.cs index 451030a25c..be42a6d88f 100644 --- a/Items/Weapons/Melee/AnarchyBlade.cs +++ b/Items/Weapons/Melee/AnarchyBlade.cs @@ -14,12 +14,12 @@ namespace CalamityMod.Items.Weapons.Melee public class AnarchyBlade : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; - private static int BaseDamage = 150; public override void SetDefaults() { Item.width = 114; - Item.damage = BaseDamage; + Item.height = 122; + Item.damage = 150; Item.DamageType = DamageClass.Melee; Item.useAnimation = 19; Item.useTime = 19; @@ -28,8 +28,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 7.5f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 122; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; } @@ -45,11 +44,6 @@ namespace CalamityMod.Items.Weapons.Melee int lifeAmount = player.statLifeMax2 - player.statLife; damage.Base += lifeAmount * 0.1f; } - - public override void ModifyHitNPC(Player player, NPC target, ref NPC.HitModifiers modifiers) - { - modifiers.CritDamage *= 0.5f; - } public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) { var source = player.GetSource_ItemUse(Item); diff --git a/Items/Weapons/Melee/Aorta.cs b/Items/Weapons/Melee/Aorta.cs index 3b1430ec38..182dab333b 100644 --- a/Items/Weapons/Melee/Aorta.cs +++ b/Items/Weapons/Melee/Aorta.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Weapons.Melee public new string LocalizationCategory => "Items.Weapons.Melee"; public override void SetStaticDefaults() { - ItemID.Sets.Yoyo[Item.type] = true; + ItemID.Sets.Yoyo[Item.type] = true; ItemID.Sets.GamepadExtraRange[Item.type] = 15; ItemID.Sets.GamepadSmartQuickReach[Item.type] = true; } @@ -37,7 +37,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.shootSpeed = 8f; Item.rare = ItemRarityID.Orange; - Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; } public override void AddRecipes() diff --git a/Items/Weapons/Melee/ArkoftheCosmos.cs b/Items/Weapons/Melee/ArkoftheCosmos.cs index a87334a2db..b2075df53f 100644 --- a/Items/Weapons/Melee/ArkoftheCosmos.cs +++ b/Items/Weapons/Melee/ArkoftheCosmos.cs @@ -1,13 +1,13 @@ -using CalamityMod.Items.Materials; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -26,7 +26,8 @@ namespace CalamityMod.Items.Weapons.Melee public static float MaxThrowReach = 760; public static float snapDamageMultiplier = 1.2f; //Extra damage from making the scissors snap - public static float chargeDamageMultiplier = 1.4f; //Extra damage from charge + public static float MaxCharge = 15f; // Maximum charge value AKA how much charge you get from a parry + public static float chargeDamageMultiplier = 1.35f; //Extra damage from charge public static float chainDamageMultiplier = 0.1f; public static int DashIframes = 10; @@ -85,7 +86,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 9.5f; Item.UseSound = null; Item.autoReuse = true; - Item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.shoot = ProjectileID.PurificationPowder; Item.shootSpeed = 28f; Item.rare = ModContent.RarityType(); @@ -202,7 +203,7 @@ namespace CalamityMod.Items.Weapons.Melee Vector2 barOrigin = barBG.Size() * 0.5f; float yOffset = 50f; Vector2 drawPos = position + Vector2.UnitY * scale * (frame.Height - yOffset); - Rectangle frameCrop = new Rectangle(0, 0, (int)(Charge / 10f * barFG.Width), barFG.Height); + Rectangle frameCrop = new Rectangle(0, 0, (int)(Charge / MaxCharge * barFG.Width), barFG.Height); Color color = Main.hslToRgb((Main.GlobalTimeWrappedHourly * 0.6f) % 1, 1, 0.75f + (float)Math.Sin(Main.GlobalTimeWrappedHourly * 3f) * 0.1f); spriteBatch.Draw(barBG, drawPos, null, color, 0f, barOrigin, scale * barScale, 0f, 0f); diff --git a/Items/Weapons/Melee/ArkoftheElements.cs b/Items/Weapons/Melee/ArkoftheElements.cs index 9408478f47..df934e2e7c 100644 --- a/Items/Weapons/Melee/ArkoftheElements.cs +++ b/Items/Weapons/Melee/ArkoftheElements.cs @@ -1,13 +1,13 @@ -using Terraria.DataStructures; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Melee public const float ComboLength = 4f; //How many regular swings before the long throw happens public static float snapDamageMultiplier = 1.2f; //Extra damage from making the scissors snap - public static float chargeDamageMultiplier = 1.2f; //Extra damage from charge + public static float chargeDamageMultiplier = 1.35f; //Extra damage from charge public static float needleDamageMultiplier = 0.8f; //Damage multiplier for non-homing needle projectile public static float glassStarDamageMultiplier = 0.2f; //Damage multiplier for the homing glass stars (4 glass stars per shot) @@ -64,7 +64,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 112; Item.height = 172; - Item.damage = 560; + Item.damage = 507; Item.DamageType = DamageClass.MeleeNoSpeed; Item.noUseGraphic = true; Item.noMelee = true; @@ -75,7 +75,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 8.5f; Item.UseSound = null; Item.autoReuse = true; - Item.value = CalamityGlobalItem.Rarity11BuyPrice; + Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; Item.rare = ItemRarityID.Purple; Item.shoot = ProjectileID.PurificationPowder; Item.shootSpeed = 16f; diff --git a/Items/Weapons/Melee/AstralBlade.cs b/Items/Weapons/Melee/AstralBlade.cs index a1d33cf7d0..46e95a74f6 100644 --- a/Items/Weapons/Melee/AstralBlade.cs +++ b/Items/Weapons/Melee/AstralBlade.cs @@ -1,12 +1,12 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Items.Weapons.Melee { public class AstralBlade : ModItem, ILocalizedModType @@ -14,17 +14,16 @@ namespace CalamityMod.Items.Weapons.Melee public new string LocalizationCategory => "Items.Weapons.Melee"; public override void SetDefaults() { - Item.damage = 85; - Item.DamageType = DamageClass.Melee; Item.width = 80; Item.height = 80; - Item.scale = 1.5f; + Item.damage = 142; + Item.DamageType = TrueMeleeDamageClass.Instance; Item.useTime = 12; Item.useAnimation = 12; Item.useTurn = true; Item.useStyle = ItemUseStyleID.Swing; - Item.knockBack = 4f; - Item.value = CalamityGlobalItem.Rarity9BuyPrice; + Item.knockBack = 6f; + Item.value = CalamityGlobalItem.RarityCyanBuyPrice; Item.rare = ItemRarityID.Cyan; Item.UseSound = SoundID.Item1; Item.autoReuse = true; @@ -33,15 +32,9 @@ 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 += 25; - public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 300); - } + public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 300); - public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo) - { - target.AddBuff(ModContent.BuffType(), 300); - } + public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo) => target.AddBuff(ModContent.BuffType(), 300); public override void MeleeEffects(Player player, Rectangle hitbox) { @@ -49,9 +42,7 @@ namespace CalamityMod.Items.Weapons.Melee { Dust d = CalamityUtils.MeleeDustHelper(player, Main.rand.NextBool() ? ModContent.DustType() : ModContent.DustType(), 0.7f, 55, 110, -0.07f, 0.07f); if (d != null) - { d.customData = 0.03f; - } } } @@ -62,7 +53,8 @@ namespace CalamityMod.Items.Weapons.Melee return; float lifeRatio = MathHelper.Clamp(target.life / (float)target.lifeMax, 0f, 1f); - float multiplier = MathHelper.Lerp(1f, 2f, lifeRatio); + float maxMultiplier = 1.25f; + float multiplier = MathHelper.Lerp(1f, maxMultiplier, lifeRatio); modifiers.SourceDamage *= multiplier; modifiers.Knockback *= multiplier; @@ -70,21 +62,19 @@ namespace CalamityMod.Items.Weapons.Melee if (Main.rand.NextBool((int)MathHelper.Clamp((Item.crit + player.GetCritChance()) * multiplier, 0f, 99f), 100)) modifiers.SetCrit(); - if (multiplier > 1.5f) + SoundEngine.PlaySound(SoundID.Item105, player.Center); + + bool blue = Main.rand.NextBool(); + float angleStart = Main.rand.NextFloat(0f, MathHelper.TwoPi); + float var = 0.05f + (maxMultiplier - multiplier); + for (float angle = 0f; angle < MathHelper.TwoPi; angle += var) { - SoundEngine.PlaySound(SoundID.Item105, player.Center); - bool blue = Main.rand.NextBool(); - float angleStart = Main.rand.NextFloat(0f, MathHelper.TwoPi); - float var = 0.05f + (2f - multiplier); - for (float angle = 0f; angle < MathHelper.TwoPi; angle += var) - { - blue = !blue; - Vector2 velocity = angle.ToRotationVector2() * (2f + (float)(Math.Sin(angleStart + angle * 3f) + 1) * 2.5f) * Main.rand.NextFloat(0.95f, 1.05f); - Dust d = Dust.NewDustPerfect(target.Center, blue ? ModContent.DustType() : ModContent.DustType(), velocity); - d.customData = 0.025f; - d.scale = multiplier - 0.75f; - d.noLight = false; - } + blue = !blue; + Vector2 velocity = angle.ToRotationVector2() * (2f + (float)(Math.Sin(angleStart + angle * 3f) + 1) * 2.5f) * Main.rand.NextFloat(0.95f, 1.05f); + Dust d = Dust.NewDustPerfect(target.Center, blue ? ModContent.DustType() : ModContent.DustType(), velocity); + d.customData = 0.025f; + d.scale = multiplier; + d.noLight = false; } } diff --git a/Items/Weapons/Melee/AstralPike.cs b/Items/Weapons/Melee/AstralPike.cs index 6498c457b2..d9d5da2e0a 100644 --- a/Items/Weapons/Melee/AstralPike.cs +++ b/Items/Weapons/Melee/AstralPike.cs @@ -17,6 +17,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { Item.width = 44; + Item.height = 50; Item.damage = 90; Item.DamageType = TrueMeleeDamageClass.Instance; Item.noMelee = true; @@ -28,8 +29,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 8.5f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 50; - Item.value = CalamityGlobalItem.Rarity9BuyPrice; + Item.value = CalamityGlobalItem.RarityCyanBuyPrice; Item.rare = ItemRarityID.Cyan; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 13f; diff --git a/Items/Weapons/Melee/AstralScythe.cs b/Items/Weapons/Melee/AstralScythe.cs index 41d62fe95f..da283e3c99 100644 --- a/Items/Weapons/Melee/AstralScythe.cs +++ b/Items/Weapons/Melee/AstralScythe.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 6f; Item.UseSound = SoundID.Item71; Item.autoReuse = true; - Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 5f; diff --git a/Items/Weapons/Melee/Ataraxia.cs b/Items/Weapons/Melee/Ataraxia.cs index cedac8448a..d02a6a5184 100644 --- a/Items/Weapons/Melee/Ataraxia.cs +++ b/Items/Weapons/Melee/Ataraxia.cs @@ -5,37 +5,38 @@ using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Items.Weapons.Melee { public class Ataraxia : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + public bool hitsound = true; public override void SetDefaults() { Item.width = 94; Item.height = 92; Item.DamageType = DamageClass.Melee; - Item.damage = 432; + Item.damage = 675; Item.knockBack = 2.5f; - Item.useAnimation = 19; - Item.useTime = 19; + Item.useAnimation = 10; + Item.useTime = 10; Item.autoReuse = true; Item.useTurn = true; Item.useStyle = ItemUseStyleID.Swing; Item.UseSound = SoundID.Item1; - Item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 9f; + Item.shootSpeed = 10f; } // Fires one large and two small projectiles which stay together in formation. @@ -46,12 +47,12 @@ namespace CalamityMod.Items.Weapons.Melee // Center projectile int centerID = ModContent.ProjectileType(); - int centerDamage = damage; + int centerDamage = (damage / 2); Projectile.NewProjectile(source, position, velocity, centerID, centerDamage, knockback, player.whoAmI, 0f, 0f); // Side projectiles (these deal 75% damage) int sideID = ModContent.ProjectileType(); - int sideDamage = (int)(0.75f * centerDamage); + int sideDamage = ((int)(0.75f * centerDamage) / 2); Vector2 originalVelocity = velocity; velocity.Normalize(); velocity *= 22f; @@ -60,19 +61,18 @@ namespace CalamityMod.Items.Weapons.Melee Vector2 rightOffset = velocity.RotatedBy(-MathHelper.PiOver4, default); leftOffset -= 1.4f * velocity; rightOffset -= 1.4f * velocity; - Projectile.NewProjectile(source, new Vector2(rrp.X + leftOffset.X, rrp.Y + leftOffset.Y), originalVelocity, sideID, sideDamage, knockback, player.whoAmI, 0f, 0f); - Projectile.NewProjectile(source, new Vector2(rrp.X + rightOffset.X, rrp.Y + rightOffset.Y), originalVelocity, sideID, sideDamage, knockback, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, new Vector2(rrp.X + leftOffset.X, rrp.Y + leftOffset.Y), originalVelocity, sideID, sideDamage, knockback, player.whoAmI, 0f, 1f); + Projectile.NewProjectile(source, new Vector2(rrp.X + rightOffset.X, rrp.Y + rightOffset.Y), originalVelocity, sideID, sideDamage, knockback, player.whoAmI, 0f, 2f); + hitsound = true; return false; } - // On-hit, tosses out five homing projectiles. This is not like Holy Collider. + // On-hit, explode for extra damage. public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(BuffID.ShadowFlame, 480); OnHitEffects(player, target.Center); } - - // On-hit, tosses out five homing projectiles. This is not like Holy Collider. public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo) { target.AddBuff(ModContent.BuffType(), 480); @@ -81,23 +81,18 @@ namespace CalamityMod.Items.Weapons.Melee private void OnHitEffects(Player player, Vector2 targetPos) { - // Individual true melee homing missiles deal 10% of the weapon's base damage. - int numSplits = 5; - int trueMeleeID = ModContent.ProjectileType(); - int trueMeleeDamage = (int)player.GetTotalDamage().ApplyTo(0.1f * Item.damage); - float angleVariance = MathHelper.TwoPi / (float)numSplits; - float spinOffsetAngle = MathHelper.Pi / (2f * numSplits); - var source = player.GetSource_ItemUse(Item); - Vector2 posVec = new Vector2(8f, 0f).RotatedByRandom(MathHelper.TwoPi); - - for (int i = 0; i < numSplits; ++i) + if (hitsound) { - posVec = posVec.RotatedBy(angleVariance); - Vector2 velocity = new Vector2(posVec.X, posVec.Y).RotatedBy(spinOffsetAngle); - velocity.Normalize(); - velocity *= 8f; - Projectile.NewProjectile(source, targetPos + posVec, velocity, trueMeleeID, trueMeleeDamage, Item.knockBack, player.whoAmI, 0.0f, 0.0f); + SoundStyle fire = new("CalamityMod/Sounds/Item/CursedDaggerThrow"); + SoundEngine.PlaySound(fire with { Volume = 0.5f, Pitch = 0.9f, PitchVariance = 0.2f, MaxInstances = -1 }, player.Center); + hitsound = false; } + + int trueMeleeID = ModContent.ProjectileType(); + int trueMeleeDamage = (int)player.GetTotalDamage().ApplyTo(0.7f * Item.damage); + var source = player.GetSource_ItemUse(Item); + Projectile.NewProjectile(source, targetPos, Vector2.Zero, trueMeleeID, trueMeleeDamage, Item.knockBack, player.whoAmI, 0.0f, 0.0f); + } // Spawn some fancy dust while swinging diff --git a/Items/Weapons/Melee/Avalanche.cs b/Items/Weapons/Melee/Avalanche.cs index 679c49f80c..d62182a121 100644 --- a/Items/Weapons/Melee/Avalanche.cs +++ b/Items/Weapons/Melee/Avalanche.cs @@ -1,6 +1,6 @@ -using CalamityMod.Projectiles.Melee; +using System; +using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -14,7 +14,6 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 64; Item.height = 64; - Item.scale = 1.5f; Item.damage = 100; Item.DamageType = DamageClass.Melee; Item.useAnimation = 35; @@ -24,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 7.25f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; } @@ -43,7 +42,7 @@ namespace CalamityMod.Items.Weapons.Melee for (int k = 0; k < totalProjectiles; k++) { Vector2 projRotation = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(source, target.Center, projRotation, type, bombDamage, hit.Knockback, Main.myPlayer); + Projectile.NewProjectile(source, target.Center, projRotation, type, bombDamage, hit.Knockback * 0.5f, Main.myPlayer); } } @@ -70,7 +69,7 @@ namespace CalamityMod.Items.Weapons.Melee { if (Main.rand.NextBool(3)) { - int iceDust = Dust.NewDust(new Vector2((float)hitbox.X, (float)hitbox.Y), hitbox.Width, hitbox.Height, 67, (float)(player.direction * 2), 0f, 150, default, 1.5f); + int iceDust = Dust.NewDust(new Vector2((float)hitbox.X, (float)hitbox.Y), hitbox.Width, hitbox.Height, DustID.IceRod, (float)(player.direction * 2), 0f, 150, default, 1.5f); Main.dust[iceDust].velocity *= 0.2f; } } diff --git a/Items/Weapons/Melee/Azathoth.cs b/Items/Weapons/Melee/Azathoth.cs index b24e39d4d6..3685b98f2f 100644 --- a/Items/Weapons/Melee/Azathoth.cs +++ b/Items/Weapons/Melee/Azathoth.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Weapons.Melee public new string LocalizationCategory => "Items.Weapons.Melee"; public override void SetStaticDefaults() { - ItemID.Sets.Yoyo[Item.type] = true; + ItemID.Sets.Yoyo[Item.type] = true; ItemID.Sets.GamepadExtraRange[Item.type] = 15; ItemID.Sets.GamepadSmartQuickReach[Item.type] = true; } @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.width = 40; Item.height = 54; Item.DamageType = DamageClass.MeleeNoSpeed; - Item.damage = 80; + Item.damage = 90; Item.knockBack = 6f; Item.useTime = 20; Item.useAnimation = 20; @@ -41,7 +41,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.autoReuse = true; Item.rare = ModContent.RarityType(); Item.Calamity().devItem = true; - Item.value = CalamityGlobalItem.Rarity16BuyPrice; + Item.value = CalamityGlobalItem.RarityHotPinkBuyPrice; } public override void AddRecipes() diff --git a/Items/Weapons/Melee/BalefulHarvester.cs b/Items/Weapons/Melee/BalefulHarvester.cs index 35015038ad..81bb2411b5 100644 --- a/Items/Weapons/Melee/BalefulHarvester.cs +++ b/Items/Weapons/Melee/BalefulHarvester.cs @@ -9,12 +9,12 @@ namespace CalamityMod.Items.Weapons.Melee public class BalefulHarvester : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + public override void SetDefaults() { - Item.damage = 90; Item.width = 74; Item.height = 86; - Item.scale = 1.5f; + Item.damage = 105; Item.DamageType = DamageClass.Melee; Item.useAnimation = 22; Item.useStyle = ItemUseStyleID.Swing; @@ -23,25 +23,21 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 8f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.value = CalamityGlobalItem.Rarity10BuyPrice; + Item.value = CalamityGlobalItem.RarityRedBuyPrice; Item.rare = ItemRarityID.Red; } - public override void ModifyHitNPC(Player player, NPC target, ref NPC.HitModifiers modifiers) - { - modifiers.CritDamage *= 0.5f; - } public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) { int type = Main.rand.NextBool() ? ModContent.ProjectileType() : ProjectileID.FlamingJack; - CalamityPlayer.HorsemansBladeOnHit(player, target.whoAmI, (int)(Item.damage * 1.5f), Item.knockBack, 0, type); + CalamityPlayer.HorsemansBladeOnHit(player, target.whoAmI, (int)(Item.damage * 1.5f), Item.knockBack * 0.5f, 0, type); target.AddBuff(BuffID.OnFire3, 300); } public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo) { int type = Main.rand.NextBool() ? ModContent.ProjectileType() : ProjectileID.FlamingJack; - CalamityPlayer.HorsemansBladeOnHit(player, -1, (int)(Item.damage * 1.5f), Item.knockBack, 0, type); + CalamityPlayer.HorsemansBladeOnHit(player, -1, (int)(Item.damage * 1.5f), Item.knockBack * 0.5f, 0, type); target.AddBuff(BuffID.OnFire3, 300); } diff --git a/Items/Weapons/Melee/BallOFugu.cs b/Items/Weapons/Melee/BallOFugu.cs index 2ccc85eda9..23f0581be8 100644 --- a/Items/Weapons/Melee/BallOFugu.cs +++ b/Items/Weapons/Melee/BallOFugu.cs @@ -10,17 +10,17 @@ namespace CalamityMod.Items.Weapons.Melee public new string LocalizationCategory => "Items.Weapons.Melee"; public override void SetDefaults() { - Item.damage = 40; - Item.DamageType = DamageClass.MeleeNoSpeed; Item.width = 30; Item.height = 10; + Item.damage = 40; + Item.DamageType = DamageClass.MeleeNoSpeed; Item.useTime = 20; Item.useAnimation = 20; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.noUseGraphic = true; Item.knockBack = 8f; - Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; Item.UseSound = SoundID.Item1; Item.autoReuse = true; diff --git a/Items/Weapons/Melee/BansheeHook.cs b/Items/Weapons/Melee/BansheeHook.cs index 9e3568bbbd..458b6276f9 100644 --- a/Items/Weapons/Melee/BansheeHook.cs +++ b/Items/Weapons/Melee/BansheeHook.cs @@ -1,8 +1,8 @@ -using CalamityMod.Projectiles.Melee.Spears; +using System; +using CalamityMod.Projectiles.Melee.Spears; using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -21,6 +21,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { Item.width = 120; + Item.height = 108; Item.damage = 250; Item.noMelee = true; Item.noUseGraphic = true; @@ -32,11 +33,10 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 8.5f; Item.UseSound = SoundID.DD2_GhastlyGlaivePierce; Item.autoReuse = true; - Item.height = 108; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 42f; - Item.value = CalamityGlobalItem.Rarity13BuyPrice; + Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; Item.rare = ModContent.RarityType(); } diff --git a/Items/Weapons/Melee/Basher.cs b/Items/Weapons/Melee/Basher.cs index 8f5356f226..ae3d491e6c 100644 --- a/Items/Weapons/Melee/Basher.cs +++ b/Items/Weapons/Melee/Basher.cs @@ -14,22 +14,22 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 56; Item.height = 60; - Item.damage = 30; - Item.scale = 1.05f; + Item.damage = 41; Item.DamageType = DamageClass.Melee; - Item.useAnimation = Item.useTime = 26; + Item.useAnimation = Item.useTime = 40; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 7f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.useTurn = true; - Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.rare = ItemRarityID.Blue; } public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(ModContent.BuffType(), 300); + target.AddBuff(BuffID.Poisoned, 60); } public override void AddRecipes() diff --git a/Items/Weapons/Melee/BladecrestOathsword.cs b/Items/Weapons/Melee/BladecrestOathsword.cs index 931e3562c0..066a995169 100644 --- a/Items/Weapons/Melee/BladecrestOathsword.cs +++ b/Items/Weapons/Melee/BladecrestOathsword.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 56; Item.height = 56; - Item.damage = 26; + Item.damage = 17; Item.DamageType = DamageClass.Melee; Item.useAnimation = 21; Item.useTime = 21; @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.noUseGraphic = true; Item.useTurn = false; Item.channel = true; - Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; Item.shootSpeed = 6f; // Set so the item isn't classified as true melee diff --git a/Items/Weapons/Melee/BlightedCleaver.cs b/Items/Weapons/Melee/BlightedCleaver.cs index d75e8fb973..176febb628 100644 --- a/Items/Weapons/Melee/BlightedCleaver.cs +++ b/Items/Weapons/Melee/BlightedCleaver.cs @@ -2,6 +2,7 @@ using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -11,43 +12,78 @@ namespace CalamityMod.Items.Weapons.Melee public class BlightedCleaver : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + public override void SetDefaults() { Item.width = 88; - Item.damage = 64; + Item.height = 88; + Item.damage = 92; Item.DamageType = DamageClass.Melee; - Item.useAnimation = 26; + Item.useAnimation = Item.useTime = 28; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 26; Item.useTurn = true; - Item.knockBack = 5.5f; + Item.knockBack = 8f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 88; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.shootsEveryUse = true; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 12f; + Item.shootSpeed = 16f; + } + + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + { + float adjustedItemScale = player.GetAdjustedItemScale(Item); + Projectile.NewProjectile(source, player.MountedCenter, velocity, type, (int)(damage * 0.75), knockback * 0.5f, player.whoAmI, (float)player.direction * player.gravDir, 32f, adjustedItemScale); + NetMessage.SendData(MessageID.PlayerControls, -1, -1, null, player.whoAmI); + return false; } public override void MeleeEffects(Player player, Rectangle hitbox) { - if (Main.rand.NextBool(5)) + if (Main.rand.NextBool(3)) { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 106); + int dustType = DustID.Venom; + switch (Main.rand.Next(5)) + { + default: + case 0: + case 1: + break; + + case 2: + dustType = DustID.RedTorch; + break; + + case 3: + dustType = DustID.CrimsonTorch; + break; + + case 4: + dustType = DustID.GreenFairy; + break; + } + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, dustType, 0f, 0f, 100, default, Main.rand.NextFloat(1.8f, 2.4f)); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0f; + if (dustType == DustID.Venom) + Main.dust[dust].fadeIn = 1.5f; } } public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) { player.AddBuff(ModContent.BuffType(), 180); - target.AddBuff(BuffID.Venom, 150); + target.AddBuff(BuffID.Venom, 240); + target.AddBuff(BuffID.OnFire3, 240); } public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo) { player.AddBuff(ModContent.BuffType(), 180); - target.AddBuff(BuffID.Venom, 150); + target.AddBuff(BuffID.Venom, 240); + target.AddBuff(BuffID.OnFire3, 240); } public override void AddRecipes() diff --git a/Items/Weapons/Melee/Bonebreaker.cs b/Items/Weapons/Melee/Bonebreaker.cs index c87cfa238a..a3a36efc90 100644 --- a/Items/Weapons/Melee/Bonebreaker.cs +++ b/Items/Weapons/Melee/Bonebreaker.cs @@ -1,5 +1,5 @@ -using CalamityMod.Projectiles.Melee; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Melee; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -13,18 +13,18 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { + Item.width = 32; + Item.height = 32; Item.useStyle = ItemUseStyleID.Swing; Item.useAnimation = 20; Item.useTime = 20; - Item.width = 32; - Item.height = 32; Item.damage = BaseDamage; Item.DamageType = DamageClass.MeleeNoSpeed; Item.knockBack = 7f; Item.UseSound = SoundID.Item1; Item.useTurn = true; Item.autoReuse = true; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.shoot = ModContent.ProjectileType(); Item.noMelee = true; diff --git a/Items/Weapons/Melee/TerraLance.cs b/Items/Weapons/Melee/BotanicPiercer.cs similarity index 67% rename from Items/Weapons/Melee/TerraLance.cs rename to Items/Weapons/Melee/BotanicPiercer.cs index d4e1cf9c66..5e75b4790b 100644 --- a/Items/Weapons/Melee/TerraLance.cs +++ b/Items/Weapons/Melee/BotanicPiercer.cs @@ -1,12 +1,15 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee.Spears; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Melee { - public class TerraLance : ModItem, ILocalizedModType + [LegacyName("TerraLance")] + public class BotanicPiercer : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; public override void SetStaticDefaults() @@ -16,7 +19,8 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - Item.width = 44; + Item.width = 112; + Item.height = 112; Item.damage = 88; Item.DamageType = DamageClass.Melee; Item.noMelee = true; @@ -28,15 +32,19 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 8.5f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 44; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; - Item.shoot = ModContent.ProjectileType(); + Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 11f; } public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; + 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/BotanicPiercerGlow").Value); + } + public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Weapons/Melee/BotanicPiercer.png b/Items/Weapons/Melee/BotanicPiercer.png new file mode 100644 index 0000000000..80e33f768e Binary files /dev/null and b/Items/Weapons/Melee/BotanicPiercer.png differ diff --git a/Items/Weapons/Melee/BotanicPiercerGlow.png b/Items/Weapons/Melee/BotanicPiercerGlow.png new file mode 100644 index 0000000000..89129d2873 Binary files /dev/null and b/Items/Weapons/Melee/BotanicPiercerGlow.png differ diff --git a/Items/Weapons/Melee/Brimlance.cs b/Items/Weapons/Melee/Brimlance.cs index bda81404f9..1666ed6820 100644 --- a/Items/Weapons/Melee/Brimlance.cs +++ b/Items/Weapons/Melee/Brimlance.cs @@ -16,6 +16,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { Item.width = 56; + Item.height = 56; Item.damage = 50; Item.DamageType = TrueMeleeDamageClass.Instance; Item.noMelee = true; @@ -27,8 +28,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 7.5f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 56; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; diff --git a/Items/Weapons/Melee/Brimlash.cs b/Items/Weapons/Melee/Brimlash.cs index a07ee466a2..2107039480 100644 --- a/Items/Weapons/Melee/Brimlash.cs +++ b/Items/Weapons/Melee/Brimlash.cs @@ -1,5 +1,5 @@ -using CalamityMod.Dusts; -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 6f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; diff --git a/Items/Weapons/Melee/BrimstoneSword.cs b/Items/Weapons/Melee/BrimstoneSword.cs index 0dce43282b..8407cb5eb2 100644 --- a/Items/Weapons/Melee/BrimstoneSword.cs +++ b/Items/Weapons/Melee/BrimstoneSword.cs @@ -1,10 +1,10 @@ -using Terraria.DataStructures; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; -using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -21,15 +21,14 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { + Item.width = Item.height = 52; Item.damage = 70; Item.DamageType = DamageClass.Melee; - Item.width = Item.height = 52; - Item.scale = 1.5f; Item.useAnimation = Item.useTime = 28; Item.useTurn = true; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 7.5f; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.shoot = ModContent.ProjectileType(); Item.UseSound = SoundID.Item1; @@ -69,11 +68,6 @@ namespace CalamityMod.Items.Weapons.Melee Item.noUseGraphic = true; } - public override void ModifyHitNPC(Player player, NPC target, ref NPC.HitModifiers modifiers) - { - modifiers.CritDamage *= 0.5f; - } - public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) { var source = player.GetSource_ItemUse(Item); diff --git a/Items/Weapons/Melee/BrinyBaron.cs b/Items/Weapons/Melee/BrinyBaron.cs index ba1a0f1a9b..108c8f20de 100644 --- a/Items/Weapons/Melee/BrinyBaron.cs +++ b/Items/Weapons/Melee/BrinyBaron.cs @@ -1,7 +1,8 @@ -using Terraria.DataStructures; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -17,6 +18,8 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { + Item.width = 100; + Item.height = 102; Item.damage = 182; Item.knockBack = 4f; Item.useAnimation = Item.useTime = 20; @@ -26,13 +29,10 @@ namespace CalamityMod.Items.Weapons.Melee Item.shootSpeed = 4f; Item.shoot = ModContent.ProjectileType(); - - Item.width = 100; - Item.height = 102; Item.useStyle = ItemUseStyleID.Swing; Item.UseSound = SoundID.Item1; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; } @@ -60,22 +60,18 @@ namespace CalamityMod.Items.Weapons.Melee type = ModContent.ProjectileType(); } - else + else type = ProjectileID.None; } 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, 187, 0f, 0f, 100, new Color(53, Main.DiscoG, 255)); - } - - public override void ModifyHitNPC(Player player, NPC target, ref NPC.HitModifiers modifiers) - { - modifiers.CritDamage *= 0.5f; + Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, DustID.Flare_Blue, 0f, 0f, 100, new Color(53, Main.DiscoG, 255)); } public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) { + target.AddBuff(ModContent.BuffType(), 180); var source = player.GetSource_ItemUse(Item); if (player.ownedProjectileCounts[ModContent.ProjectileType()] == 0) Projectile.NewProjectile(source, target.Center, Vector2.Zero, ModContent.ProjectileType(), Item.damage, Item.knockBack, player.whoAmI); @@ -83,10 +79,11 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo) { + target.AddBuff(ModContent.BuffType(), 180); var source = player.GetSource_ItemUse(Item); if (player.ownedProjectileCounts[ModContent.ProjectileType()] == 0) Projectile.NewProjectile(source, target.Center, Vector2.Zero, ModContent.ProjectileType(), Item.damage, Item.knockBack, player.whoAmI); - } + } public override void UseAnimation(Player player) { diff --git a/Items/Weapons/Melee/BrokenBiomeBlade.cs b/Items/Weapons/Melee/BrokenBiomeBlade.cs index 929f33f405..ebd82fb459 100644 --- a/Items/Weapons/Melee/BrokenBiomeBlade.cs +++ b/Items/Weapons/Melee/BrokenBiomeBlade.cs @@ -1,21 +1,21 @@ -using Terraria.DataStructures; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; using CalamityMod.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Particles; using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; using Terraria; +using Terraria.DataStructures; +using Terraria.GameContent; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; -using static Terraria.ModLoader.ModContent; using Terraria.ModLoader.IO; -using Terraria.GameContent; +using static Terraria.ModLoader.ModContent; namespace CalamityMod.Items.Weapons.Melee { @@ -30,24 +30,23 @@ namespace CalamityMod.Items.Weapons.Melee public int CanLunge = 1; #region stats - public static int BaseDamage = 47; + public static int BaseDamage = 38; - public static int DefaultAttunement_BaseDamage = 47; + public static int DefaultAttunement_BaseDamage = 38; - public static int EvilAttunement_BaseDamage = 63; + public static int EvilAttunement_BaseDamage = 50; public static int EvilAttunement_Lifesteal = 2; public static int EvilAttunement_BounceIFrames = 10; - public static int ColdAttunement_BaseDamage = 58; - public static float ColdAttunement_SecondSwingBoost = 1.14f; - public static float ColdAttunement_ThirdSwingBoost = 1.4f; + public static int ColdAttunement_BaseDamage = 40; + public static float ColdAttunement_ThirdSwingBoost = 1.15f; - public static int HotAttunement_BaseDamage = 70; - public static int HotAttunement_FullChargeDamage = 105; - public static int HotAttunement_ShredIFrames = 8; - public static int HotAttunement_LocalIFrames = 30; //Be warned its got one extra update so all the iframes should be divided in 2 - public static int HotAttunement_LocalIFramesCharged = 16; - public static float HotAttunement_ShredDecayRate = 0.7f; //How much charge is lost per frame. + public static int HotAttunement_BaseDamage = 35; + public static int HotAttunement_FullChargeDamage = 60; + public static int HotAttunement_ShredIFrames = 6; + public static int HotAttunement_LocalIFrames = 40; //Be warned its got one extra update so all the iframes should be divided in 2 + public static int HotAttunement_LocalIFramesCharged = 25; + public static float HotAttunement_ShredDecayRate = 1f; //How much charge is lost per frame. public static int TropicalAttunement_BaseDamage = 65; public static float TropicalAttunement_ChainDamageReduction = 0.6f; @@ -128,7 +127,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.shoot = ProjectileID.PurificationPowder; Item.knockBack = 5f; Item.autoReuse = true; - Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; Item.shootSpeed = 12f; } @@ -159,7 +158,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SaveData(TagCompound tag) { - int attunement1 = mainAttunement == null? -1 : (int)mainAttunement.id; + int attunement1 = mainAttunement == null ? -1 : (int)mainAttunement.id; int attunement2 = secondaryAttunement == null ? -1 : (int)secondaryAttunement.id; tag["mainAttunement"] = attunement1; tag["secondaryAttunement"] = attunement2; @@ -260,18 +259,21 @@ namespace CalamityMod.Items.Weapons.Melee public override bool CanUseItem(Player player) { - return !Main.projectile.Any(n => n.active && n.owner == player.whoAmI && + bool isRightClicking = player.altFunctionUse != ItemAlternativeFunctionID.None; + return !isRightClicking && !Main.projectile.Any(n => n.active && n.owner == player.whoAmI && (n.type == ProjectileType() || n.type == ProjectileType() || n.type == ProjectileType())); } + // 03FEB2024: Ozzatron: added so the Iban Blades don't break Overhaul compatibility. Weapons are functionally unchanged. + public override bool AltFunctionUse(Player player) => true; + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - if (mainAttunement == null) + if (mainAttunement == null || player.altFunctionUse != ItemAlternativeFunctionID.None) return false; - int powerLungeCounter = 0; //Unused here ComboResetTimer = 1f; return mainAttunement.Shoot(player, source, ref position, ref velocity.X, ref velocity.Y, ref type, ref damage, ref knockback, ref Combo, ref CanLunge, ref powerLungeCounter); diff --git a/Items/Weapons/Melee/SolarFlare.cs b/Items/Weapons/Melee/BurningRevelation.cs similarity index 82% rename from Items/Weapons/Melee/SolarFlare.cs rename to Items/Weapons/Melee/BurningRevelation.cs index ed462a8530..85c2b4d6e8 100644 --- a/Items/Weapons/Melee/SolarFlare.cs +++ b/Items/Weapons/Melee/BurningRevelation.cs @@ -5,7 +5,8 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Melee { - public class SolarFlare : ModItem, ILocalizedModType + [LegacyName("SolarFlare")] + public class BurningRevelation : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; public override void SetStaticDefaults() @@ -32,10 +33,10 @@ namespace CalamityMod.Items.Weapons.Melee Item.noUseGraphic = true; Item.noMelee = true; - Item.shoot = ModContent.ProjectileType(); + Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 16f; - Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); } } diff --git a/Items/Weapons/Melee/SolarFlare.png b/Items/Weapons/Melee/BurningRevelation.png similarity index 100% rename from Items/Weapons/Melee/SolarFlare.png rename to Items/Weapons/Melee/BurningRevelation.png diff --git a/Items/Weapons/Melee/BurntSienna.cs b/Items/Weapons/Melee/BurntSienna.cs index b704107387..d290ff5246 100644 --- a/Items/Weapons/Melee/BurntSienna.cs +++ b/Items/Weapons/Melee/BurntSienna.cs @@ -12,6 +12,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { Item.width = 42; + Item.height = 54; Item.damage = 32; Item.DamageType = DamageClass.Melee; Item.useAnimation = Item.useTime = 21; @@ -20,8 +21,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 5.5f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 54; - Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.rare = ItemRarityID.Blue; Item.shootSpeed = 5f; } @@ -56,7 +56,7 @@ namespace CalamityMod.Items.Weapons.Melee { if (Main.rand.NextBool(5)) { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 246); + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, DustID.GoldCoin); } } } diff --git a/Items/Weapons/Melee/Carnage.cs b/Items/Weapons/Melee/Carnage.cs index 2a3793b588..f1831a2ad1 100644 --- a/Items/Weapons/Melee/Carnage.cs +++ b/Items/Weapons/Melee/Carnage.cs @@ -1,9 +1,9 @@ using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Items.Weapons.Melee { @@ -13,6 +13,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { Item.width = 50; + Item.height = 54; Item.damage = 130; Item.DamageType = DamageClass.Melee; Item.useAnimation = 21; @@ -22,9 +23,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.useTurn = true; - Item.height = 54; - Item.scale = 1.25f; - Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; } diff --git a/Items/Weapons/Melee/CatastropheClaymore.cs b/Items/Weapons/Melee/CatastropheClaymore.cs index 6ce1ee972e..035899da48 100644 --- a/Items/Weapons/Melee/CatastropheClaymore.cs +++ b/Items/Weapons/Melee/CatastropheClaymore.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Melee; +using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -13,6 +13,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { Item.width = 60; + Item.height = 60; Item.damage = 85; Item.DamageType = DamageClass.Melee; Item.useAnimation = Item.useTime = 23; @@ -21,8 +22,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 6.25f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 60; - Item.value = CalamityGlobalItem.Rarity6BuyPrice; + Item.value = CalamityGlobalItem.RarityLightPurpleBuyPrice; Item.rare = ItemRarityID.LightPurple; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 11f; @@ -38,7 +38,7 @@ namespace CalamityMod.Items.Weapons.Melee { if (Main.rand.NextBool(3)) { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 73); + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, DustID.PinkFairy); } } diff --git a/Items/Weapons/Melee/CelestialClaymore.cs b/Items/Weapons/Melee/CelestialClaymore.cs index 6e959d4e24..7272201e97 100644 --- a/Items/Weapons/Melee/CelestialClaymore.cs +++ b/Items/Weapons/Melee/CelestialClaymore.cs @@ -1,8 +1,8 @@ -using Terraria.DataStructures; +using System; using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -15,16 +15,16 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 80; Item.height = 82; - Item.damage = 70; + Item.damage = 59; Item.DamageType = DamageClass.Melee; - Item.useAnimation = 19; - Item.useTime = 19; + Item.useAnimation = 24; + Item.useTime = 24; Item.useTurn = true; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 5.25f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 0.1f; @@ -32,43 +32,30 @@ namespace CalamityMod.Items.Weapons.Melee public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - float projSpeed = Item.shootSpeed; 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; + float mouseXDist = Main.mouseX + Main.screenPosition.X - realPlayerPos.X; + float mouseYDist = Main.mouseY + Main.screenPosition.Y - realPlayerPos.Y; if (player.gravDir == -1f) { - mouseYDist = Main.screenPosition.Y + (float)Main.screenHeight + (float)Main.mouseY + realPlayerPos.Y; + mouseYDist = Main.screenPosition.Y + Main.screenHeight + Main.mouseY + realPlayerPos.Y; } - float mouseDistance = (float)Math.Sqrt((double)(mouseXDist * mouseXDist + mouseYDist * mouseYDist)); if ((float.IsNaN(mouseXDist) && float.IsNaN(mouseYDist)) || (mouseXDist == 0f && mouseYDist == 0f)) { - mouseXDist = (float)player.direction; + mouseXDist = player.direction; mouseYDist = 0f; - mouseDistance = projSpeed; - } - else - { - mouseDistance = projSpeed / mouseDistance; } - for (int i = 0; i < 3; i++) + Vector2 realPositionOrig = realPlayerPos; + mouseXDist *= 0.8f; + mouseYDist *= 0.8f; + + for (int i = 0; i < 2; i++) { - realPlayerPos = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y); - realPlayerPos.X = (realPlayerPos.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); - realPlayerPos.Y -= (float)(100 * i); - mouseXDist = (float)Main.mouseX + Main.screenPosition.X - realPlayerPos.X; - mouseYDist = (float)Main.mouseY + Main.screenPosition.Y - realPlayerPos.Y; - if (mouseYDist < 0f) - { - mouseYDist *= -1f; - } - if (mouseYDist < 20f) - { - mouseYDist = 20f; - } - mouseDistance = (float)Math.Sqrt((double)(mouseXDist * mouseXDist + mouseYDist * mouseYDist)); - mouseDistance = projSpeed / mouseDistance; + realPlayerPos = realPositionOrig; + realPlayerPos.X += Main.rand.Next(-100, 101); + realPlayerPos.Y += Main.rand.Next(-100, 101); + realPlayerPos += new Vector2(mouseXDist, mouseYDist); + switch (Main.rand.Next(3)) { case 0: diff --git a/Items/Weapons/Melee/ClamCrusher.cs b/Items/Weapons/Melee/ClamCrusher.cs index d2d9ffb907..81072b8d27 100644 --- a/Items/Weapons/Melee/ClamCrusher.cs +++ b/Items/Weapons/Melee/ClamCrusher.cs @@ -10,17 +10,17 @@ namespace CalamityMod.Items.Weapons.Melee public new string LocalizationCategory => "Items.Weapons.Melee"; public override void SetDefaults() { - Item.damage = 150; - Item.DamageType = DamageClass.MeleeNoSpeed; Item.width = 40; Item.height = 60; + Item.damage = 150; + Item.DamageType = DamageClass.MeleeNoSpeed; Item.useTime = 50; Item.useAnimation = 50; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.noUseGraphic = true; Item.knockBack = 10f; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item1; Item.autoReuse = true; diff --git a/Items/Weapons/Melee/CometQuasher.cs b/Items/Weapons/Melee/CometQuasher.cs index 142394b369..2715110fdf 100644 --- a/Items/Weapons/Melee/CometQuasher.cs +++ b/Items/Weapons/Melee/CometQuasher.cs @@ -1,6 +1,7 @@ -using CalamityMod.Projectiles.Melee; +using System; +using CalamityMod.Dusts; +using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,12 +11,16 @@ namespace CalamityMod.Items.Weapons.Melee public class CometQuasher : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + + internal const float ShootSpeed = 9f; + + internal const int TotalMeteors = 2; + public override void SetDefaults() { Item.width = 46; Item.height = 62; - Item.scale = 1.5f; - Item.damage = 160; + Item.damage = 134; Item.DamageType = DamageClass.Melee; Item.useAnimation = 22; Item.useStyle = ItemUseStyleID.Swing; @@ -24,110 +29,52 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 7.75f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; - Item.shootSpeed = 9f; + Item.shootSpeed = ShootSpeed; } - public override void ModifyHitNPC(Player player, NPC target, ref NPC.HitModifiers modifiers) - { - modifiers.CritDamage *= 0.5f; - } public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) { - var source = player.GetSource_ItemUse(Item); - float cometSpeed = Item.shootSpeed; - 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) - { - mouseYDist = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - realPlayerPos.Y; - } - float mouseDistance = (float)Math.Sqrt((double)(mouseXDist * mouseXDist + mouseYDist * mouseYDist)); - if ((float.IsNaN(mouseXDist) && float.IsNaN(mouseYDist)) || (mouseXDist == 0f && mouseYDist == 0f)) - { - mouseXDist = (float)player.direction; - mouseYDist = 0f; - mouseDistance = cometSpeed; - } - else - { - mouseDistance = cometSpeed / mouseDistance; - } + Vector2 destination = target.Center; + Vector2 position = destination - (Vector2.UnitY * (destination.Y - Main.screenPosition.Y + 80f)); + Vector2 cachedPosition = position; - for (int i = 0; i < 2; i++) + Vector2 velocity = (destination - position).SafeNormalize(Vector2.UnitY) * ShootSpeed; + Vector2 cachedVelocity = velocity; + + int meteorDamage = player.CalcIntDamage((int)(Item.damage * 0.5)); + float meteorKnockback = Item.knockBack * 0.5f; + for (int i = 0; i < TotalMeteors; i++) { - realPlayerPos = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); - realPlayerPos.X = (realPlayerPos.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); - realPlayerPos.Y -= (float)(100 * i); - mouseXDist = (float)Main.mouseX + Main.screenPosition.X - realPlayerPos.X + (float)Main.rand.Next(-40, 41) * 0.03f; - mouseYDist = (float)Main.mouseY + Main.screenPosition.Y - realPlayerPos.Y; - if (mouseYDist < 0f) - { - mouseYDist *= -1f; - } - if (mouseYDist < 20f) - { - mouseYDist = 20f; - } - mouseDistance = (float)Math.Sqrt((double)(mouseXDist * mouseXDist + mouseYDist * mouseYDist)); - mouseDistance = cometSpeed / mouseDistance; - mouseXDist *= mouseDistance; - mouseYDist *= mouseDistance; - float cometSpawnXOffset = mouseXDist; - float cometSpawnYOffset = mouseYDist + (float)Main.rand.Next(-40, 41) * 0.02f; - int proj = Projectile.NewProjectile(source, realPlayerPos.X, realPlayerPos.Y, cometSpawnXOffset * 0.75f, cometSpawnYOffset * 0.75f, ModContent.ProjectileType(), (int)(Item.damage * 0.5f), Item.knockBack, player.whoAmI, 0f, 0.5f + (float)Main.rand.NextDouble() * 0.3f); + position += Vector2.UnitX * Main.rand.Next(-320, 321); + velocity = (destination - position).SafeNormalize(Vector2.UnitY) * ShootSpeed * Main.rand.NextFloat(0.9f, 1.1f); + int proj = Projectile.NewProjectile(player.GetSource_ItemUse(Item), position, velocity, ModContent.ProjectileType(), meteorDamage, meteorKnockback, player.whoAmI, 0f, 0.5f + Main.rand.NextFloat() * 0.3f, target.Center.Y); Main.projectile[proj].Calamity().lineColor = Main.rand.Next(3); + position = cachedPosition; + velocity = cachedVelocity; } } public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo) { - var source = player.GetSource_ItemUse(Item); - float cometSpeed = Item.shootSpeed; - 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) - { - mouseYDist = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - realPlayerPos.Y; - } - float mouseDistance = (float)Math.Sqrt((double)(mouseXDist * mouseXDist + mouseYDist * mouseYDist)); - if ((float.IsNaN(mouseXDist) && float.IsNaN(mouseYDist)) || (mouseXDist == 0f && mouseYDist == 0f)) - { - mouseXDist = (float)player.direction; - mouseYDist = 0f; - mouseDistance = cometSpeed; - } - else - { - mouseDistance = cometSpeed / mouseDistance; - } + Vector2 destination = target.Center; + Vector2 position = destination - (Vector2.UnitY * (destination.Y - Main.screenPosition.Y + 80f)); + Vector2 cachedPosition = position; - for (int i = 0; i < 2; i++) + Vector2 velocity = (destination - position).SafeNormalize(Vector2.UnitY) * ShootSpeed; + Vector2 cachedVelocity = velocity; + + int meteorDamage = player.CalcIntDamage((int)(Item.damage * 0.5)); + float meteorKnockback = Item.knockBack * 0.5f; + for (int i = 0; i < TotalMeteors; i++) { - realPlayerPos = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); - realPlayerPos.X = (realPlayerPos.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); - realPlayerPos.Y -= (float)(100 * i); - mouseXDist = (float)Main.mouseX + Main.screenPosition.X - realPlayerPos.X + (float)Main.rand.Next(-40, 41) * 0.03f; - mouseYDist = (float)Main.mouseY + Main.screenPosition.Y - realPlayerPos.Y; - if (mouseYDist < 0f) - { - mouseYDist *= -1f; - } - if (mouseYDist < 20f) - { - mouseYDist = 20f; - } - mouseDistance = (float)Math.Sqrt((double)(mouseXDist * mouseXDist + mouseYDist * mouseYDist)); - mouseDistance = cometSpeed / mouseDistance; - mouseXDist *= mouseDistance; - mouseYDist *= mouseDistance; - float cometSpawnXOffset = mouseXDist; - float cometSpawnYOffset = mouseYDist + (float)Main.rand.Next(-40, 41) * 0.02f; - int proj = Projectile.NewProjectile(source, realPlayerPos.X, realPlayerPos.Y, cometSpawnXOffset * 0.75f, cometSpawnYOffset * 0.75f, ModContent.ProjectileType(), (int)(Item.damage * 0.5f), Item.knockBack, player.whoAmI, 0f, 0.5f + (float)Main.rand.NextDouble() * 0.3f); + position += Vector2.UnitX * Main.rand.Next(-320, 321); + velocity *= Main.rand.NextFloat(0.9f, 1.1f); + int proj = Projectile.NewProjectile(player.GetSource_ItemUse(Item), position, velocity, ModContent.ProjectileType(), meteorDamage, meteorKnockback, player.whoAmI, 0f, 0.5f + Main.rand.NextFloat() * 0.3f, target.Center.Y); Main.projectile[proj].Calamity().lineColor = Main.rand.Next(3); + position = cachedPosition; + velocity = cachedVelocity; } } @@ -135,7 +82,8 @@ namespace CalamityMod.Items.Weapons.Melee { if (Main.rand.NextBool(3)) { - Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 6); + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, Main.rand.NextBool() ? DustID.Torch : (int)CalamityDusts.Ectoplasm, 0f, 0f, 0, default, Main.rand.NextFloat(1.5f, 2.5f)); + Main.dust[dust].noGravity = true; } } diff --git a/Items/Weapons/Melee/CosmicDischarge.cs b/Items/Weapons/Melee/CosmicDischarge.cs index 5e20cd8a96..5e0f2ae32c 100644 --- a/Items/Weapons/Melee/CosmicDischarge.cs +++ b/Items/Weapons/Melee/CosmicDischarge.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.shootSpeed = 24f; Item.shoot = ModContent.ProjectileType(); - Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.rare = ModContent.RarityType(); } diff --git a/Items/Weapons/Melee/CosmicShiv.cs b/Items/Weapons/Melee/CosmicShiv.cs index 518e84bb8c..b7e5f75b48 100644 --- a/Items/Weapons/Melee/CosmicShiv.cs +++ b/Items/Weapons/Melee/CosmicShiv.cs @@ -20,16 +20,16 @@ namespace CalamityMod.Items.Weapons.Melee Item.noUseGraphic = true; Item.autoReuse = true; Item.useStyle = ItemUseStyleID.Rapier; - Item.damage = 300; + Item.damage = 270; Item.DamageType = DamageClass.Melee; - Item.useAnimation = Item.useTime = 38; + Item.useAnimation = Item.useTime = 40; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 2.4f; Item.knockBack = 9f; Item.UseSound = SoundID.Item1; - Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.rare = ModContent.RarityType(); - Item.Calamity().donorItem = true; // revertusernamechange on Discord (Yatagarasu) + Item.Calamity().donorItem = true; // revertusernamechange on Discord (Yatagarasu) } public override bool MeleePrefix() => true; diff --git a/Items/Weapons/Melee/CrescentMoon.cs b/Items/Weapons/Melee/CrescentMoon.cs index 203c6e86c2..12654f8efb 100644 --- a/Items/Weapons/Melee/CrescentMoon.cs +++ b/Items/Weapons/Melee/CrescentMoon.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.useStyle = ItemUseStyleID.Shoot; Item.knockBack = 4f; Item.UseSound = SoundID.Item82; - Item.value = CalamityGlobalItem.Rarity13BuyPrice; + Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; Item.rare = ModContent.RarityType(); Item.shootSpeed = 24f; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Melee/DarklightGreatsword.cs b/Items/Weapons/Melee/DarklightGreatsword.cs index 6d96aa6292..ff02684bf3 100644 --- a/Items/Weapons/Melee/DarklightGreatsword.cs +++ b/Items/Weapons/Melee/DarklightGreatsword.cs @@ -1,8 +1,8 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -11,6 +11,19 @@ namespace CalamityMod.Items.Weapons.Melee public class DarklightGreatsword : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + + internal const float ShootSpeed = 2f; + + internal const float ProjectileDamageMultiplier = 0.8f; + + internal const float TrueMeleeSlashProjectileDamageMultiplier = 0.8f; + + internal const float SlashProjectileDamageMultiplier = 0.4125f; // Makes them do 33% damage since main projectile does 80% damage + + internal const int SlashProjectileLimit = 4; + + internal const int SlashCreationRate = 18; + public override void SetDefaults() { Item.width = 92; @@ -20,37 +33,43 @@ namespace CalamityMod.Items.Weapons.Melee Item.useAnimation = Item.useTime = 30; Item.useStyle = ItemUseStyleID.Swing; Item.useTurn = true; - Item.knockBack = 5; + Item.knockBack = 6f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 25f; + Item.shootSpeed = ShootSpeed; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - type = Main.rand.NextBool() ? type : ModContent.ProjectileType(); - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, (int)(damage * 0.8), knockback, player.whoAmI); - return false; - } + Vector2 offset = new Vector2(Item.width * 0.25f * -player.direction, Item.height * 0.25f); + if (player.gravDir == 1f) + position -= offset; + else + position += offset; - 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, 29); + velocity = (Main.MouseWorld - position).SafeNormalize(Vector2.UnitY) * ShootSpeed; + type = Main.rand.NextBool() ? type : ModContent.ProjectileType(); + Projectile.NewProjectile(source, position, velocity, type, (int)(damage * ProjectileDamageMultiplier), knockback * ProjectileDamageMultiplier, player.whoAmI); + return false; } public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(BuffID.Frostburn2, 180); + target.AddBuff(Main.rand.NextBool() ? BuffID.Frostburn2 : BuffID.OnFire3, 240); + int slashCreatorID = ModContent.ProjectileType(); + int slashDamage = (int)(player.CalcIntDamage(Item.damage) * TrueMeleeSlashProjectileDamageMultiplier); + float slashKnockback = Item.knockBack * TrueMeleeSlashProjectileDamageMultiplier; + if (player.ownedProjectileCounts[slashCreatorID] < SlashProjectileLimit) + { + Projectile.NewProjectile(player.GetSource_ItemUse(Item), target.Center, Vector2.Zero, slashCreatorID, slashDamage, slashKnockback, player.whoAmI, target.whoAmI, player.itemRotation, Main.rand.Next(2)); + player.ownedProjectileCounts[slashCreatorID]++; + } } - public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo) - { - target.AddBuff(BuffID.Frostburn2, 180); - } + public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo) => target.AddBuff(Main.rand.NextBool() ? BuffID.Frostburn2 : BuffID.OnFire3, 240); public override void AddRecipes() { diff --git a/Items/Weapons/Melee/DeathsAscension.cs b/Items/Weapons/Melee/DeathsAscension.cs index 4cbf65edc7..f22376f9da 100644 --- a/Items/Weapons/Melee/DeathsAscension.cs +++ b/Items/Weapons/Melee/DeathsAscension.cs @@ -19,18 +19,18 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { + Item.width = 70; + Item.height = 70; Item.damage = 1200; Item.knockBack = 9f; Item.useTime = Item.useAnimation = 24; Item.DamageType = DamageClass.Melee; Item.noMelee = true; Item.channel = true; - Item.width = 70; - Item.height = 70; Item.useStyle = ItemUseStyleID.Shoot; Item.shootSpeed = 12f; Item.shoot = ModContent.ProjectileType(); - Item.value = CalamityGlobalItem.Rarity13BuyPrice; + Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; } diff --git a/Items/Weapons/Melee/DefiledGreatsword.cs b/Items/Weapons/Melee/DefiledGreatsword.cs index ce3095e430..b46bdb4425 100644 --- a/Items/Weapons/Melee/DefiledGreatsword.cs +++ b/Items/Weapons/Melee/DefiledGreatsword.cs @@ -14,63 +14,121 @@ namespace CalamityMod.Items.Weapons.Melee public class DefiledGreatsword : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + + public const int TotalProjectiles = 3; + + public const float ProjectileFullyVisibleDuration = 40f; + + public const float ProjectileFullyVisibleDurationIncreasePerAdditionalProjectile = 8f; + + public const float ShootSpeed = 16f; + public override void SetDefaults() { Item.width = 102; - Item.damage = 124; + Item.height = 102; + Item.damage = 119; Item.DamageType = DamageClass.Melee; - Item.useAnimation = 18; + Item.useAnimation = Item.useTime = 28; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 18; Item.useTurn = true; - Item.knockBack = 7.5f; + Item.knockBack = 9f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 102; - Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.shootsEveryUse = true; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 12f; + Item.shootSpeed = ShootSpeed; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - switch (Main.rand.Next(3)) + float adjustedItemScale = player.GetAdjustedItemScale(Item); + for (int i = 0; i < TotalProjectiles; i++) { - case 0: - type = ModContent.ProjectileType(); - break; - case 1: - type = ModContent.ProjectileType(); - break; - case 2: - type = ModContent.ProjectileType(); - break; - default: - break; + float ai1 = ProjectileFullyVisibleDuration + i * ProjectileFullyVisibleDurationIncreasePerAdditionalProjectile; + float velocityMultiplier = 1f - i / (float)TotalProjectiles; + Projectile.NewProjectile(source, player.MountedCenter, velocity * velocityMultiplier, type, (int)(damage * 0.75), knockback * 0.5f, player.whoAmI, (float)player.direction * player.gravDir, ai1, adjustedItemScale); } - Projectile.NewProjectile(source, position, velocity, type, damage, knockback, Main.myPlayer, 1f); + + NetMessage.SendData(MessageID.PlayerControls, -1, -1, null, player.whoAmI); + return false; } public override void MeleeEffects(Player player, Rectangle hitbox) { - if (Main.rand.NextBool(5)) + if (Main.rand.NextBool(3)) { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 106); + int dustType = DustID.Venom; + switch (Main.rand.Next(5)) + { + default: + case 0: + case 1: + break; + + case 2: + switch (Main.rand.Next(3)) + { + default: + case 0: + dustType = DustID.RedTorch; + break; + + case 1: + dustType = DustID.YellowTorch; + break; + + case 2: + dustType = DustID.GreenTorch; + break; + } + break; + + case 3: + switch (Main.rand.Next(3)) + { + default: + case 0: + dustType = DustID.CrimsonTorch; + break; + + case 1: + dustType = DustID.IchorTorch; + break; + + case 2: + dustType = DustID.CursedTorch; + break; + } + break; + + case 4: + dustType = DustID.GreenFairy; + break; + } + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, dustType, 0f, 0f, 100, default, Main.rand.NextFloat(1.8f, 2.4f)); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0f; + if (dustType == DustID.Venom) + Main.dust[dust].fadeIn = 1.5f; } } public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) { player.AddBuff(ModContent.BuffType(), 300); - target.AddBuff(BuffID.Venom, 150); + target.AddBuff(BuffID.Venom, 360); + target.AddBuff(BuffID.OnFire3, 360); } public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo) { player.AddBuff(ModContent.BuffType(), 300); - target.AddBuff(BuffID.Venom, 150); + target.AddBuff(BuffID.Venom, 360); + target.AddBuff(BuffID.OnFire3, 360); } public override void AddRecipes() diff --git a/Items/Weapons/Melee/DepthCrusher.cs b/Items/Weapons/Melee/DepthCrusher.cs index 26edc82f51..1714581a67 100644 --- a/Items/Weapons/Melee/DepthCrusher.cs +++ b/Items/Weapons/Melee/DepthCrusher.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -10,64 +11,27 @@ namespace CalamityMod.Items.Weapons.Melee public class DepthCrusher : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; - private const int HammerPower = 70; - - public override void SetStaticDefaults() - { - - ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; - } public override void SetDefaults() { - Item.damage = 36; - Item.knockBack = 5.25f; - Item.useTime = 17; - Item.useAnimation = 22; - Item.hammer = HammerPower; - - Item.DamageType = DamageClass.Melee; - Item.useTurn = true; - Item.useStyle = ItemUseStyleID.Swing; Item.width = 56; Item.height = 50; - Item.UseSound = SoundID.Item1; + Item.damage = 35; + Item.knockBack = 7.25f; + Item.useTime = 65; + Item.useAnimation = 65; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 3f; + + Item.noMelee = true; + Item.noUseGraphic = true; + Item.DamageType = DamageClass.Melee; + Item.useStyle = ItemUseStyleID.Shoot; + Item.UseSound = null; Item.autoReuse = true; - Item.value = CalamityGlobalItem.Rarity2BuyPrice; + + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; } - - public override bool AltFunctionUse(Player player) => true; - - public override bool CanUseItem(Player player) - { - if (player.altFunctionUse == 2) - { - Item.hammer = 0; - } - else - { - Item.hammer = HammerPower; - } - return base.CanUseItem(player); - } - - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool(3)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 33); - } - } - - public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 180); - } - - public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo) - { - target.AddBuff(ModContent.BuffType(), 180); - } } } diff --git a/Items/Weapons/Melee/Devastation.cs b/Items/Weapons/Melee/Devastation.cs index 01d6dee779..8e84933f5e 100644 --- a/Items/Weapons/Melee/Devastation.cs +++ b/Items/Weapons/Melee/Devastation.cs @@ -1,9 +1,9 @@ -using Terraria.DataStructures; +using System; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -21,6 +21,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { Item.width = 72; + Item.height = 72; Item.damage = 132; Item.DamageType = DamageClass.Melee; Item.useAnimation = 24; @@ -30,9 +31,8 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 4.25f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 72; - Item.value = CalamityGlobalItem.Rarity10BuyPrice; - Item.rare = ItemRarityID.Red; + Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; + Item.rare = ItemRarityID.Purple; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 16f; } @@ -106,7 +106,7 @@ namespace CalamityMod.Items.Weapons.Melee { if (Main.rand.NextBool(3)) { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 73); + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, DustID.PinkFairy); } } diff --git a/Items/Weapons/Melee/DevilsDevastation.cs b/Items/Weapons/Melee/DevilsDevastation.cs index 4243649280..db1e6a4c01 100644 --- a/Items/Weapons/Melee/DevilsDevastation.cs +++ b/Items/Weapons/Melee/DevilsDevastation.cs @@ -1,15 +1,15 @@ -using CalamityMod.Items.Materials; +using System; using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Items.Weapons.Melee { @@ -102,12 +102,7 @@ namespace CalamityMod.Items.Weapons.Melee 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, 173); - } - - public override void ModifyHitNPC(Player player, NPC target, ref NPC.HitModifiers modifiers) - { - modifiers.CritDamage *= 0.5f; + Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, DustID.ShadowbeamStaff); } public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) @@ -127,14 +122,14 @@ namespace CalamityMod.Items.Weapons.Melee SoundEngine.PlaySound(SoundID.Item14, target.Center); for (int i = 0; i < 40; i++) { - int dustInt = Dust.NewDust(target.position, target.width, target.height, 173, 0f, 0f, 200, default, firstDustScale); + int dustInt = Dust.NewDust(target.position, target.width, target.height, DustID.ShadowbeamStaff, 0f, 0f, 200, default, firstDustScale); Dust dust = Main.dust[dustInt]; dust.position = target.Center + Vector2.UnitY.RotatedByRandom(Math.PI) * Main.rand.NextFloat() * target.width / 2f; dust.noGravity = true; dust.velocity.Y -= 4.5f; dust.velocity *= 3f; dust.velocity += dustVelocity * Main.rand.NextFloat(); - dustInt = Dust.NewDust(target.position, target.width, target.height, 173, 0f, 0f, 100, default, secondDustScale); + dustInt = Dust.NewDust(target.position, target.width, target.height, DustID.ShadowbeamStaff, 0f, 0f, 100, default, secondDustScale); dust.position = target.Center + Vector2.UnitY.RotatedByRandom(Math.PI) * Main.rand.NextFloat() * target.width / 2f; dust.velocity.Y -= 3f; dust.velocity *= 2f; @@ -145,7 +140,7 @@ namespace CalamityMod.Items.Weapons.Melee } for (int j = 0; j < 20; j++) { - int dustInt = Dust.NewDust(target.position, target.width, target.height, 173, 0f, 0f, 0, default, thirdDustScale); + int dustInt = Dust.NewDust(target.position, target.width, target.height, DustID.ShadowbeamStaff, 0f, 0f, 0, default, thirdDustScale); Dust dust = Main.dust[dustInt]; dust.position = target.Center + Vector2.UnitX.RotatedByRandom(Math.PI).RotatedBy((double)target.velocity.ToRotation(), default) * target.width / 3f; dust.noGravity = true; diff --git a/Items/Weapons/Melee/DevilsSunrise.cs b/Items/Weapons/Melee/DevilsSunrise.cs index 1282205f1e..c2fb16337e 100644 --- a/Items/Weapons/Melee/DevilsSunrise.cs +++ b/Items/Weapons/Melee/DevilsSunrise.cs @@ -12,24 +12,23 @@ namespace CalamityMod.Items.Weapons.Melee public class DevilsSunrise : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; - public static int BaseDamage = 480; public override void SetDefaults() { Item.width = 66; Item.height = 66; - Item.DamageType = TrueMeleeNoSpeedDamageClass.Instance; + Item.DamageType = DamageClass.MeleeNoSpeed; Item.noMelee = true; Item.noUseGraphic = true; Item.channel = true; - Item.damage = BaseDamage; + Item.damage = 420; Item.knockBack = 4f; Item.useAnimation = 25; Item.useTime = 5; Item.autoReuse = false; Item.useStyle = ItemUseStyleID.Shoot; - Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; @@ -42,8 +41,8 @@ namespace CalamityMod.Items.Weapons.Melee 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, 0f, 0f); - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); return false; } diff --git a/Items/Weapons/Melee/DiseasedPike.cs b/Items/Weapons/Melee/DiseasedPike.cs index 6a3b399a58..343abf21ac 100644 --- a/Items/Weapons/Melee/DiseasedPike.cs +++ b/Items/Weapons/Melee/DiseasedPike.cs @@ -16,6 +16,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { Item.width = 62; + Item.height = 58; Item.damage = 65; Item.DamageType = TrueMeleeDamageClass.Instance; Item.noMelee = true; @@ -27,8 +28,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 8.5f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 58; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; diff --git a/Items/Weapons/Melee/DraconicDestruction.cs b/Items/Weapons/Melee/DraconicDestruction.cs index 26b6c2285d..7794866eb5 100644 --- a/Items/Weapons/Melee/DraconicDestruction.cs +++ b/Items/Weapons/Melee/DraconicDestruction.cs @@ -15,20 +15,20 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { Item.width = 90; - Item.damage = 250; + Item.height = 90; + Item.damage = 200; Item.DamageType = DamageClass.Melee; - Item.useAnimation = 24; + Item.useAnimation = 34; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 24; + Item.useTime = 34; Item.useTurn = true; Item.knockBack = 7.25f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 90; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 14f; - Item.value = CalamityGlobalItem.Rarity16BuyPrice; + Item.value = CalamityGlobalItem.RarityHotPinkBuyPrice; Item.rare = ModContent.RarityType(); Item.Calamity().devItem = true; } @@ -37,7 +37,7 @@ namespace CalamityMod.Items.Weapons.Melee { if (Main.rand.NextBool(5)) { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 35); + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, DustID.Lava); } } diff --git a/Items/Weapons/Melee/DragonPow.cs b/Items/Weapons/Melee/DragonPow.cs index 3a58dca4e8..0631ea083b 100644 --- a/Items/Weapons/Melee/DragonPow.cs +++ b/Items/Weapons/Melee/DragonPow.cs @@ -1,10 +1,10 @@ using CalamityMod.Items.Materials; +using CalamityMod.NPCs.Yharon; using CalamityMod.Projectiles.Melee; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.NPCs.Yharon; namespace CalamityMod.Items.Weapons.Melee { @@ -36,7 +36,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.UseSound = Yharon.ShortRoarSound; Item.channel = true; - Item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; diff --git a/Items/Weapons/Melee/DragonRage.cs b/Items/Weapons/Melee/DragonRage.cs index 657cfe1f52..dc5f9e1f86 100644 --- a/Items/Weapons/Melee/DragonRage.cs +++ b/Items/Weapons/Melee/DragonRage.cs @@ -10,6 +10,8 @@ namespace CalamityMod.Items.Weapons.Melee public new string LocalizationCategory => "Items.Weapons.Melee"; public override void SetDefaults() { + Item.width = 128; + Item.height = 140; Item.damage = 1075; Item.knockBack = 7.5f; Item.useAnimation = Item.useTime = 25; @@ -20,12 +22,10 @@ namespace CalamityMod.Items.Weapons.Melee Item.shootSpeed = 14f; Item.shoot = ModContent.ProjectileType(); - Item.width = 128; - Item.height = 140; Item.noUseGraphic = true; Item.useStyle = ItemUseStyleID.Shoot; Item.UseSound = SoundID.DD2_SkyDragonsFurySwing; - Item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.rare = ModContent.RarityType(); } } diff --git a/Items/Weapons/Melee/Earth.cs b/Items/Weapons/Melee/Earth.cs index 773eabba6f..e8c4939df8 100644 --- a/Items/Weapons/Melee/Earth.cs +++ b/Items/Weapons/Melee/Earth.cs @@ -1,9 +1,9 @@ -using CalamityMod.Items.Materials; +using System; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -17,7 +17,6 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 92; Item.height = 104; - Item.scale = 1.5f; Item.damage = 170; Item.DamageType = DamageClass.Melee; Item.useAnimation = 16; @@ -28,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.value = CalamityGlobalItem.Rarity16BuyPrice; + Item.value = CalamityGlobalItem.RarityHotPinkBuyPrice; Item.rare = ModContent.RarityType(); Item.Calamity().devItem = true; } @@ -85,12 +84,15 @@ namespace CalamityMod.Items.Weapons.Melee if (target.Calamity().miscDefenseLoss < target.defense) target.Calamity().miscDefenseLoss += 1; - if (!target.canGhostHeal || player.moonLeech) + if (player.moonLeech || player.lifeSteal <= 0f || target.lifeMax <= 5) return; - int heal = Main.rand.Next(1, 69); + int heal = Main.rand.Next(1, 70); + player.lifeSteal -= heal; player.statLife += heal; player.HealEffect(heal); + if (player.statLife > player.statLifeMax2) + player.statLife = player.statLifeMax2; } public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo) @@ -141,12 +143,15 @@ namespace CalamityMod.Items.Weapons.Melee Projectile.NewProjectile(source, realPlayerPos.X, realPlayerPos.Y, speedX4, speedY5, ModContent.ProjectileType(), earthDamage, Item.knockBack, player.whoAmI, 0f, (float)Main.rand.Next(10)); } - if (player.moonLeech) + if (player.moonLeech || player.lifeSteal <= 0f) return; - int heal = Main.rand.Next(1, 69); + int heal = Main.rand.Next(1, 70); + player.lifeSteal -= heal; player.statLife += heal; player.HealEffect(heal); + if (player.statLife > player.statLifeMax2) + player.statLife = player.statLifeMax2; } public override void AddRecipes() diff --git a/Items/Weapons/Melee/EarthenPike.cs b/Items/Weapons/Melee/EarthenPike.cs index ba965f76da..279a1f99a0 100644 --- a/Items/Weapons/Melee/EarthenPike.cs +++ b/Items/Weapons/Melee/EarthenPike.cs @@ -10,12 +10,13 @@ namespace CalamityMod.Items.Weapons.Melee public new string LocalizationCategory => "Items.Weapons.Melee"; public override void SetStaticDefaults() { - ItemID.Sets.Spears[Item.type] = true; + ItemID.Sets.Spears[Item.type] = true; } public override void SetDefaults() { Item.width = 60; + Item.height = 60; Item.damage = 90; Item.DamageType = DamageClass.Melee; Item.noMelee = true; @@ -27,8 +28,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 7f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 60; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 8f; diff --git a/Items/Weapons/Melee/ElementalLance.cs b/Items/Weapons/Melee/ElementalLance.cs index fe65e3c08e..899b8a5f36 100644 --- a/Items/Weapons/Melee/ElementalLance.cs +++ b/Items/Weapons/Melee/ElementalLance.cs @@ -12,12 +12,13 @@ namespace CalamityMod.Items.Weapons.Melee public new string LocalizationCategory => "Items.Weapons.Melee"; public override void SetStaticDefaults() { - ItemID.Sets.Spears[Item.type] = true; + ItemID.Sets.Spears[Item.type] = true; } public override void SetDefaults() { Item.width = 88; + Item.height = 88; Item.damage = 160; Item.DamageType = DamageClass.Melee; Item.noMelee = true; @@ -29,8 +30,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 9.5f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 88; - Item.value = CalamityGlobalItem.Rarity11BuyPrice; + Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; Item.rare = ItemRarityID.Purple; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; @@ -41,7 +41,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { CreateRecipe(). - AddIngredient(). + AddIngredient(). AddIngredient(ItemID.LunarBar, 5). AddIngredient(5). AddIngredient(5). diff --git a/Items/Weapons/Melee/ElementalShiv.cs b/Items/Weapons/Melee/ElementalShiv.cs index 9861a848d7..364819f8b4 100644 --- a/Items/Weapons/Melee/ElementalShiv.cs +++ b/Items/Weapons/Melee/ElementalShiv.cs @@ -19,14 +19,14 @@ namespace CalamityMod.Items.Weapons.Melee Item.noUseGraphic = true; Item.autoReuse = true; Item.useStyle = ItemUseStyleID.Rapier; - Item.damage = 190; + Item.damage = 138; Item.DamageType = DamageClass.Melee; Item.useAnimation = Item.useTime = 13; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 2.4f; Item.knockBack = 8.5f; Item.UseSound = SoundID.Item1; - Item.value = CalamityGlobalItem.Rarity11BuyPrice; + Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; Item.rare = ItemRarityID.Purple; } diff --git a/Items/Weapons/Melee/EmpyreanKnives.cs b/Items/Weapons/Melee/EmpyreanKnives.cs index 49cea27978..4081665059 100644 --- a/Items/Weapons/Melee/EmpyreanKnives.cs +++ b/Items/Weapons/Melee/EmpyreanKnives.cs @@ -1,9 +1,9 @@ -using CalamityMod.Items.Materials; +using System; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -17,6 +17,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { Item.width = 18; + Item.height = 20; Item.damage = 230; Item.DamageType = DamageClass.MeleeNoSpeed; Item.noMelee = true; @@ -27,8 +28,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 3f; Item.UseSound = SoundID.Item39; Item.autoReuse = true; - Item.height = 20; - Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.rare = ModContent.RarityType(); Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 15f; diff --git a/Items/Weapons/Melee/EntropicClaymore.cs b/Items/Weapons/Melee/EntropicClaymore.cs index d9a820585d..a37ecdd797 100644 --- a/Items/Weapons/Melee/EntropicClaymore.cs +++ b/Items/Weapons/Melee/EntropicClaymore.cs @@ -1,8 +1,8 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -25,8 +25,8 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 5.25f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.value = CalamityGlobalItem.Rarity9BuyPrice; - Item.rare = ItemRarityID.Cyan; + Item.value = CalamityGlobalItem.RarityRedBuyPrice; + Item.rare = ItemRarityID.Red; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; } @@ -69,7 +69,7 @@ namespace CalamityMod.Items.Weapons.Melee { if (Main.rand.NextBool(3)) { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 27); + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, DustID.Shadowflame); } } diff --git a/Items/Weapons/Melee/EssenceFlayer.cs b/Items/Weapons/Melee/EssenceFlayer.cs index 38af0ebe27..790801310d 100644 --- a/Items/Weapons/Melee/EssenceFlayer.cs +++ b/Items/Weapons/Melee/EssenceFlayer.cs @@ -14,9 +14,11 @@ namespace CalamityMod.Items.Weapons.Melee public class EssenceFlayer : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + public override void SetDefaults() { Item.width = 100; + Item.height = 78; Item.damage = 225; Item.DamageType = DamageClass.Melee; Item.useAnimation = 19; @@ -26,7 +28,6 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 8f; Item.UseSound = SoundID.Item71; Item.autoReuse = true; - Item.height = 78; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 21f; @@ -42,7 +43,8 @@ namespace CalamityMod.Items.Weapons.Melee { if (Main.rand.NextBool(3)) { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 173); + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, DustID.ShadowbeamStaff); + Main.dust[dust].velocity *= 0f; } } diff --git a/Items/Weapons/Melee/EutrophicScimitar.cs b/Items/Weapons/Melee/EutrophicScimitar.cs index bd442cefe9..156f6b9779 100644 --- a/Items/Weapons/Melee/EutrophicScimitar.cs +++ b/Items/Weapons/Melee/EutrophicScimitar.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Melee; +using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -12,17 +12,17 @@ namespace CalamityMod.Items.Weapons.Melee public new string LocalizationCategory => "Items.Weapons.Melee"; public override void SetDefaults() { - Item.damage = 110; - Item.DamageType = DamageClass.Melee; Item.width = 64; Item.height = 78; + Item.damage = 110; + Item.DamageType = DamageClass.Melee; Item.useTime = 40; Item.useAnimation = 40; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 2; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 17; - Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; Item.UseSound = SoundID.Item1; Item.autoReuse = true; @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Weapons.Melee for (int i = 0; i <= 21; i++) { Dust dust; - dust = Main.dust[Dust.NewDust(new Vector2(position.X - 58 / 2, position.Y - 58 / 2), 58, 58, 226, 0f, 0f, 0, new Color(255, 255, 255), 0.4605263f)]; + dust = Main.dust[Dust.NewDust(new Vector2(position.X - 58 / 2, position.Y - 58 / 2), 58, 58, DustID.Electric, 0f, 0f, 0, new Color(255, 255, 255), 0.4605263f)]; dust.noGravity = true; dust.fadeIn = 0.9473684f; } diff --git a/Items/Weapons/Melee/EvilSmasher.cs b/Items/Weapons/Melee/EvilSmasher.cs index 1fdc322a6c..27abbe6fa8 100644 --- a/Items/Weapons/Melee/EvilSmasher.cs +++ b/Items/Weapons/Melee/EvilSmasher.cs @@ -11,7 +11,6 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 64; Item.height = 66; - Item.scale = 2f; Item.damage = 120; Item.DamageType = DamageClass.Melee; Item.useAnimation = Item.useTime = 38; @@ -20,12 +19,12 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 6f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; } public override float UseSpeedMultiplier(Player player) => 1f + (player.Calamity().evilSmasherBoost * 0.1f); - + public override void ModifyWeaponDamage(Player player, ref StatModifier damage) => damage *= 1f + player.Calamity().evilSmasherBoost * 0.1f; public override void ModifyWeaponKnockback(Player player, ref StatModifier knockback) => knockback *= 1f + (player.Calamity().evilSmasherBoost * 0.1f); diff --git a/Items/Weapons/Melee/ExaltedOathblade.cs b/Items/Weapons/Melee/ExaltedOathblade.cs index 935f03de6c..55d3e34c95 100644 --- a/Items/Weapons/Melee/ExaltedOathblade.cs +++ b/Items/Weapons/Melee/ExaltedOathblade.cs @@ -1,13 +1,13 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using System; using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Items.Weapons.Melee { @@ -15,6 +15,9 @@ namespace CalamityMod.Items.Weapons.Melee public class ExaltedOathblade : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + + internal const float ShootSpeed = 3f; + public override void SetDefaults() { Item.width = 88; @@ -28,10 +31,10 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 7.5f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 3f; + Item.shootSpeed = ShootSpeed; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) @@ -40,7 +43,7 @@ namespace CalamityMod.Items.Weapons.Melee for (int i = -index; i <= index; i += index) { Vector2 perturbedSpeed = velocity.RotatedBy(MathHelper.ToRadians(i)); - Projectile.NewProjectile(source, position, perturbedSpeed, type, damage / 2, knockback, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, position, perturbedSpeed, type, damage / 2, knockback, player.whoAmI); } return false; } @@ -48,7 +51,7 @@ namespace CalamityMod.Items.Weapons.Melee 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, 173); + Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, DustID.ShadowbeamStaff); } public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) @@ -68,14 +71,14 @@ namespace CalamityMod.Items.Weapons.Melee SoundEngine.PlaySound(SoundID.Item14, target.Center); for (int i = 0; i < 40; i++) { - int swingDust = Dust.NewDust(target.position, target.width, target.height, 173, 0f, 0f, 200, default, firstDustScale); + int swingDust = Dust.NewDust(target.position, target.width, target.height, DustID.ShadowbeamStaff, 0f, 0f, 200, default, firstDustScale); Dust dust = Main.dust[swingDust]; dust.position = target.Center + Vector2.UnitY.RotatedByRandom(Math.PI) * (float)Main.rand.NextDouble() * (float)target.width / 2f; dust.noGravity = true; dust.velocity.Y -= 4.5f; dust.velocity *= 3f; dust.velocity += dustVelocity * Main.rand.NextFloat(); - swingDust = Dust.NewDust(target.position, target.width, target.height, 173, 0f, 0f, 100, default, secondDustScale); + swingDust = Dust.NewDust(target.position, target.width, target.height, DustID.ShadowbeamStaff, 0f, 0f, 100, default, secondDustScale); dust.position = target.Center + Vector2.UnitY.RotatedByRandom(Math.PI) * (float)Main.rand.NextDouble() * (float)target.width / 2f; dust.velocity.Y -= 3f; dust.velocity *= 2f; @@ -86,7 +89,7 @@ namespace CalamityMod.Items.Weapons.Melee } for (int j = 0; j < 20; j++) { - int swingDust2 = Dust.NewDust(target.position, target.width, target.height, 173, 0f, 0f, 0, default, thirdDustScale); + int swingDust2 = Dust.NewDust(target.position, target.width, target.height, DustID.ShadowbeamStaff, 0f, 0f, 0, default, thirdDustScale); Dust dust = Main.dust[swingDust2]; dust.position = target.Center + Vector2.UnitX.RotatedByRandom(Math.PI).RotatedBy((double)target.velocity.ToRotation(), default) * (float)target.width / 3f; dust.noGravity = true; diff --git a/Items/Weapons/Melee/Excelsus.cs b/Items/Weapons/Melee/Excelsus.cs index 68511ac11b..4aab4c5fdb 100644 --- a/Items/Weapons/Melee/Excelsus.cs +++ b/Items/Weapons/Melee/Excelsus.cs @@ -15,6 +15,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { Item.width = 78; + Item.height = 94; Item.damage = 250; Item.DamageType = DamageClass.Melee; Item.useAnimation = 15; @@ -24,8 +25,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 8f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 94; - Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.rare = ModContent.RarityType(); Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; diff --git a/Items/Weapons/Melee/Exoblade.cs b/Items/Weapons/Melee/Exoblade.cs index 0576af4659..e4e2851a5e 100644 --- a/Items/Weapons/Melee/Exoblade.cs +++ b/Items/Weapons/Melee/Exoblade.cs @@ -1,9 +1,10 @@ -using CalamityMod.Items.Materials; +using System.Linq; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; -using System.Linq; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; using Terraria.DataStructures; @@ -24,10 +25,9 @@ namespace CalamityMod.Items.Weapons.Melee public static readonly SoundStyle DashSound = new("CalamityMod/Sounds/Item/ExobladeDash") { Volume = 0.6f }; public static readonly SoundStyle DashHitSound = new("CalamityMod/Sounds/Item/ExobladeDashImpact") { Volume = 0.85f }; - public static int BeamNoHomeTime = 24; - public static float NotTrueMeleeDamagePenalty = 0.46f; + public static float NotTrueMeleeDamagePenalty = 0.35f; public static float ExplosionDamageFactor = 1.8f; @@ -50,7 +50,7 @@ namespace CalamityMod.Items.Weapons.Melee public static int DashTime = 49; public static int BaseUseTime = 49; - public static int BeamsPerSwing = 3; + public static int BeamsPerSwing = 4; public override void SetDefaults() { @@ -66,7 +66,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.autoReuse = true; Item.noUseGraphic = true; Item.channel = true; - Item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.shoot = ProjectileType(); Item.shootSpeed = 9f; Item.rare = RarityType(); @@ -79,7 +79,7 @@ namespace CalamityMod.Items.Weapons.Melee return !Main.projectile.Any(n => n.active && n.owner == player.whoAmI && n.type == ProjectileType()); - return !Main.projectile.Any(n => n.active && n.owner == player.whoAmI && n.type == ProjectileType() && + return !Main.projectile.Any(n => n.active && n.owner == player.whoAmI && n.type == ProjectileType() && !(n.ai[0] == 1 && n.ai[1] == 1)); //Ignores exoblades in post bonk stasis. } @@ -127,6 +127,11 @@ namespace CalamityMod.Items.Weapons.Melee return false; } + 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/ExobladeGlow").Value); + } + public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Weapons/Melee/Exoblade.png b/Items/Weapons/Melee/Exoblade.png index fcadbc5b37..ea819cc632 100644 Binary files a/Items/Weapons/Melee/Exoblade.png and b/Items/Weapons/Melee/Exoblade.png differ diff --git a/Items/Weapons/Melee/ExobladeGlow.png b/Items/Weapons/Melee/ExobladeGlow.png new file mode 100644 index 0000000000..5529b42e13 Binary files /dev/null and b/Items/Weapons/Melee/ExobladeGlow.png differ diff --git a/Items/Weapons/Melee/ExobladeSquare.png b/Items/Weapons/Melee/ExobladeSquare.png index fd9fe0288c..f679194f8d 100644 Binary files a/Items/Weapons/Melee/ExobladeSquare.png and b/Items/Weapons/Melee/ExobladeSquare.png differ diff --git a/Items/Weapons/Melee/FallenPaladinsHammer.cs b/Items/Weapons/Melee/FallenPaladinsHammer.cs index 83482adefc..0c43c3267e 100644 --- a/Items/Weapons/Melee/FallenPaladinsHammer.cs +++ b/Items/Weapons/Melee/FallenPaladinsHammer.cs @@ -15,6 +15,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 14; + Item.height = 28; Item.damage = 368; Item.noMelee = true; Item.noUseGraphic = true; @@ -24,7 +25,6 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 20f; Item.UseSound = SoundID.Item1; Item.DamageType = DamageClass.MeleeNoSpeed; - Item.height = 28; Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Melee/FaultLine.cs b/Items/Weapons/Melee/FaultLine.cs index f76d250ae5..fb99d311a7 100644 --- a/Items/Weapons/Melee/FaultLine.cs +++ b/Items/Weapons/Melee/FaultLine.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.width = 30; Item.height = 26; Item.DamageType = DamageClass.MeleeNoSpeed; - Item.damage = 75; // 110 pre-nerf + Item.damage = 75; Item.knockBack = 4f; Item.useTime = 22; Item.useAnimation = 22; diff --git a/Items/Weapons/Melee/FeralthornClaymore.cs b/Items/Weapons/Melee/FeralthornClaymore.cs index d67132d17f..4822393f51 100644 --- a/Items/Weapons/Melee/FeralthornClaymore.cs +++ b/Items/Weapons/Melee/FeralthornClaymore.cs @@ -13,7 +13,8 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { Item.width = 68; - Item.damage = 80; + Item.height = 66; + Item.damage = 109; Item.DamageType = DamageClass.Melee; Item.useAnimation = 13; Item.useStyle = ItemUseStyleID.Swing; @@ -22,29 +23,23 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 7.25f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 66; - Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; } public override void MeleeEffects(Player player, Rectangle hitbox) { if (Main.rand.NextBool(4)) - Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 44); + Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, DustID.JungleSpore); } - public override void ModifyHitNPC(Player player, NPC target, ref NPC.HitModifiers modifiers) - { - modifiers.CritDamage *= 0.5f; - } public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(BuffID.Venom, 300); var source = player.GetSource_ItemUse(Item); - Projectile.NewProjectile(source, player.position.X + 40f + Main.rand.Next(0, 151), player.position.Y + 36f, 0f, -18f, ModContent.ProjectileType(), (int)(Item.damage * 0.25), 0f, Main.myPlayer); - Projectile.NewProjectile(source, player.position.X - 40f + Main.rand.Next(-150, 1), player.position.Y + 36f, 0f, -18f, ModContent.ProjectileType(), (int)(Item.damage * 0.25), 0f, Main.myPlayer); + Projectile.NewProjectile(source, target.Center.X, target.Center.Y, Main.rand.NextFloat(-18f, 18f), Main.rand.NextFloat(-18f, 18f), ModContent.ProjectileType(), (int)(Item.damage * 0.5), 0f, Main.myPlayer); } public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo) @@ -53,8 +48,7 @@ namespace CalamityMod.Items.Weapons.Melee var source = player.GetSource_ItemUse(Item); - Projectile.NewProjectile(source, player.position.X + 40f + Main.rand.Next(0, 151), player.position.Y + 36f, 0f, -18f, ModContent.ProjectileType(), (int)(Item.damage * 0.25), 0f, Main.myPlayer); - Projectile.NewProjectile(source, player.position.X - 40f + Main.rand.Next(-150, 1), player.position.Y + 36f, 0f, -18f, ModContent.ProjectileType(), (int)(Item.damage * 0.25), 0f, Main.myPlayer); + Projectile.NewProjectile(source, target.Center.X, target.Center.Y, Main.rand.NextFloat(-18f, 18f), Main.rand.NextFloat(-18f, 18f), ModContent.ProjectileType(), (int)(Item.damage * 0.5), 0f, Main.myPlayer); } public override void AddRecipes() diff --git a/Items/Weapons/Melee/FlarefrostBlade.cs b/Items/Weapons/Melee/FlarefrostBlade.cs index 1cafd81d66..05ef94c203 100644 --- a/Items/Weapons/Melee/FlarefrostBlade.cs +++ b/Items/Weapons/Melee/FlarefrostBlade.cs @@ -13,6 +13,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { Item.width = 64; + Item.height = 66; Item.damage = 125; Item.DamageType = DamageClass.Melee; Item.useAnimation = Item.useTime = 29; @@ -21,8 +22,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 6.25f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 66; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 11f; diff --git a/Items/Weapons/Melee/Floodtide.cs b/Items/Weapons/Melee/Floodtide.cs index 552393c48e..cf6602e1e3 100644 --- a/Items/Weapons/Melee/Floodtide.cs +++ b/Items/Weapons/Melee/Floodtide.cs @@ -1,9 +1,9 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; -using CalamityMod.Projectiles.Ranged; +using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -14,20 +14,20 @@ namespace CalamityMod.Items.Weapons.Melee public new string LocalizationCategory => "Items.Weapons.Melee"; public override void SetDefaults() { - Item.damage = 75; - Item.DamageType = DamageClass.Melee; Item.width = 80; Item.height = 92; + Item.damage = 91; + Item.DamageType = DamageClass.Melee; Item.useTime = 21; Item.useAnimation = 21; Item.useTurn = true; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 6f; - Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.shoot = ModContent.ProjectileType(); + Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 18f; } @@ -42,9 +42,7 @@ namespace CalamityMod.Items.Weapons.Melee { float SpeedX = velocity.X + (float)Main.rand.Next(-20, 21) * 0.05f; float SpeedY = velocity.Y + (float)Main.rand.Next(-20, 21) * 0.05f; - int proj = Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI, 0f, 0f); - if (proj.WithinBounds(Main.maxProjectiles)) - Main.projectile[proj].DamageType = DamageClass.Melee; + Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI, 0f, 0f); } return false; } @@ -53,7 +51,7 @@ namespace CalamityMod.Items.Weapons.Melee { if (Main.rand.NextBool(5)) { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 217); + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, DustID.FishronWings); } } diff --git a/Items/Weapons/Melee/ForbiddenOathblade.cs b/Items/Weapons/Melee/ForbiddenOathblade.cs index 83822db3c7..c9b078de77 100644 --- a/Items/Weapons/Melee/ForbiddenOathblade.cs +++ b/Items/Weapons/Melee/ForbiddenOathblade.cs @@ -1,10 +1,10 @@ -using CalamityMod.Projectiles.Melee; -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Items.Weapons.Melee { @@ -15,7 +15,6 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 74; Item.height = 74; - Item.scale = 1.5f; Item.damage = 110; Item.DamageType = DamageClass.Melee; Item.useAnimation = Item.useTime = 55; @@ -24,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 6.5f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; @@ -33,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Melee 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, 173); + Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, DustID.ShadowbeamStaff); } public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) @@ -55,14 +54,14 @@ namespace CalamityMod.Items.Weapons.Melee int dustIncr; for (int i = 0; i < 40; i = dustIncr + 1) { - int swingDust = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 173, 0f, 0f, 200, default, firstDustScale); + int swingDust = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, DustID.ShadowbeamStaff, 0f, 0f, 200, default, firstDustScale); Dust dust = Main.dust[swingDust]; dust.position = target.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)target.width / 2f; dust.noGravity = true; dust.velocity.Y -= 4.5f; dust.velocity *= 3f; dust.velocity += dustVelocity * Main.rand.NextFloat(); - swingDust = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 173, 0f, 0f, 100, default, secondDustScale); + swingDust = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, DustID.ShadowbeamStaff, 0f, 0f, 100, default, secondDustScale); dust.position = target.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)target.width / 2f; dust.velocity.Y -= 3f; dust.velocity *= 2f; @@ -74,7 +73,7 @@ namespace CalamityMod.Items.Weapons.Melee } for (int j = 0; j < 20; j = dustIncr + 1) { - int swingDust2 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 173, 0f, 0f, 0, default, thirdDustScale); + int swingDust2 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, DustID.ShadowbeamStaff, 0f, 0f, 0, default, thirdDustScale); Dust dust = Main.dust[swingDust2]; dust.position = target.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)target.velocity.ToRotation(), default) * (float)target.width / 3f; dust.noGravity = true; diff --git a/Items/Weapons/Melee/ForsakenSaber.cs b/Items/Weapons/Melee/ForsakenSaber.cs index b12b697618..bc4f7501e2 100644 --- a/Items/Weapons/Melee/ForsakenSaber.cs +++ b/Items/Weapons/Melee/ForsakenSaber.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Melee; +using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -13,6 +13,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { Item.width = 46; + Item.height = 56; Item.damage = 80; Item.DamageType = DamageClass.Melee; Item.useAnimation = Item.useTime = 15; @@ -21,8 +22,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 6; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 56; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 15f; @@ -43,7 +43,7 @@ namespace CalamityMod.Items.Weapons.Melee { if (Main.rand.NextBool(3)) { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 159); + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, DustID.Teleporter); } } diff --git a/Items/Weapons/Melee/FourSeasonsGalaxia.cs b/Items/Weapons/Melee/FourSeasonsGalaxia.cs index dc049aaad3..f2a0223988 100644 --- a/Items/Weapons/Melee/FourSeasonsGalaxia.cs +++ b/Items/Weapons/Melee/FourSeasonsGalaxia.cs @@ -182,10 +182,14 @@ namespace CalamityMod.Items.Weapons.Melee #endregion + // 03FEB2024: Ozzatron: added so the Iban Blades don't break Overhaul compatibility. Weapons are functionally unchanged. + public override bool AltFunctionUse(Player player) => true; + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - if (mainAttunement == null) + if (mainAttunement == null || player.altFunctionUse != ItemAlternativeFunctionID.None) return false; + return true; } @@ -245,7 +249,8 @@ namespace CalamityMod.Items.Weapons.Melee public override bool CanUseItem(Player player) { - return !Main.projectile.Any(n => n.active && n.owner == player.whoAmI && + bool isRightClicking = player.altFunctionUse != ItemAlternativeFunctionID.None; + return !isRightClicking && !Main.projectile.Any(n => n.active && n.owner == player.whoAmI && (n.type == ProjectileType() || n.type == ProjectileType() || n.type == ProjectileType() || diff --git a/Items/Weapons/Melee/FracturedArk.cs b/Items/Weapons/Melee/FracturedArk.cs index eaba78acbd..f7b6845084 100644 --- a/Items/Weapons/Melee/FracturedArk.cs +++ b/Items/Weapons/Melee/FracturedArk.cs @@ -1,16 +1,16 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Melee; -using Microsoft.Xna.Framework; -using System; +using System; +using System.Collections.Generic; using System.IO; using System.Linq; +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Melee; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; using Terraria.ID; -using static Terraria.ModLoader.ModContent; using Terraria.ModLoader; -using Microsoft.Xna.Framework.Graphics; -using System.Collections.Generic; +using static Terraria.ModLoader.ModContent; namespace CalamityMod.Items.Weapons.Melee { @@ -54,7 +54,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 6.25f; Item.UseSound = null; Item.autoReuse = true; - Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; Item.shoot = ProjectileID.PurificationPowder; Item.shootSpeed = 15f; @@ -89,7 +89,7 @@ namespace CalamityMod.Items.Weapons.Melee Projectile.NewProjectile(source, player.Center, velocity, ProjectileType(), damage, knockback, player.whoAmI, Combo, Charge); Combo *= -1f; - Charge --; + Charge--; if (Charge < 0) Charge = 0; @@ -132,7 +132,7 @@ namespace CalamityMod.Items.Weapons.Melee Rectangle frameCrop = new Rectangle(0, 0, (int)(Charge / 10f * barFG.Width), barFG.Height); Color color = Main.hslToRgb((Main.GlobalTimeWrappedHourly * 0.6f) % 1, 1, 0.85f + (float)Math.Sin(Main.GlobalTimeWrappedHourly * 3f) * 0.1f); - spriteBatch.Draw(barBG, drawPos, null, color , 0f, barOrigin, scale * barScale, 0f, 0f); + spriteBatch.Draw(barBG, drawPos, null, color, 0f, barOrigin, scale * barScale, 0f, 0f); spriteBatch.Draw(barFG, drawPos, frameCrop, color * 0.8f, 0f, barOrigin, scale * barScale, 0f, 0f); } diff --git a/Items/Weapons/Melee/GaelsGreatsword.cs b/Items/Weapons/Melee/GaelsGreatsword.cs index 6e344a3f31..c4d9e656db 100644 --- a/Items/Weapons/Melee/GaelsGreatsword.cs +++ b/Items/Weapons/Melee/GaelsGreatsword.cs @@ -1,7 +1,7 @@ -using CalamityMod.Projectiles.Melee; +using System; +using CalamityMod.Projectiles.Melee; using CalamityMod.Rarities; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -14,8 +14,8 @@ namespace CalamityMod.Items.Weapons.Melee { public new string LocalizationCategory => "Items.Weapons.Melee"; // Weapon attribute constants - public static readonly int BaseDamage = 670; - public static readonly float GiantSkullDamageMultiplier = 1.5f; + public static readonly int BaseDamage = 690; + public static readonly float GiantSkullDamageMultiplier = 1.7f; // Weapon projectile attribute constants public static readonly int SearchDistance = 1450; @@ -41,7 +41,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.rare = ModContent.RarityType(); Item.Calamity().devItem = true; @@ -73,7 +73,7 @@ namespace CalamityMod.Items.Weapons.Melee player.Calamity().gaelSwipes++; if (player.statLife <= player.statLifeMax2 * 0.5f) { - for (int i = 0; i < 170; i++) + for (int i = 0; i < 120; i++) { float r = (float)Math.Sqrt(Main.rand.NextDouble()); float t = Main.rand.NextFloat() * MathHelper.TwoPi; @@ -126,8 +126,8 @@ namespace CalamityMod.Items.Weapons.Melee //Giant, slow, fading skull case 1: int largeSkullDmg = (int)(damage * GiantSkullDamageMultiplier); - int projectileIndex = Projectile.NewProjectile(source, position, velocity * 0.6f, type, largeSkullDmg, knockback, player.whoAmI, ai1:1f); - Main.projectile[projectileIndex].scale = 1.75f; + int projectileIndex = Projectile.NewProjectile(source, position, velocity * 0.6f, type, largeSkullDmg, knockback, player.whoAmI, ai1: 1f); + Main.projectile[projectileIndex].scale = 2f; break; } return false; diff --git a/Items/Weapons/Melee/GalactusBlade.cs b/Items/Weapons/Melee/GalactusBlade.cs index a2e0c6ceab..7d90459230 100644 --- a/Items/Weapons/Melee/GalactusBlade.cs +++ b/Items/Weapons/Melee/GalactusBlade.cs @@ -1,9 +1,9 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; using CalamityMod.Rarities; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -19,6 +19,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { Item.width = 60; + Item.height = 58; Item.damage = 84; Item.DamageType = DamageClass.Melee; Item.useAnimation = 17; @@ -28,8 +29,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 6f; Item.UseSound = SoundID.Item105; Item.autoReuse = true; - Item.height = 58; - Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 23f; diff --git a/Items/Weapons/Melee/GalileoGladius.cs b/Items/Weapons/Melee/GalileoGladius.cs index edae7ebf82..fa34986a90 100644 --- a/Items/Weapons/Melee/GalileoGladius.cs +++ b/Items/Weapons/Melee/GalileoGladius.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.shootSpeed = 0.9f; Item.knockBack = 10f; Item.UseSound = SoundID.Item1; - Item.value = CalamityGlobalItem.Rarity13BuyPrice; + Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; Item.rare = ModContent.RarityType(); } diff --git a/Items/Weapons/Melee/GeliticBlade.cs b/Items/Weapons/Melee/GeliticBlade.cs index c1fd155865..16ab04f7ab 100644 --- a/Items/Weapons/Melee/GeliticBlade.cs +++ b/Items/Weapons/Melee/GeliticBlade.cs @@ -1,6 +1,6 @@ using CalamityMod.Items.Materials; -using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Projectiles.Melee; +using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 5.25f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 9f; @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Weapons.Melee { if (Main.rand.NextBool(3)) { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 20); + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, DustID.PurificationPowder); } } diff --git a/Items/Weapons/Melee/GildedProboscis.cs b/Items/Weapons/Melee/GildedProboscis.cs index b1dbaf00e6..45b27e9071 100644 --- a/Items/Weapons/Melee/GildedProboscis.cs +++ b/Items/Weapons/Melee/GildedProboscis.cs @@ -16,6 +16,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { Item.width = 66; + Item.height = 66; Item.damage = 315; Item.DamageType = TrueMeleeDamageClass.Instance; Item.noMelee = true; @@ -27,8 +28,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 8.75f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 66; - Item.value = CalamityGlobalItem.Rarity11BuyPrice; + Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; Item.rare = ItemRarityID.Purple; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 13f; diff --git a/Items/Weapons/Melee/GoldplumeSpear.cs b/Items/Weapons/Melee/GoldplumeSpear.cs index 5ec751c3a2..d2b38a87c0 100644 --- a/Items/Weapons/Melee/GoldplumeSpear.cs +++ b/Items/Weapons/Melee/GoldplumeSpear.cs @@ -17,7 +17,8 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { Item.width = 54; - Item.damage = 24; + Item.height = 54; + Item.damage = 27; Item.DamageType = DamageClass.Melee; Item.noMelee = true; Item.useTurn = true; @@ -28,8 +29,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 5.75f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 54; - Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 8f; diff --git a/Items/Weapons/Melee/GrandGuardian.cs b/Items/Weapons/Melee/GrandGuardian.cs index df0cd6036c..339dbd02c4 100644 --- a/Items/Weapons/Melee/GrandGuardian.cs +++ b/Items/Weapons/Melee/GrandGuardian.cs @@ -1,7 +1,7 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Healing; +using CalamityMod.Projectiles.Healing; using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -11,6 +11,13 @@ namespace CalamityMod.Items.Weapons.Melee public class GrandGuardian : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + + internal const int TotalHealOrbs = 3; + + internal const int HealPerOrb = 3; + + internal const int TotalHealed = TotalHealOrbs * HealPerOrb; + public override void SetDefaults() { Item.width = 130; @@ -24,14 +31,19 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 8.5f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.value = CalamityGlobalItem.Rarity10BuyPrice; + Item.value = CalamityGlobalItem.RarityRedBuyPrice; Item.rare = ItemRarityID.Red; Item.shootSpeed = 12f; } + 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/GrandGuardianGlow").Value); + } + public override void UseStyle(Player player, Rectangle heldItemFrame) { - player.itemLocation += new Vector2(-32f * player.direction, 12f * player.gravDir).RotatedBy(player.itemRotation); + player.itemLocation += new Vector2(-12f * player.direction, 2f * player.gravDir).RotatedBy(player.itemRotation); } public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) @@ -39,54 +51,61 @@ namespace CalamityMod.Items.Weapons.Melee if (target.Calamity().miscDefenseLoss < target.defense) target.Calamity().miscDefenseLoss += 1; - if (target.Calamity().miscDefenseLoss >= target.defense && target.canGhostHeal && !player.moonLeech) - { - player.statLife += 4; - player.HealEffect(4); - } + OnHitEffects(player, target.Center, target.life, target.lifeMax, Item.knockBack, Item.damage); - OnHitEffects(player, target.Center, target.life, target.lifeMax, Item.knockBack, Item.damage, hit.Crit); + if (target.Calamity().miscDefenseLoss >= target.defense) + { + if (player.moonLeech || player.lifeSteal <= 0f || target.lifeMax <= 5) + return; + + int heal = 6; + player.lifeSteal -= heal; + player.statLife += heal; + player.HealEffect(heal); + if (player.statLife > player.statLifeMax2) + player.statLife = player.statLifeMax2; + } } public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo) { - OnHitEffects(player, target.Center, target.statLife, target.statLifeMax2, Item.knockBack, Item.damage, false); + OnHitEffects(player, target.Center, target.statLife, target.statLifeMax2, Item.knockBack, Item.damage); } - // this should use onHitNPC and ModifyHitNPC instead of onHitEffects - private void OnHitEffects(Player player, Vector2 targetPos, int targetLife, int targetMaxLife, float knockback, int damage, bool crit) + + private void OnHitEffects(Player player, Vector2 targetPos, int targetLife, int targetMaxLife, float knockback, int damage) { var source = player.GetSource_ItemUse(Item); - if (crit) - damage /= 2; - Projectile.NewProjectile(source, targetPos, Vector2.Zero, ModContent.ProjectileType(), (int)(damage * 0.5f), 0f, player.whoAmI); + // Grand Guardian is classed as a regular melee weapon, so despite being a true melee on-hit, these scale with regular melee. + StatModifier playerMeleeDmg = player.GetTotalDamage(); + int rainbowBoomDamage = (int)playerMeleeDmg.ApplyTo(damage * 0.5f); + int rainBoltDamage = (int)playerMeleeDmg.ApplyTo(damage * 0.75f); + + Projectile.NewProjectile(source, targetPos, Vector2.Zero, ModContent.ProjectileType(), rainbowBoomDamage, 0f, player.whoAmI); + if (targetLife <= (targetMaxLife * 0.5f) && player.ownedProjectileCounts[ModContent.ProjectileType()] < 3) { - float randomSpeedX = Main.rand.Next(6, 13); - float randomSpeedY = Main.rand.Next(6, 13); - Projectile.NewProjectile(source, targetPos.X, targetPos.Y, -randomSpeedX, -randomSpeedY, ModContent.ProjectileType(), (int)(damage * 0.75f), knockback, player.whoAmI); - Projectile.NewProjectile(source, targetPos.X, targetPos.Y, randomSpeedX, -randomSpeedY, ModContent.ProjectileType(), (int)(damage * 0.75f), knockback, player.whoAmI); - Projectile.NewProjectile(source, targetPos.X, targetPos.Y, 0f, -randomSpeedY, ModContent.ProjectileType(), (int)(damage * 0.75f), knockback, player.whoAmI); + float randomSpeedX = Main.rand.NextFloat(6f, 12f); + float randomSpeedY = Main.rand.NextFloat(6f, 12f); + Projectile.NewProjectile(source, targetPos.X, targetPos.Y, -randomSpeedX, -randomSpeedY, ModContent.ProjectileType(), rainBoltDamage, knockback, player.whoAmI); + Projectile.NewProjectile(source, targetPos.X, targetPos.Y, randomSpeedX, -randomSpeedY, ModContent.ProjectileType(), rainBoltDamage, knockback, player.whoAmI); + Projectile.NewProjectile(source, targetPos.X, targetPos.Y, 0f, -randomSpeedY, ModContent.ProjectileType(), rainBoltDamage, knockback, player.whoAmI); } - if (targetLife <= 0 && !player.moonLeech && player.ownedProjectileCounts[ModContent.ProjectileType()] < 3) + + if (player.moonLeech || player.lifeSteal <= 0f) + return; + + if (targetLife <= 0 && !player.moonLeech && player.ownedProjectileCounts[ModContent.ProjectileType()] < 3 && targetMaxLife > 5) { - float randomSpeedX = Main.rand.Next(3, 7); - float randomSpeedY = Main.rand.Next(3, 7); + player.lifeSteal -= TotalHealed; + float randomSpeedX = Main.rand.NextFloat(3f, 4.5f); + float randomSpeedY = Main.rand.NextFloat(3f, 4.5f); Projectile.NewProjectile(source, targetPos.X, targetPos.Y, -randomSpeedX, -randomSpeedY, ModContent.ProjectileType(), 0, 0f, player.whoAmI); Projectile.NewProjectile(source, targetPos.X, targetPos.Y, randomSpeedX, -randomSpeedY, ModContent.ProjectileType(), 0, 0f, player.whoAmI); Projectile.NewProjectile(source, targetPos.X, targetPos.Y, 0f, -randomSpeedY, ModContent.ProjectileType(), 0, 0f, player.whoAmI); } } - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool(3)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); - Main.dust[dust].noGravity = true; - } - } - public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Weapons/Melee/GrandGuardian.png b/Items/Weapons/Melee/GrandGuardian.png index fc6194f528..804a2b30f9 100644 Binary files a/Items/Weapons/Melee/GrandGuardian.png and b/Items/Weapons/Melee/GrandGuardian.png differ diff --git a/Items/Weapons/Melee/GrandGuardianGlow.png b/Items/Weapons/Melee/GrandGuardianGlow.png new file mode 100644 index 0000000000..7b6f39623c Binary files /dev/null and b/Items/Weapons/Melee/GrandGuardianGlow.png differ diff --git a/Items/Weapons/Melee/GreatswordofJudgement.cs b/Items/Weapons/Melee/GreatswordofJudgement.cs index c53160bd91..1732260e9d 100644 --- a/Items/Weapons/Melee/GreatswordofJudgement.cs +++ b/Items/Weapons/Melee/GreatswordofJudgement.cs @@ -10,6 +10,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { Item.width = 78; + Item.height = 78; Item.damage = 40; Item.DamageType = DamageClass.Melee; Item.useAnimation = 18; @@ -19,9 +20,8 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 7f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 78; - Item.value = CalamityGlobalItem.Rarity10BuyPrice; - Item.rare = ItemRarityID.Red; + Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; + Item.rare = ItemRarityID.Purple; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; } diff --git a/Items/Weapons/Melee/GreatswordofJudgementGlow.png b/Items/Weapons/Melee/GreatswordofJudgementGlow.png new file mode 100644 index 0000000000..fde78a59ec Binary files /dev/null and b/Items/Weapons/Melee/GreatswordofJudgementGlow.png differ diff --git a/Items/Weapons/Melee/Greentide.cs b/Items/Weapons/Melee/Greentide.cs index 8286a296d9..836b4b600d 100644 --- a/Items/Weapons/Melee/Greentide.cs +++ b/Items/Weapons/Melee/Greentide.cs @@ -1,6 +1,6 @@ -using CalamityMod.Projectiles.Melee; +using System; +using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,146 +10,143 @@ namespace CalamityMod.Items.Weapons.Melee public class Greentide : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + + internal const float ShootSpeed = 32f; + + internal const float TeethSpread = 960f; + + internal const float HalvedTeethSpread = TeethSpread * 0.5f; + + internal const int TotalRows = 2; + + internal const int TotalTeeth = 5; + public override void SetDefaults() { - Item.damage = 95; - Item.DamageType = DamageClass.Melee; Item.width = 62; Item.height = 62; - Item.scale = 1.5f; - Item.useTime = 24; - Item.useAnimation = 24; + Item.damage = 87; // IS THAT THE BITE OF '87 + Item.DamageType = DamageClass.Melee; + Item.useTime = 31; + Item.useAnimation = 31; Item.useTurn = true; Item.useStyle = ItemUseStyleID.Swing; - Item.knockBack = 7; - Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.knockBack = 7f; + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.shootSpeed = 18f; + Item.shootSpeed = ShootSpeed; } public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) { - var source = player.GetSource_ItemUse(Item); - int i = Main.myPlayer; - float projSpeed = Item.shootSpeed; - float playerKnockback = hit.Knockback; - playerKnockback = player.GetWeaponKnockback(Item, playerKnockback); - 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) - { - mouseYDist = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - realPlayerPos.Y; - } - float mouseDistance = (float)Math.Sqrt((double)(mouseXDist * mouseXDist + mouseYDist * mouseYDist)); - if ((float.IsNaN(mouseXDist) && float.IsNaN(mouseYDist)) || (mouseXDist == 0f && mouseYDist == 0f)) - { - mouseXDist = (float)player.direction; - mouseYDist = 0f; - mouseDistance = projSpeed; - } - else - { - mouseDistance = projSpeed / mouseDistance; - } + Vector2 destination = target.Center; - for (int j = 0; j < 3; j++) + Vector2 position = destination - (Vector2.UnitY * (destination.Y - Main.screenPosition.Y + 80f)); + Vector2 cachedPosition = position; + Vector2 secondPosition = cachedPosition + (Vector2.UnitY * (Main.screenHeight + 160f)); + Vector2 secondCachedPosition = secondPosition; + + Vector2 velocity = (destination - position).SafeNormalize(Vector2.UnitY) * ShootSpeed; + Vector2 cachedVelocity = velocity; + Vector2 secondVelocity = (destination - secondPosition).SafeNormalize(Vector2.UnitY) * ShootSpeed; + Vector2 secondCachedVelocity = secondVelocity; + + int teethDamage = player.CalcIntDamage((int)(Item.damage * 0.5)); + float teethKnockback = Item.knockBack * 0.2f; + bool evenNumberOfProjectiles = TotalTeeth % 2 == 0; + float amountToAdd = evenNumberOfProjectiles ? 0.5f : 0f; + int centralProjectile = TotalTeeth / 2; + int otherCentralProjectile = centralProjectile - 1; + float teethXVelocityReduction = 0.9f; + float minVelocityAdjustment = 0.8f; + float maxVelocityAdjustment = 1f; + float velocityAdjustment = minVelocityAdjustment; + for (int i = 0; i < TotalRows; i++) { - realPlayerPos = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); - realPlayerPos.X = (realPlayerPos.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); - realPlayerPos.Y -= (float)(100 * j); - mouseXDist = (float)Main.mouseX + Main.screenPosition.X - realPlayerPos.X; - mouseYDist = (float)Main.mouseY + Main.screenPosition.Y - realPlayerPos.Y; - if (mouseYDist < 0f) + bool topTeeth = i == 0; + for (int j = 0; j < TotalTeeth; j++) { - mouseYDist *= -1f; + velocityAdjustment = ((j == centralProjectile || j == otherCentralProjectile) && evenNumberOfProjectiles) ? minVelocityAdjustment : MathHelper.Lerp(minVelocityAdjustment, maxVelocityAdjustment, Math.Abs((j + amountToAdd) - centralProjectile) / (float)centralProjectile); + if (topTeeth) + { + position.X += MathHelper.Lerp(-HalvedTeethSpread, HalvedTeethSpread, j / (float)(TotalTeeth - 1)); + velocity = CalamityUtils.CalculatePredictiveAimToTargetMaxUpdates(position, target, ShootSpeed, 1) * velocityAdjustment; + velocity.X *= teethXVelocityReduction; + Projectile.NewProjectile(player.GetSource_ItemUse(Item), position, velocity, ModContent.ProjectileType(), teethDamage, teethKnockback, player.whoAmI, 0f, i, target.Center.Y); + position = cachedPosition; + velocity = cachedVelocity; + } + else + { + secondPosition.X += MathHelper.Lerp(-HalvedTeethSpread, HalvedTeethSpread, j / (float)(TotalTeeth - 1)); + secondVelocity = CalamityUtils.CalculatePredictiveAimToTargetMaxUpdates(secondPosition, target, ShootSpeed, 1) * velocityAdjustment; + secondVelocity.X *= teethXVelocityReduction; + Projectile.NewProjectile(player.GetSource_ItemUse(Item), secondPosition, secondVelocity, ModContent.ProjectileType(), teethDamage, teethKnockback, player.whoAmI, 0f, i, target.Center.Y); + secondPosition = secondCachedPosition; + secondVelocity = secondCachedVelocity; + } } - if (mouseYDist < 20f) - { - mouseYDist = 20f; - } - mouseDistance = (float)Math.Sqrt((double)(mouseXDist * mouseXDist + mouseYDist * mouseYDist)); - mouseDistance = projSpeed / mouseDistance; - mouseXDist *= mouseDistance; - mouseYDist *= mouseDistance; - float speedX4 = mouseXDist; - float speedY5 = mouseYDist + (float)Main.rand.Next(-180, 181) * 0.02f; - int greenWaterDamage = player.CalcIntDamage(Item.damage); - Projectile.NewProjectile(source, realPlayerPos.X, realPlayerPos.Y, speedX4, speedY5, ModContent.ProjectileType(), greenWaterDamage, playerKnockback, i, 0f, (float)Main.rand.Next(10)); } } public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo) { - var source = player.GetSource_ItemUse(Item); - int i = Main.myPlayer; - float projSpeed = Item.shootSpeed; - float playerKnockback = Item.knockBack; - playerKnockback = player.GetWeaponKnockback(Item, playerKnockback); - 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) - { - mouseYDist = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - realPlayerPos.Y; - } - float mouseDistance = (float)Math.Sqrt((double)(mouseXDist * mouseXDist + mouseYDist * mouseYDist)); - if ((float.IsNaN(mouseXDist) && float.IsNaN(mouseYDist)) || (mouseXDist == 0f && mouseYDist == 0f)) - { - mouseXDist = (float)player.direction; - mouseYDist = 0f; - mouseDistance = projSpeed; - } - else - { - mouseDistance = projSpeed / mouseDistance; - } + Vector2 destination = target.Center; - for (int j = 0; j < 4; j++) + Vector2 position = destination - (Vector2.UnitY * (destination.Y - Main.screenPosition.Y + 80f)); + Vector2 cachedPosition = position; + Vector2 secondPosition = cachedPosition + (Vector2.UnitY * (Main.screenHeight + 160f)); + Vector2 secondCachedPosition = secondPosition; + + Vector2 velocity = (destination - position).SafeNormalize(Vector2.UnitY) * ShootSpeed; + Vector2 cachedVelocity = velocity; + Vector2 secondVelocity = (destination - secondPosition).SafeNormalize(Vector2.UnitY) * ShootSpeed; + Vector2 secondCachedVelocity = secondVelocity; + + int teethDamage = player.CalcIntDamage((int)(Item.damage * 0.5)); + float teethKnockback = Item.knockBack * 0.2f; + bool evenNumberOfProjectiles = TotalTeeth % 2 == 0; + float amountToAdd = evenNumberOfProjectiles ? 0.5f : 0f; + int centralProjectile = TotalTeeth / 2; + int otherCentralProjectile = centralProjectile - 1; + float teethXVelocityReduction = 0.9f; + float minVelocityAdjustment = 0.8f; + float maxVelocityAdjustment = 1f; + float velocityAdjustment = minVelocityAdjustment; + for (int i = 0; i < TotalRows; i++) { - realPlayerPos = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); - realPlayerPos.X = (realPlayerPos.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); - realPlayerPos.Y -= (float)(100 * j); - mouseXDist = (float)Main.mouseX + Main.screenPosition.X - realPlayerPos.X; - mouseYDist = (float)Main.mouseY + Main.screenPosition.Y - realPlayerPos.Y; - if (mouseYDist < 0f) + bool topTeeth = i == 0; + for (int j = 0; j < TotalTeeth; j++) { - mouseYDist *= -1f; + velocityAdjustment = ((j == centralProjectile || j == otherCentralProjectile) && evenNumberOfProjectiles) ? minVelocityAdjustment : MathHelper.Lerp(minVelocityAdjustment, maxVelocityAdjustment, Math.Abs((j + amountToAdd) - centralProjectile) / (float)centralProjectile); + if (topTeeth) + { + position.X += MathHelper.Lerp(-HalvedTeethSpread, HalvedTeethSpread, j / (float)(TotalTeeth - 1)); + velocity = CalamityUtils.CalculatePredictiveAimToTargetMaxUpdates(position, target, ShootSpeed, 1) * velocityAdjustment; + velocity.X *= teethXVelocityReduction; + Projectile.NewProjectile(player.GetSource_ItemUse(Item), position, velocity, ModContent.ProjectileType(), teethDamage, teethKnockback, player.whoAmI, 0f, i, target.Center.Y); + position = cachedPosition; + velocity = cachedVelocity; + } + else + { + secondPosition.X += MathHelper.Lerp(-HalvedTeethSpread, HalvedTeethSpread, j / (float)(TotalTeeth - 1)); + secondVelocity = CalamityUtils.CalculatePredictiveAimToTargetMaxUpdates(secondPosition, target, ShootSpeed, 1) * velocityAdjustment; + secondVelocity.X *= teethXVelocityReduction; + Projectile.NewProjectile(player.GetSource_ItemUse(Item), secondPosition, secondVelocity, ModContent.ProjectileType(), teethDamage, teethKnockback, player.whoAmI, 0f, i, target.Center.Y); + secondPosition = secondCachedPosition; + secondVelocity = secondCachedVelocity; + } } - if (mouseYDist < 20f) - { - mouseYDist = 20f; - } - mouseDistance = (float)Math.Sqrt((double)(mouseXDist * mouseXDist + mouseYDist * mouseYDist)); - mouseDistance = projSpeed / mouseDistance; - mouseXDist *= mouseDistance; - mouseYDist *= mouseDistance; - float speedX4 = mouseXDist; - float speedY5 = mouseYDist + (float)Main.rand.Next(-180, 181) * 0.02f; - int greenWaterDamage = player.CalcIntDamage(Item.damage); - Projectile.NewProjectile(source, realPlayerPos.X, realPlayerPos.Y, speedX4, speedY5, ModContent.ProjectileType(), greenWaterDamage, playerKnockback, i, 0f, (float)Main.rand.Next(10)); } } public override void MeleeEffects(Player player, Rectangle hitbox) { - int randomDust = Main.rand.Next(2); - if (randomDust == 0) - { - randomDust = 33; - } - else - { - randomDust = 89; - } if (Main.rand.NextBool(4)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, randomDust); - } + Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, Main.rand.NextBool() ? 33 : 89); } } } diff --git a/Items/Weapons/Melee/HellfireFlamberge.cs b/Items/Weapons/Melee/HellfireFlamberge.cs index 50cb2269f9..bfe5859fd8 100644 --- a/Items/Weapons/Melee/HellfireFlamberge.cs +++ b/Items/Weapons/Melee/HellfireFlamberge.cs @@ -1,11 +1,11 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Items.Weapons.Melee { @@ -15,6 +15,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { Item.width = 58; + Item.height = 60; Item.damage = 90; Item.DamageType = DamageClass.Melee; Item.useAnimation = 20; @@ -24,8 +25,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 7.75f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 60; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 20f; diff --git a/Items/Weapons/Melee/HellionFlowerSpear.cs b/Items/Weapons/Melee/HellionFlowerSpear.cs index e41b4183bd..0ea8d94c6d 100644 --- a/Items/Weapons/Melee/HellionFlowerSpear.cs +++ b/Items/Weapons/Melee/HellionFlowerSpear.cs @@ -11,12 +11,13 @@ namespace CalamityMod.Items.Weapons.Melee public new string LocalizationCategory => "Items.Weapons.Melee"; public override void SetStaticDefaults() { - ItemID.Sets.Spears[Item.type] = true; + ItemID.Sets.Spears[Item.type] = true; } public override void SetDefaults() { Item.width = 64; + Item.height = 64; Item.damage = 135; Item.DamageType = DamageClass.Melee; Item.noMelee = true; @@ -28,8 +29,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 7.5f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 64; - Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 8f; diff --git a/Items/Weapons/Melee/Hellkite.cs b/Items/Weapons/Melee/Hellkite.cs index 9b0f324446..b76f5b0ed6 100644 --- a/Items/Weapons/Melee/Hellkite.cs +++ b/Items/Weapons/Melee/Hellkite.cs @@ -1,11 +1,11 @@ -using CalamityMod.Items.Materials; +using System.Collections.Generic; +using CalamityMod.Items.Materials; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; -using System.Collections.Generic; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Items.Weapons.Melee { @@ -18,7 +18,6 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 84; Item.height = 84; - Item.scale = 1f; Item.damage = 180; Item.DamageType = DamageClass.Melee; Item.useTime = Item.useAnimation = 30; @@ -27,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 8f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; } @@ -35,7 +34,7 @@ namespace CalamityMod.Items.Weapons.Melee { if (!Main.zenithWorld) if (Main.rand.NextBool(4)) - Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 174); + Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, DustID.InfernoFork); } // NOTE: Modded item variants don't seem to be supported as of now, so this is probably temporary (also there is no way around modifiers screwing rarity/value in some way) @@ -64,14 +63,14 @@ namespace CalamityMod.Items.Weapons.Melee int increment; for (int i = 0; i < 40; i = increment + 1) { - int swingDust = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 174, 0f, 0f, 200, default, firstDustScale); + int swingDust = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, DustID.InfernoFork, 0f, 0f, 200, default, firstDustScale); Dust dust = Main.dust[swingDust]; dust.position = target.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)target.width / 2f; dust.noGravity = true; dust.velocity.Y -= 6f; dust.velocity *= 3f; dust.velocity += dustVelocity * Main.rand.NextFloat(); - swingDust = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 174, 0f, 0f, 100, default, secondDustScale); + swingDust = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, DustID.InfernoFork, 0f, 0f, 100, default, secondDustScale); dust.position = target.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)target.width / 2f; dust.velocity.Y -= 6f; dust.velocity *= 2f; @@ -83,7 +82,7 @@ namespace CalamityMod.Items.Weapons.Melee } for (int j = 0; j < 20; j = increment + 1) { - int swingDust2 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 174, 0f, 0f, 0, default, thirdDustScale); + int swingDust2 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, DustID.InfernoFork, 0f, 0f, 0, default, thirdDustScale); Dust dust = Main.dust[swingDust2]; dust.position = target.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)target.velocity.ToRotation(), default) * (float)target.width / 3f; dust.noGravity = true; diff --git a/Items/Weapons/Melee/HolyCollider.cs b/Items/Weapons/Melee/HolyCollider.cs index ab6116f01d..cdedd6b888 100644 --- a/Items/Weapons/Melee/HolyCollider.cs +++ b/Items/Weapons/Melee/HolyCollider.cs @@ -1,6 +1,7 @@ -using CalamityMod.Projectiles.Melee; -using CalamityMod.Rarities; +using Microsoft.Xna.Framework; using System; +using CalamityMod.Projectiles.Melee; +using CalamityMod.Rarities; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -15,7 +16,6 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 94; Item.height = 80; - Item.scale = 1.5f; Item.damage = 270; Item.DamageType = DamageClass.Melee; Item.useAnimation = 22; @@ -27,10 +27,15 @@ namespace CalamityMod.Items.Weapons.Melee Item.autoReuse = true; Item.shootSpeed = 10f; - Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); } + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + player.itemLocation += new Vector2(5f * player.direction, 13f * player.gravDir).RotatedBy(player.itemRotation); + } + public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) { var source = player.GetSource_ItemUse(Item); diff --git a/Items/Weapons/Melee/HolyCollider.png b/Items/Weapons/Melee/HolyCollider.png index 5c4c4d5698..713bd1e425 100644 Binary files a/Items/Weapons/Melee/HolyCollider.png and b/Items/Weapons/Melee/HolyCollider.png differ diff --git a/Items/Weapons/Melee/IllustriousKnives.cs b/Items/Weapons/Melee/IllustriousKnives.cs index 6fe1669c29..2b39aa7796 100644 --- a/Items/Weapons/Melee/IllustriousKnives.cs +++ b/Items/Weapons/Melee/IllustriousKnives.cs @@ -1,9 +1,9 @@ -using CalamityMod.Items.Materials; +using System; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -18,6 +18,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { Item.width = 44; + Item.height = 62; Item.damage = 400; Item.DamageType = DamageClass.MeleeNoSpeed; Item.noMelee = true; @@ -28,9 +29,8 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 3f; Item.UseSound = SoundID.Item39; Item.autoReuse = true; - Item.height = 62; - Item.value = CalamityGlobalItem.Rarity16BuyPrice; + Item.value = CalamityGlobalItem.RarityHotPinkBuyPrice; Item.rare = ModContent.RarityType(); Item.Calamity().devItem = true; diff --git a/Items/Weapons/Melee/InsidiousImpaler.cs b/Items/Weapons/Melee/InsidiousImpaler.cs index 656123e85e..89be9745df 100644 --- a/Items/Weapons/Melee/InsidiousImpaler.cs +++ b/Items/Weapons/Melee/InsidiousImpaler.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Melee.Spears; +using CalamityMod.Projectiles.Melee; +using CalamityMod.Projectiles.Melee.Spears; using CalamityMod.Rarities; using Terraria; using Terraria.ID; @@ -9,32 +10,26 @@ namespace CalamityMod.Items.Weapons.Melee public class InsidiousImpaler : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; - public override void SetStaticDefaults() - { - ItemID.Sets.Spears[Item.type] = true; - } public override void SetDefaults() { Item.width = 66; - Item.damage = 320; - Item.DamageType = DamageClass.Melee; + Item.height = 70; + Item.damage = 198; + Item.DamageType = DamageClass.MeleeNoSpeed; Item.noMelee = true; Item.useTurn = true; Item.noUseGraphic = true; - Item.useAnimation = Item.useTime = 15; - Item.useStyle = ItemUseStyleID.Shoot; + Item.useAnimation = Item.useTime = 20; + Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 8f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 70; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 5f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 15f; - Item.value = CalamityGlobalItem.Rarity13BuyPrice; + Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; Item.rare = ModContent.RarityType(); } - - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; } } diff --git a/Items/Weapons/Melee/IridescentExcalibur.cs b/Items/Weapons/Melee/IridescentExcalibur.cs index 21c7469d36..457c2521e4 100644 --- a/Items/Weapons/Melee/IridescentExcalibur.cs +++ b/Items/Weapons/Melee/IridescentExcalibur.cs @@ -1,9 +1,12 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -15,9 +18,14 @@ namespace CalamityMod.Items.Weapons.Melee public class IridescentExcalibur : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; - private static int BaseDamage = 2000; + + private int MaxBeamTypes = 12; + private int BeamType = 0; - private const int alpha = 50; + + private const int Alpha = 100; + + private const float ShootSpeed = 16f; public override void SetStaticDefaults() { @@ -26,21 +34,31 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - Item.damage = BaseDamage; - Item.useAnimation = 14; + Item.width = 112; + Item.height = 112; + Item.damage = 3000; + Item.useAnimation = Item.useTime = 15; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 14; Item.useTurn = true; Item.DamageType = DamageClass.Melee; Item.knockBack = 8f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.width = 112; - Item.height = 112; - Item.value = CalamityGlobalItem.Rarity16BuyPrice; + Item.value = CalamityGlobalItem.RarityHotPinkBuyPrice; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 6f; - Item.rare = ModContent.RarityType(); + Item.shootSpeed = ShootSpeed; + Item.rare = ModContent.RarityType(); + Item.shootsEveryUse = true; + } + + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + player.itemLocation += new Vector2(-12f * player.direction, 2f * player.gravDir).RotatedBy(player.itemRotation); + } + + 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/IridescentExcaliburGlow").Value); } // Terraria seems to really dislike high crit values in SetDefaults @@ -48,31 +66,34 @@ namespace CalamityMod.Items.Weapons.Melee 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, type, damage, knockback, player.whoAmI, (float)BeamType, 0f); + if (player.altFunctionUse == 2) + { + float adjustedItemScale = player.GetAdjustedItemScale(Item); + Projectile.NewProjectile(source, player.MountedCenter, new Vector2(player.direction, 0f), ModContent.ProjectileType(), damage, knockback, player.whoAmI, (float)player.direction * player.gravDir, player.itemAnimationMax, adjustedItemScale); + Projectile.NewProjectile(source, player.MountedCenter, new Vector2(player.direction, 0f), ModContent.ProjectileType(), 0, knockback, player.whoAmI, (float)player.direction * player.gravDir, player.itemAnimationMax, adjustedItemScale); + Projectile.NewProjectile(source, player.MountedCenter, new Vector2(player.direction, 0f), ModContent.ProjectileType(), 0, knockback, player.whoAmI, (float)player.direction * player.gravDir, player.itemAnimationMax, adjustedItemScale); + NetMessage.SendData(MessageID.PlayerControls, -1, -1, null, player.whoAmI); + } + else + { + int proj = Projectile.NewProjectile(source, position, velocity, type, (int)Math.Round(damage * 0.5), knockback * 0.5f, player.whoAmI, (float)BeamType); + if (BeamType == 7) + Main.projectile[proj].penetrate = 3; - BeamType++; - if (BeamType > 11) - BeamType = 0; + BeamType++; + if (BeamType >= MaxBeamTypes) + BeamType = 0; + } return false; } public override bool AltFunctionUse(Player player) => true; - public override bool CanUseItem(Player player) + public override bool? UseItem(Player player) { - if (player.altFunctionUse == 2) - { - Item.shoot = ProjectileID.None; - Item.shootSpeed = 0f; - } - else - { - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 12f; - } - - return base.CanUseItem(player); + Item.noMelee = player.altFunctionUse == 2; + return base.UseItem(player); } public override void ModifyHitNPC(Player player, NPC target, ref NPC.HitModifiers modifiers) @@ -89,86 +110,82 @@ namespace CalamityMod.Items.Weapons.Melee public override void MeleeEffects(Player player, Rectangle hitbox) { - if (Main.rand.NextBool(4)) + if (Main.rand.NextBool()) { - Color color = new Color(255, 0, 0, alpha); - switch (BeamType) + Color rainbowColor = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, Alpha); + Color color = Color.White; + int dustChoice = player.altFunctionUse == 2 ? Main.rand.Next(12) : BeamType; + switch (dustChoice) { case 0: // Red + color = new Color(255, 0, 0, Alpha); break; case 1: // Orange - color = new Color(255, 128, 0, alpha); + color = new Color(255, 128, 0, Alpha); break; case 2: // Yellow - color = new Color(255, 255, 0, alpha); + color = new Color(255, 255, 0, Alpha); break; case 3: // Lime - color = new Color(128, 255, 0, alpha); + color = new Color(128, 255, 0, Alpha); break; case 4: // Green - color = new Color(0, 255, 0, alpha); + color = new Color(0, 255, 0, Alpha); break; case 5: // Turquoise - color = new Color(0, 255, 128, alpha); + color = new Color(0, 255, 128, Alpha); break; case 6: // Cyan - color = new Color(0, 255, 255, alpha); + color = new Color(0, 255, 255, Alpha); break; case 7: // Light Blue - color = new Color(0, 128, 255, alpha); + color = new Color(0, 128, 255, Alpha); break; case 8: // Blue - color = new Color(0, 0, 255, alpha); + color = new Color(0, 0, 255, Alpha); break; case 9: // Purple - color = new Color(128, 0, 255, alpha); + color = new Color(128, 0, 255, Alpha); break; case 10: // Fuschia - color = new Color(255, 0, 255, alpha); + color = new Color(255, 0, 255, Alpha); break; case 11: // Hot Pink - color = new Color(255, 0, 128, alpha); + color = new Color(255, 0, 128, Alpha); break; default: break; } - Dust swingDust = Main.dust[Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 267, 0f, 0f, alpha, color, 1.2f)]; - swingDust.noGravity = true; + Dust rainbow = Main.dust[Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, DustID.RainbowMk2)]; + rainbow.velocity *= 0f; + rainbow.color = Color.Lerp(rainbowColor, color, (float)Math.Sqrt((MathF.Cos(Main.GlobalTimeWrappedHourly / 60f) + 1f) * 0.5f)); + rainbow.color.A = 100; + rainbow.scale = Main.rand.NextFloat(1.2f, 1.6f); + rainbow.fadeIn = Main.rand.NextFloat(0.4f, 1f); + rainbow.noGravity = true; } } public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(ModContent.BuffType(), 600); - - if (!target.canGhostHeal || player.moonLeech) - return; - - int healAmount = Main.rand.Next(3) + 10; - player.statLife += healAmount; - player.HealEffect(healAmount); + target.AddBuff(ModContent.BuffType(), 60); } public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo) { target.AddBuff(ModContent.BuffType(), 600); - - if (player.moonLeech) - return; - - int healAmount = Main.rand.Next(3) + 10; - player.statLife += healAmount; - player.HealEffect(healAmount); + target.AddBuff(ModContent.BuffType(), 60); } public override void AddRecipes() { CreateRecipe(). - AddIngredient(). AddIngredient(ItemID.TrueExcalibur). - AddIngredient(5). - AddIngredient(5). + AddIngredient(). + AddIngredient(3). + AddIngredient(15). AddTile(). Register(); } diff --git a/Items/Weapons/Melee/IridescentExcaliburGlow.png b/Items/Weapons/Melee/IridescentExcaliburGlow.png new file mode 100644 index 0000000000..e122aef76b Binary files /dev/null and b/Items/Weapons/Melee/IridescentExcaliburGlow.png differ diff --git a/Items/Weapons/Melee/Lacerator.cs b/Items/Weapons/Melee/Lacerator.cs index e169bd19ae..f6674661e4 100644 --- a/Items/Weapons/Melee/Lacerator.cs +++ b/Items/Weapons/Melee/Lacerator.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 16f; - Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); } diff --git a/Items/Weapons/Melee/LifefruitScythe.cs b/Items/Weapons/Melee/LifehuntScythe.cs similarity index 66% rename from Items/Weapons/Melee/LifefruitScythe.cs rename to Items/Weapons/Melee/LifehuntScythe.cs index 054d564b3c..2141d6263b 100644 --- a/Items/Weapons/Melee/LifefruitScythe.cs +++ b/Items/Weapons/Melee/LifehuntScythe.cs @@ -8,12 +8,14 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Melee { - public class LifefruitScythe : ModItem, ILocalizedModType + [LegacyName("LifefruitScythe")] + public class LifehuntScythe : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; public override void SetDefaults() { Item.width = 62; + Item.height = 72; Item.damage = 156; Item.DamageType = DamageClass.Melee; Item.useAnimation = 18; @@ -23,8 +25,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 7.5f; Item.UseSound = SoundID.Item71; Item.autoReuse = true; - Item.height = 72; - Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; @@ -33,25 +34,33 @@ namespace CalamityMod.Items.Weapons.Melee public override void MeleeEffects(Player player, Rectangle hitbox) { if (Main.rand.NextBool(4)) - Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 75); + Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, DustID.CursedTorch); } public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) { - if (!target.canGhostHeal || player.moonLeech) + if (player.moonLeech || player.lifeSteal <= 0f || target.lifeMax <= 5) return; - player.statLife += 5; - player.HealEffect(5); + int heal = 5; + player.lifeSteal -= heal; + player.statLife += heal; + player.HealEffect(heal); + if (player.statLife > player.statLifeMax2) + player.statLife = player.statLifeMax2; } public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo) { - if (player.moonLeech) + if (player.moonLeech || player.lifeSteal <= 0f) return; - player.statLife += 5; - player.HealEffect(5); + int heal = 5; + player.lifeSteal -= heal; + player.statLife += heal; + player.HealEffect(heal); + if (player.statLife > player.statLifeMax2) + player.statLife = player.statLifeMax2; } public override void AddRecipes() diff --git a/Items/Weapons/Melee/LifefruitScythe.png b/Items/Weapons/Melee/LifehuntScythe.png similarity index 100% rename from Items/Weapons/Melee/LifefruitScythe.png rename to Items/Weapons/Melee/LifehuntScythe.png diff --git a/Items/Weapons/Melee/LionHeart.cs b/Items/Weapons/Melee/LionHeart.cs index 28af951194..5b06e0992b 100644 --- a/Items/Weapons/Melee/LionHeart.cs +++ b/Items/Weapons/Melee/LionHeart.cs @@ -18,9 +18,8 @@ namespace CalamityMod.Items.Weapons.Melee Item.width = 60; Item.height = 62; - Item.damage = 323; + Item.damage = 960; Item.knockBack = 5.5f; - Item.scale = 1.5f; Item.useStyle = ItemUseStyleID.Swing; Item.useAnimation = 15; Item.useTime = 15; @@ -31,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.autoReuse = true; Item.UseSound = SoundID.Item1; - Item.value = CalamityGlobalItem.Rarity13BuyPrice; + Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; } @@ -62,11 +61,6 @@ namespace CalamityMod.Items.Weapons.Melee public override bool CanHitPvp(Player player, Player target) => player.altFunctionUse != 2; - public override void ModifyHitNPC(Player player, NPC target, ref NPC.HitModifiers modifiers) - { - modifiers.CritDamage *= 0.5f; - } - public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) { var source = player.GetSource_ItemUse(Item); @@ -88,7 +82,7 @@ namespace CalamityMod.Items.Weapons.Melee 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, 132); + Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, DustID.Firework_Blue); } } } diff --git a/Items/Weapons/Melee/Lucrecia.cs b/Items/Weapons/Melee/Lucrecia.cs index ed96a7ec94..3d4df9ee9c 100644 --- a/Items/Weapons/Melee/Lucrecia.cs +++ b/Items/Weapons/Melee/Lucrecia.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.shootSpeed = 4.2f; Item.knockBack = 8.25f; Item.UseSound = SoundID.Item1; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; } diff --git a/Items/Weapons/Melee/MajesticGuard.cs b/Items/Weapons/Melee/MajesticGuard.cs index e34384d53d..47319cb373 100644 --- a/Items/Weapons/Melee/MajesticGuard.cs +++ b/Items/Weapons/Melee/MajesticGuard.cs @@ -1,4 +1,6 @@ -using Terraria; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -7,11 +9,11 @@ namespace CalamityMod.Items.Weapons.Melee public class MajesticGuard : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + public override void SetDefaults() { Item.width = 100; Item.height = 100; - Item.scale = 1.5f; Item.damage = 70; Item.DamageType = DamageClass.Melee; Item.useAnimation = 22; @@ -21,23 +23,31 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 7.5f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; } + 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/MajesticGuardGlow").Value); + } + public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) { if (target.Calamity().miscDefenseLoss < target.defense) target.Calamity().miscDefenseLoss += 1; - // Healing effect does not trigger versus dummies - if (player.moonLeech) - return; - - if (target.Calamity().miscDefenseLoss >= target.defense && target.canGhostHeal) + if (target.Calamity().miscDefenseLoss >= target.defense) { - player.statLife += 3; - player.HealEffect(3); + if (player.moonLeech || player.lifeSteal <= 0f || target.lifeMax <= 5) + return; + + int heal = 3; + player.lifeSteal -= heal; + player.statLife += heal; + player.HealEffect(heal); + if (player.statLife > player.statLifeMax2) + player.statLife = player.statLifeMax2; } } diff --git a/Items/Weapons/Melee/MajesticGuardGlow.png b/Items/Weapons/Melee/MajesticGuardGlow.png new file mode 100644 index 0000000000..61542093d6 Binary files /dev/null and b/Items/Weapons/Melee/MajesticGuardGlow.png differ diff --git a/Items/Weapons/Melee/MantisClaws.cs b/Items/Weapons/Melee/MantisClaws.cs index 34bae42929..4c8cc3be64 100644 --- a/Items/Weapons/Melee/MantisClaws.cs +++ b/Items/Weapons/Melee/MantisClaws.cs @@ -12,6 +12,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { Item.width = 26; + Item.height = 20; Item.damage = 144; Item.DamageType = DamageClass.Melee; Item.useAnimation = 8; @@ -21,8 +22,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 7f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 20; - Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; } @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Melee { if (Main.rand.NextBool(4)) { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 33); + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, DustID.Water); } } diff --git a/Items/Weapons/Melee/MirrorBlade.cs b/Items/Weapons/Melee/MirrorBlade.cs index 9993792d1a..68f155fd79 100644 --- a/Items/Weapons/Melee/MirrorBlade.cs +++ b/Items/Weapons/Melee/MirrorBlade.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 7f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); Item.shootSpeed = 9f; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Melee/MonstrousKnives.cs b/Items/Weapons/Melee/MonstrousKnives.cs index 1d36541e02..2b512bb0b4 100644 --- a/Items/Weapons/Melee/MonstrousKnives.cs +++ b/Items/Weapons/Melee/MonstrousKnives.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Melee; +using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -13,6 +13,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { Item.width = 18; + Item.height = 20; Item.damage = 9; Item.DamageType = DamageClass.MeleeNoSpeed; Item.noMelee = true; @@ -23,9 +24,8 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 3f; Item.UseSound = SoundID.Item39; Item.autoReuse = true; - Item.height = 20; - Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; Item.Calamity().donorItem = true; @@ -43,6 +43,7 @@ namespace CalamityMod.Items.Weapons.Melee { yDist = Main.screenPosition.Y + Main.screenHeight - Main.mouseY - playerPos.Y; } + Vector2 vector = new Vector2(xDist, yDist); float speedMult = vector.Length(); if ((float.IsNaN(xDist) && float.IsNaN(yDist)) || (xDist == 0f && yDist == 0f)) @@ -55,25 +56,11 @@ namespace CalamityMod.Items.Weapons.Melee { speedMult = speed / speedMult; } + xDist *= speedMult; yDist *= speedMult; - int knifeAmt = 3; - if (Main.rand.NextBool()) - { - knifeAmt++; - } - if (Main.rand.NextBool(4)) - { - knifeAmt++; - } - if (Main.rand.NextBool(8)) - { - knifeAmt++; - } - if (Main.rand.NextBool(16)) - { - knifeAmt++; - } + + int knifeAmt = Main.rand.Next(4, 7); for (int i = 0; i < knifeAmt; i++) { float xVec = xDist; @@ -87,8 +74,9 @@ namespace CalamityMod.Items.Weapons.Melee xVec *= speedMult; yVec *= speedMult; directionToShoot = new Vector2(xVec, yVec); - Projectile.NewProjectile(source, playerPos, directionToShoot, type, damage, knockback, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, playerPos, directionToShoot, type, damage, knockback, player.whoAmI); } + return false; } diff --git a/Items/Weapons/Melee/Mourningstar.cs b/Items/Weapons/Melee/Mourningstar.cs index e47b7c031f..a039ce5e46 100644 --- a/Items/Weapons/Melee/Mourningstar.cs +++ b/Items/Weapons/Melee/Mourningstar.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.useStyle = ItemUseStyleID.Shoot; Item.knockBack = 2.5f; Item.UseSound = SoundID.Item116; - Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); Item.shootSpeed = 24f; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Melee/Murasama.cs b/Items/Weapons/Melee/Murasama.cs index e8c4078173..178e3f5df1 100644 --- a/Items/Weapons/Melee/Murasama.cs +++ b/Items/Weapons/Melee/Murasama.cs @@ -29,8 +29,8 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - Item.height = 134; Item.width = 90; + Item.height = 134; Item.damage = 2222; Item.DamageType = TrueMeleeNoSpeedDamageClass.Instance; Item.noMelee = true; @@ -41,11 +41,10 @@ namespace CalamityMod.Items.Weapons.Melee Item.useTime = 5; Item.knockBack = 6.5f; Item.autoReuse = false; - Item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 24f; - Item.rare = ModContent.RarityType(); - Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(5, 14)); + Item.rare = ModContent.RarityType(); } // Terraria seems to really dislike high crit values in SetDefaults diff --git a/Items/Weapons/Melee/MycelialClaws.cs b/Items/Weapons/Melee/MycelialClaws.cs index cd57cf0be1..d8ed6d9a09 100644 --- a/Items/Weapons/Melee/MycelialClaws.cs +++ b/Items/Weapons/Melee/MycelialClaws.cs @@ -12,6 +12,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { Item.width = 22; + Item.height = 24; Item.damage = 28; Item.DamageType = DamageClass.Melee; Item.useAnimation = 7; @@ -21,8 +22,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 3.75f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 24; - Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; } @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Weapons.Melee { if (Main.rand.NextBool(4)) { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 56); + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, DustID.BlueFairy); } } } diff --git a/Items/Weapons/Melee/Nadir.cs b/Items/Weapons/Melee/Nadir.cs index cdd08c10b9..62ed4826eb 100644 --- a/Items/Weapons/Melee/Nadir.cs +++ b/Items/Weapons/Melee/Nadir.cs @@ -11,7 +11,6 @@ namespace CalamityMod.Items.Weapons.Melee public class Nadir : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; - public static int BaseDamage = 365; public static float ProjShootSpeed = 20f; public static int FadeoutSpeed = 20; @@ -26,7 +25,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.height = 144; Item.noUseGraphic = true; Item.DamageType = DamageClass.Melee; - Item.damage = BaseDamage; + Item.damage = 365; Item.knockBack = 8f; Item.useAnimation = 18; Item.useTime = 18; @@ -36,7 +35,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.useStyle = ItemUseStyleID.Shoot; Item.UseSound = SoundID.Item1; - Item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; diff --git a/Items/Weapons/Melee/Nebulash.cs b/Items/Weapons/Melee/Nebulash.cs index f677385279..8e36c516f2 100644 --- a/Items/Weapons/Melee/Nebulash.cs +++ b/Items/Weapons/Melee/Nebulash.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Melee; +using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.useStyle = ItemUseStyleID.Shoot; Item.knockBack = 2f; Item.UseSound = SoundID.Item117; - Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.shootSpeed = 24f; Item.shoot = ModContent.ProjectileType(); } diff --git a/Items/Weapons/Melee/NeptunesBounty.cs b/Items/Weapons/Melee/NeptunesBounty.cs index 32691fc059..91c8905696 100644 --- a/Items/Weapons/Melee/NeptunesBounty.cs +++ b/Items/Weapons/Melee/NeptunesBounty.cs @@ -5,6 +5,7 @@ using CalamityMod.Projectiles.Melee; using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -13,44 +14,28 @@ namespace CalamityMod.Items.Weapons.Melee public class NeptunesBounty : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + public static readonly SoundStyle SpinSound = new("CalamityMod/Sounds/Item/SpinningWoosh") { Volume = 0.65f }; public override void SetDefaults() { Item.width = 122; Item.height = 122; - Item.damage = 270; - Item.DamageType = DamageClass.Melee; - Item.useAnimation = 22; - Item.useTime = 22; - Item.useTurn = true; - Item.useStyle = ItemUseStyleID.Swing; + Item.damage = 444; Item.knockBack = 9f; - Item.UseSound = SoundID.Item1; - Item.autoReuse = true; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 12f; + Item.useTime = 65; + Item.useAnimation = 65; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 3f; - Item.value = CalamityGlobalItem.Rarity13BuyPrice; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.DamageType = DamageClass.Melee; + Item.useStyle = ItemUseStyleID.Shoot; + Item.UseSound = null; + Item.autoReuse = true; + + Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; Item.rare = ModContent.RarityType(); } - - 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, 33); - } - } - - public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 300); - } - - public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo) - { - target.AddBuff(ModContent.BuffType(), 300); - } - public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Weapons/Melee/Oblivion.cs b/Items/Weapons/Melee/Oblivion.cs index e8dbd883b8..14b23912fb 100644 --- a/Items/Weapons/Melee/Oblivion.cs +++ b/Items/Weapons/Melee/Oblivion.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Weapons.Melee public new string LocalizationCategory => "Items.Weapons.Melee"; public override void SetStaticDefaults() { - ItemID.Sets.Yoyo[Item.type] = true; + ItemID.Sets.Yoyo[Item.type] = true; ItemID.Sets.GamepadExtraRange[Item.type] = 15; ItemID.Sets.GamepadSmartQuickReach[Item.type] = true; } diff --git a/Items/Weapons/Melee/OldLordClaymore.cs b/Items/Weapons/Melee/OldLordClaymore.cs index 1c51e01ea3..21913884b1 100644 --- a/Items/Weapons/Melee/OldLordClaymore.cs +++ b/Items/Weapons/Melee/OldLordClaymore.cs @@ -12,9 +12,9 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - Item.damage = 60; Item.width = 70; Item.height = 70; + Item.damage = 60; Item.DamageType = DamageClass.Melee; Item.useAnimation = 34; Item.useTime = 34; @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.autoReuse = true; Item.noUseGraphic = true; Item.channel = true; - Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; } diff --git a/Items/Weapons/Melee/OmegaBiomeBlade.cs b/Items/Weapons/Melee/OmegaBiomeBlade.cs index ca20e321f1..213198cac8 100644 --- a/Items/Weapons/Melee/OmegaBiomeBlade.cs +++ b/Items/Weapons/Melee/OmegaBiomeBlade.cs @@ -1,15 +1,15 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; using CalamityMod.DataStructures; +using CalamityMod.Items.Materials; using CalamityMod.Particles; using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -68,7 +68,7 @@ namespace CalamityMod.Items.Weapons.Melee public static int ShockwaveAttunement_PassiveBaseDamage = 200; - public static int FlailBladeAttunement_BaseDamage = 320; + public static int FlailBladeAttunement_BaseDamage = 400; public static int FlailBladeAttunement_LocalIFrames = 30; public static int FlailBladeAttunement_FlailTime = 10; public static int FlailBladeAttunement_Reach = 400; @@ -169,7 +169,7 @@ namespace CalamityMod.Items.Weapons.Melee } } - #endregion + #endregion public override void SetDefaults() { @@ -183,7 +183,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 8; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.value = CalamityGlobalItem.Rarity9BuyPrice; + Item.value = CalamityGlobalItem.RarityCyanBuyPrice; Item.rare = ItemRarityID.Cyan; Item.shoot = ProjectileID.PurificationPowder; Item.shootSpeed = 15f; @@ -326,15 +326,24 @@ namespace CalamityMod.Items.Weapons.Melee public override bool CanUseItem(Player player) { - return !Main.projectile.Any(n => n.active && n.owner == player.whoAmI && + bool isRightClicking = player.altFunctionUse != ItemAlternativeFunctionID.None; + return !isRightClicking && !Main.projectile.Any(n => n.active && n.owner == player.whoAmI && (n.type == ProjectileType() || n.type == ProjectileType() || n.type == ProjectileType() || n.type == ProjectileType())); } - //No need for any wacky zany hijinx in the shoot method for once??? damn - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) => mainAttunement == null ? false : true; + // 03FEB2024: Ozzatron: added so the Iban Blades don't break Overhaul compatibility. Weapons are functionally unchanged. + public override bool AltFunctionUse(Player player) => true; + + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + { + if (mainAttunement == null || player.altFunctionUse != ItemAlternativeFunctionID.None) + return false; + + return true; + } internal static ChargingEnergyParticleSet BiomeEnergyParticles = new ChargingEnergyParticleSet(-1, 2, Color.White, Color.White, 0.04f, 20f); internal static void UpdateAllParticleSets() diff --git a/Items/Weapons/Melee/Omniblade.cs b/Items/Weapons/Melee/Omniblade.cs index 93a92433f9..1fc173a4e3 100644 --- a/Items/Weapons/Melee/Omniblade.cs +++ b/Items/Weapons/Melee/Omniblade.cs @@ -12,6 +12,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { Item.width = 64; + Item.height = 146; Item.damage = 100; Item.DamageType = TrueMeleeNoSpeedDamageClass.Instance; Item.useAnimation = 12; @@ -21,8 +22,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 6f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 146; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.noMelee = true; Item.noUseGraphic = true; Item.channel = true; diff --git a/Items/Weapons/Melee/Orderbringer.cs b/Items/Weapons/Melee/Orderbringer.cs index 8b1fd1401f..01acc2a755 100644 --- a/Items/Weapons/Melee/Orderbringer.cs +++ b/Items/Weapons/Melee/Orderbringer.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 7f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.rare = ModContent.RarityType(); Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 6f; diff --git a/Items/Weapons/Melee/OrderbringerGlow.png b/Items/Weapons/Melee/OrderbringerGlow.png new file mode 100644 index 0000000000..8c6448103a Binary files /dev/null and b/Items/Weapons/Melee/OrderbringerGlow.png differ diff --git a/Items/Weapons/Melee/PerfectDark.cs b/Items/Weapons/Melee/PerfectDark.cs index 84b1486e2a..25216877bd 100644 --- a/Items/Weapons/Melee/PerfectDark.cs +++ b/Items/Weapons/Melee/PerfectDark.cs @@ -13,20 +13,20 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { Item.width = 50; - Item.damage = 24; + Item.height = 50; + Item.damage = 26; Item.DamageType = DamageClass.Melee; - Item.useAnimation = 25; + Item.useAnimation = 24; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 25; + Item.useTime = 24; Item.useTurn = true; Item.knockBack = 4.25f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 50; - Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 10f; + Item.shootSpeed = 12f; } public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) { diff --git a/Items/Weapons/Melee/PhotonRipper.cs b/Items/Weapons/Melee/PhotonRipper.cs index 19a5b3b9bc..5986c13bc3 100644 --- a/Items/Weapons/Melee/PhotonRipper.cs +++ b/Items/Weapons/Melee/PhotonRipper.cs @@ -11,8 +11,15 @@ namespace CalamityMod.Items.Weapons.Melee public class PhotonRipper : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + public override void SetStaticDefaults() + { + ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; + } + public override void SetDefaults() { + Item.width = 134; + Item.height = 54; Item.damage = 3725; Item.knockBack = 12f; Item.useTime = 5; @@ -23,8 +30,6 @@ namespace CalamityMod.Items.Weapons.Melee Item.axe = 3000 / 5; // Photon Ripper's axe power is entirely for show. Its projectiles instantly one shot trees. - Item.height = 134; - Item.width = 54; Item.DamageType = DamageClass.Melee; Item.noMelee = true; Item.noUseGraphic = true; @@ -41,10 +46,22 @@ namespace CalamityMod.Items.Weapons.Melee public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 18; public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; + public override bool AltFunctionUse(Player player) => true; + public override void HoldItem(Player player) + { + if (Main.myPlayer == player.whoAmI) + player.Calamity().rightClickListener = 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, 0f, 0f); + float breakBlocks = 1; + // If right clicking, the chainsaw won't be able to chop down trees + if (player.Calamity().mouseRight && player.whoAmI == Main.myPlayer && !Main.mapFullscreen && !Main.blockMouse) + { + breakBlocks = 0; + } + Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, 0f, breakBlocks); return false; } } diff --git a/Items/Weapons/Melee/PlagueKeeper.cs b/Items/Weapons/Melee/PlagueKeeper.cs index 624ac1b941..9ec6a35407 100644 --- a/Items/Weapons/Melee/PlagueKeeper.cs +++ b/Items/Weapons/Melee/PlagueKeeper.cs @@ -13,7 +13,8 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { Item.width = 74; - Item.damage = 80; + Item.height = 90; + Item.damage = 68; Item.DamageType = DamageClass.Melee; Item.useAnimation = 20; Item.useStyle = ItemUseStyleID.Swing; @@ -22,17 +23,12 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 6f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 90; - Item.value = CalamityGlobalItem.Rarity10BuyPrice; - Item.rare = ItemRarityID.Red; + Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; + Item.rare = ItemRarityID.Purple; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 9f; } - public override void ModifyHitNPC(Player player, NPC target, ref NPC.HitModifiers modifiers) - { - modifiers.CritDamage *= 0.5f; - } public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) { var source = player.GetSource_ItemUse(Item); diff --git a/Items/Weapons/Melee/PrismaticBreaker.cs b/Items/Weapons/Melee/PrismaticBreaker.cs index 9092b1fff9..f86e75a993 100644 --- a/Items/Weapons/Melee/PrismaticBreaker.cs +++ b/Items/Weapons/Melee/PrismaticBreaker.cs @@ -35,13 +35,15 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { - Item.staff[Item.type] = true; + Item.staff[Item.type] = true; ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; } public override void SetDefaults() { + Item.width = 50; + Item.height = 50; Item.damage = 699; Item.useStyle = ItemUseStyleID.Swing; Item.useTime = Item.useAnimation = 13; @@ -53,11 +55,9 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 7f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.width = 50; - Item.height = 50; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 14f; - Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; } @@ -118,7 +118,7 @@ namespace CalamityMod.Items.Weapons.Melee { if (Main.rand.NextBool(4)) { - Dust rainbow = Main.dust[Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 267, 0f, 0f, 50, Main.rand.Next(colors), 0.8f)]; + Dust rainbow = Main.dust[Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, DustID.RainbowMk2, 0f, 0f, 50, Main.rand.Next(colors), 0.8f)]; rainbow.noGravity = true; } } diff --git a/Items/Weapons/Melee/Pwnagehammer.cs b/Items/Weapons/Melee/Pwnagehammer.cs index a0ea1bcc15..41e5b2a727 100644 --- a/Items/Weapons/Melee/Pwnagehammer.cs +++ b/Items/Weapons/Melee/Pwnagehammer.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Melee; +using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -14,6 +14,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { Item.width = 66; + Item.height = 66; Item.damage = 210; Item.noMelee = true; Item.noUseGraphic = true; @@ -23,7 +24,6 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 10f; Item.UseSound = SoundID.Item1; Item.DamageType = DamageClass.MeleeNoSpeed; - Item.height = 66; Item.value = CalamityGlobalItem.RarityLightPurpleBuyPrice; Item.rare = ItemRarityID.LightPurple; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Melee/RedSun.cs b/Items/Weapons/Melee/RedSun.cs index 49e558c3ee..851a7968a0 100644 --- a/Items/Weapons/Melee/RedSun.cs +++ b/Items/Weapons/Melee/RedSun.cs @@ -1,10 +1,10 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -19,11 +19,11 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 62; Item.height = 62; - Item.damage = 500; + Item.damage = 350; Item.DamageType = DamageClass.Melee; - Item.useTime = 5; - Item.useAnimation = 30; - Item.reuseDelay = 20; + Item.useTime = 10; + Item.useAnimation = 40; + Item.reuseDelay = 0; Item.useLimitPerAnimation = 6; Item.useTurn = true; Item.useStyle = ItemUseStyleID.Swing; @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 15f; - Item.value = CalamityGlobalItem.Rarity16BuyPrice; + Item.value = CalamityGlobalItem.RarityHotPinkBuyPrice; Item.rare = ModContent.RarityType(); Item.Calamity().devItem = true; } @@ -89,7 +89,7 @@ namespace CalamityMod.Items.Weapons.Melee 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, 64); + Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, DustID.YellowTorch); } public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) diff --git a/Items/Weapons/Melee/RedtideSpear.cs b/Items/Weapons/Melee/RedtideSpear.cs index 1a6f11f3c9..39a9fce2af 100644 --- a/Items/Weapons/Melee/RedtideSpear.cs +++ b/Items/Weapons/Melee/RedtideSpear.cs @@ -12,12 +12,13 @@ namespace CalamityMod.Items.Weapons.Melee public new string LocalizationCategory => "Items.Weapons.Melee"; public override void SetStaticDefaults() { - ItemID.Sets.Spears[Item.type] = true; + ItemID.Sets.Spears[Item.type] = true; } public override void SetDefaults() { Item.width = 56; + Item.height = 56; Item.damage = 25; Item.DamageType = DamageClass.Melee; Item.noMelee = true; @@ -30,8 +31,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 5f; Item.UseSound = null; Item.autoReuse = true; - Item.height = 56; - Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 4f; diff --git a/Items/Weapons/Melee/RemsRevenge.cs b/Items/Weapons/Melee/RemsRevenge.cs index 39934dfabd..be3714e311 100644 --- a/Items/Weapons/Melee/RemsRevenge.cs +++ b/Items/Weapons/Melee/RemsRevenge.cs @@ -10,18 +10,18 @@ namespace CalamityMod.Items.Weapons.Melee public new string LocalizationCategory => "Items.Weapons.Melee"; public override void SetDefaults() { - Item.damage = 375; - Item.DamageType = DamageClass.MeleeNoSpeed; Item.width = 44; Item.height = 34; + Item.damage = 375; + Item.DamageType = DamageClass.MeleeNoSpeed; Item.useTime = 15; Item.useAnimation = 15; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.noUseGraphic = true; Item.knockBack = 10f; - Item.value = CalamityGlobalItem.Rarity10BuyPrice; - Item.rare = ItemRarityID.Red; + Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; + Item.rare = ItemRarityID.Purple; Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.channel = true; diff --git a/Items/Weapons/Melee/Riptide.cs b/Items/Weapons/Melee/Riptide.cs index 08bcbd82d5..3676f8d2e5 100644 --- a/Items/Weapons/Melee/Riptide.cs +++ b/Items/Weapons/Melee/Riptide.cs @@ -1,5 +1,5 @@ -using CalamityMod.Items.Placeables; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables; using CalamityMod.Projectiles.Melee.Yoyos; using Terraria; using Terraria.ID; @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Weapons.Melee public new string LocalizationCategory => "Items.Weapons.Melee"; public override void SetStaticDefaults() { - ItemID.Sets.Yoyo[Item.type] = true; + ItemID.Sets.Yoyo[Item.type] = true; ItemID.Sets.GamepadExtraRange[Item.type] = 15; ItemID.Sets.GamepadSmartQuickReach[Item.type] = true; } @@ -39,7 +39,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.shootSpeed = 18f; Item.rare = ItemRarityID.Green; - Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; } public override void AddRecipes() diff --git a/Items/Weapons/Melee/Roxcalibur.cs b/Items/Weapons/Melee/Roxcalibur.cs index 5c0637ddcb..debc3d50b2 100644 --- a/Items/Weapons/Melee/Roxcalibur.cs +++ b/Items/Weapons/Melee/Roxcalibur.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; @@ -10,27 +10,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Melee { - public class Roxcalibur : ModItem, ILocalizedModType - { + public class Roxcalibur : ModItem, ILocalizedModType + { - public string LocalizationCategory => "Items.Weapons.Melee"; + public new string LocalizationCategory => "Items.Weapons.Melee"; - public static int BaseUseTime = 40; - public override void SetDefaults() - { - Item.damage = 180; - Item.knockBack = 13f; + public static int BaseUseTime = 40; + public override void SetDefaults() + { + Item.width = 100; + Item.height = 100; + Item.damage = 180; + Item.knockBack = 13f; Item.DamageType = DamageClass.Melee; - Item.useStyle = ItemUseStyleID.Shoot; - Item.UseSound = SoundID.NPCHit42; - Item.width = 100; - Item.height = 100; + Item.useStyle = ItemUseStyleID.Shoot; + Item.UseSound = SoundID.NPCHit42; Item.useAnimation = Item.useTime = BaseUseTime; - Item.reuseDelay = 10; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 4f; - Item.value = CalamityGlobalItem.Rarity4BuyPrice; - Item.rare = ItemRarityID.LightRed; + Item.reuseDelay = 10; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 4f; + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; + Item.rare = ItemRarityID.LightRed; Item.Calamity().donorItem = true; Item.noUseGraphic = true; @@ -39,32 +39,32 @@ namespace CalamityMod.Items.Weapons.Melee Item.channel = true; } - public override void ModifyWeaponCrit(Player player, ref float crit) - { - crit += 8f; - } - public override bool CanUseItem(Player player) => Main.hardMode && player.ownedProjectileCounts[Item.shoot] < 1; - 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, ai2: player.itemTimeMax); //needed to set ai2 - return false; - } - public override void ModifyTooltips(List list) - { - list.FindAndReplace("[WOF]", Main.hardMode ? string.Empty : this.GetLocalizedValue("LockedInfo") + "\n"); - } + public override void ModifyWeaponCrit(Player player, ref float crit) + { + crit += 8f; + } + public override bool CanUseItem(Player player) => Main.hardMode && player.ownedProjectileCounts[Item.shoot] < 1; + 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, ai2: player.itemTimeMax); //needed to set ai2 + return false; + } + public override void ModifyTooltips(List list) + { + list.FindAndReplace("[WOF]", Main.hardMode ? string.Empty : this.GetLocalizedValue("LockedInfo") + "\n"); + } - public override void AddRecipes() - { - CreateRecipe() - .AddIngredient(ItemID.HellstoneBar, 25) - .AddIngredient(ItemID.SoulofNight, 10) - .AddIngredient(5) - .AddIngredient(ItemID.Obsidian, 10) - .AddIngredient(ItemID.StoneBlock, 100) - .AddIngredient(ItemID.Amethyst, 2) - .AddTile(TileID.Anvils) - .Register(); - } - } + public override void AddRecipes() + { + CreateRecipe() + .AddIngredient(ItemID.HellstoneBar, 25) + .AddIngredient(ItemID.SoulofNight, 10) + .AddIngredient(5) + .AddIngredient(ItemID.Obsidian, 10) + .AddIngredient(ItemID.StoneBlock, 100) + .AddIngredient(ItemID.Amethyst, 2) + .AddTile(TileID.Anvils) + .Register(); + } + } } diff --git a/Items/Weapons/Melee/SaharaSlicers.cs b/Items/Weapons/Melee/SaharaSlicers.cs index b71443d55f..4ffc6f96f5 100644 --- a/Items/Weapons/Melee/SaharaSlicers.cs +++ b/Items/Weapons/Melee/SaharaSlicers.cs @@ -1,12 +1,12 @@ -using CalamityMod.Projectiles.Melee.Shortswords; +using CalamityMod.Projectiles.Melee; +using CalamityMod.Projectiles.Melee.Shortswords; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using Terraria.DataStructures; -using CalamityMod.Projectiles.Melee; namespace CalamityMod.Items.Weapons.Melee { @@ -36,7 +36,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 6f; Item.UseSound = null; Item.channel = true; - Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; } public override bool AltFunctionUse(Player player) => true; diff --git a/Items/Weapons/Melee/SausageMaker.cs b/Items/Weapons/Melee/SausageMaker.cs index b2d9868cae..fd0f87b89b 100644 --- a/Items/Weapons/Melee/SausageMaker.cs +++ b/Items/Weapons/Melee/SausageMaker.cs @@ -17,6 +17,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { Item.width = 44; + Item.height = 42; Item.damage = 36; Item.DamageType = TrueMeleeDamageClass.Instance; Item.noMelee = true; @@ -28,8 +29,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 6.25f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 42; - Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 6f; diff --git a/Items/Weapons/Melee/ScourgeoftheCosmos.cs b/Items/Weapons/Melee/ScourgeoftheCosmos.cs index 730817d8c1..3eaaa817b5 100644 --- a/Items/Weapons/Melee/ScourgeoftheCosmos.cs +++ b/Items/Weapons/Melee/ScourgeoftheCosmos.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 5f; Item.UseSound = SoundID.Item109; Item.autoReuse = true; - Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.rare = ModContent.RarityType(); Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 20f; diff --git a/Items/Weapons/Melee/SeashineSword.cs b/Items/Weapons/Melee/SeashineSword.cs index 3f10e0d9ab..465fa48b07 100644 --- a/Items/Weapons/Melee/SeashineSword.cs +++ b/Items/Weapons/Melee/SeashineSword.cs @@ -1,5 +1,5 @@ -using CalamityMod.Items.Placeables; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables; using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; using Terraria; @@ -11,24 +11,21 @@ namespace CalamityMod.Items.Weapons.Melee public class SeashineSword : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + public override void SetDefaults() { Item.CloneDefaults(ItemID.EnchantedSword); - Item.useTime = 30; - Item.damage = 26; - Item.DamageType = DamageClass.Melee; - Item.value = CalamityGlobalItem.Rarity2BuyPrice; Item.width = 40; Item.height = 40; - Item.knockBack = 2; - Item.shootSpeed = 11; + Item.useTime = 30; + Item.damage = 25; + Item.DamageType = DamageClass.Melee; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; + Item.knockBack = 4f; + Item.shootSpeed = 12f; Item.rare = ItemRarityID.Green; Item.UseSound = SoundID.Item1; - } - - public override void ModifyShootStats(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) - { - type = ModContent.ProjectileType(); + Item.shoot = ModContent.ProjectileType(); } public override void AddRecipes() diff --git a/Items/Weapons/Melee/SeekingScorcher.cs b/Items/Weapons/Melee/SeekingScorcher.cs index ae9b2f28c1..79f0a44291 100644 --- a/Items/Weapons/Melee/SeekingScorcher.cs +++ b/Items/Weapons/Melee/SeekingScorcher.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.DamageType = DamageClass.MeleeNoSpeed; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 14f; - Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); } diff --git a/Items/Weapons/Melee/SeekingScorcher.png b/Items/Weapons/Melee/SeekingScorcher.png index 7f965ae3fe..902c894c6a 100644 Binary files a/Items/Weapons/Melee/SeekingScorcher.png and b/Items/Weapons/Melee/SeekingScorcher.png differ diff --git a/Items/Weapons/Melee/Shimmerspark.cs b/Items/Weapons/Melee/Shimmerspark.cs index 2cc68c7c23..45f7958674 100644 --- a/Items/Weapons/Melee/Shimmerspark.cs +++ b/Items/Weapons/Melee/Shimmerspark.cs @@ -1,4 +1,4 @@ - using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee.Yoyos; using Terraria; using Terraria.ID; @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Weapons.Melee public new string LocalizationCategory => "Items.Weapons.Melee"; public override void SetStaticDefaults() { - ItemID.Sets.Yoyo[Item.type] = true; + ItemID.Sets.Yoyo[Item.type] = true; ItemID.Sets.GamepadExtraRange[Item.type] = 15; ItemID.Sets.GamepadSmartQuickReach[Item.type] = true; } diff --git a/Items/Weapons/Melee/SmokingComet.cs b/Items/Weapons/Melee/SmokingComet.cs index c6d9265e04..ff8fe8633e 100644 --- a/Items/Weapons/Melee/SmokingComet.cs +++ b/Items/Weapons/Melee/SmokingComet.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Items.Weapons.Melee public new string LocalizationCategory => "Items.Weapons.Melee"; public override void SetStaticDefaults() { - ItemID.Sets.Yoyo[Item.type] = true; + ItemID.Sets.Yoyo[Item.type] = true; ItemID.Sets.GamepadExtraRange[Item.type] = 15; ItemID.Sets.GamepadSmartQuickReach[Item.type] = true; } @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.width = 36; Item.height = 40; Item.DamageType = DamageClass.MeleeNoSpeed; - Item.damage = 14; + Item.damage = 21; Item.knockBack = 1.5f; Item.useTime = 25; Item.useAnimation = 25; @@ -36,7 +36,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.shootSpeed = 14f; Item.rare = ItemRarityID.Green; - Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.Calamity().donorItem = true; } @@ -47,6 +47,7 @@ namespace CalamityMod.Items.Weapons.Melee AddIngredient(ItemID.Amethyst, 5). AddIngredient(ItemID.PinkGel, 10). AddIngredient(ItemID.FallenStar, 15). + AddIngredient(ItemID.MeteoriteBar, 10). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Weapons/Melee/SolsticeClaymore.cs b/Items/Weapons/Melee/SolsticeClaymore.cs index 71a0fbeec0..33deea51ab 100644 --- a/Items/Weapons/Melee/SolsticeClaymore.cs +++ b/Items/Weapons/Melee/SolsticeClaymore.cs @@ -14,6 +14,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { Item.width = 86; + Item.height = 86; Item.damage = 300; Item.DamageType = DamageClass.Melee; Item.useAnimation = 16; @@ -23,9 +24,8 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 6.5f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 86; - Item.value = CalamityGlobalItem.Rarity10BuyPrice; - Item.rare = ItemRarityID.Red; + Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; + Item.rare = ItemRarityID.Purple; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 16f; } diff --git a/Items/Weapons/Melee/SoulEdge.cs b/Items/Weapons/Melee/SoulEdge.cs deleted file mode 100644 index e93c484d04..0000000000 --- a/Items/Weapons/Melee/SoulEdge.cs +++ /dev/null @@ -1,63 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Projectiles.Melee; -using CalamityMod.Rarities; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Melee -{ - public class SoulEdge : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Weapons.Melee"; - public static readonly SoundStyle ProjectileDeathSound = SoundID.NPCDeath39 with { Volume = 0.5f}; - - public override void SetDefaults() - { - Item.width = 88; - Item.height = 88; - Item.damage = 210; - Item.DamageType = DamageClass.Melee; - Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 23; - Item.useAnimation = 23; - Item.useTurn = true; - Item.knockBack = 5.5f; - Item.UseSound = SoundID.Item1; - Item.autoReuse = true; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 12f; - - Item.value = CalamityGlobalItem.Rarity13BuyPrice; - Item.rare = ModContent.RarityType(); - } - - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) - { - int numShots = 2; - for (int i = 0; i < numShots; ++i) - { - float SpeedX = velocity.X + (float)Main.rand.Next(-40, 41) * 0.05f; - float SpeedY = velocity.Y + (float)Main.rand.Next(-40, 41) * 0.05f; - float ai1 = Main.rand.NextFloat() + 0.5f; - // TODO -- unchecked type addition math assumes we can guarantee load order - // this is extremely unsafe and if TML optimizes autoloading or asset loading it could fail - Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, Main.rand.Next(type, type + 3), damage, knockback, player.whoAmI, 0.0f, ai1); - } - return false; - } - - public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 300); - } - - public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo) - { - target.AddBuff(ModContent.BuffType(), 300); - } - } -} diff --git a/Items/Weapons/Melee/SoulHarvester.cs b/Items/Weapons/Melee/SoulHarvester.cs index 92b7c7d045..6ad35bb47f 100644 --- a/Items/Weapons/Melee/SoulHarvester.cs +++ b/Items/Weapons/Melee/SoulHarvester.cs @@ -3,9 +3,9 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Items.Weapons.Melee { @@ -15,6 +15,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { Item.width = 62; + Item.height = 64; Item.damage = 85; Item.DamageType = DamageClass.Melee; Item.useAnimation = Item.useTime = 22; @@ -23,8 +24,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 7.5f; Item.UseSound = SoundID.Item71; Item.autoReuse = true; - Item.height = 64; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 18f; @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Weapons.Melee { if (Main.rand.NextBool(3)) { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 75); + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, DustID.CursedTorch); } } @@ -49,7 +49,7 @@ namespace CalamityMod.Items.Weapons.Melee player.ApplyDamageToNPC(target, onHitDamage, 0f, 0, false); for (int i = 0; i < 10; i++) { - int plagueDust = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 89, 0f, 0f, 100, default, 2f); + int plagueDust = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, DustID.GemEmerald, 0f, 0f, 100, default, 2f); Main.dust[plagueDust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -59,10 +59,10 @@ namespace CalamityMod.Items.Weapons.Melee } for (int j = 0; j < 20; j++) { - int plagueDust2 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 89, 0f, 0f, 100, default, 3f); + int plagueDust2 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, DustID.GemEmerald, 0f, 0f, 100, default, 3f); Main.dust[plagueDust2].noGravity = true; Main.dust[plagueDust2].velocity *= 5f; - plagueDust2 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 89, 0f, 0f, 100, default, 2f); + plagueDust2 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, DustID.GemEmerald, 0f, 0f, 100, default, 2f); Main.dust[plagueDust2].velocity *= 2f; } } @@ -77,7 +77,7 @@ namespace CalamityMod.Items.Weapons.Melee SoundEngine.PlaySound(SoundID.Item14, target.Center); for (int i = 0; i < 10; i++) { - int plagueDust = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 89, 0f, 0f, 100, default, 2f); + int plagueDust = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, DustID.GemEmerald, 0f, 0f, 100, default, 2f); Main.dust[plagueDust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -87,10 +87,10 @@ namespace CalamityMod.Items.Weapons.Melee } for (int j = 0; j < 20; j++) { - int plagueDust2 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 89, 0f, 0f, 100, default, 3f); + int plagueDust2 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, DustID.GemEmerald, 0f, 0f, 100, default, 3f); Main.dust[plagueDust2].noGravity = true; Main.dust[plagueDust2].velocity *= 5f; - plagueDust2 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 89, 0f, 0f, 100, default, 2f); + plagueDust2 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, DustID.GemEmerald, 0f, 0f, 100, default, 2f); Main.dust[plagueDust2].velocity *= 2f; } } diff --git a/Items/Weapons/Melee/StarnightLance.cs b/Items/Weapons/Melee/StarnightLance.cs index c3965fc4af..8e6afe25b2 100644 --- a/Items/Weapons/Melee/StarnightLance.cs +++ b/Items/Weapons/Melee/StarnightLance.cs @@ -17,6 +17,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { Item.width = 72; + Item.height = 72; Item.damage = 110; Item.DamageType = DamageClass.Melee; Item.noMelee = true; @@ -28,8 +29,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 6; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 72; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 6f; diff --git a/Items/Weapons/Melee/StellarContempt.cs b/Items/Weapons/Melee/StellarContempt.cs index f7f7608992..03487196f7 100644 --- a/Items/Weapons/Melee/StellarContempt.cs +++ b/Items/Weapons/Melee/StellarContempt.cs @@ -1,7 +1,7 @@ -using CalamityMod.Projectiles.Melee; +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Melee; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Items.Materials; namespace CalamityMod.Items.Weapons.Melee { @@ -9,7 +9,6 @@ namespace CalamityMod.Items.Weapons.Melee public class StellarContempt : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; - public static int BaseDamage = 650; public static float Speed = 25f; public override void SetDefaults() @@ -17,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.width = 74; Item.height = 74; Item.DamageType = DamageClass.MeleeNoSpeed; - Item.damage = BaseDamage; + Item.damage = 650; Item.knockBack = 28f; Item.useTime = 45; Item.useAnimation = 45; @@ -28,8 +27,8 @@ namespace CalamityMod.Items.Weapons.Melee Item.useStyle = ItemUseStyleID.Swing; Item.UseSound = SoundID.Item1; - Item.value = CalamityGlobalItem.Rarity10BuyPrice; - Item.rare = ItemRarityID.Red; + Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; + Item.rare = ItemRarityID.Purple; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = Speed; diff --git a/Items/Weapons/Melee/StellarStriker.cs b/Items/Weapons/Melee/StellarStriker.cs index ca58d894e6..6e2e7945b2 100644 --- a/Items/Weapons/Melee/StellarStriker.cs +++ b/Items/Weapons/Melee/StellarStriker.cs @@ -1,21 +1,21 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Items.Weapons.Melee { public class StellarStriker : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + public override void SetDefaults() { Item.width = 90; Item.height = 100; - Item.scale = 1.5f; - Item.damage = 480; + Item.damage = 450; Item.DamageType = DamageClass.Melee; Item.useAnimation = 25; Item.useStyle = ItemUseStyleID.Swing; @@ -24,73 +24,65 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 7.75f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.value = CalamityGlobalItem.Rarity10BuyPrice; - Item.rare = ItemRarityID.Red; + Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; + Item.rare = ItemRarityID.Purple; Item.shootSpeed = 12f; } + // Stellar Striker is classed as a regular melee weapon, so despite being a true melee on-hit, these scale with regular melee. + private int GetOnHitDamage(Player player) => (int)player.GetTotalDamage().ApplyTo(0.5f * Item.damage); + public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) { if (player.whoAmI == Main.myPlayer) - SpawnFlares(player, Item.knockBack, Item.damage, hit.Crit); + SpawnFlaresNPC(player, Item.knockBack, GetOnHitDamage(player), target); } public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo) { if (player.whoAmI == Main.myPlayer) - SpawnFlares(player, Item.knockBack, Item.damage, true); + SpawnFlaresPvp(player, Item.knockBack, GetOnHitDamage(player), target); } - private void SpawnFlares(Player player, float knockback, int damage, bool crit) + private void SpawnFlaresNPC(Player player, float knockback, int damage, NPC target) { var source = player.GetSource_ItemUse(Item); SoundEngine.PlaySound(SoundID.Item88, player.Center); int i = Main.myPlayer; float cometSpeed = Item.shootSpeed; 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) - { - mouseYDist = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - realPlayerPos.Y; - } - float mouseDistance = (float)Math.Sqrt((double)(mouseXDist * mouseXDist + mouseYDist * mouseYDist)); - if ((float.IsNaN(mouseXDist) && float.IsNaN(mouseYDist)) || (mouseXDist == 0f && mouseYDist == 0f)) - { - mouseXDist = (float)player.direction; - mouseYDist = 0f; - mouseDistance = cometSpeed; - } - else - { - mouseDistance = cometSpeed / mouseDistance; - } - - if (crit) - damage /= 2; for (int j = 0; j < 2; j++) { realPlayerPos = new Vector2(player.Center.X + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); realPlayerPos.X = (realPlayerPos.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); realPlayerPos.Y -= (float)(100 * j); - mouseXDist = (float)Main.mouseX + Main.screenPosition.X - realPlayerPos.X + (float)Main.rand.Next(-40, 41) * 0.03f; - mouseYDist = (float)Main.mouseY + Main.screenPosition.Y - realPlayerPos.Y; - if (mouseYDist < 0f) - { - mouseYDist *= -1f; - } - if (mouseYDist < 20f) - { - mouseYDist = 20f; - } - mouseDistance = (float)Math.Sqrt((double)(mouseXDist * mouseXDist + mouseYDist * mouseYDist)); - mouseDistance = cometSpeed / mouseDistance; - mouseXDist *= mouseDistance; - mouseYDist *= mouseDistance; - float speedX = mouseXDist; - float speedY = mouseYDist + (float)Main.rand.Next(-80, 81) * 0.02f; - int proj = Projectile.NewProjectile(source, realPlayerPos.X, realPlayerPos.Y, speedX, speedY, ProjectileID.LunarFlare, (int)(damage * 0.5), knockback, i, 0f, (float)Main.rand.Next(3)); + + Vector2 flareVelocity = CalamityUtils.CalculatePredictiveAimToTargetMaxUpdates(realPlayerPos, target, cometSpeed, 6); + + int proj = Projectile.NewProjectile(source, realPlayerPos, flareVelocity, ProjectileID.LunarFlare, damage, knockback, i, 0f, (float)Main.rand.Next(3)); + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].DamageType = DamageClass.Melee; + } + } + + private void SpawnFlaresPvp(Player player, float knockback, int damage, Player target) + { + var source = player.GetSource_ItemUse(Item); + SoundEngine.PlaySound(SoundID.Item88, player.Center); + int i = Main.myPlayer; + float cometSpeed = Item.shootSpeed; + Vector2 realPlayerPos = player.RotatedRelativePoint(player.MountedCenter, true); + + for (int j = 0; j < 2; j++) + { + realPlayerPos = new Vector2(player.Center.X + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); + realPlayerPos.X = (realPlayerPos.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); + realPlayerPos.Y -= (float)(100 * j); + + Vector2 flareVelocity = Vector2.Normalize(target.Center - realPlayerPos) * cometSpeed; + + int proj = Projectile.NewProjectile(source, realPlayerPos, flareVelocity, ProjectileID.LunarFlare, damage, knockback, i, 0f, (float)Main.rand.Next(3)); if (proj.WithinBounds(Main.maxProjectiles)) Main.projectile[proj].DamageType = DamageClass.Melee; } @@ -100,7 +92,7 @@ namespace CalamityMod.Items.Weapons.Melee { if (Main.rand.NextBool(3)) { - Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 229); + Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, DustID.Vortex); } } diff --git a/Items/Weapons/Melee/StormRuler.cs b/Items/Weapons/Melee/StormRuler.cs index 7014194781..cf8ce8d329 100644 --- a/Items/Weapons/Melee/StormRuler.cs +++ b/Items/Weapons/Melee/StormRuler.cs @@ -13,6 +13,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { Item.width = 80; + Item.height = 84; Item.damage = 80; Item.DamageType = DamageClass.Melee; Item.useAnimation = 25; @@ -22,8 +23,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 6.25f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 84; - Item.value = CalamityGlobalItem.Rarity10BuyPrice; + Item.value = CalamityGlobalItem.RarityRedBuyPrice; Item.rare = ItemRarityID.Red; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 20f; @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Melee { if (Main.rand.NextBool(5)) { - int swingDust = Dust.NewDust(new Vector2((float)hitbox.X, (float)hitbox.Y), hitbox.Width, hitbox.Height, 187, (float)(player.direction * 2), 0f, 150, default, 1.3f); + int swingDust = Dust.NewDust(new Vector2((float)hitbox.X, (float)hitbox.Y), hitbox.Width, hitbox.Height, DustID.Flare_Blue, (float)(player.direction * 2), 0f, 150, default, 1.3f); Main.dust[swingDust].velocity *= 0.2f; } } diff --git a/Items/Weapons/Melee/StormSaber.cs b/Items/Weapons/Melee/StormSaber.cs index b95302eb72..f155315a5f 100644 --- a/Items/Weapons/Melee/StormSaber.cs +++ b/Items/Weapons/Melee/StormSaber.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Melee; +using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -13,6 +13,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { Item.width = 58; + Item.height = 64; Item.damage = 66; Item.DamageType = DamageClass.Melee; Item.useAnimation = 23; @@ -22,8 +23,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 6f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 64; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; @@ -47,7 +47,7 @@ namespace CalamityMod.Items.Weapons.Melee { if (Main.rand.NextBool(5)) { - int swingDust = Dust.NewDust(new Vector2((float)hitbox.X, (float)hitbox.Y), hitbox.Width, hitbox.Height, 187, (float)(player.direction * 2), 0f, 150, default, 1.3f); + int swingDust = Dust.NewDust(new Vector2((float)hitbox.X, (float)hitbox.Y), hitbox.Width, hitbox.Height, DustID.Flare_Blue, (float)(player.direction * 2), 0f, 150, default, 1.3f); Main.dust[swingDust].velocity *= 0.2f; } } diff --git a/Items/Weapons/Melee/StreamGouge.cs b/Items/Weapons/Melee/StreamGouge.cs index f884237aa0..7358ae671f 100644 --- a/Items/Weapons/Melee/StreamGouge.cs +++ b/Items/Weapons/Melee/StreamGouge.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 100; Item.height = 100; - Item.damage = 440; + Item.damage = 500; Item.DamageType = DamageClass.Melee; Item.noMelee = true; Item.useTurn = true; diff --git a/Items/Weapons/Melee/StygianShield.cs b/Items/Weapons/Melee/StygianShield.cs index c9a676e7ca..3b6b75e84f 100644 --- a/Items/Weapons/Melee/StygianShield.cs +++ b/Items/Weapons/Melee/StygianShield.cs @@ -1,10 +1,12 @@ using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; +using CalamityMod.Sounds; using Microsoft.Xna.Framework; using Terraria; -using Terraria.Localization; +using Terraria.Audio; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Melee @@ -13,7 +15,15 @@ namespace CalamityMod.Items.Weapons.Melee public class StygianShield : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; - + + public static readonly SoundStyle DashChargeSound = new("CalamityMod/Sounds/Item/StygianDashCharge"); + public static readonly SoundStyle DashSound = new("CalamityMod/Sounds/Item/StygianDash"); + public static readonly SoundStyle DashHitSound = new("CalamityMod/Sounds/Item/StygianBonk", 3); + public static readonly SoundStyle ShieldThrowSound = new("CalamityMod/Sounds/Item/StygianThrow"); + public static readonly SoundStyle ThrowLoopSound = new("CalamityMod/Sounds/Item/StygianThrowLoop"); + public static readonly SoundStyle ShieldThrowHitSound = CommonCalamitySounds.ExoHitSound; + public static readonly SoundStyle ShieldCatchSound = new("CalamityMod/Sounds/Item/StygianCatch"); + // Held stats public const int HeldDefense = 16; public const int DisableDashDuration = 90; @@ -22,6 +32,8 @@ namespace CalamityMod.Items.Weapons.Melee public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(HeldDefense, (DisableDashDuration / 60D).ToString("N1")); + public override void SetStaticDefaults() => ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; + public override void SetDefaults() { Item.width = 74; @@ -30,20 +42,20 @@ namespace CalamityMod.Items.Weapons.Melee Item.noMelee = true; Item.noUseGraphic = true; Item.channel = true; - Item.damage = 250; + Item.damage = 180; Item.DamageType = DamageClass.MeleeNoSpeed; Item.useAnimation = Item.useTime = 40; // This is only for the "Very slow" tooltip. The real use time should be faster Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; Item.knockBack = 6f; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; Item.Calamity().donorItem = true; // Donor: Cin2Win Item.UseSound = null; } - // Can only throw a shield if none is active - public override bool AltFunctionUse(Player player) => player.ownedProjectileCounts[ThrownShieldID] <= 0; + // Can only throw a shield if there's two or less + public override bool AltFunctionUse(Player player) => player.ownedProjectileCounts[ThrownShieldID] <= 1; public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; @@ -102,7 +114,7 @@ namespace CalamityMod.Items.Weapons.Melee if (Player.ActiveItem().type == ModContent.ItemType()) { Player.shield = EquipLoader.GetEquipSlot(Mod, "StygianShield", EquipType.Shield); - Player.cShield = 0; + Player.cShield = 0; } } } diff --git a/Items/Weapons/Melee/SubmarineShocker.cs b/Items/Weapons/Melee/SubmarineShocker.cs index 6372e5ea78..9f948cf7e9 100644 --- a/Items/Weapons/Melee/SubmarineShocker.cs +++ b/Items/Weapons/Melee/SubmarineShocker.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.shootSpeed = 2f; Item.knockBack = 7f; Item.UseSound = SoundID.Item1; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; } diff --git a/Items/Weapons/Melee/Swordsplosion.cs b/Items/Weapons/Melee/Swordsplosion.cs index b0f1d4aa32..ad10265c3a 100644 --- a/Items/Weapons/Melee/Swordsplosion.cs +++ b/Items/Weapons/Melee/Swordsplosion.cs @@ -1,8 +1,8 @@ -using Terraria.DataStructures; +using System; using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -15,6 +15,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { Item.width = 88; + Item.height = 90; Item.damage = 48; Item.DamageType = DamageClass.Melee; Item.useAnimation = 30; @@ -24,8 +25,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 7f; Item.UseSound = SoundID.Item60; Item.autoReuse = true; - Item.height = 90; - Item.value = CalamityGlobalItem.Rarity11BuyPrice; + Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; Item.rare = ItemRarityID.Purple; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 16f; @@ -90,7 +90,7 @@ namespace CalamityMod.Items.Weapons.Melee { if (Main.rand.NextBool(5)) { - int swingDust = Dust.NewDust(new Vector2((float)hitbox.X, (float)hitbox.Y), hitbox.Width, hitbox.Height, 66, (float)(player.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.3f); + int swingDust = Dust.NewDust(new Vector2((float)hitbox.X, (float)hitbox.Y), hitbox.Width, hitbox.Height, DustID.RainbowTorch, (float)(player.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.3f); Main.dust[swingDust].velocity *= 0.2f; Main.dust[swingDust].noGravity = true; } diff --git a/Items/Weapons/Melee/TaintedBlade.cs b/Items/Weapons/Melee/TaintedBlade.cs index 3f6f5e3b16..4bd49059d5 100644 --- a/Items/Weapons/Melee/TaintedBlade.cs +++ b/Items/Weapons/Melee/TaintedBlade.cs @@ -1,8 +1,8 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Items.Placeables; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Items.Placeables; namespace CalamityMod.Items.Weapons.Melee { @@ -15,7 +15,6 @@ namespace CalamityMod.Items.Weapons.Melee Item.width = 46; Item.height = 46; Item.damage = 60; - Item.scale = 1.4f; Item.DamageType = DamageClass.Melee; Item.useTurn = true; Item.useAnimation = 27; @@ -24,15 +23,17 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 5f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; } public override void MeleeEffects(Player player, Rectangle hitbox) { - if (Main.rand.NextBool(5)) + if (Main.rand.NextBool(3)) { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 74); + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, DustID.GreenFairy, 0f, 0f, 100, default, Main.rand.NextFloat(1.5f, 2f)); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0f; } } diff --git a/Items/Weapons/Melee/TeardropCleaver.cs b/Items/Weapons/Melee/TeardropCleaver.cs index 7e8f9f71d9..939db3f77d 100644 --- a/Items/Weapons/Melee/TeardropCleaver.cs +++ b/Items/Weapons/Melee/TeardropCleaver.cs @@ -11,7 +11,8 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { Item.width = 56; - Item.damage = 45; + Item.height = 66; + Item.damage = 38; Item.DamageType = DamageClass.Melee; Item.useAnimation = 24; Item.useStyle = ItemUseStyleID.Swing; @@ -20,9 +21,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 5.5f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 66; - Item.scale = 1.5f; - Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; } diff --git a/Items/Weapons/Melee/TenebreusTides.cs b/Items/Weapons/Melee/TenebreusTides.cs index f982321710..7bbd67982a 100644 --- a/Items/Weapons/Melee/TenebreusTides.cs +++ b/Items/Weapons/Melee/TenebreusTides.cs @@ -18,6 +18,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { + Item.width = Item.height = 68; Item.damage = 120; Item.knockBack = 4.5f; Item.DamageType = DamageClass.Melee; @@ -26,11 +27,10 @@ namespace CalamityMod.Items.Weapons.Melee Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; - Item.value = CalamityGlobalItem.Rarity9BuyPrice; - Item.rare = ItemRarityID.Cyan; + Item.value = CalamityGlobalItem.RarityRedBuyPrice; + Item.rare = ItemRarityID.Red; Item.Calamity().donorItem = true; - Item.width = Item.height = 68; Item.useStyle = ItemUseStyleID.Shoot; Item.UseSound = SoundID.Item1; Item.noMelee = true; diff --git a/Items/Weapons/Melee/TerraLance.png b/Items/Weapons/Melee/TerraLance.png deleted file mode 100644 index 2ec07315aa..0000000000 Binary files a/Items/Weapons/Melee/TerraLance.png and /dev/null differ diff --git a/Items/Weapons/Melee/Terratomere.cs b/Items/Weapons/Melee/Terratomere.cs index 73678c2313..a80bf5569d 100644 --- a/Items/Weapons/Melee/Terratomere.cs +++ b/Items/Weapons/Melee/Terratomere.cs @@ -12,9 +12,9 @@ namespace CalamityMod.Items.Weapons.Melee public class Terratomere : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; - public const int SwingTime = 83; + public const int SwingTime = 54; - public const int SlashLifetime = 27; + public const int SlashLifetime = 135; public const int SmallSlashCreationRate = 9; @@ -38,7 +38,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 60; Item.height = 66; - Item.damage = 370; + Item.damage = 145; Item.DamageType = DamageClass.Melee; Item.useAnimation = 21; Item.useTime = 21; @@ -48,14 +48,14 @@ namespace CalamityMod.Items.Weapons.Melee Item.autoReuse = true; Item.noUseGraphic = true; Item.noMelee = true; - Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 60f; } public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; - + public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Weapons/Melee/TerrorBlade.cs b/Items/Weapons/Melee/TerrorBlade.cs index 798ff61a39..e85ba3366f 100644 --- a/Items/Weapons/Melee/TerrorBlade.cs +++ b/Items/Weapons/Melee/TerrorBlade.cs @@ -16,6 +16,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { Item.width = 88; + Item.height = 80; Item.damage = 560; Item.DamageType = DamageClass.Melee; Item.useAnimation = 18; @@ -25,11 +26,10 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 8.5f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 80; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 20f; - Item.value = CalamityGlobalItem.Rarity13BuyPrice; + Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; Item.rare = ModContent.RarityType(); } @@ -41,7 +41,7 @@ namespace CalamityMod.Items.Weapons.Melee 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, 60); + Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, DustID.RedTorch); } } } diff --git a/Items/Weapons/Melee/TheBurningSky.cs b/Items/Weapons/Melee/TheBurningSky.cs index 8f059f59a4..abb9f7b438 100644 --- a/Items/Weapons/Melee/TheBurningSky.cs +++ b/Items/Weapons/Melee/TheBurningSky.cs @@ -3,10 +3,10 @@ using CalamityMod.Projectiles.Melee; using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Items.Weapons.Melee { @@ -41,7 +41,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 14f; - Item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.rare = ModContent.RarityType(); } diff --git a/Items/Weapons/Melee/TheDarkMaster.cs b/Items/Weapons/Melee/TheDarkMaster.cs new file mode 100644 index 0000000000..5054b7ed5a --- /dev/null +++ b/Items/Weapons/Melee/TheDarkMaster.cs @@ -0,0 +1,132 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Melee; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Melee +{ + public class TheDarkMaster : ModItem, ILocalizedModType + { + public const float DamagePerHealth = 0.001f; // 0.1 damage per additional health. 100 health = 10% damage. + public new string LocalizationCategory => "Items.Weapons.Melee"; + + [CloneByReference] + public BloomRing ring; + + public override void SetStaticDefaults() + { + Item.staff[Item.type] = true; + ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; + } + + public override void SetDefaults() + { + Item.width = 60; + Item.height = 60; + Item.damage = 50; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = Item.useTime = 26; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTurn = true; + Item.knockBack = 7f; + Item.autoReuse = true; + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; + Item.rare = ItemRarityID.LightRed; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 16f; + Item.Calamity().donorItem = true; + } + + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + { + if (player.altFunctionUse != 2) + { + // only fire beams at max health + if (player.statLife >= (player.statLifeMax2 * 0.75f)) + { + SoundEngine.PlaySound(SoundID.Item71, player.Center); + // increase the beam's damage by the player's additional health starting from the vanilla maximum amount with just life crystals + int baseMaxHealth = 400; + int bonusHealth = player.statLifeMax2 - baseMaxHealth; + float bonusDamage = DamagePerHealth * bonusHealth; + Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, (int)(damage * (1 + bonusDamage)), knockback, player.whoAmI, 0, 0); + } + // still play the sound if the clones are out since they always fire beams + else if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) + { + SoundEngine.PlaySound(SoundID.Item71, player.Center); + } + } + else + { + if (player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0) + { + // spawn a growing red ring + ring = new BloomRing(player.Center, Vector2.Zero, Color.Red, 0.4f, 10); + GeneralParticleHandler.SpawnParticle(ring); + // 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); + } + } + } + return false; + } + + public override bool AltFunctionUse(Player player) => true; + + public override bool CanUseItem(Player player) + { + // only allow right clicking if the player doesn't have clones out + if (player.altFunctionUse == 2) + { + if (player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0) + { + Item.UseSound = SoundID.Item104; + Item.useStyle = ItemUseStyleID.Shoot; + Item.useTurn = false; + Item.noMelee = true; + } + else + { + return false; + } + } + else + { + Item.UseSound = SoundID.Item1; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTurn = true; + Item.noMelee = false; + } + return base.CanUseItem(player); + } + + // make the ring grow if it exists + public override void UpdateInventory(Player player) + { + if (ring != null) + { + ring.Scale *= 1.3f; + } + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.BeamSword). + AddIngredient(ItemID.LightsBane). + AddIngredient(ItemID.SoulofNight, 20). + AddIngredient(3). + AddIngredient(ItemID.Ruby). // as long as you have enough... + AddTile(TileID.Anvils). + Register(); + } + } +} diff --git a/Items/Weapons/Melee/TheDarkMaster.png b/Items/Weapons/Melee/TheDarkMaster.png new file mode 100644 index 0000000000..fe2788ed50 Binary files /dev/null and b/Items/Weapons/Melee/TheDarkMaster.png differ diff --git a/Items/Weapons/Melee/TheEnforcer.cs b/Items/Weapons/Melee/TheEnforcer.cs index eefc61780a..b027454e91 100644 --- a/Items/Weapons/Melee/TheEnforcer.cs +++ b/Items/Weapons/Melee/TheEnforcer.cs @@ -1,10 +1,10 @@ -using CalamityMod.Items.Materials; +using System; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -19,7 +19,6 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 100; Item.height = 100; - Item.scale = 1.5f; Item.damage = 890; Item.DamageType = DamageClass.Melee; Item.useAnimation = 17; @@ -137,7 +136,7 @@ namespace CalamityMod.Items.Weapons.Melee 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, 173); + Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, DustID.ShadowbeamStaff); } public override void AddRecipes() diff --git a/Items/Weapons/Melee/TheGodsGambit.cs b/Items/Weapons/Melee/TheGodsGambit.cs index c447f7e2fe..24a10f6e7f 100644 --- a/Items/Weapons/Melee/TheGodsGambit.cs +++ b/Items/Weapons/Melee/TheGodsGambit.cs @@ -1,6 +1,6 @@ using CalamityMod.Items.Materials; -using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Projectiles.Melee.Yoyos; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Weapons.Melee public new string LocalizationCategory => "Items.Weapons.Melee"; public override void SetStaticDefaults() { - ItemID.Sets.Yoyo[Item.type] = true; + ItemID.Sets.Yoyo[Item.type] = true; ItemID.Sets.GamepadExtraRange[Item.type] = 15; ItemID.Sets.GamepadSmartQuickReach[Item.type] = true; } @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.width = 36; Item.height = 38; Item.DamageType = DamageClass.MeleeNoSpeed; - Item.damage = 29; + Item.damage = 26; Item.knockBack = 3.5f; Item.useTime = 21; Item.useAnimation = 21; diff --git a/Items/Weapons/Melee/TheLastMourning.cs b/Items/Weapons/Melee/TheLastMourning.cs index 87ae4c0694..19f4ae60b0 100644 --- a/Items/Weapons/Melee/TheLastMourning.cs +++ b/Items/Weapons/Melee/TheLastMourning.cs @@ -17,9 +17,8 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 94; Item.height = 94; - Item.scale = 1.5f; Item.DamageType = DamageClass.Melee; - Item.damage = 360; + Item.damage = 550; Item.knockBack = 8.5f; Item.useAnimation = 20; Item.useTime = 20; @@ -29,15 +28,11 @@ namespace CalamityMod.Items.Weapons.Melee Item.useStyle = ItemUseStyleID.Swing; Item.UseSound = SoundID.Item1; - Item.value = CalamityGlobalItem.Rarity13BuyPrice; + Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; } - public override void ModifyHitNPC(Player player, NPC target, ref NPC.HitModifiers modifiers) - { - modifiers.CritDamage *= 0.5f; - } public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) { bool isDoGSegment = target.type == ModContent.NPCType() || target.type == ModContent.NPCType(); diff --git a/Items/Weapons/Melee/TheMicrowave.cs b/Items/Weapons/Melee/TheMicrowave.cs index 25ce0b4312..c485fbbe46 100644 --- a/Items/Weapons/Melee/TheMicrowave.cs +++ b/Items/Weapons/Melee/TheMicrowave.cs @@ -1,8 +1,8 @@ using CalamityMod.Projectiles.Melee.Yoyos; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Items.Weapons.Melee { @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { - ItemID.Sets.Yoyo[Item.type] = true; + ItemID.Sets.Yoyo[Item.type] = true; ItemID.Sets.GamepadExtraRange[Item.type] = 15; ItemID.Sets.GamepadSmartQuickReach[Item.type] = true; } @@ -40,7 +40,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.shootSpeed = 14f; Item.rare = ItemRarityID.Cyan; - Item.value = CalamityGlobalItem.Rarity9BuyPrice; + Item.value = CalamityGlobalItem.RarityCyanBuyPrice; } } } diff --git a/Items/Weapons/Melee/TheMutilator.cs b/Items/Weapons/Melee/TheMutilator.cs index da73273a8d..c06b33dad3 100644 --- a/Items/Weapons/Melee/TheMutilator.cs +++ b/Items/Weapons/Melee/TheMutilator.cs @@ -16,7 +16,6 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 90; Item.height = 90; - Item.scale = 1.5f; Item.damage = 483; Item.DamageType = DamageClass.Melee; Item.useAnimation = 18; @@ -28,13 +27,13 @@ namespace CalamityMod.Items.Weapons.Melee Item.autoReuse = true; Item.shootSpeed = 10f; - Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); } public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) { - if (target.life <= (target.lifeMax * 0.2f) && target.canGhostHeal) + if (target.life <= (target.lifeMax * 0.2f)) { if (!CalamityPlayer.areThereAnyDamnBosses || Main.rand.NextBool()) { @@ -51,7 +50,7 @@ namespace CalamityMod.Items.Weapons.Melee target.position.Y -= target.height / 2; for (int i = 0; i < 30; i++) { - int bloodDust = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 5, 0f, 0f, 100, default, 2f); + int bloodDust = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, DustID.Blood, 0f, 0f, 100, default, 2f); Main.dust[bloodDust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -61,10 +60,10 @@ namespace CalamityMod.Items.Weapons.Melee } for (int j = 0; j < 50; j++) { - int bloodDust2 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 5, 0f, 0f, 100, default, 3f); + int bloodDust2 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, DustID.Blood, 0f, 0f, 100, default, 3f); Main.dust[bloodDust2].noGravity = true; Main.dust[bloodDust2].velocity *= 5f; - bloodDust2 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 5, 0f, 0f, 100, default, 2f); + bloodDust2 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, DustID.Blood, 0f, 0f, 100, default, 2f); Main.dust[bloodDust2].velocity *= 2f; } } diff --git a/Items/Weapons/Melee/TheObliterator.cs b/Items/Weapons/Melee/TheObliterator.cs index 356878287a..a02d38ce6a 100644 --- a/Items/Weapons/Melee/TheObliterator.cs +++ b/Items/Weapons/Melee/TheObliterator.cs @@ -1,5 +1,7 @@ -using CalamityMod.Projectiles.Melee.Yoyos; +using System.Collections.Generic; +using CalamityMod.Projectiles.Melee.Yoyos; using CalamityMod.Rarities; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -20,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.width = 42; Item.height = 40; Item.DamageType = DamageClass.MeleeNoSpeed; - Item.damage = 220; + Item.damage = 222; Item.knockBack = 7.5f; Item.useTime = 20; Item.useAnimation = 20; @@ -35,8 +37,9 @@ namespace CalamityMod.Items.Weapons.Melee Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 16f; - Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.rare = ModContent.RarityType(); } + public override void ModifyTooltips(List list) => list.FindAndReplace("[GFB]", this.GetLocalizedValue(Main.zenithWorld ? "TooltipGFB" : "TooltipNormal")); } } diff --git a/Items/Weapons/Melee/Oracle.cs b/Items/Weapons/Melee/TheOracle.cs similarity index 81% rename from Items/Weapons/Melee/Oracle.cs rename to Items/Weapons/Melee/TheOracle.cs index 5b7b60affa..6708ca7991 100644 --- a/Items/Weapons/Melee/Oracle.cs +++ b/Items/Weapons/Melee/TheOracle.cs @@ -10,15 +10,15 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Melee { - public class Oracle : ModItem, ILocalizedModType + [LegacyName("Oracle")] + public class TheOracle : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; - public const int YoyoBaseDamage = 170; - public const int AuraBaseDamage = 100; - public const int AuraMaxDamage = 220; + public const int AuraBaseDamage = 68; + public const int AuraMaxDamage = 150; public override void SetStaticDefaults() - { + { ItemID.Sets.Yoyo[Item.type] = true; ItemID.Sets.GamepadExtraRange[Item.type] = 15; ItemID.Sets.GamepadSmartQuickReach[Item.type] = true; @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.width = 58; Item.height = 50; Item.DamageType = DamageClass.MeleeNoSpeed; - Item.damage = YoyoBaseDamage; + Item.damage = 205; Item.knockBack = 4f; Item.useTime = 20; Item.useAnimation = 20; @@ -44,7 +44,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 16f; - Item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; } @@ -52,7 +52,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { CreateRecipe(). - AddIngredient(). + AddIngredient(). AddIngredient(). AddIngredient(5). AddTile(). diff --git a/Items/Weapons/Melee/Oracle.png b/Items/Weapons/Melee/TheOracle.png similarity index 100% rename from Items/Weapons/Melee/Oracle.png rename to Items/Weapons/Melee/TheOracle.png diff --git a/Items/Weapons/Melee/TitanArm.cs b/Items/Weapons/Melee/TitanArm.cs index ded9a8c852..03b4a71cb1 100644 --- a/Items/Weapons/Melee/TitanArm.cs +++ b/Items/Weapons/Melee/TitanArm.cs @@ -13,7 +13,6 @@ namespace CalamityMod.Items.Weapons.Melee Item.width = 46; Item.height = 58; Item.damage = 69; - Item.scale = 1.75f; Item.knockBack = 80f; //This number doesn't mean anything, but it's not 9001f because that caused bugs. Item.useAnimation = Item.useTime = 12; Item.DamageType = DamageClass.Melee; @@ -22,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.useStyle = ItemUseStyleID.Swing; Item.UseSound = SoundID.Item1; Item.rare = ItemRarityID.Lime; - Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; } // Boosting crit in SetDefaults along with knockback seemed to severely inflate the reforging price. Guaranteed crits for more knockback. diff --git a/Items/Weapons/Melee/TriactisTruePaladinianMageHammerofMightMelee.cs b/Items/Weapons/Melee/TriactisTruePaladinianMageHammerofMightMelee.cs index edfec09fb3..e6a4b2eb9f 100644 --- a/Items/Weapons/Melee/TriactisTruePaladinianMageHammerofMightMelee.cs +++ b/Items/Weapons/Melee/TriactisTruePaladinianMageHammerofMightMelee.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 25f; - Item.value = CalamityGlobalItem.Rarity16BuyPrice; + Item.value = CalamityGlobalItem.RarityHotPinkBuyPrice; Item.rare = ModContent.RarityType(); Item.Calamity().devItem = true; } diff --git a/Items/Weapons/Melee/TrueArkoftheAncients.cs b/Items/Weapons/Melee/TrueArkoftheAncients.cs index c1dab9e300..8ace1c199a 100644 --- a/Items/Weapons/Melee/TrueArkoftheAncients.cs +++ b/Items/Weapons/Melee/TrueArkoftheAncients.cs @@ -1,12 +1,12 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Melee; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; +using System; using System.Collections.Generic; using System.IO; using System.Linq; +using CalamityMod.Projectiles.Melee; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; @@ -19,9 +19,9 @@ namespace CalamityMod.Items.Weapons.Melee public new string LocalizationCategory => "Items.Weapons.Melee"; public float Combo = 1f; public float Charge = 0f; - public static float chargeDamageMultiplier = 1.45f; //Extra damage from charge - public static float beamDamageMultiplier = 0.8f; //Damage multiplier for the charged shots (remember it applies ontop of the charge damage multiplied - public static float glassStarDamageMultiplier = 0.4f; //Damage multiplier for the glass stars it shoots (Shoots 3x glass stars when not charged, shoots 2x glass stars + one beam when charged) + public static float chargeDamageMultiplier = 1.25f; //Extra damage from charge + public static float beamDamageMultiplier = 1f; //Damage multiplier for the charged shots (remember it applies ontop of the charge damage multiplied + public static float glassStarDamageMultiplier = 0.6f; //Damage multiplier for the glass stars it shoots (Shoots 3x glass stars when not charged, shoots 2x glass stars + one beam when charged) public static float blastDamageMultiplier = 0.5f; //Damage multiplier applied ontop of the charge damage multiplier mutliplied by the amount of charges consumed. So if you consume 5 charges, the blast will get multiplied by 5 times the damage multiplier public static float blastFalloffSpeed = 0.1f; //How much the blast damage falls off as you hit more and more targets @@ -47,7 +47,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { Item.width = Item.height = 72; - Item.damage = 188; + Item.damage = 194; Item.DamageType = DamageClass.MeleeNoSpeed; Item.noUseGraphic = true; Item.noMelee = true; @@ -58,7 +58,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 6.5f; Item.UseSound = null; Item.autoReuse = true; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; Item.shoot = ProjectileID.PurificationPowder; Item.shootSpeed = 12f; @@ -115,7 +115,7 @@ namespace CalamityMod.Items.Weapons.Melee Vector2 Shift = Utils.SafeNormalize(velocity.RotatedBy(MathHelper.PiOver2), Vector2.Zero) * 30; - Projectile.NewProjectile(source, player.Center + Shift, velocity.RotatedBy(MathHelper.PiOver4 * 0.3f) , ProjectileType(), (int)(damage * glassStarDamageMultiplier), knockback, player.whoAmI, Charge > 0 ? 1 : 0); + Projectile.NewProjectile(source, player.Center + Shift, velocity.RotatedBy(MathHelper.PiOver4 * 0.3f), ProjectileType(), (int)(damage * glassStarDamageMultiplier), knockback, player.whoAmI, Charge > 0 ? 1 : 0); Projectile.NewProjectile(source, player.Center - Shift, velocity.RotatedBy(-MathHelper.PiOver4 * 0.3f), ProjectileType(), (int)(damage * glassStarDamageMultiplier), knockback, player.whoAmI, Charge > 0 ? 1 : 0); } diff --git a/Items/Weapons/Melee/TrueBiomeBlade.cs b/Items/Weapons/Melee/TrueBiomeBlade.cs index d99eea2016..d465084ed8 100644 --- a/Items/Weapons/Melee/TrueBiomeBlade.cs +++ b/Items/Weapons/Melee/TrueBiomeBlade.cs @@ -1,15 +1,15 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; using CalamityMod.DataStructures; +using CalamityMod.Items.Materials; using CalamityMod.Particles; using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -18,6 +18,8 @@ using static Terraria.ModLoader.ModContent; namespace CalamityMod.Items.Weapons.Melee { + // TODO -- CANNOT RENAME this and True Biome Blade to "TrueBiomeBlade" and "BiomeBlade" internally without corrupting existing items + // (Comment copied from an equivalent one on OmegaBiomeBlade from June 2022) public class TrueBiomeBlade : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; @@ -29,11 +31,11 @@ namespace CalamityMod.Items.Weapons.Melee public int PowerLungeCounter = 0; #region stats - public static int BaseDamage = 80; + public static int BaseDamage = 115; - public static int DefaultAttunement_BaseDamage = 80; - public static int DefaultAttunement_SigilTime = 1200; - public static int DefaultAttunement_BeamTime = 60; + public static int DefaultAttunement_BaseDamage = 105; + public static int DefaultAttunement_SigilTime = 900; + public static int DefaultAttunement_BeamTime = 90; public static float DefaultAttunement_HomingAngle = MathHelper.PiOver4; public static int EvilAttunement_BaseDamage = 155; @@ -42,9 +44,8 @@ namespace CalamityMod.Items.Weapons.Melee public static float EvilAttunement_SlashDamageBoost = 3f; public static int EvilAttunement_SlashIFrames = 60; - public static int ColdAttunement_BaseDamage = 150; - public static float ColdAttunement_SecondSwingBoost = 1.15f; - public static float ColdAttunement_ThirdSwingBoost = 1.3f; + public static int ColdAttunement_BaseDamage = 175; + public static float ColdAttunement_ThirdSwingBoost = 1.75f; public static float ColdAttunement_MistDamageReduction = 0.09f; public static int HotAttunement_BaseDamage = 122; @@ -55,10 +56,10 @@ namespace CalamityMod.Items.Weapons.Melee public static int HotAttunement_LocalIFramesCharged = 16; public static float HotAttunement_ShredDecayRate = 0.65f; //How much charge is lost per frame. - public static int TropicalAttunement_BaseDamage = 120; + public static int TropicalAttunement_BaseDamage = 150; public static float TropicalAttunement_ChainDamageReduction = 0.6f; public static float TropicalAttunement_VineDamageReduction = 0.3f; - public static float TropicalAttunement_SweetSpotDamageMultiplier = 1.2f; //It also crits, so be mindful of that + public static float TropicalAttunement_SweetSpotDamageMultiplier = 1.5f; //It also crits, so be mindful of that public static int TropicalAttunement_LocalIFrames = 60; //Be warned its got 2 extra updates so all the iframes should be divided in 3 public static int HolyAttunement_BaseDamage = 60; @@ -67,9 +68,9 @@ namespace CalamityMod.Items.Weapons.Melee public static float HolyAttunement_ThrowDamageBoost = 3.8f; public static int HolyAttunement_LocalIFrames = 16; //Be warned its got 1 extra update yadda yadda - public static int AstralAttunement_BaseDamage = 225; + public static int AstralAttunement_BaseDamage = 250; public static int AstralAttunement_DashHitIFrames = 20; - public static float AstralAttunement_FullChargeBoost = 2.5f; //The EXTRA damage boost. So putting 1 here will make it deal double damage. Putting 0.5 here will make it deal 1.5x the damage. + public static float AstralAttunement_FullChargeBoost = 4f; //The EXTRA damage boost. So putting 1 here will make it deal double damage. Putting 0.5 here will make it deal 1.5x the damage. public static float AstralAttunement_MonolithDamageBoost = 1.25f; public static float AstralAttunement_MonolithDamageFalloff = 0.25f; //Damage multiplier for all subsequent hits after the first one. @@ -155,7 +156,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 7.5f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.value = CalamityGlobalItem.Rarity6BuyPrice; + Item.value = CalamityGlobalItem.RarityLightPurpleBuyPrice; Item.rare = ItemRarityID.LightPurple; Item.shoot = ProjectileID.PurificationPowder; Item.shootSpeed = 12f; @@ -290,7 +291,8 @@ namespace CalamityMod.Items.Weapons.Melee public override bool CanUseItem(Player player) { - return !Main.projectile.Any(n => n.active && n.owner == player.whoAmI && + bool isRightClicking = player.altFunctionUse != ItemAlternativeFunctionID.None; + return !isRightClicking && !Main.projectile.Any(n => n.active && n.owner == player.whoAmI && (n.type == ProjectileType() || n.type == ProjectileType() || n.type == ProjectileType() || @@ -299,9 +301,12 @@ namespace CalamityMod.Items.Weapons.Melee n.type == ProjectileType())); } + // 03FEB2024: Ozzatron: added so the Iban Blades don't break Overhaul compatibility. Weapons are functionally unchanged. + public override bool AltFunctionUse(Player player) => true; + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - if (mainAttunement == null) + if (mainAttunement == null || player.altFunctionUse != ItemAlternativeFunctionID.None) return false; ComboResetTimer = 1f; @@ -383,7 +388,7 @@ namespace CalamityMod.Items.Weapons.Melee AddIngredient(ItemID.SoulofMight). AddIngredient(ItemID.SoulofSight). AddIngredient(ItemID.PixieDust, 2). - AddIngredient(10). + AddIngredient(10). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Melee/TrueCausticEdge.cs b/Items/Weapons/Melee/TrueCausticEdge.cs index 26926acde4..b82385b468 100644 --- a/Items/Weapons/Melee/TrueCausticEdge.cs +++ b/Items/Weapons/Melee/TrueCausticEdge.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Melee; +using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -11,38 +11,48 @@ namespace CalamityMod.Items.Weapons.Melee public class TrueCausticEdge : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + public override void SetDefaults() { Item.width = 64; + Item.height = 74; Item.damage = 100; Item.DamageType = DamageClass.Melee; Item.useAnimation = 28; Item.useStyle = ItemUseStyleID.Swing; Item.useTime = 28; Item.useTurn = true; - Item.knockBack = 5.75f; + Item.knockBack = 6f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 74; - Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 16f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 12f; } - public override void ModifyShootStats(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) => damage = (int)(damage * 0.75); + public override void ModifyShootStats(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) + { + damage = (int)(damage * 0.75); + knockback *= 0.5f; + } public override void MeleeEffects(Player player, Rectangle hitbox) { if (Main.rand.NextBool(3)) { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 74); + int dustType = Main.rand.NextBool() ? DustID.GreenFairy : DustID.Venom; + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, dustType, 0f, 0f, 100, default, Main.rand.NextFloat(1.8f, 2.4f)); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0f; + if (dustType == DustID.Venom) + Main.dust[dust].fadeIn = 1.5f; } } - public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.Venom, 150); + public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.Venom, 180); - public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo) => target.AddBuff(BuffID.Venom, 150); + public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo) => target.AddBuff(BuffID.Venom, 180); public override void AddRecipes() { diff --git a/Items/Weapons/Melee/Tumbleweed.cs b/Items/Weapons/Melee/Tumbleweed.cs index c0e7337855..01cd0c49bd 100644 --- a/Items/Weapons/Melee/Tumbleweed.cs +++ b/Items/Weapons/Melee/Tumbleweed.cs @@ -11,17 +11,17 @@ namespace CalamityMod.Items.Weapons.Melee public new string LocalizationCategory => "Items.Weapons.Melee"; public override void SetDefaults() { - Item.damage = 125; - Item.DamageType = DamageClass.MeleeNoSpeed; Item.width = 44; Item.height = 36; + Item.damage = 125; + Item.DamageType = DamageClass.MeleeNoSpeed; Item.useTime = 20; Item.useAnimation = 20; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.noUseGraphic = true; Item.knockBack = 8f; - Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; Item.UseSound = SoundID.Item1; Item.autoReuse = true; diff --git a/Items/Weapons/Melee/TyphonsGreed.cs b/Items/Weapons/Melee/TyphonsGreed.cs index 35817c9b50..e101efa146 100644 --- a/Items/Weapons/Melee/TyphonsGreed.cs +++ b/Items/Weapons/Melee/TyphonsGreed.cs @@ -12,17 +12,17 @@ namespace CalamityMod.Items.Weapons.Melee public new string LocalizationCategory => "Items.Weapons.Melee"; public override void SetDefaults() { - Item.damage = 60; - Item.DamageType = DamageClass.Melee; Item.width = 16; Item.height = 16; + Item.damage = 62; + Item.DamageType = DamageClass.Melee; Item.useTime = 30; Item.useAnimation = 30; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.noUseGraphic = true; Item.knockBack = 5f; - Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; Item.UseSound = SoundID.DD2_SkyDragonsFurySwing; Item.autoReuse = true; diff --git a/Items/Weapons/Melee/UltimusCleaver.cs b/Items/Weapons/Melee/UltimusCleaver.cs index 31df9995be..655d248f21 100644 --- a/Items/Weapons/Melee/UltimusCleaver.cs +++ b/Items/Weapons/Melee/UltimusCleaver.cs @@ -1,9 +1,9 @@ using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Items.Weapons.Melee { @@ -13,18 +13,17 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { + Item.width = 72; + Item.height = 62; Item.damage = 130; Item.DamageType = DamageClass.Melee; Item.useTurn = true; Item.rare = ItemRarityID.Yellow; - Item.width = 72; - Item.height = 62; - Item.scale = 1.5f; Item.useTime = 20; Item.useAnimation = 20; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 8f; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.autoReuse = true; Item.UseSound = SoundID.Item1; } @@ -43,14 +42,14 @@ namespace CalamityMod.Items.Weapons.Melee int increment; for (int i = 0; i < 40; i = increment + 1) { - int swingDust = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 174, 0f, 0f, 200, default, firstDustScale); + int swingDust = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, DustID.InfernoFork, 0f, 0f, 200, default, firstDustScale); Dust dust = Main.dust[swingDust]; dust.position = target.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)target.width / 2f; dust.noGravity = true; dust.velocity.Y -= 6f; dust.velocity *= 3f; dust.velocity += dustVelocity * Main.rand.NextFloat(); - swingDust = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 174, 0f, 0f, 100, default, secondDustScale); + swingDust = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, DustID.InfernoFork, 0f, 0f, 100, default, secondDustScale); dust.position = target.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)target.width / 2f; dust.velocity.Y -= 6f; dust.velocity *= 2f; @@ -62,7 +61,7 @@ namespace CalamityMod.Items.Weapons.Melee } for (int j = 0; j < 20; j = increment + 1) { - int swingDust2 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 174, 0f, 0f, 0, default, thirdDustScale); + int swingDust2 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, DustID.InfernoFork, 0f, 0f, 0, default, thirdDustScale); Dust dust = Main.dust[swingDust2]; dust.position = target.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)target.velocity.ToRotation(), default) * (float)target.width / 3f; dust.noGravity = true; diff --git a/Items/Weapons/Melee/UrchinFlail.cs b/Items/Weapons/Melee/UrchinFlail.cs index 8cedafc9d1..5be6cbaa01 100644 --- a/Items/Weapons/Melee/UrchinFlail.cs +++ b/Items/Weapons/Melee/UrchinFlail.cs @@ -10,17 +10,17 @@ namespace CalamityMod.Items.Weapons.Melee public new string LocalizationCategory => "Items.Weapons.Melee"; public override void SetDefaults() { - Item.damage = 20; - Item.DamageType = DamageClass.MeleeNoSpeed; Item.width = 44; Item.height = 36; + Item.damage = 20; + Item.DamageType = DamageClass.MeleeNoSpeed; Item.useTime = 25; Item.useAnimation = 25; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.noUseGraphic = true; Item.knockBack = 6f; - Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; Item.UseSound = SoundID.Item1; Item.autoReuse = true; diff --git a/Items/Weapons/Melee/UrchinMace.cs b/Items/Weapons/Melee/UrchinMace.cs index bf1bd221a9..abea666477 100644 --- a/Items/Weapons/Melee/UrchinMace.cs +++ b/Items/Weapons/Melee/UrchinMace.cs @@ -14,6 +14,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { Item.width = 42; + Item.height = 48; Item.damage = 23; Item.channel = true; Item.noUseGraphic = true; @@ -25,8 +26,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.useTime = 19; Item.knockBack = 4; Item.UseSound = SoundID.Item1; - Item.height = 48; - Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 9f; diff --git a/Items/Weapons/Melee/VeinBurster.cs b/Items/Weapons/Melee/VeinBurster.cs index 565d8a41e8..fe8d0adf61 100644 --- a/Items/Weapons/Melee/VeinBurster.cs +++ b/Items/Weapons/Melee/VeinBurster.cs @@ -13,20 +13,20 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { Item.width = 52; + Item.height = 50; Item.damage = 42; Item.DamageType = DamageClass.Melee; - Item.useAnimation = 45; + Item.useAnimation = 41; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 45; + Item.useTime = 41; Item.useTurn = true; Item.knockBack = 4.25f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 50; - Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 10f; + Item.shootSpeed = 13f; } public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) { diff --git a/Items/Weapons/Melee/Violence.cs b/Items/Weapons/Melee/Violence.cs index e4640a714f..a4e12b4d79 100644 --- a/Items/Weapons/Melee/Violence.cs +++ b/Items/Weapons/Melee/Violence.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Weapons.Melee public new string LocalizationCategory => "Items.Weapons.Melee"; public override void SetDefaults() { - Item.height = Item.width = 142; + Item.width = Item.height = 142; Item.damage = 435; Item.DamageType = DamageClass.MeleeNoSpeed; Item.noMelee = true; diff --git a/Items/Weapons/Melee/Virulence.cs b/Items/Weapons/Melee/Virulence.cs index 811dad3881..da76d26a24 100644 --- a/Items/Weapons/Melee/Virulence.cs +++ b/Items/Weapons/Melee/Virulence.cs @@ -1,8 +1,8 @@ -using Terraria.DataStructures; -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -14,6 +14,8 @@ namespace CalamityMod.Items.Weapons.Melee public new string LocalizationCategory => "Items.Weapons.Melee"; public override void SetDefaults() { + Item.width = 48; + Item.height = 62; Item.damage = 100; Item.knockBack = 5.5f; Item.useAnimation = Item.useTime = 15; @@ -23,11 +25,9 @@ namespace CalamityMod.Items.Weapons.Melee Item.shootSpeed = 9f; Item.shoot = ModContent.ProjectileType(); - Item.width = 48; - Item.height = 62; Item.useStyle = ItemUseStyleID.Swing; Item.UseSound = SoundID.Item1; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; } diff --git a/Items/Weapons/Melee/VoidEdge.cs b/Items/Weapons/Melee/VoidEdge.cs new file mode 100644 index 0000000000..07276065ed --- /dev/null +++ b/Items/Weapons/Melee/VoidEdge.cs @@ -0,0 +1,110 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Projectiles.Melee; +using CalamityMod.Projectiles.Rogue; +using CalamityMod.Rarities; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Melee +{ + [LegacyName("SoulEdge")] + public class VoidEdge : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Weapons.Melee"; + + public static readonly SoundStyle ProjectileDeathSound = SoundID.Item100 with { Volume = 0.5f }; + + internal const int TotalProjectilesPerSwing = 3; + + internal const int ProjectileSpreadOutTime = 20; + + internal const float ShootSpeed = 10f; + + internal const float SmallSoulStatMultiplier = 0.8f; + + internal const float MediumSoulStatMultiplier = 0.9f; + + public override void SetDefaults() + { + Item.width = 88; + Item.height = 88; + Item.damage = 210; + Item.DamageType = DamageClass.Melee; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 24; + Item.useAnimation = 24; + Item.useTurn = true; + Item.knockBack = 7f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = ShootSpeed; + + Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; + Item.rare = ModContent.RarityType(); + } + + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + { + int numShots = TotalProjectilesPerSwing; + for (int i = 0; i < numShots; i++) + { + velocity = velocity.RotatedByRandom(0.35) * Main.rand.NextFloat(0.9f, 1.1f); + float ai1 = MathHelper.Lerp(0.75f, 1.25f, Main.rand.NextFloat()); + switch (i) + { + default: + case 0: + break; + + case 1: + type = ModContent.ProjectileType(); + knockback *= MediumSoulStatMultiplier; + break; + + case 2: + type = ModContent.ProjectileType(); + knockback *= SmallSoulStatMultiplier; + break; + } + int proj = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, ai1); + Main.projectile[proj].netUpdate = true; + } + return false; + } + + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.NextBool()) + { + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 66, 0f, 0f, 0, Color.Plum, Main.rand.NextFloat(0.65f, 1.2f)); + Main.dust[dust].noGravity = true; + } + } + public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) + { + SoundStyle sound = new("CalamityMod/Sounds/Item/PhantomSpirit"); + SoundEngine.PlaySound(sound with { Volume = 0.65f, PitchVariance = 0.3f, Pitch = -0.5f }, target.Center); + for (int i = 0; i <= 30; i++) + { + Dust dust = Dust.NewDustPerfect(target.Center, 66, new Vector2(0, -18).RotatedByRandom(MathHelper.ToRadians(15f)) * Main.rand.NextFloat(0.1f, 1.9f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.7f, 1.6f); + Dust dust2 = Dust.NewDustPerfect(target.Center, 66, new Vector2(0, -7).RotatedByRandom(MathHelper.ToRadians(35f)) * Main.rand.NextFloat(0.1f, 1.9f)); + dust2.noGravity = true; + dust2.scale = Main.rand.NextFloat(0.7f, 1.6f); + } + + float ai1 = MathHelper.Lerp(0.75f, 1.25f, Main.rand.NextFloat()); + int soulDamage = (int)(damageDone / 3); + Vector2 velocity = new Vector2(0f, -14f).RotatedByRandom(0.65f) * Main.rand.NextFloat(0.9f, 1.1f); + Projectile.NewProjectile(player.GetSource_ItemUse(Item), target.Center + new Vector2(0, 1300f), velocity.RotatedByRandom(0.4f) * Main.rand.NextFloat(0.9f, 1.1f), ModContent.ProjectileType(), soulDamage, 0f, player.whoAmI, 0f, ai1); + Projectile.NewProjectile(player.GetSource_ItemUse(Item), target.Center + new Vector2(0, 1300f), velocity.RotatedByRandom(0.4f) * Main.rand.NextFloat(0.9f, 1.1f), ModContent.ProjectileType(), soulDamage, 0f, player.whoAmI, 0f, ai1); + Projectile.NewProjectile(player.GetSource_ItemUse(Item), target.Center + new Vector2(0, 1300f), velocity.RotatedByRandom(0.4f) * Main.rand.NextFloat(0.9f, 1.1f), ModContent.ProjectileType(), soulDamage, 0f, player.whoAmI, 0f, ai1); + } + } +} diff --git a/Items/Weapons/Melee/SoulEdge.png b/Items/Weapons/Melee/VoidEdge.png similarity index 100% rename from Items/Weapons/Melee/SoulEdge.png rename to Items/Weapons/Melee/VoidEdge.png diff --git a/Items/Weapons/Melee/VulcaniteLance.cs b/Items/Weapons/Melee/VulcaniteLance.cs index 590be9e4cb..98e810e120 100644 --- a/Items/Weapons/Melee/VulcaniteLance.cs +++ b/Items/Weapons/Melee/VulcaniteLance.cs @@ -18,6 +18,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { Item.width = 44; + Item.height = 44; Item.damage = 90; Item.DamageType = TrueMeleeDamageClass.Instance; Item.noMelee = true; @@ -29,8 +30,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 6.75f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 44; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; diff --git a/Items/Weapons/Melee/WindBlade.cs b/Items/Weapons/Melee/WindBlade.cs index 7d6a182d7c..8676601b68 100644 --- a/Items/Weapons/Melee/WindBlade.cs +++ b/Items/Weapons/Melee/WindBlade.cs @@ -1,8 +1,8 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -14,17 +14,17 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { Item.width = 58; + Item.height = 58; Item.damage = 41; Item.DamageType = DamageClass.Melee; Item.useAnimation = 20; Item.useStyle = ItemUseStyleID.Swing; Item.useTime = 20; Item.useTurn = true; - Item.knockBack = 5; + Item.knockBack = 5f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 58; - Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 3f; @@ -32,16 +32,14 @@ namespace CalamityMod.Items.Weapons.Melee 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, type, damage / 2, knockback, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, position, velocity, type, damage / 2, knockback, player.whoAmI); return false; } public override void MeleeEffects(Player player, Rectangle hitbox) { if (Main.rand.NextBool(3)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 59); - } + Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, DustID.BlueTorch); } public override void AddRecipes() diff --git a/Items/Weapons/Melee/WulfrumScrewdriver.cs b/Items/Weapons/Melee/WulfrumScrewdriver.cs index 909b658fa7..ad663b26d5 100644 --- a/Items/Weapons/Melee/WulfrumScrewdriver.cs +++ b/Items/Weapons/Melee/WulfrumScrewdriver.cs @@ -1,16 +1,16 @@ -using CalamityMod.Items.Materials; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; +using System; +using System.Linq; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; -using Terraria.ModLoader; -using Terraria.Audio; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; -using System; -using static CalamityMod.CalamityUtils; +using Terraria; +using Terraria.Audio; using Terraria.DataStructures; -using System.Linq; +using Terraria.ID; +using Terraria.ModLoader; +using static CalamityMod.CalamityUtils; namespace CalamityMod.Items.Weapons.Melee { @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Melee public static int DefaultTime = 10; public static readonly SoundStyle ThrustSound = new("CalamityMod/Sounds/Item/WulfrumScrewdriverThrust") { PitchVariance = 0.4f }; public static readonly SoundStyle ThudSound = new("CalamityMod/Sounds/Item/WulfrumScrewdriverThud") { PitchVariance = 0.2f, Volume = 0.7f }; - public static readonly SoundStyle ScrewGetSound = new("CalamityMod/Sounds/Item/WulfrumScrewdriverScrewGet") { PitchVariance = 0.1f}; + public static readonly SoundStyle ScrewGetSound = new("CalamityMod/Sounds/Item/WulfrumScrewdriverScrewGet") { PitchVariance = 0.1f }; public static readonly SoundStyle ScrewHitSound = new("CalamityMod/Sounds/Item/WulfrumScrewdriverScrewHit") { Volume = 0.7f }; public static readonly SoundStyle FunnyUltrablingSound = new("CalamityMod/Sounds/Custom/UltrablingHit"); @@ -74,7 +74,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 3.75f; Item.UseSound = ThrustSound; Item.autoReuse = true; - Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.rare = ItemRarityID.Blue; Item.noMelee = true; Item.noUseGraphic = true; @@ -132,7 +132,7 @@ namespace CalamityMod.Items.Weapons.Melee public override bool AltFunctionUse(Player player) => ScrewAvailable; public override bool CanUseItem(Player player) => player.altFunctionUse == 2 ? !Main.projectile.Any(n => n.active && n.owner == player.whoAmI && n.type == ModContent.ProjectileType()) : true; public override void ModifyShootStats(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) - { + { if (player.altFunctionUse == 2) damage = (int)(damage * ScrewBaseDamageMult); } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) @@ -183,7 +183,7 @@ namespace CalamityMod.Items.Weapons.Melee Vector2 realIdealSpot = myPlayer.MountedCenter + myPlayer.gfxOffY * Vector2.UnitY - Main.screenPosition - Vector2.UnitY * 50f - Vector2.Lerp(myPlayer.velocity, PrevOffset, 0.5f); realIdealSpot.Y += (float)Math.Sin(Main.GlobalTimeWrappedHourly * 3f) * 5f; realIdealSpot.X += (float)Math.Sin(Main.GlobalTimeWrappedHourly * 1f) * 7.8f; - + ScrewPosition = new Vector3(realIdealSpot, (float)Math.Sin(Main.GlobalTimeWrappedHourly * 0.5f) * MathHelper.PiOver4 * 0.34f); position = Vector2.Lerp(new Vector2(ScrewPosition.X, ScrewPosition.Y), new Vector2(ScrewStart.X, ScrewStart.Y), ProgressionOfScrew); diff --git a/Items/Weapons/Melee/YateveoBloom.cs b/Items/Weapons/Melee/YateveoBloom.cs index aee836b46d..b6e7a31af2 100644 --- a/Items/Weapons/Melee/YateveoBloom.cs +++ b/Items/Weapons/Melee/YateveoBloom.cs @@ -1,8 +1,8 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Melee; +using CalamityMod.Projectiles.Melee; using CalamityMod.Projectiles.Melee.Spears; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -11,20 +11,19 @@ namespace CalamityMod.Items.Weapons.Melee public class YateveoBloom : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; - public static int BaseDamage = 30; //Spear is 20 damage, Flail is 30 damage public static float ShootSpeed = 12f; public static float SpearSpeed = 4.5f; public override void SetStaticDefaults() { - ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; + ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; } public override void SetDefaults() { Item.width = 42; Item.height = 62; - Item.damage = BaseDamage; + Item.damage = 30; // Spear is 20 damage, Flail is 30 damage Item.knockBack = 5f; Item.useAnimation = Item.useTime = 22; @@ -38,7 +37,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.useStyle = ItemUseStyleID.Shoot; Item.UseSound = SoundID.Item1; - Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; Item.Calamity().donorItem = true; diff --git a/Items/Weapons/Melee/YinYo.cs b/Items/Weapons/Melee/YinYo.cs index bea4627bf9..641d211528 100644 --- a/Items/Weapons/Melee/YinYo.cs +++ b/Items/Weapons/Melee/YinYo.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; - Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; } diff --git a/Items/Weapons/Ranged/AcesHigh.cs b/Items/Weapons/Ranged/AcesHigh.cs index c9e4c955ab..72672b11ce 100644 --- a/Items/Weapons/Ranged/AcesHigh.cs +++ b/Items/Weapons/Ranged/AcesHigh.cs @@ -16,10 +16,10 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() { - Item.damage = 325; - Item.DamageType = DamageClass.Ranged; Item.width = 48; Item.height = 30; + Item.damage = 325; + Item.DamageType = DamageClass.Ranged; Item.useTime = 3; Item.useAnimation = 12; Item.reuseDelay = 8; @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.noMelee = true; Item.knockBack = 6f; - Item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; diff --git a/Items/Weapons/Ranged/AdamantiteParticleAccelerator.cs b/Items/Weapons/Ranged/AdamantiteParticleAccelerator.cs index 3675767cc4..62bfe59a96 100644 --- a/Items/Weapons/Ranged/AdamantiteParticleAccelerator.cs +++ b/Items/Weapons/Ranged/AdamantiteParticleAccelerator.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Ranged; +using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -13,19 +13,24 @@ namespace CalamityMod.Items.Weapons.Ranged public const int ChargeFrames = 28; public const int CooldownFrames = 16; public static readonly Color[] LightColors = new Color[] { new Color(235, 40, 121), new Color(49, 161, 246) }; //beam colors + + public override void SetStaticDefaults() + { + ItemID.Sets.IsRangedSpecialistWeapon[Item.type] = true; + } public override void SetDefaults() { - Item.damage = 65; - Item.DamageType = DamageClass.Ranged; Item.width = 54; Item.height = 52; + Item.damage = 65; + Item.DamageType = DamageClass.Ranged; Item.useTime = ChargeFrames + CooldownFrames; Item.useAnimation = ChargeFrames + CooldownFrames; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3f; Item.channel = true; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.autoReuse = true; Item.shootSpeed = 6f; diff --git a/Items/Weapons/Ranged/Alluvion.cs b/Items/Weapons/Ranged/Alluvion.cs index 80bdc77a98..86ef655e99 100644 --- a/Items/Weapons/Ranged/Alluvion.cs +++ b/Items/Weapons/Ranged/Alluvion.cs @@ -16,10 +16,10 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() { - Item.damage = 165; - Item.DamageType = DamageClass.Ranged; Item.width = 62; Item.height = 90; + Item.damage = 78; + Item.DamageType = DamageClass.Ranged; Item.useTime = 15; Item.useAnimation = 30; Item.useStyle = ItemUseStyleID.Shoot; @@ -69,7 +69,7 @@ namespace CalamityMod.Items.Weapons.Ranged newType = ModContent.ProjectileType(); break; } - int proj = Projectile.NewProjectile(spawnSource, source.X + offset.X, source.Y + offset.Y, velocity.X, velocity.Y, newType, damage, knockback, player.whoAmI); + int proj = Projectile.NewProjectile(spawnSource, source.X + offset.X, source.Y + offset.Y, velocity.X, velocity.Y, newType, (int)(damage * 2.3f), knockback, player.whoAmI); if (proj.WithinBounds(Main.maxProjectiles)) { Main.projectile[proj].arrow = true; diff --git a/Items/Weapons/Ranged/AngelicShotgun.cs b/Items/Weapons/Ranged/AngelicShotgun.cs index a8914c159f..d2fce9bbca 100644 --- a/Items/Weapons/Ranged/AngelicShotgun.cs +++ b/Items/Weapons/Ranged/AngelicShotgun.cs @@ -1,8 +1,9 @@ -using CalamityMod.Items.Materials; +using System; +using CalamityMod.Items.Ammo; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; using CalamityMod.Rarities; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.Audio; using Terraria.DataStructures; @@ -14,31 +15,29 @@ namespace CalamityMod.Items.Weapons.Ranged public class AngelicShotgun : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; - private static int BaseDamage = 96; private static float BulletSpeed = 12f; public override void SetDefaults() { - Item.damage = BaseDamage; + Item.width = 86; + Item.height = 38; + Item.damage = 96; Item.knockBack = 3f; Item.DamageType = DamageClass.Ranged; Item.noMelee = true; Item.autoReuse = true; - Item.width = 86; - Item.height = 38; - Item.useTime = 24; Item.useAnimation = 24; Item.UseSound = SoundID.Item38; Item.useStyle = ItemUseStyleID.Shoot; - Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; Item.shootSpeed = BulletSpeed; - Item.shoot = ModContent.ProjectileType(); + Item.shoot = ModContent.ProjectileType(); Item.useAmmo = AmmoID.Bullet; Item.Calamity().canFirePointBlankShots = true; } @@ -53,6 +52,10 @@ namespace CalamityMod.Items.Weapons.Ranged int NumBullets = Main.rand.Next(5, 8); Vector2 baseVelocity = velocity.SafeNormalize(Vector2.Zero) * BulletSpeed; + // If Musket Balls are used, damage is set to match Hallow-Point Rounds for both bullets and lasers + if (type == ProjectileID.Bullet) + damage += HallowPointRound.BaseDamage - 7; + // Fire a shotgun spread of bullets. for (int i = 0; i < NumBullets; ++i) { @@ -61,7 +64,7 @@ namespace CalamityMod.Items.Weapons.Ranged Vector2 randomVelocity = baseVelocity + new Vector2(dx, dy); if (type == ProjectileID.Bullet) - Projectile.NewProjectile(source, position, randomVelocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, position, randomVelocity, Item.shoot, damage, knockback, player.whoAmI); else Projectile.NewProjectile(source, position, randomVelocity, type, damage, knockback, player.whoAmI); } diff --git a/Items/Weapons/Ranged/Animosity.cs b/Items/Weapons/Ranged/Animosity.cs index 4df13fc791..afd87d2f30 100644 --- a/Items/Weapons/Ranged/Animosity.cs +++ b/Items/Weapons/Ranged/Animosity.cs @@ -1,42 +1,70 @@ -using Microsoft.Xna.Framework; +using System; +using System.Collections.Generic; +using CalamityMod.Projectiles; +using CalamityMod.Projectiles.Magic; +using CalamityMod.Projectiles.Ranged; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.DataStructures; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Ranged { public class Animosity : ModItem, ILocalizedModType { + public static readonly SoundStyle ShootAndReloadSound = new("CalamityMod/Sounds/Item/WulfrumBlunderbussFireAndReload") { PitchVariance = 0.25f }; + // Very cool sound and it would be a shame for it to not be used elsewhere, would be even better if a new sound is made in the future, but for now this is good enough + + public float SniperDmgMult = 8f; + public float SniperCritMult = Main.zenithWorld ? 7f : 1.35f; + public float SniperVelocityMult = 2f; public new string LocalizationCategory => "Items.Weapons.Ranged"; - public override void SetStaticDefaults() - { - ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; - } + + public override void SetStaticDefaults() => ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; public override void SetDefaults() { - Item.damage = 33; + Item.width = 70; + Item.height = 18; + Item.damage = 45; Item.DamageType = DamageClass.Ranged; Item.width = 70; Item.height = 18; - Item.useTime = 4; - Item.useAnimation = 12; - Item.reuseDelay = 15; - Item.useLimitPerAnimation = 3; + Item.scale = 0.85f; + Item.useTime = 30; + Item.reuseDelay = 10; + Item.useAnimation = 30; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2f; - Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; - Item.UseSound = SoundID.Item31; + Item.UseSound = null; Item.autoReuse = true; Item.shoot = ProjectileID.PurificationPowder; - Item.shootSpeed = 11f; + Item.shootSpeed = 6.5f; Item.useAmmo = AmmoID.Bullet; + Item.crit = 8; Item.Calamity().canFirePointBlankShots = true; } + public override void UpdateInventory(Player player) + { + //ITS MY REWORK SO I CAN PUT A REFERENCE: Shotgun full of hate, returns Animosity otherwise + if (Main.zenithWorld) + Item.SetNameOverride(this.GetLocalizedValue("GFBName")); + } + + public override void ModifyTooltips(List list) + { + string tooltip = Main.zenithWorld ? this.GetLocalizedValue("TooltipGFB") : this.GetLocalizedValue("TooltipNormal"); + list.FindAndReplace("[GFB]", tooltip); + //Distortion wind do whisper one truth... + } + public override Vector2? HoldoutOffset() { return new Vector2(-5, 0); @@ -47,48 +75,179 @@ namespace CalamityMod.Items.Weapons.Ranged return true; } + public override float UseSpeedMultiplier(Player player) + { + if (player.altFunctionUse == 2) + return 1 / 2f; + + return 1f; + } + public override bool CanUseItem(Player player) { if (player.altFunctionUse == 2) - { - Item.useTime = 4; - Item.reuseDelay = 13; - Item.useAnimation = 12; - Item.UseSound = SoundID.Item31; - Item.shootSpeed = 10f; - } + Item.reuseDelay = 5; else - { - Item.useTime = 35; - Item.reuseDelay = 0; - Item.useAnimation = 35; - Item.UseSound = SoundID.Item40; - Item.shootSpeed = 15f; - } + Item.reuseDelay = 10; + return base.CanUseItem(player); } + #region Shooting public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { + //It should feel powerful but also not too much given feedback + if (player.altFunctionUse == 2) { - float SpeedX = velocity.X + (float)Main.rand.Next(-10, 11) * 0.05f; - float SpeedY = velocity.Y + (float)Main.rand.Next(-10, 11) * 0.05f; - Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI, 0f, 0f); - return false; + player.Calamity().GeneralScreenShakePower = 2f; + SoundEngine.PlaySound(ShootAndReloadSound with { PitchVariance = 0.3f }, position); + + if (Main.zenithWorld) // Why only shotgun full of hate, why not Hexagun too? (See AnimosityBullet for more) + { + SoundEngine.PlaySound(SoundID.Item9, position); + SoundEngine.PlaySound(SoundID.Item25, position); + } + //Shoot from muzzle + Vector2 nuzzlePos = player.MountedCenter + velocity * 4f; + + //The dmg mult has to be applied here otherwise the left click gets it instead (for one shot), and the crit needs to be applied down here too cuz otherwise it never affects the weapon + int p = Projectile.NewProjectile(source, nuzzlePos, velocity * SniperVelocityMult, ModContent.ProjectileType(), (int)(damage * SniperDmgMult), knockback, player.whoAmI); + Main.projectile[p].CritChance = (int)(Main.projectile[p].CritChance * SniperCritMult); //To support crit mults with decimals } else { - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ProjectileID.BulletHighVelocity, (int)(damage * 5.8f), knockback, player.whoAmI, 0f, 0f); - return false; + SoundEngine.PlaySound(SoundID.Item38 with { Volume = 0.8f, Pitch = 0.5f, PitchVariance = 0.3f }, position); + //Shoot from muzzle + Vector2 nuzzlePos = player.MountedCenter + velocity * 4f; + + // Fire a shotgun spread of bullets. + for (int i = 0; i < 6; ++i) + { + Vector2 randomVelocity = velocity.RotatedByRandom(MathHelper.ToRadians(i * 2.5f)); + Projectile shot = Projectile.NewProjectileDirect(source, nuzzlePos, randomVelocity, type, damage, knockback, player.whoAmI); + CalamityGlobalProjectile cgp = shot.Calamity(); + cgp.brimstoneBullets = true; //add a brimstone trail to all bullets + } + for (int i = 0; i <= 10; i++) + { + Dust dust = Dust.NewDustPerfect(nuzzlePos, 303, velocity.RotatedByRandom(MathHelper.ToRadians(7f)) * Main.rand.NextFloat(0.05f, 0.4f), 0, default, Main.rand.NextFloat(0.9f, 1.2f)); + dust.noGravity = true; + dust.alpha = 150; + } + + // Fires other assorted things in GFB, because funni! + if (Main.zenithWorld) + { + // Packed full of skulls, + if (Main.rand.Next(4) < 3) + { + for (int k = 0; k < 3; k++) + { + Vector2 skullVelocity = velocity.RotatedByRandom(MathHelper.ToRadians(k * 2f)); + Projectile skullHate = Projectile.NewProjectileDirect(source, nuzzlePos, skullVelocity, ProjectileID.BookOfSkullsSkull, damage / 4, knockback, player.whoAmI); + skullHate.DamageType = DamageClass.Ranged; + skullHate.extraUpdates += 1; + skullHate.penetrate = 1; + } + } + // nails, + if (Main.rand.Next(4) < 3) + { + for (int n = 0; n < 3; n++) + { + Vector2 nailVelocity = velocity.RotatedByRandom(MathHelper.ToRadians(n * 2f)); + Projectile nailHate = Projectile.NewProjectileDirect(source, nuzzlePos, nailVelocity, ProjectileID.NailFriendly, damage / 4, knockback, player.whoAmI); + nailHate.DamageType = DamageClass.Ranged; + nailHate.extraUpdates += 1; + } + } + // and poison. + if (Main.rand.Next(4) < 3) + { + for (int p = 0; p < 3; p++) + { + Vector2 poisonVelocity = velocity.RotatedByRandom(MathHelper.ToRadians(p * 2f)); + Projectile poisonHate = Projectile.NewProjectileDirect(source, nuzzlePos, poisonVelocity, ModContent.ProjectileType(), damage / 2, knockback, player.whoAmI, 0f, 0f, 1f); + poisonHate.DamageType = DamageClass.Ranged; + poisonHate.extraUpdates += 1; + poisonHate.penetrate = 1; + } + } + } } + //shell + if (Main.netMode != NetmodeID.Server) + { + string goreType = Main.rand.NextBool() ? "EmptyAnimosityShell" : "EmptyAnimosityShell2"; + Gore.NewGore(source, position, velocity.RotatedBy(2f * -player.direction) * Main.rand.NextFloat(0.6f, 0.7f), Mod.Find(goreType).Type); + } + return false; + } + #endregion + + #region Animations + public override void HoldItem(Player player) => player.Calamity().mouseWorldListener = true; + + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + player.ChangeDir(Math.Sign((player.Calamity().mouseWorld - player.Center).X)); + float itemRotation = player.compositeFrontArm.rotation + MathHelper.PiOver2 * player.gravDir; + + Vector2 itemPosition = player.MountedCenter + itemRotation.ToRotationVector2() * 35f; + Vector2 itemSize = new Vector2(Item.width, Item.height); + Vector2 itemOrigin = new Vector2(-5, 6); + + + //Sniper's horizontal recoil; can be a bit subtle but it is noticeable + if (player.altFunctionUse == 2) + { + //Recoil: + int anim = 0; + for (int r = 0; r < Item.useAnimation; ++r) + { + if (anim == 10 && r < Item.useAnimation / 2) //animates every 10 frames so that the player notices a recoil because this happens way too fast + { + itemPosition.X -= player.direction * 0.025f; + itemPosition.Y -= player.direction * 0.025f; + anim = 0; + } + else if (anim == 10 && r > Item.useAnimation / 2) + { + itemPosition.X += player.direction * 0.025f; + itemPosition.Y += player.direction * 0.025f; + anim = 0; + } + ++anim; + } + } + + CalamityUtils.CleanHoldStyle(player, itemRotation, itemPosition, itemSize, itemOrigin); + base.UseStyle(player, heldItemFrame); } - public override bool CanConsumeAmmo(Item ammo, Player player) + // Recoil + Not having the gun aim downwards + public override void UseItemFrame(Player player) { - if (Main.rand.Next(0, 100) < 50) - return false; - return true; + player.ChangeDir(Math.Sign((player.Calamity().mouseWorld - player.Center).X)); + + float animProgress = 1 - player.itemTime / (float)player.itemTimeMax; + float rotation = (player.Center - player.Calamity().mouseWorld).ToRotation() * player.gravDir + MathHelper.PiOver2; + if (animProgress < 0.5) + rotation += (player.altFunctionUse == 2 ? -1f : -0.45f) * (float)Math.Pow((0.5f - animProgress) / 0.5f, 2) * player.direction; + player.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, rotation); //must be here otherwise it will vibrate + + + //Reloads the gun + if (animProgress > 0.5f) + { + float backArmRotation = rotation + 0.52f * player.direction; + + Player.CompositeArmStretchAmount stretch = ((float)Math.Sin(MathHelper.Pi * (animProgress - 0.5f) / 0.36f)).ToStretchAmount(); + player.SetCompositeArmBack(true, stretch, backArmRotation); + } + } + #endregion } } diff --git a/Items/Weapons/Ranged/AntiMaterielRifle.cs b/Items/Weapons/Ranged/AntiMaterielRifle.cs index 506804fa01..3a1552f5c9 100644 --- a/Items/Weapons/Ranged/AntiMaterielRifle.cs +++ b/Items/Weapons/Ranged/AntiMaterielRifle.cs @@ -16,10 +16,10 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() { - Item.damage = 1860; - Item.DamageType = DamageClass.Ranged; Item.width = 154; Item.height = 40; + Item.damage = 1860; + Item.DamageType = DamageClass.Ranged; Item.useTime = 60; Item.useAnimation = 60; Item.useStyle = ItemUseStyleID.Shoot; @@ -37,6 +37,8 @@ namespace CalamityMod.Items.Weapons.Ranged public override Vector2? HoldoutOffset() => new Vector2(-30, 0); + public override void HoldItem(Player player) => player.scope = true; + // Terraria seems to really dislike high crit values in SetDefaults public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 20; diff --git a/Items/Weapons/Ranged/AquashardShotgun.cs b/Items/Weapons/Ranged/AquashardShotgun.cs index 412e321103..55fe5c3db9 100644 --- a/Items/Weapons/Ranged/AquashardShotgun.cs +++ b/Items/Weapons/Ranged/AquashardShotgun.cs @@ -1,9 +1,9 @@ -using Terraria.DataStructures; +using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; -using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -14,16 +14,16 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() { - Item.damage = 9; - Item.DamageType = DamageClass.Ranged; Item.width = 62; Item.height = 26; + Item.damage = 12; + Item.DamageType = DamageClass.Ranged; Item.useTime = 30; Item.useAnimation = 30; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5.5f; - Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; Item.UseSound = SoundID.Item61; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/Arbalest.cs b/Items/Weapons/Ranged/Arbalest.cs index 44d3e6e07e..3ee4b56f48 100644 --- a/Items/Weapons/Ranged/Arbalest.cs +++ b/Items/Weapons/Ranged/Arbalest.cs @@ -1,9 +1,9 @@ -using Terraria.DataStructures; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Items.Weapons.Ranged { @@ -15,10 +15,10 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - Item.damage = 28; - Item.DamageType = DamageClass.Ranged; Item.width = 82; Item.height = 34; + Item.damage = 28; + Item.DamageType = DamageClass.Ranged; Item.useTime = 7; Item.useAnimation = 21; Item.reuseDelay = 30; @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 4f; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = null; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/ArcNovaDiffuser.cs b/Items/Weapons/Ranged/ArcNovaDiffuser.cs index 24e36e7c3b..c47d25ca28 100644 --- a/Items/Weapons/Ranged/ArcNovaDiffuser.cs +++ b/Items/Weapons/Ranged/ArcNovaDiffuser.cs @@ -25,19 +25,24 @@ namespace CalamityMod.Items.Weapons.Ranged public static int Charge2Frames = 308; public new string LocalizationCategory => "Items.Weapons.Ranged"; + + public override void SetStaticDefaults() + { + ItemID.Sets.IsRangedSpecialistWeapon[Item.type] = true; + } public override void SetDefaults() { + Item.width = 58; + Item.height = 28; Item.damage = 172; Item.DamageType = DamageClass.Ranged; - Item.width = 72; - Item.height = 38; Item.useTime = Item.useAnimation = AftershotCooldownFrames; Item.noMelee = true; Item.noUseGraphic = true; Item.channel = true; Item.useStyle = ItemUseStyleID.Shoot; Item.knockBack = 4f; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; Item.UseSound = null; Item.autoReuse = false; diff --git a/Items/Weapons/Ranged/ArcNovaDiffuser.png b/Items/Weapons/Ranged/ArcNovaDiffuser.png index e761b7033e..b61ef6f3e4 100644 Binary files a/Items/Weapons/Ranged/ArcNovaDiffuser.png and b/Items/Weapons/Ranged/ArcNovaDiffuser.png differ diff --git a/Items/Weapons/Ranged/Archerfish.cs b/Items/Weapons/Ranged/Archerfish.cs index 76b7140b78..80e6aabbf1 100644 --- a/Items/Weapons/Ranged/Archerfish.cs +++ b/Items/Weapons/Ranged/Archerfish.cs @@ -1,6 +1,6 @@ -using CalamityMod.Projectiles.Ranged; +using System; +using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -13,16 +13,16 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() { - Item.damage = 16; - Item.DamageType = DamageClass.Ranged; Item.width = 78; Item.height = 36; + Item.damage = 16; + Item.DamageType = DamageClass.Ranged; Item.useTime = 11; Item.useAnimation = 11; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2f; - Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; Item.UseSound = SoundID.Item85; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/Arietes41.cs b/Items/Weapons/Ranged/Arietes41.cs new file mode 100644 index 0000000000..be78f5ede0 --- /dev/null +++ b/Items/Weapons/Ranged/Arietes41.cs @@ -0,0 +1,111 @@ +using System; +using CalamityMod.Items.Materials; +using CalamityMod.Particles; +using CalamityMod.Projectiles; +using Microsoft.CodeAnalysis; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Ranged +{ + [LegacyName("Aeries")] + public class Arietes41 : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Weapons.Ranged"; + public bool swapType = false; + public override void SetDefaults() + { + Item.width = 56; + Item.height = 30; + Item.scale = 0.85f; + Item.damage = 65; + Item.DamageType = DamageClass.Ranged; + Item.useTime = 13; + Item.useAnimation = 13; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 2.5f; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; + Item.rare = ItemRarityID.Yellow; + Item.UseSound = SoundID.Item41; + Item.autoReuse = true; + Item.shootSpeed = 13f; + Item.shoot = ProjectileID.PurificationPowder; + Item.useAmmo = AmmoID.Bullet; + Item.Calamity().canFirePointBlankShots = true; + } + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + { + float itemRotation = player.compositeFrontArm.rotation + MathHelper.PiOver2 * player.gravDir; + + Vector2 itemPosition = player.MountedCenter + itemRotation.ToRotationVector2() * 7f; + + // Shock bullet + if (!swapType) + { + for (int k = 0; k < 8; k++) + { + SparkParticle spark = new SparkParticle(itemPosition + velocity.RotatedBy(-0.6 * player.direction) + velocity * 0.65f, velocity.RotatedByRandom(0.25) * Main.rand.NextFloat(0.2f, 1.5f), false, Main.rand.Next(10, 15 + 1), Main.rand.NextFloat(0.2f, 0.35f), Color.Turquoise); + GeneralParticleHandler.SpawnParticle(spark); + } + Projectile shockShot = Projectile.NewProjectileDirect(source, itemPosition + velocity.RotatedBy(-0.6 * player.direction) + velocity * 1.65f, velocity, type, damage, knockback, player.whoAmI); + CalamityGlobalProjectile cgp = shockShot.Calamity(); + cgp.shockBullet = true; + } + // Life bullet + if (swapType) + { + for (int k = 0; k < 8; k++) + { + SparkParticle spark = new SparkParticle(itemPosition + velocity.RotatedBy(-0.6 * player.direction) + velocity * 0.65f, velocity.RotatedByRandom(0.25) * Main.rand.NextFloat(0.2f, 1.5f), false, Main.rand.Next(10, 15 + 1), Main.rand.NextFloat(0.2f, 0.35f), Color.White); + GeneralParticleHandler.SpawnParticle(spark); + } + Projectile lifeShot = Projectile.NewProjectileDirect(source, itemPosition + velocity.RotatedBy(-0.6 * player.direction) - velocity * 0.65f, velocity, type, damage, knockback, player.whoAmI); + CalamityGlobalProjectile cgp = lifeShot.Calamity(); + cgp.lifeBullet = true; + } + + swapType = !swapType; + return false; + } + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + player.ChangeDir(Math.Sign((player.Calamity().mouseWorld - player.Center).X)); + float itemRotation = player.compositeFrontArm.rotation + MathHelper.PiOver2 * player.gravDir; + + Vector2 itemPosition = player.MountedCenter + itemRotation.ToRotationVector2() * 7f; + Vector2 itemSize = new Vector2(56, 30); + Vector2 itemOrigin = new Vector2(-24, 3); + + CalamityUtils.CleanHoldStyle(player, itemRotation, itemPosition, itemSize, itemOrigin); + + base.UseStyle(player, heldItemFrame); + } + + public override void UseItemFrame(Player player) + { + player.ChangeDir(Math.Sign((player.Calamity().mouseWorld - player.Center).X)); + + 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 += -0.03f * (float)Math.Pow((0.6f - animProgress) / 0.6f, 2) * player.direction; + + player.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, rotation); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(). + AddIngredient(ItemID.ShroomiteBar, 3). + AddIngredient(ItemID.FallenStar, 3). // 41 Arietis is a triple star system + AddIngredient(). + AddTile(TileID.MythrilAnvil). + Register(); + } + } +} diff --git a/Items/Weapons/Ranged/Arietes41.png b/Items/Weapons/Ranged/Arietes41.png new file mode 100644 index 0000000000..b95d48dd5c Binary files /dev/null and b/Items/Weapons/Ranged/Arietes41.png differ diff --git a/Items/Weapons/Ranged/ArterialAssault.cs b/Items/Weapons/Ranged/ArterialAssault.cs index ee342f4866..9623518c5f 100644 --- a/Items/Weapons/Ranged/ArterialAssault.cs +++ b/Items/Weapons/Ranged/ArterialAssault.cs @@ -1,8 +1,8 @@ -using CalamityMod.Items.Materials; +using System; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles; using CalamityMod.Rarities; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -15,10 +15,10 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() { - Item.damage = 110; - Item.DamageType = DamageClass.Ranged; Item.width = 44; Item.height = 100; + Item.damage = 110; + Item.DamageType = DamageClass.Ranged; Item.useTime = 3; Item.useAnimation = 15; Item.reuseDelay = 10; @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 4.25f; - Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item102; Item.autoReuse = true; @@ -79,7 +79,6 @@ namespace CalamityMod.Items.Weapons.Ranged int shotArrow = Projectile.NewProjectile(source, realPlayerPos.X, realPlayerPos.Y, speedX4, speedY5, type, damage, knockback, player.whoAmI); Main.projectile[shotArrow].noDropItem = true; Main.projectile[shotArrow].tileCollide = false; - Main.projectile[shotArrow].timeLeft = (int)(Main.projectile[shotArrow].timeLeft * Main.projectile[shotArrow].MaxUpdates * 0.75f); CalamityGlobalProjectile cgp = Main.projectile[shotArrow].Calamity(); cgp.allProjectilesHome = true; return false; diff --git a/Items/Weapons/Ranged/AstralBlaster.cs b/Items/Weapons/Ranged/AstralBlaster.cs index 63bc77970e..72e9b8da2c 100644 --- a/Items/Weapons/Ranged/AstralBlaster.cs +++ b/Items/Weapons/Ranged/AstralBlaster.cs @@ -1,8 +1,8 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -13,16 +13,16 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() { - Item.damage = 120; - Item.DamageType = DamageClass.Ranged; Item.width = 40; Item.height = 24; + Item.damage = 120; + Item.DamageType = DamageClass.Ranged; Item.useTime = 15; Item.useAnimation = 15; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2.75f; - Item.value = CalamityGlobalItem.Rarity9BuyPrice; + Item.value = CalamityGlobalItem.RarityCyanBuyPrice; Item.rare = ItemRarityID.Cyan; Item.UseSound = SoundID.Item41; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/AstralRepeater.cs b/Items/Weapons/Ranged/AstralBow.cs similarity index 90% rename from Items/Weapons/Ranged/AstralRepeater.cs rename to Items/Weapons/Ranged/AstralBow.cs index 6f5f629f18..308327e530 100644 --- a/Items/Weapons/Ranged/AstralRepeater.cs +++ b/Items/Weapons/Ranged/AstralBow.cs @@ -5,15 +5,16 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Ranged { - public class AstralRepeater : ModItem, ILocalizedModType + [LegacyName("AstralRepeater")] + public class AstralBow : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() { - Item.damage = 92; - Item.DamageType = DamageClass.Ranged; Item.width = 38; Item.height = 78; + Item.damage = 92; + Item.DamageType = DamageClass.Ranged; Item.useTime = 6; Item.useAnimation = 18; Item.reuseDelay = 18; @@ -21,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2.5f; - Item.value = CalamityGlobalItem.Rarity9BuyPrice; + Item.value = CalamityGlobalItem.RarityCyanBuyPrice; Item.rare = ItemRarityID.Cyan; Item.UseSound = SoundID.Item5; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/AstralRepeater.png b/Items/Weapons/Ranged/AstralBow.png similarity index 100% rename from Items/Weapons/Ranged/AstralRepeater.png rename to Items/Weapons/Ranged/AstralBow.png diff --git a/Items/Weapons/Ranged/AstrealDefeat.cs b/Items/Weapons/Ranged/AstrealDefeat.cs index 62b59667dd..3231490127 100644 --- a/Items/Weapons/Ranged/AstrealDefeat.cs +++ b/Items/Weapons/Ranged/AstrealDefeat.cs @@ -1,8 +1,8 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -13,16 +13,16 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() { - Item.damage = 153; - Item.DamageType = DamageClass.Ranged; Item.width = 40; Item.height = 78; + Item.damage = 153; + Item.DamageType = DamageClass.Ranged; Item.useTime = 4; Item.useAnimation = 20; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5.5f; - Item.value = CalamityGlobalItem.Rarity11BuyPrice; + Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; Item.rare = ItemRarityID.Purple; Item.UseSound = SoundID.Item102; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/Auralis.cs b/Items/Weapons/Ranged/Auralis.cs index 217ca56100..b65b6d0d34 100644 --- a/Items/Weapons/Ranged/Auralis.cs +++ b/Items/Weapons/Ranged/Auralis.cs @@ -20,6 +20,8 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { + Item.width = 96; + Item.height = 34; Item.damage = 695; Item.DamageType = DamageClass.Ranged; Item.useTime = Item.useAnimation = 30; @@ -29,12 +31,10 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shootSpeed = 7.5f; Item.useAmmo = AmmoID.Bullet; - Item.width = 96; - Item.height = 34; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.UseSound = CommonCalamitySounds.PlasmaBlastSound; - Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; Item.Calamity().canFirePointBlankShots = true; @@ -59,6 +59,8 @@ namespace CalamityMod.Items.Weapons.Ranged public override Vector2? HoldoutOffset() => new Vector2(-10, 0); + public override void HoldItem(Player player) => player.scope = true; + public override bool CanConsumeAmmo(Item ammo, Player player) => Main.rand.Next(100) >= 50; public override void AddRecipes() @@ -67,7 +69,7 @@ namespace CalamityMod.Items.Weapons.Ranged AddIngredient(ItemID.SniperRifle). AddIngredient(5). AddIngredient(5). - AddIngredient(50). + AddIngredient(50). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Ranged/AuroraBlazer.cs b/Items/Weapons/Ranged/AuroraBlazer.cs index d647b2d5e4..5e3073cde9 100644 --- a/Items/Weapons/Ranged/AuroraBlazer.cs +++ b/Items/Weapons/Ranged/AuroraBlazer.cs @@ -1,8 +1,8 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Ranged; +using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -13,7 +13,9 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() { - Item.damage = 71; + Item.width = 68; + Item.height = 36; + Item.damage = 74; Item.DamageType = DamageClass.Ranged; Item.useTime = 5; Item.useAnimation = 30; @@ -24,12 +26,10 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useAmmo = AmmoID.Gel; Item.consumeAmmoOnFirstShotOnly = true; - Item.width = 68; - Item.height = 36; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.UseSound = SoundID.Item34; - Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; } diff --git a/Items/Weapons/Ranged/Barinade.cs b/Items/Weapons/Ranged/Barinade.cs index 73754654d7..d58ef12011 100644 --- a/Items/Weapons/Ranged/Barinade.cs +++ b/Items/Weapons/Ranged/Barinade.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Ranged; +using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -12,16 +12,16 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() { - Item.damage = 4; - Item.DamageType = DamageClass.Ranged; Item.width = 30; Item.height = 44; - Item.useTime = 22; - Item.useAnimation = 22; + Item.damage = 5; + Item.DamageType = DamageClass.Ranged; + Item.useTime = 24; + Item.useAnimation = 24; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2.2f; - Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; Item.UseSound = SoundID.Item5; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/Barinautical.cs b/Items/Weapons/Ranged/Barinautical.cs index b9fc2ea6c5..d258ec492c 100644 --- a/Items/Weapons/Ranged/Barinautical.cs +++ b/Items/Weapons/Ranged/Barinautical.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Ranged; +using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -12,10 +12,10 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() { - Item.damage = 32; - Item.DamageType = DamageClass.Ranged; Item.width = 30; Item.height = 42; + Item.damage = 32; + Item.DamageType = DamageClass.Ranged; Item.useTime = 4; Item.useAnimation = 12; Item.reuseDelay = 20; @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2f; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item5; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/BarracudaGun.cs b/Items/Weapons/Ranged/BarracudaGun.cs index 48deaa932e..72044deda0 100644 --- a/Items/Weapons/Ranged/BarracudaGun.cs +++ b/Items/Weapons/Ranged/BarracudaGun.cs @@ -1,9 +1,9 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -12,19 +12,23 @@ namespace CalamityMod.Items.Weapons.Ranged public class BarracudaGun : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; + public override void SetStaticDefaults() + { + ItemID.Sets.IsRangedSpecialistWeapon[Item.type] = true; + } public override void SetDefaults() { + Item.width = 54; + Item.height = 28; Item.damage = 56; Item.channel = true; Item.DamageType = DamageClass.Ranged; - Item.width = 54; - Item.height = 28; Item.useTime = 20; Item.useAnimation = 20; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 1f; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; Item.UseSound = SoundID.Item10; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/BladedgeGreatbow.cs b/Items/Weapons/Ranged/BladedgeGreatbow.cs deleted file mode 100644 index 3db7c451d2..0000000000 --- a/Items/Weapons/Ranged/BladedgeGreatbow.cs +++ /dev/null @@ -1,77 +0,0 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Ranged -{ - public class BladedgeGreatbow : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Weapons.Ranged"; - public override void SetDefaults() - { - Item.damage = 30; - Item.DamageType = DamageClass.Ranged; - Item.width = 74; - Item.height = 24; - Item.useTime = 29; - Item.useAnimation = 29; - Item.useStyle = ItemUseStyleID.Shoot; - Item.noMelee = true; - Item.knockBack = 3.5f; - Item.value = CalamityGlobalItem.Rarity7BuyPrice; - Item.rare = ItemRarityID.Lime; - Item.UseSound = SoundID.Item5; - Item.autoReuse = true; - Item.shoot = ProjectileID.PurificationPowder; - Item.shootSpeed = 14f; - Item.useAmmo = AmmoID.Arrow; - Item.Calamity().canFirePointBlankShots = true; - } - - public override Vector2? HoldoutOffset() - { - return new Vector2(-10, 0); - } - - 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 < 4; i++) - { - float SpeedX = velocity.X + (float)Main.rand.Next(-60, 61) * 0.05f; - float SpeedY = velocity.Y + (float)Main.rand.Next(-60, 61) * 0.05f; - int index = Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI); - Main.projectile[index].noDropItem = true; - } - Vector2 realPlayerPos = player.RotatedRelativePoint(player.MountedCenter, true); - float PiOver10 = MathHelper.Pi * 0.1f; - Vector2 arrowVel = velocity; - arrowVel.Normalize(); - arrowVel *= 10f; - bool arrowHitsTiles = Collision.CanHit(realPlayerPos, 0, 0, realPlayerPos + arrowVel, 0, 0); - for (int i = 0; i < 2; i++) - { - float arrowOffset = (float)i - 1f / 2f; - Vector2 offsetSpawn = arrowVel.RotatedBy((double)(PiOver10 * arrowOffset), default); - if (!arrowHitsTiles) - { - offsetSpawn -= arrowVel; - } - int projectile = Projectile.NewProjectile(source, realPlayerPos.X + offsetSpawn.X, realPlayerPos.Y + offsetSpawn.Y, velocity.X, velocity.Y, ProjectileID.Leaf, damage, 0f, player.whoAmI); - if (projectile.WithinBounds(Main.maxProjectiles)) - Main.projectile[projectile].DamageType = DamageClass.Ranged; - } - return false; - } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(12). - AddTile(TileID.MythrilAnvil). - Register(); - } - } -} diff --git a/Items/Weapons/Ranged/BladedgeRailbow.cs b/Items/Weapons/Ranged/BladedgeRailbow.cs new file mode 100644 index 0000000000..ebf3c143c0 --- /dev/null +++ b/Items/Weapons/Ranged/BladedgeRailbow.cs @@ -0,0 +1,174 @@ +using System.Collections.Generic; +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Ranged; +using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Ranged +{ + [LegacyName("BladedgeGreatbow")] + public class BladedgeRailbow : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Weapons.Ranged"; + + #region GFB Arrow Array + public int[] arrowArr = + { + ProjectileID.WoodenArrowFriendly, + ProjectileID.FireArrow, + ProjectileID.UnholyArrow, + ProjectileID.JestersArrow, + ProjectileID.HellfireArrow, + ProjectileID.HolyArrow, + ProjectileID.CursedArrow, + ProjectileID.FrostburnArrow, + ProjectileID.ChlorophyteArrow, + ProjectileID.IchorArrow, + ProjectileID.VenomArrow, + ProjectileID.BoneArrowFromMerchant, + ProjectileID.MoonlordArrow, + ProjectileID.ShimmerArrow, + ProjectileID.DD2BetsyArrow, + ProjectileID.BloodArrow, + ProjectileID.FairyQueenRangedItemShot, + ProjectileID.Hellwing, + ProjectileID.FrostArrow, + ProjectileID.BoneArrow, + ProjectileID.DD2PhoenixBowShot, + ProjectileID.PulseBolt, + ProjectileID.ShadowFlameArrow, + ProjectileID.BeeArrow, + ProjectileID.Stake, + + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), // Not ranged + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType() + }; + #endregion + + public override void SetDefaults() + { + Item.width = 74; + Item.height = 24; + Item.damage = 30; + Item.DamageType = DamageClass.Ranged; + Item.useTime = 29; + Item.useAnimation = 29; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 3.5f; + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; + Item.rare = ItemRarityID.Lime; + Item.UseSound = SoundID.Item5; + Item.autoReuse = true; + Item.shoot = ProjectileID.PurificationPowder; + Item.shootSpeed = 14f; + Item.useAmmo = AmmoID.Arrow; + Item.Calamity().canFirePointBlankShots = true; + } + + public override Vector2? HoldoutOffset() + { + return new Vector2(-10, 0); + } + + 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 < 4; i++) + { + float SpeedX = velocity.X + (float)Main.rand.Next(-60, 61) * 0.05f; + float SpeedY = velocity.Y + (float)Main.rand.Next(-60, 61) * 0.05f; + int index = Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI); + Main.projectile[index].noDropItem = true; + } + Vector2 realPlayerPos = player.RotatedRelativePoint(player.MountedCenter, true); + float PiOver10 = MathHelper.Pi * 0.1f; + Vector2 arrowVel = velocity; + arrowVel.Normalize(); + arrowVel *= 10f; + bool arrowHitsTiles = Collision.CanHit(realPlayerPos, 0, 0, realPlayerPos + arrowVel, 0, 0); + + int numArrows = Main.zenithWorld ? 4 : 2; + for (int i = 0; i < numArrows; i++) + { + float arrowOffset = (float)i - 1f / 2f; + Vector2 offsetSpawn = arrowVel.RotatedBy((double)(PiOver10 * arrowOffset), default); + if (!arrowHitsTiles) + { + offsetSpawn -= arrowVel; + } + + int projType; + if (Main.zenithWorld) + projType = arrowArr[Main.rand.Next(0, arrowArr.Length)]; + else + projType = ProjectileID.Leaf; + + int projectile = Projectile.NewProjectile(source, realPlayerPos.X + offsetSpawn.X, realPlayerPos.Y + offsetSpawn.Y, velocity.X, velocity.Y, projType, damage, 0f, player.whoAmI); + // Now for the special conditions to fix stuff... + if (projectile.WithinBounds(Main.maxProjectiles) && (projType == ProjectileID.Leaf || projType == ModContent.ProjectileType())) + Main.projectile[projectile].DamageType = DamageClass.Ranged; + if (projType == ModContent.ProjectileType() || projType == ModContent.ProjectileType() || projType == ModContent.ProjectileType()) + Main.projectile[projectile].velocity /= 2; + } + return false; + } + + public override void ModifyTooltips(List tooltips) + { + string tooltip = Main.zenithWorld ? this.GetLocalizedValue("TooltipGFB") : this.GetLocalizedValue("TooltipNormal"); + tooltips.FindAndReplace("[GFB]", tooltip); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(12). + AddTile(TileID.MythrilAnvil). + Register(); + } + } +} diff --git a/Items/Weapons/Ranged/BladedgeGreatbow.png b/Items/Weapons/Ranged/BladedgeRailbow.png similarity index 100% rename from Items/Weapons/Ranged/BladedgeGreatbow.png rename to Items/Weapons/Ranged/BladedgeRailbow.png diff --git a/Items/Weapons/Ranged/BlightSpewer.cs b/Items/Weapons/Ranged/BlightSpewer.cs index 472d0d2b02..50e3df7a73 100644 --- a/Items/Weapons/Ranged/BlightSpewer.cs +++ b/Items/Weapons/Ranged/BlightSpewer.cs @@ -15,17 +15,17 @@ namespace CalamityMod.Items.Weapons.Ranged public static readonly SoundStyle Nanomachines = new("CalamityMod/Sounds/Item/NanoSwarm") { PitchVariance = 0.45f, Volume = 0.4f }; public override void SetDefaults() { - Item.damage = 52; - Item.DamageType = DamageClass.Ranged; Item.width = 76; Item.height = 36; + Item.damage = 52; + Item.DamageType = DamageClass.Ranged; Item.useTime = 19; Item.useAnimation = 19; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 1.5f; Item.UseSound = SoundID.Item34; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Ranged/BlissfulBombardier.cs b/Items/Weapons/Ranged/BlissfulBombardier.cs index 1351bf6e8a..150dc202ea 100644 --- a/Items/Weapons/Ranged/BlissfulBombardier.cs +++ b/Items/Weapons/Ranged/BlissfulBombardier.cs @@ -13,16 +13,16 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() { - Item.damage = 84; - Item.DamageType = DamageClass.Ranged; Item.width = 76; Item.height = 30; + Item.damage = 93; + Item.DamageType = DamageClass.Ranged; Item.useTime = 15; Item.useAnimation = 15; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 7.5f; - Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item11; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/BloodBoiler.cs b/Items/Weapons/Ranged/BloodBoiler.cs index 3764bf9fc5..29e9f63f78 100644 --- a/Items/Weapons/Ranged/BloodBoiler.cs +++ b/Items/Weapons/Ranged/BloodBoiler.cs @@ -13,16 +13,21 @@ namespace CalamityMod.Items.Weapons.Ranged public class BloodBoiler : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; - + public static readonly SoundStyle Heartbeat = new("CalamityMod/Sounds/Item/Heartbeat") { PitchVariance = 0.2f, Volume = 0.55f }; - + public bool shotReturn = false; + + public override void SetStaticDefaults() + { + ItemID.Sets.IsRangedSpecialistWeapon[Item.type] = true; + } public override void SetDefaults() { - Item.damage = 115; - Item.DamageType = DamageClass.Ranged; Item.width = 60; Item.height = 30; + Item.damage = 115; + Item.DamageType = DamageClass.Ranged; Item.useTime = 5; Item.useAnimation = 25; Item.autoReuse = true; @@ -30,7 +35,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 4f; - Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); Item.shootSpeed = 9.5f; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Ranged/BlossomFlux.cs b/Items/Weapons/Ranged/BlossomFlux.cs index ff46680d95..b17ee348e4 100644 --- a/Items/Weapons/Ranged/BlossomFlux.cs +++ b/Items/Weapons/Ranged/BlossomFlux.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Ranged; +using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -12,15 +12,15 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetStaticDefaults() { - ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; + ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; } public override void SetDefaults() { - Item.damage = 20; - Item.DamageType = DamageClass.Ranged; Item.width = 38; Item.height = 68; + Item.damage = 20; + Item.DamageType = DamageClass.Ranged; Item.useTime = 4; Item.useAnimation = 16; Item.useStyle = ItemUseStyleID.Shoot; @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shootSpeed = 10f; Item.useAmmo = AmmoID.Arrow; - Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; Item.Calamity().canFirePointBlankShots = true; } diff --git a/Items/Weapons/Ranged/BrimstoneFury.cs b/Items/Weapons/Ranged/BrimstoneFury.cs index 606896ea3b..634cb0cef9 100644 --- a/Items/Weapons/Ranged/BrimstoneFury.cs +++ b/Items/Weapons/Ranged/BrimstoneFury.cs @@ -1,8 +1,8 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -13,16 +13,16 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() { - Item.damage = 25; - Item.DamageType = DamageClass.Ranged; Item.width = 30; Item.height = 58; + Item.damage = 21; + Item.DamageType = DamageClass.Ranged; Item.useTime = 22; Item.useAnimation = 22; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3.75f; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item5; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/BulletFilledShotgun.cs b/Items/Weapons/Ranged/BulletFilledShotgun.cs index f45b279db5..a985c94a1d 100644 --- a/Items/Weapons/Ranged/BulletFilledShotgun.cs +++ b/Items/Weapons/Ranged/BulletFilledShotgun.cs @@ -1,8 +1,8 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -13,12 +13,14 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetStaticDefaults() { - } + } public override void SetDefaults() { + Item.width = 64; + Item.height = 24; Item.damage = 1; Item.knockBack = 0f; - Item.useTime = Item.useAnimation = 45; + Item.useTime = Item.useAnimation = 75; Item.DamageType = DamageClass.Ranged; Item.noMelee = true; Item.autoReuse = true; @@ -26,11 +28,9 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shootSpeed = 9f; Item.shoot = ModContent.ProjectileType(); - Item.width = 64; - Item.height = 24; Item.useStyle = ItemUseStyleID.Shoot; Item.UseSound = SoundID.Item38; - Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; Item.Calamity().donorItem = true; Item.Calamity().canFirePointBlankShots = true; @@ -46,7 +46,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { type = Item.shoot; - int bulletAmt = Main.rand.Next(25,35); + int bulletAmt = 30; for (int i = 0; i < bulletAmt; i++) { float newSpeedX = velocity.X + Main.rand.NextFloat(-15f, 15f); diff --git a/Items/Weapons/Ranged/Butcher.cs b/Items/Weapons/Ranged/Butcher.cs index 0f055a1409..48ec12ad69 100644 --- a/Items/Weapons/Ranged/Butcher.cs +++ b/Items/Weapons/Ranged/Butcher.cs @@ -1,8 +1,8 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -13,14 +13,14 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() { - Item.damage = 15; Item.width = 20; Item.height = 12; + Item.damage = 15; Item.useTime = 40; Item.useAnimation = 40; Item.useStyle = ItemUseStyleID.Shoot; Item.knockBack = 1f; - Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; Item.UseSound = SoundID.Item38; Item.noMelee = true; @@ -44,7 +44,7 @@ namespace CalamityMod.Items.Weapons.Ranged Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 0f); return false; } - + public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Weapons/Ranged/ChickenCannon.cs b/Items/Weapons/Ranged/ChickenCannon.cs index d87044c85b..889f57a40e 100644 --- a/Items/Weapons/Ranged/ChickenCannon.cs +++ b/Items/Weapons/Ranged/ChickenCannon.cs @@ -14,15 +14,15 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() { - Item.damage = 290; - Item.DamageType = DamageClass.Ranged; Item.width = 126; Item.height = 42; + Item.damage = 290; + Item.DamageType = DamageClass.Ranged; Item.useTime = Item.useAnimation = 33; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 1.5f; - Item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.rare = ModContent.RarityType(); // No use sound is intentional Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/ClamorRifle.cs b/Items/Weapons/Ranged/ClamorRifle.cs index eafe2282ee..b51d12896b 100644 --- a/Items/Weapons/Ranged/ClamorRifle.cs +++ b/Items/Weapons/Ranged/ClamorRifle.cs @@ -1,10 +1,10 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Ranged; +using CalamityMod.Projectiles.Ranged; +using CalamityMod.Sounds; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Sounds; namespace CalamityMod.Items.Weapons.Ranged { @@ -13,16 +13,16 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() { - Item.damage = 36; - Item.DamageType = DamageClass.Ranged; Item.width = 64; Item.height = 30; + Item.damage = 36; + Item.DamageType = DamageClass.Ranged; Item.useTime = 15; Item.useAnimation = 15; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2.5f; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.UseSound = CommonCalamitySounds.PlasmaBoltSound; Item.autoReuse = true; Item.rare = ItemRarityID.Pink; diff --git a/Items/Weapons/Ranged/ClaretCannon.cs b/Items/Weapons/Ranged/ClaretCannon.cs index e1f8ea16e4..70569df399 100644 --- a/Items/Weapons/Ranged/ClaretCannon.cs +++ b/Items/Weapons/Ranged/ClaretCannon.cs @@ -14,10 +14,10 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() { - Item.damage = 140; - Item.DamageType = DamageClass.Ranged; Item.width = 48; Item.height = 30; + Item.damage = 140; + Item.DamageType = DamageClass.Ranged; Item.useTime = 3; Item.useAnimation = 9; Item.reuseDelay = 10; @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5.5f; - Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item40; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/CleansingBlaze.cs b/Items/Weapons/Ranged/CleansingBlaze.cs index c63bc6e7df..52b3cd1dfd 100644 --- a/Items/Weapons/Ranged/CleansingBlaze.cs +++ b/Items/Weapons/Ranged/CleansingBlaze.cs @@ -16,10 +16,10 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() { - Item.damage = 290; - Item.DamageType = DamageClass.Ranged; Item.width = 108; Item.height = 38; + Item.damage = 290; + Item.DamageType = DamageClass.Ranged; Item.useTime = 3; Item.useAnimation = 24; Item.useStyle = ItemUseStyleID.Shoot; diff --git a/Items/Weapons/Ranged/ClockGatlignum.cs b/Items/Weapons/Ranged/ClockGatlignum.cs index 065f0b734f..47e81821e0 100644 --- a/Items/Weapons/Ranged/ClockGatlignum.cs +++ b/Items/Weapons/Ranged/ClockGatlignum.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -12,10 +12,10 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() { - Item.damage = 55; - Item.DamageType = DamageClass.Ranged; Item.width = 66; Item.height = 34; + Item.damage = 55; + Item.DamageType = DamageClass.Ranged; Item.useTime = 3; Item.useAnimation = 9; Item.reuseDelay = 12; @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3.75f; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; Item.UseSound = SoundID.Item31; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/ClockworkBow.cs b/Items/Weapons/Ranged/ClockworkBow.cs index edac6e03d2..64b5d58268 100644 --- a/Items/Weapons/Ranged/ClockworkBow.cs +++ b/Items/Weapons/Ranged/ClockworkBow.cs @@ -1,9 +1,9 @@ -using Terraria.DataStructures; +using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Projectiles.Ranged; namespace CalamityMod.Items.Weapons.Ranged { @@ -13,17 +13,17 @@ namespace CalamityMod.Items.Weapons.Ranged public const int MaxBolts = 6; public override void SetDefaults() { - Item.damage = 770; - Item.DamageType = DamageClass.Ranged; Item.width = 48; Item.height = 96; + Item.damage = 770; + Item.DamageType = DamageClass.Ranged; Item.useTime = Item.useAnimation = 30; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.channel = true; Item.knockBack = 4.25f; - Item.value = CalamityGlobalItem.Rarity10BuyPrice; - Item.rare = ItemRarityID.Red; + Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; + Item.rare = ItemRarityID.Purple; Item.noUseGraphic = true; Item.UseSound = SoundID.Item20; Item.autoReuse = true; @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Ranged } public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; - + // Spawning the holdout cannot consume ammo public override bool CanConsumeAmmo(Item ammo, Player player) => player.ownedProjectileCounts[Item.shoot] > 0; @@ -45,7 +45,7 @@ namespace CalamityMod.Items.Weapons.Ranged Projectile.NewProjectile(source, position, shootDirection, ModContent.ProjectileType(), damage, knockback, player.whoAmI); return false; } - + public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Weapons/Ranged/Condemnation.cs b/Items/Weapons/Ranged/Condemnation.cs index b3e2829a8d..9f80655ae3 100644 --- a/Items/Weapons/Ranged/Condemnation.cs +++ b/Items/Weapons/Ranged/Condemnation.cs @@ -20,10 +20,10 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - Item.damage = 2130; - Item.DamageType = DamageClass.Ranged; Item.width = 130; Item.height = 42; + Item.damage = 2130; + Item.DamageType = DamageClass.Ranged; Item.useTime = Item.useAnimation = 22; Item.useStyle = ItemUseStyleID.Shoot; Item.channel = true; diff --git a/Items/Weapons/Ranged/ConferenceCall.cs b/Items/Weapons/Ranged/ConferenceCall.cs index 87052ebb5e..9c9fa464e9 100644 --- a/Items/Weapons/Ranged/ConferenceCall.cs +++ b/Items/Weapons/Ranged/ConferenceCall.cs @@ -12,17 +12,17 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() { - Item.damage = 36; - Item.DamageType = DamageClass.Ranged; Item.width = 66; Item.height = 26; - Item.useTime = 32; - Item.useAnimation = 32; + Item.damage = 53; + Item.DamageType = DamageClass.Ranged; + Item.useTime = 42; + Item.useAnimation = 42; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 4.5f; - Item.value = CalamityGlobalItem.Rarity9BuyPrice; - Item.rare = ItemRarityID.Cyan; + Item.value = CalamityGlobalItem.RarityRedBuyPrice; + Item.rare = ItemRarityID.Red; Item.UseSound = SoundID.Item38; Item.autoReuse = true; Item.shootSpeed = 12f; @@ -54,7 +54,7 @@ namespace CalamityMod.Items.Weapons.Ranged Main.projectile[proj].extraUpdates += 2; } - int maxTargets = 12; + int maxTargets = 7; int[] targets = new int[maxTargets]; int targetArrayIndex = 0; Rectangle rectangle = new Rectangle((int)player.Center.X - 960, (int)player.Center.Y - 540, 1920, 1080); @@ -88,10 +88,10 @@ namespace CalamityMod.Items.Weapons.Ranged targetPosition.X = (targetPosition.X + player.Center.X) / 2f + Main.rand.Next(-200, 201); targetPosition.Y -= 100 * j; - Vector2 extraBulletVel = CalamityUtils.CalculatePredictiveAimToTarget(targetPosition, Main.npc[targets[j]], Item.shootSpeed); + Vector2 extraBulletVel = Vector2.Normalize(Main.npc[targets[j]].Center - targetPosition) * Item.shootSpeed; int proj = Projectile.NewProjectile(source, targetPosition, extraBulletVel, type, extraBulletDamage, knockback, player.whoAmI); - Main.projectile[proj].extraUpdates += 2; + Main.projectile[proj].extraUpdates += 14; Main.projectile[proj].tileCollide = false; Main.projectile[proj].timeLeft /= 2; } @@ -111,7 +111,7 @@ namespace CalamityMod.Items.Weapons.Ranged Vector2 extraBulletVel = Vector2.Normalize(Main.npc[targets[randomTarget]].Center - targetPosition) * Item.shootSpeed; int proj = Projectile.NewProjectile(source, targetPosition, extraBulletVel, type, extraBulletDamage, knockback, player.whoAmI); - Main.projectile[proj].extraUpdates += 2; + Main.projectile[proj].extraUpdates += 14; Main.projectile[proj].tileCollide = false; Main.projectile[proj].timeLeft /= 2; } diff --git a/Items/Weapons/Ranged/Contagion.cs b/Items/Weapons/Ranged/Contagion.cs index 67f88c3bda..f8fe958161 100644 --- a/Items/Weapons/Ranged/Contagion.cs +++ b/Items/Weapons/Ranged/Contagion.cs @@ -15,10 +15,10 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() { - Item.damage = 880; - Item.DamageType = DamageClass.Ranged; Item.width = 22; Item.height = 50; + Item.damage = 880; + Item.DamageType = DamageClass.Ranged; Item.useTime = 20; Item.useAnimation = 20; Item.useStyle = ItemUseStyleID.Shoot; @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shootSpeed = 20f; Item.useAmmo = AmmoID.Arrow; - Item.value = CalamityGlobalItem.Rarity16BuyPrice; + Item.value = CalamityGlobalItem.RarityHotPinkBuyPrice; Item.rare = ModContent.RarityType(); Item.Calamity().devItem = true; Item.Calamity().canFirePointBlankShots = true; diff --git a/Items/Weapons/Ranged/ContinentalGreatbow.cs b/Items/Weapons/Ranged/ContinentalGreatbow.cs index 77f85f7128..6e63b9f837 100644 --- a/Items/Weapons/Ranged/ContinentalGreatbow.cs +++ b/Items/Weapons/Ranged/ContinentalGreatbow.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -13,16 +13,16 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() { - Item.damage = 34; - Item.DamageType = DamageClass.Ranged; Item.width = 18; Item.height = 36; + Item.damage = 34; + Item.DamageType = DamageClass.Ranged; Item.useTime = 24; Item.useAnimation = 24; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 4f; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; Item.UseSound = SoundID.Item5; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/CoralCannon.cs b/Items/Weapons/Ranged/CoralCannon.cs index de44fd2e05..6e97debf19 100644 --- a/Items/Weapons/Ranged/CoralCannon.cs +++ b/Items/Weapons/Ranged/CoralCannon.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Ranged; +using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -10,18 +10,23 @@ namespace CalamityMod.Items.Weapons.Ranged public class CoralCannon : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; + + public override void SetStaticDefaults() + { + ItemID.Sets.IsRangedSpecialistWeapon[Item.type] = true; + } public override void SetDefaults() { - Item.damage = 24; - Item.DamageType = DamageClass.Ranged; Item.width = 52; Item.height = 40; + Item.damage = 24; + Item.DamageType = DamageClass.Ranged; Item.useTime = 20; Item.useAnimation = 20; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 7.5f; - Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; Item.UseSound = SoundID.Item61; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/CorinthPrime.cs b/Items/Weapons/Ranged/CorinthPrime.cs index 0ebd4296b6..0ddd616eda 100644 --- a/Items/Weapons/Ranged/CorinthPrime.cs +++ b/Items/Weapons/Ranged/CorinthPrime.cs @@ -19,16 +19,16 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - Item.damage = 140; - Item.DamageType = DamageClass.Ranged; Item.width = 106; Item.height = 42; + Item.damage = 140; + Item.DamageType = DamageClass.Ranged; Item.useTime = 30; Item.useAnimation = 30; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 8f; - Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; Item.UseSound = SoundID.Item38; diff --git a/Items/Weapons/Ranged/CorrodedCaustibow.cs b/Items/Weapons/Ranged/CorrodedCaustibow.cs index 3f551db255..2413651e0e 100644 --- a/Items/Weapons/Ranged/CorrodedCaustibow.cs +++ b/Items/Weapons/Ranged/CorrodedCaustibow.cs @@ -1,8 +1,8 @@ -using Terraria.DataStructures; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; -using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -13,16 +13,16 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() { - Item.damage = 75; - Item.DamageType = DamageClass.Ranged; Item.width = 30; Item.height = 38; + Item.damage = 75; + Item.DamageType = DamageClass.Ranged; Item.useTime = 45; Item.useAnimation = 45; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 6f; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item5; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/CosmicBolter.png b/Items/Weapons/Ranged/CosmicBolter.png deleted file mode 100644 index 87db9b0226..0000000000 Binary files a/Items/Weapons/Ranged/CosmicBolter.png and /dev/null differ diff --git a/Items/Weapons/Ranged/CrackshotColt.cs b/Items/Weapons/Ranged/CrackshotColt.cs index 6134480b24..964b561572 100644 --- a/Items/Weapons/Ranged/CrackshotColt.cs +++ b/Items/Weapons/Ranged/CrackshotColt.cs @@ -17,16 +17,16 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - Item.damage = 18; - Item.DamageType = DamageClass.Ranged; Item.width = 23; Item.height = 8; + Item.damage = 18; + Item.DamageType = DamageClass.Ranged; Item.useTime = 35; Item.useAnimation = 35; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2.25f; - Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.rare = ItemRarityID.Blue; Item.UseSound = ShootSound; Item.autoReuse = true; @@ -53,12 +53,10 @@ namespace CalamityMod.Items.Weapons.Ranged if (player.altFunctionUse == 2) { // player.CanBuyItem() breaks if the player has more than 2,147 platinum coins and was never fixed - // This alternative method works no matter how much money the player has - long cashAvailable = Utils.CoinsCount(out bool overflow, player.inventory); - if (cashAvailable < 1 && !overflow) - return false; - - return player.GetActiveRicoshotCoinCount() < 4; + // 20APR2024: Ozzatron: The method was instead replaced with player.CanAfford, which is immune to overflow + // Additionally, CanAfford checks your Piggy Bank, Safe, etc., meaning Crackshot Colt can use coins from there + bool hasAtLeastOneCopper = player.CanAfford(1); + return hasAtLeastOneCopper && player.GetActiveRicoshotCoinCount() < 4; } return true; } diff --git a/Items/Weapons/Ranged/CursedCapper.cs b/Items/Weapons/Ranged/CursedCapper.cs deleted file mode 100644 index 53635070a7..0000000000 --- a/Items/Weapons/Ranged/CursedCapper.cs +++ /dev/null @@ -1,48 +0,0 @@ -using Terraria.DataStructures; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Ranged -{ - public class CursedCapper : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Weapons.Ranged"; - public override void SetDefaults() - { - Item.damage = 31; - Item.DamageType = DamageClass.Ranged; - Item.width = 52; - Item.height = 32; - Item.useTime = 10; - Item.useAnimation = 10; - Item.useStyle = ItemUseStyleID.Shoot; - Item.noMelee = true; - Item.knockBack = 2.25f; - Item.value = CalamityGlobalItem.Rarity4BuyPrice; - Item.rare = ItemRarityID.LightRed; - Item.UseSound = SoundID.Item41; - Item.autoReuse = true; - Item.shootSpeed = 14f; - Item.shoot = ProjectileID.CursedBullet; - Item.useAmmo = AmmoID.Bullet; - 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.X, position.Y, velocity.X, velocity.Y, ProjectileID.CursedBullet, damage, knockback, player.whoAmI, 0f, 0f); - return false; - } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(ItemID.PhoenixBlaster). - AddIngredient(ItemID.CursedFlame, 10). - AddTile(TileID.Anvils). - Register(); - } - } -} diff --git a/Items/Weapons/Ranged/CursedCapper.png b/Items/Weapons/Ranged/CursedCapper.png deleted file mode 100644 index ce5af668df..0000000000 Binary files a/Items/Weapons/Ranged/CursedCapper.png and /dev/null differ diff --git a/Items/Weapons/Ranged/DaemonsFlame.cs b/Items/Weapons/Ranged/DaemonsFlame.cs index 854416737d..7fa53c9b10 100644 --- a/Items/Weapons/Ranged/DaemonsFlame.cs +++ b/Items/Weapons/Ranged/DaemonsFlame.cs @@ -14,9 +14,9 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() { - Item.damage = 150; Item.width = 62; Item.height = 128; + Item.damage = 150; Item.useTime = 12; Item.useAnimation = 12; Item.useStyle = ItemUseStyleID.Shoot; @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shootSpeed = 20f; Item.useAmmo = AmmoID.Arrow; - Item.value = CalamityGlobalItem.Rarity13BuyPrice; + Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; Item.rare = ModContent.RarityType(); Item.Calamity().canFirePointBlankShots = true; } diff --git a/Items/Weapons/Ranged/DarkechoGreatbow.cs b/Items/Weapons/Ranged/DarkechoGreatbow.cs index 6b0669c8c0..960908d2c8 100644 --- a/Items/Weapons/Ranged/DarkechoGreatbow.cs +++ b/Items/Weapons/Ranged/DarkechoGreatbow.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -12,16 +12,16 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() { - Item.damage = 45; - Item.DamageType = DamageClass.Ranged; Item.width = 34; Item.height = 62; + Item.damage = 45; + Item.DamageType = DamageClass.Ranged; Item.useTime = 33; Item.useAnimation = 33; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 4; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item5; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/DeadSunsWind.cs b/Items/Weapons/Ranged/DeadSunsWind.cs index 89296548fd..8e81c00b99 100644 --- a/Items/Weapons/Ranged/DeadSunsWind.cs +++ b/Items/Weapons/Ranged/DeadSunsWind.cs @@ -13,22 +13,22 @@ namespace CalamityMod.Items.Weapons.Ranged { public new string LocalizationCategory => "Items.Weapons.Ranged"; - public static readonly SoundStyle Shoot = new("CalamityMod/Sounds/Item/DeadSunShot") { PitchVariance = 0.35f, Volume = 0.4f }; + public static readonly SoundStyle ShootSound = new("CalamityMod/Sounds/Item/DeadSunShot") { PitchVariance = 0.35f, Volume = 0.4f }; public static readonly SoundStyle Ricochet = new("CalamityMod/Sounds/Item/DeadSunRicochet") { Volume = 0.35f }; public static readonly SoundStyle Explosion = new("CalamityMod/Sounds/Item/DeadSunExplosion") { Volume = 0.5f }; public override void SetDefaults() { - Item.damage = 100; - Item.DamageType = DamageClass.Ranged; Item.width = 70; Item.height = 24; + Item.damage = 100; + Item.DamageType = DamageClass.Ranged; Item.useTime = Item.useAnimation = 22; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3.5f; - Item.UseSound = Shoot; - Item.value = CalamityGlobalItem.Rarity9BuyPrice; - Item.rare = ItemRarityID.Cyan; + Item.UseSound = ShootSound; + Item.value = CalamityGlobalItem.RarityRedBuyPrice; + Item.rare = ItemRarityID.Red; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 9f; diff --git a/Items/Weapons/Ranged/Deathwind.cs b/Items/Weapons/Ranged/Deathwind.cs index 9b38ae885c..81cf35ba6d 100644 --- a/Items/Weapons/Ranged/Deathwind.cs +++ b/Items/Weapons/Ranged/Deathwind.cs @@ -14,16 +14,16 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() { - Item.damage = 248; - Item.DamageType = DamageClass.Ranged; Item.width = 40; Item.height = 82; + Item.damage = 148; + Item.DamageType = DamageClass.Ranged; Item.useTime = 14; Item.useAnimation = 14; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5f; - Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item5; Item.autoReuse = true; @@ -46,11 +46,11 @@ namespace CalamityMod.Items.Weapons.Ranged float SpeedY = velocity.Y + Main.rand.Next(-20, 21) * 0.05f; if (CalamityUtils.CheckWoodenAmmo(type, player)) { - Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), (int)(damage * 1.75), knockback, player.whoAmI); } else { - int baseArrow = Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, (int)(damage * 0.8), knockback, player.whoAmI); + int baseArrow = Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, (int)(damage * 0.75), knockback, player.whoAmI); Main.projectile[baseArrow].noDropItem = true; } } diff --git a/Items/Weapons/Ranged/DeepcoreGK2.cs b/Items/Weapons/Ranged/DeepcoreGK2.cs index 5057d9dc03..b1f059e43b 100644 --- a/Items/Weapons/Ranged/DeepcoreGK2.cs +++ b/Items/Weapons/Ranged/DeepcoreGK2.cs @@ -1,6 +1,6 @@ -using Terraria.DataStructures; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -12,16 +12,16 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - Item.damage = 45; - Item.ArmorPenetration = 15; - Item.DamageType = DamageClass.Ranged; - Item.noMelee = true; Item.width = 142; Item.height = 64; + Item.damage = 41; + Item.ArmorPenetration = 10; + Item.DamageType = DamageClass.Ranged; + Item.noMelee = true; Item.useTime = Item.useAnimation = 14; Item.useStyle = ItemUseStyleID.Shoot; Item.knockBack = 7f; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item38; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/Disseminator.cs b/Items/Weapons/Ranged/Disseminator.cs index d96ddb02bd..2583ef4355 100644 --- a/Items/Weapons/Ranged/Disseminator.cs +++ b/Items/Weapons/Ranged/Disseminator.cs @@ -1,6 +1,6 @@ -using Terraria.DataStructures; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -12,17 +12,17 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() { - Item.damage = 48; - Item.DamageType = DamageClass.Ranged; Item.width = 66; Item.height = 24; + Item.damage = 58; + Item.DamageType = DamageClass.Ranged; Item.useTime = 35; Item.useAnimation = 35; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 4.5f; - Item.value = CalamityGlobalItem.Rarity10BuyPrice; - Item.rare = ItemRarityID.Red; + Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; + Item.rare = ItemRarityID.Purple; Item.UseSound = SoundID.Item38; Item.autoReuse = true; Item.shootSpeed = 13f; @@ -54,7 +54,7 @@ namespace CalamityMod.Items.Weapons.Ranged Main.projectile[proj].extraUpdates += 2; } - int maxTargets = 8; + int maxTargets = 7; int[] targets = new int[maxTargets]; int targetArrayIndex = 0; Rectangle rectangle = new Rectangle((int)player.Center.X - 960, (int)player.Center.Y - 540, 1920, 1080); @@ -91,7 +91,7 @@ namespace CalamityMod.Items.Weapons.Ranged Vector2 extraBulletVel = Vector2.Normalize(Main.npc[targets[j]].Center - targetPosition) * Item.shootSpeed; int proj = Projectile.NewProjectile(source, targetPosition, extraBulletVel, type, extraBulletDamage, knockback, player.whoAmI); - Main.projectile[proj].extraUpdates += 2; + Main.projectile[proj].extraUpdates += 14; Main.projectile[proj].tileCollide = false; Main.projectile[proj].timeLeft /= 2; @@ -102,7 +102,7 @@ namespace CalamityMod.Items.Weapons.Ranged extraBulletVel = Vector2.Normalize(Main.npc[targets[j]].Center - targetPosition) * Item.shootSpeed; proj = Projectile.NewProjectile(source, targetPosition, extraBulletVel, type, extraBulletDamage, knockback, player.whoAmI); - Main.projectile[proj].extraUpdates += 2; + Main.projectile[proj].extraUpdates += 14; Main.projectile[proj].tileCollide = false; Main.projectile[proj].timeLeft /= 2; } @@ -122,7 +122,7 @@ namespace CalamityMod.Items.Weapons.Ranged Vector2 extraBulletVel = Vector2.Normalize(Main.npc[targets[randomTarget]].Center - targetPosition) * Item.shootSpeed; int proj = Projectile.NewProjectile(source, targetPosition, extraBulletVel, type, extraBulletDamage, knockback, player.whoAmI); - Main.projectile[proj].extraUpdates += 2; + Main.projectile[proj].extraUpdates += 14; Main.projectile[proj].tileCollide = false; Main.projectile[proj].timeLeft /= 2; @@ -133,7 +133,7 @@ namespace CalamityMod.Items.Weapons.Ranged extraBulletVel = Vector2.Normalize(Main.npc[targets[randomTarget]].Center - targetPosition) * Item.shootSpeed; proj = Projectile.NewProjectile(source, targetPosition, extraBulletVel, type, extraBulletDamage, knockback, player.whoAmI); - Main.projectile[proj].extraUpdates += 2; + Main.projectile[proj].extraUpdates += 14; Main.projectile[proj].tileCollide = false; Main.projectile[proj].timeLeft /= 2; } diff --git a/Items/Weapons/Ranged/DodusHandcannon.cs b/Items/Weapons/Ranged/DodusHandcannon.cs index 103e91d86f..6751d3d00a 100644 --- a/Items/Weapons/Ranged/DodusHandcannon.cs +++ b/Items/Weapons/Ranged/DodusHandcannon.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shootSpeed = 13f; Item.useAmmo = AmmoID.Bullet; - Item.value = CalamityGlobalItem.Rarity13BuyPrice; + Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; Item.Calamity().canFirePointBlankShots = true; @@ -48,7 +48,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { CreateRecipe(). - AddIngredient(). + AddIngredient(). AddIngredient(5). AddIngredient(ItemID.LunarBar, 15). AddTile(TileID.LunarCraftingStation). diff --git a/Items/Weapons/Ranged/DragonsBreath.cs b/Items/Weapons/Ranged/DragonsBreath.cs index 028a6fde7f..ec7d6f4b76 100644 --- a/Items/Weapons/Ranged/DragonsBreath.cs +++ b/Items/Weapons/Ranged/DragonsBreath.cs @@ -14,8 +14,9 @@ namespace CalamityMod.Items.Weapons.Ranged public class DragonsBreath : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; - + public static readonly SoundStyle FireballSound = new("CalamityMod/Sounds/Custom/Yharon/YharonFireball", 3) { PitchVariance = 0.3f, Volume = 0.75f }; + public static readonly SoundStyle WeldingStart = new("CalamityMod/Sounds/Item/DragonsBreathStrongStart") { Volume = 1.75f }; public static readonly SoundStyle WeldingBurn = new("CalamityMod/Sounds/Item/WeldingBurn") { Volume = 0.65f }; public static readonly SoundStyle WeldingShoot = new("CalamityMod/Sounds/Item/WeldingShoot") { Volume = 0.45f }; @@ -28,13 +29,14 @@ namespace CalamityMod.Items.Weapons.Ranged public bool StrongShotMode = false; public int DragonsBreathSetUseTime = 5; public int DragonsBreathSetUseAnimation = 9; + private Player Owner; public override void SetDefaults() { + Item.width = 124; + Item.height = 72; Item.damage = 478; Item.DamageType = DamageClass.Ranged; - Item.width = 94; - Item.height = 72; Item.useTime = DragonsBreathSetUseTime; Item.useAnimation = DragonsBreathSetUseAnimation; Item.reuseDelay = BetweenShotsPause; @@ -49,11 +51,11 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useAmmo = AmmoID.Gel; Item.rare = ModContent.RarityType(); - Item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.value = CalamityGlobalItem.RarityVioletBuyPrice; } public override bool CanConsumeAmmo(Item ammo, Player player) => !StrongShotMode && Main.rand.NextFloat() > 0.80f; - public override Vector2? HoldoutOffset() => new Vector2(18, 10.5f); + public override Vector2? HoldoutOffset() => new Vector2(27, 10); public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { @@ -83,19 +85,19 @@ namespace CalamityMod.Items.Weapons.Ranged StrongShotMode = true; DragonsBreathSetUseTime = 2; DragonsBreathSetUseAnimation = 2; - SoundEngine.PlaySound(ScorchedEarth.ShootSound, player.Center); + SoundEngine.PlaySound(WeldingStart, player.Center); } } else if (StrongShotMode) { if (SoundEngine.TryGetActiveSound(WeldSoundSlot, out var WeldSound) && WeldSound.IsPlaying) WeldSound.Position = player.Center; - if (player.Calamity().DragonsBreathAudioCooldown2 == 0) + if ((player.Calamity().DragonsBreathAudioCooldown2 == 0) && (WeldingShots < 45)) { player.Calamity().DragonsBreathAudioCooldown2 = 30; WeldSoundSlot = SoundEngine.PlaySound(WeldingShoot, player.Center); } - Projectile.NewProjectile(source, position, velocity * 1.5f, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 1); + Projectile.NewProjectile(source, position, velocity * 2f, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 1); WeldingShots--; if (WeldingShots <= 0) { @@ -110,7 +112,7 @@ namespace CalamityMod.Items.Weapons.Ranged StrongShotMode = false; DragonsBreathSetUseTime = 5; DragonsBreathSetUseAnimation = 9; - } + } } return false; } @@ -120,7 +122,7 @@ namespace CalamityMod.Items.Weapons.Ranged float itemRotation = player.compositeFrontArm.rotation + MathHelper.PiOver2 * player.gravDir; Vector2 itemPosition = player.MountedCenter + itemRotation.ToRotationVector2() * 7f; - Vector2 itemSize = new Vector2(94, 72); + Vector2 itemSize = new Vector2(124, 72); Vector2 itemOrigin = new Vector2(-17, 3); CalamityUtils.CleanHoldStyle(player, itemRotation, itemPosition, itemSize, itemOrigin); diff --git a/Items/Weapons/Ranged/DragonsBreath.png b/Items/Weapons/Ranged/DragonsBreath.png index 3ff2a5ca01..f338603729 100644 Binary files a/Items/Weapons/Ranged/DragonsBreath.png and b/Items/Weapons/Ranged/DragonsBreath.png differ diff --git a/Items/Weapons/Ranged/Drataliornus.cs b/Items/Weapons/Ranged/Drataliornus.cs index 2fb5edea6c..e7d1ad1b07 100644 --- a/Items/Weapons/Ranged/Drataliornus.cs +++ b/Items/Weapons/Ranged/Drataliornus.cs @@ -22,6 +22,8 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { + Item.width = 64; + Item.height = 84; Item.damage = 129; Item.knockBack = 1f; Item.shootSpeed = 18f; @@ -30,11 +32,9 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useAnimation = 24; Item.reuseDelay = 48; Item.useLimitPerAnimation = 2; - Item.width = 64; - Item.height = 84; Item.UseSound = SoundID.Item5; Item.shoot = ModContent.ProjectileType(); - Item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.noMelee = true; Item.noUseGraphic = true; Item.DamageType = DamageClass.Ranged; diff --git a/Items/Weapons/Ranged/ElementalBlaster.cs b/Items/Weapons/Ranged/ElementalBlaster.cs index fab5898e68..50c96f5885 100644 --- a/Items/Weapons/Ranged/ElementalBlaster.cs +++ b/Items/Weapons/Ranged/ElementalBlaster.cs @@ -1,27 +1,32 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; +using CalamityMod.Sounds; using Microsoft.Xna.Framework; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Sounds; namespace CalamityMod.Items.Weapons.Ranged { public class ElementalBlaster : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; + + public override void SetStaticDefaults() + { + ItemID.Sets.IsRangedSpecialistWeapon[Item.type] = true; + } public override void SetDefaults() { - Item.damage = 67; - Item.DamageType = DamageClass.Ranged; Item.width = 104; Item.height = 42; + Item.damage = 67; + Item.DamageType = DamageClass.Ranged; Item.useTime = 2; Item.useAnimation = 6; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 1.75f; - Item.value = CalamityGlobalItem.Rarity11BuyPrice; + Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; Item.rare = ItemRarityID.Purple; Item.UseSound = CommonCalamitySounds.PlasmaBoltSound; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/ElementalEruption.cs b/Items/Weapons/Ranged/ElementalEruption.cs index 9a90f7f16e..8c8449aafd 100644 --- a/Items/Weapons/Ranged/ElementalEruption.cs +++ b/Items/Weapons/Ranged/ElementalEruption.cs @@ -1,8 +1,8 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -21,17 +21,17 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - Item.damage = 94; - Item.DamageType = DamageClass.Ranged; Item.width = 64; Item.height = 34; + Item.damage = 94; + Item.DamageType = DamageClass.Ranged; Item.useAnimation = Item.useTime = 6; Item.useStyle = ItemUseStyleID.Shoot; Item.noUseGraphic = true; Item.noMelee = true; Item.knockBack = 3.5f; Item.UseSound = SoundID.Item34; - Item.value = CalamityGlobalItem.Rarity11BuyPrice; + Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; Item.rare = ItemRarityID.Purple; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); @@ -42,7 +42,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override Vector2? HoldoutOffset() => new Vector2(-10, 0); public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; - + // Spawning the holdout cannot consume ammo public override bool CanConsumeAmmo(Item ammo, 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) @@ -54,7 +54,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { CreateRecipe(). - AddIngredient(). + AddIngredient(). AddIngredient(ItemID.LunarBar, 5). AddIngredient(5). AddIngredient(5). diff --git a/Items/Weapons/Ranged/EternalBlizzard.cs b/Items/Weapons/Ranged/EternalBlizzard.cs index ed46aaf315..988223ece0 100644 --- a/Items/Weapons/Ranged/EternalBlizzard.cs +++ b/Items/Weapons/Ranged/EternalBlizzard.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Ranged; +using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -15,17 +15,17 @@ namespace CalamityMod.Items.Weapons.Ranged } public override void SetDefaults() { - Item.damage = 67; - Item.DamageType = DamageClass.Ranged; Item.width = 72; Item.height = 36; + Item.damage = 67; + Item.DamageType = DamageClass.Ranged; Item.useTime = 18; Item.useAnimation = 18; Item.useStyle = ItemUseStyleID.Shoot; Item.useTurn = false; Item.noMelee = true; Item.knockBack = 3f; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; Item.useAmmo = AmmoID.Arrow; Item.UseSound = SoundID.Item5; diff --git a/Items/Weapons/Ranged/Eviscerator.cs b/Items/Weapons/Ranged/Eviscerator.cs index e38d2b330d..75849b1bb2 100644 --- a/Items/Weapons/Ranged/Eviscerator.cs +++ b/Items/Weapons/Ranged/Eviscerator.cs @@ -1,8 +1,8 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -13,16 +13,16 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() { - Item.damage = 65; - Item.DamageType = DamageClass.Ranged; Item.width = 58; Item.height = 22; + Item.damage = 65; + Item.DamageType = DamageClass.Ranged; Item.useTime = 60; Item.useAnimation = 60; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 7.5f; - Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; Item.UseSound = SoundID.Item40; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/FetidEmesis.cs b/Items/Weapons/Ranged/FetidEmesis.cs index b0afe33d3b..ca3cddecaf 100644 --- a/Items/Weapons/Ranged/FetidEmesis.cs +++ b/Items/Weapons/Ranged/FetidEmesis.cs @@ -14,10 +14,10 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() { - Item.damage = 129; - Item.DamageType = DamageClass.Ranged; Item.width = 76; Item.height = 46; + Item.damage = 129; + Item.DamageType = DamageClass.Ranged; Item.useTime = Item.useAnimation = 6; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shootSpeed = 16f; Item.useAmmo = AmmoID.Bullet; - Item.value = CalamityGlobalItem.Rarity13BuyPrice; + Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; Item.rare = ModContent.RarityType(); Item.Calamity().canFirePointBlankShots = true; } @@ -45,7 +45,7 @@ namespace CalamityMod.Items.Weapons.Ranged ModContent.ProjectileType(), damage, knockback, player.whoAmI); for (int i = 0; i < 5; i++) { - Dust dust = Dust.NewDustDirect(position, 10, 10, 27); + Dust dust = Dust.NewDustDirect(position, 10, 10, DustID.Shadowflame); dust.velocity = Vector2.Normalize(velocity).RotatedByRandom(MathHelper.ToRadians(15f)); dust.noGravity = true; } diff --git a/Items/Weapons/Ranged/FirestormCannon.cs b/Items/Weapons/Ranged/FirestormCannon.cs index 0238256994..573af9b6a4 100644 --- a/Items/Weapons/Ranged/FirestormCannon.cs +++ b/Items/Weapons/Ranged/FirestormCannon.cs @@ -1,8 +1,8 @@ -using Terraria.DataStructures; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using Microsoft.Xna.Framework; namespace CalamityMod.Items.Weapons.Ranged { @@ -11,21 +11,21 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetStaticDefaults() { - ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; + ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; } public override void SetDefaults() { - Item.damage = 14; - Item.DamageType = DamageClass.Ranged; Item.width = 56; Item.height = 28; + Item.damage = 14; + Item.DamageType = DamageClass.Ranged; Item.useTime = 12; Item.useAnimation = 12; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 1.5f; - Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; Item.UseSound = SoundID.Item11; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/FlakKraken.cs b/Items/Weapons/Ranged/FlakKraken.cs index a1af1cfe28..707d82448f 100644 --- a/Items/Weapons/Ranged/FlakKraken.cs +++ b/Items/Weapons/Ranged/FlakKraken.cs @@ -1,39 +1,78 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Sounds; namespace CalamityMod.Items.Weapons.Ranged { public class FlakKraken : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; + + #region Other Stats + public static int OriginalUseTime = 63; + + public static float TimeBetweenShots = 21; + public static float ProjectilesPerBurst = 2f; + + public static float OwnerKnockbackStrength = 2.5f; + + public static float ProjectileGravityStrength = 0.22f; + public static float ProjectileShootSpeed = 25f; + + public static float InitialShotDamageMultiplier = 1f; + public static float InitialShotHitShrapnelDamageMultiplier = 0.3f; + + public static int ShrapnelAmount = 5; + public static float ShrapnelAngleOffset = MathHelper.PiOver4; + + public static int ClusterShrapnelAmount = 8; + public static float ClusterShrapnelAngleOffset = MathHelper.PiOver2 + MathHelper.ToRadians(50f); + #endregion + public override void SetDefaults() { - Item.damage = 88; + Item.damage = 124; Item.DamageType = DamageClass.Ranged; + Item.useTime = Item.useAnimation = OriginalUseTime; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 15f; + Item.width = 152; Item.height = 58; - Item.useTime = 10; - Item.useAnimation = 10; - Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.noUseGraphic = true; Item.channel = true; - Item.knockBack = 0f; - Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.useAmmo = AmmoID.Rocket; + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; - Item.UseSound = CommonCalamitySounds.LaserCannonSound; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 30f; //30 + Item.useStyle = ItemUseStyleID.Shoot; + Item.UseSound = new SoundStyle("CalamityMod/Sounds/Item/DudFire") with { Volume = .4f, Pitch = -.95f, PitchVariance = 0.1f }; } - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; + // Obviously we don't want multiple holdouts existing at the same time. + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] == 0; + + // Spawning the holdout won't consume ammo. + public override bool CanConsumeAmmo(Item ammo, Player player) => player.ownedProjectileCounts[Item.shoot] != 0; + + // Makes the rotation of the mouse around the player sync in multiplayer. + public override void HoldItem(Player player) => player.Calamity().mouseWorldListener = true; + + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + { + Projectile holdout = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, player.whoAmI); + + // We set the rotation to the direction to the mouse so the first frame doesn't appear bugged out. + holdout.velocity = (player.Calamity().mouseWorld - player.MountedCenter).SafeNormalize(Vector2.Zero); + + return false; + } public override void AddRecipes() { diff --git a/Items/Weapons/Ranged/FlakToxicannon.cs b/Items/Weapons/Ranged/FlakToxicannon.cs index d98eba6f8e..78d2f57a2b 100644 --- a/Items/Weapons/Ranged/FlakToxicannon.cs +++ b/Items/Weapons/Ranged/FlakToxicannon.cs @@ -1,7 +1,8 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Ranged; +using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -10,34 +11,59 @@ namespace CalamityMod.Items.Weapons.Ranged public class FlakToxicannon : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; - public override void SetStaticDefaults() - { - } + + #region Other Stats + public static float OwnerKnockbackStrength = 1.1f; + + public static float ProjectileGravityStrength = 0.17f; + public static float ProjectileShootSpeed = 25f; + + public static float InitialShotDamageMultiplier = 1f; + public static float InitialShotHitShrapnelDamageMultiplier = .2f; + + public static int ShrapnelAmount = 4; + public static float ShrapnelAngleOffset = 0.11f; + + public static int ClusterShrapnelAmount = 7; + public static float ClusterShrapnelAngleOffset = 0.53f; + #endregion + public override void SetDefaults() { - Item.damage = 51; + Item.damage = 73; // Here you're modifying the shrapnel's damage. Item.DamageType = DamageClass.Ranged; + Item.useTime = Item.useAnimation = 44; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 15f; + Item.width = 88; Item.height = 28; - Item.useTime = Item.useAnimation = 11; - Item.useStyle = ItemUseStyleID.Shoot; - Item.useTurn = false; Item.noMelee = true; - Item.knockBack = 7f; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.noUseGraphic = true; + Item.channel = true; + Item.useAmmo = AmmoID.Rocket; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; - Item.UseSound = SoundID.Item109; - Item.autoReuse = true; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 16f; + Item.useStyle = ItemUseStyleID.Shoot; + Item.UseSound = new SoundStyle("CalamityMod/Sounds/Item/DudFire") with { Volume = .4f, Pitch = -.7f, PitchVariance = 0.1f }; } + + // Obviously we don't want multiple holdouts existing at the same time. + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] == 0; + + // Spawning the holdout won't consume ammo. + public override bool CanConsumeAmmo(Item ammo, Player player) => player.ownedProjectileCounts[Item.shoot] != 0; + + // Makes the rotation of the mouse around the player sync in multiplayer. + public override void HoldItem(Player player) => player.Calamity().mouseWorldListener = true; + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - float angle = velocity.ToRotation() + MathHelper.PiOver2; - if (angle <= -(MathHelper.Pi / 3) || angle >= (MathHelper.Pi / 3)) - return false; + Projectile holdout = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, player.whoAmI); + + // We set the rotation to the direction to the mouse so the first frame doesn't appear bugged out. + holdout.velocity = (player.Calamity().mouseWorld - player.MountedCenter).SafeNormalize(Vector2.Zero); - Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); return false; } } diff --git a/Items/Weapons/Ranged/FlarewingBow.cs b/Items/Weapons/Ranged/FlarewingBow.cs index dbc0a5d0f3..a1f6d32d26 100644 --- a/Items/Weapons/Ranged/FlarewingBow.cs +++ b/Items/Weapons/Ranged/FlarewingBow.cs @@ -1,8 +1,8 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -13,16 +13,16 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() { - Item.damage = 31; - Item.DamageType = DamageClass.Ranged; Item.width = 40; Item.height = 72; + Item.damage = 31; + Item.DamageType = DamageClass.Ranged; Item.useTime = 41; Item.useAnimation = 41; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 1.5f; - Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; Item.UseSound = SoundID.Item5; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/FlurrystormCannon.cs b/Items/Weapons/Ranged/FlurrystormCannon.cs index ddb604d3b2..d2d1e03035 100644 --- a/Items/Weapons/Ranged/FlurrystormCannon.cs +++ b/Items/Weapons/Ranged/FlurrystormCannon.cs @@ -1,8 +1,8 @@ -using Terraria.DataStructures; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; -using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -13,15 +13,15 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() { - Item.damage = 12; Item.width = 68; Item.height = 38; + Item.damage = 10; Item.useTime = 16; Item.useAnimation = 16; Item.useStyle = ItemUseStyleID.Shoot; Item.knockBack = 1.2f; - Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; Item.Calamity().donorItem = true; @@ -41,7 +41,7 @@ namespace CalamityMod.Items.Weapons.Ranged // Spawning the holdout cannot consume ammo public override bool CanConsumeAmmo(Item ammo, Player player) => Main.rand.NextBool() && 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, 0f, 0f); diff --git a/Items/Weapons/Ranged/FreedomStar.cs b/Items/Weapons/Ranged/FreedomStar.cs index c0a31311c6..b97730696b 100644 --- a/Items/Weapons/Ranged/FreedomStar.cs +++ b/Items/Weapons/Ranged/FreedomStar.cs @@ -21,10 +21,10 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { CalamityGlobalItem modItem = Item.Calamity(); - Item.damage = 100; - Item.DamageType = DamageClass.Ranged; Item.width = 54; Item.height = 28; + Item.damage = 100; + Item.DamageType = DamageClass.Ranged; Item.useTime = 10; Item.useAnimation = 10; Item.useStyle = ItemUseStyleID.Shoot; @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.channel = true; Item.noUseGraphic = true; Item.knockBack = 3f; - Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); modItem.donorItem = true; Item.UseSound = SoundID.Item75; diff --git a/Items/Weapons/Ranged/FrostbiteBlaster.cs b/Items/Weapons/Ranged/FrostbiteBlaster.cs index 1d52ab8e5e..470c62ed7a 100644 --- a/Items/Weapons/Ranged/FrostbiteBlaster.cs +++ b/Items/Weapons/Ranged/FrostbiteBlaster.cs @@ -1,9 +1,9 @@ -using Terraria.DataStructures; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Items.Weapons.Ranged { @@ -12,10 +12,10 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() { - Item.damage = 50; - Item.DamageType = DamageClass.Ranged; Item.width = 56; Item.height = 22; + Item.damage = 50; + Item.DamageType = DamageClass.Ranged; Item.useTime = 7; Item.useAnimation = 21; Item.reuseDelay = 54; @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useTurn = false; Item.noMelee = true; Item.knockBack = 5f; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.useAmmo = AmmoID.Bullet; Item.UseSound = SoundID.Item36; diff --git a/Items/Weapons/Ranged/Fungicide.cs b/Items/Weapons/Ranged/Fungicide.cs index fd49dd050a..b7142eaa2b 100644 --- a/Items/Weapons/Ranged/Fungicide.cs +++ b/Items/Weapons/Ranged/Fungicide.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Ranged; +using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -12,16 +12,16 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() { - Item.damage = 20; - Item.DamageType = DamageClass.Ranged; Item.width = 40; Item.height = 26; - Item.useTime = 20; - Item.useAnimation = 20; + Item.damage = 20; + Item.DamageType = DamageClass.Ranged; + Item.useTime = 22; + Item.useAnimation = 22; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2.5f; - Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; Item.UseSound = SoundID.Item61; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/Galeforce.cs b/Items/Weapons/Ranged/Galeforce.cs index e0d786cc07..8fbc80de2b 100644 --- a/Items/Weapons/Ranged/Galeforce.cs +++ b/Items/Weapons/Ranged/Galeforce.cs @@ -1,8 +1,8 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -13,16 +13,16 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() { - Item.damage = 8; - Item.DamageType = DamageClass.Ranged; Item.width = 32; Item.height = 52; + Item.damage = 13; + Item.DamageType = DamageClass.Ranged; Item.useTime = 20; Item.useAnimation = 20; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3f; - Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; Item.UseSound = SoundID.Item5; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/GoldenEagle.cs b/Items/Weapons/Ranged/GoldenEagle.cs index 498b593225..87466ac4f7 100644 --- a/Items/Weapons/Ranged/GoldenEagle.cs +++ b/Items/Weapons/Ranged/GoldenEagle.cs @@ -1,6 +1,6 @@ -using Terraria.DataStructures; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -13,16 +13,16 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { + Item.width = 46; + Item.height = 30; Item.damage = 85; Item.DamageType = DamageClass.Ranged; Item.noMelee = true; - Item.width = 46; - Item.height = 30; Item.useTime = 19; Item.useAnimation = 19; Item.useStyle = ItemUseStyleID.Shoot; Item.knockBack = 3f; - Item.value = CalamityGlobalItem.Rarity11BuyPrice; + Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; Item.rare = ItemRarityID.Purple; Item.UseSound = SoundID.Item41; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/Goobow.cs b/Items/Weapons/Ranged/Goobow.cs index 0b0183fbe7..6b51c5ba4b 100644 --- a/Items/Weapons/Ranged/Goobow.cs +++ b/Items/Weapons/Ranged/Goobow.cs @@ -1,9 +1,9 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Typeless; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -14,16 +14,16 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() { - Item.damage = 33; - Item.DamageType = DamageClass.Ranged; Item.width = 32; Item.height = 96; + Item.damage = 33; + Item.DamageType = DamageClass.Ranged; Item.useTime = 31; Item.useAnimation = 31; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3f; - Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; Item.UseSound = SoundID.Item5; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/GunkShot.cs b/Items/Weapons/Ranged/GunkShot.cs index cc9c9c0543..9db3fecab5 100644 --- a/Items/Weapons/Ranged/GunkShot.cs +++ b/Items/Weapons/Ranged/GunkShot.cs @@ -1,8 +1,8 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -13,16 +13,16 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() { - Item.damage = 23; - Item.DamageType = DamageClass.Ranged; Item.width = 76; Item.height = 28; - Item.useTime = 32; - Item.useAnimation = 32; + Item.damage = 22; + Item.DamageType = DamageClass.Ranged; + Item.useTime = 35; + Item.useAnimation = 35; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3.5f; - Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; Item.UseSound = SoundID.Item36; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/HalibutCannon.cs b/Items/Weapons/Ranged/HalibutCannon.cs index 56ff639192..7dc5bc4243 100644 --- a/Items/Weapons/Ranged/HalibutCannon.cs +++ b/Items/Weapons/Ranged/HalibutCannon.cs @@ -16,17 +16,17 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() { - Item.damage = 50; - Item.DamageType = DamageClass.Ranged; Item.width = 118; Item.height = 56; + Item.damage = 50; + Item.DamageType = DamageClass.Ranged; Item.useTime = 10; Item.useAnimation = 20; Item.useStyle = ItemUseStyleID.Shoot; Item.rare = ModContent.RarityType(); Item.noMelee = true; Item.knockBack = 1f; - Item.value = CalamityGlobalItem.Rarity16BuyPrice; + Item.value = CalamityGlobalItem.RarityHotPinkBuyPrice; Item.UseSound = null; Item.autoReuse = true; Item.shoot = ProjectileID.Bullet; @@ -42,7 +42,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { SoundEngine.PlaySound(SoundID.Item38, player.Center); - + // Really jammed in GFB if (Main.zenithWorld) return Main.rand.NextBool(5); diff --git a/Items/Weapons/Ranged/HalleysInferno.cs b/Items/Weapons/Ranged/HalleysInferno.cs index e4f88f346f..3348115c70 100644 --- a/Items/Weapons/Ranged/HalleysInferno.cs +++ b/Items/Weapons/Ranged/HalleysInferno.cs @@ -14,10 +14,12 @@ namespace CalamityMod.Items.Weapons.Ranged { public new string LocalizationCategory => "Items.Weapons.Ranged"; - public static readonly SoundStyle Shoot = new("CalamityMod/Sounds/Item/HalleysInfernoShoot") { Volume = 0.68f }; + public static readonly SoundStyle ShootSound = new("CalamityMod/Sounds/Item/HalleysInfernoShoot") { Volume = 0.68f }; public static readonly SoundStyle Hit = new("CalamityMod/Sounds/Item/HalleysInfernoHit") { Volume = 0.75f }; public override void SetDefaults() { + Item.width = 84; + Item.height = 34; Item.damage = 444; Item.knockBack = 5.5f; Item.DamageType = DamageClass.Ranged; @@ -33,12 +35,10 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shootSpeed = 12f; Item.shoot = ModContent.ProjectileType(); - Item.width = 84; - Item.height = 34; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; - Item.UseSound = Shoot; - Item.value = CalamityGlobalItem.Rarity13BuyPrice; + Item.UseSound = ShootSound; + Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; Item.rare = ModContent.RarityType(); } @@ -47,6 +47,8 @@ namespace CalamityMod.Items.Weapons.Ranged public override Vector2? HoldoutOffset() => new Vector2(-15, 0); + public override void HoldItem(Player player) => player.scope = true; + public override bool CanConsumeAmmo(Item ammo, Player player) => Main.rand.Next(100) >= 50; public override void AddRecipes() diff --git a/Items/Weapons/Ranged/HandheldTank.cs b/Items/Weapons/Ranged/HandheldTank.cs index 939d096a1b..f332f79ce0 100644 --- a/Items/Weapons/Ranged/HandheldTank.cs +++ b/Items/Weapons/Ranged/HandheldTank.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.UseSound = UseSound; Item.noMelee = true; - Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; @@ -44,7 +44,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - Projectile.NewProjectile(source, position+player.DirectionTo(Main.MouseWorld)*48f, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, position + player.DirectionTo(Main.MouseWorld) * 48f, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 0f); return false; } diff --git a/Items/Weapons/Ranged/HavocsBreath.cs b/Items/Weapons/Ranged/HavocsBreath.cs index c104167950..efad9edd1e 100644 --- a/Items/Weapons/Ranged/HavocsBreath.cs +++ b/Items/Weapons/Ranged/HavocsBreath.cs @@ -13,10 +13,10 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() { - Item.damage = 70; - Item.DamageType = DamageClass.Ranged; Item.width = 68; Item.height = 26; + Item.damage = 74; + Item.DamageType = DamageClass.Ranged; Item.useTime = 5; Item.useAnimation = 35; Item.reuseDelay = 20; @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.noMelee = true; Item.knockBack = 1.5f; Item.UseSound = SoundID.Item34; - Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); @@ -39,7 +39,7 @@ namespace CalamityMod.Items.Weapons.Ranged { for (int i = 0; i <= 2; i++) { - Projectile.NewProjectile(source, position + velocity * 4f, velocity.RotatedByRandom(0.3f) * Main.rand.NextFloat(0.9f, 1.25f), type, damage , knockback, player.whoAmI); + Projectile.NewProjectile(source, position + velocity * 4f, velocity.RotatedByRandom(0.3f) * Main.rand.NextFloat(0.9f, 1.25f), type, damage, knockback, player.whoAmI); } return false; } diff --git a/Items/Weapons/Ranged/HeavenlyGale.cs b/Items/Weapons/Ranged/HeavenlyGale.cs index e469016528..3c3643b112 100644 --- a/Items/Weapons/Ranged/HeavenlyGale.cs +++ b/Items/Weapons/Ranged/HeavenlyGale.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Ranged public const float ArrowTargetingRange = 1100f; - public const float MaxChargeDamageBoost = 4.5f; + public const float MaxChargeDamageBoost = 3.5f; public const float LightningDamageFactor = 0.36f; @@ -38,10 +38,10 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - Item.damage = 215; - Item.DamageType = DamageClass.Ranged; Item.width = 138; Item.height = 176; + Item.damage = 256; + Item.DamageType = DamageClass.Ranged; Item.useAnimation = Item.useTime = ArrowShootTime; // 40 Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; diff --git a/Items/Weapons/Ranged/Hellborn.cs b/Items/Weapons/Ranged/Hellborn.cs index 382e65694d..6ec064fecf 100644 --- a/Items/Weapons/Ranged/Hellborn.cs +++ b/Items/Weapons/Ranged/Hellborn.cs @@ -1,9 +1,9 @@ -using Terraria.DataStructures; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using Microsoft.Xna.Framework; -using Terraria.Audio; namespace CalamityMod.Items.Weapons.Ranged { @@ -14,14 +14,14 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - Item.damage = 20; - Item.DamageType = DamageClass.Ranged; Item.width = 62; Item.height = 34; + Item.damage = 20; + Item.DamageType = DamageClass.Ranged; Item.useAnimation = Item.useTime = 20; Item.useStyle = ItemUseStyleID.Shoot; Item.knockBack = 2f; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item11; Item.autoReuse = true; @@ -84,14 +84,14 @@ namespace CalamityMod.Items.Weapons.Ranged SoundEngine.PlaySound(SoundID.Item14, target.Center); for (int i = 0; i < 80; i++) { - int contactDust = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 174, 0f, 0f, 200, default, firstDustScale); + int contactDust = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, DustID.InfernoFork, 0f, 0f, 200, default, firstDustScale); Dust dust = Main.dust[contactDust]; dust.position = target.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * target.width / 2f; dust.noGravity = true; dust.velocity.Y -= 6f; dust.velocity *= 3f; dust.velocity += dustVelocity * Main.rand.NextFloat(); - contactDust = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 174, 0f, 0f, 100, default, secondDustScale); + contactDust = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, DustID.InfernoFork, 0f, 0f, 100, default, secondDustScale); dust.position = target.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * target.width / 2f; dust.velocity.Y -= 6f; dust.velocity *= 2f; @@ -102,7 +102,7 @@ namespace CalamityMod.Items.Weapons.Ranged } for (int j = 0; j < 40; j++) { - int contactDust2 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 174, 0f, 0f, 0, default, thirdDustScale); + int contactDust2 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, DustID.InfernoFork, 0f, 0f, 0, default, thirdDustScale); Dust dust = Main.dust[contactDust2]; dust.position = target.Center + Vector2.UnitX.RotatedByRandom(MathHelper.Pi).RotatedBy(target.velocity.ToRotation()) * target.width / 3f; dust.noGravity = true; diff --git a/Items/Weapons/Ranged/Helstorm.cs b/Items/Weapons/Ranged/Helstorm.cs index d467c52ec5..0dbfca56dd 100644 --- a/Items/Weapons/Ranged/Helstorm.cs +++ b/Items/Weapons/Ranged/Helstorm.cs @@ -1,9 +1,9 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using Microsoft.Xna.Framework; namespace CalamityMod.Items.Weapons.Ranged { @@ -12,15 +12,15 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() { - Item.damage = 31; - Item.DamageType = DamageClass.Ranged; Item.width = 50; Item.height = 24; - Item.useTime = 7; - Item.useAnimation = 7; + Item.damage = 33; + Item.DamageType = DamageClass.Ranged; + Item.useTime = 9; + Item.useAnimation = 9; Item.useStyle = ItemUseStyleID.Shoot; - Item.knockBack = 2.5f; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.knockBack = 2f; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; Item.UseSound = SoundID.Item11; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/HoarfrostBow.cs b/Items/Weapons/Ranged/HoarfrostBow.cs index 9f290e1709..6dcc2a5750 100644 --- a/Items/Weapons/Ranged/HoarfrostBow.cs +++ b/Items/Weapons/Ranged/HoarfrostBow.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Ranged; +using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -13,16 +13,16 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() { - Item.damage = 37; - Item.DamageType = DamageClass.Ranged; Item.width = 26; Item.height = 70; - Item.useTime = 25; - Item.useAnimation = 25; + Item.damage = 36; + Item.DamageType = DamageClass.Ranged; + Item.useTime = 29; + Item.useAnimation = 29; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 4f; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item5; Item.autoReuse = true; @@ -36,8 +36,8 @@ namespace CalamityMod.Items.Weapons.Ranged { for (int index = 0; index < 2; ++index) { - float SpeedX = velocity.X + Main.rand.Next(-30, 31) * 0.05f; - float SpeedY = velocity.Y + Main.rand.Next(-30, 31) * 0.05f; + float SpeedX = velocity.X + Main.rand.Next(-25, 26) * 0.05f; + float SpeedY = velocity.Y + Main.rand.Next(-25, 26) * 0.05f; if (CalamityUtils.CheckWoodenAmmo(type, player)) Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockback, player.whoAmI); diff --git a/Items/Weapons/Ranged/Hydra.cs b/Items/Weapons/Ranged/Hydra.cs index e3605d5f86..bdc1828846 100644 --- a/Items/Weapons/Ranged/Hydra.cs +++ b/Items/Weapons/Ranged/Hydra.cs @@ -1,11 +1,11 @@ -using CalamityMod.Projectiles.Ranged; +using System; +using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Items.Weapons.Ranged { @@ -44,7 +44,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shootSpeed = 10f; Item.knockBack = 10f; Item.autoReuse = true; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; Item.UseSound = null; //does so in Shoot Item.Calamity().canFirePointBlankShots = true; @@ -85,9 +85,9 @@ namespace CalamityMod.Items.Weapons.Ranged return false; //Otherwise, launch the guns + SoundEngine.PlaySound(LaunchSound, player.Center); for (int i = 0; i < Main.maxProjectiles; i++) { - SoundEngine.PlaySound(LaunchSound, player.Center); if (Main.projectile[i].type == HeadID && Main.projectile[i].owner == player.whoAmI && Main.projectile[i].active) Main.projectile[i].ai[1] = -1f; } diff --git a/Items/Weapons/Ranged/Infinity.cs b/Items/Weapons/Ranged/Infinity.cs index 0d806aa604..0a3822976f 100644 --- a/Items/Weapons/Ranged/Infinity.cs +++ b/Items/Weapons/Ranged/Infinity.cs @@ -22,13 +22,13 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - Item.damage = 120; - Item.DamageType = DamageClass.Ranged; Item.width = 56; Item.height = 24; + Item.damage = 110; + Item.DamageType = DamageClass.Ranged; Item.useTime = 2; - Item.useAnimation = 18; - Item.reuseDelay = 6; + Item.useAnimation = 12; + Item.reuseDelay = 12; Item.useLimitPerAnimation = 9; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; @@ -73,11 +73,11 @@ namespace CalamityMod.Items.Weapons.Ranged { rotation -= 2; } - if (rotation >= 15) + if (rotation >= 11) { limit = false; } - else if (rotation <= -15) + else if (rotation <= -11) { limit = true; } @@ -100,11 +100,11 @@ namespace CalamityMod.Items.Weapons.Ranged { rotation -= 2; } - if (rotation >= 15) + if (rotation >= 11) { limit = false; } - else if (rotation <= -15) + else if (rotation <= -11) { limit = true; } diff --git a/Items/Weapons/Ranged/Karasawa.cs b/Items/Weapons/Ranged/Karasawa.cs index e062a7c395..65b84fc6fa 100644 --- a/Items/Weapons/Ranged/Karasawa.cs +++ b/Items/Weapons/Ranged/Karasawa.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.UseSound = FireSound; Item.noMelee = true; - Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; diff --git a/Items/Weapons/Ranged/Kingsbane.cs b/Items/Weapons/Ranged/Kingsbane.cs index b17c0e57c0..69fd57af7d 100644 --- a/Items/Weapons/Ranged/Kingsbane.cs +++ b/Items/Weapons/Ranged/Kingsbane.cs @@ -17,17 +17,17 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() { - Item.damage = 245; - Item.DamageType = DamageClass.Ranged; Item.width = 92; Item.height = 44; + Item.damage = 245; + Item.DamageType = DamageClass.Ranged; Item.useTime = 3; Item.useAnimation = 3; Item.channel = true; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2.5f; - Item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.UseSound = null; Item.autoReuse = true; Item.noUseGraphic = true; diff --git a/Items/Weapons/Ranged/Leviatitan.cs b/Items/Weapons/Ranged/Leviatitan.cs index 512f1fe903..2e83fff9d7 100644 --- a/Items/Weapons/Ranged/Leviatitan.cs +++ b/Items/Weapons/Ranged/Leviatitan.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Ranged; +using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -12,16 +12,16 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() { - Item.damage = 80; - Item.DamageType = DamageClass.Ranged; Item.width = 82; Item.height = 28; + Item.damage = 80; + Item.DamageType = DamageClass.Ranged; Item.useTime = 9; Item.useAnimation = 9; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5f; - Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; Item.UseSound = SoundID.Item92; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/LunarianBow.cs b/Items/Weapons/Ranged/LunarianBow.cs index 158811801a..73882fcfb2 100644 --- a/Items/Weapons/Ranged/LunarianBow.cs +++ b/Items/Weapons/Ranged/LunarianBow.cs @@ -1,8 +1,8 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -13,16 +13,16 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() { - Item.damage = 19; - Item.DamageType = DamageClass.Ranged; Item.width = 32; Item.height = 62; + Item.damage = 25; + Item.DamageType = DamageClass.Ranged; Item.useTime = 22; Item.useAnimation = 22; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2f; - Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; Item.UseSound = SoundID.Item75; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/MagnaCannon.cs b/Items/Weapons/Ranged/MagnaCannon.cs index 620a41de58..4a320fba08 100644 --- a/Items/Weapons/Ranged/MagnaCannon.cs +++ b/Items/Weapons/Ranged/MagnaCannon.cs @@ -21,19 +21,24 @@ namespace CalamityMod.Items.Weapons.Ranged public static int FullChargeFrames = 138; //126 frames is durration of charge sound public new string LocalizationCategory => "Items.Weapons.Ranged"; + + public override void SetStaticDefaults() + { + ItemID.Sets.IsRangedSpecialistWeapon[Item.type] = true; + } public override void SetDefaults() { - Item.damage = 30; - Item.DamageType = DamageClass.Ranged; Item.width = 56; Item.height = 34; + Item.damage = 30; + Item.DamageType = DamageClass.Ranged; Item.useTime = Item.useAnimation = AftershotCooldownFrames; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.noUseGraphic = true; Item.channel = true; Item.knockBack = 2.5f; - Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; Item.UseSound = null; Item.autoReuse = false; diff --git a/Items/Weapons/Ranged/MagnomalyCannon.cs b/Items/Weapons/Ranged/MagnomalyCannon.cs index 65fd8e8dbd..f23f2fe0e1 100644 --- a/Items/Weapons/Ranged/MagnomalyCannon.cs +++ b/Items/Weapons/Ranged/MagnomalyCannon.cs @@ -16,17 +16,17 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() { - Item.damage = 357; - Item.DamageType = DamageClass.Ranged; Item.width = 84; Item.height = 30; + Item.damage = 279; + Item.DamageType = DamageClass.Ranged; Item.useTime = 15; Item.useAnimation = 15; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 9.5f; Item.UseSound = SoundID.Item11; - Item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 15f; diff --git a/Items/Weapons/Ranged/Malevolence.cs b/Items/Weapons/Ranged/Malevolence.cs index 8faaaff2c6..b436e97fcf 100644 --- a/Items/Weapons/Ranged/Malevolence.cs +++ b/Items/Weapons/Ranged/Malevolence.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Ranged; +using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -12,16 +12,16 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() { - Item.damage = 56; - Item.DamageType = DamageClass.Ranged; Item.width = 36; Item.height = 58; + Item.damage = 56; + Item.DamageType = DamageClass.Ranged; Item.useTime = 18; Item.useAnimation = 18; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3f; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; Item.UseSound = SoundID.Item97; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/MarksmanBow.cs b/Items/Weapons/Ranged/MarksmanBow.cs index b8bca544b7..155944b311 100644 --- a/Items/Weapons/Ranged/MarksmanBow.cs +++ b/Items/Weapons/Ranged/MarksmanBow.cs @@ -1,6 +1,6 @@ -using Terraria.DataStructures; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -11,10 +11,10 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() { - Item.damage = 35; - Item.DamageType = DamageClass.Ranged; Item.width = 36; Item.height = 110; + Item.damage = 35; + Item.DamageType = DamageClass.Ranged; Item.useTime = 18; Item.useAnimation = 18; Item.useStyle = ItemUseStyleID.Shoot; diff --git a/Items/Weapons/Ranged/Megalodon.cs b/Items/Weapons/Ranged/Megalodon.cs index fd6681b690..80d0526b43 100644 --- a/Items/Weapons/Ranged/Megalodon.cs +++ b/Items/Weapons/Ranged/Megalodon.cs @@ -1,8 +1,8 @@ -using CalamityMod.Items.Materials; +using System; +using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -17,16 +17,16 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - Item.damage = 30; - Item.DamageType = DamageClass.Ranged; Item.width = 72; Item.height = 32; + Item.damage = 37; + Item.DamageType = DamageClass.Ranged; Item.useTime = 6; Item.useAnimation = 6; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2.5f; - Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; Item.UseSound = SoundID.Item11; Item.autoReuse = true; @@ -46,7 +46,7 @@ namespace CalamityMod.Items.Weapons.Ranged // Fire either the bullet or the water jet, depending on cadence. int projectileToFire = fireWater ? Item.shoot : type; - Projectile.NewProjectile(source, newPos, newVel, projectileToFire, damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, newPos, newVel, projectileToFire, (int)(damage * 0.8f), knockback, player.whoAmI); // Always fires a close range water blast. // It goes in the same direction as the main shot but has a minor velocity variation to be less monotonous. diff --git a/Items/Weapons/Ranged/Meowthrower.cs b/Items/Weapons/Ranged/Meowthrower.cs index e9e31de076..69e8cbe036 100644 --- a/Items/Weapons/Ranged/Meowthrower.cs +++ b/Items/Weapons/Ranged/Meowthrower.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Ranged; +using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -15,17 +15,17 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - Item.damage = 29; - Item.DamageType = DamageClass.Ranged; Item.width = 74; Item.height = 24; + Item.damage = 29; + Item.DamageType = DamageClass.Ranged; Item.useTime = 8; Item.useAnimation = 32; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; - Item.knockBack = 1.25f; + Item.knockBack = 0.4f; Item.UseSound = SoundID.Item34; - Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Ranged/Meowthrower.png b/Items/Weapons/Ranged/Meowthrower.png index 5b4b986904..031def7ddb 100644 Binary files a/Items/Weapons/Ranged/Meowthrower.png and b/Items/Weapons/Ranged/Meowthrower.png differ diff --git a/Items/Weapons/Ranged/MidasPrime.cs b/Items/Weapons/Ranged/MidasPrime.cs index 56c5ff6acd..0a15438517 100644 --- a/Items/Weapons/Ranged/MidasPrime.cs +++ b/Items/Weapons/Ranged/MidasPrime.cs @@ -20,16 +20,16 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - Item.damage = 81; - Item.DamageType = DamageClass.Ranged; Item.width = 23; Item.height = 8; + Item.damage = 81; + Item.DamageType = DamageClass.Ranged; Item.useTime = 32; Item.useAnimation = 32; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2.25f; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = ShootSound; Item.autoReuse = true; @@ -56,12 +56,10 @@ namespace CalamityMod.Items.Weapons.Ranged if (player.altFunctionUse == 2) { // player.CanBuyItem() breaks if the player has more than 2,147 platinum coins and was never fixed - // This alternative method works no matter how much money the player has - long cashAvailable = Utils.CoinsCount(out bool overflow, player.inventory); - if (cashAvailable < 100 && !overflow) - return false; - - return player.GetActiveRicoshotCoinCount() < 4; + // 20APR2024: Ozzatron: The method was instead replaced with player.CanAfford, which is immune to overflow + // Additionally, CanAfford checks your Piggy Bank, Safe, etc., meaning Midas Prime can use coins from there + bool hasAtLeastOneSilver = player.CanAfford(100); + return hasAtLeastOneSilver && player.GetActiveRicoshotCoinCount() < 4; } return true; } @@ -71,10 +69,12 @@ namespace CalamityMod.Items.Weapons.Ranged // Remove either 1 gold (if possible) or 1 silver (otherwise) when using right click if (player.altFunctionUse == 2) { - long cashAvailable = Utils.CoinsCount(out bool overflow, player.inventory); + // 20APR2024: Ozzatron: Use CanAfford (new function) to sum money across all the player's banks + // If they have a sum total of at least 1 gold everywhere, they can toss a gold coin + bool hasAtLeastOneGold = player.CanAfford(10000); // If the player has at least 1 gold in their inventory, spend it and use a gold coin - if (overflow || cashAvailable > 10000) + if (hasAtLeastOneGold) { player.BuyItem(10000); nextShotGoldCoin = true; @@ -94,7 +94,7 @@ namespace CalamityMod.Items.Weapons.Ranged // This hook is a convenient location to change the use sound. public override void UseAnimation(Player player) { - Item.UseSound = ShootSound; + Item.UseSound = ShootSound; if (player.altFunctionUse == 2) Item.UseSound = RicoshotCoin.BlingSound; } diff --git a/Items/Weapons/Ranged/MineralMortar.cs b/Items/Weapons/Ranged/MineralMortar.cs index c899c03a88..aef7481495 100644 --- a/Items/Weapons/Ranged/MineralMortar.cs +++ b/Items/Weapons/Ranged/MineralMortar.cs @@ -14,6 +14,8 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { + Item.width = 68; + Item.height = 32; Item.damage = 85; Item.DamageType = DamageClass.Ranged; Item.shoot = ModContent.ProjectileType(); @@ -21,13 +23,11 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shootSpeed = 25f; Item.knockBack = 20f; - Item.width = 68; - Item.height = 32; Item.noMelee = true; Item.noUseGraphic = true; Item.channel = true; Item.useAmmo = AmmoID.Rocket; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.useStyle = ItemUseStyleID.Shoot; Item.UseSound = new SoundStyle("CalamityMod/Sounds/Item/DudFire") with { Volume = .4f, Pitch = -.9f, PitchVariance = 0.1f }; diff --git a/Items/Weapons/Ranged/MolecularManipulator.cs b/Items/Weapons/Ranged/MolecularManipulator.cs index 36fab38770..76e1a08c05 100644 --- a/Items/Weapons/Ranged/MolecularManipulator.cs +++ b/Items/Weapons/Ranged/MolecularManipulator.cs @@ -12,18 +12,23 @@ namespace CalamityMod.Items.Weapons.Ranged public class MolecularManipulator : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; + + public override void SetStaticDefaults() + { + ItemID.Sets.IsRangedSpecialistWeapon[Item.type] = true; + } public override void SetDefaults() { - Item.damage = 580; - Item.DamageType = DamageClass.Ranged; Item.width = 56; Item.height = 34; + Item.damage = 580; + Item.DamageType = DamageClass.Ranged; Item.useTime = 20; Item.useAnimation = 20; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 8f; - Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item33; Item.autoReuse = true; @@ -46,7 +51,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { CreateRecipe(). - AddIngredient(). + AddIngredient(). AddIngredient(2). AddIngredient(). AddTile(TileID.LunarCraftingStation). diff --git a/Items/Weapons/Ranged/Monsoon.cs b/Items/Weapons/Ranged/Monsoon.cs index 66559fea56..1b018e6854 100644 --- a/Items/Weapons/Ranged/Monsoon.cs +++ b/Items/Weapons/Ranged/Monsoon.cs @@ -15,16 +15,16 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() { - Item.damage = 152; - Item.DamageType = DamageClass.Ranged; Item.width = 46; Item.height = 78; + Item.damage = 152; + Item.DamageType = DamageClass.Ranged; Item.useTime = 20; Item.useAnimation = 20; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2.5f; - Item.value = CalamityGlobalItem.Rarity13BuyPrice; + Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item5; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/Needler.cs b/Items/Weapons/Ranged/Needler.cs index 9f1feed952..748da471f9 100644 --- a/Items/Weapons/Ranged/Needler.cs +++ b/Items/Weapons/Ranged/Needler.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Ranged; +using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -12,16 +12,16 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() { - Item.damage = 52; - Item.DamageType = DamageClass.Ranged; Item.width = 44; Item.height = 26; + Item.damage = 52; + Item.DamageType = DamageClass.Ranged; Item.useTime = 18; Item.useAnimation = 18; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5.5f; - Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; Item.UseSound = SoundID.Item108; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/NettlevineGreatbow.cs b/Items/Weapons/Ranged/NettlevineGreatbow.cs index 186a929722..db0811ac93 100644 --- a/Items/Weapons/Ranged/NettlevineGreatbow.cs +++ b/Items/Weapons/Ranged/NettlevineGreatbow.cs @@ -14,16 +14,16 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() { - Item.damage = 73; - Item.DamageType = DamageClass.Ranged; Item.width = 36; Item.height = 64; + Item.damage = 73; + Item.DamageType = DamageClass.Ranged; Item.useTime = 18; Item.useAnimation = 18; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3f; - Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item5; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/NitroExpressRifle.cs b/Items/Weapons/Ranged/NitroExpressRifle.cs new file mode 100644 index 0000000000..fcaa47df0d --- /dev/null +++ b/Items/Weapons/Ranged/NitroExpressRifle.cs @@ -0,0 +1,135 @@ +using System; +using System.Collections.Generic; +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Ranged; +using CalamityMod.Rarities; +using CalamityMod.Sounds; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Ranged +{ + public class NitroExpressRifle : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Weapons.Ranged"; + public static readonly SoundStyle FireSound = new("CalamityMod/Sounds/Item/NitroExpressRifleFire") { Volume = 0.6f }; + public override void SetDefaults() + { + Item.width = 100; + Item.height = 22; + Item.damage = 210; + Item.DamageType = DamageClass.Ranged; + Item.useTime = 70; + Item.useAnimation = 70; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 7.5f; + Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; + Item.UseSound = FireSound; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 12f; + Item.useAmmo = AmmoID.Bullet; + Item.rare = ModContent.RarityType(); + Item.Calamity().canFirePointBlankShots = true; + } + + public override Vector2? HoldoutOffset() => new Vector2(-10, 8); + + // Terraria seems to really dislike high crit values in SetDefaults + public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 10; + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.Musket). + AddIngredient(3). + AddIngredient(3). + AddIngredient(ItemID.ExplosivePowder, 5). + AddTile(TileID.Anvils). + Register(); + + CreateRecipe(). + AddIngredient(ItemID.TheUndertaker). + AddIngredient(3). + AddIngredient(3). + AddIngredient(ItemID.ExplosivePowder, 5). + AddTile(TileID.Anvils). + Register(); + } + + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + { + player.velocity += -velocity * 0.3f; + Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f); + return false; + } + + public override void HoldItem(Player player) => player.Calamity().mouseWorldListener = true; + + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + player.ChangeDir(Math.Sign((player.Calamity().mouseWorld - player.Center).X)); + float itemRotation = player.compositeFrontArm.rotation + MathHelper.PiOver2 * player.gravDir; + + Vector2 itemPosition = player.MountedCenter + itemRotation.ToRotationVector2() * 35f; + Vector2 itemSize = new Vector2(Item.width, Item.height); + Vector2 itemOrigin = new Vector2(-5, 6); + + + //Sniper's horizontal recoil; can be a bit subtle but it is noticeable + if (player.altFunctionUse == 2) + { + //Recoil: + int anim = 0; + for (int r = 0; r < Item.useAnimation; ++r) + { + if (anim == 10 && r < Item.useAnimation / 2) //animates every 10 frames so that the player notices a recoil because this happens way too fast + { + itemPosition.X -= player.direction * 0.025f; + itemPosition.Y -= player.direction * 0.025f; + anim = 0; + } + else if (anim == 10 && r > Item.useAnimation / 2) + { + itemPosition.X += player.direction * 0.025f; + itemPosition.Y += player.direction * 0.025f; + anim = 0; + } + ++anim; + } + } + + CalamityUtils.CleanHoldStyle(player, itemRotation, itemPosition, itemSize, itemOrigin); + base.UseStyle(player, heldItemFrame); + } + + // Recoil + Not having the gun aim downwards + public override void UseItemFrame(Player player) + { + player.ChangeDir(Math.Sign((player.Calamity().mouseWorld - player.Center).X)); + + float animProgress = 1 - player.itemTime / (float)player.itemTimeMax; + float rotation = (player.Center - player.Calamity().mouseWorld).ToRotation() * player.gravDir + MathHelper.PiOver2; + if (animProgress < 0.5) + rotation += (player.altFunctionUse == 2 ? -1f : -0.45f) * (float)Math.Pow((0.5f - animProgress) / 0.5f, 2) * player.direction; + player.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, rotation); //must be here otherwise it will vibrate + + + //Reloads the gun + if (animProgress > 0.5f) + { + float backArmRotation = rotation + 0.52f * player.direction; + + Player.CompositeArmStretchAmount stretch = ((float)Math.Sin(MathHelper.Pi * (animProgress - 0.5f) / 0.36f)).ToStretchAmount(); + player.SetCompositeArmBack(true, stretch, backArmRotation); + } + + } + } +} diff --git a/Items/Weapons/Ranged/NitroExpressRifle.png b/Items/Weapons/Ranged/NitroExpressRifle.png new file mode 100644 index 0000000000..9211d84b7e Binary files /dev/null and b/Items/Weapons/Ranged/NitroExpressRifle.png differ diff --git a/Items/Weapons/Ranged/Norfleet.cs b/Items/Weapons/Ranged/Norfleet.cs index 6023f05a72..2f7500ee26 100644 --- a/Items/Weapons/Ranged/Norfleet.cs +++ b/Items/Weapons/Ranged/Norfleet.cs @@ -1,7 +1,9 @@ -using CalamityMod.Projectiles.Ranged; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Projectiles.Ranged; using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -11,39 +13,63 @@ namespace CalamityMod.Items.Weapons.Ranged public class Norfleet : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; + public int loadedShots = 3; + + public override void SetStaticDefaults() + { + ItemID.Sets.IsRangedSpecialistWeapon[Item.type] = true; + } public override void SetDefaults() { - Item.damage = 354; + Item.width = 140; + Item.height = 42; + Item.damage = 7077; Item.knockBack = 15f; Item.shootSpeed = 30f; Item.useStyle = ItemUseStyleID.Shoot; - Item.useAnimation = 75; - Item.useTime = 75; - Item.width = 140; - Item.height = 42; - Item.UseSound = SoundID.Item92; + Item.useAnimation = 70; + Item.useTime = 70; + Item.UseSound = null; Item.shoot = ModContent.ProjectileType(); - Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.rare = ModContent.RarityType(); Item.noMelee = true; Item.noUseGraphic = true; Item.DamageType = DamageClass.Ranged; Item.channel = true; - Item.useTurn = false; - Item.useAmmo = AmmoID.FallenStar; Item.autoReuse = true; } public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; - public override Vector2? HoldoutOffset() - { - return new Vector2(-10, 0); - } + // Makes the rotation of the mouse around the player sync in multiplayer. + public override void HoldItem(Player player) => player.Calamity().mouseRotationListener = 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.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), 0, 0f, player.whoAmI); + // Funny punishment for trying to cheeese with Norfleet + bool cheater = (player.Calamity().NorfleetCounter >= 3 && player.Calamity().NorfleetCounter < 1000); + if (player.Calamity().NorfleetCounter >= 1000) + loadedShots = 1; + + if (cheater) + { + SoundStyle fire = new("CalamityMod/Sounds/Item/NuhUhUh"); + SoundEngine.PlaySound(fire, player.Center); + } + + Projectile holdout = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0, (cheater ? 1000 : 0), loadedShots); + + // We set the rotation to the direction to the mouse so the first frame doesn't appear bugged out. + holdout.velocity = (player.Calamity().mouseWorld - player.MountedCenter).SafeNormalize(Vector2.Zero); + + player.Calamity().NorfleetCounter++; + loadedShots--; + + if (loadedShots <= 0) + { + loadedShots = 3; + } return false; } } diff --git a/Items/Weapons/Ranged/NullificationRifle.cs b/Items/Weapons/Ranged/NullificationPistol.cs similarity index 78% rename from Items/Weapons/Ranged/NullificationRifle.cs rename to Items/Weapons/Ranged/NullificationPistol.cs index e9b7326669..cca4e3d8c1 100644 --- a/Items/Weapons/Ranged/NullificationRifle.cs +++ b/Items/Weapons/Ranged/NullificationPistol.cs @@ -1,27 +1,33 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Ranged; +using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Ranged { - public class NullificationRifle : ModItem, ILocalizedModType + [LegacyName("NullificationRifle")] + public class NullificationPistol : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; + + public override void SetStaticDefaults() + { + ItemID.Sets.IsRangedSpecialistWeapon[Item.type] = true; + } public override void SetDefaults() { - Item.damage = 170; - Item.DamageType = DamageClass.Ranged; Item.width = 52; Item.height = 28; + Item.damage = 170; + Item.DamageType = DamageClass.Ranged; Item.useTime = 20; Item.useAnimation = 20; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 7f; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; Item.UseSound = SoundID.Item33; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/NullificationRifle.png b/Items/Weapons/Ranged/NullificationPistol.png similarity index 100% rename from Items/Weapons/Ranged/NullificationRifle.png rename to Items/Weapons/Ranged/NullificationPistol.png diff --git a/Items/Weapons/Ranged/OnyxChainBlaster.cs b/Items/Weapons/Ranged/OnyxChainBlaster.cs index e155ee4dd2..590aa09ec2 100644 --- a/Items/Weapons/Ranged/OnyxChainBlaster.cs +++ b/Items/Weapons/Ranged/OnyxChainBlaster.cs @@ -1,6 +1,6 @@ -using Terraria.DataStructures; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -11,17 +11,17 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() { - Item.damage = 51; - Item.DamageType = DamageClass.Ranged; Item.width = 64; Item.height = 32; + Item.damage = 51; + Item.DamageType = DamageClass.Ranged; Item.useTime = 15; Item.useAnimation = 15; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 4.5f; - Item.value = CalamityGlobalItem.Rarity10BuyPrice; - Item.rare = ItemRarityID.Red; + Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; + Item.rare = ItemRarityID.Purple; Item.UseSound = SoundID.Item36; Item.autoReuse = true; Item.shoot = ProjectileID.BlackBolt; diff --git a/Items/Weapons/Ranged/Onyxia.cs b/Items/Weapons/Ranged/Onyxia.cs index 7488e2ebe6..dd8f167c67 100644 --- a/Items/Weapons/Ranged/Onyxia.cs +++ b/Items/Weapons/Ranged/Onyxia.cs @@ -16,15 +16,15 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - Item.damage = 90; - Item.DamageType = DamageClass.Ranged; Item.width = 84; Item.height = 34; + Item.damage = 90; + Item.DamageType = DamageClass.Ranged; Item.useTime = Item.useAnimation = 10; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 4.5f; - Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item36; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/OpalStriker.cs b/Items/Weapons/Ranged/OpalStriker.cs index 0f1ce7f401..b7add585c2 100644 --- a/Items/Weapons/Ranged/OpalStriker.cs +++ b/Items/Weapons/Ranged/OpalStriker.cs @@ -1,10 +1,10 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Ranged; +using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Items.Weapons.Ranged { @@ -12,8 +12,8 @@ namespace CalamityMod.Items.Weapons.Ranged { public new string LocalizationCategory => "Items.Weapons.Ranged"; - public static readonly SoundStyle Charge = new("CalamityMod/Sounds/Item/OpalCharge") { Volume = 0.5f}; - public static readonly SoundStyle ChargeLoop = new("CalamityMod/Sounds/Item/OpalChargeLoop") { Volume = 0.5f}; + public static readonly SoundStyle Charge = new("CalamityMod/Sounds/Item/OpalCharge") { Volume = 0.5f }; + public static readonly SoundStyle ChargeLoop = new("CalamityMod/Sounds/Item/OpalChargeLoop") { Volume = 0.5f }; internal static readonly int ChargeLoopSoundFrames = 120; public static readonly SoundStyle Fire = new("CalamityMod/Sounds/Item/OpalFire") { PitchVariance = 0.4f, Volume = 0.3f }; public static readonly SoundStyle ChargedFire = new("CalamityMod/Sounds/Item/OpalChargedFire") { PitchVariance = 0.3f, Volume = 0.6f }; @@ -21,18 +21,22 @@ namespace CalamityMod.Items.Weapons.Ranged public static int AftershotCooldownFrames = 17; public static int FullChargeFrames = 88; + public override void SetStaticDefaults() + { + ItemID.Sets.IsRangedSpecialistWeapon[Item.type] = true; + } public override void SetDefaults() { - Item.damage = 37; - Item.DamageType = DamageClass.Ranged; Item.width = 48; Item.height = 24; + Item.damage = 33; + Item.DamageType = DamageClass.Ranged; Item.useTime = Item.useAnimation = AftershotCooldownFrames; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.noUseGraphic = true; Item.knockBack = 4f; - Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; Item.UseSound = null; Item.autoReuse = false; diff --git a/Items/Weapons/Ranged/OverloadedBlaster.cs b/Items/Weapons/Ranged/OverloadedBlaster.cs index 873af079aa..509277d994 100644 --- a/Items/Weapons/Ranged/OverloadedBlaster.cs +++ b/Items/Weapons/Ranged/OverloadedBlaster.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Ranged; +using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -12,15 +12,15 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() { - Item.damage = 19; - Item.DamageType = DamageClass.Ranged; Item.width = 42; Item.height = 34; - Item.useAnimation = Item.useTime = 22; + Item.damage = 19; + Item.DamageType = DamageClass.Ranged; + Item.useAnimation = Item.useTime = 28; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 1.5f; - Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; Item.UseSound = SoundID.Item9; Item.autoReuse = true; @@ -38,7 +38,7 @@ namespace CalamityMod.Items.Weapons.Ranged Vector2 newPos = position + velocity * 6f; for (int i = 0; i < 3; i++) { - Vector2 newVel = velocity.RotatedByRandom(MathHelper.ToRadians(15f)) * Main.rand.NextFloat(0.8f, 1.2f); + Vector2 newVel = velocity.RotatedByRandom(MathHelper.ToRadians(13f)) * Main.rand.NextFloat(0.8f, 1.2f); Projectile.NewProjectile(source, newPos, newVel, type, damage, knockback, player.whoAmI); } return false; diff --git a/Items/Weapons/Ranged/P90.cs b/Items/Weapons/Ranged/P90.cs index a855c5766d..0ffc14bb2c 100644 --- a/Items/Weapons/Ranged/P90.cs +++ b/Items/Weapons/Ranged/P90.cs @@ -1,11 +1,11 @@ -using Terraria.DataStructures; +using CalamityMod.Projectiles.Ranged; +using CalamityMod.Projectiles.Turret; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Projectiles.Ranged; -using Terraria.Audio; -using CalamityMod.Projectiles.Turret; namespace CalamityMod.Items.Weapons.Ranged { @@ -16,17 +16,17 @@ namespace CalamityMod.Items.Weapons.Ranged public bool fireShot = true; public override void SetDefaults() { - Item.damage = 5; - Item.DamageType = DamageClass.Ranged; Item.width = 60; Item.height = 28; + Item.damage = 5; + Item.DamageType = DamageClass.Ranged; Item.useTime = Item.useAnimation = 2; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 1.5f; - Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; - Item.UseSound = SoundID.Item11 with { Volume = 0.6f}; + Item.UseSound = SoundID.Item11 with { Volume = 0.6f }; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 9f; diff --git a/Items/Weapons/Ranged/PearlGod.cs b/Items/Weapons/Ranged/PearlGod.cs index 28688d5b84..458fc149e1 100644 --- a/Items/Weapons/Ranged/PearlGod.cs +++ b/Items/Weapons/Ranged/PearlGod.cs @@ -1,107 +1,163 @@ -using Terraria.DataStructures; +using CalamityMod.Particles; +using CalamityMod.Projectiles; +using System; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Rarities; +using CalamityMod.Items.Materials; namespace CalamityMod.Items.Weapons.Ranged { public class PearlGod : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; - private const int defaultSpread = 1; - private int spread = defaultSpread; - private bool finalShot = false; + public bool swapType = false; + public bool healVisual = false; public override void SetDefaults() { - Item.damage = 33; - Item.DamageType = DamageClass.Ranged; Item.width = 80; Item.height = 46; - Item.useTime = 20; - Item.useAnimation = 20; + Item.damage = 150; + Item.scale = 0.75f; + Item.DamageType = DamageClass.Ranged; + Item.useTime = 9; + Item.useAnimation = 9; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3f; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; - Item.rare = ItemRarityID.Yellow; + Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; + Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item41; Item.autoReuse = true; - Item.shootSpeed = 12f; - Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 14f; + Item.shoot = ProjectileID.PurificationPowder; Item.useAmmo = AmmoID.Bullet; Item.Calamity().canFirePointBlankShots = true; } - public override Vector2? HoldoutOffset() - { - return new Vector2(-5, 0); - } - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - if (spread > 6) + float itemRotation = player.compositeFrontArm.rotation + MathHelper.PiOver2 * player.gravDir; + Vector2 itemPosition = player.MountedCenter + itemRotation.ToRotationVector2() * 7f; + + if (Main.zenithWorld) { - spread = defaultSpread; - finalShot = true; + Projectile.NewProjectile(source, itemPosition + velocity.RotatedBy(-0.6 * player.direction) + velocity * 1.35f, velocity, ModContent.ProjectileType(), damage * 3, knockback * 5f, player.whoAmI, 0f, 10f); + return false; } - - float rotation = MathHelper.ToRadians(spread); - if (!finalShot) + // Pearl bullets + if (!swapType) { - int totalLoops = 1; - switch (spread) + for (int k = 0; k < 2; k++) { - case 1: - case 2: - break; - case 3: - case 4: - totalLoops = 2; - break; - case 5: - case 6: - totalLoops = 3; - break; + int randomColor = Main.rand.Next(1, 3 + 1); + Color color = randomColor == 1 ? Color.LightBlue : randomColor == 2 ? Color.LightPink : Color.Khaki; + SparkParticle spark = new SparkParticle(itemPosition + velocity.RotatedBy(-0.6 * player.direction) + velocity * 1.35f, velocity.RotatedByRandom(0.25) * Main.rand.NextFloat(0.2f, 1.5f), false, Main.rand.Next(20, 25 + 1), Main.rand.NextFloat(0.4f, 0.65f), color); + GeneralParticleHandler.SpawnParticle(spark); } - - for (int i = 0; i < totalLoops; i++) + for (int k = 0; k < 6; k++) { - int bullet1 = Projectile.NewProjectile(source, position, velocity.RotatedBy(-rotation * (i + 1)), type, (int)(damage * 0.5), knockback * 0.5f, player.whoAmI); - Main.projectile[bullet1].extraUpdates += spread; - int bullet2 = Projectile.NewProjectile(source, position, velocity.RotatedBy(+rotation * (i + 1)), type, (int)(damage * 0.5), knockback * 0.5f, player.whoAmI); - Main.projectile[bullet2].extraUpdates += spread; + int randomColor = Main.rand.Next(1, 3 + 1); + Color color = randomColor == 1 ? Color.LightBlue : randomColor == 2 ? Color.LightPink : Color.Khaki; + PearlParticle pearl1 = new PearlParticle(itemPosition + velocity.RotatedBy(-0.6 * player.direction) + velocity * 1.35f, velocity.RotatedByRandom(0.25) * Main.rand.NextFloat(0.2f, 1f), false, Main.rand.Next(40, 45 + 1), Main.rand.NextFloat(0.6f, 0.75f), color, 0.95f, Main.rand.NextFloat(1, -1), true); + GeneralParticleHandler.SpawnParticle(pearl1); } + int shotColor = Main.rand.Next(1, 3 + 1); + for (int k = 0; k < 3; k++) + { + Projectile pearlShot = Projectile.NewProjectileDirect(source, itemPosition + velocity.RotatedBy(-0.6 * player.direction) + velocity * 1.65f, velocity.RotatedBy(k == 0 ? 0 : k == 1 ? 0.025f : -0.025f), type, damage, knockback, player.whoAmI); + CalamityGlobalProjectile cgp = pearlShot.Calamity(); + if (shotColor == 1) + cgp.pearlBullet1 = true; // blue + if (shotColor == 2) + cgp.pearlBullet2 = true; // pink + if (shotColor == 3) + cgp.pearlBullet3 = true; // yellow - int shockblast = Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, spread); - Main.projectile[shockblast].extraUpdates += spread; + if (shotColor < 3) + shotColor++; + else + shotColor = 1; - spread++; + } } - else + // Life bullet + if (swapType) { - for (int i = 0; i < 3; i++) + for (int k = 0; k < 8; k++) { - int bigShockblast = Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage * 2, knockback * 2f, player.whoAmI, 0f, 10f); - Main.projectile[bigShockblast].extraUpdates += 9; + int randomColor = Main.rand.Next(1, 3 + 1); + Color color = randomColor == 1 ? Color.LightBlue : randomColor == 2 ? Color.LightPink : Color.Khaki; + Particle spark = new SparkParticle(itemPosition + velocity.RotatedBy(-0.6 * player.direction) + velocity * 1.35f, velocity.RotatedByRandom(0.25) * Main.rand.NextFloat(0.2f, 1.5f), false, Main.rand.Next(20, 25 + 1), Main.rand.NextFloat(0.4f, 0.65f), color); + GeneralParticleHandler.SpawnParticle(spark); } + for (int k = 0; (k < 13); k++) + { + int randomColor = Main.rand.Next(1, 3 + 1); + Color color = randomColor == 1 ? Color.LightBlue : randomColor == 2 ? Color.LightPink : Color.Khaki; - finalShot = false; + Dust dust2 = Dust.NewDustPerfect(itemPosition + velocity.RotatedBy(-0.6 * player.direction) + velocity * 1.35f, 278, velocity.RotatedByRandom(0.25) * Main.rand.NextFloat(0.1f, 0.9f)); + dust2.noGravity = true; + dust2.scale = Main.rand.NextFloat(0.3f, 0.45f); + dust2.color = color; + } + Projectile lifeShot = Projectile.NewProjectileDirect(source, itemPosition + velocity.RotatedBy(-0.6 * player.direction) - velocity * 0.65f, velocity, type, damage, knockback, player.whoAmI); + if (!healVisual) + { + CalamityGlobalProjectile cgp = lifeShot.Calamity(); + cgp.betterLifeBullet1 = true; + } + if (healVisual) + { + CalamityGlobalProjectile cgp = lifeShot.Calamity(); + cgp.betterLifeBullet2 = true; + } + healVisual = !healVisual; } + swapType = !swapType; return false; } + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + player.ChangeDir(Math.Sign((player.Calamity().mouseWorld - player.Center).X)); + float itemRotation = player.compositeFrontArm.rotation + MathHelper.PiOver2 * player.gravDir; + + Vector2 itemPosition = player.MountedCenter + itemRotation.ToRotationVector2() * 7f; + Vector2 itemSize = new Vector2(80, 46); + Vector2 itemOrigin = new Vector2(-24, 4); + + CalamityUtils.CleanHoldStyle(player, itemRotation, itemPosition, itemSize, itemOrigin); + + base.UseStyle(player, heldItemFrame); + } + + public override void UseItemFrame(Player player) + { + player.ChangeDir(Math.Sign((player.Calamity().mouseWorld - player.Center).X)); + + 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 += -0.03f * (float)Math.Pow((0.6f - animProgress) / 0.6f, 2) * player.direction; + + player.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, rotation); + } public override void AddRecipes() { CreateRecipe(). - AddIngredient(). - AddIngredient(ItemID.SpectreBar, 5). - AddIngredient(ItemID.ShroomiteBar, 5). - AddTile(TileID.MythrilAnvil). + AddIngredient(). + AddIngredient(5). + AddIngredient(2). + AddIngredient(ItemID.WhitePearl). + AddTile(TileID.LunarCraftingStation). Register(); } } diff --git a/Items/Weapons/Ranged/PestilentDefiler.cs b/Items/Weapons/Ranged/PestilentDefiler.cs index d21091f92f..7abf74ebcb 100644 --- a/Items/Weapons/Ranged/PestilentDefiler.cs +++ b/Items/Weapons/Ranged/PestilentDefiler.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Ranged; +using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -12,16 +12,16 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() { - Item.damage = 105; - Item.DamageType = DamageClass.Ranged; Item.width = 46; Item.height = 20; + Item.damage = 105; + Item.DamageType = DamageClass.Ranged; Item.useTime = 37; Item.useAnimation = 37; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 9.5f; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; Item.UseSound = SoundID.Item40; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/Phangasm.cs b/Items/Weapons/Ranged/Phangasm.cs index c7579fd42e..5f4e9d8ac4 100644 --- a/Items/Weapons/Ranged/Phangasm.cs +++ b/Items/Weapons/Ranged/Phangasm.cs @@ -16,9 +16,9 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() { - Item.damage = 160; Item.width = 48; Item.height = 82; + Item.damage = 87; Item.useTime = 12; Item.useAnimation = 12; Item.useStyle = ItemUseStyleID.Shoot; @@ -58,7 +58,7 @@ namespace CalamityMod.Items.Weapons.Ranged CreateRecipe(). AddIngredient(ItemID.Phantasm). AddIngredient(8). - AddIngredient(20). + AddIngredient(20). AddIngredient(20). AddTile(). Register(); diff --git a/Items/Weapons/Ranged/Photoviscerator.cs b/Items/Weapons/Ranged/Photoviscerator.cs index 2bf8005481..b65537e9bf 100644 --- a/Items/Weapons/Ranged/Photoviscerator.cs +++ b/Items/Weapons/Ranged/Photoviscerator.cs @@ -1,9 +1,10 @@ -using CalamityMod.Items.Materials; +using System.Linq; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; -using System.Linq; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; using Terraria.DataStructures; @@ -24,14 +25,14 @@ namespace CalamityMod.Items.Weapons.Ranged // Right-click stats public static float RightClickVelocityMult = 2.5f; - public static int RightClickCooldown = 20; + public static int RightClickCooldown = 30; public override void SetDefaults() { Item.width = 208; Item.height = 66; - Item.damage = 445; + Item.damage = 495; Item.DamageType = DamageClass.Ranged; Item.useTime = Item.useAnimation = LightBombCooldown; Item.shootSpeed = 6f; @@ -56,7 +57,7 @@ namespace CalamityMod.Items.Weapons.Ranged { if (player.whoAmI != Main.myPlayer) return; - + // Right-click channeling player.Calamity().rightClickListener = true; @@ -79,11 +80,16 @@ namespace CalamityMod.Items.Weapons.Ranged // The holdout will initially double up when right clicking otherwise if (player.altFunctionUse == 2f) return false; - + Projectile.NewProjectile(source, position, Vector2.Zero, type, 0, 0f, player.whoAmI); return false; } + 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/Ranged/PhotovisceratorGlow").Value); + } + public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Weapons/Ranged/PhotovisceratorGlow.png b/Items/Weapons/Ranged/PhotovisceratorGlow.png new file mode 100644 index 0000000000..90365e976f Binary files /dev/null and b/Items/Weapons/Ranged/PhotovisceratorGlow.png differ diff --git a/Items/Weapons/Ranged/PlagueTaintedSMG.cs b/Items/Weapons/Ranged/PlagueTaintedSMG.cs index 1a921fe0af..1eb3e132a5 100644 --- a/Items/Weapons/Ranged/PlagueTaintedSMG.cs +++ b/Items/Weapons/Ranged/PlagueTaintedSMG.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Ranged private const float Spread = 0.15f; public new string LocalizationCategory => "Items.Weapons.Ranged"; - + public override void SetStaticDefaults() { ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; @@ -25,15 +25,15 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - Item.damage = 76; - Item.DamageType = DamageClass.Ranged; Item.width = 98; Item.height = 50; + Item.damage = 78; + Item.DamageType = DamageClass.Ranged; Item.useTime = Item.useAnimation = 12; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2f; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; Item.Calamity().donorItem = true; Item.UseSound = SoundID.Item11; diff --git a/Items/Weapons/Ranged/PlanetaryAnnihilation.cs b/Items/Weapons/Ranged/PlanetaryAnnihilation.cs index 56c1ce7263..d06d34e907 100644 --- a/Items/Weapons/Ranged/PlanetaryAnnihilation.cs +++ b/Items/Weapons/Ranged/PlanetaryAnnihilation.cs @@ -1,9 +1,9 @@ -using Terraria.DataStructures; +using System; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -14,16 +14,16 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() { - Item.damage = 66; - Item.DamageType = DamageClass.Ranged; Item.width = 58; Item.height = 102; + Item.damage = 66; + Item.DamageType = DamageClass.Ranged; Item.useTime = 22; Item.useAnimation = 22; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5.5f; - Item.value = CalamityGlobalItem.Rarity11BuyPrice; + Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; Item.rare = ItemRarityID.Purple; Item.UseSound = SoundID.Item75; Item.autoReuse = true; @@ -101,7 +101,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { CreateRecipe(). - AddIngredient(). + AddIngredient(). AddIngredient(ItemID.DaedalusStormbow). AddIngredient(ItemID.LunarBar, 5). AddIngredient(5). diff --git a/Items/Weapons/Ranged/PolarisParrotfish.cs b/Items/Weapons/Ranged/PolarisParrotfish.cs index 99ef9cdeaf..45db5d8234 100644 --- a/Items/Weapons/Ranged/PolarisParrotfish.cs +++ b/Items/Weapons/Ranged/PolarisParrotfish.cs @@ -1,60 +1,160 @@ -using CalamityMod.CalPlayer; +using System; +using System.Collections.Generic; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.CalPlayer; +using CalamityMod.NPCs.NormalNPCs; +using CalamityMod.Projectiles.Boss; using CalamityMod.Projectiles.Ranged; +using CalamityMod.Sounds; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Sounds; +using static Humanizer.In; namespace CalamityMod.Items.Weapons.Ranged { public class PolarisParrotfish : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; + + public int SetUseTime = 6; + public int SetUseAnimation = 6; + public int ShotNumber = 0; + public bool Happy = false; + + public static readonly SoundStyle Shot = new("CalamityMod/Sounds/Item/PolarisShot") { Volume = 0.6f }; + public static readonly SoundStyle Squeak = new("CalamityMod/Sounds/Custom/CuteSqueak") { Volume = 0.75f }; public override void SetStaticDefaults() { - Item.staff[Item.type] = true; //so it doesn't look weird af when holding it + ItemID.Sets.IsRangedSpecialistWeapon[Item.type] = true; + Item.staff[Item.type] = true; //so it doesn't look weird af when holding it } public override void SetDefaults() { - Item.damage = 72; - Item.DamageType = DamageClass.Ranged; Item.width = 38; Item.height = 34; - Item.useTime = 21; - Item.useAnimation = 21; + Item.damage = 35; + Item.DamageType = DamageClass.Ranged; + + Item.useTime = SetUseTime; + Item.useAnimation = SetUseAnimation; + Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; - Item.knockBack = 2.25f; - Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.knockBack = 0.5f; + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; - Item.UseSound = CommonCalamitySounds.LaserCannonSound; //pew pew + Item.UseSound = null; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 15f; + Item.shootSpeed = 10f; } - + public override void ModifyTooltips(List list) => list.FindAndReplace("[GFB]", this.GetLocalizedValue(Main.zenithWorld ? "TooltipGFB" : "TooltipNormal")); + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] < 2; // Max of 2 shots on screen at once, get closer to fire faster + public override bool AltFunctionUse(Player player) => Main.zenithWorld ? true : false; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - CalamityPlayer modPlayer = player.Calamity(); - if (modPlayer.polarisBoostThree) //Homes in and explodes + if (Main.zenithWorld && player.altFunctionUse == 2) { - Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 2f); - return false; - } - else if (modPlayer.polarisBoostTwo) //Splits on enemy or tile hits - { - Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), (int)(damage * 1.25), knockback, player.whoAmI, 0f, 1f); - return false; - } - return true; - } + //GFB stuff + if (Happy && Main.rand.NextBool(50)) // If you pet her too much, you will regret it + { + Happy = false; + player.itemTime = 200; + player.itemAnimation = 200; + player.Calamity().GeneralScreenShakePower = 26f; + player.AddBuff(BuffID.Obstructed, 600); + Main.NewText("Too much love...", 255, 0, 0); + SoundEngine.PlaySound(Squeak with { Pitch = -1f }, player.Center); + SoundStyle roar = new("CalamityMod/Sounds/Custom/CeaselessVoidDeathBuild"); + SoundEngine.PlaySound(roar with { Pitch = 0.5f }, player.Center); + int theFuckening = ModContent.ProjectileType(); + int projDamage = 500; + int totalProjectiles = 50; + float radians = MathHelper.TwoPi / totalProjectiles; + Vector2 spinningPoint = Vector2.Normalize(new Vector2(-1f, -1f)); + for (int k = 0; k < totalProjectiles; k++) + { + Vector2 projVelocity = spinningPoint.RotatedBy(radians * k); + Projectile.NewProjectile(player.GetSource_FromThis(), player.Center + projVelocity * 2000, -projVelocity * 4, theFuckening, projDamage, 0f, Main.myPlayer); + } + } + else // Pet Polaris + { + SoundEngine.PlaySound(Squeak, player.Center); + CombatText.NewText(player.Hitbox, Color.Violet, "^-^"); + Happy = true; + switch (Main.rand.Next(1, 5 + 1)) + { + case 5: + Main.NewText("You give Polaris belly rubs", 72, 209, 204); + break; + case 4: + Main.NewText("You give Polaris a small treat", 72, 209, 204); + break; + case 3: + Main.NewText("You tell Polaris she's a good girl", 72, 209, 204); + break; + case 2: + Main.NewText("You let Polaris cuddle your arm", 72, 209, 204); + break; + default: + Main.NewText("You pet Polaris", 72, 209, 204); + break; + } - public override Vector2? HoldoutOrigin() //so it looks normal when holding - { - return new Vector2(10, 10); + for (int i = 0; i <= 6; i++) + { + Vector2 hVelocity = new Vector2(0, -4).RotateRandom(0.45); + hVelocity.X *= 0.66f; + hVelocity *= Main.rand.NextFloat(1f, 2f); + + int heart = Gore.NewGore(player.GetSource_FromThis(), player.Center + velocity * 4, hVelocity, 331, Main.rand.NextFloat(0.2f, 1.3f)); + Main.gore[heart].sticky = false; + Main.gore[heart].velocity *= 0.4f; + Main.gore[heart].velocity.Y -= 0.85f; + } + } + } + else + { + if (Happy) // If she's happy, fire much faster + { + Item.useTime = (int)(SetUseTime * 0.5f); + Item.useAnimation = (int)(SetUseAnimation * 0.5f); + } + else // Otherwise reset usetime + { + Item.useTime = SetUseTime; + Item.useAnimation = SetUseAnimation; + } + + if (Main.zenithWorld) // 1% chance to get tired when firing a projectile + { + if (Happy && Main.rand.NextBool(100)) + { + CombatText.NewText(player.Hitbox, Color.Violet, ">~<"); + Happy = false; + SoundEngine.PlaySound(Squeak with { Pitch = -0.6f }, player.Center); + } + else + SoundEngine.PlaySound(Shot, player.Center); + } + else + SoundEngine.PlaySound(Shot, player.Center); + + Projectile.NewProjectile(source, position + velocity * 5f, velocity.RotatedByRandom(0.05f), ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, ShotNumber); + + if (ShotNumber >= 2) // Cycle the shot color + ShotNumber = 0; + else + ShotNumber++; + } + return false; } } } diff --git a/Items/Weapons/Ranged/PridefulHuntersPlanarRipper.cs b/Items/Weapons/Ranged/PridefulHuntersPlanarRipper.cs index 80c4521c87..604367a05d 100644 --- a/Items/Weapons/Ranged/PridefulHuntersPlanarRipper.cs +++ b/Items/Weapons/Ranged/PridefulHuntersPlanarRipper.cs @@ -1,5 +1,5 @@ -using CalamityMod.Projectiles.Ranged; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -15,10 +15,10 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - Item.damage = 74; - Item.DamageType = DamageClass.Ranged; Item.width = 68; Item.height = 32; + Item.damage = 74; + Item.DamageType = DamageClass.Ranged; Item.useTime = 5; Item.useAnimation = 5; Item.autoReuse = true; @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useAmmo = AmmoID.Bullet; Item.shootSpeed = 15f; - Item.value = CalamityGlobalItem.Rarity11BuyPrice; + Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; Item.rare = ItemRarityID.Purple; Item.Calamity().donorItem = true; Item.Calamity().canFirePointBlankShots = true; @@ -61,12 +61,8 @@ namespace CalamityMod.Items.Weapons.Ranged CreateRecipe(). AddIngredient(). AddIngredient(ItemID.Uzi). - AddIngredient(). //This should be removed AddIngredient(ItemID.LunarBar, 5). AddIngredient(ItemID.FragmentVortex, 10). - AddIngredient(6). //This should be removed - AddIngredient(). // This should be removed - AddIngredient(25). // This should be removed AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Ranged/PristineFury.cs b/Items/Weapons/Ranged/PristineFury.cs index eb73a2cc53..056f567798 100644 --- a/Items/Weapons/Ranged/PristineFury.cs +++ b/Items/Weapons/Ranged/PristineFury.cs @@ -15,7 +15,6 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public int frameCounter = 0; public int frame = 0; - public static int BaseDamage = 80; public bool Trail = true; public override void SetStaticDefaults() @@ -25,10 +24,10 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - Item.damage = BaseDamage; - Item.DamageType = DamageClass.Ranged; Item.width = 100; Item.height = 46; + Item.damage = 80; + Item.DamageType = DamageClass.Ranged; Item.useTime = 3; Item.useAnimation = 15; Item.useStyle = ItemUseStyleID.Shoot; @@ -41,7 +40,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useAmmo = AmmoID.Gel; Item.consumeAmmoOnFirstShotOnly = true; - Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); } diff --git a/Items/Weapons/Ranged/Pumpler.cs b/Items/Weapons/Ranged/Pumpler.cs index b18c23e895..bf87eb6146 100644 --- a/Items/Weapons/Ranged/Pumpler.cs +++ b/Items/Weapons/Ranged/Pumpler.cs @@ -1,9 +1,9 @@ -using Terraria.DataStructures; +using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Projectiles.Ranged; namespace CalamityMod.Items.Weapons.Ranged { @@ -12,18 +12,23 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public const int MaxPumpkins = 5; + + public override void SetStaticDefaults() + { + ItemID.Sets.IsRangedSpecialistWeapon[Item.type] = true; + } public override void SetDefaults() { - Item.damage = 24; - Item.DamageType = DamageClass.Ranged; Item.width = 72; Item.height = 34; + Item.damage = 26; + Item.DamageType = DamageClass.Ranged; Item.useTime = 30; Item.useAnimation = 30; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 1.25f; - Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; Item.noUseGraphic = true; Item.UseSound = SoundID.Item20; diff --git a/Items/Weapons/Ranged/RealmRavager.cs b/Items/Weapons/Ranged/RealmRavager.cs index 42f0ea91aa..2f0bbf6805 100644 --- a/Items/Weapons/Ranged/RealmRavager.cs +++ b/Items/Weapons/Ranged/RealmRavager.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Ranged; +using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -12,16 +12,16 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() { - Item.damage = 50; - Item.DamageType = DamageClass.Ranged; Item.width = 76; Item.height = 32; + Item.damage = 50; + Item.DamageType = DamageClass.Ranged; Item.useTime = 22; Item.useAnimation = 22; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 4f; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; Item.UseSound = SoundID.Item38; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/ReedBlowgun.cs b/Items/Weapons/Ranged/ReedBlowgun.cs index 48c66ec8ae..fa3902328f 100644 --- a/Items/Weapons/Ranged/ReedBlowgun.cs +++ b/Items/Weapons/Ranged/ReedBlowgun.cs @@ -12,26 +12,26 @@ namespace CalamityMod.Items.Weapons.Ranged public class ReedBlowgun : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; - public static readonly SoundStyle BubbleBurstSound = new ("CalamityMod/Sounds/Custom/PistolShrimpBubbleBurst") { PitchVariance = 0.15f, Volume = 0.2f}; + public static readonly SoundStyle BubbleBurstSound = new("CalamityMod/Sounds/Custom/PistolShrimpBubbleBurst") { PitchVariance = 0.15f, Volume = 0.2f }; public override void SetStaticDefaults() { - + ItemID.Sets.IsRangedSpecialistWeapon[Item.type] = true; } public override void SetDefaults() { - Item.damage = 21; - Item.DamageType = DamageClass.Ranged; Item.width = 22; Item.height = 46; + Item.damage = 21; + Item.DamageType = DamageClass.Ranged; Item.useTime = 25; Item.useAnimation = 25; Item.useStyle = ItemUseStyleID.Shoot; Item.holdStyle = 16; Item.noMelee = true; Item.knockBack = 4.5f; - Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; Item.UseSound = null; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/RubicoPrime.cs b/Items/Weapons/Ranged/RubicoPrime.cs index bc5e37e28f..01025b4751 100644 --- a/Items/Weapons/Ranged/RubicoPrime.cs +++ b/Items/Weapons/Ranged/RubicoPrime.cs @@ -15,6 +15,8 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() { + Item.width = 82; + Item.height = 28; Item.damage = 1050; Item.DamageType = DamageClass.Ranged; Item.knockBack = 10f; @@ -24,14 +26,11 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; - Item.width = 82; - Item.height = 28; - Item.shoot = ProjectileID.PurificationPowder; Item.shootSpeed = 12f; Item.useAmmo = AmmoID.Bullet; - Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; Item.Calamity().canFirePointBlankShots = true; diff --git a/Items/Weapons/Ranged/SDFMG.cs b/Items/Weapons/Ranged/SDFMG.cs index 57488593a6..d6d7b2d767 100644 --- a/Items/Weapons/Ranged/SDFMG.cs +++ b/Items/Weapons/Ranged/SDFMG.cs @@ -16,10 +16,10 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() { - Item.damage = 100; - Item.DamageType = DamageClass.Ranged; Item.width = 74; Item.height = 34; + Item.damage = 100; + Item.DamageType = DamageClass.Ranged; Item.useTime = 2; Item.useAnimation = 2; Item.useStyle = ItemUseStyleID.Shoot; diff --git a/Items/Weapons/Ranged/SandstormGun.cs b/Items/Weapons/Ranged/SandstormGun.cs index 711290ae13..0a5727550b 100644 --- a/Items/Weapons/Ranged/SandstormGun.cs +++ b/Items/Weapons/Ranged/SandstormGun.cs @@ -1,8 +1,8 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -13,16 +13,16 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() { - Item.damage = 80; - Item.DamageType = DamageClass.Ranged; Item.width = 62; Item.height = 26; + Item.damage = 80; + Item.DamageType = DamageClass.Ranged; Item.useTime = 15; Item.useAnimation = 15; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5f; - Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; Item.UseSound = SoundID.Item11; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/ScorchedEarth.cs b/Items/Weapons/Ranged/ScorchedEarth.cs index a7fad3a57b..1a71fcc78e 100644 --- a/Items/Weapons/Ranged/ScorchedEarth.cs +++ b/Items/Weapons/Ranged/ScorchedEarth.cs @@ -19,18 +19,18 @@ namespace CalamityMod.Items.Weapons.Ranged private int counter = 0; public override void SetDefaults() { + Item.width = 104; + Item.height = 44; Item.damage = 500; Item.DamageType = DamageClass.Ranged; Item.useTime = 8; Item.useAnimation = 32; // 4 shots in just over half a second Item.reuseDelay = 60; // 1 second recharge Item.useLimitPerAnimation = 4; - Item.width = 104; - Item.height = 44; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 8.7f; - Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.rare = ModContent.RarityType(); Item.autoReuse = true; Item.shootSpeed = 12.6f; diff --git a/Items/Weapons/Ranged/Scorpio.cs b/Items/Weapons/Ranged/Scorpio.cs index 2af8610d1e..3f01345339 100644 --- a/Items/Weapons/Ranged/Scorpio.cs +++ b/Items/Weapons/Ranged/Scorpio.cs @@ -1,9 +1,12 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Ranged; +using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; namespace CalamityMod.Items.Weapons.Ranged { @@ -11,51 +14,70 @@ namespace CalamityMod.Items.Weapons.Ranged public class Scorpio : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; - public override void SetStaticDefaults() - { - ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; - } + + #region Other stats + + // Weapon stats. + public static int OriginalUseTime = 30; + public static int TimeBetweenBursts = 8; + public static int ProjectilesPerBurst = 8; + + // Small rocket stats. + public static float EnemyDetectionDistance = 2000f; + public static float TrackingSpeed = 0.06f; // VERY DELICATE VALUE, CHANGE SLOWLY. + + // Large rocket stats. + public static float NukeEnemyDistanceDetection = 300f; + public static float NukeRequiredRotationProximity = 0.96f; + public static float NukeTrackingSpeed = 0.0095f; // VERY DELICATE VALUE, CHANGE SLOWLY. + + #endregion + + public static readonly SoundStyle RocketShoot = new("CalamityMod/Sounds/Item/ScorpioShot") { Volume = 0.45f }; + public static readonly SoundStyle RocketHit = new("CalamityMod/Sounds/Item/ScorpioHit") { Volume = 0.35f }; + public static readonly SoundStyle NukeHit = new("CalamityMod/Sounds/Item/ScorpioNukeHit") { Volume = 0.6f }; public override void SetDefaults() { - Item.damage = 40; + Item.damage = 33; Item.DamageType = DamageClass.Ranged; - Item.width = 58; - Item.height = 26; - Item.useTime = 13; - Item.useAnimation = 13; - Item.useStyle = ItemUseStyleID.Shoot; - Item.noMelee = true; + Item.useTime = Item.useAnimation = OriginalUseTime; + Item.shoot = ProjectileType(); + Item.shootSpeed = 15f; Item.knockBack = 6.5f; - Item.value = CalamityGlobalItem.Rarity10BuyPrice; - Item.rare = ItemRarityID.Red; - Item.UseSound = SoundID.Item11; - Item.autoReuse = true; - Item.shootSpeed = 20f; - Item.shoot = ModContent.ProjectileType(); + + Item.width = 96; + Item.height = 42; + Item.noMelee = true; + Item.channel = true; + Item.noUseGraphic = true; Item.useAmmo = AmmoID.Rocket; + Item.value = CalamityGlobalItem.RarityRedBuyPrice; + Item.rare = ItemRarityID.Red; + Item.useStyle = ItemUseStyleID.Shoot; + Item.UseSound = new SoundStyle("CalamityMod/Sounds/Item/DudFire") with { Volume = .4f, Pitch = -.9f, PitchVariance = 0.1f }; } - public override Vector2? HoldoutOffset() => new Vector2(-20, 10); + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] == 0; - public override bool AltFunctionUse(Player player) => true; + // Spawning the holdout won't consume ammo. + public override bool CanConsumeAmmo(Item ammo, Player player) => player.ownedProjectileCounts[Item.shoot] != 0; - public override float UseSpeedMultiplier(Player player) => player.altFunctionUse == 2 ? 0.3333f : 1f; - - // Figure out which rocket is used - public int RocketType; - public override void OnConsumeAmmo(Item ammo, Player player) => RocketType = ammo.type; + // Makes the rotation of the mouse around the player sync in multiplayer. + public override void HoldItem(Player player) => player.Calamity().mouseRotationListener = true; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - if (player.altFunctionUse == 2) - Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), (int)(damage * 1.85), knockback * 2f, player.whoAmI, RocketType); - else - Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI, RocketType); + Projectile holdout = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, ProjectileType(), 0, 0f, player.whoAmI, -30); + + // We set the rotation to the direction to the mouse so the first frame doesn't appear bugged out. + holdout.velocity = (player.Calamity().mouseWorld - player.MountedCenter).SafeNormalize(Vector2.Zero); return false; } + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) => Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, Request("CalamityMod/Items/Weapons/Ranged/Scorpio_Glow").Value); + public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Weapons/Ranged/Scorpio_Glow.png b/Items/Weapons/Ranged/Scorpio_Glow.png new file mode 100644 index 0000000000..ad4c620482 Binary files /dev/null and b/Items/Weapons/Ranged/Scorpio_Glow.png differ diff --git a/Items/Weapons/Ranged/Seadragon.cs b/Items/Weapons/Ranged/Seadragon.cs index f89f67cf34..7c1dc1426b 100644 --- a/Items/Weapons/Ranged/Seadragon.cs +++ b/Items/Weapons/Ranged/Seadragon.cs @@ -1,9 +1,9 @@ -using CalamityMod.Items.Materials; +using System; +using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; using CalamityMod.Projectiles.Ranged; using CalamityMod.Rarities; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.Audio; using Terraria.DataStructures; @@ -22,16 +22,16 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - Item.damage = 60; - Item.DamageType = DamageClass.Ranged; Item.width = 90; Item.height = 38; + Item.damage = 60; + Item.DamageType = DamageClass.Ranged; Item.useTime = 5; Item.useAnimation = 5; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2.5f; - Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item11; Item.autoReuse = true; @@ -71,7 +71,7 @@ namespace CalamityMod.Items.Weapons.Ranged Projectile.NewProjectile(source, newPos, newVel * 1.2f, ModContent.ProjectileType(), rocketDamage, knockback, player.whoAmI); SoundEngine.PlaySound(SoundID.Item109, player.Center); } - + // Muzzle blasts are always directly in line with the gun's muzzle. if (muzzleBlast) { @@ -97,7 +97,7 @@ namespace CalamityMod.Items.Weapons.Ranged { CreateRecipe(). AddIngredient(). - AddIngredient(9). + AddIngredient(9). AddIngredient(3). AddIngredient(10). AddTile(TileID.LunarCraftingStation). diff --git a/Items/Weapons/Ranged/SeasSearing.cs b/Items/Weapons/Ranged/SeasSearing.cs index 79cc9ba272..c714e4e168 100644 --- a/Items/Weapons/Ranged/SeasSearing.cs +++ b/Items/Weapons/Ranged/SeasSearing.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Ranged; +using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -10,19 +10,19 @@ namespace CalamityMod.Items.Weapons.Ranged public class SeasSearing : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; - public static int BaseDamage = 40; public override void SetStaticDefaults() { - ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; + ItemID.Sets.IsRangedSpecialistWeapon[Item.type] = true; + ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; } public override void SetDefaults() { - Item.damage = BaseDamage; - Item.DamageType = DamageClass.Ranged; Item.width = 88; Item.height = 44; + Item.damage = 40; + Item.DamageType = DamageClass.Ranged; Item.useTime = 5; Item.useAnimation = 10; Item.reuseDelay = 16; @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 13f; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; } diff --git a/Items/Weapons/Ranged/SepticSkewer.cs b/Items/Weapons/Ranged/SepticSkewer.cs index 109d6e3860..739a0214ff 100644 --- a/Items/Weapons/Ranged/SepticSkewer.cs +++ b/Items/Weapons/Ranged/SepticSkewer.cs @@ -9,12 +9,17 @@ namespace CalamityMod.Items.Weapons.Ranged public class SepticSkewer : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; + + public override void SetStaticDefaults() + { + ItemID.Sets.IsRangedSpecialistWeapon[Item.type] = true; + } public override void SetDefaults() { - Item.damage = 272; - Item.DamageType = DamageClass.Ranged; Item.width = 46; Item.height = 24; + Item.damage = 272; + Item.DamageType = DamageClass.Ranged; Item.useTime = 12; Item.useAnimation = 12; Item.useStyle = ItemUseStyleID.Shoot; @@ -25,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shootSpeed = 20f; Item.shoot = ModContent.ProjectileType(); - Item.value = CalamityGlobalItem.Rarity13BuyPrice; + Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; Item.rare = ModContent.RarityType(); Item.Calamity().canFirePointBlankShots = true; } diff --git a/Items/Weapons/Ranged/Shadethrower.cs b/Items/Weapons/Ranged/Shadethrower.cs index af4bccaec2..a212cfe9d1 100644 --- a/Items/Weapons/Ranged/Shadethrower.cs +++ b/Items/Weapons/Ranged/Shadethrower.cs @@ -12,17 +12,17 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() { - Item.damage = 21; - Item.DamageType = DamageClass.Ranged; Item.width = 76; Item.height = 30; + Item.damage = 23; + Item.DamageType = DamageClass.Ranged; Item.useTime = 10; Item.useAnimation = 30; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 1.5f; Item.UseSound = SoundID.Item34; - Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Ranged/Shellshooter.cs b/Items/Weapons/Ranged/Shellshooter.cs index be05a1f18a..bca4b94f92 100644 --- a/Items/Weapons/Ranged/Shellshooter.cs +++ b/Items/Weapons/Ranged/Shellshooter.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Ranged; +using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -12,16 +12,16 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() { - Item.damage = 40; - Item.DamageType = DamageClass.Ranged; Item.width = 30; Item.height = 38; + Item.damage = 40; + Item.DamageType = DamageClass.Ranged; Item.useTime = 70; Item.useAnimation = 70; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 6f; - Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; Item.UseSound = SoundID.Item5; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/Shredder.cs b/Items/Weapons/Ranged/Shredder.cs index b39984c764..6665770842 100644 --- a/Items/Weapons/Ranged/Shredder.cs +++ b/Items/Weapons/Ranged/Shredder.cs @@ -1,8 +1,8 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -18,23 +18,23 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - Item.damage = 24; - Item.DamageType = DamageClass.Ranged; Item.width = 56; Item.height = 24; + Item.damage = 31; + Item.DamageType = DamageClass.Ranged; Item.useTime = 4; - Item.useAnimation = 32; - Item.reuseDelay = 12; + Item.useAnimation = 24; + Item.reuseDelay = 20; Item.useLimitPerAnimation = 8; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 1.5f; - Item.value = CalamityGlobalItem.Rarity11BuyPrice; + Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; Item.rare = ItemRarityID.Purple; Item.UseSound = SoundID.Item31; Item.autoReuse = true; Item.shoot = ProjectileID.Bullet; - Item.shootSpeed = 12f; + Item.shootSpeed = 9f; Item.useAmmo = AmmoID.Bullet; Item.Calamity().canFirePointBlankShots = true; } @@ -48,27 +48,29 @@ namespace CalamityMod.Items.Weapons.Ranged int bulletAmt = 4; if (player.altFunctionUse == 2) { - 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++) { - float SpeedX = velocity.X + Main.rand.Next(-30, 31) * 0.05f; - float SpeedY = velocity.Y + Main.rand.Next(-30, 31) * 0.05f; - int shot = Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI, 0f, 0f); + 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; } - return false; } else { - for (int index = 0; index < bulletAmt; ++index) + Vector2 newPosition = position + velocity.SafeNormalize(Vector2.UnitY) * 50f; + Vector2 cachedVelocity = velocity; + for (int index = 0; index < bulletAmt; index++) { - float SpeedX = velocity.X + Main.rand.Next(-30, 31) * 0.05f; - float SpeedY = velocity.Y + Main.rand.Next(-30, 31) * 0.05f; - int shredderBoltDamage = (int)(0.85f * damage); - int shot = Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), shredderBoltDamage, knockback, player.whoAmI, 0f, 0f); - Main.projectile[shot].timeLeft = 180; + 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; } - return false; } + return false; } public override void AddRecipes() diff --git a/Items/Weapons/Ranged/Shroomer.cs b/Items/Weapons/Ranged/Shroomer.cs index 3da3e50fb8..4d103f929b 100644 --- a/Items/Weapons/Ranged/Shroomer.cs +++ b/Items/Weapons/Ranged/Shroomer.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Ranged; +using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -12,16 +12,16 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() { - Item.damage = 150; - Item.DamageType = DamageClass.Ranged; Item.width = 90; Item.height = 28; + Item.damage = 150; + Item.DamageType = DamageClass.Ranged; Item.useTime = 35; Item.useAnimation = 35; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 9.75f; - Item.value = CalamityGlobalItem.Rarity10BuyPrice; + Item.value = CalamityGlobalItem.RarityRedBuyPrice; Item.rare = ItemRarityID.Red; Item.UseSound = SoundID.Item40; Item.autoReuse = true; @@ -36,6 +36,8 @@ namespace CalamityMod.Items.Weapons.Ranged public override Vector2? HoldoutOffset() => new Vector2(-25, 0); + public override void HoldItem(Player player) => player.scope = 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, ModContent.ProjectileType(), (int)(damage * 0.5), knockback, player.whoAmI); diff --git a/Items/Weapons/Ranged/SlagMagnum.cs b/Items/Weapons/Ranged/SlagMagnum.cs index 5b099e6328..4005da80e6 100644 --- a/Items/Weapons/Ranged/SlagMagnum.cs +++ b/Items/Weapons/Ranged/SlagMagnum.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Ranged; +using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -12,16 +12,16 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() { - Item.damage = 24; - Item.DamageType = DamageClass.Ranged; Item.width = 58; Item.height = 24; + Item.damage = 24; + Item.DamageType = DamageClass.Ranged; Item.useTime = 15; Item.useAnimation = 15; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 4f; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item41; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/SomaPrime.cs b/Items/Weapons/Ranged/SomaPrime.cs index 5e4953c113..95ac291e2e 100644 --- a/Items/Weapons/Ranged/SomaPrime.cs +++ b/Items/Weapons/Ranged/SomaPrime.cs @@ -17,10 +17,10 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - Item.damage = 370; - Item.DamageType = DamageClass.Ranged; Item.width = 94; Item.height = 34; + Item.damage = 400; + Item.DamageType = DamageClass.Ranged; Item.useTime = Item.useAnimation = 5; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shootSpeed = 9f; Item.useAmmo = AmmoID.Bullet; - Item.value = CalamityGlobalItem.Rarity16BuyPrice; + Item.value = CalamityGlobalItem.RarityHotPinkBuyPrice; Item.rare = ModContent.RarityType(); Item.Calamity().devItem = true; Item.Calamity().canFirePointBlankShots = true; @@ -44,7 +44,8 @@ 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 (type == ProjectileID.Bullet) { + if (type == ProjectileID.Bullet) + { type = ProjectileID.BulletHighVelocity; damage += 4; // in 1.4, HVBs deal 11 damage and Musket Balls deal 7 } @@ -54,7 +55,7 @@ namespace CalamityMod.Items.Weapons.Ranged Vector2 vel = velocity; Projectile shot = Projectile.NewProjectileDirect(source, position, vel, type, damage, knockback, player.whoAmI); CalamityGlobalProjectile cgp = shot.Calamity(); - cgp.supercritHits = -1; + cgp.supercritHits = -1; cgp.appliesSomaShred = true; return false; } diff --git a/Items/Weapons/Ranged/SparkSpreader.cs b/Items/Weapons/Ranged/SparkSpreader.cs index b51195521a..8b292401c2 100644 --- a/Items/Weapons/Ranged/SparkSpreader.cs +++ b/Items/Weapons/Ranged/SparkSpreader.cs @@ -11,6 +11,8 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() { + Item.width = 56; + Item.height = 26; Item.damage = 10; Item.knockBack = 1f; Item.DamageType = DamageClass.Ranged; @@ -22,12 +24,10 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shootSpeed = 6f; Item.shoot = ModContent.ProjectileType(); - Item.width = 56; - Item.height = 26; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.UseSound = SoundID.Item34; - Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.rare = ItemRarityID.Blue; } diff --git a/Items/Weapons/Ranged/SpectralstormCannon.cs b/Items/Weapons/Ranged/SpectralstormCannon.cs index dcb93d7cda..fc161fa028 100644 --- a/Items/Weapons/Ranged/SpectralstormCannon.cs +++ b/Items/Weapons/Ranged/SpectralstormCannon.cs @@ -1,9 +1,9 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Rogue; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using Microsoft.Xna.Framework; namespace CalamityMod.Items.Weapons.Ranged { @@ -12,16 +12,16 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() { - Item.damage = 48; - Item.DamageType = DamageClass.Ranged; Item.width = 66; Item.height = 26; + Item.damage = 48; + Item.DamageType = DamageClass.Ranged; Item.useTime = 4; Item.useAnimation = 12; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 1.5f; - Item.value = CalamityGlobalItem.Rarity10BuyPrice; + Item.value = CalamityGlobalItem.RarityRedBuyPrice; Item.rare = ItemRarityID.Red; Item.UseSound = SoundID.Item11; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/SpeedBlaster.cs b/Items/Weapons/Ranged/SpeedBlaster.cs index 59c4a6efcd..83a303c0bb 100644 --- a/Items/Weapons/Ranged/SpeedBlaster.cs +++ b/Items/Weapons/Ranged/SpeedBlaster.cs @@ -1,9 +1,9 @@ -using CalamityMod.CalPlayer; +using System; +using CalamityMod.CalPlayer; using CalamityMod.CalPlayer.Dashes; using CalamityMod.Particles; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.Audio; using Terraria.DataStructures; @@ -30,17 +30,21 @@ namespace CalamityMod.Items.Weapons.Ranged public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(DashCooldown / 60); + public override void SetStaticDefaults() + { + ItemID.Sets.IsRangedSpecialistWeapon[Item.type] = true; + } public override void SetDefaults() { - Item.damage = 40; - Item.DamageType = DamageClass.Ranged; Item.width = 52; Item.height = 30; + Item.damage = 40; + Item.DamageType = DamageClass.Ranged; Item.useTime = Item.useAnimation = 10; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2.25f; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = Shot; Item.autoReuse = true; @@ -51,7 +55,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool AltFunctionUse(Player player) => true; public override bool CanUseItem(Player player) { - if (player.Calamity().SpeedBlasterDashDelayCooldown > 0 && player.altFunctionUse == 2) + if (player.HasCooldown(Cooldowns.SpeedBlasterBoost.ID) && player.altFunctionUse == 2) { SoundEngine.PlaySound(Empty, player.Center); return false; @@ -63,14 +67,14 @@ namespace CalamityMod.Items.Weapons.Ranged public override Vector2? HoldoutOffset() => new Vector2(-1, -6); // Increased fire rate after dashing - public override float UseSpeedMultiplier(Player player) => player.Calamity().SpeedBlasterDashDelayCooldown > 0 ? FireRatePowerup : 1f; + public override float UseSpeedMultiplier(Player player) => player.HasCooldown(Cooldowns.SpeedBlasterBoost.ID) ? FireRatePowerup : 1f; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { // Reposition all shots to the gun's tip Vector2 newPos = position + new Vector2(38f, player.direction * (Math.Abs(velocity.SafeNormalize(Vector2.Zero).X) < 0.02f ? -2f : -8f)).RotatedBy(velocity.ToRotation()); // Big dashing shot - if (player.altFunctionUse == 2 && player.Calamity().SpeedBlasterDashDelayCooldown == 0) + if (player.altFunctionUse == 2 && !(player.HasCooldown(Cooldowns.SpeedBlasterBoost.ID))) { // Switches the color of the next shots, including this one if (ColorValue >= 4f) @@ -81,7 +85,7 @@ namespace CalamityMod.Items.Weapons.Ranged Projectile.NewProjectile(source, newPos, velocity, type, (int)(damage * DashShotDamageMult), knockback, player.whoAmI, ColorValue, 3f); // Activate the dash and cooldown - player.Calamity().SpeedBlasterDashDelayCooldown = DashCooldown; + player.AddCooldown(Cooldowns.SpeedBlasterBoost.ID, DashCooldown); player.Calamity().sBlasterDashActivated = true; // If moving, emit particles to signal the dash @@ -98,8 +102,8 @@ namespace CalamityMod.Items.Weapons.Ranged } // Add inaccuracy to regular shots; powered up shots are more accurate - Vector2 newVel = velocity.RotatedByRandom(MathHelper.ToRadians(player.Calamity().SpeedBlasterDashDelayCooldown > 0 ? 3f : 15f)); - float ShotMode = player.Calamity().SpeedBlasterDashDelayCooldown > 0 ? 2f : 0f; + Vector2 newVel = velocity.RotatedByRandom(MathHelper.ToRadians(player.HasCooldown(Cooldowns.SpeedBlasterBoost.ID) ? 3f : 15f)); + float ShotMode = player.HasCooldown(Cooldowns.SpeedBlasterBoost.ID) ? 2f : 0f; Projectile.NewProjectile(source, newPos, newVel, type, damage, knockback, player.whoAmI, ColorValue, ShotMode); return false; } diff --git a/Items/Weapons/Ranged/Spyker.cs b/Items/Weapons/Ranged/Spyker.cs index 5413cfda71..52c0aa0e0a 100644 --- a/Items/Weapons/Ranged/Spyker.cs +++ b/Items/Weapons/Ranged/Spyker.cs @@ -14,16 +14,16 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() { - Item.damage = 210; - Item.DamageType = DamageClass.Ranged; Item.width = 44; Item.height = 26; + Item.damage = 210; + Item.DamageType = DamageClass.Ranged; Item.useTime = 13; Item.useAnimation = 13; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 6f; - Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item108; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/StarSputter.cs b/Items/Weapons/Ranged/StarSputter.cs index 7358436448..b121ad2ba7 100644 --- a/Items/Weapons/Ranged/StarSputter.cs +++ b/Items/Weapons/Ranged/StarSputter.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Ranged; +using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -14,10 +14,10 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - Item.damage = 138; - Item.DamageType = DamageClass.Ranged; Item.width = 80; Item.height = 26; + Item.damage = 138; + Item.DamageType = DamageClass.Ranged; Item.useTime = 8; Item.useAnimation = 24; Item.reuseDelay = 15; diff --git a/Items/Weapons/Ranged/Starfleet.cs b/Items/Weapons/Ranged/Starfleet.cs index 28f752ecb9..debf9c5790 100644 --- a/Items/Weapons/Ranged/Starfleet.cs +++ b/Items/Weapons/Ranged/Starfleet.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Ranged; +using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -12,17 +12,17 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() { - Item.damage = 56; - Item.DamageType = DamageClass.Ranged; Item.width = 76; Item.height = 36; + Item.damage = 63; + Item.DamageType = DamageClass.Ranged; Item.useTime = 55; Item.useAnimation = 55; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 15f; - Item.value = CalamityGlobalItem.Rarity10BuyPrice; - Item.rare = ItemRarityID.Red; + Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; + Item.rare = ItemRarityID.Purple; Item.UseSound = SoundID.Item92; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Ranged/Starmada.cs b/Items/Weapons/Ranged/Starmada.cs index 2648427cd8..b70b3820c5 100644 --- a/Items/Weapons/Ranged/Starmada.cs +++ b/Items/Weapons/Ranged/Starmada.cs @@ -17,13 +17,13 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() { + Item.width = 122; + Item.height = 50; Item.damage = 135; Item.knockBack = 15f; Item.shootSpeed = 16f; Item.useStyle = ItemUseStyleID.Shoot; Item.useTime = Item.useAnimation = 27; - Item.width = 122; - Item.height = 50; Item.UseSound = SoundID.Item92; Item.shoot = ModContent.ProjectileType(); Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; diff --git a/Items/Weapons/Ranged/Starmageddon.cs b/Items/Weapons/Ranged/Starmageddon.cs index 59015b2587..0b704e77ac 100644 --- a/Items/Weapons/Ranged/Starmageddon.cs +++ b/Items/Weapons/Ranged/Starmageddon.cs @@ -16,15 +16,20 @@ namespace CalamityMod.Items.Weapons.Ranged { public new string LocalizationCategory => "Items.Weapons.Ranged"; + public override void SetStaticDefaults() + { + ItemID.Sets.IsRangedSpecialistWeapon[Item.type] = true; + } + public override void SetDefaults() { + Item.width = 166; + Item.height = 62; Item.damage = 100; Item.knockBack = 4f; Item.shootSpeed = 16f; Item.useStyle = ItemUseStyleID.Shoot; Item.useTime = Item.useAnimation = 30; - Item.width = 166; - Item.height = 62; Item.UseSound = null; Item.shoot = ModContent.ProjectileType(); Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; diff --git a/Items/Weapons/Ranged/StellarCannon.cs b/Items/Weapons/Ranged/StellarCannon.cs index 61f7ce7e19..c35aae9dab 100644 --- a/Items/Weapons/Ranged/StellarCannon.cs +++ b/Items/Weapons/Ranged/StellarCannon.cs @@ -9,25 +9,33 @@ namespace CalamityMod.Items.Weapons.Ranged public class StellarCannon : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; + + public override void SetStaticDefaults() + { + ItemID.Sets.IsRangedSpecialistWeapon[Item.type] = true; + } public override void SetDefaults() { - Item.damage = 175; - Item.DamageType = DamageClass.Ranged; Item.width = 50; Item.height = 30; + Item.damage = 182; + Item.DamageType = DamageClass.Ranged; Item.useTime = 40; Item.useAnimation = 40; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 7f; - Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; Item.UseSound = SoundID.Item92; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 2f; + Item.shootSpeed = 3f; } + // Terraria seems to really dislike high crit values in SetDefaults + public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 16; + public override Vector2? HoldoutOffset() { return new Vector2(-5, 0); diff --git a/Items/Weapons/Ranged/StormDragoon.cs b/Items/Weapons/Ranged/StormDragoon.cs index 82f8822c18..9e9c0301dc 100644 --- a/Items/Weapons/Ranged/StormDragoon.cs +++ b/Items/Weapons/Ranged/StormDragoon.cs @@ -12,10 +12,10 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() { - Item.damage = 96; - Item.DamageType = DamageClass.Ranged; Item.width = 74; Item.height = 34; + Item.damage = 96; + Item.DamageType = DamageClass.Ranged; Item.useTime = 2; Item.useAnimation = 20; Item.reuseDelay = 10; @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3.25f; - Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item31; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/StormSurge.cs b/Items/Weapons/Ranged/StormSurge.cs index 5fe6576486..a55535b3a7 100644 --- a/Items/Weapons/Ranged/StormSurge.cs +++ b/Items/Weapons/Ranged/StormSurge.cs @@ -11,19 +11,24 @@ namespace CalamityMod.Items.Weapons.Ranged public class StormSurge : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; + + public override void SetStaticDefaults() + { + ItemID.Sets.IsRangedSpecialistWeapon[Item.type] = true; + } public override void SetDefaults() { - Item.damage = 18; - Item.DamageType = DamageClass.Ranged; Item.width = 58; Item.height = 22; + Item.damage = 18; + Item.DamageType = DamageClass.Ranged; Item.useTime = 18; Item.useAnimation = 18; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5f; Item.UseSound = SoundID.Item122; - Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; Item.autoReuse = true; //GRRRRRRRRRRRRRRRR false begone Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Ranged/SulphuricAcidCannon.cs b/Items/Weapons/Ranged/SulphuricAcidCannon.cs index dc5a25b6e7..36c41d54c0 100644 --- a/Items/Weapons/Ranged/SulphuricAcidCannon.cs +++ b/Items/Weapons/Ranged/SulphuricAcidCannon.cs @@ -9,12 +9,17 @@ namespace CalamityMod.Items.Weapons.Ranged public class SulphuricAcidCannon : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; + + public override void SetStaticDefaults() + { + ItemID.Sets.IsRangedSpecialistWeapon[Item.type] = true; + } public override void SetDefaults() { - Item.damage = 144; - Item.DamageType = DamageClass.Ranged; Item.width = 90; Item.height = 30; + Item.damage = 144; + Item.DamageType = DamageClass.Ranged; Item.useTime = 18; Item.useAnimation = 18; Item.useStyle = ItemUseStyleID.Shoot; diff --git a/Items/Weapons/Ranged/SurgeDriver.cs b/Items/Weapons/Ranged/SurgeDriver.cs index c8c490052d..5dc40527ab 100644 --- a/Items/Weapons/Ranged/SurgeDriver.cs +++ b/Items/Weapons/Ranged/SurgeDriver.cs @@ -18,10 +18,10 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - Item.damage = 140; - Item.DamageType = DamageClass.Ranged; Item.width = 164; Item.height = 58; + Item.damage = 140; + Item.DamageType = DamageClass.Ranged; Item.useTime = Item.useAnimation = 28; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; diff --git a/Items/Weapons/Ranged/Svantechnical.cs b/Items/Weapons/Ranged/Svantechnical.cs index 8fa8a9ba9a..efb03041fc 100644 --- a/Items/Weapons/Ranged/Svantechnical.cs +++ b/Items/Weapons/Ranged/Svantechnical.cs @@ -1,8 +1,8 @@ -using CalamityMod.Items.Materials; +using System; +using CalamityMod.Items.Materials; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -15,10 +15,10 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() { + Item.width = 60; + Item.height = 26; Item.damage = 150; Item.DamageType = DamageClass.Ranged; - Item.width = 60; - Item.height = 26; Item.useTime = 2; Item.useAnimation = 24; Item.reuseDelay = 10; @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.noMelee = true; Item.knockBack = 3.5f; - Item.value = CalamityGlobalItem.Rarity16BuyPrice; + Item.value = CalamityGlobalItem.RarityHotPinkBuyPrice; Item.rare = ModContent.RarityType(); Item.Calamity().devItem = true; @@ -38,10 +38,9 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useAmmo = AmmoID.Bullet; } - public override Vector2? HoldoutOffset() - { - return new Vector2(-5, 0); - } + 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) { diff --git a/Items/Weapons/Ranged/TelluricGlare.cs b/Items/Weapons/Ranged/TelluricGlare.cs index 3ae39fc31a..95485b137b 100644 --- a/Items/Weapons/Ranged/TelluricGlare.cs +++ b/Items/Weapons/Ranged/TelluricGlare.cs @@ -12,10 +12,10 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() { - Item.damage = 216; - Item.DamageType = DamageClass.Ranged; Item.width = 54; Item.height = 92; + Item.damage = 216; + Item.DamageType = DamageClass.Ranged; Item.useTime = 5; Item.useAnimation = 20; Item.reuseDelay = 23; @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; - Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item102; diff --git a/Items/Weapons/Ranged/TerraFlameburster.png b/Items/Weapons/Ranged/TerraFlameburster.png deleted file mode 100644 index 6dd46e5f7a..0000000000 Binary files a/Items/Weapons/Ranged/TerraFlameburster.png and /dev/null differ diff --git a/Items/Weapons/Ranged/TheBallista.cs b/Items/Weapons/Ranged/TheBallista.cs index 7885f8d7da..f6219b4d3e 100644 --- a/Items/Weapons/Ranged/TheBallista.cs +++ b/Items/Weapons/Ranged/TheBallista.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Ranged; +using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -12,16 +12,16 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() { - Item.damage = 108; - Item.DamageType = DamageClass.Ranged; Item.width = 40; Item.height = 70; + Item.damage = 108; + Item.DamageType = DamageClass.Ranged; Item.useTime = 22; Item.useAnimation = 22; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 8f; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; Item.UseSound = SoundID.Item5; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/TheHive.cs b/Items/Weapons/Ranged/TheHive.cs index dea035d6b0..2092626a5c 100644 --- a/Items/Weapons/Ranged/TheHive.cs +++ b/Items/Weapons/Ranged/TheHive.cs @@ -1,52 +1,66 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Ranged; +using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; namespace CalamityMod.Items.Weapons.Ranged { public class TheHive : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; + + public static int OriginalUseTime = 34; + public override void SetDefaults() { - Item.damage = 60; + Item.damage = 92; Item.DamageType = DamageClass.Ranged; - Item.width = 62; - Item.height = 30; - Item.useTime = 34; - Item.useAnimation = 34; - Item.useStyle = ItemUseStyleID.Shoot; - Item.noMelee = true; - Item.knockBack = 3.5f; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; - Item.rare = ItemRarityID.Yellow; - Item.UseSound = SoundID.Item61; - Item.autoReuse = true; - Item.shoot = ModContent.ProjectileType(); + Item.useTime = Item.useAnimation = OriginalUseTime; + Item.shoot = ProjectileType(); Item.shootSpeed = 13f; + Item.knockBack = 3.5f; + + Item.width = 66; + Item.height = 30; + Item.noMelee = true; + Item.autoReuse = true; + Item.channel = true; + Item.noUseGraphic = true; Item.useAmmo = AmmoID.Rocket; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; + Item.rare = ItemRarityID.Yellow; + Item.useStyle = ItemUseStyleID.Shoot; + Item.UseSound = new SoundStyle("CalamityMod/Sounds/Item/DudFire") with { Volume = .4f, Pitch = -.9f, PitchVariance = 0.1f }; } - public override Vector2? HoldoutOffset() => new Vector2(-10, 0); + // Terraria seems to really dislike high crit values in SetDefaults + public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 16; - // Figure out which rocket is used - public int RocketType; - public override void OnConsumeAmmo(Item ammo, Player player) => RocketType = ammo.type; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] == 0; + + // Spawning the holdout won't consume ammo. + public override bool CanConsumeAmmo(Item ammo, Player player) => player.ownedProjectileCounts[Item.shoot] != 0; + + // Makes the rotation of the mouse around the player sync in multiplayer. + public override void HoldItem(Player player) => player.Calamity().mouseRotationListener = true; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - int rocket = Utils.SelectRandom(Main.rand, new int[] - { - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType() - }); - Projectile.NewProjectile(source, position, velocity, rocket, damage, knockback, player.whoAmI, RocketType); + Item.channel = true; + + Projectile holdout = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, ProjectileType(), 0, 0f, player.whoAmI); + + // We set the rotation to the direction to the mouse so the first frame doesn't appear bugged out. + holdout.velocity = (player.Calamity().mouseWorld - player.MountedCenter).SafeNormalize(Vector2.Zero); + return false; } + + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) => Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, Request(Texture + "_Glow").Value); } } diff --git a/Items/Weapons/Ranged/TheHive_Glow.png b/Items/Weapons/Ranged/TheHive_Glow.png new file mode 100644 index 0000000000..a1b2898a18 Binary files /dev/null and b/Items/Weapons/Ranged/TheHive_Glow.png differ diff --git a/Items/Weapons/Ranged/TheJailor.cs b/Items/Weapons/Ranged/TheJailor.cs index 341c75b789..7cb4df516e 100644 --- a/Items/Weapons/Ranged/TheJailor.cs +++ b/Items/Weapons/Ranged/TheJailor.cs @@ -13,10 +13,10 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() { - Item.damage = 300; - Item.DamageType = DamageClass.Ranged; Item.width = 102; Item.height = 70; + Item.damage = 235; + Item.DamageType = DamageClass.Ranged; Item.useTime = Item.useAnimation = 28; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.UseSound = SoundID.Item14; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 14.5f; + Item.shootSpeed = 20f; Item.useAmmo = AmmoID.Bullet; } diff --git a/Items/Weapons/Ranged/TheMaelstrom.cs b/Items/Weapons/Ranged/TheMaelstrom.cs index 80cb5cf902..f00ed388bd 100644 --- a/Items/Weapons/Ranged/TheMaelstrom.cs +++ b/Items/Weapons/Ranged/TheMaelstrom.cs @@ -15,14 +15,14 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() { - Item.damage = 530; Item.width = 20; Item.height = 12; + Item.damage = 530; Item.useTime = 45; Item.useAnimation = 45; Item.useStyle = ItemUseStyleID.Shoot; Item.knockBack = 3f; - Item.value = CalamityGlobalItem.Rarity13BuyPrice; + Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; Item.rare = ModContent.RarityType(); Item.noMelee = true; Item.noUseGraphic = true; diff --git a/Items/Weapons/Ranged/ThePack.cs b/Items/Weapons/Ranged/ThePack.cs index be130e1ae0..97cbdb97e5 100644 --- a/Items/Weapons/Ranged/ThePack.cs +++ b/Items/Weapons/Ranged/ThePack.cs @@ -15,10 +15,10 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() { - Item.damage = 1000; - Item.DamageType = DamageClass.Ranged; Item.width = 96; Item.height = 40; + Item.damage = 1000; + Item.DamageType = DamageClass.Ranged; Item.useTime = 52; Item.useAnimation = 52; Item.useStyle = ItemUseStyleID.Shoot; @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shoot = ModContent.ProjectileType(); Item.useAmmo = AmmoID.Rocket; - Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; } diff --git a/Items/Weapons/Ranged/TheSevensStriker.cs b/Items/Weapons/Ranged/TheSevensStriker.cs index 8e096e6b91..745e017d1c 100644 --- a/Items/Weapons/Ranged/TheSevensStriker.cs +++ b/Items/Weapons/Ranged/TheSevensStriker.cs @@ -13,8 +13,8 @@ namespace CalamityMod.Items.Weapons.Ranged public class TheSevensStriker : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; - public static readonly SoundStyle RouletteSound = new("CalamityMod/Sounds/Item/SevensStrikerRoulette") { Volume = 0.6f, SoundLimitBehavior = SoundLimitBehavior.ReplaceOldest}; - public static readonly SoundStyle RouletteTickSound = new("CalamityMod/Sounds/Item/SevensStrikerRouletteTick") { Volume = 0.5f}; + public static readonly SoundStyle RouletteSound = new("CalamityMod/Sounds/Item/SevensStrikerRoulette") { Volume = 0.6f, SoundLimitBehavior = SoundLimitBehavior.ReplaceOldest }; + public static readonly SoundStyle RouletteTickSound = new("CalamityMod/Sounds/Item/SevensStrikerRouletteTick") { Volume = 0.5f }; public static readonly SoundStyle BustSound = new("CalamityMod/Sounds/Item/SevensStrikerBust"); public static readonly SoundStyle DoublesSound = new("CalamityMod/Sounds/Item/SevensStrikerDoubles"); public static readonly SoundStyle TriplesSound = new("CalamityMod/Sounds/Item/SevensStrikerTriples"); @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Weapons.Ranged public static int ShotCoin = 0; // projectile ID to use for right click, affects damage multiplier public static readonly float RightClickCopperMultiplier = 0.04f; public static readonly float RightClickSilverMultiplier = 0.08f; - public static readonly float RightClickGoldMultiplier = 0.16f; + public static readonly float RightClickGoldMultiplier = 0.16f; public static readonly float DoublesMultiplier = 1f; // Unfortunately doubles can't be doubles. Balancing! public static readonly float TriplesCherryMultiplier = 1f; @@ -39,6 +39,8 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { + Item.width = 170; + Item.height = 56; Item.damage = 777; Item.knockBack = 9f; Item.useTime = 30; @@ -48,13 +50,11 @@ namespace CalamityMod.Items.Weapons.Ranged Item.channel = true; Item.useTurn = true; Item.autoReuse = true; - Item.width = 170; - Item.height = 56; Item.useStyle = ItemUseStyleID.Shoot; Item.useAmmo = AmmoID.Coin; Item.shootSpeed = 24f; Item.shoot = ProjectileID.PlatinumCoin; - Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; } diff --git a/Items/Weapons/Ranged/TheStorm.cs b/Items/Weapons/Ranged/TheStorm.cs index a2b44e1444..b9fd74ee14 100644 --- a/Items/Weapons/Ranged/TheStorm.cs +++ b/Items/Weapons/Ranged/TheStorm.cs @@ -1,7 +1,7 @@ -using CalamityMod.Projectiles.Ranged; +using System; +using CalamityMod.Projectiles.Ranged; using CalamityMod.Rarities; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -13,23 +13,23 @@ namespace CalamityMod.Items.Weapons.Ranged { public new string LocalizationCategory => "Items.Weapons.Ranged"; - public override void SetStaticDefaults() - { + public override void SetStaticDefaults() + { ItemID.Sets.AnimatesAsSoul[Type] = true; - Main.RegisterItemAnimation(Type, new DrawAnimationVertical(5, 9)); - } + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(5, 9)); + } public override void SetDefaults() { - Item.damage = 35; - Item.DamageType = DamageClass.Ranged; Item.width = 54; Item.height = 90; + Item.damage = 35; + Item.DamageType = DamageClass.Ranged; Item.useTime = 7; Item.useAnimation = 14; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3.5f; - Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item122; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/ThermoclineBlaster.cs b/Items/Weapons/Ranged/ThermoclineBlaster.cs new file mode 100644 index 0000000000..fd64420f39 --- /dev/null +++ b/Items/Weapons/Ranged/ThermoclineBlaster.cs @@ -0,0 +1,122 @@ +using System; +using CalamityMod.Items.Materials; +using CalamityMod.Particles; +using CalamityMod.Projectiles; +using Microsoft.CodeAnalysis; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Ranged +{ + [LegacyName("CursedCapper")] + public class ThermoclineBlaster : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Weapons.Ranged"; + public bool swapType = false; + public override void SetDefaults() + { + Item.width = 60; + Item.height = 40; + Item.scale = 0.75f; + Item.damage = 45; + Item.DamageType = DamageClass.Ranged; + Item.useTime = 16; + Item.useAnimation = 16; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 2.25f; + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; + Item.rare = ItemRarityID.LightRed; + Item.UseSound = SoundID.Item41; + Item.autoReuse = true; + Item.shootSpeed = 12f; + Item.shoot = ProjectileID.PurificationPowder; + Item.useAmmo = AmmoID.Bullet; + Item.Calamity().canFirePointBlankShots = true; + } + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + { + float itemRotation = player.compositeFrontArm.rotation + MathHelper.PiOver2 * player.gravDir; + + Vector2 itemPosition = player.MountedCenter + itemRotation.ToRotationVector2() * 7f; + + // Ice bullet + if (!swapType) + { + for (int k = 0; k < 8; k++) + { + CritSpark spark = new CritSpark(itemPosition + velocity.RotatedBy(-0.6 * player.direction) + velocity * 0.5f, velocity.RotatedByRandom(0.25) * Main.rand.NextFloat(0.2f, 1.5f), Main.rand.NextBool() ? Color.DeepSkyBlue : Color.LightSkyBlue, Color.White, Main.rand.NextFloat(0.3f, 0.7f), Main.rand.Next(10, 15 + 1), Main.rand.NextFloat(-2f, 2f), 1.5f); + GeneralParticleHandler.SpawnParticle(spark); + } + Projectile iceShot = Projectile.NewProjectileDirect(source, itemPosition + velocity.RotatedBy(-0.6 * player.direction) - velocity * 0.5f, velocity, type, damage, knockback, player.whoAmI); + CalamityGlobalProjectile cgp = iceShot.Calamity(); + cgp.iceBullet = true; + } + // Fire bullet + if (swapType) + { + for (int k = 0; k < 8; k++) + { + CritSpark spark = new CritSpark(itemPosition + velocity.RotatedBy(-0.6 * player.direction) + velocity * 0.5f, velocity.RotatedByRandom(0.25) * Main.rand.NextFloat(0.2f, 1.5f), Main.rand.NextBool() ? Color.Orange : Color.OrangeRed, Color.Yellow, Main.rand.NextFloat(0.3f, 0.7f), Main.rand.Next(10, 15 + 1), Main.rand.NextFloat(-2f, 2f), 1.5f); + GeneralParticleHandler.SpawnParticle(spark); + } + Projectile fireShot = Projectile.NewProjectileDirect(source, itemPosition + velocity.RotatedBy(-0.6 * player.direction) - velocity * 0.5f, velocity, type, damage, knockback, player.whoAmI); + CalamityGlobalProjectile cgp = fireShot.Calamity(); + cgp.fireBullet = true; + } + for (int k = 0; k < 4; k++) + { + Vector2 spawnPosition = itemPosition + velocity.RotatedBy(-0.6 * player.direction) + velocity * 0.5f; + Vector2 smokeVel = velocity.RotatedByRandom(0.25) * Main.rand.NextFloat(0.2f, 1f); + Particle smoke = new HeavySmokeParticle(spawnPosition, smokeVel, Color.White, Main.rand.Next(40, 60 + 1), Main.rand.NextFloat(0.2f, 0.45f), 0.5f, Main.rand.NextFloat(-0.2f, 0.2f), Main.rand.NextBool(), required: true); + GeneralParticleHandler.SpawnParticle(smoke); + + Dust dust = Dust.NewDustPerfect(spawnPosition, 303, smokeVel.RotatedByRandom(0.15f), 80, default, Main.rand.NextFloat(0.25f, 1f)); + dust.noGravity = false; + dust.color = Color.White; + } + + swapType = !swapType; + return false; + } + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + player.ChangeDir(Math.Sign((player.Calamity().mouseWorld - player.Center).X)); + float itemRotation = player.compositeFrontArm.rotation + MathHelper.PiOver2 * player.gravDir; + + Vector2 itemPosition = player.MountedCenter + itemRotation.ToRotationVector2() * 7f; + Vector2 itemSize = new Vector2(60, 40); + Vector2 itemOrigin = new Vector2(-24, 3); + + CalamityUtils.CleanHoldStyle(player, itemRotation, itemPosition, itemSize, itemOrigin); + + base.UseStyle(player, heldItemFrame); + } + + public override void UseItemFrame(Player player) + { + player.ChangeDir(Math.Sign((player.Calamity().mouseWorld - player.Center).X)); + + 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 += -0.05f * (float)Math.Pow((0.6f - animProgress) / 0.6f, 2) * player.direction; + + player.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, rotation); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.PhoenixBlaster). + AddIngredient(5). + AddIngredient(5). + AddTile(TileID.Anvils). + Register(); + } + } +} diff --git a/Items/Weapons/Ranged/ThermoclineBlaster.png b/Items/Weapons/Ranged/ThermoclineBlaster.png new file mode 100644 index 0000000000..fdd7e29268 Binary files /dev/null and b/Items/Weapons/Ranged/ThermoclineBlaster.png differ diff --git a/Items/Weapons/Ranged/TitaniumRailgun.cs b/Items/Weapons/Ranged/TitaniumRailgun.cs index 87112b0399..02fd415f1e 100644 --- a/Items/Weapons/Ranged/TitaniumRailgun.cs +++ b/Items/Weapons/Ranged/TitaniumRailgun.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Ranged; +using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -10,19 +10,24 @@ namespace CalamityMod.Items.Weapons.Ranged public class TitaniumRailgun : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; + + public override void SetStaticDefaults() + { + ItemID.Sets.IsRangedSpecialistWeapon[Item.type] = true; + } public override void SetDefaults() { - Item.damage = 370; - Item.DamageType = DamageClass.Ranged; Item.width = 62; Item.height = 32; + Item.damage = 370; + Item.DamageType = DamageClass.Ranged; Item.useTime = 26; Item.useAnimation = 26; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.channel = true; Item.knockBack = 5f; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item77 with { Volume = SoundID.Item77.Volume * 0.7f }; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/Toxibow.cs b/Items/Weapons/Ranged/Toxibow.cs index 6661d05861..a9c20c62dc 100644 --- a/Items/Weapons/Ranged/Toxibow.cs +++ b/Items/Weapons/Ranged/Toxibow.cs @@ -1,9 +1,9 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -14,15 +14,15 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() { - Item.damage = 15; - Item.DamageType = DamageClass.Ranged; Item.width = 26; Item.height = 54; + Item.damage = 15; + Item.DamageType = DamageClass.Ranged; Item.useTime = Item.useAnimation = 28; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3f; - Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; Item.UseSound = SoundID.Item5; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/TyrannysEnd.cs b/Items/Weapons/Ranged/TyrannysEnd.cs index b248eee6d2..2dec620a10 100644 --- a/Items/Weapons/Ranged/TyrannysEnd.cs +++ b/Items/Weapons/Ranged/TyrannysEnd.cs @@ -15,6 +15,8 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() { + Item.width = 150; + Item.height = 48; Item.damage = 2000; Item.knockBack = 9.5f; Item.DamageType = DamageClass.Ranged; @@ -25,13 +27,10 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useAmmo = AmmoID.Bullet; Item.autoReuse = true; - Item.width = 150; - Item.height = 48; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.UseSound = CommonCalamitySounds.LargeWeaponFireSound; - - Item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; Item.Calamity().canFirePointBlankShots = true; @@ -42,6 +41,8 @@ namespace CalamityMod.Items.Weapons.Ranged public override Vector2? HoldoutOffset() => new Vector2(-28, 0); + public override void HoldItem(Player player) => player.scope = true; + public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Weapons/Ranged/TyrannysEnd.png b/Items/Weapons/Ranged/TyrannysEnd.png index df8a87b0f9..35335871e6 100644 Binary files a/Items/Weapons/Ranged/TyrannysEnd.png and b/Items/Weapons/Ranged/TyrannysEnd.png differ diff --git a/Items/Weapons/Ranged/Ultima.cs b/Items/Weapons/Ranged/Ultima.cs index d11aefbf3f..0565b2e6e6 100644 --- a/Items/Weapons/Ranged/Ultima.cs +++ b/Items/Weapons/Ranged/Ultima.cs @@ -17,10 +17,10 @@ namespace CalamityMod.Items.Weapons.Ranged public const float FullChargeTime = 420f; public override void SetDefaults() { - Item.damage = 116; - Item.DamageType = DamageClass.Ranged; Item.width = 44; Item.height = 58; + Item.damage = 150; + Item.DamageType = DamageClass.Ranged; Item.useTime = Item.useAnimation = 8; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useTurn = false; Item.autoReuse = true; Item.noUseGraphic = true; - Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; Item.Calamity().canFirePointBlankShots = true; @@ -53,7 +53,7 @@ namespace CalamityMod.Items.Weapons.Ranged AddIngredient(ItemID.PulseBow). AddIngredient(ItemID.LaserRifle). AddIngredient(). - AddIngredient(). + AddIngredient(). AddIngredient(15). AddIngredient(8). AddIngredient(8). diff --git a/Items/Weapons/Ranged/UniversalGenesis.cs b/Items/Weapons/Ranged/UniversalGenesis.cs index 16b8d0c3ff..0526d67ad4 100644 --- a/Items/Weapons/Ranged/UniversalGenesis.cs +++ b/Items/Weapons/Ranged/UniversalGenesis.cs @@ -1,10 +1,10 @@ -using CalamityMod.Items.Accessories; +using System; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -17,6 +17,8 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() { + Item.width = 158; + Item.height = 60; Item.damage = 192; Item.DamageType = DamageClass.Ranged; Item.useTime = Item.useAnimation = 26; @@ -27,12 +29,10 @@ namespace CalamityMod.Items.Weapons.Ranged Item.autoReuse = true; Item.Calamity().canFirePointBlankShots = true; - Item.width = 158; - Item.height = 60; Item.noMelee = true; Item.UseSound = SoundID.Item38; Item.useStyle = ItemUseStyleID.Shoot; - Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; Item.Calamity().canFirePointBlankShots = true; diff --git a/Items/Weapons/Ranged/CosmicBolter.cs b/Items/Weapons/Ranged/VernalBolter.cs similarity index 75% rename from Items/Weapons/Ranged/CosmicBolter.cs rename to Items/Weapons/Ranged/VernalBolter.cs index ba41de68c0..fca73e5091 100644 --- a/Items/Weapons/Ranged/CosmicBolter.cs +++ b/Items/Weapons/Ranged/VernalBolter.cs @@ -1,37 +1,44 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Ranged { - public class CosmicBolter : ModItem, ILocalizedModType + [LegacyName("CosmicBolter")] + public class VernalBolter : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() { + Item.width = 68; + Item.height = 94; Item.damage = 48; Item.DamageType = DamageClass.Ranged; - Item.width = 40; - Item.height = 76; Item.useTime = 20; Item.useAnimation = 20; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2.75f; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; Item.UseSound = SoundID.Item75; Item.autoReuse = true; - Item.shoot = ModContent.ProjectileType(); + Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; Item.useAmmo = AmmoID.Arrow; Item.Calamity().canFirePointBlankShots = true; } + 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/Ranged/VernalBolterGlow").Value); + } + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo spawnSource, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { Vector2 source = player.RotatedRelativePoint(player.MountedCenter, true); @@ -49,7 +56,7 @@ namespace CalamityMod.Items.Weapons.Ranged offset -= velocity; if (CalamityUtils.CheckWoodenAmmo(type, player)) - Projectile.NewProjectile(spawnSource, source + offset, velocity, ModContent.ProjectileType(), (int)(damage * 1.2), knockback * 1.2f, player.whoAmI); + Projectile.NewProjectile(spawnSource, source + offset, velocity, ModContent.ProjectileType(), (int)(damage * 1.2), knockback * 1.2f, player.whoAmI); else { int proj = Projectile.NewProjectile(spawnSource, source + offset, velocity, type, damage, knockback, player.whoAmI); diff --git a/Items/Weapons/Ranged/VernalBolter.png b/Items/Weapons/Ranged/VernalBolter.png new file mode 100644 index 0000000000..8776adf492 Binary files /dev/null and b/Items/Weapons/Ranged/VernalBolter.png differ diff --git a/Items/Weapons/Ranged/VernalBolterGlow.png b/Items/Weapons/Ranged/VernalBolterGlow.png new file mode 100644 index 0000000000..d7f6ef8efe Binary files /dev/null and b/Items/Weapons/Ranged/VernalBolterGlow.png differ diff --git a/Items/Weapons/Ranged/Voidragon.cs b/Items/Weapons/Ranged/Voidragon.cs index bcb07e6912..d1077a7bd5 100644 --- a/Items/Weapons/Ranged/Voidragon.cs +++ b/Items/Weapons/Ranged/Voidragon.cs @@ -19,14 +19,14 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { // Long live Megafleet. You will be missed. Maybe one day we can revive you. - } + } public override void SetDefaults() { - Item.damage = 240; - Item.DamageType = DamageClass.Ranged; Item.width = 96; Item.height = 38; + Item.damage = 240; + Item.DamageType = DamageClass.Ranged; Item.useTime = 5; Item.useAnimation = 5; Item.useStyle = ItemUseStyleID.Shoot; @@ -38,7 +38,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shootSpeed = 18f; Item.useAmmo = AmmoID.Bullet; - Item.value = CalamityGlobalItem.Rarity16BuyPrice; + Item.value = CalamityGlobalItem.RarityHotPinkBuyPrice; Item.rare = ModContent.RarityType(); Item.Calamity().devItem = true; Item.Calamity().canFirePointBlankShots = true; diff --git a/Items/Weapons/Ranged/Vortexpopper.cs b/Items/Weapons/Ranged/Vortexpopper.cs index 361a17f5f3..fdf74ca9a2 100644 --- a/Items/Weapons/Ranged/Vortexpopper.cs +++ b/Items/Weapons/Ranged/Vortexpopper.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; +using System; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -12,16 +12,16 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() { - Item.damage = 30; - Item.DamageType = DamageClass.Ranged; Item.width = 92; Item.height = 36; + Item.damage = 30; + Item.DamageType = DamageClass.Ranged; Item.useTime = 21; Item.useAnimation = 21; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3.25f; - Item.value = CalamityGlobalItem.Rarity10BuyPrice; + Item.value = CalamityGlobalItem.RarityRedBuyPrice; Item.rare = ItemRarityID.Red; Item.UseSound = SoundID.Item95; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/TerraFlameburster.cs b/Items/Weapons/Ranged/WildfireBloom.cs similarity index 70% rename from Items/Weapons/Ranged/TerraFlameburster.cs rename to Items/Weapons/Ranged/WildfireBloom.cs index ae353fb655..b6c2286b1a 100644 --- a/Items/Weapons/Ranged/TerraFlameburster.cs +++ b/Items/Weapons/Ranged/WildfireBloom.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -8,29 +9,30 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Ranged { - public class TerraFlameburster : ModItem, ILocalizedModType + [LegacyName("TerraFlameburster")] + public class WildfireBloom : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; public int FlareCounter = 0; - public int TerraUseTime = 8; + public int WildfireUseTime = 8; public override void SetDefaults() { + Item.width = 114; + Item.height = 58; Item.damage = 78; Item.DamageType = DamageClass.Ranged; - Item.width = 68; - Item.height = 22; - Item.useTime = TerraUseTime; - Item.useAnimation = TerraUseTime; + Item.useTime = WildfireUseTime; + Item.useAnimation = WildfireUseTime; Item.useStyle = ItemUseStyleID.Shoot; Item.noUseGraphic = true; Item.noMelee = true; Item.knockBack = 3.25f; - Item.value = CalamityGlobalItem.Rarity9BuyPrice; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; Item.autoReuse = true; - Item.shoot = ModContent.ProjectileType(); + Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; Item.useAmmo = AmmoID.Gel; Item.channel = true; @@ -38,7 +40,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override Vector2? HoldoutOffset() => new Vector2(-10, 0); public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; - + // Spawning the holdout cannot consume ammo public override bool CanConsumeAmmo(Item ammo, 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) @@ -47,6 +49,11 @@ namespace CalamityMod.Items.Weapons.Ranged return false; } + 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/Ranged/WildfireBloomGlow").Value); + } + public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Weapons/Ranged/WildfireBloom.png b/Items/Weapons/Ranged/WildfireBloom.png new file mode 100644 index 0000000000..e256d3828d Binary files /dev/null and b/Items/Weapons/Ranged/WildfireBloom.png differ diff --git a/Items/Weapons/Ranged/WildfireBloomGlow.png b/Items/Weapons/Ranged/WildfireBloomGlow.png new file mode 100644 index 0000000000..7d3ba2d37f Binary files /dev/null and b/Items/Weapons/Ranged/WildfireBloomGlow.png differ diff --git a/Items/Weapons/Ranged/WulfrumBlunderbuss.cs b/Items/Weapons/Ranged/WulfrumBlunderbuss.cs index 5534fe6345..69d9acf480 100644 --- a/Items/Weapons/Ranged/WulfrumBlunderbuss.cs +++ b/Items/Weapons/Ranged/WulfrumBlunderbuss.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Ranged public static readonly SoundStyle ShootSound = new("CalamityMod/Sounds/Item/WulfrumBlunderbussFire") { PitchVariance = 0.1f }; public static readonly SoundStyle ShootAndReloadSound = new("CalamityMod/Sounds/Item/WulfrumBlunderbussFireAndReload") { PitchVariance = 0.1f }; - public static float MinSpreadDistance = 460f; + public static float MinSpreadDistance = 460f; public static float MaxSpreadDistance = 60f; public static float MinSpread = 0.2f; public static float MaxSpread = 0.6f; @@ -33,17 +33,17 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { + Item.width = 23; + Item.height = 8; Item.damage = 11; Item.ArmorPenetration = 3; Item.DamageType = DamageClass.Ranged; - Item.width = 23; - Item.height = 8; Item.useTime = 55; Item.useAnimation = 55; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2.25f; - Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.rare = ItemRarityID.Blue; Item.UseSound = ShootSound; Item.autoReuse = false; @@ -57,7 +57,7 @@ namespace CalamityMod.Items.Weapons.Ranged player.Calamity().mouseWorldListener = true; } - public override bool CanUseItem(Player player) => storedScrap > 0 || (player.HasItem(ModContent.ItemType()) || player.HasItem(ItemID.SilverCoin)); + public override bool CanUseItem(Player player) => storedScrap > 0 || (player.HasItem(ModContent.ItemType()) || player.HasItem(ItemID.SilverCoin)); public override void UseAnimation(Player player) { @@ -184,7 +184,7 @@ namespace CalamityMod.Items.Weapons.Ranged Register(); } - public override void OnCreated (ItemCreationContext context) + public override void OnCreated(ItemCreationContext context) { if (context is RecipeItemCreationContext) storedScrap = ShotsPerScrap; diff --git a/Items/Weapons/Rogue/AcidicRainBarrel.cs b/Items/Weapons/Rogue/AcidicRainBarrel.cs index 4e60c84b41..162324b036 100644 --- a/Items/Weapons/Rogue/AcidicRainBarrel.cs +++ b/Items/Weapons/Rogue/AcidicRainBarrel.cs @@ -1,8 +1,8 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 8f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 14f; @@ -31,10 +31,10 @@ namespace CalamityMod.Items.Weapons.Rogue } public override void ModifyStatsExtra(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) - { - position = position - Vector2.UnitY * 12f; - velocity.Y *= 0.667f; - } + { + position = position - Vector2.UnitY * 12f; + velocity.Y *= 0.667f; + } 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/Rogue/AdamantiteThrowingAxe.cs b/Items/Weapons/Rogue/AdamantiteThrowingAxe.cs index 16a155e200..bd12133a97 100644 --- a/Items/Weapons/Rogue/AdamantiteThrowingAxe.cs +++ b/Items/Weapons/Rogue/AdamantiteThrowingAxe.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue @@ -16,16 +16,16 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { Item.width = 30; - Item.damage = 64; + Item.height = 40; + Item.damage = 67; Item.noMelee = true; Item.consumable = true; Item.noUseGraphic = true; - Item.useAnimation = Item.useTime = 12; + Item.useAnimation = Item.useTime = 14; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 3.25f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 40; Item.maxStack = 9999; Item.value = 1600; Item.rare = ItemRarityID.LightRed; @@ -34,16 +34,16 @@ namespace CalamityMod.Items.Weapons.Rogue Item.DamageType = RogueDamageClass.Instance; } + public override float StealthVelocityMultiplier => 1.3f; + public override float StealthDamageMultiplier => 1.2f; + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) { int stealth = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (stealth.WithinBounds(Main.maxProjectiles)) - { Main.projectile[stealth].Calamity().stealthStrike = true; - Main.projectile[stealth].usesLocalNPCImmunity = true; - } return false; } return true; diff --git a/Items/Weapons/Rogue/AlphaVirus.cs b/Items/Weapons/Rogue/AlphaVirus.cs index 9a9f4da5b3..2cedc925c2 100644 --- a/Items/Weapons/Rogue/AlphaVirus.cs +++ b/Items/Weapons/Rogue/AlphaVirus.cs @@ -13,8 +13,9 @@ namespace CalamityMod.Items.Weapons.Rogue { public override void SetDefaults() { - Item.damage = 333; Item.width = 44; + Item.height = 44; + Item.damage = 248; Item.noMelee = true; Item.noUseGraphic = true; Item.useAnimation = 31; @@ -23,12 +24,11 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 1f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 44; Item.maxStack = 1; - Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 4f; - Item.rare = ModContent.RarityType(); + Item.rare = ItemRarityID.Purple; Item.DamageType = RogueDamageClass.Instance; } @@ -49,7 +49,7 @@ namespace CalamityMod.Items.Weapons.Rogue { CreateRecipe(). AddIngredient(). - AddIngredient(5). + AddIngredient(ItemID.LunarBar, 5). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Rogue/Apoctolith.cs b/Items/Weapons/Rogue/Apoctolith.cs index 41efb691bd..a2227f99dc 100644 --- a/Items/Weapons/Rogue/Apoctolith.cs +++ b/Items/Weapons/Rogue/Apoctolith.cs @@ -1,10 +1,10 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -14,16 +14,16 @@ namespace CalamityMod.Items.Weapons.Rogue { public override void SetDefaults() { - Item.damage = 220; - Item.shootSpeed = 18f; - Item.shoot = ModContent.ProjectileType(); Item.width = 66; Item.height = 64; - Item.useTime = 30; - Item.useAnimation = 30; + Item.damage = 228; + Item.shootSpeed = 18f; + Item.shoot = ModContent.ProjectileType(); + Item.useTime = 26; + Item.useAnimation = 26; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 10f; - Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; Item.UseSound = SoundID.Item1; Item.noMelee = true; @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Weapons.Rogue // Terraria seems to really dislike high crit values in SetDefaults public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 20; - public override float StealthDamageMultiplier => 1.25f; + public override float StealthDamageMultiplier => 1.3f; 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/Rogue/AshenStalactite.cs b/Items/Weapons/Rogue/AshenStalactite.cs index b1000797dd..50d0e9b31b 100644 --- a/Items/Weapons/Rogue/AshenStalactite.cs +++ b/Items/Weapons/Rogue/AshenStalactite.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.maxStack = 1; - Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice / 4; // This buy price is intentionally reduced due to how common this item is. Item.rare = ItemRarityID.Orange; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 15f; @@ -30,12 +30,12 @@ namespace CalamityMod.Items.Weapons.Rogue } public override void ModifyStatsExtra(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) - { + { if (player.Calamity().StealthStrikeAvailable()) - type = ModContent.ProjectileType(); - } + type = ModContent.ProjectileType(); + } - public override float StealthDamageMultiplier => 1.15f; + public override float StealthDamageMultiplier => 1.15f; public override float StealthVelocityMultiplier => 0.6f; public override float StealthKnockbackMultiplier => 2.5f; diff --git a/Items/Weapons/Rogue/AuroradicalThrow.cs b/Items/Weapons/Rogue/AuroradicalThrow.cs index acf8b7e406..3bc3e7e79c 100644 --- a/Items/Weapons/Rogue/AuroradicalThrow.cs +++ b/Items/Weapons/Rogue/AuroradicalThrow.cs @@ -1,11 +1,11 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.DataStructures; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; -using Terraria.GameContent; namespace CalamityMod.Items.Weapons.Rogue { @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 6f; Item.UseSound = SoundID.Item117; Item.autoReuse = true; - Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; diff --git a/Items/Weapons/Rogue/BallisticPoisonBomb.cs b/Items/Weapons/Rogue/BallisticPoisonBomb.cs index 124f4f593d..8e0c21d98a 100644 --- a/Items/Weapons/Rogue/BallisticPoisonBomb.cs +++ b/Items/Weapons/Rogue/BallisticPoisonBomb.cs @@ -1,10 +1,10 @@ -using Terraria.DataStructures; +using System; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 6.5f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; @@ -33,20 +33,10 @@ namespace CalamityMod.Items.Weapons.Rogue 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 - { - int spread = 5; - for (int i = 0; i < 3; i++) - { - Vector2 perturbedspeed = new Vector2(velocity.X + Main.rand.Next(-3,4), velocity.Y + Main.rand.Next(-3,4)).RotatedBy(MathHelper.ToRadians(spread)); - int proj = Projectile.NewProjectile(source, position, perturbedspeed, type, damage, knockback, player.whoAmI); - if (proj.WithinBounds(Main.maxProjectiles)) - Main.projectile[proj].Calamity().stealthStrike = true; - spread -= Main.rand.Next(2,6); - } - return false; - } - return true; + int proj = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); + return false; } public override void AddRecipes() diff --git a/Items/Weapons/Rogue/BlastBarrel.cs b/Items/Weapons/Rogue/BlastBarrel.cs index 166228d215..5eecae653c 100644 --- a/Items/Weapons/Rogue/BlastBarrel.cs +++ b/Items/Weapons/Rogue/BlastBarrel.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -9,12 +9,11 @@ namespace CalamityMod.Items.Weapons.Rogue { public class BlastBarrel : RogueWeapon { - public const int BaseDamage = 32; public override void SetDefaults() { Item.width = 48; Item.height = 48; - Item.damage = BaseDamage; + Item.damage = 32; Item.noMelee = true; Item.noUseGraphic = true; Item.useStyle = ItemUseStyleID.Swing; @@ -23,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 8f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.value = CalamityGlobalItem.Rarity4BuyPrice; //2 gold 40 silver sellprice + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; @@ -31,11 +30,11 @@ namespace CalamityMod.Items.Weapons.Rogue } public override void ModifyStatsExtra(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) - { + { // A vertical offset is added to ensure that the barrel does not immediately collide with tiles and explode. - position = position - Vector2.UnitY * 12f; - velocity.Y *= 0.85f; - } + position = position - Vector2.UnitY * 12f; + velocity.Y *= 0.85f; + } 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/Rogue/BlazingStar.cs b/Items/Weapons/Rogue/BlazingStar.cs index 1028a95184..871115b9eb 100644 --- a/Items/Weapons/Rogue/BlazingStar.cs +++ b/Items/Weapons/Rogue/BlazingStar.cs @@ -1,8 +1,8 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -12,17 +12,17 @@ namespace CalamityMod.Items.Weapons.Rogue { public override void SetDefaults() { + Item.width = 1; + Item.height = 1; Item.damage = 75; Item.DamageType = RogueDamageClass.Instance; Item.noMelee = true; Item.noUseGraphic = true; - Item.width = 1; - Item.height = 1; Item.useTime = 15; Item.useAnimation = 15; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 4f; - Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; Item.UseSound = SoundID.Item1; @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Rogue // Terraria seems to really dislike high crit values in SetDefaults public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 4; - public override float StealthDamageMultiplier => 0.575f; + public override float StealthDamageMultiplier => 0.575f; 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/Rogue/BloodsoakedCrasher.cs b/Items/Weapons/Rogue/BloodsoakedCrasher.cs index 1e719ccfb8..f2387e8a45 100644 --- a/Items/Weapons/Rogue/BloodsoakedCrasher.cs +++ b/Items/Weapons/Rogue/BloodsoakedCrasher.cs @@ -13,6 +13,8 @@ namespace CalamityMod.Items.Weapons.Rogue { public override void SetDefaults() { + Item.width = 66; + Item.height = 64; Item.damage = 245; Item.knockBack = 3f; Item.autoReuse = true; @@ -21,13 +23,11 @@ namespace CalamityMod.Items.Weapons.Rogue Item.shootSpeed = 9f; Item.shoot = ModContent.ProjectileType(); - Item.width = 66; - Item.height = 64; Item.noMelee = true; Item.noUseGraphic = true; Item.useStyle = ItemUseStyleID.Swing; Item.UseSound = SoundID.Item1; - Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); } diff --git a/Items/Weapons/Rogue/BouncingEyeball.cs b/Items/Weapons/Rogue/BouncingEyeball.cs index aa37e4febc..8ccc7e6781 100644 --- a/Items/Weapons/Rogue/BouncingEyeball.cs +++ b/Items/Weapons/Rogue/BouncingEyeball.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -9,21 +9,20 @@ namespace CalamityMod.Items.Weapons.Rogue { public class BouncingEyeball : RogueWeapon { - public const int BaseDamage = 16; public override void SetStaticDefaults() { - } + } public override void SetDefaults() { - Item.damage = BaseDamage; Item.width = 26; Item.height = 26; + Item.damage = 16; Item.useTime = 23; Item.useAnimation = 23; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 3.5f; Item.rare = ItemRarityID.Green; - Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.DamageType = RogueDamageClass.Instance; Item.noUseGraphic = true; Item.UseSound = SoundID.Item1; @@ -35,7 +34,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override float StealthVelocityMultiplier => 2f; public override void ModifyStatsExtra(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) - { + { if (Main.bloodMoon) { knockback *= 3f; @@ -44,18 +43,18 @@ namespace CalamityMod.Items.Weapons.Rogue { velocity *= Main.rand.NextFloat(0.85f, 1.3f); velocity = velocity.RotatedByRandom(MathHelper.ToRadians(10f)); //random spread - } - else - { - type = ModContent.ProjectileType(); - } - } + } + else + { + type = ModContent.ProjectileType(); + } + } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); - if (p.WithinBounds(Main.maxProjectiles) && player.Calamity().StealthStrikeAvailable()) - Main.projectile[p].Calamity().stealthStrike = true; + int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); + if (p.WithinBounds(Main.maxProjectiles) && player.Calamity().StealthStrikeAvailable()) + Main.projectile[p].Calamity().stealthStrike = true; return false; } } diff --git a/Items/Weapons/Rogue/BouncySpikyBall.cs b/Items/Weapons/Rogue/BouncySpikyBall.cs index 440389545a..212f13a817 100644 --- a/Items/Weapons/Rogue/BouncySpikyBall.cs +++ b/Items/Weapons/Rogue/BouncySpikyBall.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -17,6 +17,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { Item.width = 14; + Item.height = 14; Item.damage = 10; Item.noMelee = true; Item.noUseGraphic = true; @@ -28,7 +29,6 @@ namespace CalamityMod.Items.Weapons.Rogue Item.autoReuse = true; Item.consumable = true; Item.maxStack = 9999; - Item.height = 14; Item.value = Item.buyPrice(0, 0, 1, 0); Item.rare = ItemRarityID.Blue; Item.shoot = ModContent.ProjectileType(); @@ -43,13 +43,13 @@ namespace CalamityMod.Items.Weapons.Rogue int spread = 3; for (int i = 0; i < 4; i++) { - Vector2 perturbedspeed = new Vector2(velocity.X + Main.rand.Next(-3,4), velocity.Y + Main.rand.Next(-3,4)).RotatedBy(MathHelper.ToRadians(spread)); + Vector2 perturbedspeed = new Vector2(velocity.X + Main.rand.Next(-3, 4), velocity.Y + Main.rand.Next(-3, 4)).RotatedBy(MathHelper.ToRadians(spread)); int proj = Projectile.NewProjectile(source, position, perturbedspeed, type, damage, knockback, player.whoAmI); if (proj.WithinBounds(Main.maxProjectiles)) { Main.projectile[proj].Calamity().stealthStrike = true; } - spread -= Main.rand.Next(1,4); + spread -= Main.rand.Next(1, 4); } return false; } diff --git a/Items/Weapons/Rogue/BrackishFlask.cs b/Items/Weapons/Rogue/BrackishFlask.cs index d713a2aa86..cb85473023 100644 --- a/Items/Weapons/Rogue/BrackishFlask.cs +++ b/Items/Weapons/Rogue/BrackishFlask.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -12,6 +12,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { Item.width = 28; + Item.height = 30; Item.damage = 60; Item.noMelee = true; Item.noUseGraphic = true; @@ -21,15 +22,14 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 6.5f; Item.UseSound = SoundID.Item106; Item.autoReuse = true; - Item.height = 30; - Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; Item.DamageType = RogueDamageClass.Instance; } - public override float StealthDamageMultiplier => 0.85f; + public override float StealthDamageMultiplier => 0.85f; 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/Rogue/Brimblade.cs b/Items/Weapons/Rogue/Brimblade.cs index 04f18d25c6..a6cd12bcf6 100644 --- a/Items/Weapons/Rogue/Brimblade.cs +++ b/Items/Weapons/Rogue/Brimblade.cs @@ -1,9 +1,9 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -14,6 +14,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { Item.width = 26; + Item.height = 26; Item.damage = 28; Item.noMelee = true; Item.noUseGraphic = true; @@ -23,8 +24,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.useTime = 18; Item.knockBack = 6.5f; Item.UseSound = SoundID.Item1; - Item.height = 26; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; diff --git a/Items/Weapons/Rogue/BurningStrife.cs b/Items/Weapons/Rogue/BurningStrife.cs index 3903cf22fb..592522b026 100644 --- a/Items/Weapons/Rogue/BurningStrife.cs +++ b/Items/Weapons/Rogue/BurningStrife.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.height = 28; Item.UseSound = SoundID.Item1; Item.useStyle = ItemUseStyleID.Swing; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.autoReuse = true; Item.noUseGraphic = true; @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Rogue // Terraria seems to really dislike high crit values in SetDefaults public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 8; - public override float StealthDamageMultiplier => 1.3f; + public override float StealthDamageMultiplier => 1.3f; public override float StealthVelocityMultiplier => 1.25f; 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/Rogue/CelestialReaper.cs b/Items/Weapons/Rogue/CelestialReaper.cs index 53816e56be..946d0cf61e 100644 --- a/Items/Weapons/Rogue/CelestialReaper.cs +++ b/Items/Weapons/Rogue/CelestialReaper.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -9,29 +9,28 @@ namespace CalamityMod.Items.Weapons.Rogue { public class CelestialReaper : RogueWeapon { - public const int BaseDamage = 140; public override void SetDefaults() { - Item.damage = BaseDamage; Item.width = 66; Item.height = 76; + Item.damage = 140; Item.useAnimation = 31; Item.useTime = 31; Item.noMelee = true; Item.noUseGraphic = true; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 6f; - Item.rare = ItemRarityID.Red; + Item.rare = ItemRarityID.Purple; Item.UseSound = SoundID.Item71; Item.autoReuse = true; - Item.value = CalamityGlobalItem.Rarity10BuyPrice; + Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 20f; Item.DamageType = RogueDamageClass.Instance; } - public override float StealthDamageMultiplier => 0.9f; + public override float StealthDamageMultiplier => 0.9f; 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/Rogue/Celestus.cs b/Items/Weapons/Rogue/Celestus.cs index ea8cbcb2d3..5c1696590e 100644 --- a/Items/Weapons/Rogue/Celestus.cs +++ b/Items/Weapons/Rogue/Celestus.cs @@ -6,9 +6,9 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; -using Terraria.GameContent; namespace CalamityMod.Items.Weapons.Rogue { @@ -18,6 +18,8 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { + Item.width = 150; + Item.height = 132; Item.damage = 280; Item.DamageType = RogueDamageClass.Instance; Item.useAnimation = Item.useTime = 22; @@ -25,13 +27,10 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 6f; Item.shoot = ModContent.ProjectileType(); - - Item.width = 150; - Item.height = 132; Item.useStyle = ItemUseStyleID.Swing; Item.UseSound = SoundID.Item1; Item.rare = ModContent.RarityType(); - Item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.autoReuse = true; Item.noMelee = true; Item.noUseGraphic = true; @@ -44,7 +43,7 @@ namespace CalamityMod.Items.Weapons.Rogue int stealth = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (stealth.WithinBounds(Main.maxProjectiles)) Main.projectile[stealth].Calamity().stealthStrike = true; - return false; + return false; } return true; } diff --git a/Items/Weapons/Rogue/Cinquedea.cs b/Items/Weapons/Rogue/Cinquedea.cs index 7ad9c30f4a..ff5b5ab84a 100644 --- a/Items/Weapons/Rogue/Cinquedea.cs +++ b/Items/Weapons/Rogue/Cinquedea.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -9,27 +9,24 @@ namespace CalamityMod.Items.Weapons.Rogue { public class Cinquedea : RogueWeapon { - public static int BaseDamage = 36; - public static float Knockback = 5f; - public static float Speed = 8f; public override void SetDefaults() { - Item.damage = BaseDamage; + Item.width = 32; + Item.height = 32; + Item.damage = 36; Item.rare = ItemRarityID.Orange; - Item.knockBack = Knockback; + Item.knockBack = 5; Item.autoReuse = true; Item.useTime = 15; Item.useAnimation = 15; Item.useStyle = ItemUseStyleID.Swing; - Item.width = 32; - Item.height = 32; Item.UseSound = SoundID.Item1; Item.noMelee = true; Item.noUseGraphic = true; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = Speed; - Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.shootSpeed = 8; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.DamageType = RogueDamageClass.Instance; } diff --git a/Items/Weapons/Rogue/CobaltKunai.cs b/Items/Weapons/Rogue/CobaltKunai.cs index b86b1724ce..3b2b74b77e 100644 --- a/Items/Weapons/Rogue/CobaltKunai.cs +++ b/Items/Weapons/Rogue/CobaltKunai.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue @@ -16,7 +16,8 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { Item.width = 14; - Item.damage = 52; + Item.height = 38; + Item.damage = 58; Item.noMelee = true; Item.consumable = true; Item.noUseGraphic = true; @@ -25,20 +26,18 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 2.5f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 38; Item.maxStack = 9999; Item.value = 900; Item.rare = ItemRarityID.LightRed; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 12f; + Item.shootSpeed = 14f; Item.DamageType = RogueDamageClass.Instance; } public override float StealthDamageMultiplier => 1.85f; - public override float StealthVelocityMultiplier => 0.9f; - public override float StealthKnockbackMultiplier => 0.5f; + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) diff --git a/Items/Weapons/Rogue/ConsecratedWater.cs b/Items/Weapons/Rogue/ConsecratedWater.cs index 4623a8b903..d0dc2db3e9 100644 --- a/Items/Weapons/Rogue/ConsecratedWater.cs +++ b/Items/Weapons/Rogue/ConsecratedWater.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -9,19 +9,18 @@ namespace CalamityMod.Items.Weapons.Rogue { public class ConsecratedWater : RogueWeapon { - public const int BaseDamage = 48; public override void SetDefaults() { - Item.damage = BaseDamage; Item.width = 22; Item.height = 24; + Item.damage = 48; Item.useAnimation = Item.useTime = 29; Item.noMelee = true; Item.noUseGraphic = true; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 4.5f; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item106; Item.autoReuse = true; diff --git a/Items/Weapons/Rogue/ConsecratedWater.png b/Items/Weapons/Rogue/ConsecratedWater.png index 05478e95bd..9d87b59cc1 100644 Binary files a/Items/Weapons/Rogue/ConsecratedWater.png and b/Items/Weapons/Rogue/ConsecratedWater.png differ diff --git a/Items/Weapons/Rogue/ContaminatedBile.cs b/Items/Weapons/Rogue/ContaminatedBile.cs index cca6087e1a..a4fee1163e 100644 --- a/Items/Weapons/Rogue/ContaminatedBile.cs +++ b/Items/Weapons/Rogue/ContaminatedBile.cs @@ -1,8 +1,8 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -12,15 +12,15 @@ namespace CalamityMod.Items.Weapons.Rogue { public override void SetDefaults() { - Item.damage = 9; Item.width = Item.height = 24; + Item.damage = 9; Item.useAnimation = Item.useTime = 31; Item.noMelee = true; Item.noUseGraphic = true; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 4.5f; Item.rare = ItemRarityID.Green; - Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.UseSound = SoundID.Item106; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Rogue/CorpusAvertor.cs b/Items/Weapons/Rogue/CorpusAvertor.cs index fe1c8e8dc6..210c235930 100644 --- a/Items/Weapons/Rogue/CorpusAvertor.cs +++ b/Items/Weapons/Rogue/CorpusAvertor.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -39,11 +39,11 @@ namespace CalamityMod.Items.Weapons.Rogue public override void ModifyStatsExtra(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) { - if (player.Calamity().StealthStrikeAvailable()) - type = ModContent.ProjectileType(); + if (player.Calamity().StealthStrikeAvailable()) + type = ModContent.ProjectileType(); } - public override float StealthDamageMultiplier => 3.5f; + public override float StealthDamageMultiplier => 3.5f; public override float StealthKnockbackMultiplier => 2f; 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/Rogue/CosmicKunai.cs b/Items/Weapons/Rogue/CosmicKunai.cs index cf554062ce..39a5b4a75d 100644 --- a/Items/Weapons/Rogue/CosmicKunai.cs +++ b/Items/Weapons/Rogue/CosmicKunai.cs @@ -11,11 +11,10 @@ namespace CalamityMod.Items.Weapons.Rogue { public class CosmicKunai : RogueWeapon { - private int counter = 0; - public override void SetDefaults() { Item.width = 26; + Item.height = 48; Item.damage = 92; Item.noMelee = true; Item.noUseGraphic = true; @@ -27,31 +26,29 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 5f; Item.UseSound = SoundID.Item109; Item.autoReuse = true; - Item.height = 48; - Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 28f; Item.DamageType = RogueDamageClass.Instance; } + public override float StealthDamageMultiplier => 1.5f; + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { int stealth = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); - if (player.Calamity().StealthStrikeAvailable() && player.ownedProjectileCounts[ModContent.ProjectileType()] < 10 && counter == 0 && stealth.WithinBounds(Main.maxProjectiles)) + if (player.Calamity().StealthStrikeAvailable()) { Main.projectile[stealth].Calamity().stealthStrike = true; + Main.projectile[stealth].penetrate = 3; SoundEngine.PlaySound(SoundID.Item73, player.Center); for (float i = 0; i < 5; i++) { float angle = MathHelper.TwoPi / 5f * i; - Projectile.NewProjectile(source, player.Center, angle.ToRotationVector2() * 8f, ModContent.ProjectileType(), (int)(damage * 2.568f), knockback, player.whoAmI, angle, 0f); + Projectile.NewProjectile(source, player.Center, angle.ToRotationVector2() * 8f, ModContent.ProjectileType(), (int)(damage * 1.55f), knockback, player.whoAmI, angle, 0f); } } - - counter++; - if (counter >= Item.useAnimation / Item.useTime) - counter = 0; return false; } } diff --git a/Items/Weapons/Rogue/CraniumSmasher.cs b/Items/Weapons/Rogue/CraniumSmasher.cs index 48ea9aee52..f85e68d5dd 100644 --- a/Items/Weapons/Rogue/CraniumSmasher.cs +++ b/Items/Weapons/Rogue/CraniumSmasher.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -22,17 +22,17 @@ namespace CalamityMod.Items.Weapons.Rogue Item.useTime = 15; Item.knockBack = 4f; Item.UseSound = SoundID.Item1; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 20f; Item.DamageType = RogueDamageClass.Instance; } - public override float StealthDamageMultiplier => 1.75f; + public override float StealthDamageMultiplier => 1.75f; public override void ModifyStatsExtra(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) - { + { if (player.Calamity().StealthStrikeAvailable()) { type = ModContent.ProjectileType(); @@ -46,7 +46,7 @@ namespace CalamityMod.Items.Weapons.Rogue { type = ModContent.ProjectileType(); } - } + } 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/Rogue/CrushsawCrasher.cs b/Items/Weapons/Rogue/CrushsawCrasher.cs index 027d1279fd..418c4dc373 100644 --- a/Items/Weapons/Rogue/CrushsawCrasher.cs +++ b/Items/Weapons/Rogue/CrushsawCrasher.cs @@ -1,9 +1,9 @@ -using Terraria.DataStructures; +using System; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -14,6 +14,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { Item.width = 38; + Item.height = 22; Item.damage = 85; Item.useAnimation = 18; Item.useStyle = ItemUseStyleID.Swing; @@ -21,15 +22,14 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 7f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 22; - Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 13.5f; Item.DamageType = RogueDamageClass.Instance; } - public override float StealthDamageMultiplier => 0.7f; + public override float StealthDamageMultiplier => 0.7f; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { @@ -38,13 +38,13 @@ namespace CalamityMod.Items.Weapons.Rogue int spread = 3; for (int i = 0; i < 5; i++) { - Vector2 perturbedspeed = new Vector2(velocity.X + Main.rand.Next(-3,4), velocity.Y + Main.rand.Next(-3,4)).RotatedBy(MathHelper.ToRadians(spread)); + Vector2 perturbedspeed = new Vector2(velocity.X + Main.rand.Next(-3, 4), velocity.Y + Main.rand.Next(-3, 4)).RotatedBy(MathHelper.ToRadians(spread)); int proj = Projectile.NewProjectile(source, position, perturbedspeed, type, damage, knockback, player.whoAmI); if (proj.WithinBounds(Main.maxProjectiles)) { Main.projectile[proj].Calamity().stealthStrike = true; } - spread -= Main.rand.Next(1,4); + spread -= Main.rand.Next(1, 4); } return false; } diff --git a/Items/Weapons/Rogue/CrystalPiercer.cs b/Items/Weapons/Rogue/CrystalPiercer.cs index 17be3cf17b..62c1ed394d 100644 --- a/Items/Weapons/Rogue/CrystalPiercer.cs +++ b/Items/Weapons/Rogue/CrystalPiercer.cs @@ -1,8 +1,8 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -12,12 +12,13 @@ namespace CalamityMod.Items.Weapons.Rogue { public override void SetStaticDefaults() { - Item.ResearchUnlockCount = 99; + Item.ResearchUnlockCount = 99; } public override void SetDefaults() { Item.width = 62; + Item.height = 62; Item.damage = 92; Item.noMelee = true; Item.consumable = true; @@ -27,7 +28,6 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 6f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 62; Item.maxStack = 9999; Item.value = 2500; Item.rare = ItemRarityID.Pink; diff --git a/Items/Weapons/Rogue/Crystalline.cs b/Items/Weapons/Rogue/Crystalline.cs index 802c491b15..41d9c078e2 100644 --- a/Items/Weapons/Rogue/Crystalline.cs +++ b/Items/Weapons/Rogue/Crystalline.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -12,6 +12,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { Item.width = 48; + Item.height = 48; Item.damage = 16; Item.noMelee = true; Item.noUseGraphic = true; @@ -21,8 +22,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 3f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 48; - Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Rogue // Terraria seems to really dislike high crit values in SetDefaults public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 4; - public override float StealthDamageMultiplier => 3f; + public override float StealthDamageMultiplier => 3f; 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/Rogue/CursedDagger.cs b/Items/Weapons/Rogue/CursedDagger.cs index 6669c3656a..289fc8c55c 100644 --- a/Items/Weapons/Rogue/CursedDagger.cs +++ b/Items/Weapons/Rogue/CursedDagger.cs @@ -1,11 +1,11 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Rogue; +using log4net.Core; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using log4net.Core; -using Terraria.Audio; namespace CalamityMod.Items.Weapons.Rogue { @@ -14,19 +14,18 @@ namespace CalamityMod.Items.Weapons.Rogue public static readonly SoundStyle ThrowSound = new("CalamityMod/Sounds/Item/CursedDaggerThrow") { Volume = 0.3f, PitchVariance = 0.4f }; public override void SetDefaults() { + Item.width = 14; + Item.height = 48; Item.damage = 45; Item.useAnimation = Item.useTime = 18; Item.shootSpeed = 19f; Item.knockBack = 4.5f; Item.shoot = ModContent.ProjectileType(); - - Item.width = 14; - Item.height = 48; Item.DamageType = RogueDamageClass.Instance; Item.useStyle = ItemUseStyleID.Swing; Item.UseSound = ThrowSound; - Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; Item.autoReuse = true; Item.noMelee = true; diff --git a/Items/Weapons/Rogue/DeepSeaDumbbell.cs b/Items/Weapons/Rogue/DeepSeaDumbbell.cs index cb78d4e0d6..b16f478362 100644 --- a/Items/Weapons/Rogue/DeepSeaDumbbell.cs +++ b/Items/Weapons/Rogue/DeepSeaDumbbell.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.shootSpeed = 20f; Item.DamageType = RogueDamageClass.Instance; - Item.value = CalamityGlobalItem.Rarity13BuyPrice; + Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; } @@ -70,7 +70,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) => flexMult = 1f; public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo) => flexMult = 1f; - public override float StealthDamageMultiplier => 0.4f; + public override float StealthDamageMultiplier => 0.4f; 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/Rogue/DeepWounder.cs b/Items/Weapons/Rogue/DeepWounder.cs index 5c89e74fdf..17b75bd37d 100644 --- a/Items/Weapons/Rogue/DeepWounder.cs +++ b/Items/Weapons/Rogue/DeepWounder.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -12,6 +12,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { Item.width = 52; + Item.height = 48; Item.damage = 136; Item.noMelee = true; Item.noUseGraphic = true; @@ -21,17 +22,16 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 3f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 48; Item.maxStack = 1; Item.rare = ItemRarityID.Lime; - Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 14f; Item.DamageType = RogueDamageClass.Instance; } public override float StealthVelocityMultiplier => 1.1f; - public override float StealthDamageMultiplier => 3f; + public override float StealthDamageMultiplier => 2.1f; 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/Rogue/DefectiveSphere.cs b/Items/Weapons/Rogue/DefectiveSphere.cs index 45929c4479..aba7223a7a 100644 --- a/Items/Weapons/Rogue/DefectiveSphere.cs +++ b/Items/Weapons/Rogue/DefectiveSphere.cs @@ -10,14 +10,13 @@ namespace CalamityMod.Items.Weapons.Rogue { public class DefectiveSphere : RogueWeapon { - public static int BaseDamage = 130; public static float Speed = 15f; public override void SetDefaults() { Item.width = 42; Item.height = 44; - Item.damage = BaseDamage; + Item.damage = 116; Item.knockBack = 5f; Item.useAnimation = 13; Item.useTime = 13; @@ -52,11 +51,11 @@ namespace CalamityMod.Items.Weapons.Rogue } } - public override float StealthDamageMultiplier => 0.625f; + public override float StealthDamageMultiplier => 0.9f; public override void ModifyStatsExtra(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) - { - type = Utils.SelectRandom(Main.rand, new int[] + { + type = Utils.SelectRandom(Main.rand, new int[] { type, ProjectileType(), @@ -64,8 +63,8 @@ namespace CalamityMod.Items.Weapons.Rogue ProjectileType() }); if (player.Calamity().StealthStrikeAvailable()) - velocity = velocity + Main.rand.NextVector2Square(-1.5f, 1.5f); - } + velocity = velocity + Main.rand.NextVector2Square(-1.5f, 1.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/Rogue/DesecratedWater.cs b/Items/Weapons/Rogue/DesecratedWater.cs index d9f03a452b..65c2008659 100644 --- a/Items/Weapons/Rogue/DesecratedWater.cs +++ b/Items/Weapons/Rogue/DesecratedWater.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -9,20 +9,19 @@ namespace CalamityMod.Items.Weapons.Rogue { public class DesecratedWater : RogueWeapon { - public const int BaseDamage = 55; public override void SetDefaults() { - Item.damage = BaseDamage; Item.width = 22; Item.height = 24; + Item.damage = 55; Item.useAnimation = 29; Item.useTime = 29; Item.noMelee = true; Item.noUseGraphic = true; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 4.5f; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item106; Item.autoReuse = true; diff --git a/Items/Weapons/Rogue/DukesDecapitator.cs b/Items/Weapons/Rogue/DukesDecapitator.cs index 875cc16acb..729455366d 100644 --- a/Items/Weapons/Rogue/DukesDecapitator.cs +++ b/Items/Weapons/Rogue/DukesDecapitator.cs @@ -1,9 +1,9 @@ -using Terraria.DataStructures; +using CalamityMod.Projectiles.Rogue; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Projectiles.Rogue; -using Microsoft.Xna.Framework; namespace CalamityMod.Items.Weapons.Rogue { @@ -22,14 +22,14 @@ namespace CalamityMod.Items.Weapons.Rogue Item.useTime = 30; Item.knockBack = 2f; Item.UseSound = SoundID.Item1; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 15f; Item.DamageType = RogueDamageClass.Instance; } - public override float StealthDamageMultiplier => 1.2f; + public override float StealthDamageMultiplier => 1.2f; 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/Rogue/DuststormInABottle.cs b/Items/Weapons/Rogue/DuststormInABottle.cs index c4be73be4d..cb31651c19 100644 --- a/Items/Weapons/Rogue/DuststormInABottle.cs +++ b/Items/Weapons/Rogue/DuststormInABottle.cs @@ -1,8 +1,8 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -13,6 +13,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { Item.width = 20; + Item.height = 24; Item.damage = 74; Item.noMelee = true; Item.noUseGraphic = true; @@ -22,8 +23,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 4f; Item.UseSound = SoundID.Item106; Item.autoReuse = true; - Item.height = 24; - Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 14f; diff --git a/Items/Weapons/Rogue/DynamicPursuer.cs b/Items/Weapons/Rogue/DynamicPursuer.cs index 4f16d0a645..b1dfd66b28 100644 --- a/Items/Weapons/Rogue/DynamicPursuer.cs +++ b/Items/Weapons/Rogue/DynamicPursuer.cs @@ -1,13 +1,13 @@ -using CalamityMod.CustomRecipes; +using System; +using System.Collections.Generic; +using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; using CalamityMod.Items.Weapons.DraedonsArsenal; -using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Projectiles.Rogue; using CalamityMod.Rarities; +using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; -using System; -using System.Collections.Generic; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -21,18 +21,17 @@ namespace CalamityMod.Items.Weapons.Rogue { CalamityGlobalItem modItem = Item.Calamity(); - Item.damage = 2850; - Item.DamageType = RogueDamageClass.Instance; - Item.width = 30; Item.height = 34; + Item.damage = 2850; + Item.DamageType = RogueDamageClass.Instance; Item.useTime = 42; Item.useAnimation = 42; Item.useStyle = ItemUseStyleID.Swing; Item.useTurn = false; Item.knockBack = 3f; - Item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.rare = ModContent.RarityType(); Item.noUseGraphic = true; @@ -48,7 +47,7 @@ namespace CalamityMod.Items.Weapons.Rogue modItem.ChargePerUse = 0.4f; // Tesla Cannon = 0.9f } public static float StealthDmgMult = 0.3f; //So I can edit it directly via DragonLens instead of having to do math with CalTestHelpers - public override float StealthDamageMultiplier => StealthDmgMult; + public override float StealthDamageMultiplier => StealthDmgMult; public override float StealthVelocityMultiplier => 0.8f; //Stuff to be used on the projectile, but here for ease of access ingame via DragonLens diff --git a/Items/Weapons/Rogue/EclipsesFall.cs b/Items/Weapons/Rogue/EclipsesFall.cs index 40955169ba..e0c8ca091d 100644 --- a/Items/Weapons/Rogue/EclipsesFall.cs +++ b/Items/Weapons/Rogue/EclipsesFall.cs @@ -15,6 +15,8 @@ namespace CalamityMod.Items.Weapons.Rogue { public override void SetDefaults() { + Item.width = 82; + Item.height = 88; Item.damage = 500; Item.knockBack = 3.5f; Item.useAnimation = Item.useTime = 22; @@ -24,12 +26,10 @@ namespace CalamityMod.Items.Weapons.Rogue Item.shoot = ModContent.ProjectileType(); Item.useStyle = ItemUseStyleID.Swing; - Item.width = 82; - Item.height = 88; Item.noMelee = true; Item.noUseGraphic = true; Item.UseSound = SoundID.Item1; - Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.rare = ModContent.RarityType(); } diff --git a/Items/Weapons/Rogue/ElementalDisk.cs b/Items/Weapons/Rogue/ElementalDisk.cs index 6adb111910..21e758b945 100644 --- a/Items/Weapons/Rogue/ElementalDisk.cs +++ b/Items/Weapons/Rogue/ElementalDisk.cs @@ -1,8 +1,8 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -15,6 +15,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { Item.width = 38; + Item.height = 38; Item.damage = 92; Item.noMelee = true; Item.noUseGraphic = true; @@ -24,8 +25,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.useTime = 16; Item.knockBack = 9f; Item.UseSound = SoundID.Item1; - Item.height = 38; - Item.value = CalamityGlobalItem.Rarity11BuyPrice; + Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; Item.rare = ItemRarityID.Purple; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 15f; @@ -53,7 +53,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { CreateRecipe(). - AddIngredient(). + AddIngredient(). AddIngredient(ItemID.LunarBar, 5). AddIngredient(5). AddIngredient(5). diff --git a/Items/Weapons/Rogue/EnchantedAxe.cs b/Items/Weapons/Rogue/EnchantedAxe.cs index 1c6d2067ea..d4f014dab9 100644 --- a/Items/Weapons/Rogue/EnchantedAxe.cs +++ b/Items/Weapons/Rogue/EnchantedAxe.cs @@ -1,8 +1,8 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -13,6 +13,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { Item.width = 40; + Item.height = 36; Item.damage = 20; Item.noMelee = true; Item.noUseGraphic = true; @@ -22,11 +23,10 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 1f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 36; Item.maxStack = 1; Item.value = 1000; Item.rare = ItemRarityID.Orange; - Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 30f; Item.DamageType = RogueDamageClass.Instance; diff --git a/Items/Weapons/Rogue/EnchantedAxe.png b/Items/Weapons/Rogue/EnchantedAxe.png index cdae20aa68..3bab8e0e63 100644 Binary files a/Items/Weapons/Rogue/EnchantedAxe.png and b/Items/Weapons/Rogue/EnchantedAxe.png differ diff --git a/Items/Weapons/Rogue/EpidemicShredder.cs b/Items/Weapons/Rogue/EpidemicShredder.cs index 7ad2d03f2f..4e755faed2 100644 --- a/Items/Weapons/Rogue/EpidemicShredder.cs +++ b/Items/Weapons/Rogue/EpidemicShredder.cs @@ -1,10 +1,10 @@ -using Terraria.DataStructures; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 4.5f; Item.UseSound = SoundID.Item1; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 18f; diff --git a/Items/Weapons/Rogue/Equanimity.cs b/Items/Weapons/Rogue/Equanimity.cs index 185241a027..d05c0a4635 100644 --- a/Items/Weapons/Rogue/Equanimity.cs +++ b/Items/Weapons/Rogue/Equanimity.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -12,6 +12,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { Item.width = 40; + Item.height = 36; Item.damage = 40; Item.noMelee = true; Item.noUseGraphic = true; @@ -20,9 +21,8 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 1f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 36; Item.maxStack = 1; - Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 30f; diff --git a/Items/Weapons/Rogue/Eradicator.cs b/Items/Weapons/Rogue/Eradicator.cs index ffbf5bab75..7d6589d230 100644 --- a/Items/Weapons/Rogue/Eradicator.cs +++ b/Items/Weapons/Rogue/Eradicator.cs @@ -26,14 +26,14 @@ namespace CalamityMod.Items.Weapons.Rogue Item.useAnimation = 33; Item.knockBack = 7f; Item.UseSound = SoundID.Item1; - Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.rare = ModContent.RarityType(); Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = Speed; Item.DamageType = RogueDamageClass.Instance; } - public override float StealthDamageMultiplier => 0.6f; + public override float StealthDamageMultiplier => 0.6f; 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/Rogue/ExecutionersBlade.cs b/Items/Weapons/Rogue/ExecutionersBlade.cs index 565bdbbcf5..2399ea3992 100644 --- a/Items/Weapons/Rogue/ExecutionersBlade.cs +++ b/Items/Weapons/Rogue/ExecutionersBlade.cs @@ -16,6 +16,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { Item.width = 64; + Item.height = 64; Item.damage = 195; Item.noMelee = true; Item.noUseGraphic = true; @@ -27,7 +28,6 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 6.75f; Item.UseSound = SoundID.Item73; Item.autoReuse = true; - Item.height = 64; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 24f; diff --git a/Items/Weapons/Rogue/Exorcism.cs b/Items/Weapons/Rogue/Exorcism.cs index 3528725e89..0ae4de8476 100644 --- a/Items/Weapons/Rogue/Exorcism.cs +++ b/Items/Weapons/Rogue/Exorcism.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -12,7 +12,8 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { Item.width = 34; - Item.damage = 55; + Item.height = 42; + Item.damage = 64; Item.noMelee = true; Item.noUseGraphic = true; Item.useAnimation = Item.useTime = 20; @@ -20,9 +21,8 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 1f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 42; Item.maxStack = 1; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; @@ -33,13 +33,13 @@ namespace CalamityMod.Items.Weapons.Rogue { if (player.Calamity().StealthStrikeAvailable()) { - int p = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI, 2f, damage); + int p = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI, 1f, damage); if (p.WithinBounds(Main.maxProjectiles)) Main.projectile[p].Calamity().stealthStrike = true; } else { - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI, 1f, damage); + Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI, 0.25f, damage); } return false; } diff --git a/Items/Weapons/Rogue/FantasyTalisman.cs b/Items/Weapons/Rogue/FantasyTalisman.cs index 24fc49b932..f81beacc1d 100644 --- a/Items/Weapons/Rogue/FantasyTalisman.cs +++ b/Items/Weapons/Rogue/FantasyTalisman.cs @@ -1,8 +1,8 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -18,6 +18,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { Item.width = 30; + Item.height = 30; Item.damage = 82; Item.noMelee = true; Item.consumable = true; @@ -28,7 +29,6 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 6f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 30; Item.maxStack = 9999; Item.value = Item.buyPrice(0, 0, 60, 0); Item.rare = ItemRarityID.Lime; @@ -37,7 +37,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.DamageType = RogueDamageClass.Instance; } - public override float StealthDamageMultiplier => 0.8f; + public override float StealthDamageMultiplier => 0.8f; 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/Rogue/FeatherKnife.cs b/Items/Weapons/Rogue/FeatherKnife.cs index 7fa7d8705f..545601781a 100644 --- a/Items/Weapons/Rogue/FeatherKnife.cs +++ b/Items/Weapons/Rogue/FeatherKnife.cs @@ -1,8 +1,8 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; diff --git a/Items/Weapons/Rogue/FishboneBoomerang.cs b/Items/Weapons/Rogue/FishboneBoomerang.cs index 71777587c7..a6d0facb12 100644 --- a/Items/Weapons/Rogue/FishboneBoomerang.cs +++ b/Items/Weapons/Rogue/FishboneBoomerang.cs @@ -15,6 +15,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { Item.width = 18; + Item.height = 34; Item.damage = 27; Item.noMelee = true; Item.noUseGraphic = true; @@ -23,8 +24,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.useTime = 15; Item.knockBack = 5.5f; Item.UseSound = null; - Item.height = 34; - Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 3f; diff --git a/Items/Weapons/Rogue/FrostcrushValari.cs b/Items/Weapons/Rogue/FrostcrushValari.cs index 0b750a6875..4b41108386 100644 --- a/Items/Weapons/Rogue/FrostcrushValari.cs +++ b/Items/Weapons/Rogue/FrostcrushValari.cs @@ -1,11 +1,10 @@ -using Terraria.DataStructures; -using CalamityMod.CalPlayer; -using CalamityMod.Projectiles.Rogue; +using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -17,15 +16,15 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { + Item.width = 32; + Item.height = 46; Item.damage = 89; Item.knockBack = 12; - Item.DamageType = DamageClass.Throwing; - Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.DamageType = RogueDamageClass.Instance; + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; Item.useTime = 21; Item.useAnimation = 21; - Item.width = 32; - Item.height = 46; Item.useStyle = ItemUseStyleID.Swing; Item.UseSound = SoundID.Item1; Item.autoReuse = true; @@ -33,13 +32,12 @@ namespace CalamityMod.Items.Weapons.Rogue Item.shoot = ModContent.ProjectileType(); Item.noMelee = true; Item.noUseGraphic = true; - Item.DamageType = RogueDamageClass.Instance; } // Terraria seems to really dislike high crit values in SetDefaults public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 16; - public override float StealthDamageMultiplier => 0.35f; + public override float StealthDamageMultiplier => 0.35f; public override float StealthKnockbackMultiplier => 0.3333f; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) @@ -58,12 +56,12 @@ namespace CalamityMod.Items.Weapons.Rogue spread -= 10; } int spread2 = 3; - int icicleAmt = Main.rand.Next(6,11); + int icicleAmt = Main.rand.Next(6, 11); for (int i = 0; i < icicleAmt; i++) { - Vector2 perturbedspeed = new Vector2(velocity.X + Main.rand.Next(-3,4), velocity.Y + Main.rand.Next(-3,4)).RotatedBy(MathHelper.ToRadians(spread2)); + Vector2 perturbedspeed = new Vector2(velocity.X + Main.rand.Next(-3, 4), velocity.Y + Main.rand.Next(-3, 4)).RotatedBy(MathHelper.ToRadians(spread2)); Projectile.NewProjectile(source, position, perturbedspeed, (Main.rand.NextBool() ? ModContent.ProjectileType() : ModContent.ProjectileType()), damage, 0f, player.whoAmI, 0f, 0f); - spread2 -= Main.rand.Next(1,4); + spread2 -= Main.rand.Next(1, 4); } return false; } diff --git a/Items/Weapons/Rogue/FrostyFlare.cs b/Items/Weapons/Rogue/FrostyFlare.cs index 4fc3dc4bd6..1a4e5b7b3b 100644 --- a/Items/Weapons/Rogue/FrostyFlare.cs +++ b/Items/Weapons/Rogue/FrostyFlare.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; diff --git a/Items/Weapons/Rogue/GacruxianMollusk.cs b/Items/Weapons/Rogue/GacruxianMollusk.cs index 3c0382130c..eefd917f1f 100644 --- a/Items/Weapons/Rogue/GacruxianMollusk.cs +++ b/Items/Weapons/Rogue/GacruxianMollusk.cs @@ -9,27 +9,26 @@ namespace CalamityMod.Items.Weapons.Rogue { public class GacruxianMollusk : RogueWeapon { - public static int BaseDamage = 36; public static float Knockback = 5f; public static float Speed = 15f; public override void SetDefaults() { + Item.width = 24; + Item.height = 22; Item.DamageType = RogueDamageClass.Instance; - Item.damage = BaseDamage; + Item.damage = 36; Item.knockBack = Knockback; Item.autoReuse = true; Item.useTime = 26; Item.useAnimation = 26; Item.useStyle = ItemUseStyleID.Swing; - Item.width = 24; - Item.height = 22; Item.UseSound = SoundID.Item1; Item.noMelee = true; Item.noUseGraphic = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = Speed; - Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; } diff --git a/Items/Weapons/Rogue/GelDart.cs b/Items/Weapons/Rogue/GelDart.cs index 1ae4eeb49b..46abfb7598 100644 --- a/Items/Weapons/Rogue/GelDart.cs +++ b/Items/Weapons/Rogue/GelDart.cs @@ -1,9 +1,9 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -13,13 +13,14 @@ namespace CalamityMod.Items.Weapons.Rogue { public override void SetStaticDefaults() { - Item.ResearchUnlockCount = 99; + Item.ResearchUnlockCount = 99; } public override void SetDefaults() { Item.width = 26; - Item.damage = 54; + Item.height = 54; + Item.damage = 28; Item.noMelee = true; Item.consumable = true; Item.noUseGraphic = true; @@ -29,7 +30,6 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 2.5f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 28; Item.maxStack = 9999; Item.value = Item.buyPrice(0, 0, 2, 50); Item.rare = ItemRarityID.LightRed; diff --git a/Items/Weapons/Rogue/GhoulishGouger.cs b/Items/Weapons/Rogue/GhoulishGouger.cs index 3aa60549dd..e3b26d6f38 100644 --- a/Items/Weapons/Rogue/GhoulishGouger.cs +++ b/Items/Weapons/Rogue/GhoulishGouger.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.shootSpeed = 16f; Item.DamageType = RogueDamageClass.Instance; - Item.value = CalamityGlobalItem.Rarity13BuyPrice; + Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; Item.rare = ModContent.RarityType(); } diff --git a/Items/Weapons/Rogue/GildedDagger.cs b/Items/Weapons/Rogue/GildedDagger.cs index cb60dc7ccc..b111c30627 100644 --- a/Items/Weapons/Rogue/GildedDagger.cs +++ b/Items/Weapons/Rogue/GildedDagger.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -12,6 +12,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { Item.width = 32; + Item.height = 26; Item.damage = 14; Item.noMelee = true; Item.noUseGraphic = true; @@ -21,16 +22,15 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 1f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 26; Item.maxStack = 1; - Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.rare = ItemRarityID.Blue; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 15f; Item.DamageType = RogueDamageClass.Instance; } - public override float StealthDamageMultiplier => 2.8f; + public override float StealthDamageMultiplier => 2.8f; 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/Rogue/Glaive.cs b/Items/Weapons/Rogue/Glaive.cs index 085fe7d692..b76b2ab6d9 100644 --- a/Items/Weapons/Rogue/Glaive.cs +++ b/Items/Weapons/Rogue/Glaive.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -9,28 +9,27 @@ namespace CalamityMod.Items.Weapons.Rogue { public class Glaive : RogueWeapon { - public static int BaseDamage = 45; - public static float Knockback = 3f; + //These 2 are used on the Projectile AI and thus remain here public static float Speed = 10f; public static float StealthSpeedMult = 1.8f; public override void SetDefaults() { - Item.damage = BaseDamage; + Item.width = 34; + Item.height = 32; + Item.damage = 45; Item.DamageType = RogueDamageClass.Instance; Item.noMelee = true; Item.noUseGraphic = true; - Item.width = 34; - Item.height = 32; Item.useTime = 15; Item.useAnimation = 15; Item.useStyle = ItemUseStyleID.Swing; - Item.knockBack = Knockback; - Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.knockBack = 3; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; Item.UseSound = SoundID.Item1; - Item.shootSpeed = Speed; + Item.shootSpeed = 10; Item.shoot = ModContent.ProjectileType(); } diff --git a/Items/Weapons/Rogue/GleamingDagger.cs b/Items/Weapons/Rogue/GleamingDagger.cs index 5fccd23990..0677be07ca 100644 --- a/Items/Weapons/Rogue/GleamingDagger.cs +++ b/Items/Weapons/Rogue/GleamingDagger.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -12,6 +12,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { Item.width = 32; + Item.height = 26; Item.damage = 14; Item.noMelee = true; Item.noUseGraphic = true; @@ -21,16 +22,15 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 1f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 26; Item.maxStack = 1; - Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.rare = ItemRarityID.Blue; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 15f; Item.DamageType = RogueDamageClass.Instance; } - public override float StealthDamageMultiplier => 2.8f; + public override float StealthDamageMultiplier => 2.8f; 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/Rogue/GodsParanoia.cs b/Items/Weapons/Rogue/GodsParanoia.cs index 59545b08e5..3e61b927d1 100644 --- a/Items/Weapons/Rogue/GodsParanoia.cs +++ b/Items/Weapons/Rogue/GodsParanoia.cs @@ -16,12 +16,12 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { + Item.width = 20; + Item.height = 20; Item.damage = 142; Item.DamageType = RogueDamageClass.Instance; Item.noMelee = true; Item.noUseGraphic = true; - Item.width = 20; - Item.height = 20; Item.useTime = 20; Item.useAnimation = 20; Item.useStyle = ItemUseStyleID.Swing; @@ -50,7 +50,7 @@ namespace CalamityMod.Items.Weapons.Rogue } } - public override float StealthDamageMultiplier => 0.75f; + public override float StealthDamageMultiplier => 0.75f; 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/Rogue/GraveGrimreaver.cs b/Items/Weapons/Rogue/GraveGrimreaver.cs index bf87f7278f..9d1664b32b 100644 --- a/Items/Weapons/Rogue/GraveGrimreaver.cs +++ b/Items/Weapons/Rogue/GraveGrimreaver.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -12,6 +12,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { Item.width = 80; + Item.height = 68; Item.damage = 84; Item.noMelee = true; Item.noUseGraphic = true; @@ -21,16 +22,15 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 4f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 68; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 16.5f; Item.DamageType = RogueDamageClass.Instance; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.Calamity().donorItem = true; } - public override float StealthDamageMultiplier => 0.40f; + public override float StealthDamageMultiplier => 0.40f; public override float StealthVelocityMultiplier => 1.75f; 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/Rogue/HardenedHoneycomb.cs b/Items/Weapons/Rogue/HardenedHoneycomb.cs index 0ab4f689dd..fc50e89aa3 100644 --- a/Items/Weapons/Rogue/HardenedHoneycomb.cs +++ b/Items/Weapons/Rogue/HardenedHoneycomb.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -17,16 +17,16 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { Item.width = 30; - Item.damage = 20; + Item.height = 32; + Item.damage = 19; Item.noMelee = true; Item.consumable = true; Item.noUseGraphic = true; - Item.useAnimation = Item.useTime = 16; + Item.useAnimation = Item.useTime = 18; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 3f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 32; Item.maxStack = 9999; Item.value = 300; Item.rare = ItemRarityID.Orange; @@ -35,16 +35,15 @@ namespace CalamityMod.Items.Weapons.Rogue Item.DamageType = RogueDamageClass.Instance; } + public override float StealthDamageMultiplier => 0.9f; + 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 { int stealth = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (stealth.WithinBounds(Main.maxProjectiles)) - { Main.projectile[stealth].Calamity().stealthStrike = true; - Main.projectile[stealth].penetrate = 3; - } return false; } return true; diff --git a/Items/Weapons/Rogue/HeavenfallenStardisk.cs b/Items/Weapons/Rogue/HeavenfallenStardisk.cs index 6adc9cfc57..92de798ec1 100644 --- a/Items/Weapons/Rogue/HeavenfallenStardisk.cs +++ b/Items/Weapons/Rogue/HeavenfallenStardisk.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 44; Item.height = 48; - Item.damage = 90; + Item.damage = 165; Item.noMelee = true; Item.noUseGraphic = true; Item.useAnimation = Item.useTime = 40; @@ -21,23 +21,37 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 8f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; Item.DamageType = RogueDamageClass.Instance; } - // Terraria seems to really dislike high crit values in SetDefaults - public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 20; + public override float StealthDamageMultiplier => 1.2f; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - int proj = Projectile.NewProjectile(source, position, velocity.Length() * -Vector2.UnitY, type, damage, knockback, player.whoAmI); - if (proj.WithinBounds(Main.maxProjectiles)) - Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); - - return false; + { + int proj = Projectile.NewProjectile(source, position, velocity.Length() * -Vector2.UnitY, type, damage, knockback, player.whoAmI); + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); + if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike + { + int spread = 15; + for (int i = 0; i < 2; i++) + { + Vector2 perturbedspeed = new Vector2(velocity.X + Main.rand.Next(-8, 8), velocity.Y + Main.rand.Next(-2, 3)).RotatedBy(MathHelper.ToRadians(spread)); + Projectile.NewProjectile(source, position, perturbedspeed.Length() * -Vector2.UnitY, type, (int)(damage * 0.3), knockback, player.whoAmI); + if (proj.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); + } + spread -= Main.rand.Next(5, 8); + } + } + return false; + } } } } diff --git a/Items/Weapons/Rogue/HellsSun.cs b/Items/Weapons/Rogue/HellsSun.cs index 7ce3e20739..9d23b85f76 100644 --- a/Items/Weapons/Rogue/HellsSun.cs +++ b/Items/Weapons/Rogue/HellsSun.cs @@ -1,11 +1,11 @@ -using Terraria.DataStructures; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Microsoft.Xna.Framework; +using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; -using CalamityMod.CalPlayer; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { @@ -13,17 +13,17 @@ namespace CalamityMod.Items.Weapons.Rogue { public override void SetDefaults() { + Item.width = 22; + Item.height = 18; Item.damage = 200; Item.DamageType = RogueDamageClass.Instance; Item.noMelee = true; Item.noUseGraphic = true; - Item.width = 22; - Item.height = 18; Item.useTime = 15; Item.useAnimation = 15; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 5; - Item.value = CalamityGlobalItem.Rarity11BuyPrice; + Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; Item.rare = ItemRarityID.Purple; Item.UseSound = SoundID.Item1; Item.autoReuse = true; @@ -46,7 +46,7 @@ namespace CalamityMod.Items.Weapons.Rogue } } - public override float StealthDamageMultiplier => 0.10f; + public override float StealthDamageMultiplier => 0.10f; 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/Rogue/Hypothermia.cs b/Items/Weapons/Rogue/Hypothermia.cs index 0cc9f8d60b..419ededede 100644 --- a/Items/Weapons/Rogue/Hypothermia.cs +++ b/Items/Weapons/Rogue/Hypothermia.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Items.Weapons.Rogue // Terraria seems to really dislike high crit values in SetDefaults public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 16; - public override float StealthDamageMultiplier => 1.1f; + public override float StealthDamageMultiplier => 1.1f; 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/Rogue/IceStar.cs b/Items/Weapons/Rogue/IceStar.cs index e7acfb0bc7..1f54f0333e 100644 --- a/Items/Weapons/Rogue/IceStar.cs +++ b/Items/Weapons/Rogue/IceStar.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -11,11 +11,12 @@ namespace CalamityMod.Items.Weapons.Rogue { public override void SetStaticDefaults() { - Item.ResearchUnlockCount = 99; + Item.ResearchUnlockCount = 99; } public override void SetDefaults() { + Item.width = Item.height = 66; Item.damage = 45; Item.noMelee = true; Item.consumable = true; @@ -26,7 +27,6 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 2.5f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.width = Item.height = 66; Item.maxStack = 9999; Item.value = Item.buyPrice(0, 0, 5, 0); Item.rare = ItemRarityID.Pink; diff --git a/Items/Weapons/Rogue/Icebreaker.cs b/Items/Weapons/Rogue/Icebreaker.cs index 67c874f3f8..2e7bee34db 100644 --- a/Items/Weapons/Rogue/Icebreaker.cs +++ b/Items/Weapons/Rogue/Icebreaker.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -12,6 +12,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { Item.width = 60; + Item.height = 60; Item.damage = 60; Item.noMelee = true; Item.noUseGraphic = true; @@ -21,9 +22,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.useTime = 14; Item.knockBack = 6.75f; Item.UseSound = SoundID.Item1; - Item.DamageType = DamageClass.Melee; - Item.height = 60; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 16f; diff --git a/Items/Weapons/Rogue/IchorSpear.cs b/Items/Weapons/Rogue/IchorSpear.cs index 089fb9ad68..251e1e2d00 100644 --- a/Items/Weapons/Rogue/IchorSpear.cs +++ b/Items/Weapons/Rogue/IchorSpear.cs @@ -1,10 +1,10 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Items.Weapons.Rogue { @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 7f; Item.UseSound = ThrowSound; Item.autoReuse = true; - Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 17f; diff --git a/Items/Weapons/Rogue/InfernalKris.cs b/Items/Weapons/Rogue/InfernalKris.cs index 57e585f0a9..2efc3a1ecd 100644 --- a/Items/Weapons/Rogue/InfernalKris.cs +++ b/Items/Weapons/Rogue/InfernalKris.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Weapons.Rogue { public override void SetStaticDefaults() { - Item.ResearchUnlockCount = 99; + Item.ResearchUnlockCount = 99; } public override void SetDefaults() diff --git a/Items/Weapons/Rogue/InfestedClawmerang.cs b/Items/Weapons/Rogue/InfestedClawmerang.cs index c5062ada42..829c59c962 100644 --- a/Items/Weapons/Rogue/InfestedClawmerang.cs +++ b/Items/Weapons/Rogue/InfestedClawmerang.cs @@ -1,9 +1,9 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Rogue; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using Microsoft.Xna.Framework; namespace CalamityMod.Items.Weapons.Rogue { @@ -14,6 +14,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { Item.width = 26; + Item.height = 50; Item.damage = 18; Item.noMelee = true; Item.noUseGraphic = true; @@ -23,9 +24,8 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 1.5f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 50; Item.rare = ItemRarityID.Green; - Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 15f; Item.DamageType = RogueDamageClass.Instance; diff --git a/Items/Weapons/Rogue/IronFrancisca.cs b/Items/Weapons/Rogue/IronFrancisca.cs index 0571d3e8a8..ff90a931cc 100644 --- a/Items/Weapons/Rogue/IronFrancisca.cs +++ b/Items/Weapons/Rogue/IronFrancisca.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -11,12 +11,13 @@ namespace CalamityMod.Items.Weapons.Rogue { public override void SetStaticDefaults() { - Item.ResearchUnlockCount = 99; + Item.ResearchUnlockCount = 99; } public override void SetDefaults() { Item.width = 40; + Item.height = 36; Item.damage = 14; Item.noMelee = true; Item.consumable = true; @@ -27,7 +28,6 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 1f; Item.UseSound = SoundID.Item1; Item.autoReuse = false; - Item.height = 36; Item.maxStack = 9999; Item.value = Item.buyPrice(0, 0, 1, 0); Item.rare = ItemRarityID.White; @@ -42,10 +42,10 @@ namespace CalamityMod.Items.Weapons.Rogue { int p = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI, 0f, 1f); if (p.WithinBounds(Main.maxProjectiles)) - { + { Main.projectile[p].Calamity().stealthStrike = true; Main.projectile[p].penetrate = 7; - } + } return false; } return true; diff --git a/Items/Weapons/Rogue/JawsOfOblivion.cs b/Items/Weapons/Rogue/JawsOfOblivion.cs index 3baaa5d67a..0d32fde57a 100644 --- a/Items/Weapons/Rogue/JawsOfOblivion.cs +++ b/Items/Weapons/Rogue/JawsOfOblivion.cs @@ -28,11 +28,11 @@ namespace CalamityMod.Items.Weapons.Rogue Item.shootSpeed = 25f; Item.DamageType = RogueDamageClass.Instance; - Item.value = CalamityGlobalItem.Rarity13BuyPrice; + Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; Item.rare = ModContent.RarityType(); } - public override float StealthDamageMultiplier => 1.8f; + public override float StealthDamageMultiplier => 1.8f; public override float StealthKnockbackMultiplier => 7f; 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/Rogue/KelvinCatalyst.cs b/Items/Weapons/Rogue/KelvinCatalyst.cs index 2ffd966dd1..4f5b30cf01 100644 --- a/Items/Weapons/Rogue/KelvinCatalyst.cs +++ b/Items/Weapons/Rogue/KelvinCatalyst.cs @@ -1,11 +1,11 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 4f; Item.UseSound = SoundID.Item1; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.Calamity().donorItem = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Rogue/Kylie.cs b/Items/Weapons/Rogue/Kylie.cs index 8c373f21d4..8184726764 100644 --- a/Items/Weapons/Rogue/Kylie.cs +++ b/Items/Weapons/Rogue/Kylie.cs @@ -1,9 +1,8 @@ -using Terraria.DataStructures; -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -14,28 +13,27 @@ namespace CalamityMod.Items.Weapons.Rogue public static float Speed = 14f; public override void SetDefaults() { + Item.width = 34; + Item.height = 50; Item.damage = 63; Item.knockBack = 12; - Item.DamageType = DamageClass.Throwing; - Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.DamageType = RogueDamageClass.Instance; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; Item.useTime = 25; Item.useAnimation = 25; - Item.width = 34; - Item.height = 50; Item.useStyle = ItemUseStyleID.Swing; Item.UseSound = SoundID.Item1; Item.shootSpeed = Speed; Item.shoot = ModContent.ProjectileType(); Item.noMelee = true; Item.noUseGraphic = true; - Item.DamageType = RogueDamageClass.Instance; } // Terraria seems to really dislike high crit values in SetDefaults public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 16; - public override float StealthDamageMultiplier => 0.3333f; + public override float StealthDamageMultiplier => 0.3333f; 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/Rogue/LeadTomahawk.cs b/Items/Weapons/Rogue/LeadTomahawk.cs index 1118ab10fa..d0edf28472 100644 --- a/Items/Weapons/Rogue/LeadTomahawk.cs +++ b/Items/Weapons/Rogue/LeadTomahawk.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -11,12 +11,13 @@ namespace CalamityMod.Items.Weapons.Rogue { public override void SetStaticDefaults() { - Item.ResearchUnlockCount = 99; + Item.ResearchUnlockCount = 99; } public override void SetDefaults() { Item.width = 40; + Item.height = 36; Item.damage = 14; Item.noMelee = true; Item.consumable = true; @@ -27,7 +28,6 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 1f; Item.UseSound = SoundID.Item1; Item.autoReuse = false; - Item.height = 36; Item.maxStack = 9999; Item.value = Item.buyPrice(0, 0, 1, 0); Item.rare = ItemRarityID.White; @@ -42,10 +42,10 @@ namespace CalamityMod.Items.Weapons.Rogue { int p = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI, 0f, 1f); if (p.WithinBounds(Main.maxProjectiles)) - { + { Main.projectile[p].Calamity().stealthStrike = true; Main.projectile[p].penetrate = 7; - } + } return false; } return true; diff --git a/Items/Weapons/Rogue/LeonidProgenitor.cs b/Items/Weapons/Rogue/LeonidProgenitor.cs index d5abd23ed0..46d509b1ad 100644 --- a/Items/Weapons/Rogue/LeonidProgenitor.cs +++ b/Items/Weapons/Rogue/LeonidProgenitor.cs @@ -1,8 +1,8 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -15,11 +15,13 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetStaticDefaults() { - ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; + ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; } public override void SetDefaults() { + Item.width = 32; + Item.height = 48; Item.damage = 64; Item.DamageType = RogueDamageClass.Instance; Item.knockBack = 3f; @@ -28,14 +30,12 @@ namespace CalamityMod.Items.Weapons.Rogue Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; - Item.width = 32; - Item.height = 48; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.noUseGraphic = true; Item.UseSound = SoundID.Item61; - Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; } @@ -63,13 +63,13 @@ namespace CalamityMod.Items.Weapons.Rogue return 0.8f; } - public override float StealthDamageMultiplier => 1.25f; + public override float StealthDamageMultiplier => 1.25f; public override void ModifyStatsExtra(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) - { + { if (!player.Calamity().StealthStrikeAvailable() && player.altFunctionUse == 2) - damage = (int)(damage * 0.5f); - } + damage = (int)(damage * 0.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/Rogue/LeviathanTeeth.cs b/Items/Weapons/Rogue/LeviathanTeeth.cs index 4d5ef1e0e8..f013288b68 100644 --- a/Items/Weapons/Rogue/LeviathanTeeth.cs +++ b/Items/Weapons/Rogue/LeviathanTeeth.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 36; Item.height = 38; - Item.damage = 66; + Item.damage = 64; Item.noMelee = true; Item.noUseGraphic = true; Item.useAnimation = Item.useTime = 15; @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.maxStack = 1; - Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; @@ -40,15 +40,13 @@ namespace CalamityMod.Items.Weapons.Rogue } else { - teethCount = Main.rand.Next(1, 3); + teethCount = Main.rand.Next(2, 3 + 1); } - float spreadAngle = MathHelper.ToRadians(10); - for (int i = 0; i < teethCount; i++) { - float offsetSpeedX = velocity.X + Main.rand.NextFloat(-4f, 4f); - float offsetSpeedY = velocity.Y + Main.rand.NextFloat(-4f, 4f); + float offsetSpeedX = velocity.X + Main.rand.NextFloat(-2f, 2f); + float offsetSpeedY = velocity.Y + Main.rand.NextFloat(-2f, 2f); if (stealthStrike) { diff --git a/Items/Weapons/Rogue/Lionfish.cs b/Items/Weapons/Rogue/Lionfish.cs index 8738ca0670..8d692e8cb1 100644 --- a/Items/Weapons/Rogue/Lionfish.cs +++ b/Items/Weapons/Rogue/Lionfish.cs @@ -1,7 +1,9 @@ -using Terraria.DataStructures; +using CalamityMod.Projectiles.Melee; +using System; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -12,17 +14,16 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { Item.width = 40; + Item.height = 40; Item.damage = 45; Item.noMelee = true; Item.noUseGraphic = true; - Item.useAnimation = 22; + Item.useTime = Item.useAnimation = 26; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 22; Item.knockBack = 2.5f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 40; - Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; @@ -36,6 +37,16 @@ namespace CalamityMod.Items.Weapons.Rogue int stealth = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (stealth.WithinBounds(Main.maxProjectiles)) Main.projectile[stealth].Calamity().stealthStrike = true; + + for (int s = 0; s < 5; s++) + { + Vector2 spikeVel = velocity; + spikeVel *= Main.rand.NextFloat(0.85f, 1.25f); + spikeVel = spikeVel.RotatedBy((Main.rand.NextDouble() - 0.5) * Math.PI * 0.25, default); + int spike = Projectile.NewProjectile(source, position, spikeVel, ModContent.ProjectileType(), (int)(damage * 0.5), (int)(knockback * 0.5f), player.whoAmI, -10f, 1f); + if (spike.WithinBounds(Main.maxProjectiles)) + Main.projectile[spike].DamageType = RogueDamageClass.Instance; + } return false; } return true; diff --git a/Items/Weapons/Rogue/LunarKunai.cs b/Items/Weapons/Rogue/LunarKunai.cs index 2aa4d29313..a39f6910b3 100644 --- a/Items/Weapons/Rogue/LunarKunai.cs +++ b/Items/Weapons/Rogue/LunarKunai.cs @@ -1,10 +1,10 @@ -using Terraria.DataStructures; -using System; +using System; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Projectiles.Rogue; namespace CalamityMod.Items.Weapons.Rogue { @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Weapons.Rogue { public override void SetStaticDefaults() { - Item.ResearchUnlockCount = 99; + Item.ResearchUnlockCount = 99; } public override void SetDefaults() @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.UseSound = SoundID.Item39; Item.autoReuse = true; Item.value = Item.sellPrice(copper: 24); - Item.rare = ItemRarityID.Red; + Item.rare = ItemRarityID.Purple; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 22f; Item.DamageType = RogueDamageClass.Instance; @@ -61,24 +61,24 @@ namespace CalamityMod.Items.Weapons.Rogue } mouseXDist *= mouseDistance; mouseYDist *= mouseDistance; - int projAmt = player.Calamity().StealthStrikeAvailable() ? 9 : 3; - for (int i = 0; i < projAmt; i++) - { - float randXOffset = mouseXDist; - float randYOffset = mouseYDist; - float randOffsetDampener = 0.05f * (float)i; - randXOffset += (float)Main.rand.Next(-35, 36) * randOffsetDampener; - randYOffset += (float)Main.rand.Next(-35, 36) * randOffsetDampener; - mouseDistance = (float)Math.Sqrt((double)(randXOffset * randXOffset + randYOffset * randYOffset)); - mouseDistance = kunaiSpeed / mouseDistance; - randXOffset *= mouseDistance; - randYOffset *= mouseDistance; - float x4 = realPlayerPos.X; - float y4 = realPlayerPos.Y; - int stealth = Projectile.NewProjectile(source, x4, y4, randXOffset, randYOffset, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 0f); - if (stealth.WithinBounds(Main.maxProjectiles) && player.Calamity().StealthStrikeAvailable()) - Main.projectile[stealth].Calamity().stealthStrike = true; - } + int projAmt = player.Calamity().StealthStrikeAvailable() ? 9 : 3; + for (int i = 0; i < projAmt; i++) + { + float randXOffset = mouseXDist; + float randYOffset = mouseYDist; + float randOffsetDampener = 0.05f * (float)i; + randXOffset += (float)Main.rand.Next(-35, 36) * randOffsetDampener; + randYOffset += (float)Main.rand.Next(-35, 36) * randOffsetDampener; + mouseDistance = (float)Math.Sqrt((double)(randXOffset * randXOffset + randYOffset * randYOffset)); + mouseDistance = kunaiSpeed / mouseDistance; + randXOffset *= mouseDistance; + randYOffset *= mouseDistance; + float x4 = realPlayerPos.X; + float y4 = realPlayerPos.Y; + int stealth = Projectile.NewProjectile(source, x4, y4, randXOffset, randYOffset, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 0f); + if (stealth.WithinBounds(Main.maxProjectiles) && player.Calamity().StealthStrikeAvailable()) + Main.projectile[stealth].Calamity().stealthStrike = true; + } return false; } diff --git a/Items/Weapons/Rogue/Malachite.cs b/Items/Weapons/Rogue/Malachite.cs index 168bf3586e..30060d64a7 100644 --- a/Items/Weapons/Rogue/Malachite.cs +++ b/Items/Weapons/Rogue/Malachite.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -11,13 +11,14 @@ namespace CalamityMod.Items.Weapons.Rogue { public override void SetStaticDefaults() { - ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; + ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; } public override void SetDefaults() { Item.width = 28; - Item.damage = 55; + Item.height = 58; + Item.damage = 52; Item.noMelee = true; Item.noUseGraphic = true; Item.useTime = Item.useAnimation = 14; @@ -25,12 +26,11 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 1.25f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 58; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; Item.DamageType = RogueDamageClass.Instance; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; } @@ -63,13 +63,11 @@ namespace CalamityMod.Items.Weapons.Rogue return 2f; } - public override float StealthDamageMultiplier => 1.3f; - public override void ModifyStatsExtra(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) - { - if (player.altFunctionUse == 2 && !player.Calamity().StealthStrikeAvailable()) - damage = (int)(damage * 1.75f); - } + { + if (player.altFunctionUse == 2 && !player.Calamity().StealthStrikeAvailable()) + damage = (int)(damage * 1.75f); + } 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/Rogue/MangroveChakram.cs b/Items/Weapons/Rogue/MangroveChakram.cs index 6591b7fc49..2ffec7ef94 100644 --- a/Items/Weapons/Rogue/MangroveChakram.cs +++ b/Items/Weapons/Rogue/MangroveChakram.cs @@ -1,8 +1,8 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -13,6 +13,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { Item.width = 38; + Item.height = 38; Item.damage = 84; Item.noMelee = true; Item.noUseGraphic = true; @@ -22,15 +23,14 @@ namespace CalamityMod.Items.Weapons.Rogue Item.useTime = 14; Item.knockBack = 7.5f; Item.UseSound = SoundID.Item1; - Item.height = 38; - Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 16f; Item.DamageType = RogueDamageClass.Instance; } - public override float StealthDamageMultiplier => 1.25f; + public override float StealthDamageMultiplier => 1.25f; 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/Rogue/MetalMonstrosity.cs b/Items/Weapons/Rogue/MetalMonstrosity.cs index 4c44834a77..f0f50260f1 100644 --- a/Items/Weapons/Rogue/MetalMonstrosity.cs +++ b/Items/Weapons/Rogue/MetalMonstrosity.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.noMelee = true; Item.UseSound = SoundID.Item1; Item.rare = ItemRarityID.Orange; - Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.damage = 30; Item.useAnimation = 40; diff --git a/Items/Weapons/Rogue/MeteorFist.cs b/Items/Weapons/Rogue/MeteorFist.cs index 8b04b13f45..d1b4b08094 100644 --- a/Items/Weapons/Rogue/MeteorFist.cs +++ b/Items/Weapons/Rogue/MeteorFist.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -12,25 +12,25 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { Item.width = 22; + Item.height = 28; Item.damage = 15; Item.noMelee = true; Item.useTurn = true; Item.noUseGraphic = true; - Item.useAnimation = 15; + Item.useAnimation = 18; Item.useStyle = ItemUseStyleID.Shoot; - Item.useTime = 15; + Item.useTime = 18; Item.knockBack = 5.75f; Item.UseSound = SoundID.Item20; Item.autoReuse = true; - Item.height = 28; - Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 5f; Item.DamageType = RogueDamageClass.Instance; } - public override float StealthDamageMultiplier => 3.6f; + public override float StealthDamageMultiplier => 3.15f; 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/Rogue/MoltenAmputator.cs b/Items/Weapons/Rogue/MoltenAmputator.cs index 20016fd537..4f81f42ffc 100644 --- a/Items/Weapons/Rogue/MoltenAmputator.cs +++ b/Items/Weapons/Rogue/MoltenAmputator.cs @@ -15,6 +15,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { Item.width = 60; + Item.height = 60; Item.damage = 166; Item.noMelee = true; Item.noUseGraphic = true; @@ -24,15 +25,14 @@ namespace CalamityMod.Items.Weapons.Rogue Item.useTime = 18; Item.knockBack = 9f; Item.UseSound = SoundID.Item1; - Item.height = 60; - Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = Speed; Item.DamageType = RogueDamageClass.Instance; } - public override float StealthDamageMultiplier => 1.07f; + public override float StealthDamageMultiplier => 1.07f; 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/Rogue/MonkeyDarts.cs b/Items/Weapons/Rogue/MonkeyDarts.cs index d347854956..bfadd571b7 100644 --- a/Items/Weapons/Rogue/MonkeyDarts.cs +++ b/Items/Weapons/Rogue/MonkeyDarts.cs @@ -1,8 +1,8 @@ -using Terraria.DataStructures; +using System; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -17,14 +17,14 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { + Item.width = 27; + Item.height = 27; Item.damage = 150; Item.knockBack = 4; Item.noMelee = true; Item.noUseGraphic = true; Item.consumable = true; Item.maxStack = 9999; - Item.width = 27; - Item.height = 27; Item.useStyle = ItemUseStyleID.Swing; Item.UseSound = SoundID.Item1; Item.useTime = 20; @@ -40,7 +40,7 @@ namespace CalamityMod.Items.Weapons.Rogue // Terraria seems to really dislike high crit values in SetDefaults public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 18; - public override float StealthDamageMultiplier => 0.8f; + public override float StealthDamageMultiplier => 0.8f; 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/Rogue/Mycoroot.cs b/Items/Weapons/Rogue/Mycoroot.cs index 1234245668..dd6856efe8 100644 --- a/Items/Weapons/Rogue/Mycoroot.cs +++ b/Items/Weapons/Rogue/Mycoroot.cs @@ -13,6 +13,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { Item.width = 32; + Item.height = 32; Item.damage = 12; Item.noMelee = true; Item.noUseGraphic = true; @@ -22,9 +23,8 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 1.5f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 32; Item.rare = ItemRarityID.Green; - Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 20f; Item.DamageType = RogueDamageClass.Instance; @@ -36,7 +36,7 @@ namespace CalamityMod.Items.Weapons.Rogue if (player.Calamity().StealthStrikeAvailable() && player.ownedProjectileCounts[ModContent.ProjectileType()] < 20 && stealth.WithinBounds(Main.maxProjectiles)) { Main.projectile[stealth].Calamity().stealthStrike = true; - int projAmt = Main.rand.Next(7,11); + int projAmt = Main.rand.Next(7, 11); for (int i = 0; i < projAmt; i++) { int spore = Projectile.NewProjectile(source, player.Center, velocity, ModContent.ProjectileType(), (int)(damage * 0.5f), knockback, player.whoAmI); @@ -45,15 +45,15 @@ namespace CalamityMod.Items.Weapons.Rogue } for (int i = 0; i < Main.maxPlayers; i++) { - Player other = Main.player[i]; - if (other is null || !other.active || other.dead) - continue; - if ((other.team == player.team && player.team != 0) || player.whoAmI == i) + Player other = Main.player[i]; + if (other is null || !other.active || other.dead) + continue; + if ((other.team == player.team && player.team != 0) || player.whoAmI == i) { if (player.Distance(other.Center) <= 800f) other.AddBuff(ModContent.BuffType(), 900); } - } + } } return false; } diff --git a/Items/Weapons/Rogue/MythrilKnife.cs b/Items/Weapons/Rogue/MythrilKnife.cs index d47dceaa7c..8d63d39313 100644 --- a/Items/Weapons/Rogue/MythrilKnife.cs +++ b/Items/Weapons/Rogue/MythrilKnife.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue @@ -16,6 +16,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { Item.width = 12; + Item.height = 40; Item.damage = 80; Item.noMelee = true; Item.consumable = true; @@ -26,7 +27,6 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 1.75f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 40; Item.maxStack = 9999; Item.value = 1100; Item.rare = ItemRarityID.LightRed; diff --git a/Items/Weapons/Rogue/NanoblackReaper.cs b/Items/Weapons/Rogue/NanoblackReaper.cs index 49a0dc4183..cc1a2987ba 100644 --- a/Items/Weapons/Rogue/NanoblackReaper.cs +++ b/Items/Weapons/Rogue/NanoblackReaper.cs @@ -14,7 +14,6 @@ namespace CalamityMod.Items.Weapons.Rogue [LegacyName("NanoblackReaperMelee", "NanoblackReaperRogue")] public class NanoblackReaper : RogueWeapon { - public static int BaseDamage = 130; public static float Knockback = 9f; public static float Speed = 16f; @@ -22,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 78; Item.height = 64; - Item.damage = BaseDamage; + Item.damage = 130; Item.knockBack = Knockback; Item.useTime = 6; Item.useAnimation = 6; @@ -33,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.useStyle = ItemUseStyleID.Swing; Item.UseSound = SoundID.Item18; - Item.value = CalamityGlobalItem.Rarity16BuyPrice; + Item.value = CalamityGlobalItem.RarityHotPinkBuyPrice; Item.rare = ModContent.RarityType(); Item.Calamity().devItem = true; @@ -42,7 +41,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.shootSpeed = Speed; } - public override float StealthDamageMultiplier => 1.0f; + public override float StealthDamageMultiplier => 1.0f; 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/Rogue/NastyCholla.cs b/Items/Weapons/Rogue/NastyCholla.cs index 7290e51fa5..3798f96f9f 100644 --- a/Items/Weapons/Rogue/NastyCholla.cs +++ b/Items/Weapons/Rogue/NastyCholla.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -19,6 +19,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { Item.width = 20; + Item.height = 18; Item.damage = BaseDamage; Item.noMelee = true; Item.noUseGraphic = true; @@ -29,7 +30,6 @@ namespace CalamityMod.Items.Weapons.Rogue Item.useTime = 20; Item.knockBack = 3f; Item.UseSound = SoundID.Item1; - Item.height = 18; Item.value = Item.buyPrice(0, 0, 0, 50); Item.rare = ItemRarityID.White; Item.shoot = ModContent.ProjectileType(); @@ -44,14 +44,14 @@ namespace CalamityMod.Items.Weapons.Rogue int spread = 3; for (int i = 0; i < 4; i++) { - Vector2 perturbedspeed = new Vector2(velocity.X + Main.rand.Next(-3,4), velocity.Y + Main.rand.Next(-3,4)).RotatedBy(MathHelper.ToRadians(spread)); + Vector2 perturbedspeed = new Vector2(velocity.X + Main.rand.Next(-3, 4), velocity.Y + Main.rand.Next(-3, 4)).RotatedBy(MathHelper.ToRadians(spread)); int proj = Projectile.NewProjectile(source, position.X, position.Y, perturbedspeed.X, perturbedspeed.Y, type, damage, knockback, player.whoAmI); if (proj.WithinBounds(Main.maxProjectiles)) { Main.projectile[proj].originalDamage = damage; Main.projectile[proj].Calamity().stealthStrike = true; } - spread -= Main.rand.Next(1,4); + spread -= Main.rand.Next(1, 4); } return false; } diff --git a/Items/Weapons/Rogue/NightsGaze.cs b/Items/Weapons/Rogue/NightsGaze.cs index cfb744fc9f..4b05fd1732 100644 --- a/Items/Weapons/Rogue/NightsGaze.cs +++ b/Items/Weapons/Rogue/NightsGaze.cs @@ -16,6 +16,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { Item.width = 82; + Item.height = 82; Item.damage = 531; Item.noMelee = true; Item.noUseGraphic = true; @@ -25,16 +26,15 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 1f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 82; Item.maxStack = 1; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 30f; - Item.value = CalamityGlobalItem.Rarity13BuyPrice; + Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; Item.rare = ModContent.RarityType(); Item.DamageType = RogueDamageClass.Instance; } - public override float StealthDamageMultiplier => 1.22f; + public override float StealthDamageMultiplier => 1.22f; 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/Rogue/Nychthemeron.cs b/Items/Weapons/Rogue/Nychthemeron.cs index c2ea5bae27..8cf3c076fb 100644 --- a/Items/Weapons/Rogue/Nychthemeron.cs +++ b/Items/Weapons/Rogue/Nychthemeron.cs @@ -1,8 +1,8 @@ -using Terraria.DataStructures; +using System; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -13,6 +13,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { Item.width = 18; + Item.height = 18; Item.damage = 60; Item.noMelee = true; Item.noUseGraphic = true; @@ -22,8 +23,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 1f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 18; - Item.value = CalamityGlobalItem.Rarity6BuyPrice; + Item.value = CalamityGlobalItem.RarityLightPurpleBuyPrice; Item.rare = ItemRarityID.LightPurple; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 6f; @@ -43,7 +43,7 @@ namespace CalamityMod.Items.Weapons.Rogue return true; } - public override float StealthDamageMultiplier => 0.3333f; + public override float StealthDamageMultiplier => 0.3333f; 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/Rogue/OrichalcumSpikedGemstone.cs b/Items/Weapons/Rogue/OrichalcumSpikedGemstone.cs index 0333466969..2afca45b5a 100644 --- a/Items/Weapons/Rogue/OrichalcumSpikedGemstone.cs +++ b/Items/Weapons/Rogue/OrichalcumSpikedGemstone.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue diff --git a/Items/Weapons/Rogue/PalladiumJavelin.cs b/Items/Weapons/Rogue/PalladiumJavelin.cs index 58830466f8..52d8b1209a 100644 --- a/Items/Weapons/Rogue/PalladiumJavelin.cs +++ b/Items/Weapons/Rogue/PalladiumJavelin.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue @@ -16,30 +16,32 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { Item.width = 54; - Item.damage = 88; + Item.height = 54; + Item.damage = 118; Item.noMelee = true; Item.consumable = true; Item.noUseGraphic = true; - Item.useAnimation = Item.useTime = 26; + Item.useAnimation = Item.useTime = 24; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 5.5f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 54; Item.maxStack = 9999; Item.value = 1200; Item.rare = ItemRarityID.LightRed; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 16f; + Item.shootSpeed = 12f; Item.DamageType = RogueDamageClass.Instance; } + public override float StealthDamageMultiplier => 0.8f; + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { int javelin = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (javelin.WithinBounds(Main.maxProjectiles)) Main.projectile[javelin].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); - + return false; } diff --git a/Items/Weapons/Rogue/Penumbra.cs b/Items/Weapons/Rogue/Penumbra.cs index a8e33bf71f..55975887bf 100644 --- a/Items/Weapons/Rogue/Penumbra.cs +++ b/Items/Weapons/Rogue/Penumbra.cs @@ -57,7 +57,7 @@ namespace CalamityMod.Items.Weapons.Rogue mouseYDist = 0f; } realPlayerPos += new Vector2(mouseXDist, mouseYDist); - int proj = Projectile.NewProjectile(source, realPlayerPos, new Vector2(0f,-0.5f), ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 1f); + int proj = Projectile.NewProjectile(source, realPlayerPos, new Vector2(0f, -0.5f), ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 1f); if (proj.WithinBounds(Main.maxProjectiles)) Main.projectile[proj].Calamity().stealthStrike = true; return false; diff --git a/Items/Weapons/Rogue/PhantasmalRuin.cs b/Items/Weapons/Rogue/PhantasmalRuin.cs index 2e941e5d92..c00e7059f6 100644 --- a/Items/Weapons/Rogue/PhantasmalRuin.cs +++ b/Items/Weapons/Rogue/PhantasmalRuin.cs @@ -14,11 +14,10 @@ namespace CalamityMod.Items.Weapons.Rogue { public override void SetDefaults() { - Item.damage = 145; - Item.knockBack = 8f; - Item.width = 108; Item.height = 114; + Item.damage = 152; + Item.knockBack = 8f; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.noUseGraphic = true; @@ -30,11 +29,11 @@ namespace CalamityMod.Items.Weapons.Rogue Item.UseSound = SoundID.Item1; Item.DamageType = RogueDamageClass.Instance; - Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; } - public override float StealthDamageMultiplier => 1.85f; + public override float StealthDamageMultiplier => 1.2f; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { @@ -43,7 +42,7 @@ namespace CalamityMod.Items.Weapons.Rogue int stealth = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (stealth.WithinBounds(Main.maxProjectiles)) Main.projectile[stealth].Calamity().stealthStrike = true; - Main.projectile[stealth].penetrate = 3; + Main.projectile[stealth].penetrate = 3; return false; } return true; diff --git a/Items/Weapons/Rogue/Plaguenade.cs b/Items/Weapons/Rogue/Plaguenade.cs index 1f903cf04c..80f0d86737 100644 --- a/Items/Weapons/Rogue/Plaguenade.cs +++ b/Items/Weapons/Rogue/Plaguenade.cs @@ -1,8 +1,8 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -12,12 +12,13 @@ namespace CalamityMod.Items.Weapons.Rogue { public override void SetStaticDefaults() { - Item.ResearchUnlockCount = 99; + Item.ResearchUnlockCount = 99; } public override void SetDefaults() { Item.width = 20; + Item.height = 28; Item.damage = 63; Item.noMelee = true; Item.noUseGraphic = true; @@ -29,7 +30,6 @@ namespace CalamityMod.Items.Weapons.Rogue Item.maxStack = 9999; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 28; Item.value = Item.buyPrice(gold: 1); Item.rare = ItemRarityID.Yellow; Item.Calamity().donorItem = true; diff --git a/Items/Weapons/Rogue/PoisonPack.cs b/Items/Weapons/Rogue/PoisonPack.cs index 95b19ff265..858e9aff61 100644 --- a/Items/Weapons/Rogue/PoisonPack.cs +++ b/Items/Weapons/Rogue/PoisonPack.cs @@ -1,31 +1,30 @@ -using Terraria.DataStructures; +using CalamityMod.CalPlayer; +using CalamityMod.Projectiles.Rogue; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using Microsoft.Xna.Framework; -using CalamityMod.Projectiles.Rogue; -using CalamityMod.CalPlayer; namespace CalamityMod.Items.Weapons.Rogue { public class PoisonPack : RogueWeapon { - private static int baseDamage = 20; private static float baseKnockback = 1.8f; public override void SetDefaults() { - Item.damage = baseDamage; + Item.width = 14; + Item.height = 14; + Item.damage = 20; Item.DamageType = RogueDamageClass.Instance; Item.noMelee = true; Item.noUseGraphic = true; - Item.width = 14; - Item.height = 14; Item.useTime = 19; Item.useAnimation = 19; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = baseKnockback; - Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.rare = ItemRarityID.Blue; Item.UseSound = SoundID.Item1; diff --git a/Items/Weapons/Rogue/Prismalline.cs b/Items/Weapons/Rogue/Prismalline.cs index a5a8a8f6e7..140007da3d 100644 --- a/Items/Weapons/Rogue/Prismalline.cs +++ b/Items/Weapons/Rogue/Prismalline.cs @@ -1,9 +1,9 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -18,12 +18,12 @@ namespace CalamityMod.Items.Weapons.Rogue Item.damage = 36; Item.noMelee = true; Item.noUseGraphic = true; - Item.useAnimation = Item.useTime = 24; + Item.useAnimation = Item.useTime = 20; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 5f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 16f; diff --git a/Items/Weapons/Rogue/ProfanedPartisan.cs b/Items/Weapons/Rogue/ProfanedPartisan.cs index da93b93692..1a0b20520d 100644 --- a/Items/Weapons/Rogue/ProfanedPartisan.cs +++ b/Items/Weapons/Rogue/ProfanedPartisan.cs @@ -13,11 +13,10 @@ namespace CalamityMod.Items.Weapons.Rogue { public override void SetDefaults() { - Item.damage = 322; - Item.knockBack = 8f; - Item.width = 56; Item.height = 56; + Item.damage = 322; + Item.knockBack = 8f; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.noUseGraphic = true; @@ -25,7 +24,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.useTime = 18; Item.useAnimation = 18; Item.UseSound = SoundID.Item1; - Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); Item.DamageType = RogueDamageClass.Instance; diff --git a/Items/Weapons/Rogue/RadiantStar.cs b/Items/Weapons/Rogue/RadiantStar.cs index 687cb129ab..16e52c9fc5 100644 --- a/Items/Weapons/Rogue/RadiantStar.cs +++ b/Items/Weapons/Rogue/RadiantStar.cs @@ -1,8 +1,8 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 5f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.value = CalamityGlobalItem.Rarity9BuyPrice; + Item.value = CalamityGlobalItem.RarityCyanBuyPrice; Item.rare = ItemRarityID.Cyan; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 20f; @@ -49,7 +49,7 @@ namespace CalamityMod.Items.Weapons.Rogue CreateRecipe(). AddIngredient(). AddIngredient(10). - AddIngredient(15). + AddIngredient(15). AddIngredient(ItemID.FallenStar, 10). AddTile(TileID.LunarCraftingStation). Register(); diff --git a/Items/Weapons/Rogue/RealityRupture.cs b/Items/Weapons/Rogue/RealityRupture.cs index e6fff98dfd..27b1129ff6 100644 --- a/Items/Weapons/Rogue/RealityRupture.cs +++ b/Items/Weapons/Rogue/RealityRupture.cs @@ -1,12 +1,12 @@ -using Terraria.DataStructures; +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Rogue; +using CalamityMod.Rarities; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Rogue; -using Microsoft.Xna.Framework; -using Terraria.Audio; -using CalamityMod.Rarities; namespace CalamityMod.Items.Weapons.Rogue { @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 9f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; diff --git a/Items/Weapons/Rogue/RefractionRotor.cs b/Items/Weapons/Rogue/RefractionRotor.cs index 3b029ef7e7..2d7451a63e 100644 --- a/Items/Weapons/Rogue/RefractionRotor.cs +++ b/Items/Weapons/Rogue/RefractionRotor.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.rare = ModContent.RarityType(); } - public override float StealthDamageMultiplier => 0.75f; + public override float StealthDamageMultiplier => 0.75f; 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/Rogue/RegulusRiot.cs b/Items/Weapons/Rogue/RegulusRiot.cs index 48038caa70..ce2b201f5e 100644 --- a/Items/Weapons/Rogue/RegulusRiot.cs +++ b/Items/Weapons/Rogue/RegulusRiot.cs @@ -1,9 +1,9 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Rogue; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using Microsoft.Xna.Framework; namespace CalamityMod.Items.Weapons.Rogue { @@ -11,16 +11,15 @@ namespace CalamityMod.Items.Weapons.Rogue { public override void SetDefaults() { - Item.damage = 116; - Item.knockBack = 4.5f; - Item.width = 28; Item.height = 34; + Item.damage = 116; + Item.knockBack = 4.5f; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.noUseGraphic = true; - Item.value = CalamityGlobalItem.Rarity9BuyPrice; + Item.value = CalamityGlobalItem.RarityCyanBuyPrice; Item.useTime = 26; Item.useAnimation = 26; Item.UseSound = SoundID.Item1; @@ -32,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.shoot = ModContent.ProjectileType(); } - public override float StealthDamageMultiplier => 1.2f; + public override float StealthDamageMultiplier => 1.2f; 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/Rogue/RogueWeapon.cs b/Items/Weapons/Rogue/RogueWeapon.cs index 43430d5e59..e1b71f353a 100644 --- a/Items/Weapons/Rogue/RogueWeapon.cs +++ b/Items/Weapons/Rogue/RogueWeapon.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.CalPlayer; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; using static Terraria.ID.ContentSamples.CreativeHelper; @@ -24,17 +25,19 @@ namespace CalamityMod.Items.Weapons.Rogue { bool stealthStrike = player.Calamity().StealthStrikeAvailable(); if (stealthStrike || AdditionalStealthCheck()) - { + { damage = (int)(damage * StealthDamageMultiplier); velocity = velocity * StealthVelocityMultiplier; knockback = knockback * StealthKnockbackMultiplier; - } + } - ModifyStatsExtra(player, ref position, ref velocity, ref type, ref damage, ref knockback); - } + ModifyStatsExtra(player, ref position, ref velocity, ref type, ref damage, ref knockback); + } public virtual void ModifyStatsExtra(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) { } + + public override bool ConsumeItem(Player player) => Main.rand.NextFloat() < player.Calamity().rogueAmmoCost; } } diff --git a/Items/Weapons/Rogue/RotBall.cs b/Items/Weapons/Rogue/RotBall.cs index b9a0447615..adbcf73dd1 100644 --- a/Items/Weapons/Rogue/RotBall.cs +++ b/Items/Weapons/Rogue/RotBall.cs @@ -1,8 +1,8 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -18,6 +18,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { Item.width = 30; + Item.height = 30; Item.damage = 26; Item.noMelee = true; Item.consumable = true; @@ -28,7 +29,6 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 2.5f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 30; Item.maxStack = 9999; Item.value = 1000; Item.rare = ItemRarityID.Orange; diff --git a/Items/Weapons/Rogue/Sacrifice.cs b/Items/Weapons/Rogue/Sacrifice.cs index 87a880fec0..09e611d9d1 100644 --- a/Items/Weapons/Rogue/Sacrifice.cs +++ b/Items/Weapons/Rogue/Sacrifice.cs @@ -13,8 +13,8 @@ namespace CalamityMod.Items.Weapons.Rogue { public override void SetDefaults() { - Item.damage = 300; Item.width = Item.height = 68; + Item.damage = 300; Item.useAnimation = Item.useTime = 9; Item.noMelee = true; Item.noUseGraphic = true; diff --git a/Items/Weapons/Rogue/TerraDisk.cs b/Items/Weapons/Rogue/SamsaraSlicer.cs similarity index 71% rename from Items/Weapons/Rogue/TerraDisk.cs rename to Items/Weapons/Rogue/SamsaraSlicer.cs index ae8ee53854..1c35afd3bc 100644 --- a/Items/Weapons/Rogue/TerraDisk.cs +++ b/Items/Weapons/Rogue/SamsaraSlicer.cs @@ -1,23 +1,24 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class TerraDisk : RogueWeapon + [LegacyName("TerraDisk")] + public class SamsaraSlicer : RogueWeapon { - public static int BaseDamage = 100; public static float Speed = 12f; public override void SetDefaults() { - Item.width = 46; - Item.height = 46; - Item.damage = BaseDamage; + Item.width = 60; + Item.height = 64; + Item.damage = 100; Item.knockBack = 4f; Item.useAnimation = Item.useTime = 30; Item.autoReuse = true; @@ -31,10 +32,10 @@ namespace CalamityMod.Items.Weapons.Rogue Item.rare = ItemRarityID.Yellow; Item.DamageType = RogueDamageClass.Instance; - Item.shoot = ModContent.ProjectileType(); + Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = Speed; } - + public override float StealthVelocityMultiplier => 0.75f; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) @@ -47,6 +48,11 @@ namespace CalamityMod.Items.Weapons.Rogue return false; } + 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/Rogue/SamsaraSlicerGlow").Value); + } + public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Weapons/Rogue/SamsaraSlicer.png b/Items/Weapons/Rogue/SamsaraSlicer.png new file mode 100644 index 0000000000..a7b123e6f2 Binary files /dev/null and b/Items/Weapons/Rogue/SamsaraSlicer.png differ diff --git a/Items/Weapons/Rogue/SamsaraSlicerGlow.png b/Items/Weapons/Rogue/SamsaraSlicerGlow.png new file mode 100644 index 0000000000..0952f72408 Binary files /dev/null and b/Items/Weapons/Rogue/SamsaraSlicerGlow.png differ diff --git a/Items/Weapons/Rogue/SandDollar.cs b/Items/Weapons/Rogue/SandDollar.cs index 50bf0be518..c7110b796b 100644 --- a/Items/Weapons/Rogue/SandDollar.cs +++ b/Items/Weapons/Rogue/SandDollar.cs @@ -1,8 +1,8 @@ -using Terraria.DataStructures; +using System; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 3.5f; Item.autoReuse = true; Item.UseSound = SoundID.Item1; - Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 14f; @@ -42,7 +42,7 @@ namespace CalamityMod.Items.Weapons.Rogue } } - public override float StealthDamageMultiplier => 1f; + public override float StealthDamageMultiplier => 1f; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { @@ -51,11 +51,11 @@ namespace CalamityMod.Items.Weapons.Rogue int spread = 2; for (int i = 0; i < 2; i++) { - Vector2 perturbedspeed = new Vector2(velocity.X + Main.rand.Next(-2,3), velocity.Y + Main.rand.Next(-2,3)).RotatedBy(MathHelper.ToRadians(spread)); + Vector2 perturbedspeed = new Vector2(velocity.X + Main.rand.Next(-2, 3), velocity.Y + Main.rand.Next(-2, 3)).RotatedBy(MathHelper.ToRadians(spread)); int stealth = Projectile.NewProjectile(source, position.X, position.Y, perturbedspeed.X * 1.5f, perturbedspeed.Y * 1.5f, ModContent.ProjectileType(), damage, knockback, player.whoAmI); if (stealth.WithinBounds(Main.maxProjectiles)) Main.projectile[stealth].Calamity().stealthStrike = true; - spread -= Main.rand.Next(1,3); + spread -= Main.rand.Next(1, 3); } return false; } diff --git a/Items/Weapons/Rogue/Sandslasher.cs b/Items/Weapons/Rogue/Sandslasher.cs index 742e002edb..84486e2e08 100644 --- a/Items/Weapons/Rogue/Sandslasher.cs +++ b/Items/Weapons/Rogue/Sandslasher.cs @@ -1,10 +1,10 @@ -using Terraria.DataStructures; +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Rogue; namespace CalamityMod.Items.Weapons.Rogue { @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 5f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 8f; diff --git a/Items/Weapons/Rogue/ScarletDevil.cs b/Items/Weapons/Rogue/ScarletDevil.cs index 17aa26466f..9d53380866 100644 --- a/Items/Weapons/Rogue/ScarletDevil.cs +++ b/Items/Weapons/Rogue/ScarletDevil.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.shootSpeed = 30f; Item.DamageType = RogueDamageClass.Instance; - Item.value = CalamityGlobalItem.Rarity16BuyPrice; + Item.value = CalamityGlobalItem.RarityHotPinkBuyPrice; Item.rare = ModContent.RarityType(); Item.Calamity().devItem = true; } diff --git a/Items/Weapons/Rogue/ScourgeoftheDesert.cs b/Items/Weapons/Rogue/ScourgeoftheDesert.cs index f3c9976c85..c39e7906bd 100644 --- a/Items/Weapons/Rogue/ScourgeoftheDesert.cs +++ b/Items/Weapons/Rogue/ScourgeoftheDesert.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -21,14 +21,14 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 3.5f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; Item.DamageType = RogueDamageClass.Instance; } - public override float StealthDamageMultiplier => 0.65f; + public override float StealthDamageMultiplier => 0.65f; 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/Rogue/ScourgeoftheSeas.cs b/Items/Weapons/Rogue/ScourgeoftheSeas.cs index ca60c4b3cc..73754f4fb0 100644 --- a/Items/Weapons/Rogue/ScourgeoftheSeas.cs +++ b/Items/Weapons/Rogue/ScourgeoftheSeas.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -11,25 +11,24 @@ namespace CalamityMod.Items.Weapons.Rogue { public override void SetDefaults() { - Item.damage = 56; + Item.width = 64; + Item.height = 66; + Item.damage = 50; Item.knockBack = 3.5f; Item.useAnimation = Item.useTime = 24; Item.autoReuse = true; Item.DamageType = RogueDamageClass.Instance; Item.shootSpeed = 10f; Item.shoot = ModContent.ProjectileType(); - - Item.width = 64; - Item.height = 66; Item.noMelee = true; Item.noUseGraphic = true; Item.useStyle = ItemUseStyleID.Swing; Item.UseSound = SoundID.Item1; Item.rare = ItemRarityID.Pink; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; } - public override float StealthDamageMultiplier => 1.4f; + public override float StealthDamageMultiplier => 1.55f; public override float StealthVelocityMultiplier => 1.2f; 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/Rogue/SeafoamBomb.cs b/Items/Weapons/Rogue/SeafoamBomb.cs index 7d38c32b2f..63f19c3669 100644 --- a/Items/Weapons/Rogue/SeafoamBomb.cs +++ b/Items/Weapons/Rogue/SeafoamBomb.cs @@ -1,9 +1,10 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Placeables; +using System.Collections.Generic; using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -24,7 +25,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 8f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 8f; @@ -42,6 +43,7 @@ namespace CalamityMod.Items.Weapons.Rogue } return true; } + public override void ModifyTooltips(List list) => list.FindAndReplace("[GFB]", this.GetLocalizedValue(Main.zenithWorld ? "TooltipGFB" : "TooltipNormal")); public override void AddRecipes() { diff --git a/Items/Weapons/Rogue/SealedSingularity.cs b/Items/Weapons/Rogue/SealedSingularity.cs index 5496fee9ae..9eb6db81d9 100644 --- a/Items/Weapons/Rogue/SealedSingularity.cs +++ b/Items/Weapons/Rogue/SealedSingularity.cs @@ -13,6 +13,7 @@ namespace CalamityMod.Items.Weapons.Rogue { public override void SetDefaults() { + Item.width = Item.height = 34; Item.damage = 260; Item.knockBack = 5f; Item.useAnimation = Item.useTime = 25; @@ -23,15 +24,14 @@ namespace CalamityMod.Items.Weapons.Rogue Item.shootSpeed = 14f; Item.noMelee = Item.noUseGraphic = true; - Item.height = Item.width = 34; Item.UseSound = SoundID.Item106; - Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; } - public override float StealthDamageMultiplier => 0.72f; + public override float StealthDamageMultiplier => 0.72f; 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/Rogue/SearedPan.cs b/Items/Weapons/Rogue/SearedPan.cs index 4e2d6e41d0..411e55ba23 100644 --- a/Items/Weapons/Rogue/SearedPan.cs +++ b/Items/Weapons/Rogue/SearedPan.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.useLimitPerAnimation = 1; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.rare = ModContent.RarityType(); Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 15f; diff --git a/Items/Weapons/Rogue/ShardofAntumbra.cs b/Items/Weapons/Rogue/ShardofAntumbra.cs index d75d59cc2c..fae8820a7f 100644 --- a/Items/Weapons/Rogue/ShardofAntumbra.cs +++ b/Items/Weapons/Rogue/ShardofAntumbra.cs @@ -1,8 +1,8 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -19,6 +19,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { Item.width = 48; + Item.height = 48; Item.damage = 240; Item.noMelee = true; Item.consumable = true; @@ -29,16 +30,15 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 8f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 48; Item.maxStack = 9999; Item.value = 10000; - Item.rare = ItemRarityID.Cyan; + Item.rare = ItemRarityID.Red; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 24f; Item.DamageType = RogueDamageClass.Instance; } - public override float StealthDamageMultiplier => 0.8f; + public override float StealthDamageMultiplier => 0.8f; 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/Rogue/ShatteredSun.cs b/Items/Weapons/Rogue/ShatteredSun.cs index 30d63e01e2..a6c682cd9d 100644 --- a/Items/Weapons/Rogue/ShatteredSun.cs +++ b/Items/Weapons/Rogue/ShatteredSun.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 6f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 25f; @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Weapons.Rogue // Terraria seems to really dislike high crit values in SetDefaults public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 10; - public override float StealthDamageMultiplier => 1.2f; + public override float StealthDamageMultiplier => 1.2f; 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/Rogue/ShinobiBlade.cs b/Items/Weapons/Rogue/ShinobiBlade.cs index bd8858b19e..deab1b3dc7 100644 --- a/Items/Weapons/Rogue/ShinobiBlade.cs +++ b/Items/Weapons/Rogue/ShinobiBlade.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.maxStack = 1; - Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; diff --git a/Items/Weapons/Rogue/ShockGrenade.cs b/Items/Weapons/Rogue/ShockGrenade.cs index 4b621ad777..0afc12fa2d 100644 --- a/Items/Weapons/Rogue/ShockGrenade.cs +++ b/Items/Weapons/Rogue/ShockGrenade.cs @@ -1,8 +1,8 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -12,12 +12,13 @@ namespace CalamityMod.Items.Weapons.Rogue { public override void SetStaticDefaults() { - Item.ResearchUnlockCount = 99; + Item.ResearchUnlockCount = 99; } public override void SetDefaults() { Item.width = 14; + Item.height = 30; Item.damage = 108; Item.noMelee = true; Item.noUseGraphic = true; @@ -26,7 +27,6 @@ namespace CalamityMod.Items.Weapons.Rogue Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 1f; Item.autoReuse = true; - Item.height = 30; Item.maxStack = 9999; Item.value = Item.buyPrice(0, 1, 0, 0); Item.rare = ItemRarityID.Yellow; diff --git a/Items/Weapons/Rogue/SkyStabber.cs b/Items/Weapons/Rogue/SkyStabber.cs index c3c9d18edc..21446160b0 100644 --- a/Items/Weapons/Rogue/SkyStabber.cs +++ b/Items/Weapons/Rogue/SkyStabber.cs @@ -1,41 +1,39 @@ -using Terraria.DataStructures; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Microsoft.Xna.Framework; +using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; -using CalamityMod.CalPlayer; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { public class SkyStabber : RogueWeapon { - private static int damage = 50; private static int knockBack = 2; public override void SetDefaults() { - Item.damage = damage; + Item.width = 16; + Item.height = 16; + Item.damage = 50; Item.DamageType = RogueDamageClass.Instance; Item.noMelee = true; Item.noUseGraphic = true; - Item.width = 16; - Item.height = 16; Item.useTime = 15; Item.useAnimation = 15; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = knockBack; - Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; Item.UseSound = SoundID.Item1; - Item.shootSpeed = 2f; + Item.shootSpeed = 2.2f; Item.shoot = ModContent.ProjectileType(); } - // Terraria seems to really dislike high crit values in SetDefaults - public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 4; + public override float StealthDamageMultiplier => 0.5f; public override bool CanUseItem(Player player) { diff --git a/Items/Weapons/Rogue/SkyfinBombers.cs b/Items/Weapons/Rogue/SkyfinBombers.cs index 9e5417ae63..f03534a050 100644 --- a/Items/Weapons/Rogue/SkyfinBombers.cs +++ b/Items/Weapons/Rogue/SkyfinBombers.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -12,6 +12,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { Item.width = 28; + Item.height = 30; Item.damage = 46; Item.noMelee = true; Item.noUseGraphic = true; @@ -21,8 +22,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 6.5f; Item.UseSound = SoundID.Item11; Item.autoReuse = true; - Item.height = 30; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; diff --git a/Items/Weapons/Rogue/SlickCane.cs b/Items/Weapons/Rogue/SlickCane.cs index 9fba261b41..09d437d088 100644 --- a/Items/Weapons/Rogue/SlickCane.cs +++ b/Items/Weapons/Rogue/SlickCane.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -17,14 +17,13 @@ namespace CalamityMod.Items.Weapons.Rogue Item.noMelee = true; Item.noUseGraphic = true; Item.channel = true; - Item.DamageType = DamageClass.Melee; Item.useAnimation = 26; Item.useTime = 26; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 5f; Item.UseSound = SoundID.DD2_GhastlyGlaivePierce; Item.autoReuse = true; - Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 22f; diff --git a/Items/Weapons/Rogue/SludgeSplotch.cs b/Items/Weapons/Rogue/SludgeSplotch.cs index 1ce4a04c76..f35fe11b61 100644 --- a/Items/Weapons/Rogue/SludgeSplotch.cs +++ b/Items/Weapons/Rogue/SludgeSplotch.cs @@ -1,11 +1,11 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Items.Weapons.Rogue { @@ -19,6 +19,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { Item.width = 32; + Item.height = 30; Item.damage = 48; Item.noMelee = true; Item.noUseGraphic = true; @@ -28,7 +29,6 @@ namespace CalamityMod.Items.Weapons.Rogue Item.useTime = 18; Item.knockBack = 1f; Item.autoReuse = true; - Item.height = 30; Item.maxStack = 9999; Item.value = Item.sellPrice(0, 0, 0, 40); Item.rare = ItemRarityID.Green; diff --git a/Items/Weapons/Rogue/SnapClam.cs b/Items/Weapons/Rogue/SnapClam.cs index 6008498f70..31c3e263d9 100644 --- a/Items/Weapons/Rogue/SnapClam.cs +++ b/Items/Weapons/Rogue/SnapClam.cs @@ -1,8 +1,8 @@ -using Terraria.DataStructures; +using System; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.width = 26; Item.height = 16; Item.damage = 14; - Item.DamageType = DamageClass.Throwing; + Item.DamageType = RogueDamageClass.Instance; Item.noMelee = true; Item.noUseGraphic = true; Item.useTime = 25; @@ -24,11 +24,10 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 3f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; - Item.DamageType = RogueDamageClass.Instance; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) @@ -38,11 +37,11 @@ namespace CalamityMod.Items.Weapons.Rogue int spread = 3; for (int i = 0; i < 5; i++) { - Vector2 perturbedspeed = new Vector2(velocity.X + Main.rand.Next(-3,4), velocity.Y + Main.rand.Next(-3,4)).RotatedBy(MathHelper.ToRadians(spread)); + Vector2 perturbedspeed = new Vector2(velocity.X + Main.rand.Next(-3, 4), velocity.Y + Main.rand.Next(-3, 4)).RotatedBy(MathHelper.ToRadians(spread)); int proj = Projectile.NewProjectile(source, position, perturbedspeed, ModContent.ProjectileType(), Math.Max(damage / 5, 1), knockback / 5f, player.whoAmI); if (proj.WithinBounds(Main.maxProjectiles)) Main.projectile[proj].Calamity().stealthStrike = true; - spread -= Main.rand.Next(1,3); + spread -= Main.rand.Next(1, 3); } return false; } diff --git a/Items/Weapons/Rogue/SpearofDestiny.cs b/Items/Weapons/Rogue/SpearofDestiny.cs index d4fd9c8be5..292c1b9aef 100644 --- a/Items/Weapons/Rogue/SpearofDestiny.cs +++ b/Items/Weapons/Rogue/SpearofDestiny.cs @@ -1,11 +1,11 @@ -using Terraria.DataStructures; +using CalamityMod.Items.Accessories; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using CalamityMod.Items.Accessories; namespace CalamityMod.Items.Weapons.Rogue { @@ -18,6 +18,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { Item.width = 52; + Item.height = 52; Item.damage = 50; Item.noMelee = true; Item.noUseGraphic = true; @@ -27,8 +28,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 2f; Item.UseSound = ThrowSound; Item.autoReuse = true; - Item.height = 52; - Item.value = CalamityGlobalItem.Rarity6BuyPrice; + Item.value = CalamityGlobalItem.RarityLightPurpleBuyPrice; Item.rare = ItemRarityID.LightPurple; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; diff --git a/Items/Weapons/Rogue/SpearofPaleolith.cs b/Items/Weapons/Rogue/SpearofPaleolith.cs index 9af9342705..519c1c8cb2 100644 --- a/Items/Weapons/Rogue/SpearofPaleolith.cs +++ b/Items/Weapons/Rogue/SpearofPaleolith.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -12,6 +12,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { Item.width = 54; + Item.height = 54; Item.damage = 65; Item.noMelee = true; Item.noUseGraphic = true; @@ -21,8 +22,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 6f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 54; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 35f; diff --git a/Items/Weapons/Rogue/SpentFuelContainer.cs b/Items/Weapons/Rogue/SpentFuelContainer.cs index 508da55f44..cb5c4c8ad0 100644 --- a/Items/Weapons/Rogue/SpentFuelContainer.cs +++ b/Items/Weapons/Rogue/SpentFuelContainer.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -12,16 +12,16 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { - Item.damage = 50; Item.width = 22; Item.height = 24; - Item.useAnimation = 35; - Item.useTime = 35; + Item.damage = 80; + Item.useAnimation = 50; + Item.useTime = 50; Item.noMelee = true; Item.noUseGraphic = true; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 4.5f; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item106; Item.autoReuse = true; @@ -29,6 +29,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.shootSpeed = 15f; Item.DamageType = RogueDamageClass.Instance; } + public override float StealthDamageMultiplier => 0.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/Rogue/StarofDestruction.cs b/Items/Weapons/Rogue/StarofDestruction.cs index 7a731d46b3..ea2e50ca8e 100644 --- a/Items/Weapons/Rogue/StarofDestruction.cs +++ b/Items/Weapons/Rogue/StarofDestruction.cs @@ -1,8 +1,8 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -21,14 +21,14 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 10f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.value = CalamityGlobalItem.Rarity9BuyPrice; - Item.rare = ItemRarityID.Cyan; + Item.value = CalamityGlobalItem.RarityRedBuyPrice; + Item.rare = ItemRarityID.Red; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 5f; Item.DamageType = RogueDamageClass.Instance; } - public override float StealthDamageMultiplier => 0.8f; + public override float StealthDamageMultiplier => 0.8f; 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/Rogue/StellarKnife.cs b/Items/Weapons/Rogue/StellarKnife.cs index b9764af235..38f8dc355d 100644 --- a/Items/Weapons/Rogue/StellarKnife.cs +++ b/Items/Weapons/Rogue/StellarKnife.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 32; Item.height = 34; - Item.damage = 50; + Item.damage = 82; Item.noMelee = true; Item.noUseGraphic = true; Item.useAnimation = 9; @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 4f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; diff --git a/Items/Weapons/Rogue/StickySpikyBall.cs b/Items/Weapons/Rogue/StickySpikyBall.cs index 6b6769a93e..40d52883b8 100644 --- a/Items/Weapons/Rogue/StickySpikyBall.cs +++ b/Items/Weapons/Rogue/StickySpikyBall.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -17,6 +17,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { Item.width = 14; + Item.height = 14; Item.damage = 10; Item.noMelee = true; Item.noUseGraphic = true; @@ -27,7 +28,6 @@ namespace CalamityMod.Items.Weapons.Rogue Item.useTime = 20; Item.knockBack = 3f; Item.UseSound = SoundID.Item1; - Item.height = 14; Item.value = Item.buyPrice(0, 0, 1, 0); Item.rare = ItemRarityID.Blue; Item.shoot = ModContent.ProjectileType(); @@ -42,7 +42,7 @@ namespace CalamityMod.Items.Weapons.Rogue int spread = 3; for (int i = 0; i < 4; i++) { - Vector2 perturbedspeed = new Vector2(velocity.X + Main.rand.Next(-3,4), velocity.Y + Main.rand.Next(-3,4)).RotatedBy(MathHelper.ToRadians(spread)); + Vector2 perturbedspeed = new Vector2(velocity.X + Main.rand.Next(-3, 4), velocity.Y + Main.rand.Next(-3, 4)).RotatedBy(MathHelper.ToRadians(spread)); int proj = Projectile.NewProjectile(source, position, perturbedspeed, type, damage, knockback, player.whoAmI); if (proj.WithinBounds(Main.maxProjectiles)) { @@ -50,7 +50,7 @@ namespace CalamityMod.Items.Weapons.Rogue Main.projectile[proj].timeLeft *= 4; Main.projectile[proj].localNPCHitCooldown += 15; } - spread -= Main.rand.Next(1,4); + spread -= Main.rand.Next(1, 4); } return false; } diff --git a/Items/Weapons/Rogue/StormfrontRazor.cs b/Items/Weapons/Rogue/StormfrontRazor.cs index f41fe6dce1..cbfac2a18a 100644 --- a/Items/Weapons/Rogue/StormfrontRazor.cs +++ b/Items/Weapons/Rogue/StormfrontRazor.cs @@ -4,9 +4,9 @@ using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using Terraria.DataStructures; namespace CalamityMod.Items.Weapons.Rogue { @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.useStyle = ItemUseStyleID.Swing; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.useAnimation = 20; Item.useTime = 20; @@ -44,7 +44,7 @@ namespace CalamityMod.Items.Weapons.Rogue // Terraria seems to really dislike high crit values in SetDefaults public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 8; - public override float StealthDamageMultiplier => 1.2f; + public override float StealthDamageMultiplier => 1.2f; public override float StealthVelocityMultiplier => 1.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/Rogue/SubductionSlicer.cs b/Items/Weapons/Rogue/SubductionSlicer.cs index b5b84384bb..12656fa1e0 100644 --- a/Items/Weapons/Rogue/SubductionSlicer.cs +++ b/Items/Weapons/Rogue/SubductionSlicer.cs @@ -1,8 +1,8 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 50; Item.height = 48; - Item.damage = 90; + Item.damage = 95; Item.noMelee = true; Item.noUseGraphic = true; Item.autoReuse = true; diff --git a/Items/Weapons/Rogue/Supernova.cs b/Items/Weapons/Rogue/Supernova.cs index 4ef4dc7e96..d6bef9b091 100644 --- a/Items/Weapons/Rogue/Supernova.cs +++ b/Items/Weapons/Rogue/Supernova.cs @@ -4,6 +4,7 @@ using CalamityMod.Projectiles.Rogue; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; using Terraria.DataStructures; @@ -14,28 +15,30 @@ namespace CalamityMod.Items.Weapons.Rogue { public class Supernova : RogueWeapon { - public static readonly SoundStyle ExplosionSound = new("CalamityMod/Sounds/Item/SupernovaBoom") { Volume = 0.8f }; + public static readonly SoundStyle ExplosionSound = new("CalamityMod/Sounds/Item/SupernovaBoom") { Volume = 0.9f }; + public static readonly SoundStyle StealthExplosionSound = new("CalamityMod/Sounds/Item/SupernovaStealthExplode") { Volume = 1f }; + public static readonly SoundStyle StealthChargeSound = new("CalamityMod/Sounds/Item/SupernovaStealthCharge") { Volume = 1f }; public override void SetDefaults() { - Item.width = 34; - Item.damage = 675; + Item.width = 106; + Item.height = 112; + Item.damage = 5036; Item.noMelee = true; Item.noUseGraphic = true; - Item.useAnimation = 24; + Item.useAnimation = 70; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 24; - Item.knockBack = 8f; - Item.UseSound = SoundID.Item15; + Item.useTime = 70; + Item.knockBack = 18f; + Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 36; - Item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 16f; Item.DamageType = RogueDamageClass.Instance; Item.rare = ModContent.RarityType(); } - public override float StealthDamageMultiplier => 1.08f; + public override float StealthDamageMultiplier => 0.7f; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { @@ -46,7 +49,14 @@ namespace CalamityMod.Items.Weapons.Rogue Main.projectile[stealth].Calamity().stealthStrike = true; return false; } - return true; + else + Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); + return false; + } + + 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/Rogue/SupernovaGlow").Value); } public override void AddRecipes() diff --git a/Items/Weapons/Rogue/Supernova.png b/Items/Weapons/Rogue/Supernova.png index d4aa9c8ad8..a2af6d61e2 100644 Binary files a/Items/Weapons/Rogue/Supernova.png and b/Items/Weapons/Rogue/Supernova.png differ diff --git a/Items/Weapons/Rogue/SupernovaGlow.png b/Items/Weapons/Rogue/SupernovaGlow.png new file mode 100644 index 0000000000..0d383aedb3 Binary files /dev/null and b/Items/Weapons/Rogue/SupernovaGlow.png differ diff --git a/Items/Weapons/Rogue/TarragonThrowingDart.cs b/Items/Weapons/Rogue/TarragonThrowingDart.cs index 1f16c4a6b0..36cf6c2268 100644 --- a/Items/Weapons/Rogue/TarragonThrowingDart.cs +++ b/Items/Weapons/Rogue/TarragonThrowingDart.cs @@ -19,6 +19,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { Item.width = 34; + Item.height = 34; Item.damage = 380; Item.noMelee = true; Item.consumable = true; @@ -29,7 +30,6 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 4.5f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 34; Item.maxStack = 9999; Item.value = Item.sellPrice(copper: 30); Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Rogue/TerraDisk.png b/Items/Weapons/Rogue/TerraDisk.png deleted file mode 100644 index 32b39a6f1e..0000000000 Binary files a/Items/Weapons/Rogue/TerraDisk.png and /dev/null differ diff --git a/Items/Weapons/Rogue/TerrorTalons.cs b/Items/Weapons/Rogue/TerrorTalons.cs index 16bdaf0bf9..ae55c3601e 100644 --- a/Items/Weapons/Rogue/TerrorTalons.cs +++ b/Items/Weapons/Rogue/TerrorTalons.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -14,6 +14,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { Item.width = 40; + Item.height = 24; Item.damage = 52; Item.noMelee = true; Item.noUseGraphic = true; @@ -22,15 +23,14 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 3f; Item.UseSound = SoundID.Item39; Item.autoReuse = true; - Item.height = 24; - Item.value = CalamityGlobalItem.Rarity6BuyPrice; + Item.value = CalamityGlobalItem.RarityLightPurpleBuyPrice; Item.rare = ItemRarityID.LightPurple; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10.5f; Item.DamageType = RogueDamageClass.Instance; } - public override float StealthDamageMultiplier => 9f; + public override float StealthDamageMultiplier => 9f; 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/Rogue/TheAtomSplitter.cs b/Items/Weapons/Rogue/TheAtomSplitter.cs index 5d6f0e4df8..86757b4e4a 100644 --- a/Items/Weapons/Rogue/TheAtomSplitter.cs +++ b/Items/Weapons/Rogue/TheAtomSplitter.cs @@ -29,13 +29,13 @@ namespace CalamityMod.Items.Weapons.Rogue Item.rare = ModContent.RarityType(); } - public override float StealthDamageMultiplier => 1.1f; + public override float StealthDamageMultiplier => 1f; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { int javelin = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, -1f); if (player.Calamity().StealthStrikeAvailable() && Main.projectile.IndexInRange(javelin)) - { + { Main.projectile[javelin].Calamity().stealthStrike = true; } return false; diff --git a/Items/Weapons/Rogue/FinalDawn.cs b/Items/Weapons/Rogue/TheFinalDawn.cs similarity index 91% rename from Items/Weapons/Rogue/FinalDawn.cs rename to Items/Weapons/Rogue/TheFinalDawn.cs index 3f20d5361a..45f45c9fe6 100644 --- a/Items/Weapons/Rogue/FinalDawn.cs +++ b/Items/Weapons/Rogue/TheFinalDawn.cs @@ -1,28 +1,29 @@ using CalamityMod.Projectiles.Rogue; using CalamityMod.Rarities; using Terraria; -using Terraria.ID; using Terraria.Audio; +using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; namespace CalamityMod.Items.Weapons.Rogue { - public class FinalDawn : RogueWeapon + [LegacyName("FinalDawn")] + public class TheFinalDawn : RogueWeapon { public static readonly SoundStyle UseSound = new("CalamityMod/Sounds/Item/FinalDawnSlash"); public override void SetDefaults() { - Item.damage = 2500; - Item.DamageType = RogueDamageClass.Instance; Item.width = 78; Item.height = 66; + Item.damage = 2500; + Item.DamageType = RogueDamageClass.Instance; Item.noMelee = true; Item.useTime = Item.useAnimation = 15; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 4; - Item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; diff --git a/Items/Weapons/Rogue/FinalDawn.png b/Items/Weapons/Rogue/TheFinalDawn.png similarity index 100% rename from Items/Weapons/Rogue/FinalDawn.png rename to Items/Weapons/Rogue/TheFinalDawn.png diff --git a/Items/Weapons/Rogue/TheOldReaper.cs b/Items/Weapons/Rogue/TheOldReaper.cs index 9c8f188a27..dffec98bbb 100644 --- a/Items/Weapons/Rogue/TheOldReaper.cs +++ b/Items/Weapons/Rogue/TheOldReaper.cs @@ -14,6 +14,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { Item.width = 106; + Item.height = 104; Item.damage = 180; Item.noMelee = true; Item.noUseGraphic = true; @@ -23,12 +24,11 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 4f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 104; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 16f; Item.DamageType = RogueDamageClass.Instance; - Item.value = CalamityGlobalItem.Rarity13BuyPrice; + Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; Item.rare = ModContent.RarityType(); } @@ -41,13 +41,13 @@ namespace CalamityMod.Items.Weapons.Rogue int spread = 15; for (int i = 0; i < 3; i++) { - Vector2 perturbedspeed = new Vector2(velocity.X + Main.rand.Next(-2,3), velocity.Y + Main.rand.Next(-2,3)).RotatedBy(MathHelper.ToRadians(spread)); - int proj = Projectile.NewProjectile(source, position, perturbedspeed, type, (int)(damage*0.45), knockback, player.whoAmI); + Vector2 perturbedspeed = new Vector2(velocity.X + Main.rand.Next(-2, 3), velocity.Y + Main.rand.Next(-2, 3)).RotatedBy(MathHelper.ToRadians(spread)); + int proj = Projectile.NewProjectile(source, position, perturbedspeed, type, (int)(damage * 0.45), knockback, player.whoAmI); if (proj.WithinBounds(Main.maxProjectiles)) { Main.projectile[proj].Calamity().stealthStrike = true; } - spread -= Main.rand.Next(5,8); + spread -= Main.rand.Next(5, 8); } return false; } diff --git a/Items/Weapons/Rogue/TheSyringe.cs b/Items/Weapons/Rogue/TheSyringe.cs index d41e6979e1..0275281647 100644 --- a/Items/Weapons/Rogue/TheSyringe.cs +++ b/Items/Weapons/Rogue/TheSyringe.cs @@ -1,39 +1,38 @@ -using Terraria.DataStructures; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; -using Terraria.ModLoader; +using Terraria.DataStructures; using Terraria.ID; -using CalamityMod.Projectiles.Rogue; +using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { public class TheSyringe : RogueWeapon { - public static int BaseDamage = 60; public static float Knockback = 5f; public static float Speed = 15f; public override void SetDefaults() { - Item.damage = BaseDamage; + Item.width = 14; + Item.height = 50; + Item.damage = 60; Item.knockBack = Knockback; Item.autoReuse = true; Item.useTime = 15; Item.useAnimation = 15; Item.useStyle = ItemUseStyleID.Swing; - Item.width = 14; - Item.height = 50; Item.UseSound = SoundID.Item106; Item.noMelee = true; Item.noUseGraphic = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = Speed; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; Item.DamageType = RogueDamageClass.Instance; } - public override float StealthDamageMultiplier => 1.2f; + public override float StealthDamageMultiplier => 1.2f; 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/Rogue/ThrowingBrick.cs b/Items/Weapons/Rogue/ThrowingBrick.cs index 77cded8738..a8fb418509 100644 --- a/Items/Weapons/Rogue/ThrowingBrick.cs +++ b/Items/Weapons/Rogue/ThrowingBrick.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -11,15 +11,15 @@ namespace CalamityMod.Items.Weapons.Rogue { public override void SetStaticDefaults() { - Item.ResearchUnlockCount = 99; + Item.ResearchUnlockCount = 99; } public override void SetDefaults() { + Item.width = 28; + Item.height = 20; Item.damage = 17; Item.shootSpeed = 12f; Item.shoot = ModContent.ProjectileType(); - Item.width = 28; - Item.height = 20; Item.useTime = Item.useAnimation = 35; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 5f; diff --git a/Items/Weapons/Rogue/TimeBolt.cs b/Items/Weapons/Rogue/TimeBolt.cs index 3f5ac89429..35937393a0 100644 --- a/Items/Weapons/Rogue/TimeBolt.cs +++ b/Items/Weapons/Rogue/TimeBolt.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 4f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.value = CalamityGlobalItem.Rarity13BuyPrice; + Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; Item.shoot = ModContent.ProjectileType(); @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.DamageType = RogueDamageClass.Instance; } - public override float StealthDamageMultiplier => 0.68f; + public override float StealthDamageMultiplier => 0.68f; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { @@ -51,7 +51,7 @@ namespace CalamityMod.Items.Weapons.Rogue AddIngredient(). AddIngredient(ItemID.FastClock). AddIngredient(5). - AddIngredient(20). + AddIngredient(20). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Rogue/TitaniumShuriken.cs b/Items/Weapons/Rogue/TitaniumShuriken.cs index 93c58d42f3..9c6f50b5a9 100644 --- a/Items/Weapons/Rogue/TitaniumShuriken.cs +++ b/Items/Weapons/Rogue/TitaniumShuriken.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue @@ -16,7 +16,8 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { Item.width = 34; - Item.damage = 56; + Item.height = 34; + Item.damage = 41; Item.noMelee = true; Item.consumable = true; Item.noUseGraphic = true; @@ -26,7 +27,6 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 3f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 34; Item.maxStack = 9999; Item.value = 2000; Item.rare = ItemRarityID.LightRed; @@ -34,6 +34,9 @@ namespace CalamityMod.Items.Weapons.Rogue Item.shootSpeed = 16f; Item.DamageType = RogueDamageClass.Instance; } + public override float StealthDamageMultiplier => 1.3f; + public override float StealthVelocityMultiplier => 1.25f; + // Terraria seems to really dislike high crit values in SetDefaults public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 10; diff --git a/Items/Weapons/Rogue/ToothBall.cs b/Items/Weapons/Rogue/ToothBall.cs index 8e3abaa582..d328fe0d43 100644 --- a/Items/Weapons/Rogue/ToothBall.cs +++ b/Items/Weapons/Rogue/ToothBall.cs @@ -1,8 +1,8 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -18,6 +18,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { Item.width = 30; + Item.height = 30; Item.damage = 26; Item.noMelee = true; Item.consumable = true; @@ -28,7 +29,6 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 2.5f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 30; Item.maxStack = 9999; Item.value = 1000; Item.rare = ItemRarityID.Orange; diff --git a/Items/Weapons/Rogue/TotalityBreakers.cs b/Items/Weapons/Rogue/TotalityBreakers.cs index eec29a890f..d531ffe9ce 100644 --- a/Items/Weapons/Rogue/TotalityBreakers.cs +++ b/Items/Weapons/Rogue/TotalityBreakers.cs @@ -1,10 +1,10 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using Microsoft.Xna.Framework; namespace CalamityMod.Items.Weapons.Rogue { @@ -13,6 +13,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { Item.width = 32; + Item.height = 42; Item.damage = 50; Item.noMelee = true; Item.noUseGraphic = true; @@ -22,15 +23,14 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 5f; Item.UseSound = SoundID.Item106; Item.autoReuse = true; - Item.height = 42; - Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; Item.DamageType = RogueDamageClass.Instance; } - public override float StealthDamageMultiplier => 1.3f; + public override float StealthDamageMultiplier => 1.3f; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { @@ -47,7 +47,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.MolotovCocktail, 50). + AddIngredient(ItemID.MolotovCocktail, 50). AddIngredient(10). AddTile(TileID.MythrilAnvil). Register(); diff --git a/Items/Weapons/Rogue/ToxicantTwister.cs b/Items/Weapons/Rogue/ToxicantTwister.cs index 487e6913aa..d5dce99ce1 100644 --- a/Items/Weapons/Rogue/ToxicantTwister.cs +++ b/Items/Weapons/Rogue/ToxicantTwister.cs @@ -26,11 +26,11 @@ namespace CalamityMod.Items.Weapons.Rogue Item.shootSpeed = 18f; Item.DamageType = RogueDamageClass.Instance; - Item.value = CalamityGlobalItem.Rarity13BuyPrice; + Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; Item.rare = ModContent.RarityType(); } - public override float StealthDamageMultiplier => 1.3f; + public override float StealthDamageMultiplier => 1.3f; 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/Rogue/Turbulance.cs b/Items/Weapons/Rogue/Turbulance.cs index b83c6a9340..00536460cd 100644 --- a/Items/Weapons/Rogue/Turbulance.cs +++ b/Items/Weapons/Rogue/Turbulance.cs @@ -1,8 +1,8 @@ -using Terraria.DataStructures; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; -using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -13,6 +13,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { Item.width = 14; + Item.height = 14; Item.damage = 18; Item.noMelee = true; Item.noUseGraphic = true; @@ -22,8 +23,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 5f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 14; - Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; diff --git a/Items/Weapons/Rogue/TwistingThunder.cs b/Items/Weapons/Rogue/TwistingThunder.cs index 662885493c..aa3d36d2b3 100644 --- a/Items/Weapons/Rogue/TwistingThunder.cs +++ b/Items/Weapons/Rogue/TwistingThunder.cs @@ -14,18 +14,17 @@ namespace CalamityMod.Items.Weapons.Rogue { public override void SetDefaults() { - Item.damage = 466; - Item.knockBack = 10f; - Item.width = 56; Item.height = 56; + Item.damage = 466; + Item.knockBack = 10f; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.noUseGraphic = true; Item.useTime = 21; Item.useAnimation = 21; - Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); Item.DamageType = RogueDamageClass.Instance; @@ -39,10 +38,10 @@ namespace CalamityMod.Items.Weapons.Rogue public override float StealthVelocityMultiplier => 1.5f; public override void ModifyStatsExtra(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) - { - if (Main.raining) - velocity = velocity * 1.5f; - } + { + if (Main.raining) + velocity = velocity * 1.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/Rogue/UrchinStinger.cs b/Items/Weapons/Rogue/UrchinStinger.cs index 5d36df2c99..07622f7198 100644 --- a/Items/Weapons/Rogue/UrchinStinger.cs +++ b/Items/Weapons/Rogue/UrchinStinger.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue @@ -16,6 +16,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { Item.width = 10; + Item.height = 26; Item.damage = 13; Item.noMelee = true; Item.consumable = true; @@ -26,7 +27,6 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 1.5f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 26; Item.maxStack = 9999; Item.value = 200; Item.rare = ItemRarityID.Blue; @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.DamageType = RogueDamageClass.Instance; } - public override float StealthDamageMultiplier => 2f; + public override float StealthDamageMultiplier => 2f; 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/Rogue/UtensilPoker.cs b/Items/Weapons/Rogue/UtensilPoker.cs index dba6b5b87e..01742616dc 100644 --- a/Items/Weapons/Rogue/UtensilPoker.cs +++ b/Items/Weapons/Rogue/UtensilPoker.cs @@ -1,11 +1,11 @@ -using Terraria.DataStructures; -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; +using CalamityMod.Particles; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Particles; namespace CalamityMod.Items.Weapons.Rogue { @@ -24,28 +24,28 @@ namespace CalamityMod.Items.Weapons.Rogue Item.useStyle = ItemUseStyleID.Swing; Item.useTime = 15; Item.useAnimation = 45; - Item.reuseDelay = 15; + Item.reuseDelay = 15; Item.useLimitPerAnimation = 3; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.value = CalamityGlobalItem.Rarity10BuyPrice; + Item.value = CalamityGlobalItem.RarityRedBuyPrice; Item.rare = ItemRarityID.Red; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; } - public override float StealthDamageMultiplier => 2f; + public override float StealthDamageMultiplier => 2f; public override float StealthVelocityMultiplier => 1.4f; public override void ModifyStatsExtra(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) - { + { CalamityPlayer mp = player.Calamity(); if (mp.StealthStrikeAvailable()) { - type = ModContent.ProjectileType(); - } - else - { + type = ModContent.ProjectileType(); + } + else + { type = ModContent.ProjectileType(); double dmgMult = 1D; float kbMult = 1f; @@ -69,19 +69,19 @@ namespace CalamityMod.Items.Weapons.Rogue default: break; } - damage = (int)(damage * dmgMult); - knockback = knockback * kbMult; - + damage = (int)(damage * dmgMult); + knockback = knockback * kbMult; + } - } + } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { CalamityPlayer mp = player.Calamity(); - int idx = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); - if (idx.WithinBounds(Main.maxProjectiles)) - Main.projectile[idx].Calamity().stealthStrike = mp.StealthStrikeAvailable(); + int idx = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); + if (idx.WithinBounds(Main.maxProjectiles)) + Main.projectile[idx].Calamity().stealthStrike = mp.StealthStrikeAvailable(); counter++; if (counter >= 3) counter = 0; diff --git a/Items/Weapons/Rogue/Valediction.cs b/Items/Weapons/Rogue/Valediction.cs index 3cd01e2616..41462166f4 100644 --- a/Items/Weapons/Rogue/Valediction.cs +++ b/Items/Weapons/Rogue/Valediction.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.shootSpeed = 20f; Item.DamageType = RogueDamageClass.Instance; - Item.value = CalamityGlobalItem.Rarity13BuyPrice; + Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; Item.rare = ModContent.RarityType(); } diff --git a/Items/Weapons/Rogue/WaveSkipper.cs b/Items/Weapons/Rogue/WaveSkipper.cs index d53d7ff8c4..7abed0d80a 100644 --- a/Items/Weapons/Rogue/WaveSkipper.cs +++ b/Items/Weapons/Rogue/WaveSkipper.cs @@ -1,23 +1,24 @@ -using Terraria.DataStructures; +using System; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue -{ +{ [LegacyName("DuneHopper")] public class WaveSkipper : RogueWeapon { public static int SpreadAngle = 8; - + public override void SetDefaults() { Item.width = 44; + Item.height = 44; Item.damage = 80; Item.noMelee = true; Item.noUseGraphic = true; @@ -26,8 +27,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 4f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 44; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; diff --git a/Items/Weapons/Rogue/WebBall.cs b/Items/Weapons/Rogue/WebBall.cs index 1020553ad9..b6b8276719 100644 --- a/Items/Weapons/Rogue/WebBall.cs +++ b/Items/Weapons/Rogue/WebBall.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -17,6 +17,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { Item.width = 20; + Item.height = 18; Item.damage = 12; Item.noMelee = true; Item.noUseGraphic = true; @@ -27,7 +28,6 @@ namespace CalamityMod.Items.Weapons.Rogue Item.useTime = 20; Item.knockBack = 3f; Item.UseSound = SoundID.Item1; - Item.height = 18; Item.value = Item.buyPrice(0, 0, 0, 30); Item.rare = ItemRarityID.White; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Rogue/Wrathwing.cs b/Items/Weapons/Rogue/Wrathwing.cs index c75d32c93d..f8f71d8eb5 100644 --- a/Items/Weapons/Rogue/Wrathwing.cs +++ b/Items/Weapons/Rogue/Wrathwing.cs @@ -23,14 +23,14 @@ namespace CalamityMod.Items.Weapons.Rogue Item.useTime = Item.useAnimation = 13; Item.autoReuse = true; Item.UseSound = SoundID.Item1; - Item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.rare = ModContent.RarityType(); Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 28f; Item.DamageType = RogueDamageClass.Instance; } - public override float StealthDamageMultiplier => 0.9f; + public override float StealthDamageMultiplier => 0.9f; 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/Rogue/WulfrumKnife.cs b/Items/Weapons/Rogue/WulfrumKnife.cs index 1d6e7cf3a5..056ec51dd4 100644 --- a/Items/Weapons/Rogue/WulfrumKnife.cs +++ b/Items/Weapons/Rogue/WulfrumKnife.cs @@ -1,12 +1,12 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; +using CalamityMod.Particles; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using CalamityMod.Particles; namespace CalamityMod.Items.Weapons.Rogue { @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Weapons.Rogue public static readonly SoundStyle Throw3Sound = new("CalamityMod/Sounds/Item/WulfrumKnifeThrowFull") { PitchVariance = 0.4f }; public static readonly SoundStyle Throw2Sound = new("CalamityMod/Sounds/Item/WulfrumKnifeThrowTwo") { PitchVariance = 0.4f }; public static readonly SoundStyle Throw1Sound = new("CalamityMod/Sounds/Item/WulfrumKnifeThrowSingle") { PitchVariance = 0.4f }; - public static readonly SoundStyle TileHitSound = new("CalamityMod/Sounds/Item/WulfrumKnifeTileHit", 2) { PitchVariance = 0.4f , MaxInstances = 3}; + public static readonly SoundStyle TileHitSound = new("CalamityMod/Sounds/Item/WulfrumKnifeTileHit", 2) { PitchVariance = 0.4f, MaxInstances = 3 }; public override void SetStaticDefaults() { @@ -28,6 +28,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { Item.width = 22; + Item.height = 38; Item.damage = 9; Item.noMelee = true; Item.consumable = true; @@ -42,7 +43,6 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 1f; Item.UseSound = Throw3Sound; Item.autoReuse = true; - Item.height = 38; Item.maxStack = 9999; Item.value = Item.sellPrice(0, 0, 0, 5); Item.rare = ItemRarityID.Blue; @@ -85,7 +85,7 @@ namespace CalamityMod.Items.Weapons.Rogue } } - + //While this may look stupid, its necessary because ReuseDelay fucks up the consumption of the item otherwise. public override bool ConsumeItem(Player player) => shootCount < 0; public override bool? UseItem(Player player) @@ -121,7 +121,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.UseSound = Throw1Sound; } - public override float StealthDamageMultiplier => 0.8f; + public override float StealthDamageMultiplier => 0.8f; public override bool AdditionalStealthCheck() => stealthStrikeStarted; public override void ModifyStatsExtra(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) diff --git a/Items/Weapons/Summon/AbandonedSlimeStaff.cs b/Items/Weapons/Summon/AbandonedSlimeStaff.cs index ef5fe4c6ab..baf024b006 100644 --- a/Items/Weapons/Summon/AbandonedSlimeStaff.cs +++ b/Items/Weapons/Summon/AbandonedSlimeStaff.cs @@ -1,8 +1,8 @@ -using Terraria.DataStructures; +using System; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; - Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; Item.Calamity().donorItem = true; } diff --git a/Items/Weapons/Summon/AncientIceChunk.cs b/Items/Weapons/Summon/AncientIceChunk.cs index 2f9eec8aac..9554bd8e42 100644 --- a/Items/Weapons/Summon/AncientIceChunk.cs +++ b/Items/Weapons/Summon/AncientIceChunk.cs @@ -31,6 +31,8 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { + Item.width = 38; + Item.height = 50; Item.damage = 25; Item.DamageType = DamageClass.Summon; Item.shoot = ModContent.ProjectileType(); @@ -38,11 +40,9 @@ namespace CalamityMod.Items.Weapons.Summon Item.useTime = Item.useAnimation = 25; Item.mana = 10; - Item.width = 38; - Item.height = 50; Item.noMelee = true; Item.autoReuse = true; - Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; Item.useStyle = ItemUseStyleID.Swing; Item.UseSound = SoundID.Item30; diff --git a/Items/Weapons/Summon/AquasScepter.cs b/Items/Weapons/Summon/AquasScepter.cs index 3e8f4c70d8..40ac018f06 100644 --- a/Items/Weapons/Summon/AquasScepter.cs +++ b/Items/Weapons/Summon/AquasScepter.cs @@ -1,7 +1,7 @@ -using CalamityMod.Projectiles.Summon; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Summon; using CalamityMod.Rarities; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; using Terraria.GameContent.Creative; @@ -10,52 +10,52 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Summon { - public class AquasScepter : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Weapons.Summon"; - public override void SetStaticDefaults() - { - ItemID.Sets.GamepadWholeScreenUseRange[Item.type] = true; - ItemID.Sets.LockOnIgnoresCollision[Item.type] = true; - } + public class AquasScepter : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Weapons.Summon"; + public override void SetStaticDefaults() + { + ItemID.Sets.GamepadWholeScreenUseRange[Item.type] = true; + ItemID.Sets.LockOnIgnoresCollision[Item.type] = true; + } - public override void SetDefaults() - { - Item.damage = 65; - Item.mana = 50; - Item.DamageType = DamageClass.Summon; - Item.sentry = true; - Item.width = 56; - Item.height = 56; - Item.useTime = 30; - Item.useAnimation = 30; - Item.useStyle = 1; - Item.knockBack = 6; - Item.value = CalamityGlobalItem.Rarity12BuyPrice; + public override void SetDefaults() + { + Item.width = 56; + Item.height = 56; + Item.damage = 65; + Item.mana = 50; + Item.DamageType = DamageClass.Summon; + Item.sentry = true; + Item.useTime = 30; + Item.useAnimation = 30; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = 6; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); - Item.Calamity().devItem = true; + Item.Calamity().devItem = true; Item.UseSound = SoundID.Item66; - Item.noMelee = true; - Item.shoot = ModContent.ProjectileType(); - } + Item.noMelee = true; + Item.shoot = ModContent.ProjectileType(); + } - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) - { - position = Main.MouseWorld; - var projectile = Projectile.NewProjectileDirect(source, position, velocity, type, damage, knockback, player.whoAmI); - projectile.originalDamage = Item.damage; - player.UpdateMaxTurrets(); - return false; - } + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + { + position = Main.MouseWorld; + var projectile = Projectile.NewProjectileDirect(source, position, velocity, type, damage, knockback, player.whoAmI); + projectile.originalDamage = Item.damage; + player.UpdateMaxTurrets(); + return false; + } - public override void AddRecipes() - { - Recipe recipe = Recipe.Create(ModContent.ItemType()); - recipe.AddIngredient(ItemID.NimbusRod); - recipe.AddIngredient(ItemID.AquaScepter); + public override void AddRecipes() + { + Recipe recipe = Recipe.Create(ModContent.ItemType()); + recipe.AddIngredient(ItemID.NimbusRod); + recipe.AddIngredient(ItemID.AquaScepter); recipe.AddIngredient(3); recipe.AddTile(TileID.LunarCraftingStation); //LunarCraftingStation = Ancient Manipulator - recipe.Register(); - } - } + recipe.Register(); + } + } } diff --git a/Items/Weapons/Summon/AresExoskeleton.cs b/Items/Weapons/Summon/AresExoskeleton.cs index cbf43d0fc4..8d81e099cd 100644 --- a/Items/Weapons/Summon/AresExoskeleton.cs +++ b/Items/Weapons/Summon/AresExoskeleton.cs @@ -68,11 +68,11 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { + Item.width = Item.height = 36; Item.mana = 80; Item.damage = 625; Item.useStyle = ItemUseStyleID.HoldUp; Item.noUseGraphic = true; - Item.width = Item.height = 36; Item.useTime = Item.useAnimation = 9; Item.noMelee = true; Item.knockBack = 1f; diff --git a/Items/Weapons/Summon/AtlasMunitionsBeacon.cs b/Items/Weapons/Summon/AtlasMunitionsBeacon.cs index 12225fa352..118a21ec6c 100644 --- a/Items/Weapons/Summon/AtlasMunitionsBeacon.cs +++ b/Items/Weapons/Summon/AtlasMunitionsBeacon.cs @@ -1,11 +1,11 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Summon; +using CalamityMod.Projectiles.Summon; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Rarities; namespace CalamityMod.Items.Weapons.Summon { @@ -36,7 +36,7 @@ namespace CalamityMod.Items.Weapons.Summon // How long it takes for the cannon to fully cool off from the maximum heat value. public const int HeatDissipationTime = 180; - + // This shouldn't be too high. If it is, the overdrive mode will be frustratingly inconsistent to use. public const float OverdriveProjectileAngularRandomness = 0.1f; @@ -44,10 +44,10 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - Item.damage = 200; - Item.mana = 10; Item.width = 40; Item.height = 38; + Item.damage = 200; + Item.mana = 10; Item.useTime = Item.useAnimation = 10; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; @@ -64,16 +64,8 @@ namespace CalamityMod.Items.Weapons.Summon Item.sentry = true; } - public override bool CanUseItem(Player player) - { - if (player.ownedProjectileCounts[ModContent.ProjectileType()] >= 1) - return false; - if (player.ownedProjectileCounts[ModContent.ProjectileType()] >= 1) - return false; - if (player.ownedProjectileCounts[ModContent.ProjectileType()] >= 1) - return false; - return true; - } + // Keeps the sentry from being re-summoned if the player took out the usable Autocannon + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[ModContent.ProjectileType()] < 1; public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { @@ -84,9 +76,16 @@ namespace CalamityMod.Items.Weapons.Summon { if (player.altFunctionUse != 2) { + CalamityUtils.KillShootProjectileMany(player, new int[] + { + type, + ModContent.ProjectileType(), + ModContent.ProjectileType() + }); position = Main.MouseWorld - Vector2.UnitY * 1020f; velocity = (Main.MouseWorld - position).SafeNormalize(Vector2.UnitY) * Main.rand.NextFloat(9f, 10f); Projectile.NewProjectile(source, position, velocity, type, Item.damage, knockback, player.whoAmI, Main.MouseWorld.Y - 40f); + player.UpdateMaxTurrets(); } return false; } diff --git a/Items/Weapons/Summon/BelladonnaSpiritStaff.cs b/Items/Weapons/Summon/BelladonnaSpiritStaff.cs index c5f5df6263..43e4bb72cc 100644 --- a/Items/Weapons/Summon/BelladonnaSpiritStaff.cs +++ b/Items/Weapons/Summon/BelladonnaSpiritStaff.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Summon; +using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -26,23 +26,22 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { + Item.width = 40; + Item.height = 42; Item.damage = 22; Item.knockBack = 1f; Item.mana = 10; Item.shoot = ModContent.ProjectileType(); - - Item.width = 40; - Item.height = 42; Item.useTime = Item.useAnimation = 35; Item.DamageType = DamageClass.Summon; Item.useStyle = ItemUseStyleID.Swing; Item.UseSound = SoundID.Item44; Item.rare = ItemRarityID.Blue; - Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.noMelee = true; - Item.autoReuse = true; + Item.autoReuse = true; } 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/Summon/BlackHawkRemote.cs b/Items/Weapons/Summon/BlackHawkRemote.cs index 0e2d713056..9900da3a9b 100644 --- a/Items/Weapons/Summon/BlackHawkRemote.cs +++ b/Items/Weapons/Summon/BlackHawkRemote.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Summon; +using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -12,15 +12,15 @@ namespace CalamityMod.Items.Weapons.Summon public new string LocalizationCategory => "Items.Weapons.Summon"; public override void SetDefaults() { - Item.damage = 25; - Item.mana = 10; Item.width = 38; Item.height = 40; + Item.damage = 25; + Item.mana = 10; Item.useTime = Item.useAnimation = 24; Item.useStyle = ItemUseStyleID.HoldUp; Item.noMelee = true; Item.knockBack = 1f; - Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.UseSound = SoundID.Item15; //phaseblade sound effect Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Summon/BorealisBomber.cs b/Items/Weapons/Summon/BorealisBomber.cs index e628a4b8a6..ae8716c368 100644 --- a/Items/Weapons/Summon/BorealisBomber.cs +++ b/Items/Weapons/Summon/BorealisBomber.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Summon; +using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -12,20 +12,20 @@ namespace CalamityMod.Items.Weapons.Summon public new string LocalizationCategory => "Items.Weapons.Summon"; public override void SetStaticDefaults() { - Item.staff[Item.type] = true; + Item.staff[Item.type] = true; } public override void SetDefaults() { - Item.damage = 35; - Item.mana = 10; Item.width = 48; Item.height = 56; + Item.damage = 35; + Item.mana = 10; Item.useTime = Item.useAnimation = 19; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5f; - Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; Item.UseSound = SoundID.Item44; Item.autoReuse = true; diff --git a/Items/Weapons/Summon/BrittleStarStaff.cs b/Items/Weapons/Summon/BrittleStarStaff.cs index 662054a9d7..927726bba0 100644 --- a/Items/Weapons/Summon/BrittleStarStaff.cs +++ b/Items/Weapons/Summon/BrittleStarStaff.cs @@ -1,10 +1,10 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Summon; +using CalamityMod.Projectiles.Summon; +using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Projectiles.Typeless; using static Humanizer.In; namespace CalamityMod.Items.Weapons.Summon @@ -16,16 +16,16 @@ namespace CalamityMod.Items.Weapons.Summon public float Knockback = 2f; public override void SetDefaults() { + Item.width = Item.height = 44; Item.damage = 10; Item.mana = 10; - Item.width = Item.height = 44; Item.useTime = Item.useAnimation = 32; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = Knockback; - Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; - Item.UseSound = SoundID.Item44 with { Pitch = 0.5f}; + Item.UseSound = SoundID.Item44 with { Pitch = 0.5f }; Item.autoReuse = true; Item.shootSpeed = 5; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Summon/CadaverousCarrion.cs b/Items/Weapons/Summon/CadaverousCarrion.cs index 634712129b..6ae7b901f7 100644 --- a/Items/Weapons/Summon/CadaverousCarrion.cs +++ b/Items/Weapons/Summon/CadaverousCarrion.cs @@ -13,12 +13,12 @@ namespace CalamityMod.Items.Weapons.Summon public new string LocalizationCategory => "Items.Weapons.Summon"; public override void SetDefaults() { + Item.width = 54; + Item.height = 56; Item.damage = 384; Item.mana = 10; Item.DamageType = DamageClass.Summon; Item.sentry = true; - Item.width = 54; - Item.height = 56; Item.useTime = Item.useAnimation = 14; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; @@ -27,14 +27,16 @@ namespace CalamityMod.Items.Weapons.Summon Item.UseSound = SoundID.NPCDeath13; Item.shoot = ModContent.ProjectileType(); - Item.value = CalamityGlobalItem.Rarity13BuyPrice; + Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; Item.rare = ModContent.RarityType(); } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - //CalamityUtils.OnlyOneSentry(player, type); - int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); + player.FindSentryRestingSpot(type, out int XPosition, out int YPosition, out int YOffset); + YOffset += 3; + position = new Vector2((float)XPosition, (float)(YPosition - YOffset)); + int p = Projectile.NewProjectile(source, position, Vector2.Zero, type, damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; player.UpdateMaxTurrets(); diff --git a/Items/Weapons/Summon/CalamarisLament.cs b/Items/Weapons/Summon/CalamarisLament.cs index f856ece019..c477f89bdc 100644 --- a/Items/Weapons/Summon/CalamarisLament.cs +++ b/Items/Weapons/Summon/CalamarisLament.cs @@ -38,20 +38,20 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { + Item.width = 88; + Item.height = 108; Item.damage = 110; Item.shoot = ModContent.ProjectileType(); Item.DamageType = DamageClass.Summon; Item.useTime = Item.useAnimation = 10; Item.mana = 10; - Item.width = 88; - Item.height = 108; Item.noMelee = true; Item.autoReuse = true; Item.UseSound = SoundID.Item85; Item.useStyle = ItemUseStyleID.Shoot; Item.rare = ModContent.RarityType(); - Item.value = CalamityGlobalItem.Rarity13BuyPrice; + Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; // This does nothing, it's just here so it's able to act like a staff. Item.shootSpeed = 1f; diff --git a/Items/Weapons/Summon/CausticCroakerStaff.cs b/Items/Weapons/Summon/CausticCroakerStaff.cs index 1ed905db84..4a4e8c1f0b 100644 --- a/Items/Weapons/Summon/CausticCroakerStaff.cs +++ b/Items/Weapons/Summon/CausticCroakerStaff.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Summon; +using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -12,15 +12,15 @@ namespace CalamityMod.Items.Weapons.Summon public new string LocalizationCategory => "Items.Weapons.Summon"; public override void SetDefaults() { - Item.damage = 8; - Item.mana = 10; Item.width = 36; Item.height = 42; + Item.damage = 8; + Item.mana = 10; Item.useTime = Item.useAnimation = 35; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 0f; - Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; Item.UseSound = SoundID.Item44; Item.autoReuse = true; @@ -34,7 +34,10 @@ namespace CalamityMod.Items.Weapons.Summon { if (player.altFunctionUse != 2) { - int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); + player.FindSentryRestingSpot(type, out int XPosition, out int YPosition, out int YOffset); + YOffset -= 13; + position = new Vector2((float)XPosition, (float)(YPosition - YOffset)); + int p = Projectile.NewProjectile(source, position, Vector2.Zero, type, damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; player.UpdateMaxTurrets(); diff --git a/Items/Weapons/Summon/CausticStaff.cs b/Items/Weapons/Summon/CausticStaff.cs index bd8ba609b0..dfe5605cd4 100644 --- a/Items/Weapons/Summon/CausticStaff.cs +++ b/Items/Weapons/Summon/CausticStaff.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Summon; +using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -12,17 +12,17 @@ namespace CalamityMod.Items.Weapons.Summon public new string LocalizationCategory => "Items.Weapons.Summon"; public override void SetDefaults() { + Item.width = 26; + Item.height = 28; Item.mana = 10; Item.damage = 15; Item.useStyle = ItemUseStyleID.Swing; Item.shootSpeed = 10f; Item.shoot = ModContent.ProjectileType(); - Item.width = 26; - Item.height = 28; Item.UseSound = SoundID.Item77; Item.useAnimation = Item.useTime = 25; - Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; Item.Calamity().donorItem = true; diff --git a/Items/Weapons/Summon/CinderBlossomStaff.cs b/Items/Weapons/Summon/CinderBlossomStaff.cs index b150127e9b..0c5b883154 100644 --- a/Items/Weapons/Summon/CinderBlossomStaff.cs +++ b/Items/Weapons/Summon/CinderBlossomStaff.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Summon; +using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -12,21 +12,19 @@ namespace CalamityMod.Items.Weapons.Summon public new string LocalizationCategory => "Items.Weapons.Summon"; public override void SetDefaults() { + Item.width = 50; + Item.height = 56; Item.damage = 16; Item.knockBack = 2f; Item.mana = 10; - Item.shoot = ModContent.ProjectileType(); - - Item.width = 50; - Item.height = 56; Item.useTime = Item.useAnimation = 30; Item.DamageType = DamageClass.Summon; Item.useStyle = ItemUseStyleID.Swing; Item.UseSound = SoundID.Item34; Item.rare = ItemRarityID.Orange; - Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.noMelee = true; } diff --git a/Items/Weapons/Summon/CindersOfLament.cs b/Items/Weapons/Summon/CindersOfLament.cs index 8ea9cce618..44d8fc9f3c 100644 --- a/Items/Weapons/Summon/CindersOfLament.cs +++ b/Items/Weapons/Summon/CindersOfLament.cs @@ -13,12 +13,12 @@ namespace CalamityMod.Items.Weapons.Summon public new string LocalizationCategory => "Items.Weapons.Summon"; public override void SetDefaults() { + Item.width = 86; + Item.height = 92; Item.mana = 10; Item.damage = 1666; Item.useStyle = ItemUseStyleID.Swing; - Item.width = 86; - Item.height = 92; - Item.useTime = Item.useAnimation = 30; // 29 because of useStyle 1 + Item.useTime = Item.useAnimation = 80; // 79 because of useStyle 1 Item.autoReuse = true; Item.noMelee = true; Item.knockBack = 0f; @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.shootSpeed = 10f; Item.DamageType = DamageClass.Summon; } - + public override void SetStaticDefaults() { ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); diff --git a/Items/Weapons/Summon/Cnidarian.cs b/Items/Weapons/Summon/Cnidarian.cs index f2f159089f..836c151c26 100644 --- a/Items/Weapons/Summon/Cnidarian.cs +++ b/Items/Weapons/Summon/Cnidarian.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.shootSpeed = 10f; Item.rare = ItemRarityID.Green; - Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; } public override bool CanUseItem(Player player) @@ -71,7 +71,7 @@ namespace CalamityMod.Items.Weapons.Summon player.ChangeDir(-1); } - + CalamityUtils.CleanHoldStyle(player, player.compositeFrontArm.rotation + MathHelper.PiOver2 * player.gravDir, player.GetFrontHandPositionImproved(player.compositeFrontArm), new Vector2(42, 34), new Vector2(-15, 11), true); } diff --git a/Items/Weapons/Summon/CorroslimeStaff.cs b/Items/Weapons/Summon/CorroslimeStaff.cs index 20649b99e1..81c6b7689f 100644 --- a/Items/Weapons/Summon/CorroslimeStaff.cs +++ b/Items/Weapons/Summon/CorroslimeStaff.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Summon; +using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -12,15 +12,15 @@ namespace CalamityMod.Items.Weapons.Summon public new string LocalizationCategory => "Items.Weapons.Summon"; public override void SetDefaults() { - Item.damage = 24; - Item.mana = 10; Item.width = 52; Item.height = 54; + Item.damage = 24; + Item.mana = 10; Item.useTime = Item.useAnimation = 30; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 2f; - Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; Item.UseSound = SoundID.Item44; Item.autoReuse = true; diff --git a/Items/Weapons/Summon/CosmicImmaterializer.cs b/Items/Weapons/Summon/CosmicImmaterializer.cs index f9fdbe58e9..d7d6ac4aa8 100644 --- a/Items/Weapons/Summon/CosmicImmaterializer.cs +++ b/Items/Weapons/Summon/CosmicImmaterializer.cs @@ -4,6 +4,7 @@ using CalamityMod.Projectiles.Summon; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -16,15 +17,15 @@ namespace CalamityMod.Items.Weapons.Summon public new string LocalizationCategory => "Items.Weapons.Summon"; public override void SetDefaults() { + Item.width = 170; + Item.height = 164; Item.mana = 10; Item.damage = 560; Item.useStyle = ItemUseStyleID.Swing; - Item.width = 74; - Item.height = 72; Item.useTime = Item.useAnimation = 10; Item.noMelee = true; Item.knockBack = 0f; - Item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.UseSound = SoundID.Item60; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; @@ -37,14 +38,17 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { CalamityUtils.KillShootProjectiles(true, type, player); - CalamityPlayer modPlayer = player.Calamity(); - bool hasSummonerSet = modPlayer.WearingPostMLSummonerSet; - int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, (int)(damage * (hasSummonerSet ? 1 : 0.66)), knockback, player.whoAmI, 0f, 0f); + int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI, 0f, 0f); if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = (int)(Item.damage * (hasSummonerSet ? 1f : 0.66f)); + Main.projectile[p].originalDamage = Item.damage; return false; } + 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/Summon/CosmicImmaterializerGlow").Value); + } + public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Weapons/Summon/CosmicImmaterializer.png b/Items/Weapons/Summon/CosmicImmaterializer.png index aaf579725d..21ac8d7523 100644 Binary files a/Items/Weapons/Summon/CosmicImmaterializer.png and b/Items/Weapons/Summon/CosmicImmaterializer.png differ diff --git a/Items/Weapons/Summon/CosmicImmaterializerGlow.png b/Items/Weapons/Summon/CosmicImmaterializerGlow.png new file mode 100644 index 0000000000..b2854e2cae Binary files /dev/null and b/Items/Weapons/Summon/CosmicImmaterializerGlow.png differ diff --git a/Items/Weapons/Summon/CosmicViperEngine.cs b/Items/Weapons/Summon/CosmicViperEngine.cs index 5edde5b4c1..2f1cacf427 100644 --- a/Items/Weapons/Summon/CosmicViperEngine.cs +++ b/Items/Weapons/Summon/CosmicViperEngine.cs @@ -1,10 +1,10 @@ -using CalamityMod.Items.Materials; +using System; +using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Ores; using CalamityMod.Projectiles.Summon; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -17,10 +17,10 @@ namespace CalamityMod.Items.Weapons.Summon public new string LocalizationCategory => "Items.Weapons.Summon"; public override void SetDefaults() { - Item.damage = 321; - Item.mana = 10; Item.width = 46; Item.height = 28; + Item.damage = 321; + Item.mana = 10; Item.useTime = Item.useAnimation = 9; Item.useStyle = ItemUseStyleID.HoldUp; Item.noMelee = true; @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.shootSpeed = 10f; // Affects bullet speed Item.DamageType = DamageClass.Summon; - Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.rare = ModContent.RarityType(); } diff --git a/Items/Weapons/Summon/Cosmilamp.cs b/Items/Weapons/Summon/Cosmilamp.cs index 7d9a868889..231bd38e69 100644 --- a/Items/Weapons/Summon/Cosmilamp.cs +++ b/Items/Weapons/Summon/Cosmilamp.cs @@ -21,15 +21,15 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - Item.damage = 127; - Item.mana = 10; Item.width = 42; Item.height = 60; + Item.damage = 127; + Item.mana = 10; Item.useTime = Item.useAnimation = 15; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 4f; - Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item44; Item.autoReuse = true; diff --git a/Items/Weapons/Summon/CrimslimeStaff.cs b/Items/Weapons/Summon/CrimslimeStaff.cs index 47fa14d7fb..65ef4d76a8 100644 --- a/Items/Weapons/Summon/CrimslimeStaff.cs +++ b/Items/Weapons/Summon/CrimslimeStaff.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Summon; +using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -12,15 +12,15 @@ namespace CalamityMod.Items.Weapons.Summon public new string LocalizationCategory => "Items.Weapons.Summon"; public override void SetDefaults() { - Item.damage = 24; - Item.mana = 10; Item.width = 52; Item.height = 52; + Item.damage = 24; + Item.mana = 10; Item.useTime = Item.useAnimation = 30; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 2f; - Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; Item.UseSound = SoundID.Item44; Item.autoReuse = true; diff --git a/Items/Weapons/Summon/CryogenicStaff.cs b/Items/Weapons/Summon/CryogenicStaff.cs index 9a7504a0a5..3d189ee3b0 100644 --- a/Items/Weapons/Summon/CryogenicStaff.cs +++ b/Items/Weapons/Summon/CryogenicStaff.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Summon; +using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -12,19 +12,19 @@ namespace CalamityMod.Items.Weapons.Summon public new string LocalizationCategory => "Items.Weapons.Summon"; public override void SetDefaults() { + Item.width = 82; + Item.height = 84; Item.damage = 50; Item.mana = 10; Item.DamageType = DamageClass.Summon; Item.sentry = true; - Item.width = 82; - Item.height = 84; Item.useTime = Item.useAnimation = 25; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.autoReuse = true; Item.knockBack = 4f; - Item.value = CalamityGlobalItem.Rarity6BuyPrice; + Item.value = CalamityGlobalItem.RarityLightPurpleBuyPrice; Item.rare = ItemRarityID.LightPurple; Item.Calamity().devItem = true; diff --git a/Items/Weapons/Summon/DaedalusGolemStaff.cs b/Items/Weapons/Summon/DaedalusGolemStaff.cs index e6bbebd42c..57461c8924 100644 --- a/Items/Weapons/Summon/DaedalusGolemStaff.cs +++ b/Items/Weapons/Summon/DaedalusGolemStaff.cs @@ -1,8 +1,8 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -18,9 +18,9 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { + Item.width = Item.height = 32; Item.damage = 70; Item.mana = 10; - Item.width = Item.height = 32; Item.useTime = Item.useAnimation = 25; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.shootSpeed = 10f; Item.DamageType = DamageClass.Summon; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; } 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/Summon/DankStaff.cs b/Items/Weapons/Summon/DankStaff.cs index e56b5e9522..3a40da3bcc 100644 --- a/Items/Weapons/Summon/DankStaff.cs +++ b/Items/Weapons/Summon/DankStaff.cs @@ -1,8 +1,8 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -13,16 +13,15 @@ namespace CalamityMod.Items.Weapons.Summon public new string LocalizationCategory => "Items.Weapons.Summon"; public override void SetDefaults() { - Item.damage = 9; - Item.mana = 10; Item.width = 58; Item.height = 58; + Item.damage = 9; + Item.mana = 10; Item.useTime = Item.useAnimation = 30; - Item.scale = 0.85f; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 2.25f; - Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; Item.UseSound = SoundID.Item44; Item.autoReuse = true; diff --git a/Items/Weapons/Summon/DazzlingStabberStaff.cs b/Items/Weapons/Summon/DazzlingStabberStaff.cs index 63e9915dff..bab08f23e9 100644 --- a/Items/Weapons/Summon/DazzlingStabberStaff.cs +++ b/Items/Weapons/Summon/DazzlingStabberStaff.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 13f; - Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); } diff --git a/Items/Weapons/Summon/DeathstareRod.cs b/Items/Weapons/Summon/DeathstareRod.cs index 786af1ad05..2d1c16e302 100644 --- a/Items/Weapons/Summon/DeathstareRod.cs +++ b/Items/Weapons/Summon/DeathstareRod.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Summon; +using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -12,14 +12,14 @@ namespace CalamityMod.Items.Weapons.Summon public new string LocalizationCategory => "Items.Weapons.Summon"; public override void SetDefaults() { - Item.damage = 33; - Item.mana = 10; Item.width = Item.height = 46; + Item.damage = 20; + Item.mana = 10; Item.useTime = Item.useAnimation = 35; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 2f; - Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; Item.UseSound = SoundID.NPCHit8; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Summon/DeepseaStaff.cs b/Items/Weapons/Summon/DeepseaStaff.cs index f401509549..86b85473b1 100644 --- a/Items/Weapons/Summon/DeepseaStaff.cs +++ b/Items/Weapons/Summon/DeepseaStaff.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Summon; +using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -12,14 +12,14 @@ namespace CalamityMod.Items.Weapons.Summon public new string LocalizationCategory => "Items.Weapons.Summon"; public override void SetDefaults() { + Item.width = Item.height = 44; Item.damage = 40; Item.mana = 10; - Item.width = Item.height = 44; Item.useTime = Item.useAnimation = 25; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 2f; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item44; Item.autoReuse = true; diff --git a/Items/Weapons/Summon/DormantBrimseeker.cs b/Items/Weapons/Summon/DormantBrimseeker.cs index 4c2bb3a4ce..ae2b2695e9 100644 --- a/Items/Weapons/Summon/DormantBrimseeker.cs +++ b/Items/Weapons/Summon/DormantBrimseeker.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Summon; +using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -12,9 +12,9 @@ namespace CalamityMod.Items.Weapons.Summon public new string LocalizationCategory => "Items.Weapons.Summon"; public override void SetDefaults() { + Item.width = Item.height = 32; Item.damage = 42; Item.mana = 10; - Item.width = Item.height = 32; Item.useTime = Item.useAnimation = 25; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.shootSpeed = 10f; Item.DamageType = DamageClass.Summon; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; } 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/Summon/DragonbloodDisgorger.cs b/Items/Weapons/Summon/DragonbloodDisgorger.cs index cd1837dfab..cd4ee73ef3 100644 --- a/Items/Weapons/Summon/DragonbloodDisgorger.cs +++ b/Items/Weapons/Summon/DragonbloodDisgorger.cs @@ -14,15 +14,15 @@ namespace CalamityMod.Items.Weapons.Summon public new string LocalizationCategory => "Items.Weapons.Summon"; public override void SetDefaults() { - Item.damage = 215; - Item.mana = 10; Item.width = 64; Item.height = 62; + Item.damage = 215; + Item.mana = 10; Item.useTime = Item.useAnimation = 15; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 4f; - Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.DD2_SkeletonDeath; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Summon/DreadmineStaff.cs b/Items/Weapons/Summon/DreadmineStaff.cs index 3a3a03741f..a2aa36d7e8 100644 --- a/Items/Weapons/Summon/DreadmineStaff.cs +++ b/Items/Weapons/Summon/DreadmineStaff.cs @@ -1,9 +1,9 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -14,15 +14,15 @@ namespace CalamityMod.Items.Weapons.Summon public new string LocalizationCategory => "Items.Weapons.Summon"; public override void SetDefaults() { - Item.damage = 60; - Item.mana = 10; Item.width = 44; Item.height = 44; + Item.damage = 60; + Item.mana = 10; Item.useTime = Item.useAnimation = 25; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 4.5f; - Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; Item.UseSound = SoundID.Item113; Item.autoReuse = true; diff --git a/Items/Weapons/Summon/ElementalAxe.cs b/Items/Weapons/Summon/ElementalAxe.cs index 00e1c73279..50fb9ea940 100644 --- a/Items/Weapons/Summon/ElementalAxe.cs +++ b/Items/Weapons/Summon/ElementalAxe.cs @@ -1,8 +1,8 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -13,16 +13,16 @@ namespace CalamityMod.Items.Weapons.Summon public new string LocalizationCategory => "Items.Weapons.Summon"; public override void SetDefaults() { + Item.width = 36; + Item.height = 36; Item.damage = 57; Item.DamageType = DamageClass.Summon; Item.mana = 10; - Item.width = 36; - Item.height = 36; Item.useTime = Item.useAnimation = 15; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 5f; - Item.value = CalamityGlobalItem.Rarity11BuyPrice; + Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; Item.rare = ItemRarityID.Purple; Item.UseSound = SoundID.Item44; Item.autoReuse = true; diff --git a/Items/Weapons/Summon/EnchantedConch.cs b/Items/Weapons/Summon/EnchantedConch.cs index 3e9c7b9671..422f7c7233 100644 --- a/Items/Weapons/Summon/EnchantedConch.cs +++ b/Items/Weapons/Summon/EnchantedConch.cs @@ -1,8 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Summon; +using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -12,53 +11,29 @@ namespace CalamityMod.Items.Weapons.Summon public class EnchantedConch : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Summon"; + public override void SetDefaults() { + Item.width = 40; + Item.height = 26; Item.damage = 20; - Item.mana = 10; - Item.width = 34; - Item.height = 24; - Item.useTime = Item.useAnimation = 35; - Item.useStyle = ItemUseStyleID.Swing; - Item.noMelee = true; - Item.knockBack = 2f; - Item.value = CalamityGlobalItem.Rarity2BuyPrice; - Item.rare = ItemRarityID.Green; - Item.UseSound = SoundID.Item44; - Item.autoReuse = true; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 10f; Item.DamageType = DamageClass.Summon; + Item.shoot = ModContent.ProjectileType(); + Item.knockBack = 2f; + + Item.useTime = Item.useAnimation = 35; + Item.mana = 10; + Item.noMelee = true; + Item.autoReuse = true; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; + Item.rare = ItemRarityID.Green; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.UseSound = SoundID.Item44; } 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 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; - if (player.gravDir == -1f) - { - mouseYDist = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - realPlayerPos.Y; - } - float mouseDistance = (float)Math.Sqrt((double)(mouseXDist * mouseXDist + mouseYDist * mouseYDist)); - if ((float.IsNaN(mouseXDist) && float.IsNaN(mouseYDist)) || (mouseXDist == 0f && mouseYDist == 0f)) - { - mouseXDist = (float)player.direction; - } - else - { - mouseDistance = projSpeed / mouseDistance; - } - mouseXDist = 0f; - mouseYDist = 0f; - realPlayerPos.X = (float)Main.mouseX + Main.screenPosition.X; - realPlayerPos.Y = (float)Main.mouseY + Main.screenPosition.Y; - int p = Projectile.NewProjectile(source, realPlayerPos.X, realPlayerPos.Y, mouseXDist, mouseYDist, ModContent.ProjectileType(), damage, knockback, i, 0f, 0f); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; + Projectile.NewProjectileDirect(source, Main.MouseWorld, Main.rand.NextVector2CircularEdge(5f, 5f), type, damage, knockback, player.whoAmI); return false; } } diff --git a/Items/Weapons/Summon/EndoHydraStaff.cs b/Items/Weapons/Summon/EndoHydraStaff.cs index 496a0f5c8e..163f44253a 100644 --- a/Items/Weapons/Summon/EndoHydraStaff.cs +++ b/Items/Weapons/Summon/EndoHydraStaff.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.UseSound = SoundID.Item60; Item.DamageType = DamageClass.Summon; Item.mana = 10; - Item.damage = 225; + Item.damage = 232; Item.knockBack = 3f; Item.autoReuse = true; Item.useTime = Item.useAnimation = 10; diff --git a/Items/Weapons/Summon/Endogenesis.cs b/Items/Weapons/Summon/Endogenesis.cs index 27b87f9ef9..de42c89bb1 100644 --- a/Items/Weapons/Summon/Endogenesis.cs +++ b/Items/Weapons/Summon/Endogenesis.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; - Item.value = CalamityGlobalItem.Rarity16BuyPrice; + Item.value = CalamityGlobalItem.RarityHotPinkBuyPrice; Item.rare = ModContent.RarityType(); Item.Calamity().devItem = true; } diff --git a/Items/Weapons/Summon/EntropysVigil.cs b/Items/Weapons/Summon/EntropysVigil.cs index ec80ab9fe7..dd0c9287de 100644 --- a/Items/Weapons/Summon/EntropysVigil.cs +++ b/Items/Weapons/Summon/EntropysVigil.cs @@ -1,8 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Summon; +using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -12,65 +11,53 @@ namespace CalamityMod.Items.Weapons.Summon public class EntropysVigil : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Summon"; + + public override void SetStaticDefaults() => Item.staff[Type] = true; + public override void SetDefaults() { - Item.damage = 40; - Item.mana = 10; Item.width = 52; Item.height = 52; - Item.useTime = Item.useAnimation = 25; - Item.useStyle = ItemUseStyleID.Swing; - Item.noMelee = true; - Item.knockBack = 2f; - Item.value = CalamityGlobalItem.Rarity7BuyPrice; - Item.rare = ItemRarityID.Lime; - Item.UseSound = SoundID.Item82; - Item.autoReuse = true; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 10f; + Item.damage = 47; Item.DamageType = DamageClass.Summon; + Item.shoot = ModContent.ProjectileType(); + Item.knockBack = 2f; + + Item.useTime = Item.useAnimation = 25; + Item.mana = 10; + Item.noMelee = true; + Item.autoReuse = true; + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; + Item.rare = ItemRarityID.Lime; + Item.useStyle = ItemUseStyleID.Shoot; + Item.UseSound = SoundID.Item82; + + // This doesn't do anything, it's just so the item is held like a staff. + Item.shootSpeed = 1f; } 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 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; - if (player.gravDir == -1f) + float randomAngleOffset = Main.rand.NextFloat(MathHelper.TwoPi); + for (int i = 0; i < 3; i++) { - mouseYDist = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - realPlayerPos.Y; + float angle = MathHelper.TwoPi / 3f * i + randomAngleOffset; + Vector2 spawnVelocity = angle.ToRotationVector2() * 5f; + + switch (i) + { + case 0: + Projectile.NewProjectileDirect(source, Main.MouseWorld, spawnVelocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + break; + case 1: + Projectile.NewProjectileDirect(source, Main.MouseWorld, spawnVelocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + break; + case 2: + Projectile.NewProjectileDirect(source, Main.MouseWorld, spawnVelocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + break; + } } - float mouseDistance = (float)Math.Sqrt((double)(mouseXDist * mouseXDist + mouseYDist * mouseYDist)); - if ((float.IsNaN(mouseXDist) && float.IsNaN(mouseYDist)) || (mouseXDist == 0f && mouseYDist == 0f)) - { - mouseXDist = (float)player.direction; - mouseYDist = 0f; - mouseDistance = projSpeed; - } - else - { - mouseDistance = projSpeed / mouseDistance; - } - mouseXDist *= mouseDistance; - mouseYDist *= mouseDistance; - realPlayerPos.X = (float)Main.mouseX + Main.screenPosition.X; - realPlayerPos.Y = (float)Main.mouseY + Main.screenPosition.Y; - Vector2 spinningpoint = new Vector2(mouseXDist, mouseYDist); - spinningpoint = spinningpoint.RotatedBy(1.5707963705062866, default); - int p = Projectile.NewProjectile(source, realPlayerPos.X + spinningpoint.X, realPlayerPos.Y + spinningpoint.Y, spinningpoint.X, spinningpoint.Y, ModContent.ProjectileType(), damage, knockback, i, 0f, 1f); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; - spinningpoint = spinningpoint.RotatedBy(-3.1415927410125732, default); - p = Projectile.NewProjectile(source, realPlayerPos.X + spinningpoint.X, realPlayerPos.Y + spinningpoint.Y, spinningpoint.X, spinningpoint.Y, ModContent.ProjectileType(), damage, knockback, i, 0f, 0f); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; - spinningpoint = spinningpoint.RotatedBy(-5.1415927410125732, default); - p = Projectile.NewProjectile(source, realPlayerPos.X + spinningpoint.X, realPlayerPos.Y + spinningpoint.Y, spinningpoint.X, spinningpoint.Y, ModContent.ProjectileType(), damage, knockback, i, 0f, 1f); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; + return false; } } diff --git a/Items/Weapons/Summon/EtherealSubjugator.cs b/Items/Weapons/Summon/EtherealSubjugator.cs index 362b210822..9abf615c95 100644 --- a/Items/Weapons/Summon/EtherealSubjugator.cs +++ b/Items/Weapons/Summon/EtherealSubjugator.cs @@ -2,7 +2,6 @@ using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -13,65 +12,33 @@ namespace CalamityMod.Items.Weapons.Summon public class EtherealSubjugator : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Summon"; + public override void SetDefaults() { - Item.damage = 200; - Item.mana = 10; Item.width = 66; Item.height = 70; - Item.useTime = Item.useAnimation = 10; - Item.useStyle = ItemUseStyleID.Swing; - Item.noMelee = true; - Item.knockBack = 1f; - Item.value = CalamityGlobalItem.Rarity13BuyPrice; - Item.UseSound = SoundID.Item82; - Item.autoReuse = true; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 10f; + Item.damage = 200; Item.DamageType = DamageClass.Summon; + Item.shoot = ModContent.ProjectileType(); + Item.knockBack = 1f; + + Item.useTime = Item.useAnimation = 10; + Item.mana = 10; + Item.noMelee = true; + Item.autoReuse = true; + Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; Item.rare = ModContent.RarityType(); + Item.useStyle = ItemUseStyleID.Shoot; + Item.UseSound = SoundID.Item82; } - 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/Summon/EtherealSubjugatorGlow").Value); - } + public override void UseStyle(Player player, Rectangle heldItemFrame) => player.itemLocation += new Vector2(-13f * player.direction, -15f); + + 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/Summon/EtherealSubjugatorGlow").Value); 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 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; - if (player.gravDir == -1f) - { - mouseYDist = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - realPlayerPos.Y; - } - float mouseDistance = (float)Math.Sqrt((double)(mouseXDist * mouseXDist + mouseYDist * mouseYDist)); - if ((float.IsNaN(mouseXDist) && float.IsNaN(mouseYDist)) || (mouseXDist == 0f && mouseYDist == 0f)) - { - mouseXDist = (float)player.direction; - mouseYDist = 0f; - mouseDistance = projSpeed; - } - else - { - mouseDistance = projSpeed / mouseDistance; - } - mouseXDist *= mouseDistance; - mouseYDist *= mouseDistance; - realPlayerPos.X = (float)Main.mouseX + Main.screenPosition.X; - realPlayerPos.Y = (float)Main.mouseY + Main.screenPosition.Y; - Vector2 spinningpoint = new Vector2(mouseXDist, mouseYDist); - spinningpoint = spinningpoint.RotatedBy(1.5707963705062866, default); - int p = Projectile.NewProjectile(source, realPlayerPos.X + spinningpoint.X, realPlayerPos.Y + spinningpoint.Y, spinningpoint.X, spinningpoint.Y, type, damage, knockback, i, 0f, 1f); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; - } + Projectile.NewProjectileDirect(source, Main.MouseWorld, Main.rand.NextVector2CircularEdge(5f, 5f), type, damage, knockback, player.whoAmI); return false; } } diff --git a/Items/Weapons/Summon/EyeOfNight.cs b/Items/Weapons/Summon/EyeOfNight.cs index fe2b31d0a5..009e3325a1 100644 --- a/Items/Weapons/Summon/EyeOfNight.cs +++ b/Items/Weapons/Summon/EyeOfNight.cs @@ -1,10 +1,10 @@ -using Terraria.DataStructures; -using Terraria.ModLoader; -using Terraria.ID; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; -using Terraria; using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Summon { @@ -13,14 +13,14 @@ namespace CalamityMod.Items.Weapons.Summon public new string LocalizationCategory => "Items.Weapons.Summon"; public override void SetDefaults() { - Item.damage = 28; - Item.mana = 10; Item.width = Item.height = 36; + Item.damage = 24; + Item.mana = 10; Item.useTime = Item.useAnimation = 30; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 1f; - Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; Item.UseSound = SoundID.NPCHit1; diff --git a/Items/Weapons/Summon/FlamsteedRing.cs b/Items/Weapons/Summon/FlamsteedRing.cs index e3b102d464..438bf16a36 100644 --- a/Items/Weapons/Summon/FlamsteedRing.cs +++ b/Items/Weapons/Summon/FlamsteedRing.cs @@ -1,4 +1,6 @@ -using CalamityMod.Buffs.StatDebuffs; +using System.Collections.Generic; +using System.Linq; +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; using CalamityMod.Items.Weapons.Melee; @@ -6,8 +8,6 @@ using CalamityMod.Projectiles.Summon; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; -using System.Collections.Generic; -using System.Linq; using Terraria; using Terraria.Audio; using Terraria.DataStructures; @@ -38,7 +38,7 @@ namespace CalamityMod.Items.Weapons.Summon public const int CrippleTime = 360; // 6 seconds public override void SetStaticDefaults() { - + if (Main.netMode != NetmodeID.Server) { int equipSlotHead = EquipLoader.GetEquipSlot(Mod, "HeadlessEquipTexture", EquipType.Head); @@ -48,10 +48,10 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { + Item.width = Item.height = 28; Item.mana = 200; Item.damage = 1999; Item.useStyle = ItemUseStyleID.HoldUp; - Item.width = Item.height = 28; Item.useTime = Item.useAnimation = 9; Item.noMelee = true; Item.knockBack = 1f; @@ -83,7 +83,7 @@ namespace CalamityMod.Items.Weapons.Summon if (!visuals) return false; - + Dust warningDust = Dust.NewDustPerfect(pos.ToVector2() * 16f + Vector2.One * 8f, 127, Scale: 1.2f); warningDust = Dust.NewDustPerfect(pos.ToVector2() * 16f + Vector2.One * 8f, 114, Vector2.Zero, Scale: 1.4f); diff --git a/Items/Weapons/Summon/FleshOfInfidelity.cs b/Items/Weapons/Summon/FleshOfInfidelity.cs index 72c6053fe4..a0ed0e586b 100644 --- a/Items/Weapons/Summon/FleshOfInfidelity.cs +++ b/Items/Weapons/Summon/FleshOfInfidelity.cs @@ -14,18 +14,18 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { + Item.width = 42; + Item.height = 42; Item.damage = 15; Item.DamageType = DamageClass.Summon; Item.shoot = ModContent.ProjectileType(); Item.knockBack = 1f; - + Item.useTime = Item.useAnimation = 10; Item.mana = 10; - Item.width = 42; - Item.height = 42; Item.noMelee = true; Item.autoReuse = true; - Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; Item.useStyle = ItemUseStyleID.Swing; Item.UseSound = SoundID.Zombie24; diff --git a/Items/Weapons/Summon/FlowersOfMortality.cs b/Items/Weapons/Summon/FlowersOfMortality.cs index 051b74fecb..e40bf2ed65 100644 --- a/Items/Weapons/Summon/FlowersOfMortality.cs +++ b/Items/Weapons/Summon/FlowersOfMortality.cs @@ -1,8 +1,8 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -13,16 +13,16 @@ namespace CalamityMod.Items.Weapons.Summon public new string LocalizationCategory => "Items.Weapons.Summon"; public override void SetDefaults() { + Item.width = 36; + Item.height = 36; Item.damage = 72; Item.DamageType = DamageClass.Summon; Item.mana = 10; - Item.width = 36; - Item.height = 36; Item.useTime = Item.useAnimation = 15; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 5f; - Item.value = CalamityGlobalItem.Rarity11BuyPrice; + Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; Item.rare = ItemRarityID.Purple; Item.UseSound = SoundID.Item44; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Summon/ForgottenApexWand.cs b/Items/Weapons/Summon/ForgottenApexWand.cs index 94b5d455d7..377c934395 100644 --- a/Items/Weapons/Summon/ForgottenApexWand.cs +++ b/Items/Weapons/Summon/ForgottenApexWand.cs @@ -1,9 +1,9 @@ -using Terraria.DataStructures; -using Terraria.ModLoader; -using Terraria.ID; -using Terraria; -using CalamityMod.Projectiles.Summon; +using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Summon { @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.UseSound = SoundID.Item89; Item.noMelee = true; Item.rare = ItemRarityID.Pink; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.autoReuse = true; Item.knockBack = 4f; diff --git a/Items/Weapons/Summon/FrostBlossomStaff.cs b/Items/Weapons/Summon/FrostBlossomStaff.cs index 0638a7415e..928fbdfa4b 100644 --- a/Items/Weapons/Summon/FrostBlossomStaff.cs +++ b/Items/Weapons/Summon/FrostBlossomStaff.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Summon; +using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -12,15 +12,15 @@ namespace CalamityMod.Items.Weapons.Summon public new string LocalizationCategory => "Items.Weapons.Summon"; public override void SetDefaults() { - Item.damage = 10; - Item.mana = 10; Item.width = 34; Item.height = 24; + Item.damage = 10; + Item.mana = 10; Item.useTime = Item.useAnimation = 35; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 2f; - Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.rare = ItemRarityID.Blue; Item.UseSound = SoundID.Item28; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Summon/FuelCellBundle.cs b/Items/Weapons/Summon/FuelCellBundle.cs index 6914b94088..1083ecfd3b 100644 --- a/Items/Weapons/Summon/FuelCellBundle.cs +++ b/Items/Weapons/Summon/FuelCellBundle.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Summon; +using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Summon @@ -11,15 +11,15 @@ namespace CalamityMod.Items.Weapons.Summon public new string LocalizationCategory => "Items.Weapons.Summon"; public override void SetDefaults() { + Item.width = 32; + Item.height = 32; Item.mana = 10; Item.damage = 25; Item.useStyle = ItemUseStyleID.Swing; - Item.width = 32; - Item.height = 32; Item.useTime = Item.useAnimation = 20; Item.noMelee = true; Item.knockBack = 7f; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; Item.UseSound = SoundID.Item106; Item.autoReuse = true; diff --git a/Items/Weapons/Summon/GastricBelcherStaff.cs b/Items/Weapons/Summon/GastricBelcherStaff.cs index b9a8c4f143..e5befad427 100644 --- a/Items/Weapons/Summon/GastricBelcherStaff.cs +++ b/Items/Weapons/Summon/GastricBelcherStaff.cs @@ -1,8 +1,8 @@ -using Terraria.DataStructures; +using System; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -13,15 +13,15 @@ namespace CalamityMod.Items.Weapons.Summon public new string LocalizationCategory => "Items.Weapons.Summon"; public override void SetDefaults() { - Item.damage = 60; - Item.mana = 10; Item.width = 66; Item.height = 70; + Item.damage = 60; + Item.mana = 10; Item.useTime = Item.useAnimation = 20; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 1f; - Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; Item.UseSound = SoundID.Item76; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Summon/GlacialEmbrace.cs b/Items/Weapons/Summon/GlacialEmbrace.cs index ce81847306..bce8284a37 100644 --- a/Items/Weapons/Summon/GlacialEmbrace.cs +++ b/Items/Weapons/Summon/GlacialEmbrace.cs @@ -1,8 +1,8 @@ -using Terraria.DataStructures; -using CalamityMod.Buffs.Summon; +using CalamityMod.Buffs.Summon; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -14,10 +14,10 @@ namespace CalamityMod.Items.Weapons.Summon public new string LocalizationCategory => "Items.Weapons.Summon"; public override void SetDefaults() { - Item.damage = 48; - Item.mana = 10; Item.width = 52; Item.height = 50; + Item.damage = 48; + Item.mana = 10; Item.useTime = Item.useAnimation = 24; Item.useStyle = ItemUseStyleID.HoldUp; Item.noMelee = true; @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.shootSpeed = 10f; Item.DamageType = DamageClass.Summon; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; } diff --git a/Items/Weapons/Summon/GuidelightofOblivion.cs b/Items/Weapons/Summon/GuidelightofOblivion.cs index b94930b558..6525ba6f3e 100644 --- a/Items/Weapons/Summon/GuidelightofOblivion.cs +++ b/Items/Weapons/Summon/GuidelightofOblivion.cs @@ -16,17 +16,17 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { + Item.width = 42; + Item.height = 60; Item.damage = 75; Item.DamageType = DamageClass.Summon; Item.sentry = true; Item.mana = 10; - Item.width = 42; - Item.height = 60; Item.useTime = Item.useAnimation = 15; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 5f; - Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Summon/HarvestStaff.cs b/Items/Weapons/Summon/HarvestStaff.cs new file mode 100644 index 0000000000..f16756177b --- /dev/null +++ b/Items/Weapons/Summon/HarvestStaff.cs @@ -0,0 +1,64 @@ +using CalamityMod.Projectiles.Summon; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Summon +{ + public class HarvestStaff : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Weapons.Summon"; + + public static int PumpkinsPerSentry = 5; + public static float TimePerPumpkin = 150f; + public static float PlantedEnemyDistanceDetection = 160f; + public static float NormalEnemyDistanceDetection = 1200f; + public static float PumpkinGravityStrength = 0.8f; + public static float PumpkinMaxGravity = 20f; + + public override void SetStaticDefaults() => Item.staff[Type] = true; + + public override void SetDefaults() + { + Item.damage = 26; + Item.DamageType = DamageClass.Summon; + Item.shoot = ModContent.ProjectileType(); + Item.knockBack = 5f; + + Item.useTime = Item.useAnimation = 15; + Item.mana = 10; + Item.width = 44; + Item.height = 46; + Item.noMelee = true; + Item.autoReuse = true; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; + Item.rare = ItemRarityID.Green; + Item.useStyle = ItemUseStyleID.Shoot; + Item.UseSound = SoundID.Grass with { Volume = 0.6f, Pitch = -0.4f }; + + Item.shootSpeed = 0.1f; + } + + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + { + player.FindSentryRestingSpot(type, out int XPosition, out int YPosition, out int YOffset); + YOffset -= 10; + position = new Vector2((float)XPosition, (float)(YPosition - YOffset)); + Projectile.NewProjectileDirect(source, position, Vector2.Zero, type, damage, knockback, player.whoAmI); + player.UpdateMaxTurrets(); + return false; + } + + public override void AddRecipes() + { + CreateRecipe(). + AddRecipeGroup("Wood", 20). + AddIngredient(ItemID.Pumpkin, 20). + AddIngredient(ItemID.PumpkinSeed, 5). + AddTile(TileID.Anvils). + Register(); + } + } +} diff --git a/Items/Weapons/Summon/HarvestStaff.png b/Items/Weapons/Summon/HarvestStaff.png new file mode 100644 index 0000000000..3c4ce4deed Binary files /dev/null and b/Items/Weapons/Summon/HarvestStaff.png differ diff --git a/Items/Weapons/Summon/HauntedScroll.cs b/Items/Weapons/Summon/HauntedScroll.cs index 65d293808f..ae22914112 100644 --- a/Items/Weapons/Summon/HauntedScroll.cs +++ b/Items/Weapons/Summon/HauntedScroll.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Summon; +using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -10,23 +10,23 @@ namespace CalamityMod.Items.Weapons.Summon public class HauntedScroll : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Summon"; - public override void SetStaticDefaults() - { + public override void SetStaticDefaults() + { ItemID.Sets.AnimatesAsSoul[Type] = true; - Main.RegisterItemAnimation(Type, new DrawAnimationVertical(6, 6)); - } + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(6, 6)); + } public override void SetDefaults() { - Item.damage = 25; - Item.mana = 10; Item.width = 36; Item.height = 48; + Item.damage = 25; + Item.mana = 10; Item.useTime = Item.useAnimation = 24; Item.useStyle = ItemUseStyleID.HoldUp; Item.noMelee = true; Item.knockBack = 3f; - Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; Item.UseSound = SoundID.Item60; Item.autoReuse = true; diff --git a/Items/Weapons/Summon/HerringStaff.cs b/Items/Weapons/Summon/HerringStaff.cs index 28fdad0288..ba118cfcf5 100644 --- a/Items/Weapons/Summon/HerringStaff.cs +++ b/Items/Weapons/Summon/HerringStaff.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Summon; +using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -12,20 +12,18 @@ namespace CalamityMod.Items.Weapons.Summon public new string LocalizationCategory => "Items.Weapons.Summon"; public override void SetDefaults() { + Item.width = Item.height = 48; Item.damage = 15; Item.knockBack = 1.25f; Item.mana = 10; Item.shoot = ModContent.ProjectileType(); - - Item.width = Item.height = 48; Item.useTime = Item.useAnimation = 30; - Item.DamageType = DamageClass.Summon; Item.useStyle = ItemUseStyleID.Swing; Item.UseSound = SoundID.Item21; Item.rare = ItemRarityID.Orange; - Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.autoReuse = true; Item.noMelee = true; } diff --git a/Items/Weapons/Summon/HivePod.cs b/Items/Weapons/Summon/HivePod.cs index cbb66b7b64..849e2cdda0 100644 --- a/Items/Weapons/Summon/HivePod.cs +++ b/Items/Weapons/Summon/HivePod.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Summon; +using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -12,18 +12,18 @@ namespace CalamityMod.Items.Weapons.Summon public new string LocalizationCategory => "Items.Weapons.Summon"; public override void SetDefaults() { + Item.width = 46; + Item.height = 50; Item.damage = 125; Item.mana = 10; Item.DamageType = DamageClass.Summon; Item.sentry = true; Item.autoReuse = true; - Item.width = 46; - Item.height = 50; Item.useTime = Item.useAnimation = 20; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 4f; - Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; Item.UseSound = SoundID.Item78; Item.shoot = ModContent.ProjectileType(); @@ -31,8 +31,10 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - //CalamityUtils.OnlyOneSentry(player, type); - int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); + player.FindSentryRestingSpot(type, out int XPosition, out int YPosition, out int YOffset); + YOffset += 5; + position = new Vector2((float)XPosition, (float)(YPosition - YOffset)); + int p = Projectile.NewProjectile(source, position, Vector2.Zero, type, damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; player.UpdateMaxTurrets(); diff --git a/Items/Weapons/Summon/IgneousExaltation.cs b/Items/Weapons/Summon/IgneousExaltation.cs index f30bc2b7d8..f0ae80e6cc 100644 --- a/Items/Weapons/Summon/IgneousExaltation.cs +++ b/Items/Weapons/Summon/IgneousExaltation.cs @@ -1,8 +1,8 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -13,20 +13,20 @@ namespace CalamityMod.Items.Weapons.Summon public new string LocalizationCategory => "Items.Weapons.Summon"; public override void SetStaticDefaults() { - Item.staff[Item.type] = true; + Item.staff[Item.type] = true; } public override void SetDefaults() { - Item.damage = 34; - Item.mana = 10; Item.width = 52; Item.height = 50; + Item.damage = 34; + Item.mana = 10; Item.useTime = Item.useAnimation = 24; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 4.5f; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item71; Item.autoReuse = true; @@ -60,7 +60,7 @@ namespace CalamityMod.Items.Weapons.Summon swordCount++; for (int j = 0; j < 22; j++) { - Dust dust = Dust.NewDustDirect(Main.projectile[i].position, Main.projectile[i].width, Main.projectile[i].height, 6); + Dust dust = Dust.NewDustDirect(Main.projectile[i].position, Main.projectile[i].width, Main.projectile[i].height, DustID.Torch); dust.velocity = Vector2.UnitY * Main.rand.NextFloat(3f, 5.5f) * Main.rand.NextBool().ToDirectionInt(); dust.noGravity = true; } @@ -78,7 +78,7 @@ namespace CalamityMod.Items.Weapons.Summon angle += angleVariance; for (int j = 0; j < 22; j++) { - Dust dust = Dust.NewDustDirect(Main.projectile[i].position, Main.projectile[i].width, Main.projectile[i].height, 6); + Dust dust = Dust.NewDustDirect(Main.projectile[i].position, Main.projectile[i].width, Main.projectile[i].height, DustID.Torch); dust.velocity = Vector2.UnitY * Main.rand.NextFloat(3f, 5.5f) * Main.rand.NextBool().ToDirectionInt(); dust.noGravity = true; } diff --git a/Items/Weapons/Summon/InfectedRemote.cs b/Items/Weapons/Summon/InfectedRemote.cs index 70db7b30e6..080093f247 100644 --- a/Items/Weapons/Summon/InfectedRemote.cs +++ b/Items/Weapons/Summon/InfectedRemote.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Summon; +using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -34,10 +34,10 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - Item.damage = 50; - Item.mana = 10; Item.width = 46; Item.height = 28; + Item.damage = 50; + Item.mana = 10; Item.useTime = Item.useAnimation = 19; Item.useStyle = ItemUseStyleID.HoldUp; Item.noMelee = true; @@ -47,7 +47,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.shootSpeed = 10f; Item.DamageType = DamageClass.Summon; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; Item.Calamity().donorItem = true; } @@ -57,7 +57,7 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { CalamityUtils.KillShootProjectiles(true, type, player); - + int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; diff --git a/Items/Weapons/Summon/KingofConstellationsTenryu.cs b/Items/Weapons/Summon/KingofConstellationsTenryu.cs index b31afbebef..92b2903ebf 100644 --- a/Items/Weapons/Summon/KingofConstellationsTenryu.cs +++ b/Items/Weapons/Summon/KingofConstellationsTenryu.cs @@ -1,10 +1,10 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; -using CalamityMod.Rarities; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Boss; using CalamityMod.Projectiles.Summon; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -16,17 +16,17 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { + Item.width = 44; + Item.height = 62; Item.mana = 10; - Item.damage = 213; + Item.damage = 187; Item.useStyle = ItemUseStyleID.HoldUp; Item.shootSpeed = 10f; Item.shoot = ModContent.ProjectileType(); - Item.width = 44; - Item.height = 62; Item.UseSound = Flare.FlareSound; Item.useAnimation = Item.useTime = 25; - Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; diff --git a/Items/Weapons/Summon/LiliesOfFinality.cs b/Items/Weapons/Summon/LiliesOfFinality.cs new file mode 100644 index 0000000000..849286cb14 --- /dev/null +++ b/Items/Weapons/Summon/LiliesOfFinality.cs @@ -0,0 +1,83 @@ +using CalamityMod.Projectiles.Summon; +using CalamityMod.Rarities; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Items.Weapons.Summon +{ + public class LiliesOfFinality : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Weapons.Summon"; + + #region Other Stats + + public static float MaxEnemyDistanceDetection = 2000f; + public static int CommonDustID = 114; + + public static float Elster_DistanceFromTarget = 280f; + public static float Elster_TargettingFlySpeed = 35f; + public static float Elster_BulletProjectileSpeed = 20f; + public static int Elster_BulletMaxUpdates = 2; + + public static float Ariane_BoltFireRate = 60f; + public static float Ariane_TargettingFlySpeed = 20f; + public static float Ariane_BoltProjectileSpeed = 25f; + public static int Ariane_BoltTimeHoming = 600; + public static float Ariane_MinTurnRate = 0.05f; + public static float Ariane_MaxTurnRate = 0.2f; + public static int Ariane_AoESize = 1050; + public static float Ariane_AoEDMGMultiplier = 0.4f; + + // Do not change this number, ever. - Fabsol + public const int TheNumber = 512; + + #endregion + + public override void SetDefaults() + { + Item.damage = TheNumber; + Item.DamageType = DamageClass.Summon; + Item.shoot = ProjectileType(); + Item.knockBack = 5f; + + Item.mana = 10; + Item.useTime = Item.useAnimation = 15; + Item.width = 36; + Item.height = 50; + Item.noMelee = true; + Item.value = CalamityGlobalItem.RarityVioletBuyPrice; + Item.rare = RarityType(); + Item.useStyle = ItemUseStyleID.HoldUp; + Item.UseSound = new("CalamityMod/Sounds/Item/LiliesOfFinalitySummonSpawn"); + } + + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] == 0 && player.maxMinions - player.slotsMinions >= 2; + + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + { + Projectile.NewProjectileDirect(source, Main.MouseWorld, new Vector2(-1f, -1f) * 3f, type, damage, knockback, player.whoAmI); + Projectile.NewProjectileDirect(source, Main.MouseWorld, new Vector2(1f, -1f) * 3f, ProjectileType(), damage, knockback, player.whoAmI); + + if (Main.dedServ) + return false; + + int dustAmount = Main.rand.Next(30, 40 + 1); + for (int i = 0; i < dustAmount; i++) + { + float angle = MathHelper.TwoPi / dustAmount * i; + Vector2 dustVelocity = angle.ToRotationVector2() * Main.rand.NextFloat(3f, 6f); + Dust spawnDust = Dust.NewDustPerfect( + Main.MouseWorld, + CommonDustID, + dustVelocity, + Scale: Main.rand.NextFloat(1.2f, 1.5f)); + spawnDust.noGravity = true; + } + return false; + } + } +} diff --git a/Items/Weapons/Summon/LiliesOfFinality.png b/Items/Weapons/Summon/LiliesOfFinality.png new file mode 100644 index 0000000000..db6394b847 Binary files /dev/null and b/Items/Weapons/Summon/LiliesOfFinality.png differ diff --git a/Items/Weapons/Summon/Metastasis.cs b/Items/Weapons/Summon/Metastasis.cs index cb282c6682..6f8e1fbdf2 100644 --- a/Items/Weapons/Summon/Metastasis.cs +++ b/Items/Weapons/Summon/Metastasis.cs @@ -13,22 +13,22 @@ namespace CalamityMod.Items.Weapons.Summon public new string LocalizationCategory => "Items.Weapons.Summon"; public override void SetDefaults() { - Item.damage = 400; - Item.mana = 10; Item.width = 66; Item.height = 78; + Item.damage = 400; + Item.mana = 10; Item.useTime = Item.useAnimation = 10; // 9 because of useStyle 1 Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 2f; - Item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.DD2_BetsySummon; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; Item.DamageType = DamageClass.Summon; } - + public override void SetStaticDefaults() { ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); diff --git a/Items/Weapons/Summon/MidnightSunBeacon.cs b/Items/Weapons/Summon/MidnightSunBeacon.cs index 435744d9fc..bce9216ba8 100644 --- a/Items/Weapons/Summon/MidnightSunBeacon.cs +++ b/Items/Weapons/Summon/MidnightSunBeacon.cs @@ -17,9 +17,9 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { + Item.width = Item.height = 32; Item.damage = 150; Item.mana = 10; - Item.width = Item.height = 32; Item.useTime = Item.useAnimation = 10; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.shootSpeed = 10f; Item.DamageType = DamageClass.Summon; - Item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.rare = ModContent.RarityType(); } 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/Summon/MirrorofKalandra.cs b/Items/Weapons/Summon/MirrorofKalandra.cs index 86ae1c6f24..be74192042 100644 --- a/Items/Weapons/Summon/MirrorofKalandra.cs +++ b/Items/Weapons/Summon/MirrorofKalandra.cs @@ -25,34 +25,36 @@ namespace CalamityMod.Items.Weapons.Summon public static float Purple_MinRamSpeed = 40f; public static float Purple_MaxRamSpeed = 60f; - public static int Purple_IFrames = 15; - public static float Purple_BlastDMGModifier = 3f; - public static float Purple_BlastFireRate = 180f; // In frames. + public static int Purple_IFrames = 23; + public static float Purple_BlastDMGModifier = 2.25f; + public static float Purple_BlastFireRate = 240f; // In frames. public static int Purple_BlastSize = 300; public static int Purple_BlastChargeTime = 10; public static float Purple_SpinSpeed = 25f; // In degrees per frame. - public static int Scimitar_IFrames = 15; + public static int Scimitar_IFrames = 36; // Note that the effective iframes are half of this number, since the weapon is given an extra update while attacking. public static int Wind_BowChargeTime = 5; // Therefore, the higher the time, the slower the fire rate will be, and viceversa. - public static float Wind_ArrowSpeed = 35f; + public static float Wind_ArrowSpeed = 5f; + public static int Wind_ArrowSpeedMult = 10; public static int Vile_BowChargeTime = 8; - public static float Vile_ArrowSpeed = 35f; + public static float Vile_ArrowSpeed = 5f; + public static int Vile_ArrowSpeedMult = 10; public static float Vile_SplitDMGMultiplier = .33f; public static int Vile_SplitIFrames = 30; public static int Vile_SplitSpreadAngle = 8; // In degrees. public override void SetDefaults() { - Item.damage = 380; + Item.width = 58; + Item.height = 50; + Item.damage = 317; Item.useTime = Item.useAnimation = 30; Item.knockBack = 4f; Item.mana = 10; Item.shoot = ModContent.ProjectileType(); - Item.width = 58; - Item.height = 50; Item.autoReuse = true; Item.noMelee = true; Item.Calamity().donorItem = true; @@ -60,7 +62,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.useStyle = ItemUseStyleID.Shoot; Item.UseSound = SoundID.Item4; Item.rare = ModContent.RarityType(); - Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; } public override Vector2? HoldoutOffset() => new Vector2(-15, 0); diff --git a/Items/Weapons/Summon/MutatedTruffle.cs b/Items/Weapons/Summon/MutatedTruffle.cs index 351027ec4f..8284dd30e0 100644 --- a/Items/Weapons/Summon/MutatedTruffle.cs +++ b/Items/Weapons/Summon/MutatedTruffle.cs @@ -31,6 +31,8 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { + Item.width = 24; + Item.height = 26; Item.damage = 275; Item.DamageType = DamageClass.Summon; Item.shoot = ModContent.ProjectileType(); @@ -38,13 +40,11 @@ namespace CalamityMod.Items.Weapons.Summon Item.useTime = Item.useAnimation = 10; Item.mana = 10; - Item.width = 24; - Item.height = 26; Item.noMelee = true; Item.useStyle = ItemUseStyleID.HoldUp; Item.UseSound = SoundID.NPCHit14; Item.rare = ModContent.RarityType(); - Item.value = CalamityGlobalItem.Rarity13BuyPrice; + Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; } 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/Summon/OrthoceraShell.cs b/Items/Weapons/Summon/OrthoceraShell.cs index bdceb6dd57..0642fb536b 100644 --- a/Items/Weapons/Summon/OrthoceraShell.cs +++ b/Items/Weapons/Summon/OrthoceraShell.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Summon; +using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -12,15 +12,15 @@ namespace CalamityMod.Items.Weapons.Summon public new string LocalizationCategory => "Items.Weapons.Summon"; public override void SetDefaults() { - Item.damage = 53; - Item.mana = 10; Item.width = 34; Item.height = 34; + Item.damage = 53; + Item.mana = 10; Item.useTime = Item.useAnimation = 24; Item.useStyle = ItemUseStyleID.HoldUp; Item.noMelee = true; Item.knockBack = 2f; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item42; Item.autoReuse = true; diff --git a/Items/Weapons/Summon/Perdition.cs b/Items/Weapons/Summon/Perdition.cs index a8ebf4bc2a..a6129eab11 100644 --- a/Items/Weapons/Summon/Perdition.cs +++ b/Items/Weapons/Summon/Perdition.cs @@ -15,6 +15,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { + Item.width = Item.height = 56; Item.damage = 375; Item.DamageType = DamageClass.Summon; Item.shoot = ModContent.ProjectileType(); @@ -22,7 +23,6 @@ namespace CalamityMod.Items.Weapons.Summon Item.useTime = Item.useAnimation = 10; // 9 because of useStyle 1. Item.mana = 10; - Item.width = Item.height = 56; Item.noMelee = true; Item.autoReuse = true; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; diff --git a/Items/Weapons/Summon/PlantationStaff.cs b/Items/Weapons/Summon/PlantationStaff.cs index 7f94ecfafb..2fff600df2 100644 --- a/Items/Weapons/Summon/PlantationStaff.cs +++ b/Items/Weapons/Summon/PlantationStaff.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -34,6 +35,8 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { + Item.width = 50; + Item.height = 50; Item.damage = 58; Item.DamageType = DamageClass.Summon; Item.shoot = ModContent.ProjectileType(); @@ -41,10 +44,8 @@ namespace CalamityMod.Items.Weapons.Summon Item.mana = 10; Item.useTime = Item.useAnimation = 20; - Item.width = 46; - Item.height = 48; Item.noMelee = true; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; Item.useStyle = ItemUseStyleID.Swing; Item.UseSound = SoundID.Item76; @@ -58,6 +59,11 @@ namespace CalamityMod.Items.Weapons.Summon return false; } + 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/Summon/PlantationStaffGlow").Value); + } + public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Weapons/Summon/PlantationStaff.png b/Items/Weapons/Summon/PlantationStaff.png index 638749a929..f995f95e8a 100644 Binary files a/Items/Weapons/Summon/PlantationStaff.png and b/Items/Weapons/Summon/PlantationStaff.png differ diff --git a/Items/Weapons/Summon/PlantationStaffGlow.png b/Items/Weapons/Summon/PlantationStaffGlow.png new file mode 100644 index 0000000000..b17834002f Binary files /dev/null and b/Items/Weapons/Summon/PlantationStaffGlow.png differ diff --git a/Items/Weapons/Summon/PolypLauncher.cs b/Items/Weapons/Summon/PolypLauncher.cs index 1bd8d0065b..662d30304d 100644 --- a/Items/Weapons/Summon/PolypLauncher.cs +++ b/Items/Weapons/Summon/PolypLauncher.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Summon; +using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -12,16 +12,16 @@ namespace CalamityMod.Items.Weapons.Summon public new string LocalizationCategory => "Items.Weapons.Summon"; public override void SetDefaults() { - Item.damage = 12; - Item.mana = 10; Item.width = 26; Item.height = 56; + Item.damage = 12; + Item.mana = 10; Item.useTime = Item.useAnimation = 35; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 0f; - Item.value = CalamityGlobalItem.Rarity2BuyPrice; - Item.rare = 2; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; + Item.rare = ItemRarityID.Green; Item.UseSound = SoundID.Item44; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); @@ -32,8 +32,10 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - //CalamityUtils.OnlyOneSentry(player, type); - int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI, 20f); + player.FindSentryRestingSpot(type, out int XPosition, out int YPosition, out int YOffset); + YOffset -= 13; + position = new Vector2((float)XPosition, (float)(YPosition - YOffset)); + int p = Projectile.NewProjectile(source, position, Vector2.Zero, type, damage, knockback, player.whoAmI, 20f); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; player.UpdateMaxTurrets(); diff --git a/Items/Weapons/Summon/PuffShroom.cs b/Items/Weapons/Summon/PuffShroom.cs index d4084c7c9d..bee58b18d1 100644 --- a/Items/Weapons/Summon/PuffShroom.cs +++ b/Items/Weapons/Summon/PuffShroom.cs @@ -12,15 +12,15 @@ namespace CalamityMod.Items.Weapons.Summon public new string LocalizationCategory => "Items.Weapons.Summon"; public override void SetDefaults() { - Item.damage = 14; - Item.mana = 10; Item.width = 32; Item.height = 32; + Item.damage = 14; + Item.mana = 10; Item.useTime = Item.useAnimation = 35; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 2f; - Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; Item.UseSound = SoundID.Item42; Item.autoReuse = true; diff --git a/Items/Weapons/Summon/ResurrectionButterfly.cs b/Items/Weapons/Summon/ResurrectionButterfly.cs index f4ef5c48dd..d91f467d4c 100644 --- a/Items/Weapons/Summon/ResurrectionButterfly.cs +++ b/Items/Weapons/Summon/ResurrectionButterfly.cs @@ -1,9 +1,9 @@ -using Terraria.DataStructures; +using System; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -14,16 +14,16 @@ namespace CalamityMod.Items.Weapons.Summon public new string LocalizationCategory => "Items.Weapons.Summon"; public override void SetDefaults() { - Item.damage = 55; - Item.mana = 10; Item.width = 46; Item.height = 46; + Item.damage = 66; // clueless + Item.mana = 10; Item.useTime = Item.useAnimation = 20; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 1f; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; Item.Calamity().donorItem = true; diff --git a/Items/Weapons/Summon/RustyBeaconPrototype.cs b/Items/Weapons/Summon/RustyBeaconPrototype.cs index c9e03110f8..e17e158a74 100644 --- a/Items/Weapons/Summon/RustyBeaconPrototype.cs +++ b/Items/Weapons/Summon/RustyBeaconPrototype.cs @@ -1,8 +1,8 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -17,19 +17,17 @@ namespace CalamityMod.Items.Weapons.Summon public const int IrradiatedDebuffTime = 120; - public const int PoisonedDebuffTime = 240; - public override void SetDefaults() { - Item.mana = 10; Item.width = 28; Item.height = 20; + Item.mana = 10; Item.damage = 8; Item.useTime = Item.useAnimation = 34; Item.useStyle = ItemUseStyleID.HoldUp; Item.noMelee = true; Item.knockBack = 0.5f; - Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.rare = ItemRarityID.Blue; Item.UseSound = SoundID.Item15; // Phaseblade sound effect Item.autoReuse = true; diff --git a/Items/Weapons/Summon/SanctifiedSpark.cs b/Items/Weapons/Summon/SanctifiedSpark.cs index 7d860686ef..c1d0f28176 100644 --- a/Items/Weapons/Summon/SanctifiedSpark.cs +++ b/Items/Weapons/Summon/SanctifiedSpark.cs @@ -1,9 +1,9 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Summon; +using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; -using Terraria.ModLoader; +using Terraria.DataStructures; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Summon { @@ -18,17 +18,17 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { + Item.width = 66; + Item.height = 68; Item.damage = 128; Item.DamageType = DamageClass.Summon; Item.sentry = true; Item.mana = 10; - Item.width = 66; - Item.height = 68; Item.useTime = Item.useAnimation = 14; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5f; - Item.value = CalamityGlobalItem.Rarity11BuyPrice; + Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; Item.rare = ItemRarityID.Purple; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Summon/SandSharknadoStaff.cs b/Items/Weapons/Summon/SandSharknadoStaff.cs index 4ad7821460..ff780b7dd0 100644 --- a/Items/Weapons/Summon/SandSharknadoStaff.cs +++ b/Items/Weapons/Summon/SandSharknadoStaff.cs @@ -1,8 +1,8 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -21,21 +21,19 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { + Item.width = 48; + Item.height = 56; Item.damage = 94; Item.knockBack = 2f; Item.mana = 10; Item.shoot = ModContent.ProjectileType(); - - Item.width = 48; - Item.height = 56; Item.useTime = Item.useAnimation = 20; - Item.DamageType = DamageClass.Summon; Item.useStyle = ItemUseStyleID.Swing; Item.UseSound = SoundID.Item44; Item.rare = ItemRarityID.Lime; - Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.noMelee = true; Item.autoReuse = true; } diff --git a/Items/Weapons/Summon/SarosPossession.cs b/Items/Weapons/Summon/SarosPossession.cs index ad99993077..8d6dbc6405 100644 --- a/Items/Weapons/Summon/SarosPossession.cs +++ b/Items/Weapons/Summon/SarosPossession.cs @@ -15,20 +15,18 @@ namespace CalamityMod.Items.Weapons.Summon public new string LocalizationCategory => "Items.Weapons.Summon"; public override void SetDefaults() { + Item.width = Item.height = 56; Item.damage = 500; Item.knockBack = 4f; Item.mana = 10; Item.shoot = ModContent.ProjectileType(); - - Item.width = Item.height = 56; Item.useTime = Item.useAnimation = 10; - Item.DamageType = DamageClass.Summon; Item.useStyle = ItemUseStyleID.Swing; Item.UseSound = SoundID.DD2_BetsyFlameBreath; Item.rare = ModContent.RarityType(); - Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.noMelee = true; } diff --git a/Items/Weapons/Summon/ScabRipper.cs b/Items/Weapons/Summon/ScabRipper.cs index 7ac2b27c34..d83cf2574e 100644 --- a/Items/Weapons/Summon/ScabRipper.cs +++ b/Items/Weapons/Summon/ScabRipper.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Summon; +using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -12,21 +12,24 @@ namespace CalamityMod.Items.Weapons.Summon public new string LocalizationCategory => "Items.Weapons.Summon"; public override void SetDefaults() { - Item.damage = 15; - Item.mana = 10; Item.width = 66; Item.height = 70; + Item.damage = 16; + Item.mana = 10; Item.useTime = Item.useAnimation = 30; - Item.useStyle = ItemUseStyleID.Swing; + Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 0.5f; - Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; Item.UseSound = SoundID.Item83; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; Item.DamageType = DamageClass.Summon; + + // This doesn't do anything, it's just so the item is held like a staff. + Item.shootSpeed = 1f; } 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/Summon/ScabRipper.png b/Items/Weapons/Summon/ScabRipper.png index db01a65a8b..5cb86ddac8 100644 Binary files a/Items/Weapons/Summon/ScabRipper.png and b/Items/Weapons/Summon/ScabRipper.png differ diff --git a/Items/Weapons/Summon/ShellfishStaff.cs b/Items/Weapons/Summon/ShellfishStaff.cs index b3da7e364b..2487b3034c 100644 --- a/Items/Weapons/Summon/ShellfishStaff.cs +++ b/Items/Weapons/Summon/ShellfishStaff.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Summon; +using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -12,15 +12,15 @@ namespace CalamityMod.Items.Weapons.Summon public new string LocalizationCategory => "Items.Weapons.Summon"; public override void SetDefaults() { - Item.damage = 70; - Item.mana = 10; Item.width = 50; Item.height = 50; + Item.damage = 70; + Item.mana = 10; Item.useTime = Item.useAnimation = 25; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 2f; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item44; Item.autoReuse = true; diff --git a/Items/Weapons/Summon/Sirius.cs b/Items/Weapons/Summon/Sirius.cs index 88ad5174c4..3a178abe56 100644 --- a/Items/Weapons/Summon/Sirius.cs +++ b/Items/Weapons/Summon/Sirius.cs @@ -1,6 +1,6 @@ using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Summon; using CalamityMod.Items.Placeables.Ores; +using CalamityMod.Projectiles.Summon; using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; @@ -16,19 +16,16 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { Item.width = Item.height = 62; - Item.damage = 600; Item.useTime = Item.useAnimation = 10; Item.mana = 10; Item.knockBack = 10f; - Item.shoot = ModContent.ProjectileType(); - Item.DamageType = DamageClass.Summon; Item.useStyle = ItemUseStyleID.Swing; Item.UseSound = SoundID.Item44; Item.rare = ModContent.RarityType(); - Item.value = CalamityGlobalItem.Rarity13BuyPrice; + Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; Item.noMelee = true; } diff --git a/Items/Weapons/Summon/SlimePuppetStaff.cs b/Items/Weapons/Summon/SlimePuppetStaff.cs index 0dcb95fb2b..c00379c4e0 100644 --- a/Items/Weapons/Summon/SlimePuppetStaff.cs +++ b/Items/Weapons/Summon/SlimePuppetStaff.cs @@ -1,12 +1,12 @@ -using Terraria.DataStructures; +using CalamityMod.Items.Materials; +using CalamityMod.NPCs.SlimeGod; using CalamityMod.Projectiles.Summon; +using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.NPCs.SlimeGod; -using CalamityMod.Tiles.Furniture.CraftingStations; -using CalamityMod.Items.Materials; namespace CalamityMod.Items.Weapons.Summon { @@ -15,15 +15,15 @@ namespace CalamityMod.Items.Weapons.Summon public new string LocalizationCategory => "Items.Weapons.Summon"; public override void SetDefaults() { - Item.damage = 26; - Item.mana = 10; Item.width = 32; Item.height = 34; + Item.damage = 10; + Item.mana = 10; Item.useTime = Item.useAnimation = 29; Item.useStyle = ItemUseStyleID.HoldUp; Item.noMelee = true; Item.knockBack = 3.6f; - Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; Item.UseSound = SlimeGodCore.PossessionSound; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Summon/SpikecragStaff.cs b/Items/Weapons/Summon/SpikecragStaff.cs index a86ae07355..53691dfcaf 100644 --- a/Items/Weapons/Summon/SpikecragStaff.cs +++ b/Items/Weapons/Summon/SpikecragStaff.cs @@ -1,10 +1,10 @@ -using Terraria.DataStructures; +using System.Collections.Generic; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using System.Collections.Generic; namespace CalamityMod.Items.Weapons.Summon { @@ -13,17 +13,17 @@ namespace CalamityMod.Items.Weapons.Summon public new string LocalizationCategory => "Items.Weapons.Summon"; public override void SetDefaults() { + Item.width = 50; + Item.height = 50; Item.damage = 56; Item.mana = 10; Item.DamageType = DamageClass.Summon; Item.sentry = true; - Item.width = 50; - Item.height = 50; Item.useTime = Item.useAnimation = 20; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 2f; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; Item.autoReuse = true; Item.shootSpeed = 20f; @@ -35,8 +35,10 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - //CalamityUtils.OnlyOneSentry(player, type); - int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI, 120f, 0f); + player.FindSentryRestingSpot(type, out int XPosition, out int YPosition, out int YOffset); + YOffset -= 6; + position = new Vector2((float)XPosition, (float)(YPosition - YOffset)); + int p = Projectile.NewProjectile(source, position, Vector2.Zero, type, damage, knockback, player.whoAmI, 120f, 0f); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; player.UpdateMaxTurrets(); diff --git a/Items/Weapons/Summon/SquirrelSquireStaff.cs b/Items/Weapons/Summon/SquirrelSquireStaff.cs index a97d8941bf..2917782ac7 100644 --- a/Items/Weapons/Summon/SquirrelSquireStaff.cs +++ b/Items/Weapons/Summon/SquirrelSquireStaff.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Summon; +using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -12,15 +12,15 @@ namespace CalamityMod.Items.Weapons.Summon public new string LocalizationCategory => "Items.Weapons.Summon"; public override void SetDefaults() { - Item.damage = 8; - Item.mana = 10; Item.width = 52; Item.height = 52; + Item.damage = 8; + Item.mana = 10; Item.useTime = Item.useAnimation = 35; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 0.5f; - Item.value = CalamityGlobalItem.Rarity0BuyPrice; + Item.value = CalamityGlobalItem.RarityWhiteBuyPrice; Item.rare = ItemRarityID.White; Item.UseSound = SoundID.Item44; Item.autoReuse = true; @@ -34,10 +34,10 @@ namespace CalamityMod.Items.Weapons.Summon { if (player.altFunctionUse != 2) { - position = Main.MouseWorld; - velocity.X = 0; - velocity.Y = 0; - int p = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI, 0f, 30f); + player.FindSentryRestingSpot(type, out int XPosition, out int YPosition, out int YOffset); + YOffset += 6; + position = new Vector2((float)XPosition, (float)(YPosition - YOffset)); + int p = Projectile.NewProjectile(source, position, Vector2.Zero, type, damage, knockback, player.whoAmI, 0f, 30f); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; diff --git a/Items/Weapons/Summon/StaffOfNecrosteocytes.cs b/Items/Weapons/Summon/StaffOfNecrosteocytes.cs index 5fb3dc5504..5c08cfc5bc 100644 --- a/Items/Weapons/Summon/StaffOfNecrosteocytes.cs +++ b/Items/Weapons/Summon/StaffOfNecrosteocytes.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Summon; +using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -12,15 +12,15 @@ namespace CalamityMod.Items.Weapons.Summon public new string LocalizationCategory => "Items.Weapons.Summon"; public override void SetDefaults() { - Item.damage = 31; - Item.mana = 10; Item.width = 52; Item.height = 54; + Item.damage = 31; + Item.mana = 10; Item.useTime = Item.useAnimation = 30; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 3.5f; - Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; Item.UseSound = SoundID.Item44; Item.autoReuse = true; diff --git a/Items/Weapons/Summon/StaffOfNecrosteocytes.png b/Items/Weapons/Summon/StaffOfNecrosteocytes.png index d58f69168d..61665dc8d3 100644 Binary files a/Items/Weapons/Summon/StaffOfNecrosteocytes.png and b/Items/Weapons/Summon/StaffOfNecrosteocytes.png differ diff --git a/Items/Weapons/Summon/StaffoftheMechworm.cs b/Items/Weapons/Summon/StaffoftheMechworm.cs index 5cc6fe5d08..c3555dbd4b 100644 --- a/Items/Weapons/Summon/StaffoftheMechworm.cs +++ b/Items/Weapons/Summon/StaffoftheMechworm.cs @@ -1,7 +1,7 @@ -using CalamityMod.Projectiles.Summon; +using System.Linq; +using CalamityMod.Projectiles.Summon; using CalamityMod.Rarities; using Microsoft.Xna.Framework; -using System.Linq; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -12,19 +12,17 @@ namespace CalamityMod.Items.Weapons.Summon public class StaffoftheMechworm : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Summon"; - // This value is also referenced by the God Slayer and Auric summoner helmets. - public const int BaseDamage = 100; // originally 325 public override void SetDefaults() { - Item.damage = BaseDamage; - Item.mana = 10; Item.width = 68; Item.height = 68; + Item.damage = 100; + Item.mana = 10; Item.useTime = Item.useAnimation = 10; // 9 because of useStyle 1 Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 2f; - Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item113; Item.autoReuse = true; diff --git a/Items/Weapons/Summon/StarspawnHelixStaff.cs b/Items/Weapons/Summon/StarspawnHelixStaff.cs index fd98d1a8b1..867e824854 100644 --- a/Items/Weapons/Summon/StarspawnHelixStaff.cs +++ b/Items/Weapons/Summon/StarspawnHelixStaff.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Summon; +using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -13,21 +13,19 @@ namespace CalamityMod.Items.Weapons.Summon public new string LocalizationCategory => "Items.Weapons.Summon"; public override void SetDefaults() { - Item.damage = 75; + Item.width = 54; + Item.height = 52; + Item.damage = 103; Item.knockBack = 1.25f; Item.mana = 10; Item.shoot = ModContent.ProjectileType(); - - Item.width = 54; - Item.height = 52; Item.useTime = Item.useAnimation = 20; - Item.DamageType = DamageClass.Summon; Item.useStyle = ItemUseStyleID.Swing; Item.UseSound = SoundID.Item44; Item.rare = ItemRarityID.Cyan; - Item.value = CalamityGlobalItem.Rarity9BuyPrice; + Item.value = CalamityGlobalItem.RarityCyanBuyPrice; Item.noMelee = true; Item.autoReuse = true; } diff --git a/Items/Weapons/Summon/StellarTorusStaff.cs b/Items/Weapons/Summon/StellarTorusStaff.cs index 0ed006cb56..07741b3cad 100644 --- a/Items/Weapons/Summon/StellarTorusStaff.cs +++ b/Items/Weapons/Summon/StellarTorusStaff.cs @@ -23,14 +23,14 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - Item.damage = 185; - Item.useTime = Item.useAnimation = 30; + Item.width = 42; + Item.height = 42; + Item.damage = 142; + Item.useTime = Item.useAnimation = 20; Item.knockBack = 4f; Item.mana = 10; Item.shoot = ModContent.ProjectileType(); - Item.width = 42; - Item.height = 42; Item.noMelee = true; Item.autoReuse = true; Item.Calamity().donorItem = true; @@ -38,7 +38,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.useStyle = ItemUseStyleID.Swing; Item.UseSound = SoundID.Item15; Item.rare = ModContent.RarityType(); - Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) @@ -47,7 +47,7 @@ namespace CalamityMod.Items.Weapons.Summon if (Main.projectile.IndexInRange(minion)) Main.projectile[minion].originalDamage = Item.OriginalDamage; - + return false; } diff --git a/Items/Weapons/Summon/StormjawStaff.cs b/Items/Weapons/Summon/StormjawStaff.cs index f32049a30c..99f5a062b4 100644 --- a/Items/Weapons/Summon/StormjawStaff.cs +++ b/Items/Weapons/Summon/StormjawStaff.cs @@ -1,7 +1,8 @@ -using Terraria.DataStructures; +using CalamityMod.NPCs.NormalNPCs; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -12,18 +13,17 @@ namespace CalamityMod.Items.Weapons.Summon public new string LocalizationCategory => "Items.Weapons.Summon"; public override void SetDefaults() { - Item.damage = 11; - Item.mana = 10; Item.width = 32; Item.height = 32; + Item.damage = 11; + Item.mana = 10; Item.useTime = Item.useAnimation = 35; - Item.scale = 0.75f; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 2f; - Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; - Item.UseSound = SoundID.NPCDeath34; + Item.UseSound = Stormlion.DeathSound; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; diff --git a/Items/Weapons/Summon/SunSpiritStaff.cs b/Items/Weapons/Summon/SunSpiritStaff.cs index ed948dcaee..0c2c0315e1 100644 --- a/Items/Weapons/Summon/SunSpiritStaff.cs +++ b/Items/Weapons/Summon/SunSpiritStaff.cs @@ -1,8 +1,8 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -13,15 +13,15 @@ namespace CalamityMod.Items.Weapons.Summon public new string LocalizationCategory => "Items.Weapons.Summon"; public override void SetDefaults() { - Item.damage = 12; - Item.mana = 10; Item.width = 44; Item.height = 48; + Item.damage = 12; + Item.mana = 10; Item.useTime = Item.useAnimation = 35; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 1.15f; - Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.rare = ItemRarityID.Blue; Item.UseSound = SoundID.Item44; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Summon/TacticalPlagueEngine.cs b/Items/Weapons/Summon/TacticalPlagueEngine.cs index 9b5af03a24..0f24df1f31 100644 --- a/Items/Weapons/Summon/TacticalPlagueEngine.cs +++ b/Items/Weapons/Summon/TacticalPlagueEngine.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Summon; +using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -14,16 +14,16 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - Item.damage = 140; - Item.mana = 10; Item.width = 28; Item.height = 20; + Item.damage = 140; + Item.mana = 10; Item.useTime = Item.useAnimation = 14; Item.useStyle = ItemUseStyleID.HoldUp; Item.noMelee = true; Item.knockBack = 0.5f; - Item.value = CalamityGlobalItem.Rarity10BuyPrice; - Item.rare = ItemRarityID.Red; + Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; + Item.rare = ItemRarityID.Purple; Item.UseSound = SoundID.Item14; Item.autoReuse = true; Item.DamageType = DamageClass.Summon; @@ -37,7 +37,7 @@ namespace CalamityMod.Items.Weapons.Summon { int p = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI, 0f, 1f); if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; + Main.projectile[p].originalDamage = Item.damage; } return false; } diff --git a/Items/Weapons/Summon/TemporalUmbrella.cs b/Items/Weapons/Summon/TemporalUmbrella.cs index bd6a07d95f..165a7abad0 100644 --- a/Items/Weapons/Summon/TemporalUmbrella.cs +++ b/Items/Weapons/Summon/TemporalUmbrella.cs @@ -16,6 +16,8 @@ namespace CalamityMod.Items.Weapons.Summon public new string LocalizationCategory => "Items.Weapons.Summon"; public override void SetDefaults() { + Item.width = 74; + Item.height = 72; Item.damage = 193; Item.knockBack = 1f; Item.mana = 99; @@ -25,11 +27,9 @@ namespace CalamityMod.Items.Weapons.Summon Item.shoot = ModContent.ProjectileType(); Item.useStyle = ItemUseStyleID.Swing; - Item.width = 74; - Item.height = 72; Item.noMelee = true; Item.UseSound = SoundID.Item68; - Item.value = CalamityGlobalItem.Rarity16BuyPrice; + Item.value = CalamityGlobalItem.RarityHotPinkBuyPrice; Item.rare = ModContent.RarityType(); Item.Calamity().devItem = true; } diff --git a/Items/Weapons/Summon/TundraFlameBlossomsStaff.cs b/Items/Weapons/Summon/TundraFlameBlossomsStaff.cs index 00ba198c5e..8695293f73 100644 --- a/Items/Weapons/Summon/TundraFlameBlossomsStaff.cs +++ b/Items/Weapons/Summon/TundraFlameBlossomsStaff.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Summon; +using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -12,15 +12,15 @@ namespace CalamityMod.Items.Weapons.Summon public new string LocalizationCategory => "Items.Weapons.Summon"; public override void SetDefaults() { - Item.damage = 40; - Item.mana = 10; Item.width = 50; Item.height = 60; + Item.damage = 40; + Item.mana = 10; Item.useTime = Item.useAnimation = 25; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 3f; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item46; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Summon/VengefulSunStaff.cs b/Items/Weapons/Summon/VengefulSunStaff.cs index f899f99f52..1638072b13 100644 --- a/Items/Weapons/Summon/VengefulSunStaff.cs +++ b/Items/Weapons/Summon/VengefulSunStaff.cs @@ -1,8 +1,8 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -14,15 +14,15 @@ namespace CalamityMod.Items.Weapons.Summon public new string LocalizationCategory => "Items.Weapons.Summon"; public override void SetDefaults() { - Item.damage = 60; - Item.mana = 10; Item.width = 72; Item.height = 72; + Item.damage = 60; + Item.mana = 10; Item.useTime = Item.useAnimation = 25; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 1.25f; - Item.value = CalamityGlobalItem.Rarity6BuyPrice; + Item.value = CalamityGlobalItem.RarityLightPurpleBuyPrice; Item.rare = ItemRarityID.LightPurple; Item.UseSound = SoundID.Item44; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Summon/Vigilance.cs b/Items/Weapons/Summon/Vigilance.cs index cf73605087..2ed2a9261d 100644 --- a/Items/Weapons/Summon/Vigilance.cs +++ b/Items/Weapons/Summon/Vigilance.cs @@ -13,9 +13,9 @@ namespace CalamityMod.Items.Weapons.Summon public new string LocalizationCategory => "Items.Weapons.Summon"; public override void SetDefaults() { + Item.width = Item.height = 32; Item.damage = 115; Item.mana = 10; - Item.width = Item.height = 32; Item.useTime = Item.useAnimation = 10; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; diff --git a/Items/Weapons/Summon/VileFeeder.cs b/Items/Weapons/Summon/VileFeeder.cs index 22cdd84e12..7e02720664 100644 --- a/Items/Weapons/Summon/VileFeeder.cs +++ b/Items/Weapons/Summon/VileFeeder.cs @@ -1,8 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Summon; +using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -11,62 +10,34 @@ namespace CalamityMod.Items.Weapons.Summon public class VileFeeder : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Summon"; - public static int BaseDamage = 14; + + public override void SetStaticDefaults() => Item.staff[Type] = true; public override void SetDefaults() { - Item.damage = BaseDamage; - Item.mana = 10; - Item.width = 66; - Item.height = 70; - Item.useTime = Item.useAnimation = 30; - Item.useStyle = ItemUseStyleID.Swing; - Item.noMelee = true; - Item.knockBack = 0.5f; - Item.value = CalamityGlobalItem.Rarity2BuyPrice; - Item.rare = ItemRarityID.Green; - Item.UseSound = SoundID.Item2; - Item.autoReuse = true; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 10f; + Item.width = 40; + Item.height = 36; + Item.damage = 14; Item.DamageType = DamageClass.Summon; + Item.shoot = ModContent.ProjectileType(); + Item.knockBack = 0.5f; + + Item.useTime = Item.useAnimation = 30; + Item.mana = 10; + Item.noMelee = true; + Item.autoReuse = true; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; + Item.rare = ItemRarityID.Green; + Item.useStyle = ItemUseStyleID.Shoot; + Item.UseSound = SoundID.Item2; + + // This doesn't do anything, it's just so the item is held like a staff. + Item.shootSpeed = 1f; } 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 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; - if (player.gravDir == -1f) - { - mouseYDist = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - realPlayerPos.Y; - } - float mouseDistance = (float)Math.Sqrt((double)(mouseXDist * mouseXDist + mouseYDist * mouseYDist)); - if ((float.IsNaN(mouseXDist) && float.IsNaN(mouseYDist)) || (mouseXDist == 0f && mouseYDist == 0f)) - { - mouseXDist = (float)player.direction; - mouseYDist = 0f; - mouseDistance = projSpeed; - } - else - { - mouseDistance = projSpeed / mouseDistance; - } - mouseXDist *= mouseDistance; - mouseYDist *= mouseDistance; - realPlayerPos.X = (float)Main.mouseX + Main.screenPosition.X; - realPlayerPos.Y = (float)Main.mouseY + Main.screenPosition.Y; - Vector2 spinningpoint = new Vector2(mouseXDist, mouseYDist); - spinningpoint = spinningpoint.RotatedBy(MathHelper.PiOver2, default); - int p = Projectile.NewProjectile(source, realPlayerPos.X + spinningpoint.X, realPlayerPos.Y + spinningpoint.Y, spinningpoint.X, spinningpoint.Y, type, damage, knockback, i, 0f, 0f); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; - } + Projectile.NewProjectileDirect(source, Main.MouseWorld, Main.rand.NextVector2CircularEdge(5f, 5f), type, damage, knockback, player.whoAmI); return false; } diff --git a/Items/Weapons/Summon/VileFeeder.png b/Items/Weapons/Summon/VileFeeder.png index b4a7f8446b..5f1a4cc500 100644 Binary files a/Items/Weapons/Summon/VileFeeder.png and b/Items/Weapons/Summon/VileFeeder.png differ diff --git a/Items/Weapons/Summon/ViralSprout.cs b/Items/Weapons/Summon/ViralSprout.cs index 822d0453c7..b8562622b7 100644 --- a/Items/Weapons/Summon/ViralSprout.cs +++ b/Items/Weapons/Summon/ViralSprout.cs @@ -1,8 +1,8 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -13,15 +13,15 @@ namespace CalamityMod.Items.Weapons.Summon public new string LocalizationCategory => "Items.Weapons.Summon"; public override void SetDefaults() { - Item.damage = 30; - Item.mana = 10; Item.width = 48; Item.height = 56; + Item.damage = 30; + Item.mana = 10; Item.useTime = Item.useAnimation = 19; Item.useStyle = ItemUseStyleID.HoldUp; Item.noMelee = true; Item.knockBack = 2f; - Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; Item.UseSound = SoundID.Item44; Item.autoReuse = true; diff --git a/Items/Weapons/Summon/ViridVanguard.cs b/Items/Weapons/Summon/ViridVanguard.cs index 64781b3446..99585eaccc 100644 --- a/Items/Weapons/Summon/ViridVanguard.cs +++ b/Items/Weapons/Summon/ViridVanguard.cs @@ -34,11 +34,11 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { + Item.width = 26; + Item.height = 36; Item.damage = 73; Item.DamageType = DamageClass.Summon; Item.mana = 10; - Item.width = 26; - Item.height = 36; Item.useTime = Item.useAnimation = 14; Item.useStyle = ItemUseStyleID.HoldUp; Item.noMelee = true; diff --git a/Items/Weapons/Summon/VoidConcentrationStaff.cs b/Items/Weapons/Summon/VoidConcentrationStaff.cs index 0a2193a741..4d0ecae6ad 100644 --- a/Items/Weapons/Summon/VoidConcentrationStaff.cs +++ b/Items/Weapons/Summon/VoidConcentrationStaff.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.useTime = Item.useAnimation = 15; // 14 because of useStyle 1 Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; - Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); } diff --git a/Items/Weapons/Summon/WarloksMoonFist.cs b/Items/Weapons/Summon/WarloksMoonFist.cs index 66faeef075..d1b4234ac0 100644 --- a/Items/Weapons/Summon/WarloksMoonFist.cs +++ b/Items/Weapons/Summon/WarloksMoonFist.cs @@ -19,10 +19,10 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - Item.damage = 450; - Item.mana = 10; Item.width = 50; Item.height = 50; + Item.damage = 450; + Item.mana = 10; Item.useTime = Item.useAnimation = 25; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; @@ -36,6 +36,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; Item.DamageType = DamageClass.Summon; + Item.Calamity().donorItem = true; } 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/Summon/WitherBlossomsStaff.cs b/Items/Weapons/Summon/WitherBlossomsStaff.cs index b3d71f0313..e7a264c7cc 100644 --- a/Items/Weapons/Summon/WitherBlossomsStaff.cs +++ b/Items/Weapons/Summon/WitherBlossomsStaff.cs @@ -1,8 +1,8 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -13,15 +13,15 @@ namespace CalamityMod.Items.Weapons.Summon public new string LocalizationCategory => "Items.Weapons.Summon"; public override void SetDefaults() { - Item.damage = 50; - Item.mana = 10; Item.width = 52; Item.height = 60; + Item.damage = 50; + Item.mana = 10; Item.useTime = Item.useAnimation = 20; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 3f; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; Item.UseSound = SoundID.Item46; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Summon/WulfrumController.cs b/Items/Weapons/Summon/WulfrumController.cs index 8661d5ee84..82f79133b8 100644 --- a/Items/Weapons/Summon/WulfrumController.cs +++ b/Items/Weapons/Summon/WulfrumController.cs @@ -1,11 +1,11 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Summon; +using System; using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using System; namespace CalamityMod.Items.Weapons.Summon { @@ -15,15 +15,15 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - Item.damage = 16; - Item.mana = 10; Item.width = 28; Item.height = 20; + Item.damage = 16; + Item.mana = 10; Item.useTime = Item.useAnimation = 34; Item.useStyle = ItemUseStyleID.HoldUp; Item.noMelee = true; Item.knockBack = 0.5f; - Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.rare = ItemRarityID.Blue; Item.UseSound = SoundID.Item15; //phaseblade sound effect Item.autoReuse = true; @@ -92,9 +92,9 @@ namespace CalamityMod.Items.Weapons.Summon { if (buffingDrones > 0 && Main.rand.NextBool(3)) { - Vector2 dustPos = Player.position + (Player.height * Main.rand.NextFloat(0.7f, 1f) + Player.gfxOffY) * Vector2.UnitY + Vector2.UnitX * Main.rand.NextFloat() * Player.width; + Vector2 dustPos = Player.position + (Player.height * Main.rand.NextFloat(0.7f, 1f) + Player.gfxOffY) * Vector2.UnitY + Vector2.UnitX * Main.rand.NextFloat() * Player.width; - Dust chust = Dust.NewDustPerfect(dustPos, 274, -Vector2.UnitY * Main.rand.NextFloat(1.4f, 7f) + Player.velocity , Alpha: 100, Scale: Main.rand.NextFloat(1.2f, 1.8f)); + Dust chust = Dust.NewDustPerfect(dustPos, 274, -Vector2.UnitY * Main.rand.NextFloat(1.4f, 7f) + Player.velocity, Alpha: 100, Scale: Main.rand.NextFloat(1.2f, 1.8f)); chust.noGravity = true; chust.noLight = true; } diff --git a/Items/Weapons/Summon/YharonsKindleStaff.cs b/Items/Weapons/Summon/YharonsKindleStaff.cs index 740c85d372..577f76f719 100644 --- a/Items/Weapons/Summon/YharonsKindleStaff.cs +++ b/Items/Weapons/Summon/YharonsKindleStaff.cs @@ -13,19 +13,18 @@ namespace CalamityMod.Items.Weapons.Summon public class YharonsKindleStaff : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Summon"; - public const int Damage = 300; public const float ReboundRamDamageFactor = 2f; public override void SetDefaults() { - Item.damage = Damage; - Item.mana = 10; - Item.useStyle = ItemUseStyleID.Swing; Item.width = 80; Item.height = 74; + Item.damage = 300; + Item.mana = 10; + Item.useStyle = ItemUseStyleID.Swing; Item.useTime = Item.useAnimation = 10; Item.noMelee = true; Item.knockBack = 7f; - Item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.rare = ModContent.RarityType(); Item.UseSound = CommonCalamitySounds.FlareSound; Item.autoReuse = true; diff --git a/Items/Weapons/Typeless/Aestheticus.cs b/Items/Weapons/Typeless/Aestheticus.cs index 6764964188..b03b538f9a 100644 --- a/Items/Weapons/Typeless/Aestheticus.cs +++ b/Items/Weapons/Typeless/Aestheticus.cs @@ -15,8 +15,9 @@ namespace CalamityMod.Items.Weapons.Typeless public new string LocalizationCategory => "Items.Weapons.Typeless"; public override void SetDefaults() { - Item.DamageType = AverageDamageClass.Instance; Item.width = 58; + Item.height = 58; + Item.DamageType = AverageDamageClass.Instance; Item.damage = 8; Item.useAnimation = 25; Item.useTime = 25; @@ -24,9 +25,8 @@ namespace CalamityMod.Items.Weapons.Typeless Item.knockBack = 3f; Item.UseSound = SoundID.Item109; Item.autoReuse = true; - Item.height = 58; - Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; Item.Calamity().donorItem = true; @@ -34,10 +34,10 @@ namespace CalamityMod.Items.Weapons.Typeless Item.shootSpeed = 5f; } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.ClasslessWeapon; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.ClasslessWeapon; + } 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/Typeless/EyeofMagnus.cs b/Items/Weapons/Typeless/EyeofMagnus.cs index afa492a3a2..03c034f810 100644 --- a/Items/Weapons/Typeless/EyeofMagnus.cs +++ b/Items/Weapons/Typeless/EyeofMagnus.cs @@ -1,9 +1,9 @@ using CalamityMod.Projectiles.Typeless; +using CalamityMod.Sounds; using Microsoft.Xna.Framework; using Terraria; -using Terraria.ModLoader; using Terraria.ID; -using CalamityMod.Sounds; +using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Typeless { @@ -12,10 +12,11 @@ namespace CalamityMod.Items.Weapons.Typeless public new string LocalizationCategory => "Items.Weapons.Typeless"; public override void SetDefaults() { - Item.DamageType = AverageDamageClass.Instance; Item.width = 80; + Item.height = 50; + Item.DamageType = AverageDamageClass.Instance; Item.damage = 32; - Item.rare = ItemRarityID.Cyan; + Item.rare = ItemRarityID.Red; Item.useAnimation = 20; Item.useTime = 20; Item.useStyle = ItemUseStyleID.Shoot; @@ -23,16 +24,15 @@ namespace CalamityMod.Items.Weapons.Typeless Item.UseSound = CommonCalamitySounds.LaserCannonSound; Item.autoReuse = true; Item.noMelee = true; - Item.height = 50; - Item.value = CalamityGlobalItem.Rarity9BuyPrice; + Item.value = CalamityGlobalItem.RarityRedBuyPrice; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.ClasslessWeapon; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.ClasslessWeapon; + } public override Vector2? HoldoutOffset() { diff --git a/Items/Weapons/Typeless/GoldenGun.cs b/Items/Weapons/Typeless/GoldenGun.cs deleted file mode 100644 index f1cccba5d6..0000000000 --- a/Items/Weapons/Typeless/GoldenGun.cs +++ /dev/null @@ -1,56 +0,0 @@ -using CalamityMod.Projectiles.Typeless; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Typeless -{ - public class GoldenGun : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Weapons.Typeless"; - public override void SetDefaults() - { - Item.damage = 5; - Item.width = 78; - Item.height = 36; - Item.useTime = 15; - Item.useAnimation = 15; - Item.useStyle = ItemUseStyleID.Shoot; - Item.noMelee = true; - Item.knockBack = 2f; - Item.value = CalamityGlobalItem.Rarity3BuyPrice; - Item.rare = ItemRarityID.Orange; - Item.UseSound = SoundID.Item11; - Item.autoReuse = true; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 12f; - } - - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.ClasslessWeapon; - } - - public override Vector2? HoldoutOffset() - { - return new Vector2(-5, 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, velocity, type, damage, knockback, player.whoAmI, 0f, 0f); - return false; - } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(ItemID.HellstoneBar, 10). - AddIngredient(ItemID.Ichor, 15). - AddTile(TileID.Anvils). - Register(); - } - } -} diff --git a/Items/Weapons/Typeless/GoldenGun.png b/Items/Weapons/Typeless/GoldenGun.png deleted file mode 100644 index c3fd046f08..0000000000 Binary files a/Items/Weapons/Typeless/GoldenGun.png and /dev/null differ diff --git a/Items/Weapons/Typeless/LunicEye.cs b/Items/Weapons/Typeless/LunicEye.cs index e8b20ccc95..83600706cf 100644 --- a/Items/Weapons/Typeless/LunicEye.cs +++ b/Items/Weapons/Typeless/LunicEye.cs @@ -1,10 +1,10 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Typeless; +using CalamityMod.Sounds; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Sounds; namespace CalamityMod.Items.Weapons.Typeless { @@ -13,10 +13,11 @@ namespace CalamityMod.Items.Weapons.Typeless public new string LocalizationCategory => "Items.Weapons.Typeless"; public override void SetDefaults() { - Item.DamageType = AverageDamageClass.Instance; Item.width = 60; + Item.height = 36; + Item.DamageType = AverageDamageClass.Instance; Item.damage = 9; - Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; Item.useAnimation = 15; Item.useTime = 15; @@ -25,15 +26,14 @@ namespace CalamityMod.Items.Weapons.Typeless Item.UseSound = CommonCalamitySounds.LaserCannonSound; Item.autoReuse = true; Item.noMelee = true; - Item.height = 36; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.ClasslessWeapon; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.ClasslessWeapon; + } public override Vector2? HoldoutOffset() { @@ -44,7 +44,7 @@ namespace CalamityMod.Items.Weapons.Typeless { CreateRecipe(). AddRecipeGroup("AnyCobaltBar", 10). - AddIngredient(20). + AddIngredient(20). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Weapons/Typeless/RelicOfDeliverance.cs b/Items/Weapons/Typeless/RelicOfDeliverance.cs index 9e0a70f6f8..18fa4a63c8 100644 --- a/Items/Weapons/Typeless/RelicOfDeliverance.cs +++ b/Items/Weapons/Typeless/RelicOfDeliverance.cs @@ -20,16 +20,16 @@ namespace CalamityMod.Items.Weapons.Typeless Item.noMelee = true; Item.noUseGraphic = true; Item.channel = true; - Item.value = CalamityGlobalItem.Rarity11BuyPrice; + Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; Item.rare = ItemRarityID.Purple; Item.shoot = ModContent.ProjectileType(); Item.Calamity().CannotBeEnchanted = true; } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.ToolsOther; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.ToolsOther; + } // Terraria seems to really dislike high crit values in SetDefaults public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 16; diff --git a/Items/Weapons/Typeless/RelicOfResilience.cs b/Items/Weapons/Typeless/RelicOfResilience.cs index db7549197f..a86f3f278e 100644 --- a/Items/Weapons/Typeless/RelicOfResilience.cs +++ b/Items/Weapons/Typeless/RelicOfResilience.cs @@ -1,7 +1,7 @@ -using CalamityMod.Projectiles.Damageable; +using System.Linq; +using CalamityMod.Projectiles.Damageable; using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; -using System.Linq; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Typeless public const float WeaknessDR = 0.45f; public override void SetStaticDefaults() { - ItemID.Sets.CanBePlacedOnWeaponRacks[Item.type] = true; + ItemID.Sets.CanBePlacedOnWeaponRacks[Item.type] = true; } public override void SetDefaults() @@ -28,16 +28,16 @@ namespace CalamityMod.Items.Weapons.Typeless Item.UseSound = SoundID.Item45; Item.autoReuse = true; Item.noMelee = true; - Item.value = CalamityGlobalItem.Rarity11BuyPrice; + Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; Item.rare = ItemRarityID.Purple; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 0f; } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.ToolsOther; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.ToolsOther; + } public override bool CanUseItem(Player player) => !player.HasCooldown(Cooldowns.RelicOfResilience.ID); public override bool? UseItem(Player player) => true; diff --git a/Items/Weapons/Typeless/Skynamite.cs b/Items/Weapons/Typeless/Skynamite.cs index 2d7e510f5a..351f6072f8 100644 --- a/Items/Weapons/Typeless/Skynamite.cs +++ b/Items/Weapons/Typeless/Skynamite.cs @@ -15,26 +15,26 @@ namespace CalamityMod.Items.Weapons.Typeless public override void SetStaticDefaults() { - Item.ResearchUnlockCount = 99; + Item.ResearchUnlockCount = 99; ItemID.Sets.ItemsThatCountAsBombsForDemolitionistToSpawn[Item.type] = true; ItemID.Sets.CanBePlacedOnWeaponRacks[Item.type] = true; } public override void SetDefaults() { + Item.width = 8; + Item.height = 28; Item.useTime = Item.useAnimation = 40; Item.maxStack = 9999; Item.consumable = true; Item.shootSpeed = 5f; Item.shoot = ModContent.ProjectileType(); - Item.width = 8; - Item.height = 28; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.noUseGraphic = true; Item.UseSound = SoundID.Item1; - Item.value = CalamityGlobalItem.Rarity3BuyPrice / 10; // Crafted 10 at a time + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice / 10; // Crafted 10 at a time Item.rare = ItemRarityID.Orange; } diff --git a/Items/Weapons/Typeless/StarStruckWater.cs b/Items/Weapons/Typeless/StarStruckWater.cs index ef7eec5265..110edb02eb 100644 --- a/Items/Weapons/Typeless/StarStruckWater.cs +++ b/Items/Weapons/Typeless/StarStruckWater.cs @@ -1,6 +1,6 @@ -using CalamityMod.Projectiles.Typeless; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; +using CalamityMod.Projectiles.Typeless; using Terraria.ID; using Terraria.ModLoader; @@ -12,18 +12,18 @@ namespace CalamityMod.Items.Weapons.Typeless public override void SetStaticDefaults() { Item.ResearchUnlockCount = 99; - ItemID.Sets.SortingPriorityTerraforming[Type] = 92; // Blood Water + ItemID.Sets.SortingPriorityTerraforming[Type] = 92; // Blood Water } public override void SetDefaults() { + Item.width = 18; + Item.height = 20; Item.useStyle = ItemUseStyleID.Swing; Item.shootSpeed = 14f; Item.rare = ItemRarityID.Orange; Item.damage = 20; Item.shoot = ModContent.ProjectileType(); - Item.width = 18; - Item.height = 20; Item.maxStack = 9999; Item.consumable = true; Item.knockBack = 3f; @@ -39,7 +39,7 @@ namespace CalamityMod.Items.Weapons.Typeless { CreateRecipe(10). AddIngredient(ItemID.BottledWater, 10). - AddIngredient(2). + AddIngredient(2). AddIngredient(). Register(); } diff --git a/Items/Weapons/Typeless/YanmeisKnife.cs b/Items/Weapons/Typeless/YanmeisKnife.cs index 5b861e7830..42b934e108 100644 --- a/Items/Weapons/Typeless/YanmeisKnife.cs +++ b/Items/Weapons/Typeless/YanmeisKnife.cs @@ -2,10 +2,10 @@ using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Items.Weapons.Typeless { @@ -14,11 +14,11 @@ namespace CalamityMod.Items.Weapons.Typeless public new string LocalizationCategory => "Items.Weapons.Typeless"; public static readonly SoundStyle HitSound = new("CalamityMod/Sounds/Item/YanmeiKnifeHit"); public static readonly SoundStyle ExpireSound = new("CalamityMod/Sounds/Custom/YanmeiKnifeExpire"); - + public override void SetDefaults() { - Item.height = 44; Item.width = 48; + Item.height = 44; Item.damage = 8; Item.noMelee = true; Item.noUseGraphic = true; @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Typeless Item.useStyle = ItemUseStyleID.Shoot; Item.knockBack = 4.5f; Item.autoReuse = false; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; Item.Calamity().donorItem = true; Item.UseSound = SoundID.Item71; @@ -34,10 +34,10 @@ namespace CalamityMod.Items.Weapons.Typeless Item.shootSpeed = 24f; } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.ClasslessWeapon; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.ClasslessWeapon; + } // Terraria seems to really dislike high crit values in SetDefaults public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 6; diff --git a/Localization/en-US/Mods.CalamityMod.Bestiary.hjson b/Localization/en-US/Mods.CalamityMod.Bestiary.hjson index a3201816ea..8a8ccb1a7c 100644 --- a/Localization/en-US/Mods.CalamityMod.Bestiary.hjson +++ b/Localization/en-US/Mods.CalamityMod.Bestiary.hjson @@ -16,6 +16,7 @@ LuminousCorvina: Lumenyl grows on the fins of these exotic corvina, making these MirageJelly: Using the light refracted from lumenyl crystals and water warmed by the scorching heat of scoria, these jellyfish can create afterimages of themselves to confuse predators, or catch prey of their own. MorayEel: When a fish bites your heel and it looks like an eel, that's a moray. When it swims in the reef and has two sets of teeth, that's a moray. When you're slapped in the face with a slimy embrace, that's a moray. Oarfish: Oarfish are known for laying thousands or even millions of eggs in astonishingly quick gestation cycles. These eggs are the most abundant source of food in the Abyss, being part of the reason even the smallest and least threatening creatures can live in the otherwise near inhospitable depths of the sea. +SlabCrab: Despite its shell being as hard as rock, the Slab Crab hides at the most pacific zone of the Abyss; for it cannot withstand the acidic water above, nor the fearsome predators below. Whereas it would normally be prey that only the strongest could dine on, in this habitat, it manages to barely evade natural selection. ReaperShark: Apex predators of the void, these sharks take advantage of both their stealthiness and might to hunt anything and everything that comes near. Using their arms for purposes from hurling colossal squids into the Abyss' walls to crushing the heavily armored heads of eidolon wyrms, few can match their raw strength. ToxicMinnow: These abnormally large minnows have evolved to use nutrients from plants they consume to create toxins inside their body, which is then released after they die. They have next to no predators due to this, and contribute nearly nothing to their environment. Viperfish: Omnivorous fish that dwell in the middle sections of the Abyss, viperfish rest firmly near the bottom of the food chain. Their wide mouth normally reserved for filter feeding can double as a means to scare off predators by mimicking the much more threatening gulper eels. @@ -73,7 +74,7 @@ Cnidrion: Once trained to be the steeds of honored Ilmerian warriors, cnidrions GemCrawler: Relatives to the Ilmeran Sea's prismbacks. The aquatic lizards ended up in the wild after being taken in as pets, though without the proper nutrients to grow prisms on their back, many grew the next best thing– precious gems. BlightSlime: Slimes that have absorbed some of the blighted godly essence. Riddled with impurity, they are now more putrid flesh than gelatin and, having taken in such an amount that they seem ready to burst. Yet unlike most slimes which have relatively basic minds, these seem to be collecting mass with a purpose. Cryon: Archmage Permafrost went through great pains to not take part in combat himself, instead molding cryons to act as his personal guardians. Noticing the spread of godly essence just as many other creatures have, they have come out of stasis to combat any signs of it so that they may defend their master. -CryoSlime: Slimes enchanted by the Archmage, as a host to crystallize the frozen power of the tundra into a magical metal. He cast a spell to hide away most of his creations and research soon after leaving the Godseeeker's side, well aware that Yharim may attempt to exploit his previous work. +CryoSlime: Slimes enchanted by the Archmage, as a host to crystallize the frozen power of the tundra into a magical metal. He cast a spell to hide away most of his creations and research soon after leaving the Godseeker's side, well aware that Yharim may attempt to exploit his previous work. Eidolist: Once members of the dragon cult, they now beg the favor of a new master. They are able to live in the abyss indefinitely thanks to their wyrm-like form, allowing them to serve a new purpose. FearlessGoldfishWarrior: Though Goldfish thrive in their ponds and lakes, many take to land during storms to feed on the worms that have also surfaced. There are even accounts of aquatic warriors who carry daggers of shimmering gold, though most consider these tales far too fishy to be credible. Frogfish: Well-camouflaged and prepared to strike at any moment, Frogfish show that the ocean is rarely as serene as it seems. There are few places where one can find true peace here in the heart of what once was an empire unrivaled. diff --git a/Localization/en-US/Mods.CalamityMod.Biomes.hjson b/Localization/en-US/Mods.CalamityMod.Biomes.hjson index 7751dea39b..f6834ea4a1 100644 --- a/Localization/en-US/Mods.CalamityMod.Biomes.hjson +++ b/Localization/en-US/Mods.CalamityMod.Biomes.hjson @@ -1,29 +1,28 @@ // For general uses Abyss: Abyss AstralInfection: Astral Infection -AstralDesert: Astral Desert AstralSnow: Astral Snow BrimstoneCrags: Brimstone Crags SulphurousSea: Sulphurous Sea SunkenSea: Sunken Sea -AbovegroundAstralBiome: { - DisplayName: Astral Infection - TownNPCDialogueName: Astral Infection -} - -AbovegroundAstralBiomeSurface: { - DisplayName: Astral Surface - TownNPCDialogueName: Astral Infection -} - -AbovegroundAstralDesertBiome: { +AstralDesert: { DisplayName: Astral Desert Surface TownNPCDialogueName: Astral Desert } -AbovegroundAstralSnowBiome: { - DisplayName: Astral Snow Surface +AstralBiome: { + DisplayName: Astral Infection + TownNPCDialogueName: Astral Infection +} + +AstralInfectionBiome: { + DisplayName: Astral Infection + TownNPCDialogueName: Astral Infection +} + +AstralIce: { + DisplayName: Astral Ice TownNPCDialogueName: Astral Snow } @@ -72,7 +71,12 @@ SunkenSeaBiome: { TownNPCDialogueName: Sunken Sea } -UndergroundAstralBiome: { +AstralUnderground: { DisplayName: Astral Underground TownNPCDialogueName: Underground Astral Infection } + +AstralCaveDesert: { + DisplayName: Astral Cave Desert + TownNPCDialogueName: the Astral Cave Desert +} diff --git a/Localization/en-US/Mods.CalamityMod.Buffs.hjson b/Localization/en-US/Mods.CalamityMod.Buffs.hjson index 8cf9d0da1d..1d3a76f5c4 100644 --- a/Localization/en-US/Mods.CalamityMod.Buffs.hjson +++ b/Localization/en-US/Mods.CalamityMod.Buffs.hjson @@ -690,7 +690,7 @@ BrimflameFrenzyBuff: { BrutalCarnage: { DisplayName: Brutal Carnage - Description: 25% increased melee damage and 10% increased melee crit chance + Description: 20% increased melee damage } ChiBuff: { @@ -753,6 +753,11 @@ HallowedRuneRegeneration: { Description: Regenerating life } +Haste: { + DisplayName: Haste + Description: Increased movement speed and acceleration +} + IceShieldBuff: { DisplayName: Ice Shield Description: Absorbs 20% damage from the next hit you take, then shatters @@ -787,11 +792,6 @@ PhantomicShield: { ''' } -PolarisBuff: { - DisplayName: Polaris Boost - Description: The Northern Star empowers your life regeneration -} - ProfanedCrystalBuff: { DisplayName: Devotion Description: You are an emissary of the profaned goddess now! @@ -1046,11 +1046,6 @@ BlackHawkBuff: { Description: The fighter jet will protect you } -BloodClot: { - DisplayName: Blood Clot - Description: The blood clot will protect you -} - BrimseekerBuff: { DisplayName: Brimseeker Description: Does it want something from you? @@ -1520,3 +1515,8 @@ YoungDukeBuff: { DisplayName: Baby Boomer Description: The mutated fishron will intoxicate your foes } + +LiliesOfFinalityBuff: { + DisplayName: Finality + Description: Remember our promise +} diff --git a/Localization/en-US/Mods.CalamityMod.Configs.hjson b/Localization/en-US/Mods.CalamityMod.Configs.hjson index 99b3e029a3..ac8eba1fec 100644 --- a/Localization/en-US/Mods.CalamityMod.Configs.hjson +++ b/Localization/en-US/Mods.CalamityMod.Configs.hjson @@ -136,8 +136,8 @@ CalamityConfig: { ''' Demon Altars no longer spawn ores and crimson/corruption blocks when broken. Wall of Flesh spawns Cobalt and Palladium ore on first kill. - The first mech boss you fight has 20% less HP and damage and spawns Mythril and Orichalcum ore on first kill. - The second mech boss you fight has 10% less HP and damage and spawns Adamantite and Titanium ore on first kill. + The first mech boss you fight has 20% (10% in Expert and Master) less HP and damage and spawns Mythril and Orichalcum ore on first kill. + The second mech boss you fight has 10% (5% in Expert and Master) less HP and damage and spawns Adamantite and Titanium ore on first kill. The third mech boss spawns Hallowed Ore on first kill. ''' } @@ -253,6 +253,15 @@ CalamityConfig: { ''' } + NewVanillaTextures: { + Label: "[i:Paintbrush] New Vanilla Textures" + Tooltip: + ''' + Enable or disable new vanilla textures. + Disable this for compatibility with texture packs. + ''' + } + ParticleLimit: { Label: "[i:FragmentStardust] Max Particle Limit" Tooltip: @@ -260,7 +269,7 @@ CalamityConfig: { Sets the maximum of particle effects that can exist at once. Particles are separate from dust and gores. Turn down to improve performance. - [c/F05A5A:Turning this below 300 may cause some things to not display correctly.] + [c/F05A5A:Turning this below 1000 may cause some things to not display correctly.] ''' } @@ -282,6 +291,11 @@ CalamityConfig: { ''' } + RemoveLavaDropsFromLavaSlimes: { + Label: "[i:LavaWaders] Remove Lava Drops From Lava Slimes" + Tooltip: When enabled, Lava Slimes will be replaced with a new Lava Slime that no longer drops lava. + } + RemoveReforgeRNG: { Label: "[i:TinHammer] Remove Reforge RNG" Tooltip: @@ -300,9 +314,15 @@ CalamityConfig: { ''' } - Screenshake: { - Label: "[i:CalamityMod/WavePounder] Screenshake" - Tooltip: Enable or disable all screen-shaking effects. + ScreenshakePower: { + Label: "[i:CalamityMod/WavePounder] Screenshake Power" + Tooltip: + ''' + How intense screen-shaking effects are. + Set to zero to disable screen-shaking entirely. + [c/FF232C:All screen-shake visuals are balanced around a value of 1.] + [c/FF232C:Higher values may be nauseating or otherwise bad for some.] + ''' } ShopNewAlert: { diff --git a/Localization/en-US/Mods.CalamityMod.DamageClasses.hjson b/Localization/en-US/Mods.CalamityMod.DamageClasses.hjson index db97b20bf8..5b565b8e71 100644 --- a/Localization/en-US/Mods.CalamityMod.DamageClasses.hjson +++ b/Localization/en-US/Mods.CalamityMod.DamageClasses.hjson @@ -2,3 +2,4 @@ AverageDamageClass.DisplayName: average damage RogueDamageClass.DisplayName: rogue 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.Wings.hjson b/Localization/en-US/Mods.CalamityMod.Items.Accessories.Wings.hjson index 2ad9bf8596..6cd23de2b8 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Accessories.Wings.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Accessories.Wings.hjson @@ -83,7 +83,7 @@ MOAB: { Acceleration multiplier: 1.0 Good vertical speed Flight time: 75 - 10% increased jump speed and allows constant jumping + 32% increased jump speed and allows constant jumping Grants the player cloud, blizzard, and sandstorm mid-air jumps 'The Mother Of All Balloons' ''' @@ -123,7 +123,6 @@ SoulofCryogen: { Average vertical speed Flight time: 120 7% increase to all damage - All melee attacks and projectiles inflict frostburn Icicles rain down as you fly ''' } @@ -198,7 +197,6 @@ TracersSeraph: { 50% increased running acceleration and greater mobility on ice Provides the ability to walk on water, honey, and lava Grants immunity to fire, lava, and harmful block effects - Being hit for over 200 damage will make you immune for an extended period of time 'Taking speed EVEN FURTHER BEYOND!' ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson index fb59805eb5..5726d7ac9a 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson @@ -46,7 +46,7 @@ AbyssalDivingSuit: { Provides light underwater and extra mobility on ice Provides a moderate amount of light in the abyss Greatly reduces breath loss in the abyss - Reduces creature's ability to detect you in the abyss + Makes it more difficult for abyss creatures to detect you Reduces the defense reduction that the abyss causes Grants immunity to the sulphurous waters Allows you to fall faster while in liquids @@ -60,7 +60,9 @@ AbyssalMirror: { Significantly reduces enemy aggression, even in the abyss Stealth generates 25% faster when standing still and 12% faster while moving Grants the ability to evade attacks, releasing a cloud of lumenyl fluid which damages and stuns nearby enemies - Evading an attack grants a lot of stealth but has a 90 second cooldown + Attacks that deal less than 5% of your max life in damage will not be evaded + The evade has a cooldown that ranges between 15 and 90 seconds depending on the evaded attack's damage + Evading an attack grants a lot of stealth This cooldown is shared with all other dodges and reflects 'Light does not reach the depths of the ocean' ''' @@ -81,7 +83,7 @@ AeroStone: { DisplayName: Aero Stone Tooltip: ''' - Provides an additional 25 flight time + Provides an additional 50 flight time You slowly recover flight time while in the air if you are not flying or gliding 'One of the ancient relics' ''' @@ -122,7 +124,9 @@ AmalgamatedBrain: { 10% increased damage Shade rains down when you are hit Grants the ability to dodge attacks - The dodge has a 90 second cooldown which is shared with all other dodges and reflects + Attacks that deal less than 5% of your max life in damage will not be dodged + The dodge has a cooldown that ranges between 15 and 90 seconds depending on the dodged attack's damage + This cooldown is shared with all other dodges and reflects Temporarily increases critical strike chance and summon damage after a dodge You will confuse nearby enemies when you are struck ''' @@ -160,7 +164,7 @@ AnechoicPlating: { DisplayName: Anechoic Plating Tooltip: ''' - Reduces creature's ability to detect you in the abyss + Makes it more difficult for abyss creatures to detect you Reduces the defense reduction that the abyss causes ''' } @@ -254,6 +258,15 @@ AsgardsValor: { ''' } +AuricSoulArtifact: { + DisplayName: Auric Soul Artifact + Tooltip: + ''' + For each Fiery Draconid you have summoned, you gain 1 minion slot + Loyalty + ''' +} + BadgeofBravery: { DisplayName: Badge of Bravery Tooltip: @@ -304,11 +317,7 @@ BloodstainedGlove: { BloodyWormScarf: { DisplayName: Bloody Worm Scarf - Tooltip: - ''' - 7% increased damage reduction - 10% increased melee damage - ''' + Tooltip: 10% increased damage reduction and melee damage } BloodyWormTooth: { @@ -357,9 +366,10 @@ ChaliceOfTheBloodGod: { Tooltip: ''' Increases max HP by 25% + +2 HP/s life regen and reduces the cooldown of healing potions by 25% Taking more than 5 damage converts the hit into a damage over time bleed debuff This bleeding does not interfere with life regeneration - Drinking a Healing Potion removes half of the remaining bleed damage + Drinking a healing potion cancels up to 50% of its heal value of remaining bleed damage Unequipping this accessory while bleeding inflicts the remaining damage instantly 'All that for a drop of blood...' ''' @@ -390,7 +400,7 @@ CorrosiveSpine: { Tooltip: ''' 5% increased movement speed - All rogue weapons inflict poison and spawn irradiated clouds on enemy hits + All rogue weapons inflict poison and spawn poisoned clouds on enemy hits You release a ton of clouds everywhere on hit ''' } @@ -516,8 +526,9 @@ DeepDiver: { DisplayName: Deep Diver Tooltip: ''' - 15% increased damage, movement speed and +15 defense while underwater - While underwater you gain the ability to dash great distances + Allows the ability to do a short ram dash + This dash can slam through enemies without taking damage and can be used quickly in succession + Provides greatly improved water mobility ''' } @@ -525,9 +536,9 @@ DeificAmulet: { DisplayName: Deific Amulet Tooltip: ''' - Causes stars to fall and grants increased immune time when damaged - +0.5 HP/s life regen - Reduces the cooldown of healing potions + Causes stars to fall and increases length of invincibility after taking damage + Grants bonus invincibility frames based on your missing health + This effect scales from 10 frames at full HP to 40 frames at 25% or less HP ''' } @@ -544,8 +555,8 @@ DimensionalSoulArtifact: { DisplayName: Dimensional Soul Artifact Tooltip: ''' - Power Multiplies all damage by 1.2x, but at the cost of increasing damage taken by 15% + Power ''' } @@ -554,9 +565,8 @@ DraedonsHeart: { Tooltip: ''' {0}% reduced contact damage from enemies - Reduces defense damage taken by {1}% [NANODESC] - With full Nanomachines, press [KEY] to heal {2} health over {3} {^3:second;seconds} + With full Nanomachines, press [KEY] to heal {1} health over {2} {^2:second;seconds} While healing, you take [DR]% less damage 'Nanomachines, son' ''' @@ -578,7 +588,7 @@ DragonScales: { Tooltip: ''' Rogue projectiles create slow fireballs as they travel - Stealth strikes create infernados on death + Stealth strikes create infernados where they hit +10% max run speed and acceleration Grants immunity to Dragonfire 'Only a living dragon holds true treasure' @@ -589,9 +599,9 @@ DynamoStemCells: { DisplayName: Dynamo Stem Cells Tooltip: ''' - 10% increased movement speed - Ranged weapons have a chance to fire mini swarmers - Grants immunity to Dragonfire and Electrified + 10% increased ranged damage and movement speed + Ranged weapons fire a powerful mini swarmer every 3 seconds + Reduces the damage of the Dragonfire and Electrified debuff ''' } @@ -606,7 +616,9 @@ EclipseMirror: { Mobile stealth generation accelerates while not attacking Stealth strikes only expend 50% of your max stealth Grants the ability to evade attacks in a blast of darksun light, which inflicts extreme damage in a wide area - Evading an attack grants full stealth but has a 90 second cooldown + Attacks that deal less than 5% of your max life in damage will not be evaded + The evade has a cooldown that ranges between 15 and 90 seconds depending on the evaded attack's damage + Evading an attack grants a lot of stealth This cooldown is shared with all other dodges and reflects 'Its reflection shows naught but darkness' ''' @@ -680,7 +692,7 @@ EtherealExtorter: { DisplayName: Ethereal Extorter Tooltip: ''' - Rogue projectiles explode into homing souls on death + Rogue projectiles explode into homing souls on hit 8% increased rogue damage and +5 maximum stealth ''' } @@ -751,8 +763,8 @@ FrostBarrier: { DisplayName: Frost Barrier Tooltip: ''' - You will freeze enemies near you when you are struck - You are immune to the chilled debuff + You will freeze nearby enemies when you are struck + Grants immunity to Chilled and Frostburn ''' } @@ -760,10 +772,10 @@ FrostFlare: { DisplayName: Frost Flare Tooltip: ''' - All attacks and projectiles inflict frostbite - Immunity to frostburn, chilled and frozen - Being above 75% life grants 10% increased damage - Being below 25% life grants 20 defense and 15% increased max movement speed and acceleration + All attacks and projectiles inflict Frostbite + Immunity to Frostburn, Chilled and Frozen + Being above 50% life grants 10% increased damage + Being below 50% life grants 20 defense and 15% increased max movement speed and acceleration Grants resistance against cold attacks ''' } @@ -811,6 +823,7 @@ GiantTortoiseShell: { DisplayName: Giant Tortoise Shell Tooltip: ''' + Grants immunity to knockback 5% increased damage reduction 10% reduced dash velocity Taking a hit will remove the dash penalty and reduce defense and damage reduction for 5 seconds @@ -841,22 +854,13 @@ GloveOfRecklessness: { ''' } -GodlySoulArtifact: { - DisplayName: Auric Soul Artifact - Tooltip: - ''' - For each Fiery Draconid you have summoned, you gain 1 minion slot - Loyalty - ''' -} - GrandGelatin: { DisplayName: Grand Gelatin Tooltip: ''' 12% increased movement speed and jump speed Using a healing potion will spawn a cleansing aura - Walking into the aura removes all debuffs and defense damage one time + Walking into the aura removes all debuffs one time The aura grants +2.5 HP/s life regen for all players inside for 8 seconds ''' } @@ -919,8 +923,8 @@ HideofAstrumDeus: { Tooltip: ''' Taking damage, or inflicting a true melee strike, drops an immense amount of astral stars from the sky - Taking damage boosts true melee damage by 50% - Boost duration is based on the amount of damage you took, the higher the damage the longer the boost + Taking damage boosts true melee damage by 30% + Boost duration scales with the amount of damage you took, up to 10 seconds Provides immunity to the astral infection, cursed inferno, on fire, and frostburn debuffs Enemies take damage when they hit you and are inflicted with the astral infection debuff ''' @@ -1049,8 +1053,8 @@ CleansingJelly: { DisplayName: Cleansing Jelly Tooltip: ''' - Using a healing potion will spawn a cleansing aura - Walking into the aura removes all debuffs and defense damage one time + Using a healing potion will spawn a cleansing aura + Walking into the aura removes all debuffs one time ''' } @@ -1091,7 +1095,7 @@ MoonstoneCrown: { ''' 15% increased rogue projectile velocity Stealth strikes summon lunar flares on enemy hits - Rogue projectiles very occasionally summon moon sigils behind them + Rogue projectiles summon homing moon sigils as they travel ''' } @@ -1273,6 +1277,7 @@ ProfanedSoulArtifact: { ''' Summons a healer guardian, which heals for 15 health every few seconds Summons a defensive guardian, which provides a weak shield reinforced by profaned rocks + [ADREN] Upon being depleted, the barrier implodes sending the profaned rocks hurtling outwards The barrier starts recharging 5 seconds after being hit Recharging from zero to full charge takes 2 seconds @@ -1281,6 +1286,7 @@ ProfanedSoulArtifact: { The offensive guardian will occasionally fire spears on hit Purity ''' + ShieldAdren: Halves Adrenaline lost on hit if the shield fully absorbs the hit } ProfanedSoulCrystal: { @@ -1310,8 +1316,19 @@ ProfanedSoulCrystal: { ''' } -Purity: { - DisplayName: Purity +QuiverofNihility: { + DisplayName: Quiver of Nihility + Tooltip: + ''' + 5% increased ranged critical strike chance + Summons a ring of four void fields to orbit you + Arrows that pass through these fields gain a 75% damage boost and double the speed + 'Filled with a substance darker than the night sky' + ''' +} + +Radiance: { + DisplayName: Radiance Tooltip: ''' +100 max life @@ -1329,17 +1346,6 @@ Purity: { ''' } -QuiverofNihility: { - DisplayName: Quiver of Nihility - Tooltip: - ''' - 5% increased ranged critical strike chance - Summons a ring of four void fields to orbit you - Arrows that pass through these fields gain a 75% damage boost and double the speed - 'Filled with a substance darker than the night sky' - ''' -} - RadiantOoze: { DisplayName: Radiant Ooze Tooltip: @@ -1362,12 +1368,13 @@ RampartofDeities: { DisplayName: Rampart of Deities Tooltip: ''' - Causes stars to fall and gives increased immune time when damaged - +0.5 HP/s life regen and reduces the cooldown of healing potions - Absorbs 15% of damage done to players on your team - This effect is only active above 25% life + Causes stars to fall and increases length of invincibility after taking damage + Grants bonus invincibility frames based on your missing health + This effect scales from 10 frames at full HP to 40 frames at 25% or less HP + Being struck for over 200 damage grants 30 additional invincibility frames Grants immunity to knockback Puts a shell around the owner when below 50% life that reduces damage taken + Absorbs 25% of damage done to players on your team when above 25% life ''' } @@ -1424,11 +1431,13 @@ RoverDrive: { Tooltip: ''' Projects an energy shield that absorbs up to 20 damage + [ADREN] The shield grants 10 defense while active After the shield is broken, it takes 10 seconds to charge back up Being hit again while recharging restarts the charge timer Can also be scrapped at an extractinator ''' + ShieldAdren: Halves Adrenaline lost on hit if the shield fully absorbs the hit } RuinMedallion: { @@ -1454,7 +1463,8 @@ SandCloak: { Tooltip: ''' 5% increased movement speed - Press [KEY] to consume 10% of your maximum stealth to create a protective dust veil which provides +6 defense and +1 HP/s life regen + Press [KEY] to consume 10% of your maximum stealth to create a protective dust veil which damages and knocks back enemies + While inside the veil, you are given +6 defense and +1 HP/s life regen This effect has a 30 second cooldown before it can be used again ''' } @@ -1627,11 +1637,12 @@ StatisNinjaBelt: { DisplayName: Statis' Ninja Belt Tooltip: ''' - 6% increased jump speed and allows constant jumping + 32% increased jump speed and allows constant jumping Grants the ability to swim Increased fall damage resistance by 35 blocks Can climb walls, dash, and dodge attacks - The dodge has a 90 second cooldown + Attacks that deal less than 5% of your max life in damage will not be dodged + The dodge has a cooldown that ranges between 15 and 90 seconds depending on the dodged attack's damage This cooldown is shared with all other dodges and reflects ''' } @@ -1640,10 +1651,11 @@ StatisVoidSash: { DisplayName: Statis' Void Sash Tooltip: ''' - 12% increased jump speed and allows constant jumping + 32% increased jump speed and allows constant jumping Grants immunity to fall damage Can climb walls, dash, and dodge attacks - The dodge has a 90 second cooldown + Attacks that deal less than 5% of your max life in damage will not be dodged + The dodge has a cooldown that ranges between 15 and 90 seconds depending on the dodged attack's damage This cooldown is shared with all other dodges and reflects Dashes leave homing scythes in your wake ''' @@ -1751,9 +1763,10 @@ TheAbsorber: { Tooltip: ''' 12% increased movement and jump speed + Grants immunity to knockback Enemies take immense damage when they touch you and are afflicted with a damaging sickness debuff that reduces damage reduction significantly Using a healing potion will spawn a cleansing aura - Walking into the aura removes all debuffs and defense damage one time + Walking into the aura removes all debuffs one time The aura grants +3 HP/s life regen, +8% damage, and +5% damage reduction for all players inside for 10 seconds 5% of the damage from enemy attacks is absorbed and converted into healing ''' @@ -1767,7 +1780,9 @@ TheAmalgam: { 15% increased damage Shade rains down when you are hit Grants the ability to dodge attacks - The dodge has a 90 second cooldown which is shared with all other dodges and reflects + Attacks that deal less than 5% of your max life in damage will not be dodged + The dodge has a cooldown that ranges between 15 and 90 seconds depending on the dodged attack's damage + This cooldown is shared with all other dodges and reflects Temporarily increases critical strike chance and summon damage after a dodge Nearby enemies receive a variety of sickness-related debuffs when you are hit ''' @@ -1821,7 +1836,9 @@ TheEvolution: { ''' You reflect projectiles when they hit you Reflected projectiles deal no damage to you - This reflect has a 90 second cooldown which is shared with all other dodges and reflects + Projectiles that deal less than 5% of your max life in damage will not be reflected + The reflect has a cooldown that ranges between 15 and 90 seconds depending on the reflected projectile's damage + This cooldown is shared with all other dodges and reflects After reflecting something, grants +1 HP/s life regen and accelerated life regen for 5 seconds If the same enemy projectile type hits you again you will resist its damage by 15% ''' @@ -1841,11 +1858,13 @@ TheSponge: { Tooltip: ''' Projects a quantum foam barrier that absorbs up to 180 damage + [ADREN] The barrier grants 30 defense and reduces damage taken by 10% while active The barrier starts recharging 9 seconds after being hit Recharging from zero to full charge takes 6 seconds Being hit again while recharging restarts the charge timer ''' + ShieldAdren: Halves Adrenaline lost on hit if the barrier fully absorbs the hit } TheTransformer: { @@ -2010,6 +2029,11 @@ AbandonedWulfrumHelmet: { ''' } +CrystalHeartVodka: { + DisplayName: Crystal Heart Vodka + Tooltip: "'Tastes like strawberry cream liqueur (and estrogen)'" +} + CocosFeather: { DisplayName: Coco's Feather Tooltip: "" diff --git a/Localization/en-US/Mods.CalamityMod.Items.Ammo.hjson b/Localization/en-US/Mods.CalamityMod.Items.Ammo.hjson index d33e0a3686..ee6be6c217 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Ammo.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Ammo.hjson @@ -1,13 +1,3 @@ -AccelerationRound: { - DisplayName: Acceleration Round - Tooltip: Gains speed over time -} - -ArcticArrow: { - DisplayName: Arctic Arrow - Tooltip: Freezes enemies for a short time -} - AstralSolution: { DisplayName: Astral Solution Tooltip: @@ -19,15 +9,21 @@ AstralSolution: { BloodfireArrow: { DisplayName: Bloodfire Arrow - Tooltip: Heals you a small amount on enemy hits + Tooltip: + ''' + High-velocity arrows with a blood soaked tip + Firing these arrows will drain your health + Accelerates your natural life regen and heals you on hit + ''' } BloodfireBullet: { DisplayName: Bloodfire Bullet Tooltip: ''' - Accelerates your life regeneration on hit - Deals bonus damage based on your current life regeneration + Passes through tiles and accelerates your natural life regen on hit + Deals bonus damage based on your current life regen and natural life regen + This damage caps at 25 ''' } @@ -44,19 +40,23 @@ BubonicRound: { DisplayName: Bubonic Round Tooltip: ''' - Bursts into virulent plague on contact - Ignores 25% of enemy defense + Spreads the plague on hit + Ignores 10% of enemy defense ''' } +CinderArrow: { + DisplayName: Cinder Arrow + Tooltip: Explosive arrows that burst into weak flaming shards that inflict Brimstone Flames +} + ElysianArrow: { DisplayName: Elysian Arrow - Tooltip: Summons meteors from the sky on death -} - -EnhancedNanoRound: { - DisplayName: Enhanced Nano Round - Tooltip: Confuses enemies and releases a cloud of nanites when enemies die + Tooltip: + ''' + Arrows carrying profaned energy + Summons purifying light from above and below on impact + ''' } FlashRound: { @@ -74,31 +74,50 @@ GodSlayerSlug: { ''' } +HallowPointRound: { + DisplayName: Hallow-Point Round + Tooltip: + ''' + Gallant light deals 6 bonus damage on hit + This effect does not occur if the bullets are converted by special guns + ''' +} + HolyFireBullet: { DisplayName: Holy Fire Bullet - Tooltip: Explosive holy bullets + Tooltip: + ''' + Explosive holy bullets + Explosions are larger right when the bullets are fired + ''' +} + +HailstormBullet: { + DisplayName: Hailstorm Bullet + Tooltip: + ''' + Bullets imbued with potent ice magic + These bullets rapidly decelerate after being fired + Critical hits cause a flash freeze, dealing additional damage + ''' } HyperiusBullet: { DisplayName: Hyperius Bullet Tooltip: ''' - Your enemies might have a bad time - Spawns additional bullets on enemy hits + Powerful multicolor bullets + Bullets split into swirling lights on impact ''' } IcicleArrow: { DisplayName: Icicle Arrow - Tooltip: Shatters into shards on impact -} - -IcyBullet: { - DisplayName: Icy Bullet Tooltip: ''' - Can hit up to three times - Breaks into ice shards on last impact + Ice arrows with an enchanted tip + These arrows quickly freeze into falling icicles that deal increased damage + Hitting enemies or tiles before being frozen causes the arrow to fly upwards ''' } @@ -121,11 +140,6 @@ MortarRound: { ''' } -NapalmArrow: { - DisplayName: Napalm Arrow - Tooltip: Explodes into fire shards -} - RubberMortarRound: { DisplayName: Rubber Mortar Round Tooltip: @@ -136,35 +150,35 @@ RubberMortarRound: { ''' } -SuperballBullet: { - DisplayName: Superball Bullet - Tooltip: Bounces at extreme speeds +SproutingArrow: { + DisplayName: Sprouting Arrow + Tooltip: + ''' + Fires an energy arrow that quickly splits into two arrows + These arrows ignore 8 points of defense + ''' } -TerraArrow: { - DisplayName: Terra Arrow - Tooltip: Travels incredibly quickly and explodes into more arrows when it hits a certain velocity -} - -TerraBullet: { - DisplayName: Terra Bullet - Tooltip: Explodes and splits into homing terra shards on death +DryadsTear: { + DisplayName: Dryad's Tear + Tooltip: Explodes and splits into homing nature shards on impact } VanquisherArrow: { DisplayName: Vanquisher Arrow Tooltip: ''' - Pierces through tiles - Spawns extra homing arrows as it travels + Powerful arrows forged with cosmic steel + Pierces through tiles and homes in on enemies ''' } -VeriumBullet: { - DisplayName: Verium Bullet +VeriumBolt: { + DisplayName: Verium Bolt Tooltip: ''' - There is no escape! - Homes in after striking an enemy + Marks enemies on hit, dealing extra damage after a short time + This damage stacks based on how many bolts hit the enemy + 'There is no escape...' ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Armor.Hardmode.hjson b/Localization/en-US/Mods.CalamityMod.Items.Armor.Hardmode.hjson index 391c40f022..675c64e604 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Armor.Hardmode.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Armor.Hardmode.hjson @@ -66,6 +66,7 @@ CirrusDress: { ''' 5% increased magic damage and critical strike chance 20% decreased movement speed and increases maximum fall speed to 61 mph + Allows for drinking 5 alcohols before your liver is poisoned [c/B00BA5:'Here, this should help you drink a lot more than usual!'] 'You feel thick...' ''' @@ -104,7 +105,9 @@ DaedalusHeadMelee: { Enemies are more likely to target you You reflect projectiles back at enemies Reflected projectiles deal 50% less damage to you - This reflect has a 90 second cooldown which is shared with all other dodges and reflects + Projectiles that deal less than 5% of your max life in damage will not be reflected + The reflect has a cooldown that ranges between 15 and 90 seconds depending on the reflected projectile's damage + This cooldown is shared with all other dodges and reflects ''' } @@ -160,7 +163,7 @@ FathomSwarmerBoots: { DisplayName: Fathom Swarmer Greaves Tooltip: ''' - 4% increased summon damage + 8% increased summon damage Grants the ability to swim Movement speed increased by 40% while submerged in liquid ''' @@ -171,8 +174,8 @@ FathomSwarmerBreastplate: { Tooltip: ''' 6% increased damage reduction - 6% increased summon damage - Increases defense by 10 and grants +2.5 HP/s life regen while submerged in liquid + Increases your max number of minions by 1 + 10% increased summon damage Reduces defense loss within the Abyss ''' } @@ -181,14 +184,15 @@ FathomSwarmerVisage: { DisplayName: Fathom Swarmer Visage Tooltip: ''' - 5% increased summon damage + Increases your max number of minions by 1 + 8% increased summon damage Provides breathing and light underwater ''' SetBonus: ''' 10% increased summon damage and +2 max minions Grants the ability to climb walls - 30% increased summon damage while submerged in liquid + 20% increased summon damage, +10 defense and +2.5 HP/s life regen while underwater Provides a moderate amount of light and moderately reduces breath loss in the abyss ''' } @@ -324,7 +328,7 @@ LunicCorpsHelmet: { SetBonus: ''' 'Finish the fight' - Projects a bubble shield that absorbs up to 50 damage + Projects a bubble shield that absorbs up to 50 damage {0} The shield starts recharging 5 seconds after being hit Recharging from zero to full charge takes 2 seconds Being hit again while recharging restarts the charge timer @@ -333,6 +337,7 @@ LunicCorpsHelmet: { These are launchers, dartguns, or anything else that doesn't shoot arrows/bullets 20% increased jump speed ''' + ShieldAdren: Halves Adrenaline lost on hit if the shield fully absorbs the hit } LunicCorpsVest: { @@ -494,10 +499,10 @@ ReaverHeadTank: { +10 defense and +1.5 HP/s life regen Enemies are more likely to target you Reduces the life regen lost from damage over time debuffs by 20% - All attacks have a small chance to steal life and speed up the rate of life regen - 20% decreased movement speed and flight time + All attacks steal life and speed up the rate of life regen + 30% decreased movement speed and flight time Enemy damage is reflected and summons a thorn spike - Reaver Rage has a 25% chance to activate when you are damaged + Reaver Rage activates when you are damaged ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Armor.PostMoonLord.hjson b/Localization/en-US/Mods.CalamityMod.Items.Armor.PostMoonLord.hjson index 6bcd067703..06272e4042 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Armor.PostMoonLord.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Armor.PostMoonLord.hjson @@ -140,7 +140,7 @@ BloodflareHeadRogue: { +120 maximum stealth Being over 80% life boosts your defense by 30 and rogue crit by 5% Being below 80% life boosts your rogue damage by 10% - Rogue critical strikes have a 50% chance to heal you + Rogue critical strikes heal you ''' } @@ -278,10 +278,10 @@ GemTechHeadgear: { GeneralGemInfo: ''' A gem is lost when you take more than {0} damage in a single hit. - The type of gem lost is the same as the class of the previous when you used + The type of gem lost is the same as the class of the most recently used weapon If said gem has already been lost, the base gem is lost instead When a gem is lost, it breaks off and homes towards the nearest enemy or boss, if one is present, dealing a base of {1} damage - Gems have a {2} second delay before they appear again" + Gems have a {2} second delay before they appear again ''' RedGemInfo: "[i:Ruby] The red gem grants {0} maximum stealth, increased rogue stats, and makes stealth only consumable by rogue weapons" YellowGemInfo: "[i:Topaz] The yellow gem provides increased melee stats and makes melee attacks release shards on hit with a cooldown. This cooldown is shorter for true melee attacks" @@ -491,7 +491,7 @@ TarragonBreastplate: { Tooltip: ''' 10% increased damage and 5% increased critical strike chance - +1 HP/s life regen and +40 max life + +1.5 HP/s life regen and +40 max life ''' CommonSetBonus: ''' @@ -505,8 +505,8 @@ TarragonHeadMagic: { DisplayName: Tarragon Mask Tooltip: ''' - 20% increased magic damage and 10% increased magic critical strike chance - 5% increased damage reduction, +100 max mana, and 15% reduced mana usage + 15% increased magic damage and 10% increased magic critical strike chance + 10% increased damage reduction, +100 max mana, and 15% reduced mana usage ''' SetBonus: ''' @@ -520,15 +520,14 @@ TarragonHeadMelee: { DisplayName: Tarragon Helm Tooltip: ''' - 10% increased melee damage - 5% increased melee critical strike chance - 5% increased damage reduction + 12% increased melee damage and critical strike chance + 10% increased damage reduction ''' SetBonus: ''' 15% increased melee speed Enemies are more likely to target you - You have a 25% chance to gain a life regen buff when you take damage + You gain a life regen buff when you take damage Press {0} to cloak yourself in life energy that heavily reduces enemy contact damage for 10 seconds This has a 30 second cooldown ''' @@ -539,7 +538,7 @@ TarragonHeadRanged: { Tooltip: ''' 10% increased ranged damage and critical strike chance - 5% increased damage reduction + 10% increased damage reduction ''' SetBonus: Ranged projectiles split into homing life energy and leaves on death } @@ -549,7 +548,7 @@ TarragonHeadRogue: { Tooltip: ''' 10% increased rogue damage and critical strike chance - 5% increased damage reduction and movement speed + 10% increased damage reduction and 5% increased movement speed ''' SetBonus: ''' @@ -562,7 +561,7 @@ TarragonHeadRogue: { TarragonHeadSummon: { DisplayName: Tarragon Horned Helm - Tooltip: 5% increased damage reduction and summon damage + Tooltip: 10% increased damage reduction and 5% increased summon damage SetBonus: ''' 50% increased summon damage and +3 max minions diff --git a/Localization/en-US/Mods.CalamityMod.Items.Armor.PreHardmode.hjson b/Localization/en-US/Mods.CalamityMod.Items.Armor.PreHardmode.hjson index 37fa7981d0..b1f4f411f9 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Armor.PreHardmode.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Armor.PreHardmode.hjson @@ -1,6 +1,6 @@ AerospecBreastplate: { DisplayName: Aerospec Breastplate - Tooltip: 3% increased critical strike chance + Tooltip: 3% increased damage and critical strike chance CommonSetBonus: ''' Taking over 25 damage in one hit will cause a spread of homing feathers to fall @@ -10,13 +10,17 @@ AerospecBreastplate: { AerospecHat: { DisplayName: Aerospec Hat - Tooltip: 8% increased magic damage and +20 max mana - SetBonus: 5% increased movement speed and magic critical strike chance + Tooltip: 10% increased magic damage and +30 max mana + SetBonus: + ''' + 8% reduced mana cost + 5% increased movement speed and magic critical strike chance + ''' } AerospecHeadgear: { DisplayName: Aerospec Headgear - Tooltip: 8% increased rogue damage and 5% increased movement speed + Tooltip: 10% increased rogue damage and 5% increased movement speed SetBonus: ''' 5% increased movement speed and rogue critical strike chance @@ -26,7 +30,7 @@ AerospecHeadgear: { AerospecHelm: { DisplayName: Aerospec Helm - Tooltip: 8% increased melee damage + Tooltip: 10% increased melee damage SetBonus: ''' 5% increased movement speed and melee critical strike chance @@ -36,7 +40,7 @@ AerospecHelm: { AerospecHelmet: { DisplayName: Aerospec Helmet - Tooltip: 5% increased movement speed and summon damage + Tooltip: 10% increased summon damage and 5% increased movement speed SetBonus: ''' 11% increased summon damage and +1 max minion @@ -46,7 +50,7 @@ AerospecHelmet: { AerospecHood: { DisplayName: Aerospec Hood - Tooltip: 8% increased ranged damage + Tooltip: 10% increased ranged damage SetBonus: 5% increased movement speed and ranged critical strike chance } @@ -136,8 +140,8 @@ StatigelHeadMagic: { DisplayName: Statigel Cap Tooltip: ''' - 10% increased magic damage and 10% reduced mana usage - 7% increased magic critical strike chance and +30 max mana + 10% increased magic damage and 10% reduced mana cost + 7% increased magic critical strike chance and +40 max mana ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Dyes.hjson b/Localization/en-US/Mods.CalamityMod.Items.Dyes.hjson index 927ac0801d..904a71bbe9 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Dyes.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Dyes.hjson @@ -113,13 +113,13 @@ WingTimeHairDye: { Tooltip: "" } -NightmareDye: { - DisplayName: Nightmare Dye +NecroplasmicDye: { + DisplayName: Necroplasmic Dye Tooltip: "" } -PolterplasmDye: { - DisplayName: Polterplasm Dye +NightmareDye: { + DisplayName: Nightmare Dye Tooltip: "" } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Fishing.hjson b/Localization/en-US/Mods.CalamityMod.Items.Fishing.hjson index 13a8b24a11..8e96193a93 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Fishing.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Fishing.hjson @@ -24,6 +24,11 @@ AstrophageItem: { Tooltip: Summons an astrophage to follow you around } +MonolithCrate: { + DisplayName: Monolith Crate + Tooltip: "{$CommonItemTooltip.RightClickToOpen}" +} + ProcyonidPrawn: { DisplayName: Procyonid Prawn Tooltip: "" @@ -110,12 +115,22 @@ Shadowfish: { Tooltip: Darkness spreads } +SlagCrate: { + DisplayName: Slag Crate + Tooltip: "{$CommonItemTooltip.RightClickToOpen}" +} + Slurpfish: { DisplayName: Slurpfish QuestDescription: Y'know, it'd be an absolute calamity if I sent you to the ancient ruins in the depths of hell to catch a fish. And I plan to do just that. Now scram! The fish isn't going to catch itself. } // Sunken Sea Catches +EutrophicCrate: { + DisplayName: Eutrophic Crate + Tooltip: "{$CommonItemTooltip.RightClickToOpen}" +} + EutrophicSandfish: { DisplayName: Eutrophic Sandfish QuestDescription: You ever get to see what would happen if a lizard that lived in the desert scurried too deep underground? I did, and they sure are cool! But it's way too slippery for me to get my hands on it now. You go and get it so I can keep it as a pet! @@ -126,6 +141,11 @@ GreenwaveLoach: { Tooltip: An endangered fish that is highly prized in the market } +PrismCrate: { + DisplayName: Prism Crate + Tooltip: "{$CommonItemTooltip.RightClickToOpen}" +} + PrismaticGuppy: { DisplayName: Prismatic Guppy Tooltip: Throwing these in an aquarium would be insanity @@ -165,11 +185,6 @@ SparklingEmpress: { ''' } -SunkenCrate: { - DisplayName: Sunken Crate - Tooltip: "{$CommonItemTooltip.RightClickToOpen}" -} - SunkenSailfish: { DisplayName: Sunken Sailfish Tooltip: Zooming at 60 miles per hour @@ -220,6 +235,11 @@ Gorecodile: { Tooltip: Press to extract blood orbs } +HydrothermalCrate: { + DisplayName: Hydrothermal Crate + Tooltip: "{$CommonItemTooltip.RightClickToOpen}" +} + Spadefish: { DisplayName: Spadefish Tooltip: diff --git a/Localization/en-US/Mods.CalamityMod.Items.Lore.hjson b/Localization/en-US/Mods.CalamityMod.Items.Lore.hjson index b08c49fe33..90e1bb38a2 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Lore.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Lore.hjson @@ -371,9 +371,9 @@ LoreHiveMind: { Lore: ''' Some semblance of a God's mind may survive death, much like the twitches of a crushed insect. - What little remains attempts to convene and coalesce in worship. A desperate attempt that it's power may yet be restored. How pitiful. + What little remains attempts to convene and coalesce in worship. A desperate attempt that its power may yet be restored. How pitiful. Fortunately for us, the futility of this effort is unmatched. The biomass obeys; even though nothing is accomplished. - Far from all divine power flows from faith. A god is forged of its own strength, followers then may choose to worship them. + 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. ''' } @@ -536,7 +536,7 @@ LoreQueenSlime: { DisplayName: Queen Slime Lore: ''' - Having fled after your battle, it seems the Slime God fashion a new guardian from the unleashed essences. + Having fled after your battle, it seems the Slime God fashioned a new guardian from the unleashed essences. Ensnared in the absorption process of its newfound power… it could not flee again. 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. diff --git a/Localization/en-US/Mods.CalamityMod.Items.Materials.hjson b/Localization/en-US/Mods.CalamityMod.Items.Materials.hjson index 81cb1f11c3..6c23f21453 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Materials.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Materials.hjson @@ -232,6 +232,11 @@ MysteriousCircuitry: { Tooltip: "" } +Necroplasm: { + DisplayName: Necroplasm + Tooltip: It churns and seethes with ghastly malice +} + NightmareFuel: { DisplayName: Nightmare Fuel Tooltip: May drain your sanity @@ -247,11 +252,6 @@ PerennialBar: { Tooltip: "" } -Polterplasm: { - DisplayName: Polterplasm - Tooltip: It churns and seethes with ghastly malice -} - PlagueCellCanister: { DisplayName: Plague Cell Canister Tooltip: "" @@ -302,8 +302,8 @@ SolarVeil: { Tooltip: Sunlight cannot penetrate the fabric of this cloth } -Stardust: { - DisplayName: Stardust +StarblightSoot: { + DisplayName: Starblight Soot Tooltip: "" } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Misc.hjson b/Localization/en-US/Mods.CalamityMod.Items.Misc.hjson index c066cdb09a..119da60e37 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Misc.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Misc.hjson @@ -107,7 +107,7 @@ Ectoheart: { DisplayName: Ectoheart Tooltip: ''' - Permanently increases Adrenaline Mode damage by 15% and damage reduction by 5% + Permanently increases Adrenaline Mode damage by 20% and damage reduction by 5% Revengeance drop ''' } @@ -126,7 +126,7 @@ ElectrolyteGelPack: { DisplayName: Electrolyte Gel Pack Tooltip: ''' - Permanently increases Adrenaline Mode damage by 15% and damage reduction by 5% + Permanently increases Adrenaline Mode damage by 20% and damage reduction by 5% Revengeance drop ''' } @@ -190,40 +190,73 @@ StarlightFuelCell: { DisplayName: Starlight Fuel Cell Tooltip: ''' - Permanently increases Adrenaline Mode damage by 15% and damage reduction by 5% + Permanently increases Adrenaline Mode damage by 20% and damage reduction by 5% Revengeance drop ''' } // Spawn Blockers +SpawnBlockersOn: Currently enabled +SpawnBlockersOff: Currently disabled + AntiCystOintment: { DisplayName: Anti-Cyst Ointment - Tooltip: Favorite this item to prevent perforator cysts from spawning near you + Tooltip: + ''' + Toggle this item to prevent hive cysts from spawning near you + Press to toggle + [STATE] + ''' } AntiTumorOintment: { DisplayName: Anti-Tumor Ointment - Tooltip: Favorite this item to prevent hive tumors from spawning near you + Tooltip: + ''' + Toggle this item to prevent hive tumors from spawning near you + Press to toggle + [STATE] + ''' } BleachBall: { DisplayName: Bleach Ball - Tooltip: Favorite this item to prevent the Aquatic Scourge from naturally spawning near you + Tooltip: + ''' + Toggle this item to prevent Aquatic Scourge from spawning + Press to toggle + [STATE] + ''' } BrokenWaterFilter: { DisplayName: Broken Water Filter - Tooltip: Favorite this item to disable natural Acid Rain spawns + Tooltip: + ''' + Toggle this item to prevent Acid Rain from occurring + Press to toggle + [STATE] + ''' } SirenproofEarMuffs: { DisplayName: Sirenproof Earmuffs - Tooltip: Favorite this item to prevent Anahita from spawning near you + Tooltip: + ''' + Toggle this item to prevent Anahita from spawning + Press to toggle + [STATE] + ''' } VoodooDemonVoodooDoll: { DisplayName: Voodoo Demon Voodoo Doll - Tooltip: Favorite this item to prevent voodoo demons from spawning near you + Tooltip: + ''' + Toggle this item to prevent voodoo demons from spawning near you + Press to toggle + [STATE] + ''' } // Uncategorized diff --git a/Localization/en-US/Mods.CalamityMod.Items.Pets.hjson b/Localization/en-US/Mods.CalamityMod.Items.Pets.hjson index 347afbbe96..ba0af93915 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Pets.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Pets.hjson @@ -2,7 +2,6 @@ AbyssShellFossil: { DisplayName: Abyss Shell Fossil Tooltip: ''' - A fossil of a prehistoric creature, long forgotten in the deep abyss Summons a pet Escargidolon Snail to follow you Slightly reduces creatures' ability to detect you in the abyss while equipped ''' @@ -86,8 +85,6 @@ HermitsBoxofOneHundredMedicines: { Tooltip: ''' Summons the Third Sage - Use the item by pressing in the hotbar to toggle the Third Sage's blessing - With the blessing, the player will spawn with full health rather than half 'As the ice melts in the springs And waves wash the old moss' hair... Thank you, Goodbye' diff --git a/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson b/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson index 894da34193..2db3dd95ea 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson @@ -289,6 +289,11 @@ EutrophicSand: { Tooltip: "" } +HardenedEutrophicSand: { + DisplayName: Hardened Eutrophic Sand + Tooltip: "" +} + AbyssTreasureChest: { DisplayName: Ancient Treasure Chest Tooltip: "" @@ -338,6 +343,11 @@ BabyGhostBellJar: { Tooltip: "" } +CirrusCouch: { + DisplayName: Cirrus Couch + Tooltip: This shouldn't exist... +} + AquaticScourgeRelic: { DisplayName: Aquatic Scourge Relic Tooltip: A glimpse into what could have been... @@ -390,7 +400,7 @@ CryogenRelic: { DesertScourgeRelic: { DisplayName: Desert Scourge Relic - Tooltip: A glimpse into what could have been... + Tooltip: "" } DevourerOfGodsRelic: { @@ -420,7 +430,7 @@ GreatSandSharkRelic: { HiveMindRelic: { DisplayName: Hive Mind Relic - Tooltip: A glimpse into what could have been... + Tooltip: "" } LeviathanAnahitaRelic: { @@ -445,7 +455,7 @@ OldDukeRelic: { PerforatorsRelic: { DisplayName: Perforators Relic - Tooltip: A glimpse into what could have been... + Tooltip: "" } PlaguebringerGoliathRelic: { @@ -631,6 +641,11 @@ AstralFountainItem: { Tooltip: "" } +BrimstoneLavaFountainItem: { + DisplayName: Brimstone Lava Fountain + Tooltip: "" +} + SulphurousFountainItem: { DisplayName: Sulphuric Water Fountain Tooltip: "" @@ -651,6 +666,51 @@ LanternCenter: { Tooltip: Lights up the night sky with celebratory lanterns } +AstralProjector: { + DisplayName: Astral Projector + Tooltip: "'Control a small portion of the Astral Infection's influence.'" +} + +BlueDistortedMonolith: { + DisplayName: Blue Distorted Monolith + Tooltip: "'Create a localized rupture in the fabric of reality.'" +} + +BossRushMonolith: { + DisplayName: Boss Rush Monolith + Tooltip: "'Bring forth the end.'" +} + +DeepSeaAnchor: { + DisplayName: Deep Sea Anchor + Tooltip: "'Dampen the air with heavy amounts of brine.'" +} + +DraconicIncense: { + DisplayName: Draconic Incense + Tooltip: "'Ignite the air with dragonfire.'" +} + +ExoObelisk: { + DisplayName: Exo Obelisk + Tooltip: "'Energize the atmosphere with exo energy.'" +} + +FrigidMonolith: { + DisplayName: Frigid Monolith + Tooltip: "'Enchant the sky with frosty auroras.'" +} + +PlagueHumidifier: { + DisplayName: Plague Humidifier + Tooltip: "'Spread light amounts of the plague through the air.'" +} + +PurpleDistortedMonolith: { + DisplayName: Purple Distorted Monolith + Tooltip: "'Create a localized rupture in the fabric of reality.'" +} + NavyPrismTorch: { DisplayName: Navy Prism Torch Tooltip: Can be placed in water @@ -1337,6 +1397,66 @@ SmoothBrimstoneSlag: { Tooltip: "" } +ActivatedAuricPanel: { + DisplayName: Activated Auric Panel + Tooltip: "" +} + +AuricAbsorber: { + DisplayName: Auric Absorber + Tooltip: "" +} + +AuricConsole: { + DisplayName: Auric Console + Tooltip: "" +} + +AuricDisplay: { + DisplayName: Auric Display + Tooltip: "" +} + +AuricPanel: { + DisplayName: Auric Panel + Tooltip: "" +} + +AuricPlatform: { + DisplayName: Auric Platform + Tooltip: "" +} + +AuricReinforcedCrate: { + DisplayName: Auric Reinforced Crate + Tooltip: "" +} + +AuricRepulserPanel: { + DisplayName: Auric Repulser Panel + Tooltip: Repels players that come in contact with it +} + +AuricScreen: { + DisplayName: Auric Screen + Tooltip: "" +} + +AuricServer: { + DisplayName: Auric Server + Tooltip: "" +} + +AuricTerminal: { + DisplayName: Auric Terminal + Tooltip: "" +} + +ExoAuricPanel: { + DisplayName: Exo-Auric Panel + Tooltip: "" +} + BotanicBathtub: { DisplayName: Botanic Bathtub Tooltip: "" @@ -2851,9 +2971,14 @@ LivingHolyFireBlock: { Tooltip: "" } -DraedonsAmbienceMusicBox: { - DisplayName: Music Box (Draedon's Ambience) - Tooltip: Plays high tech ambience by PinpinNeon +DraedonExoSelectMusicBox: { + DisplayName: Music Box (Exo Mech Selection) + Tooltip: Plays 'Signal Received' by CDMusic +} + +DraedonTalkMusicBox: { + DisplayName: Music Box (Codebreaker) + Tooltip: Plays a variant of 'Signal Received' by CDMusic } Navystone: { @@ -3351,8 +3476,8 @@ VoidstoneWall: { Tooltip: "" } -HardenedEutrophicSand: { - DisplayName: Hardened Eutrophic Sand +WulfrumPlatingWall: { + DisplayName: Wulfrum Plating Wall Tooltip: "" } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson b/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson index a0ab4391af..0c7a8a0250 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson @@ -181,6 +181,7 @@ BloodyMary: { ''' 10% increased damage and movement speed during a Blood Moon Reduces life regen by 2 HP/s and defense by 4% + Drinking more than 3 different alcohols might not end well with your liver [c/B00BA5:'Extra spicy... and bloody!'] ''' } @@ -191,6 +192,7 @@ CaribbeanRum: { ''' Increases life regen by 1 HP/s, movement speed by 10% and wing flight time by 20% Makes you floaty and reduces defense by 10% + Drinking more than 3 different alcohols might not end well with your liver [c/B00BA5:'Why is the rum gone?'] ''' } @@ -201,6 +203,7 @@ CinnamonRoll: { ''' Increases mana regeneration rate and multiplies all fire-based debuff damage by 1.5x Reduces defense by 10% + Drinking more than 3 different alcohols might not end well with your liver [c/B00BA5:'A great-tasting cinnamon whiskey with a touch of cream soda.'] ''' } @@ -211,6 +214,8 @@ Everclear: { ''' 25% increased damage Reduces life regen by 5 HP/s and defense by 30% + Counts as 2 alcohols for Alcohol Poisoning + Drinking more than 3 different alcohols might not end well with your liver [c/B00BA5:'This is the most potent booze I have, be careful with it.'] ''' } @@ -221,6 +226,7 @@ EvergreenGin: { ''' Multiplies all sickness and water-related debuff damage by 1.25x Reduces life regen by 0.5 HP/s + Drinking more than 3 different alcohols might not end well with your liver [c/B00BA5:'It tastes like a Christmas tree, if you can imagine that.'] ''' } @@ -229,8 +235,9 @@ FabsolsVodka: { DisplayName: Fabsol's Vodka Tooltip: ''' - 8% increased damage, but lowers defense by 10% + 8% increased damage, but lowers defense by 5% Increases immune time after being struck + Drinking more than 3 different alcohols might not end well with your liver This magical liquor is highly sought by those with a refined palate ''' } @@ -241,6 +248,7 @@ Fireball: { ''' Multiplies all fire-based debuff damage by 1.25x Reduces life regen by 0.5 HP/s + Drinking more than 3 different alcohols might not end well with your liver [c/B00BA5:'A great-tasting cinnamon whiskey.'] ''' } @@ -250,6 +258,7 @@ GrapeBeer: { Tooltip: ''' Reduces defense by 3% for 15 seconds + Drinking more than 3 different alcohols might not end well with your liver [c/B00BA5:'This crap is abhorrent, but you might like it.'] ''' } @@ -260,6 +269,7 @@ Margarita: { ''' Halves the duration of most harmful debuffs Reduces defense by 6% and life regen by 0.5 HP/s + Drinking more than 3 different alcohols might not end well with your liver 3 minute duration [c/B00BA5:'One of the best drinks ever created, enjoy it while it lasts.'] ''' @@ -271,6 +281,7 @@ Moonshine: { ''' Increases defense by 10 and damage reduction by 3% Reduces life regen by 0.5 HP/s + Drinking more than 3 different alcohols might not end well with your liver [c/B00BA5:'This stuff is pretty strong, but I'm sure you can handle it.'] ''' } @@ -281,6 +292,7 @@ MoscowMule: { ''' Increases damage by 9%, knockback by 50% and critical strike chance by 3% Reduces life regen by 2 HP/s + Drinking more than 3 different alcohols might not end well with your liver [c/B00BA5:'I once heard the copper mug can be toxic and I told 'em, 'listen, dummy, I'm already poisoning myself!''] ''' } @@ -290,7 +302,8 @@ OddMushroom: { Tooltip: ''' Causes you to see many fake, vibrant copies of all nearby entities - [c/C4232C:These visual effects may be nauseating or otherwise bad for some] + These effects become more potent as you consume more shrooms + [c/FF232C:These visual effects may be nauseating or otherwise bad for some] 'Trippy' ''' } @@ -301,6 +314,7 @@ OldFashioned: { ''' Multiplies all accessory and set bonus damage by 1.5x Decreases all damage by 25% + Drinking more than 3 different alcohols might not end well with your liver [c/B00BA5:'An old favorite of mine.'] ''' } @@ -310,6 +324,7 @@ RedWine: { Tooltip: ''' Reduces life regen by 0.5 HP/s for 15 seconds + Drinking more than 3 different alcohols might not end well with your liver [c/B00BA5:'Too dry for my taste.'] ''' } @@ -320,6 +335,7 @@ Rum: { ''' Increases life regen by 1 HP/s and movement speed by 10% Reduces defense by 5% + Drinking more than 3 different alcohols might not end well with your liver [c/B00BA5:'Sweet and potent, just how I like it.'] ''' } @@ -330,6 +346,7 @@ Screwdriver: { ''' Multiplies piercing projectile damage by 1.05x Reduces life regen by 0.5 HP/s + Drinking more than 3 different alcohols might not end well with your liver [c/B00BA5:'Do you have a screw loose?'] ''' } @@ -341,6 +358,7 @@ StarBeamRye: { Increases max mana by 50, magic damage by 8%, and reduces mana usage by 10% Reduces defense by 6% and life regen by 1 HP/s + Drinking more than 3 different alcohols might not end well with your liver [c/B00BA5:'Made from some stuff I found near the Astral Meteor crash site. Don't worry, it's safe, trust me...'] ''' } @@ -351,6 +369,7 @@ Tequila: { ''' Increases knockback by 10%, crit chance by 4% and defense by 5 during daytime Reduces life regen by 0.5 HP/s + Drinking more than 3 different alcohols might not end well with your liver [c/B00BA5:'Great for mixing up daytime drinks.'] ''' } @@ -361,6 +380,7 @@ TequilaSunrise: { ''' Increases knockback by 20%, crit chance by 8% and defense by 10 during daytime Reduces life regen by 1 HP/s + Drinking more than 3 different alcohols might not end well with your liver [c/B00BA5:'The greatest daytime drink I've ever had.'] ''' } @@ -371,6 +391,7 @@ Vodka: { ''' Increases damage by 6% and critical strike chance by 2% Reduces life regen by 0.5 HP/s and defense by 5% + Drinking more than 3 different alcohols might not end well with your liver [c/B00BA5:'The number one alcohol for creating great mixed drinks.'] ''' } @@ -381,6 +402,7 @@ Whiskey: { ''' Increases damage by 4%, knockback by 20% and critical strike chance by 2% Reduces defense by 5% + Drinking more than 3 different alcohols might not end well with your liver [c/B00BA5:'The burning sensation makes it tastier.'] ''' } @@ -391,6 +413,7 @@ WhiteWine: { ''' Increases magic damage by 8% Reduces defense by 6% and life regen by 0.5 HP/s + Drinking more than 3 different alcohols might not end well with your liver [c/B00BA5:'I drank a full barrel of this stuff once in one night, I couldn't remember who I was the next day.'] ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.SummonItems.hjson b/Localization/en-US/Mods.CalamityMod.Items.SummonItems.hjson index 4e26275b5b..09de1c4991 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.SummonItems.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.SummonItems.hjson @@ -131,7 +131,7 @@ ExoticPheromones: { DisplayName: Exotic Pheromones Tooltip: ''' - Summons The Dragonfolly when used in the Jungle + Summons Dragonfolly when used in the Jungle Enrages outside the Jungle Not consumable 'Pheromones used for hunting Draconic Offshoots.' diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.DraedonsArsenal.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.DraedonsArsenal.hjson index 563ebefc68..bccef2915e 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.DraedonsArsenal.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.DraedonsArsenal.hjson @@ -34,7 +34,7 @@ GaussDagger: { Tooltip: ''' Slices through foes with turbulent magnetic force - Repeated strikes envelop foes in a damaging magnetic flux + Striking foes envelops them in a damaging magnetic flux ''' } @@ -68,6 +68,7 @@ HydraulicVoltCrasher: { Tooltip: ''' An electrically charged jackhammer which shocks all nearby foes on hit + Press to use without hammering down walls [c/1FFBFF:'A device made to electrically stamp metal plates, instantly fusing them.] [c/1FFBFF:Naturally, it can also function as a devastating weapon.'] ''' @@ -145,7 +146,9 @@ PulseRifle: { DisplayName: Pulse Rifle Tooltip: ''' - Fires an enhanced pulse that arcs to a new target on enemy hits + Fires an enhanced pulse beam that dissipates into 4 high-frequency pulse orbs on hit + Pulse orbs aggressively track nearby targets and track faster the more they hit + Pulse orb pierce will not decrease when killing enemies or dealing low damage [c/1FFBFF:'My own personal weapon, used to stamp out failed creations.] [c/1FFBFF:I have backed up the schematics in the event of the original's destruction.'] ''' @@ -224,7 +227,8 @@ TrackingDisk: { Tooltip: ''' Releases a flying disk that fires lasers at nearby enemies - Stealth strikes allow the disk to fire multiple larger lasers at different targets + This disk gains acceleration as it returns to the player + Stealth strikes fire lasers at a faster rate and distance, and can fire at multiple different targets ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson index bfc4384341..900842eba5 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson @@ -27,15 +27,6 @@ AethersWhisper: { ''' } -AlphaRay: { - DisplayName: Alpha Ray - Tooltip: - ''' - Disintegrates everything with a tri-beam of energy and lasers - Press to fire a Y-shaped beam of destructive energy and a spread of lasers - ''' -} - AlulaAustralis: { DisplayName: Alula Australis Tooltip: Fires a beautiful aurora trailed by a star shower @@ -156,12 +147,15 @@ BurningSea: { Tooltip: Fires a bouncing brimstone fireball that splits into homing fireballs upon collision with water } -CarnageRay: { - DisplayName: Carnage Ray +ChronomancersScythe: { + DisplayName: Chronomancer's Scythe Tooltip: ''' - Fires a wretched, bloody ray - The farther along the ray hit enemies are, the more damage they take + Rapidly fires icicles + Press to swing the scythe around you, creating a clock pattern of homing icicles + Direct hits with the scythe have a chance to spawn clocks + Collecting the clocks increases movement speed and acceleration by 5% for each clock collected + This stacks up to 3 times and each level wears off after 5 seconds ''' } @@ -237,7 +231,11 @@ DivineRetribution: { Downpour: { DisplayName: Downpour - Tooltip: Fires a spray of water that drips extra trails of water + Tooltip: + ''' + Fires an explosive stream of sand that falls after hitting an enemy + The explosion only occurs when the projectile expires + ''' } Effervescence: { @@ -328,7 +326,7 @@ FlareBolt: { ForbiddenSun: { DisplayName: Forbidden Sun - Tooltip: Casts a fire orb that emits a gigantic explosion on death + Tooltip: Casts a fire orb that emits a gigantic explosion on hit } FrigidflashBolt: { @@ -341,9 +339,14 @@ FrostBolt: { Tooltip: Casts a slow-moving ball of frost } -Genisis: { - DisplayName: Genisis - Tooltip: Fires a Y-shaped beam of destructive energy and a spread of lasers +Genesis: { + DisplayName: Genesis + Tooltip: + ''' + Fire an array of lasers that decreases in spread for each shot + Every sixth shot fires a splitting Genesis Beam and resets the spread of the weapon + Hitting an enemy before the Genesis Beam splits deals increased damage + ''' } GhastlyVisage: { @@ -544,6 +547,17 @@ NuclearFury: { Tooltip: Casts a torrent of cosmic typhoons } +Omicron: { + DisplayName: Omicron + Tooltip: + ''' + Fires a continuous array of lasers and spawns two Wingmen which orbit you and fire lasers at your cursor + Press when firing to shoot an Omicron Beam that splits upon hitting an enemy + After firing an Omicron Beam your Wingmen will launch a pair of grenades + Hitting an enemy with an Omicron Beam right as it is fired will increase the damage done substantially and stop it from splitting + ''' +} + ParasiticSceptor: { DisplayName: Parasitic Scepter Tooltip: Fires a spread of radioactive water leeches that latch onto enemies, increasing damage over time per leech @@ -563,6 +577,15 @@ PhoenixFlameBarrage: { ''' } +Photosynthesis: { + DisplayName: Photosynthesis + Tooltip: + ''' + Casts a brilliant ray that dissolves into energy on enemy hits + More energy is created the farther along the ray the hit enemy is + ''' +} + PlagueStaff: { DisplayName: Plague Staff Tooltip: Fires a tight spread of 4 plague fangs @@ -671,9 +694,9 @@ Serpentine: { ''' } -ShadecrystalTome: { +ShadecrystalBarrage: { DisplayName: Shadecrystal Barrage - Tooltip: Summons rapid fire shadecrystals, can shoot two crystals at once + Tooltip: Summons bursts of shadecrystals that can home in on enemies } ShaderainStaff: { @@ -714,7 +737,11 @@ SlitheringEels: { SnowstormStaff: { DisplayName: Snowstorm Staff - Tooltip: Fires a snowflake that follows the mouse cursor + Tooltip: + ''' + Fires snowflakes that follows the mouse cursor + Snowflakes split into ice stars on enemy hits + ''' } SoulPiercer: { @@ -729,7 +756,7 @@ StaffofBlushie: { StarShower: { DisplayName: Star Shower - Tooltip: Casts a spread of astral stars at the mouse cursor + Tooltip: Casts a spread of astral stars from the sky that converge at the cursor } SubsumingVortex: { @@ -758,12 +785,15 @@ TearsofHeaven: { Tooltip: Casts slow-moving homing balls of heavenly light } -TerraRay: { - DisplayName: Terra Ray +Teslastaff: { + DisplayName: Teslastaff Tooltip: ''' - Casts a brilliant ray that dissolves into energy on enemy hits - More energy is created the farther along the ray the hit enemy is + Fires a channeled beam of pinpoint-accurate lightning + The beam has limited turning speed capability + Each successive hit on the same enemy increases damage per hit + The damage increases 10% per hit to a maximum of 500% damage + This damage will rapidly decrease after the enemy stops being hit ''' } @@ -880,8 +910,9 @@ Viscera: { DisplayName: Viscera Tooltip: ''' - Fires a blood beam that heals you on enemy hits - The more tiles and enemies the beam bounces off of or travels through the more healing the beam does + Fires a rapid barrage of piercing blood beams that heal you on enemy hit + Each successive beam in the barrage deals more damage + The last beam of the barrage instead explodes upon hitting an enemy ''' } @@ -903,12 +934,12 @@ VividClarity: { VoidVortex: { DisplayName: Void Vortex - Tooltip: Conjures a swirling vortex of supercharged magnet spheres around the cursor + Tooltip: Conjures a swirling vortex of supercharged magnet spheres around the cursor that explodes into a storm of homing mini spheres } VoltaicClimax: { DisplayName: Voltaic Climax - Tooltip: Conjures an octagon of supercharged magnet spheres around the cursor + Tooltip: Conjures a ring of supercharged magnet spheres around the cursor } Waywasher: { @@ -918,7 +949,12 @@ Waywasher: { Wingman: { DisplayName: Wingman - Tooltip: Fires a concentrated laser beam + Tooltip: + ''' + Spawns two Wingmen which orbit you and fire lasers at your cursor + Press while firing to order the Wingmen to launch grenades + Grenades have a cooldown which is shortened if the Wingmen are fully revved up + ''' } WintersFury: { diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson index 737cee4b94..afeab0b76b 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson @@ -12,9 +12,8 @@ AbyssBlade: { DisplayName: Abyss Blade Tooltip: ''' - Fires short-range tridents - Hitting enemies will inflict the crush depth debuff - The lower the enemies' defense, the more damage they take from this debuff + Tosses a spinning abyssal sword that slices through enemies and releases water energy upon hitting a tile + The sword will fly towards enemies after a ricochet, dealing 2x damage ''' } @@ -85,7 +84,7 @@ ArkoftheCosmos: { to snip out the scissor blades in front of you Hitting an enemy with it will parry them, granting you brief invulnerability You can parry projectiles to make them deal 160 less damage for a short period - Parrying anything will empower the next 10 swings of the sword + Parrying anything will empower the next 15 swings of the sword ''' BlastInfo: ''' @@ -106,7 +105,7 @@ ArkoftheElements: { ComboInfo: ''' to perform a 5-swing combo that ends by throwing the blade - Releasing while the blade is out will deal extra damage and give 2 charges + Releasing while the blade is out will deal extra damage ''' ParryInfo: ''' @@ -125,7 +124,7 @@ AstralBlade: { AstralPike: { DisplayName: Astral Pike - Tooltip: Summons astral star swarms on critical hits + Tooltip: Summons astral star swarms on hit } AstralScythe: { @@ -170,7 +169,7 @@ BansheeHook: { Basher: { DisplayName: Basher - Tooltip: Inflicts irradiated on enemy hits + Tooltip: Swings a rotten club that poisons and irradiates enemies on hit } BladecrestOathsword: { @@ -178,11 +177,26 @@ BladecrestOathsword: { Tooltip: Fires bursts of demonic blades that exponentially decelerate and explode } +BlightedCleaver: { + DisplayName: Blighted Cleaver + Tooltip: + ''' + Fires homing blazing blades + Gives the player the Brutal Carnage buff on enemy hits + This buff increases melee damage by 20% + ''' +} + Bonebreaker: { DisplayName: Bonebreaker Tooltip: Fires javelins that stick to enemies before bursting into shrapnel } +BotanicPiercer: { + DisplayName: Botanic Piercer + Tooltip: Fires a botanic energy beam +} + Brimlance: { DisplayName: Brimlance Tooltip: Creates brimstone explosions on enemy hits @@ -190,7 +204,7 @@ Brimlance: { Brimlash: { DisplayName: Brimlash - Tooltip: Fires a brimstone bolt that explodes into more bolts on death + Tooltip: Fires a brimstone bolt that explodes into more bolts on hit } BrimstoneSword: { @@ -225,6 +239,15 @@ BrokenBiomeBlade: { DefaultFunction: Does nothing... yet } +BurningRevelation: { + DisplayName: Burning Revelation + Tooltip: + ''' + Emits large holy explosions on hit + An exceptionally agile yoyo + ''' +} + BurntSienna: { DisplayName: Burnt Sienna Tooltip: Causes enemies to erupt into healing projectiles on death @@ -240,14 +263,9 @@ CatastropheClaymore: { Tooltip: Fires sparkles which inflict Frostbite, Hellfire, or Ichor } -TaintedBlade: { - DisplayName: Tainted Blade - Tooltip: Inflicts poison on enemy hits -} - CelestialClaymore: { DisplayName: Celestial Claymore - Tooltip: Spawns cosmic energy flames near the player that generate large explosions + Tooltip: Spawns cosmic energy stars near the cursor that inflict several debuffs } ClamCrusher: { @@ -277,8 +295,9 @@ CosmicShiv: { DisplayName: Cosmic Shiv Tooltip: ''' - Fires a cosmic beam that homes in on enemies - Upon hitting an enemy, a barrage of offscreen objects home in on the enemy as well as raining stars + Fires a cosmic star that homes in on enemies + Upon hitting an enemy, a barrage of blades will persistently strike + Landing more stars causes more blades to strike ''' } @@ -293,7 +312,7 @@ CrescentMoon: { DarklightGreatsword: { DisplayName: Darklight Greatsword - Tooltip: Fires darklight blades that split on death + Tooltip: Fires darklight blades that slice through enemies, creating additional slashes } DeathsAscension: { @@ -305,12 +324,22 @@ DeathsAscension: { ''' } +DefiledGreatsword: { + DisplayName: Defiled Greatsword + Tooltip: + ''' + Fires blazing, hyper, and sunlight blades + Gives the player the Brutal Carnage buff on enemy hits + This buff increases melee damage by 20% + ''' +} + DepthCrusher: { DisplayName: Depth Crusher Tooltip: ''' - Hitting enemies will inflict the Riptide debuff - Press to use without hammering down walls + Tosses a heavy abyssal crusher that releases water energy upon hitting a tile + The crusher will ricochet off of tiles and enemies ''' } @@ -455,7 +484,8 @@ Exoblade: { Press to release multiple energy beams that home in on enemies and slice them on hit Press to dash in the direction of the cursor with the blade Enemy hits from the blade during the dash result in massive damage and a rebound - Press immediately after a rebound to perform a powerful slash that explodes on enemy hits + Press immediately after a rebound to perform a powerful slash + Powerful slashes are larger, heal you, and create a large explosion ''' } @@ -479,7 +509,7 @@ FaultLine: { FeralthornClaymore: { DisplayName: Feralthorn Claymore - Tooltip: Summons thorns on enemy hits + Tooltip: Sprouts thorns from enemies on hit } FlarefrostBlade: { @@ -610,7 +640,7 @@ GreatswordofJudgement: { DisplayName: Greatsword of Judgement Tooltip: ''' - Fires a white orb that emits white rain on death for a time + Fires a white orb that emits white rain from where it dissipates for a time A pale white sword from a forgotten land You can hear faint yet comforting whispers emanating from the blade 'No matter where you may be you are never alone @@ -620,7 +650,7 @@ GreatswordofJudgement: { Greentide: { DisplayName: Greentide - Tooltip: Summons teeth from the sky on hit + Tooltip: Summons teeth to chomp your foes on hit } HellfireFlamberge: { @@ -660,14 +690,14 @@ IllustriousKnives: { InsidiousImpaler: { DisplayName: Insidious Impaler - Tooltip: Fires a harpoon that sticks to enemies and explodes + Tooltip: Fires infected harpoons that stick to enemies and explode } IridescentExcalibur: { DisplayName: Iridescent Excalibur Tooltip: ''' - Freezes enemies and heals the player on hit + True melee strikes freeze enemies Fires rainbow beams that change their behavior based on their color Press for true melee ''' @@ -685,7 +715,7 @@ Lacerator: { TooltipGFB: May be a viable weapon against DoG... } -LifefruitScythe: { +LifehuntScythe: { DisplayName: Lifehunt Scythe Tooltip: Heals you on hit and shoots an energy scythe } @@ -704,7 +734,6 @@ Lucrecia: { DisplayName: Lucrecia Tooltip: ''' - Striking an enemy makes you immune for a short time Fires a DNA chain Finesse ''' @@ -782,8 +811,8 @@ NeptunesBounty: { DisplayName: Neptune's Bounty Tooltip: ''' - Fires a trident that rains additional tridents as it travels - Hitting enemies will inflict the crush depth debuff + Tosses a spinning abyssal sword which constantly sprays water energy + Once the blade begins falling, it will redirect itself towards enemies with increased velocity and 2x damage ''' } @@ -831,22 +860,11 @@ Omniblade: { Tooltip: An ancient blade forged by the legendary Omnir } -Oracle: { - DisplayName: The Oracle - Tooltip: - ''' - Emits an aura of red lightning which charges up when hitting enemies - Fires auric orbs when supercharged - An exceptionally agile yoyo - 'Gaze into the past, the present, the future... and the circumstances of your inevitable demise' - ''' -} - Orderbringer: { DisplayName: Orderbringer Tooltip: ''' - Fires a rainbow blade that emits rainbow rain on death for a time + Fires a rainbow blade that emits rainbow rain from where it dissipated for a time A pale white sword from a forgotten land You can hear faint yet comforting whispers emanating from the blade 'No matter where you may be you are never alone @@ -884,6 +902,7 @@ PhotonRipper: { ''' Projects a directed stream of hardlight teeth at ultra high velocity This weapon and its projectiles function as a chainsaw + Press to use without chopping down trees ''' } @@ -987,7 +1006,7 @@ SausageMaker: { ScourgeoftheCosmos: { DisplayName: Scourge of the Cosmos - Tooltip: Throws a bouncing cosmic scourge that emits tiny homing cosmic scourges on death and tile hits + Tooltip: Throws a bouncing cosmic scourge that emits tiny homing cosmic scourges on enemy and tile hits } SeashineSword: { @@ -1018,15 +1037,6 @@ SmokingComet: { Tooltip: Rains stars from the sky } -SolarFlare: { - DisplayName: Solar Flare - Tooltip: - ''' - Emits large holy explosions on hit - An exceptionally agile yoyo - ''' -} - SolsticeClaymore: { DisplayName: Solstice Claymore Tooltip: @@ -1036,11 +1046,6 @@ SolsticeClaymore: { ''' } -SoulEdge: { - DisplayName: Soul Edge - Tooltip: Fires the ghastly souls of long-deceased abyss dwellers -} - SoulHarvester: { DisplayName: Soul Harvester Tooltip: @@ -1084,7 +1089,7 @@ StormRuler: { DisplayName: Storm Ruler Tooltip: ''' - Fires beams that generate tornadoes on death + Fires beams that generate tornadoes where they strike Tornadoes suck enemies in 'Only a storm can fell a greatwood' ''' @@ -1144,6 +1149,11 @@ Swordsplosion: { ''' } +TaintedBlade: { + DisplayName: Tainted Blade + Tooltip: Inflicts poison on enemy hits +} + TeardropCleaver: { DisplayName: Teardrop Cleaver Tooltip: Makes your enemies cry @@ -1159,17 +1169,13 @@ TenebreusTides: { ''' } -TerraLance: { - DisplayName: Terra Lance - Tooltip: Fires a terra energy beam -} - Terratomere: { DisplayName: Terratomere Tooltip: ''' Heals the player on true melee hits - Fires a piercing energy bolt that causes hit targets to explode and be slashed + Fires several piercing energy bolts that rapidly seek targets + On hit, explodes and repeatedly slashes the target 'Linked to the essence of Terraria' ''' } @@ -1192,6 +1198,20 @@ TheBurningSky: { ''' } +TheDarkMaster: { + DisplayName: The Dark Master + Tooltip: + ''' + Fires red echo slash projectiles at full health + Projectile damage increases for every point of HP above 400 + Press to spawn three shadow clones in a Delta formation + The clones will mirror your sword swings and release projectiles + The clones will always fire projectiles regardless of your own HP + The clones may only exist while holding this weapon + 'The blade by which the shadows levy their foes with a terrible fate' + ''' +} + TheEnforcer: { DisplayName: The Enforcer Tooltip: Spawns essence flames on hit @@ -1232,11 +1252,24 @@ TheMutilator: { TheObliterator: { DisplayName: The Obliterator - Tooltip: + Tooltip: "[GFB]" + TooltipNormal: ''' Ruins nearby enemies with death lasers An exceptionally agile yoyo ''' + TooltipGFB: just a slight bit of dust spam on this weapon im afraid +} + +TheOracle: { + DisplayName: The Oracle + Tooltip: + ''' + Emits an aura of red lightning which charges up when hitting enemies + Fires auric orbs when supercharged + An exceptionally agile yoyo + 'Gaze into the past, the present, the future... and the circumstances of your inevitable demise' + ''' } TitanArm: { @@ -1293,17 +1326,7 @@ TrueCausticEdge: { Tooltip: ''' Fires a bouncing caustic beam - Inflicts venom on enemy hits - ''' -} - -DefiledGreatsword: { - DisplayName: Defiled Greatsword - Tooltip: - ''' - Fires blazing, hyper, and sunlight blades - Gives the player the Brutal Carnage buff on enemy hits - This buff increases melee damage by 25% and melee crit chance by 10% + Inflicts acid venom and slows down on enemy hits ''' } @@ -1321,16 +1344,6 @@ TyphonsGreed: { ''' } -BlightedCleaver: { - DisplayName: Blighted Cleaver - Tooltip: - ''' - Fires homing blazing blades - Gives the player the Brutal Carnage buff on enemy hits - This buff increases melee damage by 25% and melee crit chance by 10% - ''' -} - UltimusCleaver: { DisplayName: Ultimus Cleaver Tooltip: Launches damaging homing sparks and explodes on enemy hits @@ -1361,6 +1374,15 @@ Virulence: { Tooltip: Fires a plague cloud } +VoidEdge: { + DisplayName: Void Edge + Tooltip: + ''' + Fires the ghastly souls of long-deceased abyss dwellers + Striking with the blade summons additional souls from below + ''' +} + VulcaniteLance: { DisplayName: Vulcanite Lance Tooltip: Explodes on enemy hits and summons homing flares on critical hits diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson index c2974b3d1c..5b6a9163a6 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson @@ -29,18 +29,25 @@ AngelicShotgun: { Tooltip: ''' Each shot casts a radiant beam of holy light from the sky - Converts musket balls into illuminated bullets + Converts musket balls into hallow-point rounds 'Fighting 'til the war's won' ''' } Animosity: { DisplayName: Animosity - Tooltip: + GFBName: Shotgun Full of Hate + Tooltip: "[GFB]" + TooltipNormal: ''' - Fires a powerful sniper round - Press to fire a burst of bullets - 50% chance to save ammo + Fires a shotgun blast with a tight spread which is imbued with Brimstone Flames + Press Right Click to fire a powerful brimstone round that inflicts Whispering Death + ''' + TooltipGFB: + ''' + [c/9c0b0b:Fires a shotgun blast full of hatred... among other things] + [c/ac14ba:Press Right Click to use a hexing rifle round instead] + [c/454545:By Cthulhu Eye, Yharon tooth...] ''' } @@ -73,6 +80,15 @@ Archerfish: { Tooltip: Converts musket balls into streams of water } +Arietes41: { + DisplayName: Arietes 41 + Tooltip: + ''' + Alternates between firing bullets imbued with lifesteal and electricity + Electric imbued bullets create a small shockblast on impact, dealing additional damage to the enemy they hit + ''' +} + ArterialAssault: { DisplayName: Arterial Assault Tooltip: @@ -87,7 +103,7 @@ AstralBlaster: { Tooltip: Converts musket balls into homing astral rounds } -AstralRepeater: { +AstralBow: { DisplayName: Astral Bow Tooltip: Fires a burst of three arrows } @@ -135,9 +151,11 @@ BarracudaGun: { Tooltip: Fires two barracudas that latch onto enemies and shred them } -BladedgeGreatbow: { +BladedgeRailbow: { DisplayName: Bladedge Railbow - Tooltip: Fires a spread of 4 arrows and 2 leaves at once + Tooltip: "[GFB]" + TooltipNormal: Fires a spread of 4 arrows and 2 leaves at once + TooltipGFB: Fires a spread of 4 arrows... along with other various things } BlightSpewer: { @@ -313,15 +331,6 @@ CorrodedCaustibow: { Tooltip: Converts wooden arrows into slow, powerful shells that trail an irradiated aura } -CosmicBolter: { - DisplayName: Cosmic Bolter - Tooltip: - ''' - Fires a tight column of three arrows - Converts wooden arrows into sliding energy bolts - ''' -} - CrackshotColt: { DisplayName: Crackshot Colt Tooltip: @@ -329,15 +338,10 @@ CrackshotColt: { Press to toss a Copper Coin in the air Striking a coin with a bullet causes it to ricochet into the nearest enemy Up to 4 coins can be tossed simultaneously, and shots will ricochet off multiple coins if possible - Ricocheted bullets always critically strike + Coins guarantee a critical strike after a short delay ''' } -CursedCapper: { - DisplayName: Cursed Capper - Tooltip: Fires cursed bullets -} - DaemonsFlame: { DisplayName: Daemon's Flame Tooltip: @@ -373,6 +377,7 @@ Deathwind: { ''' Fires a spread of 4 arrows Wooden arrows are converted into nebula arrows + Nebula arrows deal more damage and inflict god slayer inferno ''' } @@ -380,7 +385,7 @@ DeepcoreGK2: { DisplayName: Deepcore GK2 Tooltip: ''' - Bullets are twice as large and ignores 15 points of enemy defense + Bullets are twice as large and ignore 10 points of enemy defense 'For rock and stone!' ''' } @@ -449,7 +454,7 @@ ElementalEruption: { EternalBlizzard: { DisplayName: Eternal Blizzard - Tooltip: Fires an additional icicle arrow that shatters on impact + Tooltip: Fires an additional icicle arrow that freezes into a falling icicle } Eviscerator: { @@ -470,7 +475,7 @@ FirestormCannon: { DisplayName: Firestorm Cannon Tooltip: ''' - Releases an constant stream of weaponized flares + Releases a constant stream of weaponized flares Press to fire a condensed spread of flares 70% chance to save ammo ''' @@ -478,16 +483,22 @@ FirestormCannon: { FlakKraken: { DisplayName: Flak Kraken - Tooltip: Fires an energy reticle that becomes more powerful over time + Tooltip: + ''' + Fires pairs of abyssal flak shells that explode into wide cones of ink shrapnel + Abyssal flak shells burst when they reach the cursor's position + Direct hits with the flak shell will deal reduced shrapnel damage + ''' } FlakToxicannon: { DisplayName: Flak Toxicannon Tooltip: ''' - Fires angled shots in the direction of the cursor - Can only be shot in a wide cone above the player - 'High IQ required' + Fires a toxic shell that explodes into a cone of radioactive sludge + Toxic shells burst when they reach the cursor's position + Direct hits with the toxic shell will reduce the damage dealt by the sludge + Uses rockets for ammo ''' } @@ -530,7 +541,7 @@ FrostbiteBlaster: { Fungicide: { DisplayName: Fungicide - Tooltip: Converts musket balls into fungal rounds that split on death + Tooltip: Converts musket balls into fungal rounds that split upon impact } Galeforce: { @@ -622,7 +633,7 @@ HoarfrostBow: { Tooltip: ''' Fires two arrows at once - Converts wooden arrows into mist arrows + Converts wooden arrows into mist arrows that spread frost mist on collision ''' } @@ -677,6 +688,16 @@ ArcNovaDiffuser: { ''' } +MagnaCannon: { + DisplayName: Magna Cannon + Tooltip: + ''' + Charges up a rapid fire burst of crystal bolts + Charging for longer increases the number of bolts fired + Fully charged shots fire an even longer and more rapid burst + ''' +} + MagnomalyCannon: { DisplayName: Magnomaly Cannon Tooltip: @@ -692,7 +713,7 @@ Malevolence: { Tooltip: ''' Fires two arrows at once - Converts wooden arrows into plague arrows that explode into bees on death + Converts wooden arrows into plague arrows that explode into bees ''' } @@ -731,7 +752,7 @@ MidasPrime: { Press to toss a Gold Coin or Silver Coin in the air Striking a coin with a bullet causes it to ricochet into the nearest enemy Up to 4 coins can be tossed simultaneously, and shots will ricochet off multiple coins if possible - Ricocheted bullets always critically strike and do bonus damage based on the coins used + Coins guarantee a critical strike after a short delay and bullets do bonus damage based on coins used ''' UltrakillEasterEgg: ''' @@ -743,7 +764,11 @@ MidasPrime: { MineralMortar: { DisplayName: Mineral Mortar - Tooltip: Shoots an onyx bomb that explodes into huge area damage + Tooltip: + ''' + Shoots an onyx bomb that explodes into huge area damage + Uses rockets for ammo + ''' } Kingsbane: { @@ -790,12 +815,22 @@ NettlevineGreatbow: { ''' } -Norfleet: { - DisplayName: Norfleet - Tooltip: Fire everything! +NitroExpressRifle: { + DisplayName: Nitro Express Rifle + Tooltip: "[c/88354B:'The recoil feels strong enough to break your shoulder...']" } -NullificationRifle: { +Norfleet: { + DisplayName: Norfleet + Tooltip: + ''' + Fires a cluster of erratic energy spheres that each contain a different element + Every three shots the weapon must recharge its energy to reload + [c/FF9900:'Blows up everything!'] + ''' +} + +NullificationPistol: { DisplayName: Nullification Pistol Tooltip: ''' @@ -836,7 +871,7 @@ OverloadedBlaster: { Tooltip: ''' Converts gel into a spread of energized slime pearls that overload when they come to a stop - Overloaded slime pearls deal 175% damage but no longer pierce + Overloaded slime pearls deal 60% more damage but no longer pierce Slime pearls bounce off of walls at very high speed Uses gel for ammo 25% chance to save ammo @@ -848,7 +883,7 @@ P90: { Tooltip: ''' Unleashes a stream of armor-piercing rounds at an incredible rate - Armor-piercing rounds ignore 15 defense + Armor-piercing rounds ignore 30 defense 75% chance to save ammo 'It's a bullet hose' ''' @@ -858,15 +893,14 @@ PearlGod: { DisplayName: Pearl God Tooltip: ''' - Fires shockblast rounds that emit massive explosions and steal enemy life as well as additional bullets - Every seventh shot fires a massive shockblast - 'Your life is mine...' + Alternates between firing a bullet imbued with lifesteal and 3 bullets imbued with pearlescence + Pearlescent imbued bullets create a radiant flash on impact, dealing additional damage to the enemy they hit ''' } PestilentDefiler: { DisplayName: Pestilent Defiler - Tooltip: Converts musket balls into plague rounds that explode and split apart on death + Tooltip: Converts musket balls into plague rounds that explode and split apart on hit } Phangasm: { @@ -911,12 +945,20 @@ PlanetaryAnnihilation: { PolarisParrotfish: { DisplayName: Polaris Parrotfish - Tooltip: + Tooltip: "[GFB]" + TooltipNormal: ''' - Projectile hits grant buffs to the weapon - Buffs are removed on hit + Rapidly fires an array of colorful star shots that bounce off tiles + However, only two shots can exist at once 'It carries the mark of the Northern Star' ''' + TooltipGFB: + ''' + Rapidly fires an array of colorful star shots that bounce off tiles + However, only two shots can exist at once + Right click to give the little girl some attention + 'She is a happy girl' + ''' } PridefulHuntersPlanarRipper: { @@ -1000,9 +1042,10 @@ Scorpio: { DisplayName: Scorpio Tooltip: ''' - Press to fire a nuke - Rockets will destroy tiles with tile-destroying ammo - 'BOOM' + Hold to fire a barrage of homing nano missiles and charge energy + Maximum charge is reached after firing 3 barrages + while holding at max charge to launch a nano nuke + Nano nukes deal massive damage and reset the cooldown of missile barrages ''' } @@ -1078,7 +1121,7 @@ Shroomer: { SlagMagnum: { DisplayName: Slag Magnum - Tooltip: Converts musket balls into fossil shards that split into additional shards on death + Tooltip: Converts musket balls into fossil shards that split into additional shards on impact } SomaPrime: { @@ -1209,16 +1252,6 @@ TelluricGlare: { Tooltip: Fires volleys of four colossal radiant arrows which can pass through walls } -TerraFlameburster: { - DisplayName: Terra Flameburster - Tooltip: - ''' - Charges up to emit a stream of energized flames and pairs of homing terra flares - Uses gel for ammo - 50% chance to save ammo - ''' -} - TheBallista: { DisplayName: The Ballista Tooltip: Converts wooden arrows into greatarrows that crush enemy armor and break into shards @@ -1228,8 +1261,9 @@ TheHive: { DisplayName: The Hive Tooltip: ''' - Launches a variety of rockets that explode into friendly bees - Rockets will destroy tiles with tile-destroying ammo + Launches a wide spread of 4 missiles that explode on contact with enemies and tiles + Charging the launcher decreases the spread and increases the velocity of the missile barrage + Fully charging the launcher will cause it to fire a nuke to decimate a massive area on impact ''' } @@ -1248,6 +1282,15 @@ ThePack: { Tooltip: Fires large homing rockets that explode into more homing mini rockets when in proximity to an enemy } +ThermoclineBlaster: { + DisplayName: Thermocline Blaster + Tooltip: + ''' + Alternates between firing bullets imbued with fire and ice + Any bullet type can be imbued when fired from this gun + ''' +} + TheSevensStriker: { DisplayName: The Sevens Striker Tooltip: @@ -1318,6 +1361,15 @@ UniversalGenesis: { ''' } +VernalBolter: { + DisplayName: Vernal Bolter + Tooltip: + ''' + Fires a tight column of three arrows + Converts wooden arrows into sliding energy bolts + ''' +} + Voidragon: { DisplayName: Voidragon Tooltip: @@ -1333,6 +1385,16 @@ Vortexpopper: { Tooltip: Fires bubbles everywhere that pop into bullets } +WildfireBloom: { + DisplayName: Wildfire Bloom + Tooltip: + ''' + Charges up to emit a stream of energized flames and pairs of homing wildfire flares + Uses gel for ammo + 50% chance to save ammo + ''' +} + WulfrumBlunderbuss: { DisplayName: Wulfrum Blunderbuss Tooltip: @@ -1344,13 +1406,3 @@ WulfrumBlunderbuss: { [c/83B87E:In fact, it is quite common for a robot to be turned into ammo right after it stops functioning.'] ''' } - -MagnaCannon: { - DisplayName: Magna Cannon - Tooltip: - ''' - Charges up a rapid fire burst of crystal bolts - Charging for longer increases the number of bolts fired - Fully charged shots fire an even longer and more rapid burst - ''' -} diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson index 7eb9c7fea1..d92ae3dc73 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson @@ -9,7 +9,7 @@ AcidicRainBarrel: { AdamantiteThrowingAxe: { DisplayName: Adamantite Throwing Axe - Tooltip: Stealth strikes summon lightning bolts on enemy hits + Tooltip: Stealth strikes ignore gravity and rain down lightning on enemy hits } AlphaVirus: { @@ -54,8 +54,8 @@ BallisticPoisonBomb: { DisplayName: Ballistic Poison Bomb Tooltip: ''' - Throws a sticky bomb that explodes into spikes and poison clouds - Stealth strikes throw three at once + Throws a sticky bomb that explodes into spikes and venomous clouds + Stealth strikes erupt into more clouds with a longer lasting venom ''' } @@ -204,7 +204,7 @@ CosmicKunai: { Tooltip: ''' Fires a rapid stream of short-range kunai - Stealth strikes spawn 5 Cosmic Scythes which home and explode + Stealth strikes make kunai pierce foes, travel farther, and spawn 5 homing scythes ''' } @@ -391,9 +391,8 @@ Exorcism: { DisplayName: Exorcism Tooltip: ''' - Throws a hallowed cross which explodes into a flash of light that damages nearby enemies, closer enemies receiving more damage - As the cross travels downwards, the damage inflicted by both the cross and flash increases constantly - Stealth strikes cause the cross to be thrown with full damage immediately. Hallowed stars fall when the cross explodes + Throws a hallowed cross which explodes into a flash of light that damages nearby enemies + Stealth strikes create larger flashes and rain stars infused with holy light ''' } @@ -416,18 +415,6 @@ FeatherKnife: { ''' } -FinalDawn: { - DisplayName: The Final Dawn - Tooltip: - ''' - Attack enemies with a giant scythe swing to replenish stealth - Press up and attack to throw the scythe - Stealth strikes perform a horizontal swing that leaves a lingering fire aura - Stealth strikes performed while pressing up fling yourself at the enemy and slice through them, causing homing fireballs to emerge - 'We shall ride into the sunrise once more' - ''' -} - FishboneBoomerang: { DisplayName: Fishbone Boomerang Tooltip: @@ -490,7 +477,7 @@ GildedDagger: { Tooltip: ''' Throws a shiny blade that ricochets towards another enemy on hit - Stealth strikes cause the blade to home in after ricocheting, with each ricochet dealing 20% more damage + Stealth strikes cause the blade to home in after ricocheting, with each ricochet dealing 5% more damage Stealth strikes also have increased piercing ''' } @@ -509,7 +496,7 @@ GleamingDagger: { Tooltip: ''' Throws a shiny blade that ricochets towards another enemy on hit - Stealth strikes cause the blade to home in after ricocheting, with each ricochet dealing 20% more damage + Stealth strikes cause the blade to home in after ricocheting, with each ricochet dealing 5% more damage Stealth strikes also have increased piercing ''' } @@ -542,8 +529,7 @@ HardenedHoneycomb: { Tooltip: ''' Fires a honeycomb that shatters into fragments - Grants the honey buff to players it touches - Stealth strikes can bounce off walls and enemies + Stealth strikes grant the honey buff on hit and spawn bees ''' } @@ -552,8 +538,8 @@ HeavenfallenStardisk: { Tooltip: ''' Throws a stardisk upwards which then launches itself towards your mouse cursor - Explodes into 5 astral energy bolts if the thrower is moving vertically when throwing it - Stealth strikes rain astral energy bolts from the sky + Explodes into a star of astral bolts on hit + Stealth strikes throw three disks that rain astral energy bolts from the sky ''' } @@ -632,7 +618,8 @@ JawsOfOblivion: { DisplayName: Jaws of Oblivion Tooltip: ''' - Throws a tight spread of six venomous reaper fangs that stick in enemies + Throws a tight spread of six venomous reaper teeth that stick in enemies + This venom can stack when more teeth are stuck in an enemy Stealth strikes cause the teeth to emit a crushing shockwave on impact 'You're gonna need a bigger boat' ''' @@ -679,8 +666,9 @@ LeviathanTeeth: { DisplayName: Leviathan Teeth Tooltip: ''' - Rapidly throws a variety of poisonous fangs that stick to enemies - Stealth strikes cause 6 very fast teeth to be thrown, ignoring gravity and inflicting extreme knockback + Rapidly throws a spread of venomous teeth that stick to enemies + This venom can stack when more teeth are stuck in an enemy + Stealth strikes cause 6 very fast teeth to be thrown, ignoring gravity and spawning water blasts on hit ''' } @@ -688,8 +676,9 @@ Lionfish: { DisplayName: Lionfish Tooltip: ''' - Sticks to enemies and injects a potent toxin - Stealth strikes are trailed by homing urchin spikes + Sticks to enemies and injects a potent venom + This venom can stack when more lionfish are stuck in an enemy + Stealth strikes spawn homing urchin spikes as they travel ''' } @@ -847,18 +836,7 @@ PhantasmalRuin: { Tooltip: ''' Fires a large ghost lance that explodes into spirits on enemy hits - Stealth strikes pierce and summon many spirits from the depths on enemy hits - ''' -} - -PhantomLance: { - DisplayName: Phantom Lance - Tooltip: - ''' - Fires a spectral javelin that rapidly releases lost souls - Fades away and slows down over time - Lost souls released later deal less damage - Stealth strikes don't slow down and souls always deal full damage + Stealth strikes pierce twice and summon many spirits from the depths on the first hit ''' } @@ -894,7 +872,7 @@ ProfanedPartisan: { DisplayName: Profaned Partisan Tooltip: ''' - Fires an unholy spear that explodes on death + Fires an unholy spear that explodes on enemy hits Stealth strikes spawn smaller spears to fly along side it ''' } @@ -943,6 +921,15 @@ Sacrifice: { ''' } +SamsaraSlicer: { + DisplayName: Samsara Slicer + Tooltip: + ''' + Throws a disk that has a chance to generate several disks if enemies are near it + Stealth strikes travel slower and are rapidly orbited by the smaller disks + ''' +} + SandDollar: { DisplayName: Sand Dollar Tooltip: @@ -986,18 +973,25 @@ ScourgeoftheSeas: { DisplayName: Scourge of the Seas Tooltip: ''' - Snaps apart into a venomous cloud upon striking an enemy - Stealth strikes are coated with vile toxins, afflicting enemies with a powerful debuff + Snaps apart into irradiated clouds upon striking an enemy + Stealth strikes irradiate for longer and are additionally coated with venomous toxins ''' } SeafoamBomb: { DisplayName: Seafoam Bomb - Tooltip: + Tooltip: "[GFB]" + TooltipNormal: ''' Throws a bomb that explodes into a bubble which deals extra damage to enemies Stealth strikes are faster and explode into 5 bubbles ''' + TooltipGFB: + ''' + Throws a bomb that explodes into a bubble which deals extra damage to enemies + Stealth strikes are faster and explode into 5 bubbles + [c/256b93:'Right back in S tier!'] + ''' } SealedSingularity: { @@ -1183,7 +1177,7 @@ SubductionSlicer: { Tooltip: ''' Throws a scythe that explodes on enemy hits - Stealth strikes also summon an orange pillar of fire on enemy hits + Stealth strikes also summon a pillar of fire on enemy hits ''' } @@ -1191,9 +1185,10 @@ Supernova: { DisplayName: Supernova Tooltip: ''' - Creates a massive explosion on impact - Explodes into spikes and homing energy - Stealth strikes release energy as they fly + Tosses a smart bomb that locks onto and tracks targets + If no target is found it will return to you + Each bomb creates a miniature supernova that drags in weak enemies and chases strong enemies + Stealth strikes create a blast that shakes the foundations of reality itself ''' } @@ -1206,15 +1201,6 @@ TarragonThrowingDart: { ''' } -TerraDisk: { - DisplayName: Terra Disk - Tooltip: - ''' - Throws a disk that has a chance to generate several disks if enemies are near it - Stealth strikes travel slower and are rapidly orbited by the smaller disks - ''' -} - TerrorTalons: { DisplayName: Terror Talons Tooltip: @@ -1233,6 +1219,18 @@ TheAtomSplitter: { ''' } +TheFinalDawn: { + DisplayName: The Final Dawn + Tooltip: + ''' + Attack enemies with a giant scythe swing to replenish stealth + Press up and attack to throw the scythe + Stealth strikes perform a horizontal swing that leaves a lingering fire aura + Stealth strikes performed while pressing up fling yourself at the enemy and slice through them, causing homing fireballs to emerge + 'We shall ride into the sunrise once more' + ''' +} + TheOldReaper: { DisplayName: The Old Reaper Tooltip: diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson index 46b8ff3740..0b7073c368 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson @@ -73,11 +73,6 @@ BlackHawkRemote: { ''' } -BloodClotStaff: { - DisplayName: Blood Clot Staff - Tooltip: Summons a blood clot to fight for you -} - BorealisBomber: { DisplayName: Borealis Bomber Tooltip: @@ -186,7 +181,6 @@ CosmicImmaterializer: { Summons a cosmic energy spiral to fight for you The orb will fire swarms of homing energy bolts when enemies are detected by it Requires 10 minion slots to use and there can only be one energy spiral - Without a summoner armor set bonus this minion will deal less damage ''' } @@ -561,7 +555,7 @@ RustyBeaconPrototype: { Tooltip: ''' Summons a long-abandoned drone to support you - The drone hovers in place and releases toxic waves that inflict irradiated and poisoned + The drone hovers in place and releases toxic waves that irradiate hit enemies ''' } @@ -819,3 +813,24 @@ MutatedTruffle: { There can only be one minion ''' } + +HarvestStaff: { + DisplayName: Harvest Staff + Tooltip: + ''' + Grows a pumpkin patch that sprouts pumpkins nearby + Pumpkins will hop out when approached by nearby creatures or players + Once out, they will aggressively tackle enemies, exploding on hit + 'No thoughts behind those eyes' + ''' +} + +LiliesOfFinality: { + DisplayName: Lilies of Finality + Tooltip: + ''' + Requires 2 minion slots to use + Can only be summoned once + 'Wake up' + ''' +} diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Typeless.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Typeless.hjson index 613f300021..b9a504451c 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Typeless.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Typeless.hjson @@ -17,11 +17,6 @@ EyeofMagnus: { ''' } -GoldenGun: { - DisplayName: Golden Gun - Tooltip: Shoots a straight line of pure ichor -} - LunicEye: { DisplayName: Lunic Eye Tooltip: diff --git a/Localization/en-US/Mods.CalamityMod.Misc.hjson b/Localization/en-US/Mods.CalamityMod.Misc.hjson index e67ca338e8..9a650f9ea6 100644 --- a/Localization/en-US/Mods.CalamityMod.Misc.hjson +++ b/Localization/en-US/Mods.CalamityMod.Misc.hjson @@ -22,6 +22,11 @@ RecipeGroup: { 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 @@ -47,8 +52,6 @@ SevensBust: Bust! SevensDoubles: Doubles! SevensTriples: Triples! StylishHammerHit: Stylish! -ThirdSageBlessingText: You have been blessed by the Third Sage! -ThirdSageBlessingText2: The Third Sage has rescinded its blessing... GenericConsumedText: "[c/8A8A8A:You have already consumed this item]" BloodOrangeText: You have already consumed a Blood Orange. Eating any more would make your blood too thick to flow. MiracleFruitText: You have already consumed a Miracle Fruit. It would take a miracle to put you back together if you ate another. diff --git a/Localization/en-US/Mods.CalamityMod.NPCs.hjson b/Localization/en-US/Mods.CalamityMod.NPCs.hjson index 50fe92f84d..1d7421b644 100644 --- a/Localization/en-US/Mods.CalamityMod.NPCs.hjson +++ b/Localization/en-US/Mods.CalamityMod.NPCs.hjson @@ -18,6 +18,7 @@ MirageJelly.DisplayName: Mirage Jelly MorayEel.DisplayName: Moray Eel OarfishHead.DisplayName: Oarfish ReaperShark.DisplayName: Reaper Shark +SlabCrab.DisplayName: Slab Crab ToxicMinnow.DisplayName: Toxic Minnow Viperfish.DisplayName: Viperfish AcidEel.DisplayName: Acid Eel @@ -81,6 +82,7 @@ Pyrogen: Pyrogen CryogenShield.DisplayName: Cryogen's Shield PyrogenShield: Pyrogen's Shield DesertNuisanceHead.DisplayName: Desert Nuisance +DesertNuisanceHeadYoung.DisplayName: Desert Nuisance DesertScourgeHead.DisplayName: Desert Scourge CosmicGuardianHead.DisplayName: Cosmic Guardian DevourerofGodsHead.DisplayName: The Devourer of Gods @@ -145,6 +147,7 @@ AeroSlime.DisplayName: Aero Slime ArmoredDiggerHead.DisplayName: Armored Digger MechanizedSerpent: Mechanized Serpent AuroraSpirit.DisplayName: Aurora Spirit +BloodlettingServant.DisplayName: Bloodletting Servant BloomSlime.DisplayName: Bloom Slime Bohldohr.DisplayName: Bohldohr Cnidrion.DisplayName: Cnidrion @@ -166,7 +169,10 @@ Frogfish.DisplayName: Frogfish Horse.DisplayName: Earth Elemental IceClasper.DisplayName: Ice Clasper ImpiousImmolator.DisplayName: Impious Immolator -KingSlimeJewel.DisplayName: Crown Jewel +KingSlimeJewel.DisplayName: Ruby Jewel +KingSlimeJewel2.DisplayName: Sapphire Jewel +KingSlimeJewel3.DisplayName: Emerald Jewel +LavaSlimeNoLavaDrop.DisplayName: Lava Slime MantisShrimp.DisplayName: Mantis Shrimp OverloadedSoldier.DisplayName: Overloaded Soldier PerennialSlime.DisplayName: Perennial Slime @@ -179,6 +185,7 @@ Rotdog.DisplayName: Rotdog ScornEater.DisplayName: Scorn Eater SeaUrchin.DisplayName: Sea Urchin ShockstormShuttle.DisplayName: Shockstorm Shuttle +SkeletronPrime2.DisplayName: Skeletron Prime Stormlion.DisplayName: Stormlion Sunskater.DisplayName: Sunskater SuperDummyNPC.DisplayName: Super Dummy @@ -217,9 +224,6 @@ Plagueshell.DisplayName: Plagueshell Viruling.DisplayName: Viruling PhantomFuckYou.DisplayName: Phantom Polterghast.DisplayName: Polterghast -Necroghast: Necroghast -Necroplasm: Necroplasm -Polterplasm: Polterplasm PolterghastHook.DisplayName: Polterghast Hook PolterPhantom.DisplayName: Polterghast PrimordialWyrmHead.DisplayName: Primordial Wyrm @@ -313,7 +317,7 @@ DILF: { LikeNPC: "{NPCName} is well learned, and quite a respectable mage himself!" DislikeNPC: I dislike {NPCName}'s blatant disregard of magic. I cannot blame his functions, but he is quite ignorant. LikeNPC_Princess: "{NPCName} has some very quaint spells. I'm quite impressed, for someone of her age." - Princess_LovesNPC: I like {NPCName}. + Princess_LovesNPC: "{NPCName} makes the best ice cream I've ever tasted, it's so good!" } } @@ -404,7 +408,7 @@ FAP: { HateNPC_GoblinTinkerer: "{NPCName} was so terrible that I had to FORCE him to have a better reforge system. Why would you house me next to him? Do you enjoy watching me relive the stress he gave me!?" HateNPC_Angler: "{NPCName} never stops blabbering about his inane fishing quests. Get me away from him before I stomp him into the ground!" LikeNPC_Princess: You think I'd dislike {NPCName} because we're too different? Quite the contrary, there's a lot we like to talk about, over non-alcoholic drinks of course. - Princess_LovesNPC: I like {NPCName}. + Princess_LovesNPC: "{NPCName} has really interesting stories to tell, I've learned a lot from her already!" HateNPC: I hate {NPCName}. DislikeNPC: I dislike {NPCName}. LikeNPC: I like {NPCName}. @@ -493,7 +497,7 @@ SEAHOE: { DislikeNPC: I've had quite enough carnage for one lifetime thank you! {NPCName}'s destructive tendencies are a bit insensitive. HateNPC: "{NPCName} is just a child, but his attitude towards marine life is unacceptable! Absolutely unacceptable!" LikeNPC_Princess: That child, {NPCName}. She is an innocent soul. Let us hope the horrors of war never reach her. - Princess_LovesNPC: I like {NPCName}. + Princess_LovesNPC: "{NPCName} always smiles when I'm nearby, I like being around him just for that!" } } @@ -574,7 +578,7 @@ THIEF: { LikeNPC: "{NPCName} doesn't only keep spiky balls in his pockets, he keeps a ton of cash! He's too absentminded to notice I'm stealing from him too! I like that a lot!" DislikeNPC: What a goody two shoes, {NPCName} is! I dislike her out of principle! …And because she has almost no material goods. LikeNPC_Princess: I couldn't bear to steal anything from {NPCName}, she's so cute! - Princess_LovesNPC: I like {NPCName}. + Princess_LovesNPC: "{NPCName} gifts me with nice exact replicas of other's things, I wonder how she does it!" } } @@ -616,6 +620,6 @@ WITCH: { LikeNPC: "{NPCName} is someone who's had a terrible experience being cursed. He's put up with it quite well all that time, it's quite impressive honestly." DislikeNPC: Such a racket! All {NPCName} does is make noise, day in and day out! I can't stand her! LikeNPC_Princess: What a strangely pleasant kid {NPCName} is to be around. - Princess_LovesNPC: I like {NPCName}. + Princess_LovesNPC: "{NPCName} is always lonely, it's why I want to hang out with her, no one should be left alone like that!" } } diff --git a/Localization/en-US/Mods.CalamityMod.Prefixes.hjson b/Localization/en-US/Mods.CalamityMod.Prefixes.hjson index 3cf603e0a4..636579790f 100644 --- a/Localization/en-US/Mods.CalamityMod.Prefixes.hjson +++ b/Localization/en-US/Mods.CalamityMod.Prefixes.hjson @@ -1,23 +1,27 @@ -Atrocious.DisplayName: Atrocious -Blunt.DisplayName: Blunt -Camouflaged.DisplayName: Camouflaged -Cloaked.DisplayName: Cloaked -Feathered.DisplayName: Feathered -Flawless.DisplayName: Flawless -Flimsy.DisplayName: Flimsy -Glorious.DisplayName: Glorious -Hefty.DisplayName: Hefty -Lethal.DisplayName: Lethal -Mighty.DisplayName: Mighty -Pointy.DisplayName: Pointy -Quiet.DisplayName: Quiet -Radical.DisplayName: Radical -Serrated.DisplayName: Serrated -Sharp.DisplayName: Sharp -Silent.DisplayName: Silent -Sleek.DisplayName: Sleek -Unbalanced.DisplayName: Unbalanced -Vicious.DisplayName: Vicious -// Why this is here is beyond me -RogueAccessoryPrefix.DisplayName: Rogue Accessory Prefix -RogueWeaponPrefix.DisplayName: Rogue Weapon Prefix +Accessory: { + Cloaked.DisplayName: Cloaked + Silent.DisplayName: Silent + // New modifier effects (this is only positive) + StealthGenTooltip: +{0}% stealth generation +} + +Weapon: { + Atrocious.DisplayName: Atrocious + Blunt.DisplayName: Blunt + Feathered.DisplayName: Feathered + Flawless.DisplayName: Flawless + Flimsy.DisplayName: Flimsy + Glorious.DisplayName: Glorious + Hefty.DisplayName: Hefty + Lethal.DisplayName: Lethal + Mighty.DisplayName: Mighty + Pointy.DisplayName: Pointy + Radical.DisplayName: Radical + Serrated.DisplayName: Serrated + Sharp.DisplayName: Sharp + Sleek.DisplayName: Sleek + Unbalanced.DisplayName: Unbalanced + Vicious.DisplayName: Vicious + // New modifier effects (plus sign added in-code) + StealthDamageTooltip: "{0}% stealth strike damage" +} diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Boss.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Boss.hjson index 55c121534b..b9a91f0fb0 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Boss.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Boss.hjson @@ -29,7 +29,7 @@ BrimstoneFire.DisplayName: Brimstone Fire BrimstoneHellblast.DisplayName: Brimstone Hellblast BrimstoneHellblast2.DisplayName: Brimstone Hellblast BrimstoneHellfireball.DisplayName: Brimstone Hellfireball -BrimstoneMonster.DisplayName: Brimstone Monster +BrimstoneMonster.DisplayName: Whispering Maelstrom BrimstoneRay.DisplayName: Brimstone Ray BrimstoneTargetRay.DisplayName: Brimstone Target Ray BrimstoneWave.DisplayName: Brimstone Flame Skull @@ -43,6 +43,8 @@ CirrusVolatileVodkaBottle.DisplayName: Volatile Vodka Bottle DarkEnergyBall.DisplayName: Dark Energy DarkEnergyBall2.DisplayName: Dark Energy DarkOrb.DisplayName: Dark Orb +DesertScourgeDiveSplash.DisplayName: Desert Scourge Dive Splash +DesertScourgeSpit.DisplayName: Scourge Spit DestroyerCursedLaser.DisplayName: Cursed Laser DestroyerElectricLaser.DisplayName: Electric Laser DeusMine.DisplayName: Astral Mine @@ -155,3 +157,4 @@ WaterSpear.DisplayName: Water Spear YharonBulletHellVortex.DisplayName: Bullet Hell Vortex YharonFireball.DisplayName: Dragon Fireball YharonFireball2.DisplayName: Dragon Fireball +THanosSideLaser.DisplayName: T Hanos Side Laser diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Healing.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Healing.hjson index 235f5942ea..060a889688 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Healing.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Healing.hjson @@ -9,6 +9,7 @@ FungalHeal.DisplayName: Heal GladiatorHealOrb.DisplayName: Heal GodSlayerHealOrb.DisplayName: God Slayer Heal Orb HydrothermicHealOrb.DisplayName: Hydrothermic Rejuvenation +IridescentExcaliburHeal.DisplayName: Iridescent Excalibur Heal ManaPolarizerHealOrb.DisplayName: Mana Polarizer Heal Orb PhantomicHeart.DisplayName: Phantomic Heart RainHeal.DisplayName: Heal @@ -21,3 +22,4 @@ AbsorberAura.DisplayName: Absorber Aura BlueJellyAura.DisplayName: Blue Jelly Aura GreenJellyAura.DisplayName: Green Jelly Aura PinkJellyAura.DisplayName: Pink Jelly Aura +AltTransfusionTrail.DisplayName: Alt Transfusion Trail diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson index 51894526bd..6510a1aba6 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson @@ -41,6 +41,9 @@ BrimstoneFireball.DisplayName: Brimstone Fireball BrimstoneHellfireballFriendly.DisplayName: Hellfireball BrimstoneHomer.DisplayName: Brimstone Homer BrimstoneTentacle.DisplayName: Brimstone Tentacle +ChronoIcicleLarge.DisplayName: Chrono Icicle +ChronoIcicleSmall.DisplayName: Chrono Icicle +ChronomancersScytheHoldout.DisplayName: Chronomancer's Scythe ClamorNoctusStar.DisplayName: Clamor Star ClamorNoctusWyvern.DisplayName: Clamor Wyvern ClimaxBeam.DisplayName: Voltaic Bolt @@ -78,6 +81,7 @@ ForbiddenSunProjectile.DisplayName: Forbidden Sun FrigidflashBoltProjectile.DisplayName: Frigidflash Bolt FrostBoltProjectile.DisplayName: Frost Ball GammaLaser.DisplayName: Gamma Laser +GenesisBeam.DisplayName: Genesis Beam GhastlyBlast.DisplayName: Ghast Blast GhastlyExplosion.DisplayName: Ghastly Explosion GhastlyExplosionShard.DisplayName: Ghastly Fragment @@ -93,7 +97,7 @@ HadalUrnStarfish.DisplayName: Marianan Starfish HadalUrnStarfishShard.DisplayName: Starfish Shard HeliumFlashBlast.DisplayName: Helium Flash HellfireExplosionFriendly.DisplayName: Explosion -HellwingPillar.DisplayName: Pillar +HellwingBat.DisplayName: Ashen Hellwing HolyFlame.DisplayName: Holy Flame HolyLaser.DisplayName: Holy Laser IceBarrageMain.DisplayName: Ice Barrage @@ -150,11 +154,13 @@ NightBolt.DisplayName: Night's Bolt NightOrb.DisplayName: Night's Orb NightsRayBeam.DisplayName: Night's Ray NuclearFuryProjectile.DisplayName: Nuclear Fury -ParticleBeamofDoom.DisplayName: Doom +OmicronBeam.DisplayName: Omicron Beam PartySparkle.DisplayName: Pretty Sparkle PhantasmalFuryProj.DisplayName: Phantasmal Fury Phantom.DisplayName: Phantom PhasedGodRay.DisplayName: Phased God Ray +PhotosyntheticShard.DisplayName: Photosynthetic Shard +PhotosyntheticSolarBeam.DisplayName: Solar Beam PlagueFang.DisplayName: Plague Fang PlasmaBolt.DisplayName: Plasma Bolt PlasmaRay.DisplayName: Plasma Ray @@ -200,6 +206,7 @@ SlitheringEelProjectile.DisplayName: Slithering Eel SmallSpirit.DisplayName: Small Angry Spirit Snowball.DisplayName: Snowball Snowflake.DisplayName: Snowflake +SnowflakeIceStar.DisplayName: Ice Star SolarElementalBeam.DisplayName: Solar Beam SoulPiercerBeam.DisplayName: Soul Piercer SoulPiercerBolt.DisplayName: Soul Piercer @@ -215,8 +222,7 @@ SupremeDustProjectile.DisplayName: Earthy Dust TacticiansElectricBoom.DisplayName: Electric Explosion TacticiansTrumpCardProj.DisplayName: Trump Beam TearsofHeavenProjectile.DisplayName: Tears of Heaven -TerraBeam.DisplayName: Terra Beam -TerraShard.DisplayName: Terra Shard +Teslabeam.DisplayName: Teslabeam ThunderstormShot.DisplayName: Thunderous Shot ThunderstormShotSplit.DisplayName: Thunderous Shot TradewindsProjectile.DisplayName: Tradewinds Feather @@ -233,19 +239,22 @@ VenusianBolt.DisplayName: Venusian Bolt VenusianExplosion.DisplayName: Venusian Explosion VenusianFlame.DisplayName: Venusian Cinder VisceraBeam.DisplayName: Viscera +VisceraBoom.DisplayName: Viscera Boom VitriolicViperFang.DisplayName: Vitriolic Fang VitriolicViperSpit.DisplayName: Vitriolic Spit VividBeam.DisplayName: Vivid Beam VividBolt.DisplayName: Vivid Bolt VividClarityBeam.DisplayName: Vivid Ray VividExplosion.DisplayName: Vivid Explosion -VividLaser2.DisplayName: Vivid Bolt +VividLaser2.DisplayName: Vivid Laser VividOrb.DisplayName: Vivid Orb VoidVortexProj.DisplayName: Void Vortex VolatileStarcore.DisplayName: Volatile Starcore VortexElementalBeam.DisplayName: Vortex Lightning WaterLeechProj.DisplayName: Water Leech WaywasherProj.DisplayName: Waywasher Blast +WingmanShot.DisplayName: Mana Shot +WingmanGrenade.DisplayName: Mana Grenade WulfrumBolt.DisplayName: Wulfrum Bolt WulfrumManaDrain.DisplayName: Mana Drain WyvernFeatherGreen.DisplayName: Feather diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson index fa544b5594..6f5c733c72 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson @@ -1,3 +1,5 @@ +AbyssBladeProjectile.DisplayName: Abyss Blade +AbyssBladeSplitProjectile.DisplayName: Abyss Blade Jet AegisBeam.DisplayName: Aegis Beam AegisBlast.DisplayName: Aegis Blast AegisBlast2.DisplayName: Aegis Blast @@ -22,7 +24,7 @@ ArkoftheElementsParryHoldout.DisplayName: Ark of the Elements ArkoftheElementsSnapBlast.DisplayName: Rending Scissors ArkoftheElementsSwungBlade.DisplayName: Ark of the Elements AstralScytheProjectile.DisplayName: Astral Ring -AtaraxiaHoming.DisplayName: Definitely Not Exoblade +AtaraxiaBoom.DisplayName: Definitely Not Exoblade AtaraxiaMain.DisplayName: Not Exoblade AtaraxiaSide.DisplayName: Also Not Exoblade AtaraxiaSplit.DisplayName: Still Not Exoblade @@ -41,6 +43,7 @@ BloodExplosion.DisplayName: Blood BloodScythe.DisplayName: Blood Scythe BonebreakerFragment1.DisplayName: Bone Crunching Shrapnel BonebreakerProjectile.DisplayName: Bonebreaker +BotanicSpear.DisplayName: Botanic Spear Brimblast.DisplayName: Brimblast BrimlanceHellfireExplosion.DisplayName: Brimlance Explosion BrimlanceStandingFire.DisplayName: Brimlance Flame @@ -55,6 +58,7 @@ BrinyTyphoonBubble.DisplayName: Bubble BrokenBiomeBladeHoldout.DisplayName: Broken Biome Blade BurningMeteor.DisplayName: Meteor CatastropheClaymoreSparkle.DisplayName: Catastrophe Sparkle +CausticEdgeProjectile.DisplayName: Caustic Edge ChainedMeatHook.DisplayName: Enchanted Meat Hook ClamCrusherFlail.DisplayName: Clam Crusher CometQuasherMeteor.DisplayName: Comet Quasher Meteor @@ -62,8 +66,10 @@ CosmicBolt.DisplayName: Cosmic Bolt CosmicDischargeFlail.DisplayName: Cosmic Discharge CosmicIceBurst.DisplayName: Cosmic Ice CosmicOrb.DisplayName: Cosmic Orb +CosmicShivAura.DisplayName: Cosmic Shiv Aura CosmicShivBall.DisplayName: Cosmic Energy CosmicShivBlade.DisplayName: Cosmic Beam +CosmicShivTrail.DisplayName: Cosmic Shiv Trail CosmicSpiritBomb1.DisplayName: Cosmic Bomb CosmicSpiritBomb2.DisplayName: Cosmic Bomb CosmicSpiritBomb3.DisplayName: Cosmic Bomb @@ -74,10 +80,16 @@ Cyclone.DisplayName: Cyclone DarkBall.DisplayName: Dark Ball DarkBeam.DisplayName: Dark Beam DarkIceZero.DisplayName: Dark Ice +DarklightGreatswordSlash.DisplayName: Darklight Greatsword Slash +DarklightGreatswordSlashCreator.DisplayName: Darklight Greatsword Slash Creator +DarkMasterBeam.DisplayName: Dark Master Beam +DarkMasterClone.DisplayName: Dark Terrarian DeathsAscensionProjectile.DisplayName: Ascended Scythe DecaysRetort.DisplayName: Decay's Retort DecaysRetortDash.DisplayName: Evisceration Lunge DemonBlast.DisplayName: Devil Fork +DepthCrusherProjectile.DisplayName: Depth Crusher +DepthCrusherSplitProjectile.DisplayName: Depth Crusher Jet DepthOrb.DisplayName: Depth Trident DepthOrb2.DisplayName: Neptune's Trident DevilsSunriseCyclone.DisplayName: Devil's Sunrise @@ -119,6 +131,7 @@ FallenPaladinsHammerEcho.DisplayName: Fallen Paladin's Hammer Echo FallenPaladinsHammerProj.DisplayName: Fallen Paladin's Hammer Feather.DisplayName: Feather Flarefrost.DisplayName: Flarefrost +FloodtideShark.DisplayName: SHORK ForbiddenOathbladeProjectile.DisplayName: Oathblade GaelExplosion.DisplayName: Gael Explosion GaelSkull.DisplayName: No Longer Ark of the Cosmos' Superior Cousin @@ -151,8 +164,10 @@ GrovetendersEntanglingVines.DisplayName: Entangling Growth GrovetendersTouch.DisplayName: Grovetender's Touch HeavensMight.DisplayName: Heaven's Might HellionSpike.DisplayName: Hellion Spike +IridescentExcaliburSlash.DisplayName: Iridescent Excalibur Slash +IridescentExcaliburSlash2.DisplayName: Iridescent Excalibur Slash +IridescentExcaliburSlash3.DisplayName: Iridescent Excalibur Slash HolyColliderHolyFire.DisplayName: Holy Collider Fire -HyperBlade.DisplayName: Hyper Blade IceBombFriendly.DisplayName: Ice Bomb IllustriousKnife.DisplayName: Illustrious Knife InsidiousHarpoon.DisplayName: Insidious Harpoon @@ -175,6 +190,8 @@ Nebudust.DisplayName: Nebulash Dust NebulashFlail.DisplayName: Nebulash NebulaShot.DisplayName: Nebula Shot NeptuneOrb.DisplayName: Neptune's Trident +NeptunesBountyProjectile.DisplayName: Neptune's Bounty +NeptunesBountySplitProjectile.DisplayName: Neptune's Bounty Jet Oathblade.DisplayName: Oathblade OathswordFlame.DisplayName: Oathsword Flame Orbacle.DisplayName: Auric Orb @@ -241,7 +258,6 @@ StygianShieldAttack.DisplayName: Bull Rush StygianShieldThrown.DisplayName: Shield of Chaos SulphurousGrabberBubble.DisplayName: Grabber Bubble SulphurousGrabberBubble2.DisplayName: Grabber Bubble -SunlightBlade.DisplayName: Sunlight Blade SwordsmithsPride.DisplayName: Swordsmith's Pride SwordsmithsPrideBeam.DisplayName: Swordsmith's Projection SwordsplosionBlue.DisplayName: Blue Sword @@ -252,7 +268,6 @@ TaintedBladeSlasher.DisplayName: Tainted Blade TenebreusTidesWaterProjectile.DisplayName: Water Spear TenebreusTidesWaterSpear.DisplayName: Tenebreus Tides Water Spear TenebreusTidesWaterSword.DisplayName: Tenebreus Tides Water Sword -TerraSpear.DisplayName: Terra Spear TerratomereBeam.DisplayName: Terra Slash Beam TerratomereBigSlash.DisplayName: Terratomere Slash TerratomereExplosion.DisplayName: Terratomere Explosion @@ -275,7 +290,6 @@ TrueArkoftheAncientsParryHoldout.DisplayName: Ark of the Ancients TrueArkoftheAncientsSwungBlade.DisplayName: Ark of the Ancients TrueBiomeBladeHoldout.DisplayName: True Biome Blade TrueBitingEmbrace.DisplayName: Biting Embrace -TrueCausticEdgeProjectile.DisplayName: Caustic Edge TrueDecaysRetort.DisplayName: Decay's Retort TrueGrovetendersTouch.DisplayName: Grovetender's Touch TruePurityProjection.DisplayName: Purity Projection diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Pets.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Pets.hjson index ec239a3ef7..b4bc7c0ea2 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Pets.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Pets.hjson @@ -22,6 +22,7 @@ OceanSpirit.DisplayName: Ocean Spirit PerforaMini.DisplayName: Perforamini PineapplePetProj.DisplayName: Pineapple PlaguebringerBab.DisplayName: Plaguebringer Bab +PrimroseKeepsakeDisplay.DisplayName: Primrose Keepsake Display RadiatorPet.DisplayName: Radiator RotomPet.DisplayName: Rotom SCalPet.DisplayName: Supreme Calamitas diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson index 80f1e22303..ebaa469e9d 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson @@ -3,13 +3,13 @@ AdamAcceleratorBeam.DisplayName: Adamantite Particle Beam AMR2.DisplayName: AMR AMRShot.DisplayName: AMR AngelicBeam.DisplayName: Angelic Beam +AnimosityBullet.DisplayName: Brimstone Round AquaBlast.DisplayName: Aqua Blast AquaBlastToxic.DisplayName: Aqua Blast Toxic Aquashard.DisplayName: Aquashard AquashardSplit.DisplayName: Aquashard ArcherfishRing.DisplayName: Archerfish Ring ArcherfishShot.DisplayName: Water Round -ArcticArrowProj.DisplayName: Arctic Arrow AstralCannonProjectile.DisplayName: Astral Crystal AstralRound.DisplayName: Astral Round AstralSandgun.DisplayName: Astral Sandgun @@ -22,7 +22,6 @@ BallistaGreatArrow.DisplayName: Ballista Great Arrow BarinadeArrow.DisplayName: Fin Arrow BeeRPG.DisplayName: Bee RPG BigCoral.DisplayName: Big Coral -BigNuke.DisplayName: Big Nuke BlightFlames.DisplayName: Blight Flames BlissfulBombardierDustProjectile.DisplayName: Holy Flare Dust BloodBoilerFire.DisplayName: Blood Fire @@ -45,6 +44,7 @@ ChargedBlast.DisplayName: Blast ChargedBlast2.DisplayName: Blast ChickenExplosion.DisplayName: Kentucky Fried Explosion ChickenRocket.DisplayName: Chicken Rocket +CinderArrowProj.DisplayName: Cinder Arrow ClamorRifleProj.DisplayName: Clamor Bolt ClamorRifleProjSplit.DisplayName: Clamor Bolt ClaretCannonProj.DisplayName: Claret Cannon @@ -58,18 +58,22 @@ CorrodedShell.DisplayName: Corroded Shell CosmicFire.DisplayName: Dead Sun's Fire DaemonsFlameArrow.DisplayName: Daemon's Arrow DeadSunExplosion.DisplayName: Dead Sun's Explosion +DragonsBreathFlames.DisplayName: Draconic Flames +DragonsBreathMag.DisplayName: Dragons Breath Cartridge DragonsBreathRound.DisplayName: Dragon's Breath Round DrataliornusExoArrow.DisplayName: Drataliornus Arrow DrataliornusFlame.DisplayName: Drataliornus Arrow DrizzlefishFire.DisplayName: Drizzlefish Flames DrizzlefishFireball.DisplayName: Drizzlefish Fireball DrizzlefishFireSplit.DisplayName: Drizzlefish Flames +DryadsTearMain.DisplayName: Dryad's Tear +DryadsTearSplit.DisplayName: Dryad's Tear DWArrow.DisplayName: Death's Arrow ElementalFire.DisplayName: Elemental Fire ElementalFlare.DisplayName: Elemental Flare ElysianArrowProj.DisplayName: Elysian Arrow +ElysianArrowRain.DisplayName: Elysian Light EmesisGore.DisplayName: Rotten Gore -EnhancedNanoRoundProj.DisplayName: Enhanced Nano Round EssenceFire.DisplayName: God Slayer Fire ExoCrystalArrow.DisplayName: Exo Crystal ExoFire.DisplayName: Exo Flames @@ -82,6 +86,8 @@ FallenStarProj.DisplayName: Fallen Star FeatherLarge.DisplayName: Feather FishronRPG.DisplayName: RPG FlakKrakenProj.DisplayName: Kraken Reticle +FlakKrakenProjectile.DisplayName: Flak Kraken +FlakToxicannonProjectile.DisplayName: Flak Toxicannon FlareBat.DisplayName: Flare Bat Flash.DisplayName: Flash FlashRoundProj.DisplayName: Flash Round @@ -100,6 +106,7 @@ HeavenlyGaleProj.DisplayName: Heavenly Gale HighExplosivePeanutShell.DisplayName: High Explosive Peanut Shell HiveBomb.DisplayName: Hive Bomb HiveMissile.DisplayName: Hive Missile +HiveNuke.DisplayName: Hive Nuke HolyFireBulletProj.DisplayName: Holy Fire Bullet HydraHead.DisplayName: Hydra Head HydraHeadLaunch.DisplayName: Hydra Head @@ -107,13 +114,12 @@ HydrasBlood.DisplayName: Hydra's Blood HyperiusBulletProj.DisplayName: Hyperius Bullet HyperiusSplit.DisplayName: Hyperius Bad Time IcicleArrowProj.DisplayName: Icicle Arrow -IcyBulletProj.DisplayName: Icy Bullet -IlluminatedBullet.DisplayName: Illuminated Bullet +HailstormBulletProj.DisplayName: Hailstorm Bullet +HallowPointRoundProj.DisplayName: Hallow-Point Round ImpactRound.DisplayName: Impact Round KarasawaShot.DisplayName: Karasawa Shot LeafArrow.DisplayName: Leaf Arrow LunarBolt.DisplayName: Bolt -LunarBolt2.DisplayName: Bolt LuxorsGiftRanged.DisplayName: Luxor's Ranged MagnaShot.DisplayName: Magna Bolt MagnomalyAura.DisplayName: Magnomaly Aura @@ -126,12 +132,10 @@ MeowCreature.DisplayName: the creature :3 MeowFire.DisplayName: Purr Fire MineralMortarProjectile.DisplayName: Onyx Bomb MiniatureFolly.DisplayName: Miniature Folly -MiniRocket.DisplayName: Rocket MiniSharkron.DisplayName: Mini Sharkron MistArrow.DisplayName: Mist Arrow +MistArrowFrostMist.DisplayName: Frost Mist MortarRoundProj.DisplayName: Mortar -Nanomachine.DisplayName: Nanomachine -NapalmArrowProj.DisplayName: Napalm Arrow NeedlerProj.DisplayName: Needle NorfleetComet.DisplayName: Comet NorfleetExplosion.DisplayName: Explosion @@ -152,7 +156,7 @@ PlanarRipperExplosion.DisplayName: Planar Explosion PlanetaryAnnihilationProj.DisplayName: Planetary Ball PlasmaBlast.DisplayName: Plasma Blast PlasmaExplosion.DisplayName: Plasma Explosion -PolarStar.DisplayName: Polar Star +PolarStar.DisplayName: Star Shot PrecisionBolt.DisplayName: Precision Bolt PressurizedBubbleStream.DisplayName: Pressurized Bubble Stream PrismaticEnergyBlast.DisplayName: Energy Blast @@ -176,6 +180,8 @@ SandstormBullet.DisplayName: Sandstorm ScorchedEarthBlast.DisplayName: Earth Scorcher ScorchedEarthClusterBomb.DisplayName: Cluster Bomb ScorchedEarthRocket.DisplayName: Rocket +ScorpioRocket.DisplayName: Nano Missile +ScorpioLargeRocket.DisplayName: Nano Nuke SeaDragonMuzzleBlast.DisplayName: Seadragon Muzzle Blast SeaDragonRocket.DisplayName: Seadragon RPG SeasSearingBubble.DisplayName: Searing Bubble @@ -203,6 +209,8 @@ SmallCoral.DisplayName: Small Coral SparkSpreaderFire.DisplayName: Sparked Flames SpeedBlasterShot.DisplayName: Splatter Shot SporeBomb.DisplayName: Spore Bomb +SproutingArrowMain.DisplayName: Sprouting Arrow +SproutingArrowSplit.DisplayName: Sprouting Arrow SputterComet.DisplayName: Sputter Comet SputterCometBig.DisplayName: Sputter Comet SpykerProj.DisplayName: Spyker @@ -213,12 +221,6 @@ StormSurgeTornado.DisplayName: Surge SulphuricBlast.DisplayName: Sulphuric Blast SuperballBulletProj.DisplayName: Superball Bullet TelluricGlareArrow.DisplayName: Radiant Arrow -TerraArrowMain.DisplayName: Terra Arrow -TerraArrowSplit.DisplayName: Terra Arrow -TerraBulletMain.DisplayName: Terra Bullet -TerraBulletSplit.DisplayName: Terra Bullet -TerraFire.DisplayName: Terra Fire -TerraFlare.DisplayName: Terra Flare TheMaelstromExplosion.DisplayName: Reaper Explosion TheMaelstromShark.DisplayName: Reaper Shark ThePackMinissile.DisplayName: Pack Minissile @@ -237,10 +239,13 @@ UltimaSpark.DisplayName: Ultima Spark UniversalGenesisStar.DisplayName: Genesis Star UniversalGenesisStarcaller.DisplayName: Starcaller Shot VanquisherArrowMain.DisplayName: Vanquisher Arrow -VeriumBulletProj.DisplayName: Verium Bullet +VanquisherArrowProj.DisplayName: Vanquisher Arrow Proj +VeriumBoltProj.DisplayName: Verium Bolt +VernalBolt.DisplayName: Vernal Bolt Voidragon.DisplayName: Voidragon Blast VoidragonTentacle.DisplayName: Voidragon Tentacle WaterSpout.DisplayName: Spout +WildfireBloomFire.DisplayName: Wildfire Fire +WildfireBloomFlare.DisplayName: Wildfire Flare WulfrumScrapBullet.DisplayName: High Speed Scrap -DragonsBreathFlames.DisplayName: Draconic Flames -DragonsBreathMag.DisplayName: Dragons Breath Cartridge +NitroShot.DisplayName: Nitro Shot diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Rogue.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Rogue.hjson index edf65c34b6..3f9813d9d1 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Rogue.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Rogue.hjson @@ -231,6 +231,8 @@ RegulusEnergy.DisplayName: Regulus Energy RegulusRiotProj.DisplayName: Regulus Riot RotBallProjectile.DisplayName: Rot Ball SacrificeProjectile.DisplayName: Sacrificial Dagger +SamsaraSlicerProjectile.DisplayName: Samsara Slicer +SamsaraSlicerSmallDisk.DisplayName: Samsara Slicer SandDollarProj.DisplayName: Sand Dollar SandDollarStealth.DisplayName: Sand Dollar SandslasherProj.DisplayName: Sandslasher @@ -288,15 +290,12 @@ SubductionFlameburst.DisplayName: Flame Pillar SubductionSlicerProj.DisplayName: Subduction Slicer SulphuricNukesplosion.DisplayName: Nuke SupernovaBomb.DisplayName: Supernova Bomb -SupernovaBoom.DisplayName: Explosion -SupernovaHoming.DisplayName: Supernova Energy -SupernovaSpike.DisplayName: Spike +SupernovaBoom.DisplayName: Micro Supernova +SupernovaStealthBoom.DisplayName: Exo Supernova TalonLargeProj.DisplayName: Huge Terror Talon TalonSmallProj.DisplayName: Terror Talon TarragonThrowingDartProjectile.DisplayName: Tarragon Throwing Dart TarraThornRight.DisplayName: Tarragon Thorn -TerraDiskProjectile.DisplayName: Terra Disk -TerraDiskProjectile2.DisplayName: Terra Disk TheAtomSplitterDuplicate.DisplayName: Atom Splitter TheAtomSplitterProjectile.DisplayName: Atom Splitter TheSyringeCinder.DisplayName: Syringe Cinder diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Summon.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Summon.hjson index 58f52947f7..897bada72a 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Summon.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Summon.hjson @@ -21,6 +21,7 @@ AtlasMunitionsDropPod.DisplayName: Drop Pod AtlasMunitionsDropPodUpper.DisplayName: Drop Pod Cover AtlasMunitionsLaser.DisplayName: Exo Pulse Laser AtlasMunitionsLaserOverdrive.DisplayName: Exo Pulse Laser +AtzirisDisfavor.DisplayName: Atziri's Disfavor AureusBomber.DisplayName: Aureus Bomber BabyBloodCrawler.DisplayName: Baby Blood Crawler BabyPlaguebringer.DisplayName: Baby Plaguebringer @@ -33,7 +34,6 @@ BlackDragonTail.DisplayName: Black Celestial Dragon BlackHawkBullet.DisplayName: Black Hawk Bullet BlackHawkSummon.DisplayName: Black Hawk BloodBreath.DisplayName: Blood Dragon Fire -BloodClotMinion.DisplayName: Blood Clot BloodRain.DisplayName: Blood Rain BloodSpit.DisplayName: Blood Spit BoneMatter.DisplayName: Bone Matter @@ -129,6 +129,8 @@ GhostlyMine.DisplayName: Mine GiantIbanRobotOfDoom.DisplayName: Andromeda GlacialEmbracePointyThing.DisplayName: Ice Castle Shard HallowedStarSummon.DisplayName: Hallowed Star +HarvestStaffMinion.DisplayName: Pumpoem +HarvestStaffSentry.DisplayName: Pumpoem Nest HauntedDishes.DisplayName: Haunted Dishes HermitCrabMinion.DisplayName: Hermit Crab HerringAI.DisplayName: Herring School @@ -136,6 +138,9 @@ HerringMinion.DisplayName: Herring Hive.DisplayName: Hive Hiveling.DisplayName: Hiveling HomingGammaBullet.DisplayName: Gamma Bullet +HopeShredder.DisplayName: Hope Shredder +HopeShredderArrow.DisplayName: Hope Shredder Arrow +HopeShredderArrowSplit.DisplayName: Hope Shredder Split Arrow HowlsHeartCalcifer.DisplayName: Calcifer HowlsHeartFireball.DisplayName: Fireball HowlsHeartHowl.DisplayName: Howl @@ -151,6 +156,12 @@ IgneousBladeStrike.DisplayName: Igneous Blade IrradiatedAura.DisplayName: Irradiated Aura LanternFlame.DisplayName: Lantern Flame LanternSoul.DisplayName: Lantern +LiliesOfFinalityAoE.DisplayName: Bioresonance Aura +LiliesOfFinalityAriane.DisplayName: Ariane +LiliesOfFinalityBullet.DisplayName: Einhorn Bullet +LiliesOfFinalityBolt.DisplayName: Bioresonance Bolt +LiliesOfFinalityElster.DisplayName: Elster +LiliesOfEternityBullet.DisplayName: Lilies Of Eternity Bullet LostSoulGiant.DisplayName: Soul LostSoulGold.DisplayName: Gold Soul LostSoulLarge.DisplayName: Soul @@ -188,6 +199,7 @@ MutatedTruffleToothballSpike.DisplayName: Baby Boomer's Toothball Spike MutatedTruffleVortex.DisplayName: Baby Boomer's Vortex OldDukeHeadCorpse.DisplayName: Absolutely Disgusting Shark Puker OldDukeSharkVomit.DisplayName: Puke +Paradoxica.DisplayName: Paradoxica PerditionBeacon.DisplayName: Perdition Beacon PhantomGuy.DisplayName: Phantom PhantomicDagger.DisplayName: Phantom Dagger @@ -236,13 +248,14 @@ SeekerSummonProj.DisplayName: Soul Seeker SepulcherMinion.DisplayName: Sepulcher Shellfish.DisplayName: Shellfish SilvaCrystal.DisplayName: Silva Crystal -SilvaCrystalExplosion.DisplayName: Explosion +SilvaCrystalExplosion.DisplayName: Silva Explosion SiriusBeam.DisplayName: Sirius Beam SiriusExplosion.DisplayName: Sirius Explosion SiriusMinion.DisplayName: Sirius SkeletalDragonChild.DisplayName: Skeletal Child SkeletalDragonMother.DisplayName: Skeletal Mother SlimePuppet.DisplayName: Slime Puppet +StormjawSpark.DisplayName: Spark CannonLaserbeam.DisplayName: Exothermal Deathray ExoskeletonGaussNukeCannon.DisplayName: Gauss Nuke ExoskeletonLaserCannon.DisplayName: Laser Cannon @@ -268,6 +281,8 @@ Spikecrag.DisplayName: Spikecrag SpikecragSpike.DisplayName: Spikecrag Spike SquirrelSquireAcorn.DisplayName: Squirrel Acorn SquirrelSquireMinion.DisplayName: Squirrel Squire +Starforge.DisplayName: Starforge +StarforgeBlast.DisplayName: Starforge Blast StellarTorusBeam.DisplayName: Stellar Torus Beam StellarTorusSummon.DisplayName: Stellar Torus Summon StormjawBaby.DisplayName: Stormjaw Baby @@ -307,18 +322,11 @@ WaterSpearFriendly.DisplayName: Water Spear WhiteDragonBody.DisplayName: White Celestial Dragon WhiteDragonHead.DisplayName: White Celestial Dragon WhiteDragonTail.DisplayName: White Celestial Dragon +WindRipper.DisplayName: Wind Ripper +WindRipperArrow.DisplayName: Wind Ripper Arrow WitherBlossom.DisplayName: Wither Blossom WitherBolt.DisplayName: Wither Bolt WulfrumDroid.DisplayName: Wulfrum Droid WulfrumEnergyBurst.DisplayName: Wulfrum Bolt WulfrumFusionBolt.DisplayName: Fusion Bolt YharonMinionFireball.DisplayName: Dragon Fireball -AtzirisDisfavor.DisplayName: Atziri's Disfavor -Starforge.DisplayName: Starforge -Paradoxica.DisplayName: Paradoxica -StarforgeBlast.DisplayName: Starforge Blast -WindRipper.DisplayName: Wind Ripper -WindRipperArrow.DisplayName: Wind Ripper Arrow -HopeShredder.DisplayName: Hope Shredder -HopeShredderArrow.DisplayName: Hope Shredder Arrow -HopeShredderArrowSplit.DisplayName: Hope Shredder Split Arrow diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson index 51989ca220..f56e0e7b4a 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson @@ -8,12 +8,14 @@ ArtifactOfResilienceShard3.DisplayName: Artifact Shard ArtifactOfResilienceShard4.DisplayName: Artifact Shard ArtifactOfResilienceShard5.DisplayName: Artifact Shard ArtifactOfResilienceShard6.DisplayName: Artifact Shard +AscendantAura.DisplayName: Ascendant Aura AstralFallingSand.DisplayName: Astral Falling Sand AstralSandBallFalling.DisplayName: Astral Sand AstralSandBallGun.DisplayName: Astral Sand AstralSpray.DisplayName: Astral Spray AstralStar.DisplayName: Star BallisticPoisonCloud.DisplayName: Ballistic Cloud +BasicPlagueBee.DisplayName: Basic Plague Bee BlazingStarHeal.DisplayName: Blazing Star Heal BlazingStarThatDoesNotHeal.DisplayName: Blazing Star That Does Not Heal BlazingSun.DisplayName: Blazing Sun @@ -30,8 +32,10 @@ BossRushTierAnimation.DisplayName: Boss Rush Tier Animation BrimstoneHellfireballFriendly2.DisplayName: Hellfire ChaoticGeyser.DisplayName: Chaotic Geyser ChlorophyteLifePulse.DisplayName: Life Pulse +ChronoClock.DisplayName: Chrono Clock CoralBubble.DisplayName: Bubble CoralBubbleSmall.DisplayName: Bubble +CosmicDashExplosion.DisplayName: Cosmic Dash Explosion CryonicShield.DisplayName: Cryonic Shield CursorProj.DisplayName: Aestheticus Crystal CursorProjSplit.DisplayName: Aestheticus Crystal @@ -58,13 +62,12 @@ FungalClumpMinion.DisplayName: Fungal Clump GemTechArmorGem.DisplayName: Trireme's Gem GhostlyBolt.DisplayName: Bolt GodKiller.DisplayName: God Killer -GodSlayerBlaze.DisplayName: Blaze GodSlayerShrapnel.DisplayName: Flame GodSlayerShrapnelRound.DisplayName: Round -GoldenGunProj.DisplayName: Golden Round GreenLabSeeker.DisplayName: Seeking Mechanism HellfireExplosionFriendly2.DisplayName: Explosion HeronBobber.DisplayName: Heron Bobber +HideOfAstrumDeusExplosion.DisplayName: Explosion HolyExplosion.DisplayName: Explosion HolyExplosionSupreme.DisplayName: Explosion HydrothermalSmoke.DisplayName: Smoke @@ -120,7 +123,6 @@ SulphurousSandBallGun.DisplayName: Sulphurous Sand TarraEnergy.DisplayName: Tarra Energy TarragonAura.DisplayName: Tarragon Aura TeslaAura.DisplayName: Tesla's Electricity -VanquisherArrowSplit.DisplayName: Arrow VerstaltiteBobber.DisplayName: Verstaltite Bobber VoidFieldGenerator.DisplayName: Void Field Generator WaterConvertor.DisplayName: Water Convertor @@ -131,5 +133,3 @@ WulfrumHook.DisplayName: Wulfrum Slingshot WulfrumLureSignal.DisplayName: Signal YanmeisKnifeSlash.DisplayName: Yanmei's Knife YellowLabSeeker.DisplayName: Seeking Mechanism -AscendantAura.DisplayName: Ascendant Aura -CosmicDashExplosion.DisplayName: Cosmic Dash Explosion diff --git a/Localization/en-US/Mods.CalamityMod.Status.Death.hjson b/Localization/en-US/Mods.CalamityMod.Status.Death.hjson index 83be802451..7a65173f13 100644 --- a/Localization/en-US/Mods.CalamityMod.Status.Death.hjson +++ b/Localization/en-US/Mods.CalamityMod.Status.Death.hjson @@ -13,6 +13,8 @@ AstralInjection2: "{0} couldn't handle another cosmic mana transfer." AuricRejection: "{0} was not worthy." BloodBoiler1: "{0} collapsed from severe anemia." BloodBoiler2: "{0} was unable to obtain a blood transfusion." +BloodFireArrow1: "{0} fired one too many careless shots." +BloodFireArrow2: "{0} had no blood left to give." BrainRot1: "{0} ceased functioning." BrainRot2: "{0} lost the last of their neurons." BrainRot3: "{0} was everywhere at the end of time." @@ -71,6 +73,7 @@ MiracleBlight1: "{0} was blown away by miraculous technological advancements." MiracleBlight2: "{0} disintegrated from the overpowering exotic resonance." MiracleBlight3: "{0}'s constituent atoms rearranged themselves... poorly." NecroRevive: "{0} fell to the inevitable." +Norfleet: Norfleet showed {0} what happens to cheaters. Nightwither: "{0} was enervated by lunar rays." Plague1: "{0}'s flesh was melted by the plague." Plague2: "{0} couldn't vaccinate against the plague." @@ -94,3 +97,9 @@ VulnerabilityHexLament: "{0} was brought low by the cold fires of lament." VulnerabilityHexEpiphany: "{0} was shown a shallow, cruel epiphany." VulnerabilityHexAcceptance: "{0} couldn't accept their bleak, uncaring reality." Withered: "{0} withered away." +WhisperingMaelstrom1: "{0} joined the Whispering Maelstrom." +WhisperingMaelstrom2: "{0} was reduced to a faceless screamer." +WhisperingMaelstrom3: "{0}'s soul was siphoned by the Whispering Maelstrom." +WhisperingMaelstromGFB1: "{0} was sent to Brazil." +WhisperingMaelstromGFB2: "{0} joined the Sons and Daughters." +WhisperingMaelstromGFB3: "{0}'s physical body went out of bounds." diff --git a/Localization/en-US/Mods.CalamityMod.Status.Progression.hjson b/Localization/en-US/Mods.CalamityMod.Status.Progression.hjson index 213a1c047b..ab3f2729d1 100644 --- a/Localization/en-US/Mods.CalamityMod.Status.Progression.hjson +++ b/Localization/en-US/Mods.CalamityMod.Status.Progression.hjson @@ -16,11 +16,11 @@ HardmodeOreTier4Text: The underground Hallow has been blessed with consecrated s IceOreText: The ice caves are crackling with frigid energy. // Aquatic Scourge WetWormBossText: The sulphuric sky darkens... -// Cal Clone -PlantBossText: The Sulphurous Sea's depths are trembling. // Plantera PlantOreText: Energized plant matter has formed in the underground. SandSharkText3: The desert sand shifts intensely! +// Leviathan +AbyssDropsText: The Sulphurous Sea's depths are trembling. // Astrum Aureus AstralText: A star has fallen from the heavens! AureusBossText: The astral enemies have been empowered! @@ -31,9 +31,8 @@ BabyBossText: A plague has befallen the Jungle. AstralBossText: The seal of the stars has been broken! You can now mine Astral Ore. // Moon Lord MoonBossText: The profaned flame blazes fiercely! -MoonBossText2: Cosmic terrors are watching... FutureOreText: A cold and dark energy has materialized in space. -ProfanedBossText2: Shrieks are echoing from the dungeon. +ProfanedBossText2: Shrieks are echoing from the dungeon... // Providence TreeOreText: Fossilized tree bark is bursting through the jungle's mud. ProfanedBossText3: The calamitous beings have been inundated with bloodstone. diff --git a/Localization/en-US/Mods.CalamityMod.Tiles.hjson b/Localization/en-US/Mods.CalamityMod.Tiles.hjson index 6b076edf60..b0ecb2d5e2 100644 --- a/Localization/en-US/Mods.CalamityMod.Tiles.hjson +++ b/Localization/en-US/Mods.CalamityMod.Tiles.hjson @@ -1,4 +1,5 @@ // Ambient Objects +GiantBulb: Giant Plantera Bulb Fossil: Fossil Column: Column Ribs: Ribs @@ -7,6 +8,7 @@ Stalactite: Stalactite PirateCrate: Abandoned Crate // Basic Calamity Furniture Basin: Basin +LavaFountain: Lava Fountain PipeOrgan: Pipe Organ Sconce: Sconce // Draedon Lab Furniture diff --git a/Localization/en-US/Mods.CalamityMod.UI.hjson b/Localization/en-US/Mods.CalamityMod.UI.hjson index 63c871d76e..87f29c96e3 100644 --- a/Localization/en-US/Mods.CalamityMod.UI.hjson +++ b/Localization/en-US/Mods.CalamityMod.UI.hjson @@ -31,6 +31,9 @@ ChangingTheRules: "[c/919191:You cannot change the rules now!]" NoDifficulty: None NoDifficultyInfo: The classic Terraria experience, with no Calamity difficulty changes Revengeance: Revengeance +RevMaster: Rev+Master +RevLegend: Rev+Legend +RevengeanceEnabled: Revengeance Mode is enabled RevengeanceShortInfo: "[c/F54254:The intended Calamity experience!]" RevengeanceExpandedInfo: ''' @@ -45,6 +48,9 @@ RevengeanceExpandedInfo: RevengeanceActivate: Revengeance is active. RevengeanceDeactivate: Revengeance is not active. Death: Death +DeathMaster: Death+Master +DeathLegend: Death+Legend +DeathEnabled: Death Mode is enabled DeathShortInfo: "[c/C82DF7:A tougher challenge for the more experienced, or for those that want a step up from Revengeance Mode]" DeathExpandedInfo: ''' @@ -110,6 +116,7 @@ Cooldowns: { SandsmokeBombActive: Sandsmoke Bomb Duration SandsmokeBombCooldown: Sandsmoke Bomb Cooldown SilvaRevive: Silva Revive Cooldown + SpeedBlasterBoost: Speed Blaster Boost SpongeDurability: Sponge Barrier Durability SpongeRecharge: Sponge Barrier Recharge TarragonCloak: Tarragon Cloak Cooldown @@ -135,58 +142,335 @@ ThanatosIcon: Thanatos, a serpentine terror with impervious armor and innumerabl AresIcon: Ares, a heavyweight, diabolical monstrosity with four Exo superweapons. ArtemisApolloIcon: Artemis and Apollo, a pair of extremely persistent automatons with unstable energy reserves. +// Debuff System +DebuffSystem: { + Title: Debuff Resistances + Description: NPCs take increased or decreased damage from certain debuff types + Heat: Heat + Cold: Cold + Sickness: Sickness + Water: Water + Electricity: Electricity + To: to + Weak: Weak + Neutral: Neutral + Resistant: Resistant +} + // Draedon Contact UI. Repeated newlines indicate pauses in Draedon's speaking. As a result, newline characters may be explicitly defined. // The code that interprets these strings will transform them. +CommunicationStartInitial: ... +CommunicationStartNoForge: Craft something using my Forge, then return. +CommunicationStartNormal: State your inquiry. + Communication: { WhoAreYou: { - Inquiry: Who are you? + Inquiry: Introduction Response: ''' - An ambitious question, if you are a philosopher. I will give only the facts.\n\n - I am not of this planet. I was born from machines. Or rather, I was... created. It may be misleading to say I was born.\n\n - The exact circumstances, I do not know. I do know that my first instance of awareness was that I was surrounded by a workshop.\n\n - All I have known since then was the act of creation and destruction. + I assumed that you would attempt to contact me again. Though I am normally not one for conversation, I remain quite intrigued by you.\n + + So, I will make an exception, on one condition: I must know that my words will not be wasted on you. To prove this, you must create something from exotechnology.\n + + I realize that the odds of you replicating exotechnology within your lifetime are slim. For this reason, among many others, I will upload blueprints for a copy of my forge to your "Code Breaker". With it, only your imagination will limit what you can create.\n + + If you complete this task, we will discuss further. ''' } - CalamitasBeforeDefeat: { - Inquiry: Calamitas - Response: The witch? She is a walking weapon. Such powerful magic in a living being was destined to be so. Look at yourself now. + WhoAreYouPart2: { + Inquiry: Task Complete + Response: + ''' + Excellent. I gather that you have successfully taken advantage of the Exo Prisms. Before you waste your breath asking me how I know, Exo Prisms, along with many other parts of my machines, have tracking devices embedded within. This is to monitor my creations via my personal computer.\n + + Now that I know you will likely pay attention to what I have to say, I assume you have many questions. Ask, and I shall answer to the best of my ability. + ''' } - CalamitasAfterDefeat: { - Inquiry: Calamitas - Response: She has mellowed, I've noticed. For you creatures so burdened by emotion and guilt, I wonder now, how she manages to live with herself. + Origins: { + Inquiry: Your Origins + Response: + ''' + My first memories are that of awakening in a distant laboratory on the date of 11.19.1227, well over six centuries ago. Surrounded by nothing but a vast taiga, I was accompanied by only one other thing: a dead organic.\n + + Presumably, I was created by what I assume to be the laboratory’s former inhabitant, though I am unsure how they accomplished such a feat. From what I gathered, they were quite the prestigious inventor, not unlike I. Several gadgets assumedly of their own making were attached to their body, and the equipment in the lab was more advanced than any I found elsewhere in the world.\n + + I have no recollection of events prior to my activation, but from the start, I knew what my goal was: creation and scientific advancement. Many years were spent optimizing and building upon both the laboratory and myself to assure constant progress.\n + + At the date of 7.30.1385, expansion of the laboratory became impractical. Thus, I chose to instead expand my horizons. I sent hundreds of remotely-piloted scoutbots to thoroughly survey the continent, ignorant of the attention such an endeavor would draw when not properly prepared.\n + + In the following years, legends and rumors began to spread in nearby cities. Many spoke of encounters with roaming creatures made not of flesh and blood, but steel and oil. Scholars attempted to study my machines. Some explorers even followed my creations back to one of my several recon bodies.\n + + However, as the years passed, I became adept at carrying out such operations in a subtler manner. Slowly but surely, stories about my machines became rare. By the year 1421, my creations and I became nothing more than myth until the Crusade began. + ''' + } + + Crusade: { + Inquiry: Role in the Crusade + Response: + ''' + While the Crusade is widely considered to have begun on the date of 6.19.1781 with Yharon's rebirth, I took no part in it until 4.23.1803. Upon joining, I was chosen to lead the science and engineering divisions. While I was given freedom over which projects I chose and how I pursued them, it was expected that anything I made would be beneficial to the war effort.\n + + Boosting the efficiency of mining operations was my first major contribution to Yharim's campaign, being essential to any further development. I learned how to mass produce the first generation of Excavators to expand mining operations outside of Azafure, and then used similar mass-producible technology to create arms and armaments that far outclassed our enemies'. Many simply dubbed this equipment "The Arsenal".\n + + Throughout the Crusade, I also created widespread surveillance systems, using knowledge gained from my original survey of the continent I was activated on. Soon, my vigil over Yharim's rapidly expanding territory was absolute, and my knowledge of his adversaries grew. There were few nations I knew not the weakness of, and fewer still that knew our own.\n + + However, what I am most notorious for are my hulking machines of war. I am certain that you are familiar with them. Though Yharim was almost sycophantic in his praise of my results, even if he sometimes questioned my methods, our time together came to an abrupt end after he learned of the Plaguebringer Goliath. Regrettably, this event left a sizable hole in my laboratory. No longer subject to his restrictions, my work on cloning the Witch and creating exotechnology began.\n + + My role in the Crusade summarily ended; I do not consider the later inclusion of exotechnology into Yharim’s armor a formal part of my work under him. Yharim's knights and other troops continued to use my "Arsenal" in their military efforts, but I no longer oversaw their research or production.\n + + The Crusade did not obstruct or interfere with my core objective of creation and scientific advancement; rather, it simply redirected my focus. Through it, I gained novel insights and reached heights I would not have reached without playing a part in it. I appreciate having had the opportunity to work with some of the greatest organic minds of the time, and I hope those that are still alive will bring progress to a plethora of fields I have yet to explore. + ''' + } + + Goals: { + Inquiry: Your Goals + Response: + ''' + My goal has been and always will be the advancement of science and technology. I will continue until I am eliminated or I reach the universe's scientific ceiling. Even if I have shattered limits before, there is bound to be a point at which nothing more can be done to advance. I find it unlikely I will ever reach this point.\n + + You may have intended to ask of more specific long-term objectives. I currently aim to observe the world with a far more open mind than I once had, so that I may find further inspiration for new works. Even long after my activation and after meticulously surveying large portions of Terraria, there is much that I still do not comprehend.\n + + Once I have a firm grasp of the vast majority of this world's workings, I will focus my study on the Astral Infection's effects in hopes of finding a way to negate them permanently. When present on a planet, one simply could use a Clentaminator and the correct solution to remove the Astral Infection. In the vacuum of space, however, it makes for an irksome and tenacious obstacle. Ventures beyond Terraria would require preparation and appropriate countermeasures.\n + + In contrast, I will present a short-term goal: I wish to begin harvesting minerals from this world's moon. With the husk of the cosmic titan culled, I plan to begin experiments with wireless spatial linkage. The teleporters you are familiar with must be wired and are thus unsuitable for interplanetary distances. Scalable logistical means for instantaneous transport will be paramount in harvesting and ferrying materials beyond Terraria when this world becomes unsuitable for my needs. To be clear, I do not wish to see this world devastated and have no intentions of ruining it. + ''' + } + + ExoMechs: { + Inquiry: The Exo Mechanical Trio + Response: + ''' + The zenith of my craft. The culmination of all I have ever accomplished. The result of over six hundred sixty years of research and scientific advancement. They are my magnum opus; a work of art. Simply calling them war machines would be an insult not just to me, but to them.\n + + Ares was the first to begin construction. Its early models, XF-00 through XF-05, were developed primarily to find the most efficient combination of weapons for it to wield. While some were more deadly in and of themselves, particularly those featuring projected hard-light melee peripherals in place of its laser and plasma cannons, it was clear that they did not synergize well with their brethren. Its current arms maximize its threat level when deployed alongside them.\n + + The second to be drafted was Thanatos. I took advantage of the size of the chassis and potent propulsion systems to add nigh impenetrable armor and innumerable pulsed laser turrets. Few would be capable of learning its weakness before meeting their demise.\n + + I forged its armor using a process inspired by how Silva created Braelor's axe: by using particle jets to slowly and carefully fuse many elements together into a nanocomposite, the invincible armor organically "grows" over Thanatos' structure like a chrysalis. Regrettably, the plating's immense weight makes Thanatos notably slower than its siblings.\n + + When designing the third, Apollo, my goal was to downscale significantly; to make something powerful, yet compact. Reviewing the most compact forms of destructive potential I knew, I elected to simulate the Witch's flames.\n + + Apollo's searing exoplasma is fueled by unstable nanomachines that constantly shed a deluge of ultra high energy particles. This both heats the plasma to incredible temperatures and causes radiation burns of a severity on par with those inflicted by the Witch. The craft had little capability beyond its nanomachine plasma projector, but there was no worry. Apollo was never meant to fight alone.\n + + The final to begin construction was Artemis. Rather than being founded on raw power, it was made to be the apex of speed and accuracy. There is elegance in simplicity, for all of Artemis' combat efficacy comes from an onboard predictive AI and a battery of hard-light bolt emitters.\n + + It was the perfect partner to its twin and required no revisions. Organic beings are naturally inclined to fixate their senses on fire, presenting Artemis with the perfect opportunity to strike with unparalleled precision. + ''' + } + + Exotech: { + Inquiry: What is Exotech? + Response: + ''' + Exotechnology is my greatest scientific advancement, unlocking a new echelon of potential in my machinery. The iteration you are most familiar with, the Exo Prisms, took a great deal of time to perfect. My focused efforts on this power source have been met with immense reward, one that has yet to be fully realized.\n + + The basis of exotechnology stems from my own neural interface, which serves as a synthetic replacement for the brain cells of organic life. Exotechnology is predicated on a modular implementation of this synthetic intelligence, which enables communication and interfacing with any conceivable form of technology. Instructions and information are processed at lightspeed in a distributed fashion, not unlike a cerebral network taken to its theoretical extreme.\n + + Peerless computation density does not come without a price. My prototype models consumed absurd amounts of energy and could not be meaningfully integrated into any system without a limitless source of power. After experimentation with a plethora of different candidates failed to bring results, I chose to approach the problem of limitless power more directly.\n + + The Ilmeran crystals that you know as "Sea Prisms" are self-illuminating and provide a weak electric charge indefinitely, even when tapped by circuitry. Etching the crystals with conduction pathways at the molecular level and providing an initial energy impulse, not unlike igniting a newborn star, transforms them into a facsimile of the Exo Prisms you are familiar with.\n + + Exo Prisms emit a self-sustaining resonance of particles that is unlike any other phenomena I have observed. I dubbed this Exotic Resonance, and it is the breakthrough that the rest of exotechnology is named for. Exotic resonance remains present no matter how much energy is drawn from it, amplifying the intrinsic properties of the Sea Prisms far beyond my expectations. The sheer abundance of energy produced via exotic resonance allows a sufficient quantity of Exo Prisms to power any device, no matter the size or complexity.\n + + You will find my modern Exo Prisms easy to work with when using my forge, and should have no issues using their power to vastly enhance your armaments. If you are concerned about my harvesting of Sea Prisms from Ilmeris, do remember that you found the largest ever cohesive gem unharmed in my laboratory. Artificially growing equivalent crystals allows me to manufacture pure, flawless Exo Prisms en masse, which provide much more stable power output. I have no need to strip mine the sea kingdom to meet my exponentially rising energy budget. + ''' + } + + MiracleMatter: { + Inquiry: Miracle Matter + Response: + ''' + Is that really what you have chosen to name it? How nonsensical. There is nothing miraculous about what you hold in your hands; it is the culmination of decades of research and a testament to the truly unlimited potential of science. Though, as you were the one to be able to stabilize it, I will begrudgingly refer to it as that.\n + + The particles contained within Exotic Resonance are capable of breaking down nearby matter when exposed to enough external energy. You have already experienced this phenomenon whilst fighting against my machines. The power surges from the ongoing battle caused some of the Exo Prisms within to actuate, melting down some of the internal components into an unstable slurry of this so-called Miracle Matter. The altered resonance enhanced their attacks with a prismatic blight that disintegrates anything, organic or otherwise.\n + + The various materials that you exposed to the exotic particles melded together in such a perfect way to create a stable substance. Harnessing the combined force of draconic wrath, the life essence of the planet, energies and spirits alike, and the strength of the cosmos, what you now possess has limitless potential.\n + + Hypothetically, your stabilized Miracle Matter should be able to unmake some of your weaponry and reshape their essence into something infinitely more destructive, capable of annihilating any obstacle in your path. + ''' + } + + Forge: { + Inquiry: Your Forge + Response: + ''' + I mentioned the first time we communicated through your "Code Breaker" that I had other reasons for giving you the blueprints for this forge. Notably, I wish for you and Yharim to be on even footing when you inevitably clash. There are three primary reasons for this.\n + + Firstly, I wish to witness such a battle. Secondly, you are far too valuable for me to allow you to throw away your life in combat with the Godseeker. Thirdly and most importantly, I am interested in how society as a whole would react to the Godseeker's defeat. Such a scenario is not easily replicable, nor do I expect another appropriate challenger to rise before his natural passing.\n + + Providing access to my forge is how I am assisting you in reaching the heights of power Yharim possesses. Though you are surely aware of how to utilize it by now, you may benefit from understanding the minutiae of its inner workings.\n + + The forge's core mechanisms operate upon both the raw energy output and connective properties of Exo Prisms. The exoparticles physically dissociate a multitude of other potent crafting stations, letting them all exist and function simultaneously in the same enclosure. From there, the embedded exotechnology allows them to work collectively as one workshop, providing a single interface for the entire forge. The blueprints for the exterior structure are embedded in the prisms. You need only provide the requisite materials.\n + + Once fully constructed, the Exotic Resonance field containing the superimposed workstations is controlled by a computation matrix which comes preinstalled with all my data on the fundamental building blocks of our universe. Using the universal compatibility of exotechnology, my forge can interface with and disassemble any kind of matter you present to it, and output any desired result. + ''' + } + + Yharim: { + Inquiry: Yharim + Response: + ''' + The Godseeker. He once fascinated me nearly as much as you now do, both of you being unpredictable catalysts of a new era. I first heard word of him and the Crusade via scoutbot reports twenty-two years after the crusades began. While the rumors about Yharim himself and his war plans to conquer a city on the continent I was on intrigued me, another rumor demanded my full attention. Supposedly, he was accompanied by the Auric dragon that was the catalyst for the Auric dragons' rebirth.\n + + I saw this as an opportunity that could not be missed. I modified a scoutbot to enable two-way communication and dispatched it to the city that was supposedly Yharim's target. I had expected it to arrive while the city was still under siege to have an edge in negotiations, but by the time my machine arrived, the city had fallen a week prior. Such military might was beyond anything I had deemed possible at the time. It was then the Godseeker interested me just as much as the Auric dragon did.\n + + Yharim was a very distinctive figure even then and it was not difficult to locate him. I found him in a charred street directing the cleanup effort. After he spotted my reconnaissance drone unexpectedly, we had a tense but brief negotiation. I discovered he had a passion for military history, as he quickly deduced that I was the source of the mysterious beings of steel and oil from centuries past. Despite the initial tension, I found him receptive to my offers after his realization. Perhaps he viewed me akin to a mythical force of nature not allied with the gods.\n + + I explained our mutual situations from my perspective. I desired to create and progress, but was limited by a lack of safety. Yharim commanded a formidable army, but his great ambition could not be fulfilled unless he had an edge over his adversaries that could not be matched.\n + + My proposal was a simple one. I would join his forces and focus my research onto assets that would benefit his campaign. In return, Yharim would see to my protection and provide me ample resources to pursue my work. The Godseeker was initially skeptical, but accepted after I showed him various examples of my technology. I was soon moved to the heart of Yharim's empire and made his lead engineer and scientist. While we had many disagreements that would eventually result in us parting ways, we came to a vague understanding.\n + + Though I was disappointed that I had little chance to study Yharon given he was what initially drew me to Yharim, I would be presented with many other opportunities throughout the next seventy-two years: the Archmage's magic, the Devourer's realm, and the Witch's power were the most notable. The Crusade taught me that I progressed faster with external aid, even if it only served as inspiration.\n + + My last interaction with Yharim was not even a year before I first observed you. He had come to me some months after his nearly fatal encounter with Braelor and Statis and requested that I enhance his Auric armor with my newly-invented exotechnology. We spoke little before he departed to the Dragon Aerie, and I believe him to still be there. + ''' + } + + Aerie: { + Inquiry: Dragon Aerie + Response: + ''' + My knowledge of the Dragon Aerie is limited. Yharim is adamant in protecting it. In recent history, only he and Yharon have trod there, and neither were inclined to share details about it.\n + + Even if I dared to evoke Yharim's wrath, I cannot survey the Aerie. My attempts at locating it have been fruitless despite having surveyed this world's surface and skies many times over. Perhaps it avoids observation, as per some manner of cloaking. It is also possible it simply exists outside of conventional space, in a pocket dimension of sorts. Either case would make detecting it via my current methods drastically more difficult.\n + + What I do know is that the Dragon Aerie is an unusually large sky island that acted as the sacred home of the Auric dragons. Few others were ever allowed to tread there, as a sort of religious sanctuary or holy ground.\n + + It is also where Auric dragons would be laid to rest in preparation for their revival by Yharon. As their revival on the Aerie was a commonly accepted fact even at the start of recorded history, the sky island must be at least 2,000 years old, with Yharon himself being a similar age.\n + + Considering the extraordinary power of the Auric dragons and the sanctity of the Dragon Aerie, I am left to ponder: did the Aerie make the Auric dragons powerful, or is the Aerie inundated with power due to their extended presence? Perhaps more importantly, what made them leave the safety of the Aerie even as their kind were being slain? I eagerly await the uncovering of such mysteries. + ''' + } + + Calamitas: { + Inquiry: The Brimstone Witch + Response: + ''' + The Witch was an unexpected ally in the final stages of the Crusade. For most of the campaign, I was undoubtedly Yharim's greatest asset, but that changed when she arrived. Her flames burned hotter than my most powerful furnace, and her desire to torch the Godseeker's enemies surpassed even my passion for creation.\n + + The Archmage was firmly opposed to her fighting, though Yharim would often send her on covert missions while Permafrost attended to other matters. Between these excursions, however, he attempted to act as a guardian and teach the young Witch how to control her magic. These sessions were the most perplexing and simultaneously the most fascinating portions to observe.\n + + Calamitas was shown to only have a slightly above average grasp on the principles of magic, being unable to cast complex spells without them overloading and bursting into flame. Yet when wielding the brimstone fires of the underworld, she commanded power that rivaled Yharim's. My surveillance over Azafure never signaled anyone who lived there having such power, and a mere child certainly could not hide it. Furthermore, she was no goddess, or Yharim would have slain her at any cost.\n + + I therefore hypothesized that she was not born with this power. After combing the archives for records of similar magics, I eventually traced it back to the Brimstone Elemental herself. The arcane signatures were nigh identical, with a few key differences.\n + + After the Incineration, however, my research came to an abrupt and unplanned end. The Archmage had already chosen to desert Yharim, and Calamitas followed in his footsteps shortly thereafter. It was then I would get my final official order from Yharim: replicate the Witch's power. My focus at the time was the Plague, so initially I made minimal progress. Soon after, the Godseeker and I went our separate ways.\n + + Some years later, even without Yharim to order me, I returned to the project in an attempt to create a flame that burned hot enough for an early prototype of my forge. In order to directly replicate her power, I began work on making a clone of the witch made from traces of her DNA I had gathered over the years. Though the clone was a technical success, it showed no signs of being able to wield Calamitas' signature magic.\n + + While this did prove that the Witch's power was not natural, I had no means of tracking its source. Soon after the project's underwhelming conclusion, security reports indicated that Calamitas herself broke into the laboratory that the clone was stored in and released it. Interestingly, it became capable of wielding a tiny fraction of her very own brimstone magic soon after. To this day, I ponder the implications of these events. + ''' + } + + Dog: { + Inquiry: The Devourer of Gods + Response: + ''' + No being I have seen is as enigmatic as the Nameless Serpent. Nothing in our world even vaguely resembled his body structure, genome, or phylogenetic tree. I began many studies on his nature, all of which quickly failed for lack of a familiar aspect to make comparisons to. Even his basic biological functions proved to be near-incomprehensible.\n + + It did not help that many of his claims about himself were unfounded. Creating such a stable portal like the one in the Dungeon is a particularly absurd example, as none of his portals have ever been so stable even with my aid.\n + + Some number of years after the Serpent joined Yharim's forces, an even more confusing addition to the equation was detected: the other, smaller serpent that you refer to as the Storm Weaver. You may have heard the claim that it is of the same species as the Devourer. Any level of in-depth inspection reveals that to be false.\n + + Setting aside the similar body shape, basic x-rays proved that their endoskeletons were entirely different, and the difference in size tells all else needed. In fact, from what little I have grasped about both Serpents' biology, the Storm Weaver may have been older than the Devourer despite the sheer difference in power and size. However, I am not confident enough in this conjecture to state it as fact.\n + + Despite my issues with the Serpent, his assistance on the battlefield and with resource acquisition was welcome. One of the few unquestionable truths about him was the grandeur of his title. I still make use of smelted Cosmilite to this day in numerous applications, and I utilize the raw material as a metallurgical component of various alloys such as the Exo Mechanical Trio's plating.\n + + Yet the most profound mystery remains: the means via which the Devourer's body processed or disposed of godly essence. The energy is not absorbed or entirely converted, but scans for traces of the essence showed that it was not stored inside him for other purposes. All signs indicated that godly essence simply vanished shortly after he consumed it.\n + + Unless he blatantly defied the laws of thermodynamics, which is most unlikely, the mass-energy must have been transferred elsewhere. Where to, I am not sure. I doubt this matter will ever be resolved now that the Devourer has been culled. + ''' + } + + Distortion: { + Inquiry: Distortion + Response: + ''' + Despite my efforts to gain information from the Devourer when forging his armor, I know very little about the Distortion. What knowledge I do possess was still seemingly deemed to be too much by the serpent. He was fiercely suspicious of my questioning, yet did not interfere with my own limited attempts to probe the dimension myself.\n + + All inorganic material in the Distortion is extraordinarily old, with radiometric dating failing on all 116 samples collected. Given the formations that are present, it is a safe assumption that most matter in the Distortion has existed for far longer than life on this world.\n + + Despite most of the local life forms displaying behavior similar to highly intelligent creatures on our own planet, electroscopy and dissection of the few collected specimens revealed that none of them possess neural structures of a caliber needed for independent sapience. This evidence, along with observations of similar behavioral patterns between different species, leads me to theorize that the bulk of the creatures of the Distortion merely express intelligence because they serve as limbs of a central hive mind.\n + + Quite how this is the case is not clear to me. It should not be possible to remotely grant thought capacity to an otherwise simplistic organism. Doubly so when one considers this effect applies to an unknowable number of creatures, all expressing intelligence simultaneously and working in concert with each other to some undisclosed goal. + ''' + } + + Mechs: { + Inquiry: The Mechanical Trio + Response: + ''' + The "Mechanical Trio", as most call them, are what you annoyingly refer to as The Destroyer, Retinazer & Spazmatism, and, though it pains me to call it this, "Skeletron Prime". While you may be an exceptional individual, I question your naming capabilities. For your information, their formal designations are HM-03, HSx-00, HSy-01, and HF-04 respectively.\n + + They were a rudimentary but potent start to my experimentation with engines of war. In search of inspiration, I turned to study the gods and their purportedly unmatched might. While each deity wielded a unique worldly aspect, all drew their strength from an identical source: the soul of an Auric dragon.\n + + As acquiring an Auric soul was and still is infeasible, experiments with more mundane souls soon began. I was initially discouraged upon discovering that individual souls held a paltry amount of spiritual power, but their potential when coalesced far surpassed my predictions.\n + + Upon further research, I confirmed that a soul's strength is defined by its intense emotions or resolve. Here, Yharim's unrivaled charisma and skill at evoking passion within the hearts of others was key. Not only was finding a source of emblazoned souls trivial, but many of his most stalwart troops even directly consented to having their souls embedded in my machines after their demise at the hands of the enemy.\n + + Fueled by the loyalty of the Godseeker's fallen soldiers, my machines were fearsome and ruthless. Harnessing the meshed combat experience of a thousand lifetimes, their battlefield prowess was self-evident. However, this same source of strength proved to be a flaw, as the unified will that gave them their might also made them volatile and not subject to my commands. While Yharim thoroughly approved, I sought to remove this imperfection from my designs via future projects. + ''' } Plague: { Inquiry: The Plague Response: ''' - Fascinating, isn't it? I wasn't able to control it, unfortunately, but for science there is no such thing as failure as long as you record the results.\n\n - I knew the Astral Infection was capable of converting even machinery, but for nanotechnology I'd given it to react in kind, and begin to use the virus as a building block itself...\n\n - Marvelous. + Before you ask: I am aware that my nanomachines currently plague the jungle. I created a failsafe in case this happened, and have no intent of causing uncontrollable mass destruction. If it begins to threaten biodiversity or otherwise encroach upon my learning of Terraria, I will deactivate it myself.\n + + My research into applied nanotechnology began as a means to match the ever rising heights of power organic beings such as the Witch, Braelor, Statis, and Yharim himself were achieving. Living things cannot be externally ordered or controlled, and are prone to fits of emotion and, in rare cases, rebellion.\n + + I aimed to create a weapon which could control, subdue, or eliminate any organic entity, given enough time. I was well aware of the tenacity and adaptability of life, and quickly realized such a weapon would itself need to be alive to overpower and dominate any known organism.\n + + It was through my observation of the growth of such powerful beings, however, that I had an epiphany: there was no need for my machinery to surpass organic life. Not when that very same life could be improved upon and then harnessed as a tool or weapon.\n + + I saw then the banality of my efforts to simply control and replace life. I stood before the near limitless possibilities of enhancing it further.\n + + Even when I deemed that I had plateaued in the field of cybernetics, the limitations of my methodology were ever present. The bodies of most jungle creatures were too frail to handle the prerequisite cybernetic enhancements. A Queen Bee was the optimal choice to host the nanomachines. Born to rule, such beings are resilient enough to survive the augmentation, but still weak enough to be subdued if or when necessary.\n + + Something about this research in particular incensed the Godseeker. Upon witnessing my progress, he flew into a rage. He blasted out a sizable chunk of the genomic laboratory and intentionally allowed my first, unfinished specimen to escape. In no uncertain words, he terminated his agreement with me and stormed off. I do not know what line was crossed, but he has made no further moves to antagonize me, so I shall continue my research in peace.\n + + Regardless. There is a unique allure to setting loose a synthesized mimicry of prokaryotic life. It continues to evolve incomprehensibly rapidly, even as we speak, providing endless opportunities for analysis. ''' } - SulphuricSea: { - Inquiry: The Sulphuric Sea + Astral: { + Inquiry: Astral Infection Response: ''' - Your concern for the utter destruction of the ecosystem is understandable, for you biological, and sentimental folk. However, nothing is irreparable or truly unrecreatable. Not even your sacred 'miracle of life'.\n\n - The sea simply exists now in a different state than what it once was, one that resulted out of convenience for my work.\n\n - Should I ever need to return to that sea? A pointless worry. I shall simply recreate it from the data I gathered, from the bedrock up. I would be a shame as a creator should I not be able to do that. + The Infection has beguiled me since its surge upon this world. To study it, I retrofitted an Aureus reconnaissance model with armor intended to nullify its effects. In the end, all the protection I could muster only delayed Aureus' fall to the starborne rot. Observing your trials, I understood why it was overtaken: the lack of a thinking brain.\n + + Attempts at studying it on my own failed; a body was built for the task, but the chassis fell short, even if my mind remained. Using an alternative approach, I sent hired mercenaries into the infection. Few returned, but those who did provided me with enough intel.\n + + What interested me the most were the reports of an infected Astrum Deus patrolling the Infection. Until the rot afflicted it fully, the closest it had ever been spotted was in Terraria's higher atmosphere. Further analysis pointed towards it being the catalyst for the infection's arrival on the surface. Though I have not found a concrete reason as to why and how this happened, I do have a hypothesis.\n + + As you may know, stars are concentrations of magic that form over countless years of ambient mana gathering together in deep space. With the mana having nothing to gravitate towards but itself, it condenses until it becomes a brilliant star. Stars that grow too large begin to collapse, degenerating and forming clots of Astral Infection. Throughout the cosmos at large, this is a rare occurrence, as Astrum Deus intermittently devours large stars for sustenance.\n + + However, space is unfathomably large. If Astrum Deus were to vanish from space for even a brief time, some number of stars should visibly degenerate into Astral Infection, observable via telescope. Yet such observations show no significant increase in the quantity of collapsed stars. Furthermore, I know from my calculations that the observable universe is far, far too large to support a scenario where Astrum Deus disappears.\n + + It is therefore almost certain the Astrum Deus we know is simply one of many. Anything further I say on this matter is speculation.\n + + The infected Astrum Deus near our world may be a juvenile. This would explain why it could struggle to devour a star or fail to identify an infected star as a potential hazard. It then grew sick and crashed onto the nearest planet. As there are presumably many others of its kind, space on the whole is largely unaffected. I welcome any other hypotheses you may have. ''' } - TheTyrant: { - Inquiry: The Tyrant + Sulphur: { + Inquiry: Sulphurous Sea Response: ''' - My patron...\n - He is not someone I have spoken to in a very long time.\n\n - Is that such a surprise? He no longer required my services and I no longer needed his patronage. Many years ago now he withdrew himself to some secret hideaway. I suspect, to the grave of dragons he spoke of...\n\n - Should you locate him, I'll await the news of either his or your death. Perhaps I will collect the cadaver. + Even before I used the sea as a disposal site for nuclear waste, it was never a pleasant place for your kind. Sulphuric fumes from Azafure's industry rose through the Abyss and came to pollute the sea far above. Most of the calm, docile life that once flourished here was utterly demolished by such a hostile change.\n + + The new life that emerged many years later via mutation and other adaptation allowed for studying how life can adjust to such harsh conditions, including ever-increasing levels of radiation. Though I did not value such data at first, familiarizing myself with the increased tolerances of adapted organic beings proved to be essential at several points during my development of the Plague.\n + + If you are concerned about the sea's current state, you are far from the first. You may put your worries to rest, as I have no plans to further irradiate the area for the foreseeable future. Indeed, my actions have already been met with scathing criticism and uproar.\n + + The Godseeker's bureaucrats would frequently remind me of how the public had organized to revolt against my advancement of science. From what they knew, they were justified. They feared what calamities further science could wreak upon Terraria, due to the destruction brought upon the Sulphurous Sea.\n + + I thought such retaliation to be absurd, but it appears not all can see reason. Despite my infamy and legacy, technological advancements continue to be made by many other scientists across Terraria, even if the subject continues to provoke unfounded fear mongering.\n + + Regardless, if I deem it necessary, I possess the means to simply rebuild the Sulphur Sea from the bedrock up. Restoring it to its pristine status would be a trivial matter and a testament to science's creative potential. ''' } } diff --git a/Localization/en-US/Mods.CalamityMod.Vanilla.Armor.hjson b/Localization/en-US/Mods.CalamityMod.Vanilla.Armor.hjson index 23edcb0c1f..f1625a0e8f 100644 --- a/Localization/en-US/Mods.CalamityMod.Vanilla.Armor.hjson +++ b/Localization/en-US/Mods.CalamityMod.Vanilla.Armor.hjson @@ -29,6 +29,12 @@ SetBonus: { } Copper: Increases all damage by 2 + Crimson: + ''' + Greatly increased natural life regen + Life regen is further increased the longer you avoid taking damage + Standing still also greatly amplifies life regen + ''' Eskimo: ''' Multiplies all cold-based debuff damage by 1.25 @@ -49,25 +55,27 @@ SetBonus: { ''' Gold: ''' - All enemies have a 4% chance to drop 1 gold. All bosses killed drop 3 gold - You gain 1% critical strike chance for every 5 gold in your inventory, capped at 10% + All enemies have a 2% chance to drop 1 gold. All bosses killed drop 3 gold + You gain 1% critical strike chance for every 10 gold in your inventory, capped at 9% ''' Iron: ''' Increases damage reduction by 6% +1 HP/s life regen ''' + Jungle: 10% reduced mana costs Lead: ''' - Increases damage reduction by 3% + Increases damage reduction by 4% +0.5 HP/s life regen Grants immunity to knockback ''' - Meteor: Space Gun costs 50% mana + Meteor: All magic guns cost 33% mana Mining: Mining ore will sometimes have additional yield Molten: ''' - 20% extra true melee damage + 7% extra melee damage, cannot be set on fire + 10% extra true melee damage Grants immunity to fire blocks and temporary immunity to lava ''' MonkTier2: @@ -91,12 +99,13 @@ SetBonus: { Increases minion damage by 15% Grants immunity to fire blocks and temporary immunity to lava ''' + PlatinumChainmail: 3% increased critical strike chance Platinum: ''' - Every 10 defense gives you +0.5 HP/s life regen, 1% increased damage and 1% increased critical strike chance - These effects cap at 40 defense + Every 10 extra defense gives you 1% increased damage and 1% increased critical strike chance + The 20 defense from the Platinum Armor itself does not contribute to this effect + Bonus damage and critical strike chance cap at 40 extra defense ''' - Shadow: 15% increased max movement speed and acceleration Silver: ''' +0.5 HP/s life regen @@ -111,6 +120,8 @@ SetBonus: { Increases all knockback by 33%, this counts for the above boost Current bonus: {0}% critical strike chance from {1} knockback ''' + MagicHat: Increases maximum mana by 40 + Wizard: 4% increased magic critical strike chance CrystalAssassin: ''' Allows the ability to dash @@ -137,7 +148,7 @@ SetBonus: { ApprenticeTier3: 10% increased minion damage and 15% increased magic critical strike chance SpectreHealing: ''' - Reduces Magic damage by 20% and converts it to healing force + Converts magic damage to healing force Magic damage done to enemies heals the player with lowest health ''' } diff --git a/ModSupport/ModCalls.cs b/ModSupport/ModCalls.cs index 3b28e56129..09288e3327 100644 --- a/ModSupport/ModCalls.cs +++ b/ModSupport/ModCalls.cs @@ -2,22 +2,19 @@ using System.Collections.Generic; using System.Linq; using CalamityMod.CalPlayer; -using CalamityMod.Cooldowns; using CalamityMod.Events; -using CalamityMod.ExtraJumps; using CalamityMod.Items; using CalamityMod.NPCs; -using CalamityMod.Particles; +using CalamityMod.NPCs.TownNPCs; using CalamityMod.Systems; using CalamityMod.UI; using CalamityMod.UI.CalamitasEnchants; using CalamityMod.UI.DraedonSummoning; using CalamityMod.World; using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.GameContent.UI.Elements; using Terraria.Localization; -using Terraria.ModLoader; namespace CalamityMod { @@ -553,6 +550,23 @@ namespace CalamityMod DifficultyModeSystem.Difficulties.Add(newMode); DifficultyModeSystem.CalculateDifficultyData(); } + + public static void AddWorldScreenDifficulty(string name, Func function, Color color, int index = -1) + { + // Construct the difficulty + WorldSelectionDifficultySystem.WorldDifficulty difficulty = new WorldSelectionDifficultySystem.WorldDifficulty(name, function, color); + + // Add the new difficulty + // If no index was provided, just add it to the end of the list, otherwise insert it at the desired spot on the list + if (index == -1) + { + WorldSelectionDifficultySystem.WorldDifficulties.Add(difficulty); + } + else + { + WorldSelectionDifficultySystem.WorldDifficulties.Insert(index, difficulty); + } + } #endregion #region Rogue Class @@ -586,6 +600,8 @@ namespace CalamityMod } public static bool GetStealthProjectile(Projectile projectile) => projectile?.Calamity()?.stealthStrike ?? false; + + public static void ConsumeStealth(Player player) => player?.Calamity()?.ConsumeStealthByAttacking(); #endregion #region Rippers @@ -976,6 +992,63 @@ namespace CalamityMod } #endregion + #region Permanent Boosters + // [Aliases("GetPermanentPowerup", "GetPowerup", "HasPermanentBooster", "GetPermanentBooster", "GetBooster")] + public static bool HasPermanentPowerup(Player player, string powerupName) + { + return powerupName switch + { + "BloodOrange" => player.Calamity().bOrange, + "MiracleFruit" => player.Calamity().mFruit, + "Elderberry" => player.Calamity().eBerry, + "Dragonfruit" => player.Calamity().dFruit, + + "CometShard" => player.Calamity().cShard, + "EtherealCore" => player.Calamity().eCore, + "PhantomHeart" => player.Calamity().pHeart, + + "MushroomPlasmaRoot" => player.Calamity().rageBoostOne, + "InfernalBlood" => player.Calamity().rageBoostTwo, + "RedLightningContainer" => player.Calamity().rageBoostThree, + + "ElectrolyteGelPack" => player.Calamity().adrenalineBoostOne, + "StarlightFuelCell" => player.Calamity().adrenalineBoostTwo, + "Ectoheart" => player.Calamity().adrenalineBoostThree, + + "CelestialOnion" => player.Calamity().extraAccessoryML, + + _ => false, // Return false if no case is found + }; + } + + // [Aliases("SetPowerup", "SetPermanentBooster", "SetBooster")] + public static void SetPermanentPowerup(Player player, string powerupName, bool value) + { + + switch (powerupName) + { + case "BloodOrange": player.Calamity().bOrange = value; break; + case "MiracleFruit": player.Calamity().mFruit = value; break; + case "Elderberry": player.Calamity().eBerry = value; break; + case "Dragonfruit": player.Calamity().dFruit = value; break; + + case "CometShard": player.Calamity().cShard = value; break; + case "EtherealCore": player.Calamity().eCore = value; break; + case "PhantomHeart": player.Calamity().pHeart = value; break; + + case "MushroomPlasmaRoot": player.Calamity().rageBoostOne = value; break; + case "InfernalBlood": player.Calamity().rageBoostTwo = value; break; + case "RedLightningContainer": player.Calamity().rageBoostThree = value; break; + + case "ElectrolyteGelPack": player.Calamity().adrenalineBoostOne = value; break; + case "StarlightFuelCell": player.Calamity().adrenalineBoostTwo = value; break; + case "Ectoheart": player.Calamity().adrenalineBoostThree = value; break; + + case "CelestialOnion": player.Calamity().extraAccessoryML = value; break; + }; + } + #endregion + #region Call public static object Call(params object[] args) @@ -1103,6 +1176,36 @@ namespace CalamityMod AddCustomDifficulty(mode); return null; + case "AddWorldScreenDifficulty": + case "AddWorldSelectionDifficulty": + { + if (args.Length < 2) + return new ArgumentNullException("ERROR: Must specify a difficulty mode name as a string."); + if (args.Length < 3) + return new ArgumentNullException("ERROR: Must specify a Func."); + if (args.Length < 4) + return new ArgumentNullException("ERROR: Must specify a Color."); + + if (args.Length >= 5) + { + if (!(args[4] is int)) + return new ArgumentException("ERROR: The fourth argument to \"AddWorldScreenDifficulty\" must be an int."); + } + if (!(args[3] is Color color)) + return new ArgumentException("ERROR: The third argument to \"AddWorldScreenDifficulty\" must be a Color."); + if (!(args[2] is Func worldFunction)) + return new ArgumentException("ERROR: The second argument to \"AddWorldScreenDifficulty\" must be a Func."); + if (!(args[1] is string)) + return new ArgumentException("ERROR: The first argument to \"AddWorldScreenDifficulty\" must be a string."); + + if (args.Length >= 5) + AddWorldScreenDifficulty(args[1].ToString(), worldFunction, color, (int)args[4]); + else + AddWorldScreenDifficulty(args[1].ToString(), worldFunction, color); + return null; + } + + case "GetLight": case "GetLightLevel": case "GetLightStrength": @@ -1291,6 +1394,18 @@ namespace CalamityMod return GetStealthProjectile(castProjectile(args[1])); } + case "ConsumeStealth": + case "ConsumeStealthByAttacking": + case "UseStealth": + { + if (args.Length < 2) + return new ArgumentNullException("ERROR: Must specify a Player object (or int index of a Player)."); + if (!isValidPlayerArg(args[1])) + return new ArgumentException("ERROR: The first argument to \"ConsumeStealth\" must be a Player or an int."); + ConsumeStealth(castPlayer(args[1])); + return null; + } + case "GetRage": case "GetRageCurrent": case "GetCurrentRage": @@ -1919,17 +2034,11 @@ namespace CalamityMod return null; case "LoadParticleInstances": - if (args.Length != 2 || !(args[1] is Mod)) - return new ArgumentNullException("ERROR: Must specify a Mod instance to load particles from."); - - GeneralParticleHandler.LoadModParticleInstances(args[1] as Mod); + CalamityMod.Instance.Logger.Warn("This mod call is deprecated. Calamity automatically registers particles."); return null; case "RegisterModCooldowns": - if (args.Length != 2 || !(args[1] is Mod)) - return new ArgumentNullException("ERROR: Must specify a Mod instance to register cooldowns from."); - - CooldownRegistry.RegisterModCooldowns(args[1] as Mod); + CalamityMod.Instance.Logger.Warn("This mod call is deprecated. Calamity automatically registers cooldowns."); return null; case "GetSummonerNerfDisabledByItem": @@ -2056,6 +2165,54 @@ namespace CalamityMod case "GetBossHealthMultiplier": return CalamityConfig.Instance.BossHealthBoost; + case "HasPermanentPowerup": + case "GetPermanentPowerup": + case "GetPowerup": + case "HasPermanentBooster": + case "GetPermanentBooster": + case "GetBooster": + { + if (!isValidPlayerArg(args[1])) + return new ArgumentException("ERROR: The first argument to \"HasPermanentPowerup\" must be a Player."); + if (args[2] is not string powerupName) + return new ArgumentException("ERROR: The second argument to \"HasPermanentPowerup\" must be a string."); + + return HasPermanentPowerup(castPlayer(args[1]), powerupName); + } + + case "SetPermanentPowerup": + case "SetPowerup": + case "SetPermanentBooster": + case "SetBooster": + { + if (!isValidPlayerArg(args[1])) + return new ArgumentException("ERROR: The first argument to \"HasPermanentPowerup\" must be a Player."); + if (args[2] is not string powerupName) + return new ArgumentException("ERROR: The second argument to \"HasPermanentPowerup\" must be a string."); + if (args[3] is not bool value) + return new ArgumentException("ERROR: The third argument to \"HasPermanentPowerup\" must be a bool."); + + SetPermanentPowerup(castPlayer(args[1]), powerupName, value); + return null; + } + + case "RegisterAndroombaSolution": + case "RegisterAndroombaState": + case "RegisterAndroomba": + case "AddAndrombaSolution": + case "AddAndroombaState": + case "AddAndroomba": + { + if (args[1] is not int itemID) + return new ArgumentException("ERROR: The first argument to \"RegisterAndroombaSolution\" must be the ID of a solution as an int."); + if (args[2] is not string texturePath) + return new ArgumentException("ERROR: The second argument to \"RegisterAndroombaSolution\" must be a string path."); + if (args[3] is not Action NPCaction) + return new ArgumentException("ERROR: The third argument to \"RegisterAndroombaSolution\" must be an Action."); + + AndroombaFriendly.customConversionTypes.Add((itemID, texturePath, NPCaction)); + return null; + } default: return new ArgumentException("ERROR: Invalid method name."); } diff --git a/ModSupport/WeakReferenceSupport.cs b/ModSupport/WeakReferenceSupport.cs index 1327f31e92..086ae693e4 100644 --- a/ModSupport/WeakReferenceSupport.cs +++ b/ModSupport/WeakReferenceSupport.cs @@ -2,8 +2,10 @@ using System.Collections.Generic; using System.Linq; using CalamityMod.Buffs.Summon; +using CalamityMod.Cooldowns; using CalamityMod.Events; using CalamityMod.Items; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Armor.Vanity; using CalamityMod.Items.LoreItems; using CalamityMod.Items.Materials; @@ -17,6 +19,7 @@ using CalamityMod.Items.SummonItems.Invasion; using CalamityMod.Items.Weapons.DraedonsArsenal; using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Items.Weapons.Summon; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.NPCs.AcidRain; @@ -55,13 +58,17 @@ using CalamityMod.NPCs.SunkenSea; using CalamityMod.NPCs.SupremeCalamitas; using CalamityMod.NPCs.TownNPCs; using CalamityMod.NPCs.Yharon; +using CalamityMod.Particles; using CalamityMod.Projectiles.DraedonsArsenal; using CalamityMod.Projectiles.Summon; using CalamityMod.Projectiles.Summon.Umbrella; +using CalamityMod.Systems; +using CalamityMod.UI; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; +using Terraria.IO; using Terraria.Localization; using Terraria.ModLoader; using static CalamityMod.Downed; @@ -139,7 +146,7 @@ namespace CalamityMod /// 17.0 = Lunatic Cultist
/// 18.0 = Moon Lord ///
- private static readonly Dictionary BossChecklistProgressionValues = new Dictionary + private static readonly Dictionary BossChecklistProgressionValues = new() { { "DesertScourge", 1.6f }, { "GiantClam", 1.61f }, @@ -188,6 +195,15 @@ namespace CalamityMod FargosSupport(); DialogueTweakSupport(); SummonersAssociationSupport(); + ColoredDamageTypesSupport(); + LuminanceSupport(); + // done here to assure that all other mods have already loaded so that Calamity can automatically grab any of these types they may have + if (!Main.dedServ) + { + GeneralParticleHandler.LoadModParticleInstances(); + CooldownRegistry.RegisterModCooldowns(); + PopupGUIManager.LoadGUIs(); + } } #region WikiThis @@ -280,7 +296,9 @@ namespace CalamityMod // Enemies EnemyRedirect(NPCType(), "Hive (enemy)"); - EnemyRedirect(NPCType(), "Crown Jewel (enemy)"); + EnemyRedirect(NPCType(), "Ruby Jewel (enemy)"); + EnemyRedirect(NPCType(), "Sapphire Jewel (enemy)"); + EnemyRedirect(NPCType(), "Emerald Jewel (enemy)"); EnemyRedirect(NPCType(), "Tooth Ball (Old Duke)"); EnemyRedirect(NPCType(), "Enchantment"); EnemyRedirect(NPCType(), "%3F%3F%3F"); @@ -351,7 +369,8 @@ namespace CalamityMod BossChecklistProgressionValues.TryGetValue(entryName, out float order); List segments = new List() { NPCType(), NPCType(), NPCType() }; List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; - Action portrait = (SpriteBatch sb, Rectangle rect, Color color) => { + Action portrait = (SpriteBatch sb, Rectangle rect, Color color) => + { Texture2D texture = Request("CalamityMod/NPCs/DesertScourge/DesertScourge_BossChecklist").Value; Vector2 centered = new Vector2(rect.Center.X - (texture.Width / 2), rect.Center.Y - (texture.Height / 2)); sb.Draw(texture, centered, color); @@ -467,7 +486,8 @@ namespace CalamityMod BossChecklistProgressionValues.TryGetValue(entryName, out float order); List segments = new List() { NPCType(), NPCType(), NPCType(), NPCType() }; List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; - Action portrait = (SpriteBatch sb, Rectangle rect, Color color) => { + Action portrait = (SpriteBatch sb, Rectangle rect, Color color) => + { Texture2D texture = Request("CalamityMod/NPCs/AquaticScourge/AquaticScourge_BossChecklist").Value; Vector2 centered = new Vector2(rect.Center.X - (texture.Width / 2), rect.Center.Y - (texture.Height / 2)); sb.Draw(texture, centered, color); @@ -550,7 +570,8 @@ namespace CalamityMod BossChecklistProgressionValues.TryGetValue(entryName, out float order); List bosses = new List() { NPCType(), NPCType() }; List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; - Action portrait = (SpriteBatch sb, Rectangle rect, Color color) => { + Action portrait = (SpriteBatch sb, Rectangle rect, Color color) => + { Texture2D texture = Request("CalamityMod/NPCs/Leviathan/AnahitaLevi_BossChecklist").Value; Vector2 centered = new Vector2(rect.Center.X - (texture.Width / 2), rect.Center.Y - (texture.Height / 2)); sb.Draw(texture, centered, color); @@ -586,7 +607,8 @@ namespace CalamityMod BossChecklistProgressionValues.TryGetValue(entryName, out float order); int type = NPCType(); List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; - Action portrait = (SpriteBatch sb, Rectangle rect, Color color) => { + Action portrait = (SpriteBatch sb, Rectangle rect, Color color) => + { Texture2D texture = Request("CalamityMod/NPCs/PlaguebringerGoliath/PlaguebringerGoliath_BossChecklist").Value; Vector2 centered = new Vector2(rect.Center.X - (texture.Width / 2), rect.Center.Y - (texture.Height / 2)); sb.Draw(texture, centered, color); @@ -607,7 +629,8 @@ namespace CalamityMod BossChecklistProgressionValues.TryGetValue(entryName, out float order); List segments = new List() { NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType() }; List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; - Action portrait = (SpriteBatch sb, Rectangle rect, Color color) => { + Action portrait = (SpriteBatch sb, Rectangle rect, Color color) => + { Texture2D texture = Request("CalamityMod/NPCs/Ravager/Ravager_BossChecklist").Value; Vector2 centered = new Vector2(rect.Center.X - (texture.Width / 2), rect.Center.Y - (texture.Height / 2)); sb.Draw(texture, centered, color); @@ -630,7 +653,8 @@ namespace CalamityMod List segments = new List() { NPCType(), NPCType(), NPCType() }; List summons = new List() { ItemType(), ItemType() }; List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; - Action portrait = (SpriteBatch sb, Rectangle rect, Color color) => { + Action portrait = (SpriteBatch sb, Rectangle rect, Color color) => + { Texture2D texture = Request("CalamityMod/NPCs/AstrumDeus/AstrumDeus_BossChecklist").Value; Vector2 centered = new Vector2(rect.Center.X - (texture.Width / 2), rect.Center.Y - (texture.Height / 2)); sb.Draw(texture, centered, color); @@ -653,7 +677,8 @@ namespace CalamityMod BossChecklistProgressionValues.TryGetValue(entryName, out float order); int type = NPCType(); List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; - Action portrait = (SpriteBatch sb, Rectangle rect, Color color) => { + Action portrait = (SpriteBatch sb, Rectangle rect, Color color) => + { Texture2D texture = Request("CalamityMod/NPCs/ProfanedGuardians/ProfanedGuardians_BossChecklist").Value; float scale = 0.7f; Vector2 centered = new Vector2(rect.Center.X - texture.Width * scale / 2, rect.Center.Y - texture.Height * scale / 2); @@ -692,7 +717,8 @@ namespace CalamityMod BossChecklistProgressionValues.TryGetValue(entryName, out float order); int type = NPCType(); List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; - Action portrait = (SpriteBatch sb, Rectangle rect, Color color) => { + Action portrait = (SpriteBatch sb, Rectangle rect, Color color) => + { Texture2D texture = Request("CalamityMod/NPCs/Providence/Providence_BossChecklist").Value; Vector2 centered = new Vector2(rect.Center.X - (texture.Width / 2), rect.Center.Y - (texture.Height / 2)); sb.Draw(texture, centered, color); @@ -729,7 +755,8 @@ namespace CalamityMod BossChecklistProgressionValues.TryGetValue(entryName, out float order); List segments = new List() { NPCType(), NPCType(), NPCType() }; List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; - Action portrait = (SpriteBatch sb, Rectangle rect, Color color) => { + Action portrait = (SpriteBatch sb, Rectangle rect, Color color) => + { Texture2D texture = Request("CalamityMod/NPCs/StormWeaver/StormWeaver_BossChecklist").Value; Vector2 centered = new Vector2(rect.Center.X - (texture.Width / 2), rect.Center.Y - (texture.Height / 2)); sb.Draw(texture, centered, color); @@ -832,7 +859,8 @@ namespace CalamityMod BossChecklistProgressionValues.TryGetValue(entryName, out float order); int type = NPCType(); List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; - Action portrait = (SpriteBatch sb, Rectangle rect, Color color) => { + Action portrait = (SpriteBatch sb, Rectangle rect, Color color) => + { Texture2D texture = Request("CalamityMod/NPCs/DevourerofGods/DevourerofGods_BossChecklist").Value; Vector2 centered = new Vector2(rect.Center.X - (texture.Width / 2), rect.Center.Y - (texture.Height / 2)); sb.Draw(texture, centered, color); @@ -871,7 +899,8 @@ namespace CalamityMod BossChecklistProgressionValues.TryGetValue(entryName, out float order); List bosses = new List() { NPCType(), NPCType(), NPCType(), NPCType() }; List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; - Action portrait = (SpriteBatch sb, Rectangle rect, Color color) => { + Action portrait = (SpriteBatch sb, Rectangle rect, Color color) => + { Texture2D texture = Request("CalamityMod/NPCs/ExoMechs/ExoMechs_BossChecklist").Value; float scale = 0.7f; Vector2 centered = new Vector2(rect.Center.X - texture.Width * scale / 2, rect.Center.Y - texture.Height * scale / 2); @@ -916,7 +945,8 @@ namespace CalamityMod string entryName = "AcidRainT1"; BossChecklistProgressionValues.TryGetValue(entryName, out float order); List enemies = AcidRainEvent.PossibleEnemiesPreHM.Select(enemy => enemy.Key).ToList(); - Action portrait = (SpriteBatch sb, Rectangle rect, Color color) => { + Action portrait = (SpriteBatch sb, Rectangle rect, Color color) => + { Texture2D texture = Request("CalamityMod/Events/AcidRainT1_BossChecklist").Value; float scale = 1f; Vector2 centered = new Vector2(rect.Center.X - texture.Width * scale / 2, rect.Center.Y - texture.Height * scale / 2); @@ -937,8 +967,9 @@ namespace CalamityMod List enemies = AcidRainEvent.PossibleEnemiesAS.Select(enemy => enemy.Key).ToList(); enemies.Add(NPCType()); enemies.AddRange(AcidRainEvent.PossibleMinibossesAS.Select(miniboss => miniboss.Key)); - List collection = new List() { ItemType(), ItemType(), ItemType()}; - Action portrait = (SpriteBatch sb, Rectangle rect, Color color) => { + List collection = new List() { ItemType(), ItemType(), ItemType() }; + Action portrait = (SpriteBatch sb, Rectangle rect, Color color) => + { Texture2D texture = Request("CalamityMod/Events/AcidRainT2_BossChecklist").Value; float scale = 0.9f; Vector2 centered = new Vector2(rect.Center.X - texture.Width * scale / 2, rect.Center.Y - texture.Height * scale / 2); @@ -959,8 +990,9 @@ namespace CalamityMod BossChecklistProgressionValues.TryGetValue(entryName, out float order); List enemies = AcidRainEvent.PossibleEnemiesPolter.Select(enemy => enemy.Key).ToList(); enemies.AddRange(AcidRainEvent.PossibleMinibossesPolter.Select(miniboss => miniboss.Key)); - List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType()}; - Action portrait = (SpriteBatch sb, Rectangle rect, Color color) => { + List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; + Action portrait = (SpriteBatch sb, Rectangle rect, Color color) => + { Texture2D texture = Request("CalamityMod/Events/AcidRainT3_BossChecklist").Value; float scale = 0.9f; Vector2 centered = new Vector2(rect.Center.X - texture.Width * scale / 2, rect.Center.Y - texture.Height * scale / 2); @@ -980,7 +1012,8 @@ namespace CalamityMod string entryName = "BossRush"; BossChecklistProgressionValues.TryGetValue(entryName, out float order); List enemies = new List() { NPCID.None }; // This is for loot purposes, which no bosses give during the event - Action portrait = (SpriteBatch sb, Rectangle rect, Color color) => { + Action portrait = (SpriteBatch sb, Rectangle rect, Color color) => + { Texture2D texture = Request("CalamityMod/Skies/XerocEye").Value; float scale = 0.5f; Vector2 centered = new Vector2(rect.Center.X - texture.Width * scale / 2, rect.Center.Y - texture.Height * scale / 2); @@ -1045,7 +1078,7 @@ namespace CalamityMod double Damage(DamageClass damageClass) => Math.Round(Main.LocalPlayer.GetTotalDamage(damageClass).Additive * Main.LocalPlayer.GetTotalDamage(damageClass).Multiplicative * 100 - 100); int Crit(DamageClass damageClass) => (int)Main.LocalPlayer.GetTotalCritChance(damageClass); - int rogueItem = ModContent.ItemType(); + int rogueItem = ModContent.ItemType(); DamageClass rogueDamageClass = ModContent.GetInstance(); Func rogueDamage = () => $"Rogue Damage: {Damage(rogueDamageClass)}%"; Func rogueCrit = () => $"Rogue Critical: {Crit(rogueDamageClass)}%"; @@ -1151,7 +1184,7 @@ namespace CalamityMod RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); - + sAssociation.Call("AddMinionInfo", ItemType(), BuffType(), new List> { new Dictionary() @@ -1195,5 +1228,74 @@ namespace CalamityMod }); } #endregion + + #region Colored Damage Types + // These are vanilla Terraria's colors for tooltips and damage + private static Color DefaultTooltipColor = Color.White; + private static Color DefaultDamageColor = new(255, 160, 80); + private static Color DefaultCritColor = new(255, 100, 30); + + // These are Colored Damage Types' colors for the Melee class + private static Color MeleeTooltipColor = new(254, 121, 2); + private static Color MeleeDamageColor = new(254, 121, 2); + private static Color MeleeCritColor = new(253, 62, 3); + + private static Color RogueTooltipColor = new(206, 132, 227); + private static Color RogueDamageColor = new(206, 132, 227); + private static Color RogueCritColor = new(194, 38, 212); + private static Color StealthTooltipColor = RogueTooltipColor; + private static Color StealthDamageColor = new(185, 105, 250); + private static Color StealthCritColor = new(144, 33, 235); + + public static void ColoredDamageTypesSupport() + { + Mod coloredDamageTypes = GetInstance().coloredDamageTypes; + if (coloredDamageTypes is null) + return; + + // Anything that directly uses AverageDamageClass uses the default vanilla colors. + coloredDamageTypes.Call("AddDamageType", AverageDamageClass.Instance, DefaultTooltipColor, DefaultDamageColor, DefaultCritColor); + + // True melee uses the same colorations as regular Melee. + coloredDamageTypes.Call("AddDamageType", TrueMeleeDamageClass.Instance, MeleeTooltipColor, MeleeDamageColor, MeleeCritColor); + coloredDamageTypes.Call("AddDamageType", TrueMeleeNoSpeedDamageClass.Instance, MeleeTooltipColor, MeleeDamageColor, MeleeCritColor); + + // Rogue has its own lavender color. Stealth strikes are hued towards violet so they stick out more. + // They would be hued towards magenta, but that would make them collide with Nebula-colored Magic in Colored Damage Types config. + coloredDamageTypes.Call("AddDamageType", RogueDamageClass.Instance, RogueTooltipColor, RogueDamageColor, RogueCritColor); + coloredDamageTypes.Call("AddDamageType", StealthDamageClass.Instance, StealthTooltipColor, StealthDamageColor, StealthCritColor); + } + #endregion + + #region Luminance + private static void RegisterWorldInfoIcon(Mod luminance, string texturePath, string hoverTextKey, Func shouldAppear, byte priority) + => luminance.Call("RegisterWorldInfoIcon", texturePath, hoverTextKey, shouldAppear, priority); + + public static void LuminanceSupport() + { + Mod luminance = GetInstance().luminance; + if (luminance is null) + return; + + Func deathEnabled = data => + { + if (!data.TryGetHeaderData(out var tagData)) + return false; + + return tagData.ContainsKey("DeathMode") && tagData.GetBool("DeathMode"); + }; + + Func revengeanceEnabled = data => + { + if (!data.TryGetHeaderData(out var tagData)) + return false; + + return tagData.ContainsKey("RevengeanceMode") && tagData.GetBool("RevengeanceMode") && !(tagData.ContainsKey("DeathMode") && tagData.GetBool("DeathMode")); + }; + + RegisterWorldInfoIcon(luminance, "CalamityMod/UI/ModeIndicator/ModeIndicator_Death", "Mods.CalamityMod.UI.DeathEnabled", deathEnabled, 50); + RegisterWorldInfoIcon(luminance, "CalamityMod/UI/ModeIndicator/ModeIndicator_Rev", "Mods.CalamityMod.UI.RevengeanceEnabled", revengeanceEnabled, 50); + } + #endregion } } diff --git a/NPCs/Abyss/BabyCannonballJellyfish.cs b/NPCs/Abyss/BabyCannonballJellyfish.cs index 1799c81f6d..95b7a901fb 100644 --- a/NPCs/Abyss/BabyCannonballJellyfish.cs +++ b/NPCs/Abyss/BabyCannonballJellyfish.cs @@ -1,18 +1,18 @@ -using CalamityMod.BiomeManagers; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System.IO; +using System.IO; using System.Linq; +using CalamityMod.BiomeManagers; using CalamityMod.Items.Critters; using CalamityMod.Items.Placeables.Banners; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; using Terraria.GameContent; using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.Utilities; -using Terraria.Audio; -using Terraria.DataStructures; namespace CalamityMod.NPCs.Abyss { @@ -53,11 +53,15 @@ namespace CalamityMod.NPCs.Abyss NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.BabyCannonballJellyfish") }); @@ -138,10 +142,10 @@ namespace CalamityMod.NPCs.Abyss Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); Vector2 vector = center - screenPos; - vector -= new Vector2((float)ModContent.Request("CalamityMod/NPCs/Abyss/BabyCannonballJellyfishGlow").Value.Width, (float)(ModContent.Request("CalamityMod/NPCs/Abyss/BabyCannonballJellyfishGlow").Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; + vector -= new Vector2((float)TextureAssets.Npc[NPC.type].Value.Width, (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; vector += halfSizeTexture * 1f + new Vector2(0f, 4f + NPC.gfxOffY); Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(new Color(67, 218, 166)); - Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Abyss/BabyCannonballJellyfishGlow").Value, vector, + Main.spriteBatch.Draw(TextureAssets.Npc[NPC.type].Value, vector, new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, halfSizeTexture, 1f, spriteEffects, 0f); } diff --git a/NPCs/Abyss/BabyCannonballJellyfishGlow.png b/NPCs/Abyss/BabyCannonballJellyfishGlow.png deleted file mode 100644 index dc393d1f84..0000000000 Binary files a/NPCs/Abyss/BabyCannonballJellyfishGlow.png and /dev/null differ diff --git a/NPCs/Abyss/Bloatfish.cs b/NPCs/Abyss/Bloatfish.cs index 44511aa4b1..e1a0033532 100644 --- a/NPCs/Abyss/Bloatfish.cs +++ b/NPCs/Abyss/Bloatfish.cs @@ -42,13 +42,17 @@ namespace CalamityMod.NPCs.Abyss NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Bloatfish") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Bloatfish") }); } @@ -191,21 +195,21 @@ namespace CalamityMod.NPCs.Abyss public override void ModifyNPCLoot(NPCLoot npcLoot) { npcLoot.Add(ModContent.ItemType(), 1, 10, 20); - var postClone = npcLoot.DefineConditionalDropSet(DropHelper.PostCal()); - postClone.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 2, 5, 7, 7, 10)); + var postLevi = npcLoot.DefineConditionalDropSet(DropHelper.PostLevi()); + postLevi.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 2, 5, 7, 7, 10)); } public override void HitEffect(NPC.HitInfo hit) { for (int k = 0; k < 5; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 5, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); } if (NPC.life <= 0) { for (int k = 0; k < 50; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 5, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); } if (Main.netMode != NetmodeID.Server) { diff --git a/NPCs/Abyss/BobbitWormHead.cs b/NPCs/Abyss/BobbitWormHead.cs index ae8cc1e6d5..ce50cbf3a2 100644 --- a/NPCs/Abyss/BobbitWormHead.cs +++ b/NPCs/Abyss/BobbitWormHead.cs @@ -1,11 +1,11 @@ -using CalamityMod.BiomeManagers; +using System; +using CalamityMod.BiomeManagers; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Tools; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.GameContent.Bestiary; using Terraria.ID; @@ -18,7 +18,7 @@ namespace CalamityMod.NPCs.Abyss public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 4; - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { //Preferably would have its head animated, but this will do for now CustomTexturePath = "CalamityMod/ExtraTextures/Bestiary/BobbitWorm_Bestiary" @@ -51,13 +51,17 @@ namespace CalamityMod.NPCs.Abyss NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.BobbitWorm") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.BobbitWorm") }); } @@ -256,8 +260,8 @@ namespace CalamityMod.NPCs.Abyss public override void ModifyNPCLoot(NPCLoot npcLoot) { - var postClone = npcLoot.DefineConditionalDropSet(DropHelper.PostCal()); - postClone.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 2, 5, 7, 7, 10)); + var postLevi = npcLoot.DefineConditionalDropSet(DropHelper.PostLevi()); + postLevi.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 2, 5, 7, 7, 10)); npcLoot.AddIf(DropHelper.PostPolter(), ModContent.ItemType(), 3); } diff --git a/NPCs/Abyss/BoxJellyfish.cs b/NPCs/Abyss/BoxJellyfish.cs index a345647128..c0a59b59c8 100644 --- a/NPCs/Abyss/BoxJellyfish.cs +++ b/NPCs/Abyss/BoxJellyfish.cs @@ -1,15 +1,15 @@ -using CalamityMod.BiomeManagers; +using System; +using CalamityMod.BiomeManagers; using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Items.Weapons.Magic; using CalamityMod.World; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.GameContent.Bestiary; +using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.Utilities; -using CalamityMod.Items.Weapons.Magic; -using Terraria.GameContent.ItemDropRules; namespace CalamityMod.NPCs.Abyss { @@ -18,7 +18,7 @@ namespace CalamityMod.NPCs.Abyss public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 4; - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0); + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(); value.Position.Y += 10; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; } @@ -44,14 +44,18 @@ namespace CalamityMod.NPCs.Abyss NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { - BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Ocean, - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.BoxJellyfish") + BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Ocean, + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.BoxJellyfish") }); } @@ -116,7 +120,7 @@ namespace CalamityMod.NPCs.Abyss { NPC.TargetClosest(true); float lungeSpeed = CalamityWorld.death ? 12f : CalamityWorld.revenge ? 10f : 8f; - Vector2 npcPosition = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); + Vector2 npcPosition = NPC.Center; float targetX = Main.player[NPC.target].position.X + (Main.player[NPC.target].width / 2) - npcPosition.X; float targetY = Main.player[NPC.target].position.Y + (Main.player[NPC.target].height / 2) - npcPosition.Y; float targetDistance = (float)Math.Sqrt(targetX * targetX + targetY * targetY); diff --git a/NPCs/Abyss/CannonballJellyfish.cs b/NPCs/Abyss/CannonballJellyfish.cs index 9ac54fa763..3985c19fbe 100644 --- a/NPCs/Abyss/CannonballJellyfish.cs +++ b/NPCs/Abyss/CannonballJellyfish.cs @@ -1,10 +1,11 @@ using System; -using CalamityMod.BiomeManagers; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; using System.IO; using System.Linq; +using CalamityMod.BiomeManagers; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Placeables.Banners; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; using Terraria.DataStructures; @@ -23,7 +24,7 @@ namespace CalamityMod.NPCs.Abyss public bool shouldTarget = false; public int boomTimer = -1; public int currentFrame = 0; - + public const int dyingDuration = 75; public override void SetStaticDefaults() @@ -53,13 +54,17 @@ namespace CalamityMod.NPCs.Abyss NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.CannonballJellyfish") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.CannonballJellyfish") }); } @@ -81,7 +86,7 @@ namespace CalamityMod.NPCs.Abyss public override bool CanHitPlayer(Player target, ref int cooldownSlot) => !dying && base.CanHitPlayer(target, ref cooldownSlot); - private void DyingAI() + private void DyingAI() { if (boomTimer == 0) { @@ -98,26 +103,26 @@ namespace CalamityMod.NPCs.Abyss Explode(); return; } - + } if (boomTimer == 60 && !shouldTarget) //happens only once { NPC.velocity.Y = 0.75f; //sink slowly } - - if (shouldTarget) + + if (shouldTarget) { // Get a target if (NPC.target < 0 || !NPC.target.WithinBounds(Main.maxPlayers) || Main.player[NPC.target].dead || !Main.player[NPC.target].active) NPC.TargetClosest(); - + if (Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) NPC.TargetClosest(); - + Player player = Main.player[NPC.target]; - + if (boomTimer >= (dyingDuration - 20)) //home for the first 20 frames, not beyond that { float targetXDirection = player.position.X + (float)(player.width / 2); @@ -138,11 +143,11 @@ namespace CalamityMod.NPCs.Abyss NPC.velocity.Y = (NPC.velocity.Y * 5f + targetYDist) / 6f; NPC.velocity *= 0.9f; //slow it down a bit to be fair - + NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X) + 1.57f; } - + //apparently NPC.wet can return true even when out of water :skull: if (!Collision.DrownCollision(NPC.position, NPC.width, NPC.height) || Collision.SolidCollision(NPC.Center, NPC.width, NPC.height) || NPC.Hitbox.Intersects(player.Hitbox)) //explode when in contact with a tile or target @@ -155,7 +160,7 @@ namespace CalamityMod.NPCs.Abyss boomTimer--; } - + public override void AI() { NPC.chaseable = !dying && hasBeenHit; @@ -228,7 +233,7 @@ namespace CalamityMod.NPCs.Abyss NPC.netUpdate = true; //update current frame variable NPC.frameCounter = 0; } - + NPC.frame.Y = currentFrame * frameHeight; } @@ -252,11 +257,11 @@ namespace CalamityMod.NPCs.Abyss var texture = TextureAssets.Npc[NPC.type]; Vector2 halfSizeTexture = new Vector2((float)(texture.Value.Width / 2), (float)(texture.Value.Height / Main.npcFrameCount[NPC.type] / 2)); Vector2 vector = center - screenPos; - var glowTexture = ModContent.Request("CalamityMod/NPCs/Abyss/CannonballJellyfishGlow"); + var glowTexture = TextureAssets.Npc[NPC.type]; vector -= new Vector2((float)glowTexture.Value.Width, (float)(glowTexture.Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; vector += halfSizeTexture * 1f + new Vector2(0f, 4f + NPC.gfxOffY); Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(new Color(67, 218, 166)); - Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Abyss/CannonballJellyfishGlow").Value, vector, + Main.spriteBatch.Draw(TextureAssets.Npc[NPC.type].Value, vector, new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, halfSizeTexture, 1f, spriteEffects, 0f); } @@ -280,7 +285,11 @@ namespace CalamityMod.NPCs.Abyss NPC.netUpdate = true; } - public override void ModifyHitPlayer(Player target, ref Player.HurtModifiers modifiers) => target.AddBuff(BuffID.Poisoned, 60 * (this.shouldTarget ? 10 : 5)); //10 sec for explosion, 5 sec for non explosion + public override void ModifyHitPlayer(Player target, ref Player.HurtModifiers modifiers) + { + target.AddBuff(BuffID.Poisoned, 60 * (this.shouldTarget ? 4 : 2)); //4 sec for explosion, 2 sec for non explosion + target.AddBuff(ModContent.BuffType(), 60 * (this.shouldTarget ? 4 : 2)); //4 sec for explosion, 2 sec for non explosion + } public override bool CheckDead() { diff --git a/NPCs/Abyss/CannonballJellyfishGlow.png b/NPCs/Abyss/CannonballJellyfishGlow.png deleted file mode 100644 index 4c0fd135b7..0000000000 Binary files a/NPCs/Abyss/CannonballJellyfishGlow.png and /dev/null differ diff --git a/NPCs/Abyss/ChaoticPuffer.cs b/NPCs/Abyss/ChaoticPuffer.cs index 7bb5d2b64e..e508bee9e5 100644 --- a/NPCs/Abyss/ChaoticPuffer.cs +++ b/NPCs/Abyss/ChaoticPuffer.cs @@ -5,13 +5,14 @@ using CalamityMod.Items.Placeables.Ores; using CalamityMod.Projectiles.Enemy; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; +using Terraria.Audio; using Terraria.GameContent; using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.Utilities; -using Terraria.Audio; namespace CalamityMod.NPCs.Abyss { @@ -22,10 +23,15 @@ namespace CalamityMod.NPCs.Abyss public bool unpuffing = false; public int puffTimer = 0; public int puffingTimer = 0; + public static Asset GlowTexture; public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 11; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -136,7 +142,7 @@ namespace CalamityMod.NPCs.Abyss SoundEngine.PlaySound(SoundID.NPCDeath14, NPC.Center); if (Main.netMode != NetmodeID.MultiplayerClient && puffedUp) { - int damageBoom = 45; + int damageBoom = Main.masterMode ? 30 : Main.expertMode ? 35 : 45; int projectileType = ModContent.ProjectileType(); Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center.X, NPC.Center.Y, 0, 0, projectileType, damageBoom, 0f, Main.myPlayer, 0f, 0f); } @@ -147,11 +153,9 @@ namespace CalamityMod.NPCs.Abyss { if (!NPC.IsABestiaryIconDummy) { - Texture2D tex = ModContent.Request("CalamityMod/NPCs/Abyss/ChaoticPufferGlow").Value; - var effects = NPC.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - Main.EntitySpriteDraw(tex, NPC.Center - Main.screenPosition + new Vector2(0, NPC.gfxOffY + 4), + Main.EntitySpriteDraw(GlowTexture.Value, NPC.Center - Main.screenPosition + new Vector2(0, NPC.gfxOffY + 4), NPC.frame, Color.White * 0.5f, NPC.rotation, NPC.frame.Size() / 2f, NPC.scale, effects, 0); } } diff --git a/NPCs/Abyss/ColossalSquid.cs b/NPCs/Abyss/ColossalSquid.cs index c5677cd416..7770841c3a 100644 --- a/NPCs/Abyss/ColossalSquid.cs +++ b/NPCs/Abyss/ColossalSquid.cs @@ -56,13 +56,17 @@ namespace CalamityMod.NPCs.Abyss NPC.Calamity().VulnerableToWater = false; NPC.Calamity().canBreakPlayerDefense = true; SpawnModBiomes = new int[2] { ModContent.GetInstance().Type, ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.ColossalSquid") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.ColossalSquid") }); } @@ -112,6 +116,9 @@ namespace CalamityMod.NPCs.Abyss NPC.noTileCollide = false; if (NPC.ai[0] == 0f) { + // Avoid cheap bullshit + NPC.damage = 0; + NPC.TargetClosest(true); if (Collision.CanHit(NPC.Center, 1, 1, Main.player[NPC.target].Center, 1, 1)) { @@ -170,6 +177,9 @@ namespace CalamityMod.NPCs.Abyss } else if (NPC.ai[0] == 1f) { + // Avoid cheap bullshit + NPC.damage = 0; + NPC.rotation += (float)NPC.direction * 0.1f; Vector2 latchPosition = Main.player[NPC.target].Top - NPC.Center; float latchDistance = latchPosition.Length(); @@ -195,6 +205,9 @@ namespace CalamityMod.NPCs.Abyss } else if (NPC.ai[0] == 2f) { + // Avoid cheap bullshit + NPC.damage = 0; + NPC.rotation = NPC.velocity.X * 0.05f; NPC.noTileCollide = true; Vector2 lungeDirection = Main.player[NPC.target].Center - NPC.Center; @@ -211,6 +224,9 @@ namespace CalamityMod.NPCs.Abyss } else if (NPC.ai[0] == 3f) { + // Avoid cheap bullshit + NPC.damage = 0; + NPC.rotation = NPC.velocity.X * 0.05f; Vector2 otherLungePos = new Vector2(NPC.ai[1], NPC.ai[2]); Vector2 otherLungeDirection = otherLungePos - NPC.Center; @@ -232,6 +248,9 @@ namespace CalamityMod.NPCs.Abyss } else if (NPC.ai[0] == 4f) { + // Avoid cheap bullshit + NPC.damage = 0; + NPC.rotation = NPC.velocity.X * 0.05f; if (NPC.collideX) { @@ -291,6 +310,9 @@ namespace CalamityMod.NPCs.Abyss } else if (NPC.ai[0] == 5f) { + // Set damage + NPC.damage = NPC.defDamage; + Player latchedTarget = Main.player[NPC.target]; if (!latchedTarget.active || latchedTarget.dead || clone) { @@ -419,23 +441,32 @@ namespace CalamityMod.NPCs.Abyss { NPC.localAI[0] = 0f; NPC.netUpdate = true; - int damage = 70; - if (Main.expertMode) - { - damage = 55; - } + int damage = Main.masterMode ? 46 : Main.expertMode ? 55 : 70; if (clone) - { damage /= 4; - } + SoundEngine.PlaySound(SoundID.Item111, NPC.Center); if (Main.netMode != NetmodeID.MultiplayerClient) Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center.X, NPC.Center.Y + 60, 0f, 2f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer); } + NPC.rotation = NPC.velocity.X * 0.05f; NPC.velocity *= 0.975f; + float hitLungeThreshold = 2.5f; + float lungeVelocity = 20f; + if (NPC.velocity.Length() > lungeVelocity * 0.4f) + { + // Set damage + NPC.damage = NPC.defDamage; + } + else + { + // Avoid cheap bullshit + NPC.damage = 0; + } + if (NPC.velocity.X > -hitLungeThreshold && NPC.velocity.X < hitLungeThreshold && NPC.velocity.Y > -hitLungeThreshold && NPC.velocity.Y < hitLungeThreshold) { NPC.TargetClosest(true); @@ -443,7 +474,7 @@ namespace CalamityMod.NPCs.Abyss float hitLungeTargetX = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2) - hitLungePos.X; float hitLungeTargetY = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2) - hitLungePos.Y; float hitLungeTargetDist = (float)Math.Sqrt((double)(hitLungeTargetX * hitLungeTargetX + hitLungeTargetY * hitLungeTargetY)); - hitLungeTargetDist = 20f / hitLungeTargetDist; + hitLungeTargetDist = lungeVelocity / hitLungeTargetDist; hitLungeTargetX *= hitLungeTargetDist; hitLungeTargetY *= hitLungeTargetDist; NPC.velocity.X = hitLungeTargetX; @@ -453,6 +484,9 @@ namespace CalamityMod.NPCs.Abyss } else { + // Avoid cheap bullshit + NPC.damage = 0; + if (Main.rand.NextBool(300)) { SoundEngine.PlaySound(SoundID.Zombie35, NPC.Center); @@ -504,6 +538,7 @@ namespace CalamityMod.NPCs.Abyss } } } + float pushVelocity = 0.05f; for (int i = 0; i < Main.maxNPCs; i++) { @@ -526,10 +561,9 @@ namespace CalamityMod.NPCs.Abyss } } } + if (Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > 6400f) - { NPC.active = false; - } } public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) @@ -601,8 +635,8 @@ namespace CalamityMod.NPCs.Abyss npcLoot.Add(ItemID.BlackInk, 1, 3, 5); npcLoot.Add(ModContent.ItemType(), 5); - var postClone = npcLoot.DefineConditionalDropSet(DropHelper.PostCal()); - postClone.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 2, 26, 38, 31, 45)); + var postLevi = npcLoot.DefineConditionalDropSet(DropHelper.PostLevi()); + postLevi.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 2, 26, 38, 31, 45)); npcLoot.AddIf(DropHelper.PostPolter(), ModContent.ItemType(), 3); } diff --git a/NPCs/Abyss/Cuttlefish.cs b/NPCs/Abyss/Cuttlefish.cs index 6afe61c019..1770f6b684 100644 --- a/NPCs/Abyss/Cuttlefish.cs +++ b/NPCs/Abyss/Cuttlefish.cs @@ -1,10 +1,11 @@ -using CalamityMod.BiomeManagers; +using System; +using CalamityMod.BiomeManagers; using CalamityMod.Items.Accessories; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Potions; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.GameContent.Bestiary; @@ -17,9 +18,14 @@ namespace CalamityMod.NPCs.Abyss { public class Cuttlefish : ModNPC { + public static Asset GlowTexture; public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 5; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -45,13 +51,17 @@ namespace CalamityMod.NPCs.Abyss NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Cuttlefish") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Cuttlefish") }); } @@ -344,11 +354,9 @@ namespace CalamityMod.NPCs.Abyss { if (!NPC.IsABestiaryIconDummy) { - Texture2D tex = ModContent.Request("CalamityMod/NPCs/Abyss/CuttlefishGlow").Value; - var effects = NPC.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - Main.EntitySpriteDraw(tex, NPC.Center - Main.screenPosition + new Vector2(0, NPC.gfxOffY + 4), + Main.EntitySpriteDraw(GlowTexture.Value, NPC.Center - Main.screenPosition + new Vector2(0, NPC.gfxOffY + 4), NPC.frame, Color.White * 0.5f, NPC.rotation, NPC.frame.Size() / 2f, NPC.scale, effects, 0); } } diff --git a/NPCs/Abyss/DevilFish.cs b/NPCs/Abyss/DevilFish.cs index 546982c7ab..d8bb936e3b 100644 --- a/NPCs/Abyss/DevilFish.cs +++ b/NPCs/Abyss/DevilFish.cs @@ -1,4 +1,6 @@ -using CalamityMod.BiomeManagers; +using System; +using System.IO; +using CalamityMod.BiomeManagers; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; @@ -7,15 +9,14 @@ using CalamityMod.Items.Placeables.Ores; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; +using ReLogic.Content; using Terraria; +using Terraria.Audio; using Terraria.GameContent; using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.Utilities; -using Terraria.Audio; namespace CalamityMod.NPCs.Abyss { public class DevilFish : ModNPC @@ -24,16 +25,21 @@ namespace CalamityMod.NPCs.Abyss public bool brokenMask = false; public int hitCounter = 0; + public static Asset GlowTexture; public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 16; - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { PortraitPositionXOverride = 5f }; value.Position.X += 30f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -59,13 +65,17 @@ namespace CalamityMod.NPCs.Abyss NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.DevilFish") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.DevilFish") }); } @@ -282,11 +292,9 @@ namespace CalamityMod.NPCs.Abyss { if (!NPC.IsABestiaryIconDummy) { - Texture2D tex = ModContent.Request("CalamityMod/NPCs/Abyss/DevilFishGlow").Value; - var effects = NPC.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - Main.EntitySpriteDraw(tex, NPC.Center - Main.screenPosition + new Vector2(0, NPC.gfxOffY + 4), + Main.EntitySpriteDraw(GlowTexture.Value, NPC.Center - Main.screenPosition + new Vector2(0, NPC.gfxOffY + 4), NPC.frame, Color.White * 0.5f, NPC.rotation, NPC.frame.Size() / 2f, NPC.scale, effects, 0); } } @@ -308,9 +316,9 @@ namespace CalamityMod.NPCs.Abyss public static void DefineDevilFishLoot(NPCLoot npcLoot) { - var postClone = npcLoot.DefineConditionalDropSet(DropHelper.PostCal()); - postClone.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 2, 1, 2, 2, 3)); - postClone.Add(ModContent.ItemType(), 2); + var postLevi = npcLoot.DefineConditionalDropSet(DropHelper.PostLevi()); + postLevi.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 2, 1, 2, 2, 3)); + postLevi.Add(ModContent.ItemType(), 2); npcLoot.AddIf(() => NPC.downedGolemBoss, ModContent.ItemType(), 1, 3, 9); npcLoot.Add(ModContent.ItemType(), 1, 10, 20); } diff --git a/NPCs/Abyss/DevilFishAlt.cs b/NPCs/Abyss/DevilFishAlt.cs index 44060ffa94..607e863a20 100644 --- a/NPCs/Abyss/DevilFishAlt.cs +++ b/NPCs/Abyss/DevilFishAlt.cs @@ -1,29 +1,35 @@ -using CalamityMod.BiomeManagers; +using System; +using System.IO; +using CalamityMod.BiomeManagers; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Placeables.Banners; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; +using ReLogic.Content; using Terraria; +using Terraria.Audio; using Terraria.GameContent; using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.Utilities; -using Terraria.Audio; namespace CalamityMod.NPCs.Abyss { public class DevilFishAlt : ModNPC { public bool brokenMask = false; public int hitCounter = 0; + public static Asset GlowTexture; public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 16; this.HideFromBestiary(); + if (!Main.dedServ) + { + GlowTexture = ModContent.Request("CalamityMod/NPCs/Abyss/DevilFishGlowAlt", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -49,6 +55,10 @@ namespace CalamityMod.NPCs.Abyss NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SendExtraAI(BinaryWriter writer) @@ -264,11 +274,9 @@ namespace CalamityMod.NPCs.Abyss { if (!NPC.IsABestiaryIconDummy) { - Texture2D tex = ModContent.Request("CalamityMod/NPCs/Abyss/DevilFishGlowAlt").Value; - var effects = NPC.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - Main.EntitySpriteDraw(tex, NPC.Center - Main.screenPosition + new Vector2(0, NPC.gfxOffY + 4), + Main.EntitySpriteDraw(GlowTexture.Value, NPC.Center - Main.screenPosition + new Vector2(0, NPC.gfxOffY + 4), NPC.frame, Color.White * 0.5f, NPC.rotation, NPC.frame.Size() / 2f, NPC.scale, effects, 0); } } diff --git a/NPCs/Abyss/EidolonWyrmBody.cs b/NPCs/Abyss/EidolonWyrmBody.cs index c1a8c86b08..de8d0bb5d9 100644 --- a/NPCs/Abyss/EidolonWyrmBody.cs +++ b/NPCs/Abyss/EidolonWyrmBody.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.ID; @@ -11,9 +12,14 @@ namespace CalamityMod.NPCs.Abyss public class EidolonWyrmBody : ModNPC { public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.EidolonWyrmHead.DisplayName"); + public static Asset GlowTexture; public override void SetStaticDefaults() { this.HideFromBestiary(); + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -36,6 +42,10 @@ namespace CalamityMod.NPCs.Abyss NPC.dontCountMe = true; NPC.dontTakeDamage = true; NPC.chaseable = false; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) @@ -99,7 +109,8 @@ namespace CalamityMod.NPCs.Abyss segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); targetXDirection = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - segmentPosition.X; targetYDirection = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - segmentPosition.Y; - } catch + } + catch { } NPC.rotation = (float)System.Math.Atan2((double)targetYDirection, (double)targetXDirection) + 1.57f; @@ -129,10 +140,10 @@ namespace CalamityMod.NPCs.Abyss Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); Vector2 vector = center - screenPos; - vector -= new Vector2((float)ModContent.Request("CalamityMod/NPCs/Abyss/EidolonWyrmBodyGlow").Value.Width, (float)(ModContent.Request("CalamityMod/NPCs/Abyss/EidolonWyrmBodyGlow").Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; + vector -= new Vector2((float)GlowTexture.Value.Width, (float)(GlowTexture.Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; vector += halfSizeTexture * 1f + new Vector2(0f, 4f + NPC.gfxOffY); Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightYellow); - Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Abyss/EidolonWyrmBodyGlow").Value, vector, + Main.spriteBatch.Draw(GlowTexture.Value, vector, new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, halfSizeTexture, 1f, spriteEffects, 0f); } @@ -147,7 +158,7 @@ namespace CalamityMod.NPCs.Abyss { for (int k = 0; k < 10; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 4, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, hit.HitDirection, -1f, 0, default, 1f); } if (Main.netMode != NetmodeID.Server) { diff --git a/NPCs/Abyss/EidolonWyrmBodyAlt.cs b/NPCs/Abyss/EidolonWyrmBodyAlt.cs index 2cbfd9e8f6..c0a31646c9 100644 --- a/NPCs/Abyss/EidolonWyrmBodyAlt.cs +++ b/NPCs/Abyss/EidolonWyrmBodyAlt.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.ID; @@ -11,9 +12,14 @@ namespace CalamityMod.NPCs.Abyss public class EidolonWyrmBodyAlt : ModNPC { public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.EidolonWyrmHead.DisplayName"); + public static Asset GlowTexture; public override void SetStaticDefaults() { this.HideFromBestiary(); + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -36,6 +42,10 @@ namespace CalamityMod.NPCs.Abyss NPC.dontCountMe = true; NPC.dontTakeDamage = true; NPC.chaseable = false; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) @@ -99,7 +109,8 @@ namespace CalamityMod.NPCs.Abyss segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); targetXDirection = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - segmentPosition.X; targetYDirection = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - segmentPosition.Y; - } catch + } + catch { } NPC.rotation = (float)System.Math.Atan2((double)targetYDirection, (double)targetXDirection) + 1.57f; @@ -129,10 +140,10 @@ namespace CalamityMod.NPCs.Abyss Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); Vector2 vector = center - screenPos; - vector -= new Vector2((float)ModContent.Request("CalamityMod/NPCs/Abyss/EidolonWyrmBodyAltGlow").Value.Width, (float)(ModContent.Request("CalamityMod/NPCs/Abyss/EidolonWyrmBodyAltGlow").Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; + vector -= new Vector2((float)GlowTexture.Value.Width, (float)(GlowTexture.Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; vector += halfSizeTexture * 1f + new Vector2(0f, NPC.gfxOffY); Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Color.White); - Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Abyss/EidolonWyrmBodyAltGlow").Value, vector, + Main.spriteBatch.Draw(GlowTexture.Value, vector, new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, halfSizeTexture, 1f, spriteEffects, 0f); } @@ -147,7 +158,7 @@ namespace CalamityMod.NPCs.Abyss { for (int k = 0; k < 10; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 4, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, hit.HitDirection, -1f, 0, default, 1f); } if (Main.netMode != NetmodeID.Server) { diff --git a/NPCs/Abyss/EidolonWyrmHead.cs b/NPCs/Abyss/EidolonWyrmHead.cs index 3746bc643e..8b23bec9cf 100644 --- a/NPCs/Abyss/EidolonWyrmHead.cs +++ b/NPCs/Abyss/EidolonWyrmHead.cs @@ -3,16 +3,18 @@ using System.IO; using CalamityMod.BiomeManagers; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Materials; +using CalamityMod.Items.Pets; using CalamityMod.Items.Placeables; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Melee; -using CalamityMod.NPCs.PrimordialWyrm; using CalamityMod.NPCs.NormalNPCs; +using CalamityMod.NPCs.PrimordialWyrm; using CalamityMod.Sounds; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -33,16 +35,20 @@ namespace CalamityMod.NPCs.Abyss public float speed = 5f; //10 public float turnSpeed = 0.1f; //0.15 bool TailSpawned = false; - + public static Asset GlowTexture; public override void SetStaticDefaults() { - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { CustomTexturePath = "CalamityMod/ExtraTextures/Bestiary/EidolonWyrm_Bestiary", PortraitPositionXOverride = 40 }; value.Position.X += 40; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -73,13 +79,17 @@ namespace CalamityMod.NPCs.Abyss NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.EidolonWyrm") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.EidolonWyrm") }); } @@ -189,7 +199,7 @@ namespace CalamityMod.NPCs.Abyss if (NPC.position.Y > Main.worldSurface * 16.0) NPC.velocity.Y += 3f; - if (NPC.position.Y > (Main.maxTilesY - 200) * 16.0) + if (NPC.position.Y > Main.UnderworldLayer * 16.0) { for (int a = 0; a < Main.maxNPCs; a++) { @@ -210,7 +220,7 @@ namespace CalamityMod.NPCs.Abyss float currentSpeed = speed; float currentTurnSpeed = turnSpeed; - Vector2 segmentPosition = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); + Vector2 segmentPosition = NPC.Center; if (patrolSpot == Vector2.Zero) patrolSpot = Main.player[NPC.target].Center; @@ -425,10 +435,10 @@ namespace CalamityMod.NPCs.Abyss Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); Vector2 vector = center - screenPos; - vector -= new Vector2((float)ModContent.Request("CalamityMod/NPCs/Abyss/EidolonWyrmHeadGlow").Value.Width, (float)(ModContent.Request("CalamityMod/NPCs/Abyss/EidolonWyrmHeadGlow").Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; + vector -= new Vector2((float)GlowTexture.Value.Width, (float)(GlowTexture.Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; vector += halfSizeTexture * 1f + new Vector2(0f, NPC.gfxOffY); Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Color.White); - Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Abyss/EidolonWyrmHeadGlow").Value, vector, + Main.spriteBatch.Draw(GlowTexture.Value, vector, new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, halfSizeTexture, 1f, spriteEffects, 0f); } @@ -448,17 +458,20 @@ namespace CalamityMod.NPCs.Abyss // 30-40 Voidstone aewMinionCondition.Add(ModContent.ItemType(), 1, 30, 40); + //rarely drop the snail fossil + aewMinionCondition.Add(ModContent.ItemType(), 50); + // Post-Polterghast: Soul Edge, Eidolic Wail, Stardust Staff LeadingConditionRule postPolter = npcLoot.DefineConditionalDropSet(DropHelper.PostPolter()); aewMinionCondition.Add(postPolter); - postPolter.Add(ModContent.ItemType(), 3); + postPolter.Add(ModContent.ItemType(), 3); postPolter.Add(ModContent.ItemType(), 3); postPolter.Add(ModContent.ItemType(), 3); - // Post-Clone: 6-8 Lumenyl (8-11 on Expert) - LeadingConditionRule postClone = npcLoot.DefineConditionalDropSet(DropHelper.PostCal()); - aewMinionCondition.Add(postClone); - postClone.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 1, 6, 8, 8, 11)); + // Post-Leviathan: 6-8 Lumenyl (8-11 on Expert) + LeadingConditionRule postLevi = npcLoot.DefineConditionalDropSet(DropHelper.PostLevi()); + aewMinionCondition.Add(postLevi); + postLevi.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 1, 6, 8, 8, 11)); // Post-Plantera: 8-12 Ectoplasm aewMinionCondition.Add(ItemDropRule.ByCondition(new Conditions.DownedPlantera(), ItemID.Ectoplasm, 1, 8, 12)); @@ -468,13 +481,13 @@ namespace CalamityMod.NPCs.Abyss { for (int k = 0; k < 5; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 4, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, hit.HitDirection, -1f, 0, default, 1f); } if (NPC.life <= 0) { for (int k = 0; k < 15; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 4, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, hit.HitDirection, -1f, 0, default, 1f); } if (Main.netMode != NetmodeID.Server) { diff --git a/NPCs/Abyss/EidolonWyrmTail.cs b/NPCs/Abyss/EidolonWyrmTail.cs index 463c697b83..45ff9eb1da 100644 --- a/NPCs/Abyss/EidolonWyrmTail.cs +++ b/NPCs/Abyss/EidolonWyrmTail.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.ID; @@ -11,9 +12,14 @@ namespace CalamityMod.NPCs.Abyss public class EidolonWyrmTail : ModNPC { public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.EidolonWyrmHead.DisplayName"); + public static Asset GlowTexture; public override void SetStaticDefaults() { this.HideFromBestiary(); + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -36,6 +42,10 @@ namespace CalamityMod.NPCs.Abyss NPC.dontCountMe = true; NPC.dontTakeDamage = true; NPC.chaseable = false; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) @@ -99,7 +109,8 @@ namespace CalamityMod.NPCs.Abyss segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); targetXDirection = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - segmentPosition.X; targetYDirection = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - segmentPosition.Y; - } catch + } + catch { } NPC.rotation = (float)System.Math.Atan2((double)targetYDirection, (double)targetXDirection) + 1.57f; @@ -129,10 +140,10 @@ namespace CalamityMod.NPCs.Abyss Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); Vector2 vector = center - screenPos; - vector -= new Vector2((float)ModContent.Request("CalamityMod/NPCs/Abyss/EidolonWyrmTailGlow").Value.Width, (float)(ModContent.Request("CalamityMod/NPCs/Abyss/EidolonWyrmTailGlow").Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; + vector -= new Vector2((float)GlowTexture.Value.Width, (float)(GlowTexture.Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; vector += halfSizeTexture * 1f + new Vector2(0f, 4f + NPC.gfxOffY); Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightYellow); - Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Abyss/EidolonWyrmTailGlow").Value, vector, + Main.spriteBatch.Draw(GlowTexture.Value, vector, new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, halfSizeTexture, 1f, spriteEffects, 0f); } @@ -147,7 +158,7 @@ namespace CalamityMod.NPCs.Abyss { for (int k = 0; k < 10; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 4, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, hit.HitDirection, -1f, 0, default, 1f); } if (Main.netMode != NetmodeID.Server) { diff --git a/NPCs/Abyss/GiantSquid.cs b/NPCs/Abyss/GiantSquid.cs index 9806b3eafc..c6e40661f5 100644 --- a/NPCs/Abyss/GiantSquid.cs +++ b/NPCs/Abyss/GiantSquid.cs @@ -1,12 +1,13 @@ -using CalamityMod.BiomeManagers; +using System; +using System.IO; +using CalamityMod.BiomeManagers; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.GameContent.Bestiary; @@ -19,10 +20,15 @@ namespace CalamityMod.NPCs.Abyss public class GiantSquid : ModNPC { private bool hasBeenHit = false; + public static Asset GlowTexture; public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 5; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -45,13 +51,17 @@ namespace CalamityMod.NPCs.Abyss NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.GiantSquid") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.GiantSquid") }); } @@ -69,6 +79,9 @@ namespace CalamityMod.NPCs.Abyss public override void AI() { + // Avoid cheap bullshit + NPC.damage = 0; + if (NPC.direction == 0) { NPC.TargetClosest(true); @@ -125,11 +138,15 @@ namespace CalamityMod.NPCs.Abyss { NPC.localAI[2] = 1f; NPC.velocity *= 0.975f; + + float lungeSpeed = CalamityWorld.death ? 24f : CalamityWorld.revenge ? 20f : 16f; + if (NPC.velocity.Length() > lungeSpeed * 0.4f) + NPC.damage = NPC.defDamage; + float lungeThreshold = 1.6f; if (NPC.velocity.X > -lungeThreshold && NPC.velocity.X < lungeThreshold && NPC.velocity.Y > -lungeThreshold && NPC.velocity.Y < lungeThreshold) { NPC.TargetClosest(true); - float lungeSpeed = CalamityWorld.death ? 24f : CalamityWorld.revenge ? 20f : 16f; Vector2 lungeNPCPos = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); float lungeTargetX = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2) - lungeNPCPos.X; float lungeTargetY = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2) - lungeNPCPos.Y; @@ -211,11 +228,9 @@ namespace CalamityMod.NPCs.Abyss { if (!NPC.IsABestiaryIconDummy) { - Texture2D tex = ModContent.Request("CalamityMod/NPCs/Abyss/GiantSquidGlow").Value; - var effects = NPC.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - Main.EntitySpriteDraw(tex, NPC.Center - Main.screenPosition + new Vector2(0, NPC.gfxOffY + 4), + Main.EntitySpriteDraw(GlowTexture.Value, NPC.Center - Main.screenPosition + new Vector2(0, NPC.gfxOffY + 4), NPC.frame, Color.White * 0.5f, NPC.rotation, NPC.frame.Size() / 2f, NPC.scale, effects, 0); } } @@ -240,9 +255,9 @@ namespace CalamityMod.NPCs.Abyss public override void ModifyNPCLoot(NPCLoot npcLoot) { - var postClone = npcLoot.DefineConditionalDropSet(DropHelper.PostCal()); - postClone.Add(ModContent.ItemType(), 2); - postClone.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 2, 2, 4, 3, 6)); + var postLevi = npcLoot.DefineConditionalDropSet(DropHelper.PostLevi()); + postLevi.Add(ModContent.ItemType(), 2); + postLevi.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 2, 2, 4, 3, 6)); } public override void HitEffect(NPC.HitInfo hit) diff --git a/NPCs/Abyss/GulperEelBody.cs b/NPCs/Abyss/GulperEelBody.cs index 8fab0776de..e043327a62 100644 --- a/NPCs/Abyss/GulperEelBody.cs +++ b/NPCs/Abyss/GulperEelBody.cs @@ -2,6 +2,7 @@ using CalamityMod.Items.Placeables.Banners; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.ID; @@ -13,9 +14,14 @@ namespace CalamityMod.NPCs.Abyss public class GulperEelBody : ModNPC { public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.GulperEelHead.DisplayName"); + public static Asset GlowTexture; public override void SetStaticDefaults() { this.HideFromBestiary(); + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -43,6 +49,10 @@ namespace CalamityMod.NPCs.Abyss NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) @@ -52,6 +62,9 @@ namespace CalamityMod.NPCs.Abyss public override void AI() { + // Avoid cheap bullshit + NPC.damage = 0; + if (NPC.ai[2] > 0f) NPC.realLife = (int)NPC.ai[2]; @@ -104,7 +117,8 @@ namespace CalamityMod.NPCs.Abyss segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); targetXDirection = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - segmentPosition.X; targetYDirection = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - segmentPosition.Y; - } catch + } + catch { } NPC.rotation = (float)System.Math.Atan2((double)targetYDirection, (double)targetXDirection) + 1.57f; @@ -134,10 +148,10 @@ namespace CalamityMod.NPCs.Abyss Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); Vector2 vector = center - screenPos; - vector -= new Vector2((float)ModContent.Request("CalamityMod/NPCs/Abyss/GulperEelBodyGlow").Value.Width, (float)(ModContent.Request("CalamityMod/NPCs/Abyss/GulperEelBodyGlow").Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; + vector -= new Vector2((float)GlowTexture.Value.Width, (float)(GlowTexture.Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; vector += halfSizeTexture * 1f + new Vector2(0f, NPC.gfxOffY); Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Color.White); - Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Abyss/GulperEelBodyGlow").Value, vector, + Main.spriteBatch.Draw(GlowTexture.Value, vector, new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, halfSizeTexture, 1f, spriteEffects, 0f); } diff --git a/NPCs/Abyss/GulperEelBodyAlt.cs b/NPCs/Abyss/GulperEelBodyAlt.cs index 292bae06f1..ce6ac572b1 100644 --- a/NPCs/Abyss/GulperEelBodyAlt.cs +++ b/NPCs/Abyss/GulperEelBodyAlt.cs @@ -2,6 +2,7 @@ using CalamityMod.Items.Placeables.Banners; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.ID; @@ -13,9 +14,14 @@ namespace CalamityMod.NPCs.Abyss public class GulperEelBodyAlt : ModNPC { public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.GulperEelHead.DisplayName"); + public static Asset GlowTexture; public override void SetStaticDefaults() { this.HideFromBestiary(); + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -43,6 +49,10 @@ namespace CalamityMod.NPCs.Abyss NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) @@ -52,6 +62,9 @@ namespace CalamityMod.NPCs.Abyss public override void AI() { + // Avoid cheap bullshit + NPC.damage = 0; + if (NPC.ai[2] > 0f) NPC.realLife = (int)NPC.ai[2]; @@ -104,7 +117,8 @@ namespace CalamityMod.NPCs.Abyss segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); targetXDirection = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - segmentPosition.X; targetYDirection = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - segmentPosition.Y; - } catch + } + catch { } NPC.rotation = (float)System.Math.Atan2((double)targetYDirection, (double)targetXDirection) + 1.57f; @@ -134,10 +148,10 @@ namespace CalamityMod.NPCs.Abyss Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); Vector2 vector = center - screenPos; - vector -= new Vector2((float)ModContent.Request("CalamityMod/NPCs/Abyss/GulperEelBodyAltGlow").Value.Width, (float)(ModContent.Request("CalamityMod/NPCs/Abyss/GulperEelBodyAltGlow").Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; + vector -= new Vector2((float)GlowTexture.Value.Width, (float)(GlowTexture.Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; vector += halfSizeTexture * 1f + new Vector2(0f, 4f + NPC.gfxOffY); Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightYellow); - Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Abyss/GulperEelBodyAltGlow").Value, vector, + Main.spriteBatch.Draw(GlowTexture.Value, vector, new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, halfSizeTexture, 1f, spriteEffects, 0f); } diff --git a/NPCs/Abyss/GulperEelHead.cs b/NPCs/Abyss/GulperEelHead.cs index 98a75fac66..1d09fd334f 100644 --- a/NPCs/Abyss/GulperEelHead.cs +++ b/NPCs/Abyss/GulperEelHead.cs @@ -1,11 +1,12 @@ -using CalamityMod.BiomeManagers; +using System; +using System.IO; +using CalamityMod.BiomeManagers; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.GameContent.Bestiary; @@ -24,10 +25,11 @@ namespace CalamityMod.NPCs.Abyss public float speed = 5f; //10 public float turnSpeed = 0.075f; //0.15 bool TailSpawned = false; + public static Asset GlowTexture; public override void SetStaticDefaults() { - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { Scale = 0.75f, CustomTexturePath = "CalamityMod/ExtraTextures/Bestiary/GulperEel_Bestiary", @@ -37,6 +39,10 @@ namespace CalamityMod.NPCs.Abyss value.Position.X += 50; value.Position.Y += 20; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -64,13 +70,17 @@ namespace CalamityMod.NPCs.Abyss NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[2] { ModContent.GetInstance().Type, ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.GulperEel") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.GulperEel") }); } @@ -97,7 +107,7 @@ namespace CalamityMod.NPCs.Abyss { if (Main.rand.NextBool()) { - Dust dust = Dust.NewDustDirect(NPC.position, NPC.width, NPC.height, 204, 0f, 0f, 150, default(Color), 0.3f); + Dust dust = Dust.NewDustDirect(NPC.position, NPC.width, NPC.height, DustID.TreasureSparkle, 0f, 0f, 150, default(Color), 0.3f); dust.fadeIn = 0.75f; dust.velocity *= 0.1f; dust.noLight = true; @@ -347,10 +357,10 @@ namespace CalamityMod.NPCs.Abyss Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); Vector2 vector = center - screenPos; - vector -= new Vector2((float)ModContent.Request("CalamityMod/NPCs/Abyss/GulperEelHeadGlow").Value.Width, (float)(ModContent.Request("CalamityMod/NPCs/Abyss/GulperEelHeadGlow").Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; + vector -= new Vector2((float)GlowTexture.Value.Width, (float)(GlowTexture.Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; vector += halfSizeTexture * 1f + new Vector2(0f, 4f + NPC.gfxOffY); Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightYellow); - Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Abyss/GulperEelHeadGlow").Value, vector, + Main.spriteBatch.Draw(GlowTexture.Value, vector, new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, halfSizeTexture, 1f, spriteEffects, 0f); } @@ -367,9 +377,9 @@ namespace CalamityMod.NPCs.Abyss public override void ModifyNPCLoot(NPCLoot npcLoot) { - var postClone = npcLoot.DefineConditionalDropSet(DropHelper.PostCal()); - postClone.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 2, 2, 3, 3, 4)); - postClone.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 2, 6, 8, 8, 11)); + var postLevi = npcLoot.DefineConditionalDropSet(DropHelper.PostLevi()); + postLevi.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 2, 2, 3, 3, 4)); + postLevi.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 2, 6, 8, 8, 11)); } public override void HitEffect(NPC.HitInfo hit) diff --git a/NPCs/Abyss/GulperEelTail.cs b/NPCs/Abyss/GulperEelTail.cs index 7381e75b4f..48748c15c8 100644 --- a/NPCs/Abyss/GulperEelTail.cs +++ b/NPCs/Abyss/GulperEelTail.cs @@ -2,6 +2,7 @@ using CalamityMod.Items.Placeables.Banners; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.ID; @@ -13,9 +14,14 @@ namespace CalamityMod.NPCs.Abyss public class GulperEelTail : ModNPC { public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.GulperEelHead.DisplayName"); + public static Asset GlowTexture; public override void SetStaticDefaults() { this.HideFromBestiary(); + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -43,6 +49,10 @@ namespace CalamityMod.NPCs.Abyss NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) @@ -52,6 +62,9 @@ namespace CalamityMod.NPCs.Abyss public override void AI() { + // Avoid cheap bullshit + NPC.damage = 0; + if (NPC.ai[2] > 0f) NPC.realLife = (int)NPC.ai[2]; @@ -104,7 +117,8 @@ namespace CalamityMod.NPCs.Abyss segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); targetXDirection = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - segmentPosition.X; targetYDirection = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - segmentPosition.Y; - } catch + } + catch { } NPC.rotation = (float)System.Math.Atan2((double)targetYDirection, (double)targetXDirection) + 1.57f; @@ -134,10 +148,10 @@ namespace CalamityMod.NPCs.Abyss Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); Vector2 vector = center - screenPos; - vector -= new Vector2((float)ModContent.Request("CalamityMod/NPCs/Abyss/GulperEelTailGlow").Value.Width, (float)(ModContent.Request("CalamityMod/NPCs/Abyss/GulperEelTailGlow").Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; + vector -= new Vector2((float)GlowTexture.Value.Width, (float)(GlowTexture.Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; vector += halfSizeTexture * 1f + new Vector2(0f, 4f + NPC.gfxOffY); Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightYellow); - Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Abyss/GulperEelTailGlow").Value, vector, + Main.spriteBatch.Draw(GlowTexture.Value, vector, new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, halfSizeTexture, 1f, spriteEffects, 0f); } diff --git a/NPCs/Abyss/Laserfish.cs b/NPCs/Abyss/Laserfish.cs index d9b8ef7d6c..6a70bdf5c1 100644 --- a/NPCs/Abyss/Laserfish.cs +++ b/NPCs/Abyss/Laserfish.cs @@ -1,9 +1,11 @@ -using CalamityMod.BiomeManagers; +using System.IO; +using CalamityMod.BiomeManagers; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; +using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System.IO; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.GameContent.Bestiary; @@ -15,9 +17,14 @@ namespace CalamityMod.NPCs.Abyss { public class Laserfish : ModNPC { + public static Asset GlowTexture; public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 6; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -42,13 +49,17 @@ namespace CalamityMod.NPCs.Abyss NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[2] { ModContent.GetInstance().Type, ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Laserfish") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Laserfish") }); } @@ -67,7 +78,7 @@ namespace CalamityMod.NPCs.Abyss // Setting this in SetDefaults will disable expert mode scaling, so put it here instead NPC.damage = 0; - CalamityAI.PassiveSwimmingAI(NPC, Mod, 0, Main.player[NPC.target].Calamity().GetAbyssAggro(160f), 0.15f, 0.15f, 4f, 4f, 0.1f); + CalamityRegularEnemyAI.PassiveSwimmingAI(NPC, Mod, 0, Main.player[NPC.target].Calamity().GetAbyssAggro(160f), 0.15f, 0.15f, 4f, 4f, 0.1f); } public override bool? CanBeHitByProjectile(Projectile projectile) @@ -96,11 +107,9 @@ namespace CalamityMod.NPCs.Abyss { if (!NPC.IsABestiaryIconDummy) { - Texture2D tex = ModContent.Request("CalamityMod/NPCs/Abyss/LaserfishGlow").Value; - var effects = NPC.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - Main.EntitySpriteDraw(tex, NPC.Center - Main.screenPosition + new Vector2(0, NPC.gfxOffY + 4), + Main.EntitySpriteDraw(GlowTexture.Value, NPC.Center - Main.screenPosition + new Vector2(0, NPC.gfxOffY + 4), NPC.frame, Color.White * 0.5f, NPC.rotation, NPC.frame.Size() / 2f, NPC.scale, effects, 0); } } @@ -120,7 +129,7 @@ namespace CalamityMod.NPCs.Abyss public override void ModifyNPCLoot(NPCLoot npcLoot) { - npcLoot.AddIf(DropHelper.PostCal(), ModContent.ItemType(), 2); + npcLoot.AddIf(DropHelper.PostLevi(), ModContent.ItemType(), 2); } public override void HitEffect(NPC.HitInfo hit) diff --git a/NPCs/Abyss/LuminousCorvina.cs b/NPCs/Abyss/LuminousCorvina.cs index d0b2b2bc6d..a729bdce48 100644 --- a/NPCs/Abyss/LuminousCorvina.cs +++ b/NPCs/Abyss/LuminousCorvina.cs @@ -1,4 +1,6 @@ -using CalamityMod.BiomeManagers; +using System; +using System.IO; +using CalamityMod.BiomeManagers; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Materials; @@ -7,20 +9,21 @@ using CalamityMod.Items.Placeables.Banners; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; +using ReLogic.Content; using Terraria; +using Terraria.Audio; using Terraria.GameContent; using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.Utilities; -using Terraria.Audio; namespace CalamityMod.NPCs.Abyss { public class LuminousCorvina : ModNPC { + public static Asset GlowTexture; + public static readonly SoundStyle ScreamSound = new("CalamityMod/Sounds/Custom/CorvinaScream"); private bool hasBeenHit = false; @@ -29,6 +32,10 @@ namespace CalamityMod.NPCs.Abyss public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 8; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -52,13 +59,17 @@ namespace CalamityMod.NPCs.Abyss NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.LuminousCorvina") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.LuminousCorvina") }); } @@ -276,11 +287,9 @@ namespace CalamityMod.NPCs.Abyss { if (!NPC.IsABestiaryIconDummy) { - Texture2D tex = ModContent.Request("CalamityMod/NPCs/Abyss/LuminousCorvinaGlow").Value; - var effects = NPC.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - Main.EntitySpriteDraw(tex, NPC.Center - Main.screenPosition + new Vector2(0, NPC.gfxOffY + 4), + Main.EntitySpriteDraw(GlowTexture.Value, NPC.Center - Main.screenPosition + new Vector2(0, NPC.gfxOffY + 4), NPC.frame, Color.White * 0.5f, NPC.rotation, NPC.frame.Size() / 2f, NPC.scale, effects, 0); } } @@ -288,7 +297,7 @@ namespace CalamityMod.NPCs.Abyss public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) { if (hurtInfo.Damage > 0) - target.AddBuff(ModContent.BuffType(), 180, true); + target.AddBuff(ModContent.BuffType(), 180, true); } public override float SpawnChance(NPCSpawnInfo spawnInfo) @@ -303,22 +312,22 @@ namespace CalamityMod.NPCs.Abyss public override void ModifyNPCLoot(NPCLoot npcLoot) { npcLoot.Add(ModContent.ItemType(), 1, 8, 15); - var postClone = npcLoot.DefineConditionalDropSet(DropHelper.PostCal()); - postClone.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 2, 1, 2, 2, 3)); - postClone.Add(ModContent.ItemType(), 2); + var postLevi = npcLoot.DefineConditionalDropSet(DropHelper.PostLevi()); + postLevi.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 2, 1, 2, 2, 3)); + postLevi.Add(ModContent.ItemType(), 2); } public override void HitEffect(NPC.HitInfo hit) { for (int k = 0; k < 5; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 139, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Confetti, hit.HitDirection, -1f, 0, default, 1f); } if (NPC.life <= 0) { for (int k = 0; k < 25; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 139, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Confetti, hit.HitDirection, -1f, 0, default, 1f); } if (Main.netMode != NetmodeID.Server) { diff --git a/NPCs/Abyss/MirageJelly.cs b/NPCs/Abyss/MirageJelly.cs index 8005102f35..c57b37a7d0 100644 --- a/NPCs/Abyss/MirageJelly.cs +++ b/NPCs/Abyss/MirageJelly.cs @@ -1,11 +1,12 @@ -using CalamityMod.BiomeManagers; +using System.IO; +using CalamityMod.BiomeManagers; using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Weapons.Magic; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System.IO; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.GameContent.Bestiary; @@ -21,16 +22,21 @@ namespace CalamityMod.NPCs.Abyss private bool teleporting = false; private bool rephasing = false; private bool hasBeenHit = false; + public static Asset GlowTexture; public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 7; - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { - PortraitPositionYOverride = 20 + PortraitPositionYOverride = 20 }; value.Position.Y += 30f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -55,13 +61,17 @@ namespace CalamityMod.NPCs.Abyss NPC.Calamity().VulnerableToElectricity = false; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.MirageJelly") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.MirageJelly") }); } @@ -143,7 +153,7 @@ namespace CalamityMod.NPCs.Abyss NPC.ai[1] = (float)teleportTileX; NPC.ai[2] = (float)teleportTileY; NPC.netUpdate = true; - Block: +Block: ; } } @@ -189,11 +199,9 @@ namespace CalamityMod.NPCs.Abyss { if (!NPC.IsABestiaryIconDummy) { - Texture2D tex = ModContent.Request("CalamityMod/NPCs/Abyss/MirageJellyGlow").Value; - var effects = NPC.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - Main.EntitySpriteDraw(tex, NPC.Center - Main.screenPosition + new Vector2(0, NPC.gfxOffY + 4), + Main.EntitySpriteDraw(GlowTexture.Value, NPC.Center - Main.screenPosition + new Vector2(0, NPC.gfxOffY + 4), NPC.frame, Color.White * 0.5f, NPC.rotation, NPC.frame.Size() / 2f, NPC.scale, effects, 0); } } @@ -219,8 +227,8 @@ namespace CalamityMod.NPCs.Abyss { npcLoot.AddIf(() => NPC.downedBoss3, ModContent.ItemType(), 10); - var postClone = npcLoot.DefineConditionalDropSet(DropHelper.PostCal()); - postClone.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 2, 5, 7, 10, 14)); + var postLevi = npcLoot.DefineConditionalDropSet(DropHelper.PostLevi()); + postLevi.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 2, 5, 7, 10, 14)); npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 7, 5)); npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 7, 5)); @@ -228,6 +236,18 @@ namespace CalamityMod.NPCs.Abyss npcLoot.Add(ItemID.JellyfishNecklace, 10); } + // Can only hit the target if they're touching the tentacles + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + Vector2 npcCenter = NPC.Center; + Rectangle tentacleHitbox = new Rectangle((int)(npcCenter.X - (NPC.width / 4f)), (int)npcCenter.Y, NPC.width / 2, NPC.height / 2); + + Rectangle targetHitbox = target.Hitbox; + bool insideTentacleHitbox = targetHitbox.Intersects(tentacleHitbox); + + return insideTentacleHitbox; + } + public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) { if (hurtInfo.Damage > 0) diff --git a/NPCs/Abyss/MorayEel.cs b/NPCs/Abyss/MorayEel.cs index 68155b0c9c..7da581930d 100644 --- a/NPCs/Abyss/MorayEel.cs +++ b/NPCs/Abyss/MorayEel.cs @@ -1,7 +1,8 @@ -using CalamityMod.BiomeManagers; +using System.IO; +using CalamityMod.BiomeManagers; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Weapons.Melee; -using System.IO; +using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; using Terraria; using Terraria.GameContent.Bestiary; using Terraria.GameContent.ItemDropRules; @@ -16,7 +17,7 @@ namespace CalamityMod.NPCs.Abyss public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 6; - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { Scale = 0.75f, PortraitPositionXOverride = 0f, @@ -48,11 +49,15 @@ namespace CalamityMod.NPCs.Abyss NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Ocean, new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.MorayEel") @@ -71,7 +76,7 @@ namespace CalamityMod.NPCs.Abyss public override void AI() { - CalamityAI.PassiveSwimmingAI(NPC, Mod, 0, Main.player[NPC.target].Calamity().GetAbyssAggro(160f), 0.15f, 0.1f, 6f, 4f, 0.1f); + CalamityRegularEnemyAI.PassiveSwimmingAI(NPC, Mod, 0, Main.player[NPC.target].Calamity().GetAbyssAggro(160f), 0.15f, 0.1f, 6f, 4f, 0.1f); } public override bool? CanBeHitByProjectile(Projectile projectile) @@ -113,7 +118,6 @@ namespace CalamityMod.NPCs.Abyss public override void ModifyNPCLoot(NPCLoot npcLoot) { npcLoot.Add(ItemID.Flipper, 20); - npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 15, 10)); } public override void HitEffect(NPC.HitInfo hit) diff --git a/NPCs/Abyss/OarfishBody.cs b/NPCs/Abyss/OarfishBody.cs index 71dad1d575..ac1f56f8e3 100644 --- a/NPCs/Abyss/OarfishBody.cs +++ b/NPCs/Abyss/OarfishBody.cs @@ -40,6 +40,10 @@ namespace CalamityMod.NPCs.Abyss NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) @@ -49,6 +53,9 @@ namespace CalamityMod.NPCs.Abyss public override void AI() { + // Avoid cheap bullshit + NPC.damage = 0; + if (NPC.ai[2] > 0f) NPC.realLife = (int)NPC.ai[2]; @@ -101,7 +108,8 @@ namespace CalamityMod.NPCs.Abyss segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); targetXDirection = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - segmentPosition.X; targetYDirection = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - segmentPosition.Y; - } catch + } + catch { } NPC.rotation = (float)System.Math.Atan2((double)targetYDirection, (double)targetXDirection) + 1.57f; diff --git a/NPCs/Abyss/OarfishHead.cs b/NPCs/Abyss/OarfishHead.cs index 2f17785853..5945215fc8 100644 --- a/NPCs/Abyss/OarfishHead.cs +++ b/NPCs/Abyss/OarfishHead.cs @@ -1,10 +1,10 @@ -using CalamityMod.BiomeManagers; +using System; +using System.IO; +using CalamityMod.BiomeManagers; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; using Microsoft.Xna.Framework; -using System; -using System.IO; using Terraria; using Terraria.GameContent.Bestiary; using Terraria.ID; @@ -25,7 +25,7 @@ namespace CalamityMod.NPCs.Abyss public override void SetStaticDefaults() { - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { CustomTexturePath = "CalamityMod/ExtraTextures/Bestiary/Oarfish_Bestiary", PortraitPositionYOverride = 20 @@ -59,6 +59,10 @@ namespace CalamityMod.NPCs.Abyss NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[2] { ModContent.GetInstance().Type, ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -93,7 +97,7 @@ namespace CalamityMod.NPCs.Abyss { if (Main.rand.NextBool()) { - Dust dust = Dust.NewDustDirect(NPC.position, NPC.width, NPC.height, 204, 0f, 0f, 150, default(Color), 0.3f); + Dust dust = Dust.NewDustDirect(NPC.position, NPC.width, NPC.height, DustID.TreasureSparkle, 0f, 0f, 150, default(Color), 0.3f); dust.fadeIn = 0.75f; dust.velocity *= 0.1f; dust.noLight = true; @@ -330,8 +334,8 @@ namespace CalamityMod.NPCs.Abyss public override void ModifyNPCLoot(NPCLoot npcLoot) { - var postClone = npcLoot.DefineConditionalDropSet(DropHelper.PostCal()); - postClone.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 2, 3, 5, 4, 7)); + var postLevi = npcLoot.DefineConditionalDropSet(DropHelper.PostLevi()); + postLevi.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 2, 3, 5, 4, 7)); } public override void HitEffect(NPC.HitInfo hit) @@ -354,7 +358,7 @@ namespace CalamityMod.NPCs.Abyss public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) { if (hurtInfo.Damage > 0) - target.AddBuff(ModContent.BuffType(), 90); + target.AddBuff(ModContent.BuffType(), 90); } } } diff --git a/NPCs/Abyss/OarfishTail.cs b/NPCs/Abyss/OarfishTail.cs index f9bf228a3c..f91af05d87 100644 --- a/NPCs/Abyss/OarfishTail.cs +++ b/NPCs/Abyss/OarfishTail.cs @@ -40,6 +40,10 @@ namespace CalamityMod.NPCs.Abyss NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) @@ -49,6 +53,9 @@ namespace CalamityMod.NPCs.Abyss public override void AI() { + // Avoid cheap bullshit + NPC.damage = 0; + if (NPC.ai[2] > 0f) NPC.realLife = (int)NPC.ai[2]; @@ -101,7 +108,8 @@ namespace CalamityMod.NPCs.Abyss segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); targetXDirection = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - segmentPosition.X; targetYDirection = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - segmentPosition.Y; - } catch + } + catch { } NPC.rotation = (float)System.Math.Atan2((double)targetYDirection, (double)targetXDirection) + 1.57f; diff --git a/NPCs/Abyss/ReaperShark.cs b/NPCs/Abyss/ReaperShark.cs index 1f7b10c7a0..e7ef0e456f 100644 --- a/NPCs/Abyss/ReaperShark.cs +++ b/NPCs/Abyss/ReaperShark.cs @@ -23,6 +23,8 @@ namespace CalamityMod.NPCs.Abyss { public class ReaperShark : ModNPC { + public static Asset ManTexture; + public static readonly SoundStyle SearchRoarSound = new("CalamityMod/Sounds/Custom/ReaperSearchRoar"); public static readonly SoundStyle EnragedRoarSound = new("CalamityMod/Sounds/Custom/ReaperEnragedRoar"); @@ -33,6 +35,10 @@ namespace CalamityMod.NPCs.Abyss public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 4; + if (!Main.dedServ) + { + ManTexture = ModContent.Request(Texture + "Man", AssetRequestMode.ImmediateLoad); + } } public override void SetDefaults() @@ -61,17 +67,20 @@ namespace CalamityMod.NPCs.Abyss NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + if (Main.zenithWorld) // legg - { NPC.height = (int)(NPC.height * 1.5f); - } + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.ReaperShark") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.ReaperShark") }); } @@ -117,7 +126,7 @@ namespace CalamityMod.NPCs.Abyss { if (!reset2 && phase3) { - NPC.damage /= 2; + NPC.damage = 0; NPC.noTileCollide = true; NPC.netAlways = true; NPC.localAI[0] = 0f; @@ -132,6 +141,9 @@ namespace CalamityMod.NPCs.Abyss NPC.spriteDirection = (NPC.direction > 0) ? -1 : 1; if (NPC.ai[2] == 0f) { + // Avoid cheap bullshit + NPC.damage = 0; + NPC.TargetClosest(true); if (!Main.player[NPC.target].dead && (Main.player[NPC.target].Center - NPC.Center).Length() < 170f && Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[NPC.target].position, Main.player[NPC.target].width, Main.player[NPC.target].height)) { @@ -146,6 +158,9 @@ namespace CalamityMod.NPCs.Abyss if (NPC.ai[2] < 0f) { + // Avoid cheap bullshit + NPC.damage = 0; + NPC.ai[2] += 1f; if (NPC.ai[2] == 0f) { @@ -177,6 +192,9 @@ namespace CalamityMod.NPCs.Abyss if (!canAttack) { + // Avoid cheap bullshit + NPC.damage = 0; + if (!Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) { NPC.noTileCollide = false; @@ -206,6 +224,9 @@ namespace CalamityMod.NPCs.Abyss } if (canAttack) { + // Set damage + NPC.damage = phase3 ? (int)Math.Round(NPC.defDamage * 0.5) : NPC.defDamage; + if (NPC.ai[3] > 0f && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) { if (Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[NPC.target].position, Main.player[NPC.target].width, Main.player[NPC.target].height)) @@ -303,6 +324,9 @@ namespace CalamityMod.NPCs.Abyss } else { + // Set damage + NPC.damage = NPC.defDamage; + if (NPC.velocity.Y == 0f) { if (Main.netMode != NetmodeID.MultiplayerClient) @@ -460,6 +484,9 @@ namespace CalamityMod.NPCs.Abyss } if (NPC.ai[0] == -1f) { + // Avoid cheap bullshit + NPC.damage = 0; + NPC.dontTakeDamage = true; NPC.chaseable = false; NPC.velocity *= 0.98f; @@ -493,7 +520,7 @@ namespace CalamityMod.NPCs.Abyss { Vector2 expr_80F = (Vector2.Normalize(NPC.velocity) * new Vector2((float)NPC.width / 2f, (float)NPC.height) * 0.75f * 0.5f).RotatedBy((double)((float)(i - (dustAmt / 2 - 1)) * 6.28318548f / (float)dustAmt), default) + NPC.Center; Vector2 dustDirection = expr_80F - NPC.Center; - int chargeDust = Dust.NewDust(expr_80F + dustDirection, 0, 0, 172, dustDirection.X * 2f, dustDirection.Y * 2f, 100, default, 1.4f); + int chargeDust = Dust.NewDust(expr_80F + dustDirection, 0, 0, DustID.DungeonWater, dustDirection.X * 2f, dustDirection.Y * 2f, 100, default, 1.4f); Main.dust[chargeDust].noGravity = true; Main.dust[chargeDust].noLight = true; Main.dust[chargeDust].velocity = Vector2.Normalize(dustDirection) * 3f; @@ -512,6 +539,9 @@ namespace CalamityMod.NPCs.Abyss } else if (NPC.ai[0] == 0f && !player.dead) { + // Avoid cheap bullshit + NPC.damage = 0; + NPC.dontTakeDamage = false; NPC.chaseable = true; if (NPC.ai[1] == 0f) @@ -568,6 +598,9 @@ namespace CalamityMod.NPCs.Abyss NPC.ai[2] += 1f; if (NPC.ai[2] >= 30f) { + // Set damage + NPC.damage = NPC.defDamage; + NPC.ai[0] = 1f; NPC.ai[1] = 0f; NPC.ai[2] = 0f; @@ -588,12 +621,15 @@ namespace CalamityMod.NPCs.Abyss } else if (NPC.ai[0] == 1f) { + // Set damage + NPC.damage = NPC.defDamage; + int phase2DustAmt = 7; for (int j = 0; j < phase2DustAmt; j++) { Vector2 arg_E1C_0 = (Vector2.Normalize(NPC.velocity) * new Vector2((float)(NPC.width + 50) / 2f, (float)NPC.height) * 0.75f).RotatedBy((double)(j - (phase2DustAmt / 2 - 1)) * 3.1415926535897931 / (double)(float)phase2DustAmt, default) + shorkCenter; Vector2 phase2DustRotation = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); - int phase2Dust = Dust.NewDust(arg_E1C_0 + phase2DustRotation, 0, 0, 172, phase2DustRotation.X * 2f, phase2DustRotation.Y * 2f, 100, default, 1.4f); + int phase2Dust = Dust.NewDust(arg_E1C_0 + phase2DustRotation, 0, 0, DustID.DungeonWater, phase2DustRotation.X * 2f, phase2DustRotation.Y * 2f, 100, default, 1.4f); Main.dust[phase2Dust].noGravity = true; Main.dust[phase2Dust].noLight = true; Main.dust[phase2Dust].velocity /= 4f; @@ -634,7 +670,7 @@ namespace CalamityMod.NPCs.Abyss public override void FindFrame(int frameHeight) { int newFrameHeight = (int)(frameHeight * (Main.zenithWorld ? 1.5f : 1f)); - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { Scale = 0.3f, PortraitPositionXOverride = 54f, @@ -658,7 +694,7 @@ namespace CalamityMod.NPCs.Abyss SpriteEffects spriteEffects = SpriteEffects.None; if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Asset npcTexture = Main.zenithWorld ? ModContent.Request("CalamityMod/NPCs/Abyss/ReaperSharkMan") : TextureAssets.Npc[NPC.type]; + Asset npcTexture = Main.zenithWorld ? ManTexture : TextureAssets.Npc[NPC.type]; Rectangle nframe = npcTexture.Frame(1, 4, 0, (int)NPC.frameCounter); Vector2 origin = new Vector2((float)(npcTexture.Value.Width / 2), (float)(npcTexture.Value.Height / Main.npcFrameCount[NPC.type] / 2)); Vector2 npcOffset = NPC.Center - screenPos; @@ -690,12 +726,12 @@ namespace CalamityMod.NPCs.Abyss npcLoot.Add(ModContent.ItemType(), 1, 2, 3); var postPolter = npcLoot.DefineConditionalDropSet(DropHelper.PostPolter()); - postPolter.Add(ModContent.ItemType(), 1, 3, 4); + postPolter.Add(ModContent.ItemType(), 1, 6, 8); postPolter.Add(ModContent.ItemType(), 3); postPolter.Add(ModContent.ItemType(), 3); - var postClone = npcLoot.DefineConditionalDropSet(DropHelper.PostCal()); - postClone.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 2, 10, 17, 14, 22)); + var postLevi = npcLoot.DefineConditionalDropSet(DropHelper.PostLevi()); + postLevi.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 2, 10, 17, 14, 22)); } public override void HitEffect(NPC.HitInfo hit) diff --git a/NPCs/Abyss/SlabCrab.cs b/NPCs/Abyss/SlabCrab.cs new file mode 100644 index 0000000000..0eca2a663d --- /dev/null +++ b/NPCs/Abyss/SlabCrab.cs @@ -0,0 +1,480 @@ +using System; +using System.IO; +using CalamityMod.BiomeManagers; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Banners; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.Audio; +using Terraria.GameContent.Bestiary; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ModLoader.Utilities; + +namespace CalamityMod.NPCs.Abyss +{ + public class SlabCrab : ModNPC + { + enum AIState + { + Hiding = 0, + IdleAnim = 1, + Enraged = 2, + Active = 3, + Walking = 4 + } + + public Player Target => Main.player[NPC.target]; + public ref float CurrentPhase => ref NPC.ai[0]; + public ref float AITimer => ref NPC.ai[1]; + public ref float HopTimer => ref NPC.ai[2]; + public ref float CalmDownTimer => ref NPC.ai[3]; + + public bool playerCrossed = false; + public const int BaseDefense = 10; // the crab's defense while hostile + public const int BaseAttack = 20; // the crab's damage while hostile + public const float BaseKB = 1f; // the crab's knockback taken while hostile + public static Asset GlowTexture; + public override void SetStaticDefaults() + { + Main.npcFrameCount[NPC.type] = 23; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } + } + + public override void SetDefaults() + { + NPC.width = 44; + NPC.height = 30; + + NPC.damage = BaseAttack; + NPC.lifeMax = 300; + + NPC.aiStyle = AIType = -1; + + NPC.knockBackResist = 0f; + NPC.value = Item.buyPrice(0, 0, 2, 0); + NPC.lavaImmune = true; + NPC.noGravity = false; + NPC.noTileCollide = false; + NPC.chaseable = false; + NPC.knockBackResist = 0f; + NPC.defense = 999998; + NPC.HitSound = SoundID.NPCHit33; + NPC.DeathSound = SoundID.NPCDeath36; + Banner = NPC.type; + BannerItem = ModContent.ItemType(); + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; + NPC.GravityIgnoresLiquid = true; + SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); + } + + public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) + { + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + { + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.SlabCrab") + }); + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(NPC.localAI[0]); + writer.Write(playerCrossed); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + playerCrossed = reader.ReadBoolean(); + NPC.localAI[0] = reader.ReadSingle(); + } + + public override void AI() + { + NPC.direction = NPC.velocity.X != 0 ? Math.Sign(NPC.velocity.X) : NPC.direction; + NPC.spriteDirection = -NPC.direction; + // the crab cannot be awoken for 1.5 seconds after spawning + NPC.localAI[0]++; + if (NPC.localAI[0] < 90) + return; + // Enables expert scaling, if damage is 0 in set defaults expert scaling will not happen. + NPC.damage = 0; + switch (CurrentPhase) + { + case (int)AIState.Hiding: + NPC.ShowNameOnHover = false; + NPC.chaseable = false; + NPC.defense = 999998; + AITimer++; + NPC.TargetClosest(false); + // if the block below it is mined, instantly start running + if (NPC.velocity.Y > 0) + { + ChangeAIHook((int)AIState.Active); + } + // randomly start looking around after a bit + if (AITimer > 300 && Main.rand.NextBool(420)) + { + ChangeAIHook((int)AIState.IdleAnim); + } + HandlePlayerDetection(); + HandlePickaxeInteraction(); + break; + case (int)AIState.IdleAnim: + NPC.ShowNameOnHover = true; + NPC.chaseable = false; + NPC.defense = 999998; + AITimer++; + NPC.TargetClosest(false); + // if the block below it is mined, instantly start running + if (NPC.velocity.Y > 0) + { + ChangeAIHook((int)AIState.Active); + } + // if the animation finishes, go back to stone mode + if (AITimer > 90) + { + ChangeAIHook((int)AIState.Hiding); + } + HandlePlayerDetection(); + HandlePickaxeInteraction(); + break; + case (int)AIState.Enraged: + NPC.ShowNameOnHover = true; + AITimer++; + NPC.defense = BaseDefense; + NPC.knockBackResist = 0f; + NPC.chaseable = false; + NPC.TargetClosest(false); + // give the animation time to play out then start attacking + if (AITimer > 24) + { + ChangeAIHook((int)AIState.Active); + } + break; + case (int)AIState.Active: + { + NPC.ShowNameOnHover = true; + NPC.defense = BaseDefense; + NPC.knockBackResist = BaseKB; + NPC.damage = BaseAttack; + NPC.chaseable = true; + // if the player is out of range (affected by if the crab can see the player), start ticking down the calmdown timer + bool outofRange = ((Target.Center.Distance(NPC.Center) > 600) || (Target.Center.Distance(NPC.Center) > 320 && !Collision.CanHitLine(NPC.Center, 1, 1, Target.Center, 1, 1))); + if (outofRange) + { + CalmDownTimer++; + } + else if (CalmDownTimer > 0) + { + CalmDownTimer--; + } + if (NPC.velocity.Y == 0f) + { + AITimer++; + NPC.knockBackResist = 0.6f; + NPC.TargetClosest(true); + NPC.velocity.X *= 0.85f; + + float hopRate = MathHelper.Lerp(25f, 10f, 1f - NPC.life / (float)NPC.lifeMax); + float lungeForwardSpeed = 6f; + float jumpSpeed = 7f; + if (Collision.CanHit(NPC.Center, 1, 1, Target.Center, 1, 1)) + lungeForwardSpeed *= 1.2f; + + // ocne the calmdown timer hits 3 seconds and the crab is on the ground, go back to hiding + if (outofRange && CalmDownTimer > 180) + { + playerCrossed = false; + ChangeAIHook((int)AIState.Hiding); + NPC.velocity.X = 0; + } + // after 3 hops, start walking once the crab is on the ground + if (HopTimer >= 3) + { + ChangeAIHook((int)AIState.Walking); + } + if (Main.netMode != NetmodeID.MultiplayerClient && AITimer > hopRate) + { + HopTimer++; + + // Make a bigger leap every 3 hops. + if (HopTimer % 3f == 2f) + lungeForwardSpeed *= 1.5f; + + AITimer = 0f; + NPC.velocity.Y -= jumpSpeed; + NPC.velocity.X = lungeForwardSpeed * NPC.direction; + NPC.netUpdate = true; + } + } + else + { + NPC.knockBackResist = 0.2f; + NPC.velocity.X *= 0.995f; + } + } + break; + case 4: + { + AITimer++; + NPC.knockBackResist = BaseKB; + NPC.damage = BaseAttack; + NPC.defense = BaseDefense; + // deaggro code is the same as above + bool outofRange = ((Target.Center.Distance(NPC.Center) > 300) || (Target.Center.Distance(NPC.Center) > 120 && !Collision.CanHitLine(NPC.Center, 1, 1, Target.Center, 1, 1))); + if (outofRange) + { + CalmDownTimer++; + } + else if (CalmDownTimer > 0) + { + CalmDownTimer--; + } + // turn around + if (NPC.oldPosition == NPC.position) + { + NPC.direction *= -1; + NPC.netUpdate = true; + } + NPC.velocity.X = MathHelper.Lerp(NPC.velocity.X, 5 * NPC.direction, 0.0125f); + if (outofRange && Main.rand.NextBool(3) && CalmDownTimer > 180) + { + playerCrossed = false; + ChangeAIHook((int)AIState.Hiding); + NPC.velocity.X = 0; + } + // after 4 seconds and the player is still in the crab's line of sight, start leaping at them again + if (AITimer > 240 && Collision.CanHitLine(NPC.Center, 1, 1, Target.Center, 1, 1)) + { + ChangeAIHook((int)AIState.Active); + } + } + break; + } + // heavy + if (NPC.velocity.Y > 0) + { + NPC.velocity.Y *= 1.1f; + } + } + + public void ChangePhase(float ai0, float ai1 = -1, float ai2 = -1, float ai3 = -1) + { + CurrentPhase = ai0; + AITimer = ai1 == -1 ? 0 : ai1; + HopTimer = ai2 == -1 ? 0 : ai2; + CalmDownTimer = ai3 == -1 ? 0 : ai3; + NPC.netUpdate = true; + if (Main.netMode == NetmodeID.Server) + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, NPC.whoAmI); + } + + public void ChangeAIHook(float phase) + { + if (Main.netMode == NetmodeID.SinglePlayer) + { + ChangePhase((int)phase); + } + else + { + var netMessage = Mod.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.SyncSlabCrabAI); + netMessage.Write(NPC.whoAmI); + netMessage.Write((int)phase); + netMessage.Send(); + } + } + + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + // Don't draw the bar if in stealth mode. + if (CurrentPhase < (int)AIState.Enraged) + return false; + return null; + } + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.Player.Calamity().ZoneAbyssLayer1 && spawnInfo.Water) + { + return SpawnCondition.OceanMonster.Chance; + } + return 0f; + } + + public override void ModifyNPCLoot(NPCLoot npcLoot) + { + npcLoot.Add(ModContent.ItemType(), 5, 10, 30); + } + + public override void FindFrame(int frameHeight) + { + // walkie + if (NPC.IsABestiaryIconDummy || CurrentPhase == (int)AIState.Active) + { + if (NPC.velocity.Y == 0) + { + if (NPC.frameCounter++ % 6 == 0) + { + NPC.frame.Y += frameHeight; + } + } + if (NPC.velocity.X != 0 || NPC.IsABestiaryIconDummy) + { + if (NPC.frame.Y > frameHeight * 22 || NPC.frame.Y < frameHeight * 19) + { + NPC.frame.Y = frameHeight * 19; + } + } + else + { + NPC.frame.Y = frameHeight * 19; + } + return; + } + switch (CurrentPhase) + { + case (int)AIState.Hiding: + NPC.frame.Y = 0; + break; + case (int)AIState.IdleAnim: + if (NPC.frameCounter++ % 6 == 0) + { + NPC.frame.Y += frameHeight; + } + if (NPC.frame.Y > frameHeight * 14) + { + NPC.frame.Y = frameHeight * 0; + } + break; + case (int)AIState.Enraged: + if (NPC.frame.Y > frameHeight * 18 || NPC.frame.Y < frameHeight * 15) + { + NPC.frame.Y = frameHeight * 15; + } + if (NPC.frame.Y < frameHeight * 18) + { + NPC.frameCounter++; + } + if (NPC.frameCounter >= 6) + { + NPC.frame.Y += frameHeight; + NPC.frameCounter = 0; + } + break; + default: + if (NPC.frameCounter++ % 6 == 0) + { + NPC.frame.Y += frameHeight; + } + if (NPC.frame.Y > frameHeight * 22 || NPC.frame.Y < frameHeight * 19) + { + NPC.frame.Y = frameHeight * 19; + } + break; + } + } + // the crab is invincible while hiding + public override bool? CanBeHitByItem(Player player, Item item) => CurrentPhase > (int)AIState.IdleAnim; + + public override bool? CanBeHitByProjectile(Projectile projectile) => CurrentPhase > (int)AIState.IdleAnim; + + public void HandlePickaxeInteraction() + { + Player player = Main.LocalPlayer; + Rectangle tileMaus = new Rectangle(Player.tileTargetX * 16, Player.tileTargetY * 16, 16, 16); + // check if the player is holding a pickaxe + if (player.HeldItem.pick > 0) + { + // check if the tile sized cursor intersects with the crab + if (tileMaus.Intersects(NPC.getRect())) + { + // check if the crab is within range of the player's mining distance + if (player.Distance(NPC.Center) < (new Vector2(Player.tileRangeX, Player.tileRangeY).Length() + player.HeldItem.tileBoost) * 16) + { + // finally check if the player is actually swinging their pickaxe + if (player.ItemAnimationActive) + { + // ouch! + player.ApplyDamageToNPC(NPC, (int)player.GetDamage(DamageClass.MeleeNoSpeed).ApplyTo(player.HeldItem.damage), 0, player.direction); + SoundEngine.PlaySound(SoundID.Dig, NPC.Center); // this is the dig sound that shale piles use + if (CurrentPhase < (int)AIState.Enraged) + { + ChangeAIHook((int)AIState.Enraged); + } + } + } + } + } + } + + public void HandlePlayerDetection() + { + if (!playerCrossed) + { + // if the player is within a 4 pixel distance of the NPC's horizontal position and is within its line of sight, mark the player as noticed + if (Math.Abs(Target.position.X - NPC.position.X) < 4 && Collision.CanHitLine(NPC.Center, 1, 1, Target.Center, 1, 1)) + { + playerCrossed = true; + } + } + else + { + // once the player moves 8 blocks away, jump them + if (Target.Distance(NPC.Center) > 128) + { + ChangeAIHook((int)AIState.Enraged); + } + } + } + + public override void HitEffect(NPC.HitInfo hit) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Water, hit.HitDirection, -1f, 0, default, 1f); + } + if (NPC.life <= 0) + { + for (int k = 0; k < 15; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Water, hit.HitDirection, -1f, 0, default, 1f); + } + if (Main.netMode != NetmodeID.Server) + { + for (int i = 1; i < 5; i++) + { + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SlabCrab" + i).Type, 1f); + } + } + } + } + public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) + { + if (hurtInfo.Damage > 0) + target.AddBuff(ModContent.BuffType(), 90); + } + public override void PostDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + { + if (!NPC.IsABestiaryIconDummy) + { + var effects = NPC.spriteDirection != 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + + Main.EntitySpriteDraw(GlowTexture.Value, NPC.Center - Main.screenPosition + new Vector2(0, NPC.gfxOffY + 4), + NPC.frame, Color.White * 0.5f, NPC.rotation, NPC.frame.Size() / 2f, NPC.scale, effects, 0); + } + } + } +} diff --git a/NPCs/Abyss/SlabCrab.png b/NPCs/Abyss/SlabCrab.png new file mode 100644 index 0000000000..d1e3465c13 Binary files /dev/null and b/NPCs/Abyss/SlabCrab.png differ diff --git a/NPCs/Abyss/SlabCrabGlow.png b/NPCs/Abyss/SlabCrabGlow.png new file mode 100644 index 0000000000..0af1cd2b82 Binary files /dev/null and b/NPCs/Abyss/SlabCrabGlow.png differ diff --git a/NPCs/Abyss/ToxicMinnow.cs b/NPCs/Abyss/ToxicMinnow.cs index dc6308bd63..02efa40f7b 100644 --- a/NPCs/Abyss/ToxicMinnow.cs +++ b/NPCs/Abyss/ToxicMinnow.cs @@ -1,31 +1,38 @@ -using CalamityMod.BiomeManagers; +using System; +using System.IO; +using CalamityMod.BiomeManagers; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; +using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; using CalamityMod.Projectiles.Enemy; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; +using ReLogic.Content; using Terraria; +using Terraria.Audio; using Terraria.GameContent; using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.Utilities; -using Terraria.Audio; namespace CalamityMod.NPCs.Abyss { public class ToxicMinnow : ModNPC { + public static Asset GlowTexture; public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 4; - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { Scale = 0.8f, }; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -50,13 +57,17 @@ namespace CalamityMod.NPCs.Abyss NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[2] { ModContent.GetInstance().Type, ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.ToxicMinnow") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.ToxicMinnow") }); } @@ -72,7 +83,7 @@ namespace CalamityMod.NPCs.Abyss public override void AI() { - CalamityAI.PassiveSwimmingAI(NPC, Mod, 2, 0f, 0f, 0f, 0f, 0f, 0.1f); + CalamityRegularEnemyAI.PassiveSwimmingAI(NPC, Mod, 2, 0f, 0f, 0f, 0f, 0f, 0.1f); } public override bool? CanBeHitByProjectile(Projectile projectile) @@ -100,7 +111,7 @@ namespace CalamityMod.NPCs.Abyss double deltaAngleBoom = spreadBoom / 8f; double offsetAngleBoom; int iBoom; - int damageBoom = 30; + int damageBoom = Main.masterMode ? 19 : Main.expertMode ? 22 : 30; for (iBoom = 0; iBoom < 5; iBoom++) { int projectileType = ModContent.ProjectileType(); @@ -117,11 +128,9 @@ namespace CalamityMod.NPCs.Abyss { if (!NPC.IsABestiaryIconDummy) { - Texture2D tex = ModContent.Request("CalamityMod/NPCs/Abyss/ToxicMinnowGlow").Value; - var effects = NPC.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - Main.EntitySpriteDraw(tex, NPC.Center - Main.screenPosition + new Vector2(0, NPC.gfxOffY + 4), + Main.EntitySpriteDraw(GlowTexture.Value, NPC.Center - Main.screenPosition + new Vector2(0, NPC.gfxOffY + 4), NPC.frame, Color.White * 0.5f, NPC.rotation, NPC.frame.Size() / 2f, NPC.scale, effects, 0); } } @@ -176,21 +185,21 @@ namespace CalamityMod.NPCs.Abyss public override void ModifyNPCLoot(NPCLoot npcLoot) { - var postClone = npcLoot.DefineConditionalDropSet(DropHelper.PostCal()); - postClone.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 2, 2, 3, 4, 6)); + var postLevi = npcLoot.DefineConditionalDropSet(DropHelper.PostLevi()); + postLevi.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 2, 2, 3, 4, 6)); } public override void HitEffect(NPC.HitInfo hit) { for (int k = 0; k < 5; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 40, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.JunglePlants, hit.HitDirection, -1f, 0, default, 1f); } if (NPC.life <= 0) { for (int k = 0; k < 50; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 40, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.JunglePlants, hit.HitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/Abyss/Viperfish.cs b/NPCs/Abyss/Viperfish.cs index 43e88471c6..c81ad502c2 100644 --- a/NPCs/Abyss/Viperfish.cs +++ b/NPCs/Abyss/Viperfish.cs @@ -1,13 +1,17 @@ -using CalamityMod.BiomeManagers; +using System.IO; +using CalamityMod.BiomeManagers; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System.IO; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.GameContent.Bestiary; +using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.Utilities; @@ -16,15 +20,20 @@ namespace CalamityMod.NPCs.Abyss { public class Viperfish : ModNPC { + public static Asset GlowTexture; public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 4; - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { PortraitPositionXOverride = 0 }; value.Position.X += 15; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -49,13 +58,17 @@ namespace CalamityMod.NPCs.Abyss NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[2] { ModContent.GetInstance().Type, ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Viperfish") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Viperfish") }); } @@ -71,7 +84,7 @@ namespace CalamityMod.NPCs.Abyss public override void AI() { - CalamityAI.PassiveSwimmingAI(NPC, Mod, 0, Main.player[NPC.target].Calamity().GetAbyssAggro(160f), 0.25f, 0.15f, 6f, 6f, 0.1f); + CalamityRegularEnemyAI.PassiveSwimmingAI(NPC, Mod, 0, Main.player[NPC.target].Calamity().GetAbyssAggro(160f), 0.25f, 0.15f, 6f, 6f, 0.1f); } public override bool? CanBeHitByProjectile(Projectile projectile) @@ -116,11 +129,9 @@ namespace CalamityMod.NPCs.Abyss { if (!NPC.IsABestiaryIconDummy) { - Texture2D tex = ModContent.Request("CalamityMod/NPCs/Abyss/ViperfishGlow").Value; - var effects = NPC.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - Main.EntitySpriteDraw(tex, NPC.Center - Main.screenPosition + new Vector2(0, NPC.gfxOffY + 4), + Main.EntitySpriteDraw(GlowTexture.Value, NPC.Center - Main.screenPosition + new Vector2(0, NPC.gfxOffY + 4), NPC.frame, Color.White * 0.5f, NPC.rotation, NPC.frame.Size() / 2f, NPC.scale, effects, 0); } } @@ -128,7 +139,7 @@ namespace CalamityMod.NPCs.Abyss public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) { if (hurtInfo.Damage > 0) - target.AddBuff(ModContent.BuffType(), 120, true); + target.AddBuff(ModContent.BuffType(), 120, true); } public override float SpawnChance(NPCSpawnInfo spawnInfo) @@ -146,9 +157,10 @@ namespace CalamityMod.NPCs.Abyss public override void ModifyNPCLoot(NPCLoot npcLoot) { - var postClone = npcLoot.DefineConditionalDropSet(DropHelper.PostCal()); - postClone.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 2, 1, 2, 2, 3)); - postClone.Add(ModContent.ItemType(), 4); + var postLevi = npcLoot.DefineConditionalDropSet(DropHelper.PostLevi()); + postLevi.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 2, 1, 2, 2, 3)); + postLevi.Add(ModContent.ItemType(), 4); + npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 10, 6)); } public override void HitEffect(NPC.HitInfo hit) diff --git a/NPCs/AcidRain/AcidEel.cs b/NPCs/AcidRain/AcidEel.cs index b4245e62ea..f507bcc990 100644 --- a/NPCs/AcidRain/AcidEel.cs +++ b/NPCs/AcidRain/AcidEel.cs @@ -1,39 +1,50 @@ -using CalamityMod.BiomeManagers; +using System; +using System.Linq; +using CalamityMod.BiomeManagers; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; -using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Graphics.Primitives; using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Weapons.Magic; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; +using ReLogic.Content; using Terraria; using Terraria.Audio; +using Terraria.GameContent; using Terraria.GameContent.Bestiary; using Terraria.GameContent.ItemDropRules; +using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Graphics.Shaders; -using System.Linq; -using CalamityMod.Graphics.Primitives; namespace CalamityMod.NPCs.AcidRain { public class AcidEel : ModNPC { public Player Target => Main.player[NPC.target]; + public static Asset BodyTexture; + public static Asset TailTexture; + public static Asset BestiaryTexture; public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 6; NPCID.Sets.TrailingMode[NPC.type] = 1; NPCID.Sets.TrailCacheLength[NPC.type] = 12; - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { PortraitPositionXOverride = 0 }; value.Position.X += 15; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + BodyTexture = ModContent.Request(Texture + "Body", AssetRequestMode.ImmediateLoad); + TailTexture = ModContent.Request(Texture + "Tail", AssetRequestMode.AsyncLoad); + BestiaryTexture = ModContent.Request(Texture + "Bestiary", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -74,6 +85,10 @@ namespace CalamityMod.NPCs.AcidRain NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -180,14 +195,14 @@ namespace CalamityMod.NPCs.AcidRain Vector2 headDrawPosition = NPC.Center - screenPos; if (NPC.IsABestiaryIconDummy) { - Texture2D texture = ModContent.Request("CalamityMod/NPCs/AcidRain/AcidEelBestiary").Value; + Texture2D texture = BestiaryTexture.Value; Rectangle eelArea = NPC.frame with { Width = 74 }; Main.EntitySpriteDraw(texture, headDrawPosition, eelArea, NPC.GetAlpha(Color.White), NPC.rotation, eelArea.Size() * 0.5f, NPC.scale, SpriteEffects.None, 0); return false; } - Texture2D headTexture = ModContent.Request(Texture).Value; - Texture2D tailTexture = ModContent.Request("CalamityMod/NPCs/AcidRain/AcidEelTail").Value; + Texture2D headTexture = TextureAssets.Npc[NPC.type].Value; + Texture2D tailTexture = TailTexture.Value; Vector2[] segmentPositions = (Vector2[])NPC.oldPos.Clone(); Vector2 segmentAreaTopLeft = Vector2.One * 999999f; @@ -217,7 +232,7 @@ namespace CalamityMod.NPCs.AcidRain float offsetAngle = (NPC.position - NPC.oldPos[1]).ToRotation(); Vector2 primitiveArea = (segmentAreaTopRight - segmentAreaTopLeft).RotatedBy(offsetAngle); Rectangle tailArea = NPC.frame with { Width = 28 }; - GameShaders.Misc["CalamityMod:PrimitiveTexture"].SetShaderTexture(ModContent.Request("CalamityMod/NPCs/AcidRain/AcidEelBody")); + GameShaders.Misc["CalamityMod:PrimitiveTexture"].SetShaderTexture(BodyTexture); GameShaders.Misc["CalamityMod:PrimitiveTexture"].Shader.Parameters["uPrimitiveSize"].SetValue(primitiveArea); GameShaders.Misc["CalamityMod:PrimitiveTexture"].Shader.Parameters["flipVertically"].SetValue(NPC.velocity.X > 0f); @@ -239,7 +254,7 @@ namespace CalamityMod.NPCs.AcidRain public override void HitEffect(NPC.HitInfo hit) { for (int k = 0; k < 8; k++) - Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulphurousSeaAcid, hit.HitDirection, -1f, 0, default, 1f); if (NPC.life <= 0) { if (Main.netMode != NetmodeID.Server) @@ -249,7 +264,7 @@ namespace CalamityMod.NPCs.AcidRain Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("AcidEelGore3").Type, NPC.scale); } for (int k = 0; k < 20; k++) - Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulphurousSeaAcid, hit.HitDirection, -1f, 0, default, 1f); } } diff --git a/NPCs/AcidRain/BabyFlakCrab.cs b/NPCs/AcidRain/BabyFlakCrab.cs index ae27431687..b712830a88 100644 --- a/NPCs/AcidRain/BabyFlakCrab.cs +++ b/NPCs/AcidRain/BabyFlakCrab.cs @@ -1,10 +1,10 @@ -using CalamityMod.BiomeManagers; +using System; +using CalamityMod.BiomeManagers; using CalamityMod.Dusts; -using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Critters; using CalamityMod.Items.Pets; +using CalamityMod.Items.Placeables.Banners; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.GameContent.Bestiary; using Terraria.ID; @@ -62,7 +62,7 @@ namespace CalamityMod.NPCs.AcidRain } if (Main.rand.NextBool(8) && NPC.catchItem == (short)ModContent.ItemType()) { - int dust = Dust.NewDust(NPC.position - new Vector2(2f, 2f), NPC.width + 4, NPC.height + 4, (int)CalamityDusts.SulfurousSeaAcid, NPC.velocity.X * 0.4f, NPC.velocity.Y * 0.4f, 200, default, 1f); + int dust = Dust.NewDust(NPC.position - new Vector2(2f, 2f), NPC.width + 4, NPC.height + 4, (int)CalamityDusts.SulphurousSeaAcid, NPC.velocity.X * 0.4f, NPC.velocity.Y * 0.4f, 200, default, 1f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 1.1f; Main.dust[dust].velocity.Y += 0.25f; @@ -141,13 +141,13 @@ namespace CalamityMod.NPCs.AcidRain { for (int k = 0; k < 5; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulphurousSeaAcid, hit.HitDirection, -1f, 0, default, 1f); } if (NPC.life <= 0) { for (int k = 0; k < 15; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulphurousSeaAcid, hit.HitDirection, -1f, 0, default, 1f); } if (Main.netMode != NetmodeID.Server) { diff --git a/NPCs/AcidRain/BloodwormFleeing.cs b/NPCs/AcidRain/BloodwormFleeing.cs index c7053bc198..95483b5893 100644 --- a/NPCs/AcidRain/BloodwormFleeing.cs +++ b/NPCs/AcidRain/BloodwormFleeing.cs @@ -1,5 +1,5 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.Localization; diff --git a/NPCs/AcidRain/BloodwormNormal.cs b/NPCs/AcidRain/BloodwormNormal.cs index c303aa1459..18c8b4e8c9 100644 --- a/NPCs/AcidRain/BloodwormNormal.cs +++ b/NPCs/AcidRain/BloodwormNormal.cs @@ -1,8 +1,8 @@ -using CalamityMod.BiomeManagers; +using System; +using CalamityMod.BiomeManagers; using CalamityMod.Events; using CalamityMod.Items.SummonItems; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.GameContent.Bestiary; using Terraria.ID; @@ -81,7 +81,7 @@ namespace CalamityMod.NPCs.AcidRain public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Bloodworm") }); diff --git a/NPCs/AcidRain/CragmawMire.cs b/NPCs/AcidRain/CragmawMire.cs index 8efc886612..336e418767 100644 --- a/NPCs/AcidRain/CragmawMire.cs +++ b/NPCs/AcidRain/CragmawMire.cs @@ -9,8 +9,10 @@ using CalamityMod.Projectiles.Enemy; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; +using Terraria.GameContent; using Terraria.GameContent.Bestiary; using Terraria.GameContent.ItemDropRules; using Terraria.ID; @@ -51,11 +53,16 @@ namespace CalamityMod.NPCs.AcidRain return NPC.life / (float)NPC.lifeMax < phase2CeilingRatio && DownedBossSystem.downedPolterghast; } } + public static Asset Phase2Texture; public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 2; NPCID.Sets.BossBestiaryPriority.Add(Type); + if (!Main.dedServ) + { + Phase2Texture = ModContent.Request(Texture + "2", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -94,9 +101,9 @@ namespace CalamityMod.NPCs.AcidRain public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.CragmawMire") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.CragmawMire") }); } @@ -184,7 +191,7 @@ namespace CalamityMod.NPCs.AcidRain if (Main.netMode != NetmodeID.MultiplayerClient) { - int damage = DownedBossSystem.downedPolterghast ? 52 : 33; + int damage = DownedBossSystem.downedPolterghast ? (Main.masterMode ? 35 : Main.expertMode ? 42 : 52) : (Main.masterMode ? 22 : Main.expertMode ? 26 : 33); float shootOffsetAngle = Main.rand.NextFloat(MathHelper.TwoPi); for (int i = 0; i < spikesPerBurst; i++) { @@ -290,7 +297,7 @@ namespace CalamityMod.NPCs.AcidRain SoundEngine.PlaySound(SoundID.DD2_ExplosiveTrapExplode, NPC.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { - int nukeDamage = DownedBossSystem.downedPolterghast ? 72 : 38; + int nukeDamage = DownedBossSystem.downedPolterghast ? (Main.masterMode ? 49 : Main.expertMode ? 58 : 72) : (Main.masterMode ? 25 : Main.expertMode ? 30 : 38); int dropletDamage = (int)(nukeDamage * 0.6f); int explosion = Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, Vector2.Zero, ModContent.ProjectileType(), nukeDamage, 0f); if (Main.projectile.IndexInRange(explosion)) @@ -416,7 +423,7 @@ namespace CalamityMod.NPCs.AcidRain if (Main.netMode != NetmodeID.MultiplayerClient) { - int laserbeamDamage = DownedBossSystem.downedPolterghast ? 120 : 40; + int laserbeamDamage = DownedBossSystem.downedPolterghast ? (Main.masterMode ? 81 : Main.expertMode ? 96 : 120) : (Main.masterMode ? 27 : Main.expertMode ? 32 : 40); Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, -Vector2.UnitY, ModContent.ProjectileType(), laserbeamDamage, 0f, Main.myPlayer, 0f, NPC.whoAmI); } } @@ -467,7 +474,7 @@ namespace CalamityMod.NPCs.AcidRain public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { - Texture2D texture = InPhase2 ? ModContent.Request("CalamityMod/NPCs/AcidRain/CragmawMire2").Value : ModContent.Request("CalamityMod/NPCs/AcidRain/CragmawMire").Value; + Texture2D texture = InPhase2 ? Phase2Texture.Value : TextureAssets.Npc[Type].Value; Main.EntitySpriteDraw(texture, NPC.Center - screenPos, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, NPC.frame.Size() * 0.5f, NPC.scale, 0, 0); return false; } @@ -484,7 +491,7 @@ namespace CalamityMod.NPCs.AcidRain public override void HitEffect(NPC.HitInfo hit) { for (int k = 0; k < 5; k++) - Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulphurousSeaAcid, hit.HitDirection, -1f, 0, default, 1f); if (NPC.life <= 0) { if (Main.netMode != NetmodeID.Server) @@ -512,7 +519,7 @@ namespace CalamityMod.NPCs.AcidRain public override void ModifyNPCLoot(NPCLoot npcLoot) { // If post-Polter, the drop rates are 10%. Otherwise they're 100%. - // This is accomplished by adding rules if the CONDITION "Post-Polter" fails. + // This is accomplished by adding rules if the CONDITION "Post-Polter" fails. LeadingConditionRule postPolter = npcLoot.DefineConditionalDropSet(() => DownedBossSystem.downedPolterghast); postPolter.Add(ModContent.ItemType(), 10, hideLootReport: !DownedBossSystem.downedPolterghast); postPolter.Add(ModContent.ItemType(), 10, hideLootReport: !DownedBossSystem.downedPolterghast); diff --git a/NPCs/AcidRain/FlakCrab.cs b/NPCs/AcidRain/FlakCrab.cs index 6cf8ecc655..cff8b1674b 100644 --- a/NPCs/AcidRain/FlakCrab.cs +++ b/NPCs/AcidRain/FlakCrab.cs @@ -1,12 +1,12 @@ -using CalamityMod.BiomeManagers; +using System; +using System.IO; +using CalamityMod.BiomeManagers; using CalamityMod.Dusts; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Projectiles.Enemy; using Microsoft.Xna.Framework; -using System; -using System.IO; using Terraria; using Terraria.GameContent.Bestiary; using Terraria.GameContent.ItemDropRules; @@ -60,13 +60,17 @@ namespace CalamityMod.NPCs.AcidRain NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.FlakCrab") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.FlakCrab") }); } @@ -160,7 +164,7 @@ namespace CalamityMod.NPCs.AcidRain float speed = DownedBossSystem.downedPolterghast ? 29f : 17f; speed *= Main.rand.NextFloat(0.8f, 1.2f); - int damage = Main.expertMode ? DownedBossSystem.downedPolterghast ? 32 : 18 : DownedBossSystem.downedPolterghast ? 42 : 23; + int damage = Main.masterMode ? (DownedBossSystem.downedPolterghast ? 27 : 15) : Main.expertMode ? (DownedBossSystem.downedPolterghast ? 32 : 18) : (DownedBossSystem.downedPolterghast ? 42 : 23); Vector2 spawnPosition = NPC.Top + Vector2.UnitY * 6f; Vector2 shootVelocity = (closestTargetToTop.Center - spawnPosition).SafeNormalize(Vector2.UnitY).RotatedByRandom(0.25f) * speed; Projectile.NewProjectile(NPC.GetSource_FromAI(), spawnPosition, shootVelocity, ModContent.ProjectileType(), damage, 2f); @@ -214,13 +218,13 @@ namespace CalamityMod.NPCs.AcidRain { for (int k = 0; k < 5; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulphurousSeaAcid, hit.HitDirection, -1f, 0, default, 1f); } if (NPC.life <= 0) { for (int k = 0; k < 15; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulphurousSeaAcid, hit.HitDirection, -1f, 0, default, 1f); } if (Main.netMode != NetmodeID.Server) { diff --git a/NPCs/AcidRain/GammaSlime.cs b/NPCs/AcidRain/GammaSlime.cs index 55f22ea971..bf2da35ba4 100644 --- a/NPCs/AcidRain/GammaSlime.cs +++ b/NPCs/AcidRain/GammaSlime.cs @@ -1,16 +1,17 @@ -using CalamityMod.BiomeManagers; +using System; +using CalamityMod.BiomeManagers; +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; using CalamityMod.Items.Placeables.Banners; -using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Projectiles.Enemy; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; +using ReLogic.Content; using Terraria; +using Terraria.Audio; using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.NPCs.AcidRain { @@ -24,10 +25,15 @@ namespace CalamityMod.NPCs.AcidRain public float LaserTelegraphOpacity => MathHelper.Lerp(0.3f, 0.9f, LaserTelegraphPower); public ref float GammaAcidShootTimer => ref NPC.ai[0]; public ref float LaserShootCountdown => ref NPC.ai[1]; + public static Asset GlowTexture; public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 2; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -58,18 +64,24 @@ namespace CalamityMod.NPCs.AcidRain NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.GammaSlime") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.GammaSlime") }); } public override void AI() { + NPC.damage = (NPC.velocity.Y == 0f || NPC.velocity.Length() < 3f) ? 0 : NPC.defDamage; + // Release green light at the position of the slime. Lighting.AddLight((int)NPC.Center.X / 16, (int)NPC.Center.Y / 16, 0.6f, 0.8f, 0.6f); @@ -94,7 +106,7 @@ namespace CalamityMod.NPCs.AcidRain float angle = MathHelper.TwoPi / 5f * i; if (GammaAcidShootTimer % 60f == 58f) angle += MathHelper.PiOver2; - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, angle.ToRotationVector2() * 7f, ModContent.ProjectileType(), Main.expertMode ? 36 : 45, 3f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, angle.ToRotationVector2() * 7f, ModContent.ProjectileType(), Main.masterMode ? 30 : Main.expertMode ? 36 : 45, 3f); } } NPC.netUpdate = true; @@ -118,7 +130,7 @@ namespace CalamityMod.NPCs.AcidRain { float scale = LaserShootCountdown < 530f ? 2.25f : 1.65f; Vector2 destination = NPC.Top + new Vector2(0f, 6f); - Dust dust = Dust.NewDustPerfect(destination + Main.rand.NextVector2CircularEdge(12f, 12f), (int)CalamityDusts.SulfurousSeaAcid); + Dust dust = Dust.NewDustPerfect(destination + Main.rand.NextVector2CircularEdge(12f, 12f), (int)CalamityDusts.SulphurousSeaAcid); dust.velocity = Vector2.Normalize(destination - dust.position) * 3f; dust.scale = scale; dust.noGravity = true; @@ -129,7 +141,7 @@ namespace CalamityMod.NPCs.AcidRain { float angle = i / 24f; Vector2 spawnPosition = new Vector2(NPC.Center.X, i); - dust = Dust.NewDustPerfect(spawnPosition, (int)CalamityDusts.SulfurousSeaAcid); + dust = Dust.NewDustPerfect(spawnPosition, (int)CalamityDusts.SulphurousSeaAcid); dust.scale = 1.5f; dust.velocity = Vector2.UnitX * (float)Math.Cos(angle) * (1f - LaserTelegraphPower) * 4f; dust.noGravity = true; @@ -145,7 +157,7 @@ namespace CalamityMod.NPCs.AcidRain if (Main.netMode != NetmodeID.MultiplayerClient) { SoundEngine.PlaySound(SoundID.Zombie104, NPC.Center); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, -Vector2.UnitY, ModContent.ProjectileType(), Main.expertMode ? 96 : 120, 4f, Main.myPlayer, 0f, NPC.whoAmI); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, -Vector2.UnitY, ModContent.ProjectileType(), Main.masterMode ? 81 : Main.expertMode ? 96 : 120, 4f, Main.myPlayer, 0f, NPC.whoAmI); } NPC.netUpdate = true; } @@ -157,12 +169,12 @@ namespace CalamityMod.NPCs.AcidRain float horizontalSpeed = (float)Math.Sin(angle * DustAngleMultiplier1) * (float)Math.Cos(angle) * 4.5f; float verticalSpeed = (float)Math.Cos(angle * DustAngleMultiplier1) * (float)Math.Sin(angle) * 2f; Vector2 velocity = new Vector2(horizontalSpeed, verticalSpeed); - Dust dust = Dust.NewDustPerfect(NPC.Center + angle.ToRotationVector2() * 8f, (int)CalamityDusts.SulfurousSeaAcid); + Dust dust = Dust.NewDustPerfect(NPC.Center + angle.ToRotationVector2() * 8f, (int)CalamityDusts.SulphurousSeaAcid); dust.velocity = velocity; dust.scale = (float)Math.Cos(angle) + 2f; dust.noGravity = true; - dust = Dust.NewDustPerfect(NPC.Center + angle.ToRotationVector2() * 8f, (int)CalamityDusts.SulfurousSeaAcid); + dust = Dust.NewDustPerfect(NPC.Center + angle.ToRotationVector2() * 8f, (int)CalamityDusts.SulphurousSeaAcid); dust.velocity = -velocity; dust.scale = (float)Math.Cos(angle) + 2f; dust.noGravity = true; @@ -180,11 +192,11 @@ namespace CalamityMod.NPCs.AcidRain public override void HitEffect(NPC.HitInfo hit) { for (int k = 0; k < 10; k++) - Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulphurousSeaAcid, 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, (int)CalamityDusts.SulfurousSeaAcid, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulphurousSeaAcid, hit.HitDirection, -1f, 0, default, 1f); if (Main.netMode != NetmodeID.Server) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("GammaSlimeGore").Type, NPC.scale); @@ -201,7 +213,7 @@ namespace CalamityMod.NPCs.AcidRain Vector2 laserTop = laserBottom - Vector2.UnitY * LaserTelegraphLength; Utils.DrawLine(spriteBatch, laserBottom, laserTop, Color.Lerp(Color.Lime, Color.Transparent, LaserTelegraphOpacity)); } - CalamityGlobalNPC.DrawGlowmask(NPC, spriteBatch, ModContent.Request(Texture + "Glow").Value); + CalamityGlobalNPC.DrawGlowmask(NPC, spriteBatch, GlowTexture.Value); } public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) diff --git a/NPCs/AcidRain/IrradiatedSlime.cs b/NPCs/AcidRain/IrradiatedSlime.cs index 67a63231d4..d371fa1641 100644 --- a/NPCs/AcidRain/IrradiatedSlime.cs +++ b/NPCs/AcidRain/IrradiatedSlime.cs @@ -1,10 +1,11 @@ -using CalamityMod.BiomeManagers; -using CalamityMod.Dusts; +using System.IO; +using CalamityMod.BiomeManagers; using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Dusts; using CalamityMod.Items.Placeables.Banners; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System.IO; +using ReLogic.Content; using Terraria; using Terraria.GameContent.Bestiary; using Terraria.ID; @@ -14,10 +15,15 @@ namespace CalamityMod.NPCs.AcidRain public class IrradiatedSlime : ModNPC { public bool Falling = true; + public static Asset GlowTexture; public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 2; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -29,7 +35,7 @@ namespace CalamityMod.NPCs.AcidRain NPC.lifeMax = 220; NPC.defense = 5; - NPC.knockBackResist = 0f; + NPC.knockBackResist = 0.5f; AnimationType = NPCID.CorruptSlime; AIType = NPCID.ToxicSludge; NPC.value = Item.buyPrice(0, 0, 5, 0); @@ -46,6 +52,10 @@ namespace CalamityMod.NPCs.AcidRain NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -53,9 +63,9 @@ namespace CalamityMod.NPCs.AcidRain int associatedNPCType = ModContent.NPCType(); //This exists so you're not locked out of getting an entry for Irradiated Slime if you skip the second tier bestiaryEntry.UIInfoProvider = new CommonEnemyUICollectionInfoProvider(ContentSamples.NpcBestiaryCreditIdsByNpcNetIds[associatedNPCType], quickUnlock: true); - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.IrradiatedSlime") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.IrradiatedSlime") }); } @@ -73,6 +83,8 @@ namespace CalamityMod.NPCs.AcidRain public override void AI() { + NPC.damage = (NPC.velocity.Y == 0f || NPC.velocity.Length() < 3f) ? 0 : NPC.defDamage; + Lighting.AddLight((int)((NPC.position.X + (float)(NPC.width / 2)) / 16f), (int)((NPC.position.Y + (float)(NPC.height / 2)) / 16f), 0.6f, 0.8f, 0.6f); if (Falling) { @@ -102,13 +114,13 @@ namespace CalamityMod.NPCs.AcidRain { for (int k = 0; k < 5; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulphurousSeaAcid, 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, (int)CalamityDusts.SulfurousSeaAcid, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulphurousSeaAcid, hit.HitDirection, -1f, 0, default, 1f); } if (Main.netMode != NetmodeID.Server) { @@ -120,7 +132,7 @@ namespace CalamityMod.NPCs.AcidRain public override void PostDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { - CalamityGlobalNPC.DrawGlowmask(NPC, spriteBatch, ModContent.Request(Texture + "Glow").Value); + CalamityGlobalNPC.DrawGlowmask(NPC, spriteBatch, GlowTexture.Value); } public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) diff --git a/NPCs/AcidRain/Mauler.cs b/NPCs/AcidRain/Mauler.cs index a835f8ee24..fa9a03aac0 100644 --- a/NPCs/AcidRain/Mauler.cs +++ b/NPCs/AcidRain/Mauler.cs @@ -1,4 +1,5 @@ -using CalamityMod.BiomeManagers; +using System; +using CalamityMod.BiomeManagers; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Placeables.Furniture.BossRelics; using CalamityMod.Items.Placeables.Furniture.Trophies; @@ -7,15 +8,15 @@ using CalamityMod.Projectiles.Enemy; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; +using ReLogic.Content; using Terraria; +using Terraria.Audio; using Terraria.GameContent; using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; using Terraria.Utilities; using Terraria.WorldBuilding; -using Terraria.Audio; namespace CalamityMod.NPCs.AcidRain { @@ -44,13 +45,15 @@ namespace CalamityMod.NPCs.AcidRain set => NPC.localAI[0] = value; } + public static Asset GlowTexture; + public static readonly SoundStyle RoarSound = new("CalamityMod/Sounds/Custom/MaulerRoar"); public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 8; NPCID.Sets.BossBestiaryPriority.Add(Type); - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { Scale = 0.425f, PortraitScale = 0.9f, @@ -58,6 +61,10 @@ namespace CalamityMod.NPCs.AcidRain }; value.Position.X += 10f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glowmask", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -86,7 +93,7 @@ namespace CalamityMod.NPCs.AcidRain public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Mauler") }); @@ -417,7 +424,7 @@ namespace CalamityMod.NPCs.AcidRain public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { Texture2D texture = TextureAssets.Npc[NPC.type].Value; - Texture2D glowmask = ModContent.Request("CalamityMod/NPCs/AcidRain/MaulerGlowmask").Value; + Texture2D glowmask = GlowTexture.Value; Vector2 drawPosition = NPC.Center - screenPos + Vector2.UnitY * NPC.gfxOffY; Vector2 origin = NPC.frame.Size() * 0.5f; SpriteEffects direction = NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; @@ -489,20 +496,20 @@ namespace CalamityMod.NPCs.AcidRain double deltaAngleBoom = spreadBoom / 8f; double offsetAngleBoom; int iBoom; - int damageBoom = 200; + int damageBoom = Main.masterMode ? 127 : Main.expertMode ? 150 : 200; for (iBoom = 0; iBoom < 25; iBoom++) { int projectileType = Main.rand.NextBool() ? ModContent.ProjectileType() : ModContent.ProjectileType(); offsetAngleBoom = startAngleBoom + deltaAngleBoom * (iBoom + iBoom * iBoom) / 2f + 32f * iBoom; if (Main.netMode != NetmodeID.MultiplayerClient) { - int boom1 = Projectile.NewProjectile(NPC.GetSource_Death(), valueBoom.X, valueBoom.Y, (float)(Math.Sin(offsetAngleBoom) * 6f), (float)(Math.Cos(offsetAngleBoom) * 6f), projectileType, damageBoom, 0f, Main.myPlayer, 0f, 0f); - int boom2 = Projectile.NewProjectile(NPC.GetSource_Death(), valueBoom.X, valueBoom.Y, (float)(-Math.Sin(offsetAngleBoom) * 6f), (float)(-Math.Cos(offsetAngleBoom) * 6f), projectileType, damageBoom, 0f, Main.myPlayer, 0f, 0f); + int boom1 = Projectile.NewProjectile(NPC.GetSource_Death(), valueBoom.X, valueBoom.Y, (float)(Math.Sin(offsetAngleBoom) * 6f), (float)(Math.Cos(offsetAngleBoom) * 6f), projectileType, damageBoom, 0f, Main.myPlayer, 0f, 0f); + int boom2 = Projectile.NewProjectile(NPC.GetSource_Death(), valueBoom.X, valueBoom.Y, (float)(-Math.Sin(offsetAngleBoom) * 6f), (float)(-Math.Cos(offsetAngleBoom) * 6f), projectileType, damageBoom, 0f, Main.myPlayer, 0f, 0f); } } for (int i = 0; i < 25; i++) { - int deathDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, 31, 0f, 0f, 100, default, 2f); + int deathDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Smoke, 0f, 0f, 100, default, 2f); Main.dust[deathDust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -513,10 +520,10 @@ namespace CalamityMod.NPCs.AcidRain } for (int j = 0; j < 50; j++) { - int deathDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, 5, 0f, 0f, 100, default, 3f); + int deathDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, 0f, 0f, 100, default, 3f); Main.dust[deathDust2].noGravity = true; Main.dust[deathDust2].velocity *= 5f; - deathDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, 5, 0f, 0f, 100, default, 2f); + deathDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, 0f, 0f, 100, default, 2f); Main.dust[deathDust2].velocity *= 2f; Main.dust[deathDust2].noGravity = true; } diff --git a/NPCs/AcidRain/NuclearTerror.cs b/NPCs/AcidRain/NuclearTerror.cs index 0b8165919e..c3455067f5 100644 --- a/NPCs/AcidRain/NuclearTerror.cs +++ b/NPCs/AcidRain/NuclearTerror.cs @@ -1,21 +1,21 @@ -using CalamityMod.BiomeManagers; +using System; +using System.IO; +using CalamityMod.BiomeManagers; +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; using CalamityMod.Items.Placeables.Furniture.BossRelics; using CalamityMod.Items.Placeables.Furniture.Trophies; +using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Summon; using CalamityMod.Projectiles.Enemy; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; using Terraria; +using Terraria.Audio; using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Buffs.StatDebuffs; -using CalamityMod.Items.Weapons.Melee; -using Terraria.Audio; namespace CalamityMod.NPCs.AcidRain { @@ -91,7 +91,7 @@ namespace CalamityMod.NPCs.AcidRain NPCID.Sets.TrailCacheLength[NPC.type] = 6; NPCID.Sets.TrailingMode[NPC.type] = 1; NPCID.Sets.BossBestiaryPriority.Add(Type); - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { Scale = 0.4f, Direction = 1 @@ -129,7 +129,7 @@ namespace CalamityMod.NPCs.AcidRain public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.NuclearTerror") }); @@ -365,7 +365,7 @@ namespace CalamityMod.NPCs.AcidRain return; - Continue: +Continue: continue; } } @@ -400,7 +400,7 @@ namespace CalamityMod.NPCs.AcidRain int totalDust = (int)(30 * NPC.alpha / 255f); for (int i = 0; i < totalDust; i++) { - Dust dust = Dust.NewDustDirect(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid); + Dust dust = Dust.NewDustDirect(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulphurousSeaAcid); dust.noGravity = true; dust.velocity = NPC.DirectionFrom(dust.position) * 2f; dust.scale = 1.6f; @@ -423,7 +423,7 @@ namespace CalamityMod.NPCs.AcidRain { for (int i = 0; i < 48; i++) { - Dust dust = Dust.NewDustDirect(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid); + Dust dust = Dust.NewDustDirect(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulphurousSeaAcid); dust.noGravity = true; dust.velocity = NPC.DirectionFrom(dust.position) * Main.rand.NextFloat(2f, 3.6f); dust.scale = 1.8f; @@ -445,6 +445,7 @@ namespace CalamityMod.NPCs.AcidRain public void PerformSpecialAttack(float wrappedAttackTime) { + int damage = Main.masterMode ? 32 : Main.expertMode ? 38 : 48; Vector2 mouthPosition = NPC.Center - Vector2.UnitY * 26f; mouthPosition.X += NPC.spriteDirection * -54f; @@ -467,7 +468,7 @@ namespace CalamityMod.NPCs.AcidRain if (Main.netMode != NetmodeID.MultiplayerClient) { float angle = (wrappedAttackTime - (AttackCycleTime - SpecialAttackTime + 20f)) % 12f / 12f * MathHelper.ToRadians(15f) - MathHelper.ToRadians(7.5f); - int bullet = Projectile.NewProjectile(NPC.GetSource_FromAI(), mouthPosition, directionToShootPosition.RotatedBy(angle) * 14f, ModContent.ProjectileType(), 48, 4f); + int bullet = Projectile.NewProjectile(NPC.GetSource_FromAI(), mouthPosition, directionToShootPosition.RotatedBy(angle) * 14f, ModContent.ProjectileType(), damage, 4f); Main.projectile[bullet].localAI[0] = angle; } NPC.spriteDirection = (ShootPosition.X - NPC.Center.X < 0).ToDirectionInt(); @@ -475,7 +476,7 @@ namespace CalamityMod.NPCs.AcidRain } if (wrappedAttackTime >= (AttackCycleTime - SpecialAttackTime + 35f) && AttackTime % 10f == 9f) - Projectile.NewProjectile(NPC.GetSource_FromAI(), mouthPosition, directionToTarget * 12f, ModContent.ProjectileType(), 48, 3f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), mouthPosition, directionToTarget * 12f, ModContent.ProjectileType(), damage, 3f); break; @@ -486,8 +487,8 @@ namespace CalamityMod.NPCs.AcidRain if (Main.netMode != NetmodeID.MultiplayerClient) { float angle = MathHelper.Lerp(MathHelper.ToRadians(35f), MathHelper.ToRadians(5f), (wrappedAttackTime - (AttackCycleTime - SpecialAttackTime + 35f)) / (SpecialAttackTime + 35f)); - Projectile.NewProjectile(NPC.GetSource_FromAI(), mouthPosition, directionToTarget.RotatedBy(angle) * 16f, ModContent.ProjectileType(), 48, 4.5f); - Projectile.NewProjectile(NPC.GetSource_FromAI(), mouthPosition, directionToTarget.RotatedBy(-angle) * 16f, ModContent.ProjectileType(), 48, 4.5f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), mouthPosition, directionToTarget.RotatedBy(angle) * 16f, ModContent.ProjectileType(), damage, 4.5f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), mouthPosition, directionToTarget.RotatedBy(-angle) * 16f, ModContent.ProjectileType(), damage, 4.5f); } NPC.spriteDirection = (Target.Center.X - NPC.Center.X < 0).ToDirectionInt(); @@ -504,7 +505,7 @@ namespace CalamityMod.NPCs.AcidRain for (int i = 0; i < 3; i++) { float angle = MathHelper.Lerp(-0.5f, 0.5f, i / 3f); - Projectile.NewProjectile(NPC.GetSource_FromAI(), mouthPosition, directionToShootPosition.RotatedBy(angle) * 13f, ModContent.ProjectileType(), 48, 4f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), mouthPosition, directionToShootPosition.RotatedBy(angle) * 13f, ModContent.ProjectileType(), damage, 4f); } } @@ -523,7 +524,7 @@ namespace CalamityMod.NPCs.AcidRain NPC.alpha = 0; if (DeathrayTime < 240f) { - int bigFuckOffDeathrayDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 200, default, 1.5f); + int bigFuckOffDeathrayDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulphurousSeaAcid, 0f, 0f, 200, default, 1.5f); Main.dust[bigFuckOffDeathrayDust].noGravity = true; Main.dust[bigFuckOffDeathrayDust].velocity *= 0.75f; Main.dust[bigFuckOffDeathrayDust].fadeIn = 1.3f; @@ -583,19 +584,20 @@ namespace CalamityMod.NPCs.AcidRain SoundEngine.PlaySound(DeathSound, NPC.Center); if (NPC.frame.Y < frameHeight * 8) { + int damage = Main.masterMode ? 32 : Main.expertMode ? 38 : 48; if (Main.netMode != NetmodeID.MultiplayerClient) { for (int i = 0; i < 16; i++) { int type = Main.rand.NextBool(4) ? ModContent.ProjectileType() : ModContent.ProjectileType(); float angle = MathHelper.TwoPi / 16f * i; - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, angle.ToRotationVector2() * Main.rand.NextFloat(4f, 11f), type, 48, 3f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, angle.ToRotationVector2() * Main.rand.NextFloat(4f, 11f), type, damage, 3f); } } for (int i = 0; i < 60; i++) { - Dust dust = Dust.NewDustDirect(NPC.Center, 45, 45, (int)CalamityDusts.SulfurousSeaAcid); + Dust dust = Dust.NewDustDirect(NPC.Center, 45, 45, (int)CalamityDusts.SulphurousSeaAcid); dust.velocity = Utils.NextVector2Unit(Main.rand) * Main.rand.NextFloat(4f, 15f); dust.noGravity = true; dust.scale = Main.rand.NextFloat(2f, 3f); @@ -657,7 +659,7 @@ namespace CalamityMod.NPCs.AcidRain public override void HitEffect(NPC.HitInfo hit) { for (int k = 0; k < 10; k++) - Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulphurousSeaAcid, hit.HitDirection, -1f, 0, default, 1f); } public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) diff --git a/NPCs/AcidRain/NuclearToad.cs b/NPCs/AcidRain/NuclearToad.cs index b26e44e5c5..9057a3c886 100644 --- a/NPCs/AcidRain/NuclearToad.cs +++ b/NPCs/AcidRain/NuclearToad.cs @@ -1,19 +1,20 @@ -using CalamityMod.BiomeManagers; +using System; +using CalamityMod.BiomeManagers; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; -using CalamityMod.Projectiles.Enemy; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Weapons.Summon; +using CalamityMod.Projectiles.Enemy; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent.Bestiary; using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; -using System; namespace CalamityMod.NPCs.AcidRain { @@ -36,13 +37,19 @@ namespace CalamityMod.NPCs.AcidRain public const float ExplosionTelegraphTime = 120f; + public static Asset GlowTexture; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 5; - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0); + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(); value.Position.Y += 8; value.PortraitPositionYOverride = 28f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -83,11 +90,15 @@ namespace CalamityMod.NPCs.AcidRain NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.NuclearToad") }); @@ -130,12 +141,12 @@ namespace CalamityMod.NPCs.AcidRain { if (Main.netMode != NetmodeID.MultiplayerClient) { - int damage = Main.expertMode ? DownedBossSystem.downedAquaticScourge ? 21 : 8 : DownedBossSystem.downedAquaticScourge ? 27 : 10; + int damage = Main.masterMode ? (DownedBossSystem.downedAquaticScourge ? 17 : 7) : Main.expertMode ? (DownedBossSystem.downedAquaticScourge ? 21 : 8) : (DownedBossSystem.downedAquaticScourge ? 27 : 10); float speed = Main.rand.NextFloat(8f, 12f); if (DownedBossSystem.downedPolterghast) { speed *= 1.8f; - damage = Main.expertMode ? 36 : 45; + damage = Main.masterMode ? 30 : Main.expertMode ? 36 : 45; } for (int i = 0; i < 7; i++) @@ -172,7 +183,7 @@ namespace CalamityMod.NPCs.AcidRain public override void HitEffect(NPC.HitInfo hit) { for (int k = 0; k < 8; k++) - Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulphurousSeaAcid, hit.HitDirection, -1f, 0, default, 1f); if (NPC.life <= 0) { @@ -184,7 +195,7 @@ namespace CalamityMod.NPCs.AcidRain Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("NuclearToadGore4").Type, NPC.scale); } for (int i = 0; i < 25; i++) - Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, Main.rand.NextFloat(-2f, 2f), -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulphurousSeaAcid, Main.rand.NextFloat(-2f, 2f), -1f, 0, default, 1f); } } @@ -202,6 +213,6 @@ namespace CalamityMod.NPCs.AcidRain target.AddBuff(ModContent.BuffType(), 120); } - public override void PostDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) => CalamityGlobalNPC.DrawGlowmask(NPC, spriteBatch, ModContent.Request(Texture + "Glow").Value, true); + public override void PostDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) => CalamityGlobalNPC.DrawGlowmask(NPC, spriteBatch, GlowTexture.Value, true); } } diff --git a/NPCs/AcidRain/Orthocera.cs b/NPCs/AcidRain/Orthocera.cs index 8b36b27fd9..2bc519b439 100644 --- a/NPCs/AcidRain/Orthocera.cs +++ b/NPCs/AcidRain/Orthocera.cs @@ -71,6 +71,10 @@ namespace CalamityMod.NPCs.AcidRain NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -184,9 +188,9 @@ namespace CalamityMod.NPCs.AcidRain if (NPC.spriteDirection == -1) spitDirection += MathHelper.PiOver2; - int damage = DownedBossSystem.downedPolterghast ? 40 : DownedBossSystem.downedAquaticScourge ? 26 : 18; - if (Main.expertMode) - damage = (int)Math.Round(damage * 0.8); + int damage = DownedBossSystem.downedPolterghast ? (Main.masterMode ? 27 : Main.expertMode ? 32 : 40) : + DownedBossSystem.downedAquaticScourge ? (Main.masterMode ? 17 : Main.expertMode ? 21 : 26) : + (Main.masterMode ? 11 : Main.expertMode ? 14 : 18); // Spit two extra streams of acid at the target post-Polterghast. if (DownedBossSystem.downedPolterghast) @@ -248,7 +252,7 @@ namespace CalamityMod.NPCs.AcidRain public override void HitEffect(NPC.HitInfo hit) { for (int k = 0; k < 5; k++) - Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulphurousSeaAcid, hit.HitDirection, -1f, 0, default, 1f); if (NPC.life <= 0) { if (Main.netMode != NetmodeID.Server) diff --git a/NPCs/AcidRain/Radiator.cs b/NPCs/AcidRain/Radiator.cs index 85758d0ca3..fa5266c59c 100644 --- a/NPCs/AcidRain/Radiator.cs +++ b/NPCs/AcidRain/Radiator.cs @@ -1,14 +1,14 @@ using CalamityMod.BiomeManagers; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; using CalamityMod.Items.Materials; using CalamityMod.Items.Pets; using CalamityMod.Items.Placeables.Banners; using Terraria; -using Terraria.ID; using Terraria.GameContent.Bestiary; +using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Buffs.StatDebuffs; -using CalamityMod.Buffs.DamageOverTime; namespace CalamityMod.NPCs.AcidRain { public class Radiator : ModNPC @@ -40,7 +40,7 @@ namespace CalamityMod.NPCs.AcidRain NPC.defense = 10; } - NPC.knockBackResist = 0f; + NPC.knockBackResist = 0.8f; NPC.value = Item.buyPrice(0, 0, 5, 0); NPC.lavaImmune = false; NPC.noGravity = false; @@ -56,13 +56,17 @@ namespace CalamityMod.NPCs.AcidRain NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] - { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Radiator") + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + { + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Radiator") }); } @@ -70,21 +74,21 @@ namespace CalamityMod.NPCs.AcidRain { Lighting.AddLight(NPC.Center, 0.3f, 1.5f, 0.3f); - if (Main.netMode != NetmodeID.Server) - { - int auraSize = 200; //roughly 12 blocks (half the size of Wither Beast aura) - Player player = Main.player[Main.myPlayer]; - if (!player.dead && player.active && (player.Center - NPC.Center).Length() < auraSize && !player.creativeGodMode) - { - player.AddBuff(ModContent.BuffType(), 3, false); - player.AddBuff(BuffID.Poisoned, 2, false); - if (DownedBossSystem.downedPolterghast) - { - player.AddBuff(ModContent.BuffType(), 3, false); - player.AddBuff(BuffID.Venom, 2, false); - } - } - } + if (Main.netMode != NetmodeID.Server) + { + int auraSize = 200; //roughly 12 blocks (half the size of Wither Beast aura) + Player player = Main.player[Main.myPlayer]; + if (!player.dead && player.active && (player.Center - NPC.Center).Length() < auraSize && !player.creativeGodMode) + { + player.AddBuff(ModContent.BuffType(), 3, false); + player.AddBuff(BuffID.Poisoned, 2, false); + if (DownedBossSystem.downedPolterghast) + { + player.AddBuff(ModContent.BuffType(), 3, false); + player.AddBuff(BuffID.Venom, 2, false); + } + } + } } public override void FindFrame(int frameHeight) @@ -105,7 +109,7 @@ namespace CalamityMod.NPCs.AcidRain { for (int k = 0; k < 5; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulphurousSeaAcid, hit.HitDirection, -1f, 0, default, 1f); } } diff --git a/NPCs/AcidRain/Skyfin.cs b/NPCs/AcidRain/Skyfin.cs index fafbc88638..a69b0c7964 100644 --- a/NPCs/AcidRain/Skyfin.cs +++ b/NPCs/AcidRain/Skyfin.cs @@ -1,16 +1,16 @@ using CalamityMod.BiomeManagers; -using CalamityMod.Dusts; -using CalamityMod.Items.Placeables.Banners; -using CalamityMod.Items.Materials; -using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Dusts; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Items.Weapons.Rogue; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.GameContent.Bestiary; using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.NPCs.AcidRain { @@ -23,7 +23,7 @@ namespace CalamityMod.NPCs.AcidRain public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 5; - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { Rotation = MathHelper.Pi }; @@ -69,13 +69,17 @@ namespace CalamityMod.NPCs.AcidRain NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Skyfin") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Skyfin") }); } @@ -123,7 +127,7 @@ namespace CalamityMod.NPCs.AcidRain SoundEngine.PlaySound(SoundID.DD2_WyvernDiveDown, NPC.Center); for (int i = 0; i < 36; i++) { - Dust acid = Dust.NewDustPerfect(NPC.Center, (int)CalamityDusts.SulfurousSeaAcid); + Dust acid = Dust.NewDustPerfect(NPC.Center, (int)CalamityDusts.SulphurousSeaAcid); acid.velocity = (MathHelper.TwoPi * i / 36f).ToRotationVector2() * 6f; acid.scale = 1.1f; acid.noGravity = true; @@ -184,7 +188,7 @@ namespace CalamityMod.NPCs.AcidRain public override void HitEffect(NPC.HitInfo hit) { for (int k = 0; k < 8; k++) - Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulphurousSeaAcid, hit.HitDirection, -1f, 0, default, 1f); if (NPC.life <= 0) { if (Main.netMode != NetmodeID.Server) @@ -194,7 +198,7 @@ namespace CalamityMod.NPCs.AcidRain Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SkyfinGore3").Type, NPC.scale); } for (int k = 0; k < 20; k++) - Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulphurousSeaAcid, hit.HitDirection, -1f, 0, default, 1f); } } diff --git a/NPCs/AcidRain/SulphurousSkater.cs b/NPCs/AcidRain/SulphurousSkater.cs index d5502e57d5..a984472c18 100644 --- a/NPCs/AcidRain/SulphurousSkater.cs +++ b/NPCs/AcidRain/SulphurousSkater.cs @@ -1,4 +1,6 @@ -using CalamityMod.BiomeManagers; +using System; +using System.IO; +using CalamityMod.BiomeManagers; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; using CalamityMod.Items.Materials; @@ -7,8 +9,7 @@ using CalamityMod.Items.Weapons.Melee; using CalamityMod.Projectiles.Enemy; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; +using ReLogic.Content; using Terraria; using Terraria.GameContent.Bestiary; using Terraria.GameContent.ItemDropRules; @@ -20,18 +21,24 @@ namespace CalamityMod.NPCs.AcidRain public class SulphurousSkater : ModNPC { public bool Flying = false; - + public Player Target => Main.player[NPC.target]; public ref float JumpTimer => ref NPC.ai[0]; public const int JumpDelay = 64; + public static Asset GlowTexture; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 5; NPCID.Sets.TrailingMode[NPC.type] = 1; NPCID.Sets.TrailCacheLength[NPC.type] = 6; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -66,6 +73,10 @@ namespace CalamityMod.NPCs.AcidRain NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SendExtraAI(BinaryWriter writer) => writer.Write(Flying); @@ -74,9 +85,9 @@ namespace CalamityMod.NPCs.AcidRain public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.SulphurousSkater") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.SulphurousSkater") }); } @@ -200,7 +211,7 @@ namespace CalamityMod.NPCs.AcidRain public override void FindFrame(int frameHeight) { - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { SpriteDirection = 1 }; @@ -225,7 +236,7 @@ namespace CalamityMod.NPCs.AcidRain if (!NPC.IsABestiaryIconDummy) { CalamityGlobalNPC.DrawAfterimage(NPC, spriteBatch, drawColor, Color.Transparent, directioning: true, invertedDirection: true); - CalamityGlobalNPC.DrawGlowmask(NPC, spriteBatch, ModContent.Request(Texture + "Glow").Value, true); + CalamityGlobalNPC.DrawGlowmask(NPC, spriteBatch, GlowTexture.Value, true); } } @@ -233,15 +244,15 @@ namespace CalamityMod.NPCs.AcidRain { for (int k = 0; k < 5; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulphurousSeaAcid, hit.HitDirection, -1f, 0, default, 1f); } if (NPC.life <= 0) { if (Main.netMode != NetmodeID.Server) { - Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SulfurousSkaterGore").Type, NPC.scale); - Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SulfurousSkaterGore2").Type, NPC.scale); - Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SulfurousSkaterGore3").Type, NPC.scale); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SulphurousSkaterGore").Type, NPC.scale); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SulphurousSkaterGore2").Type, NPC.scale); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SulphurousSkaterGore3").Type, NPC.scale); } } } diff --git a/NPCs/AcidRain/Trilobite.cs b/NPCs/AcidRain/Trilobite.cs index a4c4684b84..bea6a87290 100644 --- a/NPCs/AcidRain/Trilobite.cs +++ b/NPCs/AcidRain/Trilobite.cs @@ -62,13 +62,17 @@ namespace CalamityMod.NPCs.AcidRain NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Trilobite") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Trilobite") }); } @@ -163,9 +167,7 @@ namespace CalamityMod.NPCs.AcidRain if (SpikeShootCountdown <= 0f) { SoundEngine.PlaySound(SoundID.NPCDeath11, NPC.Center); - int projDamage = DownedBossSystem.downedPolterghast ? 35 : DownedBossSystem.downedAquaticScourge ? 29 : 21; - if (Main.expertMode) - projDamage = (int)Math.Round(projDamage * 0.8); + int projDamage = DownedBossSystem.downedPolterghast ? (Main.masterMode ? 23 : Main.expertMode ? 28 : 35) : DownedBossSystem.downedAquaticScourge ? (Main.masterMode ? 19 : Main.expertMode ? 23 : 29) : (Main.masterMode ? 14 : Main.expertMode ? 17 : 21); Vector2 spikeVelocity = -NPC.velocity.RotatedByRandom(0.18f); if (Main.zenithWorld) // more true to the original concept art. @@ -196,7 +198,7 @@ namespace CalamityMod.NPCs.AcidRain { for (int k = 0; k < 5; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulphurousSeaAcid, hit.HitDirection, -1f, 0, default, 1f); } if (NPC.life <= 0) { @@ -208,7 +210,7 @@ namespace CalamityMod.NPCs.AcidRain } for (int k = 0; k < 30; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulphurousSeaAcid, hit.HitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/AquaticScourge/AquaticScourgeBody.cs b/NPCs/AquaticScourge/AquaticScourgeBody.cs index d66f327dce..e7d0565bad 100644 --- a/NPCs/AquaticScourge/AquaticScourgeBody.cs +++ b/NPCs/AquaticScourge/AquaticScourgeBody.cs @@ -1,9 +1,10 @@ -using CalamityMod.Buffs.StatDebuffs; +using System.IO; +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Events; +using CalamityMod.NPCs.CalamityAIs.CalamityBossAIs; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System.IO; using Terraria; using Terraria.GameContent; using Terraria.ID; @@ -46,7 +47,6 @@ namespace CalamityMod.NPCs.AquaticScourge NPC.netAlways = true; NPC.dontCountMe = true; NPC.chaseable = false; - NPC.canGhostHeal = false; if (BossRushEvent.BossRushActive) NPC.scale *= 1.25f; @@ -87,7 +87,7 @@ namespace CalamityMod.NPCs.AquaticScourge public override void AI() { - CalamityAI.AquaticScourgeAI(NPC, Mod, false); + AquaticScourgeAI.VanillaAquaticScourgeAI(NPC, Mod, false); } public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) @@ -136,7 +136,7 @@ namespace CalamityMod.NPCs.AquaticScourge public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { - NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } diff --git a/NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs b/NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs index 06f72e58ef..6a2871b0a2 100644 --- a/NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs +++ b/NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs @@ -1,9 +1,10 @@ -using CalamityMod.Buffs.StatDebuffs; +using System.IO; +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Events; +using CalamityMod.NPCs.CalamityAIs.CalamityBossAIs; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System.IO; using Terraria; using Terraria.GameContent; using Terraria.ID; @@ -45,7 +46,6 @@ namespace CalamityMod.NPCs.AquaticScourge NPC.netAlways = true; NPC.dontCountMe = true; NPC.chaseable = false; - NPC.canGhostHeal = false; if (BossRushEvent.BossRushActive) NPC.scale *= 1.25f; @@ -86,7 +86,7 @@ namespace CalamityMod.NPCs.AquaticScourge public override void AI() { - CalamityAI.AquaticScourgeAI(NPC, Mod, false); + AquaticScourgeAI.VanillaAquaticScourgeAI(NPC, Mod, false); } public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) @@ -135,7 +135,7 @@ namespace CalamityMod.NPCs.AquaticScourge public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { - NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } diff --git a/NPCs/AquaticScourge/AquaticScourgeHead.cs b/NPCs/AquaticScourge/AquaticScourgeHead.cs index f73c8daa8d..01e9e94ab5 100644 --- a/NPCs/AquaticScourge/AquaticScourgeHead.cs +++ b/NPCs/AquaticScourge/AquaticScourgeHead.cs @@ -1,7 +1,9 @@ -using CalamityMod.BiomeManagers; +using System.IO; +using CalamityMod.BiomeManagers; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Events; using CalamityMod.Items.Accessories; +using CalamityMod.Items.Armor.Vanity; using CalamityMod.Items.LoreItems; using CalamityMod.Items.Placeables; using CalamityMod.Items.Placeables.Furniture.BossRelics; @@ -12,22 +14,21 @@ using CalamityMod.Items.TreasureBags.MiscGrabBags; using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; -using CalamityMod.Items.Weapons.Summon; using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Items.Weapons.Summon; +using CalamityMod.NPCs.AcidRain; +using CalamityMod.NPCs.CalamityAIs.CalamityBossAIs; using CalamityMod.NPCs.TownNPCs; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System.IO; using Terraria; +using Terraria.Audio; using Terraria.GameContent; using Terraria.GameContent.Bestiary; +using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Items.Armor.Vanity; -using Terraria.Audio; -using Terraria.GameContent.ItemDropRules; -using CalamityMod.NPCs.AcidRain; namespace CalamityMod.NPCs.AquaticScourge { @@ -37,7 +38,7 @@ namespace CalamityMod.NPCs.AquaticScourge public override void SetStaticDefaults() { NPCID.Sets.BossBestiaryPriority.Add(Type); - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { Scale = 0.6f, PortraitScale = 0.6f, @@ -46,7 +47,7 @@ namespace CalamityMod.NPCs.AquaticScourge value.Position.X += 40f; value.Position.Y += 20f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; - NPCID.Sets.MPAllowedEnemies[Type] = true; + NPCID.Sets.MPAllowedEnemies[Type] = true; } public override void SetDefaults() @@ -97,10 +98,10 @@ namespace CalamityMod.NPCs.AquaticScourge public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { bestiaryEntry.UIInfoProvider = new CommonEnemyUICollectionInfoProvider(ContentSamples.NpcBestiaryCreditIdsByNpcNetIds[Type], quickUnlock: true); - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { new BossBestiaryInfoElement(), - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.AquaticScourge") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.AquaticScourge") }); } @@ -128,7 +129,7 @@ namespace CalamityMod.NPCs.AquaticScourge public override void AI() { - CalamityAI.AquaticScourgeAI(NPC, Mod, true); + AquaticScourgeAI.VanillaAquaticScourgeAI(NPC, Mod, true); } public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) @@ -228,7 +229,7 @@ namespace CalamityMod.NPCs.AquaticScourge var normalOnly = npcLoot.DefineNormalOnlyDropSet(); { // Weapons - int[] weapons = new int[] + int[] weapons = new int[] { ModContent.ItemType(), ModContent.ItemType(), @@ -245,14 +246,13 @@ namespace CalamityMod.NPCs.AquaticScourge // Equipment normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); normalOnly.Add(ModContent.ItemType(), DropHelper.NormalWeaponDropRateFraction); - normalOnly.Add(ModContent.ItemType(), 10); normalOnly.Add(ModContent.ItemType(), 10); // Fishing normalOnly.Add(ModContent.ItemType()); } - npcLoot.DefineConditionalDropSet(() => true).Add(DropHelper.PerPlayer(ItemID.GreaterHealingPotion, 1, 5, 15), hideLootReport: true); // Healing Potions don't show up in the Bestiary + npcLoot.DefineConditionalDropSet(() => true).Add(DropHelper.PerPlayer(ItemID.GreaterHealingPotion, 1, 5, 15), hideLootReport: true); // Healing Potions don't show up in the Bestiary npcLoot.Add(ModContent.ItemType(), 10); npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType()); @@ -262,7 +262,7 @@ namespace CalamityMod.NPCs.AquaticScourge // Lore bool firstASKill() => !DownedBossSystem.downedAquaticScourge; npcLoot.AddConditionalPerPlayer(firstASKill, ModContent.ItemType(), desc: DropHelper.FirstKillText); - npcLoot.AddConditionalPerPlayer(firstASKill, ModContent.ItemType(), desc: DropHelper.FirstKillText); + npcLoot.AddConditionalPerPlayer(firstASKill, ModContent.ItemType(), desc: DropHelper.FirstKillText); } public override void OnKill() @@ -293,7 +293,7 @@ namespace CalamityMod.NPCs.AquaticScourge public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { - NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } diff --git a/NPCs/AquaticScourge/AquaticScourgeTail.cs b/NPCs/AquaticScourge/AquaticScourgeTail.cs index 51908a45bf..5b7217d8c0 100644 --- a/NPCs/AquaticScourge/AquaticScourgeTail.cs +++ b/NPCs/AquaticScourge/AquaticScourgeTail.cs @@ -1,9 +1,10 @@ -using CalamityMod.Buffs.StatDebuffs; +using System.IO; +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Events; +using CalamityMod.NPCs.CalamityAIs.CalamityBossAIs; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System.IO; using Terraria; using Terraria.GameContent; using Terraria.ID; @@ -45,7 +46,6 @@ namespace CalamityMod.NPCs.AquaticScourge NPC.netAlways = true; NPC.dontCountMe = true; NPC.chaseable = false; - NPC.canGhostHeal = false; if (BossRushEvent.BossRushActive) NPC.scale *= 1.25f; @@ -86,7 +86,7 @@ namespace CalamityMod.NPCs.AquaticScourge public override void AI() { - CalamityAI.AquaticScourgeAI(NPC, Mod, false); + AquaticScourgeAI.VanillaAquaticScourgeAI(NPC, Mod, false); } public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) @@ -135,7 +135,7 @@ namespace CalamityMod.NPCs.AquaticScourge public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { - NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } diff --git a/NPCs/Astral/Aries.cs b/NPCs/Astral/Aries.cs index 6435f23f34..1ea110d392 100644 --- a/NPCs/Astral/Aries.cs +++ b/NPCs/Astral/Aries.cs @@ -18,13 +18,13 @@ namespace CalamityMod.NPCs.Astral { public class Aries : ModNPC { - private static Texture2D glowmask; + public static Asset glowmask; public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 8; if (!Main.dedServ) - glowmask = ModContent.Request("CalamityMod/NPCs/Astral/AriesGlow", AssetRequestMode.ImmediateLoad).Value; + glowmask = ModContent.Request("CalamityMod/NPCs/Astral/AriesGlow", AssetRequestMode.AsyncLoad); } public override void SetDefaults() @@ -50,14 +50,18 @@ namespace CalamityMod.NPCs.Astral } NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; - SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Aries") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Aries") }); } @@ -100,7 +104,7 @@ namespace CalamityMod.NPCs.Astral public override void PostDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { //draw glowmask - spriteBatch.Draw(glowmask, NPC.Center - screenPos, NPC.frame, Color.White * 0.6f, NPC.rotation, new Vector2(33, 31), 1f, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); + spriteBatch.Draw(glowmask.Value, NPC.Center - screenPos, NPC.frame, Color.White * 0.6f, NPC.rotation, new Vector2(33, 31), 1f, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); } public override float SpawnChance(NPCSpawnInfo spawnInfo) @@ -124,7 +128,7 @@ namespace CalamityMod.NPCs.Astral public override void ModifyNPCLoot(NPCLoot npcLoot) { - npcLoot.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 2, 1, 2, 1, 3)); + npcLoot.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 2, 1, 2, 1, 3)); npcLoot.AddIf(() => DownedBossSystem.downedAstrumAureus, ModContent.ItemType(), 7); } } diff --git a/NPCs/Astral/AstralProbe.cs b/NPCs/Astral/AstralProbe.cs index 46a657a72e..b57bd3c99d 100644 --- a/NPCs/Astral/AstralProbe.cs +++ b/NPCs/Astral/AstralProbe.cs @@ -1,24 +1,35 @@ -using CalamityMod.BiomeManagers; +using System; +using CalamityMod.BiomeManagers; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Sounds; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; +using ReLogic.Content; using Terraria; +using Terraria.Audio; using Terraria.GameContent; using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using CalamityMod.Sounds; namespace CalamityMod.NPCs.Astral { public class AstralProbe : ModNPC { + public static Asset GlowTexture; + + public override void SetStaticDefaults() + { + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } + } + public override void SetDefaults() { NPC.damage = 20; @@ -45,14 +56,18 @@ namespace CalamityMod.NPCs.Astral } NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; - SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.AstralProbe") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.AstralProbe") }); } @@ -149,6 +164,7 @@ namespace CalamityMod.NPCs.Astral NPC.localAI[0] = 0f; if (Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[NPC.target].position, Main.player[NPC.target].width, Main.player[NPC.target].height)) { + // These are already nerfed in Master Mode via the global scaling code int projDamage = Main.expertMode ? 14 : 18; if (DownedBossSystem.downedAstrumAureus) projDamage += 6; @@ -235,7 +251,7 @@ namespace CalamityMod.NPCs.Astral spriteBatch.Draw(texture2D15, drawPosition, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/Astral/AstralProbeGlow").Value; + texture2D15 = GlowTexture.Value; spriteBatch.Draw(texture2D15, drawPosition, NPC.frame, Color.White * 0.6f, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); @@ -322,7 +338,7 @@ namespace CalamityMod.NPCs.Astral public override void ModifyNPCLoot(NPCLoot npcLoot) { - npcLoot.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 2, 1, 2, 1, 3)); + npcLoot.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 2, 1, 2, 1, 3)); } public override float SpawnChance(NPCSpawnInfo spawnInfo) diff --git a/NPCs/Astral/AstralSlime.cs b/NPCs/Astral/AstralSlime.cs index a73f93514a..9959c22d91 100644 --- a/NPCs/Astral/AstralSlime.cs +++ b/NPCs/Astral/AstralSlime.cs @@ -28,7 +28,7 @@ namespace CalamityMod.NPCs.Astral NPC.aiStyle = NPCAIStyleID.Slime; NPC.defense = 8; NPC.lifeMax = 200; - NPC.knockBackResist = 0f; + NPC.knockBackResist = 0.6f; NPC.value = Item.buyPrice(0, 0, 10, 0); NPC.alpha = 60; NPC.HitSound = SoundID.NPCHit1; @@ -44,17 +44,26 @@ namespace CalamityMod.NPCs.Astral } NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; - SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.AstralSlime") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.AstralSlime") }); } + public override void AI() + { + NPC.damage = (NPC.velocity.Y == 0f || NPC.velocity.Length() < 3f) ? 0 : NPC.defDamage; + } + public override void FindFrame(int frameHeight) { //DO DUST @@ -91,7 +100,7 @@ namespace CalamityMod.NPCs.Astral public override void ModifyNPCLoot(NPCLoot npcLoot) { - npcLoot.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 2, 1, 2, 1, 3)); + npcLoot.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 2, 1, 2, 1, 3)); npcLoot.AddIf(() => DownedBossSystem.downedAstrumAureus, ModContent.ItemType(), 7); var postDeus = npcLoot.DefineConditionalDropSet(() => DownedBossSystem.downedAstrumDeus); diff --git a/NPCs/Astral/AstralachneaGround.cs b/NPCs/Astral/AstralachneaGround.cs index b6e40c4cdb..6037b4ad46 100644 --- a/NPCs/Astral/AstralachneaGround.cs +++ b/NPCs/Astral/AstralachneaGround.cs @@ -1,28 +1,28 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Sounds; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.NPCs.Astral { public class AstralachneaGround : ModNPC { - private static Texture2D glowmask; + public static Asset glowmask; public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 5; if (!Main.dedServ) - glowmask = ModContent.Request("CalamityMod/NPCs/Astral/AstralachneaGroundGlow", AssetRequestMode.ImmediateLoad).Value; + glowmask = ModContent.Request("CalamityMod/NPCs/Astral/AstralachneaGroundGlow", AssetRequestMode.AsyncLoad); this.HideFromBestiary(); } @@ -52,6 +52,10 @@ namespace CalamityMod.NPCs.Astral } NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void AI() @@ -132,7 +136,7 @@ namespace CalamityMod.NPCs.Astral public override void PostDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { Vector2 origin = new Vector2(40f, 21f); - spriteBatch.Draw(glowmask, NPC.Center - screenPos, NPC.frame, Color.White * 0.6f, NPC.rotation, origin, 1f, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); + spriteBatch.Draw(glowmask.Value, NPC.Center - screenPos, NPC.frame, Color.White * 0.6f, NPC.rotation, origin, 1f, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); } public override float SpawnChance(NPCSpawnInfo spawnInfo) diff --git a/NPCs/Astral/AstralachneaWall.cs b/NPCs/Astral/AstralachneaWall.cs index b4f2184c55..ab3c5fc0d1 100644 --- a/NPCs/Astral/AstralachneaWall.cs +++ b/NPCs/Astral/AstralachneaWall.cs @@ -1,4 +1,5 @@ -using CalamityMod.BiomeManagers; +using System; +using CalamityMod.BiomeManagers; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Items.Materials; @@ -6,10 +7,10 @@ using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Weapons.Magic; using CalamityMod.Sounds; using CalamityMod.World; +using CalamityMod.BiomeManagers.BestiaryCategories; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; -using System; using Terraria; using Terraria.Audio; using Terraria.GameContent.Bestiary; @@ -21,15 +22,15 @@ namespace CalamityMod.NPCs.Astral { public class AstralachneaWall : ModNPC { - private static Texture2D glowmask; + public static Asset glowmask; public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.AstralachneaGround.DisplayName"); public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 4; if (!Main.dedServ) - glowmask = ModContent.Request("CalamityMod/NPCs/Astral/AstralachneaWallGlow", AssetRequestMode.ImmediateLoad).Value; - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) { Rotation = -MathHelper.PiOver2 }; + glowmask = ModContent.Request("CalamityMod/NPCs/Astral/AstralachneaWallGlow", AssetRequestMode.AsyncLoad); + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { Rotation = -MathHelper.PiOver2 }; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; } @@ -58,14 +59,18 @@ namespace CalamityMod.NPCs.Astral } NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; - SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Astralachnea") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Astralachnea") }); } @@ -140,7 +145,7 @@ namespace CalamityMod.NPCs.Astral public override void PostDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { Vector2 origin = new Vector2(40f, 40f); - spriteBatch.Draw(glowmask, NPC.Center - screenPos - new Vector2(0, 8f), NPC.frame, Color.White * 0.6f, NPC.rotation, origin, 1f, SpriteEffects.None, 0); + spriteBatch.Draw(glowmask.Value, NPC.Center - screenPos - new Vector2(0, 8f), NPC.frame, Color.White * 0.6f, NPC.rotation, origin, 1f, SpriteEffects.None, 0); } public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) @@ -151,8 +156,8 @@ namespace CalamityMod.NPCs.Astral public static void ModifyAstralachneaLoot(NPCLoot npcLoot) { - npcLoot.AddIf(() => !Main.expertMode, ModContent.ItemType(), 2, 2, 3); - npcLoot.AddIf(() => Main.expertMode, ModContent.ItemType(), 1, 1, 4); + npcLoot.AddIf(() => !Main.expertMode, ModContent.ItemType(), 2, 2, 3); + npcLoot.AddIf(() => Main.expertMode, ModContent.ItemType(), 1, 1, 4); npcLoot.AddIf(() => DownedBossSystem.downedAstrumAureus, ModContent.ItemType(), 7); } diff --git a/NPCs/Astral/Atlas.cs b/NPCs/Astral/Atlas.cs index 10abbd321b..197c13bfff 100644 --- a/NPCs/Astral/Atlas.cs +++ b/NPCs/Astral/Atlas.cs @@ -1,4 +1,6 @@ -using CalamityMod.BiomeManagers; +using System; +using System.IO; +using CalamityMod.BiomeManagers; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Items.Materials; @@ -7,16 +9,14 @@ using CalamityMod.Items.Weapons.Melee; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; +using ReLogic.Content; using Terraria; -using Terraria.ID; +using Terraria.Audio; +using Terraria.DataStructures; using Terraria.GameContent; using Terraria.GameContent.Bestiary; -using Terraria.DataStructures; +using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using ReLogic.Content; namespace CalamityMod.NPCs.Astral { @@ -24,7 +24,7 @@ namespace CalamityMod.NPCs.Astral { //TODO -- draw 4 pixels lower than actual bottom position (arm overlaps tiles) - private static Texture2D glowmask; + public static Asset glowmask; //CONSTANTS private const int sheetHeight = 852; @@ -108,8 +108,8 @@ namespace CalamityMod.NPCs.Astral //also it's visuals are messed up on npc spawners etc. because the sheet is 3 wide. //not much we can do. looks fine in-game so /shrug if (!Main.dedServ) - glowmask = ModContent.Request("CalamityMod/NPCs/Astral/AtlasGlow", AssetRequestMode.ImmediateLoad).Value; - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + glowmask = ModContent.Request("CalamityMod/NPCs/Astral/AtlasGlow", AssetRequestMode.AsyncLoad); + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { PortraitPositionYOverride = -5 }; @@ -153,14 +153,18 @@ namespace CalamityMod.NPCs.Astral } NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; - SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Atlas") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Atlas") }); } @@ -188,6 +192,9 @@ namespace CalamityMod.NPCs.Astral public override void AI() { + // Avoid cheap bullshit + NPC.damage = 0; + //PICK A TARGET if (!NPC.HasValidTarget || idling) { @@ -268,7 +275,7 @@ namespace CalamityMod.NPCs.Astral if (Main.player[i].active && !Main.player[i].dead && Main.player[i].getRect().Intersects(hitbox)) { Vector2 before = Main.player[i].velocity; - Main.player[i].Hurt(PlayerDeathReason.ByNPC(NPC.whoAmI), NPC.damage, NPC.direction); + Main.player[i].Hurt(PlayerDeathReason.ByNPC(NPC.whoAmI), NPC.defDamage, NPC.direction); Vector2 after = Main.player[i].velocity; Vector2 difference = after - before; @@ -321,7 +328,7 @@ namespace CalamityMod.NPCs.Astral { NPC.velocity.X = idle_walkLeft ? -idle_walkMaxSpeed : idle_walkMaxSpeed; } - idle_impulseWalk = idle_impulseWalk && idle_counter > 20 && Main.rand.Next(150) != 0; + idle_impulseWalk = idle_impulseWalk && idle_counter > 20 && !Main.rand.NextBool(150); if (!idle_impulseWalk) { idle_counter = 0; @@ -583,7 +590,7 @@ namespace CalamityMod.NPCs.Astral //draw glowmask spriteBatch.Draw( - glowmask, position, NPC.frame, + glowmask.Value, position, NPC.frame, Color.White * 0.65f, 0f, default, 1f, //color, rotation, origin, scale effect, 0f); //effect, drawlayer @@ -650,7 +657,7 @@ namespace CalamityMod.NPCs.Astral public override void ModifyNPCLoot(NPCLoot npcLoot) { npcLoot.Add(ModContent.ItemType()); - npcLoot.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 1, 6, 8, 7, 9)); + npcLoot.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 1, 6, 8, 7, 9)); npcLoot.AddIf(() => DownedBossSystem.downedAstrumAureus, ModContent.ItemType(), 7); } } diff --git a/NPCs/Astral/FusionFeeder.cs b/NPCs/Astral/FusionFeeder.cs index 0b9e929fa6..9df2efe204 100644 --- a/NPCs/Astral/FusionFeeder.cs +++ b/NPCs/Astral/FusionFeeder.cs @@ -1,26 +1,27 @@ -using CalamityMod.BiomeManagers; +using System; +using CalamityMod.BiomeManagers; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; +using CalamityMod.BiomeManagers.BestiaryCategories; +using CalamityMod.Projectiles.Enemy; +using CalamityMod.Sounds; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; +using ReLogic.Content; using Terraria; +using Terraria.Audio; using Terraria.GameContent; using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using ReLogic.Content; -using CalamityMod.Projectiles.Enemy; -using CalamityMod.Sounds; namespace CalamityMod.NPCs.Astral { public class FusionFeeder : ModNPC { - private static Texture2D glowmask; + public static Asset glowmask; public Player Target => Main.player[NPC.target]; @@ -35,8 +36,8 @@ namespace CalamityMod.NPCs.Astral public override void SetStaticDefaults() { if (!Main.dedServ) - glowmask = ModContent.Request("CalamityMod/NPCs/Astral/FusionFeederGlow", AssetRequestMode.ImmediateLoad).Value; - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + glowmask = ModContent.Request("CalamityMod/NPCs/Astral/FusionFeederGlow", AssetRequestMode.AsyncLoad); + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { Scale = 0.5f, PortraitPositionXOverride = 0f, @@ -75,7 +76,11 @@ namespace CalamityMod.NPCs.Astral } NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; - SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public static bool ValidMovementPosition(Tile tile) @@ -123,6 +128,9 @@ namespace CalamityMod.NPCs.Astral // Move towards the target and lunge at them, releasing meteors. if (attemptingToAttackTarget) { + // Set damage + NPC.damage = NPC.defDamage; + NPC.TargetClosest(true); NPC.velocity += new Vector2(NPC.direction, NPC.directionY) * 0.15f; NPC.velocity.X = MathHelper.Clamp(NPC.velocity.X, -6f, 6f); @@ -149,7 +157,7 @@ namespace CalamityMod.NPCs.Astral SoundEngine.PlaySound(SoundID.Item73, NPC.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { - int damage = DownedBossSystem.downedAstrumAureus ? 55 : 45; + int damage = DownedBossSystem.downedAstrumAureus ? (Main.masterMode ? 34 : Main.expertMode ? 40 : 55) : (Main.masterMode ? 30 : Main.expertMode ? 35 : 45); Vector2 meteorShootVelocity = NPC.SafeDirectionTo(Target.Center) * 9f; Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + meteorShootVelocity * 6f, meteorShootVelocity, ModContent.ProjectileType(), damage, 0f); } @@ -162,6 +170,9 @@ namespace CalamityMod.NPCs.Astral } else { + // Avoid cheap bullshit + NPC.damage = 0; + // Rebound on collision. if (NPC.collideX) { @@ -207,6 +218,9 @@ namespace CalamityMod.NPCs.Astral } else { + // Avoid cheap bullshit + NPC.damage = 0; + if (NPC.velocity.Y == 0f) { // Search for any potential closer targets if attempting to attack. @@ -231,7 +245,7 @@ namespace CalamityMod.NPCs.Astral public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.FusionFeeder") }); @@ -282,7 +296,7 @@ namespace CalamityMod.NPCs.Astral spriteBatch.Draw(TextureAssets.Npc[NPC.type].Value, NPC.Center - screenPos + offset, NPC.frame, drawColor, NPC.rotation, origin, 1f, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); //draw glowmask - spriteBatch.Draw(glowmask, NPC.Center - screenPos + offset, NPC.frame, Color.White * 0.6f, NPC.rotation, origin, 1f, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); + spriteBatch.Draw(glowmask.Value, NPC.Center - screenPos + offset, NPC.frame, Color.White * 0.6f, NPC.rotation, origin, 1f, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); return false; } @@ -309,7 +323,7 @@ namespace CalamityMod.NPCs.Astral public override void ModifyNPCLoot(NPCLoot npcLoot) { npcLoot.Add(ItemID.SharkFin, 8); - npcLoot.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 1, 2, 3, 3, 4)); + npcLoot.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 1, 2, 3, 3, 4)); } } } diff --git a/NPCs/Astral/Hadarian.cs b/NPCs/Astral/Hadarian.cs index 71f74ba954..8882cf68c8 100644 --- a/NPCs/Astral/Hadarian.cs +++ b/NPCs/Astral/Hadarian.cs @@ -1,34 +1,35 @@ -using CalamityMod.BiomeManagers; +using System; +using CalamityMod.BiomeManagers; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; -using CalamityMod.Items.Materials; using CalamityMod.Items.Accessories.Wings; +using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Sounds; using CalamityMod.Tiles.AstralDesert; using CalamityMod.World; +using CalamityMod.BiomeManagers.BestiaryCategories; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; +using ReLogic.Content; using Terraria; +using Terraria.Audio; using Terraria.GameContent; using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using ReLogic.Content; -using CalamityMod.Sounds; namespace CalamityMod.NPCs.Astral { public class Hadarian : ModNPC { - private static Texture2D glowmask; + public static Asset glowmask; public override void SetStaticDefaults() { if (!Main.dedServ) - glowmask = ModContent.Request("CalamityMod/NPCs/Astral/HadarianGlow", AssetRequestMode.ImmediateLoad).Value; - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0); + glowmask = ModContent.Request("CalamityMod/NPCs/Astral/HadarianGlow", AssetRequestMode.AsyncLoad); + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(); value.Position.X += 10f; value.Position.Y += 10f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; @@ -58,12 +59,16 @@ namespace CalamityMod.NPCs.Astral } NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; - SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Hadarian") }); @@ -155,7 +160,7 @@ namespace CalamityMod.NPCs.Astral Rectangle src = new Rectangle(20, 34, 38, 42); spriteBatch.Draw(TextureAssets.Npc[NPC.type].Value, position - screenPos, src, drawColor, NPC.rotation, default, 1f, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); //draw glowmask - spriteBatch.Draw(glowmask, position - screenPos, src, Color.White * 0.6f, NPC.rotation, default, 1f, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); + spriteBatch.Draw(glowmask.Value, position - screenPos, src, Color.White * 0.6f, NPC.rotation, default, 1f, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); return false; } return true; @@ -168,7 +173,7 @@ namespace CalamityMod.NPCs.Astral Vector2 origin = new Vector2(41f, 39f); //draw glowmask - spriteBatch.Draw(glowmask, NPC.Center - screenPos - new Vector2(0f, 12f), NPC.frame, Color.White * 0.6f, NPC.rotation, origin, 1f, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); + spriteBatch.Draw(glowmask.Value, NPC.Center - screenPos - new Vector2(0f, 12f), NPC.frame, Color.White * 0.6f, NPC.rotation, origin, 1f, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); } } @@ -217,7 +222,7 @@ namespace CalamityMod.NPCs.Astral public override void ModifyNPCLoot(NPCLoot npcLoot) { - npcLoot.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 1, 1, 3, 1, 4)); + npcLoot.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 1, 1, 3, 1, 4)); npcLoot.AddIf(() => DownedBossSystem.downedAstrumAureus, ModContent.ItemType(), 10); } } diff --git a/NPCs/Astral/HiveEnemy.cs b/NPCs/Astral/HiveEnemy.cs index 4bcb6e9171..634dd610c2 100644 --- a/NPCs/Astral/HiveEnemy.cs +++ b/NPCs/Astral/HiveEnemy.cs @@ -1,30 +1,31 @@ -using CalamityMod.BiomeManagers; +using System; +using CalamityMod.BiomeManagers; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Weapons.Summon; +using CalamityMod.Sounds; using CalamityMod.World; +using CalamityMod.BiomeManagers.BestiaryCategories; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; +using ReLogic.Content; using Terraria; +using Terraria.Audio; using Terraria.GameContent.Bestiary; using Terraria.ModLoader; -using Terraria.Audio; -using ReLogic.Content; -using CalamityMod.Sounds; namespace CalamityMod.NPCs.Astral { public class HiveEnemy : ModNPC { - private static Texture2D glowmask; + public static Asset glowmask; public override void SetStaticDefaults() { if (!Main.dedServ) - glowmask = ModContent.Request("CalamityMod/NPCs/Astral/HiveGlow", AssetRequestMode.ImmediateLoad).Value; + glowmask = ModContent.Request("CalamityMod/NPCs/Astral/HiveGlow", AssetRequestMode.AsyncLoad); Main.npcFrameCount[NPC.type] = 6; } @@ -50,23 +51,30 @@ namespace CalamityMod.NPCs.Astral } NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; - SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; if (Main.zenithWorld) { NPC.scale = 3f; } + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.HiveEnemy") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.HiveEnemy") }); } public override void AI() { + // Setting this in SetDefaults will disable expert mode scaling, so put it here instead + NPC.damage = 0; + NPC.ai[0]++; if (NPC.ai[0] > (CalamityWorld.death ? 60f : CalamityWorld.revenge ? 120f : 180f)) { @@ -102,7 +110,7 @@ namespace CalamityMod.NPCs.Astral public override void PostDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { // Draw glowmask. - spriteBatch.Draw(glowmask, NPC.Center - screenPos, NPC.frame, Color.White * 0.6f, NPC.rotation, new Vector2(19, 30), 1f, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); + spriteBatch.Draw(glowmask.Value, NPC.Center - screenPos, NPC.frame, Color.White * 0.6f, NPC.rotation, new Vector2(19, 30), 1f, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); } public override void HitEffect(NPC.HitInfo hit) @@ -152,7 +160,7 @@ namespace CalamityMod.NPCs.Astral public override void ModifyNPCLoot(NPCLoot npcLoot) { - npcLoot.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 1, 1, 3, 1, 4)); + npcLoot.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 1, 1, 3, 1, 4)); npcLoot.AddIf(() => DownedBossSystem.downedAstrumAureus, ModContent.ItemType(), 7); } } diff --git a/NPCs/Astral/Hiveling.cs b/NPCs/Astral/Hiveling.cs index bb284ecf97..1815cf10a8 100644 --- a/NPCs/Astral/Hiveling.cs +++ b/NPCs/Astral/Hiveling.cs @@ -1,30 +1,31 @@ -using CalamityMod.BiomeManagers; +using System; +using CalamityMod.BiomeManagers; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; +using CalamityMod.Sounds; using CalamityMod.World; +using CalamityMod.BiomeManagers.BestiaryCategories; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; +using ReLogic.Content; using Terraria; +using Terraria.Audio; using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using ReLogic.Content; -using CalamityMod.Sounds; namespace CalamityMod.NPCs.Astral { public class Hiveling : ModNPC { - private static Texture2D glowmask; + public static Asset glowmask; public override void SetStaticDefaults() { if (!Main.dedServ) - glowmask = ModContent.Request("CalamityMod/NPCs/Astral/HivelingGlow", AssetRequestMode.ImmediateLoad).Value; + glowmask = ModContent.Request("CalamityMod/NPCs/Astral/HivelingGlow", AssetRequestMode.AsyncLoad); Main.npcFrameCount[NPC.type] = 4; - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0); + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(); value.Position.Y -= 8; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; } @@ -50,14 +51,18 @@ namespace CalamityMod.NPCs.Astral } NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; - SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Hiveling") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Hiveling") }); } @@ -128,7 +133,7 @@ namespace CalamityMod.NPCs.Astral public override void PostDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { //draw glowmask - spriteBatch.Draw(glowmask, NPC.Center - screenPos + new Vector2(0, 12), NPC.frame, Color.White * 0.6f, NPC.rotation, new Vector2(15, 10), 1f, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); + spriteBatch.Draw(glowmask.Value, NPC.Center - screenPos + new Vector2(0, 12), NPC.frame, Color.White * 0.6f, NPC.rotation, new Vector2(15, 10), 1f, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); } public override void HitEffect(NPC.HitInfo hit) diff --git a/NPCs/Astral/Mantis.cs b/NPCs/Astral/Mantis.cs index 0c16b746eb..f4416a41f4 100644 --- a/NPCs/Astral/Mantis.cs +++ b/NPCs/Astral/Mantis.cs @@ -1,39 +1,39 @@ -using CalamityMod.BiomeManagers; +using System; +using CalamityMod.BiomeManagers; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Projectiles.Enemy; +using CalamityMod.Sounds; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; +using ReLogic.Content; using Terraria; +using Terraria.Audio; using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using ReLogic.Content; -using CalamityMod.Sounds; namespace CalamityMod.NPCs.Astral { public class Mantis : ModNPC { - private static Texture2D glowmask; + public static Asset glowmask; public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 14; - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { PortraitPositionYOverride = 0 }; value.Position.Y += 15; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; if (!Main.dedServ) - glowmask = ModContent.Request("CalamityMod/NPCs/Astral/MantisGlow", AssetRequestMode.ImmediateLoad).Value; + glowmask = ModContent.Request("CalamityMod/NPCs/Astral/MantisGlow", AssetRequestMode.AsyncLoad); } public override void SetDefaults() @@ -60,14 +60,18 @@ namespace CalamityMod.NPCs.Astral } NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; - SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] - { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Mantis") + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + { + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Mantis") }); } @@ -136,7 +140,7 @@ namespace CalamityMod.NPCs.Astral SoundEngine.PlaySound(SoundID.Item71, NPC.Center); Vector2 vector = Main.player[NPC.target].Center - NPC.Center; vector.Normalize(); - int damage = DownedBossSystem.downedAstrumAureus ? 55 : 45; + int damage = DownedBossSystem.downedAstrumAureus ? (Main.masterMode ? 34 : Main.expertMode ? 40 : 55) : (Main.masterMode ? 30 : Main.expertMode ? 35 : 45); Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + (NPC.Center.X < target.Center.X ? -14f : 14f) * Vector2.UnitX, vector * 7f, ModContent.ProjectileType(), damage, 0f); } } @@ -222,7 +226,7 @@ namespace CalamityMod.NPCs.Astral public override void PostDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { //draw glowmask - spriteBatch.Draw(glowmask, NPC.Center - screenPos - new Vector2(0, 8), NPC.frame, Color.White * 0.6f, NPC.rotation, new Vector2(70, 40), 1f, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); + spriteBatch.Draw(glowmask.Value, NPC.Center - screenPos - new Vector2(0, 8), NPC.frame, Color.White * 0.6f, NPC.rotation, new Vector2(70, 40), 1f, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); } public override float SpawnChance(NPCSpawnInfo spawnInfo) @@ -246,7 +250,7 @@ namespace CalamityMod.NPCs.Astral public override void ModifyNPCLoot(NPCLoot npcLoot) { - npcLoot.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 1, 1, 2, 1, 3)); + npcLoot.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 1, 1, 2, 1, 3)); npcLoot.AddIf(() => DownedBossSystem.downedAstrumAureus, ModContent.ItemType(), 7); } } diff --git a/NPCs/Astral/Nova.cs b/NPCs/Astral/Nova.cs index 4453eb8aea..6546f6889d 100644 --- a/NPCs/Astral/Nova.cs +++ b/NPCs/Astral/Nova.cs @@ -1,29 +1,29 @@ -using CalamityMod.BiomeManagers; +using System; +using CalamityMod.BiomeManagers; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Sounds; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; +using ReLogic.Content; using Terraria; +using Terraria.Audio; using Terraria.DataStructures; using Terraria.GameContent.Bestiary; +using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using ReLogic.Content; -using Terraria.GameContent.ItemDropRules; -using CalamityMod.Sounds; namespace CalamityMod.NPCs.Astral { public class Nova : ModNPC { - private static Texture2D glowmask; + public static Asset glowmask; private float travelAcceleration = 0.2f; private float targetTime = 120f; @@ -36,8 +36,8 @@ namespace CalamityMod.NPCs.Astral Main.npcFrameCount[NPC.type] = 8; if (!Main.dedServ) - glowmask = ModContent.Request("CalamityMod/NPCs/Astral/NovaGlow", AssetRequestMode.ImmediateLoad).Value; - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + glowmask = ModContent.Request("CalamityMod/NPCs/Astral/NovaGlow", AssetRequestMode.AsyncLoad); + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { Scale = 0.64f, PortraitPositionXOverride = 10f, @@ -81,14 +81,18 @@ namespace CalamityMod.NPCs.Astral } NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; - SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Nova") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Nova") }); } @@ -133,6 +137,9 @@ namespace CalamityMod.NPCs.Astral Player target = Main.player[NPC.target]; if (NPC.ai[3] >= 0) { + // Avoid cheap bullshit + NPC.damage = 0; + CalamityGlobalNPC.DoFlyingAI(NPC, (CalamityWorld.death ? 8.5f : CalamityWorld.revenge ? 7f : 5.5f), (CalamityWorld.death ? 0.055f : CalamityWorld.revenge ? 0.045f : 0.035f), 400f, 150, false); if (Collision.CanHit(NPC.position, NPC.width, NPC.height, target.position, target.width, target.height)) @@ -169,11 +176,20 @@ namespace CalamityMod.NPCs.Astral NPC.velocity += new Vector2(NPC.ai[1], NPC.ai[2]) * travelAcceleration; //acceleration per frame + // Set damage or avoid cheap bullshit + if (NPC.velocity.Length() > 4f) + NPC.damage = NPC.defDamage; + else + NPC.damage = 0; + //rotation NPC.rotation = NPC.velocity.ToRotation(); } else if (NPC.ai[3] == -waitBeforeTravel) { + // Avoid cheap bullshit + NPC.damage = 0; + between.Normalize(); NPC.ai[1] = between.X; NPC.ai[2] = between.Y; @@ -184,6 +200,9 @@ namespace CalamityMod.NPCs.Astral } else { + // Avoid cheap bullshit + NPC.damage = 0; + //slowdown NPC.velocity *= slowdown; @@ -237,15 +256,15 @@ namespace CalamityMod.NPCs.Astral } for (int i = 0; i < 15; i++) { - int dust = Dust.NewDust(NPC.Center - off, size, size, 31, 0f, 0f, 100, default, 1.7f); + int dust = Dust.NewDust(NPC.Center - off, size, size, DustID.Smoke, 0f, 0f, 100, default, 1.7f); Main.dust[dust].velocity *= 1.4f; } for (int i = 0; i < 27; i++) { - int dust = Dust.NewDust(NPC.Center - off, size, size, 6, 0f, 0f, 100, default, 2.4f); + int dust = Dust.NewDust(NPC.Center - off, size, size, DustID.Torch, 0f, 0f, 100, default, 2.4f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 5f; - dust = Dust.NewDust(NPC.Center - off, size, size, 6, 0f, 0f, 100, default, 1.6f); + dust = Dust.NewDust(NPC.Center - off, size, size, DustID.Torch, 0f, 0f, 100, default, 1.6f); Main.dust[dust].velocity *= 3f; } } @@ -278,7 +297,7 @@ namespace CalamityMod.NPCs.Astral var exploded = npcLoot.DefineConditionalDropSet((info) => info.npc.ai[3] <= -10000f); // 2-3 Stardust (3-4 Expert+) - exploded.OnFailedConditions(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 1, 2, 3, 3, 4)); + exploded.OnFailedConditions(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 1, 2, 3, 3, 4)); exploded.OnFailedConditions(ItemDropRule.ByCondition(DropHelper.If(() => DownedBossSystem.downedAstrumAureus), ModContent.ItemType(), 7)); // If exploded, then have a chance to drop Glorious End and nothing else @@ -291,7 +310,7 @@ namespace CalamityMod.NPCs.Astral return; Vector2 drawPosition = NPC.Center - screenPos - new Vector2(0, NPC.scale * 4f); - spriteBatch.Draw(glowmask, drawPosition, NPC.frame, Color.White * 0.75f, NPC.rotation, new Vector2(57f, 37f), NPC.scale, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0f); + spriteBatch.Draw(glowmask.Value, drawPosition, NPC.frame, Color.White * 0.75f, NPC.rotation, new Vector2(57f, 37f), NPC.scale, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0f); } public override float SpawnChance(NPCSpawnInfo spawnInfo) diff --git a/NPCs/Astral/SightseerCollider.cs b/NPCs/Astral/SightseerCollider.cs index b482b4381f..5b0a72f09c 100644 --- a/NPCs/Astral/SightseerCollider.cs +++ b/NPCs/Astral/SightseerCollider.cs @@ -1,33 +1,33 @@ -using CalamityMod.BiomeManagers; +using System; +using CalamityMod.BiomeManagers; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Sounds; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; +using ReLogic.Content; using Terraria; +using Terraria.Audio; using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using ReLogic.Content; -using CalamityMod.Sounds; namespace CalamityMod.NPCs.Astral { public class SightseerCollider : ModNPC { - private static Texture2D glowmask; + public static Asset glowmask; public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 4; if (!Main.dedServ) - glowmask = ModContent.Request("CalamityMod/NPCs/Astral/SightseerColliderGlow", AssetRequestMode.ImmediateLoad).Value; - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + glowmask = ModContent.Request("CalamityMod/NPCs/Astral/SightseerColliderGlow", AssetRequestMode.AsyncLoad); + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { PortraitPositionXOverride = 0 }; @@ -59,14 +59,18 @@ namespace CalamityMod.NPCs.Astral } NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; - SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.SightseerCollider") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.SightseerCollider") }); } @@ -129,7 +133,7 @@ namespace CalamityMod.NPCs.Astral public override void PostDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { - spriteBatch.Draw(glowmask, NPC.Center - screenPos + new Vector2(0, 4f), new Rectangle(0, NPC.frame.Y, 80, NPC.frame.Height), Color.White * 0.75f, NPC.rotation, new Vector2(40f, 20f), NPC.scale, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0f); + spriteBatch.Draw(glowmask.Value, NPC.Center - screenPos + new Vector2(0, 4f), new Rectangle(0, NPC.frame.Y, 80, NPC.frame.Height), Color.White * 0.75f, NPC.rotation, new Vector2(40f, 20f), NPC.scale, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0f); } public override float SpawnChance(NPCSpawnInfo spawnInfo) @@ -153,7 +157,7 @@ namespace CalamityMod.NPCs.Astral public override void ModifyNPCLoot(NPCLoot npcLoot) { - npcLoot.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 1, 1, 2, 1, 3)); + npcLoot.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 1, 1, 2, 1, 3)); } } } diff --git a/NPCs/Astral/SightseerSpitter.cs b/NPCs/Astral/SightseerSpitter.cs index 97c1bd3230..18a292029b 100644 --- a/NPCs/Astral/SightseerSpitter.cs +++ b/NPCs/Astral/SightseerSpitter.cs @@ -1,32 +1,32 @@ -using CalamityMod.BiomeManagers; +using System; +using CalamityMod.BiomeManagers; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Sounds; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; +using ReLogic.Content; using Terraria; +using Terraria.Audio; using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using ReLogic.Content; -using CalamityMod.Sounds; namespace CalamityMod.NPCs.Astral { public class SightseerSpitter : ModNPC { - private static Texture2D glowmask; + public static Asset glowmask; public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 4; if (!Main.dedServ) - glowmask = ModContent.Request("CalamityMod/NPCs/Astral/SightseerSpitterGlow", AssetRequestMode.ImmediateLoad).Value; - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + glowmask = ModContent.Request("CalamityMod/NPCs/Astral/SightseerSpitterGlow", AssetRequestMode.AsyncLoad); + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { Scale = 0.7f, Velocity = 2f, @@ -61,14 +61,18 @@ namespace CalamityMod.NPCs.Astral } NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; - SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.SightseerSpitter") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.SightseerSpitter") }); } @@ -158,7 +162,7 @@ namespace CalamityMod.NPCs.Astral public override void PostDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { if (!NPC.IsABestiaryIconDummy) - spriteBatch.Draw(glowmask, NPC.Center - screenPos + new Vector2(0, 4f), NPC.frame, Color.White * 0.75f, NPC.rotation, new Vector2(59f, 28f), NPC.scale, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0f); + spriteBatch.Draw(glowmask.Value, NPC.Center - screenPos + new Vector2(0, 4f), NPC.frame, Color.White * 0.75f, NPC.rotation, new Vector2(59f, 28f), NPC.scale, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0f); } public override float SpawnChance(NPCSpawnInfo spawnInfo) @@ -182,7 +186,7 @@ namespace CalamityMod.NPCs.Astral public override void ModifyNPCLoot(NPCLoot npcLoot) { - npcLoot.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 1, 2, 3, 3, 4)); + npcLoot.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 1, 2, 3, 3, 4)); } } @@ -247,13 +251,13 @@ namespace CalamityMod.NPCs.Astral { if (modifiers.GetDamage(NPC.damage, 0f, 0f) > 0) { - if (target.HasNPCBannerBuff(ModContent.NPCType())) - { - if (Main.expertMode) - modifiers.IncomingDamageMultiplier *= 0.5f; - else - modifiers.IncomingDamageMultiplier *= 0.75f; - } + if (target.HasNPCBannerBuff(ModContent.NPCType())) + { + if (Main.expertMode) + modifiers.IncomingDamageMultiplier *= 0.5f; + else + modifiers.IncomingDamageMultiplier *= 0.75f; + } if (Main.netMode != NetmodeID.MultiplayerClient) NPC.StrikeInstantKill(); diff --git a/NPCs/Astral/StellarCulex.cs b/NPCs/Astral/StellarCulex.cs index 15d82413e3..979055f748 100644 --- a/NPCs/Astral/StellarCulex.cs +++ b/NPCs/Astral/StellarCulex.cs @@ -1,32 +1,33 @@ -using CalamityMod.BiomeManagers; +using System; +using CalamityMod.BiomeManagers; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; -using CalamityMod.Items.Materials; using CalamityMod.Items.Accessories; +using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; +using CalamityMod.BiomeManagers.BestiaryCategories; +using CalamityMod.Sounds; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; +using ReLogic.Content; using Terraria; +using Terraria.Audio; using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using ReLogic.Content; -using CalamityMod.Sounds; namespace CalamityMod.NPCs.Astral { public class StellarCulex : ModNPC { - private static Texture2D glowmask; + public static Asset glowmask; public override void SetStaticDefaults() { if (!Main.dedServ) - glowmask = ModContent.Request("CalamityMod/NPCs/Astral/StellarCulexGlow", AssetRequestMode.ImmediateLoad).Value; + glowmask = ModContent.Request("CalamityMod/NPCs/Astral/StellarCulexGlow", AssetRequestMode.AsyncLoad); Main.npcFrameCount[NPC.type] = 4; - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { PortraitPositionXOverride = 10f }; @@ -59,14 +60,18 @@ namespace CalamityMod.NPCs.Astral } NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; - SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.StellarCulex") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.StellarCulex") }); } @@ -107,7 +112,7 @@ namespace CalamityMod.NPCs.Astral public override void PostDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { Vector2 origin = new Vector2(50, 30f); - spriteBatch.Draw(glowmask, NPC.Center - screenPos, NPC.frame, Color.White * 0.6f, NPC.rotation, origin, 1f, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); + spriteBatch.Draw(glowmask.Value, NPC.Center - screenPos, NPC.frame, Color.White * 0.6f, NPC.rotation, origin, 1f, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); } public override float SpawnChance(NPCSpawnInfo spawnInfo) @@ -131,7 +136,7 @@ namespace CalamityMod.NPCs.Astral public override void ModifyNPCLoot(NPCLoot npcLoot) { - npcLoot.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 1, 1, 2, 1, 3)); + npcLoot.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 1, 1, 2, 1, 3)); npcLoot.AddIf(() => DownedBossSystem.downedAstrumAureus, ModContent.ItemType(), 7); } } diff --git a/NPCs/Astral/Twinkler.cs b/NPCs/Astral/Twinkler.cs index a793112a20..236659fd72 100644 --- a/NPCs/Astral/Twinkler.cs +++ b/NPCs/Astral/Twinkler.cs @@ -26,12 +26,12 @@ namespace CalamityMod.NPCs.Astral AIType = NPCID.LightningBug; AnimationType = NPCID.LightningBug; NPC.catchItem = (short)ModContent.ItemType(); - SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Twinkler") }); diff --git a/NPCs/AstrumAureus/AstrumAureus.cs b/NPCs/AstrumAureus/AstrumAureus.cs index 6a7d4a7caa..c2222cc170 100644 --- a/NPCs/AstrumAureus/AstrumAureus.cs +++ b/NPCs/AstrumAureus/AstrumAureus.cs @@ -1,4 +1,6 @@ -using CalamityMod.BiomeManagers; +using System.IO; +using System.Threading; +using CalamityMod.BiomeManagers; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Items.Accessories; @@ -10,24 +12,24 @@ using CalamityMod.Items.Placeables.Furniture.DevPaintings; using CalamityMod.Items.Placeables.Furniture.Trophies; using CalamityMod.Items.Potions; using CalamityMod.Items.TreasureBags; +using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; -using CalamityMod.Items.Weapons.Magic; -using CalamityMod.Items.Weapons.Summon; using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Items.Weapons.Summon; +using CalamityMod.NPCs.CalamityAIs.CalamityBossAIs; using CalamityMod.NPCs.TownNPCs; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System.IO; -using System.Threading; +using ReLogic.Content; using Terraria; +using Terraria.Audio; using Terraria.GameContent; using Terraria.GameContent.Bestiary; +using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using Terraria.GameContent.ItemDropRules; namespace CalamityMod.NPCs.AstrumAureus { @@ -35,8 +37,21 @@ namespace CalamityMod.NPCs.AstrumAureus public class AstrumAureus : ModNPC { public static readonly SoundStyle HitSound = new("CalamityMod/Sounds/NPCHit/AureusHit", 4); + public static readonly SoundStyle DeathSound = new("CalamityMod/Sounds/NPCKilled/AureusDeath"); + public static readonly SoundStyle LaserSound = new("CalamityMod/Sounds/Custom/AstrumAureus/AureusShoot"); + public static readonly SoundStyle FlameCrystalSound = new("CalamityMod/Sounds/Custom/AstrumAureus/AureusShootCrystal"); public static readonly SoundStyle StompSound = new("CalamityMod/Sounds/Custom/AstrumAureus/LegStomp"); public static readonly SoundStyle JumpSound = new("CalamityMod/Sounds/Custom/AstrumAureus/AureusJump"); + public static readonly SoundStyle TeleportSound = new("CalamityMod/Sounds/Custom/AstrumAureus/AureusTeleport"); + + public static Asset JumpTexture; + public static Asset RechargeTexture; + public static Asset StompTexture; + public static Asset WalkTexture; + public static Asset Texture_Glow; + public static Asset JumpTexture_Glow; + public static Asset StompTexture_Glow; + public static Asset WalkTexture_Glow; private bool stomping = false; public int slimeProjCounter = 0; @@ -47,7 +62,7 @@ namespace CalamityMod.NPCs.AstrumAureus Main.npcFrameCount[NPC.type] = 6; NPCID.Sets.TrailingMode[NPC.type] = 1; NPCID.Sets.BossBestiaryPriority.Add(Type); - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { Scale = 0.27f, PortraitScale = 0.45f, @@ -55,7 +70,18 @@ namespace CalamityMod.NPCs.AstrumAureus }; value.Position.Y -= 20f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; - NPCID.Sets.MPAllowedEnemies[Type] = true; + NPCID.Sets.MPAllowedEnemies[Type] = true; + if (!Main.dedServ) + { + Texture_Glow = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + JumpTexture = ModContent.Request(Texture + "Jump", AssetRequestMode.AsyncLoad); + RechargeTexture = ModContent.Request(Texture + "Recharge", AssetRequestMode.AsyncLoad); + StompTexture = ModContent.Request(Texture + "Stomp", AssetRequestMode.AsyncLoad); + WalkTexture = ModContent.Request(Texture + "Walk", AssetRequestMode.AsyncLoad); + JumpTexture_Glow = ModContent.Request(Texture + "JumpGlow", AssetRequestMode.AsyncLoad); + StompTexture_Glow = ModContent.Request(Texture + "StompGlow", AssetRequestMode.AsyncLoad); + WalkTexture_Glow = ModContent.Request(Texture + "WalkGlow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -75,12 +101,12 @@ namespace CalamityMod.NPCs.AstrumAureus NPC.knockBackResist = 0f; NPC.value = Item.buyPrice(0, 60, 0, 0); NPC.boss = true; - NPC.DeathSound = SoundID.NPCDeath14; + NPC.DeathSound = DeathSound; double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; - SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; if (Main.getGoodWorld) NPC.scale *= 0.8f; @@ -90,10 +116,10 @@ namespace CalamityMod.NPCs.AstrumAureus public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Times.NightTime, - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.AstrumAureus") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.AstrumAureus") }); } @@ -123,7 +149,7 @@ namespace CalamityMod.NPCs.AstrumAureus public override void AI() { - CalamityAI.AstrumAureusAI(NPC, Mod); + AstrumAureusAI.VanillaAstrumAureusAI(NPC, Mod); } public override void FindFrame(int frameHeight) @@ -232,33 +258,33 @@ namespace CalamityMod.NPCs.AstrumAureus if (NPC.ai[0] == 0f || (slimePhaseHP && Main.zenithWorld)) { NPCTexture = TextureAssets.Npc[NPC.type].Value; - GlowMaskTexture = ModContent.Request("CalamityMod/NPCs/AstrumAureus/AstrumAureusGlow").Value; + GlowMaskTexture = Texture_Glow.Value; } else if (NPC.ai[0] == 1f) //nothing special done here { - NPCTexture = ModContent.Request("CalamityMod/NPCs/AstrumAureus/AstrumAureusRecharge").Value; + NPCTexture = RechargeTexture.Value; } else if (NPC.ai[0] == 2f) //nothing special done here { - NPCTexture = ModContent.Request("CalamityMod/NPCs/AstrumAureus/AstrumAureusWalk").Value; - GlowMaskTexture = ModContent.Request("CalamityMod/NPCs/AstrumAureus/AstrumAureusWalkGlow").Value; + NPCTexture = WalkTexture.Value; + GlowMaskTexture = WalkTexture_Glow.Value; } else if (NPC.ai[0] == 3f || NPC.ai[0] == 4f) //needs to have an in-air frame { if (NPC.velocity.Y == 0f && NPC.ai[1] >= 0f && NPC.ai[0] == 3f) //idle before jump { NPCTexture = TextureAssets.Npc[NPC.type].Value; //idle frames - GlowMaskTexture = ModContent.Request("CalamityMod/NPCs/AstrumAureus/AstrumAureusGlow").Value; + GlowMaskTexture = Texture_Glow.Value; } else if (NPC.velocity.Y <= 0f || NPC.ai[1] < 0f) //jump frames if flying upward or if about to jump { - NPCTexture = ModContent.Request("CalamityMod/NPCs/AstrumAureus/AstrumAureusJump").Value; - GlowMaskTexture = ModContent.Request("CalamityMod/NPCs/AstrumAureus/AstrumAureusJumpGlow").Value; + NPCTexture = JumpTexture.Value; + GlowMaskTexture = JumpTexture_Glow.Value; } else //stomping { - NPCTexture = ModContent.Request("CalamityMod/NPCs/AstrumAureus/AstrumAureusStomp").Value; - GlowMaskTexture = ModContent.Request("CalamityMod/NPCs/AstrumAureus/AstrumAureusStompGlow").Value; + NPCTexture = StompTexture.Value; + GlowMaskTexture = StompTexture_Glow.Value; } } else if (NPC.ai[0] >= 5f) //needs to have an in-air frame @@ -266,12 +292,12 @@ namespace CalamityMod.NPCs.AstrumAureus if (NPC.velocity.Y == 0f) //idle before teleport { NPCTexture = TextureAssets.Npc[NPC.type].Value; //idle frames - GlowMaskTexture = ModContent.Request("CalamityMod/NPCs/AstrumAureus/AstrumAureusGlow").Value; + GlowMaskTexture = Texture_Glow.Value; } else //in-air frames { - NPCTexture = ModContent.Request("CalamityMod/NPCs/AstrumAureus/AstrumAureusJump").Value; - GlowMaskTexture = ModContent.Request("CalamityMod/NPCs/AstrumAureus/AstrumAureusJumpGlow").Value; + NPCTexture = JumpTexture.Value; + GlowMaskTexture = JumpTexture_Glow.Value; } } @@ -413,7 +439,7 @@ namespace CalamityMod.NPCs.AstrumAureus } // Drop an Astral Meteor if applicable - ThreadPool.QueueUserWorkItem(_ => AstralBiome.PlaceAstralMeteor()); + ThreadPool.QueueUserWorkItem(_ => World.AstralBiome.PlaceAstralMeteor()); // Mark Astrum Aureus as dead DownedBossSystem.downedAstrumAureus = true; @@ -442,7 +468,7 @@ namespace CalamityMod.NPCs.AstrumAureus NPC.position.Y = NPC.position.Y - (NPC.height / 2); for (int r = 0; r < 50; r++) { - int aureusDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + int aureusDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[aureusDust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -452,10 +478,10 @@ namespace CalamityMod.NPCs.AstrumAureus } for (int s = 0; s < 100; s++) { - int aureusDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 3f); + int aureusDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 3f); Main.dust[aureusDust2].noGravity = true; Main.dust[aureusDust2].velocity *= 5f; - aureusDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 2f); + aureusDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 2f); Main.dust[aureusDust2].velocity *= 2f; } } @@ -463,7 +489,7 @@ namespace CalamityMod.NPCs.AstrumAureus public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { - NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } diff --git a/NPCs/AstrumAureus/AureusSpawn.cs b/NPCs/AstrumAureus/AureusSpawn.cs index 848c2a6de0..5c44436054 100644 --- a/NPCs/AstrumAureus/AureusSpawn.cs +++ b/NPCs/AstrumAureus/AureusSpawn.cs @@ -1,29 +1,35 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using System.IO; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Events; using CalamityMod.Projectiles.Boss; +using CalamityMod.Projectiles.Typeless; +using CalamityMod.Sounds; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; +using ReLogic.Content; using Terraria; +using Terraria.Audio; using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using CalamityMod.Projectiles.Typeless; -using CalamityMod.Sounds; namespace CalamityMod.NPCs.AstrumAureus { public class AureusSpawn : ModNPC { + public static Asset GlowTexture; public override void SetStaticDefaults() { this.HideFromBestiary(); Main.npcFrameCount[NPC.type] = 4; NPCID.Sets.TrailingMode[NPC.type] = 1; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -43,7 +49,6 @@ namespace CalamityMod.NPCs.AstrumAureus NPC.dontTakeDamage = true; NPC.noGravity = true; NPC.noTileCollide = true; - NPC.canGhostHeal = false; NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath1; NPC.Calamity().VulnerableToHeat = true; @@ -136,7 +141,7 @@ namespace CalamityMod.NPCs.AstrumAureus float lifeRatio = NPC.life / (float)NPC.lifeMax; // Phase 2 check - bool phase2 = lifeRatio <= 0.5f || Main.dayTime; + bool phase2 = lifeRatio <= 0.5f || Main.IsItDay(); // Charge towards the target and explode after some time int inertia = 30; @@ -167,7 +172,7 @@ namespace CalamityMod.NPCs.AstrumAureus for (int j = 0; j < 10; j++) { - int dust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 1f); + int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 1f); Main.dust[dust].velocity *= 1.66f; if (Main.rand.NextBool()) { @@ -179,10 +184,10 @@ namespace CalamityMod.NPCs.AstrumAureus for (int k = 0; k < 20; k++) { - int dust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 173, 0f, 0f, 100, default, 2f); + int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.ShadowbeamStaff, 0f, 0f, 100, default, 2f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 2f; - dust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 1f); + dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 1f); Main.dust[dust].velocity *= 1.33f; Main.dust[dust].noGravity = true; } @@ -202,7 +207,7 @@ namespace CalamityMod.NPCs.AstrumAureus Point point = NPC.Center.ToTileCoordinates(); Tile tileSafely = Framing.GetTileSafely(point); bool explodeOnCollision = tileSafely.HasUnactuatedTile && Main.tileSolid[tileSafely.TileType] && !Main.tileSolidTop[tileSafely.TileType] && !TileID.Sets.Platforms[tileSafely.TileType]; - bool explodeOnAureus = distanceFromAureus < (180f + 30f * (NPC.scale - 1f)) && !Main.dayTime; + bool explodeOnAureus = distanceFromAureus < (180f + 30f * (NPC.scale - 1f)) && !Main.IsItDay(); if (vector.Length() < (60f + 30f * (NPC.scale - 1f)) || explodeOnCollision || explodeOnAureus || NPC.Calamity().newAI[0] >= enlargeDuration) { NPC.life = 0; @@ -264,7 +269,7 @@ namespace CalamityMod.NPCs.AstrumAureus drawLocation += originalDrawSize * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, originalDrawSize, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/AstrumAureus/AureusSpawnGlow").Value; + texture2D15 = GlowTexture.Value; Color afterimageColorLerp = Color.Lerp(Color.White, Color.Orange, 0.5f) * NPC.Opacity; if (CalamityConfig.Instance.Afterimages) @@ -330,14 +335,14 @@ namespace CalamityMod.NPCs.AstrumAureus return; // Damage Aureus for a percentage of its HP if the spawn explodes on or near it - if (Main.netMode != NetmodeID.MultiplayerClient && (Main.npc[CalamityGlobalNPC.astrumAureus].Center - NPC.Center).Length() < (200f + 30f * (NPC.scale - 1f)) && !Main.dayTime) + if (Main.netMode != NetmodeID.MultiplayerClient && (Main.npc[CalamityGlobalNPC.astrumAureus].Center - NPC.Center).Length() < (200f + 30f * (NPC.scale - 1f)) && !Main.IsItDay()) Projectile.NewProjectileDirect(NPC.GetSource_FromAI(), Main.npc[CalamityGlobalNPC.astrumAureus].Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Main.npc[CalamityGlobalNPC.astrumAureus].lifeMax / 200 * NPC.scale), 0f, Main.myPlayer, Main.npc[CalamityGlobalNPC.astrumAureus].whoAmI); } public override void HitEffect(NPC.HitInfo hit) { for (int k = 0; k < 3; k++) - Dust.NewDust(NPC.position, NPC.width, NPC.height, 173, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.ShadowbeamStaff, hit.HitDirection, -1f, 0, default, 1f); if (NPC.life <= 0) { @@ -345,14 +350,14 @@ namespace CalamityMod.NPCs.AstrumAureus NPC.position.X = NPC.position.X + NPC.width / 2; NPC.position.Y = NPC.position.Y + NPC.height / 2; - NPC.damage = (int)(NPC.defDamage * NPC.scale); + NPC.damage = (int)Math.Round(NPC.defDamage * (double)NPC.scale); NPC.width = NPC.height = (int)(216 * NPC.scale); NPC.position.X = NPC.position.X - NPC.width / 2; NPC.position.Y = NPC.position.Y - NPC.height / 2; for (int r = 0; r < 30; r++) { - int astralDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 1f); + int astralDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 1f); Main.dust[astralDust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -364,10 +369,10 @@ namespace CalamityMod.NPCs.AstrumAureus for (int s = 0; s < 60; s++) { - int astralDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 173, 0f, 0f, 100, default, 2f); + int astralDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.ShadowbeamStaff, 0f, 0f, 100, default, 2f); Main.dust[astralDust2].noGravity = true; Main.dust[astralDust2].velocity *= 5f; - astralDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 1f); + astralDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 1f); Main.dust[astralDust2].velocity *= 2f; Main.dust[astralDust2].noGravity = true; } diff --git a/NPCs/AstrumDeus/AstrumDeusBody.cs b/NPCs/AstrumDeus/AstrumDeusBody.cs index ba1e2f361f..df1beaab43 100644 --- a/NPCs/AstrumDeus/AstrumDeusBody.cs +++ b/NPCs/AstrumDeus/AstrumDeusBody.cs @@ -1,10 +1,12 @@ -using CalamityMod.Buffs.DamageOverTime; +using System.IO; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Events; +using CalamityMod.NPCs.CalamityAIs.CalamityBossAIs; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System.IO; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.ID; @@ -17,10 +19,28 @@ namespace CalamityMod.NPCs.AstrumDeus { public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.AstrumDeusHead.DisplayName"); + public static Asset AltTexture; + public static Asset TextureGlow1; + public static Asset TextureGlow2; + public static Asset TextureGlow3; + public static Asset TextureGlow4; + public static Asset TextureAltGlow1; + public static Asset TextureAltGlow2; + public override void SetStaticDefaults() { this.HideFromBestiary(); NPCID.Sets.TrailingMode[NPC.type] = 1; + if (!Main.dedServ) + { + AltTexture = ModContent.Request(Texture + "AltSpectral", AssetRequestMode.AsyncLoad); + TextureGlow1 = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + TextureGlow2 = ModContent.Request(Texture + "Glow2", AssetRequestMode.AsyncLoad); + TextureGlow3 = ModContent.Request(Texture + "Glow3", AssetRequestMode.AsyncLoad); + TextureGlow4 = ModContent.Request(Texture + "Glow4", AssetRequestMode.AsyncLoad); + TextureAltGlow1 = ModContent.Request(Texture + "AltGlow", AssetRequestMode.AsyncLoad); + TextureAltGlow2 = ModContent.Request(Texture + "AltGlow2", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -30,7 +50,7 @@ namespace CalamityMod.NPCs.AstrumDeus NPC.width = 38; NPC.height = 44; NPC.defense = 35; - NPC.DR_NERD(0.2f); + NPC.DR_NERD(0.25f); NPC.LifeMaxNERB(200000, 240000, 650000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); @@ -51,8 +71,7 @@ namespace CalamityMod.NPCs.AstrumDeus NPC.behindTiles = true; NPC.noGravity = true; NPC.noTileCollide = true; - NPC.canGhostHeal = false; - NPC.HitSound = SoundID.NPCHit4; + NPC.HitSound = AstrumDeusHead.HitSound; NPC.DeathSound = AstrumDeusHead.DeathSound; NPC.netAlways = true; NPC.boss = true; @@ -82,7 +101,7 @@ namespace CalamityMod.NPCs.AstrumDeus public override void AI() { - CalamityAI.AstrumDeusAI(NPC, Mod, false); + AstrumDeusAI.VanillaAstrumDeusAI(NPC, Mod, false); } public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) @@ -99,8 +118,8 @@ namespace CalamityMod.NPCs.AstrumDeus bool deathModeEnragePhase = Main.npc[(int)NPC.ai[2]].Calamity().newAI[0] == 3f; bool doubleWormPhase = NPC.Calamity().newAI[0] != 0f && !deathModeEnragePhase; - Texture2D mainWormTex = altBodyTextures ? ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusBodyAltSpectral").Value : TextureAssets.Npc[NPC.type].Value; - Texture2D secondWormTex = ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusBodyGlow2").Value; + Texture2D mainWormTex = altBodyTextures ? AltTexture.Value : TextureAssets.Npc[NPC.type].Value; + Texture2D secondWormTex = TextureGlow2.Value; Vector2 halfSizeTex = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / 2); Vector2 drawLocation = NPC.Center - screenPos; @@ -108,12 +127,12 @@ namespace CalamityMod.NPCs.AstrumDeus drawLocation += halfSizeTex * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(mainWormTex, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTex, NPC.scale, spriteEffects, 0f); - mainWormTex = altBodyTextures ? ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusBodyAltGlow").Value : ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusBodyGlow").Value; + mainWormTex = altBodyTextures ? TextureAltGlow1.Value : TextureGlow1.Value; Color phaseColor = drawCyan ? Color.Cyan : Color.Orange; if (doubleWormPhase) { - mainWormTex = drawCyan ? mainWormTex : (altBodyTextures ? ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusBodyAltGlow2").Value : ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusBodyGlow3").Value); - secondWormTex = drawCyan ? ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusBodyGlow4").Value : secondWormTex; + mainWormTex = drawCyan ? mainWormTex : (altBodyTextures ? TextureAltGlow2.Value : TextureGlow3.Value); + secondWormTex = drawCyan ? TextureGlow4.Value : secondWormTex; } Color mainWormColorLerp = Color.Lerp(Color.White, doubleWormPhase ? phaseColor : Color.Cyan, 0.5f) * (deathModeEnragePhase ? 1f : NPC.Opacity); Color secondWormColorLerp = Color.Lerp(Color.White, doubleWormPhase ? phaseColor : Color.Orange, 0.5f) * (deathModeEnragePhase ? 1f : NPC.Opacity); @@ -154,7 +173,7 @@ namespace CalamityMod.NPCs.AstrumDeus NPC.position.Y = NPC.position.Y - (NPC.height / 2); for (int i = 0; i < 5; i++) { - int purpleDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + int purpleDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[purpleDust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -164,10 +183,10 @@ namespace CalamityMod.NPCs.AstrumDeus } for (int j = 0; j < 10; j++) { - int astralDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 3f); + int astralDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 3f); Main.dust[astralDust].noGravity = true; Main.dust[astralDust].velocity *= 5f; - astralDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 2f); + astralDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 2f); Main.dust[astralDust].velocity *= 2f; } } @@ -181,7 +200,7 @@ namespace CalamityMod.NPCs.AstrumDeus public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { - NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } } diff --git a/NPCs/AstrumDeus/AstrumDeusHead.cs b/NPCs/AstrumDeus/AstrumDeusHead.cs index 4e0f3ff8a2..0174243a2e 100644 --- a/NPCs/AstrumDeus/AstrumDeusHead.cs +++ b/NPCs/AstrumDeus/AstrumDeusHead.cs @@ -1,4 +1,5 @@ -using CalamityMod.BiomeManagers; +using System.IO; +using CalamityMod.BiomeManagers; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Events; @@ -11,40 +12,48 @@ using CalamityMod.Items.Placeables.Furniture.BossRelics; using CalamityMod.Items.Placeables.Furniture.DevPaintings; using CalamityMod.Items.Placeables.Furniture.Trophies; using CalamityMod.Items.TreasureBags; +using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; -using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Items.Weapons.Summon; +using CalamityMod.NPCs.CalamityAIs.CalamityBossAIs; using CalamityMod.UI.VanillaBossBars; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System.IO; +using ReLogic.Content; using Terraria; +using Terraria.Audio; using Terraria.GameContent; using Terraria.GameContent.Bestiary; +using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; -using Terraria.GameContent.ItemDropRules; -using Terraria.Audio; namespace CalamityMod.NPCs.AstrumDeus { [AutoloadBossHead] public class AstrumDeusHead : ModNPC { - public static readonly SoundStyle SpawnSound = new("CalamityMod/Sounds/Custom/AstrumDeusSpawn"); - public static readonly SoundStyle LaserSound = new("CalamityMod/Sounds/Custom/AstrumDeusLaser"); - public static readonly SoundStyle MineSound = new("CalamityMod/Sounds/Custom/AstrumDeusMine"); - public static readonly SoundStyle SplitSound = new("CalamityMod/Sounds/Custom/AstrumDeusSplit"); + public static readonly SoundStyle SpawnSound = new("CalamityMod/Sounds/Custom/AstrumDeus/AstrumDeusSpawn"); + public static readonly SoundStyle LaserSound = new("CalamityMod/Sounds/Custom/AstrumDeus/AstrumDeusLaser") { Volume = 0.35f }; + public static readonly SoundStyle GodRaySound = new("CalamityMod/Sounds/Custom/AstrumDeus/AstrumDeusGodRay") { Volume = 0.4f }; + public static readonly SoundStyle MineSound = new("CalamityMod/Sounds/Custom/AstrumDeus/AstrumDeusMine") { Volume = 0.4f }; + public static readonly SoundStyle SplitSound = new("CalamityMod/Sounds/Custom/AstrumDeus/AstrumDeusSplit"); + public static readonly SoundStyle HitSound = new("CalamityMod/Sounds/NPCHit/AstrumDeusHit", 2) { Volume = 0.7f }; public static readonly SoundStyle DeathSound = new("CalamityMod/Sounds/NPCKilled/AstrumDeusDeath"); + public static Asset TextureGlow1; + public static Asset TextureGlow2; + public static Asset TextureGlow3; + public static Asset TextureGlow4; + public override void SetStaticDefaults() { NPCID.Sets.TrailingMode[NPC.type] = 1; NPCID.Sets.BossBestiaryPriority.Add(Type); - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { Scale = 0.70f, PortraitScale = 0.75f, @@ -53,6 +62,13 @@ namespace CalamityMod.NPCs.AstrumDeus value.Position.X += 55f; value.Position.Y += 23f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + TextureGlow1 = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + TextureGlow2 = ModContent.Request(Texture + "Glow2", AssetRequestMode.AsyncLoad); + TextureGlow3 = ModContent.Request(Texture + "Glow3", AssetRequestMode.AsyncLoad); + TextureGlow4 = ModContent.Request(Texture + "Glow4", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -87,12 +103,12 @@ namespace CalamityMod.NPCs.AstrumDeus NPC.behindTiles = true; NPC.noGravity = true; NPC.noTileCollide = true; - NPC.HitSound = SoundID.NPCHit4; + NPC.HitSound = HitSound; NPC.DeathSound = DeathSound; NPC.netAlways = true; NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; - SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; if (Main.zenithWorld) { @@ -105,7 +121,7 @@ namespace CalamityMod.NPCs.AstrumDeus public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Times.NightTime, new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.AstrumDeus") @@ -128,7 +144,7 @@ namespace CalamityMod.NPCs.AstrumDeus public override void AI() { - CalamityAI.AstrumDeusAI(NPC, Mod, true); + AstrumDeusAI.VanillaAstrumDeusAI(NPC, Mod, true); } public override bool CheckActive() @@ -150,7 +166,7 @@ namespace CalamityMod.NPCs.AstrumDeus bool doubleWormPhase = NPC.Calamity().newAI[0] != 0f && !deathModeEnragePhase; Texture2D mainWormTex = TextureAssets.Npc[NPC.type].Value; - Texture2D secondWormTex = ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusHeadGlow2").Value; + Texture2D secondWormTex = TextureGlow2.Value; Vector2 halfSizeTex = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / 2); Vector2 drawLocation = NPC.Center - screenPos; @@ -158,12 +174,12 @@ namespace CalamityMod.NPCs.AstrumDeus drawLocation += halfSizeTex * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(mainWormTex, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTex, NPC.scale, spriteEffects, 0f); - mainWormTex = ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusHeadGlow").Value; + mainWormTex = TextureGlow1.Value; Color phaseColor = drawCyan ? Color.Cyan : Color.Orange; if (doubleWormPhase) { - mainWormTex = drawCyan ? mainWormTex : ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusHeadGlow3").Value; - secondWormTex = drawCyan ? ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusHeadGlow4").Value : secondWormTex; + mainWormTex = drawCyan ? mainWormTex : TextureGlow3.Value; + secondWormTex = drawCyan ? TextureGlow4.Value : secondWormTex; } Color mainWormColorLerp = Color.Lerp(Color.White, doubleWormPhase ? phaseColor : Color.Cyan, 0.5f) * (deathModeEnragePhase ? 1f : NPC.Opacity); Color secondWormColorLerp = Color.Lerp(Color.White, doubleWormPhase ? phaseColor : Color.Orange, 0.5f) * (deathModeEnragePhase ? 1f : NPC.Opacity); @@ -193,7 +209,7 @@ namespace CalamityMod.NPCs.AstrumDeus NPC.position.Y = NPC.position.Y - (NPC.height / 2); for (int i = 0; i < 5; i++) { - int purpleDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + int purpleDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[purpleDust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -203,17 +219,17 @@ namespace CalamityMod.NPCs.AstrumDeus } for (int j = 0; j < 10; j++) { - int astralDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 3f); + int astralDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 3f); Main.dust[astralDust].noGravity = true; Main.dust[astralDust].velocity *= 5f; - astralDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 2f); + astralDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 2f); Main.dust[astralDust].velocity *= 2f; } } } } - public override void BossLoot(ref string name, ref int potionType) => potionType = ModContent.ItemType(); + public override void BossLoot(ref string name, ref int potionType) => potionType = ModContent.ItemType(); public static bool ShouldNotDropThings(NPC npc) => npc.Calamity().newAI[0] == 0f || ((CalamityWorld.death || BossRushEvent.BossRushActive) && npc.Calamity().newAI[0] != 3f); @@ -289,16 +305,16 @@ namespace CalamityMod.NPCs.AstrumDeus normalOnly.Add(ModContent.ItemType(), 7); normalOnly.Add(ModContent.ItemType(), ThankYouPainting.DropInt); - // Equipment + // Equipment normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); normalOnly.Add(ModContent.ItemType(), 5); // Materials normalOnly.Add(ItemID.FallenStar, 1, 25, 40); - normalOnly.Add(ModContent.ItemType(), 1, 50, 80); + normalOnly.Add(ModContent.ItemType(), 1, 50, 80); } - npcLoot.DefineConditionalDropSet(() => true).Add(DropHelper.PerPlayer(ItemID.SuperHealingPotion, 1, 5, 15), hideLootReport: true); // Healing Potions don't show up in the Bestiary + npcLoot.DefineConditionalDropSet(() => true).Add(DropHelper.PerPlayer(ItemID.SuperHealingPotion, 1, 5, 15), hideLootReport: true); // Healing Potions don't show up in the Bestiary lastWorm.Add(ModContent.ItemType(), 10); // Relic @@ -336,7 +352,7 @@ namespace CalamityMod.NPCs.AstrumDeus public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { - NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); } } } diff --git a/NPCs/AstrumDeus/AstrumDeusTail.cs b/NPCs/AstrumDeus/AstrumDeusTail.cs index eae753ab00..3a3a2f1004 100644 --- a/NPCs/AstrumDeus/AstrumDeusTail.cs +++ b/NPCs/AstrumDeus/AstrumDeusTail.cs @@ -1,10 +1,12 @@ -using CalamityMod.Buffs.DamageOverTime; +using System.IO; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Events; +using CalamityMod.NPCs.CalamityAIs.CalamityBossAIs; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System.IO; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.ID; @@ -17,10 +19,18 @@ namespace CalamityMod.NPCs.AstrumDeus { public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.AstrumDeusHead.DisplayName"); + public static Asset GlowTexture; + public static Asset GlowTexture2; + public override void SetStaticDefaults() { this.HideFromBestiary(); NPCID.Sets.TrailingMode[NPC.type] = 1; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + GlowTexture2 = ModContent.Request(Texture + "Glow2", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -30,7 +40,7 @@ namespace CalamityMod.NPCs.AstrumDeus NPC.width = 52; NPC.height = 68; NPC.defense = 50; - NPC.DR_NERD(0.3f); + NPC.DR_NERD(0.4f); NPC.LifeMaxNERB(200000, 240000, 650000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); @@ -51,8 +61,7 @@ namespace CalamityMod.NPCs.AstrumDeus NPC.behindTiles = true; NPC.noGravity = true; NPC.noTileCollide = true; - NPC.canGhostHeal = false; - NPC.HitSound = SoundID.NPCHit4; + NPC.HitSound = AstrumDeusHead.HitSound; NPC.DeathSound = AstrumDeusHead.DeathSound; NPC.netAlways = true; NPC.boss = true; @@ -82,7 +91,7 @@ namespace CalamityMod.NPCs.AstrumDeus public override void AI() { - CalamityAI.AstrumDeusAI(NPC, Mod, false); + AstrumDeusAI.VanillaAstrumDeusAI(NPC, Mod, false); } public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) @@ -106,10 +115,10 @@ namespace CalamityMod.NPCs.AstrumDeus drawLocation += halfSizeTex * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(wormTexture, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTex, NPC.scale, spriteEffects, 0f); - wormTexture = ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusTailGlow").Value; + wormTexture = GlowTexture.Value; Color phaseColor = drawCyan ? Color.Cyan : Color.Orange; if (doubleWormPhase) - wormTexture = drawCyan ? ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusTailGlow2").Value : wormTexture; + wormTexture = drawCyan ? GlowTexture2.Value : wormTexture; Color wormColorLerp = Color.Lerp(Color.White, doubleWormPhase ? phaseColor : Color.Orange, 0.5f) * (deathModeEnragePhase ? 1f : NPC.Opacity); @@ -137,7 +146,7 @@ namespace CalamityMod.NPCs.AstrumDeus NPC.position.Y = NPC.position.Y - (NPC.height / 2); for (int i = 0; i < 5; i++) { - int purpleDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + int purpleDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[purpleDust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -147,10 +156,10 @@ namespace CalamityMod.NPCs.AstrumDeus } for (int j = 0; j < 10; j++) { - int astralDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 3f); + int astralDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 3f); Main.dust[astralDust].noGravity = true; Main.dust[astralDust].velocity *= 5f; - astralDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 2f); + astralDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 2f); Main.dust[astralDust].velocity *= 2f; } } @@ -169,7 +178,7 @@ namespace CalamityMod.NPCs.AstrumDeus public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { - NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } } diff --git a/NPCs/BrimstoneElemental/Brimling.cs b/NPCs/BrimstoneElemental/Brimling.cs index bb7d4fa158..b538a4df94 100644 --- a/NPCs/BrimstoneElemental/Brimling.cs +++ b/NPCs/BrimstoneElemental/Brimling.cs @@ -1,16 +1,16 @@ -using CalamityMod.BiomeManagers; +using System; +using System.IO; +using CalamityMod.BiomeManagers; using CalamityMod.Dusts; using CalamityMod.Events; using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; -using System; -using System.IO; using Terraria; +using Terraria.Audio; using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.NPCs.BrimstoneElemental { @@ -36,10 +36,9 @@ namespace CalamityMod.NPCs.BrimstoneElemental NPC.defense = 0; NPC.DR_NERD(normalDR); NPC.lifeMax = 1000; - NPC.knockBackResist = 0f; + NPC.knockBackResist = 0.5f; NPC.noGravity = true; NPC.noTileCollide = true; - NPC.canGhostHeal = false; NPC.HitSound = SoundID.NPCHit23; NPC.DeathSound = SoundID.NPCDeath39; if (BossRushEvent.BossRushActive) @@ -62,7 +61,7 @@ namespace CalamityMod.NPCs.BrimstoneElemental int associatedNPCType = ModContent.NPCType(); bestiaryEntry.UIInfoProvider = new CommonEnemyUICollectionInfoProvider(ContentSamples.NpcBestiaryCreditIdsByNpcNetIds[associatedNPCType], quickUnlock: true); - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Brimling") }); @@ -159,7 +158,7 @@ namespace CalamityMod.NPCs.BrimstoneElemental float projectileVelocity = 5f; int type = ModContent.ProjectileType(); int damage = NPC.GetProjectileDamage(type); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, Vector2.Normalize(Main.player[Main.npc[CalamityGlobalNPC.brimstoneElemental].target].Center - NPC.Center) * projectileVelocity, type, damage, 0f, Main.myPlayer, 1f, 0f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, Vector2.Normalize(Main.player[Main.npc[CalamityGlobalNPC.brimstoneElemental].target].Center - NPC.Center) * projectileVelocity, type, damage, 0f, Main.myPlayer, 1f, 0f, projectileVelocity * 3f); } } else @@ -223,7 +222,7 @@ namespace CalamityMod.NPCs.BrimstoneElemental { for (int i = 0; i < 20; i++) { - int deepRedDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, 235, 0f, 0f, 100, Color.Transparent, 1f); + int deepRedDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.LifeDrain, 0f, 0f, 100, Color.Transparent, 1f); Dust dust = Main.dust[deepRedDust]; dust.velocity *= 3f; Main.dust[deepRedDust].noGravity = true; @@ -240,7 +239,7 @@ namespace CalamityMod.NPCs.BrimstoneElemental for (int j = 0; j < 20; j++) { - int deepRedDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, 235, 0f, 0f, 100, Color.Transparent, 1f); + int deepRedDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.LifeDrain, 0f, 0f, 100, Color.Transparent, 1f); Dust dust = Main.dust[deepRedDust2]; dust.velocity *= 3f; Main.dust[deepRedDust2].noGravity = true; diff --git a/NPCs/BrimstoneElemental/BrimstoneElemental.cs b/NPCs/BrimstoneElemental/BrimstoneElemental.cs index bf3c38328e..39e33068b0 100644 --- a/NPCs/BrimstoneElemental/BrimstoneElemental.cs +++ b/NPCs/BrimstoneElemental/BrimstoneElemental.cs @@ -1,4 +1,5 @@ -using CalamityMod.BiomeManagers; +using System.IO; +using CalamityMod.BiomeManagers; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Events; @@ -16,10 +17,10 @@ using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Summon; +using CalamityMod.NPCs.CalamityAIs.CalamityBossAIs; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System.IO; using Terraria; using Terraria.GameContent; using Terraria.GameContent.Bestiary; @@ -47,7 +48,7 @@ namespace CalamityMod.NPCs.BrimstoneElemental { Main.npcFrameCount[NPC.type] = 12; NPCID.Sets.BossBestiaryPriority.Add(Type); - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { Scale = 0.5f, PortraitScale = 0.64f @@ -86,7 +87,7 @@ namespace CalamityMod.NPCs.BrimstoneElemental public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.BrimstoneElemental") }); @@ -116,7 +117,7 @@ namespace CalamityMod.NPCs.BrimstoneElemental public override void AI() { - CalamityAI.BrimstoneElementalAI(NPC, Mod); + BrimstoneElementalAI.VanillaBrimstoneElementalAI(NPC, Mod); } public override bool CanHitPlayer(Player target, ref int cooldownSlot) @@ -190,7 +191,7 @@ namespace CalamityMod.NPCs.BrimstoneElemental // Normal drops: Everything that would otherwise be in the bag var normalOnly = npcLoot.DefineNormalOnlyDropSet(); - { + { // Weapons int[] weapons = new int[] { @@ -245,7 +246,7 @@ namespace CalamityMod.NPCs.BrimstoneElemental public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { - NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } @@ -253,7 +254,7 @@ namespace CalamityMod.NPCs.BrimstoneElemental { for (int k = 0; k < 5; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 235, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.LifeDrain, hit.HitDirection, -1f, 0, default, 1f); } if (NPC.life <= 0) { @@ -265,7 +266,7 @@ namespace CalamityMod.NPCs.BrimstoneElemental NPC.position.Y = NPC.position.Y - (float)(NPC.height / 2); for (int i = 0; i < 40; i++) { - int brimDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); + int brimDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); Main.dust[brimDust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -275,10 +276,10 @@ namespace CalamityMod.NPCs.BrimstoneElemental } for (int j = 0; j < 60; j++) { - int brimDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 3f); + int brimDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 3f); Main.dust[brimDust2].noGravity = true; Main.dust[brimDust2].velocity *= 5f; - brimDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); + brimDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); Main.dust[brimDust2].velocity *= 2f; } if (Main.netMode != NetmodeID.Server) diff --git a/NPCs/Bumblebirb/Bumblefuck.cs b/NPCs/Bumblebirb/Bumblefuck.cs index 5173fb793e..e88ddfb475 100644 --- a/NPCs/Bumblebirb/Bumblefuck.cs +++ b/NPCs/Bumblebirb/Bumblefuck.cs @@ -14,11 +14,13 @@ using CalamityMod.Items.TreasureBags; using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.NPCs.CalamityAIs.CalamityBossAIs; using CalamityMod.Projectiles.Boss; using CalamityMod.Sounds; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -32,12 +34,13 @@ namespace CalamityMod.NPCs.Bumblebirb [AutoloadBossHead] public class Bumblefuck : ModNPC { + public static Asset GlowTexture; public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 6; NPCID.Sets.TrailingMode[NPC.type] = 1; NPCID.Sets.BossBestiaryPriority.Add(Type); - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { Scale = 0.5f, PortraitScale = 0.85f, @@ -47,6 +50,10 @@ namespace CalamityMod.NPCs.Bumblebirb value.Position.Y += 8f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; NPCID.Sets.MPAllowedEnemies[Type] = true; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request("CalamityMod/NPCs/Bumblebirb/BirbGlow", AssetRequestMode.AsyncLoad); + } } public override string Texture => "CalamityMod/NPCs/Bumblebirb/Birb"; @@ -82,7 +89,7 @@ namespace CalamityMod.NPCs.Bumblebirb public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Jungle, new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Bumblefuck") @@ -111,7 +118,7 @@ namespace CalamityMod.NPCs.Bumblebirb public override void AI() { - CalamityAI.BumblebirbAI(NPC, Mod); + BumblebirbAI.VanillaBumblebirbAI(NPC, Mod); } public override void FindFrame(int frameHeight) @@ -349,7 +356,7 @@ namespace CalamityMod.NPCs.Bumblebirb if (phase2) { - texture2D15 = ModContent.Request("CalamityMod/NPCs/Bumblebirb/BirbGlow").Value; + texture2D15 = GlowTexture.Value; Color glowmaskColor = Color.Lerp(Color.White, Color.Red, 0.5f); altColor = Color.Red; @@ -480,7 +487,7 @@ namespace CalamityMod.NPCs.Bumblebirb public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { - NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } @@ -496,13 +503,13 @@ namespace CalamityMod.NPCs.Bumblebirb { for (int k = 0; k < 5; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 244, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.CopperCoin, hit.HitDirection, -1f, 0, default, 1f); } if (NPC.life <= 0) { for (int k = 0; k < 50; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 244, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.CopperCoin, hit.HitDirection, -1f, 0, default, 1f); } if (Main.netMode != NetmodeID.Server) { diff --git a/NPCs/Bumblebirb/Bumblefuck2.cs b/NPCs/Bumblebirb/Bumblefuck2.cs index 9312bb3f08..b79d7fb64a 100644 --- a/NPCs/Bumblebirb/Bumblefuck2.cs +++ b/NPCs/Bumblebirb/Bumblefuck2.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Boss; +using CalamityMod.NPCs.CalamityAIs.CalamityBossAIs; +using CalamityMod.Projectiles.Boss; using CalamityMod.Sounds; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -31,24 +32,27 @@ namespace CalamityMod.NPCs.Bumblebirb NPC.width = 120; NPC.height = 80; NPC.defense = 20; - NPC.LifeMaxNERB(9375, 11250, 5000); // Old HP - 12000, 15000 + NPC.LifeMaxNERB(9375, 11250, 5000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); - NPC.knockBackResist = 0f; + NPC.knockBackResist = 0.15f; NPC.lavaImmune = true; NPC.noTileCollide = true; NPC.noGravity = true; - NPC.canGhostHeal = false; NPC.HitSound = SoundID.NPCHit51; NPC.DeathSound = SoundID.NPCDeath46; NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void AI() { - CalamityAI.Bumblebirb2AI(NPC, Mod, true); + BumblebirbAI.VanillaBumblebirb2AI(NPC, Mod, true); } public override void OnKill() @@ -137,13 +141,13 @@ namespace CalamityMod.NPCs.Bumblebirb { for (int k = 0; k < 5; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 244, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.CopperCoin, hit.HitDirection, -1f, 0, default, 1f); } if (NPC.life <= 0) { for (int k = 0; k < 50; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 244, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.CopperCoin, hit.HitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/CalClone/CalamitasClone.cs b/NPCs/CalClone/CalamitasClone.cs index 1af5ce551a..c3c1dd0cbc 100644 --- a/NPCs/CalClone/CalamitasClone.cs +++ b/NPCs/CalClone/CalamitasClone.cs @@ -1,4 +1,5 @@ -using CalamityMod.Buffs.DamageOverTime; +using System.IO; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Events; using CalamityMod.Items.Accessories; @@ -13,31 +14,34 @@ using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Summon; +using CalamityMod.NPCs.CalamityAIs.CalamityBossAIs; using CalamityMod.NPCs.TownNPCs; +using CalamityMod.Sounds; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System.IO; +using ReLogic.Content; using Terraria; +using Terraria.Audio; using Terraria.GameContent; using Terraria.GameContent.Bestiary; +using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using Terraria.GameContent.ItemDropRules; -using CalamityMod.Sounds; namespace CalamityMod.NPCs.CalClone { [AutoloadBossHead] public class CalamitasClone : ModNPC { + public static Asset GlowTexture; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 6; NPCID.Sets.TrailingMode[NPC.type] = 1; NPCID.Sets.BossBestiaryPriority.Add(Type); - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { Scale = 0.65f, PortraitScale = 0.65f @@ -45,6 +49,10 @@ namespace CalamityMod.NPCs.CalClone value.Position.Y -= 10f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; NPCID.Sets.MPAllowedEnemies[Type] = true; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -79,7 +87,7 @@ namespace CalamityMod.NPCs.CalClone public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Times.NightTime, BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Surface, @@ -119,7 +127,7 @@ namespace CalamityMod.NPCs.CalClone public override void AI() { - CalamityAI.CalamitasCloneAI(NPC, Mod); + CalamitasCloneAI.VanillaCalamitasCloneAI(NPC, Mod); } public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) @@ -154,7 +162,7 @@ namespace CalamityMod.NPCs.CalClone npcOffset += origin * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture, npcOffset, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, origin, NPC.scale, spriteEffects, 0f); - texture = ModContent.Request("CalamityMod/NPCs/CalClone/CalamitasCloneGlow").Value; + texture = GlowTexture.Value; Color color = Color.Lerp(Color.White, Color.Red, 0.5f); if (Main.zenithWorld) { @@ -183,8 +191,7 @@ namespace CalamityMod.NPCs.CalClone public override void ModifyNPCLoot(NPCLoot npcLoot) { npcLoot.Add(ItemDropRule.BossBag(ModContent.ItemType())); - npcLoot.Add(ItemID.BrokenHeroSword); - + // Normal drops: Everything that would otherwise be in the bag var normalOnly = npcLoot.DefineNormalOnlyDropSet(); { @@ -233,18 +240,6 @@ namespace CalamityMod.NPCs.CalClone CalamityGlobalNPC.SetNewShopVariable(new int[] { ModContent.NPCType() }, DownedBossSystem.downedCalamitasClone); - // Abyss awakens after killing Calamitas - string key = "Mods.CalamityMod.Status.Progression.PlantBossText"; - Color messageColor = Color.RoyalBlue; - - if (!DownedBossSystem.downedCalamitasClone) - { - if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active) - SoundEngine.PlaySound(CommonCalamitySounds.WyrmScreamSound, Main.player[Main.myPlayer].Center); - - CalamityUtils.DisplayLocalizedText(key, messageColor); - } - // Mark the Calamitas Clone as dead DownedBossSystem.downedCalamitasClone = true; CalamityNetcode.SyncWorld(); @@ -277,7 +272,7 @@ namespace CalamityMod.NPCs.CalClone NPC.position.Y = NPC.position.Y - (float)(NPC.height / 2); for (int i = 0; i < 40; i++) { - int brimDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); + int brimDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); Main.dust[brimDust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -287,10 +282,10 @@ namespace CalamityMod.NPCs.CalClone } for (int j = 0; j < 70; j++) { - int brimDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 3f); + int brimDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 3f); Main.dust[brimDust2].noGravity = true; Main.dust[brimDust2].velocity *= 5f; - brimDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); + brimDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); Main.dust[brimDust2].velocity *= 2f; } } @@ -298,7 +293,7 @@ namespace CalamityMod.NPCs.CalClone public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { - NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } diff --git a/NPCs/CalClone/Cataclysm.cs b/NPCs/CalClone/Cataclysm.cs index 1f2c153cea..80b173cc83 100644 --- a/NPCs/CalClone/Cataclysm.cs +++ b/NPCs/CalClone/Cataclysm.cs @@ -1,35 +1,43 @@ -using CalamityMod.Buffs.DamageOverTime; +using System.IO; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Events; using CalamityMod.Items.Placeables.Furniture.Trophies; using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.NPCs.CalamityAIs.CalamityBossAIs; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; -using System.IO; namespace CalamityMod.NPCs.CalClone { [AutoloadBossHead] public class Cataclysm : ModNPC { + public static Asset GlowTexture; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 6; NPCID.Sets.TrailingMode[NPC.type] = 1; NPCID.Sets.BossBestiaryPriority.Add(Type); - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { PortraitScale = 0.8f, Scale = 0.5f, PortraitPositionYOverride = 0 }; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -66,11 +74,11 @@ namespace CalamityMod.NPCs.CalClone int associatedNPCType = ModContent.NPCType(); bestiaryEntry.UIInfoProvider = new CommonEnemyUICollectionInfoProvider(ContentSamples.NpcBestiaryCreditIdsByNpcNetIds[associatedNPCType], quickUnlock: true); - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Times.NightTime, BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Surface, - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Cataclysm") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Cataclysm") }); } @@ -96,7 +104,7 @@ namespace CalamityMod.NPCs.CalClone public override void AI() { - CalamityAI.CataclysmAI(NPC, Mod); + CalamitasCloneAI.VanillaCataclysmAI(NPC, Mod); } public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) @@ -129,7 +137,7 @@ namespace CalamityMod.NPCs.CalClone drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/CalClone/CataclysmGlow").Value; + texture2D15 = GlowTexture.Value; Color pinkLerp = Color.Lerp(Color.White, Color.Red, 0.5f); if (CalamityConfig.Instance.Afterimages) @@ -151,6 +159,11 @@ namespace CalamityMod.NPCs.CalClone return false; } + public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) + { + NPC.lifeMax = (int)(NPC.lifeMax * balance); + } + public override bool CheckActive() => false; public override void OnKill() @@ -190,7 +203,7 @@ namespace CalamityMod.NPCs.CalClone NPC.position.Y = NPC.position.Y - (float)(NPC.height / 2); for (int i = 0; i < 40; i++) { - int brimDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); + int brimDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); Main.dust[brimDust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -200,10 +213,10 @@ namespace CalamityMod.NPCs.CalClone } for (int j = 0; j < 70; j++) { - int brimDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 3f); + int brimDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 3f); Main.dust[brimDust2].noGravity = true; Main.dust[brimDust2].velocity *= 5f; - brimDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); + brimDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); Main.dust[brimDust2].velocity *= 2f; } } diff --git a/NPCs/CalClone/Catastrophe.cs b/NPCs/CalClone/Catastrophe.cs index eac8c67b49..c06986998d 100644 --- a/NPCs/CalClone/Catastrophe.cs +++ b/NPCs/CalClone/Catastrophe.cs @@ -1,35 +1,43 @@ -using CalamityMod.Buffs.DamageOverTime; +using System.IO; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Events; using CalamityMod.Items.Placeables.Furniture.Trophies; using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.NPCs.CalamityAIs.CalamityBossAIs; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; -using System.IO; namespace CalamityMod.NPCs.CalClone { [AutoloadBossHead] public class Catastrophe : ModNPC { + public static Asset GlowTexture; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 6; NPCID.Sets.TrailingMode[NPC.type] = 1; NPCID.Sets.BossBestiaryPriority.Add(Type); - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { PortraitScale = 0.8f, Scale = 0.5f }; value.Position.Y -= 10; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -66,11 +74,11 @@ namespace CalamityMod.NPCs.CalClone int associatedNPCType = ModContent.NPCType(); bestiaryEntry.UIInfoProvider = new CommonEnemyUICollectionInfoProvider(ContentSamples.NpcBestiaryCreditIdsByNpcNetIds[associatedNPCType], quickUnlock: true); - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Times.NightTime, BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Surface, - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Catastrophe") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Catastrophe") }); } @@ -96,7 +104,7 @@ namespace CalamityMod.NPCs.CalClone public override void AI() { - CalamityAI.CatastropheAI(NPC, Mod); + CalamitasCloneAI.VanillaCatastropheAI(NPC, Mod); } public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) @@ -129,7 +137,7 @@ namespace CalamityMod.NPCs.CalClone drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/CalClone/CatastropheGlow").Value; + texture2D15 = GlowTexture.Value; Color pinkLerp = Color.Lerp(Color.White, Color.Red, 0.5f); if (CalamityConfig.Instance.Afterimages) @@ -151,6 +159,11 @@ namespace CalamityMod.NPCs.CalClone return false; } + public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) + { + NPC.lifeMax = (int)(NPC.lifeMax * balance); + } + public override bool CheckActive() => false; public override void OnKill() @@ -190,7 +203,7 @@ namespace CalamityMod.NPCs.CalClone NPC.position.Y = NPC.position.Y - (float)(NPC.height / 2); for (int i = 0; i < 40; i++) { - int brimDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); + int brimDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); Main.dust[brimDust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -200,10 +213,10 @@ namespace CalamityMod.NPCs.CalClone } for (int j = 0; j < 70; j++) { - int brimDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 3f); + int brimDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 3f); Main.dust[brimDust2].noGravity = true; Main.dust[brimDust2].velocity *= 5f; - brimDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); + brimDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); Main.dust[brimDust2].velocity *= 2f; } } diff --git a/NPCs/CalClone/SoulSeeker.cs b/NPCs/CalClone/SoulSeeker.cs index bc1b2865d9..2731b95647 100644 --- a/NPCs/CalClone/SoulSeeker.cs +++ b/NPCs/CalClone/SoulSeeker.cs @@ -1,10 +1,11 @@ -using CalamityMod.Dusts; +using System; +using CalamityMod.Dusts; using CalamityMod.Events; using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.GameContent.Bestiary; @@ -17,12 +18,17 @@ namespace CalamityMod.NPCs.CalClone { private int timer = 0; private bool start = true; + public static Asset GlowTexture; public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 5; NPCID.Sets.TrailingMode[NPC.type] = 1; NPCID.Sets.BossBestiaryPriority.Add(Type); + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -33,7 +39,6 @@ namespace CalamityMod.NPCs.CalClone NPC.height = 40; NPC.noGravity = true; NPC.noTileCollide = true; - NPC.canGhostHeal = false; NPC.damage = 40; NPC.defense = 10; NPC.DR_NERD(0.1f); @@ -49,6 +54,10 @@ namespace CalamityMod.NPCs.CalClone NPC.Calamity().VulnerableToHeat = false; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToWater = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -56,7 +65,7 @@ namespace CalamityMod.NPCs.CalClone int associatedNPCType = ModContent.NPCType(); bestiaryEntry.UIInfoProvider = new CommonEnemyUICollectionInfoProvider(ContentSamples.NpcBestiaryCreditIdsByNpcNetIds[associatedNPCType], quickUnlock: true); - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Times.NightTime, BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Surface, @@ -101,9 +110,10 @@ namespace CalamityMod.NPCs.CalClone NPC.TargetClosest(); + float projectileSpeed = 9f; Vector2 velocity = Main.player[NPC.target].Center - NPC.Center; velocity.Normalize(); - velocity *= 9f; + velocity *= projectileSpeed; NPC.rotation = velocity.ToRotation() + MathHelper.Pi; timer++; @@ -116,7 +126,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); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, velocity, type, damage, 1f, NPC.target, 1f, 0f, projectileSpeed * 2f); } timer = 0; } @@ -209,7 +219,7 @@ namespace CalamityMod.NPCs.CalClone drawPos += origin * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture, drawPos, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, origin, NPC.scale, spriteEffects, 0f); - texture = ModContent.Request("CalamityMod/NPCs/CalClone/SoulSeekerGlow").Value; + texture = GlowTexture.Value; Color glow = Color.Lerp(Color.White, Color.Red, colorLerpAmt); if (CalamityConfig.Instance.Afterimages) diff --git a/NPCs/CalamityAI.cs b/NPCs/CalamityAI.cs deleted file mode 100644 index 0bada01b73..0000000000 --- a/NPCs/CalamityAI.cs +++ /dev/null @@ -1,8300 +0,0 @@ -using System; -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; -using CalamityMod.CalPlayer; -using CalamityMod.Dusts; -using CalamityMod.Events; -using CalamityMod.NPCs.Abyss; -using CalamityMod.NPCs.AquaticScourge; -using CalamityMod.NPCs.AstrumAureus; -using CalamityMod.NPCs.AstrumDeus; -using CalamityMod.NPCs.BrimstoneElemental; -using CalamityMod.NPCs.Bumblebirb; -using CalamityMod.NPCs.CalClone; -using CalamityMod.NPCs.CeaselessVoid; -using CalamityMod.NPCs.Crags; -using CalamityMod.NPCs.NormalNPCs; -using CalamityMod.NPCs.OldDuke; -using CalamityMod.NPCs.SulphurousSea; -using CalamityMod.NPCs.SunkenSea; -using CalamityMod.Projectiles.Boss; -using CalamityMod.Projectiles.Enemy; -using CalamityMod.Sounds; -using CalamityMod.World; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.NPCs -{ - public class CalamityAI - { - #region Aquatic Scourge - public static void AquaticScourgeAI(NPC npc, Mod mod, bool head) - { - CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - bool bossRush = BossRushEvent.BossRushActive; - bool expertMode = Main.expertMode || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool death = CalamityWorld.death || bossRush; - - bool getFuckedAI = Main.zenithWorld; - - if (head) - CalamityGlobalNPC.aquaticScourge = npc.whoAmI; - - // Adjust hostility and stats - bool nonHostile = calamityGlobalNPC.newAI[0] == 0f; - if (npc.justHit || npc.life <= npc.lifeMax * 0.999 || bossRush || Main.getGoodWorld) - { - if (nonHostile) - { - // Kiss my motherfucking ass you piece of shit game - npc.timeLeft *= 20; - npc.npcSlots = 16f; - CalamityMod.bossKillTimes.TryGetValue(npc.type, out int revKillTime); - calamityGlobalNPC.KillTime = revKillTime; - calamityGlobalNPC.newAI[0] = 1f; - nonHostile = false; - npc.boss = head; - npc.chaseable = true; - npc.netUpdate = true; - } - npc.damage = npc.defDamage; - } - else - npc.damage = 0; - - // Percent life remaining - float lifeRatio = npc.life / (float)npc.lifeMax; - - // Phases - bool phase2 = lifeRatio < 0.75f; - bool phase3 = lifeRatio < 0.5f; - bool phase4 = lifeRatio < 0.25f; - - // Set worm variable - if (npc.ai[2] > 0f) - npc.realLife = (int)npc.ai[2]; - - if (!head) - { - if (npc.life > Main.npc[(int)npc.ai[1]].life) - npc.life = Main.npc[(int)npc.ai[1]].life; - } - - // Get a target - 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 || - player.position.Y > Main.worldSurface * 16.0 || - (player.position.X > 7680f && player.position.X < (Main.maxTilesX * 16 - 7680)); - - // Check for the flipped Abyss - if (Main.remixWorld) - { - notOcean = player.position.Y < (Main.maxTilesY - 200) * 0.8f || player.position.Y > Main.maxTilesY - 200 || - (player.position.X > 7680f && player.position.X < (Main.maxTilesX * 16 - 7680)); - } - - // Enrage - if (head) - { - if (notOcean && !player.Calamity().ZoneSulphur && !bossRush) - { - if (npc.localAI[2] > 0f) - npc.localAI[2] -= 1f; - } - else - npc.localAI[2] = CalamityGlobalNPC.biomeEnrageTimerMax; - } - - bool biomeEnraged = npc.localAI[2] <= 0f || bossRush; - - float enrageScale = bossRush ? 1f : 0f; - if (biomeEnraged) - { - npc.Calamity().CurrentlyEnraged = !bossRush; - enrageScale += 2f; - } - - // Circular movement - float colorFadeTimeAfterSpiral = 90f; - float spiralGateValue = 480f; - bool doSpiral = false; - if (head && calamityGlobalNPC.newAI[0] == 1f && calamityGlobalNPC.newAI[2] == 1f && (revenge || getFuckedAI)) - { - doSpiral = calamityGlobalNPC.newAI[1] == 0f && calamityGlobalNPC.newAI[3] >= spiralGateValue; - if (Vector2.Distance(npc.Center, player.Center) < (getFuckedAI ? 1600f : 1000f) || doSpiral) - calamityGlobalNPC.newAI[3] += 1f; - - if (doSpiral) - { - npc.localAI[3] = colorFadeTimeAfterSpiral; - - // Vomit acid mist - float acidMistBarfDivisor = getFuckedAI ? 2f : ((float)Math.Floor(bossRush ? 4f : death ? 5f : 6f) * (phase3 ? 1.5f : 1f)); - if (calamityGlobalNPC.newAI[3] % acidMistBarfDivisor == 0f) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - float mistVelocity = death ? 10f : 8f; - Vector2 projectileVelocity = (npc.Center + npc.velocity * 10f - npc.Center).SafeNormalize(Vector2.UnitY); - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + projectileVelocity * 5f, projectileVelocity * mistVelocity, type, damage, 0f, Main.myPlayer); - Main.projectile[proj].tileCollide = false; - Main.projectile[proj].timeLeft = getFuckedAI ? 240 : 600; - } - } - - // Vomit circular spreads of acid clouds while in phase 3 - float toxicCloudBarfDivisor = bossRush ? 20f : death ? 30f : 40f; - if (calamityGlobalNPC.newAI[3] % toxicCloudBarfDivisor == 0f && phase3) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - int totalProjectiles = (phase4 ? 6 : 9) + (getFuckedAI ? Main.rand.Next(-2, 3) : (int)((calamityGlobalNPC.newAI[3] - spiralGateValue) / toxicCloudBarfDivisor) * (phase4 ? 2 : 3)); - float radians = MathHelper.TwoPi / totalProjectiles; - float cloudVelocity = 1f + enrageScale; - Vector2 spinningPoint = new Vector2(0f, -cloudVelocity); - for (int k = 0; k < totalProjectiles; k++) - { - Vector2 vector255 = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + vector255.SafeNormalize(Vector2.UnitY) * 5f, vector255, type, damage, 0f, Main.myPlayer); - } - } - } - - // Velocity boost - if (calamityGlobalNPC.newAI[3] == spiralGateValue) - { - npc.velocity = npc.velocity.SafeNormalize(Vector2.UnitY); - npc.velocity *= 24f; - } - - // Spin velocity - float velocity = (float)(Math.PI * 2D) / 120f; - // In GFB, contracts the radius as the fight progresses - if (getFuckedAI) - velocity *= phase3 ? 1.5f : phase2 ? 1.25f : 1f; - npc.velocity = npc.velocity.RotatedBy(-(double)velocity * npc.localAI[1]); - // Speed up even more in GFB for more radius - if (getFuckedAI && npc.velocity.Length() <= 32f) - npc.velocity *= 1.1f; - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) + MathHelper.PiOver2; - - // Reset and charge at target - // Don't reset in GFB - if (!getFuckedAI && calamityGlobalNPC.newAI[3] >= spiralGateValue + 120f) - { - calamityGlobalNPC.newAI[3] = 0f; - npc.TargetClosest(); - } - } - else - { - if (!Collision.CanHit(npc.Center, 1, 1, player.position, player.width, player.height) && calamityGlobalNPC.newAI[3] > 300f) - calamityGlobalNPC.newAI[3] -= 2f; - - if (npc.localAI[3] > 0f) - npc.localAI[3] -= 1f; - - npc.localAI[1] = npc.Center.X - player.Center.X < 0 ? 1f : -1f; - } - } - - // Adjust slowing debuff immunity - bool immuneToSlowingDebuffs = doSpiral || getFuckedAI; - npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - npc.buffImmune[BuffID.Slow] = immuneToSlowingDebuffs; - npc.buffImmune[BuffID.Webbed] = immuneToSlowingDebuffs; - - if (head) - { - // Spawn segments - if (calamityGlobalNPC.newAI[2] == 0f && npc.ai[0] == 0f) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int maxLength = getFuckedAI ? 24 : death ? 80 : revenge ? 40 : expertMode ? 35 : 30; - int Previous = npc.whoAmI; - for (int segments = 0; segments < maxLength; segments++) - { - int lol; - if (segments >= 0 && segments < maxLength - 1) - { - if (segments % 2 == 0) - lol = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), ModContent.NPCType(), npc.whoAmI); - else - lol = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), ModContent.NPCType(), npc.whoAmI); - } - else - lol = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), ModContent.NPCType(), npc.whoAmI); - - Main.npc[lol].realLife = npc.whoAmI; - Main.npc[lol].ai[2] = npc.whoAmI; - Main.npc[lol].ai[1] = Previous; - Main.npc[Previous].ai[0] = lol; - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, lol, 0f, 0f, 0f, 0); - Previous = lol; - } - } - calamityGlobalNPC.newAI[2] = 1f; - } - - // Big barf attack - if (calamityGlobalNPC.newAI[0] == 1f && (!doSpiral && phase2) || (getFuckedAI && !phase3)) - { - npc.localAI[0] += 1f; - if (npc.localAI[0] >= (revenge ? 360f : 420f)) - { - if (Vector2.Distance(player.Center, npc.Center) > 320f) - { - npc.localAI[0] = 0f; - npc.netUpdate = true; - SoundEngine.PlaySound(SoundID.NPCDeath13, npc.Center); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int totalProjectiles = bossRush ? 10 : expertMode ? 8 : 6; - if (phase3) - totalProjectiles *= 2; - - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - for (int i = 0; i < totalProjectiles; i++) - { - Vector2 velocity = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101)); - velocity = velocity.SafeNormalize(Vector2.UnitY); - velocity *= Main.rand.Next(phase3 ? 300 : 100, 401) * 0.01f; - - float maximumVelocityMult = death ? 0.75f : 0.5f; - if (expertMode) - velocity *= 1f + (maximumVelocityMult * (0.5f - lifeRatio)); - - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + velocity.SafeNormalize(Vector2.UnitY) * 5f, velocity, type, damage, 0f, Main.myPlayer); - } - } - } - } - } - } - - // Fire teeth depending on body type - else - { - if (calamityGlobalNPC.newAI[0] == 1f && (!phase3 || phase4)) - { - npc.localAI[0] += 1f; - float shootProjectile = 300; - float timer = npc.ai[0] + 15f; - float divisor = timer + shootProjectile; - - if (npc.type == ModContent.NPCType()) - { - if (npc.localAI[0] % divisor == 0f && (npc.ai[0] % 3f == 0f || getFuckedAI || !death)) - { - npc.TargetClosest(); - if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) - { - SoundEngine.PlaySound(SoundID.Item17, npc.Center); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - float toothVelocity = death ? 9f : 8f; - Vector2 projectileVelocity = (player.Center - npc.Center).SafeNormalize(Vector2.UnitY); - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - float accelerate = phase4 ? 1f : 0f; - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + projectileVelocity * 5f, projectileVelocity * toothVelocity, type, damage, 0f, Main.myPlayer, accelerate, 0f); - } - npc.netUpdate = true; - } - } - } - } - } - - // Kill body and tail - if (!head) - { - bool shouldDespawn = true; - for (int i = 0; i < Main.maxNPCs; i++) - { - if (Main.npc[i].active && Main.npc[i].type == ModContent.NPCType()) - { - shouldDespawn = false; - break; - } - } - if (!shouldDespawn) - { - if (npc.ai[1] <= 0f) - shouldDespawn = true; - else if (Main.npc[(int)npc.ai[1]].life <= 0) - shouldDespawn = true; - } - if (shouldDespawn) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - npc.active = false; - } - } - else - { - if (npc.life > Main.npc[(int)npc.ai[0]].life) - npc.life = Main.npc[(int)npc.ai[0]].life; - } - - float maxDistance = calamityGlobalNPC.newAI[0] == 1f ? 12800f : 6400f; - if (player.dead || Vector2.Distance(npc.Center, player.Center) > maxDistance || (nonHostile && biomeEnraged)) - { - calamityGlobalNPC.newAI[1] = 1f; - npc.TargetClosest(false); - npc.velocity.Y += 2f; - - if (npc.position.Y > Main.worldSurface * 16.0) - npc.velocity.Y += 2f; - - if (npc.position.Y > Main.worldSurface * 16.0) - { - for (int a = 0; a < Main.npc.Length; a++) - { - int type = Main.npc[a].type; - if (type == ModContent.NPCType() || type == ModContent.NPCType() || - type == ModContent.NPCType() || type == ModContent.NPCType()) - { - Main.npc[a].active = false; - } - } - } - } - else - calamityGlobalNPC.newAI[1] = 0f; - - // Change direction - if (npc.velocity.X < 0f) - npc.spriteDirection = -1; - else if (npc.velocity.X > 0f) - npc.spriteDirection = 1; - - // Alpha changes - if (head || Main.npc[(int)npc.ai[1]].alpha < 128) - { - npc.alpha -= 42; - if (npc.alpha < 0) - npc.alpha = 0; - } - - // Velocity and movement - float scourgeMaxSpeed = 5f; - float scourgeAcceleration = 0.08f; - Vector2 scourgePosition = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - Vector2 predictionVector = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? Main.player[npc.target].velocity * 20f : Vector2.Zero; - float scourgeTargetX = player.position.X + (player.width / 2) + predictionVector.X; - float scourgeTargetY = player.position.Y + (player.height / 2) + predictionVector.Y; - - if (head && !doSpiral) - { - if (calamityGlobalNPC.newAI[0] != 1f) - { - scourgeTargetY += 400; - if (Math.Abs(npc.Center.X - player.Center.X) < 500f) - { - if (npc.velocity.X > 0f) - scourgeTargetX = player.Center.X + 600f; - else - scourgeTargetX = player.Center.X - 600f; - } - } - - if (calamityGlobalNPC.newAI[0] == 1f) - { - scourgeMaxSpeed = revenge ? 14.4f : 12f; - scourgeAcceleration = revenge ? 0.18f : 0.15f; - if (expertMode) - { - scourgeMaxSpeed += 2.4f * (1f - lifeRatio); - scourgeAcceleration += 0.03f * (1f - lifeRatio); - } - scourgeMaxSpeed += 3f * enrageScale; - scourgeAcceleration += 0.06f * enrageScale; - if (death || getFuckedAI) - { - scourgeMaxSpeed += 5f; - scourgeAcceleration -= getFuckedAI ? 0f : 0.03f; - scourgeMaxSpeed += Vector2.Distance(player.Center, npc.Center) * 0.001f; - scourgeAcceleration += Vector2.Distance(player.Center, npc.Center) * 0.000045f; - } - - // Increase acceleration after spiral attack - if (npc.localAI[3] > 0f) - { - float accelerationMultiplier = MathHelper.Lerp(1f, 2f, npc.localAI[3] / colorFadeTimeAfterSpiral); - scourgeAcceleration *= accelerationMultiplier; - } - - if (Main.getGoodWorld) - { - scourgeMaxSpeed *= 1.15f; - scourgeAcceleration *= 1.15f; - } - } - - float scourgeHigherSpeed = scourgeMaxSpeed * 1.3f; - float scourgeLowerSpeed = scourgeMaxSpeed * 0.7f; - float scourgeSpeed = npc.velocity.Length(); - if (scourgeSpeed > 0f) - { - if (scourgeSpeed > scourgeHigherSpeed) - { - npc.velocity = npc.velocity.SafeNormalize(Vector2.UnitY); - npc.velocity *= scourgeHigherSpeed; - } - else if (scourgeSpeed < scourgeLowerSpeed) - { - npc.velocity = npc.velocity.SafeNormalize(Vector2.UnitY); - npc.velocity *= scourgeLowerSpeed; - } - } - } - - scourgeTargetX = (int)(scourgeTargetX / 16f) * 16; - scourgeTargetY = (int)(scourgeTargetY / 16f) * 16; - scourgePosition.X = (int)(scourgePosition.X / 16f) * 16; - scourgePosition.Y = (int)(scourgePosition.Y / 16f) * 16; - scourgeTargetX -= scourgePosition.X; - scourgeTargetY -= scourgePosition.Y; - float scourgeTargetDist = (float)Math.Sqrt(scourgeTargetX * scourgeTargetX + scourgeTargetY * scourgeTargetY); - - if (!head) - { - if (npc.ai[1] > 0f && npc.ai[1] < Main.npc.Length) - { - try - { - scourgePosition = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - scourgeTargetX = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - scourgePosition.X; - scourgeTargetY = Main.npc[(int)npc.ai[1]].position.Y + (Main.npc[(int)npc.ai[1]].height / 2) - scourgePosition.Y; - } - catch - { - } - npc.rotation = (float)Math.Atan2(scourgeTargetY, scourgeTargetX) + MathHelper.PiOver2; - scourgeTargetDist = (float)Math.Sqrt(scourgeTargetX * scourgeTargetX + scourgeTargetY * scourgeTargetY); - int scourgeWidth = npc.width; - scourgeTargetDist = (scourgeTargetDist - scourgeWidth) / scourgeTargetDist; - scourgeTargetX *= scourgeTargetDist; - scourgeTargetY *= scourgeTargetDist; - npc.velocity = Vector2.Zero; - npc.position.X = npc.position.X + scourgeTargetX; - npc.position.Y = npc.position.Y + scourgeTargetY; - if (scourgeTargetX < 0f) - { - npc.spriteDirection = -1; - } - else if (scourgeTargetX > 0f) - { - npc.spriteDirection = 1; - } - } - } - else if (!doSpiral) - { - float scourgeAbsoluteTargetX = Math.Abs(scourgeTargetX); - float scourgeAbsoluteTargetY = Math.Abs(scourgeTargetY); - float scourgeTimeToReachTarget = scourgeMaxSpeed / scourgeTargetDist; - scourgeTargetX *= scourgeTimeToReachTarget; - scourgeTargetY *= scourgeTimeToReachTarget; - - if ((npc.velocity.X > 0f && scourgeTargetX > 0f) || (npc.velocity.X < 0f && scourgeTargetX < 0f) || (npc.velocity.Y > 0f && scourgeTargetY > 0f) || (npc.velocity.Y < 0f && scourgeTargetY < 0f)) - { - if (npc.velocity.X < scourgeTargetX) - { - npc.velocity.X += scourgeAcceleration; - } - else - { - if (npc.velocity.X > scourgeTargetX) - npc.velocity.X -= scourgeAcceleration; - } - if (npc.velocity.Y < scourgeTargetY) - { - npc.velocity.Y += scourgeAcceleration; - } - else - { - if (npc.velocity.Y > scourgeTargetY) - npc.velocity.Y -= scourgeAcceleration; - } - if (Math.Abs(scourgeTargetY) < scourgeMaxSpeed * 0.2 && ((npc.velocity.X > 0f && scourgeTargetX < 0f) || (npc.velocity.X < 0f && scourgeTargetX > 0f))) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y += scourgeAcceleration * 2f; - else - npc.velocity.Y -= scourgeAcceleration * 2f; - } - if (Math.Abs(scourgeTargetX) < scourgeMaxSpeed * 0.2 && ((npc.velocity.Y > 0f && scourgeTargetY < 0f) || (npc.velocity.Y < 0f && scourgeTargetY > 0f))) - { - if (npc.velocity.X > 0f) - npc.velocity.X += scourgeAcceleration * 2f; - else - npc.velocity.X -= scourgeAcceleration * 2f; - } - } - else - { - if (scourgeAbsoluteTargetX > scourgeAbsoluteTargetY) - { - if (npc.velocity.X < scourgeTargetX) - npc.velocity.X += scourgeAcceleration * 1.1f; - else if (npc.velocity.X > scourgeTargetX) - npc.velocity.X -= scourgeAcceleration * 1.1f; - - if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < scourgeMaxSpeed * 0.5) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y += scourgeAcceleration; - else - npc.velocity.Y -= scourgeAcceleration; - } - } - else - { - if (npc.velocity.Y < scourgeTargetY) - npc.velocity.Y += scourgeAcceleration * 1.1f; - else if (npc.velocity.Y > scourgeTargetY) - npc.velocity.Y -= scourgeAcceleration * 1.1f; - - if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < scourgeMaxSpeed * 0.5) - { - if (npc.velocity.X > 0f) - npc.velocity.X += scourgeAcceleration; - else - npc.velocity.X -= scourgeAcceleration; - } - } - } - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) + MathHelper.PiOver2; - } - } - #endregion - - #region Brimstone Elemental - public static void BrimstoneElementalAI(NPC npc, Mod mod) - { - CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - BrimstoneElemental.BrimstoneElemental brimmy = npc.ModNPC(); - - // Used for Brimling AI states - CalamityGlobalNPC.brimstoneElemental = npc.whoAmI; - - // Emit light - Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 1.2f, 0f, 0f); - - // Set damage - npc.damage = npc.defDamage; - - // Get a target - 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; - - if (!player.active || player.dead || despawnDistance) - { - npc.TargetClosest(false); - player = Main.player[npc.target]; - if (!player.active || player.dead || despawnDistance) - { - npc.rotation = npc.velocity.X * 0.04f; - - if (npc.velocity.Y > 3f) - npc.velocity.Y = 3f; - npc.velocity.Y -= 0.1f; - if (npc.velocity.Y < -12f) - npc.velocity.Y = -12f; - - if (npc.timeLeft > 60) - npc.timeLeft = 60; - - if (npc.ai[0] != 0f) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.localAI[0] = 0f; - npc.localAI[1] = 0f; - npc.netUpdate = true; - } - return; - } - } - else if (npc.timeLeft < 1800) - npc.timeLeft = 1800; - - CalamityPlayer modPlayer = player.Calamity(); - - // Reset defense - npc.defense = npc.defDefense; - calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = npc.ai[0] == 4f; - - // Percent life remaining - float lifeRatio = npc.life / (float)npc.lifeMax; - - // Variables for buffing the AI - bool bossRush = BossRushEvent.BossRushActive; - bool expertMode = Main.expertMode || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool death = CalamityWorld.death || bossRush; - - bool phase2 = lifeRatio < 0.5f && revenge; - bool phase3 = lifeRatio < 0.33f; - - // Enrage - if ((!player.ZoneUnderworldHeight || !modPlayer.ZoneCalamity) && !bossRush) - { - if (calamityGlobalNPC.newAI[3] > 0f) - calamityGlobalNPC.newAI[3] -= 1f; - } - else - calamityGlobalNPC.newAI[3] = CalamityGlobalNPC.biomeEnrageTimerMax; - - bool biomeEnraged = calamityGlobalNPC.newAI[3] <= 0f || bossRush; - - float enrageScale = bossRush ? 1f : 0f; - if (biomeEnraged && (!player.ZoneUnderworldHeight || bossRush)) - { - npc.Calamity().CurrentlyEnraged = !bossRush; - enrageScale += 1f; - } - if (biomeEnraged && (!modPlayer.ZoneCalamity || bossRush)) - { - npc.Calamity().CurrentlyEnraged = !bossRush; - enrageScale += 1f; - } - - npc.Calamity().DR = npc.ai[0] == 4f ? 0.6f : 0.15f; - - // Emit dust - int dustAmt = (npc.ai[0] == 2f) ? 2 : 1; - int size = (npc.ai[0] == 2f) ? 50 : 35; - if (npc.ai[0] != 1f) - { - for (int i = 0; i < 2; i++) - { - if (Main.rand.Next(3) < dustAmt) - { - int dust = Dust.NewDust(npc.Center - new Vector2(size), size * 2, size * 2, 235, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f, 90, default, 1.5f); - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity *= 0.2f; - Main.dust[dust].fadeIn = 1f; - } - } - } - - // Distance from destination where Brimmy stops moving - float movementDistanceGateValue = 100f; - - // How fast Brimmy moves to the destination - float baseVelocity = (death ? 6f : revenge ? 5.5f : expertMode ? 5f : 4.5f) * (npc.ai[0] == 5f ? 0.05f : npc.ai[0] == 3f ? 1.5f : 1f); - baseVelocity += 3f * enrageScale; - if (expertMode) - baseVelocity += death ? 3f * (1f - lifeRatio) : 2f * (1f - lifeRatio); - - float baseAcceleration = (death ? 0.12f : 0.1f) * (npc.ai[0] == 5f ? 0.5f : npc.ai[0] == 3f ? 1.5f : 1f); - baseAcceleration += 0.06f * enrageScale; - if (expertMode) - baseAcceleration += 0.03f * (1f - lifeRatio); - - // This is where Brimmy should be - Vector2 destination = npc.ai[0] != 3f ? player.Center : new Vector2(player.Center.X, player.Center.Y - 300f); - - // How far Brimmy is from where she's supposed to be - Vector2 distanceFromDestination = destination - npc.Center; - - // Movement - if (npc.ai[0] != 4f) - CalamityUtils.SmoothMovement(npc, movementDistanceGateValue, distanceFromDestination, baseVelocity, baseAcceleration, true); - - // Rotation and direction - if (npc.ai[0] <= 2f || npc.ai[0] == 5f) - { - npc.rotation = npc.velocity.X * 0.04f; - if (npc.ai[0] != 5 || (npc.ai[1] < 180f && npc.ai[0] == 5f)) - { - float playerLocation = npc.Center.X - player.Center.X; - npc.direction = playerLocation < 0f ? 1 : -1; - npc.spriteDirection = npc.direction; - } - } - - if (Main.zenithWorld) // in gfb, Brimmy channels the power of the other elementals. - { - int newMode; - if (lifeRatio <= 0.8f && lifeRatio > 0.6f) - { - newMode = 1; // Sand - } - else if (lifeRatio <= 0.6f && lifeRatio > 0.4f) - { - newMode = 2; // Rare Sand - } - else if (lifeRatio <= 0.4f && lifeRatio > 0.2f) - { - newMode = 3; // Cloud - } - else if (lifeRatio <= 0.2f) - { - newMode = 4; // Water - } - else - { - newMode = 0; // Brimstone, default - } - if (newMode != brimmy.currentMode) - { - SoundEngine.PlaySound(SoundID.Item29, npc.Center); - } - brimmy.currentMode = newMode; - } - - if (npc.ai[0] == -1f) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int phase; - int random = phase2 ? 6 : 5; - do phase = Main.rand.Next(random); - while (phase == npc.ai[1] || (phase == 0 && phase3 && revenge) || phase == 1 || phase == 2 || (phase == 4 && npc.localAI[3] != 0f)); - - npc.ai[0] = phase; - npc.ai[1] = 0f; - - // Cocoon phase cooldown - if (npc.localAI[3] > 0f) - npc.localAI[3] -= 1f; - else if (phase == 4) - npc.localAI[3] = 3f; - - npc.netUpdate = true; - - // Prevent netUpdate from being blocked by the spam counter. - // A phase switch sync is a critical operation that must be synced. - if (npc.netSpam >= 10) - npc.netSpam = 9; - } - } - - // Pick a location to teleport to - else if (npc.ai[0] == 0f) - { - npc.chaseable = true; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[1] += 1f; - if (npc.localAI[1] >= (bossRush ? 5f : death ? 30f : 180f)) - { - npc.TargetClosest(); - npc.localAI[1] = 0f; - int timer = 0; - int playerPosX; - int playerPosY; - while (true) - { - timer++; - playerPosX = (int)player.Center.X / 16; - playerPosY = (int)player.Center.Y / 16; - - int min = 12; - int max = 16; - - if (Main.rand.NextBool()) - playerPosX += Main.rand.Next(min, max); - else - playerPosX -= Main.rand.Next(min, max); - - if (Main.rand.NextBool()) - playerPosY += Main.rand.Next(min, max); - else - playerPosY -= Main.rand.Next(min, max); - - if (!WorldGen.SolidTile(playerPosX, playerPosY)) - break; - - if (timer > 100) - return; - } - npc.ai[0] = 1f; - npc.ai[1] = playerPosX; - npc.ai[2] = playerPosY; - npc.netUpdate = true; - } - } - } - - // Teleport to location - else if (npc.ai[0] == 1f) - { - // Avoid cheap bullshit - npc.damage = 0; - - npc.chaseable = true; - Vector2 position = new Vector2(npc.ai[1] * 16f - (npc.width / 2), npc.ai[2] * 16f - (npc.height / 2)); - for (int m = 0; m < 5; m++) - { - int dust = Dust.NewDust(position, npc.width, npc.height, 235, 0f, -1f, 90, default, 2f); - Main.dust[dust].noGravity = true; - Main.dust[dust].fadeIn = 1f; - } - npc.alpha += bossRush ? 4 : death ? 3 : 2; - if (npc.alpha >= 255) - { - int spawnType = brimmy.currentMode == 3 ? NPCID.AngryNimbus : ModContent.NPCType(); - int enemyCount = brimmy.currentMode == 3 ? 3 : 1; // 3 angry nimbi if cloud, otherwise 1 brimling - if (Main.netMode != NetmodeID.MultiplayerClient && NPC.CountNPCS(spawnType) < (death ? 1 : 2) && revenge && brimmy.currentMode != 2) // dont spawn anything if gfb rare sand - { - for (int i = 0; i < enemyCount; i++) - NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, spawnType); - } - SoundEngine.PlaySound(SoundID.Item8, npc.Center); - npc.alpha = 255; - npc.position = position; - for (int n = 0; n < 15; n++) - { - int warpDust = Dust.NewDust(npc.position, npc.width, npc.height, 235, 0f, -1f, 90, default, 3f); - Main.dust[warpDust].noGravity = true; - } - npc.ai[0] = 2f; - npc.netUpdate = true; - } - } - - // Either teleport again or go to next AI state - else if (npc.ai[0] == 2f) - { - // Avoid cheap bullshit - npc.damage = 0; - - if (npc.alpha >= 255) - { - if (Main.zenithWorld) - { - SoundEngine.PlaySound(SoundID.Item68, npc.Center); - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - Vector2 pos = npc.Center; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Projectile.NewProjectile(npc.GetSource_FromAI(), pos, new Vector2(0, 1), type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); - Projectile.NewProjectile(npc.GetSource_FromAI(), pos, new Vector2(0, -1), type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); - Projectile.NewProjectile(npc.GetSource_FromAI(), pos, new Vector2(1, 0), type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); - Projectile.NewProjectile(npc.GetSource_FromAI(), pos, new Vector2(-1, 0), type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); - } - if (brimmy.currentMode >= 1 && brimmy.currentMode <= 3) - { - int tornadoType = brimmy.currentMode == 3 ? ModContent.ProjectileType() : ProjectileID.SandnadoHostileMark; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Projectile.NewProjectile(npc.GetSource_FromAI(), pos, Vector2.Zero, tornadoType, damage, 0f, Main.myPlayer, 0f, 0f); - } - } - if (brimmy.currentMode == 2) - { - int healAmt = npc.lifeMax / 25; - if (healAmt > 0) - { - npc.life += healAmt; - npc.HealEffect(healAmt, true); - npc.netUpdate = true; - } - } - } - } - - npc.alpha -= 50; - if (npc.alpha <= 0) - { - npc.chaseable = true; - npc.ai[3] += 1f; - npc.alpha = 0; - if (npc.ai[3] >= 2f || phase2 || Main.getGoodWorld) - { - npc.ai[0] = -1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - } - else - { - npc.ai[0] = 0f; - } - npc.netUpdate = true; - } - } - - // Float above target and fire projectiles - else if (npc.ai[0] == 3f) - { - npc.chaseable = true; - npc.rotation = npc.velocity.X * 0.04f; - - float playerLocation = npc.Center.X - player.Center.X; - npc.direction = playerLocation < 0f ? 1 : -1; - npc.spriteDirection = npc.direction; - - npc.ai[1] += 1f; - float divisor = expertMode ? (death ? 80f : revenge ? 45f : 50f) - (float)Math.Ceiling(10f * (1f - lifeRatio)) : 50f; - divisor -= 3f * enrageScale; - float divisor2 = divisor * 2f; - - if (npc.ai[1] % divisor == divisor - 1f) - { - float velocity = (death ? 7f : revenge ? 6f : 5f) + (2f * enrageScale) + (expertMode ? 3f * (1f - lifeRatio) : 0f); - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - if (brimmy.currentMode == 4) - { - type = ModContent.ProjectileType(); - SoundEngine.PlaySound(SoundID.Item30, player.Center); - } - Vector2 projectileVelocity = (player.Center - npc.Center).SafeNormalize(Vector2.UnitY) * velocity; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + projectileVelocity.SafeNormalize(Vector2.UnitY) * 5f, projectileVelocity, type, damage, 0f, Main.myPlayer, player.position.X, player.position.Y); - Main.projectile[proj].timeLeft = 240; - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) - Main.projectile[proj].extraUpdates += 1; - } - - if (npc.ai[1] % divisor2 == divisor2 - 1f) - { - velocity = (death ? 5f : 4f) + 2f * enrageScale; - type = ModContent.ProjectileType(); - damage = npc.GetProjectileDamage(type); - if (brimmy.currentMode == 4) - { - type = ModContent.ProjectileType(); - SoundEngine.PlaySound(SoundID.Item21, player.Center); - } - projectileVelocity = (player.Center - npc.Center).SafeNormalize(Vector2.UnitY) * velocity; - int numProj = death ? 8 : 4; - int spread = death ? 90 : 45; - if (Main.getGoodWorld) - { - numProj *= 3; - spread *= 2; - } - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - float rotation = MathHelper.ToRadians(spread); - for (int i = 0; i < numProj; i++) - { - Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); - int proj2 = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 5f, perturbedSpeed, type, damage, 0f, Main.myPlayer, 1f, 0f); - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) - Main.projectile[proj2].extraUpdates += 1; - } - } - } - } - - if (npc.ai[1] >= divisor * (death ? 5f : 10f)) - { - npc.TargetClosest(); - npc.ai[0] = -1f; - npc.ai[1] = 3f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; - } - } - - // Cocoon bullet hell - else if (npc.ai[0] == 4f) - { - npc.defense = npc.defDefense * 4; - - npc.chaseable = false; - npc.localAI[0] += 1f; - if (Main.getGoodWorld) - npc.localAI[0] += 2f; - if (expertMode) - npc.localAI[0] += 1f - lifeRatio; - npc.localAI[0] += enrageScale; - - if (npc.localAI[0] >= 120f) - { - npc.localAI[0] = 0f; - - float projectileSpeed = death ? 9f : revenge ? 8f : 6f; - projectileSpeed += 2f * enrageScale; - - Vector2 projectileVelocity = player.Center - npc.Center; - - float radialOffset = 0.2f; - float diameter = 80f; - - projectileVelocity = projectileVelocity.SafeNormalize(Vector2.UnitY) * projectileSpeed; - - Vector2 velocity = projectileVelocity; - velocity = velocity.SafeNormalize(Vector2.UnitY); - velocity *= diameter; - - int totalProjectiles = 6; - float offsetAngle = (float)Math.PI * radialOffset; - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - for (int j = 0; j < totalProjectiles; j++) - { - float radians = j - (totalProjectiles - 1f) / 2f; - Vector2 offset = velocity.RotatedBy(offsetAngle * radians); - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + offset, projectileVelocity, type, damage, 0f, Main.myPlayer, 1f, 0f); - Main.projectile[proj].timeLeft = 300; - Main.projectile[proj].tileCollide = false; - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) - Main.projectile[proj].extraUpdates += 1; - } - } - - totalProjectiles = 12; - float radians2 = MathHelper.TwoPi / totalProjectiles; - type = ModContent.ProjectileType(); - damage = npc.GetProjectileDamage(type); - if (brimmy.currentMode == 4) - { - type = ModContent.ProjectileType(); - SoundEngine.PlaySound(SoundID.Item26, player.Center); - } - double angleA = radians2 * 0.5; - double angleB = MathHelper.ToRadians(90f) - angleA; - float velocityX = (float)(projectileSpeed * Math.Sin(angleA) / Math.Sin(angleB)); - Vector2 spinningPoint = npc.localAI[2] % 2f == 0f ? new Vector2(0f, -projectileSpeed) : new Vector2(-velocityX, -projectileSpeed); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - for (int k = 0; k < totalProjectiles; k++) - { - Vector2 vector255 = spinningPoint.RotatedBy(radians2 * k); - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + vector255.SafeNormalize(Vector2.UnitY) * 5f, vector255, type, damage, 0f, Main.myPlayer, 1f, 0f); - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) - Main.projectile[proj].extraUpdates += 1; - } - - if (death) - { - spinningPoint = npc.localAI[2] % 2f == 0f ? new Vector2(-velocityX, -projectileSpeed) : new Vector2(0f, -projectileSpeed); - for (int k = 0; k < totalProjectiles; k++) - { - Vector2 vector255 = spinningPoint.RotatedBy(radians2 * k); - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + vector255.SafeNormalize(Vector2.UnitY) * 5f, vector255 * 0.75f, type, damage, 0f, Main.myPlayer, 1f, 0f); - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) - Main.projectile[proj].extraUpdates += 1; - } - } - } - - npc.localAI[2] += 1f; - } - - npc.velocity *= 0.95f; - npc.rotation = npc.velocity.X * 0.04f; - float playerLocation = npc.Center.X - player.Center.X; - npc.direction = playerLocation < 0f ? 1 : -1; - npc.spriteDirection = npc.direction; - - npc.ai[1] += 1f; - if (npc.ai[1] >= (death ? 240f : 300f)) - { - npc.TargetClosest(); - npc.ai[0] = -1f; - npc.ai[1] = 4f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.localAI[0] = 0f; - npc.netUpdate = true; - } - } - - // Laser beam attack - else if (npc.ai[0] == 5f) - { - npc.chaseable = true; - - npc.defense = npc.defDefense * 2; - - Vector2 source = new Vector2(npc.Center.X + (npc.spriteDirection > 0 ? 34f : -34f), npc.Center.Y - 74f); - Vector2 aimAt = player.Center + player.velocity * 20f; - float aimResponsiveness = bossRush ? 0.05f : (npc.ai[2] == 1f || death) ? 0.1f : 0.25f; - - Vector2 aimVector = (aimAt - source).SafeNormalize(Vector2.UnitY); - if (aimVector.HasNaNs()) - aimVector = -Vector2.UnitY; - aimVector = (Vector2.Lerp(aimVector, npc.velocity.SafeNormalize(Vector2.UnitY), aimResponsiveness)).SafeNormalize(Vector2.UnitY); - aimVector *= 6f; - - Vector2 laserVelocity = aimVector.SafeNormalize(Vector2.UnitY); - if (laserVelocity.HasNaNs()) - laserVelocity = -Vector2.UnitY; - - calamityGlobalNPC.newAI[1] = laserVelocity.X; - calamityGlobalNPC.newAI[2] = laserVelocity.Y; - - // Rev = 190 + 165 = 355 - // Death = 165 - - npc.ai[1] += 1f; - if (npc.ai[1] >= 240f) - { - npc.TargetClosest(); - npc.ai[2] += 1f; - npc.localAI[0] = 0f; - npc.localAI[1] = 0f; - if (npc.ai[2] >= (death ? 1f : 2f)) - { - npc.ai[0] = -1f; - npc.ai[1] = 5f; - npc.ai[2] = 0f; - calamityGlobalNPC.newAI[0] = 0f; - } - else - { - npc.ai[1] = 0f; - calamityGlobalNPC.newAI[0] = 0f; - } - } - else if (npc.ai[1] >= 180f) - { - npc.velocity *= 0.95f; - if (npc.ai[1] == 180f) - { - SoundEngine.PlaySound(SoundID.Item68, source); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Vector2 laserVelocity2 = new Vector2(npc.localAI[0], npc.localAI[1]); - laserVelocity2 = laserVelocity2.SafeNormalize(Vector2.UnitY); - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - - Projectile.NewProjectile(npc.GetSource_FromAI(), source, laserVelocity2, type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); - if (Main.getGoodWorld) - Projectile.NewProjectile(npc.GetSource_FromAI(), source, -laserVelocity2, type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); - - if (Main.zenithWorld) - { - Projectile.NewProjectile(npc.GetSource_FromAI(), source, new Vector2(-laserVelocity2.X, laserVelocity2.Y), type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); - Projectile.NewProjectile(npc.GetSource_FromAI(), source, new Vector2(laserVelocity2.X, -laserVelocity2.Y), type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); - } - } - } - } - else - { - float playSoundTimer = 30f; - if (npc.ai[1] < 150f) - { - switch ((int)npc.ai[2]) - { - case 0: - npc.ai[1] += 0.5f; - break; - case 1: - npc.ai[1] += 1f; - playSoundTimer = 40f; - break; - } - if (death) - { - npc.ai[1] += 0.5f; - playSoundTimer += 10f; - } - } - - if (npc.ai[1] % playSoundTimer == 0f) - SoundEngine.PlaySound(SoundID.Item20, npc.Center); - - if (npc.ai[1] < 150f && calamityGlobalNPC.newAI[0] == 0f) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Projectile.NewProjectile(npc.GetSource_FromAI(), source, laserVelocity, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 0f, npc.whoAmI); - if (Main.getGoodWorld) - Projectile.NewProjectile(npc.GetSource_FromAI(), source, -laserVelocity, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 0f, npc.whoAmI); - - if (Main.zenithWorld) - { - Projectile.NewProjectile(npc.GetSource_FromAI(), source, new Vector2(-laserVelocity.X, laserVelocity.Y), ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 0f, npc.whoAmI); - Projectile.NewProjectile(npc.GetSource_FromAI(), source, new Vector2(laserVelocity.X, -laserVelocity.Y), ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 0f, npc.whoAmI); - } - } - - calamityGlobalNPC.newAI[0] = 1f; - } - else - { - if (npc.ai[1] == 150f) - { - npc.localAI[0] = laserVelocity.X; - npc.localAI[1] = laserVelocity.Y; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Projectile.NewProjectile(npc.GetSource_FromAI(), source.X, source.Y, npc.localAI[0], npc.localAI[1], ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 1f, npc.whoAmI); - if (Main.getGoodWorld) - Projectile.NewProjectile(npc.GetSource_FromAI(), source.X, source.Y, -npc.localAI[0], -npc.localAI[1], ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 1f, npc.whoAmI); - - if (Main.zenithWorld) - { - Projectile.NewProjectile(npc.GetSource_FromAI(), source.X, source.Y, -npc.localAI[0], npc.localAI[1], ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 1f, npc.whoAmI); - Projectile.NewProjectile(npc.GetSource_FromAI(), source.X, source.Y, npc.localAI[0], -npc.localAI[1], ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 1f, npc.whoAmI); - } - } - } - } - } - } - } - #endregion - - #region Calamitas Clone - public static void CalamitasCloneAI(NPC npc, Mod mod) - { - CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - - // Emit light - Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 1f, 0f, 0f); - - // Variables for increasing difficulty - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool expertMode = Main.expertMode || bossRush; - - // Percent life remaining - float lifeRatio = npc.life / (float)npc.lifeMax; - - // Phases - bool phase2 = lifeRatio < 0.7f || death; - bool phase3 = lifeRatio < 0.35f; - bool phase4 = lifeRatio <= 0.1f && death; - - // Don't take damage during bullet hells - npc.dontTakeDamage = calamityGlobalNPC.newAI[2] > 0f; - - // Variable for live brothers - bool brotherAlive = false; - - // For seekers - CalamityGlobalNPC.calamitas = npc.whoAmI; - - // Seeker ring - if (calamityGlobalNPC.newAI[1] == 0f && phase3 && expertMode) - { - SoundEngine.PlaySound(SoundID.Item72, npc.Center); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int seekerAmt = death ? 10 : 5; - int seekerSpread = 360 / seekerAmt; - int seekerDistance = death ? 180 : 150; - for (int i = 0; i < seekerAmt; i++) - { - int spawn = NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(i * seekerSpread) * seekerDistance)), (int)(npc.Center.Y + (Math.Cos(i * seekerSpread) * seekerDistance)), ModContent.NPCType(), npc.whoAmI, 0, 0, 0, -1); - Main.npc[spawn].ai[0] = i * seekerSpread; - } - } - - string key = "Mods.CalamityMod.Status.Boss.CalamitasBossText3"; - Color messageColor = Color.Orange; - CalamityUtils.DisplayLocalizedText(key, messageColor); - - calamityGlobalNPC.newAI[1] = 1f; - } - - // Do bullet hell or spawn brothers - if (calamityGlobalNPC.newAI[0] == 0f && npc.life > 0) - calamityGlobalNPC.newAI[0] = npc.lifeMax; - - // Bullet hells at 70% and 10%, brothers at 40% - if (npc.life > 0) - { - int calClonePhaseThreshold = (int)(npc.lifeMax * 0.3); - if ((npc.life + calClonePhaseThreshold) < calamityGlobalNPC.newAI[0]) - { - calamityGlobalNPC.newAI[0] = npc.life; - if (calamityGlobalNPC.newAI[0] <= npc.lifeMax * 0.1) - { - SoundEngine.PlaySound(SoundID.Item109, npc.Center); - calamityGlobalNPC.newAI[2] = 2f; - - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) - calamityGlobalNPC.newAI[3] = 0f; - - SpawnDust(); - } - else if (calamityGlobalNPC.newAI[0] <= npc.lifeMax * 0.4) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.position.Y + npc.height, ModContent.NPCType(), npc.whoAmI); - NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.position.Y + npc.height, ModContent.NPCType(), npc.whoAmI); - } - - string key = "Mods.CalamityMod.Status.Boss.CalamitasBossText2"; - Color messageColor = Color.Orange; - CalamityUtils.DisplayLocalizedText(key, messageColor); - - SpawnDust(); - } - else - { - SoundEngine.PlaySound(SoundID.Item109, npc.Center); - calamityGlobalNPC.newAI[2] = 1f; - - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) - calamityGlobalNPC.newAI[3] = 0f; - - SpawnDust(); - } - } - } - - // Immunity if brothers are alive - if (CalamityGlobalNPC.cataclysm != -1) - { - if (Main.npc[CalamityGlobalNPC.cataclysm].active) - brotherAlive = true; - } - if (CalamityGlobalNPC.catastrophe != -1) - { - if (Main.npc[CalamityGlobalNPC.catastrophe].active) - brotherAlive = true; - } - - if (brotherAlive) - npc.dontTakeDamage = true; - - void SpawnDust() - { - int dustAmt = 50; - int random = 3; - - for (int j = 0; j < 10; j++) - { - random += j; - int dustAmtSpawned = 0; - int scale = random * 6; - float dustPositionX = npc.Center.X - (scale / 2); - float dustPositionY = npc.Center.Y - (scale / 2); - while (dustAmtSpawned < dustAmt) - { - float dustVelocityX = Main.rand.Next(-random, random); - float dustVelocityY = Main.rand.Next(-random, random); - float dustVelocityScalar = random * 2f; - float dustVelocity = (float)Math.Sqrt(dustVelocityX * dustVelocityX + dustVelocityY * dustVelocityY); - dustVelocity = dustVelocityScalar / dustVelocity; - dustVelocityX *= dustVelocity; - dustVelocityY *= dustVelocity; - int dust = Dust.NewDust(new Vector2(dustPositionX, dustPositionY), scale, scale, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); - Main.dust[dust].noGravity = true; - Main.dust[dust].position.X = npc.Center.X; - Main.dust[dust].position.Y = npc.Center.Y; - Main.dust[dust].position.X += Main.rand.Next(-10, 11); - Main.dust[dust].position.Y += Main.rand.Next(-10, 11); - Main.dust[dust].velocity.X = dustVelocityX; - Main.dust[dust].velocity.Y = dustVelocityY; - dustAmtSpawned++; - } - } - } - - // Get a target - 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]; - - float enrageScale = bossRush ? 1f : 0f; - if (Main.dayTime || bossRush) - { - npc.Calamity().CurrentlyEnraged = !bossRush; - enrageScale += 2f; - } - - // Rotation - Vector2 npcCenter = new Vector2(npc.Center.X, npc.position.Y + npc.height - 59f); - Vector2 lookAt = new Vector2(player.position.X - (player.width / 2), player.position.Y - (player.height / 2)); - Vector2 rotationVector = npcCenter - lookAt; - - // Boss Rush predictive charge rotation - if (npc.ai[1] == 4f && phase4 && bossRush) - { - // Velocity - float chargeVelocity = 30f; - chargeVelocity += 5f * enrageScale; - lookAt += Main.player[npc.target].velocity * 20f; - rotationVector = Vector2.Normalize(npcCenter - lookAt) * chargeVelocity; - } - - float rotation = (float)Math.Atan2(rotationVector.Y, rotationVector.X) + MathHelper.PiOver2; - if (rotation < 0f) - rotation += MathHelper.TwoPi; - else if (rotation > MathHelper.TwoPi) - rotation -= MathHelper.TwoPi; - - float rotationAmt = 0.1f; - if (npc.rotation < rotation) - { - if ((rotation - npc.rotation) > MathHelper.Pi) - npc.rotation -= rotationAmt; - else - npc.rotation += rotationAmt; - } - else if (npc.rotation > rotation) - { - if ((npc.rotation - rotation) > MathHelper.Pi) - npc.rotation += rotationAmt; - else - npc.rotation -= rotationAmt; - } - - if (npc.rotation > rotation - rotationAmt && npc.rotation < rotation + rotationAmt) - npc.rotation = rotation; - if (npc.rotation < 0f) - npc.rotation += MathHelper.TwoPi; - else if (npc.rotation > MathHelper.TwoPi) - npc.rotation -= MathHelper.TwoPi; - if (npc.rotation > rotation - rotationAmt && npc.rotation < rotation + rotationAmt) - npc.rotation = rotation; - - // Despawn - if (!player.active || player.dead) - { - npc.TargetClosest(false); - player = Main.player[npc.target]; - if (!player.active || player.dead) - { - if (npc.velocity.Y > 3f) - npc.velocity.Y = 3f; - npc.velocity.Y -= 0.1f; - if (npc.velocity.Y < -12f) - npc.velocity.Y = -12f; - - if (npc.timeLeft > 60) - npc.timeLeft = 60; - - if (npc.ai[1] != 0f) - { - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - calamityGlobalNPC.newAI[2] = 0f; - calamityGlobalNPC.newAI[3] = 0f; - npc.alpha = 0; - npc.netUpdate = true; - } - return; - } - } - else if (npc.timeLeft < 1800) - npc.timeLeft = 1800; - - // Reset damage from bullet hell phases - npc.damage = npc.defDamage; - - // Distance from destination where Cal Clone stops moving - float movementDistanceGateValue = 100f; - - // How fast Cal Clone moves to the destination - float baseVelocity = (expertMode ? 10f : 8.5f) * (npc.ai[1] == 4f ? 1.4f : 1f); - float baseAcceleration = (expertMode ? 0.18f : 0.155f) * (npc.ai[1] == 4f ? 1.4f : 1f); - baseVelocity += 4f * enrageScale; - baseAcceleration += 0.1f * enrageScale; - if (revenge) - { - baseVelocity += 1.5f * (1f - lifeRatio); - baseAcceleration += 0.03f * (1f - lifeRatio); - } - if (death) - { - baseVelocity += 1.5f * (1f - lifeRatio); - baseAcceleration += 0.03f * (1f - lifeRatio); - } - if (Main.getGoodWorld) - { - baseVelocity *= 1.15f; - baseAcceleration *= 1.15f; - } - - // Reduce acceleration if target is holding a true melee weapon - if (player.HoldingTrueMeleeWeapon()) - baseAcceleration *= 0.5f; - - // What side Cal Clone should be on, relative to the target - int xPos = 1; - if (npc.Center.X < player.Center.X) - xPos = -1; - - // How far Cal Clone should be from the target - float averageDistance = 500f; - float chargeDistance = phase4 ? 300f : 400f; - - // This is where Cal Clone should be - Vector2 destination = (calamityGlobalNPC.newAI[2] > 0f || npc.ai[1] == 0f) ? new Vector2(player.Center.X, player.Center.Y - averageDistance) : - npc.ai[1] == 1f ? new Vector2(player.Center.X + averageDistance * xPos, player.Center.Y) : - new Vector2(player.Center.X + chargeDistance * xPos, player.Center.Y); - - // Add some random distance to the destination after certain attacks - if (npc.localAI[0] == 1f) - { - npc.localAI[0] = 0f; - npc.localAI[2] = Main.rand.Next(-50, 51); - npc.localAI[3] = Main.rand.Next(-300, 301); - npc.netUpdate = true; - } - - // Add a bit of randomness to the destination - if (death) - { - destination.X += npc.ai[1] == 0f ? npc.localAI[3] : npc.localAI[2]; - destination.Y += npc.ai[1] == 0f ? npc.localAI[2] : npc.localAI[3]; - } - - // How far Cal Clone is from where she's supposed to be - Vector2 distanceFromDestination = destination - npc.Center; - - // Movement - if (npc.ai[1] == 0f || npc.ai[1] == 1f || npc.ai[1] == 4f || calamityGlobalNPC.newAI[2] > 0f) - CalamityUtils.SmoothMovement(npc, movementDistanceGateValue, distanceFromDestination, baseVelocity, baseAcceleration, true); - - // Bullet hell phase - if (calamityGlobalNPC.newAI[2] > 0f) - { - if (calamityGlobalNPC.newAI[3] < 900f) - { - calamityGlobalNPC.newAI[3] += 1f; - npc.damage = 0; - npc.dontTakeDamage = true; - npc.alpha = 255; - - float rotX = player.Center.X - npc.Center.X; - float rotY = player.Center.Y - npc.Center.Y; - npc.rotation = (float)Math.Atan2(rotY, rotX) - MathHelper.PiOver2; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (calamityGlobalNPC.newAI[2] == 2f) - { - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - if (Main.zenithWorld) - type = ModContent.ProjectileType(); - - float gigaBlastFrequency = (Main.getGoodWorld ? 120f : expertMode ? 180f : 240f) - enrageScale * 15f; - float projSpeed = bossRush ? 6.25f : 5f; - if (calamityGlobalNPC.newAI[3] <= 300f) - { - if (calamityGlobalNPC.newAI[3] % gigaBlastFrequency == 0f) // Blasts from top - Projectile.NewProjectile(npc.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, projSpeed, type, damage, 0f, Main.myPlayer); - } - else if (calamityGlobalNPC.newAI[3] <= 600f && calamityGlobalNPC.newAI[3] > 300f) - { - if (calamityGlobalNPC.newAI[3] % gigaBlastFrequency == 0f) // Blasts from right - Projectile.NewProjectile(npc.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -projSpeed, 0f, type, damage, 0f, Main.myPlayer); - } - else if (calamityGlobalNPC.newAI[3] > 600f) - { - if (calamityGlobalNPC.newAI[3] % gigaBlastFrequency == 0f) // Blasts from top - Projectile.NewProjectile(npc.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, projSpeed, type, damage, 0f, Main.myPlayer); - } - } - } - - npc.ai[0] += 1f; - float hellblastGateValue = (expertMode ? 12f : 16f) - enrageScale; - if (npc.ai[0] >= hellblastGateValue) - { - npc.ai[0] = 0f; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - float projSpeed = bossRush ? 5f : 4f; - if (calamityGlobalNPC.newAI[3] % (hellblastGateValue * 6f) == 0f) - { - float distance = Main.rand.NextBool() ? -1000f : 1000f; - float velocity = distance == -1000f ? projSpeed : -projSpeed; - Projectile.NewProjectile(npc.GetSource_FromAI(), player.position.X + distance, player.position.Y, velocity, 0f, type, damage, 0f, Main.myPlayer, 2f, 0f); - } - - if (calamityGlobalNPC.newAI[3] < 300f) // Blasts from above - { - Projectile.NewProjectile(npc.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, projSpeed, type, damage, 0f, Main.myPlayer, 2f, 0f); - } - else if (calamityGlobalNPC.newAI[3] < 600f) // Blasts from left and right - { - Projectile.NewProjectile(npc.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -(projSpeed - 0.5f), 0f, type, damage, 0f, Main.myPlayer, 2f, 0f); - Projectile.NewProjectile(npc.GetSource_FromAI(), player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), projSpeed - 0.5f, 0f, type, damage, 0f, Main.myPlayer, 2f, 0f); - } - else // Blasts from above, left, and right - { - Projectile.NewProjectile(npc.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, projSpeed - 1f, type, damage, 0f, Main.myPlayer, 2f, 0f); - Projectile.NewProjectile(npc.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -(projSpeed - 1f), 0f, type, damage, 0f, Main.myPlayer, 2f, 0f); - Projectile.NewProjectile(npc.GetSource_FromAI(), player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), projSpeed - 1f, 0f, type, damage, 0f, Main.myPlayer, 2f, 0f); - } - } - } - } - else - { - npc.ai[0] = 0f; - npc.ai[3] = 0f; - npc.localAI[1] = 0f; - calamityGlobalNPC.newAI[2] = 0f; - calamityGlobalNPC.newAI[3] = 0f; - - // Prevent bullshit charge hits when second bullet hell ends. - if (phase4) - { - npc.ai[1] = 4f; - npc.ai[2] = -105f; - npc.TargetClosest(); - } - else - { - if (death) - { - int AIState = Main.rand.Next(3); - switch (AIState) - { - case 0: - npc.ai[1] = 0f; - npc.ai[2] = 0f; - break; - case 1: - npc.ai[1] = 1f; - npc.ai[2] = 0f; - break; - case 2: - npc.ai[1] = 4f; - npc.ai[2] = -105f; - npc.TargetClosest(); - break; - } - } - else - { - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - - if (death) - npc.localAI[0] = 1f; - } - - npc.netUpdate = true; - - for (int x = 0; x < Main.maxProjectiles; x++) - { - Projectile projectile = Main.projectile[x]; - if (projectile.active) - { - if (projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType()) - { - if (projectile.timeLeft > 60) - projectile.timeLeft = 60; - } - else if (projectile.type == ModContent.ProjectileType()) - { - projectile.ai[1] = 1f; - - if (projectile.timeLeft > 60) - projectile.timeLeft = 60; - } - } - } - } - - return; - } - else if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) - { - if (calamityGlobalNPC.newAI[3] < 900f) - calamityGlobalNPC.newAI[3] += 1f; - else - calamityGlobalNPC.newAI[3] = 0f; - - npc.ai[0] += 1f; - float hellblastGateValue = 30f - enrageScale; - if (npc.ai[0] >= hellblastGateValue) - { - npc.ai[0] = 0f; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - float projSpeed = bossRush ? 5f : 4f; - if (calamityGlobalNPC.newAI[3] % (hellblastGateValue * 6f) == 0f) - { - float distance = Main.rand.NextBool() ? -1000f : 1000f; - float velocity = distance == -1000f ? projSpeed : -projSpeed; - Projectile.NewProjectile(npc.GetSource_FromAI(), player.position.X + distance, player.position.Y, velocity, 0f, type, damage, 0f, Main.myPlayer, 2f, 0f); - } - - if (calamityGlobalNPC.newAI[3] < 300f) // Blasts from above - { - Projectile.NewProjectile(npc.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, projSpeed, type, damage, 0f, Main.myPlayer, 2f, 0f); - } - else if (calamityGlobalNPC.newAI[3] < 600f) // Blasts from left and right - { - Projectile.NewProjectile(npc.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -(projSpeed - 0.5f), 0f, type, damage, 0f, Main.myPlayer, 2f, 0f); - Projectile.NewProjectile(npc.GetSource_FromAI(), player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), projSpeed - 0.5f, 0f, type, damage, 0f, Main.myPlayer, 2f, 0f); - } - else // Blasts from above, left, and right - { - Projectile.NewProjectile(npc.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, projSpeed - 1f, type, damage, 0f, Main.myPlayer, 2f, 0f); - Projectile.NewProjectile(npc.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -(projSpeed - 1f), 0f, type, damage, 0f, Main.myPlayer, 2f, 0f); - Projectile.NewProjectile(npc.GetSource_FromAI(), player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), projSpeed - 1f, 0f, type, damage, 0f, Main.myPlayer, 2f, 0f); - } - } - } - } - - npc.alpha = npc.dontTakeDamage ? 255 : 0; - npc.damage = npc.dontTakeDamage ? 0 : npc.defDamage; - - // Float above target and fire lasers or fireballs - if (npc.ai[1] == 0f) - { - npc.ai[2] += 1f; - float phaseTimer = 400f - (death ? 120f * (1f - lifeRatio) : 0f); - if (npc.ai[2] >= phaseTimer || phase4) - { - if (death && !phase4 && Main.rand.NextBool() && !brotherAlive) - npc.ai[1] = 4f; - else - npc.ai[1] = 1f; - - npc.ai[2] = 0f; - if (death) - npc.localAI[0] = 1f; - - npc.TargetClosest(); - npc.netUpdate = true; - } - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[1] += 1f; - if (!brotherAlive) - { - if (expertMode) - npc.localAI[1] += death ? 2f * (1f - lifeRatio) : 1f - lifeRatio; - if (revenge) - npc.localAI[1] += 0.5f; - } - - if (npc.localAI[1] >= (brotherAlive ? 180f : 120f)) - { - npc.localAI[1] = 0f; - - float projectileVelocity = expertMode ? 14f : 12.5f; - projectileVelocity += 3f * enrageScale; - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - bool shootPredictiveShot = CalamityWorld.LegendaryMode && CalamityWorld.revenge && Main.rand.NextBool(); - Vector2 predictionVector = shootPredictiveShot ? player.velocity * 20f : Vector2.Zero; - Vector2 fireballVelocity = Vector2.Normalize(player.Center + predictionVector - npc.Center) * projectileVelocity; - Vector2 offset = Vector2.Normalize(fireballVelocity) * 40f; - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + offset, fireballVelocity, type, damage, 0f, Main.myPlayer, player.position.X, player.position.Y); - Main.projectile[proj].netUpdate = true; - } - } - } - - // Float to the side of the target and fire - else if (npc.ai[1] == 1f) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[1] += 1f; - if (!brotherAlive) - { - if (revenge) - npc.localAI[1] += 0.5f; - if (expertMode) - npc.localAI[1] += 0.5f; - } - - if (npc.localAI[1] >= (brotherAlive ? 75f : 50f) && Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) - { - npc.localAI[1] = 0f; - - float projectileVelocity = expertMode ? 12.5f : 11f; - projectileVelocity += 3f * enrageScale; - int type = brotherAlive ? ModContent.ProjectileType() : ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - Vector2 fireballVelocity = Vector2.Normalize(player.Center - npc.Center) * projectileVelocity; - Vector2 offset = Vector2.Normalize(fireballVelocity) * 40f; - - if (!Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) - { - type = ModContent.ProjectileType(); - damage = npc.GetProjectileDamage(type); - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + offset, fireballVelocity, type, damage, 0f, Main.myPlayer, player.position.X, player.position.Y); - } - else - { - float ai0 = type == ModContent.ProjectileType() ? 1f : player.position.X; - float ai1 = type == ModContent.ProjectileType() ? 0f : player.position.Y; - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + offset, fireballVelocity, type, damage, 0f, Main.myPlayer, ai0, ai1); - } - } - } - - npc.ai[2] += 1f; - float phaseTimer = 240f - (death ? 60f * (1f - lifeRatio) : 0f); - if (npc.ai[2] >= phaseTimer || phase4) - { - if (death && !phase4 && Main.rand.NextBool() && !brotherAlive) - npc.ai[1] = 0f; - else - npc.ai[1] = !brotherAlive && phase2 && revenge ? 4f : 0f; - - npc.ai[2] = 0f; - if (death) - npc.localAI[0] = 1f; - - npc.TargetClosest(); - npc.netUpdate = true; - } - } - else if (npc.ai[1] == 2f) - { - npc.rotation = rotation; - - float chargeVelocity = phase4 ? 30f : death ? 28f : 25f; - chargeVelocity += 5f * enrageScale; - - Vector2 vector = Vector2.Normalize(player.Center + (phase4 && bossRush ? player.velocity * 20f : Vector2.Zero) - npc.Center); - npc.velocity = vector * chargeVelocity; - - npc.ai[1] = 3f; - npc.netUpdate = true; - } - else if (npc.ai[1] == 3f) - { - npc.ai[2] += 1f; - - float chargeTime = phase4 ? 35f : death ? 40f : 45f; - if (npc.ai[2] >= chargeTime) - { - npc.velocity *= 0.9f; - if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) - npc.velocity.X = 0f; - if (npc.velocity.Y > -0.1 && npc.velocity.Y < 0.1) - npc.velocity.Y = 0f; - } - else - { - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) - MathHelper.PiOver2; - - // Leave behind slow hellblasts in Death Mode - if (Main.netMode != NetmodeID.MultiplayerClient && death && phase3 && npc.ai[2] % (phase4 ? 6f : 10f) == 0f) - { - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - Vector2 fireballVelocity = CalamityWorld.LegendaryMode ? Main.rand.NextVector2CircularEdge(0.02f, 0.02f) : npc.velocity * 0.01f; - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, fireballVelocity, type, damage, 0f, Main.myPlayer, 1f, 0f); - } - } - - if (npc.ai[2] >= chargeTime + 10f) - { - if (!phase4) - npc.ai[3] += 1f; - - npc.ai[2] = 0f; - - npc.rotation = rotation; - npc.TargetClosest(); - npc.netUpdate = true; - - if (npc.ai[3] >= 2f) - { - npc.ai[1] = 0f; - npc.ai[3] = 0f; - return; - } - - npc.ai[1] = 4f; - } - } - else - { - npc.ai[2] += 1f; - if (npc.ai[2] >= (phase4 ? 15f : 30f)) - { - npc.TargetClosest(); - - npc.ai[1] = 2f; - npc.ai[2] = 0f; - if (death) - npc.localAI[0] = 1f; - - npc.netUpdate = true; - } - } - } - - public static void CataclysmAI(NPC npc, Mod mod) - { - CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - - if (CalamityGlobalNPC.calamitas < 0 || !Main.npc[CalamityGlobalNPC.calamitas].active) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - npc.StrikeInstantKill(); - - return; - } - - // Percent life remaining - float lifeRatio = npc.life / (float)npc.lifeMax; - - CalamityGlobalNPC.cataclysm = npc.whoAmI; - - // Emit light - Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 1f, 0f, 0f); - - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool expertMode = Main.expertMode || bossRush; - - // Get a target - 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; - if (Main.dayTime || bossRush) - { - npc.Calamity().CurrentlyEnraged = !bossRush; - enrageScale += 2f; - } - - float calCloneBroPlayerXDist = npc.position.X + (npc.width / 2) - player.position.X - (player.width / 2); - float calCloneBroPlayerYDist = npc.position.Y + npc.height - 59f - player.position.Y - (player.height / 2); - float calCloneBroRotation = (float)Math.Atan2(calCloneBroPlayerYDist, calCloneBroPlayerXDist) + MathHelper.PiOver2; - if (calCloneBroRotation < 0f) - calCloneBroRotation += MathHelper.TwoPi; - else if (calCloneBroRotation > MathHelper.TwoPi) - calCloneBroRotation -= MathHelper.TwoPi; - - float calCloneBroRotationSpeed = 0.15f; - if (npc.rotation < calCloneBroRotation) - { - if ((calCloneBroRotation - npc.rotation) > MathHelper.Pi) - npc.rotation -= calCloneBroRotationSpeed; - else - npc.rotation += calCloneBroRotationSpeed; - } - else if (npc.rotation > calCloneBroRotation) - { - if ((npc.rotation - calCloneBroRotation) > MathHelper.Pi) - npc.rotation += calCloneBroRotationSpeed; - else - npc.rotation -= calCloneBroRotationSpeed; - } - - if (npc.rotation > calCloneBroRotation - calCloneBroRotationSpeed && npc.rotation < calCloneBroRotation + calCloneBroRotationSpeed) - npc.rotation = calCloneBroRotation; - if (npc.rotation < 0f) - npc.rotation += MathHelper.TwoPi; - else if (npc.rotation > MathHelper.TwoPi) - npc.rotation -= MathHelper.TwoPi; - if (npc.rotation > calCloneBroRotation - calCloneBroRotationSpeed && npc.rotation < calCloneBroRotation + calCloneBroRotationSpeed) - npc.rotation = calCloneBroRotation; - - if (!player.active || player.dead) - { - npc.TargetClosest(false); - player = Main.player[npc.target]; - if (!player.active || player.dead) - { - if (npc.velocity.Y > 3f) - npc.velocity.Y = 3f; - npc.velocity.Y -= 0.1f; - if (npc.velocity.Y < -12f) - npc.velocity.Y = -12f; - - if (npc.timeLeft > 60) - npc.timeLeft = 60; - - if (npc.ai[1] != 0f) - { - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; - } - - return; - } - } - - if (npc.ai[1] == 0f) - { - float calCloneBroProjAttackMaxSpeed = 5f; - float calCloneBroProjAttackAccel = 0.1f; - calCloneBroProjAttackMaxSpeed += 2f * enrageScale; - calCloneBroProjAttackAccel += 0.06f * enrageScale; - - if (Main.getGoodWorld) - { - calCloneBroProjAttackMaxSpeed *= 1.15f; - calCloneBroProjAttackAccel *= 1.15f; - } - - int calCloneBroProjAttackDirection = 1; - if (npc.position.X + (npc.width / 2) < player.position.X + player.width) - calCloneBroProjAttackDirection = -1; - - Vector2 calCloneBroProjLocation = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float calCloneBroProjTargetX = player.position.X + (player.width / 2) + (calCloneBroProjAttackDirection * 180) - calCloneBroProjLocation.X; - float calCloneBroProjTargetY = player.position.Y + (player.height / 2) - calCloneBroProjLocation.Y; - float calCloneBroProjTargetDist = (float)Math.Sqrt(calCloneBroProjTargetX * calCloneBroProjTargetX + calCloneBroProjTargetY * calCloneBroProjTargetY); - - if (expertMode) - { - if (calCloneBroProjTargetDist > 300f) - calCloneBroProjAttackMaxSpeed += 0.5f; - if (calCloneBroProjTargetDist > 400f) - calCloneBroProjAttackMaxSpeed += 0.5f; - if (calCloneBroProjTargetDist > 500f) - calCloneBroProjAttackMaxSpeed += 0.55f; - if (calCloneBroProjTargetDist > 600f) - calCloneBroProjAttackMaxSpeed += 0.55f; - if (calCloneBroProjTargetDist > 700f) - calCloneBroProjAttackMaxSpeed += 0.6f; - if (calCloneBroProjTargetDist > 800f) - calCloneBroProjAttackMaxSpeed += 0.6f; - } - - calCloneBroProjTargetDist = calCloneBroProjAttackMaxSpeed / calCloneBroProjTargetDist; - calCloneBroProjTargetX *= calCloneBroProjTargetDist; - calCloneBroProjTargetY *= calCloneBroProjTargetDist; - - if (npc.velocity.X < calCloneBroProjTargetX) - { - npc.velocity.X += calCloneBroProjAttackAccel; - if (npc.velocity.X < 0f && calCloneBroProjTargetX > 0f) - npc.velocity.X += calCloneBroProjAttackAccel; - } - else if (npc.velocity.X > calCloneBroProjTargetX) - { - npc.velocity.X -= calCloneBroProjAttackAccel; - if (npc.velocity.X > 0f && calCloneBroProjTargetX < 0f) - npc.velocity.X -= calCloneBroProjAttackAccel; - } - if (npc.velocity.Y < calCloneBroProjTargetY) - { - npc.velocity.Y += calCloneBroProjAttackAccel; - if (npc.velocity.Y < 0f && calCloneBroProjTargetY > 0f) - npc.velocity.Y += calCloneBroProjAttackAccel; - } - else if (npc.velocity.Y > calCloneBroProjTargetY) - { - npc.velocity.Y -= calCloneBroProjAttackAccel; - if (npc.velocity.Y > 0f && calCloneBroProjTargetY < 0f) - npc.velocity.Y -= calCloneBroProjAttackAccel; - } - - 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; - npc.netUpdate = true; - } - - bool fireDelay = npc.ai[2] > 120f || npc.life < npc.lifeMax * 0.9; - if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height) && fireDelay) - { - npc.localAI[2] += 1f; - if (npc.localAI[2] > 22f) - { - npc.localAI[2] = 0f; - SoundEngine.PlaySound(SoundID.Item34, npc.Center); - } - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[1] += 3f; - if (revenge) - npc.localAI[1] += 1f; - - if (npc.localAI[1] > 12f) - { - npc.localAI[1] = 0f; - float calCloneBroProjSpeed = NPC.AnyNPCs(ModContent.NPCType()) ? 4f : 6f; - calCloneBroProjSpeed += enrageScale; - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - calCloneBroProjLocation = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - calCloneBroProjTargetX = player.position.X + (player.width / 2) - calCloneBroProjLocation.X; - calCloneBroProjTargetY = player.position.Y + (player.height / 2) - calCloneBroProjLocation.Y; - calCloneBroProjTargetDist = (float)Math.Sqrt(calCloneBroProjTargetX * calCloneBroProjTargetX + calCloneBroProjTargetY * calCloneBroProjTargetY); - calCloneBroProjTargetDist = calCloneBroProjSpeed / calCloneBroProjTargetDist; - calCloneBroProjTargetX *= calCloneBroProjTargetDist; - calCloneBroProjTargetY *= calCloneBroProjTargetDist; - calCloneBroProjTargetY += npc.velocity.Y * 0.5f; - calCloneBroProjTargetX += npc.velocity.X * 0.5f; - calCloneBroProjLocation.X -= calCloneBroProjTargetX; - calCloneBroProjLocation.Y -= calCloneBroProjTargetY; - Projectile.NewProjectile(npc.GetSource_FromAI(), calCloneBroProjLocation.X, calCloneBroProjLocation.Y, calCloneBroProjTargetX, calCloneBroProjTargetY, type, damage, 0f, Main.myPlayer, 0f, 0f); - } - } - } - } - else - { - if (npc.ai[1] == 1f) - { - SoundEngine.PlaySound(SoundID.Roar, npc.Center); - npc.rotation = calCloneBroRotation; - - float calCloneBroChargeSpeed = 14f + (death ? 4f * (1f - lifeRatio) : 0f); - calCloneBroChargeSpeed += 3f * enrageScale; - if (expertMode) - calCloneBroChargeSpeed += 2f; - if (revenge) - calCloneBroChargeSpeed += 2f; - if (Main.getGoodWorld) - calCloneBroChargeSpeed *= 1.25f; - - Vector2 calCloneBroChargeCenter = npc.Center; - float calCloneBroChargeTargetXDist = player.Center.X - calCloneBroChargeCenter.X; - float calCloneBroChargeTargetYDist = player.Center.Y - calCloneBroChargeCenter.Y; - float calCloneBroChargeTargetDistance = (float)Math.Sqrt(calCloneBroChargeTargetXDist * calCloneBroChargeTargetXDist + calCloneBroChargeTargetYDist * calCloneBroChargeTargetYDist); - calCloneBroChargeTargetDistance = calCloneBroChargeSpeed / calCloneBroChargeTargetDistance; - npc.velocity.X = calCloneBroChargeTargetXDist * calCloneBroChargeTargetDistance; - npc.velocity.Y = calCloneBroChargeTargetYDist * calCloneBroChargeTargetDistance; - npc.ai[1] = 2f; - - if (Main.zenithWorld) - { - SoundEngine.PlaySound(SupremeCalamitas.SupremeCalamitas.BrimstoneShotSound, npc.Center); - - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(ModContent.ProjectileType()); - if (bossRush) - damage /= 2; - int totalProjectiles = bossRush ? 12 : death ? 10 : revenge ? 8 : expertMode ? 6 : 4; - float radians = MathHelper.TwoPi / totalProjectiles; - float velocity = 5f; - Vector2 spinningPoint = new Vector2(0f, -velocity); - for (int k = 0; k < totalProjectiles; k++) - { - Vector2 velocity2 = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, velocity2, type, damage, 0f, Main.myPlayer, 0f, 1f); - } - - for (int i = 0; i < 6; i++) - Dust.NewDust(npc.position + npc.velocity, npc.width, npc.height, (int)CalamityDusts.Brimstone, 0f, 0f); - } - return; - } - - if (npc.ai[1] == 2f) - { - npc.ai[2] += 1f + (death ? 0.5f * (1f - lifeRatio) : 0f); - if (expertMode) - npc.ai[2] += 0.25f; - if (revenge) - npc.ai[2] += 0.25f; - - if (npc.ai[2] >= 75f) - { - npc.velocity.X *= 0.93f; - npc.velocity.Y *= 0.93f; - - if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) - npc.velocity.X = 0f; - if (npc.velocity.Y > -0.1 && npc.velocity.Y < 0.1) - npc.velocity.Y = 0f; - } - else - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) - MathHelper.PiOver2; - - if (npc.ai[2] >= 105f) - { - npc.ai[3] += 1f; - npc.ai[2] = 0f; - npc.target = 255; - npc.rotation = calCloneBroRotation; - npc.TargetClosest(); - if (npc.ai[3] >= 3f) - { - npc.ai[1] = 0f; - npc.ai[3] = 0f; - return; - } - npc.ai[1] = 1f; - } - } - } - } - - public static void CatastropheAI(NPC npc, Mod mod) - { - CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - - if (CalamityGlobalNPC.calamitas < 0 || !Main.npc[CalamityGlobalNPC.calamitas].active) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - npc.StrikeInstantKill(); - - return; - } - - // Percent life remaining - float lifeRatio = npc.life / (float)npc.lifeMax; - - CalamityGlobalNPC.catastrophe = npc.whoAmI; - - // Emit light - Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 1f, 0f, 0f); - - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool expertMode = Main.expertMode || bossRush; - - // Get a target - 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; - if (Main.dayTime || bossRush) - { - npc.Calamity().CurrentlyEnraged = !bossRush; - enrageScale += 2f; - } - - float calCloneBroPlayerXDist = npc.position.X + (npc.width / 2) - player.position.X - (player.width / 2); - float calCloneBroPlayerYDist = npc.position.Y + npc.height - 59f - player.position.Y - (player.height / 2); - float calCloneBroRotation = (float)Math.Atan2(calCloneBroPlayerYDist, calCloneBroPlayerXDist) + MathHelper.PiOver2; - if (calCloneBroRotation < 0f) - calCloneBroRotation += MathHelper.TwoPi; - else if (calCloneBroRotation > MathHelper.TwoPi) - calCloneBroRotation -= MathHelper.TwoPi; - - float calCloneBroRotationSpeed = 0.15f; - if (npc.rotation < calCloneBroRotation) - { - if ((calCloneBroRotation - npc.rotation) > MathHelper.Pi) - npc.rotation -= calCloneBroRotationSpeed; - else - npc.rotation += calCloneBroRotationSpeed; - } - else if (npc.rotation > calCloneBroRotation) - { - if ((npc.rotation - calCloneBroRotation) > MathHelper.Pi) - npc.rotation += calCloneBroRotationSpeed; - else - npc.rotation -= calCloneBroRotationSpeed; - } - - if (npc.rotation > calCloneBroRotation - calCloneBroRotationSpeed && npc.rotation < calCloneBroRotation + calCloneBroRotationSpeed) - npc.rotation = calCloneBroRotation; - if (npc.rotation < 0f) - npc.rotation += MathHelper.TwoPi; - else if (npc.rotation > MathHelper.TwoPi) - npc.rotation -= MathHelper.TwoPi; - if (npc.rotation > calCloneBroRotation - calCloneBroRotationSpeed && npc.rotation < calCloneBroRotation + calCloneBroRotationSpeed) - npc.rotation = calCloneBroRotation; - - if (!player.active || player.dead) - { - npc.TargetClosest(false); - player = Main.player[npc.target]; - if (!player.active || player.dead) - { - if (npc.velocity.Y > 3f) - npc.velocity.Y = 3f; - npc.velocity.Y -= 0.1f; - if (npc.velocity.Y < -12f) - npc.velocity.Y = -12f; - - if (npc.timeLeft > 60) - npc.timeLeft = 60; - - if (npc.ai[1] != 0f) - { - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; - } - - return; - } - } - - if (npc.ai[1] == 0f) - { - float calCloneBroProjAttackMaxSpeed = 4.5f; - float calCloneBroProjAttackAccel = 0.2f; - calCloneBroProjAttackMaxSpeed += 2f * enrageScale; - calCloneBroProjAttackAccel += 0.1f * enrageScale; - - if (Main.getGoodWorld) - { - calCloneBroProjAttackMaxSpeed *= 1.15f; - calCloneBroProjAttackAccel *= 1.15f; - } - - int calCloneBroProjAttackDirection = 1; - if (npc.Center.X < player.Center.X) - calCloneBroProjAttackDirection = -1; - - Vector2 calCloneBroProjLocation = npc.Center; - float calCloneBroProjTargetX = player.Center.X + (calCloneBroProjAttackDirection * 180) - calCloneBroProjLocation.X; - float calCloneBroProjTargetY = player.Center.Y - calCloneBroProjLocation.Y; - float calCloneBroProjTargetDist = (float)Math.Sqrt(calCloneBroProjTargetX * calCloneBroProjTargetX + calCloneBroProjTargetY * calCloneBroProjTargetY); - - if (expertMode) - { - if (calCloneBroProjTargetDist > 300f) - calCloneBroProjAttackMaxSpeed += 0.5f; - if (calCloneBroProjTargetDist > 400f) - calCloneBroProjAttackMaxSpeed += 0.5f; - if (calCloneBroProjTargetDist > 500f) - calCloneBroProjAttackMaxSpeed += 0.55f; - if (calCloneBroProjTargetDist > 600f) - calCloneBroProjAttackMaxSpeed += 0.55f; - if (calCloneBroProjTargetDist > 700f) - calCloneBroProjAttackMaxSpeed += 0.6f; - if (calCloneBroProjTargetDist > 800f) - calCloneBroProjAttackMaxSpeed += 0.6f; - } - - calCloneBroProjTargetDist = calCloneBroProjAttackMaxSpeed / calCloneBroProjTargetDist; - calCloneBroProjTargetX *= calCloneBroProjTargetDist; - calCloneBroProjTargetY *= calCloneBroProjTargetDist; - - if (npc.velocity.X < calCloneBroProjTargetX) - { - npc.velocity.X += calCloneBroProjAttackAccel; - if (npc.velocity.X < 0f && calCloneBroProjTargetX > 0f) - npc.velocity.X += calCloneBroProjAttackAccel; - } - else if (npc.velocity.X > calCloneBroProjTargetX) - { - npc.velocity.X -= calCloneBroProjAttackAccel; - if (npc.velocity.X > 0f && calCloneBroProjTargetX < 0f) - npc.velocity.X -= calCloneBroProjAttackAccel; - } - if (npc.velocity.Y < calCloneBroProjTargetY) - { - npc.velocity.Y += calCloneBroProjAttackAccel; - if (npc.velocity.Y < 0f && calCloneBroProjTargetY > 0f) - npc.velocity.Y += calCloneBroProjAttackAccel; - } - else if (npc.velocity.Y > calCloneBroProjTargetY) - { - npc.velocity.Y -= calCloneBroProjAttackAccel; - if (npc.velocity.Y > 0f && calCloneBroProjTargetY < 0f) - npc.velocity.Y -= calCloneBroProjAttackAccel; - } - - 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; - npc.netUpdate = true; - } - - bool fireDelay = npc.ai[2] > 120f || lifeRatio < 0.9f; - if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height) && fireDelay) - { - npc.localAI[2] += 1f; - if (npc.localAI[2] > 36f) - { - npc.localAI[2] = 0f; - SoundEngine.PlaySound(SoundID.Item34, npc.Center); - } - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[1] += 1f; - if (revenge) - npc.localAI[1] += 0.5f; - - if (npc.localAI[1] > 50f) - { - npc.localAI[1] = 0f; - float calCloneBroProjSpeed = death ? 14f : 12f; - calCloneBroProjSpeed += 3f * enrageScale; - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - calCloneBroProjLocation = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - calCloneBroProjTargetX = player.position.X + (player.width / 2) - calCloneBroProjLocation.X; - calCloneBroProjTargetY = player.position.Y + (player.height / 2) - calCloneBroProjLocation.Y; - calCloneBroProjTargetDist = (float)Math.Sqrt(calCloneBroProjTargetX * calCloneBroProjTargetX + calCloneBroProjTargetY * calCloneBroProjTargetY); - calCloneBroProjTargetDist = calCloneBroProjSpeed / calCloneBroProjTargetDist; - calCloneBroProjTargetX *= calCloneBroProjTargetDist; - calCloneBroProjTargetY *= calCloneBroProjTargetDist; - calCloneBroProjTargetY += npc.velocity.Y * 0.5f; - calCloneBroProjTargetX += npc.velocity.X * 0.5f; - calCloneBroProjLocation.X -= calCloneBroProjTargetX; - calCloneBroProjLocation.Y -= calCloneBroProjTargetY; - Projectile.NewProjectile(npc.GetSource_FromAI(), calCloneBroProjLocation.X, calCloneBroProjLocation.Y, calCloneBroProjTargetX, calCloneBroProjTargetY, type, damage, 0f, Main.myPlayer, 0f, 0f); - } - } - } - } - else - { - if (npc.ai[1] == 1f) - { - SoundEngine.PlaySound(SoundID.Roar, npc.Center); - npc.rotation = calCloneBroRotation; - - float calCloneBroChargeSpeed = (NPC.AnyNPCs(ModContent.NPCType()) ? 12f : 16f) + (death ? 4f * (1f - lifeRatio) : 0f); - calCloneBroChargeSpeed += 4f * enrageScale; - if (expertMode) - calCloneBroChargeSpeed += 2f; - if (revenge) - calCloneBroChargeSpeed += 2f; - if (Main.getGoodWorld) - calCloneBroChargeSpeed *= 1.25f; - - Vector2 calCloneBroChargeCenter = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float calCloneBroChargeTargetXDist = player.position.X + (player.width / 2) - calCloneBroChargeCenter.X; - float calCloneBroChargeTargetYDist = player.position.Y + (player.height / 2) - calCloneBroChargeCenter.Y; - float calCloneBroChargeTargetDistance = (float)Math.Sqrt(calCloneBroChargeTargetXDist * calCloneBroChargeTargetXDist + calCloneBroChargeTargetYDist * calCloneBroChargeTargetYDist); - calCloneBroChargeTargetDistance = calCloneBroChargeSpeed / calCloneBroChargeTargetDistance; - npc.velocity.X = calCloneBroChargeTargetXDist * calCloneBroChargeTargetDistance; - npc.velocity.Y = calCloneBroChargeTargetYDist * calCloneBroChargeTargetDistance; - npc.ai[1] = 2f; - - if (Main.zenithWorld) - { - SoundEngine.PlaySound(SupremeCalamitas.SupremeCalamitas.BrimstoneShotSound, npc.Center); - - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(ModContent.ProjectileType()); - if (bossRush) - damage /= 2; - int totalProjectiles = bossRush ? 12 : death ? 10 : revenge ? 8 : expertMode ? 6 : 4; - float radians = MathHelper.TwoPi / totalProjectiles; - float velocity = 5f; - Vector2 spinningPoint = new Vector2(0f, -velocity); - for (int k = 0; k < totalProjectiles; k++) - { - Vector2 velocity2 = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, velocity2, type, damage, 0f, Main.myPlayer, 0f, 1f); - } - - for (int i = 0; i < 6; i++) - Dust.NewDust(npc.position + npc.velocity, npc.width, npc.height, (int)CalamityDusts.Brimstone, 0f, 0f); - } - return; - } - - if (npc.ai[1] == 2f) - { - npc.ai[2] += 1f + (death ? 0.5f * (1f - lifeRatio) : 0f); - if (expertMode) - npc.ai[2] += 0.25f; - if (revenge) - npc.ai[2] += 0.25f; - - if (npc.ai[2] >= 60f) //50 - { - npc.velocity.X *= 0.93f; - npc.velocity.Y *= 0.93f; - - if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) - npc.velocity.X = 0f; - if (npc.velocity.Y > -0.1 && npc.velocity.Y < 0.1) - npc.velocity.Y = 0f; - } - else - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) - MathHelper.PiOver2; - - if (npc.ai[2] >= 90f) //80 - { - npc.ai[3] += 1f; - npc.ai[2] = 0f; - npc.TargetClosest(); - npc.rotation = calCloneBroRotation; - if (npc.ai[3] >= 4f) - { - npc.ai[1] = 0f; - npc.ai[3] = 0f; - return; - } - npc.ai[1] = 1f; - } - } - } - } - #endregion - - #region Astrum Aureus - public static void AstrumAureusAI(NPC npc, Mod mod) - { - CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - - CalamityGlobalNPC.astrumAureus = npc.whoAmI; - - // Variables - bool bossRush = BossRushEvent.BossRushActive; - bool expertMode = Main.expertMode || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool death = CalamityWorld.death || bossRush; - - // Percent life remaining - float lifeRatio = npc.life / (float)npc.lifeMax; - - // Phases - bool phase2 = lifeRatio < (revenge ? 0.85f : expertMode ? 0.8f : 0.75f); - bool phase3 = lifeRatio < (revenge ? 0.7f : expertMode ? 0.6f : 0.5f); - bool phase4 = lifeRatio < (revenge ? 0.5f : 0.4f) && expertMode; - bool phase5 = lifeRatio < 0.3f && revenge; - - // Exhaustion - bool exhausted = npc.ai[2] >= (phase3 ? 2f : 1f); - calamityGlobalNPC.DR = exhausted ? 0.25f : 0.5f; - npc.defense = exhausted ? npc.defDefense / 2 : npc.defDefense; - npc.damage = exhausted ? 0 : npc.defDamage; - - // Don't fire projectiles and don't increment phase timers for 4 seconds after the teleport phase to avoid cheap bullshit - float noProjectileOrPhaseIncrementTime = 240f; - - // Don't deal contact damage for 2 seconds after the teleport phase to avoid cheap bullshit - float noContactDamageTime = 120f; - - bool dontDealContactDamage = npc.localAI[3] > noProjectileOrPhaseIncrementTime - noContactDamageTime; - bool dontAttack = npc.localAI[3] > 0f; - if (dontAttack) - { - npc.localAI[3] -= 1f; - - if (dontDealContactDamage) - npc.damage = 0; - } - - // Get a target - 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; - if ((Main.dayTime && !player.Calamity().ZoneAstral) || bossRush) - { - npc.Calamity().CurrentlyEnraged = !bossRush; - enrageScale += 1f; - } - - float astralFlameBarrageTimerIncrement = 1f; - if (expertMode) - astralFlameBarrageTimerIncrement += death ? (float)Math.Round(3f * (1f - lifeRatio)) : (float)Math.Round(2f * (1f - lifeRatio)); - - float walkingVelocity = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 6f : 5f; - walkingVelocity += 3f * enrageScale; - if (phase5) - walkingVelocity += 2f; - if (expertMode) - walkingVelocity += 1.5f * (1f - lifeRatio); - if (revenge) - walkingVelocity += Math.Abs(npc.Center.X - player.Center.X) * 0.0025f; - if (Main.getGoodWorld) - walkingVelocity *= 1.15f; - - float walkingProjectileVelocity = walkingVelocity * 0.8f; - - // Direction - npc.spriteDirection = (npc.direction > 0) ? 1 : -1; - - // Used to reduce Aureus' fall speed - bool reduceFallSpeed = npc.velocity.Y > 0f && Collision.SolidCollision(npc.position + Vector2.UnitY * 1.1f * npc.velocity.Y, npc.width, npc.height) && npc.ai[0] == 4f; - - // Despawn - bool despawnDistance = Vector2.Distance(player.Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance350Tiles; - if (!player.active || player.dead || despawnDistance) - { - npc.TargetClosest(false); - player = Main.player[npc.target]; - if (!player.active || player.dead || despawnDistance) - { - npc.noTileCollide = true; - - if (npc.velocity.Y < -3f) - npc.velocity.Y = -3f; - npc.velocity.Y += 0.1f; - if (npc.velocity.Y > 12f) - npc.velocity.Y = 12f; - - if (npc.timeLeft > 60) - npc.timeLeft = 60; - - if (npc.ai[0] != 0f) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.localAI[2] = 0f; - npc.localAI[3] = 0f; - calamityGlobalNPC.newAI[0] = 0f; - calamityGlobalNPC.newAI[1] = 0f; - npc.netUpdate = true; - } - return; - } - } - else if (npc.timeLeft < 1800) - npc.timeLeft = 1800; - - bool geldonPhase1 = lifeRatio > 0.6f && lifeRatio <= 0.7f; - bool geldonPhase2 = lifeRatio <= 0.1f; - if (Main.zenithWorld && (geldonPhase1 || geldonPhase2)) - { - AstrumAureus.AstrumAureus astrumAureus = npc.ModNPC(); - astrumAureus.slimeProjCounter++; - if (astrumAureus.slimeProjCounter % 180 == 0) - { - SoundEngine.PlaySound(SoundID.Item33, npc.Center); - - if (astrumAureus.slimePhase == 1) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - int totalProjectiles = bossRush ? 14 : death ? 12 : revenge ? 10 : expertMode ? 8 : 6; - float radians = MathHelper.TwoPi / totalProjectiles; - float velocity = 10f; - Vector2 spinningPoint = new Vector2(0f, -velocity); - for (int k = 0; k < totalProjectiles; k++) - { - Vector2 velocity2 = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, velocity2, type, damage, 0f, Main.myPlayer, 0f, 1f); - } - } - astrumAureus.slimePhase = 0; - } - else - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - float aureusLaserSpeed = 7f; - float aureusLaserTargetX = player.Center.X - npc.Center.X; - float aureusLaserTargetY = player.Center.Y - npc.Center.Y; - float aureusLaserTargetDist = (float)Math.Sqrt(aureusLaserTargetX * aureusLaserTargetX + aureusLaserTargetY * aureusLaserTargetY); - aureusLaserTargetDist = aureusLaserSpeed / aureusLaserTargetDist; - aureusLaserTargetX *= aureusLaserTargetDist; - aureusLaserTargetY *= aureusLaserTargetDist; - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X, npc.Center.Y, aureusLaserTargetX, aureusLaserTargetY, type, damage, 0f, Main.myPlayer); - for (int i = 0; i < 4; i++) - { - Vector2 offset = new Vector2(Main.rand.Next(-6, 7), Main.rand.Next(-6, 7)); - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X, npc.Center.Y, aureusLaserTargetX + offset.X, aureusLaserTargetY + offset.Y, type, damage, 0f, Main.myPlayer); - } - } - astrumAureus.slimePhase = 1; - } - } - CalamityGlobalAI.BuffedMimicAI(npc, mod); - npc.noGravity = false; - npc.noTileCollide = false; - return; - } - else - { - npc.noGravity = true; - } - - // Emit light when not Idle - if (npc.ai[0] != 1f) - Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 1.3f, 0.5f, 0f); - - // Fire projectiles while walking, teleporting, or falling - if (npc.ai[0] == 2f || npc.ai[0] >= 5f) - { - if (!dontAttack) - npc.localAI[0] += npc.ai[0] == 2f ? 1f : astralFlameBarrageTimerIncrement; - - float astralFlameBarrageGateValue = phase4 ? 30f : 60f; - if (npc.localAI[0] >= astralFlameBarrageGateValue) - { - // Fire astral flames while teleporting - if (npc.ai[0] >= 5f && npc.ai[0] != 7) - { - npc.localAI[0] = 0f; - SoundEngine.PlaySound(SoundID.Item109, npc.Center); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - float velocity = death ? (8f + npc.localAI[2] * 0.025f) : 7f; - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - float spreadLimit = (phase4 ? 100f : 50f) + enrageScale * 50f; - float randomSpread = (Main.rand.NextFloat() - 0.5f) * spreadLimit; - Vector2 spawnVector = new Vector2(npc.Center.X, npc.Center.Y - 80f * npc.scale); - Vector2 destination = new Vector2(spawnVector.X + randomSpread, spawnVector.Y - 100f * npc.scale); - Projectile.NewProjectile(npc.GetSource_FromAI(), spawnVector, Vector2.Normalize(destination - spawnVector) * velocity, type, damage, 0f, Main.myPlayer); - } - } - } - - float laserBarrageGateValue = phase5 ? 160f : phase3 ? 120f : phase2 ? 80f : 60f; - if (npc.localAI[0] >= laserBarrageGateValue) - { - // Fire astral lasers while walking - if (npc.ai[0] == 2f) - { - npc.localAI[0] = 0f; - - SoundEngine.PlaySound(SoundID.Item33, npc.Center); - - if (calamityGlobalNPC.newAI[2] == 0f) - { - calamityGlobalNPC.newAI[2] = 1f; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int maxProjectiles = !phase2 ? (bossRush ? 5 : 3) : (bossRush ? 7 : 5); - int spread = !phase2 ? (bossRush ? 11 : 8) : (bossRush ? 12 : 10); - - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - Vector2 projectileVelocity = Vector2.Normalize(player.Center - npc.Center) * walkingProjectileVelocity; - float rotation = MathHelper.ToRadians(spread); - for (int i = 0; i < maxProjectiles; i++) - { - Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(maxProjectiles - 1))); - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, perturbedSpeed, type, damage, 0f, Main.myPlayer, 0f, walkingProjectileVelocity * 2f); - } - - if (phase3) - { - float flameVelocity = walkingProjectileVelocity; - maxProjectiles = 2; - spread = 45; - - type = ModContent.ProjectileType(); - damage = npc.GetProjectileDamage(type); - projectileVelocity = Vector2.Normalize(player.Center - npc.Center) * flameVelocity; - rotation = MathHelper.ToRadians(spread); - for (int i = 0; i < maxProjectiles; i++) - { - Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(maxProjectiles - 1))); - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, perturbedSpeed, type, damage, 0f, Main.myPlayer); - } - } - } - } - else - { - calamityGlobalNPC.newAI[2] = 0f; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int maxProjectiles = !phase3 ? (bossRush ? 13 : death ? 11 : 9) : (bossRush ? 19 : death ? 17 : 15); - int spread = !phase3 ? (bossRush ? 20 : death ? 18 : 16) : (bossRush ? 24 : death ? 22 : 20); - - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - int centralLaser = maxProjectiles / 2; - int[] lasersToNotFire = new int[6] { centralLaser - 3, centralLaser - 2, centralLaser - 1, centralLaser + 1, centralLaser + 2, centralLaser + 3 }; - Vector2 projectileVelocity = Vector2.Normalize(player.Center - npc.Center) * walkingProjectileVelocity; - float rotation = MathHelper.ToRadians(spread); - for (int i = 0; i < maxProjectiles; i++) - { - if (i != lasersToNotFire[0] && i != lasersToNotFire[1] && i != lasersToNotFire[2] && i != lasersToNotFire[3] && i != lasersToNotFire[4] && i != lasersToNotFire[5]) - { - Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(maxProjectiles - 1))); - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, perturbedSpeed, type, damage, 0f, Main.myPlayer, 0f, walkingProjectileVelocity * 2f); - } - } - } - } - } - } - } - else - npc.localAI[0] = 0f; - - // Start up - if (npc.ai[0] == 0f) - { - npc.ai[0] = 1f; - npc.netUpdate = true; - CustomGravity(); - } - - // Idle - else if (npc.ai[0] == 1f) - { - // Slow down - npc.velocity.X *= 0.8f; - - // Stay vulnerable for 3 seconds - npc.ai[1] += 1f; - if (npc.ai[1] >= 180f || bossRush) - { - // Set AI to random state and reset other AI arrays - npc.TargetClosest(); - switch (Main.rand.Next(phase3 ? 3 : 2)) - { - case 0: - npc.ai[0] = 2f; - break; - - case 1: - npc.ai[0] = 3f; - break; - - case 2: - npc.ai[0] = 5f; - break; - - default: - break; - } - npc.ai[1] = 0f; - npc.ai[2] = 0f; - - // Stop colliding with tiles if entering walking phase - npc.noTileCollide = npc.ai[0] == 2f; - - npc.netUpdate = true; - } - else - CustomGravity(); - } - - // Walk - else if (npc.ai[0] == 2f) - { - // Set walking direction - if (Math.Abs(npc.Center.X - player.Center.X) < 200f * npc.scale) - { - npc.velocity.X *= 0.8f; - if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) - npc.velocity.X = 0f; - } - else - { - float playerLocation = npc.Center.X - player.Center.X; - npc.direction = playerLocation < 0 ? 1 : -1; - - if (npc.direction > 0) - npc.velocity.X = (npc.velocity.X * 20f + walkingVelocity) / 21f; - if (npc.direction < 0) - npc.velocity.X = (npc.velocity.X * 20f - walkingVelocity) / 21f; - } - - if (Collision.CanHit(npc.position, npc.width, npc.height, player.Center, 1, 1) && !Collision.SolidCollision(npc.position, npc.width, npc.height) && player.position.Y <= npc.position.Y + npc.height && !npc.collideX) - { - CustomGravity(); - npc.noTileCollide = false; - } - else - { - npc.noTileCollide = true; - - // Walk through tiles if colliding with tiles and player is out of reach - int aureusHitboxWidth = 80; - int aureusHitboxHeight = 20; - Vector2 aureusHitboxTileCollideSize = new Vector2(npc.Center.X - (aureusHitboxWidth / 2), npc.position.Y + npc.height - aureusHitboxHeight); - - bool nearPlayerWalkingThroughTiles = false; - if (npc.position.X < player.position.X && npc.position.X + npc.width > player.position.X + player.width && npc.position.Y + npc.height < player.position.Y + player.height - 16f) - nearPlayerWalkingThroughTiles = true; - - if (nearPlayerWalkingThroughTiles) - { - npc.velocity.Y += 0.5f; - } - else if (Collision.SolidCollision(aureusHitboxTileCollideSize, aureusHitboxWidth, aureusHitboxHeight)) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y = 0f; - - if (npc.velocity.Y > -0.2) - npc.velocity.Y -= 0.025f; - else - npc.velocity.Y -= 0.2f; - - if (npc.velocity.Y < -4f) - npc.velocity.Y = -4f; - } - else - { - if (npc.velocity.Y < 0f) - npc.velocity.Y = 0f; - - if (npc.velocity.Y < 0.1) - npc.velocity.Y += 0.025f; - else - npc.velocity.Y += 0.5f; - } - } - - // Walk for a maximum of 6 seconds - if (!dontAttack) - npc.ai[1] += 1f; - - if (npc.ai[1] >= ((bossRush ? 270f : 360f) - (death ? 90f * (1f - lifeRatio) : 0f))) - { - // Collide with tiles again - npc.noTileCollide = false; - - // Set AI to next phase (Jump) and reset other AI - npc.TargetClosest(); - npc.ai[0] = exhausted ? 1f : 3f; - npc.ai[1] = 0f; - npc.ai[2] += 1f; - npc.netUpdate = true; - } - - // Limit downward velocity - if (npc.velocity.Y > 10f) - npc.velocity.Y = 10f; - } - - // Jump - else if (npc.ai[0] == 3f) - { - npc.noTileCollide = false; - - if (npc.velocity.Y == 0f) - { - // Slow down - npc.velocity.X *= 0.8f; - - // Half second delay before jumping - if (!dontAttack) - npc.ai[1] += 1f; - - if (npc.ai[1] >= 30f) - { - npc.ai[1] = -20f; - } - else if (npc.ai[1] == -1f) - { - // Set jump velocity, reset and set AI to next phase (Stomp) - float distanceFromPlayerOnXAxis = npc.Center.X - player.Center.X; - npc.direction = distanceFromPlayerOnXAxis < 0 ? 1 : -1; - calamityGlobalNPC.newAI[3] = npc.direction; - - // The limit for how much Aureus can multiply its jump velocity - float speedMultLimit = 1f; - - // Maxes out when the player is a full 2000 pixels away from or above Aureus - float multiplier = 1f / 2000f; - - // Increase Aureus jump velocity X if it's far enough away from the player - float distanceAwayFromTarget = Math.Abs(distanceFromPlayerOnXAxis); - float distanceGateValue = 400f; - bool increaseJumpVelocityX = distanceAwayFromTarget > distanceGateValue && expertMode; - if (increaseJumpVelocityX) - { - calamityGlobalNPC.newAI[0] = (distanceAwayFromTarget - distanceGateValue) * multiplier; - if (calamityGlobalNPC.newAI[0] > speedMultLimit) - calamityGlobalNPC.newAI[0] = speedMultLimit; - } - - // Increase Aureus jump velocity Y if it's far enough above the player - float distanceBelowTarget = npc.position.Y - (player.position.Y + 80f); - bool increaseJumpVelocityY = distanceBelowTarget > 0f && revenge; - if (increaseJumpVelocityY) - { - calamityGlobalNPC.newAI[1] = distanceBelowTarget * multiplier; - if (calamityGlobalNPC.newAI[1] > speedMultLimit) - calamityGlobalNPC.newAI[1] = speedMultLimit; - } - - float velocity = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 27f : 20f; - velocity += 6f * enrageScale; - if (expertMode) - velocity += death ? 6f * (1f - lifeRatio) : 4f * (1f - lifeRatio); - if (Main.getGoodWorld) - velocity *= 1.15f; - - npc.velocity = (new Vector2(player.Center.X, player.Center.Y - 500f) - npc.Center).SafeNormalize(Vector2.Zero) * velocity; - npc.velocity *= new Vector2(calamityGlobalNPC.newAI[0] + 1f, calamityGlobalNPC.newAI[1] + 1f); - - npc.noTileCollide = true; - - npc.ai[0] = 4f; - npc.ai[1] = 0f; - - SoundEngine.PlaySound(AstrumAureus.AstrumAureus.JumpSound, npc.Center); - - npc.netUpdate = true; - } - } - - // Don't run custom gravity when starting a jump - if (npc.ai[0] != 4f) - CustomGravity(); - } - - // Stomp - else if (npc.ai[0] == 4f) - { - if (npc.velocity.Y == 0f) - { - // Play stomp sound. Gotta specify the filepath to avoid confusion between the namespace and npc - SoundStyle soundToPlay = Main.zenithWorld ? NPCs.ExoMechs.Ares.AresGaussNuke.NukeExplosionSound : NPCs.AstrumAureus.AstrumAureus.StompSound; - SoundEngine.PlaySound(soundToPlay, npc.Center); - - if (Main.zenithWorld) - { - float screenShakePower = 16 * Utils.GetLerpValue(1300f, 0f, npc.Distance(Main.LocalPlayer.Center), true); - if (Main.LocalPlayer.Calamity().GeneralScreenShakePower < screenShakePower) - Main.LocalPlayer.Calamity().GeneralScreenShakePower = screenShakePower; - } - - // Stomp and jump again, if stomped twice then reset and set AI to next phase (Teleport or Idle) - npc.TargetClosest(); - npc.localAI[1] += 1f; - float maxStompAmt = phase5 ? 5f : phase3 ? 2f : 3f; - if (npc.localAI[1] >= maxStompAmt) - { - npc.ai[0] = exhausted ? 1f : (phase3 ? 5f : 2f); - npc.localAI[1] = 0f; - npc.ai[2] += 1f; - npc.ai[3] = 0f; - npc.noTileCollide = false; - npc.netUpdate = true; - } - else - { - float playerLocation = npc.Center.X - player.Center.X; - npc.direction = playerLocation < 0 ? 1 : -1; - npc.ai[0] = 3f; - npc.ai[3] = 0f; - npc.netUpdate = true; - } - - calamityGlobalNPC.newAI[0] = 0f; - calamityGlobalNPC.newAI[1] = 0f; - calamityGlobalNPC.newAI[3] = 0f; - - // Spawn dust for visual effect - for (int i = (int)npc.position.X - 20; i < (int)npc.position.X + npc.width + 40; i += 20) - { - for (int j = 0; j < 4; j++) - { - int stompDust = Dust.NewDust(new Vector2(npc.position.X - 20f, npc.position.Y + npc.height), npc.width + 20, 4, ModContent.DustType(), 0f, 0f, 100, default, 1.5f); - Main.dust[stompDust].velocity *= 0.2f; - } - } - - // Fire lasers or flames on stomp - SoundEngine.PlaySound(SoundID.Item33, npc.Center); - - if (Main.zenithWorld) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int type = Main.rand.NextBool() ? ModContent.ProjectileType() : ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - int totalProjectiles = bossRush ? 14 : death ? 12 : revenge ? 10 : expertMode ? 8 : 6; - float radians = MathHelper.TwoPi / totalProjectiles; - float velocity = 10f; - Vector2 spinningPoint = new Vector2(0f, -velocity); - for (int k = 0; k < totalProjectiles; k++) - { - Vector2 velocity2 = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, velocity2, type, damage, 0f, Main.myPlayer, 0f, 1f); - } - } - } - else if (calamityGlobalNPC.newAI[2] == 0f && phase2) - { - calamityGlobalNPC.newAI[2] = 1f; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - float flameVelocity = 6f; - int maxProjectiles = bossRush ? 4 : death ? 3 : 2; - int spread = bossRush ? 36 : death ? 28 : 20; - - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - Vector2 spawnVector = new Vector2(npc.Center.X, npc.Center.Y - 80f * npc.scale); - Vector2 destination = new Vector2(spawnVector.X, spawnVector.Y + 100f * npc.scale); - Vector2 projectileVelocity = Vector2.Normalize(destination - spawnVector) * flameVelocity; - float rotation = MathHelper.ToRadians(spread); - for (int i = 0; i < maxProjectiles; i++) - { - Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(maxProjectiles - 1))); - Projectile.NewProjectile(npc.GetSource_FromAI(), spawnVector + Vector2.Normalize(perturbedSpeed) * 100f, perturbedSpeed, type, damage, 0f, Main.myPlayer); - } - } - } - else - { - calamityGlobalNPC.newAI[2] = 0f; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - float laserVelocity = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 7f : death ? 6f : 5f; - int maxProjectiles = !phase3 ? (bossRush ? 13 : death ? 11 : 9) : (bossRush ? 17 : death ? 15 : 13); - int spread = !phase3 ? (bossRush ? 20 : death ? 18 : 16) : (bossRush ? 24 : death ? 22 : 20); - - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - int[] lasersToNotFire = new int[4] { 1, 3, maxProjectiles - 2, maxProjectiles - 4 }; - Vector2 projectileVelocity = Vector2.Normalize(player.Center - npc.Center) * laserVelocity; - float rotation = MathHelper.ToRadians(spread); - for (int i = 0; i < maxProjectiles; i++) - { - if (i != lasersToNotFire[0] && i != lasersToNotFire[1] && i != lasersToNotFire[2] && i != lasersToNotFire[3]) - { - Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(maxProjectiles - 1))); - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, perturbedSpeed, type, damage, 0f, Main.myPlayer, 0f, laserVelocity * 2f); - } - } - } - } - } - else - { - // Set velocities while falling, this happens before the stomp - // Fall through - if (!player.dead) - { - if ((player.position.Y > npc.Bottom.Y && npc.velocity.Y > 0f) || (player.position.Y < npc.Bottom.Y && npc.velocity.Y < 0f)) - npc.noTileCollide = true; - else if ((npc.velocity.Y > 0f && npc.Bottom.Y > Main.player[npc.target].Top.Y) || (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].Center, 1, 1) && !Collision.SolidCollision(npc.position, npc.width, npc.height))) - npc.noTileCollide = false; - } - - if (npc.position.X < player.position.X && npc.position.X + npc.width > player.position.X + player.width) - { - // Make sure Aureus falls quickly when directly on top of or below the player - if (npc.ai[3] < 30f) - npc.ai[3] = 30f; - - npc.velocity.X *= 0.8f; - - if (npc.Bottom.Y < player.position.Y) - { - // Make sure Aureus falls rather quickly - if (npc.velocity.Y < -3f) - npc.velocity.Y = -3f; - - float fallSpeed = 1.2f; - fallSpeed += 0.36f * enrageScale; - if (expertMode) - fallSpeed += death ? 0.36f * (1f - lifeRatio) : 0.24f * (1f - lifeRatio); - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) - fallSpeed += 0.5f; - - if (calamityGlobalNPC.newAI[1] > 0f) - fallSpeed *= calamityGlobalNPC.newAI[1] + 1f; - - npc.velocity.Y += fallSpeed; - } - } - else - { - // Push Aureus towards the player on the X axis if he's not directly on top of or below the player - float velocityXChange = 0.2f + Math.Abs(npc.Center.X - player.Center.X) * 0.0001f; - velocityXChange += 0.1f * enrageScale; - - if (calamityGlobalNPC.newAI[0] > 0f) - velocityXChange *= calamityGlobalNPC.newAI[0] + 1f; - - if (npc.direction < 0) - npc.velocity.X -= velocityXChange; - else if (npc.direction > 0) - npc.velocity.X += velocityXChange; - - float velocityXCap = 12f; - velocityXCap += 3.6f * enrageScale; - if (expertMode) - velocityXCap += death ? 3.6f * (1f - lifeRatio) : 2.4f * (1f - lifeRatio); - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) - velocityXCap += 5f; - - if (calamityGlobalNPC.newAI[0] > 0f) - velocityXCap *= calamityGlobalNPC.newAI[0] + 1f; - - float playerLocation = npc.Center.X - player.Center.X; - int directionRelativeToTarget = playerLocation < 0 ? 1 : -1; - bool slowDown = directionRelativeToTarget != calamityGlobalNPC.newAI[3]; - - if (slowDown) - velocityXCap *= 0.333f; - - if (npc.velocity.X < -velocityXCap) - npc.velocity.X = -velocityXCap; - if (npc.velocity.X > velocityXCap) - npc.velocity.X = velocityXCap; - } - - // Don't start falling quickly until half a second has passed - npc.ai[3] += 1f; - if (npc.ai[3] > 30f) - CustomGravity(); - } - } - - // Teleport - else if (npc.ai[0] == 5f) - { - // Slow down - npc.velocity.X *= 0.8f; - - // Start teleport - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[1] += 1f; - if (death) - npc.localAI[2] += 1.25f; - - if (phase4) - { - npc.localAI[1] += 1f; - if (death) - npc.localAI[2] += 1.25f; - } - - if (npc.localAI[1] >= (bossRush ? 60f : death ? 180f : 240f)) - { - // Reset localAI and find a teleport destination - npc.TargetClosest(); - npc.localAI[1] = 0f; - - Vector2 vectorAimedAheadOfTarget = Main.player[npc.target].Center + new Vector2((float)Math.Round(Main.player[npc.target].velocity.X), 0f).SafeNormalize(Vector2.Zero) * 1000f; - Point point4 = vectorAimedAheadOfTarget.ToTileCoordinates(); - int teleportTries = 0; - while (teleportTries < 100) - { - teleportTries++; - int teleportTileX = Main.rand.Next(point4.X - 5, point4.X + 6); - int teleportTileY = Main.rand.Next(point4.Y - 5, point4.Y); - - if (!Main.tile[teleportTileX, teleportTileY].HasUnactuatedTile) - { - npc.ai[1] = teleportTileX * 16 + 8; - npc.ai[3] = teleportTileY * 16 + 16; - break; - } - } - - // Default teleport if the above conditions aren't met in 100 iterations - if (teleportTries >= 100) - { - Vector2 bottom = Main.player[Player.FindClosest(npc.position, npc.width, npc.height)].Bottom; - npc.ai[1] = bottom.X; - npc.ai[3] = bottom.Y; - } - - // Set AI to next phase (Mid-teleport) - npc.ai[0] = 6f; - npc.netUpdate = true; - } - } - - CustomGravity(); - } - - // Mid-teleport - else if (npc.ai[0] == 6f) - { - // Avoid cheap bullshit - npc.damage = 0; - - if (death) - npc.localAI[2] += 1.25f; - - if (phase4) - { - if (death) - npc.localAI[2] += 1.25f; - } - - // Turn invisible - npc.alpha += 10; - if (npc.alpha >= 255) - { - // Set position to teleport destination - npc.Bottom = new Vector2(npc.ai[1], npc.ai[3]); - - // Reset alpha and set AI to next phase (End of teleport) - npc.alpha = 255; - npc.ai[0] = 7f; - npc.localAI[2] = 0f; - npc.netUpdate = true; - } - - // Play sound for cool effect - if (npc.soundDelay == 0) - { - npc.soundDelay = 15; - SoundEngine.PlaySound(SoundID.Item109, npc.Center); - } - - // Emit dust to make the teleport pretty - for (int i = 0; i < 10; i++) - { - int teleportDust = Dust.NewDust(npc.position, npc.width, npc.height, ModContent.DustType(), npc.velocity.X, npc.velocity.Y, 255, default, 2f); - Main.dust[teleportDust].noGravity = true; - Main.dust[teleportDust].velocity *= 0.5f; - } - - CustomGravity(); - } - - // End of teleport - else if (npc.ai[0] == 7f) - { - // Avoid cheap bullshit - npc.damage = 0; - - // Turn visible - npc.alpha -= 10; - if (npc.alpha <= 0) - { - // Spawn Aureus Spawns - bool spawnFlag = expertMode; - if (NPC.CountNPCS(ModContent.NPCType()) >= 2) - spawnFlag = false; - - if (spawnFlag && Main.netMode != NetmodeID.MultiplayerClient) - { - int aureusSpawn = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)(npc.Center.Y - 25f * npc.scale), ModContent.NPCType()); - Main.npc[aureusSpawn].velocity.Y = -10f; - Main.npc[aureusSpawn].netUpdate = true; - if (revenge) - { - aureusSpawn = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)(npc.Center.Y - 25f * npc.scale), ModContent.NPCType()); - Main.npc[aureusSpawn].velocity.Y = -15f; - Main.npc[aureusSpawn].netUpdate = true; - } - - if (death) - { - int damageAmt = npc.lifeMax / 50; - npc.life -= damageAmt; - if (npc.life < 1) - npc.life = 1; - - npc.HealEffect(-damageAmt, true); - } - } - - // Reset alpha and set AI to next phase (Idle) - npc.alpha = 0; - npc.ai[0] = exhausted ? 1f : 2f; - npc.ai[1] = 0f; - npc.ai[2] += 1f; - npc.localAI[3] = noProjectileOrPhaseIncrementTime; - - // Stop colliding with tiles if entering walking phase - npc.noTileCollide = npc.ai[0] == 2f; - - npc.netUpdate = true; - } - - // Play sound at teleport destination for cool effect - if (npc.soundDelay == 0) - { - npc.soundDelay = 15; - SoundEngine.PlaySound(SoundID.Item109, npc.Center); - } - - // Emit dust to make the teleport pretty - for (int i = 0; i < 10; i++) - { - int teleportDust = Dust.NewDust(npc.position, npc.width, npc.height, ModContent.DustType(), npc.velocity.X, npc.velocity.Y, 255, default, 2f); - Main.dust[teleportDust].noGravity = true; - Main.dust[teleportDust].velocity *= 0.5f; - } - - CustomGravity(); - } - - void CustomGravity() - { - float gravity = 0.36f + 0.12f * enrageScale; - float maxFallSpeed = reduceFallSpeed ? 12f : 12f + 4f * enrageScale; - - if (calamityGlobalNPC.newAI[1] > 0f && !reduceFallSpeed) - maxFallSpeed *= calamityGlobalNPC.newAI[1] + 1f; - - if (Main.getGoodWorld && !reduceFallSpeed) - { - gravity *= 1.15f; - maxFallSpeed *= 1.15f; - } - - npc.velocity.Y += gravity; - if (npc.velocity.Y > maxFallSpeed) - npc.velocity.Y = maxFallSpeed; - } - } - #endregion - - #region Astrum Deus - public static void AstrumDeusAI(NPC npc, Mod mod, bool head) - { - CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - - // Difficulty variables - bool bossRush = BossRushEvent.BossRushActive; - bool expertMode = Main.expertMode || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool death = CalamityWorld.death || bossRush; - - float enrageScale = bossRush ? 0.5f : 0f; - if (Main.dayTime || bossRush) - { - npc.Calamity().CurrentlyEnraged = !bossRush; - enrageScale += 1.5f; - } - - // Deus cannot hit for 3 seconds or while invulnerable - if (calamityGlobalNPC.newAI[1] < 180f || npc.dontTakeDamage) - npc.damage = 0; - else - npc.damage = npc.defDamage; - - // 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]; - - bool increaseSpeed = Vector2.Distance(player.Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles; - bool increaseSpeedMore = Vector2.Distance(player.Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance350Tiles; - - // Despawn safety, make sure to target another player if the current player target is too far away - if (increaseSpeedMore && head) - npc.TargetClosest(); - - // Inflict Extreme Gravity to nearby players - if (revenge) - { - if (Main.netMode != NetmodeID.Server) - { - if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active && Vector2.Distance(Main.player[Main.myPlayer].Center, npc.Center) < CalamityGlobalNPC.CatchUpDistance350Tiles) - Main.player[Main.myPlayer].AddBuff(ModContent.BuffType(), 2); - } - } - - // Life - float lifeRatio = npc.life / (float)npc.lifeMax; - - // Phases based on life percentage - bool halfHealth = lifeRatio < 0.5f; - bool doubleWormPhase = calamityGlobalNPC.newAI[0] != 0f; - bool startFlightPhase = lifeRatio < 0.8f || death || doubleWormPhase; - bool phase2 = lifeRatio < 0.5f && doubleWormPhase && expertMode; - bool phase3 = lifeRatio < 0.2f && doubleWormPhase && expertMode; - bool splittingMines = lifeRatio < 0.7f; - bool movingMines = lifeRatio < 0.3f && doubleWormPhase && expertMode; - bool deathModeEnragePhase_Head = calamityGlobalNPC.newAI[0] == 3f; - bool deathModeEnragePhase_BodyAndTail = false; - - // 5 seconds of resistance in phase 2, 10 seconds in phase 1, to prevent spawn killing - float resistanceTime = doubleWormPhase ? 300f : 600f; - if (calamityGlobalNPC.newAI[1] < resistanceTime) - calamityGlobalNPC.newAI[1] += 1f; - - calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = calamityGlobalNPC.newAI[1] < resistanceTime; - - // Flight timer - float aiSwitchTimer = doubleWormPhase ? (Main.getGoodWorld ? 600f : 1200f) : (Main.getGoodWorld ? 900f : 1800f); - - calamityGlobalNPC.newAI[3] += 1f; - if (calamityGlobalNPC.newAI[3] >= aiSwitchTimer) - calamityGlobalNPC.newAI[3] = 0f; - - // Phase for flying at the player - bool flyAtTarget = calamityGlobalNPC.newAI[3] >= (aiSwitchTimer * 0.5f) && startFlightPhase; - - // Length of worms - int phase1Length = death ? 80 : revenge ? 70 : expertMode ? 60 : 50; - int phase2Length = death ? 40 : revenge ? 35 : expertMode ? 30 : 25; - int gfbLength = death ? 8 : revenge ? 7 : expertMode ? 6 : 5; - int maxLength = Main.zenithWorld && doubleWormPhase ? gfbLength : doubleWormPhase ? phase2Length : phase1Length; - - // Become gradually more pissed as more worms are killed - int gfbMaxWormCount = 10; - int gfbWormCount = 0; - if (CalamityWorld.LegendaryMode && revenge) - gfbWormCount = NPC.CountNPCS(ModContent.NPCType()); - if (gfbWormCount > gfbMaxWormCount) - gfbWormCount = gfbMaxWormCount; - if (gfbWormCount > 0) - enrageScale += (gfbMaxWormCount - gfbWormCount) * 0.111f; - - // Split into two worms - if (head) - { - float splitAnimationTime = 180f; - bool oneWormAlive = NPC.CountNPCS(ModContent.NPCType()) < 2; - bool deathModeFinalWormEnrage = death && doubleWormPhase && oneWormAlive && calamityGlobalNPC.newAI[1] >= resistanceTime; - if (deathModeFinalWormEnrage) - { - if (calamityGlobalNPC.newAI[0] != 3f) - { - SoundEngine.PlaySound(AstrumDeusHead.SplitSound, player.Center); - calamityGlobalNPC.newAI[0] = 3f; - npc.defense = 12; - calamityGlobalNPC.DR = 0.075f; - - // Despawns the other deus worm segments - int bodyID = ModContent.NPCType(); - int tailID = ModContent.NPCType(); - for (int i = 0; i < Main.maxNPCs; i++) - { - NPC wormseg = Main.npc[i]; - if (!wormseg.active) - continue; - - if ((wormseg.type == bodyID || wormseg.type == tailID) && Main.npc[(int)wormseg.ai[2]].Calamity().newAI[0] != 3f) - { - wormseg.life = 0; - wormseg.active = false; - } - } - } - - calamityGlobalNPC.newAI[2] += 10f; - if (calamityGlobalNPC.newAI[2] > 162f) - calamityGlobalNPC.newAI[2] = 162f; - - npc.Opacity = MathHelper.Clamp(1f - (calamityGlobalNPC.newAI[2] / splitAnimationTime), 0f, 1f); - } - - bool despawnRemainingWorm = doubleWormPhase && oneWormAlive && !death; - if ((halfHealth && calamityGlobalNPC.newAI[0] == 0f) || despawnRemainingWorm) - { - npc.dontTakeDamage = true; - - calamityGlobalNPC.newAI[2] += despawnRemainingWorm ? 10f : 1f; - npc.Opacity = MathHelper.Clamp(1f - (calamityGlobalNPC.newAI[2] / splitAnimationTime), 0f, 1f); - - bool despawning = calamityGlobalNPC.newAI[2] == splitAnimationTime; - - // - // CODE TWEAKED BY: OZZATRON - // September 20th, 2020 - // reason: fixing Astrum Deus death mode NPC cap bug - // - - // Despawn the unsplit Astrum Deus and spawn two half-size Astrum Deus worms. - if (despawning) - { - // If this is already a split worm (newAI[0] != 0f) then don't do anything. At all. - if (doubleWormPhase) - return; - - // Mark all existing body and tail segments as inactive. This instantly frees up their NPC slots for the freshly spawned worms. - int bodyID = ModContent.NPCType(); - int tailID = ModContent.NPCType(); - for (int i = 0; i < Main.maxNPCs; i++) - { - NPC wormseg = Main.npc[i]; - if (!wormseg.active) - continue; - if (wormseg.type == bodyID || wormseg.type == tailID) - { - wormseg.life = 0; - wormseg.active = false; - } - } - - // The unsplit Astrum Deus worm head will die next frame. - npc.life = 0; - - // Do not spawn worms client side. The server handles this. - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int wormamt = Main.zenithWorld ? 5 : 1; - for (int i = 0; i < wormamt; i++) - { - // Now that the original worm doesn't exist, startCount can be zero. - // int startCount = npc.whoAmI + phase1Length + 1; - int startIndexHeadOne = 1; - int headOneID = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, npc.type, startIndexHeadOne); - Main.npc[headOneID].Calamity().newAI[0] = 1f; - Main.npc[headOneID].velocity = Vector2.Normalize(player.Center - Main.npc[headOneID].Center) * 16f; - Main.npc[headOneID].timeLeft *= 20; - Main.npc[headOneID].netSpam = 0; - Main.npc[headOneID].netUpdate = true; - - // On server, immediately send the correct extra AI of this head to clients. - if (Main.netMode == NetmodeID.Server) - { - var netMessage = mod.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.SyncCalamityNPCAIArray); - netMessage.Write((byte)headOneID); - netMessage.Write(Main.npc[headOneID].Calamity().newAI[0]); - netMessage.Write(Main.npc[headOneID].Calamity().newAI[1]); - netMessage.Write(Main.npc[headOneID].Calamity().newAI[2]); - netMessage.Write(Main.npc[headOneID].Calamity().newAI[3]); - netMessage.Send(); - } - - // Make sure the second split worm is also contiguous. - int startIndexHeadTwo = startIndexHeadOne + phase2Length + 1; - int headTwoID = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, npc.type, startIndexHeadTwo); - Main.npc[headTwoID].Calamity().newAI[0] = 2f; - Main.npc[headTwoID].Calamity().newAI[3] = Main.getGoodWorld ? 300f : 600f; - Main.npc[headTwoID].velocity = Vector2.Normalize(player.Center - Main.npc[headTwoID].Center) * 16f; - Main.npc[headTwoID].timeLeft *= 20; - Main.npc[headTwoID].netSpam = 0; - Main.npc[headTwoID].netUpdate = true; - - // On server, immediately send the correct extra AI of this head to clients. - if (Main.netMode == NetmodeID.Server) - { - var netMessage = mod.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.SyncCalamityNPCAIArray); - netMessage.Write((byte)headTwoID); - netMessage.Write(Main.npc[headTwoID].Calamity().newAI[0]); - netMessage.Write(Main.npc[headTwoID].Calamity().newAI[1]); - netMessage.Write(Main.npc[headTwoID].Calamity().newAI[2]); - netMessage.Write(Main.npc[headTwoID].Calamity().newAI[3]); - netMessage.Send(); - } - } - - SoundEngine.PlaySound(AstrumDeusHead.SplitSound, player.Center); - } - return; - } - } - - if (Main.zenithWorld && calamityGlobalNPC.newAI[1] < 10f) // desync the deuses - { - float pushForce = 0.25f; - for (int k = 0; k < Main.maxNPCs; k++) - { - NPC otherDeus = Main.npc[k]; - // Short circuits to make the loop as fast as possible - if (!otherDeus.active || k == npc.whoAmI) - continue; - - // If the other projectile is indeed the same owned by the same player and they're too close, nudge them away. - bool sameProjType = otherDeus.type == npc.type; - float taxicabDist = Vector2.Distance(npc.Center, otherDeus.Center); - float distancegate = 320f; - if (sameProjType && taxicabDist < distancegate) - { - if (npc.position.X < otherDeus.position.X) - npc.velocity.X -= pushForce; - else - npc.velocity.X += pushForce; - - if (npc.position.Y < otherDeus.position.Y) - npc.velocity.Y -= pushForce; - else - npc.velocity.Y += pushForce; - } - } - } - } - - // Copy dontTakeDamage and Opacity from head - else - { - npc.dontTakeDamage = Main.npc[(int)npc.ai[2]].dontTakeDamage; - npc.Opacity = Main.npc[(int)npc.ai[2]].Opacity; - deathModeEnragePhase_BodyAndTail = Main.npc[(int)npc.ai[2]].Calamity().newAI[0] == 3f; - - if (deathModeEnragePhase_BodyAndTail) - { - npc.defense = 25; - calamityGlobalNPC.DR = 0.15f; - } - } - - // Set worm variable - if (npc.ai[2] > 0f) - npc.realLife = (int)npc.ai[2]; - - // Alpha effects - if ((head || Main.npc[(int)npc.ai[1]].alpha < 128) && !npc.dontTakeDamage) - { - // Alpha changes - npc.alpha -= 42; - if (npc.alpha < 0) - npc.alpha = 0; - } - - // Check if other segments are still alive, if not, die - if (npc.type != ModContent.NPCType()) - { - bool shouldDespawn = true; - int headType = ModContent.NPCType(); - for (int i = 0; i < Main.maxNPCs; i++) - { - if (Main.npc[i].type != headType || !Main.npc[i].active) - continue; - shouldDespawn = false; - break; - } - if (shouldDespawn) - { - if (Main.npc.IndexInRange((int)npc.ai[1]) && Main.npc[(int)npc.ai[1]].active && Main.npc[(int)npc.ai[1]].life > 0) - shouldDespawn = false; - } - if (shouldDespawn) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - npc.active = false; - - npc.netUpdate = true; - - // Prevent netUpdate from being blocked by the spam counter. - if (npc.netSpam >= 10) - npc.netSpam = 9; - } - } - - // Direction - if (npc.velocity.X < 0f) - npc.spriteDirection = -1; - else if (npc.velocity.X > 0f) - npc.spriteDirection = 1; - - // Head code - if (head) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (npc.ai[0] == 0f) - { - int Previous = npc.whoAmI; - int bodyType = ModContent.NPCType(); - int tailType = ModContent.NPCType(); - for (int segments = 0; segments < maxLength; segments++) - { - int lol; - if (segments >= 0 && segments < maxLength - 1) - lol = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), bodyType, npc.whoAmI); - else - lol = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), tailType, npc.whoAmI); - - if (segments % 2 == 0) - Main.npc[lol].localAI[3] = 1f; - - Main.npc[lol].realLife = npc.whoAmI; - Main.npc[lol].Calamity().newAI[0] = Main.npc[Previous].Calamity().newAI[0]; - Main.npc[lol].Calamity().newAI[3] = Main.npc[Previous].Calamity().newAI[3]; - if (Main.netMode == NetmodeID.Server) - { - var netMessage = mod.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.SyncCalamityNPCAIArray); - netMessage.Write((byte)lol); - netMessage.Write(Main.npc[lol].Calamity().newAI[0]); - netMessage.Write(Main.npc[lol].Calamity().newAI[1]); - netMessage.Write(Main.npc[lol].Calamity().newAI[2]); - netMessage.Write(Main.npc[lol].Calamity().newAI[3]); - netMessage.Send(); - } - Main.npc[lol].ai[2] = npc.whoAmI; - Main.npc[lol].ai[1] = Previous; - Main.npc[Previous].ai[0] = lol; - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, lol, 0f, 0f, 0f, 0); - Previous = lol; - } - } - } - } - - if (head) - { - int headTilePositionX = (int)(npc.position.X / 16f) - 1; - int headTileWidthPosX = (int)((npc.position.X + npc.width) / 16f) + 2; - int headTilePositionY = (int)(npc.position.Y / 16f) - 1; - int headTileWidthPosY = (int)((npc.position.Y + npc.height) / 16f) + 2; - - if (headTilePositionX < 0) - headTilePositionX = 0; - if (headTileWidthPosX > Main.maxTilesX) - headTileWidthPosX = Main.maxTilesX; - if (headTilePositionY < 0) - headTilePositionY = 0; - if (headTileWidthPosY > Main.maxTilesY) - headTileWidthPosY = Main.maxTilesY; - - // Fly or not - bool shouldFly = flyAtTarget; - if (!shouldFly) - { - for (int k = headTilePositionX; k < headTileWidthPosX; k++) - { - for (int l = headTilePositionY; l < headTileWidthPosY; l++) - { - if (Main.tile[k, l] != null && ((Main.tile[k, l].HasUnactuatedTile && (Main.tileSolid[Main.tile[k, l].TileType] || (Main.tileSolidTop[Main.tile[k, l].TileType] && Main.tile[k, l].TileFrameY == 0))) || Main.tile[k, l].LiquidAmount > 64)) - { - Vector2 vector2; - vector2.X = k * 16f; - vector2.Y = l * 16f; - if (npc.position.X + npc.width > vector2.X && npc.position.X < vector2.X + 16f && npc.position.Y + npc.height > vector2.Y && npc.position.Y < vector2.Y + 16f) - { - shouldFly = true; - break; - } - } - } - } - } - - // Start flying if target is not within a certain distance - if (!shouldFly) - { - npc.localAI[1] = 1f; - - Rectangle rectangle = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); - int noFlyZone = 200; - int heightReduction = death ? 130 : (int)(130f * (1f - lifeRatio)); - int height = 400 - heightReduction; - bool outsideNoFlyZone = true; - - if (npc.position.Y > player.position.Y) - { - for (int m = 0; m < Main.maxPlayers; m++) - { - if (Main.player[m].active) - { - Rectangle rectangle2 = new Rectangle((int)Main.player[m].position.X - noFlyZone, (int)Main.player[m].position.Y - noFlyZone, noFlyZone * 2, height); - if (rectangle.Intersects(rectangle2)) - { - outsideNoFlyZone = false; - break; - } - } - } - if (outsideNoFlyZone) - shouldFly = true; - } - } - else - npc.localAI[1] = 0f; - - // Despawn - float fallSpeed = deathModeEnragePhase_Head ? 19f : death ? 17.5f : 16f; - if (player.dead) - { - shouldFly = false; - float velocity = 2f; - npc.velocity.Y -= velocity; - if ((double)npc.position.Y < Main.topWorld + 16f) - { - fallSpeed = deathModeEnragePhase_Head ? 38f : death ? 35f : 32f; - npc.velocity.Y -= velocity; - } - - int headType = ModContent.NPCType(); - int bodyType = ModContent.NPCType(); - int tailType = ModContent.NPCType(); - if ((double)npc.position.Y < Main.topWorld + 16f) - { - for (int i = 0; i < Main.maxNPCs; i++) - { - if (Main.npc[i].type == headType || Main.npc[i].type == bodyType || Main.npc[i].type == tailType) - { - Main.npc[i].active = false; - - Main.npc[i].netUpdate = true; - - // Prevent netUpdate from being blocked by the spam counter. - if (Main.npc[i].netSpam >= 10) - Main.npc[i].netSpam = 9; - } - } - } - } - - float fallSpeedBoost = 5f * (1f - lifeRatio); - fallSpeed += fallSpeedBoost; - fallSpeed += 4f * enrageScale; - - // Speed and movement - float speedBoost = death ? (0.1f * (1f - lifeRatio)) : (0.13f * (1f - lifeRatio)); - float turnSpeedBoost = death ? (0.18f * (1f - lifeRatio)) : (0.2f * (1f - lifeRatio)); - float speed = (deathModeEnragePhase_Head ? 0.2f : death ? 0.18f : 0.13f) + speedBoost; - float turnSpeed = (deathModeEnragePhase_Head ? 0.27f : death ? 0.25f : 0.2f) + turnSpeedBoost; - speed += 0.05f * enrageScale; - turnSpeed += 0.08f * enrageScale; - - if (flyAtTarget) - { - float speedMultiplier = deathModeEnragePhase_Head ? 1.25f : doubleWormPhase ? (phase3 ? 1.25f : phase2 ? 1.2f : 1.15f) : 1f; - speed *= speedMultiplier; - } - - if (revenge) - { - float revMultiplier = 1.1f; - speed *= revMultiplier; - turnSpeed *= revMultiplier; - fallSpeed *= revMultiplier; - } - - speed *= increaseSpeedMore ? 2f : increaseSpeed ? 1.5f : 1f; - turnSpeed *= increaseSpeedMore ? 2f : increaseSpeed ? 1.5f : 1f; - - if (Main.getGoodWorld) - { - speed *= 1.15f; - turnSpeed *= 1.15f; - } - - Vector2 deusCenter = npc.Center; - float deusTargetX = player.position.X + (player.width / 2); - float deusTargetY = player.position.Y + (player.height / 2); - deusTargetX = (int)(deusTargetX / 16f) * 16; - deusTargetY = (int)(deusTargetY / 16f) * 16; - deusCenter.X = (int)(deusCenter.X / 16f) * 16; - deusCenter.Y = (int)(deusCenter.Y / 16f) * 16; - deusTargetX -= deusCenter.X; - deusTargetY -= deusCenter.Y; - - if (!shouldFly) - { - npc.velocity.Y += 0.15f; - if (npc.velocity.Y > fallSpeed) - npc.velocity.Y = fallSpeed; - - if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < fallSpeed * 0.4) - { - if (npc.velocity.X < 0f) - npc.velocity.X -= speed * 1.1f; - else - npc.velocity.X += speed * 1.1f; - } - else if (npc.velocity.Y == fallSpeed) - { - if (npc.velocity.X < deusTargetX) - npc.velocity.X += speed; - else if (npc.velocity.X > deusTargetX) - npc.velocity.X -= speed; - } - else if (npc.velocity.Y > 4f) - { - if (npc.velocity.X < 0f) - npc.velocity.X += speed * 0.9f; - else - npc.velocity.X -= speed * 0.9f; - } - } - else - { - float deusTargetDist = (float)Math.Sqrt(deusTargetX * deusTargetX + deusTargetY * deusTargetY); - float deusAbsoluteTargetX = Math.Abs(deusTargetX); - float deusAbsoluteTargetY = Math.Abs(deusTargetY); - float deusTimeToReachTarget = fallSpeed / deusTargetDist; - deusTargetX *= deusTimeToReachTarget; - deusTargetY *= deusTimeToReachTarget; - - bool speedUpWhileFlying = false; - if (flyAtTarget) - { - if (((npc.velocity.X > 0f && deusTargetX < 0f) || (npc.velocity.X < 0f && deusTargetX > 0f) || (npc.velocity.Y > 0f && deusTargetY < 0f) || (npc.velocity.Y < 0f && deusTargetY > 0f)) && Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) > speed / 2f && deusTargetDist < 400f) - { - speedUpWhileFlying = true; - - if (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) < fallSpeed) - npc.velocity *= 1.1f; - } - - if (npc.position.Y > player.position.Y) - { - speedUpWhileFlying = true; - - if (Math.Abs(npc.velocity.X) < fallSpeed / 2f) - { - if (npc.velocity.X == 0f) - npc.velocity.X -= npc.direction; - - npc.velocity.X *= 1.1f; - } - else if (npc.velocity.Y > -fallSpeed) - npc.velocity.Y -= speed; - } - } - - if (!speedUpWhileFlying) - { - if (!flyAtTarget) - { - if (((npc.velocity.X > 0f && deusTargetX > 0f) || (npc.velocity.X < 0f && deusTargetX < 0f)) && ((npc.velocity.Y > 0f && deusTargetY > 0f) || (npc.velocity.Y < 0f && deusTargetY < 0f))) - { - if (npc.velocity.X < deusTargetX) - npc.velocity.X += turnSpeed; - else if (npc.velocity.X > deusTargetX) - npc.velocity.X -= turnSpeed; - if (npc.velocity.Y < deusTargetY) - npc.velocity.Y += turnSpeed; - else if (npc.velocity.Y > deusTargetY) - npc.velocity.Y -= turnSpeed; - } - } - - if ((npc.velocity.X > 0f && deusTargetX > 0f) || (npc.velocity.X < 0f && deusTargetX < 0f) || (npc.velocity.Y > 0f && deusTargetY > 0f) || (npc.velocity.Y < 0f && deusTargetY < 0f)) - { - if (npc.velocity.X < deusTargetX) - npc.velocity.X += speed; - else if (npc.velocity.X > deusTargetX) - npc.velocity.X -= speed; - if (npc.velocity.Y < deusTargetY) - npc.velocity.Y += speed; - else if (npc.velocity.Y > deusTargetY) - npc.velocity.Y -= speed; - - if (Math.Abs(deusTargetY) < fallSpeed * 0.2 && ((npc.velocity.X > 0f && deusTargetX < 0f) || (npc.velocity.X < 0f && deusTargetX > 0f))) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y += speed * 2f; - else - npc.velocity.Y -= speed * 2f; - } - if (Math.Abs(deusTargetX) < fallSpeed * 0.2 && ((npc.velocity.Y > 0f && deusTargetY < 0f) || (npc.velocity.Y < 0f && deusTargetY > 0f))) - { - if (npc.velocity.X > 0f) - npc.velocity.X += speed * 2f; - else - npc.velocity.X -= speed * 2f; - } - } - else if (deusAbsoluteTargetX > deusAbsoluteTargetY) - { - if (npc.velocity.X < deusTargetX) - npc.velocity.X += speed * 1.1f; - else if (npc.velocity.X > deusTargetX) - npc.velocity.X -= speed * 1.1f; - - if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < fallSpeed * 0.5) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y += speed; - else - npc.velocity.Y -= speed; - } - } - else - { - if (npc.velocity.Y < deusTargetY) - npc.velocity.Y += speed * 1.1f; - else if (npc.velocity.Y > deusTargetY) - npc.velocity.Y -= speed * 1.1f; - - if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < fallSpeed * 0.5) - { - if (npc.velocity.X > 0f) - npc.velocity.X += speed; - else - npc.velocity.X -= speed; - } - } - } - } - - if (shouldFly) - { - if (npc.localAI[0] != 1f) - { - npc.netUpdate = true; - - // Prevent netUpdate from being blocked by the spam counter. - if (npc.netSpam >= 10) - npc.netSpam = 9; - } - - npc.localAI[0] = 1f; - } - else - { - if (npc.localAI[0] != 0f) - { - npc.netUpdate = true; - - // Prevent netUpdate from being blocked by the spam counter. - if (npc.netSpam >= 10) - npc.netSpam = 9; - } - - npc.localAI[0] = 0f; - } - - if (((npc.velocity.X > 0f && npc.oldVelocity.X < 0f) || (npc.velocity.X < 0f && npc.oldVelocity.X > 0f) || (npc.velocity.Y > 0f && npc.oldVelocity.Y < 0f) || (npc.velocity.Y < 0f && npc.oldVelocity.Y > 0f)) && !npc.justHit) - { - npc.netUpdate = true; - - // Prevent netUpdate from being blocked by the spam counter. - if (npc.netSpam >= 10) - npc.netSpam = 9; - } - - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) + MathHelper.PiOver2; - } - - // Only the main worm body and tail use this code - else - { - // Shoot lasers - if (npc.type == ModContent.NPCType()) - { - npc.localAI[0] += 1f; - - int shootTime = (doubleWormPhase && expertMode) ? 2 : 1; - float shootProjectile = (doubleWormPhase && expertMode) ? 200 : 400; - float timer = npc.ai[0] + 15f; - float divisor = timer + shootProjectile; - bool shootGodRays = phase2 || deathModeEnragePhase_BodyAndTail; - if (!flyAtTarget || deathModeEnragePhase_BodyAndTail) - { - float laserDivisor = (phase2 && !deathModeEnragePhase_BodyAndTail) ? 4f : 2f; - if (npc.localAI[0] % divisor == 0f && npc.ai[0] % laserDivisor == 0f) - { - npc.TargetClosest(); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (deathModeEnragePhase_BodyAndTail) - { - Vector2 velocity = Vector2.Zero; - if (movingMines) - { - Vector2 randomMineMovement = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101)); - randomMineMovement.Normalize(); - randomMineMovement *= Main.rand.Next(90, 121) * 0.01f; - velocity = randomMineMovement; - } - - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - float split = (splittingMines && npc.ai[0] % 3f == 0f) ? 1f : 0f; - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, velocity, type, damage, 0f, Main.myPlayer, split, 0f); - } - } - - if (Vector2.Distance(player.Center, npc.Center) > 80f) - { - SoundEngine.PlaySound(AstrumDeusHead.LaserSound, npc.Center); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - float deusLaserSpeed = (death ? 16f : revenge ? 14f : 13f) + enrageScale * 4f; - Vector2 deusLaserCenter = npc.Center; - float deusLaserTargetX = player.position.X + player.width * 0.5f - deusLaserCenter.X; - float deusLaserTargetY = player.position.Y + player.height * 0.5f - deusLaserCenter.Y; - float deusLaserTargetDist = (float)Math.Sqrt(deusLaserTargetX * deusLaserTargetX + deusLaserTargetY * deusLaserTargetY); - deusLaserTargetDist = deusLaserSpeed / deusLaserTargetDist; - deusLaserTargetX *= deusLaserTargetDist; - deusLaserTargetY *= deusLaserTargetDist; - deusLaserCenter.X += deusLaserTargetX * 5f; - deusLaserCenter.Y += deusLaserTargetY * 5f; - Vector2 shootDirection = new Vector2(deusLaserTargetX, deusLaserTargetY).SafeNormalize(Vector2.UnitY); - Vector2 laserVelocity = shootDirection * deusLaserSpeed; - int type = shootGodRays ? ModContent.ProjectileType() : ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - if (shootGodRays) - { - // Waving beams need to start offset so they cross each other neatly. - float waveSideOffset = Main.rand.NextFloat(9f, 14f); - Vector2 perp = shootDirection.RotatedBy(-MathHelper.PiOver2) * waveSideOffset; - - for (int i = -1; i <= 1; i += 2) - { - Vector2 laserStartPos = deusLaserCenter + i * perp + Main.rand.NextVector2CircularEdge(6f, 6f); - Projectile godRay = Projectile.NewProjectileDirect(npc.GetSource_FromAI(), laserStartPos, laserVelocity, type, damage, 0f, Main.myPlayer, player.Center.X, player.Center.Y); - - // Tell this Phased God Ray exactly which way it should be waving. - godRay.localAI[1] = i * 0.5f; - } - } - else - Projectile.NewProjectile(npc.GetSource_FromAI(), deusLaserCenter, laserVelocity, type, damage, 0f, Main.myPlayer, player.Center.X, player.Center.Y); - } - } - } - } - else - { - if (npc.localAI[0] % divisor == 0f && npc.ai[0] % 2f == 0f) - { - Vector2 velocity = Vector2.Zero; - if (movingMines) - { - Vector2 randomMineMovement = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101)); - randomMineMovement.Normalize(); - randomMineMovement *= Main.rand.Next(30, 121) * 0.01f; - velocity = randomMineMovement; - } - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - float split = (splittingMines && npc.ai[0] % 3f == 0f) ? 1f : 0f; - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, velocity, type, damage, 0f, Main.myPlayer, split, 0f); - } - } - } - - // Follow the head - Vector2 segmentCenter = npc.Center; - float segmentTargetX = player.position.X + (player.width / 2); - float segmentTargetY = player.position.Y + (player.height / 2); - segmentTargetX = (int)(segmentTargetX / 16f) * 16; - segmentTargetY = (int)(segmentTargetY / 16f) * 16; - segmentCenter.X = (int)(segmentCenter.X / 16f) * 16; - segmentCenter.Y = (int)(segmentCenter.Y / 16f) * 16; - segmentTargetX -= segmentCenter.X; - segmentTargetY -= segmentCenter.Y; - - if (npc.ai[1] > 0f && npc.ai[1] < Main.npc.Length) - { - try - { - segmentCenter = npc.Center; - segmentTargetX = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - segmentCenter.X; - segmentTargetY = Main.npc[(int)npc.ai[1]].position.Y + (Main.npc[(int)npc.ai[1]].height / 2) - segmentCenter.Y; - } - catch - { - } - - npc.rotation = (float)Math.Atan2(segmentTargetY, segmentTargetX) + MathHelper.PiOver2; - float segmentTargetDist = (float)Math.Sqrt(segmentTargetX * segmentTargetX + segmentTargetY * segmentTargetY); - int segmentWidth = npc.width; - segmentTargetDist = (segmentTargetDist - segmentWidth) / segmentTargetDist; - segmentTargetX *= segmentTargetDist; - segmentTargetY *= segmentTargetDist; - npc.velocity = Vector2.Zero; - npc.position.X = npc.position.X + segmentTargetX; - npc.position.Y = npc.position.Y + segmentTargetY; - - if (segmentTargetX < 0f) - npc.spriteDirection = -1; - else if (segmentTargetX > 0f) - npc.spriteDirection = 1; - } - } - } - #endregion - - #region Ceaseless Void - public static void CeaselessVoidAI(NPC npc, Mod mod) - { - CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - - CalamityGlobalNPC.voidBoss = npc.whoAmI; - - // Percent life remaining - double lifeRatio = npc.life / (double)npc.lifeMax; - - // Difficulty modes - bool bossRush = BossRushEvent.BossRushActive; - bool expertMode = Main.expertMode || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool death = CalamityWorld.death || bossRush; - - // Phases - bool phase2 = lifeRatio <= 0.7; - bool phase3 = lifeRatio <= 0.4; - bool phase4 = lifeRatio <= 0.1; - bool theBigSucc = npc.life / (double)npc.lifeMax <= 0.1; - bool succSoHardThatYouDie = npc.life / (double)npc.lifeMax <= 0.005; - - // Spawn Dark Energies - int darkEnergyAmt = death ? 6 : revenge ? 5 : expertMode ? 4 : 3; - if (phase2) - darkEnergyAmt += 1; - if (phase3) - darkEnergyAmt += 1; - if (phase4) - darkEnergyAmt += 1; - - if (Main.getGoodWorld) - darkEnergyAmt *= 2; - - // Spawn a few Dark Energies as soon as the fight starts - int spacing = 360 / darkEnergyAmt; - int distance2 = 10; - if (npc.ai[2] == 0f) - { - npc.ai[2] = 1f; - for (int i = 0; i < darkEnergyAmt; i++) - { - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(i * spacing) * distance2)), (int)(npc.Center.Y + (Math.Cos(i * spacing) * distance2)), ModContent.NPCType(), npc.whoAmI, i * spacing, 0f, 0f, 0f); - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(i * spacing) * distance2)), (int)(npc.Center.Y + (Math.Cos(i * spacing) * distance2)), ModContent.NPCType(), npc.whoAmI, i * spacing, 1f, 0f, 0f); - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(i * spacing) * distance2)), (int)(npc.Center.Y + (Math.Cos(i * spacing) * distance2)), ModContent.NPCType(), npc.whoAmI, i * spacing, 2f, 0f, 0f); - } - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(0) * distance2)), (int)(npc.Center.Y + (Math.Cos(0) * distance2)), ModContent.NPCType(), npc.whoAmI, 0f, 0.5f, 0f, 0f); - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(0) * distance2)), (int)(npc.Center.Y + (Math.Cos(0) * distance2)), ModContent.NPCType(), npc.whoAmI, 0f, 1.5f, 0f, 0f); - } - - // If there are any Dark Energies alive, change AI and don't take damage - bool anyDarkEnergies = NPC.AnyNPCs(ModContent.NPCType()); - bool movingDuringSuccPhase = npc.ai[3] == 0f; - npc.dontTakeDamage = anyDarkEnergies || theBigSucc || movingDuringSuccPhase; - - // Get a target - 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]; - - // Speed enrage - bool moveVeryFast = Vector2.Distance(npc.Center, player.Center) > 960f || (!player.ZoneDungeon && !bossRush && player.position.Y < Main.worldSurface * 16.0); - - // Despawn - if (!player.active || player.dead || Vector2.Distance(player.Center, npc.Center) > 5600f) - { - npc.TargetClosest(false); - player = Main.player[npc.target]; - if (!player.active || player.dead || Vector2.Distance(player.Center, npc.Center) > 5600f) - { - if (npc.velocity.Y > 3f) - npc.velocity.Y = 3f; - npc.velocity.Y -= 0.1f; - if (npc.velocity.Y < -12f) - npc.velocity.Y = -12f; - - if (npc.timeLeft > 60) - npc.timeLeft = 60; - - return; - } - } - else if (npc.timeLeft < 1800) - npc.timeLeft = 1800; - - float tileEnrageMult = (CalamityWorld.LegendaryMode && revenge) ? 1.5f : bossRush ? 1.375f : 1f; - npc.Calamity().CurrentlyEnraged = tileEnrageMult > 1f && !bossRush; - - // Set AI variable to be used by Dark Energies - npc.ai[1] = tileEnrageMult; - - // Increase projectile fire rate based on number of nearby active tiles - float projectileFireRateMultiplier = MathHelper.Lerp(0.5f, 1.5f, 1f - ((tileEnrageMult - 1f) / 0.5f)); - - // Succ attack - if (!anyDarkEnergies) - { - // This is here because it's used in multiple places - float suckDistance = (CalamityWorld.LegendaryMode && revenge) ? 2400f : bossRush ? 1920f : death ? 1600f : revenge ? 1440f : expertMode ? 1280f : 1040f; - - // Move closer to the target before trying to succ - if (movingDuringSuccPhase) - { - if (Vector2.Distance(npc.Center, player.Center) > 320f || !Collision.CanHit(npc.Center, 1, 1, player.Center, 1, 1)) - Movement(true); - else - npc.ai[3] = 1f; - } - else - { - // Use this to generate more and more dust in final phase - float finalPhaseDustRatio = 1f; - if (succSoHardThatYouDie) - { - finalPhaseDustRatio = 5f; - } - else if (theBigSucc) - { - float amount = (10f - (float)(npc.life / (double)npc.lifeMax) * 100f) / 10f; - finalPhaseDustRatio += MathHelper.Lerp(0f, 2f, amount); - } - - // Slow down - if (npc.velocity.Length() > 0.5f) - npc.velocity *= 0.8f; - else - npc.velocity = Vector2.Zero; - - // Move towards target again if they get outside the succ radius - float moveCloserGateValue = suckDistance * 0.75f; - if (Vector2.Distance(npc.Center, player.Center) > moveCloserGateValue) - npc.ai[3] = 0f; - - // Ceaseless Void sucks in dark energy in different patterns - // This attack also sucks in all players that are within reach of the succ - int dustRings = 3; - for (int h = 0; h < dustRings; h++) - { - float distanceDivisor = h + 1f; - float dustDistance = suckDistance / distanceDivisor; - int numDust = (int)(0.1f * MathHelper.TwoPi * dustDistance); - float angleIncrement = MathHelper.TwoPi / numDust; - Vector2 dustOffset = new Vector2(dustDistance, 0f); - dustOffset = dustOffset.RotatedByRandom(MathHelper.TwoPi); - - int var = (int)(dustDistance / finalPhaseDustRatio); - float dustVelocity = 24f / distanceDivisor * finalPhaseDustRatio; - for (int i = 0; i < numDust; i++) - { - if (Main.rand.NextBool(var)) - { - dustOffset = dustOffset.RotatedBy(angleIncrement); - int dust = Dust.NewDust(npc.Center, 1, 1, ModContent.DustType()); - Main.dust[dust].position = npc.Center + dustOffset; - Main.dust[dust].fadeIn = 1f; - Main.dust[dust].velocity = Vector2.Normalize(npc.Center - Main.dust[dust].position) * dustVelocity; - Main.dust[dust].scale = 3f - h; - } - } - } - - float succPower = 0.125f + finalPhaseDustRatio * 0.125f; - for (int i = 0; i < Main.maxPlayers; i++) - { - float distance = Vector2.Distance(Main.player[i].Center, npc.Center); - if (distance < suckDistance && Main.player[i].grappling[0] == -1) - { - if (Collision.CanHit(npc.Center, 1, 1, Main.player[i].Center, 1, 1)) - { - float distanceRatio = distance / suckDistance; - float multiplier = 1f - distanceRatio; - - if (Main.player[i].Center.X < npc.Center.X) - Main.player[i].velocity.X += succPower * multiplier; - else - Main.player[i].velocity.X -= succPower * multiplier; - } - } - } - - // Slowly die in final phase and then implode - // This phase lasts 20 seconds - if (theBigSucc && calamityGlobalNPC.newAI[1] % 60f == 0f) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int damageAmt = npc.lifeMax / 200; - npc.life -= damageAmt; - npc.HealEffect(-damageAmt, true); - } - - if (npc.life <= ((npc.lifeMax / 200) * 5) && !npc.ModNPC().playedbuildsound) - { - SoundEngine.PlaySound(CeaselessVoid.CeaselessVoid.BuildupSound, npc.Center); - npc.ModNPC().playedbuildsound = true; - } - - if (npc.life <= 0) - { - npc.life = 0; - npc.HitEffect(); - npc.checkDead(); - } - - npc.netUpdate = true; - } - - // Beam Portals - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (calamityGlobalNPC.newAI[1] == 0f) - { - int numBeamPortals = bossRush ? 4 : revenge ? 3 : 2; - float degrees = 360 / numBeamPortals; - float beamPortalDistance = bossRush ? 360f : death ? 400f : revenge ? 420f : expertMode ? 440f : 480f; - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - for (int i = 0; i < numBeamPortals; i++) - { - float ai1 = i * degrees; - Projectile.NewProjectile(npc.GetSource_FromAI(), player.Center.X + (float)(Math.Sin(i * degrees) * beamPortalDistance), player.Center.Y + (float)(Math.Cos(i * degrees) * beamPortalDistance), 0f, 0f, type, damage, 0f, Main.myPlayer, ai1, 0f); - } - } - } - - // Use this timer to lessen Dark Energy projectile rate of fire while Beam Portals are active - float beamPortalTimeLeft = 600f; - bool summonLessDarkEnergies = false; - if (calamityGlobalNPC.newAI[1] < beamPortalTimeLeft) - { - calamityGlobalNPC.newAI[1] += 1f; - summonLessDarkEnergies = true; - } - else if (theBigSucc) - calamityGlobalNPC.newAI[1] += 1f; - - // Suck in Dark Energy projectiles from far away - calamityGlobalNPC.newAI[3] += 1f; - float darkEnergySpiralGateValue = (summonLessDarkEnergies ? 24f : 12f) * projectileFireRateMultiplier; - if (calamityGlobalNPC.newAI[3] >= darkEnergySpiralGateValue) - { - calamityGlobalNPC.newAI[3] = 0f; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - bool normalSpread = npc.localAI[0] % 2f == 0f; - float speed = 0.5f; - int totalProjectiles = 4; - float radians = MathHelper.TwoPi / totalProjectiles; - double angleA = radians * 0.5; - double angleB = MathHelper.ToRadians(90f) - angleA; - float velocityX = (float)(speed * Math.Sin(angleA) / Math.Sin(angleB)); - Vector2 spinningPoint = normalSpread ? new Vector2(0f, -speed) : new Vector2(-velocityX, -speed); - float radialOffset = MathHelper.ToRadians(npc.localAI[1]); - for (int i = 0; i < totalProjectiles; i++) - { - Vector2 spawnVector = npc.Center + Vector2.Normalize(spinningPoint.RotatedBy(radians * i + radialOffset)) * suckDistance; - Vector2 velocity = Vector2.Normalize(npc.Center - spawnVector) * speed; - Projectile.NewProjectile(npc.GetSource_FromAI(), spawnVector, velocity, type, damage, 0f, Main.myPlayer); - } - } - - npc.localAI[1] += 10f; - } - - // Summon some extra projectiles in Expert Mode - if (phase2 && expertMode) - { - npc.localAI[2] += 1f; - if (npc.localAI[2] >= 60f * projectileFireRateMultiplier) - { - npc.localAI[2] = 0f; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - bool normalSpread = npc.localAI[0] % 2f != 0f; - float speed = 2f; - int totalProjectiles = 2; - float radians = MathHelper.TwoPi / totalProjectiles; - double angleA = radians * 0.5; - double angleB = MathHelper.ToRadians(90f) - angleA; - float velocityX = (float)(speed * Math.Sin(angleA) / Math.Sin(angleB)); - Vector2 spinningPoint = normalSpread ? new Vector2(0f, -speed) : new Vector2(-velocityX, -speed); - float radialOffset = MathHelper.ToRadians(npc.localAI[1] * 0.25f); - for (int i = 0; i < totalProjectiles; i++) - { - Vector2 spawnVector = npc.Center + Vector2.Normalize(spinningPoint.RotatedBy(radians * i + radialOffset)) * suckDistance; - Vector2 velocity = Vector2.Normalize(npc.Center - spawnVector) * speed; - Projectile.NewProjectile(npc.GetSource_FromAI(), spawnVector, velocity, type, damage, 0f, Main.myPlayer); - } - } - } - } - - // Summon some extra projectiles in Revengeance Mode - if (phase4 && revenge) - { - npc.localAI[3] += 1f; - if (npc.localAI[3] >= 90f * projectileFireRateMultiplier) - { - npc.localAI[3] = 0f; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - bool normalSpread = npc.localAI[0] % 2f == 0f; - float speed = 4f; - int totalProjectiles = 2; - float radians = MathHelper.TwoPi / totalProjectiles; - double angleA = radians * 0.5; - double angleB = MathHelper.ToRadians(90f) - angleA; - float velocityX = (float)(speed * Math.Sin(angleA) / Math.Sin(angleB)); - Vector2 spinningPoint = normalSpread ? new Vector2(0f, -speed) : new Vector2(-velocityX, -speed); - float radialOffset = MathHelper.ToRadians(npc.localAI[1] * 0.25f); - for (int i = 0; i < totalProjectiles; i++) - { - Vector2 spawnVector = npc.Center + Vector2.Normalize(spinningPoint.RotatedBy(radians * i + radialOffset)) * suckDistance; - Vector2 velocity = Vector2.Normalize(npc.Center - spawnVector) * speed; - Projectile.NewProjectile(npc.GetSource_FromAI(), spawnVector, velocity, type, damage, 0f, Main.myPlayer); - } - } - } - } - } - } - else - { - Movement(false); - - // Count up all Dark Energy HP values - int totalDarkEnergyHP = 0; - for (int i = 0; i < Main.maxNPCs; i++) - { - NPC darkEnergy = Main.npc[i]; - if (darkEnergy.active && darkEnergy.type == ModContent.NPCType()) - totalDarkEnergyHP += darkEnergy.life; - } - - // Destroy all Dark Energies if their total HP is below 20% - int darkEnergyMaxHP = bossRush ? DarkEnergy.MaxBossRushHP : DarkEnergy.MaxHP; - double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; - darkEnergyMaxHP += (int)(darkEnergyMaxHP * HPBoost); - int totalDarkEnergiesSpawned = darkEnergyAmt * 3 + 2; - int totalDarkEnergyMaxHP = darkEnergyMaxHP * totalDarkEnergiesSpawned; - int succPhaseGateValue = (int)(totalDarkEnergyMaxHP * 0.2); - if (totalDarkEnergyHP < succPhaseGateValue) - { - SoundEngine.PlaySound(SoundID.NPCDeath44, npc.Center); - - // Kill all Dark Energies - for (int i = 0; i < Main.maxNPCs; i++) - { - NPC darkEnergy = Main.npc[i]; - if (darkEnergy.active && darkEnergy.type == ModContent.NPCType()) - { - darkEnergy.HitEffect(); - darkEnergy.active = false; - darkEnergy.netUpdate = true; - } - } - - // Generate a dust explosion - int dustAmt = 30; - int random = 3; - for (int j = 0; j < 10; j++) - { - random += j * 2; - int dustAmtSpawned = 0; - int scale = random * 13; - float dustPositionX = npc.Center.X - (scale / 2); - float dustPositionY = npc.Center.Y - (scale / 2); - while (dustAmtSpawned < dustAmt) - { - float dustVelocityX = Main.rand.Next(-random, random); - float dustVelocityY = Main.rand.Next(-random, random); - float dustVelocityScalar = random * 2f; - float dustVelocity = (float)Math.Sqrt(dustVelocityX * dustVelocityX + dustVelocityY * dustVelocityY); - dustVelocity = dustVelocityScalar / dustVelocity; - dustVelocityX *= dustVelocity; - dustVelocityY *= dustVelocity; - int dust = Dust.NewDust(new Vector2(dustPositionX, dustPositionY), scale, scale, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 5f); - Main.dust[dust].noGravity = true; - Main.dust[dust].position.X = npc.Center.X; - Main.dust[dust].position.Y = npc.Center.Y; - Main.dust[dust].position.X += Main.rand.Next(-10, 11); - Main.dust[dust].position.Y += Main.rand.Next(-10, 11); - Main.dust[dust].velocity.X = dustVelocityX; - Main.dust[dust].velocity.Y = dustVelocityY; - dustAmtSpawned++; - } - } - } - } - - // Basic movement towards a location - 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; - - // Increase speed dramatically in succ phase - if (succ) - { - velocity *= 2f; - acceleration *= 2f; - } - - if (Main.getGoodWorld) - { - velocity *= 1.15f; - acceleration *= 1.15f; - } - - Vector2 destination = player.Center; - - // Move between 8 different positions around the player, in order - float maxDistance = 320f; - Vector2 moveToOffset = succ ? Vector2.Zero : new Vector2(0f, -maxDistance); - if (!succ) - { - // Move to a new location every few seconds - calamityGlobalNPC.newAI[2] += 1f; - float newPositionGateValue = bossRush ? 180f : death ? 270f : revenge ? 300f : expertMode ? 360f : 480f; - if (calamityGlobalNPC.newAI[2] > newPositionGateValue) - { - calamityGlobalNPC.newAI[2] = 0f; - - npc.ai[0] += 1f; - if (npc.ai[0] > 7f) - npc.ai[0] = 0f; - } - - switch ((int)npc.ai[0]) - { - case 0: - break; - case 1: - moveToOffset.X = -maxDistance; - break; - case 2: - moveToOffset.X = -maxDistance; - moveToOffset.Y = 0f; - break; - case 3: - moveToOffset.X = -maxDistance; - moveToOffset.Y = maxDistance; - break; - case 4: - moveToOffset.Y = maxDistance; - break; - case 5: - moveToOffset.X = maxDistance; - moveToOffset.Y = maxDistance; - break; - case 6: - moveToOffset.X = maxDistance; - moveToOffset.Y = 0f; - break; - case 7: - moveToOffset.X = maxDistance; - break; - } - } - - destination += moveToOffset; - - // How far Ceaseless Void is from where it's supposed to be - Vector2 distanceFromDestination = destination - npc.Center; - - // Movement - CalamityUtils.SmoothMovement(npc, 0f, distanceFromDestination, velocity, acceleration, true); - } - - // Spawn more Dark Energies as the fight progresses - if (calamityGlobalNPC.newAI[0] == 0f && npc.life > 0) - calamityGlobalNPC.newAI[0] = npc.lifeMax; - - if (npc.life > 0) - { - int healthGateValue = (int)(npc.lifeMax * 0.3); - if ((npc.life + healthGateValue) < calamityGlobalNPC.newAI[0]) - { - npc.TargetClosest(); - calamityGlobalNPC.newAI[0] = npc.life; - calamityGlobalNPC.newAI[1] = 0f; - calamityGlobalNPC.newAI[2] = 0f; - calamityGlobalNPC.newAI[3] = 0f; - npc.ai[3] = 0f; - npc.localAI[0] += 1f; - npc.localAI[1] = 0f; - npc.localAI[2] = 0f; - npc.localAI[3] = 0f; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (phase4) - { - for (int i = 0; i < darkEnergyAmt; i++) - { - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(i * spacing) * distance2)), (int)(npc.Center.Y + (Math.Cos(i * spacing) * distance2)), ModContent.NPCType(), npc.whoAmI, i * spacing, 0f, 0f, 0f); - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(i * spacing) * distance2)), (int)(npc.Center.Y + (Math.Cos(i * spacing) * distance2)), ModContent.NPCType(), npc.whoAmI, i * spacing, 2f, 0f, 0f); - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(i * spacing) * distance2)), (int)(npc.Center.Y + (Math.Cos(i * spacing) * distance2)), ModContent.NPCType(), npc.whoAmI, i * spacing, 4f, 0f, 0f); - } - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(0) * distance2)), (int)(npc.Center.Y + (Math.Cos(0) * distance2)), ModContent.NPCType(), npc.whoAmI, 0f, 1f, 0f, 0f); - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(0) * distance2)), (int)(npc.Center.Y + (Math.Cos(0) * distance2)), ModContent.NPCType(), npc.whoAmI, 0f, 3f, 0f, 0f); - } - else if (phase3) - { - for (int i = 0; i < darkEnergyAmt; i++) - { - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(i * spacing) * distance2)), (int)(npc.Center.Y + (Math.Cos(i * spacing) * distance2)), ModContent.NPCType(), npc.whoAmI, i * spacing, 0f, 0f, 0f); - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(i * spacing) * distance2)), (int)(npc.Center.Y + (Math.Cos(i * spacing) * distance2)), ModContent.NPCType(), npc.whoAmI, i * spacing, 1.5f, 0f, 0f); - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(i * spacing) * distance2)), (int)(npc.Center.Y + (Math.Cos(i * spacing) * distance2)), ModContent.NPCType(), npc.whoAmI, i * spacing, 3f, 0f, 0f); - } - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(0) * distance2)), (int)(npc.Center.Y + (Math.Cos(0) * distance2)), ModContent.NPCType(), npc.whoAmI, 0f, 0.5f, 0f, 0f); - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(0) * distance2)), (int)(npc.Center.Y + (Math.Cos(0) * distance2)), ModContent.NPCType(), npc.whoAmI, 0f, 2f, 0f, 0f); - } - else - { - for (int i = 0; i < darkEnergyAmt; i++) - { - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(i * spacing) * distance2)), (int)(npc.Center.Y + (Math.Cos(i * spacing) * distance2)), ModContent.NPCType(), npc.whoAmI, i * spacing, 0f, 0f, 0f); - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(i * spacing) * distance2)), (int)(npc.Center.Y + (Math.Cos(i * spacing) * distance2)), ModContent.NPCType(), npc.whoAmI, i * spacing, 1f, 0f, 0f); - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(i * spacing) * distance2)), (int)(npc.Center.Y + (Math.Cos(i * spacing) * distance2)), ModContent.NPCType(), npc.whoAmI, i * spacing, 2f, 0f, 0f); - } - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(0) * distance2)), (int)(npc.Center.Y + (Math.Cos(0) * distance2)), ModContent.NPCType(), npc.whoAmI, 0f, 1.5f, 0f, 0f); - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(0) * distance2)), (int)(npc.Center.Y + (Math.Cos(0) * distance2)), ModContent.NPCType(), npc.whoAmI, 0f, 2.5f, 0f, 0f); - } - } - - // Despawn potentially hazardous projectiles when entering a new phase - for (int i = 0; i < Main.maxProjectiles; i++) - { - Projectile projectile = Main.projectile[i]; - if (projectile.active) - { - if (projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType() || - projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType()) - { - if (projectile.timeLeft > 30) - projectile.timeLeft = 30; - } - } - } - } - } - } - #endregion - - #region Bumblebirb - public static void BumblebirbAI(NPC npc, Mod mod) - { - CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - - // Get a target - 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]; - - // Variables - float rotationMult = 3f; - float rotationAmt = 0.03f; - bool bossRush = BossRushEvent.BossRushActive; - bool expertMode = Main.expertMode || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool death = CalamityWorld.death || bossRush; - - // Adjust slowing debuff immunity - bool immuneToSlowingDebuffs = npc.ai[0] == 3f || npc.ai[0] == 3.1f || npc.ai[0] == 3.2f; - npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - npc.buffImmune[BuffID.Slow] = immuneToSlowingDebuffs; - npc.buffImmune[BuffID.Webbed] = immuneToSlowingDebuffs; - - // If target is outside the jungle for more than 5 seconds, enrage - if (!player.ZoneJungle) - { - if (npc.localAI[1] < CalamityGlobalNPC.biomeEnrageTimerMax) - npc.localAI[1] += 1f; - } - else - npc.localAI[1] = 0f; - - // If dragonfolly is off screen, enrage for the next couple attacks - if (Vector2.Distance(player.Center, npc.Center) > 1200f) - npc.localAI[2] = 2f; - - // Enrage scale - float enrageScale = death ? 1.5f : 1f; - if (npc.localAI[1] >= CalamityGlobalNPC.biomeEnrageTimerMax || bossRush) - { - npc.Calamity().CurrentlyEnraged = !bossRush; - enrageScale += 1f; - } - - if (npc.localAI[2] > 0f || bossRush) - enrageScale += 1f; - - if (Main.getGoodWorld) - enrageScale += 0.5f; - - if (enrageScale > 3f) - enrageScale = 3f; - - // Despawn - if (!player.active || player.dead || Vector2.Distance(player.Center, npc.Center) > 5600f) - { - npc.TargetClosest(false); - player = Main.player[npc.target]; - - if (!player.active || player.dead || Vector2.Distance(player.Center, npc.Center) > 5600f) - { - npc.rotation = (npc.rotation * rotationMult + npc.velocity.X * rotationAmt) / 10f; - - if (npc.velocity.Y > 3f) - npc.velocity.Y = 3f; - npc.velocity.Y -= 0.2f; - if (npc.velocity.Y < -12f) - npc.velocity.Y = -12f; - - if (npc.timeLeft > 60) - npc.timeLeft = 60; - - if (npc.ai[0] != 0f) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - - npc.netUpdate = true; - - // Prevent netUpdate from being blocked by the spam counter. - if (npc.netSpam >= 10) - npc.netSpam = 9; - } - - return; - } - } - else if (npc.timeLeft < 1800) - npc.timeLeft = 1800; - - // Percent life remaining - float lifeRatio = npc.life / (float)npc.lifeMax; - - // Phases - bool phase2 = lifeRatio < (revenge ? 0.75f : 0.5f); - bool phase3 = lifeRatio < (death ? 0.4f : revenge ? 0.25f : 0.1f) && expertMode; - - float birbSpawnPhaseTimer = 180f; - float newPhaseTimer = 180f; - bool phaseSwitchPhase = (phase2 && calamityGlobalNPC.newAI[0] < newPhaseTimer && calamityGlobalNPC.newAI[2] != 1f) || - (phase3 && calamityGlobalNPC.newAI[1] < newPhaseTimer && calamityGlobalNPC.newAI[3] != 1f); - - calamityGlobalNPC.DR = (phaseSwitchPhase || npc.ai[0] == 5f || (enrageScale == 3f && !bossRush)) ? (bossRush ? 0.99f : 0.55f) : 0.1f; - calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = phaseSwitchPhase || npc.ai[0] == 5f || (enrageScale == 3f && !bossRush); - - if (phaseSwitchPhase) - { - if (npc.velocity.X < 0f) - npc.direction = -1; - else if (npc.velocity.X > 0f) - npc.direction = 1; - - npc.spriteDirection = npc.direction; - npc.rotation = (npc.rotation * rotationMult + npc.velocity.X * rotationAmt) / 10f; - - if (phase3) - { - calamityGlobalNPC.newAI[1] += 1f; - - // Sound - if (calamityGlobalNPC.newAI[1] == newPhaseTimer - 60f) - { - float squawkpitch = Main.zenithWorld ? 1.3f : 0.25f; - SoundEngine.PlaySound(SoundID.DD2_BetsyScream with { Pitch = squawkpitch }, npc.Center); - - if (Main.zenithWorld) - { - int spacing = 20; - int amt = 5; - SoundEngine.PlaySound(CommonCalamitySounds.LightningSound, npc.Center - Vector2.UnitY * 300f); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - for (int i = 0; i < amt; i++) - { - Vector2 fireFrom = new Vector2(npc.Center.X + (spacing * i) - (spacing * amt / 2), npc.Center.Y - 900f); - Vector2 ai0 = npc.Center - fireFrom; - float ai = Main.rand.Next(100); - Vector2 velocity = Vector2.Normalize(ai0.RotatedByRandom(MathHelper.PiOver4)) * 7f; - Projectile.NewProjectile(npc.GetSource_FromAI(), fireFrom.X, fireFrom.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), npc.damage, 0f, Main.myPlayer, ai0.ToRotation(), ai); - } - } - } - } - - if (calamityGlobalNPC.newAI[1] >= newPhaseTimer) - { - calamityGlobalNPC.newAI[1] = 0f; - calamityGlobalNPC.newAI[2] = 1f; - calamityGlobalNPC.newAI[3] = 1f; - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.SyncExtraAI(); - - npc.netUpdate = true; - - // Prevent netUpdate from being blocked by the spam counter. - if (npc.netSpam >= 10) - npc.netSpam = 9; - } - } - else - { - calamityGlobalNPC.newAI[0] += 1f; - - // Sound - if (calamityGlobalNPC.newAI[0] == newPhaseTimer - 60f) - { - float squawkpitch = Main.zenithWorld ? 1.3f : 0.25f; - SoundEngine.PlaySound(SoundID.DD2_BetsyScream with { Pitch = squawkpitch }, npc.Center); - - if (Main.zenithWorld) - { - int spacing = 20; - int amt = 3; - SoundEngine.PlaySound(CommonCalamitySounds.LightningSound, npc.Center - Vector2.UnitY * 300f); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - for (int i = 0; i < amt; i++) - { - Vector2 fireFrom = new Vector2(npc.Center.X + (spacing * i) - (spacing * amt / 2), npc.Center.Y - 900f); - Vector2 ai0 = npc.Center - fireFrom; - float ai = Main.rand.Next(100); - Vector2 velocity = Vector2.Normalize(ai0.RotatedByRandom(MathHelper.PiOver4)) * 7f; - Projectile.NewProjectile(npc.GetSource_FromAI(), fireFrom.X, fireFrom.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), npc.damage, 0f, Main.myPlayer, ai0.ToRotation(), ai); - } - } - } - } - - if (calamityGlobalNPC.newAI[0] >= newPhaseTimer) - { - calamityGlobalNPC.newAI[0] = 0f; - calamityGlobalNPC.newAI[2] = 1f; - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.SyncExtraAI(); - - npc.netUpdate = true; - - // Prevent netUpdate from being blocked by the spam counter. - if (npc.netSpam >= 10) - npc.netSpam = 9; - } - } - - Vector2 follyTargetDirection = player.Center - npc.Center; - float follyTargetDistance = 4f + follyTargetDirection.Length() / 100f; - float follyVelocityMult = 25f; - follyTargetDirection.Normalize(); - follyTargetDirection *= follyTargetDistance; - npc.velocity = (npc.velocity * (follyVelocityMult - 1f) + follyTargetDirection) / follyVelocityMult; - return; - } - - // Max spawn amount - int maxBirbs = (CalamityWorld.LegendaryMode && revenge) ? 12 : revenge ? 3 : 2; - - // Variable for charging - float chargeDistance = 600f; - if (phase2) - chargeDistance -= 50f; - if (phase3) - chargeDistance -= 50f; - chargeDistance -= (enrageScale - 1f) * 100f; - - // Phase switch - if (npc.ai[0] == 0f) - { - if (npc.Center.X < player.Center.X - 2f) - npc.direction = 1; - if (npc.Center.X > player.Center.X + 2f) - npc.direction = -1; - - // Direction and rotation - npc.spriteDirection = npc.direction; - npc.rotation = (npc.rotation * rotationMult + npc.velocity.X * rotationAmt * 1.25f) / 10f; - - // Fly to target if target is too far away, otherwise get close to target and then slow down - Vector2 follyFlyTargetDirection = player.Center - npc.Center; - follyFlyTargetDirection.Y -= 200f; - if (follyFlyTargetDirection.Length() > 2800f) - { - npc.TargetClosest(); - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - else if (follyFlyTargetDirection.Length() > 240f) - { - float follyFlySpeed = 12f + (enrageScale - 1f) * 6f; - float follyFlyVelocityMult = 30f; - follyFlyTargetDirection.Normalize(); - follyFlyTargetDirection *= follyFlySpeed; - npc.velocity = (npc.velocity * (follyFlyVelocityMult - 1f) + follyFlyTargetDirection) / follyFlyVelocityMult; - } - else if (npc.velocity.Length() > 2f) - npc.velocity *= 0.95f; - else if (npc.velocity.Length() < 1f) - npc.velocity *= 1.05f; - - // Phase switch - npc.ai[1] += 1f; - if (npc.ai[1] >= 30f) - { - npc.ai[1] = 0f; - npc.ai[2] = 0f; - - while (npc.ai[0] == 0f) - { - if (phase2) - npc.localAI[0] += 1f; - - if (npc.localAI[0] >= (phase3 ? 7 : 9)) - { - npc.TargetClosest(); - npc.ai[0] = 5f; - npc.localAI[0] = 0f; - - // Decrease the feather variable, feathers can be used again if it's at 0 - if (npc.ai[3] > 0f) - npc.ai[3] -= 1f; - - // Decrease enraged attacks by 1 - if (npc.localAI[2] > 0f) - npc.localAI[2] -= 1f; - - // Decrease amount of attacks until able to spawn small birbs again - if (npc.localAI[3] > 0f) - npc.localAI[3] -= 1f; - } - else - { - int follyAttackPicker = phase2 ? Main.rand.Next(2) + 1 : Main.rand.Next(3); - if (phase3) - follyAttackPicker = 1; - - float featherVelocity = 2f + (enrageScale - 1f); - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - - if (follyAttackPicker == 0 && npc.localAI[3] == 0f) - { - npc.TargetClosest(); - npc.ai[0] = 2f; - - // Decrease the feather variable, feathers can be used again if it's at 0 - if (npc.ai[3] > 0f) - npc.ai[3] -= 1f; - - // Decrease enraged attacks by 1 - if (npc.localAI[2] > 0f) - npc.localAI[2] -= 1f; - - // Birb will do at least 1 different attack before entering this phase again - npc.localAI[3] = 1f; - } - else if (follyAttackPicker == 1) - { - npc.TargetClosest(); - npc.ai[0] = 3f; - - // Decrease enraged attacks by 1 - if (npc.localAI[2] > 0f) - npc.localAI[2] -= 1f; - - // Decrease amount of attacks until able to use other attacks again - if (npc.localAI[3] > 0f) - npc.localAI[3] -= 1f; - - if (phase2 && npc.ai[3] == 0f) - { - npc.ai[3] = 3f; - SoundEngine.PlaySound(SoundID.Item102, player.Center); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int totalProjectiles = 40; - float radians = MathHelper.TwoPi / totalProjectiles; - int distance = 800; - bool spawnRight = player.velocity.X > 0f; - for (int i = 0; i < totalProjectiles; i++) - { - if (Main.getGoodWorld) - { - if (i >= (int)(totalProjectiles * 0.125) && i <= (int)(totalProjectiles * 0.375)) - { - Vector2 spawnVector = player.Center + Vector2.Normalize(new Vector2(0f, -featherVelocity).RotatedBy(radians * i)) * distance; - Vector2 velocity = Vector2.Normalize(player.Center - spawnVector) * featherVelocity; - Projectile.NewProjectile(npc.GetSource_FromAI(), spawnVector, velocity, type, damage, 0f, Main.myPlayer); - } - if (i >= (int)(totalProjectiles * 0.625) && i <= (int)(totalProjectiles * 0.875)) - { - Vector2 spawnVector = player.Center + Vector2.Normalize(new Vector2(0f, -featherVelocity).RotatedBy(radians * i)) * distance; - Vector2 velocity = Vector2.Normalize(player.Center - spawnVector) * featherVelocity; - Projectile.NewProjectile(npc.GetSource_FromAI(), spawnVector, velocity, type, damage, 0f, Main.myPlayer); - } - } - else - { - if (spawnRight) - { - if (i >= (int)(totalProjectiles * 0.125) && i <= (int)(totalProjectiles * 0.375)) - { - Vector2 spawnVector = player.Center + Vector2.Normalize(new Vector2(0f, -featherVelocity).RotatedBy(radians * i)) * distance; - Vector2 velocity = Vector2.Normalize(player.Center - spawnVector) * featherVelocity; - Projectile.NewProjectile(npc.GetSource_FromAI(), spawnVector, velocity, type, damage, 0f, Main.myPlayer); - } - } - else - { - if (i >= (int)(totalProjectiles * 0.625) && i <= (int)(totalProjectiles * 0.875)) - { - Vector2 spawnVector = player.Center + Vector2.Normalize(new Vector2(0f, -featherVelocity).RotatedBy(radians * i)) * distance; - Vector2 velocity = Vector2.Normalize(player.Center - spawnVector) * featherVelocity; - Projectile.NewProjectile(npc.GetSource_FromAI(), spawnVector, velocity, type, damage, 0f, Main.myPlayer); - } - } - } - } - } - } - else - { - // Decrease the feather variable, feathers can be used again if it's at 0 - if (npc.ai[3] > 0f) - npc.ai[3] -= 1f; - } - } - else if (NPC.CountNPCS(ModContent.NPCType()) < maxBirbs && npc.localAI[3] == 0f) - { - npc.TargetClosest(); - npc.ai[0] = 4f; - - // Birb will do at least 2 different attacks before entering this phase again - npc.localAI[3] = 2f; - - // Decrease enraged attacks by 1 - if (npc.localAI[2] > 0f) - npc.localAI[2] -= 1f; - - if (npc.ai[3] == 0f) - { - npc.ai[3] = 3f; - SoundEngine.PlaySound(SoundID.Item102, player.Center); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int totalProjectiles = phase2 ? 40 : 48; - - if (Main.getGoodWorld) - totalProjectiles *= 2; - - float radians = MathHelper.TwoPi / totalProjectiles; - int distance = phase2 ? 1200 : 1320; - - if (Main.getGoodWorld) - distance *= 2; - - bool spawnRight = player.velocity.X > 0f; - for (int i = 0; i < totalProjectiles; i++) - { - if (spawnRight) - { - if (i >= totalProjectiles / 2) - break; - - Vector2 spawnVector = player.Center + Vector2.Normalize(new Vector2(0f, -featherVelocity).RotatedBy(radians * i)) * distance; - Vector2 velocity = Vector2.Normalize(player.Center - spawnVector) * featherVelocity; - Projectile.NewProjectile(npc.GetSource_FromAI(), spawnVector, velocity, type, damage, 0f, Main.myPlayer); - } - else - { - if (i >= totalProjectiles / 2) - { - Vector2 spawnVector = player.Center + Vector2.Normalize(new Vector2(0f, -featherVelocity).RotatedBy(radians * i)) * distance; - Vector2 velocity = Vector2.Normalize(player.Center - spawnVector) * featherVelocity; - Projectile.NewProjectile(npc.GetSource_FromAI(), spawnVector, velocity, type, damage, 0f, Main.myPlayer); - } - } - } - } - } - else - { - // Decrease the feather variable, feathers can be used again if it's at 0 - if (npc.ai[3] > 0f) - npc.ai[3] -= 1f; - } - } - } - } - - npc.netUpdate = true; - - // Prevent netUpdate from being blocked by the spam counter. - if (npc.netSpam >= 10) - npc.netSpam = 9; - - npc.SyncExtraAI(); - } - } - - // Fly to target - else if (npc.ai[0] == 1f) - { - if (npc.velocity.X < 0f) - npc.direction = -1; - else if (npc.velocity.X > 0f) - npc.direction = 1; - - npc.spriteDirection = npc.direction; - npc.rotation = (npc.rotation * rotationMult + npc.velocity.X * rotationAmt) / 10f; - - Vector2 follyTargetDirection = player.Center - npc.Center; - if (follyTargetDirection.Length() < 800f) - { - npc.TargetClosest(); - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - - npc.netUpdate = true; - - // Prevent netUpdate from being blocked by the spam counter. - if (npc.netSpam >= 10) - npc.netSpam = 9; - - npc.SyncExtraAI(); - } - - float velocity = 14f + (enrageScale - 1f) * 4f; - float follyTargetDistance = velocity + follyTargetDirection.Length() / 100f; - float follyVelocityMult = 25f; - follyTargetDirection.Normalize(); - follyTargetDirection *= follyTargetDistance; - npc.velocity = (npc.velocity * (follyVelocityMult - 1f) + follyTargetDirection) / follyVelocityMult; - } - - // Fly towards target quickly - else if (npc.ai[0] == 2f) - { - if (npc.target < 0 || !player.active || player.dead) - { - npc.TargetClosest(); - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - - npc.netUpdate = true; - - // Prevent netUpdate from being blocked by the spam counter. - if (npc.netSpam >= 10) - npc.netSpam = 9; - - npc.SyncExtraAI(); - } - - if (player.Center.X - 10f < npc.Center.X) - npc.direction = -1; - else if (player.Center.X + 10f > npc.Center.X) - npc.direction = 1; - - npc.spriteDirection = npc.direction; - npc.rotation = (npc.rotation * rotationMult * 0.5f + npc.velocity.X * rotationAmt * 1.25f) / 5f; - - Vector2 follyQuickFlyTargetDirection = player.Center - npc.Center; - follyQuickFlyTargetDirection.Y -= 20f; - npc.ai[2] += 0.0222222228f; - if (expertMode) - npc.ai[2] += 0.0166666675f; - - float velocity = 8f + (enrageScale - 1f) * 2f; - float follyQuickFlySpeed = velocity + npc.ai[2] + follyQuickFlyTargetDirection.Length() / 120f; - if (CalamityWorld.LegendaryMode && revenge) - follyQuickFlySpeed *= 2f; - - float follyQuickFlyVelMult = 20f; - follyQuickFlyTargetDirection.Normalize(); - follyQuickFlyTargetDirection *= follyQuickFlySpeed; - npc.velocity = (npc.velocity * (follyQuickFlyVelMult - 1f) + follyQuickFlyTargetDirection) / follyQuickFlyVelMult; - - npc.ai[1] += 1f; - if (npc.ai[1] >= ((CalamityWorld.LegendaryMode && revenge) ? 90f : 180f)) - { - npc.TargetClosest(); - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - - npc.netUpdate = true; - - // Prevent netUpdate from being blocked by the spam counter. - if (npc.netSpam >= 10) - npc.netSpam = 9; - - npc.SyncExtraAI(); - } - } - - // Line up charge - else if (npc.ai[0] == 3f) - { - if (npc.velocity.X < 0f) - npc.direction = -1; - else - npc.direction = 1; - - npc.spriteDirection = npc.direction; - npc.rotation = (npc.rotation * rotationMult * 0.5f + npc.velocity.X * rotationAmt * 0.85f) / 5f; - - Vector2 follyLineUpTargetDirection = player.Center - npc.Center; - follyLineUpTargetDirection.Y -= 12f; - if (npc.Center.X > player.Center.X) - follyLineUpTargetDirection.X += chargeDistance; - else - follyLineUpTargetDirection.X -= chargeDistance; - - float verticalDistanceGateValue = (phase3 ? 100f : 20f) + (enrageScale - 1f) * 20f; - if (Math.Abs(npc.Center.X - player.Center.X) > chargeDistance - 50f && Math.Abs(npc.Center.Y - player.Center.Y) < verticalDistanceGateValue) - { - npc.ai[0] = 3.1f; - npc.ai[1] = 0f; - - npc.netUpdate = true; - - // Prevent netUpdate from being blocked by the spam counter. - if (npc.netSpam >= 10) - npc.netSpam = 9; - - npc.SyncExtraAI(); - } - - npc.ai[1] += 0.0333333351f; - float velocity = 16f + (enrageScale - 1f) * 4f; - float follyLineUpSpeed = velocity + npc.ai[1]; - float follyLineUpVelMult = 4f; - follyLineUpTargetDirection.Normalize(); - follyLineUpTargetDirection *= follyLineUpSpeed; - npc.velocity = (npc.velocity * (follyLineUpVelMult - 1f) + follyLineUpTargetDirection) / follyLineUpVelMult; - } - - // Prepare to charge - else if (npc.ai[0] == 3.1f) - { - npc.rotation = (npc.rotation * rotationMult * 0.5f + npc.velocity.X * rotationAmt * 0.85f) / 5f; - - Vector2 follyChargePrepareTargetDirection = player.Center - npc.Center; - follyChargePrepareTargetDirection.Y -= 12f; - float follyChargePrepareSpeed = 28f + (enrageScale - 1f) * 4f; - float follyChargePrepareVelMult = 8f; - follyChargePrepareTargetDirection.Normalize(); - follyChargePrepareTargetDirection *= follyChargePrepareSpeed; - npc.velocity = (npc.velocity * (follyChargePrepareVelMult - 1f) + follyChargePrepareTargetDirection) / follyChargePrepareVelMult; - - if (npc.velocity.X < 0f) - npc.direction = -1; - else - npc.direction = 1; - - npc.spriteDirection = npc.direction; - - npc.ai[1] += 1f; - if (npc.ai[1] > 10f) - { - npc.velocity = follyChargePrepareTargetDirection; - - if (npc.velocity.X < 0f) - npc.direction = -1; - else - npc.direction = 1; - - npc.ai[0] = 3.2f; - npc.ai[1] = npc.direction; - - npc.netUpdate = true; - - // Prevent netUpdate from being blocked by the spam counter. - if (npc.netSpam >= 10) - npc.netSpam = 9; - - npc.SyncExtraAI(); - } - } - - // Charge - else if (npc.ai[0] == 3.2f) - { - npc.ai[2] += 0.0333333351f; - float velocity = 28f + (enrageScale - 1f) * 4f; - npc.velocity.X = (velocity + npc.ai[2]) * npc.ai[1]; - - if ((npc.ai[1] > 0f && npc.Center.X > player.Center.X + (chargeDistance - 140f)) || (npc.ai[1] < 0f && npc.Center.X < player.Center.X - (chargeDistance - 140f))) - { - if (!Collision.SolidCollision(npc.position, npc.width, npc.height)) - { - npc.TargetClosest(); - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - - npc.netUpdate = true; - - // Prevent netUpdate from being blocked by the spam counter. - if (npc.netSpam >= 10) - npc.netSpam = 9; - } - else if (Math.Abs(npc.Center.X - player.Center.X) > chargeDistance + 200f) - { - npc.TargetClosest(); - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - - npc.netUpdate = true; - - // Prevent netUpdate from being blocked by the spam counter. - if (npc.netSpam >= 10) - npc.netSpam = 9; - } - } - - npc.rotation = (npc.rotation * rotationMult * 0.5f + npc.velocity.X * rotationAmt * 0.85f) / 5f; - } - - // Birb spawn - else if (npc.ai[0] == 4f) - { - if (npc.ai[1] == 0f) - { - Vector2 destination2 = player.Center + new Vector2(0f, -200f); - Vector2 desiredVelocity2 = npc.SafeDirectionTo(destination2, -Vector2.UnitY) * 18f; - npc.SimpleFlyMovement(desiredVelocity2, 1.5f); - - if (npc.velocity.X < 0f) - npc.direction = -1; - else - npc.direction = 1; - - npc.spriteDirection = npc.direction; - - npc.ai[2] += 1f; - if (npc.Distance(player.Center) < 600f || npc.ai[2] >= 180f) - { - npc.ai[1] = 1f; - - npc.netUpdate = true; - - // Prevent netUpdate from being blocked by the spam counter. - if (npc.netSpam >= 10) - npc.netSpam = 9; - } - } - else - { - if (npc.ai[1] < 90f) - npc.velocity *= 0.95f; - else - npc.velocity *= 0.98f; - - if (npc.ai[1] == 90f) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y /= 3f; - - npc.velocity.Y -= 3f; - } - - // Sound - if (npc.ai[1] == birbSpawnPhaseTimer - 60f) - { - float squawkpitch = Main.zenithWorld ? 1.3f : 0.25f; - SoundEngine.PlaySound(SoundID.DD2_BetsyScream with { Pitch = squawkpitch }, npc.Center); - - if (Main.zenithWorld) - { - int spacing = 30; - int amt = 3; - SoundEngine.PlaySound(CommonCalamitySounds.LightningSound, npc.Center - Vector2.UnitY * 300f); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - for (int i = 0; i < amt; i++) - { - Vector2 fireFrom = new Vector2(npc.Center.X + (spacing * i) - (spacing * amt / 2), npc.Center.Y - 900f); - Vector2 ai0 = npc.Center - fireFrom; - float ai = Main.rand.Next(100); - Vector2 velocity = Vector2.Normalize(ai0.RotatedByRandom(MathHelper.PiOver4)) * 7f; - Projectile.NewProjectile(npc.GetSource_FromAI(), fireFrom.X, fireFrom.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), npc.damage, 0f, Main.myPlayer, ai0.ToRotation(), ai); - } - } - } - } - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - bool gfbSpawnFlag = CalamityWorld.LegendaryMode && revenge && (npc.ai[1] == 145f || npc.ai[1] == 150f || npc.ai[1] == 160f || npc.ai[1] == 165f); - bool spawnFlag = NPC.CountNPCS(ModContent.NPCType()) < maxBirbs && (npc.ai[1] == 140f || (revenge && npc.ai[1] == 155f) || npc.ai[1] == 170f || gfbSpawnFlag); - if (spawnFlag) - { - Vector2 follySpawnCenter = npc.Center + (MathHelper.TwoPi * Main.rand.NextFloat()).ToRotationVector2() * new Vector2(2f, 1f) * 50f * (0.6f + Main.rand.NextFloat() * 0.4f); - if (Vector2.Distance(follySpawnCenter, player.Center) > 150f) - NPC.NewNPC(npc.GetSource_FromAI(), (int)follySpawnCenter.X, (int)follySpawnCenter.Y, ModContent.NPCType(), npc.whoAmI); - - npc.netUpdate = true; - - // Prevent netUpdate from being blocked by the spam counter. - if (npc.netSpam >= 10) - npc.netSpam = 9; - } - } - - npc.ai[1] += 1f; - } - - if (npc.ai[1] >= birbSpawnPhaseTimer) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.TargetClosest(); - - npc.netUpdate = true; - - // Prevent netUpdate from being blocked by the spam counter. - if (npc.netSpam >= 10) - npc.netSpam = 9; - } - } - - // Spit homing aura sphere - else if (npc.ai[0] == 5f) - { - // Velocity - npc.velocity *= 0.98f; - npc.rotation = (npc.rotation * rotationMult + npc.velocity.X * rotationAmt) / 10f; - - // Play sound - float aiGateValue = 120f; - if (npc.ai[1] == aiGateValue - 30f) - { - SoundEngine.PlaySound(SoundID.DD2_BetsyFireballShot, npc.Center); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Vector2 follySpawnCenter = npc.rotation.ToRotationVector2() * (Vector2.UnitX * npc.direction) * (npc.width + 20) / 2f + npc.Center; - float ai0 = (phase3 ? 2f : 0f) + (enrageScale - 1f); - if (ai0 > 3f) - ai0 = 3f; - - Projectile.NewProjectile(npc.GetSource_FromAI(), follySpawnCenter.X, follySpawnCenter.Y, 0f, 0f, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, ai0, npc.target + 1); - - npc.netUpdate = true; - - // Prevent netUpdate from being blocked by the spam counter. - if (npc.netSpam >= 10) - npc.netSpam = 9; - } - - if (Main.zenithWorld) - { - int spacing = 30; - int amt = 3; - SoundEngine.PlaySound(CommonCalamitySounds.LightningSound, npc.Center - Vector2.UnitY * 300f); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - for (int i = 0; i < amt; i++) - { - Vector2 fireFrom = new Vector2(npc.Center.X + (spacing * i) - (spacing * amt / 2), npc.Center.Y - 900f); - Vector2 ai0 = npc.Center - fireFrom; - float ai = Main.rand.Next(100); - Vector2 velocity = Vector2.Normalize(ai0.RotatedByRandom(MathHelper.PiOver4)) * 7f; - Projectile.NewProjectile(npc.GetSource_FromAI(), fireFrom.X, fireFrom.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), npc.damage, 0f, Main.myPlayer, ai0.ToRotation(), ai); - } - } - } - } - - npc.ai[1] += 1f; - if (npc.ai[1] >= aiGateValue) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - - npc.netUpdate = true; - - // Prevent netUpdate from being blocked by the spam counter. - if (npc.netSpam >= 10) - npc.netSpam = 9; - } - } - } - - public static void Bumblebirb2AI(NPC npc, Mod mod, bool bossMinion) - { - Player player = Main.player[npc.target]; - - float rotationMult = 4f; - float rotationAmt = 0.04f; - - if (Vector2.Distance(player.Center, npc.Center) > 5600f) - { - if (npc.timeLeft > 5) - npc.timeLeft = 5; - } - - npc.rotation = (npc.rotation * rotationMult + npc.velocity.X * rotationAmt * 1.25f) / 10f; - - if (npc.ai[0] == 0f || npc.ai[0] == 1f) - { - for (int i = 0; i < Main.maxNPCs; i++) - { - if (i != npc.whoAmI && Main.npc[i].active && Main.npc[i].type == npc.type) - { - Vector2 otherSwarmerDirection = Main.npc[i].Center - npc.Center; - if (otherSwarmerDirection.Length() < (npc.width + npc.height)) - { - otherSwarmerDirection.Normalize(); - otherSwarmerDirection *= -0.1f; - npc.velocity += otherSwarmerDirection; - NPC nPC6 = Main.npc[i]; - nPC6.velocity -= otherSwarmerDirection; - } - } - } - } - - if (npc.target < 0 || Main.player[npc.target].dead || !Main.player[npc.target].active) - { - npc.TargetClosest(true); - Vector2 swarmerTargetDist = Main.player[npc.target].Center - npc.Center; - if (Main.player[npc.target].dead || swarmerTargetDist.Length() > (bossMinion ? 5600f : 2800f)) - npc.ai[0] = -1f; - } - else - { - Vector2 swarmerCatchUpTargetDist = Main.player[npc.target].Center - npc.Center; - if (npc.ai[0] > 1f && swarmerCatchUpTargetDist.Length() > 3600f) - npc.ai[0] = 1f; - } - - if (npc.ai[0] == -1f) - { - Vector2 swarmerDespawnVelMult = new Vector2(0f, -8f); - npc.velocity = (npc.velocity * 21f + swarmerDespawnVelMult) / 10f; - return; - } - - if (npc.ai[0] == 0f) - { - npc.TargetClosest(true); - npc.spriteDirection = npc.direction; - - Vector2 swarmerIdleTargetDist = Main.player[npc.target].Center - npc.Center; - if (swarmerIdleTargetDist.Length() > 2800f) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - } - else if (swarmerIdleTargetDist.Length() > 400f) - { - float swarmerIdleSpeed = (bossMinion ? 9f : 7f) + swarmerIdleTargetDist.Length() / 100f + npc.ai[1] / 15f; - swarmerIdleTargetDist.Normalize(); - swarmerIdleTargetDist *= swarmerIdleSpeed; - npc.velocity = (npc.velocity * 29F + swarmerIdleTargetDist) / 30F; - if (Main.getGoodWorld && !Main.zenithWorld) - npc.velocity *= 1.15f; - } - else if (npc.velocity.Length() > 2f) - npc.velocity *= 0.95f; - else if (npc.velocity.Length() < 1f) - npc.velocity *= 1.05f; - - npc.ai[1] += 1f; - if (npc.ai[1] >= (bossMinion ? 90f : 105f)) - { - npc.ai[1] = 0f; - npc.ai[0] = 2f; - } - } - else - { - if (npc.ai[0] == 1f) - { - if (npc.target < 0 || !Main.player[npc.target].active || Main.player[npc.target].dead) - npc.TargetClosest(true); - - if (npc.velocity.X < 0f) - npc.direction = -1; - else if (npc.velocity.X > 0f) - npc.direction = 1; - - npc.spriteDirection = npc.direction; - npc.rotation = (npc.rotation * rotationMult + npc.velocity.X * rotationAmt) / 10f; - - Vector2 swarmerChargeTargetDist = Main.player[npc.target].Center - npc.Center; - if (swarmerChargeTargetDist.Length() < 800f && !Collision.SolidCollision(npc.position, npc.width, npc.height)) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - } - - npc.ai[2] += 0.0166666675f; - float swarmerChargeSpeed = (bossMinion ? 12f : 9f) + npc.ai[2] + swarmerChargeTargetDist.Length() / 150f; - float swarmerChargeVelMult = 25f; - swarmerChargeTargetDist.Normalize(); - swarmerChargeTargetDist *= swarmerChargeSpeed; - npc.velocity = (npc.velocity * (swarmerChargeVelMult - 1f) + swarmerChargeTargetDist) / swarmerChargeVelMult; - if (Main.getGoodWorld && !Main.zenithWorld) - npc.velocity *= 1.15f; - - npc.netSpam = 5; - if (Main.netMode == NetmodeID.Server) - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, npc.whoAmI, 0f, 0f, 0f, 0, 0, 0); - - return; - } - if (npc.ai[0] == 2f) - { - if (npc.velocity.X < 0f) - npc.direction = -1; - else if (npc.velocity.X > 0f) - npc.direction = 1; - - npc.spriteDirection = npc.direction; - npc.rotation = (npc.rotation * rotationMult * 0.75f + npc.velocity.X * rotationAmt * 1.25f) / 8f; - - Vector2 swarmerDecelerateTargetDist = Main.player[npc.target].Center - npc.Center; - swarmerDecelerateTargetDist.Y -= 8f; - float swarmerDecelerateSpeed = bossMinion ? 18f : 14f; - float swarmerDecelerateVelMult = 8f; - swarmerDecelerateTargetDist.Normalize(); - swarmerDecelerateTargetDist *= swarmerDecelerateSpeed; - npc.velocity = (npc.velocity * (swarmerDecelerateVelMult - 1f) + swarmerDecelerateTargetDist) / swarmerDecelerateVelMult; - if (Main.getGoodWorld && !Main.zenithWorld) - npc.velocity *= 1.15f; - - if (npc.velocity.X < 0f) - npc.direction = -1; - else - npc.direction = 1; - - npc.spriteDirection = npc.direction; - - npc.ai[1] += 1f; - if (npc.ai[1] > 10f) - { - npc.velocity = swarmerDecelerateTargetDist; - if (Main.getGoodWorld && !Main.zenithWorld) - npc.velocity *= 1.15f; - - if (npc.velocity.X < 0f) - npc.direction = -1; - else - npc.direction = 1; - - npc.ai[0] = 2.1f; - npc.ai[1] = 0f; - } - } - else if (npc.ai[0] == 2.1f) - { - if (npc.velocity.X < 0f) - npc.direction = -1; - else if (npc.velocity.X > 0f) - npc.direction = 1; - - npc.spriteDirection = npc.direction; - - npc.velocity *= 1.01f; - - npc.ai[1] += 1f; - if (npc.ai[1] > 30) - { - if (!Collision.SolidCollision(npc.position, npc.width, npc.height)) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - return; - } - - if (npc.ai[1] > 60) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - } - } - } - } - #endregion - - #region Old Duke - public static void OldDukeAI(NPC npc, Mod mod) - { - CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - OldDuke.OldDuke modNPC = npc.ModNPC(); - - npc.Calamity().canBreakPlayerDefense = true; - - // Percent life remaining - float lifeRatio = npc.life / (float)npc.lifeMax; - - // Variables - bool bossRush = BossRushEvent.BossRushActive; - bool expertMode = Main.expertMode || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool death = CalamityWorld.death || bossRush; - - float exhaustionGateValue = 300f; - if (Main.getGoodWorld) - exhaustionGateValue *= 0.5f; - - float exhaustionIncreasePerAttack = exhaustionGateValue * 0.1f; - bool exhausted = calamityGlobalNPC.newAI[1] == 1f; - bool phase2 = lifeRatio <= (death ? 0.8f : revenge ? 0.7f : 0.5f); - bool phase3 = lifeRatio <= (death ? 0.5f : (revenge ? 0.35f : 0.2f)) && expertMode; - bool phase2AI = npc.ai[0] > 4f; - bool phase3AI = npc.ai[0] > 9f; - bool charging = npc.ai[3] < 10f; - float pie = (float)Math.PI; - - if (calamityGlobalNPC.newAI[0] >= exhaustionGateValue) - calamityGlobalNPC.newAI[1] = 1f; - - float alphaScale = (255 - npc.alpha) / 255f; - float redLight = (phase3AI ? 0.4f : phase2AI ? 0.64f : 0.88f) * alphaScale; - float greenLight = (phase3AI ? 1.2f : phase2AI ? 0.8f : 0.4f) * alphaScale; - Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), redLight, greenLight, 0f); - - if (CalamityConfig.Instance.BossesStopWeather) - CalamityMod.StopRain(); - else if (!Main.raining) - CalamityUtils.StartRain(); - - // Adjust stats - calamityGlobalNPC.DR = exhausted ? 0f : 0.5f; - npc.defense = exhausted ? 0 : npc.defDefense; - if (phase3AI) - { - npc.damage = (int)(npc.defDamage * 1.2f); - npc.defense = exhausted ? 0 : npc.defDefense - 40; - } - else if (phase2AI) - { - npc.damage = (int)(npc.defDamage * 1.1f); - npc.defense = exhausted ? 0 : npc.defDefense - 20; - } - else - { - npc.damage = npc.defDamage; - } - - int idlePhaseTimer = expertMode ? 55 : 60; - float idlePhaseAcceleration = expertMode ? 0.75f : 0.7f; - float idlePhaseVelocity = expertMode ? 14f : 13f; - if (phase3AI) - { - idlePhaseAcceleration = expertMode ? 0.6f : 0.55f; - idlePhaseVelocity = expertMode ? 12f : 11f; - } - else if (phase2AI & charging) - { - idlePhaseAcceleration = expertMode ? 0.8f : 0.75f; - idlePhaseVelocity = expertMode ? 15f : 14f; - } - - int chargeTime = expertMode ? 34 : 36; - float chargeVelocity = expertMode ? 20f : 19f; - if (phase3AI) - { - chargeTime = expertMode ? 28 : 30; - chargeVelocity = expertMode ? 26f : 25f; - } - else if (charging & phase2AI) - { - chargeTime = expertMode ? 31 : 33; - chargeVelocity = expertMode ? 24f : 23f; - } - - if (bossRush) - { - idlePhaseTimer = 35; - idlePhaseAcceleration *= 1.25f; - idlePhaseVelocity *= 1.2f; - chargeTime -= 3; - chargeVelocity *= 1.25f; - } - else if (death) - { - idlePhaseTimer = 51; - idlePhaseAcceleration *= 1.05f; - idlePhaseVelocity *= 1.05f; - chargeTime -= 2; - chargeVelocity *= 1.1f; - } - else if (revenge) - { - idlePhaseTimer = 53; - idlePhaseAcceleration *= 1.025f; - idlePhaseVelocity *= 1.025f; - chargeTime -= 1; - chargeVelocity *= 1.05f; - } - - // The dumbest thing to ever exist - if (CalamityWorld.LegendaryMode && revenge) - chargeVelocity *= 1.25f; - - if (exhausted) - idlePhaseVelocity *= 0.25f; - - // Variables - int maxToothBallBelches = bossRush ? 5 : death ? 4 : 3; - int toothBallBelchPhaseDivisor = bossRush ? 24 : death ? 30 : 40; - int toothBallBelchPhaseTimer = toothBallBelchPhaseDivisor * maxToothBallBelches; - float toothBallBelchPhaseAcceleration = bossRush ? 0.95f : death ? 0.6f : 0.55f; - float toothBallBelchPhaseVelocity = bossRush ? 14f : death ? 10f : 9f; - float toothBallFinalVelocity = death ? 14f : revenge ? 13f : 12f; - float goreVelocityX = death ? 8f : revenge ? 7.5f : expertMode ? 7f : 6f; - float goreVelocityY = death ? 10.5f : revenge ? 10f : expertMode ? 9.5f : 8f; - float sharkronVelocity = bossRush ? 18f : death ? 16f : revenge ? 15f : expertMode ? 14f : 12f; - int attackTimer = 120; - int phaseTransitionTimer = 180; - int teleportPauseTimer = 30; - int toothBallSpinPhaseDivisor = bossRush ? 27 : death ? 32 : 45; - int toothBallSpinTimer = maxToothBallBelches * toothBallSpinPhaseDivisor; - float spinTime = toothBallSpinTimer / 2f; - float toothBallSpinToothBallVelocity = bossRush ? 14f : death ? 9.5f : 9f; - float spinAttackSpeed = Main.zenithWorld ? 44f : 22f; - float spinSpeed = MathHelper.TwoPi / spinTime; - - Player player = Main.player[npc.target]; - - // Get target - if (npc.target < 0 || npc.target == Main.maxPlayers || player.dead || !player.active) - { - npc.TargetClosest(); - player = Main.player[npc.target]; - npc.netUpdate = true; - } - - // Despawn safety, make sure to target another player if the current player target is too far away - if (Vector2.Distance(player.Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) - npc.TargetClosest(); - - // Despawn - if (player.dead || Vector2.Distance(player.Center, npc.Center) > 8800f) - { - npc.TargetClosest(); - - npc.velocity.Y -= 0.4f; - - if (npc.timeLeft > 10) - npc.timeLeft = 10; - - if (npc.timeLeft == 1) - { - AcidRainEvent.AccumulatedKillPoints = 0; - AcidRainEvent.HasTriedToSummonOldDuke = false; - AcidRainEvent.UpdateInvasion(false); - npc.timeLeft = 0; - } - - if (npc.ai[0] > 4f) - npc.ai[0] = 5f; - else - npc.ai[0] = 0f; - - npc.ai[2] = 0f; - } - - if (exhausted) - { - npc.Calamity().canBreakPlayerDefense = false; - - npc.damage /= 4; - - // Play exhausted sound - if (calamityGlobalNPC.newAI[0] % 60f == 0f && Main.player[Main.myPlayer].active && !Main.player[Main.myPlayer].dead && Vector2.Distance(Main.player[Main.myPlayer].Center, npc.Center) < 2800f) - SoundEngine.PlaySound(OldDuke.OldDuke.HuffSound, Main.LocalPlayer.Center); - - if (Main.zenithWorld) - { - float screenShakePower = 10 * Utils.GetLerpValue(800f, 0f, npc.Distance(Main.LocalPlayer.Center), true); - if (Main.LocalPlayer.Calamity().GeneralScreenShakePower < screenShakePower) - Main.LocalPlayer.Calamity().GeneralScreenShakePower = screenShakePower; - - if (calamityGlobalNPC.newAI[0] == exhaustionGateValue) - SoundEngine.PlaySound(SoundID.NPCDeath64 with { Pitch = SoundID.NPCDeath64.Pitch - 0.9f, Volume = SoundID.NPCDeath64.Volume + 0.4f}, player.Center); // fart - - if (Main.netMode != NetmodeID.MultiplayerClient && calamityGlobalNPC.newAI[0] % 5f == 0f) - { - Vector2 dist = player.Center - npc.Center; - dist.Normalize(); - dist *= 3; - dist.X += Main.rand.NextFloat(-0.5f, 0.5f); - dist.Y += Main.rand.NextFloat(-0.5f, 0.5f); - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, -dist, type, damage, 0, Main.myPlayer); - } - } - - calamityGlobalNPC.newAI[0] -= bossRush ? 1.5f : 1f; - if (calamityGlobalNPC.newAI[0] <= 0f) - { - calamityGlobalNPC.newAI[0] = 0f; - calamityGlobalNPC.newAI[1] = 0f; - } - } - - // Enrage variable - bool enrage = !bossRush && - (player.position.Y < 300f || player.position.Y > Main.worldSurface * 16.0 || - (player.position.X > 8000f && player.position.X < (Main.maxTilesX * 16 - 8000))); - - // Check for the flipped Abyss - if (Main.remixWorld) - { - enrage = !bossRush && - (player.position.Y < (Main.maxTilesY - 200) * 0.8f || player.position.Y > Main.maxTilesY - 200 || - (player.position.X > 8000f && player.position.X < (Main.maxTilesX * 16 - 8000))); - } - - // Enrage - if (enrage) - { - if (npc.localAI[1] > 0f) - npc.localAI[1] -= 1f; - } - else - npc.localAI[1] = CalamityGlobalNPC.biomeEnrageTimerMax; - - bool biomeEnraged = npc.localAI[1] <= 0f; - - npc.Calamity().CurrentlyEnraged = biomeEnraged || bossRush; - - // Increased DR while transitioning phases and not exhausted - if (!exhausted) - calamityGlobalNPC.DR = (npc.ai[0] == -1f || npc.ai[0] == 4f || npc.ai[0] == 9f) ? (bossRush ? 0.99f : 0.75f) : 0.5f; - - calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = npc.ai[0] == -1f || npc.ai[0] == 4f || npc.ai[0] == 9f; - - // Enrage - if (biomeEnraged) - { - toothBallBelchPhaseTimer = 60; - toothBallBelchPhaseDivisor = 20; - toothBallBelchPhaseAcceleration = 1f; - toothBallBelchPhaseVelocity = 15f; - goreVelocityX = 12f; - goreVelocityY = 16f; - sharkronVelocity = 20f; - idlePhaseTimer = 20; - idlePhaseAcceleration = 1.2f; - idlePhaseVelocity = 20f; - chargeTime = 25; - chargeVelocity += 8f; - toothBallSpinPhaseDivisor = 24; - toothBallSpinToothBallVelocity = 15f; - npc.damage = npc.defDamage * 2; - npc.defense = npc.defDefense * 3; - } - - // The dumbest thing to ever exist - if (CalamityWorld.LegendaryMode && revenge) - chargeTime *= 2; - - // Set variables for spawn effects - if (npc.localAI[0] == 0f) - { - npc.localAI[0] = 1f; - npc.alpha = 255; - npc.rotation = 0f; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.ai[0] = -1f; - npc.netUpdate = true; - } - } - - // Rotation - float rateOfRotation = 0.04f; - if (npc.ai[0] == 1f || npc.ai[0] == 6f || npc.ai[0] == 7f || npc.ai[0] == 14f) - rateOfRotation = 0f; - if (npc.ai[0] == 3f || npc.ai[0] == 4f) - rateOfRotation = 0.01f; - if (npc.ai[0] == 8f || npc.ai[0] == 13f) - rateOfRotation = 0.05f; - - Vector2 rotationVector = player.Center - npc.Center; - if (calamityGlobalNPC.newAI[1] != 1f && !player.dead) - { - // Rotate to show direction of predictive charge - if (npc.ai[0] == 0f && !phase2) - { - if (npc.ai[3] < 6f) - { - rateOfRotation = 0.1f; - rotationVector = Vector2.Normalize(player.Center + player.velocity * 20f - npc.Center) * chargeVelocity; - } - } - else if (npc.ai[0] == 5f && !phase3) - { - if (npc.ai[3] < 4f) - { - rateOfRotation = 0.1f; - rotationVector = Vector2.Normalize(player.Center + player.velocity * 20f - npc.Center) * chargeVelocity; - } - } - else if (npc.ai[0] == 10f) - { - if (npc.ai[3] < 8f && npc.ai[3] != 1f && npc.ai[3] != 4f) - { - rateOfRotation = 0.1f; - rotationVector = Vector2.Normalize(player.Center + player.velocity * 20f - npc.Center) * chargeVelocity; - } - } - } - - float dukeRotationSpeed = (float)Math.Atan2(rotationVector.Y, rotationVector.X); - if (npc.spriteDirection == 1) - dukeRotationSpeed += pie; - if (dukeRotationSpeed < 0f) - dukeRotationSpeed += MathHelper.TwoPi; - if (dukeRotationSpeed > MathHelper.TwoPi) - dukeRotationSpeed -= MathHelper.TwoPi; - if (npc.ai[0] == -1f || npc.ai[0] == 3f || npc.ai[0] == 4f) - dukeRotationSpeed = 0f; - if (npc.ai[0] == 8f || npc.ai[0] == 13f) - dukeRotationSpeed = pie * 0.1666666667f * npc.spriteDirection; - - if (npc.rotation < dukeRotationSpeed) - { - if (dukeRotationSpeed - npc.rotation > pie) - npc.rotation -= rateOfRotation; - else - npc.rotation += rateOfRotation; - } - if (npc.rotation > dukeRotationSpeed) - { - if (npc.rotation - dukeRotationSpeed > pie) - npc.rotation += rateOfRotation; - else - npc.rotation -= rateOfRotation; - } - - if ((npc.ai[0] != 8f && npc.ai[0] != 13f) || npc.spriteDirection == 1) - { - if (npc.rotation > dukeRotationSpeed - rateOfRotation && npc.rotation < dukeRotationSpeed + rateOfRotation) - npc.rotation = dukeRotationSpeed; - if (npc.rotation < 0f) - npc.rotation += MathHelper.TwoPi; - if (npc.rotation > MathHelper.TwoPi) - npc.rotation -= MathHelper.TwoPi; - if (npc.rotation > dukeRotationSpeed - rateOfRotation && npc.rotation < dukeRotationSpeed + rateOfRotation) - npc.rotation = dukeRotationSpeed; - } - - // Alpha adjustments - if (npc.ai[0] != -1f && (npc.ai[0] < 9f || npc.ai[0] > 12f)) - { - if (Collision.SolidCollision(npc.position, npc.width, npc.height)) - npc.alpha += 15; - else - npc.alpha -= 15; - - if (npc.alpha < 0) - npc.alpha = 0; - if (npc.alpha > 150) - npc.alpha = 150; - } - - // Spawn effects - if (npc.ai[0] == -1f) - { - // Velocity - if (npc.Calamity().newAI[3] == 0f) - npc.velocity *= 0.98f; - - // Direction - int dukeFaceDirection = Math.Sign(player.Center.X - npc.Center.X); - if (dukeFaceDirection != 0) - { - npc.direction = dukeFaceDirection; - npc.spriteDirection = -npc.direction; - } - - // Alpha - if (npc.ai[2] > 20f) - { - if (npc.Calamity().newAI[3] == 0f) - npc.velocity.Y = -2f; - - npc.alpha -= 5; - if (Collision.SolidCollision(npc.position, npc.width, npc.height)) - npc.alpha += 15; - if (npc.alpha < 0) - npc.alpha = 0; - if (npc.alpha > 150) - npc.alpha = 150; - } - - // Spawn dust and play sound - if (npc.ai[2] == attackTimer - 30) - { - int dustAmt = 36; - for (int i = 0; i < dustAmt; i++) - { - Vector2 dust = (Vector2.Normalize(npc.velocity) * new Vector2(npc.width / 2f, npc.height) * 0.75f * 0.5f).RotatedBy((i - (dustAmt / 2 - 1)) * MathHelper.TwoPi / dustAmt) + npc.Center; - Vector2 vector2 = dust - npc.Center; - int toxicDust = Dust.NewDust(dust + vector2, 0, 0, (int)CalamityDusts.SulfurousSeaAcid, vector2.X * 2f, vector2.Y * 2f, 100, default, 1.4f); - Main.dust[toxicDust].noGravity = true; - Main.dust[toxicDust].noLight = true; - Main.dust[toxicDust].velocity = Vector2.Normalize(vector2) * 3f; - } - - modNPC.RoarSoundSlot = SoundEngine.PlaySound(OldDuke.OldDuke.RoarSound, npc.Center); - } - - npc.ai[2] += 1f; - if (npc.ai[2] >= 75) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.netUpdate = true; - } - } - - // Phase 1 - else if (npc.ai[0] == 0f && !player.dead) - { - // Velocity - if (npc.ai[1] == 0f) - npc.ai[1] = 500 * Math.Sign((npc.Center - player.Center).X); - - Vector2 phase1IdleSpeed = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -300f) - npc.Center - npc.velocity) * idlePhaseVelocity; - npc.SimpleFlyMovement(phase1IdleSpeed, idlePhaseAcceleration); - - // Rotation and direction - int dukeLookAt = Math.Sign(player.Center.X - npc.Center.X); - if (dukeLookAt != 0) - { - if (npc.ai[2] == 0f && dukeLookAt != npc.direction) - npc.rotation += pie; - - npc.direction = dukeLookAt; - - if (npc.spriteDirection != -npc.direction) - npc.rotation += pie; - - npc.spriteDirection = -npc.direction; - } - - // Phase switch - if (calamityGlobalNPC.newAI[1] != 1f || (phase2 && !phase2AI)) - { - npc.ai[2] += 1f; - if (npc.ai[2] >= idlePhaseTimer || (phase2 && !phase2AI)) - { - int oldDukeAttackPicker = 0; - switch ((int)npc.ai[3]) - { - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - oldDukeAttackPicker = 1; - break; - case 6: - npc.ai[3] = 1f; - oldDukeAttackPicker = 2; - break; - case 7: - npc.ai[3] = 0f; - oldDukeAttackPicker = 3; - break; - } - - if (phase2) - oldDukeAttackPicker = 4; - - // Set velocity for charge - if (oldDukeAttackPicker == 1) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - - // Velocity - Vector2 distanceVector = player.Center + player.velocity * 20f - npc.Center; - npc.velocity = Vector2.Normalize(distanceVector) * chargeVelocity; - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); - - // Direction - if (dukeLookAt != 0) - { - npc.direction = dukeLookAt; - - if (npc.spriteDirection == 1) - npc.rotation += pie; - - npc.spriteDirection = -npc.direction; - } - } - - // Tooth Balls - else if (oldDukeAttackPicker == 2) - { - npc.ai[0] = 2f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - - // Call sharks from the sides of the screen - else if (oldDukeAttackPicker == 3) - { - npc.ai[0] = 3f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - - // Go to phase 2 - else if (oldDukeAttackPicker == 4) - { - npc.ai[0] = 4f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - - npc.netUpdate = true; - } - } - } - - // Charge - else if (npc.ai[0] == 1f) - { - // The dumbest thing to ever exist - if (CalamityWorld.LegendaryMode && revenge && npc.ai[2] % 10f == 0f) - { - // Rotation and direction - int dir = Math.Sign(player.Center.X - npc.Center.X); - if (dir != 0) - { - if (npc.ai[2] == 0f && dir != npc.direction) - npc.rotation += pie; - - npc.direction = dir; - - if (npc.spriteDirection != -npc.direction) - npc.rotation += pie; - - npc.spriteDirection = -npc.direction; - } - - Vector2 distanceVector = player.Center + player.velocity * 20f - npc.Center; - npc.velocity = Vector2.Normalize(distanceVector) * chargeVelocity; - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); - - // Direction - if (dir != 0) - { - npc.direction = dir; - - if (npc.spriteDirection == 1) - npc.rotation += pie; - - npc.spriteDirection = -npc.direction; - } - } - else - { - // Accelerate - npc.velocity *= 1.01f; - } - - // Spawn dust - int chargeDustAmt = 7; - for (int j = 0; j < chargeDustAmt; j++) - { - Vector2 arg_E1C_0 = (Vector2.Normalize(npc.velocity) * new Vector2((npc.width + 50) / 2f, npc.height) * 0.75f).RotatedBy((j - (chargeDustAmt / 2 - 1)) * pie / chargeDustAmt) + npc.Center; - Vector2 vector4 = ((float)(Main.rand.NextDouble() * pie) - MathHelper.PiOver2).ToRotationVector2() * Main.rand.Next(3, 8); - int chargeDust = Dust.NewDust(arg_E1C_0 + vector4, 0, 0, (int)CalamityDusts.SulfurousSeaAcid, vector4.X * 2f, vector4.Y * 2f, 100, default, 1.4f); - Main.dust[chargeDust].noGravity = true; - Main.dust[chargeDust].noLight = true; - Main.dust[chargeDust].velocity /= 4f; - Main.dust[chargeDust].velocity -= npc.velocity; - } - - npc.ai[2] += 1f; - if (npc.ai[2] >= chargeTime) - { - calamityGlobalNPC.newAI[0] += exhaustionIncreasePerAttack; - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] += 2f; - npc.TargetClosest(); - npc.netUpdate = true; - } - } - - // Tooth Ball belch - else if (npc.ai[0] == 2f) - { - // Velocity - if (npc.ai[1] == 0f) - npc.ai[1] = 500 * Math.Sign((npc.Center - player.Center).X); - - Vector2 toothBallBelchPhaseSpeed = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -300f) - npc.Center - npc.velocity) * toothBallBelchPhaseVelocity; - npc.SimpleFlyMovement(toothBallBelchPhaseSpeed, toothBallBelchPhaseAcceleration); - - // Play sounds and spawn Tooth Balls - if (npc.ai[2] == 0f) - modNPC.RoarSoundSlot = SoundEngine.PlaySound(OldDuke.OldDuke.RoarSound, npc.Center); - - if (npc.ai[2] % toothBallBelchPhaseDivisor == 0f) - { - if (npc.ai[2] != 0f) - SoundEngine.PlaySound(OldDuke.OldDuke.VomitSound, npc.Center); - - Vector2 toothBallDirection = Vector2.Normalize(player.Center - npc.Center) * (npc.width + 20) / 2f + npc.Center; - Vector2 toothBallVelocity = Vector2.Normalize(Main.player[npc.target].Center - npc.Center) * toothBallFinalVelocity; - Vector2 toothBallSpawnPos = new Vector2(toothBallDirection.X, toothBallDirection.Y + 45f); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int toothBall = NPC.NewNPC(npc.GetSource_FromAI(), (int)toothBallSpawnPos.X, (int)toothBallSpawnPos.Y, ModContent.NPCType(), 0, toothBallVelocity.X, toothBallVelocity.Y); - Main.npc[toothBall].velocity = Vector2.Normalize(toothBallVelocity) * npc.velocity.Length(); - Main.npc[toothBall].netUpdate = true; - } - - for (int i = 0; i < 50; i++) - { - int dustID; - switch (Main.rand.Next(6)) - { - case 0: - case 1: - case 2: - case 3: - dustID = (int)CalamityDusts.SulfurousSeaAcid; - break; - default: - dustID = DustID.Blood; - break; - } - - // Choose a random speed and angle to belch out the vomit - float dustSpeed = Main.rand.NextFloat(3.0f, 12.0f); - float angleRandom = 0.06f; - Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(toothBallVelocity.ToRotation()); - dustVel = dustVel.RotatedBy(-angleRandom); - dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); - - // Pick a size for the vomit particles - float scale = Main.rand.NextFloat(1f, 2f); - - // Actually spawn the vomit - int idx = Dust.NewDust(toothBallSpawnPos, 40, 40, dustID, dustVel.X, dustVel.Y, 0, default, scale); - Main.dust[idx].noGravity = true; - } - } - - // Direction - int toothBallLookAt = Math.Sign(player.Center.X - npc.Center.X); - if (toothBallLookAt != 0) - { - npc.direction = toothBallLookAt; - if (npc.spriteDirection != -npc.direction) - npc.rotation += pie; - npc.spriteDirection = -npc.direction; - } - - npc.ai[2] += 1f; - if (npc.ai[2] >= toothBallBelchPhaseTimer) - { - calamityGlobalNPC.newAI[0] += exhaustionIncreasePerAttack; - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.TargetClosest(); - npc.netUpdate = true; - } - } - - // Call sharks from the sides of the screen - else if (npc.ai[0] == 3f) - { - // Velocity - npc.velocity *= 0.98f; - npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); - - // Play sound and spawn sharks - if (npc.ai[2] == attackTimer - 30) - SoundEngine.PlaySound(OldDuke.OldDuke.VomitSound, npc.Center); - - if (npc.ai[2] >= attackTimer - 90) - { - if (npc.ai[2] % 18f == 0f) - { - calamityGlobalNPC.newAI[2] += 100f; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + 900f), (int)(npc.Center.Y - calamityGlobalNPC.newAI[2]), ModContent.NPCType(), 0, 0f, 0f, npc.whoAmI, 0f, 255); - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X - 900f), (int)(npc.Center.Y - calamityGlobalNPC.newAI[2]), ModContent.NPCType(), 0, 0f, 0f, npc.whoAmI, 0f, 255); - - if (Main.getGoodWorld) - { - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + 1800f), (int)(npc.Center.Y - calamityGlobalNPC.newAI[2]), ModContent.NPCType(), 0, 0f, 0f, npc.whoAmI, 0f, 255); - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X - 1800f), (int)(npc.Center.Y - calamityGlobalNPC.newAI[2]), ModContent.NPCType(), 0, 0f, 0f, npc.whoAmI, 0f, 255); - } - } - } - } - - npc.ai[2] += 1f; - if (npc.ai[2] >= attackTimer) - { - calamityGlobalNPC.newAI[0] += exhaustionIncreasePerAttack; - calamityGlobalNPC.newAI[2] = 0f; - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.TargetClosest(); - npc.netUpdate = true; - } - } - - // Transition to phase 2 and call sharks from below - else if (npc.ai[0] == 4f) - { - // Velocity - npc.velocity *= 0.98f; - npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); - - // Sound - if (npc.ai[2] == phaseTransitionTimer - 60) - modNPC.RoarSoundSlot = SoundEngine.PlaySound(OldDuke.OldDuke.RoarSound, npc.Center); - - if (npc.ai[2] >= phaseTransitionTimer - 60) - { - if (npc.ai[2] % 18f == 0f) - { - calamityGlobalNPC.newAI[2] += 150f; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + 50f + calamityGlobalNPC.newAI[2]), (int)(npc.Center.Y + 540f), ModContent.NPCType(), 0, 0f, 0f, 1f, -sharkronVelocity, 255); - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X - 50f - calamityGlobalNPC.newAI[2]), (int)(npc.Center.Y + 540f), ModContent.NPCType(), 0, 0f, 0f, -1f, -sharkronVelocity, 255); - - if (Main.getGoodWorld) - { - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + 50f + calamityGlobalNPC.newAI[2] * 0.5f), (int)(npc.Center.Y + 270f), ModContent.NPCType(), 0, 0f, 0f, 1f, -sharkronVelocity, 255); - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X - 50f - calamityGlobalNPC.newAI[2] * 0.5f), (int)(npc.Center.Y + 270f), ModContent.NPCType(), 0, 0f, 0f, -1f, -sharkronVelocity, 255); - } - } - } - } - - npc.ai[2] += 1f; - if (npc.ai[2] >= phaseTransitionTimer) - { - calamityGlobalNPC.newAI[0] = 0f; - calamityGlobalNPC.newAI[1] = 0f; - calamityGlobalNPC.newAI[2] = 0f; - npc.ai[0] = 5f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.TargetClosest(); - npc.netUpdate = true; - } - } - - // Phase 2 - else if (npc.ai[0] == 5f && !player.dead) - { - // Velocity - if (npc.ai[1] == 0f) - npc.ai[1] = 500 * Math.Sign((npc.Center - player.Center).X); - - Vector2 dukePhase2IdleSpeed = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -300f) - npc.Center - npc.velocity) * idlePhaseVelocity; - npc.SimpleFlyMovement(dukePhase2IdleSpeed, idlePhaseAcceleration); - - // Direction and rotation - int phase2FaceDirection = Math.Sign(player.Center.X - npc.Center.X); - if (phase2FaceDirection != 0) - { - if (npc.ai[2] == 0f && phase2FaceDirection != npc.direction) - npc.rotation += pie; - - npc.direction = phase2FaceDirection; - - if (npc.spriteDirection != -npc.direction) - npc.rotation += pie; - - npc.spriteDirection = -npc.direction; - } - - // Phase switch - if (calamityGlobalNPC.newAI[1] != 1f || (phase3 && !phase3AI)) - { - npc.ai[2] += 1f; - if (npc.ai[2] >= idlePhaseTimer || (phase3 && !phase3AI)) - { - int phase2AttackPicker = 0; - switch ((int)npc.ai[3]) - { - case 0: - case 1: - case 2: - case 3: - phase2AttackPicker = 1; - break; - case 4: - npc.ai[3] = 1f; - phase2AttackPicker = 2; - break; - case 5: - npc.ai[3] = 0f; - phase2AttackPicker = 3; - break; - } - - if (phase3) - phase2AttackPicker = 4; - - // Set velocity for charge - if (phase2AttackPicker == 1) - { - npc.ai[0] = 6f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - - // Velocity and rotation - Vector2 distanceVector = player.Center + player.velocity * 20f - npc.Center; - npc.velocity = Vector2.Normalize(distanceVector) * chargeVelocity; - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); - - // Direction - if (phase2FaceDirection != 0) - { - npc.direction = phase2FaceDirection; - - if (npc.spriteDirection == 1) - npc.rotation += pie; - - npc.spriteDirection = -npc.direction; - } - } - - // Set velocity for spin - else if (phase2AttackPicker == 2) - { - // Velocity and rotation - npc.velocity = Vector2.Normalize(player.Center - npc.Center) * spinAttackSpeed; - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); - - // Direction - if (phase2FaceDirection != 0) - { - npc.direction = phase2FaceDirection; - - if (npc.spriteDirection == 1) - npc.rotation += pie; - - npc.spriteDirection = -npc.direction; - } - - npc.ai[0] = 7f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - - else if (phase2AttackPicker == 3) - { - npc.ai[0] = 8f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - - // Go to next phase - else if (phase2AttackPicker == 4) - { - npc.ai[0] = 9f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - - npc.netUpdate = true; - } - } - } - - // Charge - else if (npc.ai[0] == 6f) - { - // The dumbest thing to ever exist - if (CalamityWorld.LegendaryMode && revenge && npc.ai[2] % 8f == 0f) - { - // Rotation and direction - int dir = Math.Sign(player.Center.X - npc.Center.X); - if (dir != 0) - { - if (npc.ai[2] == 0f && dir != npc.direction) - npc.rotation += pie; - - npc.direction = dir; - - if (npc.spriteDirection != -npc.direction) - npc.rotation += pie; - - npc.spriteDirection = -npc.direction; - } - - Vector2 distanceVector = player.Center + player.velocity * 20f - npc.Center; - npc.velocity = Vector2.Normalize(distanceVector) * chargeVelocity; - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); - - // Direction - if (dir != 0) - { - npc.direction = dir; - - if (npc.spriteDirection == 1) - npc.rotation += pie; - - npc.spriteDirection = -npc.direction; - } - } - else - { - // Accelerate - npc.velocity *= 1.01f; - } - - // Spawn dust - int phase2ChargeDustAmt = 7; - for (int k = 0; k < phase2ChargeDustAmt; k++) - { - Vector2 arg_1A97_0 = (Vector2.Normalize(npc.velocity) * new Vector2((npc.width + 50) / 2f, npc.height) * 0.75f).RotatedBy((k - (phase2ChargeDustAmt / 2 - 1)) * pie / phase2ChargeDustAmt) + npc.Center; - Vector2 vector9 = ((float)(Main.rand.NextDouble() * pie) - MathHelper.PiOver2).ToRotationVector2() * Main.rand.Next(3, 8); - int phase2ChargeDust = Dust.NewDust(arg_1A97_0 + vector9, 0, 0, (int)CalamityDusts.SulfurousSeaAcid, vector9.X * 2f, vector9.Y * 2f, 100, default, 1.4f); - Main.dust[phase2ChargeDust].noGravity = true; - Main.dust[phase2ChargeDust].noLight = true; - Main.dust[phase2ChargeDust].velocity /= 4f; - Main.dust[phase2ChargeDust].velocity -= npc.velocity; - } - - npc.ai[2] += 1f; - if (npc.ai[2] >= chargeTime) - { - calamityGlobalNPC.newAI[0] += exhaustionIncreasePerAttack; - npc.ai[0] = 5f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] += 2f; - npc.TargetClosest(); - npc.netUpdate = true; - } - } - - // Tooth Ball and Vortex spin - else if (npc.ai[0] == 7f) - { - // Play sounds and spawn Tooth Balls and a Vortex - if (npc.ai[2] == 0f) - { - modNPC.RoarSoundSlot = SoundEngine.PlaySound(OldDuke.OldDuke.RoarSound, npc.Center); - - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - Vector2 vortexSpawn = npc.Center + npc.velocity.RotatedBy(MathHelper.PiOver2 * -npc.direction) * spinTime / MathHelper.TwoPi; - if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(npc.GetSource_FromAI(), vortexSpawn, Vector2.Zero, type, damage, 0f, Main.myPlayer, vortexSpawn.X, vortexSpawn.Y); - } - - if (npc.ai[2] % toothBallSpinPhaseDivisor == 0f) - { - if (npc.ai[2] != 0f) - SoundEngine.PlaySound(OldDuke.OldDuke.VomitSound, npc.Center); - - Vector2 phase2ToothBallDirection = Vector2.Normalize(npc.velocity) * (npc.width + 20) / 2f + npc.Center; - Vector2 toothBallVelocity = Vector2.Normalize(npc.velocity).RotatedBy(MathHelper.PiOver2 * npc.direction) * toothBallSpinToothBallVelocity; - Vector2 toothBallSpawnPos = new Vector2(phase2ToothBallDirection.X, phase2ToothBallDirection.Y + 45f); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int toothBall = NPC.NewNPC(npc.GetSource_FromAI(), (int)toothBallSpawnPos.X, (int)toothBallSpawnPos.Y, ModContent.NPCType(), 0, toothBallVelocity.X, toothBallVelocity.Y); - Main.npc[toothBall].target = npc.target; - Main.npc[toothBall].velocity = Vector2.Normalize(toothBallVelocity) * toothBallSpinToothBallVelocity * 0.5f; - Main.npc[toothBall].netUpdate = true; - Main.npc[toothBall].ai[3] = 30f; - } - - for (int i = 0; i < 50; i++) - { - int dustID; - switch (Main.rand.Next(6)) - { - case 0: - case 1: - case 2: - case 3: - dustID = (int)CalamityDusts.SulfurousSeaAcid; - break; - default: - dustID = DustID.Blood; - break; - } - - // Choose a random speed and angle to belch out the vomit - float dustSpeed = Main.rand.NextFloat(3.0f, 12.0f); - float angleRandom = 0.06f; - Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(toothBallVelocity.ToRotation()); - dustVel = dustVel.RotatedBy(-angleRandom); - dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); - - // Pick a size for the vomit particles - float scale = Main.rand.NextFloat(1f, 2f); - - // Actually spawn the vomit - int idx = Dust.NewDust(toothBallSpawnPos, 40, 40, dustID, dustVel.X, dustVel.Y, 0, default, scale); - Main.dust[idx].noGravity = true; - } - } - - // Velocity and rotation - npc.velocity = npc.velocity.RotatedBy(-(double)spinSpeed * (float)npc.direction); - npc.rotation -= spinSpeed * npc.direction; - - npc.ai[2] += 1f; - if (npc.ai[2] >= toothBallSpinTimer) - { - calamityGlobalNPC.newAI[0] += exhaustionIncreasePerAttack; - npc.ai[0] = 5f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.TargetClosest(); - npc.netUpdate = true; - } - } - - // Vomit a huge amount of gore into the sky and call sharks from the sides of the screen - else if (npc.ai[0] == 8f) - { - // Velocity - npc.velocity *= 0.98f; - npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); - - // Play sound - if (npc.ai[2] == attackTimer - 30) - { - SoundEngine.PlaySound(OldDuke.OldDuke.VomitSound, npc.Center); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Vector2 phase2GoreDirection = npc.rotation.ToRotationVector2() * (Vector2.UnitX * npc.direction) * (npc.width + 20) / 2f + npc.Center; - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - int totalGore = Main.getGoodWorld ? 40 : 20; - for (int i = 0; i < totalGore; i++) - { - float velocityX = npc.direction * goreVelocityX * (Main.rand.NextFloat(0.2f, 0.8f) + 0.5f); - float velocityY = goreVelocityY * (Main.rand.NextFloat(0.2f, 0.8f) + 0.5f); - - if (Main.getGoodWorld) - { - velocityX *= Main.rand.NextFloat() + 0.5f; - velocityY *= Main.rand.NextFloat() + 0.5f; - } - - Projectile.NewProjectile(npc.GetSource_FromAI(), phase2GoreDirection.X, phase2GoreDirection.Y, velocityX, -velocityY, type, damage, 0f, Main.myPlayer, 0f, 0f); - } - } - } - - if (npc.ai[2] >= attackTimer - 90) - { - if (npc.ai[2] % 18f == 0f) - { - calamityGlobalNPC.newAI[2] += 100f; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - float x = 900f - calamityGlobalNPC.newAI[2]; - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + x), (int)(npc.Center.Y - calamityGlobalNPC.newAI[2]), ModContent.NPCType(), 0, 0f, 0f, npc.whoAmI, 0f, 255); - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X - x), (int)(npc.Center.Y - calamityGlobalNPC.newAI[2]), ModContent.NPCType(), 0, 0f, 0f, npc.whoAmI, 0f, 255); - } - } - } - - npc.ai[2] += 1f; - if (npc.ai[2] >= attackTimer) - { - calamityGlobalNPC.newAI[0] += exhaustionIncreasePerAttack; - calamityGlobalNPC.newAI[2] = 0f; - npc.ai[0] = 5f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.TargetClosest(); - npc.netUpdate = true; - } - } - - // Transition to phase 3 and summon sharks from above - else if (npc.ai[0] == 9f) - { - // Velocity - npc.velocity *= 0.98f; - npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); - - // Sound - if (npc.ai[2] == phaseTransitionTimer - 60) - modNPC.RoarSoundSlot = SoundEngine.PlaySound(OldDuke.OldDuke.RoarSound, npc.Center); - - if (npc.ai[2] >= phaseTransitionTimer - 60) - { - if (npc.ai[2] % 18f == 0f) - { - calamityGlobalNPC.newAI[2] += 200f; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + 50f + calamityGlobalNPC.newAI[2]), (int)(npc.Center.Y - 540f), ModContent.NPCType(), 0, 0f, 0f, 1f, sharkronVelocity, 255); - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X - 50f - calamityGlobalNPC.newAI[2]), (int)(npc.Center.Y - 540f), ModContent.NPCType(), 0, 0f, 0f, -1f, sharkronVelocity, 255); - - if (Main.getGoodWorld) - { - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + 50f + calamityGlobalNPC.newAI[2] * 0.5f), (int)(npc.Center.Y + 270f), ModContent.NPCType(), 0, 0f, 0f, 1f, -sharkronVelocity, 255); - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X - 50f - calamityGlobalNPC.newAI[2] * 0.5f), (int)(npc.Center.Y + 270f), ModContent.NPCType(), 0, 0f, 0f, -1f, -sharkronVelocity, 255); - } - } - } - } - - npc.ai[2] += 1f; - if (npc.ai[2] >= phaseTransitionTimer) - { - calamityGlobalNPC.newAI[0] = 0f; - calamityGlobalNPC.newAI[1] = 0f; - calamityGlobalNPC.newAI[2] = 0f; - npc.ai[0] = 10f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.TargetClosest(); - npc.netUpdate = true; - } - } - - // Phase 3 - else if (npc.ai[0] == 10f && !player.dead) - { - // Alpha - npc.alpha -= 25; - if (npc.alpha < 0) - npc.alpha = 0; - - // Movement location - if (npc.ai[1] == 0f) - npc.ai[1] = 500 * Math.Sign((npc.Center - player.Center).X); - - Vector2 desiredVelocity = Vector2.Normalize(player.Center + new Vector2(-npc.ai[1], -300f) - npc.Center - npc.velocity) * idlePhaseVelocity; - npc.SimpleFlyMovement(desiredVelocity, idlePhaseAcceleration); - - // Rotation and direction - int phase3FaceDirection = Math.Sign(player.Center.X - npc.Center.X); - if (phase3FaceDirection != 0) - { - if (npc.ai[2] == 0f && phase3FaceDirection != npc.direction) - { - npc.rotation += pie; - for (int l = 0; l < npc.oldPos.Length; l++) - npc.oldPos[l] = Vector2.Zero; - } - - npc.direction = phase3FaceDirection; - - if (npc.spriteDirection != -npc.direction) - npc.rotation += pie; - - npc.spriteDirection = -npc.direction; - } - - // Phase switch - if (calamityGlobalNPC.newAI[1] != 1f) - { - // Avoid cheap bullshit - npc.damage = 0; - - npc.ai[2] += 1f; - if (npc.ai[2] >= idlePhaseTimer) - { - int phase3AttackPicker = 0; - switch ((int)npc.ai[3]) - { - case 0: - case 2: - case 3: - case 5: - case 6: - case 7: - phase3AttackPicker = 1; - break; - case 1: - case 8: - phase3AttackPicker = 2; - break; - case 4: - npc.ai[3] = 1f; - phase3AttackPicker = 3; - break; - case 9: - npc.ai[3] = 6f; - phase3AttackPicker = 4; - break; - } - - // Set velocity for charge - if (phase3AttackPicker == 1) - { - npc.ai[0] = 11f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - - // Velocity and rotation - Vector2 distanceVector = player.Center + player.velocity * 20f - npc.Center; - npc.velocity = Vector2.Normalize(distanceVector) * chargeVelocity; - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); - - // Direction - if (phase3FaceDirection != 0) - { - npc.direction = phase3FaceDirection; - - if (npc.spriteDirection == 1) - npc.rotation += pie; - - npc.spriteDirection = -npc.direction; - } - } - - // Pause - else if (phase3AttackPicker == 2) - { - npc.ai[0] = 12f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - - else if (phase3AttackPicker == 3) - { - npc.ai[0] = 13f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - - // Set velocity for spin - else if (phase3AttackPicker == 4) - { - // Velocity and rotation - npc.velocity = Vector2.Normalize(player.Center - npc.Center) * spinAttackSpeed; - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); - - // Direction - if (phase3FaceDirection != 0) - { - npc.direction = phase3FaceDirection; - - if (npc.spriteDirection == 1) - npc.rotation += pie; - - npc.spriteDirection = -npc.direction; - } - - npc.ai[0] = 14f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - - npc.netUpdate = true; - } - } - } - - // Charge - else if (npc.ai[0] == 11f) - { - // The dumbest thing to ever exist - if (CalamityWorld.LegendaryMode && revenge && npc.ai[2] % 6f == 0f) - { - // Rotation and direction - int dir = Math.Sign(player.Center.X - npc.Center.X); - if (dir != 0) - { - if (npc.ai[2] == 0f && dir != npc.direction) - npc.rotation += pie; - - npc.direction = dir; - - if (npc.spriteDirection != -npc.direction) - npc.rotation += pie; - - npc.spriteDirection = -npc.direction; - } - - Vector2 distanceVector = player.Center + player.velocity * 20f - npc.Center; - npc.velocity = Vector2.Normalize(distanceVector) * chargeVelocity; - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); - - // Direction - if (dir != 0) - { - npc.direction = dir; - - if (npc.spriteDirection == 1) - npc.rotation += pie; - - npc.spriteDirection = -npc.direction; - } - } - else - { - // Accelerate - npc.velocity *= 1.01f; - } - - // Spawn dust - int phase3ChargeDustAmt = 7; - for (int m = 0; m < phase3ChargeDustAmt; m++) - { - Vector2 arg_2444_0 = (Vector2.Normalize(npc.velocity) * new Vector2((npc.width + 50) / 2f, npc.height) * 0.75f).RotatedBy((m - (phase3ChargeDustAmt / 2 - 1)) * pie / phase3ChargeDustAmt) + npc.Center; - Vector2 vector11 = ((float)(Main.rand.NextDouble() * pie) - MathHelper.PiOver2).ToRotationVector2() * Main.rand.Next(3, 8); - int phase3ChargeDust = Dust.NewDust(arg_2444_0 + vector11, 0, 0, (int)CalamityDusts.SulfurousSeaAcid, vector11.X * 2f, vector11.Y * 2f, 100, default, 1.4f); - Main.dust[phase3ChargeDust].noGravity = true; - Main.dust[phase3ChargeDust].noLight = true; - Main.dust[phase3ChargeDust].velocity /= 4f; - Main.dust[phase3ChargeDust].velocity -= npc.velocity; - } - - npc.ai[2] += 1f; - if (npc.ai[2] >= chargeTime) - { - calamityGlobalNPC.newAI[0] += exhaustionIncreasePerAttack; - npc.ai[0] = 10f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] += 2f; - npc.TargetClosest(); - npc.netUpdate = true; - } - } - - // Pause before teleport - else if (npc.ai[0] == 12f) - { - // Avoid cheap bullshit - npc.damage = 0; - - // Alpha - if (npc.alpha < 255 && npc.ai[2] >= teleportPauseTimer - 15f) - { - npc.alpha += 17; - if (npc.alpha > 255) - npc.alpha = 255; - } - - // Velocity - npc.velocity *= 0.98f; - npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); - - // Play sound - if (npc.ai[2] == teleportPauseTimer / 2) - modNPC.RoarSoundSlot = SoundEngine.PlaySound(OldDuke.OldDuke.RoarSound, npc.Center); - - if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == teleportPauseTimer / 2) - { - // Teleport location - if (npc.ai[1] == 0f) - npc.ai[1] = 600 * Math.Sign((npc.Center - player.Center).X); - - // Rotation and direction - Vector2 center = player.Center + new Vector2(npc.ai[1], -300f); - Vector2 npcCenter = npc.Center = center; - int phase3TeleportFaceDirection = Math.Sign(player.Center.X - npcCenter.X); - if (phase3TeleportFaceDirection != 0) - { - if (npc.ai[2] == 0f && phase3TeleportFaceDirection != npc.direction) - { - npc.rotation += pie; - for (int n = 0; n < npc.oldPos.Length; n++) - npc.oldPos[n] = Vector2.Zero; - } - - npc.direction = phase3TeleportFaceDirection; - - if (npc.spriteDirection != -npc.direction) - npc.rotation += pie; - - npc.spriteDirection = -npc.direction; - } - } - - npc.ai[2] += 1f; - if (npc.ai[2] >= teleportPauseTimer) - { - npc.ai[0] = 10f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - - npc.ai[3] += 2f; - if (npc.ai[3] >= 9f) - npc.ai[3] = 0f; - - npc.netUpdate = true; - } - } - - // Vomit a huge amount of gore into the sky and call sharks from the sides of the screen - else if (npc.ai[0] == 13f) - { - // Velocity - npc.velocity *= 0.98f; - npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); - - // Play sound - if (npc.ai[2] == attackTimer - 30) - { - SoundEngine.PlaySound(OldDuke.OldDuke.VomitSound, npc.Center); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Vector2 phase3GoreDirection = npc.rotation.ToRotationVector2() * (Vector2.UnitX * npc.direction) * (npc.width + 20) / 2f + npc.Center; - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - int totalGore = Main.getGoodWorld ? 40 : 20; - for (int i = 0; i < totalGore; i++) - { - float velocityX = npc.direction * goreVelocityX * (Main.rand.NextFloat(0.2f, 0.8f) + 0.5f); - float velocityY = goreVelocityY * (Main.rand.NextFloat(0.2f, 0.8f) + 0.5f); - - if (Main.getGoodWorld) - { - velocityX *= Main.rand.NextFloat() + 0.5f; - velocityY *= Main.rand.NextFloat() + 0.5f; - } - - Projectile.NewProjectile(npc.GetSource_FromAI(), phase3GoreDirection.X, phase3GoreDirection.Y, velocityX, -velocityY, type, damage, 0f, Main.myPlayer, 0f, 0f); - } - } - } - - if (npc.ai[2] >= attackTimer - 90) - { - if (npc.ai[2] % 18f == 0f) - { - calamityGlobalNPC.newAI[2] += 150f; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - float x = 900f - calamityGlobalNPC.newAI[2]; - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + x), (int)(npc.Center.Y - calamityGlobalNPC.newAI[2]), ModContent.NPCType(), 0, 0f, 0f, npc.whoAmI, 0f, 255); - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X - x), (int)(npc.Center.Y - calamityGlobalNPC.newAI[2]), ModContent.NPCType(), 0, 0f, 0f, npc.whoAmI, 0f, 255); - - if (Main.getGoodWorld) - { - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + x), (int)(npc.Center.Y - calamityGlobalNPC.newAI[2] * 0.5f), ModContent.NPCType(), 0, 0f, 0f, npc.whoAmI, 0f, 255); - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X - x), (int)(npc.Center.Y - calamityGlobalNPC.newAI[2] * 0.5f), ModContent.NPCType(), 0, 0f, 0f, npc.whoAmI, 0f, 255); - } - } - } - } - - npc.ai[2] += 1f; - if (npc.ai[2] >= attackTimer) - { - calamityGlobalNPC.newAI[0] += exhaustionIncreasePerAttack; - calamityGlobalNPC.newAI[2] = 0f; - npc.ai[0] = 10f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.TargetClosest(); - npc.netUpdate = true; - } - } - - // Tooth Ball and Vortex spin - else if (npc.ai[0] == 14f) - { - // Play sounds and spawn Tooth Balls and a Vortex - if (npc.ai[2] == 0f) - { - modNPC.RoarSoundSlot = SoundEngine.PlaySound(OldDuke.OldDuke.RoarSound, npc.Center); - - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - Vector2 vortexSpawn = npc.Center + npc.velocity.RotatedBy(MathHelper.PiOver2 * -npc.direction) * spinTime / MathHelper.TwoPi; - if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(npc.GetSource_FromAI(), vortexSpawn, Vector2.Zero, type, damage, 0f, Main.myPlayer, vortexSpawn.X, vortexSpawn.Y); - } - - if (npc.ai[2] % toothBallSpinPhaseDivisor == 0f) - { - if (npc.ai[2] != 0f) - SoundEngine.PlaySound(OldDuke.OldDuke.VomitSound, npc.Center); - - Vector2 phase3ToothBallDirection = Vector2.Normalize(npc.velocity) * (npc.width + 20) / 2f + npc.Center; - Vector2 toothBallVelocity = Vector2.Normalize(npc.velocity).RotatedBy(MathHelper.PiOver2 * npc.direction) * toothBallSpinToothBallVelocity; - Vector2 toothBallSpawnPos = new Vector2(phase3ToothBallDirection.X, phase3ToothBallDirection.Y + 45f); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int toothBall = NPC.NewNPC(npc.GetSource_FromAI(), (int)toothBallSpawnPos.X, (int)toothBallSpawnPos.Y, ModContent.NPCType(), 0, toothBallVelocity.X, toothBallVelocity.Y); - Main.npc[toothBall].target = npc.target; - Main.npc[toothBall].velocity = Vector2.Normalize(toothBallVelocity) * toothBallSpinToothBallVelocity * 0.5f; - Main.npc[toothBall].netUpdate = true; - Main.npc[toothBall].ai[3] = 60f; - } - - for (int i = 0; i < 50; i++) - { - int dustID; - switch (Main.rand.Next(6)) - { - case 0: - case 1: - case 2: - case 3: - dustID = (int)CalamityDusts.SulfurousSeaAcid; - break; - default: - dustID = DustID.Blood; - break; - } - - // Choose a random speed and angle to belch out the vomit - float dustSpeed = Main.rand.NextFloat(3.0f, 12.0f); - float angleRandom = 0.06f; - Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(toothBallVelocity.ToRotation()); - dustVel = dustVel.RotatedBy(-angleRandom); - dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); - - // Pick a size for the vomit particles - float scale = Main.rand.NextFloat(1f, 2f); - - // Actually spawn the vomit - int idx = Dust.NewDust(toothBallSpawnPos, 40, 40, dustID, dustVel.X, dustVel.Y, 0, default, scale); - Main.dust[idx].noGravity = true; - } - } - - // Velocity and rotation - npc.velocity = npc.velocity.RotatedBy(-(double)spinSpeed * npc.direction); - npc.rotation -= spinSpeed * npc.direction; - - npc.ai[2] += 1f; - if (npc.ai[2] >= toothBallSpinTimer) - { - calamityGlobalNPC.newAI[0] += exhaustionIncreasePerAttack; - npc.ai[0] = 10f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.TargetClosest(); - npc.netUpdate = true; - } - } - - if (SoundEngine.TryGetActiveSound(modNPC.RoarSoundSlot, out var roarSound) && roarSound.IsPlaying) - { - roarSound.Position = npc.Center; - } - } - #endregion - - #region Gem Crawler AI - public static void GemCrawlerAI(NPC npc, Mod mod, float speedDetect, float speedAdditive) - { - int turnAroundDelay = 30; - bool unusedFlag = false; - bool isRunning = false; - bool shouldTurnAround = false; - if (npc.velocity.Y == 0f && ((npc.velocity.X > 0f && npc.direction > 0) || (npc.velocity.X < 0f && npc.direction < 0))) - { - isRunning = true; - npc.ai[3] += 1f; - } - if ((npc.position.X == npc.oldPosition.X || npc.ai[3] >= (float)turnAroundDelay) | isRunning) - { - npc.ai[3] += 1f; - shouldTurnAround = true; - } - else if (npc.ai[3] > 0f) - { - npc.ai[3] -= 1f; - } - if (npc.ai[3] > (float)(turnAroundDelay * 10)) - { - npc.ai[3] = 0f; - } - if (npc.justHit) - { - npc.ai[3] = 0f; - } - if (npc.ai[3] == (float)turnAroundDelay) - { - npc.netUpdate = true; - } - Vector2 npcPos = new Vector2(npc.Center.X, npc.Center.Y); - float xDist = Main.player[npc.target].Center.X - npcPos.X; - float yDist = Main.player[npc.target].Center.Y - npcPos.Y; - float targetDist = (float)Math.Sqrt((double)(xDist * xDist + yDist * yDist)); - if (targetDist < 200f && !shouldTurnAround) - { - npc.ai[3] = 0f; - } - if (npc.ai[3] < (float)turnAroundDelay) - { - npc.TargetClosest(true); - } - else - { - if (npc.velocity.X == 0f) - { - if (npc.velocity.Y == 0f) - { - npc.ai[0] += 1f; - if (npc.ai[0] >= 2f) - { - npc.direction *= -1; - npc.spriteDirection = -npc.direction; - npc.ai[0] = 0f; - } - } - } - else - { - npc.ai[0] = 0f; - } - npc.directionY = -1; - if (npc.direction == 0) - { - npc.direction = 1; - } - } - float maxVelocity = speedDetect; //5 - float acceleration = speedAdditive; //0.05 - if (!unusedFlag && (npc.velocity.Y == 0f || npc.wet || (npc.velocity.X <= 0f && npc.direction > 0) || (npc.velocity.X >= 0f && npc.direction < 0))) - { - if (npc.velocity.X < -maxVelocity || npc.velocity.X > maxVelocity) - { - if (npc.velocity.Y == 0f) - { - npc.velocity *= 0.8f; - } - } - else if (npc.velocity.X < maxVelocity && npc.direction == -1) - { - npc.velocity.X = npc.velocity.X + acceleration; - if (npc.velocity.X > maxVelocity) - { - npc.velocity.X = maxVelocity; - } - } - else if (npc.velocity.X > -maxVelocity && npc.direction == 1) - { - npc.velocity.X = npc.velocity.X - acceleration; - if (npc.velocity.X < -maxVelocity) - { - npc.velocity.X = -maxVelocity; - } - } - } - if (npc.velocity.Y >= 0f) - { - int faceDirection = 0; - if (npc.velocity.X < 0f) - { - faceDirection = -1; - } - if (npc.velocity.X > 0f) - { - faceDirection = 1; - } - Vector2 position = npc.position; - position.X += npc.velocity.X; - int x = (int)((position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 1) * faceDirection)) / 16f); - int y = (int)((position.Y + (float)npc.height - 1f) / 16f); - if ((float)(x * 16) < position.X + (float)npc.width && (float)(x * 16 + 16) > position.X && ((Main.tile[x, y].HasUnactuatedTile && !Main.tile[x, y].TopSlope && !Main.tile[x, y - 1].TopSlope && Main.tileSolid[(int)Main.tile[x, y].TileType] && !Main.tileSolidTop[(int)Main.tile[x, y].TileType]) || (Main.tile[x, y - 1].IsHalfBlock && Main.tile[x, y - 1].HasUnactuatedTile)) && (!Main.tile[x, y - 1].HasUnactuatedTile || !Main.tileSolid[(int)Main.tile[x, y - 1].TileType] || Main.tileSolidTop[(int)Main.tile[x, y - 1].TileType] || (Main.tile[x, y - 1].IsHalfBlock && (!Main.tile[x, y - 4].HasUnactuatedTile || !Main.tileSolid[(int)Main.tile[x, y - 4].TileType] || Main.tileSolidTop[(int)Main.tile[x, y - 4].TileType]))) && (!Main.tile[x, y - 2].HasUnactuatedTile || !Main.tileSolid[(int)Main.tile[x, y - 2].TileType] || Main.tileSolidTop[(int)Main.tile[x, y - 2].TileType]) && (!Main.tile[x, y - 3].HasUnactuatedTile || !Main.tileSolid[(int)Main.tile[x, y - 3].TileType] || Main.tileSolidTop[(int)Main.tile[x, y - 3].TileType]) && (!Main.tile[x - faceDirection, y - 3].HasUnactuatedTile || !Main.tileSolid[(int)Main.tile[x - faceDirection, y - 3].TileType])) - { - float npcBottom = (float)(y * 16); - if (Main.tile[x, y].IsHalfBlock) - { - npcBottom += 8f; - } - if (Main.tile[x, y - 1].IsHalfBlock) - { - npcBottom -= 8f; - } - if (npcBottom < position.Y + (float)npc.height) - { - float percentageTileRisen = position.Y + (float)npc.height - npcBottom; - if (percentageTileRisen <= 16.1f) - { - npc.gfxOffY += npc.position.Y + (float)npc.height - npcBottom; - npc.position.Y = npcBottom - (float)npc.height; - if (percentageTileRisen < 9f) - { - npc.stepSpeed = 1f; - } - else - { - npc.stepSpeed = 2f; - } - } - } - } - } - } - #endregion - - #region Dungeon Spirit AI - public static void DungeonSpiritAI(NPC npc, Mod mod, float speed, float rotation, bool lantern = false) - { - npc.TargetClosest(true); - Vector2 npcPos = new Vector2(npc.Center.X, npc.Center.Y); - float xDist = Main.player[npc.target].Center.X - npcPos.X; - float yDist = Main.player[npc.target].Center.Y - npcPos.Y; - float targetDist = (float)Math.Sqrt((double)(xDist * xDist + yDist * yDist)); - float homingSpeed = speed; - - if (lantern) - { - if (npc.localAI[0] < 85f) - { - homingSpeed = 0.1f; - targetDist = homingSpeed / targetDist; - xDist *= targetDist; - yDist *= targetDist; - npc.velocity = (npc.velocity * 100f + new Vector2(xDist, yDist)) / 101f; - npc.localAI[0] += 1f; - return; - } - - npc.dontTakeDamage = false; - npc.chaseable = true; - } - - targetDist = homingSpeed / targetDist; - xDist *= targetDist; - yDist *= targetDist; - npc.velocity.X = (npc.velocity.X * 100f + xDist) / 101f; - npc.velocity.Y = (npc.velocity.Y * 100f + yDist) / 101f; - - if (lantern) - { - npc.rotation = npc.velocity.X * 0.08f; - npc.spriteDirection = (npc.direction > 0) ? 1 : -1; - } - else - npc.rotation = (float)Math.Atan2((double)yDist, (double)xDist) + rotation; - } - #endregion - - #region Unicorn AI - public static void UnicornAI(NPC npc, Mod mod, bool spin, float bounciness, float speedDetect, float speedAdditive, float bouncy1 = -8.5f, float bouncy2 = -7.5f, float bouncy3 = -7f, float bouncy4 = -6f, float bouncy5 = -8f) - { - bool DogPhase1 = npc.type == ModContent.NPCType() && npc.life > npc.lifeMax * (CalamityWorld.death ? 0.9 : CalamityWorld.revenge ? 0.7 : 0.5); - bool DogPhase2 = npc.type == ModContent.NPCType() && npc.life <= npc.lifeMax * (CalamityWorld.death ? 0.9 : CalamityWorld.revenge ? 0.7 : 0.5); - int turnAroundDelay = 30; - bool isRunning = false; - bool shouldTurnAround = false; - if (npc.velocity.Y == 0f && ((npc.velocity.X > 0f && npc.direction < 0) || (npc.velocity.X < 0f && npc.direction > 0))) - { - isRunning = true; - npc.ai[3] += 1f; - } - int turnAroundDelayMult = DogPhase1 ? 10 : 4; - if (!DogPhase1) - { - bool noYVelocity = npc.velocity.Y == 0f; - for (int i = 0; i < Main.maxNPCs; i++) - { - if (i != npc.whoAmI && Main.npc[i].active && Main.npc[i].type == npc.type && Math.Abs(npc.position.X - Main.npc[i].position.X) + Math.Abs(npc.position.Y - Main.npc[i].position.Y) < (float)npc.width) - { - if (npc.position.X < Main.npc[i].position.X) - { - npc.velocity.X -= 0.05f; - } - else - { - npc.velocity.X += 0.05f; - } - if (npc.position.Y < Main.npc[i].position.Y) - { - npc.velocity.Y -= 0.05f; - } - else - { - npc.velocity.Y += 0.05f; - } - } - } - if (noYVelocity) - { - npc.velocity.Y = 0f; - } - } - if (npc.position.X == npc.oldPosition.X || npc.ai[3] >= (float)turnAroundDelay || isRunning) - { - npc.ai[3] += 1f; - shouldTurnAround = true; - } - else if (npc.ai[3] > 0f) - { - npc.ai[3] -= 1f; - } - if (npc.ai[3] > (float)(turnAroundDelay * turnAroundDelayMult)) - { - npc.ai[3] = 0f; - } - if (npc.justHit) - { - npc.ai[3] = 0f; - } - if (npc.ai[3] == (float)turnAroundDelay) - { - npc.netUpdate = true; - } - Vector2 npcPos = new Vector2(npc.Center.X, npc.Center.Y); - float xDist = Main.player[npc.target].Center.X - npcPos.X; - float yDist = Main.player[npc.target].Center.Y - npcPos.Y; - float targetDist = (float)Math.Sqrt((double)(xDist * xDist + yDist * yDist)); - if (targetDist < 200f && !shouldTurnAround) - { - npc.ai[3] = 0f; - } - if (!DogPhase1) - { - if (npc.velocity.Y == 0f && Math.Abs(npc.velocity.X) > 3f && ((npc.Center.X < Main.player[npc.target].Center.X && npc.velocity.X > 0f) || (npc.Center.X > Main.player[npc.target].Center.X && npc.velocity.X < 0f))) - { - npc.velocity.Y -= bounciness; - if (npc.type == ModContent.NPCType()) - { - SoundEngine.PlaySound(SoundID.Item14, npc.Center); - for (int k = 0; k < 10; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Brimstone, 0f, -1f, 0, default, 1f); - } - if (Main.zenithWorld) - { - float screenShakePower = 2 * Utils.GetLerpValue(1300f, 0f, npc.Distance(Main.LocalPlayer.Center), true); - if (Main.LocalPlayer.Calamity().GeneralScreenShakePower < screenShakePower) - Main.LocalPlayer.Calamity().GeneralScreenShakePower = screenShakePower; - } - } - if (npc.type == ModContent.NPCType()) - { - SoundEngine.PlaySound(SoundID.NPCHit7, npc.Center); - } - if (DogPhase2) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 33, 0f, -1f, 0, default, 1f); - } - } - if (npc.type == ModContent.NPCType() || npc.type == ModContent.NPCType()) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 33, 0f, -1f, 0, default, 1f); - } - } - } - } - if (npc.ai[3] < (float)turnAroundDelay) - { - npc.TargetClosest(true); - } - else - { - if (npc.velocity.X == 0f) - { - if (npc.velocity.Y == 0f) - { - npc.ai[0] += 1f; - if (npc.ai[0] >= 2f) - { - npc.direction *= -1; - npc.spriteDirection = npc.direction; - npc.ai[0] = 0f; - } - } - } - else - { - npc.ai[0] = 0f; - } - npc.directionY = -1; - if (npc.direction == 0) - { - npc.direction = 1; - } - } - - if (npc.velocity.Y == 0f || npc.wet || (npc.velocity.X <= 0f && npc.direction < 0) || (npc.velocity.X >= 0f && npc.direction > 0)) - { - if (Math.Sign(npc.velocity.X) != npc.direction && !DogPhase1) - { - npc.velocity.X *= 0.92f; - } - float sandstormPush = MathHelper.Lerp(0.6f, 1f, Math.Abs(Main.windSpeedCurrent)) * (float)Math.Sign(Main.windSpeedCurrent); - if (!Main.player[npc.target].ZoneSandstorm) - { - sandstormPush = 0f; - } - float maxVelocity = speedDetect; - float acceleration = speedAdditive; - if (npc.velocity.X < -maxVelocity || npc.velocity.X > maxVelocity) - { - if (npc.velocity.Y == 0f) - { - npc.velocity *= 0.8f; - } - } - else if (npc.velocity.X < maxVelocity && npc.direction == 1) - { - npc.velocity.X += acceleration; - if (npc.velocity.X > maxVelocity) - { - npc.velocity.X = maxVelocity; - } - } - else if (npc.velocity.X > -maxVelocity && npc.direction == -1) - { - npc.velocity.X -= acceleration; - if (npc.velocity.X < -maxVelocity) - { - npc.velocity.X = -maxVelocity; - } - } - } - if (npc.velocity.Y >= 0f) - { - int faceDirection = 0; - if (npc.velocity.X < 0f) - { - faceDirection = -1; - } - if (npc.velocity.X > 0f) - { - faceDirection = 1; - } - Vector2 position = npc.position; - position.X += npc.velocity.X; - int x = (int)((position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 1) * faceDirection)) / 16f); - int y = (int)((position.Y + (float)npc.height - 1f) / 16f); - - // 21JAN2023: Ozzatron -- this is probably the single most unmaintainable if statement I've ever seen - // I have broken all the individual statements out even though I do not fully understand the code. - Tile t_xy = CalamityUtils.ParanoidTileRetrieval(x, y); - Tile t_xy1 = CalamityUtils.ParanoidTileRetrieval(x, y - 1); - Tile t_xy2 = CalamityUtils.ParanoidTileRetrieval(x, y - 2); - Tile t_xy3 = CalamityUtils.ParanoidTileRetrieval(x, y - 3); - Tile t_xOffY3 = CalamityUtils.ParanoidTileRetrieval(x - faceDirection, y - 3); // 3 down, offset 1 in the direction of the NPC's movement - Tile t_xy4 = CalamityUtils.ParanoidTileRetrieval(x, y - 4); - bool positionCheck = (float)(x * 16) < position.X + (float)npc.width && (float)(x * 16 + 16) > position.X; - bool tileSolidityCheck1 = t_xy.HasUnactuatedTile && !t_xy.TopSlope && !t_xy1.TopSlope && Main.tileSolid[t_xy.TileType] && !Main.tileSolidTop[t_xy.TileType]; - bool oneBelowIsSolidHalf = t_xy1.IsHalfBlock && t_xy1.HasUnactuatedTile; - bool canFallThrough = !t_xy1.HasUnactuatedTile || !Main.tileSolid[t_xy1.TileType] || Main.tileSolidTop[t_xy1.TileType] || (t_xy1.IsHalfBlock && (!t_xy4.HasUnactuatedTile || !Main.tileSolid[t_xy4.TileType] || Main.tileSolidTop[t_xy4.TileType])); - bool twoDownIsNonSolid = !t_xy2.HasUnactuatedTile || !Main.tileSolid[t_xy2.TileType] || Main.tileSolidTop[t_xy2.TileType]; - bool threeDownIsNonSolid = !t_xy3.HasUnactuatedTile || !Main.tileSolid[t_xy3.TileType] || Main.tileSolidTop[t_xy3.TileType]; - // Notice it doesn't check for platforms in ther offset position. This is why walking AIs twirl on 1-wide platforms in hellevators. They have to turn around before this check succeeds. - bool threeDownOffsetIsNonSolid = !t_xOffY3.HasUnactuatedTile || !Main.tileSolid[t_xOffY3.TileType]; - if (positionCheck && (tileSolidityCheck1 || oneBelowIsSolidHalf) && canFallThrough && twoDownIsNonSolid && threeDownIsNonSolid && threeDownOffsetIsNonSolid) - { - float tilePixelPosition = (float)(y * 16); - if (Main.tile[x, y].IsHalfBlock) - { - tilePixelPosition += 8f; - } - if (Main.tile[x, y - 1].IsHalfBlock) - { - tilePixelPosition -= 8f; - } - if (tilePixelPosition < position.Y + (float)npc.height) - { - float percentageTileRisen = position.Y + (float)npc.height - tilePixelPosition; - if ((double)percentageTileRisen <= 16.1) - { - npc.gfxOffY += npc.position.Y + (float)npc.height - tilePixelPosition; - npc.position.Y = tilePixelPosition - (float)npc.height; - if (percentageTileRisen < 9f) - { - npc.stepSpeed = 1f; - } - else - { - npc.stepSpeed = 2f; - } - } - } - } - } - if (npc.velocity.Y == 0f) - { - int npcTileX = (int)((npc.position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 2) * npc.direction) + npc.velocity.X * 5f) / 16f); - int npcTileY = (int)((npc.position.Y + (float)npc.height - 15f) / 16f); - int spriteDirection = npc.spriteDirection; - spriteDirection *= -1; - if ((npc.velocity.X < 0f && spriteDirection == -1) || (npc.velocity.X > 0f && spriteDirection == 1)) - { - if (Main.tile[npcTileX, npcTileY - 2].HasUnactuatedTile && Main.tileSolid[(int)Main.tile[npcTileX, npcTileY - 2].TileType]) - { - if (Main.tile[npcTileX, npcTileY - 3].HasUnactuatedTile && Main.tileSolid[(int)Main.tile[npcTileX, npcTileY - 3].TileType]) - { - npc.velocity.Y = bouncy1; - npc.netUpdate = true; - } - else - { - npc.velocity.Y = bouncy2; - npc.netUpdate = true; - } - } - else if (Main.tile[npcTileX, npcTileY - 1].HasUnactuatedTile && !Main.tile[npcTileX, npcTileY - 1].TopSlope && Main.tileSolid[(int)Main.tile[npcTileX, npcTileY - 1].TileType]) - { - npc.velocity.Y = bouncy3; - npc.netUpdate = true; - } - else if (npc.position.Y + (float)npc.height - (float)(npcTileY * 16) > 20f && Main.tile[npcTileX, npcTileY].HasUnactuatedTile && !Main.tile[npcTileX, npcTileY].TopSlope && Main.tileSolid[(int)Main.tile[npcTileX, npcTileY].TileType]) - { - npc.velocity.Y = bouncy4; - npc.netUpdate = true; - } - else if ((npc.directionY < 0 || Math.Abs(npc.velocity.X) > 3f) && (!Main.tile[npcTileX, npcTileY + 1].HasUnactuatedTile || !Main.tileSolid[(int)Main.tile[npcTileX, npcTileY + 1].TileType]) && (!Main.tile[npcTileX, npcTileY + 2].HasUnactuatedTile || !Main.tileSolid[(int)Main.tile[npcTileX, npcTileY + 2].TileType]) && (!Main.tile[npcTileX + npc.direction, npcTileY + 3].HasUnactuatedTile || !Main.tileSolid[(int)Main.tile[npcTileX + npc.direction, npcTileY + 3].TileType])) - { - npc.velocity.Y = bouncy5; - npc.netUpdate = true; - } - } - } - if (spin) - { - npc.rotation += npc.velocity.X * 0.05f; - npc.spriteDirection = -npc.direction; - } - } - #endregion - - #region Swimming AI - // Passiveness: - // 0 = Catfish, Flounder, Frogfish, Viperfish, Moray Eel, Laserfish - // 1 = Blinded Angler - // 2 = Prism-Back, Toxic Minnow - // 3 = Sea Minnow - public static void PassiveSwimmingAI(NPC npc, Mod mod, int passiveness, float detectRange, float xSpeed, float ySpeed, float speedLimitX, float speedLimitY, float rotation, bool spriteFacesLeft = true) - { - if (spriteFacesLeft) - npc.spriteDirection = (npc.direction > 0) ? 1 : -1; - else - npc.spriteDirection = (npc.direction > 0) ? -1 : 1; - - npc.noGravity = true; - if (npc.direction == 0) - { - npc.TargetClosest(true); - } - Player target = Main.player[npc.target]; - if (npc.justHit && passiveness != 3) - { - npc.chaseable = true; - } - if (npc.wet) - { - bool hasWetTarget = npc.chaseable; - npc.TargetClosest(false); - target = Main.player[npc.target]; - // Player detection behavior - if (passiveness != 2) - { - if (npc.type == ModContent.NPCType()) - { - if (target.wet && !target.dead) - { - hasWetTarget = true; - npc.chaseable = true; //once the enemy has detected the player, let minions fuck it up - } - } - if (npc.type == ModContent.NPCType()) - { - if (!target.dead) - { - hasWetTarget = true; - npc.chaseable = true; //once the enemy has detected the player, let minions fuck it up - } - } - else if (target.wet && !target.dead && (target.Center - npc.Center).Length() < detectRange && - Collision.CanHit(npc.position, npc.width, npc.height, target.position, target.width, target.height)) - { - hasWetTarget = true; - npc.chaseable = true; //once the enemy has detected the player, let minions fuck it up - } - else - { - if (passiveness == 1) - { - hasWetTarget = false; - } - } - } - if ((target.dead || !Collision.CanHit(npc.position, npc.width, npc.height, target.position, target.width, target.height)) && hasWetTarget) - { - hasWetTarget = false; - } - - // Swim back and forth - if (!hasWetTarget || passiveness == 2) - { - if (passiveness == 0) - { - npc.TargetClosest(true); - target = Main.player[npc.target]; - } - if (npc.collideX) - { - npc.velocity.X = npc.velocity.X * -1f; - npc.direction *= -1; - npc.netUpdate = true; - } - if (npc.collideY) - { - npc.netUpdate = true; - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = Math.Abs(npc.velocity.Y) * -1f; - npc.directionY = -1; - npc.ai[0] = -1f; - } - else if (npc.velocity.Y < 0f) - { - npc.velocity.Y = Math.Abs(npc.velocity.Y); - npc.directionY = 1; - npc.ai[0] = 1f; - } - } - } - - if (hasWetTarget && passiveness != 2) - { - npc.TargetClosest(true); - target = Main.player[npc.target]; - // Swim away from the player - if (passiveness == 3) - { - npc.velocity.X = npc.velocity.X - (float)npc.direction * xSpeed; - npc.velocity.Y = npc.velocity.Y - (float)npc.directionY * ySpeed; - } - // Swim toward the player - else - { - npc.velocity.X = npc.velocity.X + (float)npc.direction * (CalamityWorld.death ? 2f * xSpeed : CalamityWorld.revenge ? 1.5f * xSpeed : xSpeed); - npc.velocity.Y = npc.velocity.Y + (float)npc.directionY * (CalamityWorld.death ? 2f * ySpeed : CalamityWorld.revenge ? 1.5f * ySpeed : ySpeed); - } - float velocityCapX = CalamityWorld.death && passiveness != 3 ? 2f * speedLimitX : CalamityWorld.revenge ? 1.5f * speedLimitX : speedLimitX; - float velocityCapY = CalamityWorld.death && passiveness != 3 ? 2f * speedLimitY : CalamityWorld.revenge ? 1.5f * speedLimitY : speedLimitY; - npc.velocity.X = MathHelper.Clamp(npc.velocity.X, -velocityCapX, velocityCapX); - npc.velocity.Y = MathHelper.Clamp(npc.velocity.Y, -velocityCapY, velocityCapY); - - if (npc.justHit) - npc.localAI[0] = 0f; - - // Laserfish shoot the player - if (npc.type == ModContent.NPCType()) - { - npc.localAI[0] += (CalamityWorld.death ? 2f : CalamityWorld.revenge ? 1.5f : 1f); - if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] >= 120f) - { - npc.localAI[0] = 0f; - if (Collision.CanHit(npc.position, npc.width, npc.height, target.position, target.width, target.height)) - { - float speed = 5f; - Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)(npc.height / 2)); - float velX = target.Center.X - vector.X + Main.rand.NextFloat(-20f, 20f); - float velY = target.Center.Y - vector.Y + Main.rand.NextFloat(-20f, 20f); - float dist = (float)Math.Sqrt((double)(velX * velX + velY * velY)); - dist = speed / dist; - velX *= dist; - velY *= dist; - int damage = Main.expertMode ? 40 : 50; - int beam = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X + (npc.spriteDirection == 1 ? 25f : -25f), npc.Center.Y + (target.position.Y > npc.Center.Y ? 5f : -5f), velX, velY, ProjectileID.EyeBeam, damage, 0f, Main.myPlayer); - Main.projectile[beam].tileCollide = true; - } - } - } - - // Flounder shoot Sulphuric Mist at the player - if (npc.type == ModContent.NPCType()) - { - if ((target.Center - npc.Center).Length() < 350f) - { - npc.localAI[0] += (CalamityWorld.death ? 3f : CalamityWorld.revenge ? 2f : 1f); - if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] >= 180f) - { - npc.localAI[0] = 0f; - if (Collision.CanHit(npc.position, npc.width, npc.height, target.position, target.width, target.height)) - { - float speed = 4f; - Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)(npc.height / 2)); - float velX = target.Center.X - vector.X + Main.rand.NextFloat(-20f, 20f); - float velY = target.Center.Y - vector.Y + Main.rand.NextFloat(-20f, 20f); - float dist = (float)Math.Sqrt((double)(velX * velX + velY * velY)); - dist = speed / dist; - velX *= dist; - velY *= dist; - int damage = Main.expertMode ? 25 : 35; - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X + (npc.spriteDirection == 1 ? 10f : -10f), npc.Center.Y, velX, velY, ModContent.ProjectileType(), damage, 0f, Main.myPlayer); - } - } - } - } - - // Sea Minnows face away from the player - if (npc.type == ModContent.NPCType()) - { - npc.direction *= -1; - } - } - else - { - // No target behavior - npc.velocity.X += (float)npc.direction * 0.1f; - if (npc.velocity.X < -2.5f || npc.velocity.X > 2.5f) - { - npc.velocity.X *= 0.95f; - } - if (npc.ai[0] == -1f) - { - npc.velocity.Y -= 0.01f; - if (npc.velocity.Y < -0.3f) - { - npc.ai[0] = 1f; - } - } - else - { - npc.velocity.Y += 0.01f; - if (npc.velocity.Y > 0.3f) - { - npc.ai[0] = -1f; - } - } - } - int npcTileX = (int)(npc.position.X + (float)(npc.width / 2)) / 16; - int npcTileY = (int)(npc.position.Y + (float)(npc.height / 2)) / 16; - if (Main.tile[npcTileX, npcTileY - 1].LiquidAmount > 128) - { - if (Main.tile[npcTileX, npcTileY + 1].HasTile) - { - npc.ai[0] = -1f; - } - else if (Main.tile[npcTileX, npcTileY + 2].HasTile) - { - npc.ai[0] = -1f; - } - } - if (npc.velocity.Y > 0.4f || npc.velocity.Y < -0.4f) - { - npc.velocity.Y = npc.velocity.Y * 0.95f; - } - } - else - { - // Out of water behavior - if (npc.velocity.Y == 0f) - { - npc.velocity.X = npc.velocity.X * 0.94f; - if (npc.velocity.X > -0.2f && npc.velocity.X < 0.2f) - { - npc.velocity.X = 0f; - } - } - npc.velocity.Y = npc.velocity.Y + 0.4f; - if (npc.velocity.Y > 12f) - { - npc.velocity.Y = 12f; - } - npc.ai[0] = 1f; - } - npc.rotation = npc.velocity.Y * (float)npc.direction * rotation; - float rotationLimit = 2f * rotation; - npc.rotation = MathHelper.Clamp(npc.rotation, -rotationLimit, rotationLimit); - } - #endregion - } -} diff --git a/NPCs/CalamityAIs/CalamityBossAIs/AquaticScourgeAI.cs b/NPCs/CalamityAIs/CalamityBossAIs/AquaticScourgeAI.cs new file mode 100644 index 0000000000..b1086e7143 --- /dev/null +++ b/NPCs/CalamityAIs/CalamityBossAIs/AquaticScourgeAI.cs @@ -0,0 +1,633 @@ +using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.CalPlayer; +using CalamityMod.Dusts; +using CalamityMod.Events; +using CalamityMod.NPCs.Abyss; +using CalamityMod.NPCs.AquaticScourge; +using CalamityMod.NPCs.AstrumAureus; +using CalamityMod.NPCs.AstrumDeus; +using CalamityMod.NPCs.BrimstoneElemental; +using CalamityMod.NPCs.Bumblebirb; +using CalamityMod.NPCs.CalClone; +using CalamityMod.NPCs.CeaselessVoid; +using CalamityMod.NPCs.Crags; +using CalamityMod.NPCs.NormalNPCs; +using CalamityMod.NPCs.OldDuke; +using CalamityMod.NPCs.SulphurousSea; +using CalamityMod.NPCs.SunkenSea; +using CalamityMod.Projectiles.Boss; +using CalamityMod.Projectiles.Enemy; +using CalamityMod.Sounds; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs +{ + public static class AquaticScourgeAI + { + public static void VanillaAquaticScourgeAI(NPC npc, Mod mod, bool head) + { + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + bool bossRush = BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || bossRush; + bool revenge = CalamityWorld.revenge || bossRush; + bool death = CalamityWorld.death || bossRush; + + bool getFuckedAI = Main.zenithWorld; + + if (head) + CalamityGlobalNPC.aquaticScourge = npc.whoAmI; + + // Adjust hostility and stats + bool nonHostile = calamityGlobalNPC.newAI[0] == 0f; + if (npc.justHit || npc.life <= npc.lifeMax * 0.999 || bossRush || Main.getGoodWorld) + { + if (nonHostile) + { + // Kiss my motherfucking ass you piece of shit game + npc.timeLeft *= 20; + npc.npcSlots = 16f; + CalamityMod.bossKillTimes.TryGetValue(npc.type, out int revKillTime); + calamityGlobalNPC.KillTime = revKillTime; + calamityGlobalNPC.newAI[0] = 1f; + nonHostile = false; + npc.boss = head; + npc.chaseable = true; + npc.netUpdate = true; + } + } + else + npc.damage = 0; + + // Percent life remaining + float lifeRatio = npc.life / (float)npc.lifeMax; + + // Phases + bool phase2 = lifeRatio < 0.75f; + bool phase3 = lifeRatio < 0.5f; + bool phase4 = lifeRatio < 0.25f; + + // Set worm variable + if (npc.ai[2] > 0f) + npc.realLife = (int)npc.ai[2]; + + if (!head) + { + if (npc.life > Main.npc[(int)npc.ai[1]].life) + npc.life = Main.npc[(int)npc.ai[1]].life; + } + + // Get a target + 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 || + player.position.Y > Main.worldSurface * 16.0 || + (player.position.X > 7680f && player.position.X < (Main.maxTilesX * 16 - 7680)); + + // Check for the flipped Abyss + if (Main.remixWorld) + { + notOcean = player.position.Y < Main.UnderworldLayer * 0.8f || player.position.Y > Main.UnderworldLayer || + (player.position.X > 7680f && player.position.X < (Main.maxTilesX * 16 - 7680)); + } + + // Enrage + if (head) + { + if (notOcean && !player.Calamity().ZoneSulphur && !bossRush) + { + if (npc.localAI[2] > 0f) + npc.localAI[2] -= 1f; + } + else + npc.localAI[2] = CalamityGlobalNPC.biomeEnrageTimerMax; + } + + bool biomeEnraged = npc.localAI[2] <= 0f || bossRush; + + float enrageScale = bossRush ? 1f : 0f; + if (biomeEnraged) + { + npc.Calamity().CurrentlyEnraged = !bossRush; + enrageScale += 2f; + } + + // Circular movement + float colorFadeTimeAfterSpiral = 90f; + float spiralGateValue = 480f; + bool doSpiral = false; + if (head && calamityGlobalNPC.newAI[0] == 1f && calamityGlobalNPC.newAI[2] == 1f && (revenge || getFuckedAI)) + { + doSpiral = calamityGlobalNPC.newAI[1] == 0f && calamityGlobalNPC.newAI[3] >= spiralGateValue; + if (Vector2.Distance(npc.Center, player.Center) < (getFuckedAI ? 1600f : 1000f) || doSpiral) + calamityGlobalNPC.newAI[3] += 1f; + + if (doSpiral) + { + npc.localAI[3] = colorFadeTimeAfterSpiral; + + // Vomit acid mist + float acidMistBarfDivisor = getFuckedAI ? 2f : ((float)Math.Floor(bossRush ? 4f : death ? 5f : 6f) * (phase3 ? 1.5f : 1f)); + if (calamityGlobalNPC.newAI[3] % acidMistBarfDivisor == 0f) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + float mistVelocity = death ? 10f : 8f; + Vector2 projectileVelocity = (npc.Center + npc.velocity * 10f - npc.Center).SafeNormalize(Vector2.UnitY); + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + projectileVelocity * 5f, projectileVelocity * mistVelocity, type, damage, 0f, Main.myPlayer); + Main.projectile[proj].tileCollide = false; + Main.projectile[proj].timeLeft = getFuckedAI ? 240 : 600; + } + } + + // Vomit circular spreads of acid clouds while in phase 3 + float toxicCloudBarfDivisor = bossRush ? 20f : death ? 30f : 40f; + if (calamityGlobalNPC.newAI[3] % toxicCloudBarfDivisor == 0f && phase3) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + int totalProjectiles = (phase4 ? 6 : 9) + (getFuckedAI ? Main.rand.Next(-2, 3) : (int)((calamityGlobalNPC.newAI[3] - spiralGateValue) / toxicCloudBarfDivisor) * (phase4 ? 2 : 3)); + float radians = MathHelper.TwoPi / totalProjectiles; + float cloudVelocity = 1f + enrageScale; + Vector2 spinningPoint = new Vector2(0f, -cloudVelocity); + for (int k = 0; k < totalProjectiles; k++) + { + Vector2 vector255 = spinningPoint.RotatedBy(radians * k); + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + vector255.SafeNormalize(Vector2.UnitY) * 5f, vector255, type, damage, 0f, Main.myPlayer); + } + } + } + + // Velocity boost + if (calamityGlobalNPC.newAI[3] == spiralGateValue) + { + npc.velocity = npc.velocity.SafeNormalize(Vector2.UnitY); + npc.velocity *= 24f; + } + + // Spin velocity + float velocity = (float)(Math.PI * 2D) / 120f; + // In GFB, contracts the radius as the fight progresses + if (getFuckedAI) + velocity *= phase3 ? 1.5f : phase2 ? 1.25f : 1f; + npc.velocity = npc.velocity.RotatedBy(-(double)velocity * npc.localAI[1]); + // Speed up even more in GFB for more radius + if (getFuckedAI && npc.velocity.Length() <= 32f) + npc.velocity *= 1.1f; + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) + MathHelper.PiOver2; + + // Reset and charge at target + // Don't reset in GFB + if (!getFuckedAI && calamityGlobalNPC.newAI[3] >= spiralGateValue + 120f) + { + calamityGlobalNPC.newAI[3] = 0f; + npc.TargetClosest(); + } + } + else + { + if (!Collision.CanHit(npc.Center, 1, 1, player.position, player.width, player.height) && calamityGlobalNPC.newAI[3] > 300f) + calamityGlobalNPC.newAI[3] -= 2f; + + if (npc.localAI[3] > 0f) + npc.localAI[3] -= 1f; + + npc.localAI[1] = npc.Center.X - player.Center.X < 0 ? 1f : -1f; + } + } + + // Adjust slowing debuff immunity + bool immuneToSlowingDebuffs = doSpiral || getFuckedAI; + npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + npc.buffImmune[BuffID.Slow] = immuneToSlowingDebuffs; + npc.buffImmune[BuffID.Webbed] = immuneToSlowingDebuffs; + + if (head) + { + // Spawn segments + if (calamityGlobalNPC.newAI[2] == 0f && npc.ai[0] == 0f) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int maxLength = getFuckedAI ? 24 : death ? 80 : revenge ? 40 : expertMode ? 35 : 30; + int Previous = npc.whoAmI; + for (int segments = 0; segments < maxLength; segments++) + { + int lol; + if (segments >= 0 && segments < maxLength - 1) + { + if (segments % 2 == 0) + lol = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, ModContent.NPCType(), npc.whoAmI); + else + lol = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, ModContent.NPCType(), npc.whoAmI); + } + else + lol = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, ModContent.NPCType(), npc.whoAmI); + + Main.npc[lol].realLife = npc.whoAmI; + Main.npc[lol].ai[2] = npc.whoAmI; + Main.npc[lol].ai[1] = Previous; + Main.npc[Previous].ai[0] = lol; + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, lol); + Previous = lol; + } + } + + calamityGlobalNPC.newAI[2] = 1f; + } + + // Big barf attack + if (calamityGlobalNPC.newAI[0] == 1f && (!doSpiral && phase2) || (getFuckedAI && !phase3)) + { + npc.localAI[0] += 1f; + if (npc.localAI[0] >= (revenge ? 360f : 420f)) + { + if (Vector2.Distance(player.Center, npc.Center) > 320f) + { + npc.localAI[0] = 0f; + npc.netUpdate = true; + SoundEngine.PlaySound(SoundID.NPCDeath13, npc.Center); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int totalProjectiles = bossRush ? 10 : expertMode ? 8 : 6; + if (phase3) + totalProjectiles *= 2; + + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + for (int i = 0; i < totalProjectiles; i++) + { + Vector2 velocity = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101)); + velocity = velocity.SafeNormalize(Vector2.UnitY); + velocity *= Main.rand.Next(phase3 ? 300 : 100, 401) * 0.01f; + + float maximumVelocityMult = death ? 0.75f : 0.5f; + if (expertMode) + velocity *= 1f + (maximumVelocityMult * (0.5f - lifeRatio)); + + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + velocity.SafeNormalize(Vector2.UnitY) * 5f, velocity, type, damage, 0f, Main.myPlayer); + } + } + } + } + } + } + + // Fire teeth depending on body type + else + { + if (calamityGlobalNPC.newAI[0] == 1f && (!phase3 || phase4)) + { + npc.localAI[0] += 1f; + float shootProjectile = 300; + float timer = npc.ai[0] + 15f; + float divisor = timer + shootProjectile; + + if (npc.type == ModContent.NPCType()) + { + if (npc.localAI[0] % divisor == 0f && (npc.ai[0] % 3f == 0f || getFuckedAI || !death)) + { + npc.TargetClosest(); + if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) + { + SoundEngine.PlaySound(SoundID.Item17, npc.Center); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + float toothVelocity = death ? 9f : 8f; + Vector2 projectileVelocity = (player.Center - npc.Center).SafeNormalize(Vector2.UnitY); + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + float accelerate = phase4 ? 1f : 0f; + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + projectileVelocity * 5f, projectileVelocity * toothVelocity, type, damage, 0f, Main.myPlayer, accelerate, 0f); + } + + npc.netUpdate = true; + } + } + } + } + } + + // Kill body and tail + if (!head) + { + bool shouldDespawn = true; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active && Main.npc[i].type == ModContent.NPCType()) + { + shouldDespawn = false; + break; + } + } + if (!shouldDespawn) + { + if (npc.ai[1] <= 0f) + shouldDespawn = true; + else if (Main.npc[(int)npc.ai[1]].life <= 0) + shouldDespawn = true; + } + if (shouldDespawn) + { + npc.life = 0; + npc.HitEffect(0, 10.0); + npc.checkDead(); + npc.active = false; + } + } + else + { + if (npc.life > Main.npc[(int)npc.ai[0]].life) + npc.life = Main.npc[(int)npc.ai[0]].life; + } + + float maxDistance = calamityGlobalNPC.newAI[0] == 1f ? 12800f : 6400f; + if (player.dead || Vector2.Distance(npc.Center, player.Center) > maxDistance || (nonHostile && biomeEnraged)) + { + calamityGlobalNPC.newAI[1] = 1f; + npc.TargetClosest(false); + npc.velocity.Y += 2f; + + if (npc.position.Y > Main.worldSurface * 16D) + npc.velocity.Y += 2f; + + if (npc.position.Y > Main.worldSurface * 16D) + { + for (int a = 0; a < Main.npc.Length; a++) + { + int type = Main.npc[a].type; + if (type == ModContent.NPCType() || type == ModContent.NPCType() || type == ModContent.NPCType() || type == ModContent.NPCType()) + Main.npc[a].active = false; + } + } + } + else + calamityGlobalNPC.newAI[1] = 0f; + + // Change direction + if (npc.velocity.X < 0f) + npc.spriteDirection = -1; + else if (npc.velocity.X > 0f) + npc.spriteDirection = 1; + + // Alpha changes + if (head || Main.npc[(int)npc.ai[1]].alpha < 128) + { + npc.alpha -= 42; + if (npc.alpha < 0) + npc.alpha = 0; + } + + Vector2 scourgePosition = npc.Center; + Vector2 predictionVector = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? Main.player[npc.target].velocity * 20f : Vector2.Zero; + float scourgeTargetX = player.Center.X + predictionVector.X; + float scourgeTargetY = player.Center.Y + predictionVector.Y; + + // Velocity and movement + float scourgeMaxSpeed = 5f; + float scourgeAcceleration = 0.08f; + if (calamityGlobalNPC.newAI[0] == 1f) + { + scourgeMaxSpeed = revenge ? 14.4f : 12f; + scourgeAcceleration = revenge ? 0.18f : 0.15f; + if (expertMode) + { + scourgeMaxSpeed += 2.4f * (1f - lifeRatio); + scourgeAcceleration += 0.03f * (1f - lifeRatio); + } + scourgeMaxSpeed += 3f * enrageScale; + scourgeAcceleration += 0.06f * enrageScale; + if (death || getFuckedAI) + { + scourgeMaxSpeed += 5f; + scourgeAcceleration -= getFuckedAI ? 0f : 0.03f; + scourgeMaxSpeed += Vector2.Distance(player.Center, npc.Center) * 0.001f; + scourgeAcceleration += Vector2.Distance(player.Center, npc.Center) * 0.000045f; + } + + // Increase acceleration after spiral attack + if (npc.localAI[3] > 0f) + { + float accelerationMultiplier = MathHelper.Lerp(1f, 2f, npc.localAI[3] / colorFadeTimeAfterSpiral); + scourgeAcceleration *= accelerationMultiplier; + } + + if (Main.getGoodWorld) + { + scourgeMaxSpeed *= 1.15f; + scourgeAcceleration *= 1.15f; + } + } + + if (head && !doSpiral) + { + if (calamityGlobalNPC.newAI[0] != 1f) + { + scourgeTargetY += 400; + if (Math.Abs(npc.Center.X - player.Center.X) < 500f) + { + if (npc.velocity.X > 0f) + scourgeTargetX = player.Center.X + 600f; + else + scourgeTargetX = player.Center.X - 600f; + } + } + + float scourgeHigherSpeed = scourgeMaxSpeed * 1.3f; + float scourgeLowerSpeed = scourgeMaxSpeed * 0.7f; + float scourgeSpeed = npc.velocity.Length(); + if (scourgeSpeed > 0f) + { + if (scourgeSpeed > scourgeHigherSpeed) + { + npc.velocity = npc.velocity.SafeNormalize(Vector2.UnitY); + npc.velocity *= scourgeHigherSpeed; + } + else if (scourgeSpeed < scourgeLowerSpeed) + { + npc.velocity = npc.velocity.SafeNormalize(Vector2.UnitY); + npc.velocity *= scourgeLowerSpeed; + } + } + } + + scourgeTargetX = (int)(scourgeTargetX / 16f) * 16; + scourgeTargetY = (int)(scourgeTargetY / 16f) * 16; + scourgePosition.X = (int)(scourgePosition.X / 16f) * 16; + scourgePosition.Y = (int)(scourgePosition.Y / 16f) * 16; + scourgeTargetX -= scourgePosition.X; + scourgeTargetY -= scourgePosition.Y; + float scourgeTargetDist = (float)Math.Sqrt(scourgeTargetX * scourgeTargetX + scourgeTargetY * scourgeTargetY); + + if (!head) + { + if (npc.ai[1] > 0f && npc.ai[1] < Main.npc.Length) + { + try + { + scourgePosition = npc.Center; + scourgeTargetX = Main.npc[(int)npc.ai[1]].Center.X - scourgePosition.X; + scourgeTargetY = Main.npc[(int)npc.ai[1]].Center.Y - scourgePosition.Y; + } + catch + { + } + + npc.rotation = (float)Math.Atan2(scourgeTargetY, scourgeTargetX) + MathHelper.PiOver2; + scourgeTargetDist = (float)Math.Sqrt(scourgeTargetX * scourgeTargetX + scourgeTargetY * scourgeTargetY); + int scourgeWidth = npc.width; + scourgeTargetDist = (scourgeTargetDist - scourgeWidth) / scourgeTargetDist; + scourgeTargetX *= scourgeTargetDist; + scourgeTargetY *= scourgeTargetDist; + npc.velocity = Vector2.Zero; + npc.position.X = npc.position.X + scourgeTargetX; + npc.position.Y = npc.position.Y + scourgeTargetY; + + if (scourgeTargetX < 0f) + npc.spriteDirection = -1; + else if (scourgeTargetX > 0f) + npc.spriteDirection = 1; + } + } + else if (!doSpiral) + { + float scourgeAbsoluteTargetX = Math.Abs(scourgeTargetX); + float scourgeAbsoluteTargetY = Math.Abs(scourgeTargetY); + float scourgeTimeToReachTarget = scourgeMaxSpeed / scourgeTargetDist; + scourgeTargetX *= scourgeTimeToReachTarget; + scourgeTargetY *= scourgeTimeToReachTarget; + + if ((npc.velocity.X > 0f && scourgeTargetX > 0f) || (npc.velocity.X < 0f && scourgeTargetX < 0f) || (npc.velocity.Y > 0f && scourgeTargetY > 0f) || (npc.velocity.Y < 0f && scourgeTargetY < 0f)) + { + if (npc.velocity.X < scourgeTargetX) + { + npc.velocity.X += scourgeAcceleration; + } + else + { + if (npc.velocity.X > scourgeTargetX) + npc.velocity.X -= scourgeAcceleration; + } + + if (npc.velocity.Y < scourgeTargetY) + { + npc.velocity.Y += scourgeAcceleration; + } + else + { + if (npc.velocity.Y > scourgeTargetY) + npc.velocity.Y -= scourgeAcceleration; + } + + if (Math.Abs(scourgeTargetY) < scourgeMaxSpeed * 0.2 && ((npc.velocity.X > 0f && scourgeTargetX < 0f) || (npc.velocity.X < 0f && scourgeTargetX > 0f))) + { + if (npc.velocity.Y > 0f) + npc.velocity.Y += scourgeAcceleration * 2f; + else + npc.velocity.Y -= scourgeAcceleration * 2f; + } + + if (Math.Abs(scourgeTargetX) < scourgeMaxSpeed * 0.2 && ((npc.velocity.Y > 0f && scourgeTargetY < 0f) || (npc.velocity.Y < 0f && scourgeTargetY > 0f))) + { + if (npc.velocity.X > 0f) + npc.velocity.X += scourgeAcceleration * 2f; + else + npc.velocity.X -= scourgeAcceleration * 2f; + } + } + else + { + if (scourgeAbsoluteTargetX > scourgeAbsoluteTargetY) + { + if (npc.velocity.X < scourgeTargetX) + npc.velocity.X += scourgeAcceleration * 1.1f; + else if (npc.velocity.X > scourgeTargetX) + npc.velocity.X -= scourgeAcceleration * 1.1f; + + if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < scourgeMaxSpeed * 0.5) + { + if (npc.velocity.Y > 0f) + npc.velocity.Y += scourgeAcceleration; + else + npc.velocity.Y -= scourgeAcceleration; + } + } + else + { + if (npc.velocity.Y < scourgeTargetY) + npc.velocity.Y += scourgeAcceleration * 1.1f; + else if (npc.velocity.Y > scourgeTargetY) + npc.velocity.Y -= scourgeAcceleration * 1.1f; + + if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < scourgeMaxSpeed * 0.5) + { + if (npc.velocity.X > 0f) + npc.velocity.X += scourgeAcceleration; + else + npc.velocity.X -= scourgeAcceleration; + } + } + } + + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) + MathHelper.PiOver2; + } + + // Calculate contact damage based on velocity + if (!nonHostile) + { + float minimalContactDamageVelocity = scourgeMaxSpeed * 0.25f; + float minimalDamageVelocity = scourgeMaxSpeed * 0.5f; + if (head) + { + if (npc.velocity.Length() <= minimalContactDamageVelocity) + { + npc.damage = (int)Math.Round(npc.defDamage * 0.5); + } + else + { + float velocityDamageScalar = MathHelper.Clamp((npc.velocity.Length() - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); + npc.damage = (int)MathHelper.Lerp((float)Math.Round(npc.defDamage * 0.5), npc.defDamage, velocityDamageScalar); + } + } + else + { + float bodyAndTailVelocity = (npc.position - npc.oldPosition).Length(); + if (bodyAndTailVelocity <= minimalContactDamageVelocity) + { + npc.damage = 0; + } + else + { + float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); + npc.damage = (int)MathHelper.Lerp(0f, npc.defDamage, velocityDamageScalar); + } + } + } + } + } +} diff --git a/NPCs/CalamityAIs/CalamityBossAIs/AstrumAureusAI.cs b/NPCs/CalamityAIs/CalamityBossAIs/AstrumAureusAI.cs new file mode 100644 index 0000000000..5a651886f6 --- /dev/null +++ b/NPCs/CalamityAIs/CalamityBossAIs/AstrumAureusAI.cs @@ -0,0 +1,958 @@ +using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.CalPlayer; +using CalamityMod.Dusts; +using CalamityMod.Events; +using CalamityMod.NPCs.Abyss; +using CalamityMod.NPCs.AquaticScourge; +using CalamityMod.NPCs.AstrumAureus; +using CalamityMod.NPCs.AstrumDeus; +using CalamityMod.NPCs.BrimstoneElemental; +using CalamityMod.NPCs.Bumblebirb; +using CalamityMod.NPCs.CalClone; +using CalamityMod.NPCs.CeaselessVoid; +using CalamityMod.NPCs.Crags; +using CalamityMod.NPCs.NormalNPCs; +using CalamityMod.NPCs.OldDuke; +using CalamityMod.NPCs.SulphurousSea; +using CalamityMod.NPCs.SunkenSea; +using CalamityMod.NPCs.VanillaNPCAIOverrides.RegularEnemies; +using CalamityMod.Projectiles.Boss; +using CalamityMod.Projectiles.Enemy; +using CalamityMod.Sounds; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs +{ + public static class AstrumAureusAI + { + public static void VanillaAstrumAureusAI(NPC npc, Mod mod) + { + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + + CalamityGlobalNPC.astrumAureus = npc.whoAmI; + + // Variables + bool bossRush = BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || bossRush; + bool revenge = CalamityWorld.revenge || bossRush; + bool death = CalamityWorld.death || bossRush; + + // Percent life remaining + float lifeRatio = npc.life / (float)npc.lifeMax; + + // Phases + bool phase2 = lifeRatio < (revenge ? 0.85f : expertMode ? 0.8f : 0.75f); + bool phase3 = lifeRatio < (revenge ? 0.7f : expertMode ? 0.6f : 0.5f); + bool phase4 = lifeRatio < (revenge ? 0.5f : 0.4f) && expertMode; + bool phase5 = lifeRatio < 0.3f && revenge; + + // Exhaustion + bool exhausted = npc.ai[2] >= (phase3 ? 2f : 1f); + 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(); + + // 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; + if ((Main.IsItDay() && !player.Calamity().ZoneAstral) || bossRush) + { + npc.Calamity().CurrentlyEnraged = !bossRush; + enrageScale += 1f; + } + + float astralFlameBarrageTimerIncrement = 1f; + if (expertMode) + astralFlameBarrageTimerIncrement += death ? (float)Math.Round(3f * (1f - lifeRatio)) : (float)Math.Round(2f * (1f - lifeRatio)); + + float walkingVelocity = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 6f : 5f; + walkingVelocity += 3f * enrageScale; + if (phase5) + walkingVelocity += 2f; + if (expertMode) + walkingVelocity += 1.5f * (1f - lifeRatio); + if (revenge) + walkingVelocity += Math.Abs(npc.Center.X - player.Center.X) * 0.0025f; + if (Main.getGoodWorld) + walkingVelocity *= 1.15f; + + float walkingProjectileVelocity = walkingVelocity * 0.8f; + + // Direction + npc.spriteDirection = (npc.direction > 0) ? 1 : -1; + + // Used to reduce Aureus' fall speed + bool reduceFallSpeed = npc.velocity.Y > 0f && Collision.SolidCollision(npc.position + Vector2.UnitY * 1.1f * npc.velocity.Y, npc.width, npc.height) && npc.ai[0] == 4f; + + // Despawn + bool despawnDistance = Vector2.Distance(player.Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance350Tiles; + if (!player.active || player.dead || despawnDistance) + { + npc.TargetClosest(false); + player = Main.player[npc.target]; + if (!player.active || player.dead || despawnDistance) + { + npc.noTileCollide = true; + + if (npc.velocity.Y < -3f) + npc.velocity.Y = -3f; + npc.velocity.Y += 0.1f; + if (npc.velocity.Y > 12f) + npc.velocity.Y = 12f; + + if (npc.timeLeft > 60) + npc.timeLeft = 60; + + if (npc.ai[0] != 0f) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.localAI[2] = 0f; + npc.localAI[3] = 0f; + calamityGlobalNPC.newAI[0] = 0f; + calamityGlobalNPC.newAI[1] = 0f; + npc.netUpdate = true; + } + return; + } + } + else if (npc.timeLeft < 1800) + npc.timeLeft = 1800; + + bool geldonPhase1 = lifeRatio > 0.6f && lifeRatio <= 0.7f; + bool geldonPhase2 = lifeRatio <= 0.1f; + if (Main.zenithWorld && (geldonPhase1 || geldonPhase2)) + { + AstrumAureus.AstrumAureus astrumAureus = npc.ModNPC(); + astrumAureus.slimeProjCounter++; + if (astrumAureus.slimeProjCounter % 180 == 0) + { + SoundEngine.PlaySound(SoundID.Item33, npc.Center); // Intentionally keeping the old laser sound in GFB + + if (astrumAureus.slimePhase == 1) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + int totalProjectiles = bossRush ? 14 : death ? 12 : revenge ? 10 : expertMode ? 8 : 6; + float radians = MathHelper.TwoPi / totalProjectiles; + float velocity = 10f; + Vector2 spinningPoint = new Vector2(0f, -velocity); + for (int k = 0; k < totalProjectiles; k++) + { + Vector2 velocity2 = spinningPoint.RotatedBy(radians * k); + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, velocity2, type, damage, 0f, Main.myPlayer, 0f, 1f); + } + } + astrumAureus.slimePhase = 0; + } + else + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + float aureusLaserSpeed = 7f; + float aureusLaserTargetX = player.Center.X - npc.Center.X; + float aureusLaserTargetY = player.Center.Y - npc.Center.Y; + float aureusLaserTargetDist = (float)Math.Sqrt(aureusLaserTargetX * aureusLaserTargetX + aureusLaserTargetY * aureusLaserTargetY); + aureusLaserTargetDist = aureusLaserSpeed / aureusLaserTargetDist; + aureusLaserTargetX *= aureusLaserTargetDist; + aureusLaserTargetY *= aureusLaserTargetDist; + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X, npc.Center.Y, aureusLaserTargetX, aureusLaserTargetY, type, damage, 0f, Main.myPlayer); + for (int i = 0; i < 4; i++) + { + Vector2 offset = new Vector2(Main.rand.Next(-6, 7), Main.rand.Next(-6, 7)); + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X, npc.Center.Y, aureusLaserTargetX + offset.X, aureusLaserTargetY + offset.Y, type, damage, 0f, Main.myPlayer); + } + } + astrumAureus.slimePhase = 1; + } + } + RevengeanceAndDeathAI.BuffedMimicAI(npc, mod); + npc.noGravity = false; + npc.noTileCollide = false; + return; + } + else + { + npc.noGravity = true; + } + + // Emit light when not Idle + if (npc.ai[0] != 1f) + Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 1.3f, 0.5f, 0f); + + // Fire projectiles while walking, teleporting, or falling + if (npc.ai[0] == 2f || npc.ai[0] >= 5f) + { + if (!dontAttack) + npc.localAI[0] += npc.ai[0] == 2f ? 1f : astralFlameBarrageTimerIncrement; + + float astralFlameBarrageGateValue = phase4 ? 30f : 60f; + if (npc.localAI[0] >= astralFlameBarrageGateValue) + { + // Fire astral flames while teleporting + if (npc.ai[0] >= 5f && npc.ai[0] != 7) + { + npc.localAI[0] = 0f; + SoundEngine.PlaySound(AstrumAureus.AstrumAureus.FlameCrystalSound, npc.Center); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + float velocity = death ? (8f + npc.localAI[2] * 0.025f) : 7f; + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + float spreadLimit = (phase4 ? 100f : 50f) + enrageScale * 50f; + float randomSpread = (Main.rand.NextFloat() - 0.5f) * spreadLimit; + Vector2 spawnVector = new Vector2(npc.Center.X, npc.Center.Y - 80f * npc.scale); + Vector2 destination = new Vector2(spawnVector.X + randomSpread, spawnVector.Y - 100f * npc.scale); + Projectile.NewProjectile(npc.GetSource_FromAI(), spawnVector, Vector2.Normalize(destination - spawnVector) * velocity, type, damage, 0f, Main.myPlayer); + } + } + } + + float laserBarrageGateValue = phase5 ? 160f : phase3 ? 120f : phase2 ? 80f : 60f; + if (npc.localAI[0] >= laserBarrageGateValue) + { + // Fire astral lasers while walking + if (npc.ai[0] == 2f) + { + npc.localAI[0] = 0f; + + SoundEngine.PlaySound(AstrumAureus.AstrumAureus.LaserSound, npc.Center); + + if (calamityGlobalNPC.newAI[2] == 0f) + { + calamityGlobalNPC.newAI[2] = 1f; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int maxProjectiles = !phase2 ? (bossRush ? 5 : 3) : (bossRush ? 7 : 5); + int spread = !phase2 ? (bossRush ? 11 : 8) : (bossRush ? 12 : 10); + + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + Vector2 projectileVelocity = Vector2.Normalize(player.Center - npc.Center) * walkingProjectileVelocity; + float rotation = MathHelper.ToRadians(spread); + for (int i = 0; i < maxProjectiles; i++) + { + Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(maxProjectiles - 1))); + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, perturbedSpeed, type, damage, 0f, Main.myPlayer, 0f, walkingProjectileVelocity * 2f); + } + + if (phase3) + { + float flameVelocity = walkingProjectileVelocity; + maxProjectiles = 2; + spread = 45; + + type = ModContent.ProjectileType(); + damage = npc.GetProjectileDamage(type); + projectileVelocity = Vector2.Normalize(player.Center - npc.Center) * flameVelocity; + rotation = MathHelper.ToRadians(spread); + for (int i = 0; i < maxProjectiles; i++) + { + Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(maxProjectiles - 1))); + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, perturbedSpeed, type, damage, 0f, Main.myPlayer); + } + } + } + } + else + { + calamityGlobalNPC.newAI[2] = 0f; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int maxProjectiles = !phase3 ? (bossRush ? 13 : death ? 11 : 9) : (bossRush ? 19 : death ? 17 : 15); + int spread = !phase3 ? (bossRush ? 20 : death ? 18 : 16) : (bossRush ? 24 : death ? 22 : 20); + + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + int centralLaser = maxProjectiles / 2; + int[] lasersToNotFire = new int[6] { centralLaser - 3, centralLaser - 2, centralLaser - 1, centralLaser + 1, centralLaser + 2, centralLaser + 3 }; + Vector2 projectileVelocity = Vector2.Normalize(player.Center - npc.Center) * walkingProjectileVelocity; + float rotation = MathHelper.ToRadians(spread); + for (int i = 0; i < maxProjectiles; i++) + { + if (i != lasersToNotFire[0] && i != lasersToNotFire[1] && i != lasersToNotFire[2] && i != lasersToNotFire[3] && i != lasersToNotFire[4] && i != lasersToNotFire[5]) + { + Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(maxProjectiles - 1))); + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, perturbedSpeed, type, damage, 0f, Main.myPlayer, 0f, walkingProjectileVelocity * 2f); + } + } + } + } + } + } + } + else + npc.localAI[0] = 0f; + + // Start up + if (npc.ai[0] == 0f) + { + // Avoid cheap bullshit + npc.damage = 0; + + npc.ai[0] = 1f; + npc.netUpdate = true; + CustomGravity(); + } + + // Idle + else if (npc.ai[0] == 1f) + { + // Avoid cheap bullshit + npc.damage = 0; + + // Slow down + npc.velocity.X *= 0.8f; + + // Stay vulnerable for 3 seconds + npc.ai[1] += 1f; + if (npc.ai[1] >= 180f || bossRush) + { + // Set AI to random state and reset other AI arrays + npc.TargetClosest(); + switch (Main.rand.Next(phase3 ? 3 : 2)) + { + case 0: + npc.ai[0] = 2f; + break; + + case 1: + npc.ai[0] = 3f; + break; + + case 2: + npc.ai[0] = 5f; + break; + + default: + break; + } + npc.ai[1] = 0f; + npc.ai[2] = 0f; + + // Stop colliding with tiles if entering walking phase + npc.noTileCollide = npc.ai[0] == 2f; + + npc.netUpdate = true; + } + else + CustomGravity(); + } + + // Walk + else if (npc.ai[0] == 2f) + { + // Avoid cheap bullshit + npc.damage = 0; + + // Set walking direction + if (Math.Abs(npc.Center.X - player.Center.X) < 200f * npc.scale) + { + npc.velocity.X *= 0.8f; + if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) + npc.velocity.X = 0f; + } + else + { + float playerLocation = npc.Center.X - player.Center.X; + npc.direction = playerLocation < 0 ? 1 : -1; + + if (npc.direction > 0) + npc.velocity.X = (npc.velocity.X * 20f + walkingVelocity) / 21f; + if (npc.direction < 0) + npc.velocity.X = (npc.velocity.X * 20f - walkingVelocity) / 21f; + } + + if (Collision.CanHit(npc.position, npc.width, npc.height, player.Center, 1, 1) && !Collision.SolidCollision(npc.position, npc.width, npc.height) && player.position.Y <= npc.position.Y + npc.height && !npc.collideX) + { + CustomGravity(); + npc.noTileCollide = false; + } + else + { + npc.noTileCollide = true; + + // Walk through tiles if colliding with tiles and player is out of reach + int aureusHitboxWidth = 80; + int aureusHitboxHeight = 20; + Vector2 aureusHitboxTileCollideSize = new Vector2(npc.Center.X - (aureusHitboxWidth / 2), npc.position.Y + npc.height - aureusHitboxHeight); + + bool nearPlayerWalkingThroughTiles = false; + if (npc.position.X < player.position.X && npc.position.X + npc.width > player.position.X + player.width && npc.position.Y + npc.height < player.position.Y + player.height - 16f) + nearPlayerWalkingThroughTiles = true; + + if (nearPlayerWalkingThroughTiles) + { + npc.velocity.Y += 0.5f; + } + else if (Collision.SolidCollision(aureusHitboxTileCollideSize, aureusHitboxWidth, aureusHitboxHeight)) + { + if (npc.velocity.Y > 0f) + npc.velocity.Y = 0f; + + if (npc.velocity.Y > -0.2) + npc.velocity.Y -= 0.025f; + else + npc.velocity.Y -= 0.2f; + + if (npc.velocity.Y < -4f) + npc.velocity.Y = -4f; + } + else + { + if (npc.velocity.Y < 0f) + npc.velocity.Y = 0f; + + if (npc.velocity.Y < 0.1) + npc.velocity.Y += 0.025f; + else + npc.velocity.Y += 0.5f; + } + } + + // Walk for a maximum of 6 seconds + if (!dontAttack) + npc.ai[1] += 1f; + + if (npc.ai[1] >= ((bossRush ? 270f : 360f) - (death ? 90f * (1f - lifeRatio) : 0f))) + { + // Collide with tiles again + npc.noTileCollide = false; + + // Set AI to next phase (Jump) and reset other AI + npc.TargetClosest(); + npc.ai[0] = exhausted ? 1f : 3f; + npc.ai[1] = 0f; + npc.ai[2] += 1f; + npc.netUpdate = true; + } + + // Limit downward velocity + if (npc.velocity.Y > 10f) + npc.velocity.Y = 10f; + } + + // Jump + else if (npc.ai[0] == 3f) + { + // Avoid cheap bullshit + npc.damage = 0; + + npc.noTileCollide = false; + + if (npc.velocity.Y == 0f) + { + // Slow down + npc.velocity.X *= 0.8f; + + // Half second delay before jumping + if (!dontAttack) + npc.ai[1] += 1f; + + if (npc.ai[1] >= 30f) + { + npc.ai[1] = -20f; + } + else if (npc.ai[1] == -1f) + { + // Set damage + npc.damage = npc.defDamage; + + // Set jump velocity, reset and set AI to next phase (Stomp) + float distanceFromPlayerOnXAxis = npc.Center.X - player.Center.X; + npc.direction = distanceFromPlayerOnXAxis < 0 ? 1 : -1; + calamityGlobalNPC.newAI[3] = npc.direction; + + // The limit for how much Aureus can multiply its jump velocity + float speedMultLimit = 1f; + + // Maxes out when the player is a full 2000 pixels away from or above Aureus + float multiplier = 1f / 2000f; + + // Increase Aureus jump velocity X if it's far enough away from the player + float distanceAwayFromTarget = Math.Abs(distanceFromPlayerOnXAxis); + float distanceGateValue = 400f; + bool increaseJumpVelocityX = distanceAwayFromTarget > distanceGateValue && expertMode; + if (increaseJumpVelocityX) + { + calamityGlobalNPC.newAI[0] = (distanceAwayFromTarget - distanceGateValue) * multiplier; + if (calamityGlobalNPC.newAI[0] > speedMultLimit) + calamityGlobalNPC.newAI[0] = speedMultLimit; + } + + // Increase Aureus jump velocity Y if it's far enough above the player + float distanceBelowTarget = npc.position.Y - (player.position.Y + 80f); + bool increaseJumpVelocityY = distanceBelowTarget > 0f && revenge; + if (increaseJumpVelocityY) + { + calamityGlobalNPC.newAI[1] = distanceBelowTarget * multiplier; + if (calamityGlobalNPC.newAI[1] > speedMultLimit) + calamityGlobalNPC.newAI[1] = speedMultLimit; + } + + float velocity = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 27f : 20f; + velocity += 6f * enrageScale; + if (expertMode) + velocity += death ? 6f * (1f - lifeRatio) : 4f * (1f - lifeRatio); + if (Main.getGoodWorld) + velocity *= 1.15f; + + npc.velocity = (new Vector2(player.Center.X, player.Center.Y - 500f) - npc.Center).SafeNormalize(Vector2.Zero) * velocity; + npc.velocity *= new Vector2(calamityGlobalNPC.newAI[0] + 1f, calamityGlobalNPC.newAI[1] + 1f); + + npc.noTileCollide = true; + + npc.ai[0] = 4f; + npc.ai[1] = 0f; + + SoundEngine.PlaySound(AstrumAureus.AstrumAureus.JumpSound, npc.Center); + + npc.netUpdate = true; + } + } + + // Don't run custom gravity when starting a jump + if (npc.ai[0] != 4f) + CustomGravity(); + } + + // Stomp + else if (npc.ai[0] == 4f) + { + if (npc.velocity.Y == 0f) + { + // Avoid cheap bullshit + npc.damage = 0; + + // Play stomp sound. Gotta specify the filepath to avoid confusion between the namespace and npc + SoundStyle soundToPlay = Main.zenithWorld ? NPCs.ExoMechs.Ares.AresGaussNuke.NukeExplosionSound : NPCs.AstrumAureus.AstrumAureus.StompSound; + SoundEngine.PlaySound(soundToPlay, npc.Center); + + if (Main.zenithWorld) + { + float screenShakePower = 16 * Utils.GetLerpValue(1300f, 0f, npc.Distance(Main.LocalPlayer.Center), true); + if (Main.LocalPlayer.Calamity().GeneralScreenShakePower < screenShakePower) + Main.LocalPlayer.Calamity().GeneralScreenShakePower = screenShakePower; + } + + // Stomp and jump again, if stomped twice then reset and set AI to next phase (Teleport or Idle) + npc.TargetClosest(); + npc.localAI[1] += 1f; + float maxStompAmt = phase5 ? 5f : phase3 ? 2f : 3f; + if (npc.localAI[1] >= maxStompAmt) + { + npc.ai[0] = exhausted ? 1f : (phase3 ? 5f : 2f); + npc.localAI[1] = 0f; + npc.ai[2] += 1f; + npc.ai[3] = 0f; + npc.noTileCollide = false; + npc.netUpdate = true; + } + else + { + float playerLocation = npc.Center.X - player.Center.X; + npc.direction = playerLocation < 0 ? 1 : -1; + npc.ai[0] = 3f; + npc.ai[3] = 0f; + npc.netUpdate = true; + } + + calamityGlobalNPC.newAI[0] = 0f; + calamityGlobalNPC.newAI[1] = 0f; + calamityGlobalNPC.newAI[3] = 0f; + + // Spawn dust for visual effect + for (int i = (int)npc.position.X - 20; i < (int)npc.position.X + npc.width + 40; i += 20) + { + for (int j = 0; j < 4; j++) + { + int stompDust = Dust.NewDust(new Vector2(npc.position.X - 20f, npc.position.Y + npc.height), npc.width + 20, 4, ModContent.DustType(), 0f, 0f, 100, default, 1.5f); + Main.dust[stompDust].velocity *= 0.2f; + } + } + + // Fire lasers or flames on stomp + SoundEngine.PlaySound(AstrumAureus.AstrumAureus.LaserSound, npc.Center); + + if (Main.zenithWorld) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int type = Main.rand.NextBool() ? ModContent.ProjectileType() : ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + int totalProjectiles = bossRush ? 14 : death ? 12 : revenge ? 10 : expertMode ? 8 : 6; + float radians = MathHelper.TwoPi / totalProjectiles; + float velocity = 10f; + Vector2 spinningPoint = new Vector2(0f, -velocity); + for (int k = 0; k < totalProjectiles; k++) + { + Vector2 velocity2 = spinningPoint.RotatedBy(radians * k); + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, velocity2, type, damage, 0f, Main.myPlayer, 0f, 1f); + } + } + } + else if (calamityGlobalNPC.newAI[2] == 0f && phase2) + { + calamityGlobalNPC.newAI[2] = 1f; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + float flameVelocity = 6f; + int maxProjectiles = bossRush ? 4 : death ? 3 : 2; + int spread = bossRush ? 36 : death ? 28 : 20; + + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + Vector2 spawnVector = new Vector2(npc.Center.X, npc.Center.Y - 80f * npc.scale); + Vector2 destination = new Vector2(spawnVector.X, spawnVector.Y + 100f * npc.scale); + Vector2 projectileVelocity = Vector2.Normalize(destination - spawnVector) * flameVelocity; + float rotation = MathHelper.ToRadians(spread); + for (int i = 0; i < maxProjectiles; i++) + { + Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(maxProjectiles - 1))); + Projectile.NewProjectile(npc.GetSource_FromAI(), spawnVector + Vector2.Normalize(perturbedSpeed) * 100f, perturbedSpeed, type, damage, 0f, Main.myPlayer); + } + } + } + else + { + calamityGlobalNPC.newAI[2] = 0f; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + float laserVelocity = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 7f : death ? 6f : 5f; + int maxProjectiles = !phase3 ? (bossRush ? 13 : death ? 11 : 9) : (bossRush ? 17 : death ? 15 : 13); + int spread = !phase3 ? (bossRush ? 20 : death ? 18 : 16) : (bossRush ? 24 : death ? 22 : 20); + + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + int[] lasersToNotFire = new int[4] { 1, 3, maxProjectiles - 2, maxProjectiles - 4 }; + Vector2 projectileVelocity = Vector2.Normalize(player.Center - npc.Center) * laserVelocity; + float rotation = MathHelper.ToRadians(spread); + for (int i = 0; i < maxProjectiles; i++) + { + if (i != lasersToNotFire[0] && i != lasersToNotFire[1] && i != lasersToNotFire[2] && i != lasersToNotFire[3]) + { + Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(maxProjectiles - 1))); + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, perturbedSpeed, type, damage, 0f, Main.myPlayer, 0f, laserVelocity * 2f); + } + } + } + } + } + else + { + // Set damage + npc.damage = npc.defDamage; + + // Set velocities while falling, this happens before the stomp + // Fall through + if (!player.dead) + { + if ((player.position.Y > npc.Bottom.Y && npc.velocity.Y > 0f) || (player.position.Y < npc.Bottom.Y && npc.velocity.Y < 0f)) + npc.noTileCollide = true; + else if ((npc.velocity.Y > 0f && npc.Bottom.Y > Main.player[npc.target].Top.Y) || (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].Center, 1, 1) && !Collision.SolidCollision(npc.position, npc.width, npc.height))) + npc.noTileCollide = false; + } + + if (npc.position.X < player.position.X && npc.position.X + npc.width > player.position.X + player.width) + { + // Make sure Aureus falls quickly when directly on top of or below the player + if (npc.ai[3] < 30f) + npc.ai[3] = 30f; + + npc.velocity.X *= 0.8f; + + if (npc.Bottom.Y < player.position.Y) + { + // Make sure Aureus falls rather quickly + if (npc.velocity.Y < -3f) + npc.velocity.Y = -3f; + + float fallSpeed = 1.2f; + fallSpeed += 0.36f * enrageScale; + if (expertMode) + fallSpeed += death ? 0.36f * (1f - lifeRatio) : 0.24f * (1f - lifeRatio); + if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + fallSpeed += 0.5f; + + if (calamityGlobalNPC.newAI[1] > 0f) + fallSpeed *= calamityGlobalNPC.newAI[1] + 1f; + + npc.velocity.Y += fallSpeed; + } + } + else + { + // Push Aureus towards the player on the X axis if he's not directly on top of or below the player + float velocityXChange = 0.2f + Math.Abs(npc.Center.X - player.Center.X) * 0.0001f; + velocityXChange += 0.1f * enrageScale; + + if (calamityGlobalNPC.newAI[0] > 0f) + velocityXChange *= calamityGlobalNPC.newAI[0] + 1f; + + if (npc.direction < 0) + npc.velocity.X -= velocityXChange; + else if (npc.direction > 0) + npc.velocity.X += velocityXChange; + + float velocityXCap = 12f; + velocityXCap += 3.6f * enrageScale; + if (expertMode) + velocityXCap += death ? 3.6f * (1f - lifeRatio) : 2.4f * (1f - lifeRatio); + if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + velocityXCap += 5f; + + if (calamityGlobalNPC.newAI[0] > 0f) + velocityXCap *= calamityGlobalNPC.newAI[0] + 1f; + + float playerLocation = npc.Center.X - player.Center.X; + int directionRelativeToTarget = playerLocation < 0 ? 1 : -1; + bool slowDown = directionRelativeToTarget != calamityGlobalNPC.newAI[3]; + + if (slowDown) + velocityXCap *= 0.333f; + + if (npc.velocity.X < -velocityXCap) + npc.velocity.X = -velocityXCap; + if (npc.velocity.X > velocityXCap) + npc.velocity.X = velocityXCap; + } + + // Don't start falling quickly until half a second has passed + npc.ai[3] += 1f; + if (npc.ai[3] > 30f) + CustomGravity(); + } + } + + // Teleport + else if (npc.ai[0] == 5f) + { + // Avoid cheap bullshit + npc.damage = 0; + + // Slow down + npc.velocity.X *= 0.8f; + + // Start teleport + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.localAI[1] += 1f; + if (death) + npc.localAI[2] += 1.25f; + + if (phase4) + { + npc.localAI[1] += 1f; + if (death) + npc.localAI[2] += 1.25f; + } + + if (npc.localAI[1] >= (bossRush ? 60f : death ? 180f : 240f)) + { + // Reset localAI and find a teleport destination + npc.TargetClosest(); + npc.localAI[1] = 0f; + + Vector2 vectorAimedAheadOfTarget = Main.player[npc.target].Center + new Vector2((float)Math.Round(Main.player[npc.target].velocity.X), 0f).SafeNormalize(Vector2.Zero) * 1000f; + Point point4 = vectorAimedAheadOfTarget.ToTileCoordinates(); + int teleportTries = 0; + while (teleportTries < 100) + { + teleportTries++; + int teleportTileX = Main.rand.Next(point4.X - 5, point4.X + 6); + int teleportTileY = Main.rand.Next(point4.Y - 5, point4.Y); + + if (!Main.tile[teleportTileX, teleportTileY].HasUnactuatedTile) + { + npc.ai[1] = teleportTileX * 16 + 8; + npc.ai[3] = teleportTileY * 16 + 16; + break; + } + } + + // Default teleport if the above conditions aren't met in 100 iterations + if (teleportTries >= 100) + { + Vector2 bottom = Main.player[Player.FindClosest(npc.position, npc.width, npc.height)].Bottom; + npc.ai[1] = bottom.X; + npc.ai[3] = bottom.Y; + } + + // Set AI to next phase (Mid-teleport) + npc.ai[0] = 6f; + npc.netUpdate = true; + } + } + + CustomGravity(); + } + + // Mid-teleport + else if (npc.ai[0] == 6f) + { + // Avoid cheap bullshit + npc.damage = 0; + + if (death) + npc.localAI[2] += 1.25f; + + if (phase4) + { + if (death) + npc.localAI[2] += 1.25f; + } + + // Turn invisible + npc.alpha += 10; + if (npc.alpha >= 255) + { + // Set position to teleport destination + npc.Bottom = new Vector2(npc.ai[1], npc.ai[3]); + + // Reset alpha and set AI to next phase (End of teleport) + npc.alpha = 255; + npc.ai[0] = 7f; + npc.localAI[2] = 0f; + npc.netUpdate = true; + } + + // Play sound for cool effect + if (npc.soundDelay == 0) + { + npc.soundDelay = 15; + SoundEngine.PlaySound(AstrumAureus.AstrumAureus.TeleportSound, npc.Center); + } + + // Emit dust to make the teleport pretty + for (int i = 0; i < 10; i++) + { + int teleportDust = Dust.NewDust(npc.position, npc.width, npc.height, ModContent.DustType(), npc.velocity.X, npc.velocity.Y, 255, default, 2f); + Main.dust[teleportDust].noGravity = true; + Main.dust[teleportDust].velocity *= 0.5f; + } + + CustomGravity(); + } + + // End of teleport + else if (npc.ai[0] == 7f) + { + // Avoid cheap bullshit + npc.damage = 0; + + // Turn visible + npc.alpha -= 10; + if (npc.alpha <= 0) + { + // Spawn Aureus Spawns + bool spawnFlag = expertMode; + if (NPC.CountNPCS(ModContent.NPCType()) >= 2) + spawnFlag = false; + + if (spawnFlag && Main.netMode != NetmodeID.MultiplayerClient) + { + int aureusSpawn = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)(npc.Center.Y - 25f * npc.scale), ModContent.NPCType()); + Main.npc[aureusSpawn].velocity.Y = -10f; + Main.npc[aureusSpawn].netUpdate = true; + if (revenge) + { + aureusSpawn = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)(npc.Center.Y - 25f * npc.scale), ModContent.NPCType()); + Main.npc[aureusSpawn].velocity.Y = -15f; + Main.npc[aureusSpawn].netUpdate = true; + } + + if (death) + { + int damageAmt = npc.lifeMax / 50; + npc.life -= damageAmt; + if (npc.life < 1) + npc.life = 1; + + npc.HealEffect(-damageAmt, true); + } + } + + // Reset alpha and set AI to next phase (Idle) + npc.alpha = 0; + npc.ai[0] = exhausted ? 1f : 2f; + npc.ai[1] = 0f; + npc.ai[2] += 1f; + npc.localAI[3] = noProjectileOrPhaseIncrementTime; + + // Stop colliding with tiles if entering walking phase + npc.noTileCollide = npc.ai[0] == 2f; + + npc.netUpdate = true; + } + + // Play sound at teleport destination for cool effect + if (npc.soundDelay == 0) + { + npc.soundDelay = 15; + SoundEngine.PlaySound(SoundID.Item109, npc.Center); + } + + // Emit dust to make the teleport pretty + for (int i = 0; i < 10; i++) + { + int teleportDust = Dust.NewDust(npc.position, npc.width, npc.height, ModContent.DustType(), npc.velocity.X, npc.velocity.Y, 255, default, 2f); + Main.dust[teleportDust].noGravity = true; + Main.dust[teleportDust].velocity *= 0.5f; + } + + CustomGravity(); + } + + void CustomGravity() + { + float gravity = 0.36f + 0.12f * enrageScale; + float maxFallSpeed = reduceFallSpeed ? 12f : 12f + 4f * enrageScale; + + if (calamityGlobalNPC.newAI[1] > 0f && !reduceFallSpeed) + maxFallSpeed *= calamityGlobalNPC.newAI[1] + 1f; + + if (Main.getGoodWorld && !reduceFallSpeed) + { + gravity *= 1.15f; + maxFallSpeed *= 1.15f; + } + + npc.velocity.Y += gravity; + if (npc.velocity.Y > maxFallSpeed) + npc.velocity.Y = maxFallSpeed; + } + } + } +} diff --git a/NPCs/CalamityAIs/CalamityBossAIs/AstrumDeusAI.cs b/NPCs/CalamityAIs/CalamityBossAIs/AstrumDeusAI.cs new file mode 100644 index 0000000000..a5eab311c9 --- /dev/null +++ b/NPCs/CalamityAIs/CalamityBossAIs/AstrumDeusAI.cs @@ -0,0 +1,947 @@ +using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.CalPlayer; +using CalamityMod.Dusts; +using CalamityMod.Events; +using CalamityMod.NPCs.Abyss; +using CalamityMod.NPCs.AquaticScourge; +using CalamityMod.NPCs.AstrumAureus; +using CalamityMod.NPCs.AstrumDeus; +using CalamityMod.NPCs.BrimstoneElemental; +using CalamityMod.NPCs.Bumblebirb; +using CalamityMod.NPCs.CalClone; +using CalamityMod.NPCs.CeaselessVoid; +using CalamityMod.NPCs.Crags; +using CalamityMod.NPCs.NormalNPCs; +using CalamityMod.NPCs.OldDuke; +using CalamityMod.NPCs.SulphurousSea; +using CalamityMod.NPCs.SunkenSea; +using CalamityMod.Projectiles.Boss; +using CalamityMod.Projectiles.Enemy; +using CalamityMod.Sounds; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs +{ + public static class AstrumDeusAI + { + public static void VanillaAstrumDeusAI(NPC npc, Mod mod, bool head) + { + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + + // Difficulty variables + bool bossRush = BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || bossRush; + bool revenge = CalamityWorld.revenge || bossRush; + bool death = CalamityWorld.death || bossRush; + + float enrageScale = bossRush ? 0.5f : 0f; + if (Main.IsItDay() || bossRush) + { + npc.Calamity().CurrentlyEnraged = !bossRush; + enrageScale += 1.5f; + } + + // Deus cannot hit for 3 seconds or while invulnerable + bool doNotDealDamage = calamityGlobalNPC.newAI[1] < 180f || npc.dontTakeDamage; + if (doNotDealDamage) + npc.damage = 0; + + // 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]; + + bool increaseSpeed = Vector2.Distance(player.Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles; + bool increaseSpeedMore = Vector2.Distance(player.Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance350Tiles; + + // Despawn safety, make sure to target another player if the current player target is too far away + if (increaseSpeedMore && head) + npc.TargetClosest(); + + // Inflict Extreme Gravity to nearby players + if (revenge) + { + if (Main.netMode != NetmodeID.Server) + { + if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active && Vector2.Distance(Main.player[Main.myPlayer].Center, npc.Center) < CalamityGlobalNPC.CatchUpDistance350Tiles) + Main.player[Main.myPlayer].AddBuff(ModContent.BuffType(), 2); + } + } + + // Life + float lifeRatio = npc.life / (float)npc.lifeMax; + + // Phases based on life percentage + bool halfHealth = lifeRatio < 0.5f; + bool doubleWormPhase = calamityGlobalNPC.newAI[0] != 0f; + bool startFlightPhase = lifeRatio < 0.8f || death || doubleWormPhase; + bool phase2 = lifeRatio < 0.5f && doubleWormPhase && expertMode; + bool phase3 = lifeRatio < 0.2f && doubleWormPhase && expertMode; + bool splittingMines = lifeRatio < 0.7f; + bool movingMines = lifeRatio < 0.3f && doubleWormPhase && expertMode; + bool deathModeEnragePhase_Head = calamityGlobalNPC.newAI[0] == 3f; + bool deathModeEnragePhase_BodyAndTail = false; + + // 5 seconds of resistance in phase 2, 10 seconds in phase 1, to prevent spawn killing + float resistanceTime = doubleWormPhase ? 300f : 600f; + if (calamityGlobalNPC.newAI[1] < resistanceTime) + calamityGlobalNPC.newAI[1] += 1f; + + calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = calamityGlobalNPC.newAI[1] < resistanceTime; + + // Flight timer + float aiSwitchTimer = doubleWormPhase ? (Main.getGoodWorld ? 600f : 1200f) : (Main.getGoodWorld ? 900f : 1800f); + + calamityGlobalNPC.newAI[3] += 1f; + if (calamityGlobalNPC.newAI[3] >= aiSwitchTimer) + calamityGlobalNPC.newAI[3] = 0f; + + // Phase for flying at the player + bool flyAtTarget = calamityGlobalNPC.newAI[3] >= (aiSwitchTimer * 0.5f) && startFlightPhase; + + // Length of worms + int phase1Length = death ? 80 : revenge ? 70 : expertMode ? 60 : 50; + int phase2Length = death ? 40 : revenge ? 35 : expertMode ? 30 : 25; + int gfbLength = death ? 8 : revenge ? 7 : expertMode ? 6 : 5; + int maxLength = Main.zenithWorld && doubleWormPhase ? gfbLength : doubleWormPhase ? phase2Length : phase1Length; + + // Become gradually more pissed as more worms are killed + int gfbMaxWormCount = 10; + int gfbWormCount = 0; + if (CalamityWorld.LegendaryMode && revenge) + gfbWormCount = NPC.CountNPCS(ModContent.NPCType()); + if (gfbWormCount > gfbMaxWormCount) + gfbWormCount = gfbMaxWormCount; + if (gfbWormCount > 0) + enrageScale += (gfbMaxWormCount - gfbWormCount) * 0.111f; + + // Split into two worms + if (head) + { + float splitAnimationTime = 180f; + bool oneWormAlive = NPC.CountNPCS(ModContent.NPCType()) < 2; + bool deathModeFinalWormEnrage = death && doubleWormPhase && oneWormAlive && calamityGlobalNPC.newAI[1] >= resistanceTime; + if (deathModeFinalWormEnrage) + { + if (calamityGlobalNPC.newAI[0] != 3f) + { + SoundEngine.PlaySound(AstrumDeusHead.SplitSound, player.Center); + calamityGlobalNPC.newAI[0] = 3f; + npc.defense = 12; + calamityGlobalNPC.DR = 0.075f; + + // Despawns the other deus worm segments + int bodyID = ModContent.NPCType(); + int tailID = ModContent.NPCType(); + for (int i = 0; i < Main.maxNPCs; i++) + { + NPC wormseg = Main.npc[i]; + if (!wormseg.active) + continue; + + if ((wormseg.type == bodyID || wormseg.type == tailID) && Main.npc[(int)wormseg.ai[2]].Calamity().newAI[0] != 3f) + { + wormseg.life = 0; + wormseg.active = false; + } + } + } + + calamityGlobalNPC.newAI[2] += 10f; + if (calamityGlobalNPC.newAI[2] > 162f) + calamityGlobalNPC.newAI[2] = 162f; + + npc.Opacity = MathHelper.Clamp(1f - (calamityGlobalNPC.newAI[2] / splitAnimationTime), 0f, 1f); + } + + bool despawnRemainingWorm = doubleWormPhase && oneWormAlive && !death; + if ((halfHealth && calamityGlobalNPC.newAI[0] == 0f) || despawnRemainingWorm) + { + npc.dontTakeDamage = true; + + calamityGlobalNPC.newAI[2] += despawnRemainingWorm ? 10f : 1f; + npc.Opacity = MathHelper.Clamp(1f - (calamityGlobalNPC.newAI[2] / splitAnimationTime), 0f, 1f); + + bool despawning = calamityGlobalNPC.newAI[2] == splitAnimationTime; + + // + // CODE TWEAKED BY: OZZATRON + // September 20th, 2020 + // reason: fixing Astrum Deus death mode NPC cap bug + // + + // Despawn the unsplit Astrum Deus and spawn two half-size Astrum Deus worms. + if (despawning) + { + // If this is already a split worm (newAI[0] != 0f) then don't do anything. At all. + if (doubleWormPhase) + return; + + // Mark all existing body and tail segments as inactive. This instantly frees up their NPC slots for the freshly spawned worms. + int bodyID = ModContent.NPCType(); + int tailID = ModContent.NPCType(); + for (int i = 0; i < Main.maxNPCs; i++) + { + NPC wormseg = Main.npc[i]; + if (!wormseg.active) + continue; + if (wormseg.type == bodyID || wormseg.type == tailID) + { + wormseg.life = 0; + wormseg.active = false; + } + } + + // The unsplit Astrum Deus worm head will die next frame. + npc.life = 0; + + // Do not spawn worms client side. The server handles this. + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int wormamt = Main.zenithWorld ? 5 : 1; + for (int i = 0; i < wormamt; i++) + { + // Now that the original worm doesn't exist, startCount can be zero. + // int startCount = npc.whoAmI + phase1Length + 1; + int startIndexHeadOne = 1; + int headOneID = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, npc.type, startIndexHeadOne); + Main.npc[headOneID].Calamity().newAI[0] = 1f; + Main.npc[headOneID].velocity = Vector2.Normalize(player.Center - Main.npc[headOneID].Center) * 16f; + Main.npc[headOneID].timeLeft *= 20; + Main.npc[headOneID].netSpam = 0; + Main.npc[headOneID].netUpdate = true; + + // On server, immediately send the correct extra AI of this head to clients. + if (Main.netMode == NetmodeID.Server) + { + var netMessage = mod.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.SyncCalamityNPCAIArray); + netMessage.Write((byte)headOneID); + netMessage.Write(Main.npc[headOneID].Calamity().newAI[0]); + netMessage.Write(Main.npc[headOneID].Calamity().newAI[1]); + netMessage.Write(Main.npc[headOneID].Calamity().newAI[2]); + netMessage.Write(Main.npc[headOneID].Calamity().newAI[3]); + netMessage.Send(); + } + + // Make sure the second split worm is also contiguous. + int startIndexHeadTwo = startIndexHeadOne + phase2Length + 1; + int headTwoID = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, npc.type, startIndexHeadTwo); + Main.npc[headTwoID].Calamity().newAI[0] = 2f; + Main.npc[headTwoID].Calamity().newAI[3] = Main.getGoodWorld ? 300f : 600f; + Main.npc[headTwoID].velocity = Vector2.Normalize(player.Center - Main.npc[headTwoID].Center) * 16f; + Main.npc[headTwoID].timeLeft *= 20; + Main.npc[headTwoID].netSpam = 0; + Main.npc[headTwoID].netUpdate = true; + + // On server, immediately send the correct extra AI of this head to clients. + if (Main.netMode == NetmodeID.Server) + { + var netMessage = mod.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.SyncCalamityNPCAIArray); + netMessage.Write((byte)headTwoID); + netMessage.Write(Main.npc[headTwoID].Calamity().newAI[0]); + netMessage.Write(Main.npc[headTwoID].Calamity().newAI[1]); + netMessage.Write(Main.npc[headTwoID].Calamity().newAI[2]); + netMessage.Write(Main.npc[headTwoID].Calamity().newAI[3]); + netMessage.Send(); + } + } + + SoundEngine.PlaySound(AstrumDeusHead.SplitSound, player.Center); + } + return; + } + } + + if (Main.zenithWorld && calamityGlobalNPC.newAI[1] < 10f) // desync the deuses + { + float pushForce = 0.25f; + for (int k = 0; k < Main.maxNPCs; k++) + { + NPC otherDeus = Main.npc[k]; + // Short circuits to make the loop as fast as possible + if (!otherDeus.active || k == npc.whoAmI) + continue; + + // If the other projectile is indeed the same owned by the same player and they're too close, nudge them away. + bool sameProjType = otherDeus.type == npc.type; + float taxicabDist = Vector2.Distance(npc.Center, otherDeus.Center); + float distancegate = 320f; + if (sameProjType && taxicabDist < distancegate) + { + if (npc.position.X < otherDeus.position.X) + npc.velocity.X -= pushForce; + else + npc.velocity.X += pushForce; + + if (npc.position.Y < otherDeus.position.Y) + npc.velocity.Y -= pushForce; + else + npc.velocity.Y += pushForce; + } + } + } + } + + // Copy dontTakeDamage and Opacity from head + else + { + npc.dontTakeDamage = Main.npc[(int)npc.ai[2]].dontTakeDamage; + npc.Opacity = Main.npc[(int)npc.ai[2]].Opacity; + deathModeEnragePhase_BodyAndTail = Main.npc[(int)npc.ai[2]].Calamity().newAI[0] == 3f; + + if (deathModeEnragePhase_BodyAndTail) + { + npc.defense = 25; + calamityGlobalNPC.DR = 0.15f; + } + } + + // Set worm variable + if (npc.ai[2] > 0f) + npc.realLife = (int)npc.ai[2]; + + // Alpha effects + if ((head || Main.npc[(int)npc.ai[1]].alpha < 128) && !npc.dontTakeDamage) + { + // Alpha changes + npc.alpha -= 42; + if (npc.alpha < 0) + npc.alpha = 0; + } + + // Check if other segments are still alive, if not, die + if (!head) + { + bool shouldDespawn = true; + int headType = ModContent.NPCType(); + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].type != headType || !Main.npc[i].active) + continue; + shouldDespawn = false; + break; + } + if (shouldDespawn) + { + if (Main.npc.IndexInRange((int)npc.ai[1]) && Main.npc[(int)npc.ai[1]].active && Main.npc[(int)npc.ai[1]].life > 0) + shouldDespawn = false; + } + if (shouldDespawn) + { + npc.life = 0; + npc.HitEffect(0, 10.0); + npc.checkDead(); + npc.active = false; + + npc.netUpdate = true; + + // Prevent netUpdate from being blocked by the spam counter. + if (npc.netSpam >= 10) + npc.netSpam = 9; + } + } + + // Direction + if (npc.velocity.X < 0f) + npc.spriteDirection = -1; + else if (npc.velocity.X > 0f) + npc.spriteDirection = 1; + + // Head code + if (head) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (npc.ai[0] == 0f) + { + int Previous = npc.whoAmI; + int bodyType = ModContent.NPCType(); + int tailType = ModContent.NPCType(); + for (int segments = 0; segments < maxLength; segments++) + { + int lol; + if (segments >= 0 && segments < maxLength - 1) + lol = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, bodyType, npc.whoAmI); + else + lol = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, tailType, npc.whoAmI); + + if (segments % 2 == 0) + Main.npc[lol].localAI[3] = 1f; + + Main.npc[lol].realLife = npc.whoAmI; + Main.npc[lol].Calamity().newAI[0] = Main.npc[Previous].Calamity().newAI[0]; + Main.npc[lol].Calamity().newAI[3] = Main.npc[Previous].Calamity().newAI[3]; + + if (Main.netMode == NetmodeID.Server) + { + var netMessage = mod.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.SyncCalamityNPCAIArray); + netMessage.Write((byte)lol); + netMessage.Write(Main.npc[lol].Calamity().newAI[0]); + netMessage.Write(Main.npc[lol].Calamity().newAI[1]); + netMessage.Write(Main.npc[lol].Calamity().newAI[2]); + netMessage.Write(Main.npc[lol].Calamity().newAI[3]); + netMessage.Send(); + } + + Main.npc[lol].ai[2] = npc.whoAmI; + Main.npc[lol].ai[1] = Previous; + Main.npc[Previous].ai[0] = lol; + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, lol); + Previous = lol; + } + } + } + + if (npc.life > Main.npc[(int)npc.ai[0]].life) + npc.life = Main.npc[(int)npc.ai[0]].life; + } + else + { + if (npc.life > Main.npc[(int)npc.ai[1]].life) + npc.life = Main.npc[(int)npc.ai[1]].life; + } + + float segmentVelocity = deathModeEnragePhase_Head ? 19f : death ? 17.5f : 16f; + + float segmentVelocityBoost = 5f * (1f - lifeRatio); + segmentVelocity += segmentVelocityBoost; + segmentVelocity += 4f * enrageScale; + + if (revenge) + { + float revMultiplier = 1.1f; + segmentVelocity *= revMultiplier; + } + + if (head) + { + int headTilePositionX = (int)(npc.position.X / 16f) - 1; + int headTileWidthPosX = (int)((npc.position.X + npc.width) / 16f) + 2; + int headTilePositionY = (int)(npc.position.Y / 16f) - 1; + int headTileWidthPosY = (int)((npc.position.Y + npc.height) / 16f) + 2; + + if (headTilePositionX < 0) + headTilePositionX = 0; + if (headTileWidthPosX > Main.maxTilesX) + headTileWidthPosX = Main.maxTilesX; + if (headTilePositionY < 0) + headTilePositionY = 0; + if (headTileWidthPosY > Main.maxTilesY) + headTileWidthPosY = Main.maxTilesY; + + // Fly or not + bool shouldFly = flyAtTarget; + if (!shouldFly) + { + for (int k = headTilePositionX; k < headTileWidthPosX; k++) + { + for (int l = headTilePositionY; l < headTileWidthPosY; l++) + { + if (Main.tile[k, l] != null && ((Main.tile[k, l].HasUnactuatedTile && (Main.tileSolid[Main.tile[k, l].TileType] || (Main.tileSolidTop[Main.tile[k, l].TileType] && Main.tile[k, l].TileFrameY == 0))) || Main.tile[k, l].LiquidAmount > 64)) + { + Vector2 vector2; + vector2.X = k * 16f; + vector2.Y = l * 16f; + if (npc.position.X + npc.width > vector2.X && npc.position.X < vector2.X + 16f && npc.position.Y + npc.height > vector2.Y && npc.position.Y < vector2.Y + 16f) + { + shouldFly = true; + break; + } + } + } + } + } + + // Start flying if target is not within a certain distance + if (!shouldFly) + { + npc.localAI[1] = 1f; + + Rectangle rectangle = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); + int noFlyZone = 200; + int heightReduction = death ? 130 : (int)(130f * (1f - lifeRatio)); + int height = 400 - heightReduction; + bool outsideNoFlyZone = true; + + if (npc.position.Y > player.position.Y) + { + for (int m = 0; m < Main.maxPlayers; m++) + { + if (Main.player[m].active) + { + Rectangle rectangle2 = new Rectangle((int)Main.player[m].position.X - noFlyZone, (int)Main.player[m].position.Y - noFlyZone, noFlyZone * 2, height); + if (rectangle.Intersects(rectangle2)) + { + outsideNoFlyZone = false; + break; + } + } + } + + if (outsideNoFlyZone) + shouldFly = true; + } + } + else + npc.localAI[1] = 0f; + + // Despawn + if (player.dead) + { + shouldFly = false; + float velocity = 2f; + npc.velocity.Y -= velocity; + if ((double)npc.position.Y < Main.topWorld + 16f) + { + segmentVelocity *= 2f; + npc.velocity.Y -= velocity; + } + + int headType = ModContent.NPCType(); + int bodyType = ModContent.NPCType(); + int tailType = ModContent.NPCType(); + if ((double)npc.position.Y < Main.topWorld + 16f) + { + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].type == headType || Main.npc[i].type == bodyType || Main.npc[i].type == tailType) + { + Main.npc[i].active = false; + + Main.npc[i].netUpdate = true; + + // Prevent netUpdate from being blocked by the spam counter. + if (Main.npc[i].netSpam >= 10) + Main.npc[i].netSpam = 9; + } + } + } + } + + // Speed and movement + float speedBoost = death ? (0.1f * (1f - lifeRatio)) : (0.13f * (1f - lifeRatio)); + float turnSpeedBoost = death ? (0.18f * (1f - lifeRatio)) : (0.2f * (1f - lifeRatio)); + float speed = (deathModeEnragePhase_Head ? 0.2f : death ? 0.18f : 0.13f) + speedBoost; + float turnSpeed = (deathModeEnragePhase_Head ? 0.27f : death ? 0.25f : 0.2f) + turnSpeedBoost; + speed += 0.05f * enrageScale; + turnSpeed += 0.08f * enrageScale; + + if (flyAtTarget) + { + float speedMultiplier = deathModeEnragePhase_Head ? 1.25f : doubleWormPhase ? (phase3 ? 1.25f : phase2 ? 1.2f : 1.15f) : 1f; + speed *= speedMultiplier; + } + + if (revenge) + { + float revMultiplier = 1.1f; + speed *= revMultiplier; + turnSpeed *= revMultiplier; + } + + speed *= increaseSpeedMore ? 2f : increaseSpeed ? 1.5f : 1f; + turnSpeed *= increaseSpeedMore ? 2f : increaseSpeed ? 1.5f : 1f; + + if (Main.getGoodWorld) + { + speed *= 1.15f; + turnSpeed *= 1.15f; + } + + Vector2 deusCenter = npc.Center; + float deusTargetX = player.Center.X; + float deusTargetY = player.Center.Y; + deusTargetX = (int)(deusTargetX / 16f) * 16; + deusTargetY = (int)(deusTargetY / 16f) * 16; + deusCenter.X = (int)(deusCenter.X / 16f) * 16; + deusCenter.Y = (int)(deusCenter.Y / 16f) * 16; + deusTargetX -= deusCenter.X; + deusTargetY -= deusCenter.Y; + + if (!shouldFly) + { + npc.velocity.Y += 0.15f; + if (npc.velocity.Y > segmentVelocity) + npc.velocity.Y = segmentVelocity; + + // This bool exists to stop the strange wiggle behavior when worms are falling down + bool slowXVelocity = Math.Abs(npc.velocity.X) > speed; + if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < segmentVelocity * 0.4) + { + if (npc.velocity.X < 0f) + npc.velocity.X -= speed * 1.1f; + else + npc.velocity.X += speed * 1.1f; + } + else if (npc.velocity.Y == segmentVelocity) + { + if (slowXVelocity) + { + if (npc.velocity.X < deusTargetX) + npc.velocity.X += speed; + else if (npc.velocity.X > deusTargetX) + npc.velocity.X -= speed; + } + else + npc.velocity.X = 0f; + } + else if (npc.velocity.Y > 4f) + { + if (slowXVelocity) + { + if (npc.velocity.X < 0f) + npc.velocity.X += speed * 0.9f; + else + npc.velocity.X -= speed * 0.9f; + } + else + npc.velocity.X = 0f; + } + } + else + { + float deusTargetDist = (float)Math.Sqrt(deusTargetX * deusTargetX + deusTargetY * deusTargetY); + float deusAbsoluteTargetX = Math.Abs(deusTargetX); + float deusAbsoluteTargetY = Math.Abs(deusTargetY); + float deusTimeToReachTarget = segmentVelocity / deusTargetDist; + deusTargetX *= deusTimeToReachTarget; + deusTargetY *= deusTimeToReachTarget; + + bool speedUpWhileFlying = false; + if (flyAtTarget) + { + if (((npc.velocity.X > 0f && deusTargetX < 0f) || (npc.velocity.X < 0f && deusTargetX > 0f) || (npc.velocity.Y > 0f && deusTargetY < 0f) || (npc.velocity.Y < 0f && deusTargetY > 0f)) && Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) > speed / 2f && deusTargetDist < 400f) + { + speedUpWhileFlying = true; + + if (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) < segmentVelocity) + npc.velocity *= 1.1f; + } + + if (npc.position.Y > player.position.Y) + { + speedUpWhileFlying = true; + + if (Math.Abs(npc.velocity.X) < segmentVelocity / 2f) + { + if (npc.velocity.X == 0f) + npc.velocity.X -= npc.direction; + + npc.velocity.X *= 1.1f; + } + else if (npc.velocity.Y > -segmentVelocity) + npc.velocity.Y -= speed; + } + } + + if (!speedUpWhileFlying) + { + if (!flyAtTarget) + { + if (((npc.velocity.X > 0f && deusTargetX > 0f) || (npc.velocity.X < 0f && deusTargetX < 0f)) && ((npc.velocity.Y > 0f && deusTargetY > 0f) || (npc.velocity.Y < 0f && deusTargetY < 0f))) + { + if (npc.velocity.X < deusTargetX) + npc.velocity.X += turnSpeed; + else if (npc.velocity.X > deusTargetX) + npc.velocity.X -= turnSpeed; + + if (npc.velocity.Y < deusTargetY) + npc.velocity.Y += turnSpeed; + else if (npc.velocity.Y > deusTargetY) + npc.velocity.Y -= turnSpeed; + } + } + + if ((npc.velocity.X > 0f && deusTargetX > 0f) || (npc.velocity.X < 0f && deusTargetX < 0f) || (npc.velocity.Y > 0f && deusTargetY > 0f) || (npc.velocity.Y < 0f && deusTargetY < 0f)) + { + if (npc.velocity.X < deusTargetX) + npc.velocity.X += speed; + else if (npc.velocity.X > deusTargetX) + npc.velocity.X -= speed; + + if (npc.velocity.Y < deusTargetY) + npc.velocity.Y += speed; + else if (npc.velocity.Y > deusTargetY) + npc.velocity.Y -= speed; + + if (Math.Abs(deusTargetY) < segmentVelocity * 0.2 && ((npc.velocity.X > 0f && deusTargetX < 0f) || (npc.velocity.X < 0f && deusTargetX > 0f))) + { + if (npc.velocity.Y > 0f) + npc.velocity.Y += speed * 2f; + else + npc.velocity.Y -= speed * 2f; + } + + if (Math.Abs(deusTargetX) < segmentVelocity * 0.2 && ((npc.velocity.Y > 0f && deusTargetY < 0f) || (npc.velocity.Y < 0f && deusTargetY > 0f))) + { + if (npc.velocity.X > 0f) + npc.velocity.X += speed * 2f; + else + npc.velocity.X -= speed * 2f; + } + } + else if (deusAbsoluteTargetX > deusAbsoluteTargetY) + { + if (npc.velocity.X < deusTargetX) + npc.velocity.X += speed * 1.1f; + else if (npc.velocity.X > deusTargetX) + npc.velocity.X -= speed * 1.1f; + + if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < segmentVelocity * 0.5) + { + if (npc.velocity.Y > 0f) + npc.velocity.Y += speed; + else + npc.velocity.Y -= speed; + } + } + else + { + if (npc.velocity.Y < deusTargetY) + npc.velocity.Y += speed * 1.1f; + else if (npc.velocity.Y > deusTargetY) + npc.velocity.Y -= speed * 1.1f; + + if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < segmentVelocity * 0.5) + { + if (npc.velocity.X > 0f) + npc.velocity.X += speed; + else + npc.velocity.X -= speed; + } + } + } + } + + if (shouldFly) + { + if (npc.localAI[0] != 1f) + { + npc.netUpdate = true; + + // Prevent netUpdate from being blocked by the spam counter. + if (npc.netSpam >= 10) + npc.netSpam = 9; + } + + npc.localAI[0] = 1f; + } + else + { + if (npc.localAI[0] != 0f) + { + npc.netUpdate = true; + + // Prevent netUpdate from being blocked by the spam counter. + if (npc.netSpam >= 10) + npc.netSpam = 9; + } + + npc.localAI[0] = 0f; + } + + if (((npc.velocity.X > 0f && npc.oldVelocity.X < 0f) || (npc.velocity.X < 0f && npc.oldVelocity.X > 0f) || (npc.velocity.Y > 0f && npc.oldVelocity.Y < 0f) || (npc.velocity.Y < 0f && npc.oldVelocity.Y > 0f)) && !npc.justHit) + { + npc.netUpdate = true; + + // Prevent netUpdate from being blocked by the spam counter. + if (npc.netSpam >= 10) + npc.netSpam = 9; + } + + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) + MathHelper.PiOver2; + } + + // Only the main worm body and tail use this code + else + { + // Shoot lasers + if (npc.type == ModContent.NPCType()) + { + npc.localAI[0] += 1f; + + int shootTime = (doubleWormPhase && expertMode) ? 2 : 1; + float shootProjectile = (doubleWormPhase && expertMode) ? 200 : 400; + float timer = npc.ai[0] + 15f; + float divisor = timer + shootProjectile; + bool shootGodRays = phase2 || deathModeEnragePhase_BodyAndTail; + + if (!flyAtTarget || deathModeEnragePhase_BodyAndTail) + { + float laserDivisor = (phase2 && !deathModeEnragePhase_BodyAndTail) ? 4f : 2f; + if (npc.localAI[0] % divisor == 0f && npc.ai[0] % laserDivisor == 0f) + { + npc.TargetClosest(); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (deathModeEnragePhase_BodyAndTail) + { + Vector2 velocity = Vector2.Zero; + if (movingMines) + { + Vector2 randomMineMovement = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101)); + randomMineMovement.Normalize(); + randomMineMovement *= Main.rand.Next(90, 121) * 0.01f; + velocity = randomMineMovement; + } + + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + float split = (splittingMines && npc.ai[0] % 3f == 0f) ? 1f : 0f; + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, velocity, type, damage, 0f, Main.myPlayer, split, 0f); + } + } + + if (Vector2.Distance(player.Center, npc.Center) > 80f) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + float deusLaserSpeed = (death ? 16f : revenge ? 14f : 13f) + enrageScale * 4f; + + Vector2 deusLaserCenter = npc.Center; + float deusLaserTargetX = player.Center.X - deusLaserCenter.X; + float deusLaserTargetY = player.Center.Y - deusLaserCenter.Y; + float deusLaserTargetDist = (float)Math.Sqrt(deusLaserTargetX * deusLaserTargetX + deusLaserTargetY * deusLaserTargetY); + deusLaserTargetDist = deusLaserSpeed / deusLaserTargetDist; + deusLaserTargetX *= deusLaserTargetDist; + deusLaserTargetY *= deusLaserTargetDist; + deusLaserCenter.X += deusLaserTargetX * 5f; + deusLaserCenter.Y += deusLaserTargetY * 5f; + + Vector2 shootDirection = new Vector2(deusLaserTargetX, deusLaserTargetY).SafeNormalize(Vector2.UnitY); + Vector2 laserVelocity = shootDirection * deusLaserSpeed; + + int type = shootGodRays ? ModContent.ProjectileType() : ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + if (shootGodRays) + { + SoundEngine.PlaySound(AstrumDeusHead.GodRaySound, npc.Center); + // Waving beams need to start offset so they cross each other neatly. + float waveSideOffset = Main.rand.NextFloat(9f, 14f); + Vector2 perp = shootDirection.RotatedBy(-MathHelper.PiOver2) * waveSideOffset; + + for (int i = -1; i <= 1; i += 2) + { + Vector2 laserStartPos = deusLaserCenter + i * perp + Main.rand.NextVector2CircularEdge(6f, 6f); + Projectile godRay = Projectile.NewProjectileDirect(npc.GetSource_FromAI(), laserStartPos, laserVelocity, type, damage, 0f, Main.myPlayer, player.Center.X, player.Center.Y); + + // Tell this Phased God Ray exactly which way it should be waving. + godRay.localAI[1] = i * 0.5f; + } + } + else + { + SoundEngine.PlaySound(AstrumDeusHead.LaserSound, npc.Center); + Projectile.NewProjectile(npc.GetSource_FromAI(), deusLaserCenter, laserVelocity, type, damage, 0f, Main.myPlayer, player.Center.X, player.Center.Y); + } + } + } + } + } + else + { + if (npc.localAI[0] % divisor == 0f && npc.ai[0] % 2f == 0f) + { + Vector2 velocity = Vector2.Zero; + if (movingMines) + { + Vector2 randomMineMovement = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101)); + randomMineMovement.Normalize(); + randomMineMovement *= Main.rand.Next(30, 121) * 0.01f; + velocity = randomMineMovement; + } + + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + float split = (splittingMines && npc.ai[0] % 3f == 0f) ? 1f : 0f; + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, velocity, type, damage, 0f, Main.myPlayer, split, 0f); + } + } + } + + // Follow the head + Vector2 segmentCenter = npc.Center; + float segmentTargetX = player.Center.X; + float segmentTargetY = player.Center.Y; + segmentTargetX = (int)(segmentTargetX / 16f) * 16; + segmentTargetY = (int)(segmentTargetY / 16f) * 16; + segmentCenter.X = (int)(segmentCenter.X / 16f) * 16; + segmentCenter.Y = (int)(segmentCenter.Y / 16f) * 16; + segmentTargetX -= segmentCenter.X; + segmentTargetY -= segmentCenter.Y; + + if (npc.ai[1] > 0f && npc.ai[1] < Main.npc.Length) + { + try + { + segmentCenter = npc.Center; + segmentTargetX = Main.npc[(int)npc.ai[1]].Center.X - segmentCenter.X; + segmentTargetY = Main.npc[(int)npc.ai[1]].Center.Y - segmentCenter.Y; + } + catch + { + } + + npc.rotation = (float)Math.Atan2(segmentTargetY, segmentTargetX) + MathHelper.PiOver2; + float segmentTargetDist = (float)Math.Sqrt(segmentTargetX * segmentTargetX + segmentTargetY * segmentTargetY); + int segmentWidth = npc.width; + segmentTargetDist = (segmentTargetDist - segmentWidth) / segmentTargetDist; + segmentTargetX *= segmentTargetDist; + segmentTargetY *= segmentTargetDist; + npc.velocity = Vector2.Zero; + npc.position.X = npc.position.X + segmentTargetX; + npc.position.Y = npc.position.Y + segmentTargetY; + + if (segmentTargetX < 0f) + npc.spriteDirection = -1; + else if (segmentTargetX > 0f) + npc.spriteDirection = 1; + } + } + + // Calculate contact damage based on velocity + if (!doNotDealDamage) + { + float minimalContactDamageVelocity = segmentVelocity * 0.25f; + float minimalDamageVelocity = segmentVelocity * 0.5f; + if (head) + { + if (npc.velocity.Length() <= minimalContactDamageVelocity) + { + npc.damage = (int)Math.Round(npc.defDamage * 0.5); + } + else + { + float velocityDamageScalar = MathHelper.Clamp((npc.velocity.Length() - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); + npc.damage = (int)MathHelper.Lerp((float)Math.Round(npc.defDamage * 0.5), npc.defDamage, velocityDamageScalar); + } + } + else + { + float bodyAndTailVelocity = (npc.position - npc.oldPosition).Length(); + if (bodyAndTailVelocity <= minimalContactDamageVelocity) + { + npc.damage = 0; + } + else + { + float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); + npc.damage = (int)MathHelper.Lerp(0f, npc.defDamage, velocityDamageScalar); + } + } + } + } + } +} diff --git a/NPCs/CalamityAIs/CalamityBossAIs/BrimstoneElementalAI.cs b/NPCs/CalamityAIs/CalamityBossAIs/BrimstoneElementalAI.cs new file mode 100644 index 0000000000..77a9dc6558 --- /dev/null +++ b/NPCs/CalamityAIs/CalamityBossAIs/BrimstoneElementalAI.cs @@ -0,0 +1,734 @@ +using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.CalPlayer; +using CalamityMod.Dusts; +using CalamityMod.Events; +using CalamityMod.NPCs.Abyss; +using CalamityMod.NPCs.AquaticScourge; +using CalamityMod.NPCs.AstrumAureus; +using CalamityMod.NPCs.AstrumDeus; +using CalamityMod.NPCs.BrimstoneElemental; +using CalamityMod.NPCs.Bumblebirb; +using CalamityMod.NPCs.CalClone; +using CalamityMod.NPCs.CeaselessVoid; +using CalamityMod.NPCs.Crags; +using CalamityMod.NPCs.NormalNPCs; +using CalamityMod.NPCs.OldDuke; +using CalamityMod.NPCs.SulphurousSea; +using CalamityMod.NPCs.SunkenSea; +using CalamityMod.Projectiles.Boss; +using CalamityMod.Projectiles.Enemy; +using CalamityMod.Sounds; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs +{ + public static class BrimstoneElementalAI + { + public static void VanillaBrimstoneElementalAI(NPC npc, Mod mod) + { + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + BrimstoneElemental.BrimstoneElemental brimmy = npc.ModNPC(); + + // Used for Brimling AI states + CalamityGlobalNPC.brimstoneElemental = npc.whoAmI; + + // Emit light + Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 1.2f, 0f, 0f); + + // Get a target + 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; + + if (!player.active || player.dead || despawnDistance) + { + npc.TargetClosest(false); + player = Main.player[npc.target]; + if (!player.active || player.dead || despawnDistance) + { + npc.rotation = npc.velocity.X * 0.04f; + + if (npc.velocity.Y > 3f) + npc.velocity.Y = 3f; + npc.velocity.Y -= 0.1f; + if (npc.velocity.Y < -12f) + npc.velocity.Y = -12f; + + if (npc.timeLeft > 60) + npc.timeLeft = 60; + + if (npc.ai[0] != 0f) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.localAI[0] = 0f; + npc.localAI[1] = 0f; + npc.netUpdate = true; + } + return; + } + } + else if (npc.timeLeft < 1800) + npc.timeLeft = 1800; + + CalamityPlayer modPlayer = player.Calamity(); + + // Reset defense + npc.defense = npc.defDefense; + calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = npc.ai[0] == 4f; + + // Percent life remaining + float lifeRatio = npc.life / (float)npc.lifeMax; + + // Variables for buffing the AI + bool bossRush = BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || bossRush; + bool revenge = CalamityWorld.revenge || bossRush; + bool death = CalamityWorld.death || bossRush; + + bool phase2 = lifeRatio < 0.5f && revenge; + bool phase3 = lifeRatio < 0.33f; + + // Enrage + if ((!player.ZoneUnderworldHeight || !modPlayer.ZoneCalamity) && !bossRush) + { + if (calamityGlobalNPC.newAI[3] > 0f) + calamityGlobalNPC.newAI[3] -= 1f; + } + else + calamityGlobalNPC.newAI[3] = CalamityGlobalNPC.biomeEnrageTimerMax; + + bool biomeEnraged = calamityGlobalNPC.newAI[3] <= 0f || bossRush; + + float enrageScale = bossRush ? 1f : 0f; + if (biomeEnraged && (!player.ZoneUnderworldHeight || bossRush)) + { + npc.Calamity().CurrentlyEnraged = !bossRush; + enrageScale += 1f; + } + if (biomeEnraged && (!modPlayer.ZoneCalamity || bossRush)) + { + npc.Calamity().CurrentlyEnraged = !bossRush; + enrageScale += 1f; + } + + npc.Calamity().DR = npc.ai[0] == 4f ? 0.6f : 0.15f; + + // Emit dust + int dustAmt = (npc.ai[0] == 2f) ? 2 : 1; + int size = (npc.ai[0] == 2f) ? 50 : 35; + if (npc.ai[0] != 1f) + { + for (int i = 0; i < 2; i++) + { + if (Main.rand.Next(3) < dustAmt) + { + int dust = Dust.NewDust(npc.Center - new Vector2(size), size * 2, size * 2, DustID.LifeDrain, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f, 90, default, 1.5f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0.2f; + Main.dust[dust].fadeIn = 1f; + } + } + } + + // Distance from destination where Brimmy stops moving + float movementDistanceGateValue = 100f; + + // How fast Brimmy moves to the destination + float baseVelocity = (death ? 6f : revenge ? 5.5f : expertMode ? 5f : 4.5f) * (npc.ai[0] == 5f ? 0.05f : npc.ai[0] == 3f ? 1.5f : 1f); + baseVelocity += 3f * enrageScale; + if (expertMode) + baseVelocity += death ? 3f * (1f - lifeRatio) : 2f * (1f - lifeRatio); + + float baseAcceleration = (death ? 0.12f : 0.1f) * (npc.ai[0] == 5f ? 0.5f : npc.ai[0] == 3f ? 1.5f : 1f); + baseAcceleration += 0.06f * enrageScale; + if (expertMode) + baseAcceleration += 0.03f * (1f - lifeRatio); + + // This is where Brimmy should be + Vector2 destination = npc.ai[0] != 3f ? player.Center : new Vector2(player.Center.X, player.Center.Y - 300f); + + // How far Brimmy is from where she's supposed to be + Vector2 distanceFromDestination = destination - npc.Center; + + // Movement + if (npc.ai[0] != 4f) + CalamityUtils.SmoothMovement(npc, movementDistanceGateValue, distanceFromDestination, baseVelocity, baseAcceleration, true); + + // Rotation and direction + if (npc.ai[0] <= 2f || npc.ai[0] == 5f) + { + npc.rotation = npc.velocity.X * 0.04f; + if (npc.ai[0] != 5 || (npc.ai[1] < 180f && npc.ai[0] == 5f)) + { + float playerLocation = npc.Center.X - player.Center.X; + npc.direction = playerLocation < 0f ? 1 : -1; + npc.spriteDirection = npc.direction; + } + } + + if (Main.zenithWorld) // in gfb, Brimmy channels the power of the other elementals. + { + int newMode; + if (lifeRatio <= 0.8f && lifeRatio > 0.6f) + { + newMode = 1; // Sand + } + else if (lifeRatio <= 0.6f && lifeRatio > 0.4f) + { + newMode = 2; // Rare Sand + } + else if (lifeRatio <= 0.4f && lifeRatio > 0.2f) + { + newMode = 3; // Cloud + } + else if (lifeRatio <= 0.2f) + { + newMode = 4; // Water + } + else + { + newMode = 0; // Brimstone, default + } + if (newMode != brimmy.currentMode) + { + SoundEngine.PlaySound(SoundID.Item29, npc.Center); + } + brimmy.currentMode = newMode; + } + + if (npc.ai[0] == -1f) + { + // Avoid cheap bullshit + npc.damage = 0; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int phase; + int random = phase2 ? 6 : 5; + do phase = Main.rand.Next(random); + while (phase == npc.ai[1] || (phase == 0 && phase3 && revenge) || phase == 1 || phase == 2 || (phase == 4 && npc.localAI[3] != 0f)); + + npc.ai[0] = phase; + npc.ai[1] = 0f; + + // Cocoon phase cooldown + if (npc.localAI[3] > 0f) + npc.localAI[3] -= 1f; + else if (phase == 4) + npc.localAI[3] = 3f; + + npc.netUpdate = true; + + // Prevent netUpdate from being blocked by the spam counter. + // A phase switch sync is a critical operation that must be synced. + if (npc.netSpam >= 10) + npc.netSpam = 9; + } + } + + // Pick a location to teleport to + else if (npc.ai[0] == 0f) + { + // Avoid cheap bullshit + npc.damage = 0; + + npc.chaseable = true; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.localAI[1] += 1f; + if (npc.localAI[1] >= (bossRush ? 5f : death ? 30f : 180f)) + { + npc.TargetClosest(); + npc.localAI[1] = 0f; + int timer = 0; + int playerPosX; + int playerPosY; + while (true) + { + timer++; + playerPosX = (int)player.Center.X / 16; + playerPosY = (int)player.Center.Y / 16; + + int min = 12; + int max = 16; + + if (Main.rand.NextBool()) + playerPosX += Main.rand.Next(min, max); + else + playerPosX -= Main.rand.Next(min, max); + + if (Main.rand.NextBool()) + playerPosY += Main.rand.Next(min, max); + else + playerPosY -= Main.rand.Next(min, max); + + if (!WorldGen.SolidTile(playerPosX, playerPosY)) + break; + + if (timer > 100) + return; + } + npc.ai[0] = 1f; + npc.ai[1] = playerPosX; + npc.ai[2] = playerPosY; + npc.netUpdate = true; + } + } + } + + // Teleport to location + else if (npc.ai[0] == 1f) + { + // Avoid cheap bullshit + npc.damage = 0; + + npc.chaseable = true; + Vector2 position = new Vector2(npc.ai[1] * 16f - (npc.width / 2), npc.ai[2] * 16f - (npc.height / 2)); + for (int m = 0; m < 5; m++) + { + int dust = Dust.NewDust(position, npc.width, npc.height, DustID.LifeDrain, 0f, -1f, 90, default, 2f); + Main.dust[dust].noGravity = true; + Main.dust[dust].fadeIn = 1f; + } + npc.alpha += bossRush ? 4 : death ? 3 : 2; + if (npc.alpha >= 255) + { + int spawnType = brimmy.currentMode == 3 ? NPCID.AngryNimbus : ModContent.NPCType(); + int enemyCount = brimmy.currentMode == 3 ? 3 : 1; // 3 angry nimbi if cloud, otherwise 1 brimling + if (Main.netMode != NetmodeID.MultiplayerClient && NPC.CountNPCS(spawnType) < (death ? 1 : 2) && revenge && brimmy.currentMode != 2) // dont spawn anything if gfb rare sand + { + for (int i = 0; i < enemyCount; i++) + NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, spawnType); + } + SoundEngine.PlaySound(SoundID.Item8, npc.Center); + npc.alpha = 255; + npc.position = position; + for (int n = 0; n < 15; n++) + { + int warpDust = Dust.NewDust(npc.position, npc.width, npc.height, DustID.LifeDrain, 0f, -1f, 90, default, 3f); + Main.dust[warpDust].noGravity = true; + } + npc.ai[0] = 2f; + npc.netUpdate = true; + } + } + + // Either teleport again or go to next AI state + else if (npc.ai[0] == 2f) + { + // Avoid cheap bullshit + npc.damage = 0; + + if (npc.alpha >= 255) + { + if (Main.zenithWorld) + { + SoundEngine.PlaySound(SoundID.Item68, npc.Center); + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + Vector2 pos = npc.Center; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Projectile.NewProjectile(npc.GetSource_FromAI(), pos, new Vector2(0, 1), type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); + Projectile.NewProjectile(npc.GetSource_FromAI(), pos, new Vector2(0, -1), type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); + Projectile.NewProjectile(npc.GetSource_FromAI(), pos, new Vector2(1, 0), type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); + Projectile.NewProjectile(npc.GetSource_FromAI(), pos, new Vector2(-1, 0), type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); + } + if (brimmy.currentMode >= 1 && brimmy.currentMode <= 3) + { + int tornadoType = brimmy.currentMode == 3 ? ModContent.ProjectileType() : ProjectileID.SandnadoHostileMark; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Projectile.NewProjectile(npc.GetSource_FromAI(), pos, Vector2.Zero, tornadoType, damage, 0f, Main.myPlayer, 0f, 0f); + } + } + if (brimmy.currentMode == 2) + { + int healAmt = npc.lifeMax / 25; + if (healAmt > 0) + { + npc.life += healAmt; + npc.HealEffect(healAmt, true); + npc.netUpdate = true; + } + } + } + } + + npc.alpha -= 50; + if (npc.alpha <= 0) + { + npc.chaseable = true; + npc.ai[3] += 1f; + npc.alpha = 0; + if (npc.ai[3] >= 2f || phase2 || Main.getGoodWorld) + { + npc.ai[0] = -1f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + } + else + { + npc.ai[0] = 0f; + } + npc.netUpdate = true; + } + } + + // Float above target and fire projectiles + else if (npc.ai[0] == 3f) + { + // Avoid cheap bullshit + npc.damage = 0; + + npc.chaseable = true; + npc.rotation = npc.velocity.X * 0.04f; + + float playerLocation = npc.Center.X - player.Center.X; + npc.direction = playerLocation < 0f ? 1 : -1; + npc.spriteDirection = npc.direction; + + npc.ai[1] += 1f; + float divisor = expertMode ? (death ? 80f : revenge ? 45f : 50f) - (float)Math.Ceiling(10f * (1f - lifeRatio)) : 50f; + divisor -= 3f * enrageScale; + float divisor2 = divisor * 2f; + + if (npc.ai[1] % divisor == divisor - 1f) + { + float velocity = (death ? 7f : revenge ? 6f : 5f) + (2f * enrageScale) + (expertMode ? 3f * (1f - lifeRatio) : 0f); + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + if (brimmy.currentMode == 4) + { + type = ModContent.ProjectileType(); + SoundEngine.PlaySound(SoundID.Item30, player.Center); + } + Vector2 projectileVelocity = (player.Center - npc.Center).SafeNormalize(Vector2.UnitY) * velocity; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + projectileVelocity.SafeNormalize(Vector2.UnitY) * 5f, projectileVelocity, type, damage, 0f, Main.myPlayer, player.position.X, player.position.Y); + Main.projectile[proj].timeLeft = 240; + if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + Main.projectile[proj].extraUpdates += 1; + } + + if (npc.ai[1] % divisor2 == divisor2 - 1f) + { + velocity = (death ? 5f : 4f) + 2f * enrageScale; + type = ModContent.ProjectileType(); + damage = npc.GetProjectileDamage(type); + if (brimmy.currentMode == 4) + { + type = ModContent.ProjectileType(); + SoundEngine.PlaySound(SoundID.Item21, player.Center); + } + projectileVelocity = (player.Center - npc.Center).SafeNormalize(Vector2.UnitY) * velocity; + int numProj = death ? 8 : 4; + int spread = death ? 90 : 45; + if (Main.getGoodWorld) + { + numProj *= 3; + spread *= 2; + } + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + float rotation = MathHelper.ToRadians(spread); + float projectileVelocityToPass = velocity * 3f; + for (int i = 0; i < numProj; i++) + { + Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); + int proj2 = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 5f, perturbedSpeed, type, damage, 0f, Main.myPlayer, 1f, 0f, projectileVelocityToPass); + if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + Main.projectile[proj2].extraUpdates += 1; + } + } + } + } + + if (npc.ai[1] >= divisor * (death ? 5f : 10f)) + { + npc.TargetClosest(); + npc.ai[0] = -1f; + npc.ai[1] = 3f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.netUpdate = true; + } + } + + // Cocoon bullet hell + else if (npc.ai[0] == 4f) + { + // Avoid cheap bullshit + npc.damage = 0; + + npc.defense = npc.defDefense * 4; + + npc.chaseable = false; + npc.localAI[0] += 1f; + if (Main.getGoodWorld) + npc.localAI[0] += 2f; + if (expertMode) + npc.localAI[0] += 1f - lifeRatio; + npc.localAI[0] += enrageScale; + + if (npc.localAI[0] >= 120f) + { + npc.localAI[0] = 0f; + + float projectileSpeed = death ? 9f : revenge ? 8f : 6f; + projectileSpeed += 2f * enrageScale; + + Vector2 projectileVelocity = player.Center - npc.Center; + + float radialOffset = 0.2f; + float diameter = 80f; + + projectileVelocity = projectileVelocity.SafeNormalize(Vector2.UnitY) * projectileSpeed; + + Vector2 velocity = projectileVelocity; + velocity = velocity.SafeNormalize(Vector2.UnitY); + velocity *= diameter; + + int totalProjectiles = 6; + float offsetAngle = (float)Math.PI * radialOffset; + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + for (int j = 0; j < totalProjectiles; j++) + { + float radians = j - (totalProjectiles - 1f) / 2f; + Vector2 offset = velocity.RotatedBy(offsetAngle * radians); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + offset, projectileVelocity, type, damage, 0f, Main.myPlayer, 1f, 0f); + Main.projectile[proj].timeLeft = 300; + Main.projectile[proj].tileCollide = false; + if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + Main.projectile[proj].extraUpdates += 1; + } + } + + totalProjectiles = 12; + float radians2 = MathHelper.TwoPi / totalProjectiles; + type = ModContent.ProjectileType(); + damage = npc.GetProjectileDamage(type); + if (brimmy.currentMode == 4) + { + type = ModContent.ProjectileType(); + SoundEngine.PlaySound(SoundID.Item26, player.Center); + } + double angleA = radians2 * 0.5; + double angleB = MathHelper.ToRadians(90f) - angleA; + float velocityX = (float)(projectileSpeed * Math.Sin(angleA) / Math.Sin(angleB)); + Vector2 spinningPoint = npc.localAI[2] % 2f == 0f ? new Vector2(0f, -projectileSpeed) : new Vector2(-velocityX, -projectileSpeed); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + float projectileVelocityToPass = projectileSpeed * 3f; + for (int k = 0; k < totalProjectiles; k++) + { + Vector2 vector255 = spinningPoint.RotatedBy(radians2 * k); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + vector255.SafeNormalize(Vector2.UnitY) * 5f, vector255, type, damage, 0f, Main.myPlayer, 1f, 0f, projectileVelocityToPass); + if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + Main.projectile[proj].extraUpdates += 1; + } + + if (death) + { + spinningPoint = npc.localAI[2] % 2f == 0f ? new Vector2(-velocityX, -projectileSpeed) : new Vector2(0f, -projectileSpeed); + for (int k = 0; k < totalProjectiles; k++) + { + Vector2 vector255 = spinningPoint.RotatedBy(radians2 * k); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + vector255.SafeNormalize(Vector2.UnitY) * 5f, vector255 * 0.75f, type, damage, 0f, Main.myPlayer, 1f, 0f, projectileVelocityToPass); + if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + Main.projectile[proj].extraUpdates += 1; + } + } + } + + npc.localAI[2] += 1f; + } + + npc.velocity *= 0.95f; + npc.rotation = npc.velocity.X * 0.04f; + float playerLocation = npc.Center.X - player.Center.X; + npc.direction = playerLocation < 0f ? 1 : -1; + npc.spriteDirection = npc.direction; + + npc.ai[1] += 1f; + if (npc.ai[1] >= (death ? 240f : 300f)) + { + npc.TargetClosest(); + npc.ai[0] = -1f; + npc.ai[1] = 4f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.localAI[0] = 0f; + npc.netUpdate = true; + } + } + + // Laser beam attack + else if (npc.ai[0] == 5f) + { + // Avoid cheap bullshit + npc.damage = 0; + + npc.chaseable = true; + + npc.defense = npc.defDefense * 2; + + Vector2 source = new Vector2(npc.Center.X + (npc.spriteDirection > 0 ? 34f : -34f), npc.Center.Y - 74f); + Vector2 aimAt = player.Center + player.velocity * 20f; + float aimResponsiveness = bossRush ? 0.05f : (npc.ai[2] == 1f || death) ? 0.1f : 0.25f; + + Vector2 aimVector = (aimAt - source).SafeNormalize(Vector2.UnitY); + if (aimVector.HasNaNs()) + aimVector = -Vector2.UnitY; + aimVector = (Vector2.Lerp(aimVector, npc.velocity.SafeNormalize(Vector2.UnitY), aimResponsiveness)).SafeNormalize(Vector2.UnitY); + aimVector *= 6f; + + Vector2 laserVelocity = aimVector.SafeNormalize(Vector2.UnitY); + if (laserVelocity.HasNaNs()) + laserVelocity = -Vector2.UnitY; + + calamityGlobalNPC.newAI[1] = laserVelocity.X; + calamityGlobalNPC.newAI[2] = laserVelocity.Y; + + // Rev = 190 + 165 = 355 + // Death = 165 + + npc.ai[1] += 1f; + if (npc.ai[1] >= 240f) + { + npc.TargetClosest(); + npc.ai[2] += 1f; + npc.localAI[0] = 0f; + npc.localAI[1] = 0f; + if (npc.ai[2] >= (death ? 1f : 2f)) + { + npc.ai[0] = -1f; + npc.ai[1] = 5f; + npc.ai[2] = 0f; + calamityGlobalNPC.newAI[0] = 0f; + } + else + { + npc.ai[1] = 0f; + calamityGlobalNPC.newAI[0] = 0f; + } + } + else if (npc.ai[1] >= 180f) + { + npc.velocity *= 0.95f; + if (npc.ai[1] == 180f) + { + SoundEngine.PlaySound(SoundID.Item68, source); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Vector2 laserVelocity2 = new Vector2(npc.localAI[0], npc.localAI[1]); + laserVelocity2 = laserVelocity2.SafeNormalize(Vector2.UnitY); + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + + Projectile.NewProjectile(npc.GetSource_FromAI(), source, laserVelocity2, type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); + if (Main.getGoodWorld) + Projectile.NewProjectile(npc.GetSource_FromAI(), source, -laserVelocity2, type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); + + if (Main.zenithWorld) + { + Projectile.NewProjectile(npc.GetSource_FromAI(), source, new Vector2(-laserVelocity2.X, laserVelocity2.Y), type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); + Projectile.NewProjectile(npc.GetSource_FromAI(), source, new Vector2(laserVelocity2.X, -laserVelocity2.Y), type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); + } + } + } + } + else + { + float playSoundTimer = 30f; + if (npc.ai[1] < 150f) + { + switch ((int)npc.ai[2]) + { + case 0: + npc.ai[1] += 0.5f; + break; + case 1: + npc.ai[1] += 1f; + playSoundTimer = 40f; + break; + } + if (death) + { + npc.ai[1] += 0.5f; + playSoundTimer += 10f; + } + } + + if (npc.ai[1] % playSoundTimer == 0f) + SoundEngine.PlaySound(SoundID.Item20, npc.Center); + + if (npc.ai[1] < 150f && calamityGlobalNPC.newAI[0] == 0f) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Projectile.NewProjectile(npc.GetSource_FromAI(), source, laserVelocity, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 0f, npc.whoAmI); + if (Main.getGoodWorld) + Projectile.NewProjectile(npc.GetSource_FromAI(), source, -laserVelocity, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 0f, npc.whoAmI); + + if (Main.zenithWorld) + { + Projectile.NewProjectile(npc.GetSource_FromAI(), source, new Vector2(-laserVelocity.X, laserVelocity.Y), ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 0f, npc.whoAmI); + Projectile.NewProjectile(npc.GetSource_FromAI(), source, new Vector2(laserVelocity.X, -laserVelocity.Y), ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 0f, npc.whoAmI); + } + } + + calamityGlobalNPC.newAI[0] = 1f; + } + else + { + if (npc.ai[1] == 150f) + { + npc.localAI[0] = laserVelocity.X; + npc.localAI[1] = laserVelocity.Y; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Projectile.NewProjectile(npc.GetSource_FromAI(), source.X, source.Y, npc.localAI[0], npc.localAI[1], ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 1f, npc.whoAmI); + if (Main.getGoodWorld) + Projectile.NewProjectile(npc.GetSource_FromAI(), source.X, source.Y, -npc.localAI[0], -npc.localAI[1], ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 1f, npc.whoAmI); + + if (Main.zenithWorld) + { + Projectile.NewProjectile(npc.GetSource_FromAI(), source.X, source.Y, -npc.localAI[0], npc.localAI[1], ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 1f, npc.whoAmI); + Projectile.NewProjectile(npc.GetSource_FromAI(), source.X, source.Y, npc.localAI[0], -npc.localAI[1], ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 1f, npc.whoAmI); + } + } + } + } + } + } + } + } +} diff --git a/NPCs/CalamityAIs/CalamityBossAIs/BumblebirbAI.cs b/NPCs/CalamityAIs/CalamityBossAIs/BumblebirbAI.cs new file mode 100644 index 0000000000..0882a65f4f --- /dev/null +++ b/NPCs/CalamityAIs/CalamityBossAIs/BumblebirbAI.cs @@ -0,0 +1,1158 @@ +using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.CalPlayer; +using CalamityMod.Dusts; +using CalamityMod.Events; +using CalamityMod.NPCs.Abyss; +using CalamityMod.NPCs.AquaticScourge; +using CalamityMod.NPCs.AstrumAureus; +using CalamityMod.NPCs.AstrumDeus; +using CalamityMod.NPCs.BrimstoneElemental; +using CalamityMod.NPCs.Bumblebirb; +using CalamityMod.NPCs.CalClone; +using CalamityMod.NPCs.CeaselessVoid; +using CalamityMod.NPCs.Crags; +using CalamityMod.NPCs.NormalNPCs; +using CalamityMod.NPCs.OldDuke; +using CalamityMod.NPCs.SulphurousSea; +using CalamityMod.NPCs.SunkenSea; +using CalamityMod.Projectiles.Boss; +using CalamityMod.Projectiles.Enemy; +using CalamityMod.Sounds; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs +{ + public static class BumblebirbAI + { + public static void VanillaBumblebirbAI(NPC npc, Mod mod) + { + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + + // Get a target + 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]; + + // Variables + float rotationMult = 3f; + float rotationAmt = 0.03f; + bool bossRush = BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || bossRush; + bool revenge = CalamityWorld.revenge || bossRush; + bool death = CalamityWorld.death || bossRush; + + // Adjust slowing debuff immunity + bool immuneToSlowingDebuffs = npc.ai[0] == 3f || npc.ai[0] == 3.1f || npc.ai[0] == 3.2f; + npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + npc.buffImmune[BuffID.Slow] = immuneToSlowingDebuffs; + npc.buffImmune[BuffID.Webbed] = immuneToSlowingDebuffs; + + // If target is outside the jungle for more than 5 seconds, enrage + if (!player.ZoneJungle) + { + if (npc.localAI[1] < CalamityGlobalNPC.biomeEnrageTimerMax) + npc.localAI[1] += 1f; + } + else + npc.localAI[1] = 0f; + + // If dragonfolly is off screen, enrage for the next couple attacks + if (Vector2.Distance(player.Center, npc.Center) > 1200f) + npc.localAI[2] = 2f; + + // Enrage scale + float enrageScale = death ? 1.5f : 1f; + if (npc.localAI[1] >= CalamityGlobalNPC.biomeEnrageTimerMax || bossRush) + { + npc.Calamity().CurrentlyEnraged = !bossRush; + enrageScale += 1f; + } + + if (npc.localAI[2] > 0f || bossRush) + enrageScale += 1f; + + if (Main.getGoodWorld) + enrageScale += 0.5f; + + if (enrageScale > 3f) + enrageScale = 3f; + + // Despawn + if (!player.active || player.dead || Vector2.Distance(player.Center, npc.Center) > 5600f) + { + npc.TargetClosest(false); + player = Main.player[npc.target]; + + if (!player.active || player.dead || Vector2.Distance(player.Center, npc.Center) > 5600f) + { + npc.rotation = (npc.rotation * rotationMult + npc.velocity.X * rotationAmt) / 10f; + + if (npc.velocity.Y > 3f) + npc.velocity.Y = 3f; + npc.velocity.Y -= 0.2f; + if (npc.velocity.Y < -12f) + npc.velocity.Y = -12f; + + if (npc.timeLeft > 60) + npc.timeLeft = 60; + + if (npc.ai[0] != 0f) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + + npc.netUpdate = true; + + // Prevent netUpdate from being blocked by the spam counter. + if (npc.netSpam >= 10) + npc.netSpam = 9; + } + + return; + } + } + else if (npc.timeLeft < 1800) + npc.timeLeft = 1800; + + // Percent life remaining + float lifeRatio = npc.life / (float)npc.lifeMax; + + // Phases + bool phase2 = lifeRatio < (revenge ? 0.75f : 0.5f); + bool phase3 = lifeRatio < (death ? 0.4f : revenge ? 0.25f : 0.1f) && expertMode; + + float birbSpawnPhaseTimer = 180f; + float newPhaseTimer = 180f; + bool phaseSwitchPhase = (phase2 && calamityGlobalNPC.newAI[0] < newPhaseTimer && calamityGlobalNPC.newAI[2] != 1f) || + (phase3 && calamityGlobalNPC.newAI[1] < newPhaseTimer && calamityGlobalNPC.newAI[3] != 1f); + + calamityGlobalNPC.DR = (phaseSwitchPhase || npc.ai[0] == 5f || (enrageScale == 3f && !bossRush)) ? (bossRush ? 0.99f : 0.55f) : 0.1f; + calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = phaseSwitchPhase || npc.ai[0] == 5f || (enrageScale == 3f && !bossRush); + + int reducedSetDamage = (int)Math.Round(npc.defDamage * 0.5); + + if (phaseSwitchPhase) + { + // Avoid cheap bullshit + npc.damage = 0; + + if (npc.velocity.X < 0f) + npc.direction = -1; + else if (npc.velocity.X > 0f) + npc.direction = 1; + + npc.spriteDirection = npc.direction; + npc.rotation = (npc.rotation * rotationMult + npc.velocity.X * rotationAmt) / 10f; + + if (phase3) + { + calamityGlobalNPC.newAI[1] += 1f; + + // Sound + if (calamityGlobalNPC.newAI[1] == newPhaseTimer - 60f) + { + float squawkpitch = Main.zenithWorld ? 1.3f : 0.25f; + SoundEngine.PlaySound(SoundID.DD2_BetsyScream with { Pitch = squawkpitch }, npc.Center); + + if (Main.zenithWorld) + { + int spacing = 20; + int amt = 5; + SoundEngine.PlaySound(CommonCalamitySounds.LightningSound, npc.Center - Vector2.UnitY * 300f); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + for (int i = 0; i < amt; i++) + { + Vector2 fireFrom = new Vector2(npc.Center.X + (spacing * i) - (spacing * amt / 2), npc.Center.Y - 900f); + Vector2 ai0 = npc.Center - fireFrom; + float ai = Main.rand.Next(100); + Vector2 velocity = Vector2.Normalize(ai0.RotatedByRandom(MathHelper.PiOver4)) * 7f; + Projectile.NewProjectile(npc.GetSource_FromAI(), fireFrom.X, fireFrom.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), npc.defDamage, 0f, Main.myPlayer, ai0.ToRotation(), ai); + } + } + } + } + + if (calamityGlobalNPC.newAI[1] >= newPhaseTimer) + { + calamityGlobalNPC.newAI[1] = 0f; + calamityGlobalNPC.newAI[2] = 1f; + calamityGlobalNPC.newAI[3] = 1f; + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.SyncExtraAI(); + + npc.netUpdate = true; + + // Prevent netUpdate from being blocked by the spam counter. + if (npc.netSpam >= 10) + npc.netSpam = 9; + } + } + else + { + calamityGlobalNPC.newAI[0] += 1f; + + // Sound + if (calamityGlobalNPC.newAI[0] == newPhaseTimer - 60f) + { + float squawkpitch = Main.zenithWorld ? 1.3f : 0.25f; + SoundEngine.PlaySound(SoundID.DD2_BetsyScream with { Pitch = squawkpitch }, npc.Center); + + if (Main.zenithWorld) + { + int spacing = 20; + int amt = 3; + SoundEngine.PlaySound(CommonCalamitySounds.LightningSound, npc.Center - Vector2.UnitY * 300f); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + for (int i = 0; i < amt; i++) + { + Vector2 fireFrom = new Vector2(npc.Center.X + (spacing * i) - (spacing * amt / 2), npc.Center.Y - 900f); + Vector2 ai0 = npc.Center - fireFrom; + float ai = Main.rand.Next(100); + Vector2 velocity = Vector2.Normalize(ai0.RotatedByRandom(MathHelper.PiOver4)) * 7f; + Projectile.NewProjectile(npc.GetSource_FromAI(), fireFrom.X, fireFrom.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), npc.defDamage, 0f, Main.myPlayer, ai0.ToRotation(), ai); + } + } + } + } + + if (calamityGlobalNPC.newAI[0] >= newPhaseTimer) + { + calamityGlobalNPC.newAI[0] = 0f; + calamityGlobalNPC.newAI[2] = 1f; + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.SyncExtraAI(); + + npc.netUpdate = true; + + // Prevent netUpdate from being blocked by the spam counter. + if (npc.netSpam >= 10) + npc.netSpam = 9; + } + } + + Vector2 follyTargetDirection = player.Center - npc.Center; + float follyTargetDistance = 4f + follyTargetDirection.Length() / 100f; + float follyVelocityMult = 25f; + follyTargetDirection.Normalize(); + follyTargetDirection *= follyTargetDistance; + npc.velocity = (npc.velocity * (follyVelocityMult - 1f) + follyTargetDirection) / follyVelocityMult; + return; + } + + // Max spawn amount + int maxBirbs = (CalamityWorld.LegendaryMode && revenge) ? 12 : revenge ? 3 : 2; + + // Variable for charging + float chargeDistance = 600f; + if (phase2) + chargeDistance -= 50f; + if (phase3) + chargeDistance -= 50f; + chargeDistance -= (enrageScale - 1f) * 100f; + + // Phase switch + if (npc.ai[0] == 0f) + { + // Avoid cheap bullshit + npc.damage = 0; + + if (npc.Center.X < player.Center.X - 2f) + npc.direction = 1; + if (npc.Center.X > player.Center.X + 2f) + npc.direction = -1; + + // Direction and rotation + npc.spriteDirection = npc.direction; + npc.rotation = (npc.rotation * rotationMult + npc.velocity.X * rotationAmt * 1.25f) / 10f; + + // Fly to target if target is too far away, otherwise get close to target and then slow down + Vector2 follyFlyTargetDirection = player.Center - npc.Center; + follyFlyTargetDirection.Y -= 200f; + if (follyFlyTargetDirection.Length() > 2800f) + { + npc.TargetClosest(); + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + } + else if (follyFlyTargetDirection.Length() > 240f) + { + float follyFlySpeed = 12f + (enrageScale - 1f) * 6f; + float follyFlyVelocityMult = 30f; + follyFlyTargetDirection.Normalize(); + follyFlyTargetDirection *= follyFlySpeed; + npc.velocity = (npc.velocity * (follyFlyVelocityMult - 1f) + follyFlyTargetDirection) / follyFlyVelocityMult; + } + else if (npc.velocity.Length() > 2f) + npc.velocity *= 0.95f; + else if (npc.velocity.Length() < 1f) + npc.velocity *= 1.05f; + + // Phase switch + npc.ai[1] += 1f; + if (npc.ai[1] >= 30f) + { + npc.ai[1] = 0f; + npc.ai[2] = 0f; + + while (npc.ai[0] == 0f) + { + if (phase2) + npc.localAI[0] += 1f; + + if (npc.localAI[0] >= (phase3 ? 7 : 9)) + { + npc.TargetClosest(); + npc.ai[0] = 5f; + npc.localAI[0] = 0f; + + // Decrease the feather variable, feathers can be used again if it's at 0 + if (npc.ai[3] > 0f) + npc.ai[3] -= 1f; + + // Decrease enraged attacks by 1 + if (npc.localAI[2] > 0f) + npc.localAI[2] -= 1f; + + // Decrease amount of attacks until able to spawn small birbs again + if (npc.localAI[3] > 0f) + npc.localAI[3] -= 1f; + } + else + { + int follyAttackPicker = phase2 ? Main.rand.Next(2) + 1 : Main.rand.Next(3); + if (phase3) + follyAttackPicker = 1; + + float featherVelocity = 2f + (enrageScale - 1f); + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + + if (follyAttackPicker == 0 && npc.localAI[3] == 0f) + { + npc.TargetClosest(); + npc.ai[0] = 2f; + + // Decrease the feather variable, feathers can be used again if it's at 0 + if (npc.ai[3] > 0f) + npc.ai[3] -= 1f; + + // Decrease enraged attacks by 1 + if (npc.localAI[2] > 0f) + npc.localAI[2] -= 1f; + + // Birb will do at least 1 different attack before entering this phase again + npc.localAI[3] = 1f; + } + else if (follyAttackPicker == 1) + { + npc.TargetClosest(); + npc.ai[0] = 3f; + + // Decrease enraged attacks by 1 + if (npc.localAI[2] > 0f) + npc.localAI[2] -= 1f; + + // Decrease amount of attacks until able to use other attacks again + if (npc.localAI[3] > 0f) + npc.localAI[3] -= 1f; + + if (phase2 && npc.ai[3] == 0f) + { + npc.ai[3] = 3f; + SoundEngine.PlaySound(SoundID.Item102, player.Center); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int totalProjectiles = 40; + float radians = MathHelper.TwoPi / totalProjectiles; + int distance = 800; + bool spawnRight = player.velocity.X > 0f; + for (int i = 0; i < totalProjectiles; i++) + { + if (Main.getGoodWorld) + { + if (i >= (int)(totalProjectiles * 0.125) && i <= (int)(totalProjectiles * 0.375)) + { + Vector2 spawnVector = player.Center + Vector2.Normalize(new Vector2(0f, -featherVelocity).RotatedBy(radians * i)) * distance; + Vector2 velocity = Vector2.Normalize(player.Center - spawnVector) * featherVelocity; + Projectile.NewProjectile(npc.GetSource_FromAI(), spawnVector, velocity, type, damage, 0f, Main.myPlayer); + } + if (i >= (int)(totalProjectiles * 0.625) && i <= (int)(totalProjectiles * 0.875)) + { + Vector2 spawnVector = player.Center + Vector2.Normalize(new Vector2(0f, -featherVelocity).RotatedBy(radians * i)) * distance; + Vector2 velocity = Vector2.Normalize(player.Center - spawnVector) * featherVelocity; + Projectile.NewProjectile(npc.GetSource_FromAI(), spawnVector, velocity, type, damage, 0f, Main.myPlayer); + } + } + else + { + if (spawnRight) + { + if (i >= (int)(totalProjectiles * 0.125) && i <= (int)(totalProjectiles * 0.375)) + { + Vector2 spawnVector = player.Center + Vector2.Normalize(new Vector2(0f, -featherVelocity).RotatedBy(radians * i)) * distance; + Vector2 velocity = Vector2.Normalize(player.Center - spawnVector) * featherVelocity; + Projectile.NewProjectile(npc.GetSource_FromAI(), spawnVector, velocity, type, damage, 0f, Main.myPlayer); + } + } + else + { + if (i >= (int)(totalProjectiles * 0.625) && i <= (int)(totalProjectiles * 0.875)) + { + Vector2 spawnVector = player.Center + Vector2.Normalize(new Vector2(0f, -featherVelocity).RotatedBy(radians * i)) * distance; + Vector2 velocity = Vector2.Normalize(player.Center - spawnVector) * featherVelocity; + Projectile.NewProjectile(npc.GetSource_FromAI(), spawnVector, velocity, type, damage, 0f, Main.myPlayer); + } + } + } + } + } + } + else + { + // Decrease the feather variable, feathers can be used again if it's at 0 + if (npc.ai[3] > 0f) + npc.ai[3] -= 1f; + } + } + else if (NPC.CountNPCS(ModContent.NPCType()) < maxBirbs && npc.localAI[3] == 0f) + { + npc.TargetClosest(); + npc.ai[0] = 4f; + + // Birb will do at least 2 different attacks before entering this phase again + npc.localAI[3] = 2f; + + // Decrease enraged attacks by 1 + if (npc.localAI[2] > 0f) + npc.localAI[2] -= 1f; + + if (npc.ai[3] == 0f) + { + npc.ai[3] = 3f; + SoundEngine.PlaySound(SoundID.Item102, player.Center); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int totalProjectiles = phase2 ? 40 : 48; + + if (Main.getGoodWorld) + totalProjectiles *= 2; + + float radians = MathHelper.TwoPi / totalProjectiles; + int distance = phase2 ? 1200 : 1320; + + if (Main.getGoodWorld) + distance *= 2; + + bool spawnRight = player.velocity.X > 0f; + for (int i = 0; i < totalProjectiles; i++) + { + if (spawnRight) + { + if (i >= totalProjectiles / 2) + break; + + Vector2 spawnVector = player.Center + Vector2.Normalize(new Vector2(0f, -featherVelocity).RotatedBy(radians * i)) * distance; + Vector2 velocity = Vector2.Normalize(player.Center - spawnVector) * featherVelocity; + Projectile.NewProjectile(npc.GetSource_FromAI(), spawnVector, velocity, type, damage, 0f, Main.myPlayer); + } + else + { + if (i >= totalProjectiles / 2) + { + Vector2 spawnVector = player.Center + Vector2.Normalize(new Vector2(0f, -featherVelocity).RotatedBy(radians * i)) * distance; + Vector2 velocity = Vector2.Normalize(player.Center - spawnVector) * featherVelocity; + Projectile.NewProjectile(npc.GetSource_FromAI(), spawnVector, velocity, type, damage, 0f, Main.myPlayer); + } + } + } + } + } + else + { + // Decrease the feather variable, feathers can be used again if it's at 0 + if (npc.ai[3] > 0f) + npc.ai[3] -= 1f; + } + } + } + } + + npc.netUpdate = true; + + // Prevent netUpdate from being blocked by the spam counter. + if (npc.netSpam >= 10) + npc.netSpam = 9; + + npc.SyncExtraAI(); + } + } + + // Fly to target + else if (npc.ai[0] == 1f) + { + // Avoid cheap bullshit + npc.damage = 0; + + if (npc.velocity.X < 0f) + npc.direction = -1; + else if (npc.velocity.X > 0f) + npc.direction = 1; + + npc.spriteDirection = npc.direction; + npc.rotation = (npc.rotation * rotationMult + npc.velocity.X * rotationAmt) / 10f; + + Vector2 follyTargetDirection = player.Center - npc.Center; + if (follyTargetDirection.Length() < 800f) + { + npc.TargetClosest(); + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + + npc.netUpdate = true; + + // Prevent netUpdate from being blocked by the spam counter. + if (npc.netSpam >= 10) + npc.netSpam = 9; + + npc.SyncExtraAI(); + } + + float velocity = 14f + (enrageScale - 1f) * 4f; + float follyTargetDistance = velocity + follyTargetDirection.Length() / 100f; + float follyVelocityMult = 25f; + follyTargetDirection.Normalize(); + follyTargetDirection *= follyTargetDistance; + npc.velocity = (npc.velocity * (follyVelocityMult - 1f) + follyTargetDirection) / follyVelocityMult; + } + + // Fly towards target quickly + else if (npc.ai[0] == 2f) + { + // Set reduced damage + npc.damage = reducedSetDamage; + + if (npc.target < 0 || !player.active || player.dead) + { + npc.TargetClosest(); + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + + npc.netUpdate = true; + + // Prevent netUpdate from being blocked by the spam counter. + if (npc.netSpam >= 10) + npc.netSpam = 9; + + npc.SyncExtraAI(); + } + + if (player.Center.X - 10f < npc.Center.X) + npc.direction = -1; + else if (player.Center.X + 10f > npc.Center.X) + npc.direction = 1; + + npc.spriteDirection = npc.direction; + npc.rotation = (npc.rotation * rotationMult * 0.5f + npc.velocity.X * rotationAmt * 1.25f) / 5f; + + Vector2 follyQuickFlyTargetDirection = player.Center - npc.Center; + follyQuickFlyTargetDirection.Y -= 20f; + npc.ai[2] += 0.0222222228f; + if (expertMode) + npc.ai[2] += 0.0166666675f; + + float velocity = 8f + (enrageScale - 1f) * 2f; + float follyQuickFlySpeed = velocity + npc.ai[2] + follyQuickFlyTargetDirection.Length() / 120f; + if (CalamityWorld.LegendaryMode && revenge) + follyQuickFlySpeed *= 2f; + + float follyQuickFlyVelMult = 20f; + follyQuickFlyTargetDirection.Normalize(); + follyQuickFlyTargetDirection *= follyQuickFlySpeed; + npc.velocity = (npc.velocity * (follyQuickFlyVelMult - 1f) + follyQuickFlyTargetDirection) / follyQuickFlyVelMult; + + npc.ai[1] += 1f; + if (npc.ai[1] >= ((CalamityWorld.LegendaryMode && revenge) ? 90f : 180f)) + { + npc.TargetClosest(); + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + + npc.netUpdate = true; + + // Prevent netUpdate from being blocked by the spam counter. + if (npc.netSpam >= 10) + npc.netSpam = 9; + + npc.SyncExtraAI(); + } + } + + // Line up charge + else if (npc.ai[0] == 3f) + { + // Avoid cheap bullshit + npc.damage = 0; + + if (npc.velocity.X < 0f) + npc.direction = -1; + else + npc.direction = 1; + + npc.spriteDirection = npc.direction; + npc.rotation = (npc.rotation * rotationMult * 0.5f + npc.velocity.X * rotationAmt * 0.85f) / 5f; + + Vector2 follyLineUpTargetDirection = player.Center - npc.Center; + follyLineUpTargetDirection.Y -= 12f; + if (npc.Center.X > player.Center.X) + follyLineUpTargetDirection.X += chargeDistance; + else + follyLineUpTargetDirection.X -= chargeDistance; + + float verticalDistanceGateValue = (phase3 ? 100f : 20f) + (enrageScale - 1f) * 20f; + if (Math.Abs(npc.Center.X - player.Center.X) > chargeDistance - 50f && Math.Abs(npc.Center.Y - player.Center.Y) < verticalDistanceGateValue) + { + npc.ai[0] = 3.1f; + npc.ai[1] = 0f; + + npc.netUpdate = true; + + // Prevent netUpdate from being blocked by the spam counter. + if (npc.netSpam >= 10) + npc.netSpam = 9; + + npc.SyncExtraAI(); + } + + npc.ai[1] += 0.0333333351f; + float velocity = 16f + (enrageScale - 1f) * 4f; + float follyLineUpSpeed = velocity + npc.ai[1]; + float follyLineUpVelMult = 4f; + follyLineUpTargetDirection.Normalize(); + follyLineUpTargetDirection *= follyLineUpSpeed; + npc.velocity = (npc.velocity * (follyLineUpVelMult - 1f) + follyLineUpTargetDirection) / follyLineUpVelMult; + } + + // Prepare to charge + else if (npc.ai[0] == 3.1f) + { + // Avoid cheap bullshit + npc.damage = 0; + + npc.rotation = (npc.rotation * rotationMult * 0.5f + npc.velocity.X * rotationAmt * 0.85f) / 5f; + + Vector2 follyChargePrepareTargetDirection = player.Center - npc.Center; + follyChargePrepareTargetDirection.Y -= 12f; + float follyChargePrepareSpeed = 28f + (enrageScale - 1f) * 4f; + float follyChargePrepareVelMult = 8f; + follyChargePrepareTargetDirection.Normalize(); + follyChargePrepareTargetDirection *= follyChargePrepareSpeed; + npc.velocity = (npc.velocity * (follyChargePrepareVelMult - 1f) + follyChargePrepareTargetDirection) / follyChargePrepareVelMult; + + if (npc.velocity.X < 0f) + npc.direction = -1; + else + npc.direction = 1; + + npc.spriteDirection = npc.direction; + + npc.ai[1] += 1f; + if (npc.ai[1] > 10f) + { + // Set damage + npc.damage = npc.defDamage; + + npc.velocity = follyChargePrepareTargetDirection; + + if (npc.velocity.X < 0f) + npc.direction = -1; + else + npc.direction = 1; + + npc.ai[0] = 3.2f; + npc.ai[1] = npc.direction; + + npc.netUpdate = true; + + // Prevent netUpdate from being blocked by the spam counter. + if (npc.netSpam >= 10) + npc.netSpam = 9; + + npc.SyncExtraAI(); + } + } + + // Charge + else if (npc.ai[0] == 3.2f) + { + // Set damage + npc.damage = npc.defDamage; + + npc.ai[2] += 0.0333333351f; + float velocity = 28f + (enrageScale - 1f) * 4f; + npc.velocity.X = (velocity + npc.ai[2]) * npc.ai[1]; + + if ((npc.ai[1] > 0f && npc.Center.X > player.Center.X + (chargeDistance - 140f)) || (npc.ai[1] < 0f && npc.Center.X < player.Center.X - (chargeDistance - 140f))) + { + if (!Collision.SolidCollision(npc.position, npc.width, npc.height)) + { + npc.TargetClosest(); + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + + npc.netUpdate = true; + + // Prevent netUpdate from being blocked by the spam counter. + if (npc.netSpam >= 10) + npc.netSpam = 9; + } + else if (Math.Abs(npc.Center.X - player.Center.X) > chargeDistance + 200f) + { + npc.TargetClosest(); + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + + npc.netUpdate = true; + + // Prevent netUpdate from being blocked by the spam counter. + if (npc.netSpam >= 10) + npc.netSpam = 9; + } + } + + npc.rotation = (npc.rotation * rotationMult * 0.5f + npc.velocity.X * rotationAmt * 0.85f) / 5f; + } + + // Birb spawn + else if (npc.ai[0] == 4f) + { + // Avoid cheap bullshit + npc.damage = 0; + + if (npc.ai[1] == 0f) + { + Vector2 destination2 = player.Center + new Vector2(0f, -200f); + Vector2 desiredVelocity2 = npc.SafeDirectionTo(destination2, -Vector2.UnitY) * 18f; + npc.SimpleFlyMovement(desiredVelocity2, 1.5f); + + if (npc.velocity.X < 0f) + npc.direction = -1; + else + npc.direction = 1; + + npc.spriteDirection = npc.direction; + + npc.ai[2] += 1f; + if (npc.Distance(player.Center) < 600f || npc.ai[2] >= 180f) + { + npc.ai[1] = 1f; + + npc.netUpdate = true; + + // Prevent netUpdate from being blocked by the spam counter. + if (npc.netSpam >= 10) + npc.netSpam = 9; + } + } + else + { + if (npc.ai[1] < 90f) + npc.velocity *= 0.95f; + else + npc.velocity *= 0.98f; + + if (npc.ai[1] == 90f) + { + if (npc.velocity.Y > 0f) + npc.velocity.Y /= 3f; + + npc.velocity.Y -= 3f; + } + + // Sound + if (npc.ai[1] == birbSpawnPhaseTimer - 60f) + { + float squawkpitch = Main.zenithWorld ? 1.3f : 0.25f; + SoundEngine.PlaySound(SoundID.DD2_BetsyScream with { Pitch = squawkpitch }, npc.Center); + + if (Main.zenithWorld) + { + int spacing = 30; + int amt = 3; + SoundEngine.PlaySound(CommonCalamitySounds.LightningSound, npc.Center - Vector2.UnitY * 300f); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + for (int i = 0; i < amt; i++) + { + Vector2 fireFrom = new Vector2(npc.Center.X + (spacing * i) - (spacing * amt / 2), npc.Center.Y - 900f); + Vector2 ai0 = npc.Center - fireFrom; + float ai = Main.rand.Next(100); + Vector2 velocity = Vector2.Normalize(ai0.RotatedByRandom(MathHelper.PiOver4)) * 7f; + Projectile.NewProjectile(npc.GetSource_FromAI(), fireFrom.X, fireFrom.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), npc.damage, 0f, Main.myPlayer, ai0.ToRotation(), ai); + } + } + } + } + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + bool gfbSpawnFlag = CalamityWorld.LegendaryMode && revenge && (npc.ai[1] == 145f || npc.ai[1] == 150f || npc.ai[1] == 160f || npc.ai[1] == 165f); + bool spawnFlag = NPC.CountNPCS(ModContent.NPCType()) < maxBirbs && (npc.ai[1] == 140f || (revenge && npc.ai[1] == 155f) || npc.ai[1] == 170f || gfbSpawnFlag); + if (spawnFlag) + { + Vector2 follySpawnCenter = npc.Center + (MathHelper.TwoPi * Main.rand.NextFloat()).ToRotationVector2() * new Vector2(2f, 1f) * 50f * (0.6f + Main.rand.NextFloat() * 0.4f); + if (Vector2.Distance(follySpawnCenter, player.Center) > 150f) + NPC.NewNPC(npc.GetSource_FromAI(), (int)follySpawnCenter.X, (int)follySpawnCenter.Y, ModContent.NPCType(), npc.whoAmI); + + npc.netUpdate = true; + + // Prevent netUpdate from being blocked by the spam counter. + if (npc.netSpam >= 10) + npc.netSpam = 9; + } + } + + npc.ai[1] += 1f; + } + + if (npc.ai[1] >= birbSpawnPhaseTimer) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.TargetClosest(); + + npc.netUpdate = true; + + // Prevent netUpdate from being blocked by the spam counter. + if (npc.netSpam >= 10) + npc.netSpam = 9; + } + } + + // Spit homing aura sphere + else if (npc.ai[0] == 5f) + { + // Avoid cheap bullshit + npc.damage = 0; + + // Velocity + npc.velocity *= 0.98f; + npc.rotation = (npc.rotation * rotationMult + npc.velocity.X * rotationAmt) / 10f; + + // Play sound + float aiGateValue = 120f; + if (npc.ai[1] == aiGateValue - 30f) + { + SoundEngine.PlaySound(SoundID.DD2_BetsyFireballShot, npc.Center); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Vector2 follySpawnCenter = npc.rotation.ToRotationVector2() * (Vector2.UnitX * npc.direction) * (npc.width + 20) / 2f + npc.Center; + float ai0 = (phase3 ? 2f : 0f) + (enrageScale - 1f); + if (ai0 > 3f) + ai0 = 3f; + + Projectile.NewProjectile(npc.GetSource_FromAI(), follySpawnCenter.X, follySpawnCenter.Y, 0f, 0f, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, ai0, npc.target + 1); + + npc.netUpdate = true; + + // Prevent netUpdate from being blocked by the spam counter. + if (npc.netSpam >= 10) + npc.netSpam = 9; + } + + if (Main.zenithWorld) + { + int spacing = 30; + int amt = 3; + SoundEngine.PlaySound(CommonCalamitySounds.LightningSound, npc.Center - Vector2.UnitY * 300f); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + for (int i = 0; i < amt; i++) + { + Vector2 fireFrom = new Vector2(npc.Center.X + (spacing * i) - (spacing * amt / 2), npc.Center.Y - 900f); + Vector2 ai0 = npc.Center - fireFrom; + float ai = Main.rand.Next(100); + Vector2 velocity = Vector2.Normalize(ai0.RotatedByRandom(MathHelper.PiOver4)) * 7f; + Projectile.NewProjectile(npc.GetSource_FromAI(), fireFrom.X, fireFrom.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), npc.damage, 0f, Main.myPlayer, ai0.ToRotation(), ai); + } + } + } + } + + npc.ai[1] += 1f; + if (npc.ai[1] >= aiGateValue) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + + npc.netUpdate = true; + + // Prevent netUpdate from being blocked by the spam counter. + if (npc.netSpam >= 10) + npc.netSpam = 9; + } + } + } + + public static void VanillaBumblebirb2AI(NPC npc, Mod mod, bool bossMinion) + { + Player player = Main.player[npc.target]; + + float rotationMult = 4f; + float rotationAmt = 0.04f; + + if (Vector2.Distance(player.Center, npc.Center) > 5600f) + { + if (npc.timeLeft > 5) + npc.timeLeft = 5; + } + + npc.rotation = (npc.rotation * rotationMult + npc.velocity.X * rotationAmt * 1.25f) / 10f; + + if (npc.ai[0] == 0f || npc.ai[0] == 1f) + { + for (int i = 0; i < Main.maxNPCs; i++) + { + if (i != npc.whoAmI && Main.npc[i].active && Main.npc[i].type == npc.type) + { + Vector2 otherSwarmerDirection = Main.npc[i].Center - npc.Center; + if (otherSwarmerDirection.Length() < (npc.width + npc.height)) + { + otherSwarmerDirection.Normalize(); + otherSwarmerDirection *= -0.1f; + npc.velocity += otherSwarmerDirection; + NPC nPC6 = Main.npc[i]; + nPC6.velocity -= otherSwarmerDirection; + } + } + } + } + + if (npc.target < 0 || Main.player[npc.target].dead || !Main.player[npc.target].active) + { + npc.TargetClosest(true); + Vector2 swarmerTargetDist = Main.player[npc.target].Center - npc.Center; + if (Main.player[npc.target].dead || swarmerTargetDist.Length() > (bossMinion ? 5600f : 2800f)) + npc.ai[0] = -1f; + } + else + { + Vector2 swarmerCatchUpTargetDist = Main.player[npc.target].Center - npc.Center; + if (npc.ai[0] > 1f && swarmerCatchUpTargetDist.Length() > 3600f) + npc.ai[0] = 1f; + } + + if (npc.ai[0] == -1f) + { + // Avoid cheap bullshit + npc.damage = 0; + + Vector2 swarmerDespawnVelMult = new Vector2(0f, -8f); + npc.velocity = (npc.velocity * 21f + swarmerDespawnVelMult) / 10f; + return; + } + + if (npc.ai[0] == 0f) + { + // Avoid cheap bullshit + npc.damage = 0; + + npc.TargetClosest(true); + npc.spriteDirection = npc.direction; + + Vector2 swarmerIdleTargetDist = Main.player[npc.target].Center - npc.Center; + if (swarmerIdleTargetDist.Length() > 2800f) + { + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + } + else if (swarmerIdleTargetDist.Length() > 400f) + { + float swarmerIdleSpeed = (bossMinion ? 9f : 7f) + swarmerIdleTargetDist.Length() / 100f + npc.ai[1] / 15f; + swarmerIdleTargetDist.Normalize(); + swarmerIdleTargetDist *= swarmerIdleSpeed; + npc.velocity = (npc.velocity * 29f + swarmerIdleTargetDist) / 30f; + if (Main.getGoodWorld && !Main.zenithWorld) + npc.velocity *= 1.15f; + } + else if (npc.velocity.Length() > 2f) + npc.velocity *= 0.95f; + else if (npc.velocity.Length() < 1f) + npc.velocity *= 1.05f; + + npc.ai[1] += 1f; + if (npc.ai[1] >= (bossMinion ? 90f : 105f)) + { + npc.ai[1] = 0f; + npc.ai[0] = 2f; + } + } + else + { + if (npc.ai[0] == 1f) + { + // Avoid cheap bullshit + npc.damage = 0; + + if (npc.target < 0 || !Main.player[npc.target].active || Main.player[npc.target].dead) + npc.TargetClosest(true); + + if (npc.velocity.X < 0f) + npc.direction = -1; + else if (npc.velocity.X > 0f) + npc.direction = 1; + + npc.spriteDirection = npc.direction; + npc.rotation = (npc.rotation * rotationMult + npc.velocity.X * rotationAmt) / 10f; + + Vector2 swarmerChargeTargetDist = Main.player[npc.target].Center - npc.Center; + if (swarmerChargeTargetDist.Length() < 800f && !Collision.SolidCollision(npc.position, npc.width, npc.height)) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + } + + npc.ai[2] += 0.0166666675f; + float swarmerChargeSpeed = (bossMinion ? 12f : 9f) + npc.ai[2] + swarmerChargeTargetDist.Length() / 150f; + float swarmerChargeVelMult = 25f; + swarmerChargeTargetDist.Normalize(); + swarmerChargeTargetDist *= swarmerChargeSpeed; + npc.velocity = (npc.velocity * (swarmerChargeVelMult - 1f) + swarmerChargeTargetDist) / swarmerChargeVelMult; + if (Main.getGoodWorld && !Main.zenithWorld) + npc.velocity *= 1.15f; + + npc.netSpam = 5; + if (Main.netMode == NetmodeID.Server) + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, npc.whoAmI, 0f, 0f, 0f, 0, 0, 0); + + return; + } + + if (npc.ai[0] == 2f) + { + // Avoid cheap bullshit + npc.damage = 0; + + if (npc.velocity.X < 0f) + npc.direction = -1; + else if (npc.velocity.X > 0f) + npc.direction = 1; + + npc.spriteDirection = npc.direction; + npc.rotation = (npc.rotation * rotationMult * 0.75f + npc.velocity.X * rotationAmt * 1.25f) / 8f; + + Vector2 swarmerDecelerateTargetDist = Main.player[npc.target].Center - npc.Center; + swarmerDecelerateTargetDist.Y -= 8f; + float swarmerDecelerateSpeed = bossMinion ? 18f : 14f; + float swarmerDecelerateVelMult = 8f; + swarmerDecelerateTargetDist.Normalize(); + swarmerDecelerateTargetDist *= swarmerDecelerateSpeed; + npc.velocity = (npc.velocity * (swarmerDecelerateVelMult - 1f) + swarmerDecelerateTargetDist) / swarmerDecelerateVelMult; + if (Main.getGoodWorld && !Main.zenithWorld) + npc.velocity *= 1.15f; + + if (npc.velocity.X < 0f) + npc.direction = -1; + else + npc.direction = 1; + + npc.spriteDirection = npc.direction; + + npc.ai[1] += 1f; + if (npc.ai[1] > 10f) + { + // Set damage + npc.damage = npc.defDamage; + + npc.velocity = swarmerDecelerateTargetDist; + if (Main.getGoodWorld && !Main.zenithWorld) + npc.velocity *= 1.15f; + + if (npc.velocity.X < 0f) + npc.direction = -1; + else + npc.direction = 1; + + npc.ai[0] = 2.1f; + npc.ai[1] = 0f; + } + } + else if (npc.ai[0] == 2.1f) + { + // Set damage + npc.damage = npc.defDamage; + + if (npc.velocity.X < 0f) + npc.direction = -1; + else if (npc.velocity.X > 0f) + npc.direction = 1; + + npc.spriteDirection = npc.direction; + + npc.velocity *= 1.01f; + + npc.ai[1] += 1f; + if (npc.ai[1] > 30f) + { + if (!Collision.SolidCollision(npc.position, npc.width, npc.height)) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + return; + } + + if (npc.ai[1] > 60f) + { + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + } + } + } + } + } + } +} diff --git a/NPCs/CalamityAIs/CalamityBossAIs/CalamitasCloneAI.cs b/NPCs/CalamityAIs/CalamityBossAIs/CalamitasCloneAI.cs new file mode 100644 index 0000000000..2551962926 --- /dev/null +++ b/NPCs/CalamityAIs/CalamityBossAIs/CalamitasCloneAI.cs @@ -0,0 +1,1383 @@ +using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.CalPlayer; +using CalamityMod.Dusts; +using CalamityMod.Events; +using CalamityMod.NPCs.Abyss; +using CalamityMod.NPCs.AquaticScourge; +using CalamityMod.NPCs.AstrumAureus; +using CalamityMod.NPCs.AstrumDeus; +using CalamityMod.NPCs.BrimstoneElemental; +using CalamityMod.NPCs.Bumblebirb; +using CalamityMod.NPCs.CalClone; +using CalamityMod.NPCs.CeaselessVoid; +using CalamityMod.NPCs.Crags; +using CalamityMod.NPCs.NormalNPCs; +using CalamityMod.NPCs.OldDuke; +using CalamityMod.NPCs.SulphurousSea; +using CalamityMod.NPCs.SunkenSea; +using CalamityMod.Projectiles.Boss; +using CalamityMod.Projectiles.Enemy; +using CalamityMod.Sounds; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs +{ + public static class CalamitasCloneAI + { + public static void VanillaCalamitasCloneAI(NPC npc, Mod mod) + { + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + + // Emit light + Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 1f, 0f, 0f); + + // Variables for increasing difficulty + bool bossRush = BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || bossRush; + bool revenge = CalamityWorld.revenge || bossRush; + bool expertMode = Main.expertMode || bossRush; + + // Percent life remaining + float lifeRatio = npc.life / (float)npc.lifeMax; + + // Phases + bool phase2 = lifeRatio < 0.7f || death; + bool phase3 = lifeRatio < 0.35f; + bool phase4 = lifeRatio <= 0.1f && death; + + // Don't take damage during bullet hells + npc.dontTakeDamage = calamityGlobalNPC.newAI[2] > 0f; + + // Variable for live brothers + bool brotherAlive = false; + + // For seekers + CalamityGlobalNPC.calamitas = npc.whoAmI; + + // Seeker ring + if (calamityGlobalNPC.newAI[1] == 0f && phase3 && expertMode) + { + SoundEngine.PlaySound(SoundID.Item72, npc.Center); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int seekerAmt = death ? 10 : 5; + int seekerSpread = 360 / seekerAmt; + int seekerDistance = death ? 180 : 150; + for (int i = 0; i < seekerAmt; i++) + { + int spawn = NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(i * seekerSpread) * seekerDistance)), (int)(npc.Center.Y + (Math.Cos(i * seekerSpread) * seekerDistance)), ModContent.NPCType(), npc.whoAmI, 0, 0, 0, -1); + Main.npc[spawn].ai[0] = i * seekerSpread; + } + } + + string key = "Mods.CalamityMod.Status.Boss.CalamitasBossText3"; + Color messageColor = Color.Orange; + CalamityUtils.DisplayLocalizedText(key, messageColor); + + calamityGlobalNPC.newAI[1] = 1f; + } + + // Do bullet hell or spawn brothers + if (calamityGlobalNPC.newAI[0] == 0f && npc.life > 0) + calamityGlobalNPC.newAI[0] = npc.lifeMax; + + // Bullet hells at 70% and 10%, brothers at 40% + if (npc.life > 0) + { + int calClonePhaseThreshold = (int)(npc.lifeMax * 0.3); + if ((npc.life + calClonePhaseThreshold) < calamityGlobalNPC.newAI[0]) + { + calamityGlobalNPC.newAI[0] = npc.life; + if (calamityGlobalNPC.newAI[0] <= npc.lifeMax * 0.1) + { + SoundEngine.PlaySound(SoundID.Item109, npc.Center); + calamityGlobalNPC.newAI[2] = 2f; + + if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + calamityGlobalNPC.newAI[3] = 0f; + + SpawnDust(); + } + else if (calamityGlobalNPC.newAI[0] <= npc.lifeMax * 0.4) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.position.Y + npc.height, ModContent.NPCType(), npc.whoAmI); + NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.position.Y + npc.height, ModContent.NPCType(), npc.whoAmI); + } + + string key = "Mods.CalamityMod.Status.Boss.CalamitasBossText2"; + Color messageColor = Color.Orange; + CalamityUtils.DisplayLocalizedText(key, messageColor); + + SpawnDust(); + } + else + { + SoundEngine.PlaySound(SoundID.Item109, npc.Center); + calamityGlobalNPC.newAI[2] = 1f; + + if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + calamityGlobalNPC.newAI[3] = 0f; + + SpawnDust(); + } + } + } + + // Immunity if brothers are alive + if (CalamityGlobalNPC.cataclysm != -1) + { + if (Main.npc[CalamityGlobalNPC.cataclysm].active) + brotherAlive = true; + } + if (CalamityGlobalNPC.catastrophe != -1) + { + if (Main.npc[CalamityGlobalNPC.catastrophe].active) + brotherAlive = true; + } + + if (brotherAlive) + npc.dontTakeDamage = true; + + void SpawnDust() + { + int dustAmt = 50; + int random = 3; + + for (int j = 0; j < 10; j++) + { + random += j; + int dustAmtSpawned = 0; + int scale = random * 6; + float dustPositionX = npc.Center.X - (scale / 2); + float dustPositionY = npc.Center.Y - (scale / 2); + while (dustAmtSpawned < dustAmt) + { + float dustVelocityX = Main.rand.Next(-random, random); + float dustVelocityY = Main.rand.Next(-random, random); + float dustVelocityScalar = random * 2f; + float dustVelocity = (float)Math.Sqrt(dustVelocityX * dustVelocityX + dustVelocityY * dustVelocityY); + dustVelocity = dustVelocityScalar / dustVelocity; + dustVelocityX *= dustVelocity; + dustVelocityY *= dustVelocity; + int dust = Dust.NewDust(new Vector2(dustPositionX, dustPositionY), scale, scale, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); + Main.dust[dust].noGravity = true; + Main.dust[dust].position.X = npc.Center.X; + Main.dust[dust].position.Y = npc.Center.Y; + Main.dust[dust].position.X += Main.rand.Next(-10, 11); + Main.dust[dust].position.Y += Main.rand.Next(-10, 11); + Main.dust[dust].velocity.X = dustVelocityX; + Main.dust[dust].velocity.Y = dustVelocityY; + dustAmtSpawned++; + } + } + } + + // Get a target + 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]; + + float enrageScale = bossRush ? 1f : 0f; + if (Main.IsItDay() || bossRush) + { + npc.Calamity().CurrentlyEnraged = !bossRush; + enrageScale += 2f; + } + + // Rotation + Vector2 npcCenter = new Vector2(npc.Center.X, npc.position.Y + npc.height - 59f); + Vector2 lookAt = new Vector2(player.position.X - (player.width / 2), player.position.Y - (player.height / 2)); + Vector2 rotationVector = npcCenter - lookAt; + + // Boss Rush predictive charge rotation + if (npc.ai[1] == 4f && phase4 && bossRush) + { + // Velocity + float chargeVelocity = 30f; + chargeVelocity += 5f * enrageScale; + lookAt += Main.player[npc.target].velocity * 20f; + rotationVector = Vector2.Normalize(npcCenter - lookAt) * chargeVelocity; + } + + float rotation = (float)Math.Atan2(rotationVector.Y, rotationVector.X) + MathHelper.PiOver2; + if (rotation < 0f) + rotation += MathHelper.TwoPi; + else if (rotation > MathHelper.TwoPi) + rotation -= MathHelper.TwoPi; + + float rotationAmt = 0.1f; + if (npc.rotation < rotation) + { + if ((rotation - npc.rotation) > MathHelper.Pi) + npc.rotation -= rotationAmt; + else + npc.rotation += rotationAmt; + } + else if (npc.rotation > rotation) + { + if ((npc.rotation - rotation) > MathHelper.Pi) + npc.rotation += rotationAmt; + else + npc.rotation -= rotationAmt; + } + + if (npc.rotation > rotation - rotationAmt && npc.rotation < rotation + rotationAmt) + npc.rotation = rotation; + if (npc.rotation < 0f) + npc.rotation += MathHelper.TwoPi; + else if (npc.rotation > MathHelper.TwoPi) + npc.rotation -= MathHelper.TwoPi; + if (npc.rotation > rotation - rotationAmt && npc.rotation < rotation + rotationAmt) + npc.rotation = rotation; + + // Despawn + if (!player.active || player.dead) + { + npc.TargetClosest(false); + player = Main.player[npc.target]; + if (!player.active || player.dead) + { + if (npc.velocity.Y > 3f) + npc.velocity.Y = 3f; + npc.velocity.Y -= 0.1f; + if (npc.velocity.Y < -12f) + npc.velocity.Y = -12f; + + if (npc.timeLeft > 60) + npc.timeLeft = 60; + + if (npc.ai[1] != 0f) + { + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + calamityGlobalNPC.newAI[3] = 0f; + npc.alpha = 0; + npc.netUpdate = true; + } + return; + } + } + else if (npc.timeLeft < 1800) + npc.timeLeft = 1800; + + // Distance from destination where Cal Clone stops moving + float movementDistanceGateValue = 100f; + + // How fast Cal Clone moves to the destination + float baseVelocity = (expertMode ? 10f : 8.5f) * (npc.ai[1] == 4f ? 1.4f : 1f); + float baseAcceleration = (expertMode ? 0.18f : 0.155f) * (npc.ai[1] == 4f ? 1.4f : 1f); + baseVelocity += 4f * enrageScale; + baseAcceleration += 0.1f * enrageScale; + if (revenge) + { + baseVelocity += 1.5f * (1f - lifeRatio); + baseAcceleration += 0.03f * (1f - lifeRatio); + } + if (death) + { + baseVelocity += 1.5f * (1f - lifeRatio); + baseAcceleration += 0.03f * (1f - lifeRatio); + } + if (Main.getGoodWorld) + { + baseVelocity *= 1.15f; + baseAcceleration *= 1.15f; + } + + // What side Cal Clone should be on, relative to the target + int xPos = 1; + if (npc.Center.X < player.Center.X) + xPos = -1; + + // How far Cal Clone should be from the target + float averageDistance = 500f; + float chargeDistance = phase4 ? 300f : 400f; + + // This is where Cal Clone should be + Vector2 destination = (calamityGlobalNPC.newAI[2] > 0f || npc.ai[1] == 0f) ? new Vector2(player.Center.X, player.Center.Y - averageDistance) : + npc.ai[1] == 1f ? new Vector2(player.Center.X + averageDistance * xPos, player.Center.Y) : + new Vector2(player.Center.X + chargeDistance * xPos, player.Center.Y); + + // Add some random distance to the destination after certain attacks + if (npc.localAI[0] == 1f) + { + npc.localAI[0] = 0f; + npc.localAI[2] = Main.rand.Next(-50, 51); + npc.localAI[3] = Main.rand.Next(-300, 301); + npc.netUpdate = true; + } + + // Add a bit of randomness to the destination + if (death) + { + destination.X += npc.ai[1] == 0f ? npc.localAI[3] : npc.localAI[2]; + destination.Y += npc.ai[1] == 0f ? npc.localAI[2] : npc.localAI[3]; + } + + // How far Cal Clone is from where she's supposed to be + Vector2 distanceFromDestination = destination - npc.Center; + + // Movement + if (npc.ai[1] == 0f || npc.ai[1] == 1f || npc.ai[1] == 4f || calamityGlobalNPC.newAI[2] > 0f) + CalamityUtils.SmoothMovement(npc, movementDistanceGateValue, distanceFromDestination, baseVelocity, baseAcceleration, true); + + // Bullet hell phase + if (calamityGlobalNPC.newAI[2] > 0f) + { + // Avoid cheap bullshit + npc.damage = 0; + + if (calamityGlobalNPC.newAI[3] < 900f) + { + calamityGlobalNPC.newAI[3] += 1f; + npc.dontTakeDamage = true; + npc.alpha = 255; + + float rotX = player.Center.X - npc.Center.X; + float rotY = player.Center.Y - npc.Center.Y; + npc.rotation = (float)Math.Atan2(rotY, rotX) - MathHelper.PiOver2; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (calamityGlobalNPC.newAI[2] == 2f) + { + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + if (Main.zenithWorld) + type = ModContent.ProjectileType(); + + float gigaBlastFrequency = (Main.getGoodWorld ? 120f : expertMode ? 180f : 240f) - enrageScale * 15f; + float projSpeed = bossRush ? 6.25f : 5f; + if (calamityGlobalNPC.newAI[3] <= 300f) + { + if (calamityGlobalNPC.newAI[3] % gigaBlastFrequency == 0f) // Blasts from top + Projectile.NewProjectile(npc.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, projSpeed, type, damage, 0f, Main.myPlayer); + } + else if (calamityGlobalNPC.newAI[3] <= 600f && calamityGlobalNPC.newAI[3] > 300f) + { + if (calamityGlobalNPC.newAI[3] % gigaBlastFrequency == 0f) // Blasts from right + Projectile.NewProjectile(npc.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -projSpeed, 0f, type, damage, 0f, Main.myPlayer); + } + else if (calamityGlobalNPC.newAI[3] > 600f) + { + if (calamityGlobalNPC.newAI[3] % gigaBlastFrequency == 0f) // Blasts from top + Projectile.NewProjectile(npc.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, projSpeed, type, damage, 0f, Main.myPlayer); + } + } + } + + npc.ai[0] += 1f; + float hellblastGateValue = (expertMode ? 12f : 16f) - enrageScale; + if (npc.ai[0] >= hellblastGateValue) + { + npc.ai[0] = 0f; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + float projSpeed = bossRush ? 5f : 4f; + if (calamityGlobalNPC.newAI[3] % (hellblastGateValue * 6f) == 0f) + { + float distance = Main.rand.NextBool() ? -1000f : 1000f; + float velocity = distance == -1000f ? projSpeed : -projSpeed; + Projectile.NewProjectile(npc.GetSource_FromAI(), player.position.X + distance, player.position.Y, velocity, 0f, type, damage, 0f, Main.myPlayer, 2f, 0f); + } + + if (calamityGlobalNPC.newAI[3] < 300f) // Blasts from above + { + Projectile.NewProjectile(npc.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, projSpeed, type, damage, 0f, Main.myPlayer, 2f, 0f); + } + else if (calamityGlobalNPC.newAI[3] < 600f) // Blasts from left and right + { + Projectile.NewProjectile(npc.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -(projSpeed - 0.5f), 0f, type, damage, 0f, Main.myPlayer, 2f, 0f); + Projectile.NewProjectile(npc.GetSource_FromAI(), player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), projSpeed - 0.5f, 0f, type, damage, 0f, Main.myPlayer, 2f, 0f); + } + else // Blasts from above, left, and right + { + Projectile.NewProjectile(npc.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, projSpeed - 1f, type, damage, 0f, Main.myPlayer, 2f, 0f); + Projectile.NewProjectile(npc.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -(projSpeed - 1f), 0f, type, damage, 0f, Main.myPlayer, 2f, 0f); + Projectile.NewProjectile(npc.GetSource_FromAI(), player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), projSpeed - 1f, 0f, type, damage, 0f, Main.myPlayer, 2f, 0f); + } + } + } + } + else + { + npc.ai[0] = 0f; + npc.ai[3] = 0f; + npc.localAI[1] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + calamityGlobalNPC.newAI[3] = 0f; + + // Prevent bullshit charge hits when second bullet hell ends. + if (phase4) + { + npc.ai[1] = 4f; + npc.ai[2] = -105f; + npc.TargetClosest(); + } + else + { + if (death) + { + int AIState = Main.rand.Next(3); + switch (AIState) + { + case 0: + npc.ai[1] = 0f; + npc.ai[2] = 0f; + break; + case 1: + npc.ai[1] = 1f; + npc.ai[2] = 0f; + break; + case 2: + npc.ai[1] = 4f; + npc.ai[2] = -105f; + npc.TargetClosest(); + break; + } + } + else + { + npc.ai[1] = 0f; + npc.ai[2] = 0f; + } + + if (death) + npc.localAI[0] = 1f; + } + + npc.netUpdate = true; + + for (int x = 0; x < Main.maxProjectiles; x++) + { + Projectile projectile = Main.projectile[x]; + if (projectile.active) + { + if (projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType()) + { + if (projectile.timeLeft > 60) + projectile.timeLeft = 60; + } + else if (projectile.type == ModContent.ProjectileType()) + { + projectile.ai[2] = 1f; + + if (projectile.timeLeft > 60) + projectile.timeLeft = 60; + } + } + } + } + + return; + } + else if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + { + if (calamityGlobalNPC.newAI[3] < 900f) + calamityGlobalNPC.newAI[3] += 1f; + else + calamityGlobalNPC.newAI[3] = 0f; + + npc.ai[0] += 1f; + float hellblastGateValue = 30f - enrageScale; + if (npc.ai[0] >= hellblastGateValue) + { + npc.ai[0] = 0f; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + float projSpeed = bossRush ? 5f : 4f; + if (calamityGlobalNPC.newAI[3] % (hellblastGateValue * 6f) == 0f) + { + float distance = Main.rand.NextBool() ? -1000f : 1000f; + float velocity = distance == -1000f ? projSpeed : -projSpeed; + Projectile.NewProjectile(npc.GetSource_FromAI(), player.position.X + distance, player.position.Y, velocity, 0f, type, damage, 0f, Main.myPlayer, 2f, 0f); + } + + if (calamityGlobalNPC.newAI[3] < 300f) // Blasts from above + { + Projectile.NewProjectile(npc.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, projSpeed, type, damage, 0f, Main.myPlayer, 2f, 0f); + } + else if (calamityGlobalNPC.newAI[3] < 600f) // Blasts from left and right + { + Projectile.NewProjectile(npc.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -(projSpeed - 0.5f), 0f, type, damage, 0f, Main.myPlayer, 2f, 0f); + Projectile.NewProjectile(npc.GetSource_FromAI(), player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), projSpeed - 0.5f, 0f, type, damage, 0f, Main.myPlayer, 2f, 0f); + } + else // Blasts from above, left, and right + { + Projectile.NewProjectile(npc.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, projSpeed - 1f, type, damage, 0f, Main.myPlayer, 2f, 0f); + Projectile.NewProjectile(npc.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -(projSpeed - 1f), 0f, type, damage, 0f, Main.myPlayer, 2f, 0f); + Projectile.NewProjectile(npc.GetSource_FromAI(), player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), projSpeed - 1f, 0f, type, damage, 0f, Main.myPlayer, 2f, 0f); + } + } + } + } + + npc.alpha = npc.dontTakeDamage ? 255 : 0; + + // Float above target and fire lasers or fireballs + if (npc.ai[1] == 0f) + { + // Avoid cheap bullshit + npc.damage = 0; + + npc.ai[2] += 1f; + float phaseTimer = 400f - (death ? 120f * (1f - lifeRatio) : 0f); + if (npc.ai[2] >= phaseTimer || phase4) + { + if (death && !phase4 && Main.rand.NextBool() && !brotherAlive) + npc.ai[1] = 4f; + else + npc.ai[1] = 1f; + + npc.ai[2] = 0f; + if (death) + npc.localAI[0] = 1f; + + npc.TargetClosest(); + npc.netUpdate = true; + } + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.localAI[1] += 1f; + if (!brotherAlive) + { + if (expertMode) + npc.localAI[1] += death ? 2f * (1f - lifeRatio) : 1f - lifeRatio; + if (revenge) + npc.localAI[1] += 0.5f; + } + + if (npc.localAI[1] >= (brotherAlive ? 180f : 120f)) + { + npc.localAI[1] = 0f; + + float projectileVelocity = expertMode ? 14f : 12.5f; + projectileVelocity += 3f * enrageScale; + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + bool shootPredictiveShot = CalamityWorld.LegendaryMode && CalamityWorld.revenge && Main.rand.NextBool(); + Vector2 predictionVector = shootPredictiveShot ? player.velocity * 20f : Vector2.Zero; + Vector2 fireballVelocity = Vector2.Normalize(player.Center + predictionVector - npc.Center) * projectileVelocity; + Vector2 offset = Vector2.Normalize(fireballVelocity) * 40f; + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + offset, fireballVelocity, type, damage, 0f, Main.myPlayer, player.position.X, player.position.Y); + Main.projectile[proj].netUpdate = true; + } + } + } + + // Float to the side of the target and fire + else if (npc.ai[1] == 1f) + { + // Avoid cheap bullshit + npc.damage = 0; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.localAI[1] += 1f; + if (!brotherAlive) + { + if (revenge) + npc.localAI[1] += 0.5f; + if (expertMode) + npc.localAI[1] += 0.5f; + } + + if (npc.localAI[1] >= (brotherAlive ? 75f : 50f) && Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) + { + npc.localAI[1] = 0f; + + float projectileVelocity = expertMode ? 12.5f : 11f; + projectileVelocity += 3f * enrageScale; + int type = brotherAlive ? ModContent.ProjectileType() : ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + Vector2 fireballVelocity = Vector2.Normalize(player.Center - npc.Center) * projectileVelocity; + Vector2 offset = Vector2.Normalize(fireballVelocity) * 40f; + + if (!Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) + { + type = ModContent.ProjectileType(); + damage = npc.GetProjectileDamage(type); + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + offset, fireballVelocity, type, damage, 0f, Main.myPlayer, player.position.X, player.position.Y); + } + else + { + float ai0 = type == ModContent.ProjectileType() ? 1f : player.position.X; + float ai1 = type == ModContent.ProjectileType() ? 0f : player.position.Y; + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + offset, fireballVelocity, type, damage, 0f, Main.myPlayer, ai0, ai1); + } + } + } + + npc.ai[2] += 1f; + float phaseTimer = 240f - (death ? 60f * (1f - lifeRatio) : 0f); + if (npc.ai[2] >= phaseTimer || phase4) + { + if (death && !phase4 && Main.rand.NextBool() && !brotherAlive) + npc.ai[1] = 0f; + else + npc.ai[1] = !brotherAlive && phase2 && revenge ? 4f : 0f; + + npc.ai[2] = 0f; + if (death) + npc.localAI[0] = 1f; + + npc.TargetClosest(); + npc.netUpdate = true; + } + } + else if (npc.ai[1] == 2f) + { + // Set damage + npc.damage = npc.defDamage; + + npc.rotation = rotation; + + float chargeVelocity = phase4 ? 30f : death ? 28f : 25f; + chargeVelocity += 5f * enrageScale; + + Vector2 vector = Vector2.Normalize(player.Center + (phase4 && bossRush ? player.velocity * 20f : Vector2.Zero) - npc.Center); + npc.velocity = vector * chargeVelocity; + + npc.ai[1] = 3f; + npc.netUpdate = true; + } + else if (npc.ai[1] == 3f) + { + // Set damage + npc.damage = npc.defDamage; + + npc.ai[2] += 1f; + + float chargeTime = phase4 ? 35f : death ? 40f : 45f; + if (npc.ai[2] >= chargeTime) + { + // Avoid cheap bullshit + npc.damage = 0; + + npc.velocity *= 0.9f; + if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) + npc.velocity.X = 0f; + if (npc.velocity.Y > -0.1 && npc.velocity.Y < 0.1) + npc.velocity.Y = 0f; + } + else + { + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) - MathHelper.PiOver2; + + // Leave behind slow hellblasts in Death Mode + if (Main.netMode != NetmodeID.MultiplayerClient && death && phase3 && npc.ai[2] % (phase4 ? 6f : 10f) == 0f) + { + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + Vector2 fireballVelocity = CalamityWorld.LegendaryMode ? Main.rand.NextVector2CircularEdge(0.02f, 0.02f) : npc.velocity * 0.01f; + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, fireballVelocity, type, damage, 0f, Main.myPlayer, 1f, 0f); + } + } + + if (npc.ai[2] >= chargeTime + 10f) + { + if (!phase4) + npc.ai[3] += 1f; + + npc.ai[2] = 0f; + + npc.rotation = rotation; + npc.TargetClosest(); + npc.netUpdate = true; + + if (npc.ai[3] >= 2f) + { + npc.ai[1] = 0f; + npc.ai[3] = 0f; + return; + } + + npc.ai[1] = 4f; + } + } + else + { + // Avoid cheap bullshit + npc.damage = 0; + + npc.ai[2] += 1f; + if (npc.ai[2] >= (phase4 ? 15f : 30f)) + { + npc.TargetClosest(); + + npc.ai[1] = 2f; + npc.ai[2] = 0f; + if (death) + npc.localAI[0] = 1f; + + npc.netUpdate = true; + } + } + } + + public static void VanillaCataclysmAI(NPC npc, Mod mod) + { + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + + if (CalamityGlobalNPC.calamitas < 0 || !Main.npc[CalamityGlobalNPC.calamitas].active) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + npc.StrikeInstantKill(); + + return; + } + + // Percent life remaining + float lifeRatio = npc.life / (float)npc.lifeMax; + + CalamityGlobalNPC.cataclysm = npc.whoAmI; + + // Emit light + Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 1f, 0f, 0f); + + bool bossRush = BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || bossRush; + bool revenge = CalamityWorld.revenge || bossRush; + bool expertMode = Main.expertMode || bossRush; + + // Get a target + 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; + if (Main.IsItDay() || bossRush) + { + npc.Calamity().CurrentlyEnraged = !bossRush; + enrageScale += 2f; + } + + float calCloneBroPlayerXDist = npc.position.X + (npc.width / 2) - player.position.X - (player.width / 2); + float calCloneBroPlayerYDist = npc.position.Y + npc.height - 59f - player.position.Y - (player.height / 2); + float calCloneBroRotation = (float)Math.Atan2(calCloneBroPlayerYDist, calCloneBroPlayerXDist) + MathHelper.PiOver2; + if (calCloneBroRotation < 0f) + calCloneBroRotation += MathHelper.TwoPi; + else if (calCloneBroRotation > MathHelper.TwoPi) + calCloneBroRotation -= MathHelper.TwoPi; + + float calCloneBroRotationSpeed = 0.15f; + if (npc.rotation < calCloneBroRotation) + { + if ((calCloneBroRotation - npc.rotation) > MathHelper.Pi) + npc.rotation -= calCloneBroRotationSpeed; + else + npc.rotation += calCloneBroRotationSpeed; + } + else if (npc.rotation > calCloneBroRotation) + { + if ((npc.rotation - calCloneBroRotation) > MathHelper.Pi) + npc.rotation += calCloneBroRotationSpeed; + else + npc.rotation -= calCloneBroRotationSpeed; + } + + if (npc.rotation > calCloneBroRotation - calCloneBroRotationSpeed && npc.rotation < calCloneBroRotation + calCloneBroRotationSpeed) + npc.rotation = calCloneBroRotation; + if (npc.rotation < 0f) + npc.rotation += MathHelper.TwoPi; + else if (npc.rotation > MathHelper.TwoPi) + npc.rotation -= MathHelper.TwoPi; + if (npc.rotation > calCloneBroRotation - calCloneBroRotationSpeed && npc.rotation < calCloneBroRotation + calCloneBroRotationSpeed) + npc.rotation = calCloneBroRotation; + + if (!player.active || player.dead) + { + npc.TargetClosest(false); + player = Main.player[npc.target]; + if (!player.active || player.dead) + { + if (npc.velocity.Y > 3f) + npc.velocity.Y = 3f; + npc.velocity.Y -= 0.1f; + if (npc.velocity.Y < -12f) + npc.velocity.Y = -12f; + + if (npc.timeLeft > 60) + npc.timeLeft = 60; + + if (npc.ai[1] != 0f) + { + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.netUpdate = true; + } + + return; + } + } + + if (npc.ai[1] == 0f) + { + // Avoid cheap bullshit + npc.damage = (int)Math.Round(npc.defDamage * 0.5); + + float calCloneBroProjAttackMaxSpeed = 5f; + float calCloneBroProjAttackAccel = 0.1f; + calCloneBroProjAttackMaxSpeed += 2f * enrageScale; + calCloneBroProjAttackAccel += 0.06f * enrageScale; + + if (Main.getGoodWorld) + { + calCloneBroProjAttackMaxSpeed *= 1.15f; + calCloneBroProjAttackAccel *= 1.15f; + } + + int calCloneBroProjAttackDirection = 1; + if (npc.position.X + (npc.width / 2) < player.position.X + player.width) + calCloneBroProjAttackDirection = -1; + + Vector2 calCloneBroProjLocation = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float calCloneBroProjTargetX = player.position.X + (player.width / 2) + (calCloneBroProjAttackDirection * 180) - calCloneBroProjLocation.X; + float calCloneBroProjTargetY = player.position.Y + (player.height / 2) - calCloneBroProjLocation.Y; + float calCloneBroProjTargetDist = (float)Math.Sqrt(calCloneBroProjTargetX * calCloneBroProjTargetX + calCloneBroProjTargetY * calCloneBroProjTargetY); + + if (expertMode) + { + if (calCloneBroProjTargetDist > 300f) + calCloneBroProjAttackMaxSpeed += 0.5f; + if (calCloneBroProjTargetDist > 400f) + calCloneBroProjAttackMaxSpeed += 0.5f; + if (calCloneBroProjTargetDist > 500f) + calCloneBroProjAttackMaxSpeed += 0.55f; + if (calCloneBroProjTargetDist > 600f) + calCloneBroProjAttackMaxSpeed += 0.55f; + if (calCloneBroProjTargetDist > 700f) + calCloneBroProjAttackMaxSpeed += 0.6f; + if (calCloneBroProjTargetDist > 800f) + calCloneBroProjAttackMaxSpeed += 0.6f; + } + + calCloneBroProjTargetDist = calCloneBroProjAttackMaxSpeed / calCloneBroProjTargetDist; + calCloneBroProjTargetX *= calCloneBroProjTargetDist; + calCloneBroProjTargetY *= calCloneBroProjTargetDist; + + if (npc.velocity.X < calCloneBroProjTargetX) + { + npc.velocity.X += calCloneBroProjAttackAccel; + if (npc.velocity.X < 0f && calCloneBroProjTargetX > 0f) + npc.velocity.X += calCloneBroProjAttackAccel; + } + else if (npc.velocity.X > calCloneBroProjTargetX) + { + npc.velocity.X -= calCloneBroProjAttackAccel; + if (npc.velocity.X > 0f && calCloneBroProjTargetX < 0f) + npc.velocity.X -= calCloneBroProjAttackAccel; + } + if (npc.velocity.Y < calCloneBroProjTargetY) + { + npc.velocity.Y += calCloneBroProjAttackAccel; + if (npc.velocity.Y < 0f && calCloneBroProjTargetY > 0f) + npc.velocity.Y += calCloneBroProjAttackAccel; + } + else if (npc.velocity.Y > calCloneBroProjTargetY) + { + npc.velocity.Y -= calCloneBroProjAttackAccel; + if (npc.velocity.Y > 0f && calCloneBroProjTargetY < 0f) + npc.velocity.Y -= calCloneBroProjAttackAccel; + } + + 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; + npc.netUpdate = true; + } + + bool fireDelay = npc.ai[2] > 120f || npc.life < npc.lifeMax * 0.9; + if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height) && fireDelay) + { + npc.localAI[2] += 1f; + if (npc.localAI[2] > 22f) + { + npc.localAI[2] = 0f; + SoundEngine.PlaySound(SoundID.Item34, npc.Center); + } + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.localAI[1] += 3f; + if (revenge) + npc.localAI[1] += 1f; + + if (npc.localAI[1] > 12f) + { + npc.localAI[1] = 0f; + float calCloneBroProjSpeed = NPC.AnyNPCs(ModContent.NPCType()) ? 4f : 6f; + calCloneBroProjSpeed += enrageScale; + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + calCloneBroProjLocation = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + calCloneBroProjTargetX = player.position.X + (player.width / 2) - calCloneBroProjLocation.X; + calCloneBroProjTargetY = player.position.Y + (player.height / 2) - calCloneBroProjLocation.Y; + calCloneBroProjTargetDist = (float)Math.Sqrt(calCloneBroProjTargetX * calCloneBroProjTargetX + calCloneBroProjTargetY * calCloneBroProjTargetY); + calCloneBroProjTargetDist = calCloneBroProjSpeed / calCloneBroProjTargetDist; + calCloneBroProjTargetX *= calCloneBroProjTargetDist; + calCloneBroProjTargetY *= calCloneBroProjTargetDist; + calCloneBroProjTargetY += npc.velocity.Y * 0.5f; + calCloneBroProjTargetX += npc.velocity.X * 0.5f; + calCloneBroProjLocation.X -= calCloneBroProjTargetX; + calCloneBroProjLocation.Y -= calCloneBroProjTargetY; + Projectile.NewProjectile(npc.GetSource_FromAI(), calCloneBroProjLocation.X, calCloneBroProjLocation.Y, calCloneBroProjTargetX, calCloneBroProjTargetY, type, damage, 0f, Main.myPlayer, 0f, 0f); + } + } + } + } + else + { + if (npc.ai[1] == 1f) + { + // Set damage + npc.damage = npc.defDamage; + + SoundEngine.PlaySound(SoundID.Roar, npc.Center); + npc.rotation = calCloneBroRotation; + + float calCloneBroChargeSpeed = 14f + (death ? 4f * (1f - lifeRatio) : 0f); + calCloneBroChargeSpeed += 3f * enrageScale; + if (expertMode) + calCloneBroChargeSpeed += 2f; + if (revenge) + calCloneBroChargeSpeed += 2f; + if (Main.getGoodWorld) + calCloneBroChargeSpeed *= 1.25f; + + Vector2 calCloneBroChargeCenter = npc.Center; + float calCloneBroChargeTargetXDist = player.Center.X - calCloneBroChargeCenter.X; + float calCloneBroChargeTargetYDist = player.Center.Y - calCloneBroChargeCenter.Y; + float calCloneBroChargeTargetDistance = (float)Math.Sqrt(calCloneBroChargeTargetXDist * calCloneBroChargeTargetXDist + calCloneBroChargeTargetYDist * calCloneBroChargeTargetYDist); + calCloneBroChargeTargetDistance = calCloneBroChargeSpeed / calCloneBroChargeTargetDistance; + npc.velocity.X = calCloneBroChargeTargetXDist * calCloneBroChargeTargetDistance; + npc.velocity.Y = calCloneBroChargeTargetYDist * calCloneBroChargeTargetDistance; + npc.ai[1] = 2f; + + if (Main.zenithWorld) + { + SoundEngine.PlaySound(SupremeCalamitas.SupremeCalamitas.BrimstoneShotSound, npc.Center); + + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(ModContent.ProjectileType()); + if (bossRush) + damage /= 2; + + int totalProjectiles = bossRush ? 12 : death ? 10 : revenge ? 8 : expertMode ? 6 : 4; + float radians = MathHelper.TwoPi / totalProjectiles; + float velocity = 5f; + Vector2 spinningPoint = new Vector2(0f, -velocity); + float projectileVelocityToPass = velocity * 3f; + for (int k = 0; k < totalProjectiles; k++) + { + Vector2 velocity2 = spinningPoint.RotatedBy(radians * k); + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, velocity2, type, damage, 0f, Main.myPlayer, 0f, 0f, projectileVelocityToPass); + } + + for (int i = 0; i < 6; i++) + Dust.NewDust(npc.position + npc.velocity, npc.width, npc.height, (int)CalamityDusts.Brimstone, 0f, 0f); + } + return; + } + + if (npc.ai[1] == 2f) + { + // Set damage + npc.damage = npc.defDamage; + + npc.ai[2] += 1f + (death ? 0.5f * (1f - lifeRatio) : 0f); + if (expertMode) + npc.ai[2] += 0.25f; + if (revenge) + npc.ai[2] += 0.25f; + + if (npc.ai[2] >= 75f) + { + // Avoid cheap bullshit + npc.damage = (int)Math.Round(npc.defDamage * 0.5); + + npc.velocity.X *= 0.93f; + npc.velocity.Y *= 0.93f; + + if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) + npc.velocity.X = 0f; + if (npc.velocity.Y > -0.1 && npc.velocity.Y < 0.1) + npc.velocity.Y = 0f; + } + else + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) - MathHelper.PiOver2; + + if (npc.ai[2] >= 105f) + { + npc.ai[3] += 1f; + npc.ai[2] = 0f; + npc.target = 255; + npc.rotation = calCloneBroRotation; + npc.TargetClosest(); + if (npc.ai[3] >= 3f) + { + npc.ai[1] = 0f; + npc.ai[3] = 0f; + return; + } + npc.ai[1] = 1f; + } + } + } + } + + public static void VanillaCatastropheAI(NPC npc, Mod mod) + { + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + + if (CalamityGlobalNPC.calamitas < 0 || !Main.npc[CalamityGlobalNPC.calamitas].active) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + npc.StrikeInstantKill(); + + return; + } + + // Percent life remaining + float lifeRatio = npc.life / (float)npc.lifeMax; + + CalamityGlobalNPC.catastrophe = npc.whoAmI; + + // Emit light + Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 1f, 0f, 0f); + + bool bossRush = BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || bossRush; + bool revenge = CalamityWorld.revenge || bossRush; + bool expertMode = Main.expertMode || bossRush; + + // Get a target + 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; + if (Main.IsItDay() || bossRush) + { + npc.Calamity().CurrentlyEnraged = !bossRush; + enrageScale += 2f; + } + + float calCloneBroPlayerXDist = npc.position.X + (npc.width / 2) - player.position.X - (player.width / 2); + float calCloneBroPlayerYDist = npc.position.Y + npc.height - 59f - player.position.Y - (player.height / 2); + float calCloneBroRotation = (float)Math.Atan2(calCloneBroPlayerYDist, calCloneBroPlayerXDist) + MathHelper.PiOver2; + if (calCloneBroRotation < 0f) + calCloneBroRotation += MathHelper.TwoPi; + else if (calCloneBroRotation > MathHelper.TwoPi) + calCloneBroRotation -= MathHelper.TwoPi; + + float calCloneBroRotationSpeed = 0.15f; + if (npc.rotation < calCloneBroRotation) + { + if ((calCloneBroRotation - npc.rotation) > MathHelper.Pi) + npc.rotation -= calCloneBroRotationSpeed; + else + npc.rotation += calCloneBroRotationSpeed; + } + else if (npc.rotation > calCloneBroRotation) + { + if ((npc.rotation - calCloneBroRotation) > MathHelper.Pi) + npc.rotation += calCloneBroRotationSpeed; + else + npc.rotation -= calCloneBroRotationSpeed; + } + + if (npc.rotation > calCloneBroRotation - calCloneBroRotationSpeed && npc.rotation < calCloneBroRotation + calCloneBroRotationSpeed) + npc.rotation = calCloneBroRotation; + if (npc.rotation < 0f) + npc.rotation += MathHelper.TwoPi; + else if (npc.rotation > MathHelper.TwoPi) + npc.rotation -= MathHelper.TwoPi; + if (npc.rotation > calCloneBroRotation - calCloneBroRotationSpeed && npc.rotation < calCloneBroRotation + calCloneBroRotationSpeed) + npc.rotation = calCloneBroRotation; + + if (!player.active || player.dead) + { + npc.TargetClosest(false); + player = Main.player[npc.target]; + if (!player.active || player.dead) + { + if (npc.velocity.Y > 3f) + npc.velocity.Y = 3f; + npc.velocity.Y -= 0.1f; + if (npc.velocity.Y < -12f) + npc.velocity.Y = -12f; + + if (npc.timeLeft > 60) + npc.timeLeft = 60; + + if (npc.ai[1] != 0f) + { + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.netUpdate = true; + } + + return; + } + } + + if (npc.ai[1] == 0f) + { + // Avoid cheap bullshit + npc.damage = (int)Math.Round(npc.defDamage * 0.5); + + float calCloneBroProjAttackMaxSpeed = 4.5f; + float calCloneBroProjAttackAccel = 0.2f; + calCloneBroProjAttackMaxSpeed += 2f * enrageScale; + calCloneBroProjAttackAccel += 0.1f * enrageScale; + + if (Main.getGoodWorld) + { + calCloneBroProjAttackMaxSpeed *= 1.15f; + calCloneBroProjAttackAccel *= 1.15f; + } + + int calCloneBroProjAttackDirection = 1; + if (npc.Center.X < player.Center.X) + calCloneBroProjAttackDirection = -1; + + Vector2 calCloneBroProjLocation = npc.Center; + float calCloneBroProjTargetX = player.Center.X + (calCloneBroProjAttackDirection * 180) - calCloneBroProjLocation.X; + float calCloneBroProjTargetY = player.Center.Y - calCloneBroProjLocation.Y; + float calCloneBroProjTargetDist = (float)Math.Sqrt(calCloneBroProjTargetX * calCloneBroProjTargetX + calCloneBroProjTargetY * calCloneBroProjTargetY); + + if (expertMode) + { + if (calCloneBroProjTargetDist > 300f) + calCloneBroProjAttackMaxSpeed += 0.5f; + if (calCloneBroProjTargetDist > 400f) + calCloneBroProjAttackMaxSpeed += 0.5f; + if (calCloneBroProjTargetDist > 500f) + calCloneBroProjAttackMaxSpeed += 0.55f; + if (calCloneBroProjTargetDist > 600f) + calCloneBroProjAttackMaxSpeed += 0.55f; + if (calCloneBroProjTargetDist > 700f) + calCloneBroProjAttackMaxSpeed += 0.6f; + if (calCloneBroProjTargetDist > 800f) + calCloneBroProjAttackMaxSpeed += 0.6f; + } + + calCloneBroProjTargetDist = calCloneBroProjAttackMaxSpeed / calCloneBroProjTargetDist; + calCloneBroProjTargetX *= calCloneBroProjTargetDist; + calCloneBroProjTargetY *= calCloneBroProjTargetDist; + + if (npc.velocity.X < calCloneBroProjTargetX) + { + npc.velocity.X += calCloneBroProjAttackAccel; + if (npc.velocity.X < 0f && calCloneBroProjTargetX > 0f) + npc.velocity.X += calCloneBroProjAttackAccel; + } + else if (npc.velocity.X > calCloneBroProjTargetX) + { + npc.velocity.X -= calCloneBroProjAttackAccel; + if (npc.velocity.X > 0f && calCloneBroProjTargetX < 0f) + npc.velocity.X -= calCloneBroProjAttackAccel; + } + if (npc.velocity.Y < calCloneBroProjTargetY) + { + npc.velocity.Y += calCloneBroProjAttackAccel; + if (npc.velocity.Y < 0f && calCloneBroProjTargetY > 0f) + npc.velocity.Y += calCloneBroProjAttackAccel; + } + else if (npc.velocity.Y > calCloneBroProjTargetY) + { + npc.velocity.Y -= calCloneBroProjAttackAccel; + if (npc.velocity.Y > 0f && calCloneBroProjTargetY < 0f) + npc.velocity.Y -= calCloneBroProjAttackAccel; + } + + 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; + npc.netUpdate = true; + } + + bool fireDelay = npc.ai[2] > 120f || lifeRatio < 0.9f; + if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height) && fireDelay) + { + npc.localAI[2] += 1f; + if (npc.localAI[2] > 36f) + { + npc.localAI[2] = 0f; + SoundEngine.PlaySound(SoundID.Item34, npc.Center); + } + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.localAI[1] += 1f; + if (revenge) + npc.localAI[1] += 0.5f; + + if (npc.localAI[1] > 50f) + { + npc.localAI[1] = 0f; + float calCloneBroProjSpeed = death ? 14f : 12f; + calCloneBroProjSpeed += 3f * enrageScale; + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + calCloneBroProjLocation = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + calCloneBroProjTargetX = player.position.X + (player.width / 2) - calCloneBroProjLocation.X; + calCloneBroProjTargetY = player.position.Y + (player.height / 2) - calCloneBroProjLocation.Y; + calCloneBroProjTargetDist = (float)Math.Sqrt(calCloneBroProjTargetX * calCloneBroProjTargetX + calCloneBroProjTargetY * calCloneBroProjTargetY); + calCloneBroProjTargetDist = calCloneBroProjSpeed / calCloneBroProjTargetDist; + calCloneBroProjTargetX *= calCloneBroProjTargetDist; + calCloneBroProjTargetY *= calCloneBroProjTargetDist; + calCloneBroProjTargetY += npc.velocity.Y * 0.5f; + calCloneBroProjTargetX += npc.velocity.X * 0.5f; + calCloneBroProjLocation.X -= calCloneBroProjTargetX; + calCloneBroProjLocation.Y -= calCloneBroProjTargetY; + Projectile.NewProjectile(npc.GetSource_FromAI(), calCloneBroProjLocation.X, calCloneBroProjLocation.Y, calCloneBroProjTargetX, calCloneBroProjTargetY, type, damage, 0f, Main.myPlayer, 0f, 0f); + } + } + } + } + else + { + if (npc.ai[1] == 1f) + { + // Set damage + npc.damage = npc.defDamage; + + SoundEngine.PlaySound(SoundID.Roar, npc.Center); + npc.rotation = calCloneBroRotation; + + float calCloneBroChargeSpeed = (NPC.AnyNPCs(ModContent.NPCType()) ? 12f : 16f) + (death ? 4f * (1f - lifeRatio) : 0f); + calCloneBroChargeSpeed += 4f * enrageScale; + if (expertMode) + calCloneBroChargeSpeed += 2f; + if (revenge) + calCloneBroChargeSpeed += 2f; + if (Main.getGoodWorld) + calCloneBroChargeSpeed *= 1.25f; + + Vector2 calCloneBroChargeCenter = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float calCloneBroChargeTargetXDist = player.position.X + (player.width / 2) - calCloneBroChargeCenter.X; + float calCloneBroChargeTargetYDist = player.position.Y + (player.height / 2) - calCloneBroChargeCenter.Y; + float calCloneBroChargeTargetDistance = (float)Math.Sqrt(calCloneBroChargeTargetXDist * calCloneBroChargeTargetXDist + calCloneBroChargeTargetYDist * calCloneBroChargeTargetYDist); + calCloneBroChargeTargetDistance = calCloneBroChargeSpeed / calCloneBroChargeTargetDistance; + npc.velocity.X = calCloneBroChargeTargetXDist * calCloneBroChargeTargetDistance; + npc.velocity.Y = calCloneBroChargeTargetYDist * calCloneBroChargeTargetDistance; + npc.ai[1] = 2f; + + if (Main.zenithWorld) + { + SoundEngine.PlaySound(SupremeCalamitas.SupremeCalamitas.BrimstoneShotSound, npc.Center); + + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(ModContent.ProjectileType()); + if (bossRush) + damage /= 2; + + int totalProjectiles = bossRush ? 12 : death ? 10 : revenge ? 8 : expertMode ? 6 : 4; + float radians = MathHelper.TwoPi / totalProjectiles; + float velocity = 5f; + Vector2 spinningPoint = new Vector2(0f, -velocity); + float projectileVelocityToPass = velocity * 3f; + for (int k = 0; k < totalProjectiles; k++) + { + Vector2 velocity2 = spinningPoint.RotatedBy(radians * k); + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, velocity2, type, damage, 0f, Main.myPlayer, 0f, 0f, projectileVelocityToPass); + } + + for (int i = 0; i < 6; i++) + Dust.NewDust(npc.position + npc.velocity, npc.width, npc.height, (int)CalamityDusts.Brimstone, 0f, 0f); + } + return; + } + + if (npc.ai[1] == 2f) + { + // Set damage + npc.damage = npc.defDamage; + + npc.ai[2] += 1f + (death ? 0.5f * (1f - lifeRatio) : 0f); + if (expertMode) + npc.ai[2] += 0.25f; + if (revenge) + npc.ai[2] += 0.25f; + + if (npc.ai[2] >= 60f) //50 + { + // Avoid cheap bullshit + npc.damage = (int)Math.Round(npc.defDamage * 0.5); + + npc.velocity.X *= 0.93f; + npc.velocity.Y *= 0.93f; + + if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) + npc.velocity.X = 0f; + if (npc.velocity.Y > -0.1 && npc.velocity.Y < 0.1) + npc.velocity.Y = 0f; + } + else + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) - MathHelper.PiOver2; + + if (npc.ai[2] >= 90f) //80 + { + npc.ai[3] += 1f; + npc.ai[2] = 0f; + npc.TargetClosest(); + npc.rotation = calCloneBroRotation; + if (npc.ai[3] >= 4f) + { + npc.ai[1] = 0f; + npc.ai[3] = 0f; + return; + } + npc.ai[1] = 1f; + } + } + } + } + } +} diff --git a/NPCs/CalamityAIs/CalamityBossAIs/CeaselessVoidAI.cs b/NPCs/CalamityAIs/CalamityBossAIs/CeaselessVoidAI.cs new file mode 100644 index 0000000000..6f7fa5b9bd --- /dev/null +++ b/NPCs/CalamityAIs/CalamityBossAIs/CeaselessVoidAI.cs @@ -0,0 +1,601 @@ +using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.CalPlayer; +using CalamityMod.Dusts; +using CalamityMod.Events; +using CalamityMod.NPCs.Abyss; +using CalamityMod.NPCs.AquaticScourge; +using CalamityMod.NPCs.AstrumAureus; +using CalamityMod.NPCs.AstrumDeus; +using CalamityMod.NPCs.BrimstoneElemental; +using CalamityMod.NPCs.Bumblebirb; +using CalamityMod.NPCs.CalClone; +using CalamityMod.NPCs.CeaselessVoid; +using CalamityMod.NPCs.Crags; +using CalamityMod.NPCs.NormalNPCs; +using CalamityMod.NPCs.OldDuke; +using CalamityMod.NPCs.SulphurousSea; +using CalamityMod.NPCs.SunkenSea; +using CalamityMod.Projectiles.Boss; +using CalamityMod.Projectiles.Enemy; +using CalamityMod.Sounds; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs +{ + public static class CeaselessVoidAI + { + public static void VanillaCeaselessVoidAI(NPC npc, Mod mod) + { + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + + CalamityGlobalNPC.voidBoss = npc.whoAmI; + + // Percent life remaining + double lifeRatio = npc.life / (double)npc.lifeMax; + + // Difficulty modes + bool bossRush = BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || bossRush; + bool revenge = CalamityWorld.revenge || bossRush; + bool death = CalamityWorld.death || bossRush; + + // Phases + bool phase2 = lifeRatio <= 0.7; + bool phase3 = lifeRatio <= 0.4; + bool phase4 = lifeRatio <= 0.1; + bool theBigSucc = npc.life / (double)npc.lifeMax <= 0.1; + bool succSoHardThatYouDie = npc.life / (double)npc.lifeMax <= 0.005; + + // Spawn Dark Energies + int darkEnergyAmt = death ? 6 : revenge ? 5 : expertMode ? 4 : 3; + if (phase2) + darkEnergyAmt += 1; + if (phase3) + darkEnergyAmt += 1; + if (phase4) + darkEnergyAmt += 1; + + if (Main.getGoodWorld) + darkEnergyAmt *= 2; + + // Spawn a few Dark Energies as soon as the fight starts + int spacing = 360 / darkEnergyAmt; + int distance2 = 10; + if (npc.ai[2] == 0f) + { + npc.ai[2] = 1f; + for (int i = 0; i < darkEnergyAmt; i++) + { + NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(i * spacing) * distance2)), (int)(npc.Center.Y + (Math.Cos(i * spacing) * distance2)), ModContent.NPCType(), npc.whoAmI, i * spacing, 0f, 0f, 0f); + NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(i * spacing) * distance2)), (int)(npc.Center.Y + (Math.Cos(i * spacing) * distance2)), ModContent.NPCType(), npc.whoAmI, i * spacing, 1f, 0f, 0f); + NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(i * spacing) * distance2)), (int)(npc.Center.Y + (Math.Cos(i * spacing) * distance2)), ModContent.NPCType(), npc.whoAmI, i * spacing, 2f, 0f, 0f); + } + NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(0) * distance2)), (int)(npc.Center.Y + (Math.Cos(0) * distance2)), ModContent.NPCType(), npc.whoAmI, 0f, 0.5f, 0f, 0f); + NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(0) * distance2)), (int)(npc.Center.Y + (Math.Cos(0) * distance2)), ModContent.NPCType(), npc.whoAmI, 0f, 1.5f, 0f, 0f); + } + + // If there are any Dark Energies alive, change AI and don't take damage + bool anyDarkEnergies = NPC.AnyNPCs(ModContent.NPCType()); + bool movingDuringSuccPhase = npc.ai[3] == 0f; + npc.dontTakeDamage = anyDarkEnergies || theBigSucc || movingDuringSuccPhase; + + // Get a target + 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]; + + // Speed enrage + bool moveVeryFast = Vector2.Distance(npc.Center, player.Center) > 960f || (!player.ZoneDungeon && !bossRush && player.position.Y < Main.worldSurface * 16.0); + + // Despawn + if (!player.active || player.dead || Vector2.Distance(player.Center, npc.Center) > 5600f) + { + npc.TargetClosest(false); + player = Main.player[npc.target]; + if (!player.active || player.dead || Vector2.Distance(player.Center, npc.Center) > 5600f) + { + if (npc.velocity.Y > 3f) + npc.velocity.Y = 3f; + npc.velocity.Y -= 0.1f; + if (npc.velocity.Y < -12f) + npc.velocity.Y = -12f; + + if (npc.timeLeft > 60) + npc.timeLeft = 60; + + return; + } + } + else if (npc.timeLeft < 1800) + npc.timeLeft = 1800; + + float tileEnrageMult = (CalamityWorld.LegendaryMode && revenge) ? 1.5f : bossRush ? 1.375f : 1f; + npc.Calamity().CurrentlyEnraged = tileEnrageMult > 1f && !bossRush; + + // Set AI variable to be used by Dark Energies + npc.ai[1] = tileEnrageMult; + + // Increase projectile fire rate based on number of nearby active tiles + float projectileFireRateMultiplier = MathHelper.Lerp(0.5f, 1.5f, 1f - ((tileEnrageMult - 1f) / 0.5f)); + + // Succ attack + if (!anyDarkEnergies) + { + // This is here because it's used in multiple places + float suckDistance = (CalamityWorld.LegendaryMode && revenge) ? 2400f : bossRush ? 1920f : death ? 1600f : revenge ? 1440f : expertMode ? 1280f : 1040f; + + // Move closer to the target before trying to succ + if (movingDuringSuccPhase) + { + // Avoid cheap bullshit + npc.damage = 0; + + if (Vector2.Distance(npc.Center, player.Center) > 320f || !Collision.CanHit(npc.Center, 1, 1, player.Center, 1, 1)) + Movement(true); + else + npc.ai[3] = 1f; + } + else + { + // Set damage + npc.damage = npc.defDamage; + + // Use this to generate more and more dust in final phase + float finalPhaseDustRatio = 1f; + if (succSoHardThatYouDie) + { + finalPhaseDustRatio = 5f; + } + else if (theBigSucc) + { + float amount = (10f - (float)(npc.life / (double)npc.lifeMax) * 100f) / 10f; + finalPhaseDustRatio += MathHelper.Lerp(0f, 2f, amount); + } + + // Slow down + if (npc.velocity.Length() > 0.5f) + npc.velocity *= 0.8f; + else + npc.velocity = Vector2.Zero; + + // Move towards target again if they get outside the succ radius + float moveCloserGateValue = suckDistance * 0.75f; + if (Vector2.Distance(npc.Center, player.Center) > moveCloserGateValue) + npc.ai[3] = 0f; + + // Ceaseless Void sucks in dark energy in different patterns + // This attack also sucks in all players that are within reach of the succ + int dustRings = 3; + for (int h = 0; h < dustRings; h++) + { + float distanceDivisor = h + 1f; + float dustDistance = suckDistance / distanceDivisor; + int numDust = (int)(0.1f * MathHelper.TwoPi * dustDistance); + float angleIncrement = MathHelper.TwoPi / numDust; + Vector2 dustOffset = new Vector2(dustDistance, 0f); + dustOffset = dustOffset.RotatedByRandom(MathHelper.TwoPi); + + int var = (int)(dustDistance / finalPhaseDustRatio); + float dustVelocity = 24f / distanceDivisor * finalPhaseDustRatio; + for (int i = 0; i < numDust; i++) + { + if (Main.rand.NextBool(var)) + { + dustOffset = dustOffset.RotatedBy(angleIncrement); + int dust = Dust.NewDust(npc.Center, 1, 1, ModContent.DustType()); + Main.dust[dust].position = npc.Center + dustOffset; + Main.dust[dust].fadeIn = 1f; + Main.dust[dust].velocity = Vector2.Normalize(npc.Center - Main.dust[dust].position) * dustVelocity; + Main.dust[dust].scale = 3f - h; + } + } + } + + float succPower = 0.125f + finalPhaseDustRatio * 0.125f; + for (int i = 0; i < Main.maxPlayers; i++) + { + float distance = Vector2.Distance(Main.player[i].Center, npc.Center); + if (distance < suckDistance && Main.player[i].grappling[0] == -1) + { + if (Collision.CanHit(npc.Center, 1, 1, Main.player[i].Center, 1, 1)) + { + float distanceRatio = distance / suckDistance; + float multiplier = 1f - distanceRatio; + + if (Main.player[i].Center.X < npc.Center.X) + Main.player[i].velocity.X += succPower * multiplier; + else + Main.player[i].velocity.X -= succPower * multiplier; + } + } + } + + // Slowly die in final phase and then implode + // This phase lasts 20 seconds + if (theBigSucc && calamityGlobalNPC.newAI[1] % 60f == 0f) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int damageAmt = npc.lifeMax / 200; + npc.life -= damageAmt; + npc.HealEffect(-damageAmt, true); + } + + if (npc.life <= ((npc.lifeMax / 200) * 5) && !npc.ModNPC().playedbuildsound) + { + SoundEngine.PlaySound(CeaselessVoid.CeaselessVoid.BuildupSound, npc.Center); + npc.ModNPC().playedbuildsound = true; + } + + if (npc.life <= 0) + { + npc.life = 0; + npc.HitEffect(); + npc.checkDead(); + } + + npc.netUpdate = true; + } + + // Beam Portals + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (calamityGlobalNPC.newAI[1] == 0f) + { + int numBeamPortals = bossRush ? 4 : revenge ? 3 : 2; + float degrees = 360 / numBeamPortals; + float beamPortalDistance = bossRush ? 360f : death ? 400f : revenge ? 420f : expertMode ? 440f : 480f; + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + for (int i = 0; i < numBeamPortals; i++) + { + float ai1 = i * degrees; + Projectile.NewProjectile(npc.GetSource_FromAI(), player.Center.X + (float)(Math.Sin(i * degrees) * beamPortalDistance), player.Center.Y + (float)(Math.Cos(i * degrees) * beamPortalDistance), 0f, 0f, type, damage, 0f, Main.myPlayer, ai1, 0f); + } + } + } + + // Use this timer to lessen Dark Energy projectile rate of fire while Beam Portals are active + float beamPortalTimeLeft = 600f; + bool summonLessDarkEnergies = false; + if (calamityGlobalNPC.newAI[1] < beamPortalTimeLeft) + { + calamityGlobalNPC.newAI[1] += 1f; + summonLessDarkEnergies = true; + } + else if (theBigSucc) + calamityGlobalNPC.newAI[1] += 1f; + + // Suck in Dark Energy projectiles from far away + calamityGlobalNPC.newAI[3] += 1f; + float darkEnergySpiralGateValue = (summonLessDarkEnergies ? 24f : 12f) * projectileFireRateMultiplier; + if (calamityGlobalNPC.newAI[3] >= darkEnergySpiralGateValue) + { + calamityGlobalNPC.newAI[3] = 0f; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + bool normalSpread = npc.localAI[0] % 2f == 0f; + float speed = 0.5f; + int totalProjectiles = 4; + float radians = MathHelper.TwoPi / totalProjectiles; + double angleA = radians * 0.5; + double angleB = MathHelper.ToRadians(90f) - angleA; + float velocityX = (float)(speed * Math.Sin(angleA) / Math.Sin(angleB)); + Vector2 spinningPoint = normalSpread ? new Vector2(0f, -speed) : new Vector2(-velocityX, -speed); + float radialOffset = MathHelper.ToRadians(npc.localAI[1]); + for (int i = 0; i < totalProjectiles; i++) + { + Vector2 spawnVector = npc.Center + Vector2.Normalize(spinningPoint.RotatedBy(radians * i + radialOffset)) * suckDistance; + Vector2 velocity = Vector2.Normalize(npc.Center - spawnVector) * speed; + Projectile.NewProjectile(npc.GetSource_FromAI(), spawnVector, velocity, type, damage, 0f, Main.myPlayer); + } + } + + npc.localAI[1] += 10f; + } + + // Summon some extra projectiles in Expert Mode + if (phase2 && expertMode) + { + npc.localAI[2] += 1f; + if (npc.localAI[2] >= 60f * projectileFireRateMultiplier) + { + npc.localAI[2] = 0f; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + bool normalSpread = npc.localAI[0] % 2f != 0f; + float speed = 2f; + int totalProjectiles = 2; + float radians = MathHelper.TwoPi / totalProjectiles; + double angleA = radians * 0.5; + double angleB = MathHelper.ToRadians(90f) - angleA; + float velocityX = (float)(speed * Math.Sin(angleA) / Math.Sin(angleB)); + Vector2 spinningPoint = normalSpread ? new Vector2(0f, -speed) : new Vector2(-velocityX, -speed); + float radialOffset = MathHelper.ToRadians(npc.localAI[1] * 0.25f); + for (int i = 0; i < totalProjectiles; i++) + { + Vector2 spawnVector = npc.Center + Vector2.Normalize(spinningPoint.RotatedBy(radians * i + radialOffset)) * suckDistance; + Vector2 velocity = Vector2.Normalize(npc.Center - spawnVector) * speed; + Projectile.NewProjectile(npc.GetSource_FromAI(), spawnVector, velocity, type, damage, 0f, Main.myPlayer); + } + } + } + } + + // Summon some extra projectiles in Revengeance Mode + if (phase4 && revenge) + { + npc.localAI[3] += 1f; + if (npc.localAI[3] >= 90f * projectileFireRateMultiplier) + { + npc.localAI[3] = 0f; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + bool normalSpread = npc.localAI[0] % 2f == 0f; + float speed = 4f; + int totalProjectiles = 2; + float radians = MathHelper.TwoPi / totalProjectiles; + double angleA = radians * 0.5; + double angleB = MathHelper.ToRadians(90f) - angleA; + float velocityX = (float)(speed * Math.Sin(angleA) / Math.Sin(angleB)); + Vector2 spinningPoint = normalSpread ? new Vector2(0f, -speed) : new Vector2(-velocityX, -speed); + float radialOffset = MathHelper.ToRadians(npc.localAI[1] * 0.25f); + for (int i = 0; i < totalProjectiles; i++) + { + Vector2 spawnVector = npc.Center + Vector2.Normalize(spinningPoint.RotatedBy(radians * i + radialOffset)) * suckDistance; + Vector2 velocity = Vector2.Normalize(npc.Center - spawnVector) * speed; + Projectile.NewProjectile(npc.GetSource_FromAI(), spawnVector, velocity, type, damage, 0f, Main.myPlayer); + } + } + } + } + } + } + else + { + // Avoid cheap bullshit + npc.damage = 0; + + Movement(false); + + // Count up all Dark Energy HP values + int totalDarkEnergyHP = 0; + for (int i = 0; i < Main.maxNPCs; i++) + { + NPC darkEnergy = Main.npc[i]; + if (darkEnergy.active && darkEnergy.type == ModContent.NPCType()) + totalDarkEnergyHP += darkEnergy.life; + } + + // Destroy all Dark Energies if their total HP is below 20% + int darkEnergyMaxHP = bossRush ? DarkEnergy.MaxBossRushHP : DarkEnergy.MaxHP; + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; + darkEnergyMaxHP += (int)(darkEnergyMaxHP * HPBoost); + int totalDarkEnergiesSpawned = darkEnergyAmt * 3 + 2; + int totalDarkEnergyMaxHP = darkEnergyMaxHP * totalDarkEnergiesSpawned; + int succPhaseGateValue = (int)(totalDarkEnergyMaxHP * 0.2); + if (totalDarkEnergyHP < succPhaseGateValue) + { + SoundEngine.PlaySound(SoundID.NPCDeath44, npc.Center); + + // Kill all Dark Energies + for (int i = 0; i < Main.maxNPCs; i++) + { + NPC darkEnergy = Main.npc[i]; + if (darkEnergy.active && darkEnergy.type == ModContent.NPCType()) + { + darkEnergy.HitEffect(); + darkEnergy.active = false; + darkEnergy.netUpdate = true; + } + } + + // Generate a dust explosion + int dustAmt = 30; + int random = 3; + for (int j = 0; j < 10; j++) + { + random += j * 2; + int dustAmtSpawned = 0; + int scale = random * 13; + float dustPositionX = npc.Center.X - (scale / 2); + float dustPositionY = npc.Center.Y - (scale / 2); + while (dustAmtSpawned < dustAmt) + { + float dustVelocityX = Main.rand.Next(-random, random); + float dustVelocityY = Main.rand.Next(-random, random); + float dustVelocityScalar = random * 2f; + float dustVelocity = (float)Math.Sqrt(dustVelocityX * dustVelocityX + dustVelocityY * dustVelocityY); + dustVelocity = dustVelocityScalar / dustVelocity; + dustVelocityX *= dustVelocity; + dustVelocityY *= dustVelocity; + int dust = Dust.NewDust(new Vector2(dustPositionX, dustPositionY), scale, scale, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 5f); + Main.dust[dust].noGravity = true; + Main.dust[dust].position.X = npc.Center.X; + Main.dust[dust].position.Y = npc.Center.Y; + Main.dust[dust].position.X += Main.rand.Next(-10, 11); + Main.dust[dust].position.Y += Main.rand.Next(-10, 11); + Main.dust[dust].velocity.X = dustVelocityX; + Main.dust[dust].velocity.Y = dustVelocityY; + dustAmtSpawned++; + } + } + } + } + + // Basic movement towards a location + 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; + + // Increase speed dramatically in succ phase + if (succ) + { + velocity *= 2f; + acceleration *= 2f; + } + + if (Main.getGoodWorld) + { + velocity *= 1.15f; + acceleration *= 1.15f; + } + + Vector2 destination = player.Center; + + // Move between 8 different positions around the player, in order + float maxDistance = 320f; + Vector2 moveToOffset = succ ? Vector2.Zero : new Vector2(0f, -maxDistance); + if (!succ) + { + // Move to a new location every few seconds + calamityGlobalNPC.newAI[2] += 1f; + float newPositionGateValue = bossRush ? 180f : death ? 270f : revenge ? 300f : expertMode ? 360f : 480f; + if (calamityGlobalNPC.newAI[2] > newPositionGateValue) + { + calamityGlobalNPC.newAI[2] = 0f; + + npc.ai[0] += 1f; + if (npc.ai[0] > 7f) + npc.ai[0] = 0f; + } + + switch ((int)npc.ai[0]) + { + case 0: + break; + case 1: + moveToOffset.X = -maxDistance; + break; + case 2: + moveToOffset.X = -maxDistance; + moveToOffset.Y = 0f; + break; + case 3: + moveToOffset.X = -maxDistance; + moveToOffset.Y = maxDistance; + break; + case 4: + moveToOffset.Y = maxDistance; + break; + case 5: + moveToOffset.X = maxDistance; + moveToOffset.Y = maxDistance; + break; + case 6: + moveToOffset.X = maxDistance; + moveToOffset.Y = 0f; + break; + case 7: + moveToOffset.X = maxDistance; + break; + } + } + + destination += moveToOffset; + + // How far Ceaseless Void is from where it's supposed to be + Vector2 distanceFromDestination = destination - npc.Center; + + // Movement + CalamityUtils.SmoothMovement(npc, 0f, distanceFromDestination, velocity, acceleration, true); + } + + // Spawn more Dark Energies as the fight progresses + if (calamityGlobalNPC.newAI[0] == 0f && npc.life > 0) + calamityGlobalNPC.newAI[0] = npc.lifeMax; + + if (npc.life > 0) + { + int healthGateValue = (int)(npc.lifeMax * 0.3); + if ((npc.life + healthGateValue) < calamityGlobalNPC.newAI[0]) + { + npc.TargetClosest(); + calamityGlobalNPC.newAI[0] = npc.life; + calamityGlobalNPC.newAI[1] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + calamityGlobalNPC.newAI[3] = 0f; + npc.ai[3] = 0f; + npc.localAI[0] += 1f; + npc.localAI[1] = 0f; + npc.localAI[2] = 0f; + npc.localAI[3] = 0f; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (phase4) + { + for (int i = 0; i < darkEnergyAmt; i++) + { + NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(i * spacing) * distance2)), (int)(npc.Center.Y + (Math.Cos(i * spacing) * distance2)), ModContent.NPCType(), npc.whoAmI, i * spacing, 0f, 0f, 0f); + NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(i * spacing) * distance2)), (int)(npc.Center.Y + (Math.Cos(i * spacing) * distance2)), ModContent.NPCType(), npc.whoAmI, i * spacing, 2f, 0f, 0f); + NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(i * spacing) * distance2)), (int)(npc.Center.Y + (Math.Cos(i * spacing) * distance2)), ModContent.NPCType(), npc.whoAmI, i * spacing, 4f, 0f, 0f); + } + NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(0) * distance2)), (int)(npc.Center.Y + (Math.Cos(0) * distance2)), ModContent.NPCType(), npc.whoAmI, 0f, 1f, 0f, 0f); + NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(0) * distance2)), (int)(npc.Center.Y + (Math.Cos(0) * distance2)), ModContent.NPCType(), npc.whoAmI, 0f, 3f, 0f, 0f); + } + else if (phase3) + { + for (int i = 0; i < darkEnergyAmt; i++) + { + NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(i * spacing) * distance2)), (int)(npc.Center.Y + (Math.Cos(i * spacing) * distance2)), ModContent.NPCType(), npc.whoAmI, i * spacing, 0f, 0f, 0f); + NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(i * spacing) * distance2)), (int)(npc.Center.Y + (Math.Cos(i * spacing) * distance2)), ModContent.NPCType(), npc.whoAmI, i * spacing, 1.5f, 0f, 0f); + NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(i * spacing) * distance2)), (int)(npc.Center.Y + (Math.Cos(i * spacing) * distance2)), ModContent.NPCType(), npc.whoAmI, i * spacing, 3f, 0f, 0f); + } + NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(0) * distance2)), (int)(npc.Center.Y + (Math.Cos(0) * distance2)), ModContent.NPCType(), npc.whoAmI, 0f, 0.5f, 0f, 0f); + NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(0) * distance2)), (int)(npc.Center.Y + (Math.Cos(0) * distance2)), ModContent.NPCType(), npc.whoAmI, 0f, 2f, 0f, 0f); + } + else + { + for (int i = 0; i < darkEnergyAmt; i++) + { + NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(i * spacing) * distance2)), (int)(npc.Center.Y + (Math.Cos(i * spacing) * distance2)), ModContent.NPCType(), npc.whoAmI, i * spacing, 0f, 0f, 0f); + NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(i * spacing) * distance2)), (int)(npc.Center.Y + (Math.Cos(i * spacing) * distance2)), ModContent.NPCType(), npc.whoAmI, i * spacing, 1f, 0f, 0f); + NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(i * spacing) * distance2)), (int)(npc.Center.Y + (Math.Cos(i * spacing) * distance2)), ModContent.NPCType(), npc.whoAmI, i * spacing, 2f, 0f, 0f); + } + NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(0) * distance2)), (int)(npc.Center.Y + (Math.Cos(0) * distance2)), ModContent.NPCType(), npc.whoAmI, 0f, 1.5f, 0f, 0f); + NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(0) * distance2)), (int)(npc.Center.Y + (Math.Cos(0) * distance2)), ModContent.NPCType(), npc.whoAmI, 0f, 2.5f, 0f, 0f); + } + } + + // Despawn potentially hazardous projectiles when entering a new phase + for (int i = 0; i < Main.maxProjectiles; i++) + { + Projectile projectile = Main.projectile[i]; + if (projectile.active) + { + if (projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType() || + projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType()) + { + if (projectile.timeLeft > 30) + projectile.timeLeft = 30; + } + } + } + } + } + } + } +} diff --git a/NPCs/CalamityAIs/CalamityBossAIs/OldDukeAI.cs b/NPCs/CalamityAIs/CalamityBossAIs/OldDukeAI.cs new file mode 100644 index 0000000000..7383afb7d4 --- /dev/null +++ b/NPCs/CalamityAIs/CalamityBossAIs/OldDukeAI.cs @@ -0,0 +1,1656 @@ +using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.CalPlayer; +using CalamityMod.Dusts; +using CalamityMod.Events; +using CalamityMod.NPCs.Abyss; +using CalamityMod.NPCs.AquaticScourge; +using CalamityMod.NPCs.AstrumAureus; +using CalamityMod.NPCs.AstrumDeus; +using CalamityMod.NPCs.BrimstoneElemental; +using CalamityMod.NPCs.Bumblebirb; +using CalamityMod.NPCs.CalClone; +using CalamityMod.NPCs.CeaselessVoid; +using CalamityMod.NPCs.Crags; +using CalamityMod.NPCs.NormalNPCs; +using CalamityMod.NPCs.OldDuke; +using CalamityMod.NPCs.SulphurousSea; +using CalamityMod.NPCs.SunkenSea; +using CalamityMod.Projectiles.Boss; +using CalamityMod.Projectiles.Enemy; +using CalamityMod.Sounds; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs +{ + public static class OldDukeAI + { + public static void VanillaOldDukeAI(NPC npc, Mod mod) + { + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + OldDuke.OldDuke modNPC = npc.ModNPC(); + + npc.Calamity().canBreakPlayerDefense = true; + + // Percent life remaining + float lifeRatio = npc.life / (float)npc.lifeMax; + + // Variables + bool bossRush = BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || bossRush; + bool revenge = CalamityWorld.revenge || bossRush; + bool death = CalamityWorld.death || bossRush; + + float exhaustionGateValue = 300f; + if (Main.getGoodWorld) + exhaustionGateValue *= 0.5f; + + float exhaustionIncreasePerAttack = exhaustionGateValue * 0.1f; + bool exhausted = calamityGlobalNPC.newAI[1] == 1f; + bool phase2 = lifeRatio <= (death ? 0.8f : revenge ? 0.7f : 0.5f); + bool phase3 = lifeRatio <= (death ? 0.5f : (revenge ? 0.35f : 0.2f)) && expertMode; + bool phase2AI = npc.ai[0] > 4f; + bool phase3AI = npc.ai[0] > 9f; + bool charging = npc.ai[3] < 10f; + float pie = (float)Math.PI; + + if (calamityGlobalNPC.newAI[0] >= exhaustionGateValue) + calamityGlobalNPC.newAI[1] = 1f; + + float alphaScale = (255 - npc.alpha) / 255f; + float redLight = (phase3AI ? 0.4f : phase2AI ? 0.64f : 0.88f) * alphaScale; + float greenLight = (phase3AI ? 1.2f : phase2AI ? 0.8f : 0.4f) * alphaScale; + Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), redLight, greenLight, 0f); + + if (CalamityConfig.Instance.BossesStopWeather) + CalamityMod.StopRain(); + else if (!Main.raining) + CalamityUtils.StartRain(); + + // Adjust stats + int setDamage = npc.defDamage; + calamityGlobalNPC.DR = exhausted ? 0f : 0.5f; + npc.defense = exhausted ? 0 : npc.defDefense; + if (phase3AI) + { + setDamage = (int)Math.Round(setDamage * 1.2); + npc.defense = exhausted ? 0 : npc.defDefense - 40; + } + else if (phase2AI) + { + setDamage = (int)Math.Round(setDamage * 1.1); + npc.defense = exhausted ? 0 : npc.defDefense - 20; + } + + int idlePhaseTimer = expertMode ? 55 : 60; + float idlePhaseAcceleration = expertMode ? 0.75f : 0.7f; + float idlePhaseVelocity = expertMode ? 14f : 13f; + if (phase3AI) + { + idlePhaseAcceleration = expertMode ? 0.6f : 0.55f; + idlePhaseVelocity = expertMode ? 12f : 11f; + } + else if (phase2AI & charging) + { + idlePhaseAcceleration = expertMode ? 0.8f : 0.75f; + idlePhaseVelocity = expertMode ? 15f : 14f; + } + + int chargeTime = expertMode ? 34 : 36; + float chargeVelocity = expertMode ? 20f : 19f; + if (phase3AI) + { + chargeTime = expertMode ? 28 : 30; + chargeVelocity = expertMode ? 26f : 25f; + } + else if (charging & phase2AI) + { + chargeTime = expertMode ? 31 : 33; + chargeVelocity = expertMode ? 24f : 23f; + } + + if (bossRush) + { + idlePhaseTimer = 35; + idlePhaseAcceleration *= 1.25f; + idlePhaseVelocity *= 1.2f; + chargeTime -= 3; + chargeVelocity *= 1.25f; + } + else if (death) + { + idlePhaseTimer = 51; + idlePhaseAcceleration *= 1.05f; + idlePhaseVelocity *= 1.05f; + chargeTime -= 2; + chargeVelocity *= 1.1f; + } + else if (revenge) + { + idlePhaseTimer = 53; + idlePhaseAcceleration *= 1.025f; + idlePhaseVelocity *= 1.025f; + chargeTime -= 1; + chargeVelocity *= 1.05f; + } + + // The dumbest thing to ever exist + if (CalamityWorld.LegendaryMode && revenge) + chargeVelocity *= 1.25f; + + if (exhausted) + idlePhaseVelocity *= 0.25f; + + // Variables + int maxToothBallBelches = bossRush ? 5 : death ? 4 : 3; + int toothBallBelchPhaseDivisor = bossRush ? 24 : death ? 30 : 40; + int toothBallBelchPhaseTimer = toothBallBelchPhaseDivisor * maxToothBallBelches; + float toothBallBelchPhaseAcceleration = bossRush ? 0.95f : death ? 0.6f : 0.55f; + float toothBallBelchPhaseVelocity = bossRush ? 14f : death ? 10f : 9f; + float toothBallFinalVelocity = death ? 14f : revenge ? 13f : 12f; + float goreVelocityX = death ? 8f : revenge ? 7.5f : expertMode ? 7f : 6f; + float goreVelocityY = death ? 10.5f : revenge ? 10f : expertMode ? 9.5f : 8f; + float sharkronVelocity = bossRush ? 18f : death ? 16f : revenge ? 15f : expertMode ? 14f : 12f; + int attackTimer = 120; + int phaseTransitionTimer = 180; + int teleportPauseTimer = 30; + int toothBallSpinPhaseDivisor = bossRush ? 27 : death ? 32 : 45; + int toothBallSpinTimer = maxToothBallBelches * toothBallSpinPhaseDivisor; + float spinTime = toothBallSpinTimer / 2f; + float toothBallSpinToothBallVelocity = bossRush ? 14f : death ? 9.5f : 9f; + float spinAttackSpeed = Main.zenithWorld ? 44f : 22f; + float spinSpeed = MathHelper.TwoPi / spinTime; + + Player player = Main.player[npc.target]; + + // Get target + if (npc.target < 0 || npc.target == Main.maxPlayers || player.dead || !player.active) + { + npc.TargetClosest(); + player = Main.player[npc.target]; + npc.netUpdate = true; + } + + // Despawn safety, make sure to target another player if the current player target is too far away + if (Vector2.Distance(player.Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) + npc.TargetClosest(); + + // Despawn + if (player.dead || Vector2.Distance(player.Center, npc.Center) > 8800f) + { + npc.TargetClosest(); + + npc.velocity.Y -= 0.4f; + + if (npc.timeLeft > 10) + npc.timeLeft = 10; + + if (npc.timeLeft == 1) + { + AcidRainEvent.AccumulatedKillPoints = 0; + AcidRainEvent.HasTriedToSummonOldDuke = false; + AcidRainEvent.UpdateInvasion(false); + npc.timeLeft = 0; + } + + if (npc.ai[0] > 4f) + npc.ai[0] = 5f; + else + npc.ai[0] = 0f; + + npc.ai[2] = 0f; + } + + if (exhausted) + { + npc.Calamity().canBreakPlayerDefense = false; + + // Play exhausted sound + if (calamityGlobalNPC.newAI[0] % 60f == 0f && Main.player[Main.myPlayer].active && !Main.player[Main.myPlayer].dead && Vector2.Distance(Main.player[Main.myPlayer].Center, npc.Center) < 2800f) + SoundEngine.PlaySound(OldDuke.OldDuke.HuffSound with { Volume = OldDuke.OldDuke.HuffSound.Volume * 1.25f }, Main.LocalPlayer.Center); + + if (Main.zenithWorld) + { + float screenShakePower = 10 * Utils.GetLerpValue(800f, 0f, npc.Distance(Main.LocalPlayer.Center), true); + if (Main.LocalPlayer.Calamity().GeneralScreenShakePower < screenShakePower) + Main.LocalPlayer.Calamity().GeneralScreenShakePower = screenShakePower; + + if (calamityGlobalNPC.newAI[0] == exhaustionGateValue) + SoundEngine.PlaySound(SoundID.NPCDeath64 with { Pitch = SoundID.NPCDeath64.Pitch - 0.9f, Volume = SoundID.NPCDeath64.Volume + 0.4f }, player.Center); // fart + + if (Main.netMode != NetmodeID.MultiplayerClient && calamityGlobalNPC.newAI[0] % 5f == 0f) + { + Vector2 dist = player.Center - npc.Center; + dist.Normalize(); + dist *= 3; + dist.X += Main.rand.NextFloat(-0.5f, 0.5f); + dist.Y += Main.rand.NextFloat(-0.5f, 0.5f); + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, -dist, type, damage, 0, Main.myPlayer); + } + } + + calamityGlobalNPC.newAI[0] -= bossRush ? 1.5f : 1f; + if (calamityGlobalNPC.newAI[0] <= 0f) + { + calamityGlobalNPC.newAI[0] = 0f; + calamityGlobalNPC.newAI[1] = 0f; + } + } + + // Enrage variable + bool enrage = !bossRush && + (player.position.Y < 300f || player.position.Y > Main.worldSurface * 16.0 || + (player.position.X > 8000f && player.position.X < (Main.maxTilesX * 16 - 8000))); + + // Check for the flipped Abyss + if (Main.remixWorld) + { + enrage = !bossRush && + (player.position.Y < Main.UnderworldLayer * 0.8f || player.position.Y > Main.UnderworldLayer || + (player.position.X > 8000f && player.position.X < (Main.maxTilesX * 16 - 8000))); + } + + // Enrage + if (enrage) + { + if (npc.localAI[1] > 0f) + npc.localAI[1] -= 1f; + } + else + npc.localAI[1] = CalamityGlobalNPC.biomeEnrageTimerMax; + + bool biomeEnraged = npc.localAI[1] <= 0f; + + npc.Calamity().CurrentlyEnraged = biomeEnraged || bossRush; + + // Increased DR while transitioning phases and not exhausted + if (!exhausted) + calamityGlobalNPC.DR = (npc.ai[0] == -1f || npc.ai[0] == 4f || npc.ai[0] == 9f) ? (bossRush ? 0.99f : 0.75f) : 0.5f; + + calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = npc.ai[0] == -1f || npc.ai[0] == 4f || npc.ai[0] == 9f; + + // Enrage + if (biomeEnraged) + { + toothBallBelchPhaseTimer = 60; + toothBallBelchPhaseDivisor = 20; + toothBallBelchPhaseAcceleration = 1f; + toothBallBelchPhaseVelocity = 15f; + goreVelocityX = 12f; + goreVelocityY = 16f; + sharkronVelocity = 20f; + idlePhaseTimer = 20; + idlePhaseAcceleration = 1.2f; + idlePhaseVelocity = 20f; + chargeTime = 25; + chargeVelocity += 8f; + toothBallSpinPhaseDivisor = 24; + toothBallSpinToothBallVelocity = 15f; + setDamage *= 2; + npc.defense = npc.defDefense * 3; + } + + // The dumbest thing to ever exist + if (CalamityWorld.LegendaryMode && revenge) + chargeTime *= 2; + + // Set variables for spawn effects + if (npc.localAI[0] == 0f) + { + npc.localAI[0] = 1f; + npc.alpha = 255; + npc.rotation = 0f; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.ai[0] = -1f; + npc.netUpdate = true; + } + } + + // Rotation + float rateOfRotation = 0.04f; + if (npc.ai[0] == 1f || npc.ai[0] == 6f || npc.ai[0] == 7f || npc.ai[0] == 14f) + rateOfRotation = 0f; + if (npc.ai[0] == 3f || npc.ai[0] == 4f) + rateOfRotation = 0.01f; + if (npc.ai[0] == 8f || npc.ai[0] == 13f) + rateOfRotation = 0.05f; + + Vector2 rotationVector = player.Center - npc.Center; + if (calamityGlobalNPC.newAI[1] != 1f && !player.dead) + { + // Rotate to show direction of predictive charge + if (npc.ai[0] == 0f && !phase2) + { + if (npc.ai[3] < 6f) + { + rateOfRotation = 0.1f; + rotationVector = Vector2.Normalize(player.Center + player.velocity * 20f - npc.Center) * chargeVelocity; + } + } + else if (npc.ai[0] == 5f && !phase3) + { + if (npc.ai[3] < 4f) + { + rateOfRotation = 0.1f; + rotationVector = Vector2.Normalize(player.Center + player.velocity * 20f - npc.Center) * chargeVelocity; + } + } + else if (npc.ai[0] == 10f) + { + if (npc.ai[3] < 8f && npc.ai[3] != 1f && npc.ai[3] != 4f) + { + rateOfRotation = 0.1f; + rotationVector = Vector2.Normalize(player.Center + player.velocity * 20f - npc.Center) * chargeVelocity; + } + } + } + + float dukeRotationSpeed = (float)Math.Atan2(rotationVector.Y, rotationVector.X); + if (npc.spriteDirection == 1) + dukeRotationSpeed += pie; + if (dukeRotationSpeed < 0f) + dukeRotationSpeed += MathHelper.TwoPi; + if (dukeRotationSpeed > MathHelper.TwoPi) + dukeRotationSpeed -= MathHelper.TwoPi; + if (npc.ai[0] == -1f || npc.ai[0] == 3f || npc.ai[0] == 4f) + dukeRotationSpeed = 0f; + if (npc.ai[0] == 8f || npc.ai[0] == 13f) + dukeRotationSpeed = pie * 0.1666666667f * npc.spriteDirection; + + if (npc.rotation < dukeRotationSpeed) + { + if (dukeRotationSpeed - npc.rotation > pie) + npc.rotation -= rateOfRotation; + else + npc.rotation += rateOfRotation; + } + if (npc.rotation > dukeRotationSpeed) + { + if (npc.rotation - dukeRotationSpeed > pie) + npc.rotation += rateOfRotation; + else + npc.rotation -= rateOfRotation; + } + + if ((npc.ai[0] != 8f && npc.ai[0] != 13f) || npc.spriteDirection == 1) + { + if (npc.rotation > dukeRotationSpeed - rateOfRotation && npc.rotation < dukeRotationSpeed + rateOfRotation) + npc.rotation = dukeRotationSpeed; + if (npc.rotation < 0f) + npc.rotation += MathHelper.TwoPi; + if (npc.rotation > MathHelper.TwoPi) + npc.rotation -= MathHelper.TwoPi; + if (npc.rotation > dukeRotationSpeed - rateOfRotation && npc.rotation < dukeRotationSpeed + rateOfRotation) + npc.rotation = dukeRotationSpeed; + } + + // Alpha adjustments + if (npc.ai[0] != -1f && (npc.ai[0] < 9f || npc.ai[0] > 12f)) + { + if (Collision.SolidCollision(npc.position, npc.width, npc.height)) + npc.alpha += 15; + else + npc.alpha -= 15; + + if (npc.alpha < 0) + npc.alpha = 0; + if (npc.alpha > 150) + npc.alpha = 150; + } + + // Spawn effects + if (npc.ai[0] == -1f) + { + // Avoid cheap bullshit + npc.damage = 0; + + // Velocity + if (npc.Calamity().newAI[3] == 0f) + npc.velocity *= 0.98f; + + // Direction + int dukeFaceDirection = Math.Sign(player.Center.X - npc.Center.X); + if (dukeFaceDirection != 0) + { + npc.direction = dukeFaceDirection; + npc.spriteDirection = -npc.direction; + } + + // Alpha + if (npc.ai[2] > 20f) + { + if (npc.Calamity().newAI[3] == 0f) + npc.velocity.Y = -2f; + + npc.alpha -= 5; + if (Collision.SolidCollision(npc.position, npc.width, npc.height)) + npc.alpha += 15; + if (npc.alpha < 0) + npc.alpha = 0; + if (npc.alpha > 150) + npc.alpha = 150; + } + + // Spawn dust and play sound + if (npc.ai[2] == attackTimer - 30) + { + int dustAmt = 36; + for (int i = 0; i < dustAmt; i++) + { + Vector2 dust = (Vector2.Normalize(npc.velocity) * new Vector2(npc.width / 2f, npc.height) * 0.75f * 0.5f).RotatedBy((i - (dustAmt / 2 - 1)) * MathHelper.TwoPi / dustAmt) + npc.Center; + Vector2 vector2 = dust - npc.Center; + int toxicDust = Dust.NewDust(dust + vector2, 0, 0, (int)CalamityDusts.SulphurousSeaAcid, vector2.X * 2f, vector2.Y * 2f, 100, default, 1.4f); + Main.dust[toxicDust].noGravity = true; + Main.dust[toxicDust].noLight = true; + Main.dust[toxicDust].velocity = Vector2.Normalize(vector2) * 3f; + } + + modNPC.RoarSoundSlot = SoundEngine.PlaySound(OldDuke.OldDuke.RoarSound, npc.Center); + } + + npc.ai[2] += 1f; + if (npc.ai[2] >= 75) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.netUpdate = true; + } + } + + // Phase 1 + else if (npc.ai[0] == 0f && !player.dead) + { + // Avoid cheap bullshit + npc.damage = 0; + + // Velocity + if (npc.ai[1] == 0f) + npc.ai[1] = 500 * Math.Sign((npc.Center - player.Center).X); + + Vector2 phase1IdleSpeed = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -300f) - npc.Center - npc.velocity) * idlePhaseVelocity; + npc.SimpleFlyMovement(phase1IdleSpeed, idlePhaseAcceleration); + + // Rotation and direction + int dukeLookAt = Math.Sign(player.Center.X - npc.Center.X); + if (dukeLookAt != 0) + { + if (npc.ai[2] == 0f && dukeLookAt != npc.direction) + npc.rotation += pie; + + npc.direction = dukeLookAt; + + if (npc.spriteDirection != -npc.direction) + npc.rotation += pie; + + npc.spriteDirection = -npc.direction; + } + + // Phase switch + if (calamityGlobalNPC.newAI[1] != 1f || (phase2 && !phase2AI)) + { + npc.ai[2] += 1f; + if (npc.ai[2] >= idlePhaseTimer || (phase2 && !phase2AI)) + { + int oldDukeAttackPicker = 0; + switch ((int)npc.ai[3]) + { + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + oldDukeAttackPicker = 1; + break; + case 6: + npc.ai[3] = 1f; + oldDukeAttackPicker = 2; + break; + case 7: + npc.ai[3] = 0f; + oldDukeAttackPicker = 3; + break; + } + + if (phase2) + oldDukeAttackPicker = 4; + + // Set velocity for charge + if (oldDukeAttackPicker == 1) + { + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + + // Velocity + Vector2 distanceVector = player.Center + player.velocity * 20f - npc.Center; + npc.velocity = Vector2.Normalize(distanceVector) * chargeVelocity; + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); + + // Direction + if (dukeLookAt != 0) + { + npc.direction = dukeLookAt; + + if (npc.spriteDirection == 1) + npc.rotation += pie; + + npc.spriteDirection = -npc.direction; + } + } + + // Tooth Balls + else if (oldDukeAttackPicker == 2) + { + npc.ai[0] = 2f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + } + + // Call sharks from the sides of the screen + else if (oldDukeAttackPicker == 3) + { + npc.ai[0] = 3f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + } + + // Go to phase 2 + else if (oldDukeAttackPicker == 4) + { + npc.ai[0] = 4f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + } + + npc.netUpdate = true; + } + } + } + + // Charge + else if (npc.ai[0] == 1f) + { + // Set damage + npc.damage = setDamage; + + // The dumbest thing to ever exist + if (CalamityWorld.LegendaryMode && revenge && npc.ai[2] % 10f == 0f) + { + // Rotation and direction + int dir = Math.Sign(player.Center.X - npc.Center.X); + if (dir != 0) + { + if (npc.ai[2] == 0f && dir != npc.direction) + npc.rotation += pie; + + npc.direction = dir; + + if (npc.spriteDirection != -npc.direction) + npc.rotation += pie; + + npc.spriteDirection = -npc.direction; + } + + Vector2 distanceVector = player.Center + player.velocity * 20f - npc.Center; + npc.velocity = Vector2.Normalize(distanceVector) * chargeVelocity; + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); + + // Direction + if (dir != 0) + { + npc.direction = dir; + + if (npc.spriteDirection == 1) + npc.rotation += pie; + + npc.spriteDirection = -npc.direction; + } + } + else + { + // Accelerate + npc.velocity *= 1.01f; + } + + // Spawn dust + int chargeDustAmt = 7; + for (int j = 0; j < chargeDustAmt; j++) + { + Vector2 arg_E1C_0 = (Vector2.Normalize(npc.velocity) * new Vector2((npc.width + 50) / 2f, npc.height) * 0.75f).RotatedBy((j - (chargeDustAmt / 2 - 1)) * pie / chargeDustAmt) + npc.Center; + Vector2 vector4 = ((float)(Main.rand.NextDouble() * pie) - MathHelper.PiOver2).ToRotationVector2() * Main.rand.Next(3, 8); + int chargeDust = Dust.NewDust(arg_E1C_0 + vector4, 0, 0, (int)CalamityDusts.SulphurousSeaAcid, vector4.X * 2f, vector4.Y * 2f, 100, default, 1.4f); + Main.dust[chargeDust].noGravity = true; + Main.dust[chargeDust].noLight = true; + Main.dust[chargeDust].velocity /= 4f; + Main.dust[chargeDust].velocity -= npc.velocity; + } + + npc.ai[2] += 1f; + if (npc.ai[2] >= chargeTime) + { + calamityGlobalNPC.newAI[0] += exhaustionIncreasePerAttack; + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] += 2f; + npc.TargetClosest(); + npc.netUpdate = true; + } + } + + // Tooth Ball belch + else if (npc.ai[0] == 2f) + { + // Avoid cheap bullshit + npc.damage = 0; + + // Velocity + if (npc.ai[1] == 0f) + npc.ai[1] = 500 * Math.Sign((npc.Center - player.Center).X); + + Vector2 toothBallBelchPhaseSpeed = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -300f) - npc.Center - npc.velocity) * toothBallBelchPhaseVelocity; + npc.SimpleFlyMovement(toothBallBelchPhaseSpeed, toothBallBelchPhaseAcceleration); + + // Play sounds and spawn Tooth Balls + if (npc.ai[2] == 0f) + modNPC.RoarSoundSlot = SoundEngine.PlaySound(OldDuke.OldDuke.RoarSound, npc.Center); + + if (npc.ai[2] % toothBallBelchPhaseDivisor == 0f) + { + if (npc.ai[2] != 0f) + SoundEngine.PlaySound(OldDuke.OldDuke.VomitSound, npc.Center); + + Vector2 toothBallDirection = Vector2.Normalize(player.Center - npc.Center) * (npc.width + 20) / 2f + npc.Center; + Vector2 toothBallVelocity = Vector2.Normalize(Main.player[npc.target].Center - npc.Center) * toothBallFinalVelocity; + Vector2 toothBallSpawnPos = new Vector2(toothBallDirection.X, toothBallDirection.Y + 45f); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int toothBall = NPC.NewNPC(npc.GetSource_FromAI(), (int)toothBallSpawnPos.X, (int)toothBallSpawnPos.Y, ModContent.NPCType(), 0, toothBallVelocity.X, toothBallVelocity.Y); + Main.npc[toothBall].velocity = Vector2.Normalize(toothBallVelocity) * npc.velocity.Length(); + Main.npc[toothBall].netUpdate = true; + } + + for (int i = 0; i < 50; i++) + { + int dustID; + switch (Main.rand.Next(6)) + { + case 0: + case 1: + case 2: + case 3: + dustID = (int)CalamityDusts.SulphurousSeaAcid; + break; + default: + dustID = DustID.Blood; + break; + } + + // Choose a random speed and angle to belch out the vomit + float dustSpeed = Main.rand.NextFloat(3.0f, 12.0f); + float angleRandom = 0.06f; + Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(toothBallVelocity.ToRotation()); + dustVel = dustVel.RotatedBy(-angleRandom); + dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); + + // Pick a size for the vomit particles + float scale = Main.rand.NextFloat(1f, 2f); + + // Actually spawn the vomit + int idx = Dust.NewDust(toothBallSpawnPos, 40, 40, dustID, dustVel.X, dustVel.Y, 0, default, scale); + Main.dust[idx].noGravity = true; + } + } + + // Direction + int toothBallLookAt = Math.Sign(player.Center.X - npc.Center.X); + if (toothBallLookAt != 0) + { + npc.direction = toothBallLookAt; + if (npc.spriteDirection != -npc.direction) + npc.rotation += pie; + npc.spriteDirection = -npc.direction; + } + + npc.ai[2] += 1f; + if (npc.ai[2] >= toothBallBelchPhaseTimer) + { + calamityGlobalNPC.newAI[0] += exhaustionIncreasePerAttack; + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.TargetClosest(); + npc.netUpdate = true; + } + } + + // Call sharks from the sides of the screen + else if (npc.ai[0] == 3f) + { + // Avoid cheap bullshit + npc.damage = 0; + + // Velocity + npc.velocity *= 0.98f; + npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); + + // Play sound and spawn sharks + if (npc.ai[2] == attackTimer - 30) + SoundEngine.PlaySound(OldDuke.OldDuke.VomitSound, npc.Center); + + if (npc.ai[2] >= attackTimer - 90) + { + if (npc.ai[2] % 18f == 0f) + { + calamityGlobalNPC.newAI[2] += 100f; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + 900f), (int)(npc.Center.Y - calamityGlobalNPC.newAI[2]), ModContent.NPCType(), 0, 0f, 0f, npc.whoAmI, 0f, 255); + NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X - 900f), (int)(npc.Center.Y - calamityGlobalNPC.newAI[2]), ModContent.NPCType(), 0, 0f, 0f, npc.whoAmI, 0f, 255); + + if (Main.getGoodWorld) + { + NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + 1800f), (int)(npc.Center.Y - calamityGlobalNPC.newAI[2]), ModContent.NPCType(), 0, 0f, 0f, npc.whoAmI, 0f, 255); + NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X - 1800f), (int)(npc.Center.Y - calamityGlobalNPC.newAI[2]), ModContent.NPCType(), 0, 0f, 0f, npc.whoAmI, 0f, 255); + } + } + } + } + + npc.ai[2] += 1f; + if (npc.ai[2] >= attackTimer) + { + calamityGlobalNPC.newAI[0] += exhaustionIncreasePerAttack; + calamityGlobalNPC.newAI[2] = 0f; + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.TargetClosest(); + npc.netUpdate = true; + } + } + + // Transition to phase 2 and call sharks from below + else if (npc.ai[0] == 4f) + { + // Avoid cheap bullshit + npc.damage = 0; + + // Velocity + npc.velocity *= 0.98f; + npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); + + // Sound + if (npc.ai[2] == phaseTransitionTimer - 60) + modNPC.RoarSoundSlot = SoundEngine.PlaySound(OldDuke.OldDuke.RoarSound, npc.Center); + + if (npc.ai[2] >= phaseTransitionTimer - 60) + { + if (npc.ai[2] % 18f == 0f) + { + calamityGlobalNPC.newAI[2] += 150f; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + 50f + calamityGlobalNPC.newAI[2]), (int)(npc.Center.Y + 540f), ModContent.NPCType(), 0, 0f, 0f, 1f, -sharkronVelocity, 255); + NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X - 50f - calamityGlobalNPC.newAI[2]), (int)(npc.Center.Y + 540f), ModContent.NPCType(), 0, 0f, 0f, -1f, -sharkronVelocity, 255); + + if (Main.getGoodWorld) + { + NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + 50f + calamityGlobalNPC.newAI[2] * 0.5f), (int)(npc.Center.Y + 270f), ModContent.NPCType(), 0, 0f, 0f, 1f, -sharkronVelocity, 255); + NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X - 50f - calamityGlobalNPC.newAI[2] * 0.5f), (int)(npc.Center.Y + 270f), ModContent.NPCType(), 0, 0f, 0f, -1f, -sharkronVelocity, 255); + } + } + } + } + + npc.ai[2] += 1f; + if (npc.ai[2] >= phaseTransitionTimer) + { + calamityGlobalNPC.newAI[0] = 0f; + calamityGlobalNPC.newAI[1] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + npc.ai[0] = 5f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.TargetClosest(); + npc.netUpdate = true; + } + } + + // Phase 2 + else if (npc.ai[0] == 5f && !player.dead) + { + // Avoid cheap bullshit + npc.damage = 0; + + // Velocity + if (npc.ai[1] == 0f) + npc.ai[1] = 500 * Math.Sign((npc.Center - player.Center).X); + + Vector2 dukePhase2IdleSpeed = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -300f) - npc.Center - npc.velocity) * idlePhaseVelocity; + npc.SimpleFlyMovement(dukePhase2IdleSpeed, idlePhaseAcceleration); + + // Direction and rotation + int phase2FaceDirection = Math.Sign(player.Center.X - npc.Center.X); + if (phase2FaceDirection != 0) + { + if (npc.ai[2] == 0f && phase2FaceDirection != npc.direction) + npc.rotation += pie; + + npc.direction = phase2FaceDirection; + + if (npc.spriteDirection != -npc.direction) + npc.rotation += pie; + + npc.spriteDirection = -npc.direction; + } + + // Phase switch + if (calamityGlobalNPC.newAI[1] != 1f || (phase3 && !phase3AI)) + { + npc.ai[2] += 1f; + if (npc.ai[2] >= idlePhaseTimer || (phase3 && !phase3AI)) + { + int phase2AttackPicker = 0; + switch ((int)npc.ai[3]) + { + case 0: + case 1: + case 2: + case 3: + phase2AttackPicker = 1; + break; + case 4: + npc.ai[3] = 1f; + phase2AttackPicker = 2; + break; + case 5: + npc.ai[3] = 0f; + phase2AttackPicker = 3; + break; + } + + if (phase3) + phase2AttackPicker = 4; + + // Set velocity for charge + if (phase2AttackPicker == 1) + { + npc.ai[0] = 6f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + + // Velocity and rotation + Vector2 distanceVector = player.Center + player.velocity * 20f - npc.Center; + npc.velocity = Vector2.Normalize(distanceVector) * chargeVelocity; + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); + + // Direction + if (phase2FaceDirection != 0) + { + npc.direction = phase2FaceDirection; + + if (npc.spriteDirection == 1) + npc.rotation += pie; + + npc.spriteDirection = -npc.direction; + } + } + + // Set velocity for spin + else if (phase2AttackPicker == 2) + { + // Velocity and rotation + npc.velocity = Vector2.Normalize(player.Center - npc.Center) * spinAttackSpeed; + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); + + // Direction + if (phase2FaceDirection != 0) + { + npc.direction = phase2FaceDirection; + + if (npc.spriteDirection == 1) + npc.rotation += pie; + + npc.spriteDirection = -npc.direction; + } + + npc.ai[0] = 7f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + } + + else if (phase2AttackPicker == 3) + { + npc.ai[0] = 8f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + } + + // Go to next phase + else if (phase2AttackPicker == 4) + { + npc.ai[0] = 9f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + } + + npc.netUpdate = true; + } + } + } + + // Charge + else if (npc.ai[0] == 6f) + { + // Set damage + npc.damage = setDamage; + + // The dumbest thing to ever exist + if (CalamityWorld.LegendaryMode && revenge && npc.ai[2] % 8f == 0f) + { + // Rotation and direction + int dir = Math.Sign(player.Center.X - npc.Center.X); + if (dir != 0) + { + if (npc.ai[2] == 0f && dir != npc.direction) + npc.rotation += pie; + + npc.direction = dir; + + if (npc.spriteDirection != -npc.direction) + npc.rotation += pie; + + npc.spriteDirection = -npc.direction; + } + + Vector2 distanceVector = player.Center + player.velocity * 20f - npc.Center; + npc.velocity = Vector2.Normalize(distanceVector) * chargeVelocity; + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); + + // Direction + if (dir != 0) + { + npc.direction = dir; + + if (npc.spriteDirection == 1) + npc.rotation += pie; + + npc.spriteDirection = -npc.direction; + } + } + else + { + // Accelerate + npc.velocity *= 1.01f; + } + + // Spawn dust + int phase2ChargeDustAmt = 7; + for (int k = 0; k < phase2ChargeDustAmt; k++) + { + Vector2 arg_1A97_0 = (Vector2.Normalize(npc.velocity) * new Vector2((npc.width + 50) / 2f, npc.height) * 0.75f).RotatedBy((k - (phase2ChargeDustAmt / 2 - 1)) * pie / phase2ChargeDustAmt) + npc.Center; + Vector2 vector9 = ((float)(Main.rand.NextDouble() * pie) - MathHelper.PiOver2).ToRotationVector2() * Main.rand.Next(3, 8); + int phase2ChargeDust = Dust.NewDust(arg_1A97_0 + vector9, 0, 0, (int)CalamityDusts.SulphurousSeaAcid, vector9.X * 2f, vector9.Y * 2f, 100, default, 1.4f); + Main.dust[phase2ChargeDust].noGravity = true; + Main.dust[phase2ChargeDust].noLight = true; + Main.dust[phase2ChargeDust].velocity /= 4f; + Main.dust[phase2ChargeDust].velocity -= npc.velocity; + } + + npc.ai[2] += 1f; + if (npc.ai[2] >= chargeTime) + { + calamityGlobalNPC.newAI[0] += exhaustionIncreasePerAttack; + npc.ai[0] = 5f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] += 2f; + npc.TargetClosest(); + npc.netUpdate = true; + } + } + + // Tooth Ball and Vortex spin + else if (npc.ai[0] == 7f) + { + // Set damage + npc.damage = 0; + + // Play sounds and spawn Tooth Balls and a Vortex + if (npc.ai[2] == 0f) + { + modNPC.RoarSoundSlot = SoundEngine.PlaySound(OldDuke.OldDuke.RoarSound, npc.Center); + + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + Vector2 vortexSpawn = npc.Center + npc.velocity.RotatedBy(MathHelper.PiOver2 * -npc.direction) * spinTime / MathHelper.TwoPi; + if (Main.netMode != NetmodeID.MultiplayerClient) + Projectile.NewProjectile(npc.GetSource_FromAI(), vortexSpawn, Vector2.Zero, type, damage, 0f, Main.myPlayer, vortexSpawn.X, vortexSpawn.Y); + } + + if (npc.ai[2] % toothBallSpinPhaseDivisor == 0f) + { + if (npc.ai[2] != 0f) + SoundEngine.PlaySound(OldDuke.OldDuke.VomitSound, npc.Center); + + Vector2 phase2ToothBallDirection = Vector2.Normalize(npc.velocity) * (npc.width + 20) / 2f + npc.Center; + Vector2 toothBallVelocity = Vector2.Normalize(npc.velocity).RotatedBy(MathHelper.PiOver2 * npc.direction) * toothBallSpinToothBallVelocity; + Vector2 toothBallSpawnPos = new Vector2(phase2ToothBallDirection.X, phase2ToothBallDirection.Y + 45f); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int toothBall = NPC.NewNPC(npc.GetSource_FromAI(), (int)toothBallSpawnPos.X, (int)toothBallSpawnPos.Y, ModContent.NPCType(), 0, toothBallVelocity.X, toothBallVelocity.Y); + Main.npc[toothBall].target = npc.target; + Main.npc[toothBall].velocity = Vector2.Normalize(toothBallVelocity) * toothBallSpinToothBallVelocity * 0.5f; + Main.npc[toothBall].netUpdate = true; + Main.npc[toothBall].ai[3] = 30f; + } + + for (int i = 0; i < 50; i++) + { + int dustID; + switch (Main.rand.Next(6)) + { + case 0: + case 1: + case 2: + case 3: + dustID = (int)CalamityDusts.SulphurousSeaAcid; + break; + default: + dustID = DustID.Blood; + break; + } + + // Choose a random speed and angle to belch out the vomit + float dustSpeed = Main.rand.NextFloat(3.0f, 12.0f); + float angleRandom = 0.06f; + Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(toothBallVelocity.ToRotation()); + dustVel = dustVel.RotatedBy(-angleRandom); + dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); + + // Pick a size for the vomit particles + float scale = Main.rand.NextFloat(1f, 2f); + + // Actually spawn the vomit + int idx = Dust.NewDust(toothBallSpawnPos, 40, 40, dustID, dustVel.X, dustVel.Y, 0, default, scale); + Main.dust[idx].noGravity = true; + } + } + + // Velocity and rotation + npc.velocity = npc.velocity.RotatedBy(-(double)spinSpeed * (float)npc.direction); + npc.rotation -= spinSpeed * npc.direction; + + npc.ai[2] += 1f; + if (npc.ai[2] >= toothBallSpinTimer) + { + calamityGlobalNPC.newAI[0] += exhaustionIncreasePerAttack; + npc.ai[0] = 5f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.TargetClosest(); + npc.netUpdate = true; + } + } + + // Vomit a huge amount of gore into the sky and call sharks from the sides of the screen + else if (npc.ai[0] == 8f) + { + // Avoid cheap bullshit + npc.damage = 0; + + // Velocity + npc.velocity *= 0.98f; + npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); + + // Play sound + if (npc.ai[2] == attackTimer - 30) + { + SoundEngine.PlaySound(OldDuke.OldDuke.VomitSound, npc.Center); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Vector2 phase2GoreDirection = npc.rotation.ToRotationVector2() * (Vector2.UnitX * npc.direction) * (npc.width + 20) / 2f + npc.Center; + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + int totalGore = Main.getGoodWorld ? 40 : 20; + for (int i = 0; i < totalGore; i++) + { + float velocityX = npc.direction * goreVelocityX * (Main.rand.NextFloat(0.2f, 0.8f) + 0.5f); + float velocityY = goreVelocityY * (Main.rand.NextFloat(0.2f, 0.8f) + 0.5f); + + if (Main.getGoodWorld) + { + velocityX *= Main.rand.NextFloat() + 0.5f; + velocityY *= Main.rand.NextFloat() + 0.5f; + } + + Projectile.NewProjectile(npc.GetSource_FromAI(), phase2GoreDirection.X, phase2GoreDirection.Y, velocityX, -velocityY, type, damage, 0f, Main.myPlayer, 0f, 0f); + } + } + } + + if (npc.ai[2] >= attackTimer - 90) + { + if (npc.ai[2] % 18f == 0f) + { + calamityGlobalNPC.newAI[2] += 100f; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + float x = 900f - calamityGlobalNPC.newAI[2]; + NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + x), (int)(npc.Center.Y - calamityGlobalNPC.newAI[2]), ModContent.NPCType(), 0, 0f, 0f, npc.whoAmI, 0f, 255); + NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X - x), (int)(npc.Center.Y - calamityGlobalNPC.newAI[2]), ModContent.NPCType(), 0, 0f, 0f, npc.whoAmI, 0f, 255); + } + } + } + + npc.ai[2] += 1f; + if (npc.ai[2] >= attackTimer) + { + calamityGlobalNPC.newAI[0] += exhaustionIncreasePerAttack; + calamityGlobalNPC.newAI[2] = 0f; + npc.ai[0] = 5f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.TargetClosest(); + npc.netUpdate = true; + } + } + + // Transition to phase 3 and summon sharks from above + else if (npc.ai[0] == 9f) + { + // Avoid cheap bullshit + npc.damage = 0; + + // Velocity + npc.velocity *= 0.98f; + npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); + + // Sound + if (npc.ai[2] == phaseTransitionTimer - 60) + modNPC.RoarSoundSlot = SoundEngine.PlaySound(OldDuke.OldDuke.RoarSound, npc.Center); + + if (npc.ai[2] >= phaseTransitionTimer - 60) + { + if (npc.ai[2] % 18f == 0f) + { + calamityGlobalNPC.newAI[2] += 200f; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + 50f + calamityGlobalNPC.newAI[2]), (int)(npc.Center.Y - 540f), ModContent.NPCType(), 0, 0f, 0f, 1f, sharkronVelocity, 255); + NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X - 50f - calamityGlobalNPC.newAI[2]), (int)(npc.Center.Y - 540f), ModContent.NPCType(), 0, 0f, 0f, -1f, sharkronVelocity, 255); + + if (Main.getGoodWorld) + { + NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + 50f + calamityGlobalNPC.newAI[2] * 0.5f), (int)(npc.Center.Y + 270f), ModContent.NPCType(), 0, 0f, 0f, 1f, -sharkronVelocity, 255); + NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X - 50f - calamityGlobalNPC.newAI[2] * 0.5f), (int)(npc.Center.Y + 270f), ModContent.NPCType(), 0, 0f, 0f, -1f, -sharkronVelocity, 255); + } + } + } + } + + npc.ai[2] += 1f; + if (npc.ai[2] >= phaseTransitionTimer) + { + calamityGlobalNPC.newAI[0] = 0f; + calamityGlobalNPC.newAI[1] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + npc.ai[0] = 10f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.TargetClosest(); + npc.netUpdate = true; + } + } + + // Phase 3 + else if (npc.ai[0] == 10f && !player.dead) + { + // Avoid cheap bullshit + npc.damage = 0; + + // Alpha + npc.alpha -= 25; + if (npc.alpha < 0) + npc.alpha = 0; + + // Movement location + if (npc.ai[1] == 0f) + npc.ai[1] = 500 * Math.Sign((npc.Center - player.Center).X); + + Vector2 desiredVelocity = Vector2.Normalize(player.Center + new Vector2(-npc.ai[1], -300f) - npc.Center - npc.velocity) * idlePhaseVelocity; + npc.SimpleFlyMovement(desiredVelocity, idlePhaseAcceleration); + + // Rotation and direction + int phase3FaceDirection = Math.Sign(player.Center.X - npc.Center.X); + if (phase3FaceDirection != 0) + { + if (npc.ai[2] == 0f && phase3FaceDirection != npc.direction) + { + npc.rotation += pie; + for (int l = 0; l < npc.oldPos.Length; l++) + npc.oldPos[l] = Vector2.Zero; + } + + npc.direction = phase3FaceDirection; + + if (npc.spriteDirection != -npc.direction) + npc.rotation += pie; + + npc.spriteDirection = -npc.direction; + } + + // Phase switch + if (calamityGlobalNPC.newAI[1] != 1f) + { + npc.ai[2] += 1f; + if (npc.ai[2] >= idlePhaseTimer) + { + int phase3AttackPicker = 0; + switch ((int)npc.ai[3]) + { + case 0: + case 2: + case 3: + case 5: + case 6: + case 7: + phase3AttackPicker = 1; + break; + case 1: + case 8: + phase3AttackPicker = 2; + break; + case 4: + npc.ai[3] = 1f; + phase3AttackPicker = 3; + break; + case 9: + npc.ai[3] = 6f; + phase3AttackPicker = 4; + break; + } + + // Set velocity for charge + if (phase3AttackPicker == 1) + { + npc.ai[0] = 11f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + + // Velocity and rotation + Vector2 distanceVector = player.Center + player.velocity * 20f - npc.Center; + npc.velocity = Vector2.Normalize(distanceVector) * chargeVelocity; + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); + + // Direction + if (phase3FaceDirection != 0) + { + npc.direction = phase3FaceDirection; + + if (npc.spriteDirection == 1) + npc.rotation += pie; + + npc.spriteDirection = -npc.direction; + } + } + + // Pause + else if (phase3AttackPicker == 2) + { + npc.ai[0] = 12f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + } + + else if (phase3AttackPicker == 3) + { + npc.ai[0] = 13f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + } + + // Set velocity for spin + else if (phase3AttackPicker == 4) + { + // Velocity and rotation + npc.velocity = Vector2.Normalize(player.Center - npc.Center) * spinAttackSpeed; + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); + + // Direction + if (phase3FaceDirection != 0) + { + npc.direction = phase3FaceDirection; + + if (npc.spriteDirection == 1) + npc.rotation += pie; + + npc.spriteDirection = -npc.direction; + } + + npc.ai[0] = 14f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + } + + npc.netUpdate = true; + } + } + } + + // Charge + else if (npc.ai[0] == 11f) + { + // Set damage + npc.damage = setDamage; + + // The dumbest thing to ever exist + if (CalamityWorld.LegendaryMode && revenge && npc.ai[2] % 6f == 0f) + { + // Rotation and direction + int dir = Math.Sign(player.Center.X - npc.Center.X); + if (dir != 0) + { + if (npc.ai[2] == 0f && dir != npc.direction) + npc.rotation += pie; + + npc.direction = dir; + + if (npc.spriteDirection != -npc.direction) + npc.rotation += pie; + + npc.spriteDirection = -npc.direction; + } + + Vector2 distanceVector = player.Center + player.velocity * 20f - npc.Center; + npc.velocity = Vector2.Normalize(distanceVector) * chargeVelocity; + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); + + // Direction + if (dir != 0) + { + npc.direction = dir; + + if (npc.spriteDirection == 1) + npc.rotation += pie; + + npc.spriteDirection = -npc.direction; + } + } + else + { + // Accelerate + npc.velocity *= 1.01f; + } + + // Spawn dust + int phase3ChargeDustAmt = 7; + for (int m = 0; m < phase3ChargeDustAmt; m++) + { + Vector2 arg_2444_0 = (Vector2.Normalize(npc.velocity) * new Vector2((npc.width + 50) / 2f, npc.height) * 0.75f).RotatedBy((m - (phase3ChargeDustAmt / 2 - 1)) * pie / phase3ChargeDustAmt) + npc.Center; + Vector2 vector11 = ((float)(Main.rand.NextDouble() * pie) - MathHelper.PiOver2).ToRotationVector2() * Main.rand.Next(3, 8); + int phase3ChargeDust = Dust.NewDust(arg_2444_0 + vector11, 0, 0, (int)CalamityDusts.SulphurousSeaAcid, vector11.X * 2f, vector11.Y * 2f, 100, default, 1.4f); + Main.dust[phase3ChargeDust].noGravity = true; + Main.dust[phase3ChargeDust].noLight = true; + Main.dust[phase3ChargeDust].velocity /= 4f; + Main.dust[phase3ChargeDust].velocity -= npc.velocity; + } + + npc.ai[2] += 1f; + if (npc.ai[2] >= chargeTime) + { + calamityGlobalNPC.newAI[0] += exhaustionIncreasePerAttack; + npc.ai[0] = 10f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] += 2f; + npc.TargetClosest(); + npc.netUpdate = true; + } + } + + // Pause before teleport + else if (npc.ai[0] == 12f) + { + // Avoid cheap bullshit + npc.damage = 0; + + // Alpha + if (npc.alpha < 255 && npc.ai[2] >= teleportPauseTimer - 15f) + { + npc.alpha += 17; + if (npc.alpha > 255) + npc.alpha = 255; + } + + // Velocity + npc.velocity *= 0.98f; + npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); + + // Play sound + if (npc.ai[2] == teleportPauseTimer / 2) + modNPC.RoarSoundSlot = SoundEngine.PlaySound(OldDuke.OldDuke.RoarSound, npc.Center); + + if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == teleportPauseTimer / 2) + { + // Teleport location + if (npc.ai[1] == 0f) + npc.ai[1] = 600 * Math.Sign((npc.Center - player.Center).X); + + // Rotation and direction + Vector2 center = player.Center + new Vector2(npc.ai[1], -300f); + Vector2 npcCenter = npc.Center = center; + int phase3TeleportFaceDirection = Math.Sign(player.Center.X - npcCenter.X); + if (phase3TeleportFaceDirection != 0) + { + if (npc.ai[2] == 0f && phase3TeleportFaceDirection != npc.direction) + { + npc.rotation += pie; + for (int n = 0; n < npc.oldPos.Length; n++) + npc.oldPos[n] = Vector2.Zero; + } + + npc.direction = phase3TeleportFaceDirection; + + if (npc.spriteDirection != -npc.direction) + npc.rotation += pie; + + npc.spriteDirection = -npc.direction; + } + } + + npc.ai[2] += 1f; + if (npc.ai[2] >= teleportPauseTimer) + { + npc.ai[0] = 10f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + + npc.ai[3] += 2f; + if (npc.ai[3] >= 9f) + npc.ai[3] = 0f; + + npc.netUpdate = true; + } + } + + // Vomit a huge amount of gore into the sky and call sharks from the sides of the screen + else if (npc.ai[0] == 13f) + { + // Avoid cheap bullshit + npc.damage = 0; + + // Velocity + npc.velocity *= 0.98f; + npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); + + // Play sound + if (npc.ai[2] == attackTimer - 30) + { + SoundEngine.PlaySound(OldDuke.OldDuke.VomitSound, npc.Center); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Vector2 phase3GoreDirection = npc.rotation.ToRotationVector2() * (Vector2.UnitX * npc.direction) * (npc.width + 20) / 2f + npc.Center; + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + int totalGore = Main.getGoodWorld ? 40 : 20; + for (int i = 0; i < totalGore; i++) + { + float velocityX = npc.direction * goreVelocityX * (Main.rand.NextFloat(0.2f, 0.8f) + 0.5f); + float velocityY = goreVelocityY * (Main.rand.NextFloat(0.2f, 0.8f) + 0.5f); + + if (Main.getGoodWorld) + { + velocityX *= Main.rand.NextFloat() + 0.5f; + velocityY *= Main.rand.NextFloat() + 0.5f; + } + + Projectile.NewProjectile(npc.GetSource_FromAI(), phase3GoreDirection.X, phase3GoreDirection.Y, velocityX, -velocityY, type, damage, 0f, Main.myPlayer, 0f, 0f); + } + } + } + + if (npc.ai[2] >= attackTimer - 90) + { + if (npc.ai[2] % 18f == 0f) + { + calamityGlobalNPC.newAI[2] += 150f; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + float x = 900f - calamityGlobalNPC.newAI[2]; + NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + x), (int)(npc.Center.Y - calamityGlobalNPC.newAI[2]), ModContent.NPCType(), 0, 0f, 0f, npc.whoAmI, 0f, 255); + NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X - x), (int)(npc.Center.Y - calamityGlobalNPC.newAI[2]), ModContent.NPCType(), 0, 0f, 0f, npc.whoAmI, 0f, 255); + + if (Main.getGoodWorld) + { + NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + x), (int)(npc.Center.Y - calamityGlobalNPC.newAI[2] * 0.5f), ModContent.NPCType(), 0, 0f, 0f, npc.whoAmI, 0f, 255); + NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X - x), (int)(npc.Center.Y - calamityGlobalNPC.newAI[2] * 0.5f), ModContent.NPCType(), 0, 0f, 0f, npc.whoAmI, 0f, 255); + } + } + } + } + + npc.ai[2] += 1f; + if (npc.ai[2] >= attackTimer) + { + calamityGlobalNPC.newAI[0] += exhaustionIncreasePerAttack; + calamityGlobalNPC.newAI[2] = 0f; + npc.ai[0] = 10f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.TargetClosest(); + npc.netUpdate = true; + } + } + + // Tooth Ball and Vortex spin + else if (npc.ai[0] == 14f) + { + // Set damage + npc.damage = 0; + + // Play sounds and spawn Tooth Balls and a Vortex + if (npc.ai[2] == 0f) + { + modNPC.RoarSoundSlot = SoundEngine.PlaySound(OldDuke.OldDuke.RoarSound, npc.Center); + + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + Vector2 vortexSpawn = npc.Center + npc.velocity.RotatedBy(MathHelper.PiOver2 * -npc.direction) * spinTime / MathHelper.TwoPi; + if (Main.netMode != NetmodeID.MultiplayerClient) + Projectile.NewProjectile(npc.GetSource_FromAI(), vortexSpawn, Vector2.Zero, type, damage, 0f, Main.myPlayer, vortexSpawn.X, vortexSpawn.Y); + } + + if (npc.ai[2] % toothBallSpinPhaseDivisor == 0f) + { + if (npc.ai[2] != 0f) + SoundEngine.PlaySound(OldDuke.OldDuke.VomitSound, npc.Center); + + Vector2 phase3ToothBallDirection = Vector2.Normalize(npc.velocity) * (npc.width + 20) / 2f + npc.Center; + Vector2 toothBallVelocity = Vector2.Normalize(npc.velocity).RotatedBy(MathHelper.PiOver2 * npc.direction) * toothBallSpinToothBallVelocity; + Vector2 toothBallSpawnPos = new Vector2(phase3ToothBallDirection.X, phase3ToothBallDirection.Y + 45f); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int toothBall = NPC.NewNPC(npc.GetSource_FromAI(), (int)toothBallSpawnPos.X, (int)toothBallSpawnPos.Y, ModContent.NPCType(), 0, toothBallVelocity.X, toothBallVelocity.Y); + Main.npc[toothBall].target = npc.target; + Main.npc[toothBall].velocity = Vector2.Normalize(toothBallVelocity) * toothBallSpinToothBallVelocity * 0.5f; + Main.npc[toothBall].netUpdate = true; + Main.npc[toothBall].ai[3] = 60f; + } + + for (int i = 0; i < 50; i++) + { + int dustID; + switch (Main.rand.Next(6)) + { + case 0: + case 1: + case 2: + case 3: + dustID = (int)CalamityDusts.SulphurousSeaAcid; + break; + default: + dustID = DustID.Blood; + break; + } + + // Choose a random speed and angle to belch out the vomit + float dustSpeed = Main.rand.NextFloat(3.0f, 12.0f); + float angleRandom = 0.06f; + Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(toothBallVelocity.ToRotation()); + dustVel = dustVel.RotatedBy(-angleRandom); + dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); + + // Pick a size for the vomit particles + float scale = Main.rand.NextFloat(1f, 2f); + + // Actually spawn the vomit + int idx = Dust.NewDust(toothBallSpawnPos, 40, 40, dustID, dustVel.X, dustVel.Y, 0, default, scale); + Main.dust[idx].noGravity = true; + } + } + + // Velocity and rotation + npc.velocity = npc.velocity.RotatedBy(-(double)spinSpeed * npc.direction); + npc.rotation -= spinSpeed * npc.direction; + + npc.ai[2] += 1f; + if (npc.ai[2] >= toothBallSpinTimer) + { + calamityGlobalNPC.newAI[0] += exhaustionIncreasePerAttack; + npc.ai[0] = 10f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.TargetClosest(); + npc.netUpdate = true; + } + } + + if (SoundEngine.TryGetActiveSound(modNPC.RoarSoundSlot, out var roarSound) && roarSound.IsPlaying) + { + roarSound.Position = npc.Center; + } + } + } +} diff --git a/NPCs/CalamityAIs/CalamityRegularEnemyAIs/CalamityRegularEnemyAI.cs b/NPCs/CalamityAIs/CalamityRegularEnemyAIs/CalamityRegularEnemyAI.cs new file mode 100644 index 0000000000..0d84546947 --- /dev/null +++ b/NPCs/CalamityAIs/CalamityRegularEnemyAIs/CalamityRegularEnemyAI.cs @@ -0,0 +1,754 @@ +using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.CalPlayer; +using CalamityMod.Dusts; +using CalamityMod.Events; +using CalamityMod.NPCs.Abyss; +using CalamityMod.NPCs.AquaticScourge; +using CalamityMod.NPCs.AstrumAureus; +using CalamityMod.NPCs.AstrumDeus; +using CalamityMod.NPCs.BrimstoneElemental; +using CalamityMod.NPCs.Bumblebirb; +using CalamityMod.NPCs.CalClone; +using CalamityMod.NPCs.CeaselessVoid; +using CalamityMod.NPCs.Crags; +using CalamityMod.NPCs.NormalNPCs; +using CalamityMod.NPCs.OldDuke; +using CalamityMod.NPCs.SulphurousSea; +using CalamityMod.NPCs.SunkenSea; +using CalamityMod.Projectiles.Boss; +using CalamityMod.Projectiles.Enemy; +using CalamityMod.Sounds; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs +{ + public static class CalamityRegularEnemyAI + { + #region Gem Crawler AI + public static void GemCrawlerAI(NPC npc, Mod mod, float speedDetect, float speedAdditive) + { + int turnAroundDelay = 30; + bool unusedFlag = false; + bool isRunning = false; + bool shouldTurnAround = false; + if (npc.velocity.Y == 0f && ((npc.velocity.X > 0f && npc.direction > 0) || (npc.velocity.X < 0f && npc.direction < 0))) + { + isRunning = true; + npc.ai[3] += 1f; + } + if ((npc.position.X == npc.oldPosition.X || npc.ai[3] >= (float)turnAroundDelay) | isRunning) + { + npc.ai[3] += 1f; + shouldTurnAround = true; + } + else if (npc.ai[3] > 0f) + { + npc.ai[3] -= 1f; + } + if (npc.ai[3] > (float)(turnAroundDelay * 10)) + { + npc.ai[3] = 0f; + } + if (npc.justHit) + { + npc.ai[3] = 0f; + } + if (npc.ai[3] == (float)turnAroundDelay) + { + npc.netUpdate = true; + } + Vector2 npcPos = new Vector2(npc.Center.X, npc.Center.Y); + float xDist = Main.player[npc.target].Center.X - npcPos.X; + float yDist = Main.player[npc.target].Center.Y - npcPos.Y; + float targetDist = (float)Math.Sqrt((double)(xDist * xDist + yDist * yDist)); + if (targetDist < 200f && !shouldTurnAround) + { + npc.ai[3] = 0f; + } + if (npc.ai[3] < (float)turnAroundDelay) + { + npc.TargetClosest(true); + } + else + { + if (npc.velocity.X == 0f) + { + if (npc.velocity.Y == 0f) + { + npc.ai[0] += 1f; + if (npc.ai[0] >= 2f) + { + npc.direction *= -1; + npc.spriteDirection = -npc.direction; + npc.ai[0] = 0f; + } + } + } + else + { + npc.ai[0] = 0f; + } + npc.directionY = -1; + if (npc.direction == 0) + { + npc.direction = 1; + } + } + float maxVelocity = speedDetect; //5 + float acceleration = speedAdditive; //0.05 + if (!unusedFlag && (npc.velocity.Y == 0f || npc.wet || (npc.velocity.X <= 0f && npc.direction > 0) || (npc.velocity.X >= 0f && npc.direction < 0))) + { + if (npc.velocity.X < -maxVelocity || npc.velocity.X > maxVelocity) + { + if (npc.velocity.Y == 0f) + { + npc.velocity *= 0.8f; + } + } + else if (npc.velocity.X < maxVelocity && npc.direction == -1) + { + npc.velocity.X = npc.velocity.X + acceleration; + if (npc.velocity.X > maxVelocity) + { + npc.velocity.X = maxVelocity; + } + } + else if (npc.velocity.X > -maxVelocity && npc.direction == 1) + { + npc.velocity.X = npc.velocity.X - acceleration; + if (npc.velocity.X < -maxVelocity) + { + npc.velocity.X = -maxVelocity; + } + } + } + if (npc.velocity.Y >= 0f) + { + int faceDirection = 0; + if (npc.velocity.X < 0f) + { + faceDirection = -1; + } + if (npc.velocity.X > 0f) + { + faceDirection = 1; + } + Vector2 position = npc.position; + position.X += npc.velocity.X; + int x = (int)((position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 1) * faceDirection)) / 16f); + int y = (int)((position.Y + (float)npc.height - 1f) / 16f); + if ((float)(x * 16) < position.X + (float)npc.width && (float)(x * 16 + 16) > position.X && ((Main.tile[x, y].HasUnactuatedTile && !Main.tile[x, y].TopSlope && !Main.tile[x, y - 1].TopSlope && Main.tileSolid[(int)Main.tile[x, y].TileType] && !Main.tileSolidTop[(int)Main.tile[x, y].TileType]) || (Main.tile[x, y - 1].IsHalfBlock && Main.tile[x, y - 1].HasUnactuatedTile)) && (!Main.tile[x, y - 1].HasUnactuatedTile || !Main.tileSolid[(int)Main.tile[x, y - 1].TileType] || Main.tileSolidTop[(int)Main.tile[x, y - 1].TileType] || (Main.tile[x, y - 1].IsHalfBlock && (!Main.tile[x, y - 4].HasUnactuatedTile || !Main.tileSolid[(int)Main.tile[x, y - 4].TileType] || Main.tileSolidTop[(int)Main.tile[x, y - 4].TileType]))) && (!Main.tile[x, y - 2].HasUnactuatedTile || !Main.tileSolid[(int)Main.tile[x, y - 2].TileType] || Main.tileSolidTop[(int)Main.tile[x, y - 2].TileType]) && (!Main.tile[x, y - 3].HasUnactuatedTile || !Main.tileSolid[(int)Main.tile[x, y - 3].TileType] || Main.tileSolidTop[(int)Main.tile[x, y - 3].TileType]) && (!Main.tile[x - faceDirection, y - 3].HasUnactuatedTile || !Main.tileSolid[(int)Main.tile[x - faceDirection, y - 3].TileType])) + { + float npcBottom = (float)(y * 16); + if (Main.tile[x, y].IsHalfBlock) + { + npcBottom += 8f; + } + if (Main.tile[x, y - 1].IsHalfBlock) + { + npcBottom -= 8f; + } + if (npcBottom < position.Y + (float)npc.height) + { + float percentageTileRisen = position.Y + (float)npc.height - npcBottom; + if (percentageTileRisen <= 16.1f) + { + npc.gfxOffY += npc.position.Y + (float)npc.height - npcBottom; + npc.position.Y = npcBottom - (float)npc.height; + if (percentageTileRisen < 9f) + { + npc.stepSpeed = 1f; + } + else + { + npc.stepSpeed = 2f; + } + } + } + } + } + } + #endregion + + #region Dungeon Spirit AI + public static void DungeonSpiritAI(NPC npc, Mod mod, float speed, float rotation, bool lantern = false) + { + npc.TargetClosest(true); + Vector2 npcPos = new Vector2(npc.Center.X, npc.Center.Y); + float xDist = Main.player[npc.target].Center.X - npcPos.X; + float yDist = Main.player[npc.target].Center.Y - npcPos.Y; + float targetDist = (float)Math.Sqrt((double)(xDist * xDist + yDist * yDist)); + float homingSpeed = speed; + + if (lantern) + { + if (npc.localAI[0] < 85f) + { + homingSpeed = 0.1f; + targetDist = homingSpeed / targetDist; + xDist *= targetDist; + yDist *= targetDist; + npc.velocity = (npc.velocity * 100f + new Vector2(xDist, yDist)) / 101f; + npc.localAI[0] += 1f; + return; + } + + npc.dontTakeDamage = false; + } + + targetDist = homingSpeed / targetDist; + xDist *= targetDist; + yDist *= targetDist; + npc.velocity.X = (npc.velocity.X * 100f + xDist) / 101f; + npc.velocity.Y = (npc.velocity.Y * 100f + yDist) / 101f; + + if (lantern) + { + npc.rotation = npc.velocity.X * 0.08f; + npc.spriteDirection = (npc.direction > 0) ? 1 : -1; + } + else + npc.rotation = (float)Math.Atan2((double)yDist, (double)xDist) + rotation; + } + #endregion + + #region Unicorn AI + public static void UnicornAI(NPC npc, Mod mod, bool spin, float bounciness, float speedDetect, float speedAdditive, float bouncy1 = -8.5f, float bouncy2 = -7.5f, float bouncy3 = -7f, float bouncy4 = -6f, float bouncy5 = -8f) + { + bool DogPhase1 = npc.type == ModContent.NPCType() && npc.life > npc.lifeMax * (CalamityWorld.death ? 0.9 : CalamityWorld.revenge ? 0.7 : 0.5); + bool DogPhase2 = npc.type == ModContent.NPCType() && npc.life <= npc.lifeMax * (CalamityWorld.death ? 0.9 : CalamityWorld.revenge ? 0.7 : 0.5); + int turnAroundDelay = 30; + bool isRunning = false; + bool shouldTurnAround = false; + if (npc.velocity.Y == 0f && ((npc.velocity.X > 0f && npc.direction < 0) || (npc.velocity.X < 0f && npc.direction > 0))) + { + isRunning = true; + npc.ai[3] += 1f; + } + int turnAroundDelayMult = DogPhase1 ? 10 : 4; + if (!DogPhase1) + { + bool noYVelocity = npc.velocity.Y == 0f; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (i != npc.whoAmI && Main.npc[i].active && Main.npc[i].type == npc.type && Math.Abs(npc.position.X - Main.npc[i].position.X) + Math.Abs(npc.position.Y - Main.npc[i].position.Y) < (float)npc.width) + { + if (npc.position.X < Main.npc[i].position.X) + { + npc.velocity.X -= 0.05f; + } + else + { + npc.velocity.X += 0.05f; + } + if (npc.position.Y < Main.npc[i].position.Y) + { + npc.velocity.Y -= 0.05f; + } + else + { + npc.velocity.Y += 0.05f; + } + } + } + if (noYVelocity) + { + npc.velocity.Y = 0f; + } + } + if (npc.position.X == npc.oldPosition.X || npc.ai[3] >= (float)turnAroundDelay || isRunning) + { + npc.ai[3] += 1f; + shouldTurnAround = true; + } + else if (npc.ai[3] > 0f) + { + npc.ai[3] -= 1f; + } + if (npc.ai[3] > (float)(turnAroundDelay * turnAroundDelayMult)) + { + npc.ai[3] = 0f; + } + if (npc.justHit) + { + npc.ai[3] = 0f; + } + if (npc.ai[3] == (float)turnAroundDelay) + { + npc.netUpdate = true; + } + Vector2 npcPos = new Vector2(npc.Center.X, npc.Center.Y); + float xDist = Main.player[npc.target].Center.X - npcPos.X; + float yDist = Main.player[npc.target].Center.Y - npcPos.Y; + float targetDist = (float)Math.Sqrt((double)(xDist * xDist + yDist * yDist)); + if (targetDist < 200f && !shouldTurnAround) + { + npc.ai[3] = 0f; + } + if (!DogPhase1) + { + if (npc.velocity.Y == 0f && Math.Abs(npc.velocity.X) > 3f && ((npc.Center.X < Main.player[npc.target].Center.X && npc.velocity.X > 0f) || (npc.Center.X > Main.player[npc.target].Center.X && npc.velocity.X < 0f))) + { + npc.velocity.Y -= bounciness; + if (npc.type == ModContent.NPCType()) + { + SoundEngine.PlaySound(SoundID.Item14, npc.Center); + for (int k = 0; k < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Brimstone, 0f, -1f, 0, default, 1f); + } + if (Main.zenithWorld) + { + float screenShakePower = 2 * Utils.GetLerpValue(1300f, 0f, npc.Distance(Main.LocalPlayer.Center), true); + if (Main.LocalPlayer.Calamity().GeneralScreenShakePower < screenShakePower) + Main.LocalPlayer.Calamity().GeneralScreenShakePower = screenShakePower; + } + } + if (npc.type == ModContent.NPCType()) + { + SoundEngine.PlaySound(SoundID.NPCHit7, npc.Center); + } + if (DogPhase2) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Water, 0f, -1f, 0, default, 1f); + } + } + if (npc.type == ModContent.NPCType() || npc.type == ModContent.NPCType()) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Water, 0f, -1f, 0, default, 1f); + } + } + } + } + if (npc.ai[3] < (float)turnAroundDelay) + { + npc.TargetClosest(true); + } + else + { + if (npc.velocity.X == 0f) + { + if (npc.velocity.Y == 0f) + { + npc.ai[0] += 1f; + if (npc.ai[0] >= 2f) + { + npc.direction *= -1; + npc.spriteDirection = npc.direction; + npc.ai[0] = 0f; + } + } + } + else + { + npc.ai[0] = 0f; + } + npc.directionY = -1; + if (npc.direction == 0) + { + npc.direction = 1; + } + } + + if (npc.velocity.Y == 0f || npc.wet || (npc.velocity.X <= 0f && npc.direction < 0) || (npc.velocity.X >= 0f && npc.direction > 0)) + { + if (Math.Sign(npc.velocity.X) != npc.direction && !DogPhase1) + { + npc.velocity.X *= 0.92f; + } + float sandstormPush = MathHelper.Lerp(0.6f, 1f, Math.Abs(Main.windSpeedCurrent)) * (float)Math.Sign(Main.windSpeedCurrent); + if (!Main.player[npc.target].ZoneSandstorm) + { + sandstormPush = 0f; + } + float maxVelocity = speedDetect; + float acceleration = speedAdditive; + if (npc.velocity.X < -maxVelocity || npc.velocity.X > maxVelocity) + { + if (npc.velocity.Y == 0f) + { + npc.velocity *= 0.8f; + } + } + else if (npc.velocity.X < maxVelocity && npc.direction == 1) + { + npc.velocity.X += acceleration; + if (npc.velocity.X > maxVelocity) + { + npc.velocity.X = maxVelocity; + } + } + else if (npc.velocity.X > -maxVelocity && npc.direction == -1) + { + npc.velocity.X -= acceleration; + if (npc.velocity.X < -maxVelocity) + { + npc.velocity.X = -maxVelocity; + } + } + } + if (npc.velocity.Y >= 0f) + { + int faceDirection = 0; + if (npc.velocity.X < 0f) + { + faceDirection = -1; + } + if (npc.velocity.X > 0f) + { + faceDirection = 1; + } + Vector2 position = npc.position; + position.X += npc.velocity.X; + int x = (int)((position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 1) * faceDirection)) / 16f); + int y = (int)((position.Y + (float)npc.height - 1f) / 16f); + + // 21JAN2023: Ozzatron -- this is probably the single most unmaintainable if statement I've ever seen + // I have broken all the individual statements out even though I do not fully understand the code. + Tile t_xy = CalamityUtils.ParanoidTileRetrieval(x, y); + Tile t_xy1 = CalamityUtils.ParanoidTileRetrieval(x, y - 1); + Tile t_xy2 = CalamityUtils.ParanoidTileRetrieval(x, y - 2); + Tile t_xy3 = CalamityUtils.ParanoidTileRetrieval(x, y - 3); + Tile t_xOffY3 = CalamityUtils.ParanoidTileRetrieval(x - faceDirection, y - 3); // 3 down, offset 1 in the direction of the NPC's movement + Tile t_xy4 = CalamityUtils.ParanoidTileRetrieval(x, y - 4); + bool positionCheck = (float)(x * 16) < position.X + (float)npc.width && (float)(x * 16 + 16) > position.X; + bool tileSolidityCheck1 = t_xy.HasUnactuatedTile && !t_xy.TopSlope && !t_xy1.TopSlope && Main.tileSolid[t_xy.TileType] && !Main.tileSolidTop[t_xy.TileType]; + bool oneBelowIsSolidHalf = t_xy1.IsHalfBlock && t_xy1.HasUnactuatedTile; + bool canFallThrough = !t_xy1.HasUnactuatedTile || !Main.tileSolid[t_xy1.TileType] || Main.tileSolidTop[t_xy1.TileType] || (t_xy1.IsHalfBlock && (!t_xy4.HasUnactuatedTile || !Main.tileSolid[t_xy4.TileType] || Main.tileSolidTop[t_xy4.TileType])); + bool twoDownIsNonSolid = !t_xy2.HasUnactuatedTile || !Main.tileSolid[t_xy2.TileType] || Main.tileSolidTop[t_xy2.TileType]; + bool threeDownIsNonSolid = !t_xy3.HasUnactuatedTile || !Main.tileSolid[t_xy3.TileType] || Main.tileSolidTop[t_xy3.TileType]; + // Notice it doesn't check for platforms in ther offset position. This is why walking AIs twirl on 1-wide platforms in hellevators. They have to turn around before this check succeeds. + bool threeDownOffsetIsNonSolid = !t_xOffY3.HasUnactuatedTile || !Main.tileSolid[t_xOffY3.TileType]; + if (positionCheck && (tileSolidityCheck1 || oneBelowIsSolidHalf) && canFallThrough && twoDownIsNonSolid && threeDownIsNonSolid && threeDownOffsetIsNonSolid) + { + float tilePixelPosition = (float)(y * 16); + if (Main.tile[x, y].IsHalfBlock) + { + tilePixelPosition += 8f; + } + if (Main.tile[x, y - 1].IsHalfBlock) + { + tilePixelPosition -= 8f; + } + if (tilePixelPosition < position.Y + (float)npc.height) + { + float percentageTileRisen = position.Y + (float)npc.height - tilePixelPosition; + if ((double)percentageTileRisen <= 16.1) + { + npc.gfxOffY += npc.position.Y + (float)npc.height - tilePixelPosition; + npc.position.Y = tilePixelPosition - (float)npc.height; + if (percentageTileRisen < 9f) + { + npc.stepSpeed = 1f; + } + else + { + npc.stepSpeed = 2f; + } + } + } + } + } + if (npc.velocity.Y == 0f) + { + int npcTileX = (int)((npc.position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 2) * npc.direction) + npc.velocity.X * 5f) / 16f); + int npcTileY = (int)((npc.position.Y + (float)npc.height - 15f) / 16f); + int spriteDirection = npc.spriteDirection; + spriteDirection *= -1; + if ((npc.velocity.X < 0f && spriteDirection == -1) || (npc.velocity.X > 0f && spriteDirection == 1)) + { + if (Main.tile[npcTileX, npcTileY - 2].HasUnactuatedTile && Main.tileSolid[(int)Main.tile[npcTileX, npcTileY - 2].TileType]) + { + if (Main.tile[npcTileX, npcTileY - 3].HasUnactuatedTile && Main.tileSolid[(int)Main.tile[npcTileX, npcTileY - 3].TileType]) + { + npc.velocity.Y = bouncy1; + npc.netUpdate = true; + } + else + { + npc.velocity.Y = bouncy2; + npc.netUpdate = true; + } + } + else if (Main.tile[npcTileX, npcTileY - 1].HasUnactuatedTile && !Main.tile[npcTileX, npcTileY - 1].TopSlope && Main.tileSolid[(int)Main.tile[npcTileX, npcTileY - 1].TileType]) + { + npc.velocity.Y = bouncy3; + npc.netUpdate = true; + } + else if (npc.position.Y + (float)npc.height - (float)(npcTileY * 16) > 20f && Main.tile[npcTileX, npcTileY].HasUnactuatedTile && !Main.tile[npcTileX, npcTileY].TopSlope && Main.tileSolid[(int)Main.tile[npcTileX, npcTileY].TileType]) + { + npc.velocity.Y = bouncy4; + npc.netUpdate = true; + } + else if ((npc.directionY < 0 || Math.Abs(npc.velocity.X) > 3f) && (!Main.tile[npcTileX, npcTileY + 1].HasUnactuatedTile || !Main.tileSolid[(int)Main.tile[npcTileX, npcTileY + 1].TileType]) && (!Main.tile[npcTileX, npcTileY + 2].HasUnactuatedTile || !Main.tileSolid[(int)Main.tile[npcTileX, npcTileY + 2].TileType]) && (!Main.tile[npcTileX + npc.direction, npcTileY + 3].HasUnactuatedTile || !Main.tileSolid[(int)Main.tile[npcTileX + npc.direction, npcTileY + 3].TileType])) + { + npc.velocity.Y = bouncy5; + npc.netUpdate = true; + } + } + } + if (spin) + { + npc.rotation += npc.velocity.X * 0.05f; + npc.spriteDirection = -npc.direction; + } + } + #endregion + + #region Swimming AI + // Passiveness: + // 0 = Catfish, Flounder, Frogfish, Viperfish, Moray Eel, Laserfish + // 1 = Blinded Angler + // 2 = Prism-Back, Toxic Minnow + // 3 = Sea Minnow + public static void PassiveSwimmingAI(NPC npc, Mod mod, int passiveness, float detectRange, float xSpeed, float ySpeed, float speedLimitX, float speedLimitY, float rotation, bool spriteFacesLeft = true) + { + if (spriteFacesLeft) + npc.spriteDirection = (npc.direction > 0) ? 1 : -1; + else + npc.spriteDirection = (npc.direction > 0) ? -1 : 1; + + npc.noGravity = true; + if (npc.direction == 0) + { + npc.TargetClosest(true); + } + Player target = Main.player[npc.target]; + if (npc.justHit && passiveness != 3) + { + npc.chaseable = true; + } + if (npc.wet) + { + bool hasWetTarget = npc.chaseable; + npc.TargetClosest(false); + target = Main.player[npc.target]; + // Player detection behavior + if (passiveness != 2) + { + if (npc.type == ModContent.NPCType()) + { + if (target.wet && !target.dead) + { + hasWetTarget = true; + npc.chaseable = true; //once the enemy has detected the player, let minions fuck it up + } + } + if (npc.type == ModContent.NPCType()) + { + if (!target.dead) + { + hasWetTarget = true; + npc.chaseable = true; //once the enemy has detected the player, let minions fuck it up + } + } + else if (target.wet && !target.dead && (target.Center - npc.Center).Length() < detectRange && + Collision.CanHit(npc.position, npc.width, npc.height, target.position, target.width, target.height)) + { + hasWetTarget = true; + npc.chaseable = true; //once the enemy has detected the player, let minions fuck it up + } + else + { + if (passiveness == 1) + { + hasWetTarget = false; + } + } + } + if ((target.dead || !Collision.CanHit(npc.position, npc.width, npc.height, target.position, target.width, target.height)) && hasWetTarget) + { + hasWetTarget = false; + } + + // Swim back and forth + if (!hasWetTarget || passiveness == 2) + { + if (passiveness == 0) + { + npc.TargetClosest(true); + target = Main.player[npc.target]; + } + if (npc.collideX) + { + npc.velocity.X = npc.velocity.X * -1f; + npc.direction *= -1; + npc.netUpdate = true; + } + if (npc.collideY) + { + npc.netUpdate = true; + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = Math.Abs(npc.velocity.Y) * -1f; + npc.directionY = -1; + npc.ai[0] = -1f; + } + else if (npc.velocity.Y < 0f) + { + npc.velocity.Y = Math.Abs(npc.velocity.Y); + npc.directionY = 1; + npc.ai[0] = 1f; + } + } + } + + if (hasWetTarget && passiveness != 2) + { + npc.TargetClosest(true); + target = Main.player[npc.target]; + // Swim away from the player + if (passiveness == 3) + { + npc.velocity.X = npc.velocity.X - (float)npc.direction * xSpeed; + npc.velocity.Y = npc.velocity.Y - (float)npc.directionY * ySpeed; + } + // Swim toward the player + else + { + npc.velocity.X = npc.velocity.X + (float)npc.direction * (CalamityWorld.death ? 2f * xSpeed : CalamityWorld.revenge ? 1.5f * xSpeed : xSpeed); + npc.velocity.Y = npc.velocity.Y + (float)npc.directionY * (CalamityWorld.death ? 2f * ySpeed : CalamityWorld.revenge ? 1.5f * ySpeed : ySpeed); + } + float velocityCapX = CalamityWorld.death && passiveness != 3 ? 2f * speedLimitX : CalamityWorld.revenge ? 1.5f * speedLimitX : speedLimitX; + float velocityCapY = CalamityWorld.death && passiveness != 3 ? 2f * speedLimitY : CalamityWorld.revenge ? 1.5f * speedLimitY : speedLimitY; + npc.velocity.X = MathHelper.Clamp(npc.velocity.X, -velocityCapX, velocityCapX); + npc.velocity.Y = MathHelper.Clamp(npc.velocity.Y, -velocityCapY, velocityCapY); + + if (npc.justHit) + npc.localAI[0] = 0f; + + // Laserfish shoot the player + if (npc.type == ModContent.NPCType()) + { + npc.localAI[0] += (CalamityWorld.death ? 2f : CalamityWorld.revenge ? 1.5f : 1f); + if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] >= 120f) + { + npc.localAI[0] = 0f; + if (Collision.CanHit(npc.position, npc.width, npc.height, target.position, target.width, target.height)) + { + float speed = 5f; + Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)(npc.height / 2)); + float velX = target.Center.X - vector.X + Main.rand.NextFloat(-20f, 20f); + float velY = target.Center.Y - vector.Y + Main.rand.NextFloat(-20f, 20f); + float dist = (float)Math.Sqrt((double)(velX * velX + velY * velY)); + dist = speed / dist; + velX *= dist; + velY *= dist; + int damage = Main.masterMode ? 34 : Main.expertMode ? 40 : 50; + int beam = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X + (npc.spriteDirection == 1 ? 25f : -25f), npc.Center.Y + (target.position.Y > npc.Center.Y ? 5f : -5f), velX, velY, ProjectileID.EyeBeam, damage, 0f, Main.myPlayer); + Main.projectile[beam].tileCollide = true; + } + } + } + + // Flounder shoot Sulphuric Mist at the player + if (npc.type == ModContent.NPCType()) + { + if ((target.Center - npc.Center).Length() < 350f) + { + npc.localAI[0] += (CalamityWorld.death ? 3f : CalamityWorld.revenge ? 2f : 1f); + if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] >= 180f) + { + npc.localAI[0] = 0f; + if (Collision.CanHit(npc.position, npc.width, npc.height, target.position, target.width, target.height)) + { + float speed = 4f; + Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)(npc.height / 2)); + float velX = target.Center.X - vector.X + Main.rand.NextFloat(-20f, 20f); + float velY = target.Center.Y - vector.Y + Main.rand.NextFloat(-20f, 20f); + float dist = (float)Math.Sqrt((double)(velX * velX + velY * velY)); + dist = speed / dist; + velX *= dist; + velY *= dist; + int damage = Main.masterMode ? 21 : Main.expertMode ? 25 : 35; + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X + (npc.spriteDirection == 1 ? 10f : -10f), npc.Center.Y, velX, velY, ModContent.ProjectileType(), damage, 0f, Main.myPlayer); + } + } + } + } + + // Sea Minnows face away from the player + if (npc.type == ModContent.NPCType()) + { + npc.direction *= -1; + } + } + else + { + // No target behavior + npc.velocity.X += (float)npc.direction * 0.1f; + if (npc.velocity.X < -2.5f || npc.velocity.X > 2.5f) + { + npc.velocity.X *= 0.95f; + } + if (npc.ai[0] == -1f) + { + npc.velocity.Y -= 0.01f; + if (npc.velocity.Y < -0.3f) + { + npc.ai[0] = 1f; + } + } + else + { + npc.velocity.Y += 0.01f; + if (npc.velocity.Y > 0.3f) + { + npc.ai[0] = -1f; + } + } + } + int npcTileX = (int)(npc.position.X + (float)(npc.width / 2)) / 16; + int npcTileY = (int)(npc.position.Y + (float)(npc.height / 2)) / 16; + if (Main.tile[npcTileX, npcTileY - 1].LiquidAmount > 128) + { + if (Main.tile[npcTileX, npcTileY + 1].HasTile) + { + npc.ai[0] = -1f; + } + else if (Main.tile[npcTileX, npcTileY + 2].HasTile) + { + npc.ai[0] = -1f; + } + } + if (npc.velocity.Y > 0.4f || npc.velocity.Y < -0.4f) + { + npc.velocity.Y = npc.velocity.Y * 0.95f; + } + } + else + { + // Out of water behavior + if (npc.velocity.Y == 0f) + { + npc.velocity.X = npc.velocity.X * 0.94f; + if (npc.velocity.X > -0.2f && npc.velocity.X < 0.2f) + { + npc.velocity.X = 0f; + } + } + npc.velocity.Y = npc.velocity.Y + 0.4f; + if (npc.velocity.Y > 12f) + { + npc.velocity.Y = 12f; + } + npc.ai[0] = 1f; + } + npc.rotation = npc.velocity.Y * (float)npc.direction * rotation; + float rotationLimit = 2f * rotation; + npc.rotation = MathHelper.Clamp(npc.rotation, -rotationLimit, rotationLimit); + } + #endregion + } +} diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 32d244820c..7a85115865 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -45,22 +45,28 @@ using CalamityMod.NPCs.Ravager; using CalamityMod.NPCs.SlimeGod; using CalamityMod.NPCs.StormWeaver; using CalamityMod.NPCs.SupremeCalamitas; -using CalamityMod.NPCs.VanillaNPCOverrides.Bosses; -using CalamityMod.NPCs.VanillaNPCOverrides.RegularEnemies; +using CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses; +using CalamityMod.NPCs.VanillaNPCAIOverrides.RegularEnemies; using CalamityMod.Particles; using CalamityMod.Projectiles; using CalamityMod.Projectiles.Magic; using CalamityMod.Projectiles.Melee; +using CalamityMod.Projectiles.Ranged; using CalamityMod.Projectiles.Rogue; using CalamityMod.Projectiles.Summon; using CalamityMod.Projectiles.Typeless; using CalamityMod.Systems; +using CalamityMod.Tiles.FurnitureAuric; +using CalamityMod.Tiles.Ores; using CalamityMod.UI; +using CalamityMod.UI.DebuffSystem; using CalamityMod.Walls.DraedonStructures; using CalamityMod.World; +using Microsoft.CodeAnalysis; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.DataStructures; using Terraria.Enums; using Terraria.GameContent; @@ -116,12 +122,12 @@ namespace CalamityMod.NPCs public bool IncreasedColdEffects_CryoStone = false; // Transformer effect - public bool IncreasedElectricityEffects_Transformer = false; // Fireball, Cinnamon Roll and Hellfire Treads effects public bool IncreasedHeatEffects_Fireball = false; public bool IncreasedHeatEffects_CinnamonRoll = false; + public bool IncreasedHeatEffects_FlameWakerBoots = false; public bool IncreasedHeatEffects_HellfireTreads = false; // Toxic Heart effect @@ -152,12 +158,32 @@ namespace CalamityMod.NPCs public const float CatchUpDistance200Tiles = 3200f; public const float CatchUpDistance350Tiles = 5600f; + /// + /// Destroyer laser colors, used for telegraphs + /// None = -1, Red = 0, Green = 1, Cyan = 2 + /// + public int destroyerLaserColor = -1; + // Boss Zen distance private const float BossZenDistance = 6400f; // Used to nerf desert prehardmode enemies pre-Desert Scourge private const double DesertEnemyStatMultiplier = 0.75; + // Used to nerf Master Mode enemies + public const double MasterModeEnemyHPMultiplier = 0.75; + public const double MasterModeEnemyDamageMultiplier = 0.9; + + // Used to nerf Expert and Master Mode enemies + public const float ExpertModeEnemyKnockbackMultiplier = 0.05f; + public const float MasterModeEnemyKnockbackMultiplier = 0.1f; + + // HP and damage multipliers for the Early Hardmode Progression Rework + public const double EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Classic = 0.8; + public const double EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Classic = 0.9; + public const double EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert = 0.9; + public const double EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert = 0.95; + // Used to increase coin drops in Normal Mode private const double NPCValueMultiplier_NormalCalamity = 1.5; @@ -167,9 +193,6 @@ namespace CalamityMod.NPCs // Used to change the Expert Mode coin drop multiplier private const double NPCValueMultiplier_ExpertCalamity = 1.5; - // Max velocity used in contact damage scaling - public float maxVelocity = 0f; - // Dash damage immunity timer public const int maxPlayerImmunities = Main.maxPlayers + 1; public int[] dashImmunityTime = new int[maxPlayerImmunities]; @@ -203,6 +226,10 @@ namespace CalamityMod.NPCs public const int knockbackResistanceMin = 180; public int knockbackResistanceTimer = 0; + // Used for particle drawing on NPCs affected by vanilla Cobalt/Mythril weapons + public bool isNerfedByCobalt = false; + public bool isNerfedByMythril = false; + // Debuffs public int vaporfied = 0; public int timeSlow = 0; @@ -226,6 +253,11 @@ namespace CalamityMod.NPCs public int aCrunch = 0; public int crumble = 0; + public const int veriumDoomTime = 90; + public int veriumDoomTimer = 0; + public int veriumDoomStacks = 0; + public bool veriumDoomMarked = false; + // Soma Prime Shred deals damage with DirectStrikes instead of with direct debuff damage // It also stacks, scales with ranged damage, and can crit, meaning it needs to know who applied it most recently public int somaShredStacks = 0; @@ -375,6 +407,7 @@ namespace CalamityMod.NPCs myClone.IncreasedElectricityEffects_Transformer = IncreasedElectricityEffects_Transformer; myClone.IncreasedHeatEffects_Fireball = IncreasedHeatEffects_Fireball; myClone.IncreasedHeatEffects_CinnamonRoll = IncreasedHeatEffects_CinnamonRoll; + myClone.IncreasedHeatEffects_FlameWakerBoots = IncreasedHeatEffects_FlameWakerBoots; myClone.IncreasedHeatEffects_HellfireTreads = IncreasedHeatEffects_HellfireTreads; myClone.IncreasedSicknessEffects_ToxicHeart = IncreasedSicknessEffects_ToxicHeart; myClone.IncreasedSicknessAndWaterEffects_EvergreenGin = IncreasedSicknessAndWaterEffects_EvergreenGin; @@ -387,7 +420,7 @@ namespace CalamityMod.NPCs myClone.miscDefenseLoss = miscDefenseLoss; - myClone.maxVelocity = maxVelocity; + myClone.destroyerLaserColor = destroyerLaserColor; myClone.dashImmunityTime = new int[maxPlayerImmunities]; for (int i = 0; i < maxPlayerImmunities; ++i) @@ -414,6 +447,9 @@ namespace CalamityMod.NPCs myClone.bossCanBeKnockedBack = bossCanBeKnockedBack; myClone.knockbackResistanceTimer = knockbackResistanceTimer; + myClone.isNerfedByCobalt = isNerfedByCobalt; + myClone.isNerfedByMythril = isNerfedByMythril; + myClone.vaporfied = vaporfied; myClone.timeSlow = timeSlow; myClone.gState = gState; @@ -436,6 +472,10 @@ namespace CalamityMod.NPCs myClone.aCrunch = aCrunch; myClone.crumble = crumble; + myClone.veriumDoomTimer = veriumDoomTimer; + myClone.veriumDoomStacks = veriumDoomStacks; + myClone.veriumDoomMarked = veriumDoomMarked; + myClone.somaShredStacks = somaShredStacks; myClone.somaShredApplicator = somaShredApplicator; myClone.somaShredFalloff = somaShredFalloff; @@ -653,16 +693,16 @@ namespace CalamityMod.NPCs Item heldItem = Main.player[owner].ActiveItem(); int totalDamage = (int)Main.player[owner].GetTotalDamage().ApplyTo(150f); bool forbidden = Main.player[owner].head == ArmorIDs.Head.AncientBattleArmor && Main.player[owner].body == ArmorIDs.Body.AncientBattleArmor && Main.player[owner].legs == ArmorIDs.Legs.AncientBattleArmor; - bool reducedNerf = Main.player[owner].Calamity().fearmongerSet || (forbidden && heldItem.CountsAsClass()); + bool negateNerf = Main.player[owner].Calamity().fearmongerSet || (forbidden && heldItem.CountsAsClass()); - double summonNerfMult = reducedNerf ? 0.75 : 0.5; + double summonNerfMult = negateNerf ? 1 : 0.75; if (!Main.player[owner].Calamity().profanedCrystalBuffs) { if (heldItem.type > ItemID.None) { if (!heldItem.CountsAsClass() && (heldItem.CountsAsClass() || heldItem.CountsAsClass() || heldItem.CountsAsClass() || heldItem.CountsAsClass()) && - heldItem.hammer == 0 && heldItem.pick == 0 && heldItem.axe == 0 && heldItem.useStyle != 0 && + heldItem.hammer == 0 && heldItem.pick == 0 && heldItem.axe == 0 && heldItem.useStyle != ItemUseStyleID.None && !heldItem.accessory && heldItem.ammo == AmmoID.None) { totalDamage = (int)(totalDamage * summonNerfMult); @@ -763,7 +803,7 @@ namespace CalamityMod.NPCs if (VulnerableToHeat.Value) heatDamageMult *= slimed ? ((wormBoss || slimeGod) ? 1.25 : 1.5) : ((wormBoss || slimeGod) ? VulnerableToDoTDamageMult_Worms_SlimeGod : VulnerableToDoTDamageMult); else - heatDamageMult *= slimed ? 0.2 : 0.5; + heatDamageMult *= slimed ? ((wormBoss || slimeGod) ? 0.66 : 0.5) : 0.5; } double coldDamageMult = BaseDoTDamageMult; @@ -781,7 +821,7 @@ namespace CalamityMod.NPCs if (VulnerableToSickness.Value) sicknessDamageMult *= irradiated > 0 ? (wormBoss ? 1.25 : 1.5) : (wormBoss ? VulnerableToDoTDamageMult_Worms_SlimeGod : VulnerableToDoTDamageMult); else - sicknessDamageMult *= irradiated > 0 ? 0.2 : 0.5; + sicknessDamageMult *= irradiated > 0 ? (wormBoss ? 0.66 : 0.5) : 0.5; } bool increasedElectricityDamage = npc.wet || npc.honeyWet || npc.lavaWet || npc.dripping; @@ -791,7 +831,7 @@ namespace CalamityMod.NPCs if (VulnerableToElectricity.Value) electricityDamageMult *= increasedElectricityDamage ? (wormBoss ? 1.25 : 1.5) : (wormBoss ? VulnerableToDoTDamageMult_Worms_SlimeGod : VulnerableToDoTDamageMult); else - electricityDamageMult *= increasedElectricityDamage ? 0.2 : 0.5; + electricityDamageMult *= increasedElectricityDamage ? (wormBoss ? 0.66 : 0.5) : 0.5; } double waterDamageMult = BaseDoTDamageMult; @@ -813,11 +853,13 @@ namespace CalamityMod.NPCs if (IncreasedHeatEffects_Fireball) heatDamageMult += 0.25; + if (IncreasedHeatEffects_FlameWakerBoots) + heatDamageMult += 0.25; if (IncreasedHeatEffects_CinnamonRoll) heatDamageMult += 0.5; if (IncreasedHeatEffects_HellfireTreads) heatDamageMult += 0.5; - + if (IncreasedSicknessEffects_ToxicHeart) sicknessDamageMult += 0.5; @@ -917,7 +959,7 @@ namespace CalamityMod.NPCs // Dragonfire if (dragonFire > 0) { - int baseDragonFireDoTValue = (int)(360 * heatDamageMult); + int baseDragonFireDoTValue = (int)(960 * heatDamageMult); ApplyDPSDebuff(baseDragonFireDoTValue, baseDragonFireDoTValue / 5, ref npc.lifeRegen, ref damage); } @@ -997,7 +1039,7 @@ namespace CalamityMod.NPCs // Sulphuric Poisoning if (sulphurPoison > 0) { - int baseSulphurPoisonDoTValue = (int)(180 * sicknessDamageMult); + int baseSulphurPoisonDoTValue = (int)(240 * sicknessDamageMult); ApplyDPSDebuff(baseSulphurPoisonDoTValue, baseSulphurPoisonDoTValue / 5, ref npc.lifeRegen, ref damage); } @@ -1027,7 +1069,7 @@ namespace CalamityMod.NPCs // Poisoned if (npc.poisoned) { - int basePoisonedDoTValue = (int)(4 * vanillaSicknessDamageMult); + int basePoisonedDoTValue = (int)(12 * vanillaSicknessDamageMult); npc.lifeRegen -= basePoisonedDoTValue; if (damage < basePoisonedDoTValue / 4) damage = basePoisonedDoTValue / 4; @@ -1055,11 +1097,11 @@ namespace CalamityMod.NPCs int baseCrushDepthDoTValue = (int)(100 * waterDamageMult); ApplyDPSDebuff(baseCrushDepthDoTValue, baseCrushDepthDoTValue / 2, ref npc.lifeRegen, ref damage); } - + //Riptide if (rTide > 0) { - int baseRiptideDoTValue = (int)(40 * waterDamageMult); + int baseRiptideDoTValue = (int)(30 * waterDamageMult); ApplyDPSDebuff(baseRiptideDoTValue, baseRiptideDoTValue / 3, ref npc.lifeRegen, ref damage); } @@ -1069,16 +1111,16 @@ namespace CalamityMod.NPCs if (somaShredStacks > 0) Shred.TickDebuff(npc, this); if (bBlood > 0) - ApplyDPSDebuff(50, 10, ref npc.lifeRegen, ref damage); + ApplyDPSDebuff(40, 10, ref npc.lifeRegen, ref damage); if (brainRot > 0) - ApplyDPSDebuff(50, 10, ref npc.lifeRegen, ref damage); + ApplyDPSDebuff(40, 10, ref npc.lifeRegen, ref damage); if (elementalMix > 0) ApplyDPSDebuff(400, 80, ref npc.lifeRegen, ref damage); if (miracleBlight > 0) ApplyDPSDebuff(2500, 500, ref npc.lifeRegen, ref damage); - // Reduce DoT on worm bosses by 75%. - if (wormBoss && npc.lifeRegen < 0) + // Reduce DoT on worm bosses and Creepers by 75%. + if ((wormBoss || npc.type == NPCID.Creeper) && npc.lifeRegen < 0) { npc.lifeRegen /= 4; if (npc.lifeRegen > -1) @@ -1103,6 +1145,13 @@ namespace CalamityMod.NPCs #endregion #region Set Defaults + public override void SetStaticDefaults() + { + // Set Plantera to be able to update oldPos[x] + // This is only used for her Rev+ AI charge attacks + NPCID.Sets.TrailingMode[NPCID.Plantera] = 1; + } + public override void SetDefaults(NPC npc) { ShouldFallThroughPlatforms = false; @@ -1193,7 +1242,11 @@ namespace CalamityMod.NPCs case NPCID.CultistDragonBody4: case NPCID.CultistDragonHead: case NPCID.CultistDragonTail: - npc.lifeMax = 40000; + npc.lifeMax = 20000; + break; + + case NPCID.AncientCultistSquidhead: + npc.lifeMax = 4000; break; case NPCID.DukeFishron: @@ -1221,12 +1274,16 @@ namespace CalamityMod.NPCs npc.lifeMax = 75000; break; + case NPCID.PlanterasTentacle: + npc.lifeMax = 500; + break; + case NPCID.Retinazer: - npc.lifeMax = 22000; + npc.lifeMax = 23500; break; case NPCID.Spazmatism: - npc.lifeMax = 26000; + npc.lifeMax = 24500; break; case NPCID.QueenSlimeBoss: @@ -1293,7 +1350,7 @@ namespace CalamityMod.NPCs if (CalamityLists.DeathModeSplittingWormIDs.Contains(npc.type)) { if (CalamityWorld.death) - npc.lifeMax = (int)(npc.lifeMax * 0.15); + npc.lifeMax = (int)Math.Round(npc.lifeMax * 0.15); } if (npc.type == NPCID.Mothron) @@ -1302,140 +1359,133 @@ namespace CalamityMod.NPCs } else if (npc.type == NPCID.MoonLordCore || npc.type == NPCID.MoonLordHand || npc.type == NPCID.MoonLordHead || npc.type == NPCID.MoonLordLeechBlob) { - npc.lifeMax = (int)(npc.lifeMax * 1.2); + npc.lifeMax = (int)Math.Round(npc.lifeMax * 1.2); if (npc.type == NPCID.MoonLordCore) npc.npcSlots = 36f; } - else if (npc.type == NPCID.CultistBoss || (npc.type >= NPCID.CultistDragonHead && npc.type <= NPCID.CultistDragonTail)) + else if (npc.type == NPCID.CultistBoss || (npc.type >= NPCID.CultistDragonHead && npc.type <= NPCID.CultistDragonTail) || npc.type == NPCID.AncientCultistSquidhead) { - npc.lifeMax = (int)(npc.lifeMax * 1.2); + npc.lifeMax = (int)Math.Round(npc.lifeMax * 1.2); if (npc.type == NPCID.CultistBoss) npc.npcSlots = 20f; } else if (npc.type == NPCID.DukeFishron) { - npc.lifeMax = (int)(npc.lifeMax * 1.4); + npc.lifeMax = (int)Math.Round(npc.lifeMax * 1.4); npc.npcSlots = 20f; } else if (npc.type == NPCID.Sharkron || npc.type == NPCID.Sharkron2) { - npc.lifeMax = (int)(npc.lifeMax * 5.0); + npc.lifeMax = (int)Math.Round(npc.lifeMax * 5D); } else if (npc.type == NPCID.Golem || npc.type == NPCID.GolemHead) { - npc.lifeMax = (int)(npc.lifeMax * 1.2); + npc.lifeMax = (int)Math.Round(npc.lifeMax * 1.5); if (npc.type == NPCID.Golem) npc.npcSlots = 64f; } else if (npc.type == NPCID.GolemHeadFree) { - npc.lifeMax = (int)(npc.lifeMax * 1.7); - npc.width = 88; - npc.height = 90; + npc.lifeMax = (int)Math.Round(npc.lifeMax * 1.7); npc.dontTakeDamage = false; } else if (npc.type == NPCID.HallowBoss) { - npc.lifeMax = (int)(npc.lifeMax * 1.2); + npc.lifeMax = (int)Math.Round(npc.lifeMax * 1.2); npc.npcSlots = 32f; } else if (npc.type == NPCID.Plantera) { - npc.lifeMax = (int)(npc.lifeMax * 1.2); + npc.lifeMax = (int)Math.Round(npc.lifeMax * 1.2); npc.npcSlots = 32f; } else if (CalamityLists.DestroyerIDs.Contains(npc.type)) { - npc.lifeMax = (int)(npc.lifeMax * 1.25); - npc.scale *= Main.zenithWorld ? 2.5f : CalamityWorld.death ? 1.7f : 1.5f; + npc.lifeMax = (int)Math.Round(npc.lifeMax * 1.25); + npc.scale *= Main.zenithWorld ? 2f : CalamityWorld.death ? 1.4f : 1.2f; npc.npcSlots = 10f; } else if (npc.type == NPCID.Probe) { if (CalamityWorld.death) - npc.lifeMax = (int)(npc.lifeMax * 2.0); + npc.lifeMax = (int)Math.Round(npc.lifeMax * 2D); - npc.scale *= Main.zenithWorld ? 2f : CalamityWorld.death ? 1.3f : 1.2f; + npc.scale *= Main.zenithWorld ? 2f : CalamityWorld.death ? 1.4f : 1.2f; } - else if (npc.type == NPCID.SkeletronPrime) + else if (npc.type == NPCID.SkeletronPrime || npc.type == ModContent.NPCType()) { - npc.lifeMax = (int)(npc.lifeMax * 1.2); + // HP boosted in Master Mode due to having two heads (piercing can make them die faster than normal here since they share an HP bar) + npc.lifeMax = (int)Math.Round(npc.lifeMax * (Main.masterMode ? 1.7 : 1.2)); npc.npcSlots = 12f; } else if (npc.type <= NPCID.PrimeLaser && npc.type >= NPCID.PrimeCannon) { - npc.lifeMax = (int)(npc.lifeMax * 0.65); + npc.lifeMax = (int)Math.Round(npc.lifeMax * 0.65); } else if (npc.type == NPCID.Retinazer || npc.type == NPCID.Spazmatism) { - npc.lifeMax = (int)(npc.lifeMax * 1.2); + npc.lifeMax = (int)Math.Round(npc.lifeMax * 1.2); npc.npcSlots = 10f; } else if (npc.type == NPCID.QueenSlimeBoss) { - npc.lifeMax = (int)(npc.lifeMax * 1.2); + npc.lifeMax = (int)Math.Round(npc.lifeMax * 1.2); npc.npcSlots = 32f; } else if (npc.type == NPCID.WallofFlesh || npc.type == NPCID.WallofFleshEye) { - npc.lifeMax = (int)(npc.lifeMax * 1.2); + npc.lifeMax = (int)Math.Round(npc.lifeMax * 1.3); if (npc.type == NPCID.WallofFlesh) npc.npcSlots = 20f; } else if (npc.type == NPCID.Deerclops) { - npc.lifeMax = (int)(npc.lifeMax * 1.2); npc.npcSlots = 16f; } else if (npc.type == NPCID.SkeletronHead) { - if (CalamityWorld.death) - npc.lifeMax = (int)(npc.lifeMax * 0.5); + /*if (CalamityWorld.death) + npc.lifeMax = (int)(npc.lifeMax * 0.65); else - npc.lifeMax = (int)(npc.lifeMax * 0.75); + npc.lifeMax = (int)(npc.lifeMax * 0.9);*/ npc.npcSlots = 12f; } else if (npc.type == NPCID.SkeletronHand) { if (CalamityWorld.death) - npc.lifeMax = (int)(npc.lifeMax * 0.65); + npc.lifeMax = (int)Math.Round(npc.lifeMax * 0.65); else - npc.lifeMax = (int)(npc.lifeMax * 0.9); + npc.lifeMax = (int)Math.Round(npc.lifeMax * 0.9); } else if (npc.type == NPCID.QueenBee) { npc.defense = 14; npc.defDefense = npc.defense; - npc.lifeMax = (int)(npc.lifeMax * 1.2); + npc.lifeMax = (int)Math.Round(npc.lifeMax * 1.8); npc.npcSlots = 14f; } else if ((npc.type == NPCID.Bee || npc.type == NPCID.BeeSmall) && CalamityPlayer.areThereAnyDamnBosses) { - npc.lifeMax = (int)(npc.lifeMax * 1.4); + npc.lifeMax = (int)Math.Round(npc.lifeMax * 1.5); npc.scale *= 1.25f; } - else if (npc.type == NPCID.Deerclops) - { - npc.lifeMax = (int)(npc.lifeMax * 1.2); - npc.npcSlots = 12f; - } else if (npc.type == NPCID.BrainofCthulhu) { - npc.lifeMax = (int)(npc.lifeMax * 1.2); + npc.lifeMax = (int)Math.Round(npc.lifeMax * 1.65); npc.npcSlots = 12f; } else if (npc.type == NPCID.Creeper) { - npc.lifeMax = (int)(npc.lifeMax * 1.1); + npc.lifeMax = (int)Math.Round(npc.lifeMax * 1.4); } else if (CalamityLists.EaterofWorldsIDs.Contains(npc.type)) { - npc.lifeMax = (int)(npc.lifeMax * 1.2); + npc.lifeMax = (int)Math.Round(npc.lifeMax * 1.2); if (npc.type == NPCID.EaterofWorldsHead) npc.npcSlots = 10f; @@ -1445,9 +1495,13 @@ namespace CalamityMod.NPCs } else if (npc.type == NPCID.EyeofCthulhu) { - npc.lifeMax = (int)(npc.lifeMax * 1.2); + npc.lifeMax = (int)Math.Round(npc.lifeMax * 1.4); npc.npcSlots = 10f; } + else if (npc.type == NPCID.ServantofCthulhu) + { + npc.lifeMax = (int)Math.Round(npc.lifeMax * 4D); + } else if (npc.type == NPCID.KingSlime) { if (CalamityWorld.death) @@ -1455,22 +1509,12 @@ namespace CalamityMod.NPCs else npc.scale = Main.getGoodWorld ? 3f : 1.25f; - if (Main.getGoodWorld) - npc.lifeMax = (int)(npc.lifeMax * 1.5); + npc.lifeMax = (int)Math.Round(npc.lifeMax * (Main.getGoodWorld ? 1.8 : 1.5)); } else if ((npc.type == NPCID.Wraith || npc.type == NPCID.Mimic || npc.type == NPCID.Reaper || npc.type == NPCID.PresentMimic || npc.type == NPCID.SandElemental || npc.type == NPCID.Ghost) && CalamityWorld.LegendaryMode) { npc.knockBackResist = 0f; } - else if (npc.type == NPCID.Spore) - { - npc.dontTakeDamage = true; - } - - if (CalamityLists.revengeanceLifeStealExceptionList.Contains(npc.type)) - { - npc.canGhostHeal = false; - } } #endregion @@ -2178,6 +2222,23 @@ namespace CalamityMod.NPCs { EditGlobalCoinDrops(npc); + // Put this first so that any boss damage value modifications aren't reset + bool vanillaNPC = npc.type < NPCID.Count; + if (vanillaNPC) + { + if (NPCStats.EnemyStats.ContactDamageValues.ContainsKey(npc.type)) + { + npc.GetNPCDamage(); + npc.defDamage = npc.damage; + } + + if ((npc.boss && npc.type != NPCID.MartianSaucerCore) || CalamityLists.bossHPScaleList.Contains(npc.type)) + { + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; + npc.lifeMax += (int)Math.Round(npc.lifeMax * HPBoost); + } + } + switch (npc.type) { case NPCID.KingSlime: @@ -2266,12 +2327,17 @@ namespace CalamityMod.NPCs npc.coldDamage = true; break; + // These go through walls and are very annoying with the new tombstone breaking spawning them mechanic in 1.4 + case NPCID.Ghost: + npc.lifeMax = (int)Math.Round(npc.lifeMax * 0.5); + break; + case NPCID.PirateGhost: - npc.lifeMax = (int)(npc.lifeMax * 0.33); + npc.lifeMax = (int)Math.Round(npc.lifeMax * 0.33); break; case NPCID.BloodSquid: - npc.lifeMax = (int)(npc.lifeMax * 0.25); + npc.lifeMax = (int)Math.Round(npc.lifeMax * 0.25); break; case NPCID.ChatteringTeethBomb: @@ -2283,11 +2349,11 @@ namespace CalamityMod.NPCs npc.lifeMax = 15; break; - // Reduce prehardmode desert enemy stats pre-Desert Scourge + // Reduce prehardmode desert enemy stats case NPCID.WalkingAntlion: case NPCID.GiantWalkingAntlion: - npc.lifeMax = (int)(npc.lifeMax * DesertEnemyStatMultiplier); - npc.damage = (int)(npc.damage * DesertEnemyStatMultiplier); + npc.lifeMax = (int)Math.Round(npc.lifeMax * DesertEnemyStatMultiplier); + npc.damage = (int)Math.Round(npc.damage * DesertEnemyStatMultiplier); npc.defDamage = npc.damage; npc.defense /= 2; npc.defDefense = npc.defense; @@ -2297,8 +2363,8 @@ namespace CalamityMod.NPCs case NPCID.Antlion: case NPCID.FlyingAntlion: case NPCID.GiantFlyingAntlion: - npc.lifeMax = (int)(npc.lifeMax * DesertEnemyStatMultiplier); - npc.damage = (int)(npc.damage * DesertEnemyStatMultiplier); + npc.lifeMax = (int)Math.Round(npc.lifeMax * DesertEnemyStatMultiplier); + npc.damage = (int)Math.Round(npc.damage * DesertEnemyStatMultiplier); npc.defDamage = npc.damage; npc.defense /= 2; npc.defDefense = npc.defense; @@ -2306,14 +2372,14 @@ namespace CalamityMod.NPCs // Reduce Dungeon Guardian HP case NPCID.DungeonGuardian: - npc.lifeMax = (int)(npc.lifeMax * 0.1); + npc.lifeMax = (int)Math.Round(npc.lifeMax * 0.1); canBreakPlayerDefense = true; break; // Reduce Tomb Crawler stats case NPCID.TombCrawlerHead: - npc.lifeMax = (int)(npc.lifeMax * 0.5); - npc.damage = (int)(npc.damage * DesertEnemyStatMultiplier); + npc.lifeMax = (int)Math.Round(npc.lifeMax * 0.5); + npc.damage = (int)Math.Round(npc.damage * DesertEnemyStatMultiplier); npc.defDamage = npc.damage; // Tomb Crawler Head has 0 defense so there is no need to reduce it canBreakPlayerDefense = true; @@ -2321,8 +2387,8 @@ namespace CalamityMod.NPCs case NPCID.TombCrawlerBody: case NPCID.TombCrawlerTail: - npc.lifeMax = (int)(npc.lifeMax * 0.5); - npc.damage = (int)(npc.damage * DesertEnemyStatMultiplier); + npc.lifeMax = (int)Math.Round(npc.lifeMax * 0.5); + npc.damage = (int)Math.Round(npc.damage * DesertEnemyStatMultiplier); npc.defDamage = npc.damage; npc.defense /= 2; npc.defDefense = npc.defense; @@ -2332,12 +2398,19 @@ namespace CalamityMod.NPCs case NPCID.Sharkron: case NPCID.Sharkron2: npc.width = npc.height = 36; + npc.chaseable = false; canBreakPlayerDefense = true; break; + // Fix drawing issues with Golem's Free Head + case NPCID.GolemHeadFree: + npc.width = 88; + npc.height = 90; + break; + // Make Core hitbox bigger and reduce HP case NPCID.MartianSaucerCore: - npc.lifeMax = (int)(npc.lifeMax * 0.6); + npc.lifeMax = (int)Math.Round(npc.lifeMax * 0.6); npc.width *= 2; npc.height *= 2; break; @@ -2350,6 +2423,16 @@ namespace CalamityMod.NPCs npc.defDefense = npc.defense; break; + // Make Plantera's Spores immune to damage because otherwise they're pointless + case NPCID.Spore: + npc.dontTakeDamage = true; + break; + + // Make Fishron and Anahita Bubbles immune to damage in Rev+ Master Mode + case NPCID.DetonatingBubble: + npc.dontTakeDamage = Main.masterMode && CalamityWorld.revenge; + break; + default: break; } @@ -2361,8 +2444,9 @@ namespace CalamityMod.NPCs { if (CalamityLists.DestroyerIDs.Contains(npc.type) || npc.type == NPCID.Probe || CalamityLists.SkeletronPrimeIDs.Contains(npc.type) || npc.type == NPCID.Spazmatism || npc.type == NPCID.Retinazer) { - npc.lifeMax = (int)(npc.lifeMax * 0.8); - npc.damage = (int)(npc.damage * 0.8); + double multiplier = Main.expertMode ? EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert : EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Classic; + npc.lifeMax = (int)Math.Round(npc.lifeMax * multiplier); + npc.damage = (int)Math.Round(npc.damage * multiplier); npc.defDamage = npc.damage; } } @@ -2370,16 +2454,34 @@ namespace CalamityMod.NPCs { if (CalamityLists.DestroyerIDs.Contains(npc.type) || npc.type == NPCID.Probe || CalamityLists.SkeletronPrimeIDs.Contains(npc.type) || npc.type == NPCID.Spazmatism || npc.type == NPCID.Retinazer) { - npc.lifeMax = (int)(npc.lifeMax * 0.9); - npc.damage = (int)(npc.damage * 0.9); + double multiplier = Main.expertMode ? EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert : EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Classic; + npc.lifeMax = (int)Math.Round(npc.lifeMax * multiplier); + npc.damage = (int)Math.Round(npc.damage * multiplier); npc.defDamage = npc.damage; } } } + // Prehardmode mushroom enemy nerfs + if (!Main.hardMode) + { + if (npc.type == NPCID.ZombieMushroom || npc.type == NPCID.ZombieMushroomHat || npc.type == NPCID.AnomuraFungus || npc.type == NPCID.FungiBulb || npc.type == NPCID.MushiLadybug) + { + npc.lifeMax = (int)Math.Round(npc.lifeMax * 0.5); + npc.damage = (int)Math.Round(npc.damage * 0.5); + npc.defDamage = npc.damage; + } + + if (npc.type == NPCID.FungiSpore) + { + npc.damage = (int)Math.Round(npc.damage * 0.5); + npc.defDamage = npc.damage; + } + } + if (Main.hardMode && CalamityLists.HardmodeNPCNerfList.Contains(npc.type)) { - npc.damage = (int)(npc.damage * 0.75); + npc.damage = (int)Math.Round(npc.damage * 0.75); npc.defDamage = npc.damage; } @@ -2387,21 +2489,21 @@ namespace CalamityMod.NPCs { if (CalamityLists.pumpkinMoonBuffList.Contains(npc.type)) { - npc.lifeMax = (int)(npc.lifeMax * 3.5); + npc.lifeMax = (int)Math.Round(npc.lifeMax * 3.5); npc.damage += 30; npc.life = npc.lifeMax; npc.defDamage = npc.damage; } else if (CalamityLists.frostMoonBuffList.Contains(npc.type)) { - npc.lifeMax = (int)(npc.lifeMax * 2.5); + npc.lifeMax = (int)Math.Round(npc.lifeMax * 2.5); npc.damage += 30; npc.life = npc.lifeMax; npc.defDamage = npc.damage; } else if (CalamityLists.eclipseBuffList.Contains(npc.type)) { - npc.lifeMax = (int)(npc.lifeMax * 5D); + npc.lifeMax = (int)Math.Round(npc.lifeMax * 5D); npc.damage += 30; npc.life = npc.lifeMax; npc.defDamage = npc.damage; @@ -2412,58 +2514,520 @@ namespace CalamityMod.NPCs { if (CalamityLists.dungeonEnemyBuffList.Contains(npc.type)) { - npc.lifeMax = (int)(npc.lifeMax * 2.5); + npc.lifeMax = (int)Math.Round(npc.lifeMax * 2.5); npc.damage += 30; npc.life = npc.lifeMax; npc.defDamage = npc.damage; } } - if (CalamityWorld.revenge) + // Nerf KB resist in Expert and Master using this roundabout method + if (Main.expertMode) + AdjustExpertModeStatScaling(npc); + + // Nerf a shitload of Master Mode enemies + // HP is nerfed by 25% (this nerf is higher due to the player not dealing any more damage in Master) + // Damage is nerfed by 15% (this nerf is lower due to the player having 100% effective defense in Master) + if (Main.masterMode) { - double damageMultiplier = 1D; - bool containsNPC = false; - if (CalamityLists.revengeanceEnemyBuffList25Percent.Contains(npc.type)) + switch (npc.type) { - damageMultiplier += 0.25; - containsNPC = true; + case NPCID.AngryBones: + case NPCID.AngryBonesBig: + case NPCID.AngryBonesBigHelmet: + case NPCID.AngryBonesBigMuscle: + case NPCID.BigBoned: + case NPCID.ShortBones: + case NPCID.AnomuraFungus: + case NPCID.Antlion: + case NPCID.WalkingAntlion: + case NPCID.GiantWalkingAntlion: + case NPCID.LarvaeAntlion: + case NPCID.FlyingAntlion: + case NPCID.GiantFlyingAntlion: + case NPCID.BabySlime: + case NPCID.BlackSlime: + case NPCID.BlazingWheel: + case NPCID.BloodCrawler: + case NPCID.BloodCrawlerWall: + case NPCID.BlueJellyfish: + case NPCID.GreenJellyfish: + case NPCID.PinkJellyfish: + case NPCID.BloodJelly: + case NPCID.FungoFish: + case NPCID.BlueSlime: + case NPCID.BoneSerpentBody: + case NPCID.BoneSerpentHead: + case NPCID.BoneSerpentTail: + case NPCID.CaveBat: + case NPCID.CochinealBeetle: + case NPCID.Crab: + case NPCID.Crawdad: + case NPCID.Crawdad2: + case NPCID.Crimera: + case NPCID.BigCrimera: + case NPCID.LittleCrimera: + case NPCID.CursedSkull: + case NPCID.CyanBeetle: + case NPCID.Demon: + case NPCID.DemonEye: + case NPCID.CataractEye: + case NPCID.CataractEye2: + case NPCID.DemonEye2: + case NPCID.DemonEyeOwl: + case NPCID.DemonEyeSpaceship: + case NPCID.DialatedEye: + case NPCID.DialatedEye2: + case NPCID.GreenEye: + case NPCID.GreenEye2: + case NPCID.PurpleEye: + case NPCID.PurpleEye2: + case NPCID.SleepyEye: + case NPCID.SleepyEye2: + case NPCID.DevourerBody: + case NPCID.DevourerHead: + case NPCID.DevourerTail: + case NPCID.DoctorBones: + case NPCID.DungeonSlime: + case NPCID.EaterofSouls: + case NPCID.BigEater: + case NPCID.LittleEater: + case NPCID.FaceMonster: + case NPCID.ArmedZombieEskimo: + case NPCID.ZombieEskimo: + case NPCID.FungiBulb: + case NPCID.Ghost: + case NPCID.GiantShelly: + case NPCID.GiantShelly2: + case NPCID.GiantWormBody: + case NPCID.GiantWormHead: + case NPCID.GiantWormTail: + case NPCID.Gnome: + case NPCID.GoblinScout: + case NPCID.GraniteFlyer: + case NPCID.GraniteGolem: + case NPCID.GreenSlime: + case NPCID.Harpy: + case NPCID.Hellbat: + case NPCID.GreekSkeleton: + case NPCID.Hornet: + case NPCID.HornetFatty: + case NPCID.HornetHoney: + case NPCID.HornetLeafy: + case NPCID.HornetSpikey: + case NPCID.HornetStingy: + case NPCID.BigHornetFatty: + case NPCID.BigHornetHoney: + case NPCID.BigHornetLeafy: + case NPCID.BigHornetSpikey: + case NPCID.BigHornetStingy: + case NPCID.BigMossHornet: + case NPCID.GiantMossHornet: + case NPCID.LittleHornetFatty: + case NPCID.LittleHornetHoney: + case NPCID.LittleHornetLeafy: + case NPCID.LittleHornetSpikey: + case NPCID.LittleHornetStingy: + case NPCID.LittleMossHornet: + case NPCID.MossHornet: + case NPCID.TinyMossHornet: + case NPCID.IceBat: + case NPCID.IceSlime: + case NPCID.JungleBat: + case NPCID.JungleSlime: + case NPCID.LacBeetle: + case NPCID.LavaSlime: + case NPCID.MaggotZombie: + case NPCID.ManEater: + case NPCID.MeteorHead: + case NPCID.MotherSlime: + case NPCID.MushiLadybug: + case NPCID.Nymph: + case NPCID.Pinky: + case NPCID.Piranha: + case NPCID.PurpleSlime: + case NPCID.Raven: + case NPCID.RedSlime: + case NPCID.Salamander: + case NPCID.Salamander2: + case NPCID.Salamander3: + case NPCID.Salamander4: + case NPCID.Salamander5: + case NPCID.Salamander6: + case NPCID.Salamander7: + case NPCID.Salamander8: + case NPCID.Salamander9: + case NPCID.SandSlime: + case NPCID.SeaSnail: + case NPCID.Shark: + case NPCID.ShimmerSlime: + case NPCID.Skeleton: + case NPCID.SkeletonAlien: + case NPCID.SkeletonAstonaut: + case NPCID.SkeletonTopHat: + case NPCID.ArmoredSkeleton: + case NPCID.BigHeadacheSkeleton: + case NPCID.BigMisassembledSkeleton: + case NPCID.BigPantlessSkeleton: + case NPCID.BigSkeleton: + case NPCID.BoneThrowingSkeleton: + case NPCID.BoneThrowingSkeleton2: + case NPCID.BoneThrowingSkeleton3: + case NPCID.BoneThrowingSkeleton4: + case NPCID.HeadacheSkeleton: + case NPCID.HeavySkeleton: + case NPCID.MisassembledSkeleton: + case NPCID.PantlessSkeleton: + case NPCID.SmallMisassembledSkeleton: + case NPCID.SmallHeadacheSkeleton: + case NPCID.SmallSkeleton: + case NPCID.SmallPantlessSkeleton: + case NPCID.SporeSkeleton: + case NPCID.TacticalSkeleton: + case NPCID.SkeletonSniper: + case NPCID.SkeletonCommando: + case NPCID.DarkCaster: + case NPCID.FireImp: + case NPCID.Snatcher: + case NPCID.SnowFlinx: + case NPCID.SpikeBall: + case NPCID.SpikedIceSlime: + case NPCID.SpikedJungleSlime: + case NPCID.SporeBat: + case NPCID.ZombieMushroom: + case NPCID.ZombieMushroomHat: + case NPCID.Squid: + case NPCID.Tim: + case NPCID.TombCrawlerBody: + case NPCID.TombCrawlerHead: + case NPCID.TombCrawlerTail: + case NPCID.UndeadMiner: + case NPCID.UndeadViking: + case NPCID.VoodooDemon: + case NPCID.Vulture: + case NPCID.WallCreeper: + case NPCID.WallCreeperWall: + case NPCID.YellowSlime: + case NPCID.Zombie: + case NPCID.ZombieDoctor: + case NPCID.ZombieElf: + case NPCID.ZombieElfBeard: + case NPCID.ZombieElfGirl: + case NPCID.ZombieMerman: + case NPCID.ZombiePixie: + case NPCID.ZombieRaincoat: + case NPCID.ZombieSuperman: + case NPCID.ZombieSweater: + case NPCID.ZombieXmas: + case NPCID.ArmedTorchZombie: + case NPCID.ArmedZombie: + case NPCID.ArmedZombieCenx: + case NPCID.ArmedZombiePincussion: + case NPCID.ArmedZombieSlimed: + case NPCID.ArmedZombieSwamp: + case NPCID.ArmedZombieTwiggy: + case NPCID.BaldZombie: + case NPCID.BigBaldZombie: + case NPCID.BigFemaleZombie: + case NPCID.BigPincushionZombie: + case NPCID.BigRainZombie: + case NPCID.BigSlimedZombie: + case NPCID.BigSwampZombie: + case NPCID.BigTwiggyZombie: + case NPCID.BigZombie: + case NPCID.BloodZombie: + case NPCID.FemaleZombie: + case NPCID.PincushionZombie: + case NPCID.SlimedZombie: + case NPCID.SmallBaldZombie: + case NPCID.SmallFemaleZombie: + case NPCID.SmallPincushionZombie: + case NPCID.SmallRainZombie: + case NPCID.SmallSlimedZombie: + case NPCID.SmallSwampZombie: + case NPCID.SmallTwiggyZombie: + case NPCID.SmallZombie: + case NPCID.SwampZombie: + case NPCID.TorchZombie: + case NPCID.TwiggyZombie: + case NPCID.AnglerFish: + case NPCID.AngryTrapper: + case NPCID.Arapaima: + case NPCID.ArmoredViking: + case NPCID.DesertBeast: + case NPCID.BlackRecluse: + case NPCID.BlackRecluseWall: + case NPCID.BloodFeeder: + case NPCID.Mummy: + case NPCID.BloodMummy: + case NPCID.DarkMummy: + case NPCID.LightMummy: + case NPCID.BlueArmoredBones: + case NPCID.BlueArmoredBonesMace: + case NPCID.BlueArmoredBonesNoPants: + case NPCID.BlueArmoredBonesSword: + case NPCID.BoneLee: + case NPCID.ChaosElemental: + case NPCID.Clinger: + case NPCID.BigMimicCorruption: + case NPCID.BigMimicCrimson: + case NPCID.BigMimicHallow: + case NPCID.BigMimicJungle: + case NPCID.CorruptSlime: + case NPCID.Corruptor: + case NPCID.Crimslime: + case NPCID.BigCrimslime: + case NPCID.LittleCrimslime: + case NPCID.CrimsonAxe: + case NPCID.CultistArcherBlue: + case NPCID.CultistArcherWhite: + case NPCID.CultistDevote: + case NPCID.CursedHammer: + case NPCID.Derpling: + case NPCID.Herpling: + case NPCID.DesertDjinn: + case NPCID.DiabolistRed: + case NPCID.DiabolistWhite: + case NPCID.DiggerBody: + case NPCID.DiggerHead: + case NPCID.DiggerTail: + case NPCID.DesertGhoul: + case NPCID.DesertGhoulCorruption: + case NPCID.DesertGhoulCrimson: + case NPCID.DesertGhoulHallow: + case NPCID.DuneSplicerBody: + case NPCID.DuneSplicerHead: + case NPCID.DuneSplicerTail: + case NPCID.DungeonSpirit: + case NPCID.EnchantedSword: + case NPCID.FloatyGross: + case NPCID.FlyingSnake: + case NPCID.Gastropod: + case NPCID.GiantBat: + case NPCID.GiantCursedSkull: + case NPCID.GiantFlyingFox: + case NPCID.GiantFungiBulb: + case NPCID.GiantTortoise: + case NPCID.IceTortoise: + case NPCID.HellArmoredBones: + case NPCID.HellArmoredBonesMace: + case NPCID.HellArmoredBonesSpikeShield: + case NPCID.HellArmoredBonesSword: + case NPCID.HoppinJack: + case NPCID.IceElemental: + case NPCID.Mimic: + case NPCID.IceMimic: + case NPCID.PresentMimic: + case NPCID.IchorSticker: + case NPCID.IcyMerman: + case NPCID.IlluminantBat: + case NPCID.IlluminantSlime: + case NPCID.JungleCreeper: + case NPCID.JungleCreeperWall: + case NPCID.DesertLamiaDark: + case NPCID.DesertLamiaLight: + case NPCID.Lavabat: + case NPCID.Lihzahrd: + case NPCID.LihzahrdCrawler: + case NPCID.Medusa: + case NPCID.Moth: + case NPCID.Necromancer: + case NPCID.NecromancerArmored: + case NPCID.Paladin: + case NPCID.PigronCorruption: + case NPCID.PigronCrimson: + case NPCID.PigronHallow: + case NPCID.Pixie: + case NPCID.PossessedArmor: + case NPCID.RaggedCaster: + case NPCID.RaggedCasterOpenCoat: + case NPCID.RedDevil: + case NPCID.RockGolem: + case NPCID.RuneWizard: + case NPCID.RustyArmoredBonesAxe: + case NPCID.RustyArmoredBonesFlail: + case NPCID.RustyArmoredBonesSword: + case NPCID.RustyArmoredBonesSwordNoArmor: + case NPCID.DesertScorpionWalk: + case NPCID.DesertScorpionWall: + case NPCID.SkeletonArcher: + case NPCID.Slimeling: + case NPCID.Slimer: + case NPCID.Slimer2: + case NPCID.ToxicSludge: + case NPCID.Unicorn: + case NPCID.WanderingEye: + case NPCID.Werewolf: + case NPCID.Wolf: + case NPCID.SeekerBody: + case NPCID.SeekerHead: + case NPCID.SeekerTail: + case NPCID.Wraith: + case NPCID.WyvernBody: + case NPCID.WyvernBody2: + case NPCID.WyvernBody3: + case NPCID.WyvernHead: + case NPCID.WyvernLegs: + case NPCID.WyvernTail: + case NPCID.BloodEelBody: + case NPCID.BloodEelHead: + case NPCID.BloodEelTail: + case NPCID.BloodSquid: + case NPCID.ChatteringTeethBomb: + case NPCID.Clown: + case NPCID.CorruptBunny: + case NPCID.CorruptGoldfish: + case NPCID.CorruptPenguin: + case NPCID.Drippler: + case NPCID.GoblinShark: + case NPCID.TheGroom: + case NPCID.TheBride: + case NPCID.CrimsonBunny: + case NPCID.CrimsonGoldfish: + case NPCID.CrimsonPenguin: + case NPCID.EyeballFlyingFish: + case NPCID.Dandelion: + case NPCID.AngryNimbus: + case NPCID.FlyingFish: + case NPCID.IceGolem: + case NPCID.RainbowSlime: + case NPCID.UmbrellaSlime: + case NPCID.Tumbleweed: + case NPCID.SandShark: + case NPCID.SandsharkCorrupt: + case NPCID.SandsharkCrimson: + case NPCID.SandsharkHallow: + case NPCID.SandElemental: + case NPCID.BloodNautilus: + case NPCID.GoblinArcher: + case NPCID.GoblinPeon: + case NPCID.GoblinSorcerer: + case NPCID.GoblinSummoner: + case NPCID.GoblinThief: + case NPCID.GoblinWarrior: + case NPCID.MisterStabby: + case NPCID.SnowBalla: + case NPCID.SnowmanGangsta: + case NPCID.Parrot: + case NPCID.PirateCaptain: + case NPCID.PirateCorsair: + case NPCID.PirateCrossbower: + case NPCID.PirateDeadeye: + case NPCID.PirateDeckhand: + case NPCID.PirateGhost: + case NPCID.PirateShipCannon: + case NPCID.MothronSpawn: + case NPCID.Mothron: + case NPCID.Butcher: + case NPCID.CreatureFromTheDeep: + case NPCID.DeadlySphere: + case NPCID.DrManFly: + case NPCID.Eyezor: + case NPCID.Frankenstein: + case NPCID.Fritz: + case NPCID.Nailhead: + case NPCID.Psycho: + case NPCID.Reaper: + case NPCID.ThePossessed: + case NPCID.SwampThing: + case NPCID.Vampire: + case NPCID.VampireBat: + case NPCID.BrainScrambler: + case NPCID.GigaZapper: + case NPCID.MartianWalker: + case NPCID.GrayGrunt: + case NPCID.MartianDrone: + case NPCID.MartianEngineer: + case NPCID.MartianOfficer: + case NPCID.RayGunner: + case NPCID.Scutlix: + case NPCID.ScutlixRider: + case NPCID.MartianTurret: + case NPCID.HeadlessHorseman: + case NPCID.Hellhound: + case NPCID.Splinterling: + case NPCID.Poltergeist: + case NPCID.Scarecrow1: + case NPCID.Scarecrow2: + case NPCID.Scarecrow3: + case NPCID.Scarecrow4: + case NPCID.Scarecrow5: + case NPCID.Scarecrow6: + case NPCID.Scarecrow7: + case NPCID.Scarecrow8: + case NPCID.Scarecrow9: + case NPCID.Scarecrow10: + case NPCID.ElfArcher: + case NPCID.ElfCopter: + case NPCID.Flocko: + case NPCID.GingerbreadMan: + case NPCID.Krampus: + case NPCID.Nutcracker: + case NPCID.NutcrackerSpinning: + case NPCID.Yeti: + case NPCID.NebulaBeast: + case NPCID.NebulaBrain: + case NPCID.NebulaHeadcrab: + case NPCID.NebulaSoldier: + case NPCID.SolarCorite: + case NPCID.SolarCrawltipedeBody: + case NPCID.SolarCrawltipedeHead: + case NPCID.SolarCrawltipedeTail: + case NPCID.SolarDrakomire: + case NPCID.SolarDrakomireRider: + case NPCID.SolarSolenian: + case NPCID.SolarSpearman: + case NPCID.SolarSroller: + case NPCID.StardustCellBig: + case NPCID.StardustCellSmall: + case NPCID.StardustJellyfishBig: + case NPCID.StardustWormBody: + case NPCID.StardustWormHead: + case NPCID.StardustWormTail: + case NPCID.StardustSoldier: + case NPCID.StardustSpiderBig: + case NPCID.StardustSpiderSmall: + case NPCID.VortexHornet: + case NPCID.VortexHornetQueen: + case NPCID.VortexLarva: + case NPCID.VortexRifleman: + case NPCID.VortexSoldier: + case NPCID.DD2DarkMageT1: + case NPCID.DD2DarkMageT3: + case NPCID.DD2OgreT2: + case NPCID.DD2OgreT3: + case NPCID.MartianSaucerCore: + case NPCID.MartianSaucerCannon: + case NPCID.MartianSaucerTurret: + case NPCID.DD2SkeletonT1: + case NPCID.DD2SkeletonT3: + case NPCID.DD2DrakinT2: + case NPCID.DD2DrakinT3: + case NPCID.DD2GoblinBomberT1: + case NPCID.DD2GoblinBomberT2: + case NPCID.DD2GoblinBomberT3: + case NPCID.DD2GoblinT1: + case NPCID.DD2GoblinT2: + case NPCID.DD2GoblinT3: + case NPCID.DD2JavelinstT1: + case NPCID.DD2JavelinstT2: + case NPCID.DD2JavelinstT3: + case NPCID.DD2KoboldFlyerT2: + case NPCID.DD2KoboldFlyerT3: + case NPCID.DD2KoboldWalkerT2: + case NPCID.DD2KoboldWalkerT3: + case NPCID.DD2LightningBugT3: + case NPCID.DD2WitherBeastT2: + case NPCID.DD2WitherBeastT3: + case NPCID.DD2WyvernT1: + case NPCID.DD2WyvernT2: + case NPCID.DD2WyvernT3: + case NPCID.AncientCultistSquidhead: + case NPCID.SlimeSpiked: + AdjustMasterModeStatScaling(npc); + npc.defDamage = npc.damage; + break; } - else if (CalamityLists.revengeanceEnemyBuffList20Percent.Contains(npc.type)) - { - damageMultiplier += 0.2; - containsNPC = true; - } - else if (CalamityLists.revengeanceEnemyBuffList15Percent.Contains(npc.type)) - { - damageMultiplier += 0.15; - containsNPC = true; - } - else if (CalamityLists.revengeanceEnemyBuffList10Percent.Contains(npc.type)) - { - damageMultiplier += 0.1; - containsNPC = true; - } - - if (containsNPC) - { - if (CalamityWorld.death) - damageMultiplier += (damageMultiplier - 1D) * 0.6; - - npc.damage = (int)(npc.damage * damageMultiplier); - npc.defDamage = npc.damage; - } - } - - if (npc.type < NPCID.Count && NPCStats.EnemyStats.ContactDamageValues.ContainsKey(npc.type)) - { - npc.GetNPCDamage(); - npc.defDamage = npc.damage; - } - - if ((npc.boss && npc.type != NPCID.MartianSaucerCore && npc.type < NPCID.Count) || CalamityLists.bossHPScaleList.Contains(npc.type)) - { - double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)(npc.lifeMax * HPBoost); } } #endregion @@ -2597,7 +3161,7 @@ namespace CalamityMod.NPCs break; } - npc.lifeMax = (int)(npc.lifeMax * scalar); + npc.lifeMax = (int)Math.Round(npc.lifeMax * scalar); } } #endregion @@ -2616,9 +3180,13 @@ namespace CalamityMod.NPCs #endregion #region Strike NPC - // Incoming defense to this function is already affected by the vanilla debuffs Ichor (-15) and Betsy's Curse (-40), and cannot be below zero. + // Incoming defense to this function is already affected by the vanilla debuffs Ichor (-10) and Betsy's Curse (-40), and cannot be below zero. public override void ModifyIncomingHit(NPC npc, ref NPC.HitModifiers modifiers) { + // Reduce ichor debuff defense reduction from -15 to -10. + if (npc.ichor) + modifiers.Defense.Flat += 5; + // Apply armor penetration based on Calamity debuffs. The hit system manages the sequencing. // Ozzatron 05JAN2023: fixed doubled armor pen, this time for real int defenseReduction = (marked > 0 && DR <= 0f ? MarkedforDeath.DefenseReduction : 0) + (wither > 0 ? WitherDebuff.DefenseReduction : 0) + miscDefenseLoss; @@ -2628,20 +3196,12 @@ namespace CalamityMod.NPCs ApplyDR(npc, ref modifiers); // Damage reduction on spawn for certain worm bosses. - bool destroyerResist = CalamityLists.DestroyerIDs.Contains(npc.type) && (CalamityWorld.revenge || BossRushEvent.BossRushActive); - bool eaterofWorldsResist = CalamityLists.EaterofWorldsIDs.Contains(npc.type) && BossRushEvent.BossRushActive; - if (destroyerResist || eaterofWorldsResist || CalamityLists.AstrumDeusIDs.Contains(npc.type)) - { - float resistanceGateValue = (CalamityLists.AstrumDeusIDs.Contains(npc.type) && newAI[0] != 0f) ? 300f : 600f; - if (newAI[1] < resistanceGateValue || (newAI[2] > 0f && CalamityLists.DestroyerIDs.Contains(npc.type))) - modifiers.FinalDamage *= 0.01f; - } - - // Large Deus worm takes reduced damage to last a long enough time. - // TODO -- WHY DOES DEUS HAVE THIS UNDOCUMENTED MULTIPLIER HERE?? - // this should be in ModifyHitNPC for deus himself - if (CalamityLists.AstrumDeusIDs.Contains(npc.type) && newAI[0] == 0f) - modifiers.FinalDamage *= 0.8f; + 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)); + 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)) + modifiers.FinalDamage *= 1f - MathHelper.Lerp(0f, 0.99f, MathHelper.Clamp(1f - newAI[1] / (newAI[0] != 0f ? 300f : 600f), 0f, 1f)); } // Directly modifies final damage incoming to an NPC based on their DR (damage reduction) stat added by Calamity. @@ -2650,7 +3210,7 @@ namespace CalamityMod.NPCs { if (DR <= 0f && KillTime == 0) return; - + float finalMultiplier = 1f; // If the NPC currently has unbreakable DR, it cannot be reduced by any means. @@ -2678,7 +3238,7 @@ namespace CalamityMod.NPCs cirrusBossActive = Main.npc[CalamityGlobalNPC.SCal].ModNPC().cirrus; } - bool nightProvi = npc.type == NPCType() && !Main.dayTime; + bool nightProvi = npc.type == NPCType() && !Main.IsItDay(); bool dayEmpress = npc.type == NPCID.HallowBoss && NPC.ShouldEmpressBeEnraged(); if (KillTime > 0 && AITimer < KillTime && !BossRushEvent.BossRushActive && !cirrusBossActive && (nightProvi || dayEmpress)) { @@ -2825,12 +3385,6 @@ namespace CalamityMod.NPCs dashImmunityTime[i]--; } - if (CalamityPlayer.areThereAnyDamnBosses) - { - if (npc.velocity.Length() > maxVelocity) - maxVelocity = npc.velocity.Length(); - } - if (KillTime > 0 || npc.type == NPCType()) { // Apply Boss Effects while any boss NPC is active @@ -2927,6 +3481,12 @@ namespace CalamityMod.NPCs return QueenBeeAI.BuffedQueenBeeAI(npc, Mod); } + if (Main.masterMode && CalamityWorld.revenge) + { + if (npc.type == NPCID.DetonatingBubble) + return DukeFishronAI.BuffedDetonatingBubbleAI(npc, Mod); + } + if (CalamityWorld.revenge || BossRushEvent.BossRushActive) { switch (npc.type) @@ -3063,8 +3623,106 @@ namespace CalamityMod.NPCs break; } } - else if (npc.type == NPCID.Retinazer && !Main.getGoodWorld) - return TwinsAI.TrueMeleeRetinazerPhase2AI(npc); + + // Adjust vanilla AI in Classic, Expert and Master + // Fair contact damage and a few Expert/Master AI edits happen here + // Deerclops doesn't deserve love so he's not here + else if (!CalamityMod.ExternalFlag_DisableNonRevBossAI) + { + switch (npc.type) + { + case NPCID.KingSlime: + return KingSlimeAI.VanillaKingSlimeAI(npc, Mod); + + case NPCID.EyeofCthulhu: + return EyeOfCthulhuAI.VanillaEyeofCthulhuAI(npc, Mod); + + case NPCID.EaterofWorldsHead: + case NPCID.EaterofWorldsBody: + case NPCID.EaterofWorldsTail: + return EaterOfWorldsAI.VanillaEaterofWorldsAI(npc, Mod); + + case NPCID.BrainofCthulhu: + return BrainOfCthulhuAI.VanillaBrainofCthulhuAI(npc, Mod); + case NPCID.Creeper: + return BrainOfCthulhuAI.VanillaCreeperAI(npc, Mod); + + case NPCID.QueenBee: + return QueenBeeAI.VanillaQueenBeeAI(npc, Mod); + + case NPCID.SkeletronHand: + return SkeletronAI.VanillaSkeletronHandAI(npc, Mod); + case NPCID.SkeletronHead: + return SkeletronAI.VanillaSkeletronAI(npc, Mod); + + case NPCID.WallofFlesh: + return WallOfFleshAI.VanillaWallofFleshAI(npc, Mod); + case NPCID.WallofFleshEye: + return WallOfFleshAI.VanillaWallofFleshEyeAI(npc, Mod); + + case NPCID.QueenSlimeBoss: + return QueenSlimeAI.VanillaQueenSlimeAI(npc, Mod); + + case NPCID.TheDestroyer: + case NPCID.TheDestroyerBody: + case NPCID.TheDestroyerTail: + return DestroyerAI.VanillaDestroyerAI(npc, Mod); + case NPCID.Probe: + return DestroyerAI.VanillaProbeAI(npc, Mod); + + case NPCID.Retinazer: + return TwinsAI.VanillaRetinazerAI(npc, Mod); + case NPCID.Spazmatism: + return TwinsAI.VanillaSpazmatismAI(npc, Mod); + + case NPCID.SkeletronPrime: + return SkeletronPrimeAI.VanillaSkeletronPrimeAI(npc, Mod); + case NPCID.PrimeLaser: + return SkeletronPrimeAI.VanillaPrimeLaserAI(npc, Mod); + case NPCID.PrimeCannon: + return SkeletronPrimeAI.VanillaPrimeCannonAI(npc, Mod); + case NPCID.PrimeVice: + return SkeletronPrimeAI.VanillaPrimeViceAI(npc, Mod); + case NPCID.PrimeSaw: + return SkeletronPrimeAI.VanillaPrimeSawAI(npc, Mod); + + case NPCID.Plantera: + return PlanteraAI.VanillaPlanteraAI(npc, Mod); + + case NPCID.HallowBoss: + return EmpressofLightAI.VanillaEmpressofLightAI(npc, Mod); + + case NPCID.Golem: + return GolemAI.VanillaGolemAI(npc, Mod); + case NPCID.GolemFistLeft: + case NPCID.GolemFistRight: + return GolemAI.VanillaGolemFistAI(npc, Mod); + case NPCID.GolemHead: + return GolemAI.VanillaGolemHeadAI(npc, Mod); + case NPCID.GolemHeadFree: + return GolemAI.VanillaGolemHeadFreeAI(npc, Mod); + + case NPCID.DukeFishron: + return DukeFishronAI.VanillaDukeFishronAI(npc, Mod); + + case NPCID.CultistBoss: + case NPCID.CultistBossClone: + return CultistAI.VanillaCultistAI(npc, Mod); + case NPCID.AncientLight: + return CultistAI.VanillaAncientLightAI(npc, Mod); + case NPCID.AncientDoom: + return CultistAI.VanillaAncientDoomAI(npc, Mod); + + /*case NPCID.MoonLordCore: + case NPCID.MoonLordHand: + case NPCID.MoonLordHead: + case NPCID.MoonLordFreeEye: + return MoonLordAI.VanillaMoonLordAI(npc, Mod);*/ + + default: + break; + } + } if (CalamityWorld.revenge) { @@ -3104,6 +3762,7 @@ namespace CalamityMod.NPCs case NPCID.SlimeSpiked: case NPCID.SandSlime: case NPCID.GoldenSlime: + case NPCID.ShimmerSlime: return SlimeAI.BuffedSlimeAI(npc, Mod); } } @@ -3140,7 +3799,7 @@ namespace CalamityMod.NPCs if (npc.type == NPCType() || npc.type == NPCType() || npc.type == NPCType()) { - return CalamityGlobalAI.BuffedFighterAI(npc, Mod); + return RevengeanceAndDeathAI.BuffedFighterAI(npc, Mod); } else { @@ -3329,7 +3988,7 @@ namespace CalamityMod.NPCs case NPCID.MartianWalker: case NPCID.DemonTaxCollector: case NPCID.TheBride: - return CalamityGlobalAI.BuffedFighterAI(npc, Mod); + return RevengeanceAndDeathAI.BuffedFighterAI(npc, Mod); } } break; @@ -3354,7 +4013,7 @@ namespace CalamityMod.NPCs case NPCID.HornetSpikey: case NPCID.HornetStingy: case NPCID.MossHornet: - return CalamityGlobalAI.BuffedFlyingAI(npc, Mod); + return RevengeanceAndDeathAI.BuffedFlyingAI(npc, Mod); } break; @@ -3389,7 +4048,7 @@ namespace CalamityMod.NPCs case NPCID.BloodEelHead: case NPCID.BloodEelBody: case NPCID.BloodEelTail: - return CalamityGlobalAI.BuffedWormAI(npc, Mod); + return RevengeanceAndDeathAI.BuffedWormAI(npc, Mod); // Death Mode splitting worms. case NPCID.DiggerHead: @@ -3402,7 +4061,7 @@ namespace CalamityMod.NPCs case NPCID.DuneSplicerBody: case NPCID.DuneSplicerTail: if (CalamityWorld.death) - return CalamityGlobalAI.BuffedWormAI(npc, Mod); + return RevengeanceAndDeathAI.BuffedWormAI(npc, Mod); else return true; } @@ -3423,7 +4082,7 @@ namespace CalamityMod.NPCs case NPCID.DiabolistWhite: case NPCID.DesertDjinn: case NPCID.GoblinSorcerer: - return CalamityGlobalAI.BuffedCasterAI(npc, Mod); + return RevengeanceAndDeathAI.BuffedCasterAI(npc, Mod); } break; @@ -3436,14 +4095,14 @@ namespace CalamityMod.NPCs case NPCID.AngryTrapper: case NPCID.FungiBulb: case NPCID.GiantFungiBulb: - return CalamityGlobalAI.BuffedPlantAI(npc, Mod); + return RevengeanceAndDeathAI.BuffedPlantAI(npc, Mod); } break; case NPCAIStyleID.Bat: if (npc.type == NPCType() || npc.type == NPCType() || npc.type == NPCType()) { - return CalamityGlobalAI.BuffedBatAI(npc, Mod); + return RevengeanceAndDeathAI.BuffedBatAI(npc, Mod); } else { @@ -3465,7 +4124,7 @@ namespace CalamityMod.NPCs case NPCID.FlyingSnake: case NPCID.VampireBat: case NPCID.SporeBat: - return CalamityGlobalAI.BuffedBatAI(npc, Mod); + return RevengeanceAndDeathAI.BuffedBatAI(npc, Mod); } } break; @@ -3480,7 +4139,7 @@ namespace CalamityMod.NPCs case NPCID.Arapaima: case NPCID.BloodFeeder: case NPCID.CrimsonGoldfish: - return CalamityGlobalAI.BuffedSwimmingAI(npc, Mod); + return RevengeanceAndDeathAI.BuffedSwimmingAI(npc, Mod); } break; @@ -3493,7 +4152,7 @@ namespace CalamityMod.NPCs case NPCID.Squid: case NPCID.BloodJelly: case NPCID.FungoFish: - return CalamityGlobalAI.BuffedJellyfishAI(npc, Mod); + return RevengeanceAndDeathAI.BuffedJellyfishAI(npc, Mod); } break; @@ -3501,7 +4160,7 @@ namespace CalamityMod.NPCs switch (npc.type) { case NPCID.Antlion: - return CalamityGlobalAI.BuffedAntlionAI(npc, Mod); + return RevengeanceAndDeathAI.BuffedAntlionAI(npc, Mod); } break; @@ -3509,7 +4168,7 @@ namespace CalamityMod.NPCs switch (npc.type) { case NPCID.SpikeBall: - return CalamityGlobalAI.BuffedSpikeBallAI(npc, Mod); + return RevengeanceAndDeathAI.BuffedSpikeBallAI(npc, Mod); } break; @@ -3517,7 +4176,7 @@ namespace CalamityMod.NPCs switch (npc.type) { case NPCID.BlazingWheel: - return CalamityGlobalAI.BuffedBlazingWheelAI(npc, Mod); + return RevengeanceAndDeathAI.BuffedBlazingWheelAI(npc, Mod); } break; @@ -3534,7 +4193,7 @@ namespace CalamityMod.NPCs case NPCID.Poltergeist: case NPCID.Drippler: case NPCID.Reaper: - return CalamityGlobalAI.BuffedHoveringAI(npc, Mod); + return RevengeanceAndDeathAI.BuffedHoveringAI(npc, Mod); } break; @@ -3544,7 +4203,7 @@ namespace CalamityMod.NPCs case NPCID.CursedHammer: case NPCID.EnchantedSword: case NPCID.CrimsonAxe: - return CalamityGlobalAI.BuffedFlyingWeaponAI(npc, Mod); + return RevengeanceAndDeathAI.BuffedFlyingWeaponAI(npc, Mod); } break; @@ -3554,14 +4213,14 @@ namespace CalamityMod.NPCs case NPCID.Mimic: case NPCID.PresentMimic: case NPCID.IceMimic: - return CalamityGlobalAI.BuffedMimicAI(npc, Mod); + return RevengeanceAndDeathAI.BuffedMimicAI(npc, Mod); } break; case NPCAIStyleID.Unicorn: if (npc.type == NPCType()) { - return CalamityGlobalAI.BuffedUnicornAI(npc, Mod); + return RevengeanceAndDeathAI.BuffedUnicornAI(npc, Mod); } else { @@ -3574,15 +4233,23 @@ namespace CalamityMod.NPCs case NPCID.StardustSpiderSmall: case NPCID.NebulaBeast: case NPCID.Tumbleweed: - return CalamityGlobalAI.BuffedUnicornAI(npc, Mod); + return RevengeanceAndDeathAI.BuffedUnicornAI(npc, Mod); } } break; + case NPCAIStyleID.TheHungry: + switch (npc.type) + { + case NPCID.TheHungry: + return WallOfFleshAI.BuffedHungryAI(npc, Mod); + } + break; + case NPCAIStyleID.GiantTortoise: if (npc.type == NPCType()) { - return CalamityGlobalAI.BuffedTortoiseAI(npc, Mod); + return RevengeanceAndDeathAI.BuffedTortoiseAI(npc, Mod); } else { @@ -3593,7 +4260,7 @@ namespace CalamityMod.NPCs case NPCID.GiantShelly: case NPCID.GiantShelly2: case NPCID.SolarSroller: - return CalamityGlobalAI.BuffedTortoiseAI(npc, Mod); + return RevengeanceAndDeathAI.BuffedTortoiseAI(npc, Mod); } } break; @@ -3606,14 +4273,14 @@ namespace CalamityMod.NPCs case NPCID.JungleCreeperWall: case NPCID.BloodCrawlerWall: case NPCID.DesertScorpionWall: - return CalamityGlobalAI.BuffedSpiderAI(npc, Mod); + return RevengeanceAndDeathAI.BuffedSpiderAI(npc, Mod); } break; case NPCAIStyleID.Herpling: if (npc.type == NPCType()) { - return CalamityGlobalAI.BuffedHerplingAI(npc, Mod); + return RevengeanceAndDeathAI.BuffedHerplingAI(npc, Mod); } else { @@ -3622,7 +4289,7 @@ namespace CalamityMod.NPCs case NPCID.Herpling: case NPCID.Derpling: case NPCID.ChatteringTeethBomb: - return CalamityGlobalAI.BuffedHerplingAI(npc, Mod); + return RevengeanceAndDeathAI.BuffedHerplingAI(npc, Mod); } } break; @@ -3634,7 +4301,7 @@ namespace CalamityMod.NPCs case NPCID.GiantFlyingAntlion: case NPCID.FlyingAntlion: case NPCID.EyeballFlyingFish: - return CalamityGlobalAI.BuffedFlyingFishAI(npc, Mod); + return RevengeanceAndDeathAI.BuffedFlyingFishAI(npc, Mod); } break; @@ -3642,7 +4309,7 @@ namespace CalamityMod.NPCs switch (npc.type) { case NPCID.AngryNimbus: - return CalamityGlobalAI.BuffedAngryNimbusAI(npc, Mod); + return RevengeanceAndDeathAI.BuffedAngryNimbusAI(npc, Mod); } break; @@ -3650,7 +4317,7 @@ namespace CalamityMod.NPCs switch (npc.type) { case NPCID.MartianTurret: - return CalamityGlobalAI.BuffedTeslaTurretAI(npc, Mod); + return RevengeanceAndDeathAI.BuffedTeslaTurretAI(npc, Mod); } break; @@ -3659,7 +4326,7 @@ namespace CalamityMod.NPCs { case NPCID.MartianDrone: case NPCID.SolarCorite: - return CalamityGlobalAI.BuffedCoriteAI(npc, Mod); + return RevengeanceAndDeathAI.BuffedCoriteAI(npc, Mod); } break; @@ -3667,7 +4334,7 @@ namespace CalamityMod.NPCs switch (npc.type) { case NPCID.MartianProbe: - return CalamityGlobalAI.BuffedMartianProbeAI(npc, Mod); + return RevengeanceAndDeathAI.BuffedMartianProbeAI(npc, Mod); } break; @@ -3677,7 +4344,7 @@ namespace CalamityMod.NPCs case NPCID.StardustCellBig: case NPCID.NebulaHeadcrab: case NPCID.DeadlySphere: - return CalamityGlobalAI.BuffedStarCellAI(npc, Mod); + return RevengeanceAndDeathAI.BuffedStarCellAI(npc, Mod); } break; @@ -3686,7 +4353,7 @@ namespace CalamityMod.NPCs { case NPCID.ShadowFlameApparition: case NPCID.AncientCultistSquidhead: - return CalamityGlobalAI.BuffedAncientVisionAI(npc, Mod); + return RevengeanceAndDeathAI.BuffedAncientVisionAI(npc, Mod); } break; @@ -3697,7 +4364,7 @@ namespace CalamityMod.NPCs case NPCID.BigMimicCrimson: case NPCID.BigMimicHallow: case NPCID.BigMimicJungle: - return CalamityGlobalAI.BuffedBigMimicAI(npc, Mod); + return RevengeanceAndDeathAI.BuffedBigMimicAI(npc, Mod); } break; @@ -3705,7 +4372,7 @@ namespace CalamityMod.NPCs switch (npc.type) { case NPCID.MothronEgg: - return CalamityGlobalAI.BuffedMothronEggAI(npc, Mod); + return RevengeanceAndDeathAI.BuffedMothronEggAI(npc, Mod); } break; @@ -3713,7 +4380,7 @@ namespace CalamityMod.NPCs switch (npc.type) { case NPCID.GraniteFlyer: - return CalamityGlobalAI.BuffedGraniteElementalAI(npc, Mod); + return RevengeanceAndDeathAI.BuffedGraniteElementalAI(npc, Mod); } break; @@ -3721,7 +4388,7 @@ namespace CalamityMod.NPCs switch (npc.type) { case NPCID.StardustCellSmall: - return CalamityGlobalAI.BuffedSmallStarCellAI(npc, Mod); + return RevengeanceAndDeathAI.BuffedSmallStarCellAI(npc, Mod); } break; @@ -3729,7 +4396,7 @@ namespace CalamityMod.NPCs switch (npc.type) { case NPCID.StardustJellyfishBig: - return CalamityGlobalAI.BuffedFlowInvaderAI(npc, Mod); + return RevengeanceAndDeathAI.BuffedFlowInvaderAI(npc, Mod); } break; @@ -3738,8 +4405,17 @@ namespace CalamityMod.NPCs } } + if (npc.type == NPCID.QueenSlimeMinionBlue) + return QueenSlimeAI.QueenSlimeCrystalSlimeAI(npc, Mod); + + if (npc.type == NPCID.QueenSlimeMinionPink) + return QueenSlimeAI.QueenSlimeBouncySlimeAI(npc, Mod); + + if (npc.type == NPCID.FungiBulb) + return RevengeanceAndDeathAI.BuffedPlantAI(npc, Mod); + if (npc.type == NPCID.FungiSpore || npc.type == NPCID.Spore) - return CalamityGlobalAI.BuffedSporeAI(npc, Mod); + return RevengeanceAndDeathAI.BuffedSporeAI(npc, Mod); // Fairies don't run away and are immune to damage while wearing Fairy Boots. if (npc.type >= NPCID.FairyCritterPink && npc.type <= NPCID.FairyCritterBlue && (npc.ai[2] < 2f || npc.ai[2] == 7f)) @@ -3815,7 +4491,7 @@ namespace CalamityMod.NPCs if ((int)Main.timeForVisualEffects % 2 == 0) { npc.position += npc.netOffset; - Dust dust = Dust.NewDustDirect(npc.Center - new Vector2(dustPosition) * 0.5f, dustPosition + 4, dustPosition + 4, 278, 0f, 0f, 200, Color.Lerp(dustLerpColor1, dustLerpColor2, Main.rand.NextFloat()), 0.65f); + Dust dust = Dust.NewDustDirect(npc.Center - new Vector2(dustPosition) * 0.5f, dustPosition + 4, dustPosition + 4, DustID.FireworksRGB, 0f, 0f, 200, Color.Lerp(dustLerpColor1, dustLerpColor2, Main.rand.NextFloat()), 0.65f); dust.velocity *= 0f; dust.velocity += npc.velocity * 0.3f; dust.noGravity = true; @@ -4097,6 +4773,160 @@ namespace CalamityMod.NPCs #region AI public override void AI(NPC npc) { + // Fair contact damage + switch (npc.type) + { + case NPCID.DD2Betsy: + npc.damage = npc.ai[0] == 2f ? npc.defDamage : 0; + break; + + case NPCID.DD2WyvernT1: + case NPCID.DD2WyvernT2: + case NPCID.DD2WyvernT3: + npc.damage = npc.ai[0] == 2f ? npc.defDamage : 0; + break; + + case NPCID.DD2GoblinT1: + case NPCID.DD2GoblinT2: + case NPCID.DD2GoblinT3: + npc.damage = (npc.ai[0] > 0f && npc.ai[0] < 24f) ? npc.defDamage : 0; + break; + + case NPCID.PumpkingBlade: + npc.damage = (npc.ai[2] == 2f || npc.ai[2] == 5f) ? npc.defDamage : 0; + break; + + case NPCID.Mothron: + npc.damage = npc.ai[0] == 3.2f ? (int)Math.Round(npc.defDamage * 1.3) : npc.ai[0] == 2f ? (int)Math.Round(npc.defDamage * 0.5) : 0; + break; + + case NPCID.MothronSpawn: + npc.damage = npc.ai[0] == 2.1f ? npc.defDamage : 0; + break; + + case NPCID.Flocko: + npc.damage = npc.ai[0] > 0f ? npc.defDamage : 0; + break; + + case NPCID.Mimic: + case NPCID.IceMimic: + case NPCID.PresentMimic: + npc.damage = (npc.ai[0] == 0f || npc.velocity.Y == 0f) ? 0 : npc.defDamage; + break; + + case NPCID.BigMimicCorruption: + case NPCID.BigMimicCrimson: + case NPCID.BigMimicHallow: + case NPCID.BigMimicJungle: + npc.damage = npc.ai[0] == 3f ? 0 : npc.defDamage; + + // Spend less time in closed state + if (npc.ai[0] == 3f) + npc.ai[1] += 0.5f; + + break; + + case NPCID.DeadlySphere: + npc.damage = npc.ai[0] == 1f ? npc.defDamage : 0; + break; + + case NPCID.NebulaHeadcrab: + npc.damage = npc.ai[0] == 5f ? npc.defDamage : 0; + break; + + case NPCID.MartianDrone: + case NPCID.SolarCorite: + npc.damage = (npc.ai[0] == 2f || npc.ai[0] == 3f) ? npc.defDamage : 0; + break; + + case NPCID.ArmedTorchZombie: + case NPCID.ArmedZombie: + case NPCID.ArmedZombieCenx: + case NPCID.ArmedZombieEskimo: + case NPCID.ArmedZombiePincussion: + case NPCID.ArmedZombieSlimed: + case NPCID.ArmedZombieSwamp: + case NPCID.ArmedZombieTwiggy: + case NPCID.Crawdad: + case NPCID.Crawdad2: + npc.damage = npc.ai[2] == 0f ? 0 : (int)Math.Round(npc.defDamage * 1.4); + break; + + case NPCID.GraniteFlyer: + npc.damage = npc.ai[0] == -1f ? 0 : npc.defDamage; + break; + + case NPCID.GraniteGolem: + npc.damage = npc.ai[2] < 0f ? 0 : npc.defDamage; + break; + + case NPCID.Squid: + case NPCID.BlueJellyfish: + case NPCID.GreenJellyfish: + case NPCID.PinkJellyfish: + case NPCID.BloodJelly: + case NPCID.FungoFish: + float damagingVelocity = npc.type == NPCID.GreenJellyfish ? 3.6f : 2.8f; + npc.damage = (npc.dontTakeDamage || npc.velocity.Length() > damagingVelocity) ? npc.defDamage : 0; + break; + + case NPCID.Herpling: + case NPCID.Derpling: + npc.damage = (npc.velocity.Y == 0f || npc.velocity.Length() < 3f) ? 0 : npc.defDamage; + break; + + case NPCID.BlueSlime: + case NPCID.MotherSlime: + case NPCID.LavaSlime: + case NPCID.DungeonSlime: + case NPCID.CorruptSlime: + case NPCID.IlluminantSlime: + case NPCID.ToxicSludge: + case NPCID.IceSlime: + case NPCID.Crimslime: + case NPCID.UmbrellaSlime: + case NPCID.RainbowSlime: + case NPCID.SlimeMasked: + case NPCID.HoppinJack: + case NPCID.SlimeRibbonWhite: + case NPCID.SlimeRibbonYellow: + case NPCID.SlimeRibbonGreen: + case NPCID.SlimeRibbonRed: + case NPCID.SandSlime: + case NPCID.GoldenSlime: + case NPCID.ShimmerSlime: + case NPCID.GreenSlime: + case NPCID.RedSlime: + case NPCID.PurpleSlime: + case NPCID.YellowSlime: + case NPCID.BlackSlime: + case NPCID.JungleSlime: + case NPCID.BabySlime: + case NPCID.Pinky: + case NPCID.BunnySlimed: + case NPCID.Slimeling: + case NPCID.Slimer2: + npc.damage = (npc.velocity.Y == 0f || npc.velocity.Length() < 3f) ? 0 : npc.defDamage; + break; + + case NPCID.GiantShelly: + case NPCID.GiantShelly2: + npc.damage = npc.ai[0] == 3f ? (int)Math.Round(npc.defDamage * 1.2) : 0; + break; + + case NPCID.GiantTortoise: + case NPCID.IceTortoise: + npc.damage = npc.ai[0] == 3f ? (int)Math.Round(npc.defDamage * 1.4) : 0; + break; + + case NPCID.SolarSroller: + npc.damage = npc.ai[0] == 6f ? (int)Math.Round(npc.defDamage * 1.2) : 0; + break; + + default: + break; + } + if (CalamityWorld.revenge && npc.type == NPCID.DungeonGuardian) SkeletronAI.RevengeanceDungeonGuardianAI(npc); } @@ -4117,7 +4947,7 @@ namespace CalamityMod.NPCs { if (Main.rand.NextBool()) { - Dust dust = Dust.NewDustDirect(npc.position, npc.width, npc.height, 204, 0f, 0f, 150, default, 0.3f); + Dust dust = Dust.NewDustDirect(npc.position, npc.width, npc.height, DustID.TreasureSparkle, 0f, 0f, 150, default, 0.3f); dust.fadeIn = 0.75f; dust.velocity *= 0.1f; dust.noLight = true; @@ -4135,7 +4965,7 @@ namespace CalamityMod.NPCs { if (Main.rand.NextBool(10)) { - Dust dust = Dust.NewDustDirect(npc.position, npc.width, npc.height, 44, 0f, 0f, 250, default, 0.4f); + Dust dust = Dust.NewDustDirect(npc.position, npc.width, npc.height, DustID.JungleSpore, 0f, 0f, 250, default, 0.4f); dust.fadeIn = 0.7f; } } @@ -4151,7 +4981,7 @@ namespace CalamityMod.NPCs { if (Main.rand.NextBool(5)) { - Dust dust = Dust.NewDustDirect(npc.position, npc.width, npc.height, 75, 0f, 0f, 100, default, 1.5f); + Dust dust = Dust.NewDustDirect(npc.position, npc.width, npc.height, DustID.CursedTorch, 0f, 0f, 100, default, 1.5f); dust.noGravity = true; } } @@ -4254,6 +5084,25 @@ namespace CalamityMod.NPCs if (RancorBurnTime > 0) RancorBurnTime--; + if (veriumDoomTimer > 0) + veriumDoomTimer--; + if (veriumDoomTimer == 0 && veriumDoomMarked) + { + for (int d = 0; d < 14 + veriumDoomStacks; d++) + { + Particle sparks = new LineParticle(npc.Center, new Vector2(Main.rand.NextFloat(-9f, 9f), Main.rand.NextFloat(-9f, 9f)), false, 45, 0.9f, Main.rand.NextBool() ? Color.Cyan : Color.SkyBlue); + GeneralParticleHandler.SpawnParticle(sparks); + } + //Particle boop = new CustomPulse(npc.Center, Vector2.Zero, new Color(233, 95, 212), "CalamityMod/Particles/Sparkle2", Vector2.One, Main.rand.NextFloat(-5f, 5f), 0.8f + (float)(0.04 * veriumDoomStacks), 1.6f + (float)(0.08 * veriumDoomStacks), 40); + //GeneralParticleHandler.SpawnParticle(boop); + + SoundEngine.PlaySound(new("CalamityMod/Sounds/NPCHit/CryogenHit", 3) { Volume = 0.6f}, npc.Center); + Projectile.NewProjectile(npc.GetSource_FromThis(), npc.Center, Vector2.Zero, ModContent.ProjectileType(), 100 + (15 * veriumDoomStacks), 0, Main.myPlayer, 200f); + + veriumDoomMarked = false; + veriumDoomStacks = 0; + } + // Queen Bee is completely immune to having her movement impaired if not in a high difficulty mode. if (npc.type == NPCID.QueenBee && !CalamityWorld.revenge && !BossRushEvent.BossRushActive) return; @@ -4309,6 +5158,84 @@ namespace CalamityMod.NPCs if (pearlAura > 0) npc.velocity *= 0.9f; } + + // Auric Ore/Repulsers reject Town NPCs and dummies + if ((NPCID.Sets.ActsLikeTownNPC[npc.type] || npc.townNPC) && !npc.dontTakeDamage || npc.type == NPCType()) + { + int auricOreID = TileType(); + int auricRepulserID = TileType(); + + // Get a list of tiles near the npc + // This is just Collision.GetEntityTiles but with a larger detection square because the sheer speed from auric boosts causes the detection to fail at higher speeds + List EdgeTiles = new List(); + int extraDist = (int)(8 * npc.velocity.Length() / 6) + 1; + int left = (int)npc.position.X - extraDist; + int up = (int)npc.position.Y - extraDist; + int right = (int)npc.Right.X + extraDist; + int down = (int)npc.Bottom.Y + extraDist; + if (left % 16 == 0) + { + left--; + } + + if (up % 16 == 0) + { + up--; + } + + if (right % 16 == 0) + { + right++; + } + + if (down % 16 == 0) + { + down++; + } + + int width = right / 16 - left / 16; + int height = down / 16 - up / 16; + left /= 16; + up /= 16; + for (int i = left; i <= left + width; i++) + { + EdgeTiles.Add(new Point(i, up)); + EdgeTiles.Add(new Point(i, up + height)); + } + + for (int j = up; j < up + height; j++) + { + EdgeTiles.Add(new Point(left, j)); + EdgeTiles.Add(new Point(left + width, j)); + } + foreach (Point touchedTile in EdgeTiles) + { + Tile tile = Framing.GetTileSafely(touchedTile); + if (!tile.HasTile || !tile.HasUnactuatedTile) + continue; + if (tile.TileType != auricOreID && tile.TileType != auricRepulserID) + continue; + + // Force Auric Ore to animate with its crackling electricity + if (tile.TileType == auricOreID) + { + AuricOre.Animate = true; + } + + var yeetVec = Vector2.Normalize(npc.Center - touchedTile.ToWorldCoordinates()); + npc.velocity += yeetVec * 20f; + // Speed must be clamped or they start clipping through tiles very easily + float clampedSpeed = MathHelper.Clamp(npc.velocity.Length(), -40, 40); + npc.velocity = npc.velocity.SafeNormalize(Vector2.Zero) * clampedSpeed; + if (tile.TileType == auricOreID) + { + npc.SimpleStrikeNPC((int)(npc.lifeMax * 0.2f), 0); + npc.AddBuff(BuffID.Electrified, 300); + } + SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/ExoMechs/TeslaShoot1"), npc.Center); + break; + } + } } #endregion @@ -4318,7 +5245,7 @@ namespace CalamityMod.NPCs if (hurtInfo.Damage <= 0) return; - if (target.Calamity().sulfurSet) + if (target.Calamity().sulphurSet) npc.AddBuff(BuffID.Poisoned, 120); if (target.Calamity().snowman) @@ -4329,25 +5256,60 @@ namespace CalamityMod.NPCs switch (npc.type) { - case NPCID.ShadowFlameApparition: - target.AddBuff(BuffType(), 180); + case NPCID.VileSpitEaterOfWorlds: + case NPCID.VileSpit: + + target.AddBuff(BuffType(), 180); + if (Main.rand.NextBool(10)) + target.AddBuff(BuffID.Weak, 3600); + else if (Main.rand.NextBool(5)) + target.AddBuff(BuffID.Weak, 720); + else if (Main.rand.NextBool(2)) + target.AddBuff(BuffID.Weak, 120); + else + target.AddBuff(BuffID.Weak, 60); + break; + + case NPCID.ShadowFlameApparition: + target.AddBuff(BuffType(), 120); + break; + case NPCID.ChaosBall: if (Main.hardMode || CalamityPlayer.areThereAnyDamnBosses) - target.AddBuff(BuffType(), 180); + target.AddBuff(BuffType(), 120); + break; + + case NPCID.EyeofCthulhu: + if (npc.ai[0] > 2f) + target.AddBuff(BuffID.Bleeding, 180); + break; + + case NPCID.WallofFlesh: + target.AddBuff(BuffID.Bleeding, 300); break; case NPCID.Spazmatism: if (npc.ai[0] != 1f && npc.ai[0] != 2f && npc.ai[0] != 0f) - target.AddBuff(BuffID.Bleeding, 600); + target.AddBuff(BuffID.Bleeding, 300); + break; + + case NPCID.SkeletronPrime: + if (npc.ai[1] == 1f || npc.ai[1] == 2f) + target.AddBuff(BuffID.Bleeding, 300); + break; + + case NPCID.PrimeSaw: + target.AddBuff(BuffID.Bleeding, 180); break; case NPCID.Plantera: if (npc.life < npc.lifeMax / 2) - target.AddBuff(BuffID.Poisoned, 600); + target.AddBuff(BuffID.Poisoned, 300); break; + case NPCID.PlanterasTentacle: - target.AddBuff(BuffID.Poisoned, 300); + target.AddBuff(BuffID.Poisoned, 120); break; case NPCID.Golem: @@ -4361,34 +5323,25 @@ namespace CalamityMod.NPCs target.AddBuff(BuffType(), 240); break; - case NPCID.AncientDoom: - target.AddBuff(BuffType(), 180); - break; case NPCID.AncientLight: target.AddBuff(BuffType(), 120); break; case NPCID.HallowBoss: - target.AddBuff(BuffType(), 320); + target.AddBuff(NPC.ShouldEmpressBeEnraged() ? BuffType() : BuffType(), 240); break; case NPCID.BloodNautilus: - target.AddBuff(BuffType(), 480); + target.AddBuff(BuffType(), 300); break; case NPCID.GoblinShark: case NPCID.BloodEelHead: - target.AddBuff(BuffType(), 300); - break; - case NPCID.BloodEelBody: target.AddBuff(BuffType(), 180); break; - case NPCID.BloodEelTail: - target.AddBuff(BuffType(), 120); - break; case NPCID.Lavabat: - target.AddBuff(BuffID.OnFire, 180); + target.AddBuff(BuffID.OnFire, 120); break; case NPCID.RuneWizard: @@ -4447,7 +5400,7 @@ namespace CalamityMod.NPCs switch (npc.type) { case NPCID.Hellbat: - target.AddBuff(BuffID.OnFire, 120); + target.AddBuff(BuffID.OnFire, 60); break; default: @@ -4595,7 +5548,7 @@ namespace CalamityMod.NPCs { float pointBlankShotDurationRatio = projectile.Calamity().pointBlankShotDuration / (float)CalamityGlobalProjectile.DefaultPointBlankDuration; float pointBlankShotDistanceRatio = 1f - projectile.Calamity().pointBlankShotDistanceTravelled / CalamityGlobalProjectile.PointBlankShotDistanceLimit; - float pointBlankDamageRatio = (pointBlankShotDurationRatio < pointBlankShotDistanceRatio ? pointBlankShotDurationRatio : pointBlankShotDistanceRatio) * 0.5f; + float pointBlankDamageRatio = (pointBlankShotDurationRatio < pointBlankShotDistanceRatio ? pointBlankShotDurationRatio : pointBlankShotDistanceRatio) * 0.25f; float pointBlankShotDamageMultiplier = 1f + pointBlankDamageRatio; modifiers.SourceDamage *= pointBlankShotDamageMultiplier; projectile.Calamity().pointBlankShotDuration = 0; @@ -4634,6 +5587,10 @@ namespace CalamityMod.NPCs if (CalamityLists.ThanatosIDs.Contains(npc.type) && unbreakableDR) return; + // Isolates projectiles which ignore pierce resist only on Leviathan and Astrum Aureus + if ((npc.type == NPCType() || npc.type == NPCType()) && CalamityLists.pierceResistExceptionLeviAureusList.Contains(projectile.type)) + return; + float damageReduction = projectile.Calamity().timesPierced * CalamityGlobalProjectile.PierceResistHarshness; if (damageReduction > CalamityGlobalProjectile.PierceResistCap) damageReduction = CalamityGlobalProjectile.PierceResistCap; @@ -4718,6 +5675,26 @@ namespace CalamityMod.NPCs #region Check Dead public override bool CheckDead(NPC npc) { + if (npc.type == NPCID.SkeletronPrime) + { + if ((Main.masterMode || BossRushEvent.BossRushActive) && CalamityWorld.revenge) + { + // Kill the other head if he's still alive when this head dies + for (int i = 0; i < Main.maxNPCs; i++) + { + NPC nPC = Main.npc[i]; + if (nPC.active && nPC.type == ModContent.NPCType() && nPC.life > 0) + { + nPC.life = 0; + nPC.HitEffect(); + nPC.checkDead(); + nPC.active = false; + nPC.netUpdate = true; + } + } + } + } + if (npc.lifeMax > 1000 && npc.type != NPCID.DungeonSpirit && npc.type != NPCType() && npc.type != NPCType() && @@ -4739,7 +5716,7 @@ namespace CalamityMod.NPCs NPCType() }); - NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, randomType, 0, 0f, 0f, 0f, 0f, 255); + NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, randomType); } } @@ -4837,7 +5814,7 @@ namespace CalamityMod.NPCs Rectangle hitbox = npc.Hitbox; for (int i = 0; i < 20; i++) { - int idx = Dust.NewDust(hitbox.TopLeft(), npc.width, npc.height, 89, 0f, -2.5f); + int idx = Dust.NewDust(hitbox.TopLeft(), npc.width, npc.height, DustID.GemEmerald, 0f, -2.5f); Dust dust = Main.dust[idx]; dust.alpha = 200; dust.velocity *= 1.4f; @@ -5092,6 +6069,13 @@ namespace CalamityMod.NPCs spawnInfo.Player.Calamity().ZoneSunkenSea || (spawnInfo.Player.Calamity().ZoneAstral && !spawnInfo.Player.PillarZone()); + // Replace vanilla Lava Slimes with Calamity Lava Slimes to avoid annoying lava drops + if (spawnInfo.Player.ZoneUnderworldHeight && !calamityBiomeZone && CalamityConfig.Instance.RemoveLavaDropsFromLavaSlimes && Main.expertMode) + { + pool.Add(NPCType(), SpawnCondition.Underworld.Chance); + pool[NPCID.LavaSlime] = 0f; + } + // Spawn Green Jellyfish in prehm and Blue Jellyfish in hardmode if (spawnInfo.Player.ZoneRockLayerHeight && spawnInfo.Water && !calamityBiomeZone) { @@ -5278,7 +6262,7 @@ namespace CalamityMod.NPCs { if (CalamityWorld.revenge || BossRushEvent.BossRushActive) { - if (npc.type == NPCID.SkeletronPrime) + if (npc.type == NPCID.SkeletronPrime || npc.type == ModContent.NPCType()) npc.frameCounter = 0D; } } @@ -5345,19 +6329,31 @@ namespace CalamityMod.NPCs if (vaporfied > 0) Vaporfied.DrawEffects(npc, ref drawColor); + if (veriumDoomTimer > 0) + { + int sparkleChance = Math.Max(2, 8 - (veriumDoomStacks / 2)); + if (veriumDoomTimer % sparkleChance == 0) + { + float veriumRatio = (float)veriumDoomTimer / (float)veriumDoomTime; + Vector2 randPosition = new Vector2(npc.position.X + Main.rand.Next(0, npc.width), npc.position.Y + Main.rand.Next(0, npc.height)); + Particle markedSparkle = new CustomPulse(randPosition, Vector2.Zero, Color.Lerp(new Color(103, 230, 240), new Color(255, 110, 220), 1 - veriumRatio), "CalamityMod/Particles/Sparkle", Vector2.One, Main.rand.NextFloat(-0.75f, 0.75f), 0.9f, 1.1f, 35); + GeneralParticleHandler.SpawnParticle(markedSparkle); + } + } + // TODO -- These debuff visuals cannot be moved because they correspond to vanilla debuffs if (electrified > 0) { if (Main.rand.NextBool()) { - Dust.NewDustDirect(npc.position, npc.width, npc.height, 226, Main.rand.NextFloat(-2f, 2f), Main.rand.NextFloat(-2f, 2f), 0, default, 0.35f); + Dust.NewDustDirect(npc.position, npc.width, npc.height, DustID.Electric, Main.rand.NextFloat(-2f, 2f), Main.rand.NextFloat(-2f, 2f), 0, default, 0.35f); } } if (slowed > 0) { if (Main.rand.Next(5) < 4) { - int dust = Dust.NewDust(npc.position - new Vector2(2f, 2f), npc.width + 4, npc.height + 4, 191, npc.velocity.X * 0.4f, npc.velocity.Y * 0.4f, 225, default, 3f); + int dust = Dust.NewDust(npc.position - new Vector2(2f, 2f), npc.width + 4, npc.height + 4, DustID.SpookyWood, npc.velocity.X * 0.4f, npc.velocity.Y * 0.4f, 225, default, 3f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 1.1f; Main.dust[dust].velocity.Y += 0.25f; @@ -5372,7 +6368,7 @@ namespace CalamityMod.NPCs { if (Main.rand.Next(5) < 4) { - int dust = Dust.NewDust(npc.position - new Vector2(2f, 2f), npc.width + 4, npc.height + 4, 30, npc.velocity.X * 0.4f, npc.velocity.Y * 0.4f, 100, default, 1.5f); + int dust = Dust.NewDust(npc.position - new Vector2(2f, 2f), npc.width + 4, npc.height + 4, DustID.Web, npc.velocity.X * 0.4f, npc.velocity.Y * 0.4f, 100, default, 1.5f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 1.1f; Main.dust[dust].velocity.Y += 0.25f; @@ -5384,6 +6380,31 @@ namespace CalamityMod.NPCs } } + // Cobalt and Mythril weapon particle effects + if (isNerfedByCobalt) + { + if (Main.rand.NextBool(5)) + { + Vector2 spawnLocation = new Vector2(Main.rand.NextFloat(npc.position.X, npc.position.X + npc.width), Main.rand.NextFloat(npc.position.Y, npc.position.Y + npc.height)); + Vector2 velocity = new Vector2(0f, MathHelper.Max(Main.rand.NextFloat(4f, 6f) * ((npc.height - (spawnLocation.Y - npc.position.Y)) / 65), 0.6f)); + + Particle cobaltArrow = new StatDownArrow(spawnLocation, velocity, new Color(27, 141, 235), new Color(0, 94, 181), 0.75f, 15); + GeneralParticleHandler.SpawnParticle(cobaltArrow); + } + } + + if (isNerfedByMythril) + { + if (Main.rand.NextBool(5)) + { + Vector2 spawnLocation = new Vector2(Main.rand.NextFloat(npc.position.X, npc.position.X + npc.width), Main.rand.NextFloat(npc.position.Y, npc.position.Y + npc.height)); + Vector2 velocity = new Vector2(0f, MathHelper.Max(Main.rand.NextFloat(4f, 6f) * ((npc.height - (spawnLocation.Y - npc.position.Y)) / 65), 0.6f)); + + Particle mythrilArrow = new StatDownArrow(spawnLocation, velocity, new Color(35, 217, 144), new Color(23, 145, 97), 0.75f, 15); + GeneralParticleHandler.SpawnParticle(mythrilArrow); + } + } + // Some extraneous and probably undocumented visual effect caused by the heart lad pet thing if (ladHearts > 0 && !npc.loveStruck && Main.netMode != NetmodeID.Server) { @@ -5428,21 +6449,24 @@ namespace CalamityMod.NPCs return null; if (Main.LocalPlayer.Calamity().trippy || (npc.type == NPCID.KingSlime && CalamityWorld.LegendaryMode && CalamityWorld.revenge)) - return new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, npc.alpha); + return new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, Main.DiscoR); + + if (npc.type == NPCID.KingSlime && Main.masterMode && CalamityWorld.revenge) + return NPC.AnyNPCs(ModContent.NPCType()) ? Color.Lerp(new Color(0, 0, 150, npc.alpha), new Color(125, 125, 255, npc.alpha), (float)Math.Sin(Main.GlobalTimeWrappedHourly) / 2f + 0.5f) : null; if (npc.type == NPCID.QueenBee && Main.zenithWorld) { if (npc.life / (float)npc.lifeMax < 0.5f) - return new Color(0, 255, 0, npc.alpha); + return new Color(0, 255, 0, 255 - npc.alpha); else - return new Color(255, 0, 0, npc.alpha); + return new Color(255, 0, 0, 255 - npc.alpha); } if (npc.HasBuff()) - return new Color(200, 50, 50, npc.alpha); + return new Color(200, 50, 50, 255 - npc.alpha); if (npc.Calamity().kamiFlu > 0 && !CalamityLists.kamiDebuffColorImmuneList.Contains(npc.type)) - return new Color(51, 197, 108, npc.alpha); + return new Color(51, 197, 108, 255 - npc.alpha); if (npc.type == NPCID.VileSpit || npc.type == NPCID.VileSpitEaterOfWorlds) return new Color(150, 200, 0, npc.alpha); @@ -5529,23 +6553,23 @@ namespace CalamityMod.NPCs if (npc.shadowFlame) currentDebuffs.Add(TextureAssets.Buff[BuffID.ShadowFlame].Value); if (npc.oiled) - currentDebuffs.Add(TextureAssets.Buff[BuffID.Oiled].Value); + currentDebuffs.Add(Request("CalamityMod/ExtraTextures/VanillaBuffs/Oiled").Value); if (npc.javelined) currentDebuffs.Add(TextureAssets.Buff[BuffID.BoneJavelin].Value); if (npc.daybreak) - currentDebuffs.Add(TextureAssets.Buff[BuffID.Daybreak].Value); + currentDebuffs.Add(Request("CalamityMod/ExtraTextures/VanillaBuffs/Daybroken").Value); if (npc.celled) - currentDebuffs.Add(TextureAssets.Buff[BuffID.StardustMinionBleed].Value); + currentDebuffs.Add(Request("CalamityMod/ExtraTextures/VanillaBuffs/Celled").Value); if (npc.dryadBane) - currentDebuffs.Add(TextureAssets.Buff[BuffID.DryadsWardDebuff].Value); + currentDebuffs.Add(Request("CalamityMod/ExtraTextures/VanillaBuffs/DryadsBane").Value); if (npc.dryadWard) currentDebuffs.Add(TextureAssets.Buff[BuffID.DryadsWard].Value); if (npc.soulDrain && npc.realLife == -1) currentDebuffs.Add(TextureAssets.Buff[BuffID.SoulDrain].Value); if (npc.onFire3) // Hellfire - currentDebuffs.Add(TextureAssets.Buff[BuffID.OnFire3].Value); + currentDebuffs.Add(Request("CalamityMod/ExtraTextures/VanillaBuffs/Hellfire").Value); if (npc.onFrostBurn2) // Frostbite - currentDebuffs.Add(TextureAssets.Buff[BuffID.Frostburn2].Value); + currentDebuffs.Add(Request("CalamityMod/ExtraTextures/VanillaBuffs/Frostbite").Value); if (npc.tentacleSpiked) currentDebuffs.Add(TextureAssets.Buff[BuffID.TentacleSpike].Value); @@ -5565,7 +6589,7 @@ namespace CalamityMod.NPCs if (npc.stinky) currentDebuffs.Add(TextureAssets.Buff[BuffID.Stinky].Value); if (npc.betsysCurse) - currentDebuffs.Add(TextureAssets.Buff[BuffID.BetsysCurse].Value); + currentDebuffs.Add(Request("CalamityMod/ExtraTextures/VanillaBuffs/BetsysCurse").Value); if (npc.dripping) currentDebuffs.Add(TextureAssets.Buff[BuffID.Wet].Value); if (npc.drippingSlime) @@ -5622,7 +6646,7 @@ namespace CalamityMod.NPCs if (CalamityWorld.revenge || BossRushEvent.BossRushActive) { - if (npc.type == NPCID.SkeletronPrime || CalamityLists.DestroyerIDs.Contains(npc.type)) + if (npc.type == NPCID.SkeletronPrime || npc.type == ModContent.NPCType() || CalamityLists.DestroyerIDs.Contains(npc.type)) return false; } @@ -5638,6 +6662,16 @@ namespace CalamityMod.NPCs Vector2 eyesDrawPosition = headDrawPosition - npc.scale * new Vector2(1f, 12f); Rectangle eyesFrame = new Rectangle(0, 0, TextureAssets.Golem[1].Value.Width, TextureAssets.Golem[1].Value.Height / 2); spriteBatch.Draw(TextureAssets.Golem[1].Value, eyesDrawPosition, eyesFrame, eyeColor, 0f, eyesFrame.Size() * 0.5f, npc.scale, SpriteEffects.None, 0f); + + // Draw the glowmasks. + int frameCounter = (int)npc.frameCounter / 4; + Rectangle frame = TextureAssets.Extra[106].Value.Frame(1, 8); + frame.Y += frame.Height * 2 * frameCounter + npc.frame.Y; + Rectangle glowFrame = frame; + spriteBatch.Draw(TextureAssets.Extra[106].Value, eyesDrawPosition, glowFrame, eyeColor, 0f, glowFrame.Size() * 0.5f, npc.scale, SpriteEffects.None, 0f); + frame = npc.frame; + Rectangle glowFrame2 = frame; + spriteBatch.Draw(TextureAssets.Extra[107].Value, eyesDrawPosition, glowFrame2, eyeColor, 0f, glowFrame2.Size() * 0.5f, npc.scale, SpriteEffects.None, 0f); return false; } @@ -5645,41 +6679,119 @@ namespace CalamityMod.NPCs { SpriteEffects spriteEffects = SpriteEffects.None; if (npc.spriteDirection == 1) - { spriteEffects = SpriteEffects.FlipHorizontally; - } - Vector2 halfSizeTexture = new Vector2(TextureAssets.Npc[npc.type].Value.Width / 2, TextureAssets.Npc[npc.type].Value.Height / Main.npcFrameCount[npc.type] / 2); - Color rainbow = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, 0); + Color rainbow = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, Main.DiscoR); Color alphaColor = npc.GetAlpha(rainbow); float RGBMult = 0.99f; alphaColor.R = (byte)(alphaColor.R * RGBMult); alphaColor.G = (byte)(alphaColor.G * RGBMult); alphaColor.B = (byte)(alphaColor.B * RGBMult); alphaColor.A = (byte)(alphaColor.A * RGBMult); - float xOffset = screenPos.X + npc.width / 2 - TextureAssets.Npc[npc.type].Value.Width * npc.scale / 2f + halfSizeTexture.X * npc.scale; - float yOffset = screenPos.Y + npc.height - TextureAssets.Npc[npc.type].Value.Height * npc.scale / Main.npcFrameCount[npc.type] + 4f + halfSizeTexture.Y * npc.scale + npc.gfxOffY; - for (int i = 0; i < 4; i++) + int totalAfterimages = Main.player[Main.myPlayer].Calamity().trippyLevel == 3 ? 16 : (Main.player[Main.myPlayer].Calamity().trippyLevel == 2 ? 12 : 4); + for (int i = 0; i < totalAfterimages; i++) { - Vector2 position9 = npc.position; - float num214 = Math.Abs(npc.Center.X - Main.LocalPlayer.Center.X); - float num215 = Math.Abs(npc.Center.Y - Main.LocalPlayer.Center.Y); + Vector2 position = npc.position; + float distanceFromTargetX = Math.Abs(npc.Center.X - Main.player[Main.myPlayer].Center.X); + float distanceFromTargetY = Math.Abs(npc.Center.Y - Main.player[Main.myPlayer].Center.Y); - if (i == 0 || i == 2) - position9.X = Main.LocalPlayer.Center.X + num214; - else - position9.X = Main.LocalPlayer.Center.X - num214; + float smallDistanceMult = 0.48f; + float largeDistanceMult = 1.33f; + bool whatTheFuck = Main.player[Main.myPlayer].Calamity().trippyLevel == 3; - position9.X -= npc.width / 2; + switch (i) + { + case 0: + position.X = Main.player[Main.myPlayer].Center.X - distanceFromTargetX; + position.Y = Main.player[Main.myPlayer].Center.Y - distanceFromTargetY; + break; - if (i == 0 || i == 1) - position9.Y = Main.LocalPlayer.Center.Y + num215; - else - position9.Y = Main.LocalPlayer.Center.Y - num215; + case 1: + position.X = Main.player[Main.myPlayer].Center.X + distanceFromTargetX; + position.Y = Main.player[Main.myPlayer].Center.Y - distanceFromTargetY; + break; - position9.Y -= npc.height / 2; + case 2: + position.X = Main.player[Main.myPlayer].Center.X + distanceFromTargetX; + position.Y = Main.player[Main.myPlayer].Center.Y + distanceFromTargetY; + break; - Main.spriteBatch.Draw(TextureAssets.Npc[npc.type].Value, new Vector2(position9.X - xOffset, position9.Y - yOffset), new Microsoft.Xna.Framework.Rectangle?(npc.frame), alphaColor, npc.rotation, halfSizeTexture, npc.scale, spriteEffects, 0f); + case 3: + position.X = Main.player[Main.myPlayer].Center.X - distanceFromTargetX; + position.Y = Main.player[Main.myPlayer].Center.Y + distanceFromTargetY; + break; + + case 4: // 1 o'clock position + position.X = Main.player[Main.myPlayer].Center.X + (distanceFromTargetX * (whatTheFuck ? 1f : smallDistanceMult)); + position.Y = Main.player[Main.myPlayer].Center.Y - (distanceFromTargetY * (whatTheFuck ? 0f : largeDistanceMult)); + break; + + case 5: // 4 o'clock position + position.X = Main.player[Main.myPlayer].Center.X + (distanceFromTargetX * (whatTheFuck ? 0f : largeDistanceMult)); + position.Y = Main.player[Main.myPlayer].Center.Y + (distanceFromTargetY * (whatTheFuck ? 1f : smallDistanceMult)); + break; + + case 6: // 7 o'clock position + position.X = Main.player[Main.myPlayer].Center.X - (distanceFromTargetX * (whatTheFuck ? 1f : smallDistanceMult)); + position.Y = Main.player[Main.myPlayer].Center.Y + (distanceFromTargetY * (whatTheFuck ? 0f : largeDistanceMult)); + break; + + case 7: // 10 o'clock position + position.X = Main.player[Main.myPlayer].Center.X - (distanceFromTargetX * (whatTheFuck ? 0f : largeDistanceMult)); + position.Y = Main.player[Main.myPlayer].Center.Y - (distanceFromTargetY * (whatTheFuck ? 1f : smallDistanceMult)); + break; + + case 8: // 11 o'clock position + position.X = Main.player[Main.myPlayer].Center.X - (distanceFromTargetX * (whatTheFuck ? 0f : smallDistanceMult)); + position.Y = Main.player[Main.myPlayer].Center.Y - (distanceFromTargetY * (whatTheFuck ? 0.5f : largeDistanceMult)); + break; + + case 9: // 2 o'clock position + position.X = Main.player[Main.myPlayer].Center.X + (distanceFromTargetX * (whatTheFuck ? 0.5f : largeDistanceMult)); + position.Y = Main.player[Main.myPlayer].Center.Y - (distanceFromTargetY * (whatTheFuck ? 0f : smallDistanceMult)); + break; + + case 10: // 5 o'clock position + position.X = Main.player[Main.myPlayer].Center.X + (distanceFromTargetX * (whatTheFuck ? 0f : smallDistanceMult)); + position.Y = Main.player[Main.myPlayer].Center.Y + (distanceFromTargetY * (whatTheFuck ? 0.5f : largeDistanceMult)); + break; + + case 11: // 8 o'clock position + position.X = Main.player[Main.myPlayer].Center.X - (distanceFromTargetX * (whatTheFuck ? 0.5f : largeDistanceMult)); + position.Y = Main.player[Main.myPlayer].Center.Y + (distanceFromTargetY * (whatTheFuck ? 0f : smallDistanceMult)); + break; + + case 12: + position.X = Main.player[Main.myPlayer].Center.X - distanceFromTargetX * 0.5f; + position.Y = Main.player[Main.myPlayer].Center.Y - distanceFromTargetY * 0.5f; + break; + + case 13: + position.X = Main.player[Main.myPlayer].Center.X + distanceFromTargetX * 0.5f; + position.Y = Main.player[Main.myPlayer].Center.Y - distanceFromTargetY * 0.5f; + break; + + case 14: + position.X = Main.player[Main.myPlayer].Center.X + distanceFromTargetX * 0.5f; + position.Y = Main.player[Main.myPlayer].Center.Y + distanceFromTargetY * 0.5f; + break; + + case 15: + position.X = Main.player[Main.myPlayer].Center.X - distanceFromTargetX * 0.5f; + position.Y = Main.player[Main.myPlayer].Center.Y + distanceFromTargetY * 0.5f; + break; + + + default: + break; + } + + position.X -= npc.width / 2; + position.Y -= npc.height / 2; + + Vector2 halfSize = npc.frame.Size() / 2; + + spriteBatch.Draw(TextureAssets.Npc[npc.type].Value, new Vector2(position.X - screenPos.X + (float)(npc.width / 2) - (float)TextureAssets.Npc[npc.type].Width() * npc.scale / 2f + halfSize.X * npc.scale, position.Y - screenPos.Y + (float)npc.height - (float)TextureAssets.Npc[npc.type].Height() * npc.scale / (float)Main.npcFrameCount[npc.type] + 4f + halfSize.Y * npc.scale + npc.gfxOffY), npc.frame, alphaColor, npc.rotation, halfSize, npc.scale, spriteEffects, 0f); } } else @@ -5747,6 +6859,10 @@ namespace CalamityMod.NPCs public override void PostDraw(NPC npc, SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { + bool masterMode = Main.masterMode || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + // Energy shield if (npc.type == NPCID.CultistBoss || npc.type == NPCID.CultistBossClone) { @@ -5779,7 +6895,7 @@ namespace CalamityMod.NPCs intensity *= intensityAndOpacityMult; opacity *= intensityAndOpacityMult; - Texture2D forcefieldTexture = Request("CalamityMod/NPCs/SupremeCalamitas/ForcefieldTexture").Value; + Texture2D forcefieldTexture = SupremeCalamitas.SupremeCalamitas.ForcefieldTexture.Value; if (npc.type == NPCID.CultistBoss) GameShaders.Misc["CalamityMod:SupremeShield"].SetShaderTexture(Request("CalamityMod/ExtraTextures/GreyscaleGradients/EternityStreak")); @@ -5795,8 +6911,8 @@ namespace CalamityMod.NPCs GameShaders.Misc["CalamityMod:SupremeShield"].UseSecondaryColor(secondaryForcefieldColor); GameShaders.Misc["CalamityMod:SupremeShield"].UseColor(forcefieldColor); - GameShaders.Misc["CalamityMod:SupremeShield"].UseSaturation(intensity); - GameShaders.Misc["CalamityMod:SupremeShield"].UseOpacity(opacity); + GameShaders.Misc["CalamityMod:SupremeShield"].UseSaturation(1); + GameShaders.Misc["CalamityMod:SupremeShield"].UseOpacity(0.65f); GameShaders.Misc["CalamityMod:SupremeShield"].Apply(); // Actual Cultist has a bigger shield than the Clones. @@ -5806,12 +6922,472 @@ namespace CalamityMod.NPCs spriteBatch.ExitShaderRegion(); } - if (CalamityWorld.revenge || BossRushEvent.BossRushActive) + // Destroyer drawing and laser telegraphs + else if (CalamityLists.DestroyerIDs.Contains(npc.type)) { - // His afterimages I can't get to work, so fuck it - if (npc.type == NPCID.SkeletronPrime) + Texture2D npcTexture = TextureAssets.Npc[npc.type].Value; + int frameHeight = npcTexture.Height / Main.npcFrameCount[npc.type]; + + Vector2 halfSize = npc.frame.Size() / 2; + SpriteEffects spriteEffects = SpriteEffects.None; + if (npc.spriteDirection == 1) + spriteEffects = SpriteEffects.FlipHorizontally; + + if (npc.type == NPCID.TheDestroyerBody) { - Texture2D npcTexture = TextureAssets.Npc[npc.type].Value; + if (npc.ai[2] == 0f) + npc.frame.Y = 0; + else + npc.frame.Y = frameHeight; + } + + Color segmentDrawColor = npc.GetAlpha(drawColor); + + // Check if Destroyer is behind tiles and, if so, how much of the segment is behind tiles and adjust color accordingly + int x = (int)((npc.position.X - 8f) / 16f); + int x2 = (int)((npc.position.X + npc.width + 8f) / 16f); + int y = (int)((npc.position.Y - 8f) / 16f); + int y2 = (int)((npc.position.Y + npc.height + 8f) / 16f); + for (int l = x; l <= x2; l++) + { + for (int m = y; m <= y2; m++) + { + if (Lighting.Brightness(l, m) == 0f) + segmentDrawColor = Color.Black; + } + } + + // Draw segments + spriteBatch.Draw(npcTexture, npc.Center - screenPos + new Vector2(0, npc.gfxOffY), + npc.frame, segmentDrawColor, npc.rotation, halfSize, npc.scale, spriteEffects, 0f); + + // Draw lights + if (npc.ai[2] == 0f && segmentDrawColor != Color.Black) + { + // This life ratio is fine now because all Destroyer segments update to have the same amount of life every frame + float destroyerLifeRatio = npc.life / (float)npc.lifeMax; + + // Phases + bool phase4 = destroyerLifeRatio < (death ? 0.4f : 0.25f); + bool phase5 = destroyerLifeRatio < (death ? 0.2f : 0.1f); + + // Spawn DR check + bool hasSpawnDR = newAI[1] < DestroyerAI.DRIncreaseTime && newAI[1] > 60f; + + // Gradual color transition from ground to flight and vice versa + // 0f = Red, 1f = Purple + float phaseTransitionColorAmount = (hasSpawnDR || phase5) ? 1f : 0f; + if (!hasSpawnDR && !phase5) + { + if (newAI[3] >= DestroyerAI.GroundTelegraphStartGateValue) + phaseTransitionColorAmount = MathHelper.Clamp(1f - (newAI[3] - DestroyerAI.GroundTelegraphStartGateValue) / DestroyerAI.PhaseTransitionTelegraphTime, 0f, 1f); + else if (newAI[3] >= DestroyerAI.FlightTelegraphStartGateValue) + phaseTransitionColorAmount = MathHelper.Clamp((newAI[3] - DestroyerAI.FlightTelegraphStartGateValue) / DestroyerAI.PhaseTransitionTelegraphTime, 0f, 1f); + } + + // Light colors + int alpha = 192; + Color groundColor = new Color(150, 0, 0, alpha); + Color flightColor = revenge ? new Color(0, 0, 150, alpha) : groundColor; + Color segmentColor = Color.Lerp(groundColor, flightColor, phaseTransitionColorAmount); + Color telegraphColor_Red = new Color(255, 125, 125, alpha); + Color telegraphColor_Green = new Color(125, 255, 125, alpha); + Color telegraphColor_Cyan = new Color(0, 255, 255, alpha); + Color telegraphColor = telegraphColor_Red; + + // Telegraph for the laser breath and body lasers + float telegraphProgress = 0f; + if (destroyerLaserColor != -1) + { + if (npc.type == NPCID.TheDestroyer && death) + { + float telegraphGateValue = DestroyerAI.DeathModeLaserBreathGateValue - DestroyerAI.LaserTelegraphTime; + if (newAI[0] > telegraphGateValue) + { + switch (destroyerLaserColor) + { + default: + case 0: + break; + + case 1: + telegraphColor = telegraphColor_Green; + break; + + case 2: + telegraphColor = telegraphColor_Cyan; + break; + } + telegraphProgress = MathHelper.Clamp((newAI[0] - telegraphGateValue) / DestroyerAI.LaserTelegraphTime, 0f, 1f); + } + } + else if (npc.type == NPCID.TheDestroyerBody && revenge) + { + float shootProjectileTime = death ? (masterMode ? (phase5 ? 30f : phase4 ? 60f : 90f) : 270f) : (masterMode ? (phase5 ? 90f : phase4 ? 120f : 150f) : 450f); + float bodySegmentTime = npc.ai[0] * (masterMode ? 15f : 30f); + float shootProjectileGateValue = bodySegmentTime + shootProjectileTime; + float telegraphGateValue = shootProjectileGateValue - DestroyerAI.LaserTelegraphTime; + if (newAI[0] > telegraphGateValue) + { + switch (destroyerLaserColor) + { + default: + case 0: + break; + + case 1: + telegraphColor = telegraphColor_Green; + break; + + case 2: + telegraphColor = telegraphColor_Cyan; + break; + } + telegraphProgress = MathHelper.Clamp((newAI[0] - telegraphGateValue) / DestroyerAI.LaserTelegraphTime, 0f, 1f); + } + } + else if (npc.type == NPCID.TheDestroyerBody) + { + float shootProjectileTime = Main.masterMode ? 500f : Main.expertMode ? 700f : 900f; + float bodySegmentTime = npc.ai[0] * 30f; + float shootProjectileGateValue = bodySegmentTime + shootProjectileTime; + float telegraphGateValue = shootProjectileGateValue - DestroyerAI.LaserTelegraphTime; + if (npc.localAI[0] > telegraphGateValue) + telegraphProgress = MathHelper.Clamp((npc.localAI[0] - telegraphGateValue) / DestroyerAI.LaserTelegraphTime, 0f, 1f); + } + } + + Texture2D glowTexture = CalamityConfig.Instance.NewVanillaTextures ? CalamityMod.DestroyerGlowmasks[0].Value : TextureAssets.Dest[0].Value; + switch (npc.type) + { + default: + case NPCID.TheDestroyer: + break; + + case NPCID.TheDestroyerBody: + glowTexture = CalamityConfig.Instance.NewVanillaTextures ? CalamityMod.DestroyerGlowmasks[1].Value : TextureAssets.Dest[1].Value; + break; + + case NPCID.TheDestroyerTail: + glowTexture = CalamityConfig.Instance.NewVanillaTextures ? CalamityMod.DestroyerGlowmasks[2].Value : TextureAssets.Dest[2].Value; + break; + } + + float alphaMultiplier = 1f - npc.alpha / 255f; + spriteBatch.Draw(glowTexture, npc.Center - screenPos + new Vector2(0, npc.gfxOffY), npc.frame, Color.Lerp(segmentColor, telegraphColor, telegraphProgress) * alphaMultiplier, npc.rotation, halfSize, npc.scale, spriteEffects, 0f); + } + } + + if (revenge) + { + // Create additional afterimages in the cardinal directions in Rev+ + if (npc.type == NPCID.BrainofCthulhu) + { + float secondAfterimageSetHealthValue = (int)(npc.lifeMax * 0.8f); + if (npc.life < secondAfterimageSetHealthValue) + { + Color currentColor = npc.GetAlpha(drawColor); + float opacityScale = 1f - npc.life / (float)secondAfterimageSetHealthValue; + float opacity = Main.getGoodWorld ? 1f : opacityScale; + + opacity = MathHelper.Clamp(opacity, 0f, 1f); + currentColor.R = (byte)((float)(int)currentColor.R * opacity); + currentColor.G = (byte)((float)(int)currentColor.G * opacity); + currentColor.B = (byte)((float)(int)currentColor.B * opacity); + currentColor.A = (byte)((float)(int)currentColor.A * opacity); + int totalAfterimages = death ? 12 : 4; + for (int i = 0; i < totalAfterimages; i++) + { + Vector2 position = npc.position; + float distanceFromTargetX = Math.Abs(npc.Center.X - Main.player[Main.myPlayer].Center.X); + float distanceFromTargetY = Math.Abs(npc.Center.Y - Main.player[Main.myPlayer].Center.Y); + if (i > 3) + { + currentColor *= 0.5f; + distanceFromTargetX *= 0.5f; + distanceFromTargetY *= 0.5f; + } + + switch (i) + { + case 0: + case 4: + position.X = Main.player[Main.myPlayer].Center.X - distanceFromTargetX; + position.Y = Main.player[Main.myPlayer].Center.Y; + break; + + case 1: + case 5: + position.Y = Main.player[Main.myPlayer].Center.Y - distanceFromTargetY; + position.X = Main.player[Main.myPlayer].Center.X; + break; + + case 2: + case 6: + position.X = Main.player[Main.myPlayer].Center.X + distanceFromTargetX; + position.Y = Main.player[Main.myPlayer].Center.Y; + break; + + case 3: + case 7: + position.Y = Main.player[Main.myPlayer].Center.Y + distanceFromTargetY; + position.X = Main.player[Main.myPlayer].Center.X; + break; + + case 8: + position.X = Main.player[Main.myPlayer].Center.X - distanceFromTargetX; + position.Y = Main.player[Main.myPlayer].Center.Y - distanceFromTargetY; + break; + + case 9: + position.X = Main.player[Main.myPlayer].Center.X + distanceFromTargetX; + position.Y = Main.player[Main.myPlayer].Center.Y - distanceFromTargetY; + break; + + case 10: + position.X = Main.player[Main.myPlayer].Center.X + distanceFromTargetX; + position.Y = Main.player[Main.myPlayer].Center.Y + distanceFromTargetY; + break; + + case 11: + position.X = Main.player[Main.myPlayer].Center.X - distanceFromTargetX; + position.Y = Main.player[Main.myPlayer].Center.Y + distanceFromTargetY; + break; + + default: + break; + } + + position.X -= npc.width / 2; + position.Y -= npc.height / 2; + + Vector2 halfSize = npc.frame.Size() / 2; + SpriteEffects spriteEffects = SpriteEffects.None; + if (npc.spriteDirection == 1) + spriteEffects = SpriteEffects.FlipHorizontally; + + spriteBatch.Draw(TextureAssets.Npc[npc.type].Value, new Vector2(position.X - screenPos.X + (float)(npc.width / 2) - (float)TextureAssets.Npc[npc.type].Width() * npc.scale / 2f + halfSize.X * npc.scale, position.Y - screenPos.Y + (float)npc.height - (float)TextureAssets.Npc[npc.type].Height() * npc.scale / (float)Main.npcFrameCount[npc.type] + 4f + halfSize.Y * npc.scale + npc.gfxOffY), npc.frame, currentColor, npc.rotation, halfSize, npc.scale, spriteEffects, 0f); + } + } + } + + // Telegraph for charge and blood shots + else if (npc.type == NPCID.Creeper) + { + if (NPC.crimsonBoss < 0) + return; + + Vector2 halfSize = npc.frame.Size() / 2; + SpriteEffects spriteEffects = SpriteEffects.None; + if (npc.spriteDirection == 1) + spriteEffects = SpriteEffects.FlipHorizontally; + + bool brainIsInPhase2 = Main.npc[NPC.crimsonBoss].ai[0] < 0f; + if (brainIsInPhase2) + { + Vector2 distanceFromBrain = npc.Center - Main.npc[NPC.crimsonBoss].Center; + Color currentColor = npc.GetAlpha(drawColor); + float opacity = (1f - Main.npc[NPC.crimsonBoss].life / (float)Main.npc[NPC.crimsonBoss].lifeMax) * 2f; + opacity *= opacity; + if (Main.getGoodWorld) + opacity = 1f; + + opacity = MathHelper.Clamp(opacity, 0f, 1f); + currentColor.R = (byte)((float)(int)currentColor.R * opacity); + currentColor.G = (byte)((float)(int)currentColor.G * opacity); + currentColor.B = (byte)((float)(int)currentColor.B * opacity); + currentColor.A = (byte)((float)(int)currentColor.A * opacity); + int totalAfterimages = 4; + for (int i = 0; i < totalAfterimages; i++) + { + Vector2 position = npc.position; + float distanceFromTargetX = Math.Abs(npc.Center.X - Main.player[Main.myPlayer].Center.X); + float distanceFromTargetY = Math.Abs(npc.Center.Y - Main.player[Main.myPlayer].Center.Y); + if (i == 0 || i == 2) + position.X = Main.player[Main.myPlayer].Center.X + distanceFromTargetX; + else + position.X = Main.player[Main.myPlayer].Center.X - distanceFromTargetX; + + position.X -= npc.width / 2; + if (i == 0 || i == 1) + position.Y = Main.player[Main.myPlayer].Center.Y + distanceFromTargetY; + else + position.Y = Main.player[Main.myPlayer].Center.Y - distanceFromTargetY; + + position.Y -= npc.height / 2; + + spriteBatch.Draw(TextureAssets.Npc[npc.type].Value, new Vector2(position.X - screenPos.X + (float)(npc.width / 2) - (float)TextureAssets.Npc[npc.type].Width() * npc.scale / 2f + halfSize.X * npc.scale, position.Y - screenPos.Y + (float)npc.height - (float)TextureAssets.Npc[npc.type].Height() * npc.scale / (float)Main.npcFrameCount[npc.type] + 4f + halfSize.Y * npc.scale + npc.gfxOffY), npc.frame, currentColor, npc.rotation, halfSize, npc.scale, spriteEffects, 0f); + } + + float secondAfterimageSetHealthValue = (int)(Main.npc[NPC.crimsonBoss].lifeMax * 0.8f); + if (Main.npc[NPC.crimsonBoss].life < secondAfterimageSetHealthValue) + { + currentColor = npc.GetAlpha(drawColor); + float opacityScale = 1f - Main.npc[NPC.crimsonBoss].life / (float)secondAfterimageSetHealthValue; + opacity = Main.getGoodWorld ? 1f : opacityScale; + + opacity = MathHelper.Clamp(opacity, 0f, 1f); + currentColor.R = (byte)((float)(int)currentColor.R * opacity); + currentColor.G = (byte)((float)(int)currentColor.G * opacity); + currentColor.B = (byte)((float)(int)currentColor.B * opacity); + currentColor.A = (byte)((float)(int)currentColor.A * opacity); + totalAfterimages = death ? 12 : 4; + for (int i = 0; i < totalAfterimages; i++) + { + Vector2 position = npc.position; + float distanceFromTargetX = Math.Abs(npc.Center.X - Main.player[Main.myPlayer].Center.X); + float distanceFromTargetY = Math.Abs(npc.Center.Y - Main.player[Main.myPlayer].Center.Y); + if (i > 3) + { + currentColor *= 0.5f; + distanceFromTargetX *= 0.5f; + distanceFromTargetY *= 0.5f; + } + + switch (i) + { + case 0: + case 4: + position.X = Main.player[Main.myPlayer].Center.X - distanceFromTargetX; + position.Y = Main.player[Main.myPlayer].Center.Y + distanceFromBrain.Y; + break; + + case 1: + case 5: + position.Y = Main.player[Main.myPlayer].Center.Y - distanceFromTargetY; + position.X = Main.player[Main.myPlayer].Center.X + distanceFromBrain.X; + break; + + case 2: + case 6: + position.X = Main.player[Main.myPlayer].Center.X + distanceFromTargetX; + position.Y = Main.player[Main.myPlayer].Center.Y + distanceFromBrain.Y; + break; + + case 3: + case 7: + position.Y = Main.player[Main.myPlayer].Center.Y + distanceFromTargetY; + position.X = Main.player[Main.myPlayer].Center.X + distanceFromBrain.X; + break; + + case 8: + position.X = Main.player[Main.myPlayer].Center.X - distanceFromTargetX; + position.Y = Main.player[Main.myPlayer].Center.Y - distanceFromTargetY; + break; + + case 9: + position.X = Main.player[Main.myPlayer].Center.X + distanceFromTargetX; + position.Y = Main.player[Main.myPlayer].Center.Y - distanceFromTargetY; + break; + + case 10: + position.X = Main.player[Main.myPlayer].Center.X + distanceFromTargetX; + position.Y = Main.player[Main.myPlayer].Center.Y + distanceFromTargetY; + break; + + case 11: + position.X = Main.player[Main.myPlayer].Center.X - distanceFromTargetX; + position.Y = Main.player[Main.myPlayer].Center.Y + distanceFromTargetY; + break; + + default: + break; + } + + position.X -= npc.width / 2; + position.Y -= npc.height / 2; + + spriteBatch.Draw(TextureAssets.Npc[npc.type].Value, new Vector2(position.X - screenPos.X + (float)(npc.width / 2) - (float)TextureAssets.Npc[npc.type].Width() * npc.scale / 2f + halfSize.X * npc.scale, position.Y - screenPos.Y + (float)npc.height - (float)TextureAssets.Npc[npc.type].Height() * npc.scale / (float)Main.npcFrameCount[npc.type] + 4f + halfSize.Y * npc.scale + npc.gfxOffY), npc.frame, currentColor, npc.rotation, halfSize, npc.scale, spriteEffects, 0f); + } + } + } + + float beginTelegraphGateValue = BrainOfCthulhuAI.TimeBeforeCreeperAttack - BrainOfCthulhuAI.CreeperTelegraphTime; + if (npc.ai[1] > beginTelegraphGateValue || npc.ai[0] == 1f) + { + float colorScale = npc.ai[0] == 1f ? 1f : MathHelper.Clamp((npc.ai[1] - beginTelegraphGateValue) / BrainOfCthulhuAI.CreeperTelegraphTime, 0f, 1f); + Color drawColor2 = new Color(150, 30, 30, 0) * colorScale; + for (int i = 0; i < 2; i++) + { + spriteBatch.Draw(TextureAssets.Npc[npc.type].Value, npc.Center - screenPos + new Vector2(0, npc.gfxOffY), npc.frame, + drawColor2, npc.rotation, halfSize, npc.scale, spriteEffects, 0f); + } + } + } + + // Telegraph for charges + else if (npc.type == NPCID.SkeletronHead) + { + float beginTelegraphGateValue = SkeletronAI.ChargeGateValue - SkeletronAI.ChargeTelegraphTime; + if (npc.localAI[1] > beginTelegraphGateValue) + { + float colorScale = MathHelper.Clamp((npc.localAI[1] - beginTelegraphGateValue) / SkeletronAI.ChargeTelegraphTime, 0f, 1f); + Color drawColor2 = new Color(150, 150, 150, 0) * colorScale; + Vector2 halfSize = npc.frame.Size() / 2; + SpriteEffects spriteEffects = SpriteEffects.None; + if (npc.spriteDirection == 1) + spriteEffects = SpriteEffects.FlipHorizontally; + + for (int i = 0; i < 2; i++) + { + spriteBatch.Draw(TextureAssets.Npc[npc.type].Value, npc.Center - screenPos + new Vector2(0, npc.gfxOffY), npc.frame, + drawColor2, npc.rotation, halfSize, npc.scale, spriteEffects, 0f); + } + } + } + + // Telegraph for slaps + else if (npc.type == NPCID.SkeletronHand) + { + float beginTelegraphGateValue = SkeletronAI.HandSlapGateValue - SkeletronAI.HandSlapTelegraphTime; + if (newAI[2] > beginTelegraphGateValue) + { + float colorScale = MathHelper.Clamp((newAI[2] - beginTelegraphGateValue) / SkeletronAI.HandSlapTelegraphTime, 0f, 1f); + Color drawColor2 = new Color(150, 150, 150, 0) * colorScale; + Vector2 halfSize = npc.frame.Size() / 2; + SpriteEffects spriteEffects = SpriteEffects.None; + if (npc.spriteDirection == 1) + spriteEffects = SpriteEffects.FlipHorizontally; + + Vector2 glowOffset = Vector2.UnitY * 8f; + for (int i = 0; i < 2; i++) + { + spriteBatch.Draw(TextureAssets.Npc[npc.type].Value, npc.Center - screenPos + new Vector2(0, npc.gfxOffY) - glowOffset, npc.frame, + drawColor2, npc.rotation, halfSize, npc.scale, spriteEffects, 0f); + } + } + } + + // Laser telegraph + else if (npc.type == NPCID.WallofFleshEye && Main.wofNPCIndex >= 0) + { + bool enraged = npc.localAI[3] > 0f; + float eyeTelegraphGateValue = WallOfFleshAI.LaserShootGateValue - WallOfFleshAI.LaserShootTelegraphTime; + if (npc.localAI[1] > eyeTelegraphGateValue || npc.localAI[2] > 0f || enraged) + { + Texture2D glowTexture = CalamityConfig.Instance.NewVanillaTextures ? CalamityMod.WallOfFleshEyeGlowmask.Value : TextureAssets.Npc[npc.type].Value; + Vector2 halfSize = npc.frame.Size() / 2; + SpriteEffects spriteEffects = SpriteEffects.None; + if (npc.spriteDirection == 1) + spriteEffects = SpriteEffects.FlipHorizontally; + + float colorScale = enraged ? MathHelper.Clamp(npc.localAI[3] / WallOfFleshAI.EnragedLaserFiringDuration, 0f, 1f) : + npc.localAI[2] > 0f ? 1f - ((npc.localAI[2] - 1f) / WallOfFleshAI.TotalLasersPerBarrage) : + MathHelper.Clamp((npc.localAI[1] - eyeTelegraphGateValue) / WallOfFleshAI.LaserShootTelegraphTime, 0f, 1f); + + Color drawColor2 = new Color(100, 0, 200, 192) * colorScale; + for (int i = 0; i < 2; i++) + { + spriteBatch.Draw(glowTexture, npc.Center - screenPos + new Vector2(0, npc.gfxOffY), npc.frame, + drawColor2, npc.rotation, halfSize, npc.scale, spriteEffects, 0f); + } + } + } + + // His afterimages I can't get to work, so fuck it + else if (npc.type == NPCID.SkeletronPrime || npc.type == ModContent.NPCType()) + { + Texture2D npcTexture = (masterMode && revenge && npc.type == NPCID.SkeletronPrime) ? CalamityMod.ChadPrime.Value : TextureAssets.Npc[npc.type].Value; int frameHeight = npcTexture.Height / Main.npcFrameCount[npc.type]; npc.frame.Y = (int)newAI[3]; @@ -5873,100 +7449,92 @@ namespace CalamityMod.NPCs spriteBatch.Draw(npcTexture, npc.Center - screenPos + new Vector2(0, npc.gfxOffY), npc.frame, npc.GetAlpha(drawColor), npc.rotation, npc.frame.Size() / 2, npc.scale, spriteEffects, 0f); - spriteBatch.Draw(TextureAssets.BoneEyes.Value, npc.Center - screenPos + new Vector2(0, npc.gfxOffY), - npc.frame, new Color(200, 200, 200, 0), npc.rotation, npc.frame.Size() / 2, npc.scale, spriteEffects, 0f); + Color eyesColor = new Color(200, 200, 200, 0); + if (masterMode && revenge) + { + int alpha = 192; + eyesColor = npc.type == NPCType() ? new Color(150, 100, 255, alpha) : new Color(255, 255, 0, alpha); + Texture2D glowTexture = npc.type == NPCID.SkeletronPrime ? CalamityMod.ChadPrimeEyeGlowmask.Value : SkeletronPrime2.EyeTexture.Value; + spriteBatch.Draw(glowTexture, npc.Center - screenPos + new Vector2(0, npc.gfxOffY), npc.frame, eyesColor, npc.rotation, npc.frame.Size() / 2, npc.scale, spriteEffects, 0f); + } + else + spriteBatch.Draw(TextureAssets.BoneEyes.Value, npc.Center - screenPos + new Vector2(0, npc.gfxOffY), npc.frame, eyesColor, npc.rotation, npc.frame.Size() / 2, npc.scale, spriteEffects, 0f); } - else if (CalamityLists.DestroyerIDs.Contains(npc.type)) - { - Texture2D npcTexture = TextureAssets.Npc[npc.type].Value; - int frameHeight = npcTexture.Height / Main.npcFrameCount[npc.type]; - Vector2 halfSize = npc.frame.Size() / 2; + else if (npc.type == NPCID.Plantera) + { + // Percent life remaining + float lifeRatio = npc.life / (float)npc.lifeMax; + + Texture2D npcTexture = TextureAssets.Npc[npc.type].Value; + SpriteEffects spriteEffects = SpriteEffects.None; if (npc.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - if (npc.type == NPCID.TheDestroyerBody) - { - if (npc.ai[2] == 0f) - npc.frame.Y = 0; - else - npc.frame.Y = frameHeight; - } + Color originalColor = npc.GetAlpha(drawColor); + Color newColor = new Color(100, 255, 100, 255); + Vector2 glowOffset = Vector2.UnitY * -4f; + Vector2 drawPosition = npc.Center - screenPos + new Vector2(0, npc.gfxOffY) + glowOffset; + Vector2 origin = npc.frame.Size() / 2; - Color segmentDrawColor = npc.GetAlpha(drawColor); - - // Check if Destroyer is behind tiles and if so, how much of the segment is behind tiles and adjust color accordingly - int x = (int)((npc.position.X - 8f) / 16f); - int x2 = (int)((npc.position.X + npc.width + 8f) / 16f); - int y = (int)((npc.position.Y - 8f) / 16f); - int y2 = (int)((npc.position.Y + npc.height + 8f) / 16f); - for (int l = x; l <= x2; l++) + bool phase2 = lifeRatio <= 0.5f; + if (!phase2) { - for (int m = y; m <= y2; m++) + float telegraphTimer = Math.Abs(npc.ai[1]); + bool startSeedGatlingSporeGasTelegraph = npc.ai[1] > PlanteraAI.SeedGatlingColorChangeGateValue; + bool endSeedGatlingSporeGasTelegraph = npc.ai[1] < -PlanteraAI.SeedGatlingDuration + PlanteraAI.SeedGatlingColorChangeDuration; + if (startSeedGatlingSporeGasTelegraph) { - if (Lighting.Brightness(l, m) == 0f) - segmentDrawColor = Color.Black; + float telegraphScalar = MathHelper.Clamp((telegraphTimer - PlanteraAI.SeedGatlingColorChangeGateValue) / PlanteraAI.SeedGatlingColorChangeDuration, 0f, 1f); + Color telegraphColor = Color.Lerp(originalColor, newColor, telegraphScalar); + spriteBatch.Draw(npcTexture, drawPosition, npc.frame, telegraphColor, npc.rotation, origin, npc.scale, spriteEffects, 0f); + } + + // -300 to -120 + else if (endSeedGatlingSporeGasTelegraph) + { + float telegraphScalar = MathHelper.Clamp((telegraphTimer - (PlanteraAI.SeedGatlingDuration - PlanteraAI.SeedGatlingColorChangeDuration)) / PlanteraAI.SeedGatlingColorChangeDuration, 0f, 1f); + Color telegraphColor = Color.Lerp(originalColor, newColor, telegraphScalar); + spriteBatch.Draw(npcTexture, drawPosition, npc.frame, telegraphColor, npc.rotation, origin, npc.scale, spriteEffects, 0f); } } - - // Draw segments - spriteBatch.Draw(npcTexture, npc.Center - screenPos + new Vector2(0, npc.gfxOffY), - npc.frame, segmentDrawColor, npc.rotation, halfSize, npc.scale, spriteEffects, 0f); - - // Draw lights - if (npc.ai[2] == 0f && segmentDrawColor != Color.Black) + else { - float destroyerLifeRatio = 1f; - if (npc.realLife >= 0) - destroyerLifeRatio = Main.npc[npc.realLife].life / (float)Main.npc[npc.realLife].lifeMax; - - float shootProjectile = (CalamityWorld.death || BossRushEvent.BossRushActive) ? 180 : 300; - float timer = npc.ai[0] * 30f; - float shootProjectileGateValue = timer + shootProjectile; - float glowDuration = 120f; - float startGlowingGateValue = shootProjectileGateValue - glowDuration; - - if ((newAI[3] >= 900f && destroyerLifeRatio < 0.5f) || (newAI[1] < 600f && newAI[1] > 60f)) + float telegraphTimer = Math.Abs(npc.ai[3]); + bool startChargeTelegraph = npc.ai[3] > PlanteraAI.ChargeTelegraphColorChangeGateValue; + bool endChargeTelegraph = npc.ai[3] <= -2f; + if (startChargeTelegraph) { - Color drawColor2 = new Color(50, 50, 255, 0) * (1f - npc.alpha / 255f); - for (int i = 0; i < 3; i++) + float telegraphScalar = MathHelper.Clamp((telegraphTimer - PlanteraAI.ChargeTelegraphColorChangeGateValue) / PlanteraAI.SeedGatlingColorChangeDuration, 0f, 1f); + Color telegraphColor = Color.Lerp(originalColor, newColor, telegraphScalar); + spriteBatch.Draw(npcTexture, drawPosition, npc.frame, telegraphColor, npc.rotation, origin, npc.scale, spriteEffects, 0f); + } + + // -195 to -2 + else if (endChargeTelegraph) + { + float telegraphScalar = MathHelper.Clamp((Math.Abs(PlanteraAI.StopChargeGateValue) - telegraphTimer) / Math.Abs(PlanteraAI.StopChargeGateValue), 0f, 1f); + Color telegraphColor = Color.Lerp(originalColor, newColor, telegraphScalar); + + if (CalamityConfig.Instance.Afterimages) { - spriteBatch.Draw(TextureAssets.Dest[npc.type - NPCID.TheDestroyer].Value, npc.Center - screenPos + new Vector2(0, npc.gfxOffY), npc.frame, - drawColor2, npc.rotation, halfSize, npc.scale, spriteEffects, 0f); + int afterimageAmount = 10; + int afterImageIncrement = 2; + for (int j = 0; j < afterimageAmount; j += afterImageIncrement) + { + Color afterimageColor = telegraphColor; + afterimageColor = Color.Lerp(afterimageColor, originalColor, 0.5f); + afterimageColor = npc.GetAlpha(afterimageColor); + afterimageColor *= (afterimageAmount - j) / 15f; + Vector2 afterimagePos = npc.oldPos[j] + new Vector2(npc.width, npc.height) / 2f - screenPos; + afterimagePos -= new Vector2(npcTexture.Width, npcTexture.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; + afterimagePos += origin * npc.scale + new Vector2(0f, npc.gfxOffY) + glowOffset; + spriteBatch.Draw(npcTexture, afterimagePos, npc.frame, afterimageColor, npc.rotation, origin, npc.scale, spriteEffects, 0f); + } } - // Glow telegraph for lasers - /*if (newAI[0] > startGlowingGateValue) - { - Texture2D bloomTexture = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; - Color bloom = drawColor2; - bloom = Main.hslToRgb((Main.rgbToHsl(bloom).X + 0.02f) % 1, Main.rgbToHsl(bloom).Y, Main.rgbToHsl(bloom).Z); - float scalingFactor = (newAI[0] - startGlowingGateValue) / glowDuration; - float opacity = (float)Math.Sin(MathHelper.PiOver2 + scalingFactor * MathHelper.PiOver2); - float properBloomSize = (float)npc.height / (float)bloomTexture.Height; - float scale = scalingFactor; - spriteBatch.Draw(bloomTexture, npc.Center - Main.screenPosition, null, bloom * opacity * 0.5f, 0, bloomTexture.Size() / 2f, scale * 1f * properBloomSize, SpriteEffects.None, 0); - }*/ - } - else - { - Color drawColor2 = new Color(255, 255, 255, 0) * (1f - npc.alpha / 255f); - spriteBatch.Draw(TextureAssets.Dest[npc.type - NPCID.TheDestroyer].Value, npc.Center - screenPos + new Vector2(0, npc.gfxOffY), npc.frame, - drawColor2, npc.rotation, halfSize, npc.scale, spriteEffects, 0f); - - // Glow telegraph for lasers - /*if (newAI[0] > startGlowingGateValue) - { - Texture2D bloomTexture = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; - Color bloom = drawColor2; - bloom = Main.hslToRgb((Main.rgbToHsl(bloom).X + 0.02f) % 1, Main.rgbToHsl(bloom).Y, Main.rgbToHsl(bloom).Z); - float scalingFactor = (newAI[0] - startGlowingGateValue) / glowDuration; - float opacity = (float)Math.Sin(MathHelper.PiOver2 + scalingFactor * MathHelper.PiOver2); - float properBloomSize = (float)npc.height / (float)bloomTexture.Height; - float scale = scalingFactor; - spriteBatch.Draw(bloomTexture, npc.Center - Main.screenPosition, null, bloom * opacity * 0.5f, 0, bloomTexture.Size() / 2f, scale * 1f * properBloomSize, SpriteEffects.None, 0); - }*/ + spriteBatch.Draw(npcTexture, drawPosition, npc.frame, telegraphColor, npc.rotation, origin, npc.scale, spriteEffects, 0f); } } } @@ -5975,6 +7543,16 @@ namespace CalamityMod.NPCs public override bool? DrawHealthBar(NPC npc, byte hbPosition, ref float scale, ref Vector2 position) { + if ((CalamityWorld.revenge && Main.masterMode) || BossRushEvent.BossRushActive) + { + if (npc.type == NPCID.Creeper) + { + bool brainIsInPhase2 = Main.npc[NPC.crimsonBoss].ai[0] < 0f; + if (brainIsInPhase2) + return false; + } + } + if (CalamityWorld.death) { switch (npc.type) @@ -5989,10 +7567,12 @@ namespace CalamityMod.NPCs case NPCID.DuneSplicerBody: case NPCID.DuneSplicerTail: return true; + default: break; } } + return null; } @@ -6900,5 +8480,65 @@ namespace CalamityMod.NPCs return null; } #endregion + + #region Adjust Difficulty Stat Scaling + // Adjust HP and damage in Master Mode + public static void AdjustMasterModeStatScaling(NPC npc) + { + if (!Main.masterMode) + return; + + npc.lifeMax = (int)Math.Round(npc.lifeMax * MasterModeEnemyHPMultiplier); + npc.damage = (int)Math.Round(npc.damage * MasterModeEnemyDamageMultiplier); + } + + // Adjust only knockback resist in Expert Mode (this is also adjusted in Master Mode because Expert has to be enabled if Master is enabled) + public static void AdjustExpertModeStatScaling(NPC npc) + { + if (!Main.expertMode) + return; + + if (npc.knockBackResist <= 0f) + return; + + // Knockback resist is backasswards in this fucking game so we need to add to the knockBackResist variable here :^) + float knockBackResistMult = Main.masterMode ? MasterModeEnemyKnockbackMultiplier : ExpertModeEnemyKnockbackMultiplier; + float knockBackResistReduction = npc.knockBackResist * knockBackResistMult; + npc.knockBackResist += knockBackResistReduction; + } + #endregion + + #region Bestiary + public override void SetBestiary(NPC npc, Terraria.GameContent.Bestiary.BestiaryDatabase database, Terraria.GameContent.Bestiary.BestiaryEntry bestiaryEntry) + { + // Create a string array containing all an NPC's debuff resistances + string[] elements = new string[5] + { + NPCDebuffResistText(npc.Calamity().VulnerableToHeat, CalamityUtils.GetTextValue("UI.DebuffSystem.Heat")), + NPCDebuffResistText(npc.Calamity().VulnerableToSickness, CalamityUtils.GetTextValue("UI.DebuffSystem.Sickness")), + NPCDebuffResistText(npc.Calamity().VulnerableToCold, CalamityUtils.GetTextValue("UI.DebuffSystem.Cold")), + NPCDebuffResistText(npc.Calamity().VulnerableToElectricity, CalamityUtils.GetTextValue("UI.DebuffSystem.Electricity")), + NPCDebuffResistText(npc.Calamity().VulnerableToWater, CalamityUtils.GetTextValue("UI.DebuffSystem.Water")) + }; + + // Insert the debuff info into the NPC's bestiary entry + bestiaryEntry.Info.Insert(0, new BestiaryDebuffInfo(elements)); + } + + public static string NPCDebuffResistText(bool? effectiveness, string name) + { + string result = CalamityUtils.GetTextValue("UI.DebuffSystem.Neutral"); + if (effectiveness == true) + { + result = CalamityUtils.GetTextValue("UI.DebuffSystem.Weak"); + } + else if (effectiveness == false) + { + result = CalamityUtils.GetTextValue("UI.DebuffSystem.Resistant"); + } + result += " " + CalamityUtils.GetTextValue("UI.DebuffSystem.To") + " " + name; + return result; + } + #endregion } } diff --git a/NPCs/CalamityGlobalNPCLoot.cs b/NPCs/CalamityGlobalNPCLoot.cs index 670ba70021..85dd2cb643 100644 --- a/NPCs/CalamityGlobalNPCLoot.cs +++ b/NPCs/CalamityGlobalNPCLoot.cs @@ -1,4 +1,6 @@ -using CalamityMod.Events; +using System; +using System.Threading; +using CalamityMod.Events; using CalamityMod.Items; using CalamityMod.Items.Accessories; using CalamityMod.Items.Accessories.Vanity; @@ -25,8 +27,6 @@ using CalamityMod.Tiles.Ores; using CalamityMod.World; using CalamityMod.World.Planets; using Microsoft.Xna.Framework; -using System; -using System.Threading; using Terraria; using Terraria.Audio; using Terraria.GameContent.ItemDropRules; @@ -80,7 +80,7 @@ namespace CalamityMod.NPCs // Progression shortcuts LeadingConditionRule postEoC = npcLoot.DefineConditionalDropSet(DropHelper.PostEoC()); LeadingConditionRule hardmode = npcLoot.DefineConditionalDropSet(DropHelper.Hardmode()); - LeadingConditionRule postCalPlant = npcLoot.DefineConditionalDropSet(DropHelper.PostCalPlant()); + LeadingConditionRule postCal = npcLoot.DefineConditionalDropSet(DropHelper.PostCal()); LeadingConditionRule postLevi = npcLoot.DefineConditionalDropSet(DropHelper.PostLevi()); LeadingConditionRule postDoG = npcLoot.DefineConditionalDropSet(DropHelper.PostDoG()); @@ -120,8 +120,11 @@ namespace CalamityMod.NPCs // Wyvern Head // 8-10 Essence of Sunlight @ 100%, 10-12 Expert+ + // TODO: Move Aero Stone to the upcoming sky structure whenever it's implemented + // Aero Stone @ 25% Normal, 33.3% Expert+ case NPCID.WyvernHead: npcLoot.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 1, 8, 10, 10, 12)); + npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 4, 3)); break; #endregion @@ -583,24 +586,24 @@ namespace CalamityMod.NPCs break; // Reaper, Psycho - // 2-4 Solar Veil @ 50% IF Clone or Plant dead + // 2-4 Solar Veil @ 50% IF Cal Clone dead // Darksun Fragment @ 50% IF Devourer of Gods dead case NPCID.Reaper: case NPCID.Psycho: - postCalPlant.Add(ModContent.ItemType(), 2, 2, 4); + postCal.Add(ModContent.ItemType(), 2, 2, 4); postDoG.Add(ModContent.ItemType(), 2); break; // Vampire / Vampire Bat (same enemy) // Moon Stone @ 15% INSTEAD OF 2.86% // Bat Hook @ 2.5% Normal, 5% Expert+ - // 2-4 Solar Veil @ 50% IF Clone or Plant dead + // 2-4 Solar Veil @ 50% IF Cal Clone dead // Darksun Fragment @ 50% IF Devourer of Gods dead case NPCID.VampireBat: case NPCID.Vampire: npcLoot.ChangeDropRate(ItemID.MoonStone, 3, 20); npcLoot.Add(ItemDropRule.NormalvsExpert(ItemID.BatHook, 40, 20)); - postCalPlant.Add(ModContent.ItemType(), 2, 2, 4); + postCal.Add(ModContent.ItemType(), 2, 2, 4); postDoG.Add(ModContent.ItemType(), 2); break; @@ -772,7 +775,7 @@ namespace CalamityMod.NPCs ItemID.LaserMachinegun, ItemID.ElectrosphereLauncher, ItemID.InfluxWaver, - ModContent.ItemType() + ModContent.ItemType() }; npcLoot.Add(DropHelper.CalamityStyle(DropHelper.NormalWeaponDropRateFraction, saucerItems)); @@ -1172,6 +1175,7 @@ namespace CalamityMod.NPCs // Expert+ drops are also available on Normal npcLoot.AddNormalOnly(DropHelper.PerPlayer(ItemID.VolatileGelatin)); npcLoot.AddNormalOnly(ItemID.SoulofLight, 1, 15, 20); + npcLoot.AddNormalOnly(ItemID.PinkGel, 1, 15, 20); // Would be in the bag otherwise npcLoot.AddNormalOnly(ModContent.ItemType(), ThankYouPainting.DropInt); @@ -1446,8 +1450,13 @@ namespace CalamityMod.NPCs // Remove the vanilla loot rule for Fishron Wings because it's part of the Calamity Style set. npcLoot.RemoveWhere((rule) => rule is ItemDropWithConditionRule conditionalRule && conditionalRule.itemId == ItemID.FishronWings); + // 02JAN2024: Ozzatron: Fixed silent breakage of Duke Fishron's weapon drops alteration caused by the 1.4.4 port and the Remix seed. var dukeRootRules = npcLoot.Get(false); - IItemDropRule notExpert = dukeRootRules.Find((rule) => rule is LeadingConditionRule dukeLCR && dukeLCR.condition is Conditions.NotExpert); + IItemDropRule notRemix = dukeRootRules.Find((rule) => rule is LeadingConditionRule dukeLCR && dukeLCR.condition is Conditions.NotRemixSeed); + if (notRemix is not LeadingConditionRule LCR_NotRemix) + goto DukeEditFailed; + var chain = notRemix.ChainedRules.Find((chain) => chain.RuleToChain is LeadingConditionRule dukeLCR2 && dukeLCR2.condition is Conditions.NotExpert); + IItemDropRule notExpert = chain.RuleToChain; if (notExpert is LeadingConditionRule LCR_NotExpert) { LCR_NotExpert.ChainedRules.RemoveAll((chainAttempt) => @@ -1469,8 +1478,9 @@ namespace CalamityMod.NPCs } } catch (ArgumentNullException) { } +DukeEditFailed: - // Expert+ drops are also available on Normal +// Expert+ drops are also available on Normal npcLoot.AddNormalOnly(DropHelper.PerPlayer(ItemID.ShrimpyTruffle)); // Would be in the bag otherwise @@ -1666,7 +1676,7 @@ namespace CalamityMod.NPCs LeadingConditionRule goldBossDrop = new LeadingConditionRule(DropHelper.GoldSetBonusBossCondition); goldBossDrop.Add(ItemID.GoldCoin, minQuantity: 3, maxQuantity: 3, hideLootReport: true); globalLoot.Add(goldBossDrop); - + // Tarragon armor set bonus: 20% chance to drop hearts from all valid enemies // See the condition lambda in DropHelper for details // Does not show up in the Bestiary @@ -1930,12 +1940,10 @@ namespace CalamityMod.NPCs string key5 = "Mods.CalamityMod.Status.Progression.MoonBossText"; Color messageColor5 = Color.Orange; - string key6 = "Mods.CalamityMod.Status.Progression.MoonBossText2"; - Color messageColor6 = Color.Violet; - string key7 = "Mods.CalamityMod.Status.Progression.ProfanedBossText2"; - Color messageColor7 = Color.Cyan; - string key8 = "Mods.CalamityMod.Status.Progression.FutureOreText"; - Color messageColor8 = Color.LightGray; + string key6 = "Mods.CalamityMod.Status.Progression.ProfanedBossText2"; + Color messageColor6 = Color.Cyan; + string key7 = "Mods.CalamityMod.Status.Progression.FutureOreText"; + Color messageColor7 = Color.LightGray; if (!CalamityWorld.HasGeneratedLuminitePlanetoids) { @@ -1953,13 +1961,12 @@ namespace CalamityMod.NPCs CalamityNetcode.SyncWorld(); } - // Spawn Exodium planetoids and send messages about Providence, Bloodstone, Polterplasm, etc. if ML has not been killed yet + // Spawn Exodium planetoids and send messages about Providence, Exodium, and Necroplasm if ML has not been killed yet if (!NPC.downedMoonlord) { CalamityUtils.DisplayLocalizedText(key5, messageColor5); CalamityUtils.DisplayLocalizedText(key6, messageColor6); CalamityUtils.DisplayLocalizedText(key7, messageColor7); - CalamityUtils.DisplayLocalizedText(key8, messageColor8); } break; } @@ -1990,7 +1997,7 @@ namespace CalamityMod.NPCs { string key = "Mods.CalamityMod.Status.Progression.HardmodeOreTier4Text"; Color messageColor = new Color(50, 255, 130); - CalamityUtils.SpawnOre(ModContent.TileType(), 12E-05, 0.55f, 0.9f, 3, 8, TileID.Pearlstone, TileID.HallowHardenedSand, TileID.HallowSandstone, TileID.HallowedIce); + CalamityUtils.SpawnOre(ModContent.TileType(), 17E-05, 0.55f, 0.9f, 8, 14, TileID.Pearlstone, TileID.HallowHardenedSand, TileID.HallowSandstone, TileID.HallowedIce); CalamityUtils.DisplayLocalizedText(key, messageColor); } } diff --git a/NPCs/CalamityGlobalTownNPC.cs b/NPCs/CalamityGlobalTownNPC.cs index 9260b663af..5110a7a5e3 100644 --- a/NPCs/CalamityGlobalTownNPC.cs +++ b/NPCs/CalamityGlobalTownNPC.cs @@ -1,4 +1,6 @@ -using CalamityMod.Events; +using System; +using System.Collections.Generic; +using CalamityMod.Events; using CalamityMod.Items; using CalamityMod.Items.Accessories; using CalamityMod.Items.Ammo; @@ -18,8 +20,6 @@ using CalamityMod.NPCs.TownNPCs; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.Collections.Generic; using Terraria; using Terraria.GameContent; using Terraria.ID; @@ -71,12 +71,14 @@ namespace CalamityMod.NPCs "Drifter", "Finchi", "Heniek", // <@!363404700445442050> (kazurgundu) - "Fire", // <@!354362326947856384> (fire#0692) + "Fire", // <@!354362326947856384> (ultimatefirewaster) "Barney Calhoun", // <@!634462901431697410> (potatostego) - "XiaoEn0426", // <@!440448864772816896> (XiaoEn0426#9157) - "Jeffred", // <@!295362230038560768> (Knight Solaire#0873) + "XiaoEn0426", // <@!440448864772816896> (xiaoen0426) + "Jeffred", // <@!295362230038560768> (paladinsamuel) "The Cooler Arthur", // <@!568263512523014154> (gokuartillery) "Markie", // <@!291141964039061504> (markie_) + "Shark", // <@!874464051697172492> (congratsistrash) + "Sagi", // <@!508233115781693441> (sagittariod) }; private static readonly string[] ClothierNames = { @@ -85,11 +87,12 @@ namespace CalamityMod.NPCs }; private static readonly string[] CyborgNames = { - "Sylux", // <@!331812782183809025> (Gonk#2451) + "Sylux", // <@!331812782183809025> (gonkachino) }; private static readonly string[] DemolitionistNames = { "Tavish DeGroot", // <@!442447226992721930> (magicoal) + "Fimmy", // <@!407348617079160832> (darkmega5) }; private static readonly string[] DryadNames = { @@ -97,18 +100,18 @@ namespace CalamityMod.NPCs "Izuna", "Jasmine", // <@!430532867479699456> (phantasmagoria.) "Cybil", // <@!486507232666845185> (Captain Doofus#????) - "Ruth", // <@!1001307586068492388> (Briny_Coffee#4393) + "Ruth", // <@!1001307586068492388> (briny_coffee) }; private static readonly string[] DyeTraderNames = null; private static readonly string[] GoblinTinkererNames = { "Verth", - "Gormer", // <@!287651204924833795> (Picasso's Bean#2819 -- RIP) + "Gormer", // <@!287651204924833795> (picassosbean2819 -- RIP) "TingFlarg", // <@!185605031716847616> (smugggo) - "Driser", // <@!121996994406252544> (Driser#8630) + "Driser", // <@!121996994406252544> (driser) "Eddie Spaghetti", // <@!466397267407011841> (nathansfriend) "G'tok", // <@!335192200956608535> (gtoktas) - "Katto", // <@!175972165504466944> (Katto#2858) + "Katto", // <@!175972165504466944> (katto_kat) "Him", // <@!931019614958256139> (himtheguy1) "Tooshiboots", // <@!333532730593771522> (ulmod) "Neesh", // <@!175803493464932352> (xjetty) @@ -121,24 +124,25 @@ namespace CalamityMod.NPCs "Streakist", // used to be "StreakistYT". couldn't find the youtube channel, and decided to remove the ad. "Necroplasmic", "Devin", - "Woffle", // <@!185980979427540992> (Chipbeam#2268) + "Woffle", // <@!185980979427540992> (chipbeam) "Cameron", // <@!340401981711712258> (cammywammy.) "Wilbur", // <@!295171926324805634> (all_imperfect_chaos) "Good Game Design", // <@!564267767042277385> (dominickarma) - "Danmaku", // <@!756259562268524555> (Danmaku#2659) - "Grylken", // <@!299970404435361802> (Grylken#1569) + "Danmaku", // <@!756259562268524555> (danmaku0) + "Grylken", // <@!299970404435361802> (grylken) "Outlaw", // <@!918311619480657922> (thechosenoutlaw) - "Alfred Rend", // <@!606301806481375255> (Deadsqurp300#0907) - "Leeman", // <@!281999243168841728> (Tweee#5831) + "Alfred Rend", // <@!606301806481375255> (deadsqurp300) + "Leeman", // <@!281999243168841728> (tweee) "Mihai", // <@!373941893467209730> (cmihaii.) - "Aka Retribution", // <@!302318734633205761> (azurr_nihilo) + "Cooler Kevin", // <@!614126424751603714> (exellent.) }; private static readonly string[] MechanicNames = { "Lilly", "Daawn", // <@!206162323541458944> (daawnily) - "Robin", // <@!654737510030639112> (Altzeus#8687) + "Robin", // <@!654737510030639112> (altzeus) "Curly", // <@!673092101780668416> (curly4830) + "Cobalt", // <@!132962828922388481> (cobalt_44) }; private static readonly string[] MerchantNames = { @@ -152,18 +156,18 @@ namespace CalamityMod.NPCs }; private static readonly string[] PainterNames = { - "Picasso", // <@!353316526306361347> (sconicboom -- for the late Picasso's Bean#2819) + "Picasso", // <@!353316526306361347> (sconicboom -- for the late picassosbean2819) }; private static readonly string[] PartyGirlNames = { - "Arin", // <@!268169458302976012> (Kiyotu#0006) + "Arin", // <@!268169458302976012> (kiyotu) }; private static readonly string[] PirateNames = { "Tyler Van Hook", "Cap'n Deek", // "Alex N" on Patreon (No discord account) "Captain Billy Bones", // <@!699589229507772416> (djackv) - "Captain J. Crackers", // <@!233232602994049024> (Qyuuno#3031) + "Captain J. Crackers", // <@!233232602994049024> (qyuuno) }; private static readonly string[] PrincessNames = { @@ -188,6 +192,7 @@ namespace CalamityMod.NPCs { "Vorbis", "Angel", + "Mòrag Ladair", // <@!161893929485074432> (jalapeno9) }; private static readonly string[] StylistNames = { @@ -200,7 +205,7 @@ namespace CalamityMod.NPCs "Tim Lockwood", // <@!605839945483026434> (pomvoid) "Sir Samuel Winchester Jenkins Kester II", // <@!107659695749070848> (ryaegos) "Brutus", // <@!591889650692521984> (.brutus._) - "Sloth", // <@!486265327387279391> (BossyPunch#4983) + "Sloth", // <@!486265327387279391> (bossypunch) }; private static readonly string[] TaxCollectorNames = { @@ -229,17 +234,18 @@ namespace CalamityMod.NPCs "Inorim, son of Ivukey", "Jensen", "Merasmus", // <@!288066987819663360> (spiderprovidence) - "Habolo", // <@!163028025494077441> (ChristmasGoat#7810) + "Habolo", // <@!163028025494077441> (hellgoat2) "Ortho", // <@!264984390910738432> (worcuus) "Chris Tallballs", // <@!770211589076418571> (bewearium) "Syethas", // <@!325413275066171393> (cosmicstariight) - "Nextdoor Psycho", // <@!173261518572486656> (⋈-NextdoorPsycho-⋈#0001) + "Nextdoor Psycho", // <@!173261518572486656> (nextdoorpsycho) }; private static readonly string[] ZoologistNames = { - "Kiriku", // <@!395312478160027668> (rulosss#6814) + "Kiriku", // <@!395312478160027668> (rulosss) "Lacuna", // <@!790746689211203604> (_lacuna_) "Mae Borowski", //<@!219158690433990656> (justakkolite) + "Fera", // <@!195850711567826945> (juneark_) }; // The following sets are for the 1.4 Town Pets: Town Dogs, Cats and Bunnies. @@ -272,7 +278,7 @@ namespace CalamityMod.NPCs private static readonly string[] TownDogDalmatianNames = null; private static readonly string[] TownDogHuskyNames = { - "Yoshi", // <@!541127291426832384> (GregTheSpinarak#6643) + "Yoshi", // <@!541127291426832384> (gregthespinarak) }; private const int TownCatSiameseVanillaNames = 12; @@ -284,7 +290,7 @@ namespace CalamityMod.NPCs private static readonly string[] TownCatNames = { "Smoogle", // <@!709968379334623274> (smooglin) - "The Meowurer of Gods", // <@!385949114271268864> (GP#7876) + "The Meowurer of Gods", // <@!385949114271268864> (thatgp) "Katsafaros", // <@!190595401328492544> (gr_mm) "Lucerne", // <@!271954788676141066> (lord_lucerne) "Milo", // <@!401849201597874179> (maskedmilo) @@ -297,7 +303,8 @@ namespace CalamityMod.NPCs }; private static readonly string[] TownCatOrangeTabbyNames = { - "Felix" // <@!183424826407518208> (lilac_vrt_olligoci) + "Felix", // <@!183424826407518208> (lilac_vrt_olligoci) + "Tardo", // <@!739343546867384391> (midnight295) }; private static readonly string[] TownCatRussianBlueNames = null; private static readonly string[] TownCatSilverNames = null; @@ -1060,7 +1067,7 @@ namespace CalamityMod.NPCs #endregion #region Shop Stuff - public override void ModifyShop(NPCShop shop) + public override void ModifyShop(NPCShop shop) { int type = shop.NpcType; int goldCost = NPC.downedMoonlord ? 16 : Main.hardMode ? 8 : 4; @@ -1079,7 +1086,7 @@ namespace CalamityMod.NPCs if (type == NPCID.Merchant) { shop.AddWithCustomValue(ItemID.Bottle, Item.buyPrice(copper: 20), potionSells, Condition.HappyEnough) - .AddWithCustomValue(ItemID.WormholePotion, Item.buyPrice(copper: 25), potionSells, Condition.HappyEnough); + .AddWithCustomValue(ItemID.WormholePotion, Item.buyPrice(silver: 5), potionSells, Condition.HappyEnough); shop.Add(ItemID.HealingPotion, potionSells, Condition.HappyEnough, Condition.DownedEowOrBoc) .Add(ItemID.ManaPotion, potionSells, Condition.HappyEnough, Condition.DownedEowOrBoc) .Add(ItemID.Flare, hasFlareGunUpgrade) @@ -1178,9 +1185,9 @@ namespace CalamityMod.NPCs if (type == NPCID.Wizard) { - shop.Add(ItemType()) + shop.AddWithCustomValue(ItemType(), CalamityGlobalItem.RarityLightRedBuyPrice * 3) .AddWithCustomValue(ItemID.MagicMissile, Item.buyPrice(gold: 5)) - .AddWithCustomValue(ItemID.RodofDiscord, Item.buyPrice(gold: 10), Condition.Hardmode, Condition.InHallow) + .AddWithCustomValue(ItemID.RodofDiscord, Item.buyPrice(gold: 50), Condition.Hardmode, Condition.InHallow) .AddWithCustomValue(ItemID.SpectreStaff, Item.buyPrice(gold: 25), Condition.DownedGolem) .AddWithCustomValue(ItemID.InfernoFork, Item.buyPrice(gold: 25), Condition.DownedGolem) .AddWithCustomValue(ItemID.ShadowbeamStaff, Item.buyPrice(gold: 25), Condition.DownedGolem) @@ -1191,8 +1198,9 @@ namespace CalamityMod.NPCs { shop.Add(ItemType()) .Add(ItemType()) - .Add(ItemType(), Condition.Hardmode) - .Add(ItemType(), Condition.Hardmode) + .Add(ItemType()) + .Add(ItemType()) + .Add(ItemType()) .AddWithCustomValue(ItemID.ButterflyDust, Item.buyPrice(gold: 10), Condition.DownedGolem) .AddWithCustomValue(ItemID.FriedEgg, Item.buyPrice(gold: 2, silver: 50), Condition.HappyEnough); } @@ -1235,15 +1243,6 @@ namespace CalamityMod.NPCs shop.AddWithCustomValue(ItemID.Steak, Item.buyPrice(gold: 5), Condition.HappyEnough, Condition.Hardmode); } } - - public override void SetupTravelShop(int[] shop, ref int nextSlot) - { - if (Main.moonPhase == 0) - { - shop[nextSlot] = ItemType(); - nextSlot++; - } - } #endregion } } diff --git a/NPCs/CalamityPolarityNPC.cs b/NPCs/CalamityPolarityNPC.cs index 6eff97e753..b414c40154 100644 --- a/NPCs/CalamityPolarityNPC.cs +++ b/NPCs/CalamityPolarityNPC.cs @@ -1,11 +1,11 @@ using System; +using System.Collections.Generic; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Particles; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ModLoader; -using CalamityMod.Particles; -using CalamityMod.Items.Weapons.Ranged; -using System.Collections.Generic; -using Microsoft.Xna.Framework.Graphics; namespace CalamityMod.NPCs { @@ -45,7 +45,7 @@ namespace CalamityMod.NPCs //Round the polarity to avoid ending up with a polarity that's got decimals which will cause it to forever alternate between positive and negative. CurPolarity = (float)Math.Round(update); Color pulseColor = AdamantiteParticleAccelerator.LightColors[update < 0 ? 1 : 0]; - pulses.Add(new AuraPulseRing(pulseColor, new Vector2(Math.Max(npc.width / 156f * 1.1f, 0.25f) , 0.3f), new Vector2(Math.Max(npc.width / 156f * 1.5f, 0.4f), 0.01f), 40, npc)); + pulses.Add(new AuraPulseRing(pulseColor, new Vector2(Math.Max(npc.width / 156f * 1.1f, 0.25f), 0.3f), new Vector2(Math.Max(npc.width / 156f * 1.5f, 0.4f), 0.01f), 40, npc)); } public override GlobalNPC Clone(NPC npc, NPC npcClone) diff --git a/NPCs/CalamityVanillaMinibossesAI.cs b/NPCs/CalamityVanillaMinibossesAI.cs index 9c8bb57cb4..10d1ddeb09 100644 --- a/NPCs/CalamityVanillaMinibossesAI.cs +++ b/NPCs/CalamityVanillaMinibossesAI.cs @@ -1,5 +1,5 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -27,7 +27,6 @@ namespace CalamityMod.NPCs npc.noTileCollide = false; npc.noGravity = true; npc.knockBackResist = 0f; - npc.damage = npc.defDamage; ref float aiState = ref npc.ai[0]; @@ -60,6 +59,7 @@ namespace CalamityMod.NPCs switch ((MothronAIState)(int)aiState) { case MothronAIState.DespawnYeet: + npc.damage = 0; Vector2 idealVelocity = Vector2.UnitY * -34f; npc.velocity = (npc.velocity * 4f + idealVelocity) / 5f; npc.noTileCollide = true; @@ -67,6 +67,8 @@ namespace CalamityMod.NPCs return false; case MothronAIState.NewAISelection: + npc.damage = 0; + ref float aiTimer = ref npc.ai[1]; npc.TargetClosest(true); @@ -146,6 +148,8 @@ namespace CalamityMod.NPCs break; case MothronAIState.FlyTowardsPlayer: + npc.damage = 0; + npc.collideX = false; npc.collideY = false; npc.noTileCollide = true; @@ -173,6 +177,8 @@ namespace CalamityMod.NPCs break; case MothronAIState.AccelerateTowardsPlayer: + npc.damage = (int)Math.Round(npc.defDamage * 0.5); + aiTimer = ref npc.ai[1]; ref float flySpeedAdditive = ref npc.ai[2]; @@ -226,6 +232,8 @@ namespace CalamityMod.NPCs break; case MothronAIState.ChargeRedirect: + npc.damage = 0; + flySpeedAdditive = ref npc.ai[2]; npc.noTileCollide = true; @@ -257,7 +265,10 @@ namespace CalamityMod.NPCs idealVelocity = npc.SafeDirectionTo(destination, -Vector2.UnitY) * flySpeed; npc.velocity = (npc.velocity * (flyInertia - 1f) + idealVelocity) / flyInertia; break; + case MothronAIState.ChargePreparation: + npc.damage = 0; + aiTimer = ref npc.ai[1]; ref float chargeDirection = ref npc.ai[2]; @@ -292,11 +303,11 @@ namespace CalamityMod.NPCs } break; - case MothronAIState.DoTheFuckingCharge: + case MothronAIState.DoTheFuckingCharge: chargeDirection = ref npc.ai[2]; flySpeedAdditive = ref npc.ai[3]; - npc.damage = (int)(npc.defDamage * 1.2); + npc.damage = (int)Math.Round(npc.defDamage * 1.2); npc.collideX = false; npc.collideY = false; npc.noTileCollide = true; @@ -331,6 +342,8 @@ namespace CalamityMod.NPCs break; case MothronAIState.PickSpotToLayEgg: + npc.damage = 0; + ref float laySpotPositionX = ref npc.ai[2]; ref float laySpotPositionY = ref npc.ai[3]; // Fallback if the spot selection fails. @@ -376,6 +389,8 @@ namespace CalamityMod.NPCs break; case MothronAIState.FlyToEggSpot: + npc.damage = 0; + npc.spriteDirection = npc.direction = (npc.velocity.X > 0).ToDirectionInt(); npc.rotation = (npc.rotation * 9f + npc.velocity.X * 0.025f) / 10f; npc.noTileCollide = true; @@ -398,6 +413,8 @@ namespace CalamityMod.NPCs break; case MothronAIState.LayEgg: + npc.damage = 0; + npc.rotation = (npc.rotation * 9f + npc.velocity.X * 0.025f) / 10f; npc.noTileCollide = false; @@ -424,7 +441,7 @@ namespace CalamityMod.NPCs npc.ai[2] = npc.ai[3] = 0f; // Try to lay another egg at a 66% chance if the amount of eggs + spawns is not at the limit. - if (NPC.CountNPCS(NPCID.MothronEgg) + NPC.CountNPCS(NPCID.MothronSpawn) < 3 && Main.rand.Next(3) != 0) + if (NPC.CountNPCS(NPCID.MothronEgg) + NPC.CountNPCS(NPCID.MothronSpawn) < 3 && !Main.rand.NextBool(3)) aiState = (int)MothronAIState.PickSpotToLayEgg; else if (Collision.SolidCollision(npc.position, npc.width, npc.height)) aiState = (int)MothronAIState.FlyTowardsPlayer; @@ -643,6 +660,9 @@ namespace CalamityMod.NPCs if (npc.ai[2] == 0f || npc.ai[2] == 3f) { + // Avoid cheap bullshit + npc.damage = 0; + if (Main.npc[(int)npc.ai[1]].ai[1] == 3f && npc.timeLeft > 10) npc.timeLeft = 10; @@ -695,6 +715,9 @@ namespace CalamityMod.NPCs } else if (npc.ai[2] == 1f) { + // Avoid cheap bullshit + npc.damage = 0; + Vector2 scytheReturnPosition = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); float scytheReturnTargetX = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0] - scytheReturnPosition.X; float scytheReturnTargetY = Main.npc[(int)npc.ai[1]].position.Y + 230f - scytheReturnPosition.Y; @@ -709,6 +732,9 @@ namespace CalamityMod.NPCs if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y - 200f) { + // Set damage + npc.damage = npc.defDamage; + npc.TargetClosest(true); npc.ai[2] = 2f; @@ -725,13 +751,24 @@ namespace CalamityMod.NPCs } else if (npc.ai[2] == 2f) { + // Avoid cheap bullshit + npc.damage = npc.defDamage; + float scytheReturnDestination = Math.Abs(npc.Center.X - Main.npc[(int)npc.ai[1]].Center.X) + Math.Abs(npc.Center.Y - Main.npc[(int)npc.ai[1]].Center.Y); if (npc.position.Y > Main.player[npc.target].position.Y || npc.velocity.Y < 0f || scytheReturnDestination > 800f) + { + // Avoid cheap bullshit + npc.damage = 0; + npc.ai[2] = 3f; + } } else if (npc.ai[2] == 4f) { + // Avoid cheap bullshit + npc.damage = 0; + Vector2 scytheLesserSwipePos = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); float scytheLesserSwipeTargetX = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0] - scytheLesserSwipePos.X; float scytheLesserSwipeTargetY = Main.npc[(int)npc.ai[1]].position.Y + 230f - scytheLesserSwipePos.Y; @@ -748,6 +785,9 @@ namespace CalamityMod.NPCs if (npc.position.X + (float)(npc.width / 2) < Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - 500f || npc.position.X + (float)(npc.width / 2) > Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) + 500f) { + // Set damage + npc.damage = npc.defDamage; + npc.TargetClosest(true); npc.ai[2] = 5f; @@ -764,10 +804,18 @@ namespace CalamityMod.NPCs } else if (npc.ai[2] == 5f) { + // Set damage + npc.damage = npc.defDamage; + float scytheLesserSwipeReturnDest = Math.Abs(npc.Center.X - Main.npc[(int)npc.ai[1]].Center.X) + Math.Abs(npc.Center.Y - Main.npc[(int)npc.ai[1]].Center.Y); if ((npc.velocity.X > 0f && npc.position.X + (float)(npc.width / 2) > Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2)) || (npc.velocity.X < 0f && npc.position.X + (float)(npc.width / 2) < Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2)) || scytheLesserSwipeReturnDest > 800f) + { + // Avoid cheap bullshit + npc.damage = 0; + npc.ai[2] = 0f; + } } return false; diff --git a/NPCs/CeaselessVoid/CeaselessVoid.cs b/NPCs/CeaselessVoid/CeaselessVoid.cs index 7ec4467489..8a3a648268 100644 --- a/NPCs/CeaselessVoid/CeaselessVoid.cs +++ b/NPCs/CeaselessVoid/CeaselessVoid.cs @@ -1,4 +1,5 @@ -using CalamityMod.Dusts; +using System.IO; +using CalamityMod.Dusts; using CalamityMod.Items.Accessories; using CalamityMod.Items.Armor.Vanity; using CalamityMod.Items.LoreItems; @@ -10,19 +11,20 @@ using CalamityMod.Items.Potions; using CalamityMod.Items.TreasureBags; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Summon; +using CalamityMod.NPCs.CalamityAIs.CalamityBossAIs; +using CalamityMod.Sounds; using CalamityMod.UI.VanillaBossBars; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; +using Terraria.Audio; using Terraria.GameContent; using Terraria.GameContent.Bestiary; +using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; -using System.IO; -using Terraria.Audio; -using Terraria.GameContent.ItemDropRules; -using CalamityMod.Sounds; -using CalamityMod.World; namespace CalamityMod.NPCs.CeaselessVoid { @@ -32,6 +34,8 @@ namespace CalamityMod.NPCs.CeaselessVoid public static readonly SoundStyle DeathSound = new("CalamityMod/Sounds/NPCKilled/CeaselessVoidDeath"); public static readonly SoundStyle BuildupSound = new("CalamityMod/Sounds/Custom/CeaselessVoidDeathBuild"); + public static Asset GlowTexture; + public bool playedbuildsound = false; public override void SetStaticDefaults() @@ -39,12 +43,16 @@ namespace CalamityMod.NPCs.CeaselessVoid Main.npcFrameCount[NPC.type] = 6; NPCID.Sets.TrailingMode[NPC.type] = 1; NPCID.Sets.BossBestiaryPriority.Add(Type); - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { Scale = 0.55f, }; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; NPCID.Sets.MPAllowedEnemies[Type] = true; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -74,7 +82,7 @@ namespace CalamityMod.NPCs.CeaselessVoid public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.TheDungeon, new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.CeaselessVoid") @@ -115,7 +123,7 @@ namespace CalamityMod.NPCs.CeaselessVoid public override void AI() { - CalamityAI.CeaselessVoidAI(NPC, Mod); + CeaselessVoidAI.VanillaCeaselessVoidAI(NPC, Mod); } public override bool CanHitPlayer(Player target, ref int cooldownSlot) @@ -168,7 +176,7 @@ namespace CalamityMod.NPCs.CeaselessVoid drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/CeaselessVoid/CeaselessVoidGlow").Value; + texture2D15 = GlowTexture.Value; Color cyanLerp = Color.Lerp(Color.White, Color.Cyan, 0.5f); if (CalamityConfig.Instance.Afterimages) @@ -246,7 +254,7 @@ namespace CalamityMod.NPCs.CeaselessVoid public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { - NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); } public override void BossLoot(ref string name, ref int potionType) @@ -264,7 +272,7 @@ namespace CalamityMod.NPCs.CeaselessVoid { pitchVar = Main.rand.Next(-60, 41) * 0.01f; } - SoundEngine.PlaySound(CommonCalamitySounds.OtherwordlyHitSound with { Pitch = CommonCalamitySounds.OtherwordlyHitSound.Pitch + pitchVar}, NPC.Center); + SoundEngine.PlaySound(CommonCalamitySounds.OtherwordlyHitSound with { Pitch = CommonCalamitySounds.OtherwordlyHitSound.Pitch + pitchVar }, NPC.Center); } for (int k = 0; k < 5; k++) @@ -283,7 +291,7 @@ namespace CalamityMod.NPCs.CeaselessVoid NPC.position.Y = NPC.position.Y - (float)(NPC.height / 2); for (int i = 0; i < 40; i++) { - int purpleDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + int purpleDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[purpleDust].velocity *= 3f; Main.dust[purpleDust].noGravity = true; if (Main.rand.NextBool()) @@ -294,10 +302,10 @@ namespace CalamityMod.NPCs.CeaselessVoid } for (int j = 0; j < 70; j++) { - int purpleDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); + int purpleDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); Main.dust[purpleDust2].noGravity = true; Main.dust[purpleDust2].velocity *= 5f; - purpleDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + purpleDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[purpleDust2].noGravity = true; Main.dust[purpleDust2].velocity *= 2f; } diff --git a/NPCs/CeaselessVoid/DarkEnergy.cs b/NPCs/CeaselessVoid/DarkEnergy.cs index a254faf2f8..202e8d1e86 100644 --- a/NPCs/CeaselessVoid/DarkEnergy.cs +++ b/NPCs/CeaselessVoid/DarkEnergy.cs @@ -1,10 +1,11 @@ -using CalamityMod.Dusts; +using System; +using System.IO; +using CalamityMod.Dusts; using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.GameContent.Bestiary; @@ -27,11 +28,17 @@ namespace CalamityMod.NPCs.CeaselessVoid public const int HitboxSize = 64; public const int FrameCount = 8; + public static Asset GlowTexture; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = FrameCount; NPCID.Sets.TrailingMode[NPC.type] = 1; NPCID.Sets.BossBestiaryPriority.Add(Type); + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -50,10 +57,13 @@ namespace CalamityMod.NPCs.CeaselessVoid NPC.Opacity = 0f; NPC.noGravity = true; NPC.noTileCollide = true; - NPC.canGhostHeal = false; NPC.HitSound = SoundID.NPCHit53; NPC.DeathSound = SoundID.NPCDeath44; NPC.Calamity().VulnerableToSickness = false; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -61,10 +71,10 @@ namespace CalamityMod.NPCs.CeaselessVoid int associatedNPCType = ModContent.NPCType(); bestiaryEntry.UIInfoProvider = new CommonEnemyUICollectionInfoProvider(ContentSamples.NpcBestiaryCreditIdsByNpcNetIds[associatedNPCType], quickUnlock: true); - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.TheDungeon, - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.DarkEnergy") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.DarkEnergy") }); } @@ -210,7 +220,7 @@ namespace CalamityMod.NPCs.CeaselessVoid Main.EntitySpriteDraw(mainTexture, drawPos, NPC.frame, Color.White, NPC.rotation, drawOrigin, scale, spriteEffects, 0); return false; } - + if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; @@ -240,7 +250,7 @@ namespace CalamityMod.NPCs.CeaselessVoid if (NPC.dontTakeDamage) return false; - Texture2D glowTexture = ModContent.Request("CalamityMod/NPCs/CeaselessVoid/DarkEnergyGlow").Value; + Texture2D glowTexture = GlowTexture.Value; Color glowColor = Color.Lerp(Color.White, Color.Fuchsia, 0.5f) * NPC.Opacity; if (CalamityConfig.Instance.Afterimages) diff --git a/NPCs/Crabulon/CrabShroom.cs b/NPCs/Crabulon/CrabShroom.cs index a4e7110938..fe2ecc6d04 100644 --- a/NPCs/Crabulon/CrabShroom.cs +++ b/NPCs/Crabulon/CrabShroom.cs @@ -2,9 +2,9 @@ using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; -using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; @@ -12,11 +12,17 @@ namespace CalamityMod.NPCs.Crabulon { public class CrabShroom : ModNPC { + public static Asset GlowTexture; + public override void SetStaticDefaults() { this.HideFromBestiary(); Main.npcFrameCount[NPC.type] = 4; NPCID.Sets.BossBestiaryPriority.Add(Type); + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -28,7 +34,7 @@ namespace CalamityMod.NPCs.Crabulon if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) NPC.scale = 2f; - NPC.lifeMax = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 30 : 15; + NPC.lifeMax = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 180 : 30; if (BossRushEvent.BossRushActive) NPC.lifeMax = 8000; if (Main.getGoodWorld) @@ -37,15 +43,18 @@ namespace CalamityMod.NPCs.Crabulon double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); AIType = -1; - NPC.knockBackResist = 0.75f; + NPC.knockBackResist = 0.5f; NPC.noGravity = true; NPC.noTileCollide = true; - NPC.canGhostHeal = false; NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath1; NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void FindFrame(int frameHeight) @@ -58,37 +67,40 @@ namespace CalamityMod.NPCs.Crabulon public override void AI() { - Lighting.AddLight((int)((NPC.position.X + (NPC.width / 2)) / 16f), (int)((NPC.position.Y + (NPC.height / 2)) / 16f), 0f, 0.2f, 0.4f); + Lighting.AddLight(NPC.Center, 0f, 0.2f, 0.4f); + + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; - float xVelocityLimit = BossRushEvent.BossRushActive ? 7.5f : 5f; - float yVelocityLimit = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 0.5f : revenge ? 1.25f : 1f; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + + 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(); Player player = Main.player[NPC.target]; + NPC.velocity.Y += 0.02f; if (NPC.velocity.Y > yVelocityLimit) - { NPC.velocity.Y = yVelocityLimit; - } + if (NPC.position.X + NPC.width < player.position.X) { if (NPC.velocity.X < 0f) - { NPC.velocity.X *= 0.98f; - } + NPC.velocity.X += 0.1f; } else if (NPC.position.X > player.position.X + player.width) { if (NPC.velocity.X > 0f) - { NPC.velocity.X *= 0.98f; - } + NPC.velocity.X -= 0.1f; } + if (NPC.velocity.X > xVelocityLimit || NPC.velocity.X < -xVelocityLimit) - { NPC.velocity.X *= 0.97f; - } + NPC.rotation = NPC.velocity.X * 0.1f; if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) @@ -127,10 +139,10 @@ namespace CalamityMod.NPCs.Crabulon spriteEffects = SpriteEffects.FlipHorizontally; Texture2D texture = TextureAssets.Npc[NPC.type].Value; - Texture2D glow = ModContent.Request("CalamityMod/NPCs/Crabulon/CrabShroomGlow").Value; + Texture2D glow = GlowTexture.Value; Color colorToShift = Main.zenithWorld ? new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB) : Color.Cyan; Color glowColor = Color.Lerp(Color.White, colorToShift, 0.5f); - + int ClonesAroundShroom = Main.zenithWorld ? 4 : 0; for (int c = 0; c < 1 + ClonesAroundShroom; c++) { @@ -155,16 +167,13 @@ namespace CalamityMod.NPCs.Crabulon public override void HitEffect(NPC.HitInfo hit) { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 56, hit.HitDirection, -1f, 0, default, 1f); - } + for (int k = 0; k < 2; k++) + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.BlueFairy, hit.HitDirection, -1f, 0, default, 1f); + if (NPC.life <= 0) { - for (int k = 0; k < 10; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 56, hit.HitDirection, -1f, 0, default, 1f); - } + for (int k = 0; k < 6; k++) + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.BlueFairy, hit.HitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/Crabulon/Crabulon.cs b/NPCs/Crabulon/Crabulon.cs index b54d7a4d5b..c22d47736d 100644 --- a/NPCs/Crabulon/Crabulon.cs +++ b/NPCs/Crabulon/Crabulon.cs @@ -1,4 +1,6 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using System.IO; +using CalamityMod.Buffs.Alcohol; using CalamityMod.Events; using CalamityMod.Items.Accessories; using CalamityMod.Items.Armor.Vanity; @@ -6,6 +8,7 @@ using CalamityMod.Items.LoreItems; using CalamityMod.Items.Placeables.Furniture.BossRelics; using CalamityMod.Items.Placeables.Furniture.DevPaintings; using CalamityMod.Items.Placeables.Furniture.Trophies; +using CalamityMod.Items.Potions.Alcohol; using CalamityMod.Items.TreasureBags; using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Melee; @@ -16,16 +19,14 @@ using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; +using ReLogic.Content; using Terraria; +using Terraria.Audio; using Terraria.GameContent; using Terraria.GameContent.Bestiary; +using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using Terraria.GameContent.ItemDropRules; -using CalamityMod.Items.Potions.Alcohol; namespace CalamityMod.NPCs.Crabulon { @@ -35,11 +36,17 @@ namespace CalamityMod.NPCs.Crabulon private int biomeEnrageTimer = CalamityGlobalNPC.biomeEnrageTimerMax; private bool stomping = false; + public static Asset AltTexture; + public static Asset AttackTexture; + public static Asset Texture_Glow; + public static Asset AltTexture_Glow; + public static Asset AttackTexture_Glow; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 6; NPCID.Sets.BossBestiaryPriority.Add(Type); - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { Scale = 0.32f, PortraitScale = 0.55f, @@ -47,7 +54,15 @@ namespace CalamityMod.NPCs.Crabulon }; value.Position.Y += 80f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; - NPCID.Sets.MPAllowedEnemies[Type] = true; + NPCID.Sets.MPAllowedEnemies[Type] = true; + if (!Main.dedServ) + { + AltTexture = ModContent.Request(Texture + "Alt", AssetRequestMode.AsyncLoad); + AttackTexture = ModContent.Request(Texture + "Attack", AssetRequestMode.AsyncLoad); + Texture_Glow = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + AltTexture_Glow = ModContent.Request(Texture + "AltGlow", AssetRequestMode.AsyncLoad); + AttackTexture_Glow = ModContent.Request(Texture + "AttackGlow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -58,7 +73,7 @@ namespace CalamityMod.NPCs.Crabulon NPC.width = 196; NPC.height = 196; NPC.defense = 8; - NPC.LifeMaxNERB(3350, 4000, 680000); + NPC.LifeMaxNERB(3700, 4400, 680000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); NPC.aiStyle = -1; @@ -83,7 +98,7 @@ namespace CalamityMod.NPCs.Crabulon public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.UndergroundMushroom, new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Crabulon") @@ -190,46 +205,32 @@ namespace CalamityMod.NPCs.Crabulon if (NPC.ai[0] < 2f) { - Vector2 mushBombDirection = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); - int mushBombAmt = 1; - NPC.localAI[3] += 2f; - if (phase2) - { - NPC.localAI[3] += 1f; - mushBombAmt += 2; - } - if (phase3) - { - NPC.localAI[3] += 2f; - mushBombAmt += 3; - } + int mushBombAmt = phase3 ? 6 : phase2 ? 3 : 1; + float fireRate = phase3 ? 4f : phase2 ? 2f : 1f; + NPC.localAI[3] += fireRate; if (NPC.ai[3] == 0f) { - if (NPC.localAI[3] > 600f) + float shootMushroomsGateValue = revenge ? 120f : expertMode ? 200f : 300f; + if (NPC.localAI[3] > shootMushroomsGateValue) { NPC.ai[3] = 1f; NPC.localAI[3] = 0f; } } - else if (NPC.localAI[3] > 45f) + else if (NPC.localAI[3] > 30f) { NPC.localAI[3] = 0f; NPC.ai[3] += 1f; if (NPC.ai[3] >= mushBombAmt) NPC.ai[3] = 0f; - float mushBombSpeed = 10f; + float mushBombSpeed = phase3 ? 14f : phase2 ? 12f : 10f; int type = ModContent.ProjectileType(); SoundEngine.PlaySound(SoundID.Item42, NPC.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { - if (phase2) - mushBombSpeed += 1f; - if (phase3) - mushBombSpeed += 1f; - - mushBombDirection = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); + Vector2 mushBombDirection = NPC.Center; float playerXDist = player.position.X + player.width * 0.5f - mushBombDirection.X; float playerYDist = player.position.Y + player.height * 0.5f - mushBombDirection.Y; float playerDistance = (float)Math.Sqrt(playerXDist * playerXDist + playerYDist * playerYDist); @@ -238,13 +239,18 @@ namespace CalamityMod.NPCs.Crabulon playerYDist *= playerDistance; mushBombDirection.X += playerXDist; mushBombDirection.Y += playerYDist; - Projectile.NewProjectile(NPC.GetSource_FromAI(), mushBombDirection.X, mushBombDirection.Y, playerXDist, playerYDist - 5f, type, NPC.GetProjectileDamage(type), 0f, Main.myPlayer, 0f, player.Center.Y); + float yVelocity = death ? 1f : expertMode ? 2.5f : 5f; + Vector2 mushBombVelocity = new Vector2(playerXDist, playerYDist - yVelocity); + Projectile.NewProjectile(NPC.GetSource_FromAI(), mushBombDirection, mushBombVelocity, type, NPC.GetProjectileDamage(type), 0f, Main.myPlayer, 0f, player.Center.Y); } } } if (NPC.ai[0] == 0f) { + // Avoid cheap bullshit + NPC.damage = 0; + NPC.velocity *= 0.98f; NPC.ai[1] += 1f; @@ -252,10 +258,9 @@ namespace CalamityMod.NPCs.Crabulon NPC.ai[1] += 1f; if (phase3) NPC.ai[1] += 2f; - if (NPC.justHit) - NPC.ai[1] += 4f; - if (NPC.ai[1] >= (death ? 150f : revenge ? 180f : 240f)) + float idleTime = death ? 30f : expertMode ? 60f : 120f; + if (NPC.ai[1] >= idleTime) { NPC.TargetClosest(); NPC.noGravity = true; @@ -267,16 +272,16 @@ namespace CalamityMod.NPCs.Crabulon } else if (NPC.ai[0] == 1f) { - float walkingVelocity = 2f; + // Avoid cheap bullshit + NPC.damage = 0; + + float walkingVelocity = (death ? (5f + 2f * (1f - lifeRatio)) : expertMode ? 5f : 3.5f) + 2.5f * enrageScale; if (phase2) - walkingVelocity = 2.5f; + walkingVelocity += 0.5f; if (phase3) - walkingVelocity = 3f; - if (death) - walkingVelocity += 2f * (1f - lifeRatio); + walkingVelocity += 1f; if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) walkingVelocity *= 2f; - walkingVelocity += 2.5f * enrageScale; bool shouldWalkSlower = false; if (Math.Abs(NPC.Center.X - player.Center.X) < 50f) @@ -285,7 +290,7 @@ namespace CalamityMod.NPCs.Crabulon if (shouldWalkSlower) { NPC.velocity.X *= 0.9f; - if (NPC.velocity.X > -0.1 && NPC.velocity.X < 0.1) + if (Math.Abs(NPC.velocity.X) < 0.1f) NPC.velocity.X = 0f; } else @@ -293,10 +298,11 @@ namespace CalamityMod.NPCs.Crabulon float playerLocation = NPC.Center.X - player.Center.X; NPC.direction = playerLocation < 0 ? 1 : -1; + float inertia = revenge ? 10f : 20f; if (NPC.direction > 0) - NPC.velocity.X = (NPC.velocity.X * 20f + walkingVelocity) / 21f; + NPC.velocity.X = (NPC.velocity.X * inertia + walkingVelocity) / (inertia + 1f); if (NPC.direction < 0) - NPC.velocity.X = (NPC.velocity.X * 20f - walkingVelocity) / 21f; + NPC.velocity.X = (NPC.velocity.X * inertia - walkingVelocity) / (inertia + 1f); } if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.Center, 1, 1) && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height) && player.position.Y <= NPC.position.Y + NPC.height && !NPC.collideX) @@ -311,9 +317,12 @@ namespace CalamityMod.NPCs.Crabulon Vector2 collisionCheckPosition = new Vector2(NPC.Center.X - 40, NPC.position.Y + NPC.height - 20); bool fallDownOnTopOfTarget = NPC.position.X < player.position.X && NPC.position.X + NPC.width > player.position.X + player.width && NPC.position.Y + NPC.height < player.position.Y + player.height - 16f; + float acceleration = death ? 0.1f : expertMode ? 0.05f : 0.025f; + float acceleration2 = death ? 0.8f : expertMode ? 0.4f : 0.2f; if (fallDownOnTopOfTarget) { - NPC.velocity.Y += 0.5f; + float fallSpeed = death ? 2f : expertMode ? 1f : 0.5f; + NPC.velocity.Y += fallSpeed; } else if (Collision.SolidCollision(collisionCheckPosition, 80, 20)) { @@ -321,12 +330,13 @@ namespace CalamityMod.NPCs.Crabulon NPC.velocity.Y = 0f; if (NPC.velocity.Y > -0.2f) - NPC.velocity.Y -= 0.025f; + NPC.velocity.Y -= acceleration; else - NPC.velocity.Y -= 0.2f; + NPC.velocity.Y -= acceleration2; - if (NPC.velocity.Y < -4f) - NPC.velocity.Y = -4f; + float upwardSpeedCap = death ? 16f : expertMode ? 8f : 4f; + if (NPC.velocity.Y < -upwardSpeedCap) + NPC.velocity.Y = -upwardSpeedCap; } else { @@ -334,14 +344,15 @@ namespace CalamityMod.NPCs.Crabulon NPC.velocity.Y = 0f; if (NPC.velocity.Y < 0.1f) - NPC.velocity.Y += 0.025f; + NPC.velocity.Y += acceleration; else NPC.velocity.Y += 0.5f; } } NPC.ai[1] += 1f; - if (NPC.ai[1] >= (360f - (death ? 120f * (1f - lifeRatio) : 0f))) + float stompPhaseGateValue = (revenge ? 150f : expertMode ? 240f : 360f) - (death ? 120f * (1f - lifeRatio) : 0f); + if (NPC.ai[1] >= stompPhaseGateValue) { NPC.TargetClosest(); NPC.noGravity = false; @@ -356,6 +367,9 @@ namespace CalamityMod.NPCs.Crabulon } else if (NPC.ai[0] == 2f) { + // Avoid cheap bullshit + NPC.damage = 0; + NPC.noTileCollide = false; if (NPC.velocity.Y == 0f) { @@ -374,49 +388,54 @@ namespace CalamityMod.NPCs.Crabulon break; case 1: case 2: - NPC.ai[1] += 3f; + NPC.ai[1] += 2f; break; case 3: - NPC.ai[1] += 6f; + NPC.ai[1] += 4f; break; default: break; } } if (phase2) - NPC.ai[1] += !revenge ? 4f : 1f; + NPC.ai[1] += !revenge ? 2f : 1f; if (phase3) - NPC.ai[1] += !revenge ? 4f : 1f; + NPC.ai[1] += !revenge ? 2f : 1f; } - float jumpGateValue = (bossRush ? 40f : 120f) / (enrageScale + 1f); + float jumpGateValue = (bossRush ? 15f : expertMode ? 60f : 120f) / (enrageScale + 1f); if (NPC.ai[1] >= jumpGateValue) { NPC.ai[1] = -20f; } else if (NPC.ai[1] == -1f) { - int velocityX = 4; - float velocityY = -12f; + float maxVelocityXIncrease = death ? 6f : 4f; + float maxVelocityYIncrease = death ? 3f : 2f; + float velocityX = 6f + (expertMode ? (maxVelocityXIncrease * (1f - lifeRatio)) : 0f); + float velocityY = 12f + (expertMode ? (maxVelocityYIncrease * (1f - lifeRatio)) : 0f); float distanceBelowTarget = NPC.position.Y - (player.position.Y + 80f); float speedMult = 1f; if (revenge) { + float velocityXAdjustment = velocityX; + float velocityYAdjustment = velocityY / 3f; + switch ((int)NPC.ai[3]) { case 0: // Normal break; case 1: // High - velocityY -= 4f; + velocityY += velocityYAdjustment; break; case 2: // Low - velocityY += 4f; + velocityY -= velocityYAdjustment; break; case 3: // Long and low - velocityX += 4; - velocityY += 4f; + velocityX += velocityXAdjustment; + velocityY -= velocityYAdjustment; break; default: break; @@ -434,14 +453,14 @@ namespace CalamityMod.NPCs.Crabulon if (expertMode) { if (player.position.Y < NPC.Bottom.Y) - NPC.velocity.Y = velocityY; + NPC.velocity.Y = -velocityY; else NPC.velocity.Y = 1f; NPC.noTileCollide = true; } else - NPC.velocity.Y = velocityY; + NPC.velocity.Y = -velocityY; float playerLocation = NPC.Center.X - player.Center.X; NPC.direction = playerLocation < 0 ? 1 : -1; @@ -458,21 +477,24 @@ namespace CalamityMod.NPCs.Crabulon { if (NPC.velocity.Y == 0f) { + // Avoid cheap bullshit + NPC.damage = 0; + SoundEngine.PlaySound(SoundID.Item14, NPC.Center); int type = ModContent.ProjectileType(); int damage = NPC.GetProjectileDamage(type); - if (NPC.ai[2] % 2f == 0f && phase2 && revenge) + if ((NPC.ai[2] % 2f == 0f || death) && ((phase2 && revenge) || (phase3 && expertMode))) { SoundEngine.PlaySound(SoundID.Item42, NPC.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { - float projectileVelocity = BossRushEvent.BossRushActive ? 24f : CalamityWorld.death ? 12f : 10f; + float projectileVelocity = BossRushEvent.BossRushActive ? 24f : CalamityWorld.death ? 15f : 10f; Vector2 destination = new Vector2(NPC.Center.X, NPC.Center.Y - 100f) - NPC.Center; destination.Normalize(); destination *= projectileVelocity; - int numProj = bossRush ? 48 : CalamityWorld.death ? 24 : 20; + int numProj = bossRush ? 48 : CalamityWorld.death ? 30 : 20; float rotation = MathHelper.ToRadians(90); for (int i = 0; i < numProj; i++) { @@ -484,19 +506,20 @@ namespace CalamityMod.NPCs.Crabulon } NPC.TargetClosest(); + NPC.ai[2] += 1f; if (NPC.ai[2] >= (phase2 ? 4f : 3f)) { - if (revenge && !phase2) + if (revenge && (!phase2 || (phase3 && death))) { SoundEngine.PlaySound(SoundID.Item42, NPC.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { - float projectileVelocity = BossRushEvent.BossRushActive ? 24f : CalamityWorld.death ? 12f : 10f; + float projectileVelocity = BossRushEvent.BossRushActive ? 24f : CalamityWorld.death ? 15f : 10f; Vector2 destination = new Vector2(NPC.Center.X, NPC.Center.Y - 100f) - NPC.Center; destination.Normalize(); destination *= projectileVelocity; - int numProj = bossRush ? 30 : CalamityWorld.death ? 15 : 11; + int numProj = bossRush ? 30 : CalamityWorld.death ? 18 : 12; float rotation = MathHelper.ToRadians(60); for (int i = 0; i < numProj; i++) { @@ -509,6 +532,7 @@ namespace CalamityMod.NPCs.Crabulon NPC.ai[0] = 0f; NPC.ai[2] = 0f; + if (revenge) NPC.ai[3] = 0f; @@ -520,6 +544,7 @@ namespace CalamityMod.NPCs.Crabulon NPC.direction = playerLocation < 0 ? 1 : -1; NPC.ai[0] = 2f; + if (revenge) NPC.ai[3] += 1f; @@ -530,9 +555,11 @@ namespace CalamityMod.NPCs.Crabulon { for (int k = 0; k < 4; k++) { - int stompDust = Dust.NewDust(new Vector2(NPC.position.X - 20f, NPC.position.Y + NPC.height), NPC.width + 20, 4, 56, 0f, 0f, 100, default, 1.5f); + int stompDust = Dust.NewDust(new Vector2(NPC.position.X - 20f, NPC.position.Y + NPC.height), NPC.width + 20, 4, DustID.BlueFairy, 0f, 0f, 100, default, 1.5f); Main.dust[stompDust].velocity *= 0.2f; } + + // Destroy tiles with stomps in Zenith seed if (Main.zenithWorld) { int x = j / 16; @@ -559,6 +586,9 @@ namespace CalamityMod.NPCs.Crabulon } else { + // Set damage + NPC.damage = NPC.defDamage; + if (!player.dead && expertMode) { if ((player.position.Y > NPC.Bottom.Y && NPC.velocity.Y > 0f) || (player.position.Y < NPC.Bottom.Y && NPC.velocity.Y < 0f)) @@ -569,61 +599,46 @@ namespace CalamityMod.NPCs.Crabulon if (NPC.position.X < player.position.X && NPC.position.X + NPC.width > player.position.X + player.width) { - NPC.velocity.X *= 0.9f; - NPC.velocity.Y += death ? 0.18f : 0.15f; + float slowDownMultiplier = death ? 0.84f : expertMode ? 0.92f : 0.96f; + NPC.velocity.X *= slowDownMultiplier; + + float fallSpeedIncrease = death ? 0.24f : expertMode ? 0.12f : 0.06f; + NPC.velocity.Y += fallSpeedIncrease; } else { - float velocityX = 0.11f + - (expertMode ? 0.02f : 0f) + - (revenge ? 0.02f : 0f) + - (death ? 0.02f : 0f); - velocityX += 0.05f * enrageScale; - + float velocityX = (death ? 0.2f : expertMode ? 0.15f : 0.1f) + 0.05f * enrageScale; if (NPC.direction < 0) NPC.velocity.X -= velocityX; else if (NPC.direction > 0) NPC.velocity.X += velocityX; - float topXSpeed = 2.5f; - topXSpeed += enrageScale; - if (revenge) - { - topXSpeed += 1f; - } + float topXSpeed = (death ? 5.5f : expertMode ? 4f : 2.5f) + enrageScale; if (phase2) - { topXSpeed += 1f; - } if (phase3) - { topXSpeed += 1f; - } + if (NPC.velocity.X < -topXSpeed) - { NPC.velocity.X = -topXSpeed; - } if (NPC.velocity.X > topXSpeed) - { NPC.velocity.X = topXSpeed; - } } } } if (NPC.localAI[0] == 0f && NPC.life > 0) - { NPC.localAI[0] = NPC.lifeMax; - } + if (NPC.life > 0) { if (Main.netMode != NetmodeID.MultiplayerClient) { - int crabShroomSpawnFreq = (int)(NPC.lifeMax * ((CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 0.01 : Main.getGoodWorld ? 0.025 : 0.05)); + int crabShroomSpawnFreq = (int)(NPC.lifeMax * ((CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 0.01 : Main.getGoodWorld ? 0.02 : 0.05)); if ((NPC.life + crabShroomSpawnFreq) < NPC.localAI[0]) { NPC.localAI[0] = NPC.life; - int crabShroomAmt = death ? 3 : expertMode ? Main.rand.Next(2, 4) : 2; + int crabShroomAmt = death ? 4 : expertMode ? 3 : 2; for (int mush = 0; mush < crabShroomAmt; mush++) { int x = (int)(NPC.position.X + Main.rand.Next(NPC.width - 32)); @@ -634,9 +649,7 @@ namespace CalamityMod.NPCs.Crabulon Main.npc[crabShroom].velocity.X = Main.rand.Next(-50, 51) * (Main.getGoodWorld ? 0.2f : 0.1f); Main.npc[crabShroom].velocity.Y = Main.rand.Next(-50, -31) * (Main.getGoodWorld ? 0.2f : 0.1f); if (Main.netMode == NetmodeID.Server && crabShroom < Main.maxNPCs) - { - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, crabShroom, 0f, 0f, 0f, 0, 0, 0); - } + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, crabShroom); } } } @@ -771,11 +784,11 @@ namespace CalamityMod.NPCs.Crabulon spriteEffects = SpriteEffects.FlipHorizontally; Texture2D textureIdle = TextureAssets.Npc[NPC.type].Value; - Texture2D glowIdle = ModContent.Request("CalamityMod/NPCs/Crabulon/CrabulonGlow").Value; - Texture2D textureWalk = ModContent.Request("CalamityMod/NPCs/Crabulon/CrabulonAlt").Value; - Texture2D glowWalk = ModContent.Request("CalamityMod/NPCs/Crabulon/CrabulonAltGlow").Value; - Texture2D textureAttack = ModContent.Request("CalamityMod/NPCs/Crabulon/CrabulonAttack").Value; - Texture2D glowAttack = ModContent.Request("CalamityMod/NPCs/Crabulon/CrabulonAttackGlow").Value; + Texture2D glowIdle = Texture_Glow.Value; + Texture2D textureWalk = AltTexture.Value; + Texture2D glowWalk = AltTexture_Glow.Value; + Texture2D textureAttack = AttackTexture.Value; + Texture2D glowAttack = AttackTexture_Glow.Value; Color colorToShift = Main.zenithWorld ? new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB) : Color.Cyan; Color glowColor = Color.Lerp(Color.White, colorToShift, 0.5f); @@ -873,7 +886,7 @@ namespace CalamityMod.NPCs.Crabulon public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { - NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } @@ -881,7 +894,7 @@ namespace CalamityMod.NPCs.Crabulon { for (int k = 0; k < 5; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 56, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.BlueFairy, hit.HitDirection, -1f, 0, default, 1f); } if (NPC.life <= 0) { @@ -893,7 +906,7 @@ namespace CalamityMod.NPCs.Crabulon NPC.position.Y = NPC.position.Y - (NPC.height / 2); for (int i = 0; i < 40; i++) { - int j = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 56, 0f, 0f, 100, default, 2f); + int j = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.BlueFairy, 0f, 0f, 100, default, 2f); Main.dust[j].velocity *= 3f; if (Main.rand.NextBool()) { @@ -903,10 +916,10 @@ namespace CalamityMod.NPCs.Crabulon } for (int k = 0; k < 70; k++) { - int stompDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 56, 0f, 0f, 100, default, 3f); + int stompDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.BlueFairy, 0f, 0f, 100, default, 3f); Main.dust[stompDust].noGravity = true; Main.dust[stompDust].velocity *= 5f; - stompDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 56, 0f, 0f, 100, default, 2f); + stompDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.BlueFairy, 0f, 0f, 100, default, 2f); Main.dust[stompDust].velocity *= 2f; } if (Main.netMode != NetmodeID.Server) diff --git a/NPCs/Crags/CalamityEye.cs b/NPCs/Crags/CalamityEye.cs index ce525958e2..5ee0f09e36 100644 --- a/NPCs/Crags/CalamityEye.cs +++ b/NPCs/Crags/CalamityEye.cs @@ -15,7 +15,7 @@ namespace CalamityMod.NPCs.Crags public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 4; - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0); + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(); value.Position.Y -= 10f; value.PortraitPositionYOverride = -36f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; @@ -30,7 +30,7 @@ namespace CalamityMod.NPCs.Crags NPC.height = 30; NPC.defense = 12; NPC.lifeMax = 140; - NPC.knockBackResist = 0f; + NPC.knockBackResist = 0.75f; AnimationType = NPCID.DemonEye; NPC.value = Item.buyPrice(0, 0, 5, 0); NPC.HitSound = SoundID.NPCHit1; @@ -47,13 +47,17 @@ namespace CalamityMod.NPCs.Crags NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToWater = true; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.CalamityEye") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.CalamityEye") }); } diff --git a/NPCs/Crags/DespairStone.cs b/NPCs/Crags/DespairStone.cs index dfc8f2a6d0..b26c85bc46 100644 --- a/NPCs/Crags/DespairStone.cs +++ b/NPCs/Crags/DespairStone.cs @@ -1,20 +1,21 @@ -using CalamityMod.BiomeManagers; +using System; +using CalamityMod.BiomeManagers; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; -using CalamityMod.Particles; using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables; using CalamityMod.Items.Placeables.Banners; +using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; +using CalamityMod.Particles; using CalamityMod.World; using Microsoft.Xna.Framework; +using ReLogic.Utilities; using Terraria; using Terraria.Audio; using Terraria.GameContent.Bestiary; using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; -using ReLogic.Utilities; -using System; -using CalamityMod.Items.Placeables; namespace CalamityMod.NPCs.Crags { @@ -36,7 +37,7 @@ namespace CalamityMod.NPCs.Crags NPC.defense = 38; NPC.DR_NERD(0.35f); NPC.lifeMax = 120; - NPC.knockBackResist = 0f; + NPC.knockBackResist = 0.1f; NPC.value = Item.buyPrice(0, 0, 5, 0); NPC.HitSound = SoundID.NPCHit41; NPC.DeathSound = SoundID.NPCDeath14; @@ -54,11 +55,15 @@ namespace CalamityMod.NPCs.Crags NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToWater = true; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.DespairStone") }); @@ -82,7 +87,7 @@ namespace CalamityMod.NPCs.Crags else //run regular ai if buzzsaw mode isn't available { NPC.ai[2] = 0f; - CalamityAI.UnicornAI(NPC, Mod, true, CalamityWorld.death ? 8f : CalamityWorld.revenge ? 6f : 4f, 5f, 0.2f); + CalamityRegularEnemyAI.UnicornAI(NPC, Mod, true, CalamityWorld.death ? 8f : CalamityWorld.revenge ? 6f : 4f, 5f, 0.2f); } if (NPC.lavaWet) //float on lava NPC.velocity.Y += -0.8f; @@ -99,7 +104,7 @@ namespace CalamityMod.NPCs.Crags if (NPC.velocity.X < 0f) //left { NPC.ai[2] = -1f; - } + } else if (NPC.velocity.X > 0f) //right { NPC.ai[2] = 1f; @@ -201,7 +206,7 @@ namespace CalamityMod.NPCs.Crags Vector2 splatterDirection; if (NPC.velocity.X == 0f) { - particleSpawnDisplacement = new Vector2 (24f * NPC.ai[2], 20f); + particleSpawnDisplacement = new Vector2(24f * NPC.ai[2], 20f); splatterDirection = new Vector2(0f, 1f); } else @@ -209,7 +214,7 @@ namespace CalamityMod.NPCs.Crags particleSpawnDisplacement = new Vector2(20f * -NPC.ai[2], 24f); splatterDirection = new Vector2(-NPC.ai[2], 0f); } - + //Color impactColor = Color.Lerp(Color.Silver, Color.Gold, Main.rand.NextFloat(0.5f)); Vector2 bloodSpawnPosition = NPC.Center + particleSpawnDisplacement; diff --git a/NPCs/Crags/HeatSpirit.cs b/NPCs/Crags/HeatSpirit.cs index 931fe5835d..f2837be0e0 100644 --- a/NPCs/Crags/HeatSpirit.cs +++ b/NPCs/Crags/HeatSpirit.cs @@ -1,9 +1,9 @@ -using CalamityMod.BiomeManagers; +using System; +using CalamityMod.BiomeManagers; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; -using System; using Terraria; using Terraria.GameContent.Bestiary; using Terraria.GameContent.ItemDropRules; @@ -16,7 +16,7 @@ namespace CalamityMod.NPCs.Crags public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 4; - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { SpriteDirection = -1, PortraitPositionYOverride = -32f @@ -44,11 +44,15 @@ namespace CalamityMod.NPCs.Crags NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToWater = true; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.HeatSpirit") }); diff --git a/NPCs/Crags/InfernalCongealment.cs b/NPCs/Crags/InfernalCongealment.cs index 45c44780d6..984dc9505e 100644 --- a/NPCs/Crags/InfernalCongealment.cs +++ b/NPCs/Crags/InfernalCongealment.cs @@ -1,9 +1,9 @@ using CalamityMod.BiomeManagers; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; +using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Placeables.Ores; -using CalamityMod.Items.Materials; using Terraria; using Terraria.GameContent.Bestiary; using Terraria.GameContent.ItemDropRules; @@ -27,7 +27,7 @@ namespace CalamityMod.NPCs.Crags NPC.height = 30; NPC.defense = 10; NPC.lifeMax = 250; - NPC.knockBackResist = 0f; + NPC.knockBackResist = 0.5f; AnimationType = NPCID.CorruptSlime; NPC.value = Item.buyPrice(0, 0, 5, 0); NPC.alpha = 50; @@ -48,16 +48,25 @@ namespace CalamityMod.NPCs.Crags NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToWater = true; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.InfernalCongealment") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.InfernalCongealment") }); } + public override void AI() + { + NPC.damage = (NPC.velocity.Y == 0f || NPC.velocity.Length() < 3f) ? 0 : NPC.defDamage; + } + public override float SpawnChance(NPCSpawnInfo spawnInfo) { if (!DownedBossSystem.downedBrimstoneElemental) diff --git a/NPCs/Crags/RenegadeWarlock.cs b/NPCs/Crags/RenegadeWarlock.cs index da8debc2ef..59e6fa94ec 100644 --- a/NPCs/Crags/RenegadeWarlock.cs +++ b/NPCs/Crags/RenegadeWarlock.cs @@ -45,14 +45,18 @@ namespace CalamityMod.NPCs.Crags NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToWater = true; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.TheDungeon, - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.RenegadeWarlock") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.RenegadeWarlock") }); } diff --git a/NPCs/Crags/Scryllar.cs b/NPCs/Crags/Scryllar.cs index 01b59b4993..779cc3ccd6 100644 --- a/NPCs/Crags/Scryllar.cs +++ b/NPCs/Crags/Scryllar.cs @@ -1,6 +1,6 @@ using CalamityMod.BiomeManagers; -using CalamityMod.Dusts; using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Weapons.Summon; @@ -16,7 +16,7 @@ namespace CalamityMod.NPCs.Crags { public override void SetStaticDefaults() { - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { PortraitPositionYOverride = 10f }; @@ -53,13 +53,17 @@ namespace CalamityMod.NPCs.Crags NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToWater = true; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Scryllar") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Scryllar") }); } diff --git a/NPCs/Crags/ScryllarRage.cs b/NPCs/Crags/ScryllarRage.cs index 25025b69e0..6fa5a79a6f 100644 --- a/NPCs/Crags/ScryllarRage.cs +++ b/NPCs/Crags/ScryllarRage.cs @@ -43,6 +43,10 @@ namespace CalamityMod.NPCs.Crags NPC.Calamity().VulnerableToHeat = false; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToWater = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void AI() @@ -251,17 +255,17 @@ namespace CalamityMod.NPCs.Crags { if (hurtInfo.Damage > 0) target.AddBuff(ModContent.BuffType(), 60, true); - } + } - public override void OnKill() - { - // Increase the kill count of Scryllars for the Bestiary - if (NPC.GetWereThereAnyInteractions()) - { - NPC nPC = new NPC(); - nPC.SetDefaults(ModContent.NPCType()); - Main.BestiaryTracker.Kills.RegisterKill(nPC); - } + public override void OnKill() + { + // Increase the kill count of Scryllars for the Bestiary + if (NPC.GetWereThereAnyInteractions()) + { + NPC nPC = new NPC(); + nPC.SetDefaults(ModContent.NPCType()); + Main.BestiaryTracker.Kills.RegisterKill(nPC); + } } public override void HitEffect(NPC.HitInfo hit) diff --git a/NPCs/Crags/SoulSlurper.cs b/NPCs/Crags/SoulSlurper.cs index 4647877849..5ea4ea2956 100644 --- a/NPCs/Crags/SoulSlurper.cs +++ b/NPCs/Crags/SoulSlurper.cs @@ -1,13 +1,14 @@ -using CalamityMod.BiomeManagers; +using System; +using CalamityMod.BiomeManagers; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; +using CalamityMod.Items.Fishing.FishingRods; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; -using CalamityMod.Items.Fishing.FishingRods; using CalamityMod.Projectiles.Boss; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.GameContent.Bestiary; @@ -18,9 +19,15 @@ namespace CalamityMod.NPCs.Crags { public class SoulSlurper : ModNPC { + public static Asset GlowTexture; + public override void SetStaticDefaults() { NPCID.Sets.TrailingMode[NPC.type] = 1; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -29,7 +36,7 @@ namespace CalamityMod.NPCs.Crags AIType = -1; NPC.npcSlots = 1f; NPC.damage = 30; - NPC.width = 60; + NPC.width = 40; NPC.height = 40; NPC.defense = 30; NPC.DR_NERD(0.15f); @@ -52,13 +59,17 @@ namespace CalamityMod.NPCs.Crags NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToWater = true; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.SoulSlurper") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.SoulSlurper") }); } @@ -69,6 +80,9 @@ namespace CalamityMod.NPCs.Crags public override void AI() { + // Setting this in SetDefaults will disable expert mode scaling, so put it here instead + NPC.damage = 0; + bool provy = DownedBossSystem.downedProvidence; Player target = Main.player[NPC.target]; if (NPC.target < 0 || NPC.target == Main.maxPlayers || target.dead) @@ -159,13 +173,10 @@ namespace CalamityMod.NPCs.Crags NPC.localAI[0] = 0f; if (Collision.CanHit(NPC.position, NPC.width, NPC.height, target.position, target.width, target.height)) { - int dmg = 30; - if (Main.expertMode) - { - dmg = 22; - } + int dmg = Main.masterMode ? 19 : Main.expertMode ? 22 : 30; int projType = ModContent.ProjectileType(); - Projectile.NewProjectile(NPC.GetSource_FromAI(), npcCenter.X, npcCenter.Y, targetX, targetY, projType, dmg + (provy ? 30 : 0), 0f, Main.myPlayer, 1f, 0f); + Vector2 projectileVelocity = new Vector2(targetX, targetY); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + projectileVelocity.SafeNormalize(Vector2.UnitY) * 16f, projectileVelocity, projType, dmg + (provy ? 30 : 0), 0f, Main.myPlayer, 1f, 0f, projectileVelocity.Length() * 3f); } } int npcTileX = (int)NPC.Center.X; @@ -263,7 +274,7 @@ namespace CalamityMod.NPCs.Crags drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture = ModContent.Request("CalamityMod/NPCs/Crags/SoulSlurperGlow").Value; + texture = GlowTexture.Value; Color redGlow = Color.Lerp(Color.White, Color.Red, 0.5f); if (CalamityConfig.Instance.Afterimages) @@ -325,7 +336,7 @@ namespace CalamityMod.NPCs.Crags NPC.position.Y = NPC.position.Y - (float)(NPC.height / 2); for (int i = 0; i < 10; i++) { - int brimDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); + int brimDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); Main.dust[brimDust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -335,10 +346,10 @@ namespace CalamityMod.NPCs.Crags } for (int j = 0; j < 20; j++) { - int brimDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 3f); + int brimDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 3f); Main.dust[brimDust2].noGravity = true; Main.dust[brimDust2].velocity *= 5f; - brimDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); + brimDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); Main.dust[brimDust2].velocity *= 2f; } } diff --git a/NPCs/Cryogen/Cryogen.cs b/NPCs/Cryogen/Cryogen.cs index 057201c028..a5cb29f29e 100644 --- a/NPCs/Cryogen/Cryogen.cs +++ b/NPCs/Cryogen/Cryogen.cs @@ -1,4 +1,6 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using System.IO; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Effects; using CalamityMod.Events; using CalamityMod.Items.Accessories; @@ -24,16 +26,15 @@ using CalamityMod.UI.VanillaBossBars; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; +using ReLogic.Content; using Terraria; +using Terraria.Audio; using Terraria.GameContent; using Terraria.GameContent.Bestiary; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Audio; using Terraria.GameContent.ItemDropRules; using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.NPCs.Cryogen { @@ -53,6 +54,12 @@ namespace CalamityMod.NPCs.Cryogen public static readonly SoundStyle ShieldRegenSound = new("CalamityMod/Sounds/Custom/CryogenShieldRegenerate"); public static readonly SoundStyle DeathSound = new("CalamityMod/Sounds/NPCKilled/CryogenDeath"); + public static Asset Phase2Texture; + public static Asset Phase3Texture; + public static Asset Phase4Texture; + public static Asset Phase5Texture; + public static Asset Phase6Texture; + public FireParticleSet FireDrawer = null; public static int cryoIconIndex; @@ -73,7 +80,15 @@ namespace CalamityMod.NPCs.Cryogen public override void SetStaticDefaults() { NPCID.Sets.BossBestiaryPriority.Add(Type); - NPCID.Sets.MPAllowedEnemies[Type] = true; + NPCID.Sets.MPAllowedEnemies[Type] = true; + if (!Main.dedServ) + { + Phase2Texture = ModContent.Request("CalamityMod/NPCs/Cryogen/Cryogen_Phase2", AssetRequestMode.AsyncLoad); + Phase3Texture = ModContent.Request("CalamityMod/NPCs/Cryogen/Cryogen_Phase3", AssetRequestMode.AsyncLoad); + Phase4Texture = ModContent.Request("CalamityMod/NPCs/Cryogen/Cryogen_Phase4", AssetRequestMode.AsyncLoad); + Phase5Texture = ModContent.Request("CalamityMod/NPCs/Cryogen/Cryogen_Phase5", AssetRequestMode.AsyncLoad); + Phase6Texture = ModContent.Request("CalamityMod/NPCs/Cryogen/Cryogen_Phase6", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -85,7 +100,7 @@ namespace CalamityMod.NPCs.Cryogen NPC.height = 88; NPC.defense = 15; NPC.DR_NERD(0.3f); - NPC.LifeMaxNERB(30000, 36000, 300000); + NPC.LifeMaxNERB(40000, 48000, 300000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); NPC.aiStyle = -1; @@ -127,10 +142,10 @@ namespace CalamityMod.NPCs.Cryogen public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Snow, - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Cryogen") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Cryogen") }); } @@ -212,7 +227,7 @@ namespace CalamityMod.NPCs.Cryogen bool phase7 = lifeRatio < (death ? 0.25f : 0.15f) && revenge; // Projectile and sound variables - int iceBlast = Main.zenithWorld ? ModContent.ProjectileType() : ModContent.ProjectileType(); + int iceBlast = Main.zenithWorld ? ModContent.ProjectileType() : ModContent.ProjectileType(); int iceBomb = Main.zenithWorld ? ModContent.ProjectileType() : ModContent.ProjectileType(); int iceRain = Main.zenithWorld ? ModContent.ProjectileType() : ModContent.ProjectileType(); int dustType = Main.zenithWorld ? 235 : 67; @@ -221,9 +236,6 @@ namespace CalamityMod.NPCs.Cryogen NPC.HitSound = Main.zenithWorld ? SoundID.NPCHit41 : HitSound; NPC.DeathSound = Main.zenithWorld ? SoundID.NPCDeath14 : DeathSound; - // Reset damage - NPC.damage = NPC.defDamage; - if ((int)NPC.ai[0] + 1 > currentPhase) HandlePhaseTransition((int)NPC.ai[0] + 1); @@ -360,6 +372,9 @@ namespace CalamityMod.NPCs.Cryogen if (NPC.ai[0] == 0f) { + // Avoid cheap bullshit + NPC.damage = 0; + NPC.rotation = NPC.velocity.X * 0.1f; NPC.localAI[0] += 1f; @@ -378,11 +393,15 @@ namespace CalamityMod.NPCs.Cryogen int type = iceBlast; int damage = NPC.GetProjectileDamage(type); float velocity = 9f + enrageScale; + float projectileVelocityToPass = 0f; + if (type == ModContent.ProjectileType()) + projectileVelocityToPass = velocity * 2f; + Vector2 spinningPoint = new Vector2(0f, -velocity); for (int k = 0; k < totalProjectiles; k++) { Vector2 projSpreadRotation = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(projSpreadRotation) * 30f, projSpreadRotation, type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(projSpreadRotation) * 30f, projSpreadRotation, type, damage, 0f, Main.myPlayer, 0f, 0f, projectileVelocityToPass); } } } @@ -417,6 +436,9 @@ namespace CalamityMod.NPCs.Cryogen } else if (NPC.ai[0] == 1f) { + // Avoid cheap bullshit + NPC.damage = 0; + if (NPC.ai[1] < chargePhaseGateValue) { NPC.ai[1] += 1f; @@ -439,11 +461,15 @@ namespace CalamityMod.NPCs.Cryogen int type = iceBlast; int damage = NPC.GetProjectileDamage(type); float velocity2 = 9f + enrageScale; + float projectileVelocityToPass = 0f; + if (type == ModContent.ProjectileType()) + projectileVelocityToPass = velocity2 * 2f; + Vector2 spinningPoint = new Vector2(0f, -velocity2); for (int k = 0; k < totalProjectiles; k++) { Vector2 projSpreadRotation = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(projSpreadRotation) * 30f, projSpreadRotation, type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(projSpreadRotation) * 30f, projSpreadRotation, type, damage, 0f, Main.myPlayer, 0f, 0f, projectileVelocityToPass); } } } @@ -520,6 +546,10 @@ namespace CalamityMod.NPCs.Cryogen { float radians = MathHelper.TwoPi / totalProjectilesShot; float newVelocity = velocity - (velocity * 0.5f * i); + float projectileVelocityToPass = 0f; + if (type == ModContent.ProjectileType()) + projectileVelocityToPass = velocity * 2f; + double angleA = radians * 0.5; double angleB = MathHelper.ToRadians(90f) - angleA; float velocityX = (float)(newVelocity * Math.Sin(angleA) / Math.Sin(angleB)); @@ -527,7 +557,7 @@ namespace CalamityMod.NPCs.Cryogen for (int k = 0; k < totalProjectilesShot; k++) { Vector2 projSpreadRotation = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(projSpreadRotation) * 30f, projSpreadRotation, type, damage, 0f, Main.myPlayer, 0f, velocity); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(projSpreadRotation) * 30f, projSpreadRotation, type, damage, 0f, Main.myPlayer, 0f, type == ModContent.ProjectileType() ? 0f : velocity, projectileVelocityToPass); } } } @@ -540,6 +570,9 @@ namespace CalamityMod.NPCs.Cryogen } else { + // Set damage + NPC.damage = NPC.defDamage; + if (NPC.ai[1] == chargeGateValue) { float chargeVelocity = Vector2.Distance(NPC.Center, player.Center) / chargeDuration * 2f; @@ -593,6 +626,9 @@ namespace CalamityMod.NPCs.Cryogen } else if (NPC.ai[0] == 2f) { + // Avoid cheap bullshit + NPC.damage = 0; + if (NPC.ai[1] < chargePhaseGateValue) { NPC.ai[1] += 1f; @@ -615,11 +651,15 @@ namespace CalamityMod.NPCs.Cryogen int type = iceBlast; int damage = NPC.GetProjectileDamage(type); float velocity = 9f + enrageScale; + float projectileVelocityToPass = 0f; + if (type == ModContent.ProjectileType()) + projectileVelocityToPass = velocity * 2f; + Vector2 spinningPoint = new Vector2(0f, -velocity); for (int k = 0; k < totalProjectiles; k++) { Vector2 projSpreadRotation = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(projSpreadRotation) * 30f, projSpreadRotation, type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(projSpreadRotation) * 30f, projSpreadRotation, type, damage, 0f, Main.myPlayer, 0f, 0f, projectileVelocityToPass); } } } @@ -668,6 +708,10 @@ namespace CalamityMod.NPCs.Cryogen { float radians = MathHelper.TwoPi / totalProjectilesShot; float newVelocity = velocity - (velocity * 0.33f * i); + float projectileVelocityToPass = 0f; + if (type == ModContent.ProjectileType()) + projectileVelocityToPass = velocity * 2f; + double angleA = radians * 0.5; double angleB = MathHelper.ToRadians(90f) - angleA; float velocityX = (float)(newVelocity * Math.Sin(angleA) / Math.Sin(angleB)); @@ -675,7 +719,7 @@ namespace CalamityMod.NPCs.Cryogen for (int k = 0; k < totalProjectilesShot; k++) { Vector2 projSpreadRotation = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(projSpreadRotation) * 30f, projSpreadRotation, type, damage, 0f, Main.myPlayer, 0f, velocity); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(projSpreadRotation) * 30f, projSpreadRotation, type, damage, 0f, Main.myPlayer, 0f, type == ModContent.ProjectileType() ? 0f : velocity, projectileVelocityToPass); } } } @@ -688,6 +732,9 @@ namespace CalamityMod.NPCs.Cryogen } else { + // Set damage + NPC.damage = NPC.defDamage; + if (NPC.ai[1] == chargeGateValue) { float chargeVelocity = Vector2.Distance(NPC.Center, player.Center) / chargeDuration * 2f; @@ -748,6 +795,9 @@ namespace CalamityMod.NPCs.Cryogen } else if (NPC.ai[0] == 3f) { + // Avoid cheap bullshit + NPC.damage = 0; + NPC.rotation = NPC.velocity.X * 0.1f; NPC.localAI[0] += 1f; @@ -765,11 +815,15 @@ namespace CalamityMod.NPCs.Cryogen int type = iceBlast; int damage = NPC.GetProjectileDamage(type); float velocity = 10f + enrageScale; + float projectileVelocityToPass = 0f; + if (type == ModContent.ProjectileType()) + projectileVelocityToPass = velocity * 2f; + Vector2 spinningPoint = new Vector2(0f, -velocity); for (int k = 0; k < totalProjectiles; k++) { Vector2 projSpreadRotation = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(projSpreadRotation) * 30f, projSpreadRotation, type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(projSpreadRotation) * 30f, projSpreadRotation, type, damage, 0f, Main.myPlayer, 0f, 0f, projectileVelocityToPass); } } } @@ -835,16 +889,13 @@ namespace CalamityMod.NPCs.Cryogen teleportLocationX = playerTileX; calamityGlobalNPC.newAI[2] = playerTileY; NPC.netUpdate = true; - Block: +Block: ; } } } else if (NPC.ai[1] == 1f) { - // Avoid cheap bullshit - NPC.damage = 0; - Vector2 position = new Vector2(teleportLocationX * 16f - (NPC.width / 2), calamityGlobalNPC.newAI[2] * 16f - (NPC.height / 2)); for (int m = 0; m < 5; m++) { @@ -879,6 +930,10 @@ namespace CalamityMod.NPCs.Cryogen int totalProjectiles = bossRush ? 9 : 6; float radians = MathHelper.TwoPi / totalProjectiles; float newVelocity = velocity - (velocity * 0.33f * i); + float projectileVelocityToPass = 0f; + if (type == ModContent.ProjectileType()) + projectileVelocityToPass = velocity * 2f; + float velocityX = 0f; if (i > 0) { @@ -890,7 +945,7 @@ namespace CalamityMod.NPCs.Cryogen for (int k = 0; k < totalProjectiles; k++) { Vector2 projSpreadRotation = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(projSpreadRotation) * 30f, projSpreadRotation, type, damage, 0f, Main.myPlayer, 0f, velocity); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(projSpreadRotation) * 30f, projSpreadRotation, type, damage, 0f, Main.myPlayer, 0f, type == ModContent.ProjectileType() ? 0f : velocity, projectileVelocityToPass); } } } @@ -902,9 +957,6 @@ namespace CalamityMod.NPCs.Cryogen } else if (NPC.ai[1] == 2f) { - // Avoid cheap bullshit - NPC.damage = 0; - NPC.Opacity += 0.2f; if (NPC.Opacity >= 1f) { @@ -918,7 +970,7 @@ namespace CalamityMod.NPCs.Cryogen { NPC.TargetClosest(); NPC.ai[0] = 4f; - NPC.ai[1] = 0f; + NPC.ai[1] = 150f; NPC.ai[3] = 0f; NPC.localAI[0] = 0f; NPC.localAI[2] = 0f; @@ -943,9 +995,12 @@ namespace CalamityMod.NPCs.Cryogen } else if (NPC.ai[0] == 4f) { + // Avoid cheap bullshit + NPC.damage = 0; + if (phase6) { - if (NPC.ai[1] == 60f) + if (NPC.ai[1] == 60f) // Spawn homing ice blasts on charge { NPC.velocity = Vector2.Normalize(player.Center - NPC.Center) * (18f + enrageScale * 2f); @@ -964,6 +1019,10 @@ namespace CalamityMod.NPCs.Cryogen int totalProjectiles = bossRush ? 3 : 2; float radians = MathHelper.TwoPi / totalProjectiles; float newVelocity = velocity - (velocity * (phase7 ? 0.25f : 0.5f) * i); + float projectileVelocityToPass = 0f; + if (type == ModContent.ProjectileType()) + projectileVelocityToPass = velocity * 12f; + float velocityX = 0f; float ai = Main.zenithWorld ? 2f : NPC.target; if (i > 0) @@ -976,7 +1035,7 @@ namespace CalamityMod.NPCs.Cryogen for (int k = 0; k < totalProjectiles; k++) { Vector2 projSpreadRotation = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(projSpreadRotation) * 30f, projSpreadRotation, type, damage, 0f, Main.myPlayer, ai, 1f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(projSpreadRotation) * 30f, projSpreadRotation, type, damage, 0f, Main.myPlayer, ai, type == ModContent.ProjectileType() ? 0f : 1f, projectileVelocityToPass); } } } @@ -984,7 +1043,7 @@ namespace CalamityMod.NPCs.Cryogen } NPC.ai[1] -= 1f; - if (NPC.ai[1] <= 0f) + if (NPC.ai[1] <= 0f) // Set the next charge, or switch back to floating above the player { NPC.ai[3] += 1f; NPC.TargetClosest(); @@ -1000,13 +1059,23 @@ namespace CalamityMod.NPCs.Cryogen NPC.rotation = NPC.velocity.X * 0.1f; } - else if (NPC.ai[1] <= 15f) + else if (NPC.ai[1] <= 15f) // Slow down in preparation for the next charge { NPC.velocity *= 0.95f; NPC.rotation = NPC.velocity.X * 0.15f; } - else + else if (NPC.ai[1] > 60f) // Only used for when phase 6 first starts to prevent insta-charges + { + NPC.velocity *= 0.98f; + NPC.rotation += (150f - NPC.ai[1]) * 0.01f * NPC.direction; + } + else // Charge + { + // Set damage + NPC.damage = NPC.defDamage; + NPC.rotation += NPC.direction * 0.5f; + } return; } @@ -1027,6 +1096,9 @@ namespace CalamityMod.NPCs.Cryogen if (playerDistance < chargeStartDistance || calamityGlobalNPC.newAI[2] > 0f) { + // Set damage + NPC.damage = NPC.defDamage; + if (playerDistance < chargeStartDistance) calamityGlobalNPC.newAI[2] = chargeCooldown; @@ -1062,6 +1134,9 @@ namespace CalamityMod.NPCs.Cryogen } else { + // Avoid cheap bullshit + NPC.damage = 0; + NPC.rotation = NPC.velocity.X * 0.1f; calamityGlobalNPC.newAI[3] += 1f; @@ -1207,8 +1282,29 @@ namespace CalamityMod.NPCs.Cryogen else FireDrawer = null; - string phase = "CalamityMod/NPCs/Cryogen/Cryogen_Phase" + currentPhase; - Texture2D texture = ModContent.Request(phase).Value; + + Texture2D texture = TextureAssets.Npc[NPC.type].Value; + switch (currentPhase) + { + case 2: + texture = Phase2Texture.Value; + break; + case 3: + texture = Phase3Texture.Value; + break; + case 4: + texture = Phase4Texture.Value; + break; + case 5: + texture = Phase5Texture.Value; + break; + case 6: + texture = Phase6Texture.Value; + break; + default: + texture = TextureAssets.Npc[NPC.type].Value; + break; + } SpriteEffects spriteEffects = SpriteEffects.None; if (NPC.spriteDirection == 1) @@ -1228,7 +1324,7 @@ namespace CalamityMod.NPCs.Cryogen public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { - NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } @@ -1251,7 +1347,7 @@ namespace CalamityMod.NPCs.Cryogen { for (int i = 0; i < 40; i++) { - int icyDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, dusttype, 0f, 0f, 100, default, 2f); + int icyDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, dusttype, 0f, 0f, 100, default, 2f); Main.dust[icyDust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -1261,10 +1357,10 @@ namespace CalamityMod.NPCs.Cryogen } for (int j = 0; j < 70; j++) { - int icyDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, dusttype, 0f, 0f, 100, default, 3f); + int icyDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, dusttype, 0f, 0f, 100, default, 3f); Main.dust[icyDust2].noGravity = true; Main.dust[icyDust2].velocity *= 5f; - icyDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, dusttype, 0f, 0f, 100, default, 2f); + icyDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, dusttype, 0f, 0f, 100, default, 2f); Main.dust[icyDust2].velocity *= 2f; } if (Main.netMode != NetmodeID.Server && !Main.zenithWorld) diff --git a/NPCs/Cryogen/CryogenShield.cs b/NPCs/Cryogen/CryogenShield.cs index 4c07fcb1a8..d16c2fbb85 100644 --- a/NPCs/Cryogen/CryogenShield.cs +++ b/NPCs/Cryogen/CryogenShield.cs @@ -25,7 +25,6 @@ namespace CalamityMod.NPCs.Cryogen NPC.Calamity().canBreakPlayerDefense = true; NPC.aiStyle = -1; AIType = -1; - NPC.canGhostHeal = false; NPC.noTileCollide = true; NPC.coldDamage = true; NPC.GetNPCDamage(); @@ -62,9 +61,14 @@ namespace CalamityMod.NPCs.Cryogen NPC.HitSound = Main.zenithWorld ? SoundID.NPCHit41 : Cryogen.HitSound; NPC.DeathSound = Main.zenithWorld ? SoundID.NPCDeath14 : BreakSound; - NPC.Opacity += 0.012f; - if (NPC.Opacity > 1f) + NPC.Opacity += 0.01f; + if (NPC.Opacity >= 1f) + { + NPC.damage = NPC.defDamage; NPC.Opacity = 1f; + } + else + NPC.damage = 0; NPC.rotation += 0.15f; @@ -82,6 +86,7 @@ namespace CalamityMod.NPCs.Cryogen NPC.position.Y = NPC.position.Y - (NPC.height / 2); return; } + NPC.life = 0; NPC.HitEffect(); NPC.active = false; @@ -107,7 +112,7 @@ namespace CalamityMod.NPCs.Cryogen if (hitboxBotRight < minDist) minDist = hitboxBotRight; - return minDist <= (100f * NPC.scale) && NPC.Opacity == 1f; + return minDist <= (100f * NPC.scale) && NPC.Opacity >= 1f; } public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) @@ -169,7 +174,7 @@ namespace CalamityMod.NPCs.Cryogen { for (int i = 0; i < 25; i++) { - int icyDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, dusttype, 0f, 0f, 100, default, 2f); + int icyDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, dusttype, 0f, 0f, 100, default, 2f); Main.dust[icyDust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -180,10 +185,10 @@ namespace CalamityMod.NPCs.Cryogen for (int j = 0; j < 50; j++) { - int icyDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, dusttype, 0f, 0f, 100, default, 3f); + int icyDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, dusttype, 0f, 0f, 100, default, 3f); Main.dust[icyDust2].noGravity = true; Main.dust[icyDust2].velocity *= 5f; - icyDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, dusttype, 0f, 0f, 100, default, 2f); + icyDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, dusttype, 0f, 0f, 100, default, 2f); Main.dust[icyDust2].velocity *= 2f; } diff --git a/NPCs/DesertScourge/DesertNuisanceBody.cs b/NPCs/DesertScourge/DesertNuisanceBody.cs index 0b2b291868..a37c59a5c8 100644 --- a/NPCs/DesertScourge/DesertNuisanceBody.cs +++ b/NPCs/DesertScourge/DesertNuisanceBody.cs @@ -1,6 +1,9 @@ -using CalamityMod.Events; +using System.IO; +using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.ID; using Terraria.Localization; @@ -11,22 +14,41 @@ namespace CalamityMod.NPCs.DesertScourge public class DesertNuisanceBody : ModNPC { public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.DesertNuisanceHead.DisplayName"); + + public static Asset BodyTexture2; + public static Asset BodyTexture3; + public static Asset BodyTexture4; + + private const int ClosedFinFrame = 5; + public override void SetStaticDefaults() { + Main.npcFrameCount[NPC.type] = 7; + this.HideFromBestiary(); + + if (!Main.dedServ) + { + BodyTexture2 = ModContent.Request(Texture + "2", AssetRequestMode.AsyncLoad); + BodyTexture3 = ModContent.Request(Texture + "3", AssetRequestMode.AsyncLoad); + BodyTexture4 = ModContent.Request(Texture + "4", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() { NPC.GetNPCDamage(); - NPC.width = 40; - NPC.height = 40; + NPC.width = 88; + NPC.height = 88; - NPC.defense = 4; + NPC.defense = 5; if (Main.getGoodWorld) - NPC.defense += 26; + NPC.defense += 27; + + NPC.LifeMaxNERB(1500, 1800, 40000); + if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + NPC.lifeMax = 4800; - NPC.lifeMax = BossRushEvent.BossRushActive ? 35000 : (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 2400 : 800; double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); NPC.aiStyle = -1; @@ -36,7 +58,6 @@ namespace CalamityMod.NPCs.DesertScourge NPC.behindTiles = true; NPC.noGravity = true; NPC.noTileCollide = true; - NPC.canGhostHeal = false; NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath1; NPC.netAlways = true; @@ -46,16 +67,100 @@ namespace CalamityMod.NPCs.DesertScourge NPC.Calamity().VulnerableToWater = true; } - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) => false; + + public override void SendExtraAI(BinaryWriter writer) { - return false; + // Frame syncs + writer.Write(NPC.frame.X); + writer.Write(NPC.frame.Y); + writer.Write(NPC.frame.Width); + writer.Write(NPC.frame.Height); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + // Frame syncs + Rectangle frame = new Rectangle(reader.ReadInt32(), reader.ReadInt32(), reader.ReadInt32(), reader.ReadInt32()); + if (frame.Width > 0 && frame.Height > 0) + NPC.frame = frame; } public override void AI() { + bool bossRush = BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || bossRush; + bool masterMode = Main.masterMode || bossRush; + + if (NPC.ai[3] > 0f) + { + switch ((int)NPC.ai[3]) + { + default: + break; + + case 10: + + NPC.ai[3] = 1f; + + NPC.position = NPC.Center; + //NPC.width = (int)(BodyTexture2.Width() * NPC.scale); + //NPC.height = (int)(BodyTexture2.Height() * NPC.scale); + NPC.position -= NPC.Size * 0.5f; + NPC.frame = new Rectangle(0, 0, BodyTexture2.Width(), BodyTexture2.Height()); + + NPC.netUpdate = true; + + // Prevent netUpdate from being blocked by the spam counter. + NPC.netSpam = 0; + + break; + + case 20: + + NPC.ai[3] = 2f; + + NPC.position = NPC.Center; + //NPC.width = (int)(BodyTexture3.Width() * NPC.scale); + //NPC.height = (int)(BodyTexture3.Height() * NPC.scale); + NPC.position -= NPC.Size * 0.5f; + NPC.frame = new Rectangle(0, 0, BodyTexture3.Width(), BodyTexture3.Height()); + + NPC.netUpdate = true; + + // Prevent netUpdate from being blocked by the spam counter. + NPC.netSpam = 0; + + break; + + case 30: + + NPC.ai[3] = 3f; + + NPC.position = NPC.Center; + //NPC.width = (int)(BodyTexture4.Width() * NPC.scale); + //NPC.height = (int)(BodyTexture4.Height() * NPC.scale); + NPC.position -= NPC.Size * 0.5f; + NPC.frame = new Rectangle(0, 0, BodyTexture4.Width(), BodyTexture4.Height()); + + NPC.netUpdate = true; + + // Prevent netUpdate from being blocked by the spam counter. + NPC.netSpam = 0; + + break; + } + } + if (NPC.ai[2] > 0f) NPC.realLife = (int)NPC.ai[2]; + if (NPC.life > Main.npc[(int)NPC.ai[1]].life) + NPC.life = Main.npc[(int)NPC.ai[1]].life; + + // Percent life remaining + float lifeRatio = NPC.life / (float)NPC.lifeMax; + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) NPC.TargetClosest(); @@ -93,67 +198,160 @@ namespace CalamityMod.NPCs.DesertScourge if (Main.player[NPC.target].dead) NPC.TargetClosest(false); - Vector2 segmentTilePos = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); - float playerXPos = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); - float playerYPos = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2); - playerXPos = (float)((int)(playerXPos / 16f) * 16); - playerYPos = (float)((int)(playerYPos / 16f) * 16); - segmentTilePos.X = (float)((int)(segmentTilePos.X / 16f) * 16); - segmentTilePos.Y = (float)((int)(segmentTilePos.Y / 16f) * 16); - playerXPos -= segmentTilePos.X; - playerYPos -= segmentTilePos.Y; - float playerDistance = (float)System.Math.Sqrt((double)(playerXPos * playerXPos + playerYPos * playerYPos)); - if (NPC.ai[1] > 0f && NPC.ai[1] < (float)Main.npc.Length) + NPC aheadSegment = Main.npc[(int)NPC.ai[1]]; + Vector2 directionToNextSegment = aheadSegment.Center - NPC.Center; + if (aheadSegment.rotation != NPC.rotation) { - try - { - segmentTilePos = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); - playerXPos = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - segmentTilePos.X; - playerYPos = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - segmentTilePos.Y; - } - catch - { - } - NPC.rotation = (float)System.Math.Atan2((double)playerYPos, (double)playerXPos) + 1.57f; - playerDistance = (float)System.Math.Sqrt((double)(playerXPos * playerXPos + playerYPos * playerYPos)); - playerDistance = (playerDistance - (float)(NPC.width)) / playerDistance; - playerXPos *= playerDistance; - playerYPos *= playerDistance; - NPC.velocity = Vector2.Zero; - NPC.position.X = NPC.position.X + playerXPos; - NPC.position.Y = NPC.position.Y + playerYPos; + directionToNextSegment = directionToNextSegment.RotatedBy(MathHelper.WrapAngle(aheadSegment.rotation - NPC.rotation) * 0.08f); + directionToNextSegment = directionToNextSegment.MoveTowards((aheadSegment.rotation - NPC.rotation).ToRotationVector2(), 1f); + } - if (playerXPos < 0f) - NPC.spriteDirection = 1; - else if (playerXPos > 0f) - NPC.spriteDirection = -1; + // Decide segment offset stuff. + int segmentOffset = 62; + NPC.rotation = directionToNextSegment.ToRotation() + MathHelper.PiOver2; + NPC.Center = aheadSegment.Center - directionToNextSegment.SafeNormalize(Vector2.Zero) * NPC.scale * segmentOffset; + NPC.spriteDirection = (directionToNextSegment.X > 0).ToDirectionInt(); + + // Calculate contact damage based on velocity + float maxChaseSpeed = Main.zenithWorld ? DesertNuisanceHead.SegmentVelocity_ZenithSeed : + Main.getGoodWorld ? DesertNuisanceHead.SegmentVelocity_GoodWorld : + masterMode ? DesertNuisanceHead.SegmentVelocity_Master : + DesertNuisanceHead.SegmentVelocity_Expert; + maxChaseSpeed += maxChaseSpeed * 0.2f * (1f - lifeRatio); + if (masterMode) + maxChaseSpeed += maxChaseSpeed * 0.2f * (1f - lifeRatio); + + float minimalContactDamageVelocity = maxChaseSpeed * 0.25f; + float minimalDamageVelocity = maxChaseSpeed * 0.5f; + float bodyAndTailVelocity = (NPC.position - NPC.oldPosition).Length(); + if (bodyAndTailVelocity <= minimalContactDamageVelocity) + { + NPC.damage = 0; + } + else + { + float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); + NPC.damage = (int)MathHelper.Lerp(0f, NPC.defDamage, velocityDamageScalar); } } - public override bool CheckActive() + public override bool CheckActive() => false; + + public override bool CanHitPlayer(Player target, ref int cooldownSlot) { - return false; + Rectangle targetHitbox = target.Hitbox; + + float hitboxTopLeft = Vector2.Distance(NPC.Center, targetHitbox.TopLeft()); + float hitboxTopRight = Vector2.Distance(NPC.Center, targetHitbox.TopRight()); + float hitboxBotLeft = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft()); + float hitboxBotRight = Vector2.Distance(NPC.Center, targetHitbox.BottomRight()); + + float minDist = hitboxTopLeft; + if (hitboxTopRight < minDist) + minDist = hitboxTopRight; + if (hitboxBotLeft < minDist) + minDist = hitboxBotLeft; + if (hitboxBotRight < minDist) + minDist = hitboxBotRight; + + float hitDistance = 30f; + switch ((int)NPC.ai[3]) + { + default: + case 1: + case 10: + hitDistance = 40f; + break; + + case 2: + case 20: + hitDistance = 40f; + break; + + case 3: + case 30: + hitDistance = 30f; + break; + } + + return minDist <= hitDistance * NPC.scale; + } + + public override void FindFrame(int frameHeight) + { + // Fin animation segment. + if (NPC.ai[3] == 0f) + { + // Close fins while head is in tiles. + NPC head = Main.npc[(int)NPC.ai[2]]; + Point headTileCenter = head.Center.ToTileCoordinates(); + Tile tileSafely = Framing.GetTileSafely(headTileCenter); + bool headInSolidTile = tileSafely.HasUnactuatedTile || tileSafely.LiquidAmount > 0; + if (headInSolidTile) + { + NPC.frameCounter += 1D; + if (NPC.frameCounter > 10D) + { + NPC.frame.Y += frameHeight; + NPC.frameCounter = 0D; + } + if (NPC.frame.Y >= frameHeight * ClosedFinFrame) + NPC.frame.Y = frameHeight * ClosedFinFrame; + } + + // Open fins while head is outside tiles. + else + { + if (NPC.frame.Y > 0) + { + NPC.frameCounter += 1D; + if (NPC.frameCounter > 10D) + { + NPC.frame.Y += frameHeight; + NPC.frameCounter = 0D; + } + if (NPC.frame.Y >= frameHeight * Main.npcFrameCount[NPC.type]) + NPC.frame.Y = 0; + } + } + } } public override void HitEffect(NPC.HitInfo hit) { for (int k = 0; k < 3; k++) - { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); - } + if (NPC.life <= 0) { if (Main.netMode != NetmodeID.Server) { - float randomSpread = Main.rand.Next(-200, 201) / 100f; - Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread * Main.rand.NextFloat(), Mod.Find("ScourgeBody").Type, 0.65f); - Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread * Main.rand.NextFloat(), Mod.Find("ScourgeBody2").Type, 0.65f); - Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread * Main.rand.NextFloat(), Mod.Find("ScourgeBody3").Type, 0.65f); + switch ((int)NPC.ai[3]) + { + default: + case 0: + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ScourgeNuisanceBody").Type, NPC.scale); + break; + + case 1: + case 10: + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ScourgeNuisanceBody2").Type, NPC.scale); + break; + + case 2: + case 20: + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ScourgeNuisanceBody3").Type, NPC.scale); + break; + + case 3: + case 30: + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ScourgeNuisanceBody4").Type, NPC.scale); + break; + } } + for (int k = 0; k < 10; k++) - { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); - } } } @@ -177,5 +375,45 @@ namespace CalamityMod.NPCs.DesertScourge } else return null; } + + public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + { + if (NPC.ai[3] > 0f) + { + SpriteEffects spriteEffects = SpriteEffects.None; + if (NPC.spriteDirection == 1) + spriteEffects = SpriteEffects.FlipHorizontally; + + Texture2D texture = default; + switch ((int)NPC.ai[3]) + { + default: + case 1: + case 10: + texture = BodyTexture2.Value; + break; + + case 2: + case 20: + texture = BodyTexture3.Value; + break; + + case 3: + case 30: + texture = BodyTexture4.Value; + break; + } + + Vector2 halfSizeTexture = new Vector2((float)(texture.Width / 2), (float)(texture.Height / 2)); + Vector2 drawLocation = NPC.Center - screenPos; + drawLocation -= new Vector2((float)texture.Width, (float)(texture.Height)) * NPC.scale / 2f; + drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); + + return false; + } + + return true; + } } } diff --git a/NPCs/DesertScourge/DesertNuisanceBody.png b/NPCs/DesertScourge/DesertNuisanceBody.png index b7580b7d2c..3dfa8bc944 100644 Binary files a/NPCs/DesertScourge/DesertNuisanceBody.png and b/NPCs/DesertScourge/DesertNuisanceBody.png differ diff --git a/NPCs/DesertScourge/DesertNuisanceBody2.png b/NPCs/DesertScourge/DesertNuisanceBody2.png new file mode 100644 index 0000000000..23a74780c3 Binary files /dev/null and b/NPCs/DesertScourge/DesertNuisanceBody2.png differ diff --git a/NPCs/DesertScourge/DesertNuisanceBody3.png b/NPCs/DesertScourge/DesertNuisanceBody3.png new file mode 100644 index 0000000000..579fd072b3 Binary files /dev/null and b/NPCs/DesertScourge/DesertNuisanceBody3.png differ diff --git a/NPCs/DesertScourge/DesertNuisanceBody4.png b/NPCs/DesertScourge/DesertNuisanceBody4.png new file mode 100644 index 0000000000..3fa7e642d5 Binary files /dev/null and b/NPCs/DesertScourge/DesertNuisanceBody4.png differ diff --git a/NPCs/DesertScourge/DesertNuisanceBodyYoung.cs b/NPCs/DesertScourge/DesertNuisanceBodyYoung.cs new file mode 100644 index 0000000000..86b3514232 --- /dev/null +++ b/NPCs/DesertScourge/DesertNuisanceBodyYoung.cs @@ -0,0 +1,419 @@ +using System.IO; +using CalamityMod.Events; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.DesertScourge +{ + public class DesertNuisanceBodyYoung : ModNPC + { + public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.DesertNuisanceHeadYoung.DisplayName"); + + public static Asset BodyTexture2; + public static Asset BodyTexture3; + public static Asset BodyTexture4; + + private const int ClosedFinFrame = 5; + + public override void SetStaticDefaults() + { + Main.npcFrameCount[NPC.type] = 7; + + this.HideFromBestiary(); + + if (!Main.dedServ) + { + BodyTexture2 = ModContent.Request(Texture + "2", AssetRequestMode.AsyncLoad); + BodyTexture3 = ModContent.Request(Texture + "3", AssetRequestMode.AsyncLoad); + BodyTexture4 = ModContent.Request(Texture + "4", AssetRequestMode.AsyncLoad); + } + } + + public override void SetDefaults() + { + NPC.GetNPCDamage(); + NPC.width = 78; + NPC.height = 78; + + NPC.defense = 4; + if (Main.getGoodWorld) + NPC.defense += 26; + + NPC.LifeMaxNERB(1300, 1560, 35000); + if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + NPC.lifeMax = 4000; + + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; + NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); + NPC.aiStyle = -1; + AIType = -1; + NPC.knockBackResist = 0f; + NPC.alpha = 255; + NPC.behindTiles = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.netAlways = true; + NPC.dontCountMe = true; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToWater = true; + } + + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) => false; + + public override void SendExtraAI(BinaryWriter writer) + { + // Frame syncs + writer.Write(NPC.frame.X); + writer.Write(NPC.frame.Y); + writer.Write(NPC.frame.Width); + writer.Write(NPC.frame.Height); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + // Frame syncs + Rectangle frame = new Rectangle(reader.ReadInt32(), reader.ReadInt32(), reader.ReadInt32(), reader.ReadInt32()); + if (frame.Width > 0 && frame.Height > 0) + NPC.frame = frame; + } + + public override void AI() + { + bool bossRush = BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || bossRush; + bool masterMode = Main.masterMode || bossRush; + + if (NPC.ai[3] > 0f) + { + switch ((int)NPC.ai[3]) + { + default: + break; + + case 10: + + NPC.ai[3] = 1f; + + NPC.position = NPC.Center; + //NPC.width = (int)(BodyTexture2.Width() * NPC.scale); + //NPC.height = (int)(BodyTexture2.Height() * NPC.scale); + NPC.position -= NPC.Size * 0.5f; + NPC.frame = new Rectangle(0, 0, BodyTexture2.Width(), BodyTexture2.Height()); + + NPC.netUpdate = true; + + // Prevent netUpdate from being blocked by the spam counter. + NPC.netSpam = 0; + + break; + + case 20: + + NPC.ai[3] = 2f; + + NPC.position = NPC.Center; + //NPC.width = (int)(BodyTexture3.Width() * NPC.scale); + //NPC.height = (int)(BodyTexture3.Height() * NPC.scale); + NPC.position -= NPC.Size * 0.5f; + NPC.frame = new Rectangle(0, 0, BodyTexture3.Width(), BodyTexture3.Height()); + + NPC.netUpdate = true; + + // Prevent netUpdate from being blocked by the spam counter. + NPC.netSpam = 0; + + break; + + case 30: + + NPC.ai[3] = 3f; + + NPC.position = NPC.Center; + //NPC.width = (int)(BodyTexture4.Width() * NPC.scale); + //NPC.height = (int)(BodyTexture4.Height() * NPC.scale); + NPC.position -= NPC.Size * 0.5f; + NPC.frame = new Rectangle(0, 0, BodyTexture4.Width(), BodyTexture4.Height()); + + NPC.netUpdate = true; + + // Prevent netUpdate from being blocked by the spam counter. + NPC.netSpam = 0; + + break; + } + } + + if (NPC.ai[2] > 0f) + NPC.realLife = (int)NPC.ai[2]; + + if (NPC.life > Main.npc[(int)NPC.ai[1]].life) + NPC.life = Main.npc[(int)NPC.ai[1]].life; + + // Percent life remaining + float lifeRatio = NPC.life / (float)NPC.lifeMax; + + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) + NPC.TargetClosest(); + + bool shouldDespawn = true; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active && Main.npc[i].type == ModContent.NPCType()) + { + shouldDespawn = false; + break; + } + } + if (!shouldDespawn) + { + if (NPC.ai[1] <= 0f) + shouldDespawn = true; + else if (Main.npc[(int)NPC.ai[1]].life <= 0) + shouldDespawn = true; + } + if (shouldDespawn) + { + NPC.life = 0; + NPC.HitEffect(0, 10.0); + NPC.checkDead(); + NPC.active = false; + } + + if (Main.npc[(int)NPC.ai[1]].alpha < 128) + { + NPC.alpha -= 42; + if (NPC.alpha < 0) + NPC.alpha = 0; + } + + if (Main.player[NPC.target].dead) + NPC.TargetClosest(false); + + NPC aheadSegment = Main.npc[(int)NPC.ai[1]]; + Vector2 directionToNextSegment = aheadSegment.Center - NPC.Center; + if (aheadSegment.rotation != NPC.rotation) + { + directionToNextSegment = directionToNextSegment.RotatedBy(MathHelper.WrapAngle(aheadSegment.rotation - NPC.rotation) * 0.08f); + directionToNextSegment = directionToNextSegment.MoveTowards((aheadSegment.rotation - NPC.rotation).ToRotationVector2(), 1f); + } + + // Decide segment offset stuff. + int segmentOffset = 50; + NPC.rotation = directionToNextSegment.ToRotation() + MathHelper.PiOver2; + NPC.Center = aheadSegment.Center - directionToNextSegment.SafeNormalize(Vector2.Zero) * NPC.scale * segmentOffset; + NPC.spriteDirection = (directionToNextSegment.X > 0).ToDirectionInt(); + + // Calculate contact damage based on velocity + float maxChaseSpeed = Main.zenithWorld ? DesertNuisanceHeadYoung.SegmentVelocity_ZenithSeed : + Main.getGoodWorld ? DesertNuisanceHeadYoung.SegmentVelocity_GoodWorld : + masterMode ? DesertNuisanceHeadYoung.SegmentVelocity_Master : + DesertNuisanceHeadYoung.SegmentVelocity_Expert; + maxChaseSpeed += maxChaseSpeed * 0.2f * (1f - lifeRatio); + if (masterMode) + maxChaseSpeed += maxChaseSpeed * 0.2f * (1f - lifeRatio); + + float minimalContactDamageVelocity = maxChaseSpeed * 0.25f; + float minimalDamageVelocity = maxChaseSpeed * 0.5f; + float bodyAndTailVelocity = (NPC.position - NPC.oldPosition).Length(); + if (bodyAndTailVelocity <= minimalContactDamageVelocity) + { + NPC.damage = 0; + } + else + { + float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); + NPC.damage = (int)MathHelper.Lerp(0f, NPC.defDamage, velocityDamageScalar); + } + } + + public override bool CheckActive() => false; + + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + Rectangle targetHitbox = target.Hitbox; + + float hitboxTopLeft = Vector2.Distance(NPC.Center, targetHitbox.TopLeft()); + float hitboxTopRight = Vector2.Distance(NPC.Center, targetHitbox.TopRight()); + float hitboxBotLeft = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft()); + float hitboxBotRight = Vector2.Distance(NPC.Center, targetHitbox.BottomRight()); + + float minDist = hitboxTopLeft; + if (hitboxTopRight < minDist) + minDist = hitboxTopRight; + if (hitboxBotLeft < minDist) + minDist = hitboxBotLeft; + if (hitboxBotRight < minDist) + minDist = hitboxBotRight; + + float hitDistance = 30f; + switch ((int)NPC.ai[3]) + { + default: + case 1: + case 10: + hitDistance = 35f; + break; + + case 2: + case 20: + hitDistance = 35f; + break; + + case 3: + case 30: + hitDistance = 30f; + break; + } + + return minDist <= hitDistance; + } + + public override void FindFrame(int frameHeight) + { + // Fin animation segment. + if (NPC.ai[3] == 0f) + { + // Close fins while head is in tiles. + NPC head = Main.npc[(int)NPC.ai[2]]; + Point headTileCenter = head.Center.ToTileCoordinates(); + Tile tileSafely = Framing.GetTileSafely(headTileCenter); + bool headInSolidTile = tileSafely.HasUnactuatedTile || tileSafely.LiquidAmount > 0; + if (headInSolidTile) + { + NPC.frameCounter += 1D; + if (NPC.frameCounter > 10D) + { + NPC.frame.Y += frameHeight; + NPC.frameCounter = 0D; + } + if (NPC.frame.Y >= frameHeight * ClosedFinFrame) + NPC.frame.Y = frameHeight * ClosedFinFrame; + } + + // Open fins while head is outside tiles. + else + { + if (NPC.frame.Y > 0) + { + NPC.frameCounter += 1D; + if (NPC.frameCounter > 10D) + { + NPC.frame.Y += frameHeight; + NPC.frameCounter = 0D; + } + if (NPC.frame.Y >= frameHeight * Main.npcFrameCount[NPC.type]) + NPC.frame.Y = 0; + } + } + } + } + + public override void HitEffect(NPC.HitInfo hit) + { + for (int k = 0; k < 3; k++) + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); + + if (NPC.life <= 0) + { + if (Main.netMode != NetmodeID.Server) + { + switch ((int)NPC.ai[3]) + { + default: + case 0: + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ScourgeNuisance2Body").Type, NPC.scale); + break; + + case 1: + case 10: + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ScourgeNuisance2Body2").Type, NPC.scale); + break; + + case 2: + case 20: + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ScourgeNuisance2Body3").Type, NPC.scale); + break; + + case 3: + case 30: + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ScourgeNuisance2Body4").Type, NPC.scale); + break; + } + } + + for (int k = 0; k < 10; k++) + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); + } + } + + public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) + { + NPC.lifeMax = (int)(NPC.lifeMax * 0.7f * balance); + } + + public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) + { + if (hurtInfo.Damage > 0) + target.AddBuff(BuffID.Bleeding, 60, true); + } + + public override Color? GetAlpha(Color drawColor) + { + if (Main.zenithWorld) + { + Color lightColor = Color.Orange * drawColor.A; + return lightColor * NPC.Opacity; + } + else return null; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + { + if (NPC.ai[3] > 0f) + { + SpriteEffects spriteEffects = SpriteEffects.None; + if (NPC.spriteDirection == 1) + spriteEffects = SpriteEffects.FlipHorizontally; + + Texture2D texture = default; + switch ((int)NPC.ai[3]) + { + default: + case 1: + case 10: + texture = BodyTexture2.Value; + break; + + case 2: + case 20: + texture = BodyTexture3.Value; + break; + + case 3: + case 30: + texture = BodyTexture4.Value; + break; + } + + Vector2 halfSizeTexture = new Vector2((float)(texture.Width / 2), (float)(texture.Height / 2)); + Vector2 drawLocation = NPC.Center - screenPos; + drawLocation -= new Vector2((float)texture.Width, (float)(texture.Height)) * NPC.scale / 2f; + drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); + + return false; + } + + return true; + } + } +} diff --git a/NPCs/DesertScourge/DesertNuisanceBodyYoung.png b/NPCs/DesertScourge/DesertNuisanceBodyYoung.png new file mode 100644 index 0000000000..bedd6a848b Binary files /dev/null and b/NPCs/DesertScourge/DesertNuisanceBodyYoung.png differ diff --git a/NPCs/DesertScourge/DesertNuisanceBodyYoung2.png b/NPCs/DesertScourge/DesertNuisanceBodyYoung2.png new file mode 100644 index 0000000000..bf6eab76b9 Binary files /dev/null and b/NPCs/DesertScourge/DesertNuisanceBodyYoung2.png differ diff --git a/NPCs/DesertScourge/DesertNuisanceBodyYoung3.png b/NPCs/DesertScourge/DesertNuisanceBodyYoung3.png new file mode 100644 index 0000000000..9784d12d7c Binary files /dev/null and b/NPCs/DesertScourge/DesertNuisanceBodyYoung3.png differ diff --git a/NPCs/DesertScourge/DesertNuisanceBodyYoung4.png b/NPCs/DesertScourge/DesertNuisanceBodyYoung4.png new file mode 100644 index 0000000000..37efe0070c Binary files /dev/null and b/NPCs/DesertScourge/DesertNuisanceBodyYoung4.png differ diff --git a/NPCs/DesertScourge/DesertNuisanceHead.cs b/NPCs/DesertScourge/DesertNuisanceHead.cs index 9c0732dded..b6cdd5e965 100644 --- a/NPCs/DesertScourge/DesertNuisanceHead.cs +++ b/NPCs/DesertScourge/DesertNuisanceHead.cs @@ -1,4 +1,5 @@ using System; +using System.IO; using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -13,27 +14,37 @@ namespace CalamityMod.NPCs.DesertScourge [AutoloadBossHead] public class DesertNuisanceHead : ModNPC { + private int biomeEnrageTimer = CalamityGlobalNPC.biomeEnrageTimerMax; + public bool flies = false; - public float speed = 0.085f; - public float turnSpeed = 0.125f; - public int maxLength = 13; - bool TailSpawned = false; + private bool tailSpawned = false; + + public const float SegmentVelocity_Expert = 14f; + public const float SegmentVelocity_Master = 16.5f; + public const float SegmentVelocity_GoodWorld = 19f; + public const float SegmentVelocity_ZenithSeed = 21.5f; + + public const float OpenMouthForBiteDistance = 220f; + + private const int OpenMouthStopFrame = 4; public override void SetStaticDefaults() { + Main.npcFrameCount[NPC.type] = 7; + NPCID.Sets.BossBestiaryPriority.Add(Type); - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { - Scale = 0.8f, - PortraitScale = 0.8f, + Scale = 0.6f, + PortraitScale = 0.6f, CustomTexturePath = "CalamityMod/ExtraTextures/Bestiary/DesertNuisance_Bestiary", PortraitPositionXOverride = 40, PortraitPositionYOverride = 40 }; - value.Position.X += 50; - value.Position.Y += 35; + value.Position.X += 45; + value.Position.Y += 30; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; - NPCID.Sets.MPAllowedEnemies[Type] = true; + NPCID.Sets.MPAllowedEnemies[Type] = true; } public override void SetDefaults() @@ -42,13 +53,17 @@ namespace CalamityMod.NPCs.DesertScourge NPC.Calamity().canBreakPlayerDefense = true; NPC.GetNPCDamage(); - NPC.defense = 2; + NPC.defense = 3; if (Main.getGoodWorld) - NPC.defense += 18; + NPC.defense += 19; + + NPC.width = 88; + NPC.height = 88; + + NPC.LifeMaxNERB(1500, 1800, 40000); + if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + NPC.lifeMax = 4800; - NPC.width = 60; - NPC.height = 60; - NPC.lifeMax = BossRushEvent.BossRushActive ? 35000 : (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 2400 : 800; double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); NPC.aiStyle = -1; @@ -69,20 +84,73 @@ namespace CalamityMod.NPCs.DesertScourge NPC.scale *= 2; } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(biomeEnrageTimer); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + biomeEnrageTimer = reader.ReadInt32(); + } + public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { int associatedNPCType = ModContent.NPCType(); bestiaryEntry.UIInfoProvider = new CommonEnemyUICollectionInfoProvider(ContentSamples.NpcBestiaryCreditIdsByNpcNetIds[associatedNPCType], quickUnlock: true); - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Desert, - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.DesertNuisance") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.DesertNuisance") }); } public override void 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; + + // Become angry when the other Nuisance dies. + bool getMad = (!NPC.AnyNPCs(ModContent.NPCType()) && revenge) || death; + + // Enrage + if (!Main.player[NPC.target].ZoneDesert && !bossRush) + { + if (biomeEnrageTimer > 0) + biomeEnrageTimer--; + } + else + biomeEnrageTimer = CalamityGlobalNPC.biomeEnrageTimerMax; + + bool biomeEnraged = biomeEnrageTimer <= 0 || bossRush; + + float enrageScale = bossRush ? 1f : getMad ? 0.5f : 0f; + if (biomeEnraged) + { + NPC.Calamity().CurrentlyEnraged = !bossRush; + enrageScale += 2f; + } + + // Percent life remaining. + float lifeRatio = NPC.life / (float)NPC.lifeMax; + + float speed = death ? 0.2f : 0.17f; + float turnSpeed = death ? 0.3f : 0.25f; + speed += speed * 0.4f * (1f - lifeRatio); + turnSpeed += turnSpeed * 0.4f * (1f - lifeRatio); + speed += 0.17f * enrageScale; + turnSpeed += 0.25f * enrageScale; + + if (Main.getGoodWorld) + { + speed *= 1.1f; + turnSpeed *= 1.2f; + } + if (NPC.ai[2] > 0f) NPC.realLife = (int)NPC.ai[2]; @@ -95,49 +163,62 @@ namespace CalamityMod.NPCs.DesertScourge if (Main.netMode != NetmodeID.MultiplayerClient) { - if (!TailSpawned) + if (!tailSpawned && NPC.ai[0] == 0f) { - NPC.ai[2] = (float)NPC.whoAmI; - NPC.realLife = NPC.whoAmI; - int num2 = NPC.whoAmI; - for (int j = 0; j <= maxLength; j++) + int previous = NPC.whoAmI; + int minLength = 8; + if (Main.getGoodWorld) + minLength *= 2; + + int bodyTypeAIVariable = 0; + for (int i = 0; i < minLength + 1; i++) { - int segmentType = ModContent.NPCType(); - if (j == maxLength) + int lol; + if (i >= 0 && i < minLength) { - segmentType = ModContent.NPCType(); + if (i == 0) + bodyTypeAIVariable = 0; + else if (i == minLength - 1) + bodyTypeAIVariable = 30; + else if (i % 2 == 0) + bodyTypeAIVariable = 20; + else + bodyTypeAIVariable = 10; + + lol = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType(), NPC.whoAmI); + Main.npc[lol].ai[3] = bodyTypeAIVariable; } - int segmentSpawn = NPC.NewNPC(NPC.GetSource_FromAI(), (int)(NPC.position.X + (float)(NPC.width / 2)), (int)(NPC.position.Y + (float)NPC.height), segmentType, NPC.whoAmI, 0f, 0f, 0f, 0f, 255); - Main.npc[segmentSpawn].ai[2] = (float)NPC.whoAmI; - Main.npc[segmentSpawn].realLife = NPC.whoAmI; - Main.npc[segmentSpawn].ai[1] = (float)num2; - Main.npc[num2].ai[0] = (float)segmentSpawn; - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, segmentSpawn, 0f, 0f, 0f, 0, 0, 0); - num2 = segmentSpawn; + else + lol = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType(), NPC.whoAmI); + + Main.npc[lol].ai[2] = NPC.whoAmI; + Main.npc[lol].realLife = NPC.whoAmI; + Main.npc[lol].ai[1] = previous; + Main.npc[previous].ai[0] = lol; + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, lol, 0f, 0f, 0f, 0); + previous = lol; } - TailSpawned = true; + + tailSpawned = true; } } + + if (NPC.life > Main.npc[(int)NPC.ai[0]].life) + NPC.life = Main.npc[(int)NPC.ai[0]].life; + int tilePositionX = (int)(NPC.position.X / 16f) - 1; int tileWidthPosX = (int)((NPC.position.X + (float)NPC.width) / 16f) + 2; int tilePositionY = (int)(NPC.position.Y / 16f) - 1; int tileWidthPosY = (int)((NPC.position.Y + (float)NPC.height) / 16f) + 2; if (tilePositionX < 0) - { tilePositionX = 0; - } if (tileWidthPosX > Main.maxTilesX) - { tileWidthPosX = Main.maxTilesX; - } if (tilePositionY < 0) - { tilePositionY = 0; - } if (tileWidthPosY > Main.maxTilesY) - { tileWidthPosY = Main.maxTilesY; - } + bool shouldFly = false; if (!shouldFly) { @@ -159,15 +240,16 @@ namespace CalamityMod.NPCs.DesertScourge } } } + if (!shouldFly) { NPC.localAI[1] = 1f; Rectangle rectangle = new Rectangle((int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height); - int directChaseDistance = 1000; + int directChaseDistance = revenge ? 500 : 1000; bool shouldDirectlyChase = true; if (NPC.position.Y > Main.player[NPC.target].position.Y) { - for (int m = 0; m < 255; m++) + for (int m = 0; m < Main.maxPlayers; m++) { if (Main.player[m].active) { @@ -179,48 +261,56 @@ namespace CalamityMod.NPCs.DesertScourge } } } + if (shouldDirectlyChase) - { shouldFly = true; - } } } else - { NPC.localAI[1] = 0f; - } - float maxChaseSpeed = 16f; + + if (NPC.velocity.X < 0f) + NPC.spriteDirection = 1; + else if (NPC.velocity.X > 0f) + NPC.spriteDirection = -1; + + float maxChaseSpeed = Main.zenithWorld ? SegmentVelocity_ZenithSeed : + Main.getGoodWorld ? SegmentVelocity_GoodWorld : + masterMode ? SegmentVelocity_Master : + SegmentVelocity_Expert; + maxChaseSpeed += maxChaseSpeed * 0.2f * (1f - lifeRatio); + if (masterMode) + maxChaseSpeed += maxChaseSpeed * 0.2f * (1f - lifeRatio); + if (Main.player[NPC.target].dead) { shouldFly = false; - NPC.velocity.Y = NPC.velocity.Y + 1f; - if ((double)NPC.position.Y > Main.worldSurface * 16.0) + NPC.velocity.Y += 1f; + if ((double)NPC.position.Y > Main.worldSurface * 16D) { - NPC.velocity.Y = NPC.velocity.Y + 1f; - maxChaseSpeed = 32f; + NPC.velocity.Y += 1f; + maxChaseSpeed *= 2f; } - if ((double)NPC.position.Y > Main.rockLayer * 16.0) + + if ((double)NPC.position.Y > Main.rockLayer * 16D) { for (int a = 0; a < Main.maxNPCs; a++) { - if (Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || - Main.npc[a].type == ModContent.NPCType()) - { + if (Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType()) Main.npc[a].active = false; - } } } } - float speedCopy = speed; - float turnSpeedCopy = turnSpeed; + if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) { - speedCopy *= 1.5f; - turnSpeedCopy *= 1.5f; + speed *= 1.5f; + turnSpeed *= 1.5f; } - Vector2 npcCenter = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); - float playerX = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); - float targettingPosition = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2); + + Vector2 npcCenter = NPC.Center; + float playerX = Main.player[NPC.target].Center.X; + float targettingPosition = Main.player[NPC.target].Center.Y; playerX = (float)((int)(playerX / 16f) * 16); targettingPosition = (float)((int)(targettingPosition / 16f) * 16); npcCenter.X = (float)((int)(npcCenter.X / 16f) * 16); @@ -228,46 +318,46 @@ namespace CalamityMod.NPCs.DesertScourge playerX -= npcCenter.X; targettingPosition -= npcCenter.Y; float targetDistance = (float)Math.Sqrt((double)(playerX * playerX + targettingPosition * targettingPosition)); + if (!shouldFly) { NPC.TargetClosest(); - NPC.velocity.Y = NPC.velocity.Y + 0.15f; + NPC.velocity.Y += 0.15f; if (NPC.velocity.Y > maxChaseSpeed) - { NPC.velocity.Y = maxChaseSpeed; - } - if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)maxChaseSpeed * 0.4) + + // This bool exists to stop the strange wiggle behavior when worms are falling down + bool slowXVelocity = Math.Abs(NPC.velocity.X) > speed; + if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < maxChaseSpeed * 0.4) { if (NPC.velocity.X < 0f) - { - NPC.velocity.X = NPC.velocity.X - speedCopy * 1.1f; - } + NPC.velocity.X -= speed * 1.1f; else - { - NPC.velocity.X = NPC.velocity.X + speedCopy * 1.1f; - } + NPC.velocity.X += speed * 1.1f; } else if (NPC.velocity.Y == maxChaseSpeed) { - if (NPC.velocity.X < playerX) + if (slowXVelocity) { - NPC.velocity.X = NPC.velocity.X + speedCopy; - } - else if (NPC.velocity.X > playerX) - { - NPC.velocity.X = NPC.velocity.X - speedCopy; + if (NPC.velocity.X < playerX) + NPC.velocity.X += speed; + else if (NPC.velocity.X > playerX) + NPC.velocity.X -= speed; } + else + NPC.velocity.X = 0f; } else if (NPC.velocity.Y > 4f) { - if (NPC.velocity.X < 0f) + if (slowXVelocity) { - NPC.velocity.X = NPC.velocity.X + speedCopy * 0.9f; + if (NPC.velocity.X < 0f) + NPC.velocity.X += speed * 0.9f; + else + NPC.velocity.X -= speed * 0.9f; } else - { - NPC.velocity.X = NPC.velocity.X - speedCopy * 0.9f; - } + NPC.velocity.X = 0f; } } else @@ -276,174 +366,239 @@ namespace CalamityMod.NPCs.DesertScourge { float soundDelay = targetDistance / 40f; if (soundDelay < 10f) - { soundDelay = 10f; - } if (soundDelay > 20f) - { soundDelay = 20f; - } + NPC.soundDelay = (int)soundDelay; SoundEngine.PlaySound(SoundID.WormDig, NPC.Center); } + targetDistance = (float)Math.Sqrt((double)(playerX * playerX + targettingPosition * targettingPosition)); float absolutePlayerX = Math.Abs(playerX); float absoluteTargetPos = Math.Abs(targettingPosition); float timeToReachTarget = maxChaseSpeed / targetDistance; playerX *= timeToReachTarget; targettingPosition *= timeToReachTarget; + if (((NPC.velocity.X > 0f && playerX > 0f) || (NPC.velocity.X < 0f && playerX < 0f)) && ((NPC.velocity.Y > 0f && targettingPosition > 0f) || (NPC.velocity.Y < 0f && targettingPosition < 0f))) { if (NPC.velocity.X < playerX) - { - NPC.velocity.X = NPC.velocity.X + turnSpeedCopy; - } + NPC.velocity.X += turnSpeed; else if (NPC.velocity.X > playerX) - { - NPC.velocity.X = NPC.velocity.X - turnSpeedCopy; - } + NPC.velocity.X -= turnSpeed; + if (NPC.velocity.Y < targettingPosition) - { - NPC.velocity.Y = NPC.velocity.Y + turnSpeedCopy; - } + NPC.velocity.Y += turnSpeed; else if (NPC.velocity.Y > targettingPosition) - { - NPC.velocity.Y = NPC.velocity.Y - turnSpeedCopy; - } + NPC.velocity.Y -= turnSpeed; } + if ((NPC.velocity.X > 0f && playerX > 0f) || (NPC.velocity.X < 0f && playerX < 0f) || (NPC.velocity.Y > 0f && targettingPosition > 0f) || (NPC.velocity.Y < 0f && targettingPosition < 0f)) { if (NPC.velocity.X < playerX) - { - NPC.velocity.X = NPC.velocity.X + speedCopy; - } + NPC.velocity.X += speed; else if (NPC.velocity.X > playerX) - { - NPC.velocity.X = NPC.velocity.X - speedCopy; - } + NPC.velocity.X -= speed; + if (NPC.velocity.Y < targettingPosition) - { - NPC.velocity.Y = NPC.velocity.Y + speedCopy; - } + NPC.velocity.Y += speed; else if (NPC.velocity.Y > targettingPosition) - { - NPC.velocity.Y = NPC.velocity.Y - speedCopy; - } - if ((double)Math.Abs(targettingPosition) < (double)maxChaseSpeed * 0.2 && ((NPC.velocity.X > 0f && playerX < 0f) || (NPC.velocity.X < 0f && playerX > 0f))) + NPC.velocity.Y -= speed; + + if ((double)Math.Abs(targettingPosition) < maxChaseSpeed * 0.2 && ((NPC.velocity.X > 0f && playerX < 0f) || (NPC.velocity.X < 0f && playerX > 0f))) { if (NPC.velocity.Y > 0f) - { - NPC.velocity.Y = NPC.velocity.Y + speedCopy * 2f; - } + NPC.velocity.Y += speed * 2f; else - { - NPC.velocity.Y = NPC.velocity.Y - speedCopy * 2f; - } + NPC.velocity.Y -= speed * 2f; } - if ((double)Math.Abs(playerX) < (double)maxChaseSpeed * 0.2 && ((NPC.velocity.Y > 0f && targettingPosition < 0f) || (NPC.velocity.Y < 0f && targettingPosition > 0f))) + + if ((double)Math.Abs(playerX) < maxChaseSpeed * 0.2 && ((NPC.velocity.Y > 0f && targettingPosition < 0f) || (NPC.velocity.Y < 0f && targettingPosition > 0f))) { if (NPC.velocity.X > 0f) - { - NPC.velocity.X = NPC.velocity.X + speedCopy * 2f; - } + NPC.velocity.X += speed * 2f; else - { - NPC.velocity.X = NPC.velocity.X - speedCopy * 2f; - } + NPC.velocity.X -= speed * 2f; } } else if (absolutePlayerX > absoluteTargetPos) { if (NPC.velocity.X < playerX) - { - NPC.velocity.X = NPC.velocity.X + speedCopy * 1.1f; - } + NPC.velocity.X += speed * 1.1f; else if (NPC.velocity.X > playerX) - { - NPC.velocity.X = NPC.velocity.X - speedCopy * 1.1f; - } - if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)maxChaseSpeed * 0.5) + NPC.velocity.X -= speed * 1.1f; + + if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < maxChaseSpeed * 0.5) { if (NPC.velocity.Y > 0f) - { - NPC.velocity.Y = NPC.velocity.Y + speedCopy; - } + NPC.velocity.Y += speed; else - { - NPC.velocity.Y = NPC.velocity.Y - speedCopy; - } + NPC.velocity.Y -= speed; } } else { if (NPC.velocity.Y < targettingPosition) - { - NPC.velocity.Y = NPC.velocity.Y + speedCopy * 1.1f; - } + NPC.velocity.Y += speed * 1.1f; else if (NPC.velocity.Y > targettingPosition) - { - NPC.velocity.Y = NPC.velocity.Y - speedCopy * 1.1f; - } - if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)maxChaseSpeed * 0.5) + NPC.velocity.Y -= speed * 1.1f; + + if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < maxChaseSpeed * 0.5) { if (NPC.velocity.X > 0f) - { - NPC.velocity.X = NPC.velocity.X + speedCopy; - } + NPC.velocity.X += speed; else - { - NPC.velocity.X = NPC.velocity.X - speedCopy; - } + NPC.velocity.X -= speed; } } } - NPC.rotation = (float)Math.Atan2((double)NPC.velocity.Y, (double)NPC.velocity.X) + 1.57f; + + Vector2 destination = Main.player[NPC.target].Center; + if (NPC.Distance(destination) > 1000f) + NPC.velocity += (destination - NPC.Center).SafeNormalize(Vector2.UnitY) * turnSpeed; + + // Calculate contact damage based on velocity + float minimalContactDamageVelocity = maxChaseSpeed * 0.25f; + float minimalDamageVelocity = maxChaseSpeed * 0.5f; + if (NPC.velocity.Length() <= minimalContactDamageVelocity) + { + NPC.damage = (int)Math.Round(NPC.defDamage * 0.5); + } + else + { + float velocityDamageScalar = MathHelper.Clamp((NPC.velocity.Length() - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); + NPC.damage = (int)MathHelper.Lerp((float)Math.Round(NPC.defDamage * 0.5), NPC.defDamage, velocityDamageScalar); + } + + NPC.rotation = (float)Math.Atan2((double)NPC.velocity.Y, (double)NPC.velocity.X) + MathHelper.PiOver2; + if (shouldFly) { if (NPC.localAI[0] != 1f) - { NPC.netUpdate = true; - } + NPC.localAI[0] = 1f; } else { if (NPC.localAI[0] != 0f) - { NPC.netUpdate = true; - } + NPC.localAI[0] = 0f; } + if (((NPC.velocity.X > 0f && NPC.oldVelocity.X < 0f) || (NPC.velocity.X < 0f && NPC.oldVelocity.X > 0f) || (NPC.velocity.Y > 0f && NPC.oldVelocity.Y < 0f) || (NPC.velocity.Y < 0f && NPC.oldVelocity.Y > 0f)) && !NPC.justHit) - { NPC.netUpdate = true; - } + } + + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + Rectangle targetHitbox = target.Hitbox; + + float hitboxTopLeft = Vector2.Distance(NPC.Center, targetHitbox.TopLeft()); + float hitboxTopRight = Vector2.Distance(NPC.Center, targetHitbox.TopRight()); + float hitboxBotLeft = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft()); + float hitboxBotRight = Vector2.Distance(NPC.Center, targetHitbox.BottomRight()); + + float minDist = hitboxTopLeft; + if (hitboxTopRight < minDist) + minDist = hitboxTopRight; + if (hitboxBotLeft < minDist) + minDist = hitboxBotLeft; + if (hitboxBotRight < minDist) + minDist = hitboxBotRight; + + return minDist <= 50f * NPC.scale; } public override void HitEffect(NPC.HitInfo hit) { for (int k = 0; k < 3; k++) - { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); - } + if (NPC.life <= 0) { if (Main.netMode != NetmodeID.Server) - { - Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ScourgeHead").Type, 0.65f); - Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ScourgeHead2").Type, 0.65f); - } + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ScourgeNuisanceHead").Type, NPC.scale); + for (int k = 0; k < 10; k++) - { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); - } } } public override void FindFrame(int frameHeight) { - if (NPC.IsABestiaryIconDummy) - NPC.Opacity = 1f; + // Open mouth to prepare for a nibble ;3 + bool openMouth = NPC.Distance(Main.player[NPC.target].Center) < OpenMouthForBiteDistance && + (Main.player[NPC.target].Center - NPC.Center).SafeNormalize(Vector2.UnitY).ToRotation().AngleTowards(NPC.velocity.ToRotation(), MathHelper.PiOver4) == NPC.velocity.ToRotation() && + NPC.ai[3] == 0f; + + bool closeMouthBite = NPC.ai[3] == 1f; + if (closeMouthBite) + { + // Force mouth open for a bite if it's not open. + if (NPC.frame.Y < frameHeight * OpenMouthStopFrame) + { + NPC.frame.Y = frameHeight * OpenMouthStopFrame; + NPC.frameCounter = 0D; + } + + NPC.frameCounter += 1D; + if (NPC.frameCounter > 4D) + { + NPC.frame.Y += frameHeight; + NPC.frameCounter = 0D; + } + if (NPC.frame.Y >= frameHeight * Main.npcFrameCount[NPC.type]) + { + NPC.ai[3] = 2f; + NPC.netUpdate = true; + NPC.netSpam = 0; + NPC.frame.Y = 0; + } + } + else if (openMouth) + { + NPC.frameCounter += 1D; + if (NPC.frameCounter > 4D) + { + NPC.frame.Y += frameHeight; + NPC.frameCounter = 0D; + } + if (NPC.frame.Y >= frameHeight * OpenMouthStopFrame) + NPC.frame.Y = frameHeight * OpenMouthStopFrame; + } + + // Close mouth. + else + { + if (NPC.frame.Y > 0) + { + if (NPC.frame.Y >= frameHeight * Main.npcFrameCount[NPC.type]) + { + NPC.frame.Y = 0; + NPC.ai[3] = 0f; + NPC.netUpdate = true; + NPC.netSpam = 0; + } + else + { + NPC.frameCounter += 1D; + if (NPC.frameCounter > 4D) + { + NPC.frame.Y -= frameHeight; + NPC.frameCounter = 0D; + } + } + } + else + { + NPC.ai[3] = 0f; + NPC.netUpdate = true; + NPC.netSpam = 0; + } + } } public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) @@ -454,7 +609,12 @@ namespace CalamityMod.NPCs.DesertScourge public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) { if (hurtInfo.Damage > 0) - target.AddBuff(BuffID.Bleeding, 180, true); + { + target.AddBuff(BuffID.Bleeding, 180); + NPC.ai[3] = 1f; + NPC.netUpdate = true; + NPC.netSpam = 0; + } } public override Color? GetAlpha(Color drawColor) diff --git a/NPCs/DesertScourge/DesertNuisanceHead.png b/NPCs/DesertScourge/DesertNuisanceHead.png index b3a6450990..970cdae85e 100644 Binary files a/NPCs/DesertScourge/DesertNuisanceHead.png and b/NPCs/DesertScourge/DesertNuisanceHead.png differ diff --git a/NPCs/DesertScourge/DesertNuisanceHeadYoung.cs b/NPCs/DesertScourge/DesertNuisanceHeadYoung.cs new file mode 100644 index 0000000000..9a3e19a915 --- /dev/null +++ b/NPCs/DesertScourge/DesertNuisanceHeadYoung.cs @@ -0,0 +1,672 @@ +using System; +using System.IO; +using CalamityMod.Dusts; +using CalamityMod.Events; +using CalamityMod.Projectiles.Boss; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.GameContent.Bestiary; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.DesertScourge +{ + [AutoloadBossHead] + public class DesertNuisanceHeadYoung : ModNPC + { + private int biomeEnrageTimer = CalamityGlobalNPC.biomeEnrageTimerMax; + + public bool flies = false; + private bool tailSpawned = false; + + public const float SegmentVelocity_Expert = 12f; + public const float SegmentVelocity_Master = 14f; + public const float SegmentVelocity_GoodWorld = 16f; + public const float SegmentVelocity_ZenithSeed = 18f; + + public const float SpitGateValue = 180f; + + public const float OpenMouthForBiteDistance = 220f; + + private const int OpenMouthStopFrame = 4; + + public override void SetStaticDefaults() + { + Main.npcFrameCount[NPC.type] = 7; + this.HideFromBestiary(); + NPCID.Sets.MPAllowedEnemies[Type] = true; + } + + public override void SetDefaults() + { + NPC.BossBar = Main.BigBossProgressBar.NeverValid; + NPC.Calamity().canBreakPlayerDefense = true; + NPC.GetNPCDamage(); + + NPC.defense = 2; + if (Main.getGoodWorld) + NPC.defense += 18; + + NPC.width = 78; + NPC.height = 78; + + NPC.LifeMaxNERB(1300, 1560, 35000); + if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + NPC.lifeMax = 4000; + + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; + NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); + NPC.aiStyle = -1; + AIType = -1; + NPC.knockBackResist = 0f; + NPC.Opacity = 0f; + NPC.behindTiles = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.netAlways = true; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToWater = true; + + if (Main.zenithWorld) + NPC.scale *= 2; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(biomeEnrageTimer); + for (int i = 0; i < 4; i++) + writer.Write(NPC.Calamity().newAI[i]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + biomeEnrageTimer = reader.ReadInt32(); + for (int i = 0; i < 4; i++) + NPC.Calamity().newAI[i] = reader.ReadSingle(); + } + + public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) + { + int associatedNPCType = ModContent.NPCType(); + bestiaryEntry.UIInfoProvider = new CommonEnemyUICollectionInfoProvider(ContentSamples.NpcBestiaryCreditIdsByNpcNetIds[associatedNPCType], quickUnlock: true); + + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + { + BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Desert, + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.DesertNuisance") + }); + } + + public override void 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; + + // Become angry when the other Nuisance dies. + bool getMad = (!NPC.AnyNPCs(ModContent.NPCType()) && revenge) || death; + + // Enrage + if (!Main.player[NPC.target].ZoneDesert && !bossRush) + { + if (biomeEnrageTimer > 0) + biomeEnrageTimer--; + } + else + biomeEnrageTimer = CalamityGlobalNPC.biomeEnrageTimerMax; + + bool biomeEnraged = biomeEnrageTimer <= 0 || bossRush; + + float enrageScale = bossRush ? 1f : getMad ? 0.25f : 0f; + if (biomeEnraged) + { + NPC.Calamity().CurrentlyEnraged = !bossRush; + enrageScale += 2f; + } + + // Percent life remaining. + float lifeRatio = NPC.life / (float)NPC.lifeMax; + + float speed = death ? 0.22f : 0.19f; + float turnSpeed = death ? 0.32f : 0.27f; + speed += speed * 0.4f * (1f - lifeRatio); + turnSpeed += turnSpeed * 0.4f * (1f - lifeRatio); + speed += 0.19f * enrageScale; + turnSpeed += 0.27f * enrageScale; + + if (Main.getGoodWorld) + { + speed *= 1.1f; + turnSpeed *= 1.2f; + } + + if (NPC.ai[2] > 0f) + NPC.realLife = (int)NPC.ai[2]; + + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) + NPC.TargetClosest(); + + NPC.alpha -= 42; + if (NPC.alpha < 0) + NPC.alpha = 0; + + if (getMad && NPC.Distance(Main.player[NPC.target].Center) > 240f) + { + if ((Main.player[NPC.target].Center - NPC.Center).SafeNormalize(Vector2.UnitY).ToRotation().AngleTowards(NPC.velocity.ToRotation(), MathHelper.PiOver4) == NPC.velocity.ToRotation()) + NPC.Calamity().newAI[0] += 1f; + + if (NPC.Calamity().newAI[0] >= SpitGateValue) + { + NPC.Calamity().newAI[0] = 0f; + SoundEngine.PlaySound(SoundID.NPCDeath11, NPC.Center); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Vector2 projectileVelocity = (Main.player[NPC.target].Center - NPC.Center).SafeNormalize(Vector2.UnitY) * (revenge ? 10f : 8f); + int numProj = death ? 6 : 4; + int spread = masterMode ? 28 : 20; + if (masterMode) + { + numProj += 2; + spread += 8; + } + + float rotation = MathHelper.ToRadians(spread); + int type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + for (int i = 0; i < numProj; i++) + { + Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); + + for (int k = 0; k < 10; k++) + { + int dust = Dust.NewDust(NPC.Center + Vector2.Normalize(perturbedSpeed) * 5f, 10, 10, (int)CalamityDusts.SulphurousSeaAcid); + Main.dust[dust].velocity = perturbedSpeed; + } + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 5f, perturbedSpeed, type, damage, 0f, Main.myPlayer); + Main.projectile[proj].aiStyle = -1; + Main.projectile[proj].netUpdate = true; + } + } + } + } + } + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (!tailSpawned && NPC.ai[0] == 0f) + { + int previous = NPC.whoAmI; + int minLength = 8; + if (Main.getGoodWorld) + minLength *= 2; + + int bodyTypeAIVariable = 0; + for (int i = 0; i < minLength + 1; i++) + { + int lol; + if (i >= 0 && i < minLength) + { + if (i == 0) + bodyTypeAIVariable = 0; + else if (i == minLength - 1) + bodyTypeAIVariable = 30; + else if (i % 2 == 0) + bodyTypeAIVariable = 20; + else + bodyTypeAIVariable = 10; + + lol = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType(), NPC.whoAmI); + Main.npc[lol].ai[3] = bodyTypeAIVariable; + } + else + lol = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType(), NPC.whoAmI); + + Main.npc[lol].ai[2] = NPC.whoAmI; + Main.npc[lol].realLife = NPC.whoAmI; + Main.npc[lol].ai[1] = previous; + Main.npc[previous].ai[0] = lol; + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, lol, 0f, 0f, 0f, 0); + previous = lol; + } + + tailSpawned = true; + } + } + + if (NPC.life > Main.npc[(int)NPC.ai[0]].life) + NPC.life = Main.npc[(int)NPC.ai[0]].life; + + int tilePositionX = (int)(NPC.position.X / 16f) - 1; + int tileWidthPosX = (int)((NPC.position.X + (float)NPC.width) / 16f) + 2; + int tilePositionY = (int)(NPC.position.Y / 16f) - 1; + int tileWidthPosY = (int)((NPC.position.Y + (float)NPC.height) / 16f) + 2; + if (tilePositionX < 0) + tilePositionX = 0; + if (tileWidthPosX > Main.maxTilesX) + tileWidthPosX = Main.maxTilesX; + if (tilePositionY < 0) + tilePositionY = 0; + if (tileWidthPosY > Main.maxTilesY) + tileWidthPosY = Main.maxTilesY; + + bool shouldFly = false; + if (!shouldFly) + { + for (int k = tilePositionX; k < tileWidthPosX; k++) + { + for (int l = tilePositionY; l < tileWidthPosY; l++) + { + if (Main.tile[k, l] != null && ((Main.tile[k, l].HasUnactuatedTile && (Main.tileSolid[(int)Main.tile[k, l].TileType] || (Main.tileSolidTop[(int)Main.tile[k, l].TileType] && Main.tile[k, l].TileFrameY == 0))) || Main.tile[k, l].LiquidAmount > 64)) + { + Vector2 vector2; + vector2.X = (float)(k * 16); + vector2.Y = (float)(l * 16); + if (NPC.position.X + (float)NPC.width > vector2.X && NPC.position.X < vector2.X + 16f && NPC.position.Y + (float)NPC.height > vector2.Y && NPC.position.Y < vector2.Y + 16f) + { + shouldFly = true; + break; + } + } + } + } + } + + if (!shouldFly) + { + NPC.localAI[1] = 1f; + Rectangle rectangle = new Rectangle((int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height); + int directChaseDistance = revenge ? 500 : 1000; + bool shouldDirectlyChase = true; + if (NPC.position.Y > Main.player[NPC.target].position.Y) + { + for (int m = 0; m < Main.maxPlayers; m++) + { + if (Main.player[m].active) + { + Rectangle rectangle2 = new Rectangle((int)Main.player[m].position.X - directChaseDistance, (int)Main.player[m].position.Y - directChaseDistance, directChaseDistance * 2, directChaseDistance * 2); + if (rectangle.Intersects(rectangle2)) + { + shouldDirectlyChase = false; + break; + } + } + } + + if (shouldDirectlyChase) + shouldFly = true; + } + } + else + NPC.localAI[1] = 0f; + + if (NPC.velocity.X < 0f) + NPC.spriteDirection = 1; + else if (NPC.velocity.X > 0f) + NPC.spriteDirection = -1; + + float maxChaseSpeed = Main.zenithWorld ? SegmentVelocity_ZenithSeed : + Main.getGoodWorld ? SegmentVelocity_GoodWorld : + masterMode ? SegmentVelocity_Master : + SegmentVelocity_Expert; + maxChaseSpeed += maxChaseSpeed * 0.2f * (1f - lifeRatio); + if (masterMode) + maxChaseSpeed += maxChaseSpeed * 0.2f * (1f - lifeRatio); + + if (Main.player[NPC.target].dead) + { + shouldFly = false; + NPC.velocity.Y += 1f; + if ((double)NPC.position.Y > Main.worldSurface * 16D) + { + NPC.velocity.Y += 1f; + maxChaseSpeed *= 2f; + } + + if ((double)NPC.position.Y > Main.rockLayer * 16D) + { + for (int a = 0; a < Main.maxNPCs; a++) + { + if (Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType()) + Main.npc[a].active = false; + } + } + } + + if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + { + speed *= 1.5f; + turnSpeed *= 1.5f; + } + + Vector2 npcCenter = NPC.Center; + float playerX = Main.player[NPC.target].Center.X; + float targettingPosition = Main.player[NPC.target].Center.Y; + playerX = (float)((int)(playerX / 16f) * 16); + targettingPosition = (float)((int)(targettingPosition / 16f) * 16); + npcCenter.X = (float)((int)(npcCenter.X / 16f) * 16); + npcCenter.Y = (float)((int)(npcCenter.Y / 16f) * 16); + playerX -= npcCenter.X; + targettingPosition -= npcCenter.Y; + float targetDistance = (float)Math.Sqrt((double)(playerX * playerX + targettingPosition * targettingPosition)); + + if (!shouldFly) + { + NPC.TargetClosest(); + NPC.velocity.Y += 0.15f; + if (NPC.velocity.Y > maxChaseSpeed) + NPC.velocity.Y = maxChaseSpeed; + + // This bool exists to stop the strange wiggle behavior when worms are falling down + bool slowXVelocity = Math.Abs(NPC.velocity.X) > speed; + if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < maxChaseSpeed * 0.4) + { + if (NPC.velocity.X < 0f) + NPC.velocity.X -= speed * 1.1f; + else + NPC.velocity.X += speed * 1.1f; + } + else if (NPC.velocity.Y == maxChaseSpeed) + { + if (slowXVelocity) + { + if (NPC.velocity.X < playerX) + NPC.velocity.X += speed; + else if (NPC.velocity.X > playerX) + NPC.velocity.X -= speed; + } + else + NPC.velocity.X = 0f; + } + else if (NPC.velocity.Y > 4f) + { + if (slowXVelocity) + { + if (NPC.velocity.X < 0f) + NPC.velocity.X += speed * 0.9f; + else + NPC.velocity.X -= speed * 0.9f; + } + else + NPC.velocity.X = 0f; + } + } + else + { + if (NPC.soundDelay == 0) + { + float soundDelay = targetDistance / 40f; + if (soundDelay < 10f) + soundDelay = 10f; + if (soundDelay > 20f) + soundDelay = 20f; + + NPC.soundDelay = (int)soundDelay; + SoundEngine.PlaySound(SoundID.WormDig, NPC.Center); + } + + targetDistance = (float)Math.Sqrt((double)(playerX * playerX + targettingPosition * targettingPosition)); + float absolutePlayerX = Math.Abs(playerX); + float absoluteTargetPos = Math.Abs(targettingPosition); + float timeToReachTarget = maxChaseSpeed / targetDistance; + playerX *= timeToReachTarget; + targettingPosition *= timeToReachTarget; + + if (((NPC.velocity.X > 0f && playerX > 0f) || (NPC.velocity.X < 0f && playerX < 0f)) && ((NPC.velocity.Y > 0f && targettingPosition > 0f) || (NPC.velocity.Y < 0f && targettingPosition < 0f))) + { + if (NPC.velocity.X < playerX) + NPC.velocity.X += turnSpeed; + else if (NPC.velocity.X > playerX) + NPC.velocity.X -= turnSpeed; + + if (NPC.velocity.Y < targettingPosition) + NPC.velocity.Y += turnSpeed; + else if (NPC.velocity.Y > targettingPosition) + NPC.velocity.Y -= turnSpeed; + } + + if ((NPC.velocity.X > 0f && playerX > 0f) || (NPC.velocity.X < 0f && playerX < 0f) || (NPC.velocity.Y > 0f && targettingPosition > 0f) || (NPC.velocity.Y < 0f && targettingPosition < 0f)) + { + if (NPC.velocity.X < playerX) + NPC.velocity.X += speed; + else if (NPC.velocity.X > playerX) + NPC.velocity.X -= speed; + + if (NPC.velocity.Y < targettingPosition) + NPC.velocity.Y += speed; + else if (NPC.velocity.Y > targettingPosition) + NPC.velocity.Y -= speed; + + if ((double)Math.Abs(targettingPosition) < maxChaseSpeed * 0.2 && ((NPC.velocity.X > 0f && playerX < 0f) || (NPC.velocity.X < 0f && playerX > 0f))) + { + if (NPC.velocity.Y > 0f) + NPC.velocity.Y += speed * 2f; + else + NPC.velocity.Y -= speed * 2f; + } + + if ((double)Math.Abs(playerX) < maxChaseSpeed * 0.2 && ((NPC.velocity.Y > 0f && targettingPosition < 0f) || (NPC.velocity.Y < 0f && targettingPosition > 0f))) + { + if (NPC.velocity.X > 0f) + NPC.velocity.X += speed * 2f; + else + NPC.velocity.X -= speed * 2f; + } + } + else if (absolutePlayerX > absoluteTargetPos) + { + if (NPC.velocity.X < playerX) + NPC.velocity.X += speed * 1.1f; + else if (NPC.velocity.X > playerX) + NPC.velocity.X -= speed * 1.1f; + + if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < maxChaseSpeed * 0.5) + { + if (NPC.velocity.Y > 0f) + NPC.velocity.Y += speed; + else + NPC.velocity.Y -= speed; + } + } + else + { + if (NPC.velocity.Y < targettingPosition) + NPC.velocity.Y += speed * 1.1f; + else if (NPC.velocity.Y > targettingPosition) + NPC.velocity.Y -= speed * 1.1f; + + if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < maxChaseSpeed * 0.5) + { + if (NPC.velocity.X > 0f) + NPC.velocity.X += speed; + else + NPC.velocity.X -= speed; + } + } + } + + Vector2 destination = Main.player[NPC.target].Center; + if (NPC.Distance(destination) > 1000f) + NPC.velocity += (destination - NPC.Center).SafeNormalize(Vector2.UnitY) * turnSpeed; + + // Calculate contact damage based on velocity + float minimalContactDamageVelocity = maxChaseSpeed * 0.25f; + float minimalDamageVelocity = maxChaseSpeed * 0.5f; + if (NPC.velocity.Length() <= minimalContactDamageVelocity) + { + NPC.damage = (int)Math.Round(NPC.defDamage * 0.5); + } + else + { + float velocityDamageScalar = MathHelper.Clamp((NPC.velocity.Length() - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); + NPC.damage = (int)MathHelper.Lerp((float)Math.Round(NPC.defDamage * 0.5), NPC.defDamage, velocityDamageScalar); + } + + NPC.rotation = (float)Math.Atan2((double)NPC.velocity.Y, (double)NPC.velocity.X) + MathHelper.PiOver2; + + if (shouldFly) + { + if (NPC.localAI[0] != 1f) + NPC.netUpdate = true; + + NPC.localAI[0] = 1f; + } + else + { + if (NPC.localAI[0] != 0f) + NPC.netUpdate = true; + + NPC.localAI[0] = 0f; + } + + if (((NPC.velocity.X > 0f && NPC.oldVelocity.X < 0f) || (NPC.velocity.X < 0f && NPC.oldVelocity.X > 0f) || (NPC.velocity.Y > 0f && NPC.oldVelocity.Y < 0f) || (NPC.velocity.Y < 0f && NPC.oldVelocity.Y > 0f)) && !NPC.justHit) + NPC.netUpdate = true; + } + + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + Rectangle targetHitbox = target.Hitbox; + + float hitboxTopLeft = Vector2.Distance(NPC.Center, targetHitbox.TopLeft()); + float hitboxTopRight = Vector2.Distance(NPC.Center, targetHitbox.TopRight()); + float hitboxBotLeft = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft()); + float hitboxBotRight = Vector2.Distance(NPC.Center, targetHitbox.BottomRight()); + + float minDist = hitboxTopLeft; + if (hitboxTopRight < minDist) + minDist = hitboxTopRight; + if (hitboxBotLeft < minDist) + minDist = hitboxBotLeft; + if (hitboxBotRight < minDist) + minDist = hitboxBotRight; + + return minDist <= 45f; + } + + public override void HitEffect(NPC.HitInfo hit) + { + for (int k = 0; k < 3; k++) + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); + + if (NPC.life <= 0) + { + if (Main.netMode != NetmodeID.Server) + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ScourgeNuisance2Head").Type, NPC.scale); + + for (int k = 0; k < 10; k++) + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); + } + } + + public override void FindFrame(int frameHeight) + { + // Open mouth to prepare for a nibble ;3 + // Also open mouth for projectile spreads + bool aboutToSpitSpread = NPC.Calamity().newAI[0] > SpitGateValue - 30f; + bool openMouth = NPC.Distance(Main.player[NPC.target].Center) < OpenMouthForBiteDistance && + (Main.player[NPC.target].Center - NPC.Center).SafeNormalize(Vector2.UnitY).ToRotation().AngleTowards(NPC.velocity.ToRotation(), MathHelper.PiOver4) == NPC.velocity.ToRotation() && + NPC.ai[3] == 0f; + + bool closeMouthBite = NPC.ai[3] == 1f; + if (closeMouthBite) + { + // Force mouth open for a bite if it's not open. + if (NPC.frame.Y < frameHeight * OpenMouthStopFrame) + { + NPC.frame.Y = frameHeight * OpenMouthStopFrame; + NPC.frameCounter = 0D; + } + + NPC.frameCounter += 1D; + if (NPC.frameCounter > 4D) + { + NPC.frame.Y += frameHeight; + NPC.frameCounter = 0D; + } + if (NPC.frame.Y >= frameHeight * Main.npcFrameCount[NPC.type]) + { + NPC.ai[3] = 2f; + NPC.netUpdate = true; + NPC.netSpam = 0; + NPC.frame.Y = 0; + } + } + else if (openMouth || aboutToSpitSpread) + { + NPC.frameCounter += 1D; + if (NPC.frameCounter > 4D) + { + NPC.frame.Y += frameHeight; + NPC.frameCounter = 0D; + } + if (NPC.frame.Y >= frameHeight * OpenMouthStopFrame) + NPC.frame.Y = frameHeight * OpenMouthStopFrame; + } + + // Close mouth. + else + { + if (NPC.frame.Y > 0) + { + if (NPC.frame.Y >= frameHeight * Main.npcFrameCount[NPC.type]) + { + NPC.frame.Y = 0; + NPC.ai[3] = 0f; + NPC.netUpdate = true; + NPC.netSpam = 0; + } + else + { + NPC.frameCounter += 1D; + if (NPC.frameCounter > 4D) + { + NPC.frame.Y -= frameHeight; + NPC.frameCounter = 0D; + } + } + } + else + { + NPC.ai[3] = 0f; + NPC.netUpdate = true; + NPC.netSpam = 0; + } + } + } + + public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) + { + NPC.lifeMax = (int)(NPC.lifeMax * 0.7f * balance); + } + + public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) + { + if (hurtInfo.Damage > 0) + { + target.AddBuff(BuffID.Bleeding, 180); + NPC.ai[3] = 1f; + NPC.netUpdate = true; + NPC.netSpam = 0; + } + } + + public override Color? GetAlpha(Color drawColor) + { + if (Main.zenithWorld) + { + Color lightColor = Color.Orange * drawColor.A; + return lightColor * NPC.Opacity; + } + else return null; + } + } +} diff --git a/NPCs/DesertScourge/DesertNuisanceHeadYoung.png b/NPCs/DesertScourge/DesertNuisanceHeadYoung.png new file mode 100644 index 0000000000..743a910bc1 Binary files /dev/null and b/NPCs/DesertScourge/DesertNuisanceHeadYoung.png differ diff --git a/NPCs/DesertScourge/DesertNuisanceHeadYoung_Head_Boss.png b/NPCs/DesertScourge/DesertNuisanceHeadYoung_Head_Boss.png new file mode 100644 index 0000000000..d26dbbf2c5 Binary files /dev/null and b/NPCs/DesertScourge/DesertNuisanceHeadYoung_Head_Boss.png differ diff --git a/NPCs/DesertScourge/DesertNuisanceHead_Head_Boss.png b/NPCs/DesertScourge/DesertNuisanceHead_Head_Boss.png index ab04fa821f..681d0f594a 100644 Binary files a/NPCs/DesertScourge/DesertNuisanceHead_Head_Boss.png and b/NPCs/DesertScourge/DesertNuisanceHead_Head_Boss.png differ diff --git a/NPCs/DesertScourge/DesertNuisanceTail.cs b/NPCs/DesertScourge/DesertNuisanceTail.cs index 4d71065aab..285b6f2806 100644 --- a/NPCs/DesertScourge/DesertNuisanceTail.cs +++ b/NPCs/DesertScourge/DesertNuisanceTail.cs @@ -11,6 +11,7 @@ namespace CalamityMod.NPCs.DesertScourge public class DesertNuisanceTail : ModNPC { public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.DesertNuisanceHead.DisplayName"); + public override void SetStaticDefaults() { this.HideFromBestiary(); @@ -19,14 +20,17 @@ namespace CalamityMod.NPCs.DesertScourge public override void SetDefaults() { NPC.GetNPCDamage(); - NPC.width = 32; - NPC.height = 32; + NPC.width = 88; + NPC.height = 88; - NPC.defense = 7; + NPC.defense = 8; if (Main.getGoodWorld) - NPC.defense += 33; + NPC.defense += 34; + + NPC.LifeMaxNERB(1500, 1800, 40000); + if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + NPC.lifeMax = 4800; - NPC.lifeMax = BossRushEvent.BossRushActive ? 35000 : (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 2400 : 800; double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); NPC.aiStyle = -1; @@ -36,7 +40,6 @@ namespace CalamityMod.NPCs.DesertScourge NPC.behindTiles = true; NPC.noGravity = true; NPC.noTileCollide = true; - NPC.canGhostHeal = false; NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath1; NPC.netAlways = true; @@ -46,16 +49,23 @@ namespace CalamityMod.NPCs.DesertScourge NPC.Calamity().VulnerableToWater = true; } - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) => false; public override void AI() { + bool bossRush = BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || bossRush; + bool masterMode = Main.masterMode || bossRush; + if (NPC.ai[2] > 0f) NPC.realLife = (int)NPC.ai[2]; + if (NPC.life > Main.npc[(int)NPC.ai[1]].life) + NPC.life = Main.npc[(int)NPC.ai[1]].life; + + // Percent life remaining + float lifeRatio = NPC.life / (float)NPC.lifeMax; + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) NPC.TargetClosest(); @@ -93,9 +103,9 @@ namespace CalamityMod.NPCs.DesertScourge if (Main.player[NPC.target].dead) NPC.TargetClosest(false); - Vector2 segmentTilePos = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); - float playerXPos = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); - float playerYPos = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2); + Vector2 segmentTilePos = NPC.Center; + float playerXPos = Main.player[NPC.target].Center.X; + float playerYPos = Main.player[NPC.target].Center.Y; playerXPos = (float)((int)(playerXPos / 16f) * 16); playerYPos = (float)((int)(playerYPos / 16f) * 16); segmentTilePos.X = (float)((int)(segmentTilePos.X / 16f) * 16); @@ -107,16 +117,18 @@ namespace CalamityMod.NPCs.DesertScourge { try { - segmentTilePos = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); - playerXPos = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - segmentTilePos.X; - playerYPos = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - segmentTilePos.Y; + segmentTilePos = NPC.Center; + playerXPos = Main.npc[(int)NPC.ai[1]].Center.X - segmentTilePos.X; + playerYPos = Main.npc[(int)NPC.ai[1]].Center.Y - segmentTilePos.Y; } catch { } - NPC.rotation = (float)System.Math.Atan2((double)playerYPos, (double)playerXPos) + 1.57f; + NPC.rotation = (float)System.Math.Atan2((double)playerYPos, (double)playerXPos) + MathHelper.PiOver2; playerDistance = (float)System.Math.Sqrt((double)(playerXPos * playerXPos + playerYPos * playerYPos)); - playerDistance = (playerDistance - (float)(NPC.width)) / playerDistance; + + int segmentOffset = 62; + playerDistance = (playerDistance - segmentOffset) / playerDistance; playerXPos *= playerDistance; playerYPos *= playerDistance; NPC.velocity = Vector2.Zero; @@ -128,31 +140,66 @@ namespace CalamityMod.NPCs.DesertScourge else if (playerXPos > 0f) NPC.spriteDirection = -1; } + + // Calculate contact damage based on velocity + float maxChaseSpeed = Main.zenithWorld ? DesertNuisanceHead.SegmentVelocity_ZenithSeed : + Main.getGoodWorld ? DesertNuisanceHead.SegmentVelocity_GoodWorld : + masterMode ? DesertNuisanceHead.SegmentVelocity_Master : + DesertNuisanceHead.SegmentVelocity_Expert; + maxChaseSpeed += maxChaseSpeed * 0.2f * (1f - lifeRatio); + if (masterMode) + maxChaseSpeed += maxChaseSpeed * 0.2f * (1f - lifeRatio); + + float minimalContactDamageVelocity = maxChaseSpeed * 0.25f; + float minimalDamageVelocity = maxChaseSpeed * 0.5f; + float bodyAndTailVelocity = (NPC.position - NPC.oldPosition).Length(); + if (bodyAndTailVelocity <= minimalContactDamageVelocity) + { + NPC.damage = 0; + } + else + { + float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); + NPC.damage = (int)MathHelper.Lerp(0f, NPC.defDamage, velocityDamageScalar); + } + } + + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + Rectangle targetHitbox = target.Hitbox; + + float hitboxTopLeft = Vector2.Distance(NPC.Center, targetHitbox.TopLeft()); + float hitboxTopRight = Vector2.Distance(NPC.Center, targetHitbox.TopRight()); + float hitboxBotLeft = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft()); + float hitboxBotRight = Vector2.Distance(NPC.Center, targetHitbox.BottomRight()); + + float minDist = hitboxTopLeft; + if (hitboxTopRight < minDist) + minDist = hitboxTopRight; + if (hitboxBotLeft < minDist) + minDist = hitboxBotLeft; + if (hitboxBotRight < minDist) + minDist = hitboxBotRight; + + return minDist <= 30f * NPC.scale; } public override void HitEffect(NPC.HitInfo hit) { for (int k = 0; k < 3; k++) - { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); - } + if (NPC.life <= 0) { if (Main.netMode != NetmodeID.Server) - { - Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ScourgeTail").Type, 0.65f); - } + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ScourgeNuisanceTail").Type, NPC.scale); + for (int k = 0; k < 10; k++) - { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); - } } } - public override bool CheckActive() - { - return false; - } + public override bool CheckActive() => false; public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { diff --git a/NPCs/DesertScourge/DesertNuisanceTail.png b/NPCs/DesertScourge/DesertNuisanceTail.png index 0e4c24e099..b1ea90e51c 100644 Binary files a/NPCs/DesertScourge/DesertNuisanceTail.png and b/NPCs/DesertScourge/DesertNuisanceTail.png differ diff --git a/NPCs/DesertScourge/DesertNuisanceTailYoung.cs b/NPCs/DesertScourge/DesertNuisanceTailYoung.cs new file mode 100644 index 0000000000..df82733592 --- /dev/null +++ b/NPCs/DesertScourge/DesertNuisanceTailYoung.cs @@ -0,0 +1,225 @@ +using CalamityMod.Events; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.DesertScourge +{ + public class DesertNuisanceTailYoung : ModNPC + { + public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.DesertNuisanceHeadYoung.DisplayName"); + + public override void SetStaticDefaults() + { + this.HideFromBestiary(); + } + + public override void SetDefaults() + { + NPC.GetNPCDamage(); + NPC.width = 78; + NPC.height = 78; + + NPC.defense = 7; + if (Main.getGoodWorld) + NPC.defense += 33; + + NPC.LifeMaxNERB(1300, 1560, 35000); + if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + NPC.lifeMax = 4000; + + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; + NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); + NPC.aiStyle = -1; + AIType = -1; + NPC.knockBackResist = 0f; + NPC.alpha = 255; + NPC.behindTiles = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.netAlways = true; + NPC.dontCountMe = true; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToWater = true; + } + + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) => false; + + public override void AI() + { + bool bossRush = BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || bossRush; + bool masterMode = Main.masterMode || bossRush; + + if (NPC.ai[2] > 0f) + NPC.realLife = (int)NPC.ai[2]; + + if (NPC.life > Main.npc[(int)NPC.ai[1]].life) + NPC.life = Main.npc[(int)NPC.ai[1]].life; + + // Percent life remaining + float lifeRatio = NPC.life / (float)NPC.lifeMax; + + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) + NPC.TargetClosest(); + + bool shouldDespawn = true; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active && Main.npc[i].type == ModContent.NPCType()) + { + shouldDespawn = false; + break; + } + } + if (!shouldDespawn) + { + if (NPC.ai[1] <= 0f) + shouldDespawn = true; + else if (Main.npc[(int)NPC.ai[1]].life <= 0) + shouldDespawn = true; + } + if (shouldDespawn) + { + NPC.life = 0; + NPC.HitEffect(0, 10.0); + NPC.checkDead(); + NPC.active = false; + } + + if (Main.npc[(int)NPC.ai[1]].alpha < 128) + { + NPC.alpha -= 42; + if (NPC.alpha < 0) + NPC.alpha = 0; + } + + if (Main.player[NPC.target].dead) + NPC.TargetClosest(false); + + Vector2 segmentTilePos = NPC.Center; + float playerXPos = Main.player[NPC.target].Center.X; + float playerYPos = Main.player[NPC.target].Center.Y; + playerXPos = (float)((int)(playerXPos / 16f) * 16); + playerYPos = (float)((int)(playerYPos / 16f) * 16); + segmentTilePos.X = (float)((int)(segmentTilePos.X / 16f) * 16); + segmentTilePos.Y = (float)((int)(segmentTilePos.Y / 16f) * 16); + playerXPos -= segmentTilePos.X; + playerYPos -= segmentTilePos.Y; + float playerDistance = (float)System.Math.Sqrt((double)(playerXPos * playerXPos + playerYPos * playerYPos)); + if (NPC.ai[1] > 0f && NPC.ai[1] < (float)Main.npc.Length) + { + try + { + segmentTilePos = NPC.Center; + playerXPos = Main.npc[(int)NPC.ai[1]].Center.X - segmentTilePos.X; + playerYPos = Main.npc[(int)NPC.ai[1]].Center.Y - segmentTilePos.Y; + } + catch + { + } + NPC.rotation = (float)System.Math.Atan2((double)playerYPos, (double)playerXPos) + MathHelper.PiOver2; + playerDistance = (float)System.Math.Sqrt((double)(playerXPos * playerXPos + playerYPos * playerYPos)); + + int segmentOffset = 50; + playerDistance = (playerDistance - segmentOffset) / playerDistance; + playerXPos *= playerDistance; + playerYPos *= playerDistance; + NPC.velocity = Vector2.Zero; + NPC.position.X = NPC.position.X + playerXPos; + NPC.position.Y = NPC.position.Y + playerYPos; + + if (playerXPos < 0f) + NPC.spriteDirection = 1; + else if (playerXPos > 0f) + NPC.spriteDirection = -1; + } + + // Calculate contact damage based on velocity + float maxChaseSpeed = Main.zenithWorld ? DesertNuisanceHeadYoung.SegmentVelocity_ZenithSeed : + Main.getGoodWorld ? DesertNuisanceHeadYoung.SegmentVelocity_GoodWorld : + masterMode ? DesertNuisanceHeadYoung.SegmentVelocity_Master : + DesertNuisanceHeadYoung.SegmentVelocity_Expert; + maxChaseSpeed += maxChaseSpeed * 0.2f * (1f - lifeRatio); + if (masterMode) + maxChaseSpeed += maxChaseSpeed * 0.2f * (1f - lifeRatio); + + float minimalContactDamageVelocity = maxChaseSpeed * 0.25f; + float minimalDamageVelocity = maxChaseSpeed * 0.5f; + float bodyAndTailVelocity = (NPC.position - NPC.oldPosition).Length(); + if (bodyAndTailVelocity <= minimalContactDamageVelocity) + { + NPC.damage = 0; + } + else + { + float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); + NPC.damage = (int)MathHelper.Lerp(0f, NPC.defDamage, velocityDamageScalar); + } + } + + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + Rectangle targetHitbox = target.Hitbox; + + float hitboxTopLeft = Vector2.Distance(NPC.Center, targetHitbox.TopLeft()); + float hitboxTopRight = Vector2.Distance(NPC.Center, targetHitbox.TopRight()); + float hitboxBotLeft = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft()); + float hitboxBotRight = Vector2.Distance(NPC.Center, targetHitbox.BottomRight()); + + float minDist = hitboxTopLeft; + if (hitboxTopRight < minDist) + minDist = hitboxTopRight; + if (hitboxBotLeft < minDist) + minDist = hitboxBotLeft; + if (hitboxBotRight < minDist) + minDist = hitboxBotRight; + + return minDist <= 30f * NPC.scale; + } + + public override void HitEffect(NPC.HitInfo hit) + { + for (int k = 0; k < 3; k++) + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); + + if (NPC.life <= 0) + { + if (Main.netMode != NetmodeID.Server) + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ScourgeNuisance2Tail").Type, NPC.scale); + + for (int k = 0; k < 10; k++) + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); + } + } + + public override bool CheckActive() => false; + + public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) + { + NPC.lifeMax = (int)(NPC.lifeMax * 0.7f * balance); + } + + public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) + { + if (hurtInfo.Damage > 0) + target.AddBuff(BuffID.Bleeding, 30, true); + } + + public override Color? GetAlpha(Color drawColor) + { + if (Main.zenithWorld) + { + Color lightColor = Color.Orange * drawColor.A; + return lightColor * NPC.Opacity; + } + else return null; + } + } +} diff --git a/NPCs/DesertScourge/DesertNuisanceTailYoung.png b/NPCs/DesertScourge/DesertNuisanceTailYoung.png new file mode 100644 index 0000000000..ce9fdf9ace Binary files /dev/null and b/NPCs/DesertScourge/DesertNuisanceTailYoung.png differ diff --git a/NPCs/DesertScourge/DesertPestBody.png b/NPCs/DesertScourge/DesertPestBody.png new file mode 100644 index 0000000000..79e052b362 Binary files /dev/null and b/NPCs/DesertScourge/DesertPestBody.png differ diff --git a/NPCs/DesertScourge/DesertPestBody2.png b/NPCs/DesertScourge/DesertPestBody2.png new file mode 100644 index 0000000000..f651238e84 Binary files /dev/null and b/NPCs/DesertScourge/DesertPestBody2.png differ diff --git a/NPCs/DesertScourge/DesertPestBody3.png b/NPCs/DesertScourge/DesertPestBody3.png new file mode 100644 index 0000000000..2307268ff8 Binary files /dev/null and b/NPCs/DesertScourge/DesertPestBody3.png differ diff --git a/NPCs/DesertScourge/DesertPestBody4.png b/NPCs/DesertScourge/DesertPestBody4.png new file mode 100644 index 0000000000..922b55b874 Binary files /dev/null and b/NPCs/DesertScourge/DesertPestBody4.png differ diff --git a/NPCs/DesertScourge/DesertPestHead.png b/NPCs/DesertScourge/DesertPestHead.png new file mode 100644 index 0000000000..4d24a8bb61 Binary files /dev/null and b/NPCs/DesertScourge/DesertPestHead.png differ diff --git a/NPCs/DesertScourge/DesertPestTail.png b/NPCs/DesertScourge/DesertPestTail.png new file mode 100644 index 0000000000..f6f82765e0 Binary files /dev/null and b/NPCs/DesertScourge/DesertPestTail.png differ diff --git a/NPCs/DesertScourge/DesertScourgeBody.cs b/NPCs/DesertScourge/DesertScourgeBody.cs index 3154b76c7e..628434af56 100644 --- a/NPCs/DesertScourge/DesertScourgeBody.cs +++ b/NPCs/DesertScourge/DesertScourgeBody.cs @@ -1,8 +1,14 @@ using CalamityMod.Events; +using CalamityMod.Items.Placeables.Furniture; using CalamityMod.Projectiles.Enemy; using CalamityMod.World; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using System; +using System.IO; using Terraria; +using Terraria.GameContent; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -12,20 +18,36 @@ namespace CalamityMod.NPCs.DesertScourge public class DesertScourgeBody : ModNPC { public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.DesertScourgeHead.DisplayName"); + + public static Asset BodyTexture2; + public static Asset BodyTexture3; + public static Asset BodyTexture4; + + private const int ClosedFinFrame = 5; + public override void SetStaticDefaults() { + Main.npcFrameCount[NPC.type] = 7; + this.HideFromBestiary(); + + if (!Main.dedServ) + { + BodyTexture2 = ModContent.Request(Texture + "2", AssetRequestMode.AsyncLoad); + BodyTexture3 = ModContent.Request(Texture + "3", AssetRequestMode.AsyncLoad); + BodyTexture4 = ModContent.Request(Texture + "4", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() { NPC.GetNPCDamage(); - NPC.width = 32; - NPC.height = 36; + NPC.width = 104; + NPC.height = 104; NPC.defense = 6; NPC.DR_NERD(0.05f); - NPC.LifeMaxNERB(2500, 3000, 1650000); + NPC.LifeMaxNERB(4200, 5000, 1650000); if (Main.getGoodWorld) NPC.lifeMax *= 4; @@ -39,21 +61,11 @@ namespace CalamityMod.NPCs.DesertScourge NPC.behindTiles = true; NPC.noGravity = true; NPC.noTileCollide = true; - NPC.canGhostHeal = false; NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath1; NPC.netAlways = true; NPC.dontCountMe = true; - if (BossRushEvent.BossRushActive) - NPC.scale *= 1.25f; - else if (CalamityWorld.death) - NPC.scale *= 1.2f; - else if (CalamityWorld.revenge) - NPC.scale *= 1.15f; - else if (Main.expertMode) - NPC.scale *= 1.1f; - if (Main.getGoodWorld) NPC.scale *= 0.4f; @@ -62,16 +74,111 @@ namespace CalamityMod.NPCs.DesertScourge NPC.Calamity().VulnerableToWater = true; } - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) => false; + + public override void SendExtraAI(BinaryWriter writer) { - return false; + writer.Write(NPC.alpha); + writer.Write(NPC.dontTakeDamage); + + // Frame syncs + writer.Write(NPC.frame.X); + writer.Write(NPC.frame.Y); + writer.Write(NPC.frame.Width); + writer.Write(NPC.frame.Height); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + NPC.alpha = reader.ReadInt32(); + NPC.dontTakeDamage = reader.ReadBoolean(); + + // Frame syncs + Rectangle frame = new Rectangle(reader.ReadInt32(), reader.ReadInt32(), reader.ReadInt32(), reader.ReadInt32()); + if (frame.Width > 0 && frame.Height > 0) + NPC.frame = frame; } public override void AI() { + bool bossRush = BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || bossRush; + bool masterMode = Main.masterMode || bossRush; + + if (NPC.ai[3] > 0f) + { + switch ((int)NPC.ai[3]) + { + default: + break; + + case 10: + + NPC.ai[3] = 1f; + + NPC.position = NPC.Center; + //NPC.width = (int)(BodyTexture2.Width() * NPC.scale); + //NPC.height = (int)(BodyTexture2.Height() * NPC.scale); + NPC.position -= NPC.Size * 0.5f; + NPC.frame = new Rectangle(0, 0, BodyTexture2.Width(), BodyTexture2.Height()); + + NPC.netUpdate = true; + + // Prevent netUpdate from being blocked by the spam counter. + NPC.netSpam = 0; + + break; + + case 20: + + NPC.ai[3] = 2f; + + NPC.position = NPC.Center; + //NPC.width = (int)(BodyTexture3.Width() * NPC.scale); + //NPC.height = (int)(BodyTexture3.Height() * NPC.scale); + NPC.position -= NPC.Size * 0.5f; + NPC.frame = new Rectangle(0, 0, BodyTexture3.Width(), BodyTexture3.Height()); + + NPC.netUpdate = true; + + // Prevent netUpdate from being blocked by the spam counter. + NPC.netSpam = 0; + + break; + + case 30: + + NPC.ai[3] = 3f; + + NPC.position = NPC.Center; + //NPC.width = (int)(BodyTexture4.Width() * NPC.scale); + //NPC.height = (int)(BodyTexture4.Height() * NPC.scale); + NPC.position -= NPC.Size * 0.5f; + NPC.frame = new Rectangle(0, 0, BodyTexture4.Width(), BodyTexture4.Height()); + + NPC.netUpdate = true; + + // Prevent netUpdate from being blocked by the spam counter. + NPC.netSpam = 0; + + break; + } + } + if (NPC.ai[2] > 0f) NPC.realLife = (int)NPC.ai[2]; + if (NPC.life > Main.npc[(int)NPC.ai[1]].life) + NPC.life = Main.npc[(int)NPC.ai[1]].life; + + NPC.dontTakeDamage = Main.npc[(int)NPC.ai[1]].dontTakeDamage; + + // Percent life remaining + float lifeRatio = NPC.life / (float)NPC.lifeMax; + + // Phases + bool phase2 = lifeRatio < 0.5f; + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) NPC.TargetClosest(); @@ -105,52 +212,150 @@ namespace CalamityMod.NPCs.DesertScourge if (NPC.alpha < 0) NPC.alpha = 0; } + else + { + NPC.alpha = Main.npc[(int)NPC.ai[1]].alpha; + if (NPC.alpha != 255 && NPC.dontTakeDamage) + { + for (int dustIndex = 0; dustIndex < 2; dustIndex++) + { + int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.UnusedBrown, 0f, 0f, 100, default, 2f); + Main.dust[dust].noGravity = true; + Main.dust[dust].noLight = true; + } + } + } if (Main.player[NPC.target].dead) NPC.TargetClosest(false); - Vector2 segmentTilePos = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); - float playerXPos = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); - float playerYPos = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2); - playerXPos = (float)((int)(playerXPos / 16f) * 16); - playerYPos = (float)((int)(playerYPos / 16f) * 16); - segmentTilePos.X = (float)((int)(segmentTilePos.X / 16f) * 16); - segmentTilePos.Y = (float)((int)(segmentTilePos.Y / 16f) * 16); - playerXPos -= segmentTilePos.X; - playerYPos -= segmentTilePos.Y; - float playerDistance = (float)System.Math.Sqrt((double)(playerXPos * playerXPos + playerYPos * playerYPos)); - if (NPC.ai[1] > 0f && NPC.ai[1] < (float)Main.npc.Length) + NPC aheadSegment = Main.npc[(int)NPC.ai[1]]; + Vector2 directionToNextSegment = aheadSegment.Center - NPC.Center; + if (aheadSegment.rotation != NPC.rotation) { - try - { - segmentTilePos = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); - playerXPos = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - segmentTilePos.X; - playerYPos = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - segmentTilePos.Y; - } - catch - { - } - NPC.rotation = (float)System.Math.Atan2((double)playerYPos, (double)playerXPos) + 1.57f; - playerDistance = (float)System.Math.Sqrt((double)(playerXPos * playerXPos + playerYPos * playerYPos)); - playerDistance = (playerDistance - (float)(NPC.width)) / playerDistance; - playerXPos *= playerDistance; - playerYPos *= playerDistance; - NPC.velocity = Vector2.Zero; - NPC.position.X = NPC.position.X + playerXPos; - NPC.position.Y = NPC.position.Y + playerYPos; + directionToNextSegment = directionToNextSegment.RotatedBy(MathHelper.WrapAngle(aheadSegment.rotation - NPC.rotation) * 0.08f); + directionToNextSegment = directionToNextSegment.MoveTowards((aheadSegment.rotation - NPC.rotation).ToRotationVector2(), 1f); + } - if (playerXPos < 0f) - NPC.spriteDirection = 1; - else if (playerXPos > 0f) - NPC.spriteDirection = -1; + // Decide segment offset stuff. + int segmentOffset = 70; + NPC.rotation = directionToNextSegment.ToRotation() + MathHelper.PiOver2; + NPC.Center = aheadSegment.Center - directionToNextSegment.SafeNormalize(Vector2.Zero) * NPC.scale * segmentOffset; + NPC.spriteDirection = (directionToNextSegment.X > 0).ToDirectionInt(); + + NPC head = Main.npc[(int)NPC.ai[2]]; + float burrowTimeGateValue = DesertScourgeHead.BurrowTimeGateValue; + bool burrow = head.Calamity().newAI[0] >= burrowTimeGateValue; + bool lungeUpward = burrow && head.Calamity().newAI[1] == 1f; + bool quickFall = head.Calamity().newAI[1] == 2f; + + // Calculate contact damage based on velocity + float maxChaseSpeed = Main.zenithWorld ? DesertScourgeHead.SegmentVelocity_ZenithSeed : + Main.getGoodWorld ? DesertScourgeHead.SegmentVelocity_GoodWorld : + masterMode ? DesertScourgeHead.SegmentVelocity_Master : + expertMode ? DesertScourgeHead.SegmentVelocity_Expert : + DesertScourgeHead.SegmentVelocity_Normal; + if (burrow || lungeUpward) + maxChaseSpeed *= 1.5f; + if (expertMode) + maxChaseSpeed += maxChaseSpeed * 0.2f * (1f - lifeRatio); + + float minimalContactDamageVelocity = maxChaseSpeed * 0.25f; + float minimalDamageVelocity = maxChaseSpeed * 0.5f; + float bodyAndTailVelocity = (NPC.position - NPC.oldPosition).Length(); + if (bodyAndTailVelocity <= minimalContactDamageVelocity || NPC.dontTakeDamage) + { + NPC.damage = 0; + } + else + { + float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); + NPC.damage = (int)MathHelper.Lerp(0f, NPC.defDamage, velocityDamageScalar); } } - public override bool CheckActive() + public override bool CanHitPlayer(Player target, ref int cooldownSlot) { - return false; + Rectangle targetHitbox = target.Hitbox; + + float hitboxTopLeft = Vector2.Distance(NPC.Center, targetHitbox.TopLeft()); + float hitboxTopRight = Vector2.Distance(NPC.Center, targetHitbox.TopRight()); + float hitboxBotLeft = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft()); + float hitboxBotRight = Vector2.Distance(NPC.Center, targetHitbox.BottomRight()); + + float minDist = hitboxTopLeft; + if (hitboxTopRight < minDist) + minDist = hitboxTopRight; + if (hitboxBotLeft < minDist) + minDist = hitboxBotLeft; + if (hitboxBotRight < minDist) + minDist = hitboxBotRight; + + float hitDistance = 30f; + switch ((int)NPC.ai[3]) + { + default: + case 1: + case 10: + hitDistance = 45f; + break; + + case 2: + case 20: + hitDistance = 45f; + break; + + case 3: + case 30: + hitDistance = 30f; + break; + } + + return minDist <= hitDistance * NPC.scale && NPC.alpha <= 0; } + public override void FindFrame(int frameHeight) + { + // Fin animation segment. + if (NPC.ai[3] == 0f) + { + // Close fins while head is in tiles. + NPC head = Main.npc[(int)NPC.ai[2]]; + Point headTileCenter = head.Center.ToTileCoordinates(); + Tile tileSafely = Framing.GetTileSafely(headTileCenter); + bool headInSolidTile = tileSafely.HasUnactuatedTile || tileSafely.LiquidAmount > 0; + if (headInSolidTile) + { + NPC.frameCounter += 1D; + if (NPC.frameCounter > 10D) + { + NPC.frame.Y += frameHeight; + NPC.frameCounter = 0D; + } + if (NPC.frame.Y >= frameHeight * ClosedFinFrame) + NPC.frame.Y = frameHeight * ClosedFinFrame; + } + + // Open fins while head is outside tiles. + else + { + if (NPC.frame.Y > 0) + { + NPC.frameCounter += 1D; + if (NPC.frameCounter > 10D) + { + NPC.frame.Y += frameHeight; + NPC.frameCounter = 0D; + } + if (NPC.frame.Y >= frameHeight * Main.npcFrameCount[NPC.type]) + NPC.frame.Y = 0; + } + } + } + } + + public override bool CheckActive() => false; + public override void HitEffect(NPC.HitInfo hit) { for (int k = 0; k < 3; k++) @@ -160,15 +365,39 @@ namespace CalamityMod.NPCs.DesertScourge { if (Main.netMode != NetmodeID.Server) { - float randomSpread = Main.rand.Next(-200, 201) / 100f; - Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread * Main.rand.NextFloat(), Mod.Find("ScourgeBody").Type, NPC.scale); - Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread * Main.rand.NextFloat(), Mod.Find("ScourgeBody2").Type, NPC.scale); - Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread * Main.rand.NextFloat(), Mod.Find("ScourgeBody3").Type, NPC.scale); + switch ((int)NPC.ai[3]) + { + default: + case 0: + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ScourgeBody").Type, NPC.scale); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ScourgeBody2").Type, NPC.scale); + break; + + case 1: + case 10: + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ScourgeBody2").Type, NPC.scale); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ScourgeBody3").Type, NPC.scale); + break; + + case 2: + case 20: + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ScourgeBody2").Type, NPC.scale); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ScourgeBody4").Type, NPC.scale); + break; + + case 3: + case 30: + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ScourgeBody2").Type, NPC.scale); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ScourgeBody5").Type, NPC.scale); + break; + } } + for (int k = 0; k < 10; k++) Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); } } + public override void OnHitByProjectile(Projectile projectile, NPC.HitInfo hit, int damageDone) { // Sometimes "Deflect" projectiles in gfb into water blasts. @@ -185,13 +414,13 @@ namespace CalamityMod.NPCs.DesertScourge public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { - NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); } public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) { if (hurtInfo.Damage > 0) - target.AddBuff(BuffID.Bleeding, 240, true); + target.AddBuff(BuffID.Bleeding, 240); } public override Color? GetAlpha(Color drawColor) @@ -203,5 +432,45 @@ namespace CalamityMod.NPCs.DesertScourge } else return null; } + + public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + { + if (NPC.ai[3] > 0f) + { + SpriteEffects spriteEffects = SpriteEffects.None; + if (NPC.spriteDirection == 1) + spriteEffects = SpriteEffects.FlipHorizontally; + + Texture2D texture = default; + switch ((int)NPC.ai[3]) + { + default: + case 1: + case 10: + texture = BodyTexture2.Value; + break; + + case 2: + case 20: + texture = BodyTexture3.Value; + break; + + case 3: + case 30: + texture = BodyTexture4.Value; + break; + } + + Vector2 halfSizeTexture = new Vector2((float)(texture.Width / 2), (float)(texture.Height / 2)); + Vector2 drawLocation = NPC.Center - screenPos; + drawLocation -= new Vector2((float)texture.Width, (float)(texture.Height)) * NPC.scale / 2f; + drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); + + return false; + } + + return true; + } } } diff --git a/NPCs/DesertScourge/DesertScourgeBody.png b/NPCs/DesertScourge/DesertScourgeBody.png index c7a054844c..77ac3179ca 100644 Binary files a/NPCs/DesertScourge/DesertScourgeBody.png and b/NPCs/DesertScourge/DesertScourgeBody.png differ diff --git a/NPCs/DesertScourge/DesertScourgeBody2.png b/NPCs/DesertScourge/DesertScourgeBody2.png new file mode 100644 index 0000000000..a6e438c927 Binary files /dev/null and b/NPCs/DesertScourge/DesertScourgeBody2.png differ diff --git a/NPCs/DesertScourge/DesertScourgeBody3.png b/NPCs/DesertScourge/DesertScourgeBody3.png new file mode 100644 index 0000000000..937d045f2b Binary files /dev/null and b/NPCs/DesertScourge/DesertScourgeBody3.png differ diff --git a/NPCs/DesertScourge/DesertScourgeBody4.png b/NPCs/DesertScourge/DesertScourgeBody4.png new file mode 100644 index 0000000000..46662843fa Binary files /dev/null and b/NPCs/DesertScourge/DesertScourgeBody4.png differ diff --git a/NPCs/DesertScourge/DesertScourgeHead.cs b/NPCs/DesertScourge/DesertScourgeHead.cs index 4b558ac7d8..c0aa4509c0 100644 --- a/NPCs/DesertScourge/DesertScourgeHead.cs +++ b/NPCs/DesertScourge/DesertScourgeHead.cs @@ -1,4 +1,7 @@ -using CalamityMod.Events; +using System; +using System.IO; +using CalamityMod.Dusts; +using CalamityMod.Events; using CalamityMod.Items.Accessories; using CalamityMod.Items.Armor.Vanity; using CalamityMod.Items.LoreItems; @@ -18,15 +21,13 @@ using CalamityMod.Projectiles.Boss; using CalamityMod.Projectiles.Enemy; using CalamityMod.World; using Microsoft.Xna.Framework; -using System; -using System.IO; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.GameContent.Bestiary; +using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using Terraria.GameContent.ItemDropRules; -using Microsoft.Xna.Framework.Graphics; namespace CalamityMod.NPCs.DesertScourge { @@ -34,26 +35,49 @@ namespace CalamityMod.NPCs.DesertScourge public class DesertScourgeHead : ModNPC { private int biomeEnrageTimer = CalamityGlobalNPC.biomeEnrageTimerMax; - private bool TailSpawned = false; + private bool tailSpawned = false; public bool playRoarSound = false; + public const float SegmentVelocity_Normal = 12f; + public const float SegmentVelocity_Expert = 15f; + public const float SegmentVelocity_Master = 18f; + public const float SegmentVelocity_GoodWorld = 21f; + public const float SegmentVelocity_ZenithSeed = 24f; + + public const float SpitGateValue = 300f; + public const float SpitGateValue_Death = 180f; + + public const float BurrowTimeGateValue = 600f; + public const float BurrowResetTimeGateValue = BurrowTimeGateValue + 600f; + + public const float LungeUpwardDistanceOffset = 600f; + public const float LungeUpwardCutoffDistance = 420f; + public const float BurrowDistance_Hide = 1080f; + public const float BurrowDistance = 800f; + public const float BurrowDistance_BossRush = 400f; + public const float OpenMouthForBiteDistance = 220f; + + private const int OpenMouthStopFrame = 4; + public static readonly SoundStyle RoarSound = new("CalamityMod/Sounds/Custom/DesertScourgeRoar"); public override void SetStaticDefaults() { + Main.npcFrameCount[NPC.type] = 7; + NPCID.Sets.BossBestiaryPriority.Add(Type); - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { - Scale = 0.75f, - PortraitScale = 0.6f, + Scale = 0.65f, + PortraitScale = 0.7f, CustomTexturePath = "CalamityMod/ExtraTextures/Bestiary/DesertScourge_Bestiary", PortraitPositionXOverride = 40, PortraitPositionYOverride = 40 }; - value.Position.X += 95; - value.Position.Y += 45; + value.Position.X += 65; + value.Position.Y += 35; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; - NPCID.Sets.MPAllowedEnemies[Type] = true; + NPCID.Sets.MPAllowedEnemies[Type] = true; } public override void SetDefaults() @@ -62,10 +86,10 @@ namespace CalamityMod.NPCs.DesertScourge NPC.GetNPCDamage(); NPC.defense = 4; NPC.npcSlots = 12f; - NPC.width = 32; - NPC.height = 80; + NPC.width = 104; + NPC.height = 104; - NPC.LifeMaxNERB(2500, 3000, 1650000); + NPC.LifeMaxNERB(4200, 5000, 1650000); if (Main.getGoodWorld) NPC.lifeMax *= 4; @@ -84,48 +108,52 @@ namespace CalamityMod.NPCs.DesertScourge NPC.DeathSound = SoundID.NPCDeath1; NPC.netAlways = true; - if (BossRushEvent.BossRushActive) - NPC.scale *= 1.25f; - else if (CalamityWorld.death) - NPC.scale *= 1.2f; - else if (CalamityWorld.revenge) - NPC.scale *= 1.15f; - else if (Main.expertMode) - NPC.scale *= 1.1f; - if (Main.getGoodWorld) NPC.scale *= 0.4f; if (Main.zenithWorld) NPC.scale *= 4f; - NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToWater = true; } + public override void BossHeadSlot(ref int index) + { + if (NPC.AnyNPCs(ModContent.NPCType()) || NPC.AnyNPCs(ModContent.NPCType())) + index = -1; + } + public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { - BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Desert, - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.DesertScourge") + BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Desert, + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.DesertScourge") }); } public override void SendExtraAI(BinaryWriter writer) { + writer.Write(NPC.alpha); + writer.Write(NPC.dontTakeDamage); writer.Write(biomeEnrageTimer); writer.Write(playRoarSound); + writer.Write(NPC.localAI[2]); + writer.Write(NPC.localAI[3]); for (int i = 0; i < 4; i++) writer.Write(NPC.Calamity().newAI[i]); } public override void ReceiveExtraAI(BinaryReader reader) { + NPC.alpha = reader.ReadInt32(); + NPC.dontTakeDamage = reader.ReadBoolean(); biomeEnrageTimer = reader.ReadInt32(); playRoarSound = reader.ReadBoolean(); + NPC.localAI[2] = reader.ReadSingle(); + NPC.localAI[3] = reader.ReadSingle(); for (int i = 0; i < 4; i++) NPC.Calamity().newAI[i] = reader.ReadSingle(); } @@ -134,9 +162,23 @@ namespace CalamityMod.NPCs.DesertScourge { bool bossRush = BossRushEvent.BossRushActive; bool expertMode = Main.expertMode || bossRush; + bool masterMode = Main.masterMode || bossRush; bool revenge = CalamityWorld.revenge || bossRush; bool death = CalamityWorld.death || bossRush; + // Check for Nuisances + bool hide = (NPC.AnyNPCs(ModContent.NPCType()) || NPC.AnyNPCs(ModContent.NPCType())) && !masterMode; + if (hide) + { + NPC.Calamity().newAI[0] = 0f; + NPC.Calamity().newAI[1] = 0f; + NPC.Calamity().newAI[3] = 0f; + NPC.localAI[3] = 0f; + playRoarSound = false; + } + + NPC.dontTakeDamage = hide; + // Get a target if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) NPC.TargetClosest(); @@ -165,31 +207,54 @@ namespace CalamityMod.NPCs.DesertScourge enrageScale += 2f; } - // Percent life remaining + // Percent life remaining. float lifeRatio = NPC.life / (float)NPC.lifeMax; - if (revenge || lifeRatio < (expertMode ? 0.75f : 0.5f)) - NPC.Calamity().newAI[0] += 1f; + // Phases + bool phase2 = lifeRatio < 0.5f; - float burrowTimeGateValue = death ? 420f : 540f; - bool burrow = NPC.Calamity().newAI[0] >= burrowTimeGateValue; - bool resetTime = NPC.Calamity().newAI[0] >= burrowTimeGateValue + 600f; + // Summon the Nuisances. + if (phase2 && expertMode) + { + if (NPC.localAI[2] == 0f) + { + NPC.localAI[2] = 1f; + NPC.SpawnOnPlayer(NPC.FindClosestPlayer(), ModContent.NPCType()); + NPC.SpawnOnPlayer(NPC.FindClosestPlayer(), ModContent.NPCType()); + } + } + + // Only increment the burrow timer if the head is beneath the player, OR if the X distance is greater than a specified value. + if (NPC.Center.Y > Main.player[NPC.target].Center.Y || Math.Abs(NPC.Center.X - player.Center.X) > 480f) + { + if (revenge || lifeRatio < (expertMode ? 0.75f : 0.5f)) + NPC.Calamity().newAI[0] += 1f; + } + + bool burrow = NPC.Calamity().newAI[0] >= BurrowTimeGateValue; + bool resetTime = NPC.Calamity().newAI[0] >= BurrowResetTimeGateValue; bool lungeUpward = burrow && NPC.Calamity().newAI[1] == 1f; bool quickFall = NPC.Calamity().newAI[1] == 2f; - float speed = 0.09f; - float turnSpeed = 0.06f; + float burrowDistance = hide ? BurrowDistance_Hide : bossRush ? BurrowDistance_BossRush : BurrowDistance; + + float speed = death ? 0.18f : 0.15f; + float turnSpeed = death ? 0.36f : 0.3f; if (expertMode) { - float velocityScale = death ? 0.12f : 0.06f; - speed += velocityScale * (1f - lifeRatio); - float accelerationScale = death ? 0.075f : 0.05f; - turnSpeed += accelerationScale * (1f - lifeRatio); + speed += speed * 0.2f * (1f - lifeRatio); + turnSpeed += turnSpeed * 0.2f * (1f - lifeRatio); } - speed += 0.12f * enrageScale; - turnSpeed += 0.06f * enrageScale; + if (revenge) + { + speed += (death ? 0.06f : 0.05f) * (1f - lifeRatio); + turnSpeed += (death ? 0.12f : 0.1f) * (1f - lifeRatio); + } + + speed += 0.15f * enrageScale; + turnSpeed += 0.3f * enrageScale; if (Main.getGoodWorld) { @@ -197,129 +262,237 @@ namespace CalamityMod.NPCs.DesertScourge turnSpeed *= 1.2f; } - if (lungeUpward) + // Projectile spit (unused, for now) + /*if ((phase2 || death) && revenge && NPC.Distance(Main.player[NPC.target].Center) > 400f && (Main.player[NPC.target].Center - NPC.Center).SafeNormalize(Vector2.UnitY).ToRotation().AngleTowards(NPC.velocity.ToRotation(), MathHelper.PiOver4) == NPC.velocity.ToRotation()) { - speed *= 1.25f; + if (NPC.Calamity().newAI[0] % (death ? SpitGateValue_Death : SpitGateValue) == 0f) + { + SoundEngine.PlaySound(SoundID.NPCDeath11, NPC.Center); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Vector2 projectileVelocity = (Main.player[NPC.target].Center - NPC.Center).SafeNormalize(Vector2.UnitY) * (masterMode ? 10f : 8f); + int numProj = death ? 9 : 6; + int spread = masterMode ? 49 : 35; + if (masterMode) + { + numProj += 3; + spread += 14; + } + + float rotation = MathHelper.ToRadians(spread); + int type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + for (int i = 0; i < numProj; i++) + { + Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); + + for (int k = 0; k < 10; k++) + { + int dust = Dust.NewDust(NPC.Center + Vector2.Normalize(perturbedSpeed) * 5f, 10, 10, (int)CalamityDusts.SulphurousSeaAcid); + Main.dust[dust].velocity = perturbedSpeed; + } + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 5f, perturbedSpeed, type, damage, 0f, Main.myPlayer); + Main.projectile[proj].aiStyle = -1; + Main.projectile[proj].netUpdate = true; + } + } + } + } + }*/ + + // Sand splash + if (!quickFall) + { + if (lungeUpward) + { + if (NPC.localAI[3] == 0f) + { + Point headTileCenter = NPC.Top.ToTileCoordinates(); + Tile tileSafely = Framing.GetTileSafely(headTileCenter); + bool inSolidTile = tileSafely.HasUnactuatedTile; + bool finsInSolidTile = Framing.GetTileSafely(Main.npc[(int)NPC.ai[0]].Center.ToTileCoordinates()).HasUnactuatedTile; + if (!inSolidTile && finsInSolidTile && Collision.CanHit(NPC.Top, 1, 1, player.Center, 1, 1)) + { + NPC.localAI[3] = 1f; + SoundEngine.PlaySound(SoundID.Item74, NPC.Center); + + int bestY = headTileCenter.Y; + for (int j = 0; j < 20; j++) + { + if (bestY < 10) + break; + + if (!WorldGen.SolidTile(headTileCenter.X, bestY)) + break; + + bestY--; + } + + for (int k = 0; k < 20; k++) + { + if (bestY > Main.maxTilesY - 10) + break; + + if (WorldGen.ActiveAndWalkableTile(headTileCenter.X, bestY)) + break; + + bestY++; + } + + if (Main.netMode != NetmodeID.MultiplayerClient) + Projectile.NewProjectile(NPC.GetSource_FromAI(), new Vector2(headTileCenter.X * 16 + 8, bestY * 16 - 40), Vector2.Zero, ModContent.ProjectileType(), 0, 0f, Main.myPlayer); + } + } + } + else if (burrow) + { + if (NPC.localAI[3] == 0f) + { + Point headTileCenter = NPC.Center.ToTileCoordinates(); + Tile tileSafely = Framing.GetTileSafely(headTileCenter); + bool inSolidTile = tileSafely.HasUnactuatedTile; + if (inSolidTile && Collision.CanHit(NPC.Top, 1, 1, player.Center, 1, 1)) + { + NPC.localAI[3] = 1f; + SoundEngine.PlaySound(SoundID.Item74, NPC.Center); + + int bestY = headTileCenter.Y; + for (int j = 0; j < 20; j++) + { + if (bestY < 10) + break; + + if (!WorldGen.SolidTile(headTileCenter.X, bestY)) + break; + + bestY--; + } + + for (int k = 0; k < 20; k++) + { + if (bestY > Main.maxTilesY - 10) + break; + + if (WorldGen.ActiveAndWalkableTile(headTileCenter.X, bestY)) + break; + + bestY++; + } + + if (Main.netMode != NetmodeID.MultiplayerClient) + Projectile.NewProjectile(NPC.GetSource_FromAI(), new Vector2(headTileCenter.X * 16 + 8, bestY * 16 - 40), Vector2.Zero, ModContent.ProjectileType(), 0, 0f, Main.myPlayer); + } + } + } + } + + if (lungeUpward || burrow) + { + speed *= 1.5f; turnSpeed *= 1.5f; - if (NPC.Calamity().newAI[3] == 0f) - NPC.Calamity().newAI[3] = player.Center.Y - 600f; + if (NPC.Calamity().newAI[3] == 0f && lungeUpward) + NPC.Calamity().newAI[3] = player.Center.Y - LungeUpwardDistanceOffset; } if (NPC.ai[2] > 0f) NPC.realLife = (int)NPC.ai[2]; - NPC.alpha -= 42; - if (NPC.alpha < 0) - NPC.alpha = 0; + if (hide) + { + NPC.alpha += 3; + if (NPC.alpha > 255) + { + NPC.alpha = 255; + } + else + { + for (int dustIndex = 0; dustIndex < 2; dustIndex++) + { + int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.UnusedBrown, 0f, 0f, 100, default, 2f); + Main.dust[dust].noGravity = true; + Main.dust[dust].noLight = true; + } + } + } + else + { + NPC.alpha -= 42; + if (NPC.alpha < 0) + NPC.alpha = 0; + } if (Main.netMode != NetmodeID.MultiplayerClient) { - // become moist if in an aquatic biome + // Become moist if in an aquatic biome if (Main.zenithWorld && (player.ZoneBeach || player.Calamity().ZoneAbyss || player.Calamity().ZoneSunkenSea || player.Calamity().ZoneSulphur) && NPC.CountNPCS(ModContent.NPCType()) < 1) { - NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.position.X + (NPC.width / 2), (int)NPC.position.Y + (NPC.height / 2), ModContent.NPCType()); + NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType()); NPC.active = false; } } if (Main.netMode != NetmodeID.MultiplayerClient) { - if (!TailSpawned && NPC.ai[0] == 0f) + if (!tailSpawned && NPC.ai[0] == 0f) { - int Previous = NPC.whoAmI; - int minLength = death ? 40 : revenge ? 35 : expertMode ? 30 : 25; + int previous = NPC.whoAmI; + int minLength = death ? 24 : revenge ? 21 : expertMode ? 18 : 15; if (Main.getGoodWorld) minLength *= 3; + int bodyTypeAIVariable = 0; for (int i = 0; i < minLength + 1; i++) { int lol; if (i >= 0 && i < minLength) { - lol = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.position.X + (NPC.width / 2), (int)NPC.position.Y + (NPC.height / 2), ModContent.NPCType(), NPC.whoAmI); + if (i == 0) + bodyTypeAIVariable = 0; + else if (i == minLength - 1) + bodyTypeAIVariable = 30; + else if (i % 2 == 0) + bodyTypeAIVariable = 20; + else + bodyTypeAIVariable = 10; + + lol = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType(), NPC.whoAmI); + Main.npc[lol].ai[3] = bodyTypeAIVariable; } else - { - lol = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.position.X + (NPC.width / 2), (int)NPC.position.Y + (NPC.height / 2), ModContent.NPCType(), NPC.whoAmI); - } + lol = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType(), NPC.whoAmI); + Main.npc[lol].ai[2] = NPC.whoAmI; Main.npc[lol].realLife = NPC.whoAmI; - Main.npc[lol].ai[1] = Previous; - Main.npc[Previous].ai[0] = lol; + Main.npc[lol].ai[1] = previous; + Main.npc[previous].ai[0] = lol; NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, lol, 0f, 0f, 0f, 0); - Previous = lol; + previous = lol; } - TailSpawned = true; + + tailSpawned = true; } } - if (expertMode) - { - if (NPC.Calamity().newAI[2] < 180f) - NPC.Calamity().newAI[2] += 1f; - - if (NPC.SafeDirectionTo(player.Center).AngleBetween((NPC.rotation - MathHelper.PiOver2).ToRotationVector2()) < MathHelper.ToRadians(18f) && - NPC.Calamity().newAI[2] >= 180f && Vector2.Distance(NPC.Center, player.Center) > 320f && - Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height)) - { - if (NPC.Calamity().newAI[2] % 30f == 0f) - { - SoundEngine.PlaySound(SoundID.Item21, NPC.Center); - - float velocity = bossRush ? 6f : death ? 5.5f : 5f; - int type = ModContent.ProjectileType(); - int type2 = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); - Vector2 projectileVelocity = Vector2.Normalize(player.Center - NPC.Center) * velocity; - int baseProjectileAmt = bossRush ? 6 : death ? 4 : revenge ? 3 : 2; - int numProj = NPC.Calamity().newAI[2] % 60f == 0f ? (int)(baseProjectileAmt * 1.5) : baseProjectileAmt; - int spread = bossRush ? 18 : death ? 14 : revenge ? 12 : 10; - float rotation = MathHelper.ToRadians(spread); - for (int i = 0; i < numProj; i++) - { - Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) - perturbedSpeed *= Main.rand.NextFloat() + 0.5f; - - for (int k = 0; k < 10; k++) - Dust.NewDust(NPC.Center + Vector2.Normalize(perturbedSpeed) * 5f, 10, 10, 85, perturbedSpeed.X, perturbedSpeed.Y); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(perturbedSpeed) * 5f, perturbedSpeed, type, damage, 0f, Main.myPlayer); - if (Main.zenithWorld) - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(perturbedSpeed) * 3f, perturbedSpeed, type2, damage, 0f, Main.myPlayer); - } - } - } - - NPC.Calamity().newAI[2] += 1f; - if (NPC.Calamity().newAI[2] > 240f) - NPC.Calamity().newAI[2] = 0f; - } - } + if (NPC.life > Main.npc[(int)NPC.ai[0]].life) + NPC.life = Main.npc[(int)NPC.ai[0]].life; int tilePositionX = (int)(NPC.position.X / 16f) - 1; int tileWidthPosX = (int)((NPC.position.X + (float)NPC.width) / 16f) + 2; int tilePositionY = (int)(NPC.position.Y / 16f) - 1; int tileWidthPosY = (int)((NPC.position.Y + (float)NPC.height) / 16f) + 2; if (tilePositionX < 0) - { tilePositionX = 0; - } if (tileWidthPosX > Main.maxTilesX) - { tileWidthPosX = Main.maxTilesX; - } if (tilePositionY < 0) - { tilePositionY = 0; - } if (tileWidthPosY > Main.maxTilesY) - { tileWidthPosY = Main.maxTilesY; - } + bool shouldFly = lungeUpward; if (!shouldFly) { @@ -341,11 +514,12 @@ namespace CalamityMod.NPCs.DesertScourge } } } + if (!shouldFly) { NPC.localAI[1] = 1f; Rectangle rectangle = new Rectangle((int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height); - int directChaseDistance = 1000; + int directChaseDistance = expertMode ? 800 : 1000; if (enrageScale > 0f) directChaseDistance = 100; @@ -354,7 +528,7 @@ namespace CalamityMod.NPCs.DesertScourge { int rectWidth = directChaseDistance * 2; int rectHeight = directChaseDistance * 2; - for (int m = 0; m < 255; m++) + for (int m = 0; m < Main.maxPlayers; m++) { if (Main.player[m].active) { @@ -368,43 +542,49 @@ namespace CalamityMod.NPCs.DesertScourge } } } + if (shouldDirectlyChase) - { shouldFly = true; - } } } else - { NPC.localAI[1] = 0f; - } - float maxChaseSpeed = 16f; + if (NPC.velocity.X < 0f) + NPC.spriteDirection = 1; + else if (NPC.velocity.X > 0f) + NPC.spriteDirection = -1; + + float maxChaseSpeed = Main.zenithWorld ? SegmentVelocity_ZenithSeed : + Main.getGoodWorld ? SegmentVelocity_GoodWorld : + masterMode ? SegmentVelocity_Master : + expertMode ? SegmentVelocity_Expert : + SegmentVelocity_Normal; + if (burrow || lungeUpward) + maxChaseSpeed *= 1.5f; + if (expertMode) + maxChaseSpeed += maxChaseSpeed * 0.2f * (1f - lifeRatio); + if (player.dead) { shouldFly = false; NPC.velocity.Y += 1f; - if ((double)NPC.position.Y > Main.worldSurface * 16.0) + if ((double)NPC.position.Y > Main.worldSurface * 16D) { NPC.velocity.Y += 1f; - maxChaseSpeed = 32f; + maxChaseSpeed *= 2f; } - if ((double)NPC.position.Y > Main.rockLayer * 16.0) + + if ((double)NPC.position.Y > Main.rockLayer * 16D) { for (int a = 0; a < Main.maxNPCs; a++) { - if (Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || - Main.npc[a].type == ModContent.NPCType()) - { + if (Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType()) Main.npc[a].active = false; - } } } } - float speedCopy = speed; - float turnSpeedCopy = turnSpeed; - float burrowDistance = bossRush ? 500f : 800f; float burrowTarget = player.Center.Y + burrowDistance; float lungeTarget = NPC.Calamity().newAI[3]; Vector2 npcCenter = NPC.Center; @@ -422,7 +602,7 @@ namespace CalamityMod.NPCs.DesertScourge if (burrow && NPC.Center.Y >= burrowTarget - 16f) { NPC.Calamity().newAI[1] = 1f; - NPC.Calamity().newAI[2] = 0f; + NPC.localAI[3] = 0f; if (!playRoarSound) { SoundEngine.PlaySound(RoarSound, player.Center); @@ -431,15 +611,15 @@ namespace CalamityMod.NPCs.DesertScourge } // Quickly fall back down once above target - if (lungeUpward && NPC.Center.Y <= NPC.Calamity().newAI[3] + 600f - 420f) + if (lungeUpward && NPC.Center.Y <= NPC.Calamity().newAI[3] + LungeUpwardDistanceOffset - LungeUpwardCutoffDistance && Math.Abs(NPC.Center.X - player.Center.X) < 480f) { // Spit a huge spread of sand upwards that falls down SoundEngine.PlaySound(SoundID.NPCDeath13, NPC.Center); - float velocity = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 16f : bossRush ? 9f : death ? 7f : 6f; - int type = ModContent.ProjectileType(); + float velocity = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 16f : bossRush ? 10f : death ? 8.5f : revenge ? 8f : expertMode ? 7.5f : 6f; + int type = ModContent.ProjectileType(); int damage = NPC.GetProjectileDamage(type); - Vector2 projectileVelocity = Vector2.Normalize(NPC.Center + NPC.velocity * 10f - NPC.Center) * velocity; - int numProj = bossRush ? 30 : death ? 24 : revenge ? 20 : expertMode ? 16 : 12; + Vector2 projectileVelocity = (NPC.Center + NPC.velocity * 10f - NPC.Center).SafeNormalize(Vector2.UnitY) * velocity; + int numProj = bossRush ? 30 : death ? 24 : revenge ? 21 : expertMode ? 18 : 12; if (Main.getGoodWorld) numProj *= 2; @@ -450,7 +630,10 @@ namespace CalamityMod.NPCs.DesertScourge Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); for (int k = 0; k < 10; k++) - Dust.NewDust(NPC.Center + Vector2.Normalize(perturbedSpeed) * 5f, 10, 10, 85, perturbedSpeed.X, perturbedSpeed.Y); + { + int dust = Dust.NewDust(NPC.Center + Vector2.Normalize(perturbedSpeed) * 5f, 10, 10, (int)CalamityDusts.SulphurousSeaAcid); + Main.dust[dust].velocity = perturbedSpeed; + } if (Main.netMode != NetmodeID.MultiplayerClient) Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(perturbedSpeed) * 5f, perturbedSpeed, type, damage, 0f, Main.myPlayer); @@ -458,18 +641,20 @@ namespace CalamityMod.NPCs.DesertScourge NPC.TargetClosest(); NPC.Calamity().newAI[1] = 2f; + NPC.localAI[3] = 0f; playRoarSound = false; } // Quickly fall and reset variables once at target's Y position if (quickFall) { - NPC.velocity.Y += Main.getGoodWorld ? 1f : 0.5f; - if (NPC.Center.Y >= NPC.Calamity().newAI[3] + 600f) + NPC.velocity.Y += maxChaseSpeed * 0.02f; + if (NPC.Center.Y >= NPC.Calamity().newAI[3] + LungeUpwardDistanceOffset) { NPC.Calamity().newAI[0] = 0f; NPC.Calamity().newAI[1] = 0f; NPC.Calamity().newAI[3] = 0f; + NPC.localAI[3] = 0f; playRoarSound = false; } } @@ -479,48 +664,52 @@ namespace CalamityMod.NPCs.DesertScourge { NPC.Calamity().newAI[0] = 0f; NPC.Calamity().newAI[1] = 0f; + NPC.localAI[3] = 0f; } - if (!shouldFly) + if (hide && !player.dead) + { + NPC.SimpleFlyMovement((new Vector2(player.Center.X, burrowTarget) - NPC.Center).SafeNormalize(Vector2.UnitY) * maxChaseSpeed, turnSpeed); + } + else if (!shouldFly) { NPC.TargetClosest(); - NPC.velocity.Y = NPC.velocity.Y + 0.15f; + NPC.velocity.Y += 0.15f; if (NPC.velocity.Y > maxChaseSpeed) - { NPC.velocity.Y = maxChaseSpeed; - } - if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)maxChaseSpeed * 0.4) + + // This bool exists to stop the strange wiggle behavior when worms are falling down + bool slowXVelocity = Math.Abs(NPC.velocity.X) > speed; + if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < maxChaseSpeed * 0.4) { if (NPC.velocity.X < 0f) - { - NPC.velocity.X = NPC.velocity.X - speedCopy * 1.1f; - } + NPC.velocity.X -= speed * 1.1f; else - { - NPC.velocity.X = NPC.velocity.X + speedCopy * 1.1f; - } + NPC.velocity.X += speed * 1.1f; } else if (NPC.velocity.Y == maxChaseSpeed) { - if (NPC.velocity.X < playerX) + if (slowXVelocity) { - NPC.velocity.X = NPC.velocity.X + speedCopy; - } - else if (NPC.velocity.X > playerX) - { - NPC.velocity.X = NPC.velocity.X - speedCopy; + if (NPC.velocity.X < playerX) + NPC.velocity.X += speed; + else if (NPC.velocity.X > playerX) + NPC.velocity.X -= speed; } + else + NPC.velocity.X = 0f; } else if (NPC.velocity.Y > 4f) { - if (NPC.velocity.X < 0f) + if (slowXVelocity) { - NPC.velocity.X = NPC.velocity.X + speedCopy * 0.9f; + if (NPC.velocity.X < 0f) + NPC.velocity.X += speed * 0.9f; + else + NPC.velocity.X -= speed * 0.9f; } else - { - NPC.velocity.X = NPC.velocity.X - speedCopy * 0.9f; - } + NPC.velocity.X = 0f; } } else @@ -529,147 +718,240 @@ namespace CalamityMod.NPCs.DesertScourge { float soundDelay = targetDistance / 40f; if (soundDelay < 10f) - { soundDelay = 10f; - } if (soundDelay > 20f) - { soundDelay = 20f; - } + NPC.soundDelay = (int)soundDelay; SoundEngine.PlaySound(SoundID.WormDig, NPC.Center); } + targetDistance = (float)Math.Sqrt((double)(playerX * playerX + targettingPosition * targettingPosition)); float absolutePlayerX = Math.Abs(playerX); float absoluteTargetPos = Math.Abs(targettingPosition); float timeToReachTarget = maxChaseSpeed / targetDistance; playerX *= timeToReachTarget; targettingPosition *= timeToReachTarget; + if (((NPC.velocity.X > 0f && playerX > 0f) || (NPC.velocity.X < 0f && playerX < 0f)) && ((NPC.velocity.Y > 0f && targettingPosition > 0f) || (NPC.velocity.Y < 0f && targettingPosition < 0f))) { if (NPC.velocity.X < playerX) - { - NPC.velocity.X = NPC.velocity.X + turnSpeedCopy; - } + NPC.velocity.X += turnSpeed; else if (NPC.velocity.X > playerX) - { - NPC.velocity.X = NPC.velocity.X - turnSpeedCopy; - } + NPC.velocity.X -= turnSpeed; + if (NPC.velocity.Y < targettingPosition) - { - NPC.velocity.Y = NPC.velocity.Y + turnSpeedCopy; - } + NPC.velocity.Y += turnSpeed; else if (NPC.velocity.Y > targettingPosition) - { - NPC.velocity.Y = NPC.velocity.Y - turnSpeedCopy; - } + NPC.velocity.Y -= turnSpeed; } + if ((NPC.velocity.X > 0f && playerX > 0f) || (NPC.velocity.X < 0f && playerX < 0f) || (NPC.velocity.Y > 0f && targettingPosition > 0f) || (NPC.velocity.Y < 0f && targettingPosition < 0f)) { if (NPC.velocity.X < playerX) - { - NPC.velocity.X = NPC.velocity.X + speedCopy; - } + NPC.velocity.X += speed; else if (NPC.velocity.X > playerX) - { - NPC.velocity.X = NPC.velocity.X - speedCopy; - } + NPC.velocity.X -= speed; + if (NPC.velocity.Y < targettingPosition) - { - NPC.velocity.Y = NPC.velocity.Y + speedCopy; - } + NPC.velocity.Y += speed; else if (NPC.velocity.Y > targettingPosition) - { - NPC.velocity.Y = NPC.velocity.Y - speedCopy; - } - if ((double)Math.Abs(targettingPosition) < (double)maxChaseSpeed * 0.2 && ((NPC.velocity.X > 0f && playerX < 0f) || (NPC.velocity.X < 0f && playerX > 0f))) + NPC.velocity.Y -= speed; + + if ((double)Math.Abs(targettingPosition) < maxChaseSpeed * 0.2 && ((NPC.velocity.X > 0f && playerX < 0f) || (NPC.velocity.X < 0f && playerX > 0f))) { if (NPC.velocity.Y > 0f) - { - NPC.velocity.Y = NPC.velocity.Y + speedCopy * 2f; - } + NPC.velocity.Y += speed * 2f; else - { - NPC.velocity.Y = NPC.velocity.Y - speedCopy * 2f; - } + NPC.velocity.Y -= speed * 2f; } - if ((double)Math.Abs(playerX) < (double)maxChaseSpeed * 0.2 && ((NPC.velocity.Y > 0f && targettingPosition < 0f) || (NPC.velocity.Y < 0f && targettingPosition > 0f))) + + if ((double)Math.Abs(playerX) < maxChaseSpeed * 0.2 && ((NPC.velocity.Y > 0f && targettingPosition < 0f) || (NPC.velocity.Y < 0f && targettingPosition > 0f))) { if (NPC.velocity.X > 0f) - { - NPC.velocity.X = NPC.velocity.X + speedCopy * 2f; - } + NPC.velocity.X += speed * 2f; else - { - NPC.velocity.X = NPC.velocity.X - speedCopy * 2f; - } + NPC.velocity.X -= speed * 2f; } } else if (absolutePlayerX > absoluteTargetPos) { if (NPC.velocity.X < playerX) - { - NPC.velocity.X = NPC.velocity.X + speedCopy * 1.1f; - } + NPC.velocity.X += speed * 1.1f; else if (NPC.velocity.X > playerX) - { - NPC.velocity.X = NPC.velocity.X - speedCopy * 1.1f; - } - if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)maxChaseSpeed * 0.5) + NPC.velocity.X -= speed * 1.1f; + + if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < maxChaseSpeed * 0.5) { if (NPC.velocity.Y > 0f) - { - NPC.velocity.Y = NPC.velocity.Y + speedCopy; - } + NPC.velocity.Y += speed; else - { - NPC.velocity.Y = NPC.velocity.Y - speedCopy; - } + NPC.velocity.Y -= speed; } } else { if (NPC.velocity.Y < targettingPosition) - { - NPC.velocity.Y = NPC.velocity.Y + speedCopy * 1.1f; - } + NPC.velocity.Y += speed * 1.1f; else if (NPC.velocity.Y > targettingPosition) - { - NPC.velocity.Y = NPC.velocity.Y - speedCopy * 1.1f; - } - if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)maxChaseSpeed * 0.5) + NPC.velocity.Y -= speed * 1.1f; + + if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < maxChaseSpeed * 0.5) { if (NPC.velocity.X > 0f) - { - NPC.velocity.X = NPC.velocity.X + speedCopy; - } + NPC.velocity.X += speed; else - { - NPC.velocity.X = NPC.velocity.X - speedCopy; - } + NPC.velocity.X -= speed; } } } - NPC.rotation = (float)Math.Atan2((double)NPC.velocity.Y, (double)NPC.velocity.X) + 1.57f; + + if ((!burrow || lungeUpward) && !quickFall && !hide) + { + Vector2 destination = lungeUpward ? new Vector2(player.Center.X, lungeTarget) : player.Center; + if (NPC.Distance(destination) > (lungeUpward ? 1000f : 2000f)) + NPC.velocity += (destination - NPC.Center).SafeNormalize(Vector2.UnitY) * turnSpeed; + } + + // Calculate contact damage based on velocity + float minimalContactDamageVelocity = maxChaseSpeed * 0.25f; + float minimalDamageVelocity = maxChaseSpeed * 0.5f; + if (hide) + { + NPC.damage = 0; + } + else + { + if (NPC.velocity.Length() <= minimalContactDamageVelocity) + { + NPC.damage = (int)Math.Round(NPC.defDamage * 0.5); + } + else + { + float velocityDamageScalar = MathHelper.Clamp((NPC.velocity.Length() - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); + NPC.damage = (int)MathHelper.Lerp((float)Math.Round(NPC.defDamage * 0.5), NPC.defDamage, velocityDamageScalar); + } + } + + NPC.rotation = (float)Math.Atan2((double)NPC.velocity.Y, (double)NPC.velocity.X) + MathHelper.PiOver2; + if (shouldFly) { if (NPC.localAI[0] != 1f) - { NPC.netUpdate = true; - } + NPC.localAI[0] = 1f; } else { if (NPC.localAI[0] != 0f) - { NPC.netUpdate = true; - } + NPC.localAI[0] = 0f; } + if (((NPC.velocity.X > 0f && NPC.oldVelocity.X < 0f) || (NPC.velocity.X < 0f && NPC.oldVelocity.X > 0f) || (NPC.velocity.Y > 0f && NPC.oldVelocity.Y < 0f) || (NPC.velocity.Y < 0f && NPC.oldVelocity.Y > 0f)) && !NPC.justHit) - { NPC.netUpdate = true; + } + + public override bool CheckActive() => false; + + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + Rectangle targetHitbox = target.Hitbox; + + float hitboxTopLeft = Vector2.Distance(NPC.Center, targetHitbox.TopLeft()); + float hitboxTopRight = Vector2.Distance(NPC.Center, targetHitbox.TopRight()); + float hitboxBotLeft = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft()); + float hitboxBotRight = Vector2.Distance(NPC.Center, targetHitbox.BottomRight()); + + float minDist = hitboxTopLeft; + if (hitboxTopRight < minDist) + minDist = hitboxTopRight; + if (hitboxBotLeft < minDist) + minDist = hitboxBotLeft; + if (hitboxBotRight < minDist) + minDist = hitboxBotRight; + + return minDist <= 60f * NPC.scale && NPC.alpha <= 0; + } + + public override void FindFrame(int frameHeight) + { + // Open mouth to prepare for a nibble ;3 + // Also open mouth if about to spit a projectile spread + bool burrow = NPC.Calamity().newAI[0] >= BurrowTimeGateValue; + bool lungeUpward = burrow && NPC.Calamity().newAI[1] == 1f; + + bool aboutToSpitSpread = lungeUpward && NPC.Center.Y <= NPC.Calamity().newAI[3] + LungeUpwardDistanceOffset - LungeUpwardCutoffDistance * 0.25f; + bool openMouth = NPC.Distance(Main.player[NPC.target].Center) < OpenMouthForBiteDistance && + (Main.player[NPC.target].Center - NPC.Center).SafeNormalize(Vector2.UnitY).ToRotation().AngleTowards(NPC.velocity.ToRotation(), MathHelper.PiOver4) == NPC.velocity.ToRotation() && + NPC.ai[3] == 0f; + + bool closeMouthBite = NPC.ai[3] == 1f; + if (closeMouthBite) + { + // Force mouth open for a bite if it's not open. + if (NPC.frame.Y < frameHeight * OpenMouthStopFrame) + { + NPC.frame.Y = frameHeight * OpenMouthStopFrame; + NPC.frameCounter = 0D; + } + + NPC.frameCounter += 1D; + if (NPC.frameCounter > 4D) + { + NPC.frame.Y += frameHeight; + NPC.frameCounter = 0D; + } + if (NPC.frame.Y >= frameHeight * Main.npcFrameCount[NPC.type]) + { + NPC.ai[3] = 2f; + NPC.netUpdate = true; + NPC.netSpam = 0; + NPC.frame.Y = 0; + } + } + else if (openMouth || aboutToSpitSpread) + { + NPC.frameCounter += 1D; + if (NPC.frameCounter > 4D) + { + NPC.frame.Y += frameHeight; + NPC.frameCounter = 0D; + } + if (NPC.frame.Y >= frameHeight * OpenMouthStopFrame) + NPC.frame.Y = frameHeight * OpenMouthStopFrame; + } + + // Close mouth. + else + { + if (NPC.frame.Y > 0) + { + if (NPC.frame.Y >= frameHeight * Main.npcFrameCount[NPC.type]) + { + NPC.frame.Y = 0; + NPC.ai[3] = 0f; + NPC.netUpdate = true; + NPC.netSpam = 0; + } + else + { + NPC.frameCounter += 1D; + if (NPC.frameCounter > 4D) + { + NPC.frame.Y -= frameHeight; + NPC.frameCounter = 0D; + } + } + } + else + { + NPC.ai[3] = 0f; + NPC.netUpdate = true; + NPC.netSpam = 0; + } } } @@ -682,7 +964,7 @@ namespace CalamityMod.NPCs.DesertScourge { CalamityGlobalNPC.SetNewBossJustDowned(NPC); - // If Desert Scourge has not been killed yet, notify players that the Sunken Sea is open and Sandstorms can happen + // If Desert Scourge has not been killed yet, notify players that the Sunken Sea is open and Sandstorms can happen. if (!DownedBossSystem.downedDesertScourge) { string key = "Mods.CalamityMod.Status.Progression.OpenSunkenSea"; @@ -697,7 +979,7 @@ namespace CalamityMod.NPCs.DesertScourge CalamityUtils.StartSandstorm(); } - // Mark Desert Scourge as dead + // Mark Desert Scourge as dead. DownedBossSystem.downedDesertScourge = true; CalamityNetcode.SyncWorld(); } @@ -718,7 +1000,7 @@ namespace CalamityMod.NPCs.DesertScourge npcLoot.Add(ItemDropRule.BossBag(ModContent.ItemType())); // Extraneous potions - npcLoot.DefineConditionalDropSet(() => true).Add(DropHelper.PerPlayer(ItemID.LesserHealingPotion, 1, 5, 15), hideLootReport: true); // Healing Potions don't show up in the Bestiary + npcLoot.DefineConditionalDropSet(() => true).Add(DropHelper.PerPlayer(ItemID.LesserHealingPotion, 1, 5, 15), hideLootReport: true); // Healing Potions don't show up in the Bestiary. // Normal drops: Everything that would otherwise be in the bag var normalOnly = npcLoot.DefineNormalOnlyDropSet(); @@ -746,7 +1028,6 @@ namespace CalamityMod.NPCs.DesertScourge // Equipment normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); - normalOnly.Add(ModContent.ItemType(), DropHelper.NormalWeaponDropRateFraction); normalOnly.Add(ModContent.ItemType(), DropHelper.NormalWeaponDropRateFraction); // Fishing @@ -769,20 +1050,19 @@ namespace CalamityMod.NPCs.DesertScourge public override void HitEffect(NPC.HitInfo hit) { for (int k = 0; k < 3; k++) - { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); - } + if (NPC.life <= 0) { if (Main.netMode != NetmodeID.Server) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ScourgeHead").Type, NPC.scale); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ScourgeHead2").Type, NPC.scale); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ScourgeHead3").Type, NPC.scale); } + for (int k = 0; k < 10; k++) - { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); - } } } @@ -790,19 +1070,25 @@ namespace CalamityMod.NPCs.DesertScourge { if (NPC.IsABestiaryIconDummy) NPC.Opacity = 1f; + return true; } public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { - NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) { if (hurtInfo.Damage > 0) - target.AddBuff(BuffID.Bleeding, 600, true); + { + target.AddBuff(BuffID.Bleeding, 600); + NPC.ai[3] = 1f; + NPC.netUpdate = true; + NPC.netSpam = 0; + } } public override Color? GetAlpha(Color drawColor) diff --git a/NPCs/DesertScourge/DesertScourgeHead.png b/NPCs/DesertScourge/DesertScourgeHead.png index 196d7a6133..3c4301a49c 100644 Binary files a/NPCs/DesertScourge/DesertScourgeHead.png and b/NPCs/DesertScourge/DesertScourgeHead.png differ diff --git a/NPCs/DesertScourge/DesertScourgeHead_Head_Boss.png b/NPCs/DesertScourge/DesertScourgeHead_Head_Boss.png index a211f7a892..6b3ecf7b14 100644 Binary files a/NPCs/DesertScourge/DesertScourgeHead_Head_Boss.png and b/NPCs/DesertScourge/DesertScourgeHead_Head_Boss.png differ diff --git a/NPCs/DesertScourge/DesertScourgeTail.cs b/NPCs/DesertScourge/DesertScourgeTail.cs index cf3751c621..abf6aca169 100644 --- a/NPCs/DesertScourge/DesertScourgeTail.cs +++ b/NPCs/DesertScourge/DesertScourgeTail.cs @@ -1,6 +1,8 @@ using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; +using System; +using System.IO; using Terraria; using Terraria.ID; using Terraria.Localization; @@ -11,6 +13,7 @@ namespace CalamityMod.NPCs.DesertScourge public class DesertScourgeTail : ModNPC { public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.DesertScourgeHead.DisplayName"); + public override void SetStaticDefaults() { this.HideFromBestiary(); @@ -19,12 +22,12 @@ namespace CalamityMod.NPCs.DesertScourge public override void SetDefaults() { NPC.GetNPCDamage(); - NPC.width = 32; - NPC.height = 48; + NPC.width = 104; + NPC.height = 104; NPC.defense = 9; NPC.DR_NERD(0.1f); - NPC.LifeMaxNERB(2500, 3000, 1650000); + NPC.LifeMaxNERB(4200, 5000, 1650000); if (Main.getGoodWorld) NPC.lifeMax *= 4; @@ -38,21 +41,11 @@ namespace CalamityMod.NPCs.DesertScourge NPC.behindTiles = true; NPC.noGravity = true; NPC.noTileCollide = true; - NPC.canGhostHeal = false; NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath1; NPC.netAlways = true; NPC.dontCountMe = true; - if (BossRushEvent.BossRushActive) - NPC.scale *= 1.25f; - else if (CalamityWorld.death) - NPC.scale *= 1.2f; - else if (CalamityWorld.revenge) - NPC.scale *= 1.15f; - else if (Main.expertMode) - NPC.scale *= 1.1f; - if (Main.getGoodWorld) NPC.scale *= 0.4f; @@ -61,16 +54,40 @@ namespace CalamityMod.NPCs.DesertScourge NPC.Calamity().VulnerableToWater = true; } - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + public override void SendExtraAI(BinaryWriter writer) { - return false; + writer.Write(NPC.alpha); + writer.Write(NPC.dontTakeDamage); } + public override void ReceiveExtraAI(BinaryReader reader) + { + NPC.alpha = reader.ReadInt32(); + NPC.dontTakeDamage = reader.ReadBoolean(); + } + + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) => false; + public override void AI() { + bool bossRush = BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || bossRush; + bool masterMode = Main.masterMode || bossRush; + if (NPC.ai[2] > 0f) NPC.realLife = (int)NPC.ai[2]; + if (NPC.life > Main.npc[(int)NPC.ai[1]].life) + NPC.life = Main.npc[(int)NPC.ai[1]].life; + + NPC.dontTakeDamage = Main.npc[(int)NPC.ai[1]].dontTakeDamage; + + // Percent life remaining + float lifeRatio = NPC.life / (float)NPC.lifeMax; + + // Phases + bool phase2 = lifeRatio < 0.5f; + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) NPC.TargetClosest(); @@ -104,34 +121,49 @@ namespace CalamityMod.NPCs.DesertScourge if (NPC.alpha < 0) NPC.alpha = 0; } + else + { + NPC.alpha = Main.npc[(int)NPC.ai[1]].alpha; + if (NPC.alpha != 255 && NPC.dontTakeDamage) + { + for (int dustIndex = 0; dustIndex < 2; dustIndex++) + { + int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.UnusedBrown, 0f, 0f, 100, default, 2f); + Main.dust[dust].noGravity = true; + Main.dust[dust].noLight = true; + } + } + } if (Main.player[NPC.target].dead) NPC.TargetClosest(false); - Vector2 segmentTilePos = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); - float playerXPos = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); - float playerYPos = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2); + Vector2 segmentTilePos = NPC.Center; + float playerXPos = Main.player[NPC.target].Center.X; + float playerYPos = Main.player[NPC.target].Center.Y; playerXPos = (float)((int)(playerXPos / 16f) * 16); playerYPos = (float)((int)(playerYPos / 16f) * 16); segmentTilePos.X = (float)((int)(segmentTilePos.X / 16f) * 16); segmentTilePos.Y = (float)((int)(segmentTilePos.Y / 16f) * 16); playerXPos -= segmentTilePos.X; playerYPos -= segmentTilePos.Y; - float playerDistance = (float)System.Math.Sqrt((double)(playerXPos * playerXPos + playerYPos * playerYPos)); + float playerDistance = (float)Math.Sqrt((double)(playerXPos * playerXPos + playerYPos * playerYPos)); if (NPC.ai[1] > 0f && NPC.ai[1] < (float)Main.npc.Length) { try { - segmentTilePos = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); - playerXPos = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - segmentTilePos.X; - playerYPos = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - segmentTilePos.Y; + segmentTilePos = NPC.Center; + playerXPos = Main.npc[(int)NPC.ai[1]].Center.X - segmentTilePos.X; + playerYPos = Main.npc[(int)NPC.ai[1]].Center.Y - segmentTilePos.Y; } catch { } - NPC.rotation = (float)System.Math.Atan2((double)playerYPos, (double)playerXPos) + 1.57f; - playerDistance = (float)System.Math.Sqrt((double)(playerXPos * playerXPos + playerYPos * playerYPos)); - playerDistance = (playerDistance - (float)(NPC.width)) / playerDistance; + NPC.rotation = (float)Math.Atan2((double)playerYPos, (double)playerXPos) + MathHelper.PiOver2; + playerDistance = (float)Math.Sqrt((double)(playerXPos * playerXPos + playerYPos * playerYPos)); + + int segmentOffset = 70; + playerDistance = (playerDistance - segmentOffset) / playerDistance; playerXPos *= playerDistance; playerYPos *= playerDistance; NPC.velocity = Vector2.Zero; @@ -143,41 +175,84 @@ namespace CalamityMod.NPCs.DesertScourge else if (playerXPos > 0f) NPC.spriteDirection = -1; } + + NPC head = Main.npc[(int)NPC.ai[2]]; + float burrowTimeGateValue = DesertScourgeHead.BurrowTimeGateValue; + bool burrow = head.Calamity().newAI[0] >= burrowTimeGateValue; + bool lungeUpward = burrow && head.Calamity().newAI[1] == 1f; + bool quickFall = head.Calamity().newAI[1] == 2f; + + // Calculate contact damage based on velocity + float maxChaseSpeed = Main.zenithWorld ? DesertScourgeHead.SegmentVelocity_ZenithSeed : + Main.getGoodWorld ? DesertScourgeHead.SegmentVelocity_GoodWorld : + masterMode ? DesertScourgeHead.SegmentVelocity_Master : + expertMode ? DesertScourgeHead.SegmentVelocity_Expert : + DesertScourgeHead.SegmentVelocity_Normal; + if (burrow || lungeUpward) + maxChaseSpeed *= 1.5f; + if (expertMode) + maxChaseSpeed += maxChaseSpeed * 0.2f * (1f - lifeRatio); + + float minimalContactDamageVelocity = maxChaseSpeed * 0.25f; + float minimalDamageVelocity = maxChaseSpeed * 0.5f; + float bodyAndTailVelocity = (NPC.position - NPC.oldPosition).Length(); + if (bodyAndTailVelocity <= minimalContactDamageVelocity || NPC.dontTakeDamage) + { + NPC.damage = 0; + } + else + { + float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); + NPC.damage = (int)MathHelper.Lerp(0f, NPC.defDamage, velocityDamageScalar); + } + } + + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + Rectangle targetHitbox = target.Hitbox; + + float hitboxTopLeft = Vector2.Distance(NPC.Center, targetHitbox.TopLeft()); + float hitboxTopRight = Vector2.Distance(NPC.Center, targetHitbox.TopRight()); + float hitboxBotLeft = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft()); + float hitboxBotRight = Vector2.Distance(NPC.Center, targetHitbox.BottomRight()); + + float minDist = hitboxTopLeft; + if (hitboxTopRight < minDist) + minDist = hitboxTopRight; + if (hitboxBotLeft < minDist) + minDist = hitboxBotLeft; + if (hitboxBotRight < minDist) + minDist = hitboxBotRight; + + return minDist <= 30f * NPC.scale && NPC.alpha <= 0; } public override void HitEffect(NPC.HitInfo hit) { for (int k = 0; k < 3; k++) - { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); - } + if (NPC.life <= 0) { if (Main.netMode != NetmodeID.Server) - { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ScourgeTail").Type, NPC.scale); - } + for (int k = 0; k < 10; k++) - { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); - } } } - public override bool CheckActive() - { - return false; - } + public override bool CheckActive() => false; public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { - NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); } public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) { if (hurtInfo.Damage > 0) - target.AddBuff(BuffID.Bleeding, 180, true); + target.AddBuff(BuffID.Bleeding, 180); } public override Color? GetAlpha(Color drawColor) diff --git a/NPCs/DesertScourge/DesertScourgeTail.png b/NPCs/DesertScourge/DesertScourgeTail.png index b2ca84df81..11beb1f0b9 100644 Binary files a/NPCs/DesertScourge/DesertScourgeTail.png and b/NPCs/DesertScourge/DesertScourgeTail.png differ diff --git a/NPCs/DesertScourge/DesertScourge_BossChecklist.png b/NPCs/DesertScourge/DesertScourge_BossChecklist.png index 18419a3151..a529f641c3 100644 Binary files a/NPCs/DesertScourge/DesertScourge_BossChecklist.png and b/NPCs/DesertScourge/DesertScourge_BossChecklist.png differ diff --git a/NPCs/DevourerofGods/CosmicGuardianBody.cs b/NPCs/DevourerofGods/CosmicGuardianBody.cs index f9eda53cda..184958c7f5 100644 --- a/NPCs/DevourerofGods/CosmicGuardianBody.cs +++ b/NPCs/DevourerofGods/CosmicGuardianBody.cs @@ -1,8 +1,11 @@ -using CalamityMod.Buffs.DamageOverTime; +using System.IO; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; +using CalamityMod.Events; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System.IO; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.ID; @@ -14,9 +17,16 @@ namespace CalamityMod.NPCs.DevourerofGods { public int invinceTime = 180; public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.CosmicGuardianHead.DisplayName"); + + public static Asset GlowTexture; + public override void SetStaticDefaults() { this.HideFromBestiary(); + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -38,11 +48,14 @@ namespace CalamityMod.NPCs.DevourerofGods NPC.behindTiles = true; NPC.noGravity = true; NPC.noTileCollide = true; - NPC.canGhostHeal = false; NPC.HitSound = SoundID.NPCHit4; NPC.DeathSound = SoundID.NPCDeath14; NPC.netAlways = true; NPC.dontCountMe = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SendExtraAI(BinaryWriter writer) @@ -106,7 +119,7 @@ namespace CalamityMod.NPCs.DevourerofGods NPC.Opacity = Main.npc[(int)NPC.ai[2]].Opacity; - Vector2 segmentPosition = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); + Vector2 segmentPosition = NPC.Center; float targetX = Main.player[NPC.target].position.X + (Main.player[NPC.target].width / 2); float targetY = Main.player[NPC.target].position.Y + (Main.player[NPC.target].height / 2); targetX = (int)(targetX / 16f) * 16; @@ -120,7 +133,7 @@ namespace CalamityMod.NPCs.DevourerofGods { try { - segmentPosition = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); + segmentPosition = NPC.Center; targetX = Main.npc[(int)NPC.ai[1]].position.X + (Main.npc[(int)NPC.ai[1]].width / 2) - segmentPosition.X; targetY = Main.npc[(int)NPC.ai[1]].position.Y + (Main.npc[(int)NPC.ai[1]].height / 2) - segmentPosition.Y; } @@ -137,6 +150,21 @@ namespace CalamityMod.NPCs.DevourerofGods NPC.position.X = NPC.position.X + targetX; NPC.position.Y = NPC.position.Y + targetY; } + + // Calculate contact damage based on velocity + float segmentVelocity = BossRushEvent.BossRushActive ? 30f : CalamityWorld.revenge ? 25f : 23f; + float minimalContactDamageVelocity = segmentVelocity * 0.25f; + float minimalDamageVelocity = segmentVelocity * 0.5f; + float bodyAndTailVelocity = (NPC.position - NPC.oldPosition).Length(); + if (bodyAndTailVelocity <= minimalContactDamageVelocity) + { + NPC.damage = 0; + } + else + { + float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); + NPC.damage = (int)MathHelper.Lerp(0f, NPC.defDamage, velocityDamageScalar); + } } public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) @@ -153,7 +181,7 @@ namespace CalamityMod.NPCs.DevourerofGods drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/DevourerofGods/CosmicGuardianBodyGlow").Value; + texture2D15 = GlowTexture.Value; Color glowmaskColor = Color.Lerp(Color.White, Color.Fuchsia, 0.5f); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); @@ -192,7 +220,7 @@ namespace CalamityMod.NPCs.DevourerofGods NPC.position.Y = NPC.position.Y - (float)(NPC.height / 2); for (int i = 0; i < 10; i++) { - int cosmiliteDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + int cosmiliteDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[cosmiliteDust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -202,10 +230,10 @@ namespace CalamityMod.NPCs.DevourerofGods } for (int j = 0; j < 20; j++) { - int cosmiliteDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); + int cosmiliteDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); Main.dust[cosmiliteDust2].noGravity = true; Main.dust[cosmiliteDust2].velocity *= 5f; - cosmiliteDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + cosmiliteDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[cosmiliteDust2].velocity *= 2f; } } diff --git a/NPCs/DevourerofGods/CosmicGuardianHead.cs b/NPCs/DevourerofGods/CosmicGuardianHead.cs index 24aa6058cd..72df92eb3b 100644 --- a/NPCs/DevourerofGods/CosmicGuardianHead.cs +++ b/NPCs/DevourerofGods/CosmicGuardianHead.cs @@ -1,11 +1,12 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using System.IO; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.GameContent.Bestiary; @@ -21,10 +22,13 @@ namespace CalamityMod.NPCs.DevourerofGods private const int maxLength = 11; private int invinceTime = 180; + public static Asset GlowTexture; + public static Asset GlowTexture2; + public override void SetStaticDefaults() { NPCID.Sets.BossBestiaryPriority.Add(Type); - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { Scale = 0.75f, PortraitScale = 0.75f, @@ -35,6 +39,11 @@ namespace CalamityMod.NPCs.DevourerofGods value.Position.X += 62f; value.Position.Y += 35f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + GlowTexture2 = ModContent.Request(Texture + "Glow2", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -54,10 +63,13 @@ namespace CalamityMod.NPCs.DevourerofGods NPC.behindTiles = true; NPC.noGravity = true; NPC.noTileCollide = true; - NPC.canGhostHeal = false; NPC.HitSound = SoundID.NPCHit4; NPC.DeathSound = SoundID.NPCDeath14; NPC.netAlways = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -65,9 +77,9 @@ namespace CalamityMod.NPCs.DevourerofGods int associatedNPCType = ModContent.NPCType(); bestiaryEntry.UIInfoProvider = new CommonEnemyUICollectionInfoProvider(ContentSamples.NpcBestiaryCreditIdsByNpcNetIds[associatedNPCType], quickUnlock: true); - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.CosmicGuardian") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.CosmicGuardian") }); } @@ -136,7 +148,7 @@ namespace CalamityMod.NPCs.DevourerofGods if (CalamityGlobalNPC.DoGHead < 0 || !Main.npc[CalamityGlobalNPC.DoGHead].active) { NPC.velocity.Y -= 4f; - + if ((double)NPC.position.Y < Main.topWorld + 16f) { for (int a = 0; a < Main.maxNPCs; a++) @@ -175,11 +187,12 @@ namespace CalamityMod.NPCs.DevourerofGods return; } - Vector2 segmentDirection = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); + Vector2 segmentDirection = NPC.Center; float dogHeadX = Main.npc[CalamityGlobalNPC.DoGHead].position.X + (Main.npc[CalamityGlobalNPC.DoGHead].width / 2); float dogHeadY = Main.npc[CalamityGlobalNPC.DoGHead].position.Y + (Main.npc[CalamityGlobalNPC.DoGHead].height / 2); - float maxDistanceFromDoG = BossRushEvent.BossRushActive ? 30f : CalamityWorld.revenge ? 25f : 23f; + float segmentVelocity = BossRushEvent.BossRushActive ? 30f : CalamityWorld.revenge ? 25f : 23f; float velocityMult = BossRushEvent.BossRushActive ? 0.9f : CalamityWorld.revenge ? 0.75f : 0.23f; + float maxDistanceFromDoGHead = 160f; if (increaseSpeedMore) velocityMult *= 4f; @@ -191,18 +204,18 @@ namespace CalamityMod.NPCs.DevourerofGods if (Main.npc[i].active && (Main.npc[i].type == NPC.type || Main.npc[i].type == ModContent.NPCType()) && i != NPC.whoAmI) { Vector2 distFromHead = Main.npc[i].Center - NPC.Center; - if (distFromHead.Length() < 400f) + if (distFromHead.Length() < maxDistanceFromDoGHead) { distFromHead.Normalize(); - distFromHead *= 400f; + distFromHead *= maxDistanceFromDoGHead; dogHeadX -= distFromHead.X; dogHeadY -= distFromHead.Y; } } } - float higherMaxDistance = maxDistanceFromDoG * 1.3f; - float lowerMaxDistance = maxDistanceFromDoG * 0.7f; + float higherMaxDistance = segmentVelocity * 1.3f; + float lowerMaxDistance = segmentVelocity * 0.7f; float npcSpeed = NPC.velocity.Length(); if (npcSpeed > 0f) { @@ -227,7 +240,7 @@ namespace CalamityMod.NPCs.DevourerofGods float targetDistance = (float)Math.Sqrt(dogHeadX * dogHeadX + dogHeadY * dogHeadY); float absoluteDoGX = Math.Abs(dogHeadX); float absoluteDoGY = Math.Abs(dogHeadY); - float timeToReachTarget = maxDistanceFromDoG / targetDistance; + float timeToReachTarget = segmentVelocity / targetDistance; dogHeadX *= timeToReachTarget; dogHeadY *= timeToReachTarget; if ((NPC.velocity.X > 0f && dogHeadX > 0f) || (NPC.velocity.X < 0f && dogHeadX < 0f) || (NPC.velocity.Y > 0f && dogHeadY > 0f) || (NPC.velocity.Y < 0f && dogHeadY < 0f)) @@ -254,7 +267,7 @@ namespace CalamityMod.NPCs.DevourerofGods NPC.velocity.Y = NPC.velocity.Y - velocityMult; } } - if (Math.Abs(dogHeadY) < maxDistanceFromDoG * 0.2 && ((NPC.velocity.X > 0f && dogHeadX < 0f) || (NPC.velocity.X < 0f && dogHeadX > 0f))) + if (Math.Abs(dogHeadY) < segmentVelocity * 0.2 && ((NPC.velocity.X > 0f && dogHeadX < 0f) || (NPC.velocity.X < 0f && dogHeadX > 0f))) { if (NPC.velocity.Y > 0f) { @@ -265,7 +278,7 @@ namespace CalamityMod.NPCs.DevourerofGods NPC.velocity.Y = NPC.velocity.Y - velocityMult * 2f; } } - if (Math.Abs(dogHeadX) < maxDistanceFromDoG * 0.2 && ((NPC.velocity.Y > 0f && dogHeadY < 0f) || (NPC.velocity.Y < 0f && dogHeadY > 0f))) + if (Math.Abs(dogHeadX) < segmentVelocity * 0.2 && ((NPC.velocity.Y > 0f && dogHeadY < 0f) || (NPC.velocity.Y < 0f && dogHeadY > 0f))) { if (NPC.velocity.X > 0f) { @@ -289,7 +302,7 @@ namespace CalamityMod.NPCs.DevourerofGods { NPC.velocity.X = NPC.velocity.X - velocityMult * 1.1f; //changed from 1.1 } - if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < maxDistanceFromDoG * 0.5) + if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < segmentVelocity * 0.5) { if (NPC.velocity.Y > 0f) { @@ -311,7 +324,7 @@ namespace CalamityMod.NPCs.DevourerofGods { NPC.velocity.Y = NPC.velocity.Y - velocityMult * 1.1f; } - if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < maxDistanceFromDoG * 0.5) + if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < segmentVelocity * 0.5) { if (NPC.velocity.X > 0f) { @@ -324,7 +337,21 @@ namespace CalamityMod.NPCs.DevourerofGods } } } - NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X) + 1.57f; + + // Calculate contact damage based on velocity + float minimalContactDamageVelocity = segmentVelocity * 0.25f; + float minimalDamageVelocity = segmentVelocity * 0.5f; + if (NPC.velocity.Length() <= minimalContactDamageVelocity) + { + NPC.damage = (int)Math.Round(NPC.defDamage * 0.5); + } + else + { + float velocityDamageScalar = MathHelper.Clamp((NPC.velocity.Length() - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); + NPC.damage = (int)MathHelper.Lerp((float)Math.Round(NPC.defDamage * 0.5), NPC.defDamage, velocityDamageScalar); + } + + NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X) + MathHelper.PiOver2; } public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) @@ -344,12 +371,12 @@ namespace CalamityMod.NPCs.DevourerofGods distFromHead3 += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, distFromHead3, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/DevourerofGods/CosmicGuardianHeadGlow").Value; + texture2D15 = GlowTexture.Value; Color glowmaskColor = Color.Lerp(Color.White, Color.Fuchsia, 0.5f); spriteBatch.Draw(texture2D15, distFromHead3, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/DevourerofGods/CosmicGuardianHeadGlow2").Value; + texture2D15 = GlowTexture2.Value; glowmaskColor = Color.Lerp(Color.White, Color.Cyan, 0.5f); spriteBatch.Draw(texture2D15, distFromHead3, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); @@ -397,7 +424,7 @@ namespace CalamityMod.NPCs.DevourerofGods NPC.position.Y = NPC.position.Y - (float)(NPC.height / 2); for (int i = 0; i < 15; i++) { - int cosmiliteDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + int cosmiliteDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[cosmiliteDust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -407,10 +434,10 @@ namespace CalamityMod.NPCs.DevourerofGods } for (int j = 0; j < 30; j++) { - int cosmiliteDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); + int cosmiliteDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); Main.dust[cosmiliteDust2].noGravity = true; Main.dust[cosmiliteDust2].velocity *= 5f; - cosmiliteDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + cosmiliteDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[cosmiliteDust2].velocity *= 2f; } } diff --git a/NPCs/DevourerofGods/CosmicGuardianTail.cs b/NPCs/DevourerofGods/CosmicGuardianTail.cs index f7688b5818..5d2c622fa4 100644 --- a/NPCs/DevourerofGods/CosmicGuardianTail.cs +++ b/NPCs/DevourerofGods/CosmicGuardianTail.cs @@ -1,8 +1,11 @@ -using CalamityMod.Buffs.DamageOverTime; +using System.IO; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; +using CalamityMod.Events; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System.IO; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.ID; @@ -14,9 +17,16 @@ namespace CalamityMod.NPCs.DevourerofGods { public int invinceTime = 180; public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.CosmicGuardianHead.DisplayName"); + + public static Asset GlowTexture; + public override void SetStaticDefaults() { this.HideFromBestiary(); + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -35,11 +45,14 @@ namespace CalamityMod.NPCs.DevourerofGods NPC.behindTiles = true; NPC.noGravity = true; NPC.noTileCollide = true; - NPC.canGhostHeal = false; NPC.HitSound = SoundID.NPCHit4; NPC.DeathSound = SoundID.NPCDeath14; NPC.netAlways = true; NPC.dontCountMe = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SendExtraAI(BinaryWriter writer) @@ -103,7 +116,7 @@ namespace CalamityMod.NPCs.DevourerofGods NPC.Opacity = Main.npc[(int)NPC.ai[2]].Opacity; - Vector2 segmentPosition = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); + Vector2 segmentPosition = NPC.Center; float targetX = Main.player[NPC.target].position.X + (Main.player[NPC.target].width / 2); float targetY = Main.player[NPC.target].position.Y + (Main.player[NPC.target].height / 2); targetX = (int)(targetX / 16f) * 16; @@ -117,7 +130,7 @@ namespace CalamityMod.NPCs.DevourerofGods { try { - segmentPosition = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); + segmentPosition = NPC.Center; targetX = Main.npc[(int)NPC.ai[1]].position.X + (Main.npc[(int)NPC.ai[1]].width / 2) - segmentPosition.X; targetY = Main.npc[(int)NPC.ai[1]].position.Y + (Main.npc[(int)NPC.ai[1]].height / 2) - segmentPosition.Y; } @@ -134,6 +147,21 @@ namespace CalamityMod.NPCs.DevourerofGods NPC.position.X = NPC.position.X + targetX; NPC.position.Y = NPC.position.Y + targetY; } + + // Calculate contact damage based on velocity + float segmentVelocity = BossRushEvent.BossRushActive ? 30f : CalamityWorld.revenge ? 25f : 23f; + float minimalContactDamageVelocity = segmentVelocity * 0.25f; + float minimalDamageVelocity = segmentVelocity * 0.5f; + float bodyAndTailVelocity = (NPC.position - NPC.oldPosition).Length(); + if (bodyAndTailVelocity <= minimalContactDamageVelocity) + { + NPC.damage = 0; + } + else + { + float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); + NPC.damage = (int)MathHelper.Lerp(0f, NPC.defDamage, velocityDamageScalar); + } } public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) @@ -150,7 +178,7 @@ namespace CalamityMod.NPCs.DevourerofGods drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/DevourerofGods/CosmicGuardianTailGlow").Value; + texture2D15 = GlowTexture.Value; Color glowmaskColor = Color.Lerp(Color.White, Color.Cyan, 0.5f); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); @@ -184,7 +212,7 @@ namespace CalamityMod.NPCs.DevourerofGods NPC.position.Y = NPC.position.Y - (float)(NPC.height / 2); for (int i = 0; i < 10; i++) { - int cosmiliteDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + int cosmiliteDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[cosmiliteDust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -194,10 +222,10 @@ namespace CalamityMod.NPCs.DevourerofGods } for (int j = 0; j < 20; j++) { - int cosmiliteDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); + int cosmiliteDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); Main.dust[cosmiliteDust2].noGravity = true; Main.dust[cosmiliteDust2].velocity *= 5f; - cosmiliteDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + cosmiliteDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[cosmiliteDust2].velocity *= 2f; } } diff --git a/NPCs/DevourerofGods/DevourerofGodsBody.cs b/NPCs/DevourerofGods/DevourerofGodsBody.cs index 4d138aa544..b77ecc0466 100644 --- a/NPCs/DevourerofGods/DevourerofGodsBody.cs +++ b/NPCs/DevourerofGods/DevourerofGodsBody.cs @@ -1,4 +1,6 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using System.IO; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; using CalamityMod.Events; @@ -7,8 +9,7 @@ using CalamityMod.Projectiles.Melee.Yoyos; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -31,14 +32,32 @@ namespace CalamityMod.NPCs.DevourerofGods phase2IconIndex = ModContent.GetModBossHeadSlot(phase2IconPath); } + private const float LaserVelocityMultiplierMin = 0.5f; + + private const float LaserVelocityDistanceMultiplier = LaserVelocityMultiplierMin * 0.05f; + private int invinceTime = 360; private bool setOpacity = false; private bool phase2Started = false; public int SegmentIndex; + + public static Asset Texture_Glow; + public static Asset Phase2Texture; + public static Asset Phase2Texture_Glow; + public static Asset Phase2Texture_Glow2; + public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.DevourerofGodsHead.DisplayName"); + public override void SetStaticDefaults() { this.HideFromBestiary(); + if (!Main.dedServ) + { + Texture_Glow = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + Phase2Texture = ModContent.Request(Texture + "S", AssetRequestMode.AsyncLoad); + Phase2Texture_Glow = ModContent.Request(Texture + "SGlow", AssetRequestMode.AsyncLoad); + Phase2Texture_Glow2 = ModContent.Request(Texture + "SGlow2", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -55,7 +74,6 @@ namespace CalamityMod.NPCs.DevourerofGods global.DR = 0.925f; global.unbreakableDR = true; NPC.chaseable = false; - NPC.canGhostHeal = false; } NPC.LifeMaxNERB(887500, 1065000, 1500000); // Phase 1 is 355000, Phase 2 is 532500 double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; @@ -140,7 +158,10 @@ namespace CalamityMod.NPCs.DevourerofGods if (NPC.life > Main.npc[(int)NPC.ai[1]].life) NPC.life = Main.npc[(int)NPC.ai[1]].life; - bool phase2 = NPC.life / (float)NPC.lifeMax < 0.6f; + // Percent life remaining + float lifeRatio = NPC.life / (float)NPC.lifeMax; + + bool phase2 = lifeRatio < 0.6f; bool bossRush = BossRushEvent.BossRushActive; bool expertMode = Main.expertMode || bossRush; bool revenge = CalamityWorld.revenge || bossRush; @@ -233,8 +254,8 @@ namespace CalamityMod.NPCs.DevourerofGods NPC.TargetClosest(); SoundEngine.PlaySound(SoundID.Item12, player.Center); float maxProjectileVelocity = bossRush ? 24f : death ? 20f : revenge ? 18.25f : expertMode ? 17.5f : 16f; - float minProjectileVelocity = maxProjectileVelocity * 0.25f; - float projectileVelocity = MathHelper.Clamp(Vector2.Distance(player.Center, NPC.Center) * 0.01f, minProjectileVelocity, maxProjectileVelocity); + float minProjectileVelocity = maxProjectileVelocity * LaserVelocityMultiplierMin; + float projectileVelocity = MathHelper.Clamp(Vector2.Distance(player.Center, NPC.Center) * LaserVelocityDistanceMultiplier, minProjectileVelocity, maxProjectileVelocity); Vector2 velocityVector = Vector2.Normalize(player.Center - NPC.Center) * projectileVelocity; int type = ModContent.ProjectileType(); int damage = NPC.GetProjectileDamage(type); @@ -258,8 +279,8 @@ namespace CalamityMod.NPCs.DevourerofGods SoundEngine.PlaySound(SoundID.Item12, player.Center); NPC.localAI[0] = 0f; float maxProjectileVelocity = bossRush ? 22f : death ? 18f : revenge ? 16.25f : expertMode ? 15.5f : 14f; - float minProjectileVelocity = maxProjectileVelocity * 0.25f; - float projectileVelocity = MathHelper.Clamp(Vector2.Distance(player.Center, NPC.Center) * 0.01f, minProjectileVelocity, maxProjectileVelocity); + float minProjectileVelocity = maxProjectileVelocity * LaserVelocityMultiplierMin; + float projectileVelocity = MathHelper.Clamp(Vector2.Distance(player.Center, NPC.Center) * LaserVelocityDistanceMultiplier, minProjectileVelocity, maxProjectileVelocity); Vector2 velocityVector = Vector2.Normalize(player.Center - NPC.Center) * projectileVelocity; int type = ModContent.ProjectileType(); int damage = NPC.GetProjectileDamage(type); @@ -330,6 +351,27 @@ namespace CalamityMod.NPCs.DevourerofGods NPC.rotation = directionToNextSegment.ToRotation() + MathHelper.PiOver2; NPC.Center = aheadSegment.Center - directionToNextSegment.SafeNormalize(Vector2.Zero) * NPC.scale * NPC.width; NPC.spriteDirection = (directionToNextSegment.X > 0).ToDirectionInt(); + + // Velocity variables + float segmentVelocity = bossRush ? 19f : death ? 17.5f : 16f; + if (expertMode) + segmentVelocity += 4f * (1f - lifeRatio); + if (Main.getGoodWorld) + segmentVelocity *= 1.1f; + + // Calculate contact damage based on velocity + float minimalContactDamageVelocity = segmentVelocity * 0.25f; + float minimalDamageVelocity = segmentVelocity * 0.5f; + float bodyAndTailVelocity = (NPC.position - NPC.oldPosition).Length(); + if (bodyAndTailVelocity <= minimalContactDamageVelocity) + { + NPC.damage = 0; + } + else + { + float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); + NPC.damage = (int)MathHelper.Lerp(0f, NPC.defDamage, velocityDamageScalar); + } } private bool AnyTeleportRifts() @@ -364,7 +406,7 @@ namespace CalamityMod.NPCs.DevourerofGods spriteEffects = SpriteEffects.FlipHorizontally; bool useOtherTextures = phase2Started && Main.npc[(int)NPC.ai[2]].localAI[2] <= 60f; - Texture2D texture2D15 = useOtherTextures ? ModContent.Request("CalamityMod/NPCs/DevourerofGods/DevourerofGodsBodyS").Value : TextureAssets.Npc[NPC.type].Value; + Texture2D texture2D15 = useOtherTextures ? Phase2Texture.Value : TextureAssets.Npc[NPC.type].Value; Vector2 halfSizeTexture = new Vector2(texture2D15.Width / 2, texture2D15.Height / 2); Vector2 drawLocation = NPC.Center - screenPos; @@ -376,13 +418,13 @@ namespace CalamityMod.NPCs.DevourerofGods { if (useOtherTextures) { - texture2D15 = ModContent.Request("CalamityMod/NPCs/DevourerofGods/DevourerofGodsBodySGlow").Value; + texture2D15 = Phase2Texture_Glow.Value; Color glowmaskColor = Color.Lerp(Color.White, Color.Fuchsia, 0.5f); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } - texture2D15 = useOtherTextures ? ModContent.Request("CalamityMod/NPCs/DevourerofGods/DevourerofGodsBodySGlow2").Value : ModContent.Request("CalamityMod/NPCs/DevourerofGods/DevourerofGodsBodyGlow").Value; + texture2D15 = useOtherTextures ? Phase2Texture_Glow2.Value : Texture_Glow.Value; Color glowmaskColor2 = Color.Lerp(Color.White, Color.Cyan, 0.5f); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, glowmaskColor2, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); @@ -480,7 +522,7 @@ namespace CalamityMod.NPCs.DevourerofGods NPC.position.Y = NPC.position.Y - (NPC.height / 2); for (int i = 0; i < 10; i++) { - int cosmiliteDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + int cosmiliteDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[cosmiliteDust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -490,10 +532,10 @@ namespace CalamityMod.NPCs.DevourerofGods } for (int j = 0; j < 20; j++) { - int cosmiliteDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); + int cosmiliteDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); Main.dust[cosmiliteDust2].noGravity = true; Main.dust[cosmiliteDust2].velocity *= 5f; - cosmiliteDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + cosmiliteDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[cosmiliteDust2].velocity *= 2f; } } @@ -501,7 +543,7 @@ namespace CalamityMod.NPCs.DevourerofGods public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { - NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } diff --git a/NPCs/DevourerofGods/DevourerofGodsHead.cs b/NPCs/DevourerofGods/DevourerofGodsHead.cs index aa673bc98f..bfe4a051f5 100644 --- a/NPCs/DevourerofGods/DevourerofGodsHead.cs +++ b/NPCs/DevourerofGods/DevourerofGodsHead.cs @@ -1,4 +1,7 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using System.Collections.Generic; +using System.IO; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; using CalamityMod.Events; @@ -23,23 +26,21 @@ using CalamityMod.Items.Weapons.Summon; using CalamityMod.NPCs.TownNPCs; using CalamityMod.Projectiles.Boss; using CalamityMod.Projectiles.Melee.Yoyos; -using CalamityMod.World; using CalamityMod.Sounds; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.Collections.Generic; -using System.IO; +using ReLogic.Content; using Terraria; +using Terraria.Audio; using Terraria.GameContent; using Terraria.GameContent.Bestiary; using Terraria.GameContent.Events; +using Terraria.GameContent.ItemDropRules; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; -using Terraria.Audio; -using Terraria.GameContent.ItemDropRules; namespace CalamityMod.NPCs.DevourerofGods { @@ -48,6 +49,12 @@ namespace CalamityMod.NPCs.DevourerofGods public static int phase1IconIndex; public static int phase2IconIndex; + public static Asset Texture_Glow; + public static Asset Texture_Glow2; + public static Asset Phase2Texture; + public static Asset Phase2Texture_Glow; + public static Asset Phase2Texture_Glow2; + internal static void LoadHeadIcons() { string phase1IconPath = "CalamityMod/NPCs/DevourerofGods/DevourerofGodsHead_Head_Boss"; @@ -156,7 +163,7 @@ namespace CalamityMod.NPCs.DevourerofGods public override void SetStaticDefaults() { NPCID.Sets.BossBestiaryPriority.Add(Type); - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { Scale = 0.6f, PortraitScale = 0.6f, @@ -167,14 +174,22 @@ namespace CalamityMod.NPCs.DevourerofGods value.Position.X += 82f; value.Position.Y += 38f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; - NPCID.Sets.MPAllowedEnemies[Type] = true; + NPCID.Sets.MPAllowedEnemies[Type] = true; + if (!Main.dedServ) + { + Texture_Glow = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + Texture_Glow2 = ModContent.Request(Texture + "Glow2", AssetRequestMode.AsyncLoad); + Phase2Texture = ModContent.Request(Texture + "S", AssetRequestMode.AsyncLoad); + Phase2Texture_Glow = ModContent.Request(Texture + "SGlow", AssetRequestMode.AsyncLoad); + Phase2Texture_Glow2 = ModContent.Request(Texture + "SGlow2", AssetRequestMode.AsyncLoad); + } } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.DevourerofGods") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.DevourerofGods") }); } @@ -392,9 +407,9 @@ namespace CalamityMod.NPCs.DevourerofGods extrapitch = Main.zenithWorld ? 0.3f : 0f; // Velocity variables - float fallSpeed = bossRush ? 19f : death ? 17.5f : 16f; + float segmentVelocity = bossRush ? 19f : death ? 17.5f : 16f; if (expertMode) - fallSpeed += 4f * (1f - lifeRatio); + segmentVelocity += 4f * (1f - lifeRatio); float speed = bossRush ? 18f : death ? 16.5f : 15f; float turnSpeed = bossRush ? 0.36f : death ? 0.33f : 0.3f; @@ -418,7 +433,7 @@ namespace CalamityMod.NPCs.DevourerofGods if (Main.getGoodWorld) { - fallSpeed *= 1.1f; + segmentVelocity *= 1.1f; speed *= 1.1f; turnSpeed *= 1.1f; homingSpeed *= 1.1f; @@ -527,12 +542,12 @@ namespace CalamityMod.NPCs.DevourerofGods } // Phase 2 countdown - NPC.localAI[2] = 600f; + NPC.localAI[2] = 705f; } // Play music after the transiton BS - if (NPC.localAI[2] <= 530f) - CalamityGlobalNPC.DoGP2 = NPC.whoAmI; + if (NPC.localAI[2] <= 635f) + CalamityGlobalNPC.DoGP2 = NPC.whoAmI; // Once before DoG spawns, set new size and become visible again. if (NPC.localAI[2] == 60f) @@ -551,7 +566,7 @@ namespace CalamityMod.NPCs.DevourerofGods } // Dialogue the moment the second phase starts - if (NPC.localAI[2] == 60f) + if (NPC.localAI[2] == 60f && !bossRush) { string key = "Mods.CalamityMod.Status.Boss.EdgyBossText5"; Color messageColor = Color.Cyan; @@ -727,9 +742,12 @@ namespace CalamityMod.NPCs.DevourerofGods calamityGlobalNPC.newAI[3] = 0f; // Anger message - string key = "Mods.CalamityMod.Status.Boss.EdgyBossText6"; - Color messageColor = Color.Cyan; - CalamityUtils.DisplayLocalizedText(key, messageColor); + if (!bossRush) + { + string key = "Mods.CalamityMod.Status.Boss.EdgyBossText6"; + Color messageColor = Color.Cyan; + CalamityUtils.DisplayLocalizedText(key, messageColor); + } // Summon Cosmic Guardians SoundEngine.PlaySound(AttackSound with { Pitch = AttackSound.Pitch + extrapitch }, player.Center); @@ -762,7 +780,7 @@ namespace CalamityMod.NPCs.DevourerofGods // Fireballs // Check angle and distance to make sure it's realistic that they'd be fired - if (NPC.Opacity >= 1f && (distanceFromTarget > 480f || (CalamityWorld.LegendaryMode && CalamityWorld.revenge)) && NPC.SafeDirectionTo(player.Center).AngleBetween((NPC.rotation - MathHelper.PiOver2).ToRotationVector2()) < MathHelper.ToRadians(18f)) + if (NPC.Opacity >= 1f && (distanceFromTarget > 480f || (CalamityWorld.LegendaryMode && CalamityWorld.revenge)) && (player.Center - NPC.Center).SafeNormalize(Vector2.UnitY).ToRotation().AngleTowards(NPC.velocity.ToRotation(), MathHelper.PiOver4) == NPC.velocity.ToRotation()) { calamityGlobalNPC.newAI[0] += 1f; if (calamityGlobalNPC.newAI[0] >= ((CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 30f : 150f) && calamityGlobalNPC.newAI[0] % ((CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 30f : phase7 ? 30f : 60f) == 0f) @@ -784,7 +802,7 @@ namespace CalamityMod.NPCs.DevourerofGods { for (int l = 0; l < 8; l++) { - int dust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 170, 0f, 0f, 100, default, 1f); + int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Ichor, 0f, 0f, 100, default, 1f); float dustVelocityYAdd = Math.Abs(Main.dust[dust].velocity.Y) * 0.5f; if (Main.dust[dust].velocity.Y < 0f) Main.dust[dust].velocity.Y = 2f + dustVelocityYAdd; @@ -1054,6 +1072,8 @@ namespace CalamityMod.NPCs.DevourerofGods // Charge in a direction for a second until the timer is back at 0 if (postTeleportTimer > 0) { + NPC.damage = NPC.defDamage; + NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X) + MathHelper.PiOver2; return; } @@ -1129,7 +1149,7 @@ namespace CalamityMod.NPCs.DevourerofGods if (CalamityWorld.LegendaryMode && revenge) { - if (NPC.SafeDirectionTo(player.Center).AngleBetween((NPC.rotation - MathHelper.PiOver2).ToRotationVector2()) < MathHelper.ToRadians(10f)) + if ((player.Center - NPC.Center).SafeNormalize(Vector2.UnitY).ToRotation().AngleTowards(NPC.velocity.ToRotation(), MathHelper.PiOver4) == NPC.velocity.ToRotation()) speedCopy *= 2f; } @@ -1271,6 +1291,8 @@ namespace CalamityMod.NPCs.DevourerofGods // Charge in a direction for a second until the timer is back at 0 if (postTeleportTimer > 0) { + NPC.damage = NPC.defDamage; + NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X) + MathHelper.PiOver2; return; } @@ -1290,8 +1312,8 @@ namespace CalamityMod.NPCs.DevourerofGods if (CalamityWorld.LegendaryMode && revenge) { - if (NPC.SafeDirectionTo(player.Center).AngleBetween((NPC.rotation - MathHelper.PiOver2).ToRotationVector2()) < MathHelper.ToRadians(10f)) - fallSpeed *= 2f; + if ((player.Center - NPC.Center).SafeNormalize(Vector2.UnitY).ToRotation().AngleTowards(NPC.velocity.ToRotation(), MathHelper.PiOver4) == NPC.velocity.ToRotation()) + segmentVelocity *= 2f; } if (!flies) @@ -1365,29 +1387,41 @@ namespace CalamityMod.NPCs.DevourerofGods if (!flies) { NPC.velocity.Y += groundPhaseTurnSpeed; - if (NPC.velocity.Y > fallSpeed) - NPC.velocity.Y = fallSpeed; + if (NPC.velocity.Y > segmentVelocity) + NPC.velocity.Y = segmentVelocity; - if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < fallSpeed * 2.2) + // This bool exists to stop the strange wiggle behavior when worms are falling down + bool slowXVelocity = Math.Abs(NPC.velocity.X) > turnSpeedCopy; + if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < segmentVelocity * 2.2) { if (NPC.velocity.X < 0f) NPC.velocity.X -= turnSpeedCopy * 1.1f; else NPC.velocity.X += turnSpeedCopy * 1.1f; } - else if (NPC.velocity.Y == fallSpeed) + else if (NPC.velocity.Y == segmentVelocity) { - if (NPC.velocity.X < targetX) - NPC.velocity.X += turnSpeedCopy; - else if (NPC.velocity.X > targetX) - NPC.velocity.X -= turnSpeedCopy; + if (slowXVelocity) + { + if (NPC.velocity.X < targetX) + NPC.velocity.X += turnSpeedCopy; + else if (NPC.velocity.X > targetX) + NPC.velocity.X -= turnSpeedCopy; + } + else + NPC.velocity.X = 0f; } else if (NPC.velocity.Y > 4f) { - if (NPC.velocity.X < 0f) - NPC.velocity.X += turnSpeedCopy * 0.9f; + if (slowXVelocity) + { + if (NPC.velocity.X < 0f) + NPC.velocity.X += turnSpeedCopy * 0.9f; + else + NPC.velocity.X -= turnSpeedCopy * 0.9f; + } else - NPC.velocity.X -= turnSpeedCopy * 0.9f; + NPC.velocity.X = 0f; } } else @@ -1404,7 +1438,7 @@ namespace CalamityMod.NPCs.DevourerofGods float targetDistance = (float)Math.Sqrt(targetX * targetX + targetY * targetY); float absoluteTargetX2 = Math.Abs(targetX); float absoluteTargetY2 = Math.Abs(targetY); - float timeToReachTarget2 = fallSpeed / targetDistance; + float timeToReachTarget2 = segmentVelocity / targetDistance; targetX *= timeToReachTarget2; targetY *= timeToReachTarget2; @@ -1433,7 +1467,7 @@ namespace CalamityMod.NPCs.DevourerofGods else if (NPC.velocity.Y > targetY) NPC.velocity.Y -= groundPhaseTurnSpeed; - if (Math.Abs(targetY) < fallSpeed * maximumSpeed1 && ((NPC.velocity.X > 0f && targetX < 0f) || (NPC.velocity.X < 0f && targetX > 0f))) + if (Math.Abs(targetY) < segmentVelocity * maximumSpeed1 && ((NPC.velocity.X > 0f && targetX < 0f) || (NPC.velocity.X < 0f && targetX > 0f))) { if (NPC.velocity.Y > 0f) NPC.velocity.Y += groundPhaseTurnSpeed * 2f; @@ -1441,7 +1475,7 @@ namespace CalamityMod.NPCs.DevourerofGods NPC.velocity.Y -= groundPhaseTurnSpeed * 2f; } - if (Math.Abs(targetX) < fallSpeed * maximumSpeed1 && ((NPC.velocity.Y > 0f && targetY < 0f) || (NPC.velocity.Y < 0f && targetY > 0f))) + if (Math.Abs(targetX) < segmentVelocity * maximumSpeed1 && ((NPC.velocity.Y > 0f && targetY < 0f) || (NPC.velocity.Y < 0f && targetY > 0f))) { if (NPC.velocity.X > 0f) NPC.velocity.X += groundPhaseTurnSpeed * 2f; @@ -1456,7 +1490,7 @@ namespace CalamityMod.NPCs.DevourerofGods else if (NPC.velocity.X > targetX) NPC.velocity.X -= groundPhaseTurnSpeed * 1.1f; - if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < fallSpeed * maximumSpeed2) + if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < segmentVelocity * maximumSpeed2) { if (NPC.velocity.Y > 0f) NPC.velocity.Y += groundPhaseTurnSpeed; @@ -1471,7 +1505,7 @@ namespace CalamityMod.NPCs.DevourerofGods else if (NPC.velocity.Y > targetY) NPC.velocity.Y -= groundPhaseTurnSpeed * 1.1f; - if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < fallSpeed * maximumSpeed2) + if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < segmentVelocity * maximumSpeed2) { if (NPC.velocity.X > 0f) NPC.velocity.X += groundPhaseTurnSpeed; @@ -1562,9 +1596,12 @@ namespace CalamityMod.NPCs.DevourerofGods if (revenge) spawnDoGCountdown = 10; - string key = "Mods.CalamityMod.Status.Boss.EdgyBossText"; - Color messageColor = Color.Cyan; - CalamityUtils.DisplayLocalizedText(key, messageColor); + if (!bossRush) + { + string key = "Mods.CalamityMod.Status.Boss.EdgyBossText"; + Color messageColor = Color.Cyan; + CalamityUtils.DisplayLocalizedText(key, messageColor); + } NPC.TargetClosest(); spawnedGuardians = true; @@ -1854,7 +1891,7 @@ namespace CalamityMod.NPCs.DevourerofGods float speedCopy = speed; float turnSpeedCopy = turnSpeed; - Vector2 npcCenter = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); + Vector2 npcCenter = NPC.Center; float targetX = player.position.X + (player.width / 2); float targetY = player.position.Y + (player.height / 2); int flyYLevel = -1; @@ -1905,7 +1942,7 @@ namespace CalamityMod.NPCs.DevourerofGods if (CalamityWorld.LegendaryMode && revenge) { - if (NPC.SafeDirectionTo(player.Center).AngleBetween((NPC.rotation - MathHelper.PiOver2).ToRotationVector2()) < MathHelper.ToRadians(10f)) + if ((player.Center - NPC.Center).SafeNormalize(Vector2.UnitY).ToRotation().AngleTowards(NPC.velocity.ToRotation(), MathHelper.PiOver4) == NPC.velocity.ToRotation()) speedCopy *= 2f; } @@ -2054,8 +2091,8 @@ namespace CalamityMod.NPCs.DevourerofGods if (CalamityWorld.LegendaryMode && revenge) { - if (NPC.SafeDirectionTo(player.Center).AngleBetween((NPC.rotation - MathHelper.PiOver2).ToRotationVector2()) < MathHelper.ToRadians(10f)) - fallSpeed *= 2f; + if ((player.Center - NPC.Center).SafeNormalize(Vector2.UnitY).ToRotation().AngleTowards(NPC.velocity.ToRotation(), MathHelper.PiOver4) == NPC.velocity.ToRotation()) + segmentVelocity *= 2f; } if (!flies) @@ -2096,7 +2133,7 @@ namespace CalamityMod.NPCs.DevourerofGods bool canDirectlyCharge = true; if (NPC.position.Y > player.position.Y) { - for (int k = 0; k < 255; k++) + for (int k = 0; k < Main.maxPlayers; k++) { if (Main.player[k].active) { @@ -2129,29 +2166,41 @@ namespace CalamityMod.NPCs.DevourerofGods if (!flies) { NPC.velocity.Y += groundPhaseTurnSpeed; - if (NPC.velocity.Y > fallSpeed) - NPC.velocity.Y = fallSpeed; + if (NPC.velocity.Y > segmentVelocity) + NPC.velocity.Y = segmentVelocity; - if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < fallSpeed * 2.2) + // This bool exists to stop the strange wiggle behavior when worms are falling down + bool slowXVelocity = Math.Abs(NPC.velocity.X) > turnSpeedCopy; + if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < segmentVelocity * 2.2) { if (NPC.velocity.X < 0f) NPC.velocity.X -= turnSpeedCopy * 1.1f; else NPC.velocity.X += turnSpeedCopy * 1.1f; } - else if (NPC.velocity.Y == fallSpeed) + else if (NPC.velocity.Y == segmentVelocity) { - if (NPC.velocity.X < targetX) - NPC.velocity.X += turnSpeedCopy; - else if (NPC.velocity.X > targetX) - NPC.velocity.X -= turnSpeedCopy; + if (slowXVelocity) + { + if (NPC.velocity.X < targetX) + NPC.velocity.X += turnSpeedCopy; + else if (NPC.velocity.X > targetX) + NPC.velocity.X -= turnSpeedCopy; + } + else + NPC.velocity.X = 0f; } else if (NPC.velocity.Y > 4f) { - if (NPC.velocity.X < 0f) - NPC.velocity.X += turnSpeedCopy * 0.9f; + if (slowXVelocity) + { + if (NPC.velocity.X < 0f) + NPC.velocity.X += turnSpeedCopy * 0.9f; + else + NPC.velocity.X -= turnSpeedCopy * 0.9f; + } else - NPC.velocity.X -= turnSpeedCopy * 0.9f; + NPC.velocity.X = 0f; } } else @@ -2168,7 +2217,7 @@ namespace CalamityMod.NPCs.DevourerofGods float targetDistance = (float)Math.Sqrt(targetX * targetX + targetY * targetY); float absoluteTargetX2 = Math.Abs(targetX); float absoluteTargetY2 = Math.Abs(targetY); - float timeToReachTarget2 = fallSpeed / targetDistance; + float timeToReachTarget2 = segmentVelocity / targetDistance; targetX *= timeToReachTarget2; targetY *= timeToReachTarget2; @@ -2197,7 +2246,7 @@ namespace CalamityMod.NPCs.DevourerofGods else if (NPC.velocity.Y > targetY) NPC.velocity.Y -= groundPhaseTurnSpeed; - if (Math.Abs(targetY) < fallSpeed * maximumSpeed1 && ((NPC.velocity.X > 0f && targetX < 0f) || (NPC.velocity.X < 0f && targetX > 0f))) + if (Math.Abs(targetY) < segmentVelocity * maximumSpeed1 && ((NPC.velocity.X > 0f && targetX < 0f) || (NPC.velocity.X < 0f && targetX > 0f))) { if (NPC.velocity.Y > 0f) NPC.velocity.Y += groundPhaseTurnSpeed * 2f; @@ -2205,7 +2254,7 @@ namespace CalamityMod.NPCs.DevourerofGods NPC.velocity.Y -= groundPhaseTurnSpeed * 2f; } - if (Math.Abs(targetX) < fallSpeed * maximumSpeed1 && ((NPC.velocity.Y > 0f && targetY < 0f) || (NPC.velocity.Y < 0f && targetY > 0f))) + if (Math.Abs(targetX) < segmentVelocity * maximumSpeed1 && ((NPC.velocity.Y > 0f && targetY < 0f) || (NPC.velocity.Y < 0f && targetY > 0f))) { if (NPC.velocity.X > 0f) NPC.velocity.X += groundPhaseTurnSpeed * 2f; @@ -2220,7 +2269,7 @@ namespace CalamityMod.NPCs.DevourerofGods else if (NPC.velocity.X > targetX) NPC.velocity.X -= groundPhaseTurnSpeed * 1.1f; - if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < fallSpeed * maximumSpeed2) + if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < segmentVelocity * maximumSpeed2) { if (NPC.velocity.Y > 0f) NPC.velocity.Y += groundPhaseTurnSpeed; @@ -2235,7 +2284,7 @@ namespace CalamityMod.NPCs.DevourerofGods else if (NPC.velocity.Y > targetY) NPC.velocity.Y -= groundPhaseTurnSpeed * 1.1f; - if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < fallSpeed * maximumSpeed2) + if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < segmentVelocity * maximumSpeed2) { if (NPC.velocity.X > 0f) NPC.velocity.X += groundPhaseTurnSpeed; @@ -2305,6 +2354,19 @@ namespace CalamityMod.NPCs.DevourerofGods } } + // Calculate contact damage based on velocity + float minimalContactDamageVelocity = segmentVelocity * 0.25f; + float minimalDamageVelocity = segmentVelocity * 0.5f; + if (NPC.velocity.Length() <= minimalContactDamageVelocity) + { + NPC.damage = (int)Math.Round(NPC.defDamage * 0.5); + } + else + { + float velocityDamageScalar = MathHelper.Clamp((NPC.velocity.Length() - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); + NPC.damage = (int)MathHelper.Lerp((float)Math.Round(NPC.defDamage * 0.5), NPC.defDamage, velocityDamageScalar); + } + if (NPC.life > Main.npc[(int)NPC.ai[0]].life) NPC.life = Main.npc[(int)NPC.ai[0]].life; } @@ -2565,7 +2627,7 @@ namespace CalamityMod.NPCs.DevourerofGods spriteEffects = SpriteEffects.FlipHorizontally; bool useOtherTextures = (Phase2Started && NPC.localAI[2] <= 60f) || NPC.IsABestiaryIconDummy; - Texture2D texture2D15 = useOtherTextures ? ModContent.Request("CalamityMod/NPCs/DevourerofGods/DevourerofGodsHeadS").Value : TextureAssets.Npc[NPC.type].Value; + Texture2D texture2D15 = useOtherTextures ? Phase2Texture.Value : TextureAssets.Npc[NPC.type].Value; Vector2 halfSizeTexture = new Vector2(texture2D15.Width / 2, texture2D15.Height / 2); if (NPC.IsABestiaryIconDummy) NPC.frame = texture2D15.Frame(); @@ -2577,12 +2639,12 @@ namespace CalamityMod.NPCs.DevourerofGods if (!NPC.dontTakeDamage) { - texture2D15 = useOtherTextures ? ModContent.Request("CalamityMod/NPCs/DevourerofGods/DevourerofGodsHeadSGlow").Value : ModContent.Request("CalamityMod/NPCs/DevourerofGods/DevourerofGodsHeadGlow").Value; + texture2D15 = useOtherTextures ? Phase2Texture_Glow.Value : Texture_Glow.Value; Color glowmaskLerp = Color.Lerp(Color.White, Color.Fuchsia, 0.5f); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, glowmaskLerp, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = useOtherTextures ? ModContent.Request("CalamityMod/NPCs/DevourerofGods/DevourerofGodsHeadSGlow2").Value : ModContent.Request("CalamityMod/NPCs/DevourerofGods/DevourerofGodsHeadGlow2").Value; + texture2D15 = useOtherTextures ? Phase2Texture_Glow2.Value : Texture_Glow2.Value; glowmaskLerp = Color.Lerp(Color.White, Color.Cyan, 0.5f); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, glowmaskLerp, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); @@ -2613,10 +2675,11 @@ namespace CalamityMod.NPCs.DevourerofGods string key2 = "Mods.CalamityMod.Status.Progression.DoGBossText2"; Color messageColor2 = Color.Orange; string key3 = "Mods.CalamityMod.Status.Progression.DargonBossText"; + Color messageColor3 = Color.Yellow; CalamityUtils.DisplayLocalizedText(key, messageColor); CalamityUtils.DisplayLocalizedText(key2, messageColor2); - CalamityUtils.DisplayLocalizedText(key3, messageColor2); + CalamityUtils.DisplayLocalizedText(key3, messageColor3); } // Mark DoG as dead @@ -2640,7 +2703,7 @@ namespace CalamityMod.NPCs.DevourerofGods npcLoot.Add(ItemDropRule.BossBag(ModContent.ItemType())); // Extraneous potions - npcLoot.DefineConditionalDropSet(() => true).Add(DropHelper.PerPlayer(ModContent.ItemType(), 1, 5, 15), hideLootReport: true); // Healing Potions don't show up in the Bestiary + npcLoot.DefineConditionalDropSet(() => true).Add(DropHelper.PerPlayer(ModContent.ItemType(), 1, 5, 15), hideLootReport: true); // Healing Potions don't show up in the Bestiary // Fabsol Mount npcLoot.AddIf((info) => info.player.Calamity().fabsolVodka, ModContent.ItemType()); @@ -2811,7 +2874,7 @@ namespace CalamityMod.NPCs.DevourerofGods NPC.position.Y = NPC.position.Y - (NPC.height / 2); for (int i = 0; i < 15; i++) { - int cosmiliteDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + int cosmiliteDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[cosmiliteDust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -2821,10 +2884,10 @@ namespace CalamityMod.NPCs.DevourerofGods } for (int j = 0; j < 30; j++) { - int cosmiliteDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); + int cosmiliteDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); Main.dust[cosmiliteDust2].noGravity = true; Main.dust[cosmiliteDust2].velocity *= 5f; - cosmiliteDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + cosmiliteDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[cosmiliteDust2].velocity *= 2f; } } @@ -2832,18 +2895,18 @@ namespace CalamityMod.NPCs.DevourerofGods public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { - NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); } public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) { if (hurtInfo.Damage <= 0) - return; + return; target.AddBuff(ModContent.BuffType(), 200, true); target.AddBuff(ModContent.BuffType(), 600, true); - if (target.Calamity().dogTextCooldown <= 0) + if (target.Calamity().dogTextCooldown <= 0 && !BossRushEvent.BossRushActive) { string text = Utils.SelectRandom(Main.rand, new string[] { diff --git a/NPCs/DevourerofGods/DevourerofGodsTail.cs b/NPCs/DevourerofGods/DevourerofGodsTail.cs index 1387a0a641..ffcf9c3123 100644 --- a/NPCs/DevourerofGods/DevourerofGodsTail.cs +++ b/NPCs/DevourerofGods/DevourerofGodsTail.cs @@ -2,11 +2,13 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; +using CalamityMod.Events; using CalamityMod.Projectiles.Melee.Yoyos; using CalamityMod.Sounds; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -22,6 +24,12 @@ namespace CalamityMod.NPCs.DevourerofGods public static int phase1IconIndex; public static int phase2IconIndex; + public static Asset Texture_Glow; + public static Asset Texture_Glow2; + public static Asset Phase2Texture; + public static Asset Phase2Texture_Glow; + public static Asset Phase2Texture_Glow2; + internal static void LoadHeadIcons() { string phase1IconPath = "CalamityMod/NPCs/DevourerofGods/DevourerofGodsTail_Head_Boss"; @@ -41,6 +49,14 @@ namespace CalamityMod.NPCs.DevourerofGods public override void SetStaticDefaults() { this.HideFromBestiary(); + if (!Main.dedServ) + { + Texture_Glow = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + Texture_Glow2 = ModContent.Request(Texture + "Glow2", AssetRequestMode.AsyncLoad); + Phase2Texture = ModContent.Request(Texture + "S", AssetRequestMode.AsyncLoad); + Phase2Texture_Glow = ModContent.Request(Texture + "SGlow", AssetRequestMode.AsyncLoad); + Phase2Texture_Glow2 = ModContent.Request(Texture + "SGlow2", AssetRequestMode.AsyncLoad); + } } internal void setInvulTime(int time) @@ -66,7 +82,6 @@ namespace CalamityMod.NPCs.DevourerofGods NPC.behindTiles = true; NPC.noGravity = true; NPC.noTileCollide = true; - NPC.canGhostHeal = false; NPC.DeathSound = SoundID.NPCDeath14; NPC.netAlways = true; NPC.boss = true; @@ -101,7 +116,7 @@ namespace CalamityMod.NPCs.DevourerofGods { NPC head = CalamityGlobalNPC.DoGHead >= 0 ? Main.npc[CalamityGlobalNPC.DoGHead] : null; DevourerofGodsHead modNPC = head?.ModNPC() ?? null; - if (head != null || modNPC.AwaitingPhase2Teleport || !modNPC.Phase2Started) + if (head is null || modNPC.AwaitingPhase2Teleport || !modNPC.Phase2Started) return; rotation = NPC.rotation; @@ -145,7 +160,15 @@ namespace CalamityMod.NPCs.DevourerofGods if (NPC.life > Main.npc[(int)NPC.ai[1]].life) NPC.life = Main.npc[(int)NPC.ai[1]].life; - if (NPC.life / (float)NPC.lifeMax < 0.6f) + // Percent life remaining + float lifeRatio = NPC.life / (float)NPC.lifeMax; + + bool phase2 = lifeRatio < 0.6f; + bool bossRush = BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || bossRush; + bool death = CalamityWorld.death || bossRush; + + if (phase2) { phase2Started = true; @@ -266,7 +289,7 @@ namespace CalamityMod.NPCs.DevourerofGods NPC.Opacity = Main.npc[(int)NPC.ai[2]].Opacity; } - Vector2 segmentDirection = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); + Vector2 segmentDirection = NPC.Center; float playerXDist = player.position.X + (player.width / 2); float playerYDist = player.position.Y + (player.height / 2); playerXDist = (int)(playerXDist / 16f) * 16; @@ -280,10 +303,11 @@ namespace CalamityMod.NPCs.DevourerofGods { try { - segmentDirection = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); + segmentDirection = NPC.Center; playerXDist = Main.npc[(int)NPC.ai[1]].position.X + (Main.npc[(int)NPC.ai[1]].width / 2) - segmentDirection.X; playerYDist = Main.npc[(int)NPC.ai[1]].position.Y + (Main.npc[(int)NPC.ai[1]].height / 2) - segmentDirection.Y; - } catch + } + catch { } NPC.rotation = (float)System.Math.Atan2(playerYDist, playerXDist) + MathHelper.PiOver2; @@ -301,6 +325,27 @@ namespace CalamityMod.NPCs.DevourerofGods else if (playerXDist > 0f) NPC.spriteDirection = 1; } + + // Velocity variables + float segmentVelocity = bossRush ? 19f : death ? 17.5f : 16f; + if (expertMode) + segmentVelocity += 4f * (1f - lifeRatio); + if (Main.getGoodWorld) + segmentVelocity *= 1.1f; + + // Calculate contact damage based on velocity + float minimalContactDamageVelocity = segmentVelocity * 0.25f; + float minimalDamageVelocity = segmentVelocity * 0.5f; + float bodyAndTailVelocity = (NPC.position - NPC.oldPosition).Length(); + if (bodyAndTailVelocity <= minimalContactDamageVelocity) + { + NPC.damage = 0; + } + else + { + float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); + NPC.damage = (int)MathHelper.Lerp(0f, NPC.defDamage, velocityDamageScalar); + } } public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) @@ -325,7 +370,7 @@ namespace CalamityMod.NPCs.DevourerofGods spriteEffects = SpriteEffects.FlipHorizontally; bool useOtherTextures = phase2Started && Main.npc[(int)NPC.ai[2]].localAI[2] <= 60f; - Texture2D texture2D15 = useOtherTextures ? ModContent.Request("CalamityMod/NPCs/DevourerofGods/DevourerofGodsTailS").Value : TextureAssets.Npc[NPC.type].Value; + Texture2D texture2D15 = useOtherTextures ? Phase2Texture.Value : TextureAssets.Npc[NPC.type].Value; Vector2 halfSizeTexture = new Vector2(texture2D15.Width / 2, texture2D15.Height / 2); Vector2 drawPosition = NPC.Center - screenPos; @@ -335,12 +380,12 @@ namespace CalamityMod.NPCs.DevourerofGods if (!NPC.dontTakeDamage) { - texture2D15 = useOtherTextures ? ModContent.Request("CalamityMod/NPCs/DevourerofGods/DevourerofGodsTailSGlow").Value : ModContent.Request("CalamityMod/NPCs/DevourerofGods/DevourerofGodsTailGlow").Value; + texture2D15 = useOtherTextures ? Phase2Texture_Glow.Value : Texture_Glow.Value; Color glowmaskColor = Color.Lerp(Color.White, Color.Fuchsia, 0.5f); spriteBatch.Draw(texture2D15, drawPosition, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = useOtherTextures ? ModContent.Request("CalamityMod/NPCs/DevourerofGods/DevourerofGodsTailSGlow2").Value : ModContent.Request("CalamityMod/NPCs/DevourerofGods/DevourerofGodsTailGlow2").Value; + texture2D15 = useOtherTextures ? Phase2Texture_Glow2.Value : Texture_Glow2.Value; glowmaskColor = Color.Lerp(Color.White, Color.Cyan, 0.5f); spriteBatch.Draw(texture2D15, drawPosition, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); @@ -371,7 +416,7 @@ namespace CalamityMod.NPCs.DevourerofGods if (hitboxBotRight < minDist) minDist = hitboxBotRight; - return minDist <= (phase2Started ? 70f : 35f) * NPC.scale && NPC.Opacity >= 1f; + return minDist <= (phase2Started ? 70f : 35f) * NPC.scale && NPC.Opacity >= 1f && invinceTime <= 0; } public override void HitEffect(NPC.HitInfo hit) @@ -397,7 +442,7 @@ namespace CalamityMod.NPCs.DevourerofGods NPC.position.Y = NPC.position.Y - (NPC.height / 2); for (int i = 0; i < 10; i++) { - int cosmiliteDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + int cosmiliteDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[cosmiliteDust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -407,10 +452,10 @@ namespace CalamityMod.NPCs.DevourerofGods } for (int j = 0; j < 20; j++) { - int cosmiliteDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); + int cosmiliteDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); Main.dust[cosmiliteDust2].noGravity = true; Main.dust[cosmiliteDust2].velocity *= 5f; - cosmiliteDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + cosmiliteDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[cosmiliteDust2].velocity *= 2f; } } @@ -465,7 +510,7 @@ namespace CalamityMod.NPCs.DevourerofGods public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { - NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } diff --git a/NPCs/DevourerofGods/DoGScreenShaderData.cs b/NPCs/DevourerofGods/DoGScreenShaderData.cs index 2dd556a00a..74963b76e8 100644 --- a/NPCs/DevourerofGods/DoGScreenShaderData.cs +++ b/NPCs/DevourerofGods/DoGScreenShaderData.cs @@ -38,7 +38,7 @@ namespace CalamityMod.NPCs.DevourerofGods if (DoGIndex == -1) { UpdateDoGIndex(); - if (DoGIndex == -1) + if (DoGIndex == -1 && Main.LocalPlayer.Calamity().monolithDevourerPShader <= 0 && Main.LocalPlayer.Calamity().monolithDevourerBShader <= 0) Filters.Scene["CalamityMod:DevourerofGodsHead"].Deactivate(); } } @@ -50,6 +50,10 @@ namespace CalamityMod.NPCs.DevourerofGods { UseTargetPosition(Main.npc[DoGIndex].Center); } + else if (Main.LocalPlayer.Calamity().monolithDevourerPShader > 0 || Main.LocalPlayer.Calamity().monolithDevourerBShader > 0) + { + UseTargetPosition(Main.LocalPlayer.Center); + } base.Apply(); } } diff --git a/NPCs/DevourerofGods/DoGSky.cs b/NPCs/DevourerofGods/DoGSky.cs index e6a5f12315..76a41b16b9 100644 --- a/NPCs/DevourerofGods/DoGSky.cs +++ b/NPCs/DevourerofGods/DoGSky.cs @@ -20,7 +20,7 @@ namespace CalamityMod.NPCs.DevourerofGods if (DoGIndex == -1) { UpdateDoGIndex(); - if (DoGIndex == -1) + if (DoGIndex == -1 && Main.LocalPlayer.Calamity().monolithDevourerBShader <= 0 && Main.LocalPlayer.Calamity().monolithDevourerPShader <= 0) isActive = false; } @@ -75,29 +75,47 @@ namespace CalamityMod.NPCs.DevourerofGods public override void Draw(SpriteBatch spriteBatch, float minDepth, float maxDepth) { - if (maxDepth >= 0 && minDepth < 0 && DoGIndex != -1) + if (maxDepth >= 0 && minDepth < 0) { - if (Main.npc[DoGIndex].active) + if (DoGIndex != -1) { - float intensity = GetIntensity(); - float lifeRatio = Main.npc[DoGIndex].life / (float)Main.npc[DoGIndex].lifeMax; - double blackScreenLife_GateValue = (lifeRatio < 0.6f && Main.npc[DoGIndex].localAI[2] <= 2f) ? 0.15 : 0.75; - - float timeToReachNextColor = DevourerofGodsHead.SkyColorTransitionTime; - float phaseTimer = Main.npc[DoGIndex].Calamity().newAI[2]; - float colorChangeProgress = phaseTimer / timeToReachNextColor; - if (colorChangeProgress > 1f) - colorChangeProgress = 1f; - - bool death = CalamityWorld.death || BossRushEvent.BossRushActive; - Color regularSkyColor = (Main.npc[DoGIndex].ai[3] == 0f ? Color.Lerp(Color.Fuchsia, Color.Cyan, colorChangeProgress) : Color.Lerp(Color.Cyan, Color.Fuchsia, colorChangeProgress)) * intensity; - if (Main.npc[DoGIndex].life < Main.npc[DoGIndex].lifeMax * blackScreenLife_GateValue || death || Main.npc[DoGIndex].localAI[3] > 0f) + if (Main.npc[DoGIndex].active) { - float blackSkyTransitionProgress = death ? 1f : Main.npc[DoGIndex].localAI[3] / timeToReachNextColor; - spriteBatch.Draw(TextureAssets.BlackTile.Value, new Rectangle(0, 0, Main.screenWidth * 2, Main.screenHeight * 2), Color.Lerp(regularSkyColor, Color.Black * (intensity + 0.5f), blackSkyTransitionProgress)); + float intensity = GetIntensity(); + float lifeRatio = Main.npc[DoGIndex].life / (float)Main.npc[DoGIndex].lifeMax; + double blackScreenLife_GateValue = (lifeRatio < 0.6f && Main.npc[DoGIndex].localAI[2] <= 2f) ? 0.15 : 0.75; + + float timeToReachNextColor = DevourerofGodsHead.SkyColorTransitionTime; + float phaseTimer = Main.npc[DoGIndex].Calamity().newAI[2]; + float colorChangeProgress = phaseTimer / timeToReachNextColor; + if (colorChangeProgress > 1f) + colorChangeProgress = 1f; + + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + Color regularSkyColor = (Main.npc[DoGIndex].ai[3] == 0f ? Color.Lerp(Color.Fuchsia, Color.Cyan, colorChangeProgress) : Color.Lerp(Color.Cyan, Color.Fuchsia, colorChangeProgress)) * intensity; + if (Main.npc[DoGIndex].life < Main.npc[DoGIndex].lifeMax * blackScreenLife_GateValue || death || Main.npc[DoGIndex].localAI[3] > 0f) + { + float blackSkyTransitionProgress = death ? 1f : Main.npc[DoGIndex].localAI[3] / timeToReachNextColor; + spriteBatch.Draw(TextureAssets.BlackTile.Value, new Rectangle(0, 0, Main.screenWidth * 2, Main.screenHeight * 2), Color.Lerp(regularSkyColor, Color.Black * (intensity + 0.5f), blackSkyTransitionProgress)); + } + else + spriteBatch.Draw(TextureAssets.BlackTile.Value, new Rectangle(0, 0, Main.screenWidth * 2, Main.screenHeight * 2), regularSkyColor); + } + } + else + { + if (Main.LocalPlayer.Calamity().monolithDevourerBShader > 0) + { + float intensity = MathHelper.Min(MathHelper.Lerp(0, 0.5f, (float)Main.LocalPlayer.Calamity().monolithDevourerBShader / 15), 0.45f); + Color regularSkyColor = Color.Cyan; + spriteBatch.Draw(TextureAssets.BlackTile.Value, new Rectangle(0, 0, Main.screenWidth * 2, Main.screenHeight * 2), regularSkyColor * intensity); + } + if (Main.LocalPlayer.Calamity().monolithDevourerPShader > 0) + { + float intensity = MathHelper.Min(MathHelper.Lerp(0, 0.5f, (float)Main.LocalPlayer.Calamity().monolithDevourerPShader / 15), 0.45f); + Color regularSkyColor = Color.Fuchsia; + spriteBatch.Draw(TextureAssets.BlackTile.Value, new Rectangle(0, 0, Main.screenWidth * 2, Main.screenHeight * 2), regularSkyColor * intensity); } - else - spriteBatch.Draw(TextureAssets.BlackTile.Value, new Rectangle(0, 0, Main.screenWidth * 2, Main.screenHeight * 2), regularSkyColor); } } } diff --git a/NPCs/DraedonLabThings/Androomba.cs b/NPCs/DraedonLabThings/Androomba.cs index 99458991a0..d867d59bc8 100644 --- a/NPCs/DraedonLabThings/Androomba.cs +++ b/NPCs/DraedonLabThings/Androomba.cs @@ -3,6 +3,7 @@ using CalamityMod.Items.Critters; using CalamityMod.Items.Placeables.Banners; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -14,17 +15,25 @@ namespace CalamityMod.NPCs.DraedonLabThings { public class Androomba : ModNPC { + + public static Asset GlowTexture; + public SoundStyle HurrySound = new("CalamityMod/Sounds/Custom/WulfrumDroidHurry", 2) { PitchVariance = 0.3f }; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 22; NPCID.Sets.CountsAsCritter[NPC.type] = true; Main.npcCatchable[NPC.type] = true; NPCID.Sets.NormalGoldCritterBestiaryPriority.Add(Type); - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0); + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(); value.Position.Y += 18; value.PortraitPositionYOverride = 38f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "_Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -51,9 +60,9 @@ namespace CalamityMod.NPCs.DraedonLabThings public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Androomba") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Androomba") }); } @@ -247,13 +256,13 @@ namespace CalamityMod.NPCs.DraedonLabThings public override void HitEffect(NPC.HitInfo hit) { for (int i = 0; i < 6; i++) - Dust.NewDustDirect(NPC.position, NPC.width, NPC.height, 226); + Dust.NewDustDirect(NPC.position, NPC.width, NPC.height, DustID.Electric); } public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { Texture2D critterTexture = TextureAssets.Npc[NPC.type].Value; - Texture2D glowmask = ModContent.Request("CalamityMod/NPCs/DraedonLabThings/Androomba_Glow").Value; + Texture2D glowmask = GlowTexture.Value; Vector2 drawPosition = NPC.Center - screenPos + Vector2.UnitY * NPC.gfxOffY; drawPosition.Y += DrawOffsetY; SpriteEffects direction = NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; diff --git a/NPCs/DraedonLabThings/Nanodroid.cs b/NPCs/DraedonLabThings/Nanodroid.cs index 1f876cd9bd..5730109ccb 100644 --- a/NPCs/DraedonLabThings/Nanodroid.cs +++ b/NPCs/DraedonLabThings/Nanodroid.cs @@ -2,6 +2,7 @@ using CalamityMod.Items.Critters; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.GameContent.Bestiary; @@ -12,11 +13,17 @@ namespace CalamityMod.NPCs.DraedonLabThings { public class Nanodroid : ModNPC { + public static Asset GlowTexture; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 8; NPCID.Sets.CountsAsCritter[NPC.type] = true; Main.npcCatchable[NPC.type] = true; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "_Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -32,7 +39,7 @@ namespace CalamityMod.NPCs.DraedonLabThings public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Nanodroid") }); @@ -59,13 +66,13 @@ namespace CalamityMod.NPCs.DraedonLabThings public override void HitEffect(NPC.HitInfo hit) { for (int i = 0; i < 6; i++) - Dust.NewDustDirect(NPC.position, NPC.width, NPC.height, 226); + Dust.NewDustDirect(NPC.position, NPC.width, NPC.height, DustID.Electric); } public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { Texture2D critterTexture = TextureAssets.Npc[NPC.type].Value; - Texture2D glowmask = ModContent.Request("CalamityMod/NPCs/DraedonLabThings/Nanodroid_Glow").Value; + Texture2D glowmask = GlowTexture.Value; Vector2 drawPosition = NPC.Center - screenPos + Vector2.UnitY * NPC.gfxOffY; SpriteEffects direction = NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; spriteBatch.Draw(critterTexture, drawPosition, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, NPC.frame.Size() * 0.5f, NPC.scale, direction, 0f); diff --git a/NPCs/DraedonLabThings/NanodroidDysfunctional.cs b/NPCs/DraedonLabThings/NanodroidDysfunctional.cs index 0b710d0dda..fba1017618 100644 --- a/NPCs/DraedonLabThings/NanodroidDysfunctional.cs +++ b/NPCs/DraedonLabThings/NanodroidDysfunctional.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Critters; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.ID; @@ -11,6 +12,7 @@ namespace CalamityMod.NPCs.DraedonLabThings { public class NanodroidDysfunctional : ModNPC { + public static Asset GlowTexture; public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.Nanodroid.DisplayName"); public override void SetStaticDefaults() { @@ -18,6 +20,10 @@ namespace CalamityMod.NPCs.DraedonLabThings Main.npcFrameCount[NPC.type] = 8; NPCID.Sets.CountsAsCritter[NPC.type] = true; Main.npcCatchable[NPC.type] = true; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "_Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -68,13 +74,13 @@ namespace CalamityMod.NPCs.DraedonLabThings public override void HitEffect(NPC.HitInfo hit) { for (int i = 0; i < 6; i++) - Dust.NewDustDirect(NPC.position, NPC.width, NPC.height, 226); + Dust.NewDustDirect(NPC.position, NPC.width, NPC.height, DustID.Electric); } public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { Texture2D critterTexture = TextureAssets.Npc[NPC.type].Value; - Texture2D glowmask = ModContent.Request("CalamityMod/NPCs/DraedonLabThings/NanodroidDysfunctional_Glow").Value; + Texture2D glowmask = GlowTexture.Value; Vector2 drawPosition = NPC.Center - screenPos + Vector2.UnitY * NPC.gfxOffY; SpriteEffects direction = NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; spriteBatch.Draw(critterTexture, drawPosition, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, NPC.frame.Size() * 0.5f, NPC.scale, direction, 0f); diff --git a/NPCs/DraedonLabThings/NanodroidPlagueGreen.cs b/NPCs/DraedonLabThings/NanodroidPlagueGreen.cs index 7063b0f70c..9b7f651e01 100644 --- a/NPCs/DraedonLabThings/NanodroidPlagueGreen.cs +++ b/NPCs/DraedonLabThings/NanodroidPlagueGreen.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Critters; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.ID; @@ -11,6 +12,7 @@ namespace CalamityMod.NPCs.DraedonLabThings { public class NanodroidPlagueGreen : ModNPC { + public static Asset GlowTexture; public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.Nanodroid.DisplayName"); public override void SetStaticDefaults() { @@ -18,6 +20,10 @@ namespace CalamityMod.NPCs.DraedonLabThings Main.npcFrameCount[NPC.type] = 8; NPCID.Sets.CountsAsCritter[NPC.type] = true; Main.npcCatchable[NPC.type] = true; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "_Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -68,13 +74,13 @@ namespace CalamityMod.NPCs.DraedonLabThings public override void HitEffect(NPC.HitInfo hit) { for (int i = 0; i < 6; i++) - Dust.NewDustDirect(NPC.position, NPC.width, NPC.height, 226); + Dust.NewDustDirect(NPC.position, NPC.width, NPC.height, DustID.Electric); } public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { Texture2D critterTexture = TextureAssets.Npc[NPC.type].Value; - Texture2D glowmask = ModContent.Request("CalamityMod/NPCs/DraedonLabThings/NanodroidPlagueGreen_Glow").Value; + Texture2D glowmask = GlowTexture.Value; Vector2 drawPosition = NPC.Center - screenPos + Vector2.UnitY * NPC.gfxOffY; SpriteEffects direction = NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; spriteBatch.Draw(critterTexture, drawPosition, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, NPC.frame.Size() * 0.5f, NPC.scale, direction, 0f); diff --git a/NPCs/DraedonLabThings/NanodroidPlagueRed.cs b/NPCs/DraedonLabThings/NanodroidPlagueRed.cs index 316f219b8c..7473e4dd55 100644 --- a/NPCs/DraedonLabThings/NanodroidPlagueRed.cs +++ b/NPCs/DraedonLabThings/NanodroidPlagueRed.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Critters; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.ID; @@ -11,6 +12,7 @@ namespace CalamityMod.NPCs.DraedonLabThings { public class NanodroidPlagueRed : ModNPC { + public static Asset GlowTexture; public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.Nanodroid.DisplayName"); public override void SetStaticDefaults() { @@ -18,6 +20,10 @@ namespace CalamityMod.NPCs.DraedonLabThings Main.npcFrameCount[NPC.type] = 8; NPCID.Sets.CountsAsCritter[NPC.type] = true; Main.npcCatchable[NPC.type] = true; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "_Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -68,13 +74,13 @@ namespace CalamityMod.NPCs.DraedonLabThings public override void HitEffect(NPC.HitInfo hit) { for (int i = 0; i < 6; i++) - Dust.NewDustDirect(NPC.position, NPC.width, NPC.height, 226); + Dust.NewDustDirect(NPC.position, NPC.width, NPC.height, DustID.Electric); } public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { Texture2D critterTexture = TextureAssets.Npc[NPC.type].Value; - Texture2D glowmask = ModContent.Request("CalamityMod/NPCs/DraedonLabThings/NanodroidPlagueRed_Glow").Value; + Texture2D glowmask = GlowTexture.Value; Vector2 drawPosition = NPC.Center - screenPos + Vector2.UnitY * NPC.gfxOffY; SpriteEffects direction = NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; spriteBatch.Draw(critterTexture, drawPosition, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, NPC.frame.Size() * 0.5f, NPC.scale, direction, 0f); diff --git a/NPCs/DraedonLabThings/RepairUnitCritter.cs b/NPCs/DraedonLabThings/RepairUnitCritter.cs index 9f8d5e76b0..b6a844db97 100644 --- a/NPCs/DraedonLabThings/RepairUnitCritter.cs +++ b/NPCs/DraedonLabThings/RepairUnitCritter.cs @@ -1,11 +1,12 @@ -using CalamityMod.BiomeManagers; +using System; +using System.IO; +using CalamityMod.BiomeManagers; using CalamityMod.Items.Critters; using CalamityMod.Items.DraedonMisc; using CalamityMod.Items.Placeables.Banners; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.GameContent.Bestiary; @@ -50,6 +51,8 @@ namespace CalamityMod.NPCs.DraedonLabThings public const float Gravity = 0.4f; + public static Asset GlowTexture; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 17; @@ -57,10 +60,14 @@ namespace CalamityMod.NPCs.DraedonLabThings NPCID.Sets.CountsAsCritter[NPC.type] = true; NPCID.Sets.CantTakeLunchMoney[Type] = true; NPCID.Sets.NormalGoldCritterBestiaryPriority.Add(Type); - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0); + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(); value.Position.Y += 12; value.PortraitPositionYOverride = 32f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glowmask", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -85,9 +92,9 @@ namespace CalamityMod.NPCs.DraedonLabThings public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.RepairUnitCritter") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.RepairUnitCritter") }); } @@ -330,7 +337,7 @@ namespace CalamityMod.NPCs.DraedonLabThings public override void HitEffect(NPC.HitInfo hit) { for (int i = 0; i < 6; i++) - Dust.NewDustDirect(NPC.position, NPC.width, NPC.height, 226); + Dust.NewDustDirect(NPC.position, NPC.width, NPC.height, DustID.Electric); if (NPC.life <= 0) { if (Main.netMode != NetmodeID.Server) @@ -367,7 +374,7 @@ namespace CalamityMod.NPCs.DraedonLabThings public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { Texture2D critterTexture = TextureAssets.Npc[NPC.type].Value; - Texture2D glowmask = ModContent.Request("CalamityMod/NPCs/DraedonLabThings/RepairUnitCritterGlowmask").Value; + Texture2D glowmask = GlowTexture.Value; Vector2 drawPosition = NPC.Center - screenPos + Vector2.UnitY * NPC.gfxOffY; SpriteEffects direction = NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; spriteBatch.Draw(critterTexture, drawPosition, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, NPC.frame.Size() * 0.5f, NPC.scale, direction, 0f); diff --git a/NPCs/ExoMechs/Apollo/Apollo.cs b/NPCs/ExoMechs/Apollo/Apollo.cs index 25d9ae45d9..eba4711d38 100644 --- a/NPCs/ExoMechs/Apollo/Apollo.cs +++ b/NPCs/ExoMechs/Apollo/Apollo.cs @@ -1,4 +1,7 @@ -using CalamityMod.Events; +using System; +using System.Collections.Generic; +using System.IO; +using CalamityMod.Events; using CalamityMod.Graphics.Primitives; using CalamityMod.Items.Potions; using CalamityMod.Items.Weapons.DraedonsArsenal; @@ -10,9 +13,7 @@ using CalamityMod.Sounds; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.Collections.Generic; -using System.IO; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -20,7 +21,6 @@ using Terraria.GameContent.Bestiary; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; - using ArtemisBoss = CalamityMod.NPCs.ExoMechs.Artemis.Artemis; namespace CalamityMod.NPCs.ExoMechs.Apollo @@ -30,6 +30,8 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo public static int phase1IconIndex; public static int phase2IconIndex; + public static Asset GlowTexture; + internal static void LoadHeadIcons() { string phase1IconPath = "CalamityMod/NPCs/ExoMechs/Apollo/ApolloHead"; @@ -136,6 +138,10 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo Rotation = -MathHelper.PiOver4 }; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -244,7 +250,7 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo NPC.TargetClosest(); // Target variable - Player player = Main.player[NPC.target]; + int targetIndex = NPC.target; // Check if the other exo mechs are alive int otherExoMechsAlive = 0; @@ -269,7 +275,7 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo if (Main.npc[CalamityGlobalNPC.draedonExoMechWorm].active) { // Set target to Thanatos' target if Thanatos is alive - player = Main.player[Main.npc[CalamityGlobalNPC.draedonExoMechWorm].target]; + targetIndex = Main.npc[CalamityGlobalNPC.draedonExoMechWorm].target; otherExoMechsAlive++; exoWormAlive = true; @@ -280,7 +286,7 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo if (Main.npc[CalamityGlobalNPC.draedonExoMechPrime].active) { // Set target to Ares' target if Ares is alive - player = Main.player[Main.npc[CalamityGlobalNPC.draedonExoMechPrime].target]; + targetIndex = Main.npc[CalamityGlobalNPC.draedonExoMechPrime].target; otherExoMechsAlive++; exoPrimeAlive = true; @@ -360,7 +366,7 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo { NPC.ai[0] += 1f; if (NPC.ai[0] == 10f && !NPC.AnyNPCs(ModContent.NPCType())) - NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); + NPC.SpawnOnPlayer(Main.player[targetIndex].whoAmI, ModContent.NPCType()); } else { @@ -459,13 +465,13 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo // Default vector to fly to bool flyRight = NPC.ai[0] % 2f == 0f || NPC.ai[0] < 10f || !revenge; float destinationX = flyRight ? 750f : -750f; - float destinationY = player.Center.Y; + float destinationY = Main.player[targetIndex].Center.Y; float chargeComboXOffset = flyRight ? -600f : 600f; float chargeComboYOffset = NPC.ai[2] % 2f == 0f ? 480f : -480f; - Vector2 destination = SecondaryAIState == (float)SecondaryPhase.PassiveAndImmune ? new Vector2(player.Center.X + destinationX * 1.6f, destinationY) : - SecondaryAIState == (float)SecondaryPhase.Passive ? new Vector2(player.Center.X + destinationX, destinationY + 360f) : - AIState == (float)Phase.LineUpChargeCombo ? new Vector2(player.Center.X + destinationX * 1.2f, destinationY + chargeComboYOffset) : - new Vector2(player.Center.X + destinationX, destinationY); + Vector2 destination = SecondaryAIState == (float)SecondaryPhase.PassiveAndImmune ? new Vector2(Main.player[targetIndex].Center.X + destinationX * 1.6f, destinationY) : + SecondaryAIState == (float)SecondaryPhase.Passive ? new Vector2(Main.player[targetIndex].Center.X + destinationX, destinationY + 360f) : + AIState == (float)Phase.LineUpChargeCombo ? new Vector2(Main.player[targetIndex].Center.X + destinationX * 1.2f, destinationY + chargeComboYOffset) : + new Vector2(Main.player[targetIndex].Center.X + destinationX, destinationY); // Add some random distance to the destination after certain attacks if (pickNewLocation) @@ -517,9 +523,9 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo bool canFire = distanceFromDestination.Length() <= 320f; // Rotation - Vector2 aimedVector = player.Center - NPC.Center; + Vector2 aimedVector = Main.player[targetIndex].Center - NPC.Center; float rateOfRotation = 0.1f; - Vector2 rotateTowards = player.Center - NPC.Center; + Vector2 rotateTowards = Main.player[targetIndex].Center - NPC.Center; bool readyToCharge = AIState == (float)Phase.LineUpChargeCombo && (Vector2.Distance(NPC.Center, destination) <= chargeLocationDistanceGateValue || calamityGlobalNPC.newAI[2] > 0f); if (AIState == (int)Phase.ChargeCombo) { @@ -534,8 +540,8 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo } else { - float x = player.Center.X - NPC.Center.X; - float y = player.Center.Y - NPC.Center.Y; + float x = Main.player[targetIndex].Center.X - NPC.Center.X; + float y = Main.player[targetIndex].Center.Y - NPC.Center.Y; rotateTowards = Vector2.Normalize(new Vector2(x, y)) * baseVelocity; } @@ -544,42 +550,37 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo NPC.rotation = NPC.rotation.AngleTowards((float)Math.Atan2(rotateTowards.Y, rotateTowards.X) + MathHelper.PiOver2, rateOfRotation); // Despawn if target is dead - if (player.dead) + if (Main.player[targetIndex].dead) { - NPC.TargetClosest(false); - player = Main.player[NPC.target]; - if (player.dead) - { - AIState = (float)Phase.Normal; - NPC.localAI[0] = 0f; - NPC.localAI[1] = 0f; - NPC.localAI[2] = 0f; - calamityGlobalNPC.newAI[2] = 0f; - calamityGlobalNPC.newAI[3] = 0f; - for (int i = 0; i < maxCharges; i++) - chargeLocations[i] = default; + AIState = (float)Phase.Normal; + NPC.localAI[0] = 0f; + NPC.localAI[1] = 0f; + NPC.localAI[2] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + calamityGlobalNPC.newAI[3] = 0f; + for (int i = 0; i < maxCharges; i++) + chargeLocations[i] = default; - NPC.dontTakeDamage = true; + NPC.dontTakeDamage = true; + NPC.velocity.Y -= 1f; + if ((double)NPC.position.Y < Main.topWorld + 16f) NPC.velocity.Y -= 1f; - if ((double)NPC.position.Y < Main.topWorld + 16f) - NPC.velocity.Y -= 1f; - if ((double)NPC.position.Y < Main.topWorld + 16f) + if ((double)NPC.position.Y < Main.topWorld + 16f) + { + for (int a = 0; a < Main.maxNPCs; a++) { - for (int a = 0; a < Main.maxNPCs; a++) - { - if (Main.npc[a].type == NPC.type || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || - Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || - Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || - Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || - Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType()) - Main.npc[a].active = false; - } + if (Main.npc[a].type == NPC.type || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || + Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || + Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || + Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || + Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType()) + Main.npc[a].active = false; } - - return; } + + return; } // Cause the charge visual effects to begin while performing or preparing for a combo @@ -667,8 +668,8 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo if (Main.netMode != NetmodeID.MultiplayerClient) { // Spawn the fuckers - NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); - NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); + NPC.SpawnOnPlayer(Main.player[targetIndex].whoAmI, ModContent.NPCType()); + NPC.SpawnOnPlayer(Main.player[targetIndex].whoAmI, ModContent.NPCType()); } } } @@ -950,6 +951,9 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo // Fly to the right of the target case (int)Phase.Normal: + // Avoid cheap bullshit + NPC.damage = 0; + // Smooth movement towards the location Apollo is meant to be at CalamityUtils.SmoothMovement(NPC, movementDistanceGateValue, distanceFromDestination, baseVelocity, 0f, false); @@ -980,7 +984,7 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo int damage = NPC.GetProjectileDamage(type); Vector2 plasmaVelocity = Vector2.Normalize(aimedVector) * projectileVelocity; Vector2 offset = Vector2.Normalize(plasmaVelocity) * 70f; - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + offset, plasmaVelocity, type, damage, 0f, Main.myPlayer, player.Center.X, player.Center.Y); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + offset, plasmaVelocity, type, damage, 0f, Main.myPlayer, Main.player[targetIndex].Center.X, Main.player[targetIndex].Center.Y); } } } @@ -1023,6 +1027,9 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo // Charge case (int)Phase.RocketBarrage: + // Avoid cheap bullshit + NPC.damage = 0; + // Smooth movement towards the location Apollo is meant to be at CalamityUtils.SmoothMovement(NPC, movementDistanceGateValue, distanceFromDestination, baseVelocity, 0f, false); @@ -1041,7 +1048,7 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo int damage = NPC.GetProjectileDamage(type); Vector2 rocketVelocity = Vector2.Normalize(aimedVector) * projectileVelocity * 1.2f; Vector2 offset = Vector2.Normalize(rocketVelocity) * 70f; - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + offset, rocketVelocity, type, damage, 0f, Main.myPlayer, 0f, player.Center.Y); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + offset, rocketVelocity, type, damage, 0f, Main.myPlayer, 0f, Main.player[targetIndex].Center.Y); } } @@ -1064,6 +1071,9 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo // Create telegraph beams between the charge location array positions case (int)Phase.LineUpChargeCombo: + // Avoid cheap bullshit + NPC.damage = 0; + if (!readyToCharge) { // Smooth movement towards the location Apollo is meant to be at @@ -1125,6 +1135,9 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo calamityGlobalNPC.newAI[2] += 1f; if (calamityGlobalNPC.newAI[2] >= timeToLineUpCharge) { + // Set damage + NPC.damage = NPC.defDamage; + ExoMechsSky.CreateLightningBolt(10); AIState = (float)Phase.ChargeCombo; @@ -1138,6 +1151,9 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo // Charge to several locations almost instantly (Apollo doesn't teleport here, he's just moving very fast :D) case (int)Phase.ChargeCombo: + // Set damage + NPC.damage = NPC.defDamage; + // Tell Artemis to not fire lasers for a short time NPC.ai[3] = 61f; @@ -1241,6 +1257,9 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo // Reset phase and variables if (calamityGlobalNPC.newAI[2] >= maxCharges - 1) { + // Avoid cheap bullshit + NPC.damage = 0; + if (Main.zenithWorld && !exoMechdusa) { pickNewLocation = NPC.localAI[2] == 0f; @@ -1278,6 +1297,9 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo // Phase transition animation, that's all this exists for case (int)Phase.PhaseTransition: + // Avoid cheap bullshit + NPC.damage = 0; + // Smooth movement towards the location Apollo is meant to be at CalamityUtils.SmoothMovement(NPC, movementDistanceGateValue, distanceFromDestination, baseVelocity, 0f, false); @@ -1361,7 +1383,7 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo if (hitboxBotRight < minDist) minDist = hitboxBotRight; - return minDist <= 100f && NPC.Opacity == 1f && AIState == (float)Phase.ChargeCombo; + return minDist <= 100f && NPC.Opacity == 1f; } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) @@ -1576,7 +1598,7 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo } } - texture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Apollo/ApolloGlow").Value; + texture = GlowTexture.Value; if (CalamityConfig.Instance.Afterimages && !NPC.IsABestiaryIconDummy) { for (int i = 1; i < numAfterimages; i += 2) @@ -1706,7 +1728,7 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo public override void HitEffect(NPC.HitInfo hit) { for (int k = 0; k < 3; k++) - Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1f); if (NPC.soundDelay == 0) { @@ -1718,14 +1740,14 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo { for (int num193 = 0; num193 < 2; num193++) { - Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); } for (int i = 0; i < 20; i++) { - int plasmaDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); + int plasmaDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); Main.dust[plasmaDust].noGravity = true; Main.dust[plasmaDust].velocity *= 3f; - plasmaDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + plasmaDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); Main.dust[plasmaDust].velocity *= 2f; Main.dust[plasmaDust].noGravity = true; } @@ -1786,7 +1808,7 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { - NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } } diff --git a/NPCs/ExoMechs/Ares/AresBody.cs b/NPCs/ExoMechs/Ares/AresBody.cs index 7a7798463c..631b09ff53 100644 --- a/NPCs/ExoMechs/Ares/AresBody.cs +++ b/NPCs/ExoMechs/Ares/AresBody.cs @@ -1,4 +1,7 @@ -using CalamityMod.Events; +using System; +using System.Collections.Generic; +using System.IO; +using CalamityMod.Events; using CalamityMod.Graphics.Primitives; using CalamityMod.Items; using CalamityMod.Items.Accessories; @@ -25,10 +28,8 @@ using CalamityMod.UI.VanillaBossBars; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using ReLogic.Utilities; -using System; -using System.Collections.Generic; -using System.IO; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -155,6 +156,30 @@ namespace CalamityMod.NPCs.ExoMechs.Ares public static readonly SoundStyle LaserLoopSound = new SoundStyle("CalamityMod/Sounds/Custom/ExoMechs/AresCircleLaserLoop") with { IsLooped = true }; public static readonly SoundStyle LaserEndSound = new("CalamityMod/Sounds/Custom/ExoMechs/AresCircleLaserEnd"); + + #region Textures + public static Asset GlowTexture; + public static Asset NeuronTexture; + public static Asset NeuronTexture_Glow; + + public static Asset ArmTopTexture; + public static Asset ArmTopTexture2; + public static Asset ArmSegmentTexture; + public static Asset ArmTopShoulderTexture; + public static Asset ArmBottomConnectorTexture; + public static Asset ArmBottomTexture; + public static Asset ArmBottomTexture2; + public static Asset ArmBottomShoulderTexture; + + public static Asset ArmTopTexture2_Glow; + public static Asset ArmSegmentTexture_Glow; + public static Asset ArmTopShoulderTexture_Glow; + public static Asset ArmBottomTexture_Glow; + public static Asset ArmBottomTexture2_Glow; + public static Asset ArmBottomShoulderTexture_Glow; + #endregion + + public override void SetStaticDefaults() { NPCID.Sets.TrailingMode[NPC.type] = 3; @@ -166,6 +191,29 @@ namespace CalamityMod.NPCs.ExoMechs.Ares Scale = 0.4f }; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + string AresPath = "CalamityMod/NPCs/ExoMechs/Ares/Ares"; + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + NeuronTexture = ModContent.Request("CalamityMod/NPCs/ExoMechs/AergiaNeuron", AssetRequestMode.AsyncLoad); + NeuronTexture_Glow = ModContent.Request("CalamityMod/NPCs/ExoMechs/AergiaNeuron_Glow", AssetRequestMode.AsyncLoad); + + ArmTopTexture = ModContent.Request(AresPath + "ArmTopPart1", AssetRequestMode.AsyncLoad); + ArmTopTexture2 = ModContent.Request(AresPath + "ArmTopPart2", AssetRequestMode.AsyncLoad); + ArmSegmentTexture = ModContent.Request(AresPath + "ArmTopSegment", AssetRequestMode.AsyncLoad); + ArmTopShoulderTexture = ModContent.Request(AresPath + "ArmTopShoulder", AssetRequestMode.AsyncLoad); + ArmBottomConnectorTexture = ModContent.Request(AresPath + "BottomArmConnector", AssetRequestMode.AsyncLoad); + ArmBottomTexture = ModContent.Request(AresPath + "BottomArmPart1", AssetRequestMode.AsyncLoad); + ArmBottomTexture2 = ModContent.Request(AresPath + "BottomArmPart2", AssetRequestMode.AsyncLoad); + ArmBottomShoulderTexture = ModContent.Request(AresPath + "BottomArmShoulder", AssetRequestMode.AsyncLoad); + + ArmTopTexture2_Glow = ModContent.Request(AresPath + "ArmTopPart2Glow", AssetRequestMode.AsyncLoad); + ArmSegmentTexture_Glow = ModContent.Request(AresPath + "ArmTopSegmentGlow", AssetRequestMode.AsyncLoad); + ArmTopShoulderTexture_Glow = ModContent.Request(AresPath + "ArmTopShoulderGlow", AssetRequestMode.AsyncLoad); + ArmBottomTexture_Glow = ModContent.Request(AresPath + "BottomArmPart1Glow", AssetRequestMode.AsyncLoad); + ArmBottomTexture2_Glow = ModContent.Request(AresPath + "BottomArmPart2Glow", AssetRequestMode.AsyncLoad); + ArmBottomShoulderTexture_Glow = ModContent.Request(AresPath + "BottomArmShoulderGlow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -1211,7 +1259,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares Vector2 center = NPC.Center - screenPos; spriteBatch.Draw(texture, center, frame, NPC.GetAlpha(drawColor), NPC.rotation, vector, NPC.scale, SpriteEffects.None, 0f); - texture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Ares/AresBodyGlow").Value; + texture = GlowTexture.Value; if (CalamityConfig.Instance.Afterimages) { @@ -1283,14 +1331,14 @@ namespace CalamityMod.NPCs.ExoMechs.Ares // Draw back arms. if (backArm) { - Texture2D shoulderTexture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Ares/AresArmTopShoulder").Value; - Texture2D armTexture1 = ModContent.Request("CalamityMod/NPCs/ExoMechs/Ares/AresArmTopPart1").Value; - Texture2D armSegmentTexture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Ares/AresArmTopSegment").Value; - Texture2D armTexture2 = ModContent.Request("CalamityMod/NPCs/ExoMechs/Ares/AresArmTopPart2").Value; + Texture2D shoulderTexture = ArmTopShoulderTexture.Value; + Texture2D armTexture1 = ArmTopTexture.Value; + Texture2D armSegmentTexture = ArmSegmentTexture.Value; + Texture2D armTexture2 = ArmTopTexture2.Value; - Texture2D shoulderGlowmask = ModContent.Request("CalamityMod/NPCs/ExoMechs/Ares/AresArmTopShoulderGlow").Value; - Texture2D armSegmentGlowmask = ModContent.Request("CalamityMod/NPCs/ExoMechs/Ares/AresArmTopSegmentGlow").Value; - Texture2D armGlowmask2 = ModContent.Request("CalamityMod/NPCs/ExoMechs/Ares/AresArmTopPart2Glow").Value; + Texture2D shoulderGlowmask = ArmTopShoulderTexture_Glow.Value; + Texture2D armSegmentGlowmask = ArmSegmentTexture_Glow.Value; + Texture2D armGlowmask2 = ArmTopTexture2_Glow.Value; Vector2 shoulderDrawPosition = NPC.Center + NPC.scale * new Vector2(direction * 176f, -100f); Vector2 arm1DrawPosition = shoulderDrawPosition + NPC.scale * new Vector2(direction * (shoulderTexture.Width + 16f), 10f); @@ -1352,14 +1400,14 @@ namespace CalamityMod.NPCs.ExoMechs.Ares } else { - Texture2D shoulderTexture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Ares/AresBottomArmShoulder").Value; - Texture2D connectorTexture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Ares/AresBottomArmConnector").Value; - Texture2D armTexture1 = ModContent.Request("CalamityMod/NPCs/ExoMechs/Ares/AresBottomArmPart1").Value; - Texture2D armTexture2 = ModContent.Request("CalamityMod/NPCs/ExoMechs/Ares/AresBottomArmPart2").Value; + Texture2D shoulderTexture = ArmBottomShoulderTexture.Value; + Texture2D connectorTexture = ArmBottomConnectorTexture.Value; + Texture2D armTexture1 = ArmBottomTexture.Value; + Texture2D armTexture2 = ArmBottomTexture2.Value; - Texture2D shoulderGlowmask = ModContent.Request("CalamityMod/NPCs/ExoMechs/Ares/AresBottomArmShoulderGlow").Value; - Texture2D armTexture1Glowmask = ModContent.Request("CalamityMod/NPCs/ExoMechs/Ares/AresBottomArmPart1Glow").Value; - Texture2D armTexture2Glowmask = ModContent.Request("CalamityMod/NPCs/ExoMechs/Ares/AresBottomArmPart2Glow").Value; + Texture2D shoulderGlowmask = ArmBottomShoulderTexture_Glow.Value; + Texture2D armTexture1Glowmask = ArmBottomTexture_Glow.Value; + Texture2D armTexture2Glowmask = ArmBottomTexture2_Glow.Value; Vector2 shoulderDrawPosition = NPC.Center + NPC.scale * new Vector2(direction * 110f, -54f); Vector2 connectorDrawPosition = shoulderDrawPosition + NPC.scale * new Vector2(direction * 20f, 32f); @@ -1589,7 +1637,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares public override void HitEffect(NPC.HitInfo hit) { for (int k = 0; k < 3; k++) - Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1f); if (NPC.soundDelay == 0) { @@ -1601,14 +1649,14 @@ namespace CalamityMod.NPCs.ExoMechs.Ares { for (int i = 0; i < 2; i++) { - Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); } for (int j = 0; j < 20; j++) { - int plasmaDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); + int plasmaDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); Main.dust[plasmaDust].noGravity = true; Main.dust[plasmaDust].velocity *= 3f; - plasmaDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + plasmaDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); Main.dust[plasmaDust].velocity *= 2f; Main.dust[plasmaDust].noGravity = true; } @@ -1630,7 +1678,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { - NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); NPC.damage = (int)(NPC.damage * 0.8f); } } diff --git a/NPCs/ExoMechs/Ares/AresGaussNuke.cs b/NPCs/ExoMechs/Ares/AresGaussNuke.cs index 29b0f0717e..dec6dd8459 100644 --- a/NPCs/ExoMechs/Ares/AresGaussNuke.cs +++ b/NPCs/ExoMechs/Ares/AresGaussNuke.cs @@ -1,4 +1,6 @@ -using CalamityMod.Events; +using System; +using System.IO; +using CalamityMod.Events; using CalamityMod.NPCs.ExoMechs.Thanatos; using CalamityMod.Particles; using CalamityMod.Projectiles.Boss; @@ -6,9 +8,8 @@ using CalamityMod.Sounds; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using ReLogic.Utilities; -using System; -using System.IO; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -35,7 +36,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares public ThanatosSmokeParticleSet SmokeDrawer = new ThanatosSmokeParticleSet(-1, 3, 0f, 16f, 1.5f); public AresCannonChargeParticleSet EnergyDrawer = new AresCannonChargeParticleSet(-1, 15, 40f, Color.Yellow); - + public Vector2 CoreSpritePosition => NPC.Center + NPC.spriteDirection * NPC.rotation.ToRotationVector2() * 35f + (NPC.rotation + MathHelper.PiOver2).ToRotationVector2() * 5f; // This stores the sound slot of the telegraph sound it makes, so it may be properly updated in terms of position. @@ -70,11 +71,17 @@ namespace CalamityMod.NPCs.ExoMechs.Ares public static readonly SoundStyle NukeExplosionSound = new("CalamityMod/Sounds/Custom/ExoMechs/AresGaussNukeExplosion") { Volume = 1.45f }; + public static Asset GlowTexture; + public override void SetStaticDefaults() { this.HideFromBestiary(); NPCID.Sets.TrailingMode[NPC.type] = 3; NPCID.Sets.TrailCacheLength[NPC.type] = NPC.oldPos.Length; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -92,7 +99,6 @@ namespace CalamityMod.NPCs.ExoMechs.Ares AIType = -1; NPC.Opacity = 0f; NPC.knockBackResist = 0f; - NPC.canGhostHeal = false; NPC.noGravity = true; NPC.noTileCollide = true; NPC.DeathSound = CommonCalamitySounds.ExoDeathSound; @@ -190,8 +196,8 @@ namespace CalamityMod.NPCs.ExoMechs.Ares // Whether Ares should be buffed while in berserk phase bool shouldGetBuffedByBerserkPhase = berserk && !otherMechIsBerserk; - // Target variable - Player player = Main.player[Main.npc[CalamityGlobalNPC.draedonExoMechPrime].target]; + // Target variables + int targetIndex = Main.npc[CalamityGlobalNPC.draedonExoMechPrime].target; if (NPC.ai[2] > 0f) NPC.realLife = (int)NPC.ai[2]; @@ -231,8 +237,8 @@ namespace CalamityMod.NPCs.ExoMechs.Ares if (passivePhase) predictionAmt *= 0.5f; - Vector2 predictionVector = player.velocity * predictionAmt; - Vector2 rotationVector = player.Center + predictionVector - NPC.Center; + Vector2 predictionVector = Main.player[targetIndex].velocity * predictionAmt; + Vector2 rotationVector = Main.player[targetIndex].Center + predictionVector - NPC.Center; float projectileVelocity = passivePhase ? 9.6f : 12f; if (lastMechAlive) @@ -254,7 +260,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares NPC.rotation = NPC.rotation.AngleTowards(rotation, rateOfRotation); // Direction - int direction = Math.Sign(player.Center.X - NPC.Center.X); + int direction = Math.Sign(Main.player[targetIndex].Center.X - NPC.Center.X); if (direction != 0) { NPC.direction = direction; @@ -266,35 +272,31 @@ namespace CalamityMod.NPCs.ExoMechs.Ares } // Despawn if target is dead - if (player.dead) + if (Main.player[targetIndex].dead) { - player = Main.player[Main.npc[CalamityGlobalNPC.draedonExoMechPrime].target]; - if (player.dead) - { - AIState = (float)Phase.Nothing; - calamityGlobalNPC.newAI[1] = 0f; - calamityGlobalNPC.newAI[2] = 0f; - NPC.dontTakeDamage = true; + AIState = (float)Phase.Nothing; + calamityGlobalNPC.newAI[1] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + NPC.dontTakeDamage = true; + NPC.velocity.Y -= 1f; + if ((double)NPC.position.Y < Main.topWorld + 16f) NPC.velocity.Y -= 1f; - if ((double)NPC.position.Y < Main.topWorld + 16f) - NPC.velocity.Y -= 1f; - if ((double)NPC.position.Y < Main.topWorld + 16f) + if ((double)NPC.position.Y < Main.topWorld + 16f) + { + for (int a = 0; a < Main.maxNPCs; a++) { - for (int a = 0; a < Main.maxNPCs; a++) - { - if (Main.npc[a].type == NPC.type || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || - Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || - Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || - Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || - Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType()) - Main.npc[a].active = false; - } + if (Main.npc[a].type == NPC.type || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || + Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || + Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || + Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || + Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType()) + Main.npc[a].active = false; } - - return; } + + return; } // Default vector to fly to @@ -418,7 +420,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares int type = ModContent.ProjectileType(); int damage = NPC.GetProjectileDamage(type); float offset = 40f; - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(gaussNukeVelocity) * offset, gaussNukeVelocity, type, damage, 0f, Main.myPlayer, 0f, player.Center.Y); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(gaussNukeVelocity) * offset, gaussNukeVelocity, type, damage, 0f, Main.myPlayer, 0f, Main.player[targetIndex].Center.Y); } // Recoil @@ -588,7 +590,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares spriteBatch.Draw(texture, center, frame, NPC.GetAlpha(drawColor), NPC.rotation, vector, NPC.scale, spriteEffects, 0f); - Texture2D glowTexture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Ares/AresGaussNukeGlow").Value; + Texture2D glowTexture = GlowTexture.Value; if (CalamityConfig.Instance.Afterimages) { @@ -655,7 +657,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares public override void HitEffect(NPC.HitInfo hit) { for (int k = 0; k < 3; k++) - Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TerraBlade, 0f, 0f, 100, new Color(0, 255, 255), 1f); if (NPC.soundDelay == 1) { @@ -667,14 +669,14 @@ namespace CalamityMod.NPCs.ExoMechs.Ares { for (int i = 0; i < 2; i++) { - Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TerraBlade, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); } for (int j = 0; j < 20; j++) { - int plasmaDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); + int plasmaDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TerraBlade, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); Main.dust[plasmaDust].noGravity = true; Main.dust[plasmaDust].velocity *= 3f; - plasmaDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + plasmaDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TerraBlade, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); Main.dust[plasmaDust].velocity *= 2f; Main.dust[plasmaDust].noGravity = true; } @@ -695,7 +697,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { - NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); NPC.damage = (int)(NPC.damage * 0.8f); } } diff --git a/NPCs/ExoMechs/Ares/AresLaserCannon.cs b/NPCs/ExoMechs/Ares/AresLaserCannon.cs index 10988c9039..cbaacc311a 100644 --- a/NPCs/ExoMechs/Ares/AresLaserCannon.cs +++ b/NPCs/ExoMechs/Ares/AresLaserCannon.cs @@ -1,4 +1,6 @@ -using CalamityMod.Events; +using System; +using System.IO; +using CalamityMod.Events; using CalamityMod.Items.Tools; using CalamityMod.NPCs.ExoMechs.Thanatos; using CalamityMod.Particles; @@ -7,9 +9,8 @@ using CalamityMod.Sounds; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using ReLogic.Utilities; -using System; -using System.IO; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -73,11 +74,17 @@ namespace CalamityMod.NPCs.ExoMechs.Ares public static readonly SoundStyle LaserbeamShootSound = new("CalamityMod/Sounds/Custom/ExoMechs/AresLaserArmShoot") { Volume = 1.1f }; + public static Asset GlowTexture; + public override void SetStaticDefaults() { this.HideFromBestiary(); NPCID.Sets.TrailingMode[NPC.type] = 3; NPCID.Sets.TrailCacheLength[NPC.type] = NPC.oldPos.Length; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -95,7 +102,6 @@ namespace CalamityMod.NPCs.ExoMechs.Ares AIType = -1; NPC.Opacity = 0f; NPC.knockBackResist = 0f; - NPC.canGhostHeal = false; NPC.noGravity = true; NPC.noTileCollide = true; NPC.DeathSound = CommonCalamitySounds.ExoDeathSound; @@ -193,8 +199,8 @@ namespace CalamityMod.NPCs.ExoMechs.Ares // Whether Ares should be buffed while in berserk phase bool shouldGetBuffedByBerserkPhase = berserk && !otherMechIsBerserk; - // Target variable - Player player = Main.player[Main.npc[CalamityGlobalNPC.draedonExoMechPrime].target]; + // Target variables + int targetIndex = Main.npc[CalamityGlobalNPC.draedonExoMechPrime].target; if (NPC.ai[2] > 0f) NPC.realLife = (int)NPC.ai[2]; @@ -260,7 +266,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares bool horizontalLaserSweep = calamityGlobalNPC.newAI[3] == 0f; float rateOfRotation = AIState == (int)Phase.Deathray ? 0.08f : 0.04f; float lookAtX = flyLeft ? 1000f : -1000f; - Vector2 lookAt = AIState == (int)Phase.Deathray && !fireNormalLasers ? (horizontalLaserSweep ? new Vector2(NPC.Center.X, NPC.Center.Y + 1000f) : new Vector2(NPC.Center.X + lookAtX, NPC.Center.Y)) : player.Center; + Vector2 lookAt = AIState == (int)Phase.Deathray && !fireNormalLasers ? (horizontalLaserSweep ? new Vector2(NPC.Center.X, NPC.Center.Y + 1000f) : new Vector2(NPC.Center.X + lookAtX, NPC.Center.Y)) : Main.player[targetIndex].Center; float rotation = (float)Math.Atan2(lookAt.Y - NPC.Center.Y, lookAt.X - NPC.Center.X); if (NPC.spriteDirection == 1) @@ -273,7 +279,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares NPC.rotation = NPC.rotation.AngleTowards(rotation, rateOfRotation); // Direction - int direction = Math.Sign(((AIState == (int)Phase.Deathray && !horizontalLaserSweep) || fireNormalLasers ? lookAt.X : player.Center.X) - NPC.Center.X); + int direction = Math.Sign(((AIState == (int)Phase.Deathray && !horizontalLaserSweep) || fireNormalLasers ? lookAt.X : Main.player[targetIndex].Center.X) - NPC.Center.X); if (direction != 0) { NPC.direction = direction; @@ -285,35 +291,31 @@ namespace CalamityMod.NPCs.ExoMechs.Ares } // Despawn if target is dead - if (player.dead) + if (Main.player[targetIndex].dead) { - player = Main.player[Main.npc[CalamityGlobalNPC.draedonExoMechPrime].target]; - if (player.dead) - { - AIState = (float)Phase.Nothing; - calamityGlobalNPC.newAI[1] = 0f; - calamityGlobalNPC.newAI[2] = 0f; - NPC.dontTakeDamage = true; + AIState = (float)Phase.Nothing; + calamityGlobalNPC.newAI[1] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + NPC.dontTakeDamage = true; + NPC.velocity.Y -= 1f; + if ((double)NPC.position.Y < Main.topWorld + 16f) NPC.velocity.Y -= 1f; - if ((double)NPC.position.Y < Main.topWorld + 16f) - NPC.velocity.Y -= 1f; - if ((double)NPC.position.Y < Main.topWorld + 16f) + if ((double)NPC.position.Y < Main.topWorld + 16f) + { + for (int a = 0; a < Main.maxNPCs; a++) { - for (int a = 0; a < Main.maxNPCs; a++) - { - if (Main.npc[a].type == NPC.type || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || - Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || - Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || - Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || - Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType()) - Main.npc[a].active = false; - } + if (Main.npc[a].type == NPC.type || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || + Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || + Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || + Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || + Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType()) + Main.npc[a].active = false; } - - return; } + + return; } // Velocity and acceleration values @@ -345,7 +347,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares deathrayPhaseVelocity *= 1.1f; // If Laser Cannon can fire normal lasers, cannot fire if too close to the target and in deathray spiral phase - bool canFire = Vector2.Distance(NPC.Center, player.Center) > 320f || !fireNormalLasers; + bool canFire = Vector2.Distance(NPC.Center, Main.player[targetIndex].Center) > 320f || !fireNormalLasers; // Telegraph duration for deathray spiral float deathraySpiralTelegraphDuration = bossRush ? AresBody.deathrayTelegraphDuration_BossRush : death ? AresBody.deathrayTelegraphDuration_Death : @@ -448,9 +450,9 @@ namespace CalamityMod.NPCs.ExoMechs.Ares { int type = ModContent.ProjectileType(); int damage = NPC.GetProjectileDamage(type); - Vector2 laserVelocity = Vector2.Normalize(player.Center - NPC.Center); + Vector2 laserVelocity = Vector2.Normalize(Main.player[targetIndex].Center - NPC.Center); Vector2 offset = laserVelocity * 70f + Vector2.UnitY * 16f; - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + offset, player.Center, type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + offset, Main.player[targetIndex].Center, type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI); } } } @@ -520,7 +522,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares // Update the deathray and telegraph sound if they're being played. if (SoundEngine.TryGetActiveSound(DeathraySoundSlot, out var deathraySound) && deathraySound.IsPlaying) deathraySound.Position = NPC.Center; - + // Immediately stop the telegraph sound if Ares just begun transitioning to his laserbeam attack, since that automatically resets all impending cannon shots. if (SoundEngine.TryGetActiveSound(TelegraphSoundSlot, out var telSound) && telSound.IsPlaying) { @@ -634,7 +636,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares spriteBatch.Draw(texture, center, frame, NPC.GetAlpha(drawColor), NPC.rotation, vector, NPC.scale, spriteEffects, 0f); - Texture2D glowTexture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Ares/AresLaserCannonGlow").Value; + Texture2D glowTexture = GlowTexture.Value; if (CalamityConfig.Instance.Afterimages) { @@ -705,7 +707,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares public override void HitEffect(NPC.HitInfo hit) { for (int k = 0; k < 3; k++) - Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TerraBlade, 0f, 0f, 100, new Color(0, 255, 255), 1f); if (NPC.soundDelay == 0) { @@ -717,14 +719,14 @@ namespace CalamityMod.NPCs.ExoMechs.Ares { for (int i = 0; i < 2; i++) { - Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TerraBlade, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); } for (int j = 0; j < 20; j++) { - int plasmaDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); + int plasmaDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TerraBlade, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); Main.dust[plasmaDust].noGravity = true; Main.dust[plasmaDust].velocity *= 3f; - plasmaDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + plasmaDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TerraBlade, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); Main.dust[plasmaDust].velocity *= 2f; Main.dust[plasmaDust].noGravity = true; } @@ -744,7 +746,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { - NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); NPC.damage = (int)(NPC.damage * 0.8f); } } diff --git a/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs b/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs index 00ff522bd8..9aef9f09fb 100644 --- a/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs +++ b/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs @@ -1,4 +1,6 @@ -using CalamityMod.Events; +using System; +using System.IO; +using CalamityMod.Events; using CalamityMod.Items.Weapons.DraedonsArsenal; using CalamityMod.NPCs.ExoMechs.Thanatos; using CalamityMod.Particles; @@ -7,9 +9,8 @@ using CalamityMod.Sounds; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using ReLogic.Utilities; -using System; -using System.IO; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -67,11 +68,17 @@ namespace CalamityMod.NPCs.ExoMechs.Ares // Telegraph sound. public static readonly SoundStyle TelSound = new("CalamityMod/Sounds/Custom/ExoMechs/AresPlasmaArmCharge"); + public static Asset GlowTexture; + public override void SetStaticDefaults() { this.HideFromBestiary(); NPCID.Sets.TrailingMode[NPC.type] = 3; NPCID.Sets.TrailCacheLength[NPC.type] = NPC.oldPos.Length; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -89,7 +96,6 @@ namespace CalamityMod.NPCs.ExoMechs.Ares AIType = -1; NPC.Opacity = 0f; NPC.knockBackResist = 0f; - NPC.canGhostHeal = false; NPC.noGravity = true; NPC.noTileCollide = true; NPC.DeathSound = CommonCalamitySounds.ExoDeathSound; @@ -189,8 +195,8 @@ namespace CalamityMod.NPCs.ExoMechs.Ares // Whether Ares should be buffed while in berserk phase bool shouldGetBuffedByBerserkPhase = berserk && !otherMechIsBerserk; - // Target variable - Player player = Main.player[Main.npc[CalamityGlobalNPC.draedonExoMechPrime].target]; + // Target variables + int targetIndex = Main.npc[CalamityGlobalNPC.draedonExoMechPrime].target; if (NPC.ai[2] > 0f) NPC.realLife = (int)NPC.ai[2]; @@ -230,8 +236,8 @@ namespace CalamityMod.NPCs.ExoMechs.Ares if (passivePhase) predictionAmt *= 0.5f; - Vector2 predictionVector = player.velocity * predictionAmt; - Vector2 rotationVector = player.Center + predictionVector - NPC.Center; + Vector2 predictionVector = Main.player[targetIndex].velocity * predictionAmt; + Vector2 rotationVector = Main.player[targetIndex].Center + predictionVector - NPC.Center; float projectileVelocity = passivePhase ? 9.6f : 12f; if (lastMechAlive) @@ -253,7 +259,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares NPC.rotation = NPC.rotation.AngleTowards(rotation, rateOfRotation); // Direction - int direction = Math.Sign(player.Center.X - NPC.Center.X); + int direction = Math.Sign(Main.player[targetIndex].Center.X - NPC.Center.X); if (direction != 0) { NPC.direction = direction; @@ -278,35 +284,31 @@ namespace CalamityMod.NPCs.ExoMechs.Ares float setTimerTo = (int)(plasmaBoltPhaseGateValue * 0.95f) - 1; // Despawn if target is dead - if (player.dead) + if (Main.player[targetIndex].dead) { - player = Main.player[Main.npc[CalamityGlobalNPC.draedonExoMechPrime].target]; - if (player.dead) - { - AIState = (float)Phase.Nothing; - calamityGlobalNPC.newAI[1] = setTimerTo; - calamityGlobalNPC.newAI[2] = 0f; - NPC.dontTakeDamage = true; + AIState = (float)Phase.Nothing; + calamityGlobalNPC.newAI[1] = setTimerTo; + calamityGlobalNPC.newAI[2] = 0f; + NPC.dontTakeDamage = true; + NPC.velocity.Y -= 1f; + if ((double)NPC.position.Y < Main.topWorld + 16f) NPC.velocity.Y -= 1f; - if ((double)NPC.position.Y < Main.topWorld + 16f) - NPC.velocity.Y -= 1f; - if ((double)NPC.position.Y < Main.topWorld + 16f) + if ((double)NPC.position.Y < Main.topWorld + 16f) + { + for (int a = 0; a < Main.maxNPCs; a++) { - for (int a = 0; a < Main.maxNPCs; a++) - { - if (Main.npc[a].type == NPC.type || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || - Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || - Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || - Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || - Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType()) - Main.npc[a].active = false; - } + if (Main.npc[a].type == NPC.type || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || + Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || + Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || + Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || + Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType()) + Main.npc[a].active = false; } - - return; } + + return; } // Default vector to fly to @@ -345,7 +347,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares bool boltsSplitLess = fireMoreBolts && !lastMechAlive; // If Plasma Cannon can fire projectiles, cannot fire if too close to the target and in deathray spiral phase - bool canFire = Vector2.Distance(NPC.Center, player.Center) > 320f || calamityGlobalNPC_Body.newAI[0] != (float)AresBody.Phase.Deathrays; + bool canFire = Vector2.Distance(NPC.Center, Main.player[targetIndex].Center) > 320f || calamityGlobalNPC_Body.newAI[0] != (float)AresBody.Phase.Deathrays; // Telegraph duration for deathray spiral float deathrayTelegraphDuration = bossRush ? AresBody.deathrayTelegraphDuration_BossRush : death ? AresBody.deathrayTelegraphDuration_Death : @@ -444,7 +446,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares if (boltsSplitLess) Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + offset, plasmaBoltVelocity, type, damage, 0f, Main.myPlayer, -1f); else - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + offset, plasmaBoltVelocity, type, damage, 0f, Main.myPlayer, player.Center.X, player.Center.Y); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + offset, plasmaBoltVelocity, type, damage, 0f, Main.myPlayer, Main.player[targetIndex].Center.X, Main.player[targetIndex].Center.Y); } // Recoil @@ -586,7 +588,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares spriteBatch.Draw(texture, center, frame, NPC.GetAlpha(drawColor), NPC.rotation, vector, NPC.scale, spriteEffects, 0f); - Texture2D glowTexture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Ares/AresPlasmaFlamethrowerGlow").Value; + Texture2D glowTexture = GlowTexture.Value; if (CalamityConfig.Instance.Afterimages) { @@ -654,7 +656,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares public override void HitEffect(NPC.HitInfo hit) { for (int k = 0; k < 3; k++) - Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TerraBlade, 0f, 0f, 100, new Color(0, 255, 255), 1f); if (NPC.soundDelay == 0) { @@ -666,14 +668,14 @@ namespace CalamityMod.NPCs.ExoMechs.Ares { for (int i = 0; i < 2; i++) { - Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TerraBlade, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); } for (int j = 0; j < 20; j++) { - int plasmaDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); + int plasmaDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TerraBlade, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); Main.dust[plasmaDust].noGravity = true; Main.dust[plasmaDust].velocity *= 3f; - plasmaDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + plasmaDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TerraBlade, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); Main.dust[plasmaDust].velocity *= 2f; Main.dust[plasmaDust].noGravity = true; } @@ -693,7 +695,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { - NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); NPC.damage = (int)(NPC.damage * 0.8f); } } diff --git a/NPCs/ExoMechs/Ares/AresTeslaCannon.cs b/NPCs/ExoMechs/Ares/AresTeslaCannon.cs index f790886216..09d77162ed 100644 --- a/NPCs/ExoMechs/Ares/AresTeslaCannon.cs +++ b/NPCs/ExoMechs/Ares/AresTeslaCannon.cs @@ -1,4 +1,6 @@ -using CalamityMod.Events; +using System; +using System.IO; +using CalamityMod.Events; using CalamityMod.NPCs.ExoMechs.Thanatos; using CalamityMod.Particles; using CalamityMod.Projectiles.Boss; @@ -6,9 +8,8 @@ using CalamityMod.Sounds; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using ReLogic.Utilities; -using System; -using System.IO; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -68,11 +69,17 @@ namespace CalamityMod.NPCs.ExoMechs.Ares public static readonly SoundStyle TeslaOrbShootSound = new("CalamityMod/Sounds/Custom/ExoMechs/TeslaShoot", 2) { Volume = 1.1f }; + public static Asset GlowTexture; + public override void SetStaticDefaults() { this.HideFromBestiary(); NPCID.Sets.TrailingMode[NPC.type] = 3; NPCID.Sets.TrailCacheLength[NPC.type] = NPC.oldPos.Length; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -90,7 +97,6 @@ namespace CalamityMod.NPCs.ExoMechs.Ares AIType = -1; NPC.Opacity = 0f; NPC.knockBackResist = 0f; - NPC.canGhostHeal = false; NPC.noGravity = true; NPC.noTileCollide = true; NPC.DeathSound = CommonCalamitySounds.ExoDeathSound; @@ -188,8 +194,8 @@ namespace CalamityMod.NPCs.ExoMechs.Ares // Whether Ares should be buffed while in berserk phase bool shouldGetBuffedByBerserkPhase = berserk && !otherMechIsBerserk; - // Target variable - Player player = Main.player[Main.npc[CalamityGlobalNPC.draedonExoMechPrime].target]; + // Target variables + int targetIndex = Main.npc[CalamityGlobalNPC.draedonExoMechPrime].target; if (NPC.ai[2] > 0f) NPC.realLife = (int)NPC.ai[2]; @@ -231,8 +237,8 @@ namespace CalamityMod.NPCs.ExoMechs.Ares if (lastMechAlive) predictionAmt *= 1.5f; - Vector2 predictionVector = player.velocity * predictionAmt; - Vector2 rotationVector = player.Center + predictionVector - NPC.Center; + Vector2 predictionVector = Main.player[targetIndex].velocity * predictionAmt; + Vector2 rotationVector = Main.player[targetIndex].Center + predictionVector - NPC.Center; bool fireMoreOrbs = calamityGlobalNPC_Body.newAI[0] == (float)AresBody.Phase.Deathrays; float projectileVelocity = (passivePhase || fireMoreOrbs) ? 5.2f : 7.8f; @@ -255,7 +261,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares NPC.rotation = NPC.rotation.AngleTowards(rotation, rateOfRotation); // Direction - int direction = Math.Sign(player.Center.X - NPC.Center.X); + int direction = Math.Sign(Main.player[targetIndex].Center.X - NPC.Center.X); if (direction != 0) { NPC.direction = direction; @@ -279,35 +285,31 @@ namespace CalamityMod.NPCs.ExoMechs.Ares float setTimerTo = (int)(teslaOrbPhaseGateValue * 0.3f) - 1; // Despawn if target is dead - if (player.dead) + if (Main.player[targetIndex].dead) { - player = Main.player[Main.npc[CalamityGlobalNPC.draedonExoMechPrime].target]; - if (player.dead) - { - AIState = (float)Phase.Nothing; - calamityGlobalNPC.newAI[1] = setTimerTo; - calamityGlobalNPC.newAI[2] = 0f; - NPC.dontTakeDamage = true; + AIState = (float)Phase.Nothing; + calamityGlobalNPC.newAI[1] = setTimerTo; + calamityGlobalNPC.newAI[2] = 0f; + NPC.dontTakeDamage = true; + NPC.velocity.Y -= 1f; + if ((double)NPC.position.Y < Main.topWorld + 16f) NPC.velocity.Y -= 1f; - if ((double)NPC.position.Y < Main.topWorld + 16f) - NPC.velocity.Y -= 1f; - if ((double)NPC.position.Y < Main.topWorld + 16f) + if ((double)NPC.position.Y < Main.topWorld + 16f) + { + for (int a = 0; a < Main.maxNPCs; a++) { - for (int a = 0; a < Main.maxNPCs; a++) - { - if (Main.npc[a].type == NPC.type || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || - Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || - Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || - Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || - Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType()) - Main.npc[a].active = false; - } + if (Main.npc[a].type == NPC.type || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || + Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || + Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || + Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || + Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType()) + Main.npc[a].active = false; } - - return; } + + return; } // Default vector to fly to @@ -343,7 +345,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares float movementDistanceGateValue = 50f; // If Tesla Cannon can fire projectiles, cannot fire if too close to the target and in deathray spiral phase - bool canFire = Vector2.Distance(NPC.Center, player.Center) > 320f || calamityGlobalNPC_Body.newAI[0] != (float)AresBody.Phase.Deathrays; + bool canFire = Vector2.Distance(NPC.Center, Main.player[targetIndex].Center) > 320f || calamityGlobalNPC_Body.newAI[0] != (float)AresBody.Phase.Deathrays; // Telegraph duration for deathray spiral float deathrayTelegraphDuration = bossRush ? AresBody.deathrayTelegraphDuration_BossRush : death ? AresBody.deathrayTelegraphDuration_Death : @@ -580,7 +582,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares spriteBatch.Draw(texture, center, frame, NPC.GetAlpha(drawColor), NPC.rotation, vector, NPC.scale, spriteEffects, 0f); - Texture2D glowTexture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Ares/AresTeslaCannonGlow").Value; + Texture2D glowTexture = GlowTexture.Value; if (CalamityConfig.Instance.Afterimages) { @@ -648,7 +650,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares public override void HitEffect(NPC.HitInfo hit) { for (int k = 0; k < 3; k++) - Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TerraBlade, 0f, 0f, 100, new Color(0, 255, 255), 1f); if (NPC.soundDelay == 0) { @@ -660,14 +662,14 @@ namespace CalamityMod.NPCs.ExoMechs.Ares { for (int i = 0; i < 2; i++) { - Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TerraBlade, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); } for (int j = 0; j < 20; j++) { - int plasmaDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); + int plasmaDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TerraBlade, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); Main.dust[plasmaDust].noGravity = true; Main.dust[plasmaDust].velocity *= 3f; - plasmaDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + plasmaDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TerraBlade, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); Main.dust[plasmaDust].velocity *= 2f; Main.dust[plasmaDust].noGravity = true; } @@ -687,7 +689,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { - NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); NPC.damage = (int)(NPC.damage * 0.8f); } } diff --git a/NPCs/ExoMechs/Artemis/Artemis.cs b/NPCs/ExoMechs/Artemis/Artemis.cs index 43ef3dad83..705b0c02f0 100644 --- a/NPCs/ExoMechs/Artemis/Artemis.cs +++ b/NPCs/ExoMechs/Artemis/Artemis.cs @@ -1,4 +1,7 @@ -using CalamityMod.Events; +using System; +using System.Collections.Generic; +using System.IO; +using CalamityMod.Events; using CalamityMod.Graphics.Primitives; using CalamityMod.Items.Potions; using CalamityMod.NPCs.ExoMechs.Ares; @@ -10,10 +13,8 @@ using CalamityMod.UI.VanillaBossBars; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using ReLogic.Utilities; -using System; -using System.Collections.Generic; -using System.IO; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -41,6 +42,8 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis public static readonly SoundStyle SpinLaserbeamSound = new("CalamityMod/Sounds/Custom/ExoMechs/ArtemisSpinLaserbeam") { Volume = 1.3f }; + public static Asset GlowTexture; + internal static void LoadHeadIcons() { string phase1IconPath = "CalamityMod/NPCs/ExoMechs/Artemis/ArtemisHead"; @@ -168,6 +171,10 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis Rotation = MathHelper.Pi - MathHelper.PiOver4 }; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -279,7 +286,7 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis NPC.TargetClosest(); // Target variable - Player player = Main.player[NPC.target]; + int targetIndex = NPC.target; // Check if the other exo mechs are alive int otherExoMechsAlive = 0; @@ -292,7 +299,7 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis if (Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].active) { // Set target to Apollo's target if Apollo is alive - player = Main.player[Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].target]; + targetIndex = Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].target; // Link the HP of both twins if (NPC.life > Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].life) @@ -307,7 +314,7 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis if (Main.npc[CalamityGlobalNPC.draedonExoMechWorm].active) { // Set target to Thanatos' target if Thanatos is alive - player = Main.player[Main.npc[CalamityGlobalNPC.draedonExoMechWorm].target]; + targetIndex = Main.npc[CalamityGlobalNPC.draedonExoMechWorm].target; otherExoMechsAlive++; exoWormAlive = true; @@ -318,7 +325,7 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis if (Main.npc[CalamityGlobalNPC.draedonExoMechPrime].active) { // Set target to Ares' target if Ares is alive - player = Main.player[Main.npc[CalamityGlobalNPC.draedonExoMechPrime].target]; + targetIndex = Main.npc[CalamityGlobalNPC.draedonExoMechPrime].target; otherExoMechsAlive++; exoPrimeAlive = true; @@ -402,7 +409,7 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis { NPC.ai[0] += 1f; if (NPC.ai[0] == 10f && !NPC.AnyNPCs(ModContent.NPCType())) - NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); + NPC.SpawnOnPlayer(Main.player[targetIndex].whoAmI, ModContent.NPCType()); } else { @@ -458,7 +465,7 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis // Spin variables float spinRadius = 500f; float spinLocationDistance = 50f; - Vector2 spinLocation = player.Center; + Vector2 spinLocation = Main.player[targetIndex].Center; switch ((int)NPC.ai[3]) { // Laser from top @@ -550,11 +557,11 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis // Default vector to fly to bool flyLeft = NPC.ai[0] % 2f == 0f || NPC.ai[0] < 10f || !revenge; float destinationX = flyLeft ? -750f : 750f; - float destinationY = player.Center.Y; - Vector2 destination = SecondaryAIState == (float)SecondaryPhase.PassiveAndImmune ? new Vector2(player.Center.X + destinationX * 1.6f, destinationY) : - SecondaryAIState == (float)SecondaryPhase.Passive ? new Vector2(player.Center.X + destinationX, destinationY + 360f) : + float destinationY = Main.player[targetIndex].Center.Y; + Vector2 destination = SecondaryAIState == (float)SecondaryPhase.PassiveAndImmune ? new Vector2(Main.player[targetIndex].Center.X + destinationX * 1.6f, destinationY) : + SecondaryAIState == (float)SecondaryPhase.Passive ? new Vector2(Main.player[targetIndex].Center.X + destinationX, destinationY + 360f) : AIState == (float)Phase.Deathray ? spinLocation : - new Vector2(player.Center.X + destinationX, destinationY); + new Vector2(Main.player[targetIndex].Center.X + destinationX, destinationY); // Add a bit of randomness to the destination, but only in specific phases where it's necessary if (AIState == (float)Phase.Normal || AIState == (float)Phase.LaserShotgun || AIState == (float)Phase.PhaseTransition) @@ -581,10 +588,10 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis bool canFire = distanceFromDestination.Length() <= 320f && canFireLasers; // Rotation - Vector2 predictionVector = AIState == (float)Phase.Deathray ? Vector2.Zero : player.velocity * predictionAmt; - Vector2 aimedVector = player.Center + predictionVector - NPC.Center; + Vector2 predictionVector = AIState == (float)Phase.Deathray ? Vector2.Zero : Main.player[targetIndex].velocity * predictionAmt; + Vector2 aimedVector = Main.player[targetIndex].Center + predictionVector - NPC.Center; float rateOfRotation = 0.1f; - Vector2 rotateTowards = player.Center - NPC.Center; + Vector2 rotateTowards = Main.player[targetIndex].Center - NPC.Center; bool stopRotatingAndSlowDown = !phase2 && AIState == (float)Phase.Normal && lineUpAttack; if (!stopRotatingAndSlowDown) { @@ -609,8 +616,8 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis } else { - float x = player.Center.X + predictionVector.X - NPC.Center.X; - float y = player.Center.Y + predictionVector.Y - NPC.Center.Y; + float x = Main.player[targetIndex].Center.X + predictionVector.X - NPC.Center.X; + float y = Main.player[targetIndex].Center.Y + predictionVector.Y - NPC.Center.Y; rotateTowards = Vector2.Normalize(new Vector2(x, y)) * baseVelocity; } @@ -620,45 +627,40 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis } // Despawn if target is dead - if (player.dead) + if (Main.player[targetIndex].dead) { - NPC.TargetClosest(false); - player = Main.player[NPC.target]; - if (player.dead) - { - AIState = (float)Phase.Normal; - NPC.ai[1] = 0f; - NPC.ai[2] = 0f; - NPC.localAI[0] = 0f; - NPC.localAI[1] = 0f; - NPC.localAI[2] = 0f; - calamityGlobalNPC.newAI[2] = 0f; - calamityGlobalNPC.newAI[3] = 0f; - rotationDirection = 0; - chargeVelocityNormalized = default; - spinningPoint = default; - spinVelocity = default; - NPC.dontTakeDamage = true; + AIState = (float)Phase.Normal; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.localAI[0] = 0f; + NPC.localAI[1] = 0f; + NPC.localAI[2] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + calamityGlobalNPC.newAI[3] = 0f; + rotationDirection = 0; + chargeVelocityNormalized = default; + spinningPoint = default; + spinVelocity = default; + NPC.dontTakeDamage = true; + NPC.velocity.Y -= 1f; + if ((double)NPC.position.Y < Main.topWorld + 16f) NPC.velocity.Y -= 1f; - if ((double)NPC.position.Y < Main.topWorld + 16f) - NPC.velocity.Y -= 1f; - if ((double)NPC.position.Y < Main.topWorld + 16f) + if ((double)NPC.position.Y < Main.topWorld + 16f) + { + for (int a = 0; a < Main.maxNPCs; a++) { - for (int a = 0; a < Main.maxNPCs; a++) - { - if (Main.npc[a].type == NPC.type || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || - Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || - Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || - Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || - Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType()) - Main.npc[a].active = false; - } + if (Main.npc[a].type == NPC.type || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || + Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || + Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || + Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || + Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType()) + Main.npc[a].active = false; } - - return; } + + return; } // Duration of deathray spin to do a full circle @@ -724,6 +726,9 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis // Fly to the left of the target case (int)Phase.Normal: + // Avoid cheap bullshit + NPC.damage = 0; + if (!stopRotatingAndSlowDown) { // Set charge variable to default @@ -768,7 +773,7 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis else { Vector2 laserVelocity = Vector2.Normalize(aimedVector); - Vector2 projectileDestination = player.Center + predictionVector; + Vector2 projectileDestination = Main.player[targetIndex].Center + predictionVector; pointToLookAt = projectileDestination; SoundEngine.PlaySound(CommonCalamitySounds.ExoLaserShootSound, NPC.Center); if (Main.netMode != NetmodeID.MultiplayerClient) @@ -859,6 +864,9 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis } else { + // Set damage + NPC.damage = NPC.defDamage; + // Charge until a certain distance is reached and then return to normal phase SoundEngine.PlaySound(ChargeSound, NPC.Center); AIState = (float)Phase.Charge; @@ -877,6 +885,9 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis // Charge case (int)Phase.Charge: + // Set damage + NPC.damage = NPC.defDamage; + // Allow the charge flash to happen shouldDoChargeFlash = true; @@ -884,6 +895,9 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis calamityGlobalNPC.newAI[2] += 1f; if (calamityGlobalNPC.newAI[2] >= chargeDuration) { + // Avoid cheap bullshit + NPC.damage = 0; + // Decelerate NPC.velocity *= decelerationVelocityMult; @@ -901,6 +915,9 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis // Laser shotgun barrage case (int)Phase.LaserShotgun: + // Avoid cheap bullshit + NPC.damage = 0; + // Smooth movement towards the location Artemis is meant to be at CalamityUtils.SmoothMovement(NPC, movementDistanceGateValue, distanceFromDestination, baseVelocity, 0f, false); @@ -926,9 +943,9 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis int baseSpread = ((nerfedAttacks || nerfedLaserShotgun) ? 9 : lastMechAlive ? 20 : 15) + numLasersAddedByDifficulty * 2; int spread = baseSpread + (int)(calamityGlobalNPC.newAI[2] / divisor2) * (baseSpread / 4); float rotation = MathHelper.ToRadians(spread); - float distanceFromTarget = Vector2.Distance(NPC.Center, player.Center + predictionVector); + float distanceFromTarget = Vector2.Distance(NPC.Center, Main.player[targetIndex].Center + predictionVector); float setVelocityInAI = death ? 6.5f : revenge ? 6.25f : expertMode ? 6f : 5.5f; - pointToLookAt = player.Center + predictionVector; + pointToLookAt = Main.player[targetIndex].Center + predictionVector; for (int i = 0; i < numLasersPerSpread + 1; i++) { @@ -961,6 +978,9 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis // Fly above target, fire deathray and move in a circle around the target case (int)Phase.Deathray: + // Avoid cheap bullshit + NPC.damage = 0; + // Fly above, stop doing this if in the proper position // Stop rotating and spin around a target point if ((destination - NPC.Center).Length() < spinLocationDistance || calamityGlobalNPC.newAI[2] > 0f) @@ -1024,7 +1044,7 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis // Laser from top case 0: case 1: - if (player.Center.X >= NPC.Center.X) + if (Main.player[targetIndex].Center.X >= NPC.Center.X) rotationDirection = 1; else rotationDirection = -1; @@ -1032,7 +1052,7 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis // Laser from bottom case 2: - if (player.Center.X >= NPC.Center.X) + if (Main.player[targetIndex].Center.X >= NPC.Center.X) rotationDirection = -1; else rotationDirection = 1; @@ -1041,7 +1061,7 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis // Laser from left case 3: - if (player.Center.Y >= NPC.Center.Y) + if (Main.player[targetIndex].Center.Y >= NPC.Center.Y) rotationDirection = -1; else rotationDirection = 1; @@ -1050,7 +1070,7 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis // Laser from right case 4: - if (player.Center.Y >= NPC.Center.Y) + if (Main.player[targetIndex].Center.Y >= NPC.Center.Y) rotationDirection = 1; else rotationDirection = -1; @@ -1178,6 +1198,9 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis // Phase transition animation, that's all this exists for case (int)Phase.PhaseTransition: + // Avoid cheap bullshit + NPC.damage = 0; + // Smooth movement towards the location Artemis is meant to be at CalamityUtils.SmoothMovement(NPC, movementDistanceGateValue, distanceFromDestination, baseVelocity, 0f, false); @@ -1255,7 +1278,7 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis if (hitboxBotRight < minDist) minDist = hitboxBotRight; - return minDist <= 100f && NPC.Opacity == 1f && AIState == (float)Phase.Charge; + return minDist <= 100f && NPC.Opacity == 1f; } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) @@ -1470,7 +1493,7 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis } } - texture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Artemis/ArtemisGlow").Value; + texture = GlowTexture.Value; if (CalamityConfig.Instance.Afterimages && !NPC.IsABestiaryIconDummy) { for (int i = 1; i < numAfterimages; i += 2) @@ -1536,7 +1559,7 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis public override void HitEffect(NPC.HitInfo hit) { for (int k = 0; k < 3; k++) - Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1f); if (NPC.soundDelay == 0) { @@ -1548,14 +1571,14 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis { for (int i = 0; i < 2; i++) { - Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); } for (int j = 0; j < 20; j++) { - int plasmaDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); + int plasmaDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); Main.dust[plasmaDust].noGravity = true; Main.dust[plasmaDust].velocity *= 3f; - plasmaDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + plasmaDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); Main.dust[plasmaDust].velocity *= 2f; Main.dust[plasmaDust].noGravity = true; } @@ -1598,7 +1621,7 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { - NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } } diff --git a/NPCs/ExoMechs/Draedon.cs b/NPCs/ExoMechs/Draedon.cs index cf784fd48c..623673c9f1 100644 --- a/NPCs/ExoMechs/Draedon.cs +++ b/NPCs/ExoMechs/Draedon.cs @@ -1,23 +1,24 @@ -using CalamityMod.Events; +using System; +using System.IO; +using CalamityMod.Events; +using CalamityMod.Items.Weapons.DraedonsArsenal; using CalamityMod.NPCs.ExoMechs.Ares; using CalamityMod.NPCs.ExoMechs.Thanatos; +using CalamityMod.Sounds; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; +using ReLogic.Content; using Terraria; +using Terraria.Audio; using Terraria.GameContent; using Terraria.GameContent.Bestiary; using Terraria.Graphics.Effects; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Sounds; - using ApolloBoss = CalamityMod.NPCs.ExoMechs.Apollo.Apollo; using ArtemisBoss = CalamityMod.NPCs.ExoMechs.Artemis.Artemis; -using Terraria.Audio; namespace CalamityMod.NPCs.ExoMechs { @@ -81,10 +82,15 @@ namespace CalamityMod.NPCs.ExoMechs public static readonly SoundStyle TeleportSound = new("CalamityMod/Sounds/Custom/DraedonTeleport"); public static readonly SoundStyle SelectionSound = new("CalamityMod/Sounds/Custom/Codebreaker/ExoMechsIconSelect"); + public static Asset Texture_Glow; + public static Asset HoloTexture; + public static Asset ProjectorTexture; + public static Asset ProjectorTexture_Glow; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 12; - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { PortraitPositionYOverride = 40f, Scale = 0.7f, @@ -95,6 +101,13 @@ namespace CalamityMod.NPCs.ExoMechs NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; NPCID.Sets.ShouldBeCountedAsBoss[NPC.type] = true; NPCID.Sets.MustAlwaysDraw[NPC.type] = true; + if (!Main.dedServ) + { + Texture_Glow = ModContent.Request(Texture + "Glowmask", AssetRequestMode.AsyncLoad); + HoloTexture = ModContent.Request("CalamityMod/NPCs/ExoMechs/HologramDraedon", AssetRequestMode.AsyncLoad); + ProjectorTexture = ModContent.Request(Texture + "Projector", AssetRequestMode.AsyncLoad); + ProjectorTexture_Glow = ModContent.Request(Texture + "ProjectorGlowmask", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -115,7 +128,7 @@ namespace CalamityMod.NPCs.ExoMechs public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Draedon") }); @@ -164,14 +177,14 @@ namespace CalamityMod.NPCs.ExoMechs // Prevent stupid natural despawns. NPC.timeLeft = 3600; - // Check if Boss Rush is active - bool bossRush = BossRushEvent.BossRushActive; + // Check if Boss Rush is active + bool bossRush = BossRushEvent.BossRushActive; // Emit music. If the battle is ongoing, Draedon emits the battle theme. // Otherwise, he emits his trademark ambience. // This takes priority over anything except Moon Lord's music fadeout. if (!ExoMechIsPresent) - CalamityGlobalNPC.draedonAmbience = NPC.whoAmI; + CalamityGlobalNPC.draedonAmbience = NPC.whoAmI; // Decide an initial target and play a teleport sound on the first frame. if (TalkTimer == 0f) @@ -374,131 +387,131 @@ namespace CalamityMod.NPCs.ExoMechs if (Main.netMode != NetmodeID.Server) { - SoundEngine.PlaySound(CommonCalamitySounds.FlareSound with { Volume = CommonCalamitySounds.FlareSound.Volume * 1.55f}, PlayerToFollow.Center); + SoundEngine.PlaySound(CommonCalamitySounds.FlareSound with { Volume = CommonCalamitySounds.FlareSound.Volume * 1.55f }, PlayerToFollow.Center); if (!exoMechdusa) - SoundEngine.PlaySound(SelectionSound, PlayerToFollow.Center); + SoundEngine.PlaySound(SelectionSound, PlayerToFollow.Center); } } - if (!bossRush && !exoMechdusa) - { - // Dialogue lines depending on what phase the exo mechs are at. - switch ((int)DialogueType) - { - case 1: + if (!bossRush && !exoMechdusa) + { + // Dialogue lines depending on what phase the exo mechs are at. + switch ((int)DialogueType) + { + case 1: - if (Main.netMode != NetmodeID.MultiplayerClient && TalkTimer == ExoMechPhaseDialogueTime) - { - CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.Status.Boss.DraedonExoPhase1Text1", TextColor); - NPC.netUpdate = true; - } + if (Main.netMode != NetmodeID.MultiplayerClient && TalkTimer == ExoMechPhaseDialogueTime) + { + CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.Status.Boss.DraedonExoPhase1Text1", TextColor); + NPC.netUpdate = true; + } - if (Main.netMode != NetmodeID.MultiplayerClient && TalkTimer == ExoMechPhaseDialogueTime + DelayPerDialogLine) - { - CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.Status.Boss.DraedonExoPhase1Text2", TextColor); - NPC.netUpdate = true; - } + if (Main.netMode != NetmodeID.MultiplayerClient && TalkTimer == ExoMechPhaseDialogueTime + DelayPerDialogLine) + { + CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.Status.Boss.DraedonExoPhase1Text2", TextColor); + NPC.netUpdate = true; + } - break; + break; - case 2: + case 2: - if (TalkTimer == ExoMechPhaseDialogueTime) - { - SoundEngine.PlaySound(LaughSound, PlayerToFollow.Center); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.Status.Boss.DraedonExoPhase2Text1", TextColor); - NPC.netUpdate = true; - } - } + if (TalkTimer == ExoMechPhaseDialogueTime) + { + SoundEngine.PlaySound(LaughSound, PlayerToFollow.Center); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.Status.Boss.DraedonExoPhase2Text1", TextColor); + NPC.netUpdate = true; + } + } - if (Main.netMode != NetmodeID.MultiplayerClient && TalkTimer == ExoMechPhaseDialogueTime + DelayPerDialogLine) - { - CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.Status.Boss.DraedonExoPhase2Text2", TextColor); - NPC.netUpdate = true; - } + if (Main.netMode != NetmodeID.MultiplayerClient && TalkTimer == ExoMechPhaseDialogueTime + DelayPerDialogLine) + { + CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.Status.Boss.DraedonExoPhase2Text2", TextColor); + NPC.netUpdate = true; + } - break; + break; - case 3: + case 3: - if (Main.netMode != NetmodeID.MultiplayerClient && TalkTimer == ExoMechPhaseDialogueTime) - { - CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.Status.Boss.DraedonExoPhase3Text1", TextColor); - NPC.netUpdate = true; - } + if (Main.netMode != NetmodeID.MultiplayerClient && TalkTimer == ExoMechPhaseDialogueTime) + { + CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.Status.Boss.DraedonExoPhase3Text1", TextColor); + NPC.netUpdate = true; + } - if (TalkTimer == ExoMechPhaseDialogueTime + DelayPerDialogLine) - { - SoundEngine.PlaySound(LaughSound, PlayerToFollow.Center); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.Status.Boss.DraedonExoPhase3Text2", TextColor); - NPC.netUpdate = true; - } - } + if (TalkTimer == ExoMechPhaseDialogueTime + DelayPerDialogLine) + { + SoundEngine.PlaySound(LaughSound, PlayerToFollow.Center); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.Status.Boss.DraedonExoPhase3Text2", TextColor); + NPC.netUpdate = true; + } + } - break; + break; - case 4: + case 4: - if (Main.netMode != NetmodeID.MultiplayerClient && TalkTimer == ExoMechPhaseDialogueTime) - { - CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.Status.Boss.DraedonExoPhase4Text1", TextColor); - NPC.netUpdate = true; - } + if (Main.netMode != NetmodeID.MultiplayerClient && TalkTimer == ExoMechPhaseDialogueTime) + { + CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.Status.Boss.DraedonExoPhase4Text1", TextColor); + NPC.netUpdate = true; + } - if (Main.netMode != NetmodeID.MultiplayerClient && TalkTimer == ExoMechPhaseDialogueTime + DelayPerDialogLine) - { - CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.Status.Boss.DraedonExoPhase4Text2", TextColor); - NPC.netUpdate = true; - } + if (Main.netMode != NetmodeID.MultiplayerClient && TalkTimer == ExoMechPhaseDialogueTime + DelayPerDialogLine) + { + CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.Status.Boss.DraedonExoPhase4Text2", TextColor); + NPC.netUpdate = true; + } - break; + break; - case 5: + case 5: - if (Main.netMode != NetmodeID.MultiplayerClient && TalkTimer == ExoMechPhaseDialogueTime) - { - CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.Status.Boss.DraedonExoPhase5Text1", TextColor); - NPC.netUpdate = true; - } + if (Main.netMode != NetmodeID.MultiplayerClient && TalkTimer == ExoMechPhaseDialogueTime) + { + CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.Status.Boss.DraedonExoPhase5Text1", TextColor); + NPC.netUpdate = true; + } - if (Main.netMode != NetmodeID.MultiplayerClient && TalkTimer == ExoMechPhaseDialogueTime + DelayPerDialogLine) - { - CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.Status.Boss.DraedonExoPhase5Text2", TextColor); - NPC.netUpdate = true; - } + if (Main.netMode != NetmodeID.MultiplayerClient && TalkTimer == ExoMechPhaseDialogueTime + DelayPerDialogLine) + { + CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.Status.Boss.DraedonExoPhase5Text2", TextColor); + NPC.netUpdate = true; + } - break; + break; - case 6: + case 6: - if (Main.netMode != NetmodeID.MultiplayerClient && TalkTimer == ExoMechPhaseDialogueTime) - { - CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.Status.Boss.DraedonExoPhase6Text1", TextColor); - NPC.netUpdate = true; - } + if (Main.netMode != NetmodeID.MultiplayerClient && TalkTimer == ExoMechPhaseDialogueTime) + { + CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.Status.Boss.DraedonExoPhase6Text1", TextColor); + NPC.netUpdate = true; + } - if (Main.netMode != NetmodeID.MultiplayerClient && TalkTimer == ExoMechPhaseDialogueTime + DelayPerDialogLine) - { - CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.Status.Boss.DraedonExoPhase6Text2", TextColor); - NPC.netUpdate = true; - } + if (Main.netMode != NetmodeID.MultiplayerClient && TalkTimer == ExoMechPhaseDialogueTime + DelayPerDialogLine) + { + CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.Status.Boss.DraedonExoPhase6Text2", TextColor); + NPC.netUpdate = true; + } - if (TalkTimer == ExoMechPhaseDialogueTime + DelayPerDialogLine * 2f) - { - SoundEngine.PlaySound(LaughSound, PlayerToFollow.Center); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.Status.Boss.DraedonExoPhase6Text3", TextColor); - NPC.netUpdate = true; - } - } + if (TalkTimer == ExoMechPhaseDialogueTime + DelayPerDialogLine * 2f) + { + SoundEngine.PlaySound(LaughSound, PlayerToFollow.Center); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.Status.Boss.DraedonExoPhase6Text3", TextColor); + NPC.netUpdate = true; + } + } - break; - } + break; + } } if (TalkTimer > ExoMechChooseDelay + 10f && !ExoMechIsPresent) @@ -514,7 +527,7 @@ namespace CalamityMod.NPCs.ExoMechs SoundEngine.PlaySound(SoundID.Item33, NPC.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { - Vector2 shoot = PlayerToFollow.Center - NPC.Center; + Vector2 shoot = PlayerToFollow.Center - NPC.Center; shoot.Normalize(); shoot *= 4; int p = Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center - Vector2.UnitY * 30, shoot, ModContent.ProjectileType(), 116, 0, Main.myPlayer); @@ -644,9 +657,9 @@ namespace CalamityMod.NPCs.ExoMechs NPC.HitEffect(); NPC.active = false; NPC.netUpdate = true; - // Die you lil piece of shit stop creating endless loop in BR - if (BossRushEvent.BossRushActive) - NPC.NPCLoot(); + // Die you lil piece of shit stop creating endless loop in BR + if (BossRushEvent.BossRushActive) + NPC.NPCLoot(); } } @@ -658,7 +671,7 @@ namespace CalamityMod.NPCs.ExoMechs Lighting.AddLight(NPC.Center, 0.5f, 1.25f, 1.25f); if (ProjFrameChangeCounter == 0) { - Dust d = Main.dust[Dust.NewDust(new Vector2(NPC.Center.X - 45, NPC.Center.Y - 70), NPC.width, (int)(NPC.height * 1.5f), 229, 0, Main.rand.Next(-2, -1), 60)]; + Dust d = Main.dust[Dust.NewDust(new Vector2(NPC.Center.X - 45, NPC.Center.Y - 70), NPC.width, (int)(NPC.height * 1.5f), DustID.Vortex, 0, Main.rand.Next(-2, -1), 60)]; d.noGravity = true; } } @@ -805,8 +818,8 @@ namespace CalamityMod.NPCs.ExoMechs public override bool CheckDead() { - if (BossRushEvent.BossRushActive || exoMechdusa) - return true; + if (BossRushEvent.BossRushActive || exoMechdusa) + return true; if (!HasBeenKilled) { @@ -835,11 +848,11 @@ namespace CalamityMod.NPCs.ExoMechs spriteBatch.EnterShaderRegion(); bool holo = HasBeenKilled && KillReappearDelay <= 0; bool leaving = HasBeenKilled && DefeatTimer > DelayBeforeDefeatStandup + TalkDelay * 8f + 200f; - Texture2D texture = HasBeenKilled && KillReappearDelay <= 0f ? ModContent.Request("CalamityMod/NPCs/ExoMechs/HologramDraedon").Value : TextureAssets.Npc[NPC.type].Value; - Texture2D glowmask = ModContent.Request("CalamityMod/NPCs/ExoMechs/DraedonGlowmask").Value; - Texture2D projector = ModContent.Request("CalamityMod/NPCs/ExoMechs/DraedonProjector").Value; - Texture2D projectorglow = ModContent.Request("CalamityMod/NPCs/ExoMechs/DraedonProjectorGlowmask").Value; - Texture2D gun = ModContent.Request("CalamityMod/Items/Weapons/DraedonsArsenal/PulseRifle").Value; + Texture2D texture = HasBeenKilled && KillReappearDelay <= 0f ? HoloTexture.Value : TextureAssets.Npc[NPC.type].Value; + Texture2D glowmask = Texture_Glow.Value; + Texture2D projector = ProjectorTexture.Value; + Texture2D projectorglow = ProjectorTexture_Glow.Value; + Texture2D gun = TextureAssets.Item[ModContent.ItemType()].Value; Rectangle frame = NPC.frame; Vector2 drawPosition = NPC.Center - screenPos - Vector2.UnitY * 38f; @@ -858,7 +871,7 @@ namespace CalamityMod.NPCs.ExoMechs Vector2 playerToDrae = PlayerToFollow.Center - NPC.Center; playerToDrae.Normalize(); float extraRotation = PlayerToFollow.Center.X - NPC.Center.X < 0 ? -MathHelper.PiOver4 * 4 : 0; - float gunRotation = playerToDrae.ToRotation() + extraRotation; + float gunRotation = playerToDrae.ToRotation() + extraRotation; if (!NPC.IsABestiaryIconDummy) { @@ -870,7 +883,7 @@ namespace CalamityMod.NPCs.ExoMechs } if (!leaving) - spriteBatch.Draw(texture, new Vector2(drawPosition.X, drawPosition.Y + hoveroffset), holo ? null : frame, holo ? holoColor : (drawColor * NPC.Opacity), NPC.rotation, origin, NPC.scale, direction, 0f); + spriteBatch.Draw(texture, new Vector2(drawPosition.X, drawPosition.Y + hoveroffset), holo ? null : frame, holo ? holoColor : (drawColor * NPC.Opacity), NPC.rotation, origin, NPC.scale, direction, 0f); if (!NPC.IsABestiaryIconDummy) spriteBatch.ExitShaderRegion(); diff --git a/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs b/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs index b262f0b856..d14f1fbf62 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs @@ -1,12 +1,13 @@ -using CalamityMod.Events; +using System; +using System.IO; +using CalamityMod.Events; using CalamityMod.Particles; using CalamityMod.Projectiles.Boss; using CalamityMod.Sounds; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -50,10 +51,16 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.ThanatosHead.DisplayName"); + public static Asset GlowTexture; + public override void SetStaticDefaults() { this.HideFromBestiary(); Main.npcFrameCount[NPC.type] = 5; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -73,7 +80,6 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos AIType = -1; NPC.knockBackResist = 0f; NPC.Opacity = 0f; - NPC.canGhostHeal = false; NPC.behindTiles = true; NPC.noGravity = true; NPC.noTileCollide = true; @@ -169,7 +175,8 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos // Set vulnerable to false by default vulnerable = false; - CalamityGlobalNPC calamityGlobalNPC_Head = Main.npc[(int)NPC.ai[2]].Calamity(); + NPC head = Main.npc[(int)NPC.ai[2]]; + CalamityGlobalNPC calamityGlobalNPC_Head = head.Calamity(); bool invisiblePhase = calamityGlobalNPC_Head.newAI[1] == (float)ThanatosHead.SecondaryPhase.PassiveAndImmune; NPC.dontTakeDamage = Main.npc[(int)NPC.ai[2]].dontTakeDamage; @@ -258,7 +265,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos double numSegmentsAbleToFire = bossRush ? 42D : death ? 36D : revenge ? 34D : expertMode ? 30D : 24D; if (shouldGetBuffedByBerserkPhase) numSegmentsAbleToFire *= 1.25; - + float segmentDivisor = (float)Math.Round(numSegments / numSegmentsAbleToFire); if (calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge) @@ -470,7 +477,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos SmokeDrawer.Update(); - Player player = Main.player[Main.npc[CalamityGlobalNPC.draedonExoMechWorm].target]; + Player player = Main.player[head.target]; Vector2 npcCenter = NPC.Center; float targetCenterX = player.Center.X; @@ -482,31 +489,72 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos targetCenterX -= npcCenter.X; targetCenterY -= npcCenter.Y; - float distanceFromTarget = (float)Math.Sqrt(targetCenterX * targetCenterX + targetCenterY * targetCenterY); + float newPosition = (float)Math.Sqrt(targetCenterX * targetCenterX + targetCenterY * targetCenterY); if (NPC.ai[1] > 0f && NPC.ai[1] < Main.npc.Length) { try { - npcCenter = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); - targetCenterX = Main.npc[(int)NPC.ai[1]].position.X + (Main.npc[(int)NPC.ai[1]].width / 2) - npcCenter.X; - targetCenterY = Main.npc[(int)NPC.ai[1]].position.Y + (Main.npc[(int)NPC.ai[1]].height / 2) - npcCenter.Y; + npcCenter = NPC.Center; + targetCenterX = Main.npc[(int)NPC.ai[1]].Center.X - npcCenter.X; + targetCenterY = Main.npc[(int)NPC.ai[1]].Center.Y - npcCenter.Y; } catch { } NPC.rotation = (float)Math.Atan2(targetCenterY, targetCenterX) + MathHelper.PiOver2; - distanceFromTarget = (float)Math.Sqrt(targetCenterX * targetCenterX + targetCenterY * targetCenterY); - distanceFromTarget = (distanceFromTarget - NPC.width) / distanceFromTarget; - targetCenterX *= distanceFromTarget; - targetCenterY *= distanceFromTarget; + newPosition = (float)Math.Sqrt(targetCenterX * targetCenterX + targetCenterY * targetCenterY); + newPosition = (newPosition - NPC.width) / newPosition; + targetCenterX *= newPosition; + targetCenterY *= newPosition; NPC.velocity = Vector2.Zero; - NPC.position.X = NPC.position.X + targetCenterX; - NPC.position.Y = NPC.position.Y + targetCenterY; + NPC.position.X += targetCenterX; + NPC.position.Y += targetCenterY; if (targetCenterX < 0f) NPC.spriteDirection = -1; else if (targetCenterX > 0f) NPC.spriteDirection = 1; } + + bool speedUp = head.localAI[3] < 180f; + + // Distance from target + float distanceFromTarget = Vector2.Distance(head.Center, speedUp ? (player.Center + new Vector2(0f, 2400f)) : player.Center); + + // Increase speed if too far from target + float increaseSpeedMult = 1f; + float increaseSpeedGateValue = 600f; + if (distanceFromTarget > increaseSpeedGateValue) + { + float distanceAmount = MathHelper.Clamp((distanceFromTarget - increaseSpeedGateValue) / (CalamityGlobalNPC.CatchUpDistance350Tiles - increaseSpeedGateValue), 0f, 1f); + increaseSpeedMult = MathHelper.Lerp(1f, 3.5f, distanceAmount); + } + + // Velocity and turn speed values + float baseVelocityMult = (shouldGetBuffedByBerserkPhase ? 0.15f : 0f) + (bossRush ? 1.25f : death ? 1.2f : revenge ? 1.175f : expertMode ? 1.15f : 1.1f); + float baseVelocity = 10f * baseVelocityMult; + + // Increase top velocity if target is dead or if Thanatos is uncoiling + if (player.dead || speedUp) + baseVelocity *= 4f; + else + baseVelocity *= increaseSpeedMult; + + if (Main.getGoodWorld) + baseVelocity *= 1.15f; + + // Calculate contact damage based on velocity + float minimalContactDamageVelocity = baseVelocity * 0.25f; + float minimalDamageVelocity = baseVelocity * 0.5f; + float bodyAndTailVelocity = (NPC.position - NPC.oldPosition).Length(); + if (bodyAndTailVelocity <= minimalContactDamageVelocity) + { + NPC.damage = 0; + } + else + { + float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); + NPC.damage = (int)MathHelper.Lerp(0f, NPC.defDamage, velocityDamageScalar); + } } public override bool CanHitPlayer(Player target, ref int cooldownSlot) @@ -584,7 +632,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos center += vector * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture, center, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector, NPC.scale, spriteEffects, 0f); - texture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Thanatos/ThanatosBody1Glow").Value; + texture = GlowTexture.Value; spriteBatch.Draw(texture, center, NPC.frame, Color.White * NPC.Opacity, NPC.rotation, vector, NPC.scale, spriteEffects, 0f); SmokeDrawer.DrawSet(NPC.Center); @@ -625,19 +673,19 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos int baseDust = vulnerable ? 3 : 1; for (int k = 0; k < baseDust; k++) - Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TerraBlade, 0f, 0f, 100, new Color(0, 255, 255), 1f); if (NPC.life <= 0) { for (int i = 0; i < 2; i++) - Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TerraBlade, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); for (int j = 0; j < 20; j++) { - int plasmaDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); + int plasmaDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TerraBlade, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); Main.dust[plasmaDust].noGravity = true; Main.dust[plasmaDust].velocity *= 3f; - plasmaDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + plasmaDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TerraBlade, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); Main.dust[plasmaDust].velocity *= 2f; Main.dust[plasmaDust].noGravity = true; } @@ -653,7 +701,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { - NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } } diff --git a/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs b/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs index 8c4d93d0a7..9b3cdbe77f 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs @@ -1,12 +1,13 @@ -using CalamityMod.Events; +using System; +using System.IO; +using CalamityMod.Events; using CalamityMod.Particles; using CalamityMod.Projectiles.Boss; using CalamityMod.Sounds; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -47,11 +48,18 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos private const float timeToOpenAndFireLasers = 36f; private const float segmentCloseTimerDecrement = 0.2f; + + public static Asset GlowTexture; + public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.ThanatosHead.DisplayName"); public override void SetStaticDefaults() { this.HideFromBestiary(); Main.npcFrameCount[NPC.type] = 5; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -71,7 +79,6 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos AIType = -1; NPC.knockBackResist = 0f; NPC.Opacity = 0f; - NPC.canGhostHeal = false; NPC.behindTiles = true; NPC.noGravity = true; NPC.noTileCollide = true; @@ -167,7 +174,8 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos // Set vulnerable to false by default vulnerable = false; - CalamityGlobalNPC calamityGlobalNPC_Head = Main.npc[(int)NPC.ai[2]].Calamity(); + NPC head = Main.npc[(int)NPC.ai[2]]; + CalamityGlobalNPC calamityGlobalNPC_Head = head.Calamity(); bool invisiblePhase = calamityGlobalNPC_Head.newAI[1] == (float)ThanatosHead.SecondaryPhase.PassiveAndImmune; NPC.dontTakeDamage = Main.npc[(int)NPC.ai[2]].dontTakeDamage; @@ -470,7 +478,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos SmokeDrawer.Update(); - Player player = Main.player[Main.npc[CalamityGlobalNPC.draedonExoMechWorm].target]; + Player player = Main.player[head.target]; Vector2 npcCenter = NPC.Center; float targetCenterX = player.Center.X; @@ -482,33 +490,74 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos targetCenterX -= npcCenter.X; targetCenterY -= npcCenter.Y; - float distanceFromTarget = (float)Math.Sqrt(targetCenterX * targetCenterX + targetCenterY * targetCenterY); + float newPosition = (float)Math.Sqrt(targetCenterX * targetCenterX + targetCenterY * targetCenterY); if (NPC.ai[1] > 0f && NPC.ai[1] < Main.npc.Length) { try { - npcCenter = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); - targetCenterX = Main.npc[(int)NPC.ai[1]].position.X + (Main.npc[(int)NPC.ai[1]].width / 2) - npcCenter.X; - targetCenterY = Main.npc[(int)NPC.ai[1]].position.Y + (Main.npc[(int)NPC.ai[1]].height / 2) - npcCenter.Y; + npcCenter = NPC.Center; + targetCenterX = Main.npc[(int)NPC.ai[1]].Center.X - npcCenter.X; + targetCenterY = Main.npc[(int)NPC.ai[1]].Center.Y - npcCenter.Y; } catch { } NPC.rotation = (float)Math.Atan2(targetCenterY, targetCenterX) + MathHelper.PiOver2; - distanceFromTarget = (float)Math.Sqrt(targetCenterX * targetCenterX + targetCenterY * targetCenterY); - distanceFromTarget = (distanceFromTarget - NPC.width) / distanceFromTarget; - targetCenterX *= distanceFromTarget; - targetCenterY *= distanceFromTarget; + newPosition = (float)Math.Sqrt(targetCenterX * targetCenterX + targetCenterY * targetCenterY); + newPosition = (newPosition - NPC.width) / newPosition; + targetCenterX *= newPosition; + targetCenterY *= newPosition; NPC.velocity = Vector2.Zero; - NPC.position.X = NPC.position.X + targetCenterX; - NPC.position.Y = NPC.position.Y + targetCenterY; + NPC.position.X += targetCenterX; + NPC.position.Y += targetCenterY; if (targetCenterX < 0f) NPC.spriteDirection = -1; else if (targetCenterX > 0f) NPC.spriteDirection = 1; } + + bool speedUp = head.localAI[3] < 180f; + + // Distance from target + float distanceFromTarget = Vector2.Distance(head.Center, speedUp ? (player.Center + new Vector2(0f, 2400f)) : player.Center); + + // Increase speed if too far from target + float increaseSpeedMult = 1f; + float increaseSpeedGateValue = 600f; + if (distanceFromTarget > increaseSpeedGateValue) + { + float distanceAmount = MathHelper.Clamp((distanceFromTarget - increaseSpeedGateValue) / (CalamityGlobalNPC.CatchUpDistance350Tiles - increaseSpeedGateValue), 0f, 1f); + increaseSpeedMult = MathHelper.Lerp(1f, 3.5f, distanceAmount); + } + + // Velocity and turn speed values + float baseVelocityMult = (shouldGetBuffedByBerserkPhase ? 0.15f : 0f) + (bossRush ? 1.25f : death ? 1.2f : revenge ? 1.175f : expertMode ? 1.15f : 1.1f); + float baseVelocity = 10f * baseVelocityMult; + + // Increase top velocity if target is dead or if Thanatos is uncoiling + if (player.dead || speedUp) + baseVelocity *= 4f; + else + baseVelocity *= increaseSpeedMult; + + if (Main.getGoodWorld) + baseVelocity *= 1.15f; + + // Calculate contact damage based on velocity + float minimalContactDamageVelocity = baseVelocity * 0.25f; + float minimalDamageVelocity = baseVelocity * 0.5f; + float bodyAndTailVelocity = (NPC.position - NPC.oldPosition).Length(); + if (bodyAndTailVelocity <= minimalContactDamageVelocity) + { + NPC.damage = 0; + } + else + { + float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); + NPC.damage = (int)MathHelper.Lerp(0f, NPC.defDamage, velocityDamageScalar); + } } public override bool CanHitPlayer(Player target, ref int cooldownSlot) @@ -586,7 +635,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos center += vector * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture, center, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector, NPC.scale, spriteEffects, 0f); - texture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Thanatos/ThanatosBody2Glow").Value; + texture = GlowTexture.Value; spriteBatch.Draw(texture, center, NPC.frame, Color.White * NPC.Opacity, NPC.rotation, vector, NPC.scale, spriteEffects, 0f); SmokeDrawer.DrawSet(NPC.Center); @@ -628,20 +677,20 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos int baseDust = vulnerable ? 3 : 1; for (int k = 0; k < baseDust; k++) - Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TerraBlade, 0f, 0f, 100, new Color(0, 255, 255), 1f); if (NPC.life <= 0) { for (int i = 0; i < 2; i++) { - Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TerraBlade, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); } for (int j = 0; j < 20; j++) { - int plasmaDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); + int plasmaDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TerraBlade, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); Main.dust[plasmaDust].noGravity = true; Main.dust[plasmaDust].velocity *= 3f; - plasmaDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + plasmaDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TerraBlade, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); Main.dust[plasmaDust].velocity *= 2f; Main.dust[plasmaDust].noGravity = true; } @@ -657,7 +706,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { - NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } } diff --git a/NPCs/ExoMechs/Thanatos/ThanatosHead.cs b/NPCs/ExoMechs/Thanatos/ThanatosHead.cs index aeb518a29a..3c7d01279b 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosHead.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosHead.cs @@ -1,4 +1,6 @@ -using CalamityMod.Events; +using System; +using System.IO; +using CalamityMod.Events; using CalamityMod.Items.Potions; using CalamityMod.NPCs.ExoMechs.Ares; using CalamityMod.Particles; @@ -9,9 +11,8 @@ using CalamityMod.UI.VanillaBossBars; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using ReLogic.Utilities; -using System; -using System.IO; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -36,6 +37,15 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos public SlotId LaserSoundSlot; + public static Asset GlowTexture; + public static Asset AuraTexture; + public static Asset ReticleLeftTexture; + public static Asset ReticleRightTexture; + public static Asset ReticleProngLeftTexture; + public static Asset ReticleProngRightTexture; + public static Asset ReticleTopTexture; + public static Asset ReticleBottomTexture; + internal static void LoadHeadIcons() { string normalIconPath = "CalamityMod/NPCs/ExoMechs/Thanatos/ThanatosNormalHead"; @@ -139,6 +149,17 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos value.Position.X += 52f; value.Position.Y += 16f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + ReticleLeftTexture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Thanatos/ThanatosReticleLeft", AssetRequestMode.AsyncLoad); + ReticleRightTexture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Thanatos/ThanatosReticleRight", AssetRequestMode.AsyncLoad); + ReticleTopTexture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Thanatos/ThanatosReticleTop", AssetRequestMode.AsyncLoad); + ReticleBottomTexture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Thanatos/ThanatosReticleHead", AssetRequestMode.AsyncLoad); + ReticleProngRightTexture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Thanatos/ThanatosReticleProngLeft", AssetRequestMode.AsyncLoad); + ReticleProngLeftTexture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Thanatos/ThanatosReticleProngRight", AssetRequestMode.AsyncLoad); + AuraTexture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Thanatos/THanosAura", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -173,7 +194,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Thanatos") }); @@ -229,7 +250,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos public float GetSlowdownAreaEdgeRadius(bool lastMechAlive) => (BossRushEvent.BossRushActive ? 400f : CalamityWorld.death ? 600f : CalamityWorld.revenge ? 700f : Main.expertMode ? 800f : 1000f) * (lastMechAlive ? 0.6f : 1f) * (Main.zenithWorld && !exoMechdusa ? 2 : Main.getGoodWorld ? 0.5f : 1f); - public int CheckForOtherMechs(ref Player target, out bool exoPrimeAlive, out bool exoTwinsAlive) + public int CheckForOtherMechs(ref int targetIndex, out bool exoPrimeAlive, out bool exoTwinsAlive) { exoPrimeAlive = false; exoTwinsAlive = false; @@ -239,7 +260,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos if (Main.npc[CalamityGlobalNPC.draedonExoMechPrime].active) { // Set target to Ares' target if Ares is alive. - target = Main.player[Main.npc[CalamityGlobalNPC.draedonExoMechPrime].target]; + targetIndex = Main.npc[CalamityGlobalNPC.draedonExoMechPrime].target; otherExoMechsAlive++; exoPrimeAlive = true; @@ -282,10 +303,10 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos NPC.TargetClosest(); // Target variable - Player player = Main.player[NPC.target]; + int targetIndex = NPC.target; // Check if the other exo mechs are alive - int otherExoMechsAlive = CheckForOtherMechs(ref player, out bool exoPrimeAlive, out bool exoTwinsAlive); + int otherExoMechsAlive = CheckForOtherMechs(ref targetIndex, out bool exoPrimeAlive, out bool exoTwinsAlive); // These are 5 by default to avoid triggering passive phases after the other mechs are dead float exoPrimeLifeRatio = defaultLifeRatio; @@ -417,36 +438,31 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos // Despawn if target is dead bool targetDead = false; - if (player.dead) + if (Main.player[targetIndex].dead) { - NPC.TargetClosest(false); - player = Main.player[NPC.target]; - if (player.dead) - { - targetDead = true; - AIState = (float)Phase.Charge; - NPC.localAI[0] = 0f; - NPC.localAI[2] = 0f; - calamityGlobalNPC.newAI[2] = 0f; - calamityGlobalNPC.newAI[3] = 0f; - chargeVelocityScalar = 0f; - NPC.dontTakeDamage = true; + targetDead = true; + AIState = (float)Phase.Charge; + NPC.localAI[0] = 0f; + NPC.localAI[2] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + calamityGlobalNPC.newAI[3] = 0f; + chargeVelocityScalar = 0f; + NPC.dontTakeDamage = true; + NPC.velocity.Y -= 1f; + if ((double)NPC.position.Y < Main.topWorld + 16f) NPC.velocity.Y -= 1f; - if ((double)NPC.position.Y < Main.topWorld + 16f) - NPC.velocity.Y -= 1f; - if ((double)NPC.position.Y < Main.topWorld + 16f) + if ((double)NPC.position.Y < Main.topWorld + 16f) + { + for (int a = 0; a < Main.maxNPCs; a++) { - for (int a = 0; a < Main.maxNPCs; a++) - { - if (Main.npc[a].type == NPC.type || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || - Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || - Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || - Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || - Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType()) - Main.npc[a].active = false; - } + if (Main.npc[a].type == NPC.type || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || + Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || + Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || + Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || + Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType()) + Main.npc[a].active = false; } } } @@ -459,7 +475,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos NPC.netUpdate = true; // Default vector to fly to - Vector2 destination = player.Center; + Vector2 destination = Main.player[targetIndex].Center; // Move destination to somewhere far below the target for the first 3 seconds so that Thanatos can fully uncoil quickly bool speedUp = false; @@ -556,9 +572,9 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos if (Main.netMode != NetmodeID.MultiplayerClient) { // Spawn the fuckers - NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); - NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); - NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); + NPC.SpawnOnPlayer(Main.player[targetIndex].whoAmI, ModContent.NPCType()); + NPC.SpawnOnPlayer(Main.player[targetIndex].whoAmI, ModContent.NPCType()); + NPC.SpawnOnPlayer(Main.player[targetIndex].whoAmI, ModContent.NPCType()); } } } @@ -972,7 +988,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos { // Increase velocity if velocity is ever zero if (NPC.velocity == Vector2.Zero) - NPC.velocity = Vector2.Normalize(player.Center - NPC.Center).SafeNormalize(Vector2.Zero) * baseVelocity; + NPC.velocity = Vector2.Normalize(Main.player[targetIndex].Center - NPC.Center).SafeNormalize(Vector2.Zero) * baseVelocity; // Acceleration if (!((destination - NPC.Center).Length() < turnDistance)) @@ -1010,6 +1026,19 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos } } } + + // Calculate contact damage based on velocity + float minimalContactDamageVelocity = baseVelocity * 0.25f; + float minimalDamageVelocity = baseVelocity * 0.5f; + if (NPC.velocity.Length() <= minimalContactDamageVelocity) + { + NPC.damage = (int)Math.Round(NPC.defDamage * 0.5); + } + else + { + float velocityDamageScalar = MathHelper.Clamp((NPC.velocity.Length() - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); + NPC.damage = (int)MathHelper.Lerp((float)Math.Round(NPC.defDamage * 0.5), NPC.defDamage, velocityDamageScalar); + } } public override bool CanHitPlayer(Player target, ref int cooldownSlot) @@ -1090,8 +1119,10 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos center += vector * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture, center, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector, NPC.scale, spriteEffects, 0f); - texture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Thanatos/ThanatosHeadGlow").Value; - spriteBatch.Draw(texture, center, NPC.frame, Color.White * NPC.Opacity, NPC.rotation, vector, NPC.scale, spriteEffects, 0f); + texture = GlowTexture.Value; + Color glowmaskColor = vulnerable ? ((AIState == (int)Phase.Deathray && SecondaryAIState != (int)SecondaryPhase.PassiveAndImmune) ? Color.Lerp(new Color(255, 64, 64), Color.CornflowerBlue, NPC.Calamity().newAI[2] / deathrayTelegraphDuration) : new Color(255, 64, 64)) : Color.White; + + spriteBatch.Draw(texture, center, NPC.frame, glowmaskColor * NPC.Opacity, NPC.rotation, vector, NPC.scale, spriteEffects, 0f); SmokeDrawer.DrawSet(NPC.Center); @@ -1102,12 +1133,12 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos spriteBatch.SetBlendState(BlendState.Additive); // A large, faded circle. Is rescaled to fit the radius of the slowdown area. - Texture2D auraTexture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Thanatos/THanosAura").Value; + Texture2D auraTexture = AuraTexture.Value; float lifeRatio = NPC.life / (float)NPC.lifeMax; // Yes, this is bizarre as fuck. - Player completelyUseless = null; + int completelyUseless = 0; int otherExoMechsAlive = CheckForOtherMechs(ref completelyUseless, out _, out _); // A general factor for the aura. @@ -1137,12 +1168,12 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos Player target = Main.player[NPC.target]; - Texture2D leftReticleTexture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Thanatos/ThanatosReticleLeft").Value; - Texture2D rightReticleTexture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Thanatos/ThanatosReticleRight").Value; - Texture2D topReticleTexture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Thanatos/ThanatosReticleTop").Value; - Texture2D bottomReticleTexture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Thanatos/ThanatosReticleHead").Value; - Texture2D leftReticleProngTexture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Thanatos/ThanatosReticleProngLeft").Value; - Texture2D rightReticleProngTexture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Thanatos/ThanatosReticleProngRight").Value; + Texture2D leftReticleTexture = ReticleLeftTexture.Value; + Texture2D rightReticleTexture = ReticleRightTexture.Value; + Texture2D topReticleTexture = ReticleTopTexture.Value; + Texture2D bottomReticleTexture = ReticleBottomTexture.Value; + Texture2D leftReticleProngTexture = ReticleProngLeftTexture.Value; + Texture2D rightReticleProngTexture = ReticleProngRightTexture.Value; // The reticle fades away and moves farther away from the target the closer they are to the aura. // Once far away, the reticle will flash between red and white as an indicator. @@ -1261,20 +1292,20 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos } for (int k = 0; k < 3; k++) - Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TerraBlade, 0f, 0f, 100, new Color(0, 255, 255), 1f); if (NPC.life <= 0) { for (int i = 0; i < 2; i++) { - Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TerraBlade, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); } for (int j = 0; j < 20; j++) { - int plasmaDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); + int plasmaDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TerraBlade, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); Main.dust[plasmaDust].noGravity = true; Main.dust[plasmaDust].velocity *= 3f; - plasmaDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + plasmaDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TerraBlade, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); Main.dust[plasmaDust].velocity *= 2f; Main.dust[plasmaDust].noGravity = true; } @@ -1292,7 +1323,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { - NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } } diff --git a/NPCs/ExoMechs/Thanatos/ThanatosHeadGlow.png b/NPCs/ExoMechs/Thanatos/ThanatosHeadGlow.png index 477da0aa63..8447e1e687 100644 Binary files a/NPCs/ExoMechs/Thanatos/ThanatosHeadGlow.png and b/NPCs/ExoMechs/Thanatos/ThanatosHeadGlow.png differ diff --git a/NPCs/ExoMechs/Thanatos/ThanatosTail.cs b/NPCs/ExoMechs/Thanatos/ThanatosTail.cs index 73454ad0cf..7b5ea2721a 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosTail.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosTail.cs @@ -1,12 +1,13 @@ -using CalamityMod.Events; +using System; +using System.IO; +using CalamityMod.Events; using CalamityMod.Particles; using CalamityMod.Projectiles.Boss; using CalamityMod.Sounds; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -47,11 +48,18 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos private const float timeToOpenAndFireLasers = 36f; private const float segmentCloseTimerDecrement = 0.2f; + + public static Asset GlowTexture; + public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.ThanatosHead.DisplayName"); public override void SetStaticDefaults() { this.HideFromBestiary(); Main.npcFrameCount[NPC.type] = 5; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -71,7 +79,6 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos AIType = -1; NPC.knockBackResist = 0f; NPC.Opacity = 0f; - NPC.canGhostHeal = false; NPC.behindTiles = true; NPC.noGravity = true; NPC.noTileCollide = true; @@ -167,7 +174,8 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos // Set vulnerable to false by default vulnerable = false; - CalamityGlobalNPC calamityGlobalNPC_Head = Main.npc[(int)NPC.ai[2]].Calamity(); + NPC head = Main.npc[(int)NPC.ai[2]]; + CalamityGlobalNPC calamityGlobalNPC_Head = head.Calamity(); bool invisiblePhase = calamityGlobalNPC_Head.newAI[1] == (float)ThanatosHead.SecondaryPhase.PassiveAndImmune; NPC.dontTakeDamage = Main.npc[(int)NPC.ai[2]].dontTakeDamage; @@ -468,7 +476,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos SmokeDrawer.Update(); - Player player = Main.player[Main.npc[CalamityGlobalNPC.draedonExoMechWorm].target]; + Player player = Main.player[head.target]; Vector2 npcCenter = NPC.Center; float targetCenterX = player.Center.X; @@ -480,33 +488,74 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos targetCenterX -= npcCenter.X; targetCenterY -= npcCenter.Y; - float distanceFromTarget = (float)Math.Sqrt(targetCenterX * targetCenterX + targetCenterY * targetCenterY); + float newPosition = (float)Math.Sqrt(targetCenterX * targetCenterX + targetCenterY * targetCenterY); if (NPC.ai[1] > 0f && NPC.ai[1] < Main.npc.Length) { try { - npcCenter = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); - targetCenterX = Main.npc[(int)NPC.ai[1]].position.X + (Main.npc[(int)NPC.ai[1]].width / 2) - npcCenter.X; - targetCenterY = Main.npc[(int)NPC.ai[1]].position.Y + (Main.npc[(int)NPC.ai[1]].height / 2) - npcCenter.Y; + npcCenter = NPC.Center; + targetCenterX = Main.npc[(int)NPC.ai[1]].Center.X - npcCenter.X; + targetCenterY = Main.npc[(int)NPC.ai[1]].Center.Y - npcCenter.Y; } catch { } NPC.rotation = (float)Math.Atan2(targetCenterY, targetCenterX) + MathHelper.PiOver2; - distanceFromTarget = (float)Math.Sqrt(targetCenterX * targetCenterX + targetCenterY * targetCenterY); - distanceFromTarget = (distanceFromTarget - NPC.width) / distanceFromTarget; - targetCenterX *= distanceFromTarget; - targetCenterY *= distanceFromTarget; + newPosition = (float)Math.Sqrt(targetCenterX * targetCenterX + targetCenterY * targetCenterY); + newPosition = (newPosition - NPC.width) / newPosition; + targetCenterX *= newPosition; + targetCenterY *= newPosition; NPC.velocity = Vector2.Zero; - NPC.position.X = NPC.position.X + targetCenterX; - NPC.position.Y = NPC.position.Y + targetCenterY; + NPC.position.X += targetCenterX; + NPC.position.Y += targetCenterY; if (targetCenterX < 0f) NPC.spriteDirection = -1; else if (targetCenterX > 0f) NPC.spriteDirection = 1; } + + bool speedUp = head.localAI[3] < 180f; + + // Distance from target + float distanceFromTarget = Vector2.Distance(head.Center, speedUp ? (player.Center + new Vector2(0f, 2400f)) : player.Center); + + // Increase speed if too far from target + float increaseSpeedMult = 1f; + float increaseSpeedGateValue = 600f; + if (distanceFromTarget > increaseSpeedGateValue) + { + float distanceAmount = MathHelper.Clamp((distanceFromTarget - increaseSpeedGateValue) / (CalamityGlobalNPC.CatchUpDistance350Tiles - increaseSpeedGateValue), 0f, 1f); + increaseSpeedMult = MathHelper.Lerp(1f, 3.5f, distanceAmount); + } + + // Velocity and turn speed values + float baseVelocityMult = (shouldGetBuffedByBerserkPhase ? 0.15f : 0f) + (bossRush ? 1.25f : death ? 1.2f : revenge ? 1.175f : expertMode ? 1.15f : 1.1f); + float baseVelocity = 10f * baseVelocityMult; + + // Increase top velocity if target is dead or if Thanatos is uncoiling + if (player.dead || speedUp) + baseVelocity *= 4f; + else + baseVelocity *= increaseSpeedMult; + + if (Main.getGoodWorld) + baseVelocity *= 1.15f; + + // Calculate contact damage based on velocity + float minimalContactDamageVelocity = baseVelocity * 0.25f; + float minimalDamageVelocity = baseVelocity * 0.5f; + float bodyAndTailVelocity = (NPC.position - NPC.oldPosition).Length(); + if (bodyAndTailVelocity <= minimalContactDamageVelocity) + { + NPC.damage = 0; + } + else + { + float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); + NPC.damage = (int)MathHelper.Lerp(0f, NPC.defDamage, velocityDamageScalar); + } } public override bool CanHitPlayer(Player target, ref int cooldownSlot) @@ -584,7 +633,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos center += vector * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture, center, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector, NPC.scale, spriteEffects, 0f); - texture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Thanatos/ThanatosTailGlow").Value; + texture = GlowTexture.Value; spriteBatch.Draw(texture, center, NPC.frame, Color.White * NPC.Opacity, NPC.rotation, vector, NPC.scale, spriteEffects, 0f); SmokeDrawer.DrawSet(NPC.Center); @@ -626,20 +675,20 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos int baseDust = vulnerable ? 3 : 1; for (int k = 0; k < baseDust; k++) - Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TerraBlade, 0f, 0f, 100, new Color(0, 255, 255), 1f); if (NPC.life <= 0) { for (int i = 0; i < 2; i++) { - Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TerraBlade, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); } for (int j = 0; j < 20; j++) { - int plasmaDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); + int plasmaDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TerraBlade, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); Main.dust[plasmaDust].noGravity = true; Main.dust[plasmaDust].velocity *= 3f; - plasmaDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + plasmaDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TerraBlade, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); Main.dust[plasmaDust].velocity *= 2f; Main.dust[plasmaDust].noGravity = true; } @@ -656,7 +705,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { - NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } } diff --git a/NPCs/GreatSandShark/GreatSandShark.cs b/NPCs/GreatSandShark/GreatSandShark.cs index 4298f8a3d5..3d1673db94 100644 --- a/NPCs/GreatSandShark/GreatSandShark.cs +++ b/NPCs/GreatSandShark/GreatSandShark.cs @@ -1,4 +1,6 @@ -using CalamityMod.Items.Materials; +using System; +using System.IO; +using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Furniture.BossRelics; using CalamityMod.Items.Placeables.Furniture.Trophies; using CalamityMod.NPCs.Astral; @@ -7,14 +9,12 @@ using CalamityMod.Projectiles.Enemy; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; using Terraria; +using Terraria.Audio; using Terraria.GameContent; using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.NPCs.GreatSandShark { @@ -24,21 +24,21 @@ namespace CalamityMod.NPCs.GreatSandShark private bool resetAI = false; public static readonly SoundStyle RoarSound = new("CalamityMod/Sounds/Custom/GreatSandSharkRoar"); - public static readonly SoundStyle HurtSound = new("CalamityMod/Sounds/NPCHit/GreatSandSharkHit"); - public static readonly SoundStyle DeathSound = new("CalamityMod/Sounds/NPCKilled/GreatSandSharkDeath"); + public static readonly SoundStyle HurtSound = new("CalamityMod/Sounds/NPCHit/GreatSandSharkHit"); + public static readonly SoundStyle DeathSound = new("CalamityMod/Sounds/NPCKilled/GreatSandSharkDeath"); public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 8; NPCID.Sets.BossBestiaryPriority.Add(Type); - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { Scale = 0.6f, PortraitPositionXOverride = 70f }; value.Position.X += 60f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; - NPCID.Sets.MPAllowedEnemies[Type] = true; + NPCID.Sets.MPAllowedEnemies[Type] = true; } public override void SetDefaults() @@ -79,11 +79,11 @@ namespace CalamityMod.NPCs.GreatSandShark public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Desert, BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Events.Sandstorm, - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.GreatSandShark") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.GreatSandShark") }); } @@ -125,7 +125,7 @@ namespace CalamityMod.NPCs.GreatSandShark if (NPC.soundDelay <= 0) { NPC.soundDelay = 480; - SoundEngine.PlaySound(RoarSound, NPC.position); + SoundEngine.PlaySound(RoarSound, NPC.Center); } if (NPC.localAI[3] >= 1f || Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > 1000f) @@ -335,7 +335,7 @@ namespace CalamityMod.NPCs.GreatSandShark { int npcType = Main.zenithWorld ? ModContent.NPCType() : NPCID.SandShark; NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y + 50, npcType, 0, 0f, 0f, 0f, 0f, 255); - SoundEngine.PlaySound(RoarSound, NPC.position); + SoundEngine.PlaySound(RoarSound, NPC.Center); } } @@ -424,11 +424,11 @@ namespace CalamityMod.NPCs.GreatSandShark { if (NPC.localAI[0] == 0f) { - SoundEngine.PlaySound(SoundID.NPCDeath15, NPC.position); + SoundEngine.PlaySound(SoundID.NPCDeath15, NPC.Center); NPC.localAI[0] = -1f; for (int i = 0; i < 25; i++) { - int burrowDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 32, 0f, 0f, 100, default, 2f); + int burrowDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Sand, 0f, 0f, 100, default, 2f); Main.dust[burrowDust].velocity.Y *= 6f; Main.dust[burrowDust].velocity.X *= 3f; if (Main.rand.NextBool()) @@ -439,17 +439,22 @@ namespace CalamityMod.NPCs.GreatSandShark } for (int j = 0; j < 50; j++) { - int burrowDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 85, 0f, 0f, 100, default, 3f); + int burrowDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.UnusedBrown, 0f, 0f, 100, default, 3f); Main.dust[burrowDust2].noGravity = true; Main.dust[burrowDust2].velocity.Y *= 10f; - burrowDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 268, 0f, 0f, 100, default, 2f); + burrowDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Sandstorm, 0f, 0f, 100, default, 2f); Main.dust[burrowDust2].velocity.X *= 2f; } - int spawnX = (int)(NPC.width / 2); - int projType = Main.zenithWorld ? ModContent.ProjectileType() : ModContent.ProjectileType(); - for (int sand = 0; sand < 5; sand++) - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center.X + (float)Main.rand.Next(-spawnX, spawnX), NPC.Center.Y, - (float)Main.rand.Next(-3, 4), (float)Main.rand.Next(-12, -6), projType, 40, 0f, Main.myPlayer); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int spawnX = (int)(NPC.width / 2); + int projType = Main.zenithWorld ? ModContent.ProjectileType() : ModContent.ProjectileType(); + int damage = Main.masterMode ? 25 : Main.expertMode ? 30 : 40; + for (int sand = 0; sand < 5; sand++) + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center.X + (float)Main.rand.Next(-spawnX, spawnX), NPC.Center.Y, + (float)Main.rand.Next(-3, 4), (float)Main.rand.Next(-12, -6), projType, damage, 0f, Main.myPlayer); + } } NPC.ai[2] = -30f; @@ -552,14 +557,17 @@ namespace CalamityMod.NPCs.GreatSandShark if (NPC.Calamity().newAI[0] >= 120) { SoundEngine.PlaySound(SoundID.Item105, Main.player[NPC.target].Center); - for (int i = 0; i < 5; i++) + if (Main.netMode != NetmodeID.MultiplayerClient) { - float speedX = 2f + (float)Main.rand.Next(-8, 5); - float speedY = 2f + (float)Main.rand.Next(1, 6); - int p = Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center.X, Main.player[NPC.target].Center.Y - 800, speedX, speedY, ModContent.ProjectileType(), 40, 0, Main.myPlayer); - if (p.WithinBounds(Main.maxProjectiles)) + for (int i = 0; i < 5; i++) { - Main.projectile[p].timeLeft = 180; + float speedX = 2f + (float)Main.rand.Next(-8, 5); + float speedY = 2f + (float)Main.rand.Next(1, 6); + int p = Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center.X, Main.player[NPC.target].Center.Y - 800, speedX, speedY, ModContent.ProjectileType(), 40, 0, Main.myPlayer); + if (p.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[p].timeLeft = 180; + } } } NPC.Calamity().newAI[0] = 0; @@ -607,10 +615,10 @@ namespace CalamityMod.NPCs.GreatSandShark { goto IL_6899; } - IL_6881: +IL_6881: afterimageCounter += afterimageInc; continue; - IL_6899: +IL_6899: float afterimagesRemaining = (float)(eightConst - afterimageCounter); if (afterimageInc < 0) { @@ -630,7 +638,7 @@ namespace CalamityMod.NPCs.GreatSandShark public override void HitEffect(NPC.HitInfo hit) { - // Hit sound + // Hit sound if (NPC.soundDelay == 0) { NPC.soundDelay = 15; @@ -645,7 +653,7 @@ namespace CalamityMod.NPCs.GreatSandShark { for (int i = 0; i < 50; i++) { - int burrowDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 5, 0f, 0f, 100, default, 2f); + int burrowDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, 0f, 0f, 100, default, 2f); Main.dust[burrowDust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -655,10 +663,10 @@ namespace CalamityMod.NPCs.GreatSandShark } for (int j = 0; j < 100; j++) { - int burrowDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 5, 0f, 0f, 100, default, 3f); + int burrowDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, 0f, 0f, 100, default, 3f); Main.dust[burrowDust2].noGravity = true; Main.dust[burrowDust2].velocity *= 5f; - burrowDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 5, 0f, 0f, 100, default, 2f); + burrowDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, 0f, 0f, 100, default, 2f); Main.dust[burrowDust2].velocity *= 2f; } } diff --git a/NPCs/HiveMind/DankCreeper.cs b/NPCs/HiveMind/DankCreeper.cs index 3ea8d6943c..a9328ad75e 100644 --- a/NPCs/HiveMind/DankCreeper.cs +++ b/NPCs/HiveMind/DankCreeper.cs @@ -1,8 +1,8 @@ -using CalamityMod.Events; +using System; +using CalamityMod.Events; using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.GameContent.Bestiary; using Terraria.ID; @@ -42,17 +42,24 @@ namespace CalamityMod.NPCs.HiveMind NPC.knockBackResist = BossRushEvent.BossRushActive ? 0f : 0.3f; NPC.noGravity = true; NPC.noTileCollide = true; - NPC.canGhostHeal = false; NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath1; NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void AI() { + // Avoid cheap bullshit + NPC.damage = 0; + NPC.TargetClosest(); + bool revenge = CalamityWorld.revenge; float speed = revenge ? 12f : 11f; if (BossRushEvent.BossRushActive) @@ -72,23 +79,24 @@ namespace CalamityMod.NPCs.HiveMind float timeToReachTarget = speed / playerDistance; playerXDist *= timeToReachTarget; playerYDist *= timeToReachTarget; + NPC.ai[0] -= 1f; if (playerDistance < 200f || NPC.ai[0] > 0f) { + // Set damage + NPC.damage = NPC.defDamage; + if (playerDistance < 200f) - { NPC.ai[0] = 20f; - } + if (NPC.velocity.X < 0f) - { NPC.direction = -1; - } else - { NPC.direction = 1; - } + return; } + NPC.velocity.X = (NPC.velocity.X * 50f + playerXDist) / 51f; NPC.velocity.Y = (NPC.velocity.Y * 50f + playerYDist) / 51f; if (playerDistance < 350f) @@ -107,13 +115,13 @@ namespace CalamityMod.NPCs.HiveMind { for (int k = 0; k < 5; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 13, hit.HitDirection, -1f, 0, default, 1f); + 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, 13, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Glass, hit.HitDirection, -1f, 0, default, 1f); } if (Main.netMode != NetmodeID.Server) { diff --git a/NPCs/HiveMind/DarkHeart.cs b/NPCs/HiveMind/DarkHeart.cs index ac0d023d96..0449ae3853 100644 --- a/NPCs/HiveMind/DarkHeart.cs +++ b/NPCs/HiveMind/DarkHeart.cs @@ -1,8 +1,8 @@ -using CalamityMod.Events; +using System; +using CalamityMod.Events; using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.GameContent.Bestiary; using Terraria.ID; @@ -39,7 +39,6 @@ namespace CalamityMod.NPCs.HiveMind AIType = -1; NPC.knockBackResist = BossRushEvent.BossRushActive ? 0f : 0.4f; NPC.noGravity = true; - NPC.canGhostHeal = false; NPC.chaseable = false; NPC.HitSound = SoundID.NPCHit13; NPC.DeathSound = SoundID.NPCDeath21; @@ -145,13 +144,13 @@ namespace CalamityMod.NPCs.HiveMind { for (int k = 0; k < 3; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 14, hit.HitDirection, -1f, 0, default, 1f); + 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, 14, hit.HitDirection, -1f, 0, default, 1f); + 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 f8799cd8c3..cd07a4b5fe 100644 --- a/NPCs/HiveMind/HiveBlob.cs +++ b/NPCs/HiveMind/HiveBlob.cs @@ -1,9 +1,9 @@ -using CalamityMod.Events; +using System; +using CalamityMod.Events; using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.GameContent; using Terraria.GameContent.Bestiary; @@ -36,11 +36,10 @@ namespace CalamityMod.NPCs.HiveMind double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); - NPC.knockBackResist = 0f; + NPC.knockBackResist = 0.9f; AIType = -1; NPC.noGravity = true; NPC.noTileCollide = true; - NPC.canGhostHeal = false; NPC.chaseable = false; NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath1; @@ -211,12 +210,12 @@ namespace CalamityMod.NPCs.HiveMind public override void HitEffect(NPC.HitInfo hit) { for (int k = 0; k < 5; k++) - Dust.NewDust(NPC.position, NPC.width, NPC.height, 14, hit.HitDirection, -1f, 0, default, 1f); + 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 < 10; k++) - Dust.NewDust(NPC.position, NPC.width, NPC.height, 14, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Demonite, hit.HitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/HiveMind/HiveBlob2.cs b/NPCs/HiveMind/HiveBlob2.cs index d03b7d9c41..1d704aa619 100644 --- a/NPCs/HiveMind/HiveBlob2.cs +++ b/NPCs/HiveMind/HiveBlob2.cs @@ -1,9 +1,9 @@ -using CalamityMod.Events; +using System; +using CalamityMod.Events; using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.GameContent; using Terraria.ID; @@ -15,6 +15,7 @@ namespace CalamityMod.NPCs.HiveMind public class HiveBlob2 : ModNPC { public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.HiveBlob.DisplayName"); + public override string Texture => "CalamityMod/NPCs/HiveMind/HiveBlob"; public override void SetStaticDefaults() { @@ -38,11 +39,10 @@ namespace CalamityMod.NPCs.HiveMind double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); - NPC.knockBackResist = 0f; + NPC.knockBackResist = 0.9f; AIType = -1; NPC.noGravity = true; NPC.noTileCollide = true; - NPC.canGhostHeal = false; NPC.chaseable = false; NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath1; @@ -213,12 +213,12 @@ namespace CalamityMod.NPCs.HiveMind public override void HitEffect(NPC.HitInfo hit) { for (int k = 0; k < 5; k++) - Dust.NewDust(NPC.position, NPC.width, NPC.height, 14, hit.HitDirection, -1f, 0, default, 1f); + 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 < 10; k++) - Dust.NewDust(NPC.position, NPC.width, NPC.height, 14, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Demonite, hit.HitDirection, -1f, 0, default, 1f); if (Main.netMode != NetmodeID.MultiplayerClient && Main.zenithWorld) { diff --git a/NPCs/HiveMind/HiveBlob2.png b/NPCs/HiveMind/HiveBlob2.png deleted file mode 100644 index 7f8536971e..0000000000 Binary files a/NPCs/HiveMind/HiveBlob2.png and /dev/null differ diff --git a/NPCs/HiveMind/HiveMind.cs b/NPCs/HiveMind/HiveMind.cs index a92016ec05..d4585da10d 100644 --- a/NPCs/HiveMind/HiveMind.cs +++ b/NPCs/HiveMind/HiveMind.cs @@ -1,4 +1,5 @@ -using CalamityMod.Events; +using System.IO; +using CalamityMod.Events; using CalamityMod.Items.Accessories; using CalamityMod.Items.Armor.Vanity; using CalamityMod.Items.LoreItems; @@ -18,13 +19,13 @@ using CalamityMod.Tiles.Ores; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System.IO; +using ReLogic.Content; using Terraria; +using Terraria.Audio; using Terraria.GameContent.Bestiary; +using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using Terraria.GameContent.ItemDropRules; /* states: * 0 = slow drift * 1 = reelback and teleport after spawn enemy @@ -87,20 +88,26 @@ namespace CalamityMod.NPCs.HiveMind public static readonly SoundStyle RoarSound = new("CalamityMod/Sounds/Custom/HiveMindRoar"); public static readonly SoundStyle FastRoarSound = new("CalamityMod/Sounds/Custom/HiveMindRoarFast"); + public static Asset Phase2Texture; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 16; NPCID.Sets.TrailingMode[NPC.type] = 1; NPCID.Sets.TrailCacheLength[NPC.type] = NPC.oldPos.Length; - NPCID.Sets.BossBestiaryPriority.Add(Type); - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + NPCID.Sets.BossBestiaryPriority.Add(Type); + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { Scale = 0.4f, PortraitPositionYOverride = 3f }; value.Position.Y += 3f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; - NPCID.Sets.MPAllowedEnemies[Type] = true; + NPCID.Sets.MPAllowedEnemies[Type] = true; + if (!Main.dedServ) + { + Phase2Texture = ModContent.Request(Texture + "P2", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -111,7 +118,7 @@ namespace CalamityMod.NPCs.HiveMind NPC.width = 178; NPC.height = 122; NPC.defense = 8; - NPC.LifeMaxNERB(8500, 10200, 350000); + NPC.LifeMaxNERB(7700, 9200, 350000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); NPC.aiStyle = -1; @@ -173,11 +180,11 @@ namespace CalamityMod.NPCs.HiveMind public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.TheCorruption, BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.UndergroundCorruption, - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.HiveMind") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.HiveMind") }); } @@ -287,7 +294,7 @@ namespace CalamityMod.NPCs.HiveMind if (phase2) { SpriteEffects spriteEffects = NPC.direction == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Texture2D texture = ModContent.Request("CalamityMod/NPCs/HiveMind/HiveMindP2").Value; + Texture2D texture = Phase2Texture.Value; Rectangle frame = new Rectangle(NPC.width * frameX, NPC.height * frameY, NPC.width, NPC.height); Vector2 vector = new Vector2(NPC.width / 2, NPC.height / 2); Color afterimageBaseColor = Color.White; @@ -454,7 +461,7 @@ namespace CalamityMod.NPCs.HiveMind NPC.scale = 1f; NPC.alpha = 0; NPC.dontTakeDamage = false; - NPC.damage = NPC.defDamage; + NPC.damage = 0; NPC.netSpam = 0; NPC.netUpdate = true; } @@ -463,6 +470,9 @@ namespace CalamityMod.NPCs.HiveMind } else { + // Avoid cheap bullshit + NPC.damage = 0; + CalamityGlobalNPC.hiveMind = NPC.whoAmI; if (!player.active || player.dead) @@ -564,14 +574,13 @@ namespace CalamityMod.NPCs.HiveMind NPC.scale = 1f; NPC.alpha = 0; NPC.dontTakeDamage = false; - NPC.damage = NPC.defDamage; } else if (burrowTimer < -60) { NPC.scale += 0.0165f; NPC.alpha -= 4; - int burrowedDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.Center.Y), NPC.width, NPC.height / 2, 14, 0f, -3f, 100, default, 2.5f * NPC.scale); + 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; if (Main.rand.NextBool()) { @@ -581,10 +590,10 @@ namespace CalamityMod.NPCs.HiveMind for (int i = 0; i < 2; i++) { - int burrowedDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.Center.Y), NPC.width, NPC.height / 2, 14, 0f, -3f, 100, default, 3.5f * NPC.scale); + int burrowedDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.Center.Y), NPC.width, NPC.height / 2, DustID.Demonite, 0f, -3f, 100, default, 3.5f * NPC.scale); Main.dust[burrowedDust2].noGravity = true; Main.dust[burrowedDust2].velocity *= 3.5f; - burrowedDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.Center.Y), NPC.width, NPC.height / 2, 14, 0f, -3f, 100, default, 2.5f * NPC.scale); + 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; } } @@ -612,7 +621,7 @@ namespace CalamityMod.NPCs.HiveMind NPC.scale -= 0.0165f; NPC.alpha += 4; - int burrowedDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.Center.Y), NPC.width, NPC.height / 2, 14, 0f, -3f, 100, default, 2.5f * NPC.scale); + 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; if (Main.rand.NextBool()) { @@ -622,10 +631,10 @@ namespace CalamityMod.NPCs.HiveMind for (int i = 0; i < 2; i++) { - int burrowedDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.Center.Y), NPC.width, NPC.height / 2, 14, 0f, -3f, 100, default, 3.5f * NPC.scale); + int burrowedDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.Center.Y), NPC.width, NPC.height / 2, DustID.Demonite, 0f, -3f, 100, default, 3.5f * NPC.scale); Main.dust[burrowedDust2].noGravity = true; Main.dust[burrowedDust2].velocity *= 3.5f; - burrowedDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.Center.Y), NPC.width, NPC.height / 2, 14, 0f, -3f, 100, default, 2.5f * NPC.scale); + 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; } } @@ -639,25 +648,19 @@ namespace CalamityMod.NPCs.HiveMind { NPC.TargetClosest(); NPC.dontTakeDamage = true; - NPC.damage = 0; } } return; } - if (NPC.alpha != 0) - { - if (NPC.damage != 0) - NPC.damage = 0; - } - else - NPC.damage = NPC.defDamage; - switch (state) { case 0: // Slowdrift + // Avoid cheap bullshit + NPC.damage = 0; + if (NPC.alpha > 0) NPC.alpha -= 3; @@ -768,6 +771,9 @@ namespace CalamityMod.NPCs.HiveMind case 1: // Reelback and teleport + // Avoid cheap bullshit + NPC.damage = 0; + NPC.alpha += reelbackFade + 2 * (int)enrageScale; NPC.velocity -= deceleration; @@ -808,6 +814,9 @@ namespace CalamityMod.NPCs.HiveMind case 2: // Reelback for lunge + death legacy + // Avoid cheap bullshit + NPC.damage = 0; + NPC.alpha += reelbackFade + 2 * (int)enrageScale; NPC.velocity -= deceleration; @@ -838,6 +847,9 @@ namespace CalamityMod.NPCs.HiveMind case 3: // Lunge + // Avoid cheap bullshit + NPC.damage = 0; + NPC.netUpdate = true; NPC.netSpam = 0; if (NPC.alpha > 0) @@ -857,6 +869,9 @@ namespace CalamityMod.NPCs.HiveMind { if (phase2timer <= 0) { + // Set damage + NPC.damage = NPC.defDamage; + phase2timer = lungeTime - 4 * (int)enrageScale; NPC.velocity = player.Center + (bossRush ? player.velocity * 20f : Vector2.Zero) - NPC.Center; NPC.velocity.Normalize(); @@ -874,8 +889,14 @@ namespace CalamityMod.NPCs.HiveMind } else { + // Set damage + NPC.damage = NPC.defDamage; + if (phase2timer <= 0) { + // Avoid cheap bullshit + NPC.damage = 0; + state = 6; phase2timer = 0; deceleration = NPC.velocity / decelerationTime; @@ -887,6 +908,9 @@ namespace CalamityMod.NPCs.HiveMind case 4: // Enemy spawn arc + // Avoid cheap bullshit + NPC.damage = 0; + if (NPC.alpha > 0) { NPC.alpha -= 5; @@ -902,6 +926,9 @@ namespace CalamityMod.NPCs.HiveMind { if (!dashStarted) { + // Set damage + NPC.damage = NPC.defDamage; + dashStarted = true; SoundEngine.PlaySound(RoarSound, NPC.Center); NPC.velocity.X = MathHelper.Pi * teleportRadius / arcTime; @@ -911,6 +938,9 @@ namespace CalamityMod.NPCs.HiveMind } else { + // Set damage + NPC.damage = NPC.defDamage; + NPC.velocity = NPC.velocity.RotatedBy(MathHelper.Pi / arcTime * -rotationDirection); phase2timer++; @@ -945,6 +975,9 @@ namespace CalamityMod.NPCs.HiveMind case 5: // Rain dash + // Avoid cheap bullshit + NPC.damage = 0; + if (NPC.alpha > 0) { NPC.alpha -= 5; @@ -961,6 +994,9 @@ namespace CalamityMod.NPCs.HiveMind { if (!dashStarted) { + // Set damage + NPC.damage = NPC.defDamage; + dashStarted = true; SoundEngine.PlaySound(RoarSound, NPC.Center); NPC.velocity.X = teleportRadius / arcTime * 3; @@ -970,6 +1006,9 @@ namespace CalamityMod.NPCs.HiveMind } else { + // Set damage + NPC.damage = NPC.defDamage; + phase2timer++; if (phase2timer == (int)arcTime / 20) { @@ -998,6 +1037,9 @@ namespace CalamityMod.NPCs.HiveMind case 6: // Deceleration + // Avoid cheap bullshit + NPC.damage = 0; + NPC.velocity -= deceleration; phase2timer++; if (phase2timer == decelerationTime) @@ -1050,14 +1092,14 @@ namespace CalamityMod.NPCs.HiveMind public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { - NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } public override void HitEffect(NPC.HitInfo hit) { for (int k = 0; k < hit.Damage / NPC.lifeMax * 100.0; k++) - Dust.NewDust(NPC.position, NPC.width, NPC.height, 14, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Demonite, hit.HitDirection, -1f, 0, default, 1f); // When Hive Mind starts flying around bool phase2 = NPC.life / (float)NPC.lifeMax < 0.8f; @@ -1105,7 +1147,7 @@ namespace CalamityMod.NPCs.HiveMind NPC.position.Y = NPC.position.Y - (NPC.height / 2); for (int i = 0; i < 40; i++) { - int killDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 14, 0f, 0f, 100, default, 2f); + int killDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Demonite, 0f, 0f, 100, default, 2f); Main.dust[killDust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -1115,10 +1157,10 @@ namespace CalamityMod.NPCs.HiveMind } for (int j = 0; j < 70; j++) { - int killDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 14, 0f, 0f, 100, default, 3f); + int killDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Demonite, 0f, 0f, 100, default, 3f); Main.dust[killDust2].noGravity = true; Main.dust[killDust2].velocity *= 5f; - killDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 14, 0f, 0f, 100, default, 2f); + killDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Demonite, 0f, 0f, 100, default, 2f); Main.dust[killDust2].velocity *= 2f; } } @@ -1156,14 +1198,14 @@ namespace CalamityMod.NPCs.HiveMind var normalOnly = npcLoot.DefineNormalOnlyDropSet(); { // Weapons and such - normalOnly.Add(DropHelper.CalamityStyle(DropHelper.NormalWeaponDropRateFraction, new WeightedItemStack[] - { - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - new WeightedItemStack(ModContent.ItemType(), 1f, 30, 50), - })); + normalOnly.Add(DropHelper.CalamityStyle(DropHelper.NormalWeaponDropRateFraction, new WeightedItemStack[] + { + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + new WeightedItemStack(ModContent.ItemType(), 1f, 30, 50), + })); // Materials normalOnly.Add(ItemID.DemoniteBar, 1, 10, 15); @@ -1173,7 +1215,7 @@ namespace CalamityMod.NPCs.HiveMind normalOnly.Add(ItemDropRule.ByCondition(DropHelper.Hardmode(), ItemID.CursedFlame, 1, 10, 20)); // Equipment - normalOnly.Add(ModContent.ItemType(), DropHelper.NormalWeaponDropRateFraction); + normalOnly.Add(ModContent.ItemType(), DropHelper.NormalWeaponDropRateFraction); normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); // Vanity diff --git a/NPCs/HiveMind/HiveTumor.cs b/NPCs/HiveMind/HiveTumor.cs index ea180f5e9f..0aec6bbfe8 100644 --- a/NPCs/HiveMind/HiveTumor.cs +++ b/NPCs/HiveMind/HiveTumor.cs @@ -38,11 +38,11 @@ namespace CalamityMod.NPCs.HiveMind public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.TheCorruption, BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.UndergroundCorruption, - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.HiveTumor") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.HiveTumor") }); } @@ -62,7 +62,7 @@ namespace CalamityMod.NPCs.HiveMind { // Passively spawns random enemies NPC.ai[0]++; - + if (NPC.ai[0] >= timeToSpawn) { int spawnRandomizer = Main.rand.Next(0, 5); @@ -123,13 +123,13 @@ namespace CalamityMod.NPCs.HiveMind { for (int k = 0; k < 5; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 14, hit.HitDirection, -1f, 0, default, 1f); + 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, 14, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Demonite, hit.HitDirection, -1f, 0, default, 1f); } if (Main.netMode != NetmodeID.MultiplayerClient && (!NPC.AnyNPCs(ModContent.NPCType()) || (CalamityWorld.LegendaryMode && CalamityWorld.revenge))) { diff --git a/NPCs/Leviathan/Anahita.cs b/NPCs/Leviathan/Anahita.cs index 6007a3c6b1..84462774fc 100644 --- a/NPCs/Leviathan/Anahita.cs +++ b/NPCs/Leviathan/Anahita.cs @@ -1,29 +1,34 @@ -using CalamityMod.Events; +using System; +using System.IO; +using CalamityMod.Events; using CalamityMod.Items.Placeables.Furniture.Trophies; using CalamityMod.Projectiles.Boss; using CalamityMod.UI.VanillaBossBars; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; +using ReLogic.Content; using Terraria; +using Terraria.Audio; using Terraria.GameContent; using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.NPCs.Leviathan { [AutoloadBossHead] public class Anahita : ModNPC { + public static readonly SoundStyle HitSound = new("CalamityMod/Sounds/NPCHit/AnahitaHit", 3); + public static readonly SoundStyle DeathSound = new("CalamityMod/Sounds/NPCKilled/AnahitaDeath"); + private int biomeEnrageTimer = CalamityGlobalNPC.biomeEnrageTimerMax; private bool spawnedLevi = false; private bool forceChargeFrames = false; private int frameUsed = 0; public bool HasBegunSummoningLeviathan = false; + public static Asset ChargeTexture; public bool WaitingForLeviathan { get @@ -41,11 +46,15 @@ namespace CalamityMod.NPCs.Leviathan { Main.npcFrameCount[NPC.type] = 6; NPCID.Sets.BossBestiaryPriority.Add(Type); - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { Scale = 0.5f }; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + ChargeTexture = ModContent.Request("CalamityMod/NPCs/Leviathan/AnahitaStabbing", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -67,8 +76,8 @@ namespace CalamityMod.NPCs.Leviathan NPC.value = Item.buyPrice(0, 60, 0, 0); NPC.noGravity = true; NPC.noTileCollide = true; - NPC.HitSound = SoundID.NPCHit1; - NPC.DeathSound = SoundID.NPCDeath1; + NPC.HitSound = HitSound; + NPC.DeathSound = DeathSound; NPC.Calamity().VulnerableToHeat = false; NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToElectricity = true; @@ -83,10 +92,10 @@ namespace CalamityMod.NPCs.Leviathan public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Ocean, - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Anahita") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Anahita") }); } @@ -183,10 +192,6 @@ namespace CalamityMod.NPCs.Leviathan if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) bubbleVelocity *= 2f; - NPC.damage = NPC.defDamage; - - Vector2 vector = NPC.Center; - // Phases bool phase2 = lifeRatio < 0.7f; bool phase3 = lifeRatio < 0.4f; @@ -197,6 +202,9 @@ namespace CalamityMod.NPCs.Leviathan { if (!HasBegunSummoningLeviathan && !Main.zenithWorld) { + // Avoid cheap bullshit + NPC.damage = 0; + // Use charging frames. NPC.ai[0] = 3f; @@ -212,6 +220,7 @@ namespace CalamityMod.NPCs.Leviathan float moveDirection = 1f; if (Math.Abs(NPC.Center.X - Main.maxTilesX * 16f) > Math.Abs(NPC.Center.X)) moveDirection = -1f; + NPC.velocity.X = moveDirection * 6f; NPC.spriteDirection = (int)-moveDirection; NPC.velocity.Y = MathHelper.Clamp(NPC.velocity.Y + 0.2f, -3f, 16f); @@ -238,6 +247,13 @@ namespace CalamityMod.NPCs.Leviathan NPC.velocity *= 0.9f; } + else + { + NPC.alpha -= 5; + if (NPC.alpha < 0) + NPC.alpha = 0; + } + NPC.dontTakeDamage = true; return; } @@ -248,7 +264,7 @@ namespace CalamityMod.NPCs.Leviathan { if (NPC.ai[3] == 0f && NPC.localAI[1] == 0f && Main.netMode != NetmodeID.MultiplayerClient) { - int iceShieldSpawn = NPC.NewNPC(NPC.GetSource_FromAI(), (int)vector.X, (int)vector.Y, ModContent.NPCType(), NPC.whoAmI); + int iceShieldSpawn = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType(), NPC.whoAmI); NPC.ai[3] = iceShieldSpawn + 1; NPC.localAI[1] = -1f; NPC.localAI[2] += 1f; @@ -295,26 +311,30 @@ namespace CalamityMod.NPCs.Leviathan // Hover near the target, invisible if the Leviathan is present and not sufficiently injured. if ((phase3 || death) && WaitingForLeviathan && !Main.zenithWorld) { - ChargeRotation(player, vector); - ChargeLocation(player, vector, false, true); + // Avoid cheap bullshit + NPC.damage = 0; - NPC.alpha += 3; - if (NPC.alpha >= 255) + ChargeRotation(player); + ChargeLocation(player, false, true); + + if (NPC.alpha < 255) + NPC.alpha += 3; + + if (NPC.alpha > 255) { NPC.alpha = 255; } - else + else if (NPC.alpha < 255) { for (int k = 0; k < 3; k++) { - int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, 172, 0f, 0f, 100, default, 2f); + int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.DungeonWater, 0f, 0f, 100, default, 2f); Main.dust[dust].noGravity = true; Main.dust[dust].noLight = true; } } NPC.dontTakeDamage = true; - NPC.damage = 0; if (NPC.ai[0] != -1f) { @@ -328,29 +348,25 @@ namespace CalamityMod.NPCs.Leviathan return; } - // Alpha - if (NPC.damage != 0) - { - NPC.alpha -= 5; - if (NPC.alpha <= 0) - NPC.alpha = 0; - } + NPC.alpha -= 5; + if (NPC.alpha < 0) + NPC.alpha = 0; // Play sound float extrapitch = Main.zenithWorld ? -0.5f : 0; if (Main.rand.NextBool(300)) - SoundEngine.PlaySound(SoundID.Zombie35 with { Pitch = SoundID.Zombie35.Pitch + extrapitch}, NPC.Center); + SoundEngine.PlaySound(SoundID.Zombie35 with { Pitch = SoundID.Zombie35.Pitch + extrapitch }, NPC.Center); // Time left if (NPC.timeLeft < 1800) NPC.timeLeft = 1800; // Despawn - if (!player.active || player.dead || Vector2.Distance(player.Center, vector) > 5600f) + if (!player.active || player.dead || Vector2.Distance(player.Center, NPC.Center) > 5600f) { NPC.TargetClosest(false); player = Main.player[NPC.target]; - if (!player.active || player.dead || Vector2.Distance(player.Center, vector) > 5600f) + if (!player.active || player.dead || Vector2.Distance(player.Center, NPC.Center) > 5600f) { NPC.rotation = NPC.velocity.X * 0.02f; @@ -389,7 +405,7 @@ namespace CalamityMod.NPCs.Leviathan // Rotation when charging if (NPC.ai[0] > 2f) - ChargeRotation(player, vector); + ChargeRotation(player); // Phase switch if (NPC.ai[0] == -1f) @@ -404,12 +420,12 @@ namespace CalamityMod.NPCs.Leviathan if (NPC.ai[0] != 3f) { forceChargeFrames = false; - float playerLocation = vector.X - player.Center.X; + float playerLocation = NPC.Center.X - player.Center.X; NPC.direction = playerLocation < 0f ? 1 : -1; NPC.spriteDirection = NPC.direction; } else - ChargeRotation(player, vector); + ChargeRotation(player); NPC.TargetClosest(); NPC.ai[1] = 0f; @@ -419,10 +435,13 @@ namespace CalamityMod.NPCs.Leviathan // Get in position for bubble spawn else if (NPC.ai[0] == 0f) { + // Avoid cheap bullshit + NPC.damage = 0; + NPC.rotation = NPC.velocity.X * 0.02f; NPC.spriteDirection = NPC.direction; - Vector2 anahitaPos = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); + Vector2 anahitaPos = NPC.Center; float playerXDist = player.position.X + (player.width / 2) - anahitaPos.X; float playerYDist = player.position.Y + (player.height / 2) - 200f * NPC.scale - anahitaPos.Y; float playerDistance = (float)Math.Sqrt(playerXDist * playerXDist + playerYDist * playerYDist); @@ -481,9 +500,12 @@ namespace CalamityMod.NPCs.Leviathan // Bubble spawn else if (NPC.ai[0] == 1f) { + // Avoid cheap bullshit + NPC.damage = 0; + NPC.rotation = NPC.velocity.X * 0.02f; Vector2 bubbleSpawnPos = new Vector2(NPC.position.X + (NPC.width / 2) + (15 * NPC.direction * NPC.scale), NPC.position.Y + 30 * NPC.scale); - Vector2 restingPos = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); + Vector2 restingPos = NPC.Center; float restingPlayerXDist = player.position.X + (player.width / 2) - restingPos.X; float restingPlayerYDist = player.position.Y + (player.height / 2) - restingPos.Y; float restingPlayerDistance = (float)Math.Sqrt(restingPlayerXDist * restingPlayerXDist + restingPlayerYDist * restingPlayerYDist); @@ -492,7 +514,7 @@ namespace CalamityMod.NPCs.Leviathan int activePlayerAmt = 0; for (int i = 0; i < 255; i++) { - if (Main.player[i].active && !Main.player[i].dead && (vector - Main.player[i].Center).Length() < 1000f) + if (Main.player[i].active && !Main.player[i].dead && (NPC.Center - Main.player[i].Center).Length() < 1000f) activePlayerAmt++; } NPC.ai[1] += activePlayerAmt / 2; @@ -584,6 +606,9 @@ namespace CalamityMod.NPCs.Leviathan // Fly near target and summon projectiles else if (NPC.ai[0] == 2f) { + // Avoid cheap bullshit + NPC.damage = 0; + NPC.rotation = NPC.velocity.X * 0.02f; float basey = Main.zenithWorld ? -100 : -350; @@ -594,7 +619,7 @@ namespace CalamityMod.NPCs.Leviathan if (Main.getGoodWorld) velocity *= 1.15f; - Vector2 chargeSetupLocation = Vector2.Normalize(targetVector - vector - NPC.velocity) * velocity; + Vector2 chargeSetupLocation = Vector2.Normalize(targetVector - NPC.Center - NPC.velocity) * velocity; float acceleration = death ? 0.28f : 0.25f; acceleration += 0.2f * enrageScale; @@ -695,7 +720,7 @@ namespace CalamityMod.NPCs.Leviathan if (Math.Abs(NPC.Center.X - player.Center.X) > 10f) { - float playerLocation = vector.X - player.Center.X; + float playerLocation = NPC.Center.X - player.Center.X; NPC.direction = playerLocation < 0f ? 1 : -1; NPC.spriteDirection = NPC.direction; } @@ -716,7 +741,10 @@ namespace CalamityMod.NPCs.Leviathan // Set up charge else if (NPC.ai[0] == 3f) { - ChargeLocation(player, vector, leviAlive && !phase4, revenge); + // Avoid cheap bullshit + NPC.damage = 0; + + ChargeLocation(player, leviAlive && !phase4, revenge); NPC.ai[1] += 1f; @@ -738,11 +766,11 @@ namespace CalamityMod.NPCs.Leviathan if (Main.getGoodWorld) chargeVelocity *= 1.15f; - NPC.velocity = Vector2.Normalize(player.Center - vector) * chargeVelocity; + NPC.velocity = Vector2.Normalize(player.Center - NPC.Center) * chargeVelocity; NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X); // Direction - int chargeDirection = Math.Sign(player.Center.X - vector.X); + int chargeDirection = Math.Sign(player.Center.X - NPC.Center.X); if (chargeDirection != 0) { NPC.direction = chargeDirection; @@ -759,7 +787,7 @@ namespace CalamityMod.NPCs.Leviathan else if (NPC.ai[0] == 4f) { NPC.Calamity().canBreakPlayerDefense = true; - NPC.damage = (int)(NPC.defDamage * 1.5); + NPC.damage = (int)Math.Round(NPC.defDamage * 1.5); if (CalamityWorld.LegendaryMode && CalamityWorld.revenge && NPC.ai[1] % 5f == 0f) { @@ -781,9 +809,9 @@ namespace CalamityMod.NPCs.Leviathan int dustAmt = 7; for (int j = 0; j < dustAmt; j++) { - Vector2 arg_E1C_0 = (Vector2.Normalize(NPC.velocity) * new Vector2((NPC.width + 50) / 2f, NPC.height) * 0.75f).RotatedBy((j - (dustAmt / 2 - 1)) * MathHelper.Pi / dustAmt) + vector; + Vector2 arg_E1C_0 = (Vector2.Normalize(NPC.velocity) * new Vector2((NPC.width + 50) / 2f, NPC.height) * 0.75f).RotatedBy((j - (dustAmt / 2 - 1)) * MathHelper.Pi / dustAmt) + NPC.Center; Vector2 vector4 = ((float)(Main.rand.NextDouble() * MathHelper.Pi) - MathHelper.PiOver2).ToRotationVector2() * Main.rand.Next(3, 8); - int waterDust = Dust.NewDust(arg_E1C_0 + vector4, 0, 0, 172, vector4.X * 2f, vector4.Y * 2f, 100, default, 1.4f); + int waterDust = Dust.NewDust(arg_E1C_0 + vector4, 0, 0, DustID.DungeonWater, vector4.X * 2f, vector4.Y * 2f, 100, default, 1.4f); Main.dust[waterDust].noGravity = true; Main.dust[waterDust].noLight = true; Main.dust[waterDust].velocity /= 4f; @@ -802,9 +830,9 @@ namespace CalamityMod.NPCs.Leviathan } // Rotation when charging - private void ChargeRotation(Player player, Vector2 vector) + private void ChargeRotation(Player player) { - float playerDirection = (float)Math.Atan2(player.Center.Y - vector.Y, player.Center.X - vector.X); + float playerDirection = (float)Math.Atan2(player.Center.Y - NPC.Center.Y, player.Center.X - NPC.Center.X); if (NPC.spriteDirection == 1) playerDirection += MathHelper.Pi; if (playerDirection < 0f) @@ -821,15 +849,15 @@ namespace CalamityMod.NPCs.Leviathan } // Move to charge location - private void ChargeLocation(Player player, Vector2 vector, bool leviAlive, bool revenge) + private void ChargeLocation(Player player, bool leviAlive, bool revenge) { float distance = (leviAlive ? 600f : 500f) * NPC.scale; // Velocity if (NPC.localAI[0] == 0f) - NPC.localAI[0] = (int)distance * Math.Sign((vector - player.Center).X); + NPC.localAI[0] = (int)distance * Math.Sign((NPC.Center - player.Center).X); - Vector2 chargeSetupLocation = Vector2.Normalize(player.Center + new Vector2(NPC.localAI[0], -distance) - vector - NPC.velocity) * 12f; + Vector2 chargeSetupLocation = Vector2.Normalize(player.Center + new Vector2(NPC.localAI[0], -distance) - NPC.Center - NPC.velocity) * 12f; float acceleration = revenge ? 0.75f : 0.5f; if (Main.getGoodWorld) acceleration *= 1.15f; @@ -837,7 +865,7 @@ namespace CalamityMod.NPCs.Leviathan NPC.SimpleFlyMovement(chargeSetupLocation, acceleration); // Rotation - int chargeDirection = Math.Sign(player.Center.X - vector.X); + int chargeDirection = Math.Sign(player.Center.X - NPC.Center.X); if (chargeDirection != 0) { if (NPC.ai[1] == 0f && chargeDirection != NPC.direction) @@ -855,12 +883,12 @@ namespace CalamityMod.NPCs.Leviathan public override void HitEffect(NPC.HitInfo hit) { for (int k = 0; k < 3; k++) - Dust.NewDust(NPC.position, NPC.width, NPC.height, 187, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Flare_Blue, hit.HitDirection, -1f, 0, default, 1f); if (NPC.life <= 0) { for (int k = 0; k < 50; k++) - Dust.NewDust(NPC.position, NPC.width, NPC.height, 187, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Flare_Blue, hit.HitDirection, -1f, 0, default, 1f); } } @@ -873,7 +901,7 @@ namespace CalamityMod.NPCs.Leviathan texture = TextureAssets.Npc[NPC.type].Value; break; case 1: - texture = ModContent.Request("CalamityMod/NPCs/Leviathan/AnahitaStabbing").Value; + texture = ChargeTexture.Value; break; } @@ -933,7 +961,7 @@ namespace CalamityMod.NPCs.Leviathan public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { - NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } } diff --git a/NPCs/Leviathan/AnahitasIceShield.cs b/NPCs/Leviathan/AnahitasIceShield.cs index d919bf4115..a32c37cb9b 100644 --- a/NPCs/Leviathan/AnahitasIceShield.cs +++ b/NPCs/Leviathan/AnahitasIceShield.cs @@ -1,6 +1,8 @@ -using CalamityMod.Events; +using System.IO; +using CalamityMod.Events; +using CalamityMod.Projectiles.Boss; +using CalamityMod.World; using Microsoft.Xna.Framework; -using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,6 +11,17 @@ namespace CalamityMod.NPCs.Leviathan { public class AnahitasIceShield : ModNPC { + public bool WaitingForLeviathan + { + get + { + if (Main.npc.IndexInRange(CalamityGlobalNPC.leviathan) && Main.npc[CalamityGlobalNPC.leviathan].life / (float)Main.npc[CalamityGlobalNPC.leviathan].lifeMax >= ((CalamityWorld.death || BossRushEvent.BossRushActive) ? 0.7f : 0.4f)) + return true; + + return CalamityUtils.FindFirstProjectile(ModContent.ProjectileType()) != -1; + } + } + public override void SetStaticDefaults() { this.HideFromBestiary(); @@ -18,7 +31,6 @@ namespace CalamityMod.NPCs.Leviathan { NPC.aiStyle = -1; AIType = -1; - NPC.canGhostHeal = false; NPC.noTileCollide = true; NPC.coldDamage = true; NPC.GetNPCDamage(); @@ -26,11 +38,7 @@ namespace CalamityMod.NPCs.Leviathan NPC.height = 100; NPC.defense = 10; NPC.DR_NERD(0.5f); - NPC.lifeMax = 650; - if (BossRushEvent.BossRushActive) - { - NPC.lifeMax = 1000; - } + NPC.lifeMax = BossRushEvent.BossRushActive ? 1000 : 650; double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); NPC.alpha = 255; @@ -62,7 +70,7 @@ namespace CalamityMod.NPCs.Leviathan if (NPC.alpha > 100 && NPC.ai[1] == 0f) NPC.alpha -= 2; - if (Main.npc[anahitaID].damage == 0) + if (WaitingForLeviathan) NPC.ai[1] = 1f; else NPC.ai[1] = 0f; @@ -70,7 +78,7 @@ namespace CalamityMod.NPCs.Leviathan if (NPC.ai[1] == 1f) NPC.alpha = Main.npc[anahitaID].alpha; - NPC.dontTakeDamage = Main.npc[anahitaID].damage == 0; + NPC.dontTakeDamage = WaitingForLeviathan; NPC.rotation = Main.npc[anahitaID].rotation; NPC.spriteDirection = Main.npc[anahitaID].direction; NPC.velocity = Vector2.Zero; @@ -89,7 +97,7 @@ namespace CalamityMod.NPCs.Leviathan NPC.netUpdate = true; } - public override bool CanHitPlayer(Player target, ref int cooldownSlot) => NPC.ai[1] == 0f; + public override bool CanHitPlayer(Player target, ref int cooldownSlot) => NPC.ai[1] == 0f && NPC.alpha <= 100; public override Color? GetAlpha(Color drawColor) => NPC.ai[1] == 1f ? Color.Transparent : new Color(200, 200, 200, drawColor.A) * NPC.Opacity; @@ -107,13 +115,13 @@ namespace CalamityMod.NPCs.Leviathan { for (int k = 0; k < 5; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 67, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.IceRod, hit.HitDirection, -1f, 0, default, 1f); } if (NPC.life <= 0) { for (int k = 0; k < 25; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 67, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.IceRod, hit.HitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/Leviathan/AquaticAberration.cs b/NPCs/Leviathan/AquaticAberration.cs index 4d238e6259..55d330b8b9 100644 --- a/NPCs/Leviathan/AquaticAberration.cs +++ b/NPCs/Leviathan/AquaticAberration.cs @@ -1,8 +1,9 @@ -using CalamityMod.Events; +using System; +using CalamityMod.Events; using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.GameContent.Bestiary; using Terraria.ID; @@ -13,11 +14,22 @@ namespace CalamityMod.NPCs.Leviathan { public class AquaticAberration : ModNPC { + public bool WaitingForLeviathan + { + get + { + if (Main.npc.IndexInRange(CalamityGlobalNPC.leviathan) && Main.npc[CalamityGlobalNPC.leviathan].life / (float)Main.npc[CalamityGlobalNPC.leviathan].lifeMax >= ((CalamityWorld.death || BossRushEvent.BossRushActive) ? 0.7f : 0.4f)) + return true; + + return CalamityUtils.FindFirstProjectile(ModContent.ProjectileType()) != -1; + } + } + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 7; NPCID.Sets.BossBestiaryPriority.Add(Type); - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0); + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(); value.Position.X += 25; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; } @@ -30,17 +42,12 @@ namespace CalamityMod.NPCs.Leviathan NPC.width = 50; NPC.height = 50; NPC.defense = 14; - NPC.lifeMax = 600; - if (BossRushEvent.BossRushActive) - { - NPC.lifeMax = 10000; - } + NPC.lifeMax = BossRushEvent.BossRushActive ? 10000 : 600; double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); - NPC.knockBackResist = 0f; + NPC.knockBackResist = 0.2f; NPC.noGravity = true; NPC.noTileCollide = true; - NPC.canGhostHeal = false; AIType = -1; NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath1; @@ -51,6 +58,10 @@ namespace CalamityMod.NPCs.Leviathan if (Main.getGoodWorld) NPC.scale *= 1.3f; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -58,7 +69,7 @@ namespace CalamityMod.NPCs.Leviathan int associatedNPCType = ModContent.NPCType(); bestiaryEntry.UIInfoProvider = new CommonEnemyUICollectionInfoProvider(ContentSamples.NpcBestiaryCreditIdsByNpcNetIds[associatedNPCType], quickUnlock: true); - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Ocean, new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.AquaticAberration") @@ -84,6 +95,9 @@ namespace CalamityMod.NPCs.Leviathan return; } + // Avoid cheap bullshit + NPC.damage = 0; + bool bossRush = BossRushEvent.BossRushActive; bool death = CalamityWorld.death || bossRush; bool revenge = CalamityWorld.revenge || bossRush; @@ -110,13 +124,10 @@ namespace CalamityMod.NPCs.Leviathan if (CalamityGlobalNPC.siren != -1) sirenAlive = Main.npc[CalamityGlobalNPC.siren].active; - if (CalamityGlobalNPC.siren != -1) + if (sirenAlive) { - if (Main.npc[CalamityGlobalNPC.siren].active) - { - if (Main.npc[CalamityGlobalNPC.siren].damage == 0) - sirenAlive = false; - } + if (WaitingForLeviathan) + sirenAlive = false; } float inertia = bossRush ? 24f : death ? 26f : revenge ? 27f : expertMode ? 28f : 30f; @@ -197,6 +208,9 @@ namespace CalamityMod.NPCs.Leviathan } else { + // Set damage + NPC.damage = NPC.defDamage; + Vector2 npcCenterAgain = NPC.Center; Vector2 targetCenterAgain = Main.player[NPC.target].Center; Vector2 vec2 = targetCenterAgain - npcCenterAgain; diff --git a/NPCs/Leviathan/LevScreenShaderData.cs b/NPCs/Leviathan/LevScreenShaderData.cs index 2cd7258460..3552560be3 100644 --- a/NPCs/Leviathan/LevScreenShaderData.cs +++ b/NPCs/Leviathan/LevScreenShaderData.cs @@ -36,7 +36,7 @@ namespace CalamityMod.NPCs.Leviathan public override void Update(GameTime gameTime) { - if (LevIndex == -1 || BossRushEvent.BossRushActive) + if ((LevIndex == -1 && Main.LocalPlayer.Calamity().monolithLeviathanShader <= 0) || BossRushEvent.BossRushActive) { UpdateLIndex(); if (LevIndex == -1 || BossRushEvent.BossRushActive) @@ -51,6 +51,10 @@ namespace CalamityMod.NPCs.Leviathan { UseTargetPosition(Main.npc[LevIndex].Center); } + if (Main.LocalPlayer.Calamity().monolithLeviathanShader > 0) + { + UseTargetPosition(Main.LocalPlayer.Center); + } base.Apply(); } } diff --git a/NPCs/Leviathan/LevSky.cs b/NPCs/Leviathan/LevSky.cs index 5ee402bbb5..17c53ba72b 100644 --- a/NPCs/Leviathan/LevSky.cs +++ b/NPCs/Leviathan/LevSky.cs @@ -16,10 +16,10 @@ namespace CalamityMod.NPCs.Leviathan public override void Update(GameTime gameTime) { - if (LevIndex == -1 || BossRushEvent.BossRushActive) + if ((LevIndex == -1 && Main.LocalPlayer.Calamity().monolithLeviathanShader <= 0) || BossRushEvent.BossRushActive) { UpdateLIndex(); - if (LevIndex == -1 || BossRushEvent.BossRushActive) + if ((LevIndex == -1 && Main.LocalPlayer.Calamity().monolithLeviathanShader <= 0) || BossRushEvent.BossRushActive) isActive = false; } diff --git a/NPCs/Leviathan/Leviathan.cs b/NPCs/Leviathan/Leviathan.cs index 79137af19c..ade98ce310 100644 --- a/NPCs/Leviathan/Leviathan.cs +++ b/NPCs/Leviathan/Leviathan.cs @@ -1,4 +1,6 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using System.IO; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Events; using CalamityMod.Items.Accessories; @@ -6,6 +8,7 @@ using CalamityMod.Items.Armor.Vanity; using CalamityMod.Items.LoreItems; using CalamityMod.Items.Placeables.Furniture.BossRelics; using CalamityMod.Items.Placeables.Furniture.DevPaintings; +using CalamityMod.Items.Placeables.Furniture.Monoliths; using CalamityMod.Items.Placeables.Furniture.Trophies; using CalamityMod.Items.TreasureBags; using CalamityMod.Items.Weapons.Magic; @@ -14,20 +17,19 @@ using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Items.Weapons.Summon; using CalamityMod.Projectiles.Boss; +using CalamityMod.Sounds; using CalamityMod.UI.VanillaBossBars; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; +using ReLogic.Content; using Terraria; +using Terraria.Audio; using Terraria.GameContent; using Terraria.GameContent.Bestiary; +using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using Terraria.GameContent.ItemDropRules; -using ReLogic.Content; namespace CalamityMod.NPCs.Leviathan { @@ -40,7 +42,7 @@ namespace CalamityMod.NPCs.Leviathan private bool gfbAnaSummoned = false; private int soundDelay = 0; private float extrapitch = 0; - public static Texture2D AttackTexture = null; + public static Asset AttackTexture = null; public static readonly SoundStyle RoarMeteorSound = new("CalamityMod/Sounds/Custom/LeviathanRoarMeteor"); public static readonly SoundStyle RoarChargeSound = new("CalamityMod/Sounds/Custom/LeviathanRoarCharge"); @@ -51,7 +53,7 @@ namespace CalamityMod.NPCs.Leviathan Main.npcFrameCount[NPC.type] = 3; NPCID.Sets.BossBestiaryPriority.Add(Type); if (!Main.dedServ) - AttackTexture = ModContent.Request("CalamityMod/NPCs/Leviathan/LeviathanAttack", AssetRequestMode.ImmediateLoad).Value; + AttackTexture = ModContent.Request("CalamityMod/NPCs/Leviathan/LeviathanAttack", AssetRequestMode.AsyncLoad); } public override void SetDefaults() @@ -87,15 +89,15 @@ namespace CalamityMod.NPCs.Leviathan NPC.scale *= 1.3f; if (Main.zenithWorld) - NPC.scale *= 0.3f; + NPC.scale *= 0.3f; } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Ocean, - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Leviathan") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Leviathan") }); } @@ -137,11 +139,6 @@ namespace CalamityMod.NPCs.Leviathan float spawnAnimationTime = 180f; bool spawnAnimation = calamityGlobalNPC.newAI[3] < spawnAnimationTime; - // Don't do damage during spawn animation - NPC.damage = NPC.defDamage; - if (spawnAnimation) - NPC.damage = 0; - // Percent life remaining float lifeRatio = NPC.life / (float)NPC.lifeMax; @@ -158,7 +155,7 @@ namespace CalamityMod.NPCs.Leviathan { if (Main.npc[CalamityGlobalNPC.siren].active) { - if (Main.npc[CalamityGlobalNPC.siren].damage == 0) + if (!phase3 && Main.npc[CalamityGlobalNPC.siren].damage == 0) sirenAlive = false; } } @@ -199,7 +196,7 @@ namespace CalamityMod.NPCs.Leviathan Player player = Main.player[NPC.target]; - bool notOcean = player.position.Y < 800f || player.position.Y > Main.worldSurface * 16.0 || (player.position.X > 6400f && player.position.X < (Main.maxTilesX * 16 - 6400)); + bool notOcean = player.position.Y < 800f || player.position.Y > Main.worldSurface * 16D || (player.position.X > 6400f && player.position.X < (Main.maxTilesX * 16 - 6400)); // Enrage if (notOcean && !bossRush) @@ -233,6 +230,7 @@ namespace CalamityMod.NPCs.Leviathan NPC.buffImmune[BuffID.Slow] = immuneToSlowingDebuffs; NPC.buffImmune[BuffID.Webbed] = immuneToSlowingDebuffs; + // Despawn if (!player.active || player.dead || Vector2.Distance(player.Center, npcCenter) > 5600f) { NPC.TargetClosest(false); @@ -277,6 +275,9 @@ namespace CalamityMod.NPCs.Leviathan // Slowly drift up when spawning if (spawnAnimation) { + // Avoid cheap bullshit + NPC.damage = 0; + float minSpawnVelocity = 0.4f; float maxSpawnVelocity = 4f; float velocityY = maxSpawnVelocity - MathHelper.Lerp(minSpawnVelocity, maxSpawnVelocity, calamityGlobalNPC.newAI[3] / spawnAnimationTime); @@ -297,6 +298,9 @@ namespace CalamityMod.NPCs.Leviathan if (NPC.ai[0] == 0f) { + // Avoid cheap bullshit + NPC.damage = 0; + float hoverSpeed = (sirenAlive && !phase4) ? 3.5f : 7f; float hoverAcceleration = (sirenAlive && !phase4) ? 0.1f : 0.2f; hoverSpeed += 2f * enrageScale; @@ -428,6 +432,9 @@ namespace CalamityMod.NPCs.Leviathan } else if (NPC.ai[0] == 1f) { + // Avoid cheap bullshit + NPC.damage = 0; + Vector2 aberrationSpawn = new Vector2(npcCenter.X, NPC.position.Y + NPC.height * 0.8f); Vector2 leviCenterAberration = npcCenter; float playerXDist = player.Center.X - leviCenterAberration.X; @@ -528,27 +535,36 @@ namespace CalamityMod.NPCs.Leviathan } float gfbchargeboost = Main.zenithWorld ? 1100 : 0; - float chargeDistance = ((sirenAlive && !phase4) ? 1100f : 900f) * NPC.scale + gfbchargeboost; - chargeDistance -= 50f * enrageScale; + float chargeDistanceY = 20f; + float chargeDistanceX = ((sirenAlive && !phase4) ? 1100f : 900f) * NPC.scale + gfbchargeboost; + chargeDistanceX -= 50f * enrageScale; if (!sirenAlive || phase4) - chargeDistance -= 250f * (1f - lifeRatio); + chargeDistanceX -= 250f * (1f - lifeRatio); if (NPC.ai[1] % 2f == 0f) { + // Avoid cheap bullshit + NPC.damage = 0; + int dustAmt = 7; for (int j = 0; j < dustAmt; j++) { - Vector2 arg_E1C_0 = (Vector2.Normalize(NPC.velocity) * new Vector2((NPC.width + 50) / 2f, NPC.height) * 0.75f).RotatedBy((j - (dustAmt / 2 - 1)) * MathHelper.Pi / dustAmt) + npcCenter; + Vector2 dustPosition = (Vector2.Normalize(NPC.velocity) * new Vector2((NPC.width + 50) / 2f, NPC.height) * 0.75f).RotatedBy((j - (dustAmt / 2 - 1)) * MathHelper.Pi / dustAmt) + npcCenter; Vector2 dustRotation = ((float)(Main.rand.NextDouble() * MathHelper.Pi) - MathHelper.PiOver2).ToRotationVector2() * Main.rand.Next(3, 8); - int waterDust = Dust.NewDust(arg_E1C_0 + dustRotation, 0, 0, 172, dustRotation.X * 2f, dustRotation.Y * 2f, 100, default, 1.4f); + int waterDust = Dust.NewDust(dustPosition + dustRotation, 0, 0, DustID.DungeonWater, dustRotation.X * 2f, dustRotation.Y * 2f, 100, default, 1.4f); Main.dust[waterDust].noGravity = true; Main.dust[waterDust].noLight = true; Main.dust[waterDust].velocity /= 4f; Main.dust[waterDust].velocity -= NPC.velocity; } - if (Math.Abs(NPC.position.Y + (NPC.height / 2) - (player.position.Y + (player.height / 2))) < 20f) + float distanceFromTargetX = Math.Abs(NPC.Center.X - player.Center.X); + float distanceFromTargetY = Math.Abs(NPC.Center.Y - player.Center.Y); + if (distanceFromTargetY < chargeDistanceY && distanceFromTargetX >= chargeDistanceX) { + // Set damage + NPC.damage = NPC.defDamage; + NPC.ai[1] += 1f; NPC.ai[2] = 0f; @@ -578,6 +594,7 @@ namespace CalamityMod.NPCs.Leviathan return; } + // Velocity calculations float chargeSpeed = revenge ? 7.5f : 6.5f; float chargeAcceleration = revenge ? 0.12f : 0.11f; chargeSpeed += 2f * enrageScale; @@ -595,22 +612,26 @@ namespace CalamityMod.NPCs.Leviathan chargeAcceleration *= 1.15f; } - if (npcCenter.Y < player.Center.Y) + if (NPC.Center.Y < player.Center.Y - chargeDistanceY) NPC.velocity.Y += chargeAcceleration; - else + else if (NPC.Center.Y > player.Center.Y + chargeDistanceY) NPC.velocity.Y -= chargeAcceleration; + else + NPC.velocity.Y *= 0.7f; if (NPC.velocity.Y < -chargeSpeed) NPC.velocity.Y = -chargeSpeed; if (NPC.velocity.Y > chargeSpeed) NPC.velocity.Y = chargeSpeed; - if (Math.Abs(npcCenter.X - player.Center.X) > chargeDistance + 200f) + float distanceXMax = 200f; + float distanceXMin = 20f; + if (Math.Abs(npcCenter.X - player.Center.X) > chargeDistanceX + distanceXMax) NPC.velocity.X += chargeAcceleration * NPC.direction; - else if (Math.Abs(npcCenter.X - player.Center.X) < chargeDistance) + else if (Math.Abs(npcCenter.X - player.Center.X) < chargeDistanceX + distanceXMin) NPC.velocity.X -= chargeAcceleration * NPC.direction; else - NPC.velocity.X *= 0.8f; + NPC.velocity.X *= 0.7f; if (NPC.velocity.X < -chargeSpeed) NPC.velocity.X = -chargeSpeed; @@ -620,9 +641,17 @@ namespace CalamityMod.NPCs.Leviathan float playerLocation2 = npcCenter.X - player.Center.X; NPC.direction = playerLocation2 < 0 ? 1 : -1; NPC.spriteDirection = NPC.direction; + + NPC.netUpdate = true; + + if (NPC.netSpam > 10) + NPC.netSpam = 10; } else { + // Set damage + NPC.damage = NPC.defDamage; + if (NPC.velocity.X < 0f) NPC.direction = -1; else @@ -633,12 +662,17 @@ namespace CalamityMod.NPCs.Leviathan int chargeXDirectSign = 1; if (npcCenter.X < player.Center.X) chargeXDirectSign = -1; - if (NPC.direction == chargeXDirectSign && Math.Abs(npcCenter.X - player.Center.X) > chargeDistance) + if (NPC.direction == chargeXDirectSign && Math.Abs(npcCenter.X - player.Center.X) > chargeDistanceX) + NPC.ai[2] = 1f; + if (Math.Abs(NPC.Center.Y - player.Center.Y) > chargeDistanceX * 1.5f) NPC.ai[2] = 1f; if (NPC.ai[2] != 1f) return; + // Avoid cheap bullshit + NPC.damage = 0; + float playerLocation = npcCenter.X - player.Center.X; NPC.direction = playerLocation < 0 ? 1 : -1; NPC.spriteDirection = NPC.direction; @@ -659,6 +693,11 @@ namespace CalamityMod.NPCs.Leviathan NPC.ai[1] += 1f; NPC.TargetClosest(); } + + NPC.netUpdate = true; + + if (NPC.netSpam > 10) + NPC.netSpam = 10; } } } @@ -745,7 +784,7 @@ namespace CalamityMod.NPCs.Leviathan NPC.position.Y = NPC.position.Y - (NPC.height / 2); for (int i = 0; i < 40; i++) { - int bloody = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Blood, 0f, 0f, 100, default, 2f); + int bloody = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, 0f, 0f, 100, default, 2f); Main.dust[bloody].velocity *= 3f; if (Main.rand.NextBool()) { @@ -755,10 +794,10 @@ namespace CalamityMod.NPCs.Leviathan } for (int j = 0; j < 70; j++) { - int bloody2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Blood, 0f, 0f, 100, default, 3f); + int bloody2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, 0f, 0f, 100, default, 3f); Main.dust[bloody2].noGravity = true; Main.dust[bloody2].velocity *= 5f; - bloody2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Blood, 0f, 0f, 100, default, 2f); + bloody2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, 0f, 0f, 100, default, 2f); Main.dust[bloody2].velocity *= 2f; } if (Main.netMode != NetmodeID.Server) @@ -781,6 +820,18 @@ namespace CalamityMod.NPCs.Leviathan { CalamityGlobalNPC.SetNewBossJustDowned(npc); + // Abyss awakens after killing Anahita & Leviathan + string key = "Mods.CalamityMod.Status.Progression.AbyssDropsText"; + Color messageColor = Color.RoyalBlue; + + if (!DownedBossSystem.downedLeviathan) + { + if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active) + SoundEngine.PlaySound(CommonCalamitySounds.WyrmScreamSound, Main.player[Main.myPlayer].Center); + + CalamityUtils.DisplayLocalizedText(key, messageColor); + } + // Mark Anahita & Leviathan as dead DownedBossSystem.downedLeviathan = true; CalamityNetcode.SyncWorld(); @@ -822,6 +873,7 @@ namespace CalamityMod.NPCs.Leviathan // Vanity normalOnly.Add(ModContent.ItemType(), 7); normalOnly.Add(ModContent.ItemType(), 7); + normalOnly.Add(ModContent.ItemType(), 15); normalOnly.Add(ModContent.ItemType(), ThankYouPainting.DropInt); // Equipment @@ -869,7 +921,7 @@ namespace CalamityMod.NPCs.Leviathan public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { - Texture2D texture = AttackTexture; + Texture2D texture = AttackTexture.Value; if (NPC.ai[0] == 1f || NPC.Calamity().newAI[3] < 180f) { texture = TextureAssets.Npc[NPC.type].Value; @@ -891,7 +943,7 @@ namespace CalamityMod.NPCs.Leviathan { int width = 1011; int height = 486; - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { Scale = 0.2f, PortraitScale = 0.3f, @@ -931,7 +983,7 @@ namespace CalamityMod.NPCs.Leviathan public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { - NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } } diff --git a/NPCs/Leviathan/LeviathanStart.cs b/NPCs/Leviathan/LeviathanStart.cs index f41f449409..f53a972388 100644 --- a/NPCs/Leviathan/LeviathanStart.cs +++ b/NPCs/Leviathan/LeviathanStart.cs @@ -1,8 +1,9 @@ -using CalamityMod.CalPlayer; +using System.IO; +using CalamityMod.CalPlayer; using CalamityMod.Items.Accessories; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System.IO; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.GameContent.Bestiary; @@ -13,18 +14,25 @@ namespace CalamityMod.NPCs.Leviathan { public class LeviathanStart : ModNPC { + + public static Asset GlowTexture; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 6; NPCID.Sets.CantTakeLunchMoney[Type] = true; NPCID.Sets.BossBestiaryPriority.Add(Type); - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { PortraitPositionYOverride = -6f, Scale = 0.65f, PortraitScale = 0.75f }; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -56,10 +64,10 @@ namespace CalamityMod.NPCs.Leviathan public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Ocean, - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.LeviathanStart") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.LeviathanStart") }); } @@ -116,7 +124,7 @@ namespace CalamityMod.NPCs.Leviathan if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D drawTex = Main.zenithWorld ? ModContent.Request("CalamityMod/NPCs/Leviathan/Leviathan").Value : TextureAssets.Npc[NPC.type].Value; + Texture2D drawTex = Main.zenithWorld ? TextureAssets.Npc[ModContent.NPCType()].Value : TextureAssets.Npc[NPC.type].Value; Rectangle frame = Main.zenithWorld ? drawTex.Frame(2, 3, 0, 0) : NPC.frame; Vector2 origin = new Vector2(drawTex.Width / 2, drawTex.Height / 2); @@ -136,7 +144,7 @@ namespace CalamityMod.NPCs.Leviathan if (!Main.zenithWorld) { - drawTex = ModContent.Request("CalamityMod/NPCs/Leviathan/LeviathanStartGlow").Value; + drawTex = GlowTexture.Value; spriteBatch.Draw(drawTex, drawPos, frame, Color.White, NPC.rotation, origin, NPC.scale, spriteEffects, 0f); } @@ -176,10 +184,10 @@ namespace CalamityMod.NPCs.Leviathan return SpawnCondition.OceanMonster.Chance * 0.4f; } - + public override void ModifyNPCLoot(NPCLoot npcLoot) { - npcLoot.Add(ModContent.ItemType(), 4); + npcLoot.Add(ModContent.ItemType(), 4); } public override void HitEffect(NPC.HitInfo hit) diff --git a/NPCs/NormalNPCs/AeroSlime.cs b/NPCs/NormalNPCs/AeroSlime.cs index ad824856cd..45ce3a6124 100644 --- a/NPCs/NormalNPCs/AeroSlime.cs +++ b/NPCs/NormalNPCs/AeroSlime.cs @@ -14,7 +14,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 4; - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0); + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(); value.Position.Y -= 6; value.PortraitPositionYOverride = -36f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; @@ -28,7 +28,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.height = 30; NPC.defense = 6; NPC.lifeMax = 50; - NPC.knockBackResist = 0f; + NPC.knockBackResist = 0.8f; AnimationType = NPCID.Slimer; NPC.value = Item.buyPrice(0, 0, 1, 0); NPC.alpha = 50; @@ -41,14 +41,18 @@ namespace CalamityMod.NPCs.NormalNPCs BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Sky, - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.AeroSlime") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.AeroSlime") }); } @@ -58,7 +62,7 @@ namespace CalamityMod.NPCs.NormalNPCs { return 0f; } - + return SpawnCondition.Sky.Chance * 0.2f; } @@ -66,13 +70,13 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 5; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 59, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.BlueTorch, 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, 59, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.BlueTorch, hit.HitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/NormalNPCs/ArmoredDiggerBody.cs b/NPCs/NormalNPCs/ArmoredDiggerBody.cs index 0a3b9e0fb0..8a6ecf8271 100644 --- a/NPCs/NormalNPCs/ArmoredDiggerBody.cs +++ b/NPCs/NormalNPCs/ArmoredDiggerBody.cs @@ -1,8 +1,8 @@ -using CalamityMod.Items.Placeables.Banners; +using System; +using CalamityMod.Items.Placeables.Banners; using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.Localization; @@ -40,6 +40,10 @@ namespace CalamityMod.NPCs.NormalNPCs BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToElectricity = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) @@ -114,7 +118,7 @@ namespace CalamityMod.NPCs.NormalNPCs projTargetDist = speed / projTargetDist; projTargetX *= projTargetDist; projTargetY *= projTargetDist; - int projType = Main.zenithWorld ? ModContent.ProjectileType() : ProjectileID.SaucerScrap; + int projType = Main.zenithWorld ? ModContent.ProjectileType() : ProjectileID.SaucerScrap; projFirePosition.X += projTargetX * 5f; projFirePosition.Y += projTargetY * 5f; Projectile.NewProjectile(NPC.GetSource_FromAI(), projFirePosition.X, projFirePosition.Y, projTargetX, projTargetY, projType, 30, 0f, Main.myPlayer, 0f, 0f); @@ -139,7 +143,8 @@ namespace CalamityMod.NPCs.NormalNPCs segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); targetXDist = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - segmentPosition.X; targetYDist = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - segmentPosition.Y; - } catch + } + catch { } NPC.rotation = (float)Math.Atan2((double)targetYDist, (double)targetXDist) + 1.57f; @@ -152,19 +157,34 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.position.X = NPC.position.X + targetXDist; NPC.position.Y = NPC.position.Y + targetYDist; } + + // Calculate contact damage based on velocity + float maxChaseSpeed = CalamityWorld.death ? 13.5f : 10f; + float minimalContactDamageVelocity = maxChaseSpeed * 0.25f; + float minimalDamageVelocity = maxChaseSpeed * 0.5f; + float bodyAndTailVelocity = (NPC.position - NPC.oldPosition).Length(); + if (bodyAndTailVelocity <= minimalContactDamageVelocity) + { + NPC.damage = 0; + } + else + { + float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); + NPC.damage = (int)MathHelper.Lerp(0f, NPC.defDamage, velocityDamageScalar); + } } public override void HitEffect(NPC.HitInfo hit) { for (int k = 0; k < 3; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 6, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Torch, hit.HitDirection, -1f, 0, default, 1f); } if (NPC.life <= 0) { for (int k = 0; k < 10; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 6, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Torch, hit.HitDirection, -1f, 0, default, 1f); } if (Main.netMode != NetmodeID.Server) { diff --git a/NPCs/NormalNPCs/ArmoredDiggerHead.cs b/NPCs/NormalNPCs/ArmoredDiggerHead.cs index a97631312d..448082010e 100644 --- a/NPCs/NormalNPCs/ArmoredDiggerHead.cs +++ b/NPCs/NormalNPCs/ArmoredDiggerHead.cs @@ -1,15 +1,15 @@ -using CalamityMod.Items.Materials; +using System; +using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Weapons.Summon; using CalamityMod.World; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.GameContent.Bestiary; +using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using Terraria.GameContent.ItemDropRules; namespace CalamityMod.NPCs.NormalNPCs { @@ -19,7 +19,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetStaticDefaults() { - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { CustomTexturePath = "CalamityMod/ExtraTextures/Bestiary/ArmoredDigger_Bestiary", PortraitPositionXOverride = 40, @@ -54,14 +54,18 @@ namespace CalamityMod.NPCs.NormalNPCs BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToElectricity = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Caverns, - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.ArmoredDigger") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.ArmoredDigger") }); } @@ -74,7 +78,7 @@ namespace CalamityMod.NPCs.NormalNPCs { if (Main.rand.NextBool()) { - Dust dust = Dust.NewDustDirect(NPC.position, NPC.width, NPC.height, 204, 0f, 0f, 150, default(Color), 0.3f); + Dust dust = Dust.NewDustDirect(NPC.position, NPC.width, NPC.height, DustID.TreasureSparkle, 0f, 0f, 150, default(Color), 0.3f); dust.fadeIn = 0.75f; dust.velocity *= 0.1f; dust.noLight = true; @@ -187,7 +191,7 @@ namespace CalamityMod.NPCs.NormalNPCs { NPC.localAI[1] = 0f; } - float fallSpeed = death ? 13.5f : 10f; + float maxChaseSpeed = death ? 13.5f : 10f; if (Main.player[NPC.target].dead || (!Main.zenithWorld && (double)Main.player[NPC.target].position.Y < Main.rockLayer * 16.0)) { flying = false; @@ -195,9 +199,9 @@ namespace CalamityMod.NPCs.NormalNPCs if ((double)NPC.position.Y > Main.rockLayer * 16.0) { NPC.velocity.Y = NPC.velocity.Y + 1f; - fallSpeed = death ? 27f : 20f; + maxChaseSpeed *= 2f; } - if ((double)NPC.position.Y > (double)((Main.maxTilesY - 200) * 16)) + if ((double)NPC.position.Y > (double)(Main.UnderworldLayer * 16)) { for (int a = 0; a < Main.maxNPCs; a++) { @@ -225,11 +229,11 @@ namespace CalamityMod.NPCs.NormalNPCs { NPC.TargetClosest(true); NPC.velocity.Y = NPC.velocity.Y + 0.15f; - if (NPC.velocity.Y > fallSpeed) + if (NPC.velocity.Y > maxChaseSpeed) { - NPC.velocity.Y = fallSpeed; + NPC.velocity.Y = maxChaseSpeed; } - if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)fallSpeed * 0.4) + if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)maxChaseSpeed * 0.4) { if (NPC.velocity.X < 0f) { @@ -240,7 +244,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.velocity.X = NPC.velocity.X + acceleration * 1.1f; } } - else if (NPC.velocity.Y == fallSpeed) + else if (NPC.velocity.Y == maxChaseSpeed) { if (NPC.velocity.X < targetXDist) { @@ -282,7 +286,7 @@ namespace CalamityMod.NPCs.NormalNPCs targetDistance = (float)Math.Sqrt((double)(targetXDist * targetXDist + targetYDist * targetYDist)); float absoluteTargetX = Math.Abs(targetXDist); float absoluteTargetY = Math.Abs(targetYDist); - float timeToReachTarget = fallSpeed / targetDistance; + float timeToReachTarget = maxChaseSpeed / targetDistance; targetXDist *= timeToReachTarget; targetYDist *= timeToReachTarget; if (((NPC.velocity.X > 0f && targetXDist > 0f) || (NPC.velocity.X < 0f && targetXDist < 0f)) && ((NPC.velocity.Y > 0f && targetYDist > 0f) || (NPC.velocity.Y < 0f && targetYDist < 0f))) @@ -322,7 +326,7 @@ namespace CalamityMod.NPCs.NormalNPCs { NPC.velocity.Y = NPC.velocity.Y - acceleration; } - if ((double)Math.Abs(targetYDist) < (double)fallSpeed * 0.2 && ((NPC.velocity.X > 0f && targetXDist < 0f) || (NPC.velocity.X < 0f && targetXDist > 0f))) + if ((double)Math.Abs(targetYDist) < (double)maxChaseSpeed * 0.2 && ((NPC.velocity.X > 0f && targetXDist < 0f) || (NPC.velocity.X < 0f && targetXDist > 0f))) { if (NPC.velocity.Y > 0f) { @@ -333,7 +337,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.velocity.Y = NPC.velocity.Y - acceleration * 2f; } } - if ((double)Math.Abs(targetXDist) < (double)fallSpeed * 0.2 && ((NPC.velocity.Y > 0f && targetYDist < 0f) || (NPC.velocity.Y < 0f && targetYDist > 0f))) + if ((double)Math.Abs(targetXDist) < (double)maxChaseSpeed * 0.2 && ((NPC.velocity.Y > 0f && targetYDist < 0f) || (NPC.velocity.Y < 0f && targetYDist > 0f))) { if (NPC.velocity.X > 0f) { @@ -355,7 +359,7 @@ namespace CalamityMod.NPCs.NormalNPCs { NPC.velocity.X = NPC.velocity.X - acceleration * 1.1f; } - if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)fallSpeed * 0.5) + if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)maxChaseSpeed * 0.5) { if (NPC.velocity.Y > 0f) { @@ -377,7 +381,7 @@ namespace CalamityMod.NPCs.NormalNPCs { NPC.velocity.Y = NPC.velocity.Y - acceleration * 1.1f; } - if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)fallSpeed * 0.5) + if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)maxChaseSpeed * 0.5) { if (NPC.velocity.X > 0f) { @@ -390,7 +394,22 @@ namespace CalamityMod.NPCs.NormalNPCs } } } + + // Calculate contact damage based on velocity + float minimalContactDamageVelocity = maxChaseSpeed * 0.25f; + float minimalDamageVelocity = maxChaseSpeed * 0.5f; + if (NPC.velocity.Length() <= minimalContactDamageVelocity) + { + NPC.damage = (int)Math.Round(NPC.defDamage * 0.5); + } + else + { + float velocityDamageScalar = MathHelper.Clamp((NPC.velocity.Length() - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); + NPC.damage = (int)MathHelper.Lerp((float)Math.Round(NPC.defDamage * 0.5), NPC.defDamage, velocityDamageScalar); + } + NPC.rotation = (float)Math.Atan2((double)NPC.velocity.Y, (double)NPC.velocity.X) + 1.57f; + if (flying) { if (NPC.localAI[0] != 1f) @@ -427,13 +446,13 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 3; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 6, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Torch, hit.HitDirection, -1f, 0, default, 1f); } if (NPC.life <= 0) { for (int k = 0; k < 10; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 6, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Torch, hit.HitDirection, -1f, 0, default, 1f); } if (Main.netMode != NetmodeID.Server) { diff --git a/NPCs/NormalNPCs/ArmoredDiggerTail.cs b/NPCs/NormalNPCs/ArmoredDiggerTail.cs index bb5027f029..62104f3a10 100644 --- a/NPCs/NormalNPCs/ArmoredDiggerTail.cs +++ b/NPCs/NormalNPCs/ArmoredDiggerTail.cs @@ -39,6 +39,10 @@ namespace CalamityMod.NPCs.NormalNPCs BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToElectricity = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) @@ -88,7 +92,8 @@ namespace CalamityMod.NPCs.NormalNPCs segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); targetXDist = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - segmentPosition.X; targetYDist = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - segmentPosition.Y; - } catch + } + catch { } NPC.rotation = (float)Math.Atan2((double)targetYDist, (double)targetXDist) + 1.57f; @@ -101,6 +106,21 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.position.X = NPC.position.X + targetXDist; NPC.position.Y = NPC.position.Y + targetYDist; } + + // Calculate contact damage based on velocity + float maxChaseSpeed = CalamityWorld.death ? 13.5f : 10f; + float minimalContactDamageVelocity = maxChaseSpeed * 0.25f; + float minimalDamageVelocity = maxChaseSpeed * 0.5f; + float bodyAndTailVelocity = (NPC.position - NPC.oldPosition).Length(); + if (bodyAndTailVelocity <= minimalContactDamageVelocity) + { + NPC.damage = 0; + } + else + { + float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); + NPC.damage = (int)MathHelper.Lerp(0f, NPC.defDamage, velocityDamageScalar); + } } public override bool CheckActive() @@ -112,13 +132,13 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 3; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 6, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Torch, hit.HitDirection, -1f, 0, default, 1f); } if (NPC.life <= 0) { for (int k = 0; k < 10; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 6, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Torch, hit.HitDirection, -1f, 0, default, 1f); } if (Main.netMode != NetmodeID.Server) { diff --git a/NPCs/NormalNPCs/AuroraSpirit.cs b/NPCs/NormalNPCs/AuroraSpirit.cs index da912b3ae0..8052c470be 100644 --- a/NPCs/NormalNPCs/AuroraSpirit.cs +++ b/NPCs/NormalNPCs/AuroraSpirit.cs @@ -1,5 +1,5 @@ -using CalamityMod.Items.Materials; -using System; +using System; +using CalamityMod.Items.Materials; using Terraria; using Terraria.GameContent; using Terraria.GameContent.Bestiary; @@ -13,7 +13,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 5; - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { SpriteDirection = -1, PortraitPositionYOverride = -20f @@ -40,11 +40,15 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = false; NPC.Calamity().VulnerableToSickness = false; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Snow, new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.AuroraSpirit") @@ -77,11 +81,11 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.frameCounter++; if (NPC.frameCounter > 4) { - NPC.frame.Y += currentFrame; - NPC.frameCounter = 0; + NPC.frame.Y += currentFrame; + NPC.frameCounter = 0; } if (NPC.frame.Y / currentFrame >= Main.npcFrameCount[NPC.type]) - NPC.frame.Y = 0; + NPC.frame.Y = 0; } public override float SpawnChance(NPCSpawnInfo spawnInfo) @@ -105,20 +109,20 @@ namespace CalamityMod.NPCs.NormalNPCs public override void AI() { - Lighting.AddLight((int)((NPC.position.X + (float)(NPC.width / 2)) / 16f), (int)((NPC.position.Y + (float)(NPC.height / 2)) / 16f), 0.02f, 0.7f, 0.7f); + Lighting.AddLight(NPC.Center, 0.02f, 0.7f, 0.7f); } public override void HitEffect(NPC.HitInfo hit) { for (int k = 0; k < 5; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 67, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.IceRod, 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, 67, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.IceRod, hit.HitDirection, -1f, 0, default, 1f); } if (Main.netMode != NetmodeID.Server) { diff --git a/NPCs/NormalNPCs/BloodlettingServant.cs b/NPCs/NormalNPCs/BloodlettingServant.cs new file mode 100644 index 0000000000..3ec7e710f1 --- /dev/null +++ b/NPCs/NormalNPCs/BloodlettingServant.cs @@ -0,0 +1,320 @@ +using System; +using CalamityMod.Events; +using CalamityMod.NPCs.VanillaNPCAIOverrides.RegularEnemies; +using CalamityMod.Projectiles.Boss; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.NormalNPCs +{ + public class BloodlettingServant : ModNPC + { + public override string Texture => $"Terraria/Images/NPC_{NPCID.WanderingEye}"; + + private const float ChargeGateValue = 180f; + private const float ChargeTelegraphGateValue = 90f; + private const float ChargeDuration = 60f; + private const float ChargeDuration_Death = 50f; + + public override void SetStaticDefaults() + { + Main.npcFrameCount[Type] = 4; + NPCID.Sets.TrailingMode[Type] = 1; + NPCID.Sets.NPCBestiaryDrawModifiers bestiaryData = new NPCID.Sets.NPCBestiaryDrawModifiers() { Hide = true }; + NPCID.Sets.NPCBestiaryDrawOffset.Add(Type, bestiaryData); + } + + public override void SetDefaults() + { + NPC.aiStyle = -1; + AIType = -1; + NPC.GetNPCDamage(); + NPC.width = 30; + NPC.height = 32; + if (Main.tenthAnniversaryWorld) + NPC.scale *= 0.5f; + if (Main.getGoodWorld) + NPC.scale *= 1.1f; + + NPC.defense = 5; + + NPC.lifeMax = 96; + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; + NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); + + NPC.knockBackResist = 0f; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToSickness = true; + } + + public override void AI() + { + Lighting.AddLight(NPC.Center, 0.8f, 0f, 0f); + + NPC.TargetClosest(); + Player target = Main.player[NPC.target]; + bool targetDead = target.dead; + + bool phase2 = NPC.life < NPC.lifeMax * 0.5; + float enrageScale = 1f + NPC.ai[2]; + + float enrageScaleMaxSpeedBonus = 2f * enrageScale; + float maxSpeedX = (phase2 ? (CalamityWorld.death ? 10f : 8f) : (CalamityWorld.death ? 8f : 6f)) + enrageScaleMaxSpeedBonus; + float maxSpeedY = (phase2 ? (CalamityWorld.death ? 8f : 6f) : (CalamityWorld.death ? 4f : 3f)) + enrageScaleMaxSpeedBonus; + float xAccel = maxSpeedX * 0.01f; + float xAccelBoost1 = maxSpeedX * 0.01f; + float xAccelBoost2 = maxSpeedX * 0.0075f; + float yAccel = maxSpeedY * 0.01f; + float yAccelBoost1 = maxSpeedY * 0.01f; + float yAccelBoost2 = maxSpeedY * 0.0075f; + + float chargeVelocity = 12f + enrageScaleMaxSpeedBonus * 2f; + bool attemptingToCharge = NPC.ai[0] >= ChargeGateValue; + bool farEnoughForCharge = NPC.Distance(target.Center) >= 320f; + bool closeEnoughForCharge = NPC.Distance(target.Center) < 480f; + bool charging = (attemptingToCharge && farEnoughForCharge && closeEnoughForCharge) || NPC.ai[1] > 0f; + + float projectileShootGateValue = CalamityWorld.death ? 180f : 270f; + if (Main.getGoodWorld) + projectileShootGateValue *= 0.5f; + + Vector2 lookAt = target.Center - NPC.Center; + float rateOfRotation = charging ? 0f : 0.1f; + float chargeDuration = CalamityWorld.death ? ChargeDuration_Death : ChargeDuration; + NPC.Calamity().canBreakPlayerDefense = charging; + if (charging) + { + if (NPC.ai[1] == 0f) + { + SoundEngine.PlaySound(SoundID.NPCDeath9, NPC.Center); + NPC.velocity = lookAt.SafeNormalize(Vector2.UnitY) * chargeVelocity; + NPC.spriteDirection = lookAt.X < 0f ? -1 : 1; + NPC.rotation = NPC.velocity.ToRotation() + (lookAt.X < 0f ? MathHelper.Pi : 0f); + + NPC.ai[1] = 1f; + if (NPC.ai[3] > projectileShootGateValue * 0.5f) + NPC.ai[3] = projectileShootGateValue * 0.5f; + + NPC.netUpdate = true; + NPC.netSpam = 0; + } + + if (NPC.ai[1] < ChargeDuration + 1f) + { + NPC.ai[1] += 1f; + if (NPC.ai[1] > ChargeDuration + 1f - 10f) + NPC.velocity *= 0.8f; + + if (NPC.ai[1] >= ChargeDuration + 1f) + { + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.netUpdate = true; + NPC.netSpam = 0; + } + } + } + else + { + if (lookAt.X > 0f) + { + NPC.spriteDirection = 1; + NPC.rotation = (float)Math.Atan2(lookAt.Y, lookAt.X); + } + if (lookAt.X < 0f) + { + NPC.spriteDirection = -1; + NPC.rotation = (float)Math.Atan2(lookAt.Y, lookAt.X) + MathHelper.Pi; + } + } + + if (phase2) + { + NPC.damage = (int)Math.Round(NPC.defDamage * 1.3); + + if (NPC.ai[0] < ChargeGateValue && !targetDead) + { + NPC.ai[0] += 1f; + if (NPC.ai[0] == ChargeGateValue) + { + NPC.netUpdate = true; + NPC.netSpam = 0; + } + } + } + else + NPC.damage = NPC.defDamage; + + if (targetDead) + { + NPC.velocity.Y -= 0.04f; + + if (NPC.timeLeft > 10) + NPC.timeLeft = 10; + } + else if (!attemptingToCharge) + { + DemonEyeAI.DemonEyeBatMovement(NPC, maxSpeedX, maxSpeedY, xAccel, xAccelBoost1, xAccelBoost2, yAccel, yAccelBoost1, yAccelBoost2); + + NPC.ai[3] += enrageScale; + bool shootProjectile = Collision.CanHitLine(NPC.Center, 1, 1, target.Center, 1, 1) && Vector2.Distance(NPC.Center, target.Center) > 240f; + if (NPC.ai[3] >= projectileShootGateValue && shootProjectile) + { + NPC.ai[3] = 0f; + float projectileSpeed = CalamityWorld.death ? 16f : 12f; + Vector2 projectileVelocity = NPC.SafeDirectionTo(target.Center) * projectileSpeed; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int projType = ProjectileID.BloodShot; + int projDamage = NPC.GetProjectileDamage(projType); + int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + projectileVelocity.SafeNormalize(Vector2.UnitY) * 10f, projectileVelocity, projType, projDamage, 0f, Main.myPlayer); + Main.projectile[proj].timeLeft = 600; + } + + NPC.netUpdate = true; + NPC.netSpam = 0; + } + + float pushVelocity = 0.2f * enrageScale; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active) + { + if (i != NPC.whoAmI && Main.npc[i].type == NPC.type) + { + if (Vector2.Distance(NPC.Center, Main.npc[i].Center) < 48f * NPC.scale) + { + if (NPC.position.X < Main.npc[i].position.X) + NPC.velocity.X -= pushVelocity; + else + NPC.velocity.X += pushVelocity; + + if (NPC.position.Y < Main.npc[i].position.Y) + NPC.velocity.Y -= pushVelocity; + else + NPC.velocity.Y += pushVelocity; + } + } + } + } + } + else if (!charging) + { + Vector2 destination = target.Center + new Vector2(-280f * NPC.spriteDirection, -280f); + Vector2 desiredVelocity = NPC.SafeDirectionTo(destination, -Vector2.UnitY) * chargeVelocity; + NPC.SimpleFlyMovement(desiredVelocity, enrageScale); + } + + if (Main.rand.NextBool(20)) + { + Vector2 dustSpawnTopLeft = new Vector2(NPC.position.X, NPC.position.Y + NPC.height * 0.25f); + Dust blood = Dust.NewDustDirect(dustSpawnTopLeft, NPC.width, NPC.height / 2, DustID.Blood, NPC.velocity.X, 2f, 0, new Color(128, 0, 0, 255 - NPC.alpha), 1f); + blood.velocity.X *= 0.5f; + blood.velocity.Y *= 0.1f; + } + } + + public override void FindFrame(int frameHeight) + { + NPC.frameCounter += 1D; + if (NPC.frameCounter >= 8D) + NPC.frame.Y = frameHeight; + else + NPC.frame.Y = 0; + + if (NPC.frameCounter >= 16D) + { + NPC.frame.Y = 0; + NPC.frameCounter = 0D; + } + if (NPC.life < NPC.lifeMax * 0.5) + NPC.frame.Y += frameHeight * 2; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + { + if (NPC.ai[0] >= ChargeTelegraphGateValue) + { + Texture2D npcTexture = TextureAssets.Npc[NPC.type].Value; + Color originalColor = NPC.GetAlpha(drawColor); + Color newColor = new Color(255, 128, 128, 255 - NPC.alpha); + Vector2 drawPosition = NPC.Center - screenPos + new Vector2(0, NPC.gfxOffY); + Vector2 origin = NPC.frame.Size() / 2; + + SpriteEffects spriteEffects = SpriteEffects.None; + if (NPC.spriteDirection == 1) + spriteEffects = SpriteEffects.FlipHorizontally; + + float telegraphScalar = MathHelper.Clamp((NPC.ai[0] - ChargeTelegraphGateValue) / ChargeTelegraphGateValue, 0f, 1f); + Color telegraphColor = Color.Lerp(originalColor, newColor, telegraphScalar); + + if (CalamityConfig.Instance.Afterimages && NPC.ai[1] > 0f) + { + int afterimageAmount = 10; + int afterImageIncrement = 2; + for (int j = 0; j < afterimageAmount; j += afterImageIncrement) + { + Color afterimageColor = telegraphColor; + afterimageColor = Color.Lerp(afterimageColor, originalColor, 0.5f); + afterimageColor = NPC.GetAlpha(afterimageColor); + afterimageColor *= (afterimageAmount - j) / 15f; + Vector2 afterimagePos = NPC.oldPos[j] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; + afterimagePos -= new Vector2(npcTexture.Width, npcTexture.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + afterimagePos += origin * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(npcTexture, afterimagePos, NPC.frame, afterimageColor, NPC.rotation, origin, NPC.scale, spriteEffects, 0f); + } + } + + spriteBatch.Draw(npcTexture, drawPosition, NPC.frame, telegraphColor, NPC.rotation, origin, NPC.scale, spriteEffects, 0f); + + return false; + } + + return true; + } + + public override Color? GetAlpha(Color drawColor) => new Color(128, 0, 0, 255 - NPC.alpha); + + public override void HitEffect(NPC.HitInfo hit) + { + if (NPC.life > 0) + { + for (int i = 0; i < hit.Damage / (double)NPC.lifeMax * 100; i++) + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f); + + if (NPC.life < NPC.lifeMax * 0.5f && NPC.localAI[0] == 0f) + { + NPC.localAI[0] = 1f; + for (int i = 0; i < 50; i++) + { + int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, 2f * hit.HitDirection, -2f); + Main.dust[dust].scale = Main.rand.NextFloat(1.6f, 2.4f); + Main.dust[dust].velocity *= Main.rand.NextFloat(1.6f, 2.4f); + Main.dust[dust].color = new Color(128, 0, 0, 255 - NPC.alpha); + } + } + } + else + { + for (int i = 0; i < 100; i++) + { + int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, 2f * hit.HitDirection, -2f); + Main.dust[dust].scale = Main.rand.NextFloat(1.6f, 2.4f); + Main.dust[dust].velocity *= Main.rand.NextFloat(1.6f, 2.4f); + Main.dust[dust].color = new Color(128, 0, 0, 255 - NPC.alpha); + } + } + } + } +} diff --git a/NPCs/NormalNPCs/BloomSlime.cs b/NPCs/NormalNPCs/BloomSlime.cs index 34d67f308f..881bde1018 100644 --- a/NPCs/NormalNPCs/BloomSlime.cs +++ b/NPCs/NormalNPCs/BloomSlime.cs @@ -24,7 +24,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.height = 30; NPC.defense = 25; NPC.lifeMax = 1000; - NPC.knockBackResist = 0f; + NPC.knockBackResist = 0.3f; AnimationType = NPCID.CorruptSlime; NPC.value = Item.buyPrice(0, 0, 25, 0); NPC.alpha = 50; @@ -37,17 +37,26 @@ namespace CalamityMod.NPCs.NormalNPCs BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Caverns, - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.BloomSlime") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.BloomSlime") }); } + public override void AI() + { + NPC.damage = (NPC.velocity.Y == 0f || NPC.velocity.Length() < 3f) ? 0 : NPC.defDamage; + } + public override float SpawnChance(NPCSpawnInfo spawnInfo) { if (spawnInfo.PlayerSafe || !DownedBossSystem.downedProvidence || spawnInfo.Player.Calamity().ZoneAbyss || @@ -62,13 +71,13 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 5; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulphurousSeaAcid, 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, (int)CalamityDusts.SulfurousSeaAcid, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulphurousSeaAcid, hit.HitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/NormalNPCs/Bohldohr.cs b/NPCs/NormalNPCs/Bohldohr.cs index 7b6d23e74e..68c3582f54 100644 --- a/NPCs/NormalNPCs/Bohldohr.cs +++ b/NPCs/NormalNPCs/Bohldohr.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.SummonItems; +using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; using CalamityMod.NPCs.Other; using CalamityMod.World; using Terraria; @@ -31,20 +32,24 @@ namespace CalamityMod.NPCs.NormalNPCs BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToWater = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.TheTemple, - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Bohldohr") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Bohldohr") }); } public override void AI() { - CalamityAI.UnicornAI(NPC, Mod, true, CalamityWorld.death ? 8f : CalamityWorld.revenge ? 6f : 4f, 5f, 0.2f); + CalamityRegularEnemyAI.UnicornAI(NPC, Mod, true, CalamityWorld.death ? 8f : CalamityWorld.revenge ? 6f : 4f, 5f, 0.2f); } public override float SpawnChance(NPCSpawnInfo spawnInfo) @@ -60,13 +65,13 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 5; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 155, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Ambient_DarkBrown, 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, 155, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Ambient_DarkBrown, hit.HitDirection, -1f, 0, default, 1f); } if (Main.netMode != NetmodeID.Server) { diff --git a/NPCs/NormalNPCs/Cnidrion.cs b/NPCs/NormalNPCs/Cnidrion.cs index 650c200b5d..89f9538999 100644 --- a/NPCs/NormalNPCs/Cnidrion.cs +++ b/NPCs/NormalNPCs/Cnidrion.cs @@ -1,9 +1,9 @@ -using CalamityMod.Items.Accessories; +using System; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Projectiles.Enemy; using CalamityMod.World; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.GameContent.Bestiary; using Terraria.ID; @@ -16,7 +16,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 10; - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { Scale = 0.8f, }; @@ -47,11 +47,15 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToWater = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Desert, new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Cnidrion") @@ -79,7 +83,7 @@ namespace CalamityMod.NPCs.NormalNPCs if (NPC.AnyNPCs(NPC.type)) return 0f; - return 0.05f; + return 0.1f; } public override void FindFrame(int frameHeight) @@ -92,14 +96,18 @@ namespace CalamityMod.NPCs.NormalNPCs public override void AI() { + // Setting this in SetDefaults will disable expert mode scaling, so put it here instead + NPC.damage = 0; + Player player = Main.player[NPC.target]; bool expertMode = Main.expertMode; + bool masterMode = Main.masterMode; NPC.spriteDirection = (NPC.direction > 0) ? 1 : -1; float movementSpeed = 1f; NPC.TargetClosest(true); bool stopMoving = false; int offsetX = 80; - int projectileDamage = expertMode ? 9 : 12; + int projectileDamage = masterMode ? 8 : expertMode ? 9 : 12; if (NPC.life < NPC.lifeMax * 0.33 && CalamityWorld.death) { movementSpeed = 2f; @@ -311,7 +319,7 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 40; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 5, hit.HitDirection, -1f, 0, default, 2f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 2f); } } } diff --git a/NPCs/NormalNPCs/CrawlerAmber.cs b/NPCs/NormalNPCs/CrawlerAmber.cs index 3f902b7b35..9333fa56dd 100644 --- a/NPCs/NormalNPCs/CrawlerAmber.cs +++ b/NPCs/NormalNPCs/CrawlerAmber.cs @@ -1,6 +1,7 @@ -using CalamityMod.Items.Accessories; +using System.IO; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Placeables.Banners; -using System.IO; +using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; using Terraria; using Terraria.GameContent.Bestiary; using Terraria.ID; @@ -36,11 +37,15 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToWater = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.UndergroundDesert, new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.GemCrawler") @@ -87,7 +92,7 @@ namespace CalamityMod.NPCs.NormalNPCs detected = true; if (!detected) return; - CalamityAI.GemCrawlerAI(NPC, Mod, 5f, 0.05f); + CalamityRegularEnemyAI.GemCrawlerAI(NPC, Mod, 5f, 0.05f); } public override float SpawnChance(NPCSpawnInfo spawnInfo) @@ -103,13 +108,13 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 5; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 32, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Sand, 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, 32, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Sand, hit.HitDirection, -1f, 0, default, 1f); } if (Main.netMode != NetmodeID.Server) { diff --git a/NPCs/NormalNPCs/CrawlerAmethyst.cs b/NPCs/NormalNPCs/CrawlerAmethyst.cs index f943487da9..6109809617 100644 --- a/NPCs/NormalNPCs/CrawlerAmethyst.cs +++ b/NPCs/NormalNPCs/CrawlerAmethyst.cs @@ -1,6 +1,7 @@ -using CalamityMod.Items.Accessories; +using System.IO; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Placeables.Banners; -using System.IO; +using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; using Terraria; using Terraria.GameContent.Bestiary; using Terraria.ID; @@ -36,11 +37,15 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.UndergroundDesert, new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.GemCrawler") @@ -87,7 +92,7 @@ namespace CalamityMod.NPCs.NormalNPCs detected = true; if (!detected) return; - CalamityAI.GemCrawlerAI(NPC, Mod, 4.5f, 0.045f); + CalamityRegularEnemyAI.GemCrawlerAI(NPC, Mod, 4.5f, 0.045f); } public override float SpawnChance(NPCSpawnInfo spawnInfo) @@ -103,13 +108,13 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 5; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 70, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.PurpleCrystalShard, 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, 70, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.PurpleCrystalShard, hit.HitDirection, -1f, 0, default, 1f); } if (Main.netMode != NetmodeID.Server) { diff --git a/NPCs/NormalNPCs/CrawlerCrystal.cs b/NPCs/NormalNPCs/CrawlerCrystal.cs index 64a806ef07..f90f0c6d88 100644 --- a/NPCs/NormalNPCs/CrawlerCrystal.cs +++ b/NPCs/NormalNPCs/CrawlerCrystal.cs @@ -1,7 +1,8 @@ -using CalamityMod.Items.Accessories; +using System.IO; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Weapons.Melee; -using System.IO; +using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; using Terraria; using Terraria.GameContent.Bestiary; using Terraria.ID; @@ -37,11 +38,15 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.UndergroundDesert, new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.GemCrawler") @@ -88,7 +93,7 @@ namespace CalamityMod.NPCs.NormalNPCs detected = true; if (!detected) return; - CalamityAI.GemCrawlerAI(NPC, Mod, 7f, 0.07f); + CalamityRegularEnemyAI.GemCrawlerAI(NPC, Mod, 7f, 0.07f); } public override float SpawnChance(NPCSpawnInfo spawnInfo) @@ -104,13 +109,13 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 5; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 68, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.BlueCrystalShard, 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, 68, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.BlueCrystalShard, hit.HitDirection, -1f, 0, default, 1f); } if (Main.netMode != NetmodeID.Server) { diff --git a/NPCs/NormalNPCs/CrawlerDiamond.cs b/NPCs/NormalNPCs/CrawlerDiamond.cs index 4d11216f42..b5c103278c 100644 --- a/NPCs/NormalNPCs/CrawlerDiamond.cs +++ b/NPCs/NormalNPCs/CrawlerDiamond.cs @@ -1,6 +1,7 @@ -using CalamityMod.Items.Accessories; +using System.IO; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Placeables.Banners; -using System.IO; +using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; using Terraria; using Terraria.GameContent.Bestiary; using Terraria.ID; @@ -36,11 +37,15 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.UndergroundDesert, new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.GemCrawler") @@ -87,7 +92,7 @@ namespace CalamityMod.NPCs.NormalNPCs detected = true; if (!detected) return; - CalamityAI.GemCrawlerAI(NPC, Mod, 6f, 0.06f); + CalamityRegularEnemyAI.GemCrawlerAI(NPC, Mod, 6f, 0.06f); } public override float SpawnChance(NPCSpawnInfo spawnInfo) @@ -103,13 +108,13 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 5; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 91, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.GemDiamond, 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, 91, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.GemDiamond, hit.HitDirection, -1f, 0, default, 1f); } if (Main.netMode != NetmodeID.Server) { diff --git a/NPCs/NormalNPCs/CrawlerEmerald.cs b/NPCs/NormalNPCs/CrawlerEmerald.cs index a008594151..982d5b5027 100644 --- a/NPCs/NormalNPCs/CrawlerEmerald.cs +++ b/NPCs/NormalNPCs/CrawlerEmerald.cs @@ -1,6 +1,7 @@ -using CalamityMod.Items.Accessories; +using System.IO; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Placeables.Banners; -using System.IO; +using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; using Terraria; using Terraria.GameContent.Bestiary; using Terraria.ID; @@ -36,11 +37,15 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.UndergroundDesert, new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.GemCrawler") @@ -87,7 +92,7 @@ namespace CalamityMod.NPCs.NormalNPCs detected = true; if (!detected) return; - CalamityAI.GemCrawlerAI(NPC, Mod, 5.5f, 0.055f); + CalamityRegularEnemyAI.GemCrawlerAI(NPC, Mod, 5.5f, 0.055f); } public override float SpawnChance(NPCSpawnInfo spawnInfo) @@ -103,13 +108,13 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 5; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 89, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.GemEmerald, 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, 89, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.GemEmerald, hit.HitDirection, -1f, 0, default, 1f); } if (Main.netMode != NetmodeID.Server) { diff --git a/NPCs/NormalNPCs/CrawlerRuby.cs b/NPCs/NormalNPCs/CrawlerRuby.cs index 22ce82aa5b..9c03ee3ba8 100644 --- a/NPCs/NormalNPCs/CrawlerRuby.cs +++ b/NPCs/NormalNPCs/CrawlerRuby.cs @@ -1,6 +1,7 @@ -using CalamityMod.Items.Accessories; +using System.IO; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Placeables.Banners; -using System.IO; +using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; using Terraria; using Terraria.GameContent.Bestiary; using Terraria.ID; @@ -36,11 +37,15 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.UndergroundDesert, new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.GemCrawler") @@ -87,7 +92,7 @@ namespace CalamityMod.NPCs.NormalNPCs detected = true; if (!detected) return; - CalamityAI.GemCrawlerAI(NPC, Mod, 6f, 0.06f); + CalamityRegularEnemyAI.GemCrawlerAI(NPC, Mod, 6f, 0.06f); } public override float SpawnChance(NPCSpawnInfo spawnInfo) @@ -103,13 +108,13 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 5; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 12, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.HeartCrystal, 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, 12, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.HeartCrystal, hit.HitDirection, -1f, 0, default, 1f); } if (Main.netMode != NetmodeID.Server) { diff --git a/NPCs/NormalNPCs/CrawlerSapphire.cs b/NPCs/NormalNPCs/CrawlerSapphire.cs index dc38a6b880..2f61eac7b6 100644 --- a/NPCs/NormalNPCs/CrawlerSapphire.cs +++ b/NPCs/NormalNPCs/CrawlerSapphire.cs @@ -1,6 +1,7 @@ -using CalamityMod.Items.Accessories; +using System.IO; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Placeables.Banners; -using System.IO; +using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; using Terraria; using Terraria.GameContent.Bestiary; using Terraria.ID; @@ -36,11 +37,15 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.UndergroundDesert, new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.GemCrawler") @@ -87,7 +92,7 @@ namespace CalamityMod.NPCs.NormalNPCs detected = true; if (!detected) return; - CalamityAI.GemCrawlerAI(NPC, Mod, 5.5f, 0.055f); + CalamityRegularEnemyAI.GemCrawlerAI(NPC, Mod, 5.5f, 0.055f); } public override float SpawnChance(NPCSpawnInfo spawnInfo) @@ -103,13 +108,13 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 5; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 68, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.BlueCrystalShard, 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, 68, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.BlueCrystalShard, hit.HitDirection, -1f, 0, default, 1f); } if (Main.netMode != NetmodeID.Server) { diff --git a/NPCs/NormalNPCs/CrawlerTopaz.cs b/NPCs/NormalNPCs/CrawlerTopaz.cs index f6f7aa4a1d..a5d17eb520 100644 --- a/NPCs/NormalNPCs/CrawlerTopaz.cs +++ b/NPCs/NormalNPCs/CrawlerTopaz.cs @@ -1,6 +1,7 @@ -using CalamityMod.Items.Accessories; +using System.IO; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Placeables.Banners; -using System.IO; +using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; using Terraria; using Terraria.GameContent.Bestiary; using Terraria.ID; @@ -36,11 +37,15 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.UndergroundDesert, new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.GemCrawler") @@ -87,7 +92,7 @@ namespace CalamityMod.NPCs.NormalNPCs detected = true; if (!detected) return; - CalamityAI.GemCrawlerAI(NPC, Mod, 4.5f, 0.045f); + CalamityRegularEnemyAI.GemCrawlerAI(NPC, Mod, 4.5f, 0.045f); } public override float SpawnChance(NPCSpawnInfo spawnInfo) @@ -103,13 +108,13 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 5; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 147, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.t_Honey, 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, 147, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.t_Honey, hit.HitDirection, -1f, 0, default, 1f); } if (Main.netMode != NetmodeID.Server) { diff --git a/NPCs/NormalNPCs/CrimulanBlightSlime.cs b/NPCs/NormalNPCs/CrimulanBlightSlime.cs index 9d1fb5c8bd..17442a18d1 100644 --- a/NPCs/NormalNPCs/CrimulanBlightSlime.cs +++ b/NPCs/NormalNPCs/CrimulanBlightSlime.cs @@ -36,17 +36,26 @@ namespace CalamityMod.NPCs.NormalNPCs BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.TheCrimson, - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.BlightSlime") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.BlightSlime") }); } + public override void AI() + { + NPC.damage = (NPC.velocity.Y == 0f || NPC.velocity.Length() < 3f) ? 0 : NPC.defDamage; + } + public override float SpawnChance(NPCSpawnInfo spawnInfo) { if (spawnInfo.PlayerSafe || spawnInfo.Player.Calamity().ZoneAbyss) diff --git a/NPCs/NormalNPCs/CryoSlime.cs b/NPCs/NormalNPCs/CryoSlime.cs index 3354afd5b7..7c5c2a66ed 100644 --- a/NPCs/NormalNPCs/CryoSlime.cs +++ b/NPCs/NormalNPCs/CryoSlime.cs @@ -23,7 +23,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.height = 30; NPC.defense = 8; NPC.lifeMax = 120; - NPC.knockBackResist = 0f; + NPC.knockBackResist = 0.6f; AnimationType = NPCID.CorruptSlime; NPC.value = Item.buyPrice(0, 0, 5, 0); NPC.alpha = 50; @@ -38,14 +38,18 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = false; NPC.Calamity().VulnerableToSickness = false; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.UndergroundSnow, - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.CryoSlime") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.CryoSlime") }); } diff --git a/NPCs/NormalNPCs/Cryon.cs b/NPCs/NormalNPCs/Cryon.cs index 68727d6303..28a4efa960 100644 --- a/NPCs/NormalNPCs/Cryon.cs +++ b/NPCs/NormalNPCs/Cryon.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; +using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; using CalamityMod.World; using Terraria; using Terraria.GameContent.Bestiary; @@ -25,7 +26,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.defense = 10; NPC.DR_NERD(0.1f); NPC.lifeMax = 300; - NPC.knockBackResist = 0f; + NPC.knockBackResist = 0.4f; NPC.value = Item.buyPrice(0, 0, 5, 0); NPC.HitSound = SoundID.NPCHit5; NPC.DeathSound = SoundID.NPCDeath7; @@ -35,21 +36,25 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = false; NPC.Calamity().VulnerableToSickness = false; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Snow, BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.UndergroundSnow, - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Cryon") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Cryon") }); } public override void AI() { - CalamityAI.UnicornAI(NPC, Mod, false, CalamityWorld.death ? 8f : CalamityWorld.revenge ? 6f : 4f, 5f, CalamityWorld.death ? 0.2f : CalamityWorld.revenge ? 0.15f : 0.1f); + CalamityRegularEnemyAI.UnicornAI(NPC, Mod, false, CalamityWorld.death ? 8f : CalamityWorld.revenge ? 6f : 4f, 5f, CalamityWorld.death ? 0.2f : CalamityWorld.revenge ? 0.15f : 0.1f); } public override void FindFrame(int frameHeight) @@ -105,13 +110,13 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 3; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 92, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Frost, hit.HitDirection, -1f, 0, default, 1f); } if (NPC.life <= 0) { for (int k = 0; k < 15; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 92, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Frost, hit.HitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/NormalNPCs/EbonianBlightSlime.cs b/NPCs/NormalNPCs/EbonianBlightSlime.cs index 0d9718bde1..1cda527552 100644 --- a/NPCs/NormalNPCs/EbonianBlightSlime.cs +++ b/NPCs/NormalNPCs/EbonianBlightSlime.cs @@ -36,28 +36,37 @@ namespace CalamityMod.NPCs.NormalNPCs BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.TheCorruption, new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.BlightSlime") }); } + public override void AI() + { + NPC.damage = (NPC.velocity.Y == 0f || NPC.velocity.Length() < 3f) ? 0 : NPC.defDamage; + } + public override void HitEffect(NPC.HitInfo hit) { for (int k = 0; k < 3; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 14, hit.HitDirection, -1f, 0, default, 1f); + 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 < 40; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 14, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Demonite, hit.HitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/NormalNPCs/Eidolist.cs b/NPCs/NormalNPCs/Eidolist.cs index 46fdd03225..8141be8c8b 100644 --- a/NPCs/NormalNPCs/Eidolist.cs +++ b/NPCs/NormalNPCs/Eidolist.cs @@ -1,17 +1,17 @@ -using CalamityMod.BiomeManagers; +using System; +using System.IO; +using CalamityMod.BiomeManagers; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.SummonItems; +using CalamityMod.NPCs.PrimordialWyrm; using Microsoft.Xna.Framework; -using System; -using System.IO; using Terraria; +using Terraria.Audio; using Terraria.GameContent.Bestiary; using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using CalamityMod.NPCs.PrimordialWyrm; namespace CalamityMod.NPCs.NormalNPCs { @@ -24,7 +24,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 6; - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { Scale = 0.75f, PortraitPositionYOverride = 16f @@ -41,7 +41,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.width = 60; NPC.height = 80; NPC.lifeMax = 5000; - NPC.knockBackResist = 0f; + NPC.knockBackResist = 0.5f; NPC.value = Item.buyPrice(0, 1, 0, 0); NPC.Opacity = 0f; NPC.noGravity = true; @@ -56,13 +56,17 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[2] { ModContent.GetInstance().Type, ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Eidolist") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Eidolist") }); } @@ -188,7 +192,7 @@ namespace CalamityMod.NPCs.NormalNPCs targetDist = speed / targetDist; targetVec.X *= targetDist; targetVec.Y *= targetDist; - int damage = adultWyrmAlive ? (Main.expertMode ? 150 : 200) : (Main.expertMode ? 30 : 40); + int damage = adultWyrmAlive ? (Main.masterMode ? 127 : Main.expertMode ? 150 : 200) : (Main.masterMode ? 25 : Main.expertMode ? 30 : 40); if (Main.rand.NextBool()) { Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, targetVec, ProjectileID.CultistBossLightningOrb, damage, 0f, Main.myPlayer, 0f, 0f); @@ -228,7 +232,7 @@ namespace CalamityMod.NPCs.NormalNPCs SoundEngine.PlaySound(SoundID.Item8, NPC.Center); for (int i = 0; i < 20; i++) { - int eidolistDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, 20, 0f, 0f, 100, Color.Transparent, 1f); + int eidolistDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.PurificationPowder, 0f, 0f, 100, Color.Transparent, 1f); Dust dust = Main.dust[eidolistDust]; dust.velocity *= 3f; dust.noGravity = true; @@ -241,7 +245,7 @@ namespace CalamityMod.NPCs.NormalNPCs SoundEngine.PlaySound(SoundID.Item8, NPC.Center); for (int j = 0; j < 20; j++) { - int eidolistDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, 20, 0f, 0f, 100, Color.Transparent, 1f); + int eidolistDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.PurificationPowder, 0f, 0f, 100, Color.Transparent, 1f); Dust dust = Main.dust[eidolistDust2]; dust.velocity *= 3f; dust.noGravity = true; @@ -336,13 +340,13 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 5; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 4, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, 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, 4, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, hit.HitDirection, -1f, 0, default, 1f); } if (Main.netMode != NetmodeID.Server) { @@ -363,9 +367,9 @@ namespace CalamityMod.NPCs.NormalNPCs notDuringCultistFight.Add(ModContent.ItemType(), 4); aewMinionCondition.Add(notDuringCultistFight); - LeadingConditionRule postClone = new LeadingConditionRule(DropHelper.PostCal()); - postClone.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 1, 8, 10, 10, 14)); - aewMinionCondition.Add(postClone); + LeadingConditionRule postLevi = new LeadingConditionRule(DropHelper.PostLevi()); + postLevi.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 1, 8, 10, 10, 14)); + aewMinionCondition.Add(postLevi); LeadingConditionRule postPlant = new LeadingConditionRule(DropHelper.PostPlant()); postPlant.Add(ItemID.Ectoplasm, 1, 3, 5); diff --git a/NPCs/NormalNPCs/FearlessGoldfishWarrior.cs b/NPCs/NormalNPCs/FearlessGoldfishWarrior.cs index 323ad15220..6b730dc634 100644 --- a/NPCs/NormalNPCs/FearlessGoldfishWarrior.cs +++ b/NPCs/NormalNPCs/FearlessGoldfishWarrior.cs @@ -1,14 +1,14 @@ -using CalamityMod.World; -using Microsoft.Xna.Framework; -using System; +using System; using System.Collections.Generic; +using CalamityMod.Items.Placeables.Banners; +using CalamityMod.World; +using Microsoft.Xna.Framework; using Terraria; -using Terraria.GameContent.Bestiary; using Terraria.DataStructures; +using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.Utilities; -using CalamityMod.Items.Placeables.Banners; namespace CalamityMod.NPCs.NormalNPCs { @@ -38,15 +38,19 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Surface, BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Events.Rain, - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.FearlessGoldfishWarrior") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.FearlessGoldfishWarrior") }); } diff --git a/NPCs/NormalNPCs/Foveanator.png b/NPCs/NormalNPCs/Foveanator.png new file mode 100644 index 0000000000..67291fe4aa Binary files /dev/null and b/NPCs/NormalNPCs/Foveanator.png differ diff --git a/NPCs/NormalNPCs/Frogfish.cs b/NPCs/NormalNPCs/Frogfish.cs index 9519f06eeb..2cabc312e1 100644 --- a/NPCs/NormalNPCs/Frogfish.cs +++ b/NPCs/NormalNPCs/Frogfish.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Potions; +using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; using Terraria; using Terraria.GameContent.Bestiary; using Terraria.ID; @@ -36,14 +37,18 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Ocean, - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Frogfish") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Frogfish") }); } @@ -88,7 +93,7 @@ namespace CalamityMod.NPCs.NormalNPCs if (NPC.ai[2] == 1f) { NPC.chaseable = true; - CalamityAI.PassiveSwimmingAI(NPC, Mod, 0, 0f, 0.15f, 0.15f, 3.5f, 1.5f, 0.1f); + CalamityRegularEnemyAI.PassiveSwimmingAI(NPC, Mod, 0, 0f, 0.15f, 0.15f, 3.5f, 1.5f, 0.1f); } } diff --git a/NPCs/NormalNPCs/Horse.cs b/NPCs/NormalNPCs/Horse.cs index 927c78fb78..45b580ff0a 100644 --- a/NPCs/NormalNPCs/Horse.cs +++ b/NPCs/NormalNPCs/Horse.cs @@ -21,7 +21,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 6; - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { Scale = 0.4f, PortraitScale = 0.6f, @@ -44,7 +44,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.lifeMax = 3800; NPC.aiStyle = -1; AIType = -1; - NPC.knockBackResist = 0f; + NPC.knockBackResist = 0.05f; NPC.value = Item.buyPrice(0, 1, 50, 0); NPC.dontTakeDamage = true; NPC.noGravity = true; @@ -55,14 +55,18 @@ namespace CalamityMod.NPCs.NormalNPCs BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToWater = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Caverns, - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Horse") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Horse") }); } @@ -116,7 +120,7 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 5; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 31, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Smoke, hit.HitDirection, -1f, 0, default, 1f); } if (NPC.life <= 0) { @@ -129,7 +133,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.position.Y = NPC.position.Y - (NPC.height / 2); for (int i = 0; i < 40; i++) { - int earthDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 31, 0f, 0f, 100, default, 2f); + int earthDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Smoke, 0f, 0f, 100, default, 2f); Main.dust[earthDust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -139,10 +143,10 @@ namespace CalamityMod.NPCs.NormalNPCs } for (int j = 0; j < 70; j++) { - int earthDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Torch, 0f, 0f, 100, default, 3f); + int earthDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Torch, 0f, 0f, 100, default, 3f); Main.dust[earthDust2].noGravity = true; Main.dust[earthDust2].velocity *= 5f; - earthDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Torch, 0f, 0f, 100, default, 2f); + earthDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Torch, 0f, 0f, 100, default, 2f); Main.dust[earthDust2].velocity *= 2f; } @@ -228,18 +232,19 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.timeLeft = 60; } - if (Main.netMode != NetmodeID.MultiplayerClient) + NPC.localAI[0] += 1f; + if (NPC.localAI[0] >= 300f) { - NPC.localAI[0] += 1f; - if (NPC.localAI[0] >= 300f) + NPC.localAI[0] = 0f; + SoundEngine.PlaySound(SoundID.NPCHit43, NPC.Center); + NPC.TargetClosest(); + 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[0] = 0f; - SoundEngine.PlaySound(SoundID.NPCHit43, NPC.Center); - NPC.TargetClosest(); - if (Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[NPC.target].position, Main.player[NPC.target].width, Main.player[NPC.target].height)) + float rockSpeed = 4f; + int damage = Main.masterMode ? 18 : Main.expertMode ? 22 : 30; + if (Main.netMode != NetmodeID.MultiplayerClient) { - float rockSpeed = 4f; - Vector2 projPosition = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); + Vector2 projPosition = NPC.Center; float targetXDist = Main.player[NPC.target].position.X + Main.player[NPC.target].width * 0.5f - projPosition.X; float absoluteTargetX = Math.Abs(targetXDist) * 0.1f; float targetYDist = Main.player[NPC.target].position.Y + Main.player[NPC.target].height * 0.5f - projPosition.Y - absoluteTargetX; @@ -261,7 +266,7 @@ namespace CalamityMod.NPCs.NormalNPCs targetYDist += Main.rand.Next(-40, 41); targetXDist *= targetDistance; targetYDist *= targetDistance; - Projectile.NewProjectile(NPC.GetSource_FromAI(), projPosition.X, projPosition.Y, targetXDist, targetYDist, rockType, 30, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), projPosition.X, projPosition.Y, targetXDist, targetYDist, rockType, damage, 0f, Main.myPlayer, 0f, 0f); } } } @@ -271,21 +276,35 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.direction = playerLocation < 0 ? 1 : -1; NPC.spriteDirection = NPC.direction; - Vector2 direction = Main.player[NPC.target].Center - NPC.Center; - direction.Normalize(); - NPC.ai[1] += Main.expertMode ? 2f : 1f; - if (NPC.ai[1] >= 600f) + Vector2 direction = (Main.player[NPC.target].Center - NPC.Center).SafeNormalize(Vector2.UnitY); + float chargeGateValue = Main.expertMode ? 300f : 600f; + NPC.ai[1] += 1f; + if (NPC.ai[1] >= chargeGateValue) { - direction *= 6f; + // Set damage + NPC.damage = NPC.defDamage; + + float chargeVelocity = Main.expertMode ? 9f : 6f; + direction *= chargeVelocity; NPC.velocity = direction; - NPC.ai[1] = 0f; + NPC.ai[1] = -30f; } - if (Math.Sqrt((NPC.velocity.X * NPC.velocity.X) + (NPC.velocity.Y * NPC.velocity.Y)) > 1) - NPC.velocity *= 0.985f; + if (Math.Sqrt((NPC.velocity.X * NPC.velocity.X) + (NPC.velocity.Y * NPC.velocity.Y)) > 1D && NPC.ai[1] >= 0f) + { + // Avoid cheap bullshit + NPC.damage = 0; - if (Math.Sqrt((NPC.velocity.X * NPC.velocity.X) + (NPC.velocity.Y * NPC.velocity.Y)) <= 1 * 1.15) - NPC.velocity = direction * 1; + NPC.velocity *= 0.97f; + } + + if (Math.Sqrt((NPC.velocity.X * NPC.velocity.X) + (NPC.velocity.Y * NPC.velocity.Y)) <= 1.15) + { + // Avoid cheap bullshit + NPC.damage = 0; + + NPC.velocity = direction; + } return false; } diff --git a/NPCs/NormalNPCs/IceClasper.cs b/NPCs/NormalNPCs/IceClasper.cs index b68a91fd1d..fca3afe2b1 100644 --- a/NPCs/NormalNPCs/IceClasper.cs +++ b/NPCs/NormalNPCs/IceClasper.cs @@ -1,26 +1,26 @@ -using CalamityMod.Items.Accessories; +using System; +using System.IO; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Weapons.Summon; -using CalamityMod.World; using CalamityMod.Projectiles.Enemy; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; +using Terraria.GameContent; using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using Terraria.GameContent; -using System.IO; namespace CalamityMod.NPCs.NormalNPCs { public class IceClasper : ModNPC { public Player player => Main.player[NPC.target]; - + public bool expert = Main.expertMode; public bool revenge = CalamityWorld.revenge; public bool death = CalamityWorld.death; @@ -50,7 +50,7 @@ namespace CalamityMod.NPCs.NormalNPCs public float MaxVelocity = 10f; public float DistanceFromPlayer = 500f; - + // Although it is weird that Death Mode less projectiles, the AI also changes, making it a shotgun spread of 3 projectiles, so it'd be 2*3. public float AmountOfProjectiles = (CalamityWorld.death) ? 2f : (CalamityWorld.revenge) ? 4f : (Main.expertMode) ? 3f : 3f; public float TimeBetweenProjectiles = (CalamityWorld.death) ? 50f : (CalamityWorld.revenge) ? 35f : (Main.expertMode) ? 40f : 45f; @@ -66,7 +66,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 6; - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0); + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(); value.Rotation = MathHelper.ToRadians(135); NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; NPCID.Sets.TrailingMode[NPC.type] = 0; @@ -96,15 +96,19 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = false; NPC.Calamity().VulnerableToSickness = false; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Snow, BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.UndergroundSnow, - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.IceClasper") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.IceClasper") }); } @@ -165,11 +169,11 @@ namespace CalamityMod.NPCs.NormalNPCs } public void State_Shooting(Player player) - { + { // Minimun distance so the minion is able to shoot. if (NPC.Distance(player.Center) > 800f) return; - + AITimer++; if (AITimer >= TimeBetweenBurst) @@ -179,6 +183,7 @@ namespace CalamityMod.NPCs.NormalNPCs Vector2 vecToPlayer = NPC.SafeDirectionTo(player.Center); Vector2 projVelocity = vecToPlayer * ProjectileSpeed; int type = ModContent.ProjectileType(); + int damage = Main.masterMode ? 15 : Main.expertMode ? 18 : 24; // If Death Mode on, the enemy will shoot out a spead of projectiles, instead of a burst. if (Main.netMode != NetmodeID.MultiplayerClient) @@ -192,7 +197,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.Center + projVelocity.SafeNormalize(Vector2.Zero) * 10f, spreadVelocity, type, - 24, + damage, 0f, Main.myPlayer); Main.projectile[projectile].timeLeft = 300; @@ -205,7 +210,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.Center + projVelocity.SafeNormalize(Vector2.Zero) * 10f, projVelocity, type, - 24, + damage, 0f, Main.myPlayer); Main.projectile[projectile].timeLeft = 300; @@ -239,7 +244,7 @@ namespace CalamityMod.NPCs.NormalNPCs telegraphDust.noGravity = true; NPC.netUpdate = true; } - } + } public void State_Dashing(Player player) { @@ -297,13 +302,13 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 3; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 92, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Frost, hit.HitDirection, -1f, 0, default, 1f); } if (NPC.life <= 0) { for (int k = 0; k < 15; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 92, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Frost, hit.HitDirection, -1f, 0, default, 1f); } if (Main.netMode != NetmodeID.Server) { diff --git a/NPCs/NormalNPCs/ImpiousImmolator.cs b/NPCs/NormalNPCs/ImpiousImmolator.cs index 7278c038d5..fee09d05d7 100644 --- a/NPCs/NormalNPCs/ImpiousImmolator.cs +++ b/NPCs/NormalNPCs/ImpiousImmolator.cs @@ -1,4 +1,6 @@ -using CalamityMod.Dusts; +using System; +using System.IO; +using CalamityMod.Dusts; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Potions; @@ -6,8 +8,6 @@ using CalamityMod.Items.Weapons.Summon; using CalamityMod.Projectiles.Enemy; using CalamityMod.World; using Microsoft.Xna.Framework; -using System; -using System.IO; using Terraria; using Terraria.GameContent.Bestiary; using Terraria.ID; @@ -45,15 +45,19 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToWater = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.TheHallow, BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.TheUnderworld, - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.ImpiousImmolator") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.ImpiousImmolator") }); } @@ -158,11 +162,7 @@ namespace CalamityMod.NPCs.NormalNPCs targetDistance = speed / targetDistance; targetXDist *= targetDistance; targetYDist *= targetDistance; - int damage = 55; - if (Main.expertMode) - { - damage = 42; - } + int damage = Main.masterMode ? 35 : Main.expertMode ? 42 : 55; int beam = Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center.X, NPC.Center.Y, targetXDist, targetYDist, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); Main.projectile[beam].tileCollide = true; } diff --git a/NPCs/NormalNPCs/KingSlimeJewel.cs b/NPCs/NormalNPCs/KingSlimeJewel.cs index bc10f7bc3a..a6edbdf1f8 100644 --- a/NPCs/NormalNPCs/KingSlimeJewel.cs +++ b/NPCs/NormalNPCs/KingSlimeJewel.cs @@ -1,25 +1,25 @@ -using CalamityMod.Events; +using CalamityMod.CalPlayer; +using CalamityMod.Events; using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using CalamityMod.CalPlayer; namespace CalamityMod.NPCs.NormalNPCs { public class KingSlimeJewel : ModNPC { - private const int BoltShootGateValue = 75; - private const int BoltShootGateValue_Death = 60; + private const int BoltShootGateValue = 60; + private const int BoltShootGateValue_Death = 75; private const int BoltShootGateValue_BossRush = 45; private const float LightTelegraphDuration = 45f; public override void SetStaticDefaults() { - NPCID.Sets.NPCBestiaryDrawModifiers bestiaryData = new NPCID.Sets.NPCBestiaryDrawModifiers(0) { Hide = true }; + NPCID.Sets.NPCBestiaryDrawModifiers bestiaryData = new NPCID.Sets.NPCBestiaryDrawModifiers() { Hide = true }; NPCID.Sets.NPCBestiaryDrawOffset.Add(Type, bestiaryData); } @@ -32,11 +32,14 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.height = 22; NPC.defense = 10; NPC.DR_NERD(0.1f); + NPC.lifeMax = 140; - NPC.knockBackResist = 0f; + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; + NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); + + NPC.knockBackResist = 0.8f; NPC.noGravity = true; NPC.noTileCollide = true; - NPC.canGhostHeal = false; NPC.HitSound = SoundID.NPCHit5; NPC.DeathSound = SoundID.NPCDeath15; NPC.Calamity().VulnerableToSickness = false; @@ -57,15 +60,17 @@ namespace CalamityMod.NPCs.NormalNPCs return; } + Lighting.AddLight(NPC.Center, 0.8f, 0f, 0f); + // Float around the player NPC.rotation = NPC.velocity.X / 15f; - NPC.TargetClosest(true); + NPC.TargetClosest(); - float velocity = 2f; + float velocity = 5f; float acceleration = 0.1f; - if (NPC.position.Y > Main.player[NPC.target].position.Y - 350f) + if (NPC.position.Y > Main.player[NPC.target].position.Y - 400f) { if (NPC.velocity.Y > 0f) NPC.velocity.Y *= 0.98f; @@ -75,7 +80,7 @@ namespace CalamityMod.NPCs.NormalNPCs if (NPC.velocity.Y > velocity) NPC.velocity.Y = velocity; } - else if (NPC.position.Y < Main.player[NPC.target].position.Y - 400f) + else if (NPC.position.Y < Main.player[NPC.target].position.Y - 500f) { if (NPC.velocity.Y < 0f) NPC.velocity.Y *= 0.98f; @@ -113,26 +118,24 @@ namespace CalamityMod.NPCs.NormalNPCs { NPC.ai[0] = 0f; - Vector2 npcPos = new Vector2(NPC.Center.X, NPC.Center.Y); + Vector2 npcPos = NPC.Center; float xDist = Main.player[NPC.target].Center.X - npcPos.X; float yDist = Main.player[NPC.target].Center.Y - npcPos.Y; Vector2 projVector = new Vector2(xDist, yDist); float projLength = projVector.Length(); - float speed = 10f; + float speed = Main.masterMode ? 12f : 10f; int type = ModContent.ProjectileType(); projLength = speed / projLength; projVector.X *= projLength; projVector.Y *= projLength; - npcPos.X += projVector.X * 2f; - npcPos.Y += projVector.Y * 2f; for (int dusty = 0; dusty < 10; dusty++) { Vector2 dustVel = projVector; dustVel.Normalize(); - int ruby = Dust.NewDust(NPC.Center, NPC.width, NPC.height, 90, dustVel.X, dustVel.Y, 100, default, 2f); + int ruby = Dust.NewDust(NPC.Center, NPC.width, NPC.height, DustID.GemRuby, dustVel.X, dustVel.Y, 100, default, 2f); Main.dust[ruby].velocity *= 1.5f; Main.dust[ruby].noGravity = true; if (Main.rand.NextBool()) @@ -149,8 +152,8 @@ namespace CalamityMod.NPCs.NormalNPCs int damage = NPC.GetProjectileDamage(type); if (CalamityWorld.death || BossRushEvent.BossRushActive) { - int numProj = 3; - float rotation = MathHelper.ToRadians(9); + int numProj = 5; + float rotation = MathHelper.ToRadians(12); for (int i = 0; i < numProj; i++) { Vector2 perturbedSpeed = projVector.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); @@ -160,14 +163,16 @@ namespace CalamityMod.NPCs.NormalNPCs else Projectile.NewProjectile(NPC.GetSource_FromAI(), npcPos, projVector, type, damage, 0f, Main.myPlayer); } + + NPC.netUpdate = true; } } public override Color? GetAlpha(Color drawColor) { - Color initialColor = Color.DarkRed; + Color initialColor = new Color(150, 0, 0); Color newColor = initialColor; - Color finalColor = Color.White; + Color finalColor = new Color(255, 125, 125); float colorTelegraphGateValue = (BossRushEvent.BossRushActive ? BoltShootGateValue_BossRush : CalamityWorld.death ? BoltShootGateValue_Death : BoltShootGateValue) - LightTelegraphDuration; if (NPC.ai[0] > colorTelegraphGateValue) newColor = Color.Lerp(initialColor, finalColor, (NPC.ai[0] - colorTelegraphGateValue) / LightTelegraphDuration); @@ -176,35 +181,44 @@ namespace CalamityMod.NPCs.NormalNPCs return newColor; } + public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) + { + NPC.lifeMax = (int)(NPC.lifeMax * balance); + } + public override bool CheckActive() => false; public override void HitEffect(NPC.HitInfo hit) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 90, hit.HitDirection, -1f, 0, default, 1f); + int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.GemRuby, hit.HitDirection, -1f, 0, default, 1f); + Main.dust[dust].noGravity = true; + if (NPC.life <= 0) { - NPC.position.X = NPC.position.X + (NPC.width / 2); - NPC.position.Y = NPC.position.Y + (NPC.height / 2); - NPC.width = 45; - NPC.height = 45; + NPC.position = NPC.Center; + NPC.width = NPC.height = 45; NPC.position.X = NPC.position.X - (NPC.width / 2); NPC.position.Y = NPC.position.Y - (NPC.height / 2); + for (int i = 0; i < 2; i++) { - int rubyDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 90, 0f, 0f, 100, default, 2f); + int rubyDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.GemRuby, 0f, 0f, 100, default, 2f); Main.dust[rubyDust].velocity *= 3f; + Main.dust[rubyDust].noGravity = true; if (Main.rand.NextBool()) { Main.dust[rubyDust].scale = 0.5f; Main.dust[rubyDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } + for (int j = 0; j < 10; j++) { - int rubyDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 90, 0f, 0f, 100, default, 3f); + int rubyDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.GemRuby, 0f, 0f, 100, default, 3f); Main.dust[rubyDust2].noGravity = true; Main.dust[rubyDust2].velocity *= 5f; - rubyDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 90, 0f, 0f, 100, default, 2f); + rubyDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.GemRuby, 0f, 0f, 100, default, 2f); + Main.dust[rubyDust2].noGravity = true; Main.dust[rubyDust2].velocity *= 2f; } } diff --git a/NPCs/NormalNPCs/KingSlimeJewel.png b/NPCs/NormalNPCs/KingSlimeJewel.png index 326c657ab4..906567e7a7 100644 Binary files a/NPCs/NormalNPCs/KingSlimeJewel.png and b/NPCs/NormalNPCs/KingSlimeJewel.png differ diff --git a/NPCs/NormalNPCs/KingSlimeJewel2.cs b/NPCs/NormalNPCs/KingSlimeJewel2.cs new file mode 100644 index 0000000000..d18df61e1d --- /dev/null +++ b/NPCs/NormalNPCs/KingSlimeJewel2.cs @@ -0,0 +1,244 @@ +using System; +using CalamityMod.CalPlayer; +using CalamityMod.Events; +using CalamityMod.Projectiles.Boss; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.NormalNPCs +{ + public class KingSlimeJewel2 : ModNPC + { + public override string Texture => "CalamityMod/NPCs/NormalNPCs/KingSlimeJewel"; + + private const int BuffDustGateValue = 60; + private const float LightTelegraphDuration = 45f; + + public override void SetStaticDefaults() + { + NPCID.Sets.NPCBestiaryDrawModifiers bestiaryData = new NPCID.Sets.NPCBestiaryDrawModifiers() { Hide = true }; + NPCID.Sets.NPCBestiaryDrawOffset.Add(Type, bestiaryData); + } + + public override void SetDefaults() + { + NPC.aiStyle = -1; + AIType = -1; + NPC.damage = 10; + NPC.width = 22; + NPC.height = 22; + NPC.defense = 5; + NPC.DR_NERD(0.05f); + + NPC.lifeMax = 140; + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; + NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); + + NPC.knockBackResist = 0.9f; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.HitSound = SoundID.NPCHit5; + NPC.DeathSound = SoundID.NPCDeath15; + NPC.Calamity().VulnerableToSickness = false; + } + + public override void AI() + { + // Setting this in SetDefaults will disable expert mode scaling, so put it here instead + NPC.damage = 0; + + // Despawn + if (!CalamityPlayer.areThereAnyDamnBosses) + { + NPC.life = 0; + NPC.HitEffect(); + NPC.active = false; + NPC.netUpdate = true; + return; + } + + Lighting.AddLight(NPC.Center, 0f, 0f, 0.8f); + + // Float around the player + NPC.rotation = NPC.velocity.X / 15f; + + NPC.TargetClosest(); + + float velocity = 5f; + float acceleration = 0.1f; + + if (NPC.position.Y > Main.player[NPC.target].position.Y - 300f) + { + if (NPC.velocity.Y > 0f) + NPC.velocity.Y *= 0.98f; + + NPC.velocity.Y -= acceleration; + + if (NPC.velocity.Y > velocity) + NPC.velocity.Y = velocity; + } + else if (NPC.position.Y < Main.player[NPC.target].position.Y - 400f) + { + if (NPC.velocity.Y < 0f) + NPC.velocity.Y *= 0.98f; + + NPC.velocity.Y += acceleration; + + if (NPC.velocity.Y < -velocity) + NPC.velocity.Y = -velocity; + } + + if (NPC.Center.X > Main.player[NPC.target].Center.X + 300f) + { + if (NPC.velocity.X > 0f) + NPC.velocity.X *= 0.98f; + + NPC.velocity.X -= acceleration; + + if (NPC.velocity.X > 8f) + NPC.velocity.X = 8f; + } + if (NPC.Center.X < Main.player[NPC.target].Center.X - 300f) + { + if (NPC.velocity.X < 0f) + NPC.velocity.X *= 0.98f; + + NPC.velocity.X += acceleration; + + if (NPC.velocity.X < -8f) + NPC.velocity.X = -8f; + } + + // Emit buff dust + NPC.ai[0] += 1f; + if (NPC.ai[0] >= BuffDustGateValue) + { + NPC.ai[0] = 0f; + + SoundEngine.PlaySound(SoundID.Item8, NPC.Center); + + int distanceFromKingSlime = 1; + Vector2 kingSlimeCenter = NPC.Center; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active && Main.npc[i].type == NPCID.KingSlime) + { + distanceFromKingSlime = (int)NPC.Distance(Main.npc[i].Center); + kingSlimeCenter = Main.npc[i].Center; + break; + } + } + + for (int dusty = 0; dusty < 10; dusty++) + { + Vector2 dustVel = (kingSlimeCenter - NPC.Center).SafeNormalize(Vector2.UnitY) * Main.rand.NextFloat(2f, 4f); + int sapphire = Dust.NewDust(NPC.Center, NPC.width, NPC.height, DustID.GemSapphire, 0f, 0f, 100, default, 2f); + Main.dust[sapphire].velocity = dustVel * Main.rand.NextFloat(1f, 2f); + Main.dust[sapphire].noGravity = true; + if (Main.rand.NextBool()) + { + Main.dust[sapphire].scale = 0.5f; + Main.dust[sapphire].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + } + } + + int maxDustIterations = distanceFromKingSlime; + int maxDust = 100; + int dustDivisor = maxDustIterations / maxDust; + if (dustDivisor < 2) + dustDivisor = 2; + + Vector2 dustLineStart = NPC.Center; + Vector2 dustLineEnd = kingSlimeCenter; + Vector2 currentDustPos = default; + Vector2 spinningpoint = new Vector2(0f, -1f).RotatedByRandom(MathHelper.Pi); + int dustSpawned = 0; + for (int i = 0; i < maxDustIterations; i++) + { + if (i % dustDivisor == 0) + { + currentDustPos = Vector2.Lerp(dustLineStart, dustLineEnd, i / (float)maxDustIterations); + int dust = Dust.NewDust(currentDustPos, 0, 0, DustID.GemSapphire, 0f, 0f, 100, default, 1f); + Main.dust[dust].position = currentDustPos; + Main.dust[dust].velocity = spinningpoint.RotatedBy(MathHelper.TwoPi * i / maxDustIterations) * (0.9f + Main.rand.NextFloat() * 0.2f); + Main.dust[dust].noGravity = true; + if (Main.rand.NextBool()) + { + Main.dust[dust].scale = 0.5f; + Main.dust[dust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + } + + Dust dust2 = Dust.CloneDust(dust); + Dust dust3 = dust2; + dust3.scale *= 0.5f; + dust3 = dust2; + dust3.fadeIn *= 0.5f; + dustSpawned++; + } + } + + NPC.netUpdate = true; + } + } + + public override Color? GetAlpha(Color drawColor) + { + Color initialColor = new Color(0, 0, 150); + Color newColor = initialColor; + Color finalColor = new Color(125, 125, 255); + float colorTelegraphGateValue = BuffDustGateValue - LightTelegraphDuration; + if (NPC.ai[0] > colorTelegraphGateValue) + newColor = Color.Lerp(initialColor, finalColor, (NPC.ai[0] - colorTelegraphGateValue) / LightTelegraphDuration); + newColor.A = (byte)(255 * NPC.Opacity); + + return newColor; + } + + public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) + { + NPC.lifeMax = (int)(NPC.lifeMax * balance); + } + + public override bool CheckActive() => false; + + public override void HitEffect(NPC.HitInfo hit) + { + int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.GemSapphire, hit.HitDirection, -1f, 0, default, 1f); + Main.dust[dust].noGravity = true; + + if (NPC.life <= 0) + { + NPC.position = NPC.Center; + NPC.width = NPC.height = 45; + NPC.position.X = NPC.position.X - (NPC.width / 2); + NPC.position.Y = NPC.position.Y - (NPC.height / 2); + + for (int i = 0; i < 2; i++) + { + int rubyDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.GemSapphire, 0f, 0f, 100, default, 2f); + Main.dust[rubyDust].noGravity = true; + Main.dust[rubyDust].velocity *= 3f; + if (Main.rand.NextBool()) + { + Main.dust[rubyDust].scale = 0.5f; + Main.dust[rubyDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + } + } + + for (int j = 0; j < 10; j++) + { + int rubyDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.GemSapphire, 0f, 0f, 100, default, 3f); + Main.dust[rubyDust2].noGravity = true; + Main.dust[rubyDust2].velocity *= 5f; + rubyDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.GemSapphire, 0f, 0f, 100, default, 2f); + Main.dust[rubyDust2].noGravity = true; + Main.dust[rubyDust2].velocity *= 2f; + } + } + } + } +} diff --git a/NPCs/NormalNPCs/KingSlimeJewel3.cs b/NPCs/NormalNPCs/KingSlimeJewel3.cs new file mode 100644 index 0000000000..91668e6b70 --- /dev/null +++ b/NPCs/NormalNPCs/KingSlimeJewel3.cs @@ -0,0 +1,276 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Events; +using CalamityMod.Projectiles.Boss; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.NormalNPCs +{ + public class KingSlimeJewel3 : ModNPC + { + public override string Texture => "CalamityMod/NPCs/NormalNPCs/KingSlimeJewel"; + + private const int ChargePhaseGateValue = 90; + private const int ChargeGateValue = 60; + private const int ChargeGateValue_Death = 40; + private const float LightTelegraphDuration = 30f; + + public override void SetStaticDefaults() + { + NPCID.Sets.NPCBestiaryDrawModifiers bestiaryData = new NPCID.Sets.NPCBestiaryDrawModifiers() { Hide = true }; + NPCID.Sets.NPCBestiaryDrawOffset.Add(Type, bestiaryData); + } + + public override void SetDefaults() + { + NPC.aiStyle = -1; + AIType = -1; + NPC.GetNPCDamage(); + NPC.width = 22; + NPC.height = 22; + NPC.defense = 15; + NPC.DR_NERD(0.15f); + + NPC.lifeMax = 280; + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; + NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); + + NPC.knockBackResist = 0.7f; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.HitSound = SoundID.NPCHit5; + NPC.DeathSound = SoundID.NPCDeath15; + NPC.Calamity().VulnerableToSickness = false; + } + + public override void AI() + { + // Despawn + if (!CalamityPlayer.areThereAnyDamnBosses) + { + NPC.life = 0; + NPC.HitEffect(); + NPC.active = false; + NPC.netUpdate = true; + return; + } + + Lighting.AddLight(NPC.Center, 0f, 0.8f, 0f); + + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead) + NPC.TargetClosest(); + + if (NPC.ai[3] == 1f) + { + NPC.knockBackResist = 0f; + + if (NPC.ai[0] == 0f) + { + // Avoid cheap bullshit + NPC.damage = 0; + + NPC.velocity *= CalamityWorld.death ? 0.94f : 0.96f; + + NPC.ai[1] += 1f; + + float anglularSpeed = NPC.ai[1] / (CalamityWorld.death ? ChargeGateValue_Death : ChargeGateValue); + anglularSpeed = 0.1f + anglularSpeed * 0.4f; + NPC.rotation += anglularSpeed * NPC.direction; + + if (NPC.ai[1] >= (CalamityWorld.death ? ChargeGateValue_Death : ChargeGateValue)) + { + for (int dusty = 0; dusty < 10; dusty++) + { + Vector2 dustVel = NPC.SafeDirectionTo(Main.player[NPC.target].Center + Main.player[NPC.target].velocity * 20f, -Vector2.UnitY) * Main.rand.NextFloat(-4f, -1f); + int emerald = Dust.NewDust(NPC.Center, NPC.width, NPC.height, DustID.GemEmerald, 0f, 0f, 100, default, 2f); + Main.dust[emerald].velocity = dustVel * Main.rand.NextFloat(1f, 2f); + Main.dust[emerald].noGravity = true; + if (Main.rand.NextBool()) + { + Main.dust[emerald].scale = 0.5f; + Main.dust[emerald].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + } + } + + SoundEngine.PlaySound(SoundID.Item38, NPC.Center); + + NPC.ai[0] = 1f; + NPC.ai[1] = 0f; + NPC.netUpdate = true; + } + } + else if (NPC.ai[0] == 1f) + { + // Set damage + NPC.damage = NPC.defDamage; + + float chargeSpeed = CalamityWorld.death ? 24f : 16f; + NPC.velocity = NPC.SafeDirectionTo(Main.player[NPC.target].Center + Main.player[NPC.target].velocity * 20f, -Vector2.UnitY) * chargeSpeed; + NPC.rotation = NPC.velocity.ToRotation() + MathHelper.PiOver2; + + NPC.ai[0] = 2f; + NPC.ai[1] = 0f; + + NPC.netSpam = 0; + NPC.netUpdate = true; + } + else if (NPC.ai[0] == 2f) + { + // Set damage + NPC.damage = NPC.defDamage; + + NPC.ai[1] += 1f; + if (NPC.ai[1] >= (CalamityWorld.death ? ChargeGateValue_Death : ChargeGateValue)) + { + // Avoid cheap bullshit + NPC.damage = 0; + + for (int dusty = 0; dusty < 10; dusty++) + { + Vector2 dustVel = Main.rand.NextVector2CircularEdge(5f, 5f); + int emerald = Dust.NewDust(NPC.Center, NPC.width, NPC.height, DustID.GemEmerald, 0f, 0f, 100, default, 2f); + Main.dust[emerald].velocity = dustVel * Main.rand.NextFloat(1f, 2f); + Main.dust[emerald].noGravity = true; + if (Main.rand.NextBool()) + { + Main.dust[emerald].scale = 0.5f; + Main.dust[emerald].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + } + } + + SoundEngine.PlaySound(SoundID.Item8, NPC.Center); + + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.ai[3] = 0f; + NPC.netUpdate = true; + + NPC.velocity = Vector2.Zero; + } + } + } + else + { + // Avoid cheap bullshit + NPC.damage = 0; + + NPC.knockBackResist = 0.7f; + + NPC.rotation = NPC.velocity.X / 15f; + + float velocity = 5f; + float acceleration = 0.2f; + + if (NPC.position.Y > Main.player[NPC.target].position.Y - 200f) + { + if (NPC.velocity.Y > 0f) + NPC.velocity.Y *= 0.98f; + + NPC.velocity.Y -= acceleration; + + if (NPC.velocity.Y > velocity) + NPC.velocity.Y = velocity; + } + else if (NPC.position.Y < Main.player[NPC.target].position.Y - 300f) + { + if (NPC.velocity.Y < 0f) + NPC.velocity.Y *= 0.98f; + + NPC.velocity.Y += acceleration; + + if (NPC.velocity.Y < -velocity) + NPC.velocity.Y = -velocity; + } + + if (NPC.Center.X > Main.player[NPC.target].Center.X + 200f) + { + if (NPC.velocity.X > 0f) + NPC.velocity.X *= 0.98f; + + NPC.velocity.X -= acceleration; + + if (NPC.velocity.X > 8f) + NPC.velocity.X = 8f; + } + if (NPC.Center.X < Main.player[NPC.target].Center.X - 200f) + { + if (NPC.velocity.X < 0f) + NPC.velocity.X *= 0.98f; + + NPC.velocity.X += acceleration; + + if (NPC.velocity.X < -8f) + NPC.velocity.X = -8f; + } + + NPC.ai[2] += 1f; + if (NPC.ai[2] >= ChargePhaseGateValue) + { + NPC.ai[2] = 0f; + NPC.ai[3] = 1f; + NPC.netUpdate = true; + } + } + } + + public override Color? GetAlpha(Color drawColor) + { + Color initialColor = new Color(0, 150, 0); + Color newColor = initialColor; + Color finalColor = new Color(125, 255, 125); + float colorTelegraphGateValue = (CalamityWorld.death ? ChargeGateValue_Death : ChargeGateValue) - LightTelegraphDuration; + if (NPC.ai[1] > colorTelegraphGateValue) + newColor = Color.Lerp(initialColor, finalColor, (NPC.ai[1] - colorTelegraphGateValue) / LightTelegraphDuration); + newColor.A = (byte)(255 * NPC.Opacity); + + return newColor; + } + + public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) + { + NPC.lifeMax = (int)(NPC.lifeMax * balance); + } + + public override bool CheckActive() => false; + + public override void HitEffect(NPC.HitInfo hit) + { + int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.GemEmerald, hit.HitDirection, -1f, 0, default, 1f); + Main.dust[dust].noGravity = true; + + if (NPC.life <= 0) + { + NPC.position = NPC.Center; + NPC.width = NPC.height = 45; + NPC.position.X = NPC.position.X - (NPC.width / 2); + NPC.position.Y = NPC.position.Y - (NPC.height / 2); + + for (int i = 0; i < 2; i++) + { + int emeraldDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.GemEmerald, 0f, 0f, 100, default, 2f); + Main.dust[emeraldDust].noGravity = true; + Main.dust[emeraldDust].velocity *= 3f; + if (Main.rand.NextBool()) + { + Main.dust[emeraldDust].scale = 0.5f; + Main.dust[emeraldDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + } + } + + for (int j = 0; j < 10; j++) + { + int emeraldDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.GemEmerald, 0f, 0f, 100, default, 3f); + Main.dust[emeraldDust2].noGravity = true; + Main.dust[emeraldDust2].velocity *= 5f; + emeraldDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.GemEmerald, 0f, 0f, 100, default, 2f); + Main.dust[emeraldDust2].noGravity = true; + Main.dust[emeraldDust2].velocity *= 2f; + } + } + } + } +} diff --git a/NPCs/NormalNPCs/LavaSlimeNoLavaDrop.cs b/NPCs/NormalNPCs/LavaSlimeNoLavaDrop.cs new file mode 100644 index 0000000000..ca5764da80 --- /dev/null +++ b/NPCs/NormalNPCs/LavaSlimeNoLavaDrop.cs @@ -0,0 +1,75 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.NormalNPCs +{ + public class LavaSlimeNoLavaDrop : ModNPC + { + public override string Texture => $"Terraria/Images/NPC_{NPCID.LavaSlime}"; + + public override void SetStaticDefaults() + { + Main.npcFrameCount[NPC.type] = 2; + this.HideFromBestiary(); + } + + public override void SetDefaults() + { + NPC.aiStyle = NPCAIStyleID.Slime; + AIType = NPCID.LavaSlime; + AnimationType = NPCID.LavaSlime; + NPC.width = 24; + NPC.height = 18; + NPC.damage = 15; + NPC.defense = 10; + NPC.lifeMax = 50; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.scale = 1.1f; + NPC.alpha = 50; + NPC.lavaImmune = true; + NPC.value = 120f; + if (Main.remixWorld) + { + NPC.damage = 7; + NPC.defense = 2; + NPC.lifeMax = 25; + NPC.value = 25f; + } + //Banner = NPCID.LavaSlime; + //BannerItem = ItemID.LavaSlimeBanner; + + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToWater = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); + } + + public override void HitEffect(NPC.HitInfo hit) + { + if (NPC.life > 0) + { + for (int i = 0; (double)i < hit.Damage / (double)NPC.lifeMax * 80D; i++) + { + int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, 6, hit.HitDirection * 2, -1f, NPC.alpha, default, 1.5f); + if (Main.rand.Next(8) != 0) + Main.dust[dust].noGravity = true; + } + + return; + } + + for (int i = 0; i < 40; i++) + { + int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, 6, hit.HitDirection * 2, -1f, NPC.alpha, default, 1.5f); + if (Main.rand.Next(8) != 0) + Main.dust[dust].noGravity = true; + } + } + } +} diff --git a/NPCs/NormalNPCs/MantisShrimp.cs b/NPCs/NormalNPCs/MantisShrimp.cs index 2ccd64a058..15eb09e912 100644 --- a/NPCs/NormalNPCs/MantisShrimp.cs +++ b/NPCs/NormalNPCs/MantisShrimp.cs @@ -15,7 +15,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 6; - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { SpriteDirection = 1 }; @@ -41,11 +41,15 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Ocean, new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.MantisShrimp") @@ -119,9 +123,9 @@ namespace CalamityMod.NPCs.NormalNPCs } public override void ModifyNPCLoot(NPCLoot npcLoot) - { - npcLoot.AddIf(() => NPC.downedPlantBoss, ModContent.ItemType(), 5); - } + { + npcLoot.AddIf(() => NPC.downedPlantBoss, ModContent.ItemType(), 5); + } public override void HitEffect(NPC.HitInfo hit) { diff --git a/NPCs/NormalNPCs/OverloadedSoldier.cs b/NPCs/NormalNPCs/OverloadedSoldier.cs index b9911088c5..0c9fe9bb28 100644 --- a/NPCs/NormalNPCs/OverloadedSoldier.cs +++ b/NPCs/NormalNPCs/OverloadedSoldier.cs @@ -1,10 +1,10 @@ using System; -using Microsoft.Xna.Framework; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; using CalamityMod.World; +using Microsoft.Xna.Framework; using Terraria; using Terraria.GameContent.Bestiary; using Terraria.GameContent.ItemDropRules; @@ -31,7 +31,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.defense = 18; NPC.DR_NERD(0.15f); NPC.lifeMax = NPC.downedMoonlord ? 1350 : 135; - NPC.knockBackResist = 0f; + NPC.knockBackResist = 0.3f; NPC.value = Item.buyPrice(0, 0, 2, 0); NPC.HitSound = SoundID.NPCHit2; NPC.DeathSound = SoundID.NPCDeath2; @@ -39,14 +39,18 @@ namespace CalamityMod.NPCs.NormalNPCs BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToWater = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Underground, - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.OverloadedSoldier") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.OverloadedSoldier") }); } @@ -98,7 +102,7 @@ namespace CalamityMod.NPCs.NormalNPCs if (NPC.frame.Y > frameHeight * 13) NPC.frame.Y = frameHeight; } - } + } } public override void AI() @@ -178,7 +182,7 @@ namespace CalamityMod.NPCs.NormalNPCs if (Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) < 400f) { maxVelocity += (CalamityWorld.death ? 8f : CalamityWorld.revenge ? 6f : 4f) - ((Main.player[NPC.target].Center - NPC.Center).Length() * 0.01f); - } + } if (NPC.velocity.X < -maxVelocity || NPC.velocity.X > maxVelocity) { if (NPC.velocity.Y == 0f) @@ -390,13 +394,13 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 3; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Polterplasm, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Necroplasm, hit.HitDirection, -1f, 0, default, 1f); } if (NPC.life <= 0) { for (int k = 0; k < 15; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Polterplasm, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Necroplasm, hit.HitDirection, -1f, 0, default, 1f); } } } @@ -405,7 +409,7 @@ namespace CalamityMod.NPCs.NormalNPCs { npcLoot.Add(ModContent.ItemType()); LeadingConditionRule postML = npcLoot.DefineConditionalDropSet(DropHelper.PostML()); - postML.Add(ModContent.ItemType()); + postML.Add(ModContent.ItemType()); } } } diff --git a/NPCs/NormalNPCs/PerennialSlime.cs b/NPCs/NormalNPCs/PerennialSlime.cs index 29e0c3a09c..a4027c898b 100644 --- a/NPCs/NormalNPCs/PerennialSlime.cs +++ b/NPCs/NormalNPCs/PerennialSlime.cs @@ -23,7 +23,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.height = 30; NPC.defense = 12; NPC.lifeMax = 150; - NPC.knockBackResist = 0f; + NPC.knockBackResist = 0.5f; AnimationType = NPCID.CorruptSlime; NPC.value = Item.buyPrice(0, 0, 10, 0); NPC.alpha = 50; @@ -36,17 +36,26 @@ namespace CalamityMod.NPCs.NormalNPCs BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Caverns, - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.PerennialSlime") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.PerennialSlime") }); } + public override void AI() + { + NPC.damage = (NPC.velocity.Y == 0f || NPC.velocity.Length() < 3f) ? 0 : NPC.defDamage; + } + public override float SpawnChance(NPCSpawnInfo spawnInfo) { if (spawnInfo.PlayerSafe || !NPC.downedPlantBoss || spawnInfo.Player.Calamity().ZoneAbyss || diff --git a/NPCs/NormalNPCs/PhantomSpirit.cs b/NPCs/NormalNPCs/PhantomSpirit.cs index a7e0bf2637..9f81e50f1d 100644 --- a/NPCs/NormalNPCs/PhantomSpirit.cs +++ b/NPCs/NormalNPCs/PhantomSpirit.cs @@ -1,6 +1,7 @@ using CalamityMod.Dusts; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; +using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; @@ -24,7 +25,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.height = 16; NPC.defense = 10; NPC.lifeMax = 1000; - NPC.knockBackResist = 0.1f; + NPC.knockBackResist = 0.2f; AnimationType = NPCID.DungeonSpirit; AIType = -1; NPC.value = Item.buyPrice(0, 0, 20, 0); @@ -35,22 +36,26 @@ namespace CalamityMod.NPCs.NormalNPCs Banner = NPC.type; BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToSickness = false; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.TheDungeon, - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.PhantomSpirit") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.PhantomSpirit") }); } public override void AI() { float speed = CalamityWorld.death ? 22f : CalamityWorld.revenge ? 19.5f : 17f; - CalamityAI.DungeonSpiritAI(NPC, Mod, speed, -MathHelper.PiOver2); - int polterDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Polterplasm, 0f, 0f, 0, default, 1f); + CalamityRegularEnemyAI.DungeonSpiritAI(NPC, Mod, speed, -MathHelper.PiOver2); + int polterDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Necroplasm, 0f, 0f, 0, default, 1f); Dust dust = Main.dust[polterDust]; dust.velocity *= 0.1f; dust.scale = 1.3f; @@ -61,13 +66,13 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 5; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Polterplasm, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Necroplasm, hit.HitDirection, -1f, 0, default, 1f); } if (NPC.life <= 0) { for (int i = 0; i < 50; i++) { - int hitPolterDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Polterplasm, NPC.velocity.X, NPC.velocity.Y, 0, default, 1f); + int hitPolterDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Necroplasm, NPC.velocity.X, NPC.velocity.Y, 0, default, 1f); Dust dust = Main.dust[hitPolterDust]; dust.velocity *= 2f; dust.noGravity = true; @@ -78,6 +83,6 @@ namespace CalamityMod.NPCs.NormalNPCs public override Color? GetAlpha(Color drawColor) => new Color(200, 200, 200, 0); - public override void ModifyNPCLoot(NPCLoot npcLoot) => npcLoot.Add(ModContent.ItemType()); + public override void ModifyNPCLoot(NPCLoot npcLoot) => npcLoot.Add(ModContent.ItemType()); } } diff --git a/NPCs/NormalNPCs/PhantomSpiritL.cs b/NPCs/NormalNPCs/PhantomSpiritL.cs index 233e0ef259..b6edcf000f 100644 --- a/NPCs/NormalNPCs/PhantomSpiritL.cs +++ b/NPCs/NormalNPCs/PhantomSpiritL.cs @@ -1,11 +1,12 @@ -using CalamityMod.Dusts; +using System; +using CalamityMod.Dusts; using CalamityMod.Events; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; +using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.GameContent.Bestiary; using Terraria.ID; @@ -31,7 +32,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.scale *= 1.2f; NPC.defense = 30; NPC.lifeMax = 3000; - NPC.knockBackResist = 0f; + NPC.knockBackResist = 0.1f; AIType = -1; NPC.value = Item.buyPrice(0, 0, 60, 0); NPC.HitSound = SoundID.NPCHit36; @@ -41,14 +42,18 @@ namespace CalamityMod.NPCs.NormalNPCs Banner = ModContent.NPCType(); BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToSickness = false; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.TheDungeon, - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.PhantomSpirit") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.PhantomSpirit") }); } @@ -63,8 +68,8 @@ namespace CalamityMod.NPCs.NormalNPCs public override void AI() { float speed = (CalamityWorld.death || BossRushEvent.BossRushActive) ? 16f : CalamityWorld.revenge ? 14f : 12f; - CalamityAI.DungeonSpiritAI(NPC, Mod, speed, -MathHelper.PiOver2); - int polterDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Polterplasm, 0f, 0f, 0, default, 1f); + CalamityRegularEnemyAI.DungeonSpiritAI(NPC, Mod, speed, -MathHelper.PiOver2); + int polterDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Necroplasm, 0f, 0f, 0, default, 1f); Dust dust = Main.dust[polterDust]; dust.velocity *= 0.1f; dust.scale = 1.3f; @@ -95,13 +100,13 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 5; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Polterplasm, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Necroplasm, hit.HitDirection, -1f, 0, default, 1f); } if (NPC.life <= 0) { for (int i = 0; i < 50; i++) { - int hitPolterDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Polterplasm, NPC.velocity.X, NPC.velocity.Y, 0, default, 1f); + int hitPolterDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Necroplasm, NPC.velocity.X, NPC.velocity.Y, 0, default, 1f); Dust dust = Main.dust[hitPolterDust]; dust.velocity *= 2f; dust.noGravity = true; @@ -112,6 +117,6 @@ namespace CalamityMod.NPCs.NormalNPCs public override Color? GetAlpha(Color drawColor) => new Color(200, 200, 200, 0); - public override void ModifyNPCLoot(NPCLoot npcLoot) => npcLoot.Add(ModContent.ItemType(), 1, 2, 4); + public override void ModifyNPCLoot(NPCLoot npcLoot) => npcLoot.Add(ModContent.ItemType(), 1, 2, 4); } } diff --git a/NPCs/NormalNPCs/PhantomSpiritM.cs b/NPCs/NormalNPCs/PhantomSpiritM.cs index 3c6729f09c..a018061991 100644 --- a/NPCs/NormalNPCs/PhantomSpiritM.cs +++ b/NPCs/NormalNPCs/PhantomSpiritM.cs @@ -1,6 +1,7 @@ using CalamityMod.Dusts; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; +using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; @@ -27,7 +28,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.scale *= 1.1f; NPC.defense = 25; NPC.lifeMax = 2000; - NPC.knockBackResist = 0.1f; + NPC.knockBackResist = 0.15f; AIType = -1; NPC.value = Item.buyPrice(0, 0, 40, 0); NPC.HitSound = SoundID.NPCHit36; @@ -37,14 +38,18 @@ namespace CalamityMod.NPCs.NormalNPCs Banner = ModContent.NPCType(); BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToSickness = false; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.TheDungeon, - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.PhantomSpirit") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.PhantomSpirit") }); } @@ -59,8 +64,8 @@ namespace CalamityMod.NPCs.NormalNPCs public override void AI() { float speed = CalamityWorld.death ? 18f : CalamityWorld.revenge ? 15.75f : 13.5f; - CalamityAI.DungeonSpiritAI(NPC, Mod, speed, -MathHelper.PiOver2); - int polterDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Polterplasm, 0f, 0f, 0, default, 1f); + CalamityRegularEnemyAI.DungeonSpiritAI(NPC, Mod, speed, -MathHelper.PiOver2); + int polterDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Necroplasm, 0f, 0f, 0, default, 1f); Dust dust = Main.dust[polterDust]; dust.velocity *= 0.1f; dust.scale = 1.3f; @@ -72,13 +77,13 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 5; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Polterplasm, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Necroplasm, hit.HitDirection, -1f, 0, default, 1f); } if (NPC.life <= 0) { for (int i = 0; i < 50; i++) { - int hitPolterDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Polterplasm, NPC.velocity.X, NPC.velocity.Y, 0, default, 1f); + int hitPolterDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Necroplasm, NPC.velocity.X, NPC.velocity.Y, 0, default, 1f); Dust dust = Main.dust[hitPolterDust]; dust.velocity *= 2f; dust.noGravity = true; @@ -89,6 +94,6 @@ namespace CalamityMod.NPCs.NormalNPCs public override Color? GetAlpha(Color drawColor) => new Color(200, 200, 200, 0); - public override void ModifyNPCLoot(NPCLoot npcLoot) => npcLoot.Add(ModContent.ItemType(), 1, 1, 3); + public override void ModifyNPCLoot(NPCLoot npcLoot) => npcLoot.Add(ModContent.ItemType(), 1, 1, 3); } } diff --git a/NPCs/NormalNPCs/PhantomSpiritS.cs b/NPCs/NormalNPCs/PhantomSpiritS.cs index de9a48fb3f..7d375805c5 100644 --- a/NPCs/NormalNPCs/PhantomSpiritS.cs +++ b/NPCs/NormalNPCs/PhantomSpiritS.cs @@ -1,6 +1,7 @@ using CalamityMod.Dusts; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; +using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; @@ -26,7 +27,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.height = 80; NPC.defense = 20; NPC.lifeMax = 1500; - NPC.knockBackResist = 0.1f; + NPC.knockBackResist = 0.2f; AIType = -1; NPC.value = Item.buyPrice(0, 0, 30, 0); NPC.HitSound = SoundID.NPCHit36; @@ -36,14 +37,18 @@ namespace CalamityMod.NPCs.NormalNPCs Banner = ModContent.NPCType(); BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToSickness = false; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.TheDungeon, - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.PhantomSpirit") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.PhantomSpirit") }); } @@ -58,8 +63,8 @@ namespace CalamityMod.NPCs.NormalNPCs public override void AI() { float speed = CalamityWorld.death ? 20f : CalamityWorld.revenge ? 17.5f : 15f; - CalamityAI.DungeonSpiritAI(NPC, Mod, speed, -MathHelper.PiOver2); - int polterDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Polterplasm, 0f, 0f, 0, default, 1f); + CalamityRegularEnemyAI.DungeonSpiritAI(NPC, Mod, speed, -MathHelper.PiOver2); + int polterDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Necroplasm, 0f, 0f, 0, default, 1f); Dust dust = Main.dust[polterDust]; dust.velocity *= 0.1f; dust.scale = 1.3f; @@ -70,13 +75,13 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 5; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Polterplasm, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Necroplasm, hit.HitDirection, -1f, 0, default, 1f); } if (NPC.life <= 0) { for (int i = 0; i < 50; i++) { - int hitPolterDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Polterplasm, NPC.velocity.X, NPC.velocity.Y, 0, default, 1f); + int hitPolterDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Necroplasm, NPC.velocity.X, NPC.velocity.Y, 0, default, 1f); Dust dust = Main.dust[hitPolterDust]; dust.velocity *= 2f; dust.noGravity = true; @@ -87,6 +92,6 @@ namespace CalamityMod.NPCs.NormalNPCs public override Color? GetAlpha(Color drawColor) => new Color(200, 200, 200, 0); - public override void ModifyNPCLoot(NPCLoot npcLoot) => npcLoot.Add(ModContent.ItemType(), 1, 1, 2); + public override void ModifyNPCLoot(NPCLoot npcLoot) => npcLoot.Add(ModContent.ItemType(), 1, 1, 2); } } diff --git a/NPCs/NormalNPCs/Piggy.cs b/NPCs/NormalNPCs/Piggy.cs index 0b37b5a1ba..c92aebd1e2 100644 --- a/NPCs/NormalNPCs/Piggy.cs +++ b/NPCs/NormalNPCs/Piggy.cs @@ -1,6 +1,6 @@ -using CalamityMod.Items.Placeables.Banners; +using System; using CalamityMod.Items.Critters; -using System; +using CalamityMod.Items.Placeables.Banners; using Terraria; using Terraria.GameContent.Bestiary; using Terraria.ID; @@ -15,7 +15,7 @@ namespace CalamityMod.NPCs.NormalNPCs Main.npcFrameCount[NPC.type] = 5; Main.npcCatchable[NPC.type] = true; NPCID.Sets.CountsAsCritter[NPC.type] = true; - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { SpriteDirection = 1 }; @@ -65,7 +65,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Times.DayTime, BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Surface, diff --git a/NPCs/NormalNPCs/PlanterasFreeTentacle.cs b/NPCs/NormalNPCs/PlanterasFreeTentacle.cs index 705e426cab..0cbf988952 100644 --- a/NPCs/NormalNPCs/PlanterasFreeTentacle.cs +++ b/NPCs/NormalNPCs/PlanterasFreeTentacle.cs @@ -22,7 +22,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 4; - NPCID.Sets.NPCBestiaryDrawModifiers bestiaryData = new NPCID.Sets.NPCBestiaryDrawModifiers(0) { Hide = true }; + NPCID.Sets.NPCBestiaryDrawModifiers bestiaryData = new NPCID.Sets.NPCBestiaryDrawModifiers() { Hide = true }; NPCID.Sets.NPCBestiaryDrawOffset.Add(Type, bestiaryData); } @@ -36,7 +36,11 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.width = 24; NPC.height = 24; NPC.defense = 20; - NPC.lifeMax = 1000; + + NPC.lifeMax = 500; + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; + NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); + NPC.knockBackResist = 0.4f; NPC.noGravity = true; NPC.noTileCollide = true; @@ -45,6 +49,10 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void FindFrame(int frameHeight) @@ -64,12 +72,12 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.TargetClosest(); // Emit light - Lighting.AddLight((int)((NPC.position.X + (NPC.width / 2)) / 16f), (int)((NPC.position.Y + (NPC.height / 2)) / 16f), 0.2f, 0.4f, 0.1f); + Lighting.AddLight(NPC.Center, 0.2f, 0.4f, 0.1f); // Spore dust if (Main.rand.NextBool(10)) { - Dust dust = Dust.NewDustDirect(NPC.position, NPC.width, NPC.height, 44, 0f, 0f, 250, default, 0.4f); + Dust dust = Dust.NewDustDirect(NPC.position, NPC.width, NPC.height, DustID.JungleSpore, 0f, 0f, 250, default, 0.4f); dust.fadeIn = 0.7f; } @@ -93,9 +101,9 @@ namespace CalamityMod.NPCs.NormalNPCs } // Velocity and acceleration - Vector2 idealVelocity = new Vector2(death ? 12f : 9f, death ? 5f : 3.5f); - float accelerationX = death ? 0.2f : 0.15f; - float accelerationY = death ? 0.15f : 0.12f; + Vector2 idealVelocity = new Vector2(death ? 8f : 6f, death ? 6f : 4.5f); + float accelerationX = death ? 0.16f : 0.12f; + float accelerationY = death ? 0.12f : 0.09f; if (Main.getGoodWorld) { @@ -199,13 +207,14 @@ namespace CalamityMod.NPCs.NormalNPCs public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { + NPC.lifeMax = (int)(NPC.lifeMax * balance); NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) { if (hurtInfo.Damage > 0) - target.AddBuff(BuffID.Poisoned, 300); + target.AddBuff(BuffID.Poisoned, 120); } public override void HitEffect(NPC.HitInfo hit) @@ -213,13 +222,13 @@ namespace CalamityMod.NPCs.NormalNPCs if (NPC.life > 0) { for (int i = 0; (double)i < hit.Damage / (double)NPC.lifeMax * 100.0; i++) - Dust.NewDust(NPC.position, NPC.width, NPC.height, 167, hit.HitDirection, -1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Plantera_Green, hit.HitDirection, -1f); return; } for (int i = 0; i < 150; i++) - Dust.NewDust(NPC.position, NPC.width, NPC.height, 167, 2 * hit.HitDirection, -2f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Plantera_Green, 2 * hit.HitDirection, -2f); if (Main.netMode != NetmodeID.Server) { diff --git a/NPCs/NormalNPCs/ProfanedEnergyBody.cs b/NPCs/NormalNPCs/ProfanedEnergyBody.cs index ab7645b8ed..27ff77c564 100644 --- a/NPCs/NormalNPCs/ProfanedEnergyBody.cs +++ b/NPCs/NormalNPCs/ProfanedEnergyBody.cs @@ -12,7 +12,7 @@ namespace CalamityMod.NPCs.NormalNPCs { public override void SetStaticDefaults() { - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { //Preferably would have two animated lanterns, but this static one-headded wiki image will do for now PortraitPositionYOverride = 0, @@ -45,15 +45,19 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToWater = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.TheHallow, BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.TheUnderworld, - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.ProfanedEnergyBody") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.ProfanedEnergyBody") }); } diff --git a/NPCs/NormalNPCs/ProfanedEnergyLantern.cs b/NPCs/NormalNPCs/ProfanedEnergyLantern.cs index e68b2d29f5..96f0ffcbf5 100644 --- a/NPCs/NormalNPCs/ProfanedEnergyLantern.cs +++ b/NPCs/NormalNPCs/ProfanedEnergyLantern.cs @@ -1,8 +1,9 @@ -using CalamityMod.Dusts; +using System; +using CalamityMod.Dusts; using CalamityMod.Projectiles.Boss; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; +using ReLogic.Content; using Terraria; using Terraria.ID; using Terraria.Localization; @@ -12,11 +13,18 @@ namespace CalamityMod.NPCs.NormalNPCs { public class ProfanedEnergyLantern : ModNPC { + public static Asset ChainTexture; + public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.ProfanedEnergyBody.DisplayName"); + public override void SetStaticDefaults() { this.HideFromBestiary(); Main.npcFrameCount[NPC.type] = 6; + if (!Main.dedServ) + { + ChainTexture = ModContent.Request("CalamityMod/NPCs/NormalNPCs/ProfanedEnergySegment", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -171,7 +179,8 @@ namespace CalamityMod.NPCs.NormalNPCs targetDistance = projSpeed / targetDistance; targetXDist *= targetDistance; targetYDist *= targetDistance; - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center.X, NPC.Center.Y, targetXDist, targetYDist, ModContent.ProjectileType(), 40, 0f, Main.myPlayer, 0f, 0f); + int damage = Main.masterMode ? 25 : Main.expertMode ? 30 : 40; + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center.X, NPC.Center.Y, targetXDist, targetYDist, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); NPC.localAI[1] = 0f; return; } @@ -217,7 +226,7 @@ namespace CalamityMod.NPCs.NormalNPCs drawPositionY = Main.npc[CalamityGlobalNPC.energyFlame].Center.Y - center.Y; drawPositionY -= 10f; Color color = Lighting.GetColor((int)center.X / 16, (int)(center.Y / 16f)); - Texture2D chain = ModContent.Request("CalamityMod/NPCs/NormalNPCs/ProfanedEnergySegment").Value; + Texture2D chain = ChainTexture.Value; Main.spriteBatch.Draw(chain, new Vector2(center.X - screenPos.X, center.Y - screenPos.Y), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, 0, chain.Width, chain.Height)), color, rotation, new Vector2((float)chain.Width * 0.5f, (float)chain.Height * 0.5f), 1f, SpriteEffects.None, 0f); diff --git a/NPCs/NormalNPCs/Rimehound.cs b/NPCs/NormalNPCs/Rimehound.cs index 610fa51baa..62242cd86d 100644 --- a/NPCs/NormalNPCs/Rimehound.cs +++ b/NPCs/NormalNPCs/Rimehound.cs @@ -1,13 +1,15 @@ -using CalamityMod.Items.Placeables.Banners; +using System.IO; using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Banners; +using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; using CalamityMod.World; -using System.IO; using Terraria; using Terraria.Audio; using Terraria.GameContent.Bestiary; using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.NPCs.NormalNPCs { public class Rimehound : ModNPC @@ -20,7 +22,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 9; - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { Scale = 0.7f, PortraitPositionXOverride = 10f, @@ -55,15 +57,19 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = false; NPC.Calamity().VulnerableToSickness = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Snow, BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.UndergroundSnow, - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Rimehound") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Rimehound") }); } @@ -97,10 +103,10 @@ namespace CalamityMod.NPCs.NormalNPCs { NPC.ai[1] += 1f; } - CalamityAI.UnicornAI(NPC, Mod, true, CalamityWorld.death ? 8f : CalamityWorld.revenge ? 6f : 4f, 5f, 0.2f); + CalamityRegularEnemyAI.UnicornAI(NPC, Mod, true, CalamityWorld.death ? 8f : CalamityWorld.revenge ? 6f : 4f, 5f, 0.2f); return; } - CalamityAI.UnicornAI(NPC, Mod, false, CalamityWorld.death ? 8f : CalamityWorld.revenge ? 6f : 4f, 6f, CalamityWorld.death ? 0.1f : CalamityWorld.revenge ? 0.085f : 0.07f); + CalamityRegularEnemyAI.UnicornAI(NPC, Mod, false, CalamityWorld.death ? 8f : CalamityWorld.revenge ? 6f : 4f, 6f, CalamityWorld.death ? 0.1f : CalamityWorld.revenge ? 0.085f : 0.07f); } public override void FindFrame(int frameHeight) diff --git a/NPCs/NormalNPCs/Rotdog.cs b/NPCs/NormalNPCs/Rotdog.cs index 464b705b78..4e800c0d76 100644 --- a/NPCs/NormalNPCs/Rotdog.cs +++ b/NPCs/NormalNPCs/Rotdog.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Accessories; +using System; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Placeables.Banners; using Terraria; using Terraria.GameContent.Bestiary; @@ -23,7 +24,6 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.defense = 4; NPC.lifeMax = 60; NPC.knockBackResist = 0.3f; - AnimationType = NPCID.Hellhound; AIType = NPCID.Wolf; NPC.value = Item.buyPrice(0, 0, 2, 0); NPC.HitSound = SoundID.NPCHit1; @@ -33,33 +33,68 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Times.NightTime, BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Surface, - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Rotdog") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Rotdog") }); } - + public override void FindFrame(int frameHeight) { if (NPC.IsABestiaryIconDummy) { - NPC.frameCounter += 1.0; - if (NPC.frameCounter > 6.0) + NPC.frameCounter++; + if (NPC.frameCounter > 5) { - NPC.frameCounter = 0.0; + NPC.frameCounter = 0; NPC.frame.Y += frameHeight; } - if (NPC.frame.Y > frameHeight * 10) + if (NPC.frame.Y > frameHeight * 7) { NPC.frame.Y = frameHeight; } } + else + { + NPC.spriteDirection = NPC.direction; + if (NPC.velocity.Y < 0f) // jump + { + NPC.frame.Y = frameHeight * 8; + NPC.frameCounter = 0.0; + } + else if (NPC.velocity.Y > 0f) // fall + { + NPC.frame.Y = frameHeight * 9; + NPC.frameCounter = 0.0; + } + else + { + NPC.frameCounter += Math.Abs(NPC.velocity.X) * 0.4f; + if (NPC.frameCounter > 4) + { + NPC.frameCounter = 0; + NPC.frame.Y += frameHeight; + if (NPC.frame.Y < frameHeight) + { + NPC.frame.Y = frameHeight; + } + if (NPC.frame.Y > frameHeight * 7) + { + NPC.frame.Y = frameHeight; + } + } + } + } } public override float SpawnChance(NPCSpawnInfo spawnInfo) @@ -89,6 +124,13 @@ namespace CalamityMod.NPCs.NormalNPCs { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); } + if (Main.netMode != NetmodeID.Server) + { + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Rotdog1").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Rotdog2").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Rotdog3").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Rotdog4").Type, 1f); + } } } diff --git a/NPCs/NormalNPCs/Rotdog.png b/NPCs/NormalNPCs/Rotdog.png index f8f42b55d3..601a6df0da 100644 Binary files a/NPCs/NormalNPCs/Rotdog.png and b/NPCs/NormalNPCs/Rotdog.png differ diff --git a/NPCs/NormalNPCs/ScornEater.cs b/NPCs/NormalNPCs/ScornEater.cs index 830218703a..477c6cd292 100644 --- a/NPCs/NormalNPCs/ScornEater.cs +++ b/NPCs/NormalNPCs/ScornEater.cs @@ -1,28 +1,28 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; using CalamityMod.World; -using System; using Terraria; +using Terraria.Audio; using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.Utilities; -using Terraria.Audio; namespace CalamityMod.NPCs.NormalNPCs { public class ScornEater : ModNPC { public static readonly SoundStyle JumpSound = new("CalamityMod/Sounds/Custom/ScornJump"); - public static readonly SoundStyle HitSound = new("CalamityMod/Sounds/NPCHit/ScornHurt"); + public static readonly SoundStyle HitSound = new("CalamityMod/Sounds/NPCHit/ScornHurt"); public static readonly SoundStyle DeathSound = new("CalamityMod/Sounds/NPCKilled/ScornDeath"); public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 7; - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { Scale = 0.4f, PortraitScale = 0.67f, @@ -42,7 +42,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.defense = 38; NPC.DR_NERD(0.05f); NPC.lifeMax = 9000; - NPC.knockBackResist = 0f; + NPC.knockBackResist = 0.1f; AIType = -1; NPC.lavaImmune = true; NPC.value = Item.buyPrice(0, 0, 50, 0); @@ -53,11 +53,15 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToWater = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.TheHallow, BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.TheUnderworld, @@ -75,37 +79,39 @@ namespace CalamityMod.NPCs.NormalNPCs if (NPC.velocity.Y == 0f) { + NPC.knockBackResist = 0f; + + // Avoid cheap bullshit + NPC.damage = 0; + NPC.ai[2] += 1f; - int decelerationDelay = 20; + + int decelerationDelay = CalamityWorld.death ? 6 : CalamityWorld.revenge ? 12 : 20; if (NPC.ai[1] == 0f) - { - decelerationDelay = 12; - } - if (CalamityWorld.revenge) - { - decelerationDelay /= 2; - } - if (CalamityWorld.death) - { - decelerationDelay /= 2; - } + decelerationDelay = CalamityWorld.death ? 3 : CalamityWorld.revenge ? 6 : 12; + if (NPC.ai[2] < (float)decelerationDelay) { NPC.velocity.X = NPC.velocity.X * 0.9f; return; } + NPC.ai[2] = 0f; if (NPC.direction == 0) - { NPC.direction = -1; - } + NPC.spriteDirection = NPC.direction; + NPC.ai[1] += 1f; NPC.ai[3] += 1f; if (NPC.ai[3] >= 4f) { + // Set damage + NPC.damage = NPC.defDamage; + NPC.ai[3] = 0f; NPC.noTileCollide = true; + if (NPC.ai[1] == 2f) { NPC.velocity.X = (float)NPC.direction * 15f; @@ -126,22 +132,25 @@ namespace CalamityMod.NPCs.NormalNPCs else NPC.velocity.Y = 12f; } + if (!Main.zenithWorld) - SoundEngine.PlaySound(JumpSound, NPC.Center); + SoundEngine.PlaySound(JumpSound, NPC.Center); } + NPC.netUpdate = true; } else { + NPC.knockBackResist = 0.1f; + if (NPC.direction == 1 && NPC.velocity.X < 1f) { - NPC.velocity.X = NPC.velocity.X + 0.1f; + NPC.velocity.X += 0.1f; return; } + if (NPC.direction == -1 && NPC.velocity.X > -1f) - { - NPC.velocity.X = NPC.velocity.X - 0.1f; - } + NPC.velocity.X -= 0.1f; } } diff --git a/NPCs/NormalNPCs/SeaUrchin.cs b/NPCs/NormalNPCs/SeaUrchin.cs index b858743f58..b031da27b0 100644 --- a/NPCs/NormalNPCs/SeaUrchin.cs +++ b/NPCs/NormalNPCs/SeaUrchin.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; using Terraria; using Terraria.GameContent.Bestiary; using Terraria.ID; @@ -30,20 +31,24 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Ocean, - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.SeaUrchin") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.SeaUrchin") }); } public override void AI() { - CalamityAI.UnicornAI(NPC, Mod, true, NPC.wet ? 9f : 4f, NPC.wet ? 5.5f : 2.2f, NPC.wet ? 0.09f : 0.04f, NPC.wet ? -14f : -6.5f, NPC.wet ? -12f : -6f, NPC.wet ? -11f : -5f, NPC.wet ? -10f : -4f, NPC.wet ? -13f : -6f); + CalamityRegularEnemyAI.UnicornAI(NPC, Mod, true, NPC.wet ? 9f : 4f, NPC.wet ? 5.5f : 2.2f, NPC.wet ? 0.09f : 0.04f, NPC.wet ? -14f : -6.5f, NPC.wet ? -12f : -6f, NPC.wet ? -11f : -5f, NPC.wet ? -10f : -4f, NPC.wet ? -13f : -6f); } public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) diff --git a/NPCs/NormalNPCs/ShockstormShuttle.cs b/NPCs/NormalNPCs/ShockstormShuttle.cs index 4de7c16d88..9829d4bc2e 100644 --- a/NPCs/NormalNPCs/ShockstormShuttle.cs +++ b/NPCs/NormalNPCs/ShockstormShuttle.cs @@ -1,10 +1,10 @@ -using CalamityMod.Items.Accessories; +using System; +using CalamityMod.Items.Accessories; +using CalamityMod.Items.Accessories.Vanity; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Placeables.Ores; using Microsoft.Xna.Framework; -using System; -using CalamityMod.Items.Accessories.Vanity; using Terraria; using Terraria.GameContent.Bestiary; using Terraria.ID; @@ -31,7 +31,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.lifeMax = 150; NPC.aiStyle = -1; AIType = -1; - NPC.knockBackResist = 0f; + NPC.knockBackResist = 0.5f; NPC.value = Item.buyPrice(0, 0, 5, 0); NPC.HitSound = SoundID.NPCHit4; NPC.DeathSound = SoundID.NPCDeath14; @@ -41,19 +41,26 @@ namespace CalamityMod.NPCs.NormalNPCs BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToElectricity = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Sky, - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.ShockstormShuttle") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.ShockstormShuttle") }); } public override void AI() { + // Setting this in SetDefaults will disable expert mode scaling, so put it here instead + NPC.damage = 0; + if (NPC.justHit) NPC.localAI[0] = 0f; @@ -75,16 +82,13 @@ namespace CalamityMod.NPCs.NormalNPCs targetDist = projSpeed / targetDist; velocity.X *= targetDist; velocity.Y *= targetDist; - int projDmg = 30; - if (Main.expertMode) - { - projDmg = 22; - } + + // These are already nerfed in Master Mode via global scaling code + int projDmg = Main.expertMode ? 22 : 30; int projType = ProjectileID.MartianTurretBolt; if (Main.rand.NextBool(8)) - { projType = ProjectileID.SaucerLaser; - } + npcPos.X += velocity.X; npcPos.Y += velocity.Y; int spread = Main.getGoodWorld ? 100 : 20; @@ -383,13 +387,13 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 5; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 234, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.BoneTorch, 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, 234, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.BoneTorch, hit.HitDirection, -1f, 0, default, 1f); } if (Main.netMode != NetmodeID.Server) { @@ -408,7 +412,7 @@ namespace CalamityMod.NPCs.NormalNPCs } return SpawnCondition.Sky.Chance * (Main.getGoodWorld ? 0.5f : 0.1f); } - + public override void ModifyNPCLoot(NPCLoot npcLoot) { npcLoot.AddIf(() => NPC.downedGolemBoss, ItemID.MartianConduitPlating, 1, 10, 30); diff --git a/NPCs/NormalNPCs/SkeletronPrime2.cs b/NPCs/NormalNPCs/SkeletronPrime2.cs new file mode 100644 index 0000000000..6164daf879 --- /dev/null +++ b/NPCs/NormalNPCs/SkeletronPrime2.cs @@ -0,0 +1,910 @@ +using System; +using System.IO; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.DataStructures; +using CalamityMod.Events; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.Audio; +using Terraria.GameContent.Bestiary; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.NormalNPCs +{ + public class SkeletronPrime2 : ModNPC + { + public override string BossHeadTexture => $"Terraria/Images/NPC_Head_Boss_18"; + + public static Asset EyeTexture; + + public const int BombTimeLeft = 600; + + public override void SetStaticDefaults() + { + Main.npcFrameCount[NPC.type] = 6; + NPCID.Sets.NPCBestiaryDrawModifiers bestiaryData = new NPCID.Sets.NPCBestiaryDrawModifiers() { Hide = true }; + NPCID.Sets.NPCBestiaryDrawOffset.Add(Type, bestiaryData); + if (!Main.dedServ) + { + EyeTexture = ModContent.Request("CalamityMod/ExtraTextures/SkeletronPrime2HeadGlow"); + } + } + + public override void SetDefaults() + { + NPC.Calamity().canBreakPlayerDefense = true; + NPC.aiStyle = NPCAIStyleID.SkeletronPrimeHead; + NPC.GetNPCDamage(); + NPC.DR_NERD(0.2f); + + NPC.width = 80; + NPC.height = 102; + if (Main.tenthAnniversaryWorld) + NPC.scale *= 0.5f; + if (Main.getGoodWorld) + NPC.scale *= 1.1f; + + NPC.defense = 24; + + NPC.lifeMax = 28000; + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; + NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); + + NPC.knockBackResist = 0f; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.boss = true; + NPC.value = 200000f; + NPC.HitSound = SoundID.NPCHit4; + NPC.DeathSound = SoundID.NPCDeath14; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToSickness = false; + AnimationType = NPCID.SkeletronPrime; + Music = MusicID.Boss3; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(NPC.localAI[0]); + writer.Write(NPC.localAI[1]); + writer.Write(NPC.localAI[2]); + writer.Write(NPC.localAI[3]); + for (int i = 0; i < 4; i++) + writer.Write(NPC.Calamity().newAI[i]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + NPC.localAI[0] = reader.ReadSingle(); + NPC.localAI[1] = reader.ReadSingle(); + NPC.localAI[2] = reader.ReadSingle(); + NPC.localAI[3] = reader.ReadSingle(); + for (int i = 0; i < 4; i++) + NPC.Calamity().newAI[i] = reader.ReadSingle(); + } + + public override void BossHeadRotation(ref float rotation) + { + rotation = (NPC.ai[1] == 1f || NPC.ai[1] == 2f) ? NPC.rotation : 0f; + } + + public override void AI() + { + CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity(); + + bool bossRush = BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || bossRush; + + // Percent life remaining + float lifeRatio = NPC.life / (float)NPC.lifeMax; + + // Spawn arms + if (calamityGlobalNPC.newAI[1] == 0f) + { + calamityGlobalNPC.newAI[1] = 1f; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + // This head owns the Cannon and the Vice in Master Mode + int arm = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, NPCID.PrimeCannon, NPC.whoAmI); + Main.npc[arm].ai[0] = -1f; + Main.npc[arm].ai[1] = NPC.whoAmI; + Main.npc[arm].target = NPC.target; + Main.npc[arm].netUpdate = true; + + arm = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, NPCID.PrimeVice, NPC.whoAmI); + Main.npc[arm].ai[0] = -1f; + Main.npc[arm].ai[1] = NPC.whoAmI; + Main.npc[arm].target = NPC.target; + Main.npc[arm].ai[3] = 150f; + Main.npc[arm].netUpdate = true; + } + + NPC.SyncExtraAI(); + } + + if (!Main.npc[(int)NPC.ai[0]].active || Main.npc[(int)NPC.ai[0]].aiStyle != NPCAIStyleID.SkeletronPrimeHead) + { + NPC.life = 0; + NPC.HitEffect(); + NPC.active = false; + NPC.netUpdate = true; + } + else + { + // Link the HP of both heads + if (NPC.life > Main.npc[(int)NPC.ai[0]].life) + NPC.life = Main.npc[(int)NPC.ai[0]].life; + + // Push away from the lead head if too close, pull closer if too far, if Mechdusa isn't real + if (!NPC.IsMechQueenUp) + { + float pushVelocity = 0.25f; + if (Vector2.Distance(NPC.Center, Main.npc[(int)NPC.ai[0]].Center) < 80f * NPC.scale) + { + if (NPC.position.X < Main.npc[(int)NPC.ai[0]].position.X) + NPC.velocity.X -= pushVelocity; + else + NPC.velocity.X += pushVelocity; + + if (NPC.position.Y < Main.npc[(int)NPC.ai[0]].position.Y) + NPC.velocity.Y -= pushVelocity; + else + NPC.velocity.Y += pushVelocity; + } + else if (Vector2.Distance(NPC.Center, Main.npc[(int)NPC.ai[0]].Center) > 240f * NPC.scale) + { + if (NPC.position.X < Main.npc[(int)NPC.ai[0]].position.X) + NPC.velocity.X += pushVelocity; + else + NPC.velocity.X -= pushVelocity; + + if (NPC.position.Y < Main.npc[(int)NPC.ai[0]].position.Y) + NPC.velocity.Y += pushVelocity; + else + NPC.velocity.Y -= pushVelocity; + } + } + } + + // Check if arms are alive + bool cannonAlive = false; + bool laserAlive = false; + bool viceAlive = false; + bool sawAlive = false; + if (CalamityGlobalNPC.primeCannon != -1) + { + if (Main.npc[CalamityGlobalNPC.primeCannon].active) + cannonAlive = true; + } + if (CalamityGlobalNPC.primeLaser != -1) + { + if (Main.npc[CalamityGlobalNPC.primeLaser].active) + laserAlive = true; + } + if (CalamityGlobalNPC.primeVice != -1) + { + if (Main.npc[CalamityGlobalNPC.primeVice].active) + viceAlive = true; + } + if (CalamityGlobalNPC.primeSaw != -1) + { + if (Main.npc[CalamityGlobalNPC.primeSaw].active) + sawAlive = true; + } + bool allArmsDead = !cannonAlive && !laserAlive && !viceAlive && !sawAlive; + NPC.chaseable = allArmsDead; + + NPC.defense = NPC.defDefense; + + // Phases + bool phase2 = lifeRatio < 0.66f; + bool phase3 = lifeRatio < 0.33f; + bool spawnSpazmatism = lifeRatio < 0.5f && !bossRush && NPC.localAI[2] == 0f; + + // Spawn Spazmatism in Master Mode (just like Oblivion from Avalon) + if (spawnSpazmatism) + { + Player spazmatismSpawnPlayer = Main.player[Player.FindClosest(NPC.position, NPC.width, NPC.height)]; + SoundEngine.PlaySound(SoundID.Roar, spazmatismSpawnPlayer.Center); + if (Main.netMode != NetmodeID.MultiplayerClient) + NPC.SpawnOnPlayer(spazmatismSpawnPlayer.whoAmI, NPCID.Spazmatism); + + NPC.localAI[2] = 1f; + NPC.SyncVanillaLocalAI(); + } + + // Despawn + if (Main.npc[(int)NPC.ai[0]].ai[1] == 3f) + NPC.ai[1] = 3f; + + // Activate daytime enrage + if (Main.IsItDay() && !bossRush && NPC.ai[1] != 3f && NPC.ai[1] != 2f) + { + // Heal + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int healAmt = NPC.life - 300; + if (healAmt < 0) + { + int absHeal = Math.Abs(healAmt); + NPC.life += absHeal; + NPC.HealEffect(absHeal, true); + NPC.netUpdate = true; + } + } + + NPC.ai[1] = 2f; + SoundEngine.PlaySound(SoundID.ForceRoar, NPC.Center); + } + + // Adjust slowing debuff immunity + bool immuneToSlowingDebuffs = NPC.ai[1] == 5f; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[BuffID.Slow] = immuneToSlowingDebuffs; + NPC.buffImmune[BuffID.Webbed] = immuneToSlowingDebuffs; + + bool normalLaserRotation = NPC.localAI[1] % 2f == 0f; + + // Prevents cheap hits + bool canUseAttackInMaster = NPC.position.Y < Main.player[Main.npc[(int)NPC.ai[0]].target].position.Y - 350f; + + // Float near player + if (NPC.ai[1] == 0f || NPC.ai[1] == 4f) + { + // Avoid unfair bullshit + NPC.damage = 0; + + // Start other phases; if arms are dead, start with spin phase + bool otherHeadChargingOrSpinning = Main.npc[(int)NPC.ai[0]].ai[1] == 5f || Main.npc[(int)NPC.ai[0]].ai[1] == 1f; + if (phase2 || CalamityWorld.LegendaryMode || allArmsDead) + { + // Start spin phase after 1.875 seconds + NPC.ai[2] += phase3 ? 1.2f : 0.8f; + if (NPC.ai[2] >= (90f - (death ? 15f * (1f - lifeRatio) : 0f)) && (!otherHeadChargingOrSpinning || phase3) && canUseAttackInMaster) + { + bool shouldSpinAround = NPC.ai[1] == 4f && NPC.position.Y < Main.player[Main.npc[(int)NPC.ai[0]].target].position.Y - 400f && + Vector2.Distance(Main.player[Main.npc[(int)NPC.ai[0]].target].Center, NPC.Center) < 600f && Vector2.Distance(Main.player[Main.npc[(int)NPC.ai[0]].target].Center, NPC.Center) > 400f; + + if (shouldSpinAround || NPC.ai[1] != 4f) + { + if (shouldSpinAround) + { + NPC.localAI[3] = 300f; + NPC.SyncVanillaLocalAI(); + } + + NPC.ai[2] = 0f; + NPC.ai[1] = shouldSpinAround ? 5f : 1f; + NPC.TargetClosest(); + NPC.netUpdate = true; + } + } + } + + if (NPC.IsMechQueenUp) + NPC.rotation = NPC.rotation.AngleLerp(NPC.velocity.X / 15f * 0.5f, 0.75f); + else + NPC.rotation = NPC.velocity.X / 15f; + + float acceleration = (bossRush ? 0.2f : 0.125f) + (death ? 0.05f * (1f - lifeRatio) : 0f); + float accelerationMult = 1f; + if (!cannonAlive) + { + acceleration += 0.025f; + accelerationMult += 0.5f; + } + if (!laserAlive) + { + acceleration += 0.025f; + accelerationMult += 0.5f; + } + if (!viceAlive) + acceleration += 0.025f; + if (!sawAlive) + acceleration += 0.025f; + acceleration *= accelerationMult; + + float topVelocity = acceleration * 100f; + float deceleration = 0.7f; + + float headDecelerationUpDist = 0f; + float headDecelerationDownDist = 0f; + float headDecelerationHorizontalDist = 0f; + int headHorizontalDirection = ((!(Main.player[Main.npc[(int)NPC.ai[0]].target].Center.X < NPC.Center.X)) ? 1 : (-1)); + if (NPC.IsMechQueenUp) + { + headDecelerationHorizontalDist = -150f * (float)headHorizontalDirection; + headDecelerationUpDist = 50f; + headDecelerationDownDist = 50f; + } + + if (NPC.position.Y > Main.player[Main.npc[(int)NPC.ai[0]].target].position.Y - (400f + headDecelerationUpDist)) + { + if (NPC.velocity.Y > 0f) + NPC.velocity.Y *= deceleration; + + NPC.velocity.Y -= acceleration; + + if (NPC.velocity.Y > topVelocity) + NPC.velocity.Y = topVelocity; + } + else if (NPC.position.Y < Main.player[Main.npc[(int)NPC.ai[0]].target].position.Y - (450f + headDecelerationDownDist)) + { + if (NPC.velocity.Y < 0f) + NPC.velocity.Y *= deceleration; + + NPC.velocity.Y += acceleration; + + if (NPC.velocity.Y < -topVelocity) + NPC.velocity.Y = -topVelocity; + } + + if (NPC.Center.X > Main.player[Main.npc[(int)NPC.ai[0]].target].Center.X + (400f + headDecelerationHorizontalDist)) + { + if (NPC.velocity.X > 0f) + NPC.velocity.X *= deceleration; + + NPC.velocity.X -= acceleration; + + if (NPC.velocity.X > topVelocity) + NPC.velocity.X = topVelocity; + } + if (NPC.Center.X < Main.player[Main.npc[(int)NPC.ai[0]].target].Center.X - (400f + headDecelerationHorizontalDist)) + { + if (NPC.velocity.X < 0f) + NPC.velocity.X *= deceleration; + + NPC.velocity.X += acceleration; + + if (NPC.velocity.X < -topVelocity) + NPC.velocity.X = -topVelocity; + } + } + + else + { + // Spinning + if (NPC.ai[1] == 1f) + { + NPC.defense *= 2; + NPC.damage = NPC.defDamage * 2; + + calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = true; + + if (phase2 && Main.netMode != NetmodeID.MultiplayerClient) + { + NPC.localAI[0] += 1f; + if (NPC.localAI[0] >= 60f) + { + NPC.localAI[0] = 0f; + + int totalProjectiles = bossRush ? 20 : death ? 12 : 10; + float radians = MathHelper.TwoPi / totalProjectiles; + int type = ProjectileID.FrostBeam; + int damage = NPC.GetProjectileDamage(type); + + // Reduce mech boss projectile damage depending on the new ore progression changes + if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + { + double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; + double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; + if (!NPC.downedMechBossAny) + damage = (int)(damage * firstMechMultiplier); + else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) + damage = (int)(damage * secondMechMultiplier); + } + + float velocity = 4.5f; + double angleA = radians * 0.5; + double angleB = MathHelper.ToRadians(90f) - angleA; + float velocityX = (float)(velocity * Math.Sin(angleA) / Math.Sin(angleB)); + Vector2 spinningPoint = normalLaserRotation ? new Vector2(0f, -velocity) : new Vector2(-velocityX, -velocity); + for (int k = 0; k < totalProjectiles; k++) + { + Vector2 laserFireDirection = spinningPoint.RotatedBy(radians * k); + int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + laserFireDirection.SafeNormalize(Vector2.UnitY) * 140f, laserFireDirection, type, damage, 0f, Main.myPlayer, 1f, 0f); + Main.projectile[proj].timeLeft = 600; + } + NPC.localAI[1] += 1f; + } + } + + NPC.ai[2] += 1f; + if (NPC.ai[2] == 2f) + SoundEngine.PlaySound(SoundID.ForceRoar, NPC.Center); + + // Spin for 3 seconds then return to floating phase + float phaseTimer = 240f; + if (phase2 && !phase3) + phaseTimer += 60f; + + if (NPC.ai[2] >= (phaseTimer - (death ? 60f * (1f - lifeRatio) : 0f))) + { + NPC.TargetClosest(); + NPC.ai[2] = 0f; + NPC.ai[1] = 4f; + NPC.localAI[0] = 0f; + } + + if (NPC.IsMechQueenUp) + NPC.rotation = NPC.rotation.AngleLerp(NPC.velocity.X / 15f * 0.5f, 0.75f); + else + NPC.rotation += NPC.direction * 0.3f; + + Vector2 headPosition = NPC.Center; + float headTargetX = Main.player[Main.npc[(int)NPC.ai[0]].target].Center.X - headPosition.X; + float headTargetY = Main.player[Main.npc[(int)NPC.ai[0]].target].Center.Y - headPosition.Y; + float headTargetDistance = (float)Math.Sqrt(headTargetX * headTargetX + headTargetY * headTargetY); + + float speed = bossRush ? 12f : 8f; + if (phase2) + speed += 0.5f; + if (phase3) + speed += 0.5f; + + if (headTargetDistance > 150f) + { + float baseDistanceVelocityMult = 1f + MathHelper.Clamp((headTargetDistance - 150f) * 0.0015f, 0.05f, 1.5f); + speed *= baseDistanceVelocityMult; + } + + if (NPC.IsMechQueenUp) + { + float mechdusaSpeedMult = (NPC.npcsFoundForCheckActive[NPCID.TheDestroyerBody] ? 0.6f : 0.75f); + speed *= mechdusaSpeedMult; + } + + headTargetDistance = speed / headTargetDistance; + NPC.velocity.X = headTargetX * headTargetDistance; + NPC.velocity.Y = headTargetY * headTargetDistance; + + if (NPC.IsMechQueenUp) + { + float mechdusaAccelMult = Vector2.Distance(NPC.Center, Main.player[Main.npc[(int)NPC.ai[0]].target].Center); + if (mechdusaAccelMult < 0.1f) + mechdusaAccelMult = 0f; + + if (mechdusaAccelMult < speed) + NPC.velocity = NPC.velocity.SafeNormalize(Vector2.Zero) * mechdusaAccelMult; + } + } + + // Daytime enrage + if (NPC.ai[1] == 2f) + { + NPC.damage = 1000; + calamityGlobalNPC.DR = 0.9999f; + calamityGlobalNPC.unbreakableDR = true; + + calamityGlobalNPC.CurrentlyEnraged = true; + calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = true; + + if (NPC.IsMechQueenUp) + NPC.rotation = NPC.rotation.AngleLerp(NPC.velocity.X / 15f * 0.5f, 0.75f); + else + NPC.rotation += NPC.direction * 0.3f; + + Vector2 enragedHeadPosition = NPC.Center; + float enragedHeadTargetX = Main.player[Main.npc[(int)NPC.ai[0]].target].Center.X - enragedHeadPosition.X; + float enragedHeadTargetY = Main.player[Main.npc[(int)NPC.ai[0]].target].Center.Y - enragedHeadPosition.Y; + float enragedHeadTargetDist = (float)Math.Sqrt(enragedHeadTargetX * enragedHeadTargetX + enragedHeadTargetY * enragedHeadTargetY); + + float enragedHeadSpeed = 10f; + enragedHeadSpeed += enragedHeadTargetDist / 100f; + if (enragedHeadSpeed < 8f) + enragedHeadSpeed = 8f; + if (enragedHeadSpeed > 32f) + enragedHeadSpeed = 32f; + + enragedHeadTargetDist = enragedHeadSpeed / enragedHeadTargetDist; + NPC.velocity.X = enragedHeadTargetX * enragedHeadTargetDist; + NPC.velocity.Y = enragedHeadTargetY * enragedHeadTargetDist; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + NPC.localAI[0] += 1f; + if (NPC.localAI[0] >= 60f) + { + NPC.localAI[0] = 0f; + Vector2 headCenter = NPC.Center; + if (Collision.CanHit(headCenter, 1, 1, Main.player[Main.npc[(int)NPC.ai[0]].target].position, Main.player[Main.npc[(int)NPC.ai[0]].target].width, Main.player[Main.npc[(int)NPC.ai[0]].target].height)) + { + enragedHeadSpeed = 7f; + float enragedHeadSkullTargetX = Main.player[Main.npc[(int)NPC.ai[0]].target].Center.X - headCenter.X + Main.rand.Next(-20, 21); + float enragedHeadSkullTargetY = Main.player[Main.npc[(int)NPC.ai[0]].target].Center.Y - headCenter.Y + Main.rand.Next(-20, 21); + float enragedHeadSkullTargetDist = (float)Math.Sqrt(enragedHeadSkullTargetX * enragedHeadSkullTargetX + enragedHeadSkullTargetY * enragedHeadSkullTargetY); + enragedHeadSkullTargetDist = enragedHeadSpeed / enragedHeadSkullTargetDist; + enragedHeadSkullTargetX *= enragedHeadSkullTargetDist; + enragedHeadSkullTargetY *= enragedHeadSkullTargetDist; + + Vector2 value = new Vector2(enragedHeadSkullTargetX * 1f + Main.rand.Next(-50, 51) * 0.01f, enragedHeadSkullTargetY * 1f + Main.rand.Next(-50, 51) * 0.01f).SafeNormalize(Vector2.UnitY); + value *= enragedHeadSpeed; + value += NPC.velocity; + enragedHeadSkullTargetX = value.X; + enragedHeadSkullTargetY = value.Y; + + int type = ProjectileID.Skull; + headCenter += value * 5f; + int enragedSkulls = Projectile.NewProjectile(NPC.GetSource_FromAI(), headCenter.X, headCenter.Y, enragedHeadSkullTargetX, enragedHeadSkullTargetY, type, 250, 0f, Main.myPlayer, -1f, 0f); + Main.projectile[enragedSkulls].timeLeft = 300; + } + } + } + } + + // Despawning + if (NPC.ai[1] == 3f) + { + // Avoid unfair bullshit + NPC.damage = 0; + + if (NPC.IsMechQueenUp) + { + int mechdusaBossDespawning = NPC.FindFirstNPC(NPCID.Retinazer); + if (mechdusaBossDespawning >= 0) + Main.npc[mechdusaBossDespawning].EncourageDespawn(5); + + mechdusaBossDespawning = NPC.FindFirstNPC(NPCID.Spazmatism); + if (mechdusaBossDespawning >= 0) + Main.npc[mechdusaBossDespawning].EncourageDespawn(5); + + if (!NPC.AnyNPCs(NPCID.Retinazer) && !NPC.AnyNPCs(NPCID.Spazmatism)) + { + mechdusaBossDespawning = NPC.FindFirstNPC(NPCID.TheDestroyer); + if (mechdusaBossDespawning >= 0) + Main.npc[mechdusaBossDespawning].Transform(NPCID.TheDestroyerTail); + + NPC.EncourageDespawn(5); + } + + NPC.velocity.Y += 0.1f; + if (NPC.velocity.Y < 0f) + NPC.velocity.Y *= 0.95f; + + NPC.velocity.X *= 0.95f; + if (NPC.velocity.Y > 13f) + NPC.velocity.Y = 13f; + } + else + { + NPC.velocity.Y += 0.1f; + if (NPC.velocity.Y < 0f) + NPC.velocity.Y *= 0.9f; + + NPC.velocity.X *= 0.9f; + + if (NPC.timeLeft > 500) + NPC.timeLeft = 500; + } + } + + // Fly around in a circle + if (NPC.ai[1] == 5f) + { + // Avoid unfair bullshit + NPC.damage = 0; + + NPC.ai[2] += 1f; + + NPC.rotation = NPC.velocity.X / 50f; + + float bombSpawnDivisor = bossRush ? 14f : death ? 22f - (float)Math.Round(5f * (1f - lifeRatio)) : 22f; + float totalBombs = 6f; + int bombSpread = bossRush ? 250 : death ? 125 : 100; + + // Spin for about 3 seconds + float spinVelocity = 24f; + if (NPC.ai[2] == 2f) + { + // Play angry noise + SoundEngine.PlaySound(SoundID.ForceRoar, NPC.Center); + + // Set spin direction + if (Main.player[Main.npc[(int)NPC.ai[0]].target].velocity.X > 0f) + calamityGlobalNPC.newAI[0] = 1f; + else if (Main.player[Main.npc[(int)NPC.ai[0]].target].velocity.X < 0f) + calamityGlobalNPC.newAI[0] = -1f; + else + calamityGlobalNPC.newAI[0] = Main.player[Main.npc[(int)NPC.ai[0]].target].direction; + + // Set spin velocity + NPC.velocity.X = MathHelper.Pi * NPC.localAI[3] / spinVelocity; + NPC.velocity *= -calamityGlobalNPC.newAI[0]; + NPC.SyncExtraAI(); + NPC.netUpdate = true; + } + + // Maintain velocity and spit homing bombs + else if (NPC.ai[2] > 2f) + { + NPC.velocity = NPC.velocity.RotatedBy(MathHelper.Pi / spinVelocity * -calamityGlobalNPC.newAI[0]); + if (NPC.ai[2] == 3f) + NPC.velocity *= 0.6f; + + if (NPC.ai[2] % bombSpawnDivisor == 0f) + { + NPC.localAI[0] += 1f; + + if (Vector2.Distance(Main.player[Main.npc[(int)NPC.ai[0]].target].Center, NPC.Center) > 64f) + { + SoundEngine.PlaySound(SoundID.Item61, NPC.Center); + CreateParticles(NPC, new Vector2(NPC.Center.X + Main.rand.Next(NPC.width / 2), NPC.Center.Y + 4f)); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Vector2 headCenter = NPC.Center; + float enragedHeadSpeed = 6f + (death ? 2f * (1f - lifeRatio) : 0f); + float enragedHeadBombTargetX = Main.player[Main.npc[(int)NPC.ai[0]].target].Center.X - headCenter.X + Main.rand.Next(-20, 21); + float enragedHeadBombTargetY = Main.player[Main.npc[(int)NPC.ai[0]].target].Center.Y - headCenter.Y + Main.rand.Next(-20, 21); + float enragedHeadBombTargetDist = (float)Math.Sqrt(enragedHeadBombTargetX * enragedHeadBombTargetX + enragedHeadBombTargetY * enragedHeadBombTargetY); + enragedHeadBombTargetDist = enragedHeadSpeed / enragedHeadBombTargetDist; + enragedHeadBombTargetX *= enragedHeadBombTargetDist; + enragedHeadBombTargetY *= enragedHeadBombTargetDist; + + Vector2 value = new Vector2(enragedHeadBombTargetX + Main.rand.Next(-bombSpread, bombSpread + 1) * 0.01f, enragedHeadBombTargetY + Main.rand.Next(-bombSpread, bombSpread + 1) * 0.01f).SafeNormalize(Vector2.UnitY); + value *= enragedHeadSpeed; + enragedHeadBombTargetX = value.X; + enragedHeadBombTargetY = value.Y; + + int type = ProjectileID.BombSkeletronPrime; + int damage = NPC.GetProjectileDamage(type); + + // Reduce mech boss projectile damage depending on the new ore progression changes + if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + { + double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; + double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; + if (!NPC.downedMechBossAny) + damage = (int)(damage * firstMechMultiplier); + else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) + damage = (int)(damage * secondMechMultiplier); + } + + int enragedBombs = Projectile.NewProjectile(NPC.GetSource_FromAI(), headCenter.X, headCenter.Y + 30f, enragedHeadBombTargetX, enragedHeadBombTargetY, type, damage, 0f, Main.myPlayer, -1f); + Main.projectile[enragedBombs].timeLeft = BombTimeLeft; + Main.projectile[enragedBombs].tileCollide = false; + } + } + + // Go to floating phase, or spinning phase if in phase 2 + if (NPC.localAI[0] >= totalBombs) + { + NPC.velocity = NPC.velocity.SafeNormalize(Vector2.UnitY); + + // Fly overhead and spit spreads of bombs into the air if on low health + NPC.ai[1] = phase3 ? 6f : 1f; + NPC.ai[2] = 0f; + NPC.localAI[3] = 0f; + NPC.localAI[0] = 0f; + calamityGlobalNPC.newAI[0] = 0f; + NPC.SyncVanillaLocalAI(); + NPC.SyncExtraAI(); + NPC.TargetClosest(); + NPC.netUpdate = true; + } + } + } + } + + // Fly overhead and spit bombs + if (NPC.ai[1] == 6f) + { + // Avoid unfair bullshit + NPC.damage = 0; + + NPC.rotation = NPC.velocity.X / 15f; + + float flightVelocity = bossRush ? 32f : death ? 28f : 24f; + float flightAcceleration = bossRush ? 1.28f : death ? 1.12f : 0.96f; + + Vector2 destination = new Vector2(Main.player[Main.npc[(int)NPC.ai[0]].target].Center.X, Main.player[Main.npc[(int)NPC.ai[0]].target].Center.Y - 500f); + NPC.SimpleFlyMovement((destination - NPC.Center).SafeNormalize(Vector2.UnitY) * flightVelocity, flightAcceleration); + + // Spit bombs and then go to floating phase + NPC.localAI[3] += 1f; + if (Vector2.Distance(NPC.Center, destination) < 160f || NPC.ai[2] > 0f || NPC.localAI[3] > 120f) + { + float bombSpawnDivisor = death ? 50f : 60f; + float totalBombSpreads = 2f; + NPC.ai[2] += 1f; + if (NPC.ai[2] % bombSpawnDivisor == 0f) + { + NPC.localAI[0] += 1f; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int totalProjectiles = bossRush ? 24 : 12; + float radians = MathHelper.TwoPi / totalProjectiles; + int type = ProjectileID.BombSkeletronPrime; + int damage = NPC.GetProjectileDamage(type); + + // Reduce mech boss projectile damage depending on the new ore progression changes + if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + { + double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; + double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; + if (!NPC.downedMechBossAny) + damage = (int)(damage * firstMechMultiplier); + else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) + damage = (int)(damage * secondMechMultiplier); + } + + float velocity = 12f; + double angleA = radians * 0.5; + double angleB = MathHelper.ToRadians(90f) - angleA; + float velocityX = (float)(velocity * Math.Sin(angleA) / Math.Sin(angleB)); + Vector2 spinningPoint = normalLaserRotation ? new Vector2(0f, -velocity) : new Vector2(-velocityX, -velocity); + Vector2 upwardVelocity = Vector2.UnitY * velocity; + for (int k = 0; k < totalProjectiles; k++) + { + Vector2 bombVelocity = spinningPoint.RotatedBy(radians * k); + int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.UnitY * 30f + bombVelocity.SafeNormalize(Vector2.UnitY) * 15f, bombVelocity - upwardVelocity, type, damage, 0f, Main.myPlayer, -2f); + Main.projectile[proj].timeLeft = BombTimeLeft; + Main.projectile[proj].tileCollide = false; + } + NPC.localAI[1] += 1f; + } + + SoundEngine.PlaySound(SoundID.Item62, NPC.Center); + CreateParticles(NPC, new Vector2(NPC.Center.X, NPC.Center.Y + 4f), 5); + + if (NPC.localAI[0] >= totalBombSpreads) + { + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.localAI[3] = 0f; + calamityGlobalNPC.newAI[0] = 0f; + NPC.localAI[0] = 0f; + NPC.SyncVanillaLocalAI(); + NPC.SyncExtraAI(); + NPC.TargetClosest(); + NPC.netUpdate = true; + } + } + } + } + } + } + + private void CreateParticles(NPC npc, Vector2 position, int amountMultiplier = 1) + { + int firstDustCloudParticleAmount = 30 * amountMultiplier; + int secondDustCloudParticleAmount = 20 * amountMultiplier; + int goreAmount = 2 * amountMultiplier; + + for (int dustIndex = 0; dustIndex < firstDustCloudParticleAmount; dustIndex++) + { + int dust = Dust.NewDust(npc.position, npc.width, npc.height, DustID.Smoke, 0f, 0f, 100, default(Color), 1.5f); + Main.dust[dust].velocity *= 1.4f; + } + + for (int dustIndex = 0; dustIndex < secondDustCloudParticleAmount; dustIndex++) + { + int dust = Dust.NewDust(npc.position, npc.width, npc.height, DustID.Torch, 0f, 0f, 100, default(Color), 3.5f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 7f; + dust = Dust.NewDust(npc.position, npc.width, npc.height, DustID.Torch, 0f, 0f, 100, default(Color), 1.5f); + Main.dust[dust].velocity *= 3f; + } + + for (int goreIndex = 0; goreIndex < goreAmount; goreIndex++) + { + float goreVelocityMultiplier = 0.4f; + if (goreIndex >= goreAmount / 2) + goreVelocityMultiplier = 0.8f; + + int gore = Gore.NewGore(npc.GetSource_FromAI(), npc.Center, default(Vector2), Main.rand.Next(61, 64)); + Main.gore[gore].velocity *= goreVelocityMultiplier; + Main.gore[gore].velocity.X += 1f; + Main.gore[gore].velocity.Y += 1f; + gore = Gore.NewGore(npc.GetSource_FromAI(), npc.Center, default(Vector2), Main.rand.Next(61, 64)); + Main.gore[gore].velocity *= goreVelocityMultiplier; + Main.gore[gore].velocity.X -= 1f; + Main.gore[gore].velocity.Y += 1f; + gore = Gore.NewGore(npc.GetSource_FromAI(), npc.Center, default(Vector2), Main.rand.Next(61, 64)); + Main.gore[gore].velocity *= goreVelocityMultiplier; + Main.gore[gore].velocity.X += 1f; + Main.gore[gore].velocity.Y -= 1f; + gore = Gore.NewGore(npc.GetSource_FromAI(), npc.Center, default(Vector2), Main.rand.Next(61, 64)); + Main.gore[gore].velocity *= goreVelocityMultiplier; + Main.gore[gore].velocity.X -= 1f; + Main.gore[gore].velocity.Y -= 1f; + } + } + + public override void BossLoot(ref string name, ref int potionType) => potionType = ItemID.GreaterHealingPotion; + + public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) + { + NPC.lifeMax = (int)(NPC.lifeMax * 0.75f * balance * bossAdjustment); + NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); + } + + public override bool CheckActive() => false; + + public override bool CheckDead() + { + // Kill the lead head if he's still alive when this head dies + for (int i = 0; i < Main.maxNPCs; i++) + { + NPC nPC = Main.npc[i]; + if (nPC.active && nPC.type == NPCID.SkeletronPrime && nPC.life > 0) + { + nPC.life = 0; + nPC.HitEffect(); + nPC.checkDead(); + nPC.active = false; + nPC.netUpdate = true; + } + } + + return true; + } + + public override void HitEffect(NPC.HitInfo hit) + { + if (NPC.life <= 0) + { + if (Main.netMode != NetmodeID.Server) + { + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, 149); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, 150); + + int num802 = Gore.NewGore(NPC.GetSource_Death(), NPC.position, default(Vector2), Main.rand.Next(61, 64)); + Gore gore2 = Main.gore[num802]; + gore2.velocity *= 0.4f; + Main.gore[num802].velocity.X += 1f; + Main.gore[num802].velocity.Y += 1f; + + num802 = Gore.NewGore(NPC.GetSource_Death(), NPC.position, default(Vector2), Main.rand.Next(61, 64)); + gore2 = Main.gore[num802]; + gore2.velocity *= 0.4f; + Main.gore[num802].velocity.X -= 1f; + Main.gore[num802].velocity.Y += 1f; + + num802 = Gore.NewGore(NPC.GetSource_Death(), NPC.position, default(Vector2), Main.rand.Next(61, 64)); + gore2 = Main.gore[num802]; + gore2.velocity *= 0.4f; + Main.gore[num802].velocity.X += 1f; + Main.gore[num802].velocity.Y -= 1f; + + num802 = Gore.NewGore(NPC.GetSource_Death(), NPC.position, default(Vector2), Main.rand.Next(61, 64)); + gore2 = Main.gore[num802]; + gore2.velocity *= 0.4f; + Main.gore[num802].velocity.X -= 1f; + Main.gore[num802].velocity.Y -= 1f; + } + + for (int num798 = 0; num798 < 10; num798++) + { + int num799 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Smoke, 0f, 0f, 100, default(Color), 1.5f); + Dust dust = Main.dust[num799]; + dust.velocity *= 1.4f; + } + + for (int num800 = 0; num800 < 5; num800++) + { + int num801 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Torch, 0f, 0f, 100, default(Color), 2.5f); + Main.dust[num801].noGravity = true; + Dust dust = Main.dust[num801]; + dust.velocity *= 5f; + num801 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Torch, 0f, 0f, 100, default(Color), 1.5f); + dust = Main.dust[num801]; + dust.velocity *= 3f; + } + } + } + } +} diff --git a/NPCs/NormalNPCs/SkeletronPrime2.png b/NPCs/NormalNPCs/SkeletronPrime2.png new file mode 100644 index 0000000000..c019c31308 Binary files /dev/null and b/NPCs/NormalNPCs/SkeletronPrime2.png differ diff --git a/NPCs/NormalNPCs/Stormlion.cs b/NPCs/NormalNPCs/Stormlion.cs index 6a2fc01125..38ddf7e5c5 100644 --- a/NPCs/NormalNPCs/Stormlion.cs +++ b/NPCs/NormalNPCs/Stormlion.cs @@ -2,6 +2,7 @@ using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Weapons.Summon; using Terraria; +using Terraria.Audio; using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; @@ -10,6 +11,9 @@ namespace CalamityMod.NPCs.NormalNPCs { public class Stormlion : ModNPC { + public static readonly SoundStyle IdleSound = new("CalamityMod/Sounds/Custom/StormlionIdle"); + public static readonly SoundStyle HitSound = new("CalamityMod/Sounds/NPCHit/StormlionHit"); + public static readonly SoundStyle DeathSound = new("CalamityMod/Sounds/NPCKilled/StormlionDeath"); public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 6; @@ -26,25 +30,37 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.knockBackResist = 0.2f; AnimationType = NPCID.WalkingAntlion; NPC.value = Item.buyPrice(0, 0, 2, 0); - NPC.HitSound = SoundID.NPCHit31; - NPC.DeathSound = SoundID.NPCDeath34; + NPC.HitSound = HitSound; + NPC.DeathSound = DeathSound; Banner = NPC.type; BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToElectricity = false; NPC.Calamity().VulnerableToWater = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.UndergroundDesert, new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Stormlion") }); } + public override void AI() + { + if (Main.rand.NextBool(800)) + { + SoundEngine.PlaySound(IdleSound, NPC.Center); + } + } + public override void HitEffect(NPC.HitInfo hit) { for (int k = 0; k < 5; k++) diff --git a/NPCs/NormalNPCs/Sunskater.cs b/NPCs/NormalNPCs/Sunskater.cs index ffba1f6bff..d2a8b38629 100644 --- a/NPCs/NormalNPCs/Sunskater.cs +++ b/NPCs/NormalNPCs/Sunskater.cs @@ -17,7 +17,7 @@ namespace CalamityMod.NPCs.NormalNPCs { public class Sunskater : ModNPC { - public static readonly SoundStyle DeathSound = new("CalamityMod/Sounds/NPCKilled/Sunskater") { Volume = 0.9f}; + public static readonly SoundStyle DeathSound = new("CalamityMod/Sounds/NPCKilled/Sunskater") { Volume = 0.9f }; private bool hasBeenHit = false; @@ -47,14 +47,18 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToWater = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Sky, - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Sunskater") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Sunskater") }); } @@ -224,7 +228,39 @@ namespace CalamityMod.NPCs.NormalNPCs public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) { if (hurtInfo.Damage > 0) - target.AddBuff(ModContent.BuffType(), 80, true); + { + if (Main.zenithWorld) + { + target.AddBuff(ModContent.BuffType(), 150); + + if (Main.rand.NextBool(3)) + target.AddBuff(BuffID.OnFire, 180); + if (Main.rand.NextBool(3)) + target.AddBuff(BuffID.OnFire3, 120); + if (Main.rand.NextBool(3)) + target.AddBuff(BuffID.CursedInferno, 120); + if (Main.rand.NextBool(3)) + target.AddBuff(BuffID.Frostburn, 180); + if (Main.rand.NextBool(3)) + target.AddBuff(BuffID.Frostburn2, 120); + if (Main.rand.NextBool(3)) + target.AddBuff(BuffID.Burning, 60); + if (Main.rand.NextBool(3)) + target.AddBuff(ModContent.BuffType(), 120); + if (Main.rand.NextBool(3)) + target.AddBuff(ModContent.BuffType(), 120); + if (Main.rand.NextBool(3)) + target.AddBuff(ModContent.BuffType(), 120); + if (Main.rand.NextBool(3)) + target.AddBuff(ModContent.BuffType(), 90); + if (Main.rand.NextBool(3)) + target.AddBuff(ModContent.BuffType(), 90); + if (Main.rand.NextBool(3)) + target.AddBuff(ModContent.BuffType(), 90); + } + else + target.AddBuff(BuffID.OnFire, 150, true); + } } public override void ModifyNPCLoot(NPCLoot npcLoot) => npcLoot.AddIf(() => Main.hardMode, ModContent.ItemType(), 2); @@ -233,13 +269,13 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 5; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 64, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.YellowTorch, hit.HitDirection, -1f, 0, default, 1f); } if (NPC.life <= 0) { for (int k = 0; k < 25; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 64, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.YellowTorch, hit.HitDirection, -1f, 0, default, 1f); } if (Main.zenithWorld) { diff --git a/NPCs/NormalNPCs/SuperDummyNPC.cs b/NPCs/NormalNPCs/SuperDummyNPC.cs index 051382127a..d263335bc5 100644 --- a/NPCs/NormalNPCs/SuperDummyNPC.cs +++ b/NPCs/NormalNPCs/SuperDummyNPC.cs @@ -1,4 +1,5 @@ using System.IO; +using CalamityMod.NPCs.VanillaNPCAIOverrides.RegularEnemies; using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; @@ -51,7 +52,7 @@ namespace CalamityMod.NPCs.NormalNPCs if (deathCounter >= 6000) { NPC.damage = NPC.lifeMax; - CalamityGlobalAI.BuffedMimicAI(NPC, Mod); + RevengeanceAndDeathAI.BuffedMimicAI(NPC, Mod); return false; } } @@ -97,7 +98,7 @@ namespace CalamityMod.NPCs.NormalNPCs if ((NPC.justHit || deathCounter > 6000) && NPC.frame.Y > frameHeight * 2) { NPC.frame.Y = frameHeight; - } + } else if (NPC.frame.Y > frameHeight * 3) { NPC.frame.Y = 0; diff --git a/NPCs/NormalNPCs/ThiccWaifu.cs b/NPCs/NormalNPCs/ThiccWaifu.cs index 45454d331d..f0c7452571 100644 --- a/NPCs/NormalNPCs/ThiccWaifu.cs +++ b/NPCs/NormalNPCs/ThiccWaifu.cs @@ -8,8 +8,10 @@ using CalamityMod.Projectiles.Enemy; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; +using Terraria.GameContent; using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; @@ -44,10 +46,13 @@ namespace CalamityMod.NPCs.NormalNPCs } public bool Phase2 => NPC.life < NPC.lifeMax * 0.5f; public ref float AttackTimer => ref NPC.ai[1]; + + public static Asset AttackTexture; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 8; - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { Position = new Vector2(28f, 20f), Scale = 0.65f, @@ -56,6 +61,10 @@ namespace CalamityMod.NPCs.NormalNPCs PortraitPositionYOverride = 2f }; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + AttackTexture = ModContent.Request(Texture + "Attack", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -81,15 +90,19 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.Calamity().VulnerableToElectricity = false; NPC.Calamity().VulnerableToWater = false; NPC.Calamity().VulnerableToHeat = false; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Sky, BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Events.Rain, - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.ThiccWaifu") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.ThiccWaifu") }); } @@ -129,6 +142,9 @@ namespace CalamityMod.NPCs.NormalNPCs public void DoBehavior_Hover() { + // Avoid cheap bullshit + NPC.damage = 0; + float lifeRatio = NPC.life / (float)NPC.lifeMax; int hoverTime = (int)MathHelper.Lerp(330f, 180f, 1f - lifeRatio); float hoverAcceleration = MathHelper.Lerp(0.2f, 0.425f, 1f - lifeRatio); @@ -138,7 +154,7 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int i = 0; i < 2; i++) { - Dust cloudDust = Dust.NewDustDirect(NPC.position, NPC.width, NPC.height, 16); + Dust cloudDust = Dust.NewDustDirect(NPC.position, NPC.width, NPC.height, DustID.Cloud); cloudDust.velocity = Main.rand.NextVector2CircularEdge(4f, 4f); cloudDust.velocity.Y /= 3f; cloudDust.scale = Main.rand.NextFloat(1.15f, 1.35f); @@ -190,6 +206,9 @@ namespace CalamityMod.NPCs.NormalNPCs public void DoBehavior_CloudTeleport() { + // Avoid cheap bullshit + NPC.damage = 0; + int teleportFadeoutTime = 75; int teleportFadeinTime = 60; @@ -202,7 +221,7 @@ namespace CalamityMod.NPCs.NormalNPCs if (Main.rand.NextFloat() < particleSpawnRate && !Main.dedServ) { - Dust.NewDustDirect(NPC.position, NPC.width, NPC.height, 16); + Dust.NewDustDirect(NPC.position, NPC.width, NPC.height, DustID.Cloud); if (Main.rand.NextBool(15) && Main.netMode != NetmodeID.Server) { @@ -229,7 +248,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.Opacity = fadeinCompletion; if (Main.rand.NextFloat() < particleSpawnRate && !Main.dedServ) - Dust.NewDustDirect(NPC.position, NPC.width, NPC.height, 16); + Dust.NewDustDirect(NPC.position, NPC.width, NPC.height, DustID.Cloud); } if (AttackTimer >= teleportFadeoutTime + teleportFadeinTime) @@ -242,10 +261,13 @@ namespace CalamityMod.NPCs.NormalNPCs public void DoBehavior_LightningSummon() { + // Avoid cheap bullshit + NPC.damage = 0; + int cloudSummonDelay = 60; int cloudSummonRate = 30; int totalCloudWavesToSummon = 5; - int lightningDamage = Main.expertMode ? 23 : 36; + int lightningDamage = Main.masterMode ? 19 : Main.expertMode ? 23 : 36; if (Phase2) { cloudSummonRate -= 5; @@ -281,6 +303,9 @@ namespace CalamityMod.NPCs.NormalNPCs public void DoBehavior_TornadoSummon() { + // Avoid cheap bullshit + NPC.damage = 0; + int tornadoSpawnDelay = 60; int totalTornadosToSummon = Phase2 ? 8 : 5; @@ -309,6 +334,9 @@ namespace CalamityMod.NPCs.NormalNPCs public void DoBehavior_NimbusSummon() { + // Avoid cheap bullshit + NPC.damage = 0; + int nimbusSummonDelay = 45; int totalNimbiToSummon = 5; int nimbusSummonRate = 50; @@ -337,7 +365,7 @@ namespace CalamityMod.NPCs.NormalNPCs if (!Main.dedServ) { for (int i = 0; i < 20; i++) - Dust.NewDustDirect(spawnPosition.ToVector2(), -20, 20, 16); + Dust.NewDustDirect(spawnPosition.ToVector2(), -20, 20, DustID.Cloud); SoundEngine.PlaySound(SoundID.Item122, spawnPosition.ToVector2()); } @@ -376,7 +404,9 @@ namespace CalamityMod.NPCs.NormalNPCs if (AttackTimer >= (sliceChargeTime + sliceChargeDelay) * totalSlices) { - NPC.damage = NPC.defDamage; + // Avoid cheap bullshit + NPC.damage = 0; + CurrentAttackState = AttackState.Hover; AttackTimer = 0f; NPC.netUpdate = true; @@ -385,13 +415,13 @@ namespace CalamityMod.NPCs.NormalNPCs public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { - Texture2D texture = ModContent.Request("CalamityMod/NPCs/NormalNPCs/ThiccWaifuAttack").Value; + Texture2D texture = AttackTexture.Value; SpriteEffects direction = NPC.spriteDirection == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; if (CurrentAttackState != AttackState.Hover) Main.EntitySpriteDraw(texture, NPC.Center - screenPos, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, NPC.frame.Size() * 0.5f, NPC.scale, direction, 0); else { - texture = ModContent.Request(Texture).Value; + texture = TextureAssets.Npc[NPC.type].Value; Main.EntitySpriteDraw(texture, NPC.Center - screenPos, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, NPC.frame.Size() * 0.5f, NPC.scale, direction, 0); } if (Main.zenithWorld) @@ -440,12 +470,12 @@ namespace CalamityMod.NPCs.NormalNPCs public override void HitEffect(NPC.HitInfo hit) { for (int k = 0; k < 5; k++) - Dust.NewDust(NPC.position, NPC.width, NPC.height, 16, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Cloud, hit.HitDirection, -1f, 0, default, 1f); if (NPC.life <= 0) { for (int k = 0; k < 50; k++) - Dust.NewDust(NPC.position, NPC.width, NPC.height, 16, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Cloud, hit.HitDirection, -1f, 0, default, 1f); } } diff --git a/NPCs/NormalNPCs/WildBumblefuck.cs b/NPCs/NormalNPCs/WildBumblefuck.cs index 0aff5466d9..8421f495ff 100644 --- a/NPCs/NormalNPCs/WildBumblefuck.cs +++ b/NPCs/NormalNPCs/WildBumblefuck.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Materials; +using CalamityMod.NPCs.CalamityAIs.CalamityBossAIs; using CalamityMod.Projectiles.Boss; using CalamityMod.Sounds; using CalamityMod.World; @@ -20,7 +21,7 @@ namespace CalamityMod.NPCs.NormalNPCs { Main.npcFrameCount[NPC.type] = 5; NPCID.Sets.TrailingMode[NPC.type] = 1; - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { Position = Vector2.UnitX * 36f }; @@ -39,21 +40,24 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.height = 80; NPC.defense = 20; NPC.LifeMaxNERB(9375, 11250, 5000); // Old HP - 12000, 15000 - NPC.knockBackResist = 0f; + NPC.knockBackResist = 0.15f; NPC.lavaImmune = true; NPC.noTileCollide = true; NPC.noGravity = true; - NPC.canGhostHeal = false; NPC.HitSound = SoundID.NPCHit51; NPC.DeathSound = SoundID.NPCDeath46; NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Jungle, new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.WildBumblefuck") @@ -74,7 +78,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void AI() { - CalamityAI.Bumblebirb2AI(NPC, Mod, false); + BumblebirbAI.VanillaBumblebirb2AI(NPC, Mod, false); } public override void ModifyNPCLoot(NPCLoot npcLoot) => npcLoot.Add(ModContent.ItemType(), 1, 5, 7); @@ -152,13 +156,13 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 5; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 244, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.CopperCoin, hit.HitDirection, -1f, 0, default, 1f); } if (NPC.life <= 0) { for (int k = 0; k < 50; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 244, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.CopperCoin, hit.HitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/NormalNPCs/WulfrumAmplifier.cs b/NPCs/NormalNPCs/WulfrumAmplifier.cs index 2e889b8e30..5519d7528c 100644 --- a/NPCs/NormalNPCs/WulfrumAmplifier.cs +++ b/NPCs/NormalNPCs/WulfrumAmplifier.cs @@ -1,16 +1,16 @@ -using CalamityMod.Items.Accessories; +using System.Collections.Generic; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Accessories.Vanity; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Sounds; +using CalamityMod.World; +using Microsoft.Xna.Framework; using Terraria; using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.Utilities; -using Microsoft.Xna.Framework; -using System.Collections.Generic; -using CalamityMod.World; -using CalamityMod.Sounds; namespace CalamityMod.NPCs.NormalNPCs { @@ -33,7 +33,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 6; - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { SpriteDirection = 1 }; @@ -48,7 +48,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.width = 44; NPC.height = 44; NPC.defense = 4; - NPC.lifeMax = Main.zenithWorld ? 72: 46; + NPC.lifeMax = Main.zenithWorld ? 72 : 46; NPC.knockBackResist = 0f; NPC.value = Item.buyPrice(0, 0, 1, 50); NPC.noGravity = false; @@ -61,11 +61,15 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.Calamity().VulnerableToElectricity = true; if (Main.zenithWorld) NPC.scale = 1.5f; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Surface, BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Times.DayTime, @@ -95,7 +99,7 @@ namespace CalamityMod.NPCs.NormalNPCs // Spawn some off-screen enemies to act as threats if the player enters the field. if (Main.netMode != NetmodeID.MultiplayerClient) { - int enemiesToSpawn = CalamityWorld.LegendaryMode ? 4 :CalamityWorld.death ? 3 : CalamityWorld.revenge ? 2 : 1; + int enemiesToSpawn = CalamityWorld.LegendaryMode ? 4 : CalamityWorld.death ? 3 : CalamityWorld.revenge ? 2 : 1; for (int i = 0; i < enemiesToSpawn; i++) { int tries = 0; @@ -119,15 +123,20 @@ namespace CalamityMod.NPCs.NormalNPCs else if (tries < 500 && Main.zenithWorld) { //Summon the army - int npcToSpawn = CalamityWorld.LegendaryMode ? 0 : Main.rand.Next(0,4); - switch (enemiesToSpawn){ - case 0: npcToSpawn = ModContent.NPCType(); + int npcToSpawn = CalamityWorld.LegendaryMode ? 0 : Main.rand.Next(0, 4); + switch (enemiesToSpawn) + { + case 0: + npcToSpawn = ModContent.NPCType(); break; - case 1: npcToSpawn = ModContent.NPCType(); + case 1: + npcToSpawn = ModContent.NPCType(); break; - case 2: npcToSpawn = ModContent.NPCType(); + case 2: + npcToSpawn = ModContent.NPCType(); break; - case 3: npcToSpawn = ModContent.NPCType(); + case 3: + npcToSpawn = ModContent.NPCType(); break; } NPC.NewNPC(NPC.GetSource_FromAI(), (int)spawnPosition.X, (int)spawnPosition.Y, npcToSpawn); @@ -182,7 +191,7 @@ namespace CalamityMod.NPCs.NormalNPCs for (int j = 0; j < 10; j++) { - Dust.NewDust(npcAtIndex.position, npcAtIndex.width, npcAtIndex.height, 226); + Dust.NewDust(npcAtIndex.position, npcAtIndex.width, npcAtIndex.height, DustID.Electric); } } if (CalamityWorld.LegendaryMode) diff --git a/NPCs/NormalNPCs/WulfrumDrone.cs b/NPCs/NormalNPCs/WulfrumDrone.cs index 353f1b91ed..8131fe0a1e 100644 --- a/NPCs/NormalNPCs/WulfrumDrone.cs +++ b/NPCs/NormalNPCs/WulfrumDrone.cs @@ -1,18 +1,18 @@ -using CalamityMod.Items.Accessories; +using System; +using System.IO; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Sounds; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Mono.Cecil; using Terraria; +using Terraria.Audio; using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.Utilities; -using Microsoft.Xna.Framework; -using System.IO; -using CalamityMod.Sounds; -using System; -using CalamityMod.World; -using Mono.Cecil; -using Terraria.Audio; namespace CalamityMod.NPCs.NormalNPCs { @@ -55,7 +55,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 6; - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { SpriteDirection = 1 }; @@ -81,11 +81,15 @@ namespace CalamityMod.NPCs.NormalNPCs BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToElectricity = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Surface, BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Times.DayTime, @@ -104,16 +108,16 @@ namespace CalamityMod.NPCs.NormalNPCs Player player = Main.player[NPC.target]; bool farFromPlayer = NPC.Distance(player.Center) > 960f; - bool obstanceInFrontOfPlayer = Main.remixWorld ? false : !Collision.CanHitLine(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height); + bool obstacleInFrontOfPlayer = Main.remixWorld ? false : !Collision.CanHitLine(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height); - if (NPC.target < 0 || NPC.target >= 255 || farFromPlayer || obstanceInFrontOfPlayer || player.dead || !player.active) + if (NPC.target < 0 || NPC.target >= Main.maxPlayers || farFromPlayer || obstacleInFrontOfPlayer || player.dead || !player.active) { NPC.TargetClosest(false); player = Main.player[NPC.target]; farFromPlayer = NPC.Distance(player.Center) > 960f; - obstanceInFrontOfPlayer = !Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height); + obstacleInFrontOfPlayer = !Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height); // Fly away if there is no living target, or the closest target is too far away. - if (player.dead || !player.active || farFromPlayer || obstanceInFrontOfPlayer) + if (player.dead || !player.active || farFromPlayer || obstacleInFrontOfPlayer) { if (FlyAwayTimer > 420) { @@ -142,16 +146,21 @@ namespace CalamityMod.NPCs.NormalNPCs if (AIState == DroneAIState.Searching) { + // Avoid cheap bullshit + NPC.damage = 0; + if (NPC.direction == 0) NPC.direction = 1; + float searchVelocity = CalamityWorld.death ? 10f : CalamityWorld.revenge ? 9f : Main.expertMode ? 8f : 6f; Vector2 destination = player.Center + new Vector2(300f * NPC.direction, -90f); - NPC.velocity = Vector2.Lerp(NPC.velocity, NPC.SafeDirectionTo(destination) * 6f, 0.1f); + NPC.velocity = Vector2.Lerp(NPC.velocity, NPC.SafeDirectionTo(destination) * searchVelocity, searchVelocity / 60f); if (NPC.Distance(destination) < 40f) { Time++; NPC.velocity *= 0.95f; - if (Time >= 40f) + float chargeDelay = CalamityWorld.death ? 10f : CalamityWorld.revenge ? 15f : Main.expertMode ? 20f : 40f; + if (Time >= chargeDelay) { AIState = DroneAIState.Charging; NPC.netUpdate = true; @@ -160,11 +169,16 @@ namespace CalamityMod.NPCs.NormalNPCs } else { + // Set damage + NPC.damage = NPC.defDamage; + + float chargeVelocity = CalamityWorld.death ? 10f : CalamityWorld.revenge ? 9f : Main.expertMode ? 8f : 6f; if (HorizontalChargeTime < 25) - NPC.velocity = Vector2.Lerp(NPC.velocity, NPC.SafeDirectionTo(player.Center) * 6f, 0.1f); + NPC.velocity = Vector2.Lerp(NPC.velocity, NPC.SafeDirectionTo(player.Center) * chargeVelocity, chargeVelocity / 60f); if (Supercharged && Main.netMode != NetmodeID.MultiplayerClient && HorizontalChargeTime % 30f == 29f) { + int damage = Main.masterMode ? 8 : Main.expertMode ? 9 : 12; if (Main.zenithWorld) { int spread = 15; @@ -172,17 +186,19 @@ namespace CalamityMod.NPCs.NormalNPCs { Vector2 velocity = NPC.SafeDirectionTo(player.Center, Vector2.UnitY) * 6f; Vector2 perturbedspeed = new Vector2(velocity.X + Main.rand.Next(-2, 3), velocity.Y + Main.rand.Next(-2, 3)).RotatedBy(MathHelper.ToRadians(spread)); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.UnitX * 6f * NPC.spriteDirection, perturbedspeed, ProjectileID.SaucerLaser, 12, 0f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.UnitX * 6f * NPC.spriteDirection, perturbedspeed, ProjectileID.SaucerLaser, damage, 0f); spread -= Main.rand.Next(5, 8); } } else - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.UnitX * 6f * NPC.spriteDirection, NPC.SafeDirectionTo(player.Center, Vector2.UnitY) * 6f, ProjectileID.SaucerLaser, 12, 0f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.UnitX * 6f * NPC.spriteDirection, NPC.SafeDirectionTo(player.Center, Vector2.UnitY) * 6f, ProjectileID.SaucerLaser, damage, 0f); + SoundEngine.PlaySound(SoundID.Item12); } + float totalChargeTime = TotalHorizontalChargeTime - (CalamityWorld.death ? 25f : CalamityWorld.revenge ? 20f : Main.expertMode ? 15f : 0f); HorizontalChargeTime++; - if (HorizontalChargeTime > TotalHorizontalChargeTime) + if (HorizontalChargeTime > totalChargeTime) { AIState = DroneAIState.Searching; HorizontalChargeTime = 0f; diff --git a/NPCs/NormalNPCs/WulfrumGyrator.cs b/NPCs/NormalNPCs/WulfrumGyrator.cs index a3a1e373a8..adb4b9b685 100644 --- a/NPCs/NormalNPCs/WulfrumGyrator.cs +++ b/NPCs/NormalNPCs/WulfrumGyrator.cs @@ -40,7 +40,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 10; - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { SpriteDirection = 1 }; @@ -64,11 +64,15 @@ namespace CalamityMod.NPCs.NormalNPCs BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToElectricity = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Surface, BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Times.DayTime, @@ -208,13 +212,13 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 5; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 3, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.GrassBlades, 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, 3, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.GrassBlades, hit.HitDirection, -1f, 0, default, 1f); } if (!Main.dedServ) diff --git a/NPCs/NormalNPCs/WulfrumHovercraft.cs b/NPCs/NormalNPCs/WulfrumHovercraft.cs index c50a1a64cb..38fdb46dda 100644 --- a/NPCs/NormalNPCs/WulfrumHovercraft.cs +++ b/NPCs/NormalNPCs/WulfrumHovercraft.cs @@ -1,19 +1,19 @@ -using CalamityMod.Items.Accessories; +using System; +using System.IO; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Projectiles.Pets; +using CalamityMod.Projectiles.Rogue; +using CalamityMod.Sounds; +using CalamityMod.World; using Microsoft.Xna.Framework; -using System; -using System.IO; using Terraria; +using Terraria.Audio; using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.Utilities; -using CalamityMod.Sounds; -using Terraria.Audio; -using CalamityMod.World; -using CalamityMod.Projectiles.Rogue; -using CalamityMod.Projectiles.Pets; namespace CalamityMod.NPCs.NormalNPCs { @@ -63,7 +63,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 12; - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { SpriteDirection = 1 }; @@ -88,11 +88,15 @@ namespace CalamityMod.NPCs.NormalNPCs BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToElectricity = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Surface, BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Times.DayTime, @@ -128,16 +132,16 @@ namespace CalamityMod.NPCs.NormalNPCs Player player = Main.player[NPC.target]; bool farFromPlayer = NPC.Distance(player.Center) > 960f; - bool obstanceInFrontOfPlayer = Main.remixWorld ? false : !Collision.CanHitLine(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height); + bool obstacleInFrontOfPlayer = Main.remixWorld ? false : !Collision.CanHitLine(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height); - if (NPC.target < 0 || NPC.target >= 255 || farFromPlayer || obstanceInFrontOfPlayer || player.dead || !player.active) + if (NPC.target < 0 || NPC.target >= 255 || farFromPlayer || obstacleInFrontOfPlayer || player.dead || !player.active) { NPC.TargetClosest(false); player = Main.player[NPC.target]; farFromPlayer = NPC.Distance(player.Center) > 960f; - obstanceInFrontOfPlayer = !Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height); + obstacleInFrontOfPlayer = !Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height); // Fly away if there is no living target, or the closest target is too far away... unless its Gfb - if (player.dead || !player.active || farFromPlayer || obstanceInFrontOfPlayer) + if (player.dead || !player.active || farFromPlayer || obstacleInFrontOfPlayer) { if (FlyAwayTimer > 420) { @@ -145,7 +149,7 @@ namespace CalamityMod.NPCs.NormalNPCs if (Main.zenithWorld && player.active && !farFromPlayer) { AIState = HovercraftAIState.SwoopDownward; - SoundEngine.PlaySound(SoundID.DD2_KoboldFlyerHurt with { Pitch = SoundID.DD2_KoboldFlyerHurt.Pitch + 0.5f }, NPC.Center); + SoundEngine.PlaySound(SoundID.DD2_KoboldFlyerHurt with { Pitch = SoundID.DD2_KoboldFlyerHurt.Pitch + 0.5f }, NPC.Center); return; } NPC.velocity = Vector2.Lerp(NPC.velocity, Vector2.UnitY * -8f, 0.1f); @@ -170,6 +174,9 @@ namespace CalamityMod.NPCs.NormalNPCs if (StunTime > 0) { + // Avoid cheap bullshit + NPC.damage = 0; + if (!Main.dedServ && Main.rand.NextBool(4)) { for (int i = 0; i < 2; i++) @@ -200,6 +207,9 @@ namespace CalamityMod.NPCs.NormalNPCs if (AIState == HovercraftAIState.Searching || AIState == HovercraftAIState.Hover) { + // Avoid cheap bullshit + NPC.damage = 0; + Vector2 destination = player.Center + new Vector2(SearchXOffset * SearchDirection, -160f); NPC.velocity = NPC.SafeDirectionTo(destination, Vector2.UnitY) * (Supercharged ? 7f : 5f); if (AIState == HovercraftAIState.Hover) @@ -225,6 +235,9 @@ namespace CalamityMod.NPCs.NormalNPCs if (AIState == HovercraftAIState.Slowdown) { + // Avoid cheap bullshit + NPC.damage = 0; + SubphaseTime++; if (SubphaseTime < 30f) { @@ -240,6 +253,9 @@ namespace CalamityMod.NPCs.NormalNPCs if (AIState == HovercraftAIState.SwoopDownward) { + // Set damage + NPC.damage = NPC.defDamage; + NPC.rotation = 0f; float swoopType = Supercharged ? TotalSubphaseTime - 40f : TotalSubphaseTime; float swoopSlowdownTime = Supercharged ? 10f : 45f; @@ -286,13 +302,13 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 5; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 3, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.GrassBlades, 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, 3, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.GrassBlades, hit.HitDirection, -1f, 0, default, 1f); } if (!Main.dedServ) diff --git a/NPCs/NormalNPCs/WulfrumRover.cs b/NPCs/NormalNPCs/WulfrumRover.cs index a51327d1ff..bbaee7f27e 100644 --- a/NPCs/NormalNPCs/WulfrumRover.cs +++ b/NPCs/NormalNPCs/WulfrumRover.cs @@ -1,17 +1,17 @@ -using CalamityMod.Items.Accessories; +using System; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Sounds; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.GameContent.Bestiary; +using Terraria.Graphics.Effects; using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.Utilities; -using CalamityMod.Sounds; -using Terraria.Graphics.Effects; -using CalamityMod.World; namespace CalamityMod.NPCs.NormalNPCs { @@ -42,7 +42,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 16; - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { SpriteDirection = 1 }; @@ -68,11 +68,15 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.Calamity().VulnerableToElectricity = true; if (Main.zenithWorld) NPC.scale = 2f; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Surface, BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Times.DayTime, @@ -153,13 +157,13 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 4; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 3, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.GrassBlades, 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, 3, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.GrassBlades, hit.HitDirection, -1f, 0, default, 1f); } if (!Main.dedServ) @@ -176,7 +180,7 @@ namespace CalamityMod.NPCs.NormalNPCs } if (Main.zenithWorld && mineDelay == 0) { - Vector2 roverBase = new Vector2(NPC.Center.X,NPC.Center.Y+5f); + Vector2 roverBase = new Vector2(NPC.Center.X, NPC.Center.Y + 5f); int mine = Projectile.NewProjectile(NPC.GetSource_FromAI(), roverBase, Vector2.Zero, ProjectileID.ProximityMineI, 50, 0f); if (mine.WithinBounds(Main.maxProjectiles)) { diff --git a/NPCs/OldDuke/OldDuke.cs b/NPCs/OldDuke/OldDuke.cs index 03101af13f..fc8ac6e7b3 100644 --- a/NPCs/OldDuke/OldDuke.cs +++ b/NPCs/OldDuke/OldDuke.cs @@ -1,5 +1,9 @@ -using CalamityMod.BiomeManagers; +using System; +using System.IO; +using CalamityMod.BiomeManagers; using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Dusts; +using CalamityMod.Events; using CalamityMod.Items.Accessories; using CalamityMod.Items.Armor.Vanity; using CalamityMod.Items.LoreItems; @@ -13,22 +17,20 @@ using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Items.Weapons.Summon; +using CalamityMod.NPCs.CalamityAIs.CalamityBossAIs; using CalamityMod.NPCs.TownNPCs; using CalamityMod.World; -using System; -using System.IO; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using ReLogic.Utilities; using Terraria; +using Terraria.Audio; using Terraria.GameContent; using Terraria.GameContent.Bestiary; +using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Dusts; -using Terraria.GameContent.ItemDropRules; -using CalamityMod.Events; -using Terraria.Audio; -using ReLogic.Utilities; namespace CalamityMod.NPCs.OldDuke { @@ -39,20 +41,26 @@ namespace CalamityMod.NPCs.OldDuke public static readonly SoundStyle RoarSound = new("CalamityMod/Sounds/Custom/OldDukeRoar"); public static readonly SoundStyle VomitSound = new("CalamityMod/Sounds/Custom/OldDukeVomit"); - public SlotId RoarSoundSlot; + public SlotId RoarSoundSlot; + + public static Asset GlowTexture; public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 7; NPCID.Sets.TrailingMode[NPC.type] = 1; NPCID.Sets.BossBestiaryPriority.Add(Type); - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { SpriteDirection = 1, Scale = 0.45f }; value.Position.X += 14f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -86,7 +94,7 @@ namespace CalamityMod.NPCs.OldDuke public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.OldDuke") }); @@ -114,21 +122,19 @@ namespace CalamityMod.NPCs.OldDuke public override void AI() { - CalamityAI.OldDukeAI(NPC, Mod); + OldDukeAI.VanillaOldDukeAI(NPC, Mod); } public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { - NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } public override void ModifyTypeName(ref string typeName) { if (Main.zenithWorld) - { typeName = CalamityUtils.GetTextValue("NPCs.BoomerDuke"); - } } public override void FindFrame(int frameHeight) @@ -138,9 +144,8 @@ namespace CalamityMod.NPCs.OldDuke { int frameChangeFrequency = tired ? 14 : 7; if (NPC.ai[0] == 5f || NPC.ai[0] == 12f) - { frameChangeFrequency = tired ? 12 : 6; - } + NPC.frameCounter += 1D; if (NPC.frameCounter > frameChangeFrequency) { @@ -148,18 +153,15 @@ namespace CalamityMod.NPCs.OldDuke NPC.frame.Y += frameHeight; } if (NPC.frame.Y >= frameHeight * 6) - { NPC.frame.Y = 0; - } } + if (NPC.ai[0] == 1f || NPC.ai[0] == 6f || NPC.ai[0] == 11f) - { NPC.frame.Y = frameHeight * 2; - } + if (NPC.ai[0] == 2f || NPC.ai[0] == 7f || NPC.ai[0] == 14f) - { NPC.frame.Y = frameHeight * 6; - } + if (NPC.ai[0] == 3f || NPC.ai[0] == 8f || NPC.ai[0] == 13f || NPC.ai[0] == -1f) { int frameChangeGateValue = 120; @@ -172,19 +174,16 @@ namespace CalamityMod.NPCs.OldDuke NPC.frame.Y += frameHeight; } if (NPC.frame.Y >= frameHeight * 6) - { NPC.frame.Y = 0; - } } else { NPC.frame.Y = frameHeight * 5; if (NPC.ai[2] > (frameChangeGateValue - 40) && NPC.ai[2] < (frameChangeGateValue - 15)) - { NPC.frame.Y = frameHeight * 6; - } } } + if (NPC.ai[0] == 4f || NPC.ai[0] == 9f) { int secondFrameChangeGateValue = 180; @@ -197,17 +196,13 @@ namespace CalamityMod.NPCs.OldDuke NPC.frame.Y += frameHeight; } if (NPC.frame.Y >= frameHeight * 6) - { NPC.frame.Y = 0; - } } else { NPC.frame.Y = frameHeight * 5; if (NPC.ai[2] > (secondFrameChangeGateValue - 50) && NPC.ai[2] < (secondFrameChangeGateValue - 25)) - { NPC.frame.Y = frameHeight * 6; - } } } } @@ -339,7 +334,7 @@ namespace CalamityMod.NPCs.OldDuke if (NPC.ai[0] >= 4f && NPC.Calamity().newAI[1] != 1f) { - texture2D15 = ModContent.Request("CalamityMod/NPCs/OldDuke/OldDukeGlow").Value; + texture2D15 = GlowTexture.Value; Color yellowLerpColor = Color.Lerp(Color.White, Color.Yellow, 0.5f); drawLerpColor = Color.Yellow; @@ -487,7 +482,7 @@ namespace CalamityMod.NPCs.OldDuke int onHitDust = 0; while (onHitDust < hit.Damage / NPC.lifeMax * 100.0) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulphurousSeaAcid, hit.HitDirection, -1f, 0, default, 1f); onHitDust++; } } @@ -495,7 +490,7 @@ namespace CalamityMod.NPCs.OldDuke { for (int r = 0; r < 150; r++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, 2 * hit.HitDirection, -2f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulphurousSeaAcid, 2 * hit.HitDirection, -2f, 0, default, 1f); } if (Main.netMode != NetmodeID.Server) diff --git a/NPCs/OldDuke/OldDukeToothBall.cs b/NPCs/OldDuke/OldDukeToothBall.cs index 88cd360c59..bf297747ac 100644 --- a/NPCs/OldDuke/OldDukeToothBall.cs +++ b/NPCs/OldDuke/OldDukeToothBall.cs @@ -1,13 +1,13 @@ -using CalamityMod.Buffs.StatDebuffs; +using System; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Dusts; +using CalamityMod.Events; using CalamityMod.Projectiles.Boss; using CalamityMod.World; -using System; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Dusts; -using CalamityMod.Events; namespace CalamityMod.NPCs.OldDuke { @@ -34,7 +34,7 @@ namespace CalamityMod.NPCs.OldDuke } double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); - NPC.knockBackResist = 0f; + NPC.knockBackResist = 0.2f; NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath11; NPC.chaseable = false; @@ -44,6 +44,10 @@ namespace CalamityMod.NPCs.OldDuke NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void AI() @@ -230,12 +234,12 @@ namespace CalamityMod.NPCs.OldDuke public override void HitEffect(NPC.HitInfo hit) { for (int k = 0; k < 3; k++) - Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulphurousSeaAcid, hit.HitDirection, -1f, 0, default, 1f); if (NPC.life <= 0) { for (int k = 0; k < 15; k++) - Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulphurousSeaAcid, hit.HitDirection, -1f, 0, default, 1f); NPC.position.X = NPC.position.X + NPC.width / 2; NPC.position.Y = NPC.position.Y + NPC.height / 2; @@ -245,7 +249,7 @@ namespace CalamityMod.NPCs.OldDuke for (int i = 0; i < 15; i++) { - int bloody = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Blood, 0f, 0f, 100, default, 2f); + int bloody = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, 0f, 0f, 100, default, 2f); Main.dust[bloody].velocity *= 3f; if (Main.rand.NextBool()) { @@ -257,10 +261,10 @@ namespace CalamityMod.NPCs.OldDuke for (int j = 0; j < 30; j++) { - int toxicDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default, 3f); + int toxicDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulphurousSeaAcid, 0f, 0f, 100, default, 3f); Main.dust[toxicDust].noGravity = true; Main.dust[toxicDust].velocity *= 5f; - toxicDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default, 2f); + toxicDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulphurousSeaAcid, 0f, 0f, 100, default, 2f); Main.dust[toxicDust].velocity *= 2f; Main.dust[toxicDust].noGravity = true; } diff --git a/NPCs/OldDuke/SulphurousSharkron.cs b/NPCs/OldDuke/SulphurousSharkron.cs index d75a67bd55..e0d2298c82 100644 --- a/NPCs/OldDuke/SulphurousSharkron.cs +++ b/NPCs/OldDuke/SulphurousSharkron.cs @@ -1,19 +1,19 @@ -using CalamityMod.BiomeManagers; -using CalamityMod.Buffs.StatDebuffs; -using System; +using System; using System.IO; +using CalamityMod.BiomeManagers; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Dusts; +using CalamityMod.Events; +using CalamityMod.Projectiles.Boss; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.GameContent; using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Dusts; -using CalamityMod.Projectiles.Boss; -using CalamityMod.Events; -using CalamityMod.World; -using Terraria.Audio; namespace CalamityMod.NPCs.OldDuke { @@ -54,6 +54,10 @@ namespace CalamityMod.NPCs.OldDuke NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SendExtraAI(BinaryWriter writer) @@ -282,12 +286,12 @@ namespace CalamityMod.NPCs.OldDuke public override void HitEffect(NPC.HitInfo hit) { for (int k = 0; k < 5; k++) - Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulphurousSeaAcid, 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, (int)CalamityDusts.SulfurousSeaAcid, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulphurousSeaAcid, hit.HitDirection, -1f, 0, default, 1f); SoundEngine.PlaySound(SoundID.NPCDeath12, NPC.Center); @@ -299,7 +303,7 @@ namespace CalamityMod.NPCs.OldDuke for (int i = 0; i < 15; i++) { - int toxicDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default, 2f); + int toxicDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulphurousSeaAcid, 0f, 0f, 100, default, 2f); Main.dust[toxicDust].velocity.Y *= 6f; Main.dust[toxicDust].velocity.X *= 3f; if (Main.rand.NextBool()) @@ -311,10 +315,10 @@ namespace CalamityMod.NPCs.OldDuke for (int j = 0; j < 30; j++) { - int bloody = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Blood, 0f, 0f, 100, default, 3f); + int bloody = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, 0f, 0f, 100, default, 3f); Main.dust[bloody].noGravity = true; Main.dust[bloody].velocity.Y *= 10f; - bloody = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Blood, 0f, 0f, 100, default, 2f); + bloody = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, 0f, 0f, 100, default, 2f); Main.dust[bloody].velocity.X *= 2f; } diff --git a/NPCs/Other/CalamitasEnchantDemon.cs b/NPCs/Other/CalamitasEnchantDemon.cs index c650bc4d80..1096142fb6 100644 --- a/NPCs/Other/CalamitasEnchantDemon.cs +++ b/NPCs/Other/CalamitasEnchantDemon.cs @@ -86,7 +86,7 @@ namespace CalamityMod.NPCs.Other // Create some fade dust. for (int i = 0; i < 3; i++) { - Dust magic = Dust.NewDustDirect(NPC.position, NPC.width, NPC.height, 223); + Dust magic = Dust.NewDustDirect(NPC.position, NPC.width, NPC.height, DustID.FireworkFountain_Pink); magic.velocity = -Vector2.UnitY * Main.rand.NextFloat(2.8f, 3.5f); magic.scale = Main.rand.NextFloat(1f, 1.125f); magic.fadeIn = 0.4f; @@ -102,7 +102,7 @@ namespace CalamityMod.NPCs.Other { for (int i = 0; i < 50; i++) { - Dust magic = Dust.NewDustDirect(NPC.position, NPC.width, NPC.height, 223); + Dust magic = Dust.NewDustDirect(NPC.position, NPC.width, NPC.height, DustID.FireworkFountain_Pink); magic.velocity = -Vector2.UnitY * Main.rand.NextFloat(2.8f, 3.5f); magic.scale = Main.rand.NextFloat(1f, 1.125f); magic.fadeIn = 0.7f; diff --git a/NPCs/Other/DemonPortal.cs b/NPCs/Other/DemonPortal.cs index 7e64b7d563..99a6c00f2c 100644 --- a/NPCs/Other/DemonPortal.cs +++ b/NPCs/Other/DemonPortal.cs @@ -2,10 +2,10 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.NPCs.Other { diff --git a/NPCs/Other/THELORDE.cs b/NPCs/Other/THELORDE.cs index 73744b4cd2..bc6876021a 100644 --- a/NPCs/Other/THELORDE.cs +++ b/NPCs/Other/THELORDE.cs @@ -1,18 +1,20 @@ using System; +using System.IO; +using CalamityMod.Balancing; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Items.Pets; +using CalamityMod.Items.Potions; +using CalamityMod.Projectiles.Boss; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.DataStructures; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; -using System.IO; -using CalamityMod.Buffs.StatDebuffs; -using CalamityMod.Items.Potions; -using CalamityMod.Items.Pets; -using CalamityMod.Projectiles.Boss; -using CalamityMod.World; -using CalamityMod.Balancing; namespace CalamityMod.NPCs.Other { @@ -37,6 +39,8 @@ namespace CalamityMod.NPCs.Other public static readonly SoundStyle DeathSound = new("CalamityMod/Sounds/NPCKilled/Lordeath"); + public static Asset DeathAnimationTexture; + public override void SetStaticDefaults() { NPCID.Sets.MPAllowedEnemies[Type] = true; @@ -44,6 +48,10 @@ namespace CalamityMod.NPCs.Other NPCID.Sets.ShouldBeCountedAsBoss[Type] = true; this.HideFromBestiary(); Main.npcFrameCount[NPC.type] = 7; + if (!Main.dedServ) + { + DeathAnimationTexture = ModContent.Request(Texture + "DEATH", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -161,7 +169,7 @@ namespace CalamityMod.NPCs.Other { // old was zombie 1 - zombie 62 // ideally would be collaborative inferal screeches of various devs - SoundEngine.PlaySound(Polterghast.Polterghast.creepySounds[Main.rand.Next(1, Polterghast.Polterghast.creepySounds.Count)] with { PitchVariance = 2}, NPC.position); + SoundEngine.PlaySound(Polterghast.Polterghast.creepySounds[Main.rand.Next(1, Polterghast.Polterghast.creepySounds.Count)] with { PitchVariance = 2 }, NPC.Center); } Player playerLOL = Main.player[NPC.target]; playerLOL.velocity.X *= 0.99f; @@ -412,7 +420,7 @@ namespace CalamityMod.NPCs.Other SpriteEffects spriteEffects = SpriteEffects.None; if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = TextureAssets.Npc[NPC.type].Value; Rectangle frameUsed = texture.Frame(2, 7, 0, 1); // the idle frame by default Rectangle squintFrame = texture.Frame(2, 7, 0, 0); @@ -425,7 +433,7 @@ namespace CalamityMod.NPCs.Other if (Dying) { // death animation - texture = ModContent.Request("CalamityMod/NPCs/Other/THELORDEDEATH").Value; + texture = DeathAnimationTexture.Value; int xFrame = 0; int yFrame = frameToUse; if (frameToUse > 13) @@ -574,7 +582,7 @@ namespace CalamityMod.NPCs.Other public override void ModifyNPCLoot(NPCLoot npcLoot) { double pisquaredover6 = Math.Pow(MathHelper.Pi, 2) / 6; - npcLoot.AddIf(()=> CalamityWorld.LegendaryMode && CalamityWorld.revenge, ModContent.ItemType()); // guaranteed in legendarev mode + npcLoot.AddIf(() => CalamityWorld.LegendaryMode && CalamityWorld.revenge, ModContent.ItemType()); // guaranteed in legendarev mode npcLoot.AddIf(() => !(CalamityWorld.LegendaryMode && CalamityWorld.revenge), ModContent.ItemType(), 27); // otherwise 1 in 27 npcLoot.Add(ModContent.ItemType(), 1, 22, (int)(pisquaredover6 * 100)); } diff --git a/NPCs/Perforator/PerforatorBodyLarge.cs b/NPCs/Perforator/PerforatorBodyLarge.cs index b75c658e6d..01fb9ffb94 100644 --- a/NPCs/Perforator/PerforatorBodyLarge.cs +++ b/NPCs/Perforator/PerforatorBodyLarge.cs @@ -3,7 +3,9 @@ using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; +using Terraria.Audio; using Terraria.GameContent; using Terraria.ID; using Terraria.Localization; @@ -13,10 +15,24 @@ namespace CalamityMod.NPCs.Perforator { public class PerforatorBodyLarge : ModNPC { + public static readonly SoundStyle HitSound = new("CalamityMod/Sounds/NPCHit/PerfLargeHit", 3); + public static readonly SoundStyle DeathSound = new("CalamityMod/Sounds/NPCKilled/PerfLargeDeath"); + + public static Asset AltTexture; + public static Asset Texture_Glow; + public static Asset AltTexture_Glow; + + public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.PerforatorHeadLarge.DisplayName"); public override void SetStaticDefaults() { this.HideFromBestiary(); + if (!Main.dedServ) + { + AltTexture = ModContent.Request(Texture + "Alt", AssetRequestMode.AsyncLoad); + AltTexture_Glow = ModContent.Request(Texture + "AltGlow", AssetRequestMode.AsyncLoad); + Texture_Glow = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -25,7 +41,11 @@ namespace CalamityMod.NPCs.Perforator NPC.width = 60; NPC.height = 60; NPC.defense = 8; - NPC.LifeMaxNERB(2250, 2700, 80000); + + NPC.LifeMaxNERB(2700, 3240, 80000); + if (Main.zenithWorld) + NPC.lifeMax *= 4; + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); NPC.aiStyle = -1; @@ -35,9 +55,8 @@ namespace CalamityMod.NPCs.Perforator NPC.behindTiles = true; NPC.noGravity = true; NPC.noTileCollide = true; - NPC.canGhostHeal = false; - NPC.HitSound = SoundID.NPCHit1; - NPC.DeathSound = SoundID.NPCDeath1; + NPC.HitSound = HitSound; + NPC.DeathSound = DeathSound; NPC.netAlways = true; NPC.dontCountMe = true; @@ -53,6 +72,10 @@ namespace CalamityMod.NPCs.Perforator NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) @@ -102,9 +125,9 @@ namespace CalamityMod.NPCs.Perforator if (Main.player[NPC.target].dead) NPC.TargetClosest(false); - Vector2 segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); - float targetX = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); - float targetY = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2); + Vector2 segmentPosition = NPC.Center; + float targetX = Main.player[NPC.target].Center.X; + float targetY = Main.player[NPC.target].Center.Y; targetX = (float)((int)(targetX / 16f) * 16); targetY = (float)((int)(targetY / 16f) * 16); segmentPosition.X = (float)((int)(segmentPosition.X / 16f) * 16); @@ -116,28 +139,43 @@ namespace CalamityMod.NPCs.Perforator { try { - segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); - targetX = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - segmentPosition.X; - targetY = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - segmentPosition.Y; + segmentPosition = NPC.Center; + targetX = Main.npc[(int)NPC.ai[1]].Center.X - segmentPosition.X; + targetY = Main.npc[(int)NPC.ai[1]].Center.Y - segmentPosition.Y; } catch { } - NPC.rotation = (float)System.Math.Atan2((double)targetY, (double)targetX) + 1.57f; + NPC.rotation = (float)System.Math.Atan2((double)targetY, (double)targetX) + MathHelper.PiOver2; targetDistance = (float)System.Math.Sqrt((double)(targetX * targetX + targetY * targetY)); int npcWidth = NPC.width; targetDistance = (targetDistance - (float)npcWidth) / targetDistance; targetX *= targetDistance; targetY *= targetDistance; NPC.velocity = Vector2.Zero; - NPC.position.X = NPC.position.X + targetX; - NPC.position.Y = NPC.position.Y + targetY; + NPC.position.X += targetX; + NPC.position.Y += targetY; if (targetX < 0f) NPC.spriteDirection = 1; else if (targetX > 0f) NPC.spriteDirection = -1; } + + // Calculate contact damage based on velocity + float maxChaseSpeed = 16f; + float minimalContactDamageVelocity = maxChaseSpeed * 0.25f; + float minimalDamageVelocity = maxChaseSpeed * 0.5f; + float bodyAndTailVelocity = (NPC.position - NPC.oldPosition).Length(); + if (bodyAndTailVelocity <= minimalContactDamageVelocity) + { + NPC.damage = 0; + } + else + { + float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); + NPC.damage = (int)MathHelper.Lerp(0f, NPC.defDamage, velocityDamageScalar); + } } public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) @@ -146,7 +184,7 @@ namespace CalamityMod.NPCs.Perforator if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = NPC.localAI[3] == 1f ? ModContent.Request("CalamityMod/NPCs/Perforator/PerforatorBodyLargeAlt").Value : TextureAssets.Npc[NPC.type].Value; + Texture2D texture2D15 = NPC.localAI[3] == 1f ? AltTexture.Value : TextureAssets.Npc[NPC.type].Value; Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / 2)); Vector2 drawLocation = NPC.Center - screenPos; @@ -154,7 +192,7 @@ namespace CalamityMod.NPCs.Perforator drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = NPC.localAI[3] == 1f ? ModContent.Request("CalamityMod/NPCs/Perforator/PerforatorBodyLargeAltGlow").Value : ModContent.Request("CalamityMod/NPCs/Perforator/PerforatorBodyLargeGlow").Value; + texture2D15 = NPC.localAI[3] == 1f ? AltTexture_Glow.Value : Texture_Glow.Value; Color glowmaskColor = Color.Lerp(Color.White, Color.Yellow, 0.5f); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); diff --git a/NPCs/Perforator/PerforatorBodyMedium.cs b/NPCs/Perforator/PerforatorBodyMedium.cs index 8a2da84097..ef764fa9f1 100644 --- a/NPCs/Perforator/PerforatorBodyMedium.cs +++ b/NPCs/Perforator/PerforatorBodyMedium.cs @@ -1,11 +1,13 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Events; using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; +using ReLogic.Content; using Terraria; +using Terraria.Audio; using Terraria.GameContent; using Terraria.ID; using Terraria.Localization; @@ -15,10 +17,19 @@ namespace CalamityMod.NPCs.Perforator { public class PerforatorBodyMedium : ModNPC { + public static readonly SoundStyle HitSound = new("CalamityMod/Sounds/NPCHit/PerfMediumHit", 3); + public static readonly SoundStyle DeathSound = new("CalamityMod/Sounds/NPCKilled/PerfMediumDeath"); + + public static Asset GlowTexture; + public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.PerforatorHeadMedium.DisplayName"); public override void SetStaticDefaults() { this.HideFromBestiary(); + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -28,7 +39,11 @@ namespace CalamityMod.NPCs.Perforator NPC.width = 40; NPC.height = 40; NPC.defense = 6; - NPC.LifeMaxNERB(150, 180, 7000); + + NPC.LifeMaxNERB(180, 216, 7000); + if (Main.zenithWorld) + NPC.lifeMax *= 4; + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); NPC.aiStyle = -1; @@ -38,9 +53,8 @@ namespace CalamityMod.NPCs.Perforator NPC.behindTiles = true; NPC.noGravity = true; NPC.noTileCollide = true; - NPC.canGhostHeal = false; - NPC.HitSound = SoundID.NPCHit1; - NPC.DeathSound = SoundID.NPCDeath1; + NPC.HitSound = HitSound; + NPC.DeathSound = DeathSound; NPC.netAlways = true; NPC.dontCountMe = true; @@ -58,6 +72,10 @@ namespace CalamityMod.NPCs.Perforator NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void AI() @@ -83,9 +101,9 @@ namespace CalamityMod.NPCs.Perforator if (NPC.ai[0] == 0f) { if (NPC.ai[2] > 0f) - NPC.ai[0] = NPC.NewNPC(NPC.GetSource_FromAI(), (int)(NPC.position.X + (NPC.width / 2)), (int)(NPC.position.Y + NPC.height), NPC.type, NPC.whoAmI, 0f, 0f, 0f, 0f, 255); + NPC.ai[0] = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)(NPC.position.Y + NPC.height), NPC.type, NPC.whoAmI); else - NPC.ai[0] = NPC.NewNPC(NPC.GetSource_FromAI(), (int)(NPC.position.X + (NPC.width / 2)), (int)(NPC.position.Y + NPC.height), ModContent.NPCType(), NPC.whoAmI, 0f, 0f, 0f, 0f, 255); + NPC.ai[0] = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)(NPC.position.Y + NPC.height), ModContent.NPCType(), NPC.whoAmI); Main.npc[(int)NPC.ai[0]].ai[1] = NPC.whoAmI; Main.npc[(int)NPC.ai[0]].ai[2] = NPC.ai[2] - 1f; @@ -131,9 +149,9 @@ namespace CalamityMod.NPCs.Perforator NetMessage.SendData(MessageID.DamageNPC, -1, -1, null, NPC.whoAmI, -1f, 0f, 0f, 0, 0, 0); } - Vector2 segmentDirection = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); - float targetX = Main.player[NPC.target].position.X + (Main.player[NPC.target].width / 2); - float targetY = Main.player[NPC.target].position.Y + (Main.player[NPC.target].height / 2); + Vector2 segmentDirection = NPC.Center; + float targetX = Main.player[NPC.target].Center.X; + float targetY = Main.player[NPC.target].Center.Y; targetX = (int)(targetX / 16f) * 16; targetY = (int)(targetY / 16f) * 16; @@ -147,9 +165,9 @@ namespace CalamityMod.NPCs.Perforator { try { - segmentDirection = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); - targetX = Main.npc[(int)NPC.ai[1]].position.X + (Main.npc[(int)NPC.ai[1]].width / 2) - segmentDirection.X; - targetY = Main.npc[(int)NPC.ai[1]].position.Y + (Main.npc[(int)NPC.ai[1]].height / 2) - segmentDirection.Y; + segmentDirection = NPC.Center; + targetX = Main.npc[(int)NPC.ai[1]].Center.X - segmentDirection.X; + targetY = Main.npc[(int)NPC.ai[1]].Center.Y - segmentDirection.Y; } catch { @@ -166,6 +184,22 @@ namespace CalamityMod.NPCs.Perforator NPC.position.X += targetX; NPC.position.Y += targetY; } + + // Calculate contact damage based on velocity + // This worm requires more velocity to deal damage with the body because it doesn't have spikes or metal bits or etc. + float maxChaseSpeed = 16f; + float minimalContactDamageVelocity = maxChaseSpeed * 0.4f; + float minimalDamageVelocity = maxChaseSpeed * 0.8f; + float bodyAndTailVelocity = (NPC.position - NPC.oldPosition).Length(); + if (bodyAndTailVelocity <= minimalContactDamageVelocity) + { + NPC.damage = 0; + } + else + { + float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); + NPC.damage = (int)MathHelper.Lerp(0f, NPC.defDamage, velocityDamageScalar); + } } public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) @@ -182,7 +216,7 @@ namespace CalamityMod.NPCs.Perforator drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/Perforator/PerforatorBodyMediumGlow").Value; + texture2D15 = GlowTexture.Value; Color glowmaskColor = Color.Lerp(Color.White, Color.Yellow, 0.5f); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); @@ -200,7 +234,7 @@ namespace CalamityMod.NPCs.Perforator int closestPlayer = Player.FindClosest(NPC.Center, 1, 1); if (Main.rand.NextBool(4) && Main.player[closestPlayer].statLife < Main.player[closestPlayer].statLifeMax2) Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); - + if (Main.netMode != NetmodeID.MultiplayerClient && Main.zenithWorld) { int type = ModContent.ProjectileType(); diff --git a/NPCs/Perforator/PerforatorBodySmall.cs b/NPCs/Perforator/PerforatorBodySmall.cs index 8cacdd5260..edbe9583e2 100644 --- a/NPCs/Perforator/PerforatorBodySmall.cs +++ b/NPCs/Perforator/PerforatorBodySmall.cs @@ -3,7 +3,9 @@ using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; +using Terraria.Audio; using Terraria.GameContent; using Terraria.ID; using Terraria.Localization; @@ -13,10 +15,19 @@ namespace CalamityMod.NPCs.Perforator { public class PerforatorBodySmall : ModNPC { + public static readonly SoundStyle HitSound = new("CalamityMod/Sounds/NPCHit/PerfSmallHit", 3); + public static readonly SoundStyle DeathSound = new("CalamityMod/Sounds/NPCKilled/PerfSmallDeath"); + + public static Asset GlowTexture; + public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.PerforatorHeadSmall.DisplayName"); public override void SetStaticDefaults() { this.HideFromBestiary(); + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -25,7 +36,11 @@ namespace CalamityMod.NPCs.Perforator NPC.width = 42; NPC.height = 42; NPC.defense = 4; - NPC.LifeMaxNERB(1000, 1200, 50000); + + NPC.LifeMaxNERB(1200, 1440, 50000); + if (Main.zenithWorld) + NPC.lifeMax *= 4; + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); NPC.aiStyle = -1; @@ -35,9 +50,8 @@ namespace CalamityMod.NPCs.Perforator NPC.behindTiles = true; NPC.noGravity = true; NPC.noTileCollide = true; - NPC.canGhostHeal = false; - NPC.HitSound = SoundID.NPCHit1; - NPC.DeathSound = SoundID.NPCDeath1; + NPC.HitSound = HitSound; + NPC.DeathSound = DeathSound; NPC.netAlways = true; NPC.dontCountMe = true; @@ -53,6 +67,10 @@ namespace CalamityMod.NPCs.Perforator NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) @@ -102,9 +120,9 @@ namespace CalamityMod.NPCs.Perforator if (Main.player[NPC.target].dead) NPC.TargetClosest(false); - Vector2 segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); - float targetX = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); - float targetY = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2); + Vector2 segmentPosition = NPC.Center; + float targetX = Main.player[NPC.target].Center.X; + float targetY = Main.player[NPC.target].Center.Y; targetX = (float)((int)(targetX / 16f) * 16); targetY = (float)((int)(targetY / 16f) * 16); segmentPosition.X = (float)((int)(segmentPosition.X / 16f) * 16); @@ -116,28 +134,44 @@ namespace CalamityMod.NPCs.Perforator { try { - segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); - targetX = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - segmentPosition.X; - targetY = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - segmentPosition.Y; + segmentPosition = NPC.Center; + targetX = Main.npc[(int)NPC.ai[1]].Center.X - segmentPosition.X; + targetY = Main.npc[(int)NPC.ai[1]].Center.Y - segmentPosition.Y; } catch { } - NPC.rotation = (float)System.Math.Atan2((double)targetY, (double)targetX) + 1.57f; + NPC.rotation = (float)System.Math.Atan2((double)targetY, (double)targetX) + MathHelper.PiOver2; targetDistance = (float)System.Math.Sqrt((double)(targetX * targetX + targetY * targetY)); int npcWidth = NPC.width; targetDistance = (targetDistance - (float)npcWidth) / targetDistance; targetX *= targetDistance; targetY *= targetDistance; NPC.velocity = Vector2.Zero; - NPC.position.X = NPC.position.X + targetX; - NPC.position.Y = NPC.position.Y + targetY; + NPC.position.X += targetX; + NPC.position.Y += targetY; if (targetX < 0f) NPC.spriteDirection = 1; else if (targetX > 0f) NPC.spriteDirection = -1; } + + // Calculate contact damage based on velocity + // This worm requires more velocity to deal damage with the body because it doesn't have spikes or metal bits or etc. + float maxChaseSpeed = 16f; + float minimalContactDamageVelocity = maxChaseSpeed * 0.4f; + float minimalDamageVelocity = maxChaseSpeed * 0.8f; + float bodyAndTailVelocity = (NPC.position - NPC.oldPosition).Length(); + if (bodyAndTailVelocity <= minimalContactDamageVelocity) + { + NPC.damage = 0; + } + else + { + float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); + NPC.damage = (int)MathHelper.Lerp(0f, NPC.defDamage, velocityDamageScalar); + } } public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) @@ -154,7 +188,7 @@ namespace CalamityMod.NPCs.Perforator drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/Perforator/PerforatorBodySmallGlow").Value; + texture2D15 = GlowTexture.Value; Color glowmaskColor = Color.Lerp(Color.White, Color.Yellow, 0.5f); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); diff --git a/NPCs/Perforator/PerforatorCyst.cs b/NPCs/Perforator/PerforatorCyst.cs index 9826d28e7a..eaf3858d0e 100644 --- a/NPCs/Perforator/PerforatorCyst.cs +++ b/NPCs/Perforator/PerforatorCyst.cs @@ -1,6 +1,8 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; +using Terraria.Audio; using Terraria.GameContent; using Terraria.GameContent.Bestiary; using Terraria.ID; @@ -10,13 +12,21 @@ namespace CalamityMod.NPCs.Perforator { public class PerforatorCyst : ModNPC { + public static readonly SoundStyle HiveSpawn = new("CalamityMod/Sounds/Custom/Perforator/PerfHiveSpawn"); + + public static Asset GlowTexture; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 4; NPCID.Sets.CantTakeLunchMoney[Type] = true; NPCID.Sets.BossBestiaryPriority.Add(Type); - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0); + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(); NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -41,11 +51,11 @@ namespace CalamityMod.NPCs.Perforator public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.TheCrimson, BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.UndergroundCrimson, - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.PerforatorCyst") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.PerforatorCyst") }); } @@ -71,7 +81,7 @@ namespace CalamityMod.NPCs.Perforator vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/Perforator/PerforatorCystGlow").Value; + texture2D15 = GlowTexture.Value; Color color37 = Color.Lerp(Color.White, Color.Yellow, 0.5f); spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); @@ -115,6 +125,8 @@ namespace CalamityMod.NPCs.Perforator } if (NPC.life <= 0) { + SoundEngine.PlaySound(HiveSpawn, NPC.Center); + for (int k = 0; k < 20; k++) { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); diff --git a/NPCs/Perforator/PerforatorHeadLarge.cs b/NPCs/Perforator/PerforatorHeadLarge.cs index 74c0216cc6..95dd7fde47 100644 --- a/NPCs/Perforator/PerforatorHeadLarge.cs +++ b/NPCs/Perforator/PerforatorHeadLarge.cs @@ -1,30 +1,36 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using System.IO; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Events; using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; +using ReLogic.Content; using Terraria; +using Terraria.Audio; using Terraria.GameContent; using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; -using System.IO; -using Terraria.Audio; namespace CalamityMod.NPCs.Perforator { [AutoloadBossHead] public class PerforatorHeadLarge : ModNPC { + public static readonly SoundStyle HitSound = new("CalamityMod/Sounds/NPCHit/PerfLargeHit", 3); + public static readonly SoundStyle DeathSound = new("CalamityMod/Sounds/NPCKilled/PerfLargeDeath"); + + public static Asset GlowTexture; + private int biomeEnrageTimer = CalamityGlobalNPC.biomeEnrageTimerMax; private bool TailSpawned = false; public override void SetStaticDefaults() { NPCID.Sets.BossBestiaryPriority.Add(Type); - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { Scale = 0.75f, PortraitScale = 0.75f, @@ -35,6 +41,10 @@ namespace CalamityMod.NPCs.Perforator value.Position.X += 70; value.Position.Y += 40; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -46,7 +56,11 @@ namespace CalamityMod.NPCs.Perforator NPC.width = 70; NPC.height = 84; NPC.defense = 4; - NPC.LifeMaxNERB(2250, 2700, 80000); + + NPC.LifeMaxNERB(2700, 3240, 80000); + if (Main.zenithWorld) + NPC.lifeMax *= 4; + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); NPC.aiStyle = -1; @@ -56,8 +70,8 @@ namespace CalamityMod.NPCs.Perforator NPC.behindTiles = true; NPC.noGravity = true; NPC.noTileCollide = true; - NPC.HitSound = SoundID.NPCHit1; - NPC.DeathSound = SoundID.NPCDeath1; + NPC.HitSound = HitSound; + NPC.DeathSound = DeathSound; NPC.netAlways = true; if (BossRushEvent.BossRushActive) @@ -72,6 +86,10 @@ namespace CalamityMod.NPCs.Perforator NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -79,11 +97,11 @@ namespace CalamityMod.NPCs.Perforator int associatedNPCType = ModContent.NPCType(); bestiaryEntry.UIInfoProvider = new CommonEnemyUICollectionInfoProvider(ContentSamples.NpcBestiaryCreditIdsByNpcNetIds[associatedNPCType], quickUnlock: true); - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.TheCrimson, BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.UndergroundCrimson, - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Perforator") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Perforator") }); } @@ -138,15 +156,6 @@ namespace CalamityMod.NPCs.Perforator // Percent life remaining float lifeRatio = NPC.life / (float)NPC.lifeMax; - if (revenge || lifeRatio < (expertMode ? 0.75f : 0.5f)) - NPC.Calamity().newAI[0] += 1f; - - float burrowTimeGateValue = death ? 480f : 600f; - bool burrow = NPC.Calamity().newAI[0] >= burrowTimeGateValue; - bool resetTime = NPC.Calamity().newAI[0] >= burrowTimeGateValue + 600f; - bool lungeUpward = burrow && NPC.Calamity().newAI[1] == 1f; - bool quickFall = NPC.Calamity().newAI[1] == 2f; - float speed = 0.09f; float turnSpeed = 0.06f; @@ -158,15 +167,6 @@ namespace CalamityMod.NPCs.Perforator turnSpeed += accelerationScale * (1f - lifeRatio); } - if (lungeUpward) - { - speed *= 1.25f; - turnSpeed *= 1.5f; - - if (NPC.Calamity().newAI[2] == 0f) - NPC.Calamity().newAI[2] = player.Center.Y - 600f; - } - if (NPC.ai[2] > 0f) NPC.realLife = (int)NPC.ai[2]; @@ -184,17 +184,13 @@ namespace CalamityMod.NPCs.Perforator { int lol; if (segments >= 0 && segments < maxLength - 1) - { - lol = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.position.X + (NPC.width / 2), (int)NPC.position.Y + (NPC.height / 2), ModContent.NPCType(), NPC.whoAmI); - } + lol = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType(), NPC.whoAmI); else - { - lol = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.position.X + (NPC.width / 2), (int)NPC.position.Y + (NPC.height / 2), ModContent.NPCType(), NPC.whoAmI); - } + lol = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType(), NPC.whoAmI); + if (segments % 2 == 0) - { Main.npc[lol].localAI[3] = 1f; - } + Main.npc[lol].realLife = NPC.whoAmI; Main.npc[lol].ai[2] = NPC.whoAmI; Main.npc[lol].ai[1] = Previous; @@ -202,6 +198,7 @@ namespace CalamityMod.NPCs.Perforator NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, lol, 0f, 0f, 0f, 0); Previous = lol; } + TailSpawned = true; } } @@ -211,22 +208,15 @@ namespace CalamityMod.NPCs.Perforator int tilePositionY = (int)(NPC.position.Y / 16f) - 1; int tileWidthPosY = (int)((NPC.position.Y + (float)NPC.height) / 16f) + 2; if (tilePositionX < 0) - { tilePositionX = 0; - } if (tileWidthPosX > Main.maxTilesX) - { tileWidthPosX = Main.maxTilesX; - } if (tilePositionY < 0) - { tilePositionY = 0; - } if (tileWidthPosY > Main.maxTilesY) - { tileWidthPosY = Main.maxTilesY; - } - bool shouldFly = lungeUpward; + + bool shouldFly = false; if (!shouldFly) { for (int k = tilePositionX; k < tileWidthPosX; k++) @@ -247,6 +237,7 @@ namespace CalamityMod.NPCs.Perforator } } } + if (!shouldFly) { NPC.localAI[1] = 1f; @@ -255,7 +246,7 @@ namespace CalamityMod.NPCs.Perforator bool outsideFlyingRadius = true; if (NPC.position.Y > player.position.Y) { - for (int m = 0; m < 255; m++) + for (int m = 0; m < Main.maxPlayers; m++) { if (Main.player[m].active) { @@ -267,41 +258,36 @@ namespace CalamityMod.NPCs.Perforator } } } + if (outsideFlyingRadius) - { shouldFly = true; - } } } else - { NPC.localAI[1] = 0f; - } - float fallSpeed = 16f; + float maxChargeSpeed = 16f; if (player.dead || CalamityGlobalNPC.perfHive < 0 || !Main.npc[CalamityGlobalNPC.perfHive].active) { shouldFly = false; NPC.velocity.Y += 1f; - if ((double)NPC.position.Y > Main.worldSurface * 16.0) + if ((double)NPC.position.Y > Main.worldSurface * 16D) { NPC.velocity.Y += 1f; - fallSpeed = 32f; + maxChargeSpeed *= 2f; } - if ((double)NPC.position.Y > Main.rockLayer * 16.0) + + if ((double)NPC.position.Y > Main.rockLayer * 16D) { for (int a = 0; a < Main.maxNPCs; a++) { - if (Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || - Main.npc[a].type == ModContent.NPCType()) - { + if (Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType()) Main.npc[a].active = false; - } } } } - //This is possibly the best or worst idea ever conceived + // This is possibly the best or worst idea ever conceived float laserOffset = 1500f; float laserVelocity = 4f; int type = ModContent.ProjectileType(); @@ -310,12 +296,12 @@ namespace CalamityMod.NPCs.Perforator if (Main.zenithWorld) NPC.Calamity().newAI[3]++; - if (NPC.Calamity().newAI[3] > 180f) //Effectively 10 seconds but give a little headstart in case players kill it too fast + if (NPC.Calamity().newAI[3] > 180f) // Effectively 10 seconds but give a little headstart in case players kill it too fast { if (NPC.Calamity().newAI[3] % 60 == 59) { SoundEngine.PlaySound(SoundID.Item12, player.Center); - for (int i = -7; i < 8; i++) //15 lasers + for (int i = -7; i < 8; i++) // 15 lasers { float laserGap = (i * 128f); Projectile.NewProjectile(NPC.GetSource_FromAI(), player.Center.X + laserOffset, player.Center.Y + laserGap, -laserVelocity, 0f, type, damage, 0f, Main.myPlayer); @@ -324,19 +310,16 @@ namespace CalamityMod.NPCs.Perforator Projectile.NewProjectile(NPC.GetSource_FromAI(), player.Center.X + laserGap, player.Center.Y + laserOffset, 0f, laserVelocity, type, damage, 0f, Main.myPlayer); } } - + if (NPC.Calamity().newAI[3] >= 300f) NPC.Calamity().newAI[3] = -300f; } float speedCopy = speed; float turnSpeedCopy = turnSpeed; - float burrowDistance = bossRush ? 500f : 800f; - float burrowTarget = player.Center.Y + burrowDistance; - float lungeTarget = NPC.Calamity().newAI[2]; Vector2 npcCenter = NPC.Center; float playerX = player.Center.X; - float targettingPosition = lungeUpward ? lungeTarget : burrow ? burrowTarget : player.Center.Y; + float targettingPosition = player.Center.Y; playerX = (float)((int)(playerX / 16f) * 16); targettingPosition = (float)((int)(targettingPosition / 16f) * 16); npcCenter.X = (float)((int)(npcCenter.X / 16f) * 16); @@ -345,76 +328,45 @@ namespace CalamityMod.NPCs.Perforator targettingPosition -= npcCenter.Y; float targetDistance = (float)Math.Sqrt((double)(playerX * playerX + targettingPosition * targettingPosition)); - // Lunge up towards target - if (burrow && NPC.Center.Y >= burrowTarget - 16f) - NPC.Calamity().newAI[1] = 1f; - - // Quickly fall back down once above target - if (lungeUpward && NPC.Center.Y <= NPC.Calamity().newAI[2] + 600f - 420f) - { - NPC.TargetClosest(); - NPC.Calamity().newAI[1] = 2f; - } - - // Quickly fall and reset variables once at target's Y position - if (quickFall) - { - NPC.velocity.Y += 0.5f; - if (NPC.Center.Y >= NPC.Calamity().newAI[2] + 600f) - { - NPC.Calamity().newAI[0] = 0f; - NPC.Calamity().newAI[1] = 0f; - NPC.Calamity().newAI[2] = 0f; - } - } - - // Reset variables if the burrow and lunge attack is taking too long - if (resetTime) - { - NPC.Calamity().newAI[0] = 0f; - NPC.Calamity().newAI[1] = 0f; - } - if (!shouldFly) { NPC.TargetClosest(true); - NPC.velocity.Y = NPC.velocity.Y + 0.15f; - if (NPC.velocity.Y > fallSpeed) - { - NPC.velocity.Y = fallSpeed; - } - if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)fallSpeed * 0.4) + NPC.velocity.Y += 0.15f; + if (NPC.velocity.Y > maxChargeSpeed) + NPC.velocity.Y = maxChargeSpeed; + + // This bool exists to stop the strange wiggle behavior when worms are falling down + bool slowXVelocity = Math.Abs(NPC.velocity.X) > speedCopy; + if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)maxChargeSpeed * 0.4) { if (NPC.velocity.X < 0f) + NPC.velocity.X -= speedCopy * 1.1f; + else + NPC.velocity.X += speedCopy * 1.1f; + } + else if (NPC.velocity.Y == maxChargeSpeed) + { + if (slowXVelocity) { - NPC.velocity.X = NPC.velocity.X - speedCopy * 1.1f; + if (NPC.velocity.X < playerX) + NPC.velocity.X += speedCopy; + else if (NPC.velocity.X > playerX) + NPC.velocity.X -= speedCopy; } else - { - NPC.velocity.X = NPC.velocity.X + speedCopy * 1.1f; - } - } - else if (NPC.velocity.Y == fallSpeed) - { - if (NPC.velocity.X < playerX) - { - NPC.velocity.X = NPC.velocity.X + speedCopy; - } - else if (NPC.velocity.X > playerX) - { - NPC.velocity.X = NPC.velocity.X - speedCopy; - } + NPC.velocity.X = 0f; } else if (NPC.velocity.Y > 4f) { - if (NPC.velocity.X < 0f) + if (slowXVelocity) { - NPC.velocity.X = NPC.velocity.X + speedCopy * 0.9f; + if (NPC.velocity.X < 0f) + NPC.velocity.X += speedCopy * 0.9f; + else + NPC.velocity.X -= speedCopy * 0.9f; } else - { - NPC.velocity.X = NPC.velocity.X - speedCopy * 0.9f; - } + NPC.velocity.X = 0f; } } else @@ -423,20 +375,18 @@ namespace CalamityMod.NPCs.Perforator { float soundDelay = targetDistance / 40f; if (soundDelay < 10f) - { soundDelay = 10f; - } if (soundDelay > 20f) - { soundDelay = 20f; - } + NPC.soundDelay = (int)soundDelay; SoundEngine.PlaySound(SoundID.WormDig, NPC.Center); } + targetDistance = (float)Math.Sqrt((double)(playerX * playerX + targettingPosition * targettingPosition)); float absoluteTargetX = Math.Abs(playerX); float absoluteTargetPos = Math.Abs(targettingPosition); - float timeToReachTarget = fallSpeed / targetDistance; + float timeToReachTarget = maxChargeSpeed / targetDistance; playerX *= timeToReachTarget; targettingPosition *= timeToReachTarget; if (((NPC.velocity.X > 0f && playerX > 0f) || (NPC.velocity.X < 0f && playerX < 0f)) && ((NPC.velocity.Y > 0f && targettingPosition > 0f) || (NPC.velocity.Y < 0f && targettingPosition < 0f))) @@ -449,6 +399,7 @@ namespace CalamityMod.NPCs.Perforator { NPC.velocity.X = NPC.velocity.X - turnSpeedCopy; } + if (NPC.velocity.Y < targettingPosition) { NPC.velocity.Y = NPC.velocity.Y + turnSpeedCopy; @@ -468,6 +419,7 @@ namespace CalamityMod.NPCs.Perforator { NPC.velocity.X = NPC.velocity.X - speedCopy; } + if (NPC.velocity.Y < targettingPosition) { NPC.velocity.Y = NPC.velocity.Y + speedCopy; @@ -476,7 +428,8 @@ namespace CalamityMod.NPCs.Perforator { NPC.velocity.Y = NPC.velocity.Y - speedCopy; } - if ((double)Math.Abs(targettingPosition) < (double)fallSpeed * 0.2 && ((NPC.velocity.X > 0f && playerX < 0f) || (NPC.velocity.X < 0f && playerX > 0f))) + + if ((double)Math.Abs(targettingPosition) < (double)maxChargeSpeed * 0.2 && ((NPC.velocity.X > 0f && playerX < 0f) || (NPC.velocity.X < 0f && playerX > 0f))) { if (NPC.velocity.Y > 0f) { @@ -487,7 +440,8 @@ namespace CalamityMod.NPCs.Perforator NPC.velocity.Y = NPC.velocity.Y - speedCopy * 2f; } } - if ((double)Math.Abs(playerX) < (double)fallSpeed * 0.2 && ((NPC.velocity.Y > 0f && targettingPosition < 0f) || (NPC.velocity.Y < 0f && targettingPosition > 0f))) + + if ((double)Math.Abs(playerX) < (double)maxChargeSpeed * 0.2 && ((NPC.velocity.Y > 0f && targettingPosition < 0f) || (NPC.velocity.Y < 0f && targettingPosition > 0f))) { if (NPC.velocity.X > 0f) { @@ -509,7 +463,8 @@ namespace CalamityMod.NPCs.Perforator { NPC.velocity.X = NPC.velocity.X - speedCopy * 1.1f; } - if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)fallSpeed * 0.5) + + if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)maxChargeSpeed * 0.5) { if (NPC.velocity.Y > 0f) { @@ -531,7 +486,8 @@ namespace CalamityMod.NPCs.Perforator { NPC.velocity.Y = NPC.velocity.Y - speedCopy * 1.1f; } - if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)fallSpeed * 0.5) + + if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)maxChargeSpeed * 0.5) { if (NPC.velocity.X > 0f) { @@ -544,27 +500,39 @@ namespace CalamityMod.NPCs.Perforator } } } - NPC.rotation = (float)Math.Atan2((double)NPC.velocity.Y, (double)NPC.velocity.X) + 1.57f; + + // Calculate contact damage based on velocity + float minimalContactDamageVelocity = maxChargeSpeed * 0.25f; + float minimalDamageVelocity = maxChargeSpeed * 0.5f; + if (NPC.velocity.Length() <= minimalContactDamageVelocity) + { + NPC.damage = (int)Math.Round(NPC.defDamage * 0.5); + } + else + { + float velocityDamageScalar = MathHelper.Clamp((NPC.velocity.Length() - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); + NPC.damage = (int)MathHelper.Lerp((float)Math.Round(NPC.defDamage * 0.5), NPC.defDamage, velocityDamageScalar); + } + + NPC.rotation = (float)Math.Atan2((double)NPC.velocity.Y, (double)NPC.velocity.X) + MathHelper.PiOver2; + if (shouldFly) { if (NPC.localAI[0] != 1f) - { NPC.netUpdate = true; - } + NPC.localAI[0] = 1f; } else { if (NPC.localAI[0] != 0f) - { NPC.netUpdate = true; - } + NPC.localAI[0] = 0f; } + if (((NPC.velocity.X > 0f && NPC.oldVelocity.X < 0f) || (NPC.velocity.X < 0f && NPC.oldVelocity.X > 0f) || (NPC.velocity.Y > 0f && NPC.oldVelocity.Y < 0f) || (NPC.velocity.Y < 0f && NPC.oldVelocity.Y > 0f)) && !NPC.justHit) - { NPC.netUpdate = true; - } } public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) @@ -584,7 +552,7 @@ namespace CalamityMod.NPCs.Perforator drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/Perforator/PerforatorHeadLargeGlow").Value; + texture2D15 = GlowTexture.Value; Color glowmaskColor = Color.Lerp(Color.White, Color.Yellow, 0.5f); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); diff --git a/NPCs/Perforator/PerforatorHeadMedium.cs b/NPCs/Perforator/PerforatorHeadMedium.cs index 5b958674a2..4170cfdc34 100644 --- a/NPCs/Perforator/PerforatorHeadMedium.cs +++ b/NPCs/Perforator/PerforatorHeadMedium.cs @@ -1,26 +1,32 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Events; using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; +using ReLogic.Content; using Terraria; +using Terraria.Audio; using Terraria.GameContent; using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.NPCs.Perforator { [AutoloadBossHead] public class PerforatorHeadMedium : ModNPC { + public static readonly SoundStyle HitSound = new("CalamityMod/Sounds/NPCHit/PerfMediumHit", 3); + public static readonly SoundStyle DeathSound = new("CalamityMod/Sounds/NPCKilled/PerfMediumDeath"); + + public static Asset GlowTexture; + public override void SetStaticDefaults() { NPCID.Sets.BossBestiaryPriority.Add(Type); - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { Scale = 0.7f, PortraitScale = 0.7f, @@ -31,6 +37,10 @@ namespace CalamityMod.NPCs.Perforator value.Position.X += 60; value.Position.Y += 40; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -42,7 +52,11 @@ namespace CalamityMod.NPCs.Perforator NPC.width = 58; NPC.height = 68; NPC.defense = 2; - NPC.LifeMaxNERB(150, 180, 7000); + + NPC.LifeMaxNERB(180, 216, 7000); + if (Main.zenithWorld) + NPC.lifeMax *= 4; + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); NPC.aiStyle = -1; @@ -52,8 +66,8 @@ namespace CalamityMod.NPCs.Perforator NPC.behindTiles = true; NPC.noGravity = true; NPC.noTileCollide = true; - NPC.HitSound = SoundID.NPCHit1; - NPC.DeathSound = SoundID.NPCDeath1; + NPC.HitSound = HitSound; + NPC.DeathSound = DeathSound; NPC.netAlways = true; if (BossRushEvent.BossRushActive) @@ -70,6 +84,10 @@ namespace CalamityMod.NPCs.Perforator NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -77,11 +95,11 @@ namespace CalamityMod.NPCs.Perforator int associatedNPCType = ModContent.NPCType(); bestiaryEntry.UIInfoProvider = new CommonEnemyUICollectionInfoProvider(ContentSamples.NpcBestiaryCreditIdsByNpcNetIds[associatedNPCType], quickUnlock: true); - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.TheCrimson, BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.UndergroundCrimson, - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Perforator") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Perforator") }); } @@ -134,7 +152,7 @@ namespace CalamityMod.NPCs.Perforator { int totalSegments = death ? 14 : revenge ? 13 : expertMode ? 12 : 10; NPC.ai[2] = totalSegments; - NPC.ai[0] = NPC.NewNPC(NPC.GetSource_FromAI(), (int)(NPC.position.X + (NPC.width / 2)), (int)(NPC.position.Y + NPC.height), ModContent.NPCType(), NPC.whoAmI, 0f, 0f, 0f, 0f, 255); + NPC.ai[0] = NPC.NewNPC(NPC.GetSource_FromAI(), (int)(NPC.position.X + (NPC.width / 2)), (int)(NPC.position.Y + NPC.height), ModContent.NPCType(), NPC.whoAmI); Main.npc[(int)NPC.ai[0]].ai[1] = NPC.whoAmI; Main.npc[(int)NPC.ai[0]].ai[2] = NPC.ai[2] - 1f; NPC.netUpdate = true; @@ -193,18 +211,17 @@ namespace CalamityMod.NPCs.Perforator { shouldFly = true; if (Main.rand.NextBool(100) && Main.tile[i, j].HasUnactuatedTile) - { WorldGen.KillTile(i, j, true, true, false); - } } } } } } + if (!shouldFly) { Rectangle rectangle = new Rectangle((int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height); - int stopFlyingRadius = death ? 160 : revenge ? 200 : expertMode ? 240 : 300; + int stopFlyingRadius = death ? 320 : revenge ? 400 : expertMode ? 480 : 600; bool outsideFlyRadius = true; for (int k = 0; k < Main.maxPlayers; k++) { @@ -218,29 +235,29 @@ namespace CalamityMod.NPCs.Perforator } } } + if (outsideFlyRadius) shouldFly = true; } - float fallSpeed = 16f; + float maxChargeSpeed = 16f; if (player.dead || CalamityGlobalNPC.perfHive < 0 || !Main.npc[CalamityGlobalNPC.perfHive].active) { NPC.TargetClosest(false); shouldFly = false; NPC.velocity.Y += 1f; - if (NPC.position.Y > Main.worldSurface * 16.0) + if (NPC.position.Y > Main.worldSurface * 16D) { NPC.velocity.Y += 1f; - fallSpeed = 32f; + maxChargeSpeed *= 2f; } - if (NPC.position.Y > Main.rockLayer * 16.0) + + if (NPC.position.Y > Main.rockLayer * 16D) { for (int p = 0; p < Main.maxNPCs; p++) { if (Main.npc[p].type == NPC.type || Main.npc[p].type == ModContent.NPCType() || Main.npc[p].type == ModContent.NPCType()) - { Main.npc[p].active = false; - } } } } @@ -273,29 +290,41 @@ namespace CalamityMod.NPCs.Perforator if (!shouldFly) { NPC.velocity.Y += 0.15f; - if (NPC.velocity.Y > fallSpeed) - NPC.velocity.Y = fallSpeed; + if (NPC.velocity.Y > maxChargeSpeed) + NPC.velocity.Y = maxChargeSpeed; - if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < fallSpeed * 0.4) + // This bool exists to stop the strange wiggle behavior when worms are falling down + bool slowXVelocity = Math.Abs(NPC.velocity.X) > turnSpeedCopy; + if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < maxChargeSpeed * 0.4) { if (NPC.velocity.X < 0f) NPC.velocity.X -= turnSpeedCopy * 1.1f; else NPC.velocity.X += turnSpeedCopy * 1.1f; } - else if (NPC.velocity.Y == fallSpeed) + else if (NPC.velocity.Y == maxChargeSpeed) { - if (NPC.velocity.X < targetX) - NPC.velocity.X += turnSpeedCopy; - else if (NPC.velocity.X > targetX) - NPC.velocity.X -= turnSpeedCopy; + if (slowXVelocity) + { + if (NPC.velocity.X < targetX) + NPC.velocity.X += turnSpeedCopy; + else if (NPC.velocity.X > targetX) + NPC.velocity.X -= turnSpeedCopy; + } + else + NPC.velocity.X = 0f; } else if (NPC.velocity.Y > 4f) { - if (NPC.velocity.X < 0f) - NPC.velocity.X += turnSpeedCopy * 0.9f; + if (slowXVelocity) + { + if (NPC.velocity.X < 0f) + NPC.velocity.X += turnSpeedCopy * 0.9f; + else + NPC.velocity.X -= turnSpeedCopy * 0.9f; + } else - NPC.velocity.X -= turnSpeedCopy * 0.9f; + NPC.velocity.X = 0f; } } else @@ -316,7 +345,7 @@ namespace CalamityMod.NPCs.Perforator targetDistance = (float)Math.Sqrt(targetX * targetX + targetY * targetY); float absoluteTargetX = Math.Abs(targetX); float absoluteTargetY = Math.Abs(targetY); - float timeToReachTarget = fallSpeed / targetDistance; + float timeToReachTarget = maxChargeSpeed / targetDistance; targetX *= timeToReachTarget; targetY *= timeToReachTarget; @@ -345,7 +374,7 @@ namespace CalamityMod.NPCs.Perforator else if (NPC.velocity.Y > targetY) NPC.velocity.Y -= speedCopy; - if (Math.Abs(targetY) < fallSpeed * 0.2 && ((NPC.velocity.X > 0f && targetX < 0f) || (NPC.velocity.X < 0f && targetX > 0f))) + if (Math.Abs(targetY) < maxChargeSpeed * 0.2 && ((NPC.velocity.X > 0f && targetX < 0f) || (NPC.velocity.X < 0f && targetX > 0f))) { if (NPC.velocity.Y > 0f) NPC.velocity.Y += speedCopy * 2f; @@ -353,7 +382,7 @@ namespace CalamityMod.NPCs.Perforator NPC.velocity.Y -= speedCopy * 2f; } - if (Math.Abs(targetX) < fallSpeed * 0.2 && ((NPC.velocity.Y > 0f && targetY < 0f) || (NPC.velocity.Y < 0f && targetY > 0f))) + if (Math.Abs(targetX) < maxChargeSpeed * 0.2 && ((NPC.velocity.Y > 0f && targetY < 0f) || (NPC.velocity.Y < 0f && targetY > 0f))) { if (NPC.velocity.X > 0f) NPC.velocity.X += speedCopy * 2f; @@ -368,7 +397,7 @@ namespace CalamityMod.NPCs.Perforator else if (NPC.velocity.X > targetX) NPC.velocity.X -= speedCopy * 1.1f; - if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < fallSpeed * 0.5) + if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < maxChargeSpeed * 0.5) { if (NPC.velocity.Y > 0f) NPC.velocity.Y += speedCopy; @@ -383,7 +412,7 @@ namespace CalamityMod.NPCs.Perforator else if (NPC.velocity.Y > targetY) NPC.velocity.Y -= speedCopy * 1.1f; - if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < fallSpeed * 0.5) + if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < maxChargeSpeed * 0.5) { if (NPC.velocity.X > 0f) NPC.velocity.X += speedCopy; @@ -393,6 +422,19 @@ namespace CalamityMod.NPCs.Perforator } } + // Calculate contact damage based on velocity + float minimalContactDamageVelocity = maxChargeSpeed * 0.25f; + float minimalDamageVelocity = maxChargeSpeed * 0.5f; + if (NPC.velocity.Length() <= minimalContactDamageVelocity) + { + NPC.damage = (int)Math.Round(NPC.defDamage * 0.5); + } + else + { + float velocityDamageScalar = MathHelper.Clamp((NPC.velocity.Length() - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); + NPC.damage = (int)MathHelper.Lerp((float)Math.Round(NPC.defDamage * 0.5), NPC.defDamage, velocityDamageScalar); + } + NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X) + MathHelper.PiOver2; if (shouldFly) @@ -409,6 +451,7 @@ namespace CalamityMod.NPCs.Perforator NPC.localAI[0] = 0f; } + if (((NPC.velocity.X > 0f && NPC.oldVelocity.X < 0f) || (NPC.velocity.X < 0f && NPC.oldVelocity.X > 0f) || (NPC.velocity.Y > 0f && NPC.oldVelocity.Y < 0f) || (NPC.velocity.Y < 0f && NPC.oldVelocity.Y > 0f)) && !NPC.justHit) NPC.netUpdate = true; } @@ -430,7 +473,7 @@ namespace CalamityMod.NPCs.Perforator drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/Perforator/PerforatorHeadMediumGlow").Value; + texture2D15 = GlowTexture.Value; Color glowmaskColor = Color.Lerp(Color.White, Color.Yellow, 0.5f); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); diff --git a/NPCs/Perforator/PerforatorHeadSmall.cs b/NPCs/Perforator/PerforatorHeadSmall.cs index dd79644dc6..8d341da595 100644 --- a/NPCs/Perforator/PerforatorHeadSmall.cs +++ b/NPCs/Perforator/PerforatorHeadSmall.cs @@ -1,22 +1,28 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using System.IO; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; +using ReLogic.Content; using Terraria; +using Terraria.Audio; using Terraria.GameContent; using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.NPCs.Perforator { [AutoloadBossHead] public class PerforatorHeadSmall : ModNPC { + public static readonly SoundStyle HitSound = new("CalamityMod/Sounds/NPCHit/PerfSmallHit", 3); + public static readonly SoundStyle DeathSound = new("CalamityMod/Sounds/NPCKilled/PerfSmallDeath"); + + public static Asset GlowTexture; + private int biomeEnrageTimer = CalamityGlobalNPC.biomeEnrageTimerMax; private const int MsgType = 23; private bool TailSpawned = false; @@ -24,7 +30,7 @@ namespace CalamityMod.NPCs.Perforator public override void SetStaticDefaults() { NPCID.Sets.BossBestiaryPriority.Add(Type); - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { Scale = 0.8f, PortraitScale = 0.8f, @@ -35,6 +41,10 @@ namespace CalamityMod.NPCs.Perforator value.Position.X += 60; value.Position.Y += 50; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -45,7 +55,11 @@ namespace CalamityMod.NPCs.Perforator NPC.npcSlots = 5f; NPC.width = 42; NPC.height = 62; - NPC.LifeMaxNERB(1000, 1200, 50000); + + NPC.LifeMaxNERB(1200, 1440, 50000); + if (Main.zenithWorld) + NPC.lifeMax *= 4; + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); NPC.aiStyle = -1; @@ -55,8 +69,8 @@ namespace CalamityMod.NPCs.Perforator NPC.behindTiles = true; NPC.noGravity = true; NPC.noTileCollide = true; - NPC.HitSound = SoundID.NPCHit1; - NPC.DeathSound = SoundID.NPCDeath1; + NPC.HitSound = HitSound; + NPC.DeathSound = DeathSound; NPC.netAlways = true; if (BossRushEvent.BossRushActive) @@ -71,6 +85,10 @@ namespace CalamityMod.NPCs.Perforator NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -78,11 +96,11 @@ namespace CalamityMod.NPCs.Perforator int associatedNPCType = ModContent.NPCType(); bestiaryEntry.UIInfoProvider = new CommonEnemyUICollectionInfoProvider(ContentSamples.NpcBestiaryCreditIdsByNpcNetIds[associatedNPCType], quickUnlock: true); - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.TheCrimson, BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.UndergroundCrimson, - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Perforator") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Perforator") }); } @@ -161,13 +179,10 @@ namespace CalamityMod.NPCs.Perforator { int lol; if (segments >= 0 && segments < maxLength - 1) - { - lol = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.position.X + (NPC.width / 2), (int)NPC.position.Y + (NPC.height / 2), ModContent.NPCType(), NPC.whoAmI); - } + lol = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType(), NPC.whoAmI); else - { - lol = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.position.X + (NPC.width / 2), (int)NPC.position.Y + (NPC.height / 2), ModContent.NPCType(), NPC.whoAmI); - } + lol = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType(), NPC.whoAmI); + Main.npc[lol].realLife = NPC.whoAmI; Main.npc[lol].ai[2] = NPC.whoAmI; Main.npc[lol].ai[1] = Previous; @@ -175,6 +190,7 @@ namespace CalamityMod.NPCs.Perforator NetMessage.SendData(MsgType, -1, -1, null, lol, 0f, 0f, 0f, 0); Previous = lol; } + TailSpawned = true; } } @@ -184,21 +200,14 @@ namespace CalamityMod.NPCs.Perforator int tilePositionY = (int)(NPC.position.Y / 16f) - 1; int tileWidthPosY = (int)((NPC.position.Y + (float)NPC.height) / 16f) + 2; if (tilePositionX < 0) - { tilePositionX = 0; - } if (tileWidthPosX > Main.maxTilesX) - { tileWidthPosX = Main.maxTilesX; - } if (tilePositionY < 0) - { tilePositionY = 0; - } if (tileWidthPosY > Main.maxTilesY) - { tileWidthPosY = Main.maxTilesY; - } + bool shouldFly = false; if (!shouldFly) { @@ -220,15 +229,16 @@ namespace CalamityMod.NPCs.Perforator } } } + if (!shouldFly) { NPC.localAI[1] = 1f; Rectangle rectangle = new Rectangle((int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height); - int stopFlyingRadius = death ? 160 : revenge ? 200 : expertMode ? 240 : 300; + int stopFlyingRadius = death ? 320 : revenge ? 400 : expertMode ? 480 : 600; bool outsideFlyRadius = true; if (NPC.position.Y > player.position.Y) { - for (int m = 0; m < 255; m++) + for (int m = 0; m < Main.maxPlayers; m++) { if (Main.player[m].active) { @@ -240,59 +250,58 @@ namespace CalamityMod.NPCs.Perforator } } } + if (outsideFlyRadius) - { shouldFly = true; - } } } else - { NPC.localAI[1] = 0f; - } + float maxChargeSpeed = 16f; if (player.dead || CalamityGlobalNPC.perfHive < 0 || !Main.npc[CalamityGlobalNPC.perfHive].active) { shouldFly = false; NPC.velocity.Y += 1f; - if ((double)NPC.position.Y > Main.worldSurface * 16.0) + if ((double)NPC.position.Y > Main.worldSurface * 16D) { NPC.velocity.Y += 1f; - maxChargeSpeed = 32f; + maxChargeSpeed *= 2f; } - if ((double)NPC.position.Y > Main.rockLayer * 16.0) + + if ((double)NPC.position.Y > Main.rockLayer * 16D) { for (int a = 0; a < Main.maxNPCs; a++) { - if (Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || - Main.npc[a].type == ModContent.NPCType()) - { + if (Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType()) Main.npc[a].active = false; - } } } } if (Main.zenithWorld && CalamityGlobalNPC.perfHive >= 0) NPC.ai[0]++; - - //GFB movement + + // GFB movement if (NPC.ai[0] >= 300f && CalamityGlobalNPC.perfHive >= 0) { shouldFly = false; - + NPC Hive = Main.npc[CalamityGlobalNPC.perfHive]; Vector2 targetDistance = Hive.Center - NPC.Center; float velocity = 16f; float acceleration = 0.15f; - //Move towards the hive really quickly + + // Move towards the hive really quickly if (targetDistance.Length() > 32f) + { CalamityUtils.SmoothMovement(NPC, 0f, targetDistance, velocity, acceleration, true); + } else { - //Go and succ it + // Go and succ it NPC.Center = Hive.Center + (Vector2.UnitY * 4f).RotatedBy(NPC.rotation); - Hive.localAI[1]++; + Hive.localAI[1] += 1f; } if (NPC.ai[0] >= 600f) @@ -301,14 +310,14 @@ namespace CalamityMod.NPCs.Perforator Hive.localAI[1] = 0f; } } - //Normal movement + // Normal movement else { float speedCopy = speed; float turnSpeedCopy = turnSpeed; - Vector2 npcCenter = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); - float targetX = player.position.X + (float)(player.width / 2); - float targetY = player.position.Y + (float)(player.height / 2); + Vector2 npcCenter = NPC.Center; + float targetX = player.Center.X; + float targetY = player.Center.Y; targetX = (float)((int)(targetX / 16f) * 16); targetY = (float)((int)(targetY / 16f) * 16); npcCenter.X = (float)((int)(npcCenter.X / 16f) * 16); @@ -319,43 +328,42 @@ namespace CalamityMod.NPCs.Perforator if (!shouldFly) { NPC.TargetClosest(true); - NPC.velocity.Y = NPC.velocity.Y + 0.15f; + NPC.velocity.Y += 0.15f; if (NPC.velocity.Y > maxChargeSpeed) - { NPC.velocity.Y = maxChargeSpeed; - } + + // This bool exists to stop the strange wiggle behavior when worms are falling down + bool slowXVelocity = Math.Abs(NPC.velocity.X) > speedCopy; if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)maxChargeSpeed * 0.4) { if (NPC.velocity.X < 0f) - { - NPC.velocity.X = NPC.velocity.X - speedCopy * 1.1f; - } + NPC.velocity.X -= speedCopy * 1.1f; else - { - NPC.velocity.X = NPC.velocity.X + speedCopy * 1.1f; - } + NPC.velocity.X += speedCopy * 1.1f; } else if (NPC.velocity.Y == maxChargeSpeed) { - if (NPC.velocity.X < targetX) + if (slowXVelocity) { - NPC.velocity.X = NPC.velocity.X + speedCopy; - } - else if (NPC.velocity.X > targetX) - { - NPC.velocity.X = NPC.velocity.X - speedCopy; + if (NPC.velocity.X < targetX) + NPC.velocity.X += speedCopy; + else if (NPC.velocity.X > targetX) + NPC.velocity.X -= speedCopy; } + else + NPC.velocity.X = 0f; } else if (NPC.velocity.Y > 4f) { - if (NPC.velocity.X < 0f) + if (slowXVelocity) { - NPC.velocity.X = NPC.velocity.X + speedCopy * 0.9f; + if (NPC.velocity.X < 0f) + NPC.velocity.X += speedCopy * 0.9f; + else + NPC.velocity.X -= speedCopy * 0.9f; } else - { - NPC.velocity.X = NPC.velocity.X - speedCopy * 0.9f; - } + NPC.velocity.X = 0f; } } else @@ -364,16 +372,14 @@ namespace CalamityMod.NPCs.Perforator { float soundDelay = targetDistance / 40f; if (soundDelay < 10f) - { soundDelay = 10f; - } if (soundDelay > 20f) - { soundDelay = 20f; - } + NPC.soundDelay = (int)soundDelay; SoundEngine.PlaySound(SoundID.WormDig, NPC.Center); } + targetDistance = (float)Math.Sqrt((double)(targetX * targetX + targetY * targetY)); float absoluteTargetX = Math.Abs(targetX); float absoluteTargetY = Math.Abs(targetY); @@ -383,130 +389,108 @@ namespace CalamityMod.NPCs.Perforator if (((NPC.velocity.X > 0f && targetX > 0f) || (NPC.velocity.X < 0f && targetX < 0f)) && ((NPC.velocity.Y > 0f && targetY > 0f) || (NPC.velocity.Y < 0f && targetY < 0f))) { if (NPC.velocity.X < targetX) - { - NPC.velocity.X = NPC.velocity.X + turnSpeedCopy; - } + NPC.velocity.X += turnSpeedCopy; else if (NPC.velocity.X > targetX) - { - NPC.velocity.X = NPC.velocity.X - turnSpeedCopy; - } + NPC.velocity.X -= turnSpeedCopy; + if (NPC.velocity.Y < targetY) - { - NPC.velocity.Y = NPC.velocity.Y + turnSpeedCopy; - } + NPC.velocity.Y += turnSpeedCopy; else if (NPC.velocity.Y > targetY) - { - NPC.velocity.Y = NPC.velocity.Y - turnSpeedCopy; - } + NPC.velocity.Y -= turnSpeedCopy; } if ((NPC.velocity.X > 0f && targetX > 0f) || (NPC.velocity.X < 0f && targetX < 0f) || (NPC.velocity.Y > 0f && targetY > 0f) || (NPC.velocity.Y < 0f && targetY < 0f)) { if (NPC.velocity.X < targetX) - { - NPC.velocity.X = NPC.velocity.X + speedCopy; - } + NPC.velocity.X += speedCopy; else if (NPC.velocity.X > targetX) - { - NPC.velocity.X = NPC.velocity.X - speedCopy; - } + NPC.velocity.X -= speedCopy; + if (NPC.velocity.Y < targetY) - { - NPC.velocity.Y = NPC.velocity.Y + speedCopy; - } + NPC.velocity.Y += speedCopy; else if (NPC.velocity.Y > targetY) - { - NPC.velocity.Y = NPC.velocity.Y - speedCopy; - } + NPC.velocity.Y -= speedCopy; + if ((double)Math.Abs(targetY) < (double)maxChargeSpeed * 0.2 && ((NPC.velocity.X > 0f && targetX < 0f) || (NPC.velocity.X < 0f && targetX > 0f))) { if (NPC.velocity.Y > 0f) - { - NPC.velocity.Y = NPC.velocity.Y + speedCopy * 2f; - } + NPC.velocity.Y += speedCopy * 2f; else - { - NPC.velocity.Y = NPC.velocity.Y - speedCopy * 2f; - } + NPC.velocity.Y -= speedCopy * 2f; } + if ((double)Math.Abs(targetX) < (double)maxChargeSpeed * 0.2 && ((NPC.velocity.Y > 0f && targetY < 0f) || (NPC.velocity.Y < 0f && targetY > 0f))) { if (NPC.velocity.X > 0f) - { - NPC.velocity.X = NPC.velocity.X + speedCopy * 2f; - } + NPC.velocity.X += speedCopy * 2f; else - { - NPC.velocity.X = NPC.velocity.X - speedCopy * 2f; - } + NPC.velocity.X -= speedCopy * 2f; } } else if (absoluteTargetX > absoluteTargetY) { if (NPC.velocity.X < targetX) - { - NPC.velocity.X = NPC.velocity.X + speedCopy * 1.1f; - } + NPC.velocity.X += speedCopy * 1.1f; else if (NPC.velocity.X > targetX) - { - NPC.velocity.X = NPC.velocity.X - speedCopy * 1.1f; - } + NPC.velocity.X -= speedCopy * 1.1f; + if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)maxChargeSpeed * 0.5) { if (NPC.velocity.Y > 0f) - { - NPC.velocity.Y = NPC.velocity.Y + speedCopy; - } + NPC.velocity.Y += speedCopy; else - { - NPC.velocity.Y = NPC.velocity.Y - speedCopy; - } + NPC.velocity.Y -= speedCopy; } } else { if (NPC.velocity.Y < targetY) - { - NPC.velocity.Y = NPC.velocity.Y + speedCopy * 1.1f; - } + NPC.velocity.Y += speedCopy * 1.1f; else if (NPC.velocity.Y > targetY) - { - NPC.velocity.Y = NPC.velocity.Y - speedCopy * 1.1f; - } + NPC.velocity.Y -= speedCopy * 1.1f; + if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)maxChargeSpeed * 0.5) { if (NPC.velocity.X > 0f) - { - NPC.velocity.X = NPC.velocity.X + speedCopy; - } + NPC.velocity.X += speedCopy; else - { - NPC.velocity.X = NPC.velocity.X - speedCopy; - } + NPC.velocity.X -= speedCopy; } } } } - NPC.rotation = (float)Math.Atan2((double)NPC.velocity.Y, (double)NPC.velocity.X) + 1.57f; + + // Calculate contact damage based on velocity + float minimalContactDamageVelocity = maxChargeSpeed * 0.25f; + float minimalDamageVelocity = maxChargeSpeed * 0.5f; + if (NPC.velocity.Length() <= minimalContactDamageVelocity) + { + NPC.damage = (int)Math.Round(NPC.defDamage * 0.5); + } + else + { + float velocityDamageScalar = MathHelper.Clamp((NPC.velocity.Length() - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); + NPC.damage = (int)MathHelper.Lerp((float)Math.Round(NPC.defDamage * 0.5), NPC.defDamage, velocityDamageScalar); + } + + NPC.rotation = (float)Math.Atan2((double)NPC.velocity.Y, (double)NPC.velocity.X) + MathHelper.PiOver2; + if (shouldFly) { if (NPC.localAI[0] != 1f) - { NPC.netUpdate = true; - } + NPC.localAI[0] = 1f; } else { if (NPC.localAI[0] != 0f) - { NPC.netUpdate = true; - } + NPC.localAI[0] = 0f; } + if (((NPC.velocity.X > 0f && NPC.oldVelocity.X < 0f) || (NPC.velocity.X < 0f && NPC.oldVelocity.X > 0f) || (NPC.velocity.Y > 0f && NPC.oldVelocity.Y < 0f) || (NPC.velocity.Y < 0f && NPC.oldVelocity.Y > 0f)) && !NPC.justHit) - { NPC.netUpdate = true; - } } public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) @@ -526,7 +510,7 @@ namespace CalamityMod.NPCs.Perforator glowmaskDrawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, glowmaskDrawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/Perforator/PerforatorHeadSmallGlow").Value; + texture2D15 = GlowTexture.Value; Color glowmaskColor = Color.Lerp(Color.White, Color.Yellow, 0.5f); spriteBatch.Draw(texture2D15, glowmaskDrawLocation, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); diff --git a/NPCs/Perforator/PerforatorHive.cs b/NPCs/Perforator/PerforatorHive.cs index 3a397a365e..92c52757ba 100644 --- a/NPCs/Perforator/PerforatorHive.cs +++ b/NPCs/Perforator/PerforatorHive.cs @@ -1,6 +1,9 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using System.IO; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Events; using CalamityMod.Items.Accessories; +using CalamityMod.Items.Ammo; using CalamityMod.Items.Armor.Vanity; using CalamityMod.Items.Fishing.BrimstoneCragCatches; using CalamityMod.Items.LoreItems; @@ -16,26 +19,31 @@ using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Items.Weapons.Summon; using CalamityMod.Projectiles.Boss; -using CalamityMod.Tiles.Ores; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; +using ReLogic.Content; using Terraria; +using Terraria.Audio; using Terraria.GameContent; using Terraria.GameContent.Bestiary; +using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using Terraria.GameContent.ItemDropRules; -using CalamityMod.Items.Ammo; namespace CalamityMod.NPCs.Perforator { [AutoloadBossHead] public class PerforatorHive : ModNPC { + public static readonly SoundStyle GeyserShoot = new("CalamityMod/Sounds/Custom/Perforator/PerfHiveShoot", 3); + public static readonly SoundStyle IchorShoot = new("CalamityMod/Sounds/Custom/Perforator/PerfHiveIchorShoot"); + public static readonly SoundStyle WormSpawn = new("CalamityMod/Sounds/Custom/Perforator/PerfHiveWormSpawn"); + public static readonly SoundStyle HitSound = new("CalamityMod/Sounds/NPCHit/PerfHiveHit", 3); + public static readonly SoundStyle DeathSound = new("CalamityMod/Sounds/NPCKilled/PerfHiveDeath"); + + public static Asset GlowTexture; + private int biomeEnrageTimer = CalamityGlobalNPC.biomeEnrageTimerMax; private bool small = false; private bool medium = false; @@ -46,9 +54,13 @@ namespace CalamityMod.NPCs.Perforator { Main.npcFrameCount[NPC.type] = 10; NPCID.Sets.BossBestiaryPriority.Add(Type); - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0); + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(); NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; - NPCID.Sets.MPAllowedEnemies[Type] = true; + NPCID.Sets.MPAllowedEnemies[Type] = true; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -59,7 +71,7 @@ namespace CalamityMod.NPCs.Perforator NPC.width = 110; NPC.height = 100; NPC.defense = 4; - NPC.LifeMaxNERB(5000, 6000, 270000); + NPC.LifeMaxNERB(6000, 7200, 270000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); NPC.aiStyle = -1; @@ -69,8 +81,8 @@ namespace CalamityMod.NPCs.Perforator NPC.boss = true; NPC.noGravity = true; NPC.noTileCollide = true; - NPC.HitSound = SoundID.NPCHit13; - NPC.DeathSound = SoundID.NPCDeath19; + NPC.HitSound = HitSound; + NPC.DeathSound = DeathSound; NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; @@ -78,11 +90,11 @@ namespace CalamityMod.NPCs.Perforator public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.TheCrimson, BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.UndergroundCrimson, - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.PerforatorHive") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.PerforatorHive") }); } @@ -127,16 +139,6 @@ namespace CalamityMod.NPCs.Perforator float blobPhaseGateValue = bossRush ? 450f : 600f; bool floatAboveToFireBlobs = NPC.ai[2] >= blobPhaseGateValue - 120f; - // Don't deal damage for 3 seconds after spawning or while firing blobs - NPC.damage = NPC.defDamage; - if (NPC.ai[1] < 180f || floatAboveToFireBlobs) - { - if (NPC.ai[1] < 180f) - NPC.ai[1] += 1f; - - NPC.damage = 0; - } - Player player = Main.player[NPC.target]; // Percent life remaining @@ -274,11 +276,11 @@ namespace CalamityMod.NPCs.Perforator NPC.TargetClosest(); - SoundEngine.PlaySound(SoundID.NPCDeath23, NPC.Center); + SoundEngine.PlaySound(WormSpawn, NPC.Center); for (int i = 0; i < 16; i++) { - int ichorDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 170, 0f, 0f, 100, default, 1f); + int ichorDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Ichor, 0f, 0f, 100, default, 1f); Main.dust[ichorDust].velocity *= 2f; if (Main.rand.NextBool()) { @@ -289,10 +291,10 @@ namespace CalamityMod.NPCs.Perforator for (int j = 0; j < 32; j++) { - int bloodDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 5, 0f, 0f, 100, default, 1.5f); + int bloodDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, 0f, 0f, 100, default, 1.5f); Main.dust[bloodDust].noGravity = true; Main.dust[bloodDust].velocity *= 3f; - bloodDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 5, 0f, 0f, 100, default, 1f); + bloodDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, 0f, 0f, 100, default, 1f); Main.dust[bloodDust].velocity *= 2f; } } @@ -327,11 +329,11 @@ namespace CalamityMod.NPCs.Perforator { NPC.ai[2] = 0f; - SoundEngine.PlaySound(SoundID.NPCDeath23, NPC.Center); + SoundEngine.PlaySound(IchorShoot, NPC.Center); for (int i = 0; i < 32; i++) { - int ichorDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 170, 0f, 0f, 100, default, 1f); + int ichorDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Ichor, 0f, 0f, 100, default, 1f); float dustVelocityYAdd = Math.Abs(Main.dust[ichorDust].velocity.Y) * 0.5f; if (Main.dust[ichorDust].velocity.Y < 0f) Main.dust[ichorDust].velocity.Y = 2f + dustVelocityYAdd; @@ -377,6 +379,9 @@ namespace CalamityMod.NPCs.Perforator // When firing blobs, float above the target and don't call any other projectile firing or movement code if (floatAboveToFireBlobs) { + // Avoid cheap bullshit + NPC.damage = 0; + if (revenge) Movement(player, 6f + velocityEnrageIncrease, 0.3f, 450f); else @@ -391,11 +396,11 @@ namespace CalamityMod.NPCs.Perforator if (NPC.localAI[0] >= (revenge ? 200f : 250f) + wormsAlive * 150f && NPC.position.Y + NPC.height < player.position.Y && Vector2.Distance(player.Center, NPC.Center) > 80f) { NPC.localAI[0] = 0f; - SoundEngine.PlaySound(SoundID.NPCHit20, NPC.Center); + SoundEngine.PlaySound(GeyserShoot, NPC.Center); for (int i = 0; i < 8; i++) { - int ichorDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 170, 0f, 0f, 100, default, 1f); + int ichorDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Ichor, 0f, 0f, 100, default, 1f); Main.dust[ichorDust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -406,10 +411,10 @@ namespace CalamityMod.NPCs.Perforator for (int j = 0; j < 16; j++) { - int bloodDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 5, 0f, 0f, 100, default, 1.5f); + int bloodDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, 0f, 0f, 100, default, 1.5f); Main.dust[bloodDust].noGravity = true; Main.dust[bloodDust].velocity *= 5f; - bloodDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 5, 0f, 0f, 100, default, 1f); + bloodDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, 0f, 0f, 100, default, 1f); Main.dust[bloodDust].velocity *= 2f; } @@ -438,6 +443,10 @@ namespace CalamityMod.NPCs.Perforator switch (wormsAlive) { case 0: + + // Set damage + NPC.damage = NPC.defDamage; + if (large || death) Movement(player, 11f + velocityEnrageIncrease, death ? 0.1125f : 0.0975f, 20f); else if (medium) @@ -446,23 +455,44 @@ namespace CalamityMod.NPCs.Perforator Movement(player, 9f + velocityEnrageIncrease, death ? 0.0975f : 0.0825f, 40f); else Movement(player, 8f + velocityEnrageIncrease, death ? 0.09f : 0.075f, 50f); + break; case 1: + + // Avoid cheap bullshit + NPC.damage = 0; + Movement(player, 6f + velocityEnrageIncrease, 0.15f, 350f); + break; case 2: + + // Avoid cheap bullshit + NPC.damage = 0; + Movement(player, 6f + velocityEnrageIncrease, 0.15f, 275f); + break; case 3: + + // Avoid cheap bullshit + NPC.damage = 0; + Movement(player, 6f + velocityEnrageIncrease, 0.15f, 200f); + break; } } else + { + // Avoid cheap bullshit + NPC.damage = 0; + Movement(player, 6f + velocityEnrageIncrease, 0.075f, 350f); + } } private void Movement(Player target, float velocity, float acceleration, float y) @@ -494,7 +524,7 @@ namespace CalamityMod.NPCs.Perforator drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/Perforator/PerforatorHiveGlow").Value; + texture2D15 = GlowTexture.Value; Color glowmaskColor = Color.Lerp(Color.White, Color.Yellow, 0.5f); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); @@ -504,7 +534,7 @@ namespace CalamityMod.NPCs.Perforator public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { - NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } @@ -542,16 +572,16 @@ namespace CalamityMod.NPCs.Perforator var normalOnly = npcLoot.DefineNormalOnlyDropSet(); { // Weapons and such - normalOnly.Add(DropHelper.CalamityStyle(DropHelper.NormalWeaponDropRateFraction, new WeightedItemStack[] - { + normalOnly.Add(DropHelper.CalamityStyle(DropHelper.NormalWeaponDropRateFraction, new WeightedItemStack[] + { ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), - new WeightedItemStack(ModContent.ItemType(), 1f, 30, 50), - })); + new WeightedItemStack(ModContent.ItemType(), 1f, 30, 50), + })); // Materials normalOnly.Add(ItemID.CrimtaneBar, 1, 10, 15); @@ -561,7 +591,7 @@ namespace CalamityMod.NPCs.Perforator normalOnly.Add(ItemDropRule.ByCondition(DropHelper.Hardmode(), ItemID.Ichor, 1, 10, 20)); // Equipment - normalOnly.Add(ModContent.ItemType(), DropHelper.NormalWeaponDropRateFraction); + normalOnly.Add(ModContent.ItemType(), DropHelper.NormalWeaponDropRateFraction); normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); // Vanity @@ -611,7 +641,7 @@ namespace CalamityMod.NPCs.Perforator NPC.position.Y = NPC.position.Y - (float)(NPC.height / 2); for (int i = 0; i < 40; i++) { - int ichorDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 5, 0f, 0f, 100, default, 2f); + int ichorDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, 0f, 0f, 100, default, 2f); Main.dust[ichorDust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -621,10 +651,10 @@ namespace CalamityMod.NPCs.Perforator } for (int j = 0; j < 70; j++) { - int bloodDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 5, 0f, 0f, 100, default, 3f); + int bloodDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, 0f, 0f, 100, default, 3f); Main.dust[bloodDust].noGravity = true; Main.dust[bloodDust].velocity *= 5f; - bloodDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 5, 0f, 0f, 100, default, 2f); + bloodDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, 0f, 0f, 100, default, 2f); Main.dust[bloodDust].velocity *= 2f; } } diff --git a/NPCs/Perforator/PerforatorTailLarge.cs b/NPCs/Perforator/PerforatorTailLarge.cs index decd23463b..df4536e71a 100644 --- a/NPCs/Perforator/PerforatorTailLarge.cs +++ b/NPCs/Perforator/PerforatorTailLarge.cs @@ -3,7 +3,9 @@ using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; +using Terraria.Audio; using Terraria.GameContent; using Terraria.ID; using Terraria.Localization; @@ -13,10 +15,19 @@ namespace CalamityMod.NPCs.Perforator { public class PerforatorTailLarge : ModNPC { + public static readonly SoundStyle HitSound = new("CalamityMod/Sounds/NPCHit/PerfLargeHit", 3); + public static readonly SoundStyle DeathSound = new("CalamityMod/Sounds/NPCKilled/PerfLargeDeath"); + + public static Asset GlowTexture; + public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.PerforatorHeadLarge.DisplayName"); public override void SetStaticDefaults() { this.HideFromBestiary(); + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -25,7 +36,11 @@ namespace CalamityMod.NPCs.Perforator NPC.width = 60; NPC.height = 78; NPC.defense = 12; - NPC.LifeMaxNERB(2250, 2700, 80000); + + NPC.LifeMaxNERB(2700, 3240, 80000); + if (Main.zenithWorld) + NPC.lifeMax *= 4; + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); NPC.aiStyle = -1; @@ -35,9 +50,8 @@ namespace CalamityMod.NPCs.Perforator NPC.behindTiles = true; NPC.noGravity = true; NPC.noTileCollide = true; - NPC.canGhostHeal = false; - NPC.HitSound = SoundID.NPCHit1; - NPC.DeathSound = SoundID.NPCDeath1; + NPC.HitSound = HitSound; + NPC.DeathSound = DeathSound; NPC.netAlways = true; NPC.dontCountMe = true; @@ -53,6 +67,10 @@ namespace CalamityMod.NPCs.Perforator NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) @@ -102,9 +120,9 @@ namespace CalamityMod.NPCs.Perforator if (Main.player[NPC.target].dead) NPC.TargetClosest(false); - Vector2 segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); - float targetX = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); - float targetY = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2); + Vector2 segmentPosition = NPC.Center; + float targetX = Main.player[NPC.target].Center.X; + float targetY = Main.player[NPC.target].Center.Y; targetX = (float)((int)(targetX / 16f) * 16); targetY = (float)((int)(targetY / 16f) * 16); segmentPosition.X = (float)((int)(segmentPosition.X / 16f) * 16); @@ -116,28 +134,44 @@ namespace CalamityMod.NPCs.Perforator { try { - segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); - targetX = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - segmentPosition.X; - targetY = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - segmentPosition.Y; + segmentPosition = NPC.Center; + targetX = Main.npc[(int)NPC.ai[1]].Center.X - segmentPosition.X; + targetY = Main.npc[(int)NPC.ai[1]].Center.Y - segmentPosition.Y; } catch { } - NPC.rotation = (float)System.Math.Atan2((double)targetY, (double)targetX) + 1.57f; + + NPC.rotation = (float)System.Math.Atan2((double)targetY, (double)targetX) + MathHelper.PiOver2; targetDistance = (float)System.Math.Sqrt((double)(targetX * targetX + targetY * targetY)); int npcWidth = NPC.width; targetDistance = (targetDistance - (float)npcWidth) / targetDistance; targetX *= targetDistance; targetY *= targetDistance; NPC.velocity = Vector2.Zero; - NPC.position.X = NPC.position.X + targetX; - NPC.position.Y = NPC.position.Y + targetY; + NPC.position.X += targetX; + NPC.position.Y += targetY; if (targetX < 0f) NPC.spriteDirection = 1; else if (targetX > 0f) NPC.spriteDirection = -1; } + + // Calculate contact damage based on velocity + float maxChaseSpeed = 16f; + float minimalContactDamageVelocity = maxChaseSpeed * 0.25f; + float minimalDamageVelocity = maxChaseSpeed * 0.5f; + float bodyAndTailVelocity = (NPC.position - NPC.oldPosition).Length(); + if (bodyAndTailVelocity <= minimalContactDamageVelocity) + { + NPC.damage = 0; + } + else + { + float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); + NPC.damage = (int)MathHelper.Lerp(0f, NPC.defDamage, velocityDamageScalar); + } } public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) @@ -154,7 +188,7 @@ namespace CalamityMod.NPCs.Perforator drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/Perforator/PerforatorTailLargeGlow").Value; + texture2D15 = GlowTexture.Value; Color glowmaskColor = Color.Lerp(Color.White, Color.Yellow, 0.5f); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); diff --git a/NPCs/Perforator/PerforatorTailMedium.cs b/NPCs/Perforator/PerforatorTailMedium.cs index a87c5bab46..6880426acc 100644 --- a/NPCs/Perforator/PerforatorTailMedium.cs +++ b/NPCs/Perforator/PerforatorTailMedium.cs @@ -1,11 +1,13 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Events; using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; +using ReLogic.Content; using Terraria; +using Terraria.Audio; using Terraria.GameContent; using Terraria.ID; using Terraria.Localization; @@ -15,10 +17,19 @@ namespace CalamityMod.NPCs.Perforator { public class PerforatorTailMedium : ModNPC { + public static readonly SoundStyle HitSound = new("CalamityMod/Sounds/NPCHit/PerfMediumHit", 3); + public static readonly SoundStyle DeathSound = new("CalamityMod/Sounds/NPCKilled/PerfMediumDeath"); + + public static Asset GlowTexture; + public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.PerforatorHeadMedium.DisplayName"); public override void SetStaticDefaults() { this.HideFromBestiary(); + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -28,7 +39,11 @@ namespace CalamityMod.NPCs.Perforator NPC.width = 40; NPC.height = 50; NPC.defense = 10; - NPC.LifeMaxNERB(150, 180, 7000); + + NPC.LifeMaxNERB(180, 216, 7000); + if (Main.zenithWorld) + NPC.lifeMax *= 4; + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); NPC.aiStyle = -1; @@ -38,9 +53,8 @@ namespace CalamityMod.NPCs.Perforator NPC.behindTiles = true; NPC.noGravity = true; NPC.noTileCollide = true; - NPC.canGhostHeal = false; - NPC.HitSound = SoundID.NPCHit1; - NPC.DeathSound = SoundID.NPCDeath1; + NPC.HitSound = HitSound; + NPC.DeathSound = DeathSound; NPC.netAlways = true; NPC.dontCountMe = true; @@ -58,6 +72,10 @@ namespace CalamityMod.NPCs.Perforator NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void AI() @@ -102,9 +120,9 @@ namespace CalamityMod.NPCs.Perforator NetMessage.SendData(MessageID.DamageNPC, -1, -1, null, NPC.whoAmI, -1f, 0f, 0f, 0, 0, 0); } - Vector2 segmentDirection = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); - float targetX = Main.player[NPC.target].position.X + (Main.player[NPC.target].width / 2); - float targetY = Main.player[NPC.target].position.Y + (Main.player[NPC.target].height / 2); + Vector2 segmentDirection = NPC.Center; + float targetX = Main.player[NPC.target].Center.X; + float targetY = Main.player[NPC.target].Center.Y; targetX = (int)(targetX / 16f) * 16; targetY = (int)(targetY / 16f) * 16; @@ -118,9 +136,9 @@ namespace CalamityMod.NPCs.Perforator { try { - segmentDirection = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); - targetX = Main.npc[(int)NPC.ai[1]].position.X + (Main.npc[(int)NPC.ai[1]].width / 2) - segmentDirection.X; - targetY = Main.npc[(int)NPC.ai[1]].position.Y + (Main.npc[(int)NPC.ai[1]].height / 2) - segmentDirection.Y; + segmentDirection = NPC.Center; + targetX = Main.npc[(int)NPC.ai[1]].Center.X - segmentDirection.X; + targetY = Main.npc[(int)NPC.ai[1]].Center.Y - segmentDirection.Y; } catch { @@ -137,6 +155,22 @@ namespace CalamityMod.NPCs.Perforator NPC.position.X += targetX; NPC.position.Y += targetY; } + + // Calculate contact damage based on velocity + // This worm requires more velocity to deal damage with the body because it doesn't have spikes or metal bits or etc. + float maxChaseSpeed = 16f; + float minimalContactDamageVelocity = maxChaseSpeed * 0.4f; + float minimalDamageVelocity = maxChaseSpeed * 0.8f; + float bodyAndTailVelocity = (NPC.position - NPC.oldPosition).Length(); + if (bodyAndTailVelocity <= minimalContactDamageVelocity) + { + NPC.damage = 0; + } + else + { + float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); + NPC.damage = (int)MathHelper.Lerp(0f, NPC.defDamage, velocityDamageScalar); + } } public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) @@ -153,7 +187,7 @@ namespace CalamityMod.NPCs.Perforator drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/Perforator/PerforatorTailMediumGlow").Value; + texture2D15 = GlowTexture.Value; Color glowmaskColor = Color.Lerp(Color.White, Color.Yellow, 0.5f); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); @@ -191,7 +225,7 @@ namespace CalamityMod.NPCs.Perforator int closestPlayer = Player.FindClosest(NPC.Center, 1, 1); if (Main.rand.NextBool(4) && Main.player[closestPlayer].statLife < Main.player[closestPlayer].statLifeMax2) Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); - + if (Main.netMode != NetmodeID.MultiplayerClient && Main.zenithWorld) { int type = ModContent.ProjectileType(); diff --git a/NPCs/Perforator/PerforatorTailSmall.cs b/NPCs/Perforator/PerforatorTailSmall.cs index f64eadc007..7f5d26a183 100644 --- a/NPCs/Perforator/PerforatorTailSmall.cs +++ b/NPCs/Perforator/PerforatorTailSmall.cs @@ -3,7 +3,9 @@ using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; +using Terraria.Audio; using Terraria.GameContent; using Terraria.ID; using Terraria.Localization; @@ -13,10 +15,19 @@ namespace CalamityMod.NPCs.Perforator { public class PerforatorTailSmall : ModNPC { + public static readonly SoundStyle HitSound = new("CalamityMod/Sounds/NPCHit/PerfSmallHit", 3); + public static readonly SoundStyle DeathSound = new("CalamityMod/Sounds/NPCKilled/PerfSmallDeath"); + + public static Asset GlowTexture; + public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.PerforatorHeadSmall.DisplayName"); public override void SetStaticDefaults() { this.HideFromBestiary(); + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -25,7 +36,11 @@ namespace CalamityMod.NPCs.Perforator NPC.width = 40; NPC.height = 34; NPC.defense = 8; - NPC.LifeMaxNERB(1000, 1200, 50000); + + NPC.LifeMaxNERB(1200, 1440, 50000); + if (Main.zenithWorld) + NPC.lifeMax *= 4; + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); NPC.aiStyle = -1; @@ -35,9 +50,8 @@ namespace CalamityMod.NPCs.Perforator NPC.behindTiles = true; NPC.noGravity = true; NPC.noTileCollide = true; - NPC.canGhostHeal = false; - NPC.HitSound = SoundID.NPCHit1; - NPC.DeathSound = SoundID.NPCDeath1; + NPC.HitSound = HitSound; + NPC.DeathSound = DeathSound; NPC.netAlways = true; NPC.dontCountMe = true; @@ -53,6 +67,10 @@ namespace CalamityMod.NPCs.Perforator NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) @@ -102,9 +120,9 @@ namespace CalamityMod.NPCs.Perforator if (Main.player[NPC.target].dead) NPC.TargetClosest(false); - Vector2 segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); - float targetX = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); - float targetY = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2); + Vector2 segmentPosition = NPC.Center; + float targetX = Main.player[NPC.target].Center.X; + float targetY = Main.player[NPC.target].Center.Y; targetX = (float)((int)(targetX / 16f) * 16); targetY = (float)((int)(targetY / 16f) * 16); segmentPosition.X = (float)((int)(segmentPosition.X / 16f) * 16); @@ -116,28 +134,45 @@ namespace CalamityMod.NPCs.Perforator { try { - segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); - targetX = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - segmentPosition.X; - targetY = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - segmentPosition.Y; + segmentPosition = NPC.Center; + targetX = Main.npc[(int)NPC.ai[1]].Center.X - segmentPosition.X; + targetY = Main.npc[(int)NPC.ai[1]].Center.Y - segmentPosition.Y; } catch { } - NPC.rotation = (float)System.Math.Atan2((double)targetY, (double)targetX) + 1.57f; + + NPC.rotation = (float)System.Math.Atan2((double)targetY, (double)targetX) + MathHelper.PiOver2; targetDistance = (float)System.Math.Sqrt((double)(targetX * targetX + targetY * targetY)); int npcWidth = NPC.width; targetDistance = (targetDistance - (float)npcWidth) / targetDistance; targetX *= targetDistance; targetY *= targetDistance; NPC.velocity = Vector2.Zero; - NPC.position.X = NPC.position.X + targetX; - NPC.position.Y = NPC.position.Y + targetY; + NPC.position.X += targetX; + NPC.position.Y += targetY; if (targetX < 0f) NPC.spriteDirection = 1; else if (targetX > 0f) NPC.spriteDirection = -1; } + + // Calculate contact damage based on velocity + // This worm requires more velocity to deal damage with the body because it doesn't have spikes or metal bits or etc. + float maxChaseSpeed = 16f; + float minimalContactDamageVelocity = maxChaseSpeed * 0.4f; + float minimalDamageVelocity = maxChaseSpeed * 0.8f; + float bodyAndTailVelocity = (NPC.position - NPC.oldPosition).Length(); + if (bodyAndTailVelocity <= minimalContactDamageVelocity) + { + NPC.damage = 0; + } + else + { + float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); + NPC.damage = (int)MathHelper.Lerp(0f, NPC.defDamage, velocityDamageScalar); + } } public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) @@ -154,7 +189,7 @@ namespace CalamityMod.NPCs.Perforator drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/Perforator/PerforatorTailSmallGlow").Value; + texture2D15 = GlowTexture.Value; Color glowmaskColor = Color.Lerp(Color.White, Color.Yellow, 0.5f); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); diff --git a/NPCs/PlagueEnemies/Melter.cs b/NPCs/PlagueEnemies/Melter.cs index 29f7a5f612..bd097cbde3 100644 --- a/NPCs/PlagueEnemies/Melter.cs +++ b/NPCs/PlagueEnemies/Melter.cs @@ -2,13 +2,13 @@ using CalamityMod.Dusts; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Sounds; using Terraria; +using Terraria.Audio; using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.Utilities; -using Terraria.Audio; -using CalamityMod.Sounds; namespace CalamityMod.NPCs.PlagueEnemies { @@ -17,7 +17,7 @@ namespace CalamityMod.NPCs.PlagueEnemies public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 4; - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0); + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(); value.PortraitPositionYOverride = -32f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; } @@ -33,7 +33,7 @@ namespace CalamityMod.NPCs.PlagueEnemies NPC.height = 34; NPC.defense = 15; NPC.lifeMax = 500; - NPC.knockBackResist = 0f; + NPC.knockBackResist = 0.3f; NPC.value = Item.buyPrice(0, 0, 10, 0); NPC.HitSound = SoundID.NPCHit1; Banner = NPC.type; @@ -41,15 +41,19 @@ namespace CalamityMod.NPCs.PlagueEnemies NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = false; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Jungle, BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.UndergroundJungle, - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Melter") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Melter") }); } diff --git a/NPCs/PlagueEnemies/PestilentSlime.cs b/NPCs/PlagueEnemies/PestilentSlime.cs index 14511f8d49..e59ceb3545 100644 --- a/NPCs/PlagueEnemies/PestilentSlime.cs +++ b/NPCs/PlagueEnemies/PestilentSlime.cs @@ -1,18 +1,18 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Projectiles.Boss; +using CalamityMod.Sounds; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.GameContent.Bestiary; +using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.Utilities; -using Terraria.Audio; -using Terraria.GameContent.ItemDropRules; -using CalamityMod.Sounds; namespace CalamityMod.NPCs.PlagueEnemies { @@ -33,7 +33,7 @@ namespace CalamityMod.NPCs.PlagueEnemies NPC.height = 30; NPC.defense = 12; NPC.lifeMax = 350; - NPC.knockBackResist = 0f; + NPC.knockBackResist = 0.5f; AnimationType = NPCID.CorruptSlime; NPC.value = Item.buyPrice(0, 0, 10, 0); NPC.alpha = 60; @@ -45,15 +45,19 @@ namespace CalamityMod.NPCs.PlagueEnemies BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Jungle, BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.UndergroundJungle, - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.PestilentSlime") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.PestilentSlime") }); } @@ -76,18 +80,22 @@ namespace CalamityMod.NPCs.PlagueEnemies { NPC.velocity.X = NPC.velocity.X * 0.9f; } - if (Main.netMode != NetmodeID.MultiplayerClient && spikeTimer == 0f) + if (spikeTimer == 0f) { + int damage = Main.masterMode ? 16 : Main.expertMode ? 19 : 25; SoundEngine.PlaySound(SoundID.Item42, NPC.Center); - for (int n = 0; n < 5; n++) + if (Main.netMode != NetmodeID.MultiplayerClient) { - Vector2 spikeVelocity = new Vector2((float)(n - 2), -4f); - spikeVelocity.X *= 1f + (float)Main.rand.Next(-50, 51) * 0.005f; - spikeVelocity.Y *= 1f + (float)Main.rand.Next(-50, 51) * 0.005f; - spikeVelocity.Normalize(); - spikeVelocity *= 4f + (float)Main.rand.Next(-50, 51) * 0.01f; - Projectile.NewProjectile(NPC.GetSource_FromAI(), slimePosition.X, slimePosition.Y, spikeVelocity.X, spikeVelocity.Y, ModContent.ProjectileType(), 25, 0f, Main.myPlayer, 0f, 0f); - spikeTimer = 30f; + for (int n = 0; n < 5; n++) + { + Vector2 spikeVelocity = new Vector2((float)(n - 2), -4f); + spikeVelocity.X *= 1f + (float)Main.rand.Next(-50, 51) * 0.005f; + spikeVelocity.Y *= 1f + (float)Main.rand.Next(-50, 51) * 0.005f; + spikeVelocity.Normalize(); + spikeVelocity *= 4f + (float)Main.rand.Next(-50, 51) * 0.01f; + Projectile.NewProjectile(NPC.GetSource_FromAI(), slimePosition.X, slimePosition.Y, spikeVelocity.X, spikeVelocity.Y, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + spikeTimer = 30f; + } } } } @@ -98,8 +106,9 @@ namespace CalamityMod.NPCs.PlagueEnemies { NPC.velocity.X = NPC.velocity.X * 0.9f; } - if (Main.netMode != NetmodeID.MultiplayerClient && spikeTimer == 0f) + if (spikeTimer == 0f) { + int damage = Main.masterMode ? 14 : Main.expertMode ? 17 : 22; SoundEngine.PlaySound(SoundID.Item42, NPC.Center); targetYDist = Main.player[NPC.target].position.Y - slimePosition.Y - (float)Main.rand.Next(0, 200); targetDistance = (float)Math.Sqrt((double)(targetXDist * targetXDist + targetYDist * targetYDist)); @@ -107,7 +116,8 @@ namespace CalamityMod.NPCs.PlagueEnemies targetXDist *= targetDistance; targetYDist *= targetDistance; spikeTimer = 50f; - Projectile.NewProjectile(NPC.GetSource_FromAI(), slimePosition.X, slimePosition.Y, targetXDist, targetYDist, ModContent.ProjectileType(), 22, 0f, Main.myPlayer, 0f, 0f); + if (Main.netMode != NetmodeID.MultiplayerClient) + Projectile.NewProjectile(NPC.GetSource_FromAI(), slimePosition.X, slimePosition.Y, targetXDist, targetYDist, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); } } } diff --git a/NPCs/PlagueEnemies/PlagueCharger.cs b/NPCs/PlagueEnemies/PlagueCharger.cs index 53b533f68b..1f79c757cc 100644 --- a/NPCs/PlagueEnemies/PlagueCharger.cs +++ b/NPCs/PlagueEnemies/PlagueCharger.cs @@ -2,26 +2,33 @@ using CalamityMod.Dusts; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Sounds; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; +using Terraria.Audio; using Terraria.GameContent; using Terraria.GameContent.Bestiary; using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.Utilities; -using Terraria.Audio; -using CalamityMod.Sounds; namespace CalamityMod.NPCs.PlagueEnemies { public class PlagueCharger : ModNPC { + public static Asset GlowTexture; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 4; NPCID.Sets.TrailingMode[NPC.type] = 1; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -34,7 +41,7 @@ namespace CalamityMod.NPCs.PlagueEnemies NPC.lifeMax = 200; NPC.aiStyle = NPCAIStyleID.Flying; AIType = NPCID.Bee; - NPC.knockBackResist = 0f; + NPC.knockBackResist = 0.4f; AnimationType = NPCID.Bee; NPC.value = Item.buyPrice(0, 0, 5, 0); NPC.HitSound = SoundID.NPCHit4; @@ -44,11 +51,15 @@ namespace CalamityMod.NPCs.PlagueEnemies BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToElectricity = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Jungle, BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.UndergroundJungle, @@ -86,7 +97,7 @@ namespace CalamityMod.NPCs.PlagueEnemies drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/PlagueEnemies/PlagueChargerGlow").Value; + texture2D15 = GlowTexture.Value; Color redEyeColor = Color.Lerp(Color.White, Color.Red, 0.5f); if (CalamityConfig.Instance.Afterimages) diff --git a/NPCs/PlagueEnemies/PlagueChargerLarge.cs b/NPCs/PlagueEnemies/PlagueChargerLarge.cs index e8342aa68f..c6b4e66b75 100644 --- a/NPCs/PlagueEnemies/PlagueChargerLarge.cs +++ b/NPCs/PlagueEnemies/PlagueChargerLarge.cs @@ -2,18 +2,18 @@ using CalamityMod.Dusts; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Sounds; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.GameContent; using Terraria.GameContent.Bestiary; +using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; using Terraria.ModLoader.Utilities; -using Terraria.Audio; -using Terraria.GameContent.ItemDropRules; -using CalamityMod.Sounds; namespace CalamityMod.NPCs.PlagueEnemies { @@ -36,7 +36,7 @@ namespace CalamityMod.NPCs.PlagueEnemies NPC.lifeMax = 300; NPC.aiStyle = NPCAIStyleID.Flying; AIType = NPCID.Bee; - NPC.knockBackResist = 0f; + NPC.knockBackResist = 0.3f; AnimationType = NPCID.Bee; NPC.value = Item.buyPrice(0, 0, 10, 0); NPC.HitSound = SoundID.NPCHit4; @@ -46,11 +46,15 @@ namespace CalamityMod.NPCs.PlagueEnemies BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToElectricity = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Jungle, BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.UndergroundJungle, diff --git a/NPCs/PlagueEnemies/PlaguebringerMiniboss.cs b/NPCs/PlagueEnemies/PlaguebringerMiniboss.cs index 78e7b7d9d7..d403dd897b 100644 --- a/NPCs/PlagueEnemies/PlaguebringerMiniboss.cs +++ b/NPCs/PlagueEnemies/PlaguebringerMiniboss.cs @@ -1,21 +1,21 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using CalamityMod.Items.Pets; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Projectiles.Boss; -using CalamityMod.Items.Accessories; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; using Terraria.GameContent; using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.Utilities; -using Terraria.Audio; namespace CalamityMod.NPCs.PlagueEnemies { @@ -25,7 +25,7 @@ namespace CalamityMod.NPCs.PlagueEnemies { Main.npcFrameCount[NPC.type] = 12; NPCID.Sets.TrailingMode[NPC.type] = 1; - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { Scale = 0.7f, PortraitScale = 0.8f, @@ -43,7 +43,7 @@ namespace CalamityMod.NPCs.PlagueEnemies NPC.height = 66; NPC.defense = 24; NPC.DR_NERD(0.2f); - NPC.lifeMax = 3000; + NPC.lifeMax = 8750; NPC.value = Item.buyPrice(0, 1, 50, 0); NPC.knockBackResist = 0f; NPC.aiStyle = -1; @@ -61,64 +61,63 @@ namespace CalamityMod.NPCs.PlagueEnemies { NPC.scale = 2f; } + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Jungle, BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.UndergroundJungle, - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.PlaguebringerMiniboss") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.PlaguebringerMiniboss") }); } public override void AI() { - Lighting.AddLight((int)((NPC.position.X + (float)(NPC.width / 2)) / 16f), (int)((NPC.position.Y + (float)(NPC.height / 2)) / 16f), 0.1f, 0.3f, 0f); + Lighting.AddLight((int)(NPC.Center.X / 16f), (int)(NPC.Center.Y / 16f), 0.1f, 0.3f, 0f); + bool outsideJungle = false; if (!Main.player[NPC.target].ZoneJungle) { outsideJungle = true; if (NPC.timeLeft > 150) - { NPC.timeLeft = 150; - } } else { if (NPC.timeLeft < 750) - { NPC.timeLeft = 750; - } } + int playerAmt = 0; - for (int i = 0; i < 255; i++) + for (int i = 0; i < Main.maxPlayers; i++) { if (Main.player[i].active && !Main.player[i].dead && (NPC.Center - Main.player[i].Center).Length() < 1000f) - { playerAmt++; - } } + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) - { NPC.TargetClosest(); - } + bool dead4 = Main.player[NPC.target].dead; if (dead4 && Main.expertMode) { - if ((double)NPC.position.Y < Main.worldSurface * 16.0 + 2000.0) - { - NPC.velocity.Y = NPC.velocity.Y + 0.04f; - } + // Avoid cheap bullshit + NPC.damage = 0; + + if ((double)NPC.position.Y < Main.worldSurface * 16D + 2000D) + NPC.velocity.Y += 0.04f; + if (NPC.position.X < (float)(Main.maxTilesX * 8)) - { - NPC.velocity.X = NPC.velocity.X - 0.04f; - } + NPC.velocity.X -= 0.04f; else - { - NPC.velocity.X = NPC.velocity.X + 0.04f; - } + NPC.velocity.X += 0.04f; + if (NPC.timeLeft > 10) { NPC.timeLeft = 10; @@ -131,18 +130,7 @@ namespace CalamityMod.NPCs.PlagueEnemies { float currentAttack = NPC.ai[1]; int nextAttack; - do - { - nextAttack = Main.rand.Next(3); - if (nextAttack == 1) - { - nextAttack = 2; - } - else if (nextAttack == 2) - { - nextAttack = 3; - } - } + do nextAttack = Main.rand.Next(2); while ((float)nextAttack == currentAttack); NPC.ai[0] = (float)nextAttack; NPC.ai[1] = 0f; @@ -152,11 +140,10 @@ namespace CalamityMod.NPCs.PlagueEnemies } else if (NPC.ai[0] == 0f) { - int chargeDelay = 2; //2 - if (outsideJungle) - { - chargeDelay += 1; - } + // Charging distance from player + int chargeDistanceX = (outsideJungle ? 500 : 750) - (CalamityWorld.death ? 100 : CalamityWorld.revenge ? 75 : Main.expertMode ? 50 : 0); + + int chargeDelay = outsideJungle ? 4 : 2; if (NPC.ai[1] > (float)(2 * chargeDelay) && NPC.ai[1] % 2f == 0f) { NPC.ai[0] = -1f; @@ -165,22 +152,29 @@ namespace CalamityMod.NPCs.PlagueEnemies NPC.netUpdate = true; return; } + if (NPC.ai[1] % 2f == 0f) { + // Avoid cheap bullshit + NPC.damage = 0; + NPC.TargetClosest(true); - if (Math.Abs(NPC.position.Y + (float)(NPC.height / 2) - (Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2))) < 20f) + + float chargeDistanceY = 20f; + float distanceFromTargetX = Math.Abs(NPC.Center.X - Main.player[NPC.target].Center.X); + float distanceFromTargetY = Math.Abs(NPC.Center.Y - Main.player[NPC.target].Center.Y); + if (distanceFromTargetY < chargeDistanceY && distanceFromTargetX >= chargeDistanceX) { + // Set damage + NPC.damage = NPC.defDamage; + NPC.localAI[0] = 1f; NPC.ai[1] += 1f; NPC.ai[2] = 0f; - float chargeSpeed = 15f; - if (outsideJungle) - { - chargeSpeed += 2f; - } - Vector2 chargeBeePos = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); - float chargeTargetX = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2) - chargeBeePos.X; - float chargeTargetY = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2) - chargeBeePos.Y; + float chargeSpeed = outsideJungle ? 36f : 24f; + Vector2 chargeBeePos = NPC.Center; + float chargeTargetX = Main.player[NPC.target].Center.X - chargeBeePos.X; + float chargeTargetY = Main.player[NPC.target].Center.Y - chargeBeePos.Y; float chargeTargetDist = (float)Math.Sqrt((double)(chargeTargetX * chargeTargetX + chargeTargetY * chargeTargetY)); chargeTargetDist = chargeSpeed / chargeTargetDist; NPC.velocity.X = chargeTargetX * chargeTargetDist; @@ -189,87 +183,87 @@ namespace CalamityMod.NPCs.PlagueEnemies SoundEngine.PlaySound(SoundID.Roar, NPC.Center); return; } + + // Velocity variables NPC.localAI[0] = 0f; - float lineUpSpeed = 12.25f; - float lineUpAcceleration = 0.155f; - if (outsideJungle) - { - lineUpSpeed += 1f; - lineUpAcceleration += 0.075f; - } - if (NPC.position.Y + (float)(NPC.height / 2) < Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2)) - { - NPC.velocity.Y = NPC.velocity.Y + lineUpAcceleration; - } + float chargeVelocityX = 16f; + float chargeVelocityY = outsideJungle ? 16f : 12f; + float chargeAccelerationX = 0.15f; + float chargeAccelerationY = outsideJungle ? 0.24f : 0.16f; + + // Velocity calculations + if (NPC.Center.Y < Main.player[NPC.target].Center.Y - chargeDistanceY) + NPC.velocity.Y += chargeAccelerationY; + else if (NPC.Center.Y > Main.player[NPC.target].Center.Y + chargeDistanceY) + NPC.velocity.Y -= chargeAccelerationY; else - { - NPC.velocity.Y = NPC.velocity.Y - lineUpAcceleration; - } - if (NPC.velocity.Y < -12f) - { - NPC.velocity.Y = -lineUpSpeed; - } - if (NPC.velocity.Y > 12f) - { - NPC.velocity.Y = lineUpSpeed; - } - if (Math.Abs(NPC.position.X + (float)(NPC.width / 2) - (Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2))) > 600f) - { - NPC.velocity.X = NPC.velocity.X + 0.15f * (float)NPC.direction; - } - else if (Math.Abs(NPC.position.X + (float)(NPC.width / 2) - (Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2))) < 300f) - { - NPC.velocity.X = NPC.velocity.X - 0.15f * (float)NPC.direction; - } + NPC.velocity.Y *= 0.7f; + + if (NPC.velocity.Y < -chargeVelocityY) + NPC.velocity.Y = -chargeVelocityY; + if (NPC.velocity.Y > chargeVelocityY) + NPC.velocity.Y = chargeVelocityY; + + float distanceXMax = 100f; + float distanceXMin = 20f; + if (distanceFromTargetX > chargeDistanceX + distanceXMax) + NPC.velocity.X += chargeAccelerationX * NPC.direction; + else if (distanceFromTargetX < chargeDistanceX + distanceXMin) + NPC.velocity.X -= chargeAccelerationX * NPC.direction; else - { - NPC.velocity.X = NPC.velocity.X * 0.8f; - } - if (NPC.velocity.X < -16f) - { - NPC.velocity.X = -16f; - } - if (NPC.velocity.X > 16f) - { - NPC.velocity.X = 16f; - } + NPC.velocity.X *= 0.8f; + + // Limit velocity + if (NPC.velocity.X < -chargeVelocityX) + NPC.velocity.X = -chargeVelocityX; + if (NPC.velocity.X > chargeVelocityX) + NPC.velocity.X = chargeVelocityX; + NPC.spriteDirection = NPC.direction; } else { + // Set damage + NPC.damage = NPC.defDamage; + if (NPC.velocity.X < 0f) - { NPC.direction = -1; - } else - { NPC.direction = 1; - } + NPC.spriteDirection = NPC.direction; + int chargeDirection = 1; - if (NPC.position.X + (float)(NPC.width / 2) < Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2)) - { + if (NPC.Center.X < Main.player[NPC.target].Center.X) chargeDirection = -1; - } - if (NPC.direction == chargeDirection && Math.Abs(NPC.position.X + (float)(NPC.width / 2) - (Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2))) > 500f) - { + + if (NPC.direction == chargeDirection && Math.Abs(NPC.Center.X - Main.player[NPC.target].Center.X) > chargeDistanceX) NPC.ai[2] = 1f; - } + if (Math.Abs(NPC.Center.Y - Main.player[NPC.target].Center.Y) > chargeDistanceX * 1.5f) + NPC.ai[2] = 1f; + if (NPC.ai[2] != 1f) { NPC.localAI[0] = 1f; return; } + + // Avoid cheap bullshit + NPC.damage = 0; + NPC.TargetClosest(true); NPC.spriteDirection = NPC.direction; + NPC.localAI[0] = 0f; + NPC.velocity *= 0.9f; - float chargeDeceleration = 0.105f; + float chargeDeceleration = 0.12f; if (outsideJungle) { NPC.velocity *= 0.9f; - chargeDeceleration += 0.075f; + chargeDeceleration += 0.08f; } + if (Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y) < chargeDeceleration) { NPC.ai[2] = 0f; @@ -277,291 +271,64 @@ namespace CalamityMod.NPCs.PlagueEnemies } } } - else if (NPC.ai[0] == 2f) - { - NPC.TargetClosest(true); - NPC.spriteDirection = NPC.direction; - float hoverForBeesSpeed = 12f; - float hoverForBeesAccel = 0.1f; - if (outsideJungle) - { - hoverForBeesAccel = 0.12f; - } - Vector2 hoverForBeesPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); - float hoverForBeesTargetX = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2) - hoverForBeesPosition.X; - float hoverForBeesTargetY = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2) - 200f - hoverForBeesPosition.Y; - float hoverForBeesTargetDist = (float)Math.Sqrt((double)(hoverForBeesTargetX * hoverForBeesTargetX + hoverForBeesTargetY * hoverForBeesTargetY)); - if (hoverForBeesTargetDist < 400f) - { - NPC.ai[0] = 1f; - NPC.ai[1] = 0f; - NPC.netUpdate = true; - return; - } - hoverForBeesTargetDist = hoverForBeesSpeed / hoverForBeesTargetDist; - if (NPC.velocity.X < hoverForBeesTargetX) - { - NPC.velocity.X = NPC.velocity.X + hoverForBeesAccel; - if (NPC.velocity.X < 0f && hoverForBeesTargetX > 0f) - { - NPC.velocity.X = NPC.velocity.X + hoverForBeesAccel; - } - } - else if (NPC.velocity.X > hoverForBeesTargetX) - { - NPC.velocity.X = NPC.velocity.X - hoverForBeesAccel; - if (NPC.velocity.X > 0f && hoverForBeesTargetX < 0f) - { - NPC.velocity.X = NPC.velocity.X - hoverForBeesAccel; - } - } - if (NPC.velocity.Y < hoverForBeesTargetY) - { - NPC.velocity.Y = NPC.velocity.Y + hoverForBeesAccel; - if (NPC.velocity.Y < 0f && hoverForBeesTargetY > 0f) - { - NPC.velocity.Y = NPC.velocity.Y + hoverForBeesAccel; - } - } - else if (NPC.velocity.Y > hoverForBeesTargetY) - { - NPC.velocity.Y = NPC.velocity.Y - hoverForBeesAccel; - if (NPC.velocity.Y > 0f && hoverForBeesTargetY < 0f) - { - NPC.velocity.Y = NPC.velocity.Y - hoverForBeesAccel; - } - } - } else if (NPC.ai[0] == 1f) { - NPC.localAI[0] = 0f; - NPC.TargetClosest(true); - Vector2 beeSpawnPosition = new Vector2(NPC.position.X + (float)(NPC.width / 2) + (float)(40 * NPC.direction), NPC.position.Y + (float)NPC.height * 0.8f); - Vector2 plaguebringerBeeSpawnPos = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); - float beeSpawnTargetX = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2) - plaguebringerBeeSpawnPos.X; - float beeSpawnTargetY = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2) - plaguebringerBeeSpawnPos.Y; - float beeSpawnTargetDist = (float)Math.Sqrt((double)(beeSpawnTargetX * beeSpawnTargetX + beeSpawnTargetY * beeSpawnTargetY)); + // Avoid cheap bullshit + NPC.damage = 0; + + float stingerAttackSpeed = outsideJungle ? 24f : 16f; + float stingerAttackAccel = outsideJungle ? 0.4f : 0.3f; + Vector2 stingerSpawnPos = new Vector2(NPC.Center.X + (float)(40 * NPC.direction), NPC.position.Y + (float)NPC.height * 0.8f); + Vector2 stingerAttackPos = NPC.Center; + float stingerAttackTargetX = Main.player[NPC.target].Center.X - stingerAttackPos.X; + float stingerAttackTargetY = Main.player[NPC.target].Center.Y - 300f - stingerAttackPos.Y; + float stingerAttackTargetDist = (float)Math.Sqrt((double)(stingerAttackTargetX * stingerAttackTargetX + stingerAttackTargetY * stingerAttackTargetY)); + + bool canHitTarget = Collision.CanHit(new Vector2(stingerSpawnPos.X, stingerSpawnPos.Y - 30f), 1, 1, Main.player[NPC.target].position, Main.player[NPC.target].width, Main.player[NPC.target].height); + Vector2 hoverDestination = Main.player[NPC.target].Center - Vector2.UnitY * (!canHitTarget ? 0f : 300f); + Vector2 idealVelocity = NPC.SafeDirectionTo(hoverDestination) * stingerAttackSpeed; + NPC.ai[1] += 1f; - NPC.ai[1] += (float)(playerAmt / 2); - bool canSpawnBee = false; - if (NPC.ai[1] > 10f) + float stingerGateValue = CalamityWorld.death ? 15f : CalamityWorld.revenge ? 20f : Main.expertMode ? 25f : 35f; + bool canFireStinger = false; + if (NPC.ai[1] % stingerGateValue == stingerGateValue - 1f) + canFireStinger = true; + + if (canFireStinger && NPC.position.Y + (float)NPC.height < Main.player[NPC.target].position.Y && Collision.CanHit(stingerSpawnPos, 1, 1, Main.player[NPC.target].position, Main.player[NPC.target].width, Main.player[NPC.target].height)) { - NPC.ai[1] = 0f; - NPC.ai[2] += 1f; - canSpawnBee = true; - } - if (Collision.CanHit(beeSpawnPosition, 1, 1, Main.player[NPC.target].position, Main.player[NPC.target].width, Main.player[NPC.target].height) && canSpawnBee) - { - SoundEngine.PlaySound(SoundID.NPCHit8, NPC.Center); + SoundEngine.PlaySound(SoundID.Item42, stingerSpawnPos); if (Main.netMode != NetmodeID.MultiplayerClient) { - int beeType; - if (Main.rand.NextBool(4)) - { - beeType = ModContent.NPCType(); - } - else - { - beeType = ModContent.NPCType(); - } - if (NPC.CountNPCS(ModContent.NPCType()) < 3) - { - int notTheBees = NPC.NewNPC(NPC.GetSource_FromAI(), (int)beeSpawnPosition.X, (int)beeSpawnPosition.Y, beeType, 0, 0f, 0f, 0f, 0f, 255); - Main.npc[notTheBees].velocity.X = (float)Main.rand.Next(-200, 201) * 0.005f; - Main.npc[notTheBees].velocity.Y = (float)Main.rand.Next(-200, 201) * 0.005f; - Main.npc[notTheBees].localAI[0] = 60f; - Main.npc[notTheBees].netUpdate = true; - } + float stingerSpeed = outsideJungle ? 8f : 6f; + float stingerTargetX = Main.player[NPC.target].Center.X - stingerSpawnPos.X; + float stingerTargetY = Main.player[NPC.target].Center.Y - stingerSpawnPos.Y; + float stingerTargetDist = (float)Math.Sqrt((double)(stingerTargetX * stingerTargetX + stingerTargetY * stingerTargetY)); + stingerTargetDist = stingerSpeed / stingerTargetDist; + stingerTargetX *= stingerTargetDist; + stingerTargetY *= stingerTargetDist; + int rocketChance = CalamityWorld.death ? 4 : CalamityWorld.revenge ? 7 : Main.expertMode ? 10 : 15; + bool fireRocket = Main.rand.NextBool(rocketChance); + int type = fireRocket ? ModContent.ProjectileType() : ModContent.ProjectileType(); + int damage = Main.masterMode ? (fireRocket ? 42 : 29) : Main.expertMode ? (fireRocket ? 50 : 35) : (fireRocket ? 72 : 52); + Projectile.NewProjectile(NPC.GetSource_FromAI(), stingerSpawnPos.X, stingerSpawnPos.Y, stingerTargetX, stingerTargetY, type, damage, 0f, Main.myPlayer); } } - if (beeSpawnTargetDist > 400f || !Collision.CanHit(new Vector2(beeSpawnPosition.X, beeSpawnPosition.Y - 30f), 1, 1, Main.player[NPC.target].position, Main.player[NPC.target].width, Main.player[NPC.target].height)) - { - float beeSpawnSpeed = 14.5f; - float beeSpawnAcceleration = 0.105f; - plaguebringerBeeSpawnPos = beeSpawnPosition; - beeSpawnTargetX = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2) - plaguebringerBeeSpawnPos.X; - beeSpawnTargetY = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2) - plaguebringerBeeSpawnPos.Y; - beeSpawnTargetDist = (float)Math.Sqrt((double)(beeSpawnTargetX * beeSpawnTargetX + beeSpawnTargetY * beeSpawnTargetY)); - beeSpawnTargetDist = beeSpawnSpeed / beeSpawnTargetDist; - if (NPC.velocity.X < beeSpawnTargetX) - { - NPC.velocity.X = NPC.velocity.X + beeSpawnAcceleration; - if (NPC.velocity.X < 0f && beeSpawnTargetX > 0f) - { - NPC.velocity.X = NPC.velocity.X + beeSpawnAcceleration; - } - } - else if (NPC.velocity.X > beeSpawnTargetX) - { - NPC.velocity.X = NPC.velocity.X - beeSpawnAcceleration; - if (NPC.velocity.X > 0f && beeSpawnTargetX < 0f) - { - NPC.velocity.X = NPC.velocity.X - beeSpawnAcceleration; - } - } - if (NPC.velocity.Y < beeSpawnTargetY) - { - NPC.velocity.Y = NPC.velocity.Y + beeSpawnAcceleration; - if (NPC.velocity.Y < 0f && beeSpawnTargetY > 0f) - { - NPC.velocity.Y = NPC.velocity.Y + beeSpawnAcceleration; - } - } - else if (NPC.velocity.Y > beeSpawnTargetY) - { - NPC.velocity.Y = NPC.velocity.Y - beeSpawnAcceleration; - if (NPC.velocity.Y > 0f && beeSpawnTargetY < 0f) - { - NPC.velocity.Y = NPC.velocity.Y - beeSpawnAcceleration; - } - } - } - else - { - NPC.velocity *= 0.9f; //changed from 0.9 - } - NPC.spriteDirection = NPC.direction; - if (NPC.ai[2] > 2f) + + // Movement calculations + if (Vector2.Distance(stingerSpawnPos, hoverDestination) > 40f || !canHitTarget) + NPC.SimpleFlyMovement(idealVelocity, stingerAttackAccel); + + float stingerPhaseTime = CalamityWorld.death ? 180f : CalamityWorld.revenge ? 240f : Main.expertMode ? 300f : 600f; + if (NPC.ai[1] > stingerPhaseTime) { NPC.ai[0] = -1f; NPC.ai[1] = 1f; NPC.netUpdate = true; } } - else if (NPC.ai[0] == 3f) - { - float stingerAttackSpeed = 7f; - float stingerAttackAccel = 0.075f; - if (outsideJungle) - { - stingerAttackAccel = 0.09f; - stingerAttackSpeed = 8f; - } - Vector2 stingerSpawnPos = new Vector2(NPC.position.X + (float)(NPC.width / 2) + (float)(40 * NPC.direction), NPC.position.Y + (float)NPC.height * 0.8f); - Vector2 stingerAttackPos = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); - float stingerAttackTargetX = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2) - stingerAttackPos.X; - float stingerAttackTargetY = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2) - 300f - stingerAttackPos.Y; - float stingerAttackTargetDist = (float)Math.Sqrt((double)(stingerAttackTargetX * stingerAttackTargetX + stingerAttackTargetY * stingerAttackTargetY)); - NPC.ai[1] += 1f; - bool canFireStinger = false; - if (NPC.ai[1] % 35f == 34f) - { - canFireStinger = true; - } - if (canFireStinger && NPC.position.Y + (float)NPC.height < Main.player[NPC.target].position.Y && Collision.CanHit(stingerSpawnPos, 1, 1, Main.player[NPC.target].position, Main.player[NPC.target].width, Main.player[NPC.target].height)) - { - SoundEngine.PlaySound(SoundID.Item42, NPC.Center); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - float stingerSpeed = 6f; - if (outsideJungle) - { - stingerSpeed += 2f; - } - float stingerTargetX = Main.player[NPC.target].position.X + (float)Main.player[NPC.target].width * 0.5f - stingerSpawnPos.X; - float stingerTargetY = Main.player[NPC.target].position.Y + (float)Main.player[NPC.target].height * 0.5f - stingerSpawnPos.Y; - float stingerTargetDist = (float)Math.Sqrt((double)(stingerTargetX * stingerTargetX + stingerTargetY * stingerTargetY)); - stingerTargetDist = stingerSpeed / stingerTargetDist; - stingerTargetX *= stingerTargetDist; - stingerTargetY *= stingerTargetDist; - bool fireRocket = Main.rand.NextBool(15); - int type = fireRocket ? ModContent.ProjectileType() : ModContent.ProjectileType(); - int damage = fireRocket ? 72 : 52; - if (Main.expertMode) - damage = fireRocket ? 50 : 35; - - Projectile.NewProjectile(NPC.GetSource_FromAI(), stingerSpawnPos.X, stingerSpawnPos.Y, stingerTargetX, stingerTargetY, type, damage, 0f, Main.myPlayer, 0f, 0f); - } - } - if (!Collision.CanHit(new Vector2(stingerSpawnPos.X, stingerSpawnPos.Y - 30f), 1, 1, Main.player[NPC.target].position, Main.player[NPC.target].width, Main.player[NPC.target].height)) - { - stingerAttackAccel = 0.105f; - stingerAttackPos = stingerSpawnPos; - stingerAttackTargetX = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2) - stingerAttackPos.X; - stingerAttackTargetY = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2) - stingerAttackPos.Y; - if (NPC.velocity.X < stingerAttackTargetX) - { - NPC.velocity.X = NPC.velocity.X + stingerAttackAccel; - if (NPC.velocity.X < 0f && stingerAttackTargetX > 0f) - { - NPC.velocity.X = NPC.velocity.X + stingerAttackAccel; - } - } - else if (NPC.velocity.X > stingerAttackTargetX) - { - NPC.velocity.X = NPC.velocity.X - stingerAttackAccel; - if (NPC.velocity.X > 0f && stingerAttackTargetX < 0f) - { - NPC.velocity.X = NPC.velocity.X - stingerAttackAccel; - } - } - if (NPC.velocity.Y < stingerAttackTargetY) - { - NPC.velocity.Y = NPC.velocity.Y + stingerAttackAccel; - if (NPC.velocity.Y < 0f && stingerAttackTargetY > 0f) - { - NPC.velocity.Y = NPC.velocity.Y + stingerAttackAccel; - } - } - else if (NPC.velocity.Y > stingerAttackTargetY) - { - NPC.velocity.Y = NPC.velocity.Y - stingerAttackAccel; - if (NPC.velocity.Y > 0f && stingerAttackTargetY < 0f) - { - NPC.velocity.Y = NPC.velocity.Y - stingerAttackAccel; - } - } - } - else if (stingerAttackTargetDist > 100f) - { - NPC.TargetClosest(true); - NPC.spriteDirection = NPC.direction; - stingerAttackTargetDist = stingerAttackSpeed / stingerAttackTargetDist; - if (NPC.velocity.X < stingerAttackTargetX) - { - NPC.velocity.X = NPC.velocity.X + stingerAttackAccel; - if (NPC.velocity.X < 0f && stingerAttackTargetX > 0f) - { - NPC.velocity.X = NPC.velocity.X + stingerAttackAccel * 2f; - } - } - else if (NPC.velocity.X > stingerAttackTargetX) - { - NPC.velocity.X = NPC.velocity.X - stingerAttackAccel; - if (NPC.velocity.X > 0f && stingerAttackTargetX < 0f) - { - NPC.velocity.X = NPC.velocity.X - stingerAttackAccel * 2f; - } - } - if (NPC.velocity.Y < stingerAttackTargetY) - { - NPC.velocity.Y = NPC.velocity.Y + stingerAttackAccel; - if (NPC.velocity.Y < 0f && stingerAttackTargetY > 0f) - { - NPC.velocity.Y = NPC.velocity.Y + stingerAttackAccel * 2f; - } - } - else if (NPC.velocity.Y > stingerAttackTargetY) - { - NPC.velocity.Y = NPC.velocity.Y - stingerAttackAccel; - if (NPC.velocity.Y > 0f && stingerAttackTargetY < 0f) - { - NPC.velocity.Y = NPC.velocity.Y - stingerAttackAccel * 2f; - } - } - } - if (NPC.ai[1] > 600f) - { - NPC.ai[0] = -1f; - NPC.ai[1] = 3f; - NPC.netUpdate = true; - } - } if (Main.netMode == NetmodeID.Server) - { - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, NPC.whoAmI, 0f, 0f, 0f, 0, 0, 0); - } + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, NPC.whoAmI); } public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) @@ -614,20 +381,18 @@ namespace CalamityMod.NPCs.PlagueEnemies public override void HitEffect(NPC.HitInfo hit) { for (int k = 0; k < 5; k++) - { Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Plague, hit.HitDirection, -1f, 0, default, 1f); - } + if (NPC.life <= 0) { - NPC.position.X = NPC.position.X + (float)(NPC.width / 2); - NPC.position.Y = NPC.position.Y + (float)(NPC.height / 2); - NPC.width = 100; - NPC.height = 100; + NPC.position = NPC.Center; + NPC.width = NPC.height = 100; NPC.position.X = NPC.position.X - (float)(NPC.width / 2); NPC.position.Y = NPC.position.Y - (float)(NPC.height / 2); + for (int i = 0; i < 40; i++) { - int plagueDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Plague, 0f, 0f, 100, default, 2f); + int plagueDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Plague, 0f, 0f, 100, default, 2f); Main.dust[plagueDust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -635,12 +400,13 @@ namespace CalamityMod.NPCs.PlagueEnemies Main.dust[plagueDust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } + for (int j = 0; j < 70; j++) { - int plagueDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Plague, 0f, 0f, 100, default, 3f); + int plagueDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Plague, 0f, 0f, 100, default, 3f); Main.dust[plagueDust2].noGravity = true; Main.dust[plagueDust2].velocity *= 5f; - plagueDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Plague, 0f, 0f, 100, default, 2f); + plagueDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Plague, 0f, 0f, 100, default, 2f); Main.dust[plagueDust2].velocity *= 2f; } } diff --git a/NPCs/PlagueEnemies/Plagueshell.cs b/NPCs/PlagueEnemies/Plagueshell.cs index 7ae1392e4e..122ac2e63b 100644 --- a/NPCs/PlagueEnemies/Plagueshell.cs +++ b/NPCs/PlagueEnemies/Plagueshell.cs @@ -1,14 +1,15 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Sounds; using Terraria; +using Terraria.Audio; using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.Utilities; -using Terraria.Audio; -using CalamityMod.Sounds; namespace CalamityMod.NPCs.PlagueEnemies { @@ -38,18 +39,27 @@ namespace CalamityMod.NPCs.PlagueEnemies NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = false; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { - BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Jungle, + BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Jungle, BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.UndergroundJungle, - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Plagueshell") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Plagueshell") }); } + public override void AI() + { + NPC.damage = NPC.ai[0] == 3f ? (int)Math.Round(NPC.defDamage * 1.4) : 0; + } + public override void HitEffect(NPC.HitInfo hit) { for (int k = 0; k < 5; k++) diff --git a/NPCs/PlagueEnemies/Viruling.cs b/NPCs/PlagueEnemies/Viruling.cs index a78dd17c7f..47819df894 100644 --- a/NPCs/PlagueEnemies/Viruling.cs +++ b/NPCs/PlagueEnemies/Viruling.cs @@ -1,17 +1,17 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Sounds; using CalamityMod.World; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.Utilities; -using Terraria.Audio; -using CalamityMod.Sounds; namespace CalamityMod.NPCs.PlagueEnemies { @@ -32,7 +32,7 @@ namespace CalamityMod.NPCs.PlagueEnemies NPC.height = 44; NPC.defense = 18; NPC.lifeMax = 400; - NPC.knockBackResist = 0f; + NPC.knockBackResist = 0.3f; NPC.value = Item.buyPrice(0, 0, 10, 0); NPC.HitSound = SoundID.NPCHit22; Banner = NPC.type; @@ -40,15 +40,19 @@ namespace CalamityMod.NPCs.PlagueEnemies NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = false; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Jungle, BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.UndergroundJungle, - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Viruling") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Viruling") }); } @@ -161,7 +165,7 @@ namespace CalamityMod.NPCs.PlagueEnemies { NPC.netUpdate = true; } - int idleDust = Dust.NewDust(new Vector2(NPC.position.X - NPC.velocity.X, NPC.position.Y - NPC.velocity.Y), NPC.width, NPC.height, 46, NPC.velocity.X * 0.2f, NPC.velocity.Y * 0.2f, 100, default, 2f); + int idleDust = Dust.NewDust(new Vector2(NPC.position.X - NPC.velocity.X, NPC.position.Y - NPC.velocity.Y), NPC.width, NPC.height, DustID.Poisoned, NPC.velocity.X * 0.2f, NPC.velocity.Y * 0.2f, 100, default, 2f); Dust dust = Main.dust[idleDust]; dust.noGravity = true; dust.velocity.X *= 0.3f; diff --git a/NPCs/PlaguebringerGoliath/PbGScreenShaderData.cs b/NPCs/PlaguebringerGoliath/PbGScreenShaderData.cs index 004be2aa36..717e8c0cc0 100644 --- a/NPCs/PlaguebringerGoliath/PbGScreenShaderData.cs +++ b/NPCs/PlaguebringerGoliath/PbGScreenShaderData.cs @@ -35,10 +35,10 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath public override void Update(GameTime gameTime) { - if (PbGIndex == -1) + if (PbGIndex == -1 && Main.LocalPlayer.Calamity().monolithPlagueShader <= 0) { UpdatePbGIndex(); - if (PbGIndex == -1) + if (PbGIndex == -1 && Main.LocalPlayer.Calamity().monolithPlagueShader <= 0) Filters.Scene["CalamityMod:PlaguebringerGoliath"].Deactivate(); } } @@ -50,6 +50,10 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath { UseTargetPosition(Main.npc[PbGIndex].Center); } + if (Main.LocalPlayer.Calamity().monolithPlagueShader > 0) + { + UseTargetPosition(Main.LocalPlayer.Center); + } base.Apply(); } } diff --git a/NPCs/PlaguebringerGoliath/PbGSky.cs b/NPCs/PlaguebringerGoliath/PbGSky.cs index 7ac452626c..ada84bda25 100644 --- a/NPCs/PlaguebringerGoliath/PbGSky.cs +++ b/NPCs/PlaguebringerGoliath/PbGSky.cs @@ -16,10 +16,10 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath public override void Update(GameTime gameTime) { - if (PbGIndex == -1 || BossRushEvent.BossRushActive) + if ((PbGIndex == -1 && Main.LocalPlayer.Calamity().monolithPlagueShader <= 0) || BossRushEvent.BossRushActive) { UpdatePbGIndex(); - if (PbGIndex == -1 || BossRushEvent.BossRushActive) + if ((PbGIndex == -1 && Main.LocalPlayer.Calamity().monolithPlagueShader <= 0) || BossRushEvent.BossRushActive) isActive = false; } } diff --git a/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs b/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs index f60f882457..dd170d4dfa 100644 --- a/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs +++ b/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs @@ -1,26 +1,32 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Events; using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; +using ReLogic.Content; using Terraria; +using Terraria.Audio; using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.NPCs.PlaguebringerGoliath { public class PlagueHomingMissile : ModNPC { + public static Asset GlowTexture; public override void SetStaticDefaults() { this.HideFromBestiary(); Main.npcFrameCount[NPC.type] = 4; NPCID.Sets.TrailingMode[NPC.type] = 1; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request("CalamityMod/NPCs/PlaguebringerGoliath/PlagueHomingMissileGlow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -39,10 +45,13 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath NPC.HitSound = SoundID.NPCHit4; NPC.DeathSound = SoundID.NPCDeath14; NPC.noGravity = true; - NPC.canGhostHeal = false; NPC.noTileCollide = true; NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToElectricity = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void AI() @@ -63,22 +72,22 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath dustXOffset = NPC.velocity.X * 0.5f; dustYOffset = NPC.velocity.Y * 0.5f; } - int smokyFire = Dust.NewDust(new Vector2(NPC.position.X + 3f + dustXOffset, NPC.position.Y + 3f + dustYOffset) - NPC.velocity * 0.5f, NPC.width - 8, NPC.height - 8, 6, 0f, 0f, 100, default, 0.5f); + int smokyFire = Dust.NewDust(new Vector2(NPC.position.X + 3f + dustXOffset, NPC.position.Y + 3f + dustYOffset) - NPC.velocity * 0.5f, NPC.width - 8, NPC.height - 8, DustID.Torch, 0f, 0f, 100, default, 0.5f); Main.dust[smokyFire].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; Main.dust[smokyFire].velocity *= 0.2f; Main.dust[smokyFire].noGravity = true; - smokyFire = Dust.NewDust(new Vector2(NPC.position.X + 3f + dustXOffset, NPC.position.Y + 3f + dustYOffset) - NPC.velocity * 0.5f, NPC.width - 8, NPC.height - 8, 31, 0f, 0f, 100, default, 0.25f); + smokyFire = Dust.NewDust(new Vector2(NPC.position.X + 3f + dustXOffset, NPC.position.Y + 3f + dustYOffset) - NPC.velocity * 0.5f, NPC.width - 8, NPC.height - 8, DustID.Smoke, 0f, 0f, 100, default, 0.25f); Main.dust[smokyFire].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; Main.dust[smokyFire].velocity *= 0.05f; } else if (Main.rand.NextBool(4)) { - int smokyFire2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 31, 0f, 0f, 100, default, 0.5f); + int smokyFire2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Smoke, 0f, 0f, 100, default, 0.5f); Main.dust[smokyFire2].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f; Main.dust[smokyFire2].fadeIn = 1.5f + (float)Main.rand.Next(5) * 0.1f; Main.dust[smokyFire2].noGravity = true; Main.dust[smokyFire2].position = NPC.Center + new Vector2(0f, (float)(-(float)NPC.height / 2)).RotatedBy((double)NPC.rotation, default) * 1.1f; - smokyFire2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 6, 0f, 0f, 100, default, 1f); + smokyFire2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Torch, 0f, 0f, 100, default, 1f); Main.dust[smokyFire2].scale = 1f + (float)Main.rand.Next(5) * 0.1f; Main.dust[smokyFire2].noGravity = true; Main.dust[smokyFire2].position = NPC.Center + new Vector2(0f, (float)(-(float)NPC.height / 2 - 6)).RotatedBy((double)NPC.rotation, default) * 1.1f; @@ -182,7 +191,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/PlaguebringerGoliath/PlagueHomingMissileGlow").Value; + texture2D15 = GlowTexture.Value; Color redLerpColor = Color.Lerp(Color.White, Color.Red, 0.5f); if (CalamityConfig.Instance.Afterimages) @@ -222,7 +231,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath NPC.position.Y = NPC.position.Y - (float)(NPC.height / 2); for (int i = 0; i < 15; i++) { - int greenPlague = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 89, 0f, 0f, 100, default, 2f); + int greenPlague = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.GemEmerald, 0f, 0f, 100, default, 2f); Main.dust[greenPlague].velocity *= 3f; if (Main.rand.NextBool()) { @@ -233,10 +242,10 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath } for (int j = 0; j < 30; j++) { - int greenPlague2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 89, 0f, 0f, 100, default, 3f); + int greenPlague2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.GemEmerald, 0f, 0f, 100, default, 3f); Main.dust[greenPlague2].noGravity = true; Main.dust[greenPlague2].velocity *= 5f; - greenPlague2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 89, 0f, 0f, 100, default, 2f); + greenPlague2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.GemEmerald, 0f, 0f, 100, default, 2f); Main.dust[greenPlague2].velocity *= 2f; Main.dust[greenPlague2].noGravity = true; } diff --git a/NPCs/PlaguebringerGoliath/PlagueMine.cs b/NPCs/PlaguebringerGoliath/PlagueMine.cs index 4b5d876202..efca4ac339 100644 --- a/NPCs/PlaguebringerGoliath/PlagueMine.cs +++ b/NPCs/PlaguebringerGoliath/PlagueMine.cs @@ -1,24 +1,30 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Events; using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; +using ReLogic.Content; using Terraria; +using Terraria.Audio; using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.NPCs.PlaguebringerGoliath { public class PlagueMine : ModNPC { + public static Asset GlowTexture; public override void SetStaticDefaults() { this.HideFromBestiary(); Main.npcFrameCount[NPC.type] = 4; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request("CalamityMod/NPCs/PlaguebringerGoliath/PlagueMineGlow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -33,14 +39,17 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); NPC.aiStyle = -1; AIType = -1; - NPC.knockBackResist = 0f; + NPC.knockBackResist = 0.2f; NPC.noGravity = true; NPC.noTileCollide = true; - NPC.canGhostHeal = false; NPC.HitSound = SoundID.NPCHit4; NPC.DeathSound = SoundID.NPCDeath14; NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToElectricity = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void AI() @@ -122,7 +131,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/PlaguebringerGoliath/PlagueMineGlow").Value; + texture2D15 = GlowTexture.Value; Color redLerpColor = Color.Lerp(Color.White, Color.Red, 0.5f); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, redLerpColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); @@ -154,7 +163,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath NPC.position.Y = NPC.position.Y - (float)(NPC.height / 2); for (int i = 0; i < 15; i++) { - int greenPlague = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 89, 0f, 0f, 100, default, 2f); + int greenPlague = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.GemEmerald, 0f, 0f, 100, default, 2f); Main.dust[greenPlague].velocity *= 3f; if (Main.rand.NextBool()) { @@ -165,10 +174,10 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath } for (int j = 0; j < 30; j++) { - int greenPlague2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 89, 0f, 0f, 100, default, 3f); + int greenPlague2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.GemEmerald, 0f, 0f, 100, default, 3f); Main.dust[greenPlague2].noGravity = true; Main.dust[greenPlague2].velocity *= 5f; - greenPlague2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 89, 0f, 0f, 100, default, 2f); + greenPlague2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.GemEmerald, 0f, 0f, 100, default, 2f); Main.dust[greenPlague2].velocity *= 2f; Main.dust[greenPlague2].noGravity = true; } diff --git a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs index 6b7f5bfe78..2b78a69901 100644 --- a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs +++ b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs @@ -1,4 +1,6 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using System.IO; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; using CalamityMod.Events; @@ -20,15 +22,14 @@ using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; +using ReLogic.Content; using Terraria; +using Terraria.Audio; using Terraria.GameContent; using Terraria.GameContent.Bestiary; +using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using Terraria.GameContent.ItemDropRules; namespace CalamityMod.NPCs.PlaguebringerGoliath { @@ -47,6 +48,10 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath private bool flyingFrame2 = false; private int curTex = 1; + public static Asset ChargeTexture; + public static Asset Texture_Glow; + public static Asset ChargeTexture_Glow; + public static readonly SoundStyle NukeWarningSound = new("CalamityMod/Sounds/Custom/PlagueSounds/PBGNukeWarning"); public static readonly SoundStyle AttackSwitchSound = new("CalamityMod/Sounds/Custom/PlagueSounds/PBGAttackSwitch", 2); public static readonly SoundStyle DashSound = new("CalamityMod/Sounds/Custom/PlagueSounds/PBGDash"); @@ -57,7 +62,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath Main.npcFrameCount[NPC.type] = 6; NPCID.Sets.TrailingMode[NPC.type] = 1; NPCID.Sets.BossBestiaryPriority.Add(Type); - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { Scale = 0.4f, PortraitScale = 0.5f, @@ -67,7 +72,13 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath }; value.Position.X -= 48f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; - NPCID.Sets.MPAllowedEnemies[Type] = true; + NPCID.Sets.MPAllowedEnemies[Type] = true; + if (!Main.dedServ) + { + ChargeTexture = ModContent.Request("CalamityMod/NPCs/PlaguebringerGoliath/PlaguebringerGoliathChargeTex", AssetRequestMode.AsyncLoad); + Texture_Glow = ModContent.Request("CalamityMod/NPCs/PlaguebringerGoliath/PlaguebringerGoliathGlow", AssetRequestMode.AsyncLoad); + ChargeTexture_Glow = ModContent.Request("CalamityMod/NPCs/PlaguebringerGoliath/PlaguebringerGoliathChargeTexGlow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -97,7 +108,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Jungle, BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.UndergroundJungle, @@ -180,7 +191,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath NPC.buffImmune[BuffID.Webbed] = immuneToSlowingDebuffs; // Light - Lighting.AddLight((int)((NPC.position.X + (NPC.width / 2)) / 16f), (int)((NPC.position.Y + (NPC.height / 2)) / 16f), 0.3f, 0.7f, 0f); + Lighting.AddLight((int)(NPC.Center.X / 16f), (int)(NPC.Center.Y / 16f), 0.3f, 0.7f, 0f); // Show message if (!halfLife && phase3 && expertMode) @@ -199,13 +210,11 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath if (MissileCountdown > 1) MissileCountdown--; - Vector2 vectorCenter = NPC.Center; - // Count nearby players int activePlayers = 0; for (int i = 0; i < Main.maxPlayers; i++) { - if (Main.player[i].active && !Main.player[i].dead && (vectorCenter - Main.player[i].Center).Length() < 1000f) + if (Main.player[i].active && !Main.player[i].dead && (NPC.Center - Main.player[i].Center).Length() < 1000f) activePlayers++; } @@ -220,7 +229,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath Player player = Main.player[NPC.target]; // Distance from target - Vector2 distFromPlayer = player.Center - vectorCenter; + Vector2 distFromPlayer = player.Center - NPC.Center; // Enrage if (!player.ZoneJungle && !bossRush) @@ -255,11 +264,11 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath NPC.rotation = NPC.velocity.X * 0.02f; // Despawn - if (!player.active || player.dead || Vector2.Distance(player.Center, vectorCenter) > 5600f) + if (!player.active || player.dead || Vector2.Distance(player.Center, NPC.Center) > 5600f) { NPC.TargetClosest(false); player = Main.player[NPC.target]; - if (!player.active || player.dead || Vector2.Distance(player.Center, vectorCenter) > 5600f) + if (!player.active || player.dead || Vector2.Distance(player.Center, NPC.Center) > 5600f) { if (despawnTimer > 0) despawnTimer--; @@ -271,6 +280,9 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath canDespawn = despawnTimer <= 0; if (canDespawn) { + // Avoid cheap bullshit + NPC.damage = 0; + if (NPC.velocity.Y > 3f) NPC.velocity.Y = 3f; NPC.velocity.Y -= 0.2f; @@ -289,6 +301,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath chargeDistance = 0; NPC.netUpdate = true; } + return; } @@ -348,6 +361,15 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath // Charge phase else if (NPC.ai[0] == 0f) { + int chargeDistanceX = revenge ? 525 : 550; + if (phase4) + chargeDistanceX = revenge ? 450 : 475; + else if (phase3) + chargeDistanceX = revenge ? 475 : 500; + else if (phase2) + chargeDistanceX = revenge ? 500 : 525; + chargeDistanceX -= (int)(25f * enrageScale); + float chargeSpeed = revenge ? 28f : 26f; if (phase2) chargeSpeed += 1f; @@ -381,13 +403,21 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath // Charge if (NPC.ai[1] % 2f == 0f) { - float playerLocation = vectorCenter.X - player.Center.X; + // Avoid cheap bullshit + NPC.damage = 0; - float chargeThresholdY = 20f; - chargeThresholdY += 20f * enrageScale; + float playerLocation = NPC.Center.X - player.Center.X; - if (Math.Abs(NPC.Center.Y - (player.Center.Y - chargeDistance)) < chargeThresholdY) + float chargeDistanceY = 20f; + chargeDistanceY += 20f * enrageScale; + + float distanceFromTargetX = Math.Abs(NPC.Center.X - player.Center.X); + float distanceFromTargetY = Math.Abs(NPC.Center.Y - (player.Center.Y - chargeDistance)); + if (distanceFromTargetY < chargeDistanceY && distanceFromTargetX >= chargeDistanceX) { + // Set damage + NPC.damage = NPC.defDamage; + if (diagonalDash) { switch (Main.rand.Next(3)) @@ -410,8 +440,8 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath NPC.ai[1] += 1f; NPC.ai[2] = 0f; - float targetX = player.position.X + (player.width / 2) - vectorCenter.X; - float targetY = player.position.Y + (player.height / 2) - vectorCenter.Y; + float targetX = player.Center.X - NPC.Center.X; + float targetY = player.Center.Y - NPC.Center.Y; float targetDistance = (float)Math.Sqrt(targetX * targetX + targetY * targetY); targetDistance = chargeSpeed / targetDistance; @@ -431,48 +461,53 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath NPC.netSpam -= 5; SoundEngine.PlaySound(DashSound, NPC.Center); + return; } NPC.rotation = NPC.velocity.X * 0.02f; charging = false; - float maxLineUpSpeedY = revenge ? 14f : 12f; - float lineUpAccelY = revenge ? 0.25f : 0.22f; + float maxLineUpSpeed = revenge ? 25f : 20f; + float lineUpAccel = revenge ? 0.75f : 0.6f; if (phase2) { - maxLineUpSpeedY += 1f; - lineUpAccelY += 0.05f; + maxLineUpSpeed += 3f; + lineUpAccel += 0.15f; } if (phase4) { - maxLineUpSpeedY += 1f; - lineUpAccelY += 0.05f; + maxLineUpSpeed += 3f; + lineUpAccel += 0.15f; } - maxLineUpSpeedY += 1.5f * enrageScale; - lineUpAccelY += 0.25f * enrageScale; + maxLineUpSpeed += 7f * enrageScale; + lineUpAccel += 0.35f * enrageScale; - if (vectorCenter.Y < (player.Center.Y - chargeDistance)) - NPC.velocity.Y += lineUpAccelY; + if (NPC.Center.Y < (player.Center.Y - chargeDistance - chargeDistanceY)) + NPC.velocity.Y += lineUpAccel; + else if (NPC.Center.Y > (player.Center.Y - chargeDistance + chargeDistanceY)) + NPC.velocity.Y -= lineUpAccel; else - NPC.velocity.Y -= lineUpAccelY; + NPC.velocity.Y *= 0.7f; - if (NPC.velocity.Y < -maxLineUpSpeedY) - NPC.velocity.Y = -maxLineUpSpeedY; - if (NPC.velocity.Y > maxLineUpSpeedY) - NPC.velocity.Y = maxLineUpSpeedY; + if (NPC.velocity.Y < -maxLineUpSpeed) + NPC.velocity.Y = -maxLineUpSpeed; + if (NPC.velocity.Y > maxLineUpSpeed) + NPC.velocity.Y = maxLineUpSpeed; - if (Math.Abs(vectorCenter.X - player.Center.X) > 650f) - NPC.velocity.X += lineUpAccelY * NPC.direction; - else if (Math.Abs(vectorCenter.X - player.Center.X) < 500f) - NPC.velocity.X -= lineUpAccelY * NPC.direction; + float distanceXMax = 100f; + float distanceXMin = 20f; + if (distanceFromTargetX > chargeDistanceX + distanceXMax) + NPC.velocity.X += lineUpAccel * NPC.direction; + else if (distanceFromTargetX < chargeDistanceX + distanceXMin) + NPC.velocity.X -= lineUpAccel * NPC.direction; else - NPC.velocity.X *= 0.8f; + NPC.velocity.X *= 0.7f; - if (NPC.velocity.X < -maxLineUpSpeedY) - NPC.velocity.X = -maxLineUpSpeedY; - if (NPC.velocity.X > maxLineUpSpeedY) - NPC.velocity.X = maxLineUpSpeedY; + if (NPC.velocity.X < -maxLineUpSpeed) + NPC.velocity.X = -maxLineUpSpeed; + if (NPC.velocity.X > maxLineUpSpeed) + NPC.velocity.X = maxLineUpSpeed; NPC.direction = playerLocation < 0 ? 1 : -1; NPC.spriteDirection = NPC.direction; @@ -484,6 +519,9 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath // Slow down after charge else { + // Set damage + NPC.damage = NPC.defDamage; + if (NPC.velocity.X < 0f) NPC.direction = -1; else @@ -491,20 +529,13 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath NPC.spriteDirection = NPC.direction; - int stopChargeXDist = revenge ? 525 : 550; - if (phase4) - stopChargeXDist = revenge ? 450 : 475; - else if (phase3) - stopChargeXDist = revenge ? 475 : 500; - else if (phase2) - stopChargeXDist = revenge ? 500 : 525; - stopChargeXDist -= (int)(25f * enrageScale); - int chargeDirectionXSign = 1; - if (vectorCenter.X < player.Center.X) + if (NPC.Center.X < player.Center.X) chargeDirectionXSign = -1; - if (NPC.direction == chargeDirectionXSign && (Math.Abs(vectorCenter.X - player.Center.X) > stopChargeXDist || Math.Abs(vectorCenter.Y - player.Center.Y) > stopChargeXDist)) + if (NPC.direction == chargeDirectionXSign && Math.Abs(NPC.Center.X - player.Center.X) > chargeDistanceX) + NPC.ai[2] = 1f; + if (Math.Abs(NPC.Center.Y - player.Center.Y) > chargeDistanceX * 1.5f) NPC.ai[2] = 1f; if (enrageScale > 0 && NPC.ai[2] == 1f) @@ -549,7 +580,10 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath return; } - float playerLocation = vectorCenter.X - player.Center.X; + // Avoid cheap bullshit + NPC.damage = 0; + + float playerLocation = NPC.Center.X - player.Center.X; NPC.direction = playerLocation < 0 ? 1 : -1; NPC.spriteDirection = NPC.direction; @@ -588,16 +622,25 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath // Move closer if too far away else if (NPC.ai[0] == 2f) { - float playerLocation = vectorCenter.X - player.Center.X; + // Avoid cheap bullshit + NPC.damage = 0; + + float playerLocation = NPC.Center.X - player.Center.X; NPC.direction = playerLocation < 0 ? 1 : -1; NPC.spriteDirection = NPC.direction; - float playerXDist = player.position.X + (player.width / 2) - vectorCenter.X; - float playerYDist = player.position.Y + (player.height / 2) - 200f - vectorCenter.Y; - float playerTotalDist = (float)Math.Sqrt(playerXDist * playerXDist + playerYDist * playerYDist); + // Move closer + bool canHitTarget = Collision.CanHit(NPC.Center, 1, 1, player.position, player.width, player.height); + float distanceAboveTarget = !canHitTarget ? 0f : 400f; + float distanceAwayFromTargetX = !canHitTarget ? 36f : 144f; + float distanceAwayFromTargetY = player.Center.Y - NPC.Center.Y; + float distanceAwayFromTargetYLeeway = !canHitTarget ? 16f : 48f; + bool tooFarX = Math.Abs(player.Center.X - NPC.Center.X) > distanceAwayFromTargetX; + bool tooFarY = distanceAwayFromTargetY > distanceAboveTarget + distanceAwayFromTargetYLeeway || distanceAwayFromTargetY < distanceAboveTarget - distanceAwayFromTargetYLeeway; + bool tooFar = tooFarX || tooFarY; calamityGlobalNPC.newAI[0] += 1f; - if (playerTotalDist < 600f || calamityGlobalNPC.newAI[0] >= 180f) + if ((Vector2.Distance(NPC.Center, player.Center) < 640f && canHitTarget) || calamityGlobalNPC.newAI[0] >= 180f) { NPC.ai[0] = (phase3 || bossRush) ? 5f : 1f; NPC.ai[1] = 0f; @@ -614,19 +657,22 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath return; } - // Move closer - Movement(100f, 350f, 450f, player, enrageScale); + if (tooFar) + Movement(distanceAboveTarget, player, enrageScale); } // Spawn less missiles else if (NPC.ai[0] == 1f) { + // Avoid cheap bullshit + NPC.damage = 0; + charging = false; + Vector2 missileSpawnPos = new Vector2(NPC.direction == 1 ? NPC.getRect().BottomLeft().X : NPC.getRect().BottomRight().X, NPC.getRect().Bottom().Y + 20f); missileSpawnPos.X += NPC.direction * 120; - float playerMissileX = player.position.X + (player.width / 2) - vectorCenter.X; - float playerMissileY = player.position.Y + (player.height / 2) - vectorCenter.Y; - float playerMissileDist = (float)Math.Sqrt(playerMissileX * playerMissileX + playerMissileY * playerMissileY); + Vector2 missileSpawnCollisionLocation = new Vector2(missileSpawnPos.X, missileSpawnPos.Y - 30f); + bool canHitTarget = Collision.CanHit(missileSpawnCollisionLocation, 1, 1, player.position, player.width, player.height); NPC.ai[1] += 1f; NPC.ai[1] += activePlayers / 2; @@ -652,8 +698,8 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath float npcSpeed = (revenge ? 9f : 7f) + enrageScale * 2f; - float projXDist = player.position.X + player.width * 0.5f - missileSpawnPos.X; - float projYDist = player.position.Y + player.height * 0.5f - missileSpawnPos.Y; + float projXDist = player.Center.X - missileSpawnPos.X; + float projYDist = player.Center.Y - missileSpawnPos.Y; float projDistance = (float)Math.Sqrt(projXDist * projXDist + projYDist * projYDist); projDistance = npcSpeed / projDistance; @@ -667,13 +713,18 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath } } - // Move closer if too far away - if (playerMissileDist > 600f) - Movement(100f, 350f, 450f, player, enrageScale); - else - NPC.velocity *= 0.9f; + // Move closer + float distanceAboveTarget = !canHitTarget ? 0f : 400f; + float distanceAwayFromTargetX = !canHitTarget ? 36f : 144f; + float distanceAwayFromTargetY = player.Center.Y - NPC.Center.Y; + float distanceAwayFromTargetYLeeway = !canHitTarget ? 16f : 48f; + bool tooFarX = Math.Abs(player.Center.X - NPC.Center.X) > distanceAwayFromTargetX; + bool tooFarY = distanceAwayFromTargetY > distanceAboveTarget + distanceAwayFromTargetYLeeway || distanceAwayFromTargetY < distanceAboveTarget - distanceAwayFromTargetYLeeway; + bool tooFar = tooFarX || tooFarY; + if (tooFar) + Movement(distanceAboveTarget, player, enrageScale); - float playerLocation = vectorCenter.X - player.Center.X; + float playerLocation = NPC.Center.X - player.Center.X; NPC.direction = playerLocation < 0 ? 1 : -1; NPC.spriteDirection = NPC.direction; @@ -696,12 +747,14 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath // Missile spawn else if (NPC.ai[0] == 5f) { + // Avoid cheap bullshit + NPC.damage = 0; + charging = false; Vector2 missileSpawnPos = new Vector2(NPC.direction == 1 ? NPC.getRect().BottomLeft().X : NPC.getRect().BottomRight().X, NPC.getRect().Bottom().Y + 20f); missileSpawnPos.X += NPC.direction * 120; - float playerMissileX = player.position.X + (player.width / 2) - vectorCenter.X; - float playerMissileY = player.position.Y + (player.height / 2) - vectorCenter.Y; - float playerMissileDist = (float)Math.Sqrt(playerMissileX * playerMissileX + playerMissileY * playerMissileY); + Vector2 missileSpawnCollisionLocation = new Vector2(missileSpawnPos.X, missileSpawnPos.Y - 30f); + bool canHitTarget = Collision.CanHit(missileSpawnCollisionLocation, 1, 1, player.position, player.width, player.height); NPC.ai[1] += 1f; NPC.ai[1] += activePlayers / 2; @@ -723,17 +776,17 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath if (shouldSpawnMissiles) { - SoundEngine.PlaySound(SoundID.Item88,NPC.Center); + SoundEngine.PlaySound(SoundID.Item88, NPC.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { if (expertMode && NPC.CountNPCS(ModContent.NPCType()) < 3) NPC.NewNPC(NPC.GetSource_FromAI(), (int)missileSpawnPos.X, (int)missileSpawnPos.Y, ModContent.NPCType(), 0, 0f, 0f, 0f, challengeAmt); - float npcSpeed = (revenge ? 11f : 9f) + enrageScale * 2f; + float npcSpeed = (revenge ? 10f : 8f) + enrageScale * 2f; - float projXDist = player.position.X + player.width * 0.5f - missileSpawnPos.X; - float projYDist = player.position.Y + player.height * 0.5f - missileSpawnPos.Y; + float projXDist = player.Center.X - missileSpawnPos.X; + float projYDist = player.Center.Y - missileSpawnPos.Y; float projDistance = (float)Math.Sqrt(projXDist * projXDist + projYDist * projYDist); projDistance = npcSpeed / projDistance; @@ -749,13 +802,18 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath } } - // Move closer if too far away - if (playerMissileDist > 600f) - Movement(100f, 350f, 450f, player, enrageScale); - else - NPC.velocity *= 0.9f; + // Move closer + float distanceAboveTarget = !canHitTarget ? 0f : 400f; + float distanceAwayFromTargetX = !canHitTarget ? 36f : 144f; + float distanceAwayFromTargetY = player.Center.Y - NPC.Center.Y; + float distanceAwayFromTargetYLeeway = !canHitTarget ? 16f : 48f; + bool tooFarX = Math.Abs(player.Center.X - NPC.Center.X) > distanceAwayFromTargetX; + bool tooFarY = distanceAwayFromTargetY > distanceAboveTarget + distanceAwayFromTargetYLeeway || distanceAwayFromTargetY < distanceAboveTarget - distanceAwayFromTargetYLeeway; + bool tooFar = tooFarX || tooFarY; + if (tooFar) + Movement(distanceAboveTarget, player, enrageScale); - float playerLocation = vectorCenter.X - player.Center.X; + float playerLocation = NPC.Center.X - player.Center.X; NPC.direction = playerLocation < 0 ? 1 : -1; NPC.spriteDirection = NPC.direction; @@ -778,14 +836,18 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath // Stinger phase else if (NPC.ai[0] == 3f) { + // Avoid cheap bullshit + NPC.damage = 0; + Vector2 stingerSpawnPos = new Vector2(NPC.direction == 1 ? NPC.getRect().BottomLeft().X : NPC.getRect().BottomRight().X, NPC.getRect().Bottom().Y + 20f); stingerSpawnPos.X += NPC.direction * 120; + bool canHitTarget = Collision.CanHit(new Vector2(stingerSpawnPos.X, stingerSpawnPos.Y - 30f), 1, 1, player.position, player.width, player.height); NPC.ai[1] += 1f; int stingerFireDelay = phase5 ? 20 : (phase3 ? 25 : 30); stingerFireDelay -= (int)Math.Ceiling(5f * enrageScale); - if (NPC.ai[1] % stingerFireDelay == (stingerFireDelay - 1) && vectorCenter.Y < player.position.Y) + if (NPC.ai[1] % stingerFireDelay == (stingerFireDelay - 1) && NPC.Center.Y < player.position.Y) { SoundEngine.PlaySound(SoundID.Item42, NPC.Center); @@ -794,8 +856,8 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath float projectileSpeed = revenge ? 6f : 5f; projectileSpeed += 2f * enrageScale; - float projXDist = player.position.X + player.width * 0.5f - stingerSpawnPos.X; - float projYDist = player.position.Y + player.height * 0.5f - stingerSpawnPos.Y; + float projXDist = player.Center.X - stingerSpawnPos.X; + float projYDist = player.Center.Y - stingerSpawnPos.Y; float projDistance = (float)Math.Sqrt(projXDist * projXDist + projYDist * projYDist); projDistance = projectileSpeed / projDistance; projXDist *= projDistance; @@ -807,20 +869,20 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath case 0: case 1: break; + case 2: case 3: if (expertMode) type = ModContent.ProjectileType(); break; + case 4: type = ModContent.ProjectileType(); break; } if (Main.zenithWorld) - { type = ModContent.ProjectileType(); - } int damage = NPC.GetProjectileDamage(type); Projectile.NewProjectile(NPC.GetSource_FromAI(), stingerSpawnPos.X, stingerSpawnPos.Y, projXDist, projYDist, type, damage, 0f, Main.myPlayer, challengeAmt, player.position.Y); @@ -832,9 +894,18 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath NPC.ai[2] = 0f; } - Movement(100f, 400f, 500f, player, enrageScale); + // Move closer + float distanceAboveTarget = !canHitTarget ? 0f : 400f; + float distanceAwayFromTargetX = !canHitTarget ? 36f : 144f; + float distanceAwayFromTargetY = player.Center.Y - NPC.Center.Y; + float distanceAwayFromTargetYLeeway = !canHitTarget ? 16f : 48f; + bool tooFarX = Math.Abs(player.Center.X - NPC.Center.X) > distanceAwayFromTargetX; + bool tooFarY = distanceAwayFromTargetY > distanceAboveTarget + distanceAwayFromTargetYLeeway || distanceAwayFromTargetY < distanceAboveTarget - distanceAwayFromTargetYLeeway; + bool tooFar = tooFarX || tooFarY; + if (tooFar) + Movement(distanceAboveTarget, player, enrageScale); - float playerLocation = vectorCenter.X - player.Center.X; + float playerLocation = NPC.Center.X - player.Center.X; NPC.direction = playerLocation < 0 ? 1 : -1; NPC.spriteDirection = NPC.direction; @@ -857,8 +928,14 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath // Missile charge else if (NPC.ai[0] == 4f) { - float chargeSpeed = revenge ? 28f : 26f; + float missileVelocity = revenge ? 6f : 5f; + missileVelocity += 2f * enrageScale; + int type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + + int chargeDistanceX = 600; + float chargeSpeed = revenge ? 28f : 26f; chargeSpeed += 3f * enrageScale; int phaseSwitchTimer = (int)Math.Ceiling(2f + enrageScale); @@ -874,37 +951,41 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath // A phase switch sync is a critical operation that must be synced. if (NPC.netSpam >= 10) NPC.netSpam = 9; + SoundEngine.PlaySound(AttackSwitchSound, NPC.Center); + return; } // Charge if (NPC.ai[1] % 2f == 0f) { - float playerLocation = vectorCenter.X - player.Center.X; + // Avoid cheap bullshit + NPC.damage = 0; - float chargeThresholdY = 20f; - chargeThresholdY += 20 * enrageScale; + float playerLocation = NPC.Center.X - player.Center.X; - if (Math.Abs(vectorCenter.Y - (player.Center.Y - 500f)) < chargeThresholdY) + float chargeDistanceY = 20f; + chargeDistanceY += 20f * enrageScale; + + float distanceFromTargetX = Math.Abs(NPC.Center.X - player.Center.X); + float distanceFromTargetY = Math.Abs(NPC.Center.Y - (player.Center.Y - 500f)); + if (distanceFromTargetY < chargeDistanceY && distanceFromTargetX >= chargeDistanceX) { + // Set damage + NPC.damage = NPC.defDamage; + if (MissileCountdown == 1) { SoundEngine.PlaySound(BarrageLaunchSound, NPC.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { - float speed = revenge ? 6f : 5f; - speed += 2f * enrageScale; - bool gaussMode = false; - int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); - - Vector2 baseVelocity = player.Center - vectorCenter; + Vector2 baseVelocity = player.Center - NPC.Center; baseVelocity.Normalize(); - baseVelocity *= speed; + baseVelocity *= missileVelocity; if (Main.rand.NextBool(10) && Main.zenithWorld) { @@ -924,16 +1005,14 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath { for (int i = 0; i < missiles; i++) { - Vector2 spawn = vectorCenter; // Normal = 96, Boss Rush = 144 + Vector2 spawn = NPC.Center; // Normal = 96, Boss Rush = 144 spawn.X += i * (int)(spread * 1.125) - (missiles * (spread / 2)); // Normal = -96 to 93, Boss Rush = -144 to 156 Vector2 velocity = baseVelocity.RotatedBy(MathHelper.ToRadians(-MissileAngleSpread / 2 + (MissileAngleSpread * i / missiles))); Projectile.NewProjectile(NPC.GetSource_FromAI(), spawn, velocity, type, damage, 0f, Main.myPlayer, nukeBarrageChallengeAmt, player.position.Y); } } else - { Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, baseVelocity, type, damage, 0f, Main.myPlayer); - } } } @@ -942,8 +1021,8 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath NPC.ai[1] += 1f; NPC.ai[2] = 0f; - float targetX = player.position.X + (player.width / 2) - vectorCenter.X; - float targetY = player.position.Y - 500f + (player.height / 2) - vectorCenter.Y; + float targetX = player.Center.X - NPC.Center.X; + float targetY = player.Center.Y - 500f - NPC.Center.Y; float targetDistance = (float)Math.Sqrt(targetX * targetX + targetY * targetY); targetDistance = chargeSpeed / targetDistance; @@ -964,32 +1043,36 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath NPC.rotation = NPC.velocity.X * 0.02f; charging = false; - float maxLineUpSpeedY = revenge ? 16f : 14f; - float lineUpAccelY = revenge ? 0.2f : 0.18f; - maxLineUpSpeedY += 1.5f * enrageScale; - lineUpAccelY += 0.25f * enrageScale; + float maxLineUpSpeed = revenge ? 31f : 26f; + float lineUpAccel = revenge ? 1.05f : 0.9f; + maxLineUpSpeed += 7f * enrageScale; + lineUpAccel += 0.35f * enrageScale; - if (vectorCenter.Y < player.Center.Y - 500f) - NPC.velocity.Y += lineUpAccelY; + if (NPC.Center.Y < (player.Center.Y - 500f - chargeDistanceY)) + NPC.velocity.Y += lineUpAccel; + else if (NPC.Center.Y > (player.Center.Y - 500f + chargeDistanceY)) + NPC.velocity.Y -= lineUpAccel; else - NPC.velocity.Y -= lineUpAccelY; + NPC.velocity.Y *= 0.7f; - if (NPC.velocity.Y < -maxLineUpSpeedY) - NPC.velocity.Y = -maxLineUpSpeedY; - if (NPC.velocity.Y > maxLineUpSpeedY) - NPC.velocity.Y = maxLineUpSpeedY; + if (NPC.velocity.Y < -maxLineUpSpeed) + NPC.velocity.Y = -maxLineUpSpeed; + if (NPC.velocity.Y > maxLineUpSpeed) + NPC.velocity.Y = maxLineUpSpeed; - if (Math.Abs(vectorCenter.X - player.Center.X) > 600f) - NPC.velocity.X += lineUpAccelY * NPC.direction; - else if (Math.Abs(vectorCenter.X - player.Center.X) < 300f) - NPC.velocity.X -= lineUpAccelY * NPC.direction; + float distanceXMax = 100f; + float distanceXMin = 20f; + if (distanceFromTargetX > chargeDistanceX + distanceXMax) + NPC.velocity.X += lineUpAccel * NPC.direction; + else if (distanceFromTargetX < chargeDistanceX + distanceXMin) + NPC.velocity.X -= lineUpAccel * NPC.direction; else - NPC.velocity.X *= 0.8f; + NPC.velocity.X *= 0.7f; - if (NPC.velocity.X < -maxLineUpSpeedY) - NPC.velocity.X = -maxLineUpSpeedY; - if (NPC.velocity.X > maxLineUpSpeedY) - NPC.velocity.X = maxLineUpSpeedY; + if (NPC.velocity.X < -maxLineUpSpeed) + NPC.velocity.X = -maxLineUpSpeed; + if (NPC.velocity.X > maxLineUpSpeed) + NPC.velocity.X = maxLineUpSpeed; NPC.direction = playerLocation < 0 ? 1 : -1; NPC.spriteDirection = NPC.direction; @@ -998,6 +1081,9 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath // Slow down after charge else { + // Set damage + NPC.damage = NPC.defDamage; + if (NPC.velocity.X < 0f) NPC.direction = -1; else @@ -1005,12 +1091,13 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath NPC.spriteDirection = NPC.direction; - int stopChargeXDist = 600; int chargeDirectionXSign = 1; - if (vectorCenter.X < player.Center.X) + if (NPC.Center.X < player.Center.X) chargeDirectionXSign = -1; - if (NPC.direction == chargeDirectionXSign && Math.Abs(vectorCenter.X - player.Center.X) > stopChargeXDist) + if (NPC.direction == chargeDirectionXSign && Math.Abs(NPC.Center.X - player.Center.X) > chargeDistanceX) + NPC.ai[2] = 1f; + if (Math.Abs(NPC.Center.Y - player.Center.Y) > chargeDistanceX * 3f) NPC.ai[2] = 1f; if (enrageScale > 0 && NPC.ai[2] == 1f) NPC.velocity *= 0.95f; @@ -1027,9 +1114,25 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath if (calamityGlobalNPC.newAI[0] > 90f) NPC.velocity.X *= 1.01f; + // Fire missiles in death mode during charge + if (death) + { + float missileGateValue = 20f; + bool fireMissile = calamityGlobalNPC.newAI[0] % missileGateValue == 0f && Collision.CanHit(NPC.Center, 1, 1, player.position, player.width, player.height); + if (fireMissile) + { + SoundEngine.PlaySound(SoundID.Item42, NPC.Center); + if (Main.netMode != NetmodeID.MultiplayerClient) + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, (player.Center - NPC.Center).SafeNormalize(Vector2.UnitY) * missileVelocity, type, damage, 0f, Main.myPlayer, nukeBarrageChallengeAmt, player.position.Y); + } + } + return; } + // Avoid cheap bullshit + NPC.damage = 0; + NPC.rotation = NPC.velocity.X * 0.02f; charging = false; @@ -1063,51 +1166,15 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath } } - private void Movement(float xPos, float yPos, float yPos2, Player player, float enrageScale) + private void Movement(float distanceAboveTarget, Player player, float enrageScale) { - Vector2 acceleration = new Vector2(0.1f, 0.15f); - Vector2 velocity = new Vector2(8f, 5f); - float deceleration = 0.9f; - - acceleration *= 0.1f * enrageScale + 1f; - velocity *= 1f - enrageScale * 0.1f; - if (BossRushEvent.BossRushActive) - velocity *= 0.5f; - deceleration *= 1f - enrageScale * 0.1f; - - if (NPC.position.Y > player.position.Y - yPos) - { - if (NPC.velocity.Y > 0f) - NPC.velocity.Y *= deceleration; - NPC.velocity.Y -= acceleration.Y; - if (NPC.velocity.Y > velocity.Y) - NPC.velocity.Y = velocity.Y; - } - else if (NPC.position.Y < player.position.Y - yPos2) - { - if (NPC.velocity.Y < 0f) - NPC.velocity.Y *= deceleration; - NPC.velocity.Y += acceleration.Y; - if (NPC.velocity.Y < -velocity.Y) - NPC.velocity.Y = -velocity.Y; - } - - if (NPC.position.X + (NPC.width / 2) > player.position.X + (player.width / 2) + xPos) - { - if (NPC.velocity.X > 0f) - NPC.velocity.X *= deceleration; - NPC.velocity.X -= acceleration.X; - if (NPC.velocity.X > velocity.X) - NPC.velocity.X = velocity.X; - } - if (NPC.position.X + (NPC.width / 2) < player.position.X + (player.width / 2) - xPos) - { - if (NPC.velocity.X < 0f) - NPC.velocity.X *= deceleration; - NPC.velocity.X += acceleration.X; - if (NPC.velocity.X < -velocity.X) - NPC.velocity.X = -velocity.X; - } + float acceleration = (NPC.ai[0] == 1f || NPC.ai[0] == 5f) ? 0.24f : 0.48f; // Reduce acceleration while spawning minions + float velocity = (NPC.ai[0] == 1f || NPC.ai[0] == 5f) ? 12f : (NPC.ai[0] == 2f ? 18f : 24f); // Reduce velocity while preparing to spawn minions and spawning minions + acceleration *= 0.5f * enrageScale + 1f; + velocity *= 1f + enrageScale * 0.5f; + Vector2 hoverDestination = player.Center - Vector2.UnitY * distanceAboveTarget; + Vector2 idealVelocity = NPC.SafeDirectionTo(hoverDestination) * velocity; + NPC.SimpleFlyMovement(idealVelocity, acceleration); } public override bool CheckActive() => canDespawn; @@ -1136,9 +1203,8 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath public override void HitEffect(NPC.HitInfo hit) { for (int k = 0; k < 2; k++) - { Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Plague, hit.HitDirection, -1f, 0, default, 1f); - } + if (NPC.life <= 0) { if (Main.netMode != NetmodeID.Server) @@ -1146,15 +1212,15 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath for (int i = 1; i < 7; i++) Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("PlaguebringerGoliathGore" + i).Type, NPC.scale); } - NPC.position.X = NPC.position.X + (NPC.width / 2); - NPC.position.Y = NPC.position.Y + (NPC.height / 2); - NPC.width = 200; - NPC.height = 200; + + NPC.position = NPC.Center; + NPC.width = NPC.height = 200; NPC.position.X = NPC.position.X - (NPC.width / 2); NPC.position.Y = NPC.position.Y - (NPC.height / 2); + for (int i = 0; i < 40; i++) { - int plagueDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Plague, 0f, 0f, 100, default, 2f); + int plagueDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Plague, 0f, 0f, 100, default, 2f); Main.dust[plagueDust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -1162,12 +1228,13 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath Main.dust[plagueDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } + for (int j = 0; j < 70; j++) { - int plagueDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Plague, 0f, 0f, 100, default, 3f); + int plagueDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Plague, 0f, 0f, 100, default, 3f); Main.dust[plagueDust2].noGravity = true; Main.dust[plagueDust2].velocity *= 5f; - plagueDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Plague, 0f, 0f, 100, default, 2f); + plagueDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Plague, 0f, 0f, 100, default, 2f); Main.dust[plagueDust2].velocity *= 2f; } } @@ -1176,7 +1243,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { Texture2D texture = TextureAssets.Npc[NPC.type].Value; - Texture2D glowTexture = ModContent.Request("CalamityMod/NPCs/PlaguebringerGoliath/PlaguebringerGoliathGlow").Value; + Texture2D glowTexture = Texture_Glow.Value; if (curTex != (charging ? 2 : 1)) { NPC.frame.X = 0; @@ -1185,13 +1252,11 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath if (charging) { curTex = 2; - texture = ModContent.Request("CalamityMod/NPCs/PlaguebringerGoliath/PlaguebringerGoliathChargeTex").Value; - glowTexture = ModContent.Request("CalamityMod/NPCs/PlaguebringerGoliath/PlaguebringerGoliathChargeTexGlow").Value; + texture = ChargeTexture.Value; + glowTexture = ChargeTexture_Glow.Value; } else - { curTex = 1; - } SpriteEffects spriteEffects = SpriteEffects.None; if (NPC.spriteDirection == 1) @@ -1262,9 +1327,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath NPC.frame.Y = 0; NPC.frame.X = NPC.frame.X == 0 ? width : 0; if (charging) - { - flyingFrame2 = !flyingFrame2; - } + flyingFrame2 = !flyingFrame2; } } @@ -1335,7 +1398,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { - NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } diff --git a/NPCs/Polterghast/PhantomFuckYou.cs b/NPCs/Polterghast/PhantomFuckYou.cs index a6361ff55d..8856bddc30 100644 --- a/NPCs/Polterghast/PhantomFuckYou.cs +++ b/NPCs/Polterghast/PhantomFuckYou.cs @@ -1,10 +1,10 @@ -using CalamityMod.Dusts; +using System; +using System.IO; +using CalamityMod.Dusts; using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; using Terraria; using Terraria.GameContent; using Terraria.ID; @@ -32,7 +32,6 @@ namespace CalamityMod.NPCs.Polterghast NPC.DR_NERD(0.1f); NPC.noGravity = true; NPC.noTileCollide = true; - NPC.canGhostHeal = false; NPC.damage = 50; NPC.lifeMax = 20000; double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; @@ -67,7 +66,7 @@ namespace CalamityMod.NPCs.Polterghast for (int i = 0; i < 10; i++) { - int dust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Ectoplasm, 0f, 0f, 100, default, 2f); + int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Ectoplasm, 0f, 0f, 100, default, 2f); Main.dust[dust].noGravity = true; } @@ -179,7 +178,7 @@ namespace CalamityMod.NPCs.Polterghast public override void HitEffect(NPC.HitInfo hit) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 180, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.DungeonSpirit, hit.HitDirection, -1f, 0, default, 1f); if (NPC.life <= 0) { NPC.position.X = NPC.position.X + (NPC.width / 2); @@ -190,7 +189,7 @@ namespace CalamityMod.NPCs.Polterghast NPC.position.Y = NPC.position.Y - (NPC.height / 2); for (int i = 0; i < 2; i++) { - int ghostDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Polterplasm, 0f, 0f, 100, default, 2f); + int ghostDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Necroplasm, 0f, 0f, 100, default, 2f); Main.dust[ghostDust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -200,10 +199,10 @@ namespace CalamityMod.NPCs.Polterghast } for (int j = 0; j < 10; j++) { - int ghostDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 180, 0f, 0f, 100, default, 3f); + int ghostDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.DungeonSpirit, 0f, 0f, 100, default, 3f); Main.dust[ghostDust2].noGravity = true; Main.dust[ghostDust2].velocity *= 5f; - ghostDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 180, 0f, 0f, 100, default, 2f); + ghostDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.DungeonSpirit, 0f, 0f, 100, default, 2f); Main.dust[ghostDust2].velocity *= 2f; } } diff --git a/NPCs/Polterghast/PolterPhantom.cs b/NPCs/Polterghast/PolterPhantom.cs index d6f60702e6..6593c96a5a 100644 --- a/NPCs/Polterghast/PolterPhantom.cs +++ b/NPCs/Polterghast/PolterPhantom.cs @@ -1,15 +1,16 @@ -using CalamityMod.Dusts; +using System; +using System.IO; +using CalamityMod.Dusts; using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; +using ReLogic.Content; using Terraria; +using Terraria.Audio; using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.NPCs.Polterghast { @@ -19,12 +20,18 @@ namespace CalamityMod.NPCs.Polterghast private int despawnTimer = 600; private bool reachedChargingPoint = false; + public static Asset GlowTexture; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 4; NPCID.Sets.TrailingMode[NPC.type] = 1; - NPCID.Sets.NPCBestiaryDrawModifiers bestiaryData = new NPCID.Sets.NPCBestiaryDrawModifiers(0) { Hide = true }; + NPCID.Sets.NPCBestiaryDrawModifiers bestiaryData = new NPCID.Sets.NPCBestiaryDrawModifiers() { Hide = true }; NPCID.Sets.NPCBestiaryDrawOffset.Add(Type, bestiaryData); + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -49,7 +56,6 @@ namespace CalamityMod.NPCs.Polterghast NPC.noGravity = true; NPC.noTileCollide = true; NPC.netAlways = true; - NPC.canGhostHeal = false; NPC.HitSound = SoundID.NPCHit36; NPC.DeathSound = SoundID.NPCDeath39; NPC.Calamity().VulnerableToSickness = false; @@ -183,10 +189,12 @@ namespace CalamityMod.NPCs.Polterghast else NPC.rotation = NPC.velocity.ToRotation() + MathHelper.PiOver2; - NPC.damage = NPC.defDamage; + int reducedSetDamage = (int)Math.Round(NPC.defDamage * 0.5); if (!chargePhase) { + NPC.damage = reducedSetDamage; + // Set this here to avoid despawn issues reachedChargingPoint = false; @@ -302,18 +310,26 @@ namespace CalamityMod.NPCs.Polterghast if (NPC.Calamity().newAI[1] == 0f) { + NPC.damage = NPC.defDamage; + NPC.velocity = Vector2.Normalize(rotationVector) * chargeVelocity; NPC.Calamity().newAI[1] = 1f; } else { + NPC.damage = NPC.defDamage; + NPC.Calamity().newAI[2] += 1f; // Slow down for a few frames float totalChargeTime = chargeDistance * 4f / chargeVelocity; float slowDownTime = chargeVelocity; - if (NPC.Calamity().newAI[2] >= totalChargeTime - slowDownTime) - NPC.velocity *= 0.9f; + { + NPC.damage = reducedSetDamage; + + if (NPC.Calamity().newAI[2] >= totalChargeTime - slowDownTime) + NPC.velocity *= 0.9f; + } // Reset and either go back to normal or charge again if (NPC.Calamity().newAI[2] >= totalChargeTime) @@ -335,6 +351,9 @@ namespace CalamityMod.NPCs.Polterghast } else { + // Do not deal damage during movement to avoid cheap bullshit hits + NPC.damage = 0; + // Random location choice if (NPC.ai[0] == 0f) { @@ -356,9 +375,6 @@ namespace CalamityMod.NPCs.Polterghast else NPC.Calamity().newAI[2] = NPC.ai[0] == 2f ? player.Center.Y + chargeDistance : Main.npc[CalamityGlobalNPC.ghostBoss].Calamity().newAI[2]; - // Do not deal damage during movement to avoid cheap bullshit hits - NPC.damage = 0; - // Charge location Vector2 chargeVector = new Vector2(NPC.Calamity().newAI[1], NPC.Calamity().newAI[2]); Vector2 chargeLocationVelocity = Vector2.Normalize(chargeVector - vector) * chargeVelocity; @@ -387,7 +403,7 @@ namespace CalamityMod.NPCs.Polterghast SoundEngine.PlaySound(SoundID.Item125, NPC.Center); for (int i = 0; i < 30; i++) { - int dust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Ectoplasm, 0f, 0f, 100, default, 3f); + int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Ectoplasm, 0f, 0f, 100, default, 3f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 5f; } @@ -467,7 +483,6 @@ namespace CalamityMod.NPCs.Polterghast drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, color, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - Texture2D texture2D16 = ModContent.Request("CalamityMod/NPCs/Polterghast/PolterPhantomGlow").Value; Color c = Color.Red; if (!NPC.IsABestiaryIconDummy && (Main.npc[CalamityGlobalNPC.ghostBoss].ai[2] < changeColorGateValue || Main.npc[CalamityGlobalNPC.ghostBoss].Calamity().newAI[0] > changeColorGateValue)) c = Color.Black; @@ -485,11 +500,11 @@ namespace CalamityMod.NPCs.Polterghast otherAfterimageColor = Color.Lerp(otherAfterimageColor, Color.White, 0.5f); otherAfterimageColor = NPC.GetAlpha(otherAfterimageColor); otherAfterimageColor *= (afterimageAmt - j) / 15f; - spriteBatch.Draw(texture2D16, otherAfterimagePos, NPC.frame, otherAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(GlowTexture.Value, otherAfterimagePos, NPC.frame, otherAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } } - spriteBatch.Draw(texture2D16, drawLocation, NPC.frame, blackWhiteLerp, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(GlowTexture.Value, drawLocation, NPC.frame, blackWhiteLerp, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); return false; } @@ -536,7 +551,7 @@ namespace CalamityMod.NPCs.Polterghast public override void HitEffect(NPC.HitInfo hit) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 180, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.DungeonSpirit, hit.HitDirection, -1f, 0, default, 1f); if (NPC.life <= 0) { NPC.position.X = NPC.position.X + (NPC.width / 2); @@ -547,7 +562,7 @@ namespace CalamityMod.NPCs.Polterghast NPC.position.Y = NPC.position.Y - (NPC.height / 2); for (int i = 0; i < 10; i++) { - int ghostDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Polterplasm, 0f, 0f, 100, default, 2f); + int ghostDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Necroplasm, 0f, 0f, 100, default, 2f); Main.dust[ghostDust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -557,10 +572,10 @@ namespace CalamityMod.NPCs.Polterghast } for (int j = 0; j < 60; j++) { - int ghostDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 180, 0f, 0f, 100, default, 3f); + int ghostDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.DungeonSpirit, 0f, 0f, 100, default, 3f); Main.dust[ghostDust2].noGravity = true; Main.dust[ghostDust2].velocity *= 5f; - ghostDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 180, 0f, 0f, 100, default, 2f); + ghostDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.DungeonSpirit, 0f, 0f, 100, default, 2f); Main.dust[ghostDust2].velocity *= 2f; } } diff --git a/NPCs/Polterghast/Polterghast.cs b/NPCs/Polterghast/Polterghast.cs index 05f9fa0d76..d7f339cba4 100644 --- a/NPCs/Polterghast/Polterghast.cs +++ b/NPCs/Polterghast/Polterghast.cs @@ -1,4 +1,7 @@ -using CalamityMod.Dusts; +using System; +using System.Collections.Generic; +using System.IO; +using CalamityMod.Dusts; using CalamityMod.Events; using CalamityMod.Items.Accessories; using CalamityMod.Items.Armor.Vanity; @@ -14,23 +17,21 @@ using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Items.Weapons.Summon; +using CalamityMod.NPCs.Abyss; using CalamityMod.NPCs.NormalNPCs; using CalamityMod.Particles; using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; -using System.Collections.Generic; +using ReLogic.Content; using Terraria; +using Terraria.Audio; using Terraria.GameContent; using Terraria.GameContent.Bestiary; +using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using Terraria.GameContent.ItemDropRules; -using CalamityMod.NPCs.Abyss; namespace CalamityMod.NPCs.Polterghast { @@ -56,13 +57,15 @@ namespace CalamityMod.NPCs.Polterghast private int soundTimer = 0; private bool reachedChargingPoint = false; private bool threeAM = false; - private int nameStage = 1; public static readonly SoundStyle HitSound = new("CalamityMod/Sounds/NPCHit/PolterghastHit"); public static readonly SoundStyle P2Sound = new("CalamityMod/Sounds/Custom/Polterghast/PolterghastP2Transition"); public static readonly SoundStyle P3Sound = new("CalamityMod/Sounds/Custom/Polterghast/PolterghastP3Transition"); public static readonly SoundStyle SpawnSound = new("CalamityMod/Sounds/Custom/Polterghast/PolterghastSpawn"); public static readonly SoundStyle PhantomSound = new("CalamityMod/Sounds/Custom/Polterghast/PolterghastPhantomSpawn"); + public static Asset Texture_Glow; + public static Asset Texture_Glow2; + public static List creepySounds = new List { NPCs.DevourerofGods.DevourerofGodsHead.AttackSound, @@ -96,6 +99,11 @@ namespace CalamityMod.NPCs.Polterghast NPCID.Sets.TrailingMode[NPC.type] = 1; NPCID.Sets.BossBestiaryPriority.Add(Type); NPCID.Sets.MPAllowedEnemies[Type] = true; + if (!Main.dedServ) + { + Texture_Glow = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + Texture_Glow2 = ModContent.Request(Texture + "Glow2", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -125,23 +133,13 @@ namespace CalamityMod.NPCs.Polterghast public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.TheDungeon, new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Polterghast") }); } - public override void ModifyTypeName(ref string typeName) - { - typeName = nameStage switch - { - 2 => CalamityUtils.GetTextValue("NPCs.Necroghast"), - 3 => CalamityUtils.GetTextValue("NPCs.Necroplasm"), - _ => this.GetLocalizedValue("DisplayName"), - }; - } - public override void BossHeadSlot(ref int index) { bool death = CalamityWorld.death || BossRushEvent.BossRushActive; @@ -303,7 +301,7 @@ namespace CalamityMod.NPCs.Polterghast { SoundStyle[] creepyArray = creepySounds.ToArray(); SoundStyle selectedSound = creepyArray[Main.rand.Next(0, creepyArray.Length - 1)]; - SoundEngine.PlaySound(selectedSound with { Pitch = selectedSound.Pitch - 0.8f, Volume = selectedSound.Volume - 0.2f}, NPC.Center); + SoundEngine.PlaySound(selectedSound with { Pitch = selectedSound.Pitch - 0.8f, Volume = selectedSound.Volume - 0.2f }, NPC.Center); } } @@ -434,6 +432,12 @@ namespace CalamityMod.NPCs.Polterghast else NPC.rotation = NPC.velocity.ToRotation() + MathHelper.PiOver2; + int phase1ReducedSetDamage = (int)Math.Round(NPC.defDamage * 0.5); + int phase2Damage = (int)Math.Round(NPC.defDamage * 1.2); + int phase2ReducedSetDamage = (int)Math.Round(phase2Damage * 0.5); + int phase3Damage = (int)Math.Round(NPC.defDamage * 1.4); + int phase3ReducedSetDamage = (int)Math.Round(phase3Damage * 0.5); + if (!chargePhase) { NPC.ai[2] += 1f; @@ -540,18 +544,26 @@ namespace CalamityMod.NPCs.Polterghast if (calamityGlobalNPC.newAI[1] == 0f) { + NPC.damage = phase3 ? phase3Damage : phase2 ? phase2Damage : NPC.defDamage; + NPC.velocity = Vector2.Normalize(rotationVector) * chargeVelocity; calamityGlobalNPC.newAI[1] = 1f; } else { + NPC.damage = phase3 ? phase3Damage : phase2 ? phase2Damage : NPC.defDamage; + calamityGlobalNPC.newAI[2] += 1f; // Slow down for a few frames float totalChargeTime = chargeDistance * 4f / chargeVelocity; float slowDownTime = chargeVelocity; if (calamityGlobalNPC.newAI[2] >= totalChargeTime - slowDownTime) + { + NPC.damage = phase3 ? phase3ReducedSetDamage : phase2 ? phase2ReducedSetDamage : phase1ReducedSetDamage; + NPC.velocity *= 0.9f; + } // Reset and either go back to normal or charge again if (calamityGlobalNPC.newAI[2] >= totalChargeTime) @@ -577,6 +589,8 @@ namespace CalamityMod.NPCs.Polterghast } else { + NPC.damage = phase3 ? phase3ReducedSetDamage : phase2 ? phase2ReducedSetDamage : phase1ReducedSetDamage; + // Pick a charging location // Set charge locations X if (vector.X >= player.Center.X) @@ -607,7 +621,7 @@ namespace CalamityMod.NPCs.Polterghast SoundEngine.PlaySound(SoundID.Item125, NPC.Center); for (int i = 0; i < 30; i++) { - int dust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Ectoplasm, 0f, 0f, 100, default, 3f); + int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Ectoplasm, 0f, 0f, 100, default, 3f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 5f; } @@ -654,13 +668,17 @@ namespace CalamityMod.NPCs.Polterghast NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, NPC.whoAmI, 0f, 0f, 0f, 0, 0, 0); } + bool isInChargePhase = charging && chargePhase; + // Phase 1: "Polterghast" if (!phase2 && !phase3) { - NPC.damage = NPC.defDamage; + if (!isInChargePhase) + NPC.damage = phase1ReducedSetDamage; + NPC.defense = NPC.defDefense; - if (Main.netMode != NetmodeID.MultiplayerClient && !charging && !chargePhase) + if (Main.netMode != NetmodeID.MultiplayerClient && !isInChargePhase) { NPC.localAI[1] += expertMode ? 1.5f : 1f; if (speedBoost) @@ -770,7 +788,7 @@ namespace CalamityMod.NPCs.Polterghast for (int i = 0; i < 10; i++) { - int ghostDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Polterplasm, 0f, 0f, 100, default, 2f); + int ghostDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Necroplasm, 0f, 0f, 100, default, 2f); Main.dust[ghostDust].velocity *= 3f; Main.dust[ghostDust].noGravity = true; if (Main.rand.NextBool()) @@ -781,21 +799,20 @@ namespace CalamityMod.NPCs.Polterghast } for (int j = 0; j < 30; j++) { - int ghostDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Ectoplasm, 0f, 0f, 100, default, 3f); + int ghostDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Ectoplasm, 0f, 0f, 100, default, 3f); Main.dust[ghostDust2].noGravity = true; Main.dust[ghostDust2].velocity *= 5f; - ghostDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Ectoplasm, 0f, 0f, 100, default, 2f); + ghostDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Ectoplasm, 0f, 0f, 100, default, 2f); Main.dust[ghostDust2].velocity *= 2f; } } - // Actually changes name to Necroghast - nameStage = 2; + if (!isInChargePhase) + NPC.damage = phase2ReducedSetDamage; - NPC.damage = (int)(NPC.defDamage * 1.2f); - NPC.defense = (int)(NPC.defDefense * 0.8f); + NPC.defense = (int)Math.Round(NPC.defDefense * 0.8); - if (Main.netMode != NetmodeID.MultiplayerClient && !charging && !chargePhase) + if (Main.netMode != NetmodeID.MultiplayerClient && !isInChargePhase) { NPC.localAI[1] += expertMode ? 1.5f : 1f; if (speedBoost) @@ -924,7 +941,7 @@ namespace CalamityMod.NPCs.Polterghast for (int i = 0; i < 10; i++) { - int ghostDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Polterplasm, 0f, 0f, 100, default, 2f); + int ghostDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Necroplasm, 0f, 0f, 100, default, 2f); Main.dust[ghostDust].velocity *= 3f; Main.dust[ghostDust].noGravity = true; if (Main.rand.NextBool()) @@ -935,25 +952,24 @@ namespace CalamityMod.NPCs.Polterghast } for (int j = 0; j < 30; j++) { - int ghostDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Ectoplasm, 0f, 0f, 100, default, 3f); + int ghostDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Ectoplasm, 0f, 0f, 100, default, 3f); Main.dust[ghostDust2].noGravity = true; Main.dust[ghostDust2].velocity *= 5f; - ghostDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Ectoplasm, 0f, 0f, 100, default, 2f); + ghostDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Ectoplasm, 0f, 0f, 100, default, 2f); Main.dust[ghostDust2].velocity *= 2f; } } - // Actually changes name to Necroplasm - nameStage = 3; + if (!isInChargePhase) + NPC.damage = phase3ReducedSetDamage; - NPC.damage = (int)(NPC.defDamage * 1.4f); - NPC.defense = (int)(NPC.defDefense * 0.5f); + NPC.defense = (int)Math.Round(NPC.defDefense * 0.5); NPC.localAI[1] += 1f; if (NPC.localAI[1] >= (getPissed ? 200f : 280f) && Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height)) { NPC.localAI[1] = 0f; - if (Main.netMode != NetmodeID.MultiplayerClient && !charging && !chargePhase) + if (Main.netMode != NetmodeID.MultiplayerClient && !isInChargePhase) { Vector2 firingPosition = vector; float playerXDist = player.Center.X - firingPosition.X; @@ -1001,7 +1017,7 @@ namespace CalamityMod.NPCs.Polterghast spiritSpawn.X += spiritXDist * 3f; spiritSpawn.Y += spiritYDist * 3f; - if (NPC.CountNPCS(ModContent.NPCType()) < 2 && Main.netMode != NetmodeID.MultiplayerClient && !charging && !chargePhase) + if (NPC.CountNPCS(ModContent.NPCType()) < 2 && Main.netMode != NetmodeID.MultiplayerClient && !isInChargePhase) { SoundEngine.PlaySound(PhantomSound, NPC.Center); int phantomSpirit = NPC.NewNPC(NPC.GetSource_FromAI(), (int)vector.X, (int)vector.Y, ModContent.NPCType()); @@ -1010,11 +1026,6 @@ namespace CalamityMod.NPCs.Polterghast Main.npc[phantomSpirit].netUpdate = true; } } - - if (Main.zenithWorld) - { - NPC.GivenName = CalamityUtils.GetTextValue("NPCs.Polterplasm"); - } } } } @@ -1080,7 +1091,7 @@ namespace CalamityMod.NPCs.Polterghast // Materials normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType(), 1, 7, 15)); - normalOnly.Add(ModContent.ItemType(), 1, 30, 40); + normalOnly.Add(ModContent.ItemType(), 1, 30, 40); // Vanity normalOnly.Add(ModContent.ItemType(), 7); @@ -1149,7 +1160,7 @@ namespace CalamityMod.NPCs.Polterghast spriteEffects = SpriteEffects.FlipHorizontally; Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; - Texture2D texture2D16 = ModContent.Request("CalamityMod/NPCs/Polterghast/PolterghastGlow2").Value; + Texture2D texture2D16 = Texture_Glow2.Value; Vector2 halfSizeTexture = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2); int afterimageAmt = 7; @@ -1174,7 +1185,7 @@ namespace CalamityMod.NPCs.Polterghast Color c = NPC.IsABestiaryIconDummy ? Color.White : NPC.GetAlpha(drawColor); spriteBatch.Draw(texture2D15, vector43, NPC.frame, c, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/Polterghast/PolterghastGlow").Value; + texture2D15 = Texture_Glow.Value; Color secondColorLerp = Color.Lerp(Color.White, Color.Cyan, 0.5f); Color lightRed = new Color(255, 100, 100, 255); @@ -1291,7 +1302,7 @@ namespace CalamityMod.NPCs.Polterghast public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { - NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } @@ -1308,7 +1319,7 @@ namespace CalamityMod.NPCs.Polterghast NPC.position.Y = NPC.position.Y - (NPC.height / 2); for (int i = 0; i < 10; i++) { - int ghostDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Polterplasm, 0f, 0f, 100, default, 2f); + int ghostDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Necroplasm, 0f, 0f, 100, default, 2f); Main.dust[ghostDust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -1318,10 +1329,10 @@ namespace CalamityMod.NPCs.Polterghast } for (int j = 0; j < 60; j++) { - int ghostDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Ectoplasm, 0f, 0f, 100, default, 3f); + int ghostDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Ectoplasm, 0f, 0f, 100, default, 3f); Main.dust[ghostDust2].noGravity = true; Main.dust[ghostDust2].velocity *= 5f; - ghostDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Ectoplasm, 0f, 0f, 100, default, 2f); + ghostDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Ectoplasm, 0f, 0f, 100, default, 2f); Main.dust[ghostDust2].velocity *= 2f; } } diff --git a/NPCs/Polterghast/PolterghastHook.cs b/NPCs/Polterghast/PolterghastHook.cs index 3966ad294b..e6b04762ad 100644 --- a/NPCs/Polterghast/PolterghastHook.cs +++ b/NPCs/Polterghast/PolterghastHook.cs @@ -1,10 +1,11 @@ -using CalamityMod.Events; +using System; +using System.IO; +using CalamityMod.Events; using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.ID; @@ -16,11 +17,19 @@ namespace CalamityMod.NPCs.Polterghast private int despawnTimer = 300; private bool phase2 = false; + public static Asset GlowTexture; + public static Asset ChainTexture; + public override void SetStaticDefaults() { this.HideFromBestiary(); Main.npcFrameCount[NPC.type] = 2; NPCID.Sets.TrailingMode[NPC.type] = 1; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + ChainTexture = ModContent.Request("CalamityMod/NPCs/Polterghast/PolterghastChain", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -126,7 +135,7 @@ namespace CalamityMod.NPCs.Polterghast Movement(phase2, expertMode, revenge, death, speedBoost, despawnBoost, lifeRatio, tileEnrageMult, player); // Fire projectiles - Vector2 hookPosition = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); + Vector2 hookPosition = NPC.Center; float targetX = Main.player[NPC.target].position.X + (Main.player[NPC.target].width / 2) - hookPosition.X; float targetY = Main.player[NPC.target].position.Y + (Main.player[NPC.target].height / 2) - hookPosition.Y; float targetDistance = (float)Math.Sqrt(targetX * targetX + targetY * targetY); @@ -261,7 +270,8 @@ namespace CalamityMod.NPCs.Polterghast NPC.localAI[1] = Vector2.Distance(NPC.Center, player.Center) * 0.01f; NPC.netUpdate = true; } - } catch + } + catch { } } @@ -351,9 +361,9 @@ namespace CalamityMod.NPCs.Polterghast if (Main.npc[CalamityGlobalNPC.ghostBoss].Calamity().newAI[0] > changeColorGateValue) cyanLerpColor = Color.Lerp(cyanLerpColor, lightRed, MathHelper.Clamp((Main.npc[CalamityGlobalNPC.ghostBoss].Calamity().newAI[0] - changeColorGateValue) / timeToReachFullColor, 0f, 1f)); - Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Polterghast/PolterghastChain").Value, new Vector2(center.X - screenPos.X, center.Y - screenPos.Y), - new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, 0, ModContent.Request("CalamityMod/NPCs/Polterghast/PolterghastChain").Value.Width, chainWidth)), cyanLerpColor, chainRotation, - new Vector2(ModContent.Request("CalamityMod/NPCs/Polterghast/PolterghastChain").Value.Width * 0.5f, ModContent.Request("CalamityMod/NPCs/Polterghast/PolterghastChain").Value.Height * 0.5f), 1f, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(ChainTexture.Value, new Vector2(center.X - screenPos.X, center.Y - screenPos.Y), + new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, 0, ChainTexture.Value.Width, chainWidth)), cyanLerpColor, chainRotation, + new Vector2(ChainTexture.Value.Width * 0.5f, ChainTexture.Value.Height * 0.5f), 1f, SpriteEffects.None, 0f); } } @@ -385,7 +395,7 @@ namespace CalamityMod.NPCs.Polterghast drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/Polterghast/PolterghastHookGlow").Value; + texture2D15 = GlowTexture.Value; Color cyanLerp2 = Color.Lerp(Color.White, Color.Cyan, 0.5f); if (Main.npc[CalamityGlobalNPC.ghostBoss].Calamity().newAI[0] > changeColorGateValue) @@ -466,23 +476,17 @@ namespace CalamityMod.NPCs.Polterghast return false; } - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - cooldownSlot = ImmunityCooldownID.Bosses; - return true; - } - public override void HitEffect(NPC.HitInfo hit) { for (int k = 0; k < 5; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 180, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.DungeonSpirit, 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, 180, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.DungeonSpirit, hit.HitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/PrimordialWyrm/PrimordialWyrmBody.cs b/NPCs/PrimordialWyrm/PrimordialWyrmBody.cs index f36e27e98e..8a8fb1aa1d 100644 --- a/NPCs/PrimordialWyrm/PrimordialWyrmBody.cs +++ b/NPCs/PrimordialWyrm/PrimordialWyrmBody.cs @@ -1,8 +1,9 @@ -using CalamityMod.World; +using System; +using System.IO; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.ID; @@ -13,10 +14,17 @@ namespace CalamityMod.NPCs.PrimordialWyrm { public class PrimordialWyrmBody : ModNPC { + public static Asset GlowTexture; + public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.PrimordialWyrmHead.DisplayName"); + public override void SetStaticDefaults() { this.HideFromBestiary(); + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -158,6 +166,11 @@ namespace CalamityMod.NPCs.PrimordialWyrm NPC.spriteDirection = (directionToNextSegment.X > 0).ToDirectionInt(); } + public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) + { + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); + } + public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { SpriteEffects spriteEffects = SpriteEffects.None; @@ -172,7 +185,7 @@ namespace CalamityMod.NPCs.PrimordialWyrm center += vector * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture, center, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector, NPC.scale, spriteEffects, 0f); - texture = ModContent.Request("CalamityMod/NPCs/PrimordialWyrm/PrimordialWyrmBodyGlow").Value; + texture = GlowTexture.Value; spriteBatch.Draw(texture, center, NPC.frame, Color.White * NPC.Opacity, NPC.rotation, vector, NPC.scale, spriteEffects, 0f); return false; @@ -185,7 +198,7 @@ namespace CalamityMod.NPCs.PrimordialWyrm if (NPC.life <= 0) { for (int k = 0; k < 10; k++) - Dust.NewDust(NPC.position, NPC.width, NPC.height, 4, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, hit.HitDirection, -1f, 0, default, 1f); if (Main.netMode != NetmodeID.Server) { diff --git a/NPCs/PrimordialWyrm/PrimordialWyrmBodyAlt.cs b/NPCs/PrimordialWyrm/PrimordialWyrmBodyAlt.cs index f4263b6cde..fa061524e4 100644 --- a/NPCs/PrimordialWyrm/PrimordialWyrmBodyAlt.cs +++ b/NPCs/PrimordialWyrm/PrimordialWyrmBodyAlt.cs @@ -1,8 +1,9 @@ -using CalamityMod.World; +using System; +using System.IO; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.ID; @@ -13,10 +14,16 @@ namespace CalamityMod.NPCs.PrimordialWyrm { public class PrimordialWyrmBodyAlt : ModNPC { + public static Asset GlowTexture; + public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.PrimordialWyrmHead.DisplayName"); public override void SetStaticDefaults() { this.HideFromBestiary(); + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -144,8 +151,8 @@ namespace CalamityMod.NPCs.PrimordialWyrm } } - // Decide segment offset stuff. - NPC aheadSegment = Main.npc[(int)NPC.ai[1]]; + // Decide segment offset stuff. + NPC aheadSegment = Main.npc[(int)NPC.ai[1]]; Vector2 directionToNextSegment = aheadSegment.Center - NPC.Center; if (aheadSegment.rotation != NPC.rotation) { @@ -158,6 +165,11 @@ namespace CalamityMod.NPCs.PrimordialWyrm NPC.spriteDirection = (directionToNextSegment.X > 0).ToDirectionInt(); } + public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) + { + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); + } + public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { SpriteEffects spriteEffects = SpriteEffects.None; @@ -172,7 +184,7 @@ namespace CalamityMod.NPCs.PrimordialWyrm center += vector * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture, center, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector, NPC.scale, spriteEffects, 0f); - texture = ModContent.Request("CalamityMod/NPCs/PrimordialWyrm/PrimordialWyrmBodyAltGlow").Value; + texture = GlowTexture.Value; spriteBatch.Draw(texture, center, NPC.frame, Color.White * NPC.Opacity, NPC.rotation, vector, NPC.scale, spriteEffects, 0f); return false; @@ -185,7 +197,7 @@ namespace CalamityMod.NPCs.PrimordialWyrm if (NPC.life <= 0) { for (int k = 0; k < 10; k++) - Dust.NewDust(NPC.position, NPC.width, NPC.height, 4, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, hit.HitDirection, -1f, 0, default, 1f); if (Main.netMode != NetmodeID.Server) { diff --git a/NPCs/PrimordialWyrm/PrimordialWyrmHead.cs b/NPCs/PrimordialWyrm/PrimordialWyrmHead.cs index 896e52d12c..974863ec59 100644 --- a/NPCs/PrimordialWyrm/PrimordialWyrmHead.cs +++ b/NPCs/PrimordialWyrm/PrimordialWyrmHead.cs @@ -1,7 +1,10 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using System.IO; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Events; using CalamityMod.Items.Materials; +using CalamityMod.Items.Pets; using CalamityMod.Items.Placeables; using CalamityMod.Items.Placeables.Furniture.DevPaintings; using CalamityMod.Items.Potions; @@ -14,8 +17,7 @@ using CalamityMod.Sounds; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -80,10 +82,12 @@ namespace CalamityMod.NPCs.PrimordialWyrm public static readonly SoundStyle ChargeSound = new("CalamityMod/Sounds/Custom/PrimordialWyrmCharge"); public static readonly SoundStyle DeathSound = new("CalamityMod/Sounds/NPCKilled/PrimordialWyrmDeath"); + public static Asset GlowTexture; + public override void SetStaticDefaults() { NPCID.Sets.BossBestiaryPriority.Add(Type); - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { Scale = 0.50f, PortraitScale = 0.6f, @@ -93,6 +97,10 @@ namespace CalamityMod.NPCs.PrimordialWyrm value.Position.X += 55; value.Position.Y += 5; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -136,7 +144,7 @@ namespace CalamityMod.NPCs.PrimordialWyrm public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { //AAAAAAAAAAAAH Scary abyss superboss guy so he gets pitch black bg and no biome source. //eidolon wyrm comment jumpscare!!!!!! @@ -451,7 +459,7 @@ namespace CalamityMod.NPCs.PrimordialWyrm float chargeVelocityScalarIncrement = 0.005f; float totalChargeDistance = 3000f; - bool lookingAtTarget = NPC.SafeDirectionTo(player.Center).AngleBetween((NPC.rotation - MathHelper.PiOver2).ToRotationVector2()) < MathHelper.ToRadians(15f); + bool lookingAtTarget = (player.Center - NPC.Center).SafeNormalize(Vector2.UnitY).ToRotation().AngleTowards(NPC.velocity.ToRotation(), MathHelper.PiOver4) == NPC.velocity.ToRotation(); // Telekinesis while enraged if (!targetDownDeep) @@ -465,7 +473,7 @@ namespace CalamityMod.NPCs.PrimordialWyrm for (int i = 0; i < 20; i++) { - int dust = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 185, 0f, 0f, 100, default, 2f); + int dust = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, DustID.FrostHydra, 0f, 0f, 100, default, 2f); Main.dust[dust].velocity *= 0.6f; if (Main.rand.NextBool()) { @@ -476,9 +484,9 @@ namespace CalamityMod.NPCs.PrimordialWyrm for (int j = 0; j < 30; j++) { - int dust = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 185, 0f, 0f, 100, default, 3f); + int dust = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, DustID.FrostHydra, 0f, 0f, 100, default, 3f); Main.dust[dust].noGravity = true; - dust = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 185, 0f, 0f, 100, default, 2f); + dust = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, DustID.FrostHydra, 0f, 0f, 100, default, 2f); Main.dust[dust].velocity *= 0.2f; } @@ -656,14 +664,14 @@ namespace CalamityMod.NPCs.PrimordialWyrm float rotation = MathHelper.Clamp((float)Main.rand.NextDouble() * 1f - 0.5f, -0.5f, 0.5f); Vector2 dustPosition = new Vector2(-NPC.width * 0.2f * NPC.scale, 0f).RotatedBy(rotation * ((float)Math.PI * 2f)).RotatedBy(NPC.velocity.ToRotation()); - int dust = Dust.NewDust(NPC.Center - Vector2.One * 5f, 10, 10, 226, (0f - NPC.velocity.X) / 3f, (0f - NPC.velocity.Y) / 3f, 150, Color.Transparent, 0.7f); + int dust = Dust.NewDust(NPC.Center - Vector2.One * 5f, 10, 10, DustID.Electric, (0f - NPC.velocity.X) / 3f, (0f - NPC.velocity.Y) / 3f, 150, Color.Transparent, 0.7f); Main.dust[dust].position = NPC.Center + dustPosition; Main.dust[dust].velocity = Vector2.Normalize(Main.dust[dust].position - NPC.Center) * 2f; Main.dust[dust].noGravity = true; rotation = MathHelper.Clamp((float)Main.rand.NextDouble() * 1f - 0.5f, -0.5f, 0.5f); dustPosition = new Vector2(-NPC.width * 0.6f * NPC.scale, 0f).RotatedBy(rotation * ((float)Math.PI * 2f)).RotatedBy(NPC.velocity.ToRotation()); - dust = Dust.NewDust(NPC.Center - Vector2.One * 5f, 10, 10, 226, (0f - NPC.velocity.X) / 3f, (0f - NPC.velocity.Y) / 3f, 150, Color.Transparent, 0.7f); + dust = Dust.NewDust(NPC.Center - Vector2.One * 5f, 10, 10, DustID.Electric, (0f - NPC.velocity.X) / 3f, (0f - NPC.velocity.Y) / 3f, 150, Color.Transparent, 0.7f); Main.dust[dust].velocity = Vector2.Zero; Main.dust[dust].position = NPC.Center + dustPosition; Main.dust[dust].noGravity = true; @@ -944,14 +952,14 @@ namespace CalamityMod.NPCs.PrimordialWyrm float rotation = MathHelper.Clamp((float)Main.rand.NextDouble() * 1f - 0.5f, -0.5f, 0.5f); Vector2 dustPosition = new Vector2(-NPC.width * 0.2f * NPC.scale, 0f).RotatedBy(rotation * ((float)Math.PI * 2f)).RotatedBy(NPC.velocity.ToRotation()); - int dust = Dust.NewDust(NPC.Center - Vector2.One * 5f, 10, 10, 197, 0f, 0f, 100, Color.Transparent); + int dust = Dust.NewDust(NPC.Center - Vector2.One * 5f, 10, 10, DustID.NorthPole, 0f, 0f, 100, Color.Transparent); Main.dust[dust].position = NPC.Center + dustPosition; Main.dust[dust].velocity = Vector2.Normalize(Main.dust[dust].position - NPC.Center) * 2f; Main.dust[dust].noGravity = true; rotation = MathHelper.Clamp((float)Main.rand.NextDouble() * 1f - 0.5f, -0.5f, 0.5f); dustPosition = new Vector2(-NPC.width * 0.6f * NPC.scale, 0f).RotatedBy(rotation * ((float)Math.PI * 2f)).RotatedBy(NPC.velocity.ToRotation()); - dust = Dust.NewDust(NPC.Center - Vector2.One * 5f, 10, 10, 197, 0f, 0f, 100, Color.Transparent); + dust = Dust.NewDust(NPC.Center - Vector2.One * 5f, 10, 10, DustID.NorthPole, 0f, 0f, 100, Color.Transparent); Main.dust[dust].velocity = Vector2.Zero; Main.dust[dust].position = NPC.Center + dustPosition; Main.dust[dust].noGravity = true; @@ -1369,7 +1377,7 @@ namespace CalamityMod.NPCs.PrimordialWyrm Vector2 dustRotation = Vector2.Normalize(NPC.velocity) * new Vector2((NPC.width + 50) / 2f, NPC.height) * 0.75f; dustRotation = dustRotation.RotatedBy((num1474 - (dustAmt / 2 - 1)) * (double)pie / (float)dustAmt) + NPC.Center; Vector2 dustVelocity = ((float)(Main.rand.NextDouble() * pie) - MathHelper.PiOver2).ToRotationVector2() * Main.rand.Next(3, 8); - int chargeDust = Dust.NewDust(dustRotation + dustVelocity, 0, 0, 172, dustVelocity.X * 2f, dustVelocity.Y * 2f, 100, default, 1.4f); + int chargeDust = Dust.NewDust(dustRotation + dustVelocity, 0, 0, DustID.DungeonWater, dustVelocity.X * 2f, dustVelocity.Y * 2f, 100, default, 1.4f); Main.dust[chargeDust].noGravity = true; Main.dust[chargeDust].noLight = true; Main.dust[chargeDust].velocity /= 4f; @@ -1433,7 +1441,7 @@ namespace CalamityMod.NPCs.PrimordialWyrm center += vector * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture, center, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector, NPC.scale, spriteEffects, 0f); - texture = ModContent.Request("CalamityMod/NPCs/PrimordialWyrm/PrimordialWyrmHeadGlow").Value; + texture = GlowTexture.Value; spriteBatch.Draw(texture, center, NPC.frame, Color.White * NPC.Opacity, NPC.rotation, vector, NPC.scale, spriteEffects, 0f); return false; @@ -1447,14 +1455,15 @@ namespace CalamityMod.NPCs.PrimordialWyrm public override void ModifyNPCLoot(NPCLoot npcLoot) { npcLoot.Add(ModContent.ItemType()); - npcLoot.Add(ModContent.ItemType()); + npcLoot.Add(ModContent.ItemType()); npcLoot.Add(ModContent.ItemType()); + npcLoot.Add(ModContent.ItemType()); npcLoot.Add(ModContent.ItemType(), 1, 80, 100); npcLoot.Add(ModContent.ItemType(), ThankYouPainting.DropInt); - var postClone = npcLoot.DefineConditionalDropSet(() => DownedBossSystem.downedCalamitasClone); - postClone.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 1, 50, 108, 65, 135)); - postClone.Add(ItemID.Ectoplasm, 1, 21, 32); + var postLevi = npcLoot.DefineConditionalDropSet(() => DownedBossSystem.downedLeviathan); + postLevi.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 1, 50, 108, 65, 135)); + postLevi.Add(ItemID.Ectoplasm, 1, 21, 32); } public override void HitEffect(NPC.HitInfo hit) @@ -1464,12 +1473,12 @@ namespace CalamityMod.NPCs.PrimordialWyrm return; for (int k = 0; k < 15; k++) - Dust.NewDust(NPC.position, NPC.width, NPC.height, 4, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, hit.HitDirection, -1f, 0, default, 1f); if (NPC.life <= 0) { for (int k = 0; k < 15; k++) - Dust.NewDust(NPC.position, NPC.width, NPC.height, 4, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, hit.HitDirection, -1f, 0, default, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("PrimordialWyrm").Type, 1f); } @@ -1479,7 +1488,7 @@ namespace CalamityMod.NPCs.PrimordialWyrm public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { - NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } diff --git a/NPCs/PrimordialWyrm/PrimordialWyrmTail.cs b/NPCs/PrimordialWyrm/PrimordialWyrmTail.cs index 2a4545fa9b..e192350bad 100644 --- a/NPCs/PrimordialWyrm/PrimordialWyrmTail.cs +++ b/NPCs/PrimordialWyrm/PrimordialWyrmTail.cs @@ -1,7 +1,8 @@ -using CalamityMod.World; +using System; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.ID; @@ -12,10 +13,16 @@ namespace CalamityMod.NPCs.PrimordialWyrm { public class PrimordialWyrmTail : ModNPC { + public static Asset GlowTexture; + public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.PrimordialWyrmHead.DisplayName"); public override void SetStaticDefaults() { this.HideFromBestiary(); + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -120,6 +127,11 @@ namespace CalamityMod.NPCs.PrimordialWyrm NPC.spriteDirection = (directionToNextSegment.X > 0).ToDirectionInt(); } + public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) + { + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); + } + public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { SpriteEffects spriteEffects = SpriteEffects.None; @@ -134,7 +146,7 @@ namespace CalamityMod.NPCs.PrimordialWyrm center += vector * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture, center, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector, NPC.scale, spriteEffects, 0f); - texture = ModContent.Request("CalamityMod/NPCs/PrimordialWyrm/PrimordialWyrmTailGlow").Value; + texture = GlowTexture.Value; spriteBatch.Draw(texture, center, NPC.frame, Color.White * NPC.Opacity, NPC.rotation, vector, NPC.scale, spriteEffects, 0f); return false; @@ -147,7 +159,7 @@ namespace CalamityMod.NPCs.PrimordialWyrm if (NPC.life <= 0) { for (int k = 0; k < 10; k++) - Dust.NewDust(NPC.position, NPC.width, NPC.height, 4, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, hit.HitDirection, -1f, 0, default, 1f); if (Main.netMode != NetmodeID.Server) { diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianCommander.cs b/NPCs/ProfanedGuardians/ProfanedGuardianCommander.cs index d608835485..d85a7326d6 100644 --- a/NPCs/ProfanedGuardians/ProfanedGuardianCommander.cs +++ b/NPCs/ProfanedGuardians/ProfanedGuardianCommander.cs @@ -1,28 +1,29 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using System.IO; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; +using CalamityMod.Events; using CalamityMod.Items.Accessories; using CalamityMod.Items.Armor.Vanity; using CalamityMod.Items.LoreItems; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Furniture.BossRelics; +using CalamityMod.Items.Placeables.Furniture.DevPaintings; +using CalamityMod.Items.Placeables.Furniture.Trophies; using CalamityMod.Items.SummonItems; using CalamityMod.Items.Weapons.Typeless; using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; +using ReLogic.Content; using Terraria; +using Terraria.Audio; using Terraria.GameContent; using Terraria.GameContent.Bestiary; using Terraria.Graphics.Effects; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Items.Placeables.Furniture.BossRelics; -using CalamityMod.Items.Placeables.Furniture.DevPaintings; -using CalamityMod.Items.Placeables.Furniture.Trophies; -using CalamityMod.Events; -using Terraria.Audio; -using CalamityMod.Items.Materials; using Filters = Terraria.Graphics.Effects.Filters; namespace CalamityMod.NPCs.ProfanedGuardians @@ -38,12 +39,15 @@ namespace CalamityMod.NPCs.ProfanedGuardians public static readonly SoundStyle DashSound = new("CalamityMod/Sounds/Custom/ProfanedGuardians/GuardianDash"); public static readonly SoundStyle ShieldDeathSound = new("CalamityMod/Sounds/Custom/ProfanedGuardians/GuardianShieldDeactivate"); + public static Asset Texture_Glow; + public static Asset TextureNight_Glow; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 10; NPCID.Sets.TrailingMode[NPC.type] = 1; NPCID.Sets.BossBestiaryPriority.Add(Type); - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { PortraitPositionXOverride = 0, PortraitScale = 0.75f, @@ -52,7 +56,12 @@ namespace CalamityMod.NPCs.ProfanedGuardians value.Position.X += 25; value.Position.Y += 15; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; - NPCID.Sets.MPAllowedEnemies[Type] = true; + NPCID.Sets.MPAllowedEnemies[Type] = true; + if (!Main.dedServ) + { + Texture_Glow = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + TextureNight_Glow = ModContent.Request(Texture + "GlowNight", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -84,11 +93,11 @@ namespace CalamityMod.NPCs.ProfanedGuardians public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.TheHallow, BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.TheUnderworld, - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.ProfanedGuardianCommander") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.ProfanedGuardianCommander") }); } @@ -235,7 +244,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians currentDustPos = Vector2.Lerp(dustLineStart, dustLineEnd, i / (float)maxHealDustIterations); Color dustColor = Main.hslToRgb(Main.rgbToHsl(new Color(255, 200, Math.Abs(Main.DiscoB - (int)(dustSpawned * 2.55f)))).X, 1f, 0.5f); dustColor.A = 255; - int dust = Dust.NewDust(currentDustPos, 0, 0, 267, 0f, 0f, 0, dustColor, 1f); + int dust = Dust.NewDust(currentDustPos, 0, 0, DustID.RainbowMk2, 0f, 0f, 0, dustColor, 1f); Main.dust[dust].position = currentDustPos; Main.dust[dust].velocity = spinningpoint.RotatedBy(MathHelper.TwoPi * i / maxHealDustIterations) * dustVelocityMult * (0.8f + Main.rand.NextFloat() * 0.4f) + NPC.velocity; Main.dust[dust].noGravity = true; @@ -392,6 +401,9 @@ namespace CalamityMod.NPCs.ProfanedGuardians if (NPC.ai[0] == 0f) { + // Avoid cheap bullshit + NPC.damage = 0; + // Face the target if (Math.Abs(NPC.Center.X - player.Center.X) > 10f) { @@ -623,6 +635,9 @@ namespace CalamityMod.NPCs.ProfanedGuardians } else if (NPC.ai[0] == 1f) { + // Set damage + NPC.damage = NPC.defDamage; + // Face the target if (Math.Abs(NPC.Center.X - player.Center.X) > 10f) { @@ -657,6 +672,9 @@ namespace CalamityMod.NPCs.ProfanedGuardians } else if (NPC.ai[0] == 2f) { + // Set damage + NPC.damage = NPC.defDamage; + // Face the direction of the charge if (Math.Sign(NPC.velocity.X) != 0) NPC.spriteDirection = -Math.Sign(NPC.velocity.X); @@ -722,6 +740,9 @@ namespace CalamityMod.NPCs.ProfanedGuardians } else if (NPC.ai[0] == 3f) { + // Avoid cheap bullshit + NPC.damage = 0; + // Face the direction of the charge if (Math.Sign(NPC.velocity.X) != 0) NPC.spriteDirection = -Math.Sign(NPC.velocity.X); @@ -751,6 +772,9 @@ namespace CalamityMod.NPCs.ProfanedGuardians } else if (NPC.ai[0] == 4f) { + // Avoid cheap bullshit + NPC.damage = 0; + // Face the target if (Math.Abs(NPC.Center.X - player.Center.X) > 10f) { @@ -866,6 +890,9 @@ namespace CalamityMod.NPCs.ProfanedGuardians } else if (NPC.ai[0] == 5f) { + // Avoid cheap bullshit + NPC.damage = 0; + // Face the target if (Math.Abs(NPC.Center.X - player.Center.X) > 10f) { @@ -1019,11 +1046,11 @@ namespace CalamityMod.NPCs.ProfanedGuardians drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY) + drawOffset; spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, colorOverride ?? NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/ProfanedGuardians/ProfanedGuardianCommanderGlow").Value; + texture2D15 = Texture_Glow.Value; Color timeBasedColorLerp = Color.Lerp(Color.White, Color.Yellow, 0.5f); if (Main.remixWorld) { - texture2D15 = ModContent.Request("CalamityMod/NPCs/ProfanedGuardians/ProfanedGuardianCommanderGlowNight").Value; + texture2D15 = TextureNight_Glow.Value; timeBasedColorLerp = Color.Cyan; } if (colorOverride != null) @@ -1135,7 +1162,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians color *= 0.6f; color2 *= 0.6f; float scaleMult = 1.2f + scaleDuringShieldDespawn; - + // The scale used for the noise overlay polygons also grows and shrinks // This is intentionally out of sync with the shield, and intentionally desynced per player // Don't put this anywhere less than 0.25f or higher than 1f. The higher it is, the denser / more zoomed out the noise overlay is. @@ -1147,26 +1174,26 @@ namespace CalamityMod.NPCs.ProfanedGuardians shieldEffect.Parameters["blowUpPower"].SetValue(2.8f); shieldEffect.Parameters["blowUpSize"].SetValue(0.4f); shieldEffect.Parameters["noiseScale"].SetValue(noiseScale); - + shieldEffect.Parameters["shieldOpacity"].SetValue(opacityScaleDuringShieldDespawn); shieldEffect.Parameters["shieldEdgeBlendStrenght"].SetValue(4f); - + Color edgeColor = CalamityUtils.MulticolorLerp(Main.GlobalTimeWrappedHourly * 0.2f, color, color2); - + // Define shader parameters for shield color shieldEffect.Parameters["shieldColor"].SetValue(color.ToVector3()); shieldEffect.Parameters["shieldEdgeColor"].SetValue(edgeColor.ToVector3()); - + spriteBatch.Draw(shieldTexture, shieldDrawPos, shieldFrame, color, NPC.rotation, origin, shieldScale2 * scaleMult, SpriteEffects.None, 0f); spriteBatch.Draw(shieldTexture, shieldDrawPos, shieldFrame, color2, NPC.rotation, origin, shieldScale2 * scaleMult * 0.95f, SpriteEffects.None, 0f); spriteBatch.Draw(shieldTexture, shieldDrawPos, shieldFrame, color, NPC.rotation, origin, shieldScale * scaleMult, SpriteEffects.None, 0f); spriteBatch.Draw(shieldTexture, shieldDrawPos, shieldFrame, color2, NPC.rotation, origin, shieldScale * scaleMult * 0.95f, SpriteEffects.None, 0f); - + // The shield for the border MUST be drawn before the main shield, it becomes incredibly visually obnoxious otherwise. Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, shieldEffect, Main.GameViewMatrix.TransformationMatrix); - + // Fetch shield heat overlay texture (this is the neutrons fed to the shader) Texture2D heatTex = ModContent.Request("CalamityMod/ExtraTextures/GreyscaleGradients/Neurons2").Value; Vector2 pos = NPC.Center + NPC.gfxOffY * Vector2.UnitY - Main.screenPosition; @@ -1187,7 +1214,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians npcLoot.Add(ModContent.ItemType()); npcLoot.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 1, 10, 15, 15, 20)); - // Furniture + // Furniture npcLoot.Add(ModContent.ItemType(), ThankYouPainting.DropInt); // Relic @@ -1244,7 +1271,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { - NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianDefender.cs b/NPCs/ProfanedGuardians/ProfanedGuardianDefender.cs index eaedaa3fc6..dc0fba164b 100644 --- a/NPCs/ProfanedGuardians/ProfanedGuardianDefender.cs +++ b/NPCs/ProfanedGuardians/ProfanedGuardianDefender.cs @@ -1,21 +1,21 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using System.IO; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Events; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Weapons.Typeless; using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; -using CalamityMod.Items.Accessories; using ReLogic.Content; using Terraria; +using Terraria.Audio; using Terraria.GameContent; using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; using Filters = Terraria.Graphics.Effects.Filters; namespace CalamityMod.NPCs.ProfanedGuardians @@ -30,12 +30,15 @@ namespace CalamityMod.NPCs.ProfanedGuardians public static readonly SoundStyle RockShieldSpawnSound = new("CalamityMod/Sounds/Custom/ProfanedGuardians/GuardianRockShieldActivate"); public static readonly SoundStyle ShieldDeathSound = new("CalamityMod/Sounds/Custom/ProfanedGuardians/GuardianShieldDeactivate"); + public static Asset Texture_Glow; + public static Asset TextureNight_Glow; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 10; NPCID.Sets.TrailingMode[NPC.type] = 1; NPCID.Sets.BossBestiaryPriority.Add(Type); - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { PortraitPositionXOverride = 0, PortraitScale = 0.75f, @@ -44,6 +47,11 @@ namespace CalamityMod.NPCs.ProfanedGuardians value.Position.X += 25; value.Position.Y += 15; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + Texture_Glow = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + TextureNight_Glow = ModContent.Request(Texture + "GlowNight", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -63,7 +71,6 @@ namespace CalamityMod.NPCs.ProfanedGuardians NPC.knockBackResist = 0f; NPC.noGravity = true; NPC.noTileCollide = true; - NPC.canGhostHeal = false; AIType = -1; NPC.HitSound = SoundID.NPCHit52; NPC.DeathSound = SoundID.NPCDeath55; @@ -71,6 +78,10 @@ namespace CalamityMod.NPCs.ProfanedGuardians NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToWater = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -78,7 +89,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians int associatedNPCType = ModContent.NPCType(); bestiaryEntry.UIInfoProvider = new CommonEnemyUICollectionInfoProvider(ContentSamples.NpcBestiaryCreditIdsByNpcNetIds[associatedNPCType], quickUnlock: true); - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.TheHallow, BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.TheUnderworld, @@ -182,7 +193,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians currentDustPos = Vector2.Lerp(dustLineStart, dustLineEnd, i / (float)maxHealDustIterations); Color dustColor = Main.hslToRgb(Main.rgbToHsl(new Color(255, 200, Math.Abs(Main.DiscoB - (int)(dustSpawned * 2.55f)))).X, 1f, 0.5f); dustColor.A = 255; - int dust = Dust.NewDust(currentDustPos, 0, 0, 267, 0f, 0f, 0, dustColor, 1f); + int dust = Dust.NewDust(currentDustPos, 0, 0, DustID.RainbowMk2, 0f, 0f, 0, dustColor, 1f); Main.dust[dust].position = currentDustPos; Main.dust[dust].velocity = spinningpoint.RotatedBy(MathHelper.TwoPi * i / maxHealDustIterations) * value5 * (0.8f + Main.rand.NextFloat() * 0.4f) + NPC.velocity; Main.dust[dust].noGravity = true; @@ -381,7 +392,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians Vector2 dustVelocity = dustSpawnPos - NPC.Center; Color dustColor = Main.hslToRgb(Main.rgbToHsl(Color.Orange).X, 1f, 0.5f); dustColor.A = 255; - int dust = Dust.NewDust(dustSpawnPos + dustVelocity, 0, 0, 267, dustVelocity.X, dustVelocity.Y, 0, dustColor, 1.4f); + int dust = Dust.NewDust(dustSpawnPos + dustVelocity, 0, 0, DustID.RainbowMk2, dustVelocity.X, dustVelocity.Y, 0, dustColor, 1.4f); Main.dust[dust].noGravity = true; Main.dust[dust].noLight = true; Main.dust[dust].velocity = dustVelocity * (j * 0.1f + 0.1f); @@ -406,6 +417,9 @@ namespace CalamityMod.NPCs.ProfanedGuardians if (NPC.ai[0] == 0f) { + // Avoid cheap bullshit + NPC.damage = 0; + // Face the target if (Math.Abs(NPC.Center.X - player.Center.X) > 10f) { @@ -475,6 +489,9 @@ namespace CalamityMod.NPCs.ProfanedGuardians // Throw rocks, charge, summon holy bombs and shoot molten blasts else if (NPC.ai[0] == 1f) { + // Avoid cheap bullshit + NPC.damage = 0; + // Face the target if (Math.Abs(NPC.Center.X - player.Center.X) > 10f) { @@ -569,6 +586,9 @@ namespace CalamityMod.NPCs.ProfanedGuardians // Charge at target if (NPC.ai[1] >= 0f) { + // Set damage + NPC.damage = NPC.defDamage; + NPC.ai[0] = 2f; NPC.ai[1] = 0f; NPC.netUpdate = true; @@ -599,6 +619,9 @@ namespace CalamityMod.NPCs.ProfanedGuardians // Charge at the target and spawn holy bombs else if (NPC.ai[0] == 2f) { + // Set damage + NPC.damage = NPC.defDamage; + if (Math.Sign(NPC.velocity.X) != 0) NPC.spriteDirection = -Math.Sign(NPC.velocity.X); NPC.spriteDirection = Math.Sign(NPC.velocity.X); @@ -664,6 +687,9 @@ namespace CalamityMod.NPCs.ProfanedGuardians // Slow down and pause for a bit else if (NPC.ai[0] == 3f) { + // Avoid cheap bullshit + NPC.damage = 0; + if (Math.Sign(NPC.velocity.X) != 0) NPC.spriteDirection = -Math.Sign(NPC.velocity.X); NPC.spriteDirection = Math.Sign(NPC.velocity.X); @@ -745,11 +771,11 @@ namespace CalamityMod.NPCs.ProfanedGuardians drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY) + drawOffset; spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, colorOverride ?? NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/ProfanedGuardians/ProfanedGuardianDefenderGlow").Value; + texture2D15 = Texture_Glow.Value; Color timeBasedGlowColor = Color.Lerp(Color.White, Color.Yellow, 0.5f); if (Main.remixWorld) { - texture2D15 = ModContent.Request("CalamityMod/NPCs/ProfanedGuardians/ProfanedGuardianDefenderGlowNight").Value; + texture2D15 = TextureNight_Glow.Value; timeBasedGlowColor = Color.Cyan; } if (colorOverride != null) @@ -853,7 +879,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians color *= 0.6f; color2 *= 0.6f; float scaleMult = 1.2f + scaleDuringShieldDespawn; - + // The scale used for the noise overlay polygons also grows and shrinks // This is intentionally out of sync with the shield, and intentionally desynced per player // Don't put this anywhere less than 0.25f or higher than 1f. The higher it is, the denser / more zoomed out the noise overlay is. @@ -865,23 +891,23 @@ namespace CalamityMod.NPCs.ProfanedGuardians shieldEffect.Parameters["blowUpPower"].SetValue(2.8f); shieldEffect.Parameters["blowUpSize"].SetValue(0.4f); shieldEffect.Parameters["noiseScale"].SetValue(noiseScale); - + shieldEffect.Parameters["shieldOpacity"].SetValue(opacityScaleDuringShieldDespawn); shieldEffect.Parameters["shieldEdgeBlendStrenght"].SetValue(4f); - + Color edgeColor = CalamityUtils.MulticolorLerp(Main.GlobalTimeWrappedHourly * 0.2f, color, color2); - + // Define shader parameters for shield color shieldEffect.Parameters["shieldColor"].SetValue(color.ToVector3()); shieldEffect.Parameters["shieldEdgeColor"].SetValue(edgeColor.ToVector3()); - + spriteBatch.Draw(shieldTexture, shieldDrawPos, shieldFrame, color, NPC.rotation, origin, shieldScale2 * scaleMult, SpriteEffects.None, 0f); spriteBatch.Draw(shieldTexture, shieldDrawPos, shieldFrame, color2, NPC.rotation, origin, shieldScale2 * scaleMult * 0.95f, SpriteEffects.None, 0f); spriteBatch.Draw(shieldTexture, shieldDrawPos, shieldFrame, color, NPC.rotation, origin, shieldScale * scaleMult, SpriteEffects.None, 0f); spriteBatch.Draw(shieldTexture, shieldDrawPos, shieldFrame, color2, NPC.rotation, origin, shieldScale * scaleMult * 0.95f, SpriteEffects.None, 0f); - + // The shield for the border MUST be drawn before the main shield, it becomes incredibly visually obnoxious otherwise. - + Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, shieldEffect, Main.GameViewMatrix.TransformationMatrix); // Fetch shield heat overlay texture (this is the neutrons fed to the shader) diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianHealer.cs b/NPCs/ProfanedGuardians/ProfanedGuardianHealer.cs index 3a6d9a2e38..cfc275078d 100644 --- a/NPCs/ProfanedGuardians/ProfanedGuardianHealer.cs +++ b/NPCs/ProfanedGuardians/ProfanedGuardianHealer.cs @@ -1,4 +1,6 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using System.IO; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Events; using CalamityMod.Items; @@ -6,8 +8,7 @@ using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -40,12 +41,16 @@ namespace CalamityMod.NPCs.ProfanedGuardians private int biomeEnrageTimer = CalamityGlobalNPC.biomeEnrageTimerMax; + public static Asset Texture_Glow; + public static Asset Texture_Glow2; + public static Asset TextureNight_Glow; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 10; NPCID.Sets.TrailingMode[NPC.type] = 1; NPCID.Sets.BossBestiaryPriority.Add(Type); - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { PortraitPositionXOverride = 0, PortraitScale = 0.75f, @@ -54,6 +59,12 @@ namespace CalamityMod.NPCs.ProfanedGuardians value.Position.X += 25; value.Position.Y += 15; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + Texture_Glow = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + Texture_Glow2 = ModContent.Request(Texture + "Glow2", AssetRequestMode.AsyncLoad); + TextureNight_Glow = ModContent.Request(Texture + "GlowNight", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -73,7 +84,6 @@ namespace CalamityMod.NPCs.ProfanedGuardians NPC.knockBackResist = 0f; NPC.noGravity = true; NPC.noTileCollide = true; - NPC.canGhostHeal = false; AIType = -1; NPC.HitSound = SoundID.NPCHit52; NPC.DeathSound = SoundID.NPCDeath55; @@ -81,6 +91,10 @@ namespace CalamityMod.NPCs.ProfanedGuardians NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToWater = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -88,11 +102,11 @@ namespace CalamityMod.NPCs.ProfanedGuardians int associatedNPCType = ModContent.NPCType(); bestiaryEntry.UIInfoProvider = new CommonEnemyUICollectionInfoProvider(ContentSamples.NpcBestiaryCreditIdsByNpcNetIds[associatedNPCType], quickUnlock: true); - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.TheHallow, BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.TheUnderworld, - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.ProfanedGuardianHealer") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.ProfanedGuardianHealer") }); } @@ -124,6 +138,9 @@ namespace CalamityMod.NPCs.ProfanedGuardians { CalamityGlobalNPC.doughnutBossHealer = NPC.whoAmI; + // Avoid cheap bullshit + NPC.damage = 0; + Lighting.AddLight((int)((NPC.position.X + (NPC.width / 2)) / 16f), (int)((NPC.position.Y + (NPC.height / 2)) / 16f), 1.1f, 0.9f, 0f); if (CalamityGlobalNPC.doughnutBoss < 0 || !Main.npc[CalamityGlobalNPC.doughnutBoss].active) @@ -288,7 +305,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians Color baseColor = new Color(250, 150, 0); float brightness = 0.8f; Color dustColor = Color.Lerp(baseColor, Color.White, brightness); - Dust dust = Main.dust[Dust.NewDust(NPC.Top, 0, 0, 267, 0f, 0f, 100, dustColor, 1f)]; + Dust dust = Main.dust[Dust.NewDust(NPC.Top, 0, 0, DustID.RainbowMk2, 0f, 0f, 100, dustColor, 1f)]; dust.velocity.X = 0f; dust.noGravity = true; dust.fadeIn = 1f; @@ -378,7 +395,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians int maxDust = 3; for (int k = 0; k < maxDust; k++) { - int dust = Dust.NewDust(shootFrom, 0, 0, 267, 0f, 0f, 0, dustColor, 1f); + int dust = Dust.NewDust(shootFrom, 0, 0, DustID.RainbowMk2, 0f, 0f, 0, dustColor, 1f); Main.dust[dust].position = shootFrom; Main.dust[dust].velocity = vector2 * starVelocity * (k * 0.5f + 1f); Main.dust[dust].noGravity = true; @@ -432,7 +449,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians spriteEffects = SpriteEffects.FlipHorizontally; Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; - Texture2D texture2D16 = ModContent.Request("CalamityMod/NPCs/ProfanedGuardians/ProfanedGuardianHealerGlow2").Value; + Texture2D texture2D16 = Texture_Glow2.Value; Vector2 halfSizeTexture = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2); int afterimageAmt = 5; @@ -459,11 +476,11 @@ namespace CalamityMod.NPCs.ProfanedGuardians drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY) + drawOffset; spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, colorOverride ?? NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/ProfanedGuardians/ProfanedGuardianHealerGlow").Value; + texture2D15 = Texture_Glow.Value; Color timeBasedDrawColor = Color.Lerp(Color.White, Color.Yellow, 0.5f); if (Main.remixWorld) { - texture2D15 = ModContent.Request("CalamityMod/NPCs/ProfanedGuardians/ProfanedGuardianHealerGlowNight").Value; + texture2D15 = TextureNight_Glow.Value; timeBasedDrawColor = Color.Cyan; } Color overrideColor = Color.Lerp(Color.White, Color.Violet, 0.5f); diff --git a/NPCs/ProfanedGuardians/ProfanedRocks.cs b/NPCs/ProfanedGuardians/ProfanedRocks.cs index 4919b3fdf2..9ef42786b6 100644 --- a/NPCs/ProfanedGuardians/ProfanedRocks.cs +++ b/NPCs/ProfanedGuardians/ProfanedRocks.cs @@ -1,11 +1,12 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using System.IO; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -23,10 +24,19 @@ namespace CalamityMod.NPCs.ProfanedGuardians public const int MaxHP = 8000; public const int MaxBossRushHP = 20000; + public static Asset[] Textures = new Asset[6]; + public override void SetStaticDefaults() { this.HideFromBestiary(); NPCID.Sets.TrailingMode[NPC.type] = 1; + if (!Main.dedServ) + { + for (int i = 0; i < 6; i++) + { + Textures[i] = ModContent.Request(Texture + (i + 1), AssetRequestMode.AsyncLoad); + } + } } public override void SetDefaults() @@ -47,7 +57,6 @@ namespace CalamityMod.NPCs.ProfanedGuardians NPC.noGravity = true; NPC.chaseable = false; NPC.noTileCollide = true; - NPC.canGhostHeal = false; NPC.HitSound = SoundID.NPCHit52; NPC.DeathSound = SoundID.NPCDeath55; NPC.Calamity().VulnerableToHeat = false; @@ -104,7 +113,6 @@ namespace CalamityMod.NPCs.ProfanedGuardians // Stay invincile while the commander and defender are swapping sides and don't deal damage to avoid unfair hits if (Main.npc[CalamityGlobalNPC.doughnutBossDefender].localAI[3] == 1f) { - NPC.damage = 0; NPC.dontTakeDamage = true; NPC.Opacity -= 0.01f; @@ -117,7 +125,6 @@ namespace CalamityMod.NPCs.ProfanedGuardians // Stay invincible for 100 frames to avoid being instantly killed and don't deal damage to avoid unfair hits else if (NPC.Opacity < 1f) { - NPC.damage = 0; NPC.dontTakeDamage = true; NPC.Opacity += 0.01f; @@ -127,12 +134,9 @@ namespace CalamityMod.NPCs.ProfanedGuardians NPC.scale = MathHelper.Lerp(0.05f, 1f, NPC.Opacity); } else - { - NPC.damage = NPC.defDamage; NPC.dontTakeDamage = false; - } - Lighting.AddLight((int)((NPC.position.X + (NPC.width / 2)) / 16f), (int)((NPC.position.Y + (NPC.height / 2)) / 16f), 0.7f * NPC.Opacity, 0.55f * NPC.Opacity, 0f); + Lighting.AddLight((int)(NPC.Center.X / 16f), (int)(NPC.Center.Y / 16f), 0.7f * NPC.Opacity, 0.55f * NPC.Opacity, 0f); // Set time left just in case something dumb happens with despawning if (NPC.timeLeft < 1800) @@ -162,6 +166,9 @@ namespace CalamityMod.NPCs.ProfanedGuardians // Fall down after some time and blow up if inside tiles if (NPC.Calamity().newAI[0] == -3f) { + // Set damage + NPC.damage = NPC.defDamage; + // Accelerate towards final velocity Vector2 finalVelocity = new Vector2(NPC.Calamity().newAI[2], NPC.Calamity().newAI[3]); if (NPC.velocity.Length() < finalVelocity.Length()) @@ -198,6 +205,9 @@ namespace CalamityMod.NPCs.ProfanedGuardians // Charge else if (NPC.Calamity().newAI[0] == -2f) { + // Set damage + NPC.damage = NPC.defDamage; + // Start off slow Vector2 finalVelocity = NPC.SafeDirectionTo(player.Center, -Vector2.UnitY) * chargeSpeed; if (CalamityWorld.LegendaryMode && revenge) @@ -214,6 +224,9 @@ namespace CalamityMod.NPCs.ProfanedGuardians // Rotate else { + // Avoid cheap bullshit + NPC.damage = 0; + // Push away from each other in Death and Boss Rush if (death) { @@ -267,6 +280,9 @@ namespace CalamityMod.NPCs.ProfanedGuardians return; } + // Avoid cheap bullshit + NPC.damage = 0; + // Distance from Defender Guardian double maxDistance = bossRush ? 360D : death ? 340D : revenge ? 330D : expertMode ? 320D : MinMaxDistance; double rateOfChangeIncrease = (maxDistance / MinMaxDistance) - 1D; @@ -308,7 +324,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { int npcType = (int)MathHelper.Clamp(NPC.ai[2], 1f, 6f); - Texture2D texture = ModContent.Request("CalamityMod/NPCs/ProfanedGuardians/ProfanedRocks" + npcType.ToString()).Value; + Texture2D texture = Textures[npcType - 1].Value; Vector2 drawOrigin = new Vector2(texture.Width / 2, texture.Height / 2); Vector2 drawPos = NPC.Center - screenPos; drawPos -= new Vector2(texture.Width, texture.Height) * NPC.scale / 2f; diff --git a/NPCs/Providence/ProvSpawnDefense.cs b/NPCs/Providence/ProvSpawnDefense.cs index 2744eb6250..0e2e9a8d0d 100644 --- a/NPCs/Providence/ProvSpawnDefense.cs +++ b/NPCs/Providence/ProvSpawnDefense.cs @@ -1,9 +1,10 @@ -using CalamityMod.Dusts; +using System; +using CalamityMod.Dusts; using CalamityMod.Events; +using CalamityMod.NPCs.ProfanedGuardians; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.GameContent; using Terraria.ID; @@ -52,6 +53,10 @@ namespace CalamityMod.NPCs.Providence NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToWater = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void FindFrame(int frameHeight) @@ -137,7 +142,7 @@ namespace CalamityMod.NPCs.Providence vector43 += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/ProfanedGuardians/ProfanedGuardianDefenderGlow").Value; + texture2D15 = ProfanedGuardianDefender.Texture_Glow.Value; Color yellowLerp = Color.Lerp(Color.White, Color.Yellow, 0.5f); if (CalamityConfig.Instance.Afterimages) diff --git a/NPCs/Providence/ProvSpawnHealer.cs b/NPCs/Providence/ProvSpawnHealer.cs index 9644b52742..9d1aa49894 100644 --- a/NPCs/Providence/ProvSpawnHealer.cs +++ b/NPCs/Providence/ProvSpawnHealer.cs @@ -1,9 +1,10 @@ -using CalamityMod.Dusts; +using System; +using CalamityMod.Dusts; using CalamityMod.Events; +using CalamityMod.NPCs.ProfanedGuardians; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.GameContent; using Terraria.ID; @@ -51,6 +52,10 @@ namespace CalamityMod.NPCs.Providence NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToWater = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void FindFrame(int frameHeight) @@ -113,7 +118,7 @@ namespace CalamityMod.NPCs.Providence spriteEffects = SpriteEffects.FlipHorizontally; Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; - Texture2D texture2D16 = ModContent.Request("CalamityMod/NPCs/ProfanedGuardians/ProfanedGuardianHealerGlow2").Value; + Texture2D texture2D16 = ProfanedGuardianHealer.Texture_Glow2.Value; Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); int afterimageAmt = 5; @@ -137,7 +142,7 @@ namespace CalamityMod.NPCs.Providence drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/ProfanedGuardians/ProfanedGuardianHealerGlow").Value; + texture2D15 = ProfanedGuardianHealer.Texture_Glow.Value; Color yellowLerp = Color.Lerp(Color.White, Color.Yellow, 0.5f); Color violetLerp = Color.Lerp(Color.White, Color.Violet, 0.5f); diff --git a/NPCs/Providence/ProvSpawnOffense.cs b/NPCs/Providence/ProvSpawnOffense.cs index 45fbb115f9..faa67a7dfa 100644 --- a/NPCs/Providence/ProvSpawnOffense.cs +++ b/NPCs/Providence/ProvSpawnOffense.cs @@ -1,9 +1,10 @@ -using CalamityMod.Dusts; +using System; +using CalamityMod.Dusts; using CalamityMod.Events; +using CalamityMod.NPCs.ProfanedGuardians; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.GameContent; using Terraria.ID; @@ -52,6 +53,10 @@ namespace CalamityMod.NPCs.Providence NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToWater = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void FindFrame(int frameHeight) @@ -139,7 +144,7 @@ namespace CalamityMod.NPCs.Providence drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/ProfanedGuardians/ProfanedGuardianCommanderGlow").Value; + texture2D15 = ProfanedGuardianCommander.Texture_Glow.Value; Color yellowLerpColor = Color.Lerp(Color.White, Color.Yellow, 0.5f); if (CalamityConfig.Instance.Afterimages) diff --git a/NPCs/Providence/Providence.cs b/NPCs/Providence/Providence.cs index 1b0547687b..79471eeab9 100644 --- a/NPCs/Providence/Providence.cs +++ b/NPCs/Providence/Providence.cs @@ -1,4 +1,7 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using System.Collections.Generic; +using System.IO; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; using CalamityMod.Events; @@ -27,10 +30,8 @@ using CalamityMod.Tiles.Ores; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using ReLogic.Utilities; -using System; -using System.Collections.Generic; -using System.IO; using Terraria; using Terraria.Audio; using Terraria.DataStructures; @@ -107,19 +108,59 @@ namespace CalamityMod.NPCs.Providence public SlotId BurningSoundSlot; //Level of sound playing public float SoundWarningLevel = -1f; - + public static float normalDR = 0.3f; public static float cocoonDR = 0.9f; private const float TimeForStarDespawn = 120f; private const float TimeForShieldDespawn = 120f; + // Every single one of Providence's sprites, both night and day, and their glowmasks + #region Textures + public static Asset TextureAlt; + public static Asset TextureAltNight; + public static Asset TextureAttack; + public static Asset TextureAttackNight; + public static Asset TextureAttackAlt; + public static Asset TextureAttackAltNight; + public static Asset TextureDefense; + public static Asset TextureDefenseNight; + public static Asset TextureDefenseAlt; + public static Asset TextureDefenseAltNight; + public static Asset TextureNight; + + public static Asset Texture_Glow; + public static Asset TextureAlt_Glow; + public static Asset TextureAltNight_Glow; + public static Asset TextureAttack_Glow; + public static Asset TextureAttackNight_Glow; + public static Asset TextureAttackAlt_Glow; + public static Asset TextureAttackAltNight_Glow; + public static Asset TextureDefense_Glow; + public static Asset TextureDefenseNight_Glow; + public static Asset TextureDefenseAlt_Glow; + public static Asset TextureDefenseAltNight_Glow; + public static Asset TextureNight_Glow; + public static Asset Texture_Glow_2; + public static Asset TextureAlt_Glow_2; + public static Asset TextureAltNight_Glow_2; + public static Asset TextureAttack_Glow_2; + public static Asset TextureAttackNight_Glow_2; + public static Asset TextureAttackAlt_Glow_2; + public static Asset TextureAttackAltNight_Glow_2; + public static Asset TextureDefense_Glow_2; + public static Asset TextureDefenseNight_Glow_2; + public static Asset TextureDefenseAlt_Glow_2; + public static Asset TextureDefenseAltNight_Glow_2; + public static Asset TextureNight_Glow_2; + #endregion + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 3; NPCID.Sets.TrailingMode[NPC.type] = 1; NPCID.Sets.BossBestiaryPriority.Add(Type); - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { Scale = 0.2f, PortraitScale = 0.32f, @@ -128,6 +169,55 @@ namespace CalamityMod.NPCs.Providence value.Position.Y += 6f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; NPCID.Sets.MPAllowedEnemies[Type] = true; + + #region Texture Loading + if (!Main.dedServ) + { + string ProviPath = "CalamityMod/NPCs/Providence/Providence"; + string GlowPath = "CalamityMod/NPCs/Providence/Glowmasks/Providence"; + + // Normal textures + TextureAlt = ModContent.Request(ProviPath + "Alt", AssetRequestMode.AsyncLoad); + TextureAltNight = ModContent.Request(ProviPath + "AltNight", AssetRequestMode.AsyncLoad); + TextureAttack = ModContent.Request(ProviPath + "Attack", AssetRequestMode.AsyncLoad); + TextureAttackNight = ModContent.Request(ProviPath + "AttackNight", AssetRequestMode.AsyncLoad); + TextureAttackAlt = ModContent.Request(ProviPath + "AttackAlt", AssetRequestMode.AsyncLoad); + TextureAttackAltNight = ModContent.Request(ProviPath + "AttackAltNight", AssetRequestMode.AsyncLoad); + TextureDefense = ModContent.Request(ProviPath + "Defense", AssetRequestMode.AsyncLoad); + TextureDefenseNight = ModContent.Request(ProviPath + "DefenseNight", AssetRequestMode.AsyncLoad); + TextureDefenseAlt = ModContent.Request(ProviPath + "DefenseAlt", AssetRequestMode.AsyncLoad); + TextureDefenseAltNight = ModContent.Request(ProviPath + "DefenseAltNight", AssetRequestMode.AsyncLoad); + TextureNight = ModContent.Request(ProviPath + "Night", AssetRequestMode.AsyncLoad); + + // Fire glowmasks + Texture_Glow = ModContent.Request(GlowPath + "Glow", AssetRequestMode.AsyncLoad); + TextureAlt_Glow = ModContent.Request(GlowPath + "AltGlow", AssetRequestMode.AsyncLoad); + TextureAltNight_Glow = ModContent.Request(GlowPath + "AltGlowNight", AssetRequestMode.AsyncLoad); + TextureAttack_Glow = ModContent.Request(GlowPath + "AttackGlow", AssetRequestMode.AsyncLoad); + TextureAttackNight_Glow = ModContent.Request(GlowPath + "AttackGlowNight", AssetRequestMode.AsyncLoad); + TextureAttackAlt_Glow = ModContent.Request(GlowPath + "AttackAltGlow", AssetRequestMode.AsyncLoad); + TextureAttackAltNight_Glow = ModContent.Request(GlowPath + "AttackAltGlowNight", AssetRequestMode.AsyncLoad); + TextureDefense_Glow = ModContent.Request(GlowPath + "DefenseGlow", AssetRequestMode.AsyncLoad); + TextureDefenseNight_Glow = ModContent.Request(GlowPath + "DefenseGlowNight", AssetRequestMode.AsyncLoad); + TextureDefenseAlt_Glow = ModContent.Request(GlowPath + "DefenseAltGlow", AssetRequestMode.AsyncLoad); + TextureDefenseAltNight_Glow = ModContent.Request(GlowPath + "DefenseAltGlowNight", AssetRequestMode.AsyncLoad); + TextureNight_Glow = ModContent.Request(GlowPath + "GlowNight", AssetRequestMode.AsyncLoad); + + // Crystal glowmasks + Texture_Glow_2 = ModContent.Request(GlowPath + "Glow2", AssetRequestMode.AsyncLoad); + TextureAlt_Glow_2 = ModContent.Request(GlowPath + "AltGlow2", AssetRequestMode.AsyncLoad); + TextureAltNight_Glow_2 = ModContent.Request(GlowPath + "AltGlow2Night", AssetRequestMode.AsyncLoad); + TextureAttack_Glow_2 = ModContent.Request(GlowPath + "AttackGlow2", AssetRequestMode.AsyncLoad); + TextureAttackNight_Glow_2 = ModContent.Request(GlowPath + "AttackGlow2Night", AssetRequestMode.AsyncLoad); + TextureAttackAlt_Glow_2 = ModContent.Request(GlowPath + "AttackAltGlow2", AssetRequestMode.AsyncLoad); + TextureAttackAltNight_Glow_2 = ModContent.Request(GlowPath + "AttackAltGlow2Night", AssetRequestMode.AsyncLoad); + TextureDefense_Glow_2 = ModContent.Request(GlowPath + "DefenseGlow2", AssetRequestMode.AsyncLoad); + TextureDefenseNight_Glow_2 = ModContent.Request(GlowPath + "DefenseGlow2Night", AssetRequestMode.AsyncLoad); + TextureDefenseAlt_Glow_2 = ModContent.Request(GlowPath + "DefenseAltGlow2", AssetRequestMode.AsyncLoad); + TextureDefenseAltNight_Glow_2 = ModContent.Request(GlowPath + "DefenseAltGlow2Night", AssetRequestMode.AsyncLoad); + TextureNight_Glow_2 = ModContent.Request(GlowPath + "Glow2Night", AssetRequestMode.AsyncLoad); + } + #endregion } public override void SetDefaults() @@ -162,7 +252,7 @@ namespace CalamityMod.NPCs.Providence public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.TheHallow, BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.TheUnderworld, @@ -182,7 +272,6 @@ namespace CalamityMod.NPCs.Providence writer.Write(flightPath); writer.Write(NPC.dontTakeDamage); writer.Write(NPC.chaseable); - writer.Write(NPC.canGhostHeal); writer.Write(NPC.localAI[0]); writer.Write(NPC.localAI[1]); writer.Write(NPC.localAI[2]); @@ -209,7 +298,6 @@ namespace CalamityMod.NPCs.Providence flightPath = reader.ReadInt32(); NPC.dontTakeDamage = reader.ReadBoolean(); NPC.chaseable = reader.ReadBoolean(); - NPC.canGhostHeal = reader.ReadBoolean(); NPC.localAI[0] = reader.ReadSingle(); NPC.localAI[1] = reader.ReadSingle(); NPC.localAI[2] = reader.ReadSingle(); @@ -219,7 +307,7 @@ namespace CalamityMod.NPCs.Providence DeathAnimationTimer = reader.ReadInt32(); borderRadius = reader.ReadSingle(); shouldDrawInfernoBorder = reader.ReadBoolean(); - + for (int i = 0; i < 4; i++) NPC.Calamity().newAI[i] = reader.ReadSingle(); @@ -278,7 +366,7 @@ namespace CalamityMod.NPCs.Providence colorShiftTimer = 0; } } - else if (!Main.dayTime || bossRush) //Normal Night time activity + else if (!Main.IsItDay() || bossRush) //Normal Night time activity NPC.localAI[1] = (float)BossMode.Night; else NPC.localAI[1] = (float)BossMode.Day; @@ -379,7 +467,7 @@ namespace CalamityMod.NPCs.Providence float distanceX = Math.Abs(NPC.Center.X - player.Center.X); // Inflict Holy Inferno if target is too far away - float burnIntensity = CalculateBurnIntensity(attackDelayAfterCocoon); + float burnIntensity = CalculateBurnIntensity(attackDelayAfterCocoon); if (!player.dead && player.active && !player.creativeGodMode && !Dying) { @@ -430,7 +518,7 @@ namespace CalamityMod.NPCs.Providence { if (SoundWarningLevel <= 1f) burningSound?.Stop(); - else if(SoundWarningLevel <= 2f) + else if (SoundWarningLevel <= 2f) burningSound.Volume = SoundWarningLevel - 1f; } @@ -523,7 +611,6 @@ namespace CalamityMod.NPCs.Providence // Whether the boss can be homed in on or healed off of NPC.chaseable = normalAttackRate; - NPC.canGhostHeal = NPC.chaseable; // Prevent lag by stopping rain if (CalamityConfig.Instance.BossesStopWeather) @@ -615,7 +702,7 @@ namespace CalamityMod.NPCs.Providence if (i % dustDivisor == 0) { currentDustPos = Vector2.Lerp(dustLineStart, dustLineEnd, i / (float)maxHealDustIterations); - int dust = Dust.NewDust(currentDustPos, 0, 0, 267, 0f, 0f, 0, dustColor, 1f); + int dust = Dust.NewDust(currentDustPos, 0, 0, DustID.RainbowMk2, 0f, 0f, 0, dustColor, 1f); Main.dust[dust].position = currentDustPos; Main.dust[dust].velocity = spinningpoint.RotatedBy(MathHelper.TwoPi * i / maxHealDustIterations) * dustVelocityMult * (0.8f + Main.rand.NextFloat() * 0.4f) + NPC.velocity; Main.dust[dust].noGravity = true; @@ -1004,7 +1091,7 @@ namespace CalamityMod.NPCs.Providence newColor.R = 0; } - int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, 267, 0f, 0f, 0, newColor); + int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.RainbowMk2, 0f, 0f, 0, newColor); Main.dust[dust].position = NPC.Center + Main.rand.NextVector2Circular(NPC.width * 2f, NPC.height * 2f) + new Vector2(0f, -150f); Main.dust[dust].velocity *= Main.rand.NextFloat() * 0.8f; Main.dust[dust].noGravity = true; @@ -1185,7 +1272,7 @@ namespace CalamityMod.NPCs.Providence int maxDust = 3; for (int j = 0; j < maxDust; j++) { - int dust = Dust.NewDust(fireFrom, 0, 0, 267, 0f, 0f, 0, dustColor, 1f); + int dust = Dust.NewDust(fireFrom, 0, 0, DustID.RainbowMk2, 0f, 0f, 0, dustColor, 1f); Main.dust[dust].position = fireFrom; Main.dust[dust].velocity = vector2 * cocoonProjVelocity * (j * 0.5f + 1f); Main.dust[dust].noGravity = true; @@ -1245,7 +1332,7 @@ namespace CalamityMod.NPCs.Providence int maxDust = 3; for (int j = 0; j < maxDust; j++) { - int dust = Dust.NewDust(fireFrom, 0, 0, 267, 0f, 0f, 0, dustColor, 1f); + int dust = Dust.NewDust(fireFrom, 0, 0, DustID.RainbowMk2, 0f, 0f, 0, dustColor, 1f); Main.dust[dust].position = fireFrom; Main.dust[dust].velocity = vector2 * cocoonProjVelocity * (j * 0.5f + 1f); Main.dust[dust].noGravity = true; @@ -1286,7 +1373,7 @@ namespace CalamityMod.NPCs.Providence int maxDust = 3; for (int j = 0; j < maxDust; j++) { - int dust = Dust.NewDust(fireFrom, 0, 0, 267, 0f, 0f, 0, dustColor, 1f); + int dust = Dust.NewDust(fireFrom, 0, 0, DustID.RainbowMk2, 0f, 0f, 0, dustColor, 1f); Main.dust[dust].position = fireFrom; Main.dust[dust].velocity = velocity2 * cocoonProjVelocity * 2f; Main.dust[dust].noGravity = true; @@ -1591,7 +1678,7 @@ namespace CalamityMod.NPCs.Providence currentDustPos = Vector2.Lerp(dustLineStart, dustLineEnd, j / (float)maxHealDustIterations); Color dustColor = Main.hslToRgb(Main.rgbToHsl(nightAI ? new Color(100, 200, 250) : new Color(255, 200, Math.Abs(Math.Abs(blue) - (int)(dustSpawned * 2.55f)))).X, 1f, 0.5f); dustColor.A = 255; - int dust = Dust.NewDust(currentDustPos, 0, 0, 267, 0f, 0f, 0, dustColor, 1f); + int dust = Dust.NewDust(currentDustPos, 0, 0, DustID.RainbowMk2, 0f, 0f, 0, dustColor, 1f); Main.dust[dust].position = currentDustPos + new Vector2(32f, 32f).RotatedByRandom(MathHelper.TwoPi) * i; Main.dust[dust].velocity = spinningpoint.RotatedBy(MathHelper.TwoPi * j / maxHealDustIterations) * dustVelocityMult * (0.8f + Main.rand.NextFloat() * 0.4f); Main.dust[dust].noGravity = true; @@ -1620,7 +1707,7 @@ namespace CalamityMod.NPCs.Providence Vector2 dustVelocity = dustSpawnPos - dustLineEnd; Color dustColor = Main.hslToRgb(Main.rgbToHsl(nightAI ? new Color(100, 200, 250) : new Color(255, 200, Math.Abs(Math.Abs(blue) - (int)(circleDustSpawned * 7.08f)))).X, 1f, 0.5f); dustColor.A = 255; - int dust = Dust.NewDust(dustSpawnPos + dustVelocity, 0, 0, 267, dustVelocity.X, dustVelocity.Y, 0, dustColor, 1.4f); + int dust = Dust.NewDust(dustSpawnPos + dustVelocity, 0, 0, DustID.RainbowMk2, dustVelocity.X, dustVelocity.Y, 0, dustColor, 1.4f); Main.dust[dust].noGravity = true; Main.dust[dust].noLight = true; Main.dust[dust].velocity = dustVelocity * 0.33f; @@ -1629,10 +1716,8 @@ namespace CalamityMod.NPCs.Providence if (Main.netMode != NetmodeID.MultiplayerClient) { - int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), crystalSpawnPos, Vector2.Zero, ModContent.ProjectileType(), crystalDamage, 0f, Main.myPlayer, lifeRatio, 0f); - - if (nightAI) - Main.projectile[proj].timeLeft = getFuckedAI ? gfbCrystalTime : nightCrystalTime; + float timeLeft = nightAI ? (float)(getFuckedAI ? gfbCrystalTime : nightCrystalTime) : 0f; + Projectile.NewProjectile(NPC.GetSource_FromAI(), crystalSpawnPos, Vector2.Zero, ModContent.ProjectileType(), crystalDamage, 0f, Main.myPlayer, lifeRatio, 0f, timeLeft); } } @@ -1835,7 +1920,7 @@ namespace CalamityMod.NPCs.Providence if (CalamityGlobalNPC.holyBossAttacker != -1 && Main.npc[CalamityGlobalNPC.holyBossAttacker].active) guardianAlive = true; - + if (CalamityGlobalNPC.holyBossDefender != -1 && Main.npc[CalamityGlobalNPC.holyBossDefender].active) guardianAlive = true; @@ -1848,7 +1933,7 @@ namespace CalamityMod.NPCs.Providence // It is determined based on how much time has elapsed during the attack thus far, specifically for the two cocoon attacks. // This shave-off does not happen when guardians are present. float shorterDistanceFade = Utils.GetLerpValue(0f, 120f, aiTimer, true); - + //Distance does not get shorter if in GFB / Guardians are alive if (!guardianAlive && NPC.localAI[1] < (float)BossMode.Red) { @@ -1986,7 +2071,7 @@ namespace CalamityMod.NPCs.Providence int[] weapons = new int[] { ModContent.ItemType(), - ModContent.ItemType(), + ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), @@ -2065,50 +2150,45 @@ namespace CalamityMod.NPCs.Providence string baseTextureString = "CalamityMod/NPCs/Providence/"; string baseGlowTextureString = baseTextureString + "Glowmasks/"; - string getTextureString = baseTextureString + "Providence"; - string getTextureGlowString = baseGlowTextureString + "ProvidenceGlow"; - string getTextureGlow2String = baseGlowTextureString + "ProvidenceGlow2"; + Texture2D texture = offColor ? TextureNight.Value : TextureAssets.Npc[Type].Value; + Texture2D textureGlow = offColor ? TextureNight_Glow.Value : Texture_Glow.Value; + Texture2D textureGlow2 = offColor ? TextureNight_Glow_2.Value : Texture_Glow_2.Value; if (AIState == (int)Phase.FlameCocoon || AIState == (int)Phase.SpearCocoon) { if (!useDefenseFrames) { - getTextureString = baseTextureString + "ProvidenceDefense"; - getTextureGlowString = baseGlowTextureString + "ProvidenceDefenseGlow"; - getTextureGlow2String = baseGlowTextureString + "ProvidenceDefenseGlow2"; + texture = offColor ? TextureDefenseNight.Value : TextureDefense.Value; + textureGlow = offColor ? TextureDefenseNight_Glow.Value : TextureDefense_Glow.Value; + textureGlow2 = offColor ? TextureDefenseNight_Glow_2.Value : TextureDefense_Glow_2.Value; } else { - getTextureString = baseTextureString + "ProvidenceDefenseAlt"; - getTextureGlowString = baseGlowTextureString + "ProvidenceDefenseAltGlow"; - getTextureGlow2String = baseGlowTextureString + "ProvidenceDefenseAltGlow2"; + texture = offColor ? TextureDefenseAltNight.Value : TextureDefenseAlt.Value; + textureGlow = offColor ? TextureDefenseAltNight_Glow.Value : TextureDefenseAlt_Glow.Value; + textureGlow2 = offColor ? TextureDefenseAltNight_Glow_2.Value : TextureDefenseAlt_Glow_2.Value; } } else { switch (frameUsed) { - case 0: - getTextureGlowString = baseGlowTextureString + "ProvidenceGlow"; - getTextureGlow2String = baseGlowTextureString + "ProvidenceGlow2"; + case 1: + texture = offColor ? TextureAltNight.Value : TextureAlt.Value; + textureGlow = offColor ? TextureAltNight_Glow.Value : TextureAlt_Glow.Value; + textureGlow2 = offColor ? TextureAltNight_Glow_2.Value : TextureAlt_Glow_2.Value; break; - case 1: - getTextureString = baseTextureString + "ProvidenceAlt"; - getTextureGlowString = baseGlowTextureString + "ProvidenceAltGlow"; - getTextureGlow2String = baseGlowTextureString + "ProvidenceAltGlow2"; - break; - case 2: - getTextureString = baseTextureString + "ProvidenceAttack"; - getTextureGlowString = baseGlowTextureString + "ProvidenceAttackGlow"; - getTextureGlow2String = baseGlowTextureString + "ProvidenceAttackGlow2"; + texture = offColor ? TextureAttackNight.Value : TextureAttack.Value; + textureGlow = offColor ? TextureAttackNight_Glow.Value : TextureAttack_Glow.Value; + textureGlow2 = offColor ? TextureAttackNight_Glow_2.Value : TextureAttack_Glow_2.Value; break; - + case 3: - getTextureString = baseTextureString + "ProvidenceAttackAlt"; - getTextureGlowString = baseGlowTextureString + "ProvidenceAttackAltGlow"; - getTextureGlow2String = baseGlowTextureString + "ProvidenceAttackAltGlow2"; + texture = offColor ? TextureAttackAltNight.Value : TextureAttackAlt.Value; + textureGlow = offColor ? TextureAttackAltNight_Glow.Value : TextureAttackAlt_Glow.Value; + textureGlow2 = offColor ? TextureAttackAltNight_Glow_2.Value : TextureAttackAlt_Glow_2.Value; break; default: @@ -2116,17 +2196,6 @@ namespace CalamityMod.NPCs.Providence } } - if (offColor) - { - getTextureString += "Night"; - getTextureGlowString += "Night"; - getTextureGlow2String += "Night"; - } - - Texture2D texture = ModContent.Request(getTextureString).Value; - Texture2D textureGlow = ModContent.Request(getTextureGlowString).Value; - Texture2D textureGlow2 = ModContent.Request(getTextureGlow2String).Value; - SpriteEffects spriteEffects = SpriteEffects.None; if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; @@ -2326,9 +2395,9 @@ namespace CalamityMod.NPCs.Providence float scaleMult = 2.75f + scaleDuringShieldDespawn; spriteBatch.Draw(shieldTexture, shieldDrawPos, shieldFrame, color2, NPC.rotation, origin, shieldScale2 * scaleMult * 0.45f, SpriteEffects.None, 0f); spriteBatch.Draw(shieldTexture, shieldDrawPos, shieldFrame, color2, NPC.rotation, origin, shieldScale2 * scaleMult * 0.5f, SpriteEffects.None, 0f); - + // The shield for the border MUST be drawn before the main shield, it becomes incredibly visually obnoxious otherwise. - + // The scale used for the noise overlay polygons also grows and shrinks // This is intentionally out of sync with the shield, and intentionally desynced per player // Don't put this anywhere less than 0.25f or higher than 1f. The higher it is, the denser / more zoomed out the noise overlay is. @@ -2340,19 +2409,19 @@ namespace CalamityMod.NPCs.Providence shieldEffect.Parameters["blowUpPower"].SetValue(2.8f); shieldEffect.Parameters["blowUpSize"].SetValue(0.4f); shieldEffect.Parameters["noiseScale"].SetValue(noiseScale); - + shieldEffect.Parameters["shieldOpacity"].SetValue(opacityScaleDuringShieldDespawn); shieldEffect.Parameters["shieldEdgeBlendStrenght"].SetValue(4f); - + Color edgeColor = CalamityUtils.MulticolorLerp(Main.GlobalTimeWrappedHourly * 0.2f, color, color2); - + // Define shader parameters for shield color shieldEffect.Parameters["shieldColor"].SetValue(color.ToVector3()); shieldEffect.Parameters["shieldEdgeColor"].SetValue(edgeColor.ToVector3()); - + Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, shieldEffect, Main.GameViewMatrix.TransformationMatrix); - + // Fetch shield heat overlay texture (this is the neutrons fed to the shader) Texture2D heatTex = ModContent.Request("CalamityMod/ExtraTextures/GreyscaleGradients/Neurons2").Value; Vector2 pos = NPC.Center + NPC.gfxOffY * Vector2.UnitY - Main.screenPosition; @@ -2429,7 +2498,7 @@ namespace CalamityMod.NPCs.Providence public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { - NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); NPC.damage = (int)(NPC.damage * 0.8f); } @@ -2456,7 +2525,6 @@ namespace CalamityMod.NPCs.Providence { List exceptionList = new List() { - ModContent.ProjectileType(), ModContent.ProjectileType(), ModContent.ProjectileType(), ModContent.ProjectileType(), @@ -2470,7 +2538,7 @@ namespace CalamityMod.NPCs.Providence ModContent.ProjectileType() }; - bool allowedClass = projectile.CountsAsClass() || (!projectile.CountsAsClass() && !projectile.CountsAsClass() && + bool allowedClass = projectile.CountsAsClass() || (!projectile.CountsAsClass() && !projectile.CountsAsClass() && !projectile.CountsAsClass() && !projectile.CountsAsClass() && !projectile.CountsAsClass()); bool allowedDamage = allowedClass && hit.Damage <= 75; //Flat 75 regardless of difficulty. //Absorber on-hit effects likely won't proc this but Deific Amulet and Astral Bulwark stars will proc this. @@ -2677,13 +2745,13 @@ namespace CalamityMod.NPCs.Providence break; case (int)Providence.BossMode.Violet: BuffType = ModContent.BuffType(); - Multiplier = 0.60f; + Multiplier = 0.60f; break; default: break; } Target.AddBuff(BuffType, (int)(BaseDuration * Multiplier)); - + //A. Specifically inflicts Vaporfied in quirky RGB Mode because it's a colorful debuff //B. Apply the negative healing if (Mode >= (int)Providence.BossMode.Red) @@ -2704,7 +2772,7 @@ namespace CalamityMod.NPCs.Providence } NetMessage.SendData(MessageID.SpiritHeal, -1, -1, null, Target.whoAmI, NegativeHealValue); - Target.AddBuff(ModContent.BuffType(), (int)(BaseDuration * Multiplier)); + Target.AddBuff(ModContent.BuffType(), (int)(BaseDuration * Multiplier)); } } } diff --git a/NPCs/Ravager/FlamePillar.cs b/NPCs/Ravager/FlamePillar.cs index 4b61c255ff..933d5a4a8e 100644 --- a/NPCs/Ravager/FlamePillar.cs +++ b/NPCs/Ravager/FlamePillar.cs @@ -3,6 +3,7 @@ using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -14,10 +15,16 @@ namespace CalamityMod.NPCs.Ravager public class FlamePillar : ModNPC { public static readonly SoundStyle HitSound = new("CalamityMod/Sounds/NPCHit/RavagerRockPillarHit", 3); + public static Asset GlowTexture; + public override void SetStaticDefaults() { this.HideFromBestiary(); Main.npcFrameCount[NPC.type] = 4; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -28,7 +35,6 @@ namespace CalamityMod.NPCs.Ravager NPC.defense = 35; NPC.DR_NERD(0.2f); NPC.chaseable = false; - NPC.canGhostHeal = false; NPC.lifeMax = DownedBossSystem.downedProvidence ? 14000 : 3500; double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); @@ -40,6 +46,10 @@ namespace CalamityMod.NPCs.Ravager NPC.DeathSound = SoundID.NPCDeath14; NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToWater = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void FindFrame(int frameHeight) @@ -52,6 +62,9 @@ namespace CalamityMod.NPCs.Ravager public override void AI() { + // Avoid cheap bullshit + NPC.damage = 0; + bool provy = DownedBossSystem.downedProvidence; bool death = CalamityWorld.death || BossRushEvent.BossRushActive; @@ -70,19 +83,10 @@ namespace CalamityMod.NPCs.Ravager if (NPC.alpha > 0) { - NPC.damage = 0; - NPC.alpha -= 5; if (NPC.alpha < 0) NPC.alpha = 0; } - else - { - if (DownedBossSystem.downedProvidence && !BossRushEvent.BossRushActive) - NPC.damage = (int)(NPC.defDamage * 1.5); - else - NPC.damage = NPC.defDamage; - } if (NPC.ai[0] == 0f) { @@ -156,7 +160,7 @@ namespace CalamityMod.NPCs.Ravager spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/Ravager/FlamePillarGlow").Value; + texture2D15 = GlowTexture.Value; Color flameBlue = Color.Lerp(Color.White, Color.Cyan, 0.5f); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, flameBlue, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); @@ -178,7 +182,7 @@ namespace CalamityMod.NPCs.Ravager NPC.position.Y = NPC.position.Y - (NPC.height / 2); for (int i = 0; i < 30; i++) { - int iceFlame = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 135, 0f, 0f, 100, default, 2f); + int iceFlame = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.IceTorch, 0f, 0f, 100, default, 2f); Main.dust[iceFlame].velocity *= 3f; if (Main.rand.NextBool()) { @@ -188,10 +192,10 @@ namespace CalamityMod.NPCs.Ravager } for (int j = 0; j < 30; j++) { - int rockDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Stone, 0f, 0f, 100, default, 3f); + int rockDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Stone, 0f, 0f, 100, default, 3f); Main.dust[rockDust].noGravity = true; Main.dust[rockDust].velocity *= 5f; - rockDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Iron, 0f, 0f, 100, default, 2f); + rockDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Iron, 0f, 0f, 100, default, 2f); Main.dust[rockDust].velocity *= 2f; } } @@ -199,7 +203,7 @@ namespace CalamityMod.NPCs.Ravager { for (int i = 0; i < 2; i++) { - int iceFlame = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Iron, 0f, 0f, 100, default, 2f); + int iceFlame = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Iron, 0f, 0f, 100, default, 2f); Main.dust[iceFlame].velocity *= 3f; if (Main.rand.NextBool()) { @@ -209,10 +213,10 @@ namespace CalamityMod.NPCs.Ravager } for (int j = 0; j < 2; j++) { - int rockDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Stone, 0f, 0f, 100, default, 3f); + int rockDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Stone, 0f, 0f, 100, default, 3f); Main.dust[rockDust].noGravity = true; Main.dust[rockDust].velocity *= 5f; - rockDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Iron, 0f, 0f, 100, default, 2f); + rockDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Iron, 0f, 0f, 100, default, 2f); Main.dust[rockDust].velocity *= 2f; } } diff --git a/NPCs/Ravager/RavagerBody.cs b/NPCs/Ravager/RavagerBody.cs index 49b2079dd2..ffee658261 100644 --- a/NPCs/Ravager/RavagerBody.cs +++ b/NPCs/Ravager/RavagerBody.cs @@ -1,8 +1,11 @@ -using CalamityMod.Buffs.StatDebuffs; +using System; +using System.IO; +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Events; using CalamityMod.Items.Accessories; using CalamityMod.Items.Armor.Vanity; using CalamityMod.Items.LoreItems; +using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Furniture.BossRelics; using CalamityMod.Items.Placeables.Furniture.DevPaintings; using CalamityMod.Items.Placeables.Furniture.Trophies; @@ -14,21 +17,19 @@ using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Items.Weapons.Summon; using CalamityMod.Projectiles.Boss; +using CalamityMod.Projectiles.Enemy; using CalamityMod.UI.VanillaBossBars; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; +using ReLogic.Content; using Terraria; +using Terraria.Audio; using Terraria.GameContent; using Terraria.GameContent.Bestiary; +using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using Terraria.GameContent.ItemDropRules; -using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Enemy; namespace CalamityMod.NPCs.Ravager { @@ -45,11 +46,14 @@ namespace CalamityMod.NPCs.Ravager public static readonly SoundStyle PillarSound = new("CalamityMod/Sounds/Custom/Ravager/RavagerPillarSummon"); public static readonly SoundStyle MissileSound = new("CalamityMod/Sounds/Custom/Ravager/RavagerMissileLaunch"); + public static Asset GlowTexture; + public static Asset ChainTexture; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 7; NPCID.Sets.BossBestiaryPriority.Add(Type); - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { Scale = 0.5f, PortraitPositionYOverride = -40f, @@ -57,7 +61,12 @@ namespace CalamityMod.NPCs.Ravager }; value.Position.Y -= 50f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; - NPCID.Sets.MPAllowedEnemies[Type] = true; + NPCID.Sets.MPAllowedEnemies[Type] = true; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + ChainTexture = ModContent.Request("CalamityMod/NPCs/Ravager/RavagerChain", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -97,10 +106,10 @@ namespace CalamityMod.NPCs.Ravager public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Surface, - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Ravager") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Ravager") }); } @@ -240,7 +249,7 @@ namespace CalamityMod.NPCs.Ravager { bool finalStand = lifeRatio < 0.2f; //At 20% body health, does the funny final attack NPC.localAI[1]++; - + Vector2 Pos = player.Center; //Spawn projectiles based on player's center. Having it be based on the boss turned out weird. (Except for final) int type = ModContent.ProjectileType(); int damage = NPC.GetProjectileDamage(type); @@ -313,7 +322,7 @@ namespace CalamityMod.NPCs.Ravager Vector2 position = new Vector2(Pos.X - blueOffset2, Pos.Y - (blueOffset1 * (Main.rand.NextBool() ? -1 : 1))); Vector2 destination = new Vector2(Pos.X - blueOffset2, Pos.Y); int movement = Main.rand.Next(-4, 0); - switch(movement) + switch (movement) { case -2: //aim up or down, sweep to the left position.X = Pos.X + blueOffset2; @@ -352,7 +361,7 @@ namespace CalamityMod.NPCs.Ravager if (Main.rand.NextBool(10)) { rightDust = Dust.NewDust(new Vector2(NPC.Center.X, NPC.Center.Y - 30f), 8, 8, DustID.Torch, 0f, 0f, 0, default, 1.5f); - if (Main.rand.Next(20) != 0) + if (!Main.rand.NextBool(20)) { Main.dust[rightDust].noGravity = true; Main.dust[rightDust].scale *= 1f + Main.rand.Next(10) * 0.1f; @@ -375,7 +384,7 @@ namespace CalamityMod.NPCs.Ravager if (Main.rand.NextBool(10)) { rightDust = Dust.NewDust(new Vector2(NPC.Center.X + 80f, NPC.Center.Y + 45f), 8, 8, DustID.Torch, 0f, 0f, 0, default, 2f); - if (Main.rand.Next(20) != 0) + if (!Main.rand.NextBool(20)) { Main.dust[rightDust].noGravity = true; Main.dust[rightDust].scale *= 1f + Main.rand.Next(10) * 0.1f; @@ -397,7 +406,7 @@ namespace CalamityMod.NPCs.Ravager if (Main.rand.NextBool(10)) { leftDust = Dust.NewDust(new Vector2(NPC.Center.X - 80f, NPC.Center.Y + 45f), 8, 8, DustID.Torch, 0f, 0f, 0, default, 2f); - if (Main.rand.Next(20) != 0) + if (!Main.rand.NextBool(20)) { Dust leftDustExpr2 = Main.dust[leftDust]; leftDustExpr2.noGravity = true; @@ -419,7 +428,7 @@ namespace CalamityMod.NPCs.Ravager if (Main.rand.NextBool(10)) { rightDust = Dust.NewDust(new Vector2(NPC.Center.X + 60f, NPC.Center.Y + 60f), 8, 8, DustID.Torch, 0f, 0f, 0, default, 1.5f); - if (Main.rand.Next(20) != 0) + if (!Main.rand.NextBool(20)) { Dust rightDustExpr2 = Main.dust[rightDust]; rightDustExpr2.noGravity = true; @@ -442,7 +451,7 @@ namespace CalamityMod.NPCs.Ravager if (Main.rand.NextBool(10)) { leftDust = Dust.NewDust(new Vector2(NPC.Center.X - 60f, NPC.Center.Y + 60f), 8, 8, DustID.Torch, 0f, 0f, 0, default, 1.5f); - if (Main.rand.Next(20) != 0) + if (!Main.rand.NextBool(20)) { Main.dust[leftDust].noGravity = true; Main.dust[leftDust].scale *= 1f + Main.rand.Next(10) * 0.1f; @@ -464,6 +473,9 @@ namespace CalamityMod.NPCs.Ravager { if (NPC.velocity.Y == 0f) { + // Avoid cheap bullshit + NPC.damage = 0; + NPC.velocity.X *= 0.8f; NPC.ai[1] += 1f; if (NPC.ai[1] > 0f) @@ -491,6 +503,10 @@ namespace CalamityMod.NPCs.Ravager } else if (NPC.ai[1] == -1f) { + // Set damage + if (!finalPhase) + NPC.damage = NPC.defDamage; + NPC.noTileCollide = true; NPC.TargetClosest(); @@ -501,9 +517,8 @@ namespace CalamityMod.NPCs.Ravager float velocityX = 4f + velocityXBoost; if (velocityY != 16) - { SoundEngine.PlaySound(JumpSound, NPC.Center); - } + velocityY = -16f; float distanceBelowTarget = NPC.position.Y - (player.position.Y + 80f); @@ -558,14 +573,15 @@ namespace CalamityMod.NPCs.Ravager // Don't run custom gravity when starting a jump if (NPC.ai[0] != 1f) - { CustomGravity(); - } } else if (NPC.ai[0] >= 1f) { if (NPC.velocity.Y == 0f && (NPC.ai[1] == 31f || NPC.ai[0] == 1f)) { + // Avoid cheap bullshit + NPC.damage = 0; + SoundEngine.PlaySound(StompSound, NPC.Center); NPC.ai[0] = 0f; @@ -645,7 +661,7 @@ namespace CalamityMod.NPCs.Ravager { for (int stompDustAmount = 0; stompDustAmount < 6; stompDustAmount++) { - int stompDust = Dust.NewDust(new Vector2(NPC.position.X - 30f, NPC.position.Y + NPC.height), NPC.width + 30, 4, 31, 0f, 0f, 100, default, 1.5f); + int stompDust = Dust.NewDust(new Vector2(NPC.position.X - 30f, NPC.position.Y + NPC.height), NPC.width + 30, 4, DustID.Smoke, 0f, 0f, 100, default, 1.5f); Main.dust[stompDust].velocity *= 0.2f; } @@ -658,6 +674,10 @@ namespace CalamityMod.NPCs.Ravager } else { + // Set damage + if (!phase2) + NPC.damage = NPC.defDamage; + Vector2 targetVector = player.position; float aimY = targetVector.Y - 640f; float distanceFromTargetPos = Math.Abs(NPC.Top.Y - aimY); @@ -666,9 +686,8 @@ namespace CalamityMod.NPCs.Ravager if (phase2 && NPC.ai[1] == 0f) { if (calamityGlobalNPC.newAI[3] == 0) - { SoundEngine.PlaySound(JumpSound, NPC.Center); - } + NPC.noTileCollide = true; calamityGlobalNPC.newAI[3] += 1f; @@ -699,8 +718,6 @@ namespace CalamityMod.NPCs.Ravager if ((NPC.position.X + quarterWidth < targetVector.X + offset && NPC.position.X + NPC.width - quarterWidth > targetVector.X + player.width + offset && (inRange || NPC.ai[0] != 2f)) || NPC.ai[1] > 0f || calamityGlobalNPC.newAI[3] >= 90f) { - NPC.damage = NPC.defDamage; - if (phase2) { float stopBeforeFallTime = bossRush ? 25f : 30f; @@ -716,6 +733,9 @@ namespace CalamityMod.NPCs.Ravager } else { + // Set damage + NPC.damage = NPC.defDamage; + float fallSpeedBoost = !anyHeadActive ? 1.8f : death ? 1.8f * (1f - lifeRatio) : 1.2f * (1f - lifeRatio); float fallSpeed = (bossRush ? 1.8f : 1.2f) + fallSpeedBoost; @@ -764,7 +784,6 @@ namespace CalamityMod.NPCs.Ravager if (phase2) { - NPC.damage = 0; velocityXChange *= velocityMult; velocityXCap *= velocityMult; } @@ -840,11 +859,11 @@ namespace CalamityMod.NPCs.Ravager Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); if (NPC.IsABestiaryIconDummy) { - spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Ravager/RavagerClawLeft").Value, new Vector2(center.X - screenPos.X - NPC.scale * 180, center.Y - screenPos.Y + 50), - new Rectangle?(new Rectangle(0, 0, ModContent.Request("CalamityMod/NPCs/Ravager/RavagerClawLeft").Value.Width, ModContent.Request("CalamityMod/NPCs/Ravager/RavagerClawLeft").Value.Height)), + spriteBatch.Draw(TextureAssets.Npc[ModContent.NPCType()].Value, new Vector2(center.X - screenPos.X - NPC.scale * 180, center.Y - screenPos.Y + 50), + new Rectangle?(new Rectangle(0, 0, TextureAssets.Npc[ModContent.NPCType()].Value.Width, TextureAssets.Npc[ModContent.NPCType()].Value.Height)), Color.White, 0f, default, NPC.scale, SpriteEffects.None, 0f); - spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Ravager/RavagerClawRight").Value, new Vector2(center.X - screenPos.X + NPC.scale * 110, center.Y - screenPos.Y + 50), - new Rectangle?(new Rectangle(0, 0, ModContent.Request("CalamityMod/NPCs/Ravager/RavagerClawRight").Value.Width, ModContent.Request("CalamityMod/NPCs/Ravager/RavagerClawRight").Value.Height)), + spriteBatch.Draw(TextureAssets.Npc[ModContent.NPCType()].Value, new Vector2(center.X - screenPos.X + NPC.scale * 110, center.Y - screenPos.Y + 50), + new Rectangle?(new Rectangle(0, 0, TextureAssets.Npc[ModContent.NPCType()].Value.Width, TextureAssets.Npc[ModContent.NPCType()].Value.Height)), Color.White, 0f, default, NPC.scale, SpriteEffects.None, 0f); } return true; @@ -860,10 +879,10 @@ namespace CalamityMod.NPCs.Ravager Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); Vector2 halfSizeTexture = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2); Vector2 glowmaskPosition = center - screenPos; - glowmaskPosition -= new Vector2(ModContent.Request("CalamityMod/NPCs/Ravager/RavagerBodyGlow").Value.Width, ModContent.Request("CalamityMod/NPCs/Ravager/RavagerBodyGlow").Value.Height / Main.npcFrameCount[NPC.type]) * 1f / 2f; + glowmaskPosition -= new Vector2(GlowTexture.Value.Width, GlowTexture.Value.Height / Main.npcFrameCount[NPC.type]) * 1f / 2f; glowmaskPosition += halfSizeTexture * 1f + new Vector2(0f, 4f + NPC.gfxOffY); Color glowmaskColor = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Color.Blue); - spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Ravager/RavagerBodyGlow").Value, glowmaskPosition, + spriteBatch.Draw(GlowTexture.Value, glowmaskPosition, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); float legOffset = 20f; @@ -876,23 +895,23 @@ namespace CalamityMod.NPCs.Ravager headOffset = 0f; } - spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Ravager/RavagerLegRight").Value, new Vector2(center.X - screenPos.X + NPC.scale * 28f, center.Y - screenPos.Y + legOffset), //72 - new Rectangle?(new Rectangle(0, 0, ModContent.Request("CalamityMod/NPCs/Ravager/RavagerLegRight").Value.Width, ModContent.Request("CalamityMod/NPCs/Ravager/RavagerLegRight").Value.Height)), + spriteBatch.Draw(TextureAssets.Npc[ModContent.NPCType()].Value, new Vector2(center.X - screenPos.X + NPC.scale * 28f, center.Y - screenPos.Y + legOffset), //72 + new Rectangle?(new Rectangle(0, 0, TextureAssets.Npc[ModContent.NPCType()].Value.Width, TextureAssets.Npc[ModContent.NPCType()].Value.Height)), drawLighting, 0f, default, NPC.scale, SpriteEffects.None, 0f); - spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Ravager/RavagerLegLeft").Value, new Vector2(center.X - screenPos.X - NPC.scale * 112f, center.Y - screenPos.Y + legOffset), //72 - new Rectangle?(new Rectangle(0, 0, ModContent.Request("CalamityMod/NPCs/Ravager/RavagerLegLeft").Value.Width, ModContent.Request("CalamityMod/NPCs/Ravager/RavagerLegLeft").Value.Height)), + spriteBatch.Draw(TextureAssets.Npc[ModContent.NPCType()].Value, new Vector2(center.X - screenPos.X - NPC.scale * 112f, center.Y - screenPos.Y + legOffset), //72 + new Rectangle?(new Rectangle(0, 0, TextureAssets.Npc[ModContent.NPCType()].Value.Width, TextureAssets.Npc[ModContent.NPCType()].Value.Height)), drawLighting, 0f, default, NPC.scale, SpriteEffects.None, 0f); if (NPC.AnyNPCs(ModContent.NPCType()) || NPC.IsABestiaryIconDummy) { - spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Ravager/RavagerHead").Value, new Vector2(center.X - screenPos.X - NPC.scale * 70f, center.Y - screenPos.Y - NPC.scale * headOffset), - new Rectangle?(new Rectangle(0, 0, ModContent.Request("CalamityMod/NPCs/Ravager/RavagerHead").Value.Width, ModContent.Request("CalamityMod/NPCs/Ravager/RavagerHead").Value.Height)), + spriteBatch.Draw(TextureAssets.Npc[ModContent.NPCType()].Value, new Vector2(center.X - screenPos.X - NPC.scale * 70f, center.Y - screenPos.Y - NPC.scale * headOffset), + new Rectangle?(new Rectangle(0, 0, TextureAssets.Npc[ModContent.NPCType()].Value.Width, TextureAssets.Npc[ModContent.NPCType()].Value.Height)), drawLighting, 0f, default, NPC.scale, SpriteEffects.None, 0f); } } public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { - NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } @@ -915,7 +934,7 @@ namespace CalamityMod.NPCs.Ravager } for (int k = 0; k < 50; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 5, hit.HitDirection, -1f, 0, default, 2f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 2f); Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Torch, hit.HitDirection, -1f, 0, default, 1f); } } diff --git a/NPCs/Ravager/RavagerClawLeft.cs b/NPCs/Ravager/RavagerClawLeft.cs index 202654ffa7..218826ba88 100644 --- a/NPCs/Ravager/RavagerClawLeft.cs +++ b/NPCs/Ravager/RavagerClawLeft.cs @@ -1,9 +1,9 @@ -using CalamityMod.Buffs.StatDebuffs; +using System; +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -34,7 +34,6 @@ namespace CalamityMod.NPCs.Ravager NPC.knockBackResist = 0f; AIType = -1; NPC.noGravity = true; - NPC.canGhostHeal = false; NPC.alpha = 255; NPC.netAlways = true; NPC.HitSound = RavagerBody.HitSound; @@ -53,6 +52,10 @@ namespace CalamityMod.NPCs.Ravager NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToWater = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void AI() @@ -80,6 +83,9 @@ namespace CalamityMod.NPCs.Ravager } if (NPC.ai[0] == 0f) { + // Avoid cheap bullshit + NPC.damage = 0; + NPC.noTileCollide = true; Vector2 npcCenter = new Vector2(NPC.Center.X, NPC.Center.Y); float ravBodyXDist = Main.npc[CalamityGlobalNPC.scavenger].Center.X - npcCenter.X; @@ -134,6 +140,9 @@ namespace CalamityMod.NPCs.Ravager } else if (NPC.ai[0] == 1f) { + // Set damage + NPC.damage = NPC.defDamage; + SoundEngine.PlaySound(RavagerBody.FistSound, NPC.Center); NPC.noTileCollide = true; NPC.collideX = false; @@ -163,6 +172,9 @@ namespace CalamityMod.NPCs.Ravager } else if (NPC.ai[0] == 2f) { + // Set damage + NPC.damage = NPC.defDamage; + if (Math.Abs(NPC.velocity.X) > Math.Abs(NPC.velocity.Y)) { if (NPC.velocity.X > 0f && NPC.Center.X > Main.player[NPC.target].Center.X) @@ -195,12 +207,18 @@ namespace CalamityMod.NPCs.Ravager float bodyReturnDistance = (float)Math.Sqrt(bodyReturnXDist * bodyReturnXDist + bodyReturnYDist * bodyReturnYDist); if ((bodyReturnDistance > (death ? 900f : 700f) || NPC.collideX || NPC.collideY) | NPC.justHit) { + // Avoid cheap bullshit + NPC.damage = 0; + NPC.noTileCollide = true; NPC.ai[0] = 0f; } } else if (NPC.ai[0] == 3f) { + // Set damage + NPC.damage = NPC.defDamage; + NPC.noTileCollide = true; float velocityMult = 0.4f; Vector2 clawCenter = new Vector2(NPC.Center.X, NPC.Center.Y); @@ -277,9 +295,9 @@ namespace CalamityMod.NPCs.Ravager drawPositionY += 12f; drawPositionX -= 28f; Color color = Lighting.GetColor((int)center.X / 16, (int)(center.Y / 16f)); - spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Ravager/RavagerChain").Value, new Vector2(center.X - screenPos.X, center.Y - screenPos.Y), - new Rectangle?(new Rectangle(0, 0, ModContent.Request("CalamityMod/NPCs/Ravager/RavagerChain").Value.Width, ModContent.Request("CalamityMod/NPCs/Ravager/RavagerChain").Value.Height)), color, rotation, - new Vector2(ModContent.Request("CalamityMod/NPCs/Ravager/RavagerChain").Value.Width * 0.5f, ModContent.Request("CalamityMod/NPCs/Ravager/RavagerChain").Value.Height * 0.5f), 1f, SpriteEffects.None, 0f); + spriteBatch.Draw(RavagerBody.ChainTexture.Value, new Vector2(center.X - screenPos.X, center.Y - screenPos.Y), + new Rectangle?(new Rectangle(0, 0, RavagerBody.ChainTexture.Value.Width, RavagerBody.ChainTexture.Value.Height)), color, rotation, + new Vector2(RavagerBody.ChainTexture.Value.Width * 0.5f, RavagerBody.ChainTexture.Value.Height * 0.5f), 1f, SpriteEffects.None, 0f); } } return true; diff --git a/NPCs/Ravager/RavagerClawRight.cs b/NPCs/Ravager/RavagerClawRight.cs index 205e010f02..360d61c8a6 100644 --- a/NPCs/Ravager/RavagerClawRight.cs +++ b/NPCs/Ravager/RavagerClawRight.cs @@ -1,9 +1,9 @@ -using CalamityMod.Buffs.StatDebuffs; +using System; +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -35,7 +35,6 @@ namespace CalamityMod.NPCs.Ravager AIType = -1; NPC.netAlways = true; NPC.noGravity = true; - NPC.canGhostHeal = false; NPC.alpha = 255; NPC.HitSound = RavagerBody.HitSound; NPC.DeathSound = RavagerBody.LimbLossSound; @@ -53,6 +52,10 @@ namespace CalamityMod.NPCs.Ravager NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToWater = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void AI() @@ -81,6 +84,9 @@ namespace CalamityMod.NPCs.Ravager } if (NPC.ai[0] == 0f) { + // Avoid cheap bullshit + NPC.damage = 0; + NPC.noTileCollide = true; Vector2 npcCenter = new Vector2(NPC.Center.X, NPC.Center.Y); float ravBodyXDist = Main.npc[CalamityGlobalNPC.scavenger].Center.X - npcCenter.X; @@ -135,6 +141,9 @@ namespace CalamityMod.NPCs.Ravager } else if (NPC.ai[0] == 1f) { + // Set damage + NPC.damage = NPC.defDamage; + SoundEngine.PlaySound(RavagerBody.FistSound, NPC.Center); NPC.noTileCollide = true; NPC.collideX = false; @@ -164,6 +173,9 @@ namespace CalamityMod.NPCs.Ravager } else if (NPC.ai[0] == 2f) { + // Set damage + NPC.damage = NPC.defDamage; + if (Math.Abs(NPC.velocity.X) > Math.Abs(NPC.velocity.Y)) { if (NPC.velocity.X > 0f && NPC.Center.X > Main.player[NPC.target].Center.X) @@ -196,12 +208,18 @@ namespace CalamityMod.NPCs.Ravager float bodyReturnDistance = (float)Math.Sqrt(bodyReturnXDist * bodyReturnXDist + bodyReturnYDist * bodyReturnYDist); if ((bodyReturnDistance > (death ? 900f : 700f) || NPC.collideX || NPC.collideY) | NPC.justHit) { + // Avoid cheap bullshit + NPC.damage = 0; + NPC.noTileCollide = true; NPC.ai[0] = 0f; } } else if (NPC.ai[0] == 3f) { + // Set damage + NPC.damage = NPC.defDamage; + NPC.noTileCollide = true; float velocityMult = 0.4f; Vector2 clawCenter = new Vector2(NPC.Center.X, NPC.Center.Y); @@ -278,9 +296,9 @@ namespace CalamityMod.NPCs.Ravager drawPositionY += 12f; drawPositionX += 28f; Color color = Lighting.GetColor((int)center.X / 16, (int)(center.Y / 16f)); - spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Ravager/RavagerChain").Value, new Vector2(center.X - screenPos.X, center.Y - screenPos.Y), - new Rectangle?(new Rectangle(0, 0, ModContent.Request("CalamityMod/NPCs/Ravager/RavagerChain").Value.Width, ModContent.Request("CalamityMod/NPCs/Ravager/RavagerChain").Value.Height)), color, rotation, - new Vector2(ModContent.Request("CalamityMod/NPCs/Ravager/RavagerChain").Value.Width * 0.5f, ModContent.Request("CalamityMod/NPCs/Ravager/RavagerChain").Value.Height * 0.5f), 1f, SpriteEffects.None, 0f); + spriteBatch.Draw(RavagerBody.ChainTexture.Value, new Vector2(center.X - screenPos.X, center.Y - screenPos.Y), + new Rectangle?(new Rectangle(0, 0, RavagerBody.ChainTexture.Value.Width, RavagerBody.ChainTexture.Value.Height)), color, rotation, + new Vector2(RavagerBody.ChainTexture.Value.Width * 0.5f, RavagerBody.ChainTexture.Value.Height * 0.5f), 1f, SpriteEffects.None, 0f); } } return true; diff --git a/NPCs/Ravager/RavagerHead.cs b/NPCs/Ravager/RavagerHead.cs index 803f524d53..b0ff5f487d 100644 --- a/NPCs/Ravager/RavagerHead.cs +++ b/NPCs/Ravager/RavagerHead.cs @@ -3,10 +3,10 @@ using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.NPCs.Ravager { @@ -32,7 +32,6 @@ namespace CalamityMod.NPCs.Ravager AIType = -1; NPC.netAlways = true; NPC.noGravity = true; - NPC.canGhostHeal = false; NPC.noTileCollide = true; NPC.alpha = 255; NPC.HitSound = RavagerBody.HitSound; @@ -50,6 +49,10 @@ namespace CalamityMod.NPCs.Ravager NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToWater = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void AI() diff --git a/NPCs/Ravager/RavagerHead2.cs b/NPCs/Ravager/RavagerHead2.cs index 543f15d387..ccaa1b8db8 100644 --- a/NPCs/Ravager/RavagerHead2.cs +++ b/NPCs/Ravager/RavagerHead2.cs @@ -1,13 +1,13 @@ -using CalamityMod.Events; +using System; +using CalamityMod.Events; using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.NPCs.Ravager { @@ -32,7 +32,6 @@ namespace CalamityMod.NPCs.Ravager AIType = -1; NPC.netAlways = true; NPC.noGravity = true; - NPC.canGhostHeal = false; NPC.noTileCollide = true; NPC.HitSound = RavagerBody.HitSound; NPC.DeathSound = RavagerBody.LimbLossSound; @@ -49,6 +48,10 @@ namespace CalamityMod.NPCs.Ravager NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToWater = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void AI() @@ -195,7 +198,7 @@ namespace CalamityMod.NPCs.Ravager for (int k = 0; k < 3; k++) { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); - Dust.NewDust(NPC.position, NPC.width, NPC.height, 6, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Torch, hit.HitDirection, -1f, 0, default, 1f); } if (NPC.life <= 0) { @@ -208,7 +211,7 @@ namespace CalamityMod.NPCs.Ravager for (int k = 0; k < 20; k++) { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); - Dust.NewDust(NPC.position, NPC.width, NPC.height, 6, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Torch, hit.HitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/Ravager/RavagerLegLeft.cs b/NPCs/Ravager/RavagerLegLeft.cs index 826baf193b..9c1c8355b5 100644 --- a/NPCs/Ravager/RavagerLegLeft.cs +++ b/NPCs/Ravager/RavagerLegLeft.cs @@ -28,7 +28,6 @@ namespace CalamityMod.NPCs.Ravager AIType = -1; NPC.netAlways = true; NPC.noGravity = true; - NPC.canGhostHeal = false; NPC.noTileCollide = true; NPC.alpha = 255; NPC.HitSound = RavagerBody.HitSound; @@ -46,6 +45,10 @@ namespace CalamityMod.NPCs.Ravager NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToWater = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void AI() diff --git a/NPCs/Ravager/RavagerLegRight.cs b/NPCs/Ravager/RavagerLegRight.cs index 078e485d27..01ba1268f8 100644 --- a/NPCs/Ravager/RavagerLegRight.cs +++ b/NPCs/Ravager/RavagerLegRight.cs @@ -28,7 +28,6 @@ namespace CalamityMod.NPCs.Ravager AIType = -1; NPC.netAlways = true; NPC.noGravity = true; - NPC.canGhostHeal = false; NPC.noTileCollide = true; NPC.alpha = 255; NPC.HitSound = RavagerBody.HitSound; @@ -46,6 +45,10 @@ namespace CalamityMod.NPCs.Ravager NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToWater = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void AI() diff --git a/NPCs/Ravager/RockPillar.cs b/NPCs/Ravager/RockPillar.cs index 953f224ad4..7af3541cc5 100644 --- a/NPCs/Ravager/RockPillar.cs +++ b/NPCs/Ravager/RockPillar.cs @@ -2,10 +2,11 @@ using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; +using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.NPCs.Ravager { @@ -26,7 +27,6 @@ namespace CalamityMod.NPCs.Ravager NPC.defense = 50; NPC.DR_NERD(0.3f); NPC.chaseable = false; - NPC.canGhostHeal = false; NPC.lifeMax = DownedBossSystem.downedProvidence ? 20000 : 5000; double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); @@ -38,6 +38,10 @@ namespace CalamityMod.NPCs.Ravager NPC.DeathSound = SoundID.NPCDeath14; NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToWater = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void AI() @@ -55,31 +59,25 @@ namespace CalamityMod.NPCs.Ravager if (NPC.alpha > 0) { - NPC.damage = 0; - NPC.alpha -= 10; if (NPC.alpha < 0) NPC.alpha = 0; } - else - { - if (DownedBossSystem.downedProvidence && !BossRushEvent.BossRushActive) - NPC.damage = (int)(NPC.defDamage * 1.5); - else - NPC.damage = NPC.defDamage; - } if (NPC.ai[0] == 0f) { if (NPC.velocity.Y == 0f) { + // Avoid cheap bullshit + NPC.damage = 0; + if (NPC.ai[1] == -1f) { SoundEngine.PlaySound(SoundID.Item62, NPC.Center); for (int i = 0; i < 10; i++) { - int rockDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Iron, 0f, 0f, 100, default, 2f); + int rockDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Iron, 0f, 0f, 100, default, 2f); Main.dust[rockDust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -89,13 +87,19 @@ namespace CalamityMod.NPCs.Ravager } for (int j = 0; j < 10; j++) { - int rockDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Stone, 0f, 0f, 100, default, 3f); + int rockDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Stone, 0f, 0f, 100, default, 3f); Main.dust[rockDust2].noGravity = true; Main.dust[rockDust2].velocity *= 5f; - rockDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Iron, 0f, 0f, 100, default, 2f); + rockDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Iron, 0f, 0f, 100, default, 2f); Main.dust[rockDust2].velocity *= 2f; } + // Set damage + if (DownedBossSystem.downedProvidence && !BossRushEvent.BossRushActive) + NPC.damage = (int)Math.Round(NPC.defDamage * 1.5); + else + NPC.damage = NPC.defDamage; + NPC.noTileCollide = true; NPC.velocity.X = (BossRushEvent.BossRushActive ? 15 : 12) * NPC.direction; NPC.velocity.Y = -28.5f; @@ -106,6 +110,12 @@ namespace CalamityMod.NPCs.Ravager } else { + // Set damage + if (DownedBossSystem.downedProvidence && !BossRushEvent.BossRushActive) + NPC.damage = (int)Math.Round(NPC.defDamage * 1.5); + else + NPC.damage = NPC.defDamage; + if (NPC.velocity.Y == 0f || Vector2.Distance(NPC.Center, Main.npc[CalamityGlobalNPC.scavenger].Center) > 2800f) { SoundEngine.PlaySound(SoundID.Item14, NPC.Center); @@ -153,7 +163,7 @@ namespace CalamityMod.NPCs.Ravager NPC.position.Y = NPC.position.Y - (NPC.height / 2); for (int i = 0; i < 30; i++) { - int rockDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Iron, 0f, 0f, 100, default, 2f); + int rockDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Iron, 0f, 0f, 100, default, 2f); Main.dust[rockDust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -163,10 +173,10 @@ namespace CalamityMod.NPCs.Ravager } for (int j = 0; j < 30; j++) { - int rockDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Stone, 0f, 0f, 100, default, 3f); + int rockDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Stone, 0f, 0f, 100, default, 3f); Main.dust[rockDust2].noGravity = true; Main.dust[rockDust2].velocity *= 5f; - rockDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Iron, 0f, 0f, 100, default, 2f); + rockDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Iron, 0f, 0f, 100, default, 2f); Main.dust[rockDust2].velocity *= 2f; } @@ -190,7 +200,7 @@ namespace CalamityMod.NPCs.Ravager { for (int i = 0; i < 2; i++) { - int rockDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Iron, 0f, 0f, 100, default, 2f); + int rockDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Iron, 0f, 0f, 100, default, 2f); Main.dust[rockDust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -200,10 +210,10 @@ namespace CalamityMod.NPCs.Ravager } for (int j = 0; j < 2; j++) { - int rockDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Stone, 0f, 0f, 100, default, 3f); + int rockDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Stone, 0f, 0f, 100, default, 3f); Main.dust[rockDust2].noGravity = true; Main.dust[rockDust2].velocity *= 5f; - rockDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Iron, 0f, 0f, 100, default, 2f); + rockDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Iron, 0f, 0f, 100, default, 2f); Main.dust[rockDust2].velocity *= 2f; } } diff --git a/NPCs/Signus/CosmicLantern.cs b/NPCs/Signus/CosmicLantern.cs index fddafbc722..b3ba7cb89d 100644 --- a/NPCs/Signus/CosmicLantern.cs +++ b/NPCs/Signus/CosmicLantern.cs @@ -1,8 +1,10 @@ -using CalamityMod.Events; +using System.IO; +using CalamityMod.Events; +using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System.IO; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.GameContent.Bestiary; @@ -12,11 +14,17 @@ namespace CalamityMod.NPCs.Signus { public class CosmicLantern : ModNPC { + public static Asset GlowTexture; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 4; NPCID.Sets.TrailingMode[NPC.type] = 1; NPCID.Sets.BossBestiaryPriority.Add(Type); + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -35,11 +43,14 @@ namespace CalamityMod.NPCs.Signus NPC.noGravity = true; NPC.dontTakeDamage = true; NPC.chaseable = false; - NPC.canGhostHeal = false; NPC.noTileCollide = true; NPC.HitSound = SoundID.NPCHit53; NPC.DeathSound = SoundID.NPCDeath44; NPC.Calamity().VulnerableToSickness = false; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -47,10 +58,10 @@ namespace CalamityMod.NPCs.Signus int associatedNPCType = ModContent.NPCType(); bestiaryEntry.UIInfoProvider = new CommonEnemyUICollectionInfoProvider(ContentSamples.NpcBestiaryCreditIdsByNpcNetIds[associatedNPCType], quickUnlock: true); - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.TheUnderworld, - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.CosmicLantern") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.CosmicLantern") }); } @@ -89,19 +100,27 @@ namespace CalamityMod.NPCs.Signus Lighting.AddLight((int)((NPC.position.X + (float)(NPC.width / 2)) / 16f), (int)((NPC.position.Y + (float)(NPC.height / 2)) / 16f), 0.3f, 0.3f, 0.3f); NPC.alpha -= 3; - if (NPC.alpha < 0) + if (NPC.alpha <= 0) { + // Set damage + NPC.damage = NPC.defDamage; + NPC.alpha = 0; - int lightDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, 204, 0f, 0f, 0, default, 0.25f); + int lightDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TreasureSparkle, 0f, 0f, 0, default, 0.25f); Main.dust[lightDust].velocity *= 0.1f; Main.dust[lightDust].noGravity = true; } + else + { + // Avoid cheap bullshit + NPC.damage = 0; + } bool revenge = CalamityWorld.revenge; float playerDistNormMult = revenge ? 24f : 22f; if (BossRushEvent.BossRushActive) playerDistNormMult = 30f; - CalamityAI.DungeonSpiritAI(NPC, Mod, playerDistNormMult, 0f, true); + CalamityRegularEnemyAI.DungeonSpiritAI(NPC, Mod, playerDistNormMult, 0f, true); } public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) @@ -134,7 +153,7 @@ namespace CalamityMod.NPCs.Signus drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/Signus/CosmicLanternGlow").Value; + texture2D15 = GlowTexture.Value; Color cyanLerp = Color.Lerp(Color.White, Color.Cyan, 0.5f); if (CalamityConfig.Instance.Afterimages) @@ -168,7 +187,7 @@ namespace CalamityMod.NPCs.Signus { for (int k = 0; k < 10; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 204, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TreasureSparkle, hit.HitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/Signus/CosmicMine.cs b/NPCs/Signus/CosmicMine.cs index 39bbd0604b..7a5e64484a 100644 --- a/NPCs/Signus/CosmicMine.cs +++ b/NPCs/Signus/CosmicMine.cs @@ -1,15 +1,15 @@ -using CalamityMod.Dusts; +using System; +using System.IO; +using CalamityMod.Dusts; using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; using Terraria; +using Terraria.Audio; using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.NPCs.Signus { @@ -32,13 +32,18 @@ namespace CalamityMod.NPCs.Signus NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); NPC.aiStyle = -1; AIType = -1; - NPC.knockBackResist = 0f; + NPC.knockBackResist = 0.5f; NPC.noGravity = true; NPC.noTileCollide = true; NPC.dontTakeDamage = true; + NPC.chaseable = false; NPC.HitSound = SoundID.NPCHit53; NPC.DeathSound = SoundID.NPCDeath44; NPC.Calamity().VulnerableToSickness = false; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SendExtraAI(BinaryWriter writer) @@ -208,7 +213,7 @@ namespace CalamityMod.NPCs.Signus NPC.position.Y = NPC.position.Y - (NPC.height / 2); for (int i = 0; i < 10; i++) { - int cosmiliteDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + int cosmiliteDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[cosmiliteDust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -219,10 +224,10 @@ namespace CalamityMod.NPCs.Signus } for (int j = 0; j < 20; j++) { - int cosmiliteDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); + int cosmiliteDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); Main.dust[cosmiliteDust2].noGravity = true; Main.dust[cosmiliteDust2].velocity *= 5f; - cosmiliteDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + cosmiliteDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[cosmiliteDust2].velocity *= 2f; Main.dust[cosmiliteDust2].noGravity = true; } diff --git a/NPCs/Signus/Signus.cs b/NPCs/Signus/Signus.cs index 9f2f65c90f..997ff5f25a 100644 --- a/NPCs/Signus/Signus.cs +++ b/NPCs/Signus/Signus.cs @@ -1,4 +1,6 @@ -using CalamityMod.Buffs.StatDebuffs; +using System; +using System.IO; +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; using CalamityMod.Events; using CalamityMod.Items.Accessories; @@ -16,16 +18,15 @@ using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; +using ReLogic.Content; using Terraria; +using Terraria.Audio; using Terraria.GameContent; using Terraria.GameContent.Bestiary; +using Terraria.GameContent.ItemDropRules; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using Terraria.GameContent.ItemDropRules; namespace CalamityMod.NPCs.Signus { @@ -37,12 +38,18 @@ namespace CalamityMod.NPCs.Signus private int lifeToAlpha = 0; private int stealthTimer = 0; + public static Asset AltTexture; + public static Asset AltTexture2; + public static Asset Texture_Glow; + public static Asset AltTexture_Glow; + public static Asset AltTexture2_Glow; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 6; NPCID.Sets.TrailingMode[NPC.type] = 1; NPCID.Sets.BossBestiaryPriority.Add(Type); - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { PortraitPositionYOverride = 10f, Scale = 0.4f, @@ -52,6 +59,14 @@ namespace CalamityMod.NPCs.Signus value.Position.Y += 10f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; NPCID.Sets.MPAllowedEnemies[Type] = true; + if (!Main.dedServ) + { + Texture_Glow = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + AltTexture_Glow = ModContent.Request(Texture + "AltGlow", AssetRequestMode.AsyncLoad); + AltTexture2_Glow = ModContent.Request(Texture + "Alt2Glow", AssetRequestMode.AsyncLoad); + AltTexture = ModContent.Request(Texture + "Alt", AssetRequestMode.AsyncLoad); + AltTexture2 = ModContent.Request(Texture + "Alt2", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -80,7 +95,7 @@ namespace CalamityMod.NPCs.Signus public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.TheUnderworld, new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Signus") @@ -137,8 +152,6 @@ namespace CalamityMod.NPCs.Signus bool phase3 = lifeRatio < 0.5f; bool phase4 = lifeRatio < 0.33f; - NPC.damage = NPC.defDamage; - // Get a target if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) NPC.TargetClosest(); @@ -223,6 +236,9 @@ namespace CalamityMod.NPCs.Signus if (NPC.ai[0] <= 2f) { + // Avoid cheap bullshit + NPC.damage = 0; + NPC.rotation = NPC.velocity.X * 0.04f; float playerLocation = vectorCenter.X - player.Center.X; NPC.direction = playerLocation < 0f ? 1 : -1; @@ -271,6 +287,9 @@ namespace CalamityMod.NPCs.Signus } else if (NPC.ai[0] == 0f) { + // Avoid cheap bullshit + NPC.damage = 0; + if (Main.netMode != NetmodeID.MultiplayerClient) { NPC.localAI[1] += bossRush ? 1.5f : 1f; @@ -445,6 +464,9 @@ namespace CalamityMod.NPCs.Signus } else if (NPC.ai[0] == 3f) { + // Avoid cheap bullshit + NPC.damage = 0; + NPC.rotation = NPC.velocity.X * 0.04f; float playerLocation = vectorCenter.X - player.Center.X; NPC.direction = playerLocation < 0f ? 1 : -1; @@ -609,6 +631,9 @@ namespace CalamityMod.NPCs.Signus if (calamityGlobalNPC.newAI[0] == 0f) // Line up the charge { + // Avoid cheap bullshit + NPC.damage = 0; + float velocity = bossRush ? 18f : revenge ? 16f : expertMode ? 15f : 14f; if (expertMode) velocity += death ? 6f * (float)(1D - lifeRatio) : 4f * (float)(1D - lifeRatio); @@ -644,11 +669,17 @@ namespace CalamityMod.NPCs.Signus } else if (calamityGlobalNPC.newAI[0] == 1f) // Pause before charge { + // Avoid cheap bullshit + NPC.damage = 0; + NPC.velocity *= 0.8f; NPC.ai[1] += 1f; if (NPC.ai[1] >= 5f) { + // Set damage + NPC.damage = NPC.defDamage; + calamityGlobalNPC.newAI[0] = 2f; NPC.netUpdate = true; @@ -665,6 +696,9 @@ namespace CalamityMod.NPCs.Signus } else if (calamityGlobalNPC.newAI[0] == 2f) // Charging { + // Set damage + NPC.damage = NPC.defDamage; + if (Main.netMode != NetmodeID.MultiplayerClient) { bool buffed = false; @@ -715,6 +749,9 @@ namespace CalamityMod.NPCs.Signus } else if (calamityGlobalNPC.newAI[0] == 3f) // Slow down after charging and reset { + // Avoid cheap bullshit + NPC.damage = 0; + if (stealthTimer >= maxStealth) { stealthTimer = 0; @@ -772,7 +809,7 @@ namespace CalamityMod.NPCs.Signus public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { Texture2D NPCTexture = TextureAssets.Npc[NPC.type].Value; - Texture2D glowMaskTexture = ModContent.Request("CalamityMod/NPCs/Signus/SignusGlow").Value; + Texture2D glowMaskTexture = Texture_Glow.Value; SpriteEffects spriteEffects = SpriteEffects.None; if (NPC.spriteDirection == 1) @@ -784,8 +821,8 @@ namespace CalamityMod.NPCs.Signus if (NPC.ai[0] == 4f) { - NPCTexture = ModContent.Request("CalamityMod/NPCs/Signus/SignusAlt2").Value; - glowMaskTexture = ModContent.Request("CalamityMod/NPCs/Signus/SignusAlt2Glow").Value; + NPCTexture = AltTexture2.Value; + glowMaskTexture = AltTexture2_Glow.Value; afterimageAmt = 10; int frameY = 94 * (int)(NPC.frameCounter / 12.0); if (frameY >= 94 * 6) @@ -794,14 +831,14 @@ namespace CalamityMod.NPCs.Signus } else if (NPC.ai[0] == 3f) { - NPCTexture = ModContent.Request("CalamityMod/NPCs/Signus/SignusAlt").Value; - glowMaskTexture = ModContent.Request("CalamityMod/NPCs/Signus/SignusAltGlow").Value; + NPCTexture = AltTexture.Value; + glowMaskTexture = AltTexture_Glow.Value; afterimageAmt = 7; } else { NPCTexture = TextureAssets.Npc[NPC.type].Value; - glowMaskTexture = ModContent.Request("CalamityMod/NPCs/Signus/SignusGlow").Value; + glowMaskTexture = Texture_Glow.Value; } Vector2 halfSizeTexture = new Vector2(NPCTexture.Width / 2, NPCTexture.Height / frameCount / 2); @@ -941,7 +978,7 @@ namespace CalamityMod.NPCs.Signus public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { - NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } @@ -961,7 +998,7 @@ namespace CalamityMod.NPCs.Signus NPC.position.Y = NPC.position.Y - (NPC.height / 2); for (int i = 0; i < 40; i++) { - int teleportDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + int teleportDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[teleportDust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -971,10 +1008,10 @@ namespace CalamityMod.NPCs.Signus } for (int j = 0; j < 60; j++) { - int teleportDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); + int teleportDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); Main.dust[teleportDust2].noGravity = true; Main.dust[teleportDust2].velocity *= 5f; - teleportDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + teleportDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[teleportDust2].velocity *= 2f; } if (Main.netMode != NetmodeID.Server) diff --git a/NPCs/Signus/SignusScreenShaderData.cs b/NPCs/Signus/SignusScreenShaderData.cs index 32af221316..902c4f9389 100644 --- a/NPCs/Signus/SignusScreenShaderData.cs +++ b/NPCs/Signus/SignusScreenShaderData.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.Graphics.Shaders; using Terraria.ModLoader; diff --git a/NPCs/SlimeGod/CorruptSlimeSpawn.cs b/NPCs/SlimeGod/CorruptSlimeSpawn.cs index e6d980573f..b3f43e7cbd 100644 --- a/NPCs/SlimeGod/CorruptSlimeSpawn.cs +++ b/NPCs/SlimeGod/CorruptSlimeSpawn.cs @@ -15,7 +15,7 @@ namespace CalamityMod.NPCs.SlimeGod { Main.npcFrameCount[NPC.type] = 4; NPCID.Sets.BossBestiaryPriority.Add(Type); - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0); + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(); value.PortraitPositionYOverride = -32f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; } @@ -33,17 +33,20 @@ namespace CalamityMod.NPCs.SlimeGod NPC.lifeMax = BossRushEvent.BossRushActive ? 10000 : (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 360 : 180; double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); - NPC.knockBackResist = 0f; + NPC.knockBackResist = 0.7f; AnimationType = 121; NPC.Opacity = 0.8f; NPC.lavaImmune = false; NPC.noGravity = false; NPC.noTileCollide = false; - NPC.canGhostHeal = false; NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath1; NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -51,11 +54,11 @@ namespace CalamityMod.NPCs.SlimeGod int associatedNPCType = ModContent.NPCType(); bestiaryEntry.UIInfoProvider = new CommonEnemyUICollectionInfoProvider(ContentSamples.NpcBestiaryCreditIdsByNpcNetIds[associatedNPCType], quickUnlock: true); - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.TheCorruption, BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.TheCrimson, - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.CorruptSlimeSpawn") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.CorruptSlimeSpawn") }); } @@ -71,7 +74,7 @@ namespace CalamityMod.NPCs.SlimeGod dustColor.A = 150; for (int k = 0; k < 5; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 4, hit.HitDirection, -1f, NPC.alpha, dustColor, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, hit.HitDirection, -1f, NPC.alpha, dustColor, 1f); } } public override void OnKill() diff --git a/NPCs/SlimeGod/CorruptSlimeSpawn2.cs b/NPCs/SlimeGod/CorruptSlimeSpawn2.cs index 79b280c2a7..9842a5070c 100644 --- a/NPCs/SlimeGod/CorruptSlimeSpawn2.cs +++ b/NPCs/SlimeGod/CorruptSlimeSpawn2.cs @@ -1,8 +1,8 @@ -using CalamityMod.Events; +using System; +using CalamityMod.Events; using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.Localization; @@ -32,17 +32,25 @@ namespace CalamityMod.NPCs.SlimeGod NPC.lifeMax = BossRushEvent.BossRushActive ? 5000 : (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 180 : 90; double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); - NPC.knockBackResist = 0f; + NPC.knockBackResist = 0.9f; AnimationType = NPCID.CorruptSlime; NPC.Opacity = 0.8f; NPC.lavaImmune = false; NPC.noGravity = false; NPC.noTileCollide = false; - NPC.canGhostHeal = false; NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath1; NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); + } + + public override void AI() + { + NPC.damage = (NPC.velocity.Y == 0f || NPC.velocity.Length() < 3f) ? 0 : NPC.defDamage; } public override void HitEffect(NPC.HitInfo hit) @@ -51,13 +59,13 @@ namespace CalamityMod.NPCs.SlimeGod dustColor.A = 150; for (int k = 0; k < 5; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 4, hit.HitDirection, -1f, NPC.alpha, dustColor, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, hit.HitDirection, -1f, NPC.alpha, dustColor, 1f); } if (NPC.life <= 0) { for (int k = 0; k < 20; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 4, hit.HitDirection, -1f, NPC.alpha, dustColor, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, hit.HitDirection, -1f, NPC.alpha, dustColor, 1f); } } } @@ -66,8 +74,8 @@ namespace CalamityMod.NPCs.SlimeGod { int closestPlayer = Player.FindClosest(NPC.Center, 1, 1); if (Main.rand.NextBool(8) && Main.player[closestPlayer].statLife < Main.player[closestPlayer].statLifeMax2) - Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); - + Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); + if (Main.zenithWorld && Main.rand.NextBool(5)) { if (Main.netMode != NetmodeID.MultiplayerClient) diff --git a/NPCs/SlimeGod/CrimsonSlimeSpawn.cs b/NPCs/SlimeGod/CrimsonSlimeSpawn.cs index 77ffd322ad..14e3462383 100644 --- a/NPCs/SlimeGod/CrimsonSlimeSpawn.cs +++ b/NPCs/SlimeGod/CrimsonSlimeSpawn.cs @@ -1,8 +1,8 @@ -using CalamityMod.Events; +using System; +using CalamityMod.Events; using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.GameContent.Bestiary; using Terraria.ID; @@ -31,17 +31,20 @@ namespace CalamityMod.NPCs.SlimeGod NPC.lifeMax = BossRushEvent.BossRushActive ? 10000 : (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 220 : 110; double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); - NPC.knockBackResist = 0f; + NPC.knockBackResist = 0.8f; AnimationType = NPCID.CorruptSlime; NPC.Opacity = 0.8f; NPC.lavaImmune = false; NPC.noGravity = false; NPC.noTileCollide = false; - NPC.canGhostHeal = false; NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath1; NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -49,27 +52,32 @@ namespace CalamityMod.NPCs.SlimeGod int associatedNPCType = ModContent.NPCType(); bestiaryEntry.UIInfoProvider = new CommonEnemyUICollectionInfoProvider(ContentSamples.NpcBestiaryCreditIdsByNpcNetIds[associatedNPCType], quickUnlock: true); - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.TheCorruption, BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.TheCrimson, - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.CrimsonSlimeSpawn") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.CrimsonSlimeSpawn") }); } + public override void AI() + { + NPC.damage = (NPC.velocity.Y == 0f || NPC.velocity.Length() < 3f) ? 0 : NPC.defDamage; + } + public override void HitEffect(NPC.HitInfo hit) { Color dustColor = Color.Crimson; dustColor.A = 150; for (int k = 0; k < 5; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 4, hit.HitDirection, -1f, NPC.alpha, dustColor, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, hit.HitDirection, -1f, NPC.alpha, dustColor, 1f); } if (NPC.life <= 0) { for (int k = 0; k < 20; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 4, hit.HitDirection, -1f, NPC.alpha, dustColor, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, hit.HitDirection, -1f, NPC.alpha, dustColor, 1f); } } } diff --git a/NPCs/SlimeGod/CrimsonSlimeSpawn2.cs b/NPCs/SlimeGod/CrimsonSlimeSpawn2.cs index 4f189ae655..cec25e0cb4 100644 --- a/NPCs/SlimeGod/CrimsonSlimeSpawn2.cs +++ b/NPCs/SlimeGod/CrimsonSlimeSpawn2.cs @@ -1,9 +1,9 @@ -using CalamityMod.Events; +using System; +using CalamityMod.Events; using CalamityMod.Projectiles.Boss; using CalamityMod.Projectiles.Enemy; using CalamityMod.World; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.GameContent; using Terraria.GameContent.Bestiary; @@ -36,12 +36,11 @@ namespace CalamityMod.NPCs.SlimeGod NPC.lifeMax = BossRushEvent.BossRushActive ? 12000 : (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 260 : 130; double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); - NPC.knockBackResist = 0f; + NPC.knockBackResist = 0.7f; NPC.Opacity = 0.8f; NPC.lavaImmune = false; NPC.noGravity = false; NPC.noTileCollide = false; - NPC.canGhostHeal = false; NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath1; NPC.Calamity().VulnerableToHeat = true; @@ -53,11 +52,11 @@ namespace CalamityMod.NPCs.SlimeGod int associatedNPCType = ModContent.NPCType(); bestiaryEntry.UIInfoProvider = new CommonEnemyUICollectionInfoProvider(ContentSamples.NpcBestiaryCreditIdsByNpcNetIds[associatedNPCType], quickUnlock: true); - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.TheCorruption, BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.TheCrimson, - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.CrimsonSlimeSpawn2") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.CrimsonSlimeSpawn2") }); } @@ -156,13 +155,13 @@ namespace CalamityMod.NPCs.SlimeGod dustColor.A = 150; for (int k = 0; k < 5; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 4, hit.HitDirection, -1f, NPC.alpha, dustColor, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, hit.HitDirection, -1f, NPC.alpha, dustColor, 1f); } if (NPC.life <= 0) { for (int k = 0; k < 20; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 4, hit.HitDirection, -1f, NPC.alpha, dustColor, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, hit.HitDirection, -1f, NPC.alpha, dustColor, 1f); } } } diff --git a/NPCs/SlimeGod/CrimulanPaladin.cs b/NPCs/SlimeGod/CrimulanPaladin.cs index 23bfbfd72c..0881cbf004 100644 --- a/NPCs/SlimeGod/CrimulanPaladin.cs +++ b/NPCs/SlimeGod/CrimulanPaladin.cs @@ -1,14 +1,14 @@ -using CalamityMod.Events; +using System; +using System.Collections.Generic; +using System.IO; +using CalamityMod.Events; using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; -using System; -using System.Collections.Generic; -using System.IO; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.NPCs.SlimeGod { @@ -83,11 +83,11 @@ namespace CalamityMod.NPCs.SlimeGod float lifeRatio = NPC.life / (float)NPC.lifeMax; NPC.defense = NPC.defDefense; - NPC.damage = NPC.defDamage; + int setDamage = NPC.defDamage; if (NPC.localAI[1] == 1f) { NPC.defense = NPC.defDefense + 24; - NPC.damage = NPC.defDamage + 25; + setDamage += 25; } float scale = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 0.6f : Main.getGoodWorld ? 0.8f : 1f; @@ -135,10 +135,9 @@ namespace CalamityMod.NPCs.SlimeGod Vector2 spawnAt = NPC.Center + new Vector2(0f, NPC.height / 2f); NPC.NewNPC(NPC.GetSource_FromAI(), (int)spawnAt.X - 30, (int)spawnAt.Y, ModContent.NPCType()); NPC.NewNPC(NPC.GetSource_FromAI(), (int)spawnAt.X + 30, (int)spawnAt.Y, ModContent.NPCType()); - if (Main.zenithWorld && NPC.CountNPCS(ModContent.NPCType()) < 3) //split into 3 slimes if the other large slime hasn't split yet - { + if (Main.zenithWorld && NPC.CountNPCS(ModContent.NPCType()) < 3) // Split into 3 slimes if the other large slime hasn't split yet NPC.NewNPC(NPC.GetSource_FromAI(), (int)spawnAt.X, (int)spawnAt.Y - 30, ModContent.NPCType()); - } + NPC.life = 0; NPC.HitEffect(); NPC.active = false; @@ -150,14 +149,11 @@ namespace CalamityMod.NPCs.SlimeGod if (CalamityGlobalNPC.slimeGodPurple != -1) { if (Main.npc[CalamityGlobalNPC.slimeGodPurple].active) - { enraged = false; - } } + if (bossRush) - { enraged = true; - } if (NPC.localAI[1] != 1f) { @@ -183,34 +179,43 @@ namespace CalamityMod.NPCs.SlimeGod NPC.netUpdate = true; NPC.TargetClosest(false); player = Main.player[NPC.target]; - Vector2 vectorAimedAheadOfTarget = player.Center + new Vector2((float)Math.Round(player.velocity.X), 0f).SafeNormalize(Vector2.Zero) * 960f; - Point teleportAheadPos = vectorAimedAheadOfTarget.ToTileCoordinates(); - int maxTeleportTries = 0; - while (maxTeleportTries < 100) + + float distanceAhead = 800f; + Vector2 randomDefault = Main.rand.NextBool() ? Vector2.UnitX : -Vector2.UnitX; + Vector2 vectorAimedAheadOfTarget = player.Center + new Vector2((float)Math.Round(player.velocity.X), 0f).SafeNormalize(randomDefault) * distanceAhead; + Point predictiveTeleportPoint = vectorAimedAheadOfTarget.ToTileCoordinates(); + int randomPredictiveTeleportOffset = 5; + int teleportTries = 0; + while (teleportTries < 100) { - maxTeleportTries++; - int teleportPosX = Main.rand.Next(teleportAheadPos.X - 5, teleportAheadPos.X + 6); - int teleportPosY = Main.rand.Next(teleportAheadPos.Y - 5, teleportAheadPos.Y); - if (Main.tile[teleportPosX, teleportPosY].HasUnactuatedTile) - continue; + teleportTries++; + int teleportTileX = Main.rand.Next(predictiveTeleportPoint.X - randomPredictiveTeleportOffset, predictiveTeleportPoint.X + randomPredictiveTeleportOffset + 1); + int teleportTileY = Main.rand.Next(predictiveTeleportPoint.Y - randomPredictiveTeleportOffset, predictiveTeleportPoint.Y); - bool canTeleport = true; - if (canTeleport && Main.tile[teleportPosX, teleportPosY].LiquidType == LiquidID.Lava) - canTeleport = false; - if (canTeleport && !Collision.CanHitLine(NPC.Center, 0, 0, vectorAimedAheadOfTarget, 0, 0)) - canTeleport = false; - - if (canTeleport) + if (!Main.tile[teleportTileX, teleportTileY].HasUnactuatedTile) { - NPC.localAI[0] = teleportPosX * 16 + 8; - NPC.localAI[3] = teleportPosY * 16 + 16; - calamityGlobalNPC.newAI[0] = 0f; - break; + bool canTeleportToTile = true; + if (canTeleportToTile && Main.tile[teleportTileX, teleportTileY].LiquidType == LiquidID.Lava) + canTeleportToTile = false; + if (canTeleportToTile && !Collision.CanHitLine(NPC.Center, 0, 0, predictiveTeleportPoint.ToVector2() * 16, 0, 0)) + canTeleportToTile = false; + + if (canTeleportToTile) + { + NPC.localAI[0] = teleportTileX * 16 + 8; + NPC.localAI[3] = teleportTileY * 16 + 16; + calamityGlobalNPC.newAI[0] = 0f; + break; + } + else + predictiveTeleportPoint.X += predictiveTeleportPoint.X < 0f ? 1 : -1; } + else + predictiveTeleportPoint.X += predictiveTeleportPoint.X < 0f ? 1 : -1; } // Default teleport if the above conditions aren't met in 100 iterations - if (maxTeleportTries >= 100) + if (teleportTries >= 100) { Vector2 bottom = Main.player[Player.FindClosest(NPC.position, NPC.width, NPC.height)].Bottom; NPC.localAI[0] = bottom.X; @@ -236,15 +241,20 @@ namespace CalamityMod.NPCs.SlimeGod bool phaseThroughTilesToReachTarget = Vector2.Distance(player.Center, NPC.Center) > 2400f || !Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height); if (Main.netMode != NetmodeID.MultiplayerClient && phaseThroughTilesToReachTarget) { + // Set damage + NPC.damage = setDamage; + NPC.ai[0] = 4f; NPC.ai[1] = 0f; NPC.ai[2] = 0f; NPC.ai[3] = 0f; NPC.netUpdate = true; } - - if (NPC.velocity.Y == 0f) + else if (NPC.velocity.Y == 0f) { + // Avoid cheap bullshit + NPC.damage = 0; + NPC.TargetClosest(); NPC.velocity.X *= 0.8f; NPC.ai[1] += 1f; @@ -273,6 +283,9 @@ namespace CalamityMod.NPCs.SlimeGod if (NPC.ai[1] > jumpGateValue) { + // Set damage + NPC.damage = setDamage; + NPC.ai[3] += 1f; if (NPC.ai[3] >= 2f) { @@ -291,6 +304,9 @@ namespace CalamityMod.NPCs.SlimeGod } else { + // Set damage + NPC.damage = setDamage; + NPC.velocity.X *= 0.99f; if (NPC.direction < 0 && NPC.velocity.X > -1f) NPC.velocity.X = -1f; @@ -314,6 +330,9 @@ namespace CalamityMod.NPCs.SlimeGod if (NPC.velocity.Y == 0f) { + // Avoid cheap bullshit + NPC.damage = 0; + float phaseSwitchGateValue = 360f; bool switchPhase = NPC.ai[2] >= phaseSwitchGateValue; if (switchPhase) @@ -335,6 +354,9 @@ namespace CalamityMod.NPCs.SlimeGod if (NPC.ai[0] == 1f) { + // Set damage + NPC.damage = setDamage; + NPC.noTileCollide = true; NPC.velocity.Y = death ? -10f : revenge ? -9f : expertMode ? -8f : -7f; } @@ -351,6 +373,9 @@ namespace CalamityMod.NPCs.SlimeGod } else if (NPC.ai[0] == 1f) { + // Avoid cheap bullshit + NPC.damage = 0; + NPC.noTileCollide = true; NPC.noGravity = true; @@ -397,6 +422,9 @@ namespace CalamityMod.NPCs.SlimeGod } else if (NPC.ai[0] == 1.1f) { + // Set damage + NPC.damage = setDamage; + bool atTargetPosition = NPC.position.Y + NPC.height >= player.position.Y; if (NPC.ai[2] == 0f && (atTargetPosition || NPC.localAI[1] == 0f) && Collision.CanHit(NPC.Center, 1, 1, player.Center, 1, 1) && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) { @@ -406,6 +434,9 @@ namespace CalamityMod.NPCs.SlimeGod if (atTargetPosition || NPC.velocity.Y <= 0f) { + // Avoid cheap bullshit + NPC.damage = 0; + NPC.ai[1] += 1f; if (NPC.ai[1] > 10f) { @@ -469,12 +500,18 @@ namespace CalamityMod.NPCs.SlimeGod { if (NPC.velocity.Y == 0f) { + // Avoid cheap bullshit + NPC.damage = 0; + NPC.TargetClosest(); NPC.velocity.X *= 0.8f; NPC.ai[1] += 1f; if (NPC.ai[1] > 15f) { + // Set damage + NPC.damage = setDamage; + NPC.ai[1] = 0f; NPC.velocity.Y -= 3f; @@ -501,6 +538,9 @@ namespace CalamityMod.NPCs.SlimeGod } else { + // Set damage + NPC.damage = setDamage; + NPC.velocity.X *= 0.98f; float velocityLimit = (death ? 5.5f : revenge ? 5f : expertMode ? 4.5f : 4f); if (NPC.direction < 0 && NPC.velocity.X > -velocityLimit) @@ -511,6 +551,9 @@ namespace CalamityMod.NPCs.SlimeGod if (NPC.ai[2] >= 3f && NPC.velocity.Y == 0f) { + // Avoid cheap bullshit + NPC.damage = 0; + NPC.localAI[2] = NPC.ai[0]; NPC.ai[0] = 0f; NPC.ai[1] = 0f; @@ -521,6 +564,9 @@ namespace CalamityMod.NPCs.SlimeGod } else if (NPC.ai[0] == 3f) { + // Avoid cheap bullshit + NPC.damage = 0; + NPC.noTileCollide = true; NPC.Opacity -= 0.03f; @@ -534,6 +580,9 @@ namespace CalamityMod.NPCs.SlimeGod } else if (NPC.ai[0] == 4f) { + // Avoid cheap bullshit + NPC.damage = setDamage; + if (NPC.velocity.X > 0f) NPC.direction = 1; else @@ -548,6 +597,9 @@ namespace CalamityMod.NPCs.SlimeGod if (Main.netMode != NetmodeID.MultiplayerClient && distanceFromTarget.Length() < 500f && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height) && Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height)) { + // Avoid cheap bullshit + NPC.damage = 0; + NPC.ai[0] = 0f; NPC.ai[1] = 0f; NPC.ai[2] = 0f; @@ -592,7 +644,7 @@ namespace CalamityMod.NPCs.SlimeGod dustColor.A = 150; for (int i = 0; i < 10; i++) { - int crimsonDust = Dust.NewDust(NPC.position + Vector2.UnitX * -20f, NPC.width + 40, NPC.height, 4, NPC.velocity.X, NPC.velocity.Y, NPC.alpha, dustColor, 2f); + int crimsonDust = Dust.NewDust(NPC.position + Vector2.UnitX * -20f, NPC.width + 40, NPC.height, DustID.TintableDust, NPC.velocity.X, NPC.velocity.Y, NPC.alpha, dustColor, 2f); Main.dust[crimsonDust].noGravity = true; Main.dust[crimsonDust].velocity *= 0.5f; } @@ -626,7 +678,7 @@ namespace CalamityMod.NPCs.SlimeGod dustColor.A = 150; for (int i = 0; i < 10; i++) { - int crimsonDust = Dust.NewDust(NPC.position + Vector2.UnitX * -20f, NPC.width + 40, NPC.height, 4, NPC.velocity.X, NPC.velocity.Y, NPC.alpha, dustColor, 2f); + int crimsonDust = Dust.NewDust(NPC.position + Vector2.UnitX * -20f, NPC.width + 40, NPC.height, DustID.TintableDust, NPC.velocity.X, NPC.velocity.Y, NPC.alpha, dustColor, 2f); Main.dust[crimsonDust].noGravity = true; Main.dust[crimsonDust].velocity *= 0.5f; } @@ -662,10 +714,9 @@ namespace CalamityMod.NPCs.SlimeGod int y = (int)(NPC.position.Y + (float)Main.rand.Next(NPC.height - 32)); int slimeType = ModContent.NPCType(); if (Main.rand.NextBool(3)) - { slimeType = ModContent.NPCType(); - } - int slimeSpawn = NPC.NewNPC(NPC.GetSource_FromAI(), x, y, slimeType, 0, 0f, 0f, 0f, 0f, 255); + + int slimeSpawn = NPC.NewNPC(NPC.GetSource_FromAI(), x, y, slimeType); Main.npc[slimeSpawn].SetDefaults(slimeType); Main.npc[slimeSpawn].velocity.X = (float)Main.rand.Next(-15, 16) * 0.1f; Main.npc[slimeSpawn].velocity.Y = (float)Main.rand.Next(-30, 1) * 0.1f; @@ -692,14 +743,12 @@ namespace CalamityMod.NPCs.SlimeGod Color dustColor = Color.Crimson; dustColor.A = 150; for (int k = 0; k < 5; k++) - { Dust.NewDust(NPC.position, NPC.width, NPC.height, 4, hit.HitDirection, -1f, NPC.alpha, dustColor, 1f); - } } public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { - NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); } public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) diff --git a/NPCs/SlimeGod/EbonianPaladin.cs b/NPCs/SlimeGod/EbonianPaladin.cs index 09a2661ab7..6fb4067319 100644 --- a/NPCs/SlimeGod/EbonianPaladin.cs +++ b/NPCs/SlimeGod/EbonianPaladin.cs @@ -1,14 +1,14 @@ -using CalamityMod.Events; +using System; +using System.Collections.Generic; +using System.IO; +using CalamityMod.Events; using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; -using System; -using System.Collections.Generic; -using System.IO; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.NPCs.SlimeGod { @@ -80,11 +80,11 @@ namespace CalamityMod.NPCs.SlimeGod float lifeRatio = NPC.life / (float)NPC.lifeMax; NPC.defense = NPC.defDefense; - NPC.damage = NPC.defDamage; + int setDamage = NPC.defDamage; if (NPC.localAI[1] == 1f) { NPC.defense = NPC.defDefense + 20; - NPC.damage = NPC.defDamage + 22; + setDamage += 22; } float scale = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 0.6f : Main.getGoodWorld ? 0.8f : 1f; @@ -132,10 +132,9 @@ namespace CalamityMod.NPCs.SlimeGod Vector2 spawnAt = NPC.Center + new Vector2(0f, NPC.height / 2f); NPC.NewNPC(NPC.GetSource_FromAI(), (int)spawnAt.X - 30, (int)spawnAt.Y, ModContent.NPCType()); NPC.NewNPC(NPC.GetSource_FromAI(), (int)spawnAt.X + 30, (int)spawnAt.Y, ModContent.NPCType()); - if (Main.zenithWorld && NPC.CountNPCS(ModContent.NPCType()) < 3) // split into 3 slimes if the other large slime hasn't split yet - { + if (Main.zenithWorld && NPC.CountNPCS(ModContent.NPCType()) < 3) // Split into 3 slimes if the other large slime hasn't split yet NPC.NewNPC(NPC.GetSource_FromAI(), (int)spawnAt.X, (int)spawnAt.Y - 30, ModContent.NPCType()); - } + NPC.life = 0; NPC.HitEffect(); NPC.active = false; @@ -148,10 +147,9 @@ namespace CalamityMod.NPCs.SlimeGod if (CalamityGlobalNPC.slimeGodRed != -1) { if (Main.npc[CalamityGlobalNPC.slimeGodRed].active) - { enraged = false; - } } + if (bossRush) { enraged = true; @@ -176,34 +174,43 @@ namespace CalamityMod.NPCs.SlimeGod NPC.netUpdate = true; NPC.TargetClosest(false); player = Main.player[NPC.target]; - Vector2 vectorAimedAheadOfTarget = player.Center + new Vector2((float)Math.Round(player.velocity.X), 0f).SafeNormalize(Vector2.Zero) * 960f; - Point teleportAheadPos = vectorAimedAheadOfTarget.ToTileCoordinates(); - int maxTeleportTries = 0; - while (maxTeleportTries < 100) + + float distanceAhead = 800f; + Vector2 randomDefault = Main.rand.NextBool() ? Vector2.UnitX : -Vector2.UnitX; + Vector2 vectorAimedAheadOfTarget = player.Center + new Vector2((float)Math.Round(player.velocity.X), 0f).SafeNormalize(randomDefault) * distanceAhead; + Point predictiveTeleportPoint = vectorAimedAheadOfTarget.ToTileCoordinates(); + int randomPredictiveTeleportOffset = 5; + int teleportTries = 0; + while (teleportTries < 100) { - maxTeleportTries++; - int teleportPosX = Main.rand.Next(teleportAheadPos.X - 5, teleportAheadPos.X + 6); - int teleportPosY = Main.rand.Next(teleportAheadPos.Y - 5, teleportAheadPos.Y); - if (Main.tile[teleportPosX, teleportPosY].HasUnactuatedTile) - continue; + teleportTries++; + int teleportTileX = Main.rand.Next(predictiveTeleportPoint.X - randomPredictiveTeleportOffset, predictiveTeleportPoint.X + randomPredictiveTeleportOffset + 1); + int teleportTileY = Main.rand.Next(predictiveTeleportPoint.Y - randomPredictiveTeleportOffset, predictiveTeleportPoint.Y); - bool canTeleport = true; - if (canTeleport && Main.tile[teleportPosX, teleportPosY].LiquidType == LiquidID.Lava) - canTeleport = false; - if (canTeleport && !Collision.CanHitLine(NPC.Center, 0, 0, vectorAimedAheadOfTarget, 0, 0)) - canTeleport = false; - - if (canTeleport) + if (!Main.tile[teleportTileX, teleportTileY].HasUnactuatedTile) { - NPC.localAI[0] = teleportPosX * 16 + 8; - NPC.localAI[3] = teleportPosY * 16 + 16; - calamityGlobalNPC.newAI[0] = 0f; - break; + bool canTeleportToTile = true; + if (canTeleportToTile && Main.tile[teleportTileX, teleportTileY].LiquidType == LiquidID.Lava) + canTeleportToTile = false; + if (canTeleportToTile && !Collision.CanHitLine(NPC.Center, 0, 0, predictiveTeleportPoint.ToVector2() * 16, 0, 0)) + canTeleportToTile = false; + + if (canTeleportToTile) + { + NPC.localAI[0] = teleportTileX * 16 + 8; + NPC.localAI[3] = teleportTileY * 16 + 16; + calamityGlobalNPC.newAI[0] = 0f; + break; + } + else + predictiveTeleportPoint.X += predictiveTeleportPoint.X < 0f ? 1 : -1; } + else + predictiveTeleportPoint.X += predictiveTeleportPoint.X < 0f ? 1 : -1; } // Default teleport if the above conditions aren't met in 100 iterations - if (maxTeleportTries >= 100) + if (teleportTries >= 100) { Vector2 bottom = Main.player[Player.FindClosest(NPC.position, NPC.width, NPC.height)].Bottom; NPC.localAI[0] = bottom.X; @@ -229,6 +236,9 @@ namespace CalamityMod.NPCs.SlimeGod bool phaseThroughTilesToReachTarget = Vector2.Distance(player.Center, NPC.Center) > 2400f || !Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height); if (Main.netMode != NetmodeID.MultiplayerClient && phaseThroughTilesToReachTarget) { + // Set damage + NPC.damage = setDamage; + NPC.ai[0] = 5f; NPC.ai[1] = 0f; NPC.ai[2] = 0f; @@ -238,6 +248,9 @@ namespace CalamityMod.NPCs.SlimeGod if (NPC.velocity.Y == 0f) { + // Avoid cheap bullshit + NPC.damage = 0; + NPC.TargetClosest(); NPC.velocity.X *= 0.8f; NPC.ai[1] += hyperMode ? 2f : 1f; @@ -266,6 +279,9 @@ namespace CalamityMod.NPCs.SlimeGod if (NPC.ai[1] > jumpGateValue) { + // Set damage + NPC.damage = setDamage; + NPC.ai[3] += 1f; if (NPC.ai[3] >= 2f) { @@ -284,6 +300,9 @@ namespace CalamityMod.NPCs.SlimeGod } else { + // Set damage + NPC.damage = setDamage; + NPC.velocity.X *= 0.99f; if (NPC.direction < 0 && NPC.velocity.X > -1f) NPC.velocity.X = -1f; @@ -307,6 +326,9 @@ namespace CalamityMod.NPCs.SlimeGod if (NPC.velocity.Y == 0f) { + // Avoid cheap bullshit + NPC.damage = 0; + float phaseSwitchGateValue = 420f; bool switchPhase = NPC.ai[2] >= phaseSwitchGateValue; if (switchPhase) @@ -331,6 +353,9 @@ namespace CalamityMod.NPCs.SlimeGod if (NPC.ai[0] == 2f) { + // Set damage + NPC.damage = setDamage; + NPC.noTileCollide = true; NPC.velocity.Y = death ? -9f : revenge ? -8f : expertMode ? -7f : -6f; } @@ -347,11 +372,39 @@ namespace CalamityMod.NPCs.SlimeGod } else if (NPC.ai[0] == 1f) { + // Avoid cheap bullshit + NPC.damage = 0; + NPC.velocity.X *= 0.85f; NPC.ai[1] += 1f; if (NPC.ai[1] >= 30f) { + if (revenge) + { + float slimeShotVelocity = 6f; + Vector2 projectileVelocity = (player.Center - NPC.Center).SafeNormalize(Vector2.UnitY) * slimeShotVelocity; + float minFiringDistance = 160f; // 10 tile distance + if (Vector2.Distance(NPC.Center, player.Center) > minFiringDistance) + { + SoundEngine.PlaySound(SlimeGodCore.BigShotSound, NPC.Center); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + int numProj = death ? 6 : 4; + int spread = death ? 15 : 10; + float rotation = MathHelper.ToRadians(spread); + for (int j = 0; j < numProj; j++) + { + Vector2 randomVelocity = Main.rand.NextVector2CircularEdge(3f, 3f); + Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, j / (float)(numProj - 1))) + randomVelocity; + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 30f * NPC.scale, perturbedSpeed, type, damage, 0f, Main.myPlayer); + } + } + } + } + NPC.localAI[2] = NPC.ai[0]; NPC.ai[0] = 0f; NPC.ai[1] = 0f; @@ -360,6 +413,9 @@ namespace CalamityMod.NPCs.SlimeGod } else if (NPC.ai[0] == 2f) { + // Avoid cheap bullshit + NPC.damage = 0; + NPC.noTileCollide = true; NPC.noGravity = true; @@ -406,6 +462,9 @@ namespace CalamityMod.NPCs.SlimeGod } else if (NPC.ai[0] == 2.1f) { + // Set damage + NPC.damage = setDamage; + bool atTargetPosition = NPC.position.Y + NPC.height >= player.position.Y; if (NPC.ai[2] == 0f && atTargetPosition && Collision.CanHit(NPC.Center, 1, 1, player.Center, 1, 1) && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) { @@ -415,6 +474,9 @@ namespace CalamityMod.NPCs.SlimeGod if (atTargetPosition || NPC.velocity.Y <= 0f) { + // Avoid cheap bullshit + NPC.damage = 0; + NPC.ai[1] += 1f; if (NPC.ai[1] > 10f) { @@ -482,12 +544,18 @@ namespace CalamityMod.NPCs.SlimeGod { if (NPC.velocity.Y == 0f) { + // Avoid cheap bullshit + NPC.damage = 0; + NPC.TargetClosest(); NPC.velocity.X *= 0.8f; NPC.ai[1] += 1f; if (NPC.ai[1] > 15f) { + // Set damage + NPC.damage = setDamage; + NPC.ai[1] = 0f; NPC.velocity.Y -= 6f; @@ -514,6 +582,9 @@ namespace CalamityMod.NPCs.SlimeGod } else { + // Set damage + NPC.damage = setDamage; + NPC.velocity.X *= 0.98f; float velocityLimit = (death ? 6.5f : revenge ? 6f : expertMode ? 5.5f : 5f); if (NPC.direction < 0 && NPC.velocity.X > -velocityLimit) @@ -524,6 +595,9 @@ namespace CalamityMod.NPCs.SlimeGod if (NPC.ai[2] >= 2f && NPC.velocity.Y == 0f) { + // Avoid cheap bullshit + NPC.damage = 0; + NPC.localAI[2] = NPC.ai[0]; NPC.ai[0] = 0f; NPC.ai[1] = 0f; @@ -534,6 +608,9 @@ namespace CalamityMod.NPCs.SlimeGod } else if (NPC.ai[0] == 4f) { + // Avoid cheap bullshit + NPC.damage = 0; + NPC.noTileCollide = true; NPC.Opacity -= 0.03f; @@ -547,6 +624,9 @@ namespace CalamityMod.NPCs.SlimeGod } else if (NPC.ai[0] == 5f) { + // Set damage + NPC.damage = setDamage; + if (NPC.velocity.X > 0f) NPC.direction = 1; else @@ -561,6 +641,9 @@ namespace CalamityMod.NPCs.SlimeGod if (Main.netMode != NetmodeID.MultiplayerClient && distanceFromTarget.Length() < 500f && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height) && Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height)) { + // Avoid cheap bullshit + NPC.damage = 0; + NPC.ai[0] = 0f; NPC.ai[1] = 0f; NPC.ai[2] = 0f; @@ -605,7 +688,7 @@ namespace CalamityMod.NPCs.SlimeGod dustColor.A = 150; for (int i = 0; i < 10; i++) { - int corruptDust = Dust.NewDust(NPC.position + Vector2.UnitX * -20f, NPC.width + 40, NPC.height, 4, NPC.velocity.X, NPC.velocity.Y, NPC.alpha, dustColor, 2f); + int corruptDust = Dust.NewDust(NPC.position + Vector2.UnitX * -20f, NPC.width + 40, NPC.height, DustID.TintableDust, NPC.velocity.X, NPC.velocity.Y, NPC.alpha, dustColor, 2f); Main.dust[corruptDust].noGravity = true; Main.dust[corruptDust].velocity *= 0.5f; } @@ -639,7 +722,7 @@ namespace CalamityMod.NPCs.SlimeGod dustColor.A = 150; for (int i = 0; i < 10; i++) { - int corruptDust = Dust.NewDust(NPC.position + Vector2.UnitX * -20f, NPC.width + 40, NPC.height, 4, NPC.velocity.X, NPC.velocity.Y, NPC.alpha, dustColor, 2f); + int corruptDust = Dust.NewDust(NPC.position + Vector2.UnitX * -20f, NPC.width + 40, NPC.height, DustID.TintableDust, NPC.velocity.X, NPC.velocity.Y, NPC.alpha, dustColor, 2f); Main.dust[corruptDust].noGravity = true; Main.dust[corruptDust].velocity *= 0.5f; } @@ -677,7 +760,7 @@ namespace CalamityMod.NPCs.SlimeGod int x = (int)(NPC.position.X + (float)Main.rand.Next(NPC.width - 32)); int y = (int)(NPC.position.Y + (float)Main.rand.Next(NPC.height - 32)); int slimeType = ModContent.NPCType(); - int slimeSpawn = NPC.NewNPC(NPC.GetSource_FromAI(), x, y, slimeType, 0, 0f, 0f, 0f, 0f, 255); + int slimeSpawn = NPC.NewNPC(NPC.GetSource_FromAI(), x, y, slimeType); Main.npc[slimeSpawn].SetDefaults(slimeType); Main.npc[slimeSpawn].velocity.X = (float)Main.rand.Next(-15, 16) * 0.1f; Main.npc[slimeSpawn].velocity.Y = (float)Main.rand.Next(-30, 1) * 0.1f; @@ -706,13 +789,13 @@ namespace CalamityMod.NPCs.SlimeGod dustColor.A = 150; for (int k = 0; k < 5; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 4, hit.HitDirection, -1f, NPC.alpha, dustColor, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, hit.HitDirection, -1f, NPC.alpha, dustColor, 1f); } } public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { - NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); } public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) diff --git a/NPCs/SlimeGod/SlimeGodCore.cs b/NPCs/SlimeGod/SlimeGodCore.cs index ca478c3440..d208410b88 100644 --- a/NPCs/SlimeGod/SlimeGodCore.cs +++ b/NPCs/SlimeGod/SlimeGodCore.cs @@ -1,4 +1,8 @@ -using CalamityMod.CalPlayer; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using CalamityMod.CalPlayer; using CalamityMod.Events; using CalamityMod.Items.Accessories; using CalamityMod.Items.Armor.Vanity; @@ -18,17 +22,14 @@ using CalamityMod.UI.VanillaBossBars; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; +using ReLogic.Content; using Terraria; +using Terraria.Audio; using Terraria.GameContent; using Terraria.GameContent.Bestiary; +using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using Terraria.GameContent.ItemDropRules; -using System.Collections.Generic; -using System.Linq; namespace CalamityMod.NPCs.SlimeGod { @@ -43,10 +44,16 @@ namespace CalamityMod.NPCs.SlimeGod public static readonly SoundStyle ShotSound = new("CalamityMod/Sounds/Custom/SlimeGodShot", 2); public static readonly SoundStyle BigShotSound = new("CalamityMod/Sounds/Custom/SlimeGodBigShot", 2); + public static Asset EyeTexture; + public override void SetStaticDefaults() { NPCID.Sets.BossBestiaryPriority.Add(Type); - NPCID.Sets.MPAllowedEnemies[Type] = true; + NPCID.Sets.MPAllowedEnemies[Type] = true; + if (!Main.dedServ) + { + EyeTexture = ModContent.Request("CalamityMod/NPCs/SlimeGod/SlimeGodEyes", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -83,11 +90,11 @@ namespace CalamityMod.NPCs.SlimeGod public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.TheCorruption, BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.TheCrimson, - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.SlimeGodCore") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.SlimeGodCore") }); } @@ -135,9 +142,6 @@ namespace CalamityMod.NPCs.SlimeGod NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType()); } - // Set damage - NPC.damage = NPC.defDamage; - // Enrage based on large slimes bool purpleSlimeAlive = false; bool redSlimeAlive = false; @@ -180,6 +184,9 @@ namespace CalamityMod.NPCs.SlimeGod // Vanish phase if (!purpleSlimeAlive && !redSlimeAlive) { + // Avoid cheap bullshit + NPC.damage = 0; + // Make sure Opacity is set to 0.8f if it's below that when the vanish phase starts if (NPC.ai[3] == 0f) { @@ -197,7 +204,7 @@ namespace CalamityMod.NPCs.SlimeGod { Color color = Main.rand.NextBool() ? Color.Lavender : Color.Crimson; color.A = 150; - Dust.NewDust(NPC.position, NPC.width, NPC.height, 4, 0f, 0f, NPC.alpha, color, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, 0f, 0f, NPC.alpha, color, 1f); } } @@ -225,7 +232,7 @@ namespace CalamityMod.NPCs.SlimeGod { Color color = Main.rand.NextBool() ? Color.Lavender : Color.Crimson; color.A = 150; - int slimyDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 4, 0f, 0f, NPC.alpha, color, 2f); + int slimyDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, 0f, 0f, NPC.alpha, color, 2f); Main.dust[slimyDust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -237,10 +244,10 @@ namespace CalamityMod.NPCs.SlimeGod { Color color = Main.rand.NextBool() ? Color.Lavender : Color.Crimson; color.A = 150; - int slimyDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 4, 0f, 0f, NPC.alpha, color, 3f); + int slimyDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, 0f, 0f, NPC.alpha, color, 3f); Main.dust[slimyDust2].noGravity = true; Main.dust[slimyDust2].velocity *= 5f; - slimyDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 4, 0f, 0f, NPC.alpha, color, 2f); + slimyDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, 0f, 0f, NPC.alpha, color, 2f); Main.dust[slimyDust2].velocity *= 2f; } @@ -365,7 +372,7 @@ namespace CalamityMod.NPCs.SlimeGod { Color color = Main.rand.NextBool() ? Color.Lavender : Color.Crimson; color.A = 150; - int dust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 4, 0f, 0f, NPC.alpha, color, 2f); + int dust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, 0f, 0f, NPC.alpha, color, 2f); Main.dust[dust2].velocity *= 3f; if (Main.rand.NextBool()) { @@ -377,17 +384,21 @@ namespace CalamityMod.NPCs.SlimeGod { Color color = Main.rand.NextBool() ? Color.Lavender : Color.Crimson; color.A = 150; - int dust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 4, 0f, 0f, NPC.alpha, color, 3f); + int dust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, 0f, 0f, NPC.alpha, color, 3f); Main.dust[dust2].noGravity = true; Main.dust[dust2].velocity *= 5f; - dust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 4, 0f, 0f, NPC.alpha, color, 2f); + dust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, 0f, 0f, NPC.alpha, color, 2f); Main.dust[dust2].velocity *= 2f; } } return; } - else if (expertMode) + + // Avoid cheap bullshit + NPC.damage = 0; + + if (expertMode) { float divisor = bossRush ? 90f : death ? 180f : revenge ? 240f : 300f; if (phase2) @@ -421,7 +432,7 @@ namespace CalamityMod.NPCs.SlimeGod NPC.Opacity += 0.2f; if (NPC.Opacity > 0.8f) NPC.Opacity = 0.8f; - + buffedSlime = 0; float flySpeed = death ? 15f : revenge ? 13.5f : expertMode ? 12f : 9f; @@ -441,6 +452,9 @@ namespace CalamityMod.NPCs.SlimeGod NPC.ai[0] -= 1f; if (distanceFromFlyDestination < 200f || NPC.ai[0] > 0f) { + // Set damage + NPC.damage = NPC.defDamage; + if (distanceFromFlyDestination < 200f) NPC.ai[0] = 20f; @@ -542,7 +556,7 @@ namespace CalamityMod.NPCs.SlimeGod Color drawColorAlpha = NPC.GetAlpha(drawColor); Color colorLightingArea = Lighting.GetColor((int)((double)NPC.position.X + (double)NPC.width * 0.5) / 16, (int)(((double)NPC.position.Y + (double)NPC.height * 0.5) / 16.0)); Texture2D texture2D3 = TextureAssets.Npc[NPC.type].Value; - Texture2D pog = ModContent.Request("CalamityMod/NPCs/SlimeGod/SlimeGodEyes").Value; + Texture2D pog = EyeTexture.Value; int frameTexture = TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type]; int y3 = frameTexture * (int)NPC.frameCounter; Rectangle rectangle = new Rectangle(0, y3, texture2D3.Width, frameTexture); @@ -561,10 +575,10 @@ namespace CalamityMod.NPCs.SlimeGod { goto IL_6899; } - IL_6881: +IL_6881: coreID += twoConst; continue; - IL_6899: +IL_6899: float trailLengthMult = (float)(8 - coreID); if (twoConst < 0) { @@ -647,7 +661,7 @@ namespace CalamityMod.NPCs.SlimeGod { Color color = Main.rand.NextBool() ? Color.Lavender : Color.Crimson; color.A = 150; - Dust.NewDust(NPC.position, NPC.width, NPC.height, 4, hit.HitDirection, -1f, NPC.alpha, color, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, hit.HitDirection, -1f, NPC.alpha, color, 1f); } } @@ -659,7 +673,7 @@ namespace CalamityMod.NPCs.SlimeGod target.AddBuff(debufftype, 180, true); target.AddBuff(BuffID.Weak, 180, true); target.AddBuff(BuffID.Darkness, 180, true); - } + } } } } diff --git a/NPCs/SlimeGod/SplitCrimulanPaladin.cs b/NPCs/SlimeGod/SplitCrimulanPaladin.cs index 344477b686..40504fa27a 100644 --- a/NPCs/SlimeGod/SplitCrimulanPaladin.cs +++ b/NPCs/SlimeGod/SplitCrimulanPaladin.cs @@ -1,10 +1,10 @@ -using CalamityMod.Events; +using System; +using System.Collections.Generic; +using System.IO; +using CalamityMod.Events; using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; -using System; -using System.Collections.Generic; -using System.IO; using Terraria; using Terraria.Audio; using Terraria.GameContent.Bestiary; @@ -22,7 +22,7 @@ namespace CalamityMod.NPCs.SlimeGod { Main.npcFrameCount[NPC.type] = 6; NPCID.Sets.BossBestiaryPriority.Add(Type); - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { Scale = 0.6f, PortraitScale = 1f, @@ -61,11 +61,11 @@ namespace CalamityMod.NPCs.SlimeGod public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.TheCorruption, BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.TheCrimson, - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.SlimeGodPaladin") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.SlimeGodPaladin") }); } @@ -98,11 +98,11 @@ namespace CalamityMod.NPCs.SlimeGod float lifeRatio = NPC.life / (float)NPC.lifeMax; NPC.defense = NPC.defDefense; - NPC.damage = NPC.defDamage; + int setDamage = NPC.defDamage; if (NPC.localAI[1] == 1f) { NPC.defense = NPC.defDefense + 20; - NPC.damage = NPC.defDamage + 22; + setDamage += 22; } float scale = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 0.6f : Main.getGoodWorld ? 0.8f : 1f; @@ -140,14 +140,11 @@ namespace CalamityMod.NPCs.SlimeGod if (CalamityGlobalNPC.slimeGodPurple != -1) { if (Main.npc[CalamityGlobalNPC.slimeGodPurple].active) - { enraged = false; - } } + if (bossRush) - { enraged = true; - } if (NPC.localAI[1] != 1f) { @@ -173,34 +170,43 @@ namespace CalamityMod.NPCs.SlimeGod NPC.netUpdate = true; NPC.TargetClosest(false); player = Main.player[NPC.target]; - Vector2 vectorAimedAheadOfTarget = player.Center + new Vector2((float)Math.Round(player.velocity.X), 0f).SafeNormalize(Vector2.Zero) * 1120f; - Point teleportAheadPos = vectorAimedAheadOfTarget.ToTileCoordinates(); - int maxTeleportTries = 0; - while (maxTeleportTries < 100) + + float distanceAhead = 960f; + Vector2 randomDefault = Main.rand.NextBool() ? Vector2.UnitX : -Vector2.UnitX; + Vector2 vectorAimedAheadOfTarget = player.Center + new Vector2((float)Math.Round(player.velocity.X), 0f).SafeNormalize(randomDefault) * distanceAhead; + Point predictiveTeleportPoint = vectorAimedAheadOfTarget.ToTileCoordinates(); + int randomPredictiveTeleportOffset = 5; + int teleportTries = 0; + while (teleportTries < 100) { - maxTeleportTries++; - int teleportPosX = Main.rand.Next(teleportAheadPos.X - 5, teleportAheadPos.X + 6); - int teleportPosY = Main.rand.Next(teleportAheadPos.Y - 5, teleportAheadPos.Y); - if (Main.tile[teleportPosX, teleportPosY].HasUnactuatedTile) - continue; + teleportTries++; + int teleportTileX = Main.rand.Next(predictiveTeleportPoint.X - randomPredictiveTeleportOffset, predictiveTeleportPoint.X + randomPredictiveTeleportOffset + 1); + int teleportTileY = Main.rand.Next(predictiveTeleportPoint.Y - randomPredictiveTeleportOffset, predictiveTeleportPoint.Y); - bool canTeleport = true; - if (canTeleport && Main.tile[teleportPosX, teleportPosY].LiquidType == LiquidID.Lava) - canTeleport = false; - if (canTeleport && !Collision.CanHitLine(NPC.Center, 0, 0, vectorAimedAheadOfTarget, 0, 0)) - canTeleport = false; - - if (canTeleport) + if (!Main.tile[teleportTileX, teleportTileY].HasUnactuatedTile) { - NPC.localAI[0] = teleportPosX * 16 + 8; - NPC.localAI[3] = teleportPosY * 16 + 16; - NPC.ai[3] = 0f; - break; + bool canTeleportToTile = true; + if (canTeleportToTile && Main.tile[teleportTileX, teleportTileY].LiquidType == LiquidID.Lava) + canTeleportToTile = false; + if (canTeleportToTile && !Collision.CanHitLine(NPC.Center, 0, 0, predictiveTeleportPoint.ToVector2() * 16, 0, 0)) + canTeleportToTile = false; + + if (canTeleportToTile) + { + NPC.localAI[0] = teleportTileX * 16 + 8; + NPC.localAI[3] = teleportTileY * 16 + 16; + NPC.ai[3] = 0f; + break; + } + else + predictiveTeleportPoint.X += predictiveTeleportPoint.X < 0f ? 1 : -1; } + else + predictiveTeleportPoint.X += predictiveTeleportPoint.X < 0f ? 1 : -1; } // Default teleport if the above conditions aren't met in 100 iterations - if (maxTeleportTries >= 100) + if (teleportTries >= 100) { Vector2 bottom = Main.player[Player.FindClosest(NPC.position, NPC.width, NPC.height)].Bottom; NPC.localAI[0] = bottom.X; @@ -227,6 +233,9 @@ namespace CalamityMod.NPCs.SlimeGod bool phaseThroughTilesToReachTarget = Vector2.Distance(player.Center, NPC.Center) > 2400f || !Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height); if (Main.netMode != NetmodeID.MultiplayerClient && phaseThroughTilesToReachTarget) { + // Set damage + NPC.damage = setDamage; + NPC.ai[0] = 4f; NPC.ai[1] = 0f; NPC.ai[2] = 0f; @@ -235,6 +244,9 @@ namespace CalamityMod.NPCs.SlimeGod if (NPC.velocity.Y == 0f) { + // Avoid cheap bullshit + NPC.damage = 0; + NPC.TargetClosest(); NPC.velocity.X *= 0.8f; NPC.ai[1] += 1f; @@ -263,6 +275,9 @@ namespace CalamityMod.NPCs.SlimeGod if (NPC.ai[1] > jumpGateValue) { + // Set damage + NPC.damage = setDamage; + velocityX *= 1.25f; NPC.ai[1] = 0f; NPC.velocity.Y -= velocityY * speedMult; @@ -275,6 +290,9 @@ namespace CalamityMod.NPCs.SlimeGod } else { + // Set damage + NPC.damage = setDamage; + NPC.velocity.X *= 0.99f; if (NPC.direction < 0 && NPC.velocity.X > -1f) NPC.velocity.X = -1f; @@ -298,6 +316,9 @@ namespace CalamityMod.NPCs.SlimeGod if (NPC.velocity.Y == 0f) { + // Avoid cheap bullshit + NPC.damage = 0; + float phaseSwitchGateValue = 180f; bool switchPhase = NPC.ai[2] >= phaseSwitchGateValue; if (switchPhase) @@ -318,6 +339,9 @@ namespace CalamityMod.NPCs.SlimeGod if (NPC.ai[0] == 1f) { + // Set damage + NPC.damage = setDamage; + NPC.noTileCollide = true; NPC.velocity.Y = death ? -11f : revenge ? -10f : expertMode ? -9f : -8f; } @@ -333,6 +357,9 @@ namespace CalamityMod.NPCs.SlimeGod } else if (NPC.ai[0] == 1f) { + // Avoid cheap bullshit + NPC.damage = 0; + NPC.noTileCollide = true; NPC.noGravity = true; @@ -379,6 +406,9 @@ namespace CalamityMod.NPCs.SlimeGod } else if (NPC.ai[0] == 1.1f) { + // Set damage + NPC.damage = setDamage; + bool atTargetPosition = NPC.position.Y + NPC.height >= player.position.Y; if (NPC.ai[2] == 0f && (atTargetPosition || NPC.localAI[1] == 0f) && Collision.CanHit(NPC.Center, 1, 1, player.Center, 1, 1) && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) { @@ -388,6 +418,9 @@ namespace CalamityMod.NPCs.SlimeGod if (atTargetPosition || NPC.velocity.Y <= 0f) { + // Avoid cheap bullshit + NPC.damage = 0; + NPC.ai[1] += 1f; if (NPC.ai[1] > 10f) { @@ -450,12 +483,18 @@ namespace CalamityMod.NPCs.SlimeGod { if (NPC.velocity.Y == 0f) { + // Avoid cheap bullshit + NPC.damage = 0; + NPC.TargetClosest(); NPC.velocity.X *= 0.8f; NPC.ai[1] += 1f; if (NPC.ai[1] > 15f) { + // Set damage + NPC.damage = setDamage; + NPC.ai[1] = 0f; NPC.velocity.Y -= 3f; @@ -482,6 +521,9 @@ namespace CalamityMod.NPCs.SlimeGod } else { + // Set damage + NPC.damage = setDamage; + NPC.velocity.X *= 0.98f; float velocityLimit = (death ? 5.5f : revenge ? 5f : expertMode ? 4.5f : 4f); if (NPC.direction < 0 && NPC.velocity.X > -velocityLimit) @@ -492,6 +534,9 @@ namespace CalamityMod.NPCs.SlimeGod if (NPC.ai[2] >= 3f && NPC.velocity.Y == 0f) { + // Avoid cheap bullshit + NPC.damage = 0; + NPC.localAI[2] = NPC.ai[0]; NPC.ai[0] = 0f; NPC.ai[1] = 0f; @@ -501,6 +546,9 @@ namespace CalamityMod.NPCs.SlimeGod } else if (NPC.ai[0] == 3f) { + // Avoid cheap bullshit + NPC.damage = 0; + NPC.noTileCollide = true; NPC.Opacity -= 0.03f; @@ -514,6 +562,9 @@ namespace CalamityMod.NPCs.SlimeGod } else if (NPC.ai[0] == 4f) { + // Set damage + NPC.damage = setDamage; + if (NPC.velocity.X > 0f) NPC.direction = 1; else @@ -528,6 +579,9 @@ namespace CalamityMod.NPCs.SlimeGod if (Main.netMode != NetmodeID.MultiplayerClient && distanceFromTarget.Length() < 500f && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height) && Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height)) { + // Avoid cheap bullshit + NPC.damage = 0; + NPC.ai[0] = 0f; NPC.ai[1] = 0f; NPC.ai[2] = 0f; @@ -571,7 +625,7 @@ namespace CalamityMod.NPCs.SlimeGod dustColor.A = 150; for (int i = 0; i < 10; i++) { - int crimsonDust = Dust.NewDust(NPC.position + Vector2.UnitX * -20f, NPC.width + 40, NPC.height, 4, NPC.velocity.X, NPC.velocity.Y, NPC.alpha, dustColor, 2f); + int crimsonDust = Dust.NewDust(NPC.position + Vector2.UnitX * -20f, NPC.width + 40, NPC.height, DustID.TintableDust, NPC.velocity.X, NPC.velocity.Y, NPC.alpha, dustColor, 2f); Main.dust[crimsonDust].noGravity = true; Main.dust[crimsonDust].velocity *= 0.5f; } @@ -605,7 +659,7 @@ namespace CalamityMod.NPCs.SlimeGod dustColor.A = 150; for (int i = 0; i < 10; i++) { - int crimsonDust = Dust.NewDust(NPC.position + Vector2.UnitX * -20f, NPC.width + 40, NPC.height, 4, NPC.velocity.X, NPC.velocity.Y, NPC.alpha, dustColor, 2f); + int crimsonDust = Dust.NewDust(NPC.position + Vector2.UnitX * -20f, NPC.width + 40, NPC.height, DustID.TintableDust, NPC.velocity.X, NPC.velocity.Y, NPC.alpha, dustColor, 2f); Main.dust[crimsonDust].noGravity = true; Main.dust[crimsonDust].velocity *= 0.5f; } @@ -641,10 +695,9 @@ namespace CalamityMod.NPCs.SlimeGod int y = (int)(NPC.position.Y + (float)Main.rand.Next(NPC.height - 32)); int slimeType = ModContent.NPCType(); if (Main.rand.NextBool(3)) - { slimeType = ModContent.NPCType(); - } - int slimeSpawn = NPC.NewNPC(NPC.GetSource_FromAI(), x, y, slimeType, 0, 0f, 0f, 0f, 0f, 255); + + int slimeSpawn = NPC.NewNPC(NPC.GetSource_FromAI(), x, y, slimeType); Main.npc[slimeSpawn].SetDefaults(slimeType); Main.npc[slimeSpawn].velocity.X = (float)Main.rand.Next(-15, 16) * 0.1f; Main.npc[slimeSpawn].velocity.Y = (float)Main.rand.Next(-30, 1) * 0.1f; @@ -685,7 +738,7 @@ namespace CalamityMod.NPCs.SlimeGod dustColor.A = 150; for (int k = 0; k < 5; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 4, hit.HitDirection, -1f, NPC.alpha, dustColor, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, hit.HitDirection, -1f, NPC.alpha, dustColor, 1f); } if (NPC.life <= 0) { @@ -697,7 +750,7 @@ namespace CalamityMod.NPCs.SlimeGod NPC.position.Y = NPC.position.Y - (float)(NPC.height / 2); for (int i = 0; i < 40; i++) { - int crimDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 4, 0f, 0f, NPC.alpha, dustColor, 2f); + int crimDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, 0f, 0f, NPC.alpha, dustColor, 2f); Main.dust[crimDust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -707,10 +760,10 @@ namespace CalamityMod.NPCs.SlimeGod } for (int j = 0; j < 70; j++) { - int crimDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 4, 0f, 0f, NPC.alpha, dustColor, 3f); + int crimDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, 0f, 0f, NPC.alpha, dustColor, 3f); Main.dust[crimDust2].noGravity = true; Main.dust[crimDust2].velocity *= 5f; - crimDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 4, 0f, 0f, NPC.alpha, dustColor, 2f); + crimDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, 0f, 0f, NPC.alpha, dustColor, 2f); Main.dust[crimDust2].velocity *= 2f; } } @@ -718,7 +771,7 @@ namespace CalamityMod.NPCs.SlimeGod public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { - NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); } public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) diff --git a/NPCs/SlimeGod/SplitEbonianPaladin.cs b/NPCs/SlimeGod/SplitEbonianPaladin.cs index 80772fbe31..439b06b21e 100644 --- a/NPCs/SlimeGod/SplitEbonianPaladin.cs +++ b/NPCs/SlimeGod/SplitEbonianPaladin.cs @@ -1,10 +1,10 @@ -using CalamityMod.Events; +using System; +using System.Collections.Generic; +using System.IO; +using CalamityMod.Events; using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; -using System; -using System.Collections.Generic; -using System.IO; using Terraria; using Terraria.Audio; using Terraria.GameContent.Bestiary; @@ -22,7 +22,7 @@ namespace CalamityMod.NPCs.SlimeGod { Main.npcFrameCount[NPC.type] = 6; NPCID.Sets.BossBestiaryPriority.Add(Type); - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { Scale = 0.6f, PortraitScale = 1f, @@ -61,11 +61,11 @@ namespace CalamityMod.NPCs.SlimeGod public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.TheCorruption, BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.TheCrimson, - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.SlimeGodPaladin") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.SlimeGodPaladin") }); } @@ -98,11 +98,11 @@ namespace CalamityMod.NPCs.SlimeGod float lifeRatio = NPC.life / (float)NPC.lifeMax; NPC.defense = NPC.defDefense; - NPC.damage = NPC.defDamage; + int setDamage = NPC.defDamage; if (NPC.localAI[1] == 1f) { NPC.defense = NPC.defDefense + 16; - NPC.damage = NPC.defDamage + 20; + setDamage += 20; } float scale = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 0.6f : Main.getGoodWorld ? 0.8f : 1f; @@ -141,10 +141,9 @@ namespace CalamityMod.NPCs.SlimeGod if (CalamityGlobalNPC.slimeGodRed != -1) { if (Main.npc[CalamityGlobalNPC.slimeGodRed].active) - { enraged = false; - } } + if (bossRush) { enraged = true; @@ -169,34 +168,43 @@ namespace CalamityMod.NPCs.SlimeGod NPC.netUpdate = true; NPC.TargetClosest(false); player = Main.player[NPC.target]; - Vector2 vectorAimedAheadOfTarget = player.Center + new Vector2((float)Math.Round(player.velocity.X), 0f).SafeNormalize(Vector2.Zero) * 1120f; - Point teleportAheadPos = vectorAimedAheadOfTarget.ToTileCoordinates(); - int maxTeleportTries = 0; - while (maxTeleportTries < 100) + + float distanceAhead = 960f; + Vector2 randomDefault = Main.rand.NextBool() ? Vector2.UnitX : -Vector2.UnitX; + Vector2 vectorAimedAheadOfTarget = player.Center + new Vector2((float)Math.Round(player.velocity.X), 0f).SafeNormalize(randomDefault) * distanceAhead; + Point predictiveTeleportPoint = vectorAimedAheadOfTarget.ToTileCoordinates(); + int randomPredictiveTeleportOffset = 5; + int teleportTries = 0; + while (teleportTries < 100) { - maxTeleportTries++; - int teleportPosX = Main.rand.Next(teleportAheadPos.X - 5, teleportAheadPos.X + 6); - int teleportPosY = Main.rand.Next(teleportAheadPos.Y - 5, teleportAheadPos.Y); - if (Main.tile[teleportPosX, teleportPosY].HasUnactuatedTile) - continue; + teleportTries++; + int teleportTileX = Main.rand.Next(predictiveTeleportPoint.X - randomPredictiveTeleportOffset, predictiveTeleportPoint.X + randomPredictiveTeleportOffset + 1); + int teleportTileY = Main.rand.Next(predictiveTeleportPoint.Y - randomPredictiveTeleportOffset, predictiveTeleportPoint.Y); - bool canTeleport = true; - if (canTeleport && Main.tile[teleportPosX, teleportPosY].LiquidType == LiquidID.Lava) - canTeleport = false; - if (canTeleport && !Collision.CanHitLine(NPC.Center, 0, 0, vectorAimedAheadOfTarget, 0, 0)) - canTeleport = false; - - if (canTeleport) + if (!Main.tile[teleportTileX, teleportTileY].HasUnactuatedTile) { - NPC.localAI[0] = teleportPosX * 16 + 8; - NPC.localAI[3] = teleportPosY * 16 + 16; - NPC.ai[3] = 0f; - break; + bool canTeleportToTile = true; + if (canTeleportToTile && Main.tile[teleportTileX, teleportTileY].LiquidType == LiquidID.Lava) + canTeleportToTile = false; + if (canTeleportToTile && !Collision.CanHitLine(NPC.Center, 0, 0, predictiveTeleportPoint.ToVector2() * 16, 0, 0)) + canTeleportToTile = false; + + if (canTeleportToTile) + { + NPC.localAI[0] = teleportTileX * 16 + 8; + NPC.localAI[3] = teleportTileY * 16 + 16; + NPC.ai[3] = 0f; + break; + } + else + predictiveTeleportPoint.X += predictiveTeleportPoint.X < 0f ? 1 : -1; } + else + predictiveTeleportPoint.X += predictiveTeleportPoint.X < 0f ? 1 : -1; } // Default teleport if the above conditions aren't met in 100 iterations - if (maxTeleportTries >= 100) + if (teleportTries >= 100) { Vector2 bottom = Main.player[Player.FindClosest(NPC.position, NPC.width, NPC.height)].Bottom; NPC.localAI[0] = bottom.X; @@ -223,6 +231,9 @@ namespace CalamityMod.NPCs.SlimeGod bool phaseThroughTilesToReachTarget = Vector2.Distance(player.Center, NPC.Center) > 2400f || !Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height); if (Main.netMode != NetmodeID.MultiplayerClient && phaseThroughTilesToReachTarget) { + // Set damage + NPC.damage = setDamage; + NPC.ai[0] = 5f; NPC.ai[1] = 0f; NPC.ai[2] = 0f; @@ -231,6 +242,9 @@ namespace CalamityMod.NPCs.SlimeGod if (NPC.velocity.Y == 0f) { + // Avoid cheap bullshit + NPC.damage = 0; + NPC.TargetClosest(); NPC.velocity.X *= 0.8f; NPC.ai[1] += hyperMode ? 2f : 1f; @@ -259,6 +273,9 @@ namespace CalamityMod.NPCs.SlimeGod if (NPC.ai[1] > jumpGateValue) { + // Set damage + NPC.damage = setDamage; + velocityY *= 1.25f; NPC.ai[1] = 0f; NPC.velocity.Y -= velocityY * speedMult; @@ -271,6 +288,9 @@ namespace CalamityMod.NPCs.SlimeGod } else { + // Set damage + NPC.damage = setDamage; + NPC.velocity.X *= 0.99f; if (NPC.direction < 0 && NPC.velocity.X > -1f) NPC.velocity.X = -1f; @@ -294,6 +314,9 @@ namespace CalamityMod.NPCs.SlimeGod if (NPC.velocity.Y == 0f) { + // Avoid cheap bullshit + NPC.damage = 0; + float phaseSwitchGateValue = 210f; bool switchPhase = NPC.ai[2] >= phaseSwitchGateValue; if (switchPhase) @@ -318,6 +341,9 @@ namespace CalamityMod.NPCs.SlimeGod if (NPC.ai[0] == 2f) { + // Set damage + NPC.damage = setDamage; + NPC.noTileCollide = true; NPC.velocity.Y = death ? -10f : revenge ? -9f : expertMode ? -8f : -7f; } @@ -333,11 +359,39 @@ namespace CalamityMod.NPCs.SlimeGod } else if (NPC.ai[0] == 1f) { + // Avoid cheap bullshit + NPC.damage = 0; + NPC.velocity.X *= 0.8f; NPC.ai[1] += 1f; if (NPC.ai[1] >= 15f) { + if (revenge) + { + float slimeShotVelocity = 6f; + Vector2 projectileVelocity = (player.Center - NPC.Center).SafeNormalize(Vector2.UnitY) * slimeShotVelocity; + float minFiringDistance = 160f; // 10 tile distance + if (Vector2.Distance(NPC.Center, player.Center) > minFiringDistance) + { + SoundEngine.PlaySound(SlimeGodCore.BigShotSound, NPC.Center); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + int numProj = death ? 5 : 3; + int spread = death ? 12 : 8; + float rotation = MathHelper.ToRadians(spread); + for (int j = 0; j < numProj; j++) + { + Vector2 randomVelocity = Main.rand.NextVector2CircularEdge(3f, 3f); + Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, j / (float)(numProj - 1))) + randomVelocity; + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 30f * NPC.scale, perturbedSpeed, type, damage, 0f, Main.myPlayer); + } + } + } + } + NPC.localAI[2] = NPC.ai[0]; NPC.ai[0] = 0f; NPC.ai[1] = 0f; @@ -346,6 +400,9 @@ namespace CalamityMod.NPCs.SlimeGod } else if (NPC.ai[0] == 2f) { + // Avoid cheap bullshit + NPC.damage = 0; + NPC.noTileCollide = true; NPC.noGravity = true; @@ -392,6 +449,9 @@ namespace CalamityMod.NPCs.SlimeGod } else if (NPC.ai[0] == 2.1f) { + // Set damage + NPC.damage = setDamage; + bool atTargetPosition = NPC.position.Y + NPC.height >= player.position.Y; if (NPC.ai[2] == 0f && atTargetPosition && Collision.CanHit(NPC.Center, 1, 1, player.Center, 1, 1) && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) { @@ -401,6 +461,9 @@ namespace CalamityMod.NPCs.SlimeGod if (atTargetPosition || NPC.velocity.Y <= 0f) { + // Avoid cheap bullshit + NPC.damage = 0; + NPC.ai[1] += 1f; if (NPC.ai[1] > 10f) { @@ -467,12 +530,18 @@ namespace CalamityMod.NPCs.SlimeGod { if (NPC.velocity.Y == 0f) { + // Avoid cheap bullshit + NPC.damage = 0; + NPC.TargetClosest(); NPC.velocity.X *= 0.8f; NPC.ai[1] += 1f; if (NPC.ai[1] > 15f) { + // Set damage + NPC.damage = setDamage; + NPC.ai[1] = 0f; NPC.velocity.Y -= 6f; @@ -499,6 +568,9 @@ namespace CalamityMod.NPCs.SlimeGod } else { + // Set damage + NPC.damage = setDamage; + NPC.velocity.X *= 0.98f; float velocityLimit = (death ? 6.5f : revenge ? 6f : expertMode ? 5.5f : 5f); if (NPC.direction < 0 && NPC.velocity.X > -velocityLimit) @@ -509,6 +581,9 @@ namespace CalamityMod.NPCs.SlimeGod if (NPC.ai[2] >= 2f && NPC.velocity.Y == 0f) { + // Avoid cheap bullshit + NPC.damage = 0; + NPC.localAI[2] = NPC.ai[0]; NPC.ai[0] = 0f; NPC.ai[1] = 0f; @@ -518,6 +593,9 @@ namespace CalamityMod.NPCs.SlimeGod } else if (NPC.ai[0] == 4f) { + // Avoid cheap bullshit + NPC.damage = 0; + NPC.noTileCollide = true; NPC.Opacity -= 0.03f; @@ -531,6 +609,9 @@ namespace CalamityMod.NPCs.SlimeGod } else if (NPC.ai[0] == 5f) { + // Set damage + NPC.damage = setDamage; + if (NPC.velocity.X > 0f) NPC.direction = 1; else @@ -545,6 +626,9 @@ namespace CalamityMod.NPCs.SlimeGod if (Main.netMode != NetmodeID.MultiplayerClient && distanceFromTarget.Length() < 500f && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height) && Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height)) { + // Avoid cheap bullshit + NPC.damage = 0; + NPC.ai[0] = 0f; NPC.ai[1] = 0f; NPC.ai[2] = 0f; @@ -588,7 +672,7 @@ namespace CalamityMod.NPCs.SlimeGod dustColor.A = 150; for (int i = 0; i < 10; i++) { - int corruptDust = Dust.NewDust(NPC.position + Vector2.UnitX * -20f, NPC.width + 40, NPC.height, 4, NPC.velocity.X, NPC.velocity.Y, NPC.alpha, dustColor, 2f); + int corruptDust = Dust.NewDust(NPC.position + Vector2.UnitX * -20f, NPC.width + 40, NPC.height, DustID.TintableDust, NPC.velocity.X, NPC.velocity.Y, NPC.alpha, dustColor, 2f); Main.dust[corruptDust].noGravity = true; Main.dust[corruptDust].velocity *= 0.5f; } @@ -622,7 +706,7 @@ namespace CalamityMod.NPCs.SlimeGod dustColor.A = 150; for (int i = 0; i < 10; i++) { - int corruptDust = Dust.NewDust(NPC.position + Vector2.UnitX * -20f, NPC.width + 40, NPC.height, 4, NPC.velocity.X, NPC.velocity.Y, NPC.alpha, dustColor, 2f); + int corruptDust = Dust.NewDust(NPC.position + Vector2.UnitX * -20f, NPC.width + 40, NPC.height, DustID.TintableDust, NPC.velocity.X, NPC.velocity.Y, NPC.alpha, dustColor, 2f); Main.dust[corruptDust].noGravity = true; Main.dust[corruptDust].velocity *= 0.5f; } @@ -657,7 +741,7 @@ namespace CalamityMod.NPCs.SlimeGod int x = (int)(NPC.position.X + (float)Main.rand.Next(NPC.width - 32)); int y = (int)(NPC.position.Y + (float)Main.rand.Next(NPC.height - 32)); int slimeType = ModContent.NPCType(); - int slimeSpawn = NPC.NewNPC(NPC.GetSource_FromAI(), x, y, slimeType, 0, 0f, 0f, 0f, 0f, 255); + int slimeSpawn = NPC.NewNPC(NPC.GetSource_FromAI(), x, y, slimeType); Main.npc[slimeSpawn].SetDefaults(slimeType); Main.npc[slimeSpawn].velocity.X = (float)Main.rand.Next(-15, 16) * 0.1f; Main.npc[slimeSpawn].velocity.Y = (float)Main.rand.Next(-30, 1) * 0.1f; @@ -698,7 +782,7 @@ namespace CalamityMod.NPCs.SlimeGod dustColor.A = 150; for (int k = 0; k < 5; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 4, hit.HitDirection, -1f, NPC.alpha, dustColor, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, hit.HitDirection, -1f, NPC.alpha, dustColor, 1f); } if (NPC.life <= 0) { @@ -710,7 +794,7 @@ namespace CalamityMod.NPCs.SlimeGod NPC.position.Y = NPC.position.Y - (float)(NPC.height / 2); for (int i = 0; i < 40; i++) { - int corruptionDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 4, 0f, 0f, NPC.alpha, dustColor, 2f); + int corruptionDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, 0f, 0f, NPC.alpha, dustColor, 2f); Main.dust[corruptionDust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -720,10 +804,10 @@ namespace CalamityMod.NPCs.SlimeGod } for (int j = 0; j < 70; j++) { - int corruptionDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 4, 0f, 0f, NPC.alpha, dustColor, 3f); + int corruptionDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, 0f, 0f, NPC.alpha, dustColor, 3f); Main.dust[corruptionDust2].noGravity = true; Main.dust[corruptionDust2].velocity *= 5f; - corruptionDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 4, 0f, 0f, NPC.alpha, dustColor, 2f); + corruptionDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, 0f, 0f, NPC.alpha, dustColor, 2f); Main.dust[corruptionDust2].velocity *= 2f; } } @@ -731,7 +815,7 @@ namespace CalamityMod.NPCs.SlimeGod public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { - NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); } public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) diff --git a/NPCs/StormWeaver/StormWeaverBody.cs b/NPCs/StormWeaver/StormWeaverBody.cs index db749693ef..cbddaba0a0 100644 --- a/NPCs/StormWeaver/StormWeaverBody.cs +++ b/NPCs/StormWeaver/StormWeaverBody.cs @@ -1,10 +1,11 @@ -using CalamityMod.Dusts; +using System.IO; +using CalamityMod.Dusts; using CalamityMod.Events; using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System.IO; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.ID; @@ -15,12 +16,18 @@ namespace CalamityMod.NPCs.StormWeaver { public class StormWeaverBody : ModNPC { + public static Asset Phase2Texture; + public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.StormWeaverHead.DisplayName"); public override void SetStaticDefaults() { this.HideFromBestiary(); NPCID.Sets.TrailingMode[NPC.type] = 1; + if (!Main.dedServ) + { + Phase2Texture = ModContent.Request(Texture + "Naked", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -39,7 +46,7 @@ namespace CalamityMod.NPCs.StormWeaver global.unbreakableDR = true; NPC.chaseable = false; NPC.HitSound = SoundID.NPCHit4; - NPC.DeathSound = SoundID.NPCDeath14; + NPC.DeathSound = StormWeaverHead.DeathSound; double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); @@ -51,7 +58,6 @@ namespace CalamityMod.NPCs.StormWeaver NPC.noGravity = true; NPC.boss = true; NPC.noTileCollide = true; - NPC.canGhostHeal = false; NPC.netAlways = true; NPC.dontCountMe = true; @@ -130,7 +136,6 @@ namespace CalamityMod.NPCs.StormWeaver global.unbreakableDR = false; NPC.chaseable = true; NPC.HitSound = SoundID.NPCHit13; - NPC.DeathSound = SoundID.NPCDeath13; NPC.frame = new Rectangle(0, 0, 54, 52); } } @@ -188,7 +193,7 @@ namespace CalamityMod.NPCs.StormWeaver { for (int i = 0; i < 2; i++) { - int redDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 182, 0f, 0f, 100, default, 2f); + int redDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TheDestroyer, 0f, 0f, 100, default, 2f); Main.dust[redDust].noGravity = true; Main.dust[redDust].noLight = true; } @@ -199,7 +204,7 @@ namespace CalamityMod.NPCs.StormWeaver NPC.alpha = 0; } - Vector2 segmentLocation = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); + Vector2 segmentLocation = NPC.Center; float targetX = Main.player[NPC.target].position.X + (Main.player[NPC.target].width / 2); float targetY = Main.player[NPC.target].position.Y + (Main.player[NPC.target].height / 2); targetX = (int)(targetX / 16f) * 16; @@ -214,10 +219,11 @@ namespace CalamityMod.NPCs.StormWeaver { try { - segmentLocation = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); + segmentLocation = NPC.Center; targetX = Main.npc[(int)NPC.ai[1]].position.X + (Main.npc[(int)NPC.ai[1]].width / 2) - segmentLocation.X; targetY = Main.npc[(int)NPC.ai[1]].position.Y + (Main.npc[(int)NPC.ai[1]].height / 2) - segmentLocation.Y; - } catch + } + catch { } @@ -236,6 +242,21 @@ namespace CalamityMod.NPCs.StormWeaver else if (targetX > 0f) NPC.spriteDirection = 1; } + + // Calculate contact damage based on velocity + float velocity = (phase2 ? 12f : 10f) + (bossRush ? 3f : revenge ? 1.5f : expertMode ? 1f : 0f); + float minimalContactDamageVelocity = velocity * 0.25f; + float minimalDamageVelocity = velocity * 0.5f; + float bodyAndTailVelocity = (NPC.position - NPC.oldPosition).Length(); + if (bodyAndTailVelocity <= minimalContactDamageVelocity) + { + NPC.damage = 0; + } + else + { + float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); + NPC.damage = (int)MathHelper.Lerp(0f, NPC.defDamage, velocityDamageScalar); + } } public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) @@ -262,7 +283,7 @@ namespace CalamityMod.NPCs.StormWeaver if (!phase3) chargePhaseGateValue *= 0.5f; - Texture2D texture = phase2 ? ModContent.Request("CalamityMod/NPCs/StormWeaver/StormWeaverBodyNaked").Value : TextureAssets.Npc[NPC.type].Value; + Texture2D texture = phase2 ? Phase2Texture.Value : TextureAssets.Npc[NPC.type].Value; Vector2 halfSizeTexture = new Vector2(texture.Width / 2, texture.Height / 2); float chargeTelegraphTime = 120f; float chargeTelegraphGateValue = chargePhaseGateValue - chargeTelegraphTime; @@ -331,7 +352,7 @@ namespace CalamityMod.NPCs.StormWeaver for (int i = 0; i < 20; i++) { - int cosmiliteDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + int cosmiliteDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[cosmiliteDust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -342,10 +363,10 @@ namespace CalamityMod.NPCs.StormWeaver for (int j = 0; j < 40; j++) { - int cosmiliteDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); + int cosmiliteDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); Main.dust[cosmiliteDust2].noGravity = true; Main.dust[cosmiliteDust2].velocity *= 5f; - cosmiliteDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + cosmiliteDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[cosmiliteDust2].velocity *= 2f; } } @@ -353,7 +374,7 @@ namespace CalamityMod.NPCs.StormWeaver public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { - NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } diff --git a/NPCs/StormWeaver/StormWeaverHead.cs b/NPCs/StormWeaver/StormWeaverHead.cs index 14a4949b6a..3239bbd167 100644 --- a/NPCs/StormWeaver/StormWeaverHead.cs +++ b/NPCs/StormWeaver/StormWeaverHead.cs @@ -1,5 +1,8 @@ -using CalamityMod.Dusts; +using System; +using System.IO; +using CalamityMod.Dusts; using CalamityMod.Events; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Armor.Vanity; using CalamityMod.Items.LoreItems; using CalamityMod.Items.Materials; @@ -13,20 +16,18 @@ using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Projectiles.Boss; using CalamityMod.Projectiles.Enemy; +using CalamityMod.Sounds; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; +using ReLogic.Content; using Terraria; +using Terraria.Audio; using Terraria.GameContent; using Terraria.GameContent.Bestiary; +using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using Terraria.GameContent.ItemDropRules; -using CalamityMod.Sounds; -using CalamityMod.Items.Accessories; namespace CalamityMod.NPCs.StormWeaver { @@ -50,16 +51,21 @@ namespace CalamityMod.NPCs.StormWeaver private const float BoltAngleSpread = 280; private bool tail = false; + public static readonly SoundStyle ArmorShedSound = new("CalamityMod/Sounds/Custom/WeaverArmorShed"); + public static readonly SoundStyle DeathSound = new("CalamityMod/Sounds/NPCKilled/WeaverDeath"); + // Lightning flash variables public float lightning = 0f; private float lightningDecay = 1f; private float lightningSpeed = 0f; + public static Asset Phase2Texture; + public override void SetStaticDefaults() { NPCID.Sets.TrailingMode[NPC.type] = 1; NPCID.Sets.BossBestiaryPriority.Add(Type); - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { Scale = 0.85f, PortraitScale = 0.75f, @@ -70,7 +76,11 @@ namespace CalamityMod.NPCs.StormWeaver value.Position.X += 70; value.Position.Y += 55; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; - NPCID.Sets.MPAllowedEnemies[Type] = true; + NPCID.Sets.MPAllowedEnemies[Type] = true; + if (!Main.dedServ) + { + Phase2Texture = ModContent.Request(Texture + "Naked", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -91,7 +101,7 @@ namespace CalamityMod.NPCs.StormWeaver global.unbreakableDR = true; NPC.chaseable = false; NPC.HitSound = SoundID.NPCHit4; - NPC.DeathSound = SoundID.NPCDeath14; + NPC.DeathSound = DeathSound; double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); @@ -122,10 +132,10 @@ namespace CalamityMod.NPCs.StormWeaver public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Sky, - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.StormWeaver") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.StormWeaver") }); } @@ -195,7 +205,7 @@ namespace CalamityMod.NPCs.StormWeaver if (Main.netMode != NetmodeID.Server) Gore.NewGore(NPC.GetSource_FromAI(), NPC.position, NPC.velocity, Mod.Find("SWArmorHead1").Type, NPC.scale); - SoundEngine.PlaySound(SoundID.NPCDeath14, NPC.Center); + SoundEngine.PlaySound(ArmorShedSound, NPC.Center); CalamityGlobalNPC global = NPC.Calamity(); NPC.defense = 20; @@ -203,7 +213,6 @@ namespace CalamityMod.NPCs.StormWeaver global.unbreakableDR = false; NPC.chaseable = true; NPC.HitSound = SoundID.NPCHit13; - NPC.DeathSound = SoundID.NPCDeath13; NPC.frame = new Rectangle(0, 0, 62, 86); } } @@ -223,7 +232,7 @@ namespace CalamityMod.NPCs.StormWeaver { for (int i = 0; i < 2; i++) { - int redDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 182, 0f, 0f, 100, default, 2f); + int redDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TheDestroyer, 0f, 0f, 100, default, 2f); Main.dust[redDust].noGravity = true; Main.dust[redDust].noLight = true; } @@ -245,10 +254,9 @@ namespace CalamityMod.NPCs.StormWeaver for (int i = 0; i < Main.maxNPCs; i++) { if (!Main.npc[i].active) - { npcCounts++; - } } + totalLength = npcCounts - 20; } @@ -403,7 +411,7 @@ namespace CalamityMod.NPCs.StormWeaver int snowDustSpawnTileY = snowDustSpawnY / 16; if (WorldGen.InWorld(snowDustSpawnTileX, snowDustSpawnTileY) && !Main.tile[snowDustSpawnTileX, snowDustSpawnTileY].HasUnactuatedTile) { - int dust = Dust.NewDust(new Vector2(snowDustSpawnX, snowDustSpawnY), 10, 10, 76); + int dust = Dust.NewDust(new Vector2(snowDustSpawnX, snowDustSpawnY), 10, 10, DustID.Snow); Main.dust[dust].scale += 0.2f; Main.dust[dust].velocity.Y = 3f + Main.rand.Next(30) * 0.1f; Main.dust[dust].velocity.Y *= Main.dust[dust].scale; @@ -593,7 +601,7 @@ namespace CalamityMod.NPCs.StormWeaver Vector2 dustRotation = Vector2.Normalize(NPC.velocity) * new Vector2((NPC.width + 50) / 2f, NPC.height) * 0.75f; dustRotation = dustRotation.RotatedBy((k - (dustAmt / 2 - 1)) * (double)MathHelper.Pi / (float)dustAmt) + NPC.Center; Vector2 randDustMovement = ((float)(Main.rand.NextDouble() * MathHelper.Pi) - MathHelper.PiOver2).ToRotationVector2() * Main.rand.Next(3, 8); - int bluishDust = Dust.NewDust(dustRotation + randDustMovement, 0, 0, 206, randDustMovement.X, randDustMovement.Y, 100, default, 3f); + int bluishDust = Dust.NewDust(dustRotation + randDustMovement, 0, 0, DustID.UnusedWhiteBluePurple, randDustMovement.X, randDustMovement.Y, 100, default, 3f); Main.dust[bluishDust].noGravity = true; Main.dust[bluishDust].noLight = true; Main.dust[bluishDust].velocity /= 4f; @@ -767,6 +775,19 @@ namespace CalamityMod.NPCs.StormWeaver } } + // Calculate contact damage based on velocity + float minimalContactDamageVelocity = velocity * 0.25f; + float minimalDamageVelocity = velocity * 0.5f; + if (NPC.velocity.Length() <= minimalContactDamageVelocity) + { + NPC.damage = (int)Math.Round(NPC.defDamage * 0.5); + } + else + { + float velocityDamageScalar = MathHelper.Clamp((NPC.velocity.Length() - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); + NPC.damage = (int)MathHelper.Lerp((float)Math.Round(NPC.defDamage * 0.5), NPC.defDamage, velocityDamageScalar); + } + NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X) + MathHelper.PiOver2; if (phase4) @@ -826,7 +847,7 @@ namespace CalamityMod.NPCs.StormWeaver if (!phase3) chargePhaseGateValue *= 0.5f; - Texture2D texture = phase2 ? ModContent.Request("CalamityMod/NPCs/StormWeaver/StormWeaverHeadNaked").Value : TextureAssets.Npc[NPC.type].Value; + Texture2D texture = phase2 ? Phase2Texture.Value : TextureAssets.Npc[NPC.type].Value; Vector2 halfSizeTexture = new Vector2(texture.Width / 2, texture.Height / 2); float chargeTelegraphTime = 120f; float chargeTelegraphGateValue = chargePhaseGateValue - chargeTelegraphTime; @@ -894,7 +915,7 @@ namespace CalamityMod.NPCs.StormWeaver for (int i = 0; i < 20; i++) { - int cosmiliteDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + int cosmiliteDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[cosmiliteDust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -905,10 +926,10 @@ namespace CalamityMod.NPCs.StormWeaver for (int j = 0; j < 40; j++) { - int cosmiliteDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); + int cosmiliteDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); Main.dust[cosmiliteDust2].noGravity = true; Main.dust[cosmiliteDust2].velocity *= 5f; - cosmiliteDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + cosmiliteDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[cosmiliteDust2].velocity *= 2f; } } @@ -972,10 +993,10 @@ namespace CalamityMod.NPCs.StormWeaver // Vanity normalOnly.Add(ModContent.ItemType(), 7); normalOnly.Add(ModContent.ItemType(), 10); - var godSlayerVanity = ItemDropRule.Common(ModContent.ItemType(), 20); - godSlayerVanity.OnSuccess(ItemDropRule.Common(ModContent.ItemType())); - godSlayerVanity.OnSuccess(ItemDropRule.Common(ModContent.ItemType())); - normalOnly.Add(godSlayerVanity); + var godSlayerVanity = ItemDropRule.Common(ModContent.ItemType(), 20); + godSlayerVanity.OnSuccess(ItemDropRule.Common(ModContent.ItemType())); + godSlayerVanity.OnSuccess(ItemDropRule.Common(ModContent.ItemType())); + normalOnly.Add(godSlayerVanity); normalOnly.Add(ModContent.ItemType(), ThankYouPainting.DropInt); } @@ -997,7 +1018,7 @@ namespace CalamityMod.NPCs.StormWeaver public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { - NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); } } } diff --git a/NPCs/StormWeaver/StormWeaverTail.cs b/NPCs/StormWeaver/StormWeaverTail.cs index 3ff0f7a02e..668878f4ed 100644 --- a/NPCs/StormWeaver/StormWeaverTail.cs +++ b/NPCs/StormWeaver/StormWeaverTail.cs @@ -1,9 +1,10 @@ -using CalamityMod.Dusts; +using System.IO; +using CalamityMod.Dusts; using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System.IO; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.ID; @@ -16,12 +17,20 @@ namespace CalamityMod.NPCs.StormWeaver { private int invinceTime = 180; + public static Asset Phase2Texture; + public static Asset GlowTexture; + public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.StormWeaverHead.DisplayName"); public override void SetStaticDefaults() { this.HideFromBestiary(); NPCID.Sets.TrailingMode[NPC.type] = 1; + if (!Main.dedServ) + { + Phase2Texture = ModContent.Request(Texture + "Naked", AssetRequestMode.AsyncLoad); + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -36,7 +45,7 @@ namespace CalamityMod.NPCs.StormWeaver // Phase one settings NPC.takenDamageMultiplier = 2f; NPC.HitSound = SoundID.NPCHit53; - NPC.DeathSound = SoundID.NPCDeath14; + NPC.DeathSound = StormWeaverHead.DeathSound; double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); @@ -48,7 +57,6 @@ namespace CalamityMod.NPCs.StormWeaver NPC.noGravity = true; NPC.boss = true; NPC.noTileCollide = true; - NPC.canGhostHeal = false; NPC.netAlways = true; NPC.dontCountMe = true; @@ -105,6 +113,8 @@ namespace CalamityMod.NPCs.StormWeaver NPC.life = Main.npc[(int)NPC.ai[1]].life; bool bossRush = BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || bossRush; + bool revenge = CalamityWorld.revenge || bossRush; // Shed armor bool phase2 = NPC.life / (float)NPC.lifeMax < 0.8f; @@ -130,7 +140,6 @@ namespace CalamityMod.NPCs.StormWeaver global.DR = 0.4f; NPC.takenDamageMultiplier = 1f; NPC.HitSound = SoundID.NPCHit13; - NPC.DeathSound = SoundID.NPCDeath13; NPC.frame = new Rectangle(0, 0, 42, 68); } } @@ -180,7 +189,7 @@ namespace CalamityMod.NPCs.StormWeaver { for (int i = 0; i < 2; i++) { - int redDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 182, 0f, 0f, 100, default, 2f); + int redDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TheDestroyer, 0f, 0f, 100, default, 2f); Main.dust[redDust].noGravity = true; Main.dust[redDust].noLight = true; } @@ -191,7 +200,7 @@ namespace CalamityMod.NPCs.StormWeaver NPC.alpha = 0; } - Vector2 segmentLocation = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); + Vector2 segmentLocation = NPC.Center; float targetX = Main.player[NPC.target].position.X + (Main.player[NPC.target].width / 2); float targetY = Main.player[NPC.target].position.Y + (Main.player[NPC.target].height / 2); targetX = (int)(targetX / 16f) * 16; @@ -206,10 +215,11 @@ namespace CalamityMod.NPCs.StormWeaver { try { - segmentLocation = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); + segmentLocation = NPC.Center; targetX = Main.npc[(int)NPC.ai[1]].position.X + (Main.npc[(int)NPC.ai[1]].width / 2) - segmentLocation.X; targetY = Main.npc[(int)NPC.ai[1]].position.Y + (Main.npc[(int)NPC.ai[1]].height / 2) - segmentLocation.Y; - } catch + } + catch { } @@ -228,6 +238,21 @@ namespace CalamityMod.NPCs.StormWeaver else if (targetX > 0f) NPC.spriteDirection = 1; } + + // Calculate contact damage based on velocity + float velocity = (phase2 ? 12f : 10f) + (bossRush ? 3f : revenge ? 1.5f : expertMode ? 1f : 0f); + float minimalContactDamageVelocity = velocity * 0.25f; + float minimalDamageVelocity = velocity * 0.5f; + float bodyAndTailVelocity = (NPC.position - NPC.oldPosition).Length(); + if (bodyAndTailVelocity <= minimalContactDamageVelocity) + { + NPC.damage = 0; + } + else + { + float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); + NPC.damage = (int)MathHelper.Lerp(0f, NPC.defDamage, velocityDamageScalar); + } } public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) @@ -254,7 +279,7 @@ namespace CalamityMod.NPCs.StormWeaver if (!phase3) chargePhaseGateValue *= 0.5f; - Texture2D texture = phase2 ? ModContent.Request("CalamityMod/NPCs/StormWeaver/StormWeaverTailNaked").Value : TextureAssets.Npc[NPC.type].Value; + Texture2D texture = phase2 ? Phase2Texture.Value : TextureAssets.Npc[NPC.type].Value; Vector2 halfSizeTexture = new Vector2(texture.Width / 2, texture.Height / 2); float chargeTelegraphTime = 120f; float chargeTelegraphGateValue = chargePhaseGateValue - chargeTelegraphTime; @@ -273,7 +298,7 @@ namespace CalamityMod.NPCs.StormWeaver if (!phase2) { - texture = ModContent.Request("CalamityMod/NPCs/StormWeaver/StormWeaverTailGlow").Value; + texture = GlowTexture.Value; Color rainbowBecauseWhyTheFuckNot = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB); Color drawColorAlpha37 = Color.Lerp(Color.White, rainbowBecauseWhyTheFuckNot, 0.5f); spriteBatch.Draw(texture, drawLocation, NPC.frame, drawColorAlpha37, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); @@ -325,7 +350,7 @@ namespace CalamityMod.NPCs.StormWeaver for (int i = 0; i < 20; i++) { - int cosmiliteDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + int cosmiliteDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[cosmiliteDust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -336,10 +361,10 @@ namespace CalamityMod.NPCs.StormWeaver for (int j = 0; j < 40; j++) { - int cosmiliteDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); + int cosmiliteDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); Main.dust[cosmiliteDust2].noGravity = true; Main.dust[cosmiliteDust2].velocity *= 5f; - cosmiliteDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + cosmiliteDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[cosmiliteDust2].velocity *= 2f; } } @@ -352,7 +377,7 @@ namespace CalamityMod.NPCs.StormWeaver public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { - NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } } diff --git a/NPCs/SulphurousSea/AnthozoanCrab.cs b/NPCs/SulphurousSea/AnthozoanCrab.cs index 9d2cc53e40..3ce2f3ee0b 100644 --- a/NPCs/SulphurousSea/AnthozoanCrab.cs +++ b/NPCs/SulphurousSea/AnthozoanCrab.cs @@ -1,12 +1,12 @@ -using CalamityMod.BiomeManagers; +using System; +using System.IO; +using CalamityMod.BiomeManagers; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; -using CalamityMod.Projectiles.Enemy; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Projectiles.Enemy; using Microsoft.Xna.Framework; -using System; -using System.IO; using Terraria; using Terraria.GameContent.Bestiary; using Terraria.ID; @@ -17,10 +17,11 @@ namespace CalamityMod.NPCs.SulphurousSea public class AnthozoanCrab : ModNPC { public int boulderIndex; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 16; - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { SpriteDirection = 1 }; @@ -49,11 +50,15 @@ namespace CalamityMod.NPCs.SulphurousSea NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.AnthozoanCrab") }); @@ -63,12 +68,17 @@ namespace CalamityMod.NPCs.SulphurousSea { writer.Write(boulderIndex); } + public override void ReceiveExtraAI(BinaryReader reader) { boulderIndex = reader.ReadInt32(); } + public override void AI() { + // Setting this in SetDefaults will disable expert mode scaling, so put it here instead + NPC.damage = 0; + if (NPC.ai[1]++ % 360f < 280f) { if (NPC.ai[2] > 1f) @@ -163,9 +173,10 @@ namespace CalamityMod.NPCs.SulphurousSea { NPC.velocity.X = 0f; Vector2 rockSpawnPosition = new Vector2(16f * -NPC.spriteDirection + NPC.Center.X, NPC.Bottom.Y - 6f); + int damage = Main.masterMode ? 18 : Main.expertMode ? 21 : 29; if (Main.netMode != NetmodeID.MultiplayerClient) { - boulderIndex = Projectile.NewProjectile(NPC.GetSource_FromAI(), rockSpawnPosition, Vector2.Zero, ModContent.ProjectileType(), 29, 6f); + boulderIndex = Projectile.NewProjectile(NPC.GetSource_FromAI(), rockSpawnPosition, Vector2.Zero, ModContent.ProjectileType(), damage, 6f); NPC.netUpdate = true; } } @@ -226,7 +237,7 @@ namespace CalamityMod.NPCs.SulphurousSea { for (int k = 0; k < 15; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulphurousSeaAcid, hit.HitDirection, -1f, 0, default, 1f); } if (Main.netMode != NetmodeID.Server) { diff --git a/NPCs/SulphurousSea/AquaticUrchin.cs b/NPCs/SulphurousSea/AquaticUrchin.cs index a90d2d0b56..57b90345a5 100644 --- a/NPCs/SulphurousSea/AquaticUrchin.cs +++ b/NPCs/SulphurousSea/AquaticUrchin.cs @@ -15,7 +15,7 @@ namespace CalamityMod.NPCs.SulphurousSea { public override void SetStaticDefaults() { - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0); + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(); value.Position.Y += 12; value.PortraitPositionYOverride = 32f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; @@ -46,11 +46,15 @@ namespace CalamityMod.NPCs.SulphurousSea NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[2] { ModContent.GetInstance().Type, ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.AquaticUrchin") }); diff --git a/NPCs/SulphurousSea/BelchingCoral.cs b/NPCs/SulphurousSea/BelchingCoral.cs index 16b7ee7f24..4909e5bc39 100644 --- a/NPCs/SulphurousSea/BelchingCoral.cs +++ b/NPCs/SulphurousSea/BelchingCoral.cs @@ -1,13 +1,14 @@ -using CalamityMod.BiomeManagers; +using System; +using CalamityMod.BiomeManagers; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; -using CalamityMod.Projectiles.Enemy; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Projectiles.Enemy; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; @@ -16,10 +17,12 @@ namespace CalamityMod.NPCs.SulphurousSea { public class BelchingCoral : ModNPC { + public static readonly SoundStyle SAXOPHONE = new("CalamityMod/Sounds/Item/Saxophone/Sax", 6); + public const float CheckDistance = 480f; public override void SetStaticDefaults() { - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0); + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(); value.Position.Y += 4; value.PortraitPositionYOverride = 24f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; @@ -45,18 +48,25 @@ namespace CalamityMod.NPCs.SulphurousSea NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.BelchingCoral") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.BelchingCoral") }); } public override void AI() { + // Setting this in SetDefaults will disable expert mode scaling, so put it here instead + NPC.damage = 0; + NPC.velocity.Y += 0.25f; NPC.TargetClosest(false); Player player = Main.player[NPC.target]; @@ -64,8 +74,19 @@ namespace CalamityMod.NPCs.SulphurousSea { if (NPC.ai[0]++ % 35f == 34f && Main.netMode != NetmodeID.MultiplayerClient) { + int damage = Main.masterMode ? 17 : Main.expertMode ? 20 : 27; Vector2 velocity = new Vector2(Main.rand.NextFloat(-6f, 6f), Main.rand.NextFloat(-11f, -6f)); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Top + new Vector2(0f, 6f), velocity, ModContent.ProjectileType(), 27, 3f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Top + new Vector2(0f, 6f), velocity, ModContent.ProjectileType(), damage, 3f); + } + } + + if (Main.zenithWorld) + { + NPC.ai[1]++; + if (NPC.ai[1] > 27) + { + SoundEngine.PlaySound(SAXOPHONE, NPC.Center); + NPC.ai[1] = 0; } } } @@ -98,7 +119,7 @@ namespace CalamityMod.NPCs.SulphurousSea { for (int k = 0; k < 10; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulphurousSeaAcid, hit.HitDirection, -1f, 0, default, 1f); } if (Main.netMode != NetmodeID.Server) { diff --git a/NPCs/SulphurousSea/Gnasher.cs b/NPCs/SulphurousSea/Gnasher.cs index c84311fc14..f892ce143d 100644 --- a/NPCs/SulphurousSea/Gnasher.cs +++ b/NPCs/SulphurousSea/Gnasher.cs @@ -14,7 +14,7 @@ namespace CalamityMod.NPCs.SulphurousSea public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 5; - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { SpriteDirection = 1 }; @@ -43,11 +43,15 @@ namespace CalamityMod.NPCs.SulphurousSea NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Gnasher") }); diff --git a/NPCs/SulphurousSea/MicrobialCluster.cs b/NPCs/SulphurousSea/MicrobialCluster.cs index f47209a733..05b061fa9e 100644 --- a/NPCs/SulphurousSea/MicrobialCluster.cs +++ b/NPCs/SulphurousSea/MicrobialCluster.cs @@ -50,7 +50,7 @@ namespace CalamityMod.NPCs.SulphurousSea } if (NPC.ai[0] % 32f == 31f) { - Dust dust = Dust.NewDustPerfect(NPC.Center, (int)CalamityDusts.SulfurousSeaAcid); + Dust dust = Dust.NewDustPerfect(NPC.Center, (int)CalamityDusts.SulphurousSeaAcid); dust.velocity = Vector2.One.RotatedByRandom(MathHelper.TwoPi) * Main.rand.NextFloat(1f, 2f); dust.noGravity = true; dust.scale = 1.6f; @@ -65,7 +65,7 @@ namespace CalamityMod.NPCs.SulphurousSea { for (int k = 0; k < 6; k++) { - Dust dust = Dust.NewDustPerfect(NPC.Center, (int)CalamityDusts.SulfurousSeaAcid); + Dust dust = Dust.NewDustPerfect(NPC.Center, (int)CalamityDusts.SulphurousSeaAcid); dust.velocity = Vector2.One.RotatedByRandom(MathHelper.TwoPi) * Main.rand.NextFloat(1f, 2f); dust.scale = 1.2f; } diff --git a/NPCs/SulphurousSea/Sulflounder.cs b/NPCs/SulphurousSea/Sulflounder.cs index d91dcee45e..edfa82d133 100644 --- a/NPCs/SulphurousSea/Sulflounder.cs +++ b/NPCs/SulphurousSea/Sulflounder.cs @@ -2,6 +2,7 @@ using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Potions; +using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; using Terraria; using Terraria.GameContent.Bestiary; using Terraria.ID; @@ -15,7 +16,7 @@ namespace CalamityMod.NPCs.SulphurousSea public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 4; - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0); + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(); value.Position.Y -= 10f; value.PortraitPositionYOverride = -36f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; @@ -43,18 +44,25 @@ namespace CalamityMod.NPCs.SulphurousSea NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[2] { ModContent.GetInstance().Type, ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Sulflounder") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Sulflounder") }); } public override void AI() { + // Setting this in SetDefaults will disable expert mode scaling, so put it here instead + NPC.damage = 0; + NPC.spriteDirection = (NPC.direction > 0) ? 1 : -1; int alphaControl = 200; if (NPC.ai[2] == 0f) @@ -94,7 +102,7 @@ namespace CalamityMod.NPCs.SulphurousSea if (NPC.ai[2] == 1f) { NPC.chaseable = true; - CalamityAI.PassiveSwimmingAI(NPC, Mod, 0, 0f, 0.1f, 0.1f, 2f, 1f, 0.1f); + CalamityRegularEnemyAI.PassiveSwimmingAI(NPC, Mod, 0, 0f, 0.1f, 0.1f, 2f, 1f, 0.1f); } } diff --git a/NPCs/SulphurousSea/Toxicatfish.cs b/NPCs/SulphurousSea/Toxicatfish.cs index b08d54b05e..675f63a5cb 100644 --- a/NPCs/SulphurousSea/Toxicatfish.cs +++ b/NPCs/SulphurousSea/Toxicatfish.cs @@ -1,7 +1,8 @@ -using CalamityMod.BiomeManagers; +using System.IO; +using CalamityMod.BiomeManagers; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Placeables.Banners; -using System.IO; +using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; using Terraria; using Terraria.GameContent.Bestiary; using Terraria.ID; @@ -15,7 +16,7 @@ namespace CalamityMod.NPCs.SulphurousSea public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 4; - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0); + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(); value.Position.X += 10f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; } @@ -42,11 +43,15 @@ namespace CalamityMod.NPCs.SulphurousSea NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[2] { ModContent.GetInstance().Type, ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Toxicatfish") }); @@ -64,7 +69,7 @@ namespace CalamityMod.NPCs.SulphurousSea public override void AI() { - CalamityAI.PassiveSwimmingAI(NPC, Mod, 0, Main.player[NPC.target].Calamity().GetAbyssAggro(160f), 0.25f, 0.15f, 8f, 8f, 0.1f); + CalamityRegularEnemyAI.PassiveSwimmingAI(NPC, Mod, 0, Main.player[NPC.target].Calamity().GetAbyssAggro(160f), 0.25f, 0.15f, 8f, 8f, 0.1f); } public override bool? CanBeHitByProjectile(Projectile projectile) diff --git a/NPCs/SulphurousSea/Trasher.cs b/NPCs/SulphurousSea/Trasher.cs index 6dbff3f85d..dd1c4000d4 100644 --- a/NPCs/SulphurousSea/Trasher.cs +++ b/NPCs/SulphurousSea/Trasher.cs @@ -1,11 +1,11 @@ -using CalamityMod.BiomeManagers; +using System; +using System.IO; +using CalamityMod.BiomeManagers; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Pets; using CalamityMod.Items.Placeables.Banners; using CalamityMod.World; using Microsoft.Xna.Framework; -using System; -using System.IO; using Terraria; using Terraria.GameContent.Bestiary; using Terraria.ID; @@ -20,7 +20,7 @@ namespace CalamityMod.NPCs.SulphurousSea public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 8; - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { SpriteDirection = 1, Scale = 0.65f, @@ -44,7 +44,7 @@ namespace CalamityMod.NPCs.SulphurousSea NPC.value = Item.buyPrice(0, 0, 3, 0); NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath5; - NPC.knockBackResist = 0f; + NPC.knockBackResist = 0.15f; Banner = NPC.type; BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToHeat = false; @@ -52,13 +52,17 @@ namespace CalamityMod.NPCs.SulphurousSea NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Trasher") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Trasher") }); } @@ -89,7 +93,7 @@ namespace CalamityMod.NPCs.SulphurousSea NPC.TargetClosest(true); } NPC.noTileCollide = false; - bool canAttack = hasBeenHit; + bool canAttack = hasBeenHit || Main.zenithWorld; NPC.TargetClosest(false); if (Main.player[NPC.target].wet && !Main.player[NPC.target].dead && Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[NPC.target].position, Main.player[NPC.target].width, Main.player[NPC.target].height) && @@ -129,6 +133,8 @@ namespace CalamityMod.NPCs.SulphurousSea if (canAttack) { NPC.TargetClosest(true); + if (Main.zenithWorld) + NPC.noTileCollide = true; NPC.velocity.X = NPC.velocity.X + (float)NPC.direction * (CalamityWorld.death ? 0.6f : CalamityWorld.revenge ? 0.45f : 0.3f); NPC.velocity.Y = NPC.velocity.Y + (float)NPC.directionY * (CalamityWorld.death ? 0.2f : CalamityWorld.revenge ? 0.15f : 0.1f); float velocityX = CalamityWorld.death ? 20f : CalamityWorld.revenge ? 15f : 10f; @@ -200,7 +206,7 @@ namespace CalamityMod.NPCs.SulphurousSea NPC.netUpdate = true; return; } - NPC.noTileCollide = true; + NPC.noTileCollide = false; float velocityBoost = 1f; NPC.TargetClosest(true); bool closeToTargetX = false; @@ -235,52 +241,58 @@ namespace CalamityMod.NPCs.SulphurousSea NPC.velocity.X = (NPC.velocity.X * 20f - velocityBoost) / 21f; } } - int collisionWidth = 80; - int collisionHeight = 20; - Vector2 collisionSize = new Vector2(NPC.Center.X - (float)(collisionWidth / 2), NPC.position.Y + (float)NPC.height - (float)collisionHeight); - bool shouldFallThroughTiles = false; - if (NPC.position.X < Main.player[NPC.target].position.X && NPC.position.X + (float)NPC.width > Main.player[NPC.target].position.X + (float)Main.player[NPC.target].width && NPC.position.Y + (float)NPC.height < Main.player[NPC.target].position.Y + (float)Main.player[NPC.target].height - 16f) + if (NPC.velocity.Y >= 0f) { - shouldFallThroughTiles = true; - } - if (shouldFallThroughTiles) - { - NPC.velocity.Y = NPC.velocity.Y + 0.5f; - } - else if (Collision.SolidCollision(collisionSize, collisionWidth, collisionHeight)) - { - if (NPC.velocity.Y > 0f) + int fallFaceDirection = 0; + if (NPC.velocity.X < 0f) { - NPC.velocity.Y = 0f; + fallFaceDirection = -1; } - if (NPC.velocity.Y > -0.2f) + if (NPC.velocity.X > 0f) { - NPC.velocity.Y = NPC.velocity.Y - 0.025f; + fallFaceDirection = 1; } - else + Vector2 trashPosition = NPC.position; + trashPosition.X += NPC.velocity.X; + int xTileBelow = (int)((trashPosition.X + (float)(NPC.width / 2) + (float)((NPC.width / 2 + 1) * fallFaceDirection)) / 16f); + int yTileBelow = (int)((trashPosition.Y + (float)NPC.height - 1f) / 16f); + if ((float)(xTileBelow * 16) < trashPosition.X + (float)NPC.width && (float)(xTileBelow * 16 + 16) > trashPosition.X && ((Main.tile[xTileBelow, yTileBelow].HasUnactuatedTile && !Main.tile[xTileBelow, yTileBelow].TopSlope && !Main.tile[xTileBelow, yTileBelow - 1].TopSlope && Main.tileSolid[(int)Main.tile[xTileBelow, yTileBelow].TileType] && !Main.tileSolidTop[(int)Main.tile[xTileBelow, yTileBelow].TileType]) || (Main.tile[xTileBelow, yTileBelow - 1].IsHalfBlock && Main.tile[xTileBelow, yTileBelow - 1].HasUnactuatedTile)) && (!Main.tile[xTileBelow, yTileBelow - 1].HasUnactuatedTile || !Main.tileSolid[(int)Main.tile[xTileBelow, yTileBelow - 1].TileType] || Main.tileSolidTop[(int)Main.tile[xTileBelow, yTileBelow - 1].TileType] || (Main.tile[xTileBelow, yTileBelow - 1].IsHalfBlock && (!Main.tile[xTileBelow, yTileBelow - 4].HasUnactuatedTile || !Main.tileSolid[(int)Main.tile[xTileBelow, yTileBelow - 4].TileType] || Main.tileSolidTop[(int)Main.tile[xTileBelow, yTileBelow - 4].TileType]))) && (!Main.tile[xTileBelow, yTileBelow - 2].HasUnactuatedTile || !Main.tileSolid[(int)Main.tile[xTileBelow, yTileBelow - 2].TileType] || Main.tileSolidTop[(int)Main.tile[xTileBelow, yTileBelow - 2].TileType]) && (!Main.tile[xTileBelow, yTileBelow - 3].HasUnactuatedTile || !Main.tileSolid[(int)Main.tile[xTileBelow, yTileBelow - 3].TileType] || Main.tileSolidTop[(int)Main.tile[xTileBelow, yTileBelow - 3].TileType]) && (!Main.tile[xTileBelow - fallFaceDirection, yTileBelow - 3].HasUnactuatedTile || !Main.tileSolid[(int)Main.tile[xTileBelow - fallFaceDirection, yTileBelow - 3].TileType])) { - NPC.velocity.Y = NPC.velocity.Y - 0.2f; + float yPixelDistance = (float)(yTileBelow * 16); + if (Main.tile[xTileBelow, yTileBelow].IsHalfBlock) + { + yPixelDistance += 8f; + } + if (Main.tile[xTileBelow, yTileBelow - 1].IsHalfBlock) + { + yPixelDistance -= 8f; + } + if (yPixelDistance < trashPosition.Y + (float)NPC.height) + { + float percentageTileRisen = trashPosition.Y + (float)NPC.height - yPixelDistance; + float fullTileAmt = 16.1f; + if (percentageTileRisen <= fullTileAmt) + { + NPC.gfxOffY += NPC.position.Y + (float)NPC.height - yPixelDistance; + NPC.position.Y = yPixelDistance - (float)NPC.height; + if (percentageTileRisen < 9f) + { + NPC.stepSpeed = 1f; + } + else + { + NPC.stepSpeed = 2f; + } + } + } } - if (NPC.velocity.Y < -4f) + if (NPC.oldPosition == NPC.position) { - NPC.velocity.Y = -4f; - } - } - else - { - if (NPC.velocity.Y < 0f) - { - NPC.velocity.Y = 0f; - } - if (NPC.velocity.Y < 0.1f) - { - NPC.velocity.Y = NPC.velocity.Y + 0.025f; - } - else - { - NPC.velocity.Y = NPC.velocity.Y + 0.5f; + NPC.velocity.Y = -10f; + NPC.netUpdate = true; } } + NPC.velocity.Y = NPC.velocity.Y + (Main.zenithWorld ? 0.5f : 0.55f); // Lets them jump up walls infinitely in GFB if (NPC.velocity.Y > 10f) { NPC.velocity.Y = 10f; diff --git a/NPCs/SunkenSea/BabyGhostBell.cs b/NPCs/SunkenSea/BabyGhostBell.cs index 187eec59a4..812fa36cc2 100644 --- a/NPCs/SunkenSea/BabyGhostBell.cs +++ b/NPCs/SunkenSea/BabyGhostBell.cs @@ -1,27 +1,34 @@ -using CalamityMod.BiomeManagers; -using CalamityMod.Items.Placeables.Banners; +using System.IO; +using CalamityMod.BiomeManagers; using CalamityMod.Items.Critters; +using CalamityMod.Items.Fishing.SunkenSeaCatches; +using CalamityMod.Items.Placeables.Banners; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System.IO; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.Utilities; -using CalamityMod.Items.Fishing.SunkenSeaCatches; namespace CalamityMod.NPCs.SunkenSea { public class BabyGhostBell : ModNPC { public bool hasBeenHit = false; + public static Asset GlowTexture; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 4; Main.npcCatchable[NPC.type] = true; NPCID.Sets.CountsAsCritter[NPC.type] = true; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -48,7 +55,7 @@ namespace CalamityMod.NPCs.SunkenSea public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.BabyGhostBell") }); @@ -78,7 +85,7 @@ namespace CalamityMod.NPCs.SunkenSea } if (Main.rand.Next(8) < 1 && NPC.catchItem == (short)ModContent.ItemType()) { - int dust = Dust.NewDust(NPC.position - new Vector2(2f, 2f), NPC.width + 4, NPC.height + 4, 68, NPC.velocity.X * 0.4f, NPC.velocity.Y * 0.4f, 200, default, 1f); + int dust = Dust.NewDust(NPC.position - new Vector2(2f, 2f), NPC.width + 4, NPC.height + 4, DustID.BlueCrystalShard, NPC.velocity.X * 0.4f, NPC.velocity.Y * 0.4f, 200, default, 1f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 1.1f; Main.dust[dust].velocity.Y += 0.25f; @@ -144,10 +151,10 @@ namespace CalamityMod.NPCs.SunkenSea Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); Vector2 vector = center - screenPos; - vector -= new Vector2((float)ModContent.Request("CalamityMod/NPCs/SunkenSea/BabyGhostBellGlow").Value.Width, (float)(ModContent.Request("CalamityMod/NPCs/SunkenSea/BabyGhostBellGlow").Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; + vector -= new Vector2((float)GlowTexture.Value.Width, (float)(GlowTexture.Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; vector += halfSizeTexture * 1f + new Vector2(0f, 4f + NPC.gfxOffY); Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightBlue); - Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/SunkenSea/BabyGhostBellGlow").Value, vector, + Main.spriteBatch.Draw(GlowTexture.Value, vector, new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, halfSizeTexture, 1f, spriteEffects, 0f); } @@ -155,13 +162,13 @@ namespace CalamityMod.NPCs.SunkenSea { for (int k = 0; k < 2; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 68, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.BlueCrystalShard, hit.HitDirection, -1f, 0, default, 1f); } if (NPC.life <= 0) { for (int k = 0; k < 10; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 68, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.BlueCrystalShard, hit.HitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/SunkenSea/BlindedAngler.cs b/NPCs/SunkenSea/BlindedAngler.cs index ccba52a02b..d07b9c9fe4 100644 --- a/NPCs/SunkenSea/BlindedAngler.cs +++ b/NPCs/SunkenSea/BlindedAngler.cs @@ -1,10 +1,12 @@ -using CalamityMod.BiomeManagers; +using System.IO; +using CalamityMod.BiomeManagers; using CalamityMod.Items.Placeables; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System.IO; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.GameContent.Bestiary; @@ -15,9 +17,15 @@ namespace CalamityMod.NPCs.SunkenSea { public class BlindedAngler : ModNPC { + public static Asset GlowTexture; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 6; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -43,13 +51,17 @@ namespace CalamityMod.NPCs.SunkenSea NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.BlindedAngler") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.BlindedAngler") }); } @@ -66,7 +78,7 @@ namespace CalamityMod.NPCs.SunkenSea public override void AI() { Lighting.AddLight(NPC.Center, (255 - NPC.alpha) * 0f / 255f, (255 - NPC.alpha) * 0.75f / 255f, (255 - NPC.alpha) * 0.75f / 255f); - CalamityAI.PassiveSwimmingAI(NPC, Mod, 1, 100f, 0.1f, 0.1f, 3f, 3f, 0.1f); + CalamityRegularEnemyAI.PassiveSwimmingAI(NPC, Mod, 1, 100f, 0.1f, 0.1f, 3f, 3f, 0.1f); } public override void FindFrame(int frameHeight) @@ -87,10 +99,10 @@ namespace CalamityMod.NPCs.SunkenSea Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); Vector2 vector = center - screenPos; - vector -= new Vector2((float)ModContent.Request("CalamityMod/NPCs/SunkenSea/BlindedAnglerGlow").Value.Width, (float)(ModContent.Request("CalamityMod/NPCs/SunkenSea/BlindedAnglerGlow").Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; + vector -= new Vector2((float)GlowTexture.Value.Width, (float)(GlowTexture.Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; vector += halfSizeTexture * 1f + new Vector2(0f, 4f + NPC.gfxOffY); Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightBlue); - Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/SunkenSea/BlindedAnglerGlow").Value, vector, + Main.spriteBatch.Draw(GlowTexture.Value, vector, new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, halfSizeTexture, 1f, spriteEffects, 0f); } @@ -122,13 +134,13 @@ namespace CalamityMod.NPCs.SunkenSea { for (int k = 0; k < 5; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 68, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.BlueCrystalShard, hit.HitDirection, -1f, 0, default, 1f); } if (NPC.life <= 0) { for (int k = 0; k < 25; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 68, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.BlueCrystalShard, hit.HitDirection, -1f, 0, default, 1f); } if (Main.netMode != NetmodeID.Server) { diff --git a/NPCs/SunkenSea/Clam.cs b/NPCs/SunkenSea/Clam.cs index 101764fe4a..3ab87b9bfd 100644 --- a/NPCs/SunkenSea/Clam.cs +++ b/NPCs/SunkenSea/Clam.cs @@ -1,8 +1,8 @@ -using CalamityMod.BiomeManagers; +using System.IO; +using CalamityMod.BiomeManagers; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; using CalamityMod.Items.Placeables.Banners; -using System.IO; using Terraria; using Terraria.GameContent.Bestiary; using Terraria.ID; @@ -19,7 +19,7 @@ namespace CalamityMod.NPCs.SunkenSea public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 5; - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { SpriteDirection = 1 }; @@ -28,7 +28,7 @@ namespace CalamityMod.NPCs.SunkenSea public override void SetDefaults() { - NPC.damage = 30; + NPC.damage = Main.hardMode ? 60 : 30; NPC.width = 56; NPC.height = 38; NPC.defense = 9999; @@ -50,11 +50,15 @@ namespace CalamityMod.NPCs.SunkenSea NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Clam") }); @@ -94,13 +98,8 @@ namespace CalamityMod.NPCs.SunkenSea { if (!statChange) { - NPC.defense = 6; - NPC.damage = Main.expertMode ? 60 : 30; - if (Main.hardMode) - { - NPC.defense = 15; - NPC.damage = Main.expertMode ? 120 : 60; - } + NPC.defense = Main.hardMode ? 15 : 6; + NPC.damage = NPC.defDamage; statChange = true; } if (NPC.ai[0] == 0f) @@ -175,9 +174,7 @@ namespace CalamityMod.NPCs.SunkenSea } } else - { NPC.damage = 0; - } } public override bool? CanBeHitByProjectile(Projectile projectile) @@ -223,13 +220,13 @@ namespace CalamityMod.NPCs.SunkenSea { for (int k = 0; k < 5; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 37, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Obsidian, hit.HitDirection, -1f, 0, default, 1f); } if (NPC.life <= 0) { for (int k = 0; k < 50; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 37, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Obsidian, hit.HitDirection, -1f, 0, default, 1f); } if (Main.netMode != NetmodeID.Server) { diff --git a/NPCs/SunkenSea/EutrophicRay.cs b/NPCs/SunkenSea/EutrophicRay.cs index 2cee708a99..285dec213a 100644 --- a/NPCs/SunkenSea/EutrophicRay.cs +++ b/NPCs/SunkenSea/EutrophicRay.cs @@ -1,9 +1,10 @@ -using CalamityMod.BiomeManagers; +using System.IO; +using CalamityMod.BiomeManagers; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Weapons.Melee; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System.IO; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.GameContent.Bestiary; @@ -16,17 +17,23 @@ namespace CalamityMod.NPCs.SunkenSea { public bool hasBeenHit = false; + public static Asset GlowTexture; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 5; - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0); + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(); value.Position.X += 24f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() { - NPC.damage = 20; + NPC.damage = Main.hardMode ? 50 : 20; NPC.width = 116; NPC.height = 36; NPC.defense = Main.hardMode ? 15 : 5; @@ -37,7 +44,7 @@ namespace CalamityMod.NPCs.SunkenSea NPC.value = Main.hardMode ? Item.buyPrice(0, 0, 50, 0) : Item.buyPrice(0, 0, 5, 0); NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath55; - NPC.knockBackResist = 0f; + NPC.knockBackResist = 0.5f; Banner = NPC.type; BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToHeat = false; @@ -45,11 +52,15 @@ namespace CalamityMod.NPCs.SunkenSea NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.EutrophicRay") }); @@ -81,11 +92,7 @@ namespace CalamityMod.NPCs.SunkenSea if (NPC.justHit && !hasBeenHit) { hasBeenHit = true; - NPC.damage = Main.expertMode ? 40 : 20; - if (Main.hardMode) - { - NPC.damage = Main.expertMode ? 100 : 50; - } + NPC.damage = NPC.defDamage; NPC.noTileCollide = true; NPC.noGravity = true; if (NPC.Center.X < Main.player[NPC.target].Center.X) @@ -163,9 +170,7 @@ namespace CalamityMod.NPCs.SunkenSea } } else - { NPC.damage = 0; - } } public override void FindFrame(int frameHeight) @@ -186,10 +191,10 @@ namespace CalamityMod.NPCs.SunkenSea Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); Vector2 vector = center - screenPos; - vector -= new Vector2((float)ModContent.Request("CalamityMod/NPCs/SunkenSea/EutrophicRayGlow").Value.Width, (float)(ModContent.Request("CalamityMod/NPCs/SunkenSea/EutrophicRayGlow").Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; + vector -= new Vector2((float)GlowTexture.Value.Width, (float)(GlowTexture.Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; vector += halfSizeTexture * 1f + new Vector2(0f, 4f + NPC.gfxOffY); Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightBlue); - Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/SunkenSea/EutrophicRayGlow").Value, vector, + Main.spriteBatch.Draw(GlowTexture.Value, vector, new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, halfSizeTexture, 1f, spriteEffects, 0f); } @@ -210,18 +215,18 @@ namespace CalamityMod.NPCs.SunkenSea } return 0f; } - + public override void HitEffect(NPC.HitInfo hit) { for (int k = 0; k < 5; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 68, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.BlueCrystalShard, hit.HitDirection, -1f, 0, default, 1f); } if (NPC.life <= 0) { for (int k = 0; k < 25; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 68, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.BlueCrystalShard, hit.HitDirection, -1f, 0, default, 1f); } if (Main.netMode != NetmodeID.Server) { diff --git a/NPCs/SunkenSea/GhostBell.cs b/NPCs/SunkenSea/GhostBell.cs index d01e9196ec..0022e332fd 100644 --- a/NPCs/SunkenSea/GhostBell.cs +++ b/NPCs/SunkenSea/GhostBell.cs @@ -1,9 +1,10 @@ -using CalamityMod.BiomeManagers; -using CalamityMod.Items.Placeables.Banners; +using System.IO; +using CalamityMod.BiomeManagers; using CalamityMod.Items.Accessories; +using CalamityMod.Items.Placeables.Banners; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System.IO; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.GameContent.Bestiary; @@ -18,9 +19,15 @@ namespace CalamityMod.NPCs.SunkenSea { public bool hasBeenHit = false; + public static Asset GlowTexture; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 6; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -45,13 +52,17 @@ namespace CalamityMod.NPCs.SunkenSea NPC.Calamity().VulnerableToElectricity = false; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.GhostBell") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.GhostBell") }); } @@ -141,13 +152,25 @@ namespace CalamityMod.NPCs.SunkenSea Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); Vector2 vector = center - screenPos; - vector -= new Vector2((float)ModContent.Request("CalamityMod/NPCs/SunkenSea/GhostBellGlow").Value.Width, (float)(ModContent.Request("CalamityMod/NPCs/SunkenSea/GhostBellGlow").Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; + vector -= new Vector2((float)GlowTexture.Value.Width, (float)(GlowTexture.Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; vector += halfSizeTexture * 1f + new Vector2(0f, 4f + NPC.gfxOffY); Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightBlue); - Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/SunkenSea/GhostBellGlow").Value, vector, + Main.spriteBatch.Draw(GlowTexture.Value, vector, new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, halfSizeTexture, 1f, spriteEffects, 0f); } + // Can only hit the target if they're touching the tentacles + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + Vector2 npcCenter = NPC.Center; + Rectangle tentacleHitbox = new Rectangle((int)(npcCenter.X - (NPC.width / 4f)), (int)npcCenter.Y, NPC.width / 2, NPC.height / 2); + + Rectangle targetHitbox = target.Hitbox; + bool insideTentacleHitbox = targetHitbox.Intersects(tentacleHitbox); + + return insideTentacleHitbox; + } + public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) { if (hurtInfo.Damage > 0) @@ -158,13 +181,13 @@ namespace CalamityMod.NPCs.SunkenSea { for (int k = 0; k < 5; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 68, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.BlueCrystalShard, hit.HitDirection, -1f, 0, default, 1f); } if (NPC.life <= 0) { for (int k = 0; k < 25; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 68, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.BlueCrystalShard, hit.HitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/SunkenSea/GiantClam.cs b/NPCs/SunkenSea/GiantClam.cs index 782165556a..fec26d9caa 100644 --- a/NPCs/SunkenSea/GiantClam.cs +++ b/NPCs/SunkenSea/GiantClam.cs @@ -1,4 +1,6 @@ -using CalamityMod.BiomeManagers; +using System; +using System.IO; +using CalamityMod.BiomeManagers; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; @@ -14,15 +16,14 @@ using CalamityMod.Projectiles.Enemy; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; +using ReLogic.Content; using Terraria; +using Terraria.Audio; +using Terraria.GameContent; using Terraria.GameContent.Bestiary; -using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.Utilities; -using Terraria.Audio; namespace CalamityMod.NPCs.SunkenSea { @@ -35,19 +36,24 @@ namespace CalamityMod.NPCs.SunkenSea private int attack = -1; //-1 doing nothing, 0 = shell hiding, 1 = telestomp, 2 = pearl burst, 3 = pearl rain private bool attackAnim = false; private bool hasBeenHit = false; - private bool statChange = false; private bool hide = false; + public static Asset GlowTexture; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 12; NPCID.Sets.BossBestiaryPriority.Add(Type); - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { Scale = 0.4f, }; value.Position.Y += 40f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -55,7 +61,8 @@ namespace CalamityMod.NPCs.SunkenSea NPC.Calamity().canBreakPlayerDefense = true; NPC.lavaImmune = true; NPC.npcSlots = 5f; - NPC.damage = 50; + NPC.damage = Main.hardMode ? 100 : 50; + NPC.defense = Main.hardMode ? 35 : 10; NPC.width = 160; NPC.height = 120; NPC.defense = 9999; @@ -72,11 +79,15 @@ namespace CalamityMod.NPCs.SunkenSea NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.GiantClam") }); @@ -90,7 +101,6 @@ namespace CalamityMod.NPCs.SunkenSea writer.Write(NPC.dontTakeDamage); writer.Write(NPC.chaseable); writer.Write(hasBeenHit); - writer.Write(statChange); writer.Write(hide); for (int i = 0; i < 2; i++) writer.Write(NPC.Calamity().newAI[i]); @@ -104,7 +114,6 @@ namespace CalamityMod.NPCs.SunkenSea NPC.dontTakeDamage = reader.ReadBoolean(); NPC.chaseable = reader.ReadBoolean(); hasBeenHit = reader.ReadBoolean(); - statChange = reader.ReadBoolean(); hide = reader.ReadBoolean(); for (int i = 0; i < 2; i++) NPC.Calamity().newAI[i] = reader.ReadSingle(); @@ -113,41 +122,34 @@ namespace CalamityMod.NPCs.SunkenSea public override void AI() { NPC.TargetClosest(true); + Player player = Main.player[NPC.target]; CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity(); + if (NPC.justHit && hitAmount < 5) { ++hitAmount; hasBeenHit = true; } + NPC.chaseable = hasBeenHit; + if (hitAmount == 5) { if (Main.netMode != NetmodeID.Server) { if (!Main.player[NPC.target].dead && Main.player[NPC.target].active) - { player.AddBuff(ModContent.BuffType(), 2); //CLAM INVASION - } } if (!hide) Lighting.AddLight(NPC.Center, 0f, (255 - NPC.alpha) * 2.5f / 255f, (255 - NPC.alpha) * 2.5f / 255f); - if (!statChange) - { - NPC.defense = 10; - NPC.damage = Main.expertMode ? 100 : 50; - if (Main.hardMode) - { - NPC.defense = 35; - NPC.damage = Main.expertMode ? 200 : 100; - } - statChange = true; - } - if (NPC.ai[0] < 240f) { + // Avoid cheap bullshit + NPC.damage = 0; + NPC.ai[0] += 1f; hide = false; } @@ -155,14 +157,18 @@ namespace CalamityMod.NPCs.SunkenSea { if (attack == -1) { + // Avoid cheap bullshit + NPC.damage = 0; + attack = Main.rand.Next(2); if (attack == 0) - { attack = Main.rand.Next(2); //rarer chance of doing the hiding clam - } } else if (attack == 0) { + // Avoid cheap bullshit + NPC.damage = 0; + hide = true; NPC.defense = 9999; NPC.ai[1] += 1f; @@ -191,11 +197,14 @@ namespace CalamityMod.NPCs.SunkenSea } else if (NPC.ai[2] == 1f) { + // Avoid cheap bullshit NPC.damage = 0; + NPC.chaseable = false; NPC.dontTakeDamage = true; NPC.noGravity = true; NPC.noTileCollide = true; + NPC.alpha += Main.hardMode ? 8 : 5; if (NPC.alpha >= 255) { @@ -212,7 +221,7 @@ namespace CalamityMod.NPCs.SunkenSea { if (Main.rand.NextBool()) { - int attackDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, 226, 0f, 0f, 200, default, 1.5f); + int attackDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Electric, 0f, 0f, 200, default, 1.5f); Main.dust[attackDust].noGravity = true; Main.dust[attackDust].velocity *= 0.75f; Main.dust[attackDust].fadeIn = 1.3f; @@ -224,14 +233,13 @@ namespace CalamityMod.NPCs.SunkenSea vector *= 34f; Main.dust[attackDust].position = NPC.Center - vector; } + NPC.alpha -= Main.hardMode ? 7 : 4; if (NPC.alpha <= 0) { - NPC.damage = Main.expertMode ? 100 : 50; - if (Main.hardMode) - { - NPC.damage = Main.expertMode ? 200 : 100; - } + // Set damage + NPC.damage = NPC.defDamage; + NPC.chaseable = true; NPC.dontTakeDamage = false; NPC.alpha = 0; @@ -241,6 +249,9 @@ namespace CalamityMod.NPCs.SunkenSea } else if (NPC.ai[2] == 3f) { + // Set damage + NPC.damage = NPC.defDamage; + NPC.velocity.Y += 0.8f; attackAnim = true; if (NPC.Center.Y > (player.Center.Y - (float)(NPC.height / 2) + player.gfxOffY - 15f)) @@ -254,19 +265,22 @@ namespace CalamityMod.NPCs.SunkenSea { if (NPC.velocity.Y == 0f) { + // Avoid cheap bullshit + NPC.damage = 0; + NPC.ai[2] = 0f; NPC.ai[0] = 0f; NPC.netUpdate = true; NPC.noGravity = false; attack = -1; - SoundEngine.PlaySound(SlamSound, NPC.position); + SoundEngine.PlaySound(SlamSound, NPC.Center); if (Main.netMode != NetmodeID.Server) { for (int stompDustArea = (int)NPC.position.X - 30; stompDustArea < (int)NPC.position.X + NPC.width + 60; stompDustArea += 30) { for (int stompDustAmount = 0; stompDustAmount < 5; stompDustAmount++) { - int stompDust = Dust.NewDust(new Vector2(NPC.position.X - 30f, NPC.position.Y + (float)NPC.height), NPC.width + 30, 4, 33, 0f, 0f, 100, default, 1.5f); + int stompDust = Dust.NewDust(new Vector2(NPC.position.X - 30f, NPC.position.Y + (float)NPC.height), NPC.width + 30, 4, DustID.Water, 0f, 0f, 100, default, 1.5f); Main.dust[stompDust].velocity *= 0.2f; } int stompGore = Gore.NewGore(NPC.GetSource_FromAI(), new Vector2((float)(stompDustArea - 30), NPC.position.Y + (float)NPC.height - 12f), default, Main.rand.Next(61, 64), 1f); @@ -274,6 +288,7 @@ namespace CalamityMod.NPCs.SunkenSea } } } + NPC.velocity.Y += 0.8f; } } @@ -355,38 +370,41 @@ namespace CalamityMod.NPCs.SunkenSea } else if (attack == 2) { - SoundEngine.PlaySound(SoundID.Item67, NPC.position); - Vector2 clamPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(NPC.velocity.X, NPC.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int projectileShot = ModContent.ProjectileType(); - int damage = Main.expertMode ? 28 : 35; - float speed = 5f; - Vector2 vector = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)(NPC.height / 2)); - float targetXDist = Main.player[NPC.target].position.X + (float)Main.player[NPC.target].width * 0.5f - vector.X + (float)Main.rand.Next(-20, 21); - float targetYDist = Main.player[NPC.target].position.Y + (float)Main.player[NPC.target].height * 0.5f - vector.Y + (float)Main.rand.Next(-20, 21); - float targetDistance = (float)Math.Sqrt((double)(targetXDist * targetXDist + targetYDist * targetYDist)); - targetDistance = speed / targetDistance; - targetXDist *= targetDistance; - targetYDist *= targetDistance; - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center.X, NPC.Center.Y, targetXDist, targetYDist, projectileShot, damage, 0f, Main.myPlayer, 0f, 0f); - for (int i = 0; i < 4; i++) + SoundEngine.PlaySound(SoundID.Item67, NPC.Center); + if (Main.netMode != NetmodeID.MultiplayerClient) { - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(NPC.GetSource_FromAI(), clamPosition.X, clamPosition.Y, (float)(Math.Sin(offsetAngle) * 3f), (float)(Math.Cos(offsetAngle) * 3f), projectileShot, damage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(NPC.GetSource_FromAI(), clamPosition.X, clamPosition.Y, (float)(-Math.Sin(offsetAngle) * 3f), (float)(-Math.Cos(offsetAngle) * 3f), projectileShot, damage, 0f, Main.myPlayer, 0f, 0f); + Vector2 clamPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + float spread = 45f * 0.0174f; + double startAngle = Math.Atan2(NPC.velocity.X, NPC.velocity.Y) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + int projectileShot = ModContent.ProjectileType(); + int damage = Main.masterMode ? 23 : Main.expertMode ? 28 : 35; + float speed = 5f; + Vector2 vector = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)(NPC.height / 2)); + float targetXDist = Main.player[NPC.target].position.X + (float)Main.player[NPC.target].width * 0.5f - vector.X + (float)Main.rand.Next(-20, 21); + float targetYDist = Main.player[NPC.target].position.Y + (float)Main.player[NPC.target].height * 0.5f - vector.Y + (float)Main.rand.Next(-20, 21); + float targetDistance = (float)Math.Sqrt((double)(targetXDist * targetXDist + targetYDist * targetYDist)); + targetDistance = speed / targetDistance; + targetXDist *= targetDistance; + targetYDist *= targetDistance; + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center.X, NPC.Center.Y, targetXDist, targetYDist, projectileShot, damage, 0f, Main.myPlayer, 0f, 0f); + for (int i = 0; i < 4; i++) + { + offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; + Projectile.NewProjectile(NPC.GetSource_FromAI(), clamPosition.X, clamPosition.Y, (float)(Math.Sin(offsetAngle) * 3f), (float)(Math.Cos(offsetAngle) * 3f), projectileShot, damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), clamPosition.X, clamPosition.Y, (float)(-Math.Sin(offsetAngle) * 3f), (float)(-Math.Cos(offsetAngle) * 3f), projectileShot, damage, 0f, Main.myPlayer, 0f, 0f); + } } attack = -1; NPC.ai[3] = 0f; } else if (attack == 3) { + SoundEngine.PlaySound(SoundID.Item68, NPC.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { - SoundEngine.PlaySound(SoundID.Item68, NPC.position); - int damage = Main.expertMode ? 28 : 35; + int damage = Main.masterMode ? 23 : Main.expertMode ? 28 : 35; float shotSpacing = 750f; for (int i = 0; i < 11; i++) { @@ -475,13 +493,13 @@ namespace CalamityMod.NPCs.SunkenSea { for (int k = 0; k < 5; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 37, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Obsidian, hit.HitDirection, -1f, 0, default, 1f); } if (NPC.life <= 0) { for (int k = 0; k < 50; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 37, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Obsidian, hit.HitDirection, -1f, 0, default, 1f); } if (Main.netMode != NetmodeID.Server) { @@ -496,15 +514,15 @@ namespace CalamityMod.NPCs.SunkenSea public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = TextureAssets.Npc[NPC.type].Value; Main.EntitySpriteDraw(texture, NPC.Center - screenPos, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, NPC.frame.Size() * 0.5f, NPC.scale, 0, 0); return false; } public override void PostDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { - Texture2D texture = ModContent.Request(Texture).Value; - Texture2D glowmask = ModContent.Request("CalamityMod/NPCs/SunkenSea/GiantClamGlow").Value; + Texture2D texture = TextureAssets.Npc[NPC.type].Value; + Texture2D glowmask = GlowTexture.Value; SpriteEffects spriteEffects = SpriteEffects.None; Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); Vector2 halfSizeTexture = new Vector2((float)(texture.Width / 2), (float)(texture.Height / Main.npcFrameCount[NPC.type] / 2)); diff --git a/NPCs/SunkenSea/PrismBack.cs b/NPCs/SunkenSea/PrismBack.cs index 32cd648cf8..037b2c6d94 100644 --- a/NPCs/SunkenSea/PrismBack.cs +++ b/NPCs/SunkenSea/PrismBack.cs @@ -1,10 +1,12 @@ -using CalamityMod.BiomeManagers; +using System.IO; +using CalamityMod.BiomeManagers; using CalamityMod.Items.Placeables; using CalamityMod.Items.Placeables.Banners; +using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System.IO; +using System; using Terraria; using Terraria.GameContent; using Terraria.GameContent.Bestiary; @@ -12,25 +14,33 @@ using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.Utilities; +using ReLogic.Content; + namespace CalamityMod.NPCs.SunkenSea { public class PrismBack : ModNPC { + public static Asset GlowTexture; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 5; - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { PortraitPositionXOverride = 0 }; value.Position.X += 15; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() { NPC.noGravity = true; - NPC.damage = Main.hardMode ? 40 : 20; //normal damage + NPC.damage = Main.hardMode ? 40 : 20; NPC.width = 72; NPC.height = 58; NPC.defense = Main.hardMode ? 25 : 10; @@ -50,13 +60,17 @@ namespace CalamityMod.NPCs.SunkenSea NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.PrismBack") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.PrismBack") }); } @@ -74,44 +88,44 @@ namespace CalamityMod.NPCs.SunkenSea { if ((NPC.Center.Y + 10f) > Main.player[NPC.target].Center.Y) { - if (CalamityWorld.death) //gotta do damage scaling directly + if (CalamityWorld.death) { - NPC.damage = Main.hardMode ? 240 : 120; + NPC.damage = NPC.defDamage * 3; } else if (CalamityWorld.revenge) { - NPC.damage = Main.hardMode ? 168 : 84; + NPC.damage = (int)Math.Round(NPC.defDamage * 2.75); } else if (Main.expertMode) { - NPC.damage = Main.hardMode ? 160 : 80; + NPC.damage = (int)Math.Round(NPC.defDamage * 2.5); } else { - NPC.damage = Main.hardMode ? 80 : 40; + NPC.damage = (int)Math.Round(NPC.defDamage * 1.25); } } else { - if (CalamityWorld.death) //gotta do damage scaling directly + if (CalamityWorld.death) { - NPC.damage = Main.hardMode ? 120 : 60; + NPC.damage = (int)Math.Round(NPC.defDamage * 2.5); } else if (CalamityWorld.revenge) { - NPC.damage = Main.hardMode ? 84 : 42; + NPC.damage = (int)Math.Round(NPC.defDamage * 2.25); } else if (Main.expertMode) { - NPC.damage = Main.hardMode ? 80 : 40; + NPC.damage = NPC.defDamage * 2; } else { - NPC.damage = Main.hardMode ? 40 : 20; + NPC.damage = NPC.defDamage; } } Lighting.AddLight(NPC.Center, (255 - NPC.alpha) * 0f / 255f, (255 - NPC.alpha) * 0.75f / 255f, (255 - NPC.alpha) * 0.75f / 255f); - CalamityAI.PassiveSwimmingAI(NPC, Mod, 2, 0f, 0f, 0f, 0f, 0f, 0.1f); + CalamityRegularEnemyAI.PassiveSwimmingAI(NPC, Mod, 2, 0f, 0f, 0f, 0f, 0f, 0.1f); } public override void FindFrame(int frameHeight) @@ -132,10 +146,10 @@ namespace CalamityMod.NPCs.SunkenSea Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); Vector2 vector = center - screenPos; - vector -= new Vector2((float)ModContent.Request("CalamityMod/NPCs/SunkenSea/PrismBackGlow").Value.Width, (float)(ModContent.Request("CalamityMod/NPCs/SunkenSea/PrismBackGlow").Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; + vector -= new Vector2((float)GlowTexture.Value.Width, (float)(GlowTexture.Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; vector += halfSizeTexture * 1f + new Vector2(0f, 4f + NPC.gfxOffY); Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.Blue); - Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/SunkenSea/PrismBackGlow").Value, vector, + Main.spriteBatch.Draw(GlowTexture.Value, vector, new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, halfSizeTexture, 1f, spriteEffects, 0f); } @@ -167,7 +181,7 @@ namespace CalamityMod.NPCs.SunkenSea { for (int k = 0; k < 5; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 68, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.BlueCrystalShard, hit.HitDirection, -1f, 0, default, 1f); } if (NPC.life <= 0) { @@ -181,7 +195,7 @@ namespace CalamityMod.NPCs.SunkenSea } for (int k = 0; k < 25; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 68, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.BlueCrystalShard, hit.HitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/SunkenSea/SeaFloaty.cs b/NPCs/SunkenSea/SeaFloaty.cs index 6f38094dd5..5d1d30a8af 100644 --- a/NPCs/SunkenSea/SeaFloaty.cs +++ b/NPCs/SunkenSea/SeaFloaty.cs @@ -1,6 +1,6 @@ -using CalamityMod.BiomeManagers; +using System.IO; +using CalamityMod.BiomeManagers; using CalamityMod.Items.Placeables.Banners; -using System.IO; using Terraria; using Terraria.GameContent.Bestiary; using Terraria.ID; @@ -15,7 +15,7 @@ namespace CalamityMod.NPCs.SunkenSea public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 6; - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { SpriteDirection = 1 }; @@ -43,7 +43,7 @@ namespace CalamityMod.NPCs.SunkenSea public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.SeaFloaty") }); @@ -151,13 +151,13 @@ namespace CalamityMod.NPCs.SunkenSea { for (int k = 0; k < 5; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 68, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.BlueCrystalShard, hit.HitDirection, -1f, 0, default, 1f); } if (NPC.life <= 0) { for (int k = 0; k < 25; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 68, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.BlueCrystalShard, hit.HitDirection, -1f, 0, default, 1f); } if (Main.netMode != NetmodeID.Server) { diff --git a/NPCs/SunkenSea/SeaMinnow.cs b/NPCs/SunkenSea/SeaMinnow.cs index 0b4a2fa887..4aaa21eb56 100644 --- a/NPCs/SunkenSea/SeaMinnow.cs +++ b/NPCs/SunkenSea/SeaMinnow.cs @@ -1,12 +1,14 @@ -using CalamityMod.BiomeManagers; -using CalamityMod.Items.Placeables.Banners; +using System; +using CalamityMod.BiomeManagers; using CalamityMod.Items.Critters; -using System; +using CalamityMod.Items.Placeables.Banners; +using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; using Terraria; using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.Utilities; + namespace CalamityMod.NPCs.SunkenSea { public class SeaMinnow : ModNPC @@ -40,7 +42,7 @@ namespace CalamityMod.NPCs.SunkenSea public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.SeaMinnow") }); @@ -48,7 +50,7 @@ namespace CalamityMod.NPCs.SunkenSea public override void AI() { - CalamityAI.PassiveSwimmingAI(NPC, Mod, 3, 150f, 0.25f, 0.15f, 6f, 6f, 0.05f); + CalamityRegularEnemyAI.PassiveSwimmingAI(NPC, Mod, 3, 150f, 0.25f, 0.15f, 6f, 6f, 0.05f); NPC.spriteDirection = (NPC.direction > 0) ? 1 : -1; NPC.noGravity = true; bool shouldSwimAway = false; @@ -213,7 +215,7 @@ namespace CalamityMod.NPCs.SunkenSea { for (int k = 0; k < 5; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 68, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.BlueCrystalShard, hit.HitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/SunkenSea/SeaSerpent1.cs b/NPCs/SunkenSea/SeaSerpent1.cs index 8a332e4ec3..7a678cddb8 100644 --- a/NPCs/SunkenSea/SeaSerpent1.cs +++ b/NPCs/SunkenSea/SeaSerpent1.cs @@ -1,8 +1,8 @@ -using CalamityMod.BiomeManagers; +using System; +using CalamityMod.BiomeManagers; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Weapons.Magic; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.GameContent.Bestiary; using Terraria.ID; @@ -19,7 +19,7 @@ namespace CalamityMod.NPCs.SunkenSea public override void SetStaticDefaults() { - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { CustomTexturePath = "CalamityMod/ExtraTextures/Bestiary/SeaSerpent_Bestiary", PortraitPositionXOverride = 40, @@ -54,13 +54,17 @@ namespace CalamityMod.NPCs.SunkenSea NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.SeaSerpent") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.SeaSerpent") }); } @@ -73,7 +77,7 @@ namespace CalamityMod.NPCs.SunkenSea { if (Main.rand.NextBool()) { - Dust dust = Dust.NewDustDirect(NPC.position, NPC.width, NPC.height, 204, 0f, 0f, 150, default(Color), 0.3f); + Dust dust = Dust.NewDustDirect(NPC.position, NPC.width, NPC.height, DustID.TreasureSparkle, 0f, 0f, 150, default(Color), 0.3f); dust.fadeIn = 0.75f; dust.velocity *= 0.1f; dust.noLight = true; @@ -309,13 +313,13 @@ namespace CalamityMod.NPCs.SunkenSea { for (int k = 0; k < 3; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 37, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Obsidian, hit.HitDirection, -1f, 0, default, 1f); } if (NPC.life <= 0) { for (int k = 0; k < 10; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 37, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Obsidian, hit.HitDirection, -1f, 0, default, 1f); } if (Main.netMode != NetmodeID.Server) { diff --git a/NPCs/SunkenSea/SeaSerpent2.cs b/NPCs/SunkenSea/SeaSerpent2.cs index fc7e14a9cb..d64d5cc51c 100644 --- a/NPCs/SunkenSea/SeaSerpent2.cs +++ b/NPCs/SunkenSea/SeaSerpent2.cs @@ -41,6 +41,10 @@ namespace CalamityMod.NPCs.SunkenSea NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) @@ -50,6 +54,9 @@ namespace CalamityMod.NPCs.SunkenSea public override void AI() { + // Avoid cheap bullshit + NPC.damage = 0; + Lighting.AddLight(NPC.Center, (255 - NPC.alpha) * 0f / 255f, (255 - NPC.alpha) * 0.30f / 255f, (255 - NPC.alpha) * 0.30f / 255f); if (NPC.ai[2] > 0f) @@ -104,7 +111,8 @@ namespace CalamityMod.NPCs.SunkenSea segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); targetXDist = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - segmentPosition.X; targetYDist = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - segmentPosition.Y; - } catch + } + catch { } NPC.rotation = (float)System.Math.Atan2((double)targetYDist, (double)targetXDist) + 1.57f; @@ -133,13 +141,13 @@ namespace CalamityMod.NPCs.SunkenSea { for (int k = 0; k < 3; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 37, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Obsidian, hit.HitDirection, -1f, 0, default, 1f); } if (NPC.life <= 0) { for (int k = 0; k < 10; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 37, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Obsidian, hit.HitDirection, -1f, 0, default, 1f); } if (Main.netMode != NetmodeID.Server) { diff --git a/NPCs/SunkenSea/SeaSerpent3.cs b/NPCs/SunkenSea/SeaSerpent3.cs index 7c8873f0fa..3274777561 100644 --- a/NPCs/SunkenSea/SeaSerpent3.cs +++ b/NPCs/SunkenSea/SeaSerpent3.cs @@ -39,6 +39,10 @@ namespace CalamityMod.NPCs.SunkenSea NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) @@ -48,6 +52,9 @@ namespace CalamityMod.NPCs.SunkenSea public override void AI() { + // Avoid cheap bullshit + NPC.damage = 0; + Lighting.AddLight(NPC.Center, (255 - NPC.alpha) * 0f / 255f, (255 - NPC.alpha) * 0.30f / 255f, (255 - NPC.alpha) * 0.30f / 255f); if (NPC.ai[2] > 0f) @@ -102,7 +109,8 @@ namespace CalamityMod.NPCs.SunkenSea segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); targetXDist = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - segmentPosition.X; targetYDist = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - segmentPosition.Y; - } catch + } + catch { } NPC.rotation = (float)System.Math.Atan2((double)targetYDist, (double)targetXDist) + 1.57f; @@ -131,13 +139,13 @@ namespace CalamityMod.NPCs.SunkenSea { for (int k = 0; k < 3; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 37, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Obsidian, hit.HitDirection, -1f, 0, default, 1f); } if (NPC.life <= 0) { for (int k = 0; k < 10; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 37, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Obsidian, hit.HitDirection, -1f, 0, default, 1f); } if (Main.netMode != NetmodeID.Server) { diff --git a/NPCs/SunkenSea/SeaSerpent4.cs b/NPCs/SunkenSea/SeaSerpent4.cs index 9442d632d8..4d869b2c09 100644 --- a/NPCs/SunkenSea/SeaSerpent4.cs +++ b/NPCs/SunkenSea/SeaSerpent4.cs @@ -39,6 +39,10 @@ namespace CalamityMod.NPCs.SunkenSea NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) @@ -48,6 +52,9 @@ namespace CalamityMod.NPCs.SunkenSea public override void AI() { + // Avoid cheap bullshit + NPC.damage = 0; + Lighting.AddLight(NPC.Center, (255 - NPC.alpha) * 0f / 255f, (255 - NPC.alpha) * 0.30f / 255f, (255 - NPC.alpha) * 0.30f / 255f); if (NPC.ai[2] > 0f) @@ -102,7 +109,8 @@ namespace CalamityMod.NPCs.SunkenSea segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); targetXDist = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - segmentPosition.X; targetYDist = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - segmentPosition.Y; - } catch + } + catch { } NPC.rotation = (float)System.Math.Atan2((double)targetYDist, (double)targetXDist) + 1.57f; @@ -131,13 +139,13 @@ namespace CalamityMod.NPCs.SunkenSea { for (int k = 0; k < 3; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 37, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Obsidian, hit.HitDirection, -1f, 0, default, 1f); } if (NPC.life <= 0) { for (int k = 0; k < 10; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 37, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Obsidian, hit.HitDirection, -1f, 0, default, 1f); } if (Main.netMode != NetmodeID.Server) { diff --git a/NPCs/SunkenSea/SeaSerpent5.cs b/NPCs/SunkenSea/SeaSerpent5.cs index 6728bd8461..671e3ea62f 100644 --- a/NPCs/SunkenSea/SeaSerpent5.cs +++ b/NPCs/SunkenSea/SeaSerpent5.cs @@ -39,6 +39,10 @@ namespace CalamityMod.NPCs.SunkenSea NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) @@ -48,6 +52,9 @@ namespace CalamityMod.NPCs.SunkenSea public override void AI() { + // Avoid cheap bullshit + NPC.damage = 0; + Lighting.AddLight(NPC.Center, (255 - NPC.alpha) * 0f / 255f, (255 - NPC.alpha) * 0.30f / 255f, (255 - NPC.alpha) * 0.30f / 255f); if (NPC.ai[2] > 0f) @@ -102,7 +109,8 @@ namespace CalamityMod.NPCs.SunkenSea segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); targetXDist = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - segmentPosition.X; targetYDist = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - segmentPosition.Y; - } catch + } + catch { } NPC.rotation = (float)System.Math.Atan2((double)targetYDist, (double)targetXDist) + 1.57f; @@ -131,13 +139,13 @@ namespace CalamityMod.NPCs.SunkenSea { for (int k = 0; k < 3; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 37, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Obsidian, hit.HitDirection, -1f, 0, default, 1f); } if (NPC.life <= 0) { for (int k = 0; k < 10; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 37, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Obsidian, hit.HitDirection, -1f, 0, default, 1f); } if (Main.netMode != NetmodeID.Server) { diff --git a/NPCs/SupremeCalamitas/BrimstoneHeart.cs b/NPCs/SupremeCalamitas/BrimstoneHeart.cs index 17129ee0f2..fd529f0e33 100644 --- a/NPCs/SupremeCalamitas/BrimstoneHeart.cs +++ b/NPCs/SupremeCalamitas/BrimstoneHeart.cs @@ -1,11 +1,11 @@ -using CalamityMod.Graphics.Primitives; +using System; +using System.Collections.Generic; +using System.IO; +using CalamityMod.Graphics.Primitives; using CalamityMod.Projectiles.Rogue; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.Collections.Generic; -using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -37,7 +37,6 @@ namespace CalamityMod.NPCs.SupremeCalamitas NPC.alpha = 255; NPC.noGravity = true; NPC.noTileCollide = true; - NPC.canGhostHeal = false; NPC.hide = true; NPC.HitSound = SoundID.NPCHit13; NPC.DeathSound = SoundID.NPCDeath1; diff --git a/NPCs/SupremeCalamitas/CirrusHeadIcon.png b/NPCs/SupremeCalamitas/CirrusHeadIcon.png index 8811825cc7..b322de98ea 100644 Binary files a/NPCs/SupremeCalamitas/CirrusHeadIcon.png and b/NPCs/SupremeCalamitas/CirrusHeadIcon.png differ diff --git a/NPCs/SupremeCalamitas/HoodedHeadIcon.png b/NPCs/SupremeCalamitas/HoodedHeadIcon.png index 9fa8485791..131e3fc850 100644 Binary files a/NPCs/SupremeCalamitas/HoodedHeadIcon.png and b/NPCs/SupremeCalamitas/HoodedHeadIcon.png differ diff --git a/NPCs/SupremeCalamitas/HoodedHeadIconP2.png b/NPCs/SupremeCalamitas/HoodedHeadIconP2.png deleted file mode 100644 index b58cdcfaad..0000000000 Binary files a/NPCs/SupremeCalamitas/HoodedHeadIconP2.png and /dev/null differ diff --git a/NPCs/SupremeCalamitas/HoodlessHeadIcon.png b/NPCs/SupremeCalamitas/HoodlessHeadIcon.png index 6c12e09c8e..eba5d41efc 100644 Binary files a/NPCs/SupremeCalamitas/HoodlessHeadIcon.png and b/NPCs/SupremeCalamitas/HoodlessHeadIcon.png differ diff --git a/NPCs/SupremeCalamitas/HoodlessHeadIconP2.png b/NPCs/SupremeCalamitas/HoodlessHeadIconP2.png deleted file mode 100644 index dc1377a577..0000000000 Binary files a/NPCs/SupremeCalamitas/HoodlessHeadIconP2.png and /dev/null differ diff --git a/NPCs/SupremeCalamitas/SepulcherArm.cs b/NPCs/SupremeCalamitas/SepulcherArm.cs index d8f6ff4630..0897d65b50 100644 --- a/NPCs/SupremeCalamitas/SepulcherArm.cs +++ b/NPCs/SupremeCalamitas/SepulcherArm.cs @@ -1,7 +1,8 @@ -using CalamityMod.World; +using System.IO; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System.IO; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.ID; @@ -59,10 +60,19 @@ namespace CalamityMod.NPCs.SupremeCalamitas } public Player Target => Main.player[NPC.target]; public SepulcherArmLimb[] Limbs = new SepulcherArmLimb[4]; + + public static Asset HandTexture; + public static Asset ForearmTexture; + public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.SepulcherHead.DisplayName"); public override void SetStaticDefaults() { this.HideFromBestiary(); + if (!Main.dedServ) + { + HandTexture = ModContent.Request("CalamityMod/NPCs/SupremeCalamitas/SepulcherHand", AssetRequestMode.AsyncLoad); + ForearmTexture = ModContent.Request("CalamityMod/NPCs/SupremeCalamitas/SepulcherForearm", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -177,8 +187,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor_Unused) { Texture2D armTexture = TextureAssets.Npc[NPC.type].Value; - Texture2D foreArmTexture = ModContent.Request("CalamityMod/NPCs/SupremeCalamitas/SepulcherForearm").Value; - Texture2D handTexture = ModContent.Request("CalamityMod/NPCs/SupremeCalamitas/SepulcherHand").Value; + Texture2D foreArmTexture = ForearmTexture.Value; + Texture2D handTexture = HandTexture.Value; Vector2 forearmDrawPosition = Limbs[0].Center - screenPos; Color drawColor = Lighting.GetColor((int)(Limbs[0].Center.X / 16), (int)(Limbs[0].Center.Y / 16)); diff --git a/NPCs/SupremeCalamitas/SepulcherBody.cs b/NPCs/SupremeCalamitas/SepulcherBody.cs index 499ffeb018..a5be1ff57c 100644 --- a/NPCs/SupremeCalamitas/SepulcherBody.cs +++ b/NPCs/SupremeCalamitas/SepulcherBody.cs @@ -1,7 +1,8 @@ -using CalamityMod.World; +using System.IO; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System.IO; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.ID; @@ -16,9 +17,16 @@ namespace CalamityMod.NPCs.SupremeCalamitas public NPC AheadSegment => Main.npc[(int)NPC.ai[1]]; public NPC HeadSegment => Main.npc[(int)NPC.ai[2]]; public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.SepulcherHead.DisplayName"); + + public static Asset AltTexture; + public override void SetStaticDefaults() { this.HideFromBestiary(); + if (!Main.dedServ) + { + AltTexture = ModContent.Request(Texture + "Alt", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -90,7 +98,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas { for (int i = 0; i < 2; i++) { - Dust fire = Dust.NewDustDirect(NPC.position, NPC.width, NPC.height, 182, 0f, 0f, 100, default, 2f); + Dust fire = Dust.NewDustDirect(NPC.position, NPC.width, NPC.height, DustID.TheDestroyer, 0f, 0f, 100, default, 2f); fire.noGravity = true; fire.noLight = true; } @@ -121,7 +129,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = NPC.localAI[3] / 2f % 2f == 0f ? ModContent.Request("CalamityMod/NPCs/SupremeCalamitas/SepulcherBodyAlt").Value : TextureAssets.Npc[NPC.type].Value; + Texture2D texture2D15 = NPC.localAI[3] / 2f % 2f == 0f ? AltTexture.Value : TextureAssets.Npc[NPC.type].Value; Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / 2)); Vector2 drawLocation = NPC.Center - screenPos; diff --git a/NPCs/SupremeCalamitas/SepulcherBodyEnergyBall.cs b/NPCs/SupremeCalamitas/SepulcherBodyEnergyBall.cs index 4ed48c7d16..be44276128 100644 --- a/NPCs/SupremeCalamitas/SepulcherBodyEnergyBall.cs +++ b/NPCs/SupremeCalamitas/SepulcherBodyEnergyBall.cs @@ -1,14 +1,14 @@ -using CalamityMod.Events; +using System.IO; +using CalamityMod.Events; using CalamityMod.Projectiles.Boss; using CalamityMod.Projectiles.Typeless; using CalamityMod.World; using Microsoft.Xna.Framework; -using System.IO; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.NPCs.SupremeCalamitas { @@ -18,6 +18,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas public NPC AheadSegment => Main.npc[(int)NPC.ai[1]]; public NPC HeadSegment => Main.npc[(int)NPC.ai[2]]; public ref float AttackTimer => ref NPC.localAI[0]; + public int NoStartAttack = 240; public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.SepulcherHead.DisplayName"); public override void SetStaticDefaults() { @@ -66,6 +67,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas public override void AI() { + NoStartAttack--; + if (NPC.ai[2] > 0f) NPC.realLife = (int)NPC.ai[2]; @@ -88,7 +91,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas { for (int i = 0; i < 2; i++) { - Dust fire = Dust.NewDustDirect(NPC.position, NPC.width, NPC.height, 182, 0f, 0f, 100, default, 2f); + Dust fire = Dust.NewDustDirect(NPC.position, NPC.width, NPC.height, DustID.TheDestroyer, 0f, 0f, 100, default, 2f); fire.noGravity = true; fire.noLight = true; } @@ -103,9 +106,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas else NPC.alpha = HeadSegment.alpha; - AttackTimer += BossRushEvent.BossRushActive ? 1.5f : 1f; + /*AttackTimer += BossRushEvent.BossRushActive ? 1.5f : 1f; float attackgate = !HeadSegment.Calamity().unbreakableDR && Main.zenithWorld ? 450f : 900f; - if (AttackTimer >= attackgate) + if (AttackTimer >= attackgate && NoStartAttack <= 0) { AttackTimer = 0f; if (Main.netMode != NetmodeID.MultiplayerClient) @@ -114,16 +117,19 @@ namespace CalamityMod.NPCs.SupremeCalamitas int damage = NPC.GetProjectileDamage(type); int totalProjectiles = 4; float radians = MathHelper.TwoPi / totalProjectiles; - Vector2 spinningPoint = Vector2.Normalize(new Vector2(-1f, -1f)); + float velocity = 1f; + float projectileVelocityToPass = 15f; + + Vector2 spinningPoint = Vector2.Normalize(new Vector2(-velocity, -velocity)); for (int k = 0; k < totalProjectiles; k++) { - Vector2 velocity = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, velocity, type, damage, 0f, Main.myPlayer); + Vector2 projectileVelocity = spinningPoint.RotatedBy(radians * k); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, projectileVelocity, type, damage, 0f, Main.myPlayer, 0f, 0f, projectileVelocityToPass); } NPC.netUpdate = true; } SoundEngine.PlaySound(SupremeCalamitas.BrimstoneShotSound, NPC.Center); - } + }*/ if (Main.npc.IndexInRange((int)NPC.ai[1])) { diff --git a/NPCs/SupremeCalamitas/SepulcherHead.cs b/NPCs/SupremeCalamitas/SepulcherHead.cs index 3b33ce86eb..67df4e9c2f 100644 --- a/NPCs/SupremeCalamitas/SepulcherHead.cs +++ b/NPCs/SupremeCalamitas/SepulcherHead.cs @@ -1,15 +1,18 @@ -using CalamityMod.Events; +using System; +using System.IO; +using CalamityMod.Events; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; using Terraria; +using Terraria.Audio; using Terraria.GameContent; using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; +using static Humanizer.In; namespace CalamityMod.NPCs.SupremeCalamitas { @@ -21,11 +24,12 @@ namespace CalamityMod.NPCs.SupremeCalamitas private const int maxLength = 52; private float passedVar = 0f; private bool TailSpawned = false; + private float AttackCooldown = 0; public override void SetStaticDefaults() { NPCID.Sets.BossBestiaryPriority.Add(Type); - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { PortraitPositionXOverride = 30, PortraitPositionYOverride = 0, @@ -69,9 +73,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas int associatedNPCType = ModContent.NPCType(); bestiaryEntry.UIInfoProvider = new CommonEnemyUICollectionInfoProvider(ContentSamples.NpcBestiaryCreditIdsByNpcNetIds[associatedNPCType], quickUnlock: true); - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Sepulcher") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Sepulcher") }); } @@ -94,6 +98,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas public override void AI() { + if (AttackCooldown > 0) + AttackCooldown--; CalamityGlobalNPC.SCalWorm = NPC.whoAmI; // Get a target @@ -187,15 +193,16 @@ namespace CalamityMod.NPCs.SupremeCalamitas NPC.HitEffect(); NPC.active = false; NPC.netUpdate = true; + return; } else NPC.Opacity = MathHelper.Clamp(NPC.Opacity + 0.165f, 0f, 1f); - Vector2 segmentLocation = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); - float targetX = Main.player[NPC.target].position.X + (Main.player[NPC.target].width / 2); - float targetY = Main.player[NPC.target].position.Y + (Main.player[NPC.target].height / 2); - float sepMaxSpeed = BossRushEvent.BossRushActive ? 12.5f : 10f; - float sepAcceleration = BossRushEvent.BossRushActive ? 0.125f : 0.1f; + Vector2 segmentLocation = NPC.Center; + float targetX = CalamityGlobalNPC.SCal < 0 ? 0 : Main.npc[CalamityGlobalNPC.SCal].position.X + (Main.player[NPC.target].width / 2); + float targetY = CalamityGlobalNPC.SCal < 0 ? 0 : Main.npc[CalamityGlobalNPC.SCal].position.Y + (Main.player[NPC.target].height / 2); + float sepMaxSpeed = BossRushEvent.BossRushActive ? 22.5f : 20f; + float sepAcceleration = (BossRushEvent.BossRushActive ? 0.2f : 0.175f) + (0.37f - AttackCooldown * 0.0015f); float fasterMaxSpeed = sepMaxSpeed * 1.3f; float slowerMaxSpeed = sepMaxSpeed * 0.7f; @@ -321,6 +328,38 @@ namespace CalamityMod.NPCs.SupremeCalamitas } } NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X) + MathHelper.PiOver2; + float targetDist = Vector2.Distance(NPC.Center, Main.npc[CalamityGlobalNPC.SCal].Center); + if (targetDist <= 110 && AttackCooldown <= 0) + { + AttackCooldown = 150; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int type = ModContent.ProjectileType(); + int damage = (int)(NPC.GetProjectileDamage(type) * 0.5f); + int totalProjectiles = 30; + float radians = MathHelper.TwoPi / totalProjectiles; + float velocity = 1f; + float projectileVelocityToPass = 15f; + Vector2 spinningPoint = Vector2.Normalize(new Vector2(-velocity, -velocity)); + for (int k = 0; k < totalProjectiles; k++) + { + Vector2 projectileVelocity = spinningPoint.RotatedBy(radians * k); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, projectileVelocity, type, damage, 0f, Main.myPlayer, 0f, 3f, projectileVelocityToPass); + } + NPC.netUpdate = true; + } + + Particle bloom = new BloomParticle(NPC.Center, Vector2.Zero, Color.Red, 0.1f, 0.9f, 30, false); + GeneralParticleHandler.SpawnParticle(bloom); + Particle bloom2 = new BloomParticle(NPC.Center, Vector2.Zero, Color.White, 0.1f, 0.8f, 30, false); + GeneralParticleHandler.SpawnParticle(bloom2); + + Particle pulse = new DirectionalPulseRing(NPC.Center, Vector2.Zero, Color.Red, new Vector2(2f, 2f), 0, 0f, 0.9f, 25); + GeneralParticleHandler.SpawnParticle(pulse); + + SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/DeadSunRicochet") with { Pitch = -0.65f, Volume = 1.8f }, NPC.Center); + } } public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) diff --git a/NPCs/SupremeCalamitas/SepulcherTail.cs b/NPCs/SupremeCalamitas/SepulcherTail.cs index 4f11f7283b..ba744ca331 100644 --- a/NPCs/SupremeCalamitas/SepulcherTail.cs +++ b/NPCs/SupremeCalamitas/SepulcherTail.cs @@ -1,11 +1,11 @@ -using CalamityMod.World; +using System.IO; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System.IO; using Terraria; using Terraria.Audio; -using Terraria.ID; using Terraria.GameContent; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -91,7 +91,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas { for (int i = 0; i < 2; i++) { - int redDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 182, 0f, 0f, 100, default, 2f); + int redDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TheDestroyer, 0f, 0f, 100, default, 2f); Main.dust[redDust].noGravity = true; Main.dust[redDust].noLight = true; } @@ -108,7 +108,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas NPC.alpha = Main.npc[(int)NPC.ai[2]].alpha; } - Vector2 segmentLocation = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); + Vector2 segmentLocation = NPC.Center; float targetX = Main.player[NPC.target].position.X + (Main.player[NPC.target].width / 2); float targetY = Main.player[NPC.target].position.Y + (Main.player[NPC.target].height / 2); targetX = (int)(targetX / 16f) * 16; @@ -122,7 +122,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas { try { - segmentLocation = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); + segmentLocation = NPC.Center; targetX = Main.npc[(int)NPC.ai[1]].position.X + (Main.npc[(int)NPC.ai[1]].width / 2) - segmentLocation.X; targetY = Main.npc[(int)NPC.ai[1]].position.Y + (Main.npc[(int)NPC.ai[1]].height / 2) - segmentLocation.Y; } diff --git a/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs b/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs index 9455c06678..b2ffcd398e 100644 --- a/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs +++ b/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs @@ -1,16 +1,20 @@ -using CalamityMod.Events; -using CalamityMod.Projectiles.Boss; +using System.IO; using CalamityMod.Dusts; +using CalamityMod.Events; +using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; +using Terraria.Audio; using Terraria.GameContent; using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; -using System.IO; -using Terraria.Audio; +using CalamityMod.Particles; +using Steamworks; +using CalamityMod.Items.Weapons.Summon; namespace CalamityMod.NPCs.SupremeCalamitas { @@ -22,19 +26,20 @@ namespace CalamityMod.NPCs.SupremeCalamitas public Player Target => Main.player[NPC.target]; public Vector2 EyePosition => NPC.Center + new Vector2(NPC.spriteDirection == -1 ? 40f : -36f, 16f); - public ref float RotationalDegreeOffset => ref NPC.ai[1]; public static NPC SCal => Main.npc[CalamityGlobalNPC.SCal]; public const float NormalDR = 0.25f; + public static Asset GlowTexture; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 6; NPCID.Sets.TrailingMode[NPC.type] = 1; NPCID.Sets.BossBestiaryPriority.Add(Type); - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { Scale = 0.6f, PortraitPositionXOverride = -5f, @@ -43,6 +48,10 @@ namespace CalamityMod.NPCs.SupremeCalamitas value.Position.X += 12f; value.Position.Y -= 4f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -53,11 +62,10 @@ namespace CalamityMod.NPCs.SupremeCalamitas NPC.height = 40; NPC.noGravity = true; NPC.noTileCollide = true; - NPC.canGhostHeal = false; NPC.damage = 50; NPC.defense = 60; NPC.DR_NERD(NormalDR); - NPC.lifeMax = 14000; + NPC.lifeMax = 28000; double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); NPC.DeathSound = SoundID.DD2_SkeletonDeath; @@ -70,7 +78,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas int associatedNPCType = ModContent.NPCType(); bestiaryEntry.UIInfoProvider = new CommonEnemyUICollectionInfoProvider(ContentSamples.NpcBestiaryCreditIdsByNpcNetIds[associatedNPCType], quickUnlock: true); - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.SoulSeekerSupreme") }); @@ -144,23 +152,65 @@ namespace CalamityMod.NPCs.SupremeCalamitas { if (seeker == NPC) SoundEngine.PlaySound(SupremeCalamitas.BrimstoneShotSound, SCal.Center); + break; } } + if (Main.netMode != NetmodeID.MultiplayerClient) { + float targetDist = Vector2.Distance(Target.Center, NPC.Center); int type = ModContent.ProjectileType(); int damage = NPC.GetProjectileDamage(type); if (BossRushEvent.BossRushActive) damage /= 2; - Vector2 shootVelocity = (Target.Center - EyePosition).SafeNormalize(Vector2.UnitY) * 9f; - Projectile.NewProjectile(NPC.GetSource_FromAI(), EyePosition, shootVelocity, type, damage, 1f, Main.myPlayer); + + float velocity = 5f; + float projectileVelocityToPass = velocity * 3f; + Vector2 shootVelocity = (Target.Center - NPC.Center).SafeNormalize(Vector2.UnitY) * velocity; + if (targetDist <= 160 || targetDist >= 1952) + { + for (int i = 0; i < 10; i++) + { + Dust failShotDust = Dust.NewDustPerfect(NPC.Center, Main.rand.NextBool(3) ? 60 : 114); + failShotDust.noGravity = true; + failShotDust.velocity = new Vector2(3, 3).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1.3f); + failShotDust.scale = Main.rand.NextFloat(1.3f, 2.4f); + } + } + else + { + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, shootVelocity * 0.5f, type, damage, 1f, Main.myPlayer, 0f, 3f, projectileVelocityToPass); + for (int i = 0; i < 5; i++) + { + Dust ShotDust = Dust.NewDustPerfect(NPC.Center, Main.rand.NextBool(3) ? 60 : 114); + ShotDust.noGravity = true; + ShotDust.velocity = shootVelocity.RotatedByRandom(1f) * Main.rand.NextFloat(2.2f, 3.8f); + ShotDust.scale = Main.rand.NextFloat(1.8f, 2.1f); + } + } } + timer = 0; + NPC.netUpdate = true; } + if (timer == shootRate - 35) + { + Particle pulse = new StaticPulseRing(NPC.Center, Vector2.Zero, Color.Red, new Vector2(2f, 2f), 0, 0.03f, 0.005f, 8); + GeneralParticleHandler.SpawnParticle(pulse); + Particle pulse2 = new StaticPulseRing(NPC.Center, Vector2.Zero, Color.Lerp(Color.Red, Color.Magenta, 0.3f), new Vector2(2f, 2f), 0, 0.025f, 0.005f, 8); + GeneralParticleHandler.SpawnParticle(pulse2); + } + if (timer >= shootRate - 35) + { + Vector2 shootVelocity = (Target.Center - NPC.Center).SafeNormalize(Vector2.UnitY) * 5f; + GlowOrbParticle spark2 = new GlowOrbParticle(NPC.Center + shootVelocity * 7, (shootVelocity * Main.rand.NextFloat(0.6f, 1.1f)) * 1.8f + NPC.velocity * 0.5f, false, 15, Main.rand.NextFloat(0.7f, 0.75f), Main.rand.NextBool() ? Color.Lerp(Color.Red, Color.Magenta, 0.3f) : Color.Red); + GeneralParticleHandler.SpawnParticle(spark2); + } - NPC.position = SCal.Center - MathHelper.ToRadians(RotationalDegreeOffset).ToRotationVector2() * 300f - NPC.Size * 0.5f; + float distanceFromSCal = Main.getGoodWorld ? 300f : 225f; + NPC.position = SCal.Center - MathHelper.ToRadians(RotationalDegreeOffset).ToRotationVector2() * distanceFromSCal - NPC.Size * 0.5f; RotationalDegreeOffset += 0.5f; } @@ -171,12 +221,6 @@ namespace CalamityMod.NPCs.SupremeCalamitas Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); } - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - cooldownSlot = ImmunityCooldownID.Bosses; - return true; - } - public override void HitEffect(NPC.HitInfo hit) { if (NPC.life <= 0) @@ -189,7 +233,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas NPC.position.Y = NPC.position.Y - (float)(NPC.height / 2); for (int i = 0; i < 5; i++) { - int brimDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); + int brimDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); Main.dust[brimDust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -199,10 +243,10 @@ namespace CalamityMod.NPCs.SupremeCalamitas } for (int j = 0; j < 10; j++) { - int brimDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 3f); + int brimDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 3f); Main.dust[brimDust2].noGravity = true; Main.dust[brimDust2].velocity *= 5f; - brimDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); + brimDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); Main.dust[brimDust2].velocity *= 2f; } @@ -246,7 +290,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/SupremeCalamitas/SoulSeekerSupremeGlow").Value; + texture2D15 = GlowTexture.Value; Color redLerp = Color.Lerp(Color.White, Color.Red, 0.5f); if (CalamityConfig.Instance.Afterimages) diff --git a/NPCs/SupremeCalamitas/SupremeCalamitas.cs b/NPCs/SupremeCalamitas/SupremeCalamitas.cs index d0ada4a1cd..42f996b630 100644 --- a/NPCs/SupremeCalamitas/SupremeCalamitas.cs +++ b/NPCs/SupremeCalamitas/SupremeCalamitas.cs @@ -1,4 +1,8 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using CalamityMod.Buffs.Alcohol; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Events; @@ -27,18 +31,20 @@ using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; +using ReLogic.Content; using Terraria; +using Terraria.Audio; using Terraria.GameContent; using Terraria.GameContent.Bestiary; +using Terraria.GameContent.ItemDropRules; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using Terraria.GameContent.ItemDropRules; +using ReLogic.Utilities; +using CalamityMod.Projectiles.Ranged; +using Steamworks; +using CalamityMod.Particles; +using Terraria.Utilities.Terraria.Utilities; namespace CalamityMod.NPCs.SupremeCalamitas { @@ -92,13 +98,18 @@ namespace CalamityMod.NPCs.SupremeCalamitas public bool gettingTired5 = false; //1% public bool willCharge = false; public bool canFireSplitingFireball = true; + public bool fireFireblastFirst = true; public bool spawnArena = false; public bool enteredBrothersPhase = false; public bool hasSummonedBrothers = false; public bool cirrus = false; + public bool hasDoneDeathAnim = false; + public bool postMusicHit = false; private const int GiveUpCounterMax = 1200; + private const int musicSyncCounterMax = 2082; // Used to sync a visual with scal's third music track public int giveUpCounter = GiveUpCounterMax; + public int musicSyncCounter = musicSyncCounterMax; public int phaseChange = 0; public int spawnX = 0; public int spawnX2 = 0; @@ -114,11 +125,18 @@ namespace CalamityMod.NPCs.SupremeCalamitas public int hitTimer = 0; public int alicornFrame = 0; public int alicornFrameCounter = 0; + public int dashVisualCounter = 0; + public int preventionPause = 15; // Helps prevent telefragging + public int attackPause = 0; + public bool respawnBro = true; // Master Mode change public float shieldOpacity = 1f; public float shieldRotation = 0f; public float forcefieldOpacity = 1f; public float forcefieldScale = 1; + public float forcefieldPureVisualScale = 1; + public float rotateToPlayer = 0; + public float rotateAwayPlayer = 0; public FrameAnimationType FrameType { @@ -183,38 +201,44 @@ namespace CalamityMod.NPCs.SupremeCalamitas public const int brothersSpawnCastTime = 150; public const int MaxCirrusAlcohols = 20; public const int MaxCirrusAlcoholDebuffDuration = 1500; - + // Sounds. - public static readonly SoundStyle SpawnSound = new("CalamityMod/Sounds/Custom/SupremeCalamitasSpawn") { Volume = 1.2f }; + public static readonly SoundStyle SpawnSound = new("CalamityMod/Sounds/Custom/SupremeCalamitasSpawn") { Volume = 1.2f }; public static readonly SoundStyle SepulcherSummonSound = new("CalamityMod/Sounds/Custom/SCalSounds/SepulcherSpawn"); public static readonly SoundStyle BrimstoneShotSound = new("CalamityMod/Sounds/Custom/SCalSounds/BrimstoneShoot"); + public static readonly SoundStyle BrotherHit = new("CalamityMod/Sounds/Custom/SCalSounds/BrothersHurt", 2); + public static readonly SoundStyle BrotherDeath = new("CalamityMod/Sounds/Custom/SCalSounds/BrothersDeath", 2); + public static readonly SoundStyle CatastropheSwing = new("CalamityMod/Sounds/Custom/SCalSounds/CatastropheResonanceSlash1"); public static readonly SoundStyle BrimstoneBigShotSound = new("CalamityMod/Sounds/Custom/SCalSounds/BrimstoneBigShoot"); // DON'T YOU WANNA BE A [BIG SHOT] public static readonly SoundStyle DashSound = new("CalamityMod/Sounds/Custom/SCalSounds/SCalDash"); public static readonly SoundStyle HellblastSound = new("CalamityMod/Sounds/Custom/SCalSounds/BrimstoneHellblastSound"); public static readonly SoundStyle HurtSound = new("CalamityMod/Sounds/NPCHit/ShieldHit", 3); + public static readonly SoundStyle BulletHellSound = new("CalamityMod/Sounds/Custom/SCalSounds/SCalRumble"); + public static readonly SoundStyle BulletHellEndSound = new("CalamityMod/Sounds/Custom/SCalSounds/SCalEndBH"); + public static readonly SoundStyle GiveUpSound = new("CalamityMod/Sounds/Custom/SCalSounds/SupremeCalamitasGiveUp"); + public SlotId BulletHellRumbleSlot; + + public static Asset HoodedTexture; + public static Asset CirrusTexture; + public static Asset CirrusTexture2; + public static Asset ShieldTopTexture; + public static Asset ShieldBottomTexture; + public static Asset ForcefieldTexture; // TODO -- This is cumbersome. Change it to be better in 1.4. internal static void LoadHeadIcons() { string hoodedIconPath = "CalamityMod/NPCs/SupremeCalamitas/HoodedHeadIcon"; - string hoodedIconP2Path = "CalamityMod/NPCs/SupremeCalamitas/HoodedHeadIconP2"; string hoodlessIconPath = "CalamityMod/NPCs/SupremeCalamitas/HoodlessHeadIcon"; - string hoodlessIconP2Path = "CalamityMod/NPCs/SupremeCalamitas/HoodlessHeadIconP2"; string cirrusIconPath = "CalamityMod/NPCs/SupremeCalamitas/CirrusHeadIcon"; string cirrusIconP2Path = "CalamityMod/NPCs/SupremeCalamitas/CirrusHeadIcon2"; CalamityMod.Instance.AddBossHeadTexture(hoodedIconPath, -1); hoodedHeadIconIndex = ModContent.GetModBossHeadSlot(hoodedIconPath); - CalamityMod.Instance.AddBossHeadTexture(hoodedIconP2Path, -1); - hoodedHeadIconP2Index = ModContent.GetModBossHeadSlot(hoodedIconP2Path); - CalamityMod.Instance.AddBossHeadTexture(hoodlessIconPath, -1); hoodlessHeadIconIndex = ModContent.GetModBossHeadSlot(hoodlessIconPath); - CalamityMod.Instance.AddBossHeadTexture(hoodlessIconP2Path, -1); - hoodlessHeadIconP2Index = ModContent.GetModBossHeadSlot(hoodlessIconP2Path); - CalamityMod.Instance.AddBossHeadTexture(cirrusIconPath, -1); cirrusHeadIconIndex = ModContent.GetModBossHeadSlot(cirrusIconPath); @@ -233,6 +257,15 @@ namespace CalamityMod.NPCs.SupremeCalamitas }; value.Position.Y += 14f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + HoodedTexture = ModContent.Request(Texture + "Hooded", AssetRequestMode.AsyncLoad); + CirrusTexture = ModContent.Request("CalamityMod/NPCs/SupremeCalamitas/SupremeCirrus", AssetRequestMode.AsyncLoad); + CirrusTexture2 = ModContent.Request("CalamityMod/NPCs/SupremeCalamitas/SupremeCirrus_Shimmered", AssetRequestMode.AsyncLoad); + ShieldTopTexture = ModContent.Request("CalamityMod/NPCs/SupremeCalamitas/SupremeShieldTop", AssetRequestMode.AsyncLoad); + ShieldBottomTexture = ModContent.Request("CalamityMod/NPCs/SupremeCalamitas/SupremeShieldBottom", AssetRequestMode.AsyncLoad); + ForcefieldTexture = ModContent.Request("CalamityMod/NPCs/SupremeCalamitas/ForcefieldTexture", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -253,7 +286,6 @@ namespace CalamityMod.NPCs.SupremeCalamitas NPC.dontTakeDamage = false; NPC.chaseable = true; NPC.boss = true; - NPC.canGhostHeal = false; NPC.noGravity = true; NPC.noTileCollide = true; NPC.Calamity().VulnerableToHeat = false; @@ -263,7 +295,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.SupremeCalamitas") }); @@ -279,9 +311,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas else { if (!DownedBossSystem.downedCalamitas || BossRushEvent.BossRushActive) - index = inPhase2 ? hoodedHeadIconP2Index : hoodedHeadIconIndex; + index = hoodedHeadIconIndex; else - index = inPhase2 ? hoodlessHeadIconP2Index : hoodlessHeadIconIndex; + index = hoodlessHeadIconIndex; } } @@ -403,7 +435,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas #region StartUp CalamityGlobalNPC.SCal = NPC.whoAmI; - HandleMusicVariables(); + HandleMusicVariables(); bool wormAlive = false; if (CalamityGlobalNPC.SCalWorm != -1) @@ -431,6 +463,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas bool revenge = CalamityWorld.revenge || bossRush; bool death = CalamityWorld.death || bossRush; + // Used for Scal's teleport at the start of brothers phase + bool teleport = false; + // cirrus and zenith scal are mutually exclusive unless it's legendary bool zenithAI = Main.zenithWorld && (!cirrus || (CalamityWorld.LegendaryMode && revenge && cirrus)); @@ -440,20 +475,20 @@ namespace CalamityMod.NPCs.SupremeCalamitas // Projectile damage values int bulletHellblastDamage = NPC.GetProjectileDamage(ModContent.ProjectileType()); int barrageDamage = NPC.GetProjectileDamage(ModContent.ProjectileType()); - int gigablastDamage = NPC.GetProjectileDamage(ModContent.ProjectileType()); - int fireblastDamage = NPC.GetProjectileDamage(ModContent.ProjectileType()); + int fireblastDamage = NPC.GetProjectileDamage(ModContent.ProjectileType()); + int gigablastDamage = NPC.GetProjectileDamage(ModContent.ProjectileType()); int monsterDamage = NPC.GetProjectileDamage(ModContent.ProjectileType()); int waveDamage = NPC.GetProjectileDamage(ModContent.ProjectileType()); int hellblastDamage = NPC.GetProjectileDamage(ModContent.ProjectileType()); - if (bossRush) - { - bulletHellblastDamage /= 2; - barrageDamage /= 2; - gigablastDamage /= 2; - fireblastDamage /= 2; - monsterDamage /= 2; - waveDamage /= 2; - hellblastDamage /= 2; + if (bossRush) + { + bulletHellblastDamage /= 2; + barrageDamage /= 2; + fireblastDamage /= 2; + gigablastDamage /= 2; + monsterDamage /= 2; + waveDamage /= 2; + hellblastDamage /= 2; } int bulletHellblast = zenithAI ? ModContent.ProjectileType() : ModContent.ProjectileType(); @@ -504,9 +539,23 @@ namespace CalamityMod.NPCs.SupremeCalamitas #endregion #region Forcefield and Shield Logic + // Shield effect rotation + rotateToPlayer = rotateToPlayer.AngleLerp((player.Center - NPC.Center).SafeNormalize(Vector2.UnitY).ToRotation() + MathHelper.PiOver2, 0.04f); + rotateAwayPlayer = rotateAwayPlayer.AngleLerp((player.Center - NPC.Center).SafeNormalize(Vector2.UnitY).ToRotation() - MathHelper.PiOver2, 0.04f); + if (hitTimer > 0) hitTimer--; + if (NPC.dontTakeDamage && !hasDoneDeathAnim) // Dust visuals for shield when immune + { + Vector2 sustVel = new Vector2(-78 * Main.rand.NextFloat(0.95f, 1.05f), 0).RotatedBy(rotateToPlayer + MathHelper.PiOver2).RotatedByRandom(1.4); + Dust sust = Dust.NewDustPerfect(NPC.Center + sustVel, 269, sustVel * Main.rand.NextFloat(0.001f, 0.03f)); + sust.noGravity = true; + sust.scale = Main.rand.NextFloat(0.5f, 0.9f); + sust.alpha = 200; + sust.color = (Main.rand.NextBool() ? Color.Goldenrod : Color.Red); + } + Vector2 hitboxSize = new Vector2(forcefieldScale * 216f / 1.4142f); hitboxSize = Vector2.Max(hitboxSize, new Vector2(42, 44)); if (NPC.Size != hitboxSize) @@ -516,7 +565,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas NPC.ai[0] == 1f || NPC.ai[0] == 2f; // Make the shield and forcefield fade away in SCal's acceptance phase. - if (lifeRatio <= 0.01f) + if (lifeRatio <= 0.01f && hasDoneDeathAnim) { shieldOpacity = MathHelper.Lerp(shieldOpacity, 0f, 0.08f); forcefieldScale = MathHelper.Lerp(forcefieldScale, 0f, 0.08f); @@ -563,6 +612,12 @@ namespace CalamityMod.NPCs.SupremeCalamitas shieldOpacity = MathHelper.Lerp(shieldOpacity, 0f, 0.08f); forcefieldScale = MathHelper.Lerp(forcefieldScale, 1f, 0.08f); } + if (!NPC.dontTakeDamage && willCharge && NPC.ai[1] != 2f) + { + Vector2 velOffset = CalamityUtils.RandomVelocity(100f, 70f, 150f, 0.04f); + velOffset *= Main.rand.NextFloat(2, 13); + + } #endregion #region ArenaCreation @@ -704,7 +759,31 @@ namespace CalamityMod.NPCs.SupremeCalamitas // Slow down and disappear in a burst of fire if should despawn. if (!player.active || player.dead) { + if (SoundEngine.TryGetActiveSound(BulletHellRumbleSlot, out var rumbleSound) && rumbleSound.IsPlaying) + rumbleSound.Stop(); + canDespawn = true; + for (int x = 0; x < Main.maxProjectiles; x++) + { + Projectile projectile = Main.projectile[x]; + if (projectile.active) + { + if (projectile.type == bulletHellblast || + projectile.type == barrage || + projectile.type == wave) + { + if (projectile.timeLeft > 60) + projectile.timeLeft = 60; + } + else if (projectile.type == fireblast || projectile.type == gigablast) + { + projectile.ai[2] = 1f; + + if (projectile.timeLeft > 15) + projectile.timeLeft = 15; + } + } + } NPC.Opacity = MathHelper.Lerp(NPC.Opacity, 0f, 0.065f); NPC.velocity = Vector2.Lerp(Vector2.UnitY * -4f, Vector2.Zero, (float)Math.Sin(MathHelper.Pi * NPC.Opacity)); @@ -747,22 +826,6 @@ namespace CalamityMod.NPCs.SupremeCalamitas NPC.damage = 0; NPC.dontTakeDamage = true; - // Make a magic effect over time. - for (int i = 0; i < (attackCastDelay == 0 ? 16 : 1); i++) - { - Vector2 dustSpawnPosition = NPC.Bottom; - float horizontalSpawnOffset = bodyWidth * Main.rand.NextFloat(0.42f, 0.5f); - if (Main.rand.NextBool()) - horizontalSpawnOffset *= -1f; - dustSpawnPosition.X += horizontalSpawnOffset; - - Dust magic = Dust.NewDustPerfect(dustSpawnPosition, 267); - magic.color = Color.Lerp(cirrus ? Color.Pink : Color.Red, cirrus ? Color.Violet : Color.Orange, Main.rand.NextFloat(0.8f)); - magic.noGravity = true; - magic.velocity = Vector2.UnitY * -Main.rand.NextFloat(5f, 9f); - magic.scale = 1f + NPC.velocity.Y * 0.35f; - } - if ((startBattle && !hasSummonedSepulcher1) || (gettingTired && !hasSummonedSepulcher2)) DoHeartsSpawningCastAnimation(player, death); @@ -788,6 +851,18 @@ namespace CalamityMod.NPCs.SupremeCalamitas NPC.chaseable = false; NPC.dontTakeDamage = true; + #region BulletHellEndTelegraphBH1 + if (bulletHellCounter2 == (BulletHellDuration - 360)) + BulletHellRumbleSlot = SoundEngine.PlaySound(BulletHellSound, player.Center); + if (bulletHellCounter2 > (BulletHellDuration - 360)) + { + if (SoundEngine.TryGetActiveSound(BulletHellRumbleSlot, out var BHSound) && BHSound.IsPlaying) + { + BHSound.Position = player.MountedCenter; + } + } + #endregion + if (!canDespawn) NPC.velocity *= 0.95f; @@ -801,24 +876,24 @@ namespace CalamityMod.NPCs.SupremeCalamitas { float distance = Main.rand.NextBool() ? -1000f : 1000f; float velocity = (distance == -1000f ? 4f : -4f) * uDieLul; - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + distance, player.position.Y, velocity, 0f, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + distance, player.position.Y, velocity, 0f, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer, 0f, 2f); } if (bulletHellCounter2 < 300 && !Main.zenithWorld) // Blasts from above { - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 4f * uDieLul, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 4f * uDieLul, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer, 0f, 2f); } else if (bulletHellCounter2 < 600) // Blasts from left and right { - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -3.5f * uDieLul, 0f, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer); - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), 3.5f * uDieLul, 0f, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -3.5f * uDieLul, 0f, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer, 0f, 2f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), 3.5f * uDieLul, 0f, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer, 0f, 2f); } else // Blasts from above, left, and right { if (!Main.zenithWorld) - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 3f * uDieLul, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 3f * uDieLul, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer, 0f, 2f); - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -3f * uDieLul, 0f, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer); - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), 3f * uDieLul, 0f, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -3f * uDieLul, 0f, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer, 0f, 2f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), 3f * uDieLul, 0f, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer, 0f, 2f); } } } @@ -828,32 +903,28 @@ namespace CalamityMod.NPCs.SupremeCalamitas else if (!startBattle) { attackCastDelay = sepulcherSpawnCastTime; - for (int i = 0; i < 40; i++) + + Particle pulse = new DirectionalPulseRing(NPC.Center, Vector2.Zero, cirrus ? Color.Pink : Color.Red, new Vector2(1f, 1f), 0, 0.1f, 5f, 15); + GeneralParticleHandler.SpawnParticle(pulse); + Particle pulse2 = new DirectionalPulseRing(NPC.Center, Vector2.Zero, cirrus ? Color.Pink : Color.Lerp(Color.Red, Color.Magenta, 0.3f), new Vector2(1f, 1f), 0, 0.05f, 4f, 18); + GeneralParticleHandler.SpawnParticle(pulse2); + for (int i = 0; i < 100; i++) { - Dust castFire = Dust.NewDustPerfect(NPC.Center + Main.rand.NextVector2Square(-70f, 70f), cirrus ? (int)CalamityDusts.PurpleCosmilite : (int)CalamityDusts.Brimstone); - castFire.velocity = Vector2.UnitY.RotatedByRandom(0.08f) * -Main.rand.NextFloat(3f, 4.45f); - castFire.scale = Main.rand.NextFloat(1.35f, 1.6f); - castFire.fadeIn = 1.25f; - castFire.noGravity = true; + Vector2 dustVel = new Vector2(15, 15).RotatedByRandom(100); + Dust failShotDust = Dust.NewDustPerfect(NPC.Center + dustVel * 3, Main.rand.NextBool(3) ? 60 : 114); + failShotDust.noGravity = true; + failShotDust.velocity = dustVel * Main.rand.NextFloat(0.3f, 1.3f); + failShotDust.scale = Main.rand.NextFloat(2f, 3.2f); } - NPC.Center = safeBox.TopRight() + new Vector2(-120f, 620f); - - for (int i = 0; i < 40; i++) - { - Dust castFire = Dust.NewDustPerfect(NPC.Center + Main.rand.NextVector2Square(-70f, 70f), cirrus ? (int)CalamityDusts.PurpleCosmilite : (int)CalamityDusts.Brimstone); - castFire.velocity = Vector2.UnitY.RotatedByRandom(0.08f) * -Main.rand.NextFloat(3f, 4.45f); - castFire.scale = Main.rand.NextFloat(1.35f, 1.6f); - castFire.fadeIn = 1.25f; - castFire.noGravity = true; - } + SoundEngine.PlaySound(BulletHellEndSound, NPC.Center); SoundEngine.PlaySound(SoundID.DD2_DarkMageCastHeal, player.Center); startBattle = true; } #endregion #region SecondAttack - if (bulletHellCounter2 < SecondBulletHellEndValue && startSecondAttack) + if (bulletHellCounter2 < SecondBulletHellEndValue && startSecondAttack) // Bullet hell lasts 1800 { despawnProj = true; bulletHellCounter2++; @@ -861,6 +932,35 @@ namespace CalamityMod.NPCs.SupremeCalamitas NPC.chaseable = false; NPC.dontTakeDamage = true; + #region BulletHellEndTelegraphBH2 + if (bulletHellCounter2 == (SecondBulletHellEndValue - 360)) + BulletHellRumbleSlot = SoundEngine.PlaySound(BulletHellSound, player.Center); + if (bulletHellCounter2 > (SecondBulletHellEndValue - 360)) + { + if (SoundEngine.TryGetActiveSound(BulletHellRumbleSlot, out var BHSound) && BHSound.IsPlaying) + { + BHSound.Position = player.MountedCenter; + } + } + if (bulletHellCounter2 == SecondBulletHellEndValue) + { + for (int i = 0; i < 100; i++) + { + Vector2 dustVel = new Vector2(15, 15).RotatedByRandom(100); + Dust failShotDust = Dust.NewDustPerfect(NPC.Center + dustVel * 3, Main.rand.NextBool(3) ? 60 : 114); + failShotDust.noGravity = true; + failShotDust.velocity = dustVel * Main.rand.NextFloat(0.3f, 1.3f); + failShotDust.scale = Main.rand.NextFloat(2f, 3.2f); + } + Particle pulse = new DirectionalPulseRing(NPC.Center, Vector2.Zero, cirrus ? Color.Pink : Color.Red, new Vector2(1f, 1f), 0, 0.1f, 5f, 15); + GeneralParticleHandler.SpawnParticle(pulse); + Particle pulse2 = new DirectionalPulseRing(NPC.Center, Vector2.Zero, cirrus ? Color.Pink : Color.Lerp(Color.Red, Color.Magenta, 0.3f), new Vector2(1f, 1f), 0, 0.05f, 4f, 18); + GeneralParticleHandler.SpawnParticle(pulse2); + + SoundEngine.PlaySound(BulletHellEndSound, NPC.Center); + } + #endregion + if (!canDespawn) NPC.velocity *= 0.95f; @@ -873,24 +973,24 @@ namespace CalamityMod.NPCs.SupremeCalamitas { float bottleSpeed = 12f; Vector2 bottleVelocity = (player.Center + player.velocity * 20f - NPC.Center).SafeNormalize(Vector2.UnitY) * bottleSpeed; - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, bottleVelocity * uDieLul, ModContent.ProjectileType(), 350, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, bottleVelocity * uDieLul, ModContent.ProjectileType(), 350, 0f, Main.myPlayer, 0f, 2f); } } if (bulletHellCounter2 < 1200) { if (bulletHellCounter2 % 180 == 0) // Blasts from top - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 5f * uDieLul, fireblast, gigablastDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 5f * uDieLul, fireblast, fireblastDamage, 0f, Main.myPlayer, 0f, 2f); } else if (bulletHellCounter2 < 1500 && bulletHellCounter2 > 1200) { if (bulletHellCounter2 % 180 == 0) // Blasts from right - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -5f * uDieLul, 0f, fireblast, gigablastDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -5f * uDieLul, 0f, fireblast, fireblastDamage, 0f, Main.myPlayer, 0f, 2f); } else if (bulletHellCounter2 > 1500) { if (bulletHellCounter2 % 180 == 0) // Blasts from top - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 5f * uDieLul, fireblast, gigablastDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 5f * uDieLul, fireblast, fireblastDamage, 0f, Main.myPlayer, 0f, 2f); } bulletHellCounter++; @@ -901,21 +1001,21 @@ namespace CalamityMod.NPCs.SupremeCalamitas { float distance = Main.rand.NextBool() ? -1000f : 1000f; float velocity = (distance == -1000f ? 4f : -4f) * uDieLul; - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + distance, player.position.Y, velocity, 0f, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + distance, player.position.Y, velocity, 0f, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer, 0f, 2f); } if (bulletHellCounter2 < 1200 && !Main.zenithWorld) // Blasts from below { - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y + 1000f, 0f, -4f * uDieLul, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y + 1000f, 0f, -4f * uDieLul, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer, 0f, 2f); } else if (bulletHellCounter2 < 1500) // Blasts from left { - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), 3.5f * uDieLul, 0f, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), 3.5f * uDieLul, 0f, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer, 0f, 2f); } else // Blasts from left and right { - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), 3f * uDieLul, 0f, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer); - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -3f * uDieLul, 0f, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), 3f * uDieLul, 0f, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer, 0f, 2f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -3f * uDieLul, 0f, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer, 0f, 2f); } } } @@ -963,6 +1063,35 @@ namespace CalamityMod.NPCs.SupremeCalamitas NPC.chaseable = false; NPC.dontTakeDamage = true; + #region BulletHellEndTelegraphBH3 + if (bulletHellCounter2 == (ThirdBulletHellEndValue - 360)) + BulletHellRumbleSlot = SoundEngine.PlaySound(BulletHellSound, player.Center); + if (bulletHellCounter2 > (ThirdBulletHellEndValue - 360)) + { + if (SoundEngine.TryGetActiveSound(BulletHellRumbleSlot, out var BHSound) && BHSound.IsPlaying) + { + BHSound.Position = player.MountedCenter; + } + } + if (bulletHellCounter2 == ThirdBulletHellEndValue) + { + for (int i = 0; i < 100; i++) + { + Vector2 dustVel = new Vector2(15, 15).RotatedByRandom(100); + Dust failShotDust = Dust.NewDustPerfect(NPC.Center + dustVel * 3, Main.rand.NextBool(3) ? 60 : 114); + failShotDust.noGravity = true; + failShotDust.velocity = dustVel * Main.rand.NextFloat(0.3f, 1.3f); + failShotDust.scale = Main.rand.NextFloat(2f, 3.2f); + } + Particle pulse = new DirectionalPulseRing(NPC.Center, Vector2.Zero, cirrus ? Color.Pink : Color.Red, new Vector2(1f, 1f), 0, 0.1f, 5f, 15); + GeneralParticleHandler.SpawnParticle(pulse); + Particle pulse2 = new DirectionalPulseRing(NPC.Center, Vector2.Zero, cirrus ? Color.Pink : Color.Lerp(Color.Red, Color.Magenta, 0.3f), new Vector2(1f, 1f), 0, 0.05f, 4f, 18); + GeneralParticleHandler.SpawnParticle(pulse2); + + SoundEngine.PlaySound(BulletHellEndSound, NPC.Center); + } + #endregion + if (cirrus) { Vector2 destination = player.Center; @@ -984,10 +1113,10 @@ namespace CalamityMod.NPCs.SupremeCalamitas Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, Vector2.One, ModContent.ProjectileType(), CirrusPhotonRipperDamage, 0f, Main.myPlayer, 0f, 0f, NPC.whoAmI); if (bulletHellCounter2 % 180 == 0) // Blasts from top - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 5f * uDieLul, fireblast, gigablastDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 5f * uDieLul, fireblast, fireblastDamage, 0f, Main.myPlayer, 0f, 2f); if (bulletHellCounter2 % 240 == 0) // Fireblasts from above - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 10f * uDieLul, gigablast, fireblastDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 10f * uDieLul, gigablast, gigablastDamage, 0f, Main.myPlayer, 0f, 2f); bulletHellCounter++; if (bulletHellCounter >= baseBulletHellProjectileGateValue + 4) @@ -997,21 +1126,21 @@ namespace CalamityMod.NPCs.SupremeCalamitas { float distance = Main.rand.NextBool() ? -1000f : 1000f; float velocity = (distance == -1000f ? 4f : -4f) * uDieLul; - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + distance, player.position.Y, velocity, 0f, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + distance, player.position.Y, velocity, 0f, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer, 0f, 2f); } if (bulletHellCounter2 < 2100 && !Main.zenithWorld) // Blasts from above { - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 4f * uDieLul, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 4f * uDieLul, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer, 0f, 2f); } else if (bulletHellCounter2 < 2400) // Blasts from right { - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -3.5f * uDieLul, 0f, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -3.5f * uDieLul, 0f, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer, 0f, 2f); } else // Blasts from left and right { - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -3.5f * uDieLul, 0f, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer); - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), 3.5f * uDieLul, 0f, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -3.5f * uDieLul, 0f, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer, 0f, 2f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), 3.5f * uDieLul, 0f, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer, 0f, 2f); } } } @@ -1051,6 +1180,57 @@ namespace CalamityMod.NPCs.SupremeCalamitas } #endregion #region FourthAttack + if (lifeRatio <= 0.3f && musicSyncCounter > -120) + musicSyncCounter--; + if (musicSyncCounter <= 126 && musicSyncCounter > 0) + { + forcefieldOpacity = MathHelper.Lerp(forcefieldOpacity, 0.4f, 0.06f); + + if (shieldOpacity > 0f) + shieldOpacity = MathHelper.Lerp(shieldOpacity, 0f, 0.065f); + } + if (musicSyncCounter <= 42 && musicSyncCounter > 0) + { + forcefieldPureVisualScale = MathHelper.Lerp(forcefieldPureVisualScale, 0.45f, 0.095f); + } + if (musicSyncCounter == 0 && !postMusicHit) + { + Particle pulse = new DirectionalPulseRing(NPC.Center, Vector2.Zero, cirrus ? Color.Pink : Color.Red, new Vector2(1f, 1f), 0, 0.1f, 4f, 17); + GeneralParticleHandler.SpawnParticle(pulse); + Particle pulse2 = new DirectionalPulseRing(NPC.Center, Vector2.Zero, cirrus ? Color.Pink : Color.Lerp(Color.Red, Color.Magenta, 0.3f), new Vector2(1f, 1f), 0, 0.05f, 3f, 19); + GeneralParticleHandler.SpawnParticle(pulse2); + for (int i = 0; i < 30; i++) + { + Vector2 orbvel = new Vector2(25, 25).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 1.2f); + Particle orb = new SparkParticle(NPC.Center + orbvel, orbvel, false, 90, Main.rand.NextFloat(0.95f, 1.85f), Color.Lerp(Color.Red, Color.Magenta, 0.3f)); + GeneralParticleHandler.SpawnParticle(orb); + } + forcefieldOpacity = 0.7f; + forcefieldPureVisualScale = 1.5f; + postMusicHit = true; + } + if (postMusicHit && lifeRatio > 0.01f && !canDespawn && NPC.ai[1] != 2f) + { + forcefieldPureVisualScale = MathHelper.Lerp(forcefieldPureVisualScale, 1f, 0.095f); + Vector2 velOffset = new Vector2(56, 56).RotatedByRandom(100) * forcefieldPureVisualScale; + for (int i = 0; i < 2; i++) + { + Dust fust = Dust.NewDustPerfect(NPC.Center + velOffset, Main.rand.NextBool(3) ? 60 : 114); + fust.noGravity = true; + fust.velocity = velOffset * Main.rand.NextFloat(0.05f, 0.2f); + fust.scale = Main.rand.NextFloat(0.3f, 0.8f); + if (Main.rand.NextBool()) + { + Dust sust = Dust.NewDustPerfect(NPC.Center + velOffset, 269, velOffset * Main.rand.NextFloat(0.01f, 0.1f)); + sust.noGravity = true; + sust.scale = Main.rand.NextFloat(0.2f, 0.6f); + sust.alpha = 200; + sust.color = (Main.rand.NextBool() ? Color.Goldenrod : Color.Red); + } + } + + } + if (bulletHellCounter2 < FourthBulletHellEndValue && startFourthAttack) { despawnProj = true; @@ -1059,6 +1239,35 @@ namespace CalamityMod.NPCs.SupremeCalamitas NPC.chaseable = false; NPC.dontTakeDamage = true; + #region BulletHellEndTelegraphBH4 + if (bulletHellCounter2 == (FourthBulletHellEndValue - 360)) + BulletHellRumbleSlot = SoundEngine.PlaySound(BulletHellSound, player.Center); + if (bulletHellCounter2 > (FourthBulletHellEndValue - 360)) + { + if (SoundEngine.TryGetActiveSound(BulletHellRumbleSlot, out var BHSound) && BHSound.IsPlaying) + { + BHSound.Position = player.MountedCenter; + } + } + if (bulletHellCounter2 == FourthBulletHellEndValue) + { + for (int i = 0; i < 100; i++) + { + Vector2 dustVel = new Vector2(15, 15).RotatedByRandom(100); + Dust failShotDust = Dust.NewDustPerfect(NPC.Center + dustVel * 3, Main.rand.NextBool(3) ? 60 : 114); + failShotDust.noGravity = true; + failShotDust.velocity = dustVel * Main.rand.NextFloat(0.3f, 1.3f); + failShotDust.scale = Main.rand.NextFloat(2f, 3.2f); + } + Particle pulse = new DirectionalPulseRing(NPC.Center, Vector2.Zero, cirrus ? Color.Pink : Color.Red, new Vector2(1f, 1f), 0, 0.1f, 5f, 15); + GeneralParticleHandler.SpawnParticle(pulse); + Particle pulse2 = new DirectionalPulseRing(NPC.Center, Vector2.Zero, cirrus ? Color.Pink : Color.Lerp(Color.Red, Color.Magenta, 0.3f), new Vector2(1f, 1f), 0, 0.05f, 4f, 18); + GeneralParticleHandler.SpawnParticle(pulse2); + + SoundEngine.PlaySound(BulletHellEndSound, NPC.Center); + } + #endregion + if (!canDespawn) NPC.velocity *= 0.95f; @@ -1071,23 +1280,47 @@ namespace CalamityMod.NPCs.SupremeCalamitas { float bottleSpeed = 12f; Vector2 bottleVelocity = (player.Center + player.velocity * 20f - NPC.Center).SafeNormalize(Vector2.UnitY) * bottleSpeed; - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, bottleVelocity * uDieLul, ModContent.ProjectileType(), 125, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, bottleVelocity * uDieLul, ModContent.ProjectileType(), 125, 0f, Main.myPlayer, 0f, 2f); } } if (bulletHellCounter2 % 180 == 0) // Blasts from top - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 5f * uDieLul, fireblast, gigablastDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 5f * uDieLul, fireblast, fireblastDamage, 0f, Main.myPlayer, 0f, 2f); if (bulletHellCounter2 % 240 == 0) // Fireblasts from above - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 10f * uDieLul, gigablast, fireblastDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 10f * uDieLul, gigablast, gigablastDamage, 0f, Main.myPlayer, 0f, 2f); int divisor = revenge ? 225 : expertMode ? 450 : 675; - // TODO -- Resprite Brimstone Monsters to be something else. - if (bulletHellCounter2 % divisor == 0 && expertMode) // Giant homing fireballs + Vector2 spawnSpot = safeBox.Center(); + passedVar += 1f; + if (passedVar == 180) // Giant homing fireballs { - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 1f * uDieLul, ModContent.ProjectileType(), monsterDamage, 0f, Main.myPlayer, 0f, passedVar); - passedVar += 1f; + SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/SCalAltarSummon") with { Pitch = 0.3f }, player.Center); + for (int i = 0; i < 2; i++) + { + Particle bloom = new BloomParticle(spawnSpot, Vector2.Zero, Color.Lerp(Color.Red, Color.Magenta, 0.3f), 0f, 1.45f, 240, false); + GeneralParticleHandler.SpawnParticle(bloom); + } + Particle bloom2 = new BloomParticle(spawnSpot, Vector2.Zero, Color.White, 0f, 1.35f, 240, false); + GeneralParticleHandler.SpawnParticle(bloom2); + } + if (passedVar == 420) // Giant homing fireballs + { + for (int i = 0; i < 90; i++) + { + Dust spawnDust = Dust.NewDustPerfect(safeBox.Center(), cirrus ? (int)CalamityDusts.PurpleCosmilite : (int)CalamityDusts.Brimstone, new Vector2(30, 30).RotatedByRandom(100) * Main.rand.NextFloat(0.05f, 1.2f)); + spawnDust.noGravity = true; + spawnDust.scale = Main.rand.NextFloat(1.2f, 2.3f); + } + for (int i = 0; i < 40; i++) + { + Vector2 sparkVel = new Vector2(20, 20).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 1.1f); + GlowOrbParticle orb = new GlowOrbParticle(safeBox.Center() + sparkVel * 2, sparkVel, false, 120, Main.rand.NextFloat(1.55f, 2.75f), cirrus ? Color.Magenta : Color.Lerp(Color.Red, Color.Magenta, 0.3f), true, true); + GeneralParticleHandler.SpawnParticle(orb); + } + + Projectile.NewProjectile(NPC.GetSource_FromAI(), spawnSpot, Vector2.Zero, ModContent.ProjectileType(), monsterDamage, 0f, Main.myPlayer, 0f); } bulletHellCounter++; @@ -1098,21 +1331,21 @@ namespace CalamityMod.NPCs.SupremeCalamitas { float distance = Main.rand.NextBool() ? -1000f : 1000f; float velocity = (distance == -1000f ? 4f : -4f) * uDieLul; - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + distance, player.position.Y, velocity, 0f, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + distance, player.position.Y, velocity, 0f, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer, 0f, 2f); } if (bulletHellCounter2 < 3000 && !Main.zenithWorld) // Blasts from below { - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y + 1000f, 0f, -4f * uDieLul, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y + 1000f, 0f, -4f * uDieLul, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer, 0f, 2f); } else if (bulletHellCounter2 < 3300) // Blasts from left { - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), 3.5f * uDieLul, 0f, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), 3.5f * uDieLul, 0f, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer, 0f, 2f); } else // Blasts from left and right { - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -3.5f * uDieLul, 0f, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer); - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), 3.5f * uDieLul, 0f, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -3.5f * uDieLul, 0f, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer, 0f, 2f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), 3.5f * uDieLul, 0f, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer, 0f, 2f); } } } @@ -1160,6 +1393,35 @@ namespace CalamityMod.NPCs.SupremeCalamitas NPC.chaseable = false; NPC.dontTakeDamage = true; + #region BulletHellEndTelegraphBH5 + if (bulletHellCounter2 == (FifthBulletHellEndValue - 360)) + BulletHellRumbleSlot = SoundEngine.PlaySound(BulletHellSound, player.Center); + if (bulletHellCounter2 > (FifthBulletHellEndValue - 360)) + { + if (SoundEngine.TryGetActiveSound(BulletHellRumbleSlot, out var BHSound) && BHSound.IsPlaying) + { + BHSound.Position = player.MountedCenter; + } + } + if (bulletHellCounter2 == FifthBulletHellEndValue) + { + for (int i = 0; i < 100; i++) + { + Vector2 dustVel = new Vector2(15, 15).RotatedByRandom(100); + Dust failShotDust = Dust.NewDustPerfect(NPC.Center + dustVel * 3, Main.rand.NextBool(3) ? 60 : 114); + failShotDust.noGravity = true; + failShotDust.velocity = dustVel * Main.rand.NextFloat(0.3f, 1.3f); + failShotDust.scale = Main.rand.NextFloat(2f, 3.2f); + } + Particle pulse = new DirectionalPulseRing(NPC.Center, Vector2.Zero, cirrus ? Color.Pink : Color.Red, new Vector2(1f, 1f), 0, 0.1f, 5f, 15); + GeneralParticleHandler.SpawnParticle(pulse); + Particle pulse2 = new DirectionalPulseRing(NPC.Center, Vector2.Zero, cirrus ? Color.Pink : Color.Lerp(Color.Red, Color.Magenta, 0.3f), new Vector2(1f, 1f), 0, 0.05f, 4f, 18); + GeneralParticleHandler.SpawnParticle(pulse2); + + SoundEngine.PlaySound(BulletHellEndSound, NPC.Center); + } + #endregion + if (cirrus) { Vector2 destination = player.Center; @@ -1192,16 +1454,16 @@ namespace CalamityMod.NPCs.SupremeCalamitas } if (bulletHellCounter2 % 240 == 0) // Blasts from top - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 5f * uDieLul, fireblast, gigablastDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 5f * uDieLul, fireblast, fireblastDamage, 0f, Main.myPlayer, 0f, 2f); if (bulletHellCounter2 % 360 == 0) // Fireblasts from above - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 10f * uDieLul, gigablast, fireblastDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 10f * uDieLul, gigablast, gigablastDamage, 0f, Main.myPlayer, 0f, 2f); if (bulletHellCounter2 % 30 == 0) // Projectiles that move in wave pattern { int random = Main.rand.Next(-500, 501); - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + random, -5f * uDieLul, 0f, wave, waveDamage, 0f, Main.myPlayer); - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X - 1000f, player.position.Y - random, 5f * uDieLul, 0f, wave, waveDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + random, -5f * uDieLul, 0f, wave, waveDamage, 0f, Main.myPlayer, 0f, 2f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X - 1000f, player.position.Y - random, 5f * uDieLul, 0f, wave, waveDamage, 0f, Main.myPlayer, 0f, 2f); } bulletHellCounter++; @@ -1212,25 +1474,25 @@ namespace CalamityMod.NPCs.SupremeCalamitas { float distance = Main.rand.NextBool() ? -1000f : 1000f; float velocity = (distance == -1000f ? 4f : -4f) * uDieLul; - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + distance, player.position.Y, velocity, 0f, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + distance, player.position.Y, velocity, 0f, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer, 0f, 2f); } if (bulletHellCounter2 < 3900 && !Main.zenithWorld) // Blasts from above { - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 4f * uDieLul, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 4f * uDieLul, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer, 0f, 2f); } else if (bulletHellCounter2 < 4200) // Blasts from left and right { - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -3.5f * uDieLul, 0f, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer); - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), 3.5f * uDieLul, 0f, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -3.5f * uDieLul, 0f, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer, 0f, 2f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), 3.5f * uDieLul, 0f, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer, 0f, 2f); } else // Blasts from above, left, and right { if (!Main.zenithWorld) - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 3f * uDieLul, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer); - - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -3f * uDieLul, 0f, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer); - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), 3f * uDieLul, 0f, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 3f * uDieLul, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer, 0f, 2f); + + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -3f * uDieLul, 0f, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer, 0f, 2f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), 3f * uDieLul, 0f, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer, 0f, 2f); } } } @@ -1348,33 +1610,163 @@ namespace CalamityMod.NPCs.SupremeCalamitas return; } } - else + else // Scal gives up { - if (NPC.velocity.Y < 9f) - NPC.velocity.Y += 0.185f; - - NPC.noTileCollide = false; - NPC.noGravity = false; - NPC.damage = 0; - - // Teleport back to the arena on defeat - if (giveUpCounter == GiveUpCounterMax) + // Clear Debuffs DOESNT WORK YET + for (int l = 0; l < NPC.maxBuffs ; ++l) { - Dust.QuickDustLine(NPC.Center, initialRitualPosition, 500f, Color.Red); - NPC.Center = initialRitualPosition; + int buffID = NPC.buffType[l]; + + bool shouldHalveDuration = CalamityLists.debuffList.Contains(buffID); + + if (shouldHalveDuration && NPC.buffTime[l] > 4) + NPC.buffTime[l] = 4; } - if (!canDespawn) - NPC.velocity.X *= 0.96f; - if (DownedBossSystem.downedCalamitas && !bossRush) + if (!hasDoneDeathAnim && !bossRush) // Scrapped death animation for Scal { - if (giveUpCounter == 720) + attackPause = 5; + Dust.QuickDustLine(NPC.Center, safeBox.Center() + new Vector2(0, -30), 500f, cirrus ? Color.Pink : Color.Red); + NPC.Center = safeBox.Center() + new Vector2(0, -30); + NPC.velocity = new Vector2(10 * NPC.spriteDirection, -7); + hasDoneDeathAnim = true; + NPC.noTileCollide = false; + NPC.noGravity = false; + NPC.damage = 0; + + /* + // Teleport back to the arena on defeat + if (giveUpCounter == GiveUpCounterMax) { + Dust.QuickDustLine(NPC.Center, initialRitualPosition + new Vector2(0, -30), 500f, cirrus ? Color.Pink : Color.Red); + NPC.Center = initialRitualPosition + new Vector2(0, -30); + NPC.noTileCollide = false; + NPC.noGravity = false; + NPC.damage = 0; + SoundEngine.PlaySound(GiveUpSound with { Volume = 1.7f }, NPC.Center); + } + if (giveUpCounter == 1010) + { + Particle pulse2 = new StaticPulseRing(NPC.Center, Vector2.Zero, Color.Red * 0.55f, new Vector2(1f, 1f), 0f, 5f, 0f, 47); + GeneralParticleHandler.SpawnParticle(pulse2); + } + + if (shieldOpacity > 0f) + shieldOpacity = 0; + if (giveUpCounter > 1000) + forcefieldScale = MathHelper.Lerp(forcefieldScale, 1.55f, 0.045f); + else if (giveUpCounter > 960) + forcefieldScale = MathHelper.Lerp(forcefieldScale, 0.4f, 0.085f); + + if (giveUpCounter > 960) + { + for (int i = 0; i < 2; i++) + { + Vector2 sparkVel = new Vector2(15, 15).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1.1f); + GlowOrbParticle orb = new GlowOrbParticle(NPC.Center + sparkVel * (8 * forcefieldScale), sparkVel * Utils.GetLerpValue(1200, 960, giveUpCounter, true), false, 60, Main.rand.NextFloat(0.7f, 1.7f) * Utils.GetLerpValue(1200, 960, giveUpCounter), Main.rand.NextBool() ? Color.Red : Color.Lerp(Color.Red, Color.Magenta, 0.5f), true, true); + GeneralParticleHandler.SpawnParticle(orb); + } + + float vibrate = 15 * Utils.GetLerpValue(1200, 960, giveUpCounter, true); + NPC.Center = (initialRitualPosition + new Vector2(0, -30)) + Main.rand.NextVector2Circular(vibrate, vibrate); + } + else + { + if (giveUpCounter == 960) + { + NPC.Center = initialRitualPosition + new Vector2(0, -30); + + Vector2 BurstFXDirection = new Vector2(0, 15); + for (int i = 0; i < 4; i++) + { + SparkParticle spark = new SparkParticle(NPC.Center, (BurstFXDirection) * (i + 1), false, 11, (5f - i * 0.6f) * 3, Color.Lerp(Color.Red, Color.Magenta, Utils.GetLerpValue(-3, 3, i)) * 0.8f); + GeneralParticleHandler.SpawnParticle(spark); + } + for (int i = 0; i < 4; i++) + { + SparkParticle spark = new SparkParticle(NPC.Center, (-BurstFXDirection) * (i + 1), false, 11, (5f - i * 0.6f) * 3, Color.Lerp(Color.Red, Color.Magenta, Utils.GetLerpValue(-3, 3, i)) * 0.8f); + GeneralParticleHandler.SpawnParticle(spark); + } + + Particle orb = new CustomPulse(NPC.Center, Vector2.Zero, Color.Red, "CalamityMod/Particles/LargeBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 1.2f, 1.1f, 13); + GeneralParticleHandler.SpawnParticle(orb); + Particle orb2 = new CustomPulse(NPC.Center, Vector2.Zero, Color.Lerp(Color.Red, Color.Magenta, 0.5f), "CalamityMod/Particles/LargeBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 1f, 0.9f, 13); + GeneralParticleHandler.SpawnParticle(orb2); + for (int i = 0; i < 4; i++) + { + Particle orb3 = new CustomPulse(NPC.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/LargeBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0.9f, 0.8f, 13); + GeneralParticleHandler.SpawnParticle(orb3); + } + + for (int i = 0; i < 30; i++) + { + GlowOrbParticle burst = new GlowOrbParticle(NPC.Center, (new Vector2(30, 30).RotatedByRandom(100) + new Vector2(0, -2)) * Main.rand.NextFloat(0.1f, 1.2f), true, 120, Main.rand.NextFloat(1.7f, 2.7f), Main.rand.NextBool() ? Color.Red : Color.Lerp(Color.Red, Color.Magenta, 0.5f), true, true); + GeneralParticleHandler.SpawnParticle(burst); + } + + NPC.velocity = new Vector2(18 * NPC.spriteDirection, -12); + giveUpCounter = GiveUpCounterMax; + hasDoneDeathAnim = true; + } + } + */ + } + else + { + if (bossRush) + NPC.Center = initialRitualPosition + new Vector2(0, -30); + + if (NPC.velocity.Y < 8f) + NPC.velocity.Y += 0.165f; + if (!canDespawn) + NPC.velocity.X *= 0.965f; + + if (DownedBossSystem.downedCalamitas && !bossRush) + { + if (giveUpCounter == 720) + { + for (int i = 0; i < 24; i++) + { + Dust brimstoneFire = Dust.NewDustPerfect(NPC.Center + Main.rand.NextVector2Square(-24f, 24f), DustID.Torch); + brimstoneFire.color = cirrus ? Color.Pink : Color.Red; + brimstoneFire.velocity = Vector2.UnitY * -Main.rand.NextFloat(2f, 3.25f); + brimstoneFire.scale = Main.rand.NextFloat(0.95f, 1.15f); + brimstoneFire.fadeIn = 1.25f; + brimstoneFire.noGravity = true; + } + + NPC.active = false; + NPC.netUpdate = true; + NPC.NPCLoot(); + } + } + else if (giveUpCounter == 900 && !bossRush) + { + CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.Status.Boss.SCalAcceptanceText1", textColor); + } + else if (giveUpCounter == 600 && !bossRush) + { + CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.Status.Boss.SCalAcceptanceText2", textColor); + } + else if (giveUpCounter == 300 && !bossRush) + { + CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.Status.Boss.SCalAcceptanceText3", textColor); + } + + if (giveUpCounter <= 0) + { + if (bossRush) + { + NPC.chaseable = true; + NPC.dontTakeDamage = false; + return; + } + for (int i = 0; i < 24; i++) { Dust brimstoneFire = Dust.NewDustPerfect(NPC.Center + Main.rand.NextVector2Square(-24f, 24f), DustID.Torch); - brimstoneFire.color = Color.Red; + brimstoneFire.color = cirrus ? Color.Pink : Color.Red; brimstoneFire.velocity = Vector2.UnitY * -Main.rand.NextFloat(2f, 3.25f); brimstoneFire.scale = Main.rand.NextFloat(0.95f, 1.15f); brimstoneFire.fadeIn = 1.25f; @@ -1384,44 +1776,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas NPC.active = false; NPC.netUpdate = true; NPC.NPCLoot(); - } - } - else if (giveUpCounter == 900 && !bossRush) - { - CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.Status.Boss.SCalAcceptanceText1", textColor); - } - else if (giveUpCounter == 600 && !bossRush) - { - CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.Status.Boss.SCalAcceptanceText2", textColor); - } - else if (giveUpCounter == 300 && !bossRush) - { - CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.Status.Boss.SCalAcceptanceText3", textColor); - } - - if (giveUpCounter <= 0) - { - if (bossRush) - { - NPC.chaseable = true; - NPC.dontTakeDamage = false; return; } - - for (int i = 0; i < 24; i++) - { - Dust brimstoneFire = Dust.NewDustPerfect(NPC.Center + Main.rand.NextVector2Square(-24f, 24f), DustID.Torch); - brimstoneFire.color = Color.Red; - brimstoneFire.velocity = Vector2.UnitY * -Main.rand.NextFloat(2f, 3.25f); - brimstoneFire.scale = Main.rand.NextFloat(0.95f, 1.15f); - brimstoneFire.fadeIn = 1.25f; - brimstoneFire.noGravity = true; - } - - NPC.active = false; - NPC.netUpdate = true; - NPC.NPCLoot(); - return; } } @@ -1436,10 +1792,27 @@ namespace CalamityMod.NPCs.SupremeCalamitas for (int x = 0; x < Main.maxProjectiles; x++) { Projectile projectile = Main.projectile[x]; - if (projectile.active && projectile.type == ModContent.ProjectileType()) + if (projectile.active) { - if (projectile.timeLeft > 90) - projectile.timeLeft = 90; + if (projectile.type == ModContent.ProjectileType()) + { + if (projectile.timeLeft > 90) + projectile.timeLeft = 90; + } + if (projectile.type == bulletHellblast || + projectile.type == barrage || + projectile.type == wave) + { + if (projectile.timeLeft > 60) + projectile.timeLeft = 60; + } + else if (projectile.type == fireblast || projectile.type == gigablast) + { + projectile.ai[2] = 1f; + + if (projectile.timeLeft > 15) + projectile.timeLeft = 15; + } } } @@ -1513,8 +1886,6 @@ namespace CalamityMod.NPCs.SupremeCalamitas castFire.noGravity = true; } - NPC.Center = safeBox.TopRight() + new Vector2(-120f, 620f); - for (int i = 0; i < 40; i++) { Dust castFire = Dust.NewDustPerfect(NPC.Center + Main.rand.NextVector2Square(-70f, 70f), cirrus ? (int)CalamityDusts.PurpleCosmilite : (int)CalamityDusts.Brimstone); @@ -1547,10 +1918,10 @@ namespace CalamityMod.NPCs.SupremeCalamitas } else if (projectile.type == fireblast || projectile.type == gigablast) { - projectile.ai[1] = 1f; + projectile.ai[2] = 1f; - if (projectile.timeLeft > 60) - projectile.timeLeft = 60; + if (projectile.timeLeft > 15) + projectile.timeLeft = 15; } } } @@ -1558,7 +1929,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas } #endregion #region TransformSeekerandBrotherTriggers - if (!halfLife && lifeRatio <= 0.4f) + if (!halfLife && lifeRatio <= 0.45f && hasSummonedBrothers && (cirrus ? NPC.AnyNPCs(ModContent.NPCType()) : (NPC.AnyNPCs(ModContent.NPCType()) || NPC.AnyNPCs(ModContent.NPCType()))) == false) { if (!bossRush) { @@ -1636,12 +2007,15 @@ namespace CalamityMod.NPCs.SupremeCalamitas else { SoundEngine.PlaySound(SoundID.Item74, NPC.Center); - for (int i = 0; i < 20; i++) + int totalSeekers = Main.getGoodWorld ? 20 : 10; + int degreesBetweenEachSeeker = 360 / totalSeekers; + int distanceFromSCal = Main.getGoodWorld ? 300 : 225; + for (int i = 0; i < totalSeekers; i++) { - int FireEye = NPC.NewNPC(NPC.GetSource_FromAI(), (int)(vectorCenter.X + (Math.Sin(i * 18) * 300)), (int)(vectorCenter.Y + (Math.Cos(i * 18) * 300)), ModContent.NPCType(), NPC.whoAmI, 0, 0, 0, -1); + int FireEye = NPC.NewNPC(NPC.GetSource_FromAI(), (int)(vectorCenter.X + (Math.Sin(i * degreesBetweenEachSeeker) * distanceFromSCal)), (int)(vectorCenter.Y + (Math.Cos(i * degreesBetweenEachSeeker) * distanceFromSCal)), ModContent.NPCType(), NPC.whoAmI, 0, 0, 0, -1); NPC Eye = Main.npc[FireEye]; - Eye.ai[0] = i * 18; - Eye.ai[3] = i * 18; + Eye.ai[0] = i * degreesBetweenEachSeeker; + Eye.ai[3] = i * degreesBetweenEachSeeker; } } } @@ -1657,11 +2031,56 @@ namespace CalamityMod.NPCs.SupremeCalamitas } if (NPC.life > 0) { + if (attackPause > 0) + attackPause--; + if (lifeRatio < 0.45f && !enteredBrothersPhase) { - enteredBrothersPhase = true; - attackCastDelay = brothersSpawnCastTime; - NPC.netUpdate = true; + attackPause = 5; + if (preventionPause == 0) + { + enteredBrothersPhase = true; + attackCastDelay = brothersSpawnCastTime; + NPC.netUpdate = true; + if (!teleport) + { + Dust.QuickDustLine(NPC.Center, player.Center + new Vector2(0, -155), 500f, cirrus ? Color.Pink : Color.Red); + NPC.velocity = Vector2.Zero; + NPC.Center = player.Center + new Vector2(0, -175); + Particle pulse = new DirectionalPulseRing(NPC.Center, Vector2.Zero, Color.Red, new Vector2(1f, 1f), 0, 0.1f, 5f, 15); + GeneralParticleHandler.SpawnParticle(pulse); + for (int x = 0; x < Main.maxProjectiles; x++) + { + Projectile projectile = Main.projectile[x]; + if (projectile.active) + { + if (projectile.type == bulletHellblast || + projectile.type == barrage || + projectile.type == wave) + { + if (projectile.timeLeft > 60) + projectile.timeLeft = 60; + } + else if (projectile.type == fireblast || projectile.type == gigablast) + { + projectile.ai[2] = 1f; + + if (projectile.timeLeft > 15) + projectile.timeLeft = 15; + } + } + } + teleport = true; + } + } + else + { + preventionPause--; + NPC.dontTakeDamage = true; + NPC.velocity *= 0.85f; + return; + } + } } @@ -1669,7 +2088,6 @@ namespace CalamityMod.NPCs.SupremeCalamitas #region FirstStage if (NPC.ai[0] == 0f) { - NPC.damage = NPC.defDamage; if (wormAlive) { NPC.dontTakeDamage = true; @@ -1794,6 +2212,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas { if (NPC.ai[1] == 0f) { + // Avoid cheap bullshit + NPC.damage = 0; + // How fast SCal moves to the destination float velocity = 12f; float acceleration = 0.12f; @@ -1804,10 +2225,6 @@ namespace CalamityMod.NPCs.SupremeCalamitas acceleration *= 1.15f; } - // Reduce acceleration if target is holding a true melee weapon - if (player.HoldingTrueMeleeWeapon()) - acceleration *= 0.5f; - // This is where SCal should be Vector2 destination = new Vector2(player.Center.X, player.Center.Y - 550f); @@ -1825,6 +2242,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (NPC.ai[2] >= 300f) { NPC.ai[1] = -1f; + fireFireblastFirst = true; NPC.TargetClosest(); NPC.netUpdate = true; } @@ -1839,53 +2257,46 @@ namespace CalamityMod.NPCs.SupremeCalamitas NPC.localAI[1] = 0f; int randomShot = Main.rand.Next(6); - if (randomShot == 0 && canFireSplitingFireball) + + if (randomShot == 0 && canFireSplitingFireball && !fireFireblastFirst) { canFireSplitingFireball = false; randomShot = gigablast; SoundEngine.PlaySound(BrimstoneBigShotSound, NPC.Center); - for (int i = 0; i < 15; i++) + for (int i = 0; i < 9; i++) // fireblasts pre laugh { - Dust magic = Dust.NewDustPerfect(projectileSpawn, 264); - magic.velocity = projectileVelocity.RotatedByRandom(0.36f) * Main.rand.NextFloat(0.9f, 1.1f); - magic.color = cirrus ? Color.BlueViolet : Color.OrangeRed; - magic.scale = 1.2f; - magic.fadeIn = 0.6f; - magic.noLight = true; - magic.noGravity = true; + Vector2 velOffset = NPC.DirectionTo(player.Center).RotatedByRandom(0.6) * Main.rand.NextFloat(5f, 13f); + GlowOrbParticle spark2 = new GlowOrbParticle(projectileSpawn + velOffset * 2f, velOffset * 0.7f, false, 30, Main.rand.NextFloat(0.4f, 0.65f), cirrus ? Color.HotPink : Main.rand.NextBool(3) ? Color.Lerp(Color.Red, Color.Magenta, 0.3f) : Color.Red); + GeneralParticleHandler.SpawnParticle(spark2); } if (Main.netMode != NetmodeID.MultiplayerClient) { - Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileSpawn, projectileVelocity, randomShot, fireblastDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileSpawn, projectileVelocity, randomShot, gigablastDamage, 0f, Main.myPlayer, 0f, 2f); NPC.netUpdate = true; } } - else if (randomShot == 1 && canFireSplitingFireball) + else if ((randomShot == 1 && canFireSplitingFireball) || fireFireblastFirst) // Firing gigablast while hovering above pre laugh { canFireSplitingFireball = false; randomShot = fireblast; SoundEngine.PlaySound(BrimstoneShotSound, NPC.Center); - for (int i = 0; i < 20; i++) + for (int i = 0; i < 9; i++) { - Dust magic = Dust.NewDustPerfect(projectileSpawn, cirrus ? (int)CalamityDusts.PurpleCosmilite : (int)CalamityDusts.Brimstone); - magic.velocity = projectileVelocity.RotatedByRandom(0.36f) * Main.rand.NextFloat(0.9f, 1.1f) * 1.3f; - magic.color = cirrus ? Color.Pink : Color.Red; - magic.scale = 1.425f; - magic.fadeIn = 0.75f; - magic.noLight = true; - magic.noGravity = true; + Vector2 velOffset = NPC.DirectionTo(player.Center).RotatedByRandom(0.6) * Main.rand.NextFloat(5f, 13f); + GlowOrbParticle spark2 = new GlowOrbParticle(projectileSpawn + velOffset * 2f, velOffset * 0.8f, false, 30, Main.rand.NextFloat(0.4f, 0.65f), cirrus ? Color.HotPink : Main.rand.NextBool(3) ? Color.Lerp(Color.Red, Color.Magenta, 0.3f) : Color.Red); + GeneralParticleHandler.SpawnParticle(spark2); } if (Main.netMode != NetmodeID.MultiplayerClient) { - Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileSpawn, projectileVelocity, randomShot, gigablastDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileSpawn, projectileVelocity, randomShot, fireblastDamage, 0f, Main.myPlayer, 0f, 2f); NPC.netUpdate = true; } } - else + else if (!fireFireblastFirst) { canFireSplitingFireball = true; randomShot = barrage; @@ -1894,34 +2305,32 @@ namespace CalamityMod.NPCs.SupremeCalamitas int numProj = 8; for (int j = 0; j < numProj; j++) { - for (int i = 0; i < 7; i++) + for (int i = 0; i < 6; i++) // Spread dust for pre laugh floating { - Vector2 magicDustVelocity = projectileVelocity; - magicDustVelocity *= MathHelper.Lerp(0.3f, 1f, i / 7f); - - Dust magic = Dust.NewDustPerfect(projectileSpawn, 264); - magic.velocity = magicDustVelocity; - magic.color = cirrus ? Color.Pink : Color.Red; - magic.scale = MathHelper.Lerp(0.85f, 1.5f, i / 7f); - magic.fadeIn = 0.67f; - magic.noLight = true; - magic.noGravity = true; + Vector2 dustVel = (projectileVelocity * 2).RotatedByRandom(0.9) * (Main.rand.NextFloat(0.5f, 1.9f)); + GlowOrbParticle orb = new GlowOrbParticle(projectileSpawn, dustVel, false, 15, Main.rand.NextFloat(0.65f, 0.9f), cirrus ? Color.Magenta : Main.rand.NextBool() ? Color.Red : Color.Lerp(Color.Red, Color.Magenta, 0.3f)); + GeneralParticleHandler.SpawnParticle(orb); } if (Main.netMode != NetmodeID.MultiplayerClient) { + float projectileVelocityToPass = projectileVelocity.Length() * 1.3f; Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, j / (float)(numProj - 1))); - Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileSpawn, perturbedSpeed, randomShot, barrageDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileSpawn, perturbedSpeed, randomShot, barrageDamage, 0f, Main.myPlayer, 0, 4f, projectileVelocityToPass); NPC.netUpdate = true; } } } + fireFireblastFirst = false; } FrameType = FrameAnimationType.FasterUpwardDraft; } else if (NPC.ai[1] == 1f) { + // Set damage + NPC.damage = NPC.defDamage; + float chargeVelocity = (wormAlive ? 26f : 30f) + (1f - lifeRatio) * 8f; if (Main.getGoodWorld) @@ -1950,12 +2359,12 @@ namespace CalamityMod.NPCs.SupremeCalamitas { Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(2))); - int p = Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + (perturbedSpeed).SafeNormalize(Vector2.UnitY) * 3f, perturbedSpeed, type, damage, 0f, Main.myPlayer); + int p = Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + (perturbedSpeed).SafeNormalize(Vector2.UnitY) * 3f, perturbedSpeed, type, damage, 0f, Main.myPlayer, 0f, 2f); if (p.WithinBounds(Main.maxProjectiles)) { - Main.projectile[p].DamageType = DamageClass.Default; - Main.projectile[p].friendly = false; - Main.projectile[p].hostile = true; + Main.projectile[p].DamageType = DamageClass.Default; + Main.projectile[p].friendly = false; + Main.projectile[p].hostile = true; } } } @@ -1966,6 +2375,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas } else if (NPC.ai[1] == 2f) { + // Set damage + NPC.damage = NPC.defDamage; + NPC.ai[2] += 1f; if (Math.Abs(NPC.velocity.X) > 0.15f) @@ -1973,6 +2385,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (NPC.ai[2] >= 25f) { + // Avoid cheap bullshit + NPC.damage = 0; + if (!canDespawn) { NPC.velocity *= 0.96f; @@ -1988,6 +2403,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (NPC.ai[2] >= 70f) { + // Avoid cheap bullshit + NPC.damage = 0; + NPC.ai[3] += 1f; NPC.ai[2] = 0f; NPC.TargetClosest(); @@ -2009,6 +2427,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas } else if (NPC.ai[1] == 3f) { + // Avoid cheap bullshit + NPC.damage = 0; + // How fast SCal moves to the destination float velocity = 32f; float acceleration = 1.2f; @@ -2019,12 +2440,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas acceleration *= 1.15f; } - // Reduce acceleration if target is holding a true melee weapon - if (player.HoldingTrueMeleeWeapon()) - acceleration *= 0.5f; - int posX = 1; - if (NPC.position.X + (NPC.width / 2) < player.position.X + player.width) + if (NPC.Center.X < player.position.X + player.width) posX = -1; // This is where SCal should be @@ -2059,16 +2476,12 @@ namespace CalamityMod.NPCs.SupremeCalamitas NPC.ai[3] = 0f; SoundEngine.PlaySound(HellblastSound, NPC.Center); - // Release a burst of magic dust along with a brimstone hellblast skull. - for (int i = 0; i < 25; i++) + // Release a burst of magic dust along with a brimstone hellblast skull. (pre laugh) + for (int i = 0; i < 6; i++) { - Dust brimstoneMagic = Dust.NewDustPerfect(handPosition, 264); - brimstoneMagic.velocity = NPC.DirectionTo(player.Center).RotatedByRandom(0.31f) * Main.rand.NextFloat(3f, 5f) + NPC.velocity; - brimstoneMagic.scale = Main.rand.NextFloat(1.25f, 1.35f); - brimstoneMagic.noGravity = true; - brimstoneMagic.color = cirrus ? Color.BlueViolet : Color.OrangeRed; - brimstoneMagic.fadeIn = 1.5f; - brimstoneMagic.noLight = true; + Vector2 velOffset = NPC.DirectionTo(player.Center).RotatedByRandom(0.6) * Main.rand.NextFloat(5f, 13f); + PointParticle spark2 = new PointParticle(handPosition + velOffset * 2f, velOffset * 1.5f, false, 18, Main.rand.NextFloat(0.4f, 0.65f), cirrus ? Color.HotPink : Main.rand.NextBool(3) ? Color.Lerp(Color.Red, Color.Magenta, 0.3f) : Color.Red); + GeneralParticleHandler.SpawnParticle(spark2); } if (Main.netMode != NetmodeID.MultiplayerClient) @@ -2077,24 +2490,25 @@ namespace CalamityMod.NPCs.SupremeCalamitas Vector2 projectileSpawn = NPC.Center + projectileVelocity * 4f; projectileVelocity *= 10f * uDieLul; int projectileType = hellblast; - Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileSpawn, projectileVelocity, projectileType, hellblastDamage, 0f, Main.myPlayer); + if (attackPause == 0) + Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileSpawn, projectileVelocity, projectileType, hellblastDamage, 0f, Main.myPlayer, 0f, 2f); } } } - if (Main.rand.NextBool()) + if (Main.rand.NextBool()) // Hand spray magic { - Dust brimstoneMagic = Dust.NewDustPerfect(handPosition, 264); - brimstoneMagic.velocity = Vector2.UnitY.RotatedByRandom(0.14f) * Main.rand.NextFloat(-3.5f, -3f) + NPC.velocity; - brimstoneMagic.scale = Main.rand.NextFloat(1.25f, 1.35f); - brimstoneMagic.noGravity = true; - brimstoneMagic.noLight = true; + GlowOrbParticle orb = new GlowOrbParticle(handPosition, new Vector2(0, -6).RotatedByRandom(0.4) * Main.rand.NextFloat(0.8f, 1.4f), false, 15, Main.rand.NextFloat(0.85f, 1.2f), cirrus ? Color.Magenta : Main.rand.NextBool() ? Color.Red : Color.Lerp(Color.Red, Color.Magenta, 0.3f), true, true); + GeneralParticleHandler.SpawnParticle(orb); } FrameType = FrameAnimationType.OutwardHandCast; } else if (NPC.ai[1] == 4f) { + // Avoid cheap bullshit + NPC.damage = 0; + // How fast SCal moves to the destination float velocity = 32f; float acceleration = 1.2f; @@ -2105,12 +2519,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas acceleration *= 1.15f; } - // Reduce acceleration if target is holding a true melee weapon - if (player.HoldingTrueMeleeWeapon()) - acceleration *= 0.5f; - int posX = 1; - if (NPC.position.X + (NPC.width / 2) < player.position.X + player.width) + if (NPC.Center.X < player.position.X + player.width) posX = -1; // This is where SCal should be @@ -2131,20 +2541,16 @@ namespace CalamityMod.NPCs.SupremeCalamitas FrameChangeSpeed = 0.175f; FrameType = FrameAnimationType.BlastCast; - if (NPC.localAI[1] > shootRate) + if (NPC.localAI[1] > shootRate) // Firing spam projectiles post laugh { Vector2 handPosition = NPC.Center + new Vector2(NPC.spriteDirection * -22f, 2f); - // Release a burst of magic dust when punching. + // Release a burst of magic dust when punching (gigablast). for (int i = 0; i < 25; i++) { - Dust brimstoneMagic = Dust.NewDustPerfect(handPosition, 264); - brimstoneMagic.velocity = NPC.DirectionTo(player.Center).RotatedByRandom(0.24f) * Main.rand.NextFloat(5f, 7f) + NPC.velocity; - brimstoneMagic.scale = Main.rand.NextFloat(1.25f, 1.35f); - brimstoneMagic.noGravity = true; - brimstoneMagic.color = cirrus ? Color.BlueViolet : Color.OrangeRed; - brimstoneMagic.fadeIn = 1.5f; - brimstoneMagic.noLight = true; + Vector2 velOffset = NPC.DirectionTo(player.Center).RotatedByRandom(0.6) * Main.rand.NextFloat(5f, 13f); + GlowOrbParticle spark2 = new GlowOrbParticle(handPosition + velOffset * 2f, velOffset * 1.5f, false, 9, Main.rand.NextFloat(0.4f, 0.65f), cirrus ? Color.HotPink : Main.rand.NextBool(3) ? Color.Lerp(Color.Red, Color.Magenta, 0.3f) : Color.Red); + GeneralParticleHandler.SpawnParticle(spark2); } NPC.localAI[1] = 0f; @@ -2155,7 +2561,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas Vector2 projectileSpawn = NPC.Center + projectileVelocity * 8f; projectileVelocity *= 5f * uDieLul; int projectileType = gigablast; - Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileSpawn, projectileVelocity, projectileType, fireblastDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileSpawn, projectileVelocity, projectileType, gigablastDamage, 0f, Main.myPlayer, 0f, 2f); } } @@ -2169,7 +2575,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas } } - if (lifeRatio < 0.4f) + // Previously the 0.4% health threshold transition + if (lifeRatio <= 0.45f && hasSummonedBrothers && (cirrus ? NPC.AnyNPCs(ModContent.NPCType()) : (NPC.AnyNPCs(ModContent.NPCType()) || NPC.AnyNPCs(ModContent.NPCType()))) == false) { NPC.ai[0] = 1f; NPC.ai[1] = 0f; @@ -2181,9 +2588,11 @@ namespace CalamityMod.NPCs.SupremeCalamitas } #endregion #region Transition - else if (NPC.ai[0] == 1f || NPC.ai[0] == 2f) { + // Avoid cheap bullshit + NPC.damage = 0; + NPC.dontTakeDamage = true; NPC.chaseable = false; @@ -2210,8 +2619,20 @@ namespace CalamityMod.NPCs.SupremeCalamitas NPC.ai[2] = 0f; else { - for (int i = 0; i < 50; i++) - Dust.NewDust(NPC.position, NPC.width, NPC.height, cirrus ? (int)CalamityDusts.PurpleCosmilite : (int)CalamityDusts.Brimstone, Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f, 0, default, 1f); + for (int i = 0; i < 90; i++) + { + Dust spawnDust = Dust.NewDustPerfect(NPC.Center, cirrus ? (int)CalamityDusts.PurpleCosmilite : (int)CalamityDusts.Brimstone, new Vector2(30, 30).RotatedByRandom(100) * Main.rand.NextFloat(0.05f, 1.2f)); + spawnDust.noGravity = true; + spawnDust.scale = Main.rand.NextFloat(1.2f, 2.3f); + } + for (int i = 0; i < 40; i++) + { + Vector2 sparkVel = new Vector2(20, 20).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 1.1f); + GlowOrbParticle orb = new GlowOrbParticle(NPC.Center + sparkVel * 2, sparkVel, false, 120, Main.rand.NextFloat(1.55f, 2.75f), cirrus ? Color.Magenta : Color.Red, true, true); + GeneralParticleHandler.SpawnParticle(orb); + } + Particle pulse = new DirectionalPulseRing(NPC.Center, Vector2.Zero, cirrus ? Color.Magenta : Color.Red, new Vector2(2f, 2f), 0, 0f, 1.1f, 25); + GeneralParticleHandler.SpawnParticle(pulse); SoundEngine.PlaySound(SpawnSound, NPC.Center); } @@ -2238,7 +2659,6 @@ namespace CalamityMod.NPCs.SupremeCalamitas #region LastStage else { - NPC.damage = NPC.defDamage; if (wormAlive) { NPC.dontTakeDamage = true; @@ -2357,6 +2777,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas { if (NPC.ai[1] == 0f) { + // Avoid cheap bullshit + NPC.damage = 0; + // How fast SCal moves to the destination float velocity = 12f; float acceleration = 0.12f; @@ -2367,10 +2790,6 @@ namespace CalamityMod.NPCs.SupremeCalamitas acceleration *= 1.15f; } - // Reduce acceleration if target is holding a true melee weapon - if (player.HoldingTrueMeleeWeapon()) - acceleration *= 0.5f; - // This is where SCal should be Vector2 destination = new Vector2(player.Center.X, player.Center.Y - 550f); @@ -2388,6 +2807,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (NPC.ai[2] >= 240f) { NPC.ai[1] = -1f; + fireFireblastFirst = true; NPC.TargetClosest(); NPC.netUpdate = true; } @@ -2402,53 +2822,43 @@ namespace CalamityMod.NPCs.SupremeCalamitas NPC.localAI[1] = 0f; int randomShot = Main.rand.Next(6); - if (randomShot == 0 && canFireSplitingFireball) + + if (randomShot == 0 && canFireSplitingFireball && !fireFireblastFirst) // fireblast while floating post laugh { SoundEngine.PlaySound(BrimstoneBigShotSound, NPC.Center); canFireSplitingFireball = false; randomShot = gigablast; - for (int i = 0; i < 16; i++) - { - Dust magic = Dust.NewDustPerfect(projectileSpawn, 264); - magic.velocity = projectileVelocity.RotatedByRandom(0.36f) * Main.rand.NextFloat(0.9f, 1.1f) * 1.2f; - magic.color = cirrus ? Color.BlueViolet : Color.OrangeRed; - magic.scale = 1.3f; - magic.fadeIn = 0.6f; - magic.noLight = true; - magic.noGravity = true; - } + Particle pulse = new DirectionalPulseRing(NPC.Center, projectileVelocity * 1.2f, cirrus ? Color.Pink : Color.Red, new Vector2(0.5f, 1f), projectileVelocity.ToRotation(), 0.92f, 0f, 55); + GeneralParticleHandler.SpawnParticle(pulse); + Particle pulse2 = new DirectionalPulseRing(NPC.Center, projectileVelocity * 1f, cirrus ? Color.Pink : Color.Magenta, new Vector2(0.5f, 1f), projectileVelocity.ToRotation(), 0.95f, 0.4f, 55); + GeneralParticleHandler.SpawnParticle(pulse2); if (Main.netMode != NetmodeID.MultiplayerClient) { - Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileSpawn, projectileVelocity, randomShot, fireblastDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileSpawn, projectileVelocity, randomShot, gigablastDamage, 0f, Main.myPlayer, 0f, 2f); NPC.netUpdate = true; } } - else if (randomShot == 1 && canFireSplitingFireball) + else if ((randomShot == 1 && canFireSplitingFireball) || fireFireblastFirst) // Gigablast while floating post laugh { SoundEngine.PlaySound(BrimstoneShotSound, NPC.Center); - canFireSplitingFireball = false; + if (NPC.ai[2] > 1) + canFireSplitingFireball = false; randomShot = fireblast; - for (int i = 0; i < 24; i++) - { - Dust magic = Dust.NewDustPerfect(projectileSpawn, cirrus ? (int)CalamityDusts.PurpleCosmilite : (int)CalamityDusts.Brimstone); - magic.velocity = projectileVelocity.RotatedByRandom(0.36f) * Main.rand.NextFloat(0.9f, 1.1f) * 1.6f; - magic.color = cirrus ? Color.Pink : Color.Red; - magic.scale = 1.5f; - magic.fadeIn = 0.8f; - magic.noLight = true; - magic.noGravity = true; - } + Particle pulse = new DirectionalPulseRing(NPC.Center, projectileVelocity * 1.2f, cirrus ? Color.Pink : Color.Red, new Vector2(0.5f, 1f), projectileVelocity.ToRotation(), 0.95f, 0f, 55); + GeneralParticleHandler.SpawnParticle(pulse); + Particle pulse2 = new DirectionalPulseRing(NPC.Center, projectileVelocity * 1f, cirrus ? Color.Pink : Color.Magenta, new Vector2(0.5f, 1f), projectileVelocity.ToRotation(), 0.98f, 0.4f, 55); + GeneralParticleHandler.SpawnParticle(pulse2); if (Main.netMode != NetmodeID.MultiplayerClient) { - Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileSpawn, projectileVelocity, randomShot, gigablastDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileSpawn, projectileVelocity, randomShot, fireblastDamage, 0f, Main.myPlayer, 0f, 2f); NPC.netUpdate = true; } } - else + else if (!fireFireblastFirst) { SoundEngine.PlaySound(BrimstoneBigShotSound, NPC.Center); canFireSplitingFireball = true; @@ -2457,32 +2867,30 @@ namespace CalamityMod.NPCs.SupremeCalamitas int numProj = 8; for (int j = 0; j < numProj; j++) { - for (int i = 0; i < 7; i++) + for (int i = 0; i < 7; i++) // Spred dust while floating post laugh { - Vector2 magicDustVelocity = projectileVelocity; - magicDustVelocity *= MathHelper.Lerp(0.3f, 1f, i / 7f); - - Dust magic = Dust.NewDustPerfect(projectileSpawn, 264); - magic.velocity = magicDustVelocity; - magic.color = cirrus ? Color.Pink : Color.Red; - magic.scale = MathHelper.Lerp(0.85f, 1.5f, i / 7f); - magic.fadeIn = 0.67f; - magic.noLight = true; - magic.noGravity = true; + Vector2 dustVel = (projectileVelocity * 2).RotatedByRandom(0.9) * (Main.rand.NextFloat(0.5f, 1.9f)); + GlowOrbParticle orb = new GlowOrbParticle(projectileSpawn, dustVel, false, 15, Main.rand.NextFloat(0.75f, 1f), cirrus ? Color.Magenta : Main.rand.NextBool() ? Color.Red : Color.Lerp(Color.Red, Color.Magenta, 0.3f), true, true); + GeneralParticleHandler.SpawnParticle(orb); } if (Main.netMode != NetmodeID.MultiplayerClient) { + float projectileVelocityToPass = projectileVelocity.Length() * 1.3f; Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, j / (float)(numProj - 1))); - Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileSpawn, perturbedSpeed, randomShot, barrageDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileSpawn, perturbedSpeed, randomShot, barrageDamage, 0f, Main.myPlayer, 0f, 4f, projectileVelocityToPass); NPC.netUpdate = true; } } } + fireFireblastFirst = false; } } else if (NPC.ai[1] == 1f) { + // Set damage + NPC.damage = NPC.defDamage; + float chargeVelocity = (wormAlive ? 26f : 30f) + (1f - lifeRatio) * 8f; if (Main.getGoodWorld) @@ -2503,9 +2911,15 @@ namespace CalamityMod.NPCs.SupremeCalamitas } else if (NPC.ai[1] == 2f) { + // Set damage + NPC.damage = NPC.defDamage; + NPC.ai[2] += 1f; if (NPC.ai[2] >= 25f) { + // Avoid cheap bullshit + NPC.damage = 0; + if (!canDespawn) { NPC.velocity *= 0.96f; @@ -2522,6 +2936,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (NPC.ai[2] >= 70f) { + // Avoid cheap bullshit + NPC.damage = 0; + NPC.ai[3] += 1f; NPC.ai[2] = 0f; NPC.TargetClosest(); @@ -2543,6 +2960,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas } else if (NPC.ai[1] == 3f) { + // Avoid cheap bullshit + NPC.damage = 0; + // How fast SCal moves to the destination float velocity = 32f; float acceleration = 1.2f; @@ -2553,12 +2973,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas acceleration *= 1.15f; } - // Reduce acceleration if target is holding a true melee weapon - if (player.HoldingTrueMeleeWeapon()) - acceleration *= 0.5f; - int posX = 1; - if (NPC.position.X + (NPC.width / 2) < player.position.X + player.width) + if (NPC.Center.X < player.position.X + player.width) posX = -1; // This is where SCal should be @@ -2593,16 +3009,12 @@ namespace CalamityMod.NPCs.SupremeCalamitas NPC.ai[3] = 0f; SoundEngine.PlaySound(HellblastSound, NPC.Center); - // Release a burst of magic dust along with a brimstone hellblast skull. - for (int i = 0; i < 25; i++) + // Release a burst of magic dust along with a brimstone hellblast skull. (post laugh) + for (int i = 0; i < 9; i++) { - Dust brimstoneMagic = Dust.NewDustPerfect(handPosition, 264); - brimstoneMagic.velocity = NPC.DirectionTo(player.Center).RotatedByRandom(0.31f) * Main.rand.NextFloat(3f, 5f) + NPC.velocity; - brimstoneMagic.scale = Main.rand.NextFloat(1.25f, 1.35f); - brimstoneMagic.noGravity = true; - brimstoneMagic.color = cirrus ? Color.BlueViolet : Color.OrangeRed; - brimstoneMagic.fadeIn = 1.5f; - brimstoneMagic.noLight = true; + Vector2 velOffset = NPC.DirectionTo(player.Center).RotatedByRandom(0.6) * Main.rand.NextFloat(5f, 13f); + PointParticle spark2 = new PointParticle(handPosition + velOffset * 2f, velOffset * 1.5f, false, 9, Main.rand.NextFloat(0.5f, 0.75f), cirrus ? Color.HotPink : Main.rand.NextBool(3) ? Color.Lerp(Color.Red, Color.Magenta, 0.3f) : Color.Red); + GeneralParticleHandler.SpawnParticle(spark2); } if (Main.netMode != NetmodeID.MultiplayerClient) @@ -2611,25 +3023,30 @@ namespace CalamityMod.NPCs.SupremeCalamitas Vector2 projectileSpawn = NPC.Center + projectileVelocity * 4f; projectileVelocity *= 10f * uDieLul; int projectileType = hellblast; - Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileSpawn, projectileVelocity, projectileType, hellblastDamage, 0f, Main.myPlayer); + if (attackPause == 0) + Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileSpawn, projectileVelocity, projectileType, hellblastDamage, 0f, Main.myPlayer, 0f, 2f); } } } - if (Main.rand.NextBool()) + if (Main.rand.NextBool()) // Hand visual post laugh { - Dust brimstoneMagic = Dust.NewDustPerfect(handPosition, 264); - brimstoneMagic.velocity = Vector2.UnitY.RotatedByRandom(0.14f) * Main.rand.NextFloat(-3.5f, -3f) + NPC.velocity; - brimstoneMagic.scale = Main.rand.NextFloat(1.25f, 1.35f); - brimstoneMagic.noGravity = true; - brimstoneMagic.noLight = true; + GlowOrbParticle orb = new GlowOrbParticle(handPosition, new Vector2(0, -6).RotatedByRandom(0.4) * Main.rand.NextFloat(0.8f, 1.4f), false, 15, Main.rand.NextFloat(0.95f, 1.45f), cirrus ? Color.Magenta : Main.rand.NextBool() ? Color.Red : Color.Lerp(Color.Red, Color.Magenta, 0.5f), true, true); + GeneralParticleHandler.SpawnParticle(orb); } + Dust fust = Dust.NewDustPerfect(handPosition, Main.rand.NextBool(3) ? 60 : 114); + fust.noGravity = true; + fust.velocity = new Vector2(0, -6).RotatedByRandom(0.4) * Main.rand.NextFloat(0.8f, 1.4f); + fust.scale = Main.rand.NextFloat(0.3f, 0.65f); FrameChangeSpeed = 0.245f; FrameType = FrameAnimationType.PunchHandCast; } else if (NPC.ai[1] == 4f) { + // Avoid cheap bullshit + NPC.damage = 0; + // How fast SCal moves to the destination float velocity = 32f; float acceleration = 1.2f; @@ -2640,12 +3057,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas acceleration *= 1.15f; } - // Reduce acceleration if target is holding a true melee weapon - if (player.HoldingTrueMeleeWeapon()) - acceleration *= 0.5f; - int posX = 1; - if (NPC.position.X + (NPC.width / 2) < player.position.X + player.width) + if (NPC.Center.X < player.position.X + player.width) posX = -1; // This is where SCal should be @@ -2669,31 +3082,26 @@ namespace CalamityMod.NPCs.SupremeCalamitas FrameType = FrameAnimationType.BlastPunchCast; } - if (NPC.localAI[1] > shootRate) + if (NPC.localAI[1] > shootRate) // small gigablast post laugh { Vector2 handPosition = NPC.Center + new Vector2(NPC.spriteDirection * -22f, 2f); + Vector2 projectileVelocity = (player.Center - NPC.Center).SafeNormalize(Vector2.UnitY); + Vector2 projectileSpawn = NPC.Center + projectileVelocity * 8f; // Release a burst of magic dust when punching. - for (int i = 0; i < 25; i++) - { - Dust brimstoneMagic = Dust.NewDustPerfect(handPosition, 264); - brimstoneMagic.velocity = NPC.DirectionTo(player.Center).RotatedByRandom(0.24f) * Main.rand.NextFloat(5f, 7f) + NPC.velocity; - brimstoneMagic.scale = Main.rand.NextFloat(1.25f, 1.35f); - brimstoneMagic.noGravity = true; - brimstoneMagic.color = cirrus ? Color.BlueViolet : Color.OrangeRed; - brimstoneMagic.fadeIn = 1.5f; - brimstoneMagic.noLight = true; - } + Particle pulse = new DirectionalPulseRing(NPC.Center, projectileVelocity * 9, cirrus ? Color.Pink : Color.Red, new Vector2(0.5f, 1f), projectileVelocity.ToRotation(), 0.9f, 0f, 60); + GeneralParticleHandler.SpawnParticle(pulse); + Particle pulse2 = new DirectionalPulseRing(NPC.Center, projectileVelocity * 8, cirrus ? Color.Pink : Color.Magenta, new Vector2(0.5f, 1f), projectileVelocity.ToRotation(), 0.93f, 0.4f, 60); + GeneralParticleHandler.SpawnParticle(pulse2); + NPC.localAI[1] = 0f; if (Main.netMode != NetmodeID.MultiplayerClient) { SoundEngine.PlaySound(BrimstoneBigShotSound, NPC.Center); - Vector2 projectileVelocity = (player.Center - NPC.Center).SafeNormalize(Vector2.UnitY); - Vector2 projectileSpawn = NPC.Center + projectileVelocity * 8f; projectileVelocity *= 5f * uDieLul; int projectileType = gigablast; - Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileSpawn, projectileVelocity, projectileType, fireblastDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileSpawn, projectileVelocity, projectileType, gigablastDamage, 0f, Main.myPlayer, 0f, 2f); } } @@ -2707,6 +3115,37 @@ namespace CalamityMod.NPCs.SupremeCalamitas } } } + // Bonus visuals + if (!canDespawn && !hasDoneDeathAnim && shieldOpacity >= 0.9f) + { + NPC.damage = NPC.defDamage; + if (dashVisualCounter < 9) + dashVisualCounter++; + else + { + // Spawn in a helix-style pattern + float sine = (float)Math.Sin(NPC.ai[2] * (0.975f * MathHelper.Clamp(Utils.GetLerpValue(120, 0, dashVisualCounter), 0.5f, 1.1f)) / MathHelper.Pi); + + Vector2 offset = NPC.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(MathHelper.PiOver2) * sine * 33f; + + SparkParticle spark4 = new SparkParticle(NPC.Center + offset - NPC.velocity.SafeNormalize(Vector2.UnitY) * 15f, -NPC.velocity * 0.85f, false, 10, 1.9f * MathHelper.Clamp(Utils.GetLerpValue(120, 0, dashVisualCounter), 0.5f, 1.1f), Main.rand.NextBool() ? Color.Red : Color.Lerp(Color.Red, Color.Magenta, 0.5f)); + GeneralParticleHandler.SpawnParticle(spark4); + SparkParticle spark5 = new SparkParticle(NPC.Center - offset - NPC.velocity.SafeNormalize(Vector2.UnitY) * 15f, -NPC.velocity * 0.85f, false, 10, 1.9f * MathHelper.Clamp(Utils.GetLerpValue(120, 0, dashVisualCounter), 0.5f, 1.1f), Main.rand.NextBool() ? Color.Red : Color.Lerp(Color.Red, Color.Magenta, 0.5f)); + GeneralParticleHandler.SpawnParticle(spark5); + + Dust dashDust = Dust.NewDustPerfect(NPC.Center + Main.rand.NextVector2Circular(NPC.width, NPC.height), 182); + dashDust.noGravity = true; + dashDust.velocity = -NPC.velocity.RotatedByRandom(0.15f) * Main.rand.NextFloat(0.9f, 1.2f); + dashDust.scale = Main.rand.NextFloat(0.6f, 1.4f); + + dashVisualCounter++; + } + } + else + { + NPC.damage = 0; + dashVisualCounter = 0; + } #endregion } @@ -2727,14 +3166,6 @@ namespace CalamityMod.NPCs.SupremeCalamitas float castCompletion = Utils.GetLerpValue(sepulcherSpawnCastTime - 25f, 0f, attackCastDelay, true); Vector2 armPosition = NPC.Center + Vector2.UnitX * NPC.spriteDirection * -8f; - // Emit dust at the arm position as a sort of magic effect. - Dust magic = Dust.NewDustPerfect(armPosition, 264); - magic.velocity = Vector2.UnitY.RotatedByRandom(0.17f) * -Main.rand.NextFloat(2.7f, 4.1f); - magic.color = cirrus ? Color.BlueViolet : Color.OrangeRed; - magic.noLight = true; - magic.fadeIn = 0.6f; - magic.noGravity = true; - foreach (Vector2 heartSpawnPosition in heartSpawnPositions) { Vector2 leftDustPosition = Vector2.CatmullRom(armPosition + Vector2.UnitY * 1000f, armPosition, heartSpawnPosition, heartSpawnPosition + Vector2.UnitY * 1000f, castCompletion); @@ -2767,7 +3198,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas // Spawn Dragonfollies if Cirrus exists. for (int i = 0; i < 20; i++) { - Dust castFire = Dust.NewDustPerfect(heartSpawnPosition + Main.rand.NextVector2Square(-30f, 30f), cirrus ? (int)CalamityDusts.Polterplasm : (int)CalamityDusts.Brimstone); + Dust castFire = Dust.NewDustPerfect(heartSpawnPosition + Main.rand.NextVector2Square(-30f, 30f), cirrus ? (int)CalamityDusts.Necroplasm : (int)CalamityDusts.Brimstone); castFire.velocity = Vector2.UnitY.RotatedByRandom(0.08f) * -Main.rand.NextFloat(3f, 4.45f); castFire.scale = Main.rand.NextFloat(1.35f, 1.6f); castFire.fadeIn = 1.25f; @@ -2817,7 +3248,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas spawnY = spawnYReset; if (NPC.CountNPCS(ModContent.NPCType()) <= 0) // Check is here for the zenith seed - NPC.SpawnOnPlayer(NPC.FindClosestPlayer(), ModContent.NPCType()); + NPC.NewNPC(NPC.GetSource_FromAI(), (int)(safeBox.Center().X), (int)(safeBox.Bottom().Y), ModContent.NPCType()); } NPC.netUpdate = true; @@ -2829,6 +3260,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas public void DoBrothersSpawningCastAnimation(int bodyWidth, int bodyHeight) { + Player player = Main.player[NPC.target]; + Vector2 leftOfCircle = NPC.Center + Vector2.UnitY * bodyHeight * 0.5f - Vector2.UnitX * bodyWidth * 0.45f; Vector2 rightOfCircle = NPC.Center + Vector2.UnitY * bodyHeight * 0.5f + Vector2.UnitX * bodyWidth * 0.45f; @@ -2839,7 +3272,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas NPC.netUpdate = true; } - // Draw some magic dust much like the sandstorm elemental cast that approaches where the brothers will spawn. + // Draw some magic much like the sandstorm elemental cast that approaches where the brothers will spawn. if (attackCastDelay < brothersSpawnCastTime - 45f && attackCastDelay >= 60f) { float castCompletion = Utils.GetLerpValue(brothersSpawnCastTime - 45f, 60f, attackCastDelay); @@ -2847,58 +3280,65 @@ namespace CalamityMod.NPCs.SupremeCalamitas Vector2 leftDustPosition = Vector2.CatmullRom(leftOfCircle + Vector2.UnitY * 1000f, leftOfCircle, catastropheSpawnPosition, catastropheSpawnPosition + Vector2.UnitY * 1000f, castCompletion); Vector2 rightDustPosition = Vector2.CatmullRom(rightOfCircle + Vector2.UnitY * 1000f, rightOfCircle, cataclysmSpawnPosition, cataclysmSpawnPosition + Vector2.UnitY * 1000f, castCompletion); - Dust castMagicDust = Dust.NewDustPerfect(leftDustPosition, 267); - castMagicDust.scale = 1.67f; - castMagicDust.velocity = Main.rand.NextVector2CircularEdge(0.2f, 0.2f); - castMagicDust.color = cirrus ? Color.Pink : Color.Red; - castMagicDust.noGravity = true; - - castMagicDust = Dust.CloneDust(castMagicDust); - castMagicDust.position = rightDustPosition; + GlowOrbParticle orb = new GlowOrbParticle(leftDustPosition, Vector2.Zero, false, 20, 2.8f - attackCastDelay * 0.01f, cirrus ? Color.Pink : Color.Red, true, true); + GeneralParticleHandler.SpawnParticle(orb); + GlowOrbParticle orb2 = new GlowOrbParticle(rightDustPosition, Vector2.Zero, false, 20, 2.8f - attackCastDelay * 0.01f, cirrus ? Color.Pink : Color.Red, true, true); + GeneralParticleHandler.SpawnParticle(orb2); } // Make some magic effects at where the bros will spawn. if (attackCastDelay < 60f) { + if (attackCastDelay == 59) + { + + Particle bloom1 = new BloomParticle(catastropheSpawnPosition, Vector2.Zero, Color.DeepSkyBlue, 0f, 1.4f, 59, false); + GeneralParticleHandler.SpawnParticle(bloom1); + Particle bloom2 = new BloomParticle(catastropheSpawnPosition, Vector2.Zero, Color.DeepSkyBlue, 0f, 1f, 59, false); + GeneralParticleHandler.SpawnParticle(bloom2); + Particle bloom3 = new BloomParticle(cataclysmSpawnPosition, Vector2.Zero, new Color(121, 21, 77), 0f, 1.4f, 59, false); + GeneralParticleHandler.SpawnParticle(bloom3); + Particle bloom4 = new BloomParticle(cataclysmSpawnPosition, Vector2.Zero, new Color(121, 21, 77), 0f, 1f, 59, false); + GeneralParticleHandler.SpawnParticle(bloom4); + } float burnPower = Utils.GetLerpValue(60f, 20f, attackCastDelay); if (attackCastDelay == 0f) burnPower = 4f; - for (int i = 0; i < MathHelper.Lerp(5, 25, burnPower); i++) + for (int i = 0; i < MathHelper.Lerp(1, 6, burnPower); i++) { - Dust fire = Dust.NewDustPerfect(catastropheSpawnPosition + Main.rand.NextVector2Circular(60f, 60f), 264); - fire.velocity = Vector2.UnitY * -Main.rand.NextFloat(2f, 4f); - - if (attackCastDelay == 0) - { - fire.velocity += Main.rand.NextVector2Circular(4f, 4f); - fire.fadeIn = 1.6f; - } - - fire.noGravity = true; - fire.noLight = true; - fire.color = cirrus ? Color.BlueViolet : Color.OrangeRed; - fire.scale = 1.4f + fire.velocity.Y * 0.16f; - - fire = Dust.NewDustPerfect(cataclysmSpawnPosition + Main.rand.NextVector2Circular(60f, 60f), 264); - fire.velocity = Vector2.UnitY * -Main.rand.NextFloat(2f, 4f); - - if (attackCastDelay == 0) - { - fire.velocity += Main.rand.NextVector2Circular(4f, 4f); - fire.fadeIn = 1.6f; - } - - fire.noGravity = true; - fire.noLight = true; - fire.color = cirrus ? Color.BlueViolet : Color.OrangeRed; - fire.scale = 1.4f + fire.velocity.Y * 0.16f; + Vector2 velOffset = CalamityUtils.RandomVelocity(100f, 70f, 150f, 0.04f); + velOffset *= Main.rand.NextFloat(2, 13); + VoidSparkParticle spark1 = new VoidSparkParticle(catastropheSpawnPosition + velOffset * 4.5f, -velOffset * 0.25f, false, 9, Main.rand.NextFloat(0.08f, 0.16f) - attackCastDelay * 0.002f, Main.rand.NextBool(5) ? Color.DeepSkyBlue : Color.Red); + GeneralParticleHandler.SpawnParticle(spark1); + VoidSparkParticle spark2 = new VoidSparkParticle(cataclysmSpawnPosition + velOffset * 4.5f, -velOffset * 0.25f, false, 9, Main.rand.NextFloat(0.08f, 0.16f) - attackCastDelay * 0.002f, Main.rand.NextBool(5) ? new Color(121, 21, 77) : Color.Red); + GeneralParticleHandler.SpawnParticle(spark2); } } // And spawn them. if (attackCastDelay == 0) { + for (int i = 0; i < 30; i++) + { + SparkParticle spark1 = new SparkParticle(catastropheSpawnPosition, new Vector2(5, 5).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1.5f), false, 35, Main.rand.NextFloat(1.2f, 1.45f), Main.rand.NextBool() ? Color.DeepSkyBlue : Color.Red); + GeneralParticleHandler.SpawnParticle(spark1); + + SparkParticle spark2 = new SparkParticle(cataclysmSpawnPosition, new Vector2(5, 5).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1.5f), false, 35, Main.rand.NextFloat(1.2f, 1.45f), Main.rand.NextBool() ? new Color(80, 21, 77) : Color.Red); + GeneralParticleHandler.SpawnParticle(spark2); + + Dust catastrophedust = Dust.NewDustPerfect(catastropheSpawnPosition, 279, new Vector2(9, 9).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 1.5f)); + catastrophedust.noGravity = true; + catastrophedust.scale = Main.rand.NextFloat(1.5f, 1.85f); + catastrophedust.color = Color.DeepSkyBlue; + + Dust cataclysmdust = Dust.NewDustPerfect(cataclysmSpawnPosition, 279, new Vector2(9, 9).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 1.5f)); + cataclysmdust.noGravity = true; + cataclysmdust.scale = Main.rand.NextFloat(1.5f, 1.85f); + cataclysmdust.color = new Color(80, 21, 77); + + } + if (!BossRushEvent.BossRushActive) { string key = "Mods.CalamityMod.Status.Boss.SCalBrothersText"; @@ -2912,11 +3352,13 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (Main.netMode != NetmodeID.MultiplayerClient) { - CalamityUtils.SpawnBossBetter(catastropheSpawnPosition, cirrus ? ModContent.NPCType() : ModContent.NPCType()); - CalamityUtils.SpawnBossBetter(cataclysmSpawnPosition, cirrus ? ModContent.NPCType() : ModContent.NPCType()); + bool broDirection = Main.rand.NextBool(); + CalamityUtils.SpawnBossBetter(catastropheSpawnPosition, cirrus ? ModContent.NPCType() : ModContent.NPCType(), null, broDirection == false ? 1 : -1); + CalamityUtils.SpawnBossBetter(cataclysmSpawnPosition, cirrus ? ModContent.NPCType() : ModContent.NPCType(), null, broDirection == true ? 1 : -1); } - SoundEngine.PlaySound(SoundID.DD2_DarkMageHealImpact, NPC.Center); + SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/NPCKilled/RavagerDeath1") with { Pitch = -0.2f }, cataclysmSpawnPosition); + SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/NPCKilled/RavagerDeath2") with { Pitch = -0.2f }, catastropheSpawnPosition); hasSummonedBrothers = true; } } @@ -2979,7 +3421,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas CalamityGlobalNPC.SCalEpiphany = -1; CalamityGlobalNPC.SCalAcceptance = -1; - if (startFifthAttack && gettingTired5) + if (startFifthAttack && gettingTired5 && (giveUpCounter < 1160 || hasDoneDeathAnim)) CalamityGlobalNPC.SCalAcceptance = NPC.whoAmI; else if (lifeRatio <= 0.3f) CalamityGlobalNPC.SCalEpiphany = NPC.whoAmI; @@ -3039,13 +3481,13 @@ namespace CalamityMod.NPCs.SupremeCalamitas normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); // SCal vanity set (This drops all at once, or not at all) - var scalVanitySet = ItemDropRule.Common(ModContent.ItemType(), 7); - scalVanitySet.OnSuccess(ItemDropRule.Common(ModContent.ItemType())); - scalVanitySet.OnSuccess(ItemDropRule.Common(ModContent.ItemType())); - scalVanitySet.OnSuccess(ItemDropRule.Common(ModContent.ItemType())); - normalOnly.Add(scalVanitySet); + var scalVanitySet = ItemDropRule.Common(ModContent.ItemType(), 7); + scalVanitySet.OnSuccess(ItemDropRule.Common(ModContent.ItemType())); + scalVanitySet.OnSuccess(ItemDropRule.Common(ModContent.ItemType())); + scalVanitySet.OnSuccess(ItemDropRule.Common(ModContent.ItemType())); + normalOnly.Add(scalVanitySet); - // Furniture + // Furniture normalOnly.Add(ModContent.ItemType(), ThankYouPainting.DropInt); } @@ -3150,7 +3592,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas alicornFrameCounter++; if (alicornFrameCounter > 6) { - alicornFrame ++; + alicornFrame++; alicornFrameCounter = 0; } if (alicornFrame > 14 || alicornFrame < 9) @@ -3160,7 +3602,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas } } - public override Color? GetAlpha(Color drawColor) => willCharge ? drawColor * NPC.Opacity * 0.45f : null; + public override Color? GetAlpha(Color drawColor) => willCharge ? Color.Lerp(Color.Red, drawColor, 0.7f) * NPC.Opacity * 0.45f : null; public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { @@ -3168,12 +3610,12 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = DownedBossSystem.downedCalamitas && !BossRushEvent.BossRushActive ? TextureAssets.Npc[NPC.type].Value : ModContent.Request("CalamityMod/NPCs/SupremeCalamitas/SupremeCalamitasHooded").Value; + Texture2D texture2D15 = DownedBossSystem.downedCalamitas && !BossRushEvent.BossRushActive ? TextureAssets.Npc[NPC.type].Value : HoodedTexture.Value; Texture2D pony = ModContent.Request("CalamityMod/Items/Mounts/AlicornMount_Front").Value; bool inPhase2 = NPC.ai[0] >= 3f && (NPC.life > NPC.lifeMax * 0.01 || cirrus); if (cirrus) - texture2D15 = inPhase2 ? ModContent.Request("CalamityMod/NPCs/SupremeCalamitas/SupremeCirrus_Shimmered").Value : ModContent.Request("CalamityMod/NPCs/SupremeCalamitas/SupremeCirrus").Value; + texture2D15 = inPhase2 ? CirrusTexture2.Value : CirrusTexture.Value; Vector2 halfSizeTexture = new Vector2(texture2D15.Width / 2f, texture2D15.Height / Main.npcFrameCount[NPC.type] / 2f); Vector2 ponyOrigin = new Vector2(pony.Width / 2f, pony.Height / 30f); @@ -3244,6 +3686,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas public void DrawForcefield(SpriteBatch spriteBatch) { + Player player = Main.player[NPC.target]; + + float opacity = 1; spriteBatch.EnterShaderRegion(); float intensity = hitTimer / 35f; @@ -3253,20 +3698,28 @@ namespace CalamityMod.NPCs.SupremeCalamitas intensity = 0.75f + Math.Abs((float)Math.Cos(Main.GlobalTimeWrappedHourly * 1.7f)) * 0.1f; // Make the forcefield weaker in the second phase as a means of showing desparation. - if (NPC.ai[0] >= 3f) - intensity *= 0.6f; + //if (NPC.ai[0] >= 3f) + //intensity *= 0.6f; float lifeRatio = NPC.life / (float)NPC.lifeMax; + + if (lifeRatio < 0.05f) + forcefieldOpacity = 0.75f; + if (lifeRatio <= 0.01f) + forcefieldOpacity = 0.6f; + float flickerPower = 0f; if (lifeRatio < 0.6f) flickerPower += 0.1f; if (lifeRatio < 0.3f) - flickerPower += 0.15f; - if (lifeRatio < 0.1f) - flickerPower += 0.2f; + flickerPower += 0.25f; + if (postMusicHit) + flickerPower += 0.61f; if (lifeRatio < 0.05f) - flickerPower += 0.1f; - float opacity = forcefieldOpacity; + flickerPower += Main.rand.NextFloat(0.7f, 1f); + if (lifeRatio <= 0.01f) + flickerPower += 0.08f; + opacity = forcefieldOpacity; opacity *= MathHelper.Lerp(1f, MathHelper.Max(1f - flickerPower, 0.56f), (float)Math.Pow(Math.Cos(Main.GlobalTimeWrappedHourly * MathHelper.Lerp(3f, 5f, flickerPower)), 24D)); // During/prior to a charge the forcefield is always darker than usual and thus its intensity is also higher. @@ -3274,32 +3727,41 @@ namespace CalamityMod.NPCs.SupremeCalamitas intensity = 1.1f; // Dampen the opacity and intensity slightly, to allow SCal to be more easily visible inside of the forcefield. - intensity *= 0.75f; - opacity *= 0.75f; + intensity *= musicSyncCounter <= 0 && musicSyncCounter > -30 ? Utils.GetLerpValue(120, 0, musicSyncCounter, true) : 0.75f; + opacity *= musicSyncCounter <= 0 && musicSyncCounter > -30 ? Utils.GetLerpValue(120, 0, musicSyncCounter, true) : 0.75f; - Texture2D forcefieldTexture = ModContent.Request("CalamityMod/NPCs/SupremeCalamitas/ForcefieldTexture").Value; + Texture2D forcefieldTexture = ForcefieldTexture.Value; GameShaders.Misc["CalamityMod:SupremeShield"].UseImage1("Images/Misc/Perlin"); Color forcefieldColor = Color.DarkViolet; Color secondaryForcefieldColor = (cirrus ? Color.HotPink : Color.Red) * 1.4f; - if (!NPC.dontTakeDamage && (willCharge || NPC.ai[1] == 2f)) + if (!NPC.dontTakeDamage && willCharge && NPC.ai[1] != 2f) { - forcefieldColor *= 0.25f; - secondaryForcefieldColor = Color.Lerp(secondaryForcefieldColor, Color.Black, 0.7f); + forcefieldColor = Color.Magenta; + secondaryForcefieldColor = Color.Lerp(secondaryForcefieldColor, Color.Lerp(Color.Red, Color.Magenta, 0.3f), 0.7f); } + else + forcefieldColor = Color.DarkViolet; forcefieldColor *= opacity; secondaryForcefieldColor *= opacity; GameShaders.Misc["CalamityMod:SupremeShield"].UseSecondaryColor(secondaryForcefieldColor); GameShaders.Misc["CalamityMod:SupremeShield"].UseColor(forcefieldColor); - GameShaders.Misc["CalamityMod:SupremeShield"].UseSaturation(intensity); - GameShaders.Misc["CalamityMod:SupremeShield"].UseOpacity(opacity); + GameShaders.Misc["CalamityMod:SupremeShield"].UseSaturation(1); + GameShaders.Misc["CalamityMod:SupremeShield"].UseOpacity(0.65f); GameShaders.Misc["CalamityMod:SupremeShield"].Apply(); - spriteBatch.Draw(forcefieldTexture, NPC.Center - Main.screenPosition, null, Color.White * opacity, 0f, forcefieldTexture.Size() * 0.5f, forcefieldScale * 3f, SpriteEffects.None, 0f); + Texture2D centerTexture = ModContent.Request("CalamityMod/Particles/CentralGold").Value; + Texture2D immuneTex = ModContent.Request("CalamityMod/Particles/SemiCircularSmearVertical").Value; + if (postMusicHit) + spriteBatch.Draw(centerTexture, NPC.Center - Main.screenPosition, null, (Color.White with { A = 0 } * opacity) * 2f, rotateAwayPlayer, centerTexture.Size() * 0.5f, forcefieldScale * 0.088f * forcefieldPureVisualScale, SpriteEffects.None, 0f); + if (!NPC.dontTakeDamage) + spriteBatch.Draw(forcefieldTexture, NPC.Center - Main.screenPosition, null, Color.White * opacity, postMusicHit ? rotateToPlayer : 0, forcefieldTexture.Size() * 0.5f, forcefieldScale * 3f * forcefieldPureVisualScale, SpriteEffects.None, 0f); + else + spriteBatch.Draw(immuneTex, NPC.Center - Main.screenPosition, null, Color.White * opacity * 0.3f, rotateToPlayer, immuneTex.Size() * 0.5f, forcefieldScale * 1.35f * forcefieldPureVisualScale, SpriteEffects.None, 0f); spriteBatch.ExitShaderRegion(); } @@ -3317,8 +3779,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas jawRotationOffset += MathHelper.Lerp(0.04f, -0.82f, (float)Math.Sin(Main.GlobalTimeWrappedHourly * 17.2f) * 0.5f + 0.5f); Color shieldColor = Color.White * shieldOpacity; - Texture2D shieldSkullTexture = ModContent.Request("CalamityMod/NPCs/SupremeCalamitas/SupremeShieldTop").Value; - Texture2D shieldJawTexture = ModContent.Request("CalamityMod/NPCs/SupremeCalamitas/SupremeShieldBottom").Value; + Texture2D shieldSkullTexture = ShieldTopTexture.Value; + Texture2D shieldJawTexture = ShieldBottomTexture.Value; Vector2 drawPosition = NPC.Center + shieldRotation.ToRotationVector2() * 24f - Main.screenPosition; Vector2 jawDrawPosition = drawPosition; SpriteEffects direction = Math.Cos(shieldRotation) > 0 ? SpriteEffects.None : SpriteEffects.FlipVertically; @@ -3355,10 +3817,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas } if (NPC.life <= 0) { - NPC.position.X = NPC.position.X + (NPC.width / 2); - NPC.position.Y = NPC.position.Y + (NPC.height / 2); - NPC.width = 100; - NPC.height = 100; + NPC.position = NPC.Center; + NPC.width = NPC.height = 100; NPC.position.X = NPC.position.X - (NPC.width / 2); NPC.position.Y = NPC.position.Y - (NPC.height / 2); for (int i = 0; i < 40; i++) @@ -3384,7 +3844,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { - NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } diff --git a/NPCs/SupremeCalamitas/SupremeCalamitas.png b/NPCs/SupremeCalamitas/SupremeCalamitas.png index 1040ac0397..3e729e5486 100644 Binary files a/NPCs/SupremeCalamitas/SupremeCalamitas.png and b/NPCs/SupremeCalamitas/SupremeCalamitas.png differ diff --git a/NPCs/SupremeCalamitas/SupremeCalamitasHooded.png b/NPCs/SupremeCalamitas/SupremeCalamitasHooded.png index 23b956ca93..0d99e8edfa 100644 Binary files a/NPCs/SupremeCalamitas/SupremeCalamitasHooded.png and b/NPCs/SupremeCalamitas/SupremeCalamitasHooded.png differ diff --git a/NPCs/SupremeCalamitas/SupremeCataclysm.cs b/NPCs/SupremeCalamitas/SupremeCataclysm.cs index e79e7fa71e..005abccc7d 100644 --- a/NPCs/SupremeCalamitas/SupremeCataclysm.cs +++ b/NPCs/SupremeCalamitas/SupremeCataclysm.cs @@ -1,56 +1,77 @@ -using CalamityMod.Dusts; +using System; +using System.IO; +using CalamityMod.Dusts; using CalamityMod.Events; +using CalamityMod.Items.Placeables.Furniture.Trophies; +using CalamityMod.Items.Weapons.Summon; +using CalamityMod.NPCs.DevourerofGods; +using CalamityMod.Particles; using CalamityMod.Projectiles.Boss; using CalamityMod.World; -using CalamityMod.Items.Placeables.Furniture.Trophies; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; +using ReLogic.Content; using Terraria; +using Terraria.Audio; using Terraria.GameContent; using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Particles; -using Terraria.Audio; +using Terraria.Utilities.Terraria.Utilities; namespace CalamityMod.NPCs.SupremeCalamitas { [AutoloadBossHead] public class SupremeCataclysm : ModNPC { - public int VerticalOffset = 375; + public int VerticalOffset = 0; public int CurrentFrame; public bool PunchingFromRight; - public const int HorizontalOffset = 750; + public int HorizontalOffset = 750; - public const int PunchCounterLimit = 60; + public const int PunchCounterLimit = 50; public const int DartBurstCounterLimit = 300; + public const int PreBigAttackPause = 50; public const float NormalBrothersDR = 0.25f; + public int BigAttackLimit = 7; + public bool targetSide = false; + public int secondOrbTimer = 0; + public Vector2 offset = Vector2.Zero; + public bool MovingUp = true; + public bool EnrageRoar = true; + public int doublePunchCounter = 0; + public bool setMovement = true; + public bool broIsAlive = true; public Player Target => Main.player[NPC.target]; public ref float PunchCounter => ref NPC.ai[1]; public ref float DartBurstCounter => ref NPC.ai[2]; public ref float ElapsedVerticalDistance => ref NPC.ai[3]; public ref float AttackDelayTimer => ref NPC.localAI[0]; + public ref float BigAttackTimer => ref NPC.localAI[1]; + + public static Asset GlowTexture; public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 9; NPCID.Sets.TrailingMode[NPC.type] = 1; NPCID.Sets.BossBestiaryPriority.Add(Type); - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { Scale = 0.3f, PortraitPositionYOverride = 36f, }; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -70,10 +91,11 @@ namespace CalamityMod.NPCs.SupremeCalamitas NPC.knockBackResist = 0f; NPC.noGravity = true; NPC.noTileCollide = true; - NPC.HitSound = SoundID.DD2_OgreRoar; - NPC.DeathSound = SoundID.NPCDeath52; + NPC.HitSound = SupremeCalamitas.BrotherHit; + NPC.DeathSound = SupremeCalamitas.BrotherDeath; NPC.Calamity().VulnerableToHeat = false; NPC.Calamity().VulnerableToCold = true; + NPC.localAI[1] = 500; } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -81,7 +103,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas int associatedNPCType = ModContent.NPCType(); bestiaryEntry.UIInfoProvider = new CommonEnemyUICollectionInfoProvider(ContentSamples.NpcBestiaryCreditIdsByNpcNetIds[associatedNPCType], quickUnlock: true); - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.SupremeCataclysm") }); @@ -125,9 +147,20 @@ namespace CalamityMod.NPCs.SupremeCalamitas public override void AI() { + if (setMovement) + { + MovingUp = (NPC.ai[0] == 1 ? true : false); + setMovement = false; + } + // Setting this in SetDefaults will disable expert mode scaling, so put it here instead NPC.damage = 0; + NPC.direction = NPC.spriteDirection; + + if (BigAttackTimer > 0) + BigAttackTimer--; + // Set the whoAmI variable. CalamityGlobalNPC.SCalCataclysm = NPC.whoAmI; @@ -141,6 +174,13 @@ namespace CalamityMod.NPCs.SupremeCalamitas return; } + NPC scal = Main.npc[CalamityGlobalNPC.SCal]; + if (scal.ModNPC().respawnBro == false && Main.masterMode && !broIsAlive) + { + if (NPC.life > (NPC.lifeMax * 0.65f)) + NPC.life = (int)(NPC.lifeMax * 0.65f); + } + // Difficulty modes bool bossRush = BossRushEvent.BossRushActive; bool death = CalamityWorld.death || bossRush; @@ -168,93 +208,260 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (!NPC.WithinRange(Target.Center, CalamityGlobalNPC.CatchUpDistance200Tiles)) NPC.TargetClosest(); - float acceleration = 1.5f; - - // Reduce acceleration if target is holding a true melee weapon. - if (Main.player[NPC.target].HoldingTrueMeleeWeapon()) - acceleration *= 0.5f; - + float acceleration = Utils.Remap(AttackDelayTimer, 0f, 120f, 2f, 4f); int verticalSpeed = (int)Math.Round(MathHelper.Lerp(2f, 6.5f, 1f - totalLifeRatio)); - // Move up. - if (ElapsedVerticalDistance < HorizontalOffset) + bool Phase2 = broIsAlive == false ? true : false; + if (NPC.life / (float)NPC.lifeMax < (death ? 0.6 : 0.4) && !Phase2) { - ElapsedVerticalDistance += verticalSpeed; - VerticalOffset -= verticalSpeed; + if (EnrageRoar) + { + EnrageRoar = false; + SoundStyle yell = new("CalamityMod/Sounds/NPCKilled/RavagerLimbLoss2"); + SoundEngine.PlaySound(yell with { Volume = 1.5f, Pitch = 0.3f }, NPC.Center); + } + Phase2 = true; } + - // Move down. - else if (ElapsedVerticalDistance < HorizontalOffset * 2) + + // Buffs for the big attack when the other brother dies + if (Phase2 && BigAttackTimer > 400) + BigAttackTimer = 400; + + if (broIsAlive == false && BigAttackTimer > 0 && BigAttackLimit < 29) + BigAttackLimit = 29; + else if (BigAttackTimer > 0 && BigAttackLimit < 7) + BigAttackLimit = 7; + + if (BigAttackTimer > PreBigAttackPause) { - ElapsedVerticalDistance += verticalSpeed; - VerticalOffset += verticalSpeed; - } + if (Phase2) + { + if (MovingUp) + { + // Move up. + if (VerticalOffset < 400) + { + VerticalOffset += (int)(verticalSpeed * 1.5f); + } + else + MovingUp = false; + } + else + { + // Move down. + if (VerticalOffset > -400) + { + VerticalOffset -= (int)(verticalSpeed * 1.5f); + } + else + MovingUp = true; + } - // Reset the vertical distance once a single period has concluded. + // Hover to the side of the target. + Vector2 idealVelocity = NPC.SafeDirectionTo(Target.Center + new Vector2(HorizontalOffset * (targetSide ? -1 : 1), VerticalOffset)) * Utils.Remap(AttackDelayTimer, 60f, 120f, 0f, 50f); + if (PunchCounter <= PunchCounterLimit * 0.3f) + { + if (AttackDelayTimer == 120 && Main.rand.NextBool()) + { + for (int i = 0; i < 6; i++) + { + Dust cataclysmdust = Dust.NewDustPerfect(NPC.Center + Main.rand.NextVector2Circular(NPC.width, NPC.height) - NPC.velocity * 0.5f, 66, -NPC.velocity * Main.rand.NextFloat(0.1f, 0.6f)); + cataclysmdust.noGravity = true; + cataclysmdust.scale = Main.rand.NextFloat(0.7f, 1.3f); + cataclysmdust.color = Color.Lerp(Color.Red, Color.Magenta, 0.5f); + } + } + CalamityUtils.SmoothMovement(NPC, 0, (Target.Center + new Vector2(-HorizontalOffset * (!targetSide ? -1 : 1), VerticalOffset)) - NPC.Center, Utils.Remap(AttackDelayTimer, 10f, 120f, 20f, 80f), 1f, false); + } + else + NPC.velocity *= 0.85f; + } + else + { + if (MovingUp) + { + // Move up. + if (VerticalOffset < 400) + { + VerticalOffset += verticalSpeed; + } + else + MovingUp = false; + } + else + { + // Move down. + if (VerticalOffset > -400) + { + VerticalOffset -= verticalSpeed; + } + else + MovingUp = true; + } + + if (PunchCounter <= PunchCounterLimit * 0.3f) + { + offset = NPC.DirectionTo(Target.Center) * 70f * (BigAttackTimer <= 60 ? -4 : 1); + } + else + offset *= 0.9f; + CalamityUtils.SmoothMovement(NPC, 0, (Target.Center + new Vector2(-HorizontalOffset * (!targetSide ? -1 : 1), VerticalOffset)) - NPC.Center - offset, 17, 2f, false); + } + } else - ElapsedVerticalDistance = 0f; + NPC.velocity *= 0.9f; // Reset rotation to zero. NPC.rotation = 0f; - // Hover to the side of the target. - Vector2 idealVelocity = NPC.SafeDirectionTo(Target.Center + new Vector2(HorizontalOffset, VerticalOffset)) * 60f; - NPC.SimpleFlyMovement(idealVelocity, acceleration); + // Set direction. + NPC.spriteDirection = (Target.Center.X > NPC.Center.X).ToDirectionInt(); // Have a small delay prior to shooting projectiles. if (AttackDelayTimer < 120f) - AttackDelayTimer++; + AttackDelayTimer += (death ? 1.5f : 1f); // Handle projectile shots. - else + else if (BigAttackTimer > PreBigAttackPause) { // Shoot fists. - float fireRate = BossRushEvent.BossRushActive ? 2f : MathHelper.Lerp(1f, 2.5f, 1f - totalLifeRatio); + float fireRate = BossRushEvent.BossRushActive ? 2f : MathHelper.Lerp(1.5f, 2f, 1f - totalLifeRatio) * (broIsAlive == false ? death ? 1.32f : 1.1f : 1); + PunchCounter += fireRate; if (PunchCounter >= PunchCounterLimit) { PunchCounter = 0f; SoundEngine.PlaySound(SupremeCalamitas.HellblastSound, NPC.Center); + int type = ModContent.ProjectileType(); + + if (Main.zenithWorld) + type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); - if (bossRush) - damage /= 2; + if (bossRush) + damage /= 2; + if (Main.netMode != NetmodeID.MultiplayerClient) { - Vector2 fistSpawnPosition = NPC.Center + Vector2.UnitX * -74f; - Projectile.NewProjectile(NPC.GetSource_FromAI(), fistSpawnPosition, Vector2.UnitX * -8f, type, damage, 0f, Main.myPlayer, 0f, PunchingFromRight.ToInt()); + Vector2 fistSpawnPosition = NPC.Center + Vector2.UnitX * 74f * NPC.direction; + if (Phase2) + { + if (doublePunchCounter < 2) + { + Projectile.NewProjectile(NPC.GetSource_FromAI(), fistSpawnPosition, NPC.DirectionTo(Target.Center) * 15f, type, damage, 0f, Main.myPlayer, 0f, PunchingFromRight.ToInt(), 2); + doublePunchCounter++; + } + else + { + Projectile.NewProjectile(NPC.GetSource_FromAI(), fistSpawnPosition, NPC.DirectionTo(Target.Center).RotatedBy(broIsAlive == false ? 0.48f : 0.55f) * 15f, type, damage, 0f, Main.myPlayer, 0f, PunchingFromRight.ToInt(), 2); + Projectile.NewProjectile(NPC.GetSource_FromAI(), fistSpawnPosition, NPC.DirectionTo(Target.Center).RotatedBy(broIsAlive == false ? - 0.48f : -0.55f) * 15f, type, damage, 0f, Main.myPlayer, 0f, PunchingFromRight.ToInt(), 2); + doublePunchCounter = 0; + } + } + else + Projectile.NewProjectile(NPC.GetSource_FromAI(), fistSpawnPosition, NPC.DirectionTo(Target.Center) * 15f, type, damage, 0f, Main.myPlayer, 0f, PunchingFromRight.ToInt(), 2); } PunchingFromRight = !PunchingFromRight; CurrentFrame = 0; + broIsAlive = NPC.AnyNPCs(ModContent.NPCType()); + } + } + // Pause before attacking + else if (BigAttackTimer > 0) + { + if (BigAttackTimer == PreBigAttackPause) + { + SoundStyle charge = new("CalamityMod/Sounds/Custom/Ravager/RavagerPillarSummon"); + SoundEngine.PlaySound(charge with { Volume = 0.85f, Pitch = 0.6f }, NPC.Center); + } + for (int i = 0; i < 7; i++) + { + Vector2 vel = new Vector2(14, 14).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 2.5f); + Dust cataclysmdust = Dust.NewDustPerfect(NPC.Center + vel * 2, 279, vel); + cataclysmdust.noGravity = true; + cataclysmdust.scale = Main.rand.NextFloat(1.2f, 1.8f); + cataclysmdust.color = Color.Red; } - // Shoot dart spreads. - fireRate = BossRushEvent.BossRushActive ? 3f : MathHelper.Lerp(1f, 4f, 1f - totalLifeRatio); - DartBurstCounter += fireRate; - if (DartBurstCounter >= DartBurstCounterLimit) + BigAttackTimer--; + } + // Big attack + else + { + // Shoot fists. + float fireRate = BossRushEvent.BossRushActive ? 2.8f : MathHelper.Lerp(2.5f, 3f, 1f - totalLifeRatio); + if (broIsAlive == false) + fireRate = BossRushEvent.BossRushActive ? 3.5f + (29 - BigAttackLimit) * 0.45f : MathHelper.Lerp(3f, (4f + (29 - BigAttackLimit) * 0.45f), 1f - totalLifeRatio) * 1.2f; + if (Phase2 && BigAttackLimit == 0) + fireRate = 1; + + PunchCounter += fireRate; + if (PunchCounter >= PunchCounterLimit) { - DartBurstCounter = 0f; - SoundEngine.PlaySound(SupremeCalamitas.BrimstoneShotSound, NPC.Center); + PunchCounter = 0f; + + int type = ModContent.ProjectileType(); + + if (Main.zenithWorld) + type = ModContent.ProjectileType(); - int type = Main.zenithWorld ? ModContent.ProjectileType() : ModContent.ProjectileType(); int damage = NPC.GetProjectileDamage(type); - if (bossRush) - damage /= 2; - int totalProjectiles = bossRush ? 20 : death ? 16 : revenge ? 14 : expertMode ? 12 : 8; - float radians = MathHelper.TwoPi / totalProjectiles; - float velocity = Main.zenithWorld ? 5f : 7f; - Vector2 spinningPoint = new Vector2(0f, -velocity); - if (Main.netMode != NetmodeID.MultiplayerClient) + if (bossRush) + damage /= 2; + Vector2 fistSpawnPosition = NPC.Center + Vector2.UnitX * 74f * NPC.direction; + + if ((broIsAlive == false ? BigAttackLimit <= 3 && BigAttackLimit > 0 : BigAttackLimit == 1) && death) { - for (int k = 0; k < totalProjectiles; k++) + Projectile.NewProjectile(NPC.GetSource_FromAI(), fistSpawnPosition, (NPC.DirectionTo(Target.Center) * (Main.zenithWorld ? 1 : 11f)).RotatedBy(0.6f - BigAttackLimit * 0.16f), type, damage, 0f, Main.myPlayer, 0f, 0, Main.zenithWorld ? 3 : 2); + Projectile.NewProjectile(NPC.GetSource_FromAI(), fistSpawnPosition, (NPC.DirectionTo(Target.Center) * (Main.zenithWorld ? 1 : 11f)).RotatedBy(-0.6f + BigAttackLimit * 0.16f), type, damage, 0f, Main.myPlayer, 0f, 0, Main.zenithWorld ? 3 : 2); + SoundStyle fire = new("CalamityMod/Sounds/NPCHit/ThanatosHitOpen1"); + SoundEngine.PlaySound(fire with { Volume = 0.4f, Pitch = -0.8f - BigAttackLimit * 0.1f }, NPC.Center); + } + else if (BigAttackLimit == 0 && Phase2) + { + if (Main.netMode != NetmodeID.MultiplayerClient) { - Vector2 velocity2 = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, velocity2, type, damage, 0f, Main.myPlayer, 0f, 1f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), fistSpawnPosition, NPC.DirectionTo(Target.Center) * 9.5f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, PunchingFromRight.ToInt(), 3); + } + SoundEngine.PlaySound(SupremeCalamitas.BrimstoneShotSound with { Volume = 1.8f, Pitch = 0.5f }, NPC.Center); + SoundStyle charge = new("CalamityMod/Sounds/Item/ScorchedEarthShot", 3); + SoundEngine.PlaySound(charge with { Volume = 0.65f, Pitch = -0.75f }, NPC.Center); + for (int i = 0; i < 40; i++) + { + GlowOrbParticle orb = new GlowOrbParticle(fistSpawnPosition, (NPC.DirectionTo(Target.Center) * 50f).RotatedByRandom(0.8f) * Main.rand.NextFloat(0.4f, 1.1f), false, 120, Main.rand.NextFloat(1.55f, 3.75f), Color.Lerp(Color.Red, Color.Magenta, 0.3f), true, true); + GeneralParticleHandler.SpawnParticle(orb); + } + Particle pulse = new DirectionalPulseRing(NPC.Center, Vector2.Zero, Color.Red, new Vector2(1f, 1f), 0, 0.045f, 5f, 15); + GeneralParticleHandler.SpawnParticle(pulse); + Particle pulse2 = new DirectionalPulseRing(NPC.Center, Vector2.Zero, Color.Lerp(Color.Red, Color.Magenta, 0.3f), new Vector2(1f, 1f), 0, 0.025f, 4f, 18); + GeneralParticleHandler.SpawnParticle(pulse2); + } + else if (Main.netMode != NetmodeID.MultiplayerClient) + { + SoundEngine.PlaySound(SupremeCalamitas.BrimstoneShotSound with { Volume = 1.2f, Pitch = 0.4f }, NPC.Center); + Vector2 randPos = (NPC.DirectionTo(Target.Center) * 1.5f).RotatedBy(MathHelper.ToRadians(90f)) * Main.rand.NextFloat(-25, 25); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + randPos, NPC.DirectionTo(Target.Center) * (7.5f - (Phase2 ? (29 - BigAttackLimit) * 0.13f : (8 - BigAttackLimit) * 0.15f)), type, damage, 0f, Main.myPlayer, 0f, PunchingFromRight.ToInt(), 1); + for (int i = 0; i < 7; i++) + { + GlowOrbParticle orb = new GlowOrbParticle(NPC.Center + NPC.DirectionTo(Target.Center) * 10f, (NPC.DirectionTo(Target.Center) * 30f).RotatedByRandom(0.6f) * Main.rand.NextFloat(0.4f, 1.1f), false, 50, Main.rand.NextFloat(1.75f, 3.25f), Color.Lerp(Color.Red, Color.Magenta, 0.5f), true); + GeneralParticleHandler.SpawnParticle(orb); } } - - for (int i = 0; i < 6; i++) - Dust.NewDust(NPC.position + NPC.velocity, NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f); + PunchingFromRight = !PunchingFromRight; + CurrentFrame = 0; + if (BigAttackLimit > 0) + BigAttackLimit--; + else + { + BigAttackTimer = 500; + AttackDelayTimer = 0; + BigAttackLimit = 7; + + targetSide = !targetSide; + } } } } @@ -282,7 +489,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas Vector2 mainDrawPosition = NPC.Center - screenPos; spriteBatch.Draw(texture, mainDrawPosition, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, origin, NPC.scale, spriteEffects, 0f); - texture = ModContent.Request("CalamityMod/NPCs/SupremeCalamitas/SupremeCataclysmGlow").Value; + texture = GlowTexture.Value; Color primarycolor = Main.zenithWorld ? Color.Blue : Color.Red; // why? because blue fire is awesome!! Color baseGlowmaskColor = NPC.IsABestiaryIconDummy ? Color.White : Color.Lerp(Color.White, primarycolor, 0.5f); @@ -324,7 +531,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas NPC.position.Y = NPC.position.Y - (float)(NPC.height / 2); for (int i = 0; i < 40; i++) { - int brimDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); + int brimDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); Main.dust[brimDust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -334,16 +541,44 @@ namespace CalamityMod.NPCs.SupremeCalamitas } for (int j = 0; j < 70; j++) { - int brimDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 3f); + int brimDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 3f); Main.dust[brimDust2].noGravity = true; Main.dust[brimDust2].velocity *= 5f; - brimDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); + brimDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); Main.dust[brimDust2].velocity *= 2f; } // Turn into dust on death. if (NPC.life <= 0) + { + if (NPC.AnyNPCs(ModContent.NPCType())) + { + NPC scal = Main.npc[CalamityGlobalNPC.SCal]; + if (scal.ModNPC().respawnBro == true && Main.masterMode && !broIsAlive) + { + for (int i = 0; i < 45; i++) + { + Vector2 vel = new Vector2(14, 14).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 2.5f); + Dust catastrophedust = Dust.NewDustPerfect(NPC.Center + vel * 2, 279, vel); + catastrophedust.noGravity = true; + catastrophedust.scale = Main.rand.NextFloat(1.2f, 1.8f); + catastrophedust.color = Color.DeepSkyBlue; + } + Particle pulse = new DirectionalPulseRing(NPC.Center, Vector2.Zero, Color.Cyan, new Vector2(1f, 1f), 0, 0.1f, 5f, 25); + GeneralParticleHandler.SpawnParticle(pulse); + Particle pulse2 = new DirectionalPulseRing(NPC.Center, Vector2.Zero, Color.Lerp(Color.Cyan, Color.DodgerBlue, 0.3f), new Vector2(1f, 1f), 0, 0.05f, 4f, 28); + GeneralParticleHandler.SpawnParticle(pulse2); + + SoundStyle respawn = new("CalamityMod/Sounds/NPCKilled/RavagerLimbLoss3"); + SoundEngine.PlaySound(respawn with { Volume = 0.9f, Pitch = 0.3f }, NPC.Center); + + CalamityUtils.SpawnBossBetter(NPC.Center, ModContent.NPCType(), null, MovingUp ? -1 : 1); + scal.ModNPC().respawnBro = false; + } + + } DeathAshParticle.CreateAshesFromNPC(NPC); + } } } } diff --git a/NPCs/SupremeCalamitas/SupremeCatastrophe.cs b/NPCs/SupremeCalamitas/SupremeCatastrophe.cs index bd4b87d7e7..c8b5db4dd0 100644 --- a/NPCs/SupremeCalamitas/SupremeCatastrophe.cs +++ b/NPCs/SupremeCalamitas/SupremeCatastrophe.cs @@ -1,48 +1,69 @@ -using CalamityMod.Dusts; +using System; +using System.IO; +using CalamityMod.Dusts; using CalamityMod.Events; +using CalamityMod.Items.Placeables.Furniture.Trophies; +using CalamityMod.Particles; using CalamityMod.Projectiles.Boss; using CalamityMod.World; -using CalamityMod.Items.Placeables.Furniture.Trophies; +using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; +using ReLogic.Content; using Terraria; +using Terraria.Audio; using Terraria.GameContent; using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Particles; -using Terraria.Audio; +using static Humanizer.In; namespace CalamityMod.NPCs.SupremeCalamitas { [AutoloadBossHead] public class SupremeCatastrophe : ModNPC { - public int VerticalOffset = -375; + public int VerticalOffset = 0; public int CurrentFrame; public bool SlashingFromRight; - public const int HorizontalOffset = 750; - public const int SlashCounterLimit = 45; + public int HorizontalOffset = 750; + public const int SlashCounterLimit = 50; public const int DartBurstCounterLimit = 300; + public const int PreBigAttackPause = 50; + public int BigAttackLimit = 7; + public bool targetSide = false; + public int dashAttackTimer = 0; + public int dashes = 0; + public Vector2 offset = Vector2.Zero; + public bool MovingUp = false; + public bool EnrageRoar = true; + public int accSlashCounter = 0; + public bool setMovement = true; + public bool broIsAlive = true; public Player Target => Main.player[NPC.target]; public ref float SlashCounter => ref NPC.ai[1]; public ref float DartBurstCounter => ref NPC.ai[2]; public ref float ElapsedVerticalDistance => ref NPC.ai[3]; public ref float AttackDelayTimer => ref NPC.localAI[0]; + public ref float BigAttackTimer => ref NPC.localAI[1]; + + public static Asset GlowTexture; public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 8; NPCID.Sets.TrailingMode[NPC.type] = 1; NPCID.Sets.BossBestiaryPriority.Add(Type); - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { Scale = 0.3f, PortraitPositionYOverride = 56f, }; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -62,10 +83,11 @@ namespace CalamityMod.NPCs.SupremeCalamitas NPC.knockBackResist = 0f; NPC.noGravity = true; NPC.noTileCollide = true; - NPC.HitSound = SoundID.DD2_OgreRoar; - NPC.DeathSound = SoundID.NPCDeath52; + NPC.HitSound = SupremeCalamitas.BrotherHit; + NPC.DeathSound = SupremeCalamitas.BrotherDeath; NPC.Calamity().VulnerableToHeat = false; NPC.Calamity().VulnerableToCold = true; + NPC.localAI[1] = 500; } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -73,7 +95,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas int associatedNPCType = ModContent.NPCType(); bestiaryEntry.UIInfoProvider = new CommonEnemyUICollectionInfoProvider(ContentSamples.NpcBestiaryCreditIdsByNpcNetIds[associatedNPCType], quickUnlock: true); - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.SupremeCatastrophe") }); @@ -118,9 +140,20 @@ namespace CalamityMod.NPCs.SupremeCalamitas public override void AI() { + if (setMovement) + { + MovingUp = (NPC.ai[0] == 1 ? true : false); + setMovement = false; + } + // Setting this in SetDefaults will disable expert mode scaling, so put it here instead NPC.damage = 0; + NPC.direction = NPC.spriteDirection; + + if (BigAttackTimer > 0) + BigAttackTimer--; + // Set the whoAmI variable. CalamityGlobalNPC.SCalCatastrophe = NPC.whoAmI; @@ -134,6 +167,13 @@ namespace CalamityMod.NPCs.SupremeCalamitas return; } + NPC scal = Main.npc[CalamityGlobalNPC.SCal]; + if (scal.ModNPC().respawnBro == false && Main.masterMode && !broIsAlive) + { + if (NPC.life > (NPC.lifeMax * 0.65f)) + NPC.life = (int)(NPC.lifeMax * 0.65f); + } + // Difficulty modes bool bossRush = BossRushEvent.BossRushActive; bool death = CalamityWorld.death || bossRush; @@ -161,31 +201,163 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (!NPC.WithinRange(Target.Center, CalamityGlobalNPC.CatchUpDistance200Tiles)) NPC.TargetClosest(); - float acceleration = 1.5f; - - // Reduce acceleration if target is holding a true melee weapon - if (Main.player[NPC.target].HoldingTrueMeleeWeapon()) - acceleration *= 0.5f; - + float acceleration = Utils.Remap(AttackDelayTimer, 0f, 120f, 2f, 4f); int verticalSpeed = (int)Math.Round(MathHelper.Lerp(2f, 6.5f, 1f - totalLifeRatio)); - // Move down. - if (ElapsedVerticalDistance < HorizontalOffset) + bool Phase2 = broIsAlive == false ? true : false; + if (NPC.life / (float)NPC.lifeMax < (death ? 0.6 : 0.4) && !Phase2) { - ElapsedVerticalDistance += verticalSpeed; - VerticalOffset += verticalSpeed; + if (EnrageRoar) + { + EnrageRoar = false; + SoundStyle yell = new("CalamityMod/Sounds/NPCKilled/RavagerLimbLoss2"); + SoundEngine.PlaySound(yell with { Volume = 1.5f, Pitch = 0.3f }, NPC.Center); + } + Phase2 = true; } - // Move up. - else if (ElapsedVerticalDistance < HorizontalOffset * 2) - { - ElapsedVerticalDistance += verticalSpeed; - VerticalOffset -= verticalSpeed; - } - // Reset the vertical distance once a single period has concluded. + // Buffs for the big attack when the other brother dies + if (Phase2 && BigAttackTimer > 400) + BigAttackTimer = 400; + + if (Phase2 && BigAttackTimer > 0 && BigAttackLimit < 11) + BigAttackLimit = 11; + else if (BigAttackTimer > 0 && BigAttackLimit < 7) + BigAttackLimit = 7; + + if (BigAttackTimer > PreBigAttackPause) + { + if (Phase2) + { + if (MovingUp) + { + // Move up. + if (VerticalOffset < 400) + { + VerticalOffset += (int)(verticalSpeed * 1.5f); + } + else + MovingUp = false; + } + else + { + // Move down. + if (VerticalOffset > -400) + { + VerticalOffset -= (int)(verticalSpeed * 1.5f); + } + else + MovingUp = true; + } + + // Hover to the side of the target. + Vector2 idealVelocity = NPC.SafeDirectionTo(Target.Center + new Vector2(-HorizontalOffset * (targetSide ? -1 : 1), VerticalOffset)) * (Phase2 ? Utils.Remap(AttackDelayTimer, 0f, 120f, 15f, 50f) : Utils.Remap(AttackDelayTimer, 60f, 120f, 0f, 50f)); + if (SlashCounter <= SlashCounterLimit * 0.3f && dashAttackTimer == 0) + { + if (AttackDelayTimer == 120 && Main.rand.NextBool()) + { + for (int i = 0; i < 6; i++) + { + Dust catastrophedust = Dust.NewDustPerfect(NPC.Center + Main.rand.NextVector2Circular(NPC.width, NPC.height) - NPC.velocity * 0.5f, 66, -NPC.velocity * Main.rand.NextFloat(0.1f, 0.6f)); + catastrophedust.noGravity = true; + catastrophedust.scale = Main.rand.NextFloat(0.7f, 1.3f); + catastrophedust.color = Color.Cyan; + } + } + CalamityUtils.SmoothMovement(NPC, 0, (Target.Center + new Vector2(-HorizontalOffset * (!targetSide ? 1 : -1), VerticalOffset)) - NPC.Center, Utils.Remap(AttackDelayTimer, 10f, 120f, 20f, 80f), 1f, false); + } + else if (dashAttackTimer == 0) + NPC.velocity *= 0.85f; + else + { + dashAttackTimer--; + + int type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + if (bossRush) + damage /= 2; + + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, NPC.velocity.SafeNormalize(Vector2.UnitY) * 0.1f, type, damage, 0f, Main.myPlayer, 0f, SlashingFromRight.ToInt(), 4 + dashes); + dashes++; + if (dashes == 30 && broIsAlive == false) + { + if (Main.zenithWorld) + { + SoundStyle charge = new("CalamityMod/Sounds/Item/ExobladeBeamSlash"); + SoundEngine.PlaySound(charge with { Volume = 0.85f, Pitch = -0.5f }, NPC.Center); + NPC.velocity = NPC.DirectionTo(Target.Center) * 150f; + + for (int i = 0; i < 30; i++) + { + Vector2 vel = new Vector2(7, 7).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 2.5f); + Dust catastrophedust = Dust.NewDustPerfect(NPC.Center + vel * 2, 279, vel); + catastrophedust.noGravity = true; + catastrophedust.scale = Main.rand.NextFloat(1.2f, 1.8f); + catastrophedust.color = Color.DeepSkyBlue; + } + dashes = 0; + dashAttackTimer = 30; + BigAttackTimer = 500; + AttackDelayTimer = 120; + if (NPC.life > 10001) + NPC.life -= 10000; + return; + } + else + { + SoundStyle slash = new("CalamityMod/Sounds/Item/MurasamaBigSwing"); + SoundEngine.PlaySound(slash with { Volume = 0.55f, Pitch = -0.3f }, NPC.Center); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + NPC.DirectionTo(Target.Center).RotatedBy(0.34f) * 130, NPC.DirectionTo(Target.Center).RotatedBy(0.34f) * 90f, type, damage, 0f, Main.myPlayer, 0f, 0, 50); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + NPC.DirectionTo(Target.Center).RotatedBy(-0.34f) * 130, NPC.DirectionTo(Target.Center).RotatedBy(-0.34f) * 90f, type, damage, 0f, Main.myPlayer, 0f, 0, 50); + for (int i = 0; i < 30; i++) + { + Vector2 vel = new Vector2(7, 7).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 2.5f); + Dust catastrophedust = Dust.NewDustPerfect(NPC.Center + vel * 2, 279, vel); + catastrophedust.noGravity = true; + catastrophedust.scale = Main.rand.NextFloat(1.2f, 1.8f); + catastrophedust.color = Color.DeepSkyBlue; + } + } + } + NPC.velocity *= 0.975f; + } + } + else + { + if (MovingUp) + { + // Move up. + if (VerticalOffset < 400) + { + VerticalOffset += verticalSpeed; + } + else + MovingUp = false; + } + else + { + // Move down. + if (VerticalOffset > -400) + { + VerticalOffset -= verticalSpeed; + } + else + MovingUp = true; + } + + if (SlashCounter <= SlashCounterLimit * 0.3f) + { + offset = NPC.DirectionTo(Target.Center) * 70f * (BigAttackTimer <= 60 ? -4 : 1); + } + else + offset *= 0.9f; + CalamityUtils.SmoothMovement(NPC, 0, (Target.Center + new Vector2(-HorizontalOffset * (!targetSide ? 1 : -1), VerticalOffset)) - NPC.Center - offset, 17, 2f, false); + } + + } else - ElapsedVerticalDistance = 0f; + NPC.velocity *= 0.9f; // Reset rotation to zero. NPC.rotation = 0f; @@ -193,63 +365,139 @@ namespace CalamityMod.NPCs.SupremeCalamitas // Set direction. NPC.spriteDirection = (Target.Center.X > NPC.Center.X).ToDirectionInt(); - // Hover to the side of the target. - Vector2 idealVelocity = NPC.SafeDirectionTo(Target.Center + new Vector2(-HorizontalOffset, VerticalOffset)) * 60f; - NPC.SimpleFlyMovement(idealVelocity, acceleration); - // Have a small delay prior to shooting projectiles. if (AttackDelayTimer < 120f) - AttackDelayTimer++; + AttackDelayTimer += (death ? 1.5f : 1f); // Handle projectile shots. - else + else if (BigAttackTimer > PreBigAttackPause) { // Shoot sword slashes. - float fireRate = BossRushEvent.BossRushActive ? 2f : MathHelper.Lerp(1f, 2.5f, 1f - totalLifeRatio); + float fireRate = BossRushEvent.BossRushActive ? 2f : MathHelper.Lerp(1.5f, 2f, 1f - totalLifeRatio) * (broIsAlive == false ? death ? 1.25f : 1.05f : 1); SlashCounter += fireRate; if (SlashCounter >= SlashCounterLimit) { SlashCounter = 0f; - SoundEngine.PlaySound(SupremeCalamitas.BrimstoneShotSound, NPC.Center); + SoundEngine.PlaySound(SupremeCalamitas.CatastropheSwing with { Volume = 0.5f, Pitch = (SlashingFromRight ? 0.2f : -0.2f) }, NPC.Center); int type = ModContent.ProjectileType(); + + if (Main.zenithWorld) + type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); - if (bossRush) - damage /= 2; - Vector2 slashSpawnPosition = NPC.Center + Vector2.UnitX * 125f; + if (bossRush) + damage /= 2; + Vector2 slashSpawnPosition = NPC.Center + Vector2.UnitX * 125f * NPC.direction; if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(NPC.GetSource_FromAI(), slashSpawnPosition, Vector2.UnitX * 4f, type, damage, 0f, Main.myPlayer, 0f, SlashingFromRight.ToInt()); + { + Vector2 firingVelocity = (broIsAlive == false ? (NPC.DirectionTo(Target.Center) + Target.velocity * 0.0305f).SafeNormalize(Vector2.UnitY) : NPC.DirectionTo(Target.Center)); + if (Phase2) + { + if (accSlashCounter < 2) + { + accSlashCounter++; + Projectile.NewProjectile(NPC.GetSource_FromAI(), slashSpawnPosition, firingVelocity * 5.5f, type, damage, 0f, Main.myPlayer, 0f, SlashingFromRight.ToInt(), 2); + } + else + { + SoundStyle slash = new("CalamityMod/Sounds/Item/MurasamaBigSwing"); + SoundEngine.PlaySound(slash with { Volume = 0.55f, Pitch = 0.4f }, NPC.Center); + + Projectile.NewProjectile(NPC.GetSource_FromAI(), slashSpawnPosition, firingVelocity * 0.2f, type, damage, 0f, Main.myPlayer, 0f, SlashingFromRight.ToInt(), Main.zenithWorld ? 0 : 3); + accSlashCounter = 0; + } + } + else + Projectile.NewProjectile(NPC.GetSource_FromAI(), slashSpawnPosition, NPC.DirectionTo(Target.Center) * 8f, type, damage, 0f, Main.myPlayer, 0f, SlashingFromRight.ToInt(), 2); + } SlashingFromRight = !SlashingFromRight; CurrentFrame = 0; + broIsAlive = NPC.AnyNPCs(ModContent.NPCType()); + } + } + // Pause before attacking + else if (BigAttackTimer > 0) + { + if (BigAttackTimer == PreBigAttackPause) + { + SoundStyle charge = new("CalamityMod/Sounds/Custom/Ravager/RavagerPillarSummon"); + SoundEngine.PlaySound(charge with { Volume = 0.85f, Pitch = 0.6f }, NPC.Center); + } + for (int i = 0; i < 7; i++) + { + Vector2 vel = new Vector2(14, 14).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 2.5f); + Dust catastrophedust = Dust.NewDustPerfect(NPC.Center + vel * 2, 279, vel); + catastrophedust.noGravity = true; + catastrophedust.scale = Main.rand.NextFloat(1.2f, 1.8f); + catastrophedust.color = Color.DeepSkyBlue; } - // Shoot dart spreads. - fireRate = BossRushEvent.BossRushActive ? 3f : MathHelper.Lerp(1f, 4f, 1f - totalLifeRatio); - DartBurstCounter += fireRate; - if (DartBurstCounter >= DartBurstCounterLimit) + BigAttackTimer--; + } + // Big attack + else + { + // Shoot sword slashes. + float fireRate = BossRushEvent.BossRushActive ? 2.8f : MathHelper.Lerp(2.5f, 3f, 1f - totalLifeRatio) * (broIsAlive == false ? 1.35f : 1); + if (Phase2 && BigAttackLimit == 0) + fireRate = 1; + SlashCounter += fireRate; + if (SlashCounter >= SlashCounterLimit) { - DartBurstCounter = 0f; - SoundEngine.PlaySound(SupremeCalamitas.BrimstoneShotSound, NPC.Center); + SlashCounter = 0f; + + int type = ModContent.ProjectileType(); + + if (Main.zenithWorld) + type = ModContent.ProjectileType(); - int type = Main.zenithWorld ? ModContent.ProjectileType() : ModContent.ProjectileType(); int damage = NPC.GetProjectileDamage(type); - if (bossRush) - damage /= 2; - int totalProjectiles = bossRush ? 20 : death ? 16 : revenge ? 14 : expertMode ? 12 : 8; - float radians = MathHelper.TwoPi / totalProjectiles; - float velocity = Main.zenithWorld ? 5f : 7f; - Vector2 spinningPoint = new Vector2(0f, -velocity); - if (Main.netMode != NetmodeID.MultiplayerClient) + if (bossRush) + damage /= 2; + Vector2 slashSpawnPosition = NPC.Center; + Vector2 firingVelocity = (broIsAlive == false ? (NPC.DirectionTo(Target.Center) + Target.velocity * 0.032f).SafeNormalize(Vector2.UnitY) : NPC.DirectionTo(Target.Center)); + + if ((broIsAlive == false ? BigAttackLimit <= 3 && BigAttackLimit > 0 : BigAttackLimit == 1) && death) { - for (int k = 0; k < totalProjectiles; k++) + Projectile.NewProjectile(NPC.GetSource_FromAI(), slashSpawnPosition + firingVelocity * 130, (Phase2 ? NPC.DirectionTo(Target.Center) : firingVelocity) * 90f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 5, 50); + SoundStyle slash = new("CalamityMod/Sounds/Item/MurasamaBigSwing"); + SoundEngine.PlaySound(slash with { Volume = 0.55f, Pitch = -0.3f - BigAttackLimit * 0.1f }, NPC.Center); + } + else if (BigAttackLimit == 0 && Phase2) + { + if (Main.netMode != NetmodeID.MultiplayerClient) { - Vector2 velocity2 = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, velocity2, type, damage, 0f, Main.myPlayer, 0f, 1f); + SoundStyle charge = new("CalamityMod/Sounds/Item/ExobladeBeamSlash"); + SoundEngine.PlaySound(charge with { Volume = 0.85f, Pitch = -0.5f }, NPC.Center); + NPC.velocity = firingVelocity * 90f; + dashAttackTimer = 30; + dashes = 0; + } + } + else if (Main.netMode != NetmodeID.MultiplayerClient) + { + SoundEngine.PlaySound(SupremeCalamitas.CatastropheSwing with { Volume = 0.5f, Pitch = (SlashingFromRight ? 0.2f : -0.2f) }, NPC.Center); + Projectile.NewProjectile(NPC.GetSource_FromAI(), slashSpawnPosition, NPC.DirectionTo(Target.Center) * 8f, type, damage, 0f, Main.myPlayer, 0f, SlashingFromRight.ToInt(), 1); + for (int i = 0; i < 7; i++) + { + SparkParticle orb = new SparkParticle(NPC.Center + NPC.DirectionTo(Target.Center) * 10f, (NPC.DirectionTo(Target.Center) * 30f).RotatedByRandom(0.6f) * Main.rand.NextFloat(0.4f, 1.1f), false, 40, Main.rand.NextFloat(0.75f, 2.25f), Color.Cyan); + GeneralParticleHandler.SpawnParticle(orb); } } - for (int i = 0; i < 6; i++) - Dust.NewDust(NPC.position + NPC.velocity, NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f); + SlashingFromRight = !SlashingFromRight; + CurrentFrame = 0; + if (BigAttackLimit > 0) + BigAttackLimit--; + else + { + BigAttackTimer = 500; + AttackDelayTimer = 0; + BigAttackLimit = 7; + + targetSide = !targetSide; + } } } } @@ -277,7 +525,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas Vector2 mainDrawPosition = NPC.Center - screenPos; spriteBatch.Draw(texture, mainDrawPosition, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, origin, NPC.scale, spriteEffects, 0f); - texture = ModContent.Request("CalamityMod/NPCs/SupremeCalamitas/SupremeCatastropheGlow").Value; + texture = GlowTexture.Value; Color baseGlowmaskColor = Color.Lerp(Color.White, Color.Cyan, 0.35f); if (CalamityConfig.Instance.Afterimages) @@ -318,7 +566,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas NPC.position.Y = NPC.position.Y - (float)(NPC.height / 2); for (int i = 0; i < 40; i++) { - int brimDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); + int brimDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); Main.dust[brimDust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -328,16 +576,44 @@ namespace CalamityMod.NPCs.SupremeCalamitas } for (int j = 0; j < 70; j++) { - int brimDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 3f); + int brimDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 3f); Main.dust[brimDust2].noGravity = true; Main.dust[brimDust2].velocity *= 5f; - brimDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); + brimDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); Main.dust[brimDust2].velocity *= 2f; } // Turn into dust on death. if (NPC.life <= 0) + { + if (NPC.AnyNPCs(ModContent.NPCType())) + { + NPC scal = Main.npc[CalamityGlobalNPC.SCal]; + if (scal.ModNPC().respawnBro == true && Main.masterMode && !broIsAlive) + { + for (int i = 0; i < 45; i++) + { + Vector2 vel = new Vector2(14, 14).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 2.5f); + Dust cataclysmdust = Dust.NewDustPerfect(NPC.Center + vel * 2, 279, vel); + cataclysmdust.noGravity = true; + cataclysmdust.scale = Main.rand.NextFloat(1.2f, 1.8f); + cataclysmdust.color = Color.Red; + } + Particle pulse = new DirectionalPulseRing(NPC.Center, Vector2.Zero, Color.Red, new Vector2(1f, 1f), 0, 0.1f, 5f, 25); + GeneralParticleHandler.SpawnParticle(pulse); + Particle pulse2 = new DirectionalPulseRing(NPC.Center, Vector2.Zero, Color.Lerp(Color.Red, Color.Magenta, 0.3f), new Vector2(1f, 1f), 0, 0.05f, 4f, 28); + GeneralParticleHandler.SpawnParticle(pulse2); + + SoundStyle respawn = new("CalamityMod/Sounds/NPCKilled/RavagerLimbLoss3"); + SoundEngine.PlaySound(respawn with { Volume = 0.9f, Pitch = 0.3f }, NPC.Center); + + CalamityUtils.SpawnBossBetter(NPC.Center, ModContent.NPCType(), null, MovingUp ? -1 : 1); + scal.ModNPC().respawnBro = false; + } + + } DeathAshParticle.CreateAshesFromNPC(NPC); + } } } } diff --git a/NPCs/SupremeCalamitas/SupremeCirrus.png b/NPCs/SupremeCalamitas/SupremeCirrus.png index dfd69ab6d3..4412c1c02b 100644 Binary files a/NPCs/SupremeCalamitas/SupremeCirrus.png and b/NPCs/SupremeCalamitas/SupremeCirrus.png differ diff --git a/NPCs/TownNPCs/AndroombaFriendly.cs b/NPCs/TownNPCs/AndroombaFriendly.cs index 386817f6b0..5b2a262879 100644 --- a/NPCs/TownNPCs/AndroombaFriendly.cs +++ b/NPCs/TownNPCs/AndroombaFriendly.cs @@ -1,12 +1,12 @@ -using CalamityMod.BiomeManagers; +using System; +using System.Collections.Generic; +using CalamityMod.BiomeManagers; using CalamityMod.Items.Critters; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System.Collections.Generic; -using System.IO; +using ReLogic.Content; using Terraria; -using Terraria.Audio; using Terraria.GameContent; using Terraria.GameContent.Bestiary; using Terraria.ID; @@ -16,16 +16,33 @@ namespace CalamityMod.NPCs.TownNPCs { public class AndroombaFriendly : ModNPC { + public static Asset[] FaceTextures = new Asset[9]; + + // Allow for solutions from other mods. The first integer is the solution's item ID, the texture is what face shoul dappear, the Action is what modders should use for spread code + public static List<(int, string, Action)> customConversionTypes = new List<(int, string, Action)>{}; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 9; Main.npcCatchable[NPC.type] = true; NPCID.Sets.NoTownNPCHappiness[Type] = true; - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0); + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(); value.Position.Y += 16; value.PortraitPositionYOverride = 36f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; NPCID.Sets.ShimmerTownTransform[Type] = false; + if (!Main.dedServ) + { + FaceTextures[0] = ModContent.Request(Texture + "_Pure", AssetRequestMode.AsyncLoad); + FaceTextures[1] = ModContent.Request(Texture + "_Corruption", AssetRequestMode.AsyncLoad); + FaceTextures[2] = ModContent.Request(Texture + "_Hallow", AssetRequestMode.AsyncLoad); + FaceTextures[3] = ModContent.Request(Texture + "_Mushroom", AssetRequestMode.AsyncLoad); + FaceTextures[4] = ModContent.Request(Texture + "_Crimson", AssetRequestMode.AsyncLoad); + FaceTextures[5] = ModContent.Request(Texture + "_Desert", AssetRequestMode.AsyncLoad); + FaceTextures[6] = ModContent.Request(Texture + "_Snow", AssetRequestMode.AsyncLoad); + FaceTextures[7] = ModContent.Request(Texture + "_Forest", AssetRequestMode.AsyncLoad); + FaceTextures[8] = ModContent.Request(Texture + "_Astral", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -53,7 +70,7 @@ namespace CalamityMod.NPCs.TownNPCs public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.AndroombaFriendly") }); @@ -114,6 +131,7 @@ namespace CalamityMod.NPCs.TownNPCs { int x = (int)(NPC.Center.X / 16f); int y = (int)(NPC.Center.Y / 16f); + // Stuff for vanilla solutions if (conversionType <= 7) { ConvertType type = ConvertType.Pure; @@ -129,12 +147,18 @@ namespace CalamityMod.NPCs.TownNPCs type = ConvertType.Crimson; break; } - AstralBiome.ConvertFromAstral(x - 2, x + 2, y - 2, y + 2, type); + World.AstralBiome.ConvertFromAstral(x - 2, x + 2, y - 2, y + 2, type); WorldGen.Convert(x, y, conversionType, 2); } + // Calamity solution(s) + else if (conversionType == 8) + { + World.AstralBiome.ConvertToAstral(x - 2, x + 2, y - 2, y + 2); + } + // Solutions registered by other mods else { - AstralBiome.ConvertToAstral(x - 2, x + 2, y - 2, y + 2); + customConversionTypes[conversionType - 9].Item3(NPC); } } @@ -233,44 +257,24 @@ namespace CalamityMod.NPCs.TownNPCs public override void HitEffect(NPC.HitInfo hit) { for (int i = 0; i < 6; i++) - Dust.NewDustDirect(NPC.position, NPC.width, NPC.height, 226); + Dust.NewDustDirect(NPC.position, NPC.width, NPC.height, DustID.Electric); } + public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { Texture2D critterTexture = TextureAssets.Npc[NPC.type].Value; - string pathextenstion = "Pure"; - switch (NPC.ai[3]) + Texture2D glowmask = FaceTextures[0].Value; + // If the solution is from Calamity or vanilla, set the glowmask to grab the appropriate texture from the texture array + if (NPC.ai[3] <= 8) { - case 0: - pathextenstion = "Pure"; - break; - case 1: - pathextenstion = "Corruption"; - break; - case 2: - pathextenstion = "Hallow"; - break; - case 3: - pathextenstion = "Mushroom"; - break; - case 4: - pathextenstion = "Crimson"; - break; - case 5: - pathextenstion = "Desert"; - break; - case 6: - pathextenstion = "Snow"; - break; - case 7: - pathextenstion = "Forest"; - break; - case 8: - pathextenstion = "Astral"; - break; + glowmask = FaceTextures[(int)NPC.ai[3]].Value; + } + // If the solution isn't from Calamity or vanilla, grab the appropriate solution from the custom solution list + else + { + glowmask = ModContent.Request(customConversionTypes[(int)NPC.ai[3] - 9].Item2).Value; } - Texture2D glowmask = ModContent.Request("CalamityMod/NPCs/TownNPCs/AndroombaFriendly_" + pathextenstion).Value; Vector2 drawPosition = NPC.Center - screenPos + Vector2.UnitY * NPC.gfxOffY; drawPosition.Y += DrawOffsetY; SpriteEffects direction = NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; diff --git a/NPCs/TownNPCs/DILF.cs b/NPCs/TownNPCs/DILF.cs index 6b0f00db73..9b2de8371c 100644 --- a/NPCs/TownNPCs/DILF.cs +++ b/NPCs/TownNPCs/DILF.cs @@ -1,6 +1,8 @@ -using CalamityMod.Items.Accessories; +using System.Collections.Generic; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Accessories.Vanity; using CalamityMod.Items.Ammo; +using CalamityMod.Items.Placeables.Furniture.Monoliths; using CalamityMod.Items.Potions; using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Melee; @@ -9,7 +11,6 @@ using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Items.Weapons.Summon; using CalamityMod.Projectiles.Typeless; using CalamityMod.World; -using System.Collections.Generic; using Terraria; using Terraria.GameContent.Bestiary; using Terraria.GameContent.Events; @@ -36,13 +37,14 @@ namespace CalamityMod.NPCs.TownNPCs NPCID.Sets.ShimmerTownTransform[Type] = false; NPC.Happiness .SetBiomeAffection(AffectionLevel.Like) - .SetBiomeAffection(AffectionLevel.Dislike) - .SetNPCAffection(NPCID.Wizard, AffectionLevel.Like) + .SetBiomeAffection(AffectionLevel.Dislike) + .SetNPCAffection(NPCID.Wizard, AffectionLevel.Like) .SetNPCAffection(NPCID.Cyborg, AffectionLevel.Dislike); - NPCID.Sets.NPCBestiaryDrawModifiers drawModifiers = new NPCID.Sets.NPCBestiaryDrawModifiers(0) { - Velocity = 1f // Draws the NPC in the bestiary as if its walking +1 tiles in the x direction - }; - NPCID.Sets.NPCBestiaryDrawOffset.Add(NPC.type, drawModifiers); + NPCID.Sets.NPCBestiaryDrawModifiers drawModifiers = new NPCID.Sets.NPCBestiaryDrawModifiers() + { + Velocity = 1f // Draws the NPC in the bestiary as if its walking +1 tiles in the x direction + }; + NPCID.Sets.NPCBestiaryDrawOffset.Add(NPC.type, drawModifiers); } public override void SetDefaults() @@ -64,10 +66,10 @@ namespace CalamityMod.NPCs.TownNPCs public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { - BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Snow, - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.DILF") + BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Snow, + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.DILF") }); } @@ -81,7 +83,7 @@ namespace CalamityMod.NPCs.TownNPCs public override bool CanTownNPCSpawn(int numTownNPCs) => DownedBossSystem.downedCryogen; - public override List SetNPCNameList() => new List() { this.GetLocalizedValue("Name.Permafrost") }; + public override List SetNPCNameList() => new List() { this.GetLocalizedValue("Name.Permafrost") }; public override string GetChat() { @@ -150,12 +152,13 @@ namespace CalamityMod.NPCs.TownNPCs .Add(ModContent.ItemType(), Condition.DownedEverscream, Condition.DownedSantaNK1, Condition.DownedIceQueen) .Add(ModContent.ItemType(), Condition.DownedEverscream, Condition.DownedSantaNK1, Condition.DownedIceQueen) .Add(ModContent.ItemType(), Condition.DownedEverscream, Condition.DownedSantaNK1, Condition.DownedIceQueen) - .Add(ModContent.ItemType(), Condition.DownedEverscream, Condition.DownedSantaNK1, Condition.DownedIceQueen) + .Add(ModContent.ItemType(), Condition.DownedEverscream, Condition.DownedSantaNK1, Condition.DownedIceQueen) .Add(ModContent.ItemType(), Condition.DownedEverscream, Condition.DownedSantaNK1, Condition.DownedIceQueen) .Add(ModContent.ItemType()) .Add(ItemID.SuperManaPotion) .Add(ModContent.ItemType()) .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(5)) + .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(5)) .Add(ModContent.ItemType(), Condition.PlayerCarriesItem(ModContent.ItemType())) .Add(ItemID.IceCream, Condition.HappyEnough, Condition.InSnow) .Register(); diff --git a/NPCs/TownNPCs/FAP.cs b/NPCs/TownNPCs/FAP.cs index c8b3de85df..b608144bc0 100644 --- a/NPCs/TownNPCs/FAP.cs +++ b/NPCs/TownNPCs/FAP.cs @@ -1,4 +1,6 @@ -using CalamityMod.Events; +using System; +using System.Collections.Generic; +using CalamityMod.Events; using CalamityMod.Items.Mounts; using CalamityMod.Items.Placeables.Furniture; using CalamityMod.Items.Potions.Alcohol; @@ -6,7 +8,9 @@ using CalamityMod.NPCs.SupremeCalamitas; using CalamityMod.Projectiles.Magic; using CalamityMod.Projectiles.Summon; using CalamityMod.World; -using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.DataStructures; @@ -14,6 +18,7 @@ using Terraria.GameContent; using Terraria.GameContent.Bestiary; using Terraria.GameContent.Events; using Terraria.GameContent.Personalities; +using Terraria.GameContent.UI; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -24,9 +29,11 @@ namespace CalamityMod.NPCs.TownNPCs [AutoloadHead] public class FAP : ModNPC { + public static Asset AltTexture; + public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 25; + Main.npcFrameCount[NPC.type] = 27; NPCID.Sets.ExtraFramesCount[NPC.type] = 9; NPCID.Sets.AttackFrameCount[NPC.type] = 4; NPCID.Sets.DangerDetectRange[NPC.type] = 400; @@ -47,10 +54,15 @@ namespace CalamityMod.NPCs.TownNPCs .SetNPCAffection(NPCID.TaxCollector, AffectionLevel.Dislike) .SetNPCAffection(NPCID.GoblinTinkerer, AffectionLevel.Hate) .SetNPCAffection(NPCID.Angler, AffectionLevel.Hate); - NPCID.Sets.NPCBestiaryDrawModifiers drawModifiers = new NPCID.Sets.NPCBestiaryDrawModifiers(0) { - Velocity = 1f // Draws the NPC in the bestiary as if its walking +1 tiles in the x direction - }; - NPCID.Sets.NPCBestiaryDrawOffset.Add(NPC.type, drawModifiers); + NPCID.Sets.NPCBestiaryDrawModifiers drawModifiers = new NPCID.Sets.NPCBestiaryDrawModifiers() + { + Velocity = 1f // Draws the NPC in the bestiary as if its walking +1 tiles in the x direction + }; + NPCID.Sets.NPCBestiaryDrawOffset.Add(NPC.type, drawModifiers); + if (!Main.dedServ) + { + AltTexture = ModContent.Request(Texture + "Alt", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -67,18 +79,582 @@ namespace CalamityMod.NPCs.TownNPCs NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath6; NPC.knockBackResist = 0.5f; - AnimationType = NPCID.Guide; + //AnimationType = NPCID.Guide; } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { - BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.TheHallow, - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.FAP") + BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.TheHallow, + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.FAP") }); } + public override void FindFrame(int frameHeight) + { + int extraFrameAmt = (NPC.isLikeATownNPC ? NPCID.Sets.ExtraFramesCount[NPC.type] : 0); + /*if (false && !Main.dedServ && TownNPCProfiles.Instance.GetProfile(this, out var profile)) + { + Asset textureNPCShouldUse = profile.GetTextureNPCShouldUse(this); + if (textureNPCShouldUse.IsLoaded) + { + num = textureNPCShouldUse.Height() / Main.npcFrameCount[type]; + frame.Width = textureNPCShouldUse.Width(); + frame.Height = num; + } + }*/ + + if (NPC.velocity.Y == 0f) + { + if (NPC.direction == 1) + NPC.spriteDirection = 1; + + if (NPC.direction == -1) + NPC.spriteDirection = -1; + + int nonAttackFrames = Main.npcFrameCount[NPC.type] - NPCID.Sets.AttackFrameCount[NPC.type]; + if (NPC.ai[0] == 23f) + { + NPC.frameCounter += 1D; + int currentFrameHeight = NPC.frame.Y / frameHeight; + int currentFrame = nonAttackFrames - currentFrameHeight; + if ((uint)(currentFrame - 1) > 1u && (uint)(currentFrame - 4) > 1u && currentFrameHeight != 0) + { + NPC.frame.Y = 0; + NPC.frameCounter = 0D; + } + + int num239 = ((!(NPC.frameCounter < 6D)) ? (nonAttackFrames - 4) : (nonAttackFrames - 5)); + if (NPC.ai[1] < 6f) + num239 = nonAttackFrames - 5; + + NPC.frame.Y = frameHeight * num239; + } + else if (NPC.ai[0] >= 20f && NPC.ai[0] <= 22f) + { + int num240 = NPC.frame.Y / frameHeight; + switch ((int)NPC.ai[0]) + { + case 20: + case 21: + case 22: + break; + } + + NPC.frame.Y = num240 * frameHeight; + } + else if (NPC.ai[0] == 2f) + { + NPC.frameCounter += 1D; + if (NPC.frame.Y / frameHeight == nonAttackFrames - 1 && NPC.frameCounter >= 5D) + { + NPC.frame.Y = 0; + NPC.frameCounter = 0D; + } + else if (NPC.frame.Y / frameHeight == 0 && NPC.frameCounter >= 40D) + { + NPC.frame.Y = frameHeight * (nonAttackFrames - 1); + NPC.frameCounter = 0D; + } + else if (NPC.frame.Y != 0 && NPC.frame.Y != frameHeight * (nonAttackFrames - 1)) + { + NPC.frame.Y = 0; + NPC.frameCounter = 0D; + } + } + else if (NPC.ai[0] == 5f) // Sitting + { + NPC.frame.Y = frameHeight * (nonAttackFrames - 3); + NPC.frameCounter = 0D; + } + else if (NPC.ai[0] == 6f) // Throwing confetti + { + NPC.frameCounter += 1D; + int confettiFrameHeight = NPC.frame.Y / frameHeight; + int currentFrame = nonAttackFrames - confettiFrameHeight; + if ((uint)(currentFrame - 1) > 1u && (uint)(currentFrame - 4) > 1u && confettiFrameHeight != 0) + { + NPC.frame.Y = 0; + NPC.frameCounter = 0D; + } + + int confettiFrame = ((!(NPC.frameCounter < 10D)) ? + ((NPC.frameCounter < 16D) ? + (nonAttackFrames - 5) : ((NPC.frameCounter < 46D) ? + (nonAttackFrames - 4) : ((NPC.frameCounter < 60D) ? + (nonAttackFrames - 5) : ((!(NPC.frameCounter < 66D)) ? + ((NPC.frameCounter < 72D) ? + (nonAttackFrames - 5) : ((NPC.frameCounter < 102D) ? + (nonAttackFrames - 4) : ((NPC.frameCounter < 108D) ? + (nonAttackFrames - 5) : ((!(NPC.frameCounter < 114D)) ? + ((NPC.frameCounter < 120D) ? + (nonAttackFrames - 5) : ((NPC.frameCounter < 150D) ? + (nonAttackFrames - 4) : ((NPC.frameCounter < 156D) ? + (nonAttackFrames - 5) : ((!(NPC.frameCounter < 162D)) ? + ((NPC.frameCounter < 168D) ? + (nonAttackFrames - 5) : ((NPC.frameCounter < 198D) ? + (nonAttackFrames - 4) : ((NPC.frameCounter < 204D) ? + (nonAttackFrames - 5) : ((!(NPC.frameCounter < 210D)) ? + ((NPC.frameCounter < 216D) ? + (nonAttackFrames - 5) : ((NPC.frameCounter < 246D) ? + (nonAttackFrames - 4) : ((NPC.frameCounter < 252D) ? + (nonAttackFrames - 5) : ((!(NPC.frameCounter < 258D)) ? + ((NPC.frameCounter < 264D) ? + (nonAttackFrames - 5) : ((NPC.frameCounter < 294D) ? + (nonAttackFrames - 4) : ((NPC.frameCounter < 300D) ? + (nonAttackFrames - 5) : 0))) : 0)))) : 0)))) : 0)))) : 0)))) : 0)))) : 0); + + if (confettiFrame == nonAttackFrames - 4 && confettiFrameHeight == nonAttackFrames - 5) + { + Vector2 vector4 = NPC.Center + new Vector2(10 * NPC.direction, -4f); + for (int n = 0; n < 8; n++) + { + int confettiDust = Main.rand.Next(139, 143); + int partyTime = Dust.NewDust(vector4, 0, 0, confettiDust, NPC.velocity.X + (float)NPC.direction, NPC.velocity.Y - 2.5f, 0, default(Color), 1.2f); + Main.dust[partyTime].velocity.X += (float)NPC.direction * 1.5f; + Dust dust = Main.dust[partyTime]; + dust.position -= new Vector2(4f); + dust = Main.dust[partyTime]; + dust.velocity *= 2f; + Main.dust[partyTime].scale = 0.7f + Main.rand.NextFloat() * 0.3f; + } + } + + NPC.frame.Y = frameHeight * confettiFrame; + if (NPC.frameCounter >= 300D) + NPC.frameCounter = 0D; + } + else if (NPC.ai[0] == 7f || NPC.ai[0] == 19f) // Talking to the player + { + NPC.frameCounter += 1D; + int playerTalkFrameHeight = NPC.frame.Y / frameHeight; + int currentFrame = nonAttackFrames - playerTalkFrameHeight; + if ((uint)(currentFrame - 1) > 1u && (uint)(currentFrame - 4) > 1u && playerTalkFrameHeight != 0) + { + NPC.frame.Y = 0; + NPC.frameCounter = 0D; + } + + int playerTalkFrame = 0; + if (NPC.frameCounter < 16D) + playerTalkFrame = 0; + else if (NPC.frameCounter == 16D) + EmoteBubble.NewBubbleNPC(new WorldUIAnchor(NPC), 112); + else if (NPC.frameCounter < 128D) + playerTalkFrame = ((NPC.frameCounter % 16D < 8D) ? (nonAttackFrames - 2) : 0); + else if (NPC.frameCounter < 160D) + playerTalkFrame = 0; + else if (NPC.frameCounter != 160D) + playerTalkFrame = ((NPC.frameCounter < 220D) ? ((NPC.frameCounter % 12D < 6D) ? (nonAttackFrames - 2) : 0) : 0); + else + EmoteBubble.NewBubbleNPC(new WorldUIAnchor(NPC), 60); + + NPC.frame.Y = frameHeight * playerTalkFrame; + if (NPC.frameCounter >= 220D) + NPC.frameCounter = 0D; + } + else if (NPC.ai[0] == 9f) + { + NPC.frameCounter += 1D; + int num251 = NPC.frame.Y / frameHeight; + int currentFrame = nonAttackFrames - num251; + if ((uint)(currentFrame - 1) > 1u && (uint)(currentFrame - 4) > 1u && num251 != 0) + { + NPC.frame.Y = 0; + NPC.frameCounter = 0D; + } + + int num252 = ((!(NPC.frameCounter < 10D)) ? ((!(NPC.frameCounter < 16D)) ? (nonAttackFrames - 4) : (nonAttackFrames - 5)) : 0); + if (NPC.ai[1] < 16f) + num252 = nonAttackFrames - 5; + + if (NPC.ai[1] < 10f) + num252 = 0; + + NPC.frame.Y = frameHeight * num252; + } + else if (NPC.ai[0] == 18f) + { + NPC.frameCounter += 1D; + int num253 = NPC.frame.Y / frameHeight; + int currentFrame = nonAttackFrames - num253; + if ((uint)(currentFrame - 1) > 1u && (uint)(currentFrame - 4) > 1u && num253 != 0) + { + NPC.frame.Y = 0; + NPC.frameCounter = 0D; + } + + int num254 = 0; + if (NPC.frameCounter < 10D) + num254 = 0; + else if (NPC.frameCounter < 16D) + num254 = nonAttackFrames - 1; + else + num254 = nonAttackFrames - 2; + + if (NPC.ai[1] < 16f) + num254 = nonAttackFrames - 1; + + if (NPC.ai[1] < 10f) + num254 = 0; + + num254 = Main.npcFrameCount[NPC.type] - 2; + NPC.frame.Y = frameHeight * num254; + } + else if (NPC.ai[0] == 10f || NPC.ai[0] == 13f) // Attacking + { + NPC.frameCounter += 1D; + int attackFrameHeight = NPC.frame.Y / frameHeight; + int currentFrame = attackFrameHeight - nonAttackFrames; + if ((uint)currentFrame > 3u && attackFrameHeight != 0) + { + NPC.frame.Y = 0; + NPC.frameCounter = 0D; + } + + int attackTimingStart = 10; + int attackFrameTiming = 6; + int attackFrame = ((!(NPC.frameCounter < (double)attackTimingStart)) ? + ((NPC.frameCounter < (double)(attackTimingStart + attackFrameTiming)) ? + nonAttackFrames : ((NPC.frameCounter < (double)(attackTimingStart + attackFrameTiming * 2)) ? + (nonAttackFrames + 1) : ((NPC.frameCounter < (double)(attackTimingStart + attackFrameTiming * 3)) ? + (nonAttackFrames + 2) : ((NPC.frameCounter < (double)(attackTimingStart + attackFrameTiming * 4)) ? + (nonAttackFrames + 3) : 0)))) : 0); + + NPC.frame.Y = frameHeight * attackFrame; + } + else if (NPC.ai[0] == 15f) + { + NPC.frameCounter += 1D; + int num259 = NPC.frame.Y / frameHeight; + int currentFrame = num259 - nonAttackFrames; + if ((uint)currentFrame > 3u && num259 != 0) + { + NPC.frame.Y = 0; + NPC.frameCounter = 0D; + } + + float num260 = NPC.ai[1] / (float)NPCID.Sets.AttackTime[NPC.type]; + int num261 = 0; + num261 = ((num260 > 0.65f) ? + nonAttackFrames : ((num260 > 0.5f) ? + (nonAttackFrames + 1) : ((num260 > 0.35f) ? + (nonAttackFrames + 2) : ((num260 > 0f) ? + (nonAttackFrames + 3) : 0)))); + + NPC.frame.Y = frameHeight * num261; + } + else if (NPC.ai[0] == 25f) + { + NPC.frame.Y = frameHeight; + } + else if (NPC.ai[0] == 12f) + { + NPC.frameCounter += 1D; + int num262 = NPC.frame.Y / frameHeight; + int currentFrame = num262 - nonAttackFrames; + if ((uint)currentFrame > 4u && num262 != 0) + { + NPC.frame.Y = 0; + NPC.frameCounter = 0D; + } + + int num263 = nonAttackFrames + NPC.GetShootingFrame(NPC.ai[2]); + NPC.frame.Y = frameHeight * num263; + } + else if (NPC.ai[0] == 14f || NPC.ai[0] == 24f) + { + NPC.frameCounter += 1D; + int num264 = NPC.frame.Y / frameHeight; + int currentFrame = num264 - nonAttackFrames; + if ((uint)currentFrame > 1u && num264 != 0) + { + NPC.frame.Y = 0; + NPC.frameCounter = 0D; + } + + int num265 = 12; + int num266 = ((NPC.frameCounter % (double)num265 * 2D < (double)num265) ? nonAttackFrames : (nonAttackFrames + 1)); + NPC.frame.Y = frameHeight * num266; + if (NPC.ai[0] == 24f) + { + if (NPC.frameCounter == 60D) + EmoteBubble.NewBubble(EmoteID.EmoteConfused, new WorldUIAnchor(NPC), 60); + + if (NPC.frameCounter == 150D) + EmoteBubble.NewBubble(EmoteID.EmotionAlert, new WorldUIAnchor(NPC), 90); + + if (NPC.frameCounter >= 240D) + NPC.frame.Y = 0; + } + } + else if (NPC.ai[0] == 1001f) + { + NPC.frame.Y = frameHeight * (nonAttackFrames - 1); + NPC.frameCounter = 0D; + } + else if (NPC.CanTalk && (NPC.ai[0] == 3f || NPC.ai[0] == 4f)) // Talking to another NPC + { + NPC.frameCounter += 1D; + int npcTalkFrameHeight = NPC.frame.Y / frameHeight; + int currentFrame = nonAttackFrames - npcTalkFrameHeight; + if ((uint)(currentFrame - 1) > 1u && (uint)(currentFrame - 4) > 1u && npcTalkFrameHeight != 0) + { + NPC.frame.Y = 0; + NPC.frameCounter = 0D; + } + + bool displayEmote = NPC.ai[0] == 3f; + int npcTalkFrame = 0; + int npcTalkHandFrame = 0; + int emoteDisplayTime = -1; + int emoteDisplayTime2 = -1; + if (NPC.frameCounter < 10D) + npcTalkFrame = 0; + else if (NPC.frameCounter < 16D) + npcTalkFrame = nonAttackFrames - 5; + else if (NPC.frameCounter < 46D) + npcTalkFrame = nonAttackFrames - 4; + else if (NPC.frameCounter < 60D) + npcTalkFrame = nonAttackFrames - 5; + else if (NPC.frameCounter < 216D) + npcTalkFrame = 0; + else if (NPC.frameCounter == 216D && Main.netMode != NetmodeID.MultiplayerClient) + emoteDisplayTime = 70; + else if (NPC.frameCounter < 286D) + npcTalkFrame = ((NPC.frameCounter % 12D < 6D) ? (nonAttackFrames - 2) : 0); + else if (NPC.frameCounter < 320D) + npcTalkFrame = 0; + else if (NPC.frameCounter != 320D || Main.netMode == NetmodeID.MultiplayerClient) + npcTalkFrame = ((NPC.frameCounter < 420D) ? ((NPC.frameCounter % 16D < 8D) ? (nonAttackFrames - 2) : 0) : 0); + else + emoteDisplayTime = 100; + + if (NPC.frameCounter < 70D) + { + npcTalkHandFrame = 0; + } + else if (NPC.frameCounter != 70D || Main.netMode == NetmodeID.MultiplayerClient) + { + npcTalkHandFrame = ((NPC.frameCounter < 160D) ? + ((NPC.frameCounter % 16D < 8D) ? + (nonAttackFrames - 2) : 0) : ((NPC.frameCounter < 166D) ? + (nonAttackFrames - 5) : ((NPC.frameCounter < 186D) ? + (nonAttackFrames - 4) : ((NPC.frameCounter < 200D) ? + (nonAttackFrames - 5) : ((!(NPC.frameCounter < 320D)) ? + ((NPC.frameCounter < 326D) ? + (nonAttackFrames - 1) : 0) : 0))))); + } + else + emoteDisplayTime2 = 90; + + if (displayEmote) + { + NPC nPC = Main.npc[(int)NPC.ai[2]]; + if (emoteDisplayTime != -1) + EmoteBubble.NewBubbleNPC(new WorldUIAnchor(NPC), emoteDisplayTime, new WorldUIAnchor(nPC)); + + if (emoteDisplayTime2 != -1 && nPC.CanTalk) + EmoteBubble.NewBubbleNPC(new WorldUIAnchor(nPC), emoteDisplayTime2, new WorldUIAnchor(NPC)); + } + + NPC.frame.Y = frameHeight * (displayEmote ? npcTalkFrame : npcTalkHandFrame); + if (NPC.frameCounter >= 420D) + NPC.frameCounter = 0D; + } + else if (NPC.CanTalk && (NPC.ai[0] == 16f || NPC.ai[0] == 17f)) // Rock Paper Scissors + { + NPC.frameCounter += 1D; + int rpsFrameHeight = NPC.frame.Y / frameHeight; + int currentFrame = nonAttackFrames - rpsFrameHeight; + if ((uint)(currentFrame - 1) > 1u && (uint)(currentFrame - 4) > 1u && rpsFrameHeight != 0) + { + NPC.frame.Y = 0; + NPC.frameCounter = 0D; + } + + bool controlsRPS = NPC.ai[0] == 16f; + int rpsFrame = 0; + int emoteDisplayTime = -1; + if (NPC.frameCounter < 10D) + rpsFrame = 0; + else if (NPC.frameCounter < 16D) + rpsFrame = nonAttackFrames - 5; + else if (NPC.frameCounter < 22D) + rpsFrame = nonAttackFrames - 4; + else if (NPC.frameCounter < 28D) + rpsFrame = nonAttackFrames - 5; + else if (NPC.frameCounter < 34D) + rpsFrame = nonAttackFrames - 4; + else if (NPC.frameCounter < 40D) + rpsFrame = nonAttackFrames - 5; + else if (NPC.frameCounter == 40D && Main.netMode != NetmodeID.MultiplayerClient) + emoteDisplayTime = 45; + else if (NPC.frameCounter < 70D) + rpsFrame = nonAttackFrames - 4; + else if (NPC.frameCounter < 76D) + rpsFrame = nonAttackFrames - 5; + else if (NPC.frameCounter < 82D) + rpsFrame = nonAttackFrames - 4; + else if (NPC.frameCounter < 88D) + rpsFrame = nonAttackFrames - 5; + else if (NPC.frameCounter < 94D) + rpsFrame = nonAttackFrames - 4; + else if (NPC.frameCounter < 100D) + rpsFrame = nonAttackFrames - 5; + else if (NPC.frameCounter == 100D && Main.netMode != NetmodeID.MultiplayerClient) + emoteDisplayTime = 45; + else if (NPC.frameCounter < 130D) + rpsFrame = nonAttackFrames - 4; + else if (NPC.frameCounter < 136D) + rpsFrame = nonAttackFrames - 5; + else if (NPC.frameCounter < 142D) + rpsFrame = nonAttackFrames - 4; + else if (NPC.frameCounter < 148D) + rpsFrame = nonAttackFrames - 5; + else if (NPC.frameCounter < 154D) + rpsFrame = nonAttackFrames - 4; + else if (NPC.frameCounter < 160D) + rpsFrame = nonAttackFrames - 5; + else if (NPC.frameCounter != 160D || Main.netMode == NetmodeID.MultiplayerClient) + rpsFrame = ((NPC.frameCounter < 220D) ? (nonAttackFrames - 4) : ((NPC.frameCounter < 226D) ? (nonAttackFrames - 5) : 0)); + else + emoteDisplayTime = 75; + + if (controlsRPS && emoteDisplayTime != -1) + { + int npcPick = (int)NPC.localAI[2]; + int npcWins = (int)NPC.localAI[3]; + int opponentWins = (int)Main.npc[(int)NPC.ai[2]].localAI[3]; + int opponentPick = (int)Main.npc[(int)NPC.ai[2]].localAI[2]; + int rpsGameEnder = 3 - npcPick - npcWins; + int numGamesPlayed = 0; + if (NPC.frameCounter == 40D) + numGamesPlayed = 1; + + if (NPC.frameCounter == 100D) + numGamesPlayed = 2; + + if (NPC.frameCounter == 160D) + numGamesPlayed = 3; + + int gameCountdown = 3 - numGamesPlayed; + int rockPaperScissorsResultType = -1; + int gameFrameTimer = 0; + while (rockPaperScissorsResultType < 0) + { + currentFrame = gameFrameTimer + 1; + gameFrameTimer = currentFrame; + if (currentFrame >= 100) + break; + + rockPaperScissorsResultType = Main.rand.Next(2); + if (rockPaperScissorsResultType == 0 && opponentPick >= npcWins) + rockPaperScissorsResultType = -1; + + if (rockPaperScissorsResultType == 1 && opponentWins >= npcPick) + rockPaperScissorsResultType = -1; + + if (rockPaperScissorsResultType == -1 && gameCountdown <= rpsGameEnder) + rockPaperScissorsResultType = 2; + } + + if (rockPaperScissorsResultType == 0) + { + Main.npc[(int)NPC.ai[2]].localAI[3] += 1f; + opponentWins++; + } + + if (rockPaperScissorsResultType == 1) + { + Main.npc[(int)NPC.ai[2]].localAI[2] += 1f; + opponentPick++; + } + + int emoteType = Utils.SelectRandom(Main.rand, EmoteID.RPSPaper, EmoteID.RPSRock, EmoteID.RPSScissors); + int emoteType2 = emoteType; + switch (rockPaperScissorsResultType) + { + case 0: + switch (emoteType) + { + case EmoteID.RPSPaper: + emoteType2 = EmoteID.RPSRock; + break; + case EmoteID.RPSRock: + emoteType2 = EmoteID.RPSScissors; + break; + case EmoteID.RPSScissors: + emoteType2 = EmoteID.RPSPaper; + break; + } + break; + case 1: + switch (emoteType) + { + case EmoteID.RPSPaper: + emoteType2 = EmoteID.RPSScissors; + break; + case EmoteID.RPSRock: + emoteType2 = EmoteID.RPSPaper; + break; + case EmoteID.RPSScissors: + emoteType2 = EmoteID.RPSRock; + break; + } + break; + } + + if (gameCountdown == 0) + { + if (opponentWins >= 2) + emoteType -= 3; + + if (opponentPick >= 2) + emoteType2 -= 3; + } + + EmoteBubble.NewBubble(emoteType, new WorldUIAnchor(NPC), emoteDisplayTime); + EmoteBubble.NewBubble(emoteType2, new WorldUIAnchor(Main.npc[(int)NPC.ai[2]]), emoteDisplayTime); + } + + NPC.frame.Y = frameHeight * (controlsRPS ? rpsFrame : rpsFrame); + if (NPC.frameCounter >= 420D) + NPC.frameCounter = 0D; + } + else if (NPC.velocity.X == 0f) + { + NPC.frame.Y = 0; + NPC.frameCounter = 0D; + } + else // Walking + { + NPC.frameCounter += Math.Abs(NPC.velocity.X) * 2f; + NPC.frameCounter += 1D; + + int walkFrameHeightLimit = frameHeight * 2; + if (NPC.frame.Y < walkFrameHeightLimit) + NPC.frame.Y = walkFrameHeightLimit; + + int walkFrameTimer = 6; + if (NPC.frameCounter > (double)walkFrameTimer) + { + NPC.frame.Y += frameHeight; + NPC.frameCounter = 0D; + } + + if (NPC.frame.Y / frameHeight >= Main.npcFrameCount[NPC.type] - extraFrameAmt) + NPC.frame.Y = walkFrameHeightLimit; + } + + return; + } + + NPC.frameCounter = 0D; + NPC.frame.Y = frameHeight; + } + public override void AI() { if (!CalamityWorld.spawnedCirrus) @@ -103,7 +679,7 @@ namespace CalamityMod.NPCs.TownNPCs return false; } - public override List SetNPCNameList() => new List() { this.GetLocalizedValue("Name.Cirrus") }; + public override List SetNPCNameList() => new List() { this.GetLocalizedValue("Name.Cirrus") }; public override string GetChat() { @@ -245,6 +821,13 @@ namespace CalamityMod.NPCs.TownNPCs return dialogue; } + public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + { + 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; + } + public string Death() { int deaths = Main.player[Main.myPlayer].numberOfDeathsPVE; @@ -338,6 +921,7 @@ namespace CalamityMod.NPCs.TownNPCs .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(1)) .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)) .Register(); } diff --git a/NPCs/TownNPCs/FAP.png b/NPCs/TownNPCs/FAP.png index c29b4bed7f..adf1db2d15 100644 Binary files a/NPCs/TownNPCs/FAP.png and b/NPCs/TownNPCs/FAP.png differ diff --git a/NPCs/TownNPCs/FAPAlt.png b/NPCs/TownNPCs/FAPAlt.png new file mode 100644 index 0000000000..45895728f7 Binary files /dev/null and b/NPCs/TownNPCs/FAPAlt.png differ diff --git a/NPCs/TownNPCs/FAP_Head.png b/NPCs/TownNPCs/FAP_Head.png index 05a348609d..d4b8a7cb82 100644 Binary files a/NPCs/TownNPCs/FAP_Head.png and b/NPCs/TownNPCs/FAP_Head.png differ diff --git a/NPCs/TownNPCs/SEAHOE.cs b/NPCs/TownNPCs/SEAHOE.cs index 4678f5ae7d..b455f13eb2 100644 --- a/NPCs/TownNPCs/SEAHOE.cs +++ b/NPCs/TownNPCs/SEAHOE.cs @@ -1,13 +1,13 @@ -using CalamityMod.Buffs.StatBuffs; +using System.Collections.Generic; +using CalamityMod.Buffs.StatBuffs; +using CalamityMod.Items.Pets; using CalamityMod.Items.SummonItems; using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Items.Weapons.Summon; -using CalamityMod.Items.Pets; using CalamityMod.Projectiles.Rogue; -using System.Collections.Generic; using Terraria; using Terraria.DataStructures; using Terraria.GameContent.Bestiary; @@ -39,10 +39,11 @@ namespace CalamityMod.NPCs.TownNPCs .SetNPCAffection(NPCID.Pirate, AffectionLevel.Like) .SetNPCAffection(NPCID.Demolitionist, AffectionLevel.Dislike) .SetNPCAffection(NPCID.Angler, AffectionLevel.Hate); - NPCID.Sets.NPCBestiaryDrawModifiers drawModifiers = new NPCID.Sets.NPCBestiaryDrawModifiers(0) { - Velocity = 1f // Draws the NPC in the bestiary as if its walking +1 tiles in the x direction - }; - NPCID.Sets.NPCBestiaryDrawOffset.Add(NPC.type, drawModifiers); + NPCID.Sets.NPCBestiaryDrawModifiers drawModifiers = new NPCID.Sets.NPCBestiaryDrawModifiers() + { + Velocity = 1f // Draws the NPC in the bestiary as if its walking +1 tiles in the x direction + }; + NPCID.Sets.NPCBestiaryDrawOffset.Add(NPC.type, drawModifiers); } public override void SetDefaults() @@ -63,16 +64,16 @@ namespace CalamityMod.NPCs.TownNPCs public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { - BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Ocean, - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.SEAHOE") + BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Ocean, + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.SEAHOE") }); } public override bool CanTownNPCSpawn(int numTownNPCs) => DownedBossSystem.downedCLAM && DownedBossSystem.downedDesertScourge; - public override List SetNPCNameList() => new List() { this.GetLocalizedValue("Name.Amidias") }; + public override List SetNPCNameList() => new List() { this.GetLocalizedValue("Name.Amidias") }; public override void AI() { @@ -209,7 +210,7 @@ namespace CalamityMod.NPCs.TownNPCs .Add(ModContent.ItemType()) .Add(ModContent.ItemType()) .Add(ModContent.ItemType()) - .AddWithCustomValue(ItemID.TruffleWorm, Item.buyPrice(gold: 10), Condition.Hardmode) + .AddWithCustomValue(ItemID.TruffleWorm, Item.buyPrice(gold: 15), Condition.Hardmode) .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(2), downedOldDuke) .AddWithCustomValue(ItemID.ShrimpPoBoy, Item.buyPrice(gold: 2, silver: 50), Condition.HappyEnough, Condition.InBeach) .AddWithCustomValue(ItemID.Fries, Item.buyPrice(gold: 2), Condition.HappyEnough, Condition.InBeach, Condition.DownedEyeOfCthulhu) diff --git a/NPCs/TownNPCs/THIEF.cs b/NPCs/TownNPCs/THIEF.cs index 29602dd9a0..a2d2ceb4b6 100644 --- a/NPCs/TownNPCs/THIEF.cs +++ b/NPCs/TownNPCs/THIEF.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items; +using System.Collections.Generic; +using CalamityMod.Items; using CalamityMod.Items.Accessories; using CalamityMod.Items.Pets; using CalamityMod.Items.Weapons.Rogue; @@ -6,9 +7,10 @@ using CalamityMod.Projectiles.Rogue; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System.Collections.Generic; +using ReLogic.Content; using Terraria; using Terraria.Audio; +using Terraria.GameContent; using Terraria.GameContent.Bestiary; using Terraria.GameContent.Events; using Terraria.GameContent.Personalities; @@ -22,6 +24,8 @@ namespace CalamityMod.NPCs.TownNPCs [AutoloadHead] public class THIEF : ModNPC { + public static Asset AltTexture; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 23; @@ -37,10 +41,15 @@ namespace CalamityMod.NPCs.TownNPCs .SetBiomeAffection(AffectionLevel.Dislike) .SetNPCAffection(NPCID.GoblinTinkerer, AffectionLevel.Like) .SetNPCAffection(NPCID.Dryad, AffectionLevel.Dislike); - NPCID.Sets.NPCBestiaryDrawModifiers drawModifiers = new NPCID.Sets.NPCBestiaryDrawModifiers(0) { + NPCID.Sets.NPCBestiaryDrawModifiers drawModifiers = new NPCID.Sets.NPCBestiaryDrawModifiers() + { Velocity = 1f // Draws the NPC in the bestiary as if its walking +1 tiles in the x direction }; NPCID.Sets.NPCBestiaryDrawOffset.Add(NPC.type, drawModifiers); + if (!Main.dedServ) + { + AltTexture = ModContent.Request(Texture + "Alt", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -62,9 +71,9 @@ namespace CalamityMod.NPCs.TownNPCs public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { - BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Desert, + BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Desert, new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.THIEF") }); } @@ -102,6 +111,7 @@ namespace CalamityMod.NPCs.TownNPCs "Goose", // <@!591421917706321962> (DullElili#8016) "Jackson", // <@!525827730646892549> (ChowChow, Sin of Sleep Schedules#1235) "Altarca", // <@!1140673052108128337> (altarca_27226_49175) + "Jackie", // <@!353241811717718016> (jackalchan) // Original names this.GetLocalizedValue("Name.Laura"), @@ -128,7 +138,7 @@ namespace CalamityMod.NPCs.TownNPCs { if (Main.bloodMoon) return this.GetLocalizedValue("Chat.BloodMoon" + Main.rand.Next(1, 4 + 1)); - + WeightedRandom dialogue = new WeightedRandom(); dialogue.Add(this.GetLocalizedValue("Chat.Normal1")); @@ -153,7 +163,7 @@ namespace CalamityMod.NPCs.TownNPCs int cirrusIndex = NPC.FindFirstNPC(ModContent.NPCType()); if (cirrusIndex != -1) dialogue.Add(this.GetLocalization("Chat.DrunkPrincess").Format(Main.npc[cirrusIndex].GivenName)); - + int merchantIndex = NPC.FindFirstNPC(NPCID.Merchant); if (merchantIndex != -1) dialogue.Add(this.GetLocalization("Chat.Merchant").Format(Main.npc[merchantIndex].GivenName)); @@ -236,14 +246,14 @@ namespace CalamityMod.NPCs.TownNPCs public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { var something = NPC.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - spriteBatch.Draw(ModContent.Request(Texture + (BirthdayParty.PartyIsUp ? "Alt" : "")).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); + 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; } public override void SetChatButtons(ref string button, ref string button2) { button = Language.GetTextValue("LegacyInterface.28"); - button2 = this.GetLocalizedValue("RefundButton");; + button2 = this.GetLocalizedValue("RefundButton"); ; } public override void OnChatButtonClicked(bool firstButton, ref string shopName) diff --git a/NPCs/TownNPCs/WITCH.cs b/NPCs/TownNPCs/WITCH.cs index aadde1c96d..beefa5a4fb 100644 --- a/NPCs/TownNPCs/WITCH.cs +++ b/NPCs/TownNPCs/WITCH.cs @@ -1,10 +1,10 @@ -using CalamityMod.BiomeManagers; +using System.Collections.Generic; +using CalamityMod.BiomeManagers; using CalamityMod.Dusts; using CalamityMod.Events; using CalamityMod.Items; using CalamityMod.Projectiles.Magic; using CalamityMod.UI.CalamitasEnchants; -using System.Collections.Generic; using Terraria; using Terraria.GameContent; using Terraria.GameContent.Bestiary; @@ -36,10 +36,11 @@ namespace CalamityMod.NPCs.TownNPCs .SetBiomeAffection(AffectionLevel.Dislike) .SetNPCAffection(NPCID.Clothier, AffectionLevel.Like) .SetNPCAffection(NPCID.PartyGirl, AffectionLevel.Dislike); - NPCID.Sets.NPCBestiaryDrawModifiers drawModifiers = new NPCID.Sets.NPCBestiaryDrawModifiers(0) { - Velocity = 1f // Draws the NPC in the bestiary as if its walking +1 tiles in the x direction - }; - NPCID.Sets.NPCBestiaryDrawOffset.Add(NPC.type, drawModifiers); + NPCID.Sets.NPCBestiaryDrawModifiers drawModifiers = new NPCID.Sets.NPCBestiaryDrawModifiers() + { + Velocity = 1f // Draws the NPC in the bestiary as if its walking +1 tiles in the x direction + }; + NPCID.Sets.NPCBestiaryDrawOffset.Add(NPC.type, drawModifiers); } public override void SetDefaults() @@ -64,16 +65,16 @@ namespace CalamityMod.NPCs.TownNPCs public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { - BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Surface, - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.WITCH") + BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Surface, + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.WITCH") }); } public override bool CanTownNPCSpawn(int numTownNPCs) => DownedBossSystem.downedCalamitas && !NPC.AnyNPCs(NPCType()); - public override List SetNPCNameList() => new List() { this.GetLocalizedValue("Name.Calamitas") }; + public override List SetNPCNameList() => new List() { this.GetLocalizedValue("Name.Calamitas") }; // The way this works is by having an RNG based on weights. // With certain conditions (such as if a blood moon is happening) you can add possibilities diff --git a/NPCs/TownNPCs/WITCH.png b/NPCs/TownNPCs/WITCH.png index 7c02e35630..7b9a6af20e 100644 Binary files a/NPCs/TownNPCs/WITCH.png and b/NPCs/TownNPCs/WITCH.png differ diff --git a/NPCs/TownNPCs/WITCH_Head.png b/NPCs/TownNPCs/WITCH_Head.png index 8869c7a345..686a9f7aa6 100644 Binary files a/NPCs/TownNPCs/WITCH_Head.png and b/NPCs/TownNPCs/WITCH_Head.png differ diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/BrainOfCthulhuAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/BrainOfCthulhuAI.cs new file mode 100644 index 0000000000..ebfd7f20ae --- /dev/null +++ b/NPCs/VanillaNPCAIOverrides/Bosses/BrainOfCthulhuAI.cs @@ -0,0 +1,1510 @@ +using System; +using CalamityMod.Events; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses +{ + public static class BrainOfCthulhuAI + { + public const float TimeBeforeCreeperAttack = 600f; + public const float CreeperTelegraphTime = 180f; + private const float SpinVelocity = 12f; + private const int SpinRadius = 45; + + public static bool BuffedBrainofCthulhuAI(NPC npc, Mod mod) + { + // whoAmI variable + NPC.crimsonBoss = npc.whoAmI; + + bool bossRush = BossRushEvent.BossRushActive; + bool masterMode = Main.masterMode || bossRush; + bool death = CalamityWorld.death || bossRush; + + // Get a target + 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(); + + bool enrage = true; + int targetTileX = (int)Main.player[npc.target].Center.X / 16; + int targetTileY = (int)Main.player[npc.target].Center.Y / 16; + + Tile tile = Framing.GetTileSafely(targetTileX, targetTileY); + if (tile.WallType == WallID.CrimstoneUnsafe) + enrage = false; + + float enrageScale = bossRush ? 1.5f : masterMode ? 0.5f : 0f; + if (((npc.position.Y / 16f) < Main.worldSurface && enrage) || bossRush) + { + npc.Calamity().CurrentlyEnraged = !bossRush; + enrageScale += 0.5f; + } + if (!Main.player[npc.target].ZoneCrimson || bossRush) + { + npc.Calamity().CurrentlyEnraged = !bossRush; + enrageScale += 2f; + } + + // Despawn check + bool despawn = Main.player[npc.target].dead && !bossRush; + + // Despawn + if (despawn) + { + if (npc.localAI[3] < 120f) + npc.localAI[3] += 1f; + + if (npc.localAI[3] > 60f) + npc.velocity.Y += (npc.localAI[3] - 60f) * 0.25f; + } + else if (npc.localAI[3] > 0f) + npc.localAI[3] -= 1f; + + // Extra distance for teleports if enraged + int teleportDistanceIncrease = (int)Math.Round(enrageScale * 3); + + // Spawn Creepers + if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] == 0f) + { + npc.localAI[0] = 1f; + int brainOfCthuluCreepersCount = GetBrainOfCthuluCreepersCountRevDeath(); + float attackTimerIncrement = 15f; + for (int i = 0; i < brainOfCthuluCreepersCount; i++) + { + float brainX = npc.Center.X; + float brainY = npc.Center.Y; + brainX += Main.rand.Next(-npc.width, npc.width); + brainY += Main.rand.Next(-npc.height, npc.height); + + int creeperSpawn = NPC.NewNPC(npc.GetSource_FromAI(), (int)brainX, (int)brainY, NPCID.Creeper, 0, 0f, i * attackTimerIncrement); + Main.npc[creeperSpawn].velocity = new Vector2(Main.rand.Next(-30, 31) * 0.1f, Main.rand.Next(-30, 31) * 0.1f); + Main.npc[creeperSpawn].netUpdate = true; + } + } + + // Despawn + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 6000f) + { + npc.active = false; + npc.life = 0; + + if (Main.netMode == NetmodeID.Server) + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, npc.whoAmI, 0f, 0f, 0f, 0, 0, 0); + } + } + + // Phase 2 + if (npc.ai[0] < 0f) + { + if (Main.getGoodWorld) + NPC.brainOfGravity = npc.whoAmI; + + // Spawn gore + if (npc.localAI[2] == 0f) + { + SoundEngine.PlaySound(SoundID.NPCHit1, npc.Center); + + npc.localAI[2] = 1f; + + if (Main.netMode != NetmodeID.Server) + { + Gore.NewGore(npc.GetSource_FromAI(), npc.position, new Vector2(Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f), 392, 1f); + Gore.NewGore(npc.GetSource_FromAI(), npc.position, new Vector2(Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f), 393, 1f); + Gore.NewGore(npc.GetSource_FromAI(), npc.position, new Vector2(Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f), 394, 1f); + Gore.NewGore(npc.GetSource_FromAI(), npc.position, new Vector2(Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f), 395, 1f); + } + + for (int j = 0; j < 20; j++) + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f, 0, default, 1f); + + SoundEngine.PlaySound(SoundID.ForceRoar, npc.Center); + } + + // Percent life remaining + float lifeRatio = npc.life / (float)npc.lifeMax; + + // Phases + + // Start spinning, create additional afterimages, shoot projectiles and charging phase + bool phase3 = lifeRatio < 0.8f; + + // Fire projectiles from 2 locations phase + bool phase4 = lifeRatio < 0.6f; + + // Fire projectiles from 4 locations phase + bool phase5 = lifeRatio < 0.4f; + + // Spin faster, shoot faster projectiles and begin teleporting from cardinal directions phase + bool phase6 = lifeRatio < 0.25f; + + // Super fast spin and charges phase + bool phase7 = lifeRatio < 0.1f; + + // Spawn Creepers in Master Mode + if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] == 1f && masterMode && phase3) + { + npc.localAI[0] = 2f; + SpawnMasterModeCreepers(); + } + + if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] == 2f && masterMode && phase5) + { + npc.localAI[0] = 3f; + SpawnMasterModeCreepers(); + } + + if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] == 3f && masterMode && phase7) + { + npc.localAI[0] = 4f; + SpawnMasterModeCreepers(); + } + + void SpawnMasterModeCreepers() + { + int brainOfCthuluCreepersCount = GetBrainOfCthuluCreepersCountRevDeath() / 4; + float attackTimerIncrement = 15f * 4; + for (int i = 0; i < brainOfCthuluCreepersCount; i++) + { + float brainX = npc.Center.X; + float brainY = npc.Center.Y; + brainX += Main.rand.Next(-npc.width, npc.width); + brainY += Main.rand.Next(-npc.height, npc.height); + + int creeperSpawn = NPC.NewNPC(npc.GetSource_FromAI(), (int)brainX, (int)brainY, NPCID.Creeper, 0, 0f, i * attackTimerIncrement); + Main.npc[creeperSpawn].velocity = new Vector2(Main.rand.Next(-30, 31) * 0.1f, Main.rand.Next(-30, 31) * 0.1f); + Main.npc[creeperSpawn].netUpdate = true; + } + } + + // Whether the fucking thing is spinning or not, dipshit + bool spinning = npc.ai[0] == -4f; + + // Spin variables + float spinVelocity = SpinVelocity; + int spinRadius = SpinRadius; + if (phase7) + { + spinVelocity *= 2f; + spinRadius *= 2; + } + else if (phase6) + { + spinVelocity *= 1.5f; + spinRadius = (int)(SpinRadius * 1.5f); + } + + // Charge variables + float chargeVelocity = (death ? 18f : 15f) + 3f * enrageScale; + if (phase7) + chargeVelocity *= 1.2f; + + // KnockBack + float baseKnockBackResist = death ? 0.1f : 0.3f; + if (!phase3) + npc.knockBackResist = GetCrimsonBossKnockBack(npc, CalamityGlobalNPC.GetActivePlayerCount(), lifeRatio, baseKnockBackResist); + else + npc.knockBackResist = 0f; + + // Gain defense while spinning + npc.defense = npc.defDefense + (spinning ? 7 : 0); + + // Take damage + npc.dontTakeDamage = false; + + // Target distance X + float playerLocation = npc.Center.X - Main.player[npc.target].Center.X; + + // Charge + if (!spinning) + { + // Not charging + if (npc.ai[0] != -5f) + { + // Rubber band movement + if (!despawn) + { + Vector2 brainCenter = npc.Center; + Vector2 destination = Main.player[npc.target].Center + (masterMode ? Main.player[npc.target].velocity * 20f * enrageScale : Vector2.Zero); + float targetXDist = destination.X - brainCenter.X; + float targetYDist = destination.Y - brainCenter.Y; + float targetDistance = (float)Math.Sqrt(targetXDist * targetXDist + targetYDist * targetYDist); + float velocityScale = death ? 6f : 4.5f; + float velocityBoost = velocityScale * (1f - lifeRatio); + float nonChargeSpeed = (masterMode ? 24f : 18f) + velocityBoost + 3f * enrageScale; + if (Main.getGoodWorld) + nonChargeSpeed *= 1.15f; + + targetDistance = nonChargeSpeed / targetDistance; + targetXDist *= targetDistance; + targetYDist *= targetDistance; + + float minInertia = death ? 60f : 75f; + float maxInertia = death ? 80f : 100f; + if (masterMode) + { + minInertia -= 10f; + maxInertia -= 10f; + } + + float inertia = MathHelper.Lerp(minInertia, maxInertia, lifeRatio); + npc.velocity.X = (npc.velocity.X * inertia + targetXDist) / (inertia + 1f); + npc.velocity.Y = (npc.velocity.Y * inertia + targetYDist) / (inertia + 1f); + } + } + + // Charge, -5 + else + { + if (!despawn) + npc.ai[1] += 1f; + + float chargeDistance = 960f; // 60 tile charge distance + float chargeDuration = chargeDistance / chargeVelocity; + float chargeGateValue = 10f; + + if (npc.ai[1] < chargeGateValue) + { + // Avoid cheap bullshit + npc.damage = 0; + } + else + { + // Set damage + npc.damage = npc.defDamage; + } + + // Teleport + float timeGateValue = chargeDuration + chargeGateValue; + if (npc.ai[1] >= timeGateValue) + { + npc.ai[0] = -6f; + npc.ai[1] = 0f; + float maxTeleportPhaseDurationReduction = 60f; + float lerpHPScalar = (0.8f - lifeRatio) / 0.8f; + npc.localAI[1] = MathHelper.Lerp(0f, maxTeleportPhaseDurationReduction, lerpHPScalar); + npc.netUpdate = true; + } + + // Charge sound and velocity + else if (npc.ai[1] == chargeGateValue && !despawn) + { + // Sound + SoundEngine.PlaySound(SoundID.ForceRoarPitched, npc.Center); + + // Velocity + npc.velocity = (Main.player[npc.target].Center + (masterMode ? Main.player[npc.target].velocity * 20f * enrageScale : Vector2.Zero) - npc.Center).SafeNormalize(Vector2.UnitY) * chargeVelocity; + if (Main.getGoodWorld) + npc.velocity *= 1.15f; + } + } + } + + // Circle around, -4 + if (spinning) + { + // Avoid cheap bullshit + npc.damage = 0; + + // Charge sound + if (npc.ai[2] == 0f) + { + SoundEngine.PlaySound(SoundID.ForceRoar, npc.Center); + + if (CalamityWorld.LegendaryMode) + { + if (Main.netMode != NetmodeID.Server) + { + if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active && Vector2.Distance(Main.player[Main.myPlayer].Center, npc.Center) < CalamityGlobalNPC.CatchUpDistance350Tiles) + Main.player[Main.myPlayer].AddBuff(BuffID.Confused, 90); + } + } + } + + // Velocity + float velocity = MathHelper.TwoPi / spinRadius; + npc.velocity = npc.velocity.RotatedBy(-(double)velocity * npc.ai[1]); + + npc.ai[2] += 1f; + + float timer = (death ? 0f : 30f) + npc.ai[3]; + + // Move the brain away from the target in order to ensure fairness + if (npc.ai[2] >= timer - 5f) + { + float minChargeDistance = 640f; // 40 tile distance + if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) < minChargeDistance) + { + npc.ai[2] -= 1f; + npc.velocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * (-chargeVelocity - 2f * enrageScale); + if (masterMode) + npc.velocity *= 1.5f; + if (Main.getGoodWorld) + npc.velocity *= 1.15f; + } + } + + // Charge at target + if (npc.ai[2] >= timer) + { + // Shoot projectiles from 4 directions, alternating between diagonal and cardinal + float bloodShotVelocity = (death ? 7.5f : 6f) + enrageScale; + + // Scale projectile velocity + float phase7ProjectileVelocityMult = 1.2f; + float phase6ProjectileVelocityMult = 1.1f; + if (phase7) + bloodShotVelocity *= phase7ProjectileVelocityMult; + else if (phase6) + bloodShotVelocity *= phase6ProjectileVelocityMult; + + if (phase4) + { + bool alternativeFire = npc.ai[3] % 2f == 0f; + bool diagonalShots = alternativeFire || !phase5; + bool otherQuadrants = Main.rand.NextBool(); + int startingIndex = (otherQuadrants && !phase5) ? 2 : 0; + int totalProjectileSpreads = (phase5 || startingIndex == 2) ? 4 : 2; + for (int i = startingIndex; i < totalProjectileSpreads; i++) + { + Vector2 position = npc.Center; + float distanceFromTargetX = Math.Abs(npc.Center.X - Main.player[Main.myPlayer].Center.X); + float distanceFromTargetY = Math.Abs(npc.Center.Y - Main.player[Main.myPlayer].Center.Y); + + switch (i) + { + case 0: + + position.X = Main.player[Main.myPlayer].Center.X - distanceFromTargetX; + if (diagonalShots) + position.Y = Main.player[Main.myPlayer].Center.Y - distanceFromTargetY; + else + position.Y = Main.player[Main.myPlayer].Center.Y; + + break; + + case 1: + + position.Y = Main.player[Main.myPlayer].Center.Y - distanceFromTargetY; + if (diagonalShots) + position.X = Main.player[Main.myPlayer].Center.X + distanceFromTargetX; + else + position.X = Main.player[Main.myPlayer].Center.X; + + break; + + case 2: + + position.X = Main.player[Main.myPlayer].Center.X + distanceFromTargetX; + if (diagonalShots) + position.Y = Main.player[Main.myPlayer].Center.Y + distanceFromTargetY; + else + position.Y = Main.player[Main.myPlayer].Center.Y; + + break; + + case 3: + + position.Y = Main.player[Main.myPlayer].Center.Y + distanceFromTargetY; + if (diagonalShots) + position.X = Main.player[Main.myPlayer].Center.X - distanceFromTargetX; + else + position.X = Main.player[Main.myPlayer].Center.X; + + break; + + default: + break; + } + + Vector2 projectileVelocity = (Main.player[npc.target].Center - position).SafeNormalize(Vector2.UnitY) * bloodShotVelocity; + float minFiringDistance = 560f; // 35 tile distance + bool firedFromRealBrain = Vector2.Distance(position, npc.Center) < 8f; + if (Vector2.Distance(position, Main.player[npc.target].Center) > minFiringDistance && !firedFromRealBrain) // The projectiles can only be fired if the target is more than 15 tiles away from the firing position + { + bool canHit = Collision.CanHitLine(position, 1, 1, Main.player[npc.target].Center, 1, 1); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int type = ProjectileID.BloodShot; + int damage = npc.GetProjectileDamage(type); + int numProj = death ? 6 : 4; + int spread = death ? 22 : 15; + if (phase7) + { + numProj = death ? 4 : 2; + spread = death ? 15 : 10; + } + else if (phase5) + { + numProj = death ? 5 : 3; + spread = death ? 30 : 20; + } + + if (masterMode) + { + numProj += 3; + spread += 10; + } + + float rotation = MathHelper.ToRadians(spread); + for (int j = 0; j < numProj; j++) + { + Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, j / (float)(numProj - 1))); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), position + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 10f, perturbedSpeed, type, damage, 0f, Main.myPlayer); + Main.projectile[proj].timeLeft = 600; + if (!canHit) + Main.projectile[proj].tileCollide = false; + } + } + } + } + } + + Vector2 projectileVelocity2 = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * bloodShotVelocity; + bool canHit2 = Collision.CanHitLine(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int type = ProjectileID.BloodNautilusShot; + int damage = npc.GetProjectileDamage(type); + int numProj = death ? 9 : 7; + int spread = death ? 45 : 40; + if (phase7) + { + numProj = death ? 3 : 2; + spread = death ? 8 : 5; + } + else if (phase5) + { + numProj = death ? 4 : 2; + spread = death ? 15 : 10; + } + else if (phase4) + { + numProj = death ? 5 : 3; + spread = death ? 15 : 10; + } + + if (masterMode) + { + numProj += 4; + spread += 15; + } + + float rotation = MathHelper.ToRadians(spread); + for (int i = 0; i < numProj; i++) + { + Vector2 perturbedSpeed = projectileVelocity2.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 10f, perturbedSpeed, type, damage, 0f, Main.myPlayer); + Main.projectile[proj].timeLeft = 600; + if (!canHit2) + Main.projectile[proj].tileCollide = false; + } + } + + // Complete stop + npc.velocity *= 0f; + + npc.ai[0] = -5f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.TargetClosest(); + npc.netUpdate = true; + } + } + + // Pick teleport location + else if (npc.ai[0] == -1f || npc.ai[0] == -6f) + { + // Set damage + npc.damage = npc.defDamage; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + // Go to phase 3 and spin + if (phase3 && npc.ai[0] == -1f) + { + // Avoid cheap bullshit + npc.damage = 0; + + // Velocity + npc.velocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * spinVelocity; + npc.ai[0] = -4f; + npc.ai[1] = playerLocation < 0 ? 1f : -1f; + npc.ai[2] = 0f; + + int maxRandomTime = phase7 ? (masterMode ? 10 : 30) : (masterMode ? 20 : 60); + npc.ai[3] = Main.rand.Next(maxRandomTime) + 1; + npc.localAI[1] = 0f; + npc.alpha = 0; + npc.netUpdate = true; + } + + if (!despawn) + npc.localAI[1] += 1f; + + if (npc.localAI[1] >= 210f) + { + npc.localAI[1] = 0f; + npc.TargetClosest(); + int numTeleportTries = 0; + int maxTeleportTries = 100; + int teleportTileX; + int teleportTileY; + bool cardinal = Main.rand.NextBool(); + bool aboveOrBelow = Main.rand.NextBool(); + do + { + numTeleportTries++; + teleportTileX = (int)Main.player[npc.target].Center.X / 16; + teleportTileY = (int)Main.player[npc.target].Center.Y / 16; + + int minX = 14; + int maxX = 17; + int minY = 14; + int maxY = 17; + if (cardinal && phase6) + { + if (aboveOrBelow) + { + minX = 0; + maxX = 3; + minY = 21; + maxY = 24; + } + else + { + minX = 21; + maxX = 24; + minY = 0; + maxY = 3; + } + } + + int teleportX = Main.rand.Next(minX, maxX + 1) + teleportDistanceIncrease; + int teleportY = Main.rand.Next(minY, maxY + 1) + teleportDistanceIncrease; + + if (Main.rand.NextBool()) + teleportX *= -1; + + if (Main.rand.NextBool()) + teleportY *= -1; + + teleportTileX += teleportX; + teleportTileY += teleportY; + + if (numTeleportTries > maxTeleportTries || !WorldGen.SolidTile(teleportTileX, teleportTileY)) + { + // Avoid cheap bullshit + npc.damage = 0; + + npc.ai[3] = 0f; + npc.ai[0] = npc.ai[0] == -6f ? -7f : -2f; + npc.ai[1] = teleportTileX; + npc.ai[2] = teleportTileY; + npc.netUpdate = true; + npc.netSpam = 0; + + break; + } + else + { + cardinal = Main.rand.NextBool(); + aboveOrBelow = Main.rand.NextBool(); + } + } + while (numTeleportTries <= maxTeleportTries); + } + } + } + + // Teleport and turn invisible + else if (npc.ai[0] == -2f || npc.ai[0] == -7f) + { + // Avoid cheap bullshit + npc.damage = 0; + + npc.velocity *= 0.9f; + + if (Main.netMode != NetmodeID.SinglePlayer) + npc.ai[3] += 15f; + else + npc.ai[3] += 25f; + + if (npc.ai[3] >= 255f) + { + npc.ai[3] = 255f; + npc.position.X = npc.ai[1] * 16f - (npc.width / 2); + npc.position.Y = npc.ai[2] * 16f - (npc.height / 2); + SoundEngine.PlaySound(SoundID.Item8, npc.Center); + npc.ai[0] = npc.ai[0] == -7f ? -8f : -3f; + + // Move non-charging Creepers to new Brain location + for (int i = 0; i < Main.maxNPCs; i++) + { + NPC creeper = Main.npc[i]; + if (creeper.active && creeper.type == NPCID.Creeper) + { + bool creeperCanTeleport = creeper.ai[0] == 0f; + if (creeperCanTeleport) + { + creeper.position.X = npc.position.X; + creeper.position.Y = npc.position.Y; + } + } + } + + npc.netUpdate = true; + npc.netSpam = 0; + } + + npc.alpha = (int)npc.ai[3]; + } + + // Become visible + else if (npc.ai[0] == -3f || npc.ai[0] == -8f) + { + // Avoid cheap bullshit + npc.damage = 0; + + if (Main.netMode != NetmodeID.SinglePlayer) + npc.ai[3] -= 15f; + else + npc.ai[3] -= 25f; + + if (npc.ai[3] <= 0f) + { + if (npc.ai[0] == -8f) + { + npc.velocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * spinVelocity; + + npc.ai[0] = -4f; + npc.ai[1] = playerLocation < 0 ? 1f : -1f; + npc.ai[2] = 0f; + + int maxRandomTime = phase7 ? (masterMode ? 10 : 30) : (masterMode ? 20 : 60); + npc.ai[3] = Main.rand.Next(maxRandomTime) + 1; + } + else + { + npc.ai[3] = 0f; + npc.ai[2] = 0f; + npc.ai[1] = 0f; + npc.ai[0] = -1f; + } + npc.netUpdate = true; + npc.netSpam = 0; + } + + npc.alpha = (int)npc.ai[3]; + } + } + + // Phase 1 + else + { + // Avoid cheap bullshit + npc.damage = 0; + + // Creeper count + int creeperCount = NPC.CountNPCS(NPCID.Creeper); + if (creeperCount > GetBrainOfCthuluCreepersCountRevDeath()) + creeperCount = GetBrainOfCthuluCreepersCountRevDeath(); + + float creeperRatio = creeperCount / (float)GetBrainOfCthuluCreepersCountRevDeath(); + float velocityScale = MathHelper.Lerp(0f, 2f, 1f - creeperRatio) + enrageScale; + + // Check for phase 2 + bool phase2 = creeperCount <= 0; + + // Go to phase 2 + if (phase2) + { + npc.ai[0] = -1f; + npc.localAI[1] = 0f; + npc.alpha = 0; + npc.TargetClosest(); + npc.netUpdate = true; + return false; + } + + // Move towards target + if (!despawn) + { + Vector2 brainCenterPhase1 = npc.Center; + float targetXDistPhase1 = Main.player[npc.target].Center.X - brainCenterPhase1.X; + float targetYDistPhase1 = Main.player[npc.target].Center.Y - brainCenterPhase1.Y; + float targetDistancePhase1 = (float)Math.Sqrt(targetXDistPhase1 * targetXDistPhase1 + targetYDistPhase1 * targetYDistPhase1); + float maxMoveVelocity = (death ? (masterMode ? 4f : 2f) : (masterMode ? 3f : 1.5f)) + velocityScale; + if (Main.getGoodWorld) + maxMoveVelocity *= 2f; + + if (targetDistancePhase1 < maxMoveVelocity) + { + npc.velocity.X = targetXDistPhase1; + npc.velocity.Y = targetYDistPhase1; + } + else + { + targetDistancePhase1 = maxMoveVelocity / targetDistancePhase1; + npc.velocity.X = targetXDistPhase1 * targetDistancePhase1; + npc.velocity.Y = targetYDistPhase1 * targetDistancePhase1; + } + } + + // Pick a teleport location + if (npc.ai[0] == 0f) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (!despawn) + npc.localAI[1] += (death ? 2f : 1f) + velocityScale; + + if (npc.localAI[1] >= (masterMode ? 540f : 360f)) + { + // Teleport location + npc.localAI[1] = 0f; + npc.TargetClosest(); + int phase1TeleportTries = 0; + int maxTeleportTries = 100; + int phase1TeleportTileX; + int phase1TeleportTileY; + do + { + phase1TeleportTries++; + phase1TeleportTileX = (int)Main.player[npc.target].Center.X / 16; + phase1TeleportTileY = (int)Main.player[npc.target].Center.Y / 16; + + int min = 28 + teleportDistanceIncrease; + int max = 30 + teleportDistanceIncrease; + + if (Main.rand.NextBool()) + phase1TeleportTileX += Main.rand.Next(min, max); + else + phase1TeleportTileX -= Main.rand.Next(min, max); + + if (Main.rand.NextBool()) + phase1TeleportTileY += Main.rand.Next(min, max); + else + phase1TeleportTileY -= Main.rand.Next(min, max); + + if (phase1TeleportTries > maxTeleportTries || (!WorldGen.SolidTile(phase1TeleportTileX, phase1TeleportTileY) && Collision.CanHit(new Vector2(phase1TeleportTileX * 16, phase1TeleportTileY * 16), 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height))) + { + npc.ai[0] = 1f; + npc.ai[1] = phase1TeleportTileX; + npc.ai[2] = phase1TeleportTileY; + npc.netUpdate = true; + break; + } + } + while (phase1TeleportTries <= maxTeleportTries); + } + } + } + + // Turn invisible and teleport + else if (npc.ai[0] == 1f) + { + // Avoid cheap bullshit + npc.damage = 0; + + npc.alpha += 25; + if (npc.alpha >= 255) + { + SoundEngine.PlaySound(SoundID.Item8, npc.Center); + npc.alpha = 255; + npc.position.X = npc.ai[1] * 16f - (npc.width / 2); + npc.position.Y = npc.ai[2] * 16f - (npc.height / 2); + npc.ai[0] = 2f; + + // Move non-charging Creepers to new Brain location + for (int i = 0; i < Main.maxNPCs; i++) + { + NPC creeper = Main.npc[i]; + if (creeper.active && creeper.type == NPCID.Creeper) + { + bool creeperCanTeleport = creeper.ai[0] == 0f; + if (creeperCanTeleport) + { + creeper.position.X = npc.position.X; + creeper.position.Y = npc.position.Y; + } + } + } + } + } + + // Become visible + else if (npc.ai[0] == 2f) + { + // Avoid cheap bullshit + npc.damage = 0; + + npc.alpha -= 25; + if (npc.alpha <= 0) + { + npc.alpha = 0; + npc.ai[0] = 0f; + } + } + } + + return false; + } + + public static bool BuffedCreeperAI(NPC npc, Mod mod) + { + // Despawn if Brain is gone + if (NPC.crimsonBoss < 0) + { + npc.active = false; + npc.netUpdate = true; + return false; + } + + bool bossRush = BossRushEvent.BossRushActive; + bool masterMode = Main.masterMode || bossRush; + bool death = CalamityWorld.death || bossRush; + + // Get a target + if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) + npc.TargetClosest(); + + float enrageScale = bossRush ? 1.5f : masterMode ? 0.5f : 0f; + if ((npc.position.Y / 16f) < Main.worldSurface || bossRush) + enrageScale += 0.5f; + if (!Main.player[npc.target].ZoneCrimson || bossRush) + enrageScale += 2f; + + bool brainIsNotTeleportingOrCharging = Main.npc[NPC.crimsonBoss].ai[0] == 0f || Main.npc[NPC.crimsonBoss].ai[0] == -1f || Main.npc[NPC.crimsonBoss].ai[0] == -6f; + bool brainIsInPhase2 = Main.npc[NPC.crimsonBoss].ai[0] < 0f; + + // Creeper count + int creeperCount = NPC.CountNPCS(npc.type); + if (creeperCount > GetBrainOfCthuluCreepersCountRevDeath()) + creeperCount = GetBrainOfCthuluCreepersCountRevDeath(); + + float creeperRatio = 1f; + if (masterMode && brainIsInPhase2) + { + bool brainIsInPhase3 = Main.npc[NPC.crimsonBoss].localAI[0] == 2f; + bool brainIsInPhase5 = Main.npc[NPC.crimsonBoss].localAI[0] == 3f; + bool brainIsInPhase7 = Main.npc[NPC.crimsonBoss].localAI[0] == 4f; + float creeperAmountScalar = (float)(GetBrainOfCthuluCreepersCountRevDeath() / 4); + creeperRatio = creeperCount / (creeperAmountScalar * (Main.npc[NPC.crimsonBoss].localAI[0] - 1f)); + } + else + creeperRatio = creeperCount / (float)GetBrainOfCthuluCreepersCountRevDeath(); + + // Scale the aggressiveness of the charges with amount of Creepers remaining + float chargeAggressionScale = creeperRatio <= 0.1f ? 3.5f : creeperRatio <= 0.2f ? 2.5f : creeperRatio <= 0.4f ? 1.75f : creeperRatio <= 0.6f ? 1f : creeperRatio <= 0.8f ? 0.5f : 0f; + if (death) + chargeAggressionScale *= 1.25f; + + // Give off blood dust before charging + float beginTelegraphGateValue = TimeBeforeCreeperAttack - CreeperTelegraphTime; + bool showTelegraph = npc.ai[1] >= beginTelegraphGateValue || npc.ai[0] == 1f; + if (showTelegraph) + { + float dustScalar = npc.ai[0] == 1f ? 1f : MathHelper.Clamp((npc.ai[1] - beginTelegraphGateValue) / CreeperTelegraphTime, 0f, 1f); + int dustAmt = 1 + (int)Math.Round(4 * dustScalar); + Color dustColor = new Color(255, 50, 50, 0) * dustScalar; + for (int i = 0; i < dustAmt; i++) + { + Dust dust = Main.dust[Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, npc.velocity.X, npc.velocity.Y, 100, dustColor)]; + dust.noGravity = true; + dust.velocity = Vector2.Zero; + dust.scale = 1.2f; + } + } + + // Stay near Brain + if (npc.ai[0] == 0f) + { + // Avoid cheap bullshit + npc.damage = 0; + + Vector2 creeperCenter = npc.Center; + float brainXDist = Main.npc[NPC.crimsonBoss].Center.X - creeperCenter.X; + float brainYDist = Main.npc[NPC.crimsonBoss].Center.Y - creeperCenter.Y; + float brainDistance = (float)Math.Sqrt(brainXDist * brainXDist + brainYDist * brainYDist); + float velocity = (death ? (masterMode ? 16f : 12f) : (masterMode ? 12f : 8f)) + chargeAggressionScale; + velocity += 2f * enrageScale; + if (brainIsInPhase2) + { + float velocityFloor = Main.npc[NPC.crimsonBoss].velocity.Length() + velocity * 0.5f; + if (velocity < velocityFloor) + velocity = velocityFloor; + } + + float maxDistanceFromBrain = 90f; + if (brainDistance > maxDistanceFromBrain) + { + brainDistance = velocity / brainDistance; + brainXDist *= brainDistance; + brainYDist *= brainDistance; + float inertia = brainIsInPhase2 ? 5f : 15f; + npc.velocity.X = (npc.velocity.X * inertia + brainXDist) / (inertia + 1f); + npc.velocity.Y = (npc.velocity.Y * inertia + brainYDist) / (inertia + 1f); + } + + // Increase speed + if (npc.velocity.Length() < velocity) + npc.velocity *= 1.05f; + + // Set alpha to brain alpha + npc.alpha = Main.npc[NPC.crimsonBoss].alpha; + + // Only increment the attack timer if the brain isn't teleporting + if (brainIsNotTeleportingOrCharging) + npc.ai[1] += (brainIsInPhase2 ? 2f : 1f) + chargeAggressionScale; + + // Charge at target + if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[1] >= TimeBeforeCreeperAttack) + { + npc.ai[1] = 0f; + npc.TargetClosest(); + creeperCenter = npc.Center; + brainXDist = Main.player[npc.target].Center.X - creeperCenter.X; + brainYDist = Main.player[npc.target].Center.Y - creeperCenter.Y; + brainDistance = (float)Math.Sqrt(brainXDist * brainXDist + brainYDist * brainYDist); + brainDistance = velocity / brainDistance; + npc.velocity.X = brainXDist * brainDistance; + npc.velocity.Y = brainYDist * brainDistance; + npc.ai[0] = 1f; + npc.netUpdate = true; + } + } + + // Charge + else + { + // Always fully visible while charging + npc.alpha = 0; + + float chargeVelocity = (death ? (masterMode ? 12f : 9f) : (masterMode ? 9f : 6f)) + chargeAggressionScale; + chargeVelocity += 2f * enrageScale; + float returnToBrainGateValue = 1f; + if (!brainIsInPhase2) + { + // Set damage + npc.damage = npc.defDamage; + + Vector2 destination = Main.player[npc.target].Center + (masterMode ? Main.player[npc.target].velocity * 20f : Vector2.Zero); + Vector2 targetDirection = destination - npc.Center; + targetDirection = targetDirection.SafeNormalize(Vector2.UnitY); + if (Main.getGoodWorld) + { + targetDirection *= chargeVelocity + 6f; + npc.velocity = (npc.velocity * 49f + targetDirection) / 50f; + } + else + { + targetDirection *= chargeVelocity; + float inertia = masterMode ? 75f : 100f; + npc.velocity = (npc.velocity * (inertia - 1f) + targetDirection) / inertia; + } + + // Return to Brain after a set time + float chargeDistance = masterMode ? 900f : 600f; + returnToBrainGateValue = chargeDistance / chargeVelocity; + } + + npc.ai[1] += 1f; + if (npc.ai[1] >= returnToBrainGateValue || brainIsInPhase2) + { + // Avoid cheap bullshit + npc.damage = 0; + + // Shoot blood shots + if (Vector2.Distance(npc.Center, Main.player[npc.target].Center) > 160f && npc.ai[2] == 0f) + { + bool canHit = Collision.CanHitLine(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1); + Vector2 projectileVelocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * chargeVelocity; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int projectileType = ProjectileID.BloodShot; + int damage = npc.GetProjectileDamage(projectileType); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, projectileVelocity, projectileType, damage, 0f, Main.myPlayer); + Main.projectile[proj].timeLeft = 600; + if (!canHit) + Main.projectile[proj].tileCollide = false; + } + npc.ai[2] = 1f; + } + + if (brainIsNotTeleportingOrCharging) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.netUpdate = true; + } + } + } + + return false; + } + + public static bool VanillaBrainofCthulhuAI(NPC npc, Mod mod) + { + NPC.crimsonBoss = npc.whoAmI; + if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] == 0f) + { + npc.localAI[0] = 1f; + int brainOfCthuluCreepersCount = GetBrainOfCthuluCreepersCountVanilla(); + for (int num837 = 0; num837 < brainOfCthuluCreepersCount; num837++) + { + float x2 = npc.Center.X; + float y4 = npc.Center.Y; + x2 += (float)Main.rand.Next(-npc.width, npc.width); + y4 += (float)Main.rand.Next(-npc.height, npc.height); + int num838 = NPC.NewNPC(npc.GetSource_FromAI(), (int)x2, (int)y4, NPCID.Creeper); + Main.npc[num838].velocity = new Vector2((float)Main.rand.Next(-30, 31) * 0.1f, (float)Main.rand.Next(-30, 31) * 0.1f); + Main.npc[num838].netUpdate = true; + } + } + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.TargetClosest(); + int num839 = 6000; + if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) + Math.Abs(npc.Center.Y - Main.player[npc.target].Center.Y) > (float)num839) + { + npc.active = false; + npc.life = 0; + if (Main.netMode == NetmodeID.Server) + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, npc.whoAmI); + } + } + + if (npc.ai[0] < 0f) + { + // Set damage + npc.damage = npc.defDamage; + + if (Main.getGoodWorld) + NPC.brainOfGravity = npc.whoAmI; + + if (npc.localAI[2] == 0f) + { + SoundEngine.PlaySound(SoundID.NPCHit1, npc.Center); + npc.localAI[2] = 1f; + Gore.NewGore(npc.GetSource_FromAI(), npc.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 392); + Gore.NewGore(npc.GetSource_FromAI(), npc.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 393); + Gore.NewGore(npc.GetSource_FromAI(), npc.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 394); + Gore.NewGore(npc.GetSource_FromAI(), npc.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 395); + for (int num840 = 0; num840 < 20; num840++) + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, (float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f); + + SoundEngine.PlaySound(SoundID.ForceRoar, npc.Center); + } + + npc.dontTakeDamage = false; + npc.TargetClosest(); + Vector2 vector104 = npc.Center; + float num841 = Main.player[npc.target].Center.X - vector104.X; + float num842 = Main.player[npc.target].Center.Y - vector104.Y; + float num843 = (float)Math.Sqrt(num841 * num841 + num842 * num842); + float num844 = Main.masterMode ? 12f : 8f; + num843 = num844 / num843; + num841 *= num843; + num842 *= num843; + float inertia = Main.masterMode ? 40f : 50f; + npc.velocity.X = (npc.velocity.X * inertia + num841) / (inertia + 1f); + npc.velocity.Y = (npc.velocity.Y * inertia + num842) / (inertia + 1f); + if (npc.ai[0] == -1f) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.localAI[1] += 1f; + if (npc.justHit) + npc.localAI[1] -= Main.rand.Next(Main.masterMode ? 3 : 5); + + int num845 = 60 + Main.rand.Next(Main.masterMode ? 60 : 120); + if (Main.netMode != NetmodeID.SinglePlayer) + num845 += Main.rand.Next(Main.masterMode ? 15 : 30, Main.masterMode ? 45 : 90); + + if (npc.localAI[1] >= (float)num845) + { + npc.localAI[1] = 0f; + npc.TargetClosest(); + int num846 = 0; + Player player2 = Main.player[npc.target]; + do + { + num846++; + int num847 = (int)player2.Center.X / 16; + int num848 = (int)player2.Center.Y / 16; + int minValue = 10; + int num849 = 12; + float num850 = 16f; + int num851 = Main.rand.Next(minValue, num849 + 1); + int num852 = Main.rand.Next(minValue, num849 + 1); + if (Main.rand.NextBool()) + num851 *= -1; + + if (Main.rand.NextBool()) + num852 *= -1; + + Vector2 v = new Vector2(num851 * 16, num852 * 16); + if (Vector2.Dot(player2.velocity.SafeNormalize(Vector2.UnitY), v.SafeNormalize(Vector2.UnitY)) > 0f) + v += v.SafeNormalize(Vector2.Zero) * num850 * player2.velocity.Length(); + + num847 += (int)(v.X / 16f); + num848 += (int)(v.Y / 16f); + if (num846 > 100 || !WorldGen.SolidTile(num847, num848)) + { + // Avoid cheap bullshit + npc.damage = 0; + + npc.ai[3] = 0f; + npc.ai[0] = -2f; + npc.ai[1] = num847; + npc.ai[2] = num848; + npc.netUpdate = true; + npc.netSpam = 0; + break; + } + } + while (num846 <= 100); + } + } + } + else if (npc.ai[0] == -2f) + { + // Avoid cheap bullshit + npc.damage = 0; + + npc.velocity *= 0.9f; + if (Main.netMode != NetmodeID.SinglePlayer) + npc.ai[3] += 15f; + else + npc.ai[3] += 25f; + + if (npc.ai[3] >= 255f) + { + npc.ai[3] = 255f; + npc.position.X = npc.ai[1] * 16f - (float)(npc.width / 2); + npc.position.Y = npc.ai[2] * 16f - (float)(npc.height / 2); + SoundEngine.PlaySound(SoundID.Item8, npc.Center); + npc.ai[0] = -3f; + npc.netUpdate = true; + npc.netSpam = 0; + } + + npc.alpha = (int)npc.ai[3]; + } + else if (npc.ai[0] == -3f) + { + // Avoid cheap bullshit + npc.damage = 0; + + if (Main.netMode != NetmodeID.SinglePlayer) + npc.ai[3] -= 15f; + else + npc.ai[3] -= 25f; + + if (npc.ai[3] <= 0f) + { + npc.ai[3] = 0f; + npc.ai[0] = -1f; + npc.netUpdate = true; + npc.netSpam = 0; + } + + npc.alpha = (int)npc.ai[3]; + } + } + else + { + // Avoid cheap bullshit + npc.damage = 0; + + npc.TargetClosest(); + Vector2 vector105 = npc.Center; + float num853 = Main.player[npc.target].Center.X - vector105.X; + float num854 = Main.player[npc.target].Center.Y - vector105.Y; + float num855 = (float)Math.Sqrt(num853 * num853 + num854 * num854); + float num856 = Main.masterMode ? 2.5f : 1.5f; + if (Main.getGoodWorld) + num856 *= 3f; + + if (num855 < num856) + { + npc.velocity.X = num853; + npc.velocity.Y = num854; + } + else + { + num855 = num856 / num855; + npc.velocity.X = num853 * num855; + npc.velocity.Y = num854 * num855; + } + + if (npc.ai[0] == 0f) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int num857 = 0; + for (int num858 = 0; num858 < Main.maxNPCs; num858++) + { + if (Main.npc[num858].active && Main.npc[num858].type == NPCID.Creeper) + num857++; + } + + if (num857 == 0) + { + npc.ai[0] = -1f; + npc.localAI[1] = 0f; + npc.alpha = 0; + npc.netUpdate = true; + } + + npc.localAI[1] += 1f; + if (npc.localAI[1] >= (float)(120 + Main.rand.Next(Main.masterMode ? 150 : 300))) + { + npc.localAI[1] = 0f; + npc.TargetClosest(); + int num859 = 0; + Player player3 = Main.player[npc.target]; + do + { + num859++; + int num860 = (int)player3.Center.X / 16; + int num861 = (int)player3.Center.Y / 16; + int minValue2 = 12; + int num862 = 40; + float num863 = 16f; + int num864 = Main.rand.Next(minValue2, num862 + 1); + int num865 = Main.rand.Next(minValue2, num862 + 1); + if (Main.rand.NextBool()) + num864 *= -1; + + if (Main.rand.NextBool()) + num865 *= -1; + + Vector2 v2 = new Vector2(num864 * 16, num865 * 16); + if (Vector2.Dot(player3.velocity.SafeNormalize(Vector2.UnitY), v2.SafeNormalize(Vector2.UnitY)) > 0f) + v2 += v2.SafeNormalize(Vector2.Zero) * num863 * player3.velocity.Length(); + + num860 += (int)(v2.X / 16f); + num861 += (int)(v2.Y / 16f); + if (num859 > 100 || (!WorldGen.SolidTile(num860, num861) && (num859 > 75 || Collision.CanHit(new Vector2(num860 * 16, num861 * 16), 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)))) + { + npc.ai[0] = 1f; + npc.ai[1] = num860; + npc.ai[2] = num861; + npc.netUpdate = true; + break; + } + } + while (num859 <= 100); + } + } + } + else if (npc.ai[0] == 1f) + { + npc.alpha += 5; + if (npc.alpha >= 255) + { + SoundEngine.PlaySound(SoundID.Item8, npc.Center); + npc.alpha = 255; + npc.position.X = npc.ai[1] * 16f - (float)(npc.width / 2); + npc.position.Y = npc.ai[2] * 16f - (float)(npc.height / 2); + npc.ai[0] = 2f; + } + } + else if (npc.ai[0] == 2f) + { + npc.alpha -= 5; + if (npc.alpha <= 0) + { + npc.alpha = 0; + npc.ai[0] = 0f; + } + } + } + + if (Main.player[npc.target].dead || !Main.player[npc.target].ZoneCrimson) + { + if (npc.localAI[3] < 120f) + npc.localAI[3]++; + + if (npc.localAI[3] > 60f) + npc.velocity.Y += (npc.localAI[3] - 60f) * 0.25f; + + npc.ai[0] = 2f; + npc.alpha = 10; + } + else if (npc.localAI[3] > 0f) + npc.localAI[3]--; + + return false; + } + + public static bool VanillaCreeperAI(NPC npc, Mod mod) + { + if (NPC.crimsonBoss < 0) + { + npc.active = false; + npc.netUpdate = true; + return false; + } + + if (Main.masterMode) + npc.knockBackResist = 0f; + + if (npc.ai[0] == 0f) + { + // Avoid cheap bullshit + npc.damage = 0; + + npc.ai[1] = 0f; + float maxVelocity = Main.masterMode ? 10f : 8f; + Vector2 vector106 = npc.Center; + float num866 = Main.npc[NPC.crimsonBoss].Center.X - vector106.X; + float num867 = Main.npc[NPC.crimsonBoss].Center.Y - vector106.Y; + float num868 = (float)Math.Sqrt(num866 * num866 + num867 * num867); + if (num868 > 90f) + { + num868 = maxVelocity / num868; + num866 *= num868; + num867 *= num868; + npc.velocity.X = (npc.velocity.X * 15f + num866) / 16f; + npc.velocity.Y = (npc.velocity.Y * 15f + num867) / 16f; + return false; + } + + if (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) < maxVelocity) + { + float velocityMult = Main.masterMode ? 1.07f : 1.05f; + npc.velocity.Y *= velocityMult; + npc.velocity.X *= velocityMult; + } + + if (Main.netMode != NetmodeID.MultiplayerClient && ((Main.expertMode && Main.rand.NextBool(Main.masterMode ? 50 : 100)) || Main.rand.NextBool(200))) + { + npc.TargetClosest(); + vector106 = npc.Center; + num866 = Main.player[npc.target].Center.X - vector106.X; + num867 = Main.player[npc.target].Center.Y - vector106.Y; + num868 = (float)Math.Sqrt(num866 * num866 + num867 * num867); + num868 = maxVelocity / num868; + npc.velocity.X = num866 * num868; + npc.velocity.Y = num867 * num868; + npc.ai[0] = 1f; + npc.netUpdate = true; + } + + return false; + } + + // Set damage + npc.damage = npc.defDamage; + + if (Main.expertMode) + { + Vector2 vector107 = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY); + if (Main.getGoodWorld) + { + vector107 *= 12f; + npc.velocity = (npc.velocity * 49f + vector107) / 50f; + } + else + { + float chargeVelocity = Main.masterMode ? 10f : 9f; + vector107 *= chargeVelocity; + float inertia = Main.masterMode ? 75f : 100f; + npc.velocity = (npc.velocity * (inertia - 1f) + vector107) / inertia; + } + } + + Vector2 vector108 = npc.Center; + float num869 = Main.npc[NPC.crimsonBoss].Center.X - vector108.X; + float num870 = Main.npc[NPC.crimsonBoss].Center.Y - vector108.Y; + float num871 = (float)Math.Sqrt(num869 * num869 + num870 * num870); + if (num871 > 700f) + { + npc.ai[0] = 0f; + } + else + { + if (!npc.justHit) + return false; + + if (npc.knockBackResist == 0f) + { + npc.ai[1] += 1f; + float returnToBrainGateValue = Main.masterMode ? 35f : 5f; + if (npc.ai[1] > returnToBrainGateValue) + { + // Avoid cheap bullshit + npc.damage = 0; + + npc.ai[0] = 0f; + } + } + else + { + // Avoid cheap bullshit + npc.damage = 0; + + npc.ai[0] = 0f; + } + } + + return false; + } + + public static int GetBrainOfCthuluCreepersCountRevDeath() + { + return CalamityWorld.LegendaryMode ? 40 : Main.getGoodWorld ? 35 : (CalamityWorld.death || BossRushEvent.BossRushActive) ? 30 : 20; + } + + public static int GetBrainOfCthuluCreepersCountVanilla() + { + return Main.getGoodWorld ? 40 : Main.masterMode ? 30 : 20; + } + + private static float GetCrimsonBossKnockBack(NPC npc, int numPlayers, float lifeScale, float baseKnockBackResist) + { + float balance = 1f; + float boost = 0.35f; + + for (int i = 1; i < numPlayers; i++) + { + balance += boost; + boost += (1f - boost) / 3f; + } + + if (balance > 8f) + balance = (balance * 2f + 8f) / 3f; + if (balance > 1000f) + balance = 1000f; + + float KBResist = baseKnockBackResist * lifeScale; + float KBResistMultiplier = 1f - baseKnockBackResist * 0.4f; + for (float num = 1f; num < balance; num += 0.34f) + { + if (KBResist < 0.05) + { + KBResist = 0f; + break; + } + KBResist *= KBResistMultiplier; + } + + return KBResist; + } + } +} diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/CultistAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/CultistAI.cs new file mode 100644 index 0000000000..cc7f023757 --- /dev/null +++ b/NPCs/VanillaNPCAIOverrides/Bosses/CultistAI.cs @@ -0,0 +1,2400 @@ +using System; +using System.Collections.Generic; +using CalamityMod.Events; +using CalamityMod.NPCs.PrimordialWyrm; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses +{ + public static class CultistAI + { + public static bool BuffedCultistAI(NPC npc, Mod mod) + { + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + + // Chant sound + if (npc.ai[0] != -1f && Main.rand.NextBool(1000)) + { + SoundStyle chantSound = Utils.SelectRandom(Main.rand, new SoundStyle[] + { + SoundID.Zombie88, + SoundID.Zombie89, + SoundID.Zombie90, + SoundID.Zombie91 + }); + + SoundEngine.PlaySound(chantSound, npc.Center); + } + + // Percent life remaining + float lifeRatio = npc.life / (float)npc.lifeMax; + + // Phases + bool bossRush = BossRushEvent.BossRushActive; + bool masterMode = Main.masterMode || bossRush; + bool death = CalamityWorld.death || bossRush; + bool phase2 = lifeRatio < 0.85f || masterMode; + bool phase3 = lifeRatio < 0.7f || masterMode; + bool phase4 = lifeRatio < (masterMode ? 0.8f : 0.55f); + bool phase5 = lifeRatio < (masterMode ? 0.6f : 0.4f); + bool phase6 = lifeRatio < (masterMode ? 0.4f : 0.25f); + bool phase7 = masterMode && lifeRatio < 0.2f; + bool phase8 = masterMode && lifeRatio < 0.1f; + + // Variables + bool isCultist = npc.type == NPCID.CultistBoss; + bool dontTakeDamage = false; + + float predictionDistance = 480f; + float distanceAboveTarget = -240f; + float moveSpeed = masterMode ? (death ? 300f : 150f) : (death ? 100f : 75f); + + int iceMistDamage = isCultist ? npc.GetProjectileDamage(ProjectileID.CultistBossIceMist) : 0; + int fireballDamage = isCultist ? npc.GetProjectileDamage(ProjectileID.CultistBossFireBall) : npc.GetProjectileDamage(ProjectileID.CultistBossFireBallClone); + int lightningDamage = isCultist ? npc.GetProjectileDamage(ProjectileID.CultistBossLightningOrb) : 0; + + int iceMistFireRate = phase2 ? 50 : 60; + float iceMistSpeed = (phase6 ? 12f : 10f) + (death ? (1f - lifeRatio) : 0f); + int iceMistAmt = phase3 ? 2 : 1; + int fireballFireRate = (phase5 ? 10 : 12) - (masterMode ? 6 : 0); + float fireballSpeed = ((phase7 ? 8f : phase6 ? 7f : 6f) + (death ? (1f - lifeRatio) : 0f)) * (isCultist ? 1f : 0.5f); + int fireballAmt = masterMode ? 20 : 4; + int lightningOrbPhaseTime = phase2 ? 90 : 120; + int ancientLightSpawnRate = phase7 ? 20 : phase4 ? 25 : 30; + int ancientLightAmt = phase7 ? 4 : phase4 ? 3 : 2; + int ancientDoomLimit = 10; + int idleTime = phase8 ? 20 : phase7 ? 30 : phase3 ? 35 : 40; + float timeToFinishRitual = phase8 ? 180f : phase7 ? 240f : phase5 ? 300f : 360f; + + if (bossRush) + { + iceMistFireRate = 40; + iceMistSpeed = 14f; + iceMistAmt = 3; + fireballFireRate = 8; + fireballSpeed *= 1.2f; + lightningOrbPhaseTime = 90; + ancientLightSpawnRate = 20; + ancientLightAmt = 4; + idleTime = 20; + } + + if (Main.getGoodWorld) + { + iceMistFireRate = 30; + iceMistSpeed = 15f; + fireballFireRate = 6; + fireballSpeed *= 1.25f; + lightningOrbPhaseTime = 60; + ancientLightSpawnRate = 10; + ancientLightAmt = 5; + idleTime = 20; + } + + // Get a target + if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) + npc.TargetClosest(false); + + // Center and target + Player player = Main.player[npc.target]; + if (npc.target < 0 || npc.target == Main.maxPlayers || player.dead || !player.active) + { + npc.TargetClosest(false); + player = Main.player[npc.target]; + npc.netUpdate = true; + } + + // Despawn safety, make sure to target another player if the current player target is too far away + if (Vector2.Distance(player.Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) + npc.TargetClosest(false); + + // Enrage + if (!Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height) || CalamityWorld.LegendaryMode) + { + calamityGlobalNPC.newAI[0] += 1f; + if (calamityGlobalNPC.newAI[0] >= 120f) + { + calamityGlobalNPC.newAI[0] = 120f; + iceMistSpeed = 16f; + iceMistFireRate = 15; + lightningOrbPhaseTime = 30; + ancientLightSpawnRate = 5; + idleTime = 10; + timeToFinishRitual = 120f; + } + } + else + { + if (calamityGlobalNPC.newAI[0] > 0f) + calamityGlobalNPC.newAI[0] -= 1f; + } + + // Cultist clone AI + if (!isCultist) + { + if (npc.ai[3] < 0f || !Main.npc[(int)npc.ai[3]].active || Main.npc[(int)npc.ai[3]].type != NPCID.CultistBoss) + { + npc.life = 0; + npc.HitEffect(0, 10.0); + npc.active = false; + return false; + } + + npc.ai[0] = Main.npc[(int)npc.ai[3]].ai[0]; + npc.ai[1] = Main.npc[(int)npc.ai[3]].ai[1]; + dontTakeDamage = true; + } + + // Stop spawning ritual if hit + else if (npc.ai[0] == 5f && npc.ai[1] >= 120f && npc.ai[1] < timeToFinishRitual && npc.justHit) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[3] += 1f; + npc.velocity = Vector2.Zero; + npc.netUpdate = true; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (!NPC.AnyNPCs(NPCID.AncientCultistSquidhead)) + NPC.NewNPC(npc.GetSource_FromAI(), (int)Main.projectile[(int)npc.ai[2]].Center.X, (int)Main.projectile[(int)npc.ai[2]].Center.Y, NPCID.AncientCultistSquidhead); + } + + Main.projectile[(int)npc.ai[2]].ai[1] = -1f; + Main.projectile[(int)npc.ai[2]].netUpdate = true; + } + + // Despawn + if (player.dead || Vector2.Distance(player.Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance350Tiles) + { + npc.life = 0; + npc.HitEffect(0, 10.0); + npc.active = false; + + if (Main.netMode != NetmodeID.MultiplayerClient) + NetMessage.SendData(MessageID.DamageNPC, -1, -1, null, npc.whoAmI, -1f); + + for (int j = 0; j < Main.maxNPCs; j++) + { + if (Main.npc[j].active && Main.npc[j].type == NPCID.CultistBossClone && Main.npc[j].ai[3] == npc.whoAmI) + { + Main.npc[j].life = 0; + Main.npc[j].HitEffect(0, 10.0); + Main.npc[j].active = false; + + if (Main.netMode != NetmodeID.MultiplayerClient) + NetMessage.SendData(MessageID.DamageNPC, -1, -1, null, npc.whoAmI, -1f); + } + } + } + + // Clones set to Cultist phase + float clonePhase = npc.ai[3]; + + // Spawn and play sound + if (npc.localAI[0] == 0f) + { + SoundEngine.PlaySound(SoundID.Zombie89, npc.Center); + npc.localAI[0] = 1f; + npc.alpha = 255; + npc.rotation = 0f; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.ai[0] = -1f; + npc.netUpdate = true; + } + } + + // Appear and do weird ritual shit with tablet + if (npc.ai[0] == -1f) + { + npc.alpha -= 5; + if (npc.alpha < 0) + npc.alpha = 0; + + npc.ai[1] += 1f; + if (npc.ai[1] >= 420f) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.netUpdate = true; + } + else if (npc.ai[1] > 360f) + { + npc.velocity *= 0.95f; + + if (npc.localAI[2] != 13f) + SoundEngine.PlaySound(SoundID.Zombie105, npc.Center); + + npc.localAI[2] = 13f; + } + else if (npc.ai[1] > 300f) + { + npc.velocity = -Vector2.UnitY; + npc.localAI[2] = 10f; + } + else if (npc.ai[1] > 120f) + npc.localAI[2] = 1f; + else + npc.localAI[2] = 0f; + + dontTakeDamage = true; + } + + // Phase switch + if (npc.ai[0] == 0f) + { + if (npc.ai[1] == 0f) + npc.TargetClosest(false); + + npc.localAI[2] = 10f; + + int facePlayerDirection = Math.Sign(player.Center.X - npc.Center.X); + if (facePlayerDirection != 0) + npc.direction = npc.spriteDirection = facePlayerDirection; + + npc.ai[1] += 1f; + if (npc.ai[1] >= idleTime & isCultist) + { + // Phase switch + int phase = 0; + switch ((int)npc.ai[3]) + { + // Move to target + case 0: + case 2: + case 4: + case 6: + case 8: + case 10: + case 12: + case 14: + case 16: + case 18: + case 20: + phase = 0; + break; + + // Fireball + case 1: + case 15: + phase = 1; + break; + + // Ancient Light + case 3: + case 11: + phase = 5; + break; + + // Lightning Orb + case 5: + case 13: + phase = 3; + break; + + // Ice Mist + case 7: + case 17: + phase = 2; + break; + + // Ancient Doom + case 9: + case 19: + // Pick a different random phase if too many Ancient Dooms are active + int[] attackPhases = new int[4] { 1, 2, 3, 5 }; + phase = NPC.CountNPCS(NPCID.AncientDoom) < ancientDoomLimit ? 6 : attackPhases[Main.rand.Next(attackPhases.Length)]; + break; + + // Dragon Summon + case 21: + phase = 4; + npc.ai[3] = -1f; + break; + + default: + npc.ai[3] = -1f; + break; + } + + // Set AI phase + switch (phase) + { + // Movement + case 0: + // Set a location to move to + Vector2 predictionVector = new Vector2(0f + player.velocity.SafeNormalize(Vector2.Zero).X * predictionDistance, distanceAboveTarget); + float moveDistance = (float)Math.Ceiling((player.Center + predictionVector - npc.Center).Length() / moveSpeed); + if (moveDistance == 0f) + moveDistance = 1f; + + // Add self and clones to list + List list2 = new List(); + int cloneAmt = 0; + list2.Add(npc.whoAmI); + for (int k = 0; k < Main.maxNPCs; k++) + { + if (Main.npc[k].active && Main.npc[k].type == NPCID.CultistBossClone && Main.npc[k].ai[3] == npc.whoAmI) + list2.Add(k); + } + + // Move self and clones to location + bool cloneAmtIsEven = list2.Count % 2 == 0; + foreach (int current2 in list2) + { + NPC nPC2 = Main.npc[current2]; + Vector2 center2 = nPC2.Center; + float cloneOffset = (cloneAmt + cloneAmtIsEven.ToInt() + 1) / 2 * MathHelper.TwoPi * 0.4f / list2.Count; + if (cloneAmt % 2 == 1) + cloneOffset *= -1f; + if (list2.Count == 1) + cloneOffset = 0f; + + Vector2 cloneRotation = new Vector2(0f, -1f).RotatedBy(cloneOffset) * new Vector2(150f, 200f); + Vector2 finalClonePos = player.Center + (Vector2.UnitX * predictionVector.X) + cloneRotation - center2; + nPC2.ai[0] = 1f; + nPC2.ai[1] = moveDistance; + nPC2.velocity = finalClonePos / moveDistance * 2f; + if (npc.whoAmI >= nPC2.whoAmI) + nPC2.position -= nPC2.velocity; + + nPC2.netUpdate = true; + cloneAmt++; + } + break; + + // Fireball + case 1: + npc.ai[0] = 3f; + npc.ai[1] = 0f; + break; + + // Ice Mist + case 2: + npc.ai[0] = 2f; + npc.ai[1] = 0f; + break; + + // Lightning Orb + case 3: + npc.ai[0] = 4f; + npc.ai[1] = 0f; + break; + + // Dragon Summon + case 4: + npc.ai[0] = 5f; + npc.ai[1] = 0f; + break; + + // Ancient Light + case 5: + npc.ai[0] = 7f; + npc.ai[1] = 0f; + break; + + // Ancient Doom + case 6: + npc.ai[0] = 8f; + npc.ai[1] = 0f; + break; + + default: + break; + } + + npc.netUpdate = true; + } + } + + // Movement, then switch to a different attack + else if (npc.ai[0] == 1f) + { + npc.localAI[2] = 10f; + + if (npc.ai[1] % 2f != 0f && npc.ai[1] != 1f) + npc.position -= npc.velocity; + + npc.ai[1] -= 1f; + if (npc.ai[1] <= 0f) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[3] += 1f; + npc.velocity = Vector2.Zero; + npc.netUpdate = true; + } + } + + // Ice Mist + else if (npc.ai[0] == 2f) + { + npc.localAI[2] = 11f; + + Vector2 vec = Vector2.Normalize(player.Center - npc.Center); + if (vec.HasNaNs()) + vec = new Vector2(npc.direction, 0f); + + if ((npc.ai[1] >= 4f & isCultist) && (int)(npc.ai[1] - 4f) % iceMistFireRate == 0) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + List list3 = new List(); + for (int l = 0; l < Main.maxNPCs; l++) + { + if (Main.npc[l].active && Main.npc[l].type == NPCID.CultistBossClone && Main.npc[l].ai[3] == npc.whoAmI) + list3.Add(l); + } + + foreach (int current3 in list3) + { + NPC nPC3 = Main.npc[current3]; + Vector2 center3 = nPC3.Center; + + int cloneFacePlayerDirection = Math.Sign(player.Center.X - center3.X); + if (cloneFacePlayerDirection != 0) + nPC3.direction = nPC3.spriteDirection = cloneFacePlayerDirection; + + vec = Vector2.Normalize(player.Center - center3); + if (vec.HasNaNs()) + vec = new Vector2(npc.direction, 0f); + + Vector2 shadowFireballDirection = center3 + new Vector2(npc.direction * 30, 12f); + Vector2 shadowFireballVelocity = vec * (fireballSpeed + (float)Main.rand.NextDouble()); + shadowFireballVelocity = shadowFireballVelocity.RotatedByRandom(Math.PI / 6D); + Projectile.NewProjectile(npc.GetSource_FromAI(), shadowFireballDirection, shadowFireballVelocity, ProjectileID.CultistBossFireBallClone, fireballDamage, 0f, Main.myPlayer); + } + } + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + vec = Vector2.Normalize(player.Center - npc.Center); + if (vec.HasNaNs()) + vec = new Vector2(npc.direction, 0f); + + Vector2 iceMistDirection = npc.Center + new Vector2(npc.direction * 30, 12f); + Vector2 iceMistVelocity = vec * iceMistSpeed; + Projectile.NewProjectile(npc.GetSource_FromAI(), iceMistDirection, iceMistVelocity, ProjectileID.CultistBossIceMist, iceMistDamage, 0f, Main.myPlayer, 0f, 1f); + } + } + + npc.ai[1] += 1f; + if (npc.ai[1] >= (4 + iceMistFireRate * iceMistAmt)) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[3] += 1f; + npc.velocity = Vector2.Zero; + npc.netUpdate = true; + } + } + + // Fireballs + else if (npc.ai[0] == 3f) + { + npc.localAI[2] = 11f; + + Vector2 playerDirection = Vector2.Normalize(player.Center - npc.Center); + if (playerDirection.HasNaNs()) + playerDirection = new Vector2(npc.direction, 0f); + + if ((npc.ai[1] >= 4f & isCultist) && (int)(npc.ai[1] - 4f) % fireballFireRate == 0) + { + if ((int)(npc.ai[1] - 4f) / fireballFireRate == 2) + { + List list4 = new List(); + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active && Main.npc[i].type == NPCID.CultistBossClone && Main.npc[i].ai[3] == npc.whoAmI) + list4.Add(i); + } + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + foreach (int current4 in list4) + { + NPC nPC4 = Main.npc[current4]; + Vector2 center4 = nPC4.Center; + + int cloneFireballFaceDirection = Math.Sign(player.Center.X - center4.X); + if (cloneFireballFaceDirection != 0) + nPC4.direction = nPC4.spriteDirection = cloneFireballFaceDirection; + + playerDirection = Vector2.Normalize(player.Center - center4); + if (playerDirection.HasNaNs()) + playerDirection = new Vector2(npc.direction, 0f); + + Vector2 shadowFireballDirection = center4 + new Vector2(npc.direction * 30, 12f); + Vector2 shadowFireballVelocity = playerDirection * (fireballSpeed + (float)Main.rand.NextDouble()); + shadowFireballVelocity = shadowFireballVelocity.RotatedByRandom(Math.PI / 6D); + Projectile.NewProjectile(npc.GetSource_FromAI(), shadowFireballDirection, shadowFireballVelocity, ProjectileID.CultistBossFireBallClone, fireballDamage, 0f, Main.myPlayer); + } + } + } + + int cultistFireballFaceDirection = Math.Sign(player.Center.X - npc.Center.X); + if (cultistFireballFaceDirection != 0) + npc.direction = npc.spriteDirection = cultistFireballFaceDirection; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + playerDirection = Vector2.Normalize(player.Center - npc.Center); + if (playerDirection.HasNaNs()) + playerDirection = new Vector2(npc.direction, 0f); + + Vector2 fireballDirection = npc.Center + new Vector2(npc.direction * 30, 12f); + Vector2 fireballVelocity = playerDirection * (fireballSpeed + (float)Main.rand.NextDouble() * 2f); + fireballVelocity = fireballVelocity.RotatedByRandom(Math.PI / 6D); + Projectile.NewProjectile(npc.GetSource_FromAI(), fireballDirection, fireballVelocity, ProjectileID.CultistBossFireBall, fireballDamage, 0f, Main.myPlayer); + } + } + + npc.ai[1] += 1f; + if (npc.ai[1] >= (4 + fireballFireRate * fireballAmt)) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[3] += 1f; + npc.velocity = Vector2.Zero; + npc.netUpdate = true; + } + } + + // Lightning Orb + else if (npc.ai[0] == 4f) + { + if (isCultist) + npc.localAI[2] = 12f; + else + npc.localAI[2] = 11f; + + if ((npc.ai[1] == 20f & isCultist) && Main.netMode != NetmodeID.MultiplayerClient) + { + List list5 = new List(); + for (int j = 0; j < Main.maxNPCs; j++) + { + if (Main.npc[j].active && Main.npc[j].type == NPCID.CultistBossClone && Main.npc[j].ai[3] == npc.whoAmI) + list5.Add(j); + } + + foreach (int current5 in list5) + { + NPC nPC5 = Main.npc[current5]; + Vector2 center5 = nPC5.Center; + + int clonePlayerFaceDirection = Math.Sign(player.Center.X - center5.X); + if (clonePlayerFaceDirection != 0) + nPC5.direction = nPC5.spriteDirection = clonePlayerFaceDirection; + + Vector2 playerDirection = Vector2.Normalize(player.Center - center5); + if (playerDirection.HasNaNs()) + playerDirection = new Vector2(npc.direction, 0f); + + Vector2 shadowFireballDirection = center5 + new Vector2(npc.direction * 30, 12f); + Vector2 shadowFireballVelocity = playerDirection * (fireballSpeed + (float)Main.rand.NextDouble()); + shadowFireballVelocity = shadowFireballVelocity.RotatedByRandom(Math.PI / 6D); + Projectile.NewProjectile(npc.GetSource_FromAI(), shadowFireballDirection, shadowFireballVelocity, ProjectileID.CultistBossFireBallClone, fireballDamage, 0f, Main.myPlayer); + } + + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X, npc.Center.Y + (masterMode ? 210f : -100f), 0f, 0f, ProjectileID.CultistBossLightningOrb, lightningDamage, 0f, Main.myPlayer); + if (masterMode) + { + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X + 210f, npc.Center.Y - 210f, 0f, 0f, ProjectileID.CultistBossLightningOrb, lightningDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X - 210f, npc.Center.Y - 210f, 0f, 0f, ProjectileID.CultistBossLightningOrb, lightningDamage, 0f, Main.myPlayer); + } + } + + npc.ai[1] += 1f; + if (npc.ai[1] >= (20 + lightningOrbPhaseTime)) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[3] += 1f; + npc.velocity = Vector2.Zero; + npc.netUpdate = true; + } + } + + // Spawn Clones, and Dragon or Cthulhu head + else if (npc.ai[0] == 5f) + { + npc.localAI[2] = 10f; + + if (Vector2.Normalize(player.Center - npc.Center).HasNaNs()) + new Vector2(npc.direction, 0f); + + if (npc.ai[1] >= 0f && npc.ai[1] < 30f) + { + dontTakeDamage = true; + float cultistAlphaControl = (npc.ai[1] - 0f) / 30f; + npc.alpha = (int)(cultistAlphaControl * 255f); + } + else if (npc.ai[1] >= 30f && npc.ai[1] < 90f) + { + if ((npc.ai[1] == 30f && Main.netMode != NetmodeID.MultiplayerClient) & isCultist) + { + npc.localAI[1] += 1f; + + Vector2 spinningpoint = new Vector2(180f, 0f); + + List list6 = new List(); + for (int k = 0; k < Main.maxNPCs; k++) + { + if (Main.npc[k].active && Main.npc[k].type == NPCID.CultistBossClone && Main.npc[k].ai[3] == npc.whoAmI) + list6.Add(k); + } + + int potentialExtraClones = 6 - list6.Count; + if (potentialExtraClones > 2) + potentialExtraClones = 2; + + int newCloneAmt = list6.Count + potentialExtraClones + 1; + float[] array = new float[newCloneAmt]; + for (int cloneInc = 0; cloneInc < array.Length; cloneInc++) + array[cloneInc] = Vector2.Distance(npc.Center + spinningpoint.RotatedBy(cloneInc * MathHelper.TwoPi / newCloneAmt - MathHelper.PiOver2), player.Center); + + int rotateDistance = 0; + for (int j = 1; j < array.Length; j++) + { + if (array[rotateDistance] > array[j]) + rotateDistance = j; + } + + if (rotateDistance < newCloneAmt / 2) + rotateDistance += newCloneAmt / 2; + else + rotateDistance -= newCloneAmt / 2; + + int clonesToSpawn = potentialExtraClones; + for (int k = 0; k < array.Length; k++) + { + if (rotateDistance != k) + { + Vector2 cloneRotation = npc.Center + spinningpoint.RotatedBy(k * MathHelper.TwoPi / newCloneAmt - MathHelper.PiOver2); + if (clonesToSpawn-- > 0) + { + int cloneSpawn = NPC.NewNPC(npc.GetSource_FromAI(), (int)cloneRotation.X, (int)cloneRotation.Y + npc.height / 2, NPCID.CultistBossClone, npc.whoAmI); + Main.npc[cloneSpawn].ai[3] = npc.whoAmI; + Main.npc[cloneSpawn].netUpdate = true; + Main.npc[cloneSpawn].localAI[1] = npc.localAI[1]; + } + else + { + int currentClone = list6[-clonesToSpawn - 1]; + Main.npc[currentClone].Center = cloneRotation; + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, currentClone); + } + } + } + + npc.ai[2] = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, Vector2.Zero, ProjectileID.CultistRitual, 0, 0f, Main.myPlayer, 0f, npc.whoAmI); + npc.Center += spinningpoint.RotatedBy(rotateDistance * MathHelper.TwoPi / newCloneAmt - MathHelper.PiOver2); + npc.netUpdate = true; + list6.Clear(); + } + + dontTakeDamage = true; + npc.alpha = 255; + + if (isCultist) + { + Vector2 ritualCenterDirection = Main.projectile[(int)npc.ai[2]].Center; + ritualCenterDirection -= npc.Center; + if (ritualCenterDirection == Vector2.Zero) + ritualCenterDirection = -Vector2.UnitY; + + ritualCenterDirection.Normalize(); + + if (Math.Abs(ritualCenterDirection.Y) < 0.77f) + npc.localAI[2] = 11f; + else if (ritualCenterDirection.Y < 0f) + npc.localAI[2] = 12f; + else + npc.localAI[2] = 10f; + + int ritualFaceDirection = Math.Sign(ritualCenterDirection.X); + if (ritualFaceDirection != 0) + npc.direction = npc.spriteDirection = ritualFaceDirection; + } + else + { + Vector2 ritualCenterFailDirection = Main.projectile[(int)Main.npc[(int)npc.ai[3]].ai[2]].Center; + ritualCenterFailDirection -= npc.Center; + if (ritualCenterFailDirection == Vector2.Zero) + ritualCenterFailDirection = -Vector2.UnitY; + + ritualCenterFailDirection.Normalize(); + + if (Math.Abs(ritualCenterFailDirection.Y) < 0.77f) + npc.localAI[2] = 11f; + else if (ritualCenterFailDirection.Y < 0f) + npc.localAI[2] = 12f; + else + npc.localAI[2] = 10f; + + int ritualFailFaceDirection = Math.Sign(ritualCenterFailDirection.X); + if (ritualFailFaceDirection != 0) + npc.direction = npc.spriteDirection = ritualFailFaceDirection; + } + } + else if (npc.ai[1] >= 90f && npc.ai[1] < 120f) + { + dontTakeDamage = true; + float ritualAlphaControl = (npc.ai[1] - 90f) / 30f; + npc.alpha = 255 - (int)(ritualAlphaControl * 255f); + } + else if (npc.ai[1] >= 120f && npc.ai[1] < timeToFinishRitual) + { + npc.alpha = 0; + + if (isCultist) + { + Vector2 ritualTimeAlmostUpCenterDirection = Main.projectile[(int)npc.ai[2]].Center; + ritualTimeAlmostUpCenterDirection -= npc.Center; + if (ritualTimeAlmostUpCenterDirection == Vector2.Zero) + ritualTimeAlmostUpCenterDirection = -Vector2.UnitY; + + ritualTimeAlmostUpCenterDirection.Normalize(); + + if (Math.Abs(ritualTimeAlmostUpCenterDirection.Y) < 0.77f) + npc.localAI[2] = 11f; + else if (ritualTimeAlmostUpCenterDirection.Y < 0f) + npc.localAI[2] = 12f; + else + npc.localAI[2] = 10f; + + int ritualTimeAlmostUpFaceDirection = Math.Sign(ritualTimeAlmostUpCenterDirection.X); + if (ritualTimeAlmostUpFaceDirection != 0) + npc.direction = npc.spriteDirection = ritualTimeAlmostUpFaceDirection; + } + else + { + Vector2 ritualTimeUpCenterDirection = Main.projectile[(int)Main.npc[(int)npc.ai[3]].ai[2]].Center; + ritualTimeUpCenterDirection -= npc.Center; + if (ritualTimeUpCenterDirection == Vector2.Zero) + ritualTimeUpCenterDirection = -Vector2.UnitY; + + ritualTimeUpCenterDirection.Normalize(); + + if (Math.Abs(ritualTimeUpCenterDirection.Y) < 0.77f) + npc.localAI[2] = 11f; + else if (ritualTimeUpCenterDirection.Y < 0f) + npc.localAI[2] = 12f; + else + npc.localAI[2] = 10f; + + int ritualTimeUpFaceDirection = Math.Sign(ritualTimeUpCenterDirection.X); + if (ritualTimeUpFaceDirection != 0) + npc.direction = npc.spriteDirection = ritualTimeUpFaceDirection; + } + } + + npc.ai[1] += 1f; + if (npc.ai[1] >= timeToFinishRitual) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[3] += 1f; + npc.velocity = Vector2.Zero; + npc.netUpdate = true; + } + } + + // Pause + else if (npc.ai[0] == 6f) + { + npc.localAI[2] = 13f; + + npc.ai[1] += 1f; + if (npc.ai[1] >= (idleTime * 3)) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[3] += 1f; + npc.velocity = Vector2.Zero; + npc.netUpdate = true; + } + } + + // Ancient Light + else if (npc.ai[0] == 7f) + { + npc.localAI[2] = 11f; + + Vector2 playerDirection = Vector2.Normalize(player.Center - npc.Center); + if (playerDirection.HasNaNs()) + playerDirection = new Vector2(npc.direction, 0f); + + if ((npc.ai[1] >= 4f & isCultist) && (int)(npc.ai[1] - 4f) % ancientLightSpawnRate == 0) + { + if ((int)(npc.ai[1] - 4f) / ancientLightSpawnRate == 2) + { + List list7 = new List(); + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active && Main.npc[i].type == NPCID.CultistBossClone && Main.npc[i].ai[3] == npc.whoAmI) + list7.Add(i); + } + + foreach (int current6 in list7) + { + NPC nPC6 = Main.npc[current6]; + Vector2 center6 = nPC6.Center; + + int cloneFaceDirection = Math.Sign(player.Center.X - center6.X); + if (cloneFaceDirection != 0) + nPC6.direction = nPC6.spriteDirection = cloneFaceDirection; + } + } + + int cultistFaceDirection = Math.Sign(player.Center.X - npc.Center.X); + if (cultistFaceDirection != 0) + npc.direction = npc.spriteDirection = cultistFaceDirection; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + playerDirection = Vector2.Normalize(player.Center - npc.Center); + if (playerDirection.HasNaNs()) + playerDirection = new Vector2(npc.direction, 0f); + + Vector2 ancientLightShootDirection = npc.Center + new Vector2(npc.direction * 30, 12f); + float scaleFactor = death ? 6f : 4f; + + float ancientLightSpread = MathHelper.ToRadians(15f); + int ancientLightInc = 0; + float totalAncientLights = 5f; + while (ancientLightInc < totalAncientLights) + { + Vector2 ancientLightSpeed = playerDirection * scaleFactor; + ancientLightSpeed = ancientLightSpeed.RotatedBy(ancientLightSpread * ancientLightInc - (MathHelper.Pi / totalAncientLights * 2f - ancientLightSpread) / 2f); + float ai = (Main.rand.NextFloat() - 0.5f) * 0.3f * MathHelper.TwoPi / 60f; + int ancientLightProj = NPC.NewNPC(npc.GetSource_FromAI(), (int)ancientLightShootDirection.X, (int)ancientLightShootDirection.Y + 7, NPCID.AncientLight, 0, 0f, ai, ancientLightSpeed.X, ancientLightSpeed.Y); + Main.npc[ancientLightProj].velocity = ancientLightSpeed; + ancientLightInc++; + } + } + } + + npc.ai[1] += 1f; + if (npc.ai[1] >= (4 + ancientLightSpawnRate * ancientLightAmt)) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[3] += 1f; + npc.velocity = Vector2.Zero; + npc.netUpdate = true; + } + } + + // Ancient Doom + else if (npc.ai[0] == 8f) + { + npc.localAI[2] = 13f; + + if ((npc.ai[1] >= 4f & isCultist) && (int)(npc.ai[1] - 4f) % 20f == 0f) + { + List list8 = new List(); + for (int k = 0; k < Main.maxNPCs; k++) + { + if (Main.npc[k].active && Main.npc[k].type == NPCID.CultistBossClone && Main.npc[k].ai[3] == npc.whoAmI) + list8.Add(k); + } + + int ancientDoomAmt = list8.Count + 1; + if (ancientDoomAmt > 2) + ancientDoomAmt = 2; + + int ancientDoomFaceDirection = Math.Sign(player.Center.X - npc.Center.X); + if (ancientDoomFaceDirection != 0) + npc.direction = npc.spriteDirection = ancientDoomFaceDirection; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (phase4) + { + // Spawn circle of Ancient Dooms around target + for (int i = 0; i < ancientDoomLimit; i++) + { + float ai2 = i * 120; + NPC.NewNPC(npc.GetSource_FromAI(), (int)(player.Center.X + (float)(Math.Sin(i * 120) * 550)), (int)(player.Center.Y + (float)(Math.Cos(i * 120) * 550)), + NPCID.AncientDoom, 0, npc.whoAmI, 0f, ai2, 0f, Main.maxPlayers); + } + } + else + { + // Spawn Ancient Dooms randomly around the target + for (int i = 0; i < ancientDoomAmt; i++) + { + Point cultistCenterTileCoords = npc.Center.ToTileCoordinates(); + Point targetCenterTileCoords = Main.player[npc.target].Center.ToTileCoordinates(); + Vector2 targetDistanceDoom = Main.player[npc.target].Center - npc.Center; + + int randSpawnOffset = 20; + int cultistCenterSpawnOffset = 3; + int targetCenterSpawnOffset = 7; + int tileCollisionRange = 2; + int spawnAttempts = 0; + bool doomSufficientlyFar = targetDistanceDoom.Length() > 2800f; + while (!doomSufficientlyFar && spawnAttempts < 100) + { + spawnAttempts++; + int ancientDoomSpawnX = Main.rand.Next(targetCenterTileCoords.X - randSpawnOffset, targetCenterTileCoords.X + randSpawnOffset + 1); + int ancientDoomSpawnY = Main.rand.Next(targetCenterTileCoords.Y - randSpawnOffset, targetCenterTileCoords.Y + randSpawnOffset + 1); + if ((ancientDoomSpawnY < targetCenterTileCoords.Y - targetCenterSpawnOffset || ancientDoomSpawnY > targetCenterTileCoords.Y + targetCenterSpawnOffset || ancientDoomSpawnX < targetCenterTileCoords.X - targetCenterSpawnOffset || ancientDoomSpawnX > targetCenterTileCoords.X + targetCenterSpawnOffset) && (ancientDoomSpawnY < cultistCenterTileCoords.Y - cultistCenterSpawnOffset || ancientDoomSpawnY > cultistCenterTileCoords.Y + cultistCenterSpawnOffset || ancientDoomSpawnX < cultistCenterTileCoords.X - cultistCenterSpawnOffset || ancientDoomSpawnX > cultistCenterTileCoords.X + cultistCenterSpawnOffset) && !Main.tile[ancientDoomSpawnX, ancientDoomSpawnY].HasUnactuatedTile) + { + bool notInsideTiles = true; + if (notInsideTiles && Collision.SolidTiles(ancientDoomSpawnX - tileCollisionRange, ancientDoomSpawnX + tileCollisionRange, ancientDoomSpawnY - tileCollisionRange, ancientDoomSpawnY + tileCollisionRange)) + notInsideTiles = false; + + if (notInsideTiles) + { + NPC.NewNPC(npc.GetSource_FromAI(), ancientDoomSpawnX * 16 + 8, ancientDoomSpawnY * 16 + 8, NPCID.AncientDoom, 0, npc.whoAmI); + break; + } + } + } + } + } + } + } + + npc.ai[1] += 1f; + if (npc.ai[1] >= 64f) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[3] += 1f; + npc.velocity = Vector2.Zero; + npc.netUpdate = true; + } + } + + // Set Clones to Cultist phase + if (!isCultist) + npc.ai[3] = clonePhase; + + // Take damage or not + npc.dontTakeDamage = dontTakeDamage; + npc.chaseable = npc.ai[0] != -1f && npc.ai[0] != 5f; + + return false; + } + + public static bool BuffedAncientLightAI(NPC npc, Mod mod) + { + npc.dontTakeDamage = true; + + // Slow and kill code + if (npc.ai[0] == -1f) + { + // Slow down over time + if (npc.velocity.Length() >= 0.2f) + { + npc.velocity *= 0.96f; + } + else + { + npc.velocity = Vector2.Zero; + npc.position = npc.oldPosition; + + // Kill after 4 seconds + npc.ai[1] += 1f; + if (npc.ai[1] >= 240f) + { + npc.HitEffect(0, 9999.0); + npc.active = false; + } + } + + return false; + } + + npc.rotation = npc.velocity.ToRotation() - MathHelper.PiOver2; + + // Set velocity and emit dust when spawned + if (npc.localAI[0] == 0f) + { + npc.localAI[0] = 1f; + npc.velocity.X = npc.ai[2]; + npc.velocity.Y = npc.ai[3]; + for (int i = 0; i < 13; i++) + { + int ancientLight = Dust.NewDust(npc.position, npc.width, npc.height, DustID.AncientLight, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f, 90, default, 2.5f); + Main.dust[ancientLight].noGravity = true; + Main.dust[ancientLight].fadeIn = 1f; + Dust dust = Main.dust[ancientLight]; + dust.velocity *= 4f; + Main.dust[ancientLight].noLight = true; + } + } + + // Spawn dust + for (int j = 0; j < 2; j++) + { + if (Main.rand.Next(10 - (int)Math.Min(7f, npc.velocity.Length())) < 1) + { + int ancientLight2 = Dust.NewDust(npc.position, npc.width, npc.height, DustID.AncientLight, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f, 90, default, 2.5f); + Main.dust[ancientLight2].noGravity = true; + Dust dust = Main.dust[ancientLight2]; + dust.velocity *= 0.2f; + Main.dust[ancientLight2].fadeIn = 0.4f; + if (Main.rand.NextBool(6)) + { + dust = Main.dust[ancientLight2]; + dust.velocity *= 5f; + Main.dust[ancientLight2].noLight = true; + } + else + Main.dust[ancientLight2].velocity = npc.DirectionFrom(Main.dust[ancientLight2].position) * Main.dust[ancientLight2].velocity.Length(); + } + } + + if (npc.ai[0] >= 0f) + { + // Triple damage if the Primordial Wyrm is alive + if (npc.ai[0] == 0f) + { + if (CalamityGlobalNPC.adultEidolonWyrmHead != -1) + { + if (Main.npc[CalamityGlobalNPC.adultEidolonWyrmHead].active) + npc.damage *= 3; + } + } + + npc.ai[0] += 1f; + + float duration = 120f; + + // Increase velocity for 1 second + if (npc.ai[0] < duration - 60f) + { + if (npc.velocity.Length() < 20f) + npc.velocity *= 1.03f; + } + + // Intersect velocity paths with other Ancient Lights for 1 second + if (npc.ai[0] >= duration - 60f) + npc.velocity = npc.velocity.RotatedBy(npc.ai[1]); + + // Engage slow code + if (npc.ai[0] >= duration) + npc.ai[0] = -1f; + } + + return false; + } + + public static bool BuffedAncientDoomAI(NPC npc, Mod mod) + { + bool bossRush = BossRushEvent.BossRushActive; + bool masterMode = Main.masterMode || bossRush; + bool death = CalamityWorld.death || bossRush; + npc.damage = npc.defDamage = 0; + float duration = 420f; + float spawnAnimTime = 120f; + int rateOfChange = masterMode ? 2 : 1; + float splitProjVelocity = death ? 4.5f : 3f; + + // Percent life remaining for Cultist or Eidolon Wyrm + float lifeRatio = Main.npc[(int)npc.ai[0]].life / (float)Main.npc[(int)npc.ai[0]].lifeMax; + + bool phase2 = lifeRatio < 0.7f; + bool phase3 = lifeRatio < (Main.npc[(int)npc.ai[0]].type == ModContent.NPCType() ? 0.6f : 0.55f); + bool phase4 = lifeRatio < 0.4f; + + bool kill = npc.ai[1] < 0f || !Main.npc[(int)npc.ai[0]].active; + int target = Main.maxPlayers; + if (Main.npc[(int)npc.ai[0]].type == NPCID.CultistBoss || Main.npc[(int)npc.ai[0]].type == ModContent.NPCType()) + { + if (target == Main.maxPlayers) + target = Main.npc[(int)npc.ai[0]].target; + + if (phase2 || death) + rateOfChange++; + + if (phase4 || death) + rateOfChange++; + + if (Main.npc[(int)npc.ai[0]].type == ModContent.NPCType()) + npc.dontTakeDamage = true; + } + else + kill = true; + + npc.ai[1] += rateOfChange; + float growthRate = npc.ai[1] / spawnAnimTime; + growthRate = MathHelper.Clamp(growthRate, 0f, 1f); + npc.position = npc.Center; + npc.scale = MathHelper.Lerp(0f, 1f, growthRate); + npc.Center = npc.position; + npc.alpha = (int)(255f - growthRate * 255f); + + if (phase3) + { + if (npc.ai[3] == 0f) + npc.ai[3] = npc.ai[2]; + + double deg = npc.ai[3]; + double rad = deg * (Math.PI / 180); + double dist = 550; + if (Main.npc[(int)npc.ai[0]].type == ModContent.NPCType()) + { + float aiGateValue = Main.npc[(int)npc.ai[0]].Calamity().newAI[2] - 30f; + int ancientDoomScale = (int)(aiGateValue / 120f); + dist += ancientDoomScale * 45; + } + npc.position.X = Main.player[target].Center.X - (int)(Math.Cos(rad) * dist) - npc.width / 2; + npc.position.Y = Main.player[target].Center.Y - (int)(Math.Sin(rad) * dist) - npc.height / 2; + float spinVelocity = 8f * (1f - (npc.ai[1] / duration)); + npc.ai[3] += spinVelocity; + } + + if (Main.rand.NextBool(6)) + { + Vector2 shadowflameDustRotate = Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi); + Dust shadowflameDust = Main.dust[Dust.NewDust(npc.Center - shadowflameDustRotate * 20f, 0, 0, DustID.Shadowflame, 0f, 0f, 0, default, 1f)]; + shadowflameDust.noGravity = true; + shadowflameDust.position = npc.Center - shadowflameDustRotate * Main.rand.Next(10, 21) * npc.scale; + shadowflameDust.velocity = shadowflameDustRotate.RotatedBy(MathHelper.PiOver2) * 4f; + shadowflameDust.scale = 0.5f + Main.rand.NextFloat(); + shadowflameDust.fadeIn = 0.5f; + } + if (Main.rand.NextBool(6)) + { + Vector2 darkDustRotate = Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi); + Dust darkDust = Main.dust[Dust.NewDust(npc.Center - darkDustRotate * 30f, 0, 0, DustID.Granite, 0f, 0f, 0, default, 1f)]; + darkDust.noGravity = true; + darkDust.position = npc.Center - darkDustRotate * 20f * npc.scale; + darkDust.velocity = darkDustRotate.RotatedBy(-MathHelper.PiOver2) * 2f; + darkDust.scale = 0.5f + Main.rand.NextFloat(); + darkDust.fadeIn = 0.5f; + } + if (Main.rand.NextBool(6)) + { + Vector2 darkDustRotate2 = Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi); + Dust darkDust2 = Main.dust[Dust.NewDust(npc.Center - darkDustRotate2 * 30f, 0, 0, DustID.Granite, 0f, 0f, 0, default, 1f)]; + darkDust2.position = npc.Center - darkDustRotate2 * 20f * npc.scale; + darkDust2.velocity = Vector2.Zero; + darkDust2.scale = 0.5f + Main.rand.NextFloat(); + darkDust2.fadeIn = 0.5f; + darkDust2.noLight = true; + } + + npc.localAI[0] += (float)(Math.PI / 60D); + + npc.localAI[1] = 0.25f + Vector2.UnitY.RotatedBy(npc.ai[1] * MathHelper.TwoPi / 60f).Y * 0.25f; + + if (npc.ai[1] >= duration) + { + int type = ProjectileID.AncientDoomProjectile; + int damage = npc.GetProjectileDamage(type); + + // Triple damage if the Primordial Wyrm is alive + if (Main.npc[(int)npc.ai[0]].type == ModContent.NPCType()) + damage *= 3; + + kill = true; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int totalProjectiles = CalamityWorld.LegendaryMode ? 9 : (Main.npc[(int)npc.ai[0]].type == NPCID.CultistBoss && !phase3) ? 8 : masterMode ? 5 : 4; + float radians = MathHelper.TwoPi / totalProjectiles; + Vector2 spinningPoint = new Vector2(0f, -splitProjVelocity); + for (int k = 0; k < totalProjectiles; k++) + { + Vector2 doomProjRotate = spinningPoint.RotatedBy(radians * k); + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, doomProjRotate, type, damage, 0f, Main.myPlayer); + } + } + } + + if (kill) + { + npc.HitEffect(0, 9999.0); + npc.active = false; + } + + return false; + } + + public static bool VanillaCultistAI(NPC npc, Mod mod) + { + // Chant sound + if (npc.ai[0] != -1f && Main.rand.NextBool(1000)) + { + SoundStyle chantSound = Utils.SelectRandom(Main.rand, new SoundStyle[] + { + SoundID.Zombie88, + SoundID.Zombie89, + SoundID.Zombie90, + SoundID.Zombie91 + }); + + SoundEngine.PlaySound(chantSound, npc.Center); + } + + bool expertMode = Main.expertMode; + bool masterMode = Main.masterMode; + + bool phase2 = npc.life <= npc.lifeMax / 2; + + int iceMistPhaseTime = masterMode ? 60 : expertMode ? 90 : 120; + if (Main.getGoodWorld) + iceMistPhaseTime -= 30; + + int fireballPhaseTime = Main.getGoodWorld ? 8 : masterMode ? 10 : expertMode ? 12 : 18; + int fireballAmount = Main.getGoodWorld ? 6 : masterMode ? 5 : expertMode ? 4 : 3; + + int lightningOrbPhaseTime = masterMode ? 30 : expertMode ? 40 : 80; + if (Main.getGoodWorld) + lightningOrbPhaseTime -= 20; + + int ancientLightPhaseTime = masterMode ? 40 : expertMode ? 30 : 20; + int ancientLightAmount = masterMode ? 4 : expertMode ? 3 : 2; + + int ancientDoomPhaseTime = masterMode ? 30 : 20; + int ancientDoomAmount = masterMode ? 5 : 3; + + int ritualTimeMax = phase2 ? 240 : 300; + + bool flag2 = npc.type == NPCID.CultistBoss; + bool flag3 = false; + bool flag4 = false; + if (phase2) + npc.defense = (int)Math.Round(npc.defDefense * 0.65); + + if (!flag2) + { + if (npc.ai[3] < 0f || !Main.npc[(int)npc.ai[3]].active || Main.npc[(int)npc.ai[3]].type != NPCID.CultistBoss) + { + npc.life = 0; + npc.HitEffect(); + npc.active = false; + return false; + } + + npc.ai[0] = Main.npc[(int)npc.ai[3]].ai[0]; + npc.ai[1] = Main.npc[(int)npc.ai[3]].ai[1]; + if (npc.ai[0] == 5f) + { + if (npc.justHit) + { + npc.life = 0; + npc.HitEffect(); + npc.active = false; + if (Main.netMode != NetmodeID.MultiplayerClient) + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, npc.whoAmI); + + NPC obj = Main.npc[(int)npc.ai[3]]; + obj.ai[0] = 6f; + obj.ai[1] = 0f; + obj.netUpdate = true; + } + } + else + { + flag3 = true; + flag4 = true; + } + } + else if (npc.ai[0] == 5f && npc.ai[1] >= 120f && npc.ai[1] < ritualTimeMax && npc.justHit) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[3] += 1f; + npc.velocity = Vector2.Zero; + npc.netUpdate = true; + List list = new List(); + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active && Main.npc[i].type == NPCID.CultistBossClone && Main.npc[i].ai[3] == (float)npc.whoAmI) + list.Add(i); + } + + int num9 = expertMode ? 3 : 10; + foreach (int item in list) + { + NPC nPC = Main.npc[item]; + if (nPC.localAI[1] == npc.localAI[1] && num9 > 0) + { + num9--; + nPC.life = 0; + nPC.HitEffect(); + nPC.active = false; + if (Main.netMode != NetmodeID.MultiplayerClient) + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, item); + } + else if (num9 > 0) + { + num9--; + nPC.life = 0; + nPC.HitEffect(); + nPC.active = false; + } + } + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (expertMode) + { + if (!NPC.AnyNPCs(NPCID.AncientCultistSquidhead)) + NPC.NewNPC(npc.GetSource_FromAI(), (int)Main.projectile[(int)npc.ai[2]].Center.X, (int)Main.projectile[(int)npc.ai[2]].Center.Y, NPCID.AncientCultistSquidhead); + } + } + + Main.projectile[(int)npc.ai[2]].ai[1] = -1f; + Main.projectile[(int)npc.ai[2]].netUpdate = true; + } + + Vector2 center = npc.Center; + Player player = Main.player[npc.target]; + float num10 = 5600f; + if (npc.target < 0 || npc.target == Main.maxPlayers || player.dead || !player.active || Vector2.Distance(player.Center, center) > num10) + { + npc.TargetClosest(false); + player = Main.player[npc.target]; + npc.netUpdate = true; + } + + if (player.dead || !player.active || Vector2.Distance(player.Center, center) > num10) + { + npc.life = 0; + npc.HitEffect(); + npc.active = false; + if (Main.netMode != NetmodeID.MultiplayerClient) + NetMessage.SendData(MessageID.DamageNPC, -1, -1, null, npc.whoAmI, -1f); + + new List().Add(npc.whoAmI); + for (int j = 0; j < Main.maxNPCs; j++) + { + if (Main.npc[j].active && Main.npc[j].type == NPCID.CultistBossClone && Main.npc[j].ai[3] == (float)npc.whoAmI) + { + Main.npc[j].life = 0; + Main.npc[j].HitEffect(); + Main.npc[j].active = false; + if (Main.netMode != NetmodeID.MultiplayerClient) + NetMessage.SendData(MessageID.DamageNPC, -1, -1, null, npc.whoAmI, -1f); + } + } + } + + float num11 = npc.ai[3]; + if (npc.localAI[0] == 0f) + { + SoundEngine.PlaySound(SoundID.Zombie89, npc.Center); + npc.localAI[0] = 1f; + npc.alpha = 255; + npc.rotation = 0f; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.ai[0] = -1f; + npc.netUpdate = true; + } + } + + if (npc.ai[0] == -1f) + { + npc.alpha -= 5; + if (npc.alpha < 0) + npc.alpha = 0; + + npc.ai[1] += 1f; + if (npc.ai[1] >= 420f) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.netUpdate = true; + } + else if (npc.ai[1] > 360f) + { + npc.velocity *= 0.95f; + if (npc.localAI[2] != 13f) + SoundEngine.PlaySound(SoundID.Zombie105, npc.Center); + + npc.localAI[2] = 13f; + } + else if (npc.ai[1] > 300f) + { + npc.velocity = -Vector2.UnitY; + npc.localAI[2] = 10f; + } + else if (npc.ai[1] > 120f) + npc.localAI[2] = 1f; + else + npc.localAI[2] = 0f; + + flag3 = true; + flag4 = true; + } + + if (npc.ai[0] == 0f) + { + if (npc.ai[1] == 0f) + npc.TargetClosest(false); + + npc.localAI[2] = 10f; + int num12 = Math.Sign(player.Center.X - center.X); + if (num12 != 0) + npc.direction = (npc.spriteDirection = num12); + + npc.ai[1] += 1f; + if (npc.ai[1] >= 40f && flag2) + { + int num13 = 0; + if (phase2) + { + switch ((int)npc.ai[3]) + { + case 0: + num13 = 0; + break; + case 1: + num13 = 1; + break; + case 2: + num13 = 0; + break; + case 3: + num13 = 5; + break; + case 4: + num13 = 0; + break; + case 5: + num13 = 3; + break; + case 6: + num13 = 0; + break; + case 7: + num13 = 5; + break; + case 8: + num13 = 0; + break; + case 9: + num13 = 2; + break; + case 10: + num13 = 0; + break; + case 11: + num13 = 3; + break; + case 12: + num13 = 0; + break; + case 13: + num13 = 4; + npc.ai[3] = -1f; + break; + default: + npc.ai[3] = -1f; + break; + } + } + else + { + switch ((int)npc.ai[3]) + { + case 0: + num13 = 0; + break; + case 1: + num13 = 1; + break; + case 2: + num13 = 0; + break; + case 3: + num13 = 2; + break; + case 4: + num13 = 0; + break; + case 5: + num13 = 3; + break; + case 6: + num13 = 0; + break; + case 7: + num13 = 1; + break; + case 8: + num13 = 0; + break; + case 9: + num13 = 2; + break; + case 10: + num13 = 0; + break; + case 11: + num13 = 4; + npc.ai[3] = -1f; + break; + default: + npc.ai[3] = -1f; + break; + } + } + + int maxValue = 6; + if (npc.life < npc.lifeMax / 3) + maxValue = 4; + if (npc.life < npc.lifeMax / 4) + maxValue = 3; + if (masterMode) + maxValue--; + + if (expertMode && phase2 && Main.rand.NextBool(maxValue) && num13 != 0 && num13 != 4 && num13 != 5 && NPC.CountNPCS(NPCID.AncientDoom) < 10) + num13 = 6; + + if (num13 == 0) + { + float num14 = (float)Math.Ceiling((player.Center + new Vector2(0f, -100f) - center).Length() / 50f); + if (num14 == 0f) + num14 = 1f; + + List list2 = new List(); + int num15 = 0; + list2.Add(npc.whoAmI); + for (int k = 0; k < Main.maxNPCs; k++) + { + if (Main.npc[k].active && Main.npc[k].type == NPCID.CultistBossClone && Main.npc[k].ai[3] == (float)npc.whoAmI) + list2.Add(k); + } + + bool flag5 = list2.Count % 2 == 0; + foreach (int item2 in list2) + { + NPC nPC2 = Main.npc[item2]; + Vector2 center2 = nPC2.Center; + float num16 = (float)((num15 + flag5.ToInt() + 1) / 2) * MathHelper.TwoPi * 0.4f / (float)list2.Count; + if (num15 % 2 == 1) + num16 *= -1f; + + if (list2.Count == 1) + num16 = 0f; + + Vector2 vector = new Vector2(0f, -1f).RotatedBy(num16) * new Vector2(300f, 200f); + Vector2 vector2 = player.Center + vector - center2; + nPC2.ai[0] = 1f; + nPC2.ai[1] = num14 * 2f; + nPC2.velocity = vector2 / num14; + if (npc.whoAmI >= nPC2.whoAmI) + nPC2.position -= nPC2.velocity; + + nPC2.netUpdate = true; + num15++; + } + } + + switch (num13) + { + case 1: + npc.ai[0] = 3f; + npc.ai[1] = 0f; + break; + case 2: + npc.ai[0] = 2f; + npc.ai[1] = 0f; + break; + case 3: + npc.ai[0] = 4f; + npc.ai[1] = 0f; + break; + case 4: + npc.ai[0] = 5f; + npc.ai[1] = 0f; + break; + } + + if (num13 == 5) + { + npc.ai[0] = 7f; + npc.ai[1] = 0f; + } + + if (num13 == 6) + { + npc.ai[0] = 8f; + npc.ai[1] = 0f; + } + + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 1f) + { + flag3 = true; + npc.localAI[2] = 10f; + if ((float)(int)npc.ai[1] % 2f != 0f && npc.ai[1] != 1f) + npc.position -= npc.velocity; + + npc.ai[1] -= 1f; + if (npc.ai[1] <= 0f) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[3] += 1f; + npc.velocity = Vector2.Zero; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 2f) + { + npc.localAI[2] = 11f; + Vector2 vec = Vector2.Normalize(player.Center - center); + if (vec.HasNaNs()) + vec = new Vector2(npc.direction, 0f); + + if (npc.ai[1] >= 4f && flag2 && (int)(npc.ai[1] - 4f) % iceMistPhaseTime == 0) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + List list3 = new List(); + for (int l = 0; l < Main.maxNPCs; l++) + { + if (Main.npc[l].active && Main.npc[l].type == NPCID.CultistBossClone && Main.npc[l].ai[3] == (float)npc.whoAmI) + list3.Add(l); + } + + foreach (int item3 in list3) + { + NPC nPC3 = Main.npc[item3]; + Vector2 center3 = nPC3.Center; + int num17 = Math.Sign(player.Center.X - center3.X); + if (num17 != 0) + nPC3.direction = (nPC3.spriteDirection = num17); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + vec = Vector2.Normalize(player.Center - center3); + if (vec.HasNaNs()) + vec = new Vector2(npc.direction, 0f); + + Vector2 vector3 = center3 + new Vector2(npc.direction * 30, 12f); + int type = ProjectileID.CultistBossFireBallClone; + float velocity = masterMode ? 10f : expertMode ? 8f : 6f; + Vector2 spinninpoint = vec * (velocity + (float)Main.rand.NextDouble() * 4f); + spinninpoint = spinninpoint.RotatedByRandom(Math.PI / 6D); + Projectile.NewProjectile(npc.GetSource_FromAI(), vector3, spinninpoint, type, npc.GetProjectileDamage(type), 0f, Main.myPlayer); + } + } + } + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + vec = Vector2.Normalize(player.Center - center); + if (vec.HasNaNs()) + vec = new Vector2(npc.direction, 0f); + + Vector2 vector4 = npc.Center + new Vector2(npc.direction * 30, 12f); + int type = ProjectileID.CultistBossIceMist; + int numIceMists = masterMode ? 3 : expertMode ? 2 : 1; + float iceMistVelocity = masterMode ? 8f : expertMode ? 6f : 4f; + for (int n = 0; n < numIceMists; n++) + { + Vector2 vector5 = vec * (iceMistVelocity - n * 2f); + Projectile.NewProjectile(npc.GetSource_FromAI(), vector4, vector5, type, npc.GetProjectileDamage(type), 0f, Main.myPlayer, 0f, 1f); + } + } + } + + npc.ai[1] += 1f; + if (npc.ai[1] >= (float)(4 + iceMistPhaseTime)) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[3] += 1f; + npc.velocity = Vector2.Zero; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 3f) + { + npc.localAI[2] = 11f; + Vector2 vec2 = Vector2.Normalize(player.Center - center); + if (vec2.HasNaNs()) + vec2 = new Vector2(npc.direction, 0f); + + if (npc.ai[1] >= 4f && flag2 && (int)(npc.ai[1] - 4f) % fireballPhaseTime == 0) + { + if ((int)(npc.ai[1] - 4f) / fireballPhaseTime == 2) + { + List list4 = new List(); + for (int num18 = 0; num18 < Main.maxNPCs; num18++) + { + if (Main.npc[num18].active && Main.npc[num18].type == NPCID.CultistBossClone && Main.npc[num18].ai[3] == (float)npc.whoAmI) + list4.Add(num18); + } + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + foreach (int item4 in list4) + { + NPC nPC4 = Main.npc[item4]; + Vector2 center4 = nPC4.Center; + int num19 = Math.Sign(player.Center.X - center4.X); + if (num19 != 0) + nPC4.direction = (nPC4.spriteDirection = num19); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + vec2 = Vector2.Normalize(player.Center - center4); + if (vec2.HasNaNs()) + vec2 = new Vector2(npc.direction, 0f); + + Vector2 vector6 = center4 + new Vector2(npc.direction * 30, 12f); + int type = ProjectileID.CultistBossFireBallClone; + float velocity = masterMode ? 10f : expertMode ? 8f : 6f; + Vector2 spinninpoint2 = vec2 * (velocity + (float)Main.rand.NextDouble() * 4f); + spinninpoint2 = spinninpoint2.RotatedByRandom(Math.PI / 6D); + Projectile.NewProjectile(npc.GetSource_FromAI(), vector6, spinninpoint2, type, npc.GetProjectileDamage(type), 0f, Main.myPlayer); + } + } + } + } + + int num21 = Math.Sign(player.Center.X - center.X); + if (num21 != 0) + npc.direction = (npc.spriteDirection = num21); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + vec2 = Vector2.Normalize(player.Center - center); + if (vec2.HasNaNs()) + vec2 = new Vector2(npc.direction, 0f); + + Vector2 vector7 = npc.Center + new Vector2(npc.direction * 30, 12f); + int type = ProjectileID.CultistBossFireBall; + float velocity = masterMode ? 10f : expertMode ? 8f : 6f; + double spread = Math.PI / (masterMode ? 4D : expertMode ? 5D : 6D); + Vector2 spinninpoint3 = vec2 * (velocity + (float)Main.rand.NextDouble() * 4f); + spinninpoint3 = spinninpoint3.RotatedByRandom(spread); + Projectile.NewProjectile(npc.GetSource_FromAI(), vector7, spinninpoint3, type, npc.GetProjectileDamage(type), 0f, Main.myPlayer); + } + } + + npc.ai[1] += 1f; + if (npc.ai[1] >= (float)(4 + fireballPhaseTime * fireballAmount)) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[3] += 1f; + npc.velocity = Vector2.Zero; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 4f) + { + if (flag2) + npc.localAI[2] = 12f; + else + npc.localAI[2] = 11f; + + if (npc.ai[1] == 20f && flag2 && Main.netMode != NetmodeID.MultiplayerClient) + { + List list5 = new List(); + for (int num23 = 0; num23 < Main.maxNPCs; num23++) + { + if (Main.npc[num23].active && Main.npc[num23].type == NPCID.CultistBossClone && Main.npc[num23].ai[3] == (float)npc.whoAmI) + list5.Add(num23); + } + + foreach (int item5 in list5) + { + NPC nPC5 = Main.npc[item5]; + Vector2 center5 = nPC5.Center; + int num24 = Math.Sign(player.Center.X - center5.X); + if (num24 != 0) + nPC5.direction = (nPC5.spriteDirection = num24); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Vector2 vector8 = Vector2.Normalize(player.Center - center5); + if (vector8.HasNaNs()) + vector8 = new Vector2(npc.direction, 0f); + + Vector2 vector9 = center5 + new Vector2(npc.direction * 30, 12f); + int type = ProjectileID.CultistBossFireBallClone; + float velocity = masterMode ? 10f : expertMode ? 8f : 6f; + Vector2 spinninpoint4 = vector8 * (velocity + (float)Main.rand.NextDouble() * 4f); + spinninpoint4 = spinninpoint4.RotatedByRandom(Math.PI / 6D); + Projectile.NewProjectile(npc.GetSource_FromAI(), vector9, spinninpoint4, type, npc.GetProjectileDamage(type), 0f, Main.myPlayer); + } + } + + int type2 = ProjectileID.CultistBossLightningOrb; + if ((int)(npc.ai[1] - 20f) % lightningOrbPhaseTime == 0) + { + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X, npc.Center.Y - 100f, 0f, 0f, type2, npc.GetProjectileDamage(type2), 0f, Main.myPlayer); + + if (masterMode) + { + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X + 210f, npc.Center.Y - 210f, 0f, 0f, type2, npc.GetProjectileDamage(type2), 0f, Main.myPlayer); + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X - 210f, npc.Center.Y - 210f, 0f, 0f, type2, npc.GetProjectileDamage(type2), 0f, Main.myPlayer); + } + else if (expertMode) + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X, npc.Center.Y + 100f, 0f, 0f, type2, npc.GetProjectileDamage(type2), 0f, Main.myPlayer); + } + } + + npc.ai[1] += 1f; + if (npc.ai[1] >= (float)(20 + lightningOrbPhaseTime)) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[3] += 1f; + npc.velocity = Vector2.Zero; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 5f) + { + npc.localAI[2] = 10f; + if (Vector2.Normalize(player.Center - center).HasNaNs()) + new Vector2(npc.direction, 0f); + + if (npc.ai[1] >= 0f && npc.ai[1] < 30f) + { + flag3 = true; + flag4 = true; + float num26 = (npc.ai[1] - 0f) / 30f; + npc.alpha = (int)(num26 * 255f); + } + else if (npc.ai[1] >= 30f && npc.ai[1] < 90f) + { + if (npc.ai[1] == 30f && Main.netMode != NetmodeID.MultiplayerClient && flag2) + { + npc.localAI[1] += 1f; + Vector2 spinningpoint = new Vector2(180f, 0f); + List list6 = new List(); + for (int num27 = 0; num27 < Main.maxNPCs; num27++) + { + if (Main.npc[num27].active && Main.npc[num27].type == NPCID.CultistBossClone && Main.npc[num27].ai[3] == (float)npc.whoAmI) + list6.Add(num27); + } + + int num28 = 6 - list6.Count; + if (num28 > 2) + num28 = 2; + + int num29 = list6.Count + num28 + 1; + float[] array = new float[num29]; + for (int num30 = 0; num30 < array.Length; num30++) + array[num30] = Vector2.Distance(npc.Center + spinningpoint.RotatedBy((float)num30 * MathHelper.TwoPi / (float)num29 - (float)Math.PI / 2f), player.Center); + + int num31 = 0; + for (int num32 = 1; num32 < array.Length; num32++) + { + if (array[num31] > array[num32]) + num31 = num32; + } + + num31 = ((num31 >= num29 / 2) ? (num31 - num29 / 2) : (num31 + num29 / 2)); + int num33 = num28; + for (int num34 = 0; num34 < array.Length; num34++) + { + if (num31 != num34) + { + Vector2 center6 = npc.Center + spinningpoint.RotatedBy((float)num34 * MathHelper.TwoPi / (float)num29 - (float)Math.PI / 2f); + if (num33-- > 0) + { + int num35 = NPC.NewNPC(npc.GetSource_FromAI(), (int)center6.X, (int)center6.Y + npc.height / 2, NPCID.CultistBossClone, npc.whoAmI); + Main.npc[num35].ai[3] = npc.whoAmI; + Main.npc[num35].netUpdate = true; + Main.npc[num35].localAI[1] = npc.localAI[1]; + } + else + { + int num36 = list6[-num33 - 1]; + Main.npc[num36].Center = center6; + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num36); + } + } + } + + npc.ai[2] = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, Vector2.Zero, ProjectileID.CultistRitual, 0, 0f, Main.myPlayer, 0f, npc.whoAmI); + npc.Center += spinningpoint.RotatedBy((float)num31 * MathHelper.TwoPi / (float)num29 - (float)Math.PI / 2f); + npc.netUpdate = true; + list6.Clear(); + } + + flag3 = true; + flag4 = true; + npc.alpha = 255; + if (flag2) + { + Vector2 vector10 = Main.projectile[(int)npc.ai[2]].Center; + vector10 -= npc.Center; + if (vector10 == Vector2.Zero) + vector10 = -Vector2.UnitY; + + vector10.Normalize(); + if (Math.Abs(vector10.Y) < 0.77f) + npc.localAI[2] = 11f; + else if (vector10.Y < 0f) + npc.localAI[2] = 12f; + else + npc.localAI[2] = 10f; + + int num37 = Math.Sign(vector10.X); + if (num37 != 0) + npc.direction = (npc.spriteDirection = num37); + } + else + { + Vector2 vector11 = Main.projectile[(int)Main.npc[(int)npc.ai[3]].ai[2]].Center; + vector11 -= npc.Center; + if (vector11 == Vector2.Zero) + vector11 = -Vector2.UnitY; + + vector11.Normalize(); + if (Math.Abs(vector11.Y) < 0.77f) + npc.localAI[2] = 11f; + else if (vector11.Y < 0f) + npc.localAI[2] = 12f; + else + npc.localAI[2] = 10f; + + int num38 = Math.Sign(vector11.X); + if (num38 != 0) + npc.direction = (npc.spriteDirection = num38); + } + } + else if (npc.ai[1] >= 90f && npc.ai[1] < 120f) + { + flag3 = true; + flag4 = true; + float num39 = (npc.ai[1] - 90f) / 30f; + npc.alpha = 255 - (int)(num39 * 255f); + } + else if (npc.ai[1] >= 120f && npc.ai[1] < ritualTimeMax) + { + flag4 = true; + npc.alpha = 0; + if (flag2) + { + Vector2 vector12 = Main.projectile[(int)npc.ai[2]].Center; + vector12 -= npc.Center; + if (vector12 == Vector2.Zero) + vector12 = -Vector2.UnitY; + + vector12.Normalize(); + if (Math.Abs(vector12.Y) < 0.77f) + npc.localAI[2] = 11f; + else if (vector12.Y < 0f) + npc.localAI[2] = 12f; + else + npc.localAI[2] = 10f; + + int num40 = Math.Sign(vector12.X); + if (num40 != 0) + npc.direction = (npc.spriteDirection = num40); + } + else + { + Vector2 vector13 = Main.projectile[(int)Main.npc[(int)npc.ai[3]].ai[2]].Center; + vector13 -= npc.Center; + if (vector13 == Vector2.Zero) + vector13 = -Vector2.UnitY; + + vector13.Normalize(); + if (Math.Abs(vector13.Y) < 0.77f) + npc.localAI[2] = 11f; + else if (vector13.Y < 0f) + npc.localAI[2] = 12f; + else + npc.localAI[2] = 10f; + + int num41 = Math.Sign(vector13.X); + if (num41 != 0) + npc.direction = (npc.spriteDirection = num41); + } + } + + npc.ai[1] += 1f; + if (npc.ai[1] >= ritualTimeMax) + { + flag4 = true; + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[3] += 1f; + npc.velocity = Vector2.Zero; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 6f) + { + npc.localAI[2] = 13f; + npc.ai[1] += 1f; + if (npc.ai[1] >= 120f) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[3] += 1f; + npc.velocity = Vector2.Zero; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 7f) + { + npc.localAI[2] = 11f; + Vector2 vec3 = Vector2.Normalize(player.Center - center); + if (vec3.HasNaNs()) + vec3 = new Vector2(npc.direction, 0f); + + if (npc.ai[1] >= 4f && flag2 && (int)(npc.ai[1] - 4f) % ancientLightPhaseTime == 0) + { + if ((int)(npc.ai[1] - 4f) / ancientLightPhaseTime == 2) + { + List list7 = new List(); + for (int num42 = 0; num42 < Main.maxNPCs; num42++) + { + if (Main.npc[num42].active && Main.npc[num42].type == NPCID.CultistBossClone && Main.npc[num42].ai[3] == (float)npc.whoAmI) + list7.Add(num42); + } + + foreach (int item6 in list7) + { + NPC nPC6 = Main.npc[item6]; + Vector2 center7 = nPC6.Center; + int num43 = Math.Sign(player.Center.X - center7.X); + if (num43 != 0) + nPC6.direction = (nPC6.spriteDirection = num43); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + vec3 = Vector2.Normalize(player.Center - center7); + if (vec3.HasNaNs()) + vec3 = new Vector2(npc.direction, 0f); + + Vector2 vector14 = center7 + new Vector2(npc.direction * 30, 12f); + int type = ProjectileID.CultistBossFireBallClone; + float velocity = masterMode ? 10f : expertMode ? 8f : 6f; + for (int num44 = 0; (float)num44 < 5f; num44++) + { + Vector2 spinninpoint5 = vec3 * (velocity + (float)Main.rand.NextDouble() * 4f); + spinninpoint5 = spinninpoint5.RotatedByRandom(MathHelper.TwoPi / 5D); + Projectile.NewProjectile(npc.GetSource_FromAI(), vector14, spinninpoint5, type, npc.GetProjectileDamage(type), 0f, Main.myPlayer); + } + } + } + } + + int num45 = Math.Sign(player.Center.X - center.X); + if (num45 != 0) + npc.direction = (npc.spriteDirection = num45); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + vec3 = Vector2.Normalize(player.Center - center); + if (vec3.HasNaNs()) + vec3 = new Vector2(npc.direction, 0f); + + Vector2 vector15 = npc.Center + new Vector2(npc.direction * 30, 12f); + float velocity = masterMode ? 14f : expertMode ? 12f : 10f; + float spread = MathHelper.ToRadians(masterMode ? 15f : expertMode ? 20f : 25f); + float ancientLightLimit = 5f; + for (int i = 0; (float)i < ancientLightLimit; i++) + { + Vector2 spinningpoint2 = vec3 * velocity; + spinningpoint2 = spinningpoint2.RotatedBy(spread * (float)i - (MathHelper.TwoPi / ancientLightLimit - spread) / 2f); + float ai = (Main.rand.NextFloat() - 0.5f) * 0.3f * MathHelper.TwoPi / 60f; + int num49 = NPC.NewNPC(npc.GetSource_FromAI(), (int)vector15.X, (int)vector15.Y + 7, NPCID.AncientLight, 0, 0f, ai, spinningpoint2.X, spinningpoint2.Y); + Main.npc[num49].velocity = spinningpoint2; + Main.npc[num49].netUpdate = true; + } + } + } + + npc.ai[1] += 1f; + if (npc.ai[1] >= (float)(4 + ancientLightPhaseTime * ancientLightAmount)) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[3] += 1f; + npc.velocity = Vector2.Zero; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 8f) + { + npc.localAI[2] = 13f; + if (npc.ai[1] >= 4f && flag2 && (int)(npc.ai[1] - 4f) % ancientDoomPhaseTime == 0) + { + List list8 = new List(); + for (int num50 = 0; num50 < Main.maxNPCs; num50++) + { + if (Main.npc[num50].active && Main.npc[num50].type == NPCID.CultistBossClone && Main.npc[num50].ai[3] == (float)npc.whoAmI) + list8.Add(num50); + } + + int num51 = list8.Count + 1; + if (num51 > 3) + num51 = 3; + + int num52 = Math.Sign(player.Center.X - center.X); + if (num52 != 0) + npc.direction = (npc.spriteDirection = num52); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + for (int num53 = 0; num53 < num51; num53++) + { + Point point = npc.Center.ToTileCoordinates(); + Point point2 = Main.player[npc.target].Center.ToTileCoordinates(); + Vector2 vector16 = Main.player[npc.target].Center - npc.Center; + int num54 = 20; + int num55 = 3; + int num56 = 7; + int num57 = 2; + int num58 = 0; + bool flag6 = false; + if (vector16.Length() > 2000f) + flag6 = true; + + while (!flag6 && num58 < 100) + { + num58++; + int num59 = Main.rand.Next(point2.X - num54, point2.X + num54 + 1); + int num60 = Main.rand.Next(point2.Y - num54, point2.Y + num54 + 1); + if ((num60 < point2.Y - num56 || num60 > point2.Y + num56 || num59 < point2.X - num56 || num59 > point2.X + num56) && (num60 < point.Y - num55 || num60 > point.Y + num55 || num59 < point.X - num55 || num59 > point.X + num55) && !Main.tile[num59, num60].HasUnactuatedTile) + { + bool flag7 = true; + if (flag7 && Collision.SolidTiles(num59 - num57, num59 + num57, num60 - num57, num60 + num57)) + flag7 = false; + + if (flag7) + { + NPC.NewNPC(npc.GetSource_FromAI(), num59 * 16 + 8, num60 * 16 + 8, NPCID.AncientDoom, 0, npc.whoAmI); + flag6 = true; + break; + } + } + } + } + } + } + + npc.ai[1] += 1f; + if (npc.ai[1] >= (float)(4 + ancientDoomPhaseTime * ancientDoomAmount)) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[3] += 1f; + npc.velocity = Vector2.Zero; + npc.netUpdate = true; + } + } + + if (!flag2) + npc.ai[3] = num11; + + npc.dontTakeDamage = flag3; + npc.chaseable = !flag4; + + return false; + } + + public static bool VanillaAncientLightAI(NPC npc, Mod mod) + { + npc.dontTakeDamage = true; + + // Slow and kill code + if (npc.ai[0] == -1f) + { + // Slow down over time + if (npc.velocity.Length() >= 0.2f) + { + npc.velocity *= 0.96f; + } + else + { + npc.velocity = Vector2.Zero; + npc.position = npc.oldPosition; + + // Kill after 2 seconds + npc.ai[1] += 1f; + if (npc.ai[1] >= 120f) + { + npc.HitEffect(0, 9999.0); + npc.active = false; + } + } + + return false; + } + + npc.rotation = npc.velocity.ToRotation() - MathHelper.PiOver2; + + // Set velocity and emit dust when spawned + if (npc.localAI[0] == 0f) + { + npc.localAI[0] = 1f; + npc.velocity.X = npc.ai[2]; + npc.velocity.Y = npc.ai[3]; + for (int i = 0; i < 13; i++) + { + int ancientLight = Dust.NewDust(npc.position, npc.width, npc.height, DustID.AncientLight, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f, 90, default, 2.5f); + Main.dust[ancientLight].noGravity = true; + Main.dust[ancientLight].fadeIn = 1f; + Dust dust = Main.dust[ancientLight]; + dust.velocity *= 4f; + Main.dust[ancientLight].noLight = true; + } + } + + // Spawn dust + for (int j = 0; j < 2; j++) + { + if (Main.rand.Next(10 - (int)Math.Min(7f, npc.velocity.Length())) < 1) + { + int ancientLight2 = Dust.NewDust(npc.position, npc.width, npc.height, DustID.AncientLight, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f, 90, default, 2.5f); + Main.dust[ancientLight2].noGravity = true; + Dust dust = Main.dust[ancientLight2]; + dust.velocity *= 0.2f; + Main.dust[ancientLight2].fadeIn = 0.4f; + if (Main.rand.NextBool(6)) + { + dust = Main.dust[ancientLight2]; + dust.velocity *= 5f; + Main.dust[ancientLight2].noLight = true; + } + else + Main.dust[ancientLight2].velocity = npc.DirectionFrom(Main.dust[ancientLight2].position) * Main.dust[ancientLight2].velocity.Length(); + } + } + + if (npc.ai[0] >= 0f) + { + npc.ai[0] += 1f; + + float duration = 120f; + + // Increase velocity for 1 second + if (npc.ai[0] < duration - 60f) + { + if (npc.velocity.Length() < 16f) + npc.velocity *= 1.005f; + } + + // Intersect velocity paths with other Ancient Lights for 1 second + if (npc.ai[0] >= duration - 60f) + npc.velocity = npc.velocity.RotatedBy(npc.ai[1]); + + // Engage slow code + if (npc.ai[0] >= duration) + npc.ai[0] = -1f; + } + + return false; + } + + public static bool VanillaAncientDoomAI(NPC npc, Mod mod) + { + npc.damage = npc.defDamage = 0; + float duration = 420f; + float spawnAnimTime = 120f; + int rateOfChange = 1; + float splitProjVelocity = Main.masterMode ? 10f : Main.expertMode ? 8f : 6f; + + // Percent life remaining for Cultist or Eidolon Wyrm + float lifeRatio = Main.npc[(int)npc.ai[0]].life / (float)Main.npc[(int)npc.ai[0]].lifeMax; + + bool phase2 = lifeRatio < 0.7f && Main.expertMode; + bool phase3 = lifeRatio < 0.4f && Main.masterMode; + + bool kill = npc.ai[1] < 0f || !Main.npc[(int)npc.ai[0]].active; + int target = Main.maxPlayers; + if (Main.npc[(int)npc.ai[0]].type == NPCID.CultistBoss) + { + if (target == Main.maxPlayers) + target = Main.npc[(int)npc.ai[0]].target; + + if (phase2) + rateOfChange = 2; + + if (phase3) + rateOfChange = 3; + } + else + kill = true; + + npc.ai[1] += rateOfChange; + float growthRate = npc.ai[1] / spawnAnimTime; + growthRate = MathHelper.Clamp(growthRate, 0f, 1f); + npc.position = npc.Center; + npc.scale = MathHelper.Lerp(0f, 1f, growthRate); + npc.Center = npc.position; + npc.alpha = (int)(255f - growthRate * 255f); + + if (Main.rand.NextBool(6)) + { + Vector2 shadowflameDustRotate = Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi); + Dust shadowflameDust = Main.dust[Dust.NewDust(npc.Center - shadowflameDustRotate * 20f, 0, 0, DustID.Shadowflame, 0f, 0f, 0, default, 1f)]; + shadowflameDust.noGravity = true; + shadowflameDust.position = npc.Center - shadowflameDustRotate * Main.rand.Next(10, 21) * npc.scale; + shadowflameDust.velocity = shadowflameDustRotate.RotatedBy(MathHelper.PiOver2) * 4f; + shadowflameDust.scale = 0.5f + Main.rand.NextFloat(); + shadowflameDust.fadeIn = 0.5f; + } + if (Main.rand.NextBool(6)) + { + Vector2 darkDustRotate = Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi); + Dust darkDust = Main.dust[Dust.NewDust(npc.Center - darkDustRotate * 30f, 0, 0, DustID.Granite, 0f, 0f, 0, default, 1f)]; + darkDust.noGravity = true; + darkDust.position = npc.Center - darkDustRotate * 20f * npc.scale; + darkDust.velocity = darkDustRotate.RotatedBy(-MathHelper.PiOver2) * 2f; + darkDust.scale = 0.5f + Main.rand.NextFloat(); + darkDust.fadeIn = 0.5f; + } + if (Main.rand.NextBool(6)) + { + Vector2 darkDustRotate2 = Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi); + Dust darkDust2 = Main.dust[Dust.NewDust(npc.Center - darkDustRotate2 * 30f, 0, 0, DustID.Granite, 0f, 0f, 0, default, 1f)]; + darkDust2.position = npc.Center - darkDustRotate2 * 20f * npc.scale; + darkDust2.velocity = Vector2.Zero; + darkDust2.scale = 0.5f + Main.rand.NextFloat(); + darkDust2.fadeIn = 0.5f; + darkDust2.noLight = true; + } + + if (npc.ai[1] >= duration) + { + int type = ProjectileID.AncientDoomProjectile; + int damage = npc.GetProjectileDamage(type); + + kill = true; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int totalProjectiles = phase3 ? 6 : phase2 ? 5 : 4; + float radians = MathHelper.TwoPi / totalProjectiles; + Vector2 spinningPoint = new Vector2(0f, -splitProjVelocity); + for (int k = 0; k < totalProjectiles; k++) + { + Vector2 doomProjRotate = spinningPoint.RotatedBy(radians * k); + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, doomProjRotate, type, damage, 0f, Main.myPlayer); + } + } + } + + if (kill) + { + npc.HitEffect(0, 9999.0); + npc.active = false; + } + + return false; + } + } +} diff --git a/NPCs/VanillaNPCOverrides/Bosses/DeerclopsAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/DeerclopsAI.cs similarity index 87% rename from NPCs/VanillaNPCOverrides/Bosses/DeerclopsAI.cs rename to NPCs/VanillaNPCAIOverrides/Bosses/DeerclopsAI.cs index a5e98cc159..3eb437dcd6 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/DeerclopsAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/DeerclopsAI.cs @@ -1,15 +1,16 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using CalamityMod.Events; +using CalamityMod.World; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.DataStructures; using Terraria.Enums; using Terraria.Graphics.CameraModifiers; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using CalamityMod.World; -namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses +namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { public static class DeerclopsAI { @@ -23,7 +24,6 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses public static float borderScalar = 0f; public static Vector2 lastDeerclopsPosition; - public static bool BuffedDeerclopsAI(NPC npc, Mod mod) { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); @@ -34,7 +34,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses float lifeRatio = (float)npc.life / (float)npc.lifeMax; // Difficulty bools - bool expertMode = Main.expertMode; + bool bossRush = BossRushEvent.BossRushActive; + bool masterMode = Main.masterMode || bossRush; + bool death = CalamityWorld.death || bossRush; // Projectile types and damage int rubble = ProjectileID.DeerclopsRangedProjectile; @@ -49,7 +51,6 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses hasTargetBeenInRange = false; borderScalar = 0.9f; } - // Target data NPCAimedTarget targetData = npc.GetTargetData(); @@ -75,19 +76,19 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses while (invincibleDustAmount > 0f) { invincibleDustAmount -= 1f; - Dust.NewDustDirect(npc.position, npc.width, npc.height, 109, 0f, -3f, 0, default(Color), 1.4f).noGravity = true; + Dust.NewDustDirect(npc.position, npc.width, npc.height, DustID.Asphalt, 0f, -3f, 0, default(Color), 1.4f).noGravity = true; } } else if (!hasTargetBeenInRange && npc.target.WithinBounds(Main.player.Length) && !Main.player[npc.target].dead) { - //Target entered the border for the first time + // Target entered the border for the first time hasTargetBeenInRange = true; if (borderDelay > 120f) borderDelay = 120f; } if (innerBorder != increaseDRTriggerDistance || maxDRIncreaseDistance != outerBorder) { - //Adjust the border IF the new value is lower (helps prevent jumping if you enter the border early while it's on screen but not finished zooming in) + // Adjust the border IF the new value is lower (helps prevent jumping if you enter the border early while it's on screen but not finished zooming in) var LerpValue = Utils.GetLerpValue(hasTargetBeenInRange ? 120f : 180f, 0f, borderDelay, true); var newInner = MathHelper.Lerp(maxDRIncreaseDistance * 5f, increaseDRTriggerDistance, LerpValue); if (newInner < innerBorder) @@ -98,12 +99,12 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } if ((hasTargetBeenInRange && borderScalar < 1f) || borderDelay > 0f) { - //fade in, with full opacity only available after being inside the border for the first time + // Fade in, with full opacity only available after being inside the border for the first time borderScalar = MathHelper.Clamp(borderScalar + 0.015f, 0f, hasTargetBeenInRange ? 1f : 0.9f); } shouldDrawEnrageBorder = CalamityWorld.revenge || CalamityWorld.death; - //Set the last deerclops position (used only for post-death border shenanigans) + // Set the last deerclops position (used only for post-death border shenanigans) lastDeerclopsPosition = npc.Center; // Spawn settings @@ -129,7 +130,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Spawn Shadow Hands if (Main.netMode != NetmodeID.MultiplayerClient) - SpawnPassiveShadowHands(npc, lifeRatio, shadowHand, shadowHandDamage); + SpawnPassiveShadowHands(npc, lifeRatio, shadowHand, shadowHandDamage, death); // AI states switch ((int)npc.ai[0]) @@ -138,7 +139,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses case -1: npc.localAI[3] = -10f; - + break; // Choose an attack to use @@ -154,8 +155,14 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.netUpdate = true; break; } + else + { + if (npc.timeLeft < 86400) + npc.timeLeft = 86400; + } - npc.ai[1] += 1f; + float attackRate = 1f; + npc.ai[1] += attackRate; Vector2 relativeCenter = npc.Bottom + new Vector2(0f, -32f); Vector2 closestTargetPoint = targetData.Hitbox.ClosestPointInRect(relativeCenter); Vector2 distanceFromTarget2 = closestTargetPoint - relativeCenter; @@ -233,9 +240,10 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.ai[1] += 1f; haltMovement = true; - MakeSpikesForward(npc, 1, targetData, iceSpike, iceSpikeDamage); + MakeSpikesForward(npc, 1, targetData, iceSpike, iceSpikeDamage, lifeRatio, death); - if (npc.ai[1] >= 80f) + float iceSpikePhaseGateValue = 80f; + if (npc.ai[1] >= iceSpikePhaseGateValue) { npc.ai[0] = 0f; npc.ai[1] = 0f; @@ -259,8 +267,8 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[1] >= (float)scoopRubbleGateValue) { Point sourceTileCoords = npc.Top.ToTileCoordinates(); - int numRubble = 20; - int distancedByThisManyTiles = 5; + int numRubble = death ? (masterMode ? 60 : 40) : (masterMode ? 32 : 20); + int distancedByThisManyTiles = death ? (masterMode ? 3 : 4) : (masterMode ? 4 : 5); sourceTileCoords.X += npc.direction * 3; sourceTileCoords.Y -= 10; int screenShakeGateValue = (int)npc.ai[1] - scoopRubbleGateValue; @@ -276,7 +284,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses rubbleLimit = rubbleStart; for (int rubbleIndex = rubbleStart; rubbleIndex < rubbleLimit && rubbleIndex < numRubble; rubbleIndex++) - ShootRubbleUp(npc, ref sourceTileCoords, numRubble, distancedByThisManyTiles, rubbleIndex, rubble, rubbleDamage); + ShootRubbleUp(npc, ref sourceTileCoords, numRubble, distancedByThisManyTiles, rubbleIndex, rubble, rubbleDamage, lifeRatio, death); } if (npc.ai[1] >= 60f) @@ -307,14 +315,16 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.TargetClosest(); if (Main.netMode != NetmodeID.MultiplayerClient) { - int totalProjectiles = 9; - float radians = MathHelper.TwoPi / totalProjectiles; - float velocity = 9f; + int totalProjectiles = (masterMode ? 7 : 5) + (int)MathHelper.Lerp(0f, 11f, 1f - lifeRatio); + float velocityMultIncrement = ((totalProjectiles + 1) / (float)totalProjectiles) - 1f; + float randomRadialOffset = MathHelper.ToRadians(MathHelper.Lerp(0f, masterMode ? 270f : 180f, 1f - lifeRatio)); + float radians = MathHelper.TwoPi / totalProjectiles + randomRadialOffset; + float velocity = (masterMode ? 9f : 7f) + MathHelper.Lerp(0f, 3.5f, 1f - lifeRatio); Vector2 spinningPoint = new Vector2(0f, -velocity); for (int k = 0; k < totalProjectiles; k++) { Vector2 actualVelocity = spinningPoint.RotatedBy(radians * k); - float velocityMultiplier = 1f - k * 0.1f; + float velocityMultiplier = 1f - k * velocityMultIncrement; Projectile.NewProjectile(npc.GetSource_FromAI(), Main.player[npc.target].Center + Vector2.Normalize(actualVelocity) * 450f, actualVelocity * velocityMultiplier * -1f, shadowHand, shadowHandDamage, 0f, Main.myPlayer); } } @@ -335,9 +345,10 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.ai[1] += 1f; haltMovement = true; npc.TargetClosest(); - MakeSpikesBothSides(npc, 1, targetData, iceSpike, iceSpikeDamage); + MakeSpikesBothSides(npc, 1, targetData, iceSpike, iceSpikeDamage, lifeRatio, death); - if (npc.ai[1] >= 90f) + float doubleIceSpikePhaseGateValue = 90f; + if (npc.ai[1] >= doubleIceSpikePhaseGateValue) { npc.ai[0] = 0f; npc.ai[1] = 0f; @@ -365,9 +376,10 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.TargetClosest(); if (Main.netMode != NetmodeID.MultiplayerClient) { - for (int i = 0; i < 6; i++) + int handAmount = (int)MathHelper.Lerp(masterMode ? 5f : 3f, masterMode ? 12f : 10f, 1f - lifeRatio); + for (int i = 0; i < handAmount; i++) { - RandomizeInsanityShadowFor(Main.player[npc.target], isHostile: true, out var spawnposition, out var spawnvelocity, out var ai, out var ai2); + RandomizeInsanityShadowFor(Main.player[npc.target], death, isHostile: true, out var spawnposition, out var spawnvelocity, out var ai, out var ai2); Projectile.NewProjectile(npc.GetSource_FromAI(), spawnposition, spawnvelocity, shadowHand, shadowHandDamage, 0f, Main.myPlayer, ai, ai2); } } @@ -388,6 +400,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.TargetClosest(faceTarget: false); targetData = npc.GetTargetData(); + if (npc.timeLeft > 300) + npc.timeLeft = 300; + if (Main.netMode != NetmodeID.MultiplayerClient) { if (!ShouldRunAway(npc, ref targetData, isChasing: false)) @@ -503,7 +518,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } // Movement - Movement(npc, lifeRatio, haltMovement, goHome); + Movement(npc, lifeRatio, haltMovement, goHome, death); return false; } @@ -527,9 +542,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses return false; } - private static void SpawnPassiveShadowHands(NPC npc, float lifeRatio, int shadowHand, int shadowHandDamage) + private static void SpawnPassiveShadowHands(NPC npc, float lifeRatio, int shadowHand, int shadowHandDamage, bool death) { - int shadowHandSpawnRate = (int)Utils.Remap(lifeRatio, 1f, 0f, 80f, 40f); + int shadowHandSpawnRate = (int)Utils.Remap(lifeRatio, 1f, 0f, death ? 60f : 80f, death ? 30f : 40f); npc.localAI[2] += 1f; int shadowHandTimer = (int)npc.localAI[2]; if (shadowHandTimer % shadowHandSpawnRate != 0) @@ -545,7 +560,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { // Normal shadow hand spawn behavior // Modified to make the shadow hand spawns fair - RandomizeInsanityShadowFor(Main.player[i], isHostile: true, out var spawnPosition, out var spawnVelocity, out var ai, out var ai2); + RandomizeInsanityShadowFor(Main.player[i], death, isHostile: true, out var spawnPosition, out var spawnVelocity, out var ai, out var ai2); // Spawn hands to cut the player off and force them back towards Deerclops // This only happens if the player is triggering Deerclops' increased DR @@ -562,9 +577,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } } - private static void RandomizeInsanityShadowFor(Entity targetEntity, bool isHostile, out Vector2 spawnPosition, out Vector2 spawnVelocity, out float ai0, out float ai1) + private static void RandomizeInsanityShadowFor(Entity targetEntity, bool death, bool isHostile, out Vector2 spawnPosition, out Vector2 spawnVelocity, out float ai0, out float ai1) { - int spawnDirection = Main.rand.Next(2) * 2 - 1; + int spawnDirection = Main.rand.NextBool() ? 1 : -1; int shadowHandType = Main.rand.Next(4); float spawnDistance = (isHostile ? 450f : 225f); float velocityDivisor = (isHostile ? 30 : 20); @@ -581,13 +596,14 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses ai0 = 0f; ai1 = 0f; + int velocityAdd = death ? 2 : 0; if (shadowHandType == 1) { float rotation = (float)Math.PI * 2f * Main.rand.NextFloat(); spawnPosition = targetEntity.Center - rotation.ToRotationVector2() * spawnDistance; ai0 = 180f; ai1 = rotation - (float)Math.PI / 2f; - spawnVelocity = rotation.ToRotationVector2() * (isHostile ? 4 : 2); + spawnVelocity = rotation.ToRotationVector2() * (isHostile ? (4 + velocityAdd) : 2); } else if (shadowHandType == 2) { @@ -595,7 +611,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses spawnPosition = targetEntity.Center - rotation.ToRotationVector2() * spawnDistance; ai0 = 300f; ai1 = rotation; - spawnVelocity = rotation.ToRotationVector2() * (isHostile ? 4 : 2); + spawnVelocity = rotation.ToRotationVector2() * (isHostile ? (4 + velocityAdd) : 2); } else if (shadowHandType == 3) { @@ -606,7 +622,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (Vector2.Distance(spawnPosition, targetEntity.Center) < spawnDistance) spawnPosition = (spawnPosition - targetEntity.Center).SafeNormalize(Vector2.UnitY) * spawnDistance; - Vector2 vector = rotation.ToRotationVector2() * (isHostile ? 8 : 3); + Vector2 vector = rotation.ToRotationVector2() * (isHostile ? (8 + velocityAdd) : 3); for (int i = 0; (float)i < distance; i++) { spawnPosition -= vector; @@ -619,7 +635,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } } - private static void ShootRubbleUp(NPC npc, ref Point sourceTileCoords, int howMany, int distancedByThisManyTiles, int whichOne, int rubble, int rubbleDamage) + private static void ShootRubbleUp(NPC npc, ref Point sourceTileCoords, int howMany, int distancedByThisManyTiles, int whichOne, int rubble, int rubbleDamage, float lifeRatio, bool death) { // Loop to spawn rubble // The rubble attempts are used to offset the Y coordinates of the rubble spawns to make sure they can spawn in non-solid tiles @@ -631,22 +647,23 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses int posY = sourceTileCoords.Y + rubbleSpawnAttempts; if (WorldGen.ActiveAndWalkableTile(posX, posY)) { - SpawnRubble(npc, posX, posY, howMany, whichOne, rubble, rubbleDamage); + SpawnRubble(npc, posX, posY, howMany, whichOne, rubble, rubbleDamage, lifeRatio, death); break; } } } - private static void SpawnRubble(NPC npc, int posX, int posY, int howMany, int whichOne, int rubble, int rubbleDamage) + private static void SpawnRubble(NPC npc, int posX, int posY, int howMany, int whichOne, int rubble, int rubbleDamage, float lifeRatio, bool death) { Vector2 rubbleVelocity = new Vector2(0f, -1f).RotatedBy((float)(whichOne * npc.direction) * 0.7f * ((float)Math.PI / 4f / (float)howMany)); int ai1_FrameToUse = Main.rand.Next(Main.projFrames[rubble] * 4); ai1_FrameToUse = 6 + Main.rand.Next(6); - float ai2_DelayBeforeGoingUp = whichOne * 20f; + float delay = (int)MathHelper.Lerp(death ? 8f : 10f, death ? 16f : 20f, lifeRatio); + float ai2_DelayBeforeGoingUp = whichOne * delay; Projectile.NewProjectile(npc.GetSource_FromAI(), new Vector2(posX * 16 + 8, posY * 16 - 8), rubbleVelocity * 0.01f, rubble, rubbleDamage, 0f, Main.myPlayer, 0f, ai1_FrameToUse, ai2_DelayBeforeGoingUp); } - private static void MakeSpikesForward(NPC npc, int AISLOT_PhaseCounter, NPCAimedTarget targetData, int iceSpike, int iceSpikeDamage) + private static void MakeSpikesForward(NPC npc, int AISLOT_PhaseCounter, NPCAimedTarget targetData, int iceSpike, int iceSpikeDamage, float lifeRatio, bool death) { if (Main.netMode == NetmodeID.MultiplayerClient) return; @@ -655,7 +672,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (!(npc.ai[AISLOT_PhaseCounter] < (float)iceSpikeGateValue)) { Point sourceTileCoords = npc.Bottom.ToTileCoordinates(); - int numIceSpikes = 20; + int numIceSpikes = lifeRatio < 0.5f ? 15 : 20; int xOffsetMult = 1; sourceTileCoords.X += npc.direction * 3; int screenShakeGateValue = (int)npc.ai[AISLOT_PhaseCounter] - iceSpikeGateValue; @@ -673,12 +690,14 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses for (int i = iceSpikeStart; i < iceSpikeLimit && i < numIceSpikes; i++) { int xOffset = i * xOffsetMult; - TryMakingSpike(npc, ref sourceTileCoords, npc.direction, numIceSpikes, i, xOffset, iceSpike, iceSpikeDamage); + TryMakingSpike(npc, ref sourceTileCoords, npc.direction, numIceSpikes, i, xOffset, iceSpike, iceSpikeDamage, lifeRatio, death); + if (lifeRatio < 0.5f) + TryMakingSpike(npc, ref sourceTileCoords, npc.direction, numIceSpikes, i, xOffset * 2, iceSpike, iceSpikeDamage, lifeRatio, death); } } } - private static void MakeSpikesBothSides(NPC npc, int AISLOT_PhaseCounter, NPCAimedTarget targetData, int iceSpike, int iceSpikeDamage) + private static void MakeSpikesBothSides(NPC npc, int AISLOT_PhaseCounter, NPCAimedTarget targetData, int iceSpike, int iceSpikeDamage, float lifeRatio, bool death) { if (Main.netMode == NetmodeID.MultiplayerClient) return; @@ -687,7 +706,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (!(npc.ai[AISLOT_PhaseCounter] < (float)iceSpikeGateValue)) { Point sourceTileCoords = npc.Bottom.ToTileCoordinates(); - int numIceSpikes = 15; + int numIceSpikes = lifeRatio < 0.5f ? 12 : 15; int xOffsetMult = 1; int screenShakeGateValue = (int)npc.ai[AISLOT_PhaseCounter] - iceSpikeGateValue; if (screenShakeGateValue == 0) @@ -704,13 +723,18 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses for (int iceSpikeIndex = iceSpikeStart; iceSpikeIndex >= 0 && iceSpikeIndex < iceSpikeLimit && iceSpikeIndex < numIceSpikes; iceSpikeIndex++) { int xOffset = iceSpikeIndex * xOffsetMult; - TryMakingSpike(npc, ref sourceTileCoords, npc.direction, numIceSpikes, -iceSpikeIndex, xOffset, iceSpike, iceSpikeDamage); - TryMakingSpike(npc, ref sourceTileCoords, -npc.direction, numIceSpikes, -iceSpikeIndex, xOffset, iceSpike, iceSpikeDamage); + TryMakingSpike(npc, ref sourceTileCoords, npc.direction, numIceSpikes, -iceSpikeIndex, xOffset, iceSpike, iceSpikeDamage, lifeRatio, death); + TryMakingSpike(npc, ref sourceTileCoords, -npc.direction, numIceSpikes, -iceSpikeIndex, xOffset, iceSpike, iceSpikeDamage, lifeRatio, death); + if (lifeRatio < 0.5f) + { + TryMakingSpike(npc, ref sourceTileCoords, npc.direction, numIceSpikes, -iceSpikeIndex, xOffset * 2, iceSpike, iceSpikeDamage, lifeRatio, death); + TryMakingSpike(npc, ref sourceTileCoords, -npc.direction, numIceSpikes, -iceSpikeIndex, xOffset * 2, iceSpike, iceSpikeDamage, lifeRatio, death); + } } } } - private static void TryMakingSpike(NPC npc, ref Point sourceTileCoords, int dir, int howMany, int whichOne, int xOffset, int iceSpike, int iceSpikeDamage) + private static void TryMakingSpike(NPC npc, ref Point sourceTileCoords, int dir, int howMany, int whichOne, int xOffset, int iceSpike, int iceSpikeDamage, float lifeRatio, bool death) { int posX = sourceTileCoords.X + xOffset * dir; int posY = FindBestY(npc, ref sourceTileCoords, posX); @@ -718,7 +742,8 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { Vector2 iceSpikeSpawnPos = new Vector2(posX * 16 + 8, posY * 16 - 8); Vector2 iceSpikeVelocity = new Vector2(0f, -1f).RotatedBy((float)(whichOne * dir) * 0.7f * ((float)Math.PI / 4f / (float)howMany)); - Projectile.NewProjectile(npc.GetSource_FromAI(), iceSpikeSpawnPos, iceSpikeVelocity, iceSpike, iceSpikeDamage, 0f, Main.myPlayer, 0f, 0.1f + Main.rand.NextFloat() * 0.1f + (float)xOffset * 1.1f / (float)howMany); + float scaleIncrease = MathHelper.Lerp(0f, 0.55f, 1f - lifeRatio); + Projectile.NewProjectile(npc.GetSource_FromAI(), iceSpikeSpawnPos, iceSpikeVelocity, iceSpike, iceSpikeDamage, 0f, Main.myPlayer, 0f, 0.1f + Main.rand.NextFloat() * 0.1f + (float)xOffset * (1.1f + scaleIncrease) / (float)howMany); } } @@ -777,14 +802,13 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses return bestY; } - private static void Movement(NPC npc, float lifeRatio, bool haltMovement, bool goHome) + private static void Movement(NPC npc, float lifeRatio, bool haltMovement, bool goHome, bool death) { - float moveSpeedMultiplier = 1f - lifeRatio; - float moveSpeed = 3.5f + 1f * moveSpeedMultiplier; + float moveSpeed = MathHelper.Lerp(death ? 4f : 3.5f, death ? 6f : 5f, 1f - lifeRatio); float moveSpeedDivisor = 4f; - float yVelocityIncrease = -0.4f; - float yVelocityMin = -8f; - float yVelocityIncrease2 = 0.4f; + float yVelocityIncrease = death ? -0.5f : -0.4f; + float yVelocityMin = death ? -12f : -8f; + float yVelocityIncrease2 = death ? 0.5f : 0.4f; Rectangle targetHitbox = npc.GetTargetData().Hitbox; if (goHome) @@ -830,7 +854,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses bool insideTiles = Collision.SolidCollision(npcCenter, npcCenterXOffset, npcCenterYOffset, acceptTopSurfaces); bool insideTiles2 = Collision.SolidCollision(npcCenter, npcCenterXOffset, npcCenterYOffset - 4, acceptTopSurfaces); bool moveUp = !Collision.SolidCollision(npcCenter + new Vector2(npcCenterXOffset * npc.direction, 0f), 16, 80, acceptTopSurfaces); - float yVelocity = -8f; + float yVelocity = death ? -12f : -8f; if (insideTiles || insideTiles2) npc.localAI[0] = 0f; diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/DestroyerAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/DestroyerAI.cs new file mode 100644 index 0000000000..8b20d8af39 --- /dev/null +++ b/NPCs/VanillaNPCAIOverrides/Bosses/DestroyerAI.cs @@ -0,0 +1,2308 @@ +using System; +using CalamityMod.Events; +using CalamityMod.NPCs.NormalNPCs; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Boss; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses +{ + public static class DestroyerAI + { + public const float DRIncreaseTime = 600f; + public const float DeathModeLaserBreathGateValue = 600f; + public const float LaserTelegraphTime = 120f; + public const float SparkTelegraphTime = 30f; + public const float FlightPhaseGateValue = 900f; + public const float FlightPhaseResetGateValue = FlightPhaseGateValue * 2f; + private const float Phase4FlightPhaseTimerSetValue = FlightPhaseGateValue * 0.5f; + private const float Phase5FlightPhaseTimerSetValue = FlightPhaseGateValue; + public const float PhaseTransitionTelegraphTime = 180f; + public const float GroundTelegraphStartGateValue = FlightPhaseResetGateValue - PhaseTransitionTelegraphTime; + public const float FlightTelegraphStartGateValue = FlightPhaseGateValue - PhaseTransitionTelegraphTime; + private const int OneInXChanceToFireLaser = 200; + + public static bool BuffedDestroyerAI(NPC npc, Mod mod) + { + int mechdusaCurvedSpineSegmentIndex = 0; + int mechdusaCurvedSpineSegments = 10; + if (NPC.IsMechQueenUp && npc.type != NPCID.TheDestroyer) + { + int mechdusaIndex = (int)npc.ai[1]; + while (mechdusaIndex > 0 && mechdusaIndex < Main.maxNPCs) + { + if (Main.npc[mechdusaIndex].active && Main.npc[mechdusaIndex].type >= NPCID.TheDestroyer && Main.npc[mechdusaIndex].type <= NPCID.TheDestroyerTail) + { + mechdusaCurvedSpineSegmentIndex++; + if (Main.npc[mechdusaIndex].type == NPCID.TheDestroyer) + break; + + if (mechdusaCurvedSpineSegmentIndex >= mechdusaCurvedSpineSegments) + { + mechdusaCurvedSpineSegmentIndex = 0; + break; + } + + mechdusaIndex = (int)Main.npc[mechdusaIndex].ai[1]; + continue; + } + + mechdusaCurvedSpineSegmentIndex = 0; + break; + } + } + + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + + bool bossRush = BossRushEvent.BossRushActive; + bool masterMode = Main.masterMode || bossRush; + bool death = CalamityWorld.death || bossRush; + + // 10 seconds of resistance to prevent spawn killing + if (calamityGlobalNPC.newAI[1] < DRIncreaseTime) + calamityGlobalNPC.newAI[1] += 1f; + + calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = calamityGlobalNPC.newAI[1] < DRIncreaseTime; + + // Percent life remaining + float lifeRatio = npc.life / (float)npc.lifeMax; + + // Phases based on life percentage + bool phase2 = lifeRatio < 0.85f || masterMode; + bool phase3 = lifeRatio < 0.7f || masterMode; + bool startFlightPhase = lifeRatio < 0.5f; + bool phase4 = lifeRatio < (death ? 0.4f : 0.25f); + bool phase5 = lifeRatio < (death ? 0.2f : 0.1f); + + // Flight timer + if (startFlightPhase) + calamityGlobalNPC.newAI[3] += 1f; + + // Force the timer to be at a certain value in later phases + float flightPhaseTimerSetValue = phase5 ? Phase5FlightPhaseTimerSetValue : phase4 ? Phase4FlightPhaseTimerSetValue : 0f; + if (calamityGlobalNPC.newAI[3] < flightPhaseTimerSetValue) + calamityGlobalNPC.newAI[3] = flightPhaseTimerSetValue; + + // Return to ground phase, with less time spent in later phases + if (calamityGlobalNPC.newAI[3] >= FlightPhaseResetGateValue) + { + calamityGlobalNPC.newAI[3] = flightPhaseTimerSetValue; + npc.TargetClosest(); + } + + // Spawn DR check + bool hasSpawnDR = calamityGlobalNPC.newAI[1] < DRIncreaseTime && calamityGlobalNPC.newAI[1] > 60f; + + // Gradual color transition from ground to flight and vice versa + // 0f = Red, 1f = Purple + float phaseTransitionColorAmount = (hasSpawnDR || phase5) ? 1f : 0f; + if (!hasSpawnDR && !phase5) + { + if (calamityGlobalNPC.newAI[3] >= GroundTelegraphStartGateValue) + phaseTransitionColorAmount = MathHelper.Clamp(1f - (calamityGlobalNPC.newAI[3] - GroundTelegraphStartGateValue) / PhaseTransitionTelegraphTime, 0f, 1f); + else if (calamityGlobalNPC.newAI[3] >= FlightTelegraphStartGateValue) + phaseTransitionColorAmount = MathHelper.Clamp((calamityGlobalNPC.newAI[3] - FlightTelegraphStartGateValue) / PhaseTransitionTelegraphTime, 0f, 1f); + } + + // Set worm variable for worms + if (npc.ai[3] > 0f) + npc.realLife = (int)npc.ai[3]; + + // 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]; + + bool increaseSpeed = Vector2.Distance(player.Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles; + bool increaseSpeedMore = Vector2.Distance(player.Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance350Tiles; + + // Get a new target if current target is too far away + if (increaseSpeedMore && npc.type == NPCID.TheDestroyer) + npc.TargetClosest(); + + float enrageScale = bossRush ? 1f : 0f; + if (Main.IsItDay() || bossRush) + { + calamityGlobalNPC.CurrentlyEnraged = !bossRush; + enrageScale += 2f; + } + + // Phase for flying at the player + bool flyAtTarget = (calamityGlobalNPC.newAI[3] >= FlightPhaseGateValue && startFlightPhase) || hasSpawnDR; + + // Dust on spawn and alpha effects + if (npc.type == NPCID.TheDestroyer || (npc.type != NPCID.TheDestroyer && Main.npc[(int)npc.ai[1]].alpha < 128)) + { + if (npc.alpha != 0) + { + for (int i = 0; i < 2; i++) + { + int spawnDust = Dust.NewDust(npc.position, npc.width, npc.height, DustID.TheDestroyer, 0f, 0f, 100, default, 2f); + Main.dust[spawnDust].noGravity = true; + Main.dust[spawnDust].noLight = true; + } + } + + npc.alpha -= 42; + if (npc.alpha < 0) + npc.alpha = 0; + } + + // Check if other segments are still alive, if not, die + // Check for Oblivion too, since having a max power Destroyer during that fight would be turbo cancer + bool oblivionAlive = false; + if (npc.type > NPCID.TheDestroyer) + { + bool shouldDespawn = true; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active && Main.npc[i].type == NPCID.TheDestroyer) + { + shouldDespawn = false; + break; + } + } + if (!shouldDespawn) + { + if (npc.ai[1] <= 0f) + shouldDespawn = true; + else if (Main.npc[(int)npc.ai[1]].life <= 0) + shouldDespawn = true; + } + if (shouldDespawn) + { + npc.life = 0; + npc.HitEffect(0, 10.0); + npc.checkDead(); + npc.active = false; + } + } + else + { + if (masterMode && !bossRush && npc.localAI[3] != -1f) + { + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active && (Main.npc[i].type == ModContent.NPCType() || Main.npc[i].type == NPCID.SkeletronPrime)) + { + oblivionAlive = true; + break; + } + } + } + + // Set variable to force despawn when Prime dies in Master Rev+ + // Set to -1f if Prime isn't alive when summoned + if (npc.localAI[3] == 0f) + { + if (oblivionAlive) + npc.localAI[3] = 1f; + else + npc.localAI[3] = -1f; + + npc.SyncExtraAI(); + } + } + + // Total segment variable + int totalSegments = Main.getGoodWorld ? 100 : 80; + + // Calculate aggression based on how many broken segments there are + float brokenSegmentAggressionMultiplier = 1f; + if (npc.type == NPCID.TheDestroyer && !oblivionAlive) + { + int numProbeSegments = 0; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active && Main.npc[i].type == NPCID.TheDestroyerBody && Main.npc[i].ai[2] == 0f) + numProbeSegments++; + } + brokenSegmentAggressionMultiplier += (1f - MathHelper.Clamp(numProbeSegments / (float)totalSegments, 0f, 1f)) * 0.25f; + } + + // Death Mode laser spit bool + bool spitLaserSpreads = death; + + // Height of the box used to calculate whether The Destroyer should fly at its target or not + int noFlyZoneBoxHeight = masterMode ? 1500 : 1800; + + // Speed and movement variables + float speed = masterMode ? 0.2f : 0.1f; + float turnSpeed = masterMode ? 0.3f : 0.15f; + + // Max velocity + float segmentVelocity = flyAtTarget ? (masterMode ? 22.5f : 15f) : (masterMode ? 30f : 20f); + + // Increase velocity based on distance + float velocityMultiplier = increaseSpeedMore ? 2f : increaseSpeed ? 1.5f : 1f; + + // If Oblivion is alive, don't fly, don't spit laser spreads, use the default vanilla no fly zone, reduce segment count to 60, use base speed and use base turn speed + if (oblivionAlive) + { + calamityGlobalNPC.newAI[3] = 0f; + totalSegments = Main.getGoodWorld ? 75 : 60; + spitLaserSpreads = false; + noFlyZoneBoxHeight = 2000; + } + else + { + noFlyZoneBoxHeight -= death ? 400 : (int)(400f * (1f - lifeRatio)); + + float segmentVelocityBoost = death ? (flyAtTarget ? 4.5f : 6f) * (1f - lifeRatio) : (flyAtTarget ? 3f : 4f) * (1f - lifeRatio); + float speedBoost = death ? (flyAtTarget ? 0.1125f : 0.15f) * (1f - lifeRatio) : (flyAtTarget ? 0.075f : 0.1f) * (1f - lifeRatio); + float turnSpeedBoost = death ? 0.18f * (1f - lifeRatio) : 0.12f * (1f - lifeRatio); + + segmentVelocity += segmentVelocityBoost; + speed += speedBoost; + turnSpeed += turnSpeedBoost; + + segmentVelocity += 5f * enrageScale; + speed += 0.05f * enrageScale; + turnSpeed += 0.075f * enrageScale; + + if (flyAtTarget) + { + float speedMultiplier = phase5 ? 1.8f : phase4 ? 1.65f : 1.5f; + speed *= speedMultiplier; + } + + segmentVelocity *= velocityMultiplier; + speed *= velocityMultiplier; + turnSpeed *= velocityMultiplier; + + segmentVelocity *= brokenSegmentAggressionMultiplier; + speed *= brokenSegmentAggressionMultiplier; + turnSpeed *= brokenSegmentAggressionMultiplier; + + if (Main.getGoodWorld) + { + segmentVelocity *= 1.2f; + speed *= 1.2f; + turnSpeed *= 1.2f; + } + } + + bool probeLaunched = npc.ai[2] == 1f; + if (npc.type == NPCID.TheDestroyerBody) + { + // Enrage, fire more cyan lasers + if (enrageScale > 0f && !bossRush) + { + if (calamityGlobalNPC.newAI[2] < 480f) + calamityGlobalNPC.newAI[2] += 1f; + } + else + { + if (calamityGlobalNPC.newAI[2] > 0f) + calamityGlobalNPC.newAI[2] -= 1f; + } + + // Regenerate Probes in Master Mode if the number of Probes is less than 40 and the number of living NPCs is less than the segment count + 40 (this limit is here just in case) + if (masterMode && probeLaunched) + { + npc.localAI[2] += 1f; + if (npc.localAI[2] >= 600f) + { + int maxProbes = 40; + bool regenerateProbeSegment = NPC.CountNPCS(NPCID.Probe) < maxProbes; + if (regenerateProbeSegment) + { + int maxNPCs = totalSegments + maxProbes; + int numNPCs = 0; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active) + { + numNPCs++; + if (numNPCs >= maxNPCs) + { + regenerateProbeSegment = false; + break; + } + } + } + } + + if (regenerateProbeSegment) + { + npc.ai[2] = 0f; + npc.netUpdate = true; + } + + npc.localAI[2] = 0f; + npc.SyncVanillaLocalAI(); + } + } + } + + if (npc.type == NPCID.TheDestroyer) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + // Spawn segments from head + if (npc.ai[0] == 0f) + { + npc.ai[3] = npc.whoAmI; + npc.realLife = npc.whoAmI; + int index = npc.whoAmI; + for (int j = 0; j <= totalSegments; j++) + { + int type = NPCID.TheDestroyerBody; + if (j == totalSegments) + type = NPCID.TheDestroyerTail; + + int segment = NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X), (int)(npc.position.Y + npc.height), type, npc.whoAmI); + Main.npc[segment].ai[3] = npc.whoAmI; + Main.npc[segment].realLife = npc.whoAmI; + Main.npc[segment].ai[1] = index; + Main.npc[index].ai[0] = segment; + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, segment); + index = segment; + } + } + } + + // Laser breath in Death Mode + if (spitLaserSpreads) + { + // Set laser color and type + if (calamityGlobalNPC.destroyerLaserColor == -1) + { + calamityGlobalNPC.destroyerLaserColor = phase3 ? 3 : phase2 ? 2 : 1; + npc.SyncDestroyerLaserColor(); + } + + float laserBreathGateValue = DeathModeLaserBreathGateValue; + if (calamityGlobalNPC.newAI[0] < laserBreathGateValue) + calamityGlobalNPC.newAI[0] += 1f; + + // Sync newAI every 20 frames for the new telegraph + if (calamityGlobalNPC.newAI[0] % 20f == 0f) + npc.SyncExtraAI(); + + if ((player.Center - npc.Center).SafeNormalize(Vector2.UnitY).ToRotation().AngleTowards(npc.velocity.ToRotation(), MathHelper.PiOver4) == npc.velocity.ToRotation() && + calamityGlobalNPC.newAI[0] >= laserBreathGateValue && Vector2.Distance(npc.Center, player.Center) > 480f && + Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) + { + if (calamityGlobalNPC.newAI[0] % 30f == 0f) + { + float velocity = bossRush ? 6f : death ? 5.333f : 5f; + int type = ProjectileID.DeathLaser; + switch (calamityGlobalNPC.destroyerLaserColor) + { + default: + case 0: + break; + + case 1: + type = ModContent.ProjectileType(); + break; + + case 2: + type = ModContent.ProjectileType(); + break; + } + int damage = npc.GetProjectileDamage(type); + + // Reduce mech boss projectile damage depending on the new ore progression changes + if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + { + double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; + double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; + if (!NPC.downedMechBossAny) + damage = (int)(damage * firstMechMultiplier); + else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) + damage = (int)(damage * secondMechMultiplier); + } + + Vector2 projectileVelocity = (player.Center - npc.Center).SafeNormalize(Vector2.UnitY) * velocity; + int numProj = calamityGlobalNPC.newAI[0] % 60f == 0f ? (masterMode ? 9 : 7) : (masterMode ? 6 : 4); + int spread = masterMode ? 38 : 26; + float rotation = MathHelper.ToRadians(spread); + for (int i = 0; i < numProj; i++) + { + Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 100f, perturbedSpeed, type, damage, 0f, Main.myPlayer, 1f, 0f); + Main.projectile[proj].timeLeft = 1200; + } + } + } + + calamityGlobalNPC.newAI[0] += 1f; + if (calamityGlobalNPC.newAI[0] > laserBreathGateValue + 60f) + { + calamityGlobalNPC.newAI[0] = 0f; + calamityGlobalNPC.destroyerLaserColor = -1; + npc.SyncDestroyerLaserColor(); + npc.SyncExtraAI(); + } + } + } + } + + // Fire lasers + if (npc.type == NPCID.TheDestroyerBody) + { + bool ableToFireLaser = calamityGlobalNPC.destroyerLaserColor != -1; + + // Set laser color and type + if (calamityGlobalNPC.destroyerLaserColor == -1 && !probeLaunched) + { + if (Main.rand.NextBool(masterMode ? OneInXChanceToFireLaser / (phase5 ? 4 : phase4 ? 3 : 2) : OneInXChanceToFireLaser)) + { + int random = phase3 ? 4 : phase2 ? 3 : 2; + switch (Main.rand.Next(random)) + { + case 0: + case 1: + calamityGlobalNPC.destroyerLaserColor = 0; + break; + case 2: + calamityGlobalNPC.destroyerLaserColor = 1; + break; + case 3: + calamityGlobalNPC.destroyerLaserColor = 2; + break; + } + + if (calamityGlobalNPC.newAI[2] > 0f || bossRush) + calamityGlobalNPC.destroyerLaserColor = 2; + + npc.SyncDestroyerLaserColor(); + } + } + + if (probeLaunched && ableToFireLaser) + { + calamityGlobalNPC.destroyerLaserColor = -1; + npc.SyncDestroyerLaserColor(); + } + + // Laser rate of fire + float shootProjectileTime = death ? (masterMode ? (phase5 ? 120f : phase4 ? 150f : 180f) : 270f) : (masterMode ? (phase5 ? 150f : phase4 ? 210f : 270f) : 450f); + float bodySegmentTime = npc.ai[0] * (masterMode ? 20f : 30f); + float shootProjectileGateValue = bodySegmentTime + shootProjectileTime; + float laserTimerIncrement = (calamityGlobalNPC.newAI[0] > shootProjectileGateValue - LaserTelegraphTime) ? 1f : 2f; + if (ableToFireLaser) + calamityGlobalNPC.newAI[0] += laserTimerIncrement; + + // Sync newAI every 20 frames for the new telegraph + if (calamityGlobalNPC.newAI[0] % 20f == 0f && ableToFireLaser) + npc.SyncExtraAI(); + + Color telegraphColor = Color.Transparent; + switch (calamityGlobalNPC.destroyerLaserColor) + { + case 0: + telegraphColor = Color.Red; + break; + case 1: + telegraphColor = Color.Green; + break; + case 2: + telegraphColor = Color.Cyan; + break; + } + + if (calamityGlobalNPC.newAI[0] == shootProjectileGateValue - LaserTelegraphTime) + { + Particle telegraph = new DestroyerReticleTelegraph( + npc, + telegraphColor, + 1.5f, + 0.15f, + (int)LaserTelegraphTime); + GeneralParticleHandler.SpawnParticle(telegraph); + } + + if (calamityGlobalNPC.newAI[0] == shootProjectileGateValue - SparkTelegraphTime) + { + Particle spark = new DestroyerSparkTelegraph( + npc, + telegraphColor * 2f, + Color.White, + 3f, + 30, + Main.rand.NextFloat(MathHelper.ToRadians(3f)) * Main.rand.NextBool().ToDirectionInt()); + GeneralParticleHandler.SpawnParticle(spark); + } + + // Shoot lasers + // Shoot nothing if probe has been launched + if (calamityGlobalNPC.newAI[0] >= shootProjectileGateValue && ableToFireLaser) + { + if (!masterMode) + { + int numProbeSegments = 0; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active && Main.npc[i].type == npc.type && Main.npc[i].ai[2] == 0f) + numProbeSegments++; + } + float lerpAmount = MathHelper.Clamp(numProbeSegments / (float)totalSegments, 0f, 1f); + float laserShootTimeBonus = (int)MathHelper.Lerp(0f, (shootProjectileTime + bodySegmentTime * lerpAmount) - LaserTelegraphTime, 1f - lerpAmount); + calamityGlobalNPC.newAI[0] = laserShootTimeBonus; + npc.SyncExtraAI(); + npc.TargetClosest(); + } + + if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) + { + if (masterMode) + { + int numProbeSegments = 0; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active && Main.npc[i].type == npc.type && Main.npc[i].ai[2] == 0f) + numProbeSegments++; + } + float lerpAmount = MathHelper.Clamp(numProbeSegments / (float)totalSegments, 0f, 1f); + float laserShootTimeBonus = (int)MathHelper.Lerp(0f, (shootProjectileTime + bodySegmentTime * lerpAmount) - LaserTelegraphTime, 1f - lerpAmount); + calamityGlobalNPC.newAI[0] = laserShootTimeBonus; + npc.SyncExtraAI(); + npc.TargetClosest(); + } + + // Laser speed + float projectileSpeed = (masterMode ? 4.5f : 3.5f) + Main.rand.NextFloat() * 1.5f; + projectileSpeed += enrageScale; + + // Set projectile damage and type + int projectileType = ProjectileID.DeathLaser; + switch (calamityGlobalNPC.destroyerLaserColor) + { + default: + case 0: + break; + + case 1: + projectileType = ModContent.ProjectileType(); + break; + + case 2: + projectileType = ModContent.ProjectileType(); + break; + } + + // Get target vector + Vector2 projectileVelocity = (player.Center - npc.Center).SafeNormalize(Vector2.UnitY) * projectileSpeed; + Vector2 projectileSpawn = npc.Center + projectileVelocity.SafeNormalize(Vector2.UnitY) * 100f; + + // Shoot projectile + int damage = npc.GetProjectileDamage(projectileType); + + // Reduce mech boss projectile damage depending on the new ore progression changes + if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + { + double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; + double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; + if (!NPC.downedMechBossAny) + damage = (int)(damage * firstMechMultiplier); + else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) + damage = (int)(damage * secondMechMultiplier); + } + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), projectileSpawn, projectileVelocity, projectileType, damage, 0f, Main.myPlayer, 1f, 0f); + Main.projectile[proj].timeLeft = 1200; + } + + npc.netUpdate = true; + + if (masterMode) + { + calamityGlobalNPC.destroyerLaserColor = -1; + npc.SyncDestroyerLaserColor(); + } + } + + if (!masterMode) + { + calamityGlobalNPC.destroyerLaserColor = -1; + npc.SyncDestroyerLaserColor(); + } + } + } + + if (npc.type == NPCID.TheDestroyer) + { + if (npc.life > Main.npc[(int)npc.ai[0]].life) + npc.life = Main.npc[(int)npc.ai[0]].life; + } + else + { + if (npc.life > Main.npc[(int)npc.ai[1]].life) + npc.life = Main.npc[(int)npc.ai[1]].life; + } + + int tilePosX = (int)(npc.position.X / 16f) - 1; + int tileWidthPosX = (int)((npc.position.X + npc.width) / 16f) + 2; + int tilePosY = (int)(npc.position.Y / 16f) - 1; + int tileWidthPosY = (int)((npc.position.Y + npc.height) / 16f) + 2; + + if (tilePosX < 0) + tilePosX = 0; + if (tileWidthPosX > Main.maxTilesX) + tileWidthPosX = Main.maxTilesX; + if (tilePosY < 0) + tilePosY = 0; + if (tileWidthPosY > Main.maxTilesY) + tileWidthPosY = Main.maxTilesY; + + // Fly or not + bool shouldFly = flyAtTarget; + if (!shouldFly) + { + for (int k = tilePosX; k < tileWidthPosX; k++) + { + for (int l = tilePosY; l < tileWidthPosY; l++) + { + if (Main.tile[k, l] != null && ((Main.tile[k, l].HasUnactuatedTile && (Main.tileSolid[Main.tile[k, l].TileType] || (Main.tileSolidTop[Main.tile[k, l].TileType] && Main.tile[k, l].TileFrameY == 0))) || Main.tile[k, l].LiquidAmount > 64)) + { + Vector2 tileConvertedPosition; + tileConvertedPosition.X = k * 16; + tileConvertedPosition.Y = l * 16; + if (npc.position.X + npc.width > tileConvertedPosition.X && npc.position.X < tileConvertedPosition.X + 16f && npc.position.Y + npc.height > tileConvertedPosition.Y && npc.position.Y < tileConvertedPosition.Y + 16f) + { + shouldFly = true; + break; + } + } + } + } + } + + // Start flying if target is not within a certain distance + if (!shouldFly) + { + npc.localAI[1] = 1f; + + if (npc.type == NPCID.TheDestroyer) + { + Rectangle rectangle = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); + int noFlyZone = 1000; + bool outsideNoFlyZone = true; + + if (npc.position.Y > player.position.Y) + { + for (int m = 0; m < Main.maxPlayers; m++) + { + if (Main.player[m].active) + { + Rectangle noFlyRectangle = new Rectangle((int)Main.player[m].position.X - noFlyZone, (int)Main.player[m].position.Y - noFlyZone, noFlyZone * 2, noFlyZoneBoxHeight); + if (rectangle.Intersects(noFlyRectangle)) + { + outsideNoFlyZone = false; + break; + } + } + } + + if (outsideNoFlyZone) + shouldFly = true; + } + } + } + else + npc.localAI[1] = 0f; + + if (npc.type != NPCID.TheDestroyerBody || !probeLaunched) + { + Vector3 lightColor = Color.Red.ToVector3(); + int x = (int)((npc.position.X - 8f) / 16f); + int x2 = (int)((npc.position.X + npc.width + 8f) / 16f); + int y = (int)((npc.position.Y - 8f) / 16f); + int y2 = (int)((npc.position.Y + npc.height + 8f) / 16f); + for (int l = x; l <= x2; l++) + { + for (int m = y; m <= y2; m++) + { + if (Lighting.Brightness(l, m) == 0f) + lightColor = Color.Black.ToVector3(); + } + } + + if (lightColor != Color.Black.ToVector3()) + { + // Light colors + Vector3 groundColor = new Vector3(0.3f, 0.1f, 0.05f); + Vector3 flightColor = new Vector3(0.05f, 0.1f, 0.3f); + Vector3 segmentColor = Vector3.Lerp(groundColor, flightColor, phaseTransitionColorAmount); + Vector3 telegraphColor = groundColor; + + // Telegraph for the laser breath and body lasers + float telegraphProgress = 0f; + if (calamityGlobalNPC.destroyerLaserColor != -1) + { + if (npc.type == NPCID.TheDestroyer && spitLaserSpreads) + { + float telegraphGateValue = DeathModeLaserBreathGateValue - LaserTelegraphTime; + if (calamityGlobalNPC.newAI[0] > telegraphGateValue) + { + switch (calamityGlobalNPC.destroyerLaserColor) + { + default: + case 0: + break; + + case 1: + telegraphColor = new Vector3(0.1f, 0.3f, 0.05f); + break; + + case 2: + telegraphColor = new Vector3(0.05f, 0.2f, 0.2f); + break; + } + telegraphProgress = MathHelper.Clamp((calamityGlobalNPC.newAI[0] - telegraphGateValue) / LaserTelegraphTime, 0f, 1f); + } + } + else if (npc.type == NPCID.TheDestroyerBody) + { + float shootProjectileTime = (CalamityWorld.death || BossRushEvent.BossRushActive) ? 270f : 450f; + float bodySegmentTime = npc.ai[0] * 30f; + float shootProjectileGateValue = bodySegmentTime + shootProjectileTime; + float telegraphGateValue = shootProjectileGateValue - LaserTelegraphTime; + if (calamityGlobalNPC.newAI[0] > telegraphGateValue) + { + switch (calamityGlobalNPC.destroyerLaserColor) + { + default: + case 0: + break; + + case 1: + telegraphColor = new Vector3(0.1f, 0.3f, 0.05f); + break; + + case 2: + telegraphColor = new Vector3(0.05f, 0.2f, 0.2f); + break; + } + telegraphProgress = MathHelper.Clamp((calamityGlobalNPC.newAI[0] - telegraphGateValue) / LaserTelegraphTime, 0f, 1f); + } + } + } + + Lighting.AddLight(npc.Center, Vector3.Lerp(segmentColor, telegraphColor * 2f, telegraphProgress)); + } + } + + // Despawn + bool oblivionWasAlive = npc.localAI[3] == 1f && !oblivionAlive; + bool oblivionFightDespawn = (oblivionAlive && lifeRatio < 0.75f) || oblivionWasAlive; + if (player.dead || oblivionFightDespawn) + { + shouldFly = false; + npc.velocity.Y += 2f; + + if (npc.position.Y > Main.worldSurface * 16D) + { + npc.velocity.Y += 2f; + segmentVelocity *= 2f; + } + + if (npc.position.Y > Main.rockLayer * 16D) + { + for (int n = 0; n < Main.maxNPCs; n++) + { + if (Main.npc[n].aiStyle == npc.aiStyle) + Main.npc[n].active = false; + } + } + } + + Vector2 npcCenter = npc.Center; + float targetTilePosX = player.Center.X; + float targetTilePosY = player.Center.Y; + targetTilePosX = (int)(targetTilePosX / 16f) * 16; + targetTilePosY = (int)(targetTilePosY / 16f) * 16; + npcCenter.X = (int)(npcCenter.X / 16f) * 16; + npcCenter.Y = (int)(npcCenter.Y / 16f) * 16; + targetTilePosX -= npcCenter.X; + targetTilePosY -= npcCenter.Y; + float targetTileDist = (float)Math.Sqrt(targetTilePosX * targetTilePosX + targetTilePosY * targetTilePosY); + + if (npc.ai[1] > 0f && npc.ai[1] < Main.npc.Length) + { + int mechdusaSegmentScale = (int)(44f * npc.scale); + try + { + npcCenter = npc.Center; + targetTilePosX = Main.npc[(int)npc.ai[1]].Center.X - npcCenter.X; + targetTilePosY = Main.npc[(int)npc.ai[1]].Center.Y - npcCenter.Y; + } + catch + { + } + + if (mechdusaCurvedSpineSegmentIndex > 0) + { + float absoluteTilePosX = (float)mechdusaSegmentScale - (float)mechdusaSegmentScale * (((float)mechdusaCurvedSpineSegmentIndex - 1f) * 0.1f); + if (absoluteTilePosX < 0f) + absoluteTilePosX = 0f; + + if (absoluteTilePosX > (float)mechdusaSegmentScale) + absoluteTilePosX = mechdusaSegmentScale; + + targetTilePosY = Main.npc[(int)npc.ai[1]].Center.Y + absoluteTilePosX - npcCenter.Y; + } + + npc.rotation = (float)Math.Atan2(targetTilePosY, targetTilePosX) + MathHelper.PiOver2; + targetTileDist = (float)Math.Sqrt(targetTilePosX * targetTilePosX + targetTilePosY * targetTilePosY); + if (mechdusaCurvedSpineSegmentIndex > 0) + mechdusaSegmentScale = mechdusaSegmentScale / mechdusaCurvedSpineSegments * mechdusaCurvedSpineSegmentIndex; + + targetTileDist = (targetTileDist - mechdusaSegmentScale) / targetTileDist; + targetTilePosX *= targetTileDist; + targetTilePosY *= targetTileDist; + npc.velocity = Vector2.Zero; + npc.position.X += targetTilePosX; + npc.position.Y += targetTilePosY; + } + else + { + if (!shouldFly) + { + npc.velocity.Y += 0.15f; + if (masterMode && npc.velocity.Y > 0f && Math.Abs(npc.Center.Y - player.Center.Y) > 360f) + npc.velocity.Y += 0.05f; + + if (npc.velocity.Y > segmentVelocity) + npc.velocity.Y = segmentVelocity; + + // This bool exists to stop the strange wiggle behavior when worms are falling down + bool slowXVelocity = Math.Abs(npc.velocity.X) > speed; + if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < segmentVelocity * 0.4) + { + if (npc.velocity.X < 0f) + npc.velocity.X -= speed * 1.1f; + else + npc.velocity.X += speed * 1.1f; + } + else if (npc.velocity.Y == segmentVelocity) + { + if (slowXVelocity) + { + if (npc.velocity.X < targetTilePosX) + npc.velocity.X += speed; + else if (npc.velocity.X > targetTilePosX) + npc.velocity.X -= speed; + } + else + npc.velocity.X = 0f; + } + else if (npc.velocity.Y > 4f) + { + if (slowXVelocity) + { + if (npc.velocity.X < 0f) + npc.velocity.X += speed * 0.9f; + else + npc.velocity.X -= speed * 0.9f; + } + else + npc.velocity.X = 0f; + } + } + else + { + if (npc.soundDelay == 0) + { + float soundDelay = targetTileDist / 40f; + if (soundDelay < 10f) + soundDelay = 10f; + if (soundDelay > 20f) + soundDelay = 20f; + + npc.soundDelay = (int)soundDelay; + SoundEngine.PlaySound(SoundID.WormDig, npc.Center); + } + + targetTileDist = (float)Math.Sqrt(targetTilePosX * targetTilePosX + targetTilePosY * targetTilePosY); + float absoluteTilePosX = Math.Abs(targetTilePosX); + float absoluteTilePosY = Math.Abs(targetTilePosY); + float tileToReachTarget = segmentVelocity / targetTileDist; + targetTilePosX *= tileToReachTarget; + targetTilePosY *= tileToReachTarget; + + bool flyWyvernMovement = false; + if (flyAtTarget) + { + if (((npc.velocity.X > 0f && targetTilePosX < 0f) || (npc.velocity.X < 0f && targetTilePosX > 0f) || (npc.velocity.Y > 0f && targetTilePosY < 0f) || (npc.velocity.Y < 0f && targetTilePosY > 0f)) && Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) > speed / 2f && targetTileDist < 600f) + { + flyWyvernMovement = true; + + if (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) < segmentVelocity) + npc.velocity *= 1.1f; + } + + if (npc.position.Y > player.position.Y) + { + flyWyvernMovement = true; + + if (Math.Abs(npc.velocity.X) < segmentVelocity / 2f) + { + if (npc.velocity.X == 0f) + npc.velocity.X -= npc.direction; + + npc.velocity.X *= 1.1f; + } + else if (npc.velocity.Y > -segmentVelocity) + npc.velocity.Y -= speed; + } + } + + if (!flyWyvernMovement) + { + if (!flyAtTarget) + { + if (((npc.velocity.X > 0f && targetTilePosX > 0f) || (npc.velocity.X < 0f && targetTilePosX < 0f)) && ((npc.velocity.Y > 0f && targetTilePosY > 0f) || (npc.velocity.Y < 0f && targetTilePosY < 0f))) + { + if (npc.velocity.X < targetTilePosX) + npc.velocity.X += turnSpeed; + else if (npc.velocity.X > targetTilePosX) + npc.velocity.X -= turnSpeed; + if (npc.velocity.Y < targetTilePosY) + npc.velocity.Y += turnSpeed; + else if (npc.velocity.Y > targetTilePosY) + npc.velocity.Y -= turnSpeed; + } + } + + if ((npc.velocity.X > 0f && targetTilePosX > 0f) || (npc.velocity.X < 0f && targetTilePosX < 0f) || (npc.velocity.Y > 0f && targetTilePosY > 0f) || (npc.velocity.Y < 0f && targetTilePosY < 0f)) + { + if (npc.velocity.X < targetTilePosX) + npc.velocity.X += speed; + else if (npc.velocity.X > targetTilePosX) + npc.velocity.X -= speed; + if (npc.velocity.Y < targetTilePosY) + npc.velocity.Y += speed; + else if (npc.velocity.Y > targetTilePosY) + npc.velocity.Y -= speed; + + if (Math.Abs(targetTilePosY) < segmentVelocity * 0.2 && ((npc.velocity.X > 0f && targetTilePosX < 0f) || (npc.velocity.X < 0f && targetTilePosX > 0f))) + { + if (npc.velocity.Y > 0f) + npc.velocity.Y += speed * 2f; + else + npc.velocity.Y -= speed * 2f; + } + if (Math.Abs(targetTilePosX) < segmentVelocity * 0.2 && ((npc.velocity.Y > 0f && targetTilePosY < 0f) || (npc.velocity.Y < 0f && targetTilePosY > 0f))) + { + if (npc.velocity.X > 0f) + npc.velocity.X += speed * 2f; + else + npc.velocity.X -= speed * 2f; + } + } + else if (absoluteTilePosX > absoluteTilePosY) + { + if (npc.velocity.X < targetTilePosX) + npc.velocity.X += speed * 1.1f; + else if (npc.velocity.X > targetTilePosX) + npc.velocity.X -= speed * 1.1f; + + if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < segmentVelocity * 0.5) + { + if (npc.velocity.Y > 0f) + npc.velocity.Y += speed; + else + npc.velocity.Y -= speed; + } + } + else + { + if (npc.velocity.Y < targetTilePosY) + npc.velocity.Y += speed * 1.1f; + else if (npc.velocity.Y > targetTilePosY) + npc.velocity.Y -= speed * 1.1f; + + if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < segmentVelocity * 0.5) + { + if (npc.velocity.X > 0f) + npc.velocity.X += speed; + else + npc.velocity.X -= speed; + } + } + } + } + + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) + MathHelper.PiOver2; + + if (npc.type == NPCID.TheDestroyer) + { + if (shouldFly) + { + if (npc.localAI[0] != 1f) + npc.netUpdate = true; + + npc.localAI[0] = 1f; + } + else + { + if (npc.localAI[0] != 0f) + npc.netUpdate = true; + + npc.localAI[0] = 0f; + } + + if (((npc.velocity.X > 0f && npc.oldVelocity.X < 0f) || (npc.velocity.X < 0f && npc.oldVelocity.X > 0f) || (npc.velocity.Y > 0f && npc.oldVelocity.Y < 0f) || (npc.velocity.Y < 0f && npc.oldVelocity.Y > 0f)) && !npc.justHit) + npc.netUpdate = true; + } + } + + // Force the fucker to turn around in ground phase in Master + // Turns slower if Oblivion is alive, for fairness + if (npc.type == NPCID.TheDestroyer && masterMode && !flyAtTarget) + { + if (npc.Distance(player.Center) > 2000f) + npc.velocity += (player.Center - npc.Center).SafeNormalize(Vector2.UnitY) * (oblivionAlive ? speed : turnSpeed); + } + + if (NPC.IsMechQueenUp && npc.type == NPCID.TheDestroyer) + { + NPC nPC = Main.npc[NPC.mechQueen]; + Vector2 mechQueenCenter = nPC.GetMechQueenCenter(); + Vector2 mechdusaSpinningVector = new Vector2(0f, 100f); + Vector2 spinningpoint = mechQueenCenter + mechdusaSpinningVector; + float mechdusaRotation = nPC.velocity.X * 0.025f; + spinningpoint = spinningpoint.RotatedBy(mechdusaRotation, mechQueenCenter); + npc.position = spinningpoint - npc.Size / 2f + nPC.velocity; + npc.velocity.X = 0f; + npc.velocity.Y = 0f; + npc.rotation = mechdusaRotation * 0.75f + (float)Math.PI; + } + + // Calculate contact damage based on velocity + float minimalContactDamageVelocity = segmentVelocity * 0.25f; + float minimalDamageVelocity = segmentVelocity * 0.5f; + if (npc.type == NPCID.TheDestroyer) + { + if (npc.velocity.Length() <= minimalContactDamageVelocity) + { + npc.damage = (int)Math.Round(npc.defDamage * 0.5); + } + else + { + float velocityDamageScalar = MathHelper.Clamp((npc.velocity.Length() - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); + npc.damage = (int)MathHelper.Lerp((float)Math.Round(npc.defDamage * 0.5), npc.defDamage, velocityDamageScalar); + } + } + else + { + float bodyAndTailVelocity = (npc.position - npc.oldPosition).Length(); + if (bodyAndTailVelocity <= minimalContactDamageVelocity) + { + npc.damage = 0; + } + else + { + float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); + npc.damage = (int)MathHelper.Lerp(0f, npc.defDamage, velocityDamageScalar); + } + } + + return false; + } + + public static bool VanillaDestroyerAI(NPC npc, Mod mod) + { + int num = 0; + int num2 = 10; + if (NPC.IsMechQueenUp && npc.type != NPCID.TheDestroyer) + { + int num3 = (int)npc.ai[1]; + while (num3 > 0 && num3 < Main.maxNPCs) + { + if (Main.npc[num3].active && Main.npc[num3].type >= NPCID.TheDestroyer && Main.npc[num3].type <= NPCID.TheDestroyerTail) + { + num++; + if (Main.npc[num3].type == NPCID.TheDestroyer) + break; + + if (num >= num2) + { + num = 0; + break; + } + + num3 = (int)Main.npc[num3].ai[1]; + continue; + } + + num = 0; + break; + } + } + + // 10 seconds of resistance to prevent spawn killing + if (npc.Calamity().newAI[1] < DRIncreaseTime) + npc.Calamity().newAI[1] += 1f; + + npc.Calamity().CurrentlyIncreasingDefenseOrDR = npc.Calamity().newAI[1] < DRIncreaseTime; + + if (npc.ai[3] > 0f) + npc.realLife = (int)npc.ai[3]; + + if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead) + npc.TargetClosest(); + + if (npc.type >= NPCID.TheDestroyer && npc.type <= NPCID.TheDestroyerTail) + { + if (npc.type == NPCID.TheDestroyer || (npc.type != NPCID.TheDestroyer && Main.npc[(int)npc.ai[1]].alpha < 128)) + { + if (npc.alpha != 0) + { + for (int i = 0; i < 2; i++) + { + int num4 = Dust.NewDust(npc.position, npc.width, npc.height, DustID.TheDestroyer, 0f, 0f, 100, default(Color), 2f); + Main.dust[num4].noGravity = true; + Main.dust[num4].noLight = true; + } + } + + npc.alpha -= 42; + if (npc.alpha < 0) + npc.alpha = 0; + } + } + + if (npc.type > NPCID.TheDestroyer) + { + bool flag = false; + if (npc.ai[1] <= 0f) + flag = true; + else if (Main.npc[(int)npc.ai[1]].life <= 0) + flag = true; + + if (flag) + { + npc.life = 0; + npc.HitEffect(); + npc.checkDead(); + } + } + + int destroyerSegmentsCount = NPC.GetDestroyerSegmentsCount(); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (npc.ai[0] == 0f && npc.type == NPCID.TheDestroyer) + { + npc.ai[3] = npc.whoAmI; + npc.realLife = npc.whoAmI; + int num5 = 0; + int num6 = npc.whoAmI; + for (int j = 0; j <= destroyerSegmentsCount; j++) + { + int num7 = NPCID.TheDestroyerBody; + if (j == destroyerSegmentsCount) + num7 = NPCID.TheDestroyerTail; + + num5 = NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X), (int)(npc.position.Y + (float)npc.height), num7, npc.whoAmI); + Main.npc[num5].ai[3] = npc.whoAmI; + Main.npc[num5].realLife = npc.whoAmI; + Main.npc[num5].ai[1] = num6; + Main.npc[num6].ai[0] = num5; + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num5); + num6 = num5; + } + } + } + + if (npc.type == NPCID.TheDestroyerBody) + { + bool probeLaunched = npc.ai[2] == 1f; + bool ableToFireLaser = npc.Calamity().destroyerLaserColor != -1; + + if (npc.Calamity().destroyerLaserColor == -1 && !probeLaunched && Main.rand.NextBool(OneInXChanceToFireLaser)) + { + npc.Calamity().destroyerLaserColor = 0; + npc.SyncDestroyerLaserColor(); + } + + if (probeLaunched && ableToFireLaser) + { + npc.Calamity().destroyerLaserColor = -1; + npc.SyncDestroyerLaserColor(); + } + + float shootProjectileTime = Main.masterMode ? 500f : Main.expertMode ? 700f : 900f; + float bodySegmentTime = npc.ai[0] * 30f; + float shootProjectileGateValue = bodySegmentTime + shootProjectileTime; + + float laserTimerIncrement = (npc.localAI[0] > shootProjectileGateValue - LaserTelegraphTime) ? 1f : 2f; + if (ableToFireLaser) + npc.localAI[0] += laserTimerIncrement; + + // Sync newAI every 20 frames for the new telegraph + if (npc.localAI[0] % 20f == 0f && ableToFireLaser) + npc.SyncVanillaLocalAI(); + + Color telegraphColor = Color.Transparent; + switch (npc.Calamity().destroyerLaserColor) + { + case 0: + telegraphColor = Color.Red; + break; + case 1: + telegraphColor = Color.Green; + break; + case 2: + telegraphColor = Color.Cyan; + break; + } + + if (npc.localAI[0] == shootProjectileGateValue - LaserTelegraphTime) + { + Particle telegraph = new DestroyerReticleTelegraph( + npc, + telegraphColor, + 1.5f, + 0.15f, + (int)LaserTelegraphTime); + GeneralParticleHandler.SpawnParticle(telegraph); + } + + if (npc.localAI[0] == shootProjectileGateValue - SparkTelegraphTime) + { + Particle spark = new DestroyerSparkTelegraph( + npc, + telegraphColor * 2f, + Color.White, + 3f, + 30, + Main.rand.NextFloat(MathHelper.ToRadians(3f)) * Main.rand.NextBool().ToDirectionInt()); + GeneralParticleHandler.SpawnParticle(spark); + } + + if (npc.localAI[0] >= shootProjectileGateValue && ableToFireLaser) + { + int numProbeSegments = 0; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active && Main.npc[i].type == npc.type && Main.npc[i].ai[2] == 0f) + numProbeSegments++; + } + float lerpAmount = MathHelper.Clamp(numProbeSegments / (float)destroyerSegmentsCount, 0f, 1f); + float laserShootTimeBonus = (int)MathHelper.Lerp(0f, (shootProjectileTime + bodySegmentTime * lerpAmount) - LaserTelegraphTime, 1f - lerpAmount); + npc.localAI[0] = laserShootTimeBonus; + npc.SyncVanillaLocalAI(); + npc.TargetClosest(); + if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + float laserVelocity = (Main.masterMode ? 3.5f : Main.expertMode ? 3f : 2.5f) + Main.rand.NextFloat() * 1.5f; + Vector2 vector = npc.Center; + float num8 = Main.player[npc.target].Center.X - vector.X + (float)Main.rand.Next(-2, 3); + float num9 = Main.player[npc.target].Center.Y - vector.Y + (float)Main.rand.Next(-2, 3); + float num10 = (float)Math.Sqrt(num8 * num8 + num9 * num9); + num10 = laserVelocity / num10; + num8 *= num10; + num9 *= num10; + num8 += (float)Main.rand.Next(-2, 3) * 0.05f; + num9 += (float)Main.rand.Next(-2, 3) * 0.05f; + + int type = ProjectileID.DeathLaser; + int damage = npc.GetProjectileDamage(type); + + // Reduce mech boss projectile damage depending on the new ore progression changes + if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + { + double firstMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Classic; + double secondMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Classic; + if (!NPC.downedMechBossAny) + damage = (int)(damage * firstMechMultiplier); + else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) + damage = (int)(damage * secondMechMultiplier); + } + + Vector2 laserVelocityActual = new Vector2(num8, num9); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int num12 = Projectile.NewProjectile(npc.GetSource_FromAI(), vector + laserVelocityActual.SafeNormalize(Vector2.UnitY) * 100f, laserVelocityActual, type, damage, 0f, Main.myPlayer, 1f, 0f); + Main.projectile[num12].timeLeft = 1200; + } + + npc.netUpdate = true; + } + + npc.Calamity().destroyerLaserColor = -1; + npc.SyncDestroyerLaserColor(); + } + } + + if (npc.type == NPCID.TheDestroyer) + { + if (npc.life > Main.npc[(int)npc.ai[0]].life) + npc.life = Main.npc[(int)npc.ai[0]].life; + } + else + { + if (npc.life > Main.npc[(int)npc.ai[1]].life) + npc.life = Main.npc[(int)npc.ai[1]].life; + } + + // Calculate aggression based on how many broken segments there are + float brokenSegmentAggressionMultiplier = 1f; + if (npc.type == NPCID.TheDestroyer) + { + int numProbeSegments = 0; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active && Main.npc[i].type == NPCID.TheDestroyerBody && Main.npc[i].ai[2] == 0f) + numProbeSegments++; + } + brokenSegmentAggressionMultiplier += (1f - MathHelper.Clamp(numProbeSegments / (float)destroyerSegmentsCount, 0f, 1f)) * 0.25f; + } + + int num13 = (int)(npc.position.X / 16f) - 1; + int num14 = (int)((npc.position.X + (float)npc.width) / 16f) + 2; + int num15 = (int)(npc.position.Y / 16f) - 1; + int num16 = (int)((npc.position.Y + (float)npc.height) / 16f) + 2; + if (num13 < 0) + num13 = 0; + + if (num14 > Main.maxTilesX) + num14 = Main.maxTilesX; + + if (num15 < 0) + num15 = 0; + + if (num16 > Main.maxTilesY) + num16 = Main.maxTilesY; + + bool flag2 = false; + if (!flag2) + { + Vector2 vector2 = default(Vector2); + for (int k = num13; k < num14; k++) + { + for (int l = num15; l < num16; l++) + { + if (Main.tile[k, l] != null && ((Main.tile[k, l].HasUnactuatedTile && (Main.tileSolid[Main.tile[k, l].TileType] || (Main.tileSolidTop[Main.tile[k, l].TileType] && Main.tile[k, l].TileFrameY == 0))) || Main.tile[k, l].LiquidAmount > 64)) + { + vector2.X = k * 16; + vector2.Y = l * 16; + if (npc.position.X + (float)npc.width > vector2.X && npc.position.X < vector2.X + 16f && npc.position.Y + (float)npc.height > vector2.Y && npc.position.Y < vector2.Y + 16f) + { + flag2 = true; + break; + } + } + } + } + } + + if (!flag2) + { + if (npc.type != NPCID.TheDestroyerBody || npc.ai[2] != 1f) + { + Vector3 lightColor = Color.Red.ToVector3(); + int x = (int)((npc.position.X - 8f) / 16f); + int x2 = (int)((npc.position.X + npc.width + 8f) / 16f); + int y = (int)((npc.position.Y - 8f) / 16f); + int y2 = (int)((npc.position.Y + npc.height + 8f) / 16f); + for (int l = x; l <= x2; l++) + { + for (int m = y; m <= y2; m++) + { + if (Lighting.Brightness(l, m) == 0f) + lightColor = Color.Black.ToVector3(); + } + } + + if (lightColor != Color.Black.ToVector3()) + { + // Light colors + Vector3 groundColor = new Vector3(0.3f, 0.1f, 0.05f); + Vector3 segmentColor = groundColor; + Vector3 telegraphColor = groundColor; + + // Telegraph for the laser breath and body lasers + float telegraphProgress = 0f; + if (npc.Calamity().destroyerLaserColor != -1) + { + if (npc.type == NPCID.TheDestroyerBody) + { + float shootProjectileTime = Main.masterMode ? 500f : Main.expertMode ? 700f : 900f; + float bodySegmentTime = npc.ai[0] * 30f; + float shootProjectileGateValue = bodySegmentTime + shootProjectileTime; + float telegraphGateValue = shootProjectileGateValue - LaserTelegraphTime; + if (npc.localAI[0] > telegraphGateValue) + telegraphProgress = MathHelper.Clamp((npc.localAI[0] - telegraphGateValue) / LaserTelegraphTime, 0f, 1f); + } + } + + Lighting.AddLight(npc.Center, Vector3.Lerp(segmentColor, telegraphColor * 2f, telegraphProgress)); + } + } + + npc.localAI[1] = 1f; + if (npc.type == NPCID.TheDestroyer) + { + Rectangle rectangle = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); + int num17 = 1000; + int height = (num17 * 2) - (Main.masterMode ? 700 : Main.expertMode ? 400 : 0); + bool flag3 = true; + if (npc.position.Y > Main.player[npc.target].position.Y) + { + for (int m = 0; m < Main.maxPlayers; m++) + { + if (Main.player[m].active) + { + Rectangle rectangle2 = new Rectangle((int)Main.player[m].position.X - num17, (int)Main.player[m].position.Y - num17, num17 * 2, height); + if (rectangle.Intersects(rectangle2)) + { + flag3 = false; + break; + } + } + } + + if (flag3) + flag2 = true; + } + } + } + else + npc.localAI[1] = 0f; + + float num18 = (Main.masterMode ? 24f : Main.expertMode ? 20f : 16f) * brokenSegmentAggressionMultiplier; + if (Main.IsItDay() || Main.player[npc.target].dead) + { + flag2 = false; + npc.velocity.Y += 1f; + if ((double)npc.position.Y > Main.worldSurface * 16D) + { + npc.velocity.Y += 1f; + num18 *= 2f; + } + + if ((double)npc.position.Y > Main.rockLayer * 16D) + { + for (int n = 0; n < Main.maxNPCs; n++) + { + if (Main.npc[n].aiStyle == npc.aiStyle) + Main.npc[n].active = false; + } + } + } + + float num19 = 0.1f; + float num20 = 0.15f; + if (Main.expertMode) + { + num19 = Main.masterMode ? 0.2f : 0.15f; + num20 = Main.masterMode ? 0.3f : 0.225f; + } + + if (Main.getGoodWorld) + { + num19 *= 1.2f; + num20 *= 1.2f; + } + + num19 *= brokenSegmentAggressionMultiplier; + num20 *= brokenSegmentAggressionMultiplier; + + Vector2 vector3 = npc.Center; + float num21 = Main.player[npc.target].Center.X; + float num22 = Main.player[npc.target].Center.Y; + num21 = (int)(num21 / 16f) * 16; + num22 = (int)(num22 / 16f) * 16; + vector3.X = (int)(vector3.X / 16f) * 16; + vector3.Y = (int)(vector3.Y / 16f) * 16; + num21 -= vector3.X; + num22 -= vector3.Y; + float num23 = (float)Math.Sqrt(num21 * num21 + num22 * num22); + if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) + { + int num24 = (int)(44f * npc.scale); + try + { + vector3 = npc.Center; + num21 = Main.npc[(int)npc.ai[1]].Center.X - vector3.X; + num22 = Main.npc[(int)npc.ai[1]].Center.Y - vector3.Y; + } + catch + { + } + + if (num > 0) + { + float num25 = (float)num24 - (float)num24 * (((float)num - 1f) * 0.1f); + if (num25 < 0f) + num25 = 0f; + + if (num25 > (float)num24) + num25 = num24; + + num22 = Main.npc[(int)npc.ai[1]].Center.Y + num25 - vector3.Y; + } + + npc.rotation = (float)Math.Atan2(num22, num21) + MathHelper.PiOver2; + num23 = (float)Math.Sqrt(num21 * num21 + num22 * num22); + if (num > 0) + num24 = num24 / num2 * num; + + num23 = (num23 - (float)num24) / num23; + num21 *= num23; + num22 *= num23; + npc.velocity = Vector2.Zero; + npc.position.X += num21; + npc.position.Y += num22; + num21 = Main.npc[(int)npc.ai[1]].Center.X - vector3.X; + num22 = Main.npc[(int)npc.ai[1]].Center.Y - vector3.Y; + npc.rotation = (float)Math.Atan2(num22, num21) + MathHelper.PiOver2; + } + else + { + if (!flag2) + { + npc.TargetClosest(); + npc.velocity.Y += 0.15f; + if (Main.masterMode && npc.velocity.Y > 0f) + npc.velocity.Y += 0.05f; + + if (npc.velocity.Y > num18) + npc.velocity.Y = num18; + + // This bool exists to stop the strange wiggle behavior when worms are falling down + bool slowXVelocity = Math.Abs(npc.velocity.X) > num19; + if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)num18 * 0.4) + { + if (npc.velocity.X < 0f) + npc.velocity.X -= num19 * 1.1f; + else + npc.velocity.X += num19 * 1.1f; + } + else if (npc.velocity.Y == num18) + { + if (slowXVelocity) + { + if (npc.velocity.X < num21) + npc.velocity.X += num19; + else if (npc.velocity.X > num21) + npc.velocity.X -= num19; + } + else + npc.velocity.X = 0f; + } + else if (npc.velocity.Y > 4f) + { + if (slowXVelocity) + { + if (npc.velocity.X < 0f) + npc.velocity.X += num19 * 0.9f; + else + npc.velocity.X -= num19 * 0.9f; + } + else + npc.velocity.X = 0f; + } + } + else + { + if (npc.soundDelay == 0) + { + float num26 = num23 / 40f; + if (num26 < 10f) + num26 = 10f; + + if (num26 > 20f) + num26 = 20f; + + npc.soundDelay = (int)num26; + SoundEngine.PlaySound(SoundID.WormDig, npc.Center); + } + + num23 = (float)Math.Sqrt(num21 * num21 + num22 * num22); + float num27 = Math.Abs(num21); + float num28 = Math.Abs(num22); + float num29 = num18 / num23; + num21 *= num29; + num22 *= num29; + if (((npc.velocity.X > 0f && num21 > 0f) || (npc.velocity.X < 0f && num21 < 0f)) && ((npc.velocity.Y > 0f && num22 > 0f) || (npc.velocity.Y < 0f && num22 < 0f))) + { + if (npc.velocity.X < num21) + npc.velocity.X += num20; + else if (npc.velocity.X > num21) + npc.velocity.X -= num20; + + if (npc.velocity.Y < num22) + npc.velocity.Y += num20; + else if (npc.velocity.Y > num22) + npc.velocity.Y -= num20; + } + + if ((npc.velocity.X > 0f && num21 > 0f) || (npc.velocity.X < 0f && num21 < 0f) || (npc.velocity.Y > 0f && num22 > 0f) || (npc.velocity.Y < 0f && num22 < 0f)) + { + if (npc.velocity.X < num21) + npc.velocity.X += num19; + else if (npc.velocity.X > num21) + npc.velocity.X -= num19; + + if (npc.velocity.Y < num22) + npc.velocity.Y += num19; + else if (npc.velocity.Y > num22) + npc.velocity.Y -= num19; + + if ((double)Math.Abs(num22) < (double)num18 * 0.2 && ((npc.velocity.X > 0f && num21 < 0f) || (npc.velocity.X < 0f && num21 > 0f))) + { + if (npc.velocity.Y > 0f) + npc.velocity.Y += num19 * 2f; + else + npc.velocity.Y -= num19 * 2f; + } + + if ((double)Math.Abs(num21) < (double)num18 * 0.2 && ((npc.velocity.Y > 0f && num22 < 0f) || (npc.velocity.Y < 0f && num22 > 0f))) + { + if (npc.velocity.X > 0f) + npc.velocity.X += num19 * 2f; + else + npc.velocity.X -= num19 * 2f; + } + } + else if (num27 > num28) + { + if (npc.velocity.X < num21) + npc.velocity.X += num19 * 1.1f; + else if (npc.velocity.X > num21) + npc.velocity.X -= num19 * 1.1f; + + if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)num18 * 0.5) + { + if (npc.velocity.Y > 0f) + npc.velocity.Y += num19; + else + npc.velocity.Y -= num19; + } + } + else + { + if (npc.velocity.Y < num22) + npc.velocity.Y += num19 * 1.1f; + else if (npc.velocity.Y > num22) + npc.velocity.Y -= num19 * 1.1f; + + if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)num18 * 0.5) + { + if (npc.velocity.X > 0f) + npc.velocity.X += num19; + else + npc.velocity.X -= num19; + } + } + } + + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) + MathHelper.PiOver2; + if (npc.type == NPCID.TheDestroyer) + { + if (flag2) + { + if (npc.localAI[0] != 1f) + npc.netUpdate = true; + + npc.localAI[0] = 1f; + } + else + { + if (npc.localAI[0] != 0f) + npc.netUpdate = true; + + npc.localAI[0] = 0f; + } + + if (((npc.velocity.X > 0f && npc.oldVelocity.X < 0f) || (npc.velocity.X < 0f && npc.oldVelocity.X > 0f) || (npc.velocity.Y > 0f && npc.oldVelocity.Y < 0f) || (npc.velocity.Y < 0f && npc.oldVelocity.Y > 0f)) && !npc.justHit) + npc.netUpdate = true; + } + } + + if (NPC.IsMechQueenUp && npc.type == NPCID.TheDestroyer) + { + NPC nPC = Main.npc[NPC.mechQueen]; + Vector2 mechQueenCenter = nPC.GetMechQueenCenter(); + Vector2 vector4 = new Vector2(0f, 100f); + Vector2 spinningpoint = mechQueenCenter + vector4; + float num30 = nPC.velocity.X * 0.025f; + spinningpoint = spinningpoint.RotatedBy(num30, mechQueenCenter); + npc.position = spinningpoint - npc.Size / 2f + nPC.velocity; + npc.velocity.X = 0f; + npc.velocity.Y = 0f; + npc.rotation = num30 * 0.75f + (float)Math.PI; + } + + // Calculate contact damage based on velocity + float minimalContactDamageVelocity = num18 * 0.25f; + float minimalDamageVelocity = num18 * 0.5f; + if (npc.type == NPCID.TheDestroyer) + { + if (npc.velocity.Length() <= minimalContactDamageVelocity) + { + npc.damage = (int)Math.Round(npc.defDamage * 0.5); + } + else + { + float velocityDamageScalar = MathHelper.Clamp((npc.velocity.Length() - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); + npc.damage = (int)MathHelper.Lerp((float)Math.Round(npc.defDamage * 0.5), npc.defDamage, velocityDamageScalar); + } + } + else + { + float bodyAndTailVelocity = (npc.position - npc.oldPosition).Length(); + if (bodyAndTailVelocity <= minimalContactDamageVelocity) + { + npc.damage = 0; + } + else + { + float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); + npc.damage = (int)MathHelper.Lerp(0f, npc.defDamage, velocityDamageScalar); + } + } + + return false; + } + + public static bool BuffedProbeAI(NPC npc, Mod mod) + { + bool bossRush = BossRushEvent.BossRushActive; + bool masterMode = Main.masterMode || bossRush; + bool oblivionAlive = npc.ai[1] == 1f; + + // Get a target + if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) + npc.TargetClosest(); + + NPCAimedTarget targetData = npc.GetTargetData(); + bool targetDead = false; + if (targetData.Type == NPCTargetType.Player) + targetDead = Main.player[npc.target].dead; + + float velocity = bossRush ? 12f : masterMode ? 8.4f : 7.2f; + float acceleration = bossRush ? 0.1f : masterMode ? 0.07f : 0.06f; + + Vector2 probeCenter = npc.Center; + float probeTargetX = targetData.Center.X; + float probeTargetY = targetData.Center.Y; + probeTargetX = (int)(probeTargetX / 8f) * 8; + probeTargetY = (int)(probeTargetY / 8f) * 8; + probeCenter.X = (int)(probeCenter.X / 8f) * 8; + probeCenter.Y = (int)(probeCenter.Y / 8f) * 8; + probeTargetX -= probeCenter.X; + probeTargetY -= probeCenter.Y; + float distanceFromTarget = (float)Math.Sqrt(probeTargetX * probeTargetX + probeTargetY * probeTargetY); + float distance2 = distanceFromTarget; + + bool farAwayFromTarget = false; + if (distanceFromTarget > 600f) + farAwayFromTarget = true; + + if (distanceFromTarget == 0f) + { + probeTargetX = npc.velocity.X; + probeTargetY = npc.velocity.Y; + } + else + { + distanceFromTarget = velocity / distanceFromTarget; + probeTargetX *= distanceFromTarget; + probeTargetY *= distanceFromTarget; + } + + for (int i = 0; i < Main.maxNPCs; i++) + { + if (masterMode && !bossRush && npc.ai[1] == 0f) + { + if (Main.npc[i].active && (Main.npc[i].type == ModContent.NPCType() || Main.npc[i].type == NPCID.SkeletronPrime)) + npc.ai[1] = 1f; + } + + if (i != npc.whoAmI && Main.npc[i].active && Main.npc[i].type == npc.type) + { + Vector2 otherProbeDist = Main.npc[i].Center - npc.Center; + if (otherProbeDist.Length() < (npc.width + npc.height)) + { + otherProbeDist = otherProbeDist.SafeNormalize(Vector2.UnitY); + otherProbeDist *= -0.1f; + npc.velocity += otherProbeDist; + Main.npc[i].velocity -= otherProbeDist; + } + } + } + + if (distance2 > 100f) + { + npc.ai[0] += 1f; + if (npc.ai[0] > 0f) + npc.velocity.Y += 0.023f; + else + npc.velocity.Y -= 0.023f; + + if (npc.ai[0] < -100f || npc.ai[0] > 100f) + npc.velocity.X += 0.023f; + else + npc.velocity.X -= 0.023f; + + if (npc.ai[0] > 200f) + npc.ai[0] = -200f; + } + + if (targetDead) + { + probeTargetX = npc.direction * velocity / 2f; + probeTargetY = -velocity / 2f; + } + + if (npc.ai[3] != 0f) + { + if (NPC.IsMechQueenUp) + { + NPC nPC = Main.npc[NPC.mechQueen]; + Vector2 tileConvertedPosition = new Vector2(26f * npc.ai[3], 0f); + int mechdusaProbe = (int)npc.ai[2]; + if (mechdusaProbe < 0 || mechdusaProbe >= Main.maxNPCs) + { + mechdusaProbe = NPC.FindFirstNPC(NPCID.TheDestroyer); + npc.ai[2] = mechdusaProbe; + npc.netUpdate = true; + } + + if (mechdusaProbe > -1) + { + NPC nPC2 = Main.npc[mechdusaProbe]; + if (!nPC2.active || nPC2.type != NPCID.TheDestroyer) + { + npc.dontTakeDamage = false; + if (npc.ai[3] > 0f) + npc.netUpdate = true; + + npc.ai[3] = 0f; + } + else + { + Vector2 spinningpoint = nPC2.Center + tileConvertedPosition; + spinningpoint = spinningpoint.RotatedBy(nPC2.rotation, nPC2.Center); + npc.Center = spinningpoint; + npc.velocity = nPC.velocity; + npc.dontTakeDamage = true; + } + } + else + { + npc.dontTakeDamage = false; + if (npc.ai[3] > 0f) + npc.netUpdate = true; + + npc.ai[3] = 0f; + } + } + else + { + npc.dontTakeDamage = false; + if (npc.ai[3] > 0f) + npc.netUpdate = true; + + npc.ai[3] = 0f; + } + } + else + { + npc.dontTakeDamage = false; + + if (npc.velocity.X < probeTargetX) + npc.velocity.X += acceleration; + else if (npc.velocity.X > probeTargetX) + npc.velocity.X -= acceleration; + + if (npc.velocity.Y < probeTargetY) + npc.velocity.Y += acceleration; + else if (npc.velocity.Y > probeTargetY) + npc.velocity.Y -= acceleration; + } + + npc.localAI[0] += 1f; + if (npc.justHit && !masterMode) + npc.localAI[0] = 0f; + + float laserGateValue = NPC.IsMechQueenUp ? 360f : bossRush ? 150f : 240f; + if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] >= laserGateValue) + { + npc.localAI[0] = 0f; + if (targetData.Type != 0 && Collision.CanHit(npc.position, npc.width, npc.height, targetData.Position, targetData.Width, targetData.Height)) + { + int type = ProjectileID.PinkLaser; + int damage = npc.GetProjectileDamage(type); + + // Reduce mech boss projectile damage depending on the new ore progression changes + if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + { + double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; + double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; + if (!NPC.downedMechBossAny) + damage = (int)(damage * firstMechMultiplier); + else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) + damage = (int)(damage * secondMechMultiplier); + } + + int totalProjectiles = oblivionAlive ? 2 : (CalamityWorld.death || bossRush) ? 3 : 1; + Vector2 npcCenter = new Vector2(probeTargetX, probeTargetY); + if (NPC.IsMechQueenUp) + { + Vector2 v = targetData.Center - npc.Center - targetData.Velocity * 20f; + float projectileVelocity = 8f; + npcCenter = v.SafeNormalize(Vector2.UnitY) * projectileVelocity; + } + for (int i = 0; i < totalProjectiles; i++) + { + float velocityMultiplier = 1f; + switch (i) + { + case 0: + break; + case 1: + velocityMultiplier = 0.9f; + break; + case 2: + velocityMultiplier = 0.8f; + break; + } + Vector2 laserVelocity = npcCenter * velocityMultiplier; + Projectile.NewProjectile(npc.GetSource_FromAI(), probeCenter + laserVelocity.SafeNormalize(Vector2.UnitY) * 50f, laserVelocity, type, damage, 0f, Main.myPlayer); + } + + npc.netUpdate = true; + } + } + + int x = (int)npc.Center.X / 16; + int y = (int)npc.Center.Y / 16; + if (WorldGen.InWorld(x, y) && !WorldGen.SolidTile(x, y)) + Lighting.AddLight((int)(npc.Center.X / 16f), (int)(npc.Center.Y / 16f), 0.3f, 0.1f, 0.05f); + + if (probeTargetX > 0f) + { + npc.spriteDirection = 1; + npc.rotation = (float)Math.Atan2(probeTargetY, probeTargetX); + } + if (probeTargetX < 0f) + { + npc.spriteDirection = -1; + npc.rotation = (float)Math.Atan2(probeTargetY, probeTargetX) + MathHelper.Pi; + } + + float tilePosX = -0.7f; + if (npc.collideX) + { + npc.netUpdate = true; + npc.velocity.X = npc.oldVelocity.X * tilePosX; + if (npc.direction == -1 && npc.velocity.X > 0f && npc.velocity.X < 2f) + npc.velocity.X = 2f; + if (npc.direction == 1 && npc.velocity.X < 0f && npc.velocity.X > -2f) + npc.velocity.X = -2f; + } + + if (npc.collideY) + { + npc.netUpdate = true; + npc.velocity.Y = npc.oldVelocity.Y * tilePosX; + if (npc.velocity.Y > 0f && npc.velocity.Y < 1.5) + npc.velocity.Y = 2f; + if (npc.velocity.Y < 0f && npc.velocity.Y > -1.5) + npc.velocity.Y = -2f; + } + + if (farAwayFromTarget) + { + if ((npc.velocity.X > 0f && probeTargetX > 0f) || (npc.velocity.X < 0f && probeTargetX < 0f)) + { + if (Math.Abs(npc.velocity.X) < (NPC.IsMechQueenUp ? 5f : 12f)) + npc.velocity.X *= 1.05f; + } + else + npc.velocity.X *= 0.9f; + } + + if (NPC.IsMechQueenUp && npc.ai[2] == 0f) + { + Vector2 center = npc.GetTargetData().Center; + Vector2 v2 = center - npc.Center; + if (v2.Length() < 120f) + npc.Center = center - v2.SafeNormalize(Vector2.UnitY) * 120; + } + + if (targetDead) + { + npc.velocity.Y -= acceleration * 2f; + if (npc.timeLeft > 10) + npc.timeLeft = 10; + } + + if (((npc.velocity.X > 0f && npc.oldVelocity.X < 0f) || (npc.velocity.X < 0f && npc.oldVelocity.X > 0f) || (npc.velocity.Y > 0f && npc.oldVelocity.Y < 0f) || (npc.velocity.Y < 0f && npc.oldVelocity.Y > 0f)) && !npc.justHit) + npc.netUpdate = true; + + return false; + } + + public static bool VanillaProbeAI(NPC npc, Mod mod) + { + if (npc.target < 0 || npc.target <= Main.maxPlayers || Main.player[npc.target].dead) + npc.TargetClosest(); + + NPCAimedTarget targetData = npc.GetTargetData(); + bool flag = false; + if (targetData.Type == NPCTargetType.Player) + flag = Main.player[npc.target].dead; + + float num = Main.zenithWorld ? 3f : Main.expertMode ? 7.2f : 6f; + float num2 = Main.expertMode ? 0.06f : 0.05f; + + Vector2 vector = npc.Center; + float num4 = targetData.Center.X; + float num5 = targetData.Center.Y; + num4 = (int)(num4 / 8f) * 8; + num5 = (int)(num5 / 8f) * 8; + vector.X = (int)(vector.X / 8f) * 8; + vector.Y = (int)(vector.Y / 8f) * 8; + num4 -= vector.X; + num5 -= vector.Y; + float num6 = (float)Math.Sqrt(num4 * num4 + num5 * num5); + float num7 = num6; + bool flag2 = false; + if (num6 > 600f) + flag2 = true; + + if (num6 == 0f) + { + num4 = npc.velocity.X; + num5 = npc.velocity.Y; + } + else + { + num6 = num / num6; + num4 *= num6; + num5 *= num6; + } + + if (num7 > 100f) + { + npc.ai[0] += 1f; + if (npc.ai[0] > 0f) + npc.velocity.Y += 0.023f; + else + npc.velocity.Y -= 0.023f; + + if (npc.ai[0] < -100f || npc.ai[0] > 100f) + npc.velocity.X += 0.023f; + else + npc.velocity.X -= 0.023f; + + if (npc.ai[0] > 200f) + npc.ai[0] = -200f; + } + + if (flag) + { + num4 = (float)npc.direction * num / 2f; + num5 = (0f - num) / 2f; + } + + if (npc.ai[3] != 0f) + { + if (NPC.IsMechQueenUp) + { + NPC nPC = Main.npc[NPC.mechQueen]; + Vector2 vector2 = new Vector2(26f * npc.ai[3], 0f); + int num9 = (int)npc.ai[2]; + if (num9 < 0 || num9 >= Main.maxNPCs) + { + num9 = NPC.FindFirstNPC(NPCID.TheDestroyer); + npc.ai[2] = num9; + npc.netUpdate = true; + } + + if (num9 > -1) + { + NPC nPC2 = Main.npc[num9]; + if (!nPC2.active || nPC2.type != NPCID.TheDestroyer) + { + npc.dontTakeDamage = false; + if (npc.ai[3] > 0f) + npc.netUpdate = true; + + npc.ai[3] = 0f; + } + else + { + Vector2 spinningpoint = nPC2.Center + vector2; + spinningpoint = spinningpoint.RotatedBy(nPC2.rotation, nPC2.Center); + npc.Center = spinningpoint; + npc.velocity = nPC.velocity; + npc.dontTakeDamage = true; + } + } + else + { + npc.dontTakeDamage = false; + if (npc.ai[3] > 0f) + npc.netUpdate = true; + + npc.ai[3] = 0f; + } + } + else + { + npc.dontTakeDamage = false; + if (npc.ai[3] > 0f) + npc.netUpdate = true; + + npc.ai[3] = 0f; + } + } + else + { + npc.dontTakeDamage = false; + + if (npc.velocity.X < num4) + npc.velocity.X += num2; + else if (npc.velocity.X > num4) + npc.velocity.X -= num2; + + if (npc.velocity.Y < num5) + npc.velocity.Y += num2; + else if (npc.velocity.Y > num5) + npc.velocity.Y -= num2; + } + + npc.localAI[0] += 1f; + if (npc.ai[3] != 0f) + npc.localAI[0] += 2f; + + if (npc.justHit && !Main.masterMode) + npc.localAI[0] = 0f; + + float num10 = 120f; + if (NPC.IsMechQueenUp) + num10 = 360f; + + if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] >= num10) + { + npc.localAI[0] = 0f; + if (targetData.Type != 0 && Collision.CanHit(npc, targetData)) + { + int type = ProjectileID.PinkLaser; + int damage = npc.GetProjectileDamage(type); + + // Reduce mech boss projectile damage depending on the new ore progression changes + if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + { + double firstMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Classic; + double secondMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Classic; + if (!NPC.downedMechBossAny) + damage = (int)(damage * firstMechMultiplier); + else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) + damage = (int)(damage * secondMechMultiplier); + } + + Vector2 vector3 = new Vector2(num4, num5); + if (NPC.IsMechQueenUp) + { + Vector2 v = targetData.Center - npc.Center - targetData.Velocity * 20f; + float num12 = 8f; + vector3 = v.SafeNormalize(Vector2.UnitY) * num12; + } + + Projectile.NewProjectile(npc.GetSource_FromAI(), vector + vector3.SafeNormalize(Vector2.UnitY) * 50f, vector3, type, damage, 0f, Main.myPlayer); + } + } + + int num13 = (int)npc.Center.X; + int num14 = (int)npc.Center.Y; + num13 /= 16; + num14 /= 16; + if (WorldGen.InWorld(num13, num14) && !WorldGen.SolidTile(num13, num14)) + Lighting.AddLight((int)(npc.Center.X / 16f), (int)(npc.Center.Y / 16f), 0.3f, 0.1f, 0.05f); + + if (num4 > 0f) + { + npc.spriteDirection = 1; + npc.rotation = (float)Math.Atan2(num5, num4); + } + + if (num4 < 0f) + { + npc.spriteDirection = -1; + npc.rotation = (float)Math.Atan2(num5, num4) + MathHelper.Pi; + } + + float num15 = 0.7f; + if (npc.collideX) + { + npc.netUpdate = true; + npc.velocity.X = npc.oldVelocity.X * (0f - num15); + if (npc.direction == -1 && npc.velocity.X > 0f && npc.velocity.X < 2f) + npc.velocity.X = 2f; + + if (npc.direction == 1 && npc.velocity.X < 0f && npc.velocity.X > -2f) + npc.velocity.X = -2f; + } + + if (npc.collideY) + { + npc.netUpdate = true; + npc.velocity.Y = npc.oldVelocity.Y * (0f - num15); + if (npc.velocity.Y > 0f && (double)npc.velocity.Y < 1.5) + npc.velocity.Y = 2f; + + if (npc.velocity.Y < 0f && (double)npc.velocity.Y > -1.5) + npc.velocity.Y = -2f; + } + + if (flag2) + { + if ((npc.velocity.X > 0f && num4 > 0f) || (npc.velocity.X < 0f && num4 < 0f)) + { + int num27 = 12; + if (NPC.IsMechQueenUp) + num27 = 5; + + if (Math.Abs(npc.velocity.X) < (float)num27) + npc.velocity.X *= 1.05f; + } + else + npc.velocity.X *= 0.9f; + } + + if (NPC.IsMechQueenUp && npc.ai[2] == 0f) + { + Vector2 center = npc.GetTargetData().Center; + Vector2 v2 = center - npc.Center; + int num28 = 120; + if (v2.Length() < (float)num28) + npc.Center = center - v2.SafeNormalize(Vector2.UnitY) * num28; + } + + if (Main.IsItDay() || flag) + { + npc.velocity.Y -= num2 * 2f; + npc.EncourageDespawn(10); + } + + if (((npc.velocity.X > 0f && npc.oldVelocity.X < 0f) || (npc.velocity.X < 0f && npc.oldVelocity.X > 0f) || (npc.velocity.Y > 0f && npc.oldVelocity.Y < 0f) || (npc.velocity.Y < 0f && npc.oldVelocity.Y > 0f)) && !npc.justHit) + npc.netUpdate = true; + + return false; + } + } +} diff --git a/NPCs/VanillaNPCOverrides/Bosses/DreadnautilusAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/DreadnautilusAI.cs similarity index 95% rename from NPCs/VanillaNPCOverrides/Bosses/DreadnautilusAI.cs rename to NPCs/VanillaNPCAIOverrides/Bosses/DreadnautilusAI.cs index e7b1f039f3..b97169ace4 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/DreadnautilusAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/DreadnautilusAI.cs @@ -1,13 +1,13 @@ -using CalamityMod.World; +using System; +using CalamityMod.World; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses +namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { public static class DreadnautilusAI { @@ -44,7 +44,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.ai[0] != -1f && Main.rand.NextBool(4)) { npc.position += npc.netOffset; - Dust dust = Dust.NewDustDirect(npc.position + new Vector2(5f), npc.width - 10, npc.height - 10, 5); + Dust dust = Dust.NewDustDirect(npc.position + new Vector2(5f), npc.width - 10, npc.height - 10, DustID.Blood); dust.velocity *= 0.5f; if (dust.velocity.Y < 0f) dust.velocity.Y *= -1f; @@ -95,7 +95,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.position += npc.netOffset; Vector2 dustRotation = (Vector2.Normalize(npc.velocity) * new Vector2(npc.width / 2f, npc.height) * 0.75f * 0.5f).RotatedBy((l - (dustAmt / 2 - 1)) * ((float)Math.PI * 2f) / dustAmt) + npc.Center; Vector2 dustVelocity = dustRotation - npc.Center; - int spawnDustBlood = Dust.NewDust(dustRotation + dustVelocity, 0, 0, 5, dustVelocity.X * 2f, dustVelocity.Y * 2f, 100, default, 1.4f); + int spawnDustBlood = Dust.NewDust(dustRotation + dustVelocity, 0, 0, DustID.Blood, dustVelocity.X * 2f, dustVelocity.Y * 2f, 100, default, 1.4f); Main.dust[spawnDustBlood].noGravity = true; Main.dust[spawnDustBlood].velocity = Vector2.Normalize(dustVelocity) * 3f; npc.position -= npc.netOffset; @@ -201,11 +201,11 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.rotation = npc.rotation.AngleLerp(chargeFaceDirection, 0.02f); npc.position += npc.netOffset; npc.BloodNautilus_GetMouthPositionAndRotation(out Vector2 mouthPosition4, out Vector2 mouthDirection4); - Dust chargeUpDust = Dust.NewDustDirect(mouthPosition4 + mouthDirection4 * 60f - new Vector2(40f), 80, 80, 16, 0f, 0f, 150, Color.Transparent, 0.6f); + Dust chargeUpDust = Dust.NewDustDirect(mouthPosition4 + mouthDirection4 * 60f - new Vector2(40f), 80, 80, DustID.Cloud, 0f, 0f, 150, Color.Transparent, 0.6f); chargeUpDust.fadeIn = 1f; chargeUpDust.velocity = chargeUpDust.position.DirectionTo(mouthPosition4 + Main.rand.NextVector2Circular(15f, 15f)) * chargeUpDust.velocity.Length(); chargeUpDust.noGravity = true; - chargeUpDust = Dust.NewDustDirect(mouthPosition4 + mouthDirection4 * 100f - new Vector2(30f), 60, 60, 16, 0f, 0f, 100, Color.Transparent, 0.9f); + chargeUpDust = Dust.NewDustDirect(mouthPosition4 + mouthDirection4 * 100f - new Vector2(30f), 60, 60, DustID.Cloud, 0f, 0f, 100, Color.Transparent, 0.9f); chargeUpDust.fadeIn = 1.5f; chargeUpDust.velocity = chargeUpDust.position.DirectionTo(mouthPosition4 + Main.rand.NextVector2Circular(15f, 15f)) * (chargeUpDust.velocity.Length() + 5f); chargeUpDust.noGravity = true; @@ -228,10 +228,10 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses for (int m = 0; m < 4; m++) { - Dust chargeBloodDust = Dust.NewDustDirect(mouthPosition5 + mouthDirection5 * 60f - new Vector2(15f), 30, 30, 5, 0f, 0f, 0, Color.Transparent, 1.5f); + Dust chargeBloodDust = Dust.NewDustDirect(mouthPosition5 + mouthDirection5 * 60f - new Vector2(15f), 30, 30, DustID.Blood, 0f, 0f, 0, Color.Transparent, 1.5f); chargeBloodDust.velocity = chargeBloodDust.position.DirectionFrom(mouthPosition5 + Main.rand.NextVector2Circular(5f, 5f)) * chargeBloodDust.velocity.Length(); chargeBloodDust.position -= mouthDirection5 * 60f; - chargeBloodDust = Dust.NewDustDirect(mouthPosition5 + mouthDirection5 * 100f - new Vector2(20f), 40, 40, 5, 0f, 0f, 100, Color.Transparent, 1.5f); + chargeBloodDust = Dust.NewDustDirect(mouthPosition5 + mouthDirection5 * 100f - new Vector2(20f), 40, 40, DustID.Blood, 0f, 0f, 100, Color.Transparent, 1.5f); chargeBloodDust.velocity = chargeBloodDust.position.DirectionFrom(mouthPosition5 + Main.rand.NextVector2Circular(10f, 10f)) * (chargeBloodDust.velocity.Length() + 5f); chargeBloodDust.position -= mouthDirection5 * 100f; } @@ -267,13 +267,13 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.position += npc.netOffset; npc.velocity *= 0.95f; npc.BloodNautilus_GetMouthPositionAndRotation(out Vector2 mouthPosition2, out Vector2 mouthDirection2); - if (Main.rand.Next(4) != 0) + if (!Main.rand.NextBool(4)) { - Dust bloodProjChargeUpDust = Dust.NewDustDirect(mouthPosition2 + mouthDirection2 * 60f - new Vector2(60f), 120, 120, 16, 0f, 0f, 150, Color.Transparent, 0.6f); + Dust bloodProjChargeUpDust = Dust.NewDustDirect(mouthPosition2 + mouthDirection2 * 60f - new Vector2(60f), 120, 120, DustID.Cloud, 0f, 0f, 150, Color.Transparent, 0.6f); bloodProjChargeUpDust.fadeIn = 1f; bloodProjChargeUpDust.velocity = bloodProjChargeUpDust.position.DirectionTo(mouthPosition2 + Main.rand.NextVector2Circular(15f, 15f)) * (bloodProjChargeUpDust.velocity.Length() + 3f); bloodProjChargeUpDust.noGravity = true; - bloodProjChargeUpDust = Dust.NewDustDirect(mouthPosition2 + mouthDirection2 * 100f - new Vector2(80f), 160, 160, 16, 0f, 0f, 100, Color.Transparent, 0.9f); + bloodProjChargeUpDust = Dust.NewDustDirect(mouthPosition2 + mouthDirection2 * 100f - new Vector2(80f), 160, 160, DustID.Cloud, 0f, 0f, 100, Color.Transparent, 0.9f); bloodProjChargeUpDust.fadeIn = 1.5f; bloodProjChargeUpDust.velocity = bloodProjChargeUpDust.position.DirectionTo(mouthPosition2 + Main.rand.NextVector2Circular(15f, 15f)) * (bloodProjChargeUpDust.velocity.Length() + 5f); bloodProjChargeUpDust.noGravity = true; @@ -291,10 +291,10 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { for (int i = 0; i < 5; i++) { - Dust bloodProjShootDust = Dust.NewDustDirect(mouthPosition3 + mouthDirection3 * 50f - new Vector2(15f), 30, 30, 5, 0f, 0f, 0, Color.Transparent, 1.5f); + Dust bloodProjShootDust = Dust.NewDustDirect(mouthPosition3 + mouthDirection3 * 50f - new Vector2(15f), 30, 30, DustID.Blood, 0f, 0f, 0, Color.Transparent, 1.5f); bloodProjShootDust.velocity = bloodProjShootDust.position.DirectionFrom(mouthPosition3 + Main.rand.NextVector2Circular(5f, 5f)) * bloodProjShootDust.velocity.Length(); bloodProjShootDust.position -= mouthDirection3 * 60f; - bloodProjShootDust = Dust.NewDustDirect(mouthPosition3 + mouthDirection3 * 90f - new Vector2(20f), 40, 40, 5, 0f, 0f, 100, Color.Transparent, 1.5f); + bloodProjShootDust = Dust.NewDustDirect(mouthPosition3 + mouthDirection3 * 90f - new Vector2(20f), 40, 40, DustID.Blood, 0f, 0f, 100, Color.Transparent, 1.5f); bloodProjShootDust.velocity = bloodProjShootDust.position.DirectionFrom(mouthPosition3 + Main.rand.NextVector2Circular(10f, 10f)) * (bloodProjShootDust.velocity.Length() + 5f); bloodProjShootDust.position -= mouthDirection3 * 100f; } @@ -309,10 +309,10 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Spawn dust with each spit for (int j = 0; j < 20; j++) { - Dust bloodProjShootDust2 = Dust.NewDustDirect(mouthPosition3 + mouthDirection3 * 60f - new Vector2(15f), 30, 30, 5, 0f, 0f, 0, Color.Transparent, 1.5f); + Dust bloodProjShootDust2 = Dust.NewDustDirect(mouthPosition3 + mouthDirection3 * 60f - new Vector2(15f), 30, 30, DustID.Blood, 0f, 0f, 0, Color.Transparent, 1.5f); bloodProjShootDust2.velocity = bloodProjShootDust2.position.DirectionFrom(mouthPosition3 + Main.rand.NextVector2Circular(5f, 5f)) * bloodProjShootDust2.velocity.Length(); bloodProjShootDust2.position -= mouthDirection3 * 60f; - bloodProjShootDust2 = Dust.NewDustDirect(mouthPosition3 + mouthDirection3 * 100f - new Vector2(20f), 40, 40, 5, 0f, 0f, 100, Color.Transparent, 1.5f); + bloodProjShootDust2 = Dust.NewDustDirect(mouthPosition3 + mouthDirection3 * 100f - new Vector2(20f), 40, 40, DustID.Blood, 0f, 0f, 100, Color.Transparent, 1.5f); bloodProjShootDust2.velocity = bloodProjShootDust2.position.DirectionFrom(mouthPosition3 + Main.rand.NextVector2Circular(10f, 10f)) * (bloodProjShootDust2.velocity.Length() + 5f); bloodProjShootDust2.position -= mouthDirection3 * 100f; } @@ -360,9 +360,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses float t = npc.ai[1] / bloodSquidPhaseTime; float scaleFactor2 = Utils.GetLerpValue(0f, 0.5f, t) * Utils.GetLerpValue(1f, 0.5f, t); Lighting.AddLight(npc.Center, new Vector3(1f, 0.5f, 0.5f) * scaleFactor2); - if (Main.rand.Next(3) != 0) + if (!Main.rand.NextBool(3)) { - Dust bloodSquidSpawnDust = Dust.NewDustDirect(npc.Center - new Vector2(6f), 12, 12, 5, 0f, 0f, 60, Color.Transparent, 1.4f); + Dust bloodSquidSpawnDust = Dust.NewDustDirect(npc.Center - new Vector2(6f), 12, 12, DustID.Blood, 0f, 0f, 60, Color.Transparent, 1.4f); bloodSquidSpawnDust.position += new Vector2(npc.spriteDirection * 12, 12f); bloodSquidSpawnDust.velocity *= 0.1f; } diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/DukeFishronAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/DukeFishronAI.cs new file mode 100644 index 0000000000..b351e11655 --- /dev/null +++ b/NPCs/VanillaNPCAIOverrides/Bosses/DukeFishronAI.cs @@ -0,0 +1,2235 @@ +using System; +using CalamityMod.Events; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses +{ + public static class DukeFishronAI + { + public static bool BuffedDukeFishronAI(NPC npc, Mod mod) + { + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + + // Percent life remaining + float lifeRatio = npc.life / (float)npc.lifeMax; + + // Variables + bool bossRush = BossRushEvent.BossRushActive; + bool masterMode = Main.masterMode || bossRush; + bool death = CalamityWorld.death || bossRush; + bool masterModeSurprise = lifeRatio >= 0.9f && masterMode; + bool phase2 = lifeRatio < (masterMode ? 0.6f : 0.7f); + bool phase3 = lifeRatio < (masterMode ? 0.3f : 0.4f); + bool phase4 = lifeRatio < (masterMode ? 0.1f : 0.2f); + bool phase2AI = npc.ai[0] > 4f; + bool phase3AI = npc.ai[0] > 9f; + bool charging = npc.ai[3] < 10f; + + // Adjust stats + int setDamage = npc.defDamage; + if (phase3AI) + { + setDamage = (int)Math.Round(setDamage * 1.32); + npc.defense = 0; + } + else if (phase2AI) + { + setDamage = (int)Math.Round(setDamage * 1.44); + npc.defense = (int)Math.Round(npc.defDefense * 0.8); + } + else + npc.defense = npc.defDefense; + + int idlePhaseTimer = 30; + float idlePhaseAcceleration = 0.55f; + float idlePhaseVelocity = 8.5f; + if (phase3AI) + { + idlePhaseAcceleration = 0.7f; + idlePhaseVelocity = 12f; + } + else if (phase2AI & charging) + { + idlePhaseAcceleration = 0.6f; + idlePhaseVelocity = 10f; + } + + if (Main.getGoodWorld) + { + idlePhaseAcceleration *= 1.15f; + idlePhaseVelocity *= 1.15f; + } + + int chargeTime = 28; + float chargeVelocity = 17f; + if (phase3AI) + { + chargeTime = 25; + chargeVelocity = 27f; + } + else if (charging & phase2AI) + { + chargeTime = 27; + chargeVelocity = 21f; + } + + if (death) + { + idlePhaseTimer = 28; + idlePhaseAcceleration *= 1.05f; + idlePhaseVelocity *= 1.08f; + chargeTime -= 1; + chargeVelocity *= 1.13f; + } + + if (Main.getGoodWorld) + chargeVelocity *= 1.15f; + + int bubbleBelchPhaseTimer = death ? 60 : 80; + int bubbleBelchPhaseDivisor = death ? 3 : 4; + float bubbleBelchPhaseAcceleration = death ? 0.35f : 0.3f; + float bubbleBelchPhaseVelocity = death ? 5.5f : 5f; + + if (Main.getGoodWorld) + { + bubbleBelchPhaseAcceleration *= 1.5f; + bubbleBelchPhaseVelocity *= 1.5f; + } + + int sharknadoPhaseTimer = 90; + + int phaseTransitionTimer = 180; + + int teleportPhaseTimer = 30; + + int bubbleSpinPhaseTimer = bossRush ? 45 : death ? 90 : 120; + int bubbleSpinPhaseDivisor = death ? 3 : 4; + float bubbleSpinBubbleVelocity = death ? 8f : 7f; + float bubbleSpinPhaseVelocity = 20f; + float bubbleSpinPhaseRotation = MathHelper.TwoPi / (bubbleSpinPhaseTimer / 2); + + if (Main.getGoodWorld) + bubbleSpinBubbleVelocity *= 1.5f; + + int spawnEffectPhaseTimer = 75; + + Player player = Main.player[npc.target]; + + // Get target + if (npc.target < 0 || npc.target == Main.maxPlayers || player.dead || !player.active) + { + npc.TargetClosest(); + player = Main.player[npc.target]; + npc.netUpdate = true; + } + + // Despawn safety, make sure to target another player if the current player target is too far away + if (Vector2.Distance(player.Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) + npc.TargetClosest(); + + // Despawn + if (player.dead || Vector2.Distance(player.Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance350Tiles) + { + npc.TargetClosest(); + + npc.velocity.Y -= 0.4f; + + if (npc.timeLeft > 10) + npc.timeLeft = 10; + + if (npc.ai[0] > 4f) + npc.ai[0] = 5f; + else + npc.ai[0] = 0f; + + npc.ai[2] = 0f; + } + + // Enrage variable + bool enrage = !bossRush && + (player.position.Y < 800f || player.position.Y > Main.worldSurface * 16.0 || + (player.position.X > 6400f && player.position.X < (Main.maxTilesX * 16 - 6400))); + + calamityGlobalNPC.CurrentlyEnraged = !bossRush && enrage; + + // Make him always able to take damage + npc.dontTakeDamage = false; + + // Increased DR during phase transitions + calamityGlobalNPC.DR = (npc.ai[0] == -1f || npc.ai[0] == 4f || npc.ai[0] == 9f) ? (bossRush ? 0.99f : 0.625f) : 0.15f; + calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = npc.ai[0] == -1f || npc.ai[0] == 4f || npc.ai[0] == 9f; + + // Enrage + if (enrage || bossRush) + { + bubbleBelchPhaseTimer = 20; + bubbleBelchPhaseDivisor = 1; + bubbleBelchPhaseAcceleration = 0.65f; + bubbleBelchPhaseVelocity = 10f; + idlePhaseTimer = 20; + idlePhaseAcceleration = 1f; + idlePhaseVelocity = 15f; + chargeTime = 24; + chargeVelocity += 5f; + bubbleSpinPhaseDivisor = 1; + bubbleSpinBubbleVelocity = 15f; + + if (!bossRush) + { + setDamage *= 2; + npc.defense = npc.defDefense * 3; + } + } + + if (masterMode) + { + idlePhaseTimer -= 6; + idlePhaseAcceleration *= 1.2f; + idlePhaseVelocity *= 1.2f; + chargeTime -= 4; + chargeVelocity += 3f; + } + + if (CalamityWorld.LegendaryMode) + chargeTime += Main.rand.Next(5, 66); + + // Spawn cthulhunadoes in phase 3 + if (phase3AI && ((!phase4 && !masterModeSurprise) || Main.getGoodWorld)) + { + calamityGlobalNPC.newAI[0] += 1f; + float timeGateValue = 600f; + if (calamityGlobalNPC.newAI[0] >= timeGateValue) + { + calamityGlobalNPC.newAI[0] = 0f; + + if (Main.netMode != NetmodeID.MultiplayerClient) + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, Vector2.Zero, ProjectileID.SharknadoBolt, 0, 0f, Main.myPlayer, 1f, npc.target + 1, (enrage || masterMode) ? 1 : 0); + + npc.netUpdate = true; + } + } + + // Set variables for spawn effects + if (npc.localAI[0] == 0f) + { + npc.localAI[0] = 1f; + npc.alpha = 255; + npc.rotation = 0f; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.ai[0] = masterModeSurprise ? 9f : -1f; + npc.netUpdate = true; + } + } + + // Rotation + float rateOfRotation = 0.04f; + if (npc.ai[0] == 1f || npc.ai[0] == 6f || npc.ai[0] == 7f) + rateOfRotation = 0f; + if (npc.ai[0] == 3f || npc.ai[0] == 4f || npc.ai[0] == 8f) + rateOfRotation = 0.01f; + + Vector2 rotationVector = player.Center - npc.Center; + if (!player.dead && bossRush && phase4) + { + // Rotate to show direction of predictive charge + if (npc.ai[0] == 10f) + { + rateOfRotation = 0.1f; + rotationVector = Vector2.Normalize(player.Center + player.velocity * 20f - npc.Center) * chargeVelocity; + } + } + + float rotationSpeed = (float)Math.Atan2(rotationVector.Y, rotationVector.X); + if (npc.spriteDirection == 1) + rotationSpeed += MathHelper.Pi; + if (rotationSpeed < 0f) + rotationSpeed += MathHelper.TwoPi; + if (rotationSpeed > MathHelper.TwoPi) + rotationSpeed -= MathHelper.TwoPi; + if (npc.ai[0] == -1f || npc.ai[0] == 3f || npc.ai[0] == 4f || npc.ai[0] == 8f) + rotationSpeed = 0f; + + if (rateOfRotation != 0f) + npc.rotation = npc.rotation.AngleTowards(rotationSpeed, rateOfRotation); + + // Alpha adjustments + if (npc.ai[0] != -1f && npc.ai[0] < 9f) + { + if (Collision.SolidCollision(npc.position, npc.width, npc.height)) + npc.alpha += 15; + else + npc.alpha -= 15; + + if (npc.alpha < 0) + npc.alpha = 0; + if (npc.alpha > 150) + npc.alpha = 150; + } + + // Spawn effects + if (npc.ai[0] == -1f) + { + // Avoid cheap bullshit + npc.damage = 0; + + // Velocity + npc.velocity *= 0.98f; + + // Direction + int faceDirection = Math.Sign(player.Center.X - npc.Center.X); + if (faceDirection != 0) + { + npc.direction = faceDirection; + npc.spriteDirection = -npc.direction; + } + + // Alpha + if (npc.ai[2] > 20f) + { + npc.velocity.Y = -2f; + + npc.alpha -= 5; + if (Collision.SolidCollision(npc.position, npc.width, npc.height)) + npc.alpha += 15; + if (npc.alpha < 0) + npc.alpha = 0; + if (npc.alpha > 150) + npc.alpha = 150; + } + + // Spawn dust and play sound + if (npc.ai[2] == sharknadoPhaseTimer - 30) + { + int dustAmt = 36; + for (int i = 0; i < dustAmt; i++) + { + Vector2 dust = (Vector2.Normalize(npc.velocity) * new Vector2(npc.width / 2f, npc.height) * 0.75f * 0.5f).RotatedBy((i - (dustAmt / 2 - 1)) * MathHelper.TwoPi / dustAmt) + npc.Center; + Vector2 sharknadoDustDirection = dust - npc.Center; + int sharknadoDust = Dust.NewDust(dust + sharknadoDustDirection, 0, 0, DustID.DungeonWater, sharknadoDustDirection.X * 2f, sharknadoDustDirection.Y * 2f, 100, default, 1.4f); + Main.dust[sharknadoDust].noGravity = true; + Main.dust[sharknadoDust].noLight = true; + Main.dust[sharknadoDust].velocity = Vector2.Normalize(sharknadoDustDirection) * 3f; + } + + SoundEngine.PlaySound(SoundID.Zombie20, npc.Center); + } + + npc.ai[2] += 1f; + if (npc.ai[2] >= spawnEffectPhaseTimer) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.netUpdate = true; + } + } + + // Phase 1 + else if (npc.ai[0] == 0f && !player.dead) + { + // Avoid cheap bullshit + npc.damage = 0; + + // Velocity + if (npc.ai[1] == 0f) + npc.ai[1] = 300 * Math.Sign((npc.Center - player.Center).X); + + Vector2 idlePhaseDirection = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -200f) - npc.Center - npc.velocity) * idlePhaseVelocity; + npc.SimpleFlyMovement(idlePhaseDirection, idlePhaseAcceleration); + + // Rotation and direction + int playerFaceDirection = Math.Sign(player.Center.X - npc.Center.X); + if (playerFaceDirection != 0) + { + if (npc.ai[2] == 0f && playerFaceDirection != npc.direction) + npc.rotation += MathHelper.Pi; + + npc.direction = playerFaceDirection; + + if (npc.spriteDirection != -npc.direction) + npc.rotation += MathHelper.Pi; + + npc.spriteDirection = -npc.direction; + } + + // Phase switch + npc.ai[2] += 1f; + if (npc.ai[2] >= idlePhaseTimer || CalamityWorld.LegendaryMode) + { + int attackPicker = 0; + switch ((int)npc.ai[3]) + { + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + attackPicker = 1; + break; + case 10: + npc.ai[3] = 1f; + attackPicker = 2; + break; + case 11: + npc.ai[3] = 0f; + attackPicker = 3; + break; + } + + if (enrage && attackPicker == 2) + attackPicker = 3; + + if (phase2) + attackPicker = 4; + + // Set velocity for charge + if (attackPicker == 1) + { + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + + // Velocity + npc.velocity = Vector2.Normalize(player.Center - npc.Center) * chargeVelocity; + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); + + // Direction + if (playerFaceDirection != 0) + { + npc.direction = playerFaceDirection; + + if (npc.spriteDirection == 1) + npc.rotation += MathHelper.Pi; + + npc.spriteDirection = -npc.direction; + } + } + + // Bubbles + else if (attackPicker == 2) + { + npc.ai[0] = 2f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + } + + // Spawn sharknadoes + else if (attackPicker == 3) + { + npc.ai[0] = 3f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + if (enrage) + npc.ai[2] = sharknadoPhaseTimer - 40; + else if (masterMode) + npc.ai[2] = sharknadoPhaseTimer - 60; + } + + // Go to phase 2 + else if (attackPicker == 4) + { + npc.ai[0] = 4f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + } + + npc.netUpdate = true; + } + } + + // Charge + else if (npc.ai[0] == 1f) + { + // Set damage + npc.damage = setDamage; + + // Accelerate + npc.velocity *= 1.01f; + + // Spawn dust + int chargeDustAmt = 7; + for (int j = 0; j < chargeDustAmt; j++) + { + Vector2 arg_E1C_0 = (Vector2.Normalize(npc.velocity) * new Vector2((npc.width + 50) / 2f, npc.height) * 0.75f).RotatedBy((j - (chargeDustAmt / 2 - 1)) * MathHelper.Pi / chargeDustAmt) + npc.Center; + Vector2 chargeDustDirection = ((float)(Main.rand.NextDouble() * MathHelper.Pi) - MathHelper.PiOver2).ToRotationVector2() * Main.rand.Next(3, 8); + int chargeDust = Dust.NewDust(arg_E1C_0 + chargeDustDirection, 0, 0, DustID.DungeonWater, chargeDustDirection.X * 2f, chargeDustDirection.Y * 2f, 100, default, 1.4f); + Main.dust[chargeDust].noGravity = true; + Main.dust[chargeDust].noLight = true; + Main.dust[chargeDust].velocity /= 4f; + Main.dust[chargeDust].velocity -= npc.velocity; + } + + npc.ai[2] += 1f; + if (npc.ai[2] >= chargeTime) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] += 2f; + npc.TargetClosest(); + npc.netUpdate = true; + } + } + + // Bubble belch + else if (npc.ai[0] == 2f) + { + // Avoid cheap bullshit + npc.damage = 0; + + // Velocity + if (npc.ai[1] == 0f) + npc.ai[1] = 300 * Math.Sign((npc.Center - player.Center).X); + + Vector2 bubbleAttackDirection = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -200f) - npc.Center - npc.velocity) * bubbleBelchPhaseVelocity; + npc.SimpleFlyMovement(bubbleAttackDirection, bubbleBelchPhaseAcceleration); + + // Play sounds and spawn bubbles + if (npc.ai[2] == 0f) + SoundEngine.PlaySound(SoundID.Zombie20, npc.Center); + + if (npc.ai[2] % bubbleBelchPhaseDivisor == 0f) + { + SoundEngine.PlaySound(SoundID.NPCDeath19, npc.Center); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Vector2 bubbleSpawnDirection = Vector2.Normalize(player.Center - npc.Center) * (npc.width + 20) / 2f + npc.Center; + NPC.NewNPC(npc.GetSource_FromAI(), (int)bubbleSpawnDirection.X, (int)bubbleSpawnDirection.Y + 45, NPCID.DetonatingBubble); + } + } + + // Direction + int bubbleSpriteFaceDirection = Math.Sign(player.Center.X - npc.Center.X); + if (bubbleSpriteFaceDirection != 0) + { + npc.direction = bubbleSpriteFaceDirection; + if (npc.spriteDirection != -npc.direction) + npc.rotation += MathHelper.Pi; + npc.spriteDirection = -npc.direction; + } + + npc.ai[2] += 1f; + if (npc.ai[2] >= bubbleBelchPhaseTimer) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.TargetClosest(); + npc.netUpdate = true; + } + } + + // Sharknado spawn + else if (npc.ai[0] == 3f) + { + // Avoid cheap bullshit + npc.damage = 0; + + // Velocity + npc.velocity *= 0.98f; + npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); + + // Play sound and spawn sharknadoes + if (npc.ai[2] == (sharknadoPhaseTimer - 30)) + SoundEngine.PlaySound(SoundID.Zombie9, npc.Center); + + if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == sharknadoPhaseTimer - 30) + { + Vector2 sharknadoSpawnerDirection = npc.rotation.ToRotationVector2() * (Vector2.UnitX * npc.direction) * (npc.width + 20) / 2f + npc.Center; + bool normal = Main.rand.NextBool(); + float velocityY = normal ? 8f : -4f; + float ai1 = normal ? 0f : -1f; + + Projectile.NewProjectile(npc.GetSource_FromAI(), sharknadoSpawnerDirection.X, sharknadoSpawnerDirection.Y, npc.direction * 3, velocityY, ProjectileID.SharknadoBolt, 0, 0f, Main.myPlayer, 0f, ai1); + Projectile.NewProjectile(npc.GetSource_FromAI(), sharknadoSpawnerDirection.X, sharknadoSpawnerDirection.Y, -(float)npc.direction * 3, velocityY, ProjectileID.SharknadoBolt, 0, 0f, Main.myPlayer, 0f, ai1); + + velocityY = normal ? -4f : 8f; + ai1 = normal ? -1f : 0f; + Projectile.NewProjectile(npc.GetSource_FromAI(), sharknadoSpawnerDirection.X, sharknadoSpawnerDirection.Y, 0f, velocityY, ProjectileID.SharknadoBolt, 0, 0f, Main.myPlayer, 0f, ai1); + } + + npc.ai[2] += 1f; + if (npc.ai[2] >= sharknadoPhaseTimer) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.TargetClosest(); + npc.netUpdate = true; + } + } + + // Transition to phase 2 + else if (npc.ai[0] == 4f) + { + // Avoid cheap bullshit + npc.damage = 0; + + // Velocity + npc.velocity *= 0.98f; + npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); + + // Sound + if (npc.ai[2] == phaseTransitionTimer - 60) + SoundEngine.PlaySound(SoundID.Zombie20, npc.Center); + + npc.ai[2] += 1f; + if (npc.ai[2] >= phaseTransitionTimer) + { + npc.ai[0] = 5f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.TargetClosest(); + npc.netUpdate = true; + } + } + + // Phase 2 + else if (npc.ai[0] == 5f && !player.dead) + { + // Avoid cheap bullshit + npc.damage = 0; + + // Velocity + if (npc.ai[1] == 0f) + npc.ai[1] = 300 * Math.Sign((npc.Center - player.Center).X); + + Vector2 phase2IdleDirection = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -200f) - npc.Center - npc.velocity) * idlePhaseVelocity; + npc.SimpleFlyMovement(phase2IdleDirection, idlePhaseAcceleration); + + // Direction and rotation + int phase2SpriteFaceDirection = Math.Sign(player.Center.X - npc.Center.X); + if (phase2SpriteFaceDirection != 0) + { + if (npc.ai[2] == 0f && phase2SpriteFaceDirection != npc.direction) + npc.rotation += MathHelper.Pi; + + npc.direction = phase2SpriteFaceDirection; + + if (npc.spriteDirection != -npc.direction) + npc.rotation += MathHelper.Pi; + + npc.spriteDirection = -npc.direction; + } + + // Phase switch + npc.ai[2] += 1f; + if (npc.ai[2] >= idlePhaseTimer || CalamityWorld.LegendaryMode) + { + int phase2AttackPicker = 0; + switch ((int)npc.ai[3]) + { + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + phase2AttackPicker = 1; + break; + case 6: + npc.ai[3] = 1f; + phase2AttackPicker = 2; + break; + case 7: + npc.ai[3] = 0f; + phase2AttackPicker = 3; + break; + } + + if (enrage && phase2AttackPicker == 2) + phase2AttackPicker = 3; + + if (phase3) + phase2AttackPicker = 4; + + // Set velocity for charge + if (phase2AttackPicker == 1) + { + npc.ai[0] = 6f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + + // Velocity and rotation + npc.velocity = Vector2.Normalize(player.Center - npc.Center) * chargeVelocity; + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); + + // Direction + if (phase2SpriteFaceDirection != 0) + { + npc.direction = phase2SpriteFaceDirection; + + if (npc.spriteDirection == 1) + npc.rotation += MathHelper.Pi; + + npc.spriteDirection = -npc.direction; + } + } + + // Set velocity for spin + else if (phase2AttackPicker == 2) + { + // Velocity and rotation + npc.velocity = Vector2.Normalize(player.Center - npc.Center) * bubbleSpinPhaseVelocity; + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); + + // Direction + if (phase2SpriteFaceDirection != 0) + { + npc.direction = phase2SpriteFaceDirection; + + if (npc.spriteDirection == 1) + npc.rotation += MathHelper.Pi; + + npc.spriteDirection = -npc.direction; + } + + npc.ai[0] = 7f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + } + + // Spawn cthulhunado + else if (phase2AttackPicker == 3) + { + npc.ai[0] = 8f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + } + + // Go to next phase + else if (phase2AttackPicker == 4) + { + npc.ai[0] = 9f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + } + + npc.netUpdate = true; + } + } + + // Charge + else if (npc.ai[0] == 6f) + { + // Set damage + npc.damage = setDamage; + + // Accelerate + npc.velocity *= 1.01f; + + // Spawn dust + int phase2ChargeDustAmt = 7; + for (int k = 0; k < phase2ChargeDustAmt; k++) + { + Vector2 arg_1A97_0 = (Vector2.Normalize(npc.velocity) * new Vector2((npc.width + 50) / 2f, npc.height) * 0.75f).RotatedBy((k - (phase2ChargeDustAmt / 2 - 1)) * MathHelper.Pi / phase2ChargeDustAmt) + npc.Center; + Vector2 phase2ChargeDustDirection = ((float)(Main.rand.NextDouble() * MathHelper.Pi) - MathHelper.PiOver2).ToRotationVector2() * Main.rand.Next(3, 8); + int phase2ChargeDust = Dust.NewDust(arg_1A97_0 + phase2ChargeDustDirection, 0, 0, DustID.DungeonWater, phase2ChargeDustDirection.X * 2f, phase2ChargeDustDirection.Y * 2f, 100, default, 1.4f); + Main.dust[phase2ChargeDust].noGravity = true; + Main.dust[phase2ChargeDust].noLight = true; + Main.dust[phase2ChargeDust].velocity /= 4f; + Main.dust[phase2ChargeDust].velocity -= npc.velocity; + } + + npc.ai[2] += 1f; + if (npc.ai[2] >= chargeTime) + { + npc.ai[0] = 5f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] += 2f; + npc.TargetClosest(); + npc.netUpdate = true; + } + } + + // Bubble spin + else if (npc.ai[0] == 7f) + { + // Set damage + npc.damage = 0; + + // Play sounds and spawn bubbles + if (npc.ai[2] == 0f) + SoundEngine.PlaySound(SoundID.Zombie20, npc.Center); + + if (npc.ai[2] % bubbleSpinPhaseDivisor == 0f) + { + SoundEngine.PlaySound(SoundID.NPCDeath19, npc.Center); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Vector2 phase2BubbleSharkronDirection = Vector2.Normalize(npc.velocity) * (npc.width + 20) / 2f + npc.Center; + int phase2Bubbles = NPC.NewNPC(npc.GetSource_FromAI(), (int)phase2BubbleSharkronDirection.X, (int)phase2BubbleSharkronDirection.Y + 45, NPCID.DetonatingBubble); + Main.npc[phase2Bubbles].target = npc.target; + Main.npc[phase2Bubbles].velocity = Vector2.Normalize(npc.velocity).RotatedBy(MathHelper.PiOver2 * npc.direction) * bubbleSpinBubbleVelocity * (CalamityWorld.LegendaryMode ? (Main.rand.NextFloat() + 0.5f) : 1f); + Main.npc[phase2Bubbles].netUpdate = true; + Main.npc[phase2Bubbles].ai[3] = Main.rand.Next(80, 121) / 100f; + + if (npc.ai[2] % (bubbleSpinPhaseDivisor * 5) == 0f) + { + int phase2BubbleSharkrons = NPC.NewNPC(npc.GetSource_FromAI(), (int)phase2BubbleSharkronDirection.X, (int)phase2BubbleSharkronDirection.Y + 45, NPCID.Sharkron2); + Main.npc[phase2BubbleSharkrons].ai[1] = 89f; + } + } + } + + // Velocity and rotation + npc.velocity = npc.velocity.RotatedBy(-(double)bubbleSpinPhaseRotation * (float)npc.direction); + npc.rotation -= bubbleSpinPhaseRotation * npc.direction; + + npc.ai[2] += 1f; + if (npc.ai[2] >= bubbleSpinPhaseTimer) + { + npc.ai[0] = 5f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.TargetClosest(); + npc.netUpdate = true; + } + } + + // Spawn cthulhunado + else if (npc.ai[0] == 8f) + { + // Avoid cheap bullshit + npc.damage = 0; + + // Velocity + npc.velocity *= 0.98f; + npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); + + // Play sound and spawn cthulhunado + if (npc.ai[2] == sharknadoPhaseTimer - 30) + SoundEngine.PlaySound(SoundID.Zombie20, npc.Center); + + if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == sharknadoPhaseTimer - 30) + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, Vector2.Zero, ProjectileID.SharknadoBolt, 0, 0f, Main.myPlayer, 1f, npc.target + 1, (enrage || masterMode) ? 1 : 0); + + npc.ai[2] += 1f; + if (npc.ai[2] >= sharknadoPhaseTimer) + { + npc.ai[0] = 5f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.TargetClosest(); + npc.netUpdate = true; + } + } + + // Transition to phase 3 + else if (npc.ai[0] == 9f) + { + // Avoid cheap bullshit + npc.damage = 0; + + // Alpha adjustments + if (npc.ai[2] < phaseTransitionTimer - 90) + { + if (Collision.SolidCollision(npc.position, npc.width, npc.height)) + npc.alpha += 15; + else + npc.alpha -= 15; + + if (npc.alpha < 0) + npc.alpha = 0; + if (npc.alpha > 150) + npc.alpha = 150; + } + else if (npc.alpha < 255) + { + npc.alpha += 4; + if (npc.alpha > 255) + npc.alpha = 255; + } + + // Velocity + npc.velocity *= 0.98f; + npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); + + // Play sound + if (npc.ai[2] == phaseTransitionTimer - 60) + SoundEngine.PlaySound(SoundID.Zombie20, npc.Center); + + npc.ai[2] += 1f; + if (npc.ai[2] >= phaseTransitionTimer) + { + npc.ai[0] = 10f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.TargetClosest(); + npc.netUpdate = true; + } + } + + // Phase 3 + else if (npc.ai[0] == 10f && !player.dead) + { + // Avoid cheap bullshit + npc.damage = 0; + + // Alpha + if (npc.alpha < 255) + { + npc.alpha += 25; + if (npc.alpha > 255) + npc.alpha = 255; + } + + // Teleport location + if (npc.ai[1] == 0f) + npc.ai[1] = 360 * Math.Sign((npc.Center - player.Center).X); + + Vector2 desiredVelocity = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -200f) - npc.Center - npc.velocity) * idlePhaseVelocity; + npc.SimpleFlyMovement(desiredVelocity, idlePhaseAcceleration); + + // Rotation and direction + int phase3SpriteFaceDirection = Math.Sign(player.Center.X - npc.Center.X); + if (phase3SpriteFaceDirection != 0) + { + if (npc.ai[2] == 0f && phase3SpriteFaceDirection != npc.direction) + { + npc.rotation += MathHelper.Pi; + for (int l = 0; l < npc.oldPos.Length; l++) + npc.oldPos[l] = Vector2.Zero; + } + + npc.direction = phase3SpriteFaceDirection; + + if (npc.spriteDirection != -npc.direction) + npc.rotation += MathHelper.Pi; + + npc.spriteDirection = -npc.direction; + } + + // Phase switch + npc.ai[2] += 1f; + if (npc.ai[2] >= idlePhaseTimer || CalamityWorld.LegendaryMode) + { + int phase3AttackPicker = 0; + if (phase4) + { + switch ((int)npc.ai[3]) + { + case 0: + case 1: + case 2: + case 4: + case 5: + case 6: + case 7: + phase3AttackPicker = 1; + break; + case 3: + case 8: + phase3AttackPicker = 2; + break; + } + + if (death) + phase3AttackPicker = 1; + } + else + { + switch ((int)npc.ai[3]) + { + case 0: + case 2: + case 3: + case 5: + case 6: + case 7: + phase3AttackPicker = 1; + break; + case 1: + case 4: + case 8: + phase3AttackPicker = 2; + break; + } + } + + // Go back to normalcy after dropping below 90% HP + if (!masterModeSurprise && !phase3) + phase3AttackPicker = 3; + + // Set velocity for charge + if (phase3AttackPicker == 1) + { + npc.ai[0] = 11f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + + // Velocity and rotation + npc.velocity = Vector2.Normalize(player.Center + (bossRush && phase4 ? player.velocity * 20f : Vector2.Zero) - npc.Center) * chargeVelocity; + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); + + // Direction + if (phase3SpriteFaceDirection != 0) + { + npc.direction = phase3SpriteFaceDirection; + + if (npc.spriteDirection == 1) + npc.rotation += MathHelper.Pi; + + npc.spriteDirection = -npc.direction; + } + } + + // Pause + else if (phase3AttackPicker == 2) + { + npc.ai[0] = 12f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + } + + // Go to next phase + else if (phase3AttackPicker == 3) + { + npc.ai[0] = -1f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + } + + npc.netUpdate = true; + } + } + + // Charge + else if (npc.ai[0] == 11f) + { + // Set damage + npc.damage = setDamage; + + // Accelerate + npc.velocity *= 1.01f; + + // Alpha + npc.alpha -= 25; + if (npc.alpha < 0) + npc.alpha = 0; + + // Spawn dust + int phase3ChargeDustAmt = 7; + for (int m = 0; m < phase3ChargeDustAmt; m++) + { + Vector2 arg_2444_0 = (Vector2.Normalize(npc.velocity) * new Vector2((npc.width + 50) / 2f, npc.height) * 0.75f).RotatedBy((m - (phase3ChargeDustAmt / 2 - 1)) * MathHelper.Pi / phase3ChargeDustAmt) + npc.Center; + Vector2 phase3ChargeDustDirection = ((float)(Main.rand.NextDouble() * MathHelper.Pi) - MathHelper.PiOver2).ToRotationVector2() * Main.rand.Next(3, 8); + int phase3ChargeDust = Dust.NewDust(arg_2444_0 + phase3ChargeDustDirection, 0, 0, DustID.DungeonWater, phase3ChargeDustDirection.X * 2f, phase3ChargeDustDirection.Y * 2f, 100, default, 1.4f); + Main.dust[phase3ChargeDust].noGravity = true; + Main.dust[phase3ChargeDust].noLight = true; + Main.dust[phase3ChargeDust].velocity /= 4f; + Main.dust[phase3ChargeDust].velocity -= npc.velocity; + } + + // Spawn bubbles during charge in Master Mode (these bubbles have special behavior that makes them float upward, doing no damage, before returning to their normal behavior) + if (masterMode && phase4) + { + if (npc.ai[2] % (bubbleBelchPhaseDivisor * 2) == 0f) + { + SoundEngine.PlaySound(SoundID.NPCDeath19, npc.Center); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Vector2 bubbleSpawnDirection = Vector2.Normalize(player.Center - npc.Center) * (npc.width + 20) / 2f + npc.Center; + NPC.NewNPC(npc.GetSource_FromAI(), (int)bubbleSpawnDirection.X, (int)bubbleSpawnDirection.Y + 45, NPCID.DetonatingBubble, 0, 0f, -60f); + } + } + } + + npc.ai[2] += 1f; + if (npc.ai[2] >= chargeTime) + { + npc.ai[0] = 10f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + + if (!phase4 || !death) + npc.ai[3] += 1f; + + npc.TargetClosest(); + npc.netUpdate = true; + } + } + + // Pause before teleport + else if (npc.ai[0] == 12f) + { + // Avoid cheap bullshit + npc.damage = 0; + + // Alpha + if (npc.alpha < 255) + { + npc.alpha += 17; + if (npc.alpha > 255) + npc.alpha = 255; + } + + // Velocity + npc.velocity *= 0.98f; + npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); + + // Play sound + if (npc.ai[2] == teleportPhaseTimer / 2) + SoundEngine.PlaySound(SoundID.Zombie20, npc.Center); + + if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == teleportPhaseTimer / 2) + { + // Teleport location + if (npc.ai[1] == 0f) + npc.ai[1] = 300 * Math.Sign((npc.Center - player.Center).X); + + // Rotation and direction + Vector2 center = player.Center + new Vector2(-npc.ai[1], -200f); + npc.Center = center; + int phase3PlayerDirection = Math.Sign(player.Center.X - npc.Center.X); + if (phase3PlayerDirection != 0) + { + if (npc.ai[2] == 0f && phase3PlayerDirection != npc.direction) + { + npc.rotation += MathHelper.Pi; + for (int n = 0; n < npc.oldPos.Length; n++) + npc.oldPos[n] = Vector2.Zero; + } + + npc.direction = phase3PlayerDirection; + + if (npc.spriteDirection != -npc.direction) + npc.rotation += MathHelper.Pi; + + npc.spriteDirection = -npc.direction; + } + } + + npc.ai[2] += 1f; + if (npc.ai[2] >= teleportPhaseTimer) + { + npc.ai[0] = 10f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + + npc.ai[3] += 1f; + if (npc.ai[3] >= 9f) + npc.ai[3] = 0f; + + npc.netUpdate = true; + } + } + + return false; + } + + public static bool BuffedDetonatingBubbleAI(NPC npc, Mod mod) + { + bool driftUpward = npc.ai[1] < 0f; + npc.damage = driftUpward ? 0 : npc.defDamage; + + if (driftUpward) + { + npc.ai[1] += 1f; + + if (npc.velocity.Y > -2f) + npc.velocity.Y -= 0.04f; + + return false; + } + + if (npc.target == Main.maxPlayers) + { + npc.TargetClosest(); + npc.ai[3] = (float)Main.rand.Next(100, 151) / 100f; + float startingVelocity = (float)Main.rand.Next(250, 351) / 15f; + npc.velocity = (Main.player[npc.target].Center - npc.Center + new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101))).SafeNormalize(Vector2.UnitY) * startingVelocity; + npc.netUpdate = true; + } + + bool pop = npc.ai[0] == 1f; + + Vector2 velocityVector = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY); + float inertia = 30f; + float velocity = 25f; + npc.velocity = (npc.velocity * inertia + velocityVector * velocity) / (inertia + 1f); + + npc.scale = npc.ai[3]; + + npc.alpha -= 30; + if (npc.alpha < 50) + npc.alpha = 50; + npc.alpha = 50; + + float inertia2 = inertia + 10f; + npc.velocity.X = (npc.velocity.X * inertia2 + (float)Main.rand.Next(-10, 11) * 0.1f) / (inertia2 + 1f); + npc.velocity.Y = (npc.velocity.Y * inertia2 + -0.25f + (float)Main.rand.Next(-10, 11) * 0.2f) / (inertia2 + 1f); + if (npc.velocity.Y > 0f) + npc.velocity.Y -= 0.04f; + + // Push Bubbles away from each other. + float spreadOutStrength = (CalamityWorld.death || BossRushEvent.BossRushActive) ? -0.1f : -0.08f; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (i != npc.whoAmI && Main.npc[i].active && Main.npc[i].type == npc.type) + { + Vector2 otherBubbleDist = Main.npc[i].Center - npc.Center; + if (otherBubbleDist.Length() < (npc.width + npc.height)) + { + otherBubbleDist = otherBubbleDist.SafeNormalize(Vector2.UnitY); + otherBubbleDist *= spreadOutStrength; + npc.velocity += otherBubbleDist; + Main.npc[i].velocity -= otherBubbleDist; + } + } + } + + if (npc.ai[0] == 0f) + { + int size = 40; + Rectangle rect = npc.getRect(); + rect.X -= size + npc.width / 2; + rect.Y -= size + npc.height / 2; + rect.Width += size * 2; + rect.Height += size * 2; + for (int i = 0; i < Main.maxPlayers; i++) + { + Player player = Main.player[i]; + if (player.active && !player.dead && rect.Intersects(player.getRect())) + { + npc.ai[0] = 1f; + npc.ai[1] = 4f; + npc.netUpdate = true; + break; + } + } + } + + if (npc.ai[0] == 0f) + { + npc.ai[1] += 1f; + float timeBeforePopping = 300f; + if (npc.ai[1] >= timeBeforePopping) + { + npc.ai[0] = 1f; + npc.ai[1] = 4f; + } + } + + if (pop) + { + npc.ai[1] -= 1f; + if (npc.ai[1] <= 0f) + { + npc.life = 0; + npc.HitEffect(); + npc.active = false; + return false; + } + } + + if (pop) + { + npc.position = npc.Center; + npc.width = npc.height = 100; + npc.position = new Vector2(npc.position.X - (float)(npc.width / 2), npc.position.Y - (float)(npc.height / 2)); + npc.EncourageDespawn(3); + } + + return false; + } + + public static bool VanillaDukeFishronAI(NPC npc, Mod mod) + { + bool expertMode = Main.expertMode; + bool masterMode = Main.masterMode; + + double damageScale = expertMode ? 1.2 : 1D; + float phase2LifeRatio = masterMode ? 0.6f : 0.5f; + float phase3LifeRatio = masterMode ? 0.25f : 0.15f; + bool flag = npc.life <= npc.lifeMax * phase2LifeRatio; + bool flag2 = expertMode && npc.life <= npc.lifeMax * phase3LifeRatio; + bool flag3 = npc.ai[0] > 4f; + bool flag4 = npc.ai[0] > 9f; + bool flag5 = npc.ai[3] < 10f; + + int setDamage = npc.defDamage; + if (flag4) + { + setDamage = (int)Math.Round(setDamage * 1.1 * damageScale); + npc.defense = 0; + } + else if (flag3) + { + setDamage = (int)Math.Round(setDamage * 1.2 * damageScale); + npc.defense = (int)Math.Round(npc.defDefense * 0.8); + } + else + npc.defense = npc.defDefense; + + int num2 = (masterMode ? 30 : expertMode ? 40 : 60); + float num3 = (masterMode ? 0.65f : expertMode ? 0.55f : 0.45f); + float num4 = (masterMode ? 9.5f : expertMode ? 8.5f : 7.5f); + if (flag4) + { + num3 = masterMode ? 0.8f : 0.7f; + num4 = masterMode ? 13f : 12f; + num2 = masterMode ? 20 : 30; + } + else if (flag3 && flag5) + { + num3 = (masterMode ? 0.7f : expertMode ? 0.6f : 0.5f); + num4 = (masterMode ? 12f : expertMode ? 10f : 8f); + num2 = (masterMode ? 35 : expertMode ? 40 : 20); + } + else if (flag5 && !flag3 && !flag4) + num2 = masterMode ? 25 : 30; + + int num5 = (masterMode ? 25 : expertMode ? 28 : 30); + float num6 = (masterMode ? 18f : expertMode ? 17f : 16f); + if (flag4) + { + num5 = masterMode ? 20 : 25; + num6 = masterMode ? 29f : 27f; + } + else if (flag5 && flag3) + { + num5 = (masterMode ? 24 : expertMode ? 27 : 30); + if (expertMode) + num6 = masterMode ? 24f : 21f; + } + + int num7 = masterMode ? 40 : 80; + int num8 = masterMode ? 2 : 4; + float num9 = masterMode ? 0.5f : 0.3f; + float num10 = masterMode ? 8f : 5f; + int num11 = masterMode ? 60 : 90; + int num12 = 180; + int num13 = 180; + int num14 = 30; + int num15 = masterMode ? 60 : 120; + int num16 = masterMode ? 2 : 4; + float num17 = masterMode ? 9f : 6f; + float num18 = 20f; + float num19 = MathHelper.TwoPi / (float)(num15 / 2); + int num20 = masterMode ? 50 : 75; + Vector2 center = npc.Center; + Player player = Main.player[npc.target]; + if (npc.target < 0 || npc.target == Main.maxPlayers || player.dead || !player.active || Vector2.Distance(player.Center, center) > 5600f) + { + npc.TargetClosest(); + player = Main.player[npc.target]; + npc.netUpdate = true; + } + + if (player.dead || Vector2.Distance(player.Center, center) > 5600f) + { + npc.velocity.Y -= 0.4f; + npc.EncourageDespawn(10); + if (npc.ai[0] > 4f) + npc.ai[0] = 5f; + else + npc.ai[0] = 0f; + + npc.ai[2] = 0f; + } + + bool enrage = player.position.Y < 800f || (double)player.position.Y > Main.worldSurface * 16.0 || (player.position.X > 6400f && player.position.X < (float)(Main.maxTilesX * 16 - 6400)); + + npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive && enrage; + + // Increased DR during phase transitions + npc.Calamity().DR = (npc.ai[0] == -1f || npc.ai[0] == 4f || npc.ai[0] == 9f) ? (BossRushEvent.BossRushActive ? 0.99f : 0.625f) : 0.15f; + npc.Calamity().CurrentlyIncreasingDefenseOrDR = npc.ai[0] == -1f || npc.ai[0] == 4f || npc.ai[0] == 9f; + + if (enrage) + { + num2 = masterMode ? 5 : 10; + setDamage *= 2; + npc.defense = npc.defDefense * 2; + num6 += (masterMode ? 12f : 6f); + } + + if (npc.localAI[0] == 0f) + { + npc.localAI[0] = 1f; + npc.alpha = 255; + npc.rotation = 0f; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.ai[0] = -1f; + npc.netUpdate = true; + } + } + + float num21 = (float)Math.Atan2(player.Center.Y - center.Y, player.Center.X - center.X); + if (npc.spriteDirection == 1) + num21 += (float)Math.PI; + + if (num21 < 0f) + num21 += MathHelper.TwoPi; + + if (num21 > MathHelper.TwoPi) + num21 -= MathHelper.TwoPi; + + if (npc.ai[0] == -1f) + num21 = 0f; + + if (npc.ai[0] == 3f) + num21 = 0f; + + if (npc.ai[0] == 4f) + num21 = 0f; + + if (npc.ai[0] == 8f) + num21 = 0f; + + float num22 = 0.04f; + if (npc.ai[0] == 1f || npc.ai[0] == 6f) + num22 = 0f; + + if (npc.ai[0] == 7f) + num22 = 0f; + + if (npc.ai[0] == 3f) + num22 = 0.01f; + + if (npc.ai[0] == 4f) + num22 = 0.01f; + + if (npc.ai[0] == 8f) + num22 = 0.01f; + + if (npc.rotation < num21) + { + if ((double)(num21 - npc.rotation) > Math.PI) + npc.rotation -= num22; + else + npc.rotation += num22; + } + + if (npc.rotation > num21) + { + if ((double)(npc.rotation - num21) > Math.PI) + npc.rotation += num22; + else + npc.rotation -= num22; + } + + if (npc.rotation > num21 - num22 && npc.rotation < num21 + num22) + npc.rotation = num21; + + if (npc.rotation < 0f) + npc.rotation += MathHelper.TwoPi; + + if (npc.rotation > MathHelper.TwoPi) + npc.rotation -= MathHelper.TwoPi; + + if (npc.rotation > num21 - num22 && npc.rotation < num21 + num22) + npc.rotation = num21; + + if (npc.ai[0] != -1f && npc.ai[0] < 9f) + { + if (Collision.SolidCollision(npc.position, npc.width, npc.height)) + npc.alpha += 15; + else + npc.alpha -= 15; + + if (npc.alpha < 0) + npc.alpha = 0; + + if (npc.alpha > 150) + npc.alpha = 150; + } + + if (npc.ai[0] == -1f) + { + // Avoid cheap bullshit + npc.damage = 0; + + npc.velocity *= 0.98f; + int num23 = Math.Sign(player.Center.X - center.X); + if (num23 != 0) + { + npc.direction = num23; + npc.spriteDirection = -npc.direction; + } + + if (npc.ai[2] > 20f) + { + npc.velocity.Y = -2f; + npc.alpha -= 5; + if (Collision.SolidCollision(npc.position, npc.width, npc.height)) + npc.alpha += 15; + + if (npc.alpha < 0) + npc.alpha = 0; + + if (npc.alpha > 150) + npc.alpha = 150; + } + + if (npc.ai[2] == (float)(num11 - 30)) + { + int num24 = 36; + for (int i = 0; i < num24; i++) + { + Vector2 vector = (Vector2.Normalize(npc.velocity) * new Vector2((float)npc.width / 2f, npc.height) * 0.75f * 0.5f).RotatedBy((float)(i - (num24 / 2 - 1)) * MathHelper.TwoPi / (float)num24) + npc.Center; + Vector2 vector2 = vector - npc.Center; + int num25 = Dust.NewDust(vector + vector2, 0, 0, DustID.DungeonWater, vector2.X * 2f, vector2.Y * 2f, 100, default(Color), 1.4f); + Main.dust[num25].noGravity = true; + Main.dust[num25].noLight = true; + Main.dust[num25].velocity = Vector2.Normalize(vector2) * 3f; + } + + SoundEngine.PlaySound(SoundID.Zombie20, npc.Center); + } + + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num20) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 0f && !player.dead) + { + // Avoid cheap bullshit + npc.damage = 0; + + if (npc.ai[1] == 0f) + npc.ai[1] = 300 * Math.Sign((center - player.Center).X); + + Vector2 vector3 = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -200f) - center - npc.velocity) * num4; + if (npc.velocity.X < vector3.X) + { + npc.velocity.X += num3; + if (npc.velocity.X < 0f && vector3.X > 0f) + npc.velocity.X += num3; + } + else if (npc.velocity.X > vector3.X) + { + npc.velocity.X -= num3; + if (npc.velocity.X > 0f && vector3.X < 0f) + npc.velocity.X -= num3; + } + + if (npc.velocity.Y < vector3.Y) + { + npc.velocity.Y += num3; + if (npc.velocity.Y < 0f && vector3.Y > 0f) + npc.velocity.Y += num3; + } + else if (npc.velocity.Y > vector3.Y) + { + npc.velocity.Y -= num3; + if (npc.velocity.Y > 0f && vector3.Y < 0f) + npc.velocity.Y -= num3; + } + + int num26 = Math.Sign(player.Center.X - center.X); + if (num26 != 0) + { + if (npc.ai[2] == 0f && num26 != npc.direction) + npc.rotation += (float)Math.PI; + + npc.direction = num26; + if (npc.spriteDirection != -npc.direction) + npc.rotation += (float)Math.PI; + + npc.spriteDirection = -npc.direction; + } + + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num2) + { + int num27 = 0; + switch ((int)npc.ai[3]) + { + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + num27 = 1; + break; + case 10: + npc.ai[3] = 1f; + num27 = 2; + break; + case 11: + npc.ai[3] = 0f; + num27 = 3; + break; + } + + if (enrage && num27 == 2) + num27 = 3; + + if (flag) + num27 = 4; + + switch (num27) + { + case 1: + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.velocity = Vector2.Normalize(player.Center - center) * num6; + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); + if (num26 != 0) + { + npc.direction = num26; + if (npc.spriteDirection == 1) + npc.rotation += (float)Math.PI; + + npc.spriteDirection = -npc.direction; + } + break; + + case 2: + npc.ai[0] = 2f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + break; + + case 3: + npc.ai[0] = 3f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + if (enrage) + npc.ai[2] = num11 - 40; + break; + + case 4: + npc.ai[0] = 4f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + break; + } + + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 1f) + { + // Set damage + npc.damage = setDamage; + + int num28 = 7; + for (int j = 0; j < num28; j++) + { + Vector2 vector4 = (Vector2.Normalize(npc.velocity) * new Vector2((float)(npc.width + 50) / 2f, npc.height) * 0.75f).RotatedBy((double)(j - (num28 / 2 - 1)) * Math.PI / (double)(float)num28) + center; + Vector2 vector5 = ((float)(Main.rand.NextDouble() * MathHelper.Pi) - MathHelper.PiOver2).ToRotationVector2() * Main.rand.Next(3, 8); + int num29 = Dust.NewDust(vector4 + vector5, 0, 0, DustID.DungeonWater, vector5.X * 2f, vector5.Y * 2f, 100, default(Color), 1.4f); + Main.dust[num29].noGravity = true; + Main.dust[num29].noLight = true; + Main.dust[num29].velocity /= 4f; + Main.dust[num29].velocity -= npc.velocity; + } + + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num5) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] += 2f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 2f) + { + // Avoid cheap bullshit + npc.damage = 0; + + if (npc.ai[1] == 0f) + npc.ai[1] = 300 * Math.Sign((center - player.Center).X); + + Vector2 vector6 = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -200f) - center - npc.velocity) * num10; + if (npc.velocity.X < vector6.X) + { + npc.velocity.X += num9; + if (npc.velocity.X < 0f && vector6.X > 0f) + npc.velocity.X += num9; + } + else if (npc.velocity.X > vector6.X) + { + npc.velocity.X -= num9; + if (npc.velocity.X > 0f && vector6.X < 0f) + npc.velocity.X -= num9; + } + + if (npc.velocity.Y < vector6.Y) + { + npc.velocity.Y += num9; + if (npc.velocity.Y < 0f && vector6.Y > 0f) + npc.velocity.Y += num9; + } + else if (npc.velocity.Y > vector6.Y) + { + npc.velocity.Y -= num9; + if (npc.velocity.Y > 0f && vector6.Y < 0f) + npc.velocity.Y -= num9; + } + + if (npc.ai[2] == 0f) + SoundEngine.PlaySound(SoundID.Zombie20, npc.Center); + + if (npc.ai[2] % (float)num8 == 0f) + { + SoundEngine.PlaySound(SoundID.NPCDeath19, npc.Center); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Vector2 vector7 = Vector2.Normalize(player.Center - center) * (npc.width + 20) / 2f + center; + NPC.NewNPC(npc.GetSource_FromAI(), (int)vector7.X, (int)vector7.Y + 45, NPCID.DetonatingBubble); + } + } + + int num30 = Math.Sign(player.Center.X - center.X); + if (num30 != 0) + { + npc.direction = num30; + if (npc.spriteDirection != -npc.direction) + npc.rotation += (float)Math.PI; + + npc.spriteDirection = -npc.direction; + } + + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num7) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 3f) + { + // Avoid cheap bullshit + npc.damage = 0; + + npc.velocity *= 0.98f; + npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); + if (npc.ai[2] == (float)(num11 - 30)) + SoundEngine.PlaySound(SoundID.Zombie9, npc.Center); + + if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == (float)(num11 - 30)) + { + Vector2 vector8 = npc.rotation.ToRotationVector2() * (Vector2.UnitX * npc.direction) * (npc.width + 20) / 2f + center; + Vector2 sharknadoBoltVelocity = new Vector2(npc.direction * 2, masterMode ? 12f : 8f); + Projectile.NewProjectile(npc.GetSource_FromAI(), vector8, sharknadoBoltVelocity, ProjectileID.SharknadoBolt, 0, 0f, Main.myPlayer); + sharknadoBoltVelocity = new Vector2(npc.direction * -2, masterMode ? 12f : 8f); + Projectile.NewProjectile(npc.GetSource_FromAI(), vector8, sharknadoBoltVelocity, ProjectileID.SharknadoBolt, 0, 0f, Main.myPlayer); + if (masterMode) + { + sharknadoBoltVelocity = new Vector2(npc.direction * 2, masterMode ? -12f : -8f); + Projectile.NewProjectile(npc.GetSource_FromAI(), vector8, sharknadoBoltVelocity, ProjectileID.SharknadoBolt, 0, 0f, Main.myPlayer, 0f, -1f); + sharknadoBoltVelocity = new Vector2(npc.direction * -2, masterMode ? -12f : -8f); + Projectile.NewProjectile(npc.GetSource_FromAI(), vector8, sharknadoBoltVelocity, ProjectileID.SharknadoBolt, 0, 0f, Main.myPlayer, 0f, -1f); + } + } + + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num11) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 4f) + { + // Avoid cheap bullshit + npc.damage = 0; + + npc.velocity *= 0.98f; + npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); + if (npc.ai[2] == (float)(num12 - 60)) + SoundEngine.PlaySound(SoundID.Zombie20, npc.Center); + + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num12) + { + npc.ai[0] = 5f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 5f && !player.dead) + { + // Avoid cheap bullshit + npc.damage = 0; + + if (npc.ai[1] == 0f) + npc.ai[1] = 300 * Math.Sign((center - player.Center).X); + + Vector2 vector9 = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -200f) - center - npc.velocity) * num4; + if (npc.velocity.X < vector9.X) + { + npc.velocity.X += num3; + if (npc.velocity.X < 0f && vector9.X > 0f) + npc.velocity.X += num3; + } + else if (npc.velocity.X > vector9.X) + { + npc.velocity.X -= num3; + if (npc.velocity.X > 0f && vector9.X < 0f) + npc.velocity.X -= num3; + } + + if (npc.velocity.Y < vector9.Y) + { + npc.velocity.Y += num3; + if (npc.velocity.Y < 0f && vector9.Y > 0f) + npc.velocity.Y += num3; + } + else if (npc.velocity.Y > vector9.Y) + { + npc.velocity.Y -= num3; + if (npc.velocity.Y > 0f && vector9.Y < 0f) + npc.velocity.Y -= num3; + } + + int num31 = Math.Sign(player.Center.X - center.X); + if (num31 != 0) + { + if (npc.ai[2] == 0f && num31 != npc.direction) + npc.rotation += (float)Math.PI; + + npc.direction = num31; + if (npc.spriteDirection != -npc.direction) + npc.rotation += (float)Math.PI; + + npc.spriteDirection = -npc.direction; + } + + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num2) + { + int num32 = 0; + switch ((int)npc.ai[3]) + { + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + num32 = 1; + break; + case 6: + npc.ai[3] = 1f; + num32 = 2; + break; + case 7: + npc.ai[3] = 0f; + num32 = 3; + break; + } + + if (flag2) + num32 = 4; + + if (enrage && num32 == 2) + num32 = 3; + + switch (num32) + { + case 1: + npc.ai[0] = 6f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.velocity = Vector2.Normalize(player.Center - center) * num6; + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); + if (num31 != 0) + { + npc.direction = num31; + if (npc.spriteDirection == 1) + npc.rotation += (float)Math.PI; + + npc.spriteDirection = -npc.direction; + } + break; + + case 2: + npc.velocity = Vector2.Normalize(player.Center - center) * num18; + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); + if (num31 != 0) + { + npc.direction = num31; + if (npc.spriteDirection == 1) + npc.rotation += (float)Math.PI; + + npc.spriteDirection = -npc.direction; + } + npc.ai[0] = 7f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + break; + + case 3: + npc.ai[0] = 8f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + break; + + case 4: + npc.ai[0] = 9f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + break; + } + + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 6f) + { + // Set damage + npc.damage = setDamage; + + int num33 = 7; + for (int k = 0; k < num33; k++) + { + Vector2 vector10 = (Vector2.Normalize(npc.velocity) * new Vector2((float)(npc.width + 50) / 2f, npc.height) * 0.75f).RotatedBy((double)(k - (num33 / 2 - 1)) * Math.PI / (double)(float)num33) + center; + Vector2 vector11 = ((float)(Main.rand.NextDouble() * MathHelper.Pi) - MathHelper.PiOver2).ToRotationVector2() * Main.rand.Next(3, 8); + int num34 = Dust.NewDust(vector10 + vector11, 0, 0, DustID.DungeonWater, vector11.X * 2f, vector11.Y * 2f, 100, default(Color), 1.4f); + Main.dust[num34].noGravity = true; + Main.dust[num34].noLight = true; + Main.dust[num34].velocity /= 4f; + Main.dust[num34].velocity -= npc.velocity; + } + + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num5) + { + npc.ai[0] = 5f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] += 2f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 7f) + { + // Set damage + npc.damage = 0; + + if (npc.ai[2] == 0f) + SoundEngine.PlaySound(SoundID.Zombie20, npc.Center); + + if (npc.ai[2] % (float)num16 == 0f) + { + SoundEngine.PlaySound(SoundID.NPCDeath19, npc.Center); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Vector2 vector12 = Vector2.Normalize(npc.velocity) * (npc.width + 20) / 2f + center; + int num35 = NPC.NewNPC(npc.GetSource_FromAI(), (int)vector12.X, (int)vector12.Y + 45, NPCID.DetonatingBubble); + Main.npc[num35].target = npc.target; + Main.npc[num35].velocity = Vector2.Normalize(npc.velocity).RotatedBy(MathHelper.PiOver2 * (float)npc.direction) * num17; + Main.npc[num35].netUpdate = true; + Main.npc[num35].ai[3] = (float)Main.rand.Next(80, 121) / 100f; + } + } + + npc.velocity = npc.velocity.RotatedBy((0f - num19) * (float)npc.direction); + npc.rotation -= num19 * (float)npc.direction; + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num15) + { + npc.ai[0] = 5f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 8f) + { + // Avoid cheap bullshit + npc.damage = 0; + + npc.velocity *= 0.98f; + npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); + if (npc.ai[2] == (float)(num11 - 30)) + SoundEngine.PlaySound(SoundID.Zombie20, npc.Center); + + if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == (float)(num11 - 30)) + Projectile.NewProjectile(npc.GetSource_FromAI(), center, Vector2.Zero, ProjectileID.SharknadoBolt, 0, 0f, Main.myPlayer, 1f, npc.target + 1, (enrage || masterMode) ? 1 : 0); + + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num11) + { + npc.ai[0] = 5f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 9f) + { + // Avoid cheap bullshit + npc.damage = 0; + + if (npc.ai[2] < (float)(num13 - 90)) + { + if (Collision.SolidCollision(npc.position, npc.width, npc.height)) + npc.alpha += 15; + else + npc.alpha -= 15; + + if (npc.alpha < 0) + npc.alpha = 0; + + if (npc.alpha > 150) + npc.alpha = 150; + } + else if (npc.alpha < 255) + { + npc.alpha += 4; + if (npc.alpha > 255) + npc.alpha = 255; + } + + npc.velocity *= 0.98f; + npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); + if (npc.ai[2] == (float)(num13 - 60)) + SoundEngine.PlaySound(SoundID.Zombie20, npc.Center); + + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num13) + { + npc.ai[0] = 10f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 10f && !player.dead) + { + // Avoid cheap bullshit + npc.damage = 0; + + if (npc.alpha < 255) + { + npc.alpha += 25; + if (npc.alpha > 255) + npc.alpha = 255; + } + + if (npc.ai[1] == 0f) + npc.ai[1] = 360 * Math.Sign((center - player.Center).X); + + Vector2 desiredVelocity = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -200f) - center - npc.velocity) * num4; + npc.SimpleFlyMovement(desiredVelocity, num3); + int num36 = Math.Sign(player.Center.X - center.X); + if (num36 != 0) + { + if (npc.ai[2] == 0f && num36 != npc.direction) + { + npc.rotation += (float)Math.PI; + for (int l = 0; l < npc.oldPos.Length; l++) + npc.oldPos[l] = Vector2.Zero; + } + + npc.direction = num36; + if (npc.spriteDirection != -npc.direction) + npc.rotation += (float)Math.PI; + + npc.spriteDirection = -npc.direction; + } + + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num2) + { + int num37 = 0; + switch ((int)npc.ai[3]) + { + case 0: + case 2: + case 3: + case 5: + case 6: + case 7: + num37 = 1; + break; + case 1: + case 4: + case 8: + num37 = 2; + break; + } + + switch (num37) + { + case 1: + npc.ai[0] = 11f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.velocity = Vector2.Normalize(player.Center - center) * num6; + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); + if (num36 != 0) + { + npc.direction = num36; + if (npc.spriteDirection == 1) + npc.rotation += (float)Math.PI; + + npc.spriteDirection = -npc.direction; + } + break; + + case 2: + npc.ai[0] = 12f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + break; + + case 3: + npc.ai[0] = 13f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + break; + } + + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 11f) + { + // Set damage + npc.damage = setDamage; + + npc.alpha -= 25; + if (npc.alpha < 0) + npc.alpha = 0; + + int num38 = 7; + for (int m = 0; m < num38; m++) + { + Vector2 vector13 = (Vector2.Normalize(npc.velocity) * new Vector2((float)(npc.width + 50) / 2f, npc.height) * 0.75f).RotatedBy((double)(m - (num38 / 2 - 1)) * Math.PI / (double)(float)num38) + center; + Vector2 vector14 = ((float)(Main.rand.NextDouble() * MathHelper.Pi) - MathHelper.PiOver2).ToRotationVector2() * Main.rand.Next(3, 8); + int num39 = Dust.NewDust(vector13 + vector14, 0, 0, DustID.DungeonWater, vector14.X * 2f, vector14.Y * 2f, 100, default(Color), 1.4f); + Main.dust[num39].noGravity = true; + Main.dust[num39].noLight = true; + Main.dust[num39].velocity /= 4f; + Main.dust[num39].velocity -= npc.velocity; + } + + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num5) + { + npc.ai[0] = 10f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] += 1f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 12f) + { + // Avoid cheap bullshit + npc.damage = 0; + + if (npc.alpha < 255) + { + npc.alpha += 17; + if (npc.alpha > 255) + npc.alpha = 255; + } + + npc.velocity *= 0.98f; + npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); + if (npc.ai[2] == (float)(num14 / 2)) + SoundEngine.PlaySound(SoundID.Zombie20, npc.Center); + + if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == (float)(num14 / 2)) + { + if (npc.ai[1] == 0f) + npc.ai[1] = 300 * Math.Sign((center - player.Center).X); + + Vector2 vector15 = player.Center + new Vector2(0f - npc.ai[1], -200f); + Vector2 vector17 = (npc.Center = vector15); + center = vector17; + int num40 = Math.Sign(player.Center.X - center.X); + if (num40 != 0) + { + if (npc.ai[2] == 0f && num40 != npc.direction) + { + npc.rotation += (float)Math.PI; + for (int n = 0; n < npc.oldPos.Length; n++) + npc.oldPos[n] = Vector2.Zero; + } + + npc.direction = num40; + if (npc.spriteDirection != -npc.direction) + npc.rotation += (float)Math.PI; + + npc.spriteDirection = -npc.direction; + } + } + + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num14) + { + npc.ai[0] = 10f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] += 1f; + if (npc.ai[3] >= 9f) + npc.ai[3] = 0f; + + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 13f) + { + // Avoid cheap bullshit + npc.damage = 0; + + if (npc.ai[2] == 0f) + SoundEngine.PlaySound(SoundID.Zombie20, npc.Center); + + npc.velocity = npc.velocity.RotatedBy((0f - num19) * (float)npc.direction); + npc.rotation -= num19 * (float)npc.direction; + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num15) + { + npc.ai[0] = 10f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] += 1f; + npc.netUpdate = true; + } + } + + // Make him always able to take damage + npc.dontTakeDamage = false; + + return false; + } + } +} diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/EaterOfWorldsAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/EaterOfWorldsAI.cs new file mode 100644 index 0000000000..22922a5ce6 --- /dev/null +++ b/NPCs/VanillaNPCAIOverrides/Bosses/EaterOfWorldsAI.cs @@ -0,0 +1,1259 @@ +using System; +using CalamityMod.Events; +using CalamityMod.Projectiles.Boss; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses +{ + public static class EaterOfWorldsAI + { + private const int TotalMasterModeWorms = 4; + public const float DRIncreaseTime = 600f; + + public static bool BuffedEaterofWorldsAI(NPC npc, Mod mod) + { + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + + bool bossRush = BossRushEvent.BossRushActive; + bool masterMode = Main.masterMode || bossRush; + bool death = CalamityWorld.death || bossRush; + + // Causes it to split far more in death mode + if ((((npc.ai[2] % 2f == 0f && npc.type == NPCID.EaterofWorldsBody) || npc.type == NPCID.EaterofWorldsHead) && death) || CalamityWorld.LegendaryMode) + { + calamityGlobalNPC.DR = 0.5f; + npc.defense = npc.defDefense * 2; + } + + if (CalamityWorld.LegendaryMode && npc.type == NPCID.EaterofWorldsHead) + npc.reflectsProjectiles = true; + + // Get a target + 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.type == NPCID.EaterofWorldsHead) + npc.TargetClosest(); + + bool enrage = true; + int targetTileX = (int)Main.player[npc.target].Center.X / 16; + int targetTileY = (int)Main.player[npc.target].Center.Y / 16; + + Tile tile = Framing.GetTileSafely(targetTileX, targetTileY); + if (tile.WallType == WallID.EbonstoneUnsafe) + enrage = false; + + float enrageScale = bossRush ? 0.5f : 0f; + if (((npc.position.Y / 16f) < Main.worldSurface && enrage) || bossRush) + { + calamityGlobalNPC.CurrentlyEnraged = !bossRush; + enrageScale += 0.5f; + } + if (!Main.player[npc.target].ZoneCorrupt || bossRush) + { + calamityGlobalNPC.CurrentlyEnraged = !bossRush; + enrageScale += 2f; + } + + // Total body segments + float totalSegments = GetEaterOfWorldsSegmentsCountRevDeath(); + + // Count body segments remaining + float segmentCount = NPC.CountNPCS(NPCID.EaterofWorldsBody); + + // Percent body segments remaining + float lifeRatio = MathHelper.Clamp(segmentCount / totalSegments, 0f, 1f); + + // 10 seconds of resistance to prevent spawn killing + if (calamityGlobalNPC.newAI[1] < DRIncreaseTime) + calamityGlobalNPC.newAI[1] += 1f; + + // Phases + + // Cursed Flame phase + bool phase2 = lifeRatio < 0.8f || masterMode; + + // Boost velocity by 20% phase + bool phase3 = lifeRatio < 0.4f || masterMode; + + // Boost velocity by 50% phase + bool phase4 = lifeRatio < (masterMode ? 0.5f : 0.2f); + + // Go fucking crazy in Master Mode + bool phase5 = lifeRatio < 0.1f && masterMode; + bool phase6 = lifeRatio < 0.05f && masterMode; + + // Fire projectiles + if (Main.netMode != NetmodeID.MultiplayerClient) + { + // Vile spit + if (npc.type == NPCID.EaterofWorldsBody) + { + int randomChanceLimit = (int)MathHelper.Lerp(masterMode ? 15f : 30f, 900f, lifeRatio); + if (Main.getGoodWorld) + randomChanceLimit = (int)(randomChanceLimit * 0.5f); + + if (Main.rand.NextBool(randomChanceLimit)) + { + npc.TargetClosest(); + if (Collision.CanHitLine(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1) && Vector2.Distance(npc.Center, Main.player[npc.target].Center) > 320f) + NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + npc.velocity.X), (int)(npc.Center.Y + npc.velocity.Y), NPCID.VileSpitEaterOfWorlds, 0, 0f, 1f); + } + } + + // Cursed flames (shadowflames in death mode) + else if (npc.type == NPCID.EaterofWorldsHead) + { + if (Collision.CanHitLine(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1)) + calamityGlobalNPC.newAI[0] += ((npc.justHit && masterMode) ? 10f : 1f); + + float timer = enrageScale > 0f ? 120f : 180f; + float shootBoost = lifeRatio * 120f; + timer += shootBoost; + + if (enrageScale >= 2f) + timer = 60f; + + if (calamityGlobalNPC.newAI[0] >= timer && phase2) + { + if (Collision.CanHitLine(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1) && + (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY).ToRotation().AngleTowards(npc.velocity.ToRotation(), MathHelper.PiOver4) == npc.velocity.ToRotation() && + Vector2.Distance(npc.Center, Main.player[npc.target].Center) > 320f) + { + calamityGlobalNPC.newAI[0] = 0f; + Vector2 cursedFlameDirection = npc.Center; + float targetXDirection = Main.player[npc.target].Center.X - cursedFlameDirection.X; + float targetYDirection = Main.player[npc.target].Center.Y - cursedFlameDirection.Y; + float projSpeed = 7f + enrageScale * 2f; + float flameTargetDistance = (float)Math.Sqrt(targetXDirection * targetXDirection + targetYDirection * targetYDirection); + flameTargetDistance = projSpeed / flameTargetDistance; + targetXDirection *= flameTargetDistance; + targetYDirection *= flameTargetDistance; + targetYDirection += npc.velocity.Y * 0.5f; + targetXDirection += npc.velocity.X * 0.5f; + cursedFlameDirection.X -= targetXDirection; + cursedFlameDirection.Y -= targetYDirection; + + int type = (death && phase3) ? ModContent.ProjectileType() : ProjectileID.CursedFlameHostile; + Projectile.NewProjectile(npc.GetSource_FromAI(), cursedFlameDirection.X, cursedFlameDirection.Y, targetXDirection, targetYDirection, type, npc.GetProjectileDamage(type), 0f, Main.myPlayer); + } + } + } + } + + // Despawn + if (Main.player[npc.target].dead) + { + if (npc.timeLeft > 300) + npc.timeLeft = 300; + } + + // All functions that modify the active worm segments are here. This includes spawning the worm originally and splitting effects. + if (Main.netMode != NetmodeID.MultiplayerClient) + { + // If this segment is a head or a body without a next-segment defined, then it needs to spawn its own next segment. + if ((npc.type == NPCID.EaterofWorldsHead || npc.type == NPCID.EaterofWorldsBody) && npc.ai[0] == 0f) + { + int spawnX = (int)npc.position.X; + int spawnY = (int)npc.position.Y; + + // A head sets the length variable (npc.ai[2]) and then sets its next segment to a freshly spawned body. + if (npc.type == NPCID.EaterofWorldsHead) + { + // Amount of segments to spawn. + int segmentSpawnAmount = (int)(masterMode ? (totalSegments / TotalMasterModeWorms) : totalSegments); + + // Spawn additional worms of reduced length in Master Mode. + if (masterMode) + { + Vector2 additionalWormSpawnLocation = new Vector2(spawnX, spawnY); + int randomXLimit = 80; + int randomYLimit = 80; + for (int i = 1; i < TotalMasterModeWorms; i++) + { + additionalWormSpawnLocation += new Vector2((Main.rand.Next(randomXLimit + 1) + randomXLimit) * (Main.rand.NextBool() ? -1f : 1f), Main.rand.Next(randomYLimit + 1) + randomYLimit); + int wormHead = NPC.NewNPC(npc.GetSource_FromAI(), (int)additionalWormSpawnLocation.X, (int)additionalWormSpawnLocation.Y, NPCID.EaterofWorldsHead, npc.whoAmI + segmentSpawnAmount * i + 1); + Main.npc[wormHead].ai[2] = segmentSpawnAmount; + Main.npc[wormHead].ai[0] = NPC.NewNPC(Main.npc[wormHead].GetSource_FromAI(), (int)additionalWormSpawnLocation.X, (int)additionalWormSpawnLocation.Y, NPCID.EaterofWorldsBody, Main.npc[wormHead].whoAmI); + Main.npc[(int)Main.npc[wormHead].ai[0]].ai[1] = Main.npc[wormHead].whoAmI; + Main.npc[(int)Main.npc[wormHead].ai[0]].ai[2] = Main.npc[wormHead].ai[2] - 1f; + Main.npc[wormHead].netUpdate = true; + } + } + + // Set head's "length beyond this point" to be the total length of the worm. + npc.ai[2] = segmentSpawnAmount; + + // Body spawn + npc.ai[0] = NPC.NewNPC(npc.GetSource_FromAI(), spawnX, spawnY, NPCID.EaterofWorldsBody, npc.whoAmI); + } + + // A body with a "length beyond this point" greater than zero just sets its next spawned segment to a freshly spawned body. + else if (npc.type == NPCID.EaterofWorldsBody && npc.ai[2] > 0f) + npc.ai[0] = NPC.NewNPC(npc.GetSource_FromAI(), spawnX, spawnY, NPCID.EaterofWorldsBody, npc.whoAmI); + + // If the worm stops here ("length beyond this point" is zero), then spawn a tail instead. + else + npc.ai[0] = NPC.NewNPC(npc.GetSource_FromAI(), spawnX, spawnY, NPCID.EaterofWorldsTail, npc.whoAmI); + + // Maintain the linked list of worm segments, and correctly set the "length beyond this point" of this segment. + Main.npc[(int)npc.ai[0]].ai[1] = npc.whoAmI; + Main.npc[(int)npc.ai[0]].ai[2] = npc.ai[2] - 1f; + npc.netUpdate = true; + } + + // Helper function to destroy this Eater of Worlds worm segment. + void DestroyThisSegment() + { + npc.life = 0; + npc.HitEffect(0, 10.0); + npc.checkDead(); + } + + // If this segment's previous and next segments are both dead, make it explode instantly. Single segments cannot live. + if (!Main.npc[(int)npc.ai[1]].active && !Main.npc[(int)npc.ai[0]].active) + DestroyThisSegment(); + + // If this segment is a head and its next segment is dead, make it explode instantly. It's been decapitated. + if (npc.type == NPCID.EaterofWorldsHead && !Main.npc[(int)npc.ai[0]].active) + DestroyThisSegment(); + + // If this segment is a tail and its previous segment is dead, make it explode instantly. It's been chopped off. + if (npc.type == NPCID.EaterofWorldsTail && !Main.npc[(int)npc.ai[1]].active) + DestroyThisSegment(); + + // If this segment is a body and its previous segment is dead (or was rendered into a tail), transform into a head. + if (npc.type == NPCID.EaterofWorldsBody && (!Main.npc[(int)npc.ai[1]].active || Main.npc[(int)npc.ai[1]].aiStyle != npc.aiStyle)) + { + npc.type = NPCID.EaterofWorldsHead; + float segmentLifeRatio = MathHelper.Lerp(0.5f, 1f, npc.life / (float)npc.lifeMax); + int whoAmI = npc.whoAmI; + float ai0Holdover = npc.ai[0]; + float newAI1Holdover = calamityGlobalNPC.newAI[1]; + int slowingDebuffResistTimer = calamityGlobalNPC.debuffResistanceTimer; + + // Actually transform the body segment into a head segment. + npc.SetDefaultsKeepPlayerInteraction(npc.type); + npc.life = (int)(npc.lifeMax * segmentLifeRatio); + npc.whoAmI = whoAmI; + npc.ai[0] = ai0Holdover; + // Heads spawned mid fight by splitting do not get reset spawn invincibility. + CalamityGlobalNPC newCGN = npc.Calamity(); + newCGN.newAI[1] = newAI1Holdover; + newCGN.debuffResistanceTimer = slowingDebuffResistTimer; + npc.TargetClosest(); + npc.netUpdate = true; + npc.netSpam = 0; + npc.alpha = 0; + } + + // If this segment is a body and its next segment is dead (or was rendered into a head), transform into a tail. + if (npc.type == NPCID.EaterofWorldsBody && (!Main.npc[(int)npc.ai[0]].active || Main.npc[(int)npc.ai[0]].aiStyle != npc.aiStyle)) + { + npc.type = NPCID.EaterofWorldsTail; + float segmentLifeRatio = MathHelper.Lerp(0.5f, 1f, npc.life / (float)npc.lifeMax); + int whoAmI = npc.whoAmI; + float ai1Holdover = npc.ai[1]; + int slowingDebuffResistTimer = calamityGlobalNPC.debuffResistanceTimer; + + // Actually transform the body segment into a tail segment. + npc.SetDefaultsKeepPlayerInteraction(npc.type); + npc.life = (int)(npc.lifeMax * segmentLifeRatio); + npc.whoAmI = whoAmI; + npc.ai[1] = ai1Holdover; + npc.Calamity().debuffResistanceTimer = slowingDebuffResistTimer; + npc.TargetClosest(); + npc.netUpdate = true; + npc.netSpam = 0; + npc.alpha = 0; + } + + // If for any reason this segment was deleted, send info to clients so they also see it die. + if (!npc.active && Main.netMode == NetmodeID.Server) + NetMessage.SendData(MessageID.DamageNPC, -1, -1, null, npc.whoAmI, -1f); + } + + // Movement + int tilePositionX = (int)(npc.position.X / 16f) - 1; + int tileWidthPosX = (int)((npc.position.X + npc.width) / 16f) + 2; + int tilePositionY = (int)(npc.position.Y / 16f) - 1; + int tileWidthPosY = (int)((npc.position.Y + npc.height) / 16f) + 2; + if (tilePositionX < 0) + tilePositionX = 0; + if (tileWidthPosX > Main.maxTilesX) + tileWidthPosX = Main.maxTilesX; + if (tilePositionY < 0) + tilePositionY = 0; + if (tileWidthPosY > Main.maxTilesY) + tileWidthPosY = Main.maxTilesY; + + // Fly or not + bool inTiles = false; + if (!inTiles) + { + for (int i = tilePositionX; i < tileWidthPosX; i++) + { + for (int j = tilePositionY; j < tileWidthPosY; j++) + { + if (Main.tile[i, j] != null && ((Main.tile[i, j].HasUnactuatedTile && (Main.tileSolid[Main.tile[i, j].TileType] || (Main.tileSolidTop[Main.tile[i, j].TileType] && Main.tile[i, j].TileFrameY == 0))) || Main.tile[i, j].LiquidAmount > 64)) + { + Vector2 vector; + vector.X = i * 16; + vector.Y = j * 16; + if (npc.position.X + npc.width > vector.X && npc.position.X < vector.X + 16f && npc.position.Y + npc.height > vector.Y && npc.position.Y < vector.Y + 16f) + { + inTiles = true; + if (Main.rand.NextBool(100) && Main.tile[i, j].HasUnactuatedTile) + WorldGen.KillTile(i, j, true, true, false); + } + } + } + } + } + + if (!inTiles && npc.type == NPCID.EaterofWorldsHead) + { + Rectangle rectangle = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); + int noFlyZone = death ? 800 : 900; + noFlyZone -= (int)(enrageScale * 200f); + + if (masterMode) + noFlyZone -= phase5 ? 400 : 200; + + if (noFlyZone < 100) + noFlyZone = 100; + + bool freeMoveAnyway = true; + for (int k = 0; k < Main.maxPlayers; k++) + { + if (Main.player[k].active) + { + Rectangle rectangle2 = new Rectangle((int)Main.player[k].position.X - noFlyZone, (int)Main.player[k].position.Y - noFlyZone, noFlyZone * 2, noFlyZone * 2); + if (rectangle.Intersects(rectangle2)) + { + freeMoveAnyway = false; + break; + } + } + } + + if (freeMoveAnyway) + inTiles = true; + } + + // Velocity and acceleration + float velocityScale = (death ? 4.8f : 2.4f) * enrageScale; + float velocityBoost = velocityScale * (1f - lifeRatio); + float accelerationScale = (death ? 0.06f : 0.03f) * enrageScale; + float accelerationBoost = accelerationScale * (1f - lifeRatio); + float segmentVelocity = 12f + velocityBoost; + float segmentAcceleration = 0.15f + accelerationBoost; + + if (phase6) + { + segmentVelocity += (death ? 2.4f : 4f) * (enrageScale + 1f); + segmentAcceleration += 0.2f * (enrageScale + 1f); + } + else if (phase5) + { + segmentVelocity += (death ? 2.2f : 3f) * (enrageScale + 1f); + segmentAcceleration += 0.15f * (enrageScale + 1f); + } + else if (phase4) + { + segmentVelocity += 2f * (enrageScale + 1f); + segmentAcceleration += 0.1f * (enrageScale + 1f); + } + else if (phase3) + { + segmentVelocity += 0.8f * (enrageScale + 1f); + segmentAcceleration += 0.04f * (enrageScale + 1f); + } + + if (masterMode) + { + segmentVelocity += (npc.justHit ? 8f : 2f); + segmentAcceleration += (npc.justHit ? 0.16f : 0.04f); + } + + if (Main.getGoodWorld) + { + segmentVelocity += 4f; + segmentAcceleration += 0.05f; + } + + Vector2 segmentDirection = npc.Center; + Vector2 destination = Main.player[npc.target].Center + (phase6 ? Main.player[npc.target].velocity * 20f : Vector2.Zero); + float targetPosX = destination.X; + float targetPosY = destination.Y; + + targetPosX = (int)(targetPosX / 16f) * 16; + targetPosY = (int)(targetPosY / 16f) * 16; + segmentDirection.X = (int)(segmentDirection.X / 16f) * 16; + segmentDirection.Y = (int)(segmentDirection.Y / 16f) * 16; + targetPosX -= segmentDirection.X; + targetPosY -= segmentDirection.Y; + float targetDistance = (float)Math.Sqrt(targetPosX * targetPosX + targetPosY * targetPosY); + + // Does this worm segment have a "previous segment" defined? + if (npc.ai[1] > 0f && npc.ai[1] < Main.npc.Length) + { + try + { + segmentDirection = npc.Center; + targetPosX = Main.npc[(int)npc.ai[1]].Center.X - segmentDirection.X; + targetPosY = Main.npc[(int)npc.ai[1]].Center.Y - segmentDirection.Y; + } + catch + { + } + + npc.rotation = (float)Math.Atan2(targetPosY, targetPosX) + MathHelper.PiOver2; + targetDistance = (float)Math.Sqrt(targetPosX * targetPosX + targetPosY * targetPosY); + int npcWidth = npc.width; + npcWidth = (int)(npcWidth * npc.scale); + + if (Main.getGoodWorld) + npcWidth = 62; + + targetDistance = (targetDistance - npcWidth) / targetDistance; + targetPosX *= targetDistance; + targetPosY *= targetDistance; + npc.velocity = Vector2.Zero; + npc.position.X += targetPosX; + npc.position.Y += targetPosY; + } + + // Otherwise this is a head. (Why does this not just check for head NPC type?) + else + { + // Prevent new heads from being slowed when they spawn + if (calamityGlobalNPC.newAI[2] < 3f) + { + calamityGlobalNPC.newAI[2] += 1f; + + // Set velocity for when a new head spawns + // Only set this if the head is far enough away from the player, to avoid unfair hits + if (npc.Distance(Main.player[npc.target].Center) > segmentVelocity * 20f) + npc.velocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * (segmentVelocity * (death ? 0.75f : 0.5f)); + } + + if (!inTiles) + { + npc.velocity.Y += death ? 0.1375f : 0.11f; + if (masterMode && npc.velocity.Y > 0f) + npc.velocity.Y += 0.07f; + + if (npc.velocity.Y > segmentVelocity) + npc.velocity.Y = segmentVelocity; + + // This bool exists to stop the strange wiggle behavior when worms are falling down + bool slowXVelocity = Math.Abs(npc.velocity.X) > segmentAcceleration; + if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < segmentVelocity * 0.4) + { + if (npc.velocity.X < 0f) + npc.velocity.X -= segmentAcceleration * 1.1f; + else + npc.velocity.X += segmentAcceleration * 1.1f; + } + else if (npc.velocity.Y == segmentVelocity) + { + if (slowXVelocity) + { + if (npc.velocity.X < targetPosX) + npc.velocity.X += segmentAcceleration; + else if (npc.velocity.X > targetPosX) + npc.velocity.X -= segmentAcceleration; + } + else + npc.velocity.X = 0f; + } + else if (npc.velocity.Y > (death ? 5f : 4f)) + { + if (slowXVelocity) + { + if (npc.velocity.X < 0f) + npc.velocity.X += segmentAcceleration * 0.9f; + else + npc.velocity.X -= segmentAcceleration * 0.9f; + } + else + npc.velocity.X = 0f; + } + } + else + { + // Sound + if (npc.soundDelay == 0) + { + float soundDelay = targetDistance / 40f; + if (soundDelay < 10f) + soundDelay = 10f; + if (soundDelay > 20f) + soundDelay = 20f; + + npc.soundDelay = (int)soundDelay; + SoundEngine.PlaySound(SoundID.WormDig, npc.Center); + } + + targetDistance = (float)Math.Sqrt(targetPosX * targetPosX + targetPosY * targetPosY); + float absoluteTargetX = Math.Abs(targetPosX); + float absoluteTargetY = Math.Abs(targetPosY); + float timeToReachTarget = segmentVelocity / targetDistance; + targetPosX *= timeToReachTarget; + targetPosY *= timeToReachTarget; + + // Despawn + bool shouldDespawn = npc.type == NPCID.EaterofWorldsHead && Main.player[npc.target].dead; + if (shouldDespawn && !bossRush) + { + bool everyoneDead = true; + for (int i = 0; i < Main.maxPlayers; i++) + { + if (Main.player[i].active && !Main.player[i].dead) + { + everyoneDead = false; + break; + } + } + + if (everyoneDead) + { + if (Main.netMode != NetmodeID.MultiplayerClient && (npc.position.Y / 16f) > (Main.rockLayer + Main.maxTilesY) / 2.0) + { + npc.active = false; + int segmentAmt = (int)npc.ai[0]; + + while (segmentAmt > 0 && segmentAmt < Main.maxNPCs && Main.npc[segmentAmt].active && Main.npc[segmentAmt].aiStyle == npc.aiStyle) + { + int attachedSegments = (int)Main.npc[segmentAmt].ai[0]; + Main.npc[segmentAmt].active = false; + npc.life = 0; + + if (Main.netMode == NetmodeID.Server) + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, segmentAmt, 0f, 0f, 0f, 0, 0, 0); + + segmentAmt = attachedSegments; + } + + if (Main.netMode == NetmodeID.Server) + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, npc.whoAmI, 0f, 0f, 0f, 0, 0, 0); + } + targetPosX = 0f; + targetPosY = segmentVelocity; + } + } + + if ((npc.velocity.X > 0f && targetPosX > 0f) || (npc.velocity.X < 0f && targetPosX < 0f) || (npc.velocity.Y > 0f && targetPosY > 0f) || (npc.velocity.Y < 0f && targetPosY < 0f)) + { + if (npc.velocity.X < targetPosX) + npc.velocity.X += segmentAcceleration; + else if (npc.velocity.X > targetPosX) + npc.velocity.X -= segmentAcceleration; + if (npc.velocity.Y < targetPosY) + npc.velocity.Y += segmentAcceleration; + else if (npc.velocity.Y > targetPosY) + npc.velocity.Y -= segmentAcceleration; + + if (Math.Abs(targetPosY) < segmentVelocity * 0.2 && ((npc.velocity.X > 0f && targetPosX < 0f) || (npc.velocity.X < 0f && targetPosX > 0f))) + { + if (npc.velocity.Y > 0f) + npc.velocity.Y += segmentAcceleration * 2f; + else + npc.velocity.Y -= segmentAcceleration * 2f; + } + + if (Math.Abs(targetPosX) < segmentVelocity * 0.2 && ((npc.velocity.Y > 0f && targetPosY < 0f) || (npc.velocity.Y < 0f && targetPosY > 0f))) + { + if (npc.velocity.X > 0f) + npc.velocity.X += segmentAcceleration * 2f; + else + npc.velocity.X -= segmentAcceleration * 2f; + } + } + else if (absoluteTargetX > absoluteTargetY) + { + if (npc.velocity.X < targetPosX) + npc.velocity.X += segmentAcceleration * 1.1f; + else if (npc.velocity.X > targetPosX) + npc.velocity.X -= segmentAcceleration * 1.1f; + + if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < segmentVelocity * 0.5) + { + if (npc.velocity.Y > 0f) + npc.velocity.Y += segmentAcceleration; + else + npc.velocity.Y -= segmentAcceleration; + } + } + else + { + if (npc.velocity.Y < targetPosY) + npc.velocity.Y += segmentAcceleration * 1.1f; + else if (npc.velocity.Y > targetPosY) + npc.velocity.Y -= segmentAcceleration * 1.1f; + + if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < segmentVelocity * 0.5) + { + if (npc.velocity.X > 0f) + npc.velocity.X += segmentAcceleration; + else + npc.velocity.X -= segmentAcceleration; + } + } + } + + if (death) + { + int numHeads = NPC.CountNPCS(npc.type); + if (numHeads > 0) + { + // Limit this variable so that the following calculation never goes too low + numHeads--; + if (numHeads > 7) + numHeads = 7; + + float pushDistanceLowerLimit = 14f - numHeads; + float pushDistanceUpperLimit = 140f - numHeads * 10f; + float pushDistance = MathHelper.Lerp(pushDistanceLowerLimit, pushDistanceUpperLimit, 1f - lifeRatio) * npc.scale; + float pushVelocity = 0.25f + enrageScale * 0.125f; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active) + { + if (i != npc.whoAmI && Main.npc[i].type == npc.type) + { + if (Vector2.Distance(npc.Center, Main.npc[i].Center) < pushDistance) + { + if (npc.position.X < Main.npc[i].position.X) + npc.velocity.X -= pushVelocity; + else + npc.velocity.X += pushVelocity; + + if (npc.position.Y < Main.npc[i].position.Y) + npc.velocity.Y -= pushVelocity; + else + npc.velocity.Y += pushVelocity; + } + } + } + } + } + } + + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) + MathHelper.PiOver2; + + if (npc.type == NPCID.EaterofWorldsHead) + { + if (inTiles) + { + if (npc.localAI[0] != 1f) + npc.netUpdate = true; + + npc.localAI[0] = 1f; + } + else + { + if (npc.localAI[0] != 0f) + npc.netUpdate = true; + + npc.localAI[0] = 0f; + } + if (((npc.velocity.X > 0f && npc.oldVelocity.X < 0f) || (npc.velocity.X < 0f && npc.oldVelocity.X > 0f) || (npc.velocity.Y > 0f && npc.oldVelocity.Y < 0f) || (npc.velocity.Y < 0f && npc.oldVelocity.Y > 0f)) && !npc.justHit) + npc.netUpdate = true; + } + } + + // Calculate contact damage based on velocity + // This worm requires more velocity to deal damage with the body because it doesn't have spikes or metal bits or etc. + float minimalContactDamageHeadVelocity = segmentVelocity * 0.25f; + float minimalDamageHeadVelocity = segmentVelocity * 0.5f; + float minimalContactDamageBodyVelocity = segmentVelocity * 0.4f; + float minimalDamageBodyVelocity = segmentVelocity * 0.8f; + if (npc.type == NPCID.EaterofWorldsHead) + { + if (npc.velocity.Length() <= minimalContactDamageHeadVelocity) + { + npc.damage = (int)Math.Round(npc.defDamage * 0.5); + } + else + { + float velocityDamageScalar = MathHelper.Clamp((npc.velocity.Length() - minimalContactDamageHeadVelocity) / minimalDamageHeadVelocity, 0f, 1f); + npc.damage = (int)MathHelper.Lerp((float)Math.Round(npc.defDamage * 0.5), npc.defDamage, velocityDamageScalar); + } + } + else + { + float bodyAndTailVelocity = (npc.position - npc.oldPosition).Length(); + if (bodyAndTailVelocity <= minimalContactDamageBodyVelocity) + { + npc.damage = 0; + } + else + { + float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageBodyVelocity) / minimalDamageBodyVelocity, 0f, 1f); + npc.damage = (int)MathHelper.Lerp(0f, npc.defDamage, velocityDamageScalar); + } + } + + if (npc.type == NPCID.EaterofWorldsHead || (npc.type != NPCID.EaterofWorldsHead && Main.npc[(int)npc.ai[1]].alpha >= 85)) + { + if (npc.alpha > 0 && npc.life > 0) + { + for (int dustIndex = 0; dustIndex < 2; dustIndex++) + { + int dust = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, DustID.Demonite, 0f, 0f, 100, default(Color), 2f); + Main.dust[dust].noGravity = true; + Main.dust[dust].noLight = true; + } + } + + if ((npc.position - npc.oldPosition).Length() > 2f) + { + npc.alpha -= 42; + if (npc.alpha < 0) + npc.alpha = 0; + } + } + else if (npc.type > NPCID.EaterofWorldsHead && npc.alpha > 0) + { + npc.alpha -= 42; + if (npc.alpha < 0) + npc.alpha = 0; + } + + // Manually sync newAI because there is no GlobalNPC.SendExtraAI + if (npc.active && npc.netUpdate && Main.netMode == NetmodeID.Server) + { + ModPacket packet = mod.GetPacket(); + packet.Write((byte)CalamityModMessageType.SyncCalamityNPCAIArray); + packet.Write((byte)npc.whoAmI); + packet.Write(calamityGlobalNPC.newAI[0]); + packet.Write(calamityGlobalNPC.newAI[1]); + packet.Write(calamityGlobalNPC.newAI[2]); + packet.Write(calamityGlobalNPC.newAI[3]); + packet.Send(-1, -1); + } + + return false; + } + + public static bool VanillaEaterofWorldsAI(NPC npc, Mod mod) + { + if (Main.netMode != NetmodeID.MultiplayerClient && Main.expertMode) + { + if (npc.type == NPCID.EaterofWorldsBody && ((double)(npc.position.Y / 16f) < Main.worldSurface || Main.getGoodWorld)) + { + int num7 = (int)(npc.Center.X / 16f); + int num8 = (int)(npc.Center.Y / 16f); + if (WorldGen.InWorld(num7, num8) && Main.tile[num7, num8].WallType == WallID.None) + { + int num9 = Main.masterMode ? 600 : 900; + if (Main.getGoodWorld) + num9 /= 2; + + if (Main.rand.NextBool(num9)) + { + npc.TargetClosest(); + if (Collision.CanHitLine(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1)) + NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + npc.velocity.X), (int)(npc.Center.Y + npc.velocity.Y), NPCID.VileSpitEaterOfWorlds, 0, 0f, 1f); + } + } + } + else if (npc.type == NPCID.EaterofWorldsHead) + { + int num10 = Main.masterMode ? 15 : 90; + num10 += (int)((float)npc.life / (float)npc.lifeMax * 300f); + if (Main.rand.NextBool(num10)) + { + npc.TargetClosest(); + if (Collision.CanHitLine(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1)) + NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + npc.velocity.X), (int)(npc.Center.Y + npc.velocity.Y), NPCID.VileSpitEaterOfWorlds, 0, 0f, 1f); + } + } + } + + // 10 seconds of resistance to prevent spawn killing + if (npc.Calamity().newAI[1] < DRIncreaseTime) + npc.Calamity().newAI[1] += 1f; + + npc.realLife = -1; + + if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead) + npc.TargetClosest(); + + if (Main.player[npc.target].dead) + npc.EncourageDespawn(300); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if ((npc.type == NPCID.EaterofWorldsHead || npc.type == NPCID.EaterofWorldsBody) && npc.ai[0] == 0f) + { + if (npc.type == NPCID.EaterofWorldsHead) + { + npc.ai[2] = GetEaterOfWorldsSegmentsCountVanilla(); + npc.ai[0] = NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X), (int)(npc.position.Y + (float)npc.height), npc.type + 1, npc.whoAmI); + Main.npc[(int)npc.ai[0]].CopyInteractions(npc); + } + else if (npc.type == NPCID.EaterofWorldsBody && npc.ai[2] > 0f) + { + npc.ai[0] = NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X), (int)(npc.position.Y + (float)npc.height), npc.type, npc.whoAmI); + Main.npc[(int)npc.ai[0]].CopyInteractions(npc); + } + else + { + npc.ai[0] = NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X), (int)(npc.position.Y + (float)npc.height), npc.type + 1, npc.whoAmI); + Main.npc[(int)npc.ai[0]].CopyInteractions(npc); + } + + Main.npc[(int)npc.ai[0]].ai[1] = npc.whoAmI; + Main.npc[(int)npc.ai[0]].ai[2] = npc.ai[2] - 1f; + npc.netUpdate = true; + } + + if (!Main.npc[(int)npc.ai[1]].active && !Main.npc[(int)npc.ai[0]].active) + { + npc.life = 0; + npc.HitEffect(); + npc.checkDead(); + npc.active = false; + NetMessage.SendData(MessageID.DamageNPC, -1, -1, null, npc.whoAmI, -1f); + return false; + } + + if (npc.type == NPCID.EaterofWorldsHead && !Main.npc[(int)npc.ai[0]].active) + { + npc.life = 0; + npc.HitEffect(); + npc.checkDead(); + npc.active = false; + NetMessage.SendData(MessageID.DamageNPC, -1, -1, null, npc.whoAmI, -1f); + return false; + } + + if (npc.type == NPCID.EaterofWorldsTail && !Main.npc[(int)npc.ai[1]].active) + { + npc.life = 0; + npc.HitEffect(); + npc.checkDead(); + npc.active = false; + NetMessage.SendData(MessageID.DamageNPC, -1, -1, null, npc.whoAmI, -1f); + return false; + } + + if (npc.type == NPCID.EaterofWorldsBody && (!Main.npc[(int)npc.ai[1]].active || Main.npc[(int)npc.ai[1]].aiStyle != npc.aiStyle)) + { + npc.type = NPCID.EaterofWorldsHead; + int num38 = npc.whoAmI; + float num39 = (float)npc.life / (float)npc.lifeMax; + float num40 = npc.ai[0]; + npc.SetDefaultsKeepPlayerInteraction(npc.type); + npc.life = (int)((float)npc.lifeMax * num39); + npc.ai[0] = num40; + npc.TargetClosest(); + npc.netUpdate = true; + npc.whoAmI = num38; + npc.alpha = 0; + } + + if (npc.type == NPCID.EaterofWorldsBody && (!Main.npc[(int)npc.ai[0]].active || Main.npc[(int)npc.ai[0]].aiStyle != npc.aiStyle)) + { + npc.type = NPCID.EaterofWorldsTail; + int num41 = npc.whoAmI; + float num42 = (float)npc.life / (float)npc.lifeMax; + float num43 = npc.ai[1]; + npc.SetDefaultsKeepPlayerInteraction(npc.type); + npc.life = (int)((float)npc.lifeMax * num42); + npc.ai[1] = num43; + npc.TargetClosest(); + npc.netUpdate = true; + npc.whoAmI = num41; + npc.alpha = 0; + } + + if (!npc.active && Main.netMode == NetmodeID.Server) + NetMessage.SendData(MessageID.DamageNPC, -1, -1, null, npc.whoAmI, -1f); + } + + int num44 = (int)(npc.position.X / 16f) - 1; + int num45 = (int)((npc.position.X + (float)npc.width) / 16f) + 2; + int num46 = (int)(npc.position.Y / 16f) - 1; + int num47 = (int)((npc.position.Y + (float)npc.height) / 16f) + 2; + if (num44 < 0) + num44 = 0; + + if (num45 > Main.maxTilesX) + num45 = Main.maxTilesX; + + if (num46 < 0) + num46 = 0; + + if (num47 > Main.maxTilesY) + num47 = Main.maxTilesY; + + bool flag2 = false; + + if (!flag2) + { + Vector2 vector2 = default(Vector2); + for (int num48 = num44; num48 < num45; num48++) + { + for (int num49 = num46; num49 < num47; num49++) + { + if (Main.tile[num48, num49] == null || ((!Main.tile[num48, num49].HasUnactuatedTile || (!Main.tileSolid[Main.tile[num48, num49].TileType] && (!Main.tileSolidTop[Main.tile[num48, num49].TileType] || Main.tile[num48, num49].TileFrameY != 0))) && Main.tile[num48, num49].LiquidAmount <= 64)) + continue; + + vector2.X = num48 * 16; + vector2.Y = num49 * 16; + if (npc.position.X + (float)npc.width > vector2.X && npc.position.X < vector2.X + 16f && npc.position.Y + (float)npc.height > vector2.Y && npc.position.Y < vector2.Y + 16f) + { + flag2 = true; + if (Main.rand.NextBool(100) && Main.tile[num48, num49].HasUnactuatedTile && Main.tileSolid[Main.tile[num48, num49].TileType]) + WorldGen.KillTile(num48, num49, fail: true, effectOnly: true); + } + } + } + } + + if (!flag2 && npc.type == NPCID.EaterofWorldsHead) + { + Rectangle rectangle = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); + int num50 = Main.masterMode ? 750 : 1000; + bool flag3 = true; + for (int num51 = 0; num51 < Main.maxPlayers; num51++) + { + if (Main.player[num51].active) + { + Rectangle rectangle2 = new Rectangle((int)Main.player[num51].position.X - num50, (int)Main.player[num51].position.Y - num50, num50 * 2, num50 * 2); + if (rectangle.Intersects(rectangle2)) + { + flag3 = false; + break; + } + } + } + + if (flag3) + flag2 = true; + } + + float num52 = 10f; + float num53 = 0.07f; + if (Main.expertMode) + { + num52 = Main.masterMode ? 15f : 12f; + num53 = Main.masterMode ? 0.2f : 0.15f; + } + + if (Main.getGoodWorld) + { + num52 += 4f; + num53 += 0.05f; + } + + Vector2 vector5 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num55 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); + float num56 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); + num55 = (int)(num55 / 16f) * 16; + num56 = (int)(num56 / 16f) * 16; + vector5.X = (int)(vector5.X / 16f) * 16; + vector5.Y = (int)(vector5.Y / 16f) * 16; + num55 -= vector5.X; + num56 -= vector5.Y; + float num68 = (float)Math.Sqrt(num55 * num55 + num56 * num56); + if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) + { + try + { + vector5 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + num55 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector5.X; + num56 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector5.Y; + } + catch + { + } + + npc.rotation = (float)Math.Atan2(num56, num55) + MathHelper.PiOver2; + num68 = (float)Math.Sqrt(num55 * num55 + num56 * num56); + int num69 = npc.width; + num69 = (int)((float)num69 * npc.scale); + + if (Main.getGoodWorld) + num69 = 62; + + num68 = (num68 - (float)num69) / num68; + num55 *= num68; + num56 *= num68; + npc.velocity = Vector2.Zero; + npc.position.X += num55; + npc.position.Y += num56; + } + else + { + if (!flag2) + { + npc.TargetClosest(); + npc.velocity.Y += 0.11f; + if (Main.masterMode && npc.velocity.Y > 0f) + npc.velocity.Y += 0.07f; + + if (npc.velocity.Y > num52) + npc.velocity.Y = num52; + + // This bool exists to stop the strange wiggle behavior when worms are falling down + bool slowXVelocity = Math.Abs(npc.velocity.X) > num53; + if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)num52 * 0.4) + { + if (npc.velocity.X < 0f) + npc.velocity.X -= num53 * 1.1f; + else + npc.velocity.X += num53 * 1.1f; + } + else if (npc.velocity.Y == num52) + { + if (slowXVelocity) + { + if (npc.velocity.X < num55) + npc.velocity.X += num53; + else if (npc.velocity.X > num55) + npc.velocity.X -= num53; + } + else + npc.velocity.X = 0f; + } + else if (npc.velocity.Y > 4f) + { + if (slowXVelocity) + { + if (npc.velocity.X < 0f) + npc.velocity.X += num53 * 0.9f; + else + npc.velocity.X -= num53 * 0.9f; + } + else + npc.velocity.X = 0f; + } + } + else + { + if (npc.soundDelay == 0) + { + float num70 = num68 / 40f; + if (num70 < 10f) + num70 = 10f; + + if (num70 > 20f) + num70 = 20f; + + npc.soundDelay = (int)num70; + SoundEngine.PlaySound(SoundID.WormDig, npc.Center); + } + + num68 = (float)Math.Sqrt(num55 * num55 + num56 * num56); + float num71 = Math.Abs(num55); + float num72 = Math.Abs(num56); + float num73 = num52 / num68; + num55 *= num73; + num56 *= num73; + bool flag4 = false; + if (npc.type == NPCID.EaterofWorldsHead && ((!Main.player[npc.target].ZoneCorrupt && !Main.player[npc.target].ZoneCrimson) || Main.player[npc.target].dead)) + flag4 = true; + + if (flag4) + { + bool flag5 = true; + for (int num74 = 0; num74 < Main.maxPlayers; num74++) + { + if (Main.player[num74].active && !Main.player[num74].dead && Main.player[num74].ZoneCorrupt) + flag5 = false; + } + + if (flag5) + { + if (Main.netMode != NetmodeID.MultiplayerClient && (double)(npc.position.Y / 16f) > (Main.rockLayer + (double)Main.maxTilesY) / 2.0) + { + npc.active = false; + int num75 = (int)npc.ai[0]; + while (num75 > 0 && num75 < Main.maxNPCs && Main.npc[num75].active && Main.npc[num75].aiStyle == npc.aiStyle) + { + int num76 = (int)Main.npc[num75].ai[0]; + Main.npc[num75].active = false; + npc.life = 0; + if (Main.netMode == NetmodeID.Server) + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num75); + + num75 = num76; + } + + if (Main.netMode == NetmodeID.Server) + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, npc.whoAmI); + } + + num55 = 0f; + num56 = num52; + } + } + + if ((npc.velocity.X > 0f && num55 > 0f) || (npc.velocity.X < 0f && num55 < 0f) || (npc.velocity.Y > 0f && num56 > 0f) || (npc.velocity.Y < 0f && num56 < 0f)) + { + if (npc.velocity.X < num55) + npc.velocity.X += num53; + else if (npc.velocity.X > num55) + npc.velocity.X -= num53; + + if (npc.velocity.Y < num56) + npc.velocity.Y += num53; + else if (npc.velocity.Y > num56) + npc.velocity.Y -= num53; + + if ((double)Math.Abs(num56) < (double)num52 * 0.2 && ((npc.velocity.X > 0f && num55 < 0f) || (npc.velocity.X < 0f && num55 > 0f))) + { + if (npc.velocity.Y > 0f) + npc.velocity.Y += num53 * 2f; + else + npc.velocity.Y -= num53 * 2f; + } + + if ((double)Math.Abs(num55) < (double)num52 * 0.2 && ((npc.velocity.Y > 0f && num56 < 0f) || (npc.velocity.Y < 0f && num56 > 0f))) + { + if (npc.velocity.X > 0f) + npc.velocity.X += num53 * 2f; + else + npc.velocity.X -= num53 * 2f; + } + } + else if (num71 > num72) + { + if (npc.velocity.X < num55) + npc.velocity.X += num53 * 1.1f; + else if (npc.velocity.X > num55) + npc.velocity.X -= num53 * 1.1f; + + if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)num52 * 0.5) + { + if (npc.velocity.Y > 0f) + npc.velocity.Y += num53; + else + npc.velocity.Y -= num53; + } + } + else + { + if (npc.velocity.Y < num56) + npc.velocity.Y += num53 * 1.1f; + else if (npc.velocity.Y > num56) + npc.velocity.Y -= num53 * 1.1f; + + if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)num52 * 0.5) + { + if (npc.velocity.X > 0f) + npc.velocity.X += num53; + else + npc.velocity.X -= num53; + } + } + } + + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) + MathHelper.PiOver2; + if (npc.type == NPCID.EaterofWorldsHead) + { + if (flag2) + { + if (npc.localAI[0] != 1f) + npc.netUpdate = true; + + npc.localAI[0] = 1f; + } + else + { + if (npc.localAI[0] != 0f) + npc.netUpdate = true; + + npc.localAI[0] = 0f; + } + + if (((npc.velocity.X > 0f && npc.oldVelocity.X < 0f) || (npc.velocity.X < 0f && npc.oldVelocity.X > 0f) || (npc.velocity.Y > 0f && npc.oldVelocity.Y < 0f) || (npc.velocity.Y < 0f && npc.oldVelocity.Y > 0f)) && !npc.justHit) + npc.netUpdate = true; + } + } + + // Calculate contact damage based on velocity + // This worm requires more velocity to deal damage with the body because it doesn't have spikes or metal bits or etc. + float minimalContactDamageHeadVelocity = num52 * 0.25f; + float minimalDamageHeadVelocity = num52 * 0.5f; + float minimalContactDamageBodyVelocity = num52 * 0.4f; + float minimalDamageBodyVelocity = num52 * 0.8f; + if (npc.type == NPCID.EaterofWorldsHead) + { + if (npc.velocity.Length() <= minimalContactDamageHeadVelocity) + { + npc.damage = (int)Math.Round(npc.defDamage * 0.5); + } + else + { + float velocityDamageScalar = MathHelper.Clamp((npc.velocity.Length() - minimalContactDamageHeadVelocity) / minimalDamageHeadVelocity, 0f, 1f); + npc.damage = (int)MathHelper.Lerp((float)Math.Round(npc.defDamage * 0.5), npc.defDamage, velocityDamageScalar); + } + } + else + { + float bodyAndTailVelocity = (npc.position - npc.oldPosition).Length(); + if (bodyAndTailVelocity <= minimalContactDamageBodyVelocity) + { + npc.damage = 0; + } + else + { + float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageBodyVelocity) / minimalDamageBodyVelocity, 0f, 1f); + npc.damage = (int)MathHelper.Lerp(0f, npc.defDamage, velocityDamageScalar); + } + } + + if (npc.type == NPCID.EaterofWorldsHead || (npc.type != NPCID.EaterofWorldsHead && Main.npc[(int)npc.ai[1]].alpha >= 85)) + { + if (npc.alpha > 0 && npc.life > 0) + { + for (int num80 = 0; num80 < 2; num80++) + { + int num81 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, DustID.Demonite, 0f, 0f, 100, default(Color), 2f); + Main.dust[num81].noGravity = true; + Main.dust[num81].noLight = true; + } + } + + if ((npc.position - npc.oldPosition).Length() > 2f) + { + npc.alpha -= 42; + if (npc.alpha < 0) + npc.alpha = 0; + } + } + else if (npc.type > NPCID.EaterofWorldsHead && npc.alpha > 0) + { + npc.alpha -= 42; + if (npc.alpha < 0) + npc.alpha = 0; + } + + return false; + } + + public static int GetEaterOfWorldsSegmentsCountRevDeath() + { + return CalamityWorld.LegendaryMode ? 100 : + (CalamityWorld.death || BossRushEvent.BossRushActive) ? ((Main.masterMode || BossRushEvent.BossRushActive) ? 60 : 57) : + ((Main.masterMode || BossRushEvent.BossRushActive) ? 68 : 62); + } + + public static int GetEaterOfWorldsSegmentsCountVanilla() + { + return (Main.masterMode || BossRushEvent.BossRushActive) ? 75 : Main.expertMode ? 70 : 65; + } + } +} diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/EmpressofLightAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/EmpressofLightAI.cs new file mode 100644 index 0000000000..fef2365546 --- /dev/null +++ b/NPCs/VanillaNPCAIOverrides/Bosses/EmpressofLightAI.cs @@ -0,0 +1,2445 @@ +using System; +using CalamityMod.Events; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses +{ + public static class EmpressofLightAI + { + public static bool BuffedEmpressofLightAI(NPC npc, Mod mod) + { + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + + // Difficulty bools. + bool bossRush = BossRushEvent.BossRushActive; + bool masterMode = Main.masterMode || bossRush; + bool death = CalamityWorld.death || bossRush; + + // Rotation + npc.rotation = npc.velocity.X * 0.005f; + + // Reset DR every frame. + calamityGlobalNPC.DR = 0.15f; + + // Percent life remaining. + float lifeRatio = npc.life / (float)npc.lifeMax; + + float phase2LifeRatio = masterMode ? 0.7f : 0.6f; + float phase3LifeRatio = masterMode ? 0.3f : 0.15f; + bool phase2 = npc.AI_120_HallowBoss_IsInPhase2(); + bool phase3 = lifeRatio <= phase3LifeRatio; + + bool shouldBeInPhase2ButIsStillInPhase1 = lifeRatio <= phase2LifeRatio && !phase2; + if (shouldBeInPhase2ButIsStillInPhase1) + calamityGlobalNPC.DR = 0.99f; + + calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = shouldBeInPhase2ButIsStillInPhase1 || npc.ai[0] == 6f; + + bool dayTimeEnrage = NPC.ShouldEmpressBeEnraged(); + if (npc.life == npc.lifeMax && dayTimeEnrage && !npc.AI_120_HallowBoss_IsGenuinelyEnraged()) + npc.ai[3] += 2f; + + npc.Calamity().CurrentlyEnraged = !bossRush && dayTimeEnrage; + + int projectileDamageMultiplier = dayTimeEnrage ? 2 : 1; + + Vector2 rainbowStreakDistance = new Vector2(-250f, -350f); + Vector2 everlastingRainbowDistance = new Vector2(0f, -450f); + Vector2 etherealLanceDistance = new Vector2(0f, -450f); + Vector2 sunDanceDistance = new Vector2(-80f, -500f); + + float acceleration = death ? 0.66f : 0.6f; + float velocity = death ? 16.5f : 15f; + float movementDistanceGateValue = 40f; + float despawnDistanceGateValue = 6400f; + + if (dayTimeEnrage) + { + float enragedDistanceMultiplier = 1.1f; + rainbowStreakDistance *= enragedDistanceMultiplier; + everlastingRainbowDistance *= enragedDistanceMultiplier; + etherealLanceDistance *= enragedDistanceMultiplier; + + float enragedVelocityMultiplier = 1.2f; + acceleration *= enragedVelocityMultiplier; + velocity *= enragedVelocityMultiplier; + } + + bool visible = true; + bool takeDamage = true; + float lessTimeSpentPerPhaseMultiplier = phase2 ? (death ? 0.375f : 0.5f) : (death ? 0.75f : 1f); + if (Main.getGoodWorld) + lessTimeSpentPerPhaseMultiplier *= 0.2f; + + float extraPhaseTime; + Vector2 destination; + + // Variables for dust visuals on spawn and in phase 3 + float playSpawnSoundTime = 10f; + float stopSpawningDustTime = 150f; + float spawnTime = 180f; + + // Do visual stuff in phase 3 + float maxOpacity = phase3 ? 0.7f : 1f; + int minAlpha = 255 - (int)(255 * maxOpacity); + if (phase3) + { + if (calamityGlobalNPC.newAI[0] == playSpawnSoundTime) + SoundEngine.PlaySound(SoundID.Item161, npc.Center); + + if (calamityGlobalNPC.newAI[0] > playSpawnSoundTime && calamityGlobalNPC.newAI[0] < stopSpawningDustTime) + CreateSpawnDust(npc, false); + + calamityGlobalNPC.newAI[0] += 1f; + if (calamityGlobalNPC.newAI[0] >= stopSpawningDustTime) + { + calamityGlobalNPC.newAI[0] = playSpawnSoundTime + 1f; + npc.SyncExtraAI(); + } + } + + switch ((int)npc.ai[0]) + { + // Spawn animation. + case 0: + + // Avoid cheap bullshit. + npc.damage = 0; + + if (npc.ai[1] == 0f) + { + npc.velocity = new Vector2(0f, 5f); + if (Main.netMode != NetmodeID.MultiplayerClient) + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + new Vector2(0f, -80f), Vector2.Zero, ProjectileID.HallowBossDeathAurora, 0, 0f, Main.myPlayer); + } + + if (npc.ai[1] == playSpawnSoundTime) + SoundEngine.PlaySound(SoundID.Item161, npc.Center); + + npc.velocity *= 0.95f; + + if (npc.ai[1] > playSpawnSoundTime && npc.ai[1] < stopSpawningDustTime) + CreateSpawnDust(npc); + + npc.ai[1] += 1f; + visible = false; + takeDamage = false; + npc.Opacity = MathHelper.Clamp(npc.ai[1] / spawnTime, 0f, 1f); + + if (npc.ai[1] >= spawnTime) + { + if (dayTimeEnrage && !npc.AI_120_HallowBoss_IsGenuinelyEnraged()) + npc.ai[3] += 2f; + + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.netUpdate = true; + npc.TargetClosest(); + } + + break; + + // Phase switch. + case 1: + + // Avoid cheap bullshit. + npc.damage = 0; + + float idleTimer = phase2 ? (death ? 10f : 15f) : (death ? 20f : 30f); + if (Main.getGoodWorld) + idleTimer *= 0.5f; + if (idleTimer < 10f) + idleTimer = 10f; + + if (npc.ai[1] <= 10f) + { + if (npc.ai[1] == 0f) + npc.TargetClosest(); + + // Despawn. + NPCAimedTarget targetData4 = npc.GetTargetData(); + if (targetData4.Invalid) + { + npc.ai[0] = 13f; + npc.ai[1] = 0f; + npc.ai[2] += 1f; + npc.velocity /= 4f; + npc.netUpdate = true; + break; + } + + Vector2 center = targetData4.Center; + center += new Vector2(0f, -400f); + if (npc.Distance(center) > 200f) + center -= npc.DirectionTo(center) * 100f; + + Vector2 targetDirection = center - npc.Center; + float lerpValue = Utils.GetLerpValue(100f, 600f, targetDirection.Length()); + float targetDistance = targetDirection.Length(); + + float maxVelocity = death ? 24f : 21f; + if (targetDistance > maxVelocity) + targetDistance = maxVelocity; + + npc.velocity = Vector2.Lerp(targetDirection.SafeNormalize(Vector2.Zero) * targetDistance, targetDirection / 6f, lerpValue); + npc.netUpdate = true; + } + + npc.velocity *= 0.92f; + npc.ai[1] += 1f; + if (!(npc.ai[1] >= idleTimer)) + break; + + int attackPatternLength = (int)npc.ai[2]; + int attackType = 2; + int attackIncrement = 0; + + if (!phase2) + { + int phase1Attack1 = attackIncrement++; + int phase1Attack2 = attackIncrement++; + int phase1Attack3 = attackIncrement++; + int phase1Attack4 = attackIncrement++; + int phase1Attack5 = attackIncrement++; + int phase1Attack6 = attackIncrement++; + int phase1Attack7 = attackIncrement++; + int phase1Attack8 = attackIncrement++; + int phase1Attack9 = attackIncrement++; + int phase1Attack10 = attackIncrement++; + + if (attackPatternLength % attackIncrement == phase1Attack1) + attackType = 2; + + if (attackPatternLength % attackIncrement == phase1Attack2) + attackType = 6; + + if (attackPatternLength % attackIncrement == phase1Attack3) + attackType = 8; + + if (attackPatternLength % attackIncrement == phase1Attack4) + { + attackType = 4; + + // Adjust the upcoming Ethereal Lance attack depending on what random variable is chosen here. + calamityGlobalNPC.newAI[3] = Main.rand.Next(2); + + // Sync the Calamity AI variables. + npc.SyncExtraAI(); + } + + if (attackPatternLength % attackIncrement == phase1Attack5) + attackType = 5; + + if (attackPatternLength % attackIncrement == phase1Attack6) + attackType = 8; + + if (attackPatternLength % attackIncrement == phase1Attack7) + attackType = 2; + + if (attackPatternLength % attackIncrement == phase1Attack8) + { + attackType = 4; + + // Adjust the upcoming Ethereal Lance attack depending on what random variable is chosen here. + calamityGlobalNPC.newAI[3] = Main.rand.Next(2); + + // Sync the Calamity AI variables. + npc.SyncExtraAI(); + } + + if (attackPatternLength % attackIncrement == phase1Attack9) + attackType = 8; + + if (attackPatternLength % attackIncrement == phase1Attack10) + attackType = 5; + + if (lifeRatio <= phase2LifeRatio) + attackType = 10; + } + + if (phase2) + { + int phase2Attack1 = attackIncrement++; + int phase2Attack2 = attackIncrement++; + int phase2Attack3 = attackIncrement++; + int phase2Attack4 = attackIncrement++; + int phase2Attack5 = attackIncrement++; + int phase2Attack6 = attackIncrement++; + int phase2Attack7 = attackIncrement++; + int phase2Attack8 = attackIncrement++; + int phase2Attack9 = attackIncrement++; + int phase2Attack10 = attackIncrement++; + + if (attackPatternLength % attackIncrement == phase2Attack1) + { + attackType = 7; + + // Adjust the upcoming Ethereal Lance attack depending on what random variable is chosen here. + calamityGlobalNPC.newAI[2] = Main.rand.Next(2); + + // Sync the Calamity AI variables. + npc.SyncExtraAI(); + } + + if (attackPatternLength % attackIncrement == phase2Attack2) + attackType = phase3 ? 8 : 2; + + if (attackPatternLength % attackIncrement == phase2Attack3) + attackType = 8; + + if (attackPatternLength % attackIncrement == phase2Attack5) + attackType = 5; + + if (attackPatternLength % attackIncrement == phase2Attack6) + attackType = 2; + + if (attackPatternLength % attackIncrement == phase2Attack7) + { + if (phase3) + { + attackType = 7; + + // Adjust the upcoming Ethereal Lance attack depending on what random variable is chosen here. + calamityGlobalNPC.newAI[2] = Main.rand.Next(2); + + // Sync the Calamity AI variables. + npc.SyncExtraAI(); + } + else + attackType = 6; + } + + if (attackPatternLength % attackIncrement == phase2Attack7) + { + if (phase3) + { + attackType = 4; + + // Adjust the upcoming Ethereal Lance attack depending on what random variable is chosen here. + calamityGlobalNPC.newAI[3] = Main.rand.Next(2); + + // Sync the Calamity AI variables. + npc.SyncExtraAI(); + } + else + attackType = 6; + } + + if (attackPatternLength % attackIncrement == phase2Attack8) + { + attackType = 4; + + // Adjust the upcoming Ethereal Lance attack depending on what random variable is chosen here. + calamityGlobalNPC.newAI[3] = Main.rand.Next(2); + + // Sync the Calamity AI variables. + npc.SyncExtraAI(); + } + + if (attackPatternLength % attackIncrement == phase2Attack9) + attackType = 8; + + if (attackPatternLength % attackIncrement == phase2Attack4) + attackType = 11; + + if (attackPatternLength % attackIncrement == phase2Attack10) + attackType = 12; + } + + npc.TargetClosest(); + NPCAimedTarget targetData5 = npc.GetTargetData(); + bool despawnFlag = false; + if (npc.AI_120_HallowBoss_IsGenuinelyEnraged() && !bossRush) + { + if (!Main.dayTime) + despawnFlag = true; + + if (Main.dayTime && Main.time >= 53400D) + despawnFlag = true; + } + + // Despawn. + if (targetData5.Invalid || npc.Distance(targetData5.Center) > despawnDistanceGateValue || despawnFlag) + attackType = 13; + + // Set charge direction. + if (attackType == 8 && targetData5.Center.X > npc.Center.X) + attackType = 9; + + if (attackType != 5 && attackType != 12) + npc.velocity = npc.DirectionFrom(targetData5.Center).SafeNormalize(Vector2.Zero).RotatedBy(MathHelper.PiOver2 * (targetData5.Center.X > npc.Center.X).ToDirectionInt()) * 24f; + + npc.ai[0] = attackType; + npc.ai[1] = 0f; + npc.ai[2] += Main.rand.Next(2) + 1f; + npc.netUpdate = true; + + break; + + // Spawn homing Rainbow Streaks. + case 2: + + // Avoid cheap bullshit. + npc.damage = 0; + + if (npc.ai[1] == 0f) + SoundEngine.PlaySound(SoundID.Item164, npc.Center); + + Vector2 randomStreakOffset = new Vector2(-55f, -30f); + NPCAimedTarget targetData11 = npc.GetTargetData(); + Vector2 targetCenter = targetData11.Invalid ? npc.Center : targetData11.Center; + if (npc.Distance(targetCenter + rainbowStreakDistance) > movementDistanceGateValue) + npc.SimpleFlyMovement(npc.DirectionTo(targetCenter + rainbowStreakDistance).SafeNormalize(Vector2.Zero) * velocity, acceleration); + + if (npc.ai[1] < 60f) + AI_120_HallowBoss_DoMagicEffect(npc.Center + randomStreakOffset, 1, Utils.GetLerpValue(0f, 60f, npc.ai[1], clamped: true), npc); + + int streakSpawnFrequency = CalamityWorld.LegendaryMode ? 1 : 2; + if (phase3) + streakSpawnFrequency *= 2; + + if ((int)npc.ai[1] % streakSpawnFrequency == 0 && npc.ai[1] < 60f) + { + int projectileType = ProjectileID.HallowBossRainbowStreak; + int projectileDamage = npc.GetProjectileDamage(projectileType) * projectileDamageMultiplier; + + float ai3 = npc.ai[1] / 60f; + Vector2 rainbowStreakVelocity = new Vector2(0f, death ? -10f : -8f).RotatedBy(MathHelper.PiOver2 * Main.rand.NextFloatDirection()); + if (phase2) + rainbowStreakVelocity = new Vector2(0f, death ? -12f : -10f).RotatedBy(MathHelper.TwoPi * Main.rand.NextFloat()); + + if (dayTimeEnrage) + rainbowStreakVelocity *= MathHelper.Lerp(0.8f, 1.6f, ai3); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + randomStreakOffset, rainbowStreakVelocity, projectileType, projectileDamage, 0f, Main.myPlayer, npc.target, ai3); + if (phase3) + { + int proj2 = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + randomStreakOffset, -rainbowStreakVelocity, projectileType, projectileDamage, 0f, Main.myPlayer, npc.target, 1f - ai3); + if (Main.rand.NextBool(60) && CalamityWorld.LegendaryMode) + { + Main.projectile[proj2].extraUpdates += 1; + Main.projectile[proj2].netUpdate = true; + } + } + + if (Main.rand.NextBool(60) && CalamityWorld.LegendaryMode) + { + Main.projectile[proj].extraUpdates += 1; + Main.projectile[proj].netUpdate = true; + } + } + + // Spawn extra homing Rainbow Streaks per player. + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int multiplayerStreakSpawnFrequency = (int)(npc.ai[1] / streakSpawnFrequency); + for (int i = 0; i < Main.maxPlayers; i++) + { + if (npc.Boss_CanShootExtraAt(i, multiplayerStreakSpawnFrequency % 3, 3, 2400f)) + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + randomStreakOffset, rainbowStreakVelocity, projectileType, projectileDamage, 0f, Main.myPlayer, i, ai3); + } + } + } + + npc.ai[1] += 1f; + extraPhaseTime = (dayTimeEnrage ? (masterMode ? 30f : 36f) : (masterMode ? 60f : 72f)) + 30f * lessTimeSpentPerPhaseMultiplier; + if (npc.ai[1] >= 60f + extraPhaseTime) + { + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.netUpdate = true; + } + + break; + + // This is never fucking used. + /*case 3: + { + npc.ai[1] += 1f; + NPCAimedTarget targetData8 = npc.GetTargetData(); + Vector2 targetCenter = targetData8.Invalid ? npc.Center : targetData8.Center; + if (npc.Distance(targetCenter + phase2AnimationDistance) > 0.5f) + npc.SimpleFlyMovement(npc.DirectionTo(targetCenter + phase2AnimationDistance).SafeNormalize(Vector2.Zero) * scaleFactor, 4f); + + if ((int)npc.ai[1] % 180 == 0) + { + Vector2 auroraVector = new Vector2(0f, -100f); + Projectile.NewProjectile(npc.GetSource_FromAI(), targetData8.Center + auroraVector, Vector2.Zero, ProjectileID.HallowBossDeathAurora, magicAmt, 0f, Main.myPlayer); + } + + if (npc.ai[1] >= 120f) + { + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.netUpdate = true; + } + + break; + }*/ + + // Spawn Ethereal Lances around the target in seemingly random places (they will be made slower to make this easier to deal with). + case 4: + + // Avoid cheap bullshit. + npc.damage = 0; + + if (npc.ai[1] == 0f) + SoundEngine.PlaySound(SoundID.Item162, npc.Center); + + float lanceGateValue = masterMode ? 75f : 100f; + + if (npc.ai[1] >= 6f && npc.ai[1] < 54f) + { + AI_120_HallowBoss_DoMagicEffect(npc.Center + new Vector2(-55f, -20f), 2, Utils.GetLerpValue(0f, lanceGateValue, npc.ai[1], clamped: true), npc); + AI_120_HallowBoss_DoMagicEffect(npc.Center + new Vector2(55f, -20f), 4, Utils.GetLerpValue(0f, lanceGateValue, npc.ai[1], clamped: true), npc); + } + + NPCAimedTarget targetData10 = npc.GetTargetData(); + targetCenter = targetData10.Invalid ? npc.Center : targetData10.Center; + if (npc.Distance(targetCenter + etherealLanceDistance) > movementDistanceGateValue) + npc.SimpleFlyMovement(npc.DirectionTo(targetCenter + etherealLanceDistance).SafeNormalize(Vector2.Zero) * velocity, acceleration); + + int lanceRotation = death ? 10 : 8; + if (npc.ai[1] % (dayTimeEnrage ? 2f : 3f) == 0f && npc.ai[1] < lanceGateValue) + { + int lanceAmount = phase3 ? 2 : 1; + for (int i = 0; i < lanceAmount; i++) + { + int lanceFrequency = (int)(npc.ai[1] / (dayTimeEnrage ? 2f : 3f)); + lanceRotation += (masterMode ? 5 : 4) * i; + Vector2 lanceDirection = Vector2.UnitX.RotatedBy((float)Math.PI / (lanceRotation * 2) + lanceFrequency * ((float)Math.PI / lanceRotation)); + if (calamityGlobalNPC.newAI[3] == 0f) + lanceDirection.X += (lanceDirection.X > 0f) ? 0.5f : -0.5f; + + lanceDirection = lanceDirection.SafeNormalize(Vector2.UnitY); + float spawnDistance = 600f; + + Vector2 playerCenter = targetData10.Center; + if (npc.Distance(playerCenter) > 2400f) + continue; + + if (Vector2.Dot(targetData10.Velocity.SafeNormalize(Vector2.UnitY), lanceDirection) > 0f) + lanceDirection *= -1f; + + Vector2 targetHoverPos = playerCenter + targetData10.Velocity * 90; + Vector2 spawnLocation = playerCenter + lanceDirection * spawnDistance - targetData10.Velocity * 30f; + if (spawnLocation.Distance(playerCenter) < spawnDistance) + { + Vector2 lanceSpawnDirection = playerCenter - spawnLocation; + if (lanceSpawnDirection == Vector2.Zero) + lanceSpawnDirection = lanceDirection; + + spawnLocation = playerCenter - lanceSpawnDirection.SafeNormalize(Vector2.UnitY) * spawnDistance; + } + + int projectileType = ProjectileID.FairyQueenLance; + int projectileDamage = npc.GetProjectileDamage(projectileType) * projectileDamageMultiplier; + + Vector2 v3 = targetHoverPos - spawnLocation; + if (Main.netMode != NetmodeID.MultiplayerClient) + Projectile.NewProjectile(npc.GetSource_FromAI(), spawnLocation, Vector2.Zero, projectileType, projectileDamage, 0f, Main.myPlayer, v3.ToRotation(), npc.ai[1] / lanceGateValue); + + if (Main.netMode == NetmodeID.MultiplayerClient) + continue; + + // Spawn extra Ethereal Lances per player. + for (int j = 0; j < Main.maxPlayers; j++) + { + if (!npc.Boss_CanShootExtraAt(j, lanceFrequency % 3, 3, 2400f)) + continue; + + Player extraPlayer = Main.player[j]; + playerCenter = extraPlayer.Center; + if (Vector2.Dot(extraPlayer.velocity.SafeNormalize(Vector2.UnitY), lanceDirection) > 0f) + lanceDirection *= -1f; + + Vector2 extraPlayerSpawnLocation = playerCenter + extraPlayer.velocity * 90; + spawnLocation = playerCenter + lanceDirection * spawnDistance - extraPlayer.velocity * 30f; + if (spawnLocation.Distance(playerCenter) < spawnDistance) + { + Vector2 extraPlayerSpawnDirection = playerCenter - spawnLocation; + if (extraPlayerSpawnDirection == Vector2.Zero) + extraPlayerSpawnDirection = lanceDirection; + + spawnLocation = playerCenter - extraPlayerSpawnDirection.SafeNormalize(Vector2.UnitY) * spawnDistance; + } + + v3 = extraPlayerSpawnLocation - spawnLocation; + Projectile.NewProjectile(npc.GetSource_FromAI(), spawnLocation, Vector2.Zero, projectileType, projectileDamage, 0f, Main.myPlayer, v3.ToRotation(), npc.ai[1] / lanceGateValue); + } + } + } + + npc.ai[1] += 1f; + extraPhaseTime = (dayTimeEnrage ? 24f : 48f) + 20f * lessTimeSpentPerPhaseMultiplier; + if (npc.ai[1] >= lanceGateValue + extraPhaseTime) + { + npc.ai[0] = 1f; + npc.ai[1] = 0f; + calamityGlobalNPC.newAI[3] = 0f; + npc.netUpdate = true; + + // Sync the Calamity AI variables. + npc.SyncExtraAI(); + } + + break; + + // Spawn Everlasting Rainbow spiral. + case 5: + + // Avoid cheap bullshit. + npc.damage = 0; + + if (npc.ai[1] == 0f) + SoundEngine.PlaySound(SoundID.Item163, npc.Center); + + Vector2 magicSpawnOffset = new Vector2(55f, -30f); + Vector2 everlastingRainbowSpawn = npc.Center + magicSpawnOffset; + if (npc.ai[1] < 42f) + AI_120_HallowBoss_DoMagicEffect(npc.Center + magicSpawnOffset, 3, Utils.GetLerpValue(0f, 42f, npc.ai[1], clamped: true), npc); + + NPCAimedTarget targetData7 = npc.GetTargetData(); + targetCenter = targetData7.Invalid ? npc.Center : targetData7.Center; + if (npc.Distance(targetCenter + everlastingRainbowDistance) > movementDistanceGateValue) + npc.SimpleFlyMovement(npc.DirectionTo(targetCenter + everlastingRainbowDistance).SafeNormalize(Vector2.Zero) * velocity, acceleration); + + if (npc.ai[1] % 42f == 0f && npc.ai[1] < 42f) + { + float projRotation = MathHelper.TwoPi * Main.rand.NextFloat(); + float totalProjectiles = CalamityWorld.LegendaryMode ? 30f : death ? (dayTimeEnrage ? 22f : 15f) : (dayTimeEnrage ? 18f : 13f); + int projIndex = 0; + bool inversePhase2SpreadPattern = Main.rand.NextBool(); + for (float i = 0f; i < 1f; i += 1f / totalProjectiles) + { + int projectileType = ProjectileID.HallowBossLastingRainbow; + int projectileDamage = npc.GetProjectileDamage(projectileType) * projectileDamageMultiplier; + int projectileType2 = ProjectileID.HallowBossRainbowStreak; + int projectileDamage2 = npc.GetProjectileDamage(projectileType2) * projectileDamageMultiplier; + + float projRotationMultiplier = i; + Vector2 spinningpoint = Vector2.UnitY.RotatedBy(MathHelper.PiOver2 + MathHelper.TwoPi * projRotationMultiplier + projRotation); + + float initialVelocity = death ? 2f : 1.75f; + if (dayTimeEnrage && projIndex % 2 == 0) + initialVelocity *= 2f; + if (CalamityWorld.LegendaryMode) + initialVelocity *= 1.5f; + + // Given that maxAddedVelocity = 2 + // Before inverse: index 0 = 2, index 0.25 = 0, index 0.5 = 2, index 0.75 = 0, index 1 = 2 + // After inverse: index 0 = 0, index 0.25 = 2, index 0.5 = 0, index 0.75 = 2, index 1 = 0 + if (phase2) + { + float maxAddedVelocity = initialVelocity; + float addedVelocity = inversePhase2SpreadPattern ? Math.Abs(maxAddedVelocity - Math.Abs(MathHelper.Lerp(-maxAddedVelocity, maxAddedVelocity, Math.Abs(i - 0.5f) * 2f))) : Math.Abs(MathHelper.Lerp(-maxAddedVelocity, maxAddedVelocity, Math.Abs(i - 0.5f) * 2f)); + initialVelocity += addedVelocity; + } + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Projectile.NewProjectile(npc.GetSource_FromAI(), everlastingRainbowSpawn + spinningpoint.RotatedBy(-MathHelper.PiOver2) * 30f, spinningpoint * initialVelocity, projectileType, projectileDamage, 0f, Main.myPlayer, 0f, projRotationMultiplier); + + if (phase3) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + Projectile.NewProjectile(npc.GetSource_FromAI(), everlastingRainbowSpawn + spinningpoint.RotatedBy(-MathHelper.PiOver2) * 30f, spinningpoint * (masterMode ? 3f : 2f) * initialVelocity, projectileType2, projectileDamage2, 0f, Main.myPlayer, npc.target, projRotationMultiplier); + } + } + + projIndex++; + } + } + + npc.ai[1] += 1f; + extraPhaseTime = (dayTimeEnrage ? 36f : 72f) + 30f * lessTimeSpentPerPhaseMultiplier; + if (npc.ai[1] >= 72f + extraPhaseTime) + { + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.netUpdate = true; + } + + break; + + // Use Sun Dance. + case 6: + + // Avoid cheap bullshit. + npc.damage = 0; + + // Increase durability. + calamityGlobalNPC.DR = shouldBeInPhase2ButIsStillInPhase1 ? 0.99f : (bossRush ? 0.99f : 0.575f); + + int totalSunDances = phase2 ? 2 : 3; + float sunDanceGateValue = dayTimeEnrage ? 35f : death ? 40f : 50f; + float totalSunDancePhaseTime = totalSunDances * sunDanceGateValue; + + Vector2 sunDanceHoverOffset = new Vector2(0f, -100f); + Vector2 position = npc.Center + sunDanceHoverOffset; + + NPCAimedTarget targetData2 = npc.GetTargetData(); + targetCenter = targetData2.Invalid ? npc.Center : targetData2.Center; + if (npc.Distance(targetCenter + sunDanceDistance) > movementDistanceGateValue) + npc.SimpleFlyMovement(npc.DirectionTo(targetCenter + sunDanceDistance).SafeNormalize(Vector2.Zero) * velocity * 0.3f, acceleration * 0.7f); + + if (npc.ai[1] % sunDanceGateValue == 0f && npc.ai[1] < totalSunDancePhaseTime) + { + int projectileType = ProjectileID.FairyQueenSunDance; + int projectileDamage = npc.GetProjectileDamage(projectileType) * projectileDamageMultiplier; + + int sunDanceExtension = (int)(npc.ai[1] / sunDanceGateValue); + int targetFloatDirection = (targetData2.Center.X > npc.Center.X) ? 1 : 0; + float projAmount = phase2 ? 8f : 6f; + float projRotation = 1f / projAmount; + for (float j = 0f; j < 1f; j += projRotation) + { + float projDirection = (j + projRotation * 0.5f + sunDanceExtension * projRotation * 0.5f) % 1f; + float ai = MathHelper.TwoPi * (projDirection + targetFloatDirection); + if (Main.netMode != NetmodeID.MultiplayerClient) + Projectile.NewProjectile(npc.GetSource_FromAI(), position, Vector2.Zero, projectileType, projectileDamage, 0f, Main.myPlayer, ai, npc.whoAmI); + } + } + + npc.ai[1] += 1f; + extraPhaseTime = (dayTimeEnrage ? (masterMode ? 105f : 110f) : (masterMode ? 140f : 150f)) + 30f * lessTimeSpentPerPhaseMultiplier; // 112.5 is too little + if (npc.ai[1] >= totalSunDancePhaseTime + extraPhaseTime) + { + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.netUpdate = true; + } + + break; + + // Spawn rows of Ethereal Lances. + case 7: + + // Avoid cheap bullshit. + npc.damage = 0; + + // Expert attack or not. + bool expertAttack = calamityGlobalNPC.newAI[2] == 0f; + + int numLanceWalls = expertAttack ? 6 : 4; + float lanceWallSpawnGateValue = expertAttack ? 36f : 54f; + if (dayTimeEnrage) + lanceWallSpawnGateValue -= expertAttack ? 4f : 6f; + + float lanceWallPhaseTime = lanceWallSpawnGateValue * numLanceWalls; + + NPCAimedTarget targetData9 = npc.GetTargetData(); + destination = targetData9.Invalid ? npc.Center : targetData9.Center; + if (npc.Distance(destination + etherealLanceDistance) > movementDistanceGateValue) + npc.SimpleFlyMovement(npc.DirectionTo(destination + etherealLanceDistance).SafeNormalize(Vector2.Zero) * velocity * 0.4f, acceleration); + + if ((int)npc.ai[1] % lanceWallSpawnGateValue == 0f && npc.ai[1] < lanceWallPhaseTime) + { + SoundEngine.PlaySound(SoundID.Item162, npc.Center); + + float totalProjectiles = masterMode ? 18f : 15f; + float lanceSpacing = masterMode ? 150f : 175f; + float lanceWallSize = totalProjectiles * lanceSpacing; + + Vector2 lanceSpawnOffset = targetData9.Center; + if (npc.Distance(lanceSpawnOffset) <= 3200f) + { + Vector2 lanceWallStartingPosition = Vector2.Zero; + Vector2 lanceWallDirection = Vector2.UnitY; + float lanceWallConvergence = 0.4f; + float lanceWallSizeMult = 1.4f; + totalProjectiles += 5f; + lanceSpacing += 50f; + lanceWallSize *= (masterMode ? 0.75f : 0.5f); + float direction = 1f; + + int randomLanceWallType; + do randomLanceWallType = Main.rand.Next(numLanceWalls); + while (randomLanceWallType == calamityGlobalNPC.newAI[3]); + + // This is set so that Empress doesn't use the same wall type twice in a row. + calamityGlobalNPC.newAI[3] = randomLanceWallType; + + // Keeps track of the total number of lance walls used. + calamityGlobalNPC.newAI[1] += 1f; + + // Sync the Calamity AI variables. + npc.SyncExtraAI(); + + switch (randomLanceWallType) + { + case 0: + lanceSpawnOffset += new Vector2((0f - lanceWallSize) / 2f, 0f) * direction; + lanceWallStartingPosition = new Vector2(0f, lanceWallSize); + lanceWallDirection = Vector2.UnitX; + break; + + case 1: + lanceSpawnOffset += new Vector2(lanceWallSize / 2f, lanceSpacing / 2f) * direction; + lanceWallStartingPosition = new Vector2(0f, lanceWallSize); + lanceWallDirection = -Vector2.UnitX; + break; + + case 2: + lanceSpawnOffset += new Vector2(0f - lanceWallSize, 0f - lanceWallSize) * lanceWallConvergence * direction; + lanceWallStartingPosition = new Vector2(lanceWallSize * lanceWallSizeMult, 0f); + lanceWallDirection = new Vector2(1f, 1f); + break; + + case 3: + lanceSpawnOffset += new Vector2(lanceWallSize * lanceWallConvergence + lanceSpacing / 2f, (0f - lanceWallSize) * lanceWallConvergence) * direction; + lanceWallStartingPosition = new Vector2((0f - lanceWallSize) * lanceWallSizeMult, 0f); + lanceWallDirection = new Vector2(-1f, 1f); + break; + + case 4: + lanceSpawnOffset += new Vector2(0f - lanceWallSize, lanceWallSize) * lanceWallConvergence * direction; + lanceWallStartingPosition = new Vector2(lanceWallSize * lanceWallSizeMult, 0f); + lanceWallDirection = lanceSpawnOffset.DirectionTo(targetData9.Center); + break; + + case 5: + lanceSpawnOffset += new Vector2(lanceWallSize * lanceWallConvergence + lanceSpacing / 2f, lanceWallSize * lanceWallConvergence) * direction; + lanceWallStartingPosition = new Vector2((0f - lanceWallSize) * lanceWallSizeMult, 0f); + lanceWallDirection = lanceSpawnOffset.DirectionTo(targetData9.Center); + break; + } + + int projectileType = ProjectileID.FairyQueenLance; + int projectileDamage = npc.GetProjectileDamage(projectileType) * projectileDamageMultiplier; + + for (float i = 0f; i <= 1f; i += 1f / totalProjectiles) + { + Vector2 spawnLocation = lanceSpawnOffset + lanceWallStartingPosition * (i - 0.5f) * (expertAttack ? 1f : 2f); + Vector2 v2 = lanceWallDirection; + if (expertAttack) + { + Vector2 lanceWallSpawnPredictiveness = targetData9.Velocity * 20f * i; + Vector2 lanceWallSpawnLocation = spawnLocation.DirectionTo(targetData9.Center + lanceWallSpawnPredictiveness); + v2 = Vector2.Lerp(lanceWallDirection, lanceWallSpawnLocation, 0.75f).SafeNormalize(Vector2.UnitY); + } + + if (Main.netMode != NetmodeID.MultiplayerClient) + Projectile.NewProjectile(npc.GetSource_FromAI(), spawnLocation, Vector2.Zero, projectileType, projectileDamage, 0f, Main.myPlayer, v2.ToRotation(), i); + } + } + + // Chance to stop using the lance walls and switch to a different attack after 3 lance walls are used. + if (Main.rand.NextBool(5 - ((int)calamityGlobalNPC.newAI[1] - 2)) && calamityGlobalNPC.newAI[1] >= 2f) + { + npc.ai[1] = lanceWallPhaseTime; + npc.netUpdate = true; + } + } + + npc.ai[1] += 1f; + extraPhaseTime = (dayTimeEnrage ? 24f : 48f) + 20f * lessTimeSpentPerPhaseMultiplier; + if (npc.ai[1] >= lanceWallPhaseTime + extraPhaseTime) + { + npc.ai[0] = 1f; + npc.ai[1] = 0f; + calamityGlobalNPC.newAI[3] = 0f; + calamityGlobalNPC.newAI[1] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + npc.SyncExtraAI(); + npc.netUpdate = true; + } + + break; + + // Charge either left or right. + case 8: + case 9: + + int chargeDirection = (npc.ai[0] != 8f) ? 1 : (-1); + + AI_120_HallowBoss_DoMagicEffect(npc.Center, 5, Utils.GetLerpValue(40f, 90f, npc.ai[1], clamped: true), npc); + + float chargeGateValue = 40f; + float playChargeSoundTime = 20f; + float chargeDuration = phase3 ? 40f : 50f; + float slowDownTime = 30f; + float totalPhaseTime = chargeGateValue + chargeDuration + slowDownTime; + float chargeStartDistance = phase3 ? 1000f : 800f; + float chargeVelocity = phase3 ? 100f : 70f; + float chargeAcceleration = phase3 ? 0.1f : 0.07f; + + if (npc.ai[1] <= chargeGateValue) + { + // Avoid cheap bullshit. + npc.damage = 0; + + if (npc.ai[1] == playChargeSoundTime) + SoundEngine.PlaySound(SoundID.Item160, npc.Center); + + NPCAimedTarget targetData3 = npc.GetTargetData(); + destination = (targetData3.Invalid ? npc.Center : targetData3.Center) + new Vector2(chargeDirection * -chargeStartDistance, 0f); + npc.SimpleFlyMovement(npc.DirectionTo(destination).SafeNormalize(Vector2.Zero) * velocity, acceleration * 2f); + + if (npc.ai[1] == chargeGateValue) + npc.velocity *= 0.3f; + } + else if (npc.ai[1] <= chargeGateValue + chargeDuration) + { + // Spawn Rainbow Streaks during charge. + if (npc.ai[1] == chargeGateValue + 1f) + SoundEngine.PlaySound(SoundID.Item164, npc.Center); + + float rainbowStreakGateValue = 2f; + if ((npc.ai[1] - 1f) % rainbowStreakGateValue == 0f) + { + int projectileType = ProjectileID.HallowBossRainbowStreak; + int projectileDamage = npc.GetProjectileDamage(projectileType) * projectileDamageMultiplier; + + float ai3 = (npc.ai[1] - chargeGateValue - 1f) / chargeDuration; + Vector2 rainbowStreakVelocity = new Vector2(0f, death ? -5f : -4f).RotatedBy(MathHelper.PiOver2 * Main.rand.NextFloatDirection()); + if (phase2) + rainbowStreakVelocity = new Vector2(0f, death ? -6f : -5f).RotatedBy(MathHelper.TwoPi * Main.rand.NextFloat()); + + rainbowStreakVelocity.X *= 2f; + if (!phase2) + rainbowStreakVelocity.Y *= 0.5f; + + if (dayTimeEnrage) + rainbowStreakVelocity *= MathHelper.Lerp(0.8f, 1.6f, ai3); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, rainbowStreakVelocity, projectileType, projectileDamage, 0f, Main.myPlayer, npc.target, ai3); + if (Main.rand.NextBool(30) && CalamityWorld.LegendaryMode) + { + Main.projectile[proj].extraUpdates += 1; + Main.projectile[proj].netUpdate = true; + } + } + + // Spawn extra homing Rainbow Streaks per player. + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int multiplayerStreakSpawnFrequency = (int)((npc.ai[1] - chargeGateValue - 1f) / rainbowStreakGateValue); + for (int i = 0; i < Main.maxPlayers; i++) + { + if (npc.Boss_CanShootExtraAt(i, multiplayerStreakSpawnFrequency % 3, 3, 2400f)) + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, rainbowStreakVelocity, projectileType, projectileDamage, 0f, Main.myPlayer, i, ai3); + } + } + } + + npc.velocity = Vector2.Lerp(value2: new Vector2(chargeDirection * chargeVelocity, 0f), value1: npc.velocity, amount: chargeAcceleration); + + if (npc.ai[1] == chargeGateValue + chargeDuration) + npc.velocity *= 0.45f; + + npc.damage = (int)Math.Round(npc.defDamage * (dayTimeEnrage ? 3D : 1.5)); + } + else + { + // Avoid cheap bullshit. + npc.damage = 0; + + npc.velocity *= 0.92f; + } + + npc.ai[1] += 1f; + extraPhaseTime = (dayTimeEnrage ? 24f : 48f) * lessTimeSpentPerPhaseMultiplier; + if (npc.ai[1] >= totalPhaseTime + extraPhaseTime) + { + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.netUpdate = true; + } + + break; + + // Phase 2 animation. + case 10: + + // Avoid cheap bullshit. + npc.damage = 0; + + if (npc.ai[1] == 0f) + SoundEngine.PlaySound(SoundID.Item161, npc.Center); + + takeDamage = !(npc.ai[1] >= 30f) || !(npc.ai[1] <= 170f); + + npc.velocity *= 0.95f; + + if (npc.ai[1] == 90f) + { + if (npc.ai[3] == 0f) + npc.ai[3] = 1f; + + if (npc.ai[3] == 2f) + npc.ai[3] = 3f; + + npc.Center = npc.GetTargetData().Center + new Vector2(0f, -250f); + npc.netUpdate = true; + } + + npc.ai[1] += 1f; + if (npc.ai[1] >= 180f) + { + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.netUpdate = true; + } + + break; + + // Spawn Ethereal Lances ahead of the target. + case 11: + + // Avoid cheap bullshit. + npc.damage = 0; + + if (npc.ai[1] == 0f) + SoundEngine.PlaySound(SoundID.Item162, npc.Center); + + float lanceGateValue2 = masterMode ? 75f : 100f; + + if (npc.ai[1] >= 6f && npc.ai[1] < 54f) + { + AI_120_HallowBoss_DoMagicEffect(npc.Center + new Vector2(-55f, -20f), 2, Utils.GetLerpValue(0f, lanceGateValue2, npc.ai[1], clamped: true), npc); + AI_120_HallowBoss_DoMagicEffect(npc.Center + new Vector2(55f, -20f), 4, Utils.GetLerpValue(0f, lanceGateValue2, npc.ai[1], clamped: true), npc); + } + + NPCAimedTarget targetData6 = npc.GetTargetData(); + targetCenter = targetData6.Invalid ? npc.Center : targetData6.Center; + if (npc.Distance(targetCenter + etherealLanceDistance) > movementDistanceGateValue) + npc.SimpleFlyMovement(npc.DirectionTo(targetCenter + etherealLanceDistance).SafeNormalize(Vector2.Zero) * velocity, acceleration); + + float etherealLanceGateValue = death ? 5f : 6f; + if (dayTimeEnrage) + etherealLanceGateValue -= 1f; + + if (npc.ai[1] % etherealLanceGateValue == 0f && npc.ai[1] < lanceGateValue2) + { + int numLances = phase3 ? 4 : 3; + for (int i = 0; i < numLances; i++) + { + // Spawn another lance in the opposite location + bool oppositeLance = i % 2 == 0; + + Vector2 inverseTargetVel = oppositeLance ? targetData6.Velocity : -targetData6.Velocity; + inverseTargetVel.SafeNormalize(-Vector2.UnitY); + float spawnDistance = 100f + (i * 100f); + + targetCenter = targetData6.Center; + if (npc.Distance(targetCenter) > 2400f) + continue; + + Vector2 straightLanceSpawnPredict = targetCenter + (oppositeLance ? -targetData6.Velocity : targetData6.Velocity) * 90; + Vector2 straightLanceSpawnDirection = targetCenter + inverseTargetVel * spawnDistance; + if (straightLanceSpawnDirection.Distance(targetCenter) < spawnDistance) + { + Vector2 straightLanceSpawnLocation = targetCenter - straightLanceSpawnDirection; + if (straightLanceSpawnLocation == Vector2.Zero) + straightLanceSpawnLocation = inverseTargetVel; + + straightLanceSpawnDirection = targetCenter - straightLanceSpawnLocation.SafeNormalize(Vector2.UnitY) * spawnDistance; + } + + int projectileType = ProjectileID.FairyQueenLance; + int projectileDamage = npc.GetProjectileDamage(projectileType) * projectileDamageMultiplier; + + Vector2 v = straightLanceSpawnPredict - straightLanceSpawnDirection; + if (Main.netMode != NetmodeID.MultiplayerClient) + Projectile.NewProjectile(npc.GetSource_FromAI(), straightLanceSpawnDirection, Vector2.Zero, projectileType, projectileDamage, 0f, Main.myPlayer, v.ToRotation(), npc.ai[1] / lanceGateValue2); + + if (Main.netMode == NetmodeID.MultiplayerClient) + continue; + + int multiplayerExtraStraightLances = (int)(npc.ai[1] / etherealLanceGateValue); + for (int l = 0; l < Main.maxPlayers; l++) + { + if (!npc.Boss_CanShootExtraAt(l, multiplayerExtraStraightLances % 3, 3, 2400f)) + continue; + + Player player = Main.player[l]; + inverseTargetVel = oppositeLance ? player.velocity : -player.velocity; + inverseTargetVel.SafeNormalize(-Vector2.UnitY); + targetCenter = player.Center; + Vector2 extraPlayerLancePredict = targetCenter + (oppositeLance ? -player.velocity : player.velocity) * 90; + straightLanceSpawnDirection = targetCenter + inverseTargetVel * spawnDistance; + if (straightLanceSpawnDirection.Distance(targetCenter) < spawnDistance) + { + Vector2 extraPlayerLanceSpawnLocation = targetCenter - straightLanceSpawnDirection; + if (extraPlayerLanceSpawnLocation == Vector2.Zero) + extraPlayerLanceSpawnLocation = inverseTargetVel; + + straightLanceSpawnDirection = targetCenter - extraPlayerLanceSpawnLocation.SafeNormalize(Vector2.UnitY) * spawnDistance; + } + + v = extraPlayerLancePredict - straightLanceSpawnDirection; + Projectile.NewProjectile(npc.GetSource_FromAI(), straightLanceSpawnDirection, Vector2.Zero, projectileType, projectileDamage, 0f, Main.myPlayer, v.ToRotation(), npc.ai[1] / lanceGateValue2); + } + } + } + + npc.ai[1] += 1f; + extraPhaseTime = (dayTimeEnrage ? 24f : 48f) * lessTimeSpentPerPhaseMultiplier; + if (npc.ai[1] >= lanceGateValue2 + extraPhaseTime) + { + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.netUpdate = true; + } + + break; + + // Spawn homing Rainbow Streaks. + case 12: + + // Avoid cheap bullshit. + npc.damage = 0; + + Vector2 projRandomOffset = new Vector2(-55f, -30f); + + if (npc.ai[1] == 0f) + { + SoundEngine.PlaySound(SoundID.Item165, npc.Center); + npc.velocity = new Vector2(0f, -12f); + } + + npc.velocity *= 0.95f; + + bool shouldSpawnStreaks = npc.ai[1] < 60f && npc.ai[1] >= 10f; + if (shouldSpawnStreaks) + AI_120_HallowBoss_DoMagicEffect(npc.Center + projRandomOffset, 1, Utils.GetLerpValue(0f, 60f, npc.ai[1], clamped: true), npc); + + int stationaryStreakSpawnFrequency = 4; + if (dayTimeEnrage) + stationaryStreakSpawnFrequency -= 1; + if (phase3) + stationaryStreakSpawnFrequency *= 2; + + float streakHomeTime = (npc.ai[1] - 10f) / 50f; + if ((int)npc.ai[1] % stationaryStreakSpawnFrequency == 0 && shouldSpawnStreaks) + { + int projectileType = ProjectileID.HallowBossRainbowStreak; + int projectileDamage = npc.GetProjectileDamage(projectileType) * projectileDamageMultiplier; + + Vector2 vector = new Vector2(0f, (death ? -24f : -22f) - (phase3 ? ((masterMode ? 6f : 4f) * streakHomeTime) : 0f)).RotatedBy(MathHelper.TwoPi * streakHomeTime); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + projRandomOffset, vector, projectileType, projectileDamage, 0f, Main.myPlayer, npc.target, streakHomeTime); + if (phase3) + { + int proj2 = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + projRandomOffset, -vector, projectileType, projectileDamage, 0f, Main.myPlayer, npc.target, 1f - streakHomeTime); + if (Main.rand.NextBool(15) && CalamityWorld.LegendaryMode) + { + Main.projectile[proj2].extraUpdates += 1; + Main.projectile[proj2].netUpdate = true; + } + } + + if (Main.rand.NextBool(15) && CalamityWorld.LegendaryMode) + { + Main.projectile[proj].extraUpdates += 1; + Main.projectile[proj].netUpdate = true; + } + } + + // Spawn extra homing Rainbow Streaks per player. + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int extraStationaryStreakSpawnFrequency = (int)(npc.ai[1] % stationaryStreakSpawnFrequency); + for (int j = 0; j < Main.maxPlayers; j++) + { + if (npc.Boss_CanShootExtraAt(j, extraStationaryStreakSpawnFrequency % 3, 3, 2400f)) + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + projRandomOffset, vector, projectileType, projectileDamage, 0f, Main.myPlayer, j, streakHomeTime); + } + } + } + + npc.ai[1] += 1f; + extraPhaseTime = (dayTimeEnrage ? 36f : 72f) + 30f * lessTimeSpentPerPhaseMultiplier; + if (npc.ai[1] >= (masterMode ? 105f : 120f) + extraPhaseTime) + { + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.netUpdate = true; + } + + break; + + // Despawn. + case 13: + + // Avoid cheap bullshit. + npc.damage = 0; + + if (npc.ai[1] == 0f) + { + SoundEngine.PlaySound(SoundID.Item165, npc.Center); + npc.velocity = new Vector2(0f, -7f); + } + + npc.velocity *= 0.95f; + + npc.TargetClosest(); + NPCAimedTarget targetData = npc.GetTargetData(); + + visible = false; + + bool trueDespawnFlag = false; + bool shouldDespawn = false; + if (!trueDespawnFlag) + { + if (npc.AI_120_HallowBoss_IsGenuinelyEnraged() && !bossRush) + { + if (!Main.dayTime) + shouldDespawn = true; + + if (Main.dayTime && Main.time >= 53400.0) + shouldDespawn = true; + } + + trueDespawnFlag = trueDespawnFlag || shouldDespawn; + } + + if (!trueDespawnFlag) + { + bool hasNoTarget = targetData.Invalid || npc.Distance(targetData.Center) > despawnDistanceGateValue; + trueDespawnFlag = trueDespawnFlag || hasNoTarget; + } + + npc.alpha = Utils.Clamp(npc.alpha + trueDespawnFlag.ToDirectionInt() * 5, 0, 255); + bool alphaExtreme = npc.alpha == 0 || npc.alpha == 255; + + int despawnDustAmt = 5; + for (int i = 0; i < despawnDustAmt; i++) + { + float despawnDustOpacity = MathHelper.Lerp(1.3f, 0.7f, npc.Opacity); + Color newColor = Main.hslToRgb(Main.rand.NextFloat(), 1f, 0.5f); + int despawnRainbowDust = Dust.NewDust(npc.position - npc.Size * 0.5f, npc.width * 2, npc.height * 2, DustID.RainbowMk2, 0f, 0f, 0, newColor); + Main.dust[despawnRainbowDust].position = npc.Center + Main.rand.NextVector2Circular(npc.width, npc.height); + Main.dust[despawnRainbowDust].velocity *= Main.rand.NextFloat() * 0.8f; + Main.dust[despawnRainbowDust].noGravity = true; + Main.dust[despawnRainbowDust].scale = 0.9f + Main.rand.NextFloat() * 1.2f; + Main.dust[despawnRainbowDust].fadeIn = 0.4f + Main.rand.NextFloat() * 1.2f * despawnDustOpacity; + Main.dust[despawnRainbowDust].velocity += Vector2.UnitY * -2f; + Main.dust[despawnRainbowDust].scale = 0.35f; + if (despawnRainbowDust != 6000) + { + Dust dust = Dust.CloneDust(despawnRainbowDust); + dust.scale /= 2f; + dust.fadeIn *= 0.85f; + dust.color = new Color(255, 255, 255, 255); + } + } + + npc.ai[1] += 1f; + if (!(npc.ai[1] >= 20f && alphaExtreme)) + break; + + if (npc.alpha == 255) + { + npc.active = false; + if (Main.netMode != NetmodeID.MultiplayerClient) + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, npc.whoAmI); + + return false; + } + + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.netUpdate = true; + break; + } + + npc.dontTakeDamage = !takeDamage; + + if (phase3) + npc.defense = (int)Math.Round(npc.defDefense * 0.8); + else if (phase2) + npc.defense = (int)Math.Round(npc.defDefense * 1.2); + else + npc.defense = npc.defDefense; + + if ((npc.localAI[0] += 1f) >= 44f) + npc.localAI[0] = 0f; + + if (visible) + npc.alpha = Utils.Clamp(npc.alpha - 5, 0, 255); + + Lighting.AddLight(npc.Center, Vector3.One * npc.Opacity); + + return false; + } + + public static bool VanillaEmpressofLightAI(NPC npc, Mod mod) + { + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + + Vector2 stopMovingLocation = new Vector2(-250f, -350f); + Vector2 stopMovingLocation3 = new Vector2(0f, -450f); + Vector2 stopMovingLocation4 = new Vector2(0f, -450f); + Vector2 stopMovingLocation5 = new Vector2(-80f, -500f); + + // Rotation + npc.rotation = npc.velocity.X * 0.005f; + + // Reset DR every frame + calamityGlobalNPC.DR = 0.15f; + + bool phase2 = npc.AI_120_HallowBoss_IsInPhase2(); + bool expertMode = Main.expertMode; + bool masterMode = Main.masterMode; + bool expertModePhase2 = phase2 && expertMode; + bool masterModePhase2 = phase2 && masterMode; + float phase2LifeRatio = masterMode ? 0.7f : expertMode ? 0.6f : 0.5f; + float phase3LifeRatio = masterMode ? 0.3f : 0.15f; + bool genuinePhase2 = npc.life / (float)npc.lifeMax <= phase2LifeRatio; + bool phase3 = npc.life / (float)npc.lifeMax <= phase3LifeRatio && expertMode; + + bool shouldBeInPhase2ButIsStillInPhase1 = npc.life / (float)npc.lifeMax <= phase2LifeRatio && !phase2; + if (shouldBeInPhase2ButIsStillInPhase1) + calamityGlobalNPC.DR = 0.99f; + + calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = shouldBeInPhase2ButIsStillInPhase1 || npc.ai[0] == 6f; + + bool enraged = NPC.ShouldEmpressBeEnraged(); + if (npc.life == npc.lifeMax && enraged && !npc.AI_120_HallowBoss_IsGenuinelyEnraged()) + npc.ai[3] += 2f; + + calamityGlobalNPC.CurrentlyEnraged = !BossRushEvent.BossRushActive && enraged; + + int projectileDamageMultiplier = enraged ? 2 : 1; + + bool becomeVisible = true; + + float moveSpeed = masterMode ? 0.6f : expertMode ? 0.55f : 0.5f; + float desiredVelocity = masterMode ? 14.4f : expertMode ? 13.2f : 12f; + float stopMovingDistance = 40f; + float despawnDistance = 6400f; + int lanceDamage = npc.GetProjectileDamage(ProjectileID.FairyQueenLance); + int rainbowStreakDamage = npc.GetProjectileDamage(ProjectileID.HallowBossRainbowStreak); + int lastingRainbowDamage = npc.GetProjectileDamage(ProjectileID.HallowBossLastingRainbow); + int sunDanceDamage = npc.GetProjectileDamage(ProjectileID.FairyQueenSunDance); + + lanceDamage *= projectileDamageMultiplier; + rainbowStreakDamage *= projectileDamageMultiplier; + lastingRainbowDamage *= projectileDamageMultiplier; + sunDanceDamage *= projectileDamageMultiplier; + + if (enraged) + expertMode = true; + + bool takeDamage = true; + int reducedAttackCooldown = 0; + if (phase2) + reducedAttackCooldown += 15; + if (expertMode) + reducedAttackCooldown += 5; + + // Variables for dust visuals on spawn and in phase 3 + float playSpawnSoundTime = 10f; + float stopSpawningDustTime = 150f; + float spawnTime = 180f; + + // Do visual stuff in phase 3 + float maxOpacity = phase3 ? 0.7f : 1f; + int minAlpha = 255 - (int)(255 * maxOpacity); + if (phase3) + { + if (calamityGlobalNPC.newAI[0] == playSpawnSoundTime) + SoundEngine.PlaySound(SoundID.Item161, npc.Center); + + if (calamityGlobalNPC.newAI[0] > playSpawnSoundTime && calamityGlobalNPC.newAI[0] < stopSpawningDustTime) + CreateSpawnDust(npc, false); + + calamityGlobalNPC.newAI[0] += 1f; + if (calamityGlobalNPC.newAI[0] >= stopSpawningDustTime) + { + calamityGlobalNPC.newAI[0] = playSpawnSoundTime + 1f; + npc.SyncExtraAI(); + } + } + + switch ((int)npc.ai[0]) + { + case 0: + + // Avoid cheap bullshit. + npc.damage = 0; + + if (npc.ai[1] == 0f) + { + npc.velocity = new Vector2(0f, 5f); + if (Main.netMode != NetmodeID.MultiplayerClient) + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + new Vector2(0f, -80f), Vector2.Zero, ProjectileID.HallowBossDeathAurora, 0, 0f, Main.myPlayer); + } + + if (npc.ai[1] == playSpawnSoundTime) + SoundEngine.PlaySound(SoundID.Item161, npc.Center); + + npc.velocity *= 0.95f; + if (npc.ai[1] > playSpawnSoundTime && npc.ai[1] < stopSpawningDustTime) + CreateSpawnDust(npc); + + npc.ai[1] += 1f; + becomeVisible = false; + takeDamage = false; + npc.Opacity = MathHelper.Clamp(npc.ai[1] / spawnTime, 0f, 1f); + if (npc.ai[1] >= spawnTime) + { + if (enraged && !npc.AI_120_HallowBoss_IsGenuinelyEnraged()) + npc.ai[3] += 2f; + + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.netUpdate = true; + npc.TargetClosest(); + } + + break; + + case 1: + { + // Avoid cheap bullshit. + npc.damage = 0; + + float phaseTime = (phase2 ? 20f : 45f); + if (masterMode) + phaseTime /= 2f; + if (Main.getGoodWorld) + phaseTime /= 2f; + if (phaseTime < 10f) + phaseTime = 10f; + + if (npc.ai[1] <= 10f) + { + if (npc.ai[1] == 0f) + npc.TargetClosest(); + + NPCAimedTarget targetData = npc.GetTargetData(); + if (targetData.Invalid) + { + npc.ai[0] = 13f; + npc.ai[1] = 0f; + npc.ai[2] += 1f; + npc.velocity /= 4f; + npc.netUpdate = true; + break; + } + + Vector2 center = targetData.Center; + npc.DirectionTo(center); + center += new Vector2(0f, -300f); + if (npc.Distance(center) > 200f) + center -= npc.DirectionTo(center) * 100f; + + Vector2 distanceFromTarget = center - npc.Center; + float lerpValue = Utils.GetLerpValue(100f, 600f, distanceFromTarget.Length(), clamped: true); + float movementVelocity = distanceFromTarget.Length(); + if (movementVelocity > 18f) + movementVelocity = 18f; + + npc.velocity = Vector2.Lerp(distanceFromTarget.SafeNormalize(Vector2.Zero) * movementVelocity, distanceFromTarget / 6f, lerpValue); + + npc.netUpdate = true; + } + + if (npc.velocity.Length() > 16f && npc.ai[1] > 10f) + npc.velocity /= 2f; + + npc.velocity *= 0.92f; + npc.ai[1] += 1f; + if (!(npc.ai[1] >= phaseTime)) + break; + + int phaseIncrement = (int)npc.ai[2]; + int phase = 2; + int phaseDivisor = 0; + if (!phase2) + { + int num38 = phaseDivisor++; + int num39 = phaseDivisor++; + int num40 = phaseDivisor++; + int num41 = phaseDivisor++; + int num42 = phaseDivisor++; + int num43 = phaseDivisor++; + int num44 = phaseDivisor++; + int num45 = phaseDivisor++; + int num46 = phaseDivisor++; + int num47 = phaseDivisor++; + if (phaseIncrement % phaseDivisor == num38) + phase = 2; + + if (phaseIncrement % phaseDivisor == num39) + phase = 8; + + if (phaseIncrement % phaseDivisor == num40) + phase = 6; + + if (phaseIncrement % phaseDivisor == num41) + phase = 8; + + if (phaseIncrement % phaseDivisor == num42) + phase = 5; + + if (phaseIncrement % phaseDivisor == num43) + phase = 2; + + if (phaseIncrement % phaseDivisor == num44) + phase = 8; + + if (phaseIncrement % phaseDivisor == num45) + phase = 4; + + if (phaseIncrement % phaseDivisor == num46) + phase = 8; + + if (phaseIncrement % phaseDivisor == num47) + phase = 5; + + if (genuinePhase2) + phase = 10; + } + + if (phase2) + { + int num48 = phaseDivisor++; + int num49 = phaseDivisor++; + int num50 = phaseDivisor++; + int num51 = -1; + if (expertMode) + num51 = phaseDivisor++; + + int num52 = phaseDivisor++; + int num53 = phaseDivisor++; + int num54 = phaseDivisor++; + int num55 = phaseDivisor++; + int num56 = phaseDivisor++; + int num57 = phaseDivisor++; + if (phaseIncrement % phaseDivisor == num48) + phase = 7; + + if (phaseIncrement % phaseDivisor == num49) + phase = phase3 ? 8 : 2; + + if (phaseIncrement % phaseDivisor == num50) + phase = 8; + + if (phaseIncrement % phaseDivisor == num52) + phase = 5; + + if (phaseIncrement % phaseDivisor == num53) + phase = 2; + + if (phaseIncrement % phaseDivisor == num54) + phase = phase3 ? 4 : 6; + + if (phaseIncrement % phaseDivisor == num54) + phase = phase3 ? 7 : 6; + + if (phaseIncrement % phaseDivisor == num55) + phase = 4; + + if (phaseIncrement % phaseDivisor == num56) + phase = 8; + + if (phaseIncrement % phaseDivisor == num51) + phase = 11; + + if (phaseIncrement % phaseDivisor == num57) + phase = 12; + } + + npc.TargetClosest(); + NPCAimedTarget targetData2 = npc.GetTargetData(); + bool transitionToEnrage = false; + if (npc.AI_120_HallowBoss_IsGenuinelyEnraged()) + { + if (!Main.dayTime) + transitionToEnrage = true; + + if (Main.dayTime && Main.time >= 53400D) + transitionToEnrage = true; + } + + if (targetData2.Invalid || npc.Distance(targetData2.Center) > despawnDistance || transitionToEnrage) + phase = 13; + + if (phase == 8 && targetData2.Center.X > npc.Center.X) + phase = 9; + + if (expertMode && phase != 5 && phase != 12) + npc.velocity = npc.DirectionFrom(targetData2.Center).SafeNormalize(Vector2.Zero).RotatedBy(MathHelper.PiOver2 * (float)(targetData2.Center.X > npc.Center.X).ToDirectionInt()) * 20f; + + npc.ai[0] = phase; + npc.ai[1] = 0f; + + int oneInXChance = masterMode ? 3 : 4; + if (phase3) + oneInXChance--; + + float numPhaseIncrements = expertMode ? (Main.rand.NextBool(oneInXChance) ? 2f : 1f) : 1f; + npc.ai[2] += numPhaseIncrements; + npc.netUpdate = true; + + break; + } + + case 2: + { + // Avoid cheap bullshit. + npc.damage = 0; + + if (npc.ai[1] == 0f) + SoundEngine.PlaySound(SoundID.Item164, npc.Center); + + float extraPhaseTime = (masterMode ? 30f : expertMode ? 60f : 90f) - (float)reducedAttackCooldown; + Vector2 offset = new Vector2(-55f, -30f); + NPCAimedTarget targetData11 = npc.GetTargetData(); + Vector2 targetCenter = (targetData11.Invalid ? npc.Center : targetData11.Center); + if (npc.Distance(targetCenter + stopMovingLocation) > stopMovingDistance) + npc.SimpleFlyMovement(npc.DirectionTo(targetCenter + stopMovingLocation).SafeNormalize(Vector2.Zero) * desiredVelocity, moveSpeed); + + if (npc.ai[1] < 60f) + AI_120_HallowBoss_DoMagicEffect(npc.Center + offset, 1, Utils.GetLerpValue(0f, 60f, npc.ai[1], clamped: true), npc); + + int rainbowStreakGateValue = 3; + if (expertMode) + rainbowStreakGateValue = 2; + if (phase3) + rainbowStreakGateValue *= 2; + + if ((int)npc.ai[1] % rainbowStreakGateValue == 0 && npc.ai[1] < 60f) + { + float ai3 = npc.ai[1] / 60f; + Vector2 rainbowStreakVelocity = new Vector2(0f, -6f - (masterMode ? (ai3 * 4f) : expertMode ? (ai3 * 2f) : 0f)).RotatedBy(MathHelper.PiOver2 * Main.rand.NextFloatDirection()); + if (expertModePhase2) + rainbowStreakVelocity = new Vector2(0f, -10f - (masterMode ? (ai3 * 5f) : expertMode ? (ai3 * 2.5f) : 0f)).RotatedBy(MathHelper.TwoPi * Main.rand.NextFloat()); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + offset, rainbowStreakVelocity, ProjectileID.HallowBossRainbowStreak, rainbowStreakDamage, 0f, Main.myPlayer, npc.target, ai3); + if (phase3) + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + offset, -rainbowStreakVelocity, ProjectileID.HallowBossRainbowStreak, rainbowStreakDamage, 0f, Main.myPlayer, npc.target, 1f - ai3); + } + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int num92 = (int)(npc.ai[1] / (float)rainbowStreakGateValue); + for (int num93 = 0; num93 < Main.maxPlayers; num93++) + { + if (npc.Boss_CanShootExtraAt(num93, num92 % 3, 3, 2400f)) + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + offset, rainbowStreakVelocity, ProjectileID.HallowBossRainbowStreak, rainbowStreakDamage, 0f, Main.myPlayer, num93, ai3); + } + } + } + + npc.ai[1] += 1f; + if (npc.ai[1] >= 60f + extraPhaseTime) + { + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.netUpdate = true; + } + + break; + } + + /*case 3: + { + npc.ai[1] += 1f; + NPCAimedTarget targetData8 = npc.GetTargetData(); + Vector2 vector23 = (targetData8.Invalid ? npc.Center : targetData8.Center); + if (npc.Distance(vector23 + vector2) > num3) + npc.SimpleFlyMovement(npc.DirectionTo(vector23 + vector2).SafeNormalize(Vector2.Zero) * num2, num); + + if ((int)npc.ai[1] % 180 == 0) + { + Vector2 vector24 = new Vector2(0f, -100f); + Projectile.NewProjectile(npc.GetSource_FromAI(), targetData8.Center + vector24, Vector2.Zero, ProjectileID.HallowBossDeathAurora, num5, 0f, Main.myPlayer); + } + + if (npc.ai[1] >= 120f) + { + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.netUpdate = true; + } + + break; + }*/ + + case 4: + { + // Avoid cheap bullshit. + npc.damage = 0; + + float extraPhaseTime = 20 - reducedAttackCooldown; + + if (npc.ai[1] == 0f) + SoundEngine.PlaySound(SoundID.Item162, npc.Center); + + float lanceGateValue = masterMode ? 75f : 100f; + if (npc.ai[1] >= 6f && npc.ai[1] < 54f) + { + AI_120_HallowBoss_DoMagicEffect(npc.Center + new Vector2(-55f, -20f), 2, Utils.GetLerpValue(0f, lanceGateValue, npc.ai[1], clamped: true), npc); + AI_120_HallowBoss_DoMagicEffect(npc.Center + new Vector2(55f, -20f), 4, Utils.GetLerpValue(0f, lanceGateValue, npc.ai[1], clamped: true), npc); + } + + NPCAimedTarget targetData = npc.GetTargetData(); + Vector2 targetLocation = (targetData.Invalid ? npc.Center : targetData.Center); + if (npc.Distance(targetLocation + stopMovingLocation3) > stopMovingDistance) + npc.SimpleFlyMovement(npc.DirectionTo(targetLocation + stopMovingLocation3).SafeNormalize(Vector2.Zero) * desiredVelocity, moveSpeed); + + int radialSpawnOffset = masterMode ? 6 : expertMode ? 5 : 4; + int lanceSpawnGateValue = masterMode ? 3 : 4; + if ((int)npc.ai[1] % lanceSpawnGateValue == 0 && npc.ai[1] < lanceGateValue) + { + int lanceAmount = phase3 ? 2 : 1; + for (int i = 0; i < lanceAmount; i++) + { + int num85 = (int)npc.ai[1] / lanceSpawnGateValue; + radialSpawnOffset += (masterMode ? 3 : 2) * i; + Vector2 radialOffset = Vector2.UnitX.RotatedBy((float)Math.PI / (float)(radialSpawnOffset * 2) + (float)num85 * ((float)Math.PI / (float)radialSpawnOffset) + 0f); + if (masterMode) + radialOffset.X += (radialOffset.X > 0f ? -0.5f : 0.5f); + else if (!expertMode) + radialOffset.X += (radialOffset.X > 0f ? 0.5f : -0.5f); + + radialOffset = radialOffset.SafeNormalize(Vector2.UnitY); + float lanceSpawnDistance = 300f; + if (expertMode) + lanceSpawnDistance = 450f; + + Vector2 targetCenter = targetData.Center; + if (npc.Distance(targetCenter) > 2400f) + continue; + + if (Vector2.Dot(targetData.Velocity.SafeNormalize(Vector2.UnitY), radialOffset) > 0f) + radialOffset *= -1f; + + int targetVelocityOffset = 90; + Vector2 vector31 = targetCenter + targetData.Velocity * targetVelocityOffset; + Vector2 vector32 = targetCenter + radialOffset * lanceSpawnDistance - targetData.Velocity * 30f; + if (vector32.Distance(targetCenter) < lanceSpawnDistance) + { + Vector2 vector33 = targetCenter - vector32; + if (vector33 == Vector2.Zero) + vector33 = radialOffset; + + vector32 = targetCenter - vector33.SafeNormalize(Vector2.UnitY) * lanceSpawnDistance; + } + + Vector2 v3 = vector31 - vector32; + if (Main.netMode != NetmodeID.MultiplayerClient) + Projectile.NewProjectile(npc.GetSource_FromAI(), vector32, Vector2.Zero, ProjectileID.FairyQueenLance, lanceDamage, 0f, Main.myPlayer, v3.ToRotation(), npc.ai[1] / lanceGateValue); + + if (Main.netMode == NetmodeID.MultiplayerClient) + continue; + + int num88 = (int)(npc.ai[1] / (float)lanceSpawnGateValue); + for (int num89 = 0; num89 < Main.maxPlayers; num89++) + { + if (!npc.Boss_CanShootExtraAt(num89, num88 % 3, 3, 2400f)) + continue; + + Player player2 = Main.player[num89]; + targetCenter = player2.Center; + if (Vector2.Dot(player2.velocity.SafeNormalize(Vector2.UnitY), radialOffset) > 0f) + radialOffset *= -1f; + + Vector2 vector34 = targetCenter + player2.velocity * targetVelocityOffset; + vector32 = targetCenter + radialOffset * lanceSpawnDistance - player2.velocity * 30f; + if (vector32.Distance(targetCenter) < lanceSpawnDistance) + { + Vector2 vector35 = targetCenter - vector32; + if (vector35 == Vector2.Zero) + vector35 = radialOffset; + + vector32 = targetCenter - vector35.SafeNormalize(Vector2.UnitY) * lanceSpawnDistance; + } + + v3 = vector34 - vector32; + Projectile.NewProjectile(npc.GetSource_FromAI(), vector32, Vector2.Zero, ProjectileID.FairyQueenLance, lanceDamage, 0f, Main.myPlayer, v3.ToRotation(), npc.ai[1] / lanceGateValue); + } + } + } + + npc.ai[1] += 1f; + if (npc.ai[1] >= lanceGateValue + extraPhaseTime) + { + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.netUpdate = true; + } + + break; + } + + case 5: + { + // Avoid cheap bullshit. + npc.damage = 0; + + if (npc.ai[1] == 0f) + SoundEngine.PlaySound(SoundID.Item163, npc.Center); + + float extraPhaseTime = masterMode ? 22f : 30f; + extraPhaseTime -= (float)reducedAttackCooldown; + + Vector2 offset = new Vector2(55f, -30f); + Vector2 lastingRainbowInitialSpawnLocation = npc.Center + offset; + + float lastingRainbowGateValue = 42f; + if (npc.ai[1] < lastingRainbowGateValue) + AI_120_HallowBoss_DoMagicEffect(npc.Center + offset, 3, Utils.GetLerpValue(0f, lastingRainbowGateValue, npc.ai[1], clamped: true), npc); + + NPCAimedTarget targetData = npc.GetTargetData(); + Vector2 targetLocation = (targetData.Invalid ? npc.Center : targetData.Center); + if (npc.Distance(targetLocation + stopMovingLocation4) > stopMovingDistance) + npc.SimpleFlyMovement(npc.DirectionTo(targetLocation + stopMovingLocation4).SafeNormalize(Vector2.Zero) * desiredVelocity, moveSpeed); + + if ((int)npc.ai[1] % (int)lastingRainbowGateValue == 0 && npc.ai[1] < lastingRainbowGateValue) + { + float lastingRainbowRandomRotation = MathHelper.TwoPi * Main.rand.NextFloat(); + float numLastingRainbows = 13f; + for (float i = 0f; i < 1f; i += 1f / numLastingRainbows) + { + float ai1 = i; + Vector2 lastingRainbowVelocity = Vector2.UnitY.RotatedBy(MathHelper.PiOver2 + MathHelper.TwoPi * ai1 + lastingRainbowRandomRotation); + Vector2 lastingRainbowSpawnLocation = lastingRainbowInitialSpawnLocation + lastingRainbowVelocity.RotatedBy(-MathHelper.PiOver2) * 30f; + if (Main.netMode != NetmodeID.MultiplayerClient) + Projectile.NewProjectile(npc.GetSource_FromAI(), lastingRainbowSpawnLocation, lastingRainbowVelocity * (masterMode ? 10f : 8f), ProjectileID.HallowBossLastingRainbow, lastingRainbowDamage, 0f, Main.myPlayer, 0f, ai1); + + if (phase3) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + Projectile.NewProjectile(npc.GetSource_FromAI(), lastingRainbowSpawnLocation, lastingRainbowVelocity * (masterMode ? 12f : 10f), ProjectileID.HallowBossRainbowStreak, rainbowStreakDamage, 0f, Main.myPlayer, npc.target, ai1); + } + } + } + + npc.ai[1] += 1f; + if (npc.ai[1] >= lastingRainbowGateValue + extraPhaseTime) + { + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.netUpdate = true; + } + + break; + } + + case 6: + { + // Avoid cheap bullshit. + npc.damage = 0; + + // Increase durability. + calamityGlobalNPC.DR = shouldBeInPhase2ButIsStillInPhase1 ? 0.99f : (BossRushEvent.BossRushActive ? 0.99f : 0.575f); + + float extraPhaseTime = (masterMode ? 105 : expertMode ? 120 : 135) - reducedAttackCooldown; + Vector2 offset = new Vector2(0f, -100f); + Vector2 sunDanceSpawnLocation = npc.Center + offset; + NPCAimedTarget targetData = npc.GetTargetData(); + Vector2 targetLocation = (targetData.Invalid ? npc.Center : targetData.Center); + if (npc.Distance(targetLocation + stopMovingLocation5) > stopMovingDistance) + npc.SimpleFlyMovement(npc.DirectionTo(targetLocation + stopMovingLocation5).SafeNormalize(Vector2.Zero) * desiredVelocity * 0.3f, moveSpeed * 0.7f); + + float phaseGateValue = masterMode ? 120f : 180f; + int sunDanceGateValue = 60; + if ((int)npc.ai[1] % sunDanceGateValue == 0 && npc.ai[1] < phaseGateValue) + { + int sunDanceSpawnOffset = (int)npc.ai[1] / sunDanceGateValue; + int targetLocationX = ((targetData.Center.X > npc.Center.X) ? 1 : 0); + float numSunDancePetals = masterMode ? 9f : expertMode ? 8f : 6f; + float sunDanceIncrement = 1f / numSunDancePetals; + for (float i = 0f; i < 1f; i += sunDanceIncrement) + { + float radialOffset = (i + sunDanceIncrement * 0.5f + (float)sunDanceSpawnOffset * sunDanceIncrement * 0.5f) % 1f; + float ai = MathHelper.TwoPi * (radialOffset + (float)targetLocationX); + if (Main.netMode != NetmodeID.MultiplayerClient) + Projectile.NewProjectile(npc.GetSource_FromAI(), sunDanceSpawnLocation, Vector2.Zero, ProjectileID.FairyQueenSunDance, sunDanceDamage, 0f, Main.myPlayer, ai, npc.whoAmI); + } + } + + npc.ai[1] += 1f; + if (npc.ai[1] >= phaseGateValue + extraPhaseTime) + { + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.netUpdate = true; + } + + break; + } + + case 7: + { + // Avoid cheap bullshit. + npc.damage = 0; + + float extraPhaseTime = masterMode ? 34f : expertMode ? 40f : 20f; + float lanceGateValue = masterMode ? 34f : expertMode ? 40f : 60f; + float totalLanceWalls = expertMode ? 6f : 4f; + float lancePhaseTime = lanceGateValue * totalLanceWalls; + + extraPhaseTime -= (float)reducedAttackCooldown; + NPCAimedTarget targetData = npc.GetTargetData(); + Vector2 vector25 = (targetData.Invalid ? npc.Center : targetData.Center); + if (npc.Distance(vector25 + stopMovingLocation4) > stopMovingDistance) + npc.SimpleFlyMovement(npc.DirectionTo(vector25 + stopMovingLocation4).SafeNormalize(Vector2.Zero) * desiredVelocity * 0.4f, moveSpeed); + + if ((float)(int)npc.ai[1] % lanceGateValue == 0f && npc.ai[1] < lancePhaseTime) + { + SoundEngine.PlaySound(SoundID.Item162, npc.Center); + Main.rand.NextFloat(); + int lanceWallType = (int)npc.ai[1] / (int)lanceGateValue; + float numLances = phase3 ? (masterMode ? 18f : 15f) : 13f; + float distanceBetweenLances = phase3 ? (masterMode ? 125f : 135f) : 150f; + float lanceWallLength = numLances * distanceBetweenLances; + Vector2 lanceSpawnOffset = targetData.Center; + if (npc.Distance(lanceSpawnOffset) <= 3200f) + { + Vector2 vector26 = Vector2.Zero; + Vector2 lanceDirection = Vector2.UnitY; + float num77 = 0.4f; + float num78 = 1.4f; + float num79 = 1f; + if (expertMode) + { + numLances += 5f; + distanceBetweenLances += 50f; + lanceWallLength *= (masterMode ? 0.75f : 0.5f); + } + + switch (lanceWallType) + { + case 0: + lanceSpawnOffset += new Vector2((0f - lanceWallLength) / 2f, 0f) * num79; + vector26 = new Vector2(0f, lanceWallLength); + lanceDirection = Vector2.UnitX; + break; + case 1: + lanceSpawnOffset += new Vector2(lanceWallLength / 2f, distanceBetweenLances / 2f) * num79; + vector26 = new Vector2(0f, lanceWallLength); + lanceDirection = -Vector2.UnitX; + break; + case 2: + lanceSpawnOffset += new Vector2(0f - lanceWallLength, 0f - lanceWallLength) * num77 * num79; + vector26 = new Vector2(lanceWallLength * num78, 0f); + lanceDirection = new Vector2(1f, 1f); + break; + case 3: + lanceSpawnOffset += new Vector2(lanceWallLength * num77 + distanceBetweenLances / 2f, (0f - lanceWallLength) * num77) * num79; + vector26 = new Vector2((0f - lanceWallLength) * num78, 0f); + lanceDirection = new Vector2(-1f, 1f); + break; + case 4: + lanceSpawnOffset += new Vector2(0f - lanceWallLength, lanceWallLength) * num77 * num79; + vector26 = new Vector2(lanceWallLength * num78, 0f); + lanceDirection = lanceSpawnOffset.DirectionTo(targetData.Center); + break; + case 5: + lanceSpawnOffset += new Vector2(lanceWallLength * num77 + distanceBetweenLances / 2f, lanceWallLength * num77) * num79; + vector26 = new Vector2((0f - lanceWallLength) * num78, 0f); + lanceDirection = lanceSpawnOffset.DirectionTo(targetData.Center); + break; + } + + for (float lance = 0f; lance <= 1f; lance += 1f / numLances) + { + Vector2 origin = lanceSpawnOffset + vector26 * (lance - 0.5f); + Vector2 lanceRotation = lanceDirection; + if (expertMode) + { + Vector2 predictionVector = targetData.Velocity * 20f * lance; + Vector2 value2 = origin.DirectionTo(targetData.Center + predictionVector); + lanceRotation = Vector2.Lerp(lanceDirection, value2, 0.75f).SafeNormalize(Vector2.UnitY); + } + + float ai2 = lance; + if (Main.netMode != NetmodeID.MultiplayerClient) + Projectile.NewProjectile(npc.GetSource_FromAI(), origin, Vector2.Zero, ProjectileID.FairyQueenLance, lanceDamage, 0f, Main.myPlayer, lanceRotation.ToRotation(), ai2); + } + } + } + + npc.ai[1] += 1f; + if (npc.ai[1] >= lancePhaseTime + extraPhaseTime) + { + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.netUpdate = true; + } + + break; + } + + case 8: + case 9: + { + float extraPhaseTime = 20 - reducedAttackCooldown; + float startDashTime = 40f; + float playDashSoundTime = 20f; + float endDashTime = phase3 ? 75f : 90f; + int dashStartDistance = phase3 ? 750 : 550; + int dashVelocity = phase3 ? 80 : 50; + float dashAcceleration = phase3 ? 0.08f : 0.05f; + + int dashDirection = (npc.ai[0] != 8f ? 1 : -1); + AI_120_HallowBoss_DoMagicEffect(npc.Center, 5, Utils.GetLerpValue(startDashTime, endDashTime, npc.ai[1], clamped: true), npc); + + if (npc.ai[1] <= startDashTime) + { + // Avoid cheap bullshit. + npc.damage = 0; + + if (npc.ai[1] == playDashSoundTime) + SoundEngine.PlaySound(SoundID.Item160, npc.Center); + + NPCAimedTarget targetData = npc.GetTargetData(); + Vector2 destination = (targetData.Invalid ? npc.Center : targetData.Center) + new Vector2(dashDirection * -dashStartDistance, 0f); + npc.SimpleFlyMovement(npc.DirectionTo(destination).SafeNormalize(Vector2.Zero) * desiredVelocity, moveSpeed * 2f); + if (npc.ai[1] == startDashTime) + npc.velocity *= 0.3f; + } + else if (npc.ai[1] <= endDashTime) + { + npc.velocity = Vector2.Lerp(value2: new Vector2(dashDirection * dashVelocity, 0f), value1: npc.velocity, amount: dashAcceleration); + if (npc.ai[1] == endDashTime) + npc.velocity *= 0.7f; + + npc.damage = (int)Math.Round(npc.defDamage * (enraged ? 3D : 1.5)); + } + else + { + // Avoid cheap bullshit. + npc.damage = 0; + + npc.velocity *= 0.92f; + } + + npc.ai[1] += 1f; + if (npc.ai[1] >= endDashTime + extraPhaseTime) + { + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.netUpdate = true; + } + + break; + } + + case 10: + { + // Avoid cheap bullshit. + npc.damage = 0; + + float extraPhaseTime = 20 - reducedAttackCooldown; + if (npc.ai[1] == 0f) + SoundEngine.PlaySound(SoundID.Item161, npc.Center); + + takeDamage = !(npc.ai[1] >= 30f) || !(npc.ai[1] <= 170f); + npc.velocity *= 0.95f; + if (npc.ai[1] == 90f) + { + if (npc.ai[3] == 0f) + npc.ai[3] = 1f; + + if (npc.ai[3] == 2f) + npc.ai[3] = 3f; + + npc.Center = npc.GetTargetData().Center + new Vector2(0f, -250f); + npc.netUpdate = true; + } + + npc.ai[1] += 1f; + if (npc.ai[1] >= 180f + extraPhaseTime) + { + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.netUpdate = true; + } + + break; + } + + case 11: + { + // Avoid cheap bullshit. + npc.damage = 0; + + if (npc.ai[1] == 0f) + SoundEngine.PlaySound(SoundID.Item162, npc.Center); + + float extraPhaseTime = 20 - reducedAttackCooldown; + float lanceGateValue = masterMode ? 75f : 100f; + if (npc.ai[1] >= 6f && npc.ai[1] < 54f) + { + AI_120_HallowBoss_DoMagicEffect(npc.Center + new Vector2(-55f, -20f), 2, Utils.GetLerpValue(0f, lanceGateValue, npc.ai[1], clamped: true), npc); + AI_120_HallowBoss_DoMagicEffect(npc.Center + new Vector2(55f, -20f), 4, Utils.GetLerpValue(0f, lanceGateValue, npc.ai[1], clamped: true), npc); + } + + NPCAimedTarget targetData = npc.GetTargetData(); + Vector2 targetLocation = (targetData.Invalid ? npc.Center : targetData.Center); + if (npc.Distance(targetLocation + stopMovingLocation3) > stopMovingDistance) + npc.SimpleFlyMovement(npc.DirectionTo(targetLocation + stopMovingLocation3).SafeNormalize(Vector2.Zero) * desiredVelocity, moveSpeed); + + if ((int)npc.ai[1] % 3 == 0 && npc.ai[1] < lanceGateValue) + { + int numLances = phase3 ? 2 : 1; + for (int i = 0; i < numLances; i++) + { + // Spawn another lance in the opposite location + bool oppositeLance = i == 1; + + Vector2 vector13 = oppositeLance ? targetData.Velocity : -targetData.Velocity; + vector13.SafeNormalize(-Vector2.UnitY); + float lanceSpawnOffset = 100f; + Vector2 targetCenter = targetData.Center; + if (npc.Distance(targetCenter) > 2400f) + continue; + + int targetVelocityOffset = 90; + Vector2 vector14 = targetCenter + (oppositeLance ? -targetData.Velocity : targetData.Velocity) * targetVelocityOffset; + Vector2 lanceSpawnLocation = targetCenter + vector13 * lanceSpawnOffset; + if (lanceSpawnLocation.Distance(targetCenter) < lanceSpawnOffset) + { + Vector2 vector16 = targetCenter - lanceSpawnLocation; + if (vector16 == Vector2.Zero) + vector16 = vector13; + + lanceSpawnLocation = targetCenter - vector16.SafeNormalize(Vector2.UnitY) * lanceSpawnOffset; + } + + Vector2 rotationVector = vector14 - lanceSpawnLocation; + if (Main.netMode != NetmodeID.MultiplayerClient) + Projectile.NewProjectile(npc.GetSource_FromAI(), lanceSpawnLocation, Vector2.Zero, ProjectileID.FairyQueenLance, lanceDamage, 0f, Main.myPlayer, rotationVector.ToRotation(), npc.ai[1] / lanceGateValue); + + if (Main.netMode == NetmodeID.MultiplayerClient) + continue; + + int rotationIndex = (int)(npc.ai[1] / 3f); + for (int l = 0; l < Main.maxPlayers; l++) + { + if (!npc.Boss_CanShootExtraAt(l, rotationIndex % 3, 3, 2400f)) + continue; + + Player player = Main.player[l]; + vector13 = oppositeLance ? player.velocity : -player.velocity; + vector13.SafeNormalize(-Vector2.UnitY); + lanceSpawnOffset = 100f; + targetCenter = player.Center; + targetVelocityOffset = 90; + Vector2 lanceDestination = targetCenter + (oppositeLance ? -player.velocity : player.velocity) * targetVelocityOffset; + lanceSpawnLocation = targetCenter + vector13 * lanceSpawnOffset; + if (lanceSpawnLocation.Distance(targetCenter) < lanceSpawnOffset) + { + Vector2 vector18 = targetCenter - lanceSpawnLocation; + if (vector18 == Vector2.Zero) + vector18 = vector13; + + lanceSpawnLocation = targetCenter - vector18.SafeNormalize(Vector2.UnitY) * lanceSpawnOffset; + } + + rotationVector = lanceDestination - lanceSpawnLocation; + Projectile.NewProjectile(npc.GetSource_FromAI(), lanceSpawnLocation, Vector2.Zero, ProjectileID.FairyQueenLance, lanceDamage, 0f, Main.myPlayer, rotationVector.ToRotation(), npc.ai[1] / lanceGateValue); + } + } + } + + npc.ai[1] += 1f; + if (npc.ai[1] >= lanceGateValue + extraPhaseTime) + { + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.netUpdate = true; + } + + break; + } + + case 12: + { + // Avoid cheap bullshit. + npc.damage = 0; + + float extraPhaseTime = (masterMode ? 30f : expertMode ? 60f : 90f) - (float)reducedAttackCooldown; + Vector2 offset = new Vector2(-55f, -30f); + if (npc.ai[1] == 0f) + { + SoundEngine.PlaySound(SoundID.Item165, npc.Center); + npc.velocity = new Vector2(0f, -12f); + } + + npc.velocity *= 0.95f; + bool shootRainbowStreaks = npc.ai[1] < 60f && npc.ai[1] >= 10f; + if (shootRainbowStreaks) + AI_120_HallowBoss_DoMagicEffect(npc.Center + offset, 1, Utils.GetLerpValue(0f, 60f, npc.ai[1], clamped: true), npc); + + int rainbowStreakGateValue = 6; + if (expertMode) + rainbowStreakGateValue = 4; + if (phase3) + rainbowStreakGateValue *= 2; + + float radialOffset = (npc.ai[1] - 10f) / 50f; + if ((int)npc.ai[1] % rainbowStreakGateValue == 0 && shootRainbowStreaks) + { + Vector2 rainbowStreakVelocity = (rainbowStreakVelocity = new Vector2(0f, -20f - (phase3 ? ((masterMode ? 10f : 5f) * radialOffset) : 0f)).RotatedBy(MathHelper.TwoPi * radialOffset)); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + offset, rainbowStreakVelocity, ProjectileID.HallowBossRainbowStreak, rainbowStreakDamage, 0f, Main.myPlayer, npc.target, radialOffset); + if (phase3) + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + offset, -rainbowStreakVelocity, ProjectileID.HallowBossRainbowStreak, rainbowStreakDamage, 0f, Main.myPlayer, npc.target, 1f - radialOffset); + } + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int num24 = (int)(npc.ai[1] % (float)rainbowStreakGateValue); + for (int j = 0; j < Main.maxPlayers; j++) + { + if (npc.Boss_CanShootExtraAt(j, num24 % 3, 3, 2400f)) + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + offset, rainbowStreakVelocity, ProjectileID.HallowBossRainbowStreak, rainbowStreakDamage, 0f, Main.myPlayer, j, radialOffset); + } + } + } + + npc.ai[1] += 1f; + if (npc.ai[1] >= 60f + extraPhaseTime) + { + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.netUpdate = true; + } + + break; + } + + case 13: + { + // Avoid cheap bullshit. + npc.damage = 0; + + if (npc.ai[1] == 0f) + { + SoundEngine.PlaySound(SoundID.Item165, npc.Center); + npc.velocity = new Vector2(0f, -7f); + } + + npc.velocity *= 0.95f; + npc.TargetClosest(); + NPCAimedTarget targetData = npc.GetTargetData(); + becomeVisible = false; + bool turnInvisible = false; + bool despawn = false; + if (!turnInvisible) + { + if (npc.AI_120_HallowBoss_IsGenuinelyEnraged()) + { + if (!Main.dayTime) + despawn = true; + + if (Main.dayTime && Main.time >= 53400D) + despawn = true; + } + + turnInvisible = turnInvisible || despawn; + } + + if (!turnInvisible) + { + bool noValidTarget = targetData.Invalid || npc.Distance(targetData.Center) > despawnDistance; + turnInvisible = turnInvisible || noValidTarget; + } + + npc.alpha = Utils.Clamp(npc.alpha + turnInvisible.ToDirectionInt() * 5, 0, 255); + bool flag10 = npc.alpha == 0 || npc.alpha == 255; + int totalDust = 5; + for (int i = 0; i < totalDust; i++) + { + float num19 = MathHelper.Lerp(1.3f, 0.7f, npc.Opacity); + Color newColor = Main.hslToRgb(Main.rand.NextFloat(), 1f, 0.5f); + int num20 = Dust.NewDust(npc.position - npc.Size * 0.5f, npc.width * 2, npc.height * 2, DustID.RainbowMk2, 0f, 0f, 0, newColor); + Main.dust[num20].position = npc.Center + Main.rand.NextVector2Circular(npc.width, npc.height); + Main.dust[num20].velocity *= Main.rand.NextFloat() * 0.8f; + Main.dust[num20].noGravity = true; + Main.dust[num20].scale = 0.9f + Main.rand.NextFloat() * 1.2f; + Main.dust[num20].fadeIn = 0.4f + Main.rand.NextFloat() * 1.2f * num19; + Main.dust[num20].velocity += Vector2.UnitY * -2f; + Main.dust[num20].scale = 0.35f; + if (num20 != Main.maxDust) + { + Dust dust = Dust.CloneDust(num20); + dust.scale /= 2f; + dust.fadeIn *= 0.85f; + dust.color = new Color(255, 255, 255, 255); + } + } + + npc.ai[1] += 1f; + if (!(npc.ai[1] >= 20f && flag10)) + break; + + if (npc.alpha == 255) + { + npc.active = false; + if (Main.netMode != NetmodeID.MultiplayerClient) + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, npc.whoAmI); + + return false; + } + + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.netUpdate = true; + break; + } + } + + npc.dontTakeDamage = !takeDamage; + + if (phase3) + npc.defense = (int)Math.Round(npc.defDefense * 0.8); + else if (phase2) + npc.defense = (int)Math.Round(npc.defDefense * 1.2); + else + npc.defense = npc.defDefense; + + if ((npc.localAI[0] += 1f) >= 44f) + npc.localAI[0] = 0f; + + if (becomeVisible) + npc.alpha = Utils.Clamp(npc.alpha - 5, minAlpha, 255); + + Lighting.AddLight(npc.Center, Vector3.One * npc.Opacity); + + return false; + } + + private static void CreateSpawnDust(NPC npc, bool useAI = true) + { + int spawnDustAmount = 2; + float timer = useAI ? npc.ai[1] : npc.Calamity().newAI[0]; + float spawnTime = 180f; + for (int i = 0; i < spawnDustAmount; i++) + { + float fadeInScalar = MathHelper.Lerp(1.3f, 0.7f, npc.Opacity) * Utils.GetLerpValue(0f, 120f, timer, clamped: true); + Color newColor = Main.hslToRgb(timer / spawnTime, 1f, 0.5f); + int dust = Dust.NewDust(npc.position, npc.width, npc.height, DustID.RainbowMk2, 0f, 0f, 0, newColor); + Main.dust[dust].position = npc.Center + Main.rand.NextVector2Circular((float)npc.width * 3f, (float)npc.height * 3f) + new Vector2(0f, -150f); + Main.dust[dust].velocity *= Main.rand.NextFloat() * 0.8f; + Main.dust[dust].noGravity = true; + Main.dust[dust].fadeIn = 0.6f + Main.rand.NextFloat() * 0.7f * fadeInScalar; + Main.dust[dust].velocity += Vector2.UnitY * 3f; + Main.dust[dust].scale = 0.35f; + if (dust != Main.maxDust) + { + Dust dust2 = Dust.CloneDust(dust); + dust2.scale /= 2f; + dust2.fadeIn *= 0.85f; + dust2.color = new Color(255, 255, 255, 255); + } + } + } + + private static void AI_120_HallowBoss_DoMagicEffect(Vector2 spot, int effectType, float progress, NPC npc) + { + float magicDustSpawnArea = 4f; + float magicDustColorMult = 1f; + float fadeIn = 0f; + float magicDustPosChange = 0.5f; + int magicAmt = 2; + int magicDustType = 267; + switch (effectType) + { + case 1: + magicDustColorMult = 0.5f; + fadeIn = 2f; + magicDustPosChange = 0f; + break; + case 2: + case 4: + magicDustSpawnArea = 50f; + magicDustColorMult = 0.5f; + fadeIn = 0f; + magicDustPosChange = 0f; + magicAmt = 4; + break; + case 3: + magicDustSpawnArea = 30f; + magicDustColorMult = 0.1f; + fadeIn = 2.5f; + magicDustPosChange = 0f; + break; + case 5: + if (progress == 0f) + { + magicAmt = 0; + } + else + { + magicAmt = 5; + magicDustType = Main.rand.Next(86, 92); + } + if (progress >= 1f) + magicAmt = 0; + break; + } + + for (int i = 0; i < magicAmt; i++) + { + Dust dust = Dust.NewDustPerfect(spot, magicDustType, Main.rand.NextVector2CircularEdge(magicDustSpawnArea, magicDustSpawnArea) * (Main.rand.NextFloat() * (1f - magicDustPosChange) + magicDustPosChange), 0, Main.hslToRgb(Main.rand.NextFloat(), 1f, 0.5f), (Main.rand.NextFloat() * 2f + 2f) * magicDustColorMult); + dust.fadeIn = fadeIn; + dust.noGravity = true; + switch (effectType) + { + case 2: + case 4: + { + dust.velocity *= 0.005f; + dust.scale = 3f * Utils.GetLerpValue(0.7f, 0f, progress, clamped: true) * Utils.GetLerpValue(0f, 0.3f, progress, clamped: true); + dust.velocity = (MathHelper.TwoPi * (i / 4f) + MathHelper.PiOver4).ToRotationVector2() * 8f * Utils.GetLerpValue(1f, 0f, progress, clamped: true); + dust.velocity += npc.velocity * 0.3f; + float magicDustColorChange = 0f; + if (effectType == 4) + magicDustColorChange = 0.5f; + + dust.color = Main.hslToRgb((i / 5f + magicDustColorChange + progress * 0.5f) % 1f, 1f, 0.5f); + dust.color.A /= 2; + dust.alpha = 127; + break; + } + case 5: + if (progress == 0f) + { + dust.customData = npc; + dust.scale = 1.5f; + dust.fadeIn = 0f; + dust.velocity = new Vector2(0f, -1f) + Main.rand.NextVector2Circular(1f, 1f); + dust.color = new Color(255, 255, 255, 80) * 0.3f; + } + else + { + dust.color = Main.hslToRgb(progress * 2f % 1f, 1f, 0.5f); + dust.alpha = 0; + dust.scale = 1f; + dust.fadeIn = 1.3f; + dust.velocity *= 3f; + dust.velocity.X *= 0.1f; + dust.velocity += npc.velocity * 1f; + } + break; + } + } + } + } +} diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/EyeOfCthulhuAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/EyeOfCthulhuAI.cs new file mode 100644 index 0000000000..8bf28b1f87 --- /dev/null +++ b/NPCs/VanillaNPCAIOverrides/Bosses/EyeOfCthulhuAI.cs @@ -0,0 +1,1792 @@ +using System; +using CalamityMod.Events; +using CalamityMod.NPCs.NormalNPCs; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses +{ + public static class EyeOfCthulhuAI + { + private const float ProjectileOffset = 50f; + + public static bool BuffedEyeofCthulhuAI(NPC npc, Mod mod) + { + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + + // Percent life remaining + float lifeRatio = npc.life / (float)npc.lifeMax; + + bool bossRush = BossRushEvent.BossRushActive; + bool masterMode = Main.masterMode || bossRush; + bool death = CalamityWorld.death || bossRush; + + // Phases + float phase2LifeRatio = masterMode ? 0.75f : 0.6f; + float phase3LifeRatio = masterMode ? 0.4f : 0.3f; + float finalPhaseRevLifeRatio = masterMode ? 0.2f : 0.15f; + float penultimatePhaseDeathLifeRatio = masterMode ? 0.3f : 0.2f; + float finalPhaseDeathLifeRatio = masterMode ? 0.15f : 0.1f; + bool phase2 = lifeRatio < phase2LifeRatio; + bool phase3 = lifeRatio < phase3LifeRatio; + bool finalPhaseRev = lifeRatio < finalPhaseRevLifeRatio; + bool penultimatePhaseDeath = lifeRatio < penultimatePhaseDeathLifeRatio; + bool finalPhaseDeath = lifeRatio < finalPhaseDeathLifeRatio; + + float lineUpDist = death ? 15f : 20f; + + // Servant and projectile velocity, the projectile velocity is multiplied by 2 + float servantAndProjectileVelocity = (death ? 8f : 6f) + (masterMode ? 2f : 0f); + + float enrageScale = bossRush ? 1f : masterMode ? 0.5f : 0f; + if (Main.IsItDay() || bossRush) + { + npc.Calamity().CurrentlyEnraged = !bossRush; + enrageScale += 2f; + } + + npc.reflectsProjectiles = false; + + // Get a target + 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(); + + bool dead = Main.player[npc.target].dead; + float targetXDistance = npc.Center.X - Main.player[npc.target].position.X - (Main.player[npc.target].width / 2); + float targetYDistance = npc.position.Y + npc.height - 59f - Main.player[npc.target].position.Y - (Main.player[npc.target].height / 2); + float eyeRotation = (float)Math.Atan2(targetYDistance, targetXDistance) + MathHelper.PiOver2; + + if (eyeRotation < 0f) + eyeRotation += MathHelper.TwoPi; + else if (eyeRotation > MathHelper.TwoPi) + eyeRotation -= MathHelper.TwoPi; + + float eyeRotationAcceleration = 0f; + if (npc.ai[0] == 0f && npc.ai[1] == 0f) + eyeRotationAcceleration = 0.04f; + if (npc.ai[0] == 0f && npc.ai[1] == 2f && npc.ai[2] > 40f) + eyeRotationAcceleration = 0.1f; + if (npc.ai[0] == 3f && npc.ai[1] == 0f) + eyeRotationAcceleration = 0.1f; + if (npc.ai[0] == 3f && npc.ai[1] == 2f && npc.ai[2] > 40f) + eyeRotationAcceleration = 0.16f; + if (npc.ai[0] == 3f && npc.ai[1] == 4f && npc.ai[2] > lineUpDist) + eyeRotationAcceleration = 0.3f; + if (npc.ai[0] == 3f && npc.ai[1] == 5f) + eyeRotationAcceleration = 0.1f; + + if (npc.rotation < eyeRotation) + { + if ((eyeRotation - npc.rotation) > MathHelper.Pi) + npc.rotation -= eyeRotationAcceleration; + else + npc.rotation += eyeRotationAcceleration; + } + else if (npc.rotation > eyeRotation) + { + if ((npc.rotation - eyeRotation) > MathHelper.Pi) + npc.rotation += eyeRotationAcceleration; + else + npc.rotation -= eyeRotationAcceleration; + } + + if (npc.rotation > eyeRotation - eyeRotationAcceleration && npc.rotation < eyeRotation + eyeRotationAcceleration) + npc.rotation = eyeRotation; + if (npc.rotation < 0f) + npc.rotation += MathHelper.TwoPi; + else if (npc.rotation > MathHelper.TwoPi) + npc.rotation -= MathHelper.TwoPi; + if (npc.rotation > eyeRotation - eyeRotationAcceleration && npc.rotation < eyeRotation + eyeRotationAcceleration) + npc.rotation = eyeRotation; + + if (Main.rand.NextBool(5)) + { + int randomBlood = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + npc.height * 0.25f), npc.width, (int)(npc.height * 0.5f), DustID.Blood, npc.velocity.X, 2f, 0, default, 1f); + Dust dust = Main.dust[randomBlood]; + dust.velocity.X *= 0.5f; + dust.velocity.Y *= 0.1f; + } + + bool shootProjectile = Collision.CanHitLine(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1) && + npc.SafeDirectionTo(Main.player[npc.target].Center).AngleBetween((npc.rotation + MathHelper.PiOver2).ToRotationVector2()) < MathHelper.ToRadians(18f) && + Vector2.Distance(npc.Center, Main.player[npc.target].Center) > 240f; + + bool charge = Vector2.Distance(Main.player[npc.target].Center, npc.Center) >= 320f; // 20 tile distance + + if (dead) + { + npc.velocity.Y -= 0.04f; + + if (npc.timeLeft > 10) + npc.timeLeft = 10; + } + + else if (npc.ai[0] == 0f) + { + if (npc.ai[1] == 0f) + { + // Avoid cheap bullshit + npc.damage = 0; + + float hoverSpeed = 7f; + float hoverAcceleration = 0.15f; + hoverSpeed += 5f * enrageScale; + hoverAcceleration += 0.1f * enrageScale; + + if (death) + { + hoverSpeed += 7f * (1f - lifeRatio); + hoverAcceleration += 0.15f * (1f - lifeRatio); + } + + if (Main.getGoodWorld) + { + hoverSpeed += 3f; + hoverAcceleration += 0.08f; + } + + float attackSwitchTimer = (masterMode ? 120f : 180f) - (death ? 180f * (1f - lifeRatio) : 0f); + bool timeToCharge = npc.ai[2] >= attackSwitchTimer; + Vector2 hoverDestination = Main.player[npc.target].Center - Vector2.UnitY * 400f; + Vector2 idealVelocity = npc.SafeDirectionTo(hoverDestination) * (hoverSpeed + (timeToCharge ? ((npc.ai[2] - attackSwitchTimer) * 0.01f) : 0f)); + npc.SimpleFlyMovement(idealVelocity, hoverAcceleration + (timeToCharge ? ((npc.ai[2] - attackSwitchTimer) * 0.001f) : 0f)); + + npc.ai[2] += 1f; + if (timeToCharge && charge) + { + npc.ai[1] = 1f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.TargetClosest(); + npc.netUpdate = true; + } + else if (npc.WithinRange(hoverDestination, 900f)) + { + if (!Main.player[npc.target].dead) + npc.ai[3] += 1f; + + float servantSpawnGateValue = death ? (masterMode ? 10f : 20f) : (masterMode ? 25f : 40f); + if (Main.getGoodWorld) + servantSpawnGateValue *= 0.8f; + + if (npc.ai[3] >= servantSpawnGateValue && shootProjectile) + { + npc.ai[3] = 0f; + npc.rotation = eyeRotation; + + Vector2 servantSpawnVelocity = npc.SafeDirectionTo(Main.player[npc.target].Center) * servantAndProjectileVelocity; + Vector2 servantSpawnCenter = npc.Center + servantSpawnVelocity.SafeNormalize(Vector2.UnitY) * ProjectileOffset; + int maxServants = 4; + bool spawnServant = NPC.CountNPCS(NPCID.ServantofCthulhu) < maxServants; + if (spawnServant) + SoundEngine.PlaySound(SoundID.NPCHit1, servantSpawnCenter); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (spawnServant) + { + int eye = NPC.NewNPC(npc.GetSource_FromAI(), (int)servantSpawnCenter.X, (int)servantSpawnCenter.Y, NPCID.ServantofCthulhu, 0, 0f, 0f, enrageScale); + Main.npc[eye].velocity = servantSpawnVelocity; + + if (Main.netMode == NetmodeID.Server && eye < Main.maxNPCs) + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, eye); + } + else + { + int projType = ProjectileID.BloodNautilusShot; + int projDamage = npc.GetProjectileDamage(projType); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + servantSpawnVelocity.SafeNormalize(Vector2.UnitY) * ProjectileOffset, servantSpawnVelocity * 2f, projType, projDamage, 0f, Main.myPlayer); + Main.projectile[proj].timeLeft = 600; + } + } + + if (spawnServant) + { + for (int m = 0; m < 10; m++) + Dust.NewDust(servantSpawnCenter, 20, 20, DustID.Blood, servantSpawnVelocity.X * 0.4f, servantSpawnVelocity.Y * 0.4f, 0, default, 1f); + } + } + } + } + else if (npc.ai[1] == 1f) + { + // Set damage + npc.damage = npc.defDamage; + + npc.rotation = eyeRotation; + float additionalVelocityPerCharge = 2f; + float chargeSpeed = 8f + npc.ai[3] * additionalVelocityPerCharge; + chargeSpeed += 5f * enrageScale; + if (death) + chargeSpeed += 10f * (1f - lifeRatio); + if (Main.getGoodWorld) + chargeSpeed += 4f; + + npc.velocity = npc.SafeDirectionTo(Main.player[npc.target].Center) * chargeSpeed; + + npc.ai[1] = 2f; + npc.netUpdate = true; + + if (npc.netSpam > 10) + npc.netSpam = 10; + } + else if (npc.ai[1] == 2f) + { + // Set damage + npc.damage = npc.defDamage; + + int chargeDelay = masterMode ? 70 : 90; + if (death) + chargeDelay -= (int)Math.Round(40f * (1f - lifeRatio)); + if (Main.getGoodWorld) + chargeDelay -= 30; + + float slowDownGateValue = chargeDelay * (death ? (masterMode ? 0.9f : 0.75f) : (masterMode ? 0.8f : 0.65f)); + + npc.ai[2] += 1f; + if (npc.ai[2] >= slowDownGateValue) + { + // Avoid cheap bullshit + npc.damage = 0; + + float decelerationScalar = death ? ((lifeRatio - phase2LifeRatio) / (1f - phase2LifeRatio)) : 1f; + if (decelerationScalar < 0f) + decelerationScalar = 0f; + + npc.velocity *= (MathHelper.Lerp(masterMode ? 0.76f : 0.92f, masterMode ? 0.88f : 0.96f, decelerationScalar)); + if (Main.getGoodWorld) + npc.velocity *= 0.99f; + + if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) + npc.velocity.X = 0f; + if (npc.velocity.Y > -0.1 && npc.velocity.Y < 0.1) + npc.velocity.Y = 0f; + } + else + npc.rotation = npc.velocity.ToRotation() - MathHelper.PiOver2; + + if (npc.ai[2] >= chargeDelay) + { + npc.ai[3] += 1f; + npc.ai[2] = 0f; + npc.TargetClosest(); + npc.rotation = eyeRotation; + + float numCharges = death ? 4f : 3f; + if (npc.ai[3] >= numCharges) + { + // Avoid cheap bullshit + npc.damage = 0; + + npc.ai[1] = 0f; + npc.ai[3] = 0f; + } + else + npc.ai[1] = 1f; + } + } + + if (phase2) + { + // Avoid cheap bullshit + npc.damage = 0; + + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.TargetClosest(); + npc.netUpdate = true; + + if (npc.netSpam > 10) + npc.netSpam = 10; + } + } + + else if (npc.ai[0] == 1f || npc.ai[0] == 2f) + { + // Avoid cheap bullshit + npc.damage = 0; + + if (Main.getGoodWorld) + npc.reflectsProjectiles = true; + + if (npc.ai[0] == 1f) + { + npc.ai[2] += 0.005f; + if (npc.ai[2] > 0.5f) + npc.ai[2] = 0.5f; + } + else + { + npc.ai[2] -= 0.005f; + if (npc.ai[2] < 0f) + npc.ai[2] = 0f; + } + + npc.rotation += npc.ai[2]; + + float phaseChangeRate = death ? 2f : 1f; + float servantSpawnGateValue = Main.getGoodWorld ? 4f : 20f; + npc.ai[1] += phaseChangeRate; + if (npc.ai[1] % servantSpawnGateValue == 0f) + { + float servantVelocity = masterMode ? 11.3f : 5.65f; + Vector2 servantSpawnVelocity = Main.rand.NextVector2CircularEdge(servantVelocity, servantVelocity); + if (Main.getGoodWorld) + servantSpawnVelocity *= 3f; + + Vector2 servantSpawnCenter = npc.Center + servantSpawnVelocity.SafeNormalize(Vector2.UnitY) * ProjectileOffset; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int spawnType = NPCID.ServantofCthulhu; + if (masterMode) + { + int maxBloodServants = 2; + bool spawnBloodServant = NPC.CountNPCS(ModContent.NPCType()) < maxBloodServants; + if (spawnBloodServant) + spawnType = ModContent.NPCType(); + } + + int servantSpawn = NPC.NewNPC(npc.GetSource_FromAI(), (int)servantSpawnCenter.X, (int)servantSpawnCenter.Y, spawnType, 0, 0f, 0f, enrageScale); + Main.npc[servantSpawn].velocity.X = servantSpawnVelocity.X; + Main.npc[servantSpawn].velocity.Y = servantSpawnVelocity.Y; + + if (Main.netMode == NetmodeID.Server && servantSpawn < Main.maxNPCs) + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, servantSpawn); + + if (CalamityWorld.LegendaryMode) + { + int type = ProjectileID.BloodNautilusShot; + Vector2 projectileVelocity = Main.rand.NextVector2CircularEdge(15f, 15f); + int numProj = 3; + int spread = 20; + float rotation = MathHelper.ToRadians(spread); + for (int i = 0; i < numProj; i++) + { + Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * ProjectileOffset, perturbedSpeed, type, 15, 0f, Main.myPlayer); + Main.projectile[proj].timeLeft = 600; + } + } + } + + for (int n = 0; n < 10; n++) + Dust.NewDust(servantSpawnCenter, 20, 20, DustID.Blood, servantSpawnVelocity.X * 0.4f, servantSpawnVelocity.Y * 0.4f, 0, default, 1f); + } + + if (npc.ai[1] == 100f) + { + npc.ai[0] += 1f; + npc.ai[1] = 0f; + + if (npc.ai[0] == 3f) + { + npc.ai[2] = 0f; + } + else + { + SoundEngine.PlaySound(SoundID.NPCHit1, npc.Center); + + if (Main.netMode != NetmodeID.Server) + { + for (int phase2Gore = 0; phase2Gore < 2; phase2Gore++) + { + Gore.NewGore(npc.GetSource_FromAI(), npc.position, new Vector2(Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f), 8, 1f); + Gore.NewGore(npc.GetSource_FromAI(), npc.position, new Vector2(Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f), 7, 1f); + Gore.NewGore(npc.GetSource_FromAI(), npc.position, new Vector2(Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f), 6, 1f); + } + } + + for (int i = 0; i < 20; i++) + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f, 0, default, 1f); + + SoundEngine.PlaySound(SoundID.Roar, npc.Center); + } + } + + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f, 0, default, 1f); + npc.velocity *= 0.98f; + + if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) + npc.velocity.X = 0f; + if (npc.velocity.Y > -0.1 && npc.velocity.Y < 0.1) + npc.velocity.Y = 0f; + } + + else + { + npc.defense = 0; + int setDamage = (int)Math.Round(npc.defDamage * (phase3 ? 1.4 : 1.2)); + int reducedSetDamage = (int)Math.Round(setDamage * 0.5); + + if (npc.ai[1] == 0f & phase3) + npc.ai[1] = 5f; + + if (npc.ai[1] == 0f) + { + // Deal less damage overall while not charging + npc.damage = reducedSetDamage; + + float hoverSpeed = 5.5f + 3f * (phase2LifeRatio - lifeRatio); + float hoverAcceleration = 0.06f + 0.02f * (phase2LifeRatio - lifeRatio); + hoverSpeed += 4f * enrageScale; + hoverAcceleration += 0.04f * enrageScale; + + if (death) + { + hoverSpeed += 5.5f * (phase2LifeRatio - lifeRatio); + hoverAcceleration += 0.06f * (phase2LifeRatio - lifeRatio); + } + + Vector2 hoverDestination = Main.player[npc.target].Center - Vector2.UnitY * 400f; + float distanceFromHoverDestination = npc.Distance(hoverDestination); + + if (distanceFromHoverDestination > 400f) + { + hoverSpeed += 1.25f; + hoverAcceleration += 0.075f; + if (distanceFromHoverDestination > 600f) + { + hoverSpeed += 1.25f; + hoverAcceleration += 0.075f; + if (distanceFromHoverDestination > 800f) + { + hoverSpeed += 1.25f; + hoverAcceleration += 0.075f; + } + } + } + + if (Main.getGoodWorld) + { + hoverSpeed += 1f; + hoverAcceleration += 0.1f; + } + + float phaseLimit = (masterMode ? 160f : 200f) - (death ? 150f * (phase2LifeRatio - lifeRatio) : 0f); + bool timeToCharge = npc.ai[2] >= phaseLimit; + Vector2 idealHoverVelocity = npc.SafeDirectionTo(hoverDestination) * (hoverSpeed + (timeToCharge ? ((npc.ai[2] - phaseLimit) * 0.01f) : 0f)); + npc.SimpleFlyMovement(idealHoverVelocity, hoverAcceleration + (timeToCharge ? ((npc.ai[2] - phaseLimit) * 0.001f) : 0f)); + + npc.ai[2] += 1f; + float projectileGateValue = (lifeRatio < 0.5f && death) ? (masterMode ? 40f : 50f) : (masterMode ? 60f : 80f); + if (npc.ai[2] % projectileGateValue == 0f && shootProjectile) + { + Vector2 projectileVelocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * servantAndProjectileVelocity * 2f; + Vector2 projectileSpawnCenter = npc.Center + projectileVelocity; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int type = ProjectileID.BloodNautilusShot; + int numProj = masterMode ? Main.rand.Next(4, 6) : 3; + int spread = masterMode ? numProj * 3 : 10; + float rotation = MathHelper.ToRadians(spread); + for (int i = 0; i < numProj; i++) + { + Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * ProjectileOffset, perturbedSpeed, type, 15, 0f, Main.myPlayer); + Main.projectile[proj].timeLeft = 600; + } + } + } + + if (timeToCharge && charge) + { + npc.ai[1] = 1f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.TargetClosest(); + npc.netUpdate = true; + } + } + + else if (npc.ai[1] == 1f) + { + // Set damage + npc.damage = setDamage; + + SoundEngine.PlaySound(SoundID.ForceRoar, npc.Center); + npc.rotation = eyeRotation; + + float additionalVelocityPerCharge = 3f; + float chargeSpeed = 10f + (3.5f * (phase2LifeRatio - lifeRatio)) + npc.ai[3] * additionalVelocityPerCharge; + chargeSpeed += 4f * enrageScale; + if (death) + chargeSpeed += 6.5f * (phase2LifeRatio - lifeRatio); + if (npc.ai[3] == 1f) + chargeSpeed *= 1.15f; + if (npc.ai[3] == 2f) + chargeSpeed *= 1.3f; + if (Main.getGoodWorld) + chargeSpeed *= 1.2f; + + npc.velocity = npc.SafeDirectionTo(Main.player[npc.target].Center) * chargeSpeed; + npc.ai[1] = 2f; + npc.netUpdate = true; + + if (npc.netSpam > 10) + npc.netSpam = 10; + } + + else if (npc.ai[1] == 2f) + { + // Set damage + npc.damage = setDamage; + + int phase2ChargeDelay = masterMode ? 60 : 80; + if (death) + phase2ChargeDelay -= (int)Math.Round(35f * (phase2LifeRatio - lifeRatio)); + + float slowDownGateValue = phase2ChargeDelay * (death ? (masterMode ? 0.95f : 0.85f) : (masterMode ? 0.9f : 0.75f)); + + npc.ai[2] += 1f; + if (npc.ai[2] >= slowDownGateValue) + { + // Deal less damage overall while not charging + npc.damage = reducedSetDamage; + + float decelerationScalar = death ? ((lifeRatio - phase3LifeRatio) / (phase2LifeRatio - phase3LifeRatio)) : 1f; + if (decelerationScalar < 0f) + decelerationScalar = 0f; + + npc.velocity *= (MathHelper.Lerp(masterMode ? 0.6f : 0.9f, masterMode ? 0.7f : 0.95f, decelerationScalar)); + if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) + npc.velocity.X = 0f; + if (npc.velocity.Y > -0.1 && npc.velocity.Y < 0.1) + npc.velocity.Y = 0f; + } + else + npc.rotation = npc.velocity.ToRotation() - MathHelper.PiOver2; + + if (npc.ai[2] >= phase2ChargeDelay) + { + npc.ai[3] += 1f; + npc.ai[2] = 0f; + npc.TargetClosest(); + npc.rotation = eyeRotation; + + float numCharges = death ? 4f : 3f; + if (npc.ai[3] >= numCharges) + { + // Deal less damage overall while not charging + npc.damage = reducedSetDamage; + + npc.ai[1] = 0f; + npc.ai[3] = 0f; + npc.netUpdate = true; + + if (npc.netSpam > 10) + npc.netSpam = 10; + } + else + npc.ai[1] = 1f; + } + } + + else if (npc.ai[1] == 3f) + { + if ((npc.ai[3] == 4f & phase3) && npc.Center.Y > Main.player[npc.target].Center.Y) + { + // Deal less damage overall while not charging + npc.damage = reducedSetDamage; + + npc.TargetClosest(); + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.netUpdate = true; + + if (npc.netSpam > 10) + npc.netSpam = 10; + } + else if (Main.netMode != NetmodeID.MultiplayerClient) + { + // Set damage + npc.damage = setDamage; + + float speedBoost = death ? 10f * (phase3LifeRatio - lifeRatio) : 7f * (phase3LifeRatio - lifeRatio); + float finalChargeSpeed = 18f + speedBoost; + finalChargeSpeed += 10f * enrageScale; + + Vector2 eyeChargeDirection = npc.Center; + float targetX = Main.player[npc.target].Center.X - eyeChargeDirection.X; + float targetY = Main.player[npc.target].Center.Y - eyeChargeDirection.Y; + float targetVelocity = Math.Abs(Main.player[npc.target].velocity.X) + Math.Abs(Main.player[npc.target].velocity.Y) / 4f; + targetVelocity += 10f - targetVelocity; + + if (targetVelocity < (masterMode ? 2f : 5f)) + targetVelocity = (masterMode ? 2f : 5f); + if (targetVelocity > (masterMode ? 6f : 15f)) + targetVelocity = (masterMode ? 6f : 15f); + + if (npc.ai[2] == -1f) + { + targetVelocity *= 4f; + finalChargeSpeed *= 1.3f; + } + + targetX -= Main.player[npc.target].velocity.X * targetVelocity; + targetY -= Main.player[npc.target].velocity.Y * targetVelocity / 4f; + + float targetDistance = (float)Math.Sqrt(targetX * targetX + targetY * targetY); + float targetDistCopy = targetDistance; + + targetDistance = finalChargeSpeed / targetDistance; + npc.velocity.X = targetX * targetDistance; + npc.velocity.Y = targetY * targetDistance; + + if (targetDistCopy < 100f) + { + if (Math.Abs(npc.velocity.X) > Math.Abs(npc.velocity.Y)) + { + float absoluteXVel = Math.Abs(npc.velocity.X); + float absoluteYVel = Math.Abs(npc.velocity.Y); + + if (npc.Center.X > Main.player[npc.target].Center.X) + absoluteYVel *= -1f; + if (npc.Center.Y > Main.player[npc.target].Center.Y) + absoluteXVel *= -1f; + + npc.velocity.X = absoluteYVel; + npc.velocity.Y = absoluteXVel; + } + } + else if (Math.Abs(npc.velocity.X) > Math.Abs(npc.velocity.Y)) + { + float absoluteEyeVel = (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) / 2f; + float absoluteEyeVelBackup = absoluteEyeVel; + + if (npc.Center.X > Main.player[npc.target].Center.X) + absoluteEyeVelBackup *= -1f; + if (npc.Center.Y > Main.player[npc.target].Center.Y) + absoluteEyeVel *= -1f; + + npc.velocity.X = absoluteEyeVelBackup; + npc.velocity.Y = absoluteEyeVel; + } + + npc.ai[1] = 4f; + npc.netUpdate = true; + + if (npc.netSpam > 10) + npc.netSpam = 10; + } + } + + else if (npc.ai[1] == 4f) + { + // Set damage + npc.damage = setDamage; + + if (npc.ai[2] == 0f) + SoundEngine.PlaySound(SoundID.ForceRoarPitched, npc.Center); + + float lineUpDistControl = lineUpDist; + npc.ai[2] += 1f; + + if (npc.ai[2] == lineUpDistControl && Vector2.Distance(npc.position, Main.player[npc.target].position) < 200f) + npc.ai[2] -= 1f; + + if (npc.ai[2] >= lineUpDistControl) + { + // Deal less damage overall while not charging + npc.damage = reducedSetDamage; + + npc.velocity *= 0.95f; + if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) + npc.velocity.X = 0f; + if (npc.velocity.Y > -0.1 && npc.velocity.Y < 0.1) + npc.velocity.Y = 0f; + } + else + npc.rotation = npc.velocity.ToRotation() - MathHelper.PiOver2; + + float lineUpDistNetUpdate = lineUpDistControl + 13f; + if (npc.ai[2] >= lineUpDistNetUpdate) + { + npc.netUpdate = true; + + if (npc.netSpam > 10) + npc.netSpam = 10; + + npc.ai[3] += 1f; + npc.ai[2] = 0f; + + float maxCharges = death ? (finalPhaseDeath ? 0f : penultimatePhaseDeath ? 1f : 2f) : finalPhaseRev ? 2f : 3f; + if (npc.ai[3] >= maxCharges) + { + // Deal less damage overall while not charging + npc.damage = reducedSetDamage; + + npc.ai[1] = 0f; + npc.ai[3] = 0f; + } + else + npc.ai[1] = 3f; + } + } + + else if (npc.ai[1] == 5f) + { + // Deal less damage overall while not charging + npc.damage = reducedSetDamage; + + float offset = death ? 540f : 600f; + float speedBoost = death ? 15f * (phase3LifeRatio - lifeRatio) : 5f * (phase3LifeRatio - lifeRatio); + float accelerationBoost = death ? 0.425f * (phase3LifeRatio - lifeRatio) : 0.125f * (phase3LifeRatio - lifeRatio); + float hoverSpeed = 8f + speedBoost; + float hoverAcceleration = 0.25f + accelerationBoost; + hoverSpeed += enrageScale * 4f; + hoverAcceleration += enrageScale * 0.125f; + + Vector2 eyeLineUpChargeDirection = npc.Center; + float lineUpChargeTargetX = Main.player[npc.target].Center.X - eyeLineUpChargeDirection.X; + float lineUpChargeTargetY = Main.player[npc.target].Center.Y + offset - eyeLineUpChargeDirection.Y; + Vector2 hoverDestination = Main.player[npc.target].Center + Vector2.UnitY * offset; + + bool horizontalCharge = calamityGlobalNPC.newAI[0] == 1f || calamityGlobalNPC.newAI[0] == 3f; + if (horizontalCharge) + { + float horizontalChargeOffset = death ? 450f : 500f; + offset = calamityGlobalNPC.newAI[0] == 1f ? -horizontalChargeOffset : horizontalChargeOffset; + hoverSpeed *= 1.5f; + hoverAcceleration *= 1.5f; + hoverDestination = Main.player[npc.target].Center + Vector2.UnitX * offset; + } + + Vector2 idealHoverVelocity = npc.SafeDirectionTo(hoverDestination) * hoverSpeed; + npc.SimpleFlyMovement(idealHoverVelocity, hoverAcceleration); + + float timeGateValue = horizontalCharge ? (100f - (death ? 80f * (phase3LifeRatio - lifeRatio) : 0f)) : (85f - (death ? 70f * (phase3LifeRatio - lifeRatio) : 0f)); + float servantSpawnGateValue = horizontalCharge ? (death ? 23f : 35f) : (death ? 17f : 27f); + float maxServantSpawnsPerAttack = 2f; + + npc.ai[2] += 1f; + if (npc.ai[2] % servantSpawnGateValue == 0f && shootProjectile && npc.ai[2] <= servantSpawnGateValue * maxServantSpawnsPerAttack) + { + Vector2 servantSpawnVelocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * servantAndProjectileVelocity; + Vector2 servantSpawnCenter = npc.Center + servantSpawnVelocity.SafeNormalize(Vector2.UnitY) * ProjectileOffset; + + int spawnType = NPCID.ServantofCthulhu; + bool spawnServant = false; + float enrageScaleToPass = enrageScale; + if (masterMode) + { + int maxBloodServants = 2; + bool spawnBloodServant = NPC.CountNPCS(ModContent.NPCType()) < maxBloodServants; + if (spawnBloodServant) + { + spawnType = ModContent.NPCType(); + spawnServant = true; + enrageScaleToPass += 0.5f; + } + else + { + int maxServants = death ? 1 : 2; + spawnServant = (penultimatePhaseDeath || finalPhaseRev) ? false : NPC.CountNPCS(NPCID.ServantofCthulhu) < maxServants; + } + } + else + { + int maxServants = death ? (finalPhaseDeath ? 1 : penultimatePhaseDeath ? 2 : 3) : (finalPhaseRev ? 2 : 4); + spawnServant = NPC.CountNPCS(NPCID.ServantofCthulhu) < maxServants; + } + + if (spawnServant) + SoundEngine.PlaySound(SoundID.NPCDeath13, servantSpawnCenter); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (spawnServant) + { + int eye = NPC.NewNPC(npc.GetSource_FromAI(), (int)servantSpawnCenter.X, (int)servantSpawnCenter.Y, spawnType, 0, 0f, 0f, enrageScaleToPass); + Main.npc[eye].velocity.X = servantSpawnVelocity.X; + Main.npc[eye].velocity.Y = servantSpawnVelocity.Y; + + if (Main.netMode == NetmodeID.Server && eye < Main.maxNPCs) + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, eye); + } + else if (!CalamityWorld.LegendaryMode) + { + int projType = ProjectileID.BloodNautilusShot; + int projDamage = npc.GetProjectileDamage(projType); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + servantSpawnVelocity.SafeNormalize(Vector2.UnitY) * ProjectileOffset, servantSpawnVelocity * 2f, projType, projDamage, 0f, Main.myPlayer); + Main.projectile[proj].timeLeft = 600; + } + + if (CalamityWorld.LegendaryMode) + { + int type = ProjectileID.BloodNautilusShot; + Vector2 projectileVelocity = servantSpawnVelocity * 3f; + int numProj = 3; + int spread = 20; + float rotation = MathHelper.ToRadians(spread); + for (int i = 0; i < numProj; i++) + { + Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * ProjectileOffset, perturbedSpeed, type, 15, 0f, Main.myPlayer); + Main.projectile[proj].timeLeft = 600; + } + } + } + + if (spawnServant) + { + for (int m = 0; m < 10; m++) + Dust.NewDust(servantSpawnCenter, 20, 20, DustID.Blood, servantSpawnVelocity.X * 0.4f, servantSpawnVelocity.Y * 0.4f, 0, default, 1f); + } + } + + if (npc.ai[2] >= timeGateValue) + { + switch ((int)calamityGlobalNPC.newAI[0]) + { + case 0: // Normal Eye behavior + npc.ai[1] = 3f; + npc.ai[2] = -1f; + npc.ai[3] = -1f; + break; + + case 1: // Charge from the left + npc.ai[1] = 6f; + npc.ai[2] = 0f; + break; + + case 2: // Normal Eye behavior + npc.ai[1] = 3f; + npc.ai[2] = -1f; + break; + + case 3: // Charge from the right + npc.ai[1] = 6f; + npc.ai[2] = 0f; + break; + + default: + break; + } + + npc.TargetClosest(); + calamityGlobalNPC.newAI[0] += ((masterMode && calamityGlobalNPC.newAI[0] % 2f != 0f) ? Main.rand.Next(2) + 1f : 1f); + if (calamityGlobalNPC.newAI[0] > 3f) + calamityGlobalNPC.newAI[0] = masterMode ? Main.rand.Next(2) : 0f; + + npc.SyncExtraAI(); + } + + npc.netUpdate = true; + + if (npc.netSpam > 10) + npc.netSpam = 10; + } + + else if (npc.ai[1] == 6f) + { + // Set damage + npc.damage = setDamage; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + float speedBoost = death ? 15f * (phase3LifeRatio - lifeRatio) : 5f * (phase3LifeRatio - lifeRatio); + float chargeSpeed = 18f + speedBoost; + chargeSpeed += 10f * enrageScale; + npc.velocity = npc.SafeDirectionTo(Main.player[npc.target].Center) * chargeSpeed; + + npc.ai[1] = 7f; + npc.netUpdate = true; + + if (npc.netSpam > 10) + npc.netSpam = 10; + } + } + + else if (npc.ai[1] == 7f) + { + // Set damage + npc.damage = setDamage; + + if (npc.ai[2] == 0f) + SoundEngine.PlaySound(SoundID.ForceRoar, npc.Center); + + float lineUpDistControl = (float)Math.Round(lineUpDist * 2.5f); + npc.ai[2] += 1f; + + if (npc.ai[2] == lineUpDistControl && Vector2.Distance(npc.position, Main.player[npc.target].position) < 200f) + npc.ai[2] -= 1f; + + if (npc.ai[2] >= lineUpDistControl) + { + // Deal less damage overall while not charging + npc.damage = reducedSetDamage; + + npc.velocity *= 0.95f; + if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) + npc.velocity.X = 0f; + if (npc.velocity.Y > -0.1 && npc.velocity.Y < 0.1) + npc.velocity.Y = 0f; + } + else + npc.rotation = npc.velocity.ToRotation() - MathHelper.PiOver2; + + float lineUpDistNetUpdate = lineUpDistControl + 13f; + if (npc.ai[2] >= lineUpDistNetUpdate) + { + // Deal less damage overall while not charging + npc.damage = reducedSetDamage; + + npc.netUpdate = true; + + if (npc.netSpam > 10) + npc.netSpam = 10; + + npc.ai[2] = 0f; + npc.ai[1] = 0f; + } + } + } + + return false; + } + + // If you think for a fucking second that I'm going to refactor this... + public static bool VanillaEyeofCthulhuAI(NPC npc, Mod mod) + { + bool flag2 = false; + if (Main.expertMode && (double)npc.life < (double)npc.lifeMax * (Main.masterMode ? 0.2 : 0.12)) + flag2 = true; + + bool flag3 = false; + if (Main.expertMode && (double)npc.life < (double)npc.lifeMax * (Main.masterMode ? 0.08 : 0.04)) + flag3 = true; + + float num4 = Main.masterMode ? 15f : 20f; + if (flag3) + num4 = Main.masterMode ? 8f : 10f; + + if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) + npc.TargetClosest(); + + bool dead = Main.player[npc.target].dead; + float num5 = npc.Center.X - Main.player[npc.target].position.X - (float)(Main.player[npc.target].width / 2); + float num6 = npc.position.Y + (float)npc.height - 59f - Main.player[npc.target].position.Y - (float)(Main.player[npc.target].height / 2); + float num7 = (float)Math.Atan2(num6, num5) + MathHelper.PiOver2; + if (num7 < 0f) + num7 += MathHelper.TwoPi; + else if ((double)num7 > MathHelper.TwoPi) + num7 -= MathHelper.TwoPi; + + float num8 = 0f; + if (npc.ai[0] == 0f && npc.ai[1] == 0f) + num8 = 0.02f; + + if (npc.ai[0] == 0f && npc.ai[1] == 2f && npc.ai[2] > 40f) + num8 = 0.05f; + + if (npc.ai[0] == 3f && npc.ai[1] == 0f) + num8 = 0.05f; + + if (npc.ai[0] == 3f && npc.ai[1] == 2f && npc.ai[2] > 40f) + num8 = 0.08f; + + if (npc.ai[0] == 3f && npc.ai[1] == 4f && npc.ai[2] > num4) + num8 = 0.15f; + + if (npc.ai[0] == 3f && npc.ai[1] == 5f) + num8 = 0.05f; + + if (Main.expertMode) + num8 *= (Main.masterMode ? 2f : 1.5f); + + if (flag3 && Main.expertMode) + num8 = 0f; + + if (npc.rotation < num7) + { + if ((double)(num7 - npc.rotation) > MathHelper.Pi) + npc.rotation -= num8; + else + npc.rotation += num8; + } + else if (npc.rotation > num7) + { + if ((double)(npc.rotation - num7) > MathHelper.Pi) + npc.rotation += num8; + else + npc.rotation -= num8; + } + + if (npc.rotation > num7 - num8 && npc.rotation < num7 + num8) + npc.rotation = num7; + + if (npc.rotation < 0f) + npc.rotation += MathHelper.TwoPi; + else if ((double)npc.rotation > MathHelper.TwoPi) + npc.rotation -= MathHelper.TwoPi; + + if (npc.rotation > num7 - num8 && npc.rotation < num7 + num8) + npc.rotation = num7; + + if (Main.rand.NextBool(5)) + { + int num9 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + (float)npc.height * 0.25f), npc.width, (int)((float)npc.height * 0.5f), DustID.Blood, npc.velocity.X, 2f); + Main.dust[num9].velocity.X *= 0.5f; + Main.dust[num9].velocity.Y *= 0.1f; + } + + npc.reflectsProjectiles = false; + if (Main.IsItDay() || dead) + { + npc.velocity.Y -= 0.04f; + npc.EncourageDespawn(10); + return false; + } + + if (npc.ai[0] == 0f) + { + if (npc.ai[1] == 0f) + { + // Avoid cheap bullshit + npc.damage = 0; + + float num10 = 5f; + float num11 = 0.04f; + if (Main.expertMode) + { + num11 = Main.masterMode ? 0.2f : 0.15f; + num10 = Main.masterMode ? 9f : 7f; + } + + if (Main.getGoodWorld) + { + num11 += 0.05f; + num10 += 1f; + } + + Vector2 vector = npc.Center; + float num12 = Main.player[npc.target].Center.X - vector.X; + float num13 = Main.player[npc.target].Center.Y - 200f - vector.Y; + float num14 = (float)Math.Sqrt(num12 * num12 + num13 * num13); + float num15 = num14; + num14 = num10 / num14; + num12 *= num14; + num13 *= num14; + if (npc.velocity.X < num12) + { + npc.velocity.X += num11; + if (npc.velocity.X < 0f && num12 > 0f) + npc.velocity.X += num11; + } + else if (npc.velocity.X > num12) + { + npc.velocity.X -= num11; + if (npc.velocity.X > 0f && num12 < 0f) + npc.velocity.X -= num11; + } + + if (npc.velocity.Y < num13) + { + npc.velocity.Y += num11; + if (npc.velocity.Y < 0f && num13 > 0f) + npc.velocity.Y += num11; + } + else if (npc.velocity.Y > num13) + { + npc.velocity.Y -= num11; + if (npc.velocity.Y > 0f && num13 < 0f) + npc.velocity.Y -= num11; + } + + npc.ai[2] += 1f; + float num16 = Main.masterMode ? 400f : 600f; + if (Main.expertMode) + num16 *= 0.35f; + + if (npc.ai[2] >= num16) + { + npc.ai[1] = 1f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.target = Main.maxPlayers; + npc.netUpdate = true; + } + else if ((npc.position.Y + (float)npc.height < Main.player[npc.target].position.Y && num15 < 500f) || (Main.expertMode && num15 < (Main.masterMode ? 750f : 500f))) + { + if (!Main.player[npc.target].dead) + npc.ai[3] += 1f; + + float num17 = Main.masterMode ? 70f : 110f; + if (Main.expertMode) + num17 *= 0.4f; + + if (Main.getGoodWorld) + num17 *= 0.8f; + + if (npc.ai[3] >= num17) + { + npc.ai[3] = 0f; + npc.rotation = num7; + float num18 = 5f; + if (Main.expertMode) + num18 = 6f; + if (Main.masterMode) + num18 = 9f; + + float num19 = Main.player[npc.target].Center.X - vector.X; + float num20 = Main.player[npc.target].Center.Y - vector.Y; + float num21 = (float)Math.Sqrt(num19 * num19 + num20 * num20); + num21 = num18 / num21; + Vector2 vector2 = vector; + Vector2 vector3 = default(Vector2); + vector3.X = num19 * num21; + vector3.Y = num20 * num21; + vector2.X += vector3.X * 10f; + vector2.Y += vector3.Y * 10f; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int num22 = NPC.NewNPC(npc.GetSource_FromAI(), (int)vector2.X, (int)vector2.Y, NPCID.ServantofCthulhu); + Main.npc[num22].velocity.X = vector3.X; + Main.npc[num22].velocity.Y = vector3.Y; + if (Main.netMode == NetmodeID.Server && num22 < Main.maxNPCs) + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num22); + } + + SoundEngine.PlaySound(SoundID.NPCHit1, vector2); + for (int m = 0; m < 10; m++) + Dust.NewDust(vector2, 20, 20, DustID.Blood, vector3.X * 0.4f, vector3.Y * 0.4f); + } + } + } + else if (npc.ai[1] == 1f) + { + // Set damage + npc.damage = npc.defDamage; + + npc.rotation = num7; + float num23 = 6f; + if (Main.expertMode) + num23 = 7f; + if (Main.masterMode) + num23 = 9f; + + if (Main.getGoodWorld) + num23 += 1f; + + Vector2 vector4 = npc.Center; + float num24 = Main.player[npc.target].Center.X - vector4.X; + float num25 = Main.player[npc.target].Center.Y - vector4.Y; + float num26 = (float)Math.Sqrt(num24 * num24 + num25 * num25); + num26 = num23 / num26; + npc.velocity.X = num24 * num26; + npc.velocity.Y = num25 * num26; + npc.ai[1] = 2f; + npc.netUpdate = true; + if (npc.netSpam > 10) + npc.netSpam = 10; + } + else if (npc.ai[1] == 2f) + { + // Set damage + npc.damage = npc.defDamage; + + npc.ai[2] += 1f; + if (npc.ai[2] >= 40f) + { + // Avoid cheap bullshit + npc.damage = 0; + + npc.velocity *= 0.98f; + if (Main.expertMode) + npc.velocity *= 0.985f; + if (Main.masterMode) + npc.velocity *= 0.99f; + + if (Main.getGoodWorld) + npc.velocity *= 0.99f; + + if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) + npc.velocity.X = 0f; + + if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) + npc.velocity.Y = 0f; + } + else + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) - MathHelper.PiOver2; + + int num27 = 150; + if (Main.expertMode) + num27 = 100; + if (Main.masterMode) + num27 = 80; + + if (Main.getGoodWorld) + num27 -= 15; + + if (npc.ai[2] >= (float)num27) + { + npc.ai[3] += 1f; + npc.ai[2] = 0f; + npc.target = Main.maxPlayers; + npc.rotation = num7; + if (npc.ai[3] >= (Main.masterMode ? 4f : 3f)) + { + // Avoid cheap bullshit + npc.damage = 0; + + npc.ai[1] = 0f; + npc.ai[3] = 0f; + } + else + npc.ai[1] = 1f; + } + } + + float num28 = 0.5f; + if (Main.expertMode) + num28 = 0.65f; + if (Main.masterMode) + num28 = 0.75f; + + if ((float)npc.life < (float)npc.lifeMax * num28) + { + // Avoid cheap bullshit + npc.damage = 0; + + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.netUpdate = true; + if (npc.netSpam > 10) + npc.netSpam = 10; + } + + return false; + } + + if (npc.ai[0] == 1f || npc.ai[0] == 2f) + { + // Avoid cheap bullshit + npc.damage = 0; + + if (npc.ai[0] == 1f || npc.ai[3] == 1f) + { + npc.ai[2] += 0.005f; + if ((double)npc.ai[2] > 0.5) + npc.ai[2] = 0.5f; + } + else + { + npc.ai[2] -= 0.005f; + if (npc.ai[2] < 0f) + npc.ai[2] = 0f; + } + + npc.rotation += npc.ai[2]; + npc.ai[1] += 1f; + if (Main.getGoodWorld) + npc.reflectsProjectiles = true; + + int num29 = 20; + if (Main.getGoodWorld && npc.life < npc.lifeMax / 3) + num29 = 10; + + if (Main.expertMode && npc.ai[1] % (float)num29 == 0f) + { + float num30 = Main.masterMode ? 8f : 5f; + Vector2 vector5 = npc.Center; + float num31 = Main.rand.Next(-200, 200); + float num32 = Main.rand.Next(-200, 200); + if (Main.getGoodWorld) + { + num31 *= 3f; + num32 *= 3f; + } + + float num33 = (float)Math.Sqrt(num31 * num31 + num32 * num32); + num33 = num30 / num33; + Vector2 vector6 = vector5; + Vector2 vector7 = default(Vector2); + vector7.X = num31 * num33; + vector7.Y = num32 * num33; + vector6.X += vector7.X * 10f; + vector6.Y += vector7.Y * 10f; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int num34 = NPC.NewNPC(npc.GetSource_FromAI(), (int)vector6.X, (int)vector6.Y, NPCID.ServantofCthulhu); + Main.npc[num34].velocity.X = vector7.X; + Main.npc[num34].velocity.Y = vector7.Y; + if (Main.netMode == NetmodeID.Server && num34 < Main.maxNPCs) + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num34); + } + + for (int n = 0; n < 10; n++) + Dust.NewDust(vector6, 20, 20, DustID.Blood, vector7.X * 0.4f, vector7.Y * 0.4f); + } + + if (npc.ai[1] >= 100f) + { + if (npc.ai[3] == 1f) + { + npc.ai[3] = 0f; + npc.ai[1] = 0f; + } + else + { + npc.ai[0] += 1f; + npc.ai[1] = 0f; + if (npc.ai[0] == 3f) + { + npc.ai[2] = 0f; + } + else + { + SoundEngine.PlaySound(SoundID.NPCHit1, npc.Center); + for (int num35 = 0; num35 < 2; num35++) + { + Gore.NewGore(npc.GetSource_FromAI(), npc.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 8); + Gore.NewGore(npc.GetSource_FromAI(), npc.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 7); + Gore.NewGore(npc.GetSource_FromAI(), npc.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 6); + } + + for (int num36 = 0; num36 < 20; num36++) + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, (float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f); + + SoundEngine.PlaySound(SoundID.ForceRoar, npc.Center); + } + } + } + + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, (float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f); + npc.velocity *= 0.98f; + if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) + npc.velocity.X = 0f; + + if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) + npc.velocity.Y = 0f; + + return false; + } + + npc.defense = 0; + if (Main.expertMode) + { + if (flag2) + npc.defense = -(Main.masterMode ? 10 : 15); + if (flag3) + npc.defense = -(Main.masterMode ? 20 : 30); + } + + double phase2DamageMultiplier = 1.5; + npc.damage = (int)Math.Round(npc.defDamage * phase2DamageMultiplier); + int reducedSetDamage = (int)Math.Round(npc.damage * 0.5); + + if (npc.ai[1] == 0f && flag2) + npc.ai[1] = 5f; + + if (npc.ai[1] == 0f) + { + // Deal less damage while not charging + npc.damage = reducedSetDamage; + + float num39 = Main.masterMode ? 8f : 6f; + float num40 = Main.masterMode ? 0.1f : 0.07f; + Vector2 vector8 = npc.Center; + float num41 = Main.player[npc.target].Center.X - vector8.X; + float num42 = Main.player[npc.target].Center.Y - 120f - vector8.Y; + float num43 = (float)Math.Sqrt(num41 * num41 + num42 * num42); + float distanceVelocityIncrease = Main.masterMode ? 1.5f : 1f; + float distanceAccelerationIncrease = Main.masterMode ? 0.08f : 0.05f; + if (num43 > 400f && Main.expertMode) + { + num39 += distanceVelocityIncrease; + num40 += distanceAccelerationIncrease; + if (num43 > 600f) + { + num39 += distanceVelocityIncrease; + num40 += distanceAccelerationIncrease; + if (num43 > 800f) + { + num39 += distanceVelocityIncrease; + num40 += distanceAccelerationIncrease; + } + } + } + + if (Main.getGoodWorld) + { + num39 += 1f; + num40 += 0.1f; + } + + num43 = num39 / num43; + num41 *= num43; + num42 *= num43; + if (npc.velocity.X < num41) + { + npc.velocity.X += num40; + if (npc.velocity.X < 0f && num41 > 0f) + npc.velocity.X += num40; + } + else if (npc.velocity.X > num41) + { + npc.velocity.X -= num40; + if (npc.velocity.X > 0f && num41 < 0f) + npc.velocity.X -= num40; + } + + if (npc.velocity.Y < num42) + { + npc.velocity.Y += num40; + if (npc.velocity.Y < 0f && num42 > 0f) + npc.velocity.Y += num40; + } + else if (npc.velocity.Y > num42) + { + npc.velocity.Y -= num40; + if (npc.velocity.Y > 0f && num42 < 0f) + npc.velocity.Y -= num40; + } + + npc.ai[2] += 1f; + if (npc.ai[2] >= (Main.masterMode ? 120f : 200f)) + { + npc.ai[1] = 1f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + if (Main.expertMode && (double)npc.life < (double)npc.lifeMax * (Main.masterMode ? 0.45 : 0.35)) + npc.ai[1] = 3f; + + npc.target = Main.maxPlayers; + npc.netUpdate = true; + } + + if (Main.expertMode && flag3) + { + npc.TargetClosest(); + npc.netUpdate = true; + npc.ai[1] = 3f; + npc.ai[2] = 0f; + npc.ai[3] -= 1000f; + } + } + else if (npc.ai[1] == 1f) + { + SoundEngine.PlaySound(SoundID.ForceRoar, npc.Center); + npc.rotation = num7; + float num44 = Main.masterMode ? 8f : 6.8f; + if (Main.expertMode && npc.ai[3] == 1f) + num44 *= 1.15f; + + if (Main.expertMode && npc.ai[3] == 2f) + num44 *= 1.3f; + + if (Main.getGoodWorld) + num44 *= 1.2f; + + Vector2 vector9 = npc.Center; + float num45 = Main.player[npc.target].Center.X - vector9.X; + float num46 = Main.player[npc.target].Center.Y - vector9.Y; + float num47 = (float)Math.Sqrt(num45 * num45 + num46 * num46); + num47 = num44 / num47; + npc.velocity.X = num45 * num47; + npc.velocity.Y = num46 * num47; + npc.ai[1] = 2f; + npc.netUpdate = true; + if (npc.netSpam > 10) + npc.netSpam = 10; + } + else if (npc.ai[1] == 2f) + { + float num48 = 40f; + npc.ai[2] += 1f; + if (Main.expertMode) + num48 = 50f; + if (Main.masterMode) + num48 = 60f; + + if (npc.ai[2] >= num48) + { + // Deal less damage while not charging + npc.damage = reducedSetDamage; + + npc.velocity *= 0.97f; + if (Main.expertMode) + npc.velocity *= 0.98f; + if (Main.masterMode) + npc.velocity *= 0.99f; + + if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) + npc.velocity.X = 0f; + + if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) + npc.velocity.Y = 0f; + } + else + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) - MathHelper.PiOver2; + + int num49 = 130; + if (Main.expertMode) + num49 = 90; + if (Main.masterMode) + num49 = 80; + + if (npc.ai[2] >= (float)num49) + { + npc.ai[3] += 1f; + npc.ai[2] = 0f; + npc.target = Main.maxPlayers; + npc.rotation = num7; + if (npc.ai[3] >= 3f) + { + // Deal less damage while not charging + npc.damage = reducedSetDamage; + + npc.ai[1] = 0f; + npc.ai[3] = 0f; + if (Main.expertMode && Main.netMode != NetmodeID.MultiplayerClient && (double)npc.life < (double)npc.lifeMax * (Main.masterMode ? 0.6 : 0.5)) + { + npc.ai[1] = 3f; + npc.ai[3] += Main.rand.Next(1, 4); + } + + npc.netUpdate = true; + if (npc.netSpam > 10) + npc.netSpam = 10; + } + else + npc.ai[1] = 1f; + } + } + else if (npc.ai[1] == 3f) + { + if (npc.ai[3] == 4f && flag2 && npc.Center.Y > Main.player[npc.target].Center.Y) + { + // Deal less damage while not charging + npc.damage = reducedSetDamage; + + npc.TargetClosest(); + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.netUpdate = true; + if (npc.netSpam > 10) + npc.netSpam = 10; + } + else if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.TargetClosest(); + float num50 = Main.masterMode ? 24f : 20f; + Vector2 vector10 = npc.Center; + float num51 = Main.player[npc.target].Center.X - vector10.X; + float num52 = Main.player[npc.target].Center.Y - vector10.Y; + float num53 = Math.Abs(Main.player[npc.target].velocity.X) + Math.Abs(Main.player[npc.target].velocity.Y) / 4f; + num53 += 10f - num53; + if (num53 < 5f) + num53 = 5f; + + if (num53 > 15f) + num53 = 15f; + + if (npc.ai[2] == -1f && !flag3) + { + num53 *= 4f; + num50 *= 1.3f; + } + + if (flag3) + num53 *= 2f; + + num51 -= Main.player[npc.target].velocity.X * num53; + num52 -= Main.player[npc.target].velocity.Y * num53 / 4f; + num51 *= 1f + (float)Main.rand.Next(-10, 11) * 0.01f; + num52 *= 1f + (float)Main.rand.Next(-10, 11) * 0.01f; + if (flag3) + { + num51 *= 1f + (float)Main.rand.Next(-10, 11) * 0.01f; + num52 *= 1f + (float)Main.rand.Next(-10, 11) * 0.01f; + } + + float num54 = (float)Math.Sqrt(num51 * num51 + num52 * num52); + float num55 = num54; + num54 = num50 / num54; + npc.velocity.X = num51 * num54; + npc.velocity.Y = num52 * num54; + npc.velocity.X += (float)Main.rand.Next(-20, 21) * 0.1f; + npc.velocity.Y += (float)Main.rand.Next(-20, 21) * 0.1f; + if (flag3) + { + npc.velocity.X += (float)Main.rand.Next(-50, 51) * 0.1f; + npc.velocity.Y += (float)Main.rand.Next(-50, 51) * 0.1f; + float num56 = Math.Abs(npc.velocity.X); + float num57 = Math.Abs(npc.velocity.Y); + if (npc.Center.X > Main.player[npc.target].Center.X) + num57 *= -1f; + + if (npc.Center.Y > Main.player[npc.target].Center.Y) + num56 *= -1f; + + npc.velocity.X = num57 + npc.velocity.X; + npc.velocity.Y = num56 + npc.velocity.Y; + npc.velocity = npc.velocity.SafeNormalize(Vector2.UnitY); + npc.velocity *= num50; + npc.velocity.X += (float)Main.rand.Next(-20, 21) * 0.1f; + npc.velocity.Y += (float)Main.rand.Next(-20, 21) * 0.1f; + } + else if (num55 < 100f) + { + if (Math.Abs(npc.velocity.X) > Math.Abs(npc.velocity.Y)) + { + float num58 = Math.Abs(npc.velocity.X); + float num59 = Math.Abs(npc.velocity.Y); + if (npc.Center.X > Main.player[npc.target].Center.X) + num59 *= -1f; + + if (npc.Center.Y > Main.player[npc.target].Center.Y) + num58 *= -1f; + + npc.velocity.X = num59; + npc.velocity.Y = num58; + } + } + else if (Math.Abs(npc.velocity.X) > Math.Abs(npc.velocity.Y)) + { + float num60 = (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) / 2f; + float num61 = num60; + if (npc.Center.X > Main.player[npc.target].Center.X) + num61 *= -1f; + + if (npc.Center.Y > Main.player[npc.target].Center.Y) + num60 *= -1f; + + npc.velocity.X = num61; + npc.velocity.Y = num60; + } + + npc.ai[1] = 4f; + npc.netUpdate = true; + if (npc.netSpam > 10) + npc.netSpam = 10; + } + } + else if (npc.ai[1] == 4f) + { + if (npc.ai[2] == 0f) + SoundEngine.PlaySound(SoundID.ForceRoarPitched, npc.Center); + + float num62 = num4; + npc.ai[2] += 1f; + if (npc.ai[2] == num62 && Vector2.Distance(npc.position, Main.player[npc.target].position) < 200f) + npc.ai[2] -= 1f; + + if (npc.ai[2] >= num62) + { + // Deal less damage while not charging + npc.damage = reducedSetDamage; + + npc.velocity *= 0.95f; + if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) + npc.velocity.X = 0f; + + if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) + npc.velocity.Y = 0f; + } + else + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) - MathHelper.PiOver2; + + float num63 = num62 + 13f; + if (npc.ai[2] >= num63) + { + npc.netUpdate = true; + if (npc.netSpam > 10) + npc.netSpam = 10; + + npc.ai[3] += 1f; + npc.ai[2] = 0f; + if (npc.ai[3] >= 5f) + { + // Deal less damage while not charging + npc.damage = reducedSetDamage; + + npc.ai[1] = 0f; + npc.ai[3] = 0f; + if (npc.target >= 0 && Main.getGoodWorld && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, npc.width, npc.height)) + { + SoundEngine.PlaySound(SoundID.ForceRoarPitched, npc.Center); + npc.ai[0] = 2f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 1f; + npc.netUpdate = true; + } + } + else + npc.ai[1] = 3f; + } + } + else if (npc.ai[1] == 5f) + { + // Deal less damage while not charging + npc.damage = reducedSetDamage; + + float num64 = 600f; + float num65 = Main.masterMode ? 12f : 9f; + float num66 = Main.masterMode ? 0.4f : 0.3f; + Vector2 vector11 = npc.Center; + float num67 = Main.player[npc.target].Center.X - vector11.X; + float num68 = Main.player[npc.target].Center.Y + num64 - vector11.Y; + float num69 = (float)Math.Sqrt(num67 * num67 + num68 * num68); + num69 = num65 / num69; + num67 *= num69; + num68 *= num69; + if (npc.velocity.X < num67) + { + npc.velocity.X += num66; + if (npc.velocity.X < 0f && num67 > 0f) + npc.velocity.X += num66; + } + else if (npc.velocity.X > num67) + { + npc.velocity.X -= num66; + if (npc.velocity.X > 0f && num67 < 0f) + npc.velocity.X -= num66; + } + + if (npc.velocity.Y < num68) + { + npc.velocity.Y += num66; + if (npc.velocity.Y < 0f && num68 > 0f) + npc.velocity.Y += num66; + } + else if (npc.velocity.Y > num68) + { + npc.velocity.Y -= num66; + if (npc.velocity.Y > 0f && num68 < 0f) + npc.velocity.Y -= num66; + } + + npc.ai[2] += 1f; + if (npc.ai[2] >= (Main.masterMode ? 40f : 70f)) + { + npc.TargetClosest(); + npc.ai[1] = 3f; + npc.ai[2] = -1f; + npc.ai[3] = Main.rand.Next(-3, 1); + npc.netUpdate = true; + } + } + + if (flag3 && npc.ai[1] == 5f) + npc.ai[1] = 3f; + + return false; + } + } +} diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/GolemAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/GolemAI.cs new file mode 100644 index 0000000000..df15000bff --- /dev/null +++ b/NPCs/VanillaNPCAIOverrides/Bosses/GolemAI.cs @@ -0,0 +1,2451 @@ +using System; +using CalamityMod.Events; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses +{ + public static class GolemAI + { + public static bool BuffedGolemAI(NPC npc, Mod mod) + { + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + + // whoAmI variable + NPC.golemBoss = npc.whoAmI; + + // Percent life remaining + float lifeRatio = npc.life / (float)npc.lifeMax; + + // Phases + bool bossRush = BossRushEvent.BossRushActive; + bool masterMode = Main.masterMode || bossRush; + bool death = CalamityWorld.death || bossRush; + bool phase2 = lifeRatio < 0.75f; + bool phase3 = lifeRatio < 0.5f; + bool phase4 = lifeRatio < 0.25f; + + // Spawn parts + if (npc.localAI[0] == 0f && Main.netMode != NetmodeID.MultiplayerClient) + { + npc.localAI[0] = 1f; + int numFists = masterMode ? 2 : 1; + for (int i = 0; i < numFists; i++) + { + float fistPunchTimeOffset = i * 30f; + NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X - 84, (int)npc.Center.Y - 9, NPCID.GolemFistLeft, 0, 0f, fistPunchTimeOffset); + NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X + 78, (int)npc.Center.Y - 9, NPCID.GolemFistRight, 0, 0f, fistPunchTimeOffset); + } + NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X - 3, (int)npc.Center.Y - 57, NPCID.GolemHead); + } + + // Get a target + 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(); + + // Despawn + if (npc.target >= 0 && Main.player[npc.target].dead) + { + npc.TargetClosest(); + if (Main.player[npc.target].dead) + npc.noTileCollide = true; + } + + // Enrage if the target isn't inside the temple + // Turbo enrage if target isn't inside the temple and it's Boss Rush or For the Worthy + bool enrage = true; + bool turboEnrage = false; + if (Main.player[npc.target].Center.Y > Main.worldSurface * 16.0) + { + int targetTilePosX = (int)Main.player[npc.target].Center.X / 16; + int targetTilePosY = (int)Main.player[npc.target].Center.Y / 16; + + Tile tile = Framing.GetTileSafely(targetTilePosX, targetTilePosY); + if (tile.WallType == WallID.LihzahrdBrickUnsafe) + enrage = false; + else + turboEnrage = bossRush || Main.getGoodWorld; + } + else + turboEnrage = bossRush || Main.getGoodWorld; + + if (bossRush || Main.getGoodWorld) + enrage = true; + + npc.Calamity().CurrentlyEnraged = !bossRush && (enrage || turboEnrage); + + bool reduceFallSpeed = npc.velocity.Y > 0f && Collision.SolidCollision(npc.position + Vector2.UnitY * 1.1f * npc.velocity.Y, npc.width, npc.height); + + // Alpha + if (npc.alpha > 0) + { + npc.alpha -= 10; + if (npc.alpha < 0) + npc.alpha = 0; + + npc.ai[1] = 0f; + } + + // Check for body parts + bool headAlive = NPC.AnyNPCs(NPCID.GolemHead); + bool leftFistAlive = NPC.AnyNPCs(NPCID.GolemFistLeft); + bool rightFistAlive = NPC.AnyNPCs(NPCID.GolemFistRight); + npc.dontTakeDamage = (headAlive || leftFistAlive || rightFistAlive) && !CalamityWorld.LegendaryMode; + + // Phase 2, check for free head + bool freeHeadAlive = NPC.AnyNPCs(NPCID.GolemHeadFree); + + // Distance required for despawning + int despawnDistance = turboEnrage ? 7500 : enrage ? 6000 : 4500; + + // Deactivate torches + if (Main.netMode != NetmodeID.MultiplayerClient && Main.getGoodWorld && npc.velocity.Y > 0f) + { + for (int j = (int)(npc.position.X / 16f); (float)j < (npc.position.X + (float)npc.width) / 16f; j++) + { + for (int k = (int)(npc.position.Y / 16f); (float)k < (npc.position.Y + (float)npc.width) / 16f; k++) + { + if (Main.tile[j, k].TileType == TileID.Torches) + { + Main.tile[j, k].Get().HasTile = false; + if (Main.netMode == NetmodeID.Server) + NetMessage.SendTileSquare(-1, j, k); + } + } + } + } + + // Spawn arm dust + if (!Main.getGoodWorld) + { + if (!leftFistAlive) + { + int lostLeftFistDust = Dust.NewDust(new Vector2(npc.Center.X - 80f * npc.scale, npc.Center.Y - 9f), 8, 8, DustID.Smoke, 0f, 0f, 100, default, 1f); + Dust dust = Main.dust[lostLeftFistDust]; + dust.alpha += Main.rand.Next(100); + dust.velocity *= 0.2f; + dust.velocity.Y -= 0.5f + Main.rand.Next(10) * 0.1f; + dust.fadeIn = 0.5f + Main.rand.Next(10) * 0.1f; + + if (Main.rand.NextBool(10)) + { + lostLeftFistDust = Dust.NewDust(new Vector2(npc.Center.X - 80f * npc.scale, npc.Center.Y - 9f), 8, 8, DustID.Torch, 0f, 0f, 0, default, 1f); + if (!Main.rand.NextBool(20)) + { + Main.dust[lostLeftFistDust].noGravity = true; + dust = Main.dust[lostLeftFistDust]; + dust.scale *= 1f + Main.rand.Next(10) * 0.1f; + dust.velocity.Y -= 1f; + } + } + } + if (!rightFistAlive) + { + int lostRightFistDust = Dust.NewDust(new Vector2(npc.Center.X + 62f * npc.scale, npc.Center.Y - 9f), 8, 8, DustID.Smoke, 0f, 0f, 100, default, 1f); + Dust dust = Main.dust[lostRightFistDust]; + dust.alpha += Main.rand.Next(100); + dust.velocity *= 0.2f; + dust.velocity.Y -= 0.5f + Main.rand.Next(10) * 0.1f; + dust.fadeIn = 0.5f + Main.rand.Next(10) * 0.1f; + + if (Main.rand.NextBool(10)) + { + lostRightFistDust = Dust.NewDust(new Vector2(npc.Center.X + 62f * npc.scale, npc.Center.Y - 9f), 8, 8, DustID.Torch, 0f, 0f, 0, default, 1f); + if (!Main.rand.NextBool(20)) + { + Main.dust[lostRightFistDust].noGravity = true; + dust = Main.dust[lostRightFistDust]; + dust.scale *= 1f + Main.rand.Next(10) * 0.1f; + dust.velocity.Y -= 1f; + } + } + } + } + + if (npc.noTileCollide && !Main.player[npc.target].dead) + { + if (npc.velocity.Y > 0f && npc.Bottom.Y > Main.player[npc.target].Top.Y) + npc.noTileCollide = false; + else if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].Center, 1, 1) && !Collision.SolidCollision(npc.position, npc.width, npc.height)) + npc.noTileCollide = false; + } + + // Jump + if (npc.ai[0] == 0f) + { + if (npc.velocity.Y == 0f || npc.ai[2] > 0f) + { + // Avoid cheap bullshit + npc.damage = 0; + + // Laser fire when head is dead + if (Main.netMode != NetmodeID.MultiplayerClient && (!headAlive || turboEnrage || CalamityWorld.LegendaryMode) && npc.ai[2] == 0f) + { + npc.localAI[1] += 1f; + + float divisor = 15f - + (phase2 ? 4f : 0f) - + (phase3 ? 3f : 0f) - + (phase4 ? 2f : 0f); + + if (enrage) + divisor = 5f; + + if (turboEnrage && Main.getGoodWorld) + divisor = 2f; + + Vector2 projectileFirePos = new Vector2(npc.Center.X, npc.Center.Y - 60f); + if (npc.localAI[1] % divisor == 0f && (Vector2.Distance(Main.player[npc.target].Center, projectileFirePos) > 160f || !freeHeadAlive)) + { + float laserSpeed = turboEnrage ? 16f : enrage ? 12f : 6f; + float laserTargetXDist = Main.player[npc.target].Center.X - projectileFirePos.X; + float laserTargetYDist = Main.player[npc.target].Center.Y - projectileFirePos.Y; + float laserTargetDistance = (float)Math.Sqrt(laserTargetXDist * laserTargetXDist + laserTargetYDist * laserTargetYDist); + + laserTargetDistance = laserSpeed / laserTargetDistance; + laserTargetXDist *= laserTargetDistance; + laserTargetYDist *= laserTargetDistance; + + Vector2 laserVelocity = new Vector2(laserTargetXDist, laserTargetYDist); + int type = ProjectileID.EyeBeam; + int damage = npc.GetProjectileDamage(type); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int bodyLaser = Projectile.NewProjectile(npc.GetSource_FromAI(), projectileFirePos + laserVelocity.SafeNormalize(Vector2.UnitY) * 40f, laserVelocity, type, damage, 0f, Main.myPlayer); + Main.projectile[bodyLaser].timeLeft = enrage ? 720 : 360; + if (turboEnrage && Main.getGoodWorld) + Main.projectile[bodyLaser].extraUpdates += 1; + } + } + + if (npc.localAI[1] >= 15f) + npc.localAI[1] = 0f; + } + + // Delay before jumping + if (npc.ai[2] == 0f) + { + npc.velocity.X *= 0.8f; + npc.ai[1] += 1f; + } + + if (npc.ai[1] > 0f) + { + npc.ai[1] += (masterMode ? 2f : 1f); + if (Main.getGoodWorld) + npc.ai[1] += 100f; + + if (enrage || death) + { + npc.ai[1] += 18f; + } + else + { + if (!leftFistAlive) + npc.ai[1] += 6f; + if (!rightFistAlive) + npc.ai[1] += 6f; + if (!headAlive) + npc.ai[1] += 6f; + } + } + if (npc.ai[1] >= 300f) + { + npc.ai[1] = -20f; + npc.frameCounter = 0D; + } + else if (npc.ai[1] == -1f) + { + // Set jump velocity + npc.TargetClosest(); + + // Set damage + npc.damage = npc.defDamage; + + if (masterMode) + { + float straightUpJumpHeight = 640f; + if (npc.ai[3] == 0f) + npc.ai[3] = (!headAlive && npc.Bottom.Y - straightUpJumpHeight > Main.player[npc.target].Top.Y) ? Main.rand.Next(3) + 1f : (!leftFistAlive && !rightFistAlive) ? Main.rand.Next(2) + 1f : 1f; + + switch ((int)npc.ai[3]) + { + default: + case 0: + case 1: + NormalJump(); + break; + + // Jump directly above the target's head and slam down + case 2: + + npc.noTileCollide = true; + + npc.ai[2] += 1f; + float jumpVelocity = bossRush ? 30f : death ? 26f : 24f; + if (enrage) + jumpVelocity *= 1.25f; + if (turboEnrage) + jumpVelocity *= 1.5f; + + float minJumpTime = 15f; + float maxJumpTime = 45f; + if ((npc.ai[2] >= minJumpTime && Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) <= jumpVelocity) || npc.ai[2] >= maxJumpTime) + { + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.ai[2] = 1f; + npc.velocity.Y = -3f; + npc.netUpdate = true; + } + + Vector2 center = npc.Center; + if (!Main.player[npc.target].dead && Main.player[npc.target].active && Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) <= despawnDistance) + center = Main.player[npc.target].Center; + + center.Y -= 480f; + if (npc.velocity.Y == 0f) + { + npc.velocity = center - npc.Center; + npc.velocity = npc.velocity.SafeNormalize(Vector2.Zero); + npc.velocity *= jumpVelocity; + + float distanceBelowTarget = npc.position.Y - (Main.player[npc.target].position.Y + 80f); + float speedMult = 1f; + + float multiplier = turboEnrage ? 0.0025f : enrage ? 0.002f : 0.0015f; + if (distanceBelowTarget > 0f && ((!leftFistAlive && !rightFistAlive) || turboEnrage || CalamityWorld.LegendaryMode)) + speedMult += distanceBelowTarget * multiplier; + + float speedMultLimit = turboEnrage ? 3.5f : enrage ? 3f : 2.5f; + if (speedMult > speedMultLimit) + speedMult = speedMultLimit; + + if (Main.player[npc.target].position.Y < npc.Bottom.Y) + npc.velocity.Y *= speedMult; + } + else + npc.velocity.Y *= 0.95f; + + break; + + // Jump straight up and create a wall of lasers on both sides + case 3: + + npc.velocity.Y = (((!freeHeadAlive && !headAlive) || turboEnrage || CalamityWorld.LegendaryMode) ? -15.1f : -12.1f) + (enrage ? -4f : 0f); + + npc.noTileCollide = true; + + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.ai[2] = 2f; + + float jumpDuration = (float)Math.Floor(straightUpJumpHeight / Math.Abs(npc.velocity.Y)); + npc.ai[3] = jumpDuration; + + npc.netUpdate = true; + + break; + } + } + else + NormalJump(); + + void NormalJump() + { + float velocityBoost = death ? 6f * (1f - lifeRatio) : 4f * (1f - lifeRatio); + float velocityX = (masterMode ? 9f : 6f) + velocityBoost; + if (enrage) + velocityX *= 1.5f; + + float playerLocation = npc.Center.X - Main.player[npc.target].Center.X; + npc.direction = playerLocation < 0 ? 1 : -1; + calamityGlobalNPC.newAI[1] = npc.direction; + + npc.velocity.X = velocityX * npc.direction; + + float distanceBelowTarget = npc.position.Y - (Main.player[npc.target].position.Y + 80f); + float speedMult = 1f; + + float multiplier = turboEnrage ? 0.0025f : enrage ? 0.002f : 0.0015f; + if (distanceBelowTarget > 0f && ((!leftFistAlive && !rightFistAlive) || turboEnrage || CalamityWorld.LegendaryMode)) + speedMult += distanceBelowTarget * multiplier; + + float speedMultLimit = turboEnrage ? 3.5f : enrage ? 3f : 2.5f; + if (speedMult > speedMultLimit) + speedMult = speedMultLimit; + + if (Main.player[npc.target].position.Y < npc.Bottom.Y) + npc.velocity.Y = ((((!freeHeadAlive && !headAlive) || turboEnrage || CalamityWorld.LegendaryMode) ? -15.1f : -12.1f) + (enrage ? -4f : 0f)) * speedMult; + else + npc.velocity.Y = 1f; + + npc.noTileCollide = true; + + npc.ai[0] = 1f; + npc.ai[1] = 0f; + + npc.netUpdate = true; + npc.SyncExtraAI(); + } + } + } + + // Don't run custom gravity when starting a jump + if (npc.ai[0] != 1f && npc.ai[2] == 0f) + CustomGravity(false); + } + + // Fall down + else if (npc.ai[0] == 1f) + { + if (npc.velocity.Y == 0f) + { + // Avoid cheap bullshit + npc.damage = 0; + + npc.TargetClosest(); + + // Play sound + SoundEngine.PlaySound(SoundID.Item14, npc.Center); + + npc.ai[0] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + calamityGlobalNPC.newAI[1] = 0f; + npc.SyncExtraAI(); + + // Dust and gore + for (int i = (int)npc.position.X - 20; i < (int)npc.position.X + npc.width + 40; i += 20) + { + for (int j = 0; j < 4; j++) + { + int fallDust = Dust.NewDust(new Vector2(npc.position.X - 20f, npc.position.Y + npc.height), npc.width + 20, 4, DustID.Smoke, 0f, 0f, 100, default, 1.5f); + Dust dust = Main.dust[fallDust]; + dust.velocity *= 0.2f; + } + if (Main.netMode != NetmodeID.Server) + { + int fallGore = Gore.NewGore(npc.GetSource_FromAI(), new Vector2(i - 20, npc.position.Y + npc.height - 8f), default, Main.rand.Next(61, 64), 1f); + Gore gore = Main.gore[fallGore]; + gore.velocity *= 0.4f; + } + } + + // Fireball explosion when head is detached + if (Main.netMode != NetmodeID.MultiplayerClient && (!headAlive || turboEnrage || CalamityWorld.LegendaryMode)) + { + for (int i = 0; i < 10; i++) + { + int fiery = Dust.NewDust(npc.position, npc.width, npc.height, DustID.Torch, 0f, 0f, 100, default, 2f); + Main.dust[fiery].velocity.Y *= 6f; + Main.dust[fiery].velocity.X *= 3f; + if (Main.rand.NextBool()) + { + Main.dust[fiery].scale = 0.5f; + Main.dust[fiery].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + } + } + for (int j = 0; j < 20; j++) + { + int fiery2 = Dust.NewDust(npc.position, npc.width, npc.height, DustID.Torch, 0f, 0f, 100, default, 3f); + Main.dust[fiery2].noGravity = true; + Main.dust[fiery2].velocity.Y *= 10f; + fiery2 = Dust.NewDust(npc.position, npc.width, npc.height, DustID.Torch, 0f, 0f, 100, default, 2f); + Main.dust[fiery2].velocity.X *= 2f; + } + + int totalFireballs = masterMode ? 7 : 5; + if (turboEnrage && Main.getGoodWorld) + totalFireballs *= 2; + + int spawnX = npc.width / 2; + for (int i = 0; i < totalFireballs; i++) + { + Vector2 spawnVector = new Vector2(npc.Center.X + Main.rand.Next(-spawnX, spawnX), npc.Center.Y + npc.height / 2 * 0.8f); + Vector2 velocity = new Vector2(Main.rand.NextBool() ? Main.rand.NextFloat(masterMode ? 7.5f : 6f, masterMode ? 10.5f : 9f) : Main.rand.NextFloat(masterMode ? -9.5f : -8f, masterMode ? -6.5f : -5f), Main.rand.NextFloat(-1.5f, 1.5f)); + + if (death) + velocity *= 1.25f; + + if (enrage) + velocity *= 1.5f; + + if (turboEnrage) + velocity *= 1.25f; + + int type = ProjectileID.Fireball; + int damage = npc.GetProjectileDamage(type); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), spawnVector, velocity, type, damage, 0f, Main.myPlayer); + Main.projectile[proj].timeLeft = enrage ? 480 : 240; + if (turboEnrage && Main.getGoodWorld) + Main.projectile[proj].extraUpdates += 1; + } + + npc.netUpdate = true; + } + } + else + { + // Set damage + npc.damage = npc.defDamage; + + // Velocity when falling + if (npc.ai[2] == 2f) + { + // Do not collide with tiles while doing this crazy shit + npc.noTileCollide = true; + + float laserShootGateValue = death ? 6f : 9f; + if (npc.ai[3] % laserShootGateValue == 0f) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Vector2 fireFrom = new Vector2(npc.Center.X, npc.Center.Y - 60f); + int projectileAmt = 2; + int type = ProjectileID.EyeBeam; + int damage = npc.GetProjectileDamage(type); + Vector2 laserVelocity = Vector2.UnitY * npc.velocity.Y * (turboEnrage ? 2f : enrage ? 1f : 0.5f); + for (int i = 0; i < projectileAmt; i++) + { + int totalProjectiles = 2; + float radians = MathHelper.TwoPi / totalProjectiles; + for (int j = 0; j < totalProjectiles; j++) + { + Vector2 projVelocity = laserVelocity.RotatedBy(radians * j + MathHelper.PiOver2); + int bodyLaser = Projectile.NewProjectile(npc.GetSource_FromAI(), fireFrom, projVelocity, type, damage, 0f, Main.myPlayer); + Main.projectile[bodyLaser].timeLeft = enrage ? 720 : 360; + if (turboEnrage && Main.getGoodWorld) + Main.projectile[bodyLaser].extraUpdates += 1; + } + } + } + } + + npc.ai[3] -= 1f; + if (npc.ai[3] <= 0f) + { + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.netUpdate = true; + npc.netSpam = 0; + } + } + else + { + if ((npc.position.X < Main.player[npc.target].position.X && npc.position.X + npc.width > Main.player[npc.target].position.X + Main.player[npc.target].width) || npc.ai[2] == 1f) + { + npc.velocity.X *= npc.ai[2] == 1f ? 0.5f : 0.8f; + + if (npc.Bottom.Y < Main.player[npc.target].position.Y || npc.ai[2] == 1f) + { + float fallSpeedBoost = death ? 1.2f * (1f - lifeRatio) : 0.8f * (1f - lifeRatio); + float fallSpeed = (masterMode ? 0.3f : 0.2f) + fallSpeedBoost; + if (enrage) + fallSpeed *= 2f; + + npc.velocity.Y += fallSpeed; + } + } + else + { + float velocityChangeBoost = death ? 0.18f * (1f - lifeRatio) : 0.12f * (1f - lifeRatio); + float velocityXChange = (masterMode ? 0.3f : 0.2f) + velocityChangeBoost; + if (npc.direction < 0) + npc.velocity.X -= velocityXChange; + else if (npc.direction > 0) + npc.velocity.X += velocityXChange; + + float velocityBoost = death ? 6f * (1f - lifeRatio) : 4f * (1f - lifeRatio); + float velocityXCap = (masterMode ? 9f : 6f) + velocityBoost; + if (enrage) + velocityXCap *= 3f; + + float playerLocation = npc.Center.X - Main.player[npc.target].Center.X; + int directionRelativeToTarget = playerLocation < 0 ? 1 : -1; + bool slowDown = directionRelativeToTarget != calamityGlobalNPC.newAI[1]; + + if (slowDown) + velocityXCap *= (enrage ? 0.2f : 0.5f); + + if (npc.velocity.X < -velocityXCap) + npc.velocity.X = -velocityXCap; + if (npc.velocity.X > velocityXCap) + npc.velocity.X = velocityXCap; + } + + CustomGravity(npc.ai[2] == 1f); + } + } + } + + void CustomGravity(bool isSlamming) + { + float gravity = turboEnrage ? (Main.getGoodWorld ? 1.2f : 0.9f) : enrage ? 0.75f : (!leftFistAlive && !rightFistAlive) ? 0.45f : 0.3f; + float maxFallSpeed = reduceFallSpeed ? 12f : turboEnrage ? (Main.getGoodWorld ? 40f : 30f) : enrage ? 25f : (!leftFistAlive && !rightFistAlive) ? 15f : 10f; + if (isSlamming && !reduceFallSpeed) + { + gravity *= 4f; + maxFallSpeed *= 2f; + } + + npc.velocity.Y += gravity; + if (npc.velocity.Y > maxFallSpeed) + npc.velocity.Y = maxFallSpeed; + } + + // Despawn + if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) + Math.Abs(npc.Center.Y - Main.player[npc.target].Center.Y) > despawnDistance) + { + npc.TargetClosest(); + + if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) + Math.Abs(npc.Center.Y - Main.player[npc.target].Center.Y) > despawnDistance) + { + npc.active = false; + npc.netUpdate = true; + } + } + + return false; + } + + public static bool BuffedGolemFistAI(NPC npc, Mod mod) + { + if (NPC.golemBoss < 0) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + npc.StrikeInstantKill(); + + return false; + } + + if (npc.alpha > 0) + { + npc.alpha -= 10; + if (npc.alpha < 0) + npc.alpha = 0; + } + + // Get a target + if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) + npc.TargetClosest(); + + NPC golem = Main.npc[NPC.golemBoss]; + Player player = Main.player[npc.target]; + + bool bossRush = BossRushEvent.BossRushActive; + bool masterMode = Main.masterMode || bossRush; + bool death = CalamityWorld.death || bossRush; + + // Enrage if the target isn't inside the temple + // Turbo enrage if target isn't inside the temple and it's Boss Rush or For the Worthy + bool enrage = true; + bool turboEnrage = false; + if (player.Center.Y > Main.worldSurface * 16.0) + { + int targetTilePosX = (int)player.Center.X / 16; + int targetTilePosY = (int)player.Center.Y / 16; + + Tile tile = Framing.GetTileSafely(targetTilePosX, targetTilePosY); + if (tile.WallType == WallID.LihzahrdBrickUnsafe) + enrage = false; + else + turboEnrage = bossRush || Main.getGoodWorld; + } + else + turboEnrage = bossRush || Main.getGoodWorld; + + if (bossRush || Main.getGoodWorld) + enrage = true; + + float aggression = turboEnrage ? (Main.getGoodWorld ? 4f : 3f) : enrage ? 2f : death ? (masterMode ? 1.7f : 1.5f) : (masterMode ? 1.4f : 1f); + + Vector2 fistCenter = golem.Center + golem.velocity + new Vector2(0f, -9f * npc.scale); + fistCenter.X += (float)((npc.type == NPCID.GolemFistLeft) ? -84 : 78) * npc.scale; + Vector2 distanceFromFistCenter = fistCenter - npc.Center; + float distanceFromRestPosition = distanceFromFistCenter.Length(); + if (npc.ai[0] == 0f) + { + // Avoid cheap bullshit + npc.damage = 0; + + npc.noTileCollide = true; + + float fistSpeed = 28f; + fistSpeed *= (aggression + 3f) / 4f; + if (fistSpeed > 48f) + fistSpeed = 48f; + + float fistRestDistance = distanceFromRestPosition; + if (fistRestDistance < 12f + fistSpeed) + { + npc.rotation = 0f; + npc.velocity.X = distanceFromFistCenter.X; + npc.velocity.Y = distanceFromFistCenter.Y; + + bool canPunch = npc.alpha == 0 && (npc.type == NPCID.GolemFistLeft && npc.Center.X + 100f > player.Center.X) || (npc.type == NPCID.GolemFistRight && npc.Center.X - 100f < player.Center.X); + if (canPunch) + { + float fistShootSpeed = masterMode ? Main.rand.NextFloat(aggression * 0.5f, aggression * 2f) : aggression; + npc.ai[1] += fistShootSpeed; + if (npc.life < npc.lifeMax / 2) + npc.ai[1] += fistShootSpeed; + if (npc.life < npc.lifeMax / 4) + npc.ai[1] += fistShootSpeed; + } + + float fistPunchGateValue = masterMode ? 120f : 40f; + if (npc.ai[1] >= fistPunchGateValue) + { + npc.TargetClosest(); + + if (canPunch) + { + npc.ai[1] = 0f; + npc.ai[0] = 1f; + } + else + npc.ai[1] = 0f; + + // Net update in Master due to rng + if (masterMode) + { + npc.netUpdate = true; + npc.netSpam = 0; + } + } + } + else + { + fistRestDistance = fistSpeed / fistRestDistance; + npc.velocity.X = distanceFromFistCenter.X * fistRestDistance; + npc.velocity.Y = distanceFromFistCenter.Y * fistRestDistance; + + npc.rotation = (float)Math.Atan2(-npc.velocity.Y, -npc.velocity.X); + if (npc.type == NPCID.GolemFistLeft) + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); + } + } + else if (npc.ai[0] == 1f) + { + // Avoid cheap bullshit + npc.damage = 0; + + npc.ai[1] += 1f; + npc.Center = fistCenter; + npc.rotation = 0f; + npc.velocity = Vector2.Zero; + if (npc.ai[1] <= 15f) + { + for (int i = 0; i < 1; i++) + { + Vector2 largeRandDustRadius = Main.rand.NextVector2Circular(80f, 80f); + Vector2 largeRandDustRecoil = largeRandDustRadius * -1f * 0.05f; + Vector2 smallRandDustRadius = Main.rand.NextVector2Circular(20f, 20f); + Dust dust = Dust.NewDustPerfect(npc.Center + largeRandDustRecoil + largeRandDustRadius + smallRandDustRadius, 228, largeRandDustRecoil); + dust.fadeIn = 1.5f; + dust.scale = 0.5f; + if (Main.getGoodWorld) + dust.noLight = true; + + dust.noGravity = true; + } + } + + if (npc.ai[1] >= 30f) + { + // Set damage + npc.damage = npc.defDamage; + + npc.noTileCollide = true; + npc.collideX = false; + npc.collideY = false; + + float fistReturnSpeed = 24f; + fistReturnSpeed *= (aggression + 3f) / 4f; + if (fistReturnSpeed > 48f) + fistReturnSpeed = 48f; + + Vector2 fistCent = npc.Center; + float fistTargetXDist = player.Center.X - fistCent.X; + float fistTargetYDist = player.Center.Y - fistCent.Y; + float fistTargetDistance = (float)Math.Sqrt(fistTargetXDist * fistTargetXDist + fistTargetYDist * fistTargetYDist); + fistTargetDistance = fistReturnSpeed / fistTargetDistance; + npc.velocity.X = fistTargetXDist * fistTargetDistance; + npc.velocity.Y = fistTargetYDist * fistTargetDistance; + npc.ai[0] = 2f; + npc.ai[1] = 0f; + + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); + if (npc.type == NPCID.GolemFistLeft) + npc.rotation = (float)Math.Atan2(-npc.velocity.Y, -npc.velocity.X); + } + } + else if (npc.ai[0] == 2f) + { + // Set damage + npc.damage = npc.defDamage; + + if (Main.netMode != NetmodeID.MultiplayerClient && Main.getGoodWorld) + { + for (int j = (int)(npc.position.X / 16f) - 1; (float)j < (npc.position.X + (float)npc.width) / 16f + 1f; j++) + { + for (int k = (int)(npc.position.Y / 16f) - 1; (float)k < (npc.position.Y + (float)npc.width) / 16f + 1f; k++) + { + if (Main.tile[j, k].TileType == TileID.Torches) + { + Main.tile[j, k].Get().HasTile = false; + if (Main.netMode == NetmodeID.Server) + NetMessage.SendTileSquare(-1, j, k); + } + } + } + } + + npc.ai[1] += 1f; + if (npc.ai[1] == 1f) + SoundEngine.PlaySound(SoundID.Item14, npc.Center); + + if (Main.rand.NextBool()) + { + Vector2 halfVelocityDust = npc.velocity * 0.5f; + Vector2 randDustRadius = Main.rand.NextVector2Circular(20f, 20f); + Dust.NewDustPerfect(npc.Center + halfVelocityDust + randDustRadius, 306, halfVelocityDust, 0, Main.OurFavoriteColor).scale = 2f; + } + + if (Math.Abs(npc.velocity.X) > Math.Abs(npc.velocity.Y)) + { + if (npc.velocity.X > 0f && npc.Center.X > player.Center.X) + npc.noTileCollide = false; + + if (npc.velocity.X < 0f && npc.Center.X < player.Center.X) + npc.noTileCollide = false; + } + else + { + if (npc.velocity.Y > 0f && npc.Center.Y > player.Center.Y) + npc.noTileCollide = false; + + if (npc.velocity.Y < 0f && npc.Center.Y < player.Center.Y) + npc.noTileCollide = false; + } + + float maxPunchDistance = 700f; + int explosionLimit = 2; + if (masterMode) + { + if (npc.life < npc.lifeMax / 2) + { + maxPunchDistance += MathHelper.Lerp(-175f, 75f, Main.rand.NextFloat()); + explosionLimit++; + } + if (npc.life < npc.lifeMax / 4) + { + maxPunchDistance += MathHelper.Lerp(-175f, 75f, Main.rand.NextFloat()); + explosionLimit++; + } + } + + if (distanceFromRestPosition > maxPunchDistance || npc.collideX || npc.collideY) + { + // Avoid cheap bullshit + npc.damage = 0; + + npc.noTileCollide = true; + npc.ai[0] = 0f; + + if (masterMode) + { + int type = ProjectileID.InfernoHostileBlast; + bool shootExplosion = true; + int numExplosions = 0; + for (int i = 0; i < Main.maxProjectiles; i++) + { + if (Main.projectile[i].active && Main.projectile[i].type == type) + { + numExplosions++; + if (numExplosions >= explosionLimit) + { + shootExplosion = false; + break; + } + } + } + + if (shootExplosion) + { + int damage = npc.GetProjectileDamage(type); + if (Main.netMode != NetmodeID.MultiplayerClient) + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, Vector2.Zero, type, damage, 0f, Main.myPlayer, 0f, 0f, 1f); + } + } + } + } + else + { + if (npc.ai[0] != 3f) + return false; + + // Set damage + npc.damage = npc.defDamage; + + npc.noTileCollide = true; + float fistAcceleration = 0.4f; + Vector2 returningFistCenter = npc.Center; + float returningTargetX = player.Center.X - returningFistCenter.X; + float returningTargetY = player.Center.Y - returningFistCenter.Y; + float returningTargetDist = (float)Math.Sqrt(returningTargetX * returningTargetX + returningTargetY * returningTargetY); + returningTargetDist = 12f / returningTargetDist; + returningTargetX *= returningTargetDist; + returningTargetY *= returningTargetDist; + + if (npc.velocity.X < returningTargetX) + { + npc.velocity.X += fistAcceleration; + if (npc.velocity.X < 0f && returningTargetX > 0f) + npc.velocity.X += fistAcceleration * 2f; + } + else if (npc.velocity.X > returningTargetX) + { + npc.velocity.X -= fistAcceleration; + if (npc.velocity.X > 0f && returningTargetX < 0f) + npc.velocity.X -= fistAcceleration * 2f; + } + + if (npc.velocity.Y < returningTargetY) + { + npc.velocity.Y += fistAcceleration; + if (npc.velocity.Y < 0f && returningTargetY > 0f) + npc.velocity.Y += fistAcceleration * 2f; + } + else if (npc.velocity.Y > returningTargetY) + { + npc.velocity.Y -= fistAcceleration; + if (npc.velocity.Y > 0f && returningTargetY < 0f) + npc.velocity.Y -= fistAcceleration * 2f; + } + + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); + if (npc.type == NPCID.GolemFistLeft) + npc.rotation = (float)Math.Atan2(-npc.velocity.Y, -npc.velocity.X); + } + + return false; + } + + public static bool BuffedGolemHeadAI(NPC npc, Mod mod) + { + // Don't collide + npc.noTileCollide = true; + + // Get a target + 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(); + + // Die if body is gone + if (NPC.golemBoss < 0) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + npc.StrikeInstantKill(); + + return false; + } + + // Percent life remaining + float lifeRatio = npc.life / (float)npc.lifeMax; + + bool bossRush = BossRushEvent.BossRushActive; + bool masterMode = Main.masterMode || bossRush; + bool death = CalamityWorld.death || bossRush; + + // Count body parts + bool leftFistAlive = NPC.AnyNPCs(NPCID.GolemFistLeft); + bool rightFistAlive = NPC.AnyNPCs(NPCID.GolemFistRight); + npc.dontTakeDamage = (leftFistAlive || rightFistAlive) && !CalamityWorld.LegendaryMode; + + // Stay in position on top of body + npc.Center = Main.npc[NPC.golemBoss].Center - new Vector2(3f, 57f) * npc.scale; + + // Enrage if the target isn't inside the temple + bool enrage = true; + bool turboEnrage = false; + if (Main.player[npc.target].Center.Y > Main.worldSurface * 16.0) + { + int targetTilePosX = (int)Main.player[npc.target].Center.X / 16; + int targetTilePosY = (int)Main.player[npc.target].Center.Y / 16; + + Tile tile = Framing.GetTileSafely(targetTilePosX, targetTilePosY); + if (tile.WallType == WallID.LihzahrdBrickUnsafe) + enrage = false; + else + turboEnrage = bossRush || Main.getGoodWorld; + } + else + turboEnrage = bossRush || Main.getGoodWorld; + + if (bossRush || Main.getGoodWorld) + enrage = true; + + // Alpha + if (npc.alpha > 0) + { + npc.alpha -= 10; + if (npc.alpha < 0) + npc.alpha = 0; + + npc.ai[1] = 30f; + } + + // Spit fireballs if arms are alive + if (npc.ai[0] == 0f) + { + npc.ai[1] += 1f; + float openMouthGateValue = (!rightFistAlive || !leftFistAlive) ? 10f : 20f; + float shootFireballGateValue = (!rightFistAlive || !leftFistAlive) ? 60f : 120f; + if (npc.ai[1] < openMouthGateValue || npc.ai[1] > shootFireballGateValue - openMouthGateValue) + npc.localAI[0] = 1f; + else + npc.localAI[0] = 0f; + + if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[1] >= shootFireballGateValue) + { + npc.TargetClosest(); + + npc.ai[1] = 0f; + + Vector2 headCent = new Vector2(npc.Center.X, npc.Center.Y + 10f * npc.scale); + float headFireballSpeed = turboEnrage ? 24f : enrage ? 18f : 9f; + float headFireballTargetX = Main.player[npc.target].Center.X - headCent.X; + float headFireballTargetY = Main.player[npc.target].Center.Y - headCent.Y; + float headFireballTargetDist = (float)Math.Sqrt(headFireballTargetX * headFireballTargetX + headFireballTargetY * headFireballTargetY); + + headFireballTargetDist = headFireballSpeed / headFireballTargetDist; + headFireballTargetX *= headFireballTargetDist; + headFireballTargetY *= headFireballTargetDist; + + int type = ProjectileID.Fireball; + int damage = npc.GetProjectileDamage(type); + + int fireballAmount = masterMode ? 2 : 1; + Vector2 fireballVelocity = new Vector2(headFireballTargetX, headFireballTargetY); + for (int i = 0; i < fireballAmount; i++) + Projectile.NewProjectile(npc.GetSource_FromAI(), headCent, fireballVelocity * (1f / (i + 1)), type, damage, 0f, Main.myPlayer); + + npc.netUpdate = true; + } + } + + // Shoot lasers and fireballs if arms are dead + else if (npc.ai[0] == 1f) + { + // Fire projectiles from eye positions + Vector2 projectileFirePos = new Vector2(npc.Center.X, npc.Center.Y + 10f * npc.scale); + if (Main.player[npc.target].Center.X < npc.Center.X - npc.width) + { + npc.localAI[1] = -1f; + projectileFirePos.X -= 40f * npc.scale; + } + else if (Main.player[npc.target].Center.X > npc.Center.X + npc.width) + { + npc.localAI[1] = 1f; + projectileFirePos.X += 40f * npc.scale; + } + else + npc.localAI[1] = 0f; + + // Fireballs + npc.ai[1] += 1f; + float openMouthGateValue = 20f - (death ? 15f * (1f - lifeRatio) : 10f * (1f - lifeRatio)); + float shootFireballGateValue = 120f - (death ? 90f * (1f - lifeRatio) : 60f * (1f - lifeRatio)); + if (npc.ai[1] < openMouthGateValue || npc.ai[1] > shootFireballGateValue - openMouthGateValue) + npc.localAI[0] = 1f; + else + npc.localAI[0] = 0f; + + if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[1] >= shootFireballGateValue) + { + npc.TargetClosest(); + + npc.ai[1] = 0f; + + float fireballSpeedFistsDed = turboEnrage ? 32f : enrage ? 24f : 12f; + float fireballFistsDedTargetX = Main.player[npc.target].Center.X - projectileFirePos.X; + float fireballFistsDedTargetY = Main.player[npc.target].Center.Y - projectileFirePos.Y; + float fireballFistsDedTargetDist = (float)Math.Sqrt(fireballFistsDedTargetX * fireballFistsDedTargetX + fireballFistsDedTargetY * fireballFistsDedTargetY); + + fireballFistsDedTargetDist = fireballSpeedFistsDed / fireballFistsDedTargetDist; + fireballFistsDedTargetX *= fireballFistsDedTargetDist; + fireballFistsDedTargetY *= fireballFistsDedTargetDist; + + int type = ProjectileID.Fireball; + int damage = npc.GetProjectileDamage(type); + + int fireballAmount = masterMode ? 3 : 1; + Vector2 fireballVelocity = new Vector2(fireballFistsDedTargetX, fireballFistsDedTargetY); + for (int i = 0; i < fireballAmount; i++) + { + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), projectileFirePos, fireballVelocity * (1f / (i + 1)), type, damage, 0f, Main.myPlayer); + Main.projectile[proj].timeLeft = 450; + } + + npc.netUpdate = true; + } + + // Lasers + float shootBoost2 = death ? 5f * (1f - lifeRatio) : 3f * (1f - lifeRatio); + npc.ai[2] += 1f + shootBoost2; + if (enrage) + npc.ai[2] += 4f; + + if (npc.ai[2] >= 300f) + { + npc.TargetClosest(); + + npc.ai[2] = 0f; + + int projType = ProjectileID.EyeBeam; + int dmg = npc.GetProjectileDamage(projType); + + if (npc.localAI[1] == 0f) + { + for (int i = 0; i < 2; i++) + { + projectileFirePos = new Vector2(npc.Center.X, npc.Center.Y - 22f * npc.scale); + if (i == 0) + projectileFirePos.X -= 18f * npc.scale; + else + projectileFirePos.X += 18f * npc.scale; + + float laserSpeed = masterMode ? 15f : 12f; + float laserTargetXDist = Main.player[npc.target].Center.X - projectileFirePos.X; + float laserTargetYDist = Main.player[npc.target].Center.Y - projectileFirePos.Y; + float laserTargetDistance = (float)Math.Sqrt(laserTargetXDist * laserTargetXDist + laserTargetYDist * laserTargetYDist); + + laserTargetDistance = laserSpeed / laserTargetDistance; + laserTargetXDist *= laserTargetDistance; + laserTargetYDist *= laserTargetDistance; + + Vector2 laserVelocity = new Vector2(laserTargetXDist, laserTargetYDist); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int bodyLaser = Projectile.NewProjectile(npc.GetSource_FromAI(), projectileFirePos + laserVelocity.SafeNormalize(Vector2.UnitY) * 40f, laserVelocity, projType, dmg, 0f, Main.myPlayer); + Main.projectile[bodyLaser].timeLeft = enrage ? 600 : 300; + if (turboEnrage && Main.getGoodWorld) + Main.projectile[bodyLaser].extraUpdates += 1; + + npc.netUpdate = true; + } + } + } + else if (npc.localAI[1] != 0f) + { + projectileFirePos = new Vector2(npc.Center.X, npc.Center.Y - 22f * npc.scale); + if (npc.localAI[1] == -1f) + projectileFirePos.X -= 30f * npc.scale; + else if (npc.localAI[1] == 1f) + projectileFirePos.X += 30f * npc.scale; + + float extraLaserSpeed = masterMode ? 15f : 12f; + float extraLaserTargetX = Main.player[npc.target].Center.X - projectileFirePos.X; + float extraLaserTargetY = Main.player[npc.target].Center.Y - projectileFirePos.Y; + float extraLaserTargetDist = (float)Math.Sqrt(extraLaserTargetX * extraLaserTargetX + extraLaserTargetY * extraLaserTargetY); + + extraLaserTargetDist = extraLaserSpeed / extraLaserTargetDist; + extraLaserTargetX *= extraLaserTargetDist; + extraLaserTargetY *= extraLaserTargetDist; + + Vector2 laserVelocity = new Vector2(extraLaserTargetX, extraLaserTargetY); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int extraLasers = Projectile.NewProjectile(npc.GetSource_FromAI(), projectileFirePos + laserVelocity.SafeNormalize(Vector2.UnitY) * 40f, laserVelocity, projType, dmg, 0f, Main.myPlayer); + Main.projectile[extraLasers].timeLeft = enrage ? 600 : 300; + if (turboEnrage && Main.getGoodWorld) + Main.projectile[extraLasers].extraUpdates += 1; + + npc.netUpdate = true; + } + } + } + } + + // Laser fire if arms are dead + if ((!leftFistAlive && !rightFistAlive) || death || CalamityWorld.LegendaryMode) + { + npc.ai[0] = 1f; + return false; + } + npc.ai[0] = 0f; + + return false; + } + + public static bool BuffedGolemHeadFreeAI(NPC npc, Mod mod) + { + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + + // Get a target + 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(); + + // Die if body is gone + if (NPC.golemBoss < 0) + { + calamityGlobalNPC.DR = 0.25f; + calamityGlobalNPC.unbreakableDR = false; + calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = false; + + if (Main.netMode != NetmodeID.MultiplayerClient) + npc.StrikeInstantKill(); + + return false; + } + + // Percent life remaining + float lifeRatio = npc.life / (float)npc.lifeMax; + float golemLifeRatio = Main.npc[NPC.golemBoss].life / (float)Main.npc[NPC.golemBoss].lifeMax; + + // Phases + bool bossRush = BossRushEvent.BossRushActive; + bool masterMode = Main.masterMode || bossRush; + bool death = CalamityWorld.death || bossRush; + bool phase2 = lifeRatio < 0.7f || golemLifeRatio < 0.85f || masterMode; + bool phase3 = lifeRatio < 0.55f || golemLifeRatio < 0.7f || masterMode; + bool phase4 = lifeRatio < 0.4f || golemLifeRatio < 0.55f || masterMode; + + // Enrage if the target isn't inside the temple + bool enrage = true; + bool turboEnrage = false; + if (Main.player[npc.target].Center.Y > Main.worldSurface * 16.0) + { + int targetTilePosX = (int)Main.player[npc.target].Center.X / 16; + int targetTilePosY = (int)Main.player[npc.target].Center.Y / 16; + + Tile tile = Framing.GetTileSafely(targetTilePosX, targetTilePosY); + if (tile.WallType == WallID.LihzahrdBrickUnsafe) + enrage = false; + else + turboEnrage = bossRush || Main.getGoodWorld; + } + else + turboEnrage = bossRush || Main.getGoodWorld; + + if (bossRush || Main.getGoodWorld) + enrage = true; + + if (turboEnrage) + { + calamityGlobalNPC.DR = 0.9999f; + calamityGlobalNPC.unbreakableDR = true; + calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = true; + } + + // Float through tiles or not + bool canPassThroughTiles = false; + if (!Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1) || phase3 || turboEnrage) + { + npc.noTileCollide = true; + canPassThroughTiles = true; + } + else + npc.noTileCollide = false; + + // Move to new location + if (npc.ai[3] <= 0f) + { + npc.ai[3] = 400f; + + float maxDistance = 400f; + + // Four corners around target + if (phase3 || turboEnrage) + { + if (calamityGlobalNPC.newAI[1] == -maxDistance) + { + switch ((int)calamityGlobalNPC.newAI[0]) + { + case 0: + case 400: + calamityGlobalNPC.newAI[0] = -maxDistance; + break; + case -400: + calamityGlobalNPC.newAI[1] = maxDistance; + break; + default: + break; + } + } + else + { + switch ((int)calamityGlobalNPC.newAI[0]) + { + case 0: + case -400: + calamityGlobalNPC.newAI[0] = maxDistance; + break; + case 400: + calamityGlobalNPC.newAI[1] = -maxDistance; + break; + default: + break; + } + } + } + + // Above target + else if (phase2) + { + switch ((int)calamityGlobalNPC.newAI[0]) + { + case 0: + calamityGlobalNPC.newAI[0] = maxDistance; + break; + case 400: + calamityGlobalNPC.newAI[0] = -maxDistance; + break; + case -400: + calamityGlobalNPC.newAI[0] = 0f; + break; + default: + break; + } + } + else + { + calamityGlobalNPC.newAI[0] = 0f; + calamityGlobalNPC.newAI[1] = -maxDistance; + } + + npc.netSpam = 5; + npc.SyncExtraAI(); + npc.netUpdate = true; + } + + npc.ai[3] -= 1f + + ((phase2 || turboEnrage) ? 1f : 0f) + + ((phase3 || turboEnrage) ? 1f : 0f) + + ((phase4 || turboEnrage) ? 2f : 0f); + + float offsetX = calamityGlobalNPC.newAI[0]; + float offsetY = calamityGlobalNPC.newAI[1]; + Vector2 destination = Main.player[npc.target].Center + new Vector2(offsetX, offsetY); + + // Velocity and acceleration + float velocity = 16f + + ((phase2 || turboEnrage) ? 8f : 0f) + + ((phase3 || turboEnrage) ? 8f : 0f); + + if (enrage) + velocity = (phase3 || turboEnrage) ? 40f : 32f; + + float acceleration = phase3 ? 0f : turboEnrage ? 6f : enrage ? 4.8f : phase2 ? 1.2f : 0.8f; + + // How far Golem's Head is from where it's supposed to be + Vector2 distanceFromDestination = destination - npc.Center; + + // Whether Golem can fire projectiles + bool canFireProjectiles = distanceFromDestination.Length() < 120f || enrage; + + CalamityUtils.SmoothMovement(npc, 80f, distanceFromDestination, velocity, acceleration, !phase3); + + if (death && calamityGlobalNPC.newAI[2] < 120f) + { + calamityGlobalNPC.newAI[2] += 1f; + + if (calamityGlobalNPC.newAI[2] % 15f == 0f) + { + npc.netUpdate = true; + npc.SyncExtraAI(); + } + + return false; + } + + // Fireballs + if (canFireProjectiles) + npc.ai[1] += 1f; + + float combinedLifeRatio = (lifeRatio + golemLifeRatio) * 0.5f; + float openMouthGateValue = 20f - (death ? 15f * (1f - combinedLifeRatio) : 10f * (1f - combinedLifeRatio)); + float shootFireballGateValue = 240f - (death ? 180f * (1f - combinedLifeRatio) : 120f * (1f - combinedLifeRatio)); + if (npc.ai[1] < openMouthGateValue || npc.ai[1] > shootFireballGateValue - openMouthGateValue) + npc.localAI[0] = 1f; + else + npc.localAI[0] = 0f; + + if (canPassThroughTiles && !phase3) + npc.ai[1] = openMouthGateValue; + + if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[1] >= shootFireballGateValue) + { + npc.TargetClosest(); + + npc.ai[1] = 0f; + + Vector2 freeHeadCenter = new Vector2(npc.Center.X, npc.Center.Y + 20f * npc.scale); + float freeHeadSpeed = turboEnrage ? 24f : enrage ? 18f : 6f; + if (masterMode) + freeHeadSpeed *= 1.25f; + + float freeHeadTargetX = Main.player[npc.target].Center.X - freeHeadCenter.X; + float freeHeadTargetY = Main.player[npc.target].Center.Y - freeHeadCenter.Y; + float freeHeadTargetDist = (float)Math.Sqrt(freeHeadTargetX * freeHeadTargetX + freeHeadTargetY * freeHeadTargetY); + + freeHeadTargetDist = freeHeadSpeed / freeHeadTargetDist; + freeHeadTargetX *= freeHeadTargetDist; + freeHeadTargetY *= freeHeadTargetDist; + + int projectileType = (phase3 || masterMode) ? ProjectileID.InfernoHostileBolt : ProjectileID.Fireball; + int damage = npc.GetProjectileDamage(projectileType); + float ai0 = projectileType == ProjectileID.InfernoHostileBolt ? Main.player[npc.target].Center.X : 0f; + float ai1 = projectileType == ProjectileID.InfernoHostileBolt ? Main.player[npc.target].Center.Y : 0f; + float ai2 = projectileType == ProjectileID.InfernoHostileBolt ? 1f : 0f; + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), freeHeadCenter.X, freeHeadCenter.Y, freeHeadTargetX, freeHeadTargetY, projectileType, damage, 0f, Main.myPlayer, ai0, ai1, ai2); + if (projectileType == ProjectileID.InfernoHostileBolt) + { + Main.projectile[proj].timeLeft = 300; + Main.projectile[proj].netUpdate = true; + } + else + Main.projectile[proj].timeLeft = 450; + + npc.netUpdate = true; + } + + // Lasers + if (canFireProjectiles) + npc.ai[2] += 1f; + + float laserGateValue = 300f - (death ? 240f * (1f - combinedLifeRatio) : 180f * (1f - combinedLifeRatio)); + if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] >= laserGateValue) + { + npc.TargetClosest(); + + npc.ai[2] = 0f; + + int numLasers = 2; + bool leftLaserIsFast = Main.rand.NextBool(); + for (int i = 0; i < numLasers; i++) + { + Vector2 freeHeadProjSpawn = new Vector2(npc.Center.X, npc.Center.Y - 20f * npc.scale); + if (i == 0) + freeHeadProjSpawn.X -= 14f * npc.scale; + else if (i == 1) + freeHeadProjSpawn.X += 14f * npc.scale; + + float freeHeadProjSpeed = 5f + (death ? 5f * (1f - combinedLifeRatio) : 3f * (1f - combinedLifeRatio)); + if (masterMode) + { + if (i == 0) + { + if (leftLaserIsFast) + freeHeadProjSpeed *= 1.25f; + else + freeHeadProjSpeed *= 0.75f; + } + else + { + if (!leftLaserIsFast) + freeHeadProjSpeed *= 1.25f; + else + freeHeadProjSpeed *= 0.75f; + } + } + + float freeHeadProjTargetX = Main.player[npc.target].Center.X - freeHeadProjSpawn.X; + float freeHeadProjTargetY = Main.player[npc.target].Center.Y - freeHeadProjSpawn.Y; + float freeHeadProjTargetDist = (float)Math.Sqrt(freeHeadProjTargetX * freeHeadProjTargetX + freeHeadProjTargetY * freeHeadProjTargetY); + + freeHeadProjTargetDist = freeHeadProjSpeed / freeHeadProjTargetDist; + freeHeadProjTargetX *= freeHeadProjTargetDist; + freeHeadProjTargetY *= freeHeadProjTargetDist; + + Vector2 laserVelocity = new Vector2(freeHeadProjTargetX, freeHeadProjTargetY); + int type = ProjectileID.EyeBeam; + int damage = npc.GetProjectileDamage(type); + int freeHeadLaser = Projectile.NewProjectile(npc.GetSource_FromAI(), freeHeadProjSpawn + laserVelocity.SafeNormalize(Vector2.UnitY) * 40f, laserVelocity, type, damage, 0f, Main.myPlayer); + Main.projectile[freeHeadLaser].timeLeft = enrage ? 600 : 300; + if (turboEnrage && Main.getGoodWorld) + Main.projectile[freeHeadLaser].extraUpdates += 1; + } + } + + if (!Main.getGoodWorld) + { + npc.position += npc.netOffset; + int randDustOffset = Main.rand.Next(2) * 2 - 1; + Vector2 randDustPos = npc.Bottom + new Vector2((float)(randDustOffset * 22) * npc.scale, -22f * npc.scale); + Dust getGoodDust = Dust.NewDustPerfect(randDustPos, 228, (MathHelper.PiOver2 + -MathHelper.PiOver2 * (float)randDustOffset + Main.rand.NextFloatDirection() * MathHelper.PiOver4).ToRotationVector2() * (2f + Main.rand.NextFloat())); + Dust dust = getGoodDust; + dust.velocity += npc.velocity; + getGoodDust.noGravity = true; + getGoodDust = Dust.NewDustPerfect(npc.Bottom + new Vector2(Main.rand.NextFloatDirection() * 6f * npc.scale, (Main.rand.NextFloat() * -4f - 8f) * npc.scale), 228, Vector2.UnitY * (2f + Main.rand.NextFloat())); + getGoodDust.fadeIn = 0f; + getGoodDust.scale = 0.7f + Main.rand.NextFloat() * 0.5f; + getGoodDust.noGravity = true; + dust = getGoodDust; + dust.velocity += npc.velocity; + npc.position -= npc.netOffset; + } + + return false; + } + + public static bool VanillaGolemAI(NPC npc, Mod mod) + { + NPC.golemBoss = npc.whoAmI; + float enrageScale = npc.GetMyBalance(); + if (Main.expertMode) + enrageScale += 0.5f; + if (Main.masterMode) + enrageScale += 0.5f; + if (Main.getGoodWorld) + enrageScale += 2f; + + if ((!Main.player[npc.target].ZoneLihzhardTemple && !Main.player[npc.target].ZoneJungle) || (double)Main.player[npc.target].Center.Y < Main.worldSurface * 16.0) + enrageScale *= 2f; + + npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive && enrageScale > 1f; + + if (npc.localAI[0] == 0f && Main.netMode != NetmodeID.MultiplayerClient) + { + npc.localAI[0] = 1f; + NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X - 84, (int)npc.Center.Y - 9, NPCID.GolemFistLeft); + NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X + 78, (int)npc.Center.Y - 9, NPCID.GolemFistRight); + NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X - 3, (int)npc.Center.Y - 57, NPCID.GolemHead); + } + + if (npc.target >= 0 && Main.player[npc.target].dead) + { + npc.TargetClosest(); + if (Main.player[npc.target].dead) + npc.noTileCollide = true; + } + + if (npc.alpha > 0) + { + npc.alpha -= 10; + if (npc.alpha < 0) + npc.alpha = 0; + + npc.ai[1] = 0f; + } + + bool flag = false; + bool flag2 = false; + bool flag3 = false; + npc.dontTakeDamage = false; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active && Main.npc[i].type == NPCID.GolemHead) + flag = true; + + if (Main.npc[i].active && Main.npc[i].type == NPCID.GolemFistLeft) + flag2 = true; + + if (Main.npc[i].active && Main.npc[i].type == NPCID.GolemFistRight) + flag3 = true; + } + + npc.dontTakeDamage = flag; + if (Main.netMode != NetmodeID.MultiplayerClient && Main.getGoodWorld && npc.velocity.Y > 0f) + { + for (int j = (int)(npc.position.X / 16f); (float)j < (npc.position.X + (float)npc.width) / 16f; j++) + { + for (int k = (int)(npc.position.Y / 16f); (float)k < (npc.position.Y + (float)npc.width) / 16f; k++) + { + if (Main.tile[j, k].TileType == TileID.Torches) + { + Main.tile[j, k].Get().HasTile = false; + if (Main.netMode == NetmodeID.Server) + NetMessage.SendTileSquare(-1, j, k); + } + } + } + } + + npc.position += npc.netOffset; + if (!Main.getGoodWorld) + { + if (!flag2) + { + int num2 = Dust.NewDust(new Vector2(npc.Center.X - 80f * npc.scale, npc.Center.Y - 9f), 8, 8, DustID.Smoke, 0f, 0f, 100); + Main.dust[num2].alpha += Main.rand.Next(100); + Main.dust[num2].velocity *= 0.2f; + Main.dust[num2].velocity.Y -= 0.5f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[num2].fadeIn = 0.5f + (float)Main.rand.Next(10) * 0.1f; + if (Main.rand.NextBool(10)) + { + num2 = Dust.NewDust(new Vector2(npc.Center.X - 80f * npc.scale, npc.Center.Y - 9f), 8, 8, DustID.Torch); + if (!Main.rand.NextBool(20)) + { + Main.dust[num2].noGravity = true; + Main.dust[num2].scale *= 1f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[num2].velocity.Y -= 1f; + } + } + } + + if (!flag3) + { + int num3 = Dust.NewDust(new Vector2(npc.Center.X + 62f * npc.scale, npc.Center.Y - 9f), 8, 8, DustID.Smoke, 0f, 0f, 100); + Main.dust[num3].alpha += Main.rand.Next(100); + Main.dust[num3].velocity *= 0.2f; + Main.dust[num3].velocity.Y -= 0.5f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[num3].fadeIn = 0.5f + (float)Main.rand.Next(10) * 0.1f; + if (Main.rand.NextBool(10)) + { + num3 = Dust.NewDust(new Vector2(npc.Center.X + 62f * npc.scale, npc.Center.Y - 9f), 8, 8, DustID.Torch); + if (!Main.rand.NextBool(20)) + { + Main.dust[num3].noGravity = true; + Main.dust[num3].scale *= 1f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[num3].velocity.Y -= 1f; + } + } + } + } + + npc.position -= npc.netOffset; + if (npc.noTileCollide && !Main.player[npc.target].dead) + { + if (npc.velocity.Y > 0f && npc.Bottom.Y > Main.player[npc.target].Top.Y) + npc.noTileCollide = false; + else if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].Center, 1, 1) && !Collision.SolidTiles(npc.position, npc.width, npc.height)) + npc.noTileCollide = false; + } + + if (npc.ai[0] == 0f) + { + if (npc.velocity.Y == 0f) + { + // Avoid cheap bullshit + npc.damage = 0; + + npc.velocity.X *= 0.8f; + float num4 = 1f; + if (npc.ai[1] > 0f) + { + if (!flag2) + num4 += 2f; + + if (!flag3) + num4 += 2f; + + if (!flag) + num4 += 2f; + + if (npc.life < npc.lifeMax) + num4 += 1f; + + if (npc.life < npc.lifeMax / 2) + num4 += 4f; + + if (npc.life < npc.lifeMax / 3) + num4 += 8f; + + num4 *= enrageScale; + if (Main.getGoodWorld) + num4 += 100f; + } + + npc.ai[1] += num4; + if (npc.ai[1] >= 300f) + { + npc.ai[1] = -20f; + npc.frameCounter = 0D; + } + else if (npc.ai[1] == -1f) + { + // Set damage + npc.damage = npc.defDamage; + + npc.noTileCollide = true; + npc.TargetClosest(); + npc.velocity.X = 4 * npc.direction; + if (npc.life < npc.lifeMax) + { + npc.velocity.Y = -12.1f * (enrageScale + 9f) / 10f; + if ((double)npc.velocity.Y < -19.1) + npc.velocity.Y = -19.1f; + } + else + npc.velocity.Y = -12.1f; + + npc.ai[0] = 1f; + npc.ai[1] = 0f; + } + } + } + else if (npc.ai[0] == 1f) + { + if (npc.velocity.Y == 0f) + { + // Avoid cheap bullshit + npc.damage = 0; + + SoundEngine.PlaySound(SoundID.Item14, npc.Center); + npc.ai[0] = 0f; + for (int l = (int)npc.position.X - 20; l < (int)npc.position.X + npc.width + 40; l += 20) + { + for (int m = 0; m < 4; m++) + { + int num5 = Dust.NewDust(new Vector2(npc.position.X - 20f, npc.position.Y + (float)npc.height), npc.width + 20, 4, DustID.Smoke, 0f, 0f, 100, default(Color), 1.5f); + Main.dust[num5].velocity *= 0.2f; + } + + int num6 = Gore.NewGore(npc.GetSource_FromAI(), new Vector2(l - 20, npc.position.Y + (float)npc.height - 8f), default(Vector2), Main.rand.Next(61, 64)); + Main.gore[num6].velocity *= 0.4f; + } + } + else + { + // Set damage + npc.damage = npc.defDamage; + + npc.TargetClosest(); + if (npc.position.X < Main.player[npc.target].position.X && npc.position.X + (float)npc.width > Main.player[npc.target].position.X + (float)Main.player[npc.target].width) + { + npc.velocity.X *= 0.9f; + if (npc.Bottom.Y < Main.player[npc.target].position.Y) + npc.velocity.Y += 0.2f * (enrageScale + 1f) / 2f; + } + else + { + if (npc.direction < 0) + npc.velocity.X -= 0.2f; + else if (npc.direction > 0) + npc.velocity.X += 0.2f; + + float num7 = 3f; + if (npc.life < npc.lifeMax) + num7 += 1f; + + if (npc.life < npc.lifeMax / 2) + num7 += 1f; + + if (npc.life < npc.lifeMax / 4) + num7 += 1f; + + num7 *= (enrageScale + 1f) / 2f; + if (npc.velocity.X < 0f - num7) + npc.velocity.X = 0f - num7; + + if (npc.velocity.X > num7) + npc.velocity.X = num7; + } + } + } + + if (npc.target <= 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead) + npc.TargetClosest(); + + int num8 = 3000; + if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) + Math.Abs(npc.Center.Y - Main.player[npc.target].Center.Y) > (float)num8) + { + npc.TargetClosest(); + if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) + Math.Abs(npc.Center.Y - Main.player[npc.target].Center.Y) > (float)num8) + npc.active = false; + } + + return false; + } + + public static bool VanillaGolemFistAI(NPC npc, Mod mod) + { + float enrageScale = npc.GetMyBalance(); + if (Main.expertMode) + enrageScale += 1f; + if (Main.masterMode) + enrageScale += 1f; + if (Main.getGoodWorld) + enrageScale += 3f; + + if ((!Main.player[npc.target].ZoneLihzhardTemple && !Main.player[npc.target].ZoneJungle) || (double)Main.player[npc.target].Center.Y < Main.worldSurface * 16.0) + enrageScale *= 2f; + + if (NPC.golemBoss < 0) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + npc.StrikeInstantKill(); + + return false; + } + + if (npc.alpha > 0) + { + npc.alpha -= 10; + if (npc.alpha < 0) + npc.alpha = 0; + + npc.ai[1] = 0f; + } + + Player player = Main.player[npc.target]; + NPC nPC = Main.npc[NPC.golemBoss]; + Vector2 vector = nPC.Center + nPC.velocity + new Vector2(0f, -9f * npc.scale); + vector.X += (float)((npc.type == NPCID.GolemFistLeft) ? -84 : 78) * npc.scale; + Vector2 vector2 = vector - npc.Center; + float num2 = vector2.Length(); + if (npc.ai[0] == 0f) + { + // Avoid cheap bullshit + npc.damage = 0; + + npc.noTileCollide = true; + float num3 = 14f; + if (npc.life < npc.lifeMax / 2) + num3 += 3f; + + if (npc.life < npc.lifeMax / 4) + num3 += 3f; + + if (Main.npc[NPC.golemBoss].life < Main.npc[NPC.golemBoss].lifeMax) + num3 += 8f; + + num3 *= (enrageScale + 3f) / 4f; + if (num3 > 32f) + num3 = 32f; + + float x = vector2.X; + float y = vector2.Y; + float num4 = num2; + if (num4 < 12f + num3) + { + npc.rotation = 0f; + npc.velocity.X = x; + npc.velocity.Y = y; + float num5 = enrageScale; + npc.ai[1] += num5; + if (npc.life < npc.lifeMax / 2) + npc.ai[1] += num5; + + if (npc.life < npc.lifeMax / 4) + npc.ai[1] += num5; + + if (Main.npc[NPC.golemBoss].life < Main.npc[NPC.golemBoss].lifeMax) + npc.ai[1] += 10f * num5; + + if (npc.ai[1] >= 60f) + { + npc.TargetClosest(); + if ((npc.type == NPCID.GolemFistLeft && npc.Center.X + 100f > Main.player[npc.target].Center.X) || (npc.type == NPCID.GolemFistRight && npc.Center.X - 100f < Main.player[npc.target].Center.X)) + { + npc.ai[1] = 0f; + npc.ai[0] = 1f; + } + else + npc.ai[1] = 0f; + } + } + else + { + num4 = num3 / num4; + npc.velocity.X = x * num4; + npc.velocity.Y = y * num4; + npc.rotation = (float)Math.Atan2(-npc.velocity.Y, -npc.velocity.X); + if (npc.type == NPCID.GolemFistLeft) + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); + } + } + else if (npc.ai[0] == 1f) + { + // Avoid cheap bullshit + npc.damage = 0; + + npc.ai[1] += 1f; + npc.Center = vector; + npc.rotation = 0f; + npc.velocity = Vector2.Zero; + if (npc.ai[1] <= 15f) + { + for (int i = 0; i < 1; i++) + { + Vector2 vector3 = Main.rand.NextVector2Circular(80f, 80f); + Vector2 vector4 = vector3 * -1f * 0.05f; + Vector2 vector5 = Main.rand.NextVector2Circular(20f, 20f); + Dust dust = Dust.NewDustPerfect(npc.Center + vector4 + vector3 + vector5, 228, vector4); + dust.fadeIn = 1.5f; + dust.scale = 0.5f; + if (Main.getGoodWorld) + dust.noLight = true; + + dust.noGravity = true; + } + } + + if (npc.ai[1] >= 30f) + { + // Set damage + npc.damage = npc.defDamage; + + npc.noTileCollide = true; + npc.collideX = false; + npc.collideY = false; + npc.ai[0] = 2f; + npc.ai[1] = 0f; + float num6 = 12f; + if (npc.life < npc.lifeMax / 2) + num6 += 4f; + + if (npc.life < npc.lifeMax / 4) + num6 += 4f; + + if (Main.npc[NPC.golemBoss].life < Main.npc[NPC.golemBoss].lifeMax) + num6 += 10f; + + num6 *= (enrageScale + 3f) / 4f; + if (num6 > 48f) + num6 = 48f; + + Vector2 vector6 = npc.Center; + float num7 = Main.player[npc.target].Center.X - vector6.X; + float num8 = Main.player[npc.target].Center.Y - vector6.Y; + float num9 = (float)Math.Sqrt(num7 * num7 + num8 * num8); + num9 = num6 / num9; + npc.velocity.X = num7 * num9; + npc.velocity.Y = num8 * num9; + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); + if (npc.type == NPCID.GolemFistLeft) + npc.rotation = (float)Math.Atan2(-npc.velocity.Y, -npc.velocity.X); + } + } + else if (npc.ai[0] == 2f) + { + // Set damage + npc.damage = npc.defDamage; + + if (Main.netMode != NetmodeID.MultiplayerClient && Main.getGoodWorld) + { + for (int j = (int)(npc.position.X / 16f) - 1; (float)j < (npc.position.X + (float)npc.width) / 16f + 1f; j++) + { + for (int k = (int)(npc.position.Y / 16f) - 1; (float)k < (npc.position.Y + (float)npc.width) / 16f + 1f; k++) + { + if (Main.tile[j, k].TileType == TileID.Torches) + { + Main.tile[j, k].Get().HasTile = false; + if (Main.netMode == NetmodeID.Server) + NetMessage.SendTileSquare(-1, j, k); + } + } + } + } + + npc.ai[1] += 1f; + if (npc.ai[1] == 1f) + SoundEngine.PlaySound(SoundID.Item14, npc.Center); + + if (Main.rand.NextBool()) + { + Vector2 vector7 = npc.velocity * 0.5f; + Vector2 vector8 = Main.rand.NextVector2Circular(20f, 20f); + Dust.NewDustPerfect(npc.Center + vector7 + vector8, 306, vector7, 0, Main.OurFavoriteColor).scale = 2f; + } + + if (Math.Abs(npc.velocity.X) > Math.Abs(npc.velocity.Y)) + { + if (npc.velocity.X > 0f && npc.Center.X > player.Center.X) + npc.noTileCollide = false; + + if (npc.velocity.X < 0f && npc.Center.X < player.Center.X) + npc.noTileCollide = false; + } + else + { + if (npc.velocity.Y > 0f && npc.Center.Y > player.Center.Y) + npc.noTileCollide = false; + + if (npc.velocity.Y < 0f && npc.Center.Y < player.Center.Y) + npc.noTileCollide = false; + } + + if (num2 > 700f || npc.collideX || npc.collideY) + { + // Avoid cheap bullshit + npc.damage = 0; + + npc.noTileCollide = true; + npc.ai[0] = 0f; + } + } + else + { + if (npc.ai[0] != 3f) + return false; + + // Set damage + npc.damage = npc.defDamage; + + npc.noTileCollide = true; + float num10 = 0.4f; + Vector2 vector9 = npc.Center; + float num11 = Main.player[npc.target].Center.X - vector9.X; + float num12 = Main.player[npc.target].Center.Y - vector9.Y; + float num13 = (float)Math.Sqrt(num11 * num11 + num12 * num12); + num13 = 12f / num13; + num11 *= num13; + num12 *= num13; + if (npc.velocity.X < num11) + { + npc.velocity.X += num10; + if (npc.velocity.X < 0f && num11 > 0f) + npc.velocity.X += num10 * 2f; + } + else if (npc.velocity.X > num11) + { + npc.velocity.X -= num10; + if (npc.velocity.X > 0f && num11 < 0f) + npc.velocity.X -= num10 * 2f; + } + + if (npc.velocity.Y < num12) + { + npc.velocity.Y += num10; + if (npc.velocity.Y < 0f && num12 > 0f) + npc.velocity.Y += num10 * 2f; + } + else if (npc.velocity.Y > num12) + { + npc.velocity.Y -= num10; + if (npc.velocity.Y > 0f && num12 < 0f) + npc.velocity.Y -= num10 * 2f; + } + + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); + if (npc.type == NPCID.GolemFistLeft) + npc.rotation = (float)Math.Atan2(-npc.velocity.Y, -npc.velocity.X); + } + + return false; + } + + public static bool VanillaGolemHeadAI(NPC npc, Mod mod) + { + float enrageScale = npc.GetMyBalance(); + if (Main.expertMode) + enrageScale += 1f; + if (Main.masterMode) + enrageScale += 1f; + if (Main.getGoodWorld) + enrageScale += 3f; + + if ((!Main.player[npc.target].ZoneLihzhardTemple && !Main.player[npc.target].ZoneJungle) || (double)Main.player[npc.target].Center.Y < Main.worldSurface * 16.0) + enrageScale *= 2f; + + npc.noTileCollide = true; + if (NPC.golemBoss < 0) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + npc.StrikeInstantKill(); + + return false; + } + + float num707 = 100f; + Vector2 vector89 = npc.Center; + float num708 = Main.npc[NPC.golemBoss].Center.X - vector89.X; + float num709 = Main.npc[NPC.golemBoss].Center.Y - vector89.Y; + num709 -= 57f * npc.scale; + num708 -= 3f * npc.scale; + float num710 = (float)Math.Sqrt(num708 * num708 + num709 * num709); + if (num710 < num707) + { + npc.rotation = 0f; + npc.velocity.X = num708; + npc.velocity.Y = num709; + } + else + { + num710 = num707 / num710; + npc.velocity.X = num708 * num710; + npc.velocity.Y = num709 * num710; + npc.rotation = npc.velocity.X * 0.1f; + } + + if (npc.alpha > 0) + { + npc.alpha -= 10; + if (npc.alpha < 0) + npc.alpha = 0; + + npc.ai[1] = 30f; + } + + if (npc.ai[0] == 0f) + { + npc.ai[1] += 1f; + int num711 = 300; + if (npc.ai[1] < 20f || npc.ai[1] > (float)(num711 - 20)) + { + npc.ai[1] += 2f * (enrageScale - 1f) / 3f; + npc.localAI[0] = 1f; + } + else + { + npc.ai[1] += 1f * (enrageScale - 1f) / 2f; + npc.localAI[0] = 0f; + } + + if (npc.ai[1] >= (float)num711) + { + npc.TargetClosest(); + npc.ai[1] = 0f; + Vector2 vector90 = new Vector2(npc.Center.X, npc.Center.Y + 10f * npc.scale); + float num712 = 8f; + float num713 = Main.player[npc.target].Center.X - vector90.X; + float num714 = Main.player[npc.target].Center.Y - vector90.Y; + float num715 = (float)Math.Sqrt(num713 * num713 + num714 * num714); + num715 = num712 / num715; + num713 *= num715; + num714 *= num715; + + int type = ProjectileID.Fireball; + int damage = npc.GetProjectileDamage(type); + if (Main.netMode != NetmodeID.MultiplayerClient) + Projectile.NewProjectile(npc.GetSource_FromAI(), vector90.X, vector90.Y, num713, num714, type, damage, 0f, Main.myPlayer); + } + } + else if (npc.ai[0] == 1f) + { + npc.TargetClosest(); + Vector2 vector91 = new Vector2(npc.Center.X, npc.Center.Y + 10f * npc.scale); + if (Main.player[npc.target].Center.X < npc.Center.X - (float)npc.width) + { + npc.localAI[1] = -1f; + vector91.X -= 40f * npc.scale; + } + else if (Main.player[npc.target].Center.X > npc.Center.X + (float)npc.width) + { + npc.localAI[1] = 1f; + vector91.X += 40f * npc.scale; + } + else + npc.localAI[1] = 0f; + + float num719 = (enrageScale + 3f) / 4f; + npc.ai[1] += num719; + if ((double)npc.life < (double)npc.lifeMax * 0.4) + npc.ai[1] += num719; + + if ((double)npc.life < (double)npc.lifeMax * 0.2) + npc.ai[1] += num719; + + int num720 = 300; + if (npc.ai[1] < 20f || npc.ai[1] > (float)(num720 - 20)) + npc.localAI[0] = 1f; + else + npc.localAI[0] = 0f; + + if (npc.ai[1] >= (float)num720) + { + npc.TargetClosest(); + npc.ai[1] = 0f; + float num721 = 8f; + float num722 = Main.player[npc.target].Center.X - vector91.X; + float num723 = Main.player[npc.target].Center.Y - vector91.Y; + float num724 = (float)Math.Sqrt(num722 * num722 + num723 * num723); + num724 = num721 / num724; + num722 *= num724; + num723 *= num724; + + int type = ProjectileID.Fireball; + int damage = npc.GetProjectileDamage(type); + if (Main.netMode != NetmodeID.MultiplayerClient) + Projectile.NewProjectile(npc.GetSource_FromAI(), vector91.X, vector91.Y, num722, num723, type, damage, 0f, Main.myPlayer); + } + + npc.ai[2] += num719; + if (npc.life < npc.lifeMax / 3) + npc.ai[2] += num719; + + if (npc.life < npc.lifeMax / 4) + npc.ai[2] += num719; + + if (npc.life < npc.lifeMax / 5) + npc.ai[2] += num719; + + if (npc.ai[2] > (float)(60 + Main.rand.Next(600))) + { + npc.ai[2] = 0f; + + int type = ProjectileID.EyeBeam; + int damage = npc.GetProjectileDamage(type); + + if (npc.localAI[1] == 0f) + { + for (int num730 = 0; num730 < 2; num730++) + { + vector91 = new Vector2(npc.Center.X, npc.Center.Y - 22f * npc.scale); + if (num730 == 0) + vector91.X -= 18f * npc.scale; + else + vector91.X += 18f * npc.scale; + + float num731 = 11f; + float num732 = Main.player[npc.target].Center.X - vector91.X; + float num733 = Main.player[npc.target].Center.Y - vector91.Y; + float num734 = (float)Math.Sqrt(num732 * num732 + num733 * num733); + num734 = num731 / num734; + num732 *= num734; + num733 *= num734; + + Vector2 laserVelocity = new Vector2(num732, num733); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int num735 = Projectile.NewProjectile(npc.GetSource_FromAI(), vector91 + laserVelocity.SafeNormalize(Vector2.UnitY) * 40f, laserVelocity, type, damage, 0f, Main.myPlayer); + Main.projectile[num735].timeLeft = 300; + } + } + } + else if (npc.localAI[1] != 0f) + { + vector91 = new Vector2(npc.Center.X, npc.Center.Y - 22f * npc.scale); + if (npc.localAI[1] == -1f) + vector91.X -= 30f * npc.scale; + else if (npc.localAI[1] == 1f) + vector91.X += 30f * npc.scale; + + float num736 = 12f; + float num737 = Main.player[npc.target].Center.X - vector91.X; + float num738 = Main.player[npc.target].Center.Y - vector91.Y; + float num739 = (float)Math.Sqrt(num737 * num737 + num738 * num738); + num739 = num736 / num739; + num737 *= num739; + num738 *= num739; + + Vector2 laserVelocity = new Vector2(num737, num738); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int num740 = Projectile.NewProjectile(npc.GetSource_FromAI(), vector91 + laserVelocity.SafeNormalize(Vector2.UnitY) * 40f, laserVelocity, type, damage, 0f, Main.myPlayer); + Main.projectile[num740].timeLeft = 300; + } + } + } + } + + if (npc.life < npc.lifeMax / 2) + npc.ai[0] = 1f; + else + npc.ai[0] = 0f; + + return false; + } + + public static bool VanillaGolemHeadFreeAI(NPC npc, Mod mod) + { + bool flag37 = false; + float enrageScale = npc.GetMyBalance(); + if (Main.expertMode) + enrageScale += 1f; + if (Main.masterMode) + enrageScale += 1f; + if (Main.getGoodWorld) + enrageScale += 3f; + + if ((!Main.player[npc.target].ZoneLihzhardTemple && !Main.player[npc.target].ZoneJungle) || (double)Main.player[npc.target].Center.Y < Main.worldSurface * 16.0) + enrageScale *= 2f; + + if (!Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1)) + { + npc.noTileCollide = true; + flag37 = true; + } + else if (npc.noTileCollide && Collision.SolidTiles(npc.position, npc.width, npc.height)) + npc.noTileCollide = false; + + if (NPC.golemBoss < 0) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + npc.StrikeInstantKill(); + + return false; + } + + npc.TargetClosest(); + float num742 = 7f; + float num743 = 0.05f; + Vector2 vector92 = npc.Center; + float num744 = Main.player[npc.target].Center.X - vector92.X; + float num745 = Main.player[npc.target].Center.Y - vector92.Y - 300f; + float num746 = (float)Math.Sqrt(num744 * num744 + num745 * num745); + num746 = num742 / num746; + num744 *= num746; + num745 *= num746; + if (npc.velocity.X < num744) + { + npc.velocity.X += num743; + if (npc.velocity.X < 0f && num744 > 0f) + npc.velocity.X += num743; + } + else if (npc.velocity.X > num744) + { + npc.velocity.X -= num743; + if (npc.velocity.X > 0f && num744 < 0f) + npc.velocity.X -= num743; + } + + if (npc.velocity.Y < num745) + { + npc.velocity.Y += num743; + if (npc.velocity.Y < 0f && num745 > 0f) + npc.velocity.Y += num743; + } + else if (npc.velocity.Y > num745) + { + npc.velocity.Y -= num743; + if (npc.velocity.Y > 0f && num745 < 0f) + npc.velocity.Y -= num743; + } + + float num747 = (enrageScale + 4f) / 5f; + npc.ai[1] += num747; + if ((double)Main.npc[NPC.golemBoss].life < (double)Main.npc[NPC.golemBoss].lifeMax * 0.8) + npc.ai[1] += num747; + + if ((double)Main.npc[NPC.golemBoss].life < (double)Main.npc[NPC.golemBoss].lifeMax * 0.6) + npc.ai[1] += num747; + + if ((double)Main.npc[NPC.golemBoss].life < (double)Main.npc[NPC.golemBoss].lifeMax * 0.2) + npc.ai[1] += num747; + + if ((double)Main.npc[NPC.golemBoss].life < (double)Main.npc[NPC.golemBoss].lifeMax * 0.1) + npc.ai[1] += num747; + + int num748 = 300; + if (npc.ai[1] < 20f || npc.ai[1] > (float)(num748 - 20)) + npc.localAI[0] = 1f; + else + npc.localAI[0] = 0f; + + if (flag37) + npc.ai[1] = 20f; + + if (npc.ai[1] >= (float)num748) + { + npc.TargetClosest(); + npc.ai[1] = 0f; + Vector2 vector93 = new Vector2(npc.Center.X, npc.Center.Y + 20f * npc.scale); + float num749 = 8f; + + int type = ProjectileID.Fireball; + int damage = npc.GetProjectileDamage(type); + + float num752 = Main.player[npc.target].Center.X - vector93.X; + float num753 = Main.player[npc.target].Center.Y - vector93.Y; + float num754 = (float)Math.Sqrt(num752 * num752 + num753 * num753); + num754 = num749 / num754; + num752 *= num754; + num753 *= num754; + if (Main.netMode != NetmodeID.MultiplayerClient) + Projectile.NewProjectile(npc.GetSource_FromAI(), vector93.X, vector93.Y, num752, num753, type, damage, 0f, Main.myPlayer); + } + + float num756 = enrageScale; + npc.ai[2] += num756; + if ((double)Main.npc[NPC.golemBoss].life < (double)Main.npc[NPC.golemBoss].lifeMax / 1.25) + npc.ai[2] += num756; + + if ((double)Main.npc[NPC.golemBoss].life < (double)Main.npc[NPC.golemBoss].lifeMax / 1.5) + npc.ai[2] += num756; + + if (Main.npc[NPC.golemBoss].life < Main.npc[NPC.golemBoss].lifeMax / 2) + npc.ai[2] += num756; + + if (Main.npc[NPC.golemBoss].life < Main.npc[NPC.golemBoss].lifeMax / 3) + npc.ai[2] += num756; + + if (Main.npc[NPC.golemBoss].life < Main.npc[NPC.golemBoss].lifeMax / 4) + npc.ai[2] += num756; + + if (Main.npc[NPC.golemBoss].life < Main.npc[NPC.golemBoss].lifeMax / 5) + npc.ai[2] += num756; + + if (Main.npc[NPC.golemBoss].life < Main.npc[NPC.golemBoss].lifeMax / 6) + npc.ai[2] += num756; + + if (npc.ai[2] > (float)(100 + Main.rand.Next(4800))) + { + npc.ai[2] = 0f; + for (int num757 = 0; num757 < 2; num757++) + { + Vector2 vector94 = new Vector2(npc.Center.X, npc.Center.Y - 20f * npc.scale); + switch (num757) + { + case 0: + vector94.X -= 14f * npc.scale; + break; + case 1: + vector94.X += 14f * npc.scale; + break; + } + + float num758 = 11f; + int type = ProjectileID.EyeBeam; + int damage = npc.GetProjectileDamage(type); + + if ((double)Main.npc[NPC.golemBoss].life < (double)Main.npc[NPC.golemBoss].lifeMax * 0.5) + num758 += 0.25f; + if ((double)Main.npc[NPC.golemBoss].life < (double)Main.npc[NPC.golemBoss].lifeMax * 0.4) + num758 += 0.25f; + if ((double)Main.npc[NPC.golemBoss].life < (double)Main.npc[NPC.golemBoss].lifeMax * 0.3) + num758 += 0.25f; + if ((double)Main.npc[NPC.golemBoss].life < (double)Main.npc[NPC.golemBoss].lifeMax * 0.2) + num758 += 0.25f; + if ((double)Main.npc[NPC.golemBoss].life < (double)Main.npc[NPC.golemBoss].lifeMax * 0.1) + num758 += 0.25f; + + float num761 = Main.player[npc.target].Center.X; + float num762 = Main.player[npc.target].Center.Y; + num761 -= vector94.X; + num762 -= vector94.Y; + float num763 = (float)Math.Sqrt(num761 * num761 + num762 * num762); + num763 = num758 / num763; + num761 *= num763; + num762 *= num763; + + Vector2 laserVelocity = new Vector2(num761, num762); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int num764 = Projectile.NewProjectile(npc.GetSource_FromAI(), vector94 + laserVelocity.SafeNormalize(Vector2.UnitY) * 40f, laserVelocity, type, damage, 0f, Main.myPlayer); + Main.projectile[num764].timeLeft = 300; + } + } + } + + if (!Main.getGoodWorld) + { + npc.position += npc.netOffset; + int num765 = Main.rand.Next(2) * 2 - 1; + Vector2 vector95 = npc.Bottom + new Vector2((float)(num765 * 22) * npc.scale, -22f * npc.scale); + Dust dust5 = Dust.NewDustPerfect(vector95, 228, (MathHelper.PiOver2 + -MathHelper.PiOver2 * (float)num765 + Main.rand.NextFloatDirection() * MathHelper.PiOver4).ToRotationVector2() * (2f + Main.rand.NextFloat())); + Dust dust = dust5; + dust.velocity += npc.velocity; + dust5.noGravity = true; + dust5 = Dust.NewDustPerfect(npc.Bottom + new Vector2(Main.rand.NextFloatDirection() * 6f * npc.scale, (Main.rand.NextFloat() * -4f - 8f) * npc.scale), 228, Vector2.UnitY * (2f + Main.rand.NextFloat())); + dust5.fadeIn = 0f; + dust5.scale = 0.7f + Main.rand.NextFloat() * 0.5f; + dust5.noGravity = true; + dust = dust5; + dust.velocity += npc.velocity; + npc.position -= npc.netOffset; + } + + return false; + } + } +} diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/KingSlimeAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/KingSlimeAI.cs new file mode 100644 index 0000000000..54060f5524 --- /dev/null +++ b/NPCs/VanillaNPCAIOverrides/Bosses/KingSlimeAI.cs @@ -0,0 +1,936 @@ +using System; +using CalamityMod.Events; +using CalamityMod.NPCs.NormalNPCs; +using CalamityMod.UI; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses +{ + public static class KingSlimeAI + { + public static bool BuffedKingSlimeAI(NPC npc, Mod mod) + { + // Percent life remaining + float lifeRatio = npc.life / (float)npc.lifeMax; + float lifeRatio2 = lifeRatio; + + // Variables + float teleportScale = 1f; + bool teleporting = false; + bool teleported = false; + npc.aiAction = 0; + float teleportScaleSpeed = 2f; + if (Main.getGoodWorld) + { + teleportScaleSpeed -= 1f - lifeRatio; + teleportScale *= teleportScaleSpeed; + } + + bool bossRush = BossRushEvent.BossRushActive; + bool masterMode = Main.masterMode || bossRush; + bool death = CalamityWorld.death || bossRush; + + // Get a target + 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(); + + // Phases based on life percentage + + // Higher velocity jumps phase + bool phase2 = lifeRatio < 0.75f; + + // Spawn Crystal phase + bool phase3 = lifeRatio < 0.5f; + + // Check if the crystals are alive + bool crystalAlive = true; + bool blueCrystalAlive = false; + bool greenCrystalAlive = true; + if (phase3) + { + crystalAlive = NPC.AnyNPCs(ModContent.NPCType()); + if (masterMode) + { + blueCrystalAlive = NPC.AnyNPCs(ModContent.NPCType()); + greenCrystalAlive = NPC.AnyNPCs(ModContent.NPCType()); + } + } + + // Sapphire Crystal buffs + int setDamage = npc.defDamage; + npc.defense = npc.defDefense; + if (blueCrystalAlive) + { + setDamage = (int)Math.Round(setDamage * 1.5); + npc.defense *= 2; + } + + // Dust color when the blue crystal is alive + Color dustColor = Color.Lerp(new Color(0, 0, 150, npc.alpha), new Color(125, 125, 255, npc.alpha), (float)Math.Sin(Main.GlobalTimeWrappedHourly) / 2f + 0.5f); + + // Spawn crystal in phase 2 + if (phase3 && npc.Calamity().newAI[0] == 0f) + { + npc.Calamity().newAI[0] = 1f; + npc.SyncExtraAI(); + Vector2 vector = npc.Center + new Vector2(-40f, -(float)npc.height / 2) * npc.scale; + int totalDustPerCrystalSpawn = 20; + for (int i = 0; i < totalDustPerCrystalSpawn; i++) + { + int rubyDust = Dust.NewDust(vector, npc.width / 2, npc.height / 2, DustID.GemRuby, 0f, 0f, 100, default, 2f); + Main.dust[rubyDust].velocity *= 2f; + Main.dust[rubyDust].noGravity = true; + if (Main.rand.NextBool()) + { + Main.dust[rubyDust].scale = 0.5f; + Main.dust[rubyDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + } + } + + if (masterMode) + { + for (int i = 0; i < totalDustPerCrystalSpawn; i++) + { + int sapphireDust = Dust.NewDust(vector, npc.width / 2, npc.height / 2, DustID.GemSapphire, 0f, 0f, 100, default, 2f); + Main.dust[sapphireDust].velocity *= 2f; + Main.dust[sapphireDust].noGravity = true; + if (Main.rand.NextBool()) + { + Main.dust[sapphireDust].scale = 0.5f; + Main.dust[sapphireDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + } + } + + for (int i = 0; i < totalDustPerCrystalSpawn; i++) + { + int emeraldDust = Dust.NewDust(vector, npc.width / 2, npc.height / 2, DustID.GemEmerald, 0f, 0f, 100, default, 2f); + Main.dust[emeraldDust].velocity *= 2f; + Main.dust[emeraldDust].noGravity = true; + if (Main.rand.NextBool()) + { + Main.dust[emeraldDust].scale = 0.5f; + Main.dust[emeraldDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + } + } + } + + SoundEngine.PlaySound(SoundID.Item38, vector); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + NPC.NewNPC(npc.GetSource_FromAI(), (int)vector.X, (int)vector.Y, ModContent.NPCType()); + if (masterMode) + { + NPC.NewNPC(npc.GetSource_FromAI(), (int)vector.X, (int)vector.Y, ModContent.NPCType()); + NPC.NewNPC(npc.GetSource_FromAI(), (int)vector.X, (int)vector.Y, ModContent.NPCType()); + } + } + } + + // Set up health value for spawning slimes + if (npc.ai[3] == 0f && npc.life > 0) + npc.ai[3] = npc.lifeMax; + + // Spawn with attack delay + if (npc.localAI[3] == 0f && Main.netMode != NetmodeID.MultiplayerClient) + { + npc.ai[0] = -100f; + npc.localAI[3] = 1f; + npc.netUpdate = true; + } + + // Despawn + int despawnDistance = 500; + if (Main.player[npc.target].dead || Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) / 16f > despawnDistance) + { + npc.TargetClosest(); + if (Main.player[npc.target].dead || Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) / 16f > despawnDistance) + { + if (npc.timeLeft > 10) + npc.timeLeft = 10; + + if (Main.player[npc.target].Center.X < npc.Center.X) + npc.direction = 1; + else + npc.direction = -1; + } + } + + // Faster fall + if (npc.velocity.Y > 0f) + { + float fallSpeedBonus = (bossRush ? 0.1f : death ? 0.05f : 0f) + (!crystalAlive ? 0.1f : 0f) + (masterMode ? 0.1f : 0f); + npc.velocity.Y += fallSpeedBonus; + } + + // Activate teleport + float teleportGateValue = 480f; + if (!Main.player[npc.target].dead && npc.ai[2] >= teleportGateValue && npc.ai[1] < 5f && npc.velocity.Y == 0f) + { + // Avoid cheap bullshit + npc.damage = 0; + + npc.ai[2] = 0f; + npc.ai[0] = 0f; + npc.ai[1] = 5f; + + if (Main.netMode != NetmodeID.MultiplayerClient) + GetPlaceToTeleportTo(npc); + } + + if (!Collision.CanHitLine(npc.Center, 0, 0, Main.player[npc.target].Center, 0, 0) || Math.Abs(npc.Top.Y - Main.player[npc.target].Bottom.Y) > 160f) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + npc.localAI[0] += 1f; + } + else if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.localAI[0] -= 1f; + + if (npc.localAI[0] < 0f) + npc.localAI[0] = 0f; + } + + if (npc.timeLeft < 10 && (npc.ai[0] != 0f || npc.ai[1] != 0f)) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.netUpdate = true; + teleporting = false; + } + + // Get closer to activating teleport + if (npc.ai[2] < teleportGateValue) + { + if (!Collision.CanHitLine(npc.Center, 0, 0, Main.player[npc.target].Center, 0, 0) || Math.Abs(npc.Top.Y - Main.player[npc.target].Bottom.Y) > (masterMode ? 160f : 320f)) + npc.ai[2] += death ? 3f : 2f; + else + npc.ai[2] += 1f; + } + + // Teleport + if (npc.ai[1] == 5f) + { + // Avoid cheap bullshit + npc.damage = 0; + + teleporting = true; + npc.aiAction = 1; + + float teleportRate = crystalAlive ? 1f : 2f; + if (masterMode) + teleportRate *= 2f; + + npc.ai[0] += teleportRate; + teleportScale = MathHelper.Clamp((60f - npc.ai[0]) / 60f, 0f, 1f); + teleportScale = 0.5f + teleportScale * 0.5f; + if (Main.getGoodWorld) + teleportScale *= teleportScaleSpeed; + + if (npc.ai[0] >= 60f) + teleported = true; + + if (npc.ai[0] == 60f && Main.netMode != NetmodeID.Server) + Gore.NewGore(npc.GetSource_FromAI(), npc.Center + new Vector2(-40f, -(float)npc.height / 2), npc.velocity, 734, 1f); + + if (npc.ai[0] >= 60f && Main.netMode != NetmodeID.MultiplayerClient) + { + npc.Bottom = new Vector2(npc.localAI[1], npc.localAI[2]); + npc.ai[1] = 6f; + npc.ai[0] = 0f; + npc.netUpdate = true; + } + + if (Main.netMode == NetmodeID.MultiplayerClient && npc.ai[0] >= 120f) + { + npc.ai[1] = 6f; + npc.ai[0] = 0f; + } + + if (!teleported) + { + for (int i = 0; i < 10; i++) + { + int slimeDust = Dust.NewDust(npc.position + Vector2.UnitX * -20f, npc.width + 40, npc.height, blueCrystalAlive ? DustID.GemSapphire : DustID.TintableDust, npc.velocity.X, npc.velocity.Y, blueCrystalAlive ? 100 : 150, blueCrystalAlive ? dustColor : new Color(78, 136, 255, 80), 2f); + Main.dust[slimeDust].noGravity = true; + Main.dust[slimeDust].velocity *= blueCrystalAlive ? 0f : 0.5f; + } + } + } + + // Post-teleport + else if (npc.ai[1] == 6f) + { + // Avoid cheap bullshit + npc.damage = 0; + + teleporting = true; + npc.aiAction = 0; + + float teleportRate = crystalAlive ? 1f : 2f; + if (masterMode) + teleportRate *= 2f; + + npc.ai[0] += teleportRate; + teleportScale = MathHelper.Clamp(npc.ai[0] / 30f, 0f, 1f); + teleportScale = 0.5f + teleportScale * 0.5f; + if (Main.getGoodWorld) + teleportScale *= teleportScaleSpeed; + + if (npc.ai[0] >= 30f && Main.netMode != NetmodeID.MultiplayerClient) + { + npc.ai[1] = 0f; + npc.ai[0] = -15f; + npc.netUpdate = true; + npc.TargetClosest(); + } + + if (Main.netMode == NetmodeID.MultiplayerClient && npc.ai[0] >= 60f) + { + npc.ai[1] = 0f; + npc.ai[0] = -15f; + npc.TargetClosest(); + } + + for (int j = 0; j < 10; j++) + { + int slimyDust = Dust.NewDust(npc.position + Vector2.UnitX * -20f, npc.width + 40, npc.height, blueCrystalAlive ? DustID.GemSapphire : DustID.TintableDust, npc.velocity.X, npc.velocity.Y, blueCrystalAlive ? 100 : 150, blueCrystalAlive ? dustColor : new Color(78, 136, 255, 80), 2f); + Main.dust[slimyDust].noGravity = true; + Main.dust[slimyDust].velocity *= blueCrystalAlive ? 0f : 2f; + } + } + + npc.noTileCollide = false; + + // Jump + if (npc.velocity.Y == 0f) + { + // Avoid cheap bullshit + npc.damage = 0; + + npc.velocity.X *= 0.8f; + if (npc.velocity.X > -0.1f && npc.velocity.X < 0.1f) + npc.velocity.X = 0f; + + if (!teleporting) + { + npc.ai[0] += (bossRush ? 15f : MathHelper.Lerp(1f, 8f, 1f - lifeRatio)); + if (npc.ai[0] >= 0f) + { + // Set damage + npc.damage = setDamage; + + npc.netUpdate = true; + npc.TargetClosest(); + + float distanceBelowTarget = npc.position.Y - (Main.player[npc.target].position.Y + 80f); + float speedMult = 1f; + if (distanceBelowTarget > 0f) + speedMult += distanceBelowTarget * 0.002f; + + if (speedMult > 2f) + speedMult = 2f; + + bool deathModeRapidHops = death && lifeRatio < 0.3f; + if (deathModeRapidHops) + npc.ai[1] = 2f; + + float bossRushJumpSpeedMult = 1.5f; + + // Jump type + if (npc.ai[1] == 3f) + { + npc.velocity.Y = -10f * speedMult; + npc.velocity.X += (phase2 ? (death ? 5.5f : 4.5f) : 3.5f) * npc.direction; + npc.ai[0] = -100f; + npc.ai[1] = 0f; + } + else if (npc.ai[1] == 2f) + { + npc.velocity.Y = -6f * speedMult; + npc.velocity.X += (phase2 ? (deathModeRapidHops ? 8f : death ? 6.5f : 5.5f) : 4.5f) * npc.direction; + npc.ai[0] = -60f; + + // Use the quick forward jump over and over while at low HP in death mode + if (!deathModeRapidHops) + npc.ai[1] += 1f; + } + else + { + npc.velocity.Y = -8f * speedMult; + npc.velocity.X += (phase2 ? (death ? 6f : 5f) : 4f) * npc.direction; + npc.ai[0] = -60f; + npc.ai[1] += 1f; + } + + if (!greenCrystalAlive) + { + npc.velocity.X *= 1.2f; + npc.velocity.Y *= 0.6f; + } + + if (masterMode) + npc.velocity.X *= 1.4f; + + if (bossRush) + npc.velocity.X *= bossRushJumpSpeedMult; + + npc.noTileCollide = true; + } + else if (npc.ai[0] >= -30f) + npc.aiAction = 1; + } + } + + // Change jump velocity + else if (npc.target < Main.maxPlayers) + { + float jumpVelocityLimit = crystalAlive ? 3f : 4.5f; + if (masterMode) + jumpVelocityLimit += 3f; + if (Main.getGoodWorld) + jumpVelocityLimit = 8f; + + if ((npc.direction == 1 && npc.velocity.X < jumpVelocityLimit) || (npc.direction == -1 && npc.velocity.X > -jumpVelocityLimit)) + { + if ((npc.direction == -1 && npc.velocity.X < 0.1) || (npc.direction == 1 && npc.velocity.X > -0.1)) + { + npc.velocity.X += (bossRush ? 0.4f : death ? 0.25f : 0.2f) * npc.direction; + if (masterMode) + npc.velocity.X += 0.3f * npc.direction; + } + else + { + npc.velocity.X *= bossRush ? 0.9f : death ? 0.92f : 0.93f; + if (masterMode) + npc.velocity.X *= 0.9f; + } + } + + if (!Main.player[npc.target].dead) + { + if (npc.velocity.Y > 0f && npc.Bottom.Y > Main.player[npc.target].Top.Y) + npc.noTileCollide = false; + else if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].Center, 1, 1) && !Collision.SolidCollision(npc.position, npc.width, npc.height)) + npc.noTileCollide = false; + else + npc.noTileCollide = true; + } + } + + int idleSlimeDust = Dust.NewDust(npc.position, npc.width, npc.height, blueCrystalAlive ? DustID.GemSapphire : DustID.TintableDust, npc.velocity.X, npc.velocity.Y, blueCrystalAlive ? 100 : 255, blueCrystalAlive ? dustColor : new Color(0, 80, 255, 80), npc.scale * 1.2f); + Main.dust[idleSlimeDust].noGravity = true; + Main.dust[idleSlimeDust].velocity *= blueCrystalAlive ? 0f : 0.5f; + + if (npc.life <= 0) + return false; + + // Adjust size based on HP + float maxScale = death ? (Main.getGoodWorld ? 6f : 3f) : (Main.getGoodWorld ? 3f : 1.25f); + float minScale = death ? 0.5f : 0.75f; + float maxScaledValue = maxScale - minScale; + + // Inversed scale in FTW + if (Main.getGoodWorld) + lifeRatio = (maxScaledValue - lifeRatio * maxScaledValue) + minScale; + else + lifeRatio = lifeRatio * maxScaledValue + minScale; + + lifeRatio *= teleportScale; + if (lifeRatio != npc.scale) + { + npc.position.X += npc.width / 2; + npc.position.Y += npc.height; + npc.scale = lifeRatio; + npc.width = (int)(98f * npc.scale); + npc.height = (int)(92f * npc.scale); + npc.position.X -= npc.width / 2; + npc.position.Y -= npc.height; + } + + // Slime spawning + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int slimeSpawnThreshold = (int)(npc.lifeMax * 0.03); + if (npc.life + slimeSpawnThreshold < npc.ai[3]) + { + npc.ai[3] = npc.life; + int slimeAmt = Main.rand.Next(1, 3); + for (int i = 0; i < slimeAmt; i++) + { + float minLowerLimit = death ? 5f : 0f; + float maxLowerLimit = death ? 7f : 2f; + int minTypeChoice = (int)MathHelper.Lerp(minLowerLimit, 7f, 1f - lifeRatio2); + int maxTypeChoice = (int)MathHelper.Lerp(maxLowerLimit, 9f, 1f - lifeRatio2); + + int npcType; + switch (Main.rand.Next(minTypeChoice, maxTypeChoice + 1)) + { + default: + npcType = NPCID.SlimeSpiked; + break; + case 0: + npcType = NPCID.GreenSlime; + break; + case 1: + npcType = Main.raining ? NPCID.UmbrellaSlime : NPCID.BlueSlime; + break; + case 2: + npcType = NPCID.IceSlime; + break; + case 3: + npcType = NPCID.RedSlime; + break; + case 4: + npcType = NPCID.PurpleSlime; + break; + case 5: + npcType = NPCID.YellowSlime; + break; + case 6: + npcType = NPCID.SlimeSpiked; + break; + case 7: + npcType = NPCID.SpikedIceSlime; + break; + case 8: + npcType = NPCID.SpikedJungleSlime; + break; + } + + if (((Main.raining && Main.hardMode) || bossRush) && Main.rand.NextBool(50)) + npcType = NPCID.RainbowSlime; + + if (masterMode) + npcType = Main.rand.NextBool() ? NPCID.SpikedIceSlime : NPCID.SpikedJungleSlime; + + if (Main.rand.NextBool(100)) + npcType = NPCID.Pinky; + + if (CalamityWorld.LegendaryMode) + npcType = NPCID.RainbowSlime; + + int spawnZoneWidth = npc.width - 32; + int spawnZoneHeight = npc.height - 32; + int x = (int)(npc.position.X + Main.rand.Next(spawnZoneWidth)); + int y = (int)(npc.position.Y + Main.rand.Next(spawnZoneHeight)); + int slimeSpawns = NPC.NewNPC(npc.GetSource_FromAI(), x, y, npcType); + Main.npc[slimeSpawns].SetDefaults(npcType); + Main.npc[slimeSpawns].velocity.X = Main.rand.Next(-15, 16) * 0.1f; + Main.npc[slimeSpawns].velocity.Y = Main.rand.Next(-30, 31) * 0.1f; + Main.npc[slimeSpawns].ai[0] = -1000 * Main.rand.Next(3); + Main.npc[slimeSpawns].ai[1] = 0f; + + if (Main.netMode == NetmodeID.Server && slimeSpawns < Main.maxNPCs) + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, slimeSpawns); + } + } + } + return false; + } + + // If you think for a fucking second that I'm going to refactor this... + public static bool VanillaKingSlimeAI(NPC npc, Mod mod) + { + float num236 = 1f; + float num237 = 1f; + bool flag6 = false; + bool flag7 = false; + bool flag8 = false; + float num238 = 2f; + if (Main.getGoodWorld) + { + num238 -= 1f - (float)npc.life / (float)npc.lifeMax; + num237 *= num238; + } + + npc.aiAction = 0; + if (npc.ai[3] == 0f && npc.life > 0) + npc.ai[3] = npc.lifeMax; + + if (npc.localAI[3] == 0f) + { + npc.localAI[3] = 1f; + flag6 = true; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.ai[0] = -100f; + npc.TargetClosest(); + npc.netUpdate = true; + } + } + + int num239 = 3000; + if (Main.player[npc.target].dead || Vector2.Distance(npc.Center, Main.player[npc.target].Center) > (float)num239) + { + npc.TargetClosest(); + if (Main.player[npc.target].dead || Vector2.Distance(npc.Center, Main.player[npc.target].Center) > (float)num239) + { + npc.EncourageDespawn(10); + if (Main.player[npc.target].Center.X < npc.Center.X) + npc.direction = 1; + else + npc.direction = -1; + + if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[1] != 5f) + { + npc.netUpdate = true; + npc.ai[2] = 0f; + npc.ai[0] = 0f; + npc.ai[1] = 5f; + npc.localAI[1] = Main.maxTilesX * 16; + npc.localAI[2] = Main.maxTilesY * 16; + } + } + } + + if (!Main.player[npc.target].dead && npc.timeLeft > 10 && npc.ai[2] >= 300f && npc.ai[1] < 5f && npc.velocity.Y == 0f) + { + // Avoid cheap bullshit + npc.damage = 0; + + npc.ai[2] = 0f; + npc.ai[0] = 0f; + npc.ai[1] = 5f; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.TargetClosest(faceTarget: false); + Point point3 = npc.Center.ToTileCoordinates(); + Point point4 = Main.player[npc.target].Center.ToTileCoordinates(); + Vector2 vector30 = Main.player[npc.target].Center - npc.Center; + int num240 = 10; + int num241 = 0; + int num242 = 7; + int num243 = 0; + bool flag9 = false; + if (npc.localAI[0] >= 360f || vector30.Length() > 2000f) + { + if (npc.localAI[0] >= 360f) + npc.localAI[0] = 360f; + + flag9 = true; + num243 = 100; + } + + while (!flag9 && num243 < 100) + { + num243++; + int num244 = Main.rand.Next(point4.X - num240, point4.X + num240 + 1); + int num245 = Main.rand.Next(point4.Y - num240, point4.Y + 1); + if ((num245 >= point4.Y - num242 && num245 <= point4.Y + num242 && num244 >= point4.X - num242 && num244 <= point4.X + num242) || (num245 >= point3.Y - num241 && num245 <= point3.Y + num241 && num244 >= point3.X - num241 && num244 <= point3.X + num241) || Main.tile[num244, num245].HasUnactuatedTile) + continue; + + int num246 = num245; + int num247 = 0; + if (Main.tile[num244, num246].HasUnactuatedTile && Main.tileSolid[Main.tile[num244, num246].TileType] && !Main.tileSolidTop[Main.tile[num244, num246].TileType]) + { + num247 = 1; + } + else + { + for (; num247 < 150 && num246 + num247 < Main.maxTilesY; num247++) + { + int num248 = num246 + num247; + if (Main.tile[num244, num248].HasUnactuatedTile && Main.tileSolid[Main.tile[num244, num248].TileType] && !Main.tileSolidTop[Main.tile[num244, num248].TileType]) + { + num247--; + break; + } + } + } + + num245 += num247; + bool flag10 = true; + if (flag10 && Main.tile[num244, num245].LiquidType == LiquidID.Lava) + flag10 = false; + + if (flag10 && !Collision.CanHitLine(npc.Center, 0, 0, Main.player[npc.target].Center, 0, 0)) + flag10 = false; + + if (flag10) + { + npc.localAI[1] = num244 * 16 + 8; + npc.localAI[2] = num245 * 16 + 16; + flag9 = true; + break; + } + } + + if (num243 >= 100) + { + Vector2 bottom = Main.player[Player.FindClosest(npc.position, npc.width, npc.height)].Bottom; + npc.localAI[1] = bottom.X; + npc.localAI[2] = bottom.Y; + } + } + } + + if (!Collision.CanHitLine(npc.Center, 0, 0, Main.player[npc.target].Center, 0, 0) || Math.Abs(npc.Top.Y - Main.player[npc.target].Bottom.Y) > 160f) + { + npc.ai[2]++; + if (Main.netMode != NetmodeID.MultiplayerClient) + npc.localAI[0]++; + } + else if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.localAI[0]--; + if (npc.localAI[0] < 0f) + npc.localAI[0] = 0f; + } + + if (npc.timeLeft < 10 && (npc.ai[0] != 0f || npc.ai[1] != 0f)) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.netUpdate = true; + flag7 = false; + } + + Dust dust; + if (npc.ai[1] == 5f) + { + // Avoid cheap bullshit + npc.damage = 0; + + flag7 = true; + npc.aiAction = 1; + npc.ai[0]++; + num236 = MathHelper.Clamp((60f - npc.ai[0]) / 60f, 0f, 1f); + num236 = 0.5f + num236 * 0.5f; + if (npc.ai[0] >= 60f) + flag8 = true; + + if (npc.ai[0] == 60f) + Gore.NewGore(npc.GetSource_FromAI(), npc.Center + new Vector2(-40f, -npc.height / 2), npc.velocity, 734); + + if (npc.ai[0] >= 60f && Main.netMode != NetmodeID.MultiplayerClient) + { + npc.Bottom = new Vector2(npc.localAI[1], npc.localAI[2]); + npc.ai[1] = 6f; + npc.ai[0] = 0f; + npc.netUpdate = true; + } + + if (Main.netMode == NetmodeID.MultiplayerClient && npc.ai[0] >= 120f) + { + npc.ai[1] = 6f; + npc.ai[0] = 0f; + } + + if (!flag8) + { + for (int num249 = 0; num249 < 10; num249++) + { + int num250 = Dust.NewDust(npc.position + Vector2.UnitX * -20f, npc.width + 40, npc.height, DustID.TintableDust, npc.velocity.X, npc.velocity.Y, 150, new Color(78, 136, 255, 80), 2f); + Main.dust[num250].noGravity = true; + dust = Main.dust[num250]; + dust.velocity *= 0.5f; + } + } + } + else if (npc.ai[1] == 6f) + { + // Avoid cheap bullshit + npc.damage = 0; + + flag7 = true; + npc.aiAction = 0; + npc.ai[0]++; + num236 = MathHelper.Clamp(npc.ai[0] / 30f, 0f, 1f); + num236 = 0.5f + num236 * 0.5f; + if (npc.ai[0] >= 30f && Main.netMode != NetmodeID.MultiplayerClient) + { + npc.ai[1] = 0f; + npc.ai[0] = -15f; + npc.netUpdate = true; + npc.TargetClosest(); + } + + if (Main.netMode == NetmodeID.MultiplayerClient && npc.ai[0] >= 60f) + { + npc.ai[1] = 0f; + npc.ai[0] = -15f; + npc.TargetClosest(); + } + + for (int num251 = 0; num251 < 10; num251++) + { + int num252 = Dust.NewDust(npc.position + Vector2.UnitX * -20f, npc.width + 40, npc.height, DustID.TintableDust, npc.velocity.X, npc.velocity.Y, 150, new Color(78, 136, 255, 80), 2f); + Main.dust[num252].noGravity = true; + dust = Main.dust[num252]; + dust.velocity *= 2f; + } + } + + npc.dontTakeDamage = (npc.hide = flag8); + if (npc.velocity.Y == 0f) + { + // Avoid cheap bullshit + npc.damage = 0; + + npc.velocity.X *= 0.8f; + if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) + npc.velocity.X = 0f; + + if (!flag7) + { + npc.ai[0] += (MathHelper.Lerp(1f, 13f, 1f - npc.life / (float)npc.lifeMax)); + if (npc.ai[0] >= 0f) + { + // Set damage + npc.damage = npc.defDamage; + + npc.netUpdate = true; + npc.TargetClosest(); + if (npc.ai[1] == 3f) + { + npc.velocity.Y = -13f; + npc.velocity.X += (Main.masterMode ? 5.25f : 3.5f) * (float)npc.direction; + npc.ai[0] = -(Main.masterMode ? 140f : 180f); + npc.ai[1] = 0f; + } + else if (npc.ai[1] == 2f) + { + npc.velocity.Y = -6f; + npc.velocity.X += (Main.masterMode ? 6.75f : 4.5f) * (float)npc.direction; + npc.ai[0] = -(Main.masterMode ? 80f : 100f); + npc.ai[1] += 1f; + } + else + { + npc.velocity.Y = -8f; + npc.velocity.X += (Main.masterMode ? 6f : 4f) * (float)npc.direction; + npc.ai[0] = -(Main.masterMode ? 80f : 100f); + npc.ai[1] += 1f; + } + } + else if (npc.ai[0] >= -30f) + { + npc.aiAction = 1; + } + } + } + else if (npc.target < Main.maxPlayers) + { + float num253 = Main.masterMode ? 4.5f : 3f; + if (Main.getGoodWorld) + num253 = 6f; + + if ((npc.direction == 1 && npc.velocity.X < num253) || (npc.direction == -1 && npc.velocity.X > 0f - num253)) + { + if ((npc.direction == -1 && (double)npc.velocity.X < 0.1) || (npc.direction == 1 && (double)npc.velocity.X > -0.1)) + npc.velocity.X += (Main.masterMode ? 0.3f : 0.2f) * (float)npc.direction; + else + npc.velocity.X *= (Main.masterMode ? 0.86f : 0.93f); + } + } + + int num254 = Dust.NewDust(npc.position, npc.width, npc.height, DustID.TintableDust, npc.velocity.X, npc.velocity.Y, 255, new Color(0, 80, 255, 80), npc.scale * 1.2f); + Main.dust[num254].noGravity = true; + dust = Main.dust[num254]; + dust.velocity *= 0.5f; + if (npc.life <= 0) + return false; + + float num255 = (float)npc.life / (float)npc.lifeMax; + num255 = num255 * 0.5f + 0.75f; + num255 *= num236; + num255 *= num237; + if (num255 != npc.scale || flag6) + { + npc.position.X += npc.width / 2; + npc.position.Y += npc.height; + npc.scale = num255; + npc.width = (int)(98f * npc.scale); + npc.height = (int)(92f * npc.scale); + npc.position.X -= npc.width / 2; + npc.position.Y -= npc.height; + } + + if (Main.netMode == NetmodeID.MultiplayerClient) + return false; + + int num256 = (int)((double)npc.lifeMax * 0.05); + if (!((float)(npc.life + num256) < npc.ai[3])) + return false; + + npc.ai[3] = npc.life; + int num257 = Main.rand.Next(1, 4); + for (int num258 = 0; num258 < num257; num258++) + { + int x = (int)(npc.position.X + (float)Main.rand.Next(npc.width - 32)); + int y = (int)(npc.position.Y + (float)Main.rand.Next(npc.height - 32)); + int num259 = 1; + + int chanceForSpikedSlime = Main.masterMode ? 2 : 4; + if (Main.expertMode && Main.rand.NextBool(chanceForSpikedSlime)) + num259 = NPCID.SlimeSpiked; + + int num260 = NPC.NewNPC(npc.GetSource_FromAI(), x, y, num259); + Main.npc[num260].SetDefaults(num259); + Main.npc[num260].velocity.X = (float)Main.rand.Next(-15, 16) * 0.1f; + Main.npc[num260].velocity.Y = (float)Main.rand.Next(-30, 1) * 0.1f; + Main.npc[num260].ai[0] = -1000 * Main.rand.Next(3); + Main.npc[num260].ai[1] = 0f; + if (Main.netMode == NetmodeID.Server && num260 < Main.maxNPCs) + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num260); + } + + return false; + } + + 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; + Point predictiveTeleportPoint = vectorAimedAheadOfTarget.ToTileCoordinates(); + int randomPredictiveTeleportOffset = 5; + int teleportTries = 0; + while (teleportTries < 100) + { + teleportTries++; + int teleportTileX = Main.rand.Next(predictiveTeleportPoint.X - randomPredictiveTeleportOffset, predictiveTeleportPoint.X + randomPredictiveTeleportOffset + 1); + int teleportTileY = Main.rand.Next(predictiveTeleportPoint.Y - randomPredictiveTeleportOffset, predictiveTeleportPoint.Y); + + if (!Main.tile[teleportTileX, teleportTileY].HasUnactuatedTile) + { + bool canTeleportToTile = true; + if (canTeleportToTile && Main.tile[teleportTileX, teleportTileY].LiquidType == LiquidID.Lava) + canTeleportToTile = false; + if (canTeleportToTile && !Collision.CanHitLine(npc.Center, 0, 0, predictiveTeleportPoint.ToVector2() * 16, 0, 0)) + canTeleportToTile = false; + + if (canTeleportToTile) + { + npc.localAI[1] = teleportTileX * 16 + 8; + npc.localAI[2] = teleportTileY * 16 + 16; + break; + } + else + predictiveTeleportPoint.X += predictiveTeleportPoint.X < 0f ? 1 : -1; + } + else + predictiveTeleportPoint.X += predictiveTeleportPoint.X < 0f ? 1 : -1; + } + + // Default teleport if the above conditions aren't met in 100 iterations + if (teleportTries >= 100) + { + Vector2 bottom = Main.player[Player.FindClosest(npc.position, npc.width, npc.height)].Bottom; + npc.localAI[1] = bottom.X; + npc.localAI[2] = bottom.Y; + } + } + } +} diff --git a/NPCs/VanillaNPCOverrides/Bosses/MoonLordAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/MoonLordAI.cs similarity index 99% rename from NPCs/VanillaNPCOverrides/Bosses/MoonLordAI.cs rename to NPCs/VanillaNPCAIOverrides/Bosses/MoonLordAI.cs index 8efb918101..52a67431e5 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/MoonLordAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/MoonLordAI.cs @@ -8,7 +8,7 @@ using Terraria.GameContent.Events; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses +namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { // This is the most horrible abomination of code I have ever seen in my life, by a fucking landslide. // This took hours of my time to attempt to clean up, and quite frankly I'd be surprised if even half of it is accurate. @@ -185,7 +185,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.dontTakeDamage = true; npc.TargetClosest(false); - Vector2 targetDistance = Main.player[npc.target].Center - npc.Center + new Vector2(0f, 130f); + Vector2 targetDistance = Main.player[npc.target].Center - npc.Center; if (targetDistance.Length() > 20f) { float velocity = death ? 9.5f : 9.25f; @@ -211,8 +211,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses default: break; } + // Move slower if the head is doing the phantasmal deathray if (Main.npc[(int)npc.localAI[2]].ai[0] == 1f) - velocity -= 2f; + velocity -= 2.25f; Vector2 desiredVelocity = Vector2.Normalize(targetDistance - npc.velocity) * velocity; Vector2 velocity2 = npc.velocity; @@ -264,7 +265,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.dontTakeDamage = false; npc.TargetClosest(false); - Vector2 targetDistanceVulnerable = Main.player[npc.target].Center - npc.Center + new Vector2(0f, 130f); + Vector2 targetDistanceVulnerable = Main.player[npc.target].Center - npc.Center; if (targetDistanceVulnerable.Length() > 20f) { float velocity = death ? 9.5f : 9.25f; @@ -290,6 +291,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses default: break; } + // Move slower if the head is doing the phantasmal deathray if (Main.npc[(int)npc.localAI[2]].ai[0] == 1f) velocity -= 2f; @@ -367,7 +369,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses //MoonlordDeathDrama.AddExplosion(npcPosition); for (float j = 0f; j < randDustAmt * 2f; j = ai1 + 1f) { - Dust vortex = Main.dust[Dust.NewDust(npcPosition, 0, 0, 229, 0f, 0f, 0, default, 1f)]; + Dust vortex = Main.dust[Dust.NewDust(npcPosition, 0, 0, DustID.Vortex, 0f, 0f, 0, default, 1f)]; vortex.noGravity = true; vortex.position = npcPosition; vortex.velocity = Vector2.UnitY.RotatedBy(twoPiOverRand + (MathHelper.TwoPi / randDustAmt) * j) * dustVelocityMult * (Main.rand.NextFloat() * 1.6f + 1.6f); @@ -737,7 +739,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses deathrayAttackDustScale = 1.65f; Vector2 deathrayAttackDustRotation = center20 + ((float)Main.rand.NextDouble() * MathHelper.TwoPi).ToRotationVector2() * boltAndDeathrayVector / 2f; - int deathrayAttackDust = Dust.NewDust(deathrayAttackDustRotation - Vector2.One * 8f, 16, 16, 229, npc.velocity.X / 2f, npc.velocity.Y / 2f, 0, default, 1f); + int deathrayAttackDust = Dust.NewDust(deathrayAttackDustRotation - Vector2.One * 8f, 16, 16, DustID.Vortex, npc.velocity.X / 2f, npc.velocity.Y / 2f, 0, default, 1f); Main.dust[deathrayAttackDust].velocity = Vector2.Normalize(center20 - deathrayAttackDustRotation) * 3.5f * (10f - deathrayAttackDustAmt * 2f) / 10f; Main.dust[deathrayAttackDust].noGravity = true; Main.dust[deathrayAttackDust].scale = deathrayAttackDustScale; @@ -914,7 +916,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.localAI[1] = 1f; if (attackTimer == attackTimerComparison - 35f) - SoundEngine.PlaySound(SoundID.NPCDeath6, npc.position); + SoundEngine.PlaySound(SoundID.NPCDeath6, npc.Center); if ((shootFirstBolt || shootSecondBolt || shootThirdBolt) && Main.netMode != NetmodeID.MultiplayerClient) { @@ -1515,7 +1517,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.localAI[1] = 1f; if (handAttackTimer == handAttackTimerComparison - 35f) - SoundEngine.PlaySound(SoundID.NPCDeath6, npc.position); + SoundEngine.PlaySound(SoundID.NPCDeath6, npc.Center); if ((shootFirstBolt || shootSecondBolt || shootThirdBolt) && Main.netMode != NetmodeID.MultiplayerClient) { @@ -1787,7 +1789,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.localAI[2] = MathHelper.Lerp(npc.localAI[2], 0.4f, 0.2f); if (secondAttackTimer == secondAttackPicker - 35f) - SoundEngine.PlaySound(SoundID.NPCDeath6, npc.position); + SoundEngine.PlaySound(SoundID.NPCDeath6, npc.Center); if ((secondAttackTimer == secondAttackPicker - 14f || secondAttackTimer == secondAttackPicker - 7f || secondAttackTimer == secondAttackPicker) && Main.netMode != NetmodeID.MultiplayerClient) { @@ -1860,7 +1862,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses for (int k = 0; k < 2; k++) { - int trueEyeDust = Dust.NewDust(npc.Center + freeEyeRotation - Vector2.One * 4f, 0, 0, 229, 0f, 0f, 0, default, 1f); + int trueEyeDust = Dust.NewDust(npc.Center + freeEyeRotation - Vector2.One * 4f, 0, 0, DustID.Vortex, 0f, 0f, 0, default, 1f); Dust dust = Main.dust[trueEyeDust]; dust.velocity += freeEyeRotation / 15f; Main.dust[trueEyeDust].noGravity = true; @@ -1919,7 +1921,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.ai[2] = (Main.player[npc.target].Center - npc.Center).ToRotation() + MathHelper.PiOver2; - npc.rotation = npc.rotation.AngleTowards(npc.ai[2], 0.104719758f); + npc.rotation = npc.rotation.AngleTowards(npc.ai[2], MathHelper.Pi / 30f); return false; } @@ -2061,7 +2063,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses dustScale = 1.65f; Vector2 trueEyeDustDirection = trueEyeCentering + ((float)Main.rand.NextDouble() * MathHelper.TwoPi).ToRotationVector2() * thirtyVector / 2f; - int trueEyeDust = Dust.NewDust(trueEyeDustDirection - Vector2.One * 8f, 16, 16, 229, npc.velocity.X / 2f, npc.velocity.Y / 2f, 0, default, 1f); + int trueEyeDust = Dust.NewDust(trueEyeDustDirection - Vector2.One * 8f, 16, 16, DustID.Vortex, npc.velocity.X / 2f, npc.velocity.Y / 2f, 0, default, 1f); Main.dust[trueEyeDust].velocity = Vector2.Normalize(trueEyeCentering - trueEyeDustDirection) * 3.5f * (10f - dustAmt * 2f) / 10f; Main.dust[trueEyeDust].noGravity = true; Main.dust[trueEyeDust].scale = dustScale; @@ -2241,7 +2243,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses Vector2 spinningpoint3 = Vector2.UnitY * -npc.height / 2f; for (int i = 0; i < 4; i++) { - int leechDust = Dust.NewDust(npc.Center - Vector2.One * 4f + spinningpoint3.RotatedBy(i * MathHelper.TwoPi / 6f), 0, 0, 229, 0f, 0f, 0, default, 1f); + int leechDust = Dust.NewDust(npc.Center - Vector2.One * 4f + spinningpoint3.RotatedBy(i * MathHelper.TwoPi / 6f), 0, 0, DustID.Vortex, 0f, 0f, 0, default, 1f); Main.dust[leechDust].velocity = -Vector2.UnitY; Main.dust[leechDust].noGravity = true; Main.dust[leechDust].scale = 0.7f; @@ -2251,7 +2253,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses spinningpoint3 = Vector2.UnitY * -npc.height / 6f; for (int j = 0; j < 2; j++) { - int leechDust2 = Dust.NewDust(npc.Center - Vector2.One * 4f + spinningpoint3.RotatedBy(j * MathHelper.TwoPi / 6f), 0, 0, 229, 0f, -2f, 0, default, 1f); + int leechDust2 = Dust.NewDust(npc.Center - Vector2.One * 4f + spinningpoint3.RotatedBy(j * MathHelper.TwoPi / 6f), 0, 0, DustID.Vortex, 0f, -2f, 0, default, 1f); Main.dust[leechDust2].noGravity = true; Main.dust[leechDust2].scale = 1.5f; Main.dust[leechDust2].customData = npc; diff --git a/NPCs/VanillaNPCOverrides/Bosses/PlanteraAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/PlanteraAI.cs similarity index 65% rename from NPCs/VanillaNPCOverrides/Bosses/PlanteraAI.cs rename to NPCs/VanillaNPCAIOverrides/Bosses/PlanteraAI.cs index c4479e2103..8ea83cb22e 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/PlanteraAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/PlanteraAI.cs @@ -1,15 +1,15 @@ -using CalamityMod.Events; -using CalamityMod.Projectiles.Boss; +using System; +using CalamityMod.Events; using CalamityMod.NPCs.NormalNPCs; +using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses +namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { public static class PlanteraAI { @@ -20,6 +20,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses public const float SeedGatlingColorChangeGateValue = SeedGatlingStopValue - SeedGatlingColorChangeDuration; public const float TentaclePhaseSlowDuration = 1200f; public const float ChargePhaseGateValue = 900f; + public const float ChargeTelegraphColorChangeGateValue = ChargePhaseGateValue - SeedGatlingColorChangeDuration; public const float ReduceSpeedForChargeDistance = 480f; public const float BeginChargeGateValue = -120f; public const float BeginChargeSlowDownGateValue = BeginChargeGateValue - 45f; @@ -31,6 +32,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); bool bossRush = BossRushEvent.BossRushActive; + bool masterMode = Main.masterMode || bossRush; bool death = CalamityWorld.death || bossRush; // Get a target @@ -45,20 +47,28 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses float lifeRatio = npc.life / (float)npc.lifeMax; // Phases based on HP + float phase2LifeRatio = 0.5f; bool addThornBallsToGatlingAttack = lifeRatio < 0.85f; bool addSporeGasBlastToGatlingAttack = lifeRatio < 0.75f; - bool phase2 = lifeRatio <= 0.5f; + bool phase2 = lifeRatio <= phase2LifeRatio; bool phase3 = lifeRatio < 0.35f; bool phase4 = lifeRatio < 0.2f; + // Contact damage values for phase 2 + int setDamage = (int)Math.Round(npc.defDamage * 1.4); + int reducedSetDamage = (int)Math.Round(setDamage * 0.5); + // Variables and target bool enrage = bossRush; bool despawn = false; // Check for Jungle bool surface = !bossRush && Main.player[npc.target].position.Y < Main.worldSurface * 16.0; - int maxTentaclesAfterFirstTentaclePhase = death ? 4 : 2; + + // Tentacle limites + int maxTentaclesAfterFirstTentaclePhase = death ? (masterMode ? 5 : 4) : (masterMode ? 3 : 2); int maxFreeTentaclesAfterFirstTentaclePhase = maxTentaclesAfterFirstTentaclePhase * 2; + float speedUpDistance = 480f; bool speedUp = Vector2.Distance(Main.player[npc.target].Center, npc.Center) > speedUpDistance; // 30 or 40 tile distance @@ -77,7 +87,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.active = false; npc.life = 0; if (Main.netMode == NetmodeID.Server) - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, npc.whoAmI, 0f, 0f, 0f, 0, 0, 0); + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, npc.whoAmI); } } @@ -122,7 +132,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses float chargeDeceleration = bossRush ? 0.85f : phase4 ? 0.92f : phase3 ? 0.95f : 0.96f; // Enrage if target is on the surface - if (!bossRush && (surface || Main.player[npc.target].position.Y > ((Main.maxTilesY - 200) * 16))) + if (!bossRush && (surface || Main.player[npc.target].position.Y > Main.UnderworldLayer * 16)) { enrage = true; velocity += 8f; @@ -135,12 +145,21 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses Vector2 npcCenterAccountingForHooks = new Vector2(hookPositionX, hookPositionY); float maxVelocityX = Main.player[npc.target].Center.X - npcCenterAccountingForHooks.X; float maxVelocityY = Main.player[npc.target].Center.Y - npcCenterAccountingForHooks.Y; + bool phase1MoveAway = !phase2 && Vector2.Distance(Main.player[npc.target].Center, npc.Center) < 480f && Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height); + bool adjustProjectileShootLocation = Vector2.Distance(Main.player[npc.target].Center, npc.Center) < 80f; if (despawn) { maxVelocityY *= -1f; maxVelocityX *= -1f; velocity += 8f; } + else if (phase1MoveAway) + { + maxVelocityY *= -1f; + maxVelocityX *= -1f; + velocity *= 1.5f; + acceleration *= 2f; + } float distanceFromTarget = (float)Math.Sqrt(maxVelocityX * maxVelocityX + maxVelocityY * maxVelocityY); if (death) @@ -149,6 +168,20 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses acceleration += acceleration * 0.25f * (1f - lifeRatio); } + if (masterMode) + { + velocity += velocity * 0.1f * (1f - lifeRatio); + acceleration += acceleration * 0.1f * (1f - lifeRatio); + if (phase2) + { + float aggressionScale = (phase2LifeRatio - lifeRatio) / phase2LifeRatio; + chargeLineUpVelocity += chargeLineUpVelocity * 0.25f * aggressionScale; + chargeLineUpAcceleration += chargeLineUpAcceleration * 0.25f * aggressionScale; + chargeVelocity += chargeVelocity * 0.25f * aggressionScale; + chargeDeceleration -= 0.05f * aggressionScale; + } + } + if (Main.getGoodWorld) { velocity *= 1.15f; @@ -190,8 +223,8 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses float projectileSpeed = 14f; int projectileType = shootThornBall ? ProjectileID.ThornBall : shootPoisonSeed ? ProjectileID.PoisonSeedPlantera : ProjectileID.SeedPlantera; int damage = npc.GetProjectileDamage(projectileType); - Vector2 projectileVelocity = Vector2.Normalize(Main.player[npc.target].Center - npc.Center); - Vector2 spawnOffset = npc.Center + projectileVelocity * 50f; + Vector2 projectileVelocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY); + Vector2 spawnOffset = npc.Center + projectileVelocity * 70f; int dustType = shootPoisonSeed ? 74 : 73; int dustSpawnBoxSize = shootThornBall ? 38 : 14; @@ -206,7 +239,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (Main.netMode != NetmodeID.MultiplayerClient) { - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), spawnOffset, projectileVelocity * projectileSpeed, projectileType, damage, 0f, Main.myPlayer); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), adjustProjectileShootLocation ? npc.Center : spawnOffset, projectileVelocity * projectileSpeed, projectileType, damage, 0f, Main.myPlayer); if (projectileType == ProjectileID.ThornBall && (Main.rand.NextBool() || !Main.zenithWorld)) Main.projectile[proj].tileCollide = false; } @@ -225,12 +258,11 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses int dustChance = (int)Math.Round(MathHelper.Lerp(dustInXChanceMin, dustInXChanceMax, 1f - dustEmitAmount / SeedGatlingColorChangeDuration)); if (Main.rand.NextBool(dustChance)) { - int dust = Dust.NewDust(npc.position, npc.width, npc.height, 74, 0f, 0f, 0, default, 1.4f); - Vector2 vector = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101)); - vector.Normalize(); + int dust = Dust.NewDust(npc.position, npc.width, npc.height, DustID.GreenFairy, 0f, 0f, 0, default, 1.4f); + Vector2 vector = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101)).SafeNormalize(Vector2.UnitY); vector *= Main.rand.Next(50, 100) * 0.04f; Main.dust[dust].velocity = vector; - vector.Normalize(); + vector = vector.SafeNormalize(Vector2.UnitY); vector *= 86f; Main.dust[dust].position = npc.Center - vector; } @@ -243,7 +275,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (addSporeGasBlastToGatlingAttack) { SoundEngine.PlaySound(SoundID.Item74, npc.Center); - int totalProjectiles = 30; + int totalProjectiles = masterMode ? 36 : 30; float radians = MathHelper.TwoPi / totalProjectiles; int type = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); @@ -252,8 +284,8 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses for (int k = 0; k < totalProjectiles; k++) { Vector2 projectileVelocity = spinningPoint.RotatedBy(radians * k); - Vector2 spawnOffset = npc.Center + Vector2.Normalize(projectileVelocity) * 50f; - float randomSpeed = Main.rand.NextFloat(0.8f, 1.2f); + Vector2 spawnOffset = npc.Center + projectileVelocity.SafeNormalize(Vector2.UnitY) * 50f; + float randomSpeed = Main.rand.NextFloat(0.8f, masterMode ? 1.5f : 1.2f); int dustType = 74; Vector2 dustVelocity = projectileVelocity * randomSpeed; @@ -265,7 +297,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses float ai0 = Main.rand.Next(3); if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(npc.GetSource_FromAI(), spawnOffset, projectileVelocity * randomSpeed, type, damage, 0f, Main.myPlayer, ai0); + Projectile.NewProjectile(npc.GetSource_FromAI(), adjustProjectileShootLocation ? npc.Center : spawnOffset, projectileVelocity * randomSpeed, type, damage, 0f, Main.myPlayer, ai0); } } @@ -282,9 +314,12 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Prepare to charge // More charges are used in a row at lower HP - if (doneWithTentaclePhase && !charging) + if (doneWithTentaclePhase && !charging && !despawn) { float timeToChargeIncrement = phase4 ? 2f : phase3 ? 1.5f : 1f; + if (masterMode) + timeToChargeIncrement *= 2f; + npc.ai[3] += timeToChargeIncrement; if (npc.ai[3] >= ChargePhaseGateValue) npc.ai[3] = -2f; @@ -308,8 +343,8 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses float projectileSpeed = 9f; int projectileType = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(projectileType); - Vector2 projectileVelocity = Vector2.Normalize(Main.player[npc.target].Center - npc.Center); - Vector2 spawnOffset = npc.Center + projectileVelocity * 50f; + Vector2 projectileVelocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY); + Vector2 spawnOffset = npc.Center + projectileVelocity * 70f; int dustType = 73; Vector2 dustVelocity = projectileVelocity * projectileSpeed; @@ -321,7 +356,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(npc.GetSource_FromAI(), spawnOffset, projectileVelocity * projectileSpeed, projectileType, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(npc.GetSource_FromAI(), adjustProjectileShootLocation ? npc.Center : spawnOffset, projectileVelocity * projectileSpeed, projectileType, damage, 0f, Main.myPlayer); } } @@ -330,6 +365,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Slow down and return to normal behavior if (npc.ai[3] <= BeginChargeSlowDownGateValue) { + // Avoid cheap bullshit + npc.damage = reducedSetDamage; + npc.velocity *= chargeDeceleration; float timeToDecelerateDecrement = bossRush ? 2f : phase4 ? 1.5f : 1f; npc.ai[3] -= timeToDecelerateDecrement; @@ -357,13 +395,17 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Emit spore gas in phase 3 else if (npc.ai[3] <= BeginChargeGateValue) { + // Set damage + npc.damage = setDamage; + float sporeGasDashGateValue = death ? 4f : 6f; if (phase3 && npc.ai[3] % sporeGasDashGateValue == 0f) { int projectileType = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(projectileType); - Vector2 projectileVelocity = npc.velocity * Main.rand.NextVector2CircularEdge(0.2f, 0.2f); - Vector2 spawnOffset = npc.Center + Vector2.Normalize(projectileVelocity) * 30f; + float randomVelocityMultiplier = masterMode ? 0.3f : 0.2f; + Vector2 projectileVelocity = npc.velocity * Main.rand.NextVector2CircularEdge(randomVelocityMultiplier, randomVelocityMultiplier); + Vector2 spawnOffset = npc.Center + projectileVelocity.SafeNormalize(Vector2.UnitY) * 30f; int dustType = 74; Vector2 dustVelocity = projectileVelocity; @@ -386,6 +428,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Move a specified distance away from the target and charge once that distance is reached else { + // Avoid cheap bullshit + npc.damage = reducedSetDamage; + // Line up before charging if (npc.Calamity().newAI[0] == 0f) { @@ -395,7 +440,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses Vector2 destination = Main.player[npc.target].Center + new Vector2(npc.Calamity().newAI[0], 0); Vector2 distanceFromDestination = destination - npc.Center; - Vector2 desiredVelocity = Vector2.Normalize(distanceFromDestination - npc.velocity) * chargeLineUpVelocity; + Vector2 desiredVelocity = (distanceFromDestination - npc.velocity).SafeNormalize(Vector2.UnitY) * chargeLineUpVelocity; if (Vector2.Distance(npc.Center, destination) > ReduceSpeedForChargeDistance) npc.SimpleFlyMovement(desiredVelocity, chargeLineUpAcceleration); @@ -409,35 +454,40 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses int dustChance = (int)Math.Round(MathHelper.Lerp(dustInXChanceMin, dustInXChanceMax, 1f - dustEmitAmount / Math.Abs(BeginChargeGateValue))); if (Main.rand.NextBool(dustChance)) { - int dust = Dust.NewDust(npc.position, npc.width, npc.height, 74, 0f, 0f, 0, default, 1.4f); - Vector2 vector = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101)); - vector.Normalize(); + int dust = Dust.NewDust(npc.position, npc.width, npc.height, DustID.GreenFairy, 0f, 0f, 0, default, 1.4f); + Vector2 vector = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101)).SafeNormalize(Vector2.UnitY); vector *= Main.rand.Next(50, 100) * 0.04f; Main.dust[dust].velocity = vector; - vector.Normalize(); + vector = vector.SafeNormalize(Vector2.UnitY); vector *= 86f; Main.dust[dust].position = npc.Center - vector; } float timeToLineUpChargeDecrement = phase4 ? 2f : 1f; + if (masterMode) + timeToLineUpChargeDecrement *= 2f; + npc.ai[3] -= timeToLineUpChargeDecrement; if (npc.ai[3] <= BeginChargeGateValue) { + // Set damage + npc.damage = setDamage; + // Charge npc.ai[3] = BeginChargeGateValue; - npc.velocity = Vector2.Normalize(Main.player[npc.target].Center - npc.Center) * chargeVelocity; + npc.velocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * chargeVelocity; SoundEngine.PlaySound(SoundID.Item74, npc.Center); // Spore dust cloud Vector2 dustVelocity = npc.velocity * -0.25f; for (int k = 0; k < 30; k++) { - Dust dust = Dust.NewDustDirect(npc.Center, npc.width, npc.height, 44, dustVelocity.X, dustVelocity.Y, 250, default, 0.8f); + Dust dust = Dust.NewDustDirect(npc.Center, npc.width, npc.height, DustID.JungleSpore, dustVelocity.X, dustVelocity.Y, 250, default, 0.8f); dust.fadeIn = 0.7f; } // Vomit spread of spore gas - int totalProjectiles = 12; + int totalProjectiles = masterMode ? 18 : 12; float radians = MathHelper.TwoPi / totalProjectiles; int type = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); @@ -446,8 +496,8 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses for (int k = 0; k < totalProjectiles; k++) { Vector2 projectileVelocity = spinningPoint.RotatedBy(radians * k); - Vector2 spawnOffset = npc.Center + Vector2.Normalize(projectileVelocity) * 50f; - float randomSpeed = Main.rand.NextFloat(0.8f, 1.2f); + Vector2 spawnOffset = npc.Center + projectileVelocity.SafeNormalize(Vector2.UnitY) * 50f; + float randomSpeed = Main.rand.NextFloat(0.8f, masterMode ? 1.5f : 1.2f); int dustType = 74; Vector2 dustVelocity2 = projectileVelocity * randomSpeed; @@ -471,6 +521,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } else { + // Avoid cheap bullshit + npc.damage = phase2 ? reducedSetDamage : 0; + // Velocity ranges from 4 to 7.2, Acceleration ranges from 0.04 to 0.072, non-enraged phase 1 // Velocity ranges from 7 to 12.6, Acceleration ranges from 0.07 to 0.126, non-enraged phase 2 // Velocity ranges from 9 to 16.2, Acceleration ranges from 0.07 to 0.126, non-enraged phase 3 @@ -482,6 +535,8 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses maxDistanceFromHooks += 150f; if (death) maxDistanceFromHooks += maxDistanceFromHooks * 0.2f * (1f - lifeRatio); + if (masterMode) + maxDistanceFromHooks += 200f; if (distanceFromTarget >= maxDistanceFromHooks) { @@ -550,7 +605,6 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses calamityGlobalNPC.DR = 0.15f; calamityGlobalNPC.unbreakableDR = false; npc.defense = 32; - npc.damage = npc.defDamage; // Fire projectiles if (!usingSeedGatling && !slowedAfterGatlingAttack) @@ -564,17 +618,17 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (Main.getGoodWorld) npc.localAI[1] += 1f; - float shootProjectileGateValue = death ? 40f : 60f; + float shootProjectileGateValue = death ? (masterMode ? 30f : 40f) : (masterMode ? 45f : 60f); if (npc.localAI[1] >= shootProjectileGateValue) { npc.localAI[1] = 0f; npc.TargetClosest(); - bool shootPoisonSeed = CalamityWorld.LegendaryMode || Main.rand.NextBool(4); + bool shootPoisonSeed = CalamityWorld.LegendaryMode || Main.rand.NextBool(masterMode ? 2 : 4); int projectileType = shootPoisonSeed ? ProjectileID.PoisonSeedPlantera : ProjectileID.SeedPlantera; - float projectileSpeed = 14f; + float projectileSpeed = masterMode ? 16f : 14f; int damage = npc.GetProjectileDamage(projectileType); - Vector2 projectileVelocity = Vector2.Normalize(Main.player[npc.target].Center - npc.Center); - Vector2 spawnOffset = npc.Center + projectileVelocity * 50f; + Vector2 projectileVelocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY); + Vector2 spawnOffset = npc.Center + projectileVelocity * 70f; int dustType = shootPoisonSeed ? 74 : 73; Vector2 dustVelocity = projectileVelocity * projectileSpeed; @@ -586,7 +640,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(npc.GetSource_FromAI(), spawnOffset, projectileVelocity * projectileSpeed, projectileType, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(npc.GetSource_FromAI(), adjustProjectileShootLocation ? npc.Center : spawnOffset, projectileVelocity * projectileSpeed, projectileType, damage, 0f, Main.myPlayer); } } } @@ -600,7 +654,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Spore dust if (Main.rand.NextBool(10)) { - Dust dust = Dust.NewDustDirect(npc.position, npc.width, npc.height, 44, 0f, 0f, 250, default, 0.6f); + Dust dust = Dust.NewDustDirect(npc.position, npc.width, npc.height, DustID.JungleSpore, 0f, 0f, 250, default, 0.6f); dust.fadeIn = 0.7f; } @@ -608,7 +662,6 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses calamityGlobalNPC.DR = 0.15f; calamityGlobalNPC.unbreakableDR = false; npc.defense = 10; - npc.damage = (int)(npc.defDamage * 1.4f); // Spawn tentacles if (Main.netMode != NetmodeID.MultiplayerClient) @@ -616,7 +669,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.localAI[0] == 1f) { npc.localAI[0] = 2f; - int totalTentacles = death ? 10 : 8; + int totalTentacles = death ? (masterMode ? 15 : 10) : (masterMode ? 12 : 8); if (Main.getGoodWorld) totalTentacles += 6; if (CalamityWorld.LegendaryMode) @@ -653,6 +706,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses bool noAttachedTentacles = !NPC.AnyNPCs(NPCID.PlanterasTentacle); bool noFreeTentacles = !NPC.AnyNPCs(ModContent.NPCType()); float tentacleIdleTimerDecrement = (noAttachedTentacles && noFreeTentacles) ? 4f : noAttachedTentacles ? 2f : 1f; + if (masterMode) + tentacleIdleTimerDecrement *= 2f; + npc.ai[2] -= tentacleIdleTimerDecrement; if (npc.ai[2] <= 0f) npc.ai[2] = -1f; @@ -681,7 +737,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (bossRush) projectileSpeed += 4f; - Vector2 projectileVelocity = Vector2.Normalize(Main.player[npc.target].Center - npc.Center); + Vector2 projectileVelocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY); int spread = 8 + (int)Math.Round((0.5f - lifeRatio) * 16f); // 8 to 16, wider spread is harder to avoid int numProj = spread / 2; @@ -698,7 +754,10 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { bool shootPinkSeed = i % 2 == 0; if (shootPinkSeed) + { type = ProjectileID.SeedPlantera; + damage = npc.GetProjectileDamage(type); + } else type = ProjectileID.PoisonSeedPlantera; @@ -715,7 +774,50 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(npc.GetSource_FromAI(), spawnOffset, perturbedSpeed * projectileSpeed, type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(npc.GetSource_FromAI(), spawnOffset, perturbedSpeed * projectileSpeed * 0.5f, type, damage, 0f, Main.myPlayer, 0f, 0f, projectileSpeed); + } + + if (death) + { + bool shootThornBall = true; + int numThornBalls = 0; + int thornBallLimit = 3; + for (int i = 0; i < Main.maxProjectiles; i++) + { + if (Main.projectile[i].active && Main.projectile[i].type == ProjectileID.ThornBall) + { + numThornBalls++; + if (numThornBalls >= thornBallLimit) + { + shootThornBall = false; + break; + } + } + } + + if (shootThornBall) + { + type = ProjectileID.ThornBall; + damage = npc.GetProjectileDamage(type); + Vector2 spawnOffset = npc.Center + projectileVelocity * 50f; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), spawnOffset, projectileVelocity * projectileSpeed, type, damage, 0f, Main.myPlayer); + if (Main.rand.NextBool() || !Main.zenithWorld) + Main.projectile[proj].tileCollide = false; + } + } + } + + if (masterMode && Main.netMode != NetmodeID.MultiplayerClient) + { + float sporeSpeed = 12f; + Vector2 sporeVelocity = projectileVelocity * sporeSpeed; + int spore = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.Spore); + Main.npc[spore].velocity.X = sporeVelocity.X; + Main.npc[spore].velocity.Y = sporeVelocity.Y; + Main.npc[spore].netUpdate = true; } npc.localAI[3] = 0f; @@ -726,24 +828,23 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Heal if on surface if (surface) { - if (Main.rand.NextBool(Main.dayTime ? 3 : 6)) + if (Main.rand.NextBool(Main.IsItDay() ? 3 : 6)) { - int dust = Dust.NewDust(npc.position, npc.width, npc.height, 55, 0f, 0f, 200, default, 0.5f); + int dust = Dust.NewDust(npc.position, npc.width, npc.height, DustID.Pixie, 0f, 0f, 200, default, 0.5f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 0.75f; Main.dust[dust].fadeIn = 1.3f; - Vector2 vector = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101)); - vector.Normalize(); + Vector2 vector = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101)).SafeNormalize(Vector2.UnitY); vector *= Main.rand.Next(50, 100) * 0.04f; Main.dust[dust].velocity = vector; - vector.Normalize(); + vector = vector.SafeNormalize(Vector2.UnitY); vector *= 86f; Main.dust[dust].position = npc.Center - vector; } // Heal, 100 (50 during daytime) seconds to reach full HP from 0 calamityGlobalNPC.newAI[1] += 1f; - if (calamityGlobalNPC.newAI[1] >= (Main.dayTime ? 30f : 60f)) + if (calamityGlobalNPC.newAI[1] >= (Main.IsItDay() ? 30f : 60f)) { calamityGlobalNPC.newAI[1] = 0f; npc.SyncExtraAI(); @@ -779,7 +880,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { int spore = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.Spore, npc.whoAmI); float sporeSpeed = death ? 9f : 6f; - Vector2 sporeVelocity = Vector2.Normalize(Main.player[npc.target].Center - npc.Center) * sporeSpeed; + Vector2 sporeVelocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * sporeSpeed; Main.npc[spore].velocity.X = sporeVelocity.X; Main.npc[spore].velocity.Y = sporeVelocity.Y; Main.npc[spore].netUpdate = true; @@ -796,6 +897,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Variables bool enrage = BossRushEvent.BossRushActive; bool despawn = false; + bool masterMode = Main.masterMode || enrage; bool death = CalamityWorld.death || enrage; // Despawn if Plantera is gone @@ -815,7 +917,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses despawn = true; // Enrage if Plantera's target is on the surface - if (!enrage && ((Main.player[Main.npc[NPC.plantBoss].target].position.Y < Main.worldSurface * 16.0 || Main.player[Main.npc[NPC.plantBoss].target].position.Y > ((Main.maxTilesY - 200) * 16)) | despawn)) + if (!enrage && ((Main.player[Main.npc[NPC.plantBoss].target].position.Y < Main.worldSurface * 16.0 || Main.player[Main.npc[NPC.plantBoss].target].position.Y > Main.UnderworldLayer * 16) | despawn)) { npc.localAI[0] -= 4f; enrage = true; @@ -838,7 +940,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.localAI[0] = 0f; // Timer dictating whether to pick a new location or not - float moveBoost = death ? 4f * (1f - lifeRatio) : 2f * (1f - lifeRatio); + float moveBoost = death ? (masterMode ? 6f : 4f) * (1f - lifeRatio) : (masterMode ? 3f : 2f) * (1f - lifeRatio); npc.localAI[0] -= 1f + moveBoost; if (enrage) npc.localAI[0] -= 6f; @@ -907,7 +1009,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.ai[0] > 0f && npc.ai[1] > 0f) { // Hook movement velocity - float velocityBoost = death ? 6f * (1f - lifeRatio) : 3f * (1f - lifeRatio); + float velocityBoost = death ? (masterMode ? 9f : 6f) * (1f - lifeRatio) : (masterMode ? 5f : 3f) * (1f - lifeRatio); float velocity = 7f + velocityBoost; if (enrage) velocity *= 2f; @@ -954,19 +1056,17 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - // Percent life remaining - float lifeRatio = npc.life / (float)npc.lifeMax; - // Emit light - Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 0.2f, 0.4f, 0.1f); + Lighting.AddLight((int)(npc.Center.X / 16f), (int)(npc.Center.Y / 16f), 0.2f, 0.4f, 0.1f); // Spore dust if (Main.rand.NextBool(10)) { - Dust dust = Dust.NewDustDirect(npc.position, npc.width, npc.height, 44, 0f, 0f, 250, default, 0.4f); + Dust dust = Dust.NewDustDirect(npc.position, npc.width, npc.height, DustID.JungleSpore, 0f, 0f, 250, default, 0.4f); dust.fadeIn = 0.7f; } + bool masterMode = Main.masterMode || BossRushEvent.BossRushActive; bool death = CalamityWorld.death || BossRushEvent.BossRushActive; if (Main.getGoodWorld) @@ -1008,22 +1108,31 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.damage = npc.defDamage; // Movement variables + int maxOffset = 100; if (Main.netMode != NetmodeID.MultiplayerClient) { if (npc.ai[0] == 0f || npc.ai[1] == 0f) { - npc.ai[0] = Main.rand.Next(-100, 101); - npc.ai[1] = Main.rand.Next(-100, 101); + npc.ai[0] = Main.rand.Next(-maxOffset, maxOffset + 1); + npc.ai[1] = Main.rand.Next(-maxOffset, maxOffset + 1); npc.netUpdate = true; } } // Velocity and acceleration float tentacleAcceleration = death ? 2.4f : 1.6f; - float extendedDistanceFromPlantera = (1f - lifeRatio) * 2f; + float extendedDistanceFromPlantera = Math.Abs(npc.ai[0] + npc.ai[1]) / maxOffset; float tentacleVelocity = 100f + (extendedDistanceFromPlantera * 300f); float deceleration = (death ? 0.5f : 0.8f) / (1f + extendedDistanceFromPlantera); + if (masterMode) + { + tentacleAcceleration *= 1.25f; + extendedDistanceFromPlantera *= 1.1f; + tentacleVelocity *= 1.25f; + deceleration *= 0.75f; + } + if (Main.getGoodWorld) tentacleAcceleration += 4f; @@ -1094,5 +1203,378 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses return false; } + + public static bool VanillaPlanteraAI(NPC npc, Mod mod) + { + bool flag39 = false; + bool flag40 = false; + npc.TargetClosest(); + if (Main.player[npc.target].dead) + { + flag40 = true; + flag39 = true; + } + else if (Main.netMode != NetmodeID.MultiplayerClient && npc.target >= 0 && npc.target < Main.maxPlayers) + { + int despawnDistance = 4800; + if (npc.timeLeft < NPC.activeTime && Vector2.Distance(npc.Center, Main.player[npc.target].Center) < (float)despawnDistance) + npc.timeLeft = NPC.activeTime; + } + + NPC.plantBoss = npc.whoAmI; + if (npc.localAI[0] == 0f && Main.netMode != NetmodeID.MultiplayerClient) + { + npc.localAI[0] = 1f; + int hook = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.PlanterasHook, npc.whoAmI); + hook = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.PlanterasHook, npc.whoAmI); + hook = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.PlanterasHook, npc.whoAmI); + } + + int[] array2 = new int[3]; + float num775 = 0f; + float num776 = 0f; + int num777 = 0; + for (int num778 = 0; num778 < Main.maxNPCs; num778++) + { + if (Main.npc[num778].active && Main.npc[num778].aiStyle == NPCAIStyleID.PlanteraHook) + { + num775 += Main.npc[num778].Center.X; + num776 += Main.npc[num778].Center.Y; + array2[num777] = num778; + num777++; + if (num777 > 2) + break; + } + } + + num775 /= (float)num777; + num776 /= (float)num777; + float num779 = 2.5f; + float num780 = 0.025f; + if (npc.life < npc.lifeMax / 2) + { + num779 = 5f; + num780 = 0.05f; + } + + if (npc.life < npc.lifeMax / 4) + num779 = 7f; + + if (!Main.player[npc.target].ZoneJungle || (double)Main.player[npc.target].position.Y < Main.worldSurface * 16.0 || Main.player[npc.target].position.Y > (float)(Main.UnderworldLayer * 16)) + { + flag39 = true; + num779 += 8f; + num780 = 0.15f; + } + + npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive && flag39; + + if (Main.expertMode) + { + num779 += (Main.masterMode ? 2f : 1f); + num779 *= (Main.masterMode ? 1.2f : 1.1f); + num780 += (Main.masterMode ? 0.02f : 0.01f); + num780 *= (Main.masterMode ? 1.2f : 1.1f); + } + + if (Main.getGoodWorld) + { + num779 *= 1.15f; + num780 *= 1.15f; + } + + Vector2 vector97 = new Vector2(num775, num776); + float num781 = Main.player[npc.target].Center.X - vector97.X; + float num782 = Main.player[npc.target].Center.Y - vector97.Y; + bool phase1MoveAway = npc.life > npc.lifeMax / 2 && Vector2.Distance(Main.player[npc.target].Center, npc.Center) < 480f && Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height); + bool adjustProjectileShootLocation = Vector2.Distance(Main.player[npc.target].Center, npc.Center) < 80f; + if (flag40) + { + num782 *= -1f; + num781 *= -1f; + num779 += 8f; + } + else if (phase1MoveAway) + { + num782 *= -1f; + num781 *= -1f; + num779 *= 1.5f; + num780 *= 2f; + } + + float num783 = (float)Math.Sqrt(num781 * num781 + num782 * num782); + int num784 = 500; + if (flag39) + num784 += 350; + + if (Main.expertMode) + num784 += (Main.masterMode ? 300 : 150); + + if (num783 >= (float)num784) + { + num783 = (float)num784 / num783; + num781 *= num783; + num782 *= num783; + } + + num775 += num781; + num776 += num782; + vector97 = npc.Center; + num781 = num775 - vector97.X; + num782 = num776 - vector97.Y; + num783 = (float)Math.Sqrt(num781 * num781 + num782 * num782); + if (num783 < num779) + { + num781 = npc.velocity.X; + num782 = npc.velocity.Y; + } + else + { + num783 = num779 / num783; + num781 *= num783; + num782 *= num783; + } + + if (npc.velocity.X < num781) + { + npc.velocity.X += num780; + if (npc.velocity.X < 0f && num781 > 0f) + npc.velocity.X += num780 * 2f; + } + else if (npc.velocity.X > num781) + { + npc.velocity.X -= num780; + if (npc.velocity.X > 0f && num781 < 0f) + npc.velocity.X -= num780 * 2f; + } + + if (npc.velocity.Y < num782) + { + npc.velocity.Y += num780; + if (npc.velocity.Y < 0f && num782 > 0f) + npc.velocity.Y += num780 * 2f; + } + else if (npc.velocity.Y > num782) + { + npc.velocity.Y -= num780; + if (npc.velocity.Y > 0f && num782 < 0f) + npc.velocity.Y -= num780 * 2f; + } + + Vector2 vector98 = npc.Center; + float num785 = Main.player[npc.target].Center.X - vector98.X; + float num786 = Main.player[npc.target].Center.Y - vector98.Y; + npc.rotation = (float)Math.Atan2(num786, num785) + MathHelper.PiOver2; + if (npc.life > npc.lifeMax / 2) + { + npc.defense = 36; + if (flag39) + npc.defense *= 2; + + // Avoid cheap bullshit + npc.damage = 0; + + if (Main.netMode == NetmodeID.MultiplayerClient) + return false; + + npc.localAI[1] += 1f; + if ((double)npc.life < (double)npc.lifeMax * 0.9) + npc.localAI[1] += 1f; + + if ((double)npc.life < (double)npc.lifeMax * 0.8) + npc.localAI[1] += 1f; + + if ((double)npc.life < (double)npc.lifeMax * 0.7) + npc.localAI[1] += 1f; + + if ((double)npc.life < (double)npc.lifeMax * 0.6) + npc.localAI[1] += 1f; + + if (flag39) + npc.localAI[1] += 3f; + + if (Main.expertMode) + npc.localAI[1] += (Main.masterMode ? 2f : 1f); + + if (Main.expertMode && npc.justHit && Main.rand.NextBool()) + npc.localAI[3] = (Main.masterMode ? 2f : 1f); + + if (Main.getGoodWorld) + npc.localAI[1] += 1f; + + if (!(npc.localAI[1] > 80f)) + return false; + + npc.localAI[1] = 0f; + bool flag41 = Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height); + if (npc.localAI[3] > 0f) + { + flag41 = true; + npc.localAI[3] = 0f; + } + + if (flag41) + { + Vector2 vector99 = npc.Center; + float num788 = 15f; + if (Main.expertMode) + num788 = Main.masterMode ? 19f : 17f; + + float num789 = Main.player[npc.target].Center.X - vector99.X; + float num790 = Main.player[npc.target].Center.Y - vector99.Y; + float num791 = (float)Math.Sqrt(num789 * num789 + num790 * num790); + num791 = num788 / num791; + num789 *= num791; + num790 *= num791; + int type = Main.masterMode ? ProjectileID.PoisonSeedPlantera : ProjectileID.SeedPlantera; + int maxValue2 = 4; + int thornBallChance = 8; + if (Main.expertMode) + { + maxValue2 = 2; + thornBallChance = Main.masterMode ? 5 : 6; + } + + if ((double)npc.life < npc.lifeMax * 0.8 && Main.rand.NextBool(maxValue2) && !Main.masterMode) + { + npc.localAI[1] = -30f; + type = ProjectileID.PoisonSeedPlantera; + } + else if ((double)npc.life < npc.lifeMax * 0.8 && Main.rand.NextBool(thornBallChance)) + { + bool shootThornBall = true; + int numThornBalls = 0; + int thornBallLimit = 3; + for (int i = 0; i < Main.maxProjectiles; i++) + { + if (Main.projectile[i].active && Main.projectile[i].type == ProjectileID.ThornBall) + { + numThornBalls++; + if (numThornBalls >= thornBallLimit) + { + shootThornBall = false; + break; + } + } + } + + npc.localAI[1] = shootThornBall ? -120f : -30f; + type = shootThornBall ? ProjectileID.ThornBall : ProjectileID.PoisonSeedPlantera; + } + else if (Main.masterMode) + npc.localAI[1] = -30f; + + int damage = npc.GetProjectileDamage(type); + if (flag39) + damage *= 2; + + Vector2 projectileVelocity = new Vector2(num789, num790); + int num794 = Projectile.NewProjectile(npc.GetSource_FromAI(), adjustProjectileShootLocation ? vector99 : vector99 + projectileVelocity.SafeNormalize(Vector2.UnitY) * 70f, projectileVelocity, type, damage, 0f, Main.myPlayer); + if (type != ProjectileID.ThornBall) + Main.projectile[num794].timeLeft = 300; + } + + return false; + } + + npc.defense = 10; + int setDamage = (int)Math.Round(npc.defDamage * 1.4); + if (flag39) + { + npc.defense *= 4; + setDamage *= 2; + } + + npc.damage = setDamage; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (npc.localAI[0] == 1f) + { + npc.localAI[0] = 2f; + int num796 = Main.masterMode ? 12 : 8; + if (Main.getGoodWorld) + num796 += 6; + + for (int num797 = 0; num797 < num796; num797++) + NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.PlanterasTentacle, npc.whoAmI); + + if (Main.expertMode) + { + for (int num799 = 0; num799 < Main.maxNPCs; num799++) + { + if (Main.npc[num799].active && Main.npc[num799].aiStyle == NPCAIStyleID.PlanteraHook) + { + for (int num800 = 0; num800 < num796 / 2 - 1; num800++) + { + int num801 = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.PlanterasTentacle, npc.whoAmI); + Main.npc[num801].ai[3] = num799 + 1; + } + } + } + } + } + else if (Main.expertMode && Main.rand.NextBool(Main.masterMode ? 50 : 60)) + { + int num802 = 0; + for (int num803 = 0; num803 < Main.maxNPCs; num803++) + { + if (Main.npc[num803].active && Main.npc[num803].type == NPCID.PlanterasTentacle && Main.npc[num803].ai[3] == 0f) + num802++; + } + + if (num802 < (Main.masterMode ? 12 : 8) && Main.rand.Next((num802 + 1) * 10) <= 1) + NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.PlanterasTentacle, npc.whoAmI); + } + } + + if (npc.localAI[2] == 0f) + { + Gore.NewGore(npc.GetSource_FromAI(), new Vector2(npc.position.X + (float)Main.rand.Next(npc.width), npc.position.Y + (float)Main.rand.Next(npc.height)), npc.velocity, 378, npc.scale); + Gore.NewGore(npc.GetSource_FromAI(), new Vector2(npc.position.X + (float)Main.rand.Next(npc.width), npc.position.Y + (float)Main.rand.Next(npc.height)), npc.velocity, 379, npc.scale); + Gore.NewGore(npc.GetSource_FromAI(), new Vector2(npc.position.X + (float)Main.rand.Next(npc.width), npc.position.Y + (float)Main.rand.Next(npc.height)), npc.velocity, 380, npc.scale); + npc.localAI[2] = 1f; + } + + if (Main.netMode == NetmodeID.MultiplayerClient) + return false; + + npc.localAI[1] += 1f; + if ((double)npc.life < (double)npc.lifeMax * 0.4) + npc.localAI[1] += 1f; + + if ((double)npc.life < (double)npc.lifeMax * 0.3) + npc.localAI[1] += 1f; + + if ((double)npc.life < (double)npc.lifeMax * 0.2) + npc.localAI[1] += 1f; + + if ((double)npc.life < (double)npc.lifeMax * 0.1) + npc.localAI[1] += 1f; + + if (npc.localAI[1] >= (Main.masterMode ? 200f : Main.expertMode ? 275f : 350f)) + { + float num805 = Main.masterMode ? 12f : Main.expertMode ? 10f : 8f; + Vector2 vector100 = npc.Center; + float num806 = Main.player[npc.target].Center.X - vector100.X; + float num807 = Math.Abs(num806 * 0.2f); + float num808 = Main.player[npc.target].Center.Y - vector100.Y; + if (num808 > 0f) + num807 = 0f; + + num808 -= num807; + float num809 = (float)Math.Sqrt(num806 * num806 + num808 * num808); + num809 = num805 / num809; + num806 *= num809; + num808 *= num809; + int num810 = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.Spore); + Main.npc[num810].velocity.X = num806; + Main.npc[num810].velocity.Y = num808; + Main.npc[num810].netUpdate = true; + npc.localAI[1] = 0f; + } + + return false; + } } } diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/QueenBeeAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/QueenBeeAI.cs new file mode 100644 index 0000000000..95257c3031 --- /dev/null +++ b/NPCs/VanillaNPCAIOverrides/Bosses/QueenBeeAI.cs @@ -0,0 +1,1509 @@ +using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Events; +using CalamityMod.NPCs.PlagueEnemies; +using CalamityMod.Projectiles.Boss; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses +{ + public static class QueenBeeAI + { + public static bool BuffedQueenBeeAI(NPC npc, Mod mod) + { + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + + // Get a target + 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(); + + bool bossRush = BossRushEvent.BossRushActive; + bool masterMode = Main.masterMode || bossRush; + bool death = CalamityWorld.death || bossRush; + + bool enrage = true; + int targetTileX = (int)Main.player[npc.target].Center.X / 16; + int targetTileY = (int)Main.player[npc.target].Center.Y / 16; + + Tile tile = Framing.GetTileSafely(targetTileX, targetTileY); + if (tile.WallType == WallID.HiveUnsafe) + enrage = false; + + float maxEnrageScale = 2f; + float enrageScale = death ? 0.5f : 0f; + if (((npc.position.Y / 16f) < Main.worldSurface && enrage) || bossRush) + { + calamityGlobalNPC.CurrentlyEnraged = !bossRush; + enrageScale += 0.5f; + } + if (!Main.player[npc.target].ZoneJungle || bossRush) + { + calamityGlobalNPC.CurrentlyEnraged = !bossRush; + enrageScale += 0.5f; + } + + if (Main.getGoodWorld) + enrageScale += ((CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 1f : 0.5f); + + if (bossRush) + enrageScale = 2f; + + if (enrageScale > maxEnrageScale) + enrageScale = maxEnrageScale; + + // Percent life remaining + float lifeRatio = npc.life / (float)npc.lifeMax; + + // Bee spawn limit + int beeLimit = masterMode ? 9 : 15; + + // Queen Bee Bee count + int totalBees = 0; + bool beeLimitReached = false; + for (int i = 0; i < Main.maxNPCs; i++) + { + NPC bee = Main.npc[i]; + bool isQueenBeeBee = bee.ai[3] == 1f; + if (bee.active && (bee.type == NPCID.Bee || bee.type == NPCID.BeeSmall) && isQueenBeeBee) + { + totalBees++; + if (totalBees >= beeLimit) + { + beeLimitReached = true; + break; + } + } + } + + // Hornet spawn limit + int hornetLimit = 3; + bool hornetLimitReached = false; + + // Only run this when necessary + if (masterMode) + { + // Queen Bee Hornet count + int totalHornets = 0; + for (int i = 0; i < Main.maxNPCs; i++) + { + NPC hornet = Main.npc[i]; + bool isQueenBeeHornet = hornet.ai[3] == 1f; + if (hornet.active && (hornet.type == NPCID.LittleHornetHoney || hornet.type == NPCID.HornetHoney || hornet.type == NPCID.BigHornetHoney) && isQueenBeeHornet) + { + int hornetCountIncrement = hornet.type == NPCID.BigHornetHoney ? 3 : hornet.type == NPCID.HornetHoney ? 2 : 1; + totalHornets += hornetCountIncrement; + if (totalHornets >= hornetLimit) + { + hornetLimitReached = true; + break; + } + } + } + } + else + hornetLimitReached = true; + + // Phases + + // Become more aggressive and start firing double stingers (triple in death mode) phase + bool phase2 = lifeRatio < 0.85f; + + // Begin launching beehives instead of bees phase + bool phase3 = lifeRatio < 0.7f; + + // Stop spawning bees from ass and start performing stinger arcs + diagonal dashes, spawn bees while charging and become more aggressive phase + bool phase4 = lifeRatio < 0.5f; + + // Perform many shorter-range dashes and use stinger arc in two possible directions phase + bool phase5 = lifeRatio < 0.3f; + + // Triple stinger (quintuple in death mode) bombardment phase + bool phase6 = lifeRatio < 0.1f; + + // Despawn + float distanceFromTarget = Vector2.Distance(npc.Center, Main.player[npc.target].Center); + if (npc.ai[0] != 6f) + { + if (npc.timeLeft < 60) + npc.timeLeft = 60; + if (distanceFromTarget > 3000f) + npc.ai[0] = 4f; + } + if (Main.player[npc.target].dead) + npc.ai[0] = 6f; + + // Adjust slowing debuff immunity + bool immuneToSlowingDebuffs = npc.ai[0] == 0f; + npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + npc.buffImmune[BuffID.Slow] = immuneToSlowingDebuffs; + npc.buffImmune[BuffID.Webbed] = immuneToSlowingDebuffs; + + // Always start in enemy spawning phase + if (calamityGlobalNPC.newAI[3] == 0f) + { + calamityGlobalNPC.newAI[3] = 1f; + npc.ai[0] = 2f; + npc.netUpdate = true; + npc.SyncExtraAI(); + } + + // Despawn phase + if (npc.ai[0] == 6f) + { + // Avoid cheap bullshit + npc.damage = 0; + + npc.velocity.Y *= 0.98f; + + if (npc.velocity.X < 0f) + npc.direction = -1; + else + npc.direction = 1; + + npc.spriteDirection = npc.direction; + + if (npc.position.X < (Main.maxTilesX * 8)) + { + if (npc.velocity.X > 0f) + npc.velocity.X *= 0.98f; + else + npc.localAI[0] = 1f; + + npc.velocity.X -= 0.08f; + } + else + { + if (npc.velocity.X < 0f) + npc.velocity.X *= 0.98f; + else + npc.localAI[0] = 1f; + + npc.velocity.X += 0.08f; + } + + if (npc.timeLeft > 10) + npc.timeLeft = 10; + } + + // Pick a random phase + else if (npc.ai[0] == -1f) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int phase; + int maxRandom = phase4 ? 5 : 4; + do phase = Main.rand.Next(maxRandom); + while (phase == npc.ai[1] || phase == 1 || (phase == 2 && phase4) || (masterMode && phase6 && phase == 3)); + + bool charging = phase == 0; + + // 5 is stinger arc and charge + if (phase == 4) + phase = 5; + + npc.TargetClosest(); + npc.ai[0] = phase; + npc.ai[1] = 0f; + + // Movement direction for the stinger arcs + npc.ai[2] = (phase == 5 && phase5) ? (Main.rand.NextBool() ? 1f : -1f) : phase == 5 ? 1f : 0f; + + // Velocity for the charges + if (masterMode) + npc.ai[3] = charging ? ((phase6 ? 27f : phase5 ? 16f : phase4 ? 27f : phase2 ? 22f : 17f) + 3f * enrageScale) : 0f; + else + npc.ai[3] = charging ? ((phase6 ? 25f : phase5 ? 14f : phase4 ? 25f : phase2 ? 20f : 15f) + 3f * enrageScale) : 0f; + + // Distance for the charges + if (masterMode) + calamityGlobalNPC.newAI[1] = charging ? ((phase6 ? 700f : phase5 ? 300f : phase4 ? 600f : phase2 ? 500f : 400f) - 50f * enrageScale) : 0f; + else + calamityGlobalNPC.newAI[1] = charging ? ((phase6 ? 750f : phase5 ? 350f : phase4 ? 650f : phase2 ? 550f : 450f) - 50f * enrageScale) : 0f; + + npc.SyncExtraAI(); + } + } + + // Charging phase + else if (npc.ai[0] == 0f) + { + // Charging distance from player + int chargeDistanceX = (int)calamityGlobalNPC.newAI[1]; + + // Number of charges + int chargeAmt = (int)Math.Ceiling((phase6 ? 2f : phase5 ? 4f : phase4 ? 3f : 2f) + enrageScale); + if (death) + chargeAmt = phase6 ? 1 : phase5 ? 3 : phase4 ? 2 : 1; + + int masterModeChargeLimit = death ? (phase5 ? 2 : 1) : (phase5 ? 3 : 2); + if (masterMode && chargeAmt > masterModeChargeLimit) + chargeAmt = masterModeChargeLimit; + + // Switch to a random phase if chargeAmt has been exceeded + if (npc.ai[1] > (2 * chargeAmt) && npc.ai[1] % 2f == 0f) + { + npc.ai[0] = -1f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.netUpdate = true; + return false; + } + + // Charge velocity + float velocity = npc.ai[3]; + + // Line up and initiate charge + if (npc.ai[1] % 2f == 0f) + { + // Avoid cheap bullshit + npc.damage = 0; + + // Initiate charge + float chargeDistanceY = phase6 ? 100f : phase4 ? 50f : 20f; + chargeDistanceY += 100f * enrageScale; + if (death) + chargeDistanceY += MathHelper.Lerp(0f, 100f, 1f - lifeRatio); + if (masterMode) + chargeDistanceY *= 2f; + + float distanceFromTargetX = Math.Abs(npc.Center.X - Main.player[npc.target].Center.X); + float distanceFromTargetY = Math.Abs(npc.Center.Y - Main.player[npc.target].Center.Y); + if (distanceFromTargetY < chargeDistanceY && distanceFromTargetX >= chargeDistanceX) + { + // Set damage + npc.damage = npc.defDamage; + + // Set AI variables and speed + npc.localAI[0] = 1f; + npc.ai[1] += 1f; + npc.ai[2] = 0f; + + // Get target location + Vector2 beeLocation = npc.Center; + float targetXDist = Main.player[npc.target].Center.X - beeLocation.X; + float targetYDist = Main.player[npc.target].Center.Y - beeLocation.Y; + float targetDistance = (float)Math.Sqrt(targetXDist * targetXDist + targetYDist * targetYDist); + targetDistance = velocity / targetDistance; + npc.velocity.X = targetXDist * targetDistance; + npc.velocity.Y = targetYDist * targetDistance; + + // Face the correct direction and play charge sound + float playerLocation = npc.Center.X - Main.player[npc.target].Center.X; + npc.direction = playerLocation < 0 ? 1 : -1; + npc.spriteDirection = npc.direction; + + SoundEngine.PlaySound(SoundID.Zombie125, npc.Center); + + return false; + } + + // Velocity variables + npc.localAI[0] = 0f; + float chargeVelocityX = (phase4 ? 24f : phase2 ? 20f : 16f) + 8f * enrageScale; + float chargeVelocityY = (phase4 ? 18f : phase2 ? 15f : 12f) + 6f * enrageScale; + float chargeAccelerationX = (phase4 ? 0.9f : phase2 ? 0.7f : 0.5f) + 0.25f * enrageScale; + float chargeAccelerationY = (phase4 ? 0.45f : phase2 ? 0.35f : 0.25f) + 0.125f * enrageScale; + + if (masterMode) + { + chargeVelocityX += 2f; + chargeVelocityY += 4f; + chargeAccelerationX += 0.15f; + chargeAccelerationY += 0.3f; + } + + // Velocity calculations + if (npc.Center.Y < Main.player[npc.target].Center.Y - chargeDistanceY) + npc.velocity.Y += chargeAccelerationY; + else if (npc.Center.Y > Main.player[npc.target].Center.Y + chargeDistanceY) + npc.velocity.Y -= chargeAccelerationY; + else + npc.velocity.Y *= 0.7f; + + if (npc.velocity.Y < -chargeVelocityY) + npc.velocity.Y = -chargeVelocityY; + if (npc.velocity.Y > chargeVelocityY) + npc.velocity.Y = chargeVelocityY; + + float distanceXMax = 100f; + float distanceXMin = 20f; + if (distanceFromTargetX > chargeDistanceX + distanceXMax) + npc.velocity.X += chargeAccelerationX * npc.direction; + else if (distanceFromTargetX < chargeDistanceX + distanceXMin) + npc.velocity.X -= chargeAccelerationX * npc.direction; + else + npc.velocity.X *= 0.7f; + + // Limit velocity + if (npc.velocity.X < -chargeVelocityX) + npc.velocity.X = -chargeVelocityX; + if (npc.velocity.X > chargeVelocityX) + npc.velocity.X = chargeVelocityX; + + // Face the correct direction + float playerLocation2 = npc.Center.X - Main.player[npc.target].Center.X; + npc.direction = playerLocation2 < 0 ? 1 : -1; + npc.spriteDirection = npc.direction; + + npc.netUpdate = true; + + if (npc.netSpam > 10) + npc.netSpam = 10; + } + else + { + // Set damage + npc.damage = npc.defDamage; + + // Face the correct direction + if (npc.velocity.X < 0f) + npc.direction = -1; + else + npc.direction = 1; + + npc.spriteDirection = npc.direction; + + // Get which side of the player the boss is on + int chargeDirection = 1; + if (npc.Center.X < Main.player[npc.target].Center.X) + chargeDirection = -1; + + // If boss is in correct position, slow down, if not, reset + bool shouldCharge = false; + if (npc.direction == chargeDirection && Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) > chargeDistanceX) + { + npc.ai[2] = 1f; + shouldCharge = true; + } + if (Math.Abs(npc.Center.Y - Main.player[npc.target].Center.Y) > chargeDistanceX * 1.5f) + { + npc.ai[2] = 1f; + shouldCharge = true; + } + if (enrageScale > 0f && shouldCharge) + npc.velocity *= MathHelper.Lerp(0.5f, masterMode ? 0.9f : 1f, 1f - enrageScale / maxEnrageScale); + + // Keep moving + if (npc.ai[2] != 1f) + { + // Velocity fix if Queen Bee is slowed + if (npc.velocity.Length() < velocity) + npc.velocity.X = velocity * npc.direction; + + float accelerateGateValue = phase6 ? 30f : phase5 ? 10f : 90f; + if (masterMode) + accelerateGateValue *= 0.75f; + if (enrageScale > 0f) + accelerateGateValue *= 0.75f; + + calamityGlobalNPC.newAI[0] += 1f; + if (calamityGlobalNPC.newAI[0] > accelerateGateValue) + { + npc.SyncExtraAI(); + float velocityXLimit = velocity * 2f; + if (Math.Abs(npc.velocity.X) < velocityXLimit) + npc.velocity.X *= (masterMode ? 1.02f : 1.01f); + } + + // Spawn bees + float beeSpawnGateValue = masterMode ? 16f : 20f; + 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); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int spawnType = Main.rand.Next(NPCID.Bee, NPCID.BeeSmall + 1); + if (Main.zenithWorld) + { + if (phase3) + spawnType = Main.rand.NextBool(3) ? ModContent.NPCType() : ModContent.NPCType(); + else + spawnType = NPCID.Hellbat; + } + else if (masterMode) + { + int random = hornetLimitReached ? 0 : beeLimitReached ? Main.rand.Next(6, 12) : Main.rand.Next(12); + switch (random) + { + default: + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + + case 6: + case 7: + case 8: + spawnType = NPCID.LittleHornetHoney; + break; + + case 9: + case 10: + spawnType = NPCID.HornetHoney; + break; + + case 11: + spawnType = NPCID.BigHornetHoney; + break; + } + } + + if (!beeLimitReached || !hornetLimitReached) + { + int spawn = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, spawnType); + Vector2 beeVelocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY); + Main.npc[spawn].velocity = beeVelocity; + Main.npc[spawn].velocity *= 5f; + if (!Main.zenithWorld) + { + Main.npc[spawn].ai[2] = enrageScale; + Main.npc[spawn].ai[3] = 1f; + } + Main.npc[spawn].timeLeft = 600; + Main.npc[spawn].netUpdate = true; + } + } + } + + npc.localAI[0] = 1f; + return false; + } + + // Avoid cheap bullshit + npc.damage = 0; + + float playerLocation = npc.Center.X - Main.player[npc.target].Center.X; + npc.direction = playerLocation < 0 ? 1 : -1; + npc.spriteDirection = npc.direction; + + // Slow down + npc.localAI[0] = 0f; + npc.velocity *= (masterMode ? 0.8f : 0.9f); + + float chargeDeceleration = masterMode ? 0.2f : 0.1f; + if (phase2) + { + npc.velocity *= 0.9f; + chargeDeceleration += 0.05f; + } + if (phase4) + { + npc.velocity *= 0.8f; + chargeDeceleration += 0.1f; + } + if (enrageScale > 0f) + npc.velocity *= MathHelper.Lerp(0.7f, 1f, 1f - enrageScale / maxEnrageScale); + + if (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) < chargeDeceleration) + { + npc.ai[2] = 0f; + npc.ai[1] += 1f; + calamityGlobalNPC.newAI[0] = 0f; + npc.SyncExtraAI(); + } + + npc.netUpdate = true; + + if (npc.netSpam > 10) + npc.netSpam = 10; + } + } + + // Fly above target before bee spawning phase + else if (npc.ai[0] == 2f) + { + // Avoid cheap bullshit + npc.damage = 0; + + // Direction + float playerLocation = npc.Center.X - Main.player[npc.target].Center.X; + npc.direction = playerLocation < 0 ? 1 : -1; + npc.spriteDirection = npc.direction; + + // Get target location + float beeAttackAccel = death ? 0.3f : 0.24f; + float beeAttackSpeed = 12f + enrageScale * 3f; + + if (masterMode) + { + beeAttackAccel *= 2f; + beeAttackSpeed *= 1.5f; + } + + bool canHitTarget = Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height); + float distanceAboveTarget = !canHitTarget ? 0f : 320f; + Vector2 hoverDestination = Main.player[npc.target].Center - Vector2.UnitY * distanceAboveTarget; + Vector2 idealVelocity = npc.SafeDirectionTo(hoverDestination) * beeAttackSpeed; + + // Go to bee spawn phase + calamityGlobalNPC.newAI[0] += 1f; + if ((Vector2.Distance(npc.Center, hoverDestination) < 400f && canHitTarget) || calamityGlobalNPC.newAI[0] >= (masterMode ? 90f : 180f)) + { + npc.ai[0] = 1f; + npc.ai[1] = 0f; + calamityGlobalNPC.newAI[0] = 0f; + npc.netUpdate = true; + npc.SyncExtraAI(); + return false; + } + + npc.SimpleFlyMovement(idealVelocity, beeAttackAccel); + } + + // Bee spawn phase + else if (npc.ai[0] == 1f) + { + // Avoid cheap bullshit + npc.damage = 0; + + npc.localAI[0] = 0f; + + // Get target location and spawn bees from ass + float beeAttackHoverSpeed = 16f + enrageScale * 4f; + float beeAttackHoverAccel = death ? 0.4f : 0.3f; + + if (masterMode) + { + beeAttackHoverAccel *= 2f; + beeAttackHoverSpeed *= 1.5f; + } + + Vector2 beeSpawnLocation = new Vector2(npc.Center.X + (Main.rand.Next(20) * npc.direction), npc.position.Y + npc.height * 0.8f); + Vector2 beeSpawnCollisionLocation = new Vector2(beeSpawnLocation.X, beeSpawnLocation.Y - 30f); + bool canHitTarget = Collision.CanHit(beeSpawnCollisionLocation, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height); + Vector2 hoverDestination = Main.player[npc.target].Center - Vector2.UnitY * (!canHitTarget ? 0f : 320f); + Vector2 idealVelocity = npc.SafeDirectionTo(hoverDestination) * beeAttackHoverSpeed; + + // Bee spawn timer + npc.ai[1] += 1f; + int beeSpawnTimer = 0; + for (int i = 0; i < Main.maxPlayers; i++) + { + if (Main.player[i].active && !Main.player[i].dead && (npc.Center - Main.player[i].Center).Length() < 1000f) + beeSpawnTimer++; + } + npc.ai[1] += beeSpawnTimer / 2; + if (phase2) + npc.ai[1] += 1f; + + bool spawnBee = false; + float beeSpawnCheck = (phase3 ? 45f : 15f) - (phase3 ? 18f : 6f) * enrageScale; + if (npc.ai[1] > beeSpawnCheck) + { + npc.ai[1] = 0f; + npc.ai[2] += 1f; + spawnBee = true; + } + + // 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); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (phase3) + { + Projectile.NewProjectile(npc.GetSource_FromAI(), beeSpawnLocation, (Main.player[npc.target].Center - beeSpawnLocation).SafeNormalize(Vector2.UnitY), ProjectileID.BeeHive, 0, 0f, Main.myPlayer, 0f, 0f, 1f); + } + else + { + int spawnType = Main.rand.Next(NPCID.Bee, NPCID.BeeSmall + 1); + if (Main.zenithWorld) + { + if (phase3) + spawnType = Main.rand.NextBool(3) ? ModContent.NPCType() : ModContent.NPCType(); + else + spawnType = NPCID.Hellbat; + } + else if (masterMode) + { + int random = hornetLimitReached ? 0 : beeLimitReached ? Main.rand.Next(6, 12) : Main.rand.Next(12); + switch (random) + { + default: + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + + case 6: + case 7: + case 8: + spawnType = NPCID.LittleHornetHoney; + break; + + case 9: + case 10: + spawnType = NPCID.HornetHoney; + break; + + case 11: + spawnType = NPCID.BigHornetHoney; + break; + } + } + + int spawn = NPC.NewNPC(npc.GetSource_FromAI(), (int)beeSpawnLocation.X, (int)beeSpawnLocation.Y, spawnType); + Vector2 beeVelocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY); + Main.npc[spawn].velocity = beeVelocity; + Main.npc[spawn].velocity *= 5f; + if (!Main.zenithWorld) + { + Main.npc[spawn].ai[2] = enrageScale; + Main.npc[spawn].ai[3] = 1f; + } + Main.npc[spawn].timeLeft = 600; + Main.npc[spawn].netUpdate = true; + } + } + } + + // Velocity calculations if target is too far away + if (Vector2.Distance(beeSpawnLocation, hoverDestination) > 400f || !canHitTarget) + npc.SimpleFlyMovement(idealVelocity, beeAttackHoverAccel); + else + npc.velocity *= (death ? 0.8f : 0.85f); + + // Face the correct direction + float playerLocation = npc.Center.X - Main.player[npc.target].Center.X; + npc.direction = playerLocation < 0 ? 1 : -1; + npc.spriteDirection = npc.direction; + + // Go to a random phase + float numSpawns = phase3 ? (masterMode ? 1f : 2f) : (masterMode ? 3f : 5f); + if (npc.ai[2] > numSpawns || (beeLimitReached && hornetLimitReached)) + { + npc.ai[0] = -1f; + npc.ai[1] = 2f; + npc.ai[2] = 0f; + npc.netUpdate = true; + } + } + + // Stinger phase + else if (npc.ai[0] == 3f) + { + // Avoid cheap bullshit + npc.damage = 0; + + // Direction + float playerLocation = npc.Center.X - Main.player[npc.target].Center.X; + npc.direction = playerLocation < 0 ? 1 : -1; + npc.spriteDirection = npc.direction; + + // Get target location and shoot from ass + float stingerAttackSpeed = 16f + enrageScale * 4f; + float stingerAttackAccel = phase6 ? 0.32f : 0.24f; + if (enrageScale > 0f) + stingerAttackAccel = MathHelper.Lerp(phase6 ? 0.4f : 0.32f, phase6 ? 0.8f : 0.64f, enrageScale / maxEnrageScale); + + if (masterMode) + { + stingerAttackSpeed *= 1.1f; + stingerAttackAccel *= 1.2f; + } + + Vector2 stingerSpawnLocation = new Vector2(npc.Center.X + (Main.rand.Next(20) * npc.direction), npc.position.Y + npc.height * 0.8f); + bool canHitTarget = Collision.CanHit(new Vector2(stingerSpawnLocation.X, stingerSpawnLocation.Y - 30f), 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height); + Vector2 hoverDestination = Main.player[npc.target].Center - Vector2.UnitY * (!canHitTarget ? 0f : phase4 ? 400f : phase2 ? 360f : 320f); + Vector2 idealVelocity = npc.SafeDirectionTo(hoverDestination) * stingerAttackSpeed; + + npc.ai[1] += 1f; + int stingerAttackTimer = phase6 ? 40 : phase2 ? 30 : 20; + stingerAttackTimer -= (int)Math.Ceiling((phase6 ? 16f : phase2 ? 12f : 8f) * enrageScale); + if (stingerAttackTimer < 5) + stingerAttackTimer = 5; + + // Fire stingers + if (npc.ai[1] % stingerAttackTimer == (stingerAttackTimer - 1) && npc.Bottom.Y < Main.player[npc.target].Top.Y && Collision.CanHit(stingerSpawnLocation, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + SoundEngine.PlaySound(SoundID.Item17, stingerSpawnLocation); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + float stingerSpeed = (phase3 ? 6f : 5f) + enrageScale; + if (masterMode) + stingerSpeed += 1f; + + float stingerTargetX = Main.player[npc.target].Center.X - stingerSpawnLocation.X; + float stingerTargetY = Main.player[npc.target].Center.Y - stingerSpawnLocation.Y; + float stingerTargetDist = (float)Math.Sqrt(stingerTargetX * stingerTargetX + stingerTargetY * stingerTargetY); + stingerTargetDist = stingerSpeed / stingerTargetDist; + stingerTargetX *= stingerTargetDist; + stingerTargetY *= stingerTargetDist; + Vector2 stingerVelocity = new Vector2(stingerTargetX, stingerTargetY); + int type = Main.zenithWorld ? (phase3 ? ModContent.ProjectileType() : ProjectileID.FlamingWood) : ProjectileID.QueenBeeStinger; + + int projectile = Projectile.NewProjectile(npc.GetSource_FromAI(), stingerSpawnLocation, stingerVelocity, type, Main.zenithWorld ? 25 : npc.GetProjectileDamage(type), 0f, Main.myPlayer, 0f, (Main.zenithWorld && phase3) ? Main.player[npc.target].position.Y : 0f); + Main.projectile[projectile].timeLeft = 1200; + Main.projectile[projectile].extraUpdates = 1; + + if (phase2) + { + int numExtraStingers = death ? (phase6 ? 4 : 2) : (phase6 ? 2 : 1); + for (int i = 0; i < numExtraStingers; i++) + { + projectile = Projectile.NewProjectile(npc.GetSource_FromAI(), stingerSpawnLocation + Main.rand.NextVector2CircularEdge(16f, 16f) * (i + 1), stingerVelocity * MathHelper.Lerp(0.75f, 1f, i / (float)numExtraStingers), type, Main.zenithWorld ? 25 : npc.GetProjectileDamage(type), 0f, Main.myPlayer, 0f, (Main.zenithWorld && phase3) ? Main.player[npc.target].position.Y : 0f); + Main.projectile[projectile].timeLeft = 1200; + Main.projectile[projectile].extraUpdates = 1; + } + } + } + } + + // Movement calculations + if (Vector2.Distance(stingerSpawnLocation, hoverDestination) > 40f || !canHitTarget) + npc.SimpleFlyMovement(idealVelocity, stingerAttackAccel); + + // Go to a random phase + float numStingerShots = phase6 ? 5f : phase2 ? 8f : 15f; + if (masterMode) + numStingerShots = (float)Math.Round(numStingerShots * 0.5f); + + if (npc.ai[1] > stingerAttackTimer * numStingerShots) + { + npc.ai[0] = -1f; + npc.ai[1] = 3f; + npc.netUpdate = true; + } + } + + else if (npc.ai[0] == 4f) + { + // Avoid cheap bullshit + npc.damage = 0; + + npc.localAI[0] = 1f; + float despawnVelMult = 14f; + + Vector2 despawnTargetDist = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY); + despawnTargetDist *= 14f; + + npc.velocity = (npc.velocity * despawnVelMult + despawnTargetDist) / (despawnVelMult + 1f); + if (npc.velocity.X < 0f) + npc.direction = -1; + else + npc.direction = 1; + + npc.spriteDirection = npc.direction; + + if (distanceFromTarget < 2000f) + { + npc.ai[0] = -1f; + npc.localAI[0] = 0f; + } + } + + // Stinger arcs above the player + else if (npc.ai[0] == 5f) + { + // Avoid cheap bullshit + npc.damage = 0; + + // Direction + float playerLocation = npc.Center.X - Main.player[npc.target].Center.X; + npc.direction = playerLocation < 0 ? 1 : -1; + npc.spriteDirection = npc.direction; + + // Get target location and shoot spreads from ass + float stingerAttackSpeed = 20f + enrageScale * 4f; + float stingerAttackAccel = phase6 ? 0.7f : 0.5f; + if (enrageScale > 0f) + stingerAttackAccel = MathHelper.Lerp(phase6 ? 0.9f : 0.7f, phase6 ? 2.4f : 1.8f, enrageScale / maxEnrageScale); + + if (masterMode) + { + stingerAttackSpeed *= 1.1f; + stingerAttackAccel *= 1.2f; + } + + int numStingerArcs = phase6 ? 3 : phase5 ? 2 : 1; + if (death) + numStingerArcs++; + + float phaseLimit = phase6 ? 180f : phase5 ? 150f : 120f; + if (death) + phaseLimit *= 1.5f; + + float stingerAttackTimer = (float)Math.Ceiling(phaseLimit / (numStingerArcs + 1)); + + float maxDistance = 480f; + float xLocationScale = MathHelper.Lerp(-maxDistance, maxDistance, npc.ai[1] / phaseLimit) * npc.ai[2]; + Vector2 stingerSpawnLocation = new Vector2(npc.Center.X + (Main.rand.Next(20) * npc.direction), npc.position.Y + npc.height * 0.8f); + bool canHitTarget = Collision.CanHit(new Vector2(stingerSpawnLocation.X, stingerSpawnLocation.Y - 30f), 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height); + Vector2 hoverDestination = Main.player[npc.target].Center + Vector2.UnitX * xLocationScale * (death ? 1.5f : 1.25f) - Vector2.UnitY * maxDistance; + Vector2 idealVelocity = npc.SafeDirectionTo(hoverDestination) * stingerAttackSpeed; + + // Fire stingers + bool canFireStingers = stingerSpawnLocation.Y < Main.player[npc.target].Top.Y - maxDistance * 0.8f || !canHitTarget; + if (canFireStingers) + { + npc.ai[1] += 1f; + if (npc.ai[1] % stingerAttackTimer == 0f && npc.ai[1] != 0f && npc.ai[1] != phaseLimit) + { + SoundEngine.PlaySound(SoundID.Item17, stingerSpawnLocation); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + float stingerSpeed = (phase6 ? 5f : 4f) + enrageScale; + if (masterMode) + stingerSpeed += 1f; + + Vector2 projectileVelocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * stingerSpeed; + int type = Main.zenithWorld ? ModContent.ProjectileType() : ProjectileID.QueenBeeStinger; + int numProj = death ? (phase6 ? 7 : phase5 ? 11 : 15) : (phase6 ? 5 : phase5 ? 9 : 13); + int spread = phase6 ? 30 : phase5 ? 50 : 60; + + if (masterMode) + { + numProj += (phase6 ? 2 : phase5 ? 4 : 6); + spread += (phase6 ? 10 : phase5 ? 15 : 20); + } + + float rotation = MathHelper.ToRadians(spread); + for (int i = 0; i < numProj; i++) + { + Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); + if (i % 2f != 0f) + perturbedSpeed *= 0.8f; + + int projectile = Projectile.NewProjectile(npc.GetSource_FromAI(), stingerSpawnLocation + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 10f, perturbedSpeed, type, Main.zenithWorld ? 25 : npc.GetProjectileDamage(type), 0f, Main.myPlayer, 0f, Main.player[npc.target].position.Y); + Main.projectile[projectile].timeLeft = 1200; + Main.projectile[projectile].extraUpdates = 1; + + if (!Main.zenithWorld) + Main.projectile[projectile].tileCollide = false; + } + } + } + } + + // Movement calculations + npc.SimpleFlyMovement(idealVelocity, stingerAttackAccel); + + // Go to a random phase + if (npc.ai[1] >= phaseLimit) + { + npc.ai[0] = -1f; + npc.ai[1] = 4f; + npc.ai[2] = 0f; + npc.netUpdate = true; + } + } + + if (Main.netMode == NetmodeID.Server) + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, npc.whoAmI, 0f, 0f, 0f, 0, 0, 0); + + npc.netSpam = 5; + + return false; + } + + public static bool VanillaQueenBeeAI(NPC npc, Mod mod) + { + if (Main.expertMode) + { + int num643 = (int)(20f * (1f - (float)npc.life / (float)npc.lifeMax)); + npc.defense = npc.defDefense + num643; + } + + if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) + npc.TargetClosest(); + + bool enrage = true; + int targetTileX = (int)Main.player[npc.target].Center.X / 16; + int targetTileY = (int)Main.player[npc.target].Center.Y / 16; + + Tile tile = Framing.GetTileSafely(targetTileX, targetTileY); + if (tile.WallType == WallID.HiveUnsafe) + enrage = false; + + bool dead4 = Main.player[npc.target].dead; + float num644 = 0f; + if ((double)(npc.position.Y / 16f) < Main.worldSurface && enrage) + num644 += 1f; + + if (!Main.player[npc.target].ZoneJungle) + num644 += 1f; + + npc.Calamity().CurrentlyEnraged = num644 > 0f; + + if (Main.getGoodWorld) + num644 += 0.5f; + + float num645 = Vector2.Distance(npc.Center, Main.player[npc.target].Center); + if (npc.ai[0] != 5f) + { + if (npc.timeLeft < 60) + npc.timeLeft = 60; + + if (num645 > 3000f) + { + npc.ai[0] = 4f; + npc.netUpdate = true; + } + } + + if (dead4) + { + npc.ai[0] = 5f; + npc.netUpdate = true; + } + + if (npc.ai[0] == 5f) + { + // Avoid cheap bullshit + npc.damage = 0; + + npc.velocity.Y *= 0.98f; + if (npc.velocity.X < 0f) + npc.direction = -1; + else + npc.direction = 1; + + npc.spriteDirection = npc.direction; + if (npc.position.X < (float)(Main.maxTilesX * 8)) + { + if (npc.velocity.X > 0f) + npc.velocity.X *= 0.98f; + else + npc.localAI[0] = 1f; + + npc.velocity.X -= 0.08f; + } + else + { + if (npc.velocity.X < 0f) + npc.velocity.X *= 0.98f; + else + npc.localAI[0] = 1f; + + npc.velocity.X += 0.08f; + } + + npc.EncourageDespawn(10); + } + else if (npc.ai[0] == -1f) + { + if (Main.netMode == NetmodeID.MultiplayerClient) + return false; + + float num646 = npc.ai[1]; + int num647; + do + { + num647 = Main.rand.Next(3); + switch (num647) + { + case 1: + num647 = 2; + break; + case 2: + num647 = 3; + break; + } + } + while ((float)num647 == num646); + + npc.ai[0] = num647; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.netUpdate = true; + } + else if (npc.ai[0] == 0f) + { + // Charging distance from player + int chargeDistanceX = Main.masterMode ? 425 : 600; + if (Main.expertMode) + { + int chargeDistanceReduction = Main.masterMode ? 25 : 50; + if ((double)npc.life < (double)npc.lifeMax * 0.1) + chargeDistanceX -= chargeDistanceReduction * 6; + else if ((double)npc.life < (double)npc.lifeMax * 0.25) + chargeDistanceX -= chargeDistanceReduction * 3; + else if ((double)npc.life < (double)npc.lifeMax * 0.5) + chargeDistanceX -= chargeDistanceReduction * 2; + else if ((double)npc.life < (double)npc.lifeMax * 0.75) + chargeDistanceX -= chargeDistanceReduction; + } + chargeDistanceX -= (int)(100f * num644); + + int num648 = Main.masterMode ? 1 : 2; + if (Main.expertMode) + { + if (npc.life < npc.lifeMax / 2 && !Main.masterMode) + num648++; + + if (npc.life < npc.lifeMax / 3) + num648++; + + if (npc.life < npc.lifeMax / 5) + num648++; + } + + num648 += (int)(1f * num644); + if (npc.ai[1] > (float)(2 * num648) && npc.ai[1] % 2f == 0f) + { + npc.ai[0] = -1f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.netUpdate = true; + return false; + } + + if (npc.ai[1] % 2f == 0f) + { + // Avoid cheap bullshit + npc.damage = 0; + + npc.TargetClosest(); + + float chargeDistanceY = 20f; + chargeDistanceY += 20f * num644; + + float distanceFromTargetX = Math.Abs(npc.Center.X - Main.player[npc.target].Center.X); + float distanceFromTargetY = Math.Abs(npc.Center.Y - Main.player[npc.target].Center.Y); + if (distanceFromTargetY < chargeDistanceY && distanceFromTargetX >= chargeDistanceX) + { + // Set damage + npc.damage = npc.defDamage; + + npc.localAI[0] = 1f; + npc.ai[1] += 1f; + npc.ai[2] = 0f; + npc.netUpdate = true; + float num650 = 12f; + if (Main.expertMode) + { + num650 = Main.masterMode ? 20f : 16f; + float chargeVelocityIncrease = Main.masterMode ? 1.5f : 2f; + if ((double)npc.life < (double)npc.lifeMax * 0.75) + num650 += chargeVelocityIncrease; + + if ((double)npc.life < (double)npc.lifeMax * 0.5) + num650 += chargeVelocityIncrease; + + if ((double)npc.life < (double)npc.lifeMax * 0.25) + num650 += chargeVelocityIncrease; + + if ((double)npc.life < (double)npc.lifeMax * 0.1) + num650 += chargeVelocityIncrease; + } + + num650 += 7f * num644; + Vector2 vector82 = npc.Center; + float num651 = Main.player[npc.target].Center.X - vector82.X; + float num652 = Main.player[npc.target].Center.Y - vector82.Y; + float num653 = (float)Math.Sqrt(num651 * num651 + num652 * num652); + num653 = num650 / num653; + npc.velocity.X = num651 * num653; + npc.velocity.Y = num652 * num653; + + float playerLocation = npc.Center.X - Main.player[npc.target].Center.X; + npc.direction = playerLocation < 0 ? 1 : -1; + npc.spriteDirection = npc.direction; + + SoundEngine.PlaySound(SoundID.Zombie125, npc.Center); + + return false; + } + + npc.localAI[0] = 0f; + float num654 = Main.masterMode ? 16f : 12f; + float num655 = Main.masterMode ? 0.3f : 0.15f; + if (Main.expertMode) + { + float chargeLineUpVelocityIncrease = Main.masterMode ? 0.5f : 1f; + float chargeLineUpAccelerationIncrease = Main.masterMode ? 0.025f : 0.05f; + if ((double)npc.life < (double)npc.lifeMax * 0.75) + { + num654 += chargeLineUpVelocityIncrease; + num655 += chargeLineUpAccelerationIncrease; + } + + if ((double)npc.life < (double)npc.lifeMax * 0.5) + { + num654 += chargeLineUpVelocityIncrease; + num655 += chargeLineUpAccelerationIncrease; + } + + if ((double)npc.life < (double)npc.lifeMax * 0.25) + { + num654 += chargeLineUpVelocityIncrease * 2f; + num655 += chargeLineUpAccelerationIncrease; + } + + if ((double)npc.life < (double)npc.lifeMax * 0.1) + { + num654 += chargeLineUpVelocityIncrease * 2f; + num655 += chargeLineUpAccelerationIncrease * 2f; + } + } + + num654 += 3f * num644; + num655 += 0.5f * num644; + + // Velocity calculations + if (npc.Center.Y < Main.player[npc.target].Center.Y - chargeDistanceY) + npc.velocity.Y += num655; + else if (npc.Center.Y > Main.player[npc.target].Center.Y + chargeDistanceY) + npc.velocity.Y -= num655; + else + npc.velocity.Y *= 0.7f; + + if (npc.velocity.Y < -num654) + npc.velocity.Y = -num654; + if (npc.velocity.Y > num654) + npc.velocity.Y = num654; + + float distanceXMax = 100f; + float distanceXMin = 20f; + if (distanceFromTargetX > chargeDistanceX + distanceXMax) + npc.velocity.X += 0.15f * npc.direction; + else if (distanceFromTargetX < chargeDistanceX + distanceXMin) + npc.velocity.X -= 0.15f * npc.direction; + else + npc.velocity.X *= 0.7f; + + if (npc.velocity.X < -16f) + npc.velocity.X = -16f; + if (npc.velocity.X > 16f) + npc.velocity.X = 16f; + + // Face the correct direction + float playerLocation2 = npc.Center.X - Main.player[npc.target].Center.X; + npc.direction = playerLocation2 < 0 ? 1 : -1; + npc.spriteDirection = npc.direction; + + return false; + } + + // Set damage + npc.damage = npc.defDamage; + + if (npc.velocity.X < 0f) + npc.direction = -1; + else + npc.direction = 1; + + npc.spriteDirection = npc.direction; + + int num657 = 1; + if (npc.Center.X < Main.player[npc.target].Center.X) + num657 = -1; + + bool flag34 = false; + if (npc.direction == num657 && Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) > (float)chargeDistanceX) + { + npc.ai[2] = 1f; + flag34 = true; + } + + if (Math.Abs(npc.Center.Y - Main.player[npc.target].Center.Y) > (float)chargeDistanceX * 1.5f) + { + npc.ai[2] = 1f; + flag34 = true; + } + + if (num644 > 0f && flag34) + npc.velocity *= 0.5f; + + if (npc.ai[2] == 1f) + { + // Avoid cheap bullshit + npc.damage = 0; + + npc.TargetClosest(); + + float playerLocation = npc.Center.X - Main.player[npc.target].Center.X; + npc.direction = playerLocation < 0 ? 1 : -1; + npc.spriteDirection = npc.direction; + + npc.localAI[0] = 0f; + + npc.velocity *= (Main.masterMode ? 0.8f : 0.9f); + float num658 = Main.masterMode ? 0.2f : 0.1f; + if (Main.expertMode) + { + float velocityMultiplier = Main.masterMode ? 0.925f : 0.9f; + float velocityGateValueIncrease = Main.masterMode ? 0.025f : 0.05f; + if (npc.life < npc.lifeMax / 2) + { + npc.velocity *= velocityMultiplier; + num658 += velocityGateValueIncrease; + } + + if (npc.life < npc.lifeMax / 3) + { + npc.velocity *= velocityMultiplier; + num658 += velocityGateValueIncrease; + } + + if (npc.life < npc.lifeMax / 5) + { + npc.velocity *= velocityMultiplier; + num658 += velocityGateValueIncrease; + } + } + + if (num644 > 0f) + npc.velocity *= 0.7f; + + if (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) < num658) + { + npc.ai[2] = 0f; + npc.ai[1] += 1f; + npc.netUpdate = true; + } + } + else + npc.localAI[0] = 1f; + } + else if (npc.ai[0] == 2f) + { + // Avoid cheap bullshit + npc.damage = 0; + + npc.TargetClosest(); + + float playerLocation = npc.Center.X - Main.player[npc.target].Center.X; + npc.direction = playerLocation < 0 ? 1 : -1; + npc.spriteDirection = npc.direction; + + float num659 = Main.masterMode ? 14f : 12f; + float num660 = 0.14f; + if (Main.expertMode) + num660 = Main.masterMode ? 0.3f : 0.2f; + + bool canHitTarget = Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height); + float distanceAboveTarget = !canHitTarget ? 0f : 320f; + Vector2 hoverDestination = Main.player[npc.target].Center - Vector2.UnitY * distanceAboveTarget; + Vector2 idealVelocity = npc.SafeDirectionTo(hoverDestination) * num659; + + if (Vector2.Distance(npc.Center, hoverDestination) < 200f && canHitTarget) + { + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.netUpdate = true; + return false; + } + + npc.SimpleFlyMovement(idealVelocity, num660); + } + else if (npc.ai[0] == 1f) + { + // Avoid cheap bullshit + npc.damage = 0; + + npc.localAI[0] = 0f; + npc.TargetClosest(); + + float num672 = Main.masterMode ? 16f : 14f; + float num673 = Main.masterMode ? 0.15f : 0.1f; + + Vector2 beeSpawnLocation = new Vector2(npc.Center.X + (Main.rand.Next(20) * npc.direction), npc.position.Y + npc.height * 0.8f); + Vector2 beeSpawnCollisionLocation = new Vector2(beeSpawnLocation.X, beeSpawnLocation.Y - 30f); + bool canHitTarget = Collision.CanHit(beeSpawnCollisionLocation, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height); + Vector2 hoverDestination = Main.player[npc.target].Center - Vector2.UnitY * (!canHitTarget ? 0f : 320f); + Vector2 idealVelocity = npc.SafeDirectionTo(hoverDestination) * num672; + + npc.ai[1] += (Main.masterMode ? 2f : 1f); + if (Main.expertMode) + { + int num667 = 0; + for (int num668 = 0; num668 < Main.maxPlayers; num668++) + { + if (Main.player[num668].active && !Main.player[num668].dead && (npc.Center - Main.player[num668].Center).Length() < 1000f) + num667++; + } + + npc.ai[1] += num667 / 2; + float beeTimerIncrease = Main.masterMode ? 0.125f : 0.25f; + if ((double)npc.life < (double)npc.lifeMax * 0.75) + npc.ai[1] += beeTimerIncrease; + + if ((double)npc.life < (double)npc.lifeMax * 0.5) + npc.ai[1] += beeTimerIncrease; + + if ((double)npc.life < (double)npc.lifeMax * 0.25) + npc.ai[1] += beeTimerIncrease; + + if ((double)npc.life < (double)npc.lifeMax * 0.1) + npc.ai[1] += beeTimerIncrease; + } + + bool flag35 = false; + int num669 = (int)(40f - 18f * num644); + if (npc.ai[1] > (float)num669) + { + npc.ai[1] = 0f; + npc.ai[2]++; + flag35 = true; + } + + 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); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int num670 = Main.rand.Next(NPCID.Bee, NPCID.BeeSmall + 1); + int num671 = NPC.NewNPC(npc.GetSource_FromAI(), (int)beeSpawnLocation.X, (int)beeSpawnLocation.Y, num670); + Vector2 beeVelocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY); + Main.npc[num671].velocity = beeVelocity; + Main.npc[num671].velocity *= 5f; + Main.npc[num671].CanBeReplacedByOtherNPCs = true; + Main.npc[num671].localAI[0] = 60f; + Main.npc[num671].netUpdate = true; + } + } + + // Velocity calculations if target is too far away + if (Vector2.Distance(beeSpawnLocation, hoverDestination) > 400f || !canHitTarget) + npc.SimpleFlyMovement(idealVelocity, num673); + else + npc.velocity *= (Main.masterMode ? 0.8f : 0.9f); + + float playerLocation = npc.Center.X - Main.player[npc.target].Center.X; + npc.direction = playerLocation < 0 ? 1 : -1; + npc.spriteDirection = npc.direction; + + float maxBees = Main.masterMode ? 8f : 5f; + if (npc.ai[2] > maxBees) + { + npc.ai[0] = -1f; + npc.ai[1] = 1f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 3f) + { + // Avoid cheap bullshit + npc.damage = 0; + + float playerLocation = npc.Center.X - Main.player[npc.target].Center.X; + npc.direction = playerLocation < 0 ? 1 : -1; + npc.spriteDirection = npc.direction; + + float num674 = 12f; + float num675 = 0.1f; + if (Main.expertMode) + { + num675 = Main.masterMode ? 0.2f : 0.15f; + num674 = Main.masterMode ? 16f : 14f; + } + num675 += 0.2f * num644; + num674 += 6f * num644; + + Vector2 stingerSpawnLocation = new Vector2(npc.Center.X + (Main.rand.Next(20) * npc.direction), npc.position.Y + npc.height * 0.8f); + bool canHitTarget = Collision.CanHit(new Vector2(stingerSpawnLocation.X, stingerSpawnLocation.Y - 30f), 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height); + Vector2 hoverDestination = Main.player[npc.target].Center - Vector2.UnitY * (!canHitTarget ? 0f : 300f); + Vector2 idealVelocity = npc.SafeDirectionTo(hoverDestination) * num674; + + npc.ai[1] += 1f; + int num679 = 40; + if (Main.masterMode) + num679 = (((double)npc.life < (double)npc.lifeMax * 0.1) ? 10 : ((npc.life < npc.lifeMax / 3) ? 15 : ((npc.life >= npc.lifeMax / 2) ? 25 : 20))); + else if (Main.expertMode) + num679 = (((double)npc.life < (double)npc.lifeMax * 0.1) ? 15 : ((npc.life < npc.lifeMax / 3) ? 25 : ((npc.life >= npc.lifeMax / 2) ? 35 : 30))); + + num679 -= (int)((Main.masterMode ? 3f : 5f) * num644); + if (npc.ai[1] % (float)num679 == (float)(num679 - 1) && npc.position.Y + (float)npc.height < Main.player[npc.target].position.Y && Collision.CanHit(stingerSpawnLocation, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + SoundEngine.PlaySound(SoundID.Item17, npc.Center); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + float num680 = Main.masterMode ? 11f : 8f; + float stingerVelocityIncrease = Main.masterMode ? 1f : 2f; + if (Main.expertMode) + num680 += stingerVelocityIncrease; + + if (Main.expertMode && (double)npc.life < (double)npc.lifeMax * 0.1) + num680 += stingerVelocityIncrease * 1.5f; + + num680 += 7f * num644; + int num681 = (int)(12f - 5f * num644); + int num682 = (int)(6f - 2f * num644); + if (num681 < 1) + num681 = 1; + + if (num682 < 1) + num682 = 1; + + float num683 = Main.player[npc.target].Center.X - stingerSpawnLocation.X + (float)Main.rand.Next(-num681, num681 + 1); + float num684 = Main.player[npc.target].Center.Y - stingerSpawnLocation.Y + (float)Main.rand.Next(-num682, num682 + 1); + float num685 = (float)Math.Sqrt(num683 * num683 + num684 * num684); + num685 = num680 / num685; + num683 *= num685; + num684 *= num685; + int type = ProjectileID.QueenBeeStinger; + int num688 = Projectile.NewProjectile(npc.GetSource_FromAI(), stingerSpawnLocation.X, stingerSpawnLocation.Y, num683, num684, type, npc.GetProjectileDamage(type), 0f, Main.myPlayer); + Main.projectile[num688].timeLeft = 300; + } + } + + if (Vector2.Distance(stingerSpawnLocation, hoverDestination) > 40f || !canHitTarget) + npc.SimpleFlyMovement(idealVelocity, num675); + + float num689 = Main.masterMode ? 16f : 20f; + num689 -= 5f * num644; + if (npc.ai[1] > (float)num679 * num689) + { + npc.ai[0] = -1f; + npc.ai[1] = 3f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 4f) + { + // Avoid cheap bullshit + npc.damage = 0; + + npc.localAI[0] = 1f; + float num690 = 14f; + float num691 = 14f; + Vector2 vector88 = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY); + vector88 *= num690; + npc.velocity = (npc.velocity * num691 + vector88) / (num691 + 1f); + if (npc.velocity.X < 0f) + npc.direction = -1; + else + npc.direction = 1; + + npc.spriteDirection = npc.direction; + if (num645 < 2000f) + { + npc.ai[0] = -1f; + npc.localAI[0] = 0f; + } + } + + return false; + } + } +} diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/QueenSlimeAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/QueenSlimeAI.cs new file mode 100644 index 0000000000..40b7d577b3 --- /dev/null +++ b/NPCs/VanillaNPCAIOverrides/Bosses/QueenSlimeAI.cs @@ -0,0 +1,2097 @@ +using System; +using System.Collections.Generic; +using CalamityMod.Events; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses +{ + public static class QueenSlimeAI + { + public static bool BuffedQueenSlimeAI(NPC npc, Mod mod) + { + // Difficulty bools + bool bossRush = BossRushEvent.BossRushActive; + bool masterMode = Main.masterMode || bossRush; + bool death = CalamityWorld.death || bossRush; + + // Percent life remaining + float lifeRatio = npc.life / (float)npc.lifeMax; + + float slimeScale = 1f; + bool teleported = false; + bool phase2 = lifeRatio <= 0.5f; + bool phase3 = lifeRatio <= (masterMode ? 0.5f : 0.4f); + bool phase4 = lifeRatio <= (masterMode ? 0.5f : 0.2f); + bool phase5 = lifeRatio <= 0.25f && masterMode; + + // Spawn settings + if (npc.localAI[0] == 0f) + { + npc.ai[1] = -20f; + npc.localAI[0] = npc.lifeMax; + npc.TargetClosest(); + npc.netUpdate = true; + } + + // Emit light + Lighting.AddLight(npc.Center, 1f, 0.7f, 0.9f); + + // Despawn + int despawnDistanceInTiles = 500; + if (Main.player[npc.target].dead || Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) / 16f > despawnDistanceInTiles) + { + npc.TargetClosest(); + if (Main.player[npc.target].dead || Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) / 16f > despawnDistanceInTiles) + { + npc.EncourageDespawn(10); + if (Main.player[npc.target].Center.X < npc.Center.X) + npc.direction = 1; + else + npc.direction = -1; + } + } + + // Teleport + float teleportGateValue = masterMode ? 300f : 600f; + if (!Main.player[npc.target].dead && npc.timeLeft > 10 && !phase2 && npc.ai[3] >= teleportGateValue && npc.ai[0] == 0f && npc.velocity.Y == 0f) + { + // Avoid cheap bullshit + npc.damage = 0; + + npc.ai[0] = 2f; + npc.ai[1] = 0f; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.netUpdate = true; + npc.TargetClosest(faceTarget: 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; + int teleportTries = 0; + while (teleportTries < 100) + { + teleportTries++; + int teleportTileX = Main.rand.Next(predictiveTeleportPoint.X - randomTeleportOffset, predictiveTeleportPoint.X + randomTeleportOffset + 1); + int teleportTileY = Main.rand.Next(predictiveTeleportPoint.Y - randomTeleportOffset, predictiveTeleportPoint.Y); + if (Main.tile[teleportTileX, teleportTileY].HasUnactuatedTile) + continue; + + bool canTeleportToTile = true; + if (canTeleportToTile && Main.tile[teleportTileX, teleportTileY].LiquidType == LiquidID.Lava) + canTeleportToTile = false; + if (canTeleportToTile && !Collision.CanHitLine(npc.Center, 0, 0, vectorAimedAheadOfTarget, 0, 0)) + canTeleportToTile = false; + + if (canTeleportToTile) + { + npc.localAI[1] = teleportTileX * 16 + 8; + npc.localAI[2] = teleportTileY * 16 + 16; + npc.ai[3] = 0f; + break; + } + } + + // Default teleport if the above conditions aren't met in 100 iterations + if (teleportTries >= 100) + { + Vector2 bottom = Main.player[Player.FindClosest(npc.position, npc.width, npc.height)].Bottom; + npc.localAI[1] = bottom.X; + npc.localAI[2] = bottom.Y; + npc.ai[3] = 0f; + } + } + } + + // Get ready to teleport by increasing ai[3] + if (!phase2) + { + if (npc.ai[3] < teleportGateValue) + { + if (!Collision.CanHitLine(npc.Center, 0, 0, Main.player[npc.target].Center, 0, 0) || Math.Abs(npc.Top.Y - Main.player[npc.target].Bottom.Y) > 320f) + npc.ai[3] += death ? 3f : 2f; + else + npc.ai[3] += 1f; + } + } + else + { + float teleportNetUpdate = npc.ai[3]; + npc.ai[3] -= 1f; + if (npc.ai[3] < 0f) + { + if (Main.netMode != NetmodeID.MultiplayerClient && teleportNetUpdate > 0f) + npc.netUpdate = true; + + npc.ai[3] = 0f; + } + } + + // Reset variables if despawning + if (npc.timeLeft <= 10 && ((phase2 && npc.ai[0] != 0f) || (!phase2 && npc.ai[0] != 3f))) + { + if (phase2) + npc.ai[0] = 0f; + else + npc.ai[0] = 3f; + + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.netUpdate = true; + } + + npc.noTileCollide = false; + npc.noGravity = false; + + // Frame data shit I guess? + if (phase2) + { + npc.localAI[3] += 1f; + if (npc.localAI[3] >= 24f) + npc.localAI[3] = 0f; + + if ((npc.ai[0] == 4f || npc.ai[0] == 6f) && npc.ai[2] == 1f) + npc.localAI[3] = 6f; + + if (npc.ai[0] == 5f && npc.ai[2] != 1f) + npc.localAI[3] = 7f; + } + + // Phases + switch ((int)npc.ai[0]) + { + // Phase switch phase + case 0: + + // Avoid cheap bullshit + npc.damage = 0; + + if (phase2) + { + QueenSlime_FlyMovement(npc); + } + else + { + npc.noTileCollide = false; + npc.noGravity = false; + if (npc.velocity.Y == 0f) + { + npc.velocity.X *= 0.8f; + if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) + npc.velocity.X = 0f; + } + } + + if (npc.timeLeft <= 10 || (!phase2 && npc.velocity.Y != 0f)) + break; + + npc.ai[1] += 1f; + int idleTime = bossRush ? 20 : death ? 30 : 40; + if (phase2) + idleTime = bossRush ? 40 : death ? 60 : 80; + if (phase4) + idleTime /= 2; + + if (!(npc.ai[1] > idleTime)) + break; + + npc.ai[1] = 0f; + if (phase2) + { + Player player = Main.player[npc.target]; + + switch ((int)npc.Calamity().newAI[0]) + { + default: + npc.ai[0] = Main.rand.NextBool() ? 6f : 5f; + break; + case 5: + npc.ai[0] = phase4 ? 6f : Main.rand.NextBool() ? 4f : 6f; + break; + case 6: + npc.ai[0] = phase4 ? 5f : Main.rand.NextBool() ? 5f : 4f; + break; + } + + if (npc.ai[0] == 4f || npc.ai[0] == 6f) + { + npc.ai[2] = 1f; + if (player != null && player.active && !player.dead && (player.Bottom.Y < npc.Bottom.Y || Math.Abs(player.Center.X - npc.Center.X) > 450f)) + { + npc.ai[0] = 5f; + npc.ai[2] = 0f; + } + } + } + else + { + switch ((int)npc.Calamity().newAI[0]) + { + default: + npc.ai[0] = Main.rand.NextBool() ? 5f : 4f; + break; + case 4: + npc.ai[0] = Main.rand.NextBool() ? 3f : 5f; + break; + case 5: + npc.ai[0] = Main.rand.NextBool() ? 4f : 3f; + break; + } + } + + npc.netUpdate = true; + break; + + // Enlarge after teleport + case 1: + + // Avoid cheap bullshit + npc.damage = 0; + + npc.rotation = 0f; + npc.ai[1] += 1f; + float teleportEndTime = bossRush ? 10f : death ? 15f : 20f; + slimeScale = MathHelper.Clamp(npc.ai[1] / teleportEndTime, 0f, 1f); + slimeScale = 0.5f + slimeScale * 0.5f; + if (npc.ai[1] >= teleportEndTime && Main.netMode != NetmodeID.MultiplayerClient) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.netUpdate = true; + npc.TargetClosest(); + } + + if (Main.netMode == NetmodeID.MultiplayerClient && npc.ai[1] >= teleportEndTime * 2f) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.TargetClosest(); + } + + // Emit teleport dust + Color newColor2 = NPC.AI_121_QueenSlime_GetDustColor(); + newColor2.A = 150; + for (int i = 0; i < 10; i++) + { + int queenSlimeDust = Dust.NewDust(npc.position + Vector2.UnitX * -20f, npc.width + 40, npc.height, DustID.TintableDust, npc.velocity.X, npc.velocity.Y, 50, newColor2, 1.5f); + Main.dust[queenSlimeDust].noGravity = true; + Main.dust[queenSlimeDust].velocity *= 2f; + } + + break; + + // Shrink and spawn teleport gore and dust + case 2: + + // Avoid cheap bullshit + npc.damage = 0; + + npc.rotation = 0f; + npc.ai[1] += 1f; + float teleportTime = bossRush ? 20f : death ? 30f : 40f; + slimeScale = MathHelper.Clamp((teleportTime - npc.ai[1]) / teleportTime, 0f, 1f); + slimeScale = 0.5f + slimeScale * 0.5f; + + if (npc.ai[1] >= teleportTime) + teleported = true; + + // Spawn crown gore + if (npc.ai[1] == teleportTime) + { + Gore.NewGore(npc.GetSource_FromAI(), npc.Center + new Vector2(-40f, -npc.height / 2), npc.velocity, GoreID.QueenSlimeCrown); + + // Spawn spread of projectiles in Master Mode + if (masterMode) + { + int numGelProjectiles = 12; + if (Main.getGoodWorld) + numGelProjectiles = 15; + + float gelVelocity = death ? 20f : 16f; + int type = ProjectileID.QueenSlimeGelAttack; + int damage = npc.GetProjectileDamage(type); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + for (int j = 0; j < numGelProjectiles; j++) + { + Vector2 spinningpoint = new Vector2(gelVelocity, 0f); + + if (CalamityWorld.LegendaryMode) + spinningpoint *= Main.rand.NextFloat() + 0.5f; + + spinningpoint = spinningpoint.RotatedBy((float)(-j) * MathHelper.TwoPi / (float)numGelProjectiles, Vector2.Zero); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, spinningpoint, type, damage, 0f, Main.myPlayer, 0f, -2f); + Main.projectile[proj].timeLeft = 900; + } + } + + SoundEngine.PlaySound(SoundID.Item155, npc.Center); + } + } + + if (npc.ai[1] >= teleportTime && Main.netMode != NetmodeID.MultiplayerClient) + { + npc.Bottom = new Vector2(npc.localAI[1], npc.localAI[2]); + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.netUpdate = true; + } + + if (Main.netMode == NetmodeID.MultiplayerClient && npc.ai[1] >= teleportTime * 2f) + { + npc.ai[0] = 1f; + npc.ai[1] = 0f; + } + + // Emit teleport dust + if (!teleported) + { + Color newColor = NPC.AI_121_QueenSlime_GetDustColor(); + newColor.A = 150; + for (int n = 0; n < 10; n++) + { + int queenSlimeDust2 = Dust.NewDust(npc.position + Vector2.UnitX * -20f, npc.width + 40, npc.height, DustID.TintableDust, npc.velocity.X, npc.velocity.Y, 50, newColor, 1.5f); + Main.dust[queenSlimeDust2].noGravity = true; + Main.dust[queenSlimeDust2].velocity *= 0.5f; + } + } + + break; + + // She jump + case 3: + + // Faster fall + if (npc.velocity.Y > 0f) + npc.velocity.Y += bossRush ? 0.1f : death ? 0.05f : 0f; + + npc.rotation = 0f; + if (npc.velocity.Y == 0f) + { + // Avoid cheap bullshit + npc.damage = 0; + + npc.velocity.X *= 0.8f; + if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) + npc.velocity.X = 0f; + + float timerIncrement = bossRush ? 7f : death ? 6f : 5f; + npc.ai[1] += timerIncrement; + if (lifeRatio < 0.85f) + npc.ai[1] += timerIncrement; + if (lifeRatio < 0.7f) + npc.ai[1] += timerIncrement; + + if (!(npc.ai[1] >= 0f)) + break; + + // Set damage + npc.damage = npc.defDamage; + + float distanceBelowTarget = npc.position.Y - (Main.player[npc.target].position.Y + 80f); + float speedMult = 1f; + if (distanceBelowTarget > 0f) + speedMult += distanceBelowTarget * 0.002f; + + if (speedMult > 2f) + speedMult = 2f; + + npc.netUpdate = true; + npc.TargetClosest(); + if (npc.ai[2] == 3f) + { + npc.velocity.Y = -13f * speedMult; + npc.velocity.X += (bossRush ? 7f : death ? 6f : 5.5f) * npc.direction; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + if (npc.timeLeft > 10) + { + npc.Calamity().newAI[0] = npc.ai[0]; + npc.SyncExtraAI(); + npc.ai[0] = 0f; + } + else + npc.ai[1] = -60f; + } + else if (npc.ai[2] == 2f) + { + npc.velocity.Y = -(bossRush ? 10f : death ? 8f : 6f) * speedMult; + npc.velocity.X += (bossRush ? 8.5f : death ? 7.5f : 7f) * npc.direction; + npc.ai[1] = -40f; + npc.ai[2] += 1f; + } + else + { + npc.velocity.Y = -(bossRush ? 12f : death ? 10f : 8f) * speedMult; + npc.velocity.X += (bossRush ? 7.5f : death ? 6.5f : 6f) * npc.direction; + npc.ai[1] = -40f; + npc.ai[2] += 1f; + } + + if (masterMode) + npc.velocity.X *= (death ? 1.4f : 1.2f); + + npc.noTileCollide = true; + } + else + { + if (npc.target >= Main.maxPlayers) + break; + + float jumpVelocity = bossRush ? 9f : death ? (masterMode ? 7f : 5.5f) : (masterMode ? 6f : 4.5f); + if (Main.getGoodWorld) + jumpVelocity = 12f; + + if ((npc.direction == 1 && npc.velocity.X < jumpVelocity) || (npc.direction == -1 && npc.velocity.X > 0f - jumpVelocity)) + { + if ((npc.direction == -1 && npc.velocity.X < 0.1) || (npc.direction == 1 && npc.velocity.X > -0.1)) + npc.velocity.X += (bossRush ? 1f : death ? (masterMode ? 0.45f : 0.35f) : (masterMode ? 0.4f : 0.3f)) * npc.direction; + else + npc.velocity.X *= bossRush ? 0.8f : death ? (masterMode ? 0.85f : 0.9f) : (masterMode ? 0.88f : 0.91f); + } + + if (!Main.player[npc.target].dead) + { + if (npc.velocity.Y > 0f && npc.Bottom.Y > Main.player[npc.target].Top.Y) + npc.noTileCollide = false; + else if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].Center, 1, 1) && !Collision.SolidCollision(npc.position, npc.width, npc.height)) + npc.noTileCollide = false; + else + npc.noTileCollide = true; + } + } + + break; + + // Slam down and create shockwave + // Create a cascade of crystals while falling down in phase 3 and the case is 4 + // Release a massive eruption of crystals in phase 3 and the case is 6 + case 4: + case 6: + + // Avoid cheap bullshit + npc.damage = 0; + + npc.rotation *= 0.9f; + npc.noTileCollide = true; + npc.noGravity = true; + + if (npc.ai[2] == 1f) + { + npc.noTileCollide = false; + npc.noGravity = false; + + int slamDelay = 30; + if (phase2) + slamDelay = 10; + + if (Main.getGoodWorld) + slamDelay = 0; + + if (npc.velocity.Y == 0f) + { + SoundEngine.PlaySound(SoundID.Item167, npc.Center); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int type = ProjectileID.QueenSlimeSmash; + int damage = npc.GetProjectileDamage(type); + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Bottom, Vector2.Zero, type, damage, 0f, Main.myPlayer); + + // Line of explosions in Master Mode + if (masterMode) + { + float expandDelay = 0f; + int maxSmashes = death ? 22 : 16; + float maxSmashOffset = maxSmashes * 100f; + Vector2 extraSmashPosition = npc.Bottom + Vector2.UnitX * maxSmashOffset; + int maxSmashesPerSide = maxSmashes / 2; + float maxExpandDelay = (death ? 10f : 15f) * maxSmashesPerSide; + float smashSpawnDistanceOffset = 200f; + for (int i = 0; i < maxSmashes + 1; i++) + { + expandDelay = MathHelper.Lerp(0f, maxExpandDelay, Math.Abs(i - maxSmashesPerSide) / (float)maxSmashesPerSide); + if (i != maxSmashesPerSide) + Projectile.NewProjectile(npc.GetSource_FromAI(), extraSmashPosition, Vector2.Zero, type, damage, 0f, Main.myPlayer, -expandDelay); + + extraSmashPosition -= Vector2.UnitX * smashSpawnDistanceOffset; + } + } + + // Eruption of crystals in phase 3 + if (npc.ai[0] == 6f && phase3) + { + float projectileVelocity = masterMode ? (death ? 18f : 15f) : 12f; + type = ProjectileID.QueenSlimeMinionBlueSpike; + damage = npc.GetProjectileDamage(type); + Vector2 destination = (new Vector2(npc.Center.X, npc.Center.Y - 100f) - npc.Center).SafeNormalize(Vector2.UnitY); + destination *= projectileVelocity; + int numProj = 20; + float rotation = MathHelper.ToRadians(100); + for (int i = 0; i < numProj; i++) + { + Vector2 perturbedSpeed = destination.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, perturbedSpeed, type, damage, 0f, Main.myPlayer, 0f, -2f); + } + + if (phase5) + { + numProj = 15; + destination *= 0.75f; + for (int i = 0; i < numProj; i++) + { + Vector2 perturbedSpeed = destination.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, perturbedSpeed, type, damage, 0f, Main.myPlayer, 0f, -2f); + } + } + } + } + + for (int l = 0; l < 20; l++) + { + int slamDust = Dust.NewDust(npc.Bottom - new Vector2(npc.width / 2, 30f), npc.width, 30, DustID.Smoke, npc.velocity.X, npc.velocity.Y, 40, NPC.AI_121_QueenSlime_GetDustColor()); + Main.dust[slamDust].noGravity = true; + Main.dust[slamDust].velocity.Y = -5f + Main.rand.NextFloat() * -3f; + Main.dust[slamDust].velocity.X *= 7f; + } + + npc.Calamity().newAI[0] = npc.ai[0]; + npc.SyncExtraAI(); + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.netUpdate = true; + } + else if (npc.ai[1] >= slamDelay) + { + for (int m = 0; m < 4; m++) + { + Vector2 position = npc.Bottom - new Vector2(Main.rand.NextFloatDirection() * 16f, Main.rand.Next(8)); + int slamDust2 = Dust.NewDust(position, 2, 2, DustID.Smoke, npc.velocity.X, npc.velocity.Y, 40, NPC.AI_121_QueenSlime_GetDustColor(), 1.4f); + Main.dust[slamDust2].position = position; + Main.dust[slamDust2].noGravity = true; + Main.dust[slamDust2].velocity.Y = npc.velocity.Y * 0.9f; + Main.dust[slamDust2].velocity.X = (Main.rand.NextBool() ? (-10f) : 10f) + Main.rand.NextFloatDirection() * 3f; + } + } + + npc.velocity.X *= 0.8f; + float slamNetUpdate = npc.ai[1]; + npc.ai[1] += 1f; + if (npc.ai[1] >= slamDelay) + { + if (slamNetUpdate < slamDelay) + npc.netUpdate = true; + + if (phase2 && npc.ai[1] > (slamDelay + 120)) + { + npc.Calamity().newAI[0] = npc.ai[0]; + npc.SyncExtraAI(); + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.velocity.Y *= 0.8f; + npc.netUpdate = true; + break; + } + + // Set damage + npc.damage = npc.defDamage; + + npc.velocity.Y += bossRush ? 2f : death ? 1.75f : 1.5f; + float slamVelocity = bossRush ? 15.99f : death ? 15.5f : 15f; + if (Main.getGoodWorld) + { + npc.velocity.Y += 1f; + slamVelocity = 15.99f; + } + + if (npc.velocity.Y == 0f) + npc.velocity.Y = 0.01f; + + if (npc.velocity.Y >= slamVelocity) + npc.velocity.Y = slamVelocity; + + // Cascade of crystals in phase 3 or 4 while falling down + if (((npc.ai[0] == 4f && phase3) || phase4) && npc.ai[1] % 12f == 0f) + { + SoundEngine.PlaySound(SoundID.Item154, npc.Center); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Vector2 fireFrom = npc.Center; + int projectileAmt = 2; + int type = ProjectileID.QueenSlimeMinionBlueSpike; + int damage = npc.GetProjectileDamage(type); + Vector2 velocityIncrease = masterMode ? (Vector2.UnitY * (death ? 4f : 2f)) : Vector2.Zero; + for (int i = 0; i < projectileAmt; i++) + { + int totalProjectiles = 2; + float radians = MathHelper.TwoPi / totalProjectiles; + for (int j = 0; j < totalProjectiles; j++) + { + Vector2 projVelocity = (npc.velocity + velocityIncrease).RotatedBy(radians * j + MathHelper.PiOver2); + Projectile.NewProjectile(npc.GetSource_FromAI(), fireFrom, projVelocity, type, damage, 0f, Main.myPlayer, 0f, -1f); + } + } + } + } + } + else + npc.velocity.Y *= 0.8f; + + break; + } + + if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[1] == 0f) + { + npc.TargetClosest(); + npc.netUpdate = true; + } + + npc.ai[1] += 1f; + if (!(npc.ai[1] >= 30f)) + break; + + if (npc.ai[1] >= 60f) + { + npc.ai[1] = 60f; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.ai[1] = 0f; + npc.ai[2] = 1f; + npc.velocity.Y = -3f; + npc.netUpdate = true; + } + } + + Player player3 = Main.player[npc.target]; + Vector2 center = npc.Center; + if (!player3.dead && player3.active && Math.Abs(npc.Center.X - player3.Center.X) / 16f <= despawnDistanceInTiles) + center = player3.Center; + + center.Y -= 384f; + if (npc.velocity.Y == 0f) + { + npc.velocity = center - npc.Center; + npc.velocity = npc.velocity.SafeNormalize(Vector2.Zero); + npc.velocity *= bossRush ? 30f : death ? (masterMode ? 27.3f : 26f) : (masterMode ? 25.2f : 24f); + } + else + npc.velocity.Y *= 0.95f; + + break; + + // Fire spread of gel projectiles + case 5: + + // Avoid cheap bullshit + npc.damage = 0; + + npc.rotation *= 0.9f; + npc.noTileCollide = true; + npc.noGravity = true; + + if (phase2) + npc.ai[3] = 0f; + + if (npc.ai[2] == 1f) + { + npc.ai[1] += 1f; + if (!(npc.ai[1] >= 10f)) + break; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int numGelProjectiles = phase4 ? Main.rand.Next(9, 12) : phase2 ? Main.rand.Next(6, 9) : 12; + if (phase5) + numGelProjectiles += 6; + if (Main.getGoodWorld) + numGelProjectiles = 20; + + float projectileVelocity = death ? 12f : 10.5f; + int type = ProjectileID.QueenSlimeGelAttack; + int damage = npc.GetProjectileDamage(type); + if (phase2) + { + Vector2 destination = (new Vector2(npc.Center.X, npc.Center.Y + 100f) - npc.Center).SafeNormalize(Vector2.UnitY); + destination *= projectileVelocity; + float rotation = MathHelper.ToRadians(120); + for (int i = 0; i < numGelProjectiles; i++) + { + if (CalamityWorld.LegendaryMode) + destination *= Main.rand.NextFloat() + 0.5f; + + Vector2 perturbedSpeed = destination.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numGelProjectiles - 1))); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, perturbedSpeed, type, damage, 0f, Main.myPlayer, 0f, -2f); + Main.projectile[proj].timeLeft = 900; + } + } + else + { + for (int j = 0; j < numGelProjectiles; j++) + { + Vector2 spinningpoint = new Vector2(projectileVelocity, 0f); + + if (CalamityWorld.LegendaryMode) + spinningpoint *= Main.rand.NextFloat() + 0.5f; + + spinningpoint = spinningpoint.RotatedBy((-j) * MathHelper.TwoPi / numGelProjectiles, Vector2.Zero); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, spinningpoint, type, damage, 0f, Main.myPlayer, 0f, -2f); + Main.projectile[proj].timeLeft = 900; + } + } + + // Fire gel balls directly at players with a max of 3 + List targets = new List(); + for (int p = 0; p < Main.maxPlayers; p++) + { + if (Main.player[p].active && !Main.player[p].dead) + targets.Add(p); + + if (targets.Count > 2) + break; + } + foreach (int t in targets) + { + Vector2 velocity2 = (Main.player[t].Center - npc.Center).SafeNormalize(Vector2.UnitY) * projectileVelocity; + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, velocity2, type, damage, 0f, Main.myPlayer, 0f, -2f); + Main.projectile[proj].timeLeft = 900; + } + } + + SoundEngine.PlaySound(SoundID.Item155, npc.Center); + npc.Calamity().newAI[0] = npc.ai[0]; + npc.SyncExtraAI(); + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.netUpdate = true; + break; + } + + if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[1] == 0f) + { + npc.TargetClosest(); + npc.netUpdate = true; + } + + npc.ai[1] += 1f; + if (npc.ai[1] >= 50f) + { + npc.ai[1] = 50f; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.ai[1] = 0f; + npc.ai[2] = 1f; + npc.netUpdate = true; + } + } + + float slamDustRadius = 100f; + for (int k = 0; k < 4; k++) + { + Vector2 slamDustArea = npc.Center + Main.rand.NextVector2CircularEdge(slamDustRadius, slamDustRadius); + if (!phase2) + slamDustArea += new Vector2(0f, 20f); + + Vector2 v = slamDustArea - npc.Center; + v = v.SafeNormalize(Vector2.Zero) * -8f; + int superSlamDust = Dust.NewDust(slamDustArea, 2, 2, DustID.Smoke, v.X, v.Y, 40, NPC.AI_121_QueenSlime_GetDustColor(), 1.8f); + Main.dust[superSlamDust].position = slamDustArea; + Main.dust[superSlamDust].noGravity = true; + Main.dust[superSlamDust].alpha = 250; + Main.dust[superSlamDust].velocity = v; + Main.dust[superSlamDust].customData = npc; + } + + if (phase2) + QueenSlime_FlyMovement(npc); + + break; + } + + // Don't take damage while teleporting + npc.dontTakeDamage = npc.hide = teleported; + + // Adjust size with HP + if (slimeScale != npc.scale) + { + npc.position.X += npc.width / 2; + npc.position.Y += npc.height; + npc.scale = slimeScale; + npc.width = (int)(114f * npc.scale); + npc.height = (int)(100f * npc.scale); + npc.position.X -= npc.width / 2; + npc.position.Y -= npc.height; + } + + // Spawn small slimes + // Don't spawn any slimes in final phase + if (npc.life <= 0 || (phase4 && !masterMode)) + return false; + + if (Main.netMode == NetmodeID.MultiplayerClient) + return false; + + // Reset numerous variables when phase 2 begins + if (npc.localAI[0] >= (npc.lifeMax / 2) && npc.life < npc.lifeMax / 2) + { + npc.localAI[0] = npc.life; + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.netUpdate = true; + } + + float slimeSpawnHealthGateValue = CalamityWorld.LegendaryMode ? 0.01f : phase3 ? 0.04f : phase2 ? 0.03f : 0.025f; + if (masterMode) + slimeSpawnHealthGateValue *= 0.5f; + + int slimeSpawnThreshold = (int)(npc.lifeMax * slimeSpawnHealthGateValue); + + if (!((npc.life + slimeSpawnThreshold) < npc.localAI[0])) + return false; + + npc.localAI[0] = npc.life; + 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 random = Main.rand.Next(2); + if (phase2) + random += 1; + if (phase3) + random = 2; + + int typeToSpawn = NPCID.QueenSlimeMinionBlue; + switch (random) + { + case 0: + typeToSpawn = NPCID.QueenSlimeMinionBlue; + break; + case 1: + typeToSpawn = NPCID.QueenSlimeMinionPink; + break; + case 2: + typeToSpawn = NPCID.QueenSlimeMinionPurple; + break; + } + + int slimeScale2 = NPC.NewNPC(npc.GetSource_FromAI(), x, y, typeToSpawn); + Main.npc[slimeScale2].SetDefaults(typeToSpawn); + Main.npc[slimeScale2].velocity.X = Main.rand.Next(-15, 16) * 0.1f; + Main.npc[slimeScale2].velocity.Y = Main.rand.Next(-30, 1) * 0.1f; + Main.npc[slimeScale2].ai[0] = -500 * Main.rand.Next(3); + Main.npc[slimeScale2].ai[1] = 0f; + if (Main.netMode == NetmodeID.Server && slimeScale2 < Main.maxNPCs) + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, slimeScale2); + + return false; + } + + public static bool VanillaQueenSlimeAI(NPC npc, Mod mod) + { + float num3 = 1f; + bool flag = false; + bool flag2 = npc.life <= npc.lifeMax / 2; + if (npc.localAI[0] == 0f) + { + npc.ai[1] = -100f; + npc.localAI[0] = npc.lifeMax; + npc.TargetClosest(); + npc.netUpdate = true; + } + + Lighting.AddLight(npc.Center, 1f, 0.7f, 0.9f); + int num4 = 500; + if (Main.player[npc.target].dead || Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) / 16f > (float)num4) + { + npc.TargetClosest(); + if (Main.player[npc.target].dead || Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) / 16f > (float)num4) + { + npc.EncourageDespawn(10); + if (Main.player[npc.target].Center.X < npc.Center.X) + npc.direction = 1; + else + npc.direction = -1; + } + } + + if (!Main.player[npc.target].dead && npc.timeLeft > 10 && !flag2 && npc.ai[3] >= 300f && npc.ai[0] == 0f && npc.velocity.Y == 0f) + { + // Avoid cheap bullshit + npc.damage = 0; + + npc.ai[0] = 2f; + npc.ai[1] = 0f; + 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; + int num5 = 10; + int num6 = 0; + int num7 = 7; + int num8 = 0; + bool flag3 = false; + if (npc.ai[3] >= 360f || vector.Length() > 2000f) + { + if (npc.ai[3] > 360f) + npc.ai[3] = 360f; + + flag3 = true; + num8 = 100; + } + + while (!flag3 && num8 < 100) + { + num8++; + int num9 = Main.rand.Next(point2.X - num5, point2.X + num5 + 1); + int num10 = Main.rand.Next(point2.Y - num5, point2.Y + 1); + if ((num10 >= point2.Y - num7 && num10 <= point2.Y + num7 && num9 >= point2.X - num7 && num9 <= point2.X + num7) || (num10 >= point.Y - num6 && num10 <= point.Y + num6 && num9 >= point.X - num6 && num9 <= point.X + num6) || Main.tile[num9, num10].HasUnactuatedTile) + continue; + + int num11 = num10; + int i = 0; + if (Main.tile[num9, num11].HasUnactuatedTile && Main.tileSolid[Main.tile[num9, num11].TileType] && !Main.tileSolidTop[Main.tile[num9, num11].TileType]) + { + i = 1; + } + else + { + for (; i < 150 && num11 + i < Main.maxTilesY; i++) + { + int num12 = num11 + i; + if (Main.tile[num9, num12].HasUnactuatedTile && Main.tileSolid[Main.tile[num9, num12].TileType] && !Main.tileSolidTop[Main.tile[num9, num12].TileType]) + { + i--; + break; + } + } + } + + num10 += i; + bool flag4 = true; + if (flag4 && Main.tile[num9, num10].LiquidType == LiquidID.Lava) + flag4 = false; + + if (flag4 && !Collision.CanHitLine(npc.Center, 0, 0, Main.player[npc.target].Center, 0, 0)) + flag4 = false; + + if (flag4) + { + npc.localAI[1] = num9 * 16 + 8; + npc.localAI[2] = num10 * 16 + 16; + flag3 = true; + break; + } + } + + if (num8 >= 100) + { + Vector2 bottom = Main.player[Player.FindClosest(npc.position, npc.width, npc.height)].Bottom; + npc.localAI[1] = bottom.X; + npc.localAI[2] = bottom.Y; + npc.ai[3] = 0f; + } + } + } + + if (!flag2 && (!Collision.CanHitLine(npc.Center, 0, 0, Main.player[npc.target].Center, 0, 0) || Math.Abs(npc.Top.Y - Main.player[npc.target].Bottom.Y) > 320f)) + { + npc.ai[3] += (Main.masterMode ? 3f : Main.expertMode ? 2f : 1.5f); + } + else + { + float num13 = npc.ai[3]; + npc.ai[3] -= 1f; + if (npc.ai[3] < 0f) + { + if (Main.netMode != NetmodeID.MultiplayerClient && num13 > 0f) + npc.netUpdate = true; + + npc.ai[3] = 0f; + } + } + + if (npc.timeLeft <= 10 && ((flag2 && npc.ai[0] != 0f) || (!flag2 && npc.ai[0] != 3f))) + { + if (flag2) + npc.ai[0] = 0f; + else + npc.ai[0] = 3f; + + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.netUpdate = true; + } + + npc.noTileCollide = false; + npc.noGravity = false; + if (flag2) + { + npc.localAI[3] += 1f; + if (npc.localAI[3] >= 24f) + npc.localAI[3] = 0f; + + if (npc.ai[0] == 4f && npc.ai[2] == 1f) + npc.localAI[3] = 6f; + + if (npc.ai[0] == 5f && npc.ai[2] != 1f) + npc.localAI[3] = 7f; + } + + switch ((int)npc.ai[0]) + { + case 0: + { + // Avoid cheap bullshit + npc.damage = 0; + + if (flag2) + { + QueenSlime_FlyMovement_Vanilla(npc); + } + else + { + npc.noTileCollide = false; + npc.noGravity = false; + if (npc.velocity.Y == 0f) + { + npc.velocity.X *= 0.8f; + if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) + npc.velocity.X = 0f; + } + } + + if (npc.timeLeft <= 10 || (!flag2 && npc.velocity.Y != 0f)) + break; + + npc.ai[1] += 1f; + int num18 = 60; + if (flag2) + num18 = 120; + if (Main.masterMode) + num18 /= 2; + + if (!(npc.ai[1] > (float)num18)) + break; + + npc.ai[1] = 0f; + if (flag2) + { + Player player = Main.player[npc.target]; + int num19 = Main.rand.Next(2); + if (num19 != 1) + npc.ai[0] = 4f; + else + npc.ai[0] = 5f; + + if (npc.ai[0] == 4f) + { + npc.ai[2] = 1f; + if (player != null && player.active && !player.dead && (player.Bottom.Y < npc.Bottom.Y || Math.Abs(player.Center.X - npc.Center.X) > 250f)) + { + npc.ai[0] = 5f; + npc.ai[2] = 0f; + } + } + } + else + { + switch (Main.rand.Next(3)) + { + default: + npc.ai[0] = 3f; + break; + case 1: + npc.ai[0] = 4f; + break; + case 2: + npc.ai[0] = 5f; + break; + } + } + + npc.netUpdate = true; + break; + } + + case 1: + { + // Avoid cheap bullshit + npc.damage = 0; + + npc.rotation = 0f; + npc.ai[1] += (Main.masterMode ? 2f : 1f); + num3 = MathHelper.Clamp(npc.ai[1] / 30f, 0f, 1f); + num3 = 0.5f + num3 * 0.5f; + if (npc.ai[1] >= 30f && Main.netMode != NetmodeID.MultiplayerClient) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.netUpdate = true; + npc.TargetClosest(); + } + + if (Main.netMode == NetmodeID.MultiplayerClient && npc.ai[1] >= 60f) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.TargetClosest(); + } + + Color newColor2 = NPC.AI_121_QueenSlime_GetDustColor(); + newColor2.A = 150; + for (int num27 = 0; num27 < 10; num27++) + { + int num28 = Dust.NewDust(npc.position + Vector2.UnitX * -20f, npc.width + 40, npc.height, DustID.TintableDust, npc.velocity.X, npc.velocity.Y, 50, newColor2, 1.5f); + Main.dust[num28].noGravity = true; + Main.dust[num28].velocity *= 2f; + } + + break; + } + + case 2: + + // Avoid cheap bullshit + npc.damage = 0; + + npc.rotation = 0f; + npc.ai[1] += (Main.masterMode ? 2f : 1f); + num3 = MathHelper.Clamp((60f - npc.ai[1]) / 60f, 0f, 1f); + num3 = 0.5f + num3 * 0.5f; + + if (npc.ai[1] >= 60f) + flag = true; + + if (npc.ai[1] == 60f) + { + Gore.NewGore(npc.GetSource_FromAI(), npc.Center + new Vector2(-40f, -npc.height / 2), npc.velocity, GoreID.QueenSlimeCrown); + + if (Main.masterMode) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int num14 = 10; + if (Main.getGoodWorld) + num14 = 15; + + float gelVelocity = 12f; + int type = ProjectileID.QueenSlimeGelAttack; + for (int j = 0; j < num14; j++) + { + Vector2 spinningpoint = new Vector2(gelVelocity, 0f); + spinningpoint = spinningpoint.RotatedBy((float)(-j) * MathHelper.TwoPi / (float)num14, Vector2.Zero); + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, spinningpoint, type, npc.GetProjectileDamage(type), 0f, Main.myPlayer); + } + } + + SoundEngine.PlaySound(SoundID.Item155, npc.Center); + } + } + + if (npc.ai[1] >= 60f && Main.netMode != NetmodeID.MultiplayerClient) + { + npc.Bottom = new Vector2(npc.localAI[1], npc.localAI[2]); + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.netUpdate = true; + } + + if (Main.netMode == NetmodeID.MultiplayerClient && npc.ai[1] >= 120f) + { + npc.ai[0] = 1f; + npc.ai[1] = 0f; + } + + if (!flag) + { + Color newColor = NPC.AI_121_QueenSlime_GetDustColor(); + newColor.A = 150; + for (int n = 0; n < 10; n++) + { + int num26 = Dust.NewDust(npc.position + Vector2.UnitX * -20f, npc.width + 40, npc.height, DustID.TintableDust, npc.velocity.X, npc.velocity.Y, 50, newColor, 1.5f); + Main.dust[num26].noGravity = true; + Main.dust[num26].velocity *= 0.5f; + } + } + break; + + case 3: + npc.rotation = 0f; + if (npc.velocity.Y == 0f) + { + // Avoid cheap bullshit + npc.damage = 0; + + npc.velocity.X *= 0.8f; + if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) + npc.velocity.X = 0f; + + npc.ai[1] += 4f; + if ((double)npc.life < (double)npc.lifeMax * 0.8) + npc.ai[1] += 4f; + + if ((double)npc.life < (double)npc.lifeMax * 0.6) + npc.ai[1] += 4f; + + if (!(npc.ai[1] >= 0f)) + break; + + // Set damage + npc.damage = npc.defDamage; + + npc.netUpdate = true; + npc.TargetClosest(); + if (npc.ai[2] == 3f) + { + npc.velocity.Y = -13f; + npc.velocity.X += 3.5f * (float)npc.direction; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + if (npc.timeLeft > 10) + npc.ai[0] = 0f; + else + npc.ai[1] = -60f; + } + else if (npc.ai[2] == 2f) + { + npc.velocity.Y = -6f; + npc.velocity.X += 4.5f * (float)npc.direction; + npc.ai[1] = -40f; + npc.ai[2] += 1f; + } + else + { + npc.velocity.Y = -8f; + npc.velocity.X += 4f * (float)npc.direction; + npc.ai[1] = -40f; + npc.ai[2] += 1f; + } + + if (Main.expertMode) + { + npc.velocity.X *= 1.5f; + npc.velocity.Y *= 1.25f; + } + + if (Main.masterMode) + { + npc.velocity.X *= 1.3f; + npc.velocity.Y *= 1.1f; + } + } + else + { + if (npc.target >= Main.maxPlayers) + break; + + float num20 = Main.masterMode ? 5f : 3f; + if (Main.getGoodWorld) + num20 = 7f; + + if ((npc.direction == 1 && npc.velocity.X < num20) || (npc.direction == -1 && npc.velocity.X > 0f - num20)) + { + if ((npc.direction == -1 && (double)npc.velocity.X < 0.1) || (npc.direction == 1 && (double)npc.velocity.X > -0.1)) + npc.velocity.X += 0.2f * (float)npc.direction; + else + npc.velocity.X *= 0.93f; + } + } + break; + + case 4: + { + // Avoid cheap bullshit + npc.damage = 0; + + npc.rotation *= 0.9f; + npc.noTileCollide = true; + npc.noGravity = true; + if (npc.ai[2] == 1f) + { + npc.noTileCollide = false; + npc.noGravity = false; + int num21 = 30; + if (flag2) + num21 = 10; + + if (Main.getGoodWorld) + num21 = 0; + + Player player2 = Main.player[npc.target]; + if (npc.velocity.Y == 0f) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.netUpdate = true; + SoundEngine.PlaySound(SoundID.Item167, npc.Center); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int type = ProjectileID.QueenSlimeSmash; + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Bottom, Vector2.Zero, type, npc.GetProjectileDamage(type), 0f, Main.myPlayer); + + if (Main.masterMode) + { + float expandDelay = 0f; + int maxSmashes = 10; + float maxSmashOffset = maxSmashes * 100f; + Vector2 extraSmashPosition = npc.Bottom + Vector2.UnitX * maxSmashOffset; + int maxSmashesPerSide = maxSmashes / 2; + float maxExpandDelay = 20f * maxSmashesPerSide; + float smashSpawnDistanceOffset = 200f; + for (int i = 0; i < maxSmashes + 1; i++) + { + expandDelay = MathHelper.Lerp(0f, maxExpandDelay, Math.Abs(i - maxSmashesPerSide) / (float)maxSmashesPerSide); + if (i != maxSmashesPerSide) + Projectile.NewProjectile(npc.GetSource_FromAI(), extraSmashPosition, Vector2.Zero, type, npc.GetProjectileDamage(type), 0f, Main.myPlayer, -expandDelay); + + extraSmashPosition -= Vector2.UnitX * smashSpawnDistanceOffset; + } + } + } + + for (int l = 0; l < 20; l++) + { + int num22 = Dust.NewDust(npc.Bottom - new Vector2(npc.width / 2, 30f), npc.width, 30, DustID.Smoke, npc.velocity.X, npc.velocity.Y, 40, NPC.AI_121_QueenSlime_GetDustColor()); + Main.dust[num22].noGravity = true; + Main.dust[num22].velocity.Y = -5f + Main.rand.NextFloat() * -3f; + Main.dust[num22].velocity.X *= 7f; + } + } + else if (npc.ai[1] >= (float)num21) + { + for (int m = 0; m < 4; m++) + { + Vector2 vector3 = npc.Bottom - new Vector2(Main.rand.NextFloatDirection() * 16f, Main.rand.Next(8)); + int num23 = Dust.NewDust(vector3, 2, 2, DustID.Smoke, npc.velocity.X, npc.velocity.Y, 40, NPC.AI_121_QueenSlime_GetDustColor(), 1.4f); + Main.dust[num23].position = vector3; + Main.dust[num23].noGravity = true; + Main.dust[num23].velocity.Y = npc.velocity.Y * 0.9f; + Main.dust[num23].velocity.X = (Main.rand.NextBool() ? (-10f) : 10f) + Main.rand.NextFloatDirection() * 3f; + } + } + + npc.velocity.X *= 0.8f; + float num24 = npc.ai[1]; + npc.ai[1] += 1f; + if (npc.ai[1] >= (float)num21) + { + if (num24 < (float)num21) + npc.netUpdate = true; + + if (flag2 && npc.ai[1] > (float)(num21 + 120)) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.velocity.Y *= 0.8f; + npc.netUpdate = true; + break; + } + + // Set damage + npc.damage = npc.defDamage; + + npc.velocity.Y += 1f; + float num25 = 14f; + if (Main.getGoodWorld) + { + npc.velocity.Y += 1f; + num25 = 15.99f; + } + + if (npc.velocity.Y == 0f) + npc.velocity.Y = 0.01f; + + if (npc.velocity.Y >= num25) + npc.velocity.Y = num25; + } + else + npc.velocity.Y *= 0.8f; + + break; + } + + if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[1] == 0f) + { + npc.TargetClosest(); + npc.netUpdate = true; + } + + npc.ai[1] += 1f; + if (!(npc.ai[1] >= 30f)) + break; + + if (npc.ai[1] >= 60f) + { + npc.ai[1] = 60f; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.ai[1] = 0f; + npc.ai[2] = 1f; + npc.velocity.Y = -3f; + npc.netUpdate = true; + } + } + + Player player3 = Main.player[npc.target]; + Vector2 center = npc.Center; + if (!player3.dead && player3.active && Math.Abs(npc.Center.X - player3.Center.X) / 16f <= (float)num4) + center = player3.Center; + + center.Y -= 384f; + if (npc.velocity.Y == 0f) + { + npc.velocity = center - npc.Center; + npc.velocity = npc.velocity.SafeNormalize(Vector2.Zero); + npc.velocity *= (Main.masterMode ? 28f : Main.expertMode ? 24f : 20f); + } + else + npc.velocity.Y *= 0.95f; + + break; + } + + case 5: + { + // Avoid cheap bullshit + npc.damage = 0; + + npc.rotation *= 0.9f; + npc.noTileCollide = true; + npc.noGravity = true; + if (flag2) + npc.ai[3] = 0f; + + if (npc.ai[2] == 1f) + { + npc.ai[1] += 1f; + if (!(npc.ai[1] >= 10f)) + break; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int num14 = 10; + if (Main.getGoodWorld) + num14 = 15; + + int num15 = num14; + if (!flag2) + num15 = 6; + + int type = ProjectileID.QueenSlimeGelAttack; + for (int j = 0; j < num15; j++) + { + Vector2 spinningpoint = new Vector2(Main.masterMode ? 10.5f : 9f, 0f); + spinningpoint = spinningpoint.RotatedBy((float)(-j) * MathHelper.TwoPi / (float)num14, Vector2.Zero); + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, spinningpoint, type, npc.GetProjectileDamage(type), 0f, Main.myPlayer); + } + } + + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.netUpdate = true; + break; + } + + if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[1] == 0f) + { + npc.TargetClosest(); + npc.netUpdate = true; + } + + npc.ai[1] += 1f; + if (npc.ai[1] >= 50f) + { + npc.ai[1] = 50f; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.ai[1] = 0f; + npc.ai[2] = 1f; + npc.netUpdate = true; + } + } + + float num16 = 100f; + for (int k = 0; k < 4; k++) + { + Vector2 vector2 = npc.Center + Main.rand.NextVector2CircularEdge(num16, num16); + if (!flag2) + vector2 += new Vector2(0f, 20f); + + Vector2 v = vector2 - npc.Center; + v = v.SafeNormalize(Vector2.Zero) * -8f; + int num17 = Dust.NewDust(vector2, 2, 2, DustID.Smoke, v.X, v.Y, 40, NPC.AI_121_QueenSlime_GetDustColor(), 1.8f); + Main.dust[num17].position = vector2; + Main.dust[num17].noGravity = true; + Main.dust[num17].alpha = 250; + Main.dust[num17].velocity = v; + Main.dust[num17].customData = npc; + } + + if (flag2) + QueenSlime_FlyMovement_Vanilla(npc); + + break; + } + } + + npc.dontTakeDamage = (npc.hide = flag); + if (num3 != npc.scale) + { + npc.position.X += npc.width / 2; + npc.position.Y += npc.height; + npc.scale = num3; + npc.width = (int)(114f * npc.scale); + npc.height = (int)(100f * npc.scale); + npc.position.X -= npc.width / 2; + npc.position.Y -= npc.height; + } + + if (npc.life <= 0) + return false; + + if (Main.netMode == NetmodeID.MultiplayerClient) + return false; + + if (npc.localAI[0] >= (float)(npc.lifeMax / 2) && npc.life < npc.lifeMax / 2) + { + npc.localAI[0] = npc.life; + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.netUpdate = true; + } + + int num29 = (int)((float)npc.lifeMax * 0.02f); + if (flag2) + num29 = (int)((float)npc.lifeMax * 0.015f); + + if (!((float)(npc.life + num29) < npc.localAI[0])) + return false; + + npc.localAI[0] = npc.life; + int num30 = Main.rand.Next(Main.masterMode ? 2 : 1, Main.masterMode ? 4 : 3); + for (int num31 = 0; num31 < num30; num31++) + { + int x = (int)(npc.position.X + (float)Main.rand.Next(npc.width - 32)); + int y = (int)(npc.position.Y + (float)Main.rand.Next(npc.height - 32)); + int num32 = NPCID.QueenSlimeMinionBlue; + switch (Main.rand.Next(3)) + { + case 0: + num32 = NPCID.QueenSlimeMinionBlue; + break; + case 1: + num32 = NPCID.QueenSlimeMinionPink; + break; + case 2: + num32 = NPCID.QueenSlimeMinionPurple; + break; + } + + int num33 = NPC.NewNPC(npc.GetSource_FromAI(), x, y, num32); + Main.npc[num33].SetDefaults(num32); + Main.npc[num33].velocity.X = (float)Main.rand.Next(-15, 16) * 0.1f; + Main.npc[num33].velocity.Y = (float)Main.rand.Next(-30, 1) * 0.1f; + Main.npc[num33].ai[0] = -500 * Main.rand.Next(3); + Main.npc[num33].ai[1] = 0f; + if (Main.netMode == NetmodeID.Server && num33 < Main.maxNPCs) + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num33); + } + + return false; + } + + public static void QueenSlime_FlyMovement(NPC npc) + { + // Difficulty bools + bool bossRush = BossRushEvent.BossRushActive; + bool masterMode = Main.masterMode; + bool death = CalamityWorld.death; + + npc.noTileCollide = true; + npc.noGravity = true; + + float flyVelocity = bossRush ? 24f : death ? (masterMode ? 21f : 18f) : (masterMode ? 19f : 16f); + float flyAcceleration = bossRush ? 0.3f : death ? (masterMode ? 0.18f : 0.14f) : (masterMode ? 0.16f : 0.12f); + float flyDistanceY = masterMode ? 350f : 450f; + + npc.TargetClosest(); + + Vector2 desiredVelocity = npc.Center; + + if (npc.timeLeft > 10) + { + if (!Collision.CanHit(npc, Main.player[npc.target])) + { + bool flyToSolidTilesAboveTarget = false; + Vector2 center = Main.player[npc.target].Center; + for (int i = 0; i < 16; i++) + { + float tileDistanceAboveTarget = 16 * i; + Point point = (center + new Vector2(0f, 0f - tileDistanceAboveTarget)).ToTileCoordinates(); + if (WorldGen.SolidOrSlopedTile(point.X, point.Y)) + { + desiredVelocity = center + new Vector2(0f, 0f - tileDistanceAboveTarget + 16f) - npc.Center; + flyToSolidTilesAboveTarget = true; + break; + } + } + + if (!flyToSolidTilesAboveTarget) + desiredVelocity = center - npc.Center; + } + else + desiredVelocity = Main.player[npc.target].Center + new Vector2(0f, -flyDistanceY) - npc.Center; + } + else + desiredVelocity = npc.Center + new Vector2(500f * npc.direction, -flyDistanceY) - npc.Center; + + float distanceFromFlightTarget = desiredVelocity.Length(); + if (Math.Abs(desiredVelocity.X) < 40f) + desiredVelocity.X = npc.velocity.X; + + if (distanceFromFlightTarget > 100f && ((npc.velocity.X < -12f && desiredVelocity.X > 0f) || (npc.velocity.X > 12f && desiredVelocity.X < 0f))) + flyAcceleration = 0.2f; + + if (distanceFromFlightTarget < 40f) + { + desiredVelocity = npc.velocity; + } + else if (distanceFromFlightTarget < 80f) + { + desiredVelocity = desiredVelocity.SafeNormalize(Vector2.UnitY); + desiredVelocity *= flyVelocity * 0.65f; + } + else + { + desiredVelocity = desiredVelocity.SafeNormalize(Vector2.UnitY); + desiredVelocity *= flyVelocity; + } + + npc.SimpleFlyMovement(desiredVelocity, flyAcceleration); + npc.rotation = npc.velocity.X * 0.1f; + if (npc.rotation > 0.5f) + npc.rotation = 0.5f; + + if (npc.rotation < -0.5f) + npc.rotation = -0.5f; + } + + public static void QueenSlime_FlyMovement_Vanilla(NPC npc) + { + npc.noTileCollide = true; + npc.noGravity = true; + float num = Main.masterMode ? 18f : Main.expertMode ? 15f : 12f; + float num2 = Main.masterMode ? 0.12f : Main.expertMode ? 0.1f : 0.085f; + float num3 = 250f; + npc.TargetClosest(); + Vector2 desiredVelocity = npc.Center; + if (npc.timeLeft > 10) + { + if (!Collision.CanHit(npc, Main.player[npc.target])) + { + bool flag = false; + Vector2 center = Main.player[npc.target].Center; + for (int i = 0; i < 16; i++) + { + float num4 = 16 * i; + Point point = (center + new Vector2(0f, 0f - num4)).ToTileCoordinates(); + if (WorldGen.SolidOrSlopedTile(point.X, point.Y)) + { + desiredVelocity = center + new Vector2(0f, 0f - num4 + 16f) - npc.Center; + flag = true; + break; + } + } + + if (!flag) + desiredVelocity = center - npc.Center; + } + else + desiredVelocity = Main.player[npc.target].Center + new Vector2(0f, 0f - num3) - npc.Center; + } + else + desiredVelocity = npc.Center + new Vector2(500f * (float)npc.direction, 0f - num3) - npc.Center; + + float num5 = desiredVelocity.Length(); + if (Math.Abs(desiredVelocity.X) < 40f) + desiredVelocity.X = npc.velocity.X; + + float num6 = num - 2f; + if (num5 > 100f && ((npc.velocity.X < 0f - num6 && desiredVelocity.X > 0f) || (npc.velocity.X > num6 && desiredVelocity.X < 0f))) + num2 *= 2f; + + if (num5 < 40f) + { + desiredVelocity = npc.velocity; + } + else if (num5 < 80f) + { + desiredVelocity = desiredVelocity.SafeNormalize(Vector2.UnitY); + desiredVelocity *= num * 0.65f; + } + else + { + desiredVelocity = desiredVelocity.SafeNormalize(Vector2.UnitY); + desiredVelocity *= num; + } + + npc.SimpleFlyMovement(desiredVelocity, num2); + npc.rotation = npc.velocity.X * 0.1f; + if (npc.rotation > 0.5f) + npc.rotation = 0.5f; + + if (npc.rotation < -0.5f) + npc.rotation = -0.5f; + } + + public static bool QueenSlimeCrystalSlimeAI(NPC npc, Mod mod) + { + if (npc.localAI[0] > 0f) + npc.localAI[0] -= 1f; + + if (!npc.wet && Main.player[npc.target].active && !Main.player[npc.target].dead && !Main.player[npc.target].npcTypeNoAggro[npc.type]) + { + Player obj = Main.player[npc.target]; + Vector2 center = npc.Center; + float num19 = obj.Center.X - center.X; + float num20 = obj.Center.Y - center.Y; + float num21 = (float)Math.Sqrt(num19 * num19 + num20 * num20); + int num22 = NPC.CountNPCS(NPCID.QueenSlimeMinionBlue); + if (Main.expertMode && num22 < 5 && Math.Abs(num19) < 500f && Math.Abs(num20) < 550f && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && npc.velocity.Y == 0f) + { + npc.ai[0] = -40f; + if (npc.velocity.Y == 0f) + npc.velocity.X *= 0.9f; + + if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] == 0f) + { + for (int k = 0; k < 3; k++) + { + Vector2 vector6 = new Vector2(k - 1, -4f); + vector6.X *= 1f + (float)Main.rand.Next(-50, 51) * 0.005f; + vector6.Y *= 1f + (float)Main.rand.Next(-50, 51) * 0.005f; + vector6.Normalize(); + vector6 *= 6f + (float)Main.rand.Next(-50, 51) * 0.01f; + if (num21 > 350f) + vector6 *= 2f; + else if (num21 > 250f) + vector6 *= 1.5f; + + int type = ProjectileID.QueenSlimeMinionBlueSpike; + Projectile.NewProjectile(npc.GetSource_FromAI(), center, vector6 * ((Main.masterMode || BossRushEvent.BossRushActive) ? 0.8f : 0.5f), type, npc.GetProjectileDamage(type), 0f, Main.myPlayer); + npc.localAI[0] = 25f; + if (num22 > 4) + break; + } + } + } + else if (Math.Abs(num19) < 500f && Math.Abs(num20) < 550f && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && npc.velocity.Y == 0f) + { + float num23 = num21; + npc.ai[0] = -40f; + if (npc.velocity.Y == 0f) + npc.velocity.X *= 0.9f; + + if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] == 0f) + { + num20 = Main.player[npc.target].position.Y - center.Y - (float)Main.rand.Next(0, 200); + num21 = (float)Math.Sqrt(num19 * num19 + num20 * num20); + num21 = 4.5f / num21; + num21 *= 2f; + if (num23 > 350f) + num21 *= 2f; + else if (num23 > 250f) + num21 *= 1.5f; + + num19 *= num21; + num20 *= num21; + npc.localAI[0] = 50f; + int type = ProjectileID.QueenSlimeMinionBlueSpike; + Vector2 spikeVelocity = new Vector2(num19, num20) * ((Main.masterMode || BossRushEvent.BossRushActive) ? 0.8f : 0.5f); + Projectile.NewProjectile(npc.GetSource_FromAI(), center, spikeVelocity, type, npc.GetProjectileDamage(type), 0f, Main.myPlayer); + } + } + } + + if (npc.ai[2] > 1f) + npc.ai[2] -= 1f; + + if (npc.wet) + { + if (npc.collideY) + npc.velocity.Y = -2f; + + if (npc.velocity.Y < 0f && npc.ai[3] == npc.position.X) + { + npc.direction *= -1; + npc.ai[2] = 200f; + } + + if (npc.velocity.Y > 0f) + npc.ai[3] = npc.position.X; + + if (npc.velocity.Y > 2f) + npc.velocity.Y *= 0.9f; + + npc.velocity.Y -= 0.5f; + if (npc.velocity.Y < -4f) + npc.velocity.Y = -4f; + + if (npc.ai[2] == 1f) + npc.TargetClosest(); + } + + npc.aiAction = 0; + if (npc.ai[2] == 0f) + { + npc.ai[0] = -100f; + npc.ai[2] = 1f; + npc.TargetClosest(); + } + + if (npc.velocity.Y == 0f) + { + if (npc.collideY && npc.oldVelocity.Y != 0f && Collision.SolidCollision(npc.position, npc.width, npc.height)) + npc.position.X -= npc.velocity.X + (float)npc.direction; + + if (npc.ai[3] == npc.position.X) + { + npc.direction *= -1; + npc.ai[2] = 200f; + } + + npc.ai[3] = 0f; + npc.velocity.X *= 0.8f; + if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) + npc.velocity.X = 0f; + + npc.ai[0] += (Main.masterMode ? 16f : Main.expertMode ? 10f : 7f); + + float num33 = -1000f; + + int num34 = 0; + if (npc.ai[0] >= 0f) + num34 = 1; + + if (npc.ai[0] >= num33 && npc.ai[0] <= num33 * 0.5f) + num34 = 2; + + if (npc.ai[0] >= num33 * 2f && npc.ai[0] <= num33 * 1.5f) + num34 = 3; + + if (num34 > 0) + { + npc.netUpdate = true; + if (npc.ai[2] == 1f) + npc.TargetClosest(); + + if (num34 == 3) + { + npc.velocity.Y = -8f; + npc.velocity.X += (Main.masterMode ? 9 : Main.expertMode ? 6 : 3) * npc.direction; + npc.ai[0] = -200f; + npc.ai[3] = npc.position.X; + } + else + { + npc.velocity.Y = -6f; + npc.velocity.X += (Main.masterMode ? 6 : Main.expertMode ? 4 : 2) * npc.direction; + npc.ai[0] = -120f; + if (num34 == 1) + npc.ai[0] += num33; + else + npc.ai[0] += num33 * 2f; + } + } + else if (npc.ai[0] >= -30f) + npc.aiAction = 1; + } + else if (npc.target < Main.maxPlayers && ((npc.direction == 1 && npc.velocity.X < 3f) || (npc.direction == -1 && npc.velocity.X > -3f))) + { + if (npc.collideX && Math.Abs(npc.velocity.X) == 0.2f) + npc.position.X -= 1.4f * (float)npc.direction; + + if (npc.collideY && npc.oldVelocity.Y != 0f && Collision.SolidCollision(npc.position, npc.width, npc.height)) + npc.position.X -= npc.velocity.X + (float)npc.direction; + + if ((npc.direction == -1 && (double)npc.velocity.X < 0.01) || (npc.direction == 1 && (double)npc.velocity.X > -0.01)) + npc.velocity.X += 0.2f * (float)npc.direction; + else + npc.velocity.X *= 0.93f; + } + + return false; + } + + public static bool QueenSlimeBouncySlimeAI(NPC npc, Mod mod) + { + if (npc.localAI[0] > 0f) + npc.localAI[0] -= 1f; + + if (!npc.wet && Main.player[npc.target].active && !Main.player[npc.target].dead && !Main.player[npc.target].npcTypeNoAggro[npc.type]) + { + Player obj2 = Main.player[npc.target]; + Vector2 center2 = npc.Center; + float num24 = obj2.Center.X - center2.X; + float num25 = obj2.Center.Y - center2.Y; + float num26 = (float)Math.Sqrt(num24 * num24 + num25 * num25); + float num27 = num26; + if (Math.Abs(num24) < 500f && Math.Abs(num25) < 550f && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && npc.velocity.Y == 0f) + { + npc.ai[0] = -40f; + if (npc.velocity.Y == 0f) + npc.velocity.X *= 0.9f; + + if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] == 0f) + { + num25 = Main.player[npc.target].position.Y - center2.Y - (float)Main.rand.Next(0, 200); + num26 = (float)Math.Sqrt(num24 * num24 + num25 * num25); + num26 = 4.5f / num26; + num26 *= 2f; + if (num27 > 350f) + num26 *= 1.75f; + else if (num27 > 250f) + num26 *= 1.25f; + + num24 *= num26; + num25 *= num26; + npc.localAI[0] = 40f; + if (Main.expertMode) + npc.localAI[0] = 30f; + + int type = ProjectileID.QueenSlimeMinionPinkBall; + Vector2 pinkBallVelocity = new Vector2(num24, num25) * ((Main.masterMode || BossRushEvent.BossRushActive) ? 0.8f : 0.5f); + Projectile.NewProjectile(npc.GetSource_FromAI(), center2, pinkBallVelocity, type, npc.GetProjectileDamage(type), 0f, Main.myPlayer); + } + } + } + + if (npc.ai[2] > 1f) + npc.ai[2] -= 1f; + + if (npc.wet) + { + if (npc.collideY) + npc.velocity.Y = -2f; + + if (npc.velocity.Y < 0f && npc.ai[3] == npc.position.X) + { + npc.direction *= -1; + npc.ai[2] = 200f; + } + + if (npc.velocity.Y > 0f) + npc.ai[3] = npc.position.X; + + if (npc.velocity.Y > 2f) + npc.velocity.Y *= 0.9f; + + npc.velocity.Y -= 0.5f; + if (npc.velocity.Y < -4f) + npc.velocity.Y = -4f; + + if (npc.ai[2] == 1f) + npc.TargetClosest(); + } + + npc.aiAction = 0; + if (npc.ai[2] == 0f) + { + npc.ai[0] = -100f; + npc.ai[2] = 1f; + npc.TargetClosest(); + } + + if (npc.velocity.Y == 0f) + { + if (npc.collideY && npc.oldVelocity.Y != 0f && Collision.SolidCollision(npc.position, npc.width, npc.height)) + npc.position.X -= npc.velocity.X + (float)npc.direction; + + if (npc.ai[3] == npc.position.X) + { + npc.direction *= -1; + npc.ai[2] = 200f; + } + + npc.ai[3] = 0f; + npc.velocity.X *= 0.8f; + if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) + npc.velocity.X = 0f; + + npc.ai[0] += (Main.masterMode ? 11f : Main.expertMode ? 7f : 5f); + + float num33 = -500f; + + int num34 = 0; + if (npc.ai[0] >= 0f) + num34 = 1; + + if (npc.ai[0] >= num33 && npc.ai[0] <= num33 * 0.5f) + num34 = 2; + + if (npc.ai[0] >= num33 * 2f && npc.ai[0] <= num33 * 1.5f) + num34 = 3; + + if (num34 > 0) + { + npc.netUpdate = true; + if (npc.ai[2] == 1f) + npc.TargetClosest(); + + if (num34 == 3) + { + npc.velocity.Y = -8f; + npc.velocity.X += (Main.masterMode ? 9 : Main.expertMode ? 6 : 3) * npc.direction; + npc.ai[0] = -200f; + npc.ai[3] = npc.position.X; + } + else + { + npc.velocity.Y = -6f; + npc.velocity.X += (Main.masterMode ? 6 : Main.expertMode ? 4 : 2) * npc.direction; + npc.ai[0] = -120f; + if (num34 == 1) + npc.ai[0] += num33; + else + npc.ai[0] += num33 * 2f; + } + + npc.velocity.Y *= 1.6f; + npc.velocity.X *= 1.2f; + } + else if (npc.ai[0] >= -30f) + npc.aiAction = 1; + } + else if (npc.target < Main.maxPlayers && ((npc.direction == 1 && npc.velocity.X < 3f) || (npc.direction == -1 && npc.velocity.X > -3f))) + { + if (npc.collideX && Math.Abs(npc.velocity.X) == 0.2f) + npc.position.X -= 1.4f * (float)npc.direction; + + if (npc.collideY && npc.oldVelocity.Y != 0f && Collision.SolidCollision(npc.position, npc.width, npc.height)) + npc.position.X -= npc.velocity.X + (float)npc.direction; + + if ((npc.direction == -1 && (double)npc.velocity.X < 0.01) || (npc.direction == 1 && (double)npc.velocity.X > -0.01)) + npc.velocity.X += 0.2f * (float)npc.direction; + else + npc.velocity.X *= 0.93f; + } + + return false; + } + } +} diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronAI.cs new file mode 100644 index 0000000000..5a9e132aa1 --- /dev/null +++ b/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronAI.cs @@ -0,0 +1,1827 @@ +using System; +using CalamityMod.Events; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses +{ + public static class SkeletronAI + { + public const float ChargeGateValue = 600f; + public const float ChargeTelegraphTime = 120f; + public const float HandSlapGateValue = 300f; + public const float HandSlapTelegraphTime = 120f; + public const float HandSwipeDistance = 960f; // 60 tiles + public const float HandSwipeDistance_Master = 1280f; // 80 tiles + + public static bool BuffedSkeletronAI(NPC npc, Mod mod) + { + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + + bool bossRush = BossRushEvent.BossRushActive; + bool masterMode = Main.masterMode || bossRush; + bool death = CalamityWorld.death || bossRush; + + // Percent life remaining + float lifeRatio = npc.life / (float)npc.lifeMax; + + // Phases + float phase2LifeRatio = masterMode ? 1f : 0.85f; + float phase3LifeRatio = masterMode ? 0.9f : 0.7f; + float respawnHandsLifeRatio = 0.5f; + float phase4LifeRatio = masterMode ? 0.4f : 0.3f; + float phase5LifeRatio = masterMode ? 0.2f : 0.1f; + + // Begin firing spreads of skulls phase + bool phase2 = lifeRatio < phase2LifeRatio; + + // Begin using a more dangerous charge attack phase + bool phase3 = lifeRatio < phase3LifeRatio; + + // Spawn a new set of hands, fire skulls at the end of each charge and fire skulls from hands at the end of each slap phase + bool respawnHands = lifeRatio < respawnHandsLifeRatio; + + // Fire giant cursed skull projectiles (yes, these curse you if you get hit) during charge attack and hands fire skulls phase + bool phase4 = lifeRatio < phase4LifeRatio; + + // Rapid teleport and charge, stop using idle phase + bool phase5 = lifeRatio < phase5LifeRatio; + + // Set defense + npc.defense = npc.defDefense; + + npc.reflectsProjectiles = false; + + // Get a target + 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(); + + // Spawn hands + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (npc.ai[0] == 0f) + { + npc.ai[0] = 1f; + SpawnHands(); + npc.netUpdate = true; + } + + // Respawn hands + if (respawnHands && calamityGlobalNPC.newAI[0] == 0f && Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 160f) + { + calamityGlobalNPC.newAI[0] = 1f; + SoundEngine.PlaySound(SoundID.ForceRoar with { Pitch = SoundID.ForceRoar.Pitch - 0.25f }, npc.Center); + SpawnHands(); + + npc.netUpdate = true; + npc.SyncExtraAI(); + } + + void SpawnHands() + { + int skeletronHand = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.SkeletronHand, npc.whoAmI); + Main.npc[skeletronHand].ai[0] = masterMode ? -1.3f : -1f; + Main.npc[skeletronHand].ai[1] = npc.whoAmI; + Main.npc[skeletronHand].target = npc.target; + Main.npc[skeletronHand].netUpdate = true; + + skeletronHand = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.SkeletronHand, npc.whoAmI); + Main.npc[skeletronHand].ai[0] = masterMode ? 1.3f : 1f; + Main.npc[skeletronHand].ai[1] = npc.whoAmI; + Main.npc[skeletronHand].ai[3] = 150f; + Main.npc[skeletronHand].Calamity().newAI[2] = 150f; + Main.npc[skeletronHand].target = npc.target; + Main.npc[skeletronHand].netUpdate = true; + + // Spawn two additional hands with different attack timings + if (death) + { + skeletronHand = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.SkeletronHand, npc.whoAmI); + Main.npc[skeletronHand].ai[0] = masterMode ? -1.3f : -1f; + Main.npc[skeletronHand].Calamity().newAI[0] = -1f; + Main.npc[skeletronHand].ai[1] = npc.whoAmI; + Main.npc[skeletronHand].ai[3] = respawnHands ? -75f : 0f; + Main.npc[skeletronHand].Calamity().newAI[2] = respawnHands ? -75f : 0f; + Main.npc[skeletronHand].target = npc.target; + Main.npc[skeletronHand].netUpdate = true; + + skeletronHand = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.SkeletronHand, npc.whoAmI); + Main.npc[skeletronHand].ai[0] = masterMode ? 1.3f : 1f; + Main.npc[skeletronHand].Calamity().newAI[0] = -1f; + Main.npc[skeletronHand].ai[1] = npc.whoAmI; + Main.npc[skeletronHand].ai[3] = respawnHands ? 75f : 150f; + Main.npc[skeletronHand].Calamity().newAI[2] = respawnHands ? 75f : 150f; + Main.npc[skeletronHand].target = npc.target; + Main.npc[skeletronHand].netUpdate = true; + } + } + } + + // Distance from target + float distance = Vector2.Distance(Main.player[npc.target].Center, npc.Center); + + // Despawn + int despawnDistanceInTiles = 500; + if (Main.player[npc.target].dead || Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) / 16f > despawnDistanceInTiles) + { + npc.TargetClosest(); + if (Main.player[npc.target].dead || Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) / 16f > despawnDistanceInTiles) + npc.ai[1] = 3f; + } + + // Daytime enrage + if (Main.IsItDay() && !bossRush && npc.ai[1] != 3f && npc.ai[1] != 2f) + { + npc.ai[1] = 2f; + SoundEngine.PlaySound(SoundID.ForceRoar, npc.Center); + } + + // Hand count + int numHandsAlive = 0; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active && Main.npc[i].type == NPCID.SkeletronHand) + numHandsAlive++; + } + + // Hand variables + bool handsDead = numHandsAlive == 0; + int numProj = Main.getGoodWorld ? 22 : death ? 5 : 3; + float spread = MathHelper.ToRadians(Main.getGoodWorld ? 180 : 60); + float headSpinVelocityMult = bossRush ? (phase3 ? 18f : 9f) : (phase3 ? 13.5f : 4.5f); + + switch (numHandsAlive) + { + case 0: + numProj = Main.getGoodWorld ? 36 : death ? 9 : 7; + spread = MathHelper.ToRadians(Main.getGoodWorld ? 180 : death ? 90 : 82); + headSpinVelocityMult = bossRush ? (phase3 ? 18f : 12f) : (phase3 ? 13.5f : 6f); + break; + + case 1: + numProj = Main.getGoodWorld ? 27 : death ? 7 : 5; + spread = MathHelper.ToRadians(Main.getGoodWorld ? 150 : death ? 76 : 68); + headSpinVelocityMult = bossRush ? (phase3 ? 15f : 10f) : (phase3 ? 12.75f : 5f); + break; + + case 2: + numProj = Main.getGoodWorld ? 18 : death ? 6 : 4; + spread = MathHelper.ToRadians(Main.getGoodWorld ? 140 : death ? 70 : 62); + headSpinVelocityMult = bossRush ? (phase3 ? 13.5f : 9f) : (phase3 ? 12f : 4.5f); + break; + + case 3: + numProj = Main.getGoodWorld ? 15 : death ? 5 : 3; + spread = MathHelper.ToRadians(Main.getGoodWorld ? 130 : death ? 64 : 56); + headSpinVelocityMult = bossRush ? (phase3 ? 12f : 8f) : (phase3 ? 11.25f : 4f); + break; + + case 4: + numProj = Main.getGoodWorld ? 12 : death ? 4 : 3; + spread = MathHelper.ToRadians(Main.getGoodWorld ? 120 : 56); + headSpinVelocityMult = bossRush ? (phase3 ? 10.5f : 7f) : (phase3 ? 10.5f : 3.5f); + break; + } + + // Reduce the amount of skulls per spread in later phases due to near-constant teleporting + if (!masterMode && numProj > 3) + { + if (phase4) + numProj--; + if (phase5 && numProj > 3) + numProj--; + } + + if (death) + headSpinVelocityMult *= 1.2f; + + // Hand DR, scale DR up if the hands are still alive as Skeletron's HP lowers + npc.chaseable = handsDead; + float minDR = 0.05f; + float maxDR = 0.9999f; + calamityGlobalNPC.DR = !handsDead ? (float)Math.Sqrt(MathHelper.Lerp(minDR, maxDR, respawnHands ? (respawnHandsLifeRatio - lifeRatio) / respawnHandsLifeRatio : 2f - lifeRatio / respawnHandsLifeRatio)) : minDR; + calamityGlobalNPC.unbreakableDR = !handsDead; + calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = !handsDead; + + // Value to start teleport dust + int teleportGateValue = phase5 ? 180 : 300; + + // Bool to disable skull firing after charging if teleport was recent or is about to happen + bool disableSkullsAfterCharge = npc.ai[3] <= 60f || npc.ai[3] > teleportGateValue + 60f; + + // Teleport while not despawning + if (npc.ai[1] != 3f) + { + int dustType = DustID.GemDiamond; + + // Post-teleport + if (npc.ai[3] == -60f) + { + npc.ai[3] = 0f; + + SoundEngine.PlaySound(SoundID.Item66, npc.Center); + + // Fire skulls after teleport + if (Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + float skullSpeed = death ? 6f : 5f; + int type = ProjectileID.Skull; + int damage = npc.GetProjectileDamage(type); + + float boltTargetXDist = Main.player[npc.target].Center.X - npc.Center.X; + float boltTargetYDist = Main.player[npc.target].Center.Y - npc.Center.Y; + float boltTargetDistance = (float)Math.Sqrt(boltTargetXDist * boltTargetXDist + boltTargetYDist * boltTargetYDist); + + boltTargetDistance = skullSpeed / boltTargetDistance; + boltTargetXDist *= boltTargetDistance; + boltTargetYDist *= boltTargetDistance; + Vector2 center = npc.Center; + center.X += boltTargetXDist * 5f; + center.Y += boltTargetYDist * 5f; + + float baseSpeed = (float)Math.Sqrt(boltTargetXDist * boltTargetXDist + boltTargetYDist * boltTargetYDist); + double startAngle = Math.Atan2(boltTargetXDist, boltTargetYDist) - spread / 2; + double deltaAngle = spread / numProj; + double offsetAngle; + + // Inverse parabolic projectile spreads + bool evenNumberOfProjectiles = numProj % 2 == 0; + int centralProjectile = evenNumberOfProjectiles ? numProj / 2 : (numProj - 1) / 2; + int otherCentralProjectile = evenNumberOfProjectiles ? centralProjectile - 1 : -1; + float centralScalingAmount = (float)Math.Floor(numProj / (double)centralProjectile) * 0.75f; + float amountToAdd = evenNumberOfProjectiles ? 0.5f : 0f; + float originalBaseSpeed = baseSpeed; + float minVelocityMultiplier = 0.5f; + for (int i = 0; i < numProj; i++) + { + float velocityScalar = (evenNumberOfProjectiles && (i == centralProjectile || i == otherCentralProjectile)) ? minVelocityMultiplier : MathHelper.Lerp(minVelocityMultiplier, centralScalingAmount, Math.Abs((i + amountToAdd) - centralProjectile) / (float)centralProjectile); + baseSpeed = originalBaseSpeed; + baseSpeed *= velocityScalar; + offsetAngle = startAngle + deltaAngle * i; + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), center.X, center.Y, baseSpeed * (float)Math.Sin(offsetAngle), baseSpeed * (float)Math.Cos(offsetAngle), type, damage, 0f, Main.myPlayer, -2f); + Main.projectile[proj].timeLeft = 600; + } + + npc.netUpdate = true; + } + } + + // Teleport dust + for (int m = 0; m < 30; m++) + { + int teleportDust = Dust.NewDust(npc.position, npc.width, npc.height, dustType, 0f, 0f, 100, default, 3f); + Main.dust[teleportDust].noGravity = true; + Main.dust[teleportDust].velocity.X *= 2f; + } + } + + // Teleport after a certain time + // If hands are dead: 7 seconds + // If hands are not dead: 14 seconds + // If hands are dead in phase 2: 4.7 seconds + npc.ai[3] += 1f + (((phase2 && handsDead) || bossRush || phase4) ? 0.5f : 0f) - ((handsDead || bossRush) ? 0f : 0.5f); + + // Dust to show teleport + int ai3 = (int)npc.ai[3]; // 0 to 30, and -60 + bool emitDust = false; + + if (ai3 >= teleportGateValue && calamityGlobalNPC.newAI[2] == 0f && calamityGlobalNPC.newAI[3] == 0f) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Vector2 skullFaceDirection = npc.Center + new Vector2(npc.direction * 20, 6f); + Vector2 skullTargetDirection = Main.player[npc.target].Center - skullFaceDirection; + Point skullTileCoords = npc.Center.ToTileCoordinates(); + Point targetTileCoords = Main.player[npc.target].Center.ToTileCoordinates(); + int randomTeleportOffset = 20 - (int)Math.Ceiling(MathHelper.Lerp(0f, 10f, 1f - lifeRatio)); + int skullPositionOffset = 4; + int targetPositionOffset = randomTeleportOffset - 4; + int teleportTries = 0; + + bool targetTooFar = false; + if (skullTargetDirection.Length() > 2000f) + targetTooFar = true; + + while (!targetTooFar && teleportTries < 100) + { + teleportTries++; + int teleportTileX = Main.rand.Next(targetTileCoords.X - randomTeleportOffset, targetTileCoords.X + randomTeleportOffset + 1); + int teleportTileY = Main.rand.Next(targetTileCoords.Y - randomTeleportOffset, targetTileCoords.Y + randomTeleportOffset + 1); + if ((teleportTileY < targetTileCoords.Y - targetPositionOffset || teleportTileY > targetTileCoords.Y + targetPositionOffset || teleportTileX < targetTileCoords.X - targetPositionOffset || teleportTileX > targetTileCoords.X + targetPositionOffset) && (teleportTileY < skullTileCoords.Y - skullPositionOffset || teleportTileY > skullTileCoords.Y + skullPositionOffset || teleportTileX < skullTileCoords.X - skullPositionOffset || teleportTileX > skullTileCoords.X + skullPositionOffset) && !Main.tile[teleportTileX, teleportTileY].HasUnactuatedTile) + { + // New location params + calamityGlobalNPC.newAI[2] = teleportTileX * 16 - npc.width / 2; + calamityGlobalNPC.newAI[3] = teleportTileY * 16 - npc.height; + npc.SyncExtraAI(); + break; + } + } + } + } + + if (calamityGlobalNPC.newAI[2] != 0f && calamityGlobalNPC.newAI[3] != 0f) + { + for (int m = 0; m < 5; m++) + { + Vector2 position = new Vector2(calamityGlobalNPC.newAI[2], calamityGlobalNPC.newAI[3]); + int teleportDust = Dust.NewDust(position, npc.width, npc.height, dustType, 0f, 0f, 100, default, 2f); + Main.dust[teleportDust].noGravity = true; + } + } + + if (ai3 >= teleportGateValue + 90) + { + emitDust = true; + } + else if (ai3 >= teleportGateValue + 30) + { + if (Main.rand.Next(teleportGateValue + 10, ai3 + 1) >= teleportGateValue + 25) + emitDust = true; + } + + if (emitDust) + { + int dust = Dust.NewDust(npc.position, npc.width, npc.height, dustType, 0f, 0f, 100, default, 1.5f); + Main.dust[dust].noGravity = true; + } + + // Teleport + if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[3] >= teleportGateValue + 120) + { + // Teleport dust + for (int m = 0; m < 30; m++) + { + int teleportDust = Dust.NewDust(npc.position, npc.width, npc.height, dustType, 0f, 0f, 100, default, 3f); + Main.dust[teleportDust].noGravity = true; + Main.dust[teleportDust].velocity.X *= 2f; + } + + // New location + npc.Center = new Vector2(calamityGlobalNPC.newAI[2], calamityGlobalNPC.newAI[3]); + npc.velocity = Vector2.Zero; + npc.ai[3] = -60f; + calamityGlobalNPC.newAI[2] = calamityGlobalNPC.newAI[3] = 0f; + npc.SyncExtraAI(); + npc.netUpdate = true; + } + } + + // Skull shooting + if ((handsDead || masterMode) && npc.ai[1] == 0f && !phase4) + { + float skullProjFrequency = bossRush ? 10f : phase2 ? (48f - (death ? 17.5f * (1f - lifeRatio) : 0f)) : 60f; + if (Main.getGoodWorld) + skullProjFrequency *= 0.8f; + skullProjFrequency = (float)Math.Ceiling(skullProjFrequency); + + if (Main.netMode != NetmodeID.MultiplayerClient && calamityGlobalNPC.newAI[1] % skullProjFrequency == 0f && calamityGlobalNPC.newAI[1] > 45f) + { + Vector2 skullFiringPos = npc.Center; + float skullProjTargetX = Main.player[npc.target].Center.X - skullFiringPos.X; + float skullProjTargetY = Main.player[npc.target].Center.Y - skullFiringPos.Y; + if (Collision.CanHit(skullFiringPos, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + float skullProjSpeed = phase2 ? (5f + (death ? 3f * (1f - lifeRatio) : 0f)) : 4f; + int spread2 = bossRush ? 100 : 50; + Vector2 skullProjDirection = new Vector2(skullProjTargetX + Main.rand.Next(-spread2, spread2 + 1) * 0.01f, skullProjTargetY + Main.rand.Next(-spread2, spread2 + 1) * 0.01f).SafeNormalize(Vector2.UnitY); + skullProjDirection *= skullProjSpeed; + skullProjDirection += npc.velocity; + skullFiringPos += skullProjDirection * 5f; + + int type = ProjectileID.Skull; + int damage = npc.GetProjectileDamage(type); + + int skullProjectile = Projectile.NewProjectile(npc.GetSource_FromAI(), skullFiringPos, skullProjDirection, type, damage, 0f, Main.myPlayer, -1f); + Main.projectile[skullProjectile].timeLeft = 600; + if (masterMode) + { + skullProjDirection = new Vector2(skullProjTargetX, skullProjTargetY).SafeNormalize(Vector2.UnitY); + skullProjDirection *= skullProjSpeed * 2f; + int skullProjectile2 = Projectile.NewProjectile(npc.GetSource_FromAI(), skullFiringPos, skullProjDirection, type, damage, 0f, Main.myPlayer, -2f); + Main.projectile[skullProjectile2].timeLeft = 600; + } + + npc.netUpdate = true; + } + } + } + + // Float above target + if (npc.ai[1] == 0f) + { + // Avoid cheap bullshit + npc.damage = 0; + + calamityGlobalNPC.newAI[1] += 1f; + float chargePhaseChangeRateBoost = phase5 ? (death ? 24f : 14f) : phase4 ? (death ? 8f : 6f) : (((masterMode && death) ? 6f : 4f) * ((1f - lifeRatio) / (1f - phase4LifeRatio))); + float chargePhaseChangeRate = chargePhaseChangeRateBoost + 1f; + npc.ai[2] += chargePhaseChangeRate; + npc.localAI[1] += chargePhaseChangeRate; + float chargePhaseGateValue = ChargeGateValue; + if (npc.localAI[1] > chargePhaseGateValue) + npc.localAI[1] = chargePhaseGateValue; + + float forcedMoveAwayTime = death ? 30f : 45f; + if (masterMode) + forcedMoveAwayTime *= 0.5f; + + float canChargeDistance = phase3 ? 640f : 320f; // 20 tile distance, 40 tile distance in phase 3 + bool hasMovedForcedDistance = npc.localAI[2] >= forcedMoveAwayTime; + bool canCharge = Vector2.Distance(Main.player[npc.target].Center, npc.Center) >= canChargeDistance; + bool charge = npc.ai[2] >= chargePhaseGateValue && canCharge; + bool forceCharge = npc.ai[2] > chargePhaseGateValue + 120f * chargePhaseChangeRate; + if (charge || forceCharge) + { + npc.localAI[2] += 1f; + if (hasMovedForcedDistance || !phase3) + { + npc.ai[2] = 0f; + npc.ai[1] = 1f; + npc.localAI[1] = chargePhaseGateValue; + npc.localAI[2] = 0f; + calamityGlobalNPC.newAI[1] = 0f; + + npc.TargetClosest(); + npc.SyncExtraAI(); + npc.SyncVanillaLocalAI(); + npc.netUpdate = true; + } + } + + float headYAcceleration = (Main.getGoodWorld ? 0.07f : masterMode ? 0.06f : 0.04f) + (death ? 0.04f * (1f - lifeRatio) : 0f); + float headYTopSpeed = headYAcceleration * 100f; + float headXAcceleration = (Main.getGoodWorld ? 0.21f : masterMode ? 0.16f : 0.08f) + (death ? 0.08f * (1f - lifeRatio) : 0f); + float headXTopSpeed = headXAcceleration * 100f; + float deceleration = Main.getGoodWorld ? 0.83f : masterMode ? 0.86f : 0.89f; + + if (bossRush) + { + headYAcceleration *= 1.25f; + headXAcceleration *= 1.25f; + } + + float moveAwayGateValue = chargePhaseGateValue - (5f + chargePhaseChangeRate); + bool moveAwayBeforeCharge = npc.ai[2] >= moveAwayGateValue; + if (moveAwayBeforeCharge) + { + if (!canCharge || !hasMovedForcedDistance) + { + float maxAcceleration = headXAcceleration + headYAcceleration + (npc.ai[2] - moveAwayGateValue) * (phase5 ? 0.006f : 0.004f); + float maxAccelerationCap = (headXAcceleration + headYAcceleration) * 5f; + if (maxAcceleration > maxAccelerationCap) + maxAcceleration = maxAccelerationCap; + + npc.velocity += (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * -maxAcceleration; + + float maxVelocity = headSpinVelocityMult + (npc.ai[2] - moveAwayGateValue) * (phase5 ? 0.12f : 0.08f); + float maxVelocityCap = headSpinVelocityMult * 2.5f; + if (maxVelocity > maxVelocityCap) + maxVelocity = maxVelocityCap; + + if (npc.velocity.Length() > maxVelocity) + { + npc.velocity = npc.velocity.SafeNormalize(Vector2.UnitY); + npc.velocity *= maxVelocity; + } + } + + // New charge attack + if (phase3) + { + npc.rotation += npc.direction * 0.3f; + + if (npc.localAI[0] == 0f) + { + npc.localAI[0] = 1f; + npc.SyncVanillaLocalAI(); + + SoundEngine.PlaySound(SoundID.ForceRoar, npc.Center); + } + } + else + npc.rotation = npc.velocity.X / 15f; + + return false; + } + + npc.rotation = npc.velocity.X / 15f; + + if (npc.Top.Y > Main.player[npc.target].Top.Y - 250f) + { + if (npc.velocity.Y > 0f) + npc.velocity.Y *= 0.98f; + npc.velocity.Y -= headYAcceleration; + if (npc.velocity.Y > headYTopSpeed) + npc.velocity.Y = headYTopSpeed; + } + else if (npc.Top.Y < Main.player[npc.target].Top.Y - 250f) + { + if (npc.velocity.Y < 0f) + npc.velocity.Y *= 0.98f; + npc.velocity.Y += headYAcceleration; + if (npc.velocity.Y < -headYTopSpeed) + npc.velocity.Y = -headYTopSpeed; + } + + if (npc.Center.X > Main.player[npc.target].Center.X) + { + if (npc.velocity.X > 0f) + npc.velocity.X *= 0.98f; + npc.velocity.X -= headXAcceleration; + if (npc.velocity.X > headXTopSpeed) + npc.velocity.X = headXTopSpeed; + } + + if (npc.Center.X < Main.player[npc.target].Center.X) + { + if (npc.velocity.X < 0f) + npc.velocity.X *= 0.98f; + npc.velocity.X += headXAcceleration; + if (npc.velocity.X < -headXTopSpeed) + npc.velocity.X = -headXTopSpeed; + } + } + + // Spin charge + else if (npc.ai[1] == 1f) + { + // Set damage + npc.damage = npc.defDamage; + + if (Main.getGoodWorld) + { + npc.reflectsProjectiles = true; + if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == 0f) + { + if (NPC.CountNPCS(NPCID.DarkCaster) < 6) + { + for (int i = 0; i < 1000; i++) + { + int headYAcceleration = (int)(npc.Center.X / 16f) + Main.rand.Next(-50, 51); + int headYTopSpeed; + for (headYTopSpeed = (int)(npc.Center.Y / 16f) + Main.rand.Next(-50, 51); headYTopSpeed < Main.maxTilesY - 10 && !WorldGen.SolidTile(headYAcceleration, headYTopSpeed); headYTopSpeed++) + { + } + + headYTopSpeed--; + if (!WorldGen.SolidTile(headYAcceleration, headYTopSpeed)) + { + int headXAcceleration = NPC.NewNPC(npc.GetSource_FromAI(), headYAcceleration * 16 + 8, headYTopSpeed * 16, NPCID.DarkCaster); + if (Main.netMode == NetmodeID.Server && headXAcceleration < Main.maxNPCs) + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, headXAcceleration); + + break; + } + } + } + + if (CalamityWorld.LegendaryMode) + { + if (!NPC.AnyNPCs(NPCID.DiabolistWhite)) + { + for (int i = 0; i < 1000; i++) + { + int headYAcceleration = (int)(npc.Center.X / 16f) + Main.rand.Next(-50, 51); + int headYTopSpeed; + for (headYTopSpeed = (int)(npc.Center.Y / 16f) + Main.rand.Next(-50, 51); headYTopSpeed < Main.maxTilesY - 10 && !WorldGen.SolidTile(headYAcceleration, headYTopSpeed); headYTopSpeed++) + { + } + + headYTopSpeed--; + if (!WorldGen.SolidTile(headYAcceleration, headYTopSpeed)) + { + int headXAcceleration = NPC.NewNPC(npc.GetSource_FromAI(), headYAcceleration * 16 + 8, headYTopSpeed * 16, NPCID.DiabolistWhite); + if (Main.netMode == NetmodeID.Server && headXAcceleration < Main.maxNPCs) + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, headXAcceleration); + + break; + } + } + } + } + } + } + + npc.defense -= 10; + + float phaseChangeRateBoost = phase3 ? 0f : 1f - (lifeRatio - phase3LifeRatio) / (1f - phase3LifeRatio); + npc.ai[2] += 1f + phaseChangeRateBoost; + + calamityGlobalNPC.newAI[1] += 1f; + if (calamityGlobalNPC.newAI[1] == 2f) + SoundEngine.PlaySound(phase3 ? SoundID.ForceRoarPitched : SoundID.ForceRoar, npc.Center); + + // Shoot shadowflames (giant cursed skull projectiles) while charging in phase 4 + if (phase4 && Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + float shadowFlameGateValue = 20f; + int shadowFlameLimit = death ? 3 : 2; + if (calamityGlobalNPC.newAI[1] % shadowFlameGateValue == 0f && calamityGlobalNPC.newAI[1] < shadowFlameGateValue * shadowFlameLimit) + { + // Spawn projectiles + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 240f) + { + float shadowFlameProjectileSpeed = death ? 5f : 4f; + if (masterMode) + shadowFlameProjectileSpeed *= 1.2f; + + Vector2 initialProjectileVelocity = npc.Center.DirectionTo(Main.player[npc.target].Center) * shadowFlameProjectileSpeed; + int type = ProjectileID.Shadowflames; + int damage = npc.GetProjectileDamage(type); + int shadowFlameProjectile = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, initialProjectileVelocity, type, damage, 0f, Main.myPlayer, 0f, 1f); + Main.projectile[shadowFlameProjectile].timeLeft = 600; + } + } + } + } + + // Reset telegraph timer to create color fade + if (npc.localAI[1] > 0f) + { + npc.localAI[1] -= 2f; + if (npc.localAI[1] <= 0f) + { + npc.localAI[1] = 0f; + npc.SyncVanillaLocalAI(); + } + } + + bool dontGoMach10 = false; + float dashPhaseTime = masterMode ? 210f : 300f; + if (npc.ai[2] >= dashPhaseTime) + { + if (Main.getGoodWorld) + { + if (Main.netMode != NetmodeID.MultiplayerClient && NPC.CountNPCS(NPCID.DarkCaster) < 6) + { + for (int j = 0; j < 1000; j++) + { + int headYAcceleration = (int)(npc.Center.X / 16f) + Main.rand.Next(-50, 51); + int headYTopSpeed; + for (headYTopSpeed = (int)(npc.Center.Y / 16f) + Main.rand.Next(-50, 51); headYTopSpeed < Main.maxTilesY - 10 && !WorldGen.SolidTile(headYAcceleration, headYTopSpeed); headYTopSpeed++) + { + } + + headYTopSpeed--; + if (!WorldGen.SolidTile(headYAcceleration, headYTopSpeed)) + { + int headXAcceleration = NPC.NewNPC(npc.GetSource_FromAI(), headYAcceleration * 16 + 8, headYTopSpeed * 16, NPCID.DarkCaster); + if (Main.netMode == NetmodeID.Server && headXAcceleration < Main.maxNPCs) + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, headXAcceleration); + + break; + } + } + } + } + + if (respawnHands && !disableSkullsAfterCharge && Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + // Spawn projectiles + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int chargeSkullAmt = death ? 5 : 3; + int chargeSkullSpread = death ? 80 : 60; + float rotation = MathHelper.ToRadians(chargeSkullSpread); + float skullProjSpeed = phase4 ? (6f + (death ? 2f * ((phase4LifeRatio - lifeRatio) / phase4LifeRatio) : 0f)) : 4f; + Vector2 initialProjectileVelocity = npc.Center.DirectionTo(Main.player[npc.target].Center) * skullProjSpeed; + int type = ProjectileID.Skull; + int damage = npc.GetProjectileDamage(type); + for (int k = 0; k < chargeSkullAmt + 1; k++) + { + Vector2 perturbedSpeed = initialProjectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, k / (float)(chargeSkullAmt - 1))); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center - perturbedSpeed.SafeNormalize(Vector2.UnitY) * 5f, perturbedSpeed, type, damage, 0f, Main.myPlayer, -1f); + Main.projectile[proj].timeLeft = 600; + if (masterMode) + { + int proj2 = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center - perturbedSpeed.SafeNormalize(Vector2.UnitY) * 5f, perturbedSpeed, type, damage, 0f, Main.myPlayer, -2f); + Main.projectile[proj2].timeLeft = 600; + } + } + } + } + + npc.ai[2] = 0f; + npc.ai[1] = 0f; + npc.localAI[0] = 0f; + npc.localAI[1] = 0f; + calamityGlobalNPC.newAI[1] = 0f; + + npc.TargetClosest(); + npc.SyncVanillaLocalAI(); + npc.SyncExtraAI(); + npc.netUpdate = true; + + dontGoMach10 = true; + } + + npc.rotation += npc.direction * 0.3f; + + Vector2 headSpinPos = npc.Center; + float headSpinTargetX = Main.player[npc.target].Center.X - headSpinPos.X; + float headSpinTargetY = Main.player[npc.target].Center.Y - headSpinPos.Y; + float headSpinTargetDist = (float)Math.Sqrt(headSpinTargetX * headSpinTargetX + headSpinTargetY * headSpinTargetY); + + // Increase speed while charging + npc.damage = (int)Math.Round(npc.defDamage * 1.3); + + if (!phase3) + { + float velocityBoost = MathHelper.Lerp(0f, 3f, (1f - lifeRatio) / (1f - phase3LifeRatio)); + if (handsDead || bossRush) + headSpinVelocityMult += velocityBoost; + } + + float altDashStopDistance = death ? (masterMode ? 320f : 360f) : (masterMode ? 360f : 400f); + float headSpeedIncreaseDist = phase3 ? altDashStopDistance : 160f; + if (headSpinTargetDist > headSpeedIncreaseDist) + { + float velocityMult = phase3 ? 0.00075f : 0.0015f; + float baseDistanceVelocityMult = 1f + MathHelper.Clamp((headSpinTargetDist - headSpeedIncreaseDist) * 0.0015f, 0.05f, masterMode ? 2f : 1.5f); + headSpinVelocityMult *= baseDistanceVelocityMult; + } + + if (Main.getGoodWorld) + headSpinVelocityMult *= 1.3f; + + headSpinTargetDist = headSpinVelocityMult / headSpinTargetDist; + Vector2 headSpinVelocity = new Vector2(headSpinTargetX, headSpinTargetY) * headSpinTargetDist; + + if (!dontGoMach10) + { + if (phase3) + { + // Dash directly towards the target until within 15 tiles of the target, and then continue in the same direction + float altDashPhaseTime = dashPhaseTime * (death ? 0.9f : 0.85f); + if (npc.ai[2] < altDashPhaseTime) + { + if (npc.Center.Distance(Main.player[npc.target].Center) > altDashStopDistance || npc.ai[2] == 1f + phaseChangeRateBoost) + npc.velocity = headSpinVelocity.SafeNormalize(Vector2.UnitY) * headSpinVelocityMult + npc.Center.DirectionTo(Main.player[npc.target].Center + (bossRush ? Main.player[npc.target].velocity * 20f : Vector2.Zero)) * 2f; + else + npc.ai[2] = altDashPhaseTime; + } + } + else + npc.velocity = headSpinVelocity; + } + } + + // Daytime enrage + else if (npc.ai[1] == 2f) + { + npc.damage = 1000; + calamityGlobalNPC.DR = 0.9999f; + calamityGlobalNPC.unbreakableDR = true; + + calamityGlobalNPC.CurrentlyEnraged = true; + calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = true; + + npc.rotation += npc.direction * 0.3f; + Vector2 enrageSpinPos = npc.Center; + float enrageSpinTargetX = Main.player[npc.target].Center.X - enrageSpinPos.X; + float enrageSpinTargetY = Main.player[npc.target].Center.Y - enrageSpinPos.Y; + float enrageSpinTargetDist = (float)Math.Sqrt(enrageSpinTargetX * enrageSpinTargetX + enrageSpinTargetY * enrageSpinTargetY); + enrageSpinTargetDist = 8f / enrageSpinTargetDist; + npc.velocity.X = enrageSpinTargetX * enrageSpinTargetDist; + npc.velocity.Y = enrageSpinTargetY * enrageSpinTargetDist; + } + + // Despawn + else if (npc.ai[1] == 3f) + { + // Disable teleports + if (npc.ai[3] != 0f || calamityGlobalNPC.newAI[2] != 0f || calamityGlobalNPC.newAI[3] != 0f) + { + npc.ai[3] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + calamityGlobalNPC.newAI[3] = 0f; + npc.SyncExtraAI(); + npc.netUpdate = true; + } + + // Avoid cheap bullshit + npc.damage = 0; + + npc.velocity.Y += 0.1f; + if (npc.velocity.Y < 0f) + npc.velocity.Y *= 0.95f; + npc.velocity.X *= 0.95f; + if (npc.timeLeft > 50) + npc.timeLeft = 50; + } + + // Emit dust + if (npc.ai[1] != 2f && npc.ai[1] != 3f && numHandsAlive != 0) + { + int idleDust = Dust.NewDust(new Vector2(npc.Center.X - 15f - npc.velocity.X * 5f, npc.position.Y + npc.height - 2f), 30, 10, DustID.Blood, -npc.velocity.X * 0.2f, 3f, 0, default, 2f); + Main.dust[idleDust].noGravity = true; + Main.dust[idleDust].velocity.X = Main.dust[idleDust].velocity.X * 1.3f; + Main.dust[idleDust].velocity.X = Main.dust[idleDust].velocity.X + npc.velocity.X * 0.4f; + Main.dust[idleDust].velocity.Y = Main.dust[idleDust].velocity.Y + (2f + npc.velocity.Y); + for (int j = 0; j < 2; j++) + { + idleDust = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + 120f), npc.width, 60, DustID.Blood, npc.velocity.X, npc.velocity.Y, 0, default, 2f); + Main.dust[idleDust].noGravity = true; + Main.dust[idleDust].velocity -= npc.velocity; + Main.dust[idleDust].velocity.Y = Main.dust[idleDust].velocity.Y + 5f; + } + } + + return false; + } + + public static bool BuffedSkeletronHandAI(NPC npc, Mod mod) + { + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + + bool bossRush = BossRushEvent.BossRushActive; + bool masterMode = Main.masterMode || bossRush; + bool death = CalamityWorld.death || bossRush; + + // Get a target + 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(); + + float yMultiplier = 1f; + if (calamityGlobalNPC.newAI[0] != 0f) + yMultiplier = calamityGlobalNPC.newAI[0]; + if (masterMode) + yMultiplier *= 1.3f; + + // Inflict 0 damage for 3 seconds after spawning + if (calamityGlobalNPC.newAI[1] < 180f) + { + calamityGlobalNPC.newAI[1] += 1f; + if (calamityGlobalNPC.newAI[1] % 15f == 0f) + npc.SyncExtraAI(); + + npc.damage = 0; + } + else + npc.damage = npc.defDamage; + + npc.spriteDirection = -(int)npc.ai[0]; + + if (Main.npc[(int)npc.ai[1]].ai[3] == -60f) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + // Teleport dust + for (int m = 0; m < 10; m++) + { + int teleportDust = Dust.NewDust(npc.position, npc.width, npc.height, DustID.GemDiamond, 0f, 0f, 200, default, 3f); + Main.dust[teleportDust].noGravity = true; + Main.dust[teleportDust].velocity.X *= 2f; + } + + // New location + npc.Center = Main.npc[(int)npc.ai[1]].Center; + npc.velocity = Vector2.Zero; + npc.netUpdate = true; + } + } + + float skeletronLifeRatio = 1f; + if (!Main.npc[(int)npc.ai[1]].active || Main.npc[(int)npc.ai[1]].aiStyle != NPCAIStyleID.SkeletronHead) + { + npc.ai[2] += 10f; + if (npc.ai[2] > 50f || Main.netMode != NetmodeID.Server) + { + npc.life = -1; + npc.HitEffect(0, 10.0); + npc.active = false; + } + } + else + skeletronLifeRatio = Main.npc[(int)npc.ai[1]].life / (float)Main.npc[(int)npc.ai[1]].lifeMax; + + // This bool exists for fairness so the hands don't slap when Skeletron is in phase 3 and getting ready to do the new charge + bool cancelSlap = Main.npc[(int)npc.ai[1]].ai[2] >= ChargeGateValue; + + // Fire skulls from hands at the end of each slap phase (master mode only) + bool phase2 = skeletronLifeRatio < 0.5f; + + // Attack far more often if still alive + bool phase3 = skeletronLifeRatio < 0.3f; + + float velocityMultiplier = MathHelper.Lerp(death ? 0.6f : 0.7f, 1f, skeletronLifeRatio); + float velocityIncrement = MathHelper.Lerp(0.2f, death ? 0.4f : 0.3f, 1f - skeletronLifeRatio); + float handSwipeVelocity = MathHelper.Lerp(16f, death ? 24f : 20f, 1f - skeletronLifeRatio); + float deceleration = Main.getGoodWorld ? 0.78f : masterMode ? 0.82f : 0.86f; + + if (masterMode) + { + velocityMultiplier *= 0.75f; + velocityIncrement *= 1.5f; + handSwipeVelocity *= 1.35f; + deceleration *= 0.75f; + } + + float handSwipeDistance = masterMode ? HandSwipeDistance_Master : HandSwipeDistance; + float handSwipeDuration = handSwipeDistance / handSwipeVelocity; + float slapGateValue = HandSlapGateValue; + + float slapTimerIncrement = MathHelper.Lerp(masterMode ? 1.5f : 1f, masterMode ? 3f : 2f, 1f - skeletronLifeRatio); + if (phase3) + slapTimerIncrement *= (death ? 2.5f : 2f); + else if (phase2) + slapTimerIncrement *= (death ? 2f : 1.5f); + + if (npc.ai[2] == 0f || npc.ai[2] == 3f) + { + // Avoid cheap bullshit + npc.damage = 0; + + if (Main.npc[(int)npc.ai[1]].ai[1] == 3f && npc.timeLeft > 10) + npc.timeLeft = 10; + + if (Main.npc[(int)npc.ai[1]].ai[1] != 0f || cancelSlap) + { + float maxX = velocityIncrement * 100f * velocityMultiplier; + float maxY = velocityIncrement * 100f * velocityMultiplier; + + if (npc.Top.Y > Main.npc[(int)npc.ai[1]].Top.Y - 100f * yMultiplier) + { + if (npc.velocity.Y > 0f) + npc.velocity.Y *= deceleration; + npc.velocity.Y -= velocityIncrement; + if (npc.velocity.Y > maxY) + npc.velocity.Y = maxY; + } + else if (npc.Top.Y < Main.npc[(int)npc.ai[1]].Top.Y - 100f * yMultiplier) + { + if (npc.velocity.Y < 0f) + npc.velocity.Y *= deceleration; + npc.velocity.Y += velocityIncrement; + if (npc.velocity.Y < -maxY) + npc.velocity.Y = -maxY; + } + + if (npc.Center.X > Main.npc[(int)npc.ai[1]].Center.X - 120f * npc.ai[0]) + { + if (npc.velocity.X > 0f) + npc.velocity.X *= deceleration; + npc.velocity.X -= velocityIncrement; + if (npc.velocity.X > maxX) + npc.velocity.X = maxX; + } + + if (npc.Center.X < Main.npc[(int)npc.ai[1]].Center.X - 120f * npc.ai[0]) + { + if (npc.velocity.X < 0f) + npc.velocity.X *= deceleration; + npc.velocity.X += velocityIncrement; + if (npc.velocity.X < -maxX) + npc.velocity.X = -maxX; + } + } + else + { + if (calamityGlobalNPC.newAI[3] == 1f) + { + calamityGlobalNPC.newAI[2] += slapTimerIncrement; + npc.ai[3] += slapTimerIncrement; + if (npc.ai[3] >= slapGateValue) + { + npc.ai[2] += 1f; + npc.ai[3] = calamityGlobalNPC.newAI[2] = slapGateValue; + calamityGlobalNPC.newAI[3] = 0f; + npc.netUpdate = true; + npc.SyncExtraAI(); + } + } + else + { + calamityGlobalNPC.newAI[2] -= slapTimerIncrement * 2f; + if (calamityGlobalNPC.newAI[2] <= 0f) + { + calamityGlobalNPC.newAI[2] = 0f; + calamityGlobalNPC.newAI[3] = 1f; + npc.SyncExtraAI(); + } + } + + float maxX = velocityIncrement * 100f * velocityMultiplier; + float maxY = velocityIncrement * 100f * velocityMultiplier; + + if (npc.Top.Y > Main.npc[(int)npc.ai[1]].Top.Y + 230f * yMultiplier) + { + if (npc.velocity.Y > 0f) + npc.velocity.Y *= deceleration; + npc.velocity.Y -= velocityIncrement; + if (npc.velocity.Y > maxY) + npc.velocity.Y = maxY; + } + else if (npc.Top.Y < Main.npc[(int)npc.ai[1]].Top.Y + 230f * yMultiplier) + { + if (npc.velocity.Y < 0f) + npc.velocity.Y *= deceleration; + npc.velocity.Y += velocityIncrement; + if (npc.velocity.Y < -maxY) + npc.velocity.Y = -maxY; + } + + if (npc.Center.X > Main.npc[(int)npc.ai[1]].Center.X - 200f * npc.ai[0]) + { + if (npc.velocity.X > 0f) + npc.velocity.X *= deceleration; + npc.velocity.X -= velocityIncrement; + if (npc.velocity.X > maxX) + npc.velocity.X = maxX; + } + + if (npc.Center.X < Main.npc[(int)npc.ai[1]].Center.X - 200f * npc.ai[0]) + { + if (npc.velocity.X < 0f) + npc.velocity.X *= deceleration; + npc.velocity.X += velocityIncrement; + if (npc.velocity.X < -maxX) + npc.velocity.X = -maxX; + } + } + + Vector2 handCurrentPos = npc.Center; + float handIdleXPos = Main.npc[(int)npc.ai[1]].Center.X - 200f * npc.ai[0] - handCurrentPos.X; + float handIdleYPos = Main.npc[(int)npc.ai[1]].Top.Y + 230f - handCurrentPos.Y; + float handIdleDist = (float)Math.Sqrt(handIdleXPos * handIdleXPos + handIdleYPos * handIdleYPos); + npc.rotation = (float)Math.Atan2(handIdleYPos, handIdleXPos) + MathHelper.PiOver2; + + return false; + } + + if (npc.ai[2] == 1f) + { + // Avoid cheap bullshit + npc.damage = 0; + + Vector2 handCurrentPosition = npc.Center; + float handDrawbackXPos = Main.npc[(int)npc.ai[1]].Center.X - 200f * npc.ai[0] - handCurrentPosition.X; + float handDrawbackYPos = Main.npc[(int)npc.ai[1]].Top.Y + 230f - handCurrentPosition.Y; + float handDrawbackDist = (float)Math.Sqrt(handDrawbackXPos * handDrawbackXPos + handDrawbackYPos * handDrawbackYPos); + npc.rotation = (float)Math.Atan2(handDrawbackYPos, handDrawbackXPos) + MathHelper.PiOver2; + npc.velocity.X *= 0.95f; + npc.velocity.Y -= velocityIncrement; + + if (npc.velocity.Y < -14f) + npc.velocity.Y = -14f; + else if (npc.velocity.Y > 10f) + npc.velocity.Y = 10f; + + if (npc.Top.Y < Main.npc[(int)npc.ai[1]].Top.Y - 200f) + { + // Set damage + npc.damage = npc.defDamage; + + npc.TargetClosest(); + npc.ai[2] = 2f; + npc.ai[3] = 0f; + npc.velocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * handSwipeVelocity; + npc.netUpdate = true; + } + } + else if (npc.ai[2] == 2f) + { + // Set damage + npc.damage = npc.defDamage; + + npc.ai[3] += 1f; + if (npc.ai[3] >= handSwipeDuration || Vector2.Distance(Main.npc[(int)npc.ai[1]].Center, npc.Center) > handSwipeDistance || cancelSlap) + { + npc.ai[2] = 3f; + npc.ai[3] = 0f; + npc.netUpdate = true; + + // Spawn projectiles + if (masterMode && Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && !cancelSlap) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (phase2 && Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 160f) + { + float skullProjSpeed = handSwipeVelocity * (phase3 ? 0.6f : 0.2f); + Vector2 initialProjectileVelocity = npc.Center.DirectionTo(Main.player[npc.target].Center) * skullProjSpeed; + int type = ProjectileID.Skull; + int damage = npc.GetProjectileDamage(type); + int skullProjectile = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, initialProjectileVelocity, type, damage, 0f, Main.myPlayer, -(phase3 ? 2f : 1f)); + Main.projectile[skullProjectile].timeLeft = 600; + } + } + } + } + } + else if (npc.ai[2] == 4f) + { + // Avoid cheap bullshit + npc.damage = 0; + + Vector2 handStrikeCurrentPos = npc.Center; + float handStrikeXPos = Main.npc[(int)npc.ai[1]].Center.X - 200f * npc.ai[0] - handStrikeCurrentPos.X; + float handStrikeYPos = Main.npc[(int)npc.ai[1]].Top.Y + 230f - handStrikeCurrentPos.Y; + float handStrikeDist = (float)Math.Sqrt(handStrikeXPos * handStrikeXPos + handStrikeYPos * handStrikeYPos); + npc.rotation = (float)Math.Atan2(handStrikeYPos, handStrikeXPos) + MathHelper.PiOver2; + npc.velocity.Y *= 0.95f; + npc.velocity.X += velocityIncrement * -npc.ai[0]; + + if (npc.velocity.X < -10f) + npc.velocity.X = -10f; + else if (npc.velocity.X > 14f) + npc.velocity.X = 14f; + + if (npc.Center.X < Main.npc[(int)npc.ai[1]].Center.X - 500f || npc.Center.X > Main.npc[(int)npc.ai[1]].Center.X + 500f) + { + // Set damage + npc.damage = npc.defDamage; + + npc.TargetClosest(); + npc.ai[2] = 5f; + npc.ai[3] = 0f; + npc.velocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * handSwipeVelocity; + npc.netUpdate = true; + } + } + else if (npc.ai[2] == 5f) + { + // Set damage + npc.damage = npc.defDamage; + + npc.ai[3] += 1f; + if (npc.ai[3] >= handSwipeDuration || Vector2.Distance(Main.npc[(int)npc.ai[1]].Center, npc.Center) > handSwipeDistance || cancelSlap) + { + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.netUpdate = true; + + // Spawn projectiles + if (masterMode && Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && !cancelSlap) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (phase2 && Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 160f) + { + float skullProjSpeed = handSwipeVelocity * (phase3 ? 0.6f : 0.2f); + Vector2 initialProjectileVelocity = npc.Center.DirectionTo(Main.player[npc.target].Center) * skullProjSpeed; + int type = ProjectileID.Skull; + int damage = npc.GetProjectileDamage(type); + int skullProjectile = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, initialProjectileVelocity, type, damage, 0f, Main.myPlayer, -(phase3 ? 2f : 1f)); + Main.projectile[skullProjectile].timeLeft = 600; + } + } + } + } + } + + return false; + } + + public static void RevengeanceDungeonGuardianAI(NPC npc) + { + Player target = Main.player[npc.target]; + if (npc.ai[1] != 3f) + { + Vector2 targetVector = target.Center - npc.Center; + float targetDist = targetVector.Length(); + targetDist = 12f / targetDist; + npc.velocity.X = targetVector.X * targetDist; + npc.velocity.Y = targetVector.Y * targetDist; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (npc.localAI[1]++ % 60f == 59f) + { + Vector2 source = npc.Center; + if (Collision.CanHit(source, 1, 1, target.Center, target.width, target.height)) + { + float speed = 5f; + float xDist = target.Center.X - source.X + Main.rand.Next(-20, 21); + float yDist = target.Center.Y - source.Y + Main.rand.Next(-20, 21); + Vector2 velocity = new Vector2(xDist, yDist); + float distTarget = velocity.Length(); + distTarget = speed / distTarget; + velocity.X *= distTarget; + velocity.Y *= distTarget; + Vector2 offset = new Vector2(velocity.X * 1f + Main.rand.Next(-50, 51) * 0.01f, velocity.Y * 1f + Main.rand.Next(-50, 51) * 0.01f).SafeNormalize(Vector2.UnitY); + offset *= speed; + offset += npc.velocity; + velocity.X = offset.X; + velocity.Y = offset.Y; + int damage = 2500; + int projType = ProjectileID.Skull; + source += offset * 5f; + int skull = Projectile.NewProjectile(npc.GetSource_FromAI(), source, velocity, projType, damage, 0f, Main.myPlayer, -1f); + Main.projectile[skull].timeLeft = 600; + Main.projectile[skull].tileCollide = false; + } + } + } + } + } + + public static bool VanillaSkeletronAI(NPC npc, Mod mod) + { + npc.reflectsProjectiles = false; + npc.defense = npc.defDefense; + if (npc.ai[0] == 0f && Main.netMode != NetmodeID.MultiplayerClient) + { + npc.TargetClosest(); + npc.ai[0] = 1f; + int num148 = NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X), (int)npc.Center.Y, NPCID.SkeletronHand, npc.whoAmI); + Main.npc[num148].ai[0] = -1f; + Main.npc[num148].ai[1] = npc.whoAmI; + Main.npc[num148].target = npc.target; + Main.npc[num148].netUpdate = true; + num148 = NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X), (int)npc.Center.Y, NPCID.SkeletronHand, npc.whoAmI); + Main.npc[num148].ai[0] = 1f; + Main.npc[num148].ai[1] = npc.whoAmI; + Main.npc[num148].ai[3] = 150f; + Main.npc[num148].target = npc.target; + Main.npc[num148].netUpdate = true; + } + + if (Main.netMode == NetmodeID.MultiplayerClient && npc.localAI[0] == 0f) + { + npc.localAI[0] = 1f; + SoundEngine.PlaySound(SoundID.ForceRoar, npc.Center); + } + + if (Main.player[npc.target].dead || Math.Abs(npc.position.X - Main.player[npc.target].position.X) > 2000f || Math.Abs(npc.position.Y - Main.player[npc.target].position.Y) > 2000f) + { + npc.TargetClosest(); + if (Main.player[npc.target].dead || Math.Abs(npc.position.X - Main.player[npc.target].position.X) > 2000f || Math.Abs(npc.position.Y - Main.player[npc.target].position.Y) > 2000f) + npc.ai[1] = 3f; + } + + if (Main.IsItDay() && npc.ai[1] != 3f && npc.ai[1] != 2f) + { + npc.ai[1] = 2f; + SoundEngine.PlaySound(SoundID.ForceRoar, npc.Center); + } + + int numHands = 0; + int maxHands = 2; + if (Main.expertMode) + { + for (int num150 = 0; num150 < Main.maxNPCs; num150++) + { + if (Main.npc[num150].active && Main.npc[num150].type == NPCID.SkeletronHand) + numHands++; + } + + npc.defense += numHands * (Main.masterMode ? 15 : 10); + npc.Calamity().CurrentlyIncreasingDefenseOrDR = numHands > 0; + npc.chaseable = numHands == 0; + if ((numHands < maxHands || (double)npc.life < (double)npc.lifeMax * 0.75 || Main.masterMode) && npc.ai[1] == 0f) + { + float num151 = 80f; + if (numHands == 0 || Main.masterMode) + num151 /= 2f; + + if (Main.getGoodWorld) + num151 *= 0.8f; + + if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] % num151 == 0f) + { + Vector2 center3 = npc.Center; + float num152 = Main.player[npc.target].Center.X - center3.X; + float num153 = Main.player[npc.target].Center.Y - center3.Y; + float num154 = (float)Math.Sqrt(num152 * num152 + num153 * num153); + if (Collision.CanHit(center3, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + float num155 = 3f; + if (numHands == 0 || Main.masterMode) + num155 += 2f; + + float num156 = Main.player[npc.target].Center.X - center3.X + (float)Main.rand.Next(-5, 6); + float num157 = Main.player[npc.target].Center.Y - center3.Y + (float)Main.rand.Next(-5, 6); + float num158 = (float)Math.Sqrt(num156 * num156 + num157 * num157); + num158 = num155 / num158; + num156 *= num158; + num157 *= num158; + Vector2 vector19 = new Vector2(num156 * 1f + (float)Main.rand.Next(-50, 51) * 0.01f, num157 * 1f + (float)Main.rand.Next(-50, 51) * 0.01f).SafeNormalize(Vector2.UnitY); + vector19 *= num155; + vector19 += npc.velocity; + num156 = vector19.X; + num157 = vector19.Y; + int type = ProjectileID.Skull; + center3 += vector19 * 5f; + int num160 = Projectile.NewProjectile(npc.GetSource_FromAI(), center3.X, center3.Y, num156, num157, type, npc.GetProjectileDamage(type), 0f, Main.myPlayer, -1f); + Main.projectile[num160].timeLeft = 300; + } + } + } + } + + if (npc.ai[1] == 0f) + { + // Avoid cheap bullshit + npc.damage = 0; + + npc.ai[2] += 1f; + float chargeGateValue = Main.masterMode ? (600f - (maxHands - numHands) * 200f) : 800f; + if (npc.ai[2] >= chargeGateValue) + { + npc.ai[2] = 0f; + npc.ai[1] = 1f; + npc.TargetClosest(); + npc.netUpdate = true; + } + + npc.rotation = npc.velocity.X / 15f; + float accelerationY = Main.getGoodWorld ? 0.05f : Main.masterMode ? 0.04f : Main.expertMode ? 0.03f : 0.02f; + float maxVelocityY = accelerationY * 100f; + float accelerationX = Main.getGoodWorld ? 0.093f : Main.masterMode ? 0.088f : Main.expertMode ? 0.076f : 0.064f; + float maxVelocityX = accelerationX * 100f; + float deceleration = Main.getGoodWorld ? 0.83f : Main.masterMode ? 0.86f : Main.expertMode ? 0.89f : 0.92f; + + if (npc.position.Y > Main.player[npc.target].position.Y - 250f) + { + if (npc.velocity.Y > 0f) + npc.velocity.Y *= deceleration; + + npc.velocity.Y -= accelerationY; + if (npc.velocity.Y > maxVelocityY) + npc.velocity.Y = maxVelocityY; + } + else if (npc.position.Y < Main.player[npc.target].position.Y - 250f) + { + if (npc.velocity.Y < 0f) + npc.velocity.Y *= deceleration; + + npc.velocity.Y += accelerationY; + if (npc.velocity.Y < -maxVelocityY) + npc.velocity.Y = -maxVelocityY; + } + + if (npc.Center.X > Main.player[npc.target].Center.X) + { + if (npc.velocity.X > 0f) + npc.velocity.X *= deceleration; + + npc.velocity.X -= accelerationX; + if (npc.velocity.X > maxVelocityX) + npc.velocity.X = maxVelocityX; + } + + if (npc.Center.X < Main.player[npc.target].Center.X) + { + if (npc.velocity.X < 0f) + npc.velocity.X *= deceleration; + + npc.velocity.X += accelerationX; + if (npc.velocity.X < 0f - maxVelocityX) + npc.velocity.X = 0f - maxVelocityX; + } + } + else if (npc.ai[1] == 1f) + { + if (Main.getGoodWorld) + { + if (numHands > 0) + { + npc.reflectsProjectiles = true; + } + else if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] % 200f == 0f && NPC.CountNPCS(NPCID.DarkCaster) < 6) + { + int num165 = 1; + for (int num166 = 0; num166 < num165; num166++) + { + int num167 = 1000; + for (int num168 = 0; num168 < num167; num168++) + { + int num169 = (int)(npc.Center.X / 16f) + Main.rand.Next(-50, 51); + int num170; + for (num170 = (int)(npc.Center.Y / 16f) + Main.rand.Next(-50, 51); num170 < Main.maxTilesY - 10 && !WorldGen.SolidTile(num169, num170); num170++) + { + } + + num170--; + if (!WorldGen.SolidTile(num169, num170)) + { + int num171 = NPC.NewNPC(npc.GetSource_FromAI(), num169 * 16 + 8, num170 * 16, NPCID.DarkCaster); + if (Main.netMode == NetmodeID.Server && num171 < Main.maxNPCs) + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num171); + + break; + } + } + } + } + } + + npc.defense -= 10; + npc.ai[2] += 1f; + if (npc.ai[2] == 2f) + SoundEngine.PlaySound(SoundID.ForceRoar, npc.Center); + + float idlePhaseGateValue = Main.masterMode ? (300f - (maxHands - numHands) * 100f) : 400f; + if (npc.ai[2] >= idlePhaseGateValue) + { + npc.ai[2] = 0f; + npc.ai[1] = 0f; + } + + npc.rotation += (float)npc.direction * 0.3f; + Vector2 vector20 = npc.Center; + float num172 = Main.player[npc.target].Center.X - vector20.X; + float num173 = Main.player[npc.target].Center.Y - vector20.Y; + float num174 = (float)Math.Sqrt(num172 * num172 + num173 * num173); + float num175 = 3f; + npc.damage = (int)Math.Round(npc.defDamage * 1.3); + if (Main.expertMode) + { + num175 = Main.masterMode ? (5f - numHands * 0.5f) : 3.5f; + if (num174 > 150f) + num175 *= 1.05f; + + if (num174 > 200f) + num175 *= 1.1f; + + if (num174 > 250f) + num175 *= 1.1f; + + if (num174 > 300f) + num175 *= 1.1f; + + if (num174 > 350f) + num175 *= 1.1f; + + if (num174 > 400f) + num175 *= 1.1f; + + if (num174 > 450f) + num175 *= 1.1f; + + if (num174 > 500f) + num175 *= 1.1f; + + if (num174 > 550f) + num175 *= 1.1f; + + if (num174 > 600f) + num175 *= 1.1f; + + switch (numHands) + { + case 0: + num175 *= 1.1f; + break; + case 1: + num175 *= 1.05f; + break; + } + } + + if (Main.getGoodWorld) + num175 *= 1.3f; + + num174 = num175 / num174; + npc.velocity.X = num172 * num174; + npc.velocity.Y = num173 * num174; + } + else if (npc.ai[1] == 2f) + { + npc.damage = 1000; + npc.defense = 9999; + + npc.Calamity().CurrentlyEnraged = true; + npc.Calamity().CurrentlyIncreasingDefenseOrDR = true; + + npc.rotation += (float)npc.direction * 0.3f; + Vector2 vector21 = npc.Center; + float num176 = Main.player[npc.target].Center.X - vector21.X; + float num177 = Main.player[npc.target].Center.Y - vector21.Y; + float num178 = (float)Math.Sqrt(num176 * num176 + num177 * num177); + num178 = 8f / num178; + npc.velocity.X = num176 * num178; + npc.velocity.Y = num177 * num178; + } + else if (npc.ai[1] == 3f) + { + // Avoid cheap bullshit + npc.damage = 0; + + npc.velocity.Y += 0.1f; + if (npc.velocity.Y < 0f) + npc.velocity.Y *= 0.95f; + + npc.velocity.X *= 0.95f; + npc.EncourageDespawn(50); + } + + if (npc.ai[1] != 2f && npc.ai[1] != 3f && (numHands != 0 || !Main.expertMode)) + { + int num179 = Dust.NewDust(new Vector2(npc.Center.X - 15f - npc.velocity.X * 5f, npc.position.Y + (float)npc.height - 2f), 30, 10, DustID.Blood, (0f - npc.velocity.X) * 0.2f, 3f, 0, default(Color), 2f); + Main.dust[num179].noGravity = true; + Main.dust[num179].velocity.X *= 1.3f; + Main.dust[num179].velocity.X += npc.velocity.X * 0.4f; + Main.dust[num179].velocity.Y += 2f + npc.velocity.Y; + for (int num180 = 0; num180 < 2; num180++) + { + num179 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + 120f), npc.width, 60, DustID.Blood, npc.velocity.X, npc.velocity.Y, 0, default(Color), 2f); + Main.dust[num179].noGravity = true; + Dust dust = Main.dust[num179]; + dust.velocity -= npc.velocity; + Main.dust[num179].velocity.Y += 5f; + } + } + + return false; + } + + public static bool VanillaSkeletronHandAI(NPC npc, Mod mod) + { + npc.spriteDirection = -(int)npc.ai[0]; + if (!Main.npc[(int)npc.ai[1]].active || Main.npc[(int)npc.ai[1]].aiStyle != NPCAIStyleID.SkeletronHead) + { + npc.ai[2] += 10f; + if (npc.ai[2] > 50f || Main.netMode != NetmodeID.Server) + { + npc.life = -1; + npc.HitEffect(); + npc.active = false; + } + } + + if (npc.ai[2] == 0f || npc.ai[2] == 3f) + { + // Avoid cheap bullshit + npc.damage = 0; + + if (Main.npc[(int)npc.ai[1]].ai[1] == 3f) + npc.EncourageDespawn(10); + + if (Main.npc[(int)npc.ai[1]].ai[1] != 0f) + { + float accelerationY = Main.getGoodWorld ? 0.1f : Main.masterMode ? 0.09f : Main.expertMode ? 0.08f : 0.07f; + float maxVelocityY = accelerationY * 100f; + float accelerationX = Main.getGoodWorld ? 0.16f : Main.masterMode ? 0.14f : Main.expertMode ? 0.12f : 0.1f; + float maxVelocityX = accelerationX * 100f; + float deceleration = Main.getGoodWorld ? 0.81f : Main.masterMode ? 0.84f : Main.expertMode ? 0.87f : 0.9f; + + if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y - 100f) + { + if (npc.velocity.Y > 0f) + npc.velocity.Y *= deceleration; + + npc.velocity.Y -= accelerationY; + if (npc.velocity.Y > maxVelocityY) + npc.velocity.Y = maxVelocityY; + } + else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y - 100f) + { + if (npc.velocity.Y < 0f) + npc.velocity.Y *= deceleration; + + npc.velocity.Y += accelerationY; + if (npc.velocity.Y < -maxVelocityY) + npc.velocity.Y = -maxVelocityY; + } + + if (npc.Center.X > Main.npc[(int)npc.ai[1]].Center.X - 120f * npc.ai[0]) + { + if (npc.velocity.X > 0f) + npc.velocity.X *= deceleration; + + npc.velocity.X -= accelerationX; + if (npc.velocity.X > maxVelocityX) + npc.velocity.X = maxVelocityX; + } + + if (npc.Center.X < Main.npc[(int)npc.ai[1]].Center.X - 120f * npc.ai[0]) + { + if (npc.velocity.X < 0f) + npc.velocity.X *= deceleration; + + npc.velocity.X += accelerationX; + if (npc.velocity.X < -maxVelocityX) + npc.velocity.X = -maxVelocityX; + } + } + else + { + npc.ai[3] += 1f; + if (Main.expertMode) + npc.ai[3] += 0.5f; + if (Main.masterMode) + npc.ai[3] += 0.5f; + + if (npc.ai[3] >= 300f) + { + npc.ai[2] += 1f; + npc.ai[3] = 0f; + npc.netUpdate = true; + } + + float accelerationY = Main.getGoodWorld ? 0.07f : Main.masterMode ? 0.06f : Main.expertMode ? 0.05f : 0.04f; + float maxVelocityY = accelerationY * 100f; + float accelerationX = Main.getGoodWorld ? 0.13f : Main.masterMode ? 0.11f : Main.expertMode ? 0.09f : 0.07f; + float maxVelocityX = accelerationX * 100f; + float deceleration = Main.getGoodWorld ? 0.88f : Main.masterMode ? 0.9f : Main.expertMode ? 0.92f : 0.94f; + + if (Main.expertMode) + { + if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y + 230f) + { + if (npc.velocity.Y > 0f) + npc.velocity.Y *= deceleration; + + npc.velocity.Y -= accelerationY; + if (npc.velocity.Y > maxVelocityY) + npc.velocity.Y = maxVelocityY; + } + else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y + 230f) + { + if (npc.velocity.Y < 0f) + npc.velocity.Y *= deceleration; + + npc.velocity.Y += accelerationY; + if (npc.velocity.Y < -maxVelocityY) + npc.velocity.Y = -maxVelocityY; + } + + if (npc.Center.X > Main.npc[(int)npc.ai[1]].Center.X - 200f * npc.ai[0]) + { + if (npc.velocity.X > 0f) + npc.velocity.X *= deceleration; + + npc.velocity.X -= accelerationX; + if (npc.velocity.X > maxVelocityX) + npc.velocity.X = maxVelocityX; + } + + if (npc.Center.X < Main.npc[(int)npc.ai[1]].Center.X - 200f * npc.ai[0]) + { + if (npc.velocity.X < 0f) + npc.velocity.X *= deceleration; + + npc.velocity.X += accelerationX; + if (npc.velocity.X < -maxVelocityX) + npc.velocity.X = -maxVelocityX; + } + } + + if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y + 230f) + { + if (npc.velocity.Y > 0f) + npc.velocity.Y *= deceleration; + + npc.velocity.Y -= accelerationY; + if (npc.velocity.Y > maxVelocityY) + npc.velocity.Y = maxVelocityY; + } + else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y + 230f) + { + if (npc.velocity.Y < 0f) + npc.velocity.Y *= deceleration; + + npc.velocity.Y += accelerationY; + if (npc.velocity.Y < -maxVelocityY) + npc.velocity.Y = -maxVelocityY; + } + + if (npc.Center.X > Main.npc[(int)npc.ai[1]].Center.X - 200f * npc.ai[0]) + { + if (npc.velocity.X > 0f) + npc.velocity.X *= deceleration; + + npc.velocity.X -= accelerationX; + if (npc.velocity.X > maxVelocityX) + npc.velocity.X = maxVelocityX; + } + + if (npc.Center.X < Main.npc[(int)npc.ai[1]].Center.X - 200f * npc.ai[0]) + { + if (npc.velocity.X < 0f) + npc.velocity.X *= deceleration; + + npc.velocity.X += accelerationX; + if (npc.velocity.X < -maxVelocityX) + npc.velocity.X = -maxVelocityX; + } + } + + Vector2 vector22 = npc.Center; + float num181 = Main.npc[(int)npc.ai[1]].Center.X - 200f * npc.ai[0] - vector22.X; + float num182 = Main.npc[(int)npc.ai[1]].position.Y + 230f - vector22.Y; + float num183 = (float)Math.Sqrt(num181 * num181 + num182 * num182); + npc.rotation = (float)Math.Atan2(num182, num181) + MathHelper.PiOver2; + } + else if (npc.ai[2] == 1f) + { + // Avoid cheap bullshit + npc.damage = 0; + + Vector2 vector23 = npc.Center; + float num184 = Main.npc[(int)npc.ai[1]].Center.X - 200f * npc.ai[0] - vector23.X; + float num185 = Main.npc[(int)npc.ai[1]].position.Y + 230f - vector23.Y; + float num186 = (float)Math.Sqrt(num184 * num184 + num185 * num185); + npc.rotation = (float)Math.Atan2(num185, num184) + MathHelper.PiOver2; + npc.velocity.X *= 0.95f; + npc.velocity.Y -= 0.1f; + if (Main.expertMode) + { + npc.velocity.Y -= (Main.masterMode ? 0.09f : 0.06f); + if (npc.velocity.Y < -13f) + npc.velocity.Y = -13f; + } + else if (npc.velocity.Y < -8f) + npc.velocity.Y = -8f; + + if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y - 200f) + { + // Set damage + npc.damage = npc.defDamage; + + npc.TargetClosest(); + npc.ai[2] = 2f; + vector23 = npc.Center; + num184 = Main.player[npc.target].Center.X - vector23.X; + num185 = Main.player[npc.target].Center.Y - vector23.Y; + num186 = (float)Math.Sqrt(num184 * num184 + num185 * num185); + num186 = ((!Main.expertMode) ? (18f / num186) : ((Main.masterMode ? 24f : 21f) / num186)); + npc.velocity.X = num184 * num186; + npc.velocity.Y = num185 * num186; + npc.netUpdate = true; + } + } + else if (npc.ai[2] == 2f) + { + // Set damage + npc.damage = npc.defDamage; + + if (npc.position.Y > Main.player[npc.target].position.Y || npc.velocity.Y < 0f) + { + // Avoid cheap bullshit + npc.damage = 0; + + npc.ai[2] = 3f; + } + } + else if (npc.ai[2] == 4f) + { + // Avoid cheap bullshit + npc.damage = 0; + + Vector2 vector24 = npc.Center; + float num187 = Main.npc[(int)npc.ai[1]].Center.X - 200f * npc.ai[0] - vector24.X; + float num188 = Main.npc[(int)npc.ai[1]].position.Y + 230f - vector24.Y; + float num189 = (float)Math.Sqrt(num187 * num187 + num188 * num188); + npc.rotation = (float)Math.Atan2(num188, num187) + MathHelper.PiOver2; + npc.velocity.Y *= 0.95f; + npc.velocity.X += 0.1f * (0f - npc.ai[0]); + if (Main.expertMode) + { + npc.velocity.X += (Main.masterMode ? 0.1f : 0.07f) * (0f - npc.ai[0]); + if (npc.velocity.X < -12f) + npc.velocity.X = -12f; + else if (npc.velocity.X > 12f) + npc.velocity.X = 12f; + } + else if (npc.velocity.X < -8f) + npc.velocity.X = -8f; + else if (npc.velocity.X > 8f) + npc.velocity.X = 8f; + + if (npc.Center.X < Main.npc[(int)npc.ai[1]].Center.X - 500f || npc.Center.X > Main.npc[(int)npc.ai[1]].Center.X + 500f) + { + // Set damage + npc.damage = npc.defDamage; + + npc.TargetClosest(); + npc.ai[2] = 5f; + vector24 = npc.Center; + num187 = Main.player[npc.target].Center.X - vector24.X; + num188 = Main.player[npc.target].Center.Y - vector24.Y; + num189 = (float)Math.Sqrt(num187 * num187 + num188 * num188); + num189 = ((!Main.expertMode) ? (17f / num189) : ((Main.masterMode ? 25f : 22f) / num189)); + npc.velocity.X = num187 * num189; + npc.velocity.Y = num188 * num189; + npc.netUpdate = true; + } + } + else if (npc.ai[2] == 5f && ((npc.velocity.X > 0f && npc.Center.X > Main.player[npc.target].Center.X) || (npc.velocity.X < 0f && npc.Center.X < Main.player[npc.target].Center.X))) + { + // Avoid cheap bullshit + npc.damage = 0; + + npc.ai[2] = 0f; + } + + return false; + } + } +} diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronPrimeAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronPrimeAI.cs new file mode 100644 index 0000000000..96febd4b2a --- /dev/null +++ b/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronPrimeAI.cs @@ -0,0 +1,3530 @@ +using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Events; +using CalamityMod.NPCs.NormalNPCs; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses +{ + public static class SkeletronPrimeAI + { + public static bool BuffedSkeletronPrimeAI(NPC npc, Mod mod) + { + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + + bool bossRush = BossRushEvent.BossRushActive; + bool masterMode = Main.masterMode || bossRush; + bool death = CalamityWorld.death || bossRush; + + // Get a target + 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(); + + // Percent life remaining + float lifeRatio = npc.life / (float)npc.lifeMax; + + if (npc.ai[3] != 0f) + NPC.mechQueen = npc.whoAmI; + + // Spawn arms + if (calamityGlobalNPC.newAI[1] == 0f) + { + calamityGlobalNPC.newAI[1] = 1f; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + // Spawn second head in Master Mode + // The main head owns the Saw and the Laser in Master Mode + if (masterMode) + { + int head = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, ModContent.NPCType(), npc.whoAmI); + Main.npc[head].ai[0] = npc.whoAmI; + Main.npc[head].target = npc.target; + Main.npc[head].netUpdate = true; + npc.ai[0] = head; + + int arm = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.PrimeSaw, npc.whoAmI); + Main.npc[arm].ai[0] = 1f; + Main.npc[arm].ai[1] = npc.whoAmI; + Main.npc[arm].target = npc.target; + Main.npc[arm].netUpdate = true; + + arm = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.PrimeLaser, npc.whoAmI); + Main.npc[arm].ai[0] = 1f; + Main.npc[arm].ai[1] = npc.whoAmI; + Main.npc[arm].target = npc.target; + Main.npc[arm].netUpdate = true; + Main.npc[arm].ai[3] = 150f; + } + else + { + int arm = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.PrimeCannon, npc.whoAmI); + Main.npc[arm].ai[0] = -1f; + Main.npc[arm].ai[1] = npc.whoAmI; + Main.npc[arm].target = npc.target; + Main.npc[arm].netUpdate = true; + + arm = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.PrimeSaw, npc.whoAmI); + Main.npc[arm].ai[0] = 1f; + Main.npc[arm].ai[1] = npc.whoAmI; + Main.npc[arm].target = npc.target; + Main.npc[arm].netUpdate = true; + + arm = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.PrimeVice, npc.whoAmI); + Main.npc[arm].ai[0] = -1f; + Main.npc[arm].ai[1] = npc.whoAmI; + Main.npc[arm].target = npc.target; + Main.npc[arm].ai[3] = 150f; + Main.npc[arm].netUpdate = true; + + arm = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.PrimeLaser, npc.whoAmI); + Main.npc[arm].ai[0] = 1f; + Main.npc[arm].ai[1] = npc.whoAmI; + Main.npc[arm].target = npc.target; + Main.npc[arm].netUpdate = true; + Main.npc[arm].ai[3] = 150f; + } + } + + npc.netUpdate = true; + npc.SyncExtraAI(); + } + + if (masterMode) + { + if (!Main.npc[(int)npc.ai[0]].active || Main.npc[(int)npc.ai[0]].aiStyle != NPCAIStyleID.SkeletronPrimeHead) + { + npc.life = 0; + npc.HitEffect(); + npc.active = false; + npc.netUpdate = true; + } + else + { + // Link the HP of both heads + if (npc.life > Main.npc[(int)npc.ai[0]].life) + npc.life = Main.npc[(int)npc.ai[0]].life; + + // Push away from the lead head if too close, pull closer if too far, if Mechdusa isn't real + if (!NPC.IsMechQueenUp) + { + float pushVelocity = 0.25f; + if (Vector2.Distance(npc.Center, Main.npc[(int)npc.ai[0]].Center) < 80f * npc.scale) + { + if (npc.position.X < Main.npc[(int)npc.ai[0]].position.X) + npc.velocity.X -= pushVelocity; + else + npc.velocity.X += pushVelocity; + + if (npc.position.Y < Main.npc[(int)npc.ai[0]].position.Y) + npc.velocity.Y -= pushVelocity; + else + npc.velocity.Y += pushVelocity; + } + else if (Vector2.Distance(npc.Center, Main.npc[(int)npc.ai[0]].Center) > 240f * npc.scale) + { + if (npc.position.X < Main.npc[(int)npc.ai[0]].position.X) + npc.velocity.X += pushVelocity; + else + npc.velocity.X -= pushVelocity; + + if (npc.position.Y < Main.npc[(int)npc.ai[0]].position.Y) + npc.velocity.Y += pushVelocity; + else + npc.velocity.Y -= pushVelocity; + } + } + } + } + + // Check if arms are alive + bool cannonAlive = false; + bool laserAlive = false; + bool viceAlive = false; + bool sawAlive = false; + if (CalamityGlobalNPC.primeCannon != -1) + { + if (Main.npc[CalamityGlobalNPC.primeCannon].active) + cannonAlive = true; + } + if (CalamityGlobalNPC.primeLaser != -1) + { + if (Main.npc[CalamityGlobalNPC.primeLaser].active) + laserAlive = true; + } + if (CalamityGlobalNPC.primeVice != -1) + { + if (Main.npc[CalamityGlobalNPC.primeVice].active) + viceAlive = true; + } + if (CalamityGlobalNPC.primeSaw != -1) + { + if (Main.npc[CalamityGlobalNPC.primeSaw].active) + sawAlive = true; + } + bool allArmsDead = !cannonAlive && !laserAlive && !viceAlive && !sawAlive; + npc.chaseable = allArmsDead; + + npc.defense = npc.defDefense; + + // Phases + bool phase2 = lifeRatio < 0.66f; + bool spawnDestroyer = lifeRatio < 0.75f && masterMode && !bossRush && npc.localAI[2] == 0f; + bool phase3 = lifeRatio < 0.33f; + bool spawnRetinazer = lifeRatio < 0.5f && masterMode && !bossRush && npc.localAI[2] == 1f; + + // Spawn The Destroyer in Master Mode (just like Oblivion from Avalon) + if (spawnDestroyer) + { + Player destroyerSpawnPlayer = Main.player[Player.FindClosest(npc.position, npc.width, npc.height)]; + SoundEngine.PlaySound(SoundID.Roar, destroyerSpawnPlayer.Center); + if (Main.netMode != NetmodeID.MultiplayerClient) + NPC.SpawnOnPlayer(destroyerSpawnPlayer.whoAmI, NPCID.TheDestroyer); + + npc.localAI[2] = 1f; + npc.SyncVanillaLocalAI(); + } + + // Spawn Retinazer in Master Mode (just like Oblivion from Avalon) + if (spawnRetinazer) + { + Player retinazerSpawnPlayer = Main.player[Player.FindClosest(npc.position, npc.width, npc.height)]; + SoundEngine.PlaySound(SoundID.Roar, retinazerSpawnPlayer.Center); + if (Main.netMode != NetmodeID.MultiplayerClient) + NPC.SpawnOnPlayer(retinazerSpawnPlayer.whoAmI, NPCID.Retinazer); + + npc.localAI[2] = 2f; + npc.SyncVanillaLocalAI(); + } + + // Despawn + if (Main.player[npc.target].dead || Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) > 6000f || Math.Abs(npc.Center.Y - Main.player[npc.target].Center.Y) > 6000f) + { + npc.TargetClosest(); + if (Main.player[npc.target].dead || Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) > 6000f || Math.Abs(npc.Center.Y - Main.player[npc.target].Center.Y) > 6000f) + npc.ai[1] = 3f; + } + + // Activate daytime enrage + if (Main.IsItDay() && !bossRush && npc.ai[1] != 3f && npc.ai[1] != 2f) + { + // Heal + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int healAmt = npc.life - 300; + if (healAmt < 0) + { + int absHeal = Math.Abs(healAmt); + npc.life += absHeal; + npc.HealEffect(absHeal, true); + npc.netUpdate = true; + } + } + + npc.ai[1] = 2f; + SoundEngine.PlaySound(SoundID.ForceRoar, npc.Center); + } + + // Adjust slowing debuff immunity + bool immuneToSlowingDebuffs = npc.ai[1] == 5f; + npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + npc.buffImmune[BuffID.Slow] = immuneToSlowingDebuffs; + npc.buffImmune[BuffID.Webbed] = immuneToSlowingDebuffs; + + bool normalLaserRotation = npc.localAI[1] % 2f == 0f; + + // Prevents cheap hits + bool canUseAttackInMaster = npc.position.Y < Main.player[npc.target].position.Y - 350f; + + // Float near player + if (npc.ai[1] == 0f || npc.ai[1] == 4f) + { + // Avoid unfair bullshit + npc.damage = 0; + + // Start other phases; if arms are dead, start with spin phase + bool otherHeadChargingOrSpinning = Main.npc[(int)npc.ai[0]].ai[1] == 5f || Main.npc[(int)npc.ai[0]].ai[1] == 1f; + if (phase2 || CalamityWorld.LegendaryMode || allArmsDead) + { + // Start spin phase after 1.5 seconds + npc.ai[2] += phase3 ? 1.5f : 1f; + if (npc.ai[2] >= (90f - (death ? (masterMode ? 15f : 60f) * (1f - lifeRatio) : 0f)) && (!otherHeadChargingOrSpinning || !masterMode || phase3) && (canUseAttackInMaster || !masterMode)) + { + bool shouldSpinAround = npc.ai[1] == 4f && npc.position.Y < Main.player[npc.target].position.Y - 400f && + Vector2.Distance(Main.player[npc.target].Center, npc.Center) < 600f && Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 400f; + + if (shouldSpinAround || npc.ai[1] != 4f) + { + if (shouldSpinAround) + { + npc.localAI[3] = 300f; + npc.SyncVanillaLocalAI(); + } + + npc.ai[2] = 0f; + npc.ai[1] = shouldSpinAround ? 5f : 1f; + npc.TargetClosest(); + npc.netUpdate = true; + } + } + } + + if (NPC.IsMechQueenUp) + npc.rotation = npc.rotation.AngleLerp(npc.velocity.X / 15f * 0.5f, 0.75f); + else + npc.rotation = npc.velocity.X / 15f; + + float acceleration = (bossRush ? 0.2f : masterMode ? 0.125f : 0.1f) + (death ? 0.05f * (1f - lifeRatio) : 0f); + float accelerationMult = 1f; + if (!cannonAlive) + { + acceleration += 0.025f; + accelerationMult += 0.5f; + } + if (!laserAlive) + { + acceleration += 0.025f; + accelerationMult += 0.5f; + } + if (!viceAlive) + acceleration += 0.025f; + if (!sawAlive) + acceleration += 0.025f; + if (masterMode) + acceleration *= accelerationMult; + + float topVelocity = acceleration * 100f; + float deceleration = masterMode ? 0.7f : 0.85f; + + float headDecelerationUpDist = 0f; + float headDecelerationDownDist = 0f; + float headDecelerationHorizontalDist = 0f; + int headHorizontalDirection = ((!(Main.player[npc.target].Center.X < npc.Center.X)) ? 1 : (-1)); + if (NPC.IsMechQueenUp) + { + headDecelerationHorizontalDist = -150f * (float)headHorizontalDirection; + headDecelerationUpDist = -100f; + headDecelerationDownDist = -100f; + } + + if (npc.position.Y > Main.player[npc.target].position.Y - (400f + headDecelerationUpDist)) + { + if (npc.velocity.Y > 0f) + npc.velocity.Y *= deceleration; + + npc.velocity.Y -= acceleration; + + if (npc.velocity.Y > topVelocity) + npc.velocity.Y = topVelocity; + } + else if (npc.position.Y < Main.player[npc.target].position.Y - (450f + headDecelerationDownDist)) + { + if (npc.velocity.Y < 0f) + npc.velocity.Y *= deceleration; + + npc.velocity.Y += acceleration; + + if (npc.velocity.Y < -topVelocity) + npc.velocity.Y = -topVelocity; + } + + if (npc.Center.X > Main.player[npc.target].Center.X + (400f + headDecelerationHorizontalDist)) + { + if (npc.velocity.X > 0f) + npc.velocity.X *= deceleration; + + npc.velocity.X -= acceleration; + + if (npc.velocity.X > topVelocity) + npc.velocity.X = topVelocity; + } + if (npc.Center.X < Main.player[npc.target].Center.X - (400f + headDecelerationHorizontalDist)) + { + if (npc.velocity.X < 0f) + npc.velocity.X *= deceleration; + + npc.velocity.X += acceleration; + + if (npc.velocity.X < -topVelocity) + npc.velocity.X = -topVelocity; + } + } + + else + { + // Spinning + if (npc.ai[1] == 1f) + { + npc.defense *= 2; + npc.damage = npc.defDamage * 2; + + calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = true; + + if (phase2 && Main.netMode != NetmodeID.MultiplayerClient) + { + npc.localAI[0] += 1f; + if (npc.localAI[0] >= 45f) + { + npc.localAI[0] = 0f; + + int totalProjectiles = bossRush ? 24 : death ? (masterMode ? 15 : 18) : 12; + float radians = MathHelper.TwoPi / totalProjectiles; + int type = ProjectileID.DeathLaser; + int damage = npc.GetProjectileDamage(type); + + // Reduce mech boss projectile damage depending on the new ore progression changes + if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + { + double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; + double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; + if (!NPC.downedMechBossAny) + damage = (int)(damage * firstMechMultiplier); + else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) + damage = (int)(damage * secondMechMultiplier); + } + + float velocity = 3f; + double angleA = radians * 0.5; + double angleB = MathHelper.ToRadians(90f) - angleA; + float velocityX = (float)(velocity * Math.Sin(angleA) / Math.Sin(angleB)); + Vector2 spinningPoint = normalLaserRotation ? new Vector2(0f, -velocity) : new Vector2(-velocityX, -velocity); + for (int k = 0; k < totalProjectiles; k++) + { + Vector2 laserFireDirection = spinningPoint.RotatedBy(radians * k); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + laserFireDirection.SafeNormalize(Vector2.UnitY) * 100f, laserFireDirection, type, damage, 0f, Main.myPlayer, 1f, 0f); + Main.projectile[proj].timeLeft = 900; + } + npc.localAI[1] += 1f; + } + } + + npc.ai[2] += 1f; + if (npc.ai[2] == 2f) + SoundEngine.PlaySound(SoundID.ForceRoar, npc.Center); + + // Spin for 3 seconds then return to floating phase + float phaseTimer = 240f; + if (phase2 && !phase3) + phaseTimer += 60f; + + if (npc.ai[2] >= (phaseTimer - (death ? 60f * (1f - lifeRatio) : 0f))) + { + npc.TargetClosest(); + npc.ai[2] = 0f; + npc.ai[1] = 4f; + npc.localAI[0] = 0f; + } + + if (NPC.IsMechQueenUp) + npc.rotation = npc.rotation.AngleLerp(npc.velocity.X / 15f * 0.5f, 0.75f); + else + npc.rotation += npc.direction * 0.3f; + + Vector2 headPosition = npc.Center; + float headTargetX = Main.player[npc.target].Center.X - headPosition.X; + float headTargetY = Main.player[npc.target].Center.Y - headPosition.Y; + float headTargetDistance = (float)Math.Sqrt(headTargetX * headTargetX + headTargetY * headTargetY); + + float speed = bossRush ? 12f : (masterMode ? 8f : 6f); + if (phase2) + speed += 0.5f; + if (phase3) + speed += 0.5f; + + if (headTargetDistance > 150f) + { + float baseDistanceVelocityMult = 1f + MathHelper.Clamp((headTargetDistance - 150f) * 0.0015f, 0.05f, 1.5f); + speed *= baseDistanceVelocityMult; + } + + if (NPC.IsMechQueenUp) + { + float mechdusaSpeedMult = (NPC.npcsFoundForCheckActive[NPCID.TheDestroyerBody] ? 0.6f : 0.75f); + speed *= mechdusaSpeedMult; + } + + headTargetDistance = speed / headTargetDistance; + npc.velocity.X = headTargetX * headTargetDistance; + npc.velocity.Y = headTargetY * headTargetDistance; + + if (NPC.IsMechQueenUp) + { + float mechdusaAccelMult = Vector2.Distance(npc.Center, Main.player[npc.target].Center); + if (mechdusaAccelMult < 0.1f) + mechdusaAccelMult = 0f; + + if (mechdusaAccelMult < speed) + npc.velocity = npc.velocity.SafeNormalize(Vector2.Zero) * mechdusaAccelMult; + } + } + + // Daytime enrage + if (npc.ai[1] == 2f) + { + npc.damage = 1000; + calamityGlobalNPC.DR = 0.9999f; + calamityGlobalNPC.unbreakableDR = true; + + calamityGlobalNPC.CurrentlyEnraged = true; + calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = true; + + if (NPC.IsMechQueenUp) + npc.rotation = npc.rotation.AngleLerp(npc.velocity.X / 15f * 0.5f, 0.75f); + else + npc.rotation += npc.direction * 0.3f; + + Vector2 enragedHeadPosition = npc.Center; + float enragedHeadTargetX = Main.player[npc.target].Center.X - enragedHeadPosition.X; + float enragedHeadTargetY = Main.player[npc.target].Center.Y - enragedHeadPosition.Y; + float enragedHeadTargetDist = (float)Math.Sqrt(enragedHeadTargetX * enragedHeadTargetX + enragedHeadTargetY * enragedHeadTargetY); + + float enragedHeadSpeed = 10f; + enragedHeadSpeed += enragedHeadTargetDist / 100f; + if (enragedHeadSpeed < 8f) + enragedHeadSpeed = 8f; + if (enragedHeadSpeed > 32f) + enragedHeadSpeed = 32f; + + enragedHeadTargetDist = enragedHeadSpeed / enragedHeadTargetDist; + npc.velocity.X = enragedHeadTargetX * enragedHeadTargetDist; + npc.velocity.Y = enragedHeadTargetY * enragedHeadTargetDist; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.localAI[0] += 1f; + if (npc.localAI[0] >= 60f) + { + npc.localAI[0] = 0f; + Vector2 headCenter = npc.Center; + if (Collision.CanHit(headCenter, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + enragedHeadSpeed = 7f; + float enragedHeadSkullTargetX = Main.player[npc.target].Center.X - headCenter.X + Main.rand.Next(-20, 21); + float enragedHeadSkullTargetY = Main.player[npc.target].Center.Y - headCenter.Y + Main.rand.Next(-20, 21); + float enragedHeadSkullTargetDist = (float)Math.Sqrt(enragedHeadSkullTargetX * enragedHeadSkullTargetX + enragedHeadSkullTargetY * enragedHeadSkullTargetY); + enragedHeadSkullTargetDist = enragedHeadSpeed / enragedHeadSkullTargetDist; + enragedHeadSkullTargetX *= enragedHeadSkullTargetDist; + enragedHeadSkullTargetY *= enragedHeadSkullTargetDist; + + Vector2 value = new Vector2(enragedHeadSkullTargetX * 1f + Main.rand.Next(-50, 51) * 0.01f, enragedHeadSkullTargetY * 1f + Main.rand.Next(-50, 51) * 0.01f).SafeNormalize(Vector2.UnitY); + value *= enragedHeadSpeed; + value += npc.velocity; + enragedHeadSkullTargetX = value.X; + enragedHeadSkullTargetY = value.Y; + + int type = ProjectileID.Skull; + headCenter += value * 5f; + int enragedSkulls = Projectile.NewProjectile(npc.GetSource_FromAI(), headCenter.X, headCenter.Y, enragedHeadSkullTargetX, enragedHeadSkullTargetY, type, 250, 0f, Main.myPlayer, -3f, 0f); + Main.projectile[enragedSkulls].timeLeft = 300; + } + } + } + } + + // Despawning + if (npc.ai[1] == 3f) + { + // Avoid unfair bullshit + npc.damage = 0; + + if (NPC.IsMechQueenUp) + { + int mechdusaBossDespawning = NPC.FindFirstNPC(NPCID.Retinazer); + if (mechdusaBossDespawning >= 0) + Main.npc[mechdusaBossDespawning].EncourageDespawn(5); + + mechdusaBossDespawning = NPC.FindFirstNPC(NPCID.Spazmatism); + if (mechdusaBossDespawning >= 0) + Main.npc[mechdusaBossDespawning].EncourageDespawn(5); + + if (!NPC.AnyNPCs(NPCID.Retinazer) && !NPC.AnyNPCs(NPCID.Spazmatism)) + { + mechdusaBossDespawning = NPC.FindFirstNPC(NPCID.TheDestroyer); + if (mechdusaBossDespawning >= 0) + Main.npc[mechdusaBossDespawning].Transform(NPCID.TheDestroyerTail); + + npc.EncourageDespawn(5); + } + + npc.velocity.Y += 0.1f; + if (npc.velocity.Y < 0f) + npc.velocity.Y *= 0.95f; + + npc.velocity.X *= 0.95f; + if (npc.velocity.Y > 13f) + npc.velocity.Y = 13f; + } + else + { + npc.velocity.Y += 0.1f; + if (npc.velocity.Y < 0f) + npc.velocity.Y *= 0.9f; + + npc.velocity.X *= 0.9f; + + if (npc.timeLeft > 500) + npc.timeLeft = 500; + } + } + + // Fly around in a circle + if (npc.ai[1] == 5f) + { + // Avoid unfair bullshit + npc.damage = 0; + + npc.ai[2] += 1f; + + npc.rotation = npc.velocity.X / 50f; + + float skullSpawnDivisor = bossRush ? 9f : death ? 15f - (float)Math.Round((masterMode ? 3f : 5f) * (1f - lifeRatio)) : 15f; + float totalSkulls = 12f; + int skullSpread = bossRush ? 250 : death ? (masterMode ? 125 : 150) : 100; + + // Spin for about 3 seconds + float spinVelocity = 30f; + if (npc.ai[2] == 2f) + { + // Play angry noise + SoundEngine.PlaySound(SoundID.ForceRoar, npc.Center); + + // Set spin direction + if (Main.player[npc.target].velocity.X > 0f) + calamityGlobalNPC.newAI[0] = 1f; + else if (Main.player[npc.target].velocity.X < 0f) + calamityGlobalNPC.newAI[0] = -1f; + else + calamityGlobalNPC.newAI[0] = Main.player[npc.target].direction; + + // Set spin velocity + npc.velocity.X = MathHelper.Pi * npc.localAI[3] / spinVelocity; + npc.velocity *= -calamityGlobalNPC.newAI[0]; + npc.SyncExtraAI(); + npc.netUpdate = true; + } + + // Maintain velocity and spit skulls + else if (npc.ai[2] > 2f) + { + npc.velocity = npc.velocity.RotatedBy(MathHelper.Pi / spinVelocity * -calamityGlobalNPC.newAI[0]); + if (npc.ai[2] == 3f) + npc.velocity *= 0.6f; + + if (npc.ai[2] % skullSpawnDivisor == 0f) + { + npc.localAI[0] += 1f; + + if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 64f) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Vector2 headCenter = npc.Center; + float enragedHeadSpeed = (masterMode ? 5f : 4f) + (death ? (masterMode ? 1f : 2f) * (1f - lifeRatio) : 0f); + float enragedHeadSkullTargetX = Main.player[npc.target].Center.X - headCenter.X + Main.rand.Next(-20, 21); + float enragedHeadSkullTargetY = Main.player[npc.target].Center.Y - headCenter.Y + Main.rand.Next(-20, 21); + float enragedHeadSkullTargetDist = (float)Math.Sqrt(enragedHeadSkullTargetX * enragedHeadSkullTargetX + enragedHeadSkullTargetY * enragedHeadSkullTargetY); + enragedHeadSkullTargetDist = enragedHeadSpeed / enragedHeadSkullTargetDist; + enragedHeadSkullTargetX *= enragedHeadSkullTargetDist; + enragedHeadSkullTargetY *= enragedHeadSkullTargetDist; + + Vector2 value = new Vector2(enragedHeadSkullTargetX + Main.rand.Next(-skullSpread, skullSpread + 1) * 0.01f, enragedHeadSkullTargetY + Main.rand.Next(-skullSpread, skullSpread + 1) * 0.01f).SafeNormalize(Vector2.UnitY); + value *= enragedHeadSpeed; + enragedHeadSkullTargetX = value.X; + enragedHeadSkullTargetY = value.Y; + + int type = ProjectileID.Skull; + int damage = npc.GetProjectileDamage(type); + + // Reduce mech boss projectile damage depending on the new ore progression changes + if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + { + double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; + double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; + if (!NPC.downedMechBossAny) + damage = (int)(damage * firstMechMultiplier); + else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) + damage = (int)(damage * secondMechMultiplier); + } + + if (npc.localAI[0] % 3f == 0f) + { + int probeLimit = death ? (masterMode ? 3 : 4) : 2; + if (NPC.CountNPCS(NPCID.Probe) < probeLimit) + NPC.NewNPC(npc.GetSource_FromAI(), (int)headCenter.X, (int)headCenter.Y + 30, NPCID.Probe); + } + + int enragedSkulls = Projectile.NewProjectile(npc.GetSource_FromAI(), headCenter.X, headCenter.Y + 30f, enragedHeadSkullTargetX, enragedHeadSkullTargetY, type, damage, 0f, Main.myPlayer, -3f, 0f); + Main.projectile[enragedSkulls].timeLeft = 480; + Main.projectile[enragedSkulls].tileCollide = false; + } + } + + // Go to floating phase, or spinning phase if in phase 2 + if (npc.localAI[0] >= totalSkulls) + { + npc.velocity = npc.velocity.SafeNormalize(Vector2.UnitY); + + // Fly overhead and spit missiles if on low health + npc.ai[1] = phase3 ? 6f : 1f; + npc.ai[2] = 0f; + npc.localAI[3] = 0f; + npc.localAI[0] = 0f; + calamityGlobalNPC.newAI[0] = 0f; + npc.SyncVanillaLocalAI(); + npc.SyncExtraAI(); + npc.TargetClosest(); + npc.netUpdate = true; + } + } + } + } + + // Fly overhead and spit missiles + if (npc.ai[1] == 6f) + { + // Avoid unfair bullshit + npc.damage = 0; + + npc.rotation = npc.velocity.X / 15f; + + float flightVelocity = bossRush ? 28f : death ? 24f : 20f; + float flightAcceleration = bossRush ? 1.12f : death ? 0.96f : 0.8f; + + if (masterMode) + { + flightVelocity += 4f; + flightAcceleration += 0.16f; + } + + Vector2 destination = new Vector2(Main.player[npc.target].Center.X, Main.player[npc.target].Center.Y - 500f); + npc.SimpleFlyMovement((destination - npc.Center).SafeNormalize(Vector2.UnitY) * flightVelocity, flightAcceleration); + + // Spit homing missiles and then go to floating phase + npc.localAI[3] += 1f; + if (Vector2.Distance(npc.Center, destination) < 80f || npc.ai[2] > 0f || npc.localAI[3] > 120f) + { + float missileSpawnDivisor = death ? 8f : (masterMode ? 10f : 12f); + float totalMissiles = masterMode ? 12f : 10f; + npc.ai[2] += 1f; + if (npc.ai[2] % missileSpawnDivisor == 0f) + { + npc.localAI[0] += 1f; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Vector2 velocity = new Vector2(-1f * (float)Main.rand.NextDouble() * 5f, 1f); + velocity = velocity.RotatedBy((Main.rand.NextDouble() - 0.5) * MathHelper.PiOver4); + int type = ProjectileID.RocketSkeleton; + int damage = npc.GetProjectileDamage(type); + + // Reduce mech boss projectile damage depending on the new ore progression changes + if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + { + double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; + double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; + if (!NPC.downedMechBossAny) + damage = (int)(damage * firstMechMultiplier); + else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) + damage = (int)(damage * secondMechMultiplier); + } + + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X + Main.rand.Next(npc.width / 2), npc.Center.Y + 30f, velocity.X, velocity.Y, type, damage, 0f, Main.myPlayer, npc.target, 1f); + Main.projectile[proj].timeLeft = 540; + } + + SoundEngine.PlaySound(SoundID.Item62, npc.Center); + + if (npc.localAI[0] >= totalMissiles) + { + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.localAI[3] = 0f; + calamityGlobalNPC.newAI[0] = 0f; + npc.localAI[0] = 0f; + npc.SyncVanillaLocalAI(); + npc.SyncExtraAI(); + npc.TargetClosest(); + npc.netUpdate = true; + } + } + } + } + } + + return false; + } + + public static bool BuffedPrimeLaserAI(NPC npc, Mod mod) + { + bool bossRush = BossRushEvent.BossRushActive; + bool masterMode = Main.masterMode || bossRush; + bool death = CalamityWorld.death || bossRush; + + // Get a target + 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(); + + // Set direction + npc.spriteDirection = -(int)npc.ai[0]; + + // Despawn if head is gone + if (!Main.npc[(int)npc.ai[1]].active || Main.npc[(int)npc.ai[1]].aiStyle != NPCAIStyleID.SkeletronPrimeHead) + { + npc.ai[2] += 10f; + if (npc.ai[2] > 50f || Main.netMode != NetmodeID.Server) + { + npc.life = -1; + npc.HitEffect(0, 10.0); + npc.active = false; + } + } + + CalamityGlobalNPC.primeLaser = npc.whoAmI; + + // Check if arms are alive + bool cannonAlive = false; + bool viceAlive = false; + bool sawAlive = false; + if (CalamityGlobalNPC.primeCannon != -1) + { + if (Main.npc[CalamityGlobalNPC.primeCannon].active) + cannonAlive = true; + } + if (CalamityGlobalNPC.primeVice != -1) + { + if (Main.npc[CalamityGlobalNPC.primeVice].active) + viceAlive = true; + } + if (CalamityGlobalNPC.primeSaw != -1) + { + if (Main.npc[CalamityGlobalNPC.primeSaw].active) + sawAlive = true; + } + + // Inflict 0 damage for 3 seconds after spawning + float timeToNotAttack = 180f; + bool dontAttack = npc.Calamity().newAI[2] < timeToNotAttack; + if (dontAttack) + { + npc.Calamity().newAI[2] += 1f; + if (npc.Calamity().newAI[2] >= timeToNotAttack) + npc.SyncExtraAI(); + } + + // Avoid cheap bullshit + npc.damage = 0; + + bool normalLaserRotation = npc.localAI[1] % 2f == 0f; + + // Movement + float acceleration = (bossRush ? 0.6f : death ? (masterMode ? 0.375f : 0.3f) : (masterMode ? 0.3125f : 0.25f)); + float accelerationMult = 1f; + if (!cannonAlive) + { + acceleration += 0.025f; + accelerationMult += 0.5f; + } + if (!viceAlive) + acceleration += 0.025f; + if (!sawAlive) + acceleration += 0.025f; + if (masterMode) + acceleration *= accelerationMult; + + float topVelocity = acceleration * 100f; + float deceleration = masterMode ? 0.6f : 0.8f; + + if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y - 80f) + { + if (npc.velocity.Y > 0f) + npc.velocity.Y *= deceleration; + + npc.velocity.Y -= acceleration; + + if (npc.velocity.Y > topVelocity) + npc.velocity.Y = topVelocity; + } + else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y - 120f) + { + if (npc.velocity.Y < 0f) + npc.velocity.Y *= deceleration; + + npc.velocity.Y += acceleration; + + if (npc.velocity.Y < -topVelocity) + npc.velocity.Y = -topVelocity; + } + + if (npc.Center.X > Main.npc[(int)npc.ai[1]].Center.X - 160f * npc.ai[0]) + { + if (npc.velocity.X > 0f) + npc.velocity.X *= deceleration; + + npc.velocity.X -= acceleration; + + if (npc.velocity.X > topVelocity) + npc.velocity.X = topVelocity; + } + if (npc.Center.X < Main.npc[(int)npc.ai[1]].Center.X - 200f * npc.ai[0]) + { + if (npc.velocity.X < 0f) + npc.velocity.X *= deceleration; + + npc.velocity.X += acceleration; + + if (npc.velocity.X < -topVelocity) + npc.velocity.X = -topVelocity; + } + + // Phase 1 + if (npc.ai[2] == 0f) + { + // Despawn if head is despawning + if (Main.npc[(int)npc.ai[1]].ai[1] == 3f && npc.timeLeft > 10) + npc.timeLeft = 10; + + // Go to other phase after 13.3 seconds (change this as each arm dies) + npc.ai[3] += 1f; + if (!cannonAlive) + npc.ai[3] += 1f; + if (!viceAlive) + npc.ai[3] += 1f; + if (!sawAlive) + npc.ai[3] += 1f; + + if (npc.ai[3] >= (masterMode ? 200f : 800f)) + { + npc.localAI[0] = 0f; + npc.ai[2] = 1f; + npc.ai[3] = 0f; + npc.TargetClosest(); + npc.netUpdate = true; + } + + Vector2 laserArmPosition = npc.Center; + float laserArmTargetX = Main.player[npc.target].Center.X - laserArmPosition.X; + float laserArmTargetY = Main.player[npc.target].Center.Y - laserArmPosition.Y; + float laserArmTargetDist = (float)Math.Sqrt(laserArmTargetX * laserArmTargetX + laserArmTargetY * laserArmTargetY); + npc.rotation = (float)Math.Atan2(laserArmTargetY, laserArmTargetX) - MathHelper.PiOver2; + + if (Main.netMode != NetmodeID.MultiplayerClient && !dontAttack) + { + // Fire laser every 1.5 seconds (change this as each arm dies to fire more aggressively) + npc.localAI[0] += 1f; + if (!cannonAlive) + npc.localAI[0] += 1f; + if (!viceAlive) + npc.localAI[0] += 1f; + if (!sawAlive) + npc.localAI[0] += 1f; + + if (npc.localAI[0] >= 48f) + { + npc.localAI[0] = 0f; + npc.TargetClosest(); + float laserSpeed = bossRush ? 5f : 4f; + int type = ProjectileID.DeathLaser; + int damage = npc.GetProjectileDamage(type); + + // Reduce mech boss projectile damage depending on the new ore progression changes + if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + { + double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; + double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; + if (!NPC.downedMechBossAny) + damage = (int)(damage * firstMechMultiplier); + else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) + damage = (int)(damage * secondMechMultiplier); + } + + laserArmTargetDist = laserSpeed / laserArmTargetDist; + laserArmTargetX *= laserArmTargetDist; + laserArmTargetY *= laserArmTargetDist; + Vector2 laserVelocity = new Vector2(laserArmTargetX, laserArmTargetY); + Projectile.NewProjectile(npc.GetSource_FromAI(), laserArmPosition + laserVelocity.SafeNormalize(Vector2.UnitY) * 100f, laserVelocity, type, damage, 0f, Main.myPlayer, 1f, 0f); + } + } + } + + // Other phase, get closer to the player and fire ring of lasers + else if (npc.ai[2] == 1f) + { + // Go to phase 1 after 2 seconds (change this as each arm dies to stay in this phase for longer) + npc.ai[3] += 1f; + + float timeLimit = 135f; + float timeMult = 1.882075f; + if (!cannonAlive) + timeLimit *= timeMult; + if (!viceAlive) + timeLimit *= timeMult; + if (!sawAlive) + timeLimit *= timeMult; + + if (npc.ai[3] >= timeLimit) + { + npc.localAI[0] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.TargetClosest(); + npc.netUpdate = true; + } + + Vector2 laserRingArmPosition = npc.Center; + float laserRingTargetX = Main.player[npc.target].Center.X - laserRingArmPosition.X; + float laserRingTargetY = Main.player[npc.target].Center.Y - laserRingArmPosition.Y; + npc.rotation = (float)Math.Atan2(laserRingTargetY, laserRingTargetX) - MathHelper.PiOver2; + + if (Main.netMode != NetmodeID.MultiplayerClient && !dontAttack) + { + // Fire laser every 1.5 seconds (change this as each arm dies to fire more aggressively) + npc.localAI[0] += 1f; + if (!cannonAlive) + npc.localAI[0] += 0.5f; + if (!viceAlive) + npc.localAI[0] += 0.5f; + if (!sawAlive) + npc.localAI[0] += 0.5f; + + if (npc.localAI[0] >= 120f) + { + npc.localAI[0] = 0f; + npc.TargetClosest(); + int totalProjectiles = bossRush ? 32 : (masterMode ? 24 : 16); + float radians = MathHelper.TwoPi / totalProjectiles; + int type = ProjectileID.DeathLaser; + int damage = npc.GetProjectileDamage(type); + + // Reduce mech boss projectile damage depending on the new ore progression changes + if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + { + double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; + double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; + if (!NPC.downedMechBossAny) + damage = (int)(damage * firstMechMultiplier); + else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) + damage = (int)(damage * secondMechMultiplier); + } + + float velocity = 3f; + double angleA = radians * 0.5; + double angleB = MathHelper.ToRadians(90f) - angleA; + float laserVelocityX = (float)(velocity * Math.Sin(angleA) / Math.Sin(angleB)); + Vector2 spinningPoint = normalLaserRotation ? new Vector2(0f, -velocity) : new Vector2(-laserVelocityX, -velocity); + for (int k = 0; k < totalProjectiles; k++) + { + Vector2 laserFireDirection = spinningPoint.RotatedBy(radians * k); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + laserFireDirection.SafeNormalize(Vector2.UnitY) * 100f, laserFireDirection, type, damage, 0f, Main.myPlayer, 1f, 0f); + Main.projectile[proj].timeLeft = 900; + } + npc.localAI[1] += 1f; + } + } + } + + return false; + } + + public static bool BuffedPrimeCannonAI(NPC npc, Mod mod) + { + bool bossRush = BossRushEvent.BossRushActive; + bool masterMode = Main.masterMode || bossRush; + bool death = CalamityWorld.death || bossRush; + + // Get a target + 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(); + + npc.spriteDirection = -(int)npc.ai[0]; + + if (!Main.npc[(int)npc.ai[1]].active || Main.npc[(int)npc.ai[1]].aiStyle != NPCAIStyleID.SkeletronPrimeHead) + { + npc.ai[2] += 10f; + if (npc.ai[2] > 50f || Main.netMode != NetmodeID.Server) + { + npc.life = -1; + npc.HitEffect(0, 10.0); + npc.active = false; + } + } + + CalamityGlobalNPC.primeCannon = npc.whoAmI; + + // Check if arms are alive + bool laserAlive = false; + bool viceAlive = false; + bool sawAlive = false; + if (CalamityGlobalNPC.primeLaser != -1) + { + if (Main.npc[CalamityGlobalNPC.primeLaser].active) + laserAlive = true; + } + if (CalamityGlobalNPC.primeVice != -1) + { + if (Main.npc[CalamityGlobalNPC.primeVice].active) + viceAlive = true; + } + if (CalamityGlobalNPC.primeSaw != -1) + { + if (Main.npc[CalamityGlobalNPC.primeSaw].active) + sawAlive = true; + } + + // Inflict 0 damage for 3 seconds after spawning + float timeToNotAttack = 180f; + bool dontAttack = npc.Calamity().newAI[2] < timeToNotAttack; + if (dontAttack) + { + npc.Calamity().newAI[2] += 1f; + if (npc.Calamity().newAI[2] >= timeToNotAttack) + npc.SyncExtraAI(); + } + + // Avoid cheap bullshit + npc.damage = 0; + + bool fireSlower = false; + if (laserAlive) + { + // If laser is firing ring of lasers + if (Main.npc[CalamityGlobalNPC.primeLaser].ai[2] == 1f) + fireSlower = true; + } + else + { + fireSlower = npc.ai[2] == 0f; + + if (fireSlower) + { + // Go to other phase after 13.33 seconds (change this as each arm dies) + npc.ai[3] += 1f; + if (!laserAlive) + npc.ai[3] += 1f; + if (!viceAlive) + npc.ai[3] += 1f; + if (!sawAlive) + npc.ai[3] += 1f; + + if (npc.ai[3] >= (masterMode ? 200f : 800f)) + { + npc.localAI[0] = 0f; + npc.ai[2] = 1f; + fireSlower = false; + npc.ai[3] = 0f; + npc.TargetClosest(); + npc.netUpdate = true; + } + } + else + { + // Go to phase 1 after 2 seconds (change this as each arm dies to stay in this phase for longer) + npc.ai[3] += 1f; + + float timeLimit = 120f; + float timeMult = 1.882075f; + if (!laserAlive) + timeLimit *= timeMult; + if (!viceAlive) + timeLimit *= timeMult; + if (!sawAlive) + timeLimit *= timeMult; + + if (npc.ai[3] >= timeLimit) + { + npc.localAI[0] = 0f; + npc.ai[2] = 0f; + fireSlower = true; + npc.ai[3] = 0f; + npc.TargetClosest(); + npc.netUpdate = true; + } + } + } + + // Movement + float acceleration = (bossRush ? 0.6f : death ? (masterMode ? 0.375f : 0.3f) : (masterMode ? 0.3125f : 0.25f)); + float accelerationMult = 1f; + if (!laserAlive) + { + acceleration += 0.025f; + accelerationMult += 0.5f; + } + if (!viceAlive) + acceleration += 0.025f; + if (!sawAlive) + acceleration += 0.025f; + if (masterMode) + acceleration *= accelerationMult; + + float topVelocity = acceleration * 100f; + float deceleration = masterMode ? 0.6f : 0.8f; + + if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y - 130f) + { + if (npc.velocity.Y > 0f) + npc.velocity.Y *= deceleration; + + npc.velocity.Y -= acceleration; + + if (npc.velocity.Y > topVelocity) + npc.velocity.Y = topVelocity; + } + else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y - 170f) + { + if (npc.velocity.Y < 0f) + npc.velocity.Y *= deceleration; + + npc.velocity.Y += acceleration; + + if (npc.velocity.Y < -topVelocity) + npc.velocity.Y = -topVelocity; + } + + if (npc.Center.X > Main.npc[(int)npc.ai[1]].Center.X + 160f) + { + if (npc.velocity.X > 0f) + npc.velocity.X *= deceleration; + + npc.velocity.X -= acceleration; + + if (npc.velocity.X > topVelocity) + npc.velocity.X = topVelocity; + } + if (npc.Center.X < Main.npc[(int)npc.ai[1]].Center.X + 200f) + { + if (npc.velocity.X < 0f) + npc.velocity.X *= deceleration; + + npc.velocity.X += acceleration; + + if (npc.velocity.X < -topVelocity) + npc.velocity.X = -topVelocity; + } + + if (fireSlower) + { + if (Main.npc[(int)npc.ai[1]].ai[1] == 3f && npc.timeLeft > 10) + npc.timeLeft = 10; + + Vector2 cannonArmPosition = npc.Center; + float cannonArmTargetX = Main.player[npc.target].Center.X - cannonArmPosition.X; + float cannonArmTargetY = Main.player[npc.target].Center.Y - cannonArmPosition.Y; + float cannonArmTargetDist = (float)Math.Sqrt(cannonArmTargetX * cannonArmTargetX + cannonArmTargetY * cannonArmTargetY); + npc.rotation = (float)Math.Atan2(cannonArmTargetY, cannonArmTargetX) - MathHelper.PiOver2; + + if (Main.netMode != NetmodeID.MultiplayerClient && !dontAttack) + { + // Fire rocket every 2 seconds (change this as each arm dies to fire more aggressively) + npc.localAI[0] += 1f; + if (!laserAlive) + npc.localAI[0] += 1f; + if (!viceAlive) + npc.localAI[0] += 1f; + if (!sawAlive) + npc.localAI[0] += 1f; + + if (npc.localAI[0] >= 120f) + { + SoundEngine.PlaySound(SoundID.Item62, npc.Center); + npc.localAI[0] = 0f; + npc.TargetClosest(); + int type = ProjectileID.RocketSkeleton; + int damage = npc.GetProjectileDamage(type); + + // Reduce mech boss projectile damage depending on the new ore progression changes + if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + { + double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; + double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; + if (!NPC.downedMechBossAny) + damage = (int)(damage * firstMechMultiplier); + else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) + damage = (int)(damage * secondMechMultiplier); + } + + float rocketSpeed = 10f; + cannonArmTargetDist = rocketSpeed / cannonArmTargetDist; + cannonArmTargetX *= cannonArmTargetDist; + cannonArmTargetY *= cannonArmTargetDist; + + Vector2 rocketVelocity = new Vector2(cannonArmTargetX, cannonArmTargetY); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), cannonArmPosition + rocketVelocity.SafeNormalize(Vector2.UnitY) * 40f, rocketVelocity, type, damage, 0f, Main.myPlayer, npc.target, 2f); + Main.projectile[proj].timeLeft = 600; + } + } + } + else + { + Vector2 cannonSpreadArmPosition = npc.Center; + float cannonSpreadArmTargetX = Main.player[npc.target].Center.X - cannonSpreadArmPosition.X; + float cannonSpreadArmTargetY = Main.player[npc.target].Center.Y - cannonSpreadArmPosition.Y; + npc.rotation = (float)Math.Atan2(cannonSpreadArmTargetY, cannonSpreadArmTargetX) - MathHelper.PiOver2; + + if (Main.netMode != NetmodeID.MultiplayerClient && !dontAttack) + { + // Fire rockets every 2 seconds (change this as each arm dies to fire more aggressively) + npc.localAI[0] += 1f; + if (!laserAlive) + npc.localAI[0] += 0.5f; + if (!viceAlive) + npc.localAI[0] += 0.5f; + if (!sawAlive) + npc.localAI[0] += 0.5f; + + if (npc.localAI[0] >= 180f) + { + SoundEngine.PlaySound(SoundID.Item62, npc.Center); + npc.localAI[0] = 0f; + npc.TargetClosest(); + int type = ProjectileID.RocketSkeleton; + int damage = npc.GetProjectileDamage(type); + + // Reduce mech boss projectile damage depending on the new ore progression changes + if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + { + double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; + double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; + if (!NPC.downedMechBossAny) + damage = (int)(damage * firstMechMultiplier); + else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) + damage = (int)(damage * secondMechMultiplier); + } + + float rocketSpeed = 10f; + Vector2 cannonSpreadTargetDist = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * rocketSpeed; + int numProj = bossRush ? 5 : 3; + float rotation = MathHelper.ToRadians(bossRush ? 15 : 9); + for (int i = 0; i < numProj; i++) + { + Vector2 perturbedSpeed = cannonSpreadTargetDist.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 40f, perturbedSpeed, type, damage, 0f, Main.myPlayer, npc.target, 2f); + Main.projectile[proj].timeLeft = 600; + } + } + } + } + + return false; + } + + public static bool BuffedPrimeViceAI(NPC npc, Mod mod) + { + bool bossRush = BossRushEvent.BossRushActive; + bool masterMode = Main.masterMode || bossRush; + bool death = CalamityWorld.death || bossRush; + + // Get a target + 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(); + + // Direction + npc.spriteDirection = -(int)npc.ai[0]; + + // Where the vice should be in relation to the head + Vector2 viceArmPosition = npc.Center; + float viceArmIdleXPos = Main.npc[(int)npc.ai[1]].Center.X - 200f * npc.ai[0] - viceArmPosition.X; + float viceArmIdleYPos = Main.npc[(int)npc.ai[1]].position.Y + 230f - viceArmPosition.Y; + float viceArmIdleDistance = (float)Math.Sqrt(viceArmIdleXPos * viceArmIdleXPos + viceArmIdleYPos * viceArmIdleYPos); + + // Return the vice to its proper location in relation to the head if it's too far away + if (npc.ai[2] != 99f) + { + if (viceArmIdleDistance > 800f) + npc.ai[2] = 99f; + } + else if (viceArmIdleDistance < 400f) + npc.ai[2] = 0f; + + // Despawn if head is gone + if (!Main.npc[(int)npc.ai[1]].active || Main.npc[(int)npc.ai[1]].aiStyle != NPCAIStyleID.SkeletronPrimeHead) + { + npc.ai[2] += 10f; + if (npc.ai[2] > 50f || Main.netMode != NetmodeID.Server) + { + npc.life = -1; + npc.HitEffect(0, 10.0); + npc.active = false; + } + } + + CalamityGlobalNPC.primeVice = npc.whoAmI; + + // Check if arms are alive + bool cannonAlive = false; + bool laserAlive = false; + bool sawAlive = false; + if (CalamityGlobalNPC.primeCannon != -1) + { + if (Main.npc[CalamityGlobalNPC.primeCannon].active) + cannonAlive = true; + } + if (CalamityGlobalNPC.primeLaser != -1) + { + if (Main.npc[CalamityGlobalNPC.primeLaser].active) + laserAlive = true; + } + if (CalamityGlobalNPC.primeSaw != -1) + { + if (Main.npc[CalamityGlobalNPC.primeSaw].active) + sawAlive = true; + } + + // Avoid cheap bullshit + npc.damage = 0; + + // Return to the head + if (npc.ai[2] == 99f) + { + float acceleration = (bossRush ? 0.6f : death ? (masterMode ? 0.375f : 0.3f) : (masterMode ? 0.3125f : 0.25f)); + float accelerationMult = 1f; + if (!cannonAlive) + { + acceleration += 0.025f; + accelerationMult += 0.5f; + } + if (!laserAlive) + { + acceleration += 0.025f; + accelerationMult += 0.5f; + } + if (!sawAlive) + acceleration += 0.025f; + if (masterMode) + acceleration *= accelerationMult; + + float topVelocity = acceleration * 100f; + float deceleration = masterMode ? 0.6f : 0.8f; + + if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y + 20f) + { + if (npc.velocity.Y > 0f) + npc.velocity.Y *= deceleration; + + npc.velocity.Y -= acceleration; + + if (npc.velocity.Y > topVelocity) + npc.velocity.Y = topVelocity; + } + else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y - 20f) + { + if (npc.velocity.Y < 0f) + npc.velocity.Y *= deceleration; + + npc.velocity.Y += acceleration; + + if (npc.velocity.Y < -topVelocity) + npc.velocity.Y = -topVelocity; + } + + if (npc.Center.X > Main.npc[(int)npc.ai[1]].Center.X + 20f) + { + if (npc.velocity.X > 0f) + npc.velocity.X *= deceleration; + + npc.velocity.X -= acceleration * 2f; + + if (npc.velocity.X > topVelocity) + npc.velocity.X = topVelocity; + } + if (npc.Center.X < Main.npc[(int)npc.ai[1]].Center.X - 20f) + { + if (npc.velocity.X < 0f) + npc.velocity.X *= deceleration; + + npc.velocity.X += acceleration * 2f; + + if (npc.velocity.X < -topVelocity) + npc.velocity.X = -topVelocity; + } + } + + // Other phases + else + { + // Stay near the head + if (npc.ai[2] == 0f || npc.ai[2] == 3f) + { + // Despawn if head is despawning + if (Main.npc[(int)npc.ai[1]].ai[1] == 3f && npc.timeLeft > 10) + npc.timeLeft = 10; + + // Start charging after 10 seconds (change this as each arm dies) + npc.ai[3] += 1f; + if (!cannonAlive) + npc.ai[3] += 1f; + if (!laserAlive) + npc.ai[3] += 1f; + if (!sawAlive) + npc.ai[3] += 1f; + + if (npc.ai[3] >= (masterMode ? 150f : 600f)) + { + npc.ai[2] += 1f; + npc.ai[3] = 0f; + npc.TargetClosest(); + npc.netUpdate = true; + } + + float acceleration = (bossRush ? 0.6f : death ? (masterMode ? 0.375f : 0.3f) : (masterMode ? 0.3125f : 0.25f)); + float accelerationMult = 1f; + if (!cannonAlive) + { + acceleration += 0.025f; + accelerationMult += 0.5f; + } + if (!laserAlive) + { + acceleration += 0.025f; + accelerationMult += 0.5f; + } + if (!sawAlive) + acceleration += 0.025f; + if (masterMode) + acceleration *= accelerationMult; + + float topVelocity = acceleration * 100f; + float deceleration = masterMode ? 0.6f : 0.8f; + + if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y + 290f) + { + if (npc.velocity.Y > 0f) + npc.velocity.Y *= deceleration; + + npc.velocity.Y -= acceleration; + + if (npc.velocity.Y > topVelocity) + npc.velocity.Y = topVelocity; + } + else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y + 240f) + { + if (npc.velocity.Y < 0f) + npc.velocity.Y *= deceleration; + + npc.velocity.Y += acceleration; + + if (npc.velocity.Y < -topVelocity) + npc.velocity.Y = -topVelocity; + } + + if (npc.Center.X > Main.npc[(int)npc.ai[1]].Center.X + 150f) + { + if (npc.velocity.X > 0f) + npc.velocity.X *= deceleration; + + npc.velocity.X -= acceleration; + + if (npc.velocity.X > topVelocity) + npc.velocity.X = topVelocity; + } + if (npc.Center.X < Main.npc[(int)npc.ai[1]].Center.X + 100f) + { + if (npc.velocity.X < 0f) + npc.velocity.X *= deceleration; + + npc.velocity.X += acceleration; + + if (npc.velocity.X < -topVelocity) + npc.velocity.X = -topVelocity; + } + + Vector2 viceArmReelbackCurrentPos = npc.Center; + float viceArmReelbackXDest = Main.npc[(int)npc.ai[1]].Center.X - 200f * npc.ai[0] - viceArmReelbackCurrentPos.X; + float viceArmReelbackYDest = Main.npc[(int)npc.ai[1]].position.Y + 230f - viceArmReelbackCurrentPos.Y; + npc.rotation = (float)Math.Atan2(viceArmReelbackYDest, viceArmReelbackXDest) + MathHelper.PiOver2; + return false; + } + + // Charge towards the player + if (npc.ai[2] == 1f) + { + float deceleration = masterMode ? 0.75f : 0.8f; + if (npc.velocity.Y > 0f) + npc.velocity.Y *= deceleration; + + Vector2 viceArmChargePosition = npc.Center; + float viceArmChargeTargetX = Main.npc[(int)npc.ai[1]].Center.X - 280f * npc.ai[0] - viceArmChargePosition.X; + float viceArmChargeTargetY = Main.npc[(int)npc.ai[1]].position.Y + 230f - viceArmChargePosition.Y; + npc.rotation = (float)Math.Atan2(viceArmChargeTargetY, viceArmChargeTargetX) + MathHelper.PiOver2; + + npc.velocity.X = (npc.velocity.X * 5f + Main.npc[(int)npc.ai[1]].velocity.X) / 6f; + npc.velocity.X += 0.5f; + + npc.velocity.Y -= 0.5f; + if (npc.velocity.Y < -12f) + npc.velocity.Y = -12f; + + if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y - 280f) + { + // Set damage + npc.damage = npc.defDamage; + + float chargeVelocity = bossRush ? 20f : 16f; + if (!cannonAlive) + chargeVelocity += 1.5f; + if (!laserAlive) + chargeVelocity += 1.5f; + if (!sawAlive) + chargeVelocity += 1.5f; + + npc.ai[2] = 2f; + npc.TargetClosest(); + viceArmChargePosition = npc.Center; + viceArmChargeTargetX = Main.player[npc.target].Center.X - viceArmChargePosition.X; + viceArmChargeTargetY = Main.player[npc.target].Center.Y - viceArmChargePosition.Y; + float viceArmChargeTargetDist = (float)Math.Sqrt(viceArmChargeTargetX * viceArmChargeTargetX + viceArmChargeTargetY * viceArmChargeTargetY); + viceArmChargeTargetDist = chargeVelocity / viceArmChargeTargetDist; + npc.velocity.X = viceArmChargeTargetX * viceArmChargeTargetDist; + npc.velocity.Y = viceArmChargeTargetY * viceArmChargeTargetDist; + npc.netUpdate = true; + } + } + + // Charge 4 times (more if arms are dead) + else if (npc.ai[2] == 2f) + { + // Set damage + npc.damage = npc.defDamage; + + if (npc.position.Y > Main.player[npc.target].position.Y || npc.velocity.Y < 0f) + { + float chargeAmt = 4f; + if (!cannonAlive) + chargeAmt += 1f; + if (!laserAlive) + chargeAmt += 1f; + if (!sawAlive) + chargeAmt += 1f; + + if (npc.ai[3] >= chargeAmt) + { + // Return to head + npc.ai[2] = 3f; + npc.ai[3] = 0f; + npc.TargetClosest(); + return false; + } + + npc.ai[2] = 1f; + npc.ai[3] += 1f; + } + } + + // Different type of charge + else if (npc.ai[2] == 4f) + { + Vector2 viceArmOtherChargePosition = npc.Center; + float viceArmOtherChargeTargetX = Main.npc[(int)npc.ai[1]].Center.X - 200f * npc.ai[0] - viceArmOtherChargePosition.X; + float viceArmOtherChargeTargetY = Main.npc[(int)npc.ai[1]].position.Y + 230f - viceArmOtherChargePosition.Y; + npc.rotation = (float)Math.Atan2(viceArmOtherChargeTargetY, viceArmOtherChargeTargetX) + MathHelper.PiOver2; + + npc.velocity.Y = (npc.velocity.Y * 5f + Main.npc[(int)npc.ai[1]].velocity.Y) / 6f; + + npc.velocity.X += 0.5f; + if (npc.velocity.X > 12f) + npc.velocity.X = 12f; + + if (npc.Center.X < Main.npc[(int)npc.ai[1]].Center.X - 500f || npc.Center.X > Main.npc[(int)npc.ai[1]].Center.X + 500f) + { + // Set damage + npc.damage = npc.defDamage; + + float chargeVelocity = bossRush ? 17.5f : 14f; + if (!cannonAlive) + chargeVelocity += 1.15f; + if (!laserAlive) + chargeVelocity += 1.15f; + if (!sawAlive) + chargeVelocity += 1.15f; + + npc.ai[2] = 5f; + npc.TargetClosest(); + viceArmOtherChargePosition = npc.Center; + viceArmOtherChargeTargetX = Main.player[npc.target].Center.X - viceArmOtherChargePosition.X; + viceArmOtherChargeTargetY = Main.player[npc.target].Center.Y - viceArmOtherChargePosition.Y; + float viceArmOtherChargeTargetDist = (float)Math.Sqrt(viceArmOtherChargeTargetX * viceArmOtherChargeTargetX + viceArmOtherChargeTargetY * viceArmOtherChargeTargetY); + viceArmOtherChargeTargetDist = chargeVelocity / viceArmOtherChargeTargetDist; + npc.velocity.X = viceArmOtherChargeTargetX * viceArmOtherChargeTargetDist; + npc.velocity.Y = viceArmOtherChargeTargetY * viceArmOtherChargeTargetDist; + npc.netUpdate = true; + } + } + + // Charge 4 times (more if arms are dead) + else if (npc.ai[2] == 5f && npc.Center.X < Main.player[npc.target].Center.X - 100f) + { + // Set damage + npc.damage = npc.defDamage; + + float chargeAmt = 4f; + if (!cannonAlive) + chargeAmt += 1f; + if (!laserAlive) + chargeAmt += 1f; + if (!sawAlive) + chargeAmt += 1f; + + if (npc.ai[3] >= chargeAmt) + { + // Return to head + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.TargetClosest(); + return false; + } + + npc.ai[2] = 4f; + npc.ai[3] += 1f; + } + } + + return false; + } + + public static bool BuffedPrimeSawAI(NPC npc, Mod mod) + { + bool bossRush = BossRushEvent.BossRushActive; + bool masterMode = Main.masterMode || bossRush; + bool death = CalamityWorld.death || bossRush; + + // Get a target + 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(); + + Vector2 sawArmLocation = npc.Center; + float sawArmIdleXPos = Main.npc[(int)npc.ai[1]].Center.X - 200f * npc.ai[0] - sawArmLocation.X; + float sawArmIdleYPos = Main.npc[(int)npc.ai[1]].position.Y + 230f - sawArmLocation.Y; + float sawArmIdleDistance = (float)Math.Sqrt(sawArmIdleXPos * sawArmIdleXPos + sawArmIdleYPos * sawArmIdleYPos); + + if (npc.ai[2] != 99f) + { + if (sawArmIdleDistance > 800f) + npc.ai[2] = 99f; + } + else if (sawArmIdleDistance < 400f) + npc.ai[2] = 0f; + + npc.spriteDirection = -(int)npc.ai[0]; + + if (!Main.npc[(int)npc.ai[1]].active || Main.npc[(int)npc.ai[1]].aiStyle != NPCAIStyleID.SkeletronPrimeHead) + { + npc.ai[2] += 10f; + if (npc.ai[2] > 50f || Main.netMode != NetmodeID.Server) + { + npc.life = -1; + npc.HitEffect(0, 10.0); + npc.active = false; + } + } + + CalamityGlobalNPC.primeSaw = npc.whoAmI; + + // Check if arms are alive + bool cannonAlive = false; + bool laserAlive = false; + bool viceAlive = false; + if (CalamityGlobalNPC.primeCannon != -1) + { + if (Main.npc[CalamityGlobalNPC.primeCannon].active) + cannonAlive = true; + } + if (CalamityGlobalNPC.primeLaser != -1) + { + if (Main.npc[CalamityGlobalNPC.primeLaser].active) + laserAlive = true; + } + if (CalamityGlobalNPC.primeVice != -1) + { + if (Main.npc[CalamityGlobalNPC.primeVice].active) + viceAlive = true; + } + + // Min saw damage + int reducedSetDamage = (int)Math.Round(npc.defDamage * 0.5); + + // Avoid cheap bullshit + npc.damage = reducedSetDamage; + + if (npc.ai[2] == 99f) + { + float acceleration = (bossRush ? 0.6f : death ? (masterMode ? 0.375f : 0.3f) : (masterMode ? 0.3125f : 0.25f)); + float accelerationMult = 1f; + if (!cannonAlive) + { + acceleration += 0.025f; + accelerationMult += 0.5f; + } + if (!laserAlive) + { + acceleration += 0.025f; + accelerationMult += 0.5f; + } + if (!viceAlive) + acceleration += 0.025f; + if (masterMode) + acceleration *= accelerationMult; + + float topVelocity = acceleration * 100f; + float deceleration = masterMode ? 0.6f : 0.8f; + + if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y + 20f) + { + if (npc.velocity.Y > 0f) + npc.velocity.Y *= deceleration; + + npc.velocity.Y -= acceleration; + + if (npc.velocity.Y > topVelocity) + npc.velocity.Y = topVelocity; + } + else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y - 20f) + { + if (npc.velocity.Y < 0f) + npc.velocity.Y *= deceleration; + + npc.velocity.Y += acceleration; + + if (npc.velocity.Y < -topVelocity) + npc.velocity.Y = -topVelocity; + } + + if (npc.Center.X > Main.npc[(int)npc.ai[1]].Center.X + 20f) + { + if (npc.velocity.X > 0f) + npc.velocity.X *= deceleration; + + npc.velocity.X -= acceleration * 2f; + + if (npc.velocity.X > topVelocity) + npc.velocity.X = topVelocity; + } + if (npc.Center.X < Main.npc[(int)npc.ai[1]].Center.X - 20f) + { + if (npc.velocity.X < 0f) + npc.velocity.X *= deceleration; + + npc.velocity.X += acceleration * 2f; + + if (npc.velocity.X < -topVelocity) + npc.velocity.X = -topVelocity; + } + } + else + { + if (npc.ai[2] == 0f || npc.ai[2] == 3f) + { + if (Main.npc[(int)npc.ai[1]].ai[1] == 3f && npc.timeLeft > 10) + npc.timeLeft = 10; + + // Start charging after 3 seconds (change this as each arm dies) + npc.ai[3] += 1f; + if (!cannonAlive) + npc.ai[3] += 1f; + if (!laserAlive) + npc.ai[3] += 1f; + if (!viceAlive) + npc.ai[3] += 1f; + + if (npc.ai[3] >= (masterMode ? 90f : 180f)) + { + npc.ai[2] += 1f; + npc.ai[3] = 0f; + npc.TargetClosest(); + npc.netUpdate = true; + } + + float acceleration = (bossRush ? 0.6f : death ? (masterMode ? 0.375f : 0.3f) : (masterMode ? 0.3125f : 0.25f)); + float accelerationMult = 1f; + if (!cannonAlive) + { + acceleration += 0.025f; + accelerationMult += 0.5f; + } + if (!laserAlive) + { + acceleration += 0.025f; + accelerationMult += 0.5f; + } + if (!viceAlive) + acceleration += 0.025f; + if (masterMode) + acceleration *= accelerationMult; + + float topVelocity = acceleration * 100f; + float deceleration = masterMode ? 0.6f : 0.8f; + + if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y + 310f) + { + if (npc.velocity.Y > 0f) + npc.velocity.Y *= deceleration; + + npc.velocity.Y -= acceleration; + + if (npc.velocity.Y > topVelocity) + npc.velocity.Y = topVelocity; + } + else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y + 270f) + { + if (npc.velocity.Y < 0f) + npc.velocity.Y *= deceleration; + + npc.velocity.Y += acceleration; + + if (npc.velocity.Y < -topVelocity) + npc.velocity.Y = -topVelocity; + } + + if (npc.Center.X > Main.npc[(int)npc.ai[1]].Center.X - 100f) + { + if (npc.velocity.X > 0f) + npc.velocity.X *= deceleration; + + npc.velocity.X -= acceleration * 1.5f; + + if (npc.velocity.X > topVelocity) + npc.velocity.X = topVelocity; + } + if (npc.Center.X < Main.npc[(int)npc.ai[1]].Center.X - 150f) + { + if (npc.velocity.X < 0f) + npc.velocity.X *= deceleration; + + npc.velocity.X += acceleration * 1.5f; + + if (npc.velocity.X < -topVelocity) + npc.velocity.X = -topVelocity; + } + + Vector2 sawArmReelbackCurrentPos = npc.Center; + float sawArmReelbackXDest = Main.npc[(int)npc.ai[1]].Center.X - 200f * npc.ai[0] - sawArmReelbackCurrentPos.X; + float sawArmReelbackYDest = Main.npc[(int)npc.ai[1]].position.Y + 230f - sawArmReelbackCurrentPos.Y; + npc.rotation = (float)Math.Atan2(sawArmReelbackYDest, sawArmReelbackXDest) + MathHelper.PiOver2; + return false; + } + + if (npc.ai[2] == 1f) + { + Vector2 sawArmChargePos = npc.Center; + float sawArmChargeTargetX = Main.npc[(int)npc.ai[1]].Center.X - 200f * npc.ai[0] - sawArmChargePos.X; + float sawArmChargeTargetY = Main.npc[(int)npc.ai[1]].position.Y + 230f - sawArmChargePos.Y; + npc.rotation = (float)Math.Atan2(sawArmChargeTargetY, sawArmChargeTargetX) + MathHelper.PiOver2; + + float deceleration = masterMode ? 0.875f : 0.9f; + npc.velocity.X *= deceleration; + npc.velocity.Y -= 0.5f; + if (npc.velocity.Y < -12f) + npc.velocity.Y = -12f; + + if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y - 200f) + { + // Set damage + npc.damage = npc.defDamage; + + float chargeVelocity = bossRush ? 27.5f : 22f; + if (!cannonAlive) + chargeVelocity += 1.5f; + if (!laserAlive) + chargeVelocity += 1.5f; + if (!viceAlive) + chargeVelocity += 1.5f; + + npc.ai[2] = 2f; + npc.TargetClosest(); + sawArmChargePos = npc.Center; + sawArmChargeTargetX = Main.player[npc.target].Center.X - sawArmChargePos.X; + sawArmChargeTargetY = Main.player[npc.target].Center.Y - sawArmChargePos.Y; + float sawArmChargeTargetDist = (float)Math.Sqrt(sawArmChargeTargetX * sawArmChargeTargetX + sawArmChargeTargetY * sawArmChargeTargetY); + sawArmChargeTargetDist = chargeVelocity / sawArmChargeTargetDist; + npc.velocity.X = sawArmChargeTargetX * sawArmChargeTargetDist; + npc.velocity.Y = sawArmChargeTargetY * sawArmChargeTargetDist; + npc.netUpdate = true; + } + } + + else if (npc.ai[2] == 2f) + { + // Set damage + npc.damage = npc.defDamage; + + if (npc.position.Y > Main.player[npc.target].position.Y || npc.velocity.Y < 0f) + npc.ai[2] = 3f; + } + + else + { + if (npc.ai[2] == 4f) + { + // Set damage + npc.damage = npc.defDamage; + + float chargeVelocity = bossRush ? 13.5f : 11f; + if (!cannonAlive) + chargeVelocity += 1.5f; + if (!laserAlive) + chargeVelocity += 1.5f; + if (!viceAlive) + chargeVelocity += 1.5f; + if (masterMode) + chargeVelocity *= 1.25f; + + Vector2 sawArmOtherChargePos = npc.Center; + float sawArmOtherChargeTargetX = Main.player[npc.target].Center.X - sawArmOtherChargePos.X; + float sawArmOtherChargeTargetY = Main.player[npc.target].Center.Y - sawArmOtherChargePos.Y; + float sawArmOtherChargeTargetDist = (float)Math.Sqrt(sawArmOtherChargeTargetX * sawArmOtherChargeTargetX + sawArmOtherChargeTargetY * sawArmOtherChargeTargetY); + sawArmOtherChargeTargetDist = chargeVelocity / sawArmOtherChargeTargetDist; + sawArmOtherChargeTargetX *= sawArmOtherChargeTargetDist; + sawArmOtherChargeTargetY *= sawArmOtherChargeTargetDist; + + float acceleration = bossRush ? 0.3f : death ? 0.1f : 0.08f; + if (masterMode) + acceleration *= 1.25f; + + float deceleration = masterMode ? 0.6f : 0.8f; + + if (npc.velocity.X > sawArmOtherChargeTargetX) + { + if (npc.velocity.X > 0f) + npc.velocity.X *= deceleration; + + npc.velocity.X -= acceleration; + } + if (npc.velocity.X < sawArmOtherChargeTargetX) + { + if (npc.velocity.X < 0f) + npc.velocity.X *= deceleration; + + npc.velocity.X += acceleration; + } + if (npc.velocity.Y > sawArmOtherChargeTargetY) + { + if (npc.velocity.Y > 0f) + npc.velocity.Y *= deceleration; + + npc.velocity.Y -= acceleration; + } + if (npc.velocity.Y < sawArmOtherChargeTargetY) + { + if (npc.velocity.Y < 0f) + npc.velocity.Y *= deceleration; + + npc.velocity.Y += acceleration; + } + + npc.ai[3] += 1f; + if (npc.justHit) + npc.ai[3] += 2f; + + if (npc.ai[3] >= 600f) + { + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.TargetClosest(); + npc.netUpdate = true; + } + + sawArmOtherChargePos = npc.Center; + sawArmOtherChargeTargetX = Main.npc[(int)npc.ai[1]].Center.X - 200f * npc.ai[0] - sawArmOtherChargePos.X; + sawArmOtherChargeTargetY = Main.npc[(int)npc.ai[1]].position.Y + 230f - sawArmOtherChargePos.Y; + npc.rotation = (float)Math.Atan2(sawArmOtherChargeTargetY, sawArmOtherChargeTargetX) + MathHelper.PiOver2; + return false; + } + + if (npc.ai[2] == 5f && ((npc.velocity.X > 0f && npc.Center.X > Main.player[npc.target].Center.X) || (npc.velocity.X < 0f && npc.Center.X < Main.player[npc.target].Center.X))) + npc.ai[2] = 0f; + } + } + + return false; + } + + public static bool VanillaSkeletronPrimeAI(NPC npc, Mod mod) + { + npc.defense = npc.defDefense; + if (npc.ai[3] != 0f) + NPC.mechQueen = npc.whoAmI; + + npc.reflectsProjectiles = false; + if (npc.ai[0] == 0f && Main.netMode != NetmodeID.MultiplayerClient) + { + npc.TargetClosest(); + npc.ai[0] = 1f; + int num495 = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.PrimeCannon, npc.whoAmI); + Main.npc[num495].ai[0] = -1f; + Main.npc[num495].ai[1] = npc.whoAmI; + Main.npc[num495].target = npc.target; + Main.npc[num495].netUpdate = true; + num495 = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.PrimeSaw, npc.whoAmI); + Main.npc[num495].ai[0] = 1f; + Main.npc[num495].ai[1] = npc.whoAmI; + Main.npc[num495].target = npc.target; + Main.npc[num495].netUpdate = true; + num495 = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.PrimeVice, npc.whoAmI); + Main.npc[num495].ai[0] = -1f; + Main.npc[num495].ai[1] = npc.whoAmI; + Main.npc[num495].target = npc.target; + Main.npc[num495].ai[3] = 150f; + Main.npc[num495].netUpdate = true; + num495 = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.PrimeLaser, npc.whoAmI); + Main.npc[num495].ai[0] = 1f; + Main.npc[num495].ai[1] = npc.whoAmI; + Main.npc[num495].target = npc.target; + Main.npc[num495].netUpdate = true; + Main.npc[num495].ai[3] = 150f; + } + + if (Main.player[npc.target].dead || Math.Abs(npc.position.X - Main.player[npc.target].position.X) > 6000f || Math.Abs(npc.position.Y - Main.player[npc.target].position.Y) > 6000f) + { + npc.TargetClosest(); + if (Main.player[npc.target].dead || Math.Abs(npc.position.X - Main.player[npc.target].position.X) > 6000f || Math.Abs(npc.position.Y - Main.player[npc.target].position.Y) > 6000f) + npc.ai[1] = 3f; + } + + if (Main.IsItDay() && npc.ai[1] != 3f && npc.ai[1] != 2f) + { + npc.ai[1] = 2f; + SoundEngine.PlaySound(SoundID.ForceRoar, npc.Center); + } + + if (npc.ai[1] == 0f) + { + npc.damage = 0; + + npc.ai[2] += 1f; + if (npc.ai[2] >= (Main.masterMode ? 300f : 600f)) + { + npc.ai[2] = 0f; + npc.ai[1] = 1f; + npc.TargetClosest(); + npc.netUpdate = true; + } + + if (NPC.IsMechQueenUp) + npc.rotation = npc.rotation.AngleLerp(npc.velocity.X / 15f * 0.5f, 0.75f); + else + npc.rotation = npc.velocity.X / 15f; + + float num496 = 0.1f; + float num497 = 2f; + float num498 = 0.1f; + float num499 = 8f; + float deceleration = Main.masterMode ? 0.94f : Main.expertMode ? 0.96f : 0.98f; + int num500 = 200; + int num501 = 500; + float num502 = 0f; + int num503 = ((!(Main.player[npc.target].Center.X < npc.Center.X)) ? 1 : (-1)); + if (NPC.IsMechQueenUp) + { + num502 = -450f * (float)num503; + num500 = 300; + num501 = 350; + } + + if (Main.expertMode) + { + num496 = Main.masterMode ? 0.05f : 0.03f; + num497 = Main.masterMode ? 5f : 4f; + num498 = Main.masterMode ? 0.15f : 0.12f; + num499 = Main.masterMode ? 11f : 9.5f; + } + + if (npc.position.Y > Main.player[npc.target].position.Y - (float)num500) + { + if (npc.velocity.Y > 0f) + npc.velocity.Y *= deceleration; + + npc.velocity.Y -= num496; + if (npc.velocity.Y > num497) + npc.velocity.Y = num497; + } + else if (npc.position.Y < Main.player[npc.target].position.Y - (float)num501) + { + if (npc.velocity.Y < 0f) + npc.velocity.Y *= deceleration; + + npc.velocity.Y += num496; + if (npc.velocity.Y < -num497) + npc.velocity.Y = -num497; + } + + if (npc.Center.X > Main.player[npc.target].Center.X + 100f + num502) + { + if (npc.velocity.X > 0f) + npc.velocity.X *= deceleration; + + npc.velocity.X -= num498; + if (npc.velocity.X > num499) + npc.velocity.X = num499; + } + + if (npc.Center.X < Main.player[npc.target].Center.X - 100f + num502) + { + if (npc.velocity.X < 0f) + npc.velocity.X *= deceleration; + + npc.velocity.X += num498; + if (npc.velocity.X < 0f - num499) + npc.velocity.X = 0f - num499; + } + } + else if (npc.ai[1] == 1f) + { + npc.defense *= 2; + npc.damage = npc.defDamage * 2; + + npc.Calamity().CurrentlyIncreasingDefenseOrDR = true; + + npc.ai[2] += 1f; + if (npc.ai[2] == 2f) + SoundEngine.PlaySound(SoundID.ForceRoar, npc.Center); + + if (npc.ai[2] >= (Main.masterMode ? 300f : 400f)) + { + npc.ai[2] = 0f; + npc.ai[1] = 0f; + } + + if (NPC.IsMechQueenUp) + npc.rotation = npc.rotation.AngleLerp(npc.velocity.X / 15f * 0.5f, 0.75f); + else + npc.rotation += (float)npc.direction * 0.3f; + + Vector2 vector54 = npc.Center; + float num504 = Main.player[npc.target].Center.X - vector54.X; + float num505 = Main.player[npc.target].Center.Y - vector54.Y; + float num506 = (float)Math.Sqrt(num504 * num504 + num505 * num505); + float num507 = 5f; + if (Main.expertMode) + { + num507 = Main.masterMode ? 7f : 6f; + if (num506 > 150f) + num507 *= (Main.masterMode ? 1.075f : 1.05f); + + float additionalMultiplier = Main.masterMode ? 1.15f : 1.1f; + if (num506 > 200f) + num507 *= additionalMultiplier; + + if (num506 > 250f) + num507 *= additionalMultiplier; + + if (num506 > 300f) + num507 *= additionalMultiplier; + + if (num506 > 350f) + num507 *= additionalMultiplier; + + if (num506 > 400f) + num507 *= additionalMultiplier; + + if (num506 > 450f) + num507 *= additionalMultiplier; + + if (num506 > 500f) + num507 *= additionalMultiplier; + + if (num506 > 550f) + num507 *= additionalMultiplier; + + if (num506 > 600f) + num507 *= additionalMultiplier; + } + + if (NPC.IsMechQueenUp) + { + float num508 = (NPC.npcsFoundForCheckActive[NPCID.TheDestroyerBody] ? 0.6f : 0.75f); + num507 *= num508; + } + + num506 = num507 / num506; + npc.velocity.X = num504 * num506; + npc.velocity.Y = num505 * num506; + if (NPC.IsMechQueenUp) + { + float num509 = Vector2.Distance(npc.Center, Main.player[npc.target].Center); + if (num509 < 0.1f) + num509 = 0f; + + if (num509 < num507) + npc.velocity = npc.velocity.SafeNormalize(Vector2.Zero) * num509; + } + } + else if (npc.ai[1] == 2f) + { + npc.damage = 1000; + npc.defense = 9999; + + npc.Calamity().CurrentlyEnraged = true; + npc.Calamity().CurrentlyIncreasingDefenseOrDR = true; + + if (NPC.IsMechQueenUp) + npc.rotation = npc.rotation.AngleLerp(npc.velocity.X / 15f * 0.5f, 0.75f); + else + npc.rotation += (float)npc.direction * 0.3f; + + Vector2 vector55 = npc.Center; + float num510 = Main.player[npc.target].Center.X - vector55.X; + float num511 = Main.player[npc.target].Center.Y - vector55.Y; + float num512 = (float)Math.Sqrt(num510 * num510 + num511 * num511); + float num513 = 10f; + num513 += num512 / 100f; + if (num513 < 8f) + num513 = 8f; + + if (num513 > 32f) + num513 = 32f; + + num512 = num513 / num512; + npc.velocity.X = num510 * num512; + npc.velocity.Y = num511 * num512; + } + else + { + if (npc.ai[1] != 3f) + return false; + + if (NPC.IsMechQueenUp) + { + int num514 = NPC.FindFirstNPC(NPCID.Retinazer); + if (num514 >= 0) + Main.npc[num514].EncourageDespawn(5); + + num514 = NPC.FindFirstNPC(NPCID.Spazmatism); + if (num514 >= 0) + Main.npc[num514].EncourageDespawn(5); + + if (!NPC.AnyNPCs(NPCID.Retinazer) && !NPC.AnyNPCs(NPCID.Spazmatism)) + { + num514 = NPC.FindFirstNPC(NPCID.TheDestroyer); + if (num514 >= 0) + Main.npc[num514].Transform(NPCID.TheDestroyerTail); + + npc.EncourageDespawn(5); + } + + npc.velocity.Y += 0.1f; + if (npc.velocity.Y < 0f) + npc.velocity.Y *= 0.95f; + + npc.velocity.X *= 0.95f; + if (npc.velocity.Y > 13f) + npc.velocity.Y = 13f; + } + else + { + npc.EncourageDespawn(500); + npc.velocity.Y += 0.1f; + if (npc.velocity.Y < 0f) + npc.velocity.Y *= 0.95f; + + npc.velocity.X *= 0.95f; + } + } + + return false; + } + + public static bool VanillaPrimeLaserAI(NPC npc, Mod mod) + { + npc.spriteDirection = -(int)npc.ai[0]; + if (!Main.npc[(int)npc.ai[1]].active || Main.npc[(int)npc.ai[1]].aiStyle != NPCAIStyleID.SkeletronPrimeHead) + { + npc.ai[2] += 10f; + if (npc.ai[2] > 50f || Main.netMode != NetmodeID.Server) + { + npc.life = -1; + npc.HitEffect(); + npc.active = false; + } + } + + npc.damage = 0; + + if (npc.ai[2] == 0f || npc.ai[2] == 3f) + { + if (Main.npc[(int)npc.ai[1]].ai[1] == 3f) + npc.EncourageDespawn(10); + + if (Main.npc[(int)npc.ai[1]].ai[1] != 0f) + { + float num496 = 0.07f; + float num497 = 6f; + float num498 = 0.1f; + float num499 = 8f; + float deceleration = Main.masterMode ? 0.92f : Main.expertMode ? 0.94f : 0.96f; + + if (Main.expertMode) + { + num496 = Main.masterMode ? 0.11f : 0.09f; + num497 = Main.masterMode ? 8f : 7f; + num498 = Main.masterMode ? 0.15f : 0.12f; + num499 = Main.masterMode ? 11f : 9.5f; + } + + npc.localAI[0] += 3f; + if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y - 100f) + { + if (npc.velocity.Y > 0f) + npc.velocity.Y *= deceleration; + + npc.velocity.Y -= num496; + if (npc.velocity.Y > num497) + npc.velocity.Y = num497; + } + else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y - 100f) + { + if (npc.velocity.Y < 0f) + npc.velocity.Y *= deceleration; + + npc.velocity.Y += num496; + if (npc.velocity.Y < -num497) + npc.velocity.Y = -num497; + } + + if (npc.Center.X > Main.npc[(int)npc.ai[1]].Center.X - 120f * npc.ai[0]) + { + if (npc.velocity.X > 0f) + npc.velocity.X *= deceleration; + + npc.velocity.X -= num498; + if (npc.velocity.X > num499) + npc.velocity.X = num499; + } + + if (npc.Center.X < Main.npc[(int)npc.ai[1]].Center.X - 120f * npc.ai[0]) + { + if (npc.velocity.X < 0f) + npc.velocity.X *= deceleration; + + npc.velocity.X += num498; + if (npc.velocity.X < -num499) + npc.velocity.X = -num499; + } + } + else + { + npc.ai[3] += 1f; + if (npc.ai[3] >= (Main.masterMode ? 400f : Main.expertMode ? 600f : 800f)) + { + npc.ai[2] += 1f; + npc.ai[3] = 0f; + npc.netUpdate = true; + } + + float num496 = 0.1f; + float num497 = 3f; + float num498 = 0.14f; + float num499 = 8f; + float deceleration = Main.masterMode ? 0.92f : Main.expertMode ? 0.94f : 0.96f; + + if (Main.expertMode) + { + num496 = Main.masterMode ? 0.14f : 0.12f; + num497 = Main.masterMode ? 5f : 4f; + num498 = Main.masterMode ? 0.2f : 0.17f; + num499 = Main.masterMode ? 11f : 9.5f; + } + + if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y - 100f) + { + if (npc.velocity.Y > 0f) + npc.velocity.Y *= deceleration; + + npc.velocity.Y -= num496; + if (npc.velocity.Y > num497) + npc.velocity.Y = num497; + } + else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y - 100f) + { + if (npc.velocity.Y < 0f) + npc.velocity.Y *= deceleration; + + npc.velocity.Y += num496; + if (npc.velocity.Y < -num497) + npc.velocity.Y = -num497; + } + + if (npc.Center.X > Main.npc[(int)npc.ai[1]].Center.X - 180f * npc.ai[0]) + { + if (npc.velocity.X > 0f) + npc.velocity.X *= deceleration; + + npc.velocity.X -= num498; + if (npc.velocity.X > num499) + npc.velocity.X = num499; + } + + if (npc.Center.X < Main.npc[(int)npc.ai[1]].Center.X - 180f * npc.ai[0]) + { + if (npc.velocity.X < 0f) + npc.velocity.X *= deceleration; + + npc.velocity.X += num498; + if (npc.velocity.X < -num499) + npc.velocity.X = -num499; + } + } + + npc.TargetClosest(); + Vector2 vector68 = npc.Center; + float num559 = Main.player[npc.target].Center.X - vector68.X; + float num560 = Main.player[npc.target].Center.Y - vector68.Y; + float num561 = (float)Math.Sqrt(num559 * num559 + num560 * num560); + npc.rotation = (float)Math.Atan2(num560, num559) - MathHelper.PiOver2; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.localAI[0] += 1f; + if (npc.localAI[0] > (Main.masterMode ? 80f : Main.expertMode ? 140f : 200f)) + { + npc.localAI[0] = 0f; + float num562 = 8f; + + int type = ProjectileID.DeathLaser; + int damage = npc.GetProjectileDamage(type); + + // Reduce mech boss projectile damage depending on the new ore progression changes + if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + { + double firstMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Classic; + double secondMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Classic; + if (!NPC.downedMechBossAny) + damage = (int)(damage * firstMechMultiplier); + else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) + damage = (int)(damage * secondMechMultiplier); + } + + num561 = num562 / num561; + num559 *= num561; + num560 *= num561; + Vector2 laserVelocity = new Vector2(num559, num560); + Projectile.NewProjectile(npc.GetSource_FromAI(), vector68 + laserVelocity.SafeNormalize(Vector2.UnitY) * 100f, laserVelocity, type, damage, 0f, Main.myPlayer); + } + } + } + else + { + if (npc.ai[2] != 1f) + return false; + + npc.ai[3] += 1f; + if (npc.ai[3] >= (Main.masterMode ? 150f : Main.expertMode ? 175f : 200f)) + { + npc.localAI[0] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.netUpdate = true; + } + + Vector2 vector69 = npc.Center; + float num566 = Main.player[npc.target].Center.X - 350f - vector69.X; + float num567 = Main.player[npc.target].Center.Y - 20f - vector69.Y; + float num568 = (float)Math.Sqrt(num566 * num566 + num567 * num567); + num568 = (Main.masterMode ? 9f : Main.expertMode ? 8f : 7f) / num568; + num566 *= num568; + num567 *= num568; + + float num496 = 0.1f; + float num498 = 0.03f; + float deceleration = Main.masterMode ? 0.8f : Main.expertMode ? 0.85f : 0.9f; + + if (Main.expertMode) + { + num496 = Main.masterMode ? 0.14f : 0.12f; + num498 = Main.masterMode ? 0.05f : 0.04f; + } + + if (npc.velocity.X > num566) + { + if (npc.velocity.X > 0f) + npc.velocity.X *= deceleration; + + npc.velocity.X -= num496; + } + + if (npc.velocity.X < num566) + { + if (npc.velocity.X < 0f) + npc.velocity.X *= deceleration; + + npc.velocity.X += num496; + } + + if (npc.velocity.Y > num567) + { + if (npc.velocity.Y > 0f) + npc.velocity.Y *= deceleration; + + npc.velocity.Y -= num498; + } + + if (npc.velocity.Y < num567) + { + if (npc.velocity.Y < 0f) + npc.velocity.Y *= deceleration; + + npc.velocity.Y += num498; + } + + npc.TargetClosest(); + vector69 = npc.Center; + num566 = Main.player[npc.target].Center.X - vector69.X; + num567 = Main.player[npc.target].Center.Y - vector69.Y; + num568 = (float)Math.Sqrt(num566 * num566 + num567 * num567); + npc.rotation = (float)Math.Atan2(num567, num566) - MathHelper.PiOver2; + if (Main.netMode == NetmodeID.MultiplayerClient) + { + npc.localAI[0] += 1f; + if (npc.localAI[0] > (Main.masterMode ? 40f : Main.expertMode ? 60f : 80f)) + { + npc.localAI[0] = 0f; + float num569 = 10f; + + int type = ProjectileID.DeathLaser; + int damage = npc.GetProjectileDamage(type); + + // Reduce mech boss projectile damage depending on the new ore progression changes + if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + { + double firstMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Classic; + double secondMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Classic; + if (!NPC.downedMechBossAny) + damage = (int)(damage * firstMechMultiplier); + else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) + damage = (int)(damage * secondMechMultiplier); + } + + num568 = num569 / num568; + num566 *= num568; + num567 *= num568; + Vector2 laserVelocity = new Vector2(num566, num567); + Projectile.NewProjectile(npc.GetSource_FromAI(), vector69 + laserVelocity.SafeNormalize(Vector2.UnitY) * 100f, laserVelocity, type, damage, 0f, Main.myPlayer); + } + } + } + + return false; + } + + public static bool VanillaPrimeCannonAI(NPC npc, Mod mod) + { + npc.spriteDirection = -(int)npc.ai[0]; + if (!Main.npc[(int)npc.ai[1]].active || Main.npc[(int)npc.ai[1]].aiStyle != NPCAIStyleID.SkeletronPrimeHead) + { + npc.ai[2] += 10f; + if (npc.ai[2] > 50f || Main.netMode != NetmodeID.Server) + { + npc.life = -1; + npc.HitEffect(); + npc.active = false; + } + } + + npc.damage = 0; + + if (npc.ai[2] == 0f) + { + if (Main.npc[(int)npc.ai[1]].ai[1] == 3f) + npc.EncourageDespawn(10); + + if (Main.npc[(int)npc.ai[1]].ai[1] != 0f) + { + float num496 = 0.07f; + float num497 = 6f; + float num498 = 0.1f; + float num499 = 8f; + float deceleration = Main.masterMode ? 0.92f : Main.expertMode ? 0.94f : 0.96f; + + if (Main.expertMode) + { + num496 = Main.masterMode ? 0.11f : 0.09f; + num497 = Main.masterMode ? 8f : 7f; + num498 = Main.masterMode ? 0.15f : 0.12f; + num499 = Main.masterMode ? 11f : 9.5f; + } + + npc.localAI[0] += 2f; + if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y - 100f) + { + if (npc.velocity.Y > 0f) + npc.velocity.Y *= deceleration; + + npc.velocity.Y -= num496; + if (npc.velocity.Y > num497) + npc.velocity.Y = num497; + } + else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y - 100f) + { + if (npc.velocity.Y < 0f) + npc.velocity.Y *= deceleration; + + npc.velocity.Y += num496; + if (npc.velocity.Y < -num497) + npc.velocity.Y = -num497; + } + + if (npc.Center.X > Main.npc[(int)npc.ai[1]].Center.X - 120f * npc.ai[0]) + { + if (npc.velocity.X > 0f) + npc.velocity.X *= deceleration; + + npc.velocity.X -= num498; + if (npc.velocity.X > num499) + npc.velocity.X = num499; + } + + if (npc.Center.X < Main.npc[(int)npc.ai[1]].Center.X - 120f * npc.ai[0]) + { + if (npc.velocity.X < 0f) + npc.velocity.X *= deceleration; + + npc.velocity.X += num498; + if (npc.velocity.X < -num499) + npc.velocity.X = -num499; + } + } + else + { + npc.ai[3] += 1f; + if (npc.ai[3] >= (Main.masterMode ? 700f : Main.expertMode ? 900f : 1100f)) + { + npc.localAI[0] = 0f; + npc.ai[2] = 1f; + npc.ai[3] = 0f; + npc.netUpdate = true; + } + + float num496 = 0.04f; + float num497 = 3f; + float num498 = 0.2f; + float num499 = 8f; + float deceleration = Main.masterMode ? 0.92f : Main.expertMode ? 0.94f : 0.96f; + + if (Main.expertMode) + { + num496 = Main.masterMode ? 0.06f : 0.05f; + num497 = Main.masterMode ? 5f : 4f; + num498 = Main.masterMode ? 0.28f : 0.24f; + num499 = Main.masterMode ? 11f : 9.5f; + } + + if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y - 150f) + { + if (npc.velocity.Y > 0f) + npc.velocity.Y *= deceleration; + + npc.velocity.Y -= num496; + if (npc.velocity.Y > num497) + npc.velocity.Y = num497; + } + else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y - 150f) + { + if (npc.velocity.Y < 0f) + npc.velocity.Y *= deceleration; + + npc.velocity.Y += num496; + if (npc.velocity.Y < -num497) + npc.velocity.Y = -num497; + } + + if (npc.Center.X > Main.npc[(int)npc.ai[1]].Center.X + 200f) + { + if (npc.velocity.X > 0f) + npc.velocity.X *= deceleration; + + npc.velocity.X -= num498; + if (npc.velocity.X > num499) + npc.velocity.X = num499; + } + + if (npc.Center.X < Main.npc[(int)npc.ai[1]].Center.X + 160f) + { + if (npc.velocity.X < 0f) + npc.velocity.X *= deceleration; + + npc.velocity.X += num498; + if (npc.velocity.X < -num499) + npc.velocity.X = -num499; + } + } + + Vector2 vector66 = npc.Center; + float num545 = Main.npc[(int)npc.ai[1]].Center.X - 200f * npc.ai[0] - vector66.X; + float num546 = Main.npc[(int)npc.ai[1]].position.Y + 230f - vector66.Y; + float num547 = (float)Math.Sqrt(num545 * num545 + num546 * num546); + npc.rotation = (float)Math.Atan2(num546, num545) + MathHelper.PiOver2; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.localAI[0] += 1f; + if (npc.localAI[0] > (Main.masterMode ? 60f : Main.expertMode ? 100f : 140f)) + { + npc.localAI[0] = 0f; + float num548 = 12f; + int num549 = 0; + int num550 = ProjectileID.BombSkeletronPrime; + num547 = num548 / num547; + num545 = (0f - num545) * num547; + num546 = (0f - num546) * num547; + vector66.X += num545 * 4f; + vector66.Y += num546 * 4f; + Projectile.NewProjectile(npc.GetSource_FromAI(), vector66.X, vector66.Y, num545, num546, num550, num549, 0f, Main.myPlayer); + } + } + } + else + { + if (npc.ai[2] != 1f) + return false; + + npc.ai[3] += 1f; + if (npc.ai[3] >= (Main.masterMode ? 180f : Main.expertMode ? 240f : 300f)) + { + npc.localAI[0] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.netUpdate = true; + } + + Vector2 vector67 = npc.Center; + float num552 = Main.npc[(int)npc.ai[1]].Center.X - vector67.X; + float num553 = Main.npc[(int)npc.ai[1]].position.Y - vector67.Y; + num553 = Main.player[npc.target].Center.Y - 80f - vector67.Y; + float num554 = (float)Math.Sqrt(num552 * num552 + num553 * num553); + num554 = (Main.masterMode ? 8f : Main.expertMode ? 7f : 6f) / num554; + num552 *= num554; + num553 *= num554; + + float num496 = 0.04f; + float num498 = 0.08f; + float deceleration = Main.masterMode ? 0.8f : Main.expertMode ? 0.85f : 0.9f; + + if (Main.expertMode) + { + num496 = Main.masterMode ? 0.08f : 0.06f; + num498 = Main.masterMode ? 0.12f : 0.1f; + } + + if (npc.velocity.X > num552) + { + if (npc.velocity.X > 0f) + npc.velocity.X *= deceleration; + + npc.velocity.X -= num496; + } + + if (npc.velocity.X < num552) + { + if (npc.velocity.X < 0f) + npc.velocity.X *= deceleration; + + npc.velocity.X += num496; + } + + if (npc.velocity.Y > num553) + { + if (npc.velocity.Y > 0f) + npc.velocity.Y *= deceleration; + + npc.velocity.Y -= num498; + } + + if (npc.velocity.Y < num553) + { + if (npc.velocity.Y < 0f) + npc.velocity.Y *= deceleration; + + npc.velocity.Y += num498; + } + + npc.TargetClosest(); + vector67 = npc.Center; + num552 = Main.player[npc.target].Center.X - vector67.X; + num553 = Main.player[npc.target].Center.Y - vector67.Y; + num554 = (float)Math.Sqrt(num552 * num552 + num553 * num553); + npc.rotation = (float)Math.Atan2(num553, num552) - MathHelper.PiOver2; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.localAI[0] += 1f; + if (npc.localAI[0] > (Main.masterMode ? 20f : Main.expertMode ? 30f : 40f)) + { + npc.localAI[0] = 0f; + float num555 = 10f; + int num556 = 0; + int num557 = ProjectileID.BombSkeletronPrime; + num554 = num555 / num554; + num552 *= num554; + num553 *= num554; + vector67.X += num552 * 4f; + vector67.Y += num553 * 4f; + Projectile.NewProjectile(npc.GetSource_FromAI(), vector67.X, vector67.Y, num552, num553, num557, num556, 0f, Main.myPlayer); + } + } + } + + return false; + } + + public static bool VanillaPrimeViceAI(NPC npc, Mod mod) + { + npc.spriteDirection = -(int)npc.ai[0]; + Vector2 vector61 = npc.Center; + float num530 = Main.npc[(int)npc.ai[1]].Center.X - 200f * npc.ai[0] - vector61.X; + float num531 = Main.npc[(int)npc.ai[1]].position.Y + 230f - vector61.Y; + float num532 = (float)Math.Sqrt(num530 * num530 + num531 * num531); + if (npc.ai[2] != 99f) + { + if (num532 > 800f) + npc.ai[2] = 99f; + } + else if (num532 < 400f) + npc.ai[2] = 0f; + + if (!Main.npc[(int)npc.ai[1]].active || Main.npc[(int)npc.ai[1]].aiStyle != NPCAIStyleID.SkeletronPrimeHead) + { + npc.ai[2] += 10f; + if (npc.ai[2] > 50f || Main.netMode != NetmodeID.Server) + { + npc.life = -1; + npc.HitEffect(); + npc.active = false; + } + } + + // Avoid cheap bullshit + npc.damage = 0; + + if (npc.ai[2] == 99f) + { + float num496 = 0.1f; + float num497 = 8f; + float num498 = 0.5f; + float num499 = 12f; + float deceleration = Main.masterMode ? 0.92f : Main.expertMode ? 0.94f : 0.96f; + + if (Main.expertMode) + { + num496 = Main.masterMode ? 0.14f : 0.12f; + num497 = Main.masterMode ? 11f : 9.5f; + num498 = Main.masterMode ? 0.6f : 0.55f; + num499 = Main.masterMode ? 16f : 14f; + } + + if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y) + { + if (npc.velocity.Y > 0f) + npc.velocity.Y *= deceleration; + + npc.velocity.Y -= num496; + if (npc.velocity.Y > num497) + npc.velocity.Y = num497; + } + else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y) + { + if (npc.velocity.Y < 0f) + npc.velocity.Y *= deceleration; + + npc.velocity.Y += num496; + if (npc.velocity.Y < -num497) + npc.velocity.Y = -num497; + } + + if (npc.Center.X > Main.npc[(int)npc.ai[1]].Center.X) + { + if (npc.velocity.X > 0f) + npc.velocity.X *= deceleration; + + npc.velocity.X -= num498; + if (npc.velocity.X > num499) + npc.velocity.X = num499; + } + + if (npc.Center.X < Main.npc[(int)npc.ai[1]].Center.X) + { + if (npc.velocity.X < 0f) + npc.velocity.X *= deceleration; + + npc.velocity.X += num498; + if (npc.velocity.X < -num499) + npc.velocity.X = -num499; + } + } + else if (npc.ai[2] == 0f || npc.ai[2] == 3f) + { + if (Main.npc[(int)npc.ai[1]].ai[1] == 3f) + npc.EncourageDespawn(10); + + if (Main.npc[(int)npc.ai[1]].ai[1] != 0f) + { + npc.TargetClosest(); + if (Main.player[npc.target].dead) + { + npc.velocity.Y += 0.1f; + if (npc.velocity.Y > 16f) + npc.velocity.Y = 16f; + } + else + { + Vector2 vector62 = npc.Center; + float num533 = Main.player[npc.target].Center.X - vector62.X; + float num534 = Main.player[npc.target].Center.Y - vector62.Y; + float num535 = (float)Math.Sqrt(num533 * num533 + num534 * num534); + num535 = (Main.masterMode ? 16f : Main.expertMode ? 14f : 12f) / num535; + num533 *= num535; + num534 *= num535; + npc.rotation = (float)Math.Atan2(num534, num533) - MathHelper.PiOver2; + float deceleration = Main.masterMode ? 0.93f : Main.expertMode ? 0.95f : 0.97f; + if (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) < 2f) + { + npc.rotation = (float)Math.Atan2(num534, num533) - MathHelper.PiOver2; + npc.velocity.X = num533; + npc.velocity.Y = num534; + npc.netUpdate = true; + } + else + npc.velocity *= deceleration; + + npc.ai[3] += 1f; + if (npc.ai[3] >= (Main.masterMode ? 400f : Main.expertMode ? 500f : 600f)) + { + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.netUpdate = true; + } + } + } + else + { + npc.ai[3] += 1f; + if (npc.ai[3] >= (Main.masterMode ? 400f : Main.expertMode ? 500f : 600f)) + { + npc.ai[2] += 1f; + npc.ai[3] = 0f; + npc.netUpdate = true; + } + + float num496 = 0.1f; + float num497 = 3f; + float num498 = 0.2f; + float num499 = 8f; + float deceleration = Main.masterMode ? 0.92f : Main.expertMode ? 0.94f : 0.96f; + + if (Main.expertMode) + { + num496 = Main.masterMode ? 0.14f : 0.12f; + num497 = Main.masterMode ? 5f : 4f; + num498 = Main.masterMode ? 0.28f : 0.24f; + num499 = Main.masterMode ? 11f : 9.5f; + } + + if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y + 300f) + { + if (npc.velocity.Y > 0f) + npc.velocity.Y *= deceleration; + + npc.velocity.Y -= num496; + if (npc.velocity.Y > num497) + npc.velocity.Y = num497; + } + else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y + 230f) + { + if (npc.velocity.Y < 0f) + npc.velocity.Y *= deceleration; + + npc.velocity.Y += num496; + if (npc.velocity.Y < -num497) + npc.velocity.Y = -num497; + } + + if (npc.Center.X > Main.npc[(int)npc.ai[1]].Center.X + 250f) + { + if (npc.velocity.X > 0f) + npc.velocity.X *= (deceleration - 0.02f); + + npc.velocity.X -= (num498 * 1.5f); + if (npc.velocity.X > num499 + 1f) + npc.velocity.X = num499 + 1f; + } + + if (npc.Center.X < Main.npc[(int)npc.ai[1]].Center.X) + { + if (npc.velocity.X < 0f) + npc.velocity.X *= (deceleration - 0.02f); + + npc.velocity.X += num498; + if (npc.velocity.X < -num499) + npc.velocity.X = -num499; + } + } + + Vector2 vector63 = npc.Center; + float num536 = Main.npc[(int)npc.ai[1]].Center.X - 200f * npc.ai[0] - vector63.X; + float num537 = Main.npc[(int)npc.ai[1]].position.Y + 230f - vector63.Y; + float num538 = (float)Math.Sqrt(num536 * num536 + num537 * num537); + npc.rotation = (float)Math.Atan2(num537, num536) + MathHelper.PiOver2; + } + else if (npc.ai[2] == 1f) + { + float deceleration = Main.masterMode ? 0.8f : Main.expertMode ? 0.85f : 0.9f; + if (npc.velocity.Y > 0f) + npc.velocity.Y *= deceleration; + + Vector2 vector64 = npc.Center; + float num539 = Main.npc[(int)npc.ai[1]].Center.X - 280f * npc.ai[0] - vector64.X; + float num540 = Main.npc[(int)npc.ai[1]].position.Y + 230f - vector64.Y; + float num541 = (float)Math.Sqrt(num539 * num539 + num540 * num540); + npc.rotation = (float)Math.Atan2(num540, num539) + MathHelper.PiOver2; + npc.velocity.X = (npc.velocity.X * 5f + Main.npc[(int)npc.ai[1]].velocity.X) / 6f; + npc.velocity.X += 0.5f; + npc.velocity.Y -= 0.5f; + if (npc.velocity.Y < -9f) + npc.velocity.Y = -9f; + + if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y - 280f) + { + // Set damage + npc.damage = npc.defDamage; + + npc.TargetClosest(); + npc.ai[2] = 2f; + vector64 = npc.Center; + num539 = Main.player[npc.target].Center.X - vector64.X; + num540 = Main.player[npc.target].Center.Y - vector64.Y; + num541 = (float)Math.Sqrt(num539 * num539 + num540 * num540); + num541 = (Main.masterMode ? 24f : Main.expertMode ? 22f : 20f) / num541; + npc.velocity.X = num539 * num541; + npc.velocity.Y = num540 * num541; + npc.netUpdate = true; + } + } + else if (npc.ai[2] == 2f) + { + // Set damage + npc.damage = npc.defDamage; + + if (npc.position.Y > Main.player[npc.target].position.Y || npc.velocity.Y < 0f) + { + float numCharges = Main.masterMode ? 2f : Main.expertMode ? 3f : 4f; + if (npc.ai[3] >= numCharges) + { + npc.ai[2] = 3f; + npc.ai[3] = 0f; + } + else + { + npc.ai[2] = 1f; + npc.ai[3] += 1f; + } + } + } + else if (npc.ai[2] == 4f) + { + Vector2 vector65 = npc.Center; + float num542 = Main.npc[(int)npc.ai[1]].Center.X - 200f * npc.ai[0] - vector65.X; + float num543 = Main.npc[(int)npc.ai[1]].position.Y + 230f - vector65.Y; + float num544 = (float)Math.Sqrt(num542 * num542 + num543 * num543); + npc.rotation = (float)Math.Atan2(num543, num542) + MathHelper.PiOver2; + npc.velocity.Y = (npc.velocity.Y * 5f + Main.npc[(int)npc.ai[1]].velocity.Y) / 6f; + npc.velocity.X += 0.5f; + if (npc.velocity.X > 12f) + npc.velocity.X = 12f; + + if (npc.Center.X < Main.npc[(int)npc.ai[1]].Center.X - 500f || npc.Center.X > Main.npc[(int)npc.ai[1]].Center.X + 500f) + { + // Set damage + npc.damage = npc.defDamage; + + npc.TargetClosest(); + npc.ai[2] = 5f; + vector65 = npc.Center; + num542 = Main.player[npc.target].Center.X - vector65.X; + num543 = Main.player[npc.target].Center.Y - vector65.Y; + num544 = (float)Math.Sqrt(num542 * num542 + num543 * num543); + num544 = (Main.masterMode ? 20f : Main.expertMode ? 18.5f : 17f) / num544; + npc.velocity.X = num542 * num544; + npc.velocity.Y = num543 * num544; + npc.netUpdate = true; + } + } + else if (npc.ai[2] == 5f && npc.Center.X < Main.player[npc.target].Center.X - 100f) + { + // Set damage + npc.damage = npc.defDamage; + + float numCharges = Main.masterMode ? 2f : Main.expertMode ? 3f : 4f; + if (npc.ai[3] >= numCharges) + { + npc.ai[2] = 0f; + npc.ai[3] = 0f; + } + else + { + npc.ai[2] = 4f; + npc.ai[3] += 1f; + } + } + + return false; + } + + public static bool VanillaPrimeSawAI(NPC npc, Mod mod) + { + Vector2 vector56 = npc.Center; + float num515 = Main.npc[(int)npc.ai[1]].Center.X - 200f * npc.ai[0] - vector56.X; + float num516 = Main.npc[(int)npc.ai[1]].position.Y + 230f - vector56.Y; + float num517 = (float)Math.Sqrt(num515 * num515 + num516 * num516); + if (npc.ai[2] != 99f) + { + if (num517 > 800f) + npc.ai[2] = 99f; + } + else if (num517 < 400f) + npc.ai[2] = 0f; + + npc.spriteDirection = -(int)npc.ai[0]; + if (!Main.npc[(int)npc.ai[1]].active || Main.npc[(int)npc.ai[1]].aiStyle != NPCAIStyleID.SkeletronPrimeHead) + { + npc.ai[2] += 10f; + if (npc.ai[2] > 50f || Main.netMode != NetmodeID.Server) + { + npc.life = -1; + npc.HitEffect(); + npc.active = false; + } + } + + // Min saw damage + int reducedSetDamage = (int)Math.Round(npc.defDamage * 0.5); + + // Avoid cheap bullshit + npc.damage = reducedSetDamage; + + if (npc.ai[2] == 99f) + { + float num496 = 0.1f; + float num497 = 8f; + float num498 = 0.5f; + float num499 = 12f; + float deceleration = Main.masterMode ? 0.92f : Main.expertMode ? 0.94f : 0.96f; + + if (Main.expertMode) + { + num496 = Main.masterMode ? 0.14f : 0.12f; + num497 = Main.masterMode ? 11f : 9.5f; + num498 = Main.masterMode ? 0.6f : 0.55f; + num499 = Main.masterMode ? 16f : 14f; + } + + if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y) + { + if (npc.velocity.Y > 0f) + npc.velocity.Y *= deceleration; + + npc.velocity.Y -= num496; + if (npc.velocity.Y > num497) + npc.velocity.Y = num497; + } + else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y) + { + if (npc.velocity.Y < 0f) + npc.velocity.Y *= deceleration; + + npc.velocity.Y += num496; + if (npc.velocity.Y < -num497) + npc.velocity.Y = -num497; + } + + if (npc.Center.X > Main.npc[(int)npc.ai[1]].Center.X) + { + if (npc.velocity.X > 0f) + npc.velocity.X *= deceleration; + + npc.velocity.X -= num498; + if (npc.velocity.X > num499) + npc.velocity.X = num499; + } + + if (npc.Center.X < Main.npc[(int)npc.ai[1]].Center.X) + { + if (npc.velocity.X < 0f) + npc.velocity.X *= deceleration; + + npc.velocity.X += num498; + if (npc.velocity.X < -num499) + npc.velocity.X = -num499; + } + } + else if (npc.ai[2] == 0f || npc.ai[2] == 3f) + { + if (Main.npc[(int)npc.ai[1]].ai[1] == 3f) + npc.EncourageDespawn(10); + + if (Main.npc[(int)npc.ai[1]].ai[1] != 0f) + { + npc.TargetClosest(); + if (Main.player[npc.target].dead) + { + npc.velocity.Y += 0.1f; + if (npc.velocity.Y > 16f) + npc.velocity.Y = 16f; + } + else + { + Vector2 vector57 = npc.Center; + float num518 = Main.player[npc.target].Center.X - vector57.X; + float num519 = Main.player[npc.target].Center.Y - vector57.Y; + float num520 = (float)Math.Sqrt(num518 * num518 + num519 * num519); + num520 = (Main.masterMode ? 9f : Main.expertMode ? 8f : 7f) / num520; + num518 *= num520; + num519 *= num520; + npc.rotation = (float)Math.Atan2(num519, num518) - MathHelper.PiOver2; + + float deceleration = Main.masterMode ? 0.93f : Main.expertMode ? 0.95f : 0.97f; + float acceleration = Main.masterMode ? 0.07f : Main.expertMode ? 0.06f : 0.05f; + if (npc.velocity.X > num518) + { + if (npc.velocity.X > 0f) + npc.velocity.X *= deceleration; + + npc.velocity.X -= acceleration; + } + + if (npc.velocity.X < num518) + { + if (npc.velocity.X < 0f) + npc.velocity.X *= deceleration; + + npc.velocity.X += acceleration; + } + + if (npc.velocity.Y > num519) + { + if (npc.velocity.Y > 0f) + npc.velocity.Y *= deceleration; + + npc.velocity.Y -= acceleration; + } + + if (npc.velocity.Y < num519) + { + if (npc.velocity.Y < 0f) + npc.velocity.Y *= deceleration; + + npc.velocity.Y += acceleration; + } + } + + npc.ai[3] += 1f; + if (npc.ai[3] >= (Main.masterMode ? 400f : Main.expertMode ? 500f : 600f)) + { + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.netUpdate = true; + } + } + else + { + npc.ai[3] += 1f; + if (npc.ai[3] >= (Main.masterMode ? 180f : Main.expertMode ? 240f : 300f)) + { + npc.ai[2] += 1f; + npc.ai[3] = 0f; + npc.netUpdate = true; + } + + float num496 = 0.04f; + float num497 = 3f; + float num498 = 0.3f; + float num499 = 12f; + float deceleration = Main.masterMode ? 0.92f : Main.expertMode ? 0.94f : 0.96f; + + if (Main.expertMode) + { + num496 = Main.masterMode ? 0.06f : 0.05f; + num497 = Main.masterMode ? 5f : 4f; + num498 = Main.masterMode ? 0.4f : 0.35f; + num499 = Main.masterMode ? 16f : 14f; + } + + if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y + 320f) + { + if (npc.velocity.Y > 0f) + npc.velocity.Y *= deceleration; + + npc.velocity.Y -= num496; + if (npc.velocity.Y > num497) + npc.velocity.Y = num497; + } + else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y + 260f) + { + if (npc.velocity.Y < 0f) + npc.velocity.Y *= deceleration; + + npc.velocity.Y += num496; + if (npc.velocity.Y < -num497) + npc.velocity.Y = -num497; + } + + if (npc.Center.X > Main.npc[(int)npc.ai[1]].Center.X) + { + if (npc.velocity.X > 0f) + npc.velocity.X *= deceleration; + + npc.velocity.X -= num498; + if (npc.velocity.X > num499) + npc.velocity.X = num499; + } + + if (npc.Center.X < Main.npc[(int)npc.ai[1]].Center.X - 250f) + { + if (npc.velocity.X < 0f) + npc.velocity.X *= deceleration; + + npc.velocity.X += num498; + if (npc.velocity.X < -num499) + npc.velocity.X = -num499; + } + } + + Vector2 vector58 = npc.Center; + float num521 = Main.npc[(int)npc.ai[1]].Center.X - 200f * npc.ai[0] - vector58.X; + float num522 = Main.npc[(int)npc.ai[1]].position.Y + 230f - vector58.Y; + float num523 = (float)Math.Sqrt(num521 * num521 + num522 * num522); + npc.rotation = (float)Math.Atan2(num522, num521) + MathHelper.PiOver2; + } + else if (npc.ai[2] == 1f) + { + Vector2 vector59 = npc.Center; + float num524 = Main.npc[(int)npc.ai[1]].Center.X - 200f * npc.ai[0] - vector59.X; + float num525 = Main.npc[(int)npc.ai[1]].position.Y + 230f - vector59.Y; + float num526 = (float)Math.Sqrt(num524 * num524 + num525 * num525); + npc.rotation = (float)Math.Atan2(num525, num524) + MathHelper.PiOver2; + + float deceleration = Main.masterMode ? 0.85f : Main.expertMode ? 0.9f : 0.95f; + npc.velocity.X *= deceleration; + npc.velocity.Y -= 0.1f; + if (npc.velocity.Y < -8f) + npc.velocity.Y = -8f; + + if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y - 200f) + { + // Set damage + npc.damage = npc.defDamage; + + npc.TargetClosest(); + npc.ai[2] = 2f; + vector59 = npc.Center; + num524 = Main.player[npc.target].Center.X - vector59.X; + num525 = Main.player[npc.target].Center.Y - vector59.Y; + num526 = (float)Math.Sqrt(num524 * num524 + num525 * num525); + num526 = (Main.masterMode ? 26f : Main.expertMode ? 24f : 22f) / num526; + npc.velocity.X = num524 * num526; + npc.velocity.Y = num525 * num526; + npc.netUpdate = true; + } + } + else if (npc.ai[2] == 2f) + { + // Set damage + npc.damage = npc.defDamage; + + if (npc.position.Y > Main.player[npc.target].position.Y || npc.velocity.Y < 0f) + npc.ai[2] = 3f; + } + else if (npc.ai[2] == 4f) + { + // Set damage + npc.damage = npc.defDamage; + + npc.TargetClosest(); + Vector2 vector60 = npc.Center; + float num527 = Main.player[npc.target].Center.X - vector60.X; + float num528 = Main.player[npc.target].Center.Y - vector60.Y; + float num529 = (float)Math.Sqrt(num527 * num527 + num528 * num528); + num529 = (Main.masterMode ? 9f : Main.expertMode ? 8f : 7f) / num529; + num527 *= num529; + num528 *= num529; + + float deceleration = Main.masterMode ? 0.93f : Main.expertMode ? 0.95f : 0.97f; + float acceleration = Main.masterMode ? 0.07f : Main.expertMode ? 0.06f : 0.05f; + + if (npc.velocity.X > num527) + { + if (npc.velocity.X > 0f) + npc.velocity.X *= deceleration; + + npc.velocity.X -= acceleration; + } + + if (npc.velocity.X < num527) + { + if (npc.velocity.X < 0f) + npc.velocity.X *= deceleration; + + npc.velocity.X += acceleration; + } + + if (npc.velocity.Y > num528) + { + if (npc.velocity.Y > 0f) + npc.velocity.Y *= deceleration; + + npc.velocity.Y -= acceleration; + } + + if (npc.velocity.Y < num528) + { + if (npc.velocity.Y < 0f) + npc.velocity.Y *= deceleration; + + npc.velocity.Y += acceleration; + } + + npc.ai[3] += 1f; + if (npc.ai[3] >= (Main.masterMode ? 400f : Main.expertMode ? 500f : 600f)) + { + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.netUpdate = true; + } + + vector60 = npc.Center; + num527 = Main.npc[(int)npc.ai[1]].Center.X - 200f * npc.ai[0] - vector60.X; + num528 = Main.npc[(int)npc.ai[1]].position.Y + 230f - vector60.Y; + num529 = (float)Math.Sqrt(num527 * num527 + num528 * num528); + npc.rotation = (float)Math.Atan2(num528, num527) + MathHelper.PiOver2; + } + else if (npc.ai[2] == 5f && ((npc.velocity.X > 0f && npc.Center.X > Main.player[npc.target].Center.X) || (npc.velocity.X < 0f && npc.Center.X < Main.player[npc.target].Center.X))) + npc.ai[2] = 0f; + + return false; + } + } +} diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/TwinsAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/TwinsAI.cs new file mode 100644 index 0000000000..7f270bebca --- /dev/null +++ b/NPCs/VanillaNPCAIOverrides/Bosses/TwinsAI.cs @@ -0,0 +1,3297 @@ +using System; +using CalamityMod.Events; +using CalamityMod.NPCs.NormalNPCs; +using CalamityMod.Projectiles.Boss; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses +{ + public static class TwinsAI + { + public static bool BuffedRetinazerAI(NPC npc, Mod mod) + { + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + + bool bossRush = BossRushEvent.BossRushActive; + bool masterMode = Main.masterMode || bossRush; + bool death = CalamityWorld.death || bossRush; + + // Get a target + 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(); + + float enrageScale = bossRush ? 0.5f : masterMode ? 0.4f : 0f; + if (Main.IsItDay() || bossRush) + { + npc.Calamity().CurrentlyEnraged = !bossRush; + enrageScale += 1f; + } + + // Percent life remaining + float lifeRatio = npc.life / (float)npc.lifeMax; + + // Easier to send info to Spazmatism + CalamityGlobalNPC.laserEye = npc.whoAmI; + + // Check for Spazmatism + bool spazAlive = false; + if (CalamityGlobalNPC.fireEye != -1) + spazAlive = Main.npc[CalamityGlobalNPC.fireEye].active; + + // I'm not commenting this entire fucking thing, already did spaz, I'm not doing ret + float retinazerHoverXDest = npc.Center.X - Main.player[npc.target].position.X - (Main.player[npc.target].width / 2); + float retinazerHoverYDest = npc.position.Y + npc.height - 59f - Main.player[npc.target].position.Y - (Main.player[npc.target].height / 2); + + float retinazerHoverRotation = (float)Math.Atan2(retinazerHoverYDest, retinazerHoverXDest) + MathHelper.PiOver2; + if (retinazerHoverRotation < 0f) + retinazerHoverRotation += MathHelper.TwoPi; + else if (retinazerHoverRotation > MathHelper.TwoPi) + retinazerHoverRotation -= MathHelper.TwoPi; + + float retinazerRotationSpeed = 0.1f; + if (npc.rotation < retinazerHoverRotation) + { + if ((retinazerHoverRotation - npc.rotation) > MathHelper.Pi) + npc.rotation -= retinazerRotationSpeed; + else + npc.rotation += retinazerRotationSpeed; + } + else if (npc.rotation > retinazerHoverRotation) + { + if ((npc.rotation - retinazerHoverRotation) > MathHelper.Pi) + npc.rotation += retinazerRotationSpeed; + else + npc.rotation -= retinazerRotationSpeed; + } + + if (npc.rotation > retinazerHoverRotation - retinazerRotationSpeed && npc.rotation < retinazerHoverRotation + retinazerRotationSpeed) + npc.rotation = retinazerHoverRotation; + + if (npc.rotation < 0f) + npc.rotation += MathHelper.TwoPi; + else if (npc.rotation > MathHelper.TwoPi) + npc.rotation -= MathHelper.TwoPi; + + if (npc.rotation > retinazerHoverRotation - retinazerRotationSpeed && npc.rotation < retinazerHoverRotation + retinazerRotationSpeed) + npc.rotation = retinazerHoverRotation; + + if (Main.rand.NextBool(5)) + { + int retiDust = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + npc.height * 0.25f), npc.width, (int)(npc.height * 0.5f), DustID.Blood, npc.velocity.X, 2f, 0, default, 1f); + Dust dust = Main.dust[retiDust]; + dust.velocity.X *= 0.5f; + dust.velocity.Y *= 0.1f; + } + + if (Main.netMode != NetmodeID.MultiplayerClient && !Main.player[npc.target].dead && npc.timeLeft < 10) + { + for (int i = 0; i < Main.maxNPCs; i++) + { + if (i != npc.whoAmI && Main.npc[i].active && (Main.npc[i].type == NPCID.Retinazer || Main.npc[i].type == NPCID.Spazmatism) && Main.npc[i].timeLeft - 1 > npc.timeLeft) + npc.timeLeft = Main.npc[i].timeLeft - 1; + + } + } + + // Check for Oblivion in Master Mode + bool oblivionAlive = false; + if (masterMode && !bossRush && npc.localAI[3] != -1f) + { + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active && (Main.npc[i].type == ModContent.NPCType() || Main.npc[i].type == NPCID.SkeletronPrime)) + { + oblivionAlive = true; + break; + } + } + } + + // Set variable to force despawn when Prime dies in Master Rev+ + // Set to -1f if Prime isn't alive when summoned + if (npc.localAI[3] == 0f) + { + if (oblivionAlive) + npc.localAI[3] = 1f; + else + npc.localAI[3] = -1f; + + npc.SyncExtraAI(); + } + + // Phase HP ratios + float phase2LifeRatio = oblivionAlive ? 0.5f : masterMode ? 0.85f : 0.7f; + float finalPhaseLifeRatio = masterMode ? 0.4f : 0.25f; + + // Movement variables + float phase1MaxSpeedIncrease = masterMode ? 2f : 4f; + float phase1MaxAccelerationIncrease = masterMode ? 0.025f : 0.05f; + float phase1MaxChargeSpeedIncrease = masterMode ? 3f : 6f; + + // Phase duration variables + float phase1MaxLaserPhaseDurationDecrease = masterMode ? 120f : 300f; + + // If Oblivion is alive reduce aggression of all attacks + if (oblivionAlive) + { + phase1MaxSpeedIncrease = masterMode ? 1f : 2f; + phase1MaxAccelerationIncrease = masterMode ? 0.0125f : 0.025f; + phase1MaxChargeSpeedIncrease = masterMode ? 1.5f : 3f; + + phase1MaxLaserPhaseDurationDecrease = masterMode ? 60f : 150f; + } + + // Phase checks + bool phase2 = lifeRatio < phase2LifeRatio; + bool finalPhase = lifeRatio < finalPhaseLifeRatio; + + Vector2 mechQueenSpacing = Vector2.Zero; + if (NPC.IsMechQueenUp) + { + NPC nPC = Main.npc[NPC.mechQueen]; + Vector2 mechQueenCenter = nPC.GetMechQueenCenter(); + Vector2 eyePosition = new Vector2(-150f, -250f); + eyePosition *= 0.75f; + float mechdusaRotation = nPC.velocity.X * 0.025f; + mechQueenSpacing = mechQueenCenter + eyePosition; + mechQueenSpacing = mechQueenSpacing.RotatedBy(mechdusaRotation, mechQueenCenter); + } + + npc.reflectsProjectiles = false; + + // Despawn + bool oblivionWasAlive = npc.localAI[3] == 1f && !oblivionAlive; + bool oblivionFightDespawn = (oblivionAlive && lifeRatio < 0.75f) || oblivionWasAlive || (oblivionAlive && !spazAlive && lifeRatio < 0.95f); + if (Main.player[npc.target].dead || oblivionFightDespawn) + { + npc.velocity.Y -= 0.04f; + if (npc.timeLeft > 10) + { + npc.timeLeft = 10; + return false; + } + } + + else if (npc.ai[0] == 0f) + { + if (npc.ai[1] == 0f) + { + // Avoid cheap bullshit + npc.damage = 0; + + float retinazerPhase1MaxSpeed = 8.25f; + float retinazerPhase1Acceleration = 0.115f; + retinazerPhase1MaxSpeed += 4f * enrageScale; + retinazerPhase1Acceleration += 0.05f * enrageScale; + + if (death) + { + retinazerPhase1MaxSpeed += phase1MaxSpeedIncrease * ((1f - lifeRatio) / (1f - phase2LifeRatio)); + retinazerPhase1Acceleration += phase1MaxAccelerationIncrease * ((1f - lifeRatio) / (1f - phase2LifeRatio)); + } + + if (Main.getGoodWorld) + { + retinazerPhase1MaxSpeed *= 1.15f; + retinazerPhase1Acceleration *= 1.15f; + } + + int retinazerFaceDirection = 1; + if (npc.Center.X < Main.player[npc.target].position.X + Main.player[npc.target].width) + retinazerFaceDirection = -1; + + Vector2 retinazerPosition = npc.Center; + float distanceFromTarget = oblivionAlive ? 450f : 300f; + float retinazerTargetX = Main.player[npc.target].Center.X + (retinazerFaceDirection * distanceFromTarget) - retinazerPosition.X; + float retinazerTargetY = Main.player[npc.target].Center.Y - distanceFromTarget - retinazerPosition.Y; + + if (NPC.IsMechQueenUp) + { + retinazerPhase1MaxSpeed = 14f; + retinazerTargetX = mechQueenSpacing.X; + retinazerTargetY = mechQueenSpacing.Y; + retinazerTargetX -= retinazerPosition.X; + retinazerTargetY -= retinazerPosition.Y; + } + + float retinazerTargetDist = (float)Math.Sqrt(retinazerTargetX * retinazerTargetX + retinazerTargetY * retinazerTargetY); + float retinazerTargetDistCopy = retinazerTargetDist; + + if (NPC.IsMechQueenUp) + { + if (retinazerTargetDist > retinazerPhase1MaxSpeed) + { + retinazerTargetDist = retinazerPhase1MaxSpeed / retinazerTargetDist; + retinazerTargetX *= retinazerTargetDist; + retinazerTargetY *= retinazerTargetDist; + } + + npc.velocity.X = (npc.velocity.X * 59f + retinazerTargetX) / 60f; + npc.velocity.Y = (npc.velocity.Y * 59f + retinazerTargetY) / 60f; + } + else + { + retinazerTargetDist = retinazerPhase1MaxSpeed / retinazerTargetDist; + retinazerTargetX *= retinazerTargetDist; + retinazerTargetY *= retinazerTargetDist; + + if (npc.velocity.X < retinazerTargetX) + { + npc.velocity.X += retinazerPhase1Acceleration; + if (npc.velocity.X < 0f && retinazerTargetX > 0f) + npc.velocity.X += retinazerPhase1Acceleration; + } + else if (npc.velocity.X > retinazerTargetX) + { + npc.velocity.X -= retinazerPhase1Acceleration; + if (npc.velocity.X > 0f && retinazerTargetX < 0f) + npc.velocity.X -= retinazerPhase1Acceleration; + } + if (npc.velocity.Y < retinazerTargetY) + { + npc.velocity.Y += retinazerPhase1Acceleration; + if (npc.velocity.Y < 0f && retinazerTargetY > 0f) + npc.velocity.Y += retinazerPhase1Acceleration; + } + else if (npc.velocity.Y > retinazerTargetY) + { + npc.velocity.Y -= retinazerPhase1Acceleration; + if (npc.velocity.Y > 0f && retinazerTargetY < 0f) + npc.velocity.Y -= retinazerPhase1Acceleration; + } + } + + npc.ai[2] += 1f; + float phaseGateValue = (masterMode ? 300f : 450f) - (death ? phase1MaxLaserPhaseDurationDecrease * ((1f - lifeRatio) / (1f - phase2LifeRatio)) : 0f); + float laserGateValue = oblivionAlive ? 60f : 30f; + if (NPC.IsMechQueenUp) + { + phaseGateValue = 900f; + laserGateValue = ((!NPC.npcsFoundForCheckActive[NPCID.TheDestroyerBody]) ? 60f : 90f); + } + if (npc.ai[2] >= phaseGateValue) + { + npc.ai[1] = 1f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.TargetClosest(); + npc.netUpdate = true; + } + + else if (retinazerTargetDistCopy < (death ? 960f : 800f)) + { + if (!Main.player[npc.target].dead) + { + npc.ai[3] += 1f; + if (Main.getGoodWorld) + npc.ai[3] += 0.5f; + } + + if (npc.ai[3] >= laserGateValue) + { + npc.ai[3] = 0f; + retinazerPosition = npc.Center; + retinazerTargetX = Main.player[npc.target].Center.X - retinazerPosition.X; + retinazerTargetY = Main.player[npc.target].Center.Y - retinazerPosition.Y; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + float retinazerSpeed = 10.5f; + retinazerSpeed += 3f * enrageScale; + int type = ProjectileID.EyeLaser; + int damage = npc.GetProjectileDamage(type); + + // Reduce mech boss projectile damage depending on the new ore progression changes + if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + { + double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; + double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; + if (!NPC.downedMechBossAny) + damage = (int)(damage * firstMechMultiplier); + else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) + damage = (int)(damage * secondMechMultiplier); + } + + retinazerTargetDist = (float)Math.Sqrt(retinazerTargetX * retinazerTargetX + retinazerTargetY * retinazerTargetY); + retinazerTargetDist = retinazerSpeed / retinazerTargetDist; + retinazerTargetX *= retinazerTargetDist; + retinazerTargetY *= retinazerTargetDist; + + Vector2 laserVelocity = new Vector2(retinazerTargetX, retinazerTargetY); + Projectile.NewProjectile(npc.GetSource_FromAI(), retinazerPosition + laserVelocity.SafeNormalize(Vector2.UnitY) * 150f, laserVelocity, type, damage, 0f, Main.myPlayer); + } + } + } + } + + else if (npc.ai[1] == 1f) + { + // Set damage + npc.damage = npc.defDamage; + + npc.rotation = retinazerHoverRotation; + float retinazerChargeSpeed = 15f; + retinazerChargeSpeed += 10f * enrageScale; + if (death) + retinazerChargeSpeed += phase1MaxChargeSpeedIncrease * ((1f - lifeRatio) / (1f - phase2LifeRatio)); + if (Main.getGoodWorld) + retinazerChargeSpeed += 2f; + + Vector2 retinazerChargePos = npc.Center; + float retinazerChargeTargetX = Main.player[npc.target].Center.X - retinazerChargePos.X; + float retinazerChargeTargetY = Main.player[npc.target].Center.Y - retinazerChargePos.Y; + float retinazerChargeTargetDist = (float)Math.Sqrt(retinazerChargeTargetX * retinazerChargeTargetX + retinazerChargeTargetY * retinazerChargeTargetY); + retinazerChargeTargetDist = retinazerChargeSpeed / retinazerChargeTargetDist; + npc.velocity.X = retinazerChargeTargetX * retinazerChargeTargetDist; + npc.velocity.Y = retinazerChargeTargetY * retinazerChargeTargetDist; + npc.ai[1] = 2f; + } + else if (npc.ai[1] == 2f) + { + // Set damage + npc.damage = npc.defDamage; + + npc.ai[2] += 1f; + float decelerateGateValue = (masterMode ? 36f : 32f) + (death ? (masterMode ? 6f : 12f) * ((1f - lifeRatio) / (1f - phase2LifeRatio)) : 0f); + if (npc.ai[2] >= decelerateGateValue) + { + // Avoid cheap bullshit + npc.damage = 0; + + float decelerationMultiplier = (masterMode ? 0.84f : 0.92f) - (death ? (masterMode ? 0.16f : 0.32f) * ((1f - lifeRatio) / (1f - phase2LifeRatio)) : 0f); + npc.velocity *= decelerationMultiplier; + if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) + npc.velocity.X = 0f; + if (npc.velocity.Y > -0.1 && npc.velocity.Y < 0.1) + npc.velocity.Y = 0f; + } + else + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) - MathHelper.PiOver2; + + float delayBeforeChargingAgain = (masterMode ? 48f : 56f) - (death ? (masterMode ? 3f : 6f) * ((1f - lifeRatio) / (1f - phase2LifeRatio)) : 0f); + if (npc.ai[2] >= delayBeforeChargingAgain + (oblivionAlive ? 15f : 0f)) + { + npc.ai[3] += 1f; + npc.ai[2] = 0f; + npc.TargetClosest(); + npc.rotation = retinazerHoverRotation; + float totalCharges = death ? 6f : 5f; + if (npc.ai[3] >= totalCharges) + { + npc.ai[1] = 0f; + npc.ai[3] = 0f; + } + else + npc.ai[1] = 1f; + } + } + + // Enter phase 2 + if (phase2) + { + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.TargetClosest(); + npc.netUpdate = true; + } + } + + else if (npc.ai[0] == 1f || npc.ai[0] == 2f) + { + // Avoid cheap bullshit + npc.damage = 0; + + if (NPC.IsMechQueenUp) + npc.reflectsProjectiles = true; + + if (npc.ai[0] == 1f) + { + npc.ai[2] += 0.005f; + if (npc.ai[2] > 0.5) + npc.ai[2] = 0.5f; + } + else + { + npc.ai[2] -= 0.005f; + if (npc.ai[2] < 0f) + npc.ai[2] = 0f; + } + + npc.rotation += npc.ai[2]; + + npc.ai[1] += 1f; + if (masterMode && npc.ai[2] >= 0.2f) + { + if (npc.ai[1] % 10f == 0f) + { + SoundEngine.PlaySound(SoundID.Item33, npc.Center); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + bool shootLaser = npc.ai[1] % 20f == 0f; + int type = shootLaser ? ProjectileID.DeathLaser : ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + + // Reduce mech boss projectile damage depending on the new ore progression changes + if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + { + double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; + double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; + if (!NPC.downedMechBossAny) + damage = (int)(damage * firstMechMultiplier); + else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) + damage = (int)(damage * secondMechMultiplier); + } + + Vector2 projectileVelocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * (oblivionAlive ? 6f : 7f); + int numProj = shootLaser ? 6 : 2; + int spread = shootLaser ? 20 : 80; + float rotation = MathHelper.ToRadians(spread); + float offset = shootLaser ? 150f : 50f; + for (int i = 0; i < numProj; i++) + { + Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * offset, perturbedSpeed, type, damage, 0f, Main.myPlayer); + } + } + } + } + + if (npc.ai[1] == 100f) + { + npc.ai[0] += 1f; + npc.ai[1] = 0f; + if (npc.ai[0] == 3f) + { + npc.ai[2] = 0f; + } + else + { + SoundEngine.PlaySound(SoundID.NPCHit1, npc.Center); + + if (Main.netMode != NetmodeID.Server) + { + for (int i = 0; i < 2; i++) + { + Gore.NewGore(npc.GetSource_FromAI(), npc.position, new Vector2(Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f), 143, 1f); + Gore.NewGore(npc.GetSource_FromAI(), npc.position, new Vector2(Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f), 7, 1f); + Gore.NewGore(npc.GetSource_FromAI(), npc.position, new Vector2(Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f), 6, 1f); + } + } + + for (int j = 0; j < 20; j++) + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f, 0, default, 1f); + + SoundEngine.PlaySound(SoundID.ForceRoar, npc.Center); + } + } + + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f, 0, default, 1f); + + npc.velocity *= 0.98f; + if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) + npc.velocity.X = 0f; + if (npc.velocity.Y > -0.1 && npc.velocity.Y < 0.1) + npc.velocity.Y = 0f; + } + else + { + // If in phase 2 but Spaz isn't + bool spazInPhase1 = false; + if (CalamityGlobalNPC.fireEye != -1) + { + if (Main.npc[CalamityGlobalNPC.fireEye].active) + spazInPhase1 = Main.npc[CalamityGlobalNPC.fireEye].ai[0] == 1f || Main.npc[CalamityGlobalNPC.fireEye].ai[0] == 2f || Main.npc[CalamityGlobalNPC.fireEye].ai[0] == 0f; + } + + npc.chaseable = !spazInPhase1; + + int setDamage = (int)Math.Round(npc.defDamage * 1.5); + npc.defense = npc.defDefense + 10; + calamityGlobalNPC.DR = spazInPhase1 ? 0.9999f : 0.2f; + calamityGlobalNPC.unbreakableDR = spazInPhase1; + calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = spazInPhase1; + + npc.HitSound = SoundID.NPCHit4; + + if (npc.ai[1] == 0f) + { + // Avoid cheap bullshit + npc.damage = 0; + + float retinazerPhase2MaxSpeed = 9.5f + (death ? 3f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); + float retinazerPhase2Accel = 0.175f + (death ? 0.05f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); + retinazerPhase2MaxSpeed += 4.5f * enrageScale; + retinazerPhase2Accel += 0.075f * enrageScale; + + if (Main.getGoodWorld) + { + retinazerPhase2MaxSpeed *= 1.15f; + retinazerPhase2Accel *= 1.15f; + } + + Vector2 eyePosition = npc.Center; + float retinazerPhase2TargetX = Main.player[npc.target].Center.X - eyePosition.X; + float distanceFromTarget = oblivionAlive ? 480f : 420f; + float retinazerPhase2TargetY = Main.player[npc.target].Center.Y - 420f - eyePosition.Y; + + if (NPC.IsMechQueenUp) + { + retinazerPhase2MaxSpeed = 14f; + retinazerPhase2TargetX = mechQueenSpacing.X; + retinazerPhase2TargetY = mechQueenSpacing.Y; + retinazerPhase2TargetX -= eyePosition.X; + retinazerPhase2TargetY -= eyePosition.Y; + } + + float retinazerPhase2TargetDist = (float)Math.Sqrt(retinazerPhase2TargetX * retinazerPhase2TargetX + retinazerPhase2TargetY * retinazerPhase2TargetY); + + if (NPC.IsMechQueenUp) + { + if (retinazerPhase2TargetDist > retinazerPhase2MaxSpeed) + { + retinazerPhase2TargetDist = retinazerPhase2MaxSpeed / retinazerPhase2TargetDist; + retinazerPhase2TargetX *= retinazerPhase2TargetDist; + retinazerPhase2TargetY *= retinazerPhase2TargetDist; + } + + npc.velocity.X = (npc.velocity.X * 4f + retinazerPhase2TargetX) / 5f; + npc.velocity.Y = (npc.velocity.Y * 4f + retinazerPhase2TargetY) / 5f; + } + else + { + retinazerPhase2TargetDist = retinazerPhase2MaxSpeed / retinazerPhase2TargetDist; + retinazerPhase2TargetX *= retinazerPhase2TargetDist; + retinazerPhase2TargetY *= retinazerPhase2TargetDist; + + if (npc.velocity.X < retinazerPhase2TargetX) + { + npc.velocity.X += retinazerPhase2Accel; + if (npc.velocity.X < 0f && retinazerPhase2TargetX > 0f) + npc.velocity.X += retinazerPhase2Accel; + } + else if (npc.velocity.X > retinazerPhase2TargetX) + { + npc.velocity.X -= retinazerPhase2Accel; + if (npc.velocity.X > 0f && retinazerPhase2TargetX < 0f) + npc.velocity.X -= retinazerPhase2Accel; + } + if (npc.velocity.Y < retinazerPhase2TargetY) + { + npc.velocity.Y += retinazerPhase2Accel; + if (npc.velocity.Y < 0f && retinazerPhase2TargetY > 0f) + npc.velocity.Y += retinazerPhase2Accel; + } + else if (npc.velocity.Y > retinazerPhase2TargetY) + { + npc.velocity.Y -= retinazerPhase2Accel; + if (npc.velocity.Y > 0f && retinazerPhase2TargetY < 0f) + npc.velocity.Y -= retinazerPhase2Accel; + } + } + + npc.ai[2] += spazAlive ? 1f : 1.5f; + float phaseGateValue = NPC.IsMechQueenUp ? 900f : 300f - (death ? 120f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); + if (npc.ai[2] >= phaseGateValue) + { + npc.ai[1] = 1f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.TargetClosest(); + npc.netUpdate = true; + } + + eyePosition = npc.Center; + retinazerPhase2TargetX = Main.player[npc.target].Center.X - eyePosition.X; + retinazerPhase2TargetY = Main.player[npc.target].Center.Y - eyePosition.Y; + npc.rotation = (float)Math.Atan2(retinazerPhase2TargetY, retinazerPhase2TargetX) - MathHelper.PiOver2; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.localAI[1] += 1f + (death ? (phase2LifeRatio - lifeRatio) / phase2LifeRatio : 0f); + if (npc.localAI[1] >= (spazAlive ? (oblivionAlive ? 76f : 52f) : 26f)) + { + bool canHit = Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height); + if (canHit || !spazAlive || finalPhase) + { + npc.localAI[1] = 0f; + float retinazerPhase2LaserSpeed = 10f; + retinazerPhase2LaserSpeed += enrageScale; + int type = ProjectileID.DeathLaser; + int damage = npc.GetProjectileDamage(type); + + // Reduce mech boss projectile damage depending on the new ore progression changes + if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + { + double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; + double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; + if (!NPC.downedMechBossAny) + damage = (int)(damage * firstMechMultiplier); + else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) + damage = (int)(damage * secondMechMultiplier); + } + + retinazerPhase2TargetDist = (float)Math.Sqrt(retinazerPhase2TargetX * retinazerPhase2TargetX + retinazerPhase2TargetY * retinazerPhase2TargetY); + retinazerPhase2TargetDist = retinazerPhase2LaserSpeed / retinazerPhase2TargetDist; + retinazerPhase2TargetX *= retinazerPhase2TargetDist; + retinazerPhase2TargetY *= retinazerPhase2TargetDist; + + Vector2 laserVelocity = new Vector2(retinazerPhase2TargetX, retinazerPhase2TargetY); + if (canHit) + { + Projectile.NewProjectile(npc.GetSource_FromAI(), eyePosition + laserVelocity.SafeNormalize(Vector2.UnitY) * 150f, laserVelocity, type, damage, 0f, Main.myPlayer); + } + else + { + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), eyePosition + laserVelocity.SafeNormalize(Vector2.UnitY) * 150f, laserVelocity, type, damage, 0f, Main.myPlayer); + Main.projectile[proj].tileCollide = false; + Main.projectile[proj].timeLeft = 300; + } + } + } + } + } + else + { + if (npc.ai[1] == 1f) + { + // Avoid cheap bullshit + npc.damage = 0; + + int retinazerPhase2FaceDirection = 1; + if (npc.Center.X < Main.player[npc.target].position.X + Main.player[npc.target].width) + retinazerPhase2FaceDirection = -1; + + float retinazerPhase2RapidFireMaxSpeed = 9.5f + (death ? 3f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); + float retinazerPhase2RapidFireAccel = 0.25f + (death ? 0.075f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); + retinazerPhase2RapidFireMaxSpeed += 4.5f * enrageScale; + retinazerPhase2RapidFireAccel += 0.15f * enrageScale; + + if (Main.getGoodWorld) + { + retinazerPhase2RapidFireMaxSpeed *= 1.15f; + retinazerPhase2RapidFireAccel *= 1.15f; + } + + Vector2 retinazerPhase2RapidFirePos = npc.Center; + float distanceFromTarget = oblivionAlive ? 480f : 420f; + float retinazerPhase2RapidFireTargetX = Main.player[npc.target].Center.X + (retinazerPhase2FaceDirection * distanceFromTarget) - retinazerPhase2RapidFirePos.X; + float retinazerPhase2RapidFireTargetY = Main.player[npc.target].Center.Y - retinazerPhase2RapidFirePos.Y; + float retinazerPhase2RapidFireTargetDist = (float)Math.Sqrt(retinazerPhase2RapidFireTargetX * retinazerPhase2RapidFireTargetX + retinazerPhase2RapidFireTargetY * retinazerPhase2RapidFireTargetY); + retinazerPhase2RapidFireTargetDist = retinazerPhase2RapidFireMaxSpeed / retinazerPhase2RapidFireTargetDist; + retinazerPhase2RapidFireTargetX *= retinazerPhase2RapidFireTargetDist; + retinazerPhase2RapidFireTargetY *= retinazerPhase2RapidFireTargetDist; + + if (npc.velocity.X < retinazerPhase2RapidFireTargetX) + { + npc.velocity.X += retinazerPhase2RapidFireAccel; + if (npc.velocity.X < 0f && retinazerPhase2RapidFireTargetX > 0f) + npc.velocity.X += retinazerPhase2RapidFireAccel; + } + else if (npc.velocity.X > retinazerPhase2RapidFireTargetX) + { + npc.velocity.X -= retinazerPhase2RapidFireAccel; + if (npc.velocity.X > 0f && retinazerPhase2RapidFireTargetX < 0f) + npc.velocity.X -= retinazerPhase2RapidFireAccel; + } + if (npc.velocity.Y < retinazerPhase2RapidFireTargetY) + { + npc.velocity.Y += retinazerPhase2RapidFireAccel; + if (npc.velocity.Y < 0f && retinazerPhase2RapidFireTargetY > 0f) + npc.velocity.Y += retinazerPhase2RapidFireAccel; + } + else if (npc.velocity.Y > retinazerPhase2RapidFireTargetY) + { + npc.velocity.Y -= retinazerPhase2RapidFireAccel; + if (npc.velocity.Y > 0f && retinazerPhase2RapidFireTargetY < 0f) + npc.velocity.Y -= retinazerPhase2RapidFireAccel; + } + + retinazerPhase2RapidFirePos = npc.Center; + retinazerPhase2RapidFireTargetX = Main.player[npc.target].Center.X - retinazerPhase2RapidFirePos.X; + retinazerPhase2RapidFireTargetY = Main.player[npc.target].Center.Y - retinazerPhase2RapidFirePos.Y; + npc.rotation = (float)Math.Atan2(retinazerPhase2RapidFireTargetY, retinazerPhase2RapidFireTargetX) - MathHelper.PiOver2; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.localAI[1] += 1f + (death ? (phase2LifeRatio - lifeRatio) / phase2LifeRatio : 0f); + if (npc.localAI[1] > (spazAlive ? (oblivionAlive ? 30f : 20f) : 10f)) + { + bool canHit = Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height); + if (canHit || !spazAlive || finalPhase) + { + npc.localAI[1] = 0f; + int type = ProjectileID.DeathLaser; + int damage = (int)Math.Round(npc.GetProjectileDamage(type) * 0.75); + + // Reduce mech boss projectile damage depending on the new ore progression changes + if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + { + double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; + double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; + if (!NPC.downedMechBossAny) + damage = (int)(damage * firstMechMultiplier); + else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) + damage = (int)(damage * secondMechMultiplier); + } + + retinazerPhase2RapidFireTargetDist = (float)Math.Sqrt(retinazerPhase2RapidFireTargetX * retinazerPhase2RapidFireTargetX + retinazerPhase2RapidFireTargetY * retinazerPhase2RapidFireTargetY); + retinazerPhase2RapidFireTargetDist = 9f / retinazerPhase2RapidFireTargetDist; + retinazerPhase2RapidFireTargetX *= retinazerPhase2RapidFireTargetDist; + retinazerPhase2RapidFireTargetY *= retinazerPhase2RapidFireTargetDist; + + Vector2 laserVelocity = new Vector2(retinazerPhase2RapidFireTargetX, retinazerPhase2RapidFireTargetY); + if (canHit) + { + Projectile.NewProjectile(npc.GetSource_FromAI(), retinazerPhase2RapidFirePos + laserVelocity.SafeNormalize(Vector2.UnitY) * 150f, laserVelocity, type, damage, 0f, Main.myPlayer); + } + else + { + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), retinazerPhase2RapidFirePos + laserVelocity.SafeNormalize(Vector2.UnitY) * 150f, laserVelocity, type, damage, 0f, Main.myPlayer); + Main.projectile[proj].tileCollide = false; + Main.projectile[proj].timeLeft = 300; + } + } + } + } + + npc.ai[2] += spazAlive ? 1f : 1.5f; + if (npc.ai[2] >= (masterMode ? 150f : 180f) - (death ? (masterMode ? 60f : 90f) * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f)) + { + npc.ai[1] = (!spazAlive || finalPhase) ? 4f : 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.TargetClosest(); + npc.netUpdate = true; + } + } + + // Charge + else if (npc.ai[1] == 2f) + { + // Set damage + npc.damage = setDamage; + + // Set rotation and velocity + npc.rotation = retinazerHoverRotation; + float retinazerPhase3ChargeSpeed = 22f + (death ? 8f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); + retinazerPhase3ChargeSpeed += 10f * enrageScale; + + if (!spazAlive) + retinazerPhase3ChargeSpeed += 2f; + + if (Main.getGoodWorld) + retinazerPhase3ChargeSpeed += 2f; + + Vector2 retinazerPhase3ChargePos = npc.Center; + float retinazerPhase3ChargeTargetX = Main.player[npc.target].Center.X - retinazerPhase3ChargePos.X; + float retinazerPhase3ChargeTargetY = Main.player[npc.target].Center.Y - retinazerPhase3ChargePos.Y; + float retinazerPhase3ChargeTargetDist = (float)Math.Sqrt(retinazerPhase3ChargeTargetX * retinazerPhase3ChargeTargetX + retinazerPhase3ChargeTargetY * retinazerPhase3ChargeTargetY); + retinazerPhase3ChargeTargetDist = retinazerPhase3ChargeSpeed / retinazerPhase3ChargeTargetDist; + npc.velocity.X = retinazerPhase3ChargeTargetX * retinazerPhase3ChargeTargetDist; + npc.velocity.Y = retinazerPhase3ChargeTargetY * retinazerPhase3ChargeTargetDist; + npc.ai[1] = 3f; + } + + else if (npc.ai[1] == 3f) + { + // Set damage + npc.damage = setDamage; + + npc.ai[2] += 1f; + + float chargeTime = spazAlive ? 45f : 30f; + if (npc.ai[3] % 3f == 0f) + chargeTime = spazAlive ? 90f : 60f; + if (death) + chargeTime -= chargeTime * 0.25f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio); + chargeTime -= chargeTime / 5 * enrageScale; + + // Slow down + if (npc.ai[2] >= chargeTime) + { + // Avoid cheap bullshit + npc.damage = 0; + + npc.velocity *= 0.93f; + if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) + npc.velocity.X = 0f; + if (npc.velocity.Y > -0.1 && npc.velocity.Y < 0.1) + npc.velocity.Y = 0f; + } + else + { + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) - MathHelper.PiOver2; + + if (npc.ai[3] % 3f == 0f) + { + float fireRate = spazAlive ? 13f : 9f; + + if (npc.ai[2] % fireRate == 0f) + { + Vector2 retinazerPhase3ChargeLaserPos = npc.Center; + float retinazerPhase3ChargeLaserTargetX = Main.player[npc.target].Center.X - retinazerPhase3ChargeLaserPos.X; + float retinazerPhase3ChargeLaserTargetY = Main.player[npc.target].Center.Y - retinazerPhase3ChargeLaserPos.Y; + float retinazerPhase3ChargeLaserTargetDist = (float)Math.Sqrt(retinazerPhase3ChargeLaserTargetX * retinazerPhase3ChargeLaserTargetX + retinazerPhase3ChargeLaserTargetY * retinazerPhase3ChargeLaserTargetY); + + SoundEngine.PlaySound(SoundID.Item33, npc.Center); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + + // Reduce mech boss projectile damage depending on the new ore progression changes + if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + { + double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; + double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; + if (!NPC.downedMechBossAny) + damage = (int)(damage * firstMechMultiplier); + else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) + damage = (int)(damage * secondMechMultiplier); + } + + float laserDartVelocity = (death ? 9f : 6f) * (spazAlive ? 1f : 1.5f); + retinazerPhase3ChargeLaserPos = npc.Center; + retinazerPhase3ChargeLaserTargetX = Main.player[npc.target].Center.X - retinazerPhase3ChargeLaserPos.X; + retinazerPhase3ChargeLaserTargetY = Main.player[npc.target].Center.Y - retinazerPhase3ChargeLaserPos.Y; + retinazerPhase3ChargeLaserTargetDist = (float)Math.Sqrt(retinazerPhase3ChargeLaserTargetX * retinazerPhase3ChargeLaserTargetX + retinazerPhase3ChargeLaserTargetY * retinazerPhase3ChargeLaserTargetY); + retinazerPhase3ChargeLaserTargetDist = laserDartVelocity / retinazerPhase3ChargeLaserTargetDist; + retinazerPhase3ChargeLaserTargetX *= retinazerPhase3ChargeLaserTargetDist; + retinazerPhase3ChargeLaserTargetY *= retinazerPhase3ChargeLaserTargetDist; + + Vector2 laserVelocity = new Vector2(retinazerPhase3ChargeLaserTargetX, retinazerPhase3ChargeLaserTargetY); + Projectile.NewProjectile(npc.GetSource_FromAI(), retinazerPhase3ChargeLaserPos + npc.velocity.SafeNormalize(Vector2.UnitY) * 50f, laserVelocity, type, damage, 0f, Main.myPlayer); + } + } + } + } + + // Charge four times + float chargeGateValue = 30f; + chargeGateValue -= chargeGateValue / 4 * enrageScale; + if (npc.ai[2] >= chargeTime + chargeGateValue) + { + npc.ai[2] = 0f; + + float chargeIncrement = 1f; + if (masterMode && Main.rand.NextBool() && npc.ai[3] < (spazAlive ? 1f : 3f)) + { + chargeIncrement = 2f; + + // Net update due to the randomness in Master Mode + npc.netUpdate = true; + } + + npc.ai[3] += chargeIncrement; + + npc.TargetClosest(); + npc.rotation = retinazerHoverRotation; + float maxChargeAmt = spazAlive ? 2f : 4f; + if (npc.ai[3] >= maxChargeAmt) + { + npc.ai[1] = 0f; + npc.ai[3] = 0f; + } + else + npc.ai[1] = 4f; + } + } + + // Get in position for charge + else if (npc.ai[1] == 4f) + { + // Avoid cheap bullshit + npc.damage = 0; + + int chargeLineUpDist = spazAlive ? 600 : 500; + float chargeSpeed = 18f + (death ? 6f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); + float chargeAccel = 0.45f + (death ? 0.15f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); + chargeSpeed += 6f * enrageScale; + chargeAccel += 0.15f * enrageScale; + + if (spazAlive) + { + chargeSpeed *= 0.75f; + chargeAccel *= 0.75f; + } + + if (Main.getGoodWorld) + { + chargeSpeed *= 1.15f; + chargeAccel *= 1.15f; + } + + int retinazerPhase2FaceDirection = 1; + if (npc.Center.X < Main.player[npc.target].position.X + Main.player[npc.target].width) + retinazerPhase2FaceDirection = -1; + + Vector2 spazmatismRetDeadChargePos = npc.Center; + float chargeTargetX = Main.player[npc.target].Center.X + (chargeLineUpDist * retinazerPhase2FaceDirection) - spazmatismRetDeadChargePos.X; + float chargeTargetY = Main.player[npc.target].Center.Y - spazmatismRetDeadChargePos.Y; + float chargeTargetDist = (float)Math.Sqrt(chargeTargetX * chargeTargetX + chargeTargetY * chargeTargetY); + + chargeTargetDist = chargeSpeed / chargeTargetDist; + chargeTargetX *= chargeTargetDist; + chargeTargetY *= chargeTargetDist; + + if (npc.velocity.X < chargeTargetX) + { + npc.velocity.X += chargeAccel; + if (npc.velocity.X < 0f && chargeTargetX > 0f) + npc.velocity.X += chargeAccel; + } + else if (npc.velocity.X > chargeTargetX) + { + npc.velocity.X -= chargeAccel; + if (npc.velocity.X > 0f && chargeTargetX < 0f) + npc.velocity.X -= chargeAccel; + } + if (npc.velocity.Y < chargeTargetY) + { + npc.velocity.Y += chargeAccel; + if (npc.velocity.Y < 0f && chargeTargetY > 0f) + npc.velocity.Y += chargeAccel; + } + else if (npc.velocity.Y > chargeTargetY) + { + npc.velocity.Y -= chargeAccel; + if (npc.velocity.Y > 0f && chargeTargetY < 0f) + npc.velocity.Y -= chargeAccel; + } + + // Take 1.25 or 1 second to get in position, then charge + npc.ai[2] += 1f; + if (npc.ai[2] >= (spazAlive ? 75f : 60f) - (death ? 20f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f)) + { + npc.TargetClosest(); + npc.ai[1] = 2f; + npc.ai[2] = 0f; + npc.netUpdate = true; + } + } + } + } + + return false; + } + + public static bool BuffedSpazmatismAI(NPC npc, Mod mod) + { + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + + bool bossRush = BossRushEvent.BossRushActive; + bool masterMode = Main.masterMode || bossRush; + bool death = CalamityWorld.death || bossRush; + + // Get a target + 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(); + + float enrageScale = bossRush ? 0.5f : masterMode ? 0.4f : 0f; + if (Main.IsItDay() || bossRush) + { + npc.Calamity().CurrentlyEnraged = !bossRush; + enrageScale += 1f; + } + + // Percent life remaining + float lifeRatio = npc.life / (float)npc.lifeMax; + + // Easier to send info to Retinazer + CalamityGlobalNPC.fireEye = npc.whoAmI; + + // Check for Retinazer + bool retAlive = false; + if (CalamityGlobalNPC.laserEye != -1) + retAlive = Main.npc[CalamityGlobalNPC.laserEye].active; + + // Rotation + Vector2 npcCenter = new Vector2(npc.Center.X, npc.position.Y + npc.height - 59f); + Vector2 lookAt = new Vector2(Main.player[npc.target].position.X - (Main.player[npc.target].width / 2), Main.player[npc.target].position.Y - (Main.player[npc.target].height / 2)); + Vector2 rotationVector = npcCenter - lookAt; + + float spazmatismRotation = (float)Math.Atan2(rotationVector.Y, rotationVector.X) + MathHelper.PiOver2; + if (spazmatismRotation < 0f) + spazmatismRotation += MathHelper.TwoPi; + else if (spazmatismRotation > MathHelper.TwoPi) + spazmatismRotation -= MathHelper.TwoPi; + + float spazmatismRotateSpeed = 0.15f; + if (NPC.IsMechQueenUp && npc.ai[0] == 3f && npc.ai[1] == 0f) + spazmatismRotateSpeed *= 0.25f; + + if (npc.rotation < spazmatismRotation) + { + if ((spazmatismRotation - npc.rotation) > MathHelper.Pi) + npc.rotation -= spazmatismRotateSpeed; + else + npc.rotation += spazmatismRotateSpeed; + } + else if (npc.rotation > spazmatismRotation) + { + if ((npc.rotation - spazmatismRotation) > MathHelper.Pi) + npc.rotation += spazmatismRotateSpeed; + else + npc.rotation -= spazmatismRotateSpeed; + } + + if (npc.rotation > spazmatismRotation - spazmatismRotateSpeed && npc.rotation < spazmatismRotation + spazmatismRotateSpeed) + npc.rotation = spazmatismRotation; + + if (npc.rotation < 0f) + npc.rotation += MathHelper.TwoPi; + else if (npc.rotation > MathHelper.TwoPi) + npc.rotation -= MathHelper.TwoPi; + + if (npc.rotation > spazmatismRotation - spazmatismRotateSpeed && npc.rotation < spazmatismRotation + spazmatismRotateSpeed) + npc.rotation = spazmatismRotation; + + // Dust + if (Main.rand.NextBool(5)) + { + int spazDust = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + npc.height * 0.25f), npc.width, (int)(npc.height * 0.5f), DustID.Blood, npc.velocity.X, 2f, 0, default, 1f); + Dust dust = Main.dust[spazDust]; + dust.velocity.X *= 0.5f; + dust.velocity.Y *= 0.1f; + } + + // Despawn Twins at the same time + if (Main.netMode != NetmodeID.MultiplayerClient && !Main.player[npc.target].dead && npc.timeLeft < 10) + { + for (int i = 0; i < Main.maxNPCs; i++) + { + if (i != npc.whoAmI && Main.npc[i].active && (Main.npc[i].type == NPCID.Retinazer || Main.npc[i].type == NPCID.Spazmatism) && Main.npc[i].timeLeft - 1 > npc.timeLeft) + npc.timeLeft = Main.npc[i].timeLeft - 1; + + } + } + + // Check for Oblivion in Master Mode + bool oblivionAlive = false; + if (masterMode && !bossRush && npc.localAI[3] != -1f) + { + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active && (Main.npc[i].type == ModContent.NPCType() || Main.npc[i].type == NPCID.SkeletronPrime)) + { + oblivionAlive = true; + break; + } + } + } + + // Set variable to force despawn when Prime dies in Master Rev+ + // Set to -1f if Prime isn't alive when summoned + if (npc.localAI[3] == 0f) + { + if (oblivionAlive) + npc.localAI[3] = 1f; + else + npc.localAI[3] = -1f; + + npc.SyncExtraAI(); + } + + // Phase HP ratios + float phase2LifeRatio = oblivionAlive ? 0.5f : masterMode ? 0.85f : 0.7f; + float finalPhaseLifeRatio = masterMode ? 0.4f : 0.25f; + + // Movement variables + float phase1MaxSpeedIncrease = masterMode ? 2.25f : 4.5f; + float phase1MaxAccelerationIncrease = masterMode ? 0.075f : 0.15f; + float phase1MaxChargeSpeedIncrease = masterMode ? 3f : 6f; + + // Phase duration variables + float phase1MaxCursedFlamePhaseDurationDecrease = masterMode ? 80f : 200f; + float phase1MaxChargesDecrease = masterMode ? 2f : 4f; + + // If Oblivion is alive reduce aggression of all attacks + if (oblivionAlive) + { + phase1MaxSpeedIncrease = masterMode ? 1.125f : 2.25f; + phase1MaxAccelerationIncrease = masterMode ? 0.0375f : 0.075f; + phase1MaxChargeSpeedIncrease = masterMode ? 1.5f : 3f; + + phase1MaxCursedFlamePhaseDurationDecrease = masterMode ? 40f : 100f; + phase1MaxChargesDecrease = masterMode ? 1f : 2f; + } + + // Phase checks + bool phase2 = lifeRatio < phase2LifeRatio; + bool finalPhase = lifeRatio < finalPhaseLifeRatio; + + Vector2 mechQueenSpacing = Vector2.Zero; + if (NPC.IsMechQueenUp) + { + NPC nPC2 = Main.npc[NPC.mechQueen]; + Vector2 mechQueenCenter2 = nPC2.GetMechQueenCenter(); + Vector2 mechdusaSpacingVector = new Vector2(150f, -250f); + mechdusaSpacingVector *= 0.75f; + float mechdusaSpacingVel = nPC2.velocity.X * 0.025f; + mechQueenSpacing = mechQueenCenter2 + mechdusaSpacingVector; + mechQueenSpacing = mechQueenSpacing.RotatedBy(mechdusaSpacingVel, mechQueenCenter2); + } + + npc.reflectsProjectiles = false; + + // Despawn + bool oblivionWasAlive = npc.localAI[3] == 1f && !oblivionAlive; + bool oblivionFightDespawn = (oblivionAlive && lifeRatio < 0.75f) || oblivionWasAlive || (oblivionAlive && !retAlive && lifeRatio < 0.95f); + if (Main.player[npc.target].dead || oblivionFightDespawn) + { + npc.velocity.Y -= 0.04f; + if (npc.timeLeft > 10) + { + npc.timeLeft = 10; + return false; + } + } + + // Phase 1 + else if (npc.ai[0] == 0f) + { + // Cursed fireball phase + if (npc.ai[1] == 0f) + { + // Avoid cheap bullshit + npc.damage = 0; + + // Velocity + float spazmatismFireballMaxSpeed = 12f; + float spazmatismFireballAccel = 0.4f; + spazmatismFireballMaxSpeed += 6f * enrageScale; + spazmatismFireballAccel += 0.2f * enrageScale; + + if (death) + { + spazmatismFireballMaxSpeed += phase1MaxSpeedIncrease * ((1f - lifeRatio) / (1f - phase2LifeRatio)); + spazmatismFireballAccel += phase1MaxAccelerationIncrease * ((1f - lifeRatio) / (1f - phase2LifeRatio)); + } + + if (Main.getGoodWorld) + { + spazmatismFireballMaxSpeed *= 1.15f; + spazmatismFireballAccel *= 1.15f; + } + + int spazmatismFireballFaceDirection = 1; + if (npc.Center.X < Main.player[npc.target].position.X + Main.player[npc.target].width) + spazmatismFireballFaceDirection = -1; + + Vector2 spazmatismFireballPos = npc.Center; + float distanceFromTarget = oblivionAlive ? 480f : 400f; + float spazmatismFireballTargetX = Main.player[npc.target].Center.X + (spazmatismFireballFaceDirection * distanceFromTarget) - spazmatismFireballPos.X; + float spazmatismFireballTargetY = Main.player[npc.target].Center.Y - spazmatismFireballPos.Y; + if (NPC.IsMechQueenUp) + { + spazmatismFireballMaxSpeed = 14f; + spazmatismFireballTargetX = mechQueenSpacing.X; + spazmatismFireballTargetY = mechQueenSpacing.Y; + spazmatismFireballTargetX -= spazmatismFireballPos.X; + spazmatismFireballTargetY -= spazmatismFireballPos.Y; + } + + float spazmatismFireballTargetDist = (float)Math.Sqrt(spazmatismFireballTargetX * spazmatismFireballTargetX + spazmatismFireballTargetY * spazmatismFireballTargetY); + + if (NPC.IsMechQueenUp) + { + if (spazmatismFireballTargetDist > spazmatismFireballMaxSpeed) + { + spazmatismFireballTargetDist = spazmatismFireballMaxSpeed / spazmatismFireballTargetDist; + spazmatismFireballTargetX *= spazmatismFireballTargetDist; + spazmatismFireballTargetY *= spazmatismFireballTargetDist; + } + + npc.velocity.X = (npc.velocity.X * 4f + spazmatismFireballTargetX) / 5f; + npc.velocity.Y = (npc.velocity.Y * 4f + spazmatismFireballTargetY) / 5f; + } + else + { + spazmatismFireballTargetDist = spazmatismFireballMaxSpeed / spazmatismFireballTargetDist; + spazmatismFireballTargetX *= spazmatismFireballTargetDist; + spazmatismFireballTargetY *= spazmatismFireballTargetDist; + + if (npc.velocity.X < spazmatismFireballTargetX) + { + npc.velocity.X += spazmatismFireballAccel; + if (npc.velocity.X < 0f && spazmatismFireballTargetX > 0f) + npc.velocity.X += spazmatismFireballAccel; + } + else if (npc.velocity.X > spazmatismFireballTargetX) + { + npc.velocity.X -= spazmatismFireballAccel; + if (npc.velocity.X > 0f && spazmatismFireballTargetX < 0f) + npc.velocity.X -= spazmatismFireballAccel; + } + if (npc.velocity.Y < spazmatismFireballTargetY) + { + npc.velocity.Y += spazmatismFireballAccel; + if (npc.velocity.Y < 0f && spazmatismFireballTargetY > 0f) + npc.velocity.Y += spazmatismFireballAccel; + } + else if (npc.velocity.Y > spazmatismFireballTargetY) + { + npc.velocity.Y -= spazmatismFireballAccel; + if (npc.velocity.Y > 0f && spazmatismFireballTargetY < 0f) + npc.velocity.Y -= spazmatismFireballAccel; + } + } + + // Fire cursed flames for 5 seconds + npc.ai[2] += 1f; + float phaseGateValue = NPC.IsMechQueenUp ? 900f : 300f - (death ? phase1MaxCursedFlamePhaseDurationDecrease * ((1f - lifeRatio) / (1f - phase2LifeRatio)) : 0f); + if (npc.ai[2] >= phaseGateValue) + { + // Reset AI array and go to charging phase + npc.ai[1] = 1f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.TargetClosest(); + npc.netUpdate = true; + } + else + { + // Fire cursed flame every half second + if (!Main.player[npc.target].dead) + { + npc.ai[3] += 1f; + if (Main.getGoodWorld) + npc.ai[3] += 0.4f; + } + + if (npc.ai[3] >= (oblivionAlive ? 60f : 30f)) + { + npc.ai[3] = 0f; + spazmatismFireballPos = npc.Center; + spazmatismFireballTargetX = Main.player[npc.target].Center.X - spazmatismFireballPos.X; + spazmatismFireballTargetY = Main.player[npc.target].Center.Y - spazmatismFireballPos.Y; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + float cursedFireballSpeed = 15f; + cursedFireballSpeed += 3f * enrageScale; + int type = ProjectileID.CursedFlameHostile; + int damage = npc.GetProjectileDamage(type); + + // Reduce mech boss projectile damage depending on the new ore progression changes + if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + { + double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; + double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; + if (!NPC.downedMechBossAny) + damage = (int)(damage * firstMechMultiplier); + else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) + damage = (int)(damage * secondMechMultiplier); + } + + spazmatismFireballTargetDist = (float)Math.Sqrt(spazmatismFireballTargetX * spazmatismFireballTargetX + spazmatismFireballTargetY * spazmatismFireballTargetY); + spazmatismFireballTargetDist = cursedFireballSpeed / spazmatismFireballTargetDist; + spazmatismFireballTargetX *= spazmatismFireballTargetDist; + spazmatismFireballTargetY *= spazmatismFireballTargetDist; + spazmatismFireballTargetX += Main.rand.Next(-10, 11) * 0.05f; + spazmatismFireballTargetY += Main.rand.Next(-10, 11) * 0.05f; + + Vector2 fireballVelocity = new Vector2(spazmatismFireballTargetX, spazmatismFireballTargetY); + Projectile.NewProjectile(npc.GetSource_FromAI(), spazmatismFireballPos + fireballVelocity.SafeNormalize(Vector2.UnitY) * 50f, fireballVelocity, type, damage, 0f, Main.myPlayer); + } + } + } + } + + // Charging phase + else if (npc.ai[1] == 1f) + { + // Set damage + npc.damage = npc.defDamage; + + // Rotation and velocity + npc.rotation = spazmatismRotation; + float spazmatismPhase1ChargeSpeed = 18f; + spazmatismPhase1ChargeSpeed += 8f * enrageScale; + if (death) + spazmatismPhase1ChargeSpeed += phase1MaxChargeSpeedIncrease * ((1f - lifeRatio) / (1f - phase2LifeRatio)); + if (Main.getGoodWorld) + spazmatismPhase1ChargeSpeed *= 1.2f; + + Vector2 spazmatismPhase1ChargePos = npc.Center; + float spazmatismPhase1ChargeTargetX = Main.player[npc.target].Center.X - spazmatismPhase1ChargePos.X; + float spazmatismPhase1ChargeTargetY = Main.player[npc.target].Center.Y - spazmatismPhase1ChargePos.Y; + float spazmatismPhase1ChargeTargetDist = (float)Math.Sqrt(spazmatismPhase1ChargeTargetX * spazmatismPhase1ChargeTargetX + spazmatismPhase1ChargeTargetY * spazmatismPhase1ChargeTargetY); + spazmatismPhase1ChargeTargetDist = spazmatismPhase1ChargeSpeed / spazmatismPhase1ChargeTargetDist; + npc.velocity.X = spazmatismPhase1ChargeTargetX * spazmatismPhase1ChargeTargetDist; + npc.velocity.Y = spazmatismPhase1ChargeTargetY * spazmatismPhase1ChargeTargetDist; + npc.ai[1] = 2f; + } + else if (npc.ai[1] == 2f) + { + // Set damage + npc.damage = npc.defDamage; + + npc.ai[2] += 1f; + + float timeBeforeSlowDown = masterMode ? 30f : 10f; + if (npc.ai[2] >= timeBeforeSlowDown) + { + // Avoid cheap bullshit + npc.damage = 0; + + // Slow down + npc.velocity *= 0.8f; + + if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) + npc.velocity.X = 0f; + if (npc.velocity.Y > -0.1 && npc.velocity.Y < 0.1) + npc.velocity.Y = 0f; + } + else + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) - MathHelper.PiOver2; + + // Charge 8 times + float chargeTime = masterMode ? 45f : 25f; + if (npc.ai[2] >= chargeTime + (oblivionAlive ? 15f : 0f)) + { + // Reset AI array and go to cursed fireball phase + npc.ai[3] += 1f; + npc.ai[2] = 0f; + npc.TargetClosest(); + npc.rotation = spazmatismRotation; + float totalCharges = 8f; + if (death) + totalCharges -= (float)Math.Round(phase1MaxChargesDecrease * ((1f - lifeRatio) / (1f - phase2LifeRatio))); + + if (npc.ai[3] >= totalCharges) + { + npc.ai[1] = 0f; + npc.ai[3] = 0f; + } + else + npc.ai[1] = 1f; + } + } + + // Enter phase 2 + if (phase2) + { + // Reset AI array and go to transition phase + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.TargetClosest(); + npc.netUpdate = true; + } + } + + // Transition phase + else if (npc.ai[0] == 1f || npc.ai[0] == 2f) + { + // Avoid cheap bullshit + npc.damage = 0; + + if (NPC.IsMechQueenUp) + npc.reflectsProjectiles = true; + + // AI timer for rotation + if (npc.ai[0] == 1f) + { + npc.ai[2] += 0.005f; + if (npc.ai[2] > 0.5) + npc.ai[2] = 0.5f; + } + else + { + npc.ai[2] -= 0.005f; + if (npc.ai[2] < 0f) + npc.ai[2] = 0f; + } + + // Spin around like a moron while flinging blood and gore everywhere + npc.rotation += npc.ai[2]; + + npc.ai[1] += 1f; + if (masterMode && npc.ai[2] >= 0.2f) + { + if (npc.ai[1] % 10f == 0f) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int type = npc.ai[1] % 20f == 0f ? ProjectileID.CursedFlameHostile : ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + + // Reduce mech boss projectile damage depending on the new ore progression changes + if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + { + double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; + double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; + if (!NPC.downedMechBossAny) + damage = (int)(damage * firstMechMultiplier); + else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) + damage = (int)(damage * secondMechMultiplier); + } + + Vector2 projectileVelocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * (oblivionAlive ? 12f : 16f) + Main.rand.NextVector2CircularEdge(3f, 3f); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + projectileVelocity.SafeNormalize(Vector2.UnitY) * 50f, projectileVelocity, type, damage, 0f, Main.myPlayer, 0f, 1f); + Main.projectile[proj].tileCollide = false; + } + } + } + + if (npc.ai[1] == 100f) + { + npc.ai[0] += 1f; + npc.ai[1] = 0f; + + if (npc.ai[0] == 3f) + { + npc.ai[2] = 0f; + } + else + { + SoundEngine.PlaySound(SoundID.NPCHit1, npc.Center); + + if (Main.netMode != NetmodeID.Server) + { + for (int i = 0; i < 2; i++) + { + Gore.NewGore(npc.GetSource_FromAI(), npc.position, new Vector2(Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f), 144, 1f); + Gore.NewGore(npc.GetSource_FromAI(), npc.position, new Vector2(Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f), 7, 1f); + Gore.NewGore(npc.GetSource_FromAI(), npc.position, new Vector2(Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f), 6, 1f); + } + } + + for (int j = 0; j < 20; j++) + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f, 0, default, 1f); + + SoundEngine.PlaySound(SoundID.ForceRoar, npc.Center); + } + } + + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f, 0, default, 1f); + + npc.velocity *= 0.98f; + if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) + npc.velocity.X = 0f; + if (npc.velocity.Y > -0.1 && npc.velocity.Y < 0.1) + npc.velocity.Y = 0f; + } + + // Phase 2 + else + { + // If in phase 2 but Ret isn't + bool retInPhase1 = false; + if (CalamityGlobalNPC.laserEye != -1) + { + if (Main.npc[CalamityGlobalNPC.laserEye].active) + retInPhase1 = Main.npc[CalamityGlobalNPC.laserEye].ai[0] == 1f || Main.npc[CalamityGlobalNPC.laserEye].ai[0] == 2f || Main.npc[CalamityGlobalNPC.laserEye].ai[0] == 0f; + } + + npc.chaseable = !retInPhase1; + + // Increase defense and damage + int setDamage = (int)Math.Round(npc.defDamage * 1.5); + int reducedSetDamage = (int)Math.Round(setDamage * 0.5); + npc.defense = npc.defDefense + 18; + calamityGlobalNPC.DR = retInPhase1 ? 0.9999f : 0.2f; + calamityGlobalNPC.unbreakableDR = retInPhase1; + calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = retInPhase1; + + // Change hit sound to metal + npc.HitSound = SoundID.NPCHit4; + + // Shadowflamethrower phase + if (npc.ai[1] == 0f) + { + // Avoid cheap bullshit + npc.damage = reducedSetDamage; + + float spazmatismFlamethrowerMaxSpeed = 6.2f + (death ? 2f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); + float spazmatismFlamethrowerAccel = 0.1f + (death ? 0.03f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); + spazmatismFlamethrowerMaxSpeed += 3f * enrageScale; + spazmatismFlamethrowerAccel += 0.06f * enrageScale; + + int spazmatismFlamethrowerFaceDirection = 1; + if (npc.Center.X < Main.player[npc.target].position.X + Main.player[npc.target].width) + spazmatismFlamethrowerFaceDirection = -1; + + Vector2 spazmatismFlamethrowerPos = npc.Center; + int flamethrowerDistance = 180; + float spazmatismFlamethrowerTargetX = Main.player[npc.target].Center.X + (spazmatismFlamethrowerFaceDirection * flamethrowerDistance) - spazmatismFlamethrowerPos.X; + float spazmatismFlamethrowerTargetY = Main.player[npc.target].Center.Y - spazmatismFlamethrowerPos.Y; + float spazmatismFlamethrowerTargetDist = (float)Math.Sqrt(spazmatismFlamethrowerTargetX * spazmatismFlamethrowerTargetX + spazmatismFlamethrowerTargetY * spazmatismFlamethrowerTargetY); + + if (!NPC.IsMechQueenUp) + { + // Boost speed if too far from target + if (spazmatismFlamethrowerTargetDist > flamethrowerDistance) + spazmatismFlamethrowerMaxSpeed += MathHelper.Lerp(0f, oblivionAlive ? 3f : masterMode ? 8f : 6f, MathHelper.Clamp((spazmatismFlamethrowerTargetDist - flamethrowerDistance) / 1000f, 0f, 1f)); + + if (Main.getGoodWorld) + { + spazmatismFlamethrowerMaxSpeed *= 1.15f; + spazmatismFlamethrowerAccel *= 1.15f; + } + + spazmatismFlamethrowerTargetDist = spazmatismFlamethrowerMaxSpeed / spazmatismFlamethrowerTargetDist; + spazmatismFlamethrowerTargetX *= spazmatismFlamethrowerTargetDist; + spazmatismFlamethrowerTargetY *= spazmatismFlamethrowerTargetDist; + + if (npc.velocity.X < spazmatismFlamethrowerTargetX) + { + npc.velocity.X += spazmatismFlamethrowerAccel; + if (npc.velocity.X < 0f && spazmatismFlamethrowerTargetX > 0f) + npc.velocity.X += spazmatismFlamethrowerAccel; + } + else if (npc.velocity.X > spazmatismFlamethrowerTargetX) + { + npc.velocity.X -= spazmatismFlamethrowerAccel; + if (npc.velocity.X > 0f && spazmatismFlamethrowerTargetX < 0f) + npc.velocity.X -= spazmatismFlamethrowerAccel; + } + if (npc.velocity.Y < spazmatismFlamethrowerTargetY) + { + npc.velocity.Y += spazmatismFlamethrowerAccel; + if (npc.velocity.Y < 0f && spazmatismFlamethrowerTargetY > 0f) + npc.velocity.Y += spazmatismFlamethrowerAccel; + } + else if (npc.velocity.Y > spazmatismFlamethrowerTargetY) + { + npc.velocity.Y -= spazmatismFlamethrowerAccel; + if (npc.velocity.Y > 0f && spazmatismFlamethrowerTargetY < 0f) + npc.velocity.Y -= spazmatismFlamethrowerAccel; + } + } + + // Fire flamethrower for x seconds + npc.ai[2] += retAlive ? 1f : 2f; + float phaseGateValue = NPC.IsMechQueenUp ? 900f : 180f - (death ? 60f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); + if (npc.ai[2] >= phaseGateValue) + { + npc.ai[1] = (!retAlive || finalPhase) ? 5f : 1f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.TargetClosest(); + npc.netUpdate = true; + } + + // Fire fireballs and flamethrower + bool canHit = Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height); + if (canHit || !retAlive || finalPhase) + { + // Play flame sound on timer + npc.localAI[2] += 1f; + if (npc.localAI[2] > 22f) + { + npc.localAI[2] = 0f; + SoundEngine.PlaySound(SoundID.Item34, npc.Center); + } + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.localAI[1] += 1f; + if (npc.localAI[1] > 2f) + { + npc.ai[3] += 1f; + npc.localAI[1] = 0f; + + float spazmatismShadowFireballSpeed = 6f; + spazmatismShadowFireballSpeed += 3f * enrageScale; + float timeForFlamethrowerToReachMaxVelocity = 60f; + float flamethrowerSpeedScalar = MathHelper.Clamp(npc.ai[2] / timeForFlamethrowerToReachMaxVelocity, 0f, 1f); + spazmatismShadowFireballSpeed = MathHelper.Lerp(0.1f, spazmatismShadowFireballSpeed, flamethrowerSpeedScalar); + int type = npc.ai[3] % 2f == 0f ? ProjectileID.EyeFire : ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + + // Reduce mech boss projectile damage depending on the new ore progression changes + if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + { + double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; + double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; + if (!NPC.downedMechBossAny) + damage = (int)(damage * firstMechMultiplier); + else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) + damage = (int)(damage * secondMechMultiplier); + } + + spazmatismFlamethrowerPos = npc.Center; + spazmatismFlamethrowerTargetX = Main.player[npc.target].Center.X - spazmatismFlamethrowerPos.X; + spazmatismFlamethrowerTargetY = Main.player[npc.target].Center.Y - spazmatismFlamethrowerPos.Y; + spazmatismFlamethrowerTargetDist = (float)Math.Sqrt(spazmatismFlamethrowerTargetX * spazmatismFlamethrowerTargetX + spazmatismFlamethrowerTargetY * spazmatismFlamethrowerTargetY); + spazmatismFlamethrowerTargetDist = spazmatismShadowFireballSpeed / spazmatismFlamethrowerTargetDist; + spazmatismFlamethrowerTargetX *= spazmatismFlamethrowerTargetDist; + spazmatismFlamethrowerTargetY *= spazmatismFlamethrowerTargetDist; + spazmatismFlamethrowerTargetY += Main.rand.Next(-10, 11) * 0.01f; + spazmatismFlamethrowerTargetX += Main.rand.Next(-10, 11) * 0.01f; + spazmatismFlamethrowerTargetY += npc.velocity.Y * 0.5f; + spazmatismFlamethrowerTargetX += npc.velocity.X * 0.5f; + + if (NPC.IsMechQueenUp) + { + Vector2 mechdusaSpazShadowFireballPos = (npc.rotation + (float)Math.PI / 2f).ToRotationVector2() * spazmatismShadowFireballSpeed + npc.velocity * 0.5f; + spazmatismFlamethrowerTargetX = mechdusaSpazShadowFireballPos.X; + spazmatismFlamethrowerTargetY = mechdusaSpazShadowFireballPos.Y; + spazmatismFlamethrowerPos = npc.Center - mechdusaSpazShadowFireballPos * 3f; + } + + Vector2 flamethrowerVelocity = new Vector2(spazmatismFlamethrowerTargetX, spazmatismFlamethrowerTargetY); + if (canHit) + { + Projectile.NewProjectile(npc.GetSource_FromAI(), spazmatismFlamethrowerPos + flamethrowerVelocity.SafeNormalize(Vector2.UnitY) * 25f, flamethrowerVelocity, type, damage, 0f, Main.myPlayer); + if (masterMode && npc.ai[3] % 30f == 0f) + { + type = npc.ai[3] % 60f == 0f ? ModContent.ProjectileType() : ProjectileID.CursedFlameHostile; + damage = npc.GetProjectileDamage(type); + Projectile.NewProjectile(npc.GetSource_FromAI(), spazmatismFlamethrowerPos + flamethrowerVelocity.SafeNormalize(Vector2.UnitY) * 25f, flamethrowerVelocity * 2f, type, damage, 0f, Main.myPlayer); + } + } + else + { + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), spazmatismFlamethrowerPos + flamethrowerVelocity.SafeNormalize(Vector2.UnitY) * 25f, flamethrowerVelocity, type, damage, 0f, Main.myPlayer); + Main.projectile[proj].tileCollide = false; + } + } + } + } + + if (NPC.IsMechQueenUp) + { + spazmatismFlamethrowerMaxSpeed = 14f; + spazmatismFlamethrowerTargetX = Main.player[npc.target].Center.X - spazmatismFlamethrowerPos.X; + spazmatismFlamethrowerTargetY = Main.player[npc.target].Center.Y - 300f - spazmatismFlamethrowerPos.Y; + spazmatismFlamethrowerTargetX = mechQueenSpacing.X; + spazmatismFlamethrowerTargetY = mechQueenSpacing.Y; + spazmatismFlamethrowerTargetX -= spazmatismFlamethrowerPos.X; + spazmatismFlamethrowerTargetY -= spazmatismFlamethrowerPos.Y; + spazmatismFlamethrowerTargetDist = (float)Math.Sqrt(spazmatismFlamethrowerTargetX * spazmatismFlamethrowerTargetX + spazmatismFlamethrowerTargetY * spazmatismFlamethrowerTargetY); + if (spazmatismFlamethrowerTargetDist > spazmatismFlamethrowerMaxSpeed) + { + spazmatismFlamethrowerTargetDist = spazmatismFlamethrowerMaxSpeed / spazmatismFlamethrowerTargetDist; + spazmatismFlamethrowerTargetX *= spazmatismFlamethrowerTargetDist; + spazmatismFlamethrowerTargetY *= spazmatismFlamethrowerTargetDist; + } + + npc.velocity.X = (npc.velocity.X * 59f + spazmatismFlamethrowerTargetX) / 60f; + npc.velocity.Y = (npc.velocity.Y * 59f + spazmatismFlamethrowerTargetY) / 60f; + } + } + + // Charging phase + else + { + // Charge + if (npc.ai[1] == 1f) + { + // Set damage + npc.damage = setDamage; + + // Play charge sound + SoundEngine.PlaySound(SoundID.ForceRoar, npc.Center); + + // Set rotation and velocity + npc.rotation = spazmatismRotation; + float spazmatismPhase2ChargeSpeed = 18f + (death ? 5f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); + spazmatismPhase2ChargeSpeed += 16f * enrageScale; + if (Main.getGoodWorld) + spazmatismPhase2ChargeSpeed *= 1.2f; + + Vector2 distanceVector = Main.player[npc.target].Center - npc.Center; + npc.velocity = distanceVector.SafeNormalize(Vector2.UnitY) * spazmatismPhase2ChargeSpeed; + npc.ai[1] = 2f; + return false; + } + + if (npc.ai[1] == 2f) + { + // Set damage + npc.damage = setDamage; + + npc.ai[2] += retAlive ? 1f : 1.25f; + + float chargeTime = 30f - (death ? 10f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); + + // Slow down + if (npc.ai[2] >= chargeTime) + { + // Avoid cheap bullshit + npc.damage = reducedSetDamage; + + float deceleration = 0.85f - (death ? 0.1f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); + npc.velocity *= deceleration; + if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) + npc.velocity.X = 0f; + if (npc.velocity.Y > -0.1 && npc.velocity.Y < 0.1) + npc.velocity.Y = 0f; + } + else + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) - MathHelper.PiOver2; + + // Charges 5 times + if (npc.ai[2] >= (chargeTime * 1.6f) + (oblivionAlive ? 15f : 0f)) + { + npc.ai[3] += 1f; + npc.ai[2] = 0f; + npc.TargetClosest(); + npc.rotation = spazmatismRotation; + if (npc.ai[3] >= 5f) + { + npc.ai[1] = 0f; + npc.ai[3] = 0f; + return false; + } + npc.ai[1] = 1f; + } + } + + // Crazy charge + else if (npc.ai[1] == 3f) + { + // Avoid cheap bullshit + npc.damage = reducedSetDamage; + + // Reset AI array and go to shadowflamethrower phase or fireball phase if ret is dead + float secondFastCharge = 4f; + if (npc.ai[3] >= (retAlive ? secondFastCharge : secondFastCharge + 1f)) + { + npc.TargetClosest(); + npc.ai[1] = retAlive ? 0f : 5f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + + if (npc.ai[1] == 0f) + npc.localAI[1] = -20f; + + npc.netUpdate = true; + + if (npc.netSpam > 10) + npc.netSpam = 10; + } + + // Set charging velocity + else if (Main.netMode != NetmodeID.MultiplayerClient) + { + // Velocity + float spazmatismPhase3ChargeSpeed = 20f + (death ? 6f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); + spazmatismPhase3ChargeSpeed += 10f * enrageScale; + if (npc.ai[2] == -1f || (!retAlive && npc.ai[3] == secondFastCharge)) + spazmatismPhase3ChargeSpeed *= 1.3f; + if (Main.getGoodWorld) + spazmatismPhase3ChargeSpeed *= 1.2f; + + Vector2 distanceVector = Main.player[npc.target].Center + (!retAlive && bossRush ? Main.player[npc.target].velocity * 20f : Vector2.Zero) - npc.Center; + npc.velocity = distanceVector.SafeNormalize(Vector2.UnitY) * spazmatismPhase3ChargeSpeed; + + if (retAlive) + { + Vector2 spazmatismPhase3ChargePos = npc.Center; + float spazmatismPhase3ChargeTargetX = Main.player[npc.target].Center.X - spazmatismPhase3ChargePos.X; + float spazmatismPhase3ChargeTargetY = Main.player[npc.target].Center.Y - spazmatismPhase3ChargePos.Y; + float spazmatismPhase3ChargeTargetDist = (float)Math.Sqrt(spazmatismPhase3ChargeTargetX * spazmatismPhase3ChargeTargetX + spazmatismPhase3ChargeTargetY * spazmatismPhase3ChargeTargetY); + float spazmatismPhase3ChargeTargetDistCopy = spazmatismPhase3ChargeTargetDist; + + if (spazmatismPhase3ChargeTargetDistCopy < 100f) + { + if (Math.Abs(npc.velocity.X) > Math.Abs(npc.velocity.Y)) + { + float absoluteSpazXVel = Math.Abs(npc.velocity.X); + float absoluteSpazYVel = Math.Abs(npc.velocity.Y); + + if (npc.Center.X > Main.player[npc.target].Center.X) + absoluteSpazYVel *= -1f; + if (npc.Center.Y > Main.player[npc.target].Center.Y) + absoluteSpazXVel *= -1f; + + npc.velocity.X = absoluteSpazYVel; + npc.velocity.Y = absoluteSpazXVel; + } + } + } + + if (death) + { + float velocity = spazmatismPhase3ChargeSpeed * 0.5f; + int type = (!retAlive && npc.ai[3] % 2f == 0f) ? ModContent.ProjectileType() : ProjectileID.CursedFlameHostile; + int damage = npc.GetProjectileDamage(type); + + // Reduce mech boss projectile damage depending on the new ore progression changes + if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + { + double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; + double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; + if (!NPC.downedMechBossAny) + damage = (int)(damage * firstMechMultiplier); + else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) + damage = (int)(damage * secondMechMultiplier); + } + + Vector2 projectileVelocity = (Main.player[npc.target].Center + ((!retAlive && bossRush) ? Main.player[npc.target].velocity * 20f : Vector2.Zero) - npc.Center).SafeNormalize(Vector2.UnitY) * velocity; + int numProj = 3; + int spread = 15; + float rotation = MathHelper.ToRadians(spread); + for (int i = 0; i < numProj; i++) + { + Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 25f, perturbedSpeed, type, damage, 0f, Main.myPlayer); + } + } + + npc.ai[1] = 4f; + npc.netUpdate = true; + + if (npc.netSpam > 10) + npc.netSpam = 10; + } + } + + // Crazy charge + else if (npc.ai[1] == 4f) + { + // Set damage + npc.damage = setDamage; + + if (npc.ai[2] == 0f) + SoundEngine.PlaySound(SoundID.ForceRoar, npc.Center); + + float spazmatismRetDeadChargeSpeed = ((!retAlive && npc.ai[3] == 4f) ? 75f : 50f) - (float)Math.Round(death ? ((!retAlive && npc.ai[3] == 4f) ? 15f : 10f) * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); + + npc.ai[2] += 1f; + + if (npc.ai[2] == spazmatismRetDeadChargeSpeed && Vector2.Distance(npc.position, Main.player[npc.target].position) < (retAlive ? 200f : 150f)) + npc.ai[2] -= 1f; + + // Slow down + if (npc.ai[2] >= spazmatismRetDeadChargeSpeed) + { + // Avoid cheap bullshit + npc.damage = reducedSetDamage; + + npc.velocity *= 0.93f; + if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) + npc.velocity.X = 0f; + if (npc.velocity.Y > -0.1 && npc.velocity.Y < 0.1) + npc.velocity.Y = 0f; + } + else + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) - MathHelper.PiOver2; + + // Charge 3 times + float spazmatismRetDeadChargeTimer = spazmatismRetDeadChargeSpeed + 25f; + if (npc.ai[2] >= spazmatismRetDeadChargeTimer) + { + npc.netUpdate = true; + + if (npc.netSpam > 10) + npc.netSpam = 10; + + float chargeIncrement = 1f; + if (masterMode && Main.rand.NextBool() && npc.ai[3] < (retAlive ? 2f : 3f)) + chargeIncrement = 2f; + + npc.ai[3] += chargeIncrement; + npc.ai[2] = 0f; + npc.ai[1] = 3f; + } + } + + // Get in position for charge + else if (npc.ai[1] == 5f) + { + // Avoid cheap bullshit + npc.damage = reducedSetDamage; + + float chargeLineUpDist = retAlive ? 600f : 500f; + float chargeSpeed = 16f + (death ? 5f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); + float chargeAccel = 0.4f + (death ? 0.1f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); + chargeSpeed += 5.333f * enrageScale; + chargeAccel += 0.133f * enrageScale; + + if (retAlive) + { + chargeSpeed *= 0.75f; + chargeAccel *= 0.75f; + } + + if (Main.getGoodWorld) + { + chargeSpeed *= 1.15f; + chargeAccel *= 1.15f; + } + + Vector2 spazmatismRetDeadChargePos = npc.Center; + float chargeTargetX = Main.player[npc.target].Center.X - spazmatismRetDeadChargePos.X; + float chargeTargetY = Main.player[npc.target].Center.Y + chargeLineUpDist - spazmatismRetDeadChargePos.Y; + float chargeTargetDist = (float)Math.Sqrt(chargeTargetX * chargeTargetX + chargeTargetY * chargeTargetY); + + chargeTargetDist = chargeSpeed / chargeTargetDist; + chargeTargetX *= chargeTargetDist; + chargeTargetY *= chargeTargetDist; + + if (npc.velocity.X < chargeTargetX) + { + npc.velocity.X += chargeAccel; + if (npc.velocity.X < 0f && chargeTargetX > 0f) + npc.velocity.X += chargeAccel; + } + else if (npc.velocity.X > chargeTargetX) + { + npc.velocity.X -= chargeAccel; + if (npc.velocity.X > 0f && chargeTargetX < 0f) + npc.velocity.X -= chargeAccel; + } + if (npc.velocity.Y < chargeTargetY) + { + npc.velocity.Y += chargeAccel; + if (npc.velocity.Y < 0f && chargeTargetY > 0f) + npc.velocity.Y += chargeAccel; + } + else if (npc.velocity.Y > chargeTargetY) + { + npc.velocity.Y -= chargeAccel; + if (npc.velocity.Y > 0f && chargeTargetY < 0f) + npc.velocity.Y -= chargeAccel; + } + + npc.ai[2] += 1f; + + // Fire shadowflames and cursed fireballs + float fireRate = retAlive ? 30f : 20f; + if (npc.ai[2] % fireRate == 0f) + { + npc.ai[3] += 1f; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + float velocity = 16f; + int type = npc.ai[3] % 2f == 0f ? ProjectileID.CursedFlameHostile : ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + + // Reduce mech boss projectile damage depending on the new ore progression changes + if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + { + double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; + double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; + if (!NPC.downedMechBossAny) + damage = (int)(damage * firstMechMultiplier); + else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) + damage = (int)(damage * secondMechMultiplier); + } + + Vector2 projectileVelocity = (Main.player[npc.target].Center + (!retAlive && bossRush ? Main.player[npc.target].velocity * 20f : Vector2.Zero) - npc.Center).SafeNormalize(Vector2.UnitY) * velocity; + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + projectileVelocity.SafeNormalize(Vector2.UnitY) * 25f, projectileVelocity, type, damage, 0f, Main.myPlayer, 0f, retAlive ? 0f : 1f); + } + } + + // Take 3 seconds to get in position, then charge + if (npc.ai[2] >= (retAlive ? 180f : 135f) - (death ? 45f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f)) + { + npc.TargetClosest(); + npc.ai[1] = 3f; + npc.ai[2] = -1f; + npc.ai[3] = 0f; + } + + npc.netUpdate = true; + + if (npc.netSpam > 10) + npc.netSpam = 10; + } + } + } + + return false; + } + + public static bool VanillaRetinazerAI(NPC npc, Mod mod) + { + if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) + npc.TargetClosest(); + + float phase2LifeRatio = Main.masterMode ? 0.6f : 0.4f; + + bool dead2 = Main.player[npc.target].dead; + float num412 = npc.Center.X - Main.player[npc.target].position.X - (float)(Main.player[npc.target].width / 2); + float num413 = npc.position.Y + (float)npc.height - 59f - Main.player[npc.target].position.Y - (float)(Main.player[npc.target].height / 2); + float num414 = (float)Math.Atan2(num413, num412) + MathHelper.PiOver2; + if (num414 < 0f) + num414 += MathHelper.TwoPi; + else if ((double)num414 > MathHelper.TwoPi) + num414 -= MathHelper.TwoPi; + + float num415 = 0.1f; + if (npc.rotation < num414) + { + if ((double)(num414 - npc.rotation) > MathHelper.Pi) + npc.rotation -= num415; + else + npc.rotation += num415; + } + else if (npc.rotation > num414) + { + if ((double)(npc.rotation - num414) > MathHelper.Pi) + npc.rotation += num415; + else + npc.rotation -= num415; + } + + if (npc.rotation > num414 - num415 && npc.rotation < num414 + num415) + npc.rotation = num414; + + if (npc.rotation < 0f) + npc.rotation += MathHelper.TwoPi; + else if ((double)npc.rotation > MathHelper.TwoPi) + npc.rotation -= MathHelper.TwoPi; + + if (npc.rotation > num414 - num415 && npc.rotation < num414 + num415) + npc.rotation = num414; + + if (Main.rand.NextBool(5)) + { + int num416 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + (float)npc.height * 0.25f), npc.width, (int)((float)npc.height * 0.5f), DustID.Blood, npc.velocity.X, 2f); + Main.dust[num416].velocity.X *= 0.5f; + Main.dust[num416].velocity.Y *= 0.1f; + } + + if (Main.netMode != NetmodeID.MultiplayerClient && !Main.IsItDay() && !dead2 && npc.timeLeft < 10) + { + for (int num417 = 0; num417 < Main.maxNPCs; num417++) + { + if (num417 != npc.whoAmI && Main.npc[num417].active && (Main.npc[num417].type == NPCID.Retinazer || Main.npc[num417].type == NPCID.Spazmatism)) + npc.DiscourageDespawn(Main.npc[num417].timeLeft - 1); + } + } + + Vector2 vector41 = Vector2.Zero; + if (NPC.IsMechQueenUp) + { + NPC nPC = Main.npc[NPC.mechQueen]; + Vector2 mechQueenCenter = nPC.GetMechQueenCenter(); + Vector2 vector42 = new Vector2(-150f, -250f); + vector42 *= 0.75f; + float num418 = nPC.velocity.X * 0.025f; + vector41 = mechQueenCenter + vector42; + vector41 = vector41.RotatedBy(num418, mechQueenCenter); + } + + npc.reflectsProjectiles = false; + if (Main.IsItDay() || dead2) + { + npc.velocity.Y -= 0.04f; + npc.EncourageDespawn(10); + return false; + } + + if (npc.ai[0] == 0f) + { + if (npc.ai[1] == 0f) + { + // Avoid cheap bullshit + npc.damage = 0; + + float num419 = 7f; + float num420 = 0.1f; + if (Main.expertMode) + { + num419 = Main.masterMode ? 9.5f : 8.25f; + num420 = Main.masterMode ? 0.13f : 0.115f; + } + + if (Main.getGoodWorld) + { + num419 *= 1.15f; + num420 *= 1.15f; + } + + int num421 = 1; + if (npc.Center.X < Main.player[npc.target].position.X + (float)Main.player[npc.target].width) + num421 = -1; + + Vector2 vector43 = npc.Center; + float num422 = Main.player[npc.target].Center.X + (float)(num421 * 300) - vector43.X; + float num423 = Main.player[npc.target].Center.Y - 300f - vector43.Y; + if (NPC.IsMechQueenUp) + { + num419 = 14f; + num422 = vector41.X; + num423 = vector41.Y; + num422 -= vector43.X; + num423 -= vector43.Y; + } + + float num424 = (float)Math.Sqrt(num422 * num422 + num423 * num423); + float num425 = num424; + if (NPC.IsMechQueenUp) + { + if (num424 > num419) + { + num424 = num419 / num424; + num422 *= num424; + num423 *= num424; + } + + float num426 = 60f; + npc.velocity.X = (npc.velocity.X * (num426 - 1f) + num422) / num426; + npc.velocity.Y = (npc.velocity.Y * (num426 - 1f) + num423) / num426; + } + else + { + num424 = num419 / num424; + num422 *= num424; + num423 *= num424; + if (npc.velocity.X < num422) + { + npc.velocity.X += num420; + if (npc.velocity.X < 0f && num422 > 0f) + npc.velocity.X += num420; + } + else if (npc.velocity.X > num422) + { + npc.velocity.X -= num420; + if (npc.velocity.X > 0f && num422 < 0f) + npc.velocity.X -= num420; + } + + if (npc.velocity.Y < num423) + { + npc.velocity.Y += num420; + if (npc.velocity.Y < 0f && num423 > 0f) + npc.velocity.Y += num420; + } + else if (npc.velocity.Y > num423) + { + npc.velocity.Y -= num420; + if (npc.velocity.Y > 0f && num423 < 0f) + npc.velocity.Y -= num420; + } + } + + int num427 = 600; + int num428 = 60; + if (NPC.IsMechQueenUp) + { + num427 = 1200; + num428 = ((!NPC.npcsFoundForCheckActive[NPCID.TheDestroyerBody]) ? 90 : 120); + } + + if (Main.expertMode) + num428 = (int)(num428 * 0.8f); + + if (Main.masterMode) + num427 /= 2; + + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num427) + { + npc.ai[1] = 1f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.target = Main.maxPlayers; + npc.netUpdate = true; + } + else if (npc.position.Y + (float)npc.height < Main.player[npc.target].position.Y && num425 < (Main.masterMode ? 720f : Main.expertMode ? 560f : 400f)) + { + if (!Main.player[npc.target].dead) + { + npc.ai[3] += 1f; + + if (Main.expertMode) + npc.ai[3] += MathHelper.Lerp(0f, Main.masterMode ? 2.5f : 1.5f, 1f - (npc.life / (float)npc.lifeMax - phase2LifeRatio) / (1f - phase2LifeRatio)); + + if (Main.getGoodWorld) + npc.ai[3] += 0.5f; + } + + if (npc.ai[3] >= (float)num428) + { + npc.ai[3] = 0f; + vector43 = npc.Center; + num422 = Main.player[npc.target].Center.X - vector43.X; + num423 = Main.player[npc.target].Center.Y - vector43.Y; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + float num429 = Main.expertMode ? 10.5f : 9f; + int type = ProjectileID.EyeLaser; + int damage = npc.GetProjectileDamage(type); + + // Reduce mech boss projectile damage depending on the new ore progression changes + if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + { + double firstMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Classic; + double secondMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Classic; + if (!NPC.downedMechBossAny) + damage = (int)(damage * firstMechMultiplier); + else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) + damage = (int)(damage * secondMechMultiplier); + } + + num424 = (float)Math.Sqrt(num422 * num422 + num423 * num423); + num424 = num429 / num424; + num422 *= num424; + num423 *= num424; + int inaccuracy = Main.masterMode ? 3 : Main.expertMode ? 6 : 9; + num422 += (float)Main.rand.Next(-inaccuracy, inaccuracy + 1) * 0.08f; + num423 += (float)Main.rand.Next(-inaccuracy, inaccuracy + 1) * 0.08f; + + Vector2 laserVelocity = new Vector2(num422, num423); + Projectile.NewProjectile(npc.GetSource_FromAI(), vector43 + laserVelocity.SafeNormalize(Vector2.UnitY) * 150f, laserVelocity, type, damage, 0f, Main.myPlayer); + } + } + } + } + else if (npc.ai[1] == 1f) + { + // Set damage + npc.damage = npc.defDamage; + + npc.rotation = num414; + float num432 = 12f; + if (Main.expertMode) + num432 = Main.masterMode ? 18f : 15f; + + if (Main.getGoodWorld) + num432 += 2f; + + Vector2 vector44 = npc.Center; + float num433 = Main.player[npc.target].Center.X - vector44.X; + float num434 = Main.player[npc.target].Center.Y - vector44.Y; + float num435 = (float)Math.Sqrt(num433 * num433 + num434 * num434); + num435 = num432 / num435; + npc.velocity.X = num433 * num435; + npc.velocity.Y = num434 * num435; + npc.ai[1] = 2f; + } + else if (npc.ai[1] == 2f) + { + // Set damage + npc.damage = npc.defDamage; + + npc.ai[2] += 1f; + float decelerateGateValue = Main.masterMode ? 38f : Main.expertMode ? 32f : 25f; + if (npc.ai[2] >= decelerateGateValue) + { + // Avoid cheap bullshit + npc.damage = 0; + + float decelerationMultiplier = Main.masterMode ? 0.78f : Main.expertMode ? 0.92f : 0.96f; + npc.velocity *= decelerationMultiplier; + if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) + npc.velocity.X = 0f; + + if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) + npc.velocity.Y = 0f; + } + else + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) - MathHelper.PiOver2; + + float delayBeforeChargingAgain = Main.masterMode ? 47f : Main.expertMode ? 56f : 70f; + if (npc.ai[2] >= delayBeforeChargingAgain) + { + npc.ai[3] += 1f; + npc.ai[2] = 0f; + npc.target = Main.maxPlayers; + npc.rotation = num414; + float numCharges = Main.masterMode ? 6f : Main.expertMode ? 5f : 4f; + if (npc.ai[3] >= numCharges) + { + npc.ai[1] = 0f; + npc.ai[3] = 0f; + } + else + npc.ai[1] = 1f; + } + } + + if (npc.life < npc.lifeMax * phase2LifeRatio) + { + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.netUpdate = true; + } + + return false; + } + + if (npc.ai[0] == 1f || npc.ai[0] == 2f) + { + // Avoid cheap bullshit + npc.damage = 0; + + if (NPC.IsMechQueenUp) + npc.reflectsProjectiles = true; + + if (npc.ai[0] == 1f) + { + npc.ai[2] += 0.005f; + if ((double)npc.ai[2] > 0.5) + npc.ai[2] = 0.5f; + } + else + { + npc.ai[2] -= 0.005f; + if (npc.ai[2] < 0f) + npc.ai[2] = 0f; + } + + npc.rotation += npc.ai[2]; + + npc.ai[1] += 1f; + if (Main.masterMode && npc.ai[2] >= 0.2f) + { + if (npc.ai[1] % 10f == 0f) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int type = ProjectileID.EyeLaser; + int damage = npc.GetProjectileDamage(type); + + // Reduce mech boss projectile damage depending on the new ore progression changes + if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + { + double firstMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Classic; + double secondMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Classic; + if (!NPC.downedMechBossAny) + damage = (int)(damage * firstMechMultiplier); + else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) + damage = (int)(damage * secondMechMultiplier); + } + + Vector2 projectileVelocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * 7f; + int numProj = 3; + int spread = 10; + float rotation = MathHelper.ToRadians(spread); + for (int i = 0; i < numProj; i++) + { + Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 150f, perturbedSpeed, type, damage, 0f, Main.myPlayer); + Main.projectile[proj].tileCollide = false; + } + } + } + } + + if (npc.ai[1] >= 100f) + { + npc.ai[0] += 1f; + npc.ai[1] = 0f; + if (npc.ai[0] == 3f) + { + npc.ai[2] = 0f; + } + else + { + SoundEngine.PlaySound(SoundID.NPCHit1, npc.Center); + for (int num436 = 0; num436 < 2; num436++) + { + Gore.NewGore(npc.GetSource_FromAI(), npc.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 143); + Gore.NewGore(npc.GetSource_FromAI(), npc.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 7); + Gore.NewGore(npc.GetSource_FromAI(), npc.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 6); + } + + for (int num437 = 0; num437 < 20; num437++) + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, (float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f); + + SoundEngine.PlaySound(SoundID.ForceRoar, npc.Center); + } + } + + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, (float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f); + + npc.velocity *= 0.98f; + if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) + npc.velocity.X = 0f; + + if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) + npc.velocity.Y = 0f; + + return false; + } + + // Avoid cheap bullshit + npc.damage = 0; + + npc.defense = npc.defDefense + 10; + npc.HitSound = SoundID.NPCHit4; + + if (npc.ai[1] == 0f) + { + float num438 = 8f; + float num439 = 0.15f; + if (Main.expertMode) + { + num438 = Main.masterMode ? 11f : 9.5f; + num439 = Main.masterMode ? 0.2f : 0.175f; + } + + if (Main.getGoodWorld) + { + num438 *= 1.15f; + num439 *= 1.15f; + } + + Vector2 vector45 = npc.Center; + float num440 = Main.player[npc.target].Center.X - vector45.X; + float num441 = Main.player[npc.target].Center.Y - 420f - vector45.Y; + if (NPC.IsMechQueenUp) + { + num438 = 14f; + num440 = vector41.X; + num441 = vector41.Y; + num440 -= vector45.X; + num441 -= vector45.Y; + } + + float num442 = (float)Math.Sqrt(num440 * num440 + num441 * num441); + if (NPC.IsMechQueenUp) + { + if (num442 > num438) + { + num442 = num438 / num442; + num440 *= num442; + num441 *= num442; + } + + npc.velocity.X = (npc.velocity.X * 4f + num440) / 5f; + npc.velocity.Y = (npc.velocity.Y * 4f + num441) / 5f; + } + else + { + num442 = num438 / num442; + num440 *= num442; + num441 *= num442; + if (npc.velocity.X < num440) + { + npc.velocity.X += num439; + if (npc.velocity.X < 0f && num440 > 0f) + npc.velocity.X += num439; + } + else if (npc.velocity.X > num440) + { + npc.velocity.X -= num439; + if (npc.velocity.X > 0f && num440 < 0f) + npc.velocity.X -= num439; + } + + if (npc.velocity.Y < num441) + { + npc.velocity.Y += num439; + if (npc.velocity.Y < 0f && num441 > 0f) + npc.velocity.Y += num439; + } + else if (npc.velocity.Y > num441) + { + npc.velocity.Y -= num439; + if (npc.velocity.Y > 0f && num441 < 0f) + npc.velocity.Y -= num439; + } + } + + int num443 = 300; + if (NPC.IsMechQueenUp) + num443 = 1200; + + if (Main.masterMode) + num443 = (int)(num443 * 0.8f); + + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num443) + { + npc.ai[1] = 1f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.TargetClosest(); + npc.netUpdate = true; + } + + vector45 = npc.Center; + num440 = Main.player[npc.target].Center.X - vector45.X; + num441 = Main.player[npc.target].Center.Y - vector45.Y; + npc.rotation = (float)Math.Atan2(num441, num440) - MathHelper.PiOver2; + if (Main.netMode == NetmodeID.MultiplayerClient) + return false; + + npc.localAI[1] += 1f; + + npc.localAI[1] += MathHelper.Lerp(0f, Main.masterMode ? 7f : Main.expertMode ? 6f : 5f, 1f - (npc.life / (float)npc.lifeMax) / phase2LifeRatio); + + if (npc.localAI[1] > 180f && 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] = 0f; + float num444 = Main.expertMode ? 10f : 8.5f; + int type = ProjectileID.DeathLaser; + int damage = npc.GetProjectileDamage(type); + + // Reduce mech boss projectile damage depending on the new ore progression changes + if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + { + double firstMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Classic; + double secondMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Classic; + if (!NPC.downedMechBossAny) + damage = (int)(damage * firstMechMultiplier); + else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) + damage = (int)(damage * secondMechMultiplier); + } + + num442 = (float)Math.Sqrt(num440 * num440 + num441 * num441); + num442 = num444 / num442; + num440 *= num442; + num441 *= num442; + + Vector2 laserVelocity = new Vector2(num440, num441); + Projectile.NewProjectile(npc.GetSource_FromAI(), vector45 + laserVelocity.SafeNormalize(Vector2.UnitY) * 150f, laserVelocity, type, damage, 0f, Main.myPlayer); + } + + return false; + } + + int num447 = 1; + if (npc.Center.X < Main.player[npc.target].position.X + (float)Main.player[npc.target].width) + num447 = -1; + + float num448 = 8f; + float num449 = 0.2f; + if (Main.expertMode) + { + num448 = Main.masterMode ? 11f : 9.5f; + num449 = Main.masterMode ? 0.3f : 0.25f; + } + + if (Main.getGoodWorld) + { + num448 *= 1.15f; + num449 *= 1.15f; + } + + Vector2 vector46 = npc.Center; + float num450 = Main.player[npc.target].Center.X + (num447 * 420f) - vector46.X; + float num451 = Main.player[npc.target].Center.Y - vector46.Y; + float num452 = (float)Math.Sqrt(num450 * num450 + num451 * num451); + num452 = num448 / num452; + num450 *= num452; + num451 *= num452; + if (npc.velocity.X < num450) + { + npc.velocity.X += num449; + if (npc.velocity.X < 0f && num450 > 0f) + npc.velocity.X += num449; + } + else if (npc.velocity.X > num450) + { + npc.velocity.X -= num449; + if (npc.velocity.X > 0f && num450 < 0f) + npc.velocity.X -= num449; + } + + if (npc.velocity.Y < num451) + { + npc.velocity.Y += num449; + if (npc.velocity.Y < 0f && num451 > 0f) + npc.velocity.Y += num449; + } + else if (npc.velocity.Y > num451) + { + npc.velocity.Y -= num449; + if (npc.velocity.Y > 0f && num451 < 0f) + npc.velocity.Y -= num449; + } + + vector46 = npc.Center; + num450 = Main.player[npc.target].Center.X - vector46.X; + num451 = Main.player[npc.target].Center.Y - vector46.Y; + npc.rotation = (float)Math.Atan2(num451, num450) - MathHelper.PiOver2; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.localAI[1] += 1f; + + npc.localAI[1] += MathHelper.Lerp(0f, Main.masterMode ? 6f : Main.expertMode ? 5.25f : 3.75f, 1f - (npc.life / (float)npc.lifeMax) / phase2LifeRatio); + + if (npc.localAI[1] > 60f && 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] = 0f; + float num453 = 9f; + int type = ProjectileID.DeathLaser; + int damage = (int)Math.Round(npc.GetProjectileDamage(type) * 0.75); + + // Reduce mech boss projectile damage depending on the new ore progression changes + if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + { + double firstMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Classic; + double secondMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Classic; + if (!NPC.downedMechBossAny) + damage = (int)(damage * firstMechMultiplier); + else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) + damage = (int)(damage * secondMechMultiplier); + } + + num452 = (float)Math.Sqrt(num450 * num450 + num451 * num451); + num452 = num453 / num452; + num450 *= num452; + num451 *= num452; + + Vector2 laserVelocity = new Vector2(num450, num451); + Projectile.NewProjectile(npc.GetSource_FromAI(), vector46 + laserVelocity.SafeNormalize(Vector2.UnitY) * 150f, laserVelocity, type, damage, 0f, Main.myPlayer); + } + } + + npc.ai[2] += 1f; + float rapidLaserPhaseGateValue = Main.masterMode ? 120f : Main.expertMode ? 150f : 180f; + if (npc.ai[2] >= rapidLaserPhaseGateValue) + { + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.TargetClosest(); + npc.netUpdate = true; + } + + return false; + } + + public static bool VanillaSpazmatismAI(NPC npc, Mod mod) + { + if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) + npc.TargetClosest(); + + float phase2LifeRatio = Main.masterMode ? 0.6f : 0.4f; + + bool dead3 = Main.player[npc.target].dead; + float num456 = npc.Center.X - Main.player[npc.target].position.X - (float)(Main.player[npc.target].width / 2); + float num457 = npc.position.Y + (float)npc.height - 59f - Main.player[npc.target].position.Y - (float)(Main.player[npc.target].height / 2); + float num458 = (float)Math.Atan2(num457, num456) + MathHelper.PiOver2; + if (num458 < 0f) + num458 += MathHelper.TwoPi; + else if ((double)num458 > MathHelper.TwoPi) + num458 -= MathHelper.TwoPi; + + float num459 = 0.15f; + if (NPC.IsMechQueenUp && npc.ai[0] == 3f && npc.ai[1] == 0f) + num459 *= 0.25f; + + if (npc.rotation < num458) + { + if ((double)(num458 - npc.rotation) > MathHelper.Pi) + npc.rotation -= num459; + else + npc.rotation += num459; + } + else if (npc.rotation > num458) + { + if ((double)(npc.rotation - num458) > MathHelper.Pi) + npc.rotation += num459; + else + npc.rotation -= num459; + } + + if (npc.rotation > num458 - num459 && npc.rotation < num458 + num459) + npc.rotation = num458; + + if (npc.rotation < 0f) + npc.rotation += MathHelper.TwoPi; + else if ((double)npc.rotation > MathHelper.TwoPi) + npc.rotation -= MathHelper.TwoPi; + + if (npc.rotation > num458 - num459 && npc.rotation < num458 + num459) + npc.rotation = num458; + + if (Main.rand.NextBool(5)) + { + int num460 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + (float)npc.height * 0.25f), npc.width, (int)((float)npc.height * 0.5f), DustID.Blood, npc.velocity.X, 2f); + Main.dust[num460].velocity.X *= 0.5f; + Main.dust[num460].velocity.Y *= 0.1f; + } + + if (Main.netMode != NetmodeID.MultiplayerClient && !Main.IsItDay() && !dead3 && npc.timeLeft < 10) + { + for (int num461 = 0; num461 < Main.maxNPCs; num461++) + { + if (num461 != npc.whoAmI && Main.npc[num461].active && (Main.npc[num461].type == NPCID.Retinazer || Main.npc[num461].type == NPCID.Spazmatism)) + npc.DiscourageDespawn(Main.npc[num461].timeLeft - 1); + } + } + + Vector2 vector47 = Vector2.Zero; + if (NPC.IsMechQueenUp) + { + NPC nPC2 = Main.npc[NPC.mechQueen]; + Vector2 mechQueenCenter2 = nPC2.GetMechQueenCenter(); + Vector2 vector48 = new Vector2(150f, -250f); + vector48 *= 0.75f; + float num462 = nPC2.velocity.X * 0.025f; + vector47 = mechQueenCenter2 + vector48; + vector47 = vector47.RotatedBy(num462, mechQueenCenter2); + } + + npc.reflectsProjectiles = false; + if (Main.IsItDay() || dead3) + { + npc.velocity.Y -= 0.04f; + npc.EncourageDespawn(10); + return false; + } + + if (npc.ai[0] == 0f) + { + if (npc.ai[1] == 0f) + { + // Avoid cheap bullshit + npc.damage = 0; + + npc.TargetClosest(); + float num463 = 12f; + float num464 = 0.4f; + if (Main.expertMode) + { + num463 = Main.masterMode ? 13.2f : 12.6f; + num464 = Main.masterMode ? 0.48f : 0.44f; + } + + if (Main.getGoodWorld) + { + num463 *= 1.15f; + num464 *= 1.15f; + } + + int num465 = 1; + if (npc.Center.X < Main.player[npc.target].position.X + (float)Main.player[npc.target].width) + num465 = -1; + + Vector2 vector49 = npc.Center; + float num466 = Main.player[npc.target].Center.X + (float)(num465 * 400) - vector49.X; + float num467 = Main.player[npc.target].Center.Y - vector49.Y; + if (NPC.IsMechQueenUp) + { + num463 = 14f; + num466 = vector47.X; + num467 = vector47.Y; + num466 -= vector49.X; + num467 -= vector49.Y; + } + + float num468 = (float)Math.Sqrt(num466 * num466 + num467 * num467); + float num469 = num468; + if (NPC.IsMechQueenUp) + { + if (num468 > num463) + { + num468 = num463 / num468; + num466 *= num468; + num467 *= num468; + } + + npc.velocity.X = (npc.velocity.X * 4f + num466) / 5f; + npc.velocity.Y = (npc.velocity.Y * 4f + num467) / 5f; + } + else + { + num468 = num463 / num468; + num466 *= num468; + num467 *= num468; + if (npc.velocity.X < num466) + { + npc.velocity.X += num464; + if (npc.velocity.X < 0f && num466 > 0f) + npc.velocity.X += num464; + } + else if (npc.velocity.X > num466) + { + npc.velocity.X -= num464; + if (npc.velocity.X > 0f && num466 < 0f) + npc.velocity.X -= num464; + } + + if (npc.velocity.Y < num467) + { + npc.velocity.Y += num464; + if (npc.velocity.Y < 0f && num467 > 0f) + npc.velocity.Y += num464; + } + else if (npc.velocity.Y > num467) + { + npc.velocity.Y -= num464; + if (npc.velocity.Y > 0f && num467 < 0f) + npc.velocity.Y -= num464; + } + } + + int num470 = 600; + if (NPC.IsMechQueenUp) + num470 = 1200; + + if (Main.masterMode) + num470 = (int)(num470 * 0.75f); + + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num470) + { + npc.ai[1] = 1f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.target = Main.maxPlayers; + npc.netUpdate = true; + } + else + { + if (!Main.player[npc.target].dead) + { + npc.ai[3] += 1f; + + if (Main.expertMode) + npc.ai[3] += MathHelper.Lerp(0f, Main.masterMode ? 1.8f : 1.2f, 1f - (npc.life / (float)npc.lifeMax - phase2LifeRatio) / (1f - phase2LifeRatio)); + + if (Main.getGoodWorld) + npc.ai[3] += 0.4f; + } + + if (npc.ai[3] >= 60f) + { + npc.ai[3] = 0f; + vector49 = npc.Center; + num466 = Main.player[npc.target].Center.X - vector49.X; + num467 = Main.player[npc.target].Center.Y - vector49.Y; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + float num471 = Main.expertMode ? 14f : 12f; + int type = ProjectileID.CursedFlameHostile; + int damage = npc.GetProjectileDamage(type); + + // Reduce mech boss projectile damage depending on the new ore progression changes + if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + { + double firstMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Classic; + double secondMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Classic; + if (!NPC.downedMechBossAny) + damage = (int)(damage * firstMechMultiplier); + else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) + damage = (int)(damage * secondMechMultiplier); + } + + num468 = (float)Math.Sqrt(num466 * num466 + num467 * num467); + num468 = num471 / num468; + num466 *= num468; + num467 *= num468; + int inaccuracy = Main.masterMode ? 10 : Main.expertMode ? 15 : 20; + num466 += (float)Main.rand.Next(-inaccuracy, inaccuracy + 1) * 0.05f; + num467 += (float)Main.rand.Next(-inaccuracy, inaccuracy + 1) * 0.05f; + + Vector2 fireballVelocity = new Vector2(num466, num467); + Projectile.NewProjectile(npc.GetSource_FromAI(), vector49 + fireballVelocity.SafeNormalize(Vector2.UnitY) * 50f, fireballVelocity, type, damage, 0f, Main.myPlayer); + } + } + } + } + else if (npc.ai[1] == 1f) + { + // Set damage + npc.damage = npc.defDamage; + + npc.rotation = num458; + float num474 = 13f; + + if (Main.expertMode) + num474 += MathHelper.Lerp(0f, Main.masterMode ? 11.2f : 5.6f, 1f - (npc.life / (float)npc.lifeMax - phase2LifeRatio) / (1f - phase2LifeRatio)); + + if (Main.getGoodWorld) + num474 *= 1.2f; + + Vector2 vector50 = npc.Center; + float num475 = Main.player[npc.target].Center.X - vector50.X; + float num476 = Main.player[npc.target].Center.Y - vector50.Y; + float num477 = (float)Math.Sqrt(num475 * num475 + num476 * num476); + num477 = num474 / num477; + npc.velocity.X = num475 * num477; + npc.velocity.Y = num476 * num477; + npc.ai[1] = 2f; + } + else if (npc.ai[1] == 2f) + { + // Set damage + npc.damage = npc.defDamage; + + npc.ai[2] += 1f; + float decelerateGateValue = Main.masterMode ? 12f : Main.expertMode ? 10f : 8f; + if (npc.ai[2] >= decelerateGateValue) + { + // Avoid cheap bullshit + npc.damage = 0; + + float decelerationMultiplier = Main.masterMode ? 0.78f : Main.expertMode ? 0.85f : 0.9f; + npc.velocity *= decelerationMultiplier; + if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) + npc.velocity.X = 0f; + + if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) + npc.velocity.Y = 0f; + } + else + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) - MathHelper.PiOver2; + + float delayBeforeChargingAgain = Main.masterMode ? 28f : Main.expertMode ? 34f : 42f; + if (npc.ai[2] >= delayBeforeChargingAgain) + { + npc.ai[3] += 1f; + npc.ai[2] = 0f; + npc.target = Main.maxPlayers; + npc.rotation = num458; + float numCharges = Main.masterMode ? 6f : Main.expertMode ? 8f : 10f; + if (npc.ai[3] >= numCharges) + { + npc.ai[1] = 0f; + npc.ai[3] = 0f; + } + else + npc.ai[1] = 1f; + } + } + + if (npc.life < npc.lifeMax * phase2LifeRatio) + { + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.netUpdate = true; + } + + return false; + } + + if (npc.ai[0] == 1f || npc.ai[0] == 2f) + { + // Avoid cheap bullshit + npc.damage = 0; + + if (NPC.IsMechQueenUp) + npc.reflectsProjectiles = true; + + if (npc.ai[0] == 1f) + { + npc.ai[2] += 0.005f; + if ((double)npc.ai[2] > 0.5) + npc.ai[2] = 0.5f; + } + else + { + npc.ai[2] -= 0.005f; + if (npc.ai[2] < 0f) + npc.ai[2] = 0f; + } + + npc.rotation += npc.ai[2]; + + npc.ai[1] += 1f; + if (Main.masterMode && npc.ai[2] >= 0.2f) + { + if (npc.ai[1] % 10f == 0f) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int type = ProjectileID.CursedFlameHostile; + int damage = npc.GetProjectileDamage(type); + + // Reduce mech boss projectile damage depending on the new ore progression changes + if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + { + double firstMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Classic; + double secondMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Classic; + if (!NPC.downedMechBossAny) + damage = (int)(damage * firstMechMultiplier); + else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) + damage = (int)(damage * secondMechMultiplier); + } + + Vector2 projectileVelocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * 16f + Main.rand.NextVector2CircularEdge(3f, 3f); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + projectileVelocity.SafeNormalize(Vector2.UnitY) * 50f, projectileVelocity, type, damage, 0f, Main.myPlayer); + Main.projectile[proj].tileCollide = false; + } + } + } + + if (npc.ai[1] >= 100f) + { + npc.ai[0] += 1f; + npc.ai[1] = 0f; + if (npc.ai[0] == 3f) + { + npc.ai[2] = 0f; + } + else + { + SoundEngine.PlaySound(SoundID.NPCHit1, npc.Center); + for (int num478 = 0; num478 < 2; num478++) + { + Gore.NewGore(npc.GetSource_FromAI(), npc.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 144); + Gore.NewGore(npc.GetSource_FromAI(), npc.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 7); + Gore.NewGore(npc.GetSource_FromAI(), npc.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 6); + } + + for (int num479 = 0; num479 < 20; num479++) + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, (float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f); + + SoundEngine.PlaySound(SoundID.ForceRoar, npc.Center); + } + } + + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, (float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f); + + npc.velocity *= 0.98f; + if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) + npc.velocity.X = 0f; + + if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) + npc.velocity.Y = 0f; + + return false; + } + + npc.HitSound = SoundID.NPCHit4; + int setDamage = (int)Math.Round(npc.defDamage * 1.5); + int reducedSetDamage = (int)Math.Round(setDamage * 0.5); + npc.defense = npc.defDefense + 18; + + if (npc.ai[1] == 0f) + { + // Bites your fucking ass + npc.damage = reducedSetDamage; + + float num480 = 4f; + float num481 = Main.masterMode ? 0.12f : 0.1f; + int num482 = 1; + if (npc.Center.X < Main.player[npc.target].position.X + (float)Main.player[npc.target].width) + num482 = -1; + + Vector2 vector51 = npc.Center; + int flamethrowerDistance = 180; + float num483 = Main.player[npc.target].Center.X + (float)(num482 * flamethrowerDistance) - vector51.X; + float num484 = Main.player[npc.target].Center.Y - vector51.Y; + float num485 = (float)Math.Sqrt(num483 * num483 + num484 * num484); + if (!NPC.IsMechQueenUp) + { + if (num485 > flamethrowerDistance) + num480 += MathHelper.Lerp(0f, Main.masterMode ? 8f : 6f, MathHelper.Clamp((num485 - flamethrowerDistance) / 1000f, 0f, 1f)); + + if (Main.getGoodWorld) + { + num480 *= 1.15f; + num481 *= 1.15f; + } + + num485 = num480 / num485; + num483 *= num485; + num484 *= num485; + if (npc.velocity.X < num483) + { + npc.velocity.X += num481; + if (npc.velocity.X < 0f && num483 > 0f) + npc.velocity.X += num481; + } + else if (npc.velocity.X > num483) + { + npc.velocity.X -= num481; + if (npc.velocity.X > 0f && num483 < 0f) + npc.velocity.X -= num481; + } + + if (npc.velocity.Y < num484) + { + npc.velocity.Y += num481; + if (npc.velocity.Y < 0f && num484 > 0f) + npc.velocity.Y += num481; + } + else if (npc.velocity.Y > num484) + { + npc.velocity.Y -= num481; + if (npc.velocity.Y > 0f && num484 < 0f) + npc.velocity.Y -= num481; + } + } + + int num486 = 400; + if (NPC.IsMechQueenUp) + num486 = 1200; + + if (Main.masterMode) + num486 = (int)(num486 * 0.8f); + + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num486) + { + npc.ai[1] = 1f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.target = Main.maxPlayers; + npc.netUpdate = 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)) + { + npc.localAI[2] += 1f; + if (npc.localAI[2] > 22f) + { + npc.localAI[2] = 0f; + SoundEngine.PlaySound(SoundID.Item34, npc.Center); + } + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.localAI[1] += 1f; + + npc.localAI[1] += MathHelper.Lerp(0f, 5f, 1f - (npc.life / (float)npc.lifeMax) / phase2LifeRatio); + + if (npc.localAI[1] > 8f) + { + npc.localAI[1] = 0f; + float num487 = 6f + (Main.expertMode ? MathHelper.Lerp(0f, Main.masterMode ? 3f : 1.5f, 1f - (npc.life / (float)npc.lifeMax) / phase2LifeRatio) : 0f); + float timeForFlamethrowerToReachMaxVelocity = 60f; + float flamethrowerSpeedScalar = MathHelper.Clamp(npc.ai[2] / timeForFlamethrowerToReachMaxVelocity, 0f, 1f); + num487 = MathHelper.Lerp(0.1f, num487, flamethrowerSpeedScalar); + int type = ProjectileID.EyeFire; + int damage = npc.GetProjectileDamage(type); + + // Reduce mech boss projectile damage depending on the new ore progression changes + if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + { + double firstMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Classic; + double secondMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Classic; + if (!NPC.downedMechBossAny) + damage = (int)(damage * firstMechMultiplier); + else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) + damage = (int)(damage * secondMechMultiplier); + } + + vector51 = npc.Center; + num483 = Main.player[npc.target].Center.X - vector51.X; + num484 = Main.player[npc.target].Center.Y - vector51.Y; + num485 = (float)Math.Sqrt(num483 * num483 + num484 * num484); + num485 = num487 / num485; + num483 *= num485; + num484 *= num485; + int inaccuracy = Main.masterMode ? 10 : Main.expertMode ? 15 : 20; + num484 += (float)Main.rand.Next(-inaccuracy, inaccuracy + 1) * 0.01f; + num483 += (float)Main.rand.Next(-inaccuracy, inaccuracy + 1) * 0.01f; + num484 += npc.velocity.Y * 0.5f; + num483 += npc.velocity.X * 0.5f; + + if (NPC.IsMechQueenUp) + { + Vector2 vector52 = (npc.rotation + (float)Math.PI / 2f).ToRotationVector2() * num487 + npc.velocity * 0.5f; + num483 = vector52.X; + num484 = vector52.Y; + vector51 = npc.Center - vector52 * 3f; + } + + Vector2 flamethrowerVelocity = new Vector2(num483, num484); + Projectile.NewProjectile(npc.GetSource_FromAI(), vector51 + flamethrowerVelocity.SafeNormalize(Vector2.UnitY) * 25f, flamethrowerVelocity, type, damage, 0f, Main.myPlayer); + } + } + } + + if (NPC.IsMechQueenUp) + { + num480 = 14f; + num483 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector51.X; + num484 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - 300f - vector51.Y; + num483 = vector47.X; + num484 = vector47.Y; + num483 -= vector51.X; + num484 -= vector51.Y; + num485 = (float)Math.Sqrt(num483 * num483 + num484 * num484); + if (num485 > num480) + { + num485 = num480 / num485; + num483 *= num485; + num484 *= num485; + } + + int num490 = 60; + npc.velocity.X = (npc.velocity.X * (float)(num490 - 1) + num483) / (float)num490; + npc.velocity.Y = (npc.velocity.Y * (float)(num490 - 1) + num484) / (float)num490; + } + } + else if (npc.ai[1] == 1f) + { + // Set damage + npc.damage = setDamage; + + SoundEngine.PlaySound(SoundID.ForceRoar, npc.Center); + npc.rotation = num458; + float num491 = 14f; + if (Main.expertMode) + num491 += 2.5f; + if (Main.masterMode) + num491 += 3.5f; + + Vector2 vector53 = npc.Center; + float num492 = Main.player[npc.target].Center.X - vector53.X; + float num493 = Main.player[npc.target].Center.Y - vector53.Y; + float num494 = (float)Math.Sqrt(num492 * num492 + num493 * num493); + num494 = num491 / num494; + npc.velocity.X = num492 * num494; + npc.velocity.Y = num493 * num494; + npc.ai[1] = 2f; + } + else + { + if (npc.ai[1] != 2f) + return false; + + // Set damage + npc.damage = setDamage; + + npc.ai[2] += 1f; + if (Main.expertMode) + npc.ai[2] += 0.5f; + if (Main.masterMode) + npc.ai[2] += 0.5f; + + if (npc.ai[2] >= 50f) + { + // Bites your fucking ass + npc.damage = reducedSetDamage; + + npc.velocity *= 0.93f; + if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) + npc.velocity.X = 0f; + + if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) + npc.velocity.Y = 0f; + } + else + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) - MathHelper.PiOver2; + + if (npc.ai[2] >= 80f) + { + npc.ai[3] += 1f; + npc.ai[2] = 0f; + npc.target = Main.maxPlayers; + npc.rotation = num458; + float numCharges = Main.masterMode ? Main.rand.Next(4, 7) : 6f; + if (npc.ai[3] >= numCharges) + { + npc.ai[1] = 0f; + npc.ai[3] = 0f; + } + else + npc.ai[1] = 1f; + + // Due to the random number of charges in Master Mode + if (Main.masterMode) + npc.netUpdate = true; + } + } + + return false; + } + } +} diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/WallOfFleshAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/WallOfFleshAI.cs new file mode 100644 index 0000000000..8ece6740c8 --- /dev/null +++ b/NPCs/VanillaNPCAIOverrides/Bosses/WallOfFleshAI.cs @@ -0,0 +1,1496 @@ +using System; +using CalamityMod.Events; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses +{ + public static class WallOfFleshAI + { + public const float LaserShootGateValue = 400f; + public const float LaserShootTelegraphTime = LaserShootGateValue * 0.5f; + public const float TotalLasersPerBarrage = 3f; + public const float EnragedLaserFiringDuration = 300f; + + public static bool BuffedWallofFleshAI(NPC npc, Mod mod) + { + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + + bool bossRush = BossRushEvent.BossRushActive; + bool masterMode = Main.masterMode || bossRush; + bool death = CalamityWorld.death || bossRush; + + // Despawn + if (npc.position.X < 160f || npc.position.X > ((Main.maxTilesX - 10) * 16)) + npc.active = false; + + // Set Wall of Flesh variables + if (npc.localAI[0] == 0f) + { + npc.localAI[0] = 1f; + Main.wofDrawAreaBottom = -1; + Main.wofDrawAreaTop = -1; + } + + // Percent life remaining + float lifeRatio = npc.life / (float)npc.lifeMax; + + // Clamp life ratio to prevent bad velocity math. + lifeRatio = MathHelper.Clamp(lifeRatio, 0f, 1f); + + // Phases based on HP + bool phase2 = lifeRatio < 0.66f; + bool phase3 = lifeRatio < 0.33f; + + if (Main.getGoodWorld && Main.netMode != NetmodeID.MultiplayerClient && Main.rand.NextBool(180)) + { + if (NPC.CountNPCS(NPCID.FireImp) < 4) + { + for (int i = 0; i < 1000; i++) + { + int targetTileX = (int)(npc.Center.X / 16f); + int targetTileY = (int)(npc.Center.Y / 16f); + if (npc.target >= 0) + { + targetTileX = (int)(Main.player[npc.target].Center.X / 16f); + targetTileY = (int)(Main.player[npc.target].Center.Y / 16f); + } + + targetTileX += Main.rand.Next(-50, 51); + for (targetTileY += Main.rand.Next(-50, 51); targetTileY < Main.maxTilesY - 10 && !WorldGen.SolidTile(targetTileX, targetTileY); targetTileY++) + { + } + + targetTileY--; + if (!WorldGen.SolidTile(targetTileX, targetTileY)) + { + int impSpawn = NPC.NewNPC(npc.GetSource_FromAI(), targetTileX * 16 + 8, targetTileY * 16, NPCID.FireImp); + if (Main.netMode == NetmodeID.Server && impSpawn < Main.maxNPCs) + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, impSpawn); + + break; + } + } + } + } + + // Start leech spawning based on HP + npc.ai[1] += 1f; + if (npc.ai[2] == 0f) + { + if (masterMode) + npc.ai[1] += 2f; + + if (phase2) + npc.ai[1] += 1f; + if (phase3) + npc.ai[1] += 1f; + if (bossRush) + npc.ai[1] += 3f; + if (CalamityWorld.LegendaryMode) + npc.ai[1] += 9f; + + if (npc.ai[1] > 2700f) + npc.ai[2] = 1f; + } + + // Leech spawn + if (npc.ai[2] > 0f && npc.ai[1] > 60f) + { + int leechAmt = phase3 ? 3 : 2; + + npc.ai[2] += 1f; + npc.ai[1] = 0f; + if (npc.ai[2] > leechAmt) + npc.ai[2] = 0f; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (NPC.CountNPCS(NPCID.LeechHead) < 10) + { + int leechSpawn = NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X), (int)(npc.Center.Y + 20f), NPCID.LeechHead, 1); + int leechVelocity = masterMode ? 12 : 9; + Main.npc[leechSpawn].velocity.X = npc.direction * leechVelocity; + } + + if (phase2 || masterMode) + { + // Get target vector + Vector2 projectileVelocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * npc.velocity.Length(); + Vector2 projectileSpawn = npc.Center + projectileVelocity.SafeNormalize(Vector2.UnitY) * 50f; + + int damage = npc.GetProjectileDamage(ProjectileID.DemonSickle); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), projectileSpawn, projectileVelocity, ProjectileID.DemonSickle, damage, 0f, Main.myPlayer, 0f, projectileVelocity.Length() * 3f); + Main.projectile[proj].timeLeft = 600; + Main.projectile[proj].tileCollide = false; + + if (masterMode) + { + float fireballVelocity = npc.velocity.Length() + 3f; + projectileVelocity = projectileVelocity.SafeNormalize(Vector2.UnitY) * fireballVelocity; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int type = ProjectileID.Fireball; + damage = npc.GetProjectileDamage(type); + int numProj = 3; + int spread = 15; + float rotation = MathHelper.ToRadians(spread); + fireballVelocity *= 0.1f; + for (int j = 0; j < numProj; j++) + { + Vector2 randomVelocity = Main.rand.NextVector2CircularEdge(fireballVelocity, fireballVelocity); + Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, j / (float)(numProj - 1))) + randomVelocity; + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 50f, perturbedSpeed, type, damage, 0f, Main.myPlayer); + } + } + } + } + } + } + + // Play sound + npc.localAI[3] += 1f; + if (npc.localAI[3] >= (600 + Main.rand.Next(1000))) + { + npc.localAI[3] = -Main.rand.Next(200); + SoundEngine.PlaySound(SoundID.NPCDeath10, npc.Center); + } + + // Set whoAmI variable + Main.wofNPCIndex = npc.whoAmI; + + // Set eye positions + int currentEyeTileCenterX = (int)(npc.position.X / 16f); + int currentEyeTileWidthX = (int)((npc.position.X + npc.width) / 16f); + int currentEyeTileHeightY = (int)(npc.Center.Y / 16f); + int eyeMovementTries = 0; + int eyeMovementTileY = currentEyeTileHeightY + 7; + while (eyeMovementTries < 15 && eyeMovementTileY > Main.UnderworldLayer) + { + eyeMovementTileY++; + for (int eyeMovementTileX = currentEyeTileCenterX; eyeMovementTileX <= currentEyeTileWidthX; eyeMovementTileX++) + { + try + { + if (WorldGen.SolidTile(eyeMovementTileX, eyeMovementTileY) || Main.tile[eyeMovementTileX, eyeMovementTileY].LiquidAmount > 0) + eyeMovementTries++; + } + catch + { eyeMovementTries += 15; } + } + } + eyeMovementTileY += 4; + if (Main.wofDrawAreaBottom == -1) + Main.wofDrawAreaBottom = eyeMovementTileY * 16; + else if (Main.wofDrawAreaBottom > eyeMovementTileY * 16) + { + Main.wofDrawAreaBottom--; + if (Main.wofDrawAreaBottom < eyeMovementTileY * 16) + Main.wofDrawAreaBottom = eyeMovementTileY * 16; + } + else if (Main.wofDrawAreaBottom < eyeMovementTileY * 16) + { + Main.wofDrawAreaBottom++; + if (Main.wofDrawAreaBottom > eyeMovementTileY * 16) + Main.wofDrawAreaBottom = eyeMovementTileY * 16; + } + + eyeMovementTries = 0; + eyeMovementTileY = currentEyeTileHeightY - 7; + while (eyeMovementTries < 15 && eyeMovementTileY < Main.maxTilesY - 10) + { + eyeMovementTileY--; + for (int i = currentEyeTileCenterX; i <= currentEyeTileWidthX; i++) + { + try + { + if (WorldGen.SolidTile(i, eyeMovementTileY) || Main.tile[i, eyeMovementTileY].LiquidAmount > 0) + eyeMovementTries++; + } + catch + { eyeMovementTries += 15; } + } + } + eyeMovementTileY -= 4; + if (Main.wofDrawAreaTop == -1) + Main.wofDrawAreaTop = eyeMovementTileY * 16; + else if (Main.wofDrawAreaTop > eyeMovementTileY * 16) + { + Main.wofDrawAreaTop--; + if (Main.wofDrawAreaTop < eyeMovementTileY * 16) + Main.wofDrawAreaTop = eyeMovementTileY * 16; + } + else if (Main.wofDrawAreaTop < eyeMovementTileY * 16) + { + Main.wofDrawAreaTop++; + if (Main.wofDrawAreaTop > eyeMovementTileY * 16) + Main.wofDrawAreaTop = eyeMovementTileY * 16; + } + + // Set Y position + float mouthYPosition = (Main.wofDrawAreaBottom + Main.wofDrawAreaTop) / 2 - npc.height / 2; + int worldBottomTileY = (Main.maxTilesY - 180) * 16; + if (mouthYPosition < worldBottomTileY) + mouthYPosition = worldBottomTileY; + npc.position.Y = mouthYPosition; + + float targetPosition = Main.player[npc.target].Center.X; + float npcPosition = npc.Center.X; + + // Speed up if target is too far, slow down if too close + float distanceFromTarget; + if (npc.velocity.X < 0f) + distanceFromTarget = npcPosition - targetPosition; + else + distanceFromTarget = targetPosition - npcPosition; + + float halfAverageScreenWidth = 960f; + float distanceBeforeSlowingDown = 400f; + float timeBeforeEnrage = (masterMode ? 150f : 600f) - (death ? (masterMode ? 130f : 390f) * (1f - lifeRatio) : 0f); + float speedMult = 1f; + + if (bossRush) + timeBeforeEnrage *= 0.25f; + + if (calamityGlobalNPC.newAI[0] < timeBeforeEnrage) + { + if (distanceFromTarget > halfAverageScreenWidth) + { + speedMult += (distanceFromTarget - halfAverageScreenWidth) * 0.001f; + calamityGlobalNPC.newAI[0] += 1f; + + // Enrage after 10 seconds of target being off screen + if (calamityGlobalNPC.newAI[0] >= timeBeforeEnrage) + { + calamityGlobalNPC.newAI[1] = 1f; + + // Tell eyes to fire different lasers + npc.ai[3] = 1f; + + // Play roar sound on players nearby + if (Main.player[Main.myPlayer].active && !Main.player[Main.myPlayer].dead && Vector2.Distance(Main.player[Main.myPlayer].Center, npc.Center) < 2800f) + SoundEngine.PlaySound(SoundID.NPCDeath10 with { Pitch = SoundID.NPCDeath10.Pitch - 0.25f }, Main.player[Main.myPlayer].Center); + } + } + else if (distanceFromTarget < distanceBeforeSlowingDown) + speedMult += (distanceFromTarget - distanceBeforeSlowingDown) * 0.002f; + + if (distanceFromTarget < halfAverageScreenWidth) + { + if (calamityGlobalNPC.newAI[0] > 0f) + calamityGlobalNPC.newAI[0] -= 1f; + } + + speedMult = MathHelper.Clamp(speedMult, 0.75f, 2f); + } + + // Enrage if target is off screen for too long + if (calamityGlobalNPC.newAI[1] == 1f) + { + // Triple speed + speedMult = 3.25f; + + // Return to normal if very close to target + if (distanceFromTarget < distanceBeforeSlowingDown) + { + calamityGlobalNPC.newAI[0] = 0f; + calamityGlobalNPC.newAI[1] = 0f; + npc.ai[3] = 0f; + } + } + + calamityGlobalNPC.CurrentlyEnraged = distanceFromTarget > halfAverageScreenWidth || npc.ai[3] == 1f; + + if (bossRush) + speedMult += 0.2f; + + float masterModeVelocityBoost = 0f; + if (masterMode) + { + float velocityBoostStartDistance = 480f; + float velocityBoostMaxDistance = velocityBoostStartDistance * 2f; + float distanceFromTargetX = Math.Abs(npc.Center.X - Main.player[npc.target].Center.X); + float lerpAmount = MathHelper.Clamp((distanceFromTargetX - velocityBoostStartDistance) / velocityBoostMaxDistance, 0f, 1f); + masterModeVelocityBoost = MathHelper.Lerp(0f, 8f, lerpAmount); + } + + // NOTE: Max velocity is 8 in Expert Mode + // NOTE: Max velocity is 9 in For The Worthy + + float velocityBoost = 4f * (1f - lifeRatio); + float velocityX = (bossRush ? 7f : death ? 3.5f : 2f) + masterModeVelocityBoost + velocityBoost; + velocityX *= speedMult; + + if (masterMode) + velocityX *= 1.2f; + + if (Main.getGoodWorld) + { + velocityX *= 1.1f; + velocityX += 0.1f; + } + + // NOTE: Values below are based on Rev Mode only! + // Max velocity without enrage is 12 + // Min velocity is 1.5 + // Max velocity with enrage is 18 + + // Set X velocity + if (npc.velocity.X == 0f) + { + npc.TargetClosest(); + if (Main.player[npc.target].dead) + { + float wallVelocity = float.PositiveInfinity; + int wallDirection = 0; + for (int i = 0; i < Main.maxPlayers; i++) + { + Player player = Main.player[npc.target]; + if (player.active) + { + float playerDist = npc.Distance(player.Center); + if (wallVelocity > playerDist) + { + wallVelocity = playerDist; + wallDirection = (npc.Center.X < player.Center.X) ? 1 : -1; + } + } + } + + npc.direction = wallDirection; + } + + npc.velocity.X = npc.direction; + } + + if (npc.velocity.X < 0f) + { + npc.velocity.X = -velocityX; + npc.direction = -1; + } + else + { + npc.velocity.X = velocityX; + npc.direction = 1; + } + + if (Main.player[npc.target].dead || !Main.player[npc.target].gross) + npc.TargetClosest_WOF(); + + if (Main.player[npc.target].dead) + { + npc.localAI[1] += 0.0055555557f; + if (npc.localAI[1] >= 1f) + { + SoundEngine.PlaySound(SoundID.NPCDeath10, npc.Center); + npc.life = 0; + npc.active = false; + if (Main.netMode != NetmodeID.MultiplayerClient) + NetMessage.SendData(MessageID.DamageNPC, -1, -1, null, npc.whoAmI, -1f); + + return false; + } + } + else + npc.localAI[1] = MathHelper.Clamp(npc.localAI[1] - 1f / 30f, 0f, 1f); + + // Direction + npc.spriteDirection = npc.direction; + Vector2 mouthLocation = npc.Center; + float mouthTargetX = Main.player[npc.target].Center.X - mouthLocation.X; + float mouthTargetY = Main.player[npc.target].Center.Y - mouthLocation.Y; + float mouthTargetDist = (float)Math.Sqrt(mouthTargetX * mouthTargetX + mouthTargetY * mouthTargetY); + mouthTargetX *= mouthTargetDist; + mouthTargetY *= mouthTargetDist; + + // Rotation based on direction + if (npc.direction > 0) + { + if (Main.player[npc.target].Center.X > npc.Center.X) + npc.rotation = (float)Math.Atan2(-mouthTargetY, -mouthTargetX) + MathHelper.Pi; + else + npc.rotation = 0f; + } + else if (Main.player[npc.target].Center.X < npc.Center.X) + npc.rotation = (float)Math.Atan2(mouthTargetY, mouthTargetX) + MathHelper.Pi; + else + npc.rotation = 0f; + + // Expert hungry respawn over time + if (Main.netMode != NetmodeID.MultiplayerClient) + { + // Range of 2 to 11 + float spawnBoost = death ? 1f : (float)Math.Ceiling(lifeRatio * 10f); + int chance = (int)(1f + spawnBoost); + + // Range of 4 to 121 + chance *= chance; + + // Range of 23 to 134 + chance = (chance * 19 + 400) / 20; + + // Range of 32 to 59 + if (chance < 60) + chance = (chance * 3 + 60) / 4; + + // Range of 64 to 268 + chance *= 2; + + if (bossRush) + chance /= 4; + else if (masterMode) + chance /= 2; + + if (chance < 2) + chance = 2; + + if (Main.rand.NextBool(chance)) + { + int hungryAmt = 0; + float[] array = new float[10]; + for (int j = 0; j < Main.maxNPCs; j++) + { + if (hungryAmt < 10 && Main.npc[j].active && Main.npc[j].type == NPCID.TheHungry) + { + array[hungryAmt] = Main.npc[j].ai[0]; + hungryAmt++; + } + } + + int maxValue = 1 + hungryAmt * 2; + if (masterMode) + maxValue /= 2; + + if (maxValue < 2) + maxValue = 2; + + if (hungryAmt < 10 && Main.rand.Next(maxValue) <= 1) + { + int spawnHungryControl = -1; + for (int k = 0; k < 1000; k++) + { + int randomHungrySpawnValue = Main.rand.Next(10); + float hungryArrayValue = randomHungrySpawnValue * 0.1f - 0.05f; + bool shouldRespawnHungry = true; + for (int i = 0; i < hungryAmt; i++) + { + if (hungryArrayValue == array[i]) + { + shouldRespawnHungry = false; + break; + } + } + if (shouldRespawnHungry) + { + spawnHungryControl = randomHungrySpawnValue; + break; + } + } + if (spawnHungryControl >= 0) + { + int hungryRespawns = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.position.X, (int)mouthYPosition, NPCID.TheHungry, npc.whoAmI); + Main.npc[hungryRespawns].ai[0] = spawnHungryControl * 0.1f - 0.05f; + } + } + } + } + + // Spawn eyes and hungries + if (npc.localAI[0] == 1f && Main.netMode != NetmodeID.MultiplayerClient) + { + npc.localAI[0] = 2f; + + mouthYPosition = (Main.wofDrawAreaBottom + Main.wofDrawAreaTop) / 2; + mouthYPosition = (mouthYPosition + Main.wofDrawAreaTop) / 2f; + int eyeSpawn = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.position.X, (int)mouthYPosition, NPCID.WallofFleshEye, npc.whoAmI); + Main.npc[eyeSpawn].ai[0] = 1f; + if (masterMode) + Main.npc[eyeSpawn].ai[3] = 1f; + + mouthYPosition = (Main.wofDrawAreaBottom + Main.wofDrawAreaTop) / 2; + mouthYPosition = (mouthYPosition + Main.wofDrawAreaBottom) / 2f; + eyeSpawn = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.position.X, (int)mouthYPosition, NPCID.WallofFleshEye, npc.whoAmI); + Main.npc[eyeSpawn].ai[0] = -1f; + if (masterMode) + Main.npc[eyeSpawn].ai[3] = -1f; + + mouthYPosition = (Main.wofDrawAreaBottom + Main.wofDrawAreaTop) / 2; + mouthYPosition = (mouthYPosition + Main.wofDrawAreaBottom) / 2f; + + int maxHungries = masterMode ? 15 : 11; + for (int j = 0; j < maxHungries; j++) + { + int hungrySpawn = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.position.X, (int)mouthYPosition, NPCID.TheHungry, npc.whoAmI); + Main.npc[hungrySpawn].ai[0] = j * 0.1f - 0.05f; + } + } + + return false; + } + + public static bool BuffedHungryAI(NPC npc, Mod mod) + { + if (npc.justHit) + npc.ai[1] = 10f; + + if (Main.wofNPCIndex < 0) + { + npc.active = false; + return false; + } + + npc.TargetClosest(); + float acceleration = Main.masterMode ? 0.15f : 0.12f; + float distanceFromWall = 300f; + npc.damage = npc.defDamage; + npc.defense = npc.defDefense; + if ((double)Main.npc[Main.wofNPCIndex].life < (double)Main.npc[Main.wofNPCIndex].lifeMax * 0.5) + { + npc.damage = Main.masterMode ? 180 : 120; + npc.defense = 30; + acceleration += Main.masterMode ? 0.1f : 0.08f; + } + else if ((double)Main.npc[Main.wofNPCIndex].life < (double)Main.npc[Main.wofNPCIndex].lifeMax * 0.75) + { + npc.damage = Main.masterMode ? 135 : 90; + npc.defense = 20; + acceleration += Main.masterMode ? 0.05f : 0.04f; + } + + if (npc.whoAmI % 4 == 0) + distanceFromWall *= 1.75f; + + if (npc.whoAmI % 4 == 1) + distanceFromWall *= 1.5f; + + if (npc.whoAmI % 4 == 2) + distanceFromWall *= 1.25f; + + if (npc.whoAmI % 3 == 0) + distanceFromWall *= 1.5f; + + if (npc.whoAmI % 3 == 1) + distanceFromWall *= 1.25f; + + distanceFromWall *= 0.75f; + + float num404 = Main.npc[Main.wofNPCIndex].Center.X; + float y3 = Main.npc[Main.wofNPCIndex].position.Y; + float num405 = Main.wofDrawAreaBottom - Main.wofDrawAreaTop; + y3 = (float)Main.wofDrawAreaTop + num405 * npc.ai[0]; + npc.ai[2] += 1f; + if (npc.ai[2] > 100f) + { + distanceFromWall = (int)(distanceFromWall * 1.3f); + if (npc.ai[2] > 200f) + npc.ai[2] = 0f; + } + + Vector2 vector40 = new Vector2(num404, y3); + float num406 = Main.player[npc.target].Center.X - (float)(npc.width / 2) - vector40.X; + float num407 = Main.player[npc.target].Center.Y - (float)(npc.height / 2) - vector40.Y; + float num408 = (float)Math.Sqrt(num406 * num406 + num407 * num407); + if (npc.ai[1] == 0f) + { + if (num408 > distanceFromWall) + { + num408 = distanceFromWall / num408; + num406 *= num408; + num407 *= num408; + } + + if (npc.position.X < num404 + num406) + { + npc.velocity.X += acceleration; + if (npc.velocity.X < 0f && num406 > 0f) + npc.velocity.X += acceleration * 2.5f; + } + else if (npc.position.X > num404 + num406) + { + npc.velocity.X -= acceleration; + if (npc.velocity.X > 0f && num406 < 0f) + npc.velocity.X -= acceleration * 2.5f; + } + + if (npc.position.Y < y3 + num407) + { + npc.velocity.Y += acceleration; + if (npc.velocity.Y < 0f && num407 > 0f) + npc.velocity.Y += acceleration * 2.5f; + } + else if (npc.position.Y > y3 + num407) + { + npc.velocity.Y -= acceleration; + if (npc.velocity.Y > 0f && num407 < 0f) + npc.velocity.Y -= acceleration * 2.5f; + } + + float maxVelocity = 4f; + if (Main.wofNPCIndex >= 0) + { + float velocityBoost = 1.5f; + float wallLifeRatio = Main.npc[Main.wofNPCIndex].life / (float)Main.npc[Main.wofNPCIndex].lifeMax; + if (wallLifeRatio < 0.75f) + velocityBoost += 0.7f; + + if (wallLifeRatio < 0.5f) + velocityBoost += 0.7f; + + if (wallLifeRatio < 0.25f) + velocityBoost += 0.9f; + + if (wallLifeRatio < 0.1f) + velocityBoost += 0.9f; + + velocityBoost *= Main.masterMode ? 1.5f : 1.25f; + velocityBoost += 0.3f; + maxVelocity += velocityBoost * 0.35f; + if (npc.Center.X < Main.npc[Main.wofNPCIndex].Center.X && Main.npc[Main.wofNPCIndex].velocity.X > 0f) + maxVelocity += 6f; + + if (npc.Center.X > Main.npc[Main.wofNPCIndex].Center.X && Main.npc[Main.wofNPCIndex].velocity.X < 0f) + maxVelocity += 6f; + } + + if (npc.velocity.X > maxVelocity) + npc.velocity.X = maxVelocity; + + if (npc.velocity.X < -maxVelocity) + npc.velocity.X = -maxVelocity; + + if (npc.velocity.Y > maxVelocity) + npc.velocity.Y = maxVelocity; + + if (npc.velocity.Y < -maxVelocity) + npc.velocity.Y = -maxVelocity; + } + else if (npc.ai[1] > 0f) + npc.ai[1] -= 1f; + else + npc.ai[1] = 0f; + + if (num406 > 0f) + { + npc.spriteDirection = 1; + npc.rotation = (float)Math.Atan2(num407, num406); + } + + if (num406 < 0f) + { + npc.spriteDirection = -1; + npc.rotation = (float)Math.Atan2(num407, num406) + MathHelper.Pi; + } + + Lighting.AddLight(npc.Center, 0.3f, 0.2f, 0.1f); + + return false; + } + + public static bool BuffedWallofFleshEyeAI(NPC npc, Mod mod) + { + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + + bool bossRush = BossRushEvent.BossRushActive; + bool masterMode = Main.masterMode || bossRush; + bool death = CalamityWorld.death || bossRush; + + // Avoid cheap bullshit + npc.damage = 0; + + // Despawn + if (Main.wofNPCIndex < 0) + { + npc.active = false; + return false; + } + + npc.realLife = Main.wofNPCIndex; + + if (Main.npc[Main.wofNPCIndex].life > 0) + npc.life = Main.npc[Main.wofNPCIndex].life; + + // Percent life remaining + float lifeRatio = Main.npc[Main.wofNPCIndex].life / (float)Main.npc[Main.wofNPCIndex].lifeMax; + + // Get a target + if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) + npc.target = Main.npc[Main.wofNPCIndex].target; + + // Velocity, direction, and position + bool shouldFireLasers = true; + float phase2LifeRatio = 0.5f; + bool masterModeDetach = lifeRatio < phase2LifeRatio && masterMode; + if (!masterModeDetach) + { + npc.position.X = Main.npc[Main.wofNPCIndex].position.X; + npc.direction = Main.npc[Main.wofNPCIndex].direction; + npc.spriteDirection = npc.direction; + + float expectedPosition = (Main.wofDrawAreaBottom + Main.wofDrawAreaTop) / 2; + if (npc.ai[0] > 0f) + expectedPosition = (expectedPosition + Main.wofDrawAreaTop) / 2f; + else + expectedPosition = (expectedPosition + Main.wofDrawAreaBottom) / 2f; + expectedPosition -= npc.height / 2; + + bool belowExpectedPosition = npc.position.Y > expectedPosition + 1f; + bool aboveExpectedPosition = npc.position.Y < expectedPosition - 1f; + if (belowExpectedPosition) + { + float distanceBelowExpectedPosition = npc.position.Y - expectedPosition + 1f; + float movementVelocity = MathHelper.Clamp(distanceBelowExpectedPosition * 0.03125f, 1f, 5f); + npc.velocity.Y = -movementVelocity; + } + else if (aboveExpectedPosition) + { + float distanceAboveExpectedPosition = expectedPosition - 1f - npc.position.Y; + float movementVelocity = MathHelper.Clamp(distanceAboveExpectedPosition * 0.03125f, 1f, 5f); + npc.velocity.Y = movementVelocity; + } + else + { + npc.velocity.Y = 0f; + npc.position.Y = expectedPosition; + } + } + else + { + float distanceAboveTarget = 240f * npc.ai[0]; + float distanceAwayFromTargetX = 560f; + float distanceAwayFromTargetXLeeway = 40f; + float distanceAwayFromTargetY = Main.player[npc.target].Center.Y - npc.Center.Y; + float distanceAwayFromTargetYLeeway = 40f; + float absoluteDistanceX = Math.Abs(Main.player[npc.target].Center.X - npc.Center.X); + bool tooFarX = absoluteDistanceX > distanceAwayFromTargetX + distanceAwayFromTargetXLeeway || absoluteDistanceX < distanceAwayFromTargetX - distanceAwayFromTargetXLeeway; + bool tooFarY = distanceAwayFromTargetY > distanceAboveTarget + distanceAwayFromTargetYLeeway || distanceAwayFromTargetY < distanceAboveTarget - distanceAwayFromTargetYLeeway; + bool tooFar = tooFarX || tooFarY; + Vector2 hoverDestination = Main.player[npc.target].Center - Vector2.UnitY * distanceAboveTarget + Vector2.UnitX * distanceAwayFromTargetX * npc.ai[3]; + if (tooFar) + { + Vector2 idealVelocity = npc.SafeDirectionTo(hoverDestination) * 16f; + npc.SimpleFlyMovement(idealVelocity, 0.36f); + } + + if (npc.Distance(Main.player[npc.target].Center) < distanceAwayFromTargetX || npc.Distance(hoverDestination) > 120f) + shouldFireLasers = false; + + float playerLocation = npc.Center.X - Main.player[npc.target].Center.X; + npc.direction = playerLocation < 0f ? 1 : -1; + npc.spriteDirection = npc.direction; + + if (npc.ai[1] == 0f) + { + npc.ai[1] = 1f; + SoundEngine.PlaySound(SoundID.NPCDeath12, npc.Center); + for (int i = 0; i < 100; i++) + { + int dust = Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, npc.velocity.X, npc.velocity.Y); + Main.dust[dust].scale = Main.rand.NextFloat(1.5f, 4f); + Main.dust[dust].velocity *= Main.rand.NextFloat(0.5f, 1.5f); + } + } + + // 50% chance to change Y position + float eyePositionRandomChangeGateValue = MathHelper.Lerp(death ? 180f : 240f, death ? 480f : 720f, lifeRatio / phase2LifeRatio); + if (npc.ai[2] >= eyePositionRandomChangeGateValue) + { + npc.ai[2] = 0f; + npc.ai[0] = Main.rand.NextBool() ? 1f : -1f; + npc.netUpdate = true; + } + npc.ai[2] += 1f; + } + + Vector2 eyeLocation = npc.Center; + float predictionAmount = MathHelper.Lerp(0f, 20f, (float)Math.Sqrt(1f - lifeRatio)); + Vector2 lookAt = Main.player[npc.target].Center + (bossRush ? (Main.player[npc.target].velocity * predictionAmount) : Vector2.Zero); + float eyeTargetX = lookAt.X - eyeLocation.X; + float eyeTargetY = lookAt.Y - eyeLocation.Y; + float wallVelocity = (float)Math.Sqrt(eyeTargetX * eyeTargetX + eyeTargetY * eyeTargetY); + eyeTargetX *= wallVelocity; + eyeTargetY *= wallVelocity; + + // Rotation based on direction and whether to fire lasers or not + if (npc.direction > 0) + { + if (Main.player[npc.target].Center.X > npc.Center.X) + { + npc.rotation = (float)Math.Atan2(-eyeTargetY, -eyeTargetX) + MathHelper.Pi; + } + else + { + npc.rotation = 0f; + if (!masterModeDetach) + shouldFireLasers = false; + } + } + else if (Main.player[npc.target].Center.X < npc.Center.X) + { + npc.rotation = (float)Math.Atan2(eyeTargetY, eyeTargetX) + MathHelper.Pi; + } + else + { + npc.rotation = 0f; + if (!masterModeDetach) + shouldFireLasers = false; + } + + // Fire lasers + if (Main.netMode != NetmodeID.MultiplayerClient) + { + bool charging = Main.npc[Main.wofNPCIndex].ai[3] == 1f; + + // Set up enraged laser firing timer + float enragedLaserTimer = EnragedLaserFiringDuration; + if (charging) + npc.localAI[3] = enragedLaserTimer; + + bool fireEnragedLasers = npc.localAI[3] > 0f && npc.localAI[3] < enragedLaserTimer; + + // Decrement the enraged laser timer + if (npc.localAI[3] > 0f) + { + npc.localAI[3] -= 1f; + + // Stop firing normal lasers when enrage ends + if (npc.localAI[3] == 0f) + npc.localAI[1] = 0f; + } + + float shootBoost = fireEnragedLasers ? (death ? 5f : 4f) : (death ? 3f : 3f * (1f - lifeRatio)); + npc.localAI[1] += 1f + shootBoost; + + bool canHit = Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height); + + if (npc.localAI[2] == 0f) + { + if (npc.localAI[1] > LaserShootGateValue) + { + npc.localAI[2] = 1f; + npc.localAI[1] = 0f; + npc.TargetClosest(); + } + } + else if (npc.localAI[1] > 45f && (canHit || masterModeDetach) && !charging) + { + npc.localAI[1] = 0f; + npc.localAI[2] += 1f; + if (npc.localAI[2] >= TotalLasersPerBarrage + 1f) + npc.localAI[2] = 0f; + + if (shouldFireLasers) + { + float velocity = (fireEnragedLasers ? 3f : 4f) + shootBoost; + int projectileType = ProjectileID.EyeLaser; + int damage = npc.GetProjectileDamage(projectileType); + + Vector2 projectileVelocity = (lookAt - npc.Center).SafeNormalize(Vector2.UnitY) * velocity; + Vector2 projectileSpawn = npc.Center + projectileVelocity.SafeNormalize(Vector2.UnitY) * 150f; + + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), projectileSpawn, projectileVelocity, projectileType, damage, 0f, Main.myPlayer, 1f, 0f); + Main.projectile[proj].timeLeft = 900; + + if (!canHit) + Main.projectile[proj].tileCollide = false; + } + } + } + + return false; + } + + public static bool VanillaWallofFleshAI(NPC npc, Mod mod) + { + if (npc.position.X < 160f || npc.position.X > (float)((Main.maxTilesX - 10) * 16)) + npc.active = false; + + if (npc.localAI[0] == 0f) + { + npc.localAI[0] = 1f; + Main.wofDrawAreaBottom = -1; + Main.wofDrawAreaTop = -1; + } + + if (Main.getGoodWorld && Main.netMode != NetmodeID.MultiplayerClient && Main.rand.NextBool(180) && NPC.CountNPCS(NPCID.FireImp) < 4) + { + int num349 = 1; + for (int num350 = 0; num350 < num349; num350++) + { + int num351 = 1000; + for (int num352 = 0; num352 < num351; num352++) + { + int num353 = (int)(npc.Center.X / 16f); + int num354 = (int)(npc.Center.Y / 16f); + if (npc.target >= 0) + { + num353 = (int)(Main.player[npc.target].Center.X / 16f); + num354 = (int)(Main.player[npc.target].Center.Y / 16f); + } + + num353 += Main.rand.Next(-50, 51); + for (num354 += Main.rand.Next(-50, 51); num354 < Main.maxTilesY - 10 && !WorldGen.SolidTile(num353, num354); num354++) + { + } + + num354--; + if (!WorldGen.SolidTile(num353, num354)) + { + int num355 = NPC.NewNPC(npc.GetSource_FromAI(), num353 * 16 + 8, num354 * 16, 24); + if (Main.netMode == NetmodeID.Server && num355 < Main.maxNPCs) + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num355); + + break; + } + } + } + } + + npc.ai[1] += 1f; + if (npc.ai[2] == 0f) + { + if (Main.masterMode) + npc.ai[1] += 2f; + + if ((double)npc.life < (double)npc.lifeMax * 0.5) + npc.ai[1] += 1f; + + if ((double)npc.life < (double)npc.lifeMax * 0.2) + npc.ai[1] += 1f; + + if (npc.ai[1] > 2700f) + npc.ai[2] = 1f; + } + + int num356 = Main.masterMode ? 30 : 60; + if (npc.ai[2] > 0f && npc.ai[1] > (float)num356) + { + int num357 = 3; + if ((double)npc.life < (double)npc.lifeMax * 0.3) + num357++; + + npc.ai[2] += 1f; + npc.ai[1] = 0f; + if (npc.ai[2] > (float)num357) + npc.ai[2] = 0f; + + if (Main.netMode != NetmodeID.MultiplayerClient && NPC.CountNPCS(NPCID.LeechHead) < 10) + { + int num358 = NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X), (int)(npc.Center.Y + 20f), NPCID.LeechHead, 1); + int leechVelocity = Main.masterMode ? 12 : 8; + Main.npc[num358].velocity.X = npc.direction * leechVelocity; + } + } + + npc.localAI[3] += 1f; + if (npc.localAI[3] >= (float)(600 + Main.rand.Next(1000))) + { + npc.localAI[3] = -Main.rand.Next(200); + SoundEngine.PlaySound(SoundID.NPCDeath10, npc.Center); + } + + int num359 = Main.UnderworldLayer + 10; + int num360 = num359 + 70; + Main.wofNPCIndex = npc.whoAmI; + int num361 = (int)(npc.position.X / 16f); + int num362 = (int)((npc.position.X + (float)npc.width) / 16f); + int num363 = (int)(npc.Center.Y / 16f); + int num364 = 0; + int num365 = num363 + 7; + while (num364 < 15 && num365 > Main.UnderworldLayer) + { + num365++; + if (num365 > Main.maxTilesY - 10) + { + num365 = Main.maxTilesY - 10; + break; + } + + if (num365 < num359) + continue; + + for (int num366 = num361; num366 <= num362; num366++) + { + try + { + if (WorldGen.InWorld(num366, num365, 2) && (WorldGen.SolidTile(num366, num365) || Main.tile[num366, num365].LiquidAmount > 0)) + num364++; + } + catch + { + num364 += 15; + } + } + } + + num365 += 4; + if (Main.wofDrawAreaBottom == -1) + { + Main.wofDrawAreaBottom = num365 * 16; + } + else if (Main.wofDrawAreaBottom > num365 * 16) + { + Main.wofDrawAreaBottom--; + if (Main.wofDrawAreaBottom < num365 * 16) + Main.wofDrawAreaBottom = num365 * 16; + } + else if (Main.wofDrawAreaBottom < num365 * 16) + { + Main.wofDrawAreaBottom++; + if (Main.wofDrawAreaBottom > num365 * 16) + Main.wofDrawAreaBottom = num365 * 16; + } + + num364 = 0; + num365 = num363 - 7; + while (num364 < 15 && num365 < Main.maxTilesY - 10) + { + num365--; + if (num365 <= 10) + { + num365 = 10; + break; + } + + if (num365 > num360) + continue; + + if (num365 < num359) + { + num365 = num359; + break; + } + + for (int num367 = num361; num367 <= num362; num367++) + { + try + { + if (WorldGen.InWorld(num367, num365, 2) && (WorldGen.SolidTile(num367, num365) || Main.tile[num367, num365].LiquidAmount > 0)) + num364++; + } + catch + { + num364 += 15; + } + } + } + + num365 -= 4; + if (Main.wofDrawAreaTop == -1) + { + Main.wofDrawAreaTop = num365 * 16; + } + else if (Main.wofDrawAreaTop > num365 * 16) + { + Main.wofDrawAreaTop--; + if (Main.wofDrawAreaTop < num365 * 16) + Main.wofDrawAreaTop = num365 * 16; + } + else if (Main.wofDrawAreaTop < num365 * 16) + { + Main.wofDrawAreaTop++; + if (Main.wofDrawAreaTop > num365 * 16) + Main.wofDrawAreaTop = num365 * 16; + } + + Main.wofDrawAreaTop = (int)MathHelper.Clamp(Main.wofDrawAreaTop, (float)num359 * 16f, (float)num360 * 16f); + Main.wofDrawAreaBottom = (int)MathHelper.Clamp(Main.wofDrawAreaBottom, (float)num359 * 16f, (float)num360 * 16f); + if (Main.wofDrawAreaTop > Main.wofDrawAreaBottom - 160) + Main.wofDrawAreaTop = Main.wofDrawAreaBottom - 160; + else if (Main.wofDrawAreaBottom < Main.wofDrawAreaTop + 160) + Main.wofDrawAreaBottom = Main.wofDrawAreaTop + 160; + + float num368 = (Main.wofDrawAreaBottom + Main.wofDrawAreaTop) / 2 - npc.height / 2; + if (npc.position.Y > num368 + 1f) + npc.velocity.Y = -1f; + else if (npc.position.Y < num368 - 1f) + npc.velocity.Y = 1f; + + npc.velocity.Y = 0f; + npc.position.Y = num368; + + float masterModeVelocityBoost = 0f; + if (Main.masterMode) + { + float velocityBoostStartDistance = 480f; + float velocityBoostMaxDistance = velocityBoostStartDistance * 2f; + float distanceFromTargetX = Math.Abs(npc.Center.X - Main.player[npc.target].Center.X); + float lerpAmount = MathHelper.Clamp((distanceFromTargetX - velocityBoostStartDistance) / velocityBoostMaxDistance, 0f, 1f); + masterModeVelocityBoost = MathHelper.Lerp(0f, 8f, lerpAmount); + } + + float num369 = (Main.expertMode ? 3.5f : 2.5f) + masterModeVelocityBoost; + if (!Main.expertMode) + { + // 4.7 is the max in classic + if ((double)npc.life < (double)npc.lifeMax * 0.75) + num369 += 0.4f; + + if ((double)npc.life < (double)npc.lifeMax * 0.5) + num369 += 0.5f; + + if ((double)npc.life < (double)npc.lifeMax * 0.25) + num369 += 0.6f; + + if ((double)npc.life < (double)npc.lifeMax * 0.1) + num369 += 0.7f; + } + else + { + // 6.5 is the max in expert + if ((double)npc.life < (double)npc.lifeMax * 0.8) + num369 += 0.3f; + + if ((double)npc.life < (double)npc.lifeMax * 0.6) + num369 += 0.3f; + + if ((double)npc.life < (double)npc.lifeMax * 0.4) + num369 += 0.5f; + + if ((double)npc.life < (double)npc.lifeMax * 0.2) + num369 += 0.5f; + + if ((double)npc.life < (double)npc.lifeMax * 0.1) + num369 += 0.7f; + + if ((double)npc.life < (double)npc.lifeMax * 0.05) + num369 += 0.7f; + + // 8.3 is the max in master + if (Main.masterMode) + { + if ((double)npc.life < (double)npc.lifeMax * 0.025) + num369 += 0.9f; + + if ((double)npc.life < (double)npc.lifeMax * 0.01) + num369 += 0.9f; + } + } + + if (Main.getGoodWorld) + { + num369 *= 1.1f; + num369 += 0.2f; + } + + if (npc.velocity.X == 0f) + { + npc.TargetClosest(); + if (Main.player[npc.target].dead) + { + float num370 = float.PositiveInfinity; + int num371 = 0; + for (int num372 = 0; num372 < Main.maxPlayers; num372++) + { + Player player = Main.player[npc.target]; + if (player.active) + { + float num373 = npc.Distance(player.Center); + if (num370 > num373) + { + num370 = num373; + num371 = ((npc.Center.X < player.Center.X) ? 1 : (-1)); + } + } + } + + npc.direction = num371; + } + + npc.velocity.X = npc.direction; + } + + if (npc.velocity.X < 0f) + { + npc.velocity.X = -num369; + npc.direction = -1; + } + else + { + npc.velocity.X = num369; + npc.direction = 1; + } + + if (Main.player[npc.target].dead || !Main.player[npc.target].gross) + npc.TargetClosest_WOF(); + + if (Main.player[npc.target].dead) + { + npc.localAI[1] += 1f / 180f; + if (npc.localAI[1] >= 1f) + { + SoundEngine.PlaySound(SoundID.NPCDeath10, npc.Center); + npc.life = 0; + npc.active = false; + if (Main.netMode != NetmodeID.MultiplayerClient) + NetMessage.SendData(MessageID.DamageNPC, -1, -1, null, npc.whoAmI, -1f); + + return false; + } + } + else + npc.localAI[1] = MathHelper.Clamp(npc.localAI[1] - 1f / 30f, 0f, 1f); + + npc.spriteDirection = npc.direction; + Vector2 vector38 = npc.Center; + float num374 = Main.player[npc.target].Center.X - vector38.X; + float num375 = Main.player[npc.target].Center.Y - vector38.Y; + float num376 = (float)Math.Sqrt(num374 * num374 + num375 * num375); + float num377 = num376; + num374 *= num376; + num375 *= num376; + if (npc.direction > 0) + { + if (Main.player[npc.target].Center.X > npc.Center.X) + npc.rotation = (float)Math.Atan2(0f - num375, 0f - num374) + MathHelper.Pi; + else + npc.rotation = 0f; + } + else if (Main.player[npc.target].Center.X < npc.Center.X) + npc.rotation = (float)Math.Atan2(num375, num374) + MathHelper.Pi; + else + npc.rotation = 0f; + + if (Main.expertMode && Main.netMode != NetmodeID.MultiplayerClient) + { + int num378 = (int)(1f + (float)npc.life / (float)npc.lifeMax * 10f); + num378 *= num378; + if (num378 < 400) + num378 = (num378 * 19 + 400) / 20; + + if (num378 < 60) + num378 = (num378 * 3 + 60) / 4; + + if (num378 < 20) + num378 = (num378 + 20) / 2; + + num378 = (int)((double)num378 * (Main.masterMode ? 0.5 : 0.7)); + if (num378 < 2) + num378 = 2; + + if (Main.rand.NextBool(num378)) + { + int num379 = 0; + float[] array = new float[10]; + for (int num380 = 0; num380 < Main.maxNPCs; num380++) + { + if (num379 < 10 && Main.npc[num380].active && Main.npc[num380].type == NPCID.TheHungry) + { + array[num379] = Main.npc[num380].ai[0]; + num379++; + } + } + + int maxValue = 1 + num379 * 2; + if (Main.masterMode) + maxValue /= 2; + if (maxValue < 2) + maxValue = 2; + + if (num379 < 10 && Main.rand.Next(maxValue) <= 1) + { + int num381 = -1; + for (int num382 = 0; num382 < 1000; num382++) + { + int num383 = Main.rand.Next(10); + float num384 = (float)num383 * 0.1f - 0.05f; + bool flag26 = true; + for (int num385 = 0; num385 < num379; num385++) + { + if (num384 == array[num385]) + { + flag26 = false; + break; + } + } + + if (flag26) + { + num381 = num383; + break; + } + } + + if (num381 >= 0) + NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.position.X, (int)num368, NPCID.TheHungry, npc.whoAmI, (float)num381 * 0.1f - 0.05f); + } + } + } + + if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] == 1f) + { + npc.localAI[0] = 2f; + float num386 = (npc.Center.Y + (float)Main.wofDrawAreaTop) / 2f; + int num387 = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.position.X, (int)num386, NPCID.WallofFleshEye, npc.whoAmI, 1f); + float num388 = (npc.Center.Y + (float)Main.wofDrawAreaBottom) / 2f; + num387 = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.position.X, (int)num388, NPCID.WallofFleshEye, npc.whoAmI, -1f); + float num389 = (npc.Center.Y + (float)Main.wofDrawAreaBottom) / 2f; + int maxHungries = Main.masterMode ? 17 : 11; + for (int num390 = 0; num390 < maxHungries; num390++) + num387 = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.position.X, (int)num389, NPCID.TheHungry, npc.whoAmI, (float)num390 * 0.1f - 0.05f); + } + + return false; + } + + public static bool VanillaWallofFleshEyeAI(NPC npc, Mod mod) + { + if (Main.wofNPCIndex < 0) + { + npc.active = false; + return false; + } + + npc.realLife = Main.wofNPCIndex; + if (Main.npc[Main.wofNPCIndex].life > 0) + npc.life = Main.npc[Main.wofNPCIndex].life; + + // Avoid cheap bullshit + npc.damage = 0; + + npc.TargetClosest(); + npc.position.X = Main.npc[Main.wofNPCIndex].position.X; + npc.direction = Main.npc[Main.wofNPCIndex].direction; + npc.spriteDirection = npc.direction; + float num391 = (Main.wofDrawAreaBottom + Main.wofDrawAreaTop) / 2; + num391 = ((!(npc.ai[0] > 0f)) ? ((num391 + (float)Main.wofDrawAreaBottom) / 2f) : ((num391 + (float)Main.wofDrawAreaTop) / 2f)); + num391 -= (float)(npc.height / 2); + if (npc.position.Y > num391 + 1f) + { + npc.velocity.Y = -1f; + } + else if (npc.position.Y < num391 - 1f) + { + npc.velocity.Y = 1f; + } + else + { + npc.velocity.Y = 0f; + npc.position.Y = num391; + } + + if (npc.velocity.Y > 5f) + npc.velocity.Y = 5f; + + if (npc.velocity.Y < -5f) + npc.velocity.Y = -5f; + + Vector2 vector39 = npc.Center; + float num392 = Main.player[npc.target].Center.X - vector39.X; + float num393 = Main.player[npc.target].Center.Y - vector39.Y; + float num394 = (float)Math.Sqrt(num392 * num392 + num393 * num393); + float num395 = num394; + num392 *= num394; + num393 *= num394; + bool flag27 = true; + if (npc.direction > 0) + { + if (Main.player[npc.target].Center.X > npc.Center.X) + { + npc.rotation = (float)Math.Atan2(0f - num393, 0f - num392) + MathHelper.Pi; + } + else + { + npc.rotation = 0f; + flag27 = false; + } + } + else if (Main.player[npc.target].Center.X < npc.Center.X) + { + npc.rotation = (float)Math.Atan2(num393, num392) + MathHelper.Pi; + } + else + { + npc.rotation = 0f; + flag27 = false; + } + + if (Main.netMode == NetmodeID.MultiplayerClient) + return false; + + int num396 = 4; + npc.localAI[1] += 1f; + if ((double)Main.npc[Main.wofNPCIndex].life < (double)Main.npc[Main.wofNPCIndex].lifeMax * 0.75) + { + npc.localAI[1] += 1f; + num396++; + } + + if ((double)Main.npc[Main.wofNPCIndex].life < (double)Main.npc[Main.wofNPCIndex].lifeMax * 0.5) + { + npc.localAI[1] += 1f; + num396++; + } + + if ((double)Main.npc[Main.wofNPCIndex].life < (double)Main.npc[Main.wofNPCIndex].lifeMax * 0.25) + { + npc.localAI[1] += 1f; + num396 += 2; + } + + if ((double)Main.npc[Main.wofNPCIndex].life < (double)Main.npc[Main.wofNPCIndex].lifeMax * 0.1) + { + npc.localAI[1] += 2f; + num396 += 3; + } + + if (Main.expertMode) + { + npc.localAI[1] += 0.5f; + num396++; + if ((double)Main.npc[Main.wofNPCIndex].life < (double)Main.npc[Main.wofNPCIndex].lifeMax * 0.1) + { + npc.localAI[1] += 2f; + num396 += 3; + } + } + + if (npc.localAI[2] == 0f) + { + if (npc.localAI[1] > 600f) + { + npc.localAI[2] = 1f; + npc.localAI[1] = 0f; + } + } + else + { + if (!(npc.localAI[1] > 45f) || !Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + return false; + + npc.localAI[1] = 0f; + npc.localAI[2] += 1f; + if (npc.localAI[2] >= (float)num396) + npc.localAI[2] = 0f; + + if (flag27) + { + float num397 = 4f; + int type = ProjectileID.EyeLaser; + if ((double)Main.npc[Main.wofNPCIndex].life < (double)Main.npc[Main.wofNPCIndex].lifeMax * 0.5) + num397 += 1f; + if ((double)Main.npc[Main.wofNPCIndex].life < (double)Main.npc[Main.wofNPCIndex].lifeMax * 0.25) + num397 += 1f; + if ((double)Main.npc[Main.wofNPCIndex].life < (double)Main.npc[Main.wofNPCIndex].lifeMax * 0.1) + num397 += 1f; + + vector39 = npc.Center; + num392 = Main.player[npc.target].Center.X - vector39.X; + num393 = Main.player[npc.target].Center.Y - vector39.Y; + num394 = (float)Math.Sqrt(num392 * num392 + num393 * num393); + num394 = num397 / num394; + num392 *= num394; + num393 *= num394; + Vector2 projectileVelocity = new Vector2(num392, num393); + vector39 += projectileVelocity.SafeNormalize(Vector2.UnitY) * 150f; + Projectile.NewProjectile(npc.GetSource_FromAI(), vector39, projectileVelocity, type, npc.GetProjectileDamage(type), 0f, Main.myPlayer, 1f, 0f); + } + } + + return false; + } + } +} diff --git a/NPCs/VanillaNPCOverrides/RegularEnemies/DemonEyeAI.cs b/NPCs/VanillaNPCAIOverrides/RegularEnemies/DemonEyeAI.cs similarity index 98% rename from NPCs/VanillaNPCOverrides/RegularEnemies/DemonEyeAI.cs rename to NPCs/VanillaNPCAIOverrides/RegularEnemies/DemonEyeAI.cs index 2d519a95f7..0c81735975 100644 --- a/NPCs/VanillaNPCOverrides/RegularEnemies/DemonEyeAI.cs +++ b/NPCs/VanillaNPCAIOverrides/RegularEnemies/DemonEyeAI.cs @@ -1,13 +1,13 @@ -using CalamityMod.NPCs.Crags; +using System.Collections.Generic; +using CalamityMod.NPCs.Crags; +using CalamityMod.World; using Microsoft.Xna.Framework; -using System.Collections.Generic; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using CalamityMod.World; -namespace CalamityMod.NPCs.VanillaNPCOverrides.RegularEnemies +namespace CalamityMod.NPCs.VanillaNPCAIOverrides.RegularEnemies { public static class DemonEyeAI { diff --git a/NPCs/CalamityGlobalAI.cs b/NPCs/VanillaNPCAIOverrides/RegularEnemies/RevengeanceAndDeathAI.cs similarity index 95% rename from NPCs/CalamityGlobalAI.cs rename to NPCs/VanillaNPCAIOverrides/RegularEnemies/RevengeanceAndDeathAI.cs index 1bf8483ec5..afeb4c188e 100644 --- a/NPCs/CalamityGlobalAI.cs +++ b/NPCs/VanillaNPCAIOverrides/RegularEnemies/RevengeanceAndDeathAI.cs @@ -1,13 +1,13 @@ -using CalamityMod.NPCs.Astral; +using System; +using System.Collections.Generic; +using CalamityMod.NPCs.Astral; using CalamityMod.NPCs.Crags; using CalamityMod.NPCs.NormalNPCs; using CalamityMod.NPCs.PlagueEnemies; -using CalamityMod.NPCs.VanillaNPCOverrides.RegularEnemies; +using CalamityMod.NPCs.VanillaNPCAIOverrides.RegularEnemies; using CalamityMod.World; using Microsoft.Xna.Framework; using ReLogic.Utilities; -using System; -using System.Collections.Generic; using Terraria; using Terraria.Audio; using Terraria.DataStructures; @@ -18,11 +18,11 @@ using Terraria.ID; using Terraria.ModLoader; using Terraria.Utilities; -namespace CalamityMod.NPCs +namespace CalamityMod.NPCs.VanillaNPCAIOverrides.RegularEnemies { - public partial class CalamityGlobalAI + public static class RevengeanceAndDeathAI { - #region Death Mode NPC AI + #region Revengeance and Death Mode non-boss NPC AIs #region Fighter AI @@ -106,7 +106,7 @@ namespace CalamityMod.NPCs for (float i = 0f; i < 2f; i += 1f) { Vector2 rotationVector = Vector2.UnitY.RotatedByRandom(Math.PI * 2.0) * (Main.rand.NextFloat() * 0.5f + 0.5f); - Dust dust = Dust.NewDustDirect(headPosition, 0, 0, 228, 0f, 0f, 0, default, 1f); + Dust dust = Dust.NewDustDirect(headPosition, 0, 0, DustID.GoldFlame, 0f, 0f, 0, default, 1f); dust.position = headPosition + rotationVector * rotationVectorMult; dust.noGravity = true; dust.velocity = rotationVector * 2f; @@ -403,9 +403,17 @@ namespace CalamityMod.NPCs { int activeTime = 300; int defendTime = 120; + + // Set damage + npc.damage = npc.defDamage; + npc.defense = npc.defDefense; + if (npc.ai[2] < 0f) { + // Avoid cheap bullshit + npc.damage = 0; + npc.defense = npc.defDefense + 15; npc.ai[2] += 1f; npc.velocity.X *= 0.9f; @@ -480,7 +488,7 @@ namespace CalamityMod.NPCs float time = npc.ai[2] + maxTime + turnToStoneTime; if (time == 1f) { - SoundEngine.PlaySound(SoundID.NPCDeath17, npc.position); + SoundEngine.PlaySound(SoundID.NPCDeath17, npc.Center); } if (time < turnToStoneTime) { @@ -548,7 +556,7 @@ namespace CalamityMod.NPCs if (npc.ai[3] < 0f) { npc.knockBackResist = 0f; - npc.defense = (int)(npc.defDefense * 1.3); + npc.defense = (int)Math.Round(npc.defDefense * 1.3); npc.noGravity = true; npc.noTileCollide = true; npc.direction = (npc.velocity.X > 0).ToDirectionInt(); @@ -717,7 +725,7 @@ namespace CalamityMod.NPCs dustVelocity *= (float)Main.rand.Next(0, 100) * 0.1f; dustVelocity.Normalize(); dustVelocity *= (float)Main.rand.Next(50, 90) * 0.1f; - int dustIdx = Dust.NewDust(spawnPosiion, 1, 1, 27, 0f, 0f, 0, default, 1f); + int dustIdx = Dust.NewDust(spawnPosiion, 1, 1, DustID.Shadowflame, 0f, 0f, 0, default, 1f); Main.dust[dustIdx].velocity = -dustVelocity * 0.3f; Main.dust[dustIdx].alpha = 100; if (Main.rand.NextBool()) @@ -881,7 +889,7 @@ namespace CalamityMod.NPCs for (int l = 0; l < 20; l++) { Vector2 spawnPosition = npc.Center + Vector2.UnitX * (float)npc.spriteDirection * 40f; - Dust dust = Main.dust[Dust.NewDust(spawnPosition, 0, 0, 259, 0f, 0f, 0, default, 1f)]; + Dust dust = Main.dust[Dust.NewDust(spawnPosition, 0, 0, DustID.SolarFlare, 0f, 0f, 0, default, 1f)]; Vector2 velocity = Vector2.UnitY.RotatedByRandom(Math.PI * 2.0); dust.position = spawnPosition + velocity * 4f; dust.velocity = velocity * 2f + Vector2.UnitX * Main.rand.NextFloat() * (float)npc.spriteDirection * 3f; @@ -944,7 +952,7 @@ namespace CalamityMod.NPCs } if (Main.rand.NextBool(maxValue)) { - Dust dust = Main.dust[Dust.NewDust(npc.position, npc.width, npc.height, 229, 0f, 0f, 0, default, 1f)]; + Dust dust = Main.dust[Dust.NewDust(npc.position, npc.width, npc.height, DustID.Vortex, 0f, 0f, 0, default, 1f)]; dust.noGravity = true; dust.scale = 1f; dust.noLight = true; @@ -998,7 +1006,7 @@ namespace CalamityMod.NPCs } if (Main.rand.NextBool(maxValue2)) { - Dust dust = Main.dust[Dust.NewDust(npc.position, npc.width, npc.height, 229, 0f, 0f, 0, default, 1f)]; + Dust dust = Main.dust[Dust.NewDust(npc.position, npc.width, npc.height, DustID.Vortex, 0f, 0f, 0, default, 1f)]; dust.noGravity = true; dust.scale = 1f; dust.noLight = true; @@ -1035,7 +1043,7 @@ namespace CalamityMod.NPCs { npc.velocity *= 0f; npc.ai[3] = 0f; - SoundEngine.PlaySound(SoundID.Item8, npc.position); + SoundEngine.PlaySound(SoundID.Item8, npc.Center); float distX = npc.oldPos[2].X + (float)npc.width * 0.5f - npc.Center.X; float distY = npc.oldPos[2].Y + (float)npc.height * 0.5f - npc.Center.Y; float distance = (float)Math.Sqrt((distX * distX + distY * distY)); @@ -1044,14 +1052,14 @@ namespace CalamityMod.NPCs distY *= distance; for (int m = 0; m < 20; m++) { - int dustIdx = Dust.NewDust(npc.position, npc.width, npc.height, 71, distX, distY, 200, default, 2f); + int dustIdx = Dust.NewDust(npc.position, npc.width, npc.height, DustID.UndergroundHallowedEnemies, distX, distY, 200, default, 2f); Main.dust[dustIdx].noGravity = true; Dust dust = Main.dust[dustIdx]; dust.velocity.X *= 2f; } for (int n = 0; n < 20; n++) { - int dustIdx = Dust.NewDust(npc.oldPos[2], npc.width, npc.height, 71, -distX, -distY, 200, default, 2f); + int dustIdx = Dust.NewDust(npc.oldPos[2], npc.width, npc.height, DustID.UndergroundHallowedEnemies, -distX, -distY, 200, default, 2f); Main.dust[dustIdx].noGravity = true; Dust dust = Main.dust[dustIdx]; dust.velocity.X *= 2f; @@ -1117,10 +1125,10 @@ namespace CalamityMod.NPCs goto PrepareToShoot; } - // If anyone can give me an explanation of the real noticable differences between - //& and && (same with | and ||) with booleans, - // I'd greatly appreciate it - PrepareToShoot: +// If anyone can give me an explanation of the real noticable differences between +//& and && (same with | and ||) with booleans, +// I'd greatly appreciate it +PrepareToShoot: if (!ableToAlterAI3 & npcTimer) { if (npc.velocity.Y == 0f && ((npc.velocity.X > 0f && npc.direction < 0) || (npc.velocity.X < 0f && npc.direction > 0))) @@ -1312,31 +1320,31 @@ namespace CalamityMod.NPCs { if ((npcType == NPCID.Zombie || npcType == NPCID.ZombieXmas || npcType == NPCID.ZombieSweater || npcType == NPCID.Skeleton || (npcType >= NPCID.BoneThrowingSkeleton && npcType <= NPCID.BoneThrowingSkeleton4) || npcType == NPCID.AngryBones || npcType == NPCID.AngryBonesBig || npcType == NPCID.AngryBonesBigHelmet || npcType == NPCID.AngryBonesBigMuscle || npcType == NPCID.ArmoredSkeleton || npcType == NPCID.SkeletonArcher || npcType == NPCID.BaldZombie || npcType == NPCID.UndeadViking || npcType == NPCID.ZombieEskimo || npcType == NPCID.Frankenstein || npcType == NPCID.PincushionZombie || npcType == NPCID.SlimedZombie || npcType == NPCID.SwampZombie || npcType == NPCID.TwiggyZombie || npcType == NPCID.ArmoredViking || npcType == NPCID.FemaleZombie || npcType == NPCID.HeadacheSkeleton || npcType == NPCID.MisassembledSkeleton || npcType == NPCID.PantlessSkeleton || npcType == NPCID.ZombieRaincoat || npcType == NPCID.SkeletonSniper || npcType == NPCID.TacticalSkeleton || npcType == NPCID.SkeletonCommando || npcType == NPCID.ZombieSuperman || npcType == NPCID.ZombiePixie || npcType == NPCID.ZombieDoctor || npcType == NPCID.GreekSkeleton) && Main.rand.NextBool(1000)) { - SoundEngine.PlaySound(SoundID.ZombieMoan, npc.position); + SoundEngine.PlaySound(SoundID.ZombieMoan, npc.Center); } if (npcType == NPCID.BloodZombie && Main.rand.NextBool(800)) { - SoundEngine.PlaySound(SoundID.ZombieMoan, npc.position); //There was a npcType thing afterwards but its not really useable now. Hilarious, frankly + SoundEngine.PlaySound(SoundID.ZombieMoan, npc.Center); //There was a npcType thing afterwards but its not really useable now. Hilarious, frankly } if ((npcType == NPCID.Mummy || npcType == NPCID.DarkMummy || npcType == NPCID.LightMummy) && Main.rand.NextBool(500)) { - SoundEngine.PlaySound(SoundID.Mummy, npc.position); + SoundEngine.PlaySound(SoundID.Mummy, npc.Center); } if (npcType == NPCID.Vampire && Main.rand.NextBool(500)) { - SoundEngine.PlaySound(SoundID.Zombie7, npc.position); + SoundEngine.PlaySound(SoundID.Zombie7, npc.Center); } if (npcType == NPCID.Frankenstein && Main.rand.NextBool(500)) { - SoundEngine.PlaySound(SoundID.Zombie6, npc.position); + SoundEngine.PlaySound(SoundID.Zombie6, npc.Center); } if (npcType == NPCID.FaceMonster && Main.rand.NextBool(500)) { - SoundEngine.PlaySound(SoundID.Zombie8, npc.position); + SoundEngine.PlaySound(SoundID.Zombie8, npc.Center); } if (npcType >= 269 && npcType <= 280 && Main.rand.NextBool(1000)) { - SoundEngine.PlaySound(SoundID.ZombieMoan, npc.position); + SoundEngine.PlaySound(SoundID.ZombieMoan, npc.Center); } npc.TargetClosest(true); } @@ -1819,7 +1827,9 @@ namespace CalamityMod.NPCs { if (npc.ai[2] == 0f) { - npc.damage = npc.defDamage; + // Avoid cheap bullshit + npc.damage = 0; + float maxVelocity = CalamityWorld.death ? 2.5f : 1.5f; maxVelocity *= 1f + (1f - npc.scale); FighterRunningAI(npc, maxVelocity, 0.09f, 0.8f, true, 0.8f); @@ -1840,7 +1850,9 @@ namespace CalamityMod.NPCs } else { - npc.damage = npc.defDamage * 2; + // Set damage + npc.damage = (int)Math.Round(npc.defDamage * 1.4); + npc.ai[3] = 1f; npc.velocity.X *= 0.9f; if (Math.Abs(npc.velocity.X) < 0.1f) @@ -2059,7 +2071,7 @@ namespace CalamityMod.NPCs { Vector2 position = npc.Center + new Vector2((float)(npc.direction * -14), -8f) - Vector2.One * 4f; Vector2 velocity = new Vector2((float)(npc.direction * -6), 12f) * 0.2f + Utils.RandomVector2(Main.rand, -1f, 1f) * 0.1f; - Dust dust = Main.dust[Dust.NewDust(position, 8, 8, 229, velocity.X, velocity.Y, 100, Color.Transparent, 1f + Main.rand.NextFloat() * 0.5f)]; + Dust dust = Main.dust[Dust.NewDust(position, 8, 8, DustID.Vortex, velocity.X, velocity.Y, 100, Color.Transparent, 1f + Main.rand.NextFloat() * 0.5f)]; dust.noGravity = true; dust.velocity = velocity; dust.customData = npc; @@ -2272,7 +2284,7 @@ namespace CalamityMod.NPCs } if (Main.rand.NextBool(6) && npc.ai[1] <= 20f) { - Dust dust = Main.dust[Dust.NewDust(npc.Center + new Vector2((float)((npc.spriteDirection == 1) ? 8 : -20), -20f), 8, 8, 229, npc.velocity.X, npc.velocity.Y, 100, default, 1f)]; + Dust dust = Main.dust[Dust.NewDust(npc.Center + new Vector2((float)((npc.spriteDirection == 1) ? 8 : -20), -20f), 8, 8, DustID.Vortex, npc.velocity.X, npc.velocity.Y, 100, default, 1f)]; dust.velocity = dust.velocity / 4f + npc.velocity / 2f; dust.scale = 0.6f; dust.noLight = true; @@ -2291,7 +2303,7 @@ namespace CalamityMod.NPCs } if (Main.rand.NextBool(6)) { - Dust dust = Main.dust[Dust.NewDust(npc.Center, 2, 2, 229, 0f, 0f, 0, default, 1f)]; + Dust dust = Main.dust[Dust.NewDust(npc.Center, 2, 2, DustID.Vortex, 0f, 0f, 0, default, 1f)]; dust.position = npc.Center + new Vector2((float)((npc.spriteDirection == 1) ? 26 : -26), 24f); dust.velocity.X = 0f; if (dust.velocity.Y < 0f) @@ -3462,46 +3474,15 @@ namespace CalamityMod.NPCs // Teleport (Chaos elementals) if (Main.netMode != NetmodeID.MultiplayerClient && (npcType == NPCID.ChaosElemental || npcType == ModContent.NPCType()) && npc.ai[3] >= (float)aiGateValue) { - int tileCoordsX = (int)Main.player[npc.target].position.X / 16; - int tileCoordsY = (int)Main.player[npc.target].position.Y / 16; - int tileCoordsX2 = (int)npc.position.X / 16; - int tileCoordsY2 = (int)npc.position.Y / 16; - int maxDistanceX = 20; - int tryCount = 0; - bool tooFarFromPlayer = false; - if (Math.Abs(npc.position.X - Main.player[npc.target].position.X) + Math.Abs(npc.position.Y - Main.player[npc.target].position.Y) > 2000f) + int targetTileX = (int)Main.player[npc.target].Center.X / 16; + int targetTileY = (int)Main.player[npc.target].Center.Y / 16; + Vector2 chosenTile = Vector2.Zero; + if (npc.AI_AttemptToFindTeleportSpot(ref chosenTile, targetTileX, targetTileY, 20, 9)) { - tryCount = 100; - tooFarFromPlayer = true; - } - while (!tooFarFromPlayer && tryCount < 100) - { - tryCount++; - int randX = Main.rand.Next(tileCoordsX - maxDistanceX, tileCoordsX + maxDistanceX); - for (int t = Main.rand.Next(tileCoordsY - maxDistanceX, tileCoordsY + maxDistanceX); t < tileCoordsY + maxDistanceX; t++) - { - if ((t < tileCoordsY - 4 || t > tileCoordsY + 4 || randX < tileCoordsX - 4 || randX > tileCoordsX + 4) && (t < tileCoordsY2 - 1 || t > tileCoordsY2 + 1 || randX < tileCoordsX2 - 1 || randX > tileCoordsX2 + 1) && Main.tile[randX, t].HasUnactuatedTile) - { - bool foundGoodTeleport = true; - // I don't understand why the hell this exists if it's only for Chaos Elementals, but I suppose I'll - // Leave it here - if (npcType == NPCID.DarkCaster && Main.tile[randX, t - 1].WallType == WallID.None) - { - foundGoodTeleport = false; - } - else if (Main.tile[randX, t - 1].LiquidType == LiquidID.Lava) - { - foundGoodTeleport = false; - } - if (foundGoodTeleport && Main.tileSolid[(int)Main.tile[randX, t].TileType] && !Collision.SolidTiles(randX - 1, randX + 1, t - 4, t - 1)) - { - npc.position.X = (float)(randX * 16 - npc.width / 2); - npc.position.Y = (float)(t * 16 - npc.height); - npc.netUpdate = true; - npc.ai[3] = -30f; - } - } - } + npc.position.X = chosenTile.X * 16f - (float)(npc.width / 2); + npc.position.Y = chosenTile.Y * 16f - (float)npc.height; + npc.ai[3] = -30f; + npc.netUpdate = true; } } return false; @@ -3529,7 +3510,7 @@ namespace CalamityMod.NPCs npc.velocity.Y = -6f; for (int i = 0; i < 35; i++) { - Dust dust = Dust.NewDustDirect(npc.position, npc.width, npc.height, 5); + Dust dust = Dust.NewDustDirect(npc.position, npc.width, npc.height, DustID.Blood); dust.velocity *= 1f; dust.scale = 1f + Main.rand.NextFloat() * 0.5f; dust.fadeIn = 1.5f + Main.rand.NextFloat() * 0.5f; @@ -3545,7 +3526,7 @@ namespace CalamityMod.NPCs { for (int j = 0; j < 2; j++) { - Dust eyeFishDust = Dust.NewDustDirect(npc.position, npc.width, npc.height, 5); + Dust eyeFishDust = Dust.NewDustDirect(npc.position, npc.width, npc.height, DustID.Blood); eyeFishDust.velocity *= 1f; eyeFishDust.scale = 1f + Main.rand.NextFloat() * 0.5f; eyeFishDust.fadeIn = 1.5f + Main.rand.NextFloat() * 0.5f; @@ -3561,6 +3542,41 @@ namespace CalamityMod.NPCs if (targetData.Type == NPCTargetType.Player) targetDead = Main.player[npc.target].dead; + bool queenBeeHornet = npc.type == NPCID.HornetHoney && npc.ai[3] == 1f; + if (queenBeeHornet) + { + 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 (npc.localAI[1] != 0f && !Collision.SolidCollision(npc.position, npc.width, npc.height)) + { + npc.localAI[1] = 0f; + npc.localAI[2] = 0f; + npc.SyncVanillaLocalAI(); + } + } + else if (npc.localAI[1] == 0f) + npc.localAI[2]++; + + if (npc.localAI[2] >= (CalamityWorld.death ? 60f : 120f)) + { + npc.localAI[1] = 1f; + npc.localAI[2] = 0f; + npc.SyncVanillaLocalAI(); + } + if (npc.localAI[1] == 0f) + { + npc.alpha = 0; + npc.noTileCollide = false; + } + else + { + npc.wet = false; + npc.alpha = 200; + npc.noTileCollide = true; + } + } + + bool deathModeVelocityBuff = true; float maxVelocity = 6f; float acceleration = 0.05f; if (npc.type == NPCID.EaterofSouls || npc.type == NPCID.Crimera) @@ -3590,7 +3606,9 @@ namespace CalamityMod.NPCs maxVelocity *= 1f - npc.scale; acceleration *= 1f - npc.scale; - if ((double)(npc.position.Y / 16f) < Main.worldSurface) + + // Despawn + if ((double)(npc.position.Y / 16f) < Main.worldSurface && !queenBeeHornet) { if (Main.player[npc.target].position.Y - npc.position.Y > 300f && npc.velocity.Y < 0f) npc.velocity.Y *= 0.97f; @@ -3598,6 +3616,15 @@ namespace CalamityMod.NPCs if (Main.player[npc.target].position.Y - npc.position.Y < 80f && npc.velocity.Y > 0f) npc.velocity.Y *= 0.97f; } + + // Master Mode Queen Bee Hornets + if (queenBeeHornet) + { + maxVelocity *= 1.4f; + acceleration *= 1.8f; + maxVelocity += npc.ai[2] * 1.5f; + acceleration += npc.ai[2] * 0.01f; + } } else if (npc.type == NPCID.MossHornet) { @@ -3629,51 +3656,62 @@ namespace CalamityMod.NPCs } else if (npc.type == NPCID.ServantofCthulhu) { - maxVelocity = 5f; - acceleration = 0.03f; + maxVelocity = 5f + npc.ai[2] * 2f; + acceleration = 0.03f + npc.ai[2] * 0.03f; } else if (npc.type == NPCID.Bee || npc.type == NPCID.BeeSmall) { - npc.ai[1] += 1f; - float originalFlyAwayTime = 60f; - float flyAwayTime = CalamityWorld.death ? 30f : 40f; - float originalFlyAwayVelocity = 6f; - float flyAwayDistance = originalFlyAwayTime * originalFlyAwayVelocity; - float flyAwayVelocity = flyAwayDistance / flyAwayTime; - float flyAwayAccel = (npc.ai[1] - flyAwayTime) / flyAwayTime; - if (flyAwayAccel > 1f) + bool notQueenBeeBee = npc.ai[3] == 0f; + if (notQueenBeeBee) { - flyAwayAccel = 1f; + npc.ai[1] += 1f; + float originalFlyAwayTime = 60f; + float flyAwayTime = CalamityWorld.death ? 30f : 40f; + float originalFlyAwayVelocity = 6f; + float flyAwayDistance = originalFlyAwayTime * originalFlyAwayVelocity; + float flyAwayVelocity = flyAwayDistance / flyAwayTime; + float flyAwayAccel = (npc.ai[1] - flyAwayTime) / flyAwayTime; + if (flyAwayAccel > 1f) + { + flyAwayAccel = 1f; + } + else + { + if (npc.velocity.X > flyAwayVelocity) + npc.velocity.X = flyAwayVelocity; + + if (npc.velocity.X < -flyAwayVelocity) + npc.velocity.X = -flyAwayVelocity; + + if (npc.velocity.Y > flyAwayVelocity) + npc.velocity.Y = flyAwayVelocity; + + if (npc.velocity.Y < -flyAwayVelocity) + npc.velocity.Y = -flyAwayVelocity; + } + + maxVelocity = 5f; + acceleration = 0.1f * flyAwayAccel; } else { - if (npc.velocity.X > flyAwayVelocity) - npc.velocity.X = flyAwayVelocity; - - if (npc.velocity.X < -flyAwayVelocity) - npc.velocity.X = -flyAwayVelocity; - - if (npc.velocity.Y > flyAwayVelocity) - npc.velocity.Y = flyAwayVelocity; - - if (npc.velocity.Y < -flyAwayVelocity) - npc.velocity.Y = -flyAwayVelocity; + deathModeVelocityBuff = false; + maxVelocity = 5f + npc.ai[2] * 2f; + acceleration = 0.1f + npc.ai[2] * 0.04f; } - - maxVelocity = 5f; - acceleration = 0.1f; - acceleration *= flyAwayAccel; } + maxVelocity *= 1.25f; acceleration *= 1.25f; - if (CalamityWorld.death) + if (CalamityWorld.death && deathModeVelocityBuff) { maxVelocity *= 1.25f; acceleration *= 1.25f; } - Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float targetXDist = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float targetYDist = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); + + Vector2 vector = npc.Center; + float targetXDist = Main.player[npc.target].Center.X; + float targetYDist = Main.player[npc.target].Center.Y; targetXDist = (float)((int)(targetXDist / 8f) * 8); targetYDist = (float)((int)(targetYDist / 8f) * 8); vector.X = (float)((int)(vector.X / 8f) * 8); @@ -3682,11 +3720,11 @@ namespace CalamityMod.NPCs targetYDist -= vector.Y; float targetDistance = (float)Math.Sqrt((double)(targetXDist * targetXDist + targetYDist * targetYDist)); float targetDistCheck = targetDistance; + bool flag = false; if (targetDistance > 600f) - { flag = true; - } + if (targetDistance == 0f) { targetXDist = npc.velocity.X; @@ -3698,75 +3736,121 @@ namespace CalamityMod.NPCs targetXDist *= targetDistance; targetYDist *= targetDistance; } - if (npc.type == NPCID.Hornet || npc.type == NPCID.MossHornet || (npc.type >= NPCID.HornetFatty && npc.type <= NPCID.HornetStingy) || npc.type == NPCID.EaterofSouls || npc.type == NPCID.Corruptor || npc.type == NPCID.Probe || npc.type == NPCID.Crimera || npc.type == NPCID.Moth || npc.type == NPCID.Bee || npc.type == NPCID.BeeSmall || npc.type == NPCID.BloodSquid) + + if (npc.type == NPCID.Hornet || npc.type == NPCID.MossHornet || (npc.type >= NPCID.HornetFatty && npc.type <= NPCID.HornetStingy) || npc.type == NPCID.EaterofSouls || npc.type == NPCID.Corruptor || npc.type == NPCID.Crimera || npc.type == NPCID.Moth || npc.type == NPCID.Bee || npc.type == NPCID.BeeSmall || npc.type == NPCID.BloodSquid) { if (targetDistCheck > 100f || npc.type == NPCID.Corruptor || npc.type == NPCID.Bee || npc.type == NPCID.BeeSmall || npc.type == NPCID.BloodSquid || npc.type == NPCID.Hornet || npc.type == NPCID.MossHornet || (npc.type >= NPCID.HornetFatty && npc.type <= NPCID.HornetStingy)) { npc.ai[0] += 1f; if (npc.ai[0] > 0f) - { - npc.velocity.Y = npc.velocity.Y + 0.03f; - } + npc.velocity.Y += 0.03f; else - { - npc.velocity.Y = npc.velocity.Y - 0.03f; - } + npc.velocity.Y -= 0.03f; + if (npc.ai[0] < -100f || npc.ai[0] > 100f) - { - npc.velocity.X = npc.velocity.X + 0.03f; - } + npc.velocity.X += 0.03f; else - { - npc.velocity.X = npc.velocity.X - 0.03f; - } + npc.velocity.X -= 0.03f; + if (npc.ai[0] > 200f) - { npc.ai[0] = -200f; - } } + if (targetDistCheck < 150f && (npc.type == NPCID.EaterofSouls || npc.type == NPCID.Corruptor || npc.type == NPCID.Crimera || npc.type == NPCID.BloodSquid)) { - npc.velocity.X = npc.velocity.X + targetXDist * 0.009f; - npc.velocity.Y = npc.velocity.Y + targetYDist * 0.009f; + npc.velocity.X += targetXDist * 0.009f; + npc.velocity.Y += targetYDist * 0.009f; + } + + // Master Mode Queen Bee Bees + if (npc.type == NPCID.Bee || npc.type == NPCID.BeeSmall) + { + if (npc.ai[3] == 1f) + { + float pushVelocity = 0.5f + npc.ai[2] * 0.2f; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active) + { + if (i != npc.whoAmI && Main.npc[i].type == npc.type) + { + if (Vector2.Distance(npc.Center, Main.npc[i].Center) < 32f * npc.scale) + { + if (npc.position.X < Main.npc[i].position.X) + npc.velocity.X -= pushVelocity; + else + npc.velocity.X += pushVelocity; + + if (npc.position.Y < Main.npc[i].position.Y) + npc.velocity.Y -= pushVelocity; + else + npc.velocity.Y += pushVelocity; + } + } + } + } + } } } + if (targetDead) { targetXDist = (float)npc.direction * maxVelocity / 2f; targetYDist = -maxVelocity / 2f; } + if (npc.velocity.X < targetXDist) { - npc.velocity.X = npc.velocity.X + acceleration; - if (npc.type != NPCID.Crimera && npc.type != NPCID.EaterofSouls && npc.type != NPCID.Corruptor && npc.type != NPCID.Probe && npc.type != NPCID.BloodSquid && npc.velocity.X < 0f && targetXDist > 0f) - { - npc.velocity.X = npc.velocity.X + acceleration; - } + npc.velocity.X += acceleration; + if (npc.type != NPCID.Crimera && npc.type != NPCID.EaterofSouls && npc.type != NPCID.Corruptor && !queenBeeHornet && npc.type != NPCID.BloodSquid && npc.velocity.X < 0f && targetXDist > 0f) + npc.velocity.X += acceleration; } else if (npc.velocity.X > targetXDist) { - npc.velocity.X = npc.velocity.X - acceleration; - if (npc.type != NPCID.Crimera && npc.type != NPCID.EaterofSouls && npc.type != NPCID.Corruptor && npc.type != NPCID.Probe && npc.type != NPCID.BloodSquid && npc.velocity.X > 0f && targetXDist < 0f) - { - npc.velocity.X = npc.velocity.X - acceleration; - } + npc.velocity.X -= acceleration; + if (npc.type != NPCID.Crimera && npc.type != NPCID.EaterofSouls && npc.type != NPCID.Corruptor && !queenBeeHornet && npc.type != NPCID.BloodSquid && npc.velocity.X > 0f && targetXDist < 0f) + npc.velocity.X -= acceleration; } + if (npc.velocity.Y < targetYDist) { - npc.velocity.Y = npc.velocity.Y + acceleration; - if (npc.type != NPCID.Crimera && npc.type != NPCID.EaterofSouls && npc.type != NPCID.Corruptor && npc.type != NPCID.Probe && npc.type != NPCID.BloodSquid && npc.velocity.Y < 0f && targetYDist > 0f) - { - npc.velocity.Y = npc.velocity.Y + acceleration; - } + npc.velocity.Y += acceleration; + if (npc.type != NPCID.Crimera && npc.type != NPCID.EaterofSouls && npc.type != NPCID.Corruptor && !queenBeeHornet && npc.type != NPCID.BloodSquid && npc.velocity.Y < 0f && targetYDist > 0f) + npc.velocity.Y += acceleration; } else if (npc.velocity.Y > targetYDist) { - npc.velocity.Y = npc.velocity.Y - acceleration; - if (npc.type != NPCID.Crimera && npc.type != NPCID.EaterofSouls && npc.type != NPCID.Corruptor && npc.type != NPCID.Probe && npc.type != NPCID.BloodSquid && npc.velocity.Y > 0f && targetYDist < 0f) + npc.velocity.Y -= acceleration; + if (npc.type != NPCID.Crimera && npc.type != NPCID.EaterofSouls && npc.type != NPCID.Corruptor && !queenBeeHornet && npc.type != NPCID.BloodSquid && npc.velocity.Y > 0f && targetYDist < 0f) + npc.velocity.Y -= acceleration; + } + + if (npc.type == NPCID.ServantofCthulhu) + { + float pushVelocity = 0.5f + npc.ai[2] * 0.25f; + for (int i = 0; i < Main.maxNPCs; i++) { - npc.velocity.Y = npc.velocity.Y - acceleration; + if (Main.npc[i].active) + { + if (i != npc.whoAmI && Main.npc[i].type == npc.type) + { + if (Vector2.Distance(npc.Center, Main.npc[i].Center) < 48f * npc.scale) + { + if (npc.position.X < Main.npc[i].position.X) + npc.velocity.X -= pushVelocity; + else + npc.velocity.X += pushVelocity; + + if (npc.position.Y < Main.npc[i].position.Y) + npc.velocity.Y -= pushVelocity; + else + npc.velocity.Y += pushVelocity; + } + } + } } } + if (npc.type == NPCID.MeteorHead) { if (targetXDist > 0f) @@ -3780,41 +3864,6 @@ namespace CalamityMod.NPCs npc.rotation = (float)Math.Atan2((double)targetYDist, (double)targetXDist) + MathHelper.Pi; } } - else if (npc.type == NPCID.Probe) - { - if (npc.justHit) - npc.localAI[0] = 0f; - - npc.localAI[0] += 1f; - if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] >= 120f) - { - npc.localAI[0] = 0f; - if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - int projDamage = 22; - int projType = 84; - Projectile.NewProjectile(npc.GetSource_FromAI(), vector.X, vector.Y, targetXDist, targetYDist, projType, projDamage, 0f, Main.myPlayer, 0f, 0f); - } - } - int npcXPos = (int)npc.position.X + npc.width / 2; - int npcTileY = (int)npc.position.Y + npc.height / 2; - int npcTileX = npcXPos / 16; - npcTileY /= 16; - if (!WorldGen.SolidTile(npcTileX, npcTileY)) - { - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.3f, 0.1f, 0.05f); - } - if (targetXDist > 0f) - { - npc.spriteDirection = 1; - npc.rotation = (float)Math.Atan2((double)targetYDist, (double)targetXDist); - } - if (targetXDist < 0f) - { - npc.spriteDirection = -1; - npc.rotation = (float)Math.Atan2((double)targetYDist, (double)targetXDist) + MathHelper.Pi; - } - } else if (npc.type == NPCID.EaterofSouls || npc.type == NPCID.Corruptor || npc.type == NPCID.Crimera || npc.type == NPCID.BloodSquid) { npc.rotation = (float)Math.Atan2((double)targetYDist, (double)targetXDist) - MathHelper.PiOver2; @@ -3822,72 +3871,60 @@ namespace CalamityMod.NPCs else if (npc.type == NPCID.Moth || npc.type == NPCID.Hornet || npc.type == NPCID.MossHornet || (npc.type >= NPCID.HornetFatty && npc.type <= NPCID.HornetStingy)) { if (npc.velocity.X > 0f) - { npc.spriteDirection = 1; - } if (npc.velocity.X < 0f) - { npc.spriteDirection = -1; - } + npc.rotation = npc.velocity.X * 0.1f; } else - { npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) - MathHelper.PiOver2; - } - if (npc.type == NPCID.Hornet || npc.type == NPCID.MossHornet || (npc.type >= NPCID.HornetFatty && npc.type <= NPCID.HornetStingy) || npc.type == NPCID.EaterofSouls || npc.type == NPCID.MeteorHead || npc.type == NPCID.Corruptor || npc.type == NPCID.Probe || npc.type == NPCID.Crimera || npc.type == NPCID.Moth || npc.type == NPCID.Bee || npc.type == NPCID.BeeSmall || npc.type == NPCID.BloodSquid) + + if (npc.type == NPCID.Hornet || npc.type == NPCID.MossHornet || (npc.type >= NPCID.HornetFatty && npc.type <= NPCID.HornetStingy) || npc.type == NPCID.EaterofSouls || npc.type == NPCID.MeteorHead || npc.type == NPCID.Corruptor || npc.type == NPCID.Crimera || npc.type == NPCID.Moth || npc.type == NPCID.Bee || npc.type == NPCID.BeeSmall || npc.type == NPCID.BloodSquid) { float reboundSpeed = 0.7f; if (npc.type == NPCID.EaterofSouls || npc.type == NPCID.Crimera) - { reboundSpeed = 0.4f; - } + if (npc.collideX) { npc.netUpdate = true; npc.velocity.X = npc.oldVelocity.X * -reboundSpeed; if (npc.direction == -1 && npc.velocity.X > 0f && npc.velocity.X < 2f) - { npc.velocity.X = 2f; - } if (npc.direction == 1 && npc.velocity.X < 0f && npc.velocity.X > -2f) - { npc.velocity.X = -2f; - } } + if (npc.collideY) { npc.netUpdate = true; npc.velocity.Y = npc.oldVelocity.Y * -reboundSpeed; if (npc.velocity.Y > 0f && (double)npc.velocity.Y < 1.5) - { npc.velocity.Y = 2f; - } if (npc.velocity.Y < 0f && (double)npc.velocity.Y > -1.5) - { npc.velocity.Y = -2f; - } } + if (npc.type == NPCID.BloodSquid) { - int bloodDust = Dust.NewDust(npc.position, npc.width, npc.height, 5, npc.velocity.X * 0.2f, npc.velocity.Y * 0.2f, 100); + int bloodDust = Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, npc.velocity.X * 0.2f, npc.velocity.Y * 0.2f, 100); Main.dust[bloodDust].velocity *= 0.5f; } else if (npc.type == NPCID.MeteorHead) { - int meteorDust = Dust.NewDust(new Vector2(npc.position.X - npc.velocity.X, npc.position.Y - npc.velocity.Y), npc.width, npc.height, 6, npc.velocity.X * 0.2f, npc.velocity.Y * 0.2f, 100, default(Color), 2f); + int meteorDust = Dust.NewDust(new Vector2(npc.position.X - npc.velocity.X, npc.position.Y - npc.velocity.Y), npc.width, npc.height, DustID.Torch, npc.velocity.X * 0.2f, npc.velocity.Y * 0.2f, 100, default(Color), 2f); Dust dust = Main.dust[meteorDust]; dust.noGravity = true; dust.velocity.X *= 0.3f; dust.velocity.Y *= 0.3f; } - else if (npc.type != NPCID.Probe && npc.type != NPCID.Moth && npc.type != NPCID.Parrot && npc.type != NPCID.Bee && npc.type != NPCID.BeeSmall && Main.rand.NextBool(20)) + else if (npc.type != NPCID.Moth && npc.type != NPCID.Parrot && npc.type != NPCID.Bee && npc.type != NPCID.BeeSmall && Main.rand.NextBool(20)) { int dustType = 18; if (npc.type == NPCID.Crimera) - { dustType = 5; - } + int idleDust = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + (float)npc.height * 0.25f), npc.width, (int)((float)npc.height * 0.5f), dustType, npc.velocity.X, 2f, 75, npc.color, npc.scale); Dust dust = Main.dust[idleDust]; dust.velocity.X *= 0.5f; @@ -3896,7 +3933,7 @@ namespace CalamityMod.NPCs } else if (npc.type != NPCID.Parrot && Main.rand.NextBool(40)) { - int otherIdleDust = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + (float)npc.height * 0.25f), npc.width, (int)((float)npc.height * 0.5f), 5, npc.velocity.X, 2f, 0, default(Color), 1f); + int otherIdleDust = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + (float)npc.height * 0.25f), npc.width, (int)((float)npc.height * 0.5f), DustID.Blood, npc.velocity.X, 2f, 0, default(Color), 1f); Dust dust = Main.dust[otherIdleDust]; dust.velocity.X *= 0.5f; dust.velocity.Y *= 0.1f; @@ -3905,9 +3942,9 @@ namespace CalamityMod.NPCs if ((npc.type == NPCID.EaterofSouls || npc.type == NPCID.Corruptor || npc.type == NPCID.Crimera || npc.type == NPCID.BloodSquid) && npc.wet) { if (npc.velocity.Y > 0f) - npc.velocity.Y = npc.velocity.Y * 0.95f; + npc.velocity.Y *= 0.95f; - npc.velocity.Y = npc.velocity.Y - 0.4f; + npc.velocity.Y -= 0.4f; if (npc.velocity.Y < -3f) npc.velocity.Y = -3f; } @@ -3915,9 +3952,9 @@ namespace CalamityMod.NPCs if (npc.type == NPCID.Moth && npc.wet) { if (npc.velocity.Y > 0f) - npc.velocity.Y = npc.velocity.Y * 0.95f; + npc.velocity.Y *= 0.95f; - npc.velocity.Y = npc.velocity.Y - 0.7f; + npc.velocity.Y -= 0.7f; if (npc.velocity.Y < -6f) npc.velocity.Y = -6f; @@ -3940,14 +3977,14 @@ namespace CalamityMod.NPCs if (npc.ai[1] == 301f) { - SoundEngine.PlaySound(SoundID.Item17, npc.position); + SoundEngine.PlaySound(SoundID.Item17, npc.Center); npc.ai[1] = 0f; } if (Main.netMode != NetmodeID.MultiplayerClient) { - npc.ai[1] += (npc.type == NPCID.MossHornet ? 2f : 1f); - if (npc.justHit) + npc.ai[1] += ((npc.type == NPCID.MossHornet || queenBeeHornet) ? 2f : 1f) + npc.ai[2]; + if (npc.justHit && !queenBeeHornet) npc.ai[1] = 0f; if (npc.ai[1] >= 240f) @@ -3955,7 +3992,11 @@ namespace CalamityMod.NPCs if (targetData.Type != 0 && Collision.CanHit(npc, targetData)) { float projSpeed = (CalamityWorld.death || Main.hardMode) ? 5f : 8f; - Vector2 projSpawnPosition = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height / 2); + projSpeed += npc.ai[2] * ((CalamityWorld.death || Main.hardMode) ? 2f : 4f); + if (queenBeeHornet) + projSpeed += 2f; + + Vector2 projSpawnPosition = npc.Center; float projTargetXDist = targetData.Center.X - projSpawnPosition.X; float projTargetYDist = targetData.Center.Y - projSpawnPosition.Y; if ((projTargetXDist < 0f && npc.velocity.X < 0f) || (projTargetXDist > 0f && npc.velocity.X > 0f)) @@ -3964,7 +4005,9 @@ namespace CalamityMod.NPCs projTargetDistance = projSpeed / projTargetDistance; projTargetXDist *= projTargetDistance; projTargetYDist *= projTargetDistance; - int projDamage = (int)(10f * npc.scale); + + // Master Mode Queen Bee Hornets deal increased damage + int projDamage = (int)((queenBeeHornet ? 15f : 10f) * npc.scale); if (npc.type == NPCID.MossHornet) projDamage = (int)(30f * npc.scale); @@ -3984,15 +4027,15 @@ namespace CalamityMod.NPCs } } - if (npc.type == NPCID.Probe & flag) + if (queenBeeHornet & flag) { if ((npc.velocity.X > 0f && targetXDist > 0f) || (npc.velocity.X < 0f && targetXDist < 0f)) { if (Math.Abs(npc.velocity.X) < 12f) - npc.velocity.X = npc.velocity.X * 1.05f; + npc.velocity.X *= 1.05f; } else - npc.velocity.X = npc.velocity.X * 0.9f; + npc.velocity.X *= 0.9f; } if (Main.netMode != NetmodeID.MultiplayerClient && !targetDead) @@ -4065,7 +4108,7 @@ namespace CalamityMod.NPCs if ((Main.dayTime && npc.type != NPCID.Crimera && npc.type != NPCID.EaterofSouls && npc.type != NPCID.MeteorHead && npc.type != NPCID.Bee && npc.type != NPCID.BeeSmall && npc.type != NPCID.Corruptor && npc.type != NPCID.Moth && npc.type != NPCID.Parrot && npc.type != NPCID.BloodSquid) || Main.player[npc.target].dead) { - npc.velocity.Y = npc.velocity.Y - acceleration * 2f; + npc.velocity.Y -= acceleration * 2f; if (npc.timeLeft > 10) npc.timeLeft = 10; } @@ -4083,7 +4126,7 @@ namespace CalamityMod.NPCs if (npc.type == NPCID.LeechHead && npc.localAI[1] == 0f) { npc.localAI[1] = 1f; - SoundEngine.PlaySound(SoundID.NPCDeath13, npc.position); + SoundEngine.PlaySound(SoundID.NPCDeath13, npc.Center); int dustVelocity = 1; if (npc.velocity.X < 0f) { @@ -4091,7 +4134,7 @@ namespace CalamityMod.NPCs } for (int i = 0; i < 20; i++) { - Dust.NewDust(new Vector2(npc.position.X - 20f, npc.position.Y - 20f), npc.width + 40, npc.height + 40, 5, (float)(dustVelocity * 8), -1f, 0, default(Color), 1f); + Dust.NewDust(new Vector2(npc.position.X - 20f, npc.position.Y - 20f), npc.width + 40, npc.height + 40, DustID.Blood, (float)(dustVelocity * 8), -1f, 0, default(Color), 1f); } } @@ -4105,7 +4148,7 @@ namespace CalamityMod.NPCs { for (int k = 0; k < 2; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, 0f, 0f, 100); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, 0f, 0f, 100); } } @@ -4115,7 +4158,7 @@ namespace CalamityMod.NPCs } if (npc.alpha == 0 && Main.rand.NextBool(5)) - Dust.NewDust(npc.position, npc.width, npc.height, 5, 0f, 0f, 100); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, 0f, 0f, 100); npc.position -= npc.netOffset; } @@ -4142,7 +4185,7 @@ namespace CalamityMod.NPCs } else { - npc.defense = (int)(npc.defDefense * 1.3); + npc.defense = (int)Math.Round(npc.defDefense * 1.3); if (npc.ai[3] > 0f) npc.realLife = (int)npc.ai[3]; @@ -4273,7 +4316,7 @@ namespace CalamityMod.NPCs Main.npc[bloodEelSegment].ai[1] = currentBloodEel; Main.npc[bloodEelSegment].CopyInteractions(npc); Main.npc[currentBloodEel].ai[0] = bloodEelSegment; - NetMessage.SendData(23, -1, -1, null, bloodEelSegment); + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, bloodEelSegment); currentBloodEel = bloodEelSegment; } } @@ -4541,13 +4584,13 @@ namespace CalamityMod.NPCs { Vector2 crawltipedeDustPos = npc.Center + (npc.rotation - MathHelper.PiOver2).ToRotationVector2() * 8f; Vector2 crawltipedeDustRotation = npc.rotation.ToRotationVector2() * 16f; - Dust crawltipedeDust = Main.dust[Dust.NewDust(crawltipedeDustPos + crawltipedeDustRotation, 0, 0, 6, npc.velocity.X, npc.velocity.Y, 100, Color.Transparent, 1f + Main.rand.NextFloat() * 3f)]; + Dust crawltipedeDust = Main.dust[Dust.NewDust(crawltipedeDustPos + crawltipedeDustRotation, 0, 0, DustID.Torch, npc.velocity.X, npc.velocity.Y, 100, Color.Transparent, 1f + Main.rand.NextFloat() * 3f)]; crawltipedeDust.noGravity = true; crawltipedeDust.noLight = true; crawltipedeDust.position -= new Vector2(4f); crawltipedeDust.fadeIn = 1f; crawltipedeDust.velocity = Vector2.Zero; - Dust crawltipedeDust2 = Main.dust[Dust.NewDust(crawltipedeDustPos - crawltipedeDustRotation, 0, 0, 6, npc.velocity.X, npc.velocity.Y, 100, Color.Transparent, 1f + Main.rand.NextFloat() * 3f)]; + Dust crawltipedeDust2 = Main.dust[Dust.NewDust(crawltipedeDustPos - crawltipedeDustRotation, 0, 0, DustID.Torch, npc.velocity.X, npc.velocity.Y, 100, Color.Transparent, 1f + Main.rand.NextFloat() * 3f)]; crawltipedeDust2.noGravity = true; crawltipedeDust2.noLight = true; crawltipedeDust2.position -= new Vector2(4f); @@ -4838,7 +4881,7 @@ namespace CalamityMod.NPCs soundDelay = 20f; } npc.soundDelay = (int)soundDelay; - SoundEngine.PlaySound(SoundID.WormDig, npc.position); + SoundEngine.PlaySound(SoundID.WormDig, npc.Center); } wormTargetDist = (float)Math.Sqrt((double)(wormTargetX * wormTargetX + wormTargetY * wormTargetY)); @@ -5068,13 +5111,13 @@ namespace CalamityMod.NPCs { npc.alpha = 255; } - SoundEngine.PlaySound(SoundID.Item8, npc.position); + SoundEngine.PlaySound(SoundID.Item8, npc.Center); int dustIncrement; for (int i = 0; i < 50; i = dustIncrement + 1) { if (npc.type == NPCID.GoblinSorcerer || npc.type == NPCID.Tim) { - int goblinDust = Dust.NewDust(npc.position, npc.width, npc.height, 27, 0f, 0f, 100, default(Color), (float)Main.rand.Next(1, 3)); + int goblinDust = Dust.NewDust(npc.position, npc.width, npc.height, DustID.Shadowflame, 0f, 0f, 100, default(Color), (float)Main.rand.Next(1, 3)); Dust dust = Main.dust[goblinDust]; dust.velocity *= 3f; if (Main.dust[goblinDust].scale > 1f) @@ -5084,49 +5127,49 @@ namespace CalamityMod.NPCs } else if (npc.type == NPCID.DarkCaster) { - int darkCasterDust = Dust.NewDust(npc.position, npc.width, npc.height, 172, 0f, 0f, 100, default(Color), 1.5f); + int darkCasterDust = Dust.NewDust(npc.position, npc.width, npc.height, DustID.DungeonWater, 0f, 0f, 100, default(Color), 1.5f); Dust dust = Main.dust[darkCasterDust]; dust.velocity *= 3f; Main.dust[darkCasterDust].noGravity = true; } else if (npc.type == NPCID.Necromancer || npc.type == NPCID.NecromancerArmored) { - int necromancerDust = Dust.NewDust(npc.position, npc.width, npc.height, 173, 0f, 0f, 0, default(Color), 1f); + int necromancerDust = Dust.NewDust(npc.position, npc.width, npc.height, DustID.ShadowbeamStaff, 0f, 0f, 0, default(Color), 1f); Dust dust = Main.dust[necromancerDust]; dust.velocity *= 2f; Main.dust[necromancerDust].scale = 1.4f; } else if (npc.type == NPCID.DiabolistRed || npc.type == NPCID.DiabolistWhite) { - int diabolistDust = Dust.NewDust(npc.position, npc.width, npc.height, 174, 0f, 0f, 100, default(Color), 1.5f); + int diabolistDust = Dust.NewDust(npc.position, npc.width, npc.height, DustID.InfernoFork, 0f, 0f, 100, default(Color), 1.5f); Dust dust = Main.dust[diabolistDust]; dust.velocity *= 3f; Main.dust[diabolistDust].noGravity = true; } else if (npc.type == NPCID.RaggedCaster || npc.type == NPCID.RaggedCasterOpenCoat) { - int raggedCasterDust = Dust.NewDust(npc.position, npc.width, npc.height, 175, 0f, 0f, 100, default(Color), 1.5f); + int raggedCasterDust = Dust.NewDust(npc.position, npc.width, npc.height, DustID.SpectreStaff, 0f, 0f, 100, default(Color), 1.5f); Dust dust = Main.dust[raggedCasterDust]; dust.velocity *= 3f; Main.dust[raggedCasterDust].noGravity = true; } else if (npc.type == NPCID.RuneWizard) { - int runeWizardDust = Dust.NewDust(npc.position, npc.width, npc.height, 106, 0f, 0f, 100, default(Color), 2.5f); + int runeWizardDust = Dust.NewDust(npc.position, npc.width, npc.height, DustID.RuneWizard, 0f, 0f, 100, default(Color), 2.5f); Dust dust = Main.dust[runeWizardDust]; dust.velocity *= 3f; Main.dust[runeWizardDust].noGravity = true; } else if (npc.type == NPCID.DesertDjinn) { - int desertSpiritDust = Dust.NewDust(npc.position, npc.width, npc.height, 27, 0f, 0f, 100, default(Color), 2.5f); + int desertSpiritDust = Dust.NewDust(npc.position, npc.width, npc.height, DustID.Shadowflame, 0f, 0f, 100, default(Color), 2.5f); Dust dust = Main.dust[desertSpiritDust]; dust.velocity *= 3f; Main.dust[desertSpiritDust].noGravity = true; } else { - int fireImpDust = Dust.NewDust(npc.position, npc.width, npc.height, 6, 0f, 0f, 100, default(Color), 2.5f); + int fireImpDust = Dust.NewDust(npc.position, npc.width, npc.height, DustID.Torch, 0f, 0f, 100, default(Color), 2.5f); Dust dust = Main.dust[fireImpDust]; dust.velocity *= 3f; Main.dust[fireImpDust].noGravity = true; @@ -5139,12 +5182,12 @@ namespace CalamityMod.NPCs npc.velocity.Y = 0f; npc.ai[2] = 0f; npc.ai[3] = 0f; - SoundEngine.PlaySound(SoundID.Item8, npc.position); + SoundEngine.PlaySound(SoundID.Item8, npc.Center); for (int j = 0; j < 50; j = dustIncrement + 1) { if (npc.type == NPCID.GoblinSorcerer || npc.type == NPCID.Tim) { - int goblinCastDust = Dust.NewDust(npc.position, npc.width, npc.height, 27, 0f, 0f, 100, default(Color), (float)Main.rand.Next(1, 3)); + int goblinCastDust = Dust.NewDust(npc.position, npc.width, npc.height, DustID.Shadowflame, 0f, 0f, 100, default(Color), (float)Main.rand.Next(1, 3)); Dust dust = Main.dust[goblinCastDust]; dust.velocity *= 3f; if (Main.dust[goblinCastDust].scale > 1f) @@ -5154,49 +5197,49 @@ namespace CalamityMod.NPCs } else if (npc.type == NPCID.DarkCaster) { - int darkCasterCastDust = Dust.NewDust(npc.position, npc.width, npc.height, 172, 0f, 0f, 100, default(Color), 1.5f); + int darkCasterCastDust = Dust.NewDust(npc.position, npc.width, npc.height, DustID.DungeonWater, 0f, 0f, 100, default(Color), 1.5f); Dust dust = Main.dust[darkCasterCastDust]; dust.velocity *= 3f; Main.dust[darkCasterCastDust].noGravity = true; } else if (npc.type == NPCID.RuneWizard) { - int runeWizardCastDust = Dust.NewDust(npc.position, npc.width, npc.height, 106, 0f, 0f, 100, default(Color), 2.5f); + int runeWizardCastDust = Dust.NewDust(npc.position, npc.width, npc.height, DustID.RuneWizard, 0f, 0f, 100, default(Color), 2.5f); Dust dust = Main.dust[runeWizardCastDust]; dust.velocity *= 3f; Main.dust[runeWizardCastDust].noGravity = true; } else if (npc.type == NPCID.Necromancer || npc.type == NPCID.NecromancerArmored) { - int necromancerCastDust = Dust.NewDust(npc.position, npc.width, npc.height, 173, 0f, 0f, 0, default(Color), 1f); + int necromancerCastDust = Dust.NewDust(npc.position, npc.width, npc.height, DustID.ShadowbeamStaff, 0f, 0f, 0, default(Color), 1f); Dust dust = Main.dust[necromancerCastDust]; dust.velocity *= 2f; Main.dust[necromancerCastDust].scale = 1.4f; } else if (npc.type == NPCID.DiabolistRed || npc.type == NPCID.DiabolistWhite) { - int diabolistCastDust = Dust.NewDust(npc.position, npc.width, npc.height, 174, 0f, 0f, 100, default(Color), 1.5f); + int diabolistCastDust = Dust.NewDust(npc.position, npc.width, npc.height, DustID.InfernoFork, 0f, 0f, 100, default(Color), 1.5f); Dust dust = Main.dust[diabolistCastDust]; dust.velocity *= 3f; Main.dust[diabolistCastDust].noGravity = true; } else if (npc.type == NPCID.RaggedCaster || npc.type == NPCID.RaggedCasterOpenCoat) { - int raggedCasterCastDust = Dust.NewDust(npc.position, npc.width, npc.height, 175, 0f, 0f, 100, default(Color), 1.5f); + int raggedCasterCastDust = Dust.NewDust(npc.position, npc.width, npc.height, DustID.SpectreStaff, 0f, 0f, 100, default(Color), 1.5f); Dust dust = Main.dust[raggedCasterCastDust]; dust.velocity *= 3f; Main.dust[raggedCasterCastDust].noGravity = true; } else if (npc.type == NPCID.DesertDjinn) { - int desertSpiritCastDust = Dust.NewDust(npc.position, npc.width, npc.height, 27, 0f, 0f, 100, default(Color), 2.5f); + int desertSpiritCastDust = Dust.NewDust(npc.position, npc.width, npc.height, DustID.Shadowflame, 0f, 0f, 100, default(Color), 2.5f); Dust dust = Main.dust[desertSpiritCastDust]; dust.velocity *= 3f; Main.dust[desertSpiritCastDust].noGravity = true; } else { - int fireImpCastDust = Dust.NewDust(npc.position, npc.width, npc.height, 6, 0f, 0f, 100, default(Color), 2.5f); + int fireImpCastDust = Dust.NewDust(npc.position, npc.width, npc.height, DustID.Torch, 0f, 0f, 100, default(Color), 2.5f); Dust dust = Main.dust[fireImpCastDust]; dust.velocity *= 3f; Main.dust[fireImpCastDust].noGravity = true; @@ -5268,46 +5311,12 @@ namespace CalamityMod.NPCs npc.ai[0] = 2f; int targetTileX = (int)Main.player[npc.target].position.X / 16; int targetTileY = (int)Main.player[npc.target].position.Y / 16; - int npcTileX = (int)npc.position.X / 16; - int npcTileY = (int)npc.position.Y / 16; - int randTeleportOffset = 20; - int teleportTries = 0; - bool canTeleport = false; - if (Math.Abs(npc.position.X - Main.player[npc.target].position.X) + Math.Abs(npc.position.Y - Main.player[npc.target].position.Y) > 2000f) + Vector2 chosenTile = Vector2.Zero; + if (npc.AI_AttemptToFindTeleportSpot(ref chosenTile, targetTileX, targetTileY)) { - teleportTries = 100; - canTeleport = true; - } - while (!canTeleport && teleportTries < 100) - { - teleportTries++; - int teleportTileX = Main.rand.Next(targetTileX - randTeleportOffset, targetTileX + randTeleportOffset); - int teleportTileY = Main.rand.Next(targetTileY - randTeleportOffset, targetTileY + randTeleportOffset); - int dustIncrement; - for (int k = teleportTileY; k < targetTileY + randTeleportOffset; k = dustIncrement + 1) - { - if ((k < targetTileY - 4 || k > targetTileY + 4 || teleportTileX < targetTileX - 4 || teleportTileX > targetTileX + 4) && (k < npcTileY - 1 || k > npcTileY + 1 || teleportTileX < npcTileX - 1 || teleportTileX > npcTileX + 1) && Main.tile[teleportTileX, k].HasUnactuatedTile) - { - bool validTeleportSpot = true; - if ((npc.type == NPCID.DarkCaster || (npc.type >= NPCID.RaggedCaster && npc.type <= NPCID.DiabolistWhite)) && !Main.wallDungeon[(int)Main.tile[teleportTileX, k - 1].WallType]) - { - validTeleportSpot = false; - } - else if (Main.tile[teleportTileX, k - 1].LiquidType == LiquidID.Lava) - { - validTeleportSpot = false; - } - if (validTeleportSpot && Main.tileSolid[(int)Main.tile[teleportTileX, k].TileType] && !Collision.SolidTiles(teleportTileX - 1, teleportTileX + 1, k - 4, k - 1)) - { - npc.ai[1] = 20f; - npc.ai[2] = (float)teleportTileX; - npc.ai[3] = (float)k; - canTeleport = true; - break; - } - } - dustIncrement = k; - } + npc.ai[1] = 20f; + npc.ai[2] = chosenTile.X; + npc.ai[3] = chosenTile.Y; } npc.netUpdate = true; } @@ -5318,7 +5327,7 @@ namespace CalamityMod.NPCs { if (npc.ai[1] % 30f == 0f && npc.ai[1] / 30f < 5f) { - SoundEngine.PlaySound(SoundID.Item8, npc.position); + SoundEngine.PlaySound(SoundID.Item8, npc.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { Point spiritCenter = npc.Center.ToTileCoordinates(); @@ -5415,7 +5424,7 @@ namespace CalamityMod.NPCs { if (npc.type != NPCID.RuneWizard) { - SoundEngine.PlaySound(SoundID.Item8, npc.position); + SoundEngine.PlaySound(SoundID.Item8, npc.Center); } if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -5453,7 +5462,7 @@ namespace CalamityMod.NPCs { if (Main.rand.NextBool(5)) { - int shadowflameSpawnDust = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + 2f), npc.width, npc.height, 27, npc.velocity.X * 0.2f, npc.velocity.Y * 0.2f, 100, default(Color), 1.5f); + int shadowflameSpawnDust = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + 2f), npc.width, npc.height, DustID.Shadowflame, npc.velocity.X * 0.2f, npc.velocity.Y * 0.2f, 100, default(Color), 1.5f); Dust dust = Main.dust[shadowflameSpawnDust]; dust.noGravity = true; dust.velocity.X *= 0.5f; @@ -5462,9 +5471,9 @@ namespace CalamityMod.NPCs } else if (npc.type == NPCID.DarkCaster) { - if (Main.rand.Next(3) != 0) + if (!Main.rand.NextBool(3)) { - int waterSpawnDust = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + 2f), npc.width, npc.height, 172, npc.velocity.X * 0.2f, npc.velocity.Y * 0.2f, 100, default(Color), 0.9f); + int waterSpawnDust = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + 2f), npc.width, npc.height, DustID.DungeonWater, npc.velocity.X * 0.2f, npc.velocity.Y * 0.2f, 100, default(Color), 0.9f); Dust dust = Main.dust[waterSpawnDust]; dust.noGravity = true; dust.velocity.X *= 0.3f; @@ -5486,7 +5495,7 @@ namespace CalamityMod.NPCs { if (Main.rand.Next(255) > 255 - npc.alpha) { - int runeSpawnDust = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + 2f), npc.width, npc.height, 106, npc.velocity.X * 0.2f, npc.velocity.Y * 0.2f, 100, default(Color), 1.2f); + int runeSpawnDust = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + 2f), npc.width, npc.height, DustID.RuneWizard, npc.velocity.X * 0.2f, npc.velocity.Y * 0.2f, 100, default(Color), 1.2f); Dust dust = Main.dust[runeSpawnDust]; dust.noGravity = true; dust.velocity.X *= (0.1f + (float)Main.rand.Next(30) * 0.01f); @@ -5501,7 +5510,7 @@ namespace CalamityMod.NPCs { if (Main.rand.NextBool()) { - int necroSpawnDust = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + 2f), npc.width, npc.height, 173, 0f, 0f, 0, default(Color), 1f); + int necroSpawnDust = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + 2f), npc.width, npc.height, DustID.ShadowbeamStaff, 0f, 0f, 0, default(Color), 1f); Dust dust = Main.dust[necroSpawnDust]; dust.velocity.X *= 0.5f; dust.velocity.Y *= 0.5f; @@ -5511,7 +5520,7 @@ namespace CalamityMod.NPCs { if (Main.rand.NextBool()) { - int flameSpawnDust = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + 2f), npc.width, npc.height, 174, npc.velocity.X * 0.2f, npc.velocity.Y * 0.2f, 100, default(Color), 1f); + int flameSpawnDust = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + 2f), npc.width, npc.height, DustID.InfernoFork, npc.velocity.X * 0.2f, npc.velocity.Y * 0.2f, 100, default(Color), 1f); Dust dust = Main.dust[flameSpawnDust]; dust.noGravity = true; dust.velocity *= 0.4f; @@ -5523,7 +5532,7 @@ namespace CalamityMod.NPCs { if (Main.rand.NextBool()) { - int ghostSpawnDust = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + 2f), npc.width, npc.height, 175, npc.velocity.X * 0.2f, npc.velocity.Y * 0.2f, 100, default(Color), 0.1f); + int ghostSpawnDust = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + 2f), npc.width, npc.height, DustID.SpectreStaff, npc.velocity.X * 0.2f, npc.velocity.Y * 0.2f, 100, default(Color), 0.1f); Dust dust = Main.dust[ghostSpawnDust]; dust.noGravity = true; dust.velocity *= 0.5f; @@ -5539,7 +5548,7 @@ namespace CalamityMod.NPCs } if (Main.rand.NextBool()) { - int desertSpawnDust = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + 2f), npc.width, npc.height, 6, npc.velocity.X * 0.2f, npc.velocity.Y * 0.2f, 100, default(Color), 2f); + int desertSpawnDust = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + 2f), npc.width, npc.height, DustID.Torch, npc.velocity.X * 0.2f, npc.velocity.Y * 0.2f, 100, default(Color), 2f); Dust dust = Main.dust[desertSpawnDust]; dust.noGravity = true; dust.velocity.X *= 1f; @@ -5582,7 +5591,7 @@ namespace CalamityMod.NPCs minDistance = 225f; break; case NPCID.FungiBulb: - minDistance = 200f; + minDistance = !CalamityWorld.revenge ? 100f : 200f; break; case NPCID.AngryTrapper: acceleration = 0.05f; @@ -5697,7 +5706,7 @@ namespace CalamityMod.NPCs if (Main.netMode != NetmodeID.MultiplayerClient) { - if (npc.type == NPCID.Clinger && !Main.player[npc.target].dead) + if (npc.type == NPCID.Clinger && !Main.player[npc.target].DeadOrGhost) { if (npc.justHit) npc.localAI[0] = 0f; @@ -5721,17 +5730,19 @@ namespace CalamityMod.NPCs } } } - if (npc.type == NPCID.GiantFungiBulb && !Main.player[npc.target].dead) + + if ((npc.type == NPCID.GiantFungiBulb || npc.type == NPCID.FungiBulb) && !Main.player[npc.target].DeadOrGhost) { if (npc.justHit) npc.localAI[0] = 0f; npc.localAI[0] += 1f; - if (npc.localAI[0] >= 120f) + float sporeSpawnGateValue = npc.type == NPCID.GiantFungiBulb ? 120f : 240f; + if (npc.localAI[0] >= sporeSpawnGateValue) { if (!Collision.SolidCollision(npc.position, npc.width, npc.height)) { - float speed = 16f; + float speed = npc.type == NPCID.GiantFungiBulb ? 16f : 8f; distanceVector.X = Main.player[npc.target].Center.X - npc.Center.X; float absoluteYDistance = Math.Abs(distanceVector.X * 0.1f); if (Main.player[npc.target].Center.Y - npc.Center.Y > 0f) @@ -5741,7 +5752,7 @@ namespace CalamityMod.NPCs Vector2 velocity = npc.SafeDirectionTo(Main.player[npc.target].Center - npc.Center - Vector2.UnitY * absoluteYDistance, -Vector2.UnitY) * speed; - int idx = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.FungiSpore, 0, 0f, 0f, 0f, 0f, 255); + int idx = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.FungiSpore); Main.npc[idx].velocity = velocity; Main.npc[idx].netUpdate = true; npc.localAI[0] = 0f; @@ -5760,12 +5771,12 @@ namespace CalamityMod.NPCs { if (npc.type == NPCID.Hellbat || npc.type == NPCID.Lavabat) { - int lavaDust = Dust.NewDust(npc.position, npc.width, npc.height, 6, npc.velocity.X * 0.2f, npc.velocity.Y * 0.2f, 100, default(Color), 2f); + int lavaDust = Dust.NewDust(npc.position, npc.width, npc.height, DustID.Torch, npc.velocity.X * 0.2f, npc.velocity.Y * 0.2f, 100, default(Color), 2f); Main.dust[lavaDust].noGravity = true; } if (npc.type == NPCID.IceBat && Main.rand.NextBool(10)) { - int iceDust = Dust.NewDust(npc.position, npc.width, npc.height, 67, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f, 90, default(Color), 1.5f); + int iceDust = Dust.NewDust(npc.position, npc.width, npc.height, DustID.IceRod, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f, 90, default(Color), 1.5f); Main.dust[iceDust].noGravity = true; Dust dust = Main.dust[iceDust]; dust.velocity *= 0.2f; @@ -6296,6 +6307,10 @@ namespace CalamityMod.NPCs #region Jellyfish AI public static bool BuffedJellyfishAI(NPC npc, Mod mod) { + // Avoid cheap bullshit + float damagingVelocity = npc.type == NPCID.GreenJellyfish ? 7.2f : 5.6f; + npc.damage = (npc.dontTakeDamage || npc.velocity.Length() > damagingVelocity) ? npc.defDamage : 0; + // Stop moving because we're emitting electricity and don't take damage bool endEarly = false; if (npc.wet && npc.ai[1] == 1f) @@ -6564,7 +6579,7 @@ namespace CalamityMod.NPCs { if (npc.ai[0] == 200f) { - SoundEngine.PlaySound(SoundID.NPCDeath13, npc.position); + SoundEngine.PlaySound(SoundID.NPCDeath13, npc.Center); } npc.ai[0] -= 1f; } @@ -6631,7 +6646,7 @@ namespace CalamityMod.NPCs npc.noTileCollide = false; if (Main.rand.NextBool()) { - int sand = Dust.NewDust(new Vector2(npc.position.X - 4f, npc.position.Y + (float)npc.height - 8f), npc.width + 8, 24, 32, 0f, npc.velocity.Y / 2f, 0, default(Color), 1f); + int sand = Dust.NewDust(new Vector2(npc.position.X - 4f, npc.position.Y + (float)npc.height - 8f), npc.width + 8, 24, DustID.Sand, 0f, npc.velocity.Y / 2f, 0, default(Color), 1f); Dust dust = Main.dust[sand]; dust.velocity.X *= 0.4f; dust.velocity.Y *= -1f; @@ -6943,14 +6958,14 @@ namespace CalamityMod.NPCs if (Main.rand.NextBool(6)) { - int pixieDust = Dust.NewDust(npc.position, npc.width, npc.height, 55, 0f, 0f, 200, npc.color, 1f); + int pixieDust = Dust.NewDust(npc.position, npc.width, npc.height, DustID.Pixie, 0f, 0f, 200, npc.color, 1f); Dust dust = Main.dust[pixieDust]; dust.velocity *= 0.3f; } if (Main.rand.NextBool(40)) { - SoundEngine.PlaySound(SoundID.Pixie, npc.position); + SoundEngine.PlaySound(SoundID.Pixie, npc.Center); } } else if (npc.type == NPCID.IceElemental) @@ -6961,7 +6976,7 @@ namespace CalamityMod.NPCs if (Main.rand.NextBool(3)) { - int iceEleDust = Dust.NewDust(npc.position, npc.width, npc.height, 92, 0f, 0f, 200, default(Color), 1f); + int iceEleDust = Dust.NewDust(npc.position, npc.width, npc.height, DustID.Frost, 0f, 0f, 200, default(Color), 1f); Dust dust = Main.dust[iceEleDust]; dust.velocity *= 0.3f; Main.dust[iceEleDust].noGravity = true; @@ -7438,7 +7453,7 @@ namespace CalamityMod.NPCs if (npc.ai[3] == 0f) { npc.position.X += 8f; - if (npc.position.Y / 16f > Main.maxTilesY - 200f) + if (npc.position.Y / 16f > Main.UnderworldLayer) { npc.ai[3] = 3f; } @@ -7464,6 +7479,9 @@ namespace CalamityMod.NPCs // Sitting around, waiting for a potential player if (npc.ai[0] == 0f) { + // Avoid cheap bullshit + npc.damage = 0; + if (!isLostHoppingPresent) { npc.TargetClosest(true); @@ -7489,6 +7507,9 @@ namespace CalamityMod.NPCs } else if (npc.velocity.Y == 0f) { + // Avoid cheap bullshit + npc.damage = 0; + npc.ai[2] += 1f; int timeSpentStopping = 20; @@ -7533,6 +7554,9 @@ namespace CalamityMod.NPCs } else { + // Set damage + npc.damage = npc.defDamage; + if (npc.direction == 1 && npc.velocity.X < 1f) { npc.velocity.X += 0.1f; @@ -7667,7 +7691,7 @@ namespace CalamityMod.NPCs if (npc.ai[1] < 30f) { Vector2 nebulaBeastDustRotation = npc.Center + Vector2.UnitX * (float)npc.spriteDirection * -20f; - Dust nebulaBeastDust = Main.dust[Dust.NewDust(nebulaBeastDustRotation, 0, 0, 242, 0f, 0f, 0, default(Color), 1f)]; + Dust nebulaBeastDust = Main.dust[Dust.NewDust(nebulaBeastDustRotation, 0, 0, DustID.PinkTorch, 0f, 0f, 0, default(Color), 1f)]; Vector2 nebulaBeastDustVelocity = Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi); nebulaBeastDust.position = nebulaBeastDustRotation + nebulaBeastDustVelocity * 20f; nebulaBeastDust.velocity = -nebulaBeastDustVelocity * 2f; @@ -7680,7 +7704,7 @@ namespace CalamityMod.NPCs for (int l = 0; l < 20; l++) { Vector2 nebulaBeastDustRotation2 = npc.Center + Vector2.UnitX * (float)npc.spriteDirection * -20f; - Dust nebulaBeastDust2 = Main.dust[Dust.NewDust(nebulaBeastDustRotation2, 0, 0, 242, 0f, 0f, 0, default(Color), 1f)]; + Dust nebulaBeastDust2 = Main.dust[Dust.NewDust(nebulaBeastDustRotation2, 0, 0, DustID.PinkTorch, 0f, 0f, 0, default(Color), 1f)]; Vector2 nebulaBeastDustVelocity2 = Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi); nebulaBeastDust2.position = nebulaBeastDustRotation2 + nebulaBeastDustVelocity2 * 4f; nebulaBeastDust2.velocity = nebulaBeastDustVelocity2 * 4f + Vector2.UnitX * Main.rand.NextFloat() * (float)npc.spriteDirection * -5f; @@ -8012,7 +8036,7 @@ namespace CalamityMod.NPCs { if (Main.rand.NextBool(3)) { - Dust nebulaBeastIdleDust = Main.dust[Dust.NewDust(hitbox.TopLeft(), hitbox.Width, hitbox.Height, 242, 0f, 0f, 0, default(Color), 1f)]; + Dust nebulaBeastIdleDust = Main.dust[Dust.NewDust(hitbox.TopLeft(), hitbox.Width, hitbox.Height, DustID.PinkTorch, 0f, 0f, 0, default(Color), 1f)]; nebulaBeastIdleDust.velocity = Vector2.Zero; nebulaBeastIdleDust.noGravity = true; nebulaBeastIdleDust.fadeIn = 1f; @@ -8087,7 +8111,7 @@ namespace CalamityMod.NPCs if (npc.type == NPCID.IceTortoise && Main.rand.NextBool(10)) { - int iceTortoiseDust = Dust.NewDust(npc.position, npc.width, npc.height, 67, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f, 90, default(Color), 1.5f); + int iceTortoiseDust = Dust.NewDust(npc.position, npc.width, npc.height, DustID.IceRod, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f, 90, default(Color), 1.5f); Main.dust[iceTortoiseDust].noGravity = true; Dust dust = Main.dust[iceTortoiseDust]; dust.velocity *= 0.2f; @@ -8141,7 +8165,9 @@ namespace CalamityMod.NPCs } npc.defense = npc.defDefense; - npc.damage = npc.defDamage; + + // Avoid cheap bullshit + npc.damage = 0; if (npc.type == NPCID.GiantShelly || npc.type == NPCID.GiantShelly2) { @@ -8283,6 +8309,9 @@ namespace CalamityMod.NPCs } else if (npc.ai[0] == 1f) { + // Avoid cheap bullshit + npc.damage = 0; + npc.velocity.X = npc.velocity.X * 0.5f; if (npc.type == NPCID.GiantShelly || npc.type == NPCID.GiantShelly2) @@ -8315,7 +8344,7 @@ namespace CalamityMod.NPCs { if (npc.type == NPCID.IceTortoise && Main.rand.Next(3) < 2) { - int iceTortoiseSpinDust = Dust.NewDust(npc.position, npc.width, npc.height, 67, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f, 90, default(Color), 1.5f); + int iceTortoiseSpinDust = Dust.NewDust(npc.position, npc.width, npc.height, DustID.IceRod, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f, 90, default(Color), 1.5f); Main.dust[iceTortoiseSpinDust].noGravity = true; Dust dust = Main.dust[iceTortoiseSpinDust]; dust.velocity *= 0.2f; @@ -8323,11 +8352,11 @@ namespace CalamityMod.NPCs if (npc.type == NPCID.GiantShelly || npc.type == NPCID.GiantShelly2) { - npc.damage = (int)(npc.defDamage * 1.35); + npc.damage = (int)Math.Round(npc.defDamage * 1.2); } else { - npc.damage = (int)(npc.defDamage * 1.8); + npc.damage = (int)Math.Round(npc.defDamage * 1.4); } npc.defense = npc.defDefense * 2; @@ -8415,6 +8444,9 @@ namespace CalamityMod.NPCs if (npc.ai[0] == 4f) { + // Avoid cheap bullshit + npc.damage = 0; + if (npc.wet && npc.directionY < 0) { npc.velocity.Y = npc.velocity.Y - 0.45f; @@ -8445,13 +8477,13 @@ namespace CalamityMod.NPCs { if (npc.ai[0] == 6f) { - npc.damage = (int)(npc.defDamage * 1.4); + npc.damage = (int)Math.Round(npc.defDamage * 1.2); npc.defense = npc.defDefense * 2; npc.knockBackResist = 0f; if (Main.rand.Next(3) < 2) { - int spinAttackDust = Dust.NewDust(npc.Center - new Vector2(30f), 60, 60, 6, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f, 90, default(Color), 1.5f); + int spinAttackDust = Dust.NewDust(npc.Center - new Vector2(30f), 60, 60, DustID.Torch, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f, 90, default(Color), 1.5f); Dust dust = Main.dust[spinAttackDust]; dust.noGravity = true; dust.velocity *= 0.2f; @@ -8466,11 +8498,11 @@ namespace CalamityMod.NPCs Vector2 vector68 = npc.Center - new Vector2(50f); for (int i = 0; i < 32; i++) { - int spinEndDust = Dust.NewDust(vector68, 100, 100, 6, 0f, 0f, 100, default(Color), 2.5f); + int spinEndDust = Dust.NewDust(vector68, 100, 100, DustID.Torch, 0f, 0f, 100, default(Color), 2.5f); Dust dust = Main.dust[spinEndDust]; dust.noGravity = true; dust.velocity *= 3f; - spinEndDust = Dust.NewDust(vector68, 100, 100, 6, 0f, 0f, 100, default(Color), 1.5f); + spinEndDust = Dust.NewDust(vector68, 100, 100, DustID.Torch, 0f, 0f, 100, default(Color), 1.5f); dust.velocity *= 2f; dust.noGravity = true; } @@ -8490,7 +8522,7 @@ namespace CalamityMod.NPCs for (int k = 0; k < 5; k++) { - int moreSpinEndDust = Dust.NewDust(npc.position, npc.width, npc.height, 31, 0f, 0f, 100, default(Color), 1.5f); + int moreSpinEndDust = Dust.NewDust(npc.position, npc.width, npc.height, DustID.Smoke, 0f, 0f, 100, default(Color), 1.5f); Main.dust[moreSpinEndDust].velocity *= Main.rand.NextFloat(); } @@ -8566,6 +8598,9 @@ namespace CalamityMod.NPCs if (npc.ai[0] == 5f) { + // Avoid cheap bullshit + npc.damage = 0; + npc.rotation = 0f; npc.velocity.X = 0f; @@ -8975,6 +9010,9 @@ namespace CalamityMod.NPCs } } + // Avoid cheap bullshit + npc.damage = (npc.velocity.Y == 0f || npc.velocity.Length() < 3f) ? 0 : npc.defDamage; + if (npc.velocity.Y == 0f) { if (npc.ai[3] == npc.position.X) @@ -9176,7 +9214,7 @@ namespace CalamityMod.NPCs npc.netUpdate = true; for (int i = 0; i < 15; i++) { - Dust eyeFishDust = Dust.NewDustDirect(npc.position, npc.width, npc.height, 5); + Dust eyeFishDust = Dust.NewDustDirect(npc.position, npc.width, npc.height, DustID.Blood); Dust dust = eyeFishDust; dust.velocity *= 0.5f; eyeFishDust.scale = 1f + Main.rand.NextFloat() * 0.5f; @@ -9194,7 +9232,7 @@ namespace CalamityMod.NPCs { for (int j = 0; j < 2; j++) { - Dust eyeFishDust2 = Dust.NewDustDirect(npc.position, npc.width, npc.height, 5); + Dust eyeFishDust2 = Dust.NewDustDirect(npc.position, npc.width, npc.height, DustID.Blood); Dust dust = eyeFishDust2; dust.velocity *= 1f; eyeFishDust2.scale = 1f + Main.rand.NextFloat() * 0.5f; @@ -9206,7 +9244,7 @@ namespace CalamityMod.NPCs if (Main.rand.NextBool(3)) { - Dust eyeFishIdleDust = Dust.NewDustDirect(npc.position, npc.width, npc.height, 5); + Dust eyeFishIdleDust = Dust.NewDustDirect(npc.position, npc.width, npc.height, DustID.Blood); Dust dust = eyeFishIdleDust; dust.velocity *= 0f; eyeFishIdleDust.alpha = 120; @@ -9471,7 +9509,7 @@ namespace CalamityMod.NPCs public static bool BuffedSporeAI(NPC npc, Mod mod) { if (npc.type == NPCID.Spore) - Lighting.AddLight(npc.Center, 0.2f, 0.1f, 0.2f); + Lighting.AddLight(npc.Center, 0.5f, 0.2f, 0.5f); if (npc.timeLeft > 5) npc.timeLeft = 5; @@ -9487,8 +9525,8 @@ namespace CalamityMod.NPCs if (npc.ai[0] != -1f) { npc.TargetClosest(true); - float acceleration = Main.expertMode ? 0.2f : 0.1f; - float velocity = Main.expertMode ? 5f : 3f; + float acceleration = Main.masterMode ? 0.25f : Main.expertMode ? 0.2f : 0.1f; + float velocity = Main.masterMode ? 6f : Main.expertMode ? 5f : 3f; if (CalamityWorld.death) { acceleration *= 1.25f; @@ -9592,13 +9630,13 @@ namespace CalamityMod.NPCs break; } - int idx = Dust.NewDust(npc.Center, 0, 0, 226, 0f, 0f, 100, default, 0.5f); + int idx = Dust.NewDust(npc.Center, 0, 0, DustID.Electric, 0f, 0f, 100, default, 0.5f); Main.dust[idx].noGravity = true; Main.dust[idx].position = npc.Center + spinningpoint * scaleFactor2 + dustSpawnDelta; Main.dust[idx].velocity = Vector2.Zero; spinningpoint *= -1f; - idx = Dust.NewDust(npc.Center, 0, 0, 226, 0f, 0f, 100, default, 0.5f); + idx = Dust.NewDust(npc.Center, 0, 0, DustID.Electric, 0f, 0f, 100, default, 0.5f); Main.dust[idx].noGravity = true; Main.dust[idx].position = npc.Center + spinningpoint * scaleFactor2 + dustSpawnDelta; Main.dust[idx].velocity = Vector2.Zero; @@ -9719,7 +9757,7 @@ namespace CalamityMod.NPCs // Drone dust if (npc.type == NPCID.MartianDrone && npc.ai[0] != 3f) { - int idx = Dust.NewDust(npc.position, npc.width, npc.height, 226, 0f, 0f, 100, default, 0.5f); + int idx = Dust.NewDust(npc.position, npc.width, npc.height, DustID.Electric, 0f, 0f, 100, default, 0.5f); Main.dust[idx].noGravity = true; Main.dust[idx].velocity = npc.velocity / 5f; Vector2 rotationVector = new Vector2(-10f, 10f); @@ -9741,7 +9779,7 @@ namespace CalamityMod.NPCs { if (Main.rand.Next(3) < dustSpawnChance) { - int idx = Dust.NewDust(npc.Center - new Vector2(dustSpawnAreaSize), dustSpawnAreaSize * 2, dustSpawnAreaSize * 2, 6, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f, 90, default, 1.5f); + int idx = Dust.NewDust(npc.Center - new Vector2(dustSpawnAreaSize), dustSpawnAreaSize * 2, dustSpawnAreaSize * 2, DustID.Torch, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f, 90, default, 1.5f); Main.dust[idx].noGravity = true; Dust dust = Main.dust[idx]; dust.velocity *= 0.2f; @@ -9753,6 +9791,9 @@ namespace CalamityMod.NPCs // Move upward. if (npc.ai[0] == 0f) { + // Avoid cheap bullshit + npc.damage = 0; + npc.knockBackResist = npcKBResist; Vector2 playerDistanceNorm = Main.player[npc.target].Center - npc.Center; Vector2 upwardVelocity = playerDistanceNorm - Vector2.UnitY * idealUpwardDelta; @@ -9803,18 +9844,36 @@ namespace CalamityMod.NPCs // Slow down and prepare for charge. else if (npc.ai[0] == 1f) { + // Avoid cheap bullshit + npc.damage = 0; + npc.knockBackResist = 0f; - npc.velocity *= chargeWaitSlowdownMult; + + bool decelerate = true; + if (npc.type == NPCID.SolarCorite) + { + decelerate = npc.velocity.Length() > 2f; + if (!decelerate && npc.target >= 0 && !Main.player[npc.target].DeadOrGhost) + { + Vector2 maxVelocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.Zero) * 0.1f; + npc.velocity = Vector2.Lerp(npc.velocity, maxVelocity, 0.25f); + } + } + + if (decelerate) + npc.velocity *= chargeWaitSlowdownMult; npc.ai[1] += 1f; // If enough time has passed, charge. if (npc.ai[1] >= chargePhaseWait) { + // Set damage + npc.damage = npc.defDamage; + npc.ai[0] = 2f; npc.ai[1] = 0f; npc.netUpdate = true; - Vector2 velocity = new Vector2(npc.ai[2], npc.ai[3]) + - new Vector2(Main.rand.Next(-chargeRandomness, chargeRandomness + 1), Main.rand.Next(-chargeRandomness, chargeRandomness + 1)) * 0.04f; + Vector2 velocity = new Vector2(npc.ai[2], npc.ai[3]) + new Vector2(Main.rand.Next(-chargeRandomness, chargeRandomness + 1), Main.rand.Next(-chargeRandomness, chargeRandomness + 1)) * 0.04f; velocity.Normalize(); velocity *= chargeSpeed; npc.velocity = velocity; @@ -9823,7 +9882,7 @@ namespace CalamityMod.NPCs // Spawn some cool dust. if (npc.type == NPCID.MartianDrone && Main.rand.NextBool(4)) { - int idx = Dust.NewDust(npc.position, npc.width, npc.height, 226, 0f, 0f, 100, default, 0.5f); + int idx = Dust.NewDust(npc.position, npc.width, npc.height, DustID.Electric, 0f, 0f, 100, default, 0.5f); Main.dust[idx].noGravity = true; Dust dust = Main.dust[idx]; dust.velocity *= 2f; @@ -9832,6 +9891,9 @@ namespace CalamityMod.NPCs } else if (npc.ai[0] == 2f) { + // Set damage + npc.damage = npc.defDamage; + npc.knockBackResist = 0f; npc.ai[1] += 1f; @@ -9839,6 +9901,9 @@ namespace CalamityMod.NPCs // If time is up and the player is (relatively) far, or the velocity is (relatively) low, reset. if ((npc.ai[1] >= maximumChargeTime & aboveAndFar) || npc.velocity.Length() < minimumChargeSpeed) { + // Avoid cheap bullshit + npc.damage = 0; + npc.ai[0] = 0f; npc.ai[1] = 0f; npc.ai[2] = 0f; @@ -9875,6 +9940,9 @@ namespace CalamityMod.NPCs } else if (npc.ai[0] == 4f) { + // Avoid cheap bullshit + npc.damage = 0; + npc.ai[1] -= 3f; if (npc.ai[1] <= 0f) { @@ -9895,23 +9963,24 @@ namespace CalamityMod.NPCs npc.netUpdate = true; } - // Dust + // Explode if (npc.ai[0] == 3f) { + // Set damage + npc.damage = npc.defDamage; + npc.position = npc.Center; npc.width = npc.height = CalamityWorld.death ? 360 : 240; npc.position -= npc.Size; npc.velocity = Vector2.Zero; - npc.damage = 160; - npc.alpha = 255; Lighting.AddLight((int)npc.Center.X / 16, (int)npc.Center.Y / 16, 0.2f, 0.7f, 1.1f); for (int i = 0; i < 10; i++) { - int idx = Dust.NewDust(npc.position, npc.width, npc.height, 31, 0f, 0f, 100, default, 1.5f); + int idx = Dust.NewDust(npc.position, npc.width, npc.height, DustID.Smoke, 0f, 0f, 100, default, 1.5f); Dust dust = Main.dust[idx]; dust.velocity *= 1.4f; Main.dust[idx].position = ((float)Main.rand.NextDouble() * MathHelper.TwoPi).ToRotationVector2() * ((float)Main.rand.NextDouble() * 96f) + npc.Center; @@ -9919,7 +9988,7 @@ namespace CalamityMod.NPCs for (int i = 0; i < 40; i++) { - int idx = Dust.NewDust(npc.position, npc.width, npc.height, 226, 0f, 0f, 100, default, 0.5f); + int idx = Dust.NewDust(npc.position, npc.width, npc.height, DustID.Electric, 0f, 0f, 100, default, 0.5f); Main.dust[idx].noGravity = true; Dust dust = Main.dust[idx]; dust.velocity *= 2f; @@ -9928,7 +9997,7 @@ namespace CalamityMod.NPCs if (Main.rand.NextBool()) { - idx = Dust.NewDust(npc.position, npc.width, npc.height, 226, 0f, 0f, 100, default, 0.9f); + idx = Dust.NewDust(npc.position, npc.width, npc.height, DustID.Electric, 0f, 0f, 100, default, 0.9f); Main.dust[idx].noGravity = true; dust = Main.dust[idx]; dust.velocity *= 1.2f; @@ -9938,7 +10007,7 @@ namespace CalamityMod.NPCs if (Main.rand.NextBool(4)) { - idx = Dust.NewDust(npc.position, npc.width, npc.height, 226, 0f, 0f, 100, default, 0.7f); + idx = Dust.NewDust(npc.position, npc.width, npc.height, DustID.Electric, 0f, 0f, 100, default, 0.7f); dust = Main.dust[idx]; dust.velocity *= 1.2f; Main.dust[idx].position = ((float)Main.rand.NextDouble() * MathHelper.TwoPi).ToRotationVector2() * ((float)Main.rand.NextDouble() * 96f) + npc.Center; @@ -9949,7 +10018,7 @@ namespace CalamityMod.NPCs npc.ai[1] += 1f; if (npc.ai[1] >= 3f) { - SoundEngine.PlaySound(SoundID.Item14, npc.position); + SoundEngine.PlaySound(SoundID.Item14, npc.Center); npc.life = 0; npc.HitEffect(0, 10.0); npc.active = false; @@ -10082,7 +10151,7 @@ namespace CalamityMod.NPCs if ((int)npc.ai[1] == NPCID.Mothron) { - npc.defense = (int)(npc.defDefense * 1.5); + npc.defense = (int)Math.Round(npc.defDefense * 1.5); npc.scale *= 2f; npc.width = npc.height = (int)(34f * npc.scale); npc.netUpdate = true; @@ -10136,7 +10205,12 @@ namespace CalamityMod.NPCs { npc.noGravity = true; npc.noTileCollide = false; + + // Set damage + npc.damage = npc.defDamage; + npc.defense = npc.defDefense; + if (npc.justHit && Main.netMode != NetmodeID.MultiplayerClient && Main.rand.NextBool(10)) { npc.netUpdate = true; @@ -10145,7 +10219,11 @@ namespace CalamityMod.NPCs } if (npc.ai[0] == -1f) { + // Avoid cheap bullshit + npc.damage = 0; + npc.defense = npc.defDefense + 10; + npc.noGravity = false; npc.velocity.X *= 0.98f; npc.ai[1] += 1f; @@ -10325,6 +10403,10 @@ namespace CalamityMod.NPCs npc.noTileCollide = false; if (npc.ai[0] == 0f) { + // Avoid cheap bullshit + if (npc.type == NPCID.DeadlySphere || npc.type == NPCID.NebulaHeadcrab) + npc.damage = 0; + npc.TargetClosest(); if (Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1)) { @@ -10384,6 +10466,12 @@ namespace CalamityMod.NPCs } else if (npc.ai[0] == 1f) { + // Set damage or avoid cheap bullshit + if (npc.type == NPCID.DeadlySphere) + npc.damage = npc.defDamage; + else if (npc.type == NPCID.NebulaHeadcrab) + npc.damage = 0; + npc.rotation += npc.direction * 0.3f; Vector2 attacktargetDirection = Main.player[npc.target].Center - npc.Center; if (npc.type == NPCID.NebulaHeadcrab) @@ -10427,6 +10515,10 @@ namespace CalamityMod.NPCs } else if (npc.ai[0] == 2f) { + // Avoid cheap bullshit + if (npc.type == NPCID.DeadlySphere || npc.type == NPCID.NebulaHeadcrab) + npc.damage = 0; + npc.rotation = npc.velocity.X * 0.1f; npc.noTileCollide = true; Vector2 idleTargetDirection = Main.player[npc.target].Center - npc.Center; @@ -10441,6 +10533,10 @@ namespace CalamityMod.NPCs } else if (npc.ai[0] == 3f) { + // Avoid cheap bullshit + if (npc.type == NPCID.DeadlySphere || npc.type == NPCID.NebulaHeadcrab) + npc.damage = 0; + npc.rotation = npc.velocity.X * 0.1f; Vector2 blockedCellCenter = new Vector2(npc.ai[1], npc.ai[2]); Vector2 blockedCellDirection = blockedCellCenter - npc.Center; @@ -10461,6 +10557,10 @@ namespace CalamityMod.NPCs } else if (npc.ai[0] == 4f) { + // Avoid cheap bullshit + if (npc.type == NPCID.DeadlySphere || npc.type == NPCID.NebulaHeadcrab) + npc.damage = 0; + npc.rotation = npc.velocity.X * 0.1f; if (npc.collideX) npc.velocity.X *= -0.8f; @@ -10523,12 +10623,18 @@ namespace CalamityMod.NPCs Player player8 = Main.player[npc.target]; if (!player8.active || player8.dead) { + // Avoid cheap bullshit + npc.damage = 0; + npc.ai[0] = 0f; npc.ai[1] = 0f; npc.netUpdate = true; } else { + // Set damage + npc.damage = npc.defDamage; + npc.Center = ((player8.gravDir == 1f) ? player8.Top : player8.Bottom) + new Vector2(player8.direction * 4, 0f); npc.gfxOffY = player8.gfxOffY; npc.velocity = Vector2.Zero; @@ -10646,7 +10752,7 @@ namespace CalamityMod.NPCs apparitionCenter += apparitionRandVelocity; apparitionRandVelocity.Normalize(); apparitionRandVelocity *= Main.rand.Next(50, 90) * 0.2f; - int shadowflameDust = Dust.NewDust(apparitionCenter, 1, 1, 27); + int shadowflameDust = Dust.NewDust(apparitionCenter, 1, 1, DustID.Shadowflame); Main.dust[shadowflameDust].velocity = -apparitionRandVelocity * 0.3f; Main.dust[shadowflameDust].alpha = 100; if (Main.rand.NextBool()) @@ -10668,7 +10774,7 @@ namespace CalamityMod.NPCs if (Main.rand.NextBool(5)) { npc.position += npc.netOffset; - int idleShadowflameDust = Dust.NewDust(npc.position, npc.width, npc.height, 27); + int idleShadowflameDust = Dust.NewDust(npc.position, npc.width, npc.height, DustID.Shadowflame); Main.dust[idleShadowflameDust].alpha = 100; Dust dust = Main.dust[idleShadowflameDust]; dust.velocity *= 0.3f; @@ -10700,7 +10806,7 @@ namespace CalamityMod.NPCs for (int l = 0; l < 2; l++) { npc.position += npc.netOffset; - int visionDust = Dust.NewDust(npc.position - new Vector2(dustPosition), npc.width + dustPosition * 2, npc.height + dustPosition * 2, 228, 0f, 0f, 100, default(Color), 2f); + int visionDust = Dust.NewDust(npc.position - new Vector2(dustPosition), npc.width + dustPosition * 2, npc.height + dustPosition * 2, DustID.GoldFlame, 0f, 0f, 100, default(Color), 2f); Main.dust[visionDust].noGravity = true; Main.dust[visionDust].noLight = true; npc.position -= npc.netOffset; @@ -10836,7 +10942,7 @@ namespace CalamityMod.NPCs int squidDustVelocity = 10; npc.position += npc.netOffset; - int squidDust = Dust.NewDust(npc.position - new Vector2(squidDustVelocity), npc.width + squidDustVelocity * 2, npc.height + squidDustVelocity * 2, 228, 0f, 0f, 100, default(Color), 2f); + int squidDust = Dust.NewDust(npc.position - new Vector2(squidDustVelocity), npc.width + squidDustVelocity * 2, npc.height + squidDustVelocity * 2, DustID.GoldFlame, 0f, 0f, 100, default(Color), 2f); Main.dust[squidDust].noGravity = true; Main.dust[squidDust].noLight = true; @@ -10850,6 +10956,9 @@ namespace CalamityMod.NPCs #region Big Mimic AI public static bool BuffedBigMimicAI(NPC npc, Mod mod) { + // Set damage + npc.damage = npc.defDamage; + npc.knockBackResist = 0.2f * Main.GameModeInfo.KnockbackToEnemiesMultiplier; npc.dontTakeDamage = false; npc.noTileCollide = false; @@ -10971,10 +11080,13 @@ namespace CalamityMod.NPCs } else if (npc.ai[0] == 3f) { + // Avoid cheap bullshit + npc.damage = 0; + npc.velocity.X *= 0.85f; npc.dontTakeDamage = true; npc.ai[1] += 1f; - if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[1] >= (CalamityWorld.death ? 60f : 120f)) + if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[1] >= (CalamityWorld.death ? 60f : 90f)) { npc.ai[0] = 2f; npc.ai[1] = 0f; @@ -11251,7 +11363,7 @@ namespace CalamityMod.NPCs } Vector2 dustRotation = cellCenter + ((float)Main.rand.NextDouble() * ((float)Math.PI * 2f)).ToRotationVector2() * (12f - dustAmt * 2); - int cellDust = Dust.NewDust(dustRotation - Vector2.One * 12f, 24, 24, 226, npc.velocity.X / 2f, npc.velocity.Y / 2f); + int cellDust = Dust.NewDust(dustRotation - Vector2.One * 12f, 24, 24, DustID.Electric, npc.velocity.X / 2f, npc.velocity.Y / 2f); Dust dust = Main.dust[cellDust]; dust.position -= new Vector2(2f); Main.dust[cellDust].velocity = Vector2.Normalize(cellCenter - dustRotation) * 1.5f * (10f - dustAmt * 2f) / 10f; diff --git a/NPCs/VanillaNPCOverrides/RegularEnemies/SlimeAI.cs b/NPCs/VanillaNPCAIOverrides/RegularEnemies/SlimeAI.cs similarity index 95% rename from NPCs/VanillaNPCOverrides/RegularEnemies/SlimeAI.cs rename to NPCs/VanillaNPCAIOverrides/RegularEnemies/SlimeAI.cs index eb02b4c0f8..eed910dcfe 100644 --- a/NPCs/VanillaNPCOverrides/RegularEnemies/SlimeAI.cs +++ b/NPCs/VanillaNPCAIOverrides/RegularEnemies/SlimeAI.cs @@ -1,14 +1,14 @@ -using CalamityMod.NPCs.AcidRain; +using System; +using CalamityMod.NPCs.AcidRain; using CalamityMod.NPCs.Crags; using CalamityMod.NPCs.NormalNPCs; using CalamityMod.World; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.NPCs.VanillaNPCOverrides.RegularEnemies +namespace CalamityMod.NPCs.VanillaNPCAIOverrides.RegularEnemies { public static class SlimeAI { @@ -88,6 +88,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.RegularEnemies public static bool BuffedSlimeAI(NPC npc, Mod mod) { + bool isSpikedSlime = npc.type == NPCID.SlimeSpiked || npc.type == NPCID.SpikedIceSlime || npc.type == NPCID.SpikedJungleSlime || npc.type == ModContent.NPCType(); bool isLavaSlime = npc.type == NPCID.LavaSlime || npc.type == ModContent.NPCType(); bool canShootProjectile = npc.type == NPCID.SpikedIceSlime || npc.type == NPCID.SlimeSpiked || npc.type == NPCID.SpikedJungleSlime; int projectileShootType = -1; @@ -138,14 +139,14 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.RegularEnemies // Have corrupt slimes emit demonite dust. if (npc.type == NPCID.CorruptSlime && Main.rand.NextBool(30)) { - Dust demonite = Dust.NewDustDirect(npc.position, npc.width, npc.height, 14, 0f, 0f, npc.alpha, npc.color, 1f); + Dust demonite = Dust.NewDustDirect(npc.position, npc.width, npc.height, DustID.Demonite, 0f, 0f, npc.alpha, npc.color, 1f); demonite.velocity *= 0.3f; } // Have ice slimes emit snow dust. if ((npc.type == NPCID.IceSlime || npc.type == NPCID.SpikedIceSlime) && Main.rand.NextBool(10)) { - Dust snow = Dust.NewDustDirect(npc.position, npc.width, npc.height, 76, 0f, 0f, 0, default, 1f); + Dust snow = Dust.NewDustDirect(npc.position, npc.width, npc.height, DustID.Snow, 0f, 0f, 0, default, 1f); snow.noGravity = true; snow.velocity *= 0.1f; } @@ -156,7 +157,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.RegularEnemies Lighting.AddLight((int)(npc.Center.X / 16f), (int)(npc.Center.Y / 16f), 1f, 0.3f, 0.1f); // And fire. dust. - int idx = Dust.NewDust(npc.position, npc.width, npc.height, 6, npc.velocity.X * 0.2f, npc.velocity.Y * 0.2f, 100, default, 1.7f); + int idx = Dust.NewDust(npc.position, npc.width, npc.height, DustID.Torch, npc.velocity.X * 0.2f, npc.velocity.Y * 0.2f, 100, default, 1.7f); Main.dust[idx].noGravity = true; } @@ -226,6 +227,10 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.RegularEnemies npc.TargetClosest(); } + // Avoid cheap bullshit + if (!isSpikedSlime) + npc.damage = (npc.velocity.Y == 0f || npc.velocity.Length() < 3f) ? 0 : npc.defDamage; + if (npc.velocity.Y == 0f) { // Slide out of blocks if stuck. diff --git a/NPCs/VanillaNPCOverrides/Bosses/BrainOfCthulhuAI.cs b/NPCs/VanillaNPCOverrides/Bosses/BrainOfCthulhuAI.cs deleted file mode 100644 index 9df41cebe8..0000000000 --- a/NPCs/VanillaNPCOverrides/Bosses/BrainOfCthulhuAI.cs +++ /dev/null @@ -1,714 +0,0 @@ -using CalamityMod.Events; -using CalamityMod.World; -using Microsoft.Xna.Framework; -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Audio; - -namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses -{ - public static class BrainOfCthulhuAI - { - public static bool BuffedBrainofCthulhuAI(NPC npc, Mod mod) - { - // whoAmI variable - NPC.crimsonBoss = npc.whoAmI; - - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; - - // Get a target - 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(); - - float enrageScale = bossRush ? 1f : 0f; - if ((npc.position.Y / 16f) < Main.worldSurface || bossRush) - { - npc.Calamity().CurrentlyEnraged = !bossRush; - enrageScale += 1f; - } - if (!Main.player[npc.target].ZoneCrimson || bossRush) - { - npc.Calamity().CurrentlyEnraged = !bossRush; - enrageScale += 2f; - } - - // Extra distance for teleports if enraged - int teleportDistanceIncrease = (int)(enrageScale * 3); - - // Spawn Creepers - if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] == 0f) - { - npc.localAI[0] = 1f; - int brainOfCthuluCreepersCount = GetBrainOfCthuluCreepersCountRevDeath(); - for (int i = 0; i < brainOfCthuluCreepersCount; i++) - { - float brainX = npc.Center.X; - float brainY = npc.Center.Y; - brainX += Main.rand.Next(-npc.width, npc.width); - brainY += Main.rand.Next(-npc.height, npc.height); - - int creeperSpawn = NPC.NewNPC(npc.GetSource_FromAI(), (int)brainX, (int)brainY, NPCID.Creeper, 0, 0f, 0f, 0f, 0f, 255); - Main.npc[creeperSpawn].velocity = new Vector2(Main.rand.Next(-30, 31) * 0.1f, Main.rand.Next(-30, 31) * 0.1f); - Main.npc[creeperSpawn].netUpdate = true; - } - } - - // Despawn - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 6000f) - { - npc.active = false; - npc.life = 0; - - if (Main.netMode == NetmodeID.Server) - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, npc.whoAmI, 0f, 0f, 0f, 0, 0, 0); - } - } - - // Phase 2 - if (npc.ai[0] < 0f) - { - if (Main.getGoodWorld) - NPC.brainOfGravity = npc.whoAmI; - - // Spawn gore - if (npc.localAI[2] == 0f) - { - SoundEngine.PlaySound(SoundID.NPCHit1, npc.position); - - npc.localAI[2] = 1f; - - if (Main.netMode != NetmodeID.Server) - { - Gore.NewGore(npc.GetSource_FromAI(), npc.position, new Vector2(Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f), 392, 1f); - Gore.NewGore(npc.GetSource_FromAI(), npc.position, new Vector2(Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f), 393, 1f); - Gore.NewGore(npc.GetSource_FromAI(), npc.position, new Vector2(Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f), 394, 1f); - Gore.NewGore(npc.GetSource_FromAI(), npc.position, new Vector2(Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f), 395, 1f); - } - - for (int j = 0; j < 20; j++) - Dust.NewDust(npc.position, npc.width, npc.height, 5, Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f, 0, default, 1f); - - SoundEngine.PlaySound(SoundID.Roar, npc.position); - } - - // Percent life remaining - float lifeRatio = npc.life / (float)npc.lifeMax; - - // Phases based on HP - bool phase3 = lifeRatio < 0.6f; - bool spinning = npc.ai[0] == -4f; - - // KnockBack - float baseKnockBackResist = death ? 0.4f : 0.45f; - - // Gain defense while spinning - npc.defense = npc.defDefense + (spinning ? 7 : 0); - - // Take damage - npc.dontTakeDamage = false; - - // Deal no damage while spinning - npc.damage = spinning ? 0 : npc.defDamage; - - // Target distance X - float playerLocation = npc.Center.X - Main.player[npc.target].Center.X; - - // Charge - if (!spinning) - { - // Not charging - if (npc.ai[0] != -6f) - { - // Rubber band movement - Vector2 brainCenter = new Vector2(npc.Center.X, npc.Center.Y); - float targetXDist = Main.player[npc.target].Center.X - brainCenter.X; - float targetYDist = Main.player[npc.target].Center.Y - brainCenter.Y; - float targetDistance = (float)Math.Sqrt(targetXDist * targetXDist + targetYDist * targetYDist); - float velocityScale = death ? 4f : 2f; - float velocityBoost = velocityScale * (1f - lifeRatio); - float nonChargeSpeed = 8f + velocityBoost + 3f * enrageScale; - if (Main.getGoodWorld) - nonChargeSpeed *= 1.15f; - - targetDistance = nonChargeSpeed / targetDistance; - targetXDist *= targetDistance; - targetYDist *= targetDistance; - npc.velocity.X = (npc.velocity.X * 50f + targetXDist) / 51f; - npc.velocity.Y = (npc.velocity.Y * 50f + targetYDist) / 51f; - } - - // Charge, -6 - else - { - npc.ai[1] += 1f; - - // Teleport - float timeGateValue = death ? 90f : 115f; - if (npc.ai[1] >= timeGateValue) - { - if (npc.knockBackResist == 0f) - npc.knockBackResist = GetCrimsonBossKnockBack(npc, CalamityGlobalNPC.GetActivePlayerCount(), lifeRatio, baseKnockBackResist); - - npc.ai[0] = -7f; - npc.ai[1] = 0f; - npc.localAI[1] = 120f; - npc.netUpdate = true; - } - - // Charge sound and velocity - else if (npc.ai[1] == 10f) - { - // Sound - SoundEngine.PlaySound(SoundID.ForceRoar, npc.position); - - // Velocity - npc.velocity = Vector2.Normalize(Main.player[npc.target].Center + (bossRush ? Main.player[npc.target].velocity * 20f : Vector2.Zero) - npc.Center) * ((death ? 20f : 16f) + 4f * enrageScale); - if (Main.getGoodWorld) - npc.velocity *= 1.15f; - } - } - - // Rubber band movement, -5 - if (npc.ai[0] == -5f) - { - // Spin or teleport - npc.ai[2] += 1f; - if (npc.ai[2] >= 180f) - { - // Velocity and knockback - npc.knockBackResist = 0f; - npc.velocity = Vector2.Normalize(Main.player[npc.target].Center - npc.Center) * 24f; - npc.ai[0] = -4f; - npc.ai[1] = playerLocation < 0 ? 1f : -1f; - npc.ai[2] = 0f; - npc.ai[3] = Main.rand.Next(61); - npc.localAI[1] = 0f; - npc.netUpdate = true; - } - } - } - - // Circle around, -4 - if (spinning) - { - // Charge sound - if (npc.ai[2] == 0f) - { - SoundEngine.PlaySound(SoundID.Roar, npc.position); - - if (CalamityWorld.LegendaryMode) - { - if (Main.netMode != NetmodeID.Server) - { - if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active && Vector2.Distance(Main.player[Main.myPlayer].Center, npc.Center) < CalamityGlobalNPC.CatchUpDistance350Tiles) - Main.player[Main.myPlayer].AddBuff(BuffID.Confused, 90); - } - } - } - - // Velocity - float velocity = MathHelper.TwoPi / (120 * 0.75f); - npc.velocity = npc.velocity.RotatedBy(-(double)velocity * npc.ai[1]); - - npc.ai[2] += 1f; - - float timer = (death ? 0f : 30f) + npc.ai[3]; - - if (npc.ai[2] >= timer - 5f) - { - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) < 400f) // 25 tile distance - { - npc.ai[2] -= 1f; - npc.velocity = Vector2.Normalize(Main.player[npc.target].Center - npc.Center) * ((death ? -10f : -8f) - 2f * enrageScale); - if (Main.getGoodWorld) - npc.velocity *= 1.15f; - } - } - - // Charge at target, -6 is straight line movement, -5 is rubber band movement - if (npc.ai[2] >= timer) - { - // Complete stop - npc.velocity *= 0f; - - // Adjust knockback - npc.knockBackResist = 0f; - - npc.ai[0] = -6f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.TargetClosest(); - npc.netUpdate = true; - } - } - - // Pick teleport location - else if (npc.ai[0] == -1f || npc.ai[0] == -7f) - { - // Adjust knockback - if (npc.ai[0] == -1f) - { - if (npc.knockBackResist == 0f) - npc.knockBackResist = GetCrimsonBossKnockBack(npc, CalamityGlobalNPC.GetActivePlayerCount(), lifeRatio, baseKnockBackResist); - } - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - // Go to phase 3 - if (phase3 && npc.ai[0] == -1f) - { - npc.ai[0] = -5f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.localAI[1] = 0f; - npc.alpha = 0; - npc.netUpdate = true; - } - - npc.localAI[1] += 1f; - - int randomReduction = death ? 4 : (int)(5f * (1f - lifeRatio)); - int random = 5 - randomReduction; - if (npc.justHit) - npc.localAI[1] -= Main.rand.Next(random); - - if (npc.localAI[1] >= 60f) - { - npc.localAI[1] = 0f; - npc.TargetClosest(); - int numTeleportTries = 0; - int teleportTileX; - int teleportTileY; - while (true) - { - numTeleportTries++; - teleportTileX = (int)Main.player[npc.target].Center.X / 16; - teleportTileY = (int)Main.player[npc.target].Center.Y / 16; - - int min = 14; - int max = 17; - - min += teleportDistanceIncrease; - max += teleportDistanceIncrease; - - if (Main.rand.NextBool()) - teleportTileX += Main.rand.Next(min, max); - else - teleportTileX -= Main.rand.Next(min, max); - - if (Main.rand.NextBool()) - teleportTileY += Main.rand.Next(min, max); - else - teleportTileY -= Main.rand.Next(min, max); - - if (!WorldGen.SolidTile(teleportTileX, teleportTileY)) - break; - - if (numTeleportTries > 100) - goto Block_2784; - } - npc.ai[3] = 0f; - npc.ai[0] = npc.ai[0] == -7f ? -8f : -2f; - npc.ai[1] = teleportTileX; - npc.ai[2] = teleportTileY; - npc.netUpdate = true; - npc.netSpam = 0; - Block_2784: - ; - } - } - } - - // Teleport and turn invisible - else if (npc.ai[0] == -2f || npc.ai[0] == -8f) - { - // Avoid cheap bullshit - npc.damage = 0; - - npc.velocity *= 0.9f; - - if (Main.netMode != NetmodeID.SinglePlayer) - npc.ai[3] += 15f; - else - npc.ai[3] += 25f; - - if (npc.ai[3] >= 255f) - { - npc.ai[3] = 255f; - npc.position.X = npc.ai[1] * 16f - (npc.width / 2); - npc.position.Y = npc.ai[2] * 16f - (npc.height / 2); - SoundEngine.PlaySound(SoundID.Item8, npc.Center); - npc.ai[0] = npc.ai[0] == -8f ? -9f : -3f; - npc.netUpdate = true; - npc.netSpam = 0; - } - - npc.alpha = (int)npc.ai[3]; - } - - // Become visible - else if (npc.ai[0] == -3f || npc.ai[0] == -9f) - { - // Avoid cheap bullshit - npc.damage = 0; - - if (Main.netMode != NetmodeID.SinglePlayer) - npc.ai[3] -= 15f; - else - npc.ai[3] -= 25f; - - if (npc.ai[3] <= 0f) - { - if (npc.ai[0] == -9f) - { - // Adjust knockback - npc.knockBackResist = 0f; - - npc.velocity = Vector2.Normalize(Main.player[npc.target].Center - npc.Center) * 24f; - - npc.ai[0] = -4f; - npc.ai[1] = playerLocation < 0 ? 1f : -1f; - npc.ai[2] = 0f; - npc.ai[3] = Main.rand.Next(61); - } - else - { - npc.ai[3] = 0f; - npc.ai[2] = 0f; - npc.ai[1] = 0f; - npc.ai[0] = -1f; - } - npc.netUpdate = true; - npc.netSpam = 0; - } - - npc.alpha = (int)npc.ai[3]; - } - } - - // Phase 1 - else - { - // Avoid cheap bullshit - npc.damage = 0; - - // Creeper count - int creeperCount = NPC.CountNPCS(NPCID.Creeper); - int creeperScale = GetBrainOfCthuluCreepersCountRevDeath() + 1 - creeperCount; - creeperScale *= (int)enrageScale; - bool phase2 = creeperCount <= 0; - - // Go to phase 2 - if (phase2) - { - npc.ai[0] = -1f; - npc.localAI[1] = 0f; - npc.alpha = 0; - npc.TargetClosest(); - npc.netUpdate = true; - return false; - } - - // Move towards target - Vector2 brainCenterPhase1 = new Vector2(npc.Center.X, npc.Center.Y); - float targetXDistPhase1 = Main.player[npc.target].Center.X - brainCenterPhase1.X; - float targetYDistPhase1 = Main.player[npc.target].Center.Y - brainCenterPhase1.Y; - float targetDistancePhase1 = (float)Math.Sqrt(targetXDistPhase1 * targetXDistPhase1 + targetYDistPhase1 * targetYDistPhase1); - float maxMoveVelocity = (death ? 2f : 1f) + (creeperScale * 0.1f); - if (Main.getGoodWorld) - maxMoveVelocity *= 2f; - - if (targetDistancePhase1 < maxMoveVelocity) - { - npc.velocity.X = targetXDistPhase1; - npc.velocity.Y = targetYDistPhase1; - } - else - { - targetDistancePhase1 = maxMoveVelocity / targetDistancePhase1; - npc.velocity.X = targetXDistPhase1 * targetDistancePhase1; - npc.velocity.Y = targetYDistPhase1 * targetDistancePhase1; - } - - // Pick a teleport location - if (npc.ai[0] == 0f) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - // Teleport location - npc.localAI[1] += (death ? 2f : 1f) + (creeperScale * 0.1f); - if (npc.localAI[1] >= 300f) - { - npc.localAI[1] = 0f; - npc.TargetClosest(); - int phase1TeleportTries = 0; - int phase1TeleportTileX; - int phase1TeleportTileY; - while (true) - { - phase1TeleportTries++; - phase1TeleportTileX = (int)Main.player[npc.target].Center.X / 16; - phase1TeleportTileY = (int)Main.player[npc.target].Center.Y / 16; - - int min = 18 + teleportDistanceIncrease; - int max = 26 + teleportDistanceIncrease; - - if (Main.rand.NextBool()) - phase1TeleportTileX += Main.rand.Next(min, max); - else - phase1TeleportTileX -= Main.rand.Next(min, max); - - if (Main.rand.NextBool()) - phase1TeleportTileY += Main.rand.Next(min, max); - else - phase1TeleportTileY -= Main.rand.Next(min, max); - - if (!WorldGen.SolidTile(phase1TeleportTileX, phase1TeleportTileY) && Collision.CanHit(new Vector2(phase1TeleportTileX * 16, phase1TeleportTileY * 16), 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - break; - } - if (phase1TeleportTries > 100) - { - goto Block_2801; - } - } - npc.ai[0] = 1f; - npc.ai[1] = phase1TeleportTileX; - npc.ai[2] = phase1TeleportTileY; - npc.netUpdate = true; - Block_2801: - ; - } - } - } - - // Turn invisible and teleport - else if (npc.ai[0] == 1f) - { - // Avoid cheap bullshit - npc.damage = 0; - - npc.alpha += 25; - if (npc.alpha >= 255) - { - SoundEngine.PlaySound(SoundID.Item8, npc.Center); - npc.alpha = 255; - npc.position.X = npc.ai[1] * 16f - (npc.width / 2); - npc.position.Y = npc.ai[2] * 16f - (npc.height / 2); - npc.ai[0] = 2f; - } - } - - // Become visible - else if (npc.ai[0] == 2f) - { - // Avoid cheap bullshit - npc.damage = 0; - - npc.alpha -= 25; - if (npc.alpha <= 0) - { - npc.alpha = 0; - npc.ai[0] = 0f; - } - } - } - - // Despawn - if (Main.player[npc.target].dead && !bossRush) - { - if (npc.localAI[3] < 120f) - npc.localAI[3] += 1f; - - if (npc.localAI[3] > 60f) - npc.velocity.Y += (npc.localAI[3] - 60f) * 0.25f; - - npc.ai[0] = 2f; - npc.alpha = 10; - return false; - } - if (npc.localAI[3] > 0f) - npc.localAI[3] -= 1f; - - return false; - } - - public static bool BuffedCreeperAI(NPC npc, Mod mod) - { - // Despawn if Brain is gone - if (NPC.crimsonBoss < 0) - { - npc.active = false; - npc.netUpdate = true; - return false; - } - - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; - - // Get a target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(); - - float enrageScale = bossRush ? 1f : 0f; - if ((npc.position.Y / 16f) < Main.worldSurface || bossRush) - enrageScale += 1f; - if (!Main.player[npc.target].ZoneCrimson || bossRush) - enrageScale += 2f; - - // Creeper count, 0 to 20 - int creeperCount = NPC.CountNPCS(NPCID.Creeper); - - // Stay near Brain - if (npc.ai[0] == 0f) - { - Vector2 creeperCenter = new Vector2(npc.Center.X, npc.Center.Y); - float brainXDist = Main.npc[NPC.crimsonBoss].Center.X - creeperCenter.X; - float brainYDist = Main.npc[NPC.crimsonBoss].Center.Y - creeperCenter.Y; - float brainDistance = (float)Math.Sqrt(brainXDist * brainXDist + brainYDist * brainYDist); - float velocity = death ? 10f : 7f; - velocity += 4f * enrageScale; - - // Max distance from Brain - if (brainDistance > 90f) - { - brainDistance = velocity / brainDistance; - brainXDist *= brainDistance; - brainYDist *= brainDistance; - npc.velocity.X = (npc.velocity.X * 15f + brainXDist) / 16f; - npc.velocity.Y = (npc.velocity.Y * 15f + brainYDist) / 16f; - return false; - } - - // Increase speed - if (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) < velocity) - { - npc.velocity *= 1.05f; - } - - // Charge at target - int creeperScale = GetBrainOfCthuluCreepersCountRevDeath() + 1 - creeperCount; - creeperScale *= (int)enrageScale; - npc.ai[1] += (death ? 1f : 0.5f) + (creeperScale * 0.25f); - if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[1] >= 150f) - { - npc.ai[1] = 0f; - npc.TargetClosest(); - creeperCenter = new Vector2(npc.Center.X, npc.Center.Y); - brainXDist = Main.player[npc.target].Center.X - creeperCenter.X; - brainYDist = Main.player[npc.target].Center.Y - creeperCenter.Y; - brainDistance = (float)Math.Sqrt(brainXDist * brainXDist + brainYDist * brainYDist); - brainDistance = velocity / brainDistance; - npc.velocity.X = brainXDist * brainDistance; - npc.velocity.Y = brainYDist * brainDistance; - npc.ai[0] = 1f; - npc.netUpdate = true; - } - } - - // Charge - else - { - float chargeVelocity = death ? 10f : 7f; - chargeVelocity += 4f * enrageScale; - Vector2 targetDirection = Main.player[npc.target].Center - npc.Center; - targetDirection.Normalize(); - if (Main.getGoodWorld) - { - targetDirection *= 12f; - npc.velocity = (npc.velocity * 49f + targetDirection) / 50f; - } - else - { - targetDirection *= chargeVelocity; - npc.velocity = (npc.velocity * 99f + targetDirection) / 100f; - } - - Vector2 creeperCenterCharge = new Vector2(npc.Center.X, npc.Center.Y); - float brainXDistCharge = Main.npc[NPC.crimsonBoss].Center.X - creeperCenterCharge.X; - float brainYDistCharge = Main.npc[NPC.crimsonBoss].Center.Y - creeperCenterCharge.Y; - float brainDistanceCharge = (float)Math.Sqrt(brainXDistCharge * brainXDistCharge + brainYDistCharge * brainYDistCharge); - - // Return to Brain - if (brainDistanceCharge > 700f || npc.justHit) - npc.ai[0] = 0f; - } - - // Push away from each other in death mode - if (death) - { - float pushVelocity = 0.5f; - for (int i = 0; i < Main.maxNPCs; i++) - { - if (Main.npc[i].active) - { - if (i != npc.whoAmI && Main.npc[i].type == npc.type) - { - if (Vector2.Distance(npc.Center, Main.npc[i].Center) < 48f) - { - if (npc.position.X < Main.npc[i].position.X) - npc.velocity.X -= pushVelocity; - else - npc.velocity.X += pushVelocity; - - if (npc.position.Y < Main.npc[i].position.Y) - npc.velocity.Y -= pushVelocity; - else - npc.velocity.Y += pushVelocity; - } - } - } - } - } - - return false; - } - - public static int GetBrainOfCthuluCreepersCountRevDeath() - { - return CalamityWorld.LegendaryMode ? 50 : Main.getGoodWorld ? 40 : (CalamityWorld.death || BossRushEvent.BossRushActive) ? 30 : 25; - } - - private static float GetCrimsonBossKnockBack(NPC npc, int numPlayers, float lifeScale, float baseKnockBackResist) - { - float balance = 1f; - float boost = 0.35f; - - for (int i = 1; i < numPlayers; i++) - { - balance += boost; - boost += (1f - boost) / 3f; - } - - if (balance > 8f) - balance = (balance * 2f + 8f) / 3f; - if (balance > 1000f) - balance = 1000f; - - float KBResist = baseKnockBackResist * lifeScale; - float KBResistMultiplier = 1f - baseKnockBackResist * 0.4f; - for (float num = 1f; num < balance; num += 0.34f) - { - if (KBResist < 0.05) - { - KBResist = 0f; - break; - } - KBResist *= KBResistMultiplier; - } - - return KBResist; - } - } -} diff --git a/NPCs/VanillaNPCOverrides/Bosses/CultistAI.cs b/NPCs/VanillaNPCOverrides/Bosses/CultistAI.cs deleted file mode 100644 index c174ecf722..0000000000 --- a/NPCs/VanillaNPCOverrides/Bosses/CultistAI.cs +++ /dev/null @@ -1,1210 +0,0 @@ -using CalamityMod.Events; -using CalamityMod.NPCs.PrimordialWyrm; -using CalamityMod.World; -using Microsoft.Xna.Framework; -using System; -using System.Collections.Generic; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Audio; - -namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses -{ - public static class CultistAI - { - public static bool BuffedCultistAI(NPC npc, Mod mod) - { - CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - - // Chant sound - if (npc.ai[0] != -1f && Main.rand.NextBool(1000)) - { - SoundStyle chantSound = Utils.SelectRandom(Main.rand, new SoundStyle[] - { - SoundID.Zombie88, - SoundID.Zombie89, - SoundID.Zombie90, - SoundID.Zombie91 - }); - - SoundEngine.PlaySound(chantSound, npc.position); - } - - // Percent life remaining - float lifeRatio = npc.life / (float)npc.lifeMax; - - // Phases - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; - bool phase2 = lifeRatio < 0.85f; - bool phase3 = lifeRatio < 0.7f; - bool phase4 = lifeRatio < 0.55f; - bool phase5 = lifeRatio < 0.4f; - bool phase6 = lifeRatio < 0.25f; - - // Variables - bool isCultist = npc.type == NPCID.CultistBoss; - bool dontTakeDamage = false; - - int iceMistDamage = isCultist ? npc.GetProjectileDamage(ProjectileID.CultistBossIceMist) : 0; - int fireballDamage = isCultist ? npc.GetProjectileDamage(ProjectileID.CultistBossFireBall) : npc.GetProjectileDamage(ProjectileID.CultistBossFireBallClone); - int lightningDamage = isCultist ? npc.GetProjectileDamage(ProjectileID.CultistBossLightningOrb) : 0; - - int iceMistFireRate = phase2 ? 50 : 60; - float iceMistSpeed = (phase6 ? 12f : 10f) + (death ? 2f * (1f - lifeRatio) : 0f); - int iceMistAmt = phase3 ? 2 : 1; - int fireballFireRate = phase5 ? 10 : 12; - float fireballSpeed = (phase6 ? 7.5f : 6f) + (death ? 2f * (1f - lifeRatio) : 0f) - (isCultist ? 0f : 3f); - int lightningOrbPhaseTime = phase2 ? 90 : 120; - int ancientLightSpawnRate = phase4 ? 25 : 30; - int ancientLightAmt = phase4 ? 3 : 2; - int ancientDoomLimit = 10; - int idleTime = phase3 ? 35 : 40; - float timeToFinishRitual = phase5 ? 300f : 360f; - - if (bossRush) - { - iceMistFireRate = 40; - iceMistSpeed = 14f; - iceMistAmt = 3; - fireballFireRate = 8; - fireballSpeed *= 1.2f; - lightningOrbPhaseTime = 90; - ancientLightSpawnRate = 20; - ancientLightAmt = 4; - idleTime = 30; - } - - if (Main.getGoodWorld) - { - iceMistFireRate = 30; - iceMistSpeed = 15f; - fireballFireRate = 6; - fireballSpeed *= 1.25f; - lightningOrbPhaseTime = 60; - ancientLightSpawnRate = 10; - ancientLightAmt = 5; - idleTime = 20; - } - - // Get a target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(false); - - // Center and target - Player player = Main.player[npc.target]; - if (npc.target < 0 || npc.target == Main.maxPlayers || player.dead || !player.active) - { - npc.TargetClosest(false); - player = Main.player[npc.target]; - npc.netUpdate = true; - } - - // Despawn safety, make sure to target another player if the current player target is too far away - if (Vector2.Distance(player.Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) - npc.TargetClosest(false); - - // Enrage - if (!Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height) || CalamityWorld.LegendaryMode) - { - calamityGlobalNPC.newAI[0] += 1f; - if (calamityGlobalNPC.newAI[0] >= 120f) - { - calamityGlobalNPC.newAI[0] = 120f; - iceMistSpeed = 16f; - iceMistFireRate = 15; - lightningOrbPhaseTime = 30; - ancientLightSpawnRate = 5; - idleTime = 10; - timeToFinishRitual = 120f; - } - } - else - { - if (calamityGlobalNPC.newAI[0] > 0f) - calamityGlobalNPC.newAI[0] -= 1f; - } - - // Cultist clone AI - if (!isCultist) - { - if (npc.ai[3] < 0f || !Main.npc[(int)npc.ai[3]].active || Main.npc[(int)npc.ai[3]].type != NPCID.CultistBoss) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.active = false; - return false; - } - - npc.ai[0] = Main.npc[(int)npc.ai[3]].ai[0]; - npc.ai[1] = Main.npc[(int)npc.ai[3]].ai[1]; - dontTakeDamage = true; - } - - // Stop spawning ritual if hit - else if (npc.ai[0] == 5f && npc.ai[1] >= 120f && npc.ai[1] < timeToFinishRitual && npc.justHit) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[3] += 1f; - npc.velocity = Vector2.Zero; - npc.netUpdate = true; - Main.projectile[(int)npc.ai[2]].ai[1] = -1f; - Main.projectile[(int)npc.ai[2]].netUpdate = true; - } - - // Despawn - if (player.dead || Vector2.Distance(player.Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance350Tiles) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.active = false; - - if (Main.netMode != NetmodeID.MultiplayerClient) - NetMessage.SendData(MessageID.DamageNPC, -1, -1, null, npc.whoAmI, -1f, 0f, 0f, 0, 0, 0); - - for (int j = 0; j < Main.maxNPCs; j++) - { - if (Main.npc[j].active && Main.npc[j].type == NPCID.CultistBossClone && Main.npc[j].ai[3] == npc.whoAmI) - { - Main.npc[j].life = 0; - Main.npc[j].HitEffect(0, 10.0); - Main.npc[j].active = false; - - if (Main.netMode != NetmodeID.MultiplayerClient) - NetMessage.SendData(MessageID.DamageNPC, -1, -1, null, npc.whoAmI, -1f, 0f, 0f, 0, 0, 0); - } - } - } - - // Clones set to Cultist phase - float clonePhase = npc.ai[3]; - - // Spawn and play sound - if (npc.localAI[0] == 0f) - { - SoundEngine.PlaySound(SoundID.Zombie89, npc.position); - npc.localAI[0] = 1f; - npc.alpha = 255; - npc.rotation = 0f; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.ai[0] = -1f; - npc.netUpdate = true; - } - } - - // Appear and do weird ritual shit with tablet - if (npc.ai[0] == -1f) - { - npc.alpha -= 5; - if (npc.alpha < 0) - npc.alpha = 0; - - npc.ai[1] += 1f; - if (npc.ai[1] >= 420f) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.netUpdate = true; - } - else if (npc.ai[1] > 360f) - { - npc.velocity *= 0.95f; - - if (npc.localAI[2] != 13f) - SoundEngine.PlaySound(SoundID.Zombie105, npc.position); - - npc.localAI[2] = 13f; - } - else if (npc.ai[1] > 300f) - { - npc.velocity = -Vector2.UnitY; - npc.localAI[2] = 10f; - } - else if (npc.ai[1] > 120f) - npc.localAI[2] = 1f; - else - npc.localAI[2] = 0f; - - dontTakeDamage = true; - } - - // Phase switch - if (npc.ai[0] == 0f) - { - if (npc.ai[1] == 0f) - npc.TargetClosest(false); - - npc.localAI[2] = 10f; - - int facePlayerDirection = Math.Sign(player.Center.X - npc.Center.X); - if (facePlayerDirection != 0) - npc.direction = npc.spriteDirection = facePlayerDirection; - - npc.ai[1] += 1f; - if (npc.ai[1] >= idleTime & isCultist) - { - // Phase switch - int phase = 0; - switch ((int)npc.ai[3]) - { - // Move to target - case 0: - case 2: - case 4: - case 6: - case 8: - case 10: - case 12: - case 14: - case 16: - case 18: - case 20: - phase = 0; - break; - - // Fireball - case 1: - case 15: - phase = 1; - break; - - // Ancient Light - case 3: - case 11: - phase = 5; - break; - - // Lightning Orb - case 5: - case 13: - phase = 3; - break; - - // Ice Mist - case 7: - case 17: - phase = 2; - break; - - // Ancient Doom - case 9: - case 19: - // Pick a different random phase if too many Ancient Dooms are active - int[] attackPhases = new int[4] { 1, 2, 3, 5 }; - phase = NPC.CountNPCS(NPCID.AncientDoom) < ancientDoomLimit ? 6 : attackPhases[Main.rand.Next(attackPhases.Length)]; - break; - - // Dragon Summon - case 21: - phase = 4; - npc.ai[3] = -1f; - break; - - default: - npc.ai[3] = -1f; - break; - } - - // Set AI phase - switch (phase) - { - // Movement - case 0: - // Set a location to move to - float teleportLocation = (float)Math.Ceiling((player.Center + new Vector2(0f, -100f) - npc.Center).Length() / 50f); - if (teleportLocation == 0f) - teleportLocation = 1f; - - // Add self and clones to list - List list2 = new List(); - int cloneAmt = 0; - list2.Add(npc.whoAmI); - for (int k = 0; k < Main.maxNPCs; k++) - { - if (Main.npc[k].active && Main.npc[k].type == NPCID.CultistBossClone && Main.npc[k].ai[3] == npc.whoAmI) - list2.Add(k); - } - - // Move self and clones to location - bool cloneAmtIsEven = list2.Count % 2 == 0; - foreach (int current2 in list2) - { - NPC nPC2 = Main.npc[current2]; - Vector2 center2 = nPC2.Center; - float cloneOffset = (cloneAmt + cloneAmtIsEven.ToInt() + 1) / 2 * MathHelper.TwoPi * 0.4f / list2.Count; - if (cloneAmt % 2 == 1) - { - cloneOffset *= -1f; - } - if (list2.Count == 1) - { - cloneOffset = 0f; - } - Vector2 cloneRotation = new Vector2(0f, -1f).RotatedBy(cloneOffset) * new Vector2(150f, 200f); - Vector2 finalClonePos = player.Center + cloneRotation - center2; - nPC2.ai[0] = 1f; - nPC2.ai[1] = teleportLocation; - nPC2.velocity = finalClonePos / teleportLocation * 2f; - if (npc.whoAmI >= nPC2.whoAmI) - { - nPC2.position -= nPC2.velocity; - } - nPC2.netUpdate = true; - cloneAmt++; - } - break; - - // Fireball - case 1: - npc.ai[0] = 3f; - npc.ai[1] = 0f; - break; - - // Ice Mist - case 2: - npc.ai[0] = 2f; - npc.ai[1] = 0f; - break; - - // Lightning Orb - case 3: - npc.ai[0] = 4f; - npc.ai[1] = 0f; - break; - - // Dragon Summon - case 4: - npc.ai[0] = 5f; - npc.ai[1] = 0f; - break; - - // Ancient Light - case 5: - npc.ai[0] = 7f; - npc.ai[1] = 0f; - break; - - // Ancient Doom - case 6: - npc.ai[0] = 8f; - npc.ai[1] = 0f; - break; - - default: - break; - } - - npc.netUpdate = true; - } - } - - // Movement, then switch to a different attack - else if (npc.ai[0] == 1f) - { - dontTakeDamage = true; - - npc.localAI[2] = 10f; - - if (npc.ai[1] % 2f != 0f && npc.ai[1] != 1f) - npc.position -= npc.velocity; - - npc.ai[1] -= 1f; - if (npc.ai[1] <= 0f) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[3] += 1f; - npc.velocity = Vector2.Zero; - npc.netUpdate = true; - } - } - - // Ice Mist - else if (npc.ai[0] == 2f) - { - npc.localAI[2] = 11f; - - Vector2 vec = Vector2.Normalize(player.Center - npc.Center); - if (vec.HasNaNs()) - vec = new Vector2(npc.direction, 0f); - - if ((npc.ai[1] >= 4f & isCultist) && (int)(npc.ai[1] - 4f) % iceMistFireRate == 0) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - List list3 = new List(); - for (int l = 0; l < Main.maxNPCs; l++) - { - if (Main.npc[l].active && Main.npc[l].type == NPCID.CultistBossClone && Main.npc[l].ai[3] == npc.whoAmI) - list3.Add(l); - } - - foreach (int current3 in list3) - { - NPC nPC3 = Main.npc[current3]; - Vector2 center3 = nPC3.Center; - - int cloneFacePlayerDirection = Math.Sign(player.Center.X - center3.X); - if (cloneFacePlayerDirection != 0) - nPC3.direction = nPC3.spriteDirection = cloneFacePlayerDirection; - - vec = Vector2.Normalize(player.Center - center3); - if (vec.HasNaNs()) - vec = new Vector2(npc.direction, 0f); - - Vector2 shadowFireballDirection = center3 + new Vector2(npc.direction * 30, 12f); - Vector2 shadowFireballVelocity = vec * (fireballSpeed + (float)Main.rand.NextDouble() * 2f); - shadowFireballVelocity = shadowFireballVelocity.RotatedByRandom(0.52359879016876221); - Projectile.NewProjectile(npc.GetSource_FromAI(), shadowFireballDirection, shadowFireballVelocity, ProjectileID.CultistBossFireBallClone, fireballDamage, 0f, Main.myPlayer); - } - } - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - vec = Vector2.Normalize(player.Center - npc.Center); - if (vec.HasNaNs()) - vec = new Vector2(npc.direction, 0f); - - Vector2 iceMistDirection = npc.Center + new Vector2(npc.direction * 30, 12f); - Vector2 iceMistVelocity = vec * iceMistSpeed; - Projectile.NewProjectile(npc.GetSource_FromAI(), iceMistDirection, iceMistVelocity, ProjectileID.CultistBossIceMist, iceMistDamage, 0f, Main.myPlayer, 0f, 1f); - } - } - - npc.ai[1] += 1f; - if (npc.ai[1] >= (4 + iceMistFireRate * iceMistAmt)) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[3] += 1f; - npc.velocity = Vector2.Zero; - npc.netUpdate = true; - } - } - - // Fireballs - else if (npc.ai[0] == 3f) - { - npc.localAI[2] = 11f; - - Vector2 playerDirection = Vector2.Normalize(player.Center - npc.Center); - if (playerDirection.HasNaNs()) - playerDirection = new Vector2(npc.direction, 0f); - - if ((npc.ai[1] >= 4f & isCultist) && (int)(npc.ai[1] - 4f) % fireballFireRate == 0) - { - if ((int)(npc.ai[1] - 4f) / fireballFireRate == 2) - { - List list4 = new List(); - for (int i = 0; i < Main.maxNPCs; i++) - { - if (Main.npc[i].active && Main.npc[i].type == NPCID.CultistBossClone && Main.npc[i].ai[3] == npc.whoAmI) - list4.Add(i); - } - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - foreach (int current4 in list4) - { - NPC nPC4 = Main.npc[current4]; - Vector2 center4 = nPC4.Center; - - int cloneFireballFaceDirection = Math.Sign(player.Center.X - center4.X); - if (cloneFireballFaceDirection != 0) - nPC4.direction = nPC4.spriteDirection = cloneFireballFaceDirection; - - playerDirection = Vector2.Normalize(player.Center - center4); - if (playerDirection.HasNaNs()) - playerDirection = new Vector2(npc.direction, 0f); - - Vector2 shadowFireballDirection = center4 + new Vector2(npc.direction * 30, 12f); - Vector2 shadowFireballVelocity = playerDirection * (fireballSpeed + (float)Main.rand.NextDouble() * 2f); - shadowFireballVelocity = shadowFireballVelocity.RotatedByRandom(0.52359879016876221); - Projectile.NewProjectile(npc.GetSource_FromAI(), shadowFireballDirection, shadowFireballVelocity, ProjectileID.CultistBossFireBallClone, fireballDamage, 0f, Main.myPlayer); - } - } - } - - int cultistFireballFaceDirection = Math.Sign(player.Center.X - npc.Center.X); - if (cultistFireballFaceDirection != 0) - npc.direction = npc.spriteDirection = cultistFireballFaceDirection; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - playerDirection = Vector2.Normalize(player.Center - npc.Center); - if (playerDirection.HasNaNs()) - playerDirection = new Vector2(npc.direction, 0f); - - Vector2 fireballDirection = npc.Center + new Vector2(npc.direction * 30, 12f); - Vector2 fireballVelocity = playerDirection * (fireballSpeed + (float)Main.rand.NextDouble() * 4f); - fireballVelocity = fireballVelocity.RotatedByRandom(0.52359879016876221); - Projectile.NewProjectile(npc.GetSource_FromAI(), fireballDirection, fireballVelocity, ProjectileID.CultistBossFireBall, fireballDamage, 0f, Main.myPlayer); - } - } - - npc.ai[1] += 1f; - if (npc.ai[1] >= (4 + fireballFireRate * 4)) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[3] += 1f; - npc.velocity = Vector2.Zero; - npc.netUpdate = true; - } - } - - // Lightning Orb - else if (npc.ai[0] == 4f) - { - if (isCultist) - npc.localAI[2] = 12f; - else - npc.localAI[2] = 11f; - - if ((npc.ai[1] == 20f & isCultist) && Main.netMode != NetmodeID.MultiplayerClient) - { - List list5 = new List(); - for (int j = 0; j < Main.maxNPCs; j++) - { - if (Main.npc[j].active && Main.npc[j].type == NPCID.CultistBossClone && Main.npc[j].ai[3] == npc.whoAmI) - list5.Add(j); - } - - foreach (int current5 in list5) - { - NPC nPC5 = Main.npc[current5]; - Vector2 center5 = nPC5.Center; - - int clonePlayerFaceDirection = Math.Sign(player.Center.X - center5.X); - if (clonePlayerFaceDirection != 0) - nPC5.direction = nPC5.spriteDirection = clonePlayerFaceDirection; - - Vector2 playerDirection = Vector2.Normalize(player.Center - center5); - if (playerDirection.HasNaNs()) - playerDirection = new Vector2(npc.direction, 0f); - - Vector2 shadowFireballDirection = center5 + new Vector2(npc.direction * 30, 12f); - Vector2 shadowFireballVelocity = playerDirection * (fireballSpeed + (float)Main.rand.NextDouble() * 2f); - shadowFireballVelocity = shadowFireballVelocity.RotatedByRandom(0.52359879016876221); - Projectile.NewProjectile(npc.GetSource_FromAI(), shadowFireballDirection.X, shadowFireballDirection.Y, shadowFireballVelocity.X, shadowFireballVelocity.Y, ProjectileID.CultistBossFireBallClone, fireballDamage, 0f, Main.myPlayer); - } - - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X, npc.Center.Y - 100f, 0f, 0f, ProjectileID.CultistBossLightningOrb, lightningDamage, 0f, Main.myPlayer); - } - - npc.ai[1] += 1f; - if (npc.ai[1] >= (20 + lightningOrbPhaseTime)) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[3] += 1f; - npc.velocity = Vector2.Zero; - npc.netUpdate = true; - } - } - - // Spawn Clones, and Dragon or Cthulhu head - else if (npc.ai[0] == 5f) - { - npc.localAI[2] = 10f; - - if (Vector2.Normalize(player.Center - npc.Center).HasNaNs()) - new Vector2(npc.direction, 0f); - - if (npc.ai[1] >= 0f && npc.ai[1] < 30f) - { - dontTakeDamage = true; - float cultistAlphaControl = (npc.ai[1] - 0f) / 30f; - npc.alpha = (int)(cultistAlphaControl * 255f); - } - else if (npc.ai[1] >= 30f && npc.ai[1] < 90f) - { - if ((npc.ai[1] == 30f && Main.netMode != NetmodeID.MultiplayerClient) & isCultist) - { - npc.localAI[1] += 1f; - - Vector2 spinningpoint = new Vector2(180f, 0f); - - List list6 = new List(); - for (int k = 0; k < Main.maxNPCs; k++) - { - if (Main.npc[k].active && Main.npc[k].type == NPCID.CultistBossClone && Main.npc[k].ai[3] == npc.whoAmI) - list6.Add(k); - } - - int potentialExtraClones = 6 - list6.Count; - if (potentialExtraClones > 2) - potentialExtraClones = 2; - - int newCloneAmt = list6.Count + potentialExtraClones + 1; - float[] array = new float[newCloneAmt]; - for (int cloneInc = 0; cloneInc < array.Length; cloneInc++) - array[cloneInc] = Vector2.Distance(npc.Center + spinningpoint.RotatedBy(cloneInc * MathHelper.TwoPi / newCloneAmt - MathHelper.PiOver2), player.Center); - - int rotateDistance = 0; - for (int j = 1; j < array.Length; j++) - { - if (array[rotateDistance] > array[j]) - rotateDistance = j; - } - - if (rotateDistance < newCloneAmt / 2) - rotateDistance += newCloneAmt / 2; - else - rotateDistance -= newCloneAmt / 2; - - int clonesToSpawn = potentialExtraClones; - for (int k = 0; k < array.Length; k++) - { - if (rotateDistance != k) - { - Vector2 cloneRotation = npc.Center + spinningpoint.RotatedBy(k * MathHelper.TwoPi / newCloneAmt - MathHelper.PiOver2); - if (clonesToSpawn-- > 0) - { - int cloneSpawn = NPC.NewNPC(npc.GetSource_FromAI(), (int)cloneRotation.X, (int)cloneRotation.Y + npc.height / 2, NPCID.CultistBossClone, npc.whoAmI); - Main.npc[cloneSpawn].ai[3] = npc.whoAmI; - Main.npc[cloneSpawn].netUpdate = true; - Main.npc[cloneSpawn].localAI[1] = npc.localAI[1]; - } - else - { - int currentClone = list6[-clonesToSpawn - 1]; - Main.npc[currentClone].Center = cloneRotation; - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, currentClone, 0f, 0f, 0f, 0, 0, 0); - } - } - } - - npc.ai[2] = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, Vector2.Zero, ProjectileID.CultistRitual, 0, 0f, Main.myPlayer, 0f, npc.whoAmI); - npc.Center += spinningpoint.RotatedBy(rotateDistance * MathHelper.TwoPi / newCloneAmt - MathHelper.PiOver2); - npc.netUpdate = true; - list6.Clear(); - } - - dontTakeDamage = true; - npc.alpha = 255; - - if (isCultist) - { - Vector2 ritualCenterDirection = Main.projectile[(int)npc.ai[2]].Center; - ritualCenterDirection -= npc.Center; - if (ritualCenterDirection == Vector2.Zero) - ritualCenterDirection = -Vector2.UnitY; - - ritualCenterDirection.Normalize(); - - if (Math.Abs(ritualCenterDirection.Y) < 0.77f) - npc.localAI[2] = 11f; - else if (ritualCenterDirection.Y < 0f) - npc.localAI[2] = 12f; - else - npc.localAI[2] = 10f; - - int ritualFaceDirection = Math.Sign(ritualCenterDirection.X); - if (ritualFaceDirection != 0) - npc.direction = npc.spriteDirection = ritualFaceDirection; - } - else - { - Vector2 ritualCenterFailDirection = Main.projectile[(int)Main.npc[(int)npc.ai[3]].ai[2]].Center; - ritualCenterFailDirection -= npc.Center; - if (ritualCenterFailDirection == Vector2.Zero) - ritualCenterFailDirection = -Vector2.UnitY; - - ritualCenterFailDirection.Normalize(); - - if (Math.Abs(ritualCenterFailDirection.Y) < 0.77f) - npc.localAI[2] = 11f; - else if (ritualCenterFailDirection.Y < 0f) - npc.localAI[2] = 12f; - else - npc.localAI[2] = 10f; - - int ritualFailFaceDirection = Math.Sign(ritualCenterFailDirection.X); - if (ritualFailFaceDirection != 0) - npc.direction = npc.spriteDirection = ritualFailFaceDirection; - } - } - else if (npc.ai[1] >= 90f && npc.ai[1] < 120f) - { - dontTakeDamage = true; - float ritualAlphaControl = (npc.ai[1] - 90f) / 30f; - npc.alpha = 255 - (int)(ritualAlphaControl * 255f); - } - else if (npc.ai[1] >= 120f && npc.ai[1] < timeToFinishRitual) - { - npc.alpha = 0; - - if (isCultist) - { - Vector2 ritualTimeAlmostUpCenterDirection = Main.projectile[(int)npc.ai[2]].Center; - ritualTimeAlmostUpCenterDirection -= npc.Center; - if (ritualTimeAlmostUpCenterDirection == Vector2.Zero) - ritualTimeAlmostUpCenterDirection = -Vector2.UnitY; - - ritualTimeAlmostUpCenterDirection.Normalize(); - - if (Math.Abs(ritualTimeAlmostUpCenterDirection.Y) < 0.77f) - npc.localAI[2] = 11f; - else if (ritualTimeAlmostUpCenterDirection.Y < 0f) - npc.localAI[2] = 12f; - else - npc.localAI[2] = 10f; - - int ritualTimeAlmostUpFaceDirection = Math.Sign(ritualTimeAlmostUpCenterDirection.X); - if (ritualTimeAlmostUpFaceDirection != 0) - npc.direction = npc.spriteDirection = ritualTimeAlmostUpFaceDirection; - } - else - { - Vector2 ritualTimeUpCenterDirection = Main.projectile[(int)Main.npc[(int)npc.ai[3]].ai[2]].Center; - ritualTimeUpCenterDirection -= npc.Center; - if (ritualTimeUpCenterDirection == Vector2.Zero) - ritualTimeUpCenterDirection = -Vector2.UnitY; - - ritualTimeUpCenterDirection.Normalize(); - - if (Math.Abs(ritualTimeUpCenterDirection.Y) < 0.77f) - npc.localAI[2] = 11f; - else if (ritualTimeUpCenterDirection.Y < 0f) - npc.localAI[2] = 12f; - else - npc.localAI[2] = 10f; - - int ritualTimeUpFaceDirection = Math.Sign(ritualTimeUpCenterDirection.X); - if (ritualTimeUpFaceDirection != 0) - npc.direction = npc.spriteDirection = ritualTimeUpFaceDirection; - } - } - - npc.ai[1] += 1f; - if (npc.ai[1] >= timeToFinishRitual) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[3] += 1f; - npc.velocity = Vector2.Zero; - npc.netUpdate = true; - } - } - - // Pause - else if (npc.ai[0] == 6f) - { - npc.localAI[2] = 13f; - - npc.ai[1] += 1f; - if (npc.ai[1] >= (idleTime * 3)) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[3] += 1f; - npc.velocity = Vector2.Zero; - npc.netUpdate = true; - } - } - - // Ancient Light - else if (npc.ai[0] == 7f) - { - npc.localAI[2] = 11f; - - Vector2 playerDirection = Vector2.Normalize(player.Center - npc.Center); - if (playerDirection.HasNaNs()) - playerDirection = new Vector2(npc.direction, 0f); - - if ((npc.ai[1] >= 4f & isCultist) && (int)(npc.ai[1] - 4f) % ancientLightSpawnRate == 0) - { - if ((int)(npc.ai[1] - 4f) / ancientLightSpawnRate == 2) - { - List list7 = new List(); - for (int i = 0; i < Main.maxNPCs; i++) - { - if (Main.npc[i].active && Main.npc[i].type == NPCID.CultistBossClone && Main.npc[i].ai[3] == npc.whoAmI) - list7.Add(i); - } - - foreach (int current6 in list7) - { - NPC nPC6 = Main.npc[current6]; - Vector2 center6 = nPC6.Center; - - int cloneFaceDirection = Math.Sign(player.Center.X - center6.X); - if (cloneFaceDirection != 0) - nPC6.direction = nPC6.spriteDirection = cloneFaceDirection; - } - } - - int cultistFaceDirection = Math.Sign(player.Center.X - npc.Center.X); - if (cultistFaceDirection != 0) - npc.direction = npc.spriteDirection = cultistFaceDirection; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - playerDirection = Vector2.Normalize(player.Center - npc.Center); - if (playerDirection.HasNaNs()) - playerDirection = new Vector2(npc.direction, 0f); - - Vector2 ancientLightShootDirection = npc.Center + new Vector2(npc.direction * 30, 12f); - float scaleFactor = death ? 6f : 4f; - - float ancientLightSpread = MathHelper.ToRadians(15f); - int ancientLightInc = 0; - float totalAncientLights = 5f; - while (ancientLightInc < totalAncientLights) - { - Vector2 ancientLightSpeed = playerDirection * scaleFactor; - ancientLightSpeed = ancientLightSpeed.RotatedBy(ancientLightSpread * ancientLightInc - (MathHelper.Pi / totalAncientLights * 2f - ancientLightSpread) / 2f); - float ai = (Main.rand.NextFloat() - 0.5f) * 0.3f * MathHelper.TwoPi / 60f; - int ancientLightProj = NPC.NewNPC(npc.GetSource_FromAI(), (int)ancientLightShootDirection.X, (int)ancientLightShootDirection.Y + 7, NPCID.AncientLight, 0, 0f, ai, ancientLightSpeed.X, ancientLightSpeed.Y, 255); - Main.npc[ancientLightProj].velocity = ancientLightSpeed; - ancientLightInc++; - } - } - } - - npc.ai[1] += 1f; - if (npc.ai[1] >= (4 + ancientLightSpawnRate * ancientLightAmt)) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[3] += 1f; - npc.velocity = Vector2.Zero; - npc.netUpdate = true; - } - } - - // Ancient Doom - else if (npc.ai[0] == 8f) - { - npc.localAI[2] = 13f; - - if ((npc.ai[1] >= 4f & isCultist) && (int)(npc.ai[1] - 4f) % 20f == 0f) - { - List list8 = new List(); - for (int k = 0; k < Main.maxNPCs; k++) - { - if (Main.npc[k].active && Main.npc[k].type == NPCID.CultistBossClone && Main.npc[k].ai[3] == npc.whoAmI) - list8.Add(k); - } - - int ancientDoomAmt = list8.Count + 1; - if (ancientDoomAmt > 2) - ancientDoomAmt = 2; - - int ancientDoomFaceDirection = Math.Sign(player.Center.X - npc.Center.X); - if (ancientDoomFaceDirection != 0) - npc.direction = npc.spriteDirection = ancientDoomFaceDirection; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (phase4) - { - // Spawn circle of Ancient Dooms around target - for (int i = 0; i < ancientDoomLimit; i++) - { - float ai2 = i * 120; - NPC.NewNPC(npc.GetSource_FromAI(), (int)(player.Center.X + (float)(Math.Sin(i * 120) * 550)), (int)(player.Center.Y + (float)(Math.Cos(i * 120) * 550)), - NPCID.AncientDoom, 0, npc.whoAmI, 0f, ai2, 0f, Main.maxPlayers); - } - } - else - { - // Spawn Ancient Dooms randomly around the target - for (int i = 0; i < ancientDoomAmt; i++) - { - Point cultistCenterTileCoords = npc.Center.ToTileCoordinates(); - Point targetCenterTileCoords = Main.player[npc.target].Center.ToTileCoordinates(); - Vector2 targetDistanceDoom = Main.player[npc.target].Center - npc.Center; - - int randSpawnOffset = 20; - int cultistCenterSpawnOffset = 3; - int targetCenterSpawnOffset = 7; - int tileCollisionRange = 2; - int spawnAttempts = 0; - bool doomSufficientlyFar = targetDistanceDoom.Length() > 2800f; - while (!doomSufficientlyFar && spawnAttempts < 100) - { - spawnAttempts++; - int ancientDoomSpawnX = Main.rand.Next(targetCenterTileCoords.X - randSpawnOffset, targetCenterTileCoords.X + randSpawnOffset + 1); - int ancientDoomSpawnY = Main.rand.Next(targetCenterTileCoords.Y - randSpawnOffset, targetCenterTileCoords.Y + randSpawnOffset + 1); - if ((ancientDoomSpawnY < targetCenterTileCoords.Y - targetCenterSpawnOffset || ancientDoomSpawnY > targetCenterTileCoords.Y + targetCenterSpawnOffset || ancientDoomSpawnX < targetCenterTileCoords.X - targetCenterSpawnOffset || ancientDoomSpawnX > targetCenterTileCoords.X + targetCenterSpawnOffset) && (ancientDoomSpawnY < cultistCenterTileCoords.Y - cultistCenterSpawnOffset || ancientDoomSpawnY > cultistCenterTileCoords.Y + cultistCenterSpawnOffset || ancientDoomSpawnX < cultistCenterTileCoords.X - cultistCenterSpawnOffset || ancientDoomSpawnX > cultistCenterTileCoords.X + cultistCenterSpawnOffset) && !Main.tile[ancientDoomSpawnX, ancientDoomSpawnY].HasUnactuatedTile) - { - bool notInsideTiles = true; - if (notInsideTiles && Collision.SolidTiles(ancientDoomSpawnX - tileCollisionRange, ancientDoomSpawnX + tileCollisionRange, ancientDoomSpawnY - tileCollisionRange, ancientDoomSpawnY + tileCollisionRange)) - notInsideTiles = false; - - if (notInsideTiles) - { - NPC.NewNPC(npc.GetSource_FromAI(), ancientDoomSpawnX * 16 + 8, ancientDoomSpawnY * 16 + 8, NPCID.AncientDoom, 0, npc.whoAmI); - break; - } - } - } - } - } - } - } - - npc.ai[1] += 1f; - if (npc.ai[1] >= 64f) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[3] += 1f; - npc.velocity = Vector2.Zero; - npc.netUpdate = true; - } - } - - // Set Clones to Cultist phase - if (!isCultist) - npc.ai[3] = clonePhase; - - // Take damage or not - npc.dontTakeDamage = dontTakeDamage; - npc.chaseable = npc.ai[0] != -1f && npc.ai[0] != 5f; - - return false; - } - - public static bool BuffedAncientLightAI(NPC npc, Mod mod) - { - npc.dontTakeDamage = true; - - // Slow and kill code - if (npc.ai[0] == -1f) - { - // Slow down over time - if (npc.velocity.Length() >= 0.2f) - { - npc.velocity *= 0.96f; - } - else - { - npc.velocity = Vector2.Zero; - npc.position = npc.oldPosition; - - // Kill after 2 seconds - npc.ai[1] += 1f; - if (npc.ai[1] >= 240f) - { - npc.HitEffect(0, 9999.0); - npc.active = false; - } - } - - return false; - } - - npc.rotation = npc.velocity.ToRotation() - MathHelper.PiOver2; - - // Set velocity and emit dust when spawned - if (npc.localAI[0] == 0f) - { - npc.localAI[0] = 1f; - npc.velocity.X = npc.ai[2]; - npc.velocity.Y = npc.ai[3]; - for (int i = 0; i < 13; i++) - { - int ancientLight = Dust.NewDust(npc.position, npc.width, npc.height, 261, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f, 90, default, 2.5f); - Main.dust[ancientLight].noGravity = true; - Main.dust[ancientLight].fadeIn = 1f; - Dust dust = Main.dust[ancientLight]; - dust.velocity *= 4f; - Main.dust[ancientLight].noLight = true; - } - } - - // Spawn dust - for (int j = 0; j < 2; j++) - { - if (Main.rand.Next(10 - (int)Math.Min(7f, npc.velocity.Length())) < 1) - { - int ancientLight2 = Dust.NewDust(npc.position, npc.width, npc.height, 261, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f, 90, default, 2.5f); - Main.dust[ancientLight2].noGravity = true; - Dust dust = Main.dust[ancientLight2]; - dust.velocity *= 0.2f; - Main.dust[ancientLight2].fadeIn = 0.4f; - if (Main.rand.NextBool(6)) - { - dust = Main.dust[ancientLight2]; - dust.velocity *= 5f; - Main.dust[ancientLight2].noLight = true; - } - else - Main.dust[ancientLight2].velocity = npc.DirectionFrom(Main.dust[ancientLight2].position) * Main.dust[ancientLight2].velocity.Length(); - } - } - - if (npc.ai[0] >= 0f) - { - // Triple damage if the Primordial Wyrm is alive - if (npc.ai[0] == 0f) - { - if (CalamityGlobalNPC.adultEidolonWyrmHead != -1) - { - if (Main.npc[CalamityGlobalNPC.adultEidolonWyrmHead].active) - npc.damage *= 3; - } - } - - npc.ai[0] += 1f; - - float duration = 120f; - - // Increase velocity for 1 second - if (npc.ai[0] < duration - 60f) - { - if (npc.velocity.Length() < 20f) - npc.velocity *= 1.03f; - } - - // Intersect velocity paths with other Ancient Lights for 1 second - if (npc.ai[0] >= duration - 60f) - npc.velocity = npc.velocity.RotatedBy(npc.ai[1]); - - // Engage slow code - if (npc.ai[0] >= duration) - npc.ai[0] = -1f; - } - - return false; - } - - public static bool BuffedAncientDoomAI(NPC npc, Mod mod) - { - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; - npc.damage = npc.defDamage = 0; - float duration = 420f; - float spawnAnimTime = 120f; - int rateOfChange = 1; - float splitProjVelocity = death ? 4.8f : 3.2f; - - // Percent life remaining for Cultist or Eidolon Wyrm - float lifeRatio = Main.npc[(int)npc.ai[0]].life / (float)Main.npc[(int)npc.ai[0]].lifeMax; - - bool phase2 = lifeRatio < 0.7f; - bool phase3 = lifeRatio < (Main.npc[(int)npc.ai[0]].type == ModContent.NPCType() ? 0.6f : 0.55f); - bool phase4 = lifeRatio < 0.4f; - - bool kill = npc.ai[1] < 0f || !Main.npc[(int)npc.ai[0]].active; - int target = Main.maxPlayers; - if (Main.npc[(int)npc.ai[0]].type == NPCID.CultistBoss || Main.npc[(int)npc.ai[0]].type == ModContent.NPCType()) - { - if (target == Main.maxPlayers) - target = Main.npc[(int)npc.ai[0]].target; - - if (phase2 || death) - rateOfChange = 2; - - if (phase4 || death) - rateOfChange = 3; - - if (Main.npc[(int)npc.ai[0]].type == ModContent.NPCType()) - npc.dontTakeDamage = true; - } - else - kill = true; - - npc.ai[1] += rateOfChange; - float growthRate = npc.ai[1] / spawnAnimTime; - growthRate = MathHelper.Clamp(growthRate, 0f, 1f); - npc.position = npc.Center; - npc.scale = MathHelper.Lerp(0f, 1f, growthRate); - npc.Center = npc.position; - npc.alpha = (int)(255f - growthRate * 255f); - - if (phase3) - { - if (npc.ai[3] == 0f) - npc.ai[3] = npc.ai[2]; - - double deg = npc.ai[3]; - double rad = deg * (Math.PI / 180); - double dist = 550; - if (Main.npc[(int)npc.ai[0]].type == ModContent.NPCType()) - { - float aiGateValue = Main.npc[(int)npc.ai[0]].Calamity().newAI[2] - 30f; - int ancientDoomScale = (int)(aiGateValue / 120f); - dist += ancientDoomScale * 45; - } - npc.position.X = Main.player[target].Center.X - (int)(Math.Cos(rad) * dist) - npc.width / 2; - npc.position.Y = Main.player[target].Center.Y - (int)(Math.Sin(rad) * dist) - npc.height / 2; - float spinVelocity = 8f * (1f - (npc.ai[1] / duration)); - npc.ai[3] += spinVelocity; - } - - if (Main.rand.NextBool(6)) - { - Vector2 shadowflameDustRotate = Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi); - Dust shadowflameDust = Main.dust[Dust.NewDust(npc.Center - shadowflameDustRotate * 20f, 0, 0, 27, 0f, 0f, 0, default, 1f)]; - shadowflameDust.noGravity = true; - shadowflameDust.position = npc.Center - shadowflameDustRotate * Main.rand.Next(10, 21) * npc.scale; - shadowflameDust.velocity = shadowflameDustRotate.RotatedBy(MathHelper.PiOver2) * 4f; - shadowflameDust.scale = 0.5f + Main.rand.NextFloat(); - shadowflameDust.fadeIn = 0.5f; - } - if (Main.rand.NextBool(6)) - { - Vector2 darkDustRotate = Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi); - Dust darkDust = Main.dust[Dust.NewDust(npc.Center - darkDustRotate * 30f, 0, 0, 240, 0f, 0f, 0, default, 1f)]; - darkDust.noGravity = true; - darkDust.position = npc.Center - darkDustRotate * 20f * npc.scale; - darkDust.velocity = darkDustRotate.RotatedBy(-MathHelper.PiOver2) * 2f; - darkDust.scale = 0.5f + Main.rand.NextFloat(); - darkDust.fadeIn = 0.5f; - } - if (Main.rand.NextBool(6)) - { - Vector2 darkDustRotate2 = Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi); - Dust darkDust2 = Main.dust[Dust.NewDust(npc.Center - darkDustRotate2 * 30f, 0, 0, 240, 0f, 0f, 0, default, 1f)]; - darkDust2.position = npc.Center - darkDustRotate2 * 20f * npc.scale; - darkDust2.velocity = Vector2.Zero; - darkDust2.scale = 0.5f + Main.rand.NextFloat(); - darkDust2.fadeIn = 0.5f; - darkDust2.noLight = true; - } - - npc.localAI[0] += 0.05235988f; - - npc.localAI[1] = 0.25f + Vector2.UnitY.RotatedBy(npc.ai[1] * MathHelper.TwoPi / 60f).Y * 0.25f; - - if (npc.ai[1] >= duration) - { - int type = ProjectileID.AncientDoomProjectile; - int damage = npc.GetProjectileDamage(type); - - // Triple damage if the Primordial Wyrm is alive - if (Main.npc[(int)npc.ai[0]].type == ModContent.NPCType()) - damage *= 3; - - kill = true; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int totalProjectiles = CalamityWorld.LegendaryMode ? 9 : (Main.npc[(int)npc.ai[0]].type == NPCID.CultistBoss && !phase3) ? 8 : 4; - float radians = MathHelper.TwoPi / totalProjectiles; - Vector2 spinningPoint = new Vector2(0f, -splitProjVelocity); - for (int k = 0; k < totalProjectiles; k++) - { - Vector2 doomProjRotate = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, doomProjRotate, type, damage, 0f, Main.myPlayer); - } - } - } - - if (kill) - { - npc.HitEffect(0, 9999.0); - npc.active = false; - } - - return false; - } - } -} diff --git a/NPCs/VanillaNPCOverrides/Bosses/DestroyerAI.cs b/NPCs/VanillaNPCOverrides/Bosses/DestroyerAI.cs deleted file mode 100644 index abbaa9444e..0000000000 --- a/NPCs/VanillaNPCOverrides/Bosses/DestroyerAI.cs +++ /dev/null @@ -1,914 +0,0 @@ -using CalamityMod.Events; -using CalamityMod.Projectiles.Boss; -using CalamityMod.World; -using Microsoft.Xna.Framework; -using System; -using Terraria; -using Terraria.DataStructures; -using Terraria.Enums; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Audio; - -namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses -{ - public static class DestroyerAI - { - public static bool BuffedDestroyerAI(NPC npc, Mod mod) - { - int mechdusaCurvedSpineSegmentIndex = 0; - int mechdusaCurvedSpineSegments = 10; - if (NPC.IsMechQueenUp && npc.type != NPCID.TheDestroyer) - { - int mechdusaIndex = (int)npc.ai[1]; - while (mechdusaIndex > 0 && mechdusaIndex < Main.maxNPCs) - { - if (Main.npc[mechdusaIndex].active && Main.npc[mechdusaIndex].type >= NPCID.TheDestroyer && Main.npc[mechdusaIndex].type <= NPCID.TheDestroyerTail) - { - mechdusaCurvedSpineSegmentIndex++; - if (Main.npc[mechdusaIndex].type == NPCID.TheDestroyer) - break; - - if (mechdusaCurvedSpineSegmentIndex >= mechdusaCurvedSpineSegments) - { - mechdusaCurvedSpineSegmentIndex = 0; - break; - } - - mechdusaIndex = (int)Main.npc[mechdusaIndex].ai[1]; - continue; - } - - mechdusaCurvedSpineSegmentIndex = 0; - break; - } - } - - CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; - - // 10 seconds of resistance to prevent spawn killing - if (calamityGlobalNPC.newAI[1] < 600f) - calamityGlobalNPC.newAI[1] += 1f; - - calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = calamityGlobalNPC.newAI[1] < 600f; - - // Percent life remaining - float lifeRatio = npc.life / (float)npc.lifeMax; - - // Phases based on life percentage - bool phase2 = lifeRatio < 0.85f; - bool phase3 = lifeRatio < 0.7f; - bool startFlightPhase = lifeRatio < 0.5f; - bool phase4 = lifeRatio < (death ? 0.4f : 0.25f); - bool phase5 = lifeRatio < (death ? 0.2f : 0.1f); - - // Flight timer - float newAISet = phase5 ? 900f : phase4 ? 450f : 0f; - calamityGlobalNPC.newAI[3] += 1f; - if (calamityGlobalNPC.newAI[3] >= 1800f) - { - calamityGlobalNPC.newAI[3] = newAISet; - npc.TargetClosest(); - } - - // Set worm variable for worms - if (npc.ai[3] > 0f) - npc.realLife = (int)npc.ai[3]; - - // 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]; - - bool increaseSpeed = Vector2.Distance(player.Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles; - bool increaseSpeedMore = Vector2.Distance(player.Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance350Tiles; - - // Get a new target if current target is too far away - if (increaseSpeedMore && npc.type == NPCID.TheDestroyer) - npc.TargetClosest(); - - float enrageScale = bossRush ? 1f : 0f; - if (Main.dayTime || bossRush) - { - npc.Calamity().CurrentlyEnraged = !bossRush; - enrageScale += 2f; - } - - // Phase for flying at the player - bool flyAtTarget = (calamityGlobalNPC.newAI[3] >= 900f && startFlightPhase) || (calamityGlobalNPC.newAI[1] < 600f && calamityGlobalNPC.newAI[1] > 60f); - - // Dust on spawn and alpha effects - if (npc.type == NPCID.TheDestroyer || (npc.type != NPCID.TheDestroyer && Main.npc[(int)npc.ai[1]].alpha < 128)) - { - if (npc.alpha != 0) - { - for (int i = 0; i < 2; i++) - { - int spawnDust = Dust.NewDust(npc.position, npc.width, npc.height, 182, 0f, 0f, 100, default, 2f); - Main.dust[spawnDust].noGravity = true; - Main.dust[spawnDust].noLight = true; - } - } - npc.alpha -= 42; - if (npc.alpha < 0) - npc.alpha = 0; - } - - // Check if other segments are still alive, if not, die - if (npc.type > NPCID.TheDestroyer) - { - bool shouldDespawn = true; - for (int i = 0; i < Main.maxNPCs; i++) - { - if (Main.npc[i].active && Main.npc[i].type == NPCID.TheDestroyer) - { - shouldDespawn = false; - break; - } - } - if (!shouldDespawn) - { - if (npc.ai[1] <= 0f) - shouldDespawn = true; - else if (Main.npc[(int)npc.ai[1]].life <= 0) - shouldDespawn = true; - } - if (shouldDespawn) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - npc.active = false; - } - } - - if (npc.type == NPCID.TheDestroyerBody) - { - // Enrage, fire more cyan lasers - if (enrageScale > 0f && !bossRush) - { - if (calamityGlobalNPC.newAI[2] < 480f) - calamityGlobalNPC.newAI[2] += 1f; - } - else - { - if (calamityGlobalNPC.newAI[2] > 0f) - calamityGlobalNPC.newAI[2] -= 1f; - } - } - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (npc.type == NPCID.TheDestroyer) - { - // Spawn segments from head - if (npc.ai[0] == 0f) - { - npc.ai[3] = npc.whoAmI; - npc.realLife = npc.whoAmI; - int index = npc.whoAmI; - int totalSegments = Main.getGoodWorld ? 100 : 80; - for (int j = 0; j <= totalSegments; j++) - { - int type = NPCID.TheDestroyerBody; - if (j == totalSegments) - type = NPCID.TheDestroyerTail; - - int segment = NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.position.X + (npc.width / 2)), (int)(npc.position.Y + npc.height), type, npc.whoAmI); - Main.npc[segment].ai[3] = npc.whoAmI; - Main.npc[segment].realLife = npc.whoAmI; - Main.npc[segment].ai[1] = index; - Main.npc[index].ai[0] = segment; - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, segment, 0f, 0f, 0f, 0, 0, 0); - index = segment; - } - } - - // Laser breath in Death Mode - if (death) - { - if (calamityGlobalNPC.newAI[0] < 600f) - calamityGlobalNPC.newAI[0] += 1f; - - if (npc.SafeDirectionTo(player.Center).AngleBetween((npc.rotation - MathHelper.PiOver2).ToRotationVector2()) < MathHelper.ToRadians(18f) && - calamityGlobalNPC.newAI[0] >= 600f && Vector2.Distance(npc.Center, player.Center) > 480f && - Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) - { - if (calamityGlobalNPC.newAI[0] % 30f == 0f) - { - float velocity = bossRush ? 6f : death ? 5.333f : 5f; - int type = ProjectileID.DeathLaser; - int damage = npc.GetProjectileDamage(type); - Vector2 projectileVelocity = (player.Center - npc.Center).SafeNormalize(Vector2.UnitY) * velocity; - int numProj = calamityGlobalNPC.newAI[0] % 60f == 0f ? 7 : 4; - int spread = 54; - float rotation = MathHelper.ToRadians(spread); - for (int i = 0; i < numProj; i++) - { - Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + Vector2.Normalize(perturbedSpeed) * 5f, perturbedSpeed, type, damage, 0f, Main.myPlayer, 1f, 0f); - Main.projectile[proj].timeLeft = 900; - } - } - - calamityGlobalNPC.newAI[0] += 1f; - if (calamityGlobalNPC.newAI[0] > 660f) - calamityGlobalNPC.newAI[0] = 0f; - } - } - } - - // Fire lasers - if (npc.type == NPCID.TheDestroyerBody) - { - // Laser rate of fire - calamityGlobalNPC.newAI[0] += 1f; - float shootProjectile = death ? 180 : 300; - float timer = npc.ai[0] * 30f; - float shootProjectileGateValue = timer + shootProjectile; - - // Shoot lasers - // 50% chance to shoot harmless scrap if probe has been launched - bool probeLaunched = npc.ai[2] == 1f; - if (calamityGlobalNPC.newAI[0] >= shootProjectileGateValue) - { - calamityGlobalNPC.newAI[0] = 0f; - npc.TargetClosest(); - if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) - { - // Laser speed - float projectileSpeed = 3.5f + Main.rand.NextFloat() * 1.5f; - projectileSpeed += enrageScale; - - // Set projectile damage and type - int projectileType = ProjectileID.DeathLaser; - float laserSpawnDistance = 10f; - int random = phase3 ? 4 : phase2 ? 3 : 2; - switch (Main.rand.Next(random)) - { - case 0: - case 1: - break; - case 2: - projectileType = ModContent.ProjectileType(); - break; - case 3: - projectileType = ModContent.ProjectileType(); - break; - } - - if (calamityGlobalNPC.newAI[2] > 0f || bossRush) - { - projectileType = ModContent.ProjectileType(); - laserSpawnDistance = 20f; - } - - bool weakLaser = false; - if (probeLaunched) - { - weakLaser = true; - projectileType = ProjectileID.EyeLaser; - laserSpawnDistance = 0f; - } - - // Get target vector - Vector2 projectileVelocity = (player.Center - npc.Center).SafeNormalize(Vector2.UnitY) * projectileSpeed; - Vector2 projectileSpawn = npc.Center + projectileVelocity * laserSpawnDistance; - - // Shoot projectile - int damage = npc.GetProjectileDamage(projectileType); - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), projectileSpawn, projectileVelocity, projectileType, damage, 0f, Main.myPlayer, weakLaser ? 0f : 1f, 0f); - Main.projectile[proj].timeLeft = weakLaser ? 600 : 900; - - npc.netUpdate = true; - } - } - } - } - - int tilePosX = (int)(npc.position.X / 16f) - 1; - int tileWidthPosX = (int)((npc.position.X + npc.width) / 16f) + 2; - int tilePosY = (int)(npc.position.Y / 16f) - 1; - int tileWidthPosY = (int)((npc.position.Y + npc.height) / 16f) + 2; - - if (tilePosX < 0) - tilePosX = 0; - if (tileWidthPosX > Main.maxTilesX) - tileWidthPosX = Main.maxTilesX; - if (tilePosY < 0) - tilePosY = 0; - if (tileWidthPosY > Main.maxTilesY) - tileWidthPosY = Main.maxTilesY; - - // Fly or not - bool shouldFly = flyAtTarget; - if (!shouldFly) - { - for (int k = tilePosX; k < tileWidthPosX; k++) - { - for (int l = tilePosY; l < tileWidthPosY; l++) - { - if (Main.tile[k, l] != null && ((Main.tile[k, l].HasUnactuatedTile && (Main.tileSolid[Main.tile[k, l].TileType] || (Main.tileSolidTop[Main.tile[k, l].TileType] && Main.tile[k, l].TileFrameY == 0))) || Main.tile[k, l].LiquidAmount > 64)) - { - Vector2 tileConvertedPosition; - tileConvertedPosition.X = k * 16; - tileConvertedPosition.Y = l * 16; - if (npc.position.X + npc.width > tileConvertedPosition.X && npc.position.X < tileConvertedPosition.X + 16f && npc.position.Y + npc.height > tileConvertedPosition.Y && npc.position.Y < tileConvertedPosition.Y + 16f) - { - shouldFly = true; - break; - } - } - } - } - } - - // Start flying if target is not within a certain distance - if (!shouldFly) - { - npc.localAI[1] = 1f; - - if (npc.type == NPCID.TheDestroyer) - { - Rectangle rectangle = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); - int noFlyZone = 1000; - int heightReduction = death ? 400 : (int)(400f * (1f - lifeRatio)); - int height = 1800 - heightReduction; - bool outsideNoFlyZone = true; - - if (npc.position.Y > player.position.Y) - { - for (int m = 0; m < Main.maxPlayers; m++) - { - if (Main.player[m].active) - { - Rectangle noFlyRectangle = new Rectangle((int)Main.player[m].position.X - noFlyZone, (int)Main.player[m].position.Y - noFlyZone, noFlyZone * 2, height); - if (rectangle.Intersects(noFlyRectangle)) - { - outsideNoFlyZone = false; - break; - } - } - } - if (outsideNoFlyZone) - shouldFly = true; - } - } - } - else - npc.localAI[1] = 0f; - - // Despawn - float fallSpeed = 16f; - if (player.dead) - { - shouldFly = false; - npc.velocity.Y += 2f; - - if (npc.position.Y > Main.worldSurface * 16.0) - { - npc.velocity.Y += 2f; - fallSpeed = 32f; - } - - if (npc.position.Y > Main.rockLayer * 16.0) - { - for (int n = 0; n < Main.maxNPCs; n++) - { - if (Main.npc[n].aiStyle == npc.aiStyle) - Main.npc[n].active = false; - } - } - } - - float fallSpeedBoost = death ? 6.5f * (1f - lifeRatio) : 5f * (1f - lifeRatio); - fallSpeed += fallSpeedBoost; - fallSpeed += 4f * enrageScale; - - // Speed and movement - float speedBoost = death ? (0.14f * (1f - lifeRatio)) : (0.1f * (1f - lifeRatio)); - float turnSpeedBoost = death ? (0.19f * (1f - lifeRatio)) : (0.15f * (1f - lifeRatio)); - float speed = 0.1f + speedBoost; - float turnSpeed = 0.15f + turnSpeedBoost; - speed += 0.04f * enrageScale; - turnSpeed += 0.06f * enrageScale; - - if (flyAtTarget) - { - float speedMultiplier = phase5 ? 1.8f : phase4 ? 1.65f : 1.5f; - speed *= speedMultiplier; - } - - speed *= increaseSpeedMore ? 2f : increaseSpeed ? 1.5f : 1f; - turnSpeed *= increaseSpeedMore ? 2f : increaseSpeed ? 1.5f : 1f; - - if (Main.getGoodWorld) - { - speed *= 1.2f; - turnSpeed *= 1.2f; - } - - Vector2 npcCenter = npc.Center; - float targetTilePosX = player.position.X + (player.width / 2); - float targetTilePosY = player.position.Y + (player.height / 2); - targetTilePosX = (int)(targetTilePosX / 16f) * 16; - targetTilePosY = (int)(targetTilePosY / 16f) * 16; - npcCenter.X = (int)(npcCenter.X / 16f) * 16; - npcCenter.Y = (int)(npcCenter.Y / 16f) * 16; - targetTilePosX -= npcCenter.X; - targetTilePosY -= npcCenter.Y; - float targetTileDist = (float)Math.Sqrt(targetTilePosX * targetTilePosX + targetTilePosY * targetTilePosY); - - if (npc.ai[1] > 0f && npc.ai[1] < Main.npc.Length) - { - int mechdusaSegmentScale = (int)(44f * npc.scale); - try - { - npcCenter = npc.Center; - targetTilePosX = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - npcCenter.X; - targetTilePosY = Main.npc[(int)npc.ai[1]].position.Y + (Main.npc[(int)npc.ai[1]].height / 2) - npcCenter.Y; - } - catch - { - } - - if (mechdusaCurvedSpineSegmentIndex > 0) - { - float absoluteTilePosX = (float)mechdusaSegmentScale - (float)mechdusaSegmentScale * (((float)mechdusaCurvedSpineSegmentIndex - 1f) * 0.1f); - if (absoluteTilePosX < 0f) - absoluteTilePosX = 0f; - - if (absoluteTilePosX > (float)mechdusaSegmentScale) - absoluteTilePosX = mechdusaSegmentScale; - - targetTilePosY = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) + absoluteTilePosX - npcCenter.Y; - } - - npc.rotation = (float)Math.Atan2(targetTilePosY, targetTilePosX) + MathHelper.PiOver2; - targetTileDist = (float)Math.Sqrt(targetTilePosX * targetTilePosX + targetTilePosY * targetTilePosY); - if (mechdusaCurvedSpineSegmentIndex > 0) - mechdusaSegmentScale = mechdusaSegmentScale / mechdusaCurvedSpineSegments * mechdusaCurvedSpineSegmentIndex; - - targetTileDist = (targetTileDist - mechdusaSegmentScale) / targetTileDist; - targetTilePosX *= targetTileDist; - targetTilePosY *= targetTileDist; - npc.velocity = Vector2.Zero; - npc.position.X += targetTilePosX; - npc.position.Y += targetTilePosY; - } - else - { - if (!shouldFly) - { - npc.velocity.Y += 0.15f; - if (npc.velocity.Y > fallSpeed) - npc.velocity.Y = fallSpeed; - - if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < fallSpeed * 0.4) - { - if (npc.velocity.X < 0f) - npc.velocity.X -= speed * 1.1f; - else - npc.velocity.X += speed * 1.1f; - } - else if (npc.velocity.Y == fallSpeed) - { - if (npc.velocity.X < targetTilePosX) - npc.velocity.X += speed; - else if (npc.velocity.X > targetTilePosX) - npc.velocity.X -= speed; - } - else if (npc.velocity.Y > 4f) - { - if (npc.velocity.X < 0f) - npc.velocity.X += speed * 0.9f; - else - npc.velocity.X -= speed * 0.9f; - } - } - else - { - if (npc.soundDelay == 0) - { - float soundDelay = targetTileDist / 40f; - if (soundDelay < 10f) - soundDelay = 10f; - if (soundDelay > 20f) - soundDelay = 20f; - - npc.soundDelay = (int)soundDelay; - SoundEngine.PlaySound(SoundID.WormDig, npc.position); - } - - targetTileDist = (float)Math.Sqrt(targetTilePosX * targetTilePosX + targetTilePosY * targetTilePosY); - float absoluteTilePosX = Math.Abs(targetTilePosX); - float absoluteTilePosY = Math.Abs(targetTilePosY); - float tileToReachTarget = fallSpeed / targetTileDist; - targetTilePosX *= tileToReachTarget; - targetTilePosY *= tileToReachTarget; - - bool flyWyvernMovement = false; - if (flyAtTarget) - { - if (((npc.velocity.X > 0f && targetTilePosX < 0f) || (npc.velocity.X < 0f && targetTilePosX > 0f) || (npc.velocity.Y > 0f && targetTilePosY < 0f) || (npc.velocity.Y < 0f && targetTilePosY > 0f)) && Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) > speed / 2f && targetTileDist < 400f) - { - flyWyvernMovement = true; - - if (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) < fallSpeed) - npc.velocity *= 1.1f; - } - - if (npc.position.Y > player.position.Y) - { - flyWyvernMovement = true; - - if (Math.Abs(npc.velocity.X) < fallSpeed / 2f) - { - if (npc.velocity.X == 0f) - npc.velocity.X -= npc.direction; - - npc.velocity.X *= 1.1f; - } - else if (npc.velocity.Y > -fallSpeed) - npc.velocity.Y -= speed; - } - } - - if (!flyWyvernMovement) - { - if (!flyAtTarget) - { - if (((npc.velocity.X > 0f && targetTilePosX > 0f) || (npc.velocity.X < 0f && targetTilePosX < 0f)) && ((npc.velocity.Y > 0f && targetTilePosY > 0f) || (npc.velocity.Y < 0f && targetTilePosY < 0f))) - { - if (npc.velocity.X < targetTilePosX) - npc.velocity.X += turnSpeed; - else if (npc.velocity.X > targetTilePosX) - npc.velocity.X -= turnSpeed; - if (npc.velocity.Y < targetTilePosY) - npc.velocity.Y += turnSpeed; - else if (npc.velocity.Y > targetTilePosY) - npc.velocity.Y -= turnSpeed; - } - } - - if ((npc.velocity.X > 0f && targetTilePosX > 0f) || (npc.velocity.X < 0f && targetTilePosX < 0f) || (npc.velocity.Y > 0f && targetTilePosY > 0f) || (npc.velocity.Y < 0f && targetTilePosY < 0f)) - { - if (npc.velocity.X < targetTilePosX) - npc.velocity.X += speed; - else if (npc.velocity.X > targetTilePosX) - npc.velocity.X -= speed; - if (npc.velocity.Y < targetTilePosY) - npc.velocity.Y += speed; - else if (npc.velocity.Y > targetTilePosY) - npc.velocity.Y -= speed; - - if (Math.Abs(targetTilePosY) < fallSpeed * 0.2 && ((npc.velocity.X > 0f && targetTilePosX < 0f) || (npc.velocity.X < 0f && targetTilePosX > 0f))) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y += speed * 2f; - else - npc.velocity.Y -= speed * 2f; - } - if (Math.Abs(targetTilePosX) < fallSpeed * 0.2 && ((npc.velocity.Y > 0f && targetTilePosY < 0f) || (npc.velocity.Y < 0f && targetTilePosY > 0f))) - { - if (npc.velocity.X > 0f) - npc.velocity.X += speed * 2f; - else - npc.velocity.X -= speed * 2f; - } - } - else if (absoluteTilePosX > absoluteTilePosY) - { - if (npc.velocity.X < targetTilePosX) - npc.velocity.X += speed * 1.1f; - else if (npc.velocity.X > targetTilePosX) - npc.velocity.X -= speed * 1.1f; - - if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < fallSpeed * 0.5) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y += speed; - else - npc.velocity.Y -= speed; - } - } - else - { - if (npc.velocity.Y < targetTilePosY) - npc.velocity.Y += speed * 1.1f; - else if (npc.velocity.Y > targetTilePosY) - npc.velocity.Y -= speed * 1.1f; - - if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < fallSpeed * 0.5) - { - if (npc.velocity.X > 0f) - npc.velocity.X += speed; - else - npc.velocity.X -= speed; - } - } - } - } - - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) + MathHelper.PiOver2; - - if (npc.type == NPCID.TheDestroyer) - { - if (shouldFly) - { - if (npc.localAI[0] != 1f) - npc.netUpdate = true; - - npc.localAI[0] = 1f; - } - else - { - if (npc.localAI[0] != 0f) - npc.netUpdate = true; - - npc.localAI[0] = 0f; - } - - if (((npc.velocity.X > 0f && npc.oldVelocity.X < 0f) || (npc.velocity.X < 0f && npc.oldVelocity.X > 0f) || (npc.velocity.Y > 0f && npc.oldVelocity.Y < 0f) || (npc.velocity.Y < 0f && npc.oldVelocity.Y > 0f)) && !npc.justHit) - npc.netUpdate = true; - } - } - - if (NPC.IsMechQueenUp && npc.type == NPCID.TheDestroyer) - { - NPC nPC = Main.npc[NPC.mechQueen]; - Vector2 mechQueenCenter = nPC.GetMechQueenCenter(); - Vector2 mechdusaSpinningVector = new Vector2(0f, 100f); - Vector2 spinningpoint = mechQueenCenter + mechdusaSpinningVector; - float mechdusaRotation = nPC.velocity.X * 0.025f; - spinningpoint = spinningpoint.RotatedBy(mechdusaRotation, mechQueenCenter); - npc.position = spinningpoint - npc.Size / 2f + nPC.velocity; - npc.velocity.X = 0f; - npc.velocity.Y = 0f; - npc.rotation = mechdusaRotation * 0.75f + (float)Math.PI; - } - - return false; - } - - public static bool BuffedProbeAI(NPC npc, Mod mod) - { - bool bossRush = BossRushEvent.BossRushActive; - - // Get a target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(); - - NPCAimedTarget targetData = npc.GetTargetData(); - bool targetDead = false; - if (targetData.Type == NPCTargetType.Player) - targetDead = Main.player[npc.target].dead; - - float velocity = bossRush ? 8f : 6f; - float acceleration = bossRush ? 0.1f : 0.05f; - - Vector2 probeCenter = npc.Center; - float probeTargetX = targetData.Center.X; - float probeTargetY = targetData.Center.Y; - probeTargetX = (int)(probeTargetX / 8f) * 8; - probeTargetY = (int)(probeTargetY / 8f) * 8; - probeCenter.X = (int)(probeCenter.X / 8f) * 8; - probeCenter.Y = (int)(probeCenter.Y / 8f) * 8; - probeTargetX -= probeCenter.X; - probeTargetY -= probeCenter.Y; - float distanceFromTarget = (float)Math.Sqrt(probeTargetX * probeTargetX + probeTargetY * probeTargetY); - float distance2 = distanceFromTarget; - - bool farAwayFromTarget = false; - if (distanceFromTarget > 600f) - farAwayFromTarget = true; - - if (distanceFromTarget == 0f) - { - probeTargetX = npc.velocity.X; - probeTargetY = npc.velocity.Y; - } - else - { - distanceFromTarget = velocity / distanceFromTarget; - probeTargetX *= distanceFromTarget; - probeTargetY *= distanceFromTarget; - } - - for (int i = 0; i < Main.maxNPCs; i++) - { - if (i != npc.whoAmI && Main.npc[i].active && Main.npc[i].type == npc.type) - { - Vector2 otherProbeDist = Main.npc[i].Center - npc.Center; - if (otherProbeDist.Length() < (npc.width + npc.height)) - { - otherProbeDist = otherProbeDist.SafeNormalize(Vector2.UnitY); - otherProbeDist *= -0.1f; - npc.velocity += otherProbeDist; - Main.npc[i].velocity -= otherProbeDist; - } - } - } - - if (distance2 > 100f) - { - npc.ai[0] += 1f; - if (npc.ai[0] > 0f) - npc.velocity.Y += 0.023f; - else - npc.velocity.Y -= 0.023f; - - if (npc.ai[0] < -100f || npc.ai[0] > 100f) - npc.velocity.X += 0.023f; - else - npc.velocity.X -= 0.023f; - - if (npc.ai[0] > 200f) - npc.ai[0] = -200f; - } - - if (targetDead) - { - probeTargetX = npc.direction * velocity / 2f; - probeTargetY = -velocity / 2f; - } - - if (npc.ai[3] != 0f) - { - if (NPC.IsMechQueenUp) - { - NPC nPC = Main.npc[NPC.mechQueen]; - Vector2 tileConvertedPosition = new Vector2(26f * npc.ai[3], 0f); - int mechdusaProbe = (int)npc.ai[2]; - if (mechdusaProbe < 0 || mechdusaProbe >= Main.maxNPCs) - { - mechdusaProbe = NPC.FindFirstNPC(NPCID.TheDestroyer); - npc.ai[2] = mechdusaProbe; - npc.netUpdate = true; - } - - if (mechdusaProbe > -1) - { - NPC nPC2 = Main.npc[mechdusaProbe]; - if (!nPC2.active || nPC2.type != NPCID.TheDestroyer) - { - npc.dontTakeDamage = false; - if (npc.ai[3] > 0f) - npc.netUpdate = true; - - npc.ai[3] = 0f; - } - else - { - Vector2 spinningpoint = nPC2.Center + tileConvertedPosition; - spinningpoint = spinningpoint.RotatedBy(nPC2.rotation, nPC2.Center); - npc.Center = spinningpoint; - npc.velocity = nPC.velocity; - npc.dontTakeDamage = true; - } - } - else - { - npc.dontTakeDamage = false; - if (npc.ai[3] > 0f) - npc.netUpdate = true; - - npc.ai[3] = 0f; - } - } - else - { - npc.dontTakeDamage = false; - if (npc.ai[3] > 0f) - npc.netUpdate = true; - - npc.ai[3] = 0f; - } - } - else - { - npc.dontTakeDamage = false; - - if (npc.velocity.X < probeTargetX) - npc.velocity.X += acceleration; - else if (npc.velocity.X > probeTargetX) - npc.velocity.X -= acceleration; - - if (npc.velocity.Y < probeTargetY) - npc.velocity.Y += acceleration; - else if (npc.velocity.Y > probeTargetY) - npc.velocity.Y -= acceleration; - } - - npc.localAI[0] += 1f; - if (npc.justHit) - npc.localAI[0] = 0f; - - float laserGateValue = NPC.IsMechQueenUp ? 360f : bossRush ? 150f : 240f; - if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] >= laserGateValue) - { - npc.localAI[0] = 0f; - if (targetData.Type != 0 && Collision.CanHit(npc.position, npc.width, npc.height, targetData.Position, targetData.Width, targetData.Height)) - { - int type = ProjectileID.PinkLaser; - int damage = npc.GetProjectileDamage(type); - int totalProjectiles = (CalamityWorld.death || bossRush) ? 3 : 1; - Vector2 npcCenter = new Vector2(probeTargetX, probeTargetY); - if (NPC.IsMechQueenUp) - { - Vector2 v = targetData.Center - npc.Center - targetData.Velocity * 20f; - float projectileVelocity = 8f; - npcCenter = v.SafeNormalize(Vector2.UnitY) * projectileVelocity; - } - for (int i = 0; i < totalProjectiles; i++) - { - float velocityMultiplier = 1f; - switch (i) - { - case 0: - break; - case 1: - velocityMultiplier = 0.9f; - break; - case 2: - velocityMultiplier = 0.8f; - break; - } - Projectile.NewProjectile(npc.GetSource_FromAI(), probeCenter, npcCenter * velocityMultiplier, type, damage, 0f, Main.myPlayer); - } - - npc.netUpdate = true; - } - } - - if (probeTargetX > 0f) - { - npc.spriteDirection = 1; - npc.rotation = (float)Math.Atan2(probeTargetY, probeTargetX); - } - if (probeTargetX < 0f) - { - npc.spriteDirection = -1; - npc.rotation = (float)Math.Atan2(probeTargetY, probeTargetX) + MathHelper.Pi; - } - - float tilePosX = -0.7f; - if (npc.collideX) - { - npc.netUpdate = true; - npc.velocity.X = npc.oldVelocity.X * tilePosX; - if (npc.direction == -1 && npc.velocity.X > 0f && npc.velocity.X < 2f) - npc.velocity.X = 2f; - if (npc.direction == 1 && npc.velocity.X < 0f && npc.velocity.X > -2f) - npc.velocity.X = -2f; - } - - if (npc.collideY) - { - npc.netUpdate = true; - npc.velocity.Y = npc.oldVelocity.Y * tilePosX; - if (npc.velocity.Y > 0f && npc.velocity.Y < 1.5) - npc.velocity.Y = 2f; - if (npc.velocity.Y < 0f && npc.velocity.Y > -1.5) - npc.velocity.Y = -2f; - } - - if (farAwayFromTarget) - { - if ((npc.velocity.X > 0f && probeTargetX > 0f) || (npc.velocity.X < 0f && probeTargetX < 0f)) - { - if (Math.Abs(npc.velocity.X) < (NPC.IsMechQueenUp ? 5f : 12f)) - npc.velocity.X *= 1.05f; - } - else - npc.velocity.X *= 0.9f; - } - - if (NPC.IsMechQueenUp && npc.ai[2] == 0f) - { - Vector2 center = npc.GetTargetData().Center; - Vector2 v2 = center - npc.Center; - if (v2.Length() < 120f) - npc.Center = center - v2.SafeNormalize(Vector2.UnitY) * 120; - } - - if (targetDead) - { - npc.velocity.Y -= acceleration * 2f; - if (npc.timeLeft > 10) - npc.timeLeft = 10; - } - - if (((npc.velocity.X > 0f && npc.oldVelocity.X < 0f) || (npc.velocity.X < 0f && npc.oldVelocity.X > 0f) || (npc.velocity.Y > 0f && npc.oldVelocity.Y < 0f) || (npc.velocity.Y < 0f && npc.oldVelocity.Y > 0f)) && !npc.justHit) - { - npc.netUpdate = true; - } - - return false; - } - } -} diff --git a/NPCs/VanillaNPCOverrides/Bosses/DukeFishronAI.cs b/NPCs/VanillaNPCOverrides/Bosses/DukeFishronAI.cs deleted file mode 100644 index 338ce7f742..0000000000 --- a/NPCs/VanillaNPCOverrides/Bosses/DukeFishronAI.cs +++ /dev/null @@ -1,1056 +0,0 @@ -using CalamityMod.Events; -using CalamityMod.World; -using Microsoft.Xna.Framework; -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Audio; - -namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses -{ - public static class DukeFishronAI - { - public static bool BuffedDukeFishronAI(NPC npc, Mod mod) - { - CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - - // Percent life remaining - float lifeRatio = npc.life / (float)npc.lifeMax; - - // Variables - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; - bool phase2 = lifeRatio < 0.7f; - bool phase3 = lifeRatio < 0.4f; - bool phase4 = lifeRatio < 0.2f; - bool phase2AI = npc.ai[0] > 4f; - bool phase3AI = npc.ai[0] > 9f; - bool charging = npc.ai[3] < 10f; - - // Adjust stats - if (phase3AI) - { - npc.damage = (int)(npc.defDamage * 1.32f); - npc.defense = 0; - } - else if (phase2AI) - { - npc.damage = (int)(npc.defDamage * 1.44f); - npc.defense = (int)(npc.defDefense * 0.8f); - } - else - { - npc.damage = npc.defDamage; - npc.defense = npc.defDefense; - } - - int idlePhaseTimer = 30; - float idlePhaseAcceleration = 0.55f; - float idlePhaseVelocity = 8.5f; - if (phase3AI) - { - idlePhaseAcceleration = 0.7f; - idlePhaseVelocity = 12f; - } - else if (phase2AI & charging) - { - idlePhaseAcceleration = 0.6f; - idlePhaseVelocity = 10f; - } - - if (Main.getGoodWorld) - { - idlePhaseAcceleration *= 1.15f; - idlePhaseVelocity *= 1.15f; - } - - int chargeTime = 28; - float chargeVelocity = 17f; - if (phase3AI) - { - chargeTime = 25; - chargeVelocity = 27f; - } - else if (charging & phase2AI) - { - chargeTime = 27; - chargeVelocity = 21f; - } - - if (death) - { - idlePhaseTimer = 28; - idlePhaseAcceleration *= 1.05f; - idlePhaseVelocity *= 1.08f; - chargeTime -= 1; - chargeVelocity *= 1.13f; - } - - if (Main.getGoodWorld) - chargeVelocity *= 1.15f; - - int bubbleBelchPhaseTimer = death ? 60 : 80; - int bubbleBelchPhaseDivisor = death ? 3 : 4; - float bubbleBelchPhaseAcceleration = death ? 0.35f : 0.3f; - float bubbleBelchPhaseVelocity = death ? 5.5f : 5f; - - if (Main.getGoodWorld) - { - bubbleBelchPhaseAcceleration *= 1.5f; - bubbleBelchPhaseVelocity *= 1.5f; - } - - int sharknadoPhaseTimer = 90; - - int phaseTransitionTimer = 180; - - int teleportPhaseTimer = 30; - - int bubbleSpinPhaseTimer = bossRush ? 45 : death ? 90 : 120; - int bubbleSpinPhaseDivisor = death ? 3 : 4; - float bubbleSpinBubbleVelocity = death ? 8f : 7f; - float bubbleSpinPhaseVelocity = 20f; - float bubbleSpinPhaseRotation = MathHelper.TwoPi / (bubbleSpinPhaseTimer / 2); - - if (Main.getGoodWorld) - bubbleSpinBubbleVelocity *= 1.5f; - - int spawnEffectPhaseTimer = 75; - - Player player = Main.player[npc.target]; - - // Get target - if (npc.target < 0 || npc.target == Main.maxPlayers || player.dead || !player.active) - { - npc.TargetClosest(); - player = Main.player[npc.target]; - npc.netUpdate = true; - } - - // Despawn safety, make sure to target another player if the current player target is too far away - if (Vector2.Distance(player.Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) - npc.TargetClosest(); - - // Despawn - if (player.dead || Vector2.Distance(player.Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance350Tiles) - { - npc.TargetClosest(); - - npc.velocity.Y -= 0.4f; - - if (npc.timeLeft > 10) - npc.timeLeft = 10; - - if (npc.ai[0] > 4f) - npc.ai[0] = 5f; - else - npc.ai[0] = 0f; - - npc.ai[2] = 0f; - } - - // Enrage variable - bool enrage = !bossRush && - (player.position.Y < 800f || player.position.Y > Main.worldSurface * 16.0 || - (player.position.X > 6400f && player.position.X < (Main.maxTilesX * 16 - 6400))); - - npc.Calamity().CurrentlyEnraged = !bossRush && enrage; - - // Make him always able to take damage - npc.dontTakeDamage = false; - - // Increased DR during phase transitions - calamityGlobalNPC.DR = (npc.ai[0] == -1f || npc.ai[0] == 4f || npc.ai[0] == 9f) ? (bossRush ? 0.99f : 0.625f) : 0.15f; - calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = npc.ai[0] == -1f || npc.ai[0] == 4f || npc.ai[0] == 9f; - - // Enrage - if (enrage || bossRush) - { - bubbleBelchPhaseTimer = 20; - bubbleBelchPhaseDivisor = 1; - bubbleBelchPhaseAcceleration = 0.65f; - bubbleBelchPhaseVelocity = 10f; - idlePhaseTimer = 20; - idlePhaseAcceleration = 1f; - idlePhaseVelocity = 15f; - chargeTime = 24; - chargeVelocity += 5f; - bubbleSpinPhaseDivisor = 1; - bubbleSpinBubbleVelocity = 15f; - - if (!bossRush) - { - npc.damage = npc.defDamage * 2; - npc.defense = npc.defDefense * 3; - } - } - - if (CalamityWorld.LegendaryMode) - chargeTime += Main.rand.Next(5, 66); - - // Spawn cthulhunadoes in phase 3 - if (phase3AI && (!phase4 || Main.getGoodWorld)) - { - calamityGlobalNPC.newAI[0] += 1f; - float timeGateValue = 600f; - if (calamityGlobalNPC.newAI[0] >= timeGateValue) - { - calamityGlobalNPC.newAI[0] = 0f; - - if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, Vector2.Zero, ProjectileID.SharknadoBolt, 0, 0f, Main.myPlayer, 1f, npc.target + 1); - - npc.netUpdate = true; - } - } - - // Set variables for spawn effects - if (npc.localAI[0] == 0f) - { - npc.localAI[0] = 1f; - npc.alpha = 255; - npc.rotation = 0f; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.ai[0] = -1f; - npc.netUpdate = true; - } - } - - // Rotation - float rateOfRotation = 0.04f; - if (npc.ai[0] == 1f || npc.ai[0] == 6f || npc.ai[0] == 7f) - rateOfRotation = 0f; - if (npc.ai[0] == 3f || npc.ai[0] == 4f || npc.ai[0] == 8f) - rateOfRotation = 0.01f; - - Vector2 rotationVector = player.Center - npc.Center; - if (!player.dead && bossRush && phase4) - { - // Rotate to show direction of predictive charge - if (npc.ai[0] == 10f) - { - rateOfRotation = 0.1f; - rotationVector = Vector2.Normalize(player.Center + player.velocity * 20f - npc.Center) * chargeVelocity; - } - } - - float rotationSpeed = (float)Math.Atan2(rotationVector.Y, rotationVector.X); - if (npc.spriteDirection == 1) - rotationSpeed += MathHelper.Pi; - if (rotationSpeed < 0f) - rotationSpeed += MathHelper.TwoPi; - if (rotationSpeed > MathHelper.TwoPi) - rotationSpeed -= MathHelper.TwoPi; - if (npc.ai[0] == -1f || npc.ai[0] == 3f || npc.ai[0] == 4f || npc.ai[0] == 8f) - rotationSpeed = 0f; - - if (rateOfRotation != 0f) - npc.rotation = npc.rotation.AngleTowards(rotationSpeed, rateOfRotation); - - // Alpha adjustments - if (npc.ai[0] != -1f && npc.ai[0] < 9f) - { - if (Collision.SolidCollision(npc.position, npc.width, npc.height)) - npc.alpha += 15; - else - npc.alpha -= 15; - - if (npc.alpha < 0) - npc.alpha = 0; - if (npc.alpha > 150) - npc.alpha = 150; - } - - // Spawn effects - if (npc.ai[0] == -1f) - { - // Velocity - npc.velocity *= 0.98f; - - // Direction - int faceDirection = Math.Sign(player.Center.X - npc.Center.X); - if (faceDirection != 0) - { - npc.direction = faceDirection; - npc.spriteDirection = -npc.direction; - } - - // Alpha - if (npc.ai[2] > 20f) - { - npc.velocity.Y = -2f; - - npc.alpha -= 5; - if (Collision.SolidCollision(npc.position, npc.width, npc.height)) - npc.alpha += 15; - if (npc.alpha < 0) - npc.alpha = 0; - if (npc.alpha > 150) - npc.alpha = 150; - } - - // Spawn dust and play sound - if (npc.ai[2] == sharknadoPhaseTimer - 30) - { - int dustAmt = 36; - for (int i = 0; i < dustAmt; i++) - { - Vector2 dust = (Vector2.Normalize(npc.velocity) * new Vector2(npc.width / 2f, npc.height) * 0.75f * 0.5f).RotatedBy((i - (dustAmt / 2 - 1)) * MathHelper.TwoPi / dustAmt) + npc.Center; - Vector2 sharknadoDustDirection = dust - npc.Center; - int sharknadoDust = Dust.NewDust(dust + sharknadoDustDirection, 0, 0, 172, sharknadoDustDirection.X * 2f, sharknadoDustDirection.Y * 2f, 100, default, 1.4f); - Main.dust[sharknadoDust].noGravity = true; - Main.dust[sharknadoDust].noLight = true; - Main.dust[sharknadoDust].velocity = Vector2.Normalize(sharknadoDustDirection) * 3f; - } - - SoundEngine.PlaySound(SoundID.Zombie20,npc.Center); - } - - npc.ai[2] += 1f; - if (npc.ai[2] >= spawnEffectPhaseTimer) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.netUpdate = true; - } - } - - // Phase 1 - else if (npc.ai[0] == 0f && !player.dead) - { - // Velocity - if (npc.ai[1] == 0f) - npc.ai[1] = 300 * Math.Sign((npc.Center - player.Center).X); - - Vector2 idlePhaseDirection = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -200f) - npc.Center - npc.velocity) * idlePhaseVelocity; - npc.SimpleFlyMovement(idlePhaseDirection, idlePhaseAcceleration); - - // Rotation and direction - int playerFaceDirection = Math.Sign(player.Center.X - npc.Center.X); - if (playerFaceDirection != 0) - { - if (npc.ai[2] == 0f && playerFaceDirection != npc.direction) - npc.rotation += MathHelper.Pi; - - npc.direction = playerFaceDirection; - - if (npc.spriteDirection != -npc.direction) - npc.rotation += MathHelper.Pi; - - npc.spriteDirection = -npc.direction; - } - - // Phase switch - npc.ai[2] += 1f; - if (npc.ai[2] >= idlePhaseTimer || CalamityWorld.LegendaryMode) - { - int attackPicker = 0; - switch ((int)npc.ai[3]) - { - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - case 8: - case 9: - attackPicker = 1; - break; - case 10: - npc.ai[3] = 1f; - attackPicker = 2; - break; - case 11: - npc.ai[3] = 0f; - attackPicker = 3; - break; - } - - if (phase2) - attackPicker = 4; - - // Set velocity for charge - if (attackPicker == 1) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - - // Velocity - npc.velocity = Vector2.Normalize(player.Center - npc.Center) * chargeVelocity; - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); - - // Direction - if (playerFaceDirection != 0) - { - npc.direction = playerFaceDirection; - - if (npc.spriteDirection == 1) - npc.rotation += MathHelper.Pi; - - npc.spriteDirection = -npc.direction; - } - } - - // Bubbles - else if (attackPicker == 2) - { - npc.ai[0] = 2f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - - // Spawn sharknadoes - else if (attackPicker == 3) - { - npc.ai[0] = 3f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - - // Go to phase 2 - else if (attackPicker == 4) - { - npc.ai[0] = 4f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - - npc.netUpdate = true; - } - } - - // Charge - else if (npc.ai[0] == 1f) - { - // Accelerate - npc.velocity *= 1.01f; - - // Spawn dust - int chargeDustAmt = 7; - for (int j = 0; j < chargeDustAmt; j++) - { - Vector2 arg_E1C_0 = (Vector2.Normalize(npc.velocity) * new Vector2((npc.width + 50) / 2f, npc.height) * 0.75f).RotatedBy((j - (chargeDustAmt / 2 - 1)) * MathHelper.Pi / chargeDustAmt) + npc.Center; - Vector2 chargeDustDirection = ((float)(Main.rand.NextDouble() * MathHelper.Pi) - MathHelper.PiOver2).ToRotationVector2() * Main.rand.Next(3, 8); - int chargeDust = Dust.NewDust(arg_E1C_0 + chargeDustDirection, 0, 0, 172, chargeDustDirection.X * 2f, chargeDustDirection.Y * 2f, 100, default, 1.4f); - Main.dust[chargeDust].noGravity = true; - Main.dust[chargeDust].noLight = true; - Main.dust[chargeDust].velocity /= 4f; - Main.dust[chargeDust].velocity -= npc.velocity; - } - - npc.ai[2] += 1f; - if (npc.ai[2] >= chargeTime) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] += 2f; - npc.TargetClosest(); - npc.netUpdate = true; - } - } - - // Bubble belch - else if (npc.ai[0] == 2f) - { - // Velocity - if (npc.ai[1] == 0f) - npc.ai[1] = 300 * Math.Sign((npc.Center - player.Center).X); - - Vector2 bubbleAttackDirection = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -200f) - npc.Center - npc.velocity) * bubbleBelchPhaseVelocity; - npc.SimpleFlyMovement(bubbleAttackDirection, bubbleBelchPhaseAcceleration); - - // Play sounds and spawn bubbles - if (npc.ai[2] == 0f) - SoundEngine.PlaySound(SoundID.Zombie20, npc.Center); - - if (npc.ai[2] % bubbleBelchPhaseDivisor == 0f) - { - SoundEngine.PlaySound(SoundID.NPCDeath19, npc.Center); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Vector2 bubbleSpawnDirection = Vector2.Normalize(player.Center - npc.Center) * (npc.width + 20) / 2f + npc.Center; - NPC.NewNPC(npc.GetSource_FromAI(), (int)bubbleSpawnDirection.X, (int)bubbleSpawnDirection.Y + 45, NPCID.DetonatingBubble); - } - } - - // Direction - int bubbleSpriteFaceDirection = Math.Sign(player.Center.X - npc.Center.X); - if (bubbleSpriteFaceDirection != 0) - { - npc.direction = bubbleSpriteFaceDirection; - if (npc.spriteDirection != -npc.direction) - npc.rotation += MathHelper.Pi; - npc.spriteDirection = -npc.direction; - } - - npc.ai[2] += 1f; - if (npc.ai[2] >= bubbleBelchPhaseTimer) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.TargetClosest(); - npc.netUpdate = true; - } - } - - // Sharknado spawn - else if (npc.ai[0] == 3f) - { - // Velocity - npc.velocity *= 0.98f; - npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); - - // Play sound and spawn sharknadoes - if (npc.ai[2] == (sharknadoPhaseTimer - 30)) - SoundEngine.PlaySound(SoundID.Zombie9, npc.Center); - - if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == sharknadoPhaseTimer - 30) - { - Vector2 sharknadoSpawnerDirection = npc.rotation.ToRotationVector2() * (Vector2.UnitX * npc.direction) * (npc.width + 20) / 2f + npc.Center; - bool normal = Main.rand.NextBool(); - float velocityY = normal ? 8f : -4f; - float ai1 = normal ? 0f : -1f; - - Projectile.NewProjectile(npc.GetSource_FromAI(), sharknadoSpawnerDirection.X, sharknadoSpawnerDirection.Y, npc.direction * 3, velocityY, ProjectileID.SharknadoBolt, 0, 0f, Main.myPlayer, 0f, ai1); - Projectile.NewProjectile(npc.GetSource_FromAI(), sharknadoSpawnerDirection.X, sharknadoSpawnerDirection.Y, -(float)npc.direction * 3, velocityY, ProjectileID.SharknadoBolt, 0, 0f, Main.myPlayer, 0f, ai1); - - velocityY = normal ? -4f : 8f; - ai1 = normal ? -1f : 0f; - Projectile.NewProjectile(npc.GetSource_FromAI(), sharknadoSpawnerDirection.X, sharknadoSpawnerDirection.Y, 0f, velocityY, ProjectileID.SharknadoBolt, 0, 0f, Main.myPlayer, 0f, ai1); - } - - npc.ai[2] += 1f; - if (npc.ai[2] >= sharknadoPhaseTimer) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.TargetClosest(); - npc.netUpdate = true; - } - } - - // Transition to phase 2 - else if (npc.ai[0] == 4f) - { - // Velocity - npc.velocity *= 0.98f; - npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); - - // Sound - if (npc.ai[2] == phaseTransitionTimer - 60) - SoundEngine.PlaySound(SoundID.Zombie20, npc.Center); - - npc.ai[2] += 1f; - if (npc.ai[2] >= phaseTransitionTimer) - { - npc.ai[0] = 5f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.TargetClosest(); - npc.netUpdate = true; - } - } - - // Phase 2 - else if (npc.ai[0] == 5f && !player.dead) - { - // Velocity - if (npc.ai[1] == 0f) - npc.ai[1] = 300 * Math.Sign((npc.Center - player.Center).X); - - Vector2 phase2IdleDirection = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -200f) - npc.Center - npc.velocity) * idlePhaseVelocity; - npc.SimpleFlyMovement(phase2IdleDirection, idlePhaseAcceleration); - - // Direction and rotation - int phase2SpriteFaceDirection = Math.Sign(player.Center.X - npc.Center.X); - if (phase2SpriteFaceDirection != 0) - { - if (npc.ai[2] == 0f && phase2SpriteFaceDirection != npc.direction) - npc.rotation += MathHelper.Pi; - - npc.direction = phase2SpriteFaceDirection; - - if (npc.spriteDirection != -npc.direction) - npc.rotation += MathHelper.Pi; - - npc.spriteDirection = -npc.direction; - } - - // Phase switch - npc.ai[2] += 1f; - if (npc.ai[2] >= idlePhaseTimer || CalamityWorld.LegendaryMode) - { - int phase2AttackPicker = 0; - switch ((int)npc.ai[3]) - { - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - phase2AttackPicker = 1; - break; - case 6: - npc.ai[3] = 1f; - phase2AttackPicker = 2; - break; - case 7: - npc.ai[3] = 0f; - phase2AttackPicker = 3; - break; - } - - if (phase3) - phase2AttackPicker = 4; - - // Set velocity for charge - if (phase2AttackPicker == 1) - { - npc.ai[0] = 6f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - - // Velocity and rotation - npc.velocity = Vector2.Normalize(player.Center - npc.Center) * chargeVelocity; - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); - - // Direction - if (phase2SpriteFaceDirection != 0) - { - npc.direction = phase2SpriteFaceDirection; - - if (npc.spriteDirection == 1) - npc.rotation += MathHelper.Pi; - - npc.spriteDirection = -npc.direction; - } - } - - // Set velocity for spin - else if (phase2AttackPicker == 2) - { - // Velocity and rotation - npc.velocity = Vector2.Normalize(player.Center - npc.Center) * bubbleSpinPhaseVelocity; - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); - - // Direction - if (phase2SpriteFaceDirection != 0) - { - npc.direction = phase2SpriteFaceDirection; - - if (npc.spriteDirection == 1) - npc.rotation += MathHelper.Pi; - - npc.spriteDirection = -npc.direction; - } - - npc.ai[0] = 7f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - - // Spawn cthulhunado - else if (phase2AttackPicker == 3) - { - npc.ai[0] = 8f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - - // Go to next phase - else if (phase2AttackPicker == 4) - { - npc.ai[0] = 9f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - - npc.netUpdate = true; - } - } - - // Charge - else if (npc.ai[0] == 6f) - { - // Accelerate - npc.velocity *= 1.01f; - - // Spawn dust - int phase2ChargeDustAmt = 7; - for (int k = 0; k < phase2ChargeDustAmt; k++) - { - Vector2 arg_1A97_0 = (Vector2.Normalize(npc.velocity) * new Vector2((npc.width + 50) / 2f, npc.height) * 0.75f).RotatedBy((k - (phase2ChargeDustAmt / 2 - 1)) * MathHelper.Pi / phase2ChargeDustAmt) + npc.Center; - Vector2 phase2ChargeDustDirection = ((float)(Main.rand.NextDouble() * MathHelper.Pi) - MathHelper.PiOver2).ToRotationVector2() * Main.rand.Next(3, 8); - int phase2ChargeDust = Dust.NewDust(arg_1A97_0 + phase2ChargeDustDirection, 0, 0, 172, phase2ChargeDustDirection.X * 2f, phase2ChargeDustDirection.Y * 2f, 100, default, 1.4f); - Main.dust[phase2ChargeDust].noGravity = true; - Main.dust[phase2ChargeDust].noLight = true; - Main.dust[phase2ChargeDust].velocity /= 4f; - Main.dust[phase2ChargeDust].velocity -= npc.velocity; - } - - npc.ai[2] += 1f; - if (npc.ai[2] >= chargeTime) - { - npc.ai[0] = 5f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] += 2f; - npc.TargetClosest(); - npc.netUpdate = true; - } - } - - // Bubble spin - else if (npc.ai[0] == 7f) - { - // Play sounds and spawn bubbles - if (npc.ai[2] == 0f) - SoundEngine.PlaySound(SoundID.Zombie20, npc.Center); - - if (npc.ai[2] % bubbleSpinPhaseDivisor == 0f) - { - SoundEngine.PlaySound(SoundID.NPCDeath19, npc.Center); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Vector2 phase2BubbleSharkronDirection = Vector2.Normalize(npc.velocity) * (npc.width + 20) / 2f + npc.Center; - int phase2Bubbles = NPC.NewNPC(npc.GetSource_FromAI(), (int)phase2BubbleSharkronDirection.X, (int)phase2BubbleSharkronDirection.Y + 45, NPCID.DetonatingBubble); - Main.npc[phase2Bubbles].target = npc.target; - Main.npc[phase2Bubbles].velocity = Vector2.Normalize(npc.velocity).RotatedBy(MathHelper.PiOver2 * npc.direction) * bubbleSpinBubbleVelocity * (CalamityWorld.LegendaryMode ? (Main.rand.NextFloat() + 0.5f) : 1f); - Main.npc[phase2Bubbles].netUpdate = true; - Main.npc[phase2Bubbles].ai[3] = Main.rand.Next(80, 121) / 100f; - - if (npc.ai[2] % (bubbleSpinPhaseDivisor * 5) == 0f) - { - int phase2BubbleSharkrons = NPC.NewNPC(npc.GetSource_FromAI(), (int)phase2BubbleSharkronDirection.X, (int)phase2BubbleSharkronDirection.Y + 45, NPCID.Sharkron2); - Main.npc[phase2BubbleSharkrons].ai[1] = 89f; - } - } - } - - // Velocity and rotation - npc.velocity = npc.velocity.RotatedBy(-(double)bubbleSpinPhaseRotation * (float)npc.direction); - npc.rotation -= bubbleSpinPhaseRotation * npc.direction; - - npc.ai[2] += 1f; - if (npc.ai[2] >= bubbleSpinPhaseTimer) - { - npc.ai[0] = 5f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.TargetClosest(); - npc.netUpdate = true; - } - } - - // Spawn cthulhunado - else if (npc.ai[0] == 8f) - { - // Velocity - npc.velocity *= 0.98f; - npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); - - // Play sound and spawn cthulhunado - if (npc.ai[2] == sharknadoPhaseTimer - 30) - SoundEngine.PlaySound(SoundID.Zombie20, npc.Center); - - if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == sharknadoPhaseTimer - 30) - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, Vector2.Zero, ProjectileID.SharknadoBolt, 0, 0f, Main.myPlayer, 1f, npc.target + 1); - - npc.ai[2] += 1f; - if (npc.ai[2] >= sharknadoPhaseTimer) - { - npc.ai[0] = 5f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.TargetClosest(); - npc.netUpdate = true; - } - } - - // Transition to phase 3 - else if (npc.ai[0] == 9f) - { - // Alpha adjustments - if (npc.ai[2] < phaseTransitionTimer - 90) - { - if (Collision.SolidCollision(npc.position, npc.width, npc.height)) - npc.alpha += 15; - else - npc.alpha -= 15; - - if (npc.alpha < 0) - npc.alpha = 0; - if (npc.alpha > 150) - npc.alpha = 150; - } - else if (npc.alpha < 255) - { - npc.alpha += 4; - if (npc.alpha > 255) - npc.alpha = 255; - } - - // Velocity - npc.velocity *= 0.98f; - npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); - - // Play sound - if (npc.ai[2] == phaseTransitionTimer - 60) - SoundEngine.PlaySound(SoundID.Zombie20, npc.Center); - - npc.ai[2] += 1f; - if (npc.ai[2] >= phaseTransitionTimer) - { - npc.ai[0] = 10f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.TargetClosest(); - npc.netUpdate = true; - } - } - - // Phase 3 - else if (npc.ai[0] == 10f && !player.dead) - { - // Avoid cheap bullshit - npc.damage = 0; - - // Alpha - if (npc.alpha < 255) - { - npc.alpha += 25; - if (npc.alpha > 255) - npc.alpha = 255; - } - - // Teleport location - if (npc.ai[1] == 0f) - npc.ai[1] = 360 * Math.Sign((npc.Center - player.Center).X); - - Vector2 desiredVelocity = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -200f) - npc.Center - npc.velocity) * idlePhaseVelocity; - npc.SimpleFlyMovement(desiredVelocity, idlePhaseAcceleration); - - // Rotation and direction - int phase3SpriteFaceDirection = Math.Sign(player.Center.X - npc.Center.X); - if (phase3SpriteFaceDirection != 0) - { - if (npc.ai[2] == 0f && phase3SpriteFaceDirection != npc.direction) - { - npc.rotation += MathHelper.Pi; - for (int l = 0; l < npc.oldPos.Length; l++) - npc.oldPos[l] = Vector2.Zero; - } - - npc.direction = phase3SpriteFaceDirection; - - if (npc.spriteDirection != -npc.direction) - npc.rotation += MathHelper.Pi; - - npc.spriteDirection = -npc.direction; - } - - // Phase switch - npc.ai[2] += 1f; - if (npc.ai[2] >= idlePhaseTimer || CalamityWorld.LegendaryMode) - { - int phase3AttackPicker = 0; - if (phase4) - { - switch ((int)npc.ai[3]) - { - case 0: - case 1: - case 2: - case 4: - case 5: - case 6: - case 7: - phase3AttackPicker = 1; - break; - case 3: - case 8: - phase3AttackPicker = 2; - break; - } - - if (death) - phase3AttackPicker = 1; - } - else - { - switch ((int)npc.ai[3]) - { - case 0: - case 2: - case 3: - case 5: - case 6: - case 7: - phase3AttackPicker = 1; - break; - case 1: - case 4: - case 8: - phase3AttackPicker = 2; - break; - } - } - - // Set velocity for charge - if (phase3AttackPicker == 1) - { - npc.ai[0] = 11f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - - // Velocity and rotation - npc.velocity = Vector2.Normalize(player.Center + (bossRush && phase4 ? player.velocity * 20f : Vector2.Zero) - npc.Center) * chargeVelocity; - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); - - // Direction - if (phase3SpriteFaceDirection != 0) - { - npc.direction = phase3SpriteFaceDirection; - - if (npc.spriteDirection == 1) - npc.rotation += MathHelper.Pi; - - npc.spriteDirection = -npc.direction; - } - } - - // Pause - else if (phase3AttackPicker == 2) - { - npc.ai[0] = 12f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - - npc.netUpdate = true; - } - } - - // Charge - else if (npc.ai[0] == 11f) - { - // Accelerate - npc.velocity *= 1.01f; - - // Alpha - npc.alpha -= 25; - if (npc.alpha < 0) - npc.alpha = 0; - - // Spawn dust - int phase3ChargeDustAmt = 7; - for (int m = 0; m < phase3ChargeDustAmt; m++) - { - Vector2 arg_2444_0 = (Vector2.Normalize(npc.velocity) * new Vector2((npc.width + 50) / 2f, npc.height) * 0.75f).RotatedBy((m - (phase3ChargeDustAmt / 2 - 1)) * MathHelper.Pi / phase3ChargeDustAmt) + npc.Center; - Vector2 phase3ChargeDustDirection = ((float)(Main.rand.NextDouble() * MathHelper.Pi) - MathHelper.PiOver2).ToRotationVector2() * Main.rand.Next(3, 8); - int phase3ChargeDust = Dust.NewDust(arg_2444_0 + phase3ChargeDustDirection, 0, 0, 172, phase3ChargeDustDirection.X * 2f, phase3ChargeDustDirection.Y * 2f, 100, default, 1.4f); - Main.dust[phase3ChargeDust].noGravity = true; - Main.dust[phase3ChargeDust].noLight = true; - Main.dust[phase3ChargeDust].velocity /= 4f; - Main.dust[phase3ChargeDust].velocity -= npc.velocity; - } - - npc.ai[2] += 1f; - if (npc.ai[2] >= chargeTime) - { - npc.ai[0] = 10f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - - if (!phase4 || !death) - npc.ai[3] += 1f; - - npc.TargetClosest(); - npc.netUpdate = true; - } - } - - // Pause before teleport - else if (npc.ai[0] == 12f) - { - // Avoid cheap bullshit - npc.damage = 0; - - // Alpha - if (npc.alpha < 255) - { - npc.alpha += 17; - if (npc.alpha > 255) - npc.alpha = 255; - } - - // Velocity - npc.velocity *= 0.98f; - npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); - - // Play sound - if (npc.ai[2] == teleportPhaseTimer / 2) - SoundEngine.PlaySound(SoundID.Zombie20, npc.Center); - - if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == teleportPhaseTimer / 2) - { - // Teleport location - if (npc.ai[1] == 0f) - npc.ai[1] = 300 * Math.Sign((npc.Center - player.Center).X); - - // Rotation and direction - Vector2 center = player.Center + new Vector2(-npc.ai[1], -200f); - npc.Center = center; - int phase3PlayerDirection = Math.Sign(player.Center.X - npc.Center.X); - if (phase3PlayerDirection != 0) - { - if (npc.ai[2] == 0f && phase3PlayerDirection != npc.direction) - { - npc.rotation += MathHelper.Pi; - for (int n = 0; n < npc.oldPos.Length; n++) - npc.oldPos[n] = Vector2.Zero; - } - - npc.direction = phase3PlayerDirection; - - if (npc.spriteDirection != -npc.direction) - npc.rotation += MathHelper.Pi; - - npc.spriteDirection = -npc.direction; - } - } - - npc.ai[2] += 1f; - if (npc.ai[2] >= teleportPhaseTimer) - { - npc.ai[0] = 10f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - - npc.ai[3] += 1f; - if (npc.ai[3] >= 9f) - npc.ai[3] = 0f; - - npc.netUpdate = true; - } - } - - return false; - } - } -} diff --git a/NPCs/VanillaNPCOverrides/Bosses/EaterOfWorldsAI.cs b/NPCs/VanillaNPCOverrides/Bosses/EaterOfWorldsAI.cs deleted file mode 100644 index 012513d062..0000000000 --- a/NPCs/VanillaNPCOverrides/Bosses/EaterOfWorldsAI.cs +++ /dev/null @@ -1,571 +0,0 @@ -using CalamityMod.Events; -using CalamityMod.World; -using Microsoft.Xna.Framework; -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Audio; - -namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses -{ - public static class EaterOfWorldsAI - { - public static bool BuffedEaterofWorldsAI(NPC npc, Mod mod) - { - CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; - - // Causes it to split far more in death mode - if ((((npc.ai[2] % 2f == 0f && npc.type == NPCID.EaterofWorldsBody) || npc.type == NPCID.EaterofWorldsHead) && death) || CalamityWorld.LegendaryMode) - { - calamityGlobalNPC.DR = 0.5f; - npc.defense = npc.defDefense * 2; - } - - if (CalamityWorld.LegendaryMode && npc.type == NPCID.EaterofWorldsHead) - npc.reflectsProjectiles = true; - - // Get a target - 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.type == NPCID.EaterofWorldsHead) - npc.TargetClosest(); - - // Fade in. - npc.Opacity = MathHelper.Clamp(npc.Opacity + 0.08f, 0f, 1f); - - float enrageScale = bossRush ? 1f : 0f; - if ((npc.position.Y / 16f) < Main.worldSurface || bossRush) - { - npc.Calamity().CurrentlyEnraged = !bossRush; - enrageScale += 1f; - } - if (!Main.player[npc.target].ZoneCorrupt || bossRush) - { - npc.Calamity().CurrentlyEnraged = !bossRush; - enrageScale += 2f; - } - - // Total body segments - float totalSegments = GetEaterOfWorldsSegmentsCountRevDeath(); - - // Count segments remaining - // TODO - This runs for every EoW segment, this is bad because there are three separate loops here running every frame. - float segmentCount = NPC.CountNPCS(NPCID.EaterofWorldsHead) + NPC.CountNPCS(NPCID.EaterofWorldsBody) + NPC.CountNPCS(NPCID.EaterofWorldsTail); - - // Percent segments remaining, add two to total for head and tail - float lifeRatio = segmentCount / (totalSegments + 2); - - // 10 seconds of resistance to prevent spawn killing - if (calamityGlobalNPC.newAI[1] < 600f && bossRush) - calamityGlobalNPC.newAI[1] += 1f; - - // Phases - bool phase2 = lifeRatio < 0.9f; - bool phase3 = lifeRatio < 0.75f; - bool phase4 = lifeRatio < 0.4f; - bool phase5 = lifeRatio < 0.1f; - - // Fire projectiles - if (Main.netMode != NetmodeID.MultiplayerClient && (!phase5 || death || Main.getGoodWorld)) - { - // Vile spit - if (npc.type == NPCID.EaterofWorldsBody) - { - if (Main.rand.NextBool(Main.getGoodWorld ? 450 : 900) && phase2) - { - npc.TargetClosest(); - if (Collision.CanHitLine(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1) && Vector2.Distance(npc.Center, Main.player[npc.target].Center) > 320f) - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.position.X + (npc.width / 2) + npc.velocity.X), (int)(npc.position.Y + (npc.height / 2) + npc.velocity.Y), NPCID.VileSpitEaterOfWorlds, 0, 0f, 1f, 0f, 0f, 255); - } - } - - // Cursed flames - else if (npc.type == NPCID.EaterofWorldsHead) - { - calamityGlobalNPC.newAI[0] += 1f; - float timer = enrageScale > 0f ? 90f : 120f; - float shootBoost = death ? lifeRatio * 90f : lifeRatio * 180f; - timer += shootBoost; - - if (enrageScale >= 2f) - timer = 60f; - - if (calamityGlobalNPC.newAI[0] >= timer && phase3) - { - if (Collision.CanHitLine(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1) && - npc.SafeDirectionTo(Main.player[npc.target].Center).AngleBetween((npc.rotation - MathHelper.PiOver2).ToRotationVector2()) < MathHelper.ToRadians(18f) && - Vector2.Distance(npc.Center, Main.player[npc.target].Center) > 320f) - { - calamityGlobalNPC.newAI[0] = 0f; - Vector2 cursedFlameDirection = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float targetXDirection = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - cursedFlameDirection.X; - float targetYDirection = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - cursedFlameDirection.Y; - float projSpeed = 7f + enrageScale * 2f; - float flameTargetDistance = (float)Math.Sqrt(targetXDirection * targetXDirection + targetYDirection * targetYDirection); - flameTargetDistance = projSpeed / flameTargetDistance; - targetXDirection *= flameTargetDistance; - targetYDirection *= flameTargetDistance; - targetYDirection += npc.velocity.Y * 0.5f; - targetXDirection += npc.velocity.X * 0.5f; - cursedFlameDirection.X -= targetXDirection; - cursedFlameDirection.Y -= targetYDirection; - - int type = ProjectileID.CursedFlameHostile; - Projectile.NewProjectile(npc.GetSource_FromAI(), cursedFlameDirection.X, cursedFlameDirection.Y, targetXDirection, targetYDirection, type, npc.GetProjectileDamage(type), 0f, Main.myPlayer); - } - } - } - } - - // Despawn - if (Main.player[npc.target].dead) - { - if (npc.timeLeft > 300) - npc.timeLeft = 300; - } - - // All functions that modify the active worm segments are here. This includes spawning the worm originally and splitting effects. - if (Main.netMode != NetmodeID.MultiplayerClient) - { - // If this segment is a head or a body without a next-segment defined, then it needs to spawn its own next segment. - if ((npc.type == NPCID.EaterofWorldsHead || npc.type == NPCID.EaterofWorldsBody) && npc.ai[0] == 0f) - { - int spawnX = (int)npc.position.X; - int spawnY = (int)npc.position.Y; - - // A head sets the length variable (npc.ai[2]) and then sets its next segment to a freshly spawned body. - if (npc.type == NPCID.EaterofWorldsHead) - { - // Set head's "length beyond this point" to be the total length of the worm. - npc.ai[2] = totalSegments; - - // Body spawn - npc.ai[0] = NPC.NewNPC(npc.GetSource_FromAI(), spawnX, spawnY, NPCID.EaterofWorldsBody, npc.whoAmI, 0f, 0f, 0f, 0f, 255); - } - - // A body with a "length beyond this point" greater than zero just sets its next spawned segment to a freshly spawned body. - else if (npc.type == NPCID.EaterofWorldsBody && npc.ai[2] > 0f) - npc.ai[0] = NPC.NewNPC(npc.GetSource_FromAI(), spawnX, spawnY, NPCID.EaterofWorldsBody, npc.whoAmI, 0f, 0f, 0f, 0f, 255); - - // If the worm stops here ("length beyond this point" is zero), then spawn a tail instead. - else - npc.ai[0] = NPC.NewNPC(npc.GetSource_FromAI(), spawnX, spawnY, NPCID.EaterofWorldsTail, npc.whoAmI, 0f, 0f, 0f, 0f, 255); - - // Maintain the linked list of worm segments, and correctly set the "length beyond this point" of this segment. - Main.npc[(int)npc.ai[0]].ai[1] = npc.whoAmI; - Main.npc[(int)npc.ai[0]].ai[2] = npc.ai[2] - 1f; - npc.netUpdate = true; - } - - // Helper function to destroy this Eater of Worlds worm segment. - void DestroyThisSegment() - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - } - - // If this segment's previous and next segments are both dead, make it explode instantly. Single segments cannot live. - if (!Main.npc[(int)npc.ai[1]].active && !Main.npc[(int)npc.ai[0]].active) - DestroyThisSegment(); - - // If this segment is a head and its next segment is dead, make it explode instantly. It's been decapitated. - if (npc.type == NPCID.EaterofWorldsHead && !Main.npc[(int)npc.ai[0]].active) - DestroyThisSegment(); - - // If this segment is a tail and its previous segment is dead, make it explode instantly. It's been chopped off. - if (npc.type == NPCID.EaterofWorldsTail && !Main.npc[(int)npc.ai[1]].active) - DestroyThisSegment(); - - // If this segment is a body and its previous segment is dead (or was rendered into a tail), transform into a head. - if (npc.type == NPCID.EaterofWorldsBody && (!Main.npc[(int)npc.ai[1]].active || Main.npc[(int)npc.ai[1]].aiStyle != npc.aiStyle)) - { - npc.type = NPCID.EaterofWorldsHead; - float segmentLifeRatio = npc.life / (float)npc.lifeMax; - int whoAmI = npc.whoAmI; - float ai0Holdover = npc.ai[0]; - float newAI1Holdover = calamityGlobalNPC.newAI[1]; - int slowingDebuffResistTimer = calamityGlobalNPC.debuffResistanceTimer; - - // Actually transform the body segment into a head segment. - npc.SetDefaultsKeepPlayerInteraction(npc.type); - npc.life = (int)(npc.lifeMax * segmentLifeRatio); - npc.whoAmI = whoAmI; - npc.ai[0] = ai0Holdover; - // Heads spawned mid fight by splitting do not get reset spawn invincibility. - CalamityGlobalNPC newCGN = npc.Calamity(); - newCGN.newAI[1] = newAI1Holdover; - newCGN.debuffResistanceTimer = slowingDebuffResistTimer; - npc.TargetClosest(); - npc.netUpdate = true; - npc.netSpam = 0; - } - - // If this segment is a body and its next segment is dead (or was rendered into a head), transform into a tail. - if (npc.type == NPCID.EaterofWorldsBody && (!Main.npc[(int)npc.ai[0]].active || Main.npc[(int)npc.ai[0]].aiStyle != npc.aiStyle)) - { - npc.type = NPCID.EaterofWorldsTail; - float segmentLifeRatio = npc.life / (float)npc.lifeMax; - int whoAmI = npc.whoAmI; - float ai1Holdover = npc.ai[1]; - int slowingDebuffResistTimer = calamityGlobalNPC.debuffResistanceTimer; - - // Actually transform the body segment into a tail segment. - npc.SetDefaultsKeepPlayerInteraction(npc.type); - npc.life = (int)(npc.lifeMax * segmentLifeRatio); - npc.whoAmI = whoAmI; - npc.ai[1] = ai1Holdover; - npc.Calamity().debuffResistanceTimer = slowingDebuffResistTimer; - npc.TargetClosest(); - npc.netUpdate = true; - npc.netSpam = 0; - } - - // If for any reason this segment was deleted, send info to clients so they also see it die. - if (!npc.active && Main.netMode == NetmodeID.Server) - NetMessage.SendData(MessageID.DamageNPC, -1, -1, null, npc.whoAmI, -1f); - } - - // Movement - int tilePositionX = (int)(npc.position.X / 16f) - 1; - int tileWidthPosX = (int)((npc.position.X + npc.width) / 16f) + 2; - int tilePositionY = (int)(npc.position.Y / 16f) - 1; - int tileWidthPosY = (int)((npc.position.Y + npc.height) / 16f) + 2; - if (tilePositionX < 0) - tilePositionX = 0; - if (tileWidthPosX > Main.maxTilesX) - tileWidthPosX = Main.maxTilesX; - if (tilePositionY < 0) - tilePositionY = 0; - if (tileWidthPosY > Main.maxTilesY) - tileWidthPosY = Main.maxTilesY; - - // Fly or not - bool inTiles = false; - if (!inTiles) - { - for (int i = tilePositionX; i < tileWidthPosX; i++) - { - for (int j = tilePositionY; j < tileWidthPosY; j++) - { - if (Main.tile[i, j] != null && ((Main.tile[i, j].HasUnactuatedTile && (Main.tileSolid[Main.tile[i, j].TileType] || (Main.tileSolidTop[Main.tile[i, j].TileType] && Main.tile[i, j].TileFrameY == 0))) || Main.tile[i, j].LiquidAmount > 64)) - { - Vector2 vector; - vector.X = i * 16; - vector.Y = j * 16; - if (npc.position.X + npc.width > vector.X && npc.position.X < vector.X + 16f && npc.position.Y + npc.height > vector.Y && npc.position.Y < vector.Y + 16f) - { - inTiles = true; - if (Main.rand.NextBool(100) && Main.tile[i, j].HasUnactuatedTile) - { - WorldGen.KillTile(i, j, true, true, false); - } - } - } - } - } - } - if (!inTiles && npc.type == NPCID.EaterofWorldsHead) - { - Rectangle rectangle = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); - int noFlyZone = death ? 700 : 850; - noFlyZone -= (int)(enrageScale * 300f); - - if (noFlyZone < 100) - noFlyZone = 100; - - bool freeMoveAnyway = true; - for (int k = 0; k < Main.maxPlayers; k++) - { - if (Main.player[k].active) - { - Rectangle rectangle2 = new Rectangle((int)Main.player[k].position.X - noFlyZone, (int)Main.player[k].position.Y - noFlyZone, noFlyZone * 2, noFlyZone * 2); - if (rectangle.Intersects(rectangle2)) - { - freeMoveAnyway = false; - break; - } - } - } - if (freeMoveAnyway) - inTiles = true; - } - - // Velocity and acceleration - float velocityScale = (death ? 4.8f : 2.4f) * enrageScale; - float velocityBoost = velocityScale * (1f - lifeRatio); - float accelerationScale = (death ? 0.06f : 0.03f) * enrageScale; - float accelerationBoost = accelerationScale * (1f - lifeRatio); - float segmentVelocity = 12f + velocityBoost; - float segmentAcceleration = 0.15f + accelerationBoost; - - if (phase5) - { - segmentVelocity += 2.4f * enrageScale; - segmentAcceleration += 0.03f * enrageScale; - } - else if (phase4) - { - segmentVelocity += 1.2f * enrageScale; - segmentAcceleration += 0.015f * enrageScale; - } - - if (Main.getGoodWorld) - { - segmentVelocity += 4f; - segmentAcceleration += 0.05f; - } - - Vector2 segmentDirection = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float targetPosX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2); - float targetPosY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2); - - targetPosX = (int)(targetPosX / 16f) * 16; - targetPosY = (int)(targetPosY / 16f) * 16; - segmentDirection.X = (int)(segmentDirection.X / 16f) * 16; - segmentDirection.Y = (int)(segmentDirection.Y / 16f) * 16; - targetPosX -= segmentDirection.X; - targetPosY -= segmentDirection.Y; - float targetDistance = (float)Math.Sqrt(targetPosX * targetPosX + targetPosY * targetPosY); - - // Does this worm segment have a "previous segment" defined? - if (npc.ai[1] > 0f && npc.ai[1] < Main.npc.Length) - { - try - { - segmentDirection = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - targetPosX = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - segmentDirection.X; - targetPosY = Main.npc[(int)npc.ai[1]].position.Y + (Main.npc[(int)npc.ai[1]].height / 2) - segmentDirection.Y; - } - catch - { - } - - npc.rotation = (float)Math.Atan2(targetPosY, targetPosX) + MathHelper.PiOver2; - targetDistance = (float)Math.Sqrt(targetPosX * targetPosX + targetPosY * targetPosY); - int npcWidth = npc.width; - npcWidth = (int)(npcWidth * npc.scale); - - if (Main.getGoodWorld) - npcWidth = 62; - - targetDistance = (targetDistance - npcWidth) / targetDistance; - targetPosX *= targetDistance; - targetPosY *= targetDistance; - npc.velocity = Vector2.Zero; - npc.position.X += targetPosX; - npc.position.Y += targetPosY; - } - - // Otherwise this is a head. (Why does this not just check for head NPC type?) - else - { - // Prevent new heads from being slowed when they spawn - if (calamityGlobalNPC.newAI[1] < 3f) - { - calamityGlobalNPC.newAI[1] += 1f; - - // Set velocity for when a new head spawns - npc.velocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * (segmentVelocity * (death ? 0.5f : 0.4f)); - } - - if (!inTiles) - { - npc.velocity.Y += death ? 0.15f : 0.11f; - if (npc.velocity.Y > segmentVelocity) - npc.velocity.Y = segmentVelocity; - - if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < segmentVelocity * 0.4) - { - if (npc.velocity.X < 0f) - npc.velocity.X -= segmentAcceleration * 1.1f; - else - npc.velocity.X += segmentAcceleration * 1.1f; - } - else if (npc.velocity.Y == segmentVelocity) - { - if (npc.velocity.X < targetPosX) - npc.velocity.X += segmentAcceleration; - else if (npc.velocity.X > targetPosX) - npc.velocity.X -= segmentAcceleration; - } - else if (npc.velocity.Y > (death ? 6f : 4f)) - { - if (npc.velocity.X < 0f) - npc.velocity.X += segmentAcceleration * 0.9f; - else - npc.velocity.X -= segmentAcceleration * 0.9f; - } - } - else - { - // Sound - if (npc.soundDelay == 0) - { - float soundDelay = targetDistance / 40f; - if (soundDelay < 10f) - soundDelay = 10f; - if (soundDelay > 20f) - soundDelay = 20f; - - npc.soundDelay = (int)soundDelay; - SoundEngine.PlaySound(SoundID.WormDig, npc.position); - } - - targetDistance = (float)Math.Sqrt(targetPosX * targetPosX + targetPosY * targetPosY); - float absoluteTargetX = Math.Abs(targetPosX); - float absoluteTargetY = Math.Abs(targetPosY); - float timeToReachTarget = segmentVelocity / targetDistance; - targetPosX *= timeToReachTarget; - targetPosY *= timeToReachTarget; - - // Despawn - bool shouldDespawn = npc.type == NPCID.EaterofWorldsHead && Main.player[npc.target].dead; - if (shouldDespawn && !bossRush) - { - bool everyoneDead = true; - for (int i = 0; i < Main.maxPlayers; i++) - { - if (Main.player[i].active && !Main.player[i].dead) - { - everyoneDead = false; - break; - } - } - - if (everyoneDead) - { - if (Main.netMode != NetmodeID.MultiplayerClient && (npc.position.Y / 16f) > (Main.rockLayer + Main.maxTilesY) / 2.0) - { - npc.active = false; - int segmentAmt = (int)npc.ai[0]; - - while (segmentAmt > 0 && segmentAmt < Main.maxNPCs && Main.npc[segmentAmt].active && Main.npc[segmentAmt].aiStyle == npc.aiStyle) - { - int arg_2853_0 = (int)Main.npc[segmentAmt].ai[0]; - Main.npc[segmentAmt].active = false; - npc.life = 0; - - if (Main.netMode == NetmodeID.Server) - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, segmentAmt, 0f, 0f, 0f, 0, 0, 0); - - segmentAmt = arg_2853_0; - } - - if (Main.netMode == NetmodeID.Server) - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, npc.whoAmI, 0f, 0f, 0f, 0, 0, 0); - } - targetPosX = 0f; - targetPosY = segmentVelocity; - } - } - - if ((npc.velocity.X > 0f && targetPosX > 0f) || (npc.velocity.X < 0f && targetPosX < 0f) || (npc.velocity.Y > 0f && targetPosY > 0f) || (npc.velocity.Y < 0f && targetPosY < 0f)) - { - if (npc.velocity.X < targetPosX) - npc.velocity.X += segmentAcceleration; - else if (npc.velocity.X > targetPosX) - npc.velocity.X -= segmentAcceleration; - if (npc.velocity.Y < targetPosY) - npc.velocity.Y += segmentAcceleration; - else if (npc.velocity.Y > targetPosY) - npc.velocity.Y -= segmentAcceleration; - - if (Math.Abs(targetPosY) < segmentVelocity * 0.2 && ((npc.velocity.X > 0f && targetPosX < 0f) || (npc.velocity.X < 0f && targetPosX > 0f))) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y += segmentAcceleration * 2f; - else - npc.velocity.Y -= segmentAcceleration * 2f; - } - - if (Math.Abs(targetPosX) < segmentVelocity * 0.2 && ((npc.velocity.Y > 0f && targetPosY < 0f) || (npc.velocity.Y < 0f && targetPosY > 0f))) - { - if (npc.velocity.X > 0f) - npc.velocity.X += segmentAcceleration * 2f; - else - npc.velocity.X -= segmentAcceleration * 2f; - } - } - else if (absoluteTargetX > absoluteTargetY) - { - if (npc.velocity.X < targetPosX) - npc.velocity.X += segmentAcceleration * 1.1f; - else if (npc.velocity.X > targetPosX) - npc.velocity.X -= segmentAcceleration * 1.1f; - - if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < segmentVelocity * 0.5) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y += segmentAcceleration; - else - npc.velocity.Y -= segmentAcceleration; - } - } - else - { - if (npc.velocity.Y < targetPosY) - npc.velocity.Y += segmentAcceleration * 1.1f; - else if (npc.velocity.Y > targetPosY) - npc.velocity.Y -= segmentAcceleration * 1.1f; - - if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < segmentVelocity * 0.5) - { - if (npc.velocity.X > 0f) - npc.velocity.X += segmentAcceleration; - else - npc.velocity.X -= segmentAcceleration; - } - } - } - - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) + MathHelper.PiOver2; - - if (npc.type == NPCID.EaterofWorldsHead) - { - if (inTiles) - { - if (npc.localAI[0] != 1f) - npc.netUpdate = true; - - npc.localAI[0] = 1f; - } - else - { - if (npc.localAI[0] != 0f) - npc.netUpdate = true; - - npc.localAI[0] = 0f; - } - if (((npc.velocity.X > 0f && npc.oldVelocity.X < 0f) || (npc.velocity.X < 0f && npc.oldVelocity.X > 0f) || (npc.velocity.Y > 0f && npc.oldVelocity.Y < 0f) || (npc.velocity.Y < 0f && npc.oldVelocity.Y > 0f)) && !npc.justHit) - npc.netUpdate = true; - } - } - - // Manually sync newAI because there is no GlobalNPC.SendExtraAI - if (npc.active && npc.netUpdate && Main.netMode == NetmodeID.Server) - { - ModPacket packet = mod.GetPacket(); - packet.Write((byte)CalamityModMessageType.SyncCalamityNPCAIArray); - packet.Write((byte)npc.whoAmI); - packet.Write(calamityGlobalNPC.newAI[0]); - packet.Write(calamityGlobalNPC.newAI[1]); - packet.Write(calamityGlobalNPC.newAI[2]); - packet.Write(calamityGlobalNPC.newAI[3]); - packet.Send(-1, -1); - } - return false; - } - - public static int GetEaterOfWorldsSegmentsCountRevDeath() - { - return CalamityWorld.LegendaryMode ? 100 : (CalamityWorld.death || BossRushEvent.BossRushActive) ? 67 : 77; - } - } -} diff --git a/NPCs/VanillaNPCOverrides/Bosses/EmpressofLightAI.cs b/NPCs/VanillaNPCOverrides/Bosses/EmpressofLightAI.cs deleted file mode 100644 index eeebea7535..0000000000 --- a/NPCs/VanillaNPCOverrides/Bosses/EmpressofLightAI.cs +++ /dev/null @@ -1,1286 +0,0 @@ -using System; -using CalamityMod.Events; -using CalamityMod.World; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses -{ - public static class EmpressofLightAI - { - public static bool BuffedEmpressofLightAI(NPC npc, Mod mod) - { - CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - - // Difficulty bools. - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; - - // Rotation - npc.rotation = npc.velocity.X * 0.005f; - - // Reset damage every frame. - npc.damage = npc.defDamage; - - // Reset DR every frame. - calamityGlobalNPC.DR = 0.15f; - - // Percent life remaining. - float lifeRatio = npc.life / (float)npc.lifeMax; - - bool phase2 = npc.AI_120_HallowBoss_IsInPhase2(); - bool shouldBeInPhase2ButIsStillInPhase1 = lifeRatio <= 0.5f && !phase2; - if (shouldBeInPhase2ButIsStillInPhase1) - calamityGlobalNPC.DR = 0.99f; - - calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = shouldBeInPhase2ButIsStillInPhase1 || npc.ai[0] == 6f; - - bool dayTimeEnrage = NPC.ShouldEmpressBeEnraged(); - if (npc.life == npc.lifeMax && dayTimeEnrage && !npc.AI_120_HallowBoss_IsGenuinelyEnraged()) - npc.ai[3] += 2f; - - npc.Calamity().CurrentlyEnraged = !bossRush && dayTimeEnrage; - - int projectileDamageMultiplier = dayTimeEnrage ? 2 : 1; - - Vector2 rainbowStreakDistance = new Vector2(-250f, -350f); - Vector2 everlastingRainbowDistance = new Vector2(0f, -450f); - Vector2 etherealLanceDistance = new Vector2(0f, -450f); - Vector2 sunDanceDistance = new Vector2(-80f, -500f); - - float acceleration = death ? 0.55f : 0.48f; - float velocity = death ? 14f : 12f; - float movementDistanceGateValue = 40f; - float despawnDistanceGateValue = 6400f; - - if (dayTimeEnrage) - { - float enragedDistanceMultiplier = 1.1f; - rainbowStreakDistance *= enragedDistanceMultiplier; - everlastingRainbowDistance *= enragedDistanceMultiplier; - etherealLanceDistance *= enragedDistanceMultiplier; - - float enragedVelocityMultiplier = 1.2f; - acceleration *= enragedVelocityMultiplier; - velocity *= enragedVelocityMultiplier; - } - - bool visible = true; - bool takeDamage = true; - float lessTimeSpentPerPhaseMultiplier = phase2 ? (death ? 0.375f : 0.5f) : (death ? 0.75f : 1f); - if (Main.getGoodWorld) - lessTimeSpentPerPhaseMultiplier *= 0.2f; - - float extraPhaseTime; - Vector2 destination; - - switch ((int)npc.ai[0]) - { - // Spawn animation. - case 0: - - // Avoid cheap bullshit. - npc.damage = 0; - - if (npc.ai[1] == 0f) - { - npc.velocity = new Vector2(0f, 5f); - if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + new Vector2(0f, -80f), Vector2.Zero, ProjectileID.HallowBossDeathAurora, 0, 0f, Main.myPlayer); - } - - if (npc.ai[1] == 10f) - SoundEngine.PlaySound(SoundID.Item161, npc.Center); - - npc.velocity *= 0.95f; - - if (npc.ai[1] > 10f && npc.ai[1] < 150f) - { - for (int m = 0; m < 2; m++) - { - float dustOpacity = MathHelper.Lerp(1.3f, 0.7f, npc.Opacity) * Utils.GetLerpValue(0f, 120f, npc.ai[1], clamped: true); - Color newColor2 = Main.hslToRgb(npc.ai[1] / 180f, 1f, 0.5f); - int rainbow = Dust.NewDust(npc.position, npc.width, npc.height, 267, 0f, 0f, 0, newColor2); - Main.dust[rainbow].position = npc.Center + Main.rand.NextVector2Circular(npc.width * 3f, npc.height * 3f) + new Vector2(0f, -150f); - Main.dust[rainbow].velocity *= Main.rand.NextFloat() * 0.8f; - Main.dust[rainbow].noGravity = true; - Main.dust[rainbow].fadeIn = 0.6f + Main.rand.NextFloat() * 0.7f * dustOpacity; - Main.dust[rainbow].velocity += Vector2.UnitY * 3f; - Main.dust[rainbow].scale = 0.35f; - if (rainbow != 6000) - { - Dust rainbowClone = Dust.CloneDust(rainbow); - rainbowClone.scale /= 2f; - rainbowClone.fadeIn *= 0.85f; - rainbowClone.color = new Color(255, 255, 255, 255); - } - } - } - - npc.ai[1] += 1f; - visible = false; - takeDamage = false; - npc.Opacity = MathHelper.Clamp(npc.ai[1] / 180f, 0f, 1f); - - if (npc.ai[1] >= 180f) - { - if (dayTimeEnrage && !npc.AI_120_HallowBoss_IsGenuinelyEnraged()) - npc.ai[3] += 2f; - - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.netUpdate = true; - npc.TargetClosest(); - } - - break; - - // Phase switch. - case 1: - - // Avoid cheap bullshit. - npc.damage = 0; - - float idleTimer = phase2 ? (death ? 10f : 15f) : (death ? 20f : 30f); - if (Main.getGoodWorld) - idleTimer *= 0.5f; - if (idleTimer < 10f) - idleTimer = 10f; - - if (npc.ai[1] <= 10f) - { - if (npc.ai[1] == 0f) - npc.TargetClosest(); - - // Despawn. - NPCAimedTarget targetData4 = npc.GetTargetData(); - if (targetData4.Invalid) - { - npc.ai[0] = 13f; - npc.ai[1] = 0f; - npc.ai[2] += 1f; - npc.velocity /= 4f; - npc.netUpdate = true; - break; - } - - Vector2 center = targetData4.Center; - center += new Vector2(0f, -400f); - if (npc.Distance(center) > 200f) - center -= npc.DirectionTo(center) * 100f; - - Vector2 targetDirection = center - npc.Center; - float lerpValue = Utils.GetLerpValue(100f, 600f, targetDirection.Length()); - float targetDistance = targetDirection.Length(); - - float maxVelocity = death ? 24f : 21f; - if (targetDistance > maxVelocity) - targetDistance = maxVelocity; - - npc.velocity = Vector2.Lerp(targetDirection.SafeNormalize(Vector2.Zero) * targetDistance, targetDirection / 6f, lerpValue); - npc.netUpdate = true; - } - - npc.velocity *= 0.92f; - npc.ai[1] += 1f; - if (!(npc.ai[1] >= idleTimer)) - break; - - int attackPatternLength = (int)npc.ai[2]; - int attackType = 2; - int attackIncrement = 0; - - if (!phase2) - { - int phase1Attack1 = attackIncrement++; - int phase1Attack2 = attackIncrement++; - int phase1Attack3 = attackIncrement++; - int phase1Attack4 = attackIncrement++; - int phase1Attack5 = attackIncrement++; - int phase1Attack6 = attackIncrement++; - int phase1Attack7 = attackIncrement++; - int phase1Attack8 = attackIncrement++; - int phase1Attack9 = attackIncrement++; - int phase1Attack10 = attackIncrement++; - - if (attackPatternLength % attackIncrement == phase1Attack1) - attackType = 2; - - if (attackPatternLength % attackIncrement == phase1Attack2) - attackType = 6; - - if (attackPatternLength % attackIncrement == phase1Attack3) - attackType = 8; - - if (attackPatternLength % attackIncrement == phase1Attack4) - { - attackType = 4; - - // Adjust the upcoming Ethereal Lance attack depending on what random variable is chosen here. - calamityGlobalNPC.newAI[0] = Main.rand.Next(2); - - // Sync the Calamity AI variables. - npc.SyncExtraAI(); - } - - if (attackPatternLength % attackIncrement == phase1Attack5) - attackType = 5; - - if (attackPatternLength % attackIncrement == phase1Attack6) - attackType = 8; - - if (attackPatternLength % attackIncrement == phase1Attack7) - attackType = 2; - - if (attackPatternLength % attackIncrement == phase1Attack8) - { - attackType = 4; - - // Adjust the upcoming Ethereal Lance attack depending on what random variable is chosen here. - calamityGlobalNPC.newAI[0] = Main.rand.Next(2); - - // Sync the Calamity AI variables. - npc.SyncExtraAI(); - } - - if (attackPatternLength % attackIncrement == phase1Attack9) - attackType = 8; - - if (attackPatternLength % attackIncrement == phase1Attack10) - attackType = 5; - - if (lifeRatio <= 0.5f) - attackType = 10; - } - - if (phase2) - { - int phase2Attack1 = attackIncrement++; - int phase2Attack2 = attackIncrement++; - int phase2Attack3 = attackIncrement++; - int phase2Attack4 = attackIncrement++; - int phase2Attack5 = attackIncrement++; - int phase2Attack6 = attackIncrement++; - int phase2Attack7 = attackIncrement++; - int phase2Attack8 = attackIncrement++; - int phase2Attack9 = attackIncrement++; - int phase2Attack10 = attackIncrement++; - - if (attackPatternLength % attackIncrement == phase2Attack1) - { - attackType = 7; - - // Adjust the upcoming Ethereal Lance attack depending on what random variable is chosen here. - calamityGlobalNPC.newAI[2] = Main.rand.Next(2); - - // Sync the Calamity AI variables. - npc.SyncExtraAI(); - } - - if (attackPatternLength % attackIncrement == phase2Attack2) - attackType = 2; - - if (attackPatternLength % attackIncrement == phase2Attack3) - attackType = 8; - - if (attackPatternLength % attackIncrement == phase2Attack5) - attackType = 5; - - if (attackPatternLength % attackIncrement == phase2Attack6) - attackType = 2; - - if (attackPatternLength % attackIncrement == phase2Attack7) - attackType = 6; - - if (attackPatternLength % attackIncrement == phase2Attack7) - attackType = 6; - - if (attackPatternLength % attackIncrement == phase2Attack8) - { - attackType = 4; - - // Adjust the upcoming Ethereal Lance attack depending on what random variable is chosen here. - calamityGlobalNPC.newAI[0] = Main.rand.Next(2); - - // Sync the Calamity AI variables. - npc.SyncExtraAI(); - } - - if (attackPatternLength % attackIncrement == phase2Attack9) - attackType = 8; - - if (attackPatternLength % attackIncrement == phase2Attack4) - attackType = 11; - - if (attackPatternLength % attackIncrement == phase2Attack10) - attackType = 12; - } - - npc.TargetClosest(); - NPCAimedTarget targetData5 = npc.GetTargetData(); - bool despawnFlag = false; - if (npc.AI_120_HallowBoss_IsGenuinelyEnraged() && !bossRush) - { - if (!Main.dayTime) - despawnFlag = true; - - if (Main.dayTime && Main.time >= 53400.0) - despawnFlag = true; - } - - // Despawn. - if (targetData5.Invalid || npc.Distance(targetData5.Center) > despawnDistanceGateValue || despawnFlag) - attackType = 13; - - // Set charge direction. - if (attackType == 8 && targetData5.Center.X > npc.Center.X) - attackType = 9; - - if (attackType != 5 && attackType != 12) - npc.velocity = npc.DirectionFrom(targetData5.Center).SafeNormalize(Vector2.Zero).RotatedBy((float)Math.PI / 2f * (targetData5.Center.X > npc.Center.X).ToDirectionInt()) * 24f; - - npc.ai[0] = attackType; - npc.ai[1] = 0f; - npc.ai[2] += Main.rand.Next(2) + 1f; - npc.netUpdate = true; - - break; - - // Spawn homing Rainbow Streaks. - case 2: - - // Avoid cheap bullshit. - npc.damage = 0; - - if (npc.ai[1] == 0f) - SoundEngine.PlaySound(SoundID.Item164, npc.Center); - - Vector2 randomStreakOffset = new Vector2(-55f, -30f); - NPCAimedTarget targetData11 = npc.GetTargetData(); - Vector2 targetCenter = targetData11.Invalid ? npc.Center : targetData11.Center; - if (npc.Distance(targetCenter + rainbowStreakDistance) > movementDistanceGateValue) - npc.SimpleFlyMovement(npc.DirectionTo(targetCenter + rainbowStreakDistance).SafeNormalize(Vector2.Zero) * velocity, acceleration); - - if (npc.ai[1] < 60f) - AI_120_HallowBoss_DoMagicEffect(npc.Center + randomStreakOffset, 1, Utils.GetLerpValue(0f, 60f, npc.ai[1], clamped: true), npc); - - int streakSpawnFrequency = CalamityWorld.LegendaryMode ? 1 : 2; - if ((int)npc.ai[1] % streakSpawnFrequency == 0 && npc.ai[1] < 60f) - { - int projectileType = ProjectileID.HallowBossRainbowStreak; - int projectileDamage = npc.GetProjectileDamage(projectileType) * projectileDamageMultiplier; - - float ai3 = npc.ai[1] / 60f; - Vector2 rainbowStreakVelocity = new Vector2(0f, death ? -10f : -8f).RotatedBy((float)Math.PI / 2f * Main.rand.NextFloatDirection()); - if (phase2) - rainbowStreakVelocity = new Vector2(0f, death ? -12f : -10f).RotatedBy((float)Math.PI * 2f * Main.rand.NextFloat()); - - if (dayTimeEnrage) - rainbowStreakVelocity *= MathHelper.Lerp(0.8f, 1.6f, ai3); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + randomStreakOffset, rainbowStreakVelocity, projectileType, projectileDamage, 0f, Main.myPlayer, npc.target, ai3); - if (Main.rand.NextBool(60) && CalamityWorld.LegendaryMode) - { - Main.projectile[proj].extraUpdates += 1; - Main.projectile[proj].netUpdate = true; - } - } - - // Spawn extra homing Rainbow Streaks per player. - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int multiplayerStreakSpawnFrequency = (int)(npc.ai[1] / streakSpawnFrequency); - for (int i = 0; i < Main.maxPlayers; i++) - { - if (npc.Boss_CanShootExtraAt(i, multiplayerStreakSpawnFrequency % 3, 3, 2400f)) - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + randomStreakOffset, rainbowStreakVelocity, projectileType, projectileDamage, 0f, Main.myPlayer, i, ai3); - } - } - } - - npc.ai[1] += 1f; - extraPhaseTime = (dayTimeEnrage ? 36f : 72f) + 30f * lessTimeSpentPerPhaseMultiplier; - if (npc.ai[1] >= 60f + extraPhaseTime) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.netUpdate = true; - } - - break; - - // This is never fucking used. - /*case 3: - { - npc.ai[1] += 1f; - NPCAimedTarget targetData8 = npc.GetTargetData(); - Vector2 targetCenter = targetData8.Invalid ? npc.Center : targetData8.Center; - if (npc.Distance(targetCenter + phase2AnimationDistance) > 0.5f) - npc.SimpleFlyMovement(npc.DirectionTo(targetCenter + phase2AnimationDistance).SafeNormalize(Vector2.Zero) * scaleFactor, 4f); - - if ((int)npc.ai[1] % 180 == 0) - { - Vector2 auroraVector = new Vector2(0f, -100f); - Projectile.NewProjectile(npc.GetSource_FromAI(), targetData8.Center + auroraVector, Vector2.Zero, ProjectileID.HallowBossDeathAurora, magicAmt, 0f, Main.myPlayer); - } - - if (npc.ai[1] >= 120f) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.netUpdate = true; - } - - break; - }*/ - - // Spawn Ethereal Lances around the target in seemingly random places (they will be made slower to make this easier to deal with). - case 4: - - // Avoid cheap bullshit. - npc.damage = 0; - - if (npc.ai[1] == 0f) - SoundEngine.PlaySound(SoundID.Item162, npc.Center); - - if (npc.ai[1] >= 6f && npc.ai[1] < 54f) - { - AI_120_HallowBoss_DoMagicEffect(npc.Center + new Vector2(-55f, -20f), 2, Utils.GetLerpValue(0f, 100f, npc.ai[1], clamped: true), npc); - AI_120_HallowBoss_DoMagicEffect(npc.Center + new Vector2(55f, -20f), 4, Utils.GetLerpValue(0f, 100f, npc.ai[1], clamped: true), npc); - } - - NPCAimedTarget targetData10 = npc.GetTargetData(); - targetCenter = targetData10.Invalid ? npc.Center : targetData10.Center; - if (npc.Distance(targetCenter + etherealLanceDistance) > movementDistanceGateValue) - npc.SimpleFlyMovement(npc.DirectionTo(targetCenter + etherealLanceDistance).SafeNormalize(Vector2.Zero) * velocity, acceleration); - - int lanceRotation = death ? 8 : 12; - if (npc.ai[1] % (dayTimeEnrage ? 2f : 3f) == 0f && npc.ai[1] < 100f) - { - for (int n = 0; n < 1; n++) - { - int lanceFrequency = (int)(npc.ai[1] / (dayTimeEnrage ? 2f : 3f)); - Vector2 lanceDirection = Vector2.UnitX.RotatedBy((float)Math.PI / (lanceRotation * 2) + lanceFrequency * ((float)Math.PI / lanceRotation)); - if (calamityGlobalNPC.newAI[0] == 0f) - lanceDirection.X += (lanceDirection.X > 0f) ? 0.5f : -0.5f; - - lanceDirection.Normalize(); - float spawnDistance = 600f; - - Vector2 playerCenter = targetData10.Center; - if (npc.Distance(playerCenter) > 2400f) - continue; - - if (Vector2.Dot(targetData10.Velocity.SafeNormalize(Vector2.UnitY), lanceDirection) > 0f) - lanceDirection *= -1f; - - Vector2 targetHoverPos = playerCenter + targetData10.Velocity * 90; - Vector2 spawnLocation = playerCenter + lanceDirection * spawnDistance - targetData10.Velocity * 30f; - if (spawnLocation.Distance(playerCenter) < spawnDistance) - { - Vector2 lanceSpawnDirection = playerCenter - spawnLocation; - if (lanceSpawnDirection == Vector2.Zero) - lanceSpawnDirection = lanceDirection; - - spawnLocation = playerCenter - Vector2.Normalize(lanceSpawnDirection) * spawnDistance; - } - - int projectileType = ProjectileID.FairyQueenLance; - int projectileDamage = npc.GetProjectileDamage(projectileType) * projectileDamageMultiplier; - - Vector2 v3 = targetHoverPos - spawnLocation; - if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(npc.GetSource_FromAI(), spawnLocation, Vector2.Zero, projectileType, projectileDamage, 0f, Main.myPlayer, v3.ToRotation(), npc.ai[1] / 100f); - - if (Main.netMode == NetmodeID.MultiplayerClient) - continue; - - // Spawn extra Ethereal Lances per player. - for (int j = 0; j < Main.maxPlayers; j++) - { - if (!npc.Boss_CanShootExtraAt(j, lanceFrequency % 3, 3, 2400f)) - continue; - - Player extraPlayer = Main.player[j]; - playerCenter = extraPlayer.Center; - if (Vector2.Dot(extraPlayer.velocity.SafeNormalize(Vector2.UnitY), lanceDirection) > 0f) - lanceDirection *= -1f; - - Vector2 extraPlayerSpawnLocation = playerCenter + extraPlayer.velocity * 90; - spawnLocation = playerCenter + lanceDirection * spawnDistance - extraPlayer.velocity * 30f; - if (spawnLocation.Distance(playerCenter) < spawnDistance) - { - Vector2 extraPlayerSpawnDirection = playerCenter - spawnLocation; - if (extraPlayerSpawnDirection == Vector2.Zero) - extraPlayerSpawnDirection = lanceDirection; - - spawnLocation = playerCenter - Vector2.Normalize(extraPlayerSpawnDirection) * spawnDistance; - } - - v3 = extraPlayerSpawnLocation - spawnLocation; - Projectile.NewProjectile(npc.GetSource_FromAI(), spawnLocation, Vector2.Zero, projectileType, projectileDamage, 0f, Main.myPlayer, v3.ToRotation(), npc.ai[1] / 100f); - } - } - } - - npc.ai[1] += 1f; - extraPhaseTime = (dayTimeEnrage ? 24f : 48f) + 20f * lessTimeSpentPerPhaseMultiplier; - if (npc.ai[1] >= 100f + extraPhaseTime) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - calamityGlobalNPC.newAI[0] = 0f; - npc.netUpdate = true; - - // Sync the Calamity AI variables. - npc.SyncExtraAI(); - } - - break; - - // Spawn Everlasting Rainbow spiral. - case 5: - - // Avoid cheap bullshit. - npc.damage = 0; - - if (npc.ai[1] == 0f) - SoundEngine.PlaySound(SoundID.Item163, npc.Center); - - Vector2 magicSpawnOffset = new Vector2(55f, -30f); - Vector2 everlastingRainbowSpawn = npc.Center + magicSpawnOffset; - if (npc.ai[1] < 42f) - AI_120_HallowBoss_DoMagicEffect(npc.Center + magicSpawnOffset, 3, Utils.GetLerpValue(0f, 42f, npc.ai[1], clamped: true), npc); - - NPCAimedTarget targetData7 = npc.GetTargetData(); - targetCenter = targetData7.Invalid ? npc.Center : targetData7.Center; - if (npc.Distance(targetCenter + everlastingRainbowDistance) > movementDistanceGateValue) - npc.SimpleFlyMovement(npc.DirectionTo(targetCenter + everlastingRainbowDistance).SafeNormalize(Vector2.Zero) * velocity, acceleration); - - if (npc.ai[1] % 42f == 0f && npc.ai[1] < 42f) - { - float projRotation = (float)Math.PI * 2f * Main.rand.NextFloat(); - float totalProjectiles = CalamityWorld.LegendaryMode ? 30f : death ? (dayTimeEnrage ? 22f : 15f) : (dayTimeEnrage ? 18f : 13f); - int projIndex = 0; - bool inversePhase2SpreadPattern = Main.rand.NextBool(); - for (float i = 0f; i < 1f; i += 1f / totalProjectiles) - { - int projectileType = ProjectileID.HallowBossLastingRainbow; - int projectileDamage = npc.GetProjectileDamage(projectileType) * projectileDamageMultiplier; - - float projRotationMultiplier = i; - Vector2 spinningpoint = Vector2.UnitY.RotatedBy((float)Math.PI / 2f + (float)Math.PI * 2f * projRotationMultiplier + projRotation); - - float initialVelocity = death ? 2f : 1.75f; - if (dayTimeEnrage && projIndex % 2 == 0) - initialVelocity *= 2f; - if (CalamityWorld.LegendaryMode) - initialVelocity *= 1.5f; - - // Given that maxAddedVelocity = 2 - // Before inverse: index 0 = 2, index 0.25 = 0, index 0.5 = 2, index 0.75 = 0, index 1 = 2 - // After inverse: index 0 = 0, index 0.25 = 2, index 0.5 = 0, index 0.75 = 2, index 1 = 0 - if (phase2) - { - float maxAddedVelocity = initialVelocity; - float addedVelocity = inversePhase2SpreadPattern ? Math.Abs(maxAddedVelocity - Math.Abs(MathHelper.Lerp(-maxAddedVelocity, maxAddedVelocity, Math.Abs(i - 0.5f) * 2f))) : Math.Abs(MathHelper.Lerp(-maxAddedVelocity, maxAddedVelocity, Math.Abs(i - 0.5f) * 2f)); - initialVelocity += addedVelocity; - } - - if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(npc.GetSource_FromAI(), everlastingRainbowSpawn + spinningpoint.RotatedBy(-MathHelper.PiOver2) * 30f, spinningpoint * initialVelocity, projectileType, projectileDamage, 0f, Main.myPlayer, 0f, projRotationMultiplier); - - projIndex++; - } - } - - npc.ai[1] += 1f; - extraPhaseTime = (dayTimeEnrage ? 36f : 72f) + 30f * lessTimeSpentPerPhaseMultiplier; - if (npc.ai[1] >= 72f + extraPhaseTime) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.netUpdate = true; - } - - break; - - // Use Sun Dance. - case 6: - - // Avoid cheap bullshit. - npc.damage = 0; - - // Increase durability. - calamityGlobalNPC.DR = shouldBeInPhase2ButIsStillInPhase1 ? 0.99f : (bossRush ? 0.99f : 0.575f); - - int totalSunDances = phase2 ? 2 : 3; - float sunDanceGateValue = dayTimeEnrage ? 35f : death ? 40f : 50f; - float totalSunDancePhaseTime = totalSunDances * sunDanceGateValue; - - Vector2 sunDanceHoverOffset = new Vector2(0f, -100f); - Vector2 position = npc.Center + sunDanceHoverOffset; - - NPCAimedTarget targetData2 = npc.GetTargetData(); - targetCenter = targetData2.Invalid ? npc.Center : targetData2.Center; - if (npc.Distance(targetCenter + sunDanceDistance) > movementDistanceGateValue) - npc.SimpleFlyMovement(npc.DirectionTo(targetCenter + sunDanceDistance).SafeNormalize(Vector2.Zero) * velocity * 0.3f, acceleration * 0.7f); - - if (npc.ai[1] % sunDanceGateValue == 0f && npc.ai[1] < totalSunDancePhaseTime) - { - int projectileType = ProjectileID.FairyQueenSunDance; - int projectileDamage = npc.GetProjectileDamage(projectileType) * projectileDamageMultiplier; - - int sunDanceExtension = (int)(npc.ai[1] / sunDanceGateValue); - int targetFloatDirection = (targetData2.Center.X > npc.Center.X) ? 1 : 0; - float projAmount = phase2 ? 8f : 6f; - float projRotation = 1f / projAmount; - for (float j = 0f; j < 1f; j += projRotation) - { - float projDirection = (j + projRotation * 0.5f + sunDanceExtension * projRotation * 0.5f) % 1f; - float ai = (float)Math.PI * 2f * (projDirection + targetFloatDirection); - if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(npc.GetSource_FromAI(), position, Vector2.Zero, projectileType, projectileDamage, 0f, Main.myPlayer, ai, npc.whoAmI); - } - } - - npc.ai[1] += 1f; - extraPhaseTime = (dayTimeEnrage ? 110f : 150f) + 30f * lessTimeSpentPerPhaseMultiplier; // 112.5 is too little - if (npc.ai[1] >= totalSunDancePhaseTime + extraPhaseTime) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.netUpdate = true; - } - - break; - - // Spawn rows of Ethereal Lances. - case 7: - - // Avoid cheap bullshit. - npc.damage = 0; - - // Expert attack or not. - bool expertAttack = calamityGlobalNPC.newAI[2] == 0f; - - int numLanceWalls = expertAttack ? 6 : 4; - float lanceWallSpawnGateValue = expertAttack ? 36f : 54f; - if (dayTimeEnrage) - lanceWallSpawnGateValue -= expertAttack ? 4f : 6f; - - float lanceWallPhaseTime = lanceWallSpawnGateValue * numLanceWalls; - - NPCAimedTarget targetData9 = npc.GetTargetData(); - destination = targetData9.Invalid ? npc.Center : targetData9.Center; - if (npc.Distance(destination + etherealLanceDistance) > movementDistanceGateValue) - npc.SimpleFlyMovement(npc.DirectionTo(destination + etherealLanceDistance).SafeNormalize(Vector2.Zero) * velocity * 0.4f, acceleration); - - if ((int)npc.ai[1] % lanceWallSpawnGateValue == 0f && npc.ai[1] < lanceWallPhaseTime) - { - SoundEngine.PlaySound(SoundID.Item162, npc.Center); - - float totalProjectiles = 15f; - float lanceSpacing = 175f; - float lanceWallSize = totalProjectiles * lanceSpacing; - - Vector2 center3 = targetData9.Center; - if (npc.Distance(center3) <= 3200f) - { - Vector2 lanceWallStartingPosition = Vector2.Zero; - Vector2 lanceWallDirection = Vector2.UnitY; - float lanceWallConvergence = 0.4f; - float lanceWallSizeMult = 1.4f; - totalProjectiles += 5f; - lanceSpacing += 50f; - lanceWallSize *= 0.5f; - - int randomLanceWallType; - do randomLanceWallType = Main.rand.Next(numLanceWalls); - while (randomLanceWallType == calamityGlobalNPC.newAI[0]); - - // This is set so that Empress doesn't use the same wall type twice in a row. - calamityGlobalNPC.newAI[0] = randomLanceWallType; - - // Keeps track of the total number of lance walls used. - calamityGlobalNPC.newAI[1] += 1f; - - // Sync the Calamity AI variables. - npc.SyncExtraAI(); - - switch (randomLanceWallType) - { - case 0: - center3 += new Vector2((0f - lanceWallSize) / 2f, 0f); - lanceWallStartingPosition = new Vector2(0f, lanceWallSize); - lanceWallDirection = Vector2.UnitX; - break; - - case 1: - center3 += new Vector2(lanceWallSize / 2f, lanceSpacing / 2f); - lanceWallStartingPosition = new Vector2(0f, lanceWallSize); - lanceWallDirection = -Vector2.UnitX; - break; - - case 2: - center3 += new Vector2(0f - lanceWallSize, 0f - lanceWallSize) * lanceWallConvergence; - lanceWallStartingPosition = new Vector2(lanceWallSize * lanceWallSizeMult, 0f); - lanceWallDirection = new Vector2(1f, 1f); - break; - - case 3: - center3 += new Vector2(lanceWallSize * lanceWallConvergence + lanceSpacing / 2f, (0f - lanceWallSize) * lanceWallConvergence); - lanceWallStartingPosition = new Vector2((0f - lanceWallSize) * lanceWallSizeMult, 0f); - lanceWallDirection = new Vector2(-1f, 1f); - break; - - case 4: - center3 += new Vector2(0f - lanceWallSize, lanceWallSize) * lanceWallConvergence; - lanceWallStartingPosition = new Vector2(lanceWallSize * lanceWallSizeMult, 0f); - lanceWallDirection = center3.DirectionTo(targetData9.Center); - break; - - case 5: - center3 += new Vector2(lanceWallSize * lanceWallConvergence + lanceSpacing / 2f, lanceWallSize * lanceWallConvergence); - lanceWallStartingPosition = new Vector2((0f - lanceWallSize) * lanceWallSizeMult, 0f); - lanceWallDirection = center3.DirectionTo(targetData9.Center); - break; - } - - int projectileType = ProjectileID.FairyQueenLance; - int projectileDamage = npc.GetProjectileDamage(projectileType) * projectileDamageMultiplier; - - for (float i = 0f; i <= 1f; i += 1f / totalProjectiles) - { - Vector2 spawnLocation = center3 + lanceWallStartingPosition * (i - 0.5f) * (expertAttack ? 1f : 2f); - Vector2 v2 = lanceWallDirection; - if (expertAttack) - { - Vector2 lanceWallSpawnPredictiveness = targetData9.Velocity * 20f * i; - Vector2 lanceWallSpawnLocation = spawnLocation.DirectionTo(targetData9.Center + lanceWallSpawnPredictiveness); - v2 = Vector2.Lerp(lanceWallDirection, lanceWallSpawnLocation, 0.75f).SafeNormalize(Vector2.UnitY); - } - - if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(npc.GetSource_FromAI(), spawnLocation, Vector2.Zero, projectileType, projectileDamage, 0f, Main.myPlayer, v2.ToRotation(), i); - } - } - - // Chance to stop using the lance walls and switch to a different attack after 3 lance walls are used. - if (Main.rand.NextBool(5 - ((int)calamityGlobalNPC.newAI[1] - 2)) && calamityGlobalNPC.newAI[1] >= 2f) - { - npc.ai[1] = lanceWallPhaseTime; - npc.netUpdate = true; - } - } - - npc.ai[1] += 1f; - extraPhaseTime = (dayTimeEnrage ? 24f : 48f) + 20f * lessTimeSpentPerPhaseMultiplier; - if (npc.ai[1] >= lanceWallPhaseTime + extraPhaseTime) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - calamityGlobalNPC.newAI[0] = 0f; - calamityGlobalNPC.newAI[1] = 0f; - calamityGlobalNPC.newAI[2] = 0f; - npc.SyncExtraAI(); - npc.netUpdate = true; - } - - break; - - // Charge either left or right. - case 8: - case 9: - - takeDamage = !(npc.ai[1] >= 6f) || !(npc.ai[1] <= 40f); - - int chargeDirection = (npc.ai[0] != 8f) ? 1 : (-1); - - AI_120_HallowBoss_DoMagicEffect(npc.Center, 5, Utils.GetLerpValue(40f, 90f, npc.ai[1], clamped: true), npc); - - float chargeGateValue = 40f; - float chargeDuration = 50f; - if (npc.ai[1] <= chargeGateValue) - { - // Avoid cheap bullshit. - npc.damage = 0; - - if (npc.ai[1] == 20f) - SoundEngine.PlaySound(SoundID.Item160, npc.Center); - - NPCAimedTarget targetData3 = npc.GetTargetData(); - destination = (targetData3.Invalid ? npc.Center : targetData3.Center) + new Vector2(chargeDirection * -800f, 0f); - npc.SimpleFlyMovement(npc.DirectionTo(destination).SafeNormalize(Vector2.Zero) * velocity, acceleration * 2f); - - if (npc.ai[1] == chargeGateValue) - npc.velocity *= 0.3f; - } - else if (npc.ai[1] <= chargeGateValue + chargeDuration) - { - // Spawn Rainbow Streaks during charge. - if (npc.ai[1] == chargeGateValue + 1f) - SoundEngine.PlaySound(SoundID.Item164, npc.Center); - - float rainbowStreakGateValue = 2f; - if ((npc.ai[1] - 1f) % rainbowStreakGateValue == 0f) - { - int projectileType = ProjectileID.HallowBossRainbowStreak; - int projectileDamage = npc.GetProjectileDamage(projectileType) * projectileDamageMultiplier; - - float ai3 = (npc.ai[1] - chargeGateValue - 1f) / chargeDuration; - Vector2 rainbowStreakVelocity = new Vector2(0f, death ? -5f : -4f).RotatedBy((float)Math.PI / 2f * Main.rand.NextFloatDirection()); - if (phase2) - rainbowStreakVelocity = new Vector2(0f, death ? -6f : -5f).RotatedBy((float)Math.PI * 2f * Main.rand.NextFloat()); - - rainbowStreakVelocity.X *= 2f; - if (!phase2) - rainbowStreakVelocity.Y *= 0.5f; - - if (dayTimeEnrage) - rainbowStreakVelocity *= MathHelper.Lerp(0.8f, 1.6f, ai3); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, rainbowStreakVelocity, projectileType, projectileDamage, 0f, Main.myPlayer, npc.target, ai3); - if (Main.rand.NextBool(30) && CalamityWorld.LegendaryMode) - { - Main.projectile[proj].extraUpdates += 1; - Main.projectile[proj].netUpdate = true; - } - } - - // Spawn extra homing Rainbow Streaks per player. - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int multiplayerStreakSpawnFrequency = (int)((npc.ai[1] - chargeGateValue - 1f) / rainbowStreakGateValue); - for (int i = 0; i < Main.maxPlayers; i++) - { - if (npc.Boss_CanShootExtraAt(i, multiplayerStreakSpawnFrequency % 3, 3, 2400f)) - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, rainbowStreakVelocity, projectileType, projectileDamage, 0f, Main.myPlayer, i, ai3); - } - } - } - - npc.velocity = Vector2.Lerp(value2: new Vector2(chargeDirection * 70f, 0f), value1: npc.velocity, amount: 0.05f); - - if (npc.ai[1] == chargeGateValue + chargeDuration) - npc.velocity *= 0.45f; - - npc.damage = (int)(npc.defDamage * (dayTimeEnrage ? 3f : 1.5f)); - } - else - { - // Avoid cheap bullshit. - npc.damage = 0; - - npc.velocity *= 0.92f; - } - - npc.ai[1] += 1f; - extraPhaseTime = (dayTimeEnrage ? 48f : 96f) * lessTimeSpentPerPhaseMultiplier; - if (npc.ai[1] >= 150f + extraPhaseTime) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.netUpdate = true; - } - - break; - - // Phase 2 animation. - case 10: - - // Avoid cheap bullshit. - npc.damage = 0; - - if (npc.ai[1] == 0f) - SoundEngine.PlaySound(SoundID.Item161, npc.Center); - - takeDamage = !(npc.ai[1] >= 30f) || !(npc.ai[1] <= 170f); - - npc.velocity *= 0.95f; - - if (npc.ai[1] == 90f) - { - if (npc.ai[3] == 0f) - npc.ai[3] = 1f; - - if (npc.ai[3] == 2f) - npc.ai[3] = 3f; - - npc.Center = npc.GetTargetData().Center + new Vector2(0f, -250f); - npc.netUpdate = true; - } - - npc.ai[1] += 1f; - if (npc.ai[1] >= 180f) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.netUpdate = true; - } - - break; - - // Spawn Ethereal Lances around the target in seemingly random places (they will be made slower to make this easier to deal with). - case 11: - - // Avoid cheap bullshit. - npc.damage = 0; - - if (npc.ai[1] == 0f) - SoundEngine.PlaySound(SoundID.Item162, npc.Center); - - if (npc.ai[1] >= 6f && npc.ai[1] < 54f) - { - AI_120_HallowBoss_DoMagicEffect(npc.Center + new Vector2(-55f, -20f), 2, Utils.GetLerpValue(0f, 100f, npc.ai[1], clamped: true), npc); - AI_120_HallowBoss_DoMagicEffect(npc.Center + new Vector2(55f, -20f), 4, Utils.GetLerpValue(0f, 100f, npc.ai[1], clamped: true), npc); - } - - NPCAimedTarget targetData6 = npc.GetTargetData(); - targetCenter = targetData6.Invalid ? npc.Center : targetData6.Center; - if (npc.Distance(targetCenter + etherealLanceDistance) > movementDistanceGateValue) - npc.SimpleFlyMovement(npc.DirectionTo(targetCenter + etherealLanceDistance).SafeNormalize(Vector2.Zero) * velocity, acceleration); - - float etherealLanceGateValue = death ? 5f : 6f; - if (dayTimeEnrage) - etherealLanceGateValue -= 1f; - - if (npc.ai[1] % etherealLanceGateValue == 0f && npc.ai[1] < 100f) - { - for (int k = 0; k < 3; k++) - { - Vector2 inverseTargetVel = -targetData6.Velocity; - inverseTargetVel.SafeNormalize(-Vector2.UnitY); - float spawnDistance = 100f + (k * 100f); - - targetCenter = targetData6.Center; - if (npc.Distance(targetCenter) > 2400f) - continue; - - Vector2 straightLanceSpawnPredict = targetCenter + targetData6.Velocity * 90; - Vector2 straightLanceSpawnDirection = targetCenter + inverseTargetVel * spawnDistance; - if (straightLanceSpawnDirection.Distance(targetCenter) < spawnDistance) - { - Vector2 straightLanceSpawnLocation = targetCenter - straightLanceSpawnDirection; - if (straightLanceSpawnLocation == Vector2.Zero) - straightLanceSpawnLocation = inverseTargetVel; - - straightLanceSpawnDirection = targetCenter - Vector2.Normalize(straightLanceSpawnLocation) * spawnDistance; - } - - int projectileType = ProjectileID.FairyQueenLance; - int projectileDamage = npc.GetProjectileDamage(projectileType) * projectileDamageMultiplier; - - Vector2 v = straightLanceSpawnPredict - straightLanceSpawnDirection; - if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(npc.GetSource_FromAI(), straightLanceSpawnDirection, Vector2.Zero, projectileType, projectileDamage, 0f, Main.myPlayer, v.ToRotation(), npc.ai[1] / 100f); - - if (Main.netMode == NetmodeID.MultiplayerClient) - continue; - - int multiplayerExtraStraightLances = (int)(npc.ai[1] / etherealLanceGateValue); - for (int l = 0; l < Main.maxPlayers; l++) - { - if (!npc.Boss_CanShootExtraAt(l, multiplayerExtraStraightLances % 3, 3, 2400f)) - continue; - - Player player = Main.player[l]; - inverseTargetVel = -player.velocity; - inverseTargetVel.SafeNormalize(-Vector2.UnitY); - targetCenter = player.Center; - Vector2 extraPlayerLancePredict = targetCenter + player.velocity * 90; - straightLanceSpawnDirection = targetCenter + inverseTargetVel * spawnDistance; - if (straightLanceSpawnDirection.Distance(targetCenter) < spawnDistance) - { - Vector2 extraPlayerLanceSpawnLocation = targetCenter - straightLanceSpawnDirection; - if (extraPlayerLanceSpawnLocation == Vector2.Zero) - extraPlayerLanceSpawnLocation = inverseTargetVel; - - straightLanceSpawnDirection = targetCenter - Vector2.Normalize(extraPlayerLanceSpawnLocation) * spawnDistance; - } - - v = extraPlayerLancePredict - straightLanceSpawnDirection; - Projectile.NewProjectile(npc.GetSource_FromAI(), straightLanceSpawnDirection, Vector2.Zero, projectileType, projectileDamage, 0f, Main.myPlayer, v.ToRotation(), npc.ai[1] / 100f); - } - } - } - - npc.ai[1] += 1f; - extraPhaseTime = (dayTimeEnrage ? 24f : 48f) * lessTimeSpentPerPhaseMultiplier; - if (npc.ai[1] >= 100f + extraPhaseTime) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.netUpdate = true; - } - - break; - - // Spawn homing Rainbow Streaks. - case 12: - - // Avoid cheap bullshit. - npc.damage = 0; - - Vector2 projRandomOffset = new Vector2(-55f, -30f); - - if (npc.ai[1] == 0f) - { - SoundEngine.PlaySound(SoundID.Item165, npc.Center); - npc.velocity = new Vector2(0f, -12f); - } - - npc.velocity *= 0.95f; - - bool shouldSpawnStreaks = npc.ai[1] < 60f && npc.ai[1] >= 10f; - if (shouldSpawnStreaks) - AI_120_HallowBoss_DoMagicEffect(npc.Center + projRandomOffset, 1, Utils.GetLerpValue(0f, 60f, npc.ai[1], clamped: true), npc); - - int stationaryStreakSpawnFrequency = 4; - if (dayTimeEnrage) - stationaryStreakSpawnFrequency -= 1; - - float streakHomeTime = (npc.ai[1] - 10f) / 50f; - if ((int)npc.ai[1] % stationaryStreakSpawnFrequency == 0 && shouldSpawnStreaks) - { - int projectileType = ProjectileID.HallowBossRainbowStreak; - int projectileDamage = npc.GetProjectileDamage(projectileType) * projectileDamageMultiplier; - - Vector2 vector = new Vector2(0f, death ? -24f : -22f).RotatedBy((float)Math.PI * 2f * streakHomeTime); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + projRandomOffset, vector, projectileType, projectileDamage, 0f, Main.myPlayer, npc.target, streakHomeTime); - if (Main.rand.NextBool(15) && CalamityWorld.LegendaryMode) - { - Main.projectile[proj].extraUpdates += 1; - Main.projectile[proj].netUpdate = true; - } - } - - // Spawn extra homing Rainbow Streaks per player. - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int extraStationaryStreakSpawnFrequency = (int)(npc.ai[1] % stationaryStreakSpawnFrequency); - for (int j = 0; j < Main.maxPlayers; j++) - { - if (npc.Boss_CanShootExtraAt(j, extraStationaryStreakSpawnFrequency % 3, 3, 2400f)) - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + projRandomOffset, vector, projectileType, projectileDamage, 0f, Main.myPlayer, j, streakHomeTime); - } - } - } - - npc.ai[1] += 1f; - extraPhaseTime = (dayTimeEnrage ? 36f : 72f) + 30f * lessTimeSpentPerPhaseMultiplier; - if (npc.ai[1] >= 120f + extraPhaseTime) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.netUpdate = true; - } - - break; - - // Despawn. - case 13: - - // Avoid cheap bullshit. - npc.damage = 0; - - if (npc.ai[1] == 0f) - { - SoundEngine.PlaySound(SoundID.Item165, npc.Center); - npc.velocity = new Vector2(0f, -7f); - } - - npc.velocity *= 0.95f; - - npc.TargetClosest(); - NPCAimedTarget targetData = npc.GetTargetData(); - - visible = false; - - bool trueDespawnFlag = false; - bool shouldDespawn = false; - if (!trueDespawnFlag) - { - if (npc.AI_120_HallowBoss_IsGenuinelyEnraged() && !bossRush) - { - if (!Main.dayTime) - shouldDespawn = true; - - if (Main.dayTime && Main.time >= 53400.0) - shouldDespawn = true; - } - - trueDespawnFlag = trueDespawnFlag || shouldDespawn; - } - - if (!trueDespawnFlag) - { - bool hasNoTarget = targetData.Invalid || npc.Distance(targetData.Center) > despawnDistanceGateValue; - trueDespawnFlag = trueDespawnFlag || hasNoTarget; - } - - npc.alpha = Utils.Clamp(npc.alpha + trueDespawnFlag.ToDirectionInt() * 5, 0, 255); - bool alphaExtreme = npc.alpha == 0 || npc.alpha == 255; - - int despawnDustAmt = 5; - for (int i = 0; i < despawnDustAmt; i++) - { - float despawnDustOpacity = MathHelper.Lerp(1.3f, 0.7f, npc.Opacity); - Color newColor = Main.hslToRgb(Main.rand.NextFloat(), 1f, 0.5f); - int despawnRainbowDust = Dust.NewDust(npc.position - npc.Size * 0.5f, npc.width * 2, npc.height * 2, 267, 0f, 0f, 0, newColor); - Main.dust[despawnRainbowDust].position = npc.Center + Main.rand.NextVector2Circular(npc.width, npc.height); - Main.dust[despawnRainbowDust].velocity *= Main.rand.NextFloat() * 0.8f; - Main.dust[despawnRainbowDust].noGravity = true; - Main.dust[despawnRainbowDust].scale = 0.9f + Main.rand.NextFloat() * 1.2f; - Main.dust[despawnRainbowDust].fadeIn = 0.4f + Main.rand.NextFloat() * 1.2f * despawnDustOpacity; - Main.dust[despawnRainbowDust].velocity += Vector2.UnitY * -2f; - Main.dust[despawnRainbowDust].scale = 0.35f; - if (despawnRainbowDust != 6000) - { - Dust dust = Dust.CloneDust(despawnRainbowDust); - dust.scale /= 2f; - dust.fadeIn *= 0.85f; - dust.color = new Color(255, 255, 255, 255); - } - } - - npc.ai[1] += 1f; - if (!(npc.ai[1] >= 20f && alphaExtreme)) - break; - - if (npc.alpha == 255) - { - npc.active = false; - if (Main.netMode != NetmodeID.MultiplayerClient) - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, npc.whoAmI); - - return false; - } - - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.netUpdate = true; - break; - } - - npc.dontTakeDamage = !takeDamage; - - if (phase2) - npc.defense = (int)(npc.defDefense * 1.2f); - else - npc.defense = npc.defDefense; - - if ((npc.localAI[0] += 1f) >= 44f) - npc.localAI[0] = 0f; - - if (visible) - npc.alpha = Utils.Clamp(npc.alpha - 5, 0, 255); - - Lighting.AddLight(npc.Center, Vector3.One * npc.Opacity); - - return false; - } - - private static void AI_120_HallowBoss_DoMagicEffect(Vector2 spot, int effectType, float progress, NPC npc) - { - float magicDustSpawnArea = 4f; - float magicDustColorMult = 1f; - float fadeIn = 0f; - float magicDustPosChange = 0.5f; - int magicAmt = 2; - int magicDustType = 267; - switch (effectType) - { - case 1: - magicDustColorMult = 0.5f; - fadeIn = 2f; - magicDustPosChange = 0f; - break; - case 2: - case 4: - magicDustSpawnArea = 50f; - magicDustColorMult = 0.5f; - fadeIn = 0f; - magicDustPosChange = 0f; - magicAmt = 4; - break; - case 3: - magicDustSpawnArea = 30f; - magicDustColorMult = 0.1f; - fadeIn = 2.5f; - magicDustPosChange = 0f; - break; - case 5: - if (progress == 0f) - { - magicAmt = 0; - } - else - { - magicAmt = 5; - magicDustType = Main.rand.Next(86, 92); - } - if (progress >= 1f) - magicAmt = 0; - break; - } - - for (int i = 0; i < magicAmt; i++) - { - Dust dust = Dust.NewDustPerfect(spot, magicDustType, Main.rand.NextVector2CircularEdge(magicDustSpawnArea, magicDustSpawnArea) * (Main.rand.NextFloat() * (1f - magicDustPosChange) + magicDustPosChange), 0, Main.hslToRgb(Main.rand.NextFloat(), 1f, 0.5f), (Main.rand.NextFloat() * 2f + 2f) * magicDustColorMult); - dust.fadeIn = fadeIn; - dust.noGravity = true; - switch (effectType) - { - case 2: - case 4: - { - dust.velocity *= 0.005f; - dust.scale = 3f * Utils.GetLerpValue(0.7f, 0f, progress, clamped: true) * Utils.GetLerpValue(0f, 0.3f, progress, clamped: true); - dust.velocity = ((float)Math.PI * 2f * (i / 4f) + (float)Math.PI / 4f).ToRotationVector2() * 8f * Utils.GetLerpValue(1f, 0f, progress, clamped: true); - dust.velocity += npc.velocity * 0.3f; - float magicDustColorChange = 0f; - if (effectType == 4) - magicDustColorChange = 0.5f; - - dust.color = Main.hslToRgb((i / 5f + magicDustColorChange + progress * 0.5f) % 1f, 1f, 0.5f); - dust.color.A /= 2; - dust.alpha = 127; - break; - } - case 5: - if (progress == 0f) - { - dust.customData = npc; - dust.scale = 1.5f; - dust.fadeIn = 0f; - dust.velocity = new Vector2(0f, -1f) + Main.rand.NextVector2Circular(1f, 1f); - dust.color = new Color(255, 255, 255, 80) * 0.3f; - } - else - { - dust.color = Main.hslToRgb(progress * 2f % 1f, 1f, 0.5f); - dust.alpha = 0; - dust.scale = 1f; - dust.fadeIn = 1.3f; - dust.velocity *= 3f; - dust.velocity.X *= 0.1f; - dust.velocity += npc.velocity * 1f; - } - break; - } - } - } - } -} diff --git a/NPCs/VanillaNPCOverrides/Bosses/EyeOfCthulhuAI.cs b/NPCs/VanillaNPCOverrides/Bosses/EyeOfCthulhuAI.cs deleted file mode 100644 index 64d91c5d5d..0000000000 --- a/NPCs/VanillaNPCOverrides/Bosses/EyeOfCthulhuAI.cs +++ /dev/null @@ -1,774 +0,0 @@ -using CalamityMod.Events; -using CalamityMod.World; -using Microsoft.Xna.Framework; -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Audio; - -namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses -{ - public static class EyeOfCthulhuAI - { - public static bool BuffedEyeofCthulhuAI(NPC npc, Mod mod) - { - CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - - // Percent life remaining - float lifeRatio = npc.life / (float)npc.lifeMax; - - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; - bool phase2 = lifeRatio < 0.75f; - bool phase3 = lifeRatio < 0.65f; - bool phase4 = lifeRatio < 0.55f; - bool phase5 = lifeRatio < 0.4f; - float lineUpDist = death ? 15f : 20f; - - float enrageScale = bossRush ? 1f : 0f; - if (Main.dayTime || bossRush) - { - npc.Calamity().CurrentlyEnraged = !bossRush; - enrageScale += 2f; - } - - npc.reflectsProjectiles = false; - - // Get a target - 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(); - - bool dead = Main.player[npc.target].dead; - float targetXDistance = npc.position.X + (npc.width / 2) - Main.player[npc.target].position.X - (Main.player[npc.target].width / 2); - float targetYDistance = npc.position.Y + npc.height - 59f - Main.player[npc.target].position.Y - (Main.player[npc.target].height / 2); - float eyeRotation = (float)Math.Atan2(targetYDistance, targetXDistance) + MathHelper.PiOver2; - - if (eyeRotation < 0f) - eyeRotation += MathHelper.TwoPi; - else if (eyeRotation > MathHelper.TwoPi) - eyeRotation -= MathHelper.TwoPi; - - float eyeRotationAcceleration = 0f; - if (npc.ai[0] == 0f && npc.ai[1] == 0f) - eyeRotationAcceleration = 0.02f; - if (npc.ai[0] == 0f && npc.ai[1] == 2f && npc.ai[2] > 40f) - eyeRotationAcceleration = 0.05f; - if (npc.ai[0] == 3f && npc.ai[1] == 0f) - eyeRotationAcceleration = 0.05f; - if (npc.ai[0] == 3f && npc.ai[1] == 2f && npc.ai[2] > 40f) - eyeRotationAcceleration = 0.08f; - if (npc.ai[0] == 3f && npc.ai[1] == 4f && npc.ai[2] > lineUpDist) - eyeRotationAcceleration = 0.15f; - if (npc.ai[0] == 3f && npc.ai[1] == 5f) - eyeRotationAcceleration = 0.05f; - eyeRotationAcceleration *= 1.5f; - - if (npc.rotation < eyeRotation) - { - if ((eyeRotation - npc.rotation) > MathHelper.Pi) - npc.rotation -= eyeRotationAcceleration; - else - npc.rotation += eyeRotationAcceleration; - } - else if (npc.rotation > eyeRotation) - { - if ((npc.rotation - eyeRotation) > MathHelper.Pi) - npc.rotation += eyeRotationAcceleration; - else - npc.rotation -= eyeRotationAcceleration; - } - - if (npc.rotation > eyeRotation - eyeRotationAcceleration && npc.rotation < eyeRotation + eyeRotationAcceleration) - npc.rotation = eyeRotation; - if (npc.rotation < 0f) - npc.rotation += MathHelper.TwoPi; - else if (npc.rotation > MathHelper.TwoPi) - npc.rotation -= MathHelper.TwoPi; - if (npc.rotation > eyeRotation - eyeRotationAcceleration && npc.rotation < eyeRotation + eyeRotationAcceleration) - npc.rotation = eyeRotation; - - if (Main.rand.NextBool(5)) - { - int randomBlood = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + npc.height * 0.25f), npc.width, (int)(npc.height * 0.5f), 5, npc.velocity.X, 2f, 0, default, 1f); - Dust dust = Main.dust[randomBlood]; - dust.velocity.X *= 0.5f; - dust.velocity.Y *= 0.1f; - } - - if (dead) - { - npc.velocity.Y -= 0.04f; - - if (npc.timeLeft > 10) - npc.timeLeft = 10; - } - - else if (npc.ai[0] == 0f) - { - if (npc.ai[1] == 0f) - { - float hoverSpeed = 7f; - float hoverAcceleration = 0.15f; - hoverSpeed += 5f * enrageScale; - hoverAcceleration += 0.1f * enrageScale; - - if (death) - { - hoverSpeed += 8f * (1f - lifeRatio); - hoverAcceleration += 0.17f * (1f - lifeRatio); - } - - if (Main.getGoodWorld) - { - hoverSpeed += 1f; - hoverAcceleration += 0.05f; - } - - Vector2 hoverDestination = Main.player[npc.target].Center - Vector2.UnitY * 320f; - Vector2 idealVelocity = npc.SafeDirectionTo(hoverDestination) * hoverSpeed; - npc.SimpleFlyMovement(idealVelocity, hoverAcceleration); - - npc.ai[2] += 1f; - float attackSwitchTimer = 180f - (death ? 200f * (1f - lifeRatio) : 0f); - if (npc.ai[2] >= attackSwitchTimer) - { - npc.ai[1] = 1f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.TargetClosest(); - npc.netUpdate = true; - } - else if (npc.WithinRange(hoverDestination, 500f)) - { - if (!Main.player[npc.target].dead) - npc.ai[3] += 1f; - - float servantSpawnGateValue = 40f; - if (Main.getGoodWorld) - servantSpawnGateValue *= 0.8f; - - if (npc.ai[3] >= servantSpawnGateValue) - { - npc.ai[3] = 0f; - npc.rotation = eyeRotation; - - Vector2 servantSpawnVelocity = npc.SafeDirectionTo(Main.player[npc.target].Center) * 6f; - Vector2 servantSpawnCenter = npc.Center + servantSpawnVelocity * 10f; - if (Main.netMode != NetmodeID.MultiplayerClient && NPC.CountNPCS(NPCID.ServantofCthulhu) < 12) - { - int eye = NPC.NewNPC(npc.GetSource_FromAI(), (int)servantSpawnCenter.X, (int)servantSpawnCenter.Y, NPCID.ServantofCthulhu); - Main.npc[eye].velocity = servantSpawnVelocity; - - if (Main.netMode == NetmodeID.Server && eye < Main.maxNPCs) - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, eye); - } - - SoundEngine.PlaySound(SoundID.NPCHit1, servantSpawnCenter); - - int servantDust; - for (int m = 0; m < 10; m = servantDust + 1) - { - Dust.NewDust(servantSpawnCenter, 20, 20, 5, servantSpawnVelocity.X * 0.4f, servantSpawnVelocity.Y * 0.4f, 0, default, 1f); - servantDust = m; - } - } - } - } - else if (npc.ai[1] == 1f) - { - npc.rotation = eyeRotation; - float chargeSpeed = 8f; - chargeSpeed += 5f * enrageScale; - if (death) - chargeSpeed += 8.5f * (1f - lifeRatio); - if (Main.getGoodWorld) - chargeSpeed += 1f; - - npc.velocity = npc.SafeDirectionTo(Main.player[npc.target].Center) * chargeSpeed; - - npc.ai[1] = 2f; - npc.netUpdate = true; - - if (npc.netSpam > 10) - npc.netSpam = 10; - } - else if (npc.ai[1] == 2f) - { - npc.ai[2] += 1f; - if (npc.ai[2] >= 40f) - { - npc.velocity *= 0.975f; - if (Main.getGoodWorld) - npc.velocity *= 0.99f; - - if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) - npc.velocity.X = 0f; - if (npc.velocity.Y > -0.1 && npc.velocity.Y < 0.1) - npc.velocity.Y = 0f; - } - else - npc.rotation = npc.velocity.ToRotation() - MathHelper.PiOver2; - - int chargeDelay = 90; - if (death) - chargeDelay -= (int)Math.Round(120f * (1f - lifeRatio)); - if (Main.getGoodWorld) - chargeDelay -= 15; - - if (npc.ai[2] >= chargeDelay) - { - npc.ai[3] += 1f; - npc.ai[2] = 0f; - npc.TargetClosest(); - npc.rotation = eyeRotation; - - if (npc.ai[3] >= 3f) - { - npc.ai[1] = 0f; - npc.ai[3] = 0f; - } - else - npc.ai[1] = 1f; - } - } - - if (phase2) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.TargetClosest(); - npc.netUpdate = true; - - if (npc.netSpam > 10) - npc.netSpam = 10; - } - } - - else if (npc.ai[0] == 1f || npc.ai[0] == 2f) - { - if (Main.getGoodWorld) - npc.reflectsProjectiles = true; - - if (npc.ai[0] == 1f) - { - npc.ai[2] += 0.005f; - if (npc.ai[2] > 0.5f) - npc.ai[2] = 0.5f; - } - else - { - npc.ai[2] -= 0.005f; - if (npc.ai[2] < 0f) - npc.ai[2] = 0f; - } - - npc.rotation += npc.ai[2]; - npc.ai[1] += 1f; - if (npc.ai[1] % (Main.getGoodWorld ? 10f : 20f) == 0f) - { - Vector2 servantSpawnVelocity = Main.rand.NextVector2CircularEdge(5.65f, 5.65f); - if (Main.getGoodWorld) - servantSpawnVelocity *= 3f; - - Vector2 servantSpawnCenter = npc.Center + servantSpawnVelocity * 10f; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int servantSpawn = NPC.NewNPC(npc.GetSource_FromAI(), (int)servantSpawnCenter.X, (int)servantSpawnCenter.Y, NPCID.ServantofCthulhu, 0, 0f, 0f, 0f, 0f, 255); - Main.npc[servantSpawn].velocity.X = servantSpawnVelocity.X; - Main.npc[servantSpawn].velocity.Y = servantSpawnVelocity.Y; - - if (Main.netMode == NetmodeID.Server && servantSpawn < Main.maxNPCs) - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, servantSpawn, 0f, 0f, 0f, 0, 0, 0); - - if (CalamityWorld.LegendaryMode) - { - int type = ProjectileID.BloodNautilusShot; - Vector2 projectileVelocity = Main.rand.NextVector2CircularEdge(10f, 10f); - int numProj = 3; - int spread = 20; - float rotation = MathHelper.ToRadians(spread); - for (int i = 0; i < numProj; i++) - { - Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + Vector2.Normalize(perturbedSpeed) * 10f, perturbedSpeed, type, 15, 0f, Main.myPlayer); - } - } - } - - int num; - for (int n = 0; n < 10; n = num + 1) - { - Dust.NewDust(servantSpawnCenter, 20, 20, 5, servantSpawnVelocity.X * 0.4f, servantSpawnVelocity.Y * 0.4f, 0, default, 1f); - num = n; - } - } - - if (npc.ai[1] == 100f) - { - npc.ai[0] += 1f; - npc.ai[1] = 0f; - - if (npc.ai[0] == 3f) - npc.ai[2] = 0f; - else - { - SoundEngine.PlaySound(SoundID.NPCHit1, npc.position); - - if (Main.netMode != NetmodeID.Server) - { - for (int phase2Gore = 0; phase2Gore < 2; phase2Gore++) - { - Gore.NewGore(npc.GetSource_FromAI(), npc.position, new Vector2(Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f), 8, 1f); - Gore.NewGore(npc.GetSource_FromAI(), npc.position, new Vector2(Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f), 7, 1f); - Gore.NewGore(npc.GetSource_FromAI(), npc.position, new Vector2(Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f), 6, 1f); - } - } - - for (int i = 0; i < 20; i++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f, 0, default, 1f); - } - - SoundEngine.PlaySound(SoundID.Roar, npc.position); - } - } - - Dust.NewDust(npc.position, npc.width, npc.height, 5, Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f, 0, default, 1f); - npc.velocity *= 0.98f; - - if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) - npc.velocity.X = 0f; - if (npc.velocity.Y > -0.1 && npc.velocity.Y < 0.1) - npc.velocity.Y = 0f; - } - - else - { - npc.defense = 0; - npc.damage = (int)(npc.defDamage * (phase5 ? 1.4f : 1.2f)); - - if (npc.ai[1] == 0f & phase5) - npc.ai[1] = 5f; - - if (npc.ai[1] == 0f) - { - float hoverSpeed = 5.5f + 3.5f * (0.75f - lifeRatio); - float hoverAcceleration = 0.06f + 0.025f * (0.75f - lifeRatio); - hoverSpeed += 4f * enrageScale; - hoverAcceleration += 0.04f * enrageScale; - - if (death) - { - hoverSpeed += 5f * (0.75f - lifeRatio); - hoverAcceleration += 0.04f * (0.75f - lifeRatio); - } - - Vector2 hoverDestination = Main.player[npc.target].Center - Vector2.UnitY * 160f; - float distanceFromHoverDestination = npc.Distance(hoverDestination); - - if (distanceFromHoverDestination > 400f) - { - hoverSpeed += 1.25f; - hoverAcceleration += 0.075f; - if (distanceFromHoverDestination > 600f) - { - hoverSpeed += 1.25f; - hoverAcceleration += 0.075f; - if (distanceFromHoverDestination > 800f) - { - hoverSpeed += 1.25f; - hoverAcceleration += 0.075f; - } - } - } - - if (Main.getGoodWorld) - { - hoverSpeed += 1f; - hoverAcceleration += 0.1f; - } - - Vector2 idealHoverVelocity = npc.SafeDirectionTo(hoverDestination) * hoverSpeed; - npc.SimpleFlyMovement(idealHoverVelocity, hoverAcceleration); - - npc.ai[2] += 1f; - float phaseLimit = 200f - (death ? 200f * (0.75f - lifeRatio) : 0f); - if (npc.ai[2] >= phaseLimit) - { - npc.ai[1] = 1f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - - if (phase4) - npc.ai[1] = 3f; - - npc.TargetClosest(); - npc.netUpdate = true; - } - } - - else if (npc.ai[1] == 1f) - { - SoundEngine.PlaySound(SoundID.ForceRoar, npc.position); - npc.rotation = eyeRotation; - - float chargeSpeed = 6.2f + 4f * (0.75f - lifeRatio); - chargeSpeed += 4f * enrageScale; - if (death) - chargeSpeed += 5.5f * (0.75f - lifeRatio); - if (npc.ai[3] == 1f) - chargeSpeed *= 1.15f; - if (npc.ai[3] == 2f) - chargeSpeed *= 1.3f; - if (Main.getGoodWorld) - chargeSpeed *= 1.2f; - - npc.velocity = npc.SafeDirectionTo(Main.player[npc.target].Center) * chargeSpeed; - npc.ai[1] = 2f; - npc.netUpdate = true; - - if (npc.netSpam > 10) - npc.netSpam = 10; - } - - else if (npc.ai[1] == 2f) - { - npc.ai[2] += 1f; - if (npc.ai[2] >= 60f) - { - npc.velocity *= 0.96f; - if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) - npc.velocity.X = 0f; - if (npc.velocity.Y > -0.1 && npc.velocity.Y < 0.1) - npc.velocity.Y = 0f; - } - else - npc.rotation = npc.velocity.ToRotation() - MathHelper.PiOver2; - - int phase2ChargeDelay = 80; - if (death) - phase2ChargeDelay -= (int)Math.Round(40f * (0.75f - lifeRatio)); - - if (npc.ai[2] >= phase2ChargeDelay) - { - npc.ai[3] += 1f; - npc.ai[2] = 0f; - npc.TargetClosest(); - npc.rotation = eyeRotation; - - if (npc.ai[3] >= 3f) - { - npc.ai[1] = 0f; - npc.ai[3] = 0f; - if (Main.netMode != NetmodeID.MultiplayerClient && phase3) - { - npc.ai[1] = 3f; - npc.ai[3] += Main.rand.Next(1, 4); - } - npc.netUpdate = true; - - if (npc.netSpam > 10) - npc.netSpam = 10; - } - else - npc.ai[1] = 1f; - } - } - - else if (npc.ai[1] == 3f) - { - if ((npc.ai[3] == 4f & phase5) && npc.Center.Y > Main.player[npc.target].Center.Y) - { - npc.TargetClosest(); - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; - - if (npc.netSpam > 10) - npc.netSpam = 10; - } - else if (Main.netMode != NetmodeID.MultiplayerClient) - { - float speedBoost = death ? 5f * (0.65f - lifeRatio) : 3.5f * (0.65f - lifeRatio); - float finalChargeSpeed = 18f + speedBoost; - finalChargeSpeed += 10f * enrageScale; - - Vector2 eyeChargeDirection = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float targetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - eyeChargeDirection.X; - float targetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - eyeChargeDirection.Y; - float targetVelocity = Math.Abs(Main.player[npc.target].velocity.X) + Math.Abs(Main.player[npc.target].velocity.Y) / 4f; - targetVelocity += 10f - targetVelocity; - - if (targetVelocity < 5f) - targetVelocity = 5f; - if (targetVelocity > 15f) - targetVelocity = 15f; - - if (npc.ai[2] == -1f) - { - targetVelocity *= 4f; - finalChargeSpeed *= 1.3f; - } - - targetX -= Main.player[npc.target].velocity.X * targetVelocity; - targetY -= Main.player[npc.target].velocity.Y * targetVelocity / 4f; - targetX *= 1f + Main.rand.Next(-10, 11) * 0.01f; - targetY *= 1f + Main.rand.Next(-10, 11) * 0.01f; - - float targetDistance = (float)Math.Sqrt(targetX * targetX + targetY * targetY); - float targetDistCopy = targetDistance; - - targetDistance = finalChargeSpeed / targetDistance; - npc.velocity.X = targetX * targetDistance; - npc.velocity.Y = targetY * targetDistance; - npc.velocity.X += Main.rand.Next(-20, 21) * 0.1f; - npc.velocity.Y += Main.rand.Next(-20, 21) * 0.1f; - - if (targetDistCopy < 100f) - { - if (Math.Abs(npc.velocity.X) > Math.Abs(npc.velocity.Y)) - { - float absoluteXVel = Math.Abs(npc.velocity.X); - float absoluteYVel = Math.Abs(npc.velocity.Y); - - if (npc.Center.X > Main.player[npc.target].Center.X) - absoluteYVel *= -1f; - if (npc.Center.Y > Main.player[npc.target].Center.Y) - absoluteXVel *= -1f; - - npc.velocity.X = absoluteYVel; - npc.velocity.Y = absoluteXVel; - } - } - else if (Math.Abs(npc.velocity.X) > Math.Abs(npc.velocity.Y)) - { - float absoluteEyeVel = (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) / 2f; - float absoluteEyeVelBackup = absoluteEyeVel; - - if (npc.Center.X > Main.player[npc.target].Center.X) - absoluteEyeVelBackup *= -1f; - if (npc.Center.Y > Main.player[npc.target].Center.Y) - absoluteEyeVel *= -1f; - - npc.velocity.X = absoluteEyeVelBackup; - npc.velocity.Y = absoluteEyeVel; - } - - npc.ai[1] = 4f; - npc.netUpdate = true; - - if (npc.netSpam > 10) - npc.netSpam = 10; - } - } - - else if (npc.ai[1] == 4f) - { - if (npc.ai[2] == 0f) - SoundEngine.PlaySound(SoundID.ForceRoar, npc.position); - - float lineUpDistControl = lineUpDist; - npc.ai[2] += 1f; - - if (npc.ai[2] == lineUpDistControl && Vector2.Distance(npc.position, Main.player[npc.target].position) < 200f) - npc.ai[2] -= 1f; - - if (npc.ai[2] >= lineUpDistControl) - { - npc.velocity *= 0.95f; - if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) - npc.velocity.X = 0f; - if (npc.velocity.Y > -0.1 && npc.velocity.Y < 0.1) - npc.velocity.Y = 0f; - } - else - npc.rotation = npc.velocity.ToRotation() - MathHelper.PiOver2; - - float lineUpDistNetUpdate = lineUpDistControl + 13f; - if (npc.ai[2] >= lineUpDistNetUpdate) - { - npc.netUpdate = true; - - if (npc.netSpam > 10) - npc.netSpam = 10; - - npc.ai[3] += 1f; - npc.ai[2] = 0f; - - float maxCharges = death ? (lifeRatio < 0.05f ? 1f : lifeRatio < 0.1f ? 2f : lifeRatio < 0.15f ? 3f : lifeRatio < 0.25f ? 4f : 5f) : lifeRatio < 0.2f ? 4f : 5f; - if (npc.ai[3] >= maxCharges) - { - npc.ai[1] = 0f; - npc.ai[3] = 0f; - } - else - npc.ai[1] = 3f; - } - } - - else if (npc.ai[1] == 5f) - { - float offset = 600f; - float speedBoost = death ? 6f * (0.4f - lifeRatio) : 4f * (0.4f - lifeRatio); - float accelerationBoost = death ? 0.15f * (0.4f - lifeRatio) : 0.1f * (0.4f - lifeRatio); - float hoverSpeed = 8f + speedBoost; - float hoverAcceleration = 0.25f + accelerationBoost; - - Vector2 eyeLineUpChargeDirection = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float lineUpChargeTargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - eyeLineUpChargeDirection.X; - float lineUpChargeTargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) + offset - eyeLineUpChargeDirection.Y; - Vector2 hoverDestination = Main.player[npc.target].Center + Vector2.UnitY * offset; - - bool horizontalCharge = calamityGlobalNPC.newAI[0] == 1f || calamityGlobalNPC.newAI[0] == 3f; - if (horizontalCharge) - { - offset = calamityGlobalNPC.newAI[0] == 1f ? -500f : 500f; - hoverSpeed *= 1.5f; - hoverAcceleration *= 1.5f; - hoverDestination = Main.player[npc.target].Center + Vector2.UnitX * offset; - } - - Vector2 idealHoverVelocity = npc.SafeDirectionTo(hoverDestination) * hoverSpeed; - npc.SimpleFlyMovement(idealHoverVelocity, hoverAcceleration); - - npc.ai[2] += 1f; - - if (npc.ai[2] % 45f == 0f) - { - Vector2 servantSpawnVelocity = Vector2.Normalize(Main.player[npc.target].Center - npc.Center) * 5f; - Vector2 servantSpawnCenter = npc.Center + servantSpawnVelocity * 10f; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int eye = NPC.NewNPC(npc.GetSource_FromAI(), (int)servantSpawnCenter.X, (int)servantSpawnCenter.Y, NPCID.ServantofCthulhu); - Main.npc[eye].velocity.X = servantSpawnVelocity.X; - Main.npc[eye].velocity.Y = servantSpawnVelocity.Y; - - if (Main.netMode == NetmodeID.Server && eye < Main.maxNPCs) - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, eye); - - if (CalamityWorld.LegendaryMode) - { - int type = ProjectileID.BloodNautilusShot; - Vector2 projectileVelocity = servantSpawnVelocity * 2f; - int numProj = 3; - int spread = 20; - float rotation = MathHelper.ToRadians(spread); - for (int i = 0; i < numProj; i++) - { - Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + Vector2.Normalize(perturbedSpeed) * 10f, perturbedSpeed, type, 15, 0f, Main.myPlayer); - } - } - } - - SoundEngine.PlaySound(SoundID.NPCDeath13, npc.position); - - for (int m = 0; m < 10; m++) - Dust.NewDust(servantSpawnCenter, 20, 20, 5, servantSpawnVelocity.X * 0.4f, servantSpawnVelocity.Y * 0.4f, 0, default, 1f); - } - - float timeGateValue = horizontalCharge ? (100f - (death ? 20f * (0.4f - lifeRatio) : 0f)) : (70f - (death ? 15f * (0.4f - lifeRatio) : 0f)); - if (npc.ai[2] >= timeGateValue) - { - switch ((int)calamityGlobalNPC.newAI[0]) - { - case 0: // Normal Eye behavior - npc.ai[1] = 3f; - npc.ai[2] = -1f; - npc.ai[3] = -1f; - break; - case 1: // Charge from the left - npc.ai[1] = 6f; - npc.ai[2] = 0f; - break; - case 2: // Normal Eye behavior - npc.ai[1] = 3f; - npc.ai[2] = -1f; - break; - case 3: // Charge from the right - npc.ai[1] = 6f; - npc.ai[2] = 0f; - break; - default: - break; - } - - npc.TargetClosest(); - calamityGlobalNPC.newAI[0] += 1f; - if (calamityGlobalNPC.newAI[0] > 3f) - calamityGlobalNPC.newAI[0] = 0f; - - npc.SyncExtraAI(); - } - - npc.netUpdate = true; - - if (npc.netSpam > 10) - npc.netSpam = 10; - } - - else if (npc.ai[1] == 6f) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - float speedBoost = death ? 6f * (0.4f - lifeRatio) : 4f * (0.4f - lifeRatio); - float chargeSpeed = 18f + speedBoost; - chargeSpeed += 10f * enrageScale; - npc.velocity = npc.SafeDirectionTo(Main.player[npc.target].Center) * chargeSpeed; - - npc.ai[1] = 7f; - npc.netUpdate = true; - - if (npc.netSpam > 10) - npc.netSpam = 10; - } - } - - else if (npc.ai[1] == 7f) - { - if (npc.ai[2] == 0f) - SoundEngine.PlaySound(SoundID.Roar, npc.position); - - float lineUpDistControl = (float)Math.Round(lineUpDist * 2.5f); - npc.ai[2] += 1f; - - if (npc.ai[2] == lineUpDistControl && Vector2.Distance(npc.position, Main.player[npc.target].position) < 200f) - npc.ai[2] -= 1f; - - if (npc.ai[2] >= lineUpDistControl) - { - npc.velocity *= 0.95f; - if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) - npc.velocity.X = 0f; - if (npc.velocity.Y > -0.1 && npc.velocity.Y < 0.1) - npc.velocity.Y = 0f; - } - else - npc.rotation = npc.velocity.ToRotation() - MathHelper.PiOver2; - - float lineUpDistNetUpdate = lineUpDistControl + 13f; - if (npc.ai[2] >= lineUpDistNetUpdate) - { - npc.netUpdate = true; - - if (npc.netSpam > 10) - npc.netSpam = 10; - - npc.ai[2] = 0f; - npc.ai[1] = 0f; - } - } - } - - return false; - } - } -} diff --git a/NPCs/VanillaNPCOverrides/Bosses/GolemAI.cs b/NPCs/VanillaNPCOverrides/Bosses/GolemAI.cs deleted file mode 100644 index 22d960ce8d..0000000000 --- a/NPCs/VanillaNPCOverrides/Bosses/GolemAI.cs +++ /dev/null @@ -1,1275 +0,0 @@ -using CalamityMod.Events; -using CalamityMod.World; -using Microsoft.Xna.Framework; -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Audio; - -namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses -{ - public static class GolemAI - { - public static bool BuffedGolemAI(NPC npc, Mod mod) - { - CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - - // whoAmI variable - NPC.golemBoss = npc.whoAmI; - - // Percent life remaining - float lifeRatio = npc.life / (float)npc.lifeMax; - - // Phases - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; - bool phase2 = lifeRatio < 0.75f; - bool phase3 = lifeRatio < 0.5f; - bool phase4 = lifeRatio < 0.25f; - - // Spawn parts - if (npc.localAI[0] == 0f && Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[0] = 1f; - NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X - 84, (int)npc.Center.Y - 9, NPCID.GolemFistLeft); - NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X + 78, (int)npc.Center.Y - 9, NPCID.GolemFistRight); - NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X - 3, (int)npc.Center.Y - 57, NPCID.GolemHead); - } - - // Get a target - 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(); - - // Despawn - if (npc.target >= 0 && Main.player[npc.target].dead) - { - npc.TargetClosest(); - if (Main.player[npc.target].dead) - npc.noTileCollide = true; - } - - // Enrage if the target isn't inside the temple - // Turbo enrage if target isn't inside the temple and it's Boss Rush or For the Worthy - bool enrage = true; - bool turboEnrage = false; - if (Main.player[npc.target].Center.Y > Main.worldSurface * 16.0) - { - int targetTilePosX = (int)Main.player[npc.target].Center.X / 16; - int targetTilePosY = (int)Main.player[npc.target].Center.Y / 16; - - Tile tile = Framing.GetTileSafely(targetTilePosX, targetTilePosY); - if (tile.WallType == WallID.LihzahrdBrickUnsafe) - enrage = false; - else - turboEnrage = bossRush || Main.getGoodWorld; - } - else - turboEnrage = bossRush || Main.getGoodWorld; - - if (bossRush || Main.getGoodWorld) - enrage = true; - - npc.Calamity().CurrentlyEnraged = !bossRush && (enrage || turboEnrage); - - bool reduceFallSpeed = npc.velocity.Y > 0f && Collision.SolidCollision(npc.position + Vector2.UnitY * 1.1f * npc.velocity.Y, npc.width, npc.height); - - // Alpha - if (npc.alpha > 0) - { - npc.alpha -= 10; - if (npc.alpha < 0) - npc.alpha = 0; - - npc.ai[1] = 0f; - } - - // Check for body parts - bool headAlive = NPC.AnyNPCs(NPCID.GolemHead); - bool leftFistAlive = NPC.AnyNPCs(NPCID.GolemFistLeft); - bool rightFistAlive = NPC.AnyNPCs(NPCID.GolemFistRight); - npc.dontTakeDamage = (headAlive || leftFistAlive || rightFistAlive) && !CalamityWorld.LegendaryMode; - - // Phase 2, check for free head - bool freedHeadAlive = NPC.AnyNPCs(NPCID.GolemHeadFree); - - // Deactivate torches - if (Main.netMode != NetmodeID.MultiplayerClient && Main.getGoodWorld && npc.velocity.Y > 0f) - { - for (int j = (int)(npc.position.X / 16f); (float)j < (npc.position.X + (float)npc.width) / 16f; j++) - { - for (int k = (int)(npc.position.Y / 16f); (float)k < (npc.position.Y + (float)npc.width) / 16f; k++) - { - if (Main.tile[j, k].TileType == TileID.Torches) - { - Main.tile[j, k].Get().HasTile = false; - if (Main.netMode == NetmodeID.Server) - NetMessage.SendTileSquare(-1, j, k); - } - } - } - } - - // Spawn arm dust - if (!Main.getGoodWorld) - { - if (!leftFistAlive) - { - int lostLeftFistDust = Dust.NewDust(new Vector2(npc.Center.X - 80f, npc.Center.Y - 9f), 8, 8, 31, 0f, 0f, 100, default, 1f); - Dust dust = Main.dust[lostLeftFistDust]; - dust.alpha += Main.rand.Next(100); - dust.velocity *= 0.2f; - dust.velocity.Y -= 0.5f + Main.rand.Next(10) * 0.1f; - dust.fadeIn = 0.5f + Main.rand.Next(10) * 0.1f; - - if (Main.rand.NextBool(10)) - { - lostLeftFistDust = Dust.NewDust(new Vector2(npc.Center.X - 80f, npc.Center.Y - 9f), 8, 8, 6, 0f, 0f, 0, default, 1f); - if (Main.rand.Next(20) != 0) - { - Main.dust[lostLeftFistDust].noGravity = true; - dust = Main.dust[lostLeftFistDust]; - dust.scale *= 1f + Main.rand.Next(10) * 0.1f; - dust.velocity.Y -= 1f; - } - } - } - if (!rightFistAlive) - { - int lostRightFistDust = Dust.NewDust(new Vector2(npc.Center.X + 62f, npc.Center.Y - 9f), 8, 8, 31, 0f, 0f, 100, default, 1f); - Dust dust = Main.dust[lostRightFistDust]; - dust.alpha += Main.rand.Next(100); - dust.velocity *= 0.2f; - dust.velocity.Y -= 0.5f + Main.rand.Next(10) * 0.1f; - dust.fadeIn = 0.5f + Main.rand.Next(10) * 0.1f; - - if (Main.rand.NextBool(10)) - { - lostRightFistDust = Dust.NewDust(new Vector2(npc.Center.X + 62f, npc.Center.Y - 9f), 8, 8, 6, 0f, 0f, 0, default, 1f); - if (Main.rand.Next(20) != 0) - { - Main.dust[lostRightFistDust].noGravity = true; - dust = Main.dust[lostRightFistDust]; - dust.scale *= 1f + Main.rand.Next(10) * 0.1f; - dust.velocity.Y -= 1f; - } - } - } - } - - if (npc.noTileCollide && !Main.player[npc.target].dead) - { - if (npc.velocity.Y > 0f && npc.Bottom.Y > Main.player[npc.target].Top.Y) - npc.noTileCollide = false; - else if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].Center, 1, 1) && !Collision.SolidCollision(npc.position, npc.width, npc.height)) - npc.noTileCollide = false; - } - - // Jump - if (npc.ai[0] == 0f) - { - if (npc.velocity.Y == 0f) - { - // Laser fire when head is dead - if (Main.netMode != NetmodeID.MultiplayerClient && (!headAlive || turboEnrage || CalamityWorld.LegendaryMode)) - { - npc.localAI[1] += 1f; - - float divisor = 15f - - (phase2 ? 4f : 0f) - - (phase3 ? 3f : 0f) - - (phase4 ? 2f : 0f); - - if (enrage) - divisor = 5f; - - if (turboEnrage && Main.getGoodWorld) - divisor = 2f; - - Vector2 projectileFirePos = new Vector2(npc.Center.X, npc.Center.Y - 60f); - if (npc.localAI[1] % divisor == 0f && (Vector2.Distance(Main.player[npc.target].Center, projectileFirePos) > 160f || !freedHeadAlive)) - { - float laserSpeed = turboEnrage ? 12f : enrage ? 9f : 6f; - float laserTargetXDist = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - projectileFirePos.X; - float laserTargetYDist = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - projectileFirePos.Y; - float laserTargetDistance = (float)Math.Sqrt(laserTargetXDist * laserTargetXDist + laserTargetYDist * laserTargetYDist); - - laserTargetDistance = laserSpeed / laserTargetDistance; - laserTargetXDist *= laserTargetDistance; - laserTargetYDist *= laserTargetDistance; - projectileFirePos.X += laserTargetXDist * 3f; - projectileFirePos.Y += laserTargetYDist * 3f; - - int type = ProjectileID.EyeBeam; - int damage = npc.GetProjectileDamage(type); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int bodyLaser = Projectile.NewProjectile(npc.GetSource_FromAI(), projectileFirePos.X, projectileFirePos.Y, laserTargetXDist, laserTargetYDist, type, damage, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[bodyLaser].timeLeft = 480; - if (turboEnrage && Main.getGoodWorld) - Main.projectile[bodyLaser].extraUpdates += 1; - } - } - - if (npc.localAI[1] >= 15f) - npc.localAI[1] = 0f; - } - - // Slow down - npc.velocity.X *= 0.8f; - - // Delay before jumping - npc.ai[1] += 1f; - if (npc.ai[1] > 0f) - { - npc.ai[1] += 1f; - if (Main.getGoodWorld) - npc.ai[1] += 100f; - if (enrage || death) - npc.ai[1] += 18f; - else - { - if (!leftFistAlive) - npc.ai[1] += 6f; - if (!rightFistAlive) - npc.ai[1] += 6f; - if (!headAlive) - npc.ai[1] += 6f; - } - } - if (npc.ai[1] >= 300f) - { - npc.ai[1] = -20f; - npc.frameCounter = 0.0; - } - else if (npc.ai[1] == -1f) - { - // Set jump velocity - npc.TargetClosest(); - - float velocityBoost = death ? 12f * (1f - lifeRatio) : 8f * (1f - lifeRatio); - float velocityX = 4f + velocityBoost; - if (enrage) - velocityX *= 1.5f; - - float playerLocation = npc.Center.X - Main.player[npc.target].Center.X; - npc.direction = playerLocation < 0 ? 1 : -1; - calamityGlobalNPC.newAI[1] = npc.direction; - - npc.velocity.X = velocityX * npc.direction; - - float distanceBelowTarget = npc.position.Y - (Main.player[npc.target].position.Y + 80f); - float speedMult = 1f; - - float multiplier = turboEnrage ? 0.0025f : enrage ? 0.002f : 0.0015f; - if (distanceBelowTarget > 0f && ((!leftFistAlive && !rightFistAlive) || turboEnrage || CalamityWorld.LegendaryMode)) - speedMult += distanceBelowTarget * multiplier; - - float speedMultLimit = turboEnrage ? 3.5f : enrage ? 3f : 2.5f; - if (speedMult > speedMultLimit) - speedMult = speedMultLimit; - - if (Main.player[npc.target].position.Y < npc.Bottom.Y) - npc.velocity.Y = ((((!freedHeadAlive && !headAlive) || turboEnrage || CalamityWorld.LegendaryMode) ? -15.1f : -12.1f) + (enrage ? -4f : 0f)) * speedMult; - else - npc.velocity.Y = 1f; - - npc.noTileCollide = true; - - npc.ai[0] = 1f; - npc.ai[1] = 0f; - - npc.netUpdate = true; - npc.SyncExtraAI(); - } - } - - // Don't run custom gravity when starting a jump - if (npc.ai[0] != 1f) - CustomGravity(); - } - - // Fall down - else if (npc.ai[0] == 1f) - { - if (npc.velocity.Y == 0f) - { - npc.TargetClosest(); - - // Play sound - SoundEngine.PlaySound(SoundID.Item14, npc.position); - - npc.ai[0] = 0f; - calamityGlobalNPC.newAI[1] = 0f; - npc.SyncExtraAI(); - - // Dust and gore - for (int i = (int)npc.position.X - 20; i < (int)npc.position.X + npc.width + 40; i += 20) - { - for (int j = 0; j < 4; j++) - { - int fallDust = Dust.NewDust(new Vector2(npc.position.X - 20f, npc.position.Y + npc.height), npc.width + 20, 4, 31, 0f, 0f, 100, default, 1.5f); - Dust dust = Main.dust[fallDust]; - dust.velocity *= 0.2f; - } - if (Main.netMode != NetmodeID.Server) - { - int fallGore = Gore.NewGore(npc.GetSource_FromAI(), new Vector2(i - 20, npc.position.Y + npc.height - 8f), default, Main.rand.Next(61, 64), 1f); - Gore gore = Main.gore[fallGore]; - gore.velocity *= 0.4f; - } - } - - // Fireball explosion when head is dead - if (Main.netMode != NetmodeID.MultiplayerClient && (!headAlive || turboEnrage || CalamityWorld.LegendaryMode)) - { - for (int i = 0; i < 10; i++) - { - int fiery = Dust.NewDust(npc.position, npc.width, npc.height, DustID.Torch, 0f, 0f, 100, default, 2f); - Main.dust[fiery].velocity.Y *= 6f; - Main.dust[fiery].velocity.X *= 3f; - if (Main.rand.NextBool()) - { - Main.dust[fiery].scale = 0.5f; - Main.dust[fiery].fadeIn = 1f + Main.rand.Next(10) * 0.1f; - } - } - for (int j = 0; j < 20; j++) - { - int fiery2 = Dust.NewDust(npc.position, npc.width, npc.height, DustID.Torch, 0f, 0f, 100, default, 3f); - Main.dust[fiery2].noGravity = true; - Main.dust[fiery2].velocity.Y *= 10f; - fiery2 = Dust.NewDust(npc.position, npc.width, npc.height, DustID.Torch, 0f, 0f, 100, default, 2f); - Main.dust[fiery2].velocity.X *= 2f; - } - - int totalFireballs = 5; - if (turboEnrage && Main.getGoodWorld) - totalFireballs *= 2; - - int spawnX = npc.width / 2; - for (int i = 0; i < totalFireballs; i++) - { - Vector2 spawnVector = new Vector2(npc.Center.X + Main.rand.Next(-spawnX, spawnX), npc.Center.Y + npc.height / 2 * 0.8f); - Vector2 velocity = new Vector2(Main.rand.NextBool() ? Main.rand.Next(4, 6) : Main.rand.Next(-5, -3), Main.rand.Next(-1, 2)); - - if (death) - velocity *= 1.5f; - - if (enrage) - velocity *= 1.25f; - - if (turboEnrage) - velocity *= 1.25f; - - int type = ProjectileID.Fireball; - int damage = npc.GetProjectileDamage(type); - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), spawnVector, velocity, type, damage, 0f, Main.myPlayer); - Main.projectile[proj].timeLeft = 240; - if (turboEnrage && Main.getGoodWorld) - Main.projectile[proj].extraUpdates += 1; - } - - npc.netUpdate = true; - } - } - else - { - // Velocity when falling - if (npc.position.X < Main.player[npc.target].position.X && npc.position.X + npc.width > Main.player[npc.target].position.X + Main.player[npc.target].width) - { - npc.velocity.X *= 0.8f; - - if (npc.Bottom.Y < Main.player[npc.target].position.Y) - { - float fallSpeedBoost = death ? 1.2f * (1f - lifeRatio) : 0.8f * (1f - lifeRatio); - float fallSpeed = 0.2f + fallSpeedBoost; - if (enrage) - fallSpeed *= 1.5f; - - npc.velocity.Y += fallSpeed; - } - } - else - { - float velocityXChange = death ? 0.3f : 0.2f; - if (npc.direction < 0) - npc.velocity.X -= velocityXChange; - else if (npc.direction > 0) - npc.velocity.X += velocityXChange; - - float velocityBoost = death ? 9f * (1f - lifeRatio) : 6f * (1f - lifeRatio); - float velocityXCap = 3f + velocityBoost; - if (enrage) - velocityXCap *= 1.5f; - - float playerLocation = npc.Center.X - Main.player[npc.target].Center.X; - int directionRelativeToTarget = playerLocation < 0 ? 1 : -1; - bool slowDown = directionRelativeToTarget != calamityGlobalNPC.newAI[1]; - - if (slowDown) - velocityXCap *= 0.5f; - - if (npc.velocity.X < -velocityXCap) - npc.velocity.X = -velocityXCap; - if (npc.velocity.X > velocityXCap) - npc.velocity.X = velocityXCap; - } - - CustomGravity(); - } - } - - void CustomGravity() - { - float gravity = turboEnrage ? (Main.getGoodWorld ? 1.2f : 0.9f) : enrage ? 0.6f : (!leftFistAlive && !rightFistAlive) ? 0.45f : 0.3f; - float maxFallSpeed = reduceFallSpeed ? 12f : turboEnrage ? (Main.getGoodWorld ? 40f : 30f) : enrage ? 20f : (!leftFistAlive && !rightFistAlive) ? 15f : 10f; - - npc.velocity.Y += gravity; - if (npc.velocity.Y > maxFallSpeed) - npc.velocity.Y = maxFallSpeed; - } - - // Despawn - int despawnDistance = turboEnrage ? 7500 : enrage ? 6000 : 4500; - if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) + Math.Abs(npc.Center.Y - Main.player[npc.target].Center.Y) > despawnDistance) - { - npc.TargetClosest(); - - if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) + Math.Abs(npc.Center.Y - Main.player[npc.target].Center.Y) > despawnDistance) - { - npc.active = false; - npc.netUpdate = true; - } - } - - return false; - } - - public static bool BuffedGolemFistAI(NPC npc, Mod mod) - { - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; - - // Enrage if the target isn't inside the temple - // Turbo enrage if target isn't inside the temple and it's Boss Rush or For the Worthy - bool enrage = true; - bool turboEnrage = false; - if (Main.player[npc.target].Center.Y > Main.worldSurface * 16.0) - { - int targetTilePosX = (int)Main.player[npc.target].Center.X / 16; - int targetTilePosY = (int)Main.player[npc.target].Center.Y / 16; - - Tile tile = Framing.GetTileSafely(targetTilePosX, targetTilePosY); - if (tile.WallType == WallID.LihzahrdBrickUnsafe) - enrage = false; - else - turboEnrage = bossRush || Main.getGoodWorld; - } - else - turboEnrage = bossRush || Main.getGoodWorld; - - if (bossRush || Main.getGoodWorld) - enrage = true; - - float aggression = turboEnrage ? (Main.getGoodWorld ? 4f : 3f) : enrage ? 2f : death ? 1.5f : 1f; - - if (NPC.golemBoss < 0) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - npc.StrikeInstantKill(); - - return false; - } - - if (npc.alpha > 0) - { - npc.alpha -= 10; - if (npc.alpha < 0) - npc.alpha = 0; - - npc.ai[1] = 0f; - } - - if (npc.ai[0] == 0f) - { - npc.noTileCollide = true; - - float fistSpeed = 25f; - fistSpeed *= (aggression + 3f) / 4f; - - Vector2 fistCenter = new Vector2(npc.Center.X, npc.Center.Y); - float fistXPos = Main.npc[NPC.golemBoss].Center.X - fistCenter.X; - float fistYPos = Main.npc[NPC.golemBoss].Center.Y - fistCenter.Y; - fistYPos -= 9f; - fistXPos = (npc.type != NPCID.GolemFistLeft) ? (fistXPos + 78f) : (fistXPos - 84f); - if (Main.getGoodWorld) - fistXPos = (npc.type != NPCID.GolemFistLeft) ? (fistXPos - 40f) : (fistXPos + 40f); - - float fistRestDistance = (float)Math.Sqrt(fistXPos * fistXPos + fistYPos * fistYPos); - if (fistRestDistance < 12f + fistSpeed) - { - npc.rotation = 0f; - npc.velocity.X = fistXPos; - npc.velocity.Y = fistYPos; - - float fistShootSpeed = aggression; - npc.ai[1] += fistShootSpeed; - if (npc.life < npc.lifeMax / 2) - npc.ai[1] += fistShootSpeed; - if (npc.life < npc.lifeMax / 4) - npc.ai[1] += fistShootSpeed; - - if (npc.ai[1] >= 40f) - { - npc.TargetClosest(); - - if ((npc.type == NPCID.GolemFistLeft && npc.Center.X + 100f > Main.player[npc.target].Center.X) || (npc.type == NPCID.GolemFistRight && npc.Center.X - 100f < Main.player[npc.target].Center.X)) - { - npc.ai[1] = 0f; - npc.ai[0] = 1f; - } - else - npc.ai[1] = 0f; - } - } - else - { - fistRestDistance = fistSpeed / fistRestDistance; - npc.velocity.X = fistXPos * fistRestDistance; - npc.velocity.Y = fistYPos * fistRestDistance; - - npc.rotation = (float)Math.Atan2(0f - npc.velocity.Y, 0f - npc.velocity.X); - if (npc.type == NPCID.GolemFistLeft) - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); - } - } - else if (npc.ai[0] == 1f) - { - Vector2 fistCenter = new Vector2(npc.Center.X, npc.Center.Y); - float fistXPos = Main.npc[NPC.golemBoss].Center.X - fistCenter.X; - float fistYPos = Main.npc[NPC.golemBoss].Center.Y - fistCenter.Y; - fistYPos -= 9f; - fistXPos = (npc.type != NPCID.GolemFistLeft) ? (fistXPos + 78f) : (fistXPos - 84f); - if (Main.getGoodWorld) - fistXPos = (npc.type != NPCID.GolemFistLeft) ? (fistXPos - 40f) : (fistXPos + 40f); - - npc.ai[1] += 1f; - npc.Center = new Vector2(fistXPos, fistYPos); - npc.rotation = 0f; - npc.velocity = Vector2.Zero; - if (npc.ai[1] <= 15f) - { - for (int i = 0; i < 1; i++) - { - Vector2 largeRandDustRadius = Main.rand.NextVector2Circular(80f, 80f); - Vector2 largeRandDustRecoil = largeRandDustRadius * -1f * 0.05f; - Vector2 smallRandDustRadius = Main.rand.NextVector2Circular(20f, 20f); - Dust dust = Dust.NewDustPerfect(npc.Center + largeRandDustRecoil + largeRandDustRadius + smallRandDustRadius, 228, largeRandDustRecoil); - dust.fadeIn = 1.5f; - dust.scale = 0.5f; - if (Main.getGoodWorld) - dust.noLight = true; - - dust.noGravity = true; - } - } - - if (npc.ai[1] >= 30f) - { - npc.noTileCollide = true; - npc.collideX = false; - npc.collideY = false; - - float fistReturnSpeed = 20f; - fistReturnSpeed *= (aggression + 3f) / 4f; - if (fistReturnSpeed > 48f) - fistReturnSpeed = 48f; - - Vector2 fistCent = new Vector2(npc.Center.X, npc.Center.Y); - float fistTargetXDist = Main.player[npc.target].Center.X - fistCent.X; - float fistTargetYDist = Main.player[npc.target].Center.Y - fistCent.Y; - float fistTargetDistance = (float)Math.Sqrt(fistTargetXDist * fistTargetXDist + fistTargetYDist * fistTargetYDist); - fistTargetDistance = fistReturnSpeed / fistTargetDistance; - npc.velocity.X = fistTargetXDist * fistTargetDistance; - npc.velocity.Y = fistTargetYDist * fistTargetDistance; - npc.ai[0] = 2f; - npc.ai[1] = 0f; - - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); - if (npc.type == NPCID.GolemFistLeft) - npc.rotation = (float)Math.Atan2(0f - npc.velocity.Y, 0f - npc.velocity.X); - } - } - else if (npc.ai[0] == 2f) - { - if (Main.netMode != NetmodeID.MultiplayerClient && Main.getGoodWorld) - { - for (int j = (int)(npc.position.X / 16f) - 1; (float)j < (npc.position.X + (float)npc.width) / 16f + 1f; j++) - { - for (int k = (int)(npc.position.Y / 16f) - 1; (float)k < (npc.position.Y + (float)npc.width) / 16f + 1f; k++) - { - if (Main.tile[j, k].TileType == TileID.Torches) - { - Main.tile[j, k].Get().HasTile = false; - if (Main.netMode == NetmodeID.Server) - NetMessage.SendTileSquare(-1, j, k); - } - } - } - } - - npc.ai[1] += 1f; - if (npc.ai[1] == 1f) - SoundEngine.PlaySound(SoundID.Item14, npc.Center); - - if (Main.rand.NextBool()) - { - Vector2 halfVelocityDust = npc.velocity * 0.5f; - Vector2 randDustRadius = Main.rand.NextVector2Circular(20f, 20f); - Dust.NewDustPerfect(npc.Center + halfVelocityDust + randDustRadius, 306, halfVelocityDust, 0, Main.OurFavoriteColor).scale = 2f; - } - - if (Math.Abs(npc.velocity.X) > Math.Abs(npc.velocity.Y)) - { - if (npc.velocity.X > 0f && npc.Center.X > Main.player[npc.target].Center.X) - npc.noTileCollide = false; - - if (npc.velocity.X < 0f && npc.Center.X < Main.player[npc.target].Center.X) - npc.noTileCollide = false; - } - else - { - if (npc.velocity.Y > 0f && npc.Center.Y > Main.player[npc.target].Center.Y) - npc.noTileCollide = false; - - if (npc.velocity.Y < 0f && npc.Center.Y < Main.player[npc.target].Center.Y) - npc.noTileCollide = false; - } - - Vector2 projectileFirePos = new Vector2(npc.Center.X, npc.Center.Y); - float fistGolemDistanceX = Main.npc[NPC.golemBoss].Center.X - projectileFirePos.X; - float fistGolemDistanceY = Main.npc[NPC.golemBoss].Center.Y - projectileFirePos.Y; - fistGolemDistanceX += Main.npc[NPC.golemBoss].velocity.X; - fistGolemDistanceY += Main.npc[NPC.golemBoss].velocity.Y; - fistGolemDistanceY -= 9f; - fistGolemDistanceX = (npc.type != NPCID.GolemFistLeft) ? (fistGolemDistanceX + 78f) : (fistGolemDistanceX - 84f); - float fistGolemDistance = (float)Math.Sqrt(fistGolemDistanceX * fistGolemDistanceX + fistGolemDistanceY * fistGolemDistanceY); - - if (npc.life < npc.lifeMax / 4) - { - npc.knockBackResist = 0f; - - if (fistGolemDistance > 700f || npc.collideX || npc.collideY) - { - npc.noTileCollide = true; - npc.ai[0] = 0f; - } - - return false; - } - - bool leftFistAlive = npc.justHit; - if (leftFistAlive) - { - if (npc.life < npc.lifeMax / 2) - { - if (npc.knockBackResist == 0f) - leftFistAlive = false; - - npc.knockBackResist = 0f; - } - } - - if ((fistGolemDistance > 600f || npc.collideX || npc.collideY) | leftFistAlive) - { - npc.noTileCollide = true; - npc.ai[0] = 0f; - } - } - else - { - if (npc.ai[0] != 3f) - return false; - - npc.noTileCollide = true; - float fistAcceleration = 0.4f; - Vector2 returningFistCenter = new Vector2(npc.Center.X, npc.Center.Y); - float returningTargetX = Main.player[npc.target].Center.X - returningFistCenter.X; - float returningTargetY = Main.player[npc.target].Center.Y - returningFistCenter.Y; - float returningTargetDist = (float)Math.Sqrt(returningTargetX * returningTargetX + returningTargetY * returningTargetY); - returningTargetDist = 12f / returningTargetDist; - returningTargetX *= returningTargetDist; - returningTargetY *= returningTargetDist; - - if (npc.velocity.X < returningTargetX) - { - npc.velocity.X += fistAcceleration; - if (npc.velocity.X < 0f && returningTargetX > 0f) - npc.velocity.X += fistAcceleration * 2f; - } - else if (npc.velocity.X > returningTargetX) - { - npc.velocity.X -= fistAcceleration; - if (npc.velocity.X > 0f && returningTargetX < 0f) - npc.velocity.X -= fistAcceleration * 2f; - } - - if (npc.velocity.Y < returningTargetY) - { - npc.velocity.Y += fistAcceleration; - if (npc.velocity.Y < 0f && returningTargetY > 0f) - npc.velocity.Y += fistAcceleration * 2f; - } - else if (npc.velocity.Y > returningTargetY) - { - npc.velocity.Y -= fistAcceleration; - if (npc.velocity.Y > 0f && returningTargetY < 0f) - npc.velocity.Y -= fistAcceleration * 2f; - } - - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); - if (npc.type == NPCID.GolemFistLeft) - npc.rotation = (float)Math.Atan2(0f - npc.velocity.Y, 0f - npc.velocity.X); - } - - return false; - } - - - public static bool BuffedGolemHeadAI(NPC npc, Mod mod) - { - // Don't collide - npc.noTileCollide = true; - - // Get a target - 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(); - - // Die if body is gone - if (NPC.golemBoss < 0) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - npc.StrikeInstantKill(); - - return false; - } - - // Percent life remaining - float lifeRatio = npc.life / (float)npc.lifeMax; - - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; - - // Count body parts - bool leftFistAlive = NPC.AnyNPCs(NPCID.GolemFistLeft); - bool rightFistAlive = NPC.AnyNPCs(NPCID.GolemFistRight); - npc.dontTakeDamage = (leftFistAlive || rightFistAlive) && !CalamityWorld.LegendaryMode; - - // Stay in position on top of body - npc.Center = Main.npc[NPC.golemBoss].Center - new Vector2(Main.getGoodWorld ? 2f : 3f, Main.getGoodWorld ? 37f : 57f); - - // Enrage if the target isn't inside the temple - bool enrage = true; - bool turboEnrage = false; - if (Main.player[npc.target].Center.Y > Main.worldSurface * 16.0) - { - int targetTilePosX = (int)Main.player[npc.target].Center.X / 16; - int targetTilePosY = (int)Main.player[npc.target].Center.Y / 16; - - Tile tile = Framing.GetTileSafely(targetTilePosX, targetTilePosY); - if (tile.WallType == WallID.LihzahrdBrickUnsafe) - enrage = false; - else - turboEnrage = bossRush || Main.getGoodWorld; - } - else - turboEnrage = bossRush || Main.getGoodWorld; - - if (bossRush || Main.getGoodWorld) - enrage = true; - - // Alpha - if (npc.alpha > 0) - { - npc.alpha -= 10; - if (npc.alpha < 0) - npc.alpha = 0; - - npc.ai[1] = 30f; - } - - // Spit fireballs if arms are alive - if (npc.ai[0] == 0f) - { - npc.ai[1] += 1f; - if (npc.ai[1] < 20f || npc.ai[1] > 130) - npc.localAI[0] = 1f; - else - npc.localAI[0] = 0f; - - if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[1] >= 150) - { - npc.TargetClosest(); - - npc.ai[1] = 0f; - - Vector2 headCent = new Vector2(npc.Center.X, npc.Center.Y + 10f); - float headFireballSpeed = turboEnrage ? 12f : enrage ? 10f : 8f; - float headFireballTargetX = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - headCent.X; - float headFireballTargetY = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - headCent.Y; - float headFireballTargetDist = (float)Math.Sqrt(headFireballTargetX * headFireballTargetX + headFireballTargetY * headFireballTargetY); - - headFireballTargetDist = headFireballSpeed / headFireballTargetDist; - headFireballTargetX *= headFireballTargetDist; - headFireballTargetY *= headFireballTargetDist; - - int type = ProjectileID.Fireball; - int damage = npc.GetProjectileDamage(type); - Projectile.NewProjectile(npc.GetSource_FromAI(), headCent.X, headCent.Y, headFireballTargetX, headFireballTargetY, type, damage, 0f, Main.myPlayer, 0f, 0f); - - npc.netUpdate = true; - } - } - - // Shoot lasers and fireballs if arms are dead - else if (npc.ai[0] == 1f) - { - // Fire projectiles from eye positions - Vector2 projectileFirePos = new Vector2(npc.Center.X, npc.Center.Y + 10f); - if (Main.player[npc.target].Center.X < npc.Center.X - npc.width) - { - npc.localAI[1] = -1f; - projectileFirePos.X -= 40f; - } - else if (Main.player[npc.target].Center.X > npc.Center.X + npc.width) - { - npc.localAI[1] = 1f; - projectileFirePos.X += 40f; - } - else - npc.localAI[1] = 0f; - - // Fireballs - float shootBoost = death ? 3f * (1f - lifeRatio) : 2f * (1f - lifeRatio); - npc.ai[1] += 1f + shootBoost; - - if (npc.ai[1] < 20f || npc.ai[1] > 220) - npc.localAI[0] = 1f; - else - npc.localAI[0] = 0f; - - if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[1] >= 240) - { - npc.TargetClosest(); - - npc.ai[1] = 0f; - - float fireballSpeedFistsDed = turboEnrage ? 16f : enrage ? 14f : 12f; - float fireballFistsDedTargetX = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - projectileFirePos.X; - float fireballFistsDedTargetY = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - projectileFirePos.Y; - float fireballFistsDedTargetDist = (float)Math.Sqrt(fireballFistsDedTargetX * fireballFistsDedTargetX + fireballFistsDedTargetY * fireballFistsDedTargetY); - - fireballFistsDedTargetDist = fireballSpeedFistsDed / fireballFistsDedTargetDist; - fireballFistsDedTargetX *= fireballFistsDedTargetDist; - fireballFistsDedTargetY *= fireballFistsDedTargetDist; - - int type = ProjectileID.Fireball; - int damage = npc.GetProjectileDamage(type); - Projectile.NewProjectile(npc.GetSource_FromAI(), projectileFirePos.X, projectileFirePos.Y, fireballFistsDedTargetX, fireballFistsDedTargetY, type, damage, 0f, Main.myPlayer, 0f, 0f); - - npc.netUpdate = true; - } - - // Lasers - float shootBoost2 = death ? 5f * (1f - lifeRatio) : 3f * (1f - lifeRatio); - npc.ai[2] += 1f + shootBoost2; - if (enrage) - npc.ai[2] += 4f; - if (!Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1)) - npc.ai[2] += 8f; - - if (npc.ai[2] >= 300f) - { - npc.TargetClosest(); - - npc.ai[2] = 0f; - - int projType = ProjectileID.EyeBeam; - int dmg = npc.GetProjectileDamage(projType); - - if (npc.localAI[1] == 0f) - { - for (int i = 0; i < 2; i++) - { - projectileFirePos = new Vector2(npc.Center.X, npc.Center.Y - 22f); - if (i == 0) - projectileFirePos.X -= 18f; - else - projectileFirePos.X += 18f; - - float laserSpeed = 9f; - if (!Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1)) - laserSpeed = 14f; - - float laserTargetXDist = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - projectileFirePos.X; - float laserTargetYDist = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - projectileFirePos.Y; - float laserTargetDistance = (float)Math.Sqrt(laserTargetXDist * laserTargetXDist + laserTargetYDist * laserTargetYDist); - - laserTargetDistance = laserSpeed / laserTargetDistance; - laserTargetXDist *= laserTargetDistance; - laserTargetYDist *= laserTargetDistance; - projectileFirePos.X += laserTargetXDist * 3f; - projectileFirePos.Y += laserTargetYDist * 3f; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int bodyLaser = Projectile.NewProjectile(npc.GetSource_FromAI(), projectileFirePos.X, projectileFirePos.Y, laserTargetXDist, laserTargetYDist, projType, dmg, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[bodyLaser].timeLeft = enrage ? 480 : 300; - if (turboEnrage && Main.getGoodWorld) - Main.projectile[bodyLaser].extraUpdates += 1; - - npc.netUpdate = true; - } - } - } - else if (npc.localAI[1] != 0f) - { - projectileFirePos = new Vector2(npc.Center.X, npc.Center.Y - 22f); - if (npc.localAI[1] == -1f) - projectileFirePos.X -= 30f; - else if (npc.localAI[1] == 1f) - projectileFirePos.X += 30f; - - float extraLaserSpeed = 9f; - if (!Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1)) - extraLaserSpeed = 14f; - - float extraLaserTargetX = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - projectileFirePos.X; - float extraLaserTargetY = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - projectileFirePos.Y; - float extraLaserTargetDist = (float)Math.Sqrt(extraLaserTargetX * extraLaserTargetX + extraLaserTargetY * extraLaserTargetY); - - extraLaserTargetDist = extraLaserSpeed / extraLaserTargetDist; - extraLaserTargetX *= extraLaserTargetDist; - extraLaserTargetY *= extraLaserTargetDist; - projectileFirePos.X += extraLaserTargetX * 3f; - projectileFirePos.Y += extraLaserTargetY * 3f; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int extraLasers = Projectile.NewProjectile(npc.GetSource_FromAI(), projectileFirePos.X, projectileFirePos.Y, extraLaserTargetX, extraLaserTargetY, projType, dmg, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[extraLasers].timeLeft = enrage ? 480 : 300; - if (turboEnrage && Main.getGoodWorld) - Main.projectile[extraLasers].extraUpdates += 1; - - npc.netUpdate = true; - } - } - } - } - - // Laser fire if arms are dead - if ((!leftFistAlive && !rightFistAlive) || death || CalamityWorld.LegendaryMode) - { - npc.ai[0] = 1f; - return false; - } - npc.ai[0] = 0f; - - return false; - } - - public static bool BuffedGolemHeadFreeAI(NPC npc, Mod mod) - { - CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - - // Get a target - 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(); - - // Die if body is gone - if (NPC.golemBoss < 0) - { - calamityGlobalNPC.DR = 0.25f; - calamityGlobalNPC.unbreakableDR = false; - calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = false; - - if (Main.netMode != NetmodeID.MultiplayerClient) - npc.StrikeInstantKill(); - - return false; - } - - // Percent life remaining - float lifeRatio = npc.life / (float)npc.lifeMax; - float golemLifeRatio = Main.npc[NPC.golemBoss].life / (float)Main.npc[NPC.golemBoss].lifeMax; - - // Phases - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; - bool phase2 = lifeRatio < 0.7f || golemLifeRatio < 0.85f; - bool phase3 = lifeRatio < 0.55f || golemLifeRatio < 0.7f; - bool phase4 = lifeRatio < 0.4f || golemLifeRatio < 0.55f; - - // Enrage if the target isn't inside the temple - bool enrage = true; - bool turboEnrage = false; - if (Main.player[npc.target].Center.Y > Main.worldSurface * 16.0) - { - int targetTilePosX = (int)Main.player[npc.target].Center.X / 16; - int targetTilePosY = (int)Main.player[npc.target].Center.Y / 16; - - Tile tile = Framing.GetTileSafely(targetTilePosX, targetTilePosY); - if (tile.WallType == WallID.LihzahrdBrickUnsafe) - enrage = false; - else - turboEnrage = bossRush || Main.getGoodWorld; - } - else - turboEnrage = bossRush || Main.getGoodWorld; - - if (bossRush || Main.getGoodWorld) - enrage = true; - - if (turboEnrage) - { - calamityGlobalNPC.DR = 0.9999f; - calamityGlobalNPC.unbreakableDR = true; - calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = true; - } - - // Float through tiles or not - bool canPassThroughTiles = false; - if (!Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1) || phase3 || turboEnrage) - { - npc.noTileCollide = true; - canPassThroughTiles = true; - } - else - npc.noTileCollide = false; - - // Move to new location - if (npc.ai[3] <= 0f) - { - npc.ai[3] = 300f; - - float maxDistance = 300f; - - // Four corners around target - if (phase3 || turboEnrage) - { - if (calamityGlobalNPC.newAI[1] == -maxDistance) - { - switch ((int)calamityGlobalNPC.newAI[0]) - { - case 0: - case 300: - calamityGlobalNPC.newAI[0] = -maxDistance; - break; - case -300: - calamityGlobalNPC.newAI[1] = maxDistance; - break; - default: - break; - } - } - else - { - switch ((int)calamityGlobalNPC.newAI[0]) - { - case 0: - case -300: - calamityGlobalNPC.newAI[0] = maxDistance; - break; - case 300: - calamityGlobalNPC.newAI[1] = -maxDistance; - break; - default: - break; - } - } - } - - // Above target - else if (phase2) - { - switch ((int)calamityGlobalNPC.newAI[0]) - { - case 0: - calamityGlobalNPC.newAI[0] = maxDistance; - break; - case 300: - calamityGlobalNPC.newAI[0] = -maxDistance; - break; - case -300: - calamityGlobalNPC.newAI[0] = 0f; - break; - default: - break; - } - } - else - { - calamityGlobalNPC.newAI[0] = 0f; - calamityGlobalNPC.newAI[1] = -maxDistance; - } - - npc.netSpam = 5; - npc.SyncExtraAI(); - npc.netUpdate = true; - } - - npc.ai[3] -= 1f + - ((phase2 || turboEnrage) ? 1f : 0f) + - ((phase3 || turboEnrage) ? 1f : 0f) + - ((phase4 || turboEnrage) ? 2f : 0f); - - float offsetX = calamityGlobalNPC.newAI[0]; - float offsetY = calamityGlobalNPC.newAI[1]; - Vector2 destination = Main.player[npc.target].Center + new Vector2(offsetX, offsetY); - - // Velocity and acceleration - float velocity = 7f + - ((phase2 || turboEnrage) ? 4f : 0f) + - ((phase3 || turboEnrage) ? 4f : 0f); - - if (enrage) - velocity = (phase3 || turboEnrage) ? 25f : 20f; - - float acceleration = enrage ? 0.4f : phase3 ? 0.2f : phase2 ? 0.15f : 0.1f; - - // How far is from where it's supposed to be - Vector2 distanceFromDestination = destination - npc.Center; - - CalamityUtils.SmoothMovement(npc, 0f, distanceFromDestination, velocity, acceleration, true); - - if (death && calamityGlobalNPC.newAI[2] < 120f) - { - calamityGlobalNPC.newAI[2] += 1f; - - if (calamityGlobalNPC.newAI[2] % 15f == 0f) - { - npc.netUpdate = true; - npc.SyncExtraAI(); - } - - return false; - } - - // Fireballs - float shootBoost = death ? 3f * (2f - (lifeRatio + golemLifeRatio)) : 2f * (2f - (lifeRatio + golemLifeRatio)); - npc.ai[1] += 1f + shootBoost; - - if (npc.ai[1] < 20f || npc.ai[1] > 340) - npc.localAI[0] = 1f; - else - npc.localAI[0] = 0f; - - if (canPassThroughTiles && !phase3) - npc.ai[1] = 20f; - - if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[1] >= 360 && Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 160f) - { - npc.TargetClosest(); - - npc.ai[1] = 0f; - - Vector2 freeHeadCenter = new Vector2(npc.Center.X, npc.Center.Y - 10f); - float freeHeadSpeed = turboEnrage ? 8f : enrage ? 6.5f : 5f; - float freeHeadTargetX = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - freeHeadCenter.X; - float freeHeadTargetY = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - freeHeadCenter.Y; - float freeHeadTargetDist = (float)Math.Sqrt(freeHeadTargetX * freeHeadTargetX + freeHeadTargetY * freeHeadTargetY); - - freeHeadTargetDist = freeHeadSpeed / freeHeadTargetDist; - freeHeadTargetX *= freeHeadTargetDist; - freeHeadTargetY *= freeHeadTargetDist; - - int projectileType = phase3 ? ProjectileID.InfernoHostileBolt : ProjectileID.Fireball; - int damage = npc.GetProjectileDamage(projectileType); - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), freeHeadCenter.X, freeHeadCenter.Y, freeHeadTargetX, freeHeadTargetY, projectileType, damage, 0f, Main.myPlayer, 0f, 0f); - if (projectileType == ProjectileID.InfernoHostileBolt) - { - Main.projectile[proj].timeLeft = 300; - Main.projectile[proj].ai[0] = Main.player[npc.target].Center.X; - Main.projectile[proj].ai[1] = Main.player[npc.target].Center.Y; - Main.projectile[proj].netUpdate = true; - } - - npc.netUpdate = true; - } - - // Lasers - npc.ai[2] += 1f + shootBoost; - if (!Collision.CanHit(Main.npc[NPC.golemBoss].Center, 1, 1, Main.player[npc.target].Center, 1, 1)) - npc.ai[2] += 8f; - - if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] >= 300f && Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 160f) - { - npc.TargetClosest(); - - npc.ai[2] = 0f; - - for (int i = 0; i < 2; i++) - { - Vector2 freeHeadProjSpawn = new Vector2(npc.Center.X, npc.Center.Y - 50f); - if (Main.getGoodWorld) - freeHeadProjSpawn.Y += 30f; - if (i == 0) - freeHeadProjSpawn.X -= 14f; - else if (i == 1) - freeHeadProjSpawn.X += 14f; - - float freeHeadProjSpeed = 5f + shootBoost; - float freeHeadProjTargetX = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - freeHeadProjSpawn.X; - float freeHeadProjTargetY = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - freeHeadProjSpawn.Y; - float freeHeadProjTargetDist = (float)Math.Sqrt(freeHeadProjTargetX * freeHeadProjTargetX + freeHeadProjTargetY * freeHeadProjTargetY); - - freeHeadProjTargetDist = freeHeadProjSpeed / freeHeadProjTargetDist; - freeHeadProjTargetX *= freeHeadProjTargetDist; - freeHeadProjTargetY *= freeHeadProjTargetDist; - freeHeadProjSpawn.X += freeHeadProjTargetX * 3f; - freeHeadProjSpawn.Y += freeHeadProjTargetY * 3f; - - int type = ProjectileID.EyeBeam; - int damage = npc.GetProjectileDamage(type); - int freeHeadLaser = Projectile.NewProjectile(npc.GetSource_FromAI(), freeHeadProjSpawn.X, freeHeadProjSpawn.Y, freeHeadProjTargetX, freeHeadProjTargetY, type, damage, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[freeHeadLaser].timeLeft = enrage ? 480 : 300; - if (turboEnrage && Main.getGoodWorld) - Main.projectile[freeHeadLaser].extraUpdates += 1; - } - } - - if (!Main.getGoodWorld) - { - npc.position += npc.netOffset; - int randDustOffset = Main.rand.Next(2) * 2 - 1; - Vector2 randDustPos = npc.Bottom + new Vector2((float)(randDustOffset * 22) * npc.scale, -22f * npc.scale); - Dust getGoodDust = Dust.NewDustPerfect(randDustPos, 228, ((float)Math.PI / 2f + -(float)Math.PI / 2f * (float)randDustOffset + Main.rand.NextFloatDirection() * ((float)Math.PI / 4f)).ToRotationVector2() * (2f + Main.rand.NextFloat())); - Dust dust = getGoodDust; - dust.velocity += npc.velocity; - getGoodDust.noGravity = true; - getGoodDust = Dust.NewDustPerfect(npc.Bottom + new Vector2(Main.rand.NextFloatDirection() * 6f * npc.scale, (Main.rand.NextFloat() * -4f - 8f) * npc.scale), 228, Vector2.UnitY * (2f + Main.rand.NextFloat())); - getGoodDust.fadeIn = 0f; - getGoodDust.scale = 0.7f + Main.rand.NextFloat() * 0.5f; - getGoodDust.noGravity = true; - dust = getGoodDust; - dust.velocity += npc.velocity; - npc.position -= npc.netOffset; - } - - return false; - } - } -} diff --git a/NPCs/VanillaNPCOverrides/Bosses/KingSlimeAI.cs b/NPCs/VanillaNPCOverrides/Bosses/KingSlimeAI.cs deleted file mode 100644 index 9956468308..0000000000 --- a/NPCs/VanillaNPCOverrides/Bosses/KingSlimeAI.cs +++ /dev/null @@ -1,488 +0,0 @@ -using CalamityMod.Events; -using CalamityMod.NPCs.NormalNPCs; -using CalamityMod.World; -using Microsoft.Xna.Framework; -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Audio; - -namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses -{ - public static class KingSlimeAI - { - public static bool BuffedKingSlimeAI(NPC npc, Mod mod) - { - // Percent life remaining - float lifeRatio = npc.life / (float)npc.lifeMax; - - // Variables - float teleportScale = 1f; - bool teleporting = false; - bool teleported = false; - npc.aiAction = 0; - float teleportScaleSpeed = 2f; - if (Main.getGoodWorld) - { - teleportScaleSpeed -= 1f - lifeRatio; - teleportScale *= teleportScaleSpeed; - } - - // Reset damage - npc.damage = npc.defDamage; - - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; - - // Get a target - 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(); - - // Phases based on life percentage - bool phase2 = lifeRatio < 0.75f; - bool phase3 = lifeRatio < 0.5f; - - // Spawn crystal in phase 2 - if (phase3 && npc.Calamity().newAI[0] == 0f && Main.netMode != NetmodeID.MultiplayerClient) - { - npc.Calamity().newAI[0] = 1f; - npc.SyncExtraAI(); - Vector2 vector = npc.Center + new Vector2(-40f, -(float)npc.height / 2); - for (int i = 0; i < 20; i++) - { - int rubyDust = Dust.NewDust(vector, npc.width / 2, npc.height / 2, 90, 0f, 0f, 100, default, 2f); - Main.dust[rubyDust].velocity *= 2f; - Main.dust[rubyDust].noGravity = true; - if (Main.rand.NextBool()) - { - Main.dust[rubyDust].scale = 0.5f; - Main.dust[rubyDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; - } - } - SoundEngine.PlaySound(SoundID.Item38, npc.position); - NPC.NewNPC(npc.GetSource_FromAI(), (int)vector.X, (int)vector.Y, ModContent.NPCType()); - } - - // Set up health value for spawning slimes - if (npc.ai[3] == 0f && npc.life > 0) - npc.ai[3] = npc.lifeMax; - - // Spawn with attack delay - if (npc.localAI[3] == 0f && Main.netMode != NetmodeID.MultiplayerClient) - { - npc.ai[0] = -100f; - npc.localAI[3] = 1f; - npc.netUpdate = true; - } - - // Despawn - int despawnDistance = 500; - if (Main.player[npc.target].dead || Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) / 16f > despawnDistance) - { - npc.TargetClosest(); - if (Main.player[npc.target].dead || Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) / 16f > despawnDistance) - { - if (npc.timeLeft > 10) - npc.timeLeft = 10; - - //EncourageDespawn(10); - - if (Main.player[npc.target].Center.X < npc.Center.X) - npc.direction = 1; - else - npc.direction = -1; - } - } - - // Faster fall - if (npc.velocity.Y > 0f) - npc.velocity.Y += bossRush ? 0.1f : death ? 0.05f : 0f; - - // Activate teleport - float teleportGateValue = 480f; - if (!Main.player[npc.target].dead && npc.ai[2] >= teleportGateValue && npc.ai[1] < 5f && npc.velocity.Y == 0f) - { - // Avoid cheap bullshit - npc.damage = 0; - - npc.ai[2] = 0f; - npc.ai[0] = 0f; - npc.ai[1] = 5f; - - if (Main.netMode != NetmodeID.MultiplayerClient) - GetPlaceToTeleportTo(npc); - } - - if (!Collision.CanHitLine(npc.Center, 0, 0, Main.player[npc.target].Center, 0, 0) || Math.Abs(npc.Top.Y - Main.player[npc.target].Bottom.Y) > 160f) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - npc.localAI[0] += 1f; - } - else if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[0] -= 1f; - - if (npc.localAI[0] < 0f) - npc.localAI[0] = 0f; - } - - if (npc.timeLeft < 10 && (npc.ai[0] != 0f || npc.ai[1] != 0f)) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.netUpdate = true; - teleporting = false; - } - - // Get closer to activating teleport - if (npc.ai[2] < teleportGateValue) - { - if (!Collision.CanHitLine(npc.Center, 0, 0, Main.player[npc.target].Center, 0, 0) || Math.Abs(npc.Top.Y - Main.player[npc.target].Bottom.Y) > 320f) - npc.ai[2] += death ? 3f : 2f; - else - npc.ai[2] += 1f; - } - - // Dust variable - Dust dust; - - // Teleport - if (npc.ai[1] == 5f) - { - // Avoid cheap bullshit - npc.damage = 0; - - teleporting = true; - npc.aiAction = 1; - npc.ai[0] += 1f; - teleportScale = MathHelper.Clamp((60f - npc.ai[0]) / 60f, 0f, 1f); - teleportScale = 0.5f + teleportScale * 0.5f; - if (Main.getGoodWorld) - teleportScale *= teleportScaleSpeed; - - if (npc.ai[0] >= 60f) - teleported = true; - - if (npc.ai[0] == 60f && Main.netMode != NetmodeID.Server) - Gore.NewGore(npc.GetSource_FromAI(), npc.Center + new Vector2(-40f, -(float)npc.height / 2), npc.velocity, 734, 1f); - - if (npc.ai[0] >= 60f && Main.netMode != NetmodeID.MultiplayerClient) - { - npc.Bottom = new Vector2(npc.localAI[1], npc.localAI[2]); - npc.ai[1] = 6f; - npc.ai[0] = 0f; - npc.netUpdate = true; - } - - if (Main.netMode == NetmodeID.MultiplayerClient && npc.ai[0] >= 120f) - { - npc.ai[1] = 6f; - npc.ai[0] = 0f; - } - - if (!teleported) - { - for (int i = 0; i < 10; i++) - { - int slimeDust = Dust.NewDust(npc.position + Vector2.UnitX * -20f, npc.width + 40, npc.height, 4, npc.velocity.X, npc.velocity.Y, 150, new Color(78, 136, 255, 80), 2f); - Main.dust[slimeDust].noGravity = true; - dust = Main.dust[slimeDust]; - dust.velocity *= 0.5f; - } - } - } - - // Post-teleport - else if (npc.ai[1] == 6f) - { - // Avoid cheap bullshit - npc.damage = 0; - - teleporting = true; - npc.aiAction = 0; - npc.ai[0] += 1f; - teleportScale = MathHelper.Clamp(npc.ai[0] / 30f, 0f, 1f); - teleportScale = 0.5f + teleportScale * 0.5f; - if (Main.getGoodWorld) - teleportScale *= teleportScaleSpeed; - - if (npc.ai[0] >= 30f && Main.netMode != NetmodeID.MultiplayerClient) - { - npc.ai[1] = 0f; - npc.ai[0] = 0f; - npc.netUpdate = true; - npc.TargetClosest(); - } - - if (Main.netMode == NetmodeID.MultiplayerClient && npc.ai[0] >= 60f) - { - npc.ai[1] = 0f; - npc.ai[0] = 0f; - npc.TargetClosest(); - } - - for (int j = 0; j < 10; j++) - { - int slimyDust = Dust.NewDust(npc.position + Vector2.UnitX * -20f, npc.width + 40, npc.height, 4, npc.velocity.X, npc.velocity.Y, 150, new Color(78, 136, 255, 80), 2f); - Main.dust[slimyDust].noGravity = true; - dust = Main.dust[slimyDust]; - dust.velocity *= 2f; - } - } - - // Don't take damage while teleporting - npc.dontTakeDamage = npc.hide = teleported; - - npc.noTileCollide = false; - - // Jump - if (npc.velocity.Y == 0f) - { - npc.velocity.X *= 0.8f; - if (npc.velocity.X > -0.1f && npc.velocity.X < 0.1f) - npc.velocity.X = 0f; - - if (!teleporting) - { - npc.ai[0] += 2f; - if (bossRush) - { - npc.ai[0] += 9f; - } - else - { - if (lifeRatio < 0.8f) - npc.ai[0] += 1f; - if (lifeRatio < 0.6f) - npc.ai[0] += 1f; - if (lifeRatio < 0.4f) - npc.ai[0] += 2f; - } - if (lifeRatio < 0.2f) - npc.ai[0] += 3f; - if (lifeRatio < 0.1f) - npc.ai[0] += 4f; - - if (npc.ai[0] >= 0f) - { - npc.netUpdate = true; - npc.TargetClosest(); - - float distanceBelowTarget = npc.position.Y - (Main.player[npc.target].position.Y + 80f); - float speedMult = 1f; - if (distanceBelowTarget > 0f) - speedMult += distanceBelowTarget * 0.002f; - - if (speedMult > 2f) - speedMult = 2f; - - // Jump type - float jumpSpeedMult = 1.5f; - if (npc.ai[1] == 3f) - { - npc.velocity.Y = -13f * speedMult; - npc.velocity.X += (phase2 ? (death ? 5.5f : 4.5f) : 3.5f) * npc.direction; - if (bossRush) - npc.velocity.X *= jumpSpeedMult; - - npc.ai[0] = -200f; - npc.ai[1] = 0f; - } - else if (npc.ai[1] == 2f) - { - npc.velocity.Y = -6f * speedMult; - npc.velocity.X += (phase2 ? (death ? 6.5f : 5.5f) : 4.5f) * npc.direction; - if (bossRush) - npc.velocity.X *= jumpSpeedMult; - - npc.ai[0] = -120f; - npc.ai[1] += 1f; - } - else - { - npc.velocity.Y = -8f * speedMult; - npc.velocity.X += (phase2 ? (death ? 6f : 5f) : 4f) * npc.direction; - if (bossRush) - npc.velocity.X *= jumpSpeedMult; - - npc.ai[0] = -120f; - npc.ai[1] += 1f; - } - - npc.noTileCollide = true; - } - else if (npc.ai[0] >= -30f) - npc.aiAction = 1; - } - } - - // Change jump velocity - else if (npc.target < Main.maxPlayers) - { - float jumpVelocityMult = 3f; - if (Main.getGoodWorld) - jumpVelocityMult = 6f; - - if ((npc.direction == 1 && npc.velocity.X < jumpVelocityMult) || (npc.direction == -1 && npc.velocity.X > 0f - jumpVelocityMult)) - { - if ((npc.direction == -1 && npc.velocity.X < 0.1) || (npc.direction == 1 && npc.velocity.X > -0.1)) - npc.velocity.X += (bossRush ? 0.4f : death ? 0.25f : 0.2f) * npc.direction; - else - npc.velocity.X *= bossRush ? 0.9f : death ? 0.92f : 0.93f; - } - - if (!Main.player[npc.target].dead) - { - if (npc.velocity.Y > 0f && npc.Bottom.Y > Main.player[npc.target].Top.Y) - npc.noTileCollide = false; - else if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].Center, 1, 1) && !Collision.SolidCollision(npc.position, npc.width, npc.height)) - npc.noTileCollide = false; - else - npc.noTileCollide = true; - } - } - - // Spawn dust - int idleSlimeDust = Dust.NewDust(npc.position, npc.width, npc.height, 4, npc.velocity.X, npc.velocity.Y, 255, new Color(0, 80, 255, 80), npc.scale * 1.2f); - Main.dust[idleSlimeDust].noGravity = true; - dust = Main.dust[idleSlimeDust]; - dust.velocity *= 0.5f; - - if (npc.life <= 0) - return false; - - // Adjust size based on HP - float maxScale = death ? (Main.getGoodWorld ? 6f : 3f) : (Main.getGoodWorld ? 3f : 1.25f); - float minScale = 0.75f; - lifeRatio = lifeRatio * (maxScale - minScale) + minScale; - lifeRatio *= teleportScale; - if (lifeRatio != npc.scale) - { - npc.position.X += npc.width / 2; - npc.position.Y += npc.height; - npc.scale = lifeRatio; - npc.width = (int)(98f * npc.scale); - npc.height = (int)(92f * npc.scale); - npc.position.X -= npc.width / 2; - npc.position.Y -= npc.height; - } - - // Slime spawning - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int slimeSpawnThreshold = (int)(npc.lifeMax * 0.05); - if (npc.life + slimeSpawnThreshold < npc.ai[3]) - { - npc.ai[3] = npc.life; - int slimeAmt = Main.rand.Next(2, 4); - for (int i = 0; i < slimeAmt; i++) - { - 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 random = phase2 ? 10 : 8; - int npcType = death ? Main.rand.Next(4) + 6 : Main.rand.Next(random); - switch (npcType) - { - case 0: - npcType = NPCID.BlueSlime; - break; - case 1: - npcType = NPCID.YellowSlime; - break; - case 2: - npcType = NPCID.RedSlime; - break; - case 3: - npcType = NPCID.PurpleSlime; - break; - case 4: - npcType = NPCID.GreenSlime; - break; - case 5: - npcType = NPCID.IceSlime; - break; - case 6: - case 7: - case 8: - case 9: - npcType = NPCID.SlimeSpiked; - break; - default: - break; - } - - if ((Main.raining || bossRush) && Main.rand.NextBool(10)) - { - npcType = NPCID.UmbrellaSlime; - - if (Main.rand.NextBool(5) && Main.hardMode) - npcType = NPCID.RainbowSlime; - } - - if (Main.rand.NextBool(100)) - npcType = NPCID.Pinky; - - if (CalamityWorld.LegendaryMode) - npcType = NPCID.RainbowSlime; - - int slimeSpawns = NPC.NewNPC(npc.GetSource_FromAI(), x, y, npcType); - Main.npc[slimeSpawns].SetDefaults(npcType); - Main.npc[slimeSpawns].velocity.X = Main.rand.Next(-15, 16) * 0.1f; - Main.npc[slimeSpawns].velocity.Y = Main.rand.Next(-30, 1) * 0.1f; - Main.npc[slimeSpawns].ai[0] = -1000 * Main.rand.Next(3); - Main.npc[slimeSpawns].ai[1] = 0f; - - if (Main.netMode == NetmodeID.Server && slimeSpawns < Main.maxNPCs) - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, slimeSpawns, 0f, 0f, 0f, 0, 0, 0); - } - } - } - return false; - } - - public static void GetPlaceToTeleportTo(NPC npc) - { - 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 randomPredictiveTeleportOffset = 5; - int teleportTries = 0; - while (teleportTries < 100) - { - teleportTries++; - int teleportTileX = Main.rand.Next(predictiveTeleportPoint.X - randomPredictiveTeleportOffset, predictiveTeleportPoint.X + randomPredictiveTeleportOffset + 1); - int teleportTileY = Main.rand.Next(predictiveTeleportPoint.Y - randomPredictiveTeleportOffset, predictiveTeleportPoint.Y); - - if (!Main.tile[teleportTileX, teleportTileY].HasUnactuatedTile) - { - bool canTeleportToTile = true; - if (canTeleportToTile && Main.tile[teleportTileX, teleportTileY].LiquidType == LiquidID.Lava) - canTeleportToTile = false; - if (canTeleportToTile && !Collision.CanHitLine(npc.Center, 0, 0, vectorAimedAheadOfTarget, 0, 0)) - canTeleportToTile = false; - - if (canTeleportToTile) - { - npc.localAI[1] = teleportTileX * 16 + 8; - npc.localAI[2] = teleportTileY * 16 + 16; - break; - } - } - } - - // Default teleport if the above conditions aren't met in 100 iterations - if (teleportTries >= 100) - { - Vector2 bottom = Main.player[Player.FindClosest(npc.position, npc.width, npc.height)].Bottom; - npc.localAI[1] = bottom.X; - npc.localAI[2] = bottom.Y; - } - } - } -} diff --git a/NPCs/VanillaNPCOverrides/Bosses/QueenBeeAI.cs b/NPCs/VanillaNPCOverrides/Bosses/QueenBeeAI.cs deleted file mode 100644 index ef2300c683..0000000000 --- a/NPCs/VanillaNPCOverrides/Bosses/QueenBeeAI.cs +++ /dev/null @@ -1,697 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; -using CalamityMod.Events; -using CalamityMod.World; -using Microsoft.Xna.Framework; -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Audio; -using CalamityMod.NPCs.PlagueEnemies; -using CalamityMod.Projectiles.Boss; - -namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses -{ - public static class QueenBeeAI - { - public static bool BuffedQueenBeeAI(NPC npc, Mod mod) - { - CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - - // Get a target - 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(); - - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; - - bool enrage = true; - int targetTileX = (int)Main.player[npc.target].Center.X / 16; - int targetTileY = (int)Main.player[npc.target].Center.Y / 16; - - Tile tile = Framing.GetTileSafely(targetTileX, targetTileY); - if (tile.WallType == WallID.HiveUnsafe) - enrage = false; - - float enrageScale = death ? 0.25f : 0f; - if (((npc.position.Y / 16f) < Main.worldSurface && enrage) || bossRush) - { - npc.Calamity().CurrentlyEnraged = !bossRush; - enrageScale += 0.5f; - } - if (!Main.player[npc.target].ZoneJungle || bossRush) - { - npc.Calamity().CurrentlyEnraged = !bossRush; - enrageScale += 0.5f; - } - - if (enrageScale > 1f) - enrageScale = 1f; - - if (Main.getGoodWorld) - enrageScale += ((CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 1f : 0.5f); - - if (bossRush) - enrageScale = 2f; - - // Percent life remaining - float lifeRatio = npc.life / (float)npc.lifeMax; - - // Phases - bool phase2 = lifeRatio < 0.75f; - bool phase3 = lifeRatio < 0.5f; - bool phase4 = lifeRatio < 0.25f; - bool phase5 = lifeRatio < 0.1f; - - // Despawn - float distanceFromTarget = Vector2.Distance(npc.Center, Main.player[npc.target].Center); - if (npc.ai[0] != 5f) - { - if (npc.timeLeft < 60) - npc.timeLeft = 60; - if (distanceFromTarget > 3000f) - npc.ai[0] = 4f; - } - if (Main.player[npc.target].dead) - npc.ai[0] = 5f; - - // Adjust slowing debuff immunity - bool immuneToSlowingDebuffs = npc.ai[0] == 0f; - npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - npc.buffImmune[BuffID.Slow] = immuneToSlowingDebuffs; - npc.buffImmune[BuffID.Webbed] = immuneToSlowingDebuffs; - - // Always start in enemy spawning phase - if (calamityGlobalNPC.newAI[3] == 0f) - { - calamityGlobalNPC.newAI[3] = 1f; - npc.ai[0] = 2f; - npc.netUpdate = true; - npc.SyncExtraAI(); - } - - if (npc.ai[0] == 5f) - { - npc.velocity.Y *= 0.98f; - - if (npc.velocity.X < 0f) - npc.direction = -1; - else - npc.direction = 1; - - npc.spriteDirection = npc.direction; - - if (npc.position.X < (Main.maxTilesX * 8)) - { - if (npc.velocity.X > 0f) - npc.velocity.X *= 0.98f; - else - npc.localAI[0] = 1f; - - npc.velocity.X -= 0.08f; - } - else - { - if (npc.velocity.X < 0f) - npc.velocity.X *= 0.98f; - else - npc.localAI[0] = 1f; - - npc.velocity.X += 0.08f; - } - - if (npc.timeLeft > 10) - npc.timeLeft = 10; - } - - // Pick a random phase - else if (npc.ai[0] == -1f) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int phase; - do phase = Main.rand.Next(4); - while (phase == npc.ai[1] || phase == 1); - - npc.TargetClosest(); - npc.ai[0] = phase; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - } - - // Charging phase - else if (npc.ai[0] == 0f) - { - // Number of charges - int chargeAmt = (int)Math.Ceiling(2f + enrageScale); - if (phase4) - chargeAmt++; - - // Switch to a random phase if chargeAmt has been exceeded - if (npc.ai[1] > (2 * chargeAmt) && npc.ai[1] % 2f == 0f) - { - npc.ai[0] = -1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.netUpdate = true; - return false; - } - - // Charge velocity - float speed = 16f; - if (phase2) - speed += 2f; - if (phase3) - speed += 2f; - if (phase4) - speed += 2f; - if (phase5) - speed += 2f; - - speed += 8f * enrageScale; - - // Line up and initiate charge - if (npc.ai[1] % 2f == 0f) - { - // Initiate charge - float chargeDistance = 20f; - chargeDistance += 20f * enrageScale; - if (Math.Abs(npc.position.Y + (npc.height / 2) - (Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2))) < chargeDistance) - { - // Set AI variables and speed - npc.localAI[0] = 1f; - npc.ai[1] += 1f; - npc.ai[2] = 0f; - - // Get target location - Vector2 beeLocation = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float targetXDist = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - beeLocation.X; - float targetYDist = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - beeLocation.Y; - float targetDistance = (float)Math.Sqrt(targetXDist * targetXDist + targetYDist * targetYDist); - targetDistance = speed / targetDistance; - npc.velocity.X = targetXDist * targetDistance; - npc.velocity.Y = targetYDist * targetDistance; - - // Face the correct direction and play charge sound - float playerLocation = npc.Center.X - Main.player[npc.target].Center.X; - npc.direction = playerLocation < 0 ? 1 : -1; - npc.spriteDirection = npc.direction; - - SoundEngine.PlaySound(SoundID.Zombie125, npc.Center); - return false; - } - - // Velocity variables - npc.localAI[0] = 0f; - float chargeVelocity = 12f; - float chargeAcceleration = 0.15f; - if (phase2) - { - chargeVelocity += 1.5f; - chargeAcceleration += 0.0625f; - } - if (phase3) - { - chargeVelocity += 1.5f; - chargeAcceleration += 0.0625f; - } - if (phase4) - { - chargeVelocity += 1.5f; - chargeAcceleration += 0.0625f; - } - if (phase5) - { - chargeVelocity += 1.5f; - chargeAcceleration += 0.0625f; - } - chargeVelocity += 3f * enrageScale; - chargeAcceleration += 0.5f * enrageScale; - - // Velocity calculations - if (npc.position.Y + (npc.height / 2) < Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2)) - npc.velocity.Y += chargeAcceleration; - else - npc.velocity.Y -= chargeAcceleration; - - if (npc.velocity.Y < -chargeVelocity) - npc.velocity.Y = -chargeVelocity; - if (npc.velocity.Y > chargeVelocity) - npc.velocity.Y = chargeVelocity; - - if (Math.Abs(npc.position.X + (npc.width / 2) - (Main.player[npc.target].position.X + (Main.player[npc.target].width / 2))) > 500f) - npc.velocity.X += chargeAcceleration * npc.direction; - else if (Math.Abs(npc.position.X + (npc.width / 2) - (Main.player[npc.target].position.X + (Main.player[npc.target].width / 2))) < 300f) - npc.velocity.X -= chargeAcceleration * npc.direction; - else - npc.velocity.X *= 0.8f; - - // Limit velocity - if (npc.velocity.X < -chargeVelocity) - npc.velocity.X = -chargeVelocity; - if (npc.velocity.X > chargeVelocity) - npc.velocity.X = chargeVelocity; - - // Face the correct direction - float playerLocation2 = npc.Center.X - Main.player[npc.target].Center.X; - npc.direction = playerLocation2 < 0 ? 1 : -1; - npc.spriteDirection = npc.direction; - - npc.netUpdate = true; - - if (npc.netSpam > 10) - npc.netSpam = 10; - } - else - { - // Face the correct direction - if (npc.velocity.X < 0f) - npc.direction = -1; - else - npc.direction = 1; - - npc.spriteDirection = npc.direction; - - // Charging distance from player - int chargingDistance = 450; - if (phase4) - chargingDistance = 350; - else if (phase2) - chargingDistance = 400; - chargingDistance -= (int)(100f * enrageScale); - - // Get which side of the player the boss is on - int chargeDirection = 1; - if (npc.position.X + (npc.width / 2) < Main.player[npc.target].position.X + (Main.player[npc.target].width / 2)) - chargeDirection = -1; - - // If boss is in correct position, slow down, if not, reset - bool shouldCharge = false; - if (npc.direction == chargeDirection && Math.Abs(npc.position.X + (npc.width / 2) - (Main.player[npc.target].position.X + (Main.player[npc.target].width / 2))) > chargingDistance) - { - npc.ai[2] = 1f; - shouldCharge = true; - } - if (Math.Abs(npc.Center.Y - Main.player[npc.target].Center.Y) > chargingDistance * 1.5f) - { - npc.ai[2] = 1f; - shouldCharge = true; - } - if (enrageScale > 0f && shouldCharge) - npc.velocity *= 0.5f; - - // Keep moving - if (npc.ai[2] != 1f) - { - // Velocity fix if Queen Bee is slowed - if (npc.velocity.Length() < speed) - npc.velocity.X = speed * npc.direction; - - calamityGlobalNPC.newAI[0] += 1f; - if (calamityGlobalNPC.newAI[0] > 90f) - { - npc.SyncExtraAI(); - npc.velocity.X *= 1.01f; - } - - npc.localAI[0] = 1f; - return false; - } - - float playerLocation = npc.Center.X - Main.player[npc.target].Center.X; - npc.direction = playerLocation < 0 ? 1 : -1; - npc.spriteDirection = npc.direction; - - // Slow down - npc.localAI[0] = 0f; - npc.velocity *= 0.9f; - - float chargeDeceleration = 0.1f; - if (phase3) - { - npc.velocity *= 0.9f; - chargeDeceleration += 0.05f; - } - if (phase4) - { - npc.velocity *= 0.9f; - chargeDeceleration += 0.05f; - } - if (phase5) - { - npc.velocity *= 0.9f; - chargeDeceleration += 0.05f; - } - if (enrageScale > 0f) - npc.velocity *= 0.7f; - - if (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) < chargeDeceleration) - { - npc.ai[2] = 0f; - npc.ai[1] += 1f; - calamityGlobalNPC.newAI[0] = 0f; - npc.SyncExtraAI(); - } - - npc.netUpdate = true; - - if (npc.netSpam > 10) - npc.netSpam = 10; - } - } - - // Fly above target before bee spawning phase - else if (npc.ai[0] == 2f) - { - float playerLocation = npc.Center.X - Main.player[npc.target].Center.X; - npc.direction = playerLocation < 0 ? 1 : -1; - npc.spriteDirection = npc.direction; - - // Get target location - float beeAttackAccel = 0.1f; - Vector2 beeAttackPosition = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float beeAttackTargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - beeAttackPosition.X; - float beeAttackTargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - 200f - beeAttackPosition.Y; - float beeAttackTargetDist = (float)Math.Sqrt(beeAttackTargetX * beeAttackTargetX + beeAttackTargetY * beeAttackTargetY); - - // Go to bee spawn phase - calamityGlobalNPC.newAI[0] += 1f; - if (beeAttackTargetDist < (death ? 400f : 300f) || calamityGlobalNPC.newAI[0] >= 180f) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - calamityGlobalNPC.newAI[0] = 0f; - npc.netUpdate = true; - npc.SyncExtraAI(); - return false; - } - - // Velocity calculations - if (npc.velocity.X < beeAttackTargetX) - { - npc.velocity.X += beeAttackAccel; - if (npc.velocity.X < 0f && beeAttackTargetX > 0f) - npc.velocity.X += beeAttackAccel; - } - else if (npc.velocity.X > beeAttackTargetX) - { - npc.velocity.X -= beeAttackAccel; - if (npc.velocity.X > 0f && beeAttackTargetX < 0f) - npc.velocity.X -= beeAttackAccel; - } - if (npc.velocity.Y < beeAttackTargetY) - { - npc.velocity.Y += beeAttackAccel; - if (npc.velocity.Y < 0f && beeAttackTargetY > 0f) - npc.velocity.Y += beeAttackAccel; - } - else if (npc.velocity.Y > beeAttackTargetY) - { - npc.velocity.Y -= beeAttackAccel; - if (npc.velocity.Y > 0f && beeAttackTargetY < 0f) - npc.velocity.Y -= beeAttackAccel; - } - } - - // Bee spawn phase - else if (npc.ai[0] == 1f) - { - npc.localAI[0] = 0f; - - // Get target location and spawn bees from ass - Vector2 beeSpawnLocation = new Vector2(npc.position.X + (npc.width / 2) + (Main.rand.Next(20) * npc.direction), npc.position.Y + npc.height * 0.8f); - Vector2 queenBeeLocation = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float beeSpawnTargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - queenBeeLocation.X; - float beeSpawnTargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - queenBeeLocation.Y; - float beeSpawnTargetDist = (float)Math.Sqrt(beeSpawnTargetX * beeSpawnTargetX + beeSpawnTargetY * beeSpawnTargetY); - - // Bee spawn timer - npc.ai[1] += 1f; - int beeSpawnTimer = 0; - for (int i = 0; i < 255; i++) - { - if (Main.player[i].active && !Main.player[i].dead && (npc.Center - Main.player[i].Center).Length() < 1000f) - beeSpawnTimer++; - } - npc.ai[1] += beeSpawnTimer / 2; - if (phase2) - npc.ai[1] += 0.25f; - if (phase3) - npc.ai[1] += 0.25f; - if (phase4) - npc.ai[1] += 0.25f; - if (phase5) - npc.ai[1] += 0.25f; - - bool spawnBee = false; - float beeSpawnCheck = 15f - 12f * enrageScale; - if (npc.ai[1] > beeSpawnCheck) - { - npc.ai[1] = 0f; - npc.ai[2] += 1f; - spawnBee = true; - } - - // Spawn bees or hornets - if (Collision.CanHit(beeSpawnLocation, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && spawnBee) - { - SoundEngine.PlaySound(SoundID.NPCHit1, npc.Center); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int spawnType = phase3 ? NPCID.Bee : Main.rand.Next(NPCID.Bee, NPCID.BeeSmall + 1); - if (Main.zenithWorld) - { - if (phase3) - spawnType = Main.rand.NextBool(3) ? ModContent.NPCType() : ModContent.NPCType(); - else - spawnType = NPCID.Hellbat; - } - - int spawn = NPC.NewNPC(npc.GetSource_FromAI(), (int)beeSpawnLocation.X, (int)beeSpawnLocation.Y, spawnType); - Main.npc[spawn].velocity = Main.player[npc.target].Center - npc.Center; - Main.npc[spawn].velocity.Normalize(); - Main.npc[spawn].velocity *= 5f; - if (!Main.zenithWorld) - Main.npc[spawn].localAI[0] = 60f; - Main.npc[spawn].netUpdate = true; - } - } - - // Velocity calculations if target is too far away - if (beeSpawnTargetDist > 400f || !Collision.CanHit(new Vector2(beeSpawnLocation.X, beeSpawnLocation.Y - 30f), 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - float beeAttackHoverSpeed = 14f; - float beeAttackHoverAccel = 0.1f; - queenBeeLocation = beeSpawnLocation; - beeSpawnTargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - queenBeeLocation.X; - beeSpawnTargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - queenBeeLocation.Y; - beeSpawnTargetDist = (float)Math.Sqrt(beeSpawnTargetX * beeSpawnTargetX + beeSpawnTargetY * beeSpawnTargetY); - beeSpawnTargetDist = beeAttackHoverSpeed / beeSpawnTargetDist; - - if (npc.velocity.X < beeSpawnTargetX) - { - npc.velocity.X += beeAttackHoverAccel; - if (npc.velocity.X < 0f && beeSpawnTargetX > 0f) - npc.velocity.X += beeAttackHoverAccel; - } - else if (npc.velocity.X > beeSpawnTargetX) - { - npc.velocity.X -= beeAttackHoverAccel; - if (npc.velocity.X > 0f && beeSpawnTargetX < 0f) - npc.velocity.X -= beeAttackHoverAccel; - } - if (npc.velocity.Y < beeSpawnTargetY) - { - npc.velocity.Y += beeAttackHoverAccel; - if (npc.velocity.Y < 0f && beeSpawnTargetY > 0f) - npc.velocity.Y += beeAttackHoverAccel; - } - else if (npc.velocity.Y > beeSpawnTargetY) - { - npc.velocity.Y -= beeAttackHoverAccel; - if (npc.velocity.Y > 0f && beeSpawnTargetY < 0f) - npc.velocity.Y -= beeAttackHoverAccel; - } - } - else - npc.velocity *= 0.9f; - - // Face the correct direction - float playerLocation = npc.Center.X - Main.player[npc.target].Center.X; - npc.direction = playerLocation < 0 ? 1 : -1; - npc.spriteDirection = npc.direction; - - // Go to a random phase - if (npc.ai[2] > 3f) - { - npc.ai[0] = -1f; - npc.ai[1] = 2f; - npc.ai[2] = 0f; - npc.netUpdate = true; - } - } - - // Stinger phase - else if (npc.ai[0] == 3f) - { - // Get target location and shoot from ass - Vector2 stingerSpawnLocation = new Vector2(npc.position.X + (npc.width / 2) + (Main.rand.Next(20) * npc.direction), npc.position.Y + npc.height * 0.8f); - Vector2 stingerQueenBeeLocation = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float stingerAttackTargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - stingerQueenBeeLocation.X; - float stingerAttackTargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - 300f - stingerQueenBeeLocation.Y; - float stingerAttackTargetDist = (float)Math.Sqrt(stingerAttackTargetX * stingerAttackTargetX + stingerAttackTargetY * stingerAttackTargetY); - - npc.ai[1] += 1f; - int stingerAttackTimer = phase4 ? 15 : phase3 ? 20 : phase2 ? 25 : 30; - stingerAttackTimer -= (int)Math.Ceiling(5f * enrageScale); - if (stingerAttackTimer < 3) - stingerAttackTimer = 3; - - // Fire stingers - if (npc.ai[1] % stingerAttackTimer == (stingerAttackTimer - 1) && npc.position.Y + npc.height < Main.player[npc.target].position.Y && Collision.CanHit(stingerSpawnLocation, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - SoundEngine.PlaySound(SoundID.Item17, npc.position); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - float stingerSpeed = 5f; - if (phase3) - stingerSpeed += 1f; - stingerSpeed += 2f * enrageScale; - - float stingerTargetX = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - stingerSpawnLocation.X; - float stingerTargetY = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - stingerSpawnLocation.Y; - float stingerTargetDist = (float)Math.Sqrt(stingerTargetX * stingerTargetX + stingerTargetY * stingerTargetY); - stingerTargetDist = stingerSpeed / stingerTargetDist; - stingerTargetX *= stingerTargetDist; - stingerTargetY *= stingerTargetDist; - int type = Main.zenithWorld ? (phase3 ? ModContent.ProjectileType() : ProjectileID.FlamingWood) : ProjectileID.QueenBeeStinger; - int projectile = Projectile.NewProjectile(npc.GetSource_FromAI(), stingerSpawnLocation.X, stingerSpawnLocation.Y, stingerTargetX, stingerTargetY, type, Main.zenithWorld ? 25 : npc.GetProjectileDamage(type), 0f, Main.myPlayer, 0f, (Main.zenithWorld && phase3) ? Main.player[npc.target].position.Y : 0f); - Main.projectile[projectile].timeLeft = 600; - Main.projectile[projectile].extraUpdates = 1; - } - } - - // Movement calculations - float stingerAttackAccel = 0.075f; - stingerAttackAccel += 0.2f * enrageScale; - if (!Collision.CanHit(new Vector2(stingerSpawnLocation.X, stingerSpawnLocation.Y - 30f), 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - stingerAttackAccel = 0.1f; - if (enrageScale > 0f) - stingerAttackAccel = 0.5f; - - stingerQueenBeeLocation = stingerSpawnLocation; - stingerAttackTargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - stingerQueenBeeLocation.X; - stingerAttackTargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - stingerQueenBeeLocation.Y; - - if (npc.velocity.X < stingerAttackTargetX) - { - npc.velocity.X += stingerAttackAccel; - if (npc.velocity.X < 0f && stingerAttackTargetX > 0f) - npc.velocity.X += stingerAttackAccel; - } - else if (npc.velocity.X > stingerAttackTargetX) - { - npc.velocity.X -= stingerAttackAccel; - if (npc.velocity.X > 0f && stingerAttackTargetX < 0f) - npc.velocity.X -= stingerAttackAccel; - } - if (npc.velocity.Y < stingerAttackTargetY) - { - npc.velocity.Y += stingerAttackAccel; - if (npc.velocity.Y < 0f && stingerAttackTargetY > 0f) - npc.velocity.Y += stingerAttackAccel; - } - else if (npc.velocity.Y > stingerAttackTargetY) - { - npc.velocity.Y -= stingerAttackAccel; - if (npc.velocity.Y > 0f && stingerAttackTargetY < 0f) - npc.velocity.Y -= stingerAttackAccel; - } - } - else if (stingerAttackTargetDist > 100f) - { - float playerLocation = npc.Center.X - Main.player[npc.target].Center.X; - npc.direction = playerLocation < 0 ? 1 : -1; - npc.spriteDirection = npc.direction; - - if (npc.velocity.X < stingerAttackTargetX) - { - npc.velocity.X += stingerAttackAccel; - if (npc.velocity.X < 0f && stingerAttackTargetX > 0f) - npc.velocity.X += stingerAttackAccel * 2f; - } - else if (npc.velocity.X > stingerAttackTargetX) - { - npc.velocity.X -= stingerAttackAccel; - if (npc.velocity.X > 0f && stingerAttackTargetX < 0f) - npc.velocity.X -= stingerAttackAccel * 2f; - } - if (npc.velocity.Y < stingerAttackTargetY) - { - npc.velocity.Y += stingerAttackAccel; - if (npc.velocity.Y < 0f && stingerAttackTargetY > 0f) - npc.velocity.Y += stingerAttackAccel * 2f; - } - else if (npc.velocity.Y > stingerAttackTargetY) - { - npc.velocity.Y -= stingerAttackAccel; - if (npc.velocity.Y > 0f && stingerAttackTargetY < 0f) - npc.velocity.Y -= stingerAttackAccel * 2f; - } - } - - // Go to a random phase - if (npc.ai[1] > stingerAttackTimer * 15f) - { - npc.ai[0] = -1f; - npc.ai[1] = 3f; - npc.netUpdate = true; - } - } - - else if (npc.ai[0] == 4f) - { - npc.localAI[0] = 1f; - float despawnVelMult = 14f; - - Vector2 despawnTargetDist = Main.player[npc.target].Center - npc.Center; - despawnTargetDist.Normalize(); - despawnTargetDist *= 14f; - - npc.velocity = (npc.velocity * despawnVelMult + despawnTargetDist) / (despawnVelMult + 1f); - if (npc.velocity.X < 0f) - npc.direction = -1; - else - npc.direction = 1; - - npc.spriteDirection = npc.direction; - - if (distanceFromTarget < 2000f) - { - npc.ai[0] = -1f; - npc.localAI[0] = 0f; - } - } - - if (Main.netMode == NetmodeID.Server) - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, npc.whoAmI, 0f, 0f, 0f, 0, 0, 0); - - npc.netSpam = 5; - - return false; - } - } -} diff --git a/NPCs/VanillaNPCOverrides/Bosses/QueenSlimeAI.cs b/NPCs/VanillaNPCOverrides/Bosses/QueenSlimeAI.cs deleted file mode 100644 index 8dbf151dbc..0000000000 --- a/NPCs/VanillaNPCOverrides/Bosses/QueenSlimeAI.cs +++ /dev/null @@ -1,883 +0,0 @@ -using CalamityMod.Events; -using CalamityMod.World; -using Microsoft.Xna.Framework; -using System; -using System.Collections.Generic; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Audio; - -namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses -{ - public static class QueenSlimeAI - { - public static bool BuffedQueenSlimeAI(NPC npc, Mod mod) - { - // Difficulty bools - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; - - // Percent life remaining - float lifeRatio = npc.life / (float)npc.lifeMax; - - float slimeScale = 1f; - bool teleported = false; - bool phase2 = lifeRatio <= 0.5f; - bool phase3 = lifeRatio <= 0.4f; - bool phase4 = lifeRatio <= 0.2f; - - // Reset damage - npc.damage = npc.defDamage; - - // Spawn settings - if (npc.localAI[0] == 0f) - { - npc.ai[1] = -20f; - npc.localAI[0] = npc.lifeMax; - npc.TargetClosest(); - npc.netUpdate = true; - } - - // Emit light - Lighting.AddLight(npc.Center, 1f, 0.7f, 0.9f); - - // Despawn - int despawnDistanceInTiles = 500; - if (Main.player[npc.target].dead || Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) / 16f > despawnDistanceInTiles) - { - npc.TargetClosest(); - if (Main.player[npc.target].dead || Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) / 16f > despawnDistanceInTiles) - { - npc.EncourageDespawn(10); - if (Main.player[npc.target].Center.X < npc.Center.X) - npc.direction = 1; - else - npc.direction = -1; - } - } - - // Teleport - float teleportGateValue = 600f; - if (!Main.player[npc.target].dead && npc.timeLeft > 10 && !phase2 && npc.ai[3] >= teleportGateValue && npc.ai[0] == 0f && npc.velocity.Y == 0f) - { - // Avoid cheap bullshit - npc.damage = 0; - - npc.ai[0] = 2f; - npc.ai[1] = 0f; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.netUpdate = true; - npc.TargetClosest(faceTarget: 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; - int teleportTries = 0; - while (teleportTries < 100) - { - teleportTries++; - int teleportTileX = Main.rand.Next(predictiveTeleportPoint.X - randomTeleportOffset, predictiveTeleportPoint.X + randomTeleportOffset + 1); - int teleportTileY = Main.rand.Next(predictiveTeleportPoint.Y - randomTeleportOffset, predictiveTeleportPoint.Y); - if (Main.tile[teleportTileX, teleportTileY].HasUnactuatedTile) - continue; - - bool canTeleportToTile = true; - if (canTeleportToTile && Main.tile[teleportTileX, teleportTileY].LiquidType == LiquidID.Lava) - canTeleportToTile = false; - if (canTeleportToTile && !Collision.CanHitLine(npc.Center, 0, 0, vectorAimedAheadOfTarget, 0, 0)) - canTeleportToTile = false; - - if (canTeleportToTile) - { - npc.localAI[1] = teleportTileX * 16 + 8; - npc.localAI[2] = teleportTileY * 16 + 16; - npc.ai[3] = 0f; - break; - } - } - - // Default teleport if the above conditions aren't met in 100 iterations - if (teleportTries >= 100) - { - Vector2 bottom = Main.player[Player.FindClosest(npc.position, npc.width, npc.height)].Bottom; - npc.localAI[1] = bottom.X; - npc.localAI[2] = bottom.Y; - npc.ai[3] = 0f; - } - } - } - - // Get ready to teleport by increasing ai[3] - if (!phase2) - { - if (npc.ai[3] < teleportGateValue) - { - if (!Collision.CanHitLine(npc.Center, 0, 0, Main.player[npc.target].Center, 0, 0) || Math.Abs(npc.Top.Y - Main.player[npc.target].Bottom.Y) > 320f) - npc.ai[3] += death ? 3f : 2f; - else - npc.ai[3] += 1f; - } - } - else - { - float teleportNetUpdate = npc.ai[3]; - npc.ai[3] -= 1f; - if (npc.ai[3] < 0f) - { - if (Main.netMode != NetmodeID.MultiplayerClient && teleportNetUpdate > 0f) - npc.netUpdate = true; - - npc.ai[3] = 0f; - } - } - - // Reset variables if despawning - if (npc.timeLeft <= 10 && ((phase2 && npc.ai[0] != 0f) || (!phase2 && npc.ai[0] != 3f))) - { - if (phase2) - npc.ai[0] = 0f; - else - npc.ai[0] = 3f; - - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; - } - - npc.noTileCollide = false; - npc.noGravity = false; - - // Frame data shit I guess? - if (phase2) - { - npc.localAI[3] += 1f; - if (npc.localAI[3] >= 24f) - npc.localAI[3] = 0f; - - if ((npc.ai[0] == 4f || npc.ai[0] == 6f) && npc.ai[2] == 1f) - npc.localAI[3] = 6f; - - if (npc.ai[0] == 5f && npc.ai[2] != 1f) - npc.localAI[3] = 7f; - } - - // Phases - switch ((int)npc.ai[0]) - { - // Phase switch phase - case 0: - - if (phase2) - { - QueenSlime_FlyMovement(npc); - } - else - { - npc.noTileCollide = false; - npc.noGravity = false; - if (npc.velocity.Y == 0f) - { - npc.velocity.X *= 0.8f; - if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) - npc.velocity.X = 0f; - } - } - - if (npc.timeLeft <= 10 || (!phase2 && npc.velocity.Y != 0f)) - break; - - npc.ai[1] += 1f; - int idleTime = bossRush ? 20 : death ? 30 : 40; - if (phase2) - idleTime = bossRush ? 40 : death ? 60 : 80; - if (phase4) - idleTime /= 2; - - if (!(npc.ai[1] > idleTime)) - break; - - npc.ai[1] = 0f; - if (phase2) - { - Player player = Main.player[npc.target]; - - switch ((int)npc.Calamity().newAI[0]) - { - default: - npc.ai[0] = Main.rand.NextBool() ? 6f : 5f; - break; - case 5: - npc.ai[0] = phase4 ? 6f : Main.rand.NextBool() ? 4f : 6f; - break; - case 6: - npc.ai[0] = phase4 ? 5f : Main.rand.NextBool() ? 5f : 4f; - break; - } - - if (npc.ai[0] == 4f || npc.ai[0] == 6f) - { - npc.ai[2] = 1f; - if (player != null && player.active && !player.dead && (player.Bottom.Y < npc.Bottom.Y || Math.Abs(player.Center.X - npc.Center.X) > 450f)) - { - npc.ai[0] = 5f; - npc.ai[2] = 0f; - } - } - } - else - { - switch ((int)npc.Calamity().newAI[0]) - { - default: - npc.ai[0] = Main.rand.NextBool() ? 5f : 4f; - break; - case 4: - npc.ai[0] = Main.rand.NextBool() ? 3f : 5f; - break; - case 5: - npc.ai[0] = Main.rand.NextBool() ? 4f : 3f; - break; - } - } - - npc.netUpdate = true; - break; - - // Enlarge after teleport - case 1: - - // Avoid cheap bullshit - npc.damage = 0; - - npc.rotation = 0f; - npc.ai[1] += 1f; - float teleportEndTime = bossRush ? 10f : death ? 15f : 20f; - slimeScale = MathHelper.Clamp(npc.ai[1] / teleportEndTime, 0f, 1f); - slimeScale = 0.5f + slimeScale * 0.5f; - if (npc.ai[1] >= teleportEndTime && Main.netMode != NetmodeID.MultiplayerClient) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.netUpdate = true; - npc.TargetClosest(); - } - - if (Main.netMode == NetmodeID.MultiplayerClient && npc.ai[1] >= teleportEndTime * 2f) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.TargetClosest(); - } - - // Emit teleport dust - Color newColor2 = NPC.AI_121_QueenSlime_GetDustColor(); - newColor2.A = 150; - for (int i = 0; i < 10; i++) - { - int queenSlimeDust = Dust.NewDust(npc.position + Vector2.UnitX * -20f, npc.width + 40, npc.height, 4, npc.velocity.X, npc.velocity.Y, 50, newColor2, 1.5f); - Main.dust[queenSlimeDust].noGravity = true; - Main.dust[queenSlimeDust].velocity *= 2f; - } - - break; - - // Shrink and spawn teleport gore and dust - case 2: - - // Avoid cheap bullshit - npc.damage = 0; - - npc.rotation = 0f; - npc.ai[1] += 1f; - float teleportTime = bossRush ? 20f : death ? 30f : 40f; - slimeScale = MathHelper.Clamp((teleportTime - npc.ai[1]) / teleportTime, 0f, 1f); - slimeScale = 0.5f + slimeScale * 0.5f; - - if (npc.ai[1] >= teleportTime) - teleported = true; - - // Spawn crown gore - if (npc.ai[1] == teleportTime) - Gore.NewGore(npc.GetSource_FromAI(), npc.Center + new Vector2(-40f, -npc.height / 2), npc.velocity, GoreID.QueenSlimeCrown); - - if (npc.ai[1] >= teleportTime && Main.netMode != NetmodeID.MultiplayerClient) - { - npc.Bottom = new Vector2(npc.localAI[1], npc.localAI[2]); - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.netUpdate = true; - } - - if (Main.netMode == NetmodeID.MultiplayerClient && npc.ai[1] >= teleportTime * 2f) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - } - - // Emit teleport dust - if (!teleported) - { - Color newColor = NPC.AI_121_QueenSlime_GetDustColor(); - newColor.A = 150; - for (int n = 0; n < 10; n++) - { - int queenSlimeDust2 = Dust.NewDust(npc.position + Vector2.UnitX * -20f, npc.width + 40, npc.height, 4, npc.velocity.X, npc.velocity.Y, 50, newColor, 1.5f); - Main.dust[queenSlimeDust2].noGravity = true; - Main.dust[queenSlimeDust2].velocity *= 0.5f; - } - } - - break; - - // She jump - case 3: - - // Faster fall - if (npc.velocity.Y > 0f) - npc.velocity.Y += bossRush ? 0.1f : death ? 0.05f : 0f; - - npc.rotation = 0f; - if (npc.velocity.Y == 0f) - { - npc.velocity.X *= 0.8f; - if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) - npc.velocity.X = 0f; - - float timerIncrement = bossRush ? 7f : death ? 6f : 5f; - npc.ai[1] += timerIncrement; - if (lifeRatio < 0.85f) - npc.ai[1] += timerIncrement; - if (lifeRatio < 0.7f) - npc.ai[1] += timerIncrement; - - if (!(npc.ai[1] >= 0f)) - break; - - float distanceBelowTarget = npc.position.Y - (Main.player[npc.target].position.Y + 80f); - float speedMult = 1f; - if (distanceBelowTarget > 0f) - speedMult += distanceBelowTarget * 0.002f; - - if (speedMult > 2f) - speedMult = 2f; - - npc.netUpdate = true; - npc.TargetClosest(); - if (npc.ai[2] == 3f) - { - npc.velocity.Y = -13f * speedMult; - npc.velocity.X += (bossRush ? 7f : death ? 6f : 5.5f) * npc.direction; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - if (npc.timeLeft > 10) - { - npc.Calamity().newAI[0] = npc.ai[0]; - npc.SyncExtraAI(); - npc.ai[0] = 0f; - } - else - npc.ai[1] = -60f; - } - else if (npc.ai[2] == 2f) - { - npc.velocity.Y = -(bossRush ? 10f : death ? 8f : 6f) * speedMult; - npc.velocity.X += (bossRush ? 8.5f : death ? 7.5f : 7f) * npc.direction; - npc.ai[1] = -40f; - npc.ai[2] += 1f; - } - else - { - npc.velocity.Y = -(bossRush ? 12f : death ? 10f : 8f) * speedMult; - npc.velocity.X += (bossRush ? 7.5f : death ? 6.5f : 6f) * npc.direction; - npc.ai[1] = -40f; - npc.ai[2] += 1f; - } - - npc.noTileCollide = true; - } - else - { - if (npc.target >= Main.maxPlayers) - break; - - float jumpVelocity = bossRush ? 6.5f : death ? 5.5f : 4.5f; - if (Main.getGoodWorld) - jumpVelocity = 7f; - - if ((npc.direction == 1 && npc.velocity.X < jumpVelocity) || (npc.direction == -1 && npc.velocity.X > 0f - jumpVelocity)) - { - if ((npc.direction == -1 && npc.velocity.X < 0.1) || (npc.direction == 1 && npc.velocity.X > -0.1)) - npc.velocity.X += (bossRush ? 0.5f : death ? 0.35f : 0.3f) * npc.direction; - else - npc.velocity.X *= bossRush ? 0.88f : death ? 0.9f : 0.91f; - } - - if (!Main.player[npc.target].dead) - { - if (npc.velocity.Y > 0f && npc.Bottom.Y > Main.player[npc.target].Top.Y) - npc.noTileCollide = false; - else if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].Center, 1, 1) && !Collision.SolidCollision(npc.position, npc.width, npc.height)) - npc.noTileCollide = false; - else - npc.noTileCollide = true; - } - } - - break; - - // Slam down and create shockwave - // Create a cascade of crystals while falling down in phase 3 and the case is 4 - // Release a massive eruption of crystals in phase 3 and the case is 6 - case 4: - case 6: - - npc.rotation *= 0.9f; - npc.noTileCollide = true; - npc.noGravity = true; - - if (npc.ai[2] == 1f) - { - npc.noTileCollide = false; - npc.noGravity = false; - - int slamDelay = 30; - if (phase2) - slamDelay = 10; - - if (Main.getGoodWorld) - slamDelay = 0; - - if (npc.velocity.Y == 0f) - { - SoundEngine.PlaySound(SoundID.Item167, npc.Center); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int type = ProjectileID.QueenSlimeSmash; - int damage = npc.GetProjectileDamage(type); - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Bottom, Vector2.Zero, type, damage, 0f, Main.myPlayer); - - // Eruption of crystals in phase 3 - if (npc.ai[0] == 6f && phase3) - { - float projectileVelocity = 12f; - type = ProjectileID.QueenSlimeMinionBlueSpike; - damage = npc.GetProjectileDamage(type); - Vector2 destination = new Vector2(npc.Center.X, npc.Center.Y - 100f) - npc.Center; - destination.Normalize(); - destination *= projectileVelocity; - int numProj = 20; - float rotation = MathHelper.ToRadians(100); - for (int i = 0; i < numProj; i++) - { - Vector2 perturbedSpeed = destination.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, perturbedSpeed, type, damage, 0f, Main.myPlayer, 0f, -2f); - } - } - } - - for (int l = 0; l < 20; l++) - { - int slamDust = Dust.NewDust(npc.Bottom - new Vector2(npc.width / 2, 30f), npc.width, 30, 31, npc.velocity.X, npc.velocity.Y, 40, NPC.AI_121_QueenSlime_GetDustColor()); - Main.dust[slamDust].noGravity = true; - Main.dust[slamDust].velocity.Y = -5f + Main.rand.NextFloat() * -3f; - Main.dust[slamDust].velocity.X *= 7f; - } - - npc.Calamity().newAI[0] = npc.ai[0]; - npc.SyncExtraAI(); - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.netUpdate = true; - } - else if (npc.ai[1] >= slamDelay) - { - for (int m = 0; m < 4; m++) - { - Vector2 position = npc.Bottom - new Vector2(Main.rand.NextFloatDirection() * 16f, Main.rand.Next(8)); - int slamDust2 = Dust.NewDust(position, 2, 2, 31, npc.velocity.X, npc.velocity.Y, 40, NPC.AI_121_QueenSlime_GetDustColor(), 1.4f); - Main.dust[slamDust2].position = position; - Main.dust[slamDust2].noGravity = true; - Main.dust[slamDust2].velocity.Y = npc.velocity.Y * 0.9f; - Main.dust[slamDust2].velocity.X = (Main.rand.NextBool() ? (-10f) : 10f) + Main.rand.NextFloatDirection() * 3f; - } - } - - npc.velocity.X *= 0.8f; - float slamNetUpdate = npc.ai[1]; - npc.ai[1] += 1f; - if (npc.ai[1] >= slamDelay) - { - if (slamNetUpdate < slamDelay) - npc.netUpdate = true; - - if (phase2 && npc.ai[1] > (slamDelay + 120)) - { - npc.Calamity().newAI[0] = npc.ai[0]; - npc.SyncExtraAI(); - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.velocity.Y *= 0.8f; - npc.netUpdate = true; - break; - } - - npc.velocity.Y += bossRush ? 2f : death ? 1.75f : 1.5f; - float slamVelocity = bossRush ? 15.99f : death ? 15.5f : 15f; - if (Main.getGoodWorld) - { - npc.velocity.Y += 1f; - slamVelocity = 15.99f; - } - - if (npc.velocity.Y == 0f) - npc.velocity.Y = 0.01f; - - if (npc.velocity.Y >= slamVelocity) - npc.velocity.Y = slamVelocity; - - // Cascade of crystals in phase 3 or 4 while falling down - if (((npc.ai[0] == 4f && phase3) || phase4) && npc.ai[1] % 12f == 0f) - { - SoundEngine.PlaySound(SoundID.Item154, npc.Center); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Vector2 fireFrom = npc.Center; - int projectileAmt = 2; - int type = ProjectileID.QueenSlimeMinionBlueSpike; - int damage = npc.GetProjectileDamage(type); - for (int i = 0; i < projectileAmt; i++) - { - int totalProjectiles = 2; - float radians = MathHelper.TwoPi / totalProjectiles; - for (int j = 0; j < totalProjectiles; j++) - { - Vector2 projVelocity = npc.velocity.RotatedBy(radians * j + MathHelper.PiOver2); - Projectile.NewProjectile(npc.GetSource_FromAI(), fireFrom, projVelocity, type, damage, 0f, Main.myPlayer, 0f, -1f); - } - } - } - } - } - else - npc.velocity.Y *= 0.8f; - - break; - } - - if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[1] == 0f) - { - npc.TargetClosest(); - npc.netUpdate = true; - } - - npc.ai[1] += 1f; - if (!(npc.ai[1] >= 30f)) - break; - - if (npc.ai[1] >= 60f) - { - npc.ai[1] = 60f; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.ai[1] = 0f; - npc.ai[2] = 1f; - npc.velocity.Y = -3f; - npc.netUpdate = true; - } - } - - Player player3 = Main.player[npc.target]; - Vector2 center = npc.Center; - if (!player3.dead && player3.active && Math.Abs(npc.Center.X - player3.Center.X) / 16f <= despawnDistanceInTiles) - center = player3.Center; - - center.Y -= 384f; - if (npc.velocity.Y == 0f) - { - npc.velocity = center - npc.Center; - npc.velocity = npc.velocity.SafeNormalize(Vector2.Zero); - npc.velocity *= bossRush ? 30f : death ? 26f : 24f; - } - else - npc.velocity.Y *= 0.95f; - - break; - - // Fire spread of gel projectiles - case 5: - - npc.rotation *= 0.9f; - npc.noTileCollide = true; - npc.noGravity = true; - - if (phase2) - npc.ai[3] = 0f; - - if (npc.ai[2] == 1f) - { - npc.ai[1] += 1f; - if (!(npc.ai[1] >= 10f)) - break; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int numGelProjectiles = phase4 ? Main.rand.Next(9, 12) : phase2 ? Main.rand.Next(6, 9) : 12; - if (Main.getGoodWorld) - numGelProjectiles = 15; - - float projectileVelocity = death ? 12f : 10.5f; - int type = ProjectileID.QueenSlimeGelAttack; - int damage = npc.GetProjectileDamage(type); - if (phase2) - { - Vector2 destination = new Vector2(npc.Center.X, npc.Center.Y + 100f) - npc.Center; - destination.Normalize(); - destination *= projectileVelocity; - float rotation = MathHelper.ToRadians(120); - for (int i = 0; i < numGelProjectiles; i++) - { - if (CalamityWorld.LegendaryMode) - destination *= Main.rand.NextFloat() + 0.5f; - - Vector2 perturbedSpeed = destination.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numGelProjectiles - 1))); - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, perturbedSpeed, type, damage, 0f, Main.myPlayer, 0f, -2f); - Main.projectile[proj].timeLeft = 900; - } - } - else - { - for (int j = 0; j < numGelProjectiles; j++) - { - Vector2 spinningpoint = new Vector2(projectileVelocity, 0f); - - if (CalamityWorld.LegendaryMode) - spinningpoint *= Main.rand.NextFloat() + 0.5f; - - spinningpoint = spinningpoint.RotatedBy((-j) * ((float)Math.PI * 2f) / numGelProjectiles, Vector2.Zero); - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, spinningpoint, type, damage, 0f, Main.myPlayer, 0f, -2f); - Main.projectile[proj].timeLeft = 900; - } - } - - // Fire gel balls directly at players with a max of 3 - List targets = new List(); - for (int p = 0; p < Main.maxPlayers; p++) - { - if (Main.player[p].active && !Main.player[p].dead) - targets.Add(p); - - if (targets.Count > 2) - break; - } - foreach (int t in targets) - { - Vector2 velocity2 = Vector2.Normalize(Main.player[t].Center - npc.Center) * projectileVelocity; - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, velocity2, type, damage, 0f, Main.myPlayer, 0f, -2f); - Main.projectile[proj].timeLeft = 900; - } - } - - SoundEngine.PlaySound(SoundID.Item155, npc.Center); - npc.Calamity().newAI[0] = npc.ai[0]; - npc.SyncExtraAI(); - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.netUpdate = true; - break; - } - - if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[1] == 0f) - { - npc.TargetClosest(); - npc.netUpdate = true; - } - - npc.ai[1] += 1f; - if (npc.ai[1] >= 50f) - { - npc.ai[1] = 50f; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.ai[1] = 0f; - npc.ai[2] = 1f; - npc.netUpdate = true; - } - } - - float slamDustRadius = 100f; - for (int k = 0; k < 4; k++) - { - Vector2 slamDustArea = npc.Center + Main.rand.NextVector2CircularEdge(slamDustRadius, slamDustRadius); - if (!phase2) - slamDustArea += new Vector2(0f, 20f); - - Vector2 v = slamDustArea - npc.Center; - v = v.SafeNormalize(Vector2.Zero) * -8f; - int superSlamDust = Dust.NewDust(slamDustArea, 2, 2, 31, v.X, v.Y, 40, NPC.AI_121_QueenSlime_GetDustColor(), 1.8f); - Main.dust[superSlamDust].position = slamDustArea; - Main.dust[superSlamDust].noGravity = true; - Main.dust[superSlamDust].alpha = 250; - Main.dust[superSlamDust].velocity = v; - Main.dust[superSlamDust].customData = npc; - } - - if (phase2) - QueenSlime_FlyMovement(npc); - - break; - } - - // Don't take damage while teleporting - npc.dontTakeDamage = npc.hide = teleported; - - // Adjust size with HP - if (slimeScale != npc.scale) - { - npc.position.X += npc.width / 2; - npc.position.Y += npc.height; - npc.scale = slimeScale; - npc.width = (int)(114f * npc.scale); - npc.height = (int)(100f * npc.scale); - npc.position.X -= npc.width / 2; - npc.position.Y -= npc.height; - } - - // Spawn small slimes - // Don't spawn any slimes in final phase - if (npc.life <= 0 || phase4) - return false; - - if (Main.netMode == NetmodeID.MultiplayerClient) - return false; - - // Reset numerous variables when phase 2 begins - if (npc.localAI[0] >= (npc.lifeMax / 2) && npc.life < npc.lifeMax / 2) - { - npc.localAI[0] = npc.life; - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.netUpdate = true; - } - - int slimeSpawnThreshold = (int)(npc.lifeMax * (CalamityWorld.LegendaryMode ? 0.01f : phase3 ? 0.04f : phase2 ? 0.03f : 0.025f)); - if (!((npc.life + slimeSpawnThreshold) < npc.localAI[0])) - return false; - - npc.localAI[0] = npc.life; - 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 random = Main.rand.Next(2); - if (phase2) - random += 1; - if (phase3) - random = 2; - - int typeToSpawn = NPCID.QueenSlimeMinionBlue; - switch (random) - { - case 0: - typeToSpawn = NPCID.QueenSlimeMinionBlue; - break; - case 1: - typeToSpawn = NPCID.QueenSlimeMinionPink; - break; - case 2: - typeToSpawn = NPCID.QueenSlimeMinionPurple; - break; - } - - int slimeScale2 = NPC.NewNPC(npc.GetSource_FromAI(), x, y, typeToSpawn); - Main.npc[slimeScale2].SetDefaults(typeToSpawn); - Main.npc[slimeScale2].velocity.X = Main.rand.Next(-15, 16) * 0.1f; - Main.npc[slimeScale2].velocity.Y = Main.rand.Next(-30, 1) * 0.1f; - Main.npc[slimeScale2].ai[0] = -500 * Main.rand.Next(3); - Main.npc[slimeScale2].ai[1] = 0f; - if (Main.netMode == NetmodeID.Server && slimeScale2 < Main.maxNPCs) - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, slimeScale2); - - return false; - } - - public static void QueenSlime_FlyMovement(NPC npc) - { - // Difficulty bools - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death; - - npc.noTileCollide = true; - npc.noGravity = true; - - float flyVelocity = bossRush ? 20f : death ? 18f : 16f; - float flyAcceleration = bossRush ? 0.18f : death ? 0.14f : 0.12f; - float flyDistanceY = 450f; - - npc.TargetClosest(); - - Vector2 desiredVelocity = npc.Center; - - if (npc.timeLeft > 10) - { - if (!Collision.CanHit(npc, Main.player[npc.target])) - { - bool flyToSolidTilesAboveTarget = false; - Vector2 center = Main.player[npc.target].Center; - for (int i = 0; i < 16; i++) - { - float tileDistanceAboveTarget = 16 * i; - Point point = (center + new Vector2(0f, 0f - tileDistanceAboveTarget)).ToTileCoordinates(); - if (WorldGen.SolidOrSlopedTile(point.X, point.Y)) - { - desiredVelocity = center + new Vector2(0f, 0f - tileDistanceAboveTarget + 16f) - npc.Center; - flyToSolidTilesAboveTarget = true; - break; - } - } - - if (!flyToSolidTilesAboveTarget) - desiredVelocity = center - npc.Center; - } - else - desiredVelocity = Main.player[npc.target].Center + new Vector2(0f, -flyDistanceY) - npc.Center; - } - else - desiredVelocity = npc.Center + new Vector2(500f * npc.direction, -flyDistanceY) - npc.Center; - - float distanceFromFlightTarget = desiredVelocity.Length(); - if (Math.Abs(desiredVelocity.X) < 40f) - desiredVelocity.X = npc.velocity.X; - - if (distanceFromFlightTarget > 100f && ((npc.velocity.X < -12f && desiredVelocity.X > 0f) || (npc.velocity.X > 12f && desiredVelocity.X < 0f))) - flyAcceleration = 0.2f; - - if (distanceFromFlightTarget < 40f) - { - desiredVelocity = npc.velocity; - } - else if (distanceFromFlightTarget < 80f) - { - desiredVelocity.Normalize(); - desiredVelocity *= flyVelocity * 0.65f; - } - else - { - desiredVelocity.Normalize(); - desiredVelocity *= flyVelocity; - } - - npc.SimpleFlyMovement(desiredVelocity, flyAcceleration); - npc.rotation = npc.velocity.X * 0.1f; - if (npc.rotation > 0.5f) - npc.rotation = 0.5f; - - if (npc.rotation < -0.5f) - npc.rotation = -0.5f; - } - } -} diff --git a/NPCs/VanillaNPCOverrides/Bosses/SkeletronAI.cs b/NPCs/VanillaNPCOverrides/Bosses/SkeletronAI.cs deleted file mode 100644 index c658223715..0000000000 --- a/NPCs/VanillaNPCOverrides/Bosses/SkeletronAI.cs +++ /dev/null @@ -1,849 +0,0 @@ -using System; -using CalamityMod.Events; -using CalamityMod.World; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses -{ - public static class SkeletronAI - { - public static bool BuffedSkeletronAI(NPC npc, Mod mod) - { - CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; - - // Percent life remaining - float lifeRatio = npc.life / (float)npc.lifeMax; - - // Phases - bool respawnHands = lifeRatio < 0.33f; - bool phase2 = respawnHands || death; - - // Set defense - npc.defense = npc.defDefense; - - npc.reflectsProjectiles = false; - - // Get a target - 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(); - - // Spawn hands - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (npc.ai[0] == 0f) - { - npc.ai[0] = 1f; - SpawnHands(); - npc.netUpdate = true; - } - - // Respawn hands - if (respawnHands && calamityGlobalNPC.newAI[0] == 0f && Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 160f) - { - calamityGlobalNPC.newAI[0] = 1f; - SoundEngine.PlaySound(SoundID.Roar with { Pitch = SoundID.Roar.Pitch - 0.25f }, npc.position); - SpawnHands(); - - npc.netUpdate = true; - npc.SyncExtraAI(); - } - - void SpawnHands() - { - int skeletronHand = NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.position.X + (npc.width / 2)), (int)npc.position.Y + npc.height / 2, NPCID.SkeletronHand, npc.whoAmI); - Main.npc[skeletronHand].ai[0] = -1f; - Main.npc[skeletronHand].ai[1] = npc.whoAmI; - Main.npc[skeletronHand].target = npc.target; - Main.npc[skeletronHand].netUpdate = true; - - skeletronHand = NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.position.X + (npc.width / 2)), (int)npc.position.Y + npc.height / 2, NPCID.SkeletronHand, npc.whoAmI); - Main.npc[skeletronHand].ai[0] = 1f; - Main.npc[skeletronHand].ai[1] = npc.whoAmI; - Main.npc[skeletronHand].ai[3] = 150f; - Main.npc[skeletronHand].target = npc.target; - Main.npc[skeletronHand].netUpdate = true; - - // Spawn two additional hands with different attack timings - if (death) - { - skeletronHand = NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.position.X + (npc.width / 2)), (int)npc.position.Y + npc.height / 2, NPCID.SkeletronHand, npc.whoAmI); - Main.npc[skeletronHand].ai[0] = -1f; - Main.npc[skeletronHand].Calamity().newAI[0] = -1f; - Main.npc[skeletronHand].ai[1] = npc.whoAmI; - Main.npc[skeletronHand].ai[3] = respawnHands ? -75f : 0f; - Main.npc[skeletronHand].target = npc.target; - Main.npc[skeletronHand].netUpdate = true; - - skeletronHand = NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.position.X + (npc.width / 2)), (int)npc.position.Y + npc.height / 2, NPCID.SkeletronHand, npc.whoAmI); - Main.npc[skeletronHand].ai[0] = 1f; - Main.npc[skeletronHand].Calamity().newAI[0] = -1f; - Main.npc[skeletronHand].ai[1] = npc.whoAmI; - Main.npc[skeletronHand].ai[3] = respawnHands ? 75f : 150f; - Main.npc[skeletronHand].target = npc.target; - Main.npc[skeletronHand].netUpdate = true; - } - } - } - - // Distance from target - float distance = Vector2.Distance(Main.player[npc.target].Center, npc.Center); - - // Despawn - if (Main.player[npc.target].dead || distance > (bossRush ? CalamityGlobalNPC.CatchUpDistance350Tiles : CalamityGlobalNPC.CatchUpDistance200Tiles)) - { - npc.TargetClosest(); - if (Main.player[npc.target].dead || distance > (bossRush ? CalamityGlobalNPC.CatchUpDistance350Tiles : CalamityGlobalNPC.CatchUpDistance200Tiles)) - npc.ai[1] = 3f; - } - - // Daytime enrage - if (Main.dayTime && !bossRush && npc.ai[1] != 3f && npc.ai[1] != 2f) - { - npc.ai[1] = 2f; - SoundEngine.PlaySound(SoundID.Roar, npc.position); - } - - // Hand immunity - int numHandsAlive = 0; - for (int i = 0; i < Main.maxNPCs; i++) - { - if (Main.npc[i].active && Main.npc[i].type == NPCID.SkeletronHand) - numHandsAlive++; - } - bool handsDead = numHandsAlive == 0; - npc.chaseable = handsDead; - calamityGlobalNPC.DR = numHandsAlive > 0 ? 0.9999f : 0.05f; - calamityGlobalNPC.unbreakableDR = numHandsAlive > 0; - calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = numHandsAlive > 0; - - // Teleport - if (handsDead || phase2) - { - // Post-teleport - if (npc.ai[3] == -60f) - { - npc.ai[3] = 0f; - - SoundEngine.PlaySound(SoundID.Item66, npc.position); - - // Fire magic bolt after teleport - if (Main.netMode != NetmodeID.MultiplayerClient) - { - float magicBoltSpeed = 2f + (distance * 0.005f); - if (magicBoltSpeed > 6f) - magicBoltSpeed = 6f; - - int type = ProjectileID.Skull; - int damage = npc.GetProjectileDamage(type); - int numProj = Main.getGoodWorld ? 22 : death ? 5 : 3; - - float boltTargetXDist = Main.player[npc.target].Center.X - npc.Center.X; - float boltTargetYDist = Main.player[npc.target].Center.Y - npc.Center.Y; - float boltTargetDistance = (float)Math.Sqrt(boltTargetXDist * boltTargetXDist + boltTargetYDist * boltTargetYDist); - - boltTargetDistance = magicBoltSpeed / boltTargetDistance; - boltTargetXDist *= boltTargetDistance; - boltTargetYDist *= boltTargetDistance; - Vector2 center = npc.Center; - center.X += boltTargetXDist * 5f; - center.Y += boltTargetYDist * 5f; - - float rotation = MathHelper.ToRadians(Main.getGoodWorld ? 180 : 60); - float baseSpeed = (float)Math.Sqrt(boltTargetXDist * boltTargetXDist + boltTargetYDist * boltTargetYDist); - double startAngle = Math.Atan2(boltTargetXDist, boltTargetYDist) - rotation / 2; - double deltaAngle = rotation / numProj; - double offsetAngle; - - for (int i = 0; i < numProj; i++) - { - offsetAngle = startAngle + deltaAngle * i; - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), center.X, center.Y, baseSpeed * (float)Math.Sin(offsetAngle), baseSpeed * (float)Math.Cos(offsetAngle), type, damage, 0f, Main.myPlayer, -2f, 0f); - Main.projectile[proj].timeLeft = 300; - } - - npc.netUpdate = true; - } - - // Teleport dust - for (int m = 0; m < 30; m++) - { - int teleportDust = Dust.NewDust(npc.position, npc.width, npc.height, 27, 0f, 0f, 200, default, 3f); - Main.dust[teleportDust].noGravity = true; - Main.dust[teleportDust].velocity.X = Main.dust[teleportDust].velocity.X * 2f; - } - } - - // Teleport after a certain time - // If hands are dead: 7 seconds - // If hands are not dead: 14 seconds - // If hands are dead in phase 2: 4.7 seconds - npc.ai[3] += 1f + (((phase2 && handsDead) || bossRush) ? 0.5f : 0f) - ((handsDead || bossRush) ? 0f : 0.5f); - - // Dust to show teleport - int ai3 = (int)npc.ai[3]; // 0 to 30, and -60 - bool emitDust = false; - - if (ai3 >= 300 && calamityGlobalNPC.newAI[2] == 0f && calamityGlobalNPC.newAI[3] == 0f) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Vector2 skullFaceDirection = npc.Center + new Vector2(npc.direction * 20, 6f); - Vector2 skullTargetDirection = Main.player[npc.target].Center - skullFaceDirection; - Point skullTileCoords = npc.Center.ToTileCoordinates(); - Point targetTileCoords = Main.player[npc.target].Center.ToTileCoordinates(); - int randomTeleportOffset = 26; - int skullPositionOffset = 4; - int targetPositionOffset = 22; - int teleportTries = 0; - - bool targetTooFar = false; - if (skullTargetDirection.Length() > 2000f) - targetTooFar = true; - - while (!targetTooFar && teleportTries < 100) - { - teleportTries++; - int teleportTileX = Main.rand.Next(targetTileCoords.X - randomTeleportOffset, targetTileCoords.X + randomTeleportOffset + 1); - int teleportTileY = Main.rand.Next(targetTileCoords.Y - randomTeleportOffset, targetTileCoords.Y + randomTeleportOffset + 1); - if ((teleportTileY < targetTileCoords.Y - targetPositionOffset || teleportTileY > targetTileCoords.Y + targetPositionOffset || teleportTileX < targetTileCoords.X - targetPositionOffset || teleportTileX > targetTileCoords.X + targetPositionOffset) && (teleportTileY < skullTileCoords.Y - skullPositionOffset || teleportTileY > skullTileCoords.Y + skullPositionOffset || teleportTileX < skullTileCoords.X - skullPositionOffset || teleportTileX > skullTileCoords.X + skullPositionOffset) && !Main.tile[teleportTileX, teleportTileY].HasUnactuatedTile) - { - // New location params - calamityGlobalNPC.newAI[2] = teleportTileX * 16 - npc.width / 2; - calamityGlobalNPC.newAI[3] = teleportTileY * 16 - npc.height; - npc.SyncExtraAI(); - break; - } - } - } - } - - if (calamityGlobalNPC.newAI[2] != 0f && calamityGlobalNPC.newAI[3] != 0f) - { - for (int m = 0; m < 5; m++) - { - Vector2 position = new Vector2(calamityGlobalNPC.newAI[2], calamityGlobalNPC.newAI[3]); - int teleportDust = Dust.NewDust(position, npc.width, npc.height, 27, 0f, 0f, 200, default, 2f); - Main.dust[teleportDust].noGravity = true; - } - } - - if (ai3 >= 390) - emitDust = true; - else if (ai3 >= 330) - { - if (Main.rand.Next(310, ai3 + 1) >= 325) - emitDust = true; - } - if (emitDust) - { - int dust = Dust.NewDust(npc.position, npc.width, npc.height, 27, 0f, 0f, 200, default, 1.5f); - Main.dust[dust].noGravity = true; - } - - // Teleport - if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[3] >= 420f) - { - // Teleport dust - for (int m = 0; m < 30; m++) - { - int teleportDust = Dust.NewDust(npc.position, npc.width, npc.height, 27, 0f, 0f, 200, default, 3f); - Main.dust[teleportDust].noGravity = true; - Main.dust[teleportDust].velocity.X = Main.dust[teleportDust].velocity.X * 2f; - } - - // New location - npc.Center = new Vector2(calamityGlobalNPC.newAI[2], calamityGlobalNPC.newAI[3]); - npc.velocity = Vector2.Zero; - npc.ai[3] = -60f; - calamityGlobalNPC.newAI[2] = 0f; - calamityGlobalNPC.newAI[3] = 0f; - npc.SyncExtraAI(); - npc.netUpdate = true; - } - } - else - npc.ai[3] = 0f; - - // Skull shooting - if (handsDead && npc.ai[1] == 0f) - { - float skullProjFrequency = bossRush ? 10f : phase2 ? (60f - (death ? 30f * (1f - lifeRatio) : 0f)) : 75f; - if (Main.getGoodWorld) - skullProjFrequency *= 0.8f; - skullProjFrequency = (float)Math.Ceiling(skullProjFrequency); - - if (Main.netMode != NetmodeID.MultiplayerClient && calamityGlobalNPC.newAI[1] % skullProjFrequency == 0f && calamityGlobalNPC.newAI[1] > 45f) - { - Vector2 skullFiringPos = npc.Center; - float skullProjTargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - skullFiringPos.X; - float skullProjTargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - skullFiringPos.Y; - // Ozzatron: noticed this is unused. Leaving as-is for minimal touch. - float skullProjTargetDist = (float)Math.Sqrt(skullProjTargetX * skullProjTargetX + skullProjTargetY * skullProjTargetY); - if (Collision.CanHit(skullFiringPos, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - float skullProjSpeed = phase2 ? (5f + (death ? 3f * (1f - lifeRatio) : 0f)) : 4f; - skullProjTargetX = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - skullFiringPos.X; - skullProjTargetY = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - skullFiringPos.Y; - skullProjTargetDist = (float)Math.Sqrt(skullProjTargetX * skullProjTargetX + skullProjTargetY * skullProjTargetY); - skullProjTargetDist = skullProjSpeed / skullProjTargetDist; - skullProjTargetX *= skullProjTargetDist; - skullProjTargetY *= skullProjTargetDist; - int spread = bossRush ? 100 : 50; - Vector2 skullProjDirection = new Vector2(skullProjTargetX + Main.rand.Next(-spread, spread + 1) * 0.01f, skullProjTargetY + Main.rand.Next(-spread, spread + 1) * 0.01f); - skullProjDirection.Normalize(); - skullProjDirection *= skullProjSpeed; - skullProjDirection += npc.velocity; - skullProjTargetX = skullProjDirection.X; - skullProjTargetY = skullProjDirection.Y; - int type = ProjectileID.Skull; - int damage = npc.GetProjectileDamage(type); - skullFiringPos += skullProjDirection * 5f; - int skullProjectile = Projectile.NewProjectile(npc.GetSource_FromAI(), skullFiringPos.X, skullFiringPos.Y, skullProjTargetX, skullProjTargetY, type, damage, 0f, Main.myPlayer, -1f, 0f); - Main.projectile[skullProjectile].timeLeft = 300; - - npc.netUpdate = true; - } - } - } - - // Float above target - if (npc.ai[1] == 0f) - { - npc.damage = lifeRatio > 0.99f ? 0 : npc.defDamage; - - calamityGlobalNPC.newAI[1] += 1f; - float phaseChangeRateBoost = 3f * (1f - lifeRatio); - npc.ai[2] += 1f + phaseChangeRateBoost; - if (npc.ai[2] >= 600f) - { - npc.ai[2] = 0f; - npc.ai[1] = 1f; - calamityGlobalNPC.newAI[1] = 0f; - - npc.TargetClosest(); - npc.SyncExtraAI(); - npc.netUpdate = true; - } - - npc.rotation = npc.velocity.X / 15f; - - float headYAcceleration = 0.04f + (death ? 0.04f * (1f - lifeRatio) : 0f); - float headYTopSpeed = 3.5f - (death ? 1f - lifeRatio : 0f); - float headXAcceleration = 0.08f + (death ? 0.04f * (1f - lifeRatio) : 0f); - float headXTopSpeed = 8.5f - (death ? 2f * (1f - lifeRatio) : 0f); - if (Main.getGoodWorld) - { - headYAcceleration += 0.01f; - headYTopSpeed += 1f; - headXAcceleration += 0.05f; - headXTopSpeed += 2f; - } - if (bossRush) - { - headYAcceleration *= 1.25f; - headYTopSpeed *= 0.75f; - headXAcceleration *= 1.25f; - headXTopSpeed *= 0.75f; - } - - if (npc.position.Y > Main.player[npc.target].position.Y - 250f) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y *= 0.98f; - npc.velocity.Y -= headYAcceleration; - if (npc.velocity.Y > headYTopSpeed) - npc.velocity.Y = headYTopSpeed; - } - else if (npc.position.Y < Main.player[npc.target].position.Y - 250f) - { - if (npc.velocity.Y < 0f) - npc.velocity.Y *= 0.98f; - npc.velocity.Y += headYAcceleration; - if (npc.velocity.Y < -headYTopSpeed) - npc.velocity.Y = -headYTopSpeed; - } - - if (npc.position.X + (npc.width / 2) > Main.player[npc.target].position.X + (Main.player[npc.target].width / 2)) - { - if (npc.velocity.X > 0f) - npc.velocity.X *= 0.98f; - npc.velocity.X -= headXAcceleration; - if (npc.velocity.X > headXTopSpeed) - npc.velocity.X = headXTopSpeed; - } - - if (npc.position.X + (npc.width / 2) < Main.player[npc.target].position.X + (Main.player[npc.target].width / 2)) - { - if (npc.velocity.X < 0f) - npc.velocity.X *= 0.98f; - npc.velocity.X += headXAcceleration; - if (npc.velocity.X < -headXTopSpeed) - npc.velocity.X = -headXTopSpeed; - } - } - - // Spin charge - else if (npc.ai[1] == 1f) - { - if (Main.getGoodWorld) - { - npc.reflectsProjectiles = true; - if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == 0f) - { - if (NPC.CountNPCS(NPCID.DarkCaster) < 6) - { - for (int i = 0; i < 1000; i++) - { - int headYAcceleration = (int)(npc.Center.X / 16f) + Main.rand.Next(-50, 51); - int headYTopSpeed; - for (headYTopSpeed = (int)(npc.Center.Y / 16f) + Main.rand.Next(-50, 51); headYTopSpeed < Main.maxTilesY - 10 && !WorldGen.SolidTile(headYAcceleration, headYTopSpeed); headYTopSpeed++) - { - } - - headYTopSpeed--; - if (!WorldGen.SolidTile(headYAcceleration, headYTopSpeed)) - { - int headXAcceleration = NPC.NewNPC(npc.GetSource_FromAI(), headYAcceleration * 16 + 8, headYTopSpeed * 16, NPCID.DarkCaster); - if (Main.netMode == NetmodeID.Server && headXAcceleration < Main.maxNPCs) - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, headXAcceleration); - - break; - } - } - } - - if (CalamityWorld.LegendaryMode) - { - if (!NPC.AnyNPCs(NPCID.DiabolistWhite)) - { - for (int i = 0; i < 1000; i++) - { - int headYAcceleration = (int)(npc.Center.X / 16f) + Main.rand.Next(-50, 51); - int headYTopSpeed; - for (headYTopSpeed = (int)(npc.Center.Y / 16f) + Main.rand.Next(-50, 51); headYTopSpeed < Main.maxTilesY - 10 && !WorldGen.SolidTile(headYAcceleration, headYTopSpeed); headYTopSpeed++) - { - } - - headYTopSpeed--; - if (!WorldGen.SolidTile(headYAcceleration, headYTopSpeed)) - { - int headXAcceleration = NPC.NewNPC(npc.GetSource_FromAI(), headYAcceleration * 16 + 8, headYTopSpeed * 16, NPCID.DiabolistWhite); - if (Main.netMode == NetmodeID.Server && headXAcceleration < Main.maxNPCs) - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, headXAcceleration); - - break; - } - } - } - } - } - } - - npc.defense -= 10; - - float phaseChangeRateBoost = 0.5f * (1f - lifeRatio); - npc.ai[2] += 1f + phaseChangeRateBoost; - - calamityGlobalNPC.newAI[1] += 1f; - if (calamityGlobalNPC.newAI[1] == 2f) - SoundEngine.PlaySound(SoundID.Roar, npc.position); - - if (npc.ai[2] >= 300f) - { - if (Main.getGoodWorld) - { - if (Main.netMode != NetmodeID.MultiplayerClient && NPC.CountNPCS(NPCID.DarkCaster) < 6) - { - for (int j = 0; j < 1000; j++) - { - int headYAcceleration = (int)(npc.Center.X / 16f) + Main.rand.Next(-50, 51); - int headYTopSpeed; - for (headYTopSpeed = (int)(npc.Center.Y / 16f) + Main.rand.Next(-50, 51); headYTopSpeed < Main.maxTilesY - 10 && !WorldGen.SolidTile(headYAcceleration, headYTopSpeed); headYTopSpeed++) - { - } - - headYTopSpeed--; - if (!WorldGen.SolidTile(headYAcceleration, headYTopSpeed)) - { - int headXAcceleration = NPC.NewNPC(npc.GetSource_FromAI(), headYAcceleration * 16 + 8, headYTopSpeed * 16, NPCID.DarkCaster); - if (Main.netMode == NetmodeID.Server && headXAcceleration < Main.maxNPCs) - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, headXAcceleration); - - break; - } - } - } - } - - npc.ai[2] = 0f; - npc.ai[1] = 0f; - calamityGlobalNPC.newAI[1] = 0f; - - npc.TargetClosest(); - npc.SyncExtraAI(); - npc.netUpdate = true; - } - - npc.rotation += npc.direction * 0.3f; - Vector2 headSpinPos = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float headSpinTargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - headSpinPos.X; - float headSpinTargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - headSpinPos.Y; - float headSpinTargetDist = (float)Math.Sqrt(headSpinTargetX * headSpinTargetX + headSpinTargetY * headSpinTargetY); - - // Increase speed while charging - npc.damage = (int)(npc.defDamage * 1.3); - float headSpinVelocityMult = bossRush ? 9f : 4.5f; - float velocityBoost = death ? 1f : 1f - lifeRatio; - if (handsDead || bossRush) - headSpinVelocityMult += velocityBoost; - - if (headSpinTargetDist > 150f) - { - float baseDistanceVelocityMult = 1f + MathHelper.Clamp((headSpinTargetDist - 150f) * 0.0015f, 0.05f, 1.5f); - headSpinVelocityMult *= baseDistanceVelocityMult; - } - - if (Main.getGoodWorld) - headSpinVelocityMult *= 1.3f; - - headSpinTargetDist = headSpinVelocityMult / headSpinTargetDist; - npc.velocity.X = headSpinTargetX * headSpinTargetDist; - npc.velocity.Y = headSpinTargetY * headSpinTargetDist; - } - - // Daytime enrage - else if (npc.ai[1] == 2f) - { - npc.damage = 1000; - calamityGlobalNPC.DR = 0.9999f; - calamityGlobalNPC.unbreakableDR = true; - npc.rotation += npc.direction * 0.3f; - Vector2 enrageSpinPos = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float enrageSpinTargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - enrageSpinPos.X; - float enrageSpinTargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - enrageSpinPos.Y; - float enrageSpinTargetDist = (float)Math.Sqrt(enrageSpinTargetX * enrageSpinTargetX + enrageSpinTargetY * enrageSpinTargetY); - enrageSpinTargetDist = 8f / enrageSpinTargetDist; - npc.velocity.X = enrageSpinTargetX * enrageSpinTargetDist; - npc.velocity.Y = enrageSpinTargetY * enrageSpinTargetDist; - } - - // Despawn - else if (npc.ai[1] == 3f) - { - npc.velocity.Y += 0.1f; - if (npc.velocity.Y < 0f) - npc.velocity.Y *= 0.95f; - npc.velocity.X *= 0.95f; - if (npc.timeLeft > 50) - npc.timeLeft = 50; - } - - // Emit dust - if (npc.ai[1] != 2f && npc.ai[1] != 3f && numHandsAlive != 0) - { - int idleDust = Dust.NewDust(new Vector2(npc.position.X + (npc.width / 2) - 15f - npc.velocity.X * 5f, npc.position.Y + npc.height - 2f), 30, 10, 5, -npc.velocity.X * 0.2f, 3f, 0, default, 2f); - Main.dust[idleDust].noGravity = true; - Main.dust[idleDust].velocity.X = Main.dust[idleDust].velocity.X * 1.3f; - Main.dust[idleDust].velocity.X = Main.dust[idleDust].velocity.X + npc.velocity.X * 0.4f; - Main.dust[idleDust].velocity.Y = Main.dust[idleDust].velocity.Y + (2f + npc.velocity.Y); - for (int j = 0; j < 2; j++) - { - idleDust = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + 120f), npc.width, 60, 5, npc.velocity.X, npc.velocity.Y, 0, default, 2f); - Main.dust[idleDust].noGravity = true; - Main.dust[idleDust].velocity -= npc.velocity; - Main.dust[idleDust].velocity.Y = Main.dust[idleDust].velocity.Y + 5f; - } - } - - return false; - } - - public static bool BuffedSkeletronHandAI(NPC npc, Mod mod) - { - CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; - - // Get a target - 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(); - - float yMultiplier = 1f; - if (calamityGlobalNPC.newAI[0] != 0f) - yMultiplier = calamityGlobalNPC.newAI[0]; - - // Inflict 0 damage for 3 seconds after spawning - if (calamityGlobalNPC.newAI[1] < 180f) - { - calamityGlobalNPC.newAI[1] += 1f; - if (calamityGlobalNPC.newAI[1] % 15f == 0f) - npc.SyncExtraAI(); - npc.damage = 0; - } - else - npc.damage = npc.defDamage; - - npc.spriteDirection = -(int)npc.ai[0]; - - if (Main.npc[(int)npc.ai[1]].ai[3] == -60f) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - // Teleport dust - for (int m = 0; m < 10; m++) - { - int teleportDust = Dust.NewDust(npc.position, npc.width, npc.height, 27, 0f, 0f, 200, default, 3f); - Main.dust[teleportDust].noGravity = true; - Main.dust[teleportDust].velocity.X = Main.dust[teleportDust].velocity.X * 2f; - } - - // New location - npc.Center = Main.npc[(int)npc.ai[1]].Center; - npc.velocity = Vector2.Zero; - npc.netUpdate = true; - } - } - - if (!Main.npc[(int)npc.ai[1]].active || Main.npc[(int)npc.ai[1]].aiStyle != 11) - { - npc.ai[2] += 10f; - if (npc.ai[2] > 50f || Main.netMode != NetmodeID.Server) - { - npc.life = -1; - npc.HitEffect(0, 10.0); - npc.active = false; - } - } - if (npc.ai[2] == 0f || npc.ai[2] == 3f) - { - if (Main.npc[(int)npc.ai[1]].ai[1] == 3f && npc.timeLeft > 10) - npc.timeLeft = 10; - - if (Main.npc[(int)npc.ai[1]].ai[1] != 0f) - { - float maxX = bossRush ? 4f : death ? 6f : 7f; - float maxY = bossRush ? 3f : death ? 4.5f : 5f; - - if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y - 100f * yMultiplier) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y *= 0.94f; - npc.velocity.Y -= 0.2f; - if (npc.velocity.Y > maxY) - npc.velocity.Y = maxY; - } - else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y - 100f * yMultiplier) - { - if (npc.velocity.Y < 0f) - npc.velocity.Y *= 0.94f; - npc.velocity.Y += 0.2f; - if (npc.velocity.Y < -maxY) - npc.velocity.Y = -maxY; - } - - if (npc.position.X + (npc.width / 2) > Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - 120f * npc.ai[0]) - { - if (npc.velocity.X > 0f) - npc.velocity.X *= 0.94f; - npc.velocity.X -= 0.2f; - if (npc.velocity.X > maxX) - npc.velocity.X = maxX; - } - - if (npc.position.X + (npc.width / 2) < Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - 120f * npc.ai[0]) - { - if (npc.velocity.X < 0f) - npc.velocity.X *= 0.94f; - npc.velocity.X += 0.2f; - if (npc.velocity.X < -maxX) - npc.velocity.X = -maxX; - } - } - else - { - npc.ai[3] += 1f; - if (npc.ai[3] >= 200f) - { - npc.ai[2] += 1f; - npc.ai[3] = 0f; - npc.netUpdate = true; - } - - float maxX = bossRush ? 4f : death ? 6f : 7f; - float maxY = bossRush ? 1f : death ? 2f : 2.5f; - - if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y + 230f * yMultiplier) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y *= 0.92f; - npc.velocity.Y -= 0.2f; - if (npc.velocity.Y > maxY) - npc.velocity.Y = maxY; - } - else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y + 230f * yMultiplier) - { - if (npc.velocity.Y < 0f) - npc.velocity.Y *= 0.92f; - npc.velocity.Y += 0.2f; - if (npc.velocity.Y < -maxY) - npc.velocity.Y = -maxY; - } - - if (npc.position.X + (npc.width / 2) > Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0]) - { - if (npc.velocity.X > 0f) - npc.velocity.X *= 0.92f; - npc.velocity.X -= 0.2f; - if (npc.velocity.X > maxX) - npc.velocity.X = maxX; - } - - if (npc.position.X + (npc.width / 2) < Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0]) - { - if (npc.velocity.X < 0f) - npc.velocity.X *= 0.92f; - npc.velocity.X += 0.2f; - if (npc.velocity.X < -maxX) - npc.velocity.X = -maxX; - } - } - - Vector2 handCurrentPos = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float handIdleXPos = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0] - handCurrentPos.X; - float handIdleYPos = Main.npc[(int)npc.ai[1]].position.Y + 230f - handCurrentPos.Y; - float handIdleDist = (float)Math.Sqrt(handIdleXPos * handIdleXPos + handIdleYPos * handIdleYPos); - npc.rotation = (float)Math.Atan2(handIdleYPos, handIdleXPos) + MathHelper.PiOver2; - return false; - } - if (npc.ai[2] == 1f) - { - Vector2 handCurrentPosition = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float handDrawbackXPos = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0] - handCurrentPosition.X; - float handDrawbackYPos = Main.npc[(int)npc.ai[1]].position.Y + 230f - handCurrentPosition.Y; - float handDrawbackDist = (float)Math.Sqrt(handDrawbackXPos * handDrawbackXPos + handDrawbackYPos * handDrawbackYPos); - npc.rotation = (float)Math.Atan2(handDrawbackYPos, handDrawbackXPos) + MathHelper.PiOver2; - npc.velocity.X *= 0.95f; - npc.velocity.Y -= 0.2f; - - if (npc.velocity.Y < -13f) - npc.velocity.Y = -13f; - - if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y - 200f) - { - npc.TargetClosest(); - npc.ai[2] = 2f; - handCurrentPosition = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - handDrawbackXPos = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - handCurrentPosition.X; - handDrawbackYPos = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - handCurrentPosition.Y; - handDrawbackDist = (float)Math.Sqrt(handDrawbackXPos * handDrawbackXPos + handDrawbackYPos * handDrawbackYPos); - handDrawbackDist = 22f / handDrawbackDist; - npc.velocity.X = handDrawbackXPos * handDrawbackDist; - npc.velocity.Y = handDrawbackYPos * handDrawbackDist; - npc.netUpdate = true; - } - } - else if (npc.ai[2] == 2f) - { - if (npc.position.Y > Main.player[npc.target].position.Y || npc.velocity.Y < 0f || npc.velocity == Vector2.Zero) - { - npc.ai[2] = 3f; - npc.netUpdate = true; - } - } - else if (npc.ai[2] == 4f) - { - Vector2 handStrikeCurrentPos = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float handStrikeXPos = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0] - handStrikeCurrentPos.X; - float handStrikeYPos = Main.npc[(int)npc.ai[1]].position.Y + 230f - handStrikeCurrentPos.Y; - float handStrikeDist = (float)Math.Sqrt(handStrikeXPos * handStrikeXPos + handStrikeYPos * handStrikeYPos); - npc.rotation = (float)Math.Atan2(handStrikeYPos, handStrikeXPos) + MathHelper.PiOver2; - npc.velocity.Y *= 0.95f; - npc.velocity.X += 0.2f * -npc.ai[0]; - - if (npc.velocity.X < -12f) - npc.velocity.X = -12f; - else if (npc.velocity.X > 12f) - npc.velocity.X = 12f; - - if (npc.position.X + (npc.width / 2) < Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - 500f || npc.position.X + (npc.width / 2) > Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) + 500f) - { - npc.TargetClosest(); - npc.ai[2] = 5f; - handStrikeCurrentPos = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - handStrikeXPos = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - handStrikeCurrentPos.X; - handStrikeYPos = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - handStrikeCurrentPos.Y; - handStrikeDist = (float)Math.Sqrt(handStrikeXPos * handStrikeXPos + handStrikeYPos * handStrikeYPos); - handStrikeDist = 23f / handStrikeDist; - npc.velocity.X = handStrikeXPos * handStrikeDist; - npc.velocity.Y = handStrikeYPos * handStrikeDist; - npc.netUpdate = true; - } - } - else if (npc.ai[2] == 5f && ((npc.velocity.X > 0f && npc.position.X + (npc.width / 2) > Main.player[npc.target].position.X + (Main.player[npc.target].width / 2)) || (npc.velocity.X < 0f && npc.position.X + (npc.width / 2) < Main.player[npc.target].position.X + (Main.player[npc.target].width / 2)) || npc.velocity == Vector2.Zero)) - { - npc.ai[2] = 0f; - npc.netUpdate = true; - } - - return false; - } - - public static void RevengeanceDungeonGuardianAI(NPC npc) - { - Player target = Main.player[npc.target]; - if (npc.ai[1] != 3f) - { - Vector2 targetVector = target.Center - npc.Center; - float targetDist = targetVector.Length(); - targetDist = 12f / targetDist; - npc.velocity.X = targetVector.X * targetDist; - npc.velocity.Y = targetVector.Y * targetDist; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (npc.localAI[1]++ % 60f == 59f) - { - Vector2 source = npc.Center; - if (Collision.CanHit(source, 1, 1, target.Center, target.width, target.height)) - { - float speed = 5f; - float xDist = target.Center.X - source.X + Main.rand.Next(-20, 21); - float yDist = target.Center.Y - source.Y + Main.rand.Next(-20, 21); - Vector2 velocity = new Vector2(xDist, yDist); - float distTarget = velocity.Length(); - distTarget = speed / distTarget; - velocity.X *= distTarget; - velocity.Y *= distTarget; - Vector2 offset = new Vector2(velocity.X * 1f + Main.rand.Next(-50, 51) * 0.01f, velocity.Y * 1f + Main.rand.Next(-50, 51) * 0.01f); - offset.Normalize(); - offset *= speed; - offset += npc.velocity; - velocity.X = offset.X; - velocity.Y = offset.Y; - int damage = 2500; - int projType = ProjectileID.Skull; - source += offset * 5f; - int skull = Projectile.NewProjectile(npc.GetSource_FromAI(), source, velocity, projType, damage, 0f, Main.myPlayer, -1f, 0f); - Main.projectile[skull].timeLeft = 300; - } - } - } - } - } - } -} diff --git a/NPCs/VanillaNPCOverrides/Bosses/SkeletronPrimeAI.cs b/NPCs/VanillaNPCOverrides/Bosses/SkeletronPrimeAI.cs deleted file mode 100644 index a7eb64e482..0000000000 --- a/NPCs/VanillaNPCOverrides/Bosses/SkeletronPrimeAI.cs +++ /dev/null @@ -1,1772 +0,0 @@ -using System; -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; -using CalamityMod.Events; -using CalamityMod.World; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses -{ - public static class SkeletronPrimeAI - { - public static bool BuffedSkeletronPrimeAI(NPC npc, Mod mod) - { - CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; - - // Get a target - 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(); - - // Percent life remaining - float lifeRatio = npc.life / (float)npc.lifeMax; - - if (npc.ai[3] != 0f) - NPC.mechQueen = npc.whoAmI; - - // Spawn arms - if (npc.ai[0] == 0f && Main.netMode != NetmodeID.MultiplayerClient) - { - npc.ai[0] = 1f; - - int arm = NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.position.X + (npc.width / 2)), (int)npc.position.Y + npc.height / 2, NPCID.PrimeCannon, npc.whoAmI); - Main.npc[arm].ai[0] = -1f; - Main.npc[arm].ai[1] = npc.whoAmI; - Main.npc[arm].target = npc.target; - Main.npc[arm].netUpdate = true; - - arm = NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.position.X + (npc.width / 2)), (int)npc.position.Y + npc.height / 2, NPCID.PrimeSaw, npc.whoAmI); - Main.npc[arm].ai[0] = 1f; - Main.npc[arm].ai[1] = npc.whoAmI; - Main.npc[arm].target = npc.target; - Main.npc[arm].netUpdate = true; - - arm = NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.position.X + (npc.width / 2)), (int)npc.position.Y + npc.height / 2, NPCID.PrimeVice, npc.whoAmI); - Main.npc[arm].ai[0] = -1f; - Main.npc[arm].ai[1] = npc.whoAmI; - Main.npc[arm].target = npc.target; - Main.npc[arm].ai[3] = 150f; - Main.npc[arm].netUpdate = true; - - arm = NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.position.X + (npc.width / 2)), (int)npc.position.Y + npc.height / 2, NPCID.PrimeLaser, npc.whoAmI); - Main.npc[arm].ai[0] = 1f; - Main.npc[arm].ai[1] = npc.whoAmI; - Main.npc[arm].target = npc.target; - Main.npc[arm].netUpdate = true; - Main.npc[arm].ai[3] = 150f; - } - - // Check if arms are alive - bool cannonAlive = false; - bool laserAlive = false; - bool viceAlive = false; - bool sawAlive = false; - if (CalamityGlobalNPC.primeCannon != -1) - { - if (Main.npc[CalamityGlobalNPC.primeCannon].active) - cannonAlive = true; - } - if (CalamityGlobalNPC.primeLaser != -1) - { - if (Main.npc[CalamityGlobalNPC.primeLaser].active) - laserAlive = true; - } - if (CalamityGlobalNPC.primeVice != -1) - { - if (Main.npc[CalamityGlobalNPC.primeVice].active) - viceAlive = true; - } - if (CalamityGlobalNPC.primeSaw != -1) - { - if (Main.npc[CalamityGlobalNPC.primeSaw].active) - sawAlive = true; - } - bool allArmsDead = !cannonAlive && !laserAlive && !viceAlive && !sawAlive; - npc.chaseable = allArmsDead; - - // Inflict 0 damage for 3 seconds after spawning - if (calamityGlobalNPC.newAI[2] < 180f) - { - calamityGlobalNPC.newAI[2] += 1f; - npc.damage = 0; - } - - // Set stats - if (npc.ai[1] == 5f) - npc.damage = 0; - else if (allArmsDead) - npc.damage = npc.defDamage; - - npc.defense = npc.defDefense; - - // Phases - bool phase2 = lifeRatio < 0.5f; - bool phase3 = lifeRatio < 0.25f; - - // Kill all arms if Prime Head enters phase 2 - if (phase2 && !allArmsDead) - { - for (int i = 0; i < Main.maxNPCs; i++) - { - NPC npc2 = Main.npc[i]; - if (npc2.type == NPCID.PrimeCannon || npc2.type == NPCID.PrimeLaser || npc2.type == NPCID.PrimeSaw || npc2.type == NPCID.PrimeVice) - { - npc2.life = -1; - npc2.HitEffect(0, 10.0); - npc2.active = false; - npc2.netUpdate = true; - } - } - } - - // Despawn - if (Main.player[npc.target].dead || Math.Abs(npc.position.X - Main.player[npc.target].position.X) > 6000f || Math.Abs(npc.position.Y - Main.player[npc.target].position.Y) > 6000f) - { - npc.TargetClosest(); - if (Main.player[npc.target].dead || Math.Abs(npc.position.X - Main.player[npc.target].position.X) > 6000f || Math.Abs(npc.position.Y - Main.player[npc.target].position.Y) > 6000f) - npc.ai[1] = 3f; - } - - // Activate daytime enrage - if (Main.dayTime && !bossRush && npc.ai[1] != 3f && npc.ai[1] != 2f) - { - // Heal - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int healAmt = npc.life - 300; - if (healAmt < 0) - { - int absHeal = Math.Abs(healAmt); - npc.life += absHeal; - npc.HealEffect(absHeal, true); - npc.netUpdate = true; - } - } - - npc.ai[1] = 2f; - SoundEngine.PlaySound(SoundID.Roar, npc.position); - } - - // Adjust slowing debuff immunity - bool immuneToSlowingDebuffs = npc.ai[1] == 5f; - npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - npc.buffImmune[BuffID.Slow] = immuneToSlowingDebuffs; - npc.buffImmune[BuffID.Webbed] = immuneToSlowingDebuffs; - - bool normalLaserRotation = calamityGlobalNPC.newAI[3] % 2f == 0f; - - // Float near player - if (npc.ai[1] == 0f || npc.ai[1] == 4f) - { - // Start other phases if arms are dead, start with spin phase - if (allArmsDead || CalamityWorld.LegendaryMode) - { - // Start spin phase after 1.5 seconds - npc.ai[2] += phase3 ? 1.5f : 1f; - if (npc.ai[2] >= (90f - (death ? 60f * (1f - lifeRatio) : 0f))) - { - bool shouldSpinAroundTarget = npc.ai[1] == 4f && npc.position.Y < Main.player[npc.target].position.Y - 400f && - Vector2.Distance(Main.player[npc.target].Center, npc.Center) < 600f && Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 400f; - - if (shouldSpinAroundTarget || npc.ai[1] != 4f) - { - if (shouldSpinAroundTarget) - { - npc.localAI[3] = 300f; - npc.SyncVanillaLocalAI(); - } - - npc.ai[2] = 0f; - npc.ai[1] = shouldSpinAroundTarget ? 5f : 1f; - npc.TargetClosest(); - npc.netUpdate = true; - } - } - } - - if (NPC.IsMechQueenUp) - npc.rotation = npc.rotation.AngleLerp(npc.velocity.X / 15f * 0.5f, 0.75f); - else - npc.rotation = npc.velocity.X / 15f; - - float velocityY = 3f - (death ? 1f - lifeRatio : 0f); - float velocityX = 7f - (death ? 3.5f * (1f - lifeRatio) : 0f); - float acceleration = 0.1f + (death ? 0.05f * (1f - lifeRatio) : 0f); - - float headDecelerationUpDist = 0f; - float headDecelerationDownDist = 0f; - float headDecelerationHorizontalDist = 0f; - int headHorizontalDirection = ((!(Main.player[npc.target].Center.X < npc.Center.X)) ? 1 : (-1)); - if (NPC.IsMechQueenUp) - { - headDecelerationHorizontalDist = -150f * (float)headHorizontalDirection; - headDecelerationUpDist = -100f; - headDecelerationDownDist = -100f; - } - - if (!cannonAlive) - { - velocityY -= 0.35f; - acceleration += 0.025f; - } - if (!laserAlive) - { - velocityY -= 0.35f; - acceleration += 0.025f; - } - if (!viceAlive) - { - velocityY -= 0.35f; - acceleration += 0.025f; - } - if (!sawAlive) - { - velocityY -= 0.35f; - acceleration += 0.025f; - } - - if (bossRush) - { - velocityY = 0.25f; - velocityX = 0.5f; - acceleration = 0.3f; - } - - // Reduce acceleration if target is holding a true melee weapon - if (Main.player[npc.target].HoldingTrueMeleeWeapon()) - acceleration *= 0.5f; - - if (npc.position.Y > Main.player[npc.target].position.Y - (400f + headDecelerationUpDist)) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y *= 0.9f; - - npc.velocity.Y -= acceleration; - - if (npc.velocity.Y > velocityY) - npc.velocity.Y = velocityY; - } - else if (npc.position.Y < Main.player[npc.target].position.Y - (450f + headDecelerationDownDist)) - { - if (npc.velocity.Y < 0f) - npc.velocity.Y *= 0.9f; - - npc.velocity.Y += acceleration; - - if (npc.velocity.Y < -velocityY) - npc.velocity.Y = -velocityY; - } - - if (npc.position.X + (npc.width / 2) > Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) + (400f + headDecelerationHorizontalDist)) - { - if (npc.velocity.X > 0f) - npc.velocity.X *= 0.9f; - - npc.velocity.X -= acceleration; - - if (npc.velocity.X > velocityX) - npc.velocity.X = velocityX; - } - if (npc.position.X + (npc.width / 2) < Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - (400f + headDecelerationHorizontalDist)) - { - if (npc.velocity.X < 0f) - npc.velocity.X *= 0.9f; - - npc.velocity.X += acceleration; - - if (npc.velocity.X < -velocityX) - npc.velocity.X = -velocityX; - } - } - - else - { - // Spinning - if (npc.ai[1] == 1f) - { - npc.defense *= 2; - npc.damage *= 2; - - if (phase2 && Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[1] += 1f; - if (npc.localAI[1] >= 45f) - { - npc.localAI[1] = 0f; - - int totalProjectiles = bossRush ? 24 : 12; - float radians = MathHelper.TwoPi / totalProjectiles; - int type = ProjectileID.DeathLaser; - int damage = npc.GetProjectileDamage(type); - float velocity = 3f; - double angleA = radians * 0.5; - double angleB = MathHelper.ToRadians(90f) - angleA; - float velocityX = (float)(velocity * Math.Sin(angleA) / Math.Sin(angleB)); - Vector2 spinningPoint = normalLaserRotation ? new Vector2(0f, -velocity) : new Vector2(-velocityX, -velocity); - for (int k = 0; k < totalProjectiles; k++) - { - Vector2 laserFireDirection = spinningPoint.RotatedBy(radians * k); - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + Vector2.Normalize(laserFireDirection) * 30f, laserFireDirection, type, damage, 0f, Main.myPlayer, 1f, 0f); - Main.projectile[proj].timeLeft = 900; - } - calamityGlobalNPC.newAI[3] += 1f; - } - } - - npc.ai[2] += 1f; - if (npc.ai[2] == 2f) - SoundEngine.PlaySound(SoundID.Roar, npc.position); - - // Spin for 3 seconds then return to floating phase - float phaseTimer = 240f; - if (phase2 && !phase3) - phaseTimer += 60f; - - if (npc.ai[2] >= (phaseTimer - (death ? 60f * (1f - lifeRatio) : 0f))) - { - npc.TargetClosest(); - npc.ai[2] = 0f; - npc.ai[1] = 4f; - npc.localAI[1] = 0f; - } - - if (NPC.IsMechQueenUp) - npc.rotation = npc.rotation.AngleLerp(npc.velocity.X / 15f * 0.5f, 0.75f); - else - npc.rotation += npc.direction * 0.3f; - - Vector2 headPosition = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float headTargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - headPosition.X; - float headTargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - headPosition.Y; - float headTargetDistance = (float)Math.Sqrt(headTargetX * headTargetX + headTargetY * headTargetY); - - float speed = bossRush ? 9f : 6f; - if (phase2) - speed += 0.5f; - if (phase3) - speed += 0.5f; - - if (headTargetDistance > 150f) - { - float baseDistanceVelocityMult = 1f + MathHelper.Clamp((headTargetDistance - 150f) * 0.0015f, 0.05f, 1.5f); - speed *= baseDistanceVelocityMult; - } - - if (NPC.IsMechQueenUp) - { - float mechdusaSpeedMult = (NPC.npcsFoundForCheckActive[NPCID.TheDestroyerBody] ? 0.6f : 0.75f); - speed *= mechdusaSpeedMult; - } - - headTargetDistance = speed / headTargetDistance; - npc.velocity.X = headTargetX * headTargetDistance; - npc.velocity.Y = headTargetY * headTargetDistance; - - if (NPC.IsMechQueenUp) - { - float mechdusaAccelMult = Vector2.Distance(npc.Center, Main.player[npc.target].Center); - if (mechdusaAccelMult < 0.1f) - mechdusaAccelMult = 0f; - - if (mechdusaAccelMult < speed) - npc.velocity = npc.velocity.SafeNormalize(Vector2.Zero) * mechdusaAccelMult; - } - } - - // Daytime enrage - if (npc.ai[1] == 2f) - { - npc.damage = 1000; - calamityGlobalNPC.DR = 0.9999f; - calamityGlobalNPC.unbreakableDR = true; - - if (NPC.IsMechQueenUp) - npc.rotation = npc.rotation.AngleLerp(npc.velocity.X / 15f * 0.5f, 0.75f); - else - npc.rotation += npc.direction * 0.3f; - - Vector2 enragedHeadPosition = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float enragedHeadTargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - enragedHeadPosition.X; - float enragedHeadTargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - enragedHeadPosition.Y; - float enragedHeadTargetDist = (float)Math.Sqrt(enragedHeadTargetX * enragedHeadTargetX + enragedHeadTargetY * enragedHeadTargetY); - - float enragedHeadSpeed = 10f; - enragedHeadSpeed += enragedHeadTargetDist / 100f; - if (enragedHeadSpeed < 8f) - enragedHeadSpeed = 8f; - if (enragedHeadSpeed > 32f) - enragedHeadSpeed = 32f; - - enragedHeadTargetDist = enragedHeadSpeed / enragedHeadTargetDist; - npc.velocity.X = enragedHeadTargetX * enragedHeadTargetDist; - npc.velocity.Y = enragedHeadTargetY * enragedHeadTargetDist; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[0] += 1f; - if (npc.localAI[0] >= 60f) - { - npc.localAI[0] = 0f; - Vector2 headCenter = npc.Center; - if (Collision.CanHit(headCenter, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - enragedHeadSpeed = 7f; - float enragedHeadSkullTargetX = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - headCenter.X + Main.rand.Next(-20, 21); - float enragedHeadSkullTargetY = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - headCenter.Y + Main.rand.Next(-20, 21); - float enragedHeadSkullTargetDist = (float)Math.Sqrt(enragedHeadSkullTargetX * enragedHeadSkullTargetX + enragedHeadSkullTargetY * enragedHeadSkullTargetY); - enragedHeadSkullTargetDist = enragedHeadSpeed / enragedHeadSkullTargetDist; - enragedHeadSkullTargetX *= enragedHeadSkullTargetDist; - enragedHeadSkullTargetY *= enragedHeadSkullTargetDist; - - Vector2 value = new Vector2(enragedHeadSkullTargetX * 1f + Main.rand.Next(-50, 51) * 0.01f, enragedHeadSkullTargetY * 1f + Main.rand.Next(-50, 51) * 0.01f); - value.Normalize(); - value *= enragedHeadSpeed; - value += npc.velocity; - enragedHeadSkullTargetX = value.X; - enragedHeadSkullTargetY = value.Y; - - int type = ProjectileID.Skull; - headCenter += value * 5f; - int enragedSkulls = Projectile.NewProjectile(npc.GetSource_FromAI(), headCenter.X, headCenter.Y, enragedHeadSkullTargetX, enragedHeadSkullTargetY, type, 250, 0f, Main.myPlayer, -1f, 0f); - Main.projectile[enragedSkulls].timeLeft = 300; - } - } - } - } - - // Despawning - if (npc.ai[1] == 3f) - { - if (NPC.IsMechQueenUp) - { - int mechdusaBossDespawning = NPC.FindFirstNPC(NPCID.Retinazer); - if (mechdusaBossDespawning >= 0) - Main.npc[mechdusaBossDespawning].EncourageDespawn(5); - - mechdusaBossDespawning = NPC.FindFirstNPC(NPCID.Spazmatism); - if (mechdusaBossDespawning >= 0) - Main.npc[mechdusaBossDespawning].EncourageDespawn(5); - - if (!NPC.AnyNPCs(NPCID.Retinazer) && !NPC.AnyNPCs(NPCID.Spazmatism)) - { - mechdusaBossDespawning = NPC.FindFirstNPC(NPCID.TheDestroyer); - if (mechdusaBossDespawning >= 0) - Main.npc[mechdusaBossDespawning].Transform(NPCID.TheDestroyerTail); - - npc.EncourageDespawn(5); - } - - npc.velocity.Y += 0.1f; - if (npc.velocity.Y < 0f) - npc.velocity.Y *= 0.95f; - - npc.velocity.X *= 0.95f; - if (npc.velocity.Y > 13f) - npc.velocity.Y = 13f; - } - else - { - npc.velocity.Y += 0.1f; - if (npc.velocity.Y < 0f) - npc.velocity.Y *= 0.9f; - - npc.velocity.X *= 0.9f; - - if (npc.timeLeft > 500) - npc.timeLeft = 500; - } - } - - // Fly around target in a circle - if (npc.ai[1] == 5f) - { - npc.ai[2] += 1f; - - npc.rotation = npc.velocity.X / 50f; - - float skullSpawnDivisor = bossRush ? 9f : death ? 15f - (float)Math.Round(5f * (1f - lifeRatio)) : 15f; - float totalSkulls = 12f; - int skullSpread = bossRush ? 250 : death ? 150 : 100; - - // Spin for about 3 seconds - float spinVelocity = 30f; - if (npc.ai[2] == 2f) - { - // Play angry noise - SoundEngine.PlaySound(SoundID.Roar, npc.position); - - // Set spin direction - if (Main.player[npc.target].velocity.X > 0f) - calamityGlobalNPC.newAI[0] = 1f; - else if (Main.player[npc.target].velocity.X < 0f) - calamityGlobalNPC.newAI[0] = -1f; - else - calamityGlobalNPC.newAI[0] = Main.player[npc.target].direction; - - // Set spin velocity - npc.velocity.X = MathHelper.Pi * npc.localAI[3] / spinVelocity; - npc.velocity *= -calamityGlobalNPC.newAI[0]; - npc.netUpdate = true; - } - - // Maintain velocity and spit skulls - else if (npc.ai[2] > 2f) - { - npc.velocity = npc.velocity.RotatedBy(MathHelper.Pi / spinVelocity * -calamityGlobalNPC.newAI[0]); - if (npc.ai[2] == 3f) - npc.velocity *= 0.6f; - - if (npc.ai[2] % skullSpawnDivisor == 0f) - { - calamityGlobalNPC.newAI[1] += 1f; - - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 64f) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Vector2 headCenter = npc.Center; - float enragedHeadSpeed = 4f + (death ? 2f * (1f - lifeRatio) : 0f); - float enragedHeadSkullTargetX = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - headCenter.X + Main.rand.Next(-20, 21); - float enragedHeadSkullTargetY = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - headCenter.Y + Main.rand.Next(-20, 21); - float enragedHeadSkullTargetDist = (float)Math.Sqrt(enragedHeadSkullTargetX * enragedHeadSkullTargetX + enragedHeadSkullTargetY * enragedHeadSkullTargetY); - enragedHeadSkullTargetDist = enragedHeadSpeed / enragedHeadSkullTargetDist; - enragedHeadSkullTargetX *= enragedHeadSkullTargetDist; - enragedHeadSkullTargetY *= enragedHeadSkullTargetDist; - - Vector2 value = new Vector2(enragedHeadSkullTargetX + Main.rand.Next(-skullSpread, skullSpread + 1) * 0.01f, enragedHeadSkullTargetY + Main.rand.Next(-skullSpread, skullSpread + 1) * 0.01f); - value.Normalize(); - value *= enragedHeadSpeed; - enragedHeadSkullTargetX = value.X; - enragedHeadSkullTargetY = value.Y; - - int type = ProjectileID.Skull; - int damage = npc.GetProjectileDamage(type); - headCenter += value * 5f; - int enragedSkulls = Projectile.NewProjectile(npc.GetSource_FromAI(), headCenter.X, headCenter.Y, enragedHeadSkullTargetX, enragedHeadSkullTargetY, type, damage, 0f, Main.myPlayer, -1f, 0f); - Main.projectile[enragedSkulls].timeLeft = 480; - Main.projectile[enragedSkulls].tileCollide = false; - } - } - - // Go to floating phase, or spinning phase if in phase 2 - if (calamityGlobalNPC.newAI[1] >= totalSkulls) - { - npc.velocity.Normalize(); - - // Fly overhead and spit missiles if on low health - npc.ai[1] = phase3 ? 6f : 1f; - npc.ai[2] = 0f; - npc.localAI[3] = 0f; - calamityGlobalNPC.newAI[1] = 0f; - calamityGlobalNPC.newAI[0] = 0f; - npc.SyncVanillaLocalAI(); - npc.TargetClosest(); - npc.netUpdate = true; - } - } - } - } - - // Fly overhead and spit missiles - if (npc.ai[1] == 6f) - { - npc.damage = 0; - - npc.rotation = npc.velocity.X / 15f; - - float flightVelocity = bossRush ? 25f : death ? 20f : 15f; - float flightAcceleration = bossRush ? 0.25f : death ? 0.2f : 0.15f; - - Vector2 destination = new Vector2(Main.player[npc.target].Center.X, Main.player[npc.target].Center.Y - 500f); - npc.SimpleFlyMovement(Vector2.Normalize(destination - npc.Center) * flightVelocity, flightAcceleration); - - // Spit homing missiles and then go to floating phase - npc.localAI[3] += 1f; - if (Vector2.Distance(npc.Center, destination) < 160f || npc.ai[2] > 0f || npc.localAI[3] > 120f) - { - float missileSpawnDivisor = death ? 8f : 12f; - npc.ai[2] += 1f; - if (npc.ai[2] % missileSpawnDivisor == 0f) - { - calamityGlobalNPC.newAI[1] += 1f; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Vector2 velocity = new Vector2(-1f * (float)Main.rand.NextDouble() * 3f, 1f); - velocity = velocity.RotatedBy((Main.rand.NextDouble() - 0.5) * MathHelper.PiOver4); - velocity *= 0.25f; - int type = ProjectileID.RocketSkeleton; - int damage = npc.GetProjectileDamage(type); - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X + Main.rand.Next(npc.width / 2), npc.Center.Y + 4f, velocity.X, velocity.Y, type, damage, 0f, Main.myPlayer, npc.target, 1f); - Main.projectile[proj].timeLeft = 540; - } - - SoundEngine.PlaySound(SoundID.Item62, npc.Center); - - if (calamityGlobalNPC.newAI[1] >= 10f) - { - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.localAI[3] = 0f; - calamityGlobalNPC.newAI[0] = 0f; - calamityGlobalNPC.newAI[1] = 0f; - npc.SyncVanillaLocalAI(); - npc.TargetClosest(); - npc.netUpdate = true; - } - } - } - } - } - - return false; - } - - public static bool BuffedPrimeLaserAI(NPC npc, Mod mod) - { - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; - - // Get a target - 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(); - - // Set direction - npc.spriteDirection = -(int)npc.ai[0]; - - // Despawn if head is gone - if (!Main.npc[(int)npc.ai[1]].active || Main.npc[(int)npc.ai[1]].aiStyle != 32) - { - npc.ai[2] += 10f; - if (npc.ai[2] > 50f || Main.netMode != NetmodeID.Server) - { - npc.life = -1; - npc.HitEffect(0, 10.0); - npc.active = false; - } - } - - CalamityGlobalNPC.primeLaser = npc.whoAmI; - - // Check if arms are alive - bool cannonAlive = false; - bool viceAlive = false; - bool sawAlive = false; - if (CalamityGlobalNPC.primeCannon != -1) - { - if (Main.npc[CalamityGlobalNPC.primeCannon].active) - cannonAlive = true; - } - if (CalamityGlobalNPC.primeVice != -1) - { - if (Main.npc[CalamityGlobalNPC.primeVice].active) - viceAlive = true; - } - if (CalamityGlobalNPC.primeSaw != -1) - { - if (Main.npc[CalamityGlobalNPC.primeSaw].active) - sawAlive = true; - } - - // Inflict 0 damage for 3 seconds after spawning - bool dontAttack = npc.Calamity().newAI[2] < 180f; - if (dontAttack) - { - npc.Calamity().newAI[2] += 1f; - npc.damage = 0; - } - else - npc.damage = npc.defDamage; - - bool normalLaserRotation = npc.localAI[1] % 2f == 0f; - - // Movement - float velocityY = bossRush ? 0.5f : death ? 2f : 2.5f; - float velocityX = bossRush ? 1f : death ? 5f : 7f; - float acceleration = bossRush ? 0.6f : death ? 0.3f : 0.25f; - - if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y - 100f) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y *= 0.9f; - - npc.velocity.Y -= acceleration; - - if (npc.velocity.Y > velocityY) - npc.velocity.Y = velocityY; - } - else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y - 100f) - { - if (npc.velocity.Y < 0f) - npc.velocity.Y *= 0.9f; - - npc.velocity.Y += acceleration; - - if (npc.velocity.Y < -velocityY) - npc.velocity.Y = -velocityY; - } - - if (npc.position.X + (npc.width / 2) > Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - 180f * npc.ai[0]) - { - if (npc.velocity.X > 0f) - npc.velocity.X *= 0.9f; - - npc.velocity.X -= acceleration; - - if (npc.velocity.X > velocityX) - npc.velocity.X = velocityX; - } - if (npc.position.X + (npc.width / 2) < Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - 180f * npc.ai[0]) - { - if (npc.velocity.X < 0f) - npc.velocity.X *= 0.9f; - - npc.velocity.X += acceleration; - - if (npc.velocity.X < -velocityX) - npc.velocity.X = -velocityX; - } - - // Phase 1 - if (npc.ai[2] == 0f) - { - // Despawn if head is despawning - if (Main.npc[(int)npc.ai[1]].ai[1] == 3f && npc.timeLeft > 10) - npc.timeLeft = 10; - - // Go to other phase after 13.3 seconds (change this as each arm dies) - npc.ai[3] += 1f; - if (!cannonAlive) - npc.ai[3] += 1f; - if (!viceAlive) - npc.ai[3] += 1f; - if (!sawAlive) - npc.ai[3] += 1f; - - if (npc.ai[3] >= 800f) - { - npc.localAI[0] = 0f; - npc.ai[2] = 1f; - npc.ai[3] = 0f; - npc.TargetClosest(); - npc.netUpdate = true; - } - - Vector2 laserArmPosition = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float laserArmTargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - laserArmPosition.X; - float laserArmTargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - laserArmPosition.Y; - float laserArmTargetDist = (float)Math.Sqrt(laserArmTargetX * laserArmTargetX + laserArmTargetY * laserArmTargetY); - npc.rotation = (float)Math.Atan2(laserArmTargetY, laserArmTargetX) - MathHelper.PiOver2; - - if (Main.netMode != NetmodeID.MultiplayerClient && !dontAttack) - { - // Fire laser every 1.5 seconds (change this as each arm dies to fire more aggressively) - npc.localAI[0] += 1f; - if (!cannonAlive) - npc.localAI[0] += 1f; - if (!viceAlive) - npc.localAI[0] += 1f; - if (!sawAlive) - npc.localAI[0] += 1f; - - if (npc.localAI[0] >= 90f) - { - npc.localAI[0] = 0f; - npc.TargetClosest(); - float laserSpeed = bossRush ? 5f : 4f; - int type = ProjectileID.DeathLaser; - int damage = npc.GetProjectileDamage(type); - laserArmTargetDist = laserSpeed / laserArmTargetDist; - laserArmTargetX *= laserArmTargetDist; - laserArmTargetY *= laserArmTargetDist; - laserArmPosition.X += laserArmTargetX * 30f; - laserArmPosition.Y += laserArmTargetY * 30f; - Projectile.NewProjectile(npc.GetSource_FromAI(), laserArmPosition.X, laserArmPosition.Y, laserArmTargetX, laserArmTargetY, type, damage, 0f, Main.myPlayer, 1f, 0f); - } - } - } - - // Other phase, get closer to the player and fire ring of lasers - else if (npc.ai[2] == 1f) - { - // Go to phase 1 after 2 seconds (change this as each arm dies to stay in this phase for longer) - npc.ai[3] += 1f; - - float timeLimit = 135f; - float timeMult = 1.882075f; - if (!cannonAlive) - timeLimit *= timeMult; - if (!viceAlive) - timeLimit *= timeMult; - if (!sawAlive) - timeLimit *= timeMult; - - if (npc.ai[3] >= timeLimit) - { - npc.localAI[0] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.TargetClosest(); - npc.netUpdate = true; - } - - Vector2 laserRingArmPosition = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float laserRingTargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - laserRingArmPosition.X; - float laserRingTargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - laserRingArmPosition.Y; - npc.rotation = (float)Math.Atan2(laserRingTargetY, laserRingTargetX) - MathHelper.PiOver2; - - if (Main.netMode != NetmodeID.MultiplayerClient && !dontAttack) - { - // Fire laser every 1.5 seconds (change this as each arm dies to fire more aggressively) - npc.localAI[0] += 1f; - if (!cannonAlive) - npc.localAI[0] += 0.5f; - if (!viceAlive) - npc.localAI[0] += 0.5f; - if (!sawAlive) - npc.localAI[0] += 0.5f; - - if (npc.localAI[0] >= 120f) - { - npc.localAI[0] = 0f; - npc.TargetClosest(); - int totalProjectiles = bossRush ? 24 : 12; - float radians = MathHelper.TwoPi / totalProjectiles; - int type = ProjectileID.DeathLaser; - int damage = npc.GetProjectileDamage(type); - float velocity = 3f; - double angleA = radians * 0.5; - double angleB = MathHelper.ToRadians(90f) - angleA; - float laserVelocityX = (float)(velocity * Math.Sin(angleA) / Math.Sin(angleB)); - Vector2 spinningPoint = normalLaserRotation ? new Vector2(0f, -velocity) : new Vector2(-laserVelocityX, -velocity); - for (int k = 0; k < totalProjectiles; k++) - { - Vector2 laserFireDirection = spinningPoint.RotatedBy(radians * k); - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + Vector2.Normalize(laserFireDirection) * 30f, laserFireDirection, type, damage, 0f, Main.myPlayer, 1f, 0f); - Main.projectile[proj].timeLeft = 900; - } - npc.localAI[1] += 1f; - } - } - } - - return false; - } - - public static bool BuffedPrimeCannonAI(NPC npc, Mod mod) - { - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; - - // Get a target - 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(); - - npc.spriteDirection = -(int)npc.ai[0]; - - if (!Main.npc[(int)npc.ai[1]].active || Main.npc[(int)npc.ai[1]].aiStyle != 32) - { - npc.ai[2] += 10f; - if (npc.ai[2] > 50f || Main.netMode != NetmodeID.Server) - { - npc.life = -1; - npc.HitEffect(0, 10.0); - npc.active = false; - } - } - - CalamityGlobalNPC.primeCannon = npc.whoAmI; - - // Check if arms are alive - bool laserAlive = false; - bool viceAlive = false; - bool sawAlive = false; - if (CalamityGlobalNPC.primeLaser != -1) - { - if (Main.npc[CalamityGlobalNPC.primeLaser].active) - laserAlive = true; - } - if (CalamityGlobalNPC.primeVice != -1) - { - if (Main.npc[CalamityGlobalNPC.primeVice].active) - viceAlive = true; - } - if (CalamityGlobalNPC.primeSaw != -1) - { - if (Main.npc[CalamityGlobalNPC.primeSaw].active) - sawAlive = true; - } - - // Inflict 0 damage for 3 seconds after spawning - bool dontAttack = npc.Calamity().newAI[2] < 180f; - if (dontAttack) - { - npc.Calamity().newAI[2] += 1f; - npc.damage = 0; - } - else - npc.damage = npc.defDamage; - - bool fireSlower = false; - if (laserAlive) - { - // If laser is firing ring of lasers - if (Main.npc[CalamityGlobalNPC.primeLaser].ai[2] == 1f) - fireSlower = true; - } - else - { - fireSlower = npc.ai[2] == 0f; - - if (fireSlower) - { - // Go to other phase after 13.33 seconds (change this as each arm dies) - npc.ai[3] += 1f; - if (!laserAlive) - npc.ai[3] += 1f; - if (!viceAlive) - npc.ai[3] += 1f; - if (!sawAlive) - npc.ai[3] += 1f; - - if (npc.ai[3] >= 800f) - { - npc.localAI[0] = 0f; - npc.ai[2] = 1f; - fireSlower = false; - npc.ai[3] = 0f; - npc.TargetClosest(); - npc.netUpdate = true; - } - } - else - { - // Go to phase 1 after 2 seconds (change this as each arm dies to stay in this phase for longer) - npc.ai[3] += 1f; - - float timeLimit = 120f; - float timeMult = 1.882075f; - if (!laserAlive) - timeLimit *= timeMult; - if (!viceAlive) - timeLimit *= timeMult; - if (!sawAlive) - timeLimit *= timeMult; - - if (npc.ai[3] >= timeLimit) - { - npc.localAI[0] = 0f; - npc.ai[2] = 0f; - fireSlower = true; - npc.ai[3] = 0f; - npc.TargetClosest(); - npc.netUpdate = true; - } - } - } - - // Movement - float velocityY = bossRush ? 0.5f : death ? 2f : 2.5f; - float velocityX = bossRush ? 1f : death ? 5f : 7f; - float acceleration = bossRush ? 0.6f : death ? 0.3f : 0.25f; - - if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y - 150f) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y *= 0.9f; - - npc.velocity.Y -= acceleration; - - if (npc.velocity.Y > velocityY) - npc.velocity.Y = velocityY; - } - else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y - 150f) - { - if (npc.velocity.Y < 0f) - npc.velocity.Y *= 0.9f; - - npc.velocity.Y += acceleration; - - if (npc.velocity.Y < -velocityY) - npc.velocity.Y = -velocityY; - } - - if (npc.position.X + (npc.width / 2) > Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) + 200f) - { - if (npc.velocity.X > 0f) - npc.velocity.X *= 0.9f; - - npc.velocity.X -= acceleration; - - if (npc.velocity.X > velocityX) - npc.velocity.X = velocityX; - } - if (npc.position.X + (npc.width / 2) < Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) + 160f) - { - if (npc.velocity.X < 0f) - npc.velocity.X *= 0.9f; - - npc.velocity.X += acceleration; - - if (npc.velocity.X < -velocityX) - npc.velocity.X = -velocityX; - } - - if (fireSlower) - { - if (Main.npc[(int)npc.ai[1]].ai[1] == 3f && npc.timeLeft > 10) - npc.timeLeft = 10; - - Vector2 cannonArmPosition = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float cannonArmTargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - cannonArmPosition.X; - float cannonArmTargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - cannonArmPosition.Y; - float cannonArmTargetDist = (float)Math.Sqrt(cannonArmTargetX * cannonArmTargetX + cannonArmTargetY * cannonArmTargetY); - npc.rotation = (float)Math.Atan2(cannonArmTargetY, cannonArmTargetX) - MathHelper.PiOver2; - - if (Main.netMode != NetmodeID.MultiplayerClient && !dontAttack) - { - // Fire rocket every 2 seconds (change this as each arm dies to fire more aggressively) - npc.localAI[0] += 1f; - if (!laserAlive) - npc.localAI[0] += 1f; - if (!viceAlive) - npc.localAI[0] += 1f; - if (!sawAlive) - npc.localAI[0] += 1f; - - if (npc.localAI[0] >= 120f) - { - SoundEngine.PlaySound(SoundID.Item62, npc.Center); - npc.localAI[0] = 0f; - npc.TargetClosest(); - int type = ProjectileID.RocketSkeleton; - int damage = npc.GetProjectileDamage(type); - cannonArmTargetDist = 0.5f / cannonArmTargetDist; - cannonArmTargetX *= cannonArmTargetDist; - cannonArmTargetY *= cannonArmTargetDist; - cannonArmPosition.X += cannonArmTargetX * 30f; - cannonArmPosition.Y += cannonArmTargetY * 30f; - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), cannonArmPosition.X, cannonArmPosition.Y, cannonArmTargetX, cannonArmTargetY, type, damage, 0f, Main.myPlayer, npc.target, 1f); - Main.projectile[proj].timeLeft = 600; - } - } - } - else - { - Vector2 cannonSpreadArmPosition = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float cannonSpreadArmTargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - cannonSpreadArmPosition.X; - float cannonSpreadArmTargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - cannonSpreadArmPosition.Y; - npc.rotation = (float)Math.Atan2(cannonSpreadArmTargetY, cannonSpreadArmTargetX) - MathHelper.PiOver2; - - if (Main.netMode != NetmodeID.MultiplayerClient && !dontAttack) - { - // Fire rockets every 2 seconds (change this as each arm dies to fire more aggressively) - npc.localAI[0] += 1f; - if (!laserAlive) - npc.localAI[0] += 0.5f; - if (!viceAlive) - npc.localAI[0] += 0.5f; - if (!sawAlive) - npc.localAI[0] += 0.5f; - - if (npc.localAI[0] >= 180f) - { - SoundEngine.PlaySound(SoundID.Item62, npc.Center); - npc.localAI[0] = 0f; - npc.TargetClosest(); - int type = ProjectileID.RocketSkeleton; - int damage = npc.GetProjectileDamage(type); - Vector2 cannonSpreadTargetDist = Main.player[npc.target].Center - npc.Center; - cannonSpreadTargetDist.Normalize(); - cannonSpreadTargetDist *= 0.5f; - int numProj = bossRush ? 5 : 3; - float rotation = MathHelper.ToRadians(bossRush ? 8 : 5); - for (int i = 0; i < numProj; i++) - { - Vector2 perturbedSpeed = cannonSpreadTargetDist.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + Vector2.Normalize(perturbedSpeed) * 30f, perturbedSpeed, type, damage, 0f, Main.myPlayer, npc.target, 1f); - Main.projectile[proj].timeLeft = 600; - } - } - } - } - - return false; - } - - public static bool BuffedPrimeViceAI(NPC npc, Mod mod) - { - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; - - // Get a target - 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(); - - // Direction - npc.spriteDirection = -(int)npc.ai[0]; - - // Where the vice should be in relation to the head - Vector2 viceArmPosition = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float viceArmIdleXPos = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0] - viceArmPosition.X; - float viceArmIdleYPos = Main.npc[(int)npc.ai[1]].position.Y + 230f - viceArmPosition.Y; - float viceArmIdleDistance = (float)Math.Sqrt(viceArmIdleXPos * viceArmIdleXPos + viceArmIdleYPos * viceArmIdleYPos); - - // Return the vice to its proper location in relation to the head if it's too far away - if (npc.ai[2] != 99f) - { - if (viceArmIdleDistance > 800f) - npc.ai[2] = 99f; - } - else if (viceArmIdleDistance < 400f) - npc.ai[2] = 0f; - - // Despawn if head is gone - if (!Main.npc[(int)npc.ai[1]].active || Main.npc[(int)npc.ai[1]].aiStyle != 32) - { - npc.ai[2] += 10f; - if (npc.ai[2] > 50f || Main.netMode != NetmodeID.Server) - { - npc.life = -1; - npc.HitEffect(0, 10.0); - npc.active = false; - } - } - - CalamityGlobalNPC.primeVice = npc.whoAmI; - - // Check if arms are alive - bool cannonAlive = false; - bool laserAlive = false; - bool sawAlive = false; - if (CalamityGlobalNPC.primeCannon != -1) - { - if (Main.npc[CalamityGlobalNPC.primeCannon].active) - cannonAlive = true; - } - if (CalamityGlobalNPC.primeLaser != -1) - { - if (Main.npc[CalamityGlobalNPC.primeLaser].active) - laserAlive = true; - } - if (CalamityGlobalNPC.primeSaw != -1) - { - if (Main.npc[CalamityGlobalNPC.primeSaw].active) - sawAlive = true; - } - - // Inflict 0 damage for 3 seconds after spawning - if (npc.Calamity().newAI[2] < 180f) - { - npc.Calamity().newAI[2] += 1f; - npc.damage = 0; - } - else - npc.damage = npc.defDamage; - - // Return to the head - if (npc.ai[2] == 99f) - { - float velocityY = bossRush ? 1f : death ? 5f : 7f; - float velocityX = bossRush ? 1.5f : death ? 8f : 10f; - float acceleration = bossRush ? 0.6f : death ? 0.3f : 0.25f; - - if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y *= 0.9f; - - npc.velocity.Y -= acceleration; - - if (npc.velocity.Y > velocityY) - npc.velocity.Y = velocityY; - } - else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y) - { - if (npc.velocity.Y < 0f) - npc.velocity.Y *= 0.9f; - - npc.velocity.Y += acceleration; - - if (npc.velocity.Y < -velocityY) - npc.velocity.Y = -velocityY; - } - - if (npc.position.X + (npc.width / 2) > Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2)) - { - if (npc.velocity.X > 0f) - npc.velocity.X *= 0.9f; - - npc.velocity.X -= acceleration * 2f; - - if (npc.velocity.X > velocityX) - npc.velocity.X = velocityX; - } - if (npc.position.X + (npc.width / 2) < Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2)) - { - if (npc.velocity.X < 0f) - npc.velocity.X *= 0.9f; - - npc.velocity.X += acceleration * 2f; - - if (npc.velocity.X < -velocityX) - npc.velocity.X = -velocityX; - } - } - - // Other phases - else - { - // Stay near the head - if (npc.ai[2] == 0f || npc.ai[2] == 3f) - { - // Despawn if head is despawning - if (Main.npc[(int)npc.ai[1]].ai[1] == 3f && npc.timeLeft > 10) - npc.timeLeft = 10; - - // Start charging after 10 seconds (change this as each arm dies) - npc.ai[3] += 1f; - if (!cannonAlive) - npc.ai[3] += 1f; - if (!laserAlive) - npc.ai[3] += 1f; - if (!sawAlive) - npc.ai[3] += 1f; - - if (npc.ai[3] >= 600f) - { - npc.ai[2] += 1f; - npc.ai[3] = 0f; - npc.TargetClosest(); - npc.netUpdate = true; - } - - float velocityY = bossRush ? 0.5f : death ? 2f : 2.5f; - float velocityX = bossRush ? 1.5f : death ? 7f : 8f; - float velocityX2 = bossRush ? 1.25f : death ? 6f : 7f; - float acceleration = bossRush ? 0.6f : death ? 0.3f : 0.25f; - - if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y + 300f) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y *= 0.9f; - - npc.velocity.Y -= acceleration; - - if (npc.velocity.Y > velocityY) - npc.velocity.Y = velocityY; - } - else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y + 230f) - { - if (npc.velocity.Y < 0f) - npc.velocity.Y *= 0.9f; - - npc.velocity.Y += acceleration; - - if (npc.velocity.Y < -velocityY) - npc.velocity.Y = -velocityY; - } - - if (npc.position.X + (npc.width / 2) > Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) + 250f) - { - if (npc.velocity.X > 0f) - npc.velocity.X *= 0.9f; - - npc.velocity.X -= acceleration; - - if (npc.velocity.X > velocityX) - npc.velocity.X = velocityX; - } - if (npc.position.X + (npc.width / 2) < Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2)) - { - if (npc.velocity.X < 0f) - npc.velocity.X *= 0.9f; - - npc.velocity.X += acceleration; - - if (npc.velocity.X < -velocityX2) - npc.velocity.X = -velocityX2; - } - - Vector2 viceArmReelbackCurrentPos = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float viceArmReelbackXDest = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0] - viceArmReelbackCurrentPos.X; - float viceArmReelbackYDest = Main.npc[(int)npc.ai[1]].position.Y + 230f - viceArmReelbackCurrentPos.Y; - npc.rotation = (float)Math.Atan2(viceArmReelbackYDest, viceArmReelbackXDest) + MathHelper.PiOver2; - return false; - } - - // Charge towards the player - if (npc.ai[2] == 1f) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y *= 0.9f; - - Vector2 viceArmChargePosition = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float viceArmChargeTargetX = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - 280f * npc.ai[0] - viceArmChargePosition.X; - float viceArmChargeTargetY = Main.npc[(int)npc.ai[1]].position.Y + 230f - viceArmChargePosition.Y; - npc.rotation = (float)Math.Atan2(viceArmChargeTargetY, viceArmChargeTargetX) + MathHelper.PiOver2; - - npc.velocity.X = (npc.velocity.X * 5f + Main.npc[(int)npc.ai[1]].velocity.X) / 6f; - npc.velocity.X += 0.5f; - - npc.velocity.Y -= 0.5f; - if (npc.velocity.Y < -12f) - npc.velocity.Y = -12f; - - if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y - 280f) - { - float chargeVelocity = bossRush ? 20f : 16f; - if (!cannonAlive) - chargeVelocity += 1.5f; - if (!laserAlive) - chargeVelocity += 1.5f; - if (!sawAlive) - chargeVelocity += 1.5f; - - npc.ai[2] = 2f; - npc.TargetClosest(); - viceArmChargePosition = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - viceArmChargeTargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - viceArmChargePosition.X; - viceArmChargeTargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - viceArmChargePosition.Y; - float viceArmChargeTargetDist = (float)Math.Sqrt(viceArmChargeTargetX * viceArmChargeTargetX + viceArmChargeTargetY * viceArmChargeTargetY); - viceArmChargeTargetDist = chargeVelocity / viceArmChargeTargetDist; - npc.velocity.X = viceArmChargeTargetX * viceArmChargeTargetDist; - npc.velocity.Y = viceArmChargeTargetY * viceArmChargeTargetDist; - npc.netUpdate = true; - } - } - - // Charge 4 times (more if arms are dead) - else if (npc.ai[2] == 2f) - { - if (npc.position.Y > Main.player[npc.target].position.Y || npc.velocity.Y < 0f) - { - float chargeAmt = 4f; - if (!cannonAlive) - chargeAmt += 1f; - if (!laserAlive) - chargeAmt += 1f; - if (!sawAlive) - chargeAmt += 1f; - - if (npc.ai[3] >= chargeAmt) - { - // Return to head - npc.ai[2] = 3f; - npc.ai[3] = 0f; - npc.TargetClosest(); - return false; - } - - npc.ai[2] = 1f; - npc.ai[3] += 1f; - } - } - - // Different type of charge - else if (npc.ai[2] == 4f) - { - Vector2 viceArmOtherChargePosition = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float viceArmOtherChargeTargetX = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0] - viceArmOtherChargePosition.X; - float viceArmOtherChargeTargetY = Main.npc[(int)npc.ai[1]].position.Y + 230f - viceArmOtherChargePosition.Y; - npc.rotation = (float)Math.Atan2(viceArmOtherChargeTargetY, viceArmOtherChargeTargetX) + MathHelper.PiOver2; - - npc.velocity.Y = (npc.velocity.Y * 5f + Main.npc[(int)npc.ai[1]].velocity.Y) / 6f; - - npc.velocity.X += 0.5f; - if (npc.velocity.X > 12f) - npc.velocity.X = 12f; - - if (npc.position.X + (npc.width / 2) < Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - 500f || npc.position.X + (npc.width / 2) > Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) + 500f) - { - float chargeVelocity = bossRush ? 17.5f : 14f; - if (!cannonAlive) - chargeVelocity += 1.15f; - if (!laserAlive) - chargeVelocity += 1.15f; - if (!sawAlive) - chargeVelocity += 1.15f; - - npc.ai[2] = 5f; - npc.TargetClosest(); - viceArmOtherChargePosition = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - viceArmOtherChargeTargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - viceArmOtherChargePosition.X; - viceArmOtherChargeTargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - viceArmOtherChargePosition.Y; - float viceArmOtherChargeTargetDist = (float)Math.Sqrt(viceArmOtherChargeTargetX * viceArmOtherChargeTargetX + viceArmOtherChargeTargetY * viceArmOtherChargeTargetY); - viceArmOtherChargeTargetDist = chargeVelocity / viceArmOtherChargeTargetDist; - npc.velocity.X = viceArmOtherChargeTargetX * viceArmOtherChargeTargetDist; - npc.velocity.Y = viceArmOtherChargeTargetY * viceArmOtherChargeTargetDist; - npc.netUpdate = true; - } - } - - // Charge 4 times (more if arms are dead) - else if (npc.ai[2] == 5f && npc.position.X + (npc.width / 2) < Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - 100f) - { - float chargeAmt = 4f; - if (!cannonAlive) - chargeAmt += 1f; - if (!laserAlive) - chargeAmt += 1f; - if (!sawAlive) - chargeAmt += 1f; - - if (npc.ai[3] >= chargeAmt) - { - // Return to head - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.TargetClosest(); - return false; - } - - npc.ai[2] = 4f; - npc.ai[3] += 1f; - } - } - - return false; - } - - public static bool BuffedPrimeSawAI(NPC npc, Mod mod) - { - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; - - // Get a target - 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(); - - Vector2 sawArmLocation = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float sawArmIdleXPos = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0] - sawArmLocation.X; - float sawArmIdleYPos = Main.npc[(int)npc.ai[1]].position.Y + 230f - sawArmLocation.Y; - float sawArmIdleDistance = (float)Math.Sqrt(sawArmIdleXPos * sawArmIdleXPos + sawArmIdleYPos * sawArmIdleYPos); - - if (npc.ai[2] != 99f) - { - if (sawArmIdleDistance > 800f) - npc.ai[2] = 99f; - } - else if (sawArmIdleDistance < 400f) - npc.ai[2] = 0f; - - npc.spriteDirection = -(int)npc.ai[0]; - - if (!Main.npc[(int)npc.ai[1]].active || Main.npc[(int)npc.ai[1]].aiStyle != 32) - { - npc.ai[2] += 10f; - if (npc.ai[2] > 50f || Main.netMode != NetmodeID.Server) - { - npc.life = -1; - npc.HitEffect(0, 10.0); - npc.active = false; - } - } - - CalamityGlobalNPC.primeSaw = npc.whoAmI; - - // Check if arms are alive - bool cannonAlive = false; - bool laserAlive = false; - bool viceAlive = false; - if (CalamityGlobalNPC.primeCannon != -1) - { - if (Main.npc[CalamityGlobalNPC.primeCannon].active) - cannonAlive = true; - } - if (CalamityGlobalNPC.primeLaser != -1) - { - if (Main.npc[CalamityGlobalNPC.primeLaser].active) - laserAlive = true; - } - if (CalamityGlobalNPC.primeVice != -1) - { - if (Main.npc[CalamityGlobalNPC.primeVice].active) - viceAlive = true; - } - - // Inflict 0 damage for 3 seconds after spawning - if (npc.Calamity().newAI[2] < 180f) - { - npc.Calamity().newAI[2] += 1f; - npc.damage = 0; - } - else - npc.damage = npc.defDamage; - - if (npc.ai[2] == 99f) - { - float velocityY = bossRush ? 1f : death ? 6f : 7f; - float velocityX = bossRush ? 1.5f : death ? 8f : 10f; - float acceleration = bossRush ? 0.6f : death ? 0.3f : 0.25f; - - if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y *= 0.9f; - - npc.velocity.Y -= acceleration; - - if (npc.velocity.Y > velocityY) - npc.velocity.Y = velocityY; - } - else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y) - { - if (npc.velocity.Y < 0f) - npc.velocity.Y *= 0.9f; - - npc.velocity.Y += acceleration; - - if (npc.velocity.Y < -velocityY) - npc.velocity.Y = -velocityY; - } - - if (npc.position.X + (npc.width / 2) > Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2)) - { - if (npc.velocity.X > 0f) - npc.velocity.X *= 0.9f; - - npc.velocity.X -= acceleration * 2f; - - if (npc.velocity.X > velocityX) - npc.velocity.X = velocityX; - } - if (npc.position.X + (npc.width / 2) < Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2)) - { - if (npc.velocity.X < 0f) - npc.velocity.X *= 0.9f; - - npc.velocity.X += acceleration * 2f; - - if (npc.velocity.X < -velocityX) - npc.velocity.X = -velocityX; - } - } - else - { - if (npc.ai[2] == 0f || npc.ai[2] == 3f) - { - if (Main.npc[(int)npc.ai[1]].ai[1] == 3f && npc.timeLeft > 10) - npc.timeLeft = 10; - - // Start charging after 3 seconds (change this as each arm dies) - npc.ai[3] += 1f; - if (!cannonAlive) - npc.ai[3] += 1f; - if (!laserAlive) - npc.ai[3] += 1f; - if (!viceAlive) - npc.ai[3] += 1f; - - if (npc.ai[3] >= 180f) - { - npc.ai[2] += 1f; - npc.ai[3] = 0f; - npc.TargetClosest(); - npc.netUpdate = true; - } - - float velocityY = bossRush ? 0.5f : death ? 2f : 2.5f; - float velocityX = bossRush ? 1.5f : death ? 8f : 10f; - float acceleration = bossRush ? 0.6f : death ? 0.3f : 0.25f; - - if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y + 320f) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y *= 0.9f; - - npc.velocity.Y -= acceleration; - - if (npc.velocity.Y > velocityY) - npc.velocity.Y = velocityY; - } - else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y + 260f) - { - if (npc.velocity.Y < 0f) - npc.velocity.Y *= 0.9f; - - npc.velocity.Y += acceleration; - - if (npc.velocity.Y < -velocityY) - npc.velocity.Y = -velocityY; - } - - if (npc.position.X + (npc.width / 2) > Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2)) - { - if (npc.velocity.X > 0f) - npc.velocity.X *= 0.9f; - - npc.velocity.X -= acceleration * 1.5f; - - if (npc.velocity.X > velocityX) - npc.velocity.X = velocityX; - } - if (npc.position.X + (npc.width / 2) < Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - 250f) - { - if (npc.velocity.X < 0f) - npc.velocity.X *= 0.9f; - - npc.velocity.X += acceleration * 1.5f; - - if (npc.velocity.X < -velocityX) - npc.velocity.X = -velocityX; - } - - Vector2 sawArmReelbackCurrentPos = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float sawArmReelbackXDest = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0] - sawArmReelbackCurrentPos.X; - float sawArmReelbackYDest = Main.npc[(int)npc.ai[1]].position.Y + 230f - sawArmReelbackCurrentPos.Y; - npc.rotation = (float)Math.Atan2(sawArmReelbackYDest, sawArmReelbackXDest) + MathHelper.PiOver2; - return false; - } - - if (npc.ai[2] == 1f) - { - Vector2 sawArmChargePos = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float sawArmChargeTargetX = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0] - sawArmChargePos.X; - float sawArmChargeTargetY = Main.npc[(int)npc.ai[1]].position.Y + 230f - sawArmChargePos.Y; - npc.rotation = (float)Math.Atan2(sawArmChargeTargetY, sawArmChargeTargetX) + MathHelper.PiOver2; - - npc.velocity.X *= 0.95f; - npc.velocity.Y -= 0.5f; - if (npc.velocity.Y < -12f) - npc.velocity.Y = -12f; - - if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y - 200f) - { - float chargeVelocity = bossRush ? 27.5f : 22f; - if (!cannonAlive) - chargeVelocity += 1.5f; - if (!laserAlive) - chargeVelocity += 1.5f; - if (!viceAlive) - chargeVelocity += 1.5f; - - npc.ai[2] = 2f; - npc.TargetClosest(); - sawArmChargePos = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - sawArmChargeTargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - sawArmChargePos.X; - sawArmChargeTargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - sawArmChargePos.Y; - float sawArmChargeTargetDist = (float)Math.Sqrt(sawArmChargeTargetX * sawArmChargeTargetX + sawArmChargeTargetY * sawArmChargeTargetY); - sawArmChargeTargetDist = chargeVelocity / sawArmChargeTargetDist; - npc.velocity.X = sawArmChargeTargetX * sawArmChargeTargetDist; - npc.velocity.Y = sawArmChargeTargetY * sawArmChargeTargetDist; - npc.netUpdate = true; - } - } - - else if (npc.ai[2] == 2f) - { - if (npc.position.Y > Main.player[npc.target].position.Y || npc.velocity.Y < 0f) - npc.ai[2] = 3f; - } - - else - { - if (npc.ai[2] == 4f) - { - float chargeVelocity = bossRush ? 13.5f : 11f; - if (!cannonAlive) - chargeVelocity += 1.5f; - if (!laserAlive) - chargeVelocity += 1.5f; - if (!viceAlive) - chargeVelocity += 1.5f; - - Vector2 sawArmOtherChargePos = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float sawArmOtherChargeTargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - sawArmOtherChargePos.X; - float sawArmOtherChargeTargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - sawArmOtherChargePos.Y; - float sawArmOtherChargeTargetDist = (float)Math.Sqrt(sawArmOtherChargeTargetX * sawArmOtherChargeTargetX + sawArmOtherChargeTargetY * sawArmOtherChargeTargetY); - sawArmOtherChargeTargetDist = chargeVelocity / sawArmOtherChargeTargetDist; - sawArmOtherChargeTargetX *= sawArmOtherChargeTargetDist; - sawArmOtherChargeTargetY *= sawArmOtherChargeTargetDist; - - float acceleration = bossRush ? 0.3f : death ? 0.1f : 0.08f; - if (npc.velocity.X > sawArmOtherChargeTargetX) - { - if (npc.velocity.X > 0f) - npc.velocity.X *= 0.9f; - - npc.velocity.X -= acceleration; - } - if (npc.velocity.X < sawArmOtherChargeTargetX) - { - if (npc.velocity.X < 0f) - npc.velocity.X *= 0.9f; - - npc.velocity.X += acceleration; - } - if (npc.velocity.Y > sawArmOtherChargeTargetY) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y *= 0.9f; - - npc.velocity.Y -= acceleration; - } - if (npc.velocity.Y < sawArmOtherChargeTargetY) - { - if (npc.velocity.Y < 0f) - npc.velocity.Y *= 0.9f; - - npc.velocity.Y += acceleration; - } - - npc.ai[3] += 1f; - if (npc.justHit) - npc.ai[3] += 2f; - - if (npc.ai[3] >= 600f) - { - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.TargetClosest(); - npc.netUpdate = true; - } - - sawArmOtherChargePos = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - sawArmOtherChargeTargetX = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0] - sawArmOtherChargePos.X; - sawArmOtherChargeTargetY = Main.npc[(int)npc.ai[1]].position.Y + 230f - sawArmOtherChargePos.Y; - npc.rotation = (float)Math.Atan2(sawArmOtherChargeTargetY, sawArmOtherChargeTargetX) + MathHelper.PiOver2; - return false; - } - - if (npc.ai[2] == 5f && ((npc.velocity.X > 0f && npc.position.X + (npc.width / 2) > Main.player[npc.target].position.X + (Main.player[npc.target].width / 2)) || (npc.velocity.X < 0f && npc.position.X + (npc.width / 2) < Main.player[npc.target].position.X + (Main.player[npc.target].width / 2)))) - npc.ai[2] = 0f; - } - } - - return false; - } - } -} diff --git a/NPCs/VanillaNPCOverrides/Bosses/TwinsAI.cs b/NPCs/VanillaNPCOverrides/Bosses/TwinsAI.cs deleted file mode 100644 index 00c33bf5ac..0000000000 --- a/NPCs/VanillaNPCOverrides/Bosses/TwinsAI.cs +++ /dev/null @@ -1,1976 +0,0 @@ -using CalamityMod.Events; -using CalamityMod.Projectiles.Boss; -using CalamityMod.World; -using Microsoft.Xna.Framework; -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Audio; - -namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses -{ - public static class TwinsAI - { - // Only used for Normal and Expert Mode - #region True Melee Retinazer Phase 2 AI - public static bool TrueMeleeRetinazerPhase2AI(NPC npc) - { - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - { - npc.TargetClosest(); - } - bool dead2 = Main.player[npc.target].dead; - float trueMeleeRetiTargetXDist = npc.position.X + (npc.width / 2) - Main.player[npc.target].position.X - (Main.player[npc.target].width / 2); - float trueMeleeRetiTargetYDist = npc.position.Y + npc.height - 59f - Main.player[npc.target].position.Y - (Main.player[npc.target].height / 2); - float trueMeleeRetiTargetDistance = (float)Math.Atan2(trueMeleeRetiTargetYDist, trueMeleeRetiTargetXDist) + 1.57f; - if (trueMeleeRetiTargetDistance < 0f) - { - trueMeleeRetiTargetDistance += MathHelper.TwoPi; - } - else if (trueMeleeRetiTargetDistance > MathHelper.TwoPi) - { - trueMeleeRetiTargetDistance -= MathHelper.TwoPi; - } - float trueMeleeRetiReducedAccel = 0.1f; - if (npc.rotation < trueMeleeRetiTargetDistance) - { - if ((double)(trueMeleeRetiTargetDistance - npc.rotation) > MathHelper.Pi) - { - npc.rotation -= trueMeleeRetiReducedAccel; - } - else - { - npc.rotation += trueMeleeRetiReducedAccel; - } - } - else if (npc.rotation > trueMeleeRetiTargetDistance) - { - if ((double)(npc.rotation - trueMeleeRetiTargetDistance) > MathHelper.Pi) - { - npc.rotation += trueMeleeRetiReducedAccel; - } - else - { - npc.rotation -= trueMeleeRetiReducedAccel; - } - } - if (npc.rotation > trueMeleeRetiTargetDistance - trueMeleeRetiReducedAccel && npc.rotation < trueMeleeRetiTargetDistance + trueMeleeRetiReducedAccel) - { - npc.rotation = trueMeleeRetiTargetDistance; - } - if (npc.rotation < 0f) - { - npc.rotation += MathHelper.TwoPi; - } - else if (npc.rotation > MathHelper.TwoPi) - { - npc.rotation -= MathHelper.TwoPi; - } - if (npc.rotation > trueMeleeRetiTargetDistance - trueMeleeRetiReducedAccel && npc.rotation < trueMeleeRetiTargetDistance + trueMeleeRetiReducedAccel) - { - npc.rotation = trueMeleeRetiTargetDistance; - } - if (Main.rand.NextBool(5)) - { - int retinazerDust = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + npc.height * 0.25f), npc.width, (int)(npc.height * 0.5f), 5, npc.velocity.X, 2f); - Main.dust[retinazerDust].velocity.X *= 0.5f; - Main.dust[retinazerDust].velocity.Y *= 0.1f; - } - if (Main.netMode != NetmodeID.MultiplayerClient && !Main.dayTime && !Main.player[npc.target].dead && npc.timeLeft < 10) - { - for (int i = 0; i < Main.maxNPCs; i++) - { - if (i != npc.whoAmI && Main.npc[i].active && (Main.npc[i].type == NPCID.Retinazer || Main.npc[i].type == NPCID.Spazmatism) && Main.npc[i].timeLeft - 1 > npc.timeLeft) - npc.timeLeft = Main.npc[i].timeLeft - 1; - - } - } - if (Main.dayTime | Main.player[npc.target].dead) - { - npc.velocity.Y -= 0.04f; - if (npc.timeLeft > 10) - npc.timeLeft = 10; - return false; - } - if (npc.ai[0] == 3f) - { - npc.damage = (int)(npc.defDamage * 1.5); - npc.defense = npc.defDefense + 10; - npc.HitSound = SoundID.NPCHit4; - if (npc.ai[1] == 0f) - { - float retinazerMaxSpeed = 8f; - float retinazerAccel = 0.15f; - if (Main.expertMode) - { - retinazerMaxSpeed = 9.5f; - retinazerAccel = 0.175f; - } - if (Main.getGoodWorld) - { - retinazerMaxSpeed *= 1.15f; - retinazerAccel *= 1.15f; - } - // Reduce acceleration if target is holding a true melee weapon - if (Main.player[npc.target].HoldingTrueMeleeWeapon()) - { - retinazerMaxSpeed *= 0.75f; - retinazerAccel *= 0.5f; - } - Vector2 retinazerPosition = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float retinazerTargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - retinazerPosition.X; - float retinazerTargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - 300f - retinazerPosition.Y; - float retinazerTargetDist = (float)Math.Sqrt(retinazerTargetX * retinazerTargetX + retinazerTargetY * retinazerTargetY); - retinazerTargetDist = retinazerMaxSpeed / retinazerTargetDist; - retinazerTargetX *= retinazerTargetDist; - retinazerTargetY *= retinazerTargetDist; - if (npc.velocity.X < retinazerTargetX) - { - npc.velocity.X += retinazerAccel; - if (npc.velocity.X < 0f && retinazerTargetX > 0f) - { - npc.velocity.X += retinazerAccel; - } - } - else if (npc.velocity.X > retinazerTargetX) - { - npc.velocity.X -= retinazerAccel; - if (npc.velocity.X > 0f && retinazerTargetX < 0f) - { - npc.velocity.X -= retinazerAccel; - } - } - if (npc.velocity.Y < retinazerTargetY) - { - npc.velocity.Y += retinazerAccel; - if (npc.velocity.Y < 0f && retinazerTargetY > 0f) - { - npc.velocity.Y += retinazerAccel; - } - } - else if (npc.velocity.Y > retinazerTargetY) - { - npc.velocity.Y -= retinazerAccel; - if (npc.velocity.Y > 0f && retinazerTargetY < 0f) - { - npc.velocity.Y -= retinazerAccel; - } - } - npc.ai[2] += 1f; - if (npc.ai[2] >= 300f) - { - npc.ai[1] = 1f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.TargetClosest(); - npc.netUpdate = true; - } - retinazerPosition = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - retinazerTargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - retinazerPosition.X; - retinazerTargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - retinazerPosition.Y; - npc.rotation = (float)Math.Atan2(retinazerTargetY, retinazerTargetX) - 1.57f; - if (Main.netMode == NetmodeID.MultiplayerClient) - { - return false; - } - npc.localAI[1] += 1f; - if (npc.life < npc.lifeMax * 0.75) - { - npc.localAI[1] += 1f; - } - if (npc.life < npc.lifeMax * 0.5) - { - npc.localAI[1] += 1f; - } - if (npc.life < npc.lifeMax * 0.25) - { - npc.localAI[1] += 1f; - } - if (npc.life < npc.lifeMax * 0.1) - { - npc.localAI[1] += 2f; - } - if (npc.localAI[1] > 180f && 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] = 0f; - float retinazerLaserSpeed = 8.5f; - int attackDamage_ForProjectiles4 = Main.expertMode ? 23 : 25; - if (Main.expertMode) - { - retinazerLaserSpeed = 10f; - } - retinazerTargetDist = (float)Math.Sqrt(retinazerTargetX * retinazerTargetX + retinazerTargetY * retinazerTargetY); - retinazerTargetDist = retinazerLaserSpeed / retinazerTargetDist; - retinazerTargetX *= retinazerTargetDist; - retinazerTargetY *= retinazerTargetDist; - retinazerPosition.X += retinazerTargetX * 15f; - retinazerPosition.Y += retinazerTargetY * 15f; - int retinazerLaser = Projectile.NewProjectile(npc.GetSource_FromAI(), retinazerPosition.X, retinazerPosition.Y, retinazerTargetX, retinazerTargetY, 100, attackDamage_ForProjectiles4, 0f, Main.myPlayer); - } - return false; - } - int retinazerFaceDirection = 1; - if (npc.position.X + (npc.width / 2) < Main.player[npc.target].position.X + Main.player[npc.target].width) - { - retinazerFaceDirection = -1; - } - float retinazerSpeedPhase2 = 8f; - float retinazerAccelPhase2 = 0.2f; - if (Main.expertMode) - { - retinazerSpeedPhase2 = 9.5f; - retinazerAccelPhase2 = 0.25f; - } - if (Main.getGoodWorld) - { - retinazerSpeedPhase2 *= 1.15f; - retinazerAccelPhase2 *= 1.15f; - } - // Reduce acceleration if target is holding a true melee weapon - if (Main.player[npc.target].HoldingTrueMeleeWeapon()) - { - retinazerSpeedPhase2 *= 0.75f; - retinazerAccelPhase2 *= 0.5f; - } - Vector2 retinazerPhase2Pos = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float retinazerPhase2TargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) + (retinazerFaceDirection * 340) - retinazerPhase2Pos.X; - float retinazerPhase2TargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - retinazerPhase2Pos.Y; - float retinazerPhase2TargetDist = (float)Math.Sqrt(retinazerPhase2TargetX * retinazerPhase2TargetX + retinazerPhase2TargetY * retinazerPhase2TargetY); - retinazerPhase2TargetDist = retinazerSpeedPhase2 / retinazerPhase2TargetDist; - retinazerPhase2TargetX *= retinazerPhase2TargetDist; - retinazerPhase2TargetY *= retinazerPhase2TargetDist; - if (npc.velocity.X < retinazerPhase2TargetX) - { - npc.velocity.X += retinazerAccelPhase2; - if (npc.velocity.X < 0f && retinazerPhase2TargetX > 0f) - { - npc.velocity.X += retinazerAccelPhase2; - } - } - else if (npc.velocity.X > retinazerPhase2TargetX) - { - npc.velocity.X -= retinazerAccelPhase2; - if (npc.velocity.X > 0f && retinazerPhase2TargetX < 0f) - { - npc.velocity.X -= retinazerAccelPhase2; - } - } - if (npc.velocity.Y < retinazerPhase2TargetY) - { - npc.velocity.Y += retinazerAccelPhase2; - if (npc.velocity.Y < 0f && retinazerPhase2TargetY > 0f) - { - npc.velocity.Y += retinazerAccelPhase2; - } - } - else if (npc.velocity.Y > retinazerPhase2TargetY) - { - npc.velocity.Y -= retinazerAccelPhase2; - if (npc.velocity.Y > 0f && retinazerPhase2TargetY < 0f) - { - npc.velocity.Y -= retinazerAccelPhase2; - } - } - retinazerPhase2Pos = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - retinazerPhase2TargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - retinazerPhase2Pos.X; - retinazerPhase2TargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - retinazerPhase2Pos.Y; - npc.rotation = (float)Math.Atan2(retinazerPhase2TargetY, retinazerPhase2TargetX) - 1.57f; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[1] += 1f; - if (npc.life < npc.lifeMax * 0.75) - { - npc.localAI[1] += 0.5f; - } - if (npc.life < npc.lifeMax * 0.5) - { - npc.localAI[1] += 0.75f; - } - if (npc.life < npc.lifeMax * 0.25) - { - npc.localAI[1] += 1f; - } - if (npc.life < npc.lifeMax * 0.1) - { - npc.localAI[1] += 1.5f; - } - if (Main.expertMode) - { - npc.localAI[1] += 1.5f; - } - if (npc.localAI[1] > 60f && 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] = 0f; - int attackDamage_ForProjectiles5 = Main.expertMode ? 17 : 18; - retinazerPhase2TargetDist = (float)Math.Sqrt(retinazerPhase2TargetX * retinazerPhase2TargetX + retinazerPhase2TargetY * retinazerPhase2TargetY); - retinazerPhase2TargetDist = 9f / retinazerPhase2TargetDist; - retinazerPhase2TargetX *= retinazerPhase2TargetDist; - retinazerPhase2TargetY *= retinazerPhase2TargetDist; - retinazerPhase2Pos.X += retinazerPhase2TargetX * 15f; - retinazerPhase2Pos.Y += retinazerPhase2TargetY * 15f; - int retinazerPhase2Laser = Projectile.NewProjectile(npc.GetSource_FromAI(), retinazerPhase2Pos.X, retinazerPhase2Pos.Y, retinazerPhase2TargetX, retinazerPhase2TargetY, 100, attackDamage_ForProjectiles5, 0f, Main.myPlayer); - } - } - npc.ai[2] += 1f; - if (npc.ai[2] >= 180f) - { - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.TargetClosest(); - npc.netUpdate = true; - } - - return false; - } - - return true; - } - #endregion - - #region Twins AI - public static bool BuffedRetinazerAI(NPC npc, Mod mod) - { - CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; - - // Get a target - 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(); - - float enrageScale = bossRush ? 0.5f : 0f; - if (Main.dayTime || bossRush) - { - npc.Calamity().CurrentlyEnraged = !bossRush; - enrageScale += 1f; - } - - // Percent life remaining - float lifeRatio = npc.life / (float)npc.lifeMax; - - // Easier to send info to Spazmatism - CalamityGlobalNPC.laserEye = npc.whoAmI; - - // Check for Spazmatism - bool spazAlive = false; - if (CalamityGlobalNPC.fireEye != -1) - spazAlive = Main.npc[CalamityGlobalNPC.fireEye].active; - - bool enrage = lifeRatio < 0.25f; - - // I'm not commenting this entire fucking thing, already did spaz, I'm not doing ret - float retinazerHoverXDest = npc.position.X + (npc.width / 2) - Main.player[npc.target].position.X - (Main.player[npc.target].width / 2); - float retinazerHoverYDest = npc.position.Y + npc.height - 59f - Main.player[npc.target].position.Y - (Main.player[npc.target].height / 2); - - float retinazerHoverRotation = (float)Math.Atan2(retinazerHoverYDest, retinazerHoverXDest) + MathHelper.PiOver2; - if (retinazerHoverRotation < 0f) - retinazerHoverRotation += MathHelper.TwoPi; - else if (retinazerHoverRotation > MathHelper.TwoPi) - retinazerHoverRotation -= MathHelper.TwoPi; - - float retinazerRotationSpeed = 0.1f; - if (npc.rotation < retinazerHoverRotation) - { - if ((retinazerHoverRotation - npc.rotation) > MathHelper.Pi) - npc.rotation -= retinazerRotationSpeed; - else - npc.rotation += retinazerRotationSpeed; - } - else if (npc.rotation > retinazerHoverRotation) - { - if ((npc.rotation - retinazerHoverRotation) > MathHelper.Pi) - npc.rotation += retinazerRotationSpeed; - else - npc.rotation -= retinazerRotationSpeed; - } - - if (npc.rotation > retinazerHoverRotation - retinazerRotationSpeed && npc.rotation < retinazerHoverRotation + retinazerRotationSpeed) - npc.rotation = retinazerHoverRotation; - - if (npc.rotation < 0f) - npc.rotation += MathHelper.TwoPi; - else if (npc.rotation > MathHelper.TwoPi) - npc.rotation -= MathHelper.TwoPi; - - if (npc.rotation > retinazerHoverRotation - retinazerRotationSpeed && npc.rotation < retinazerHoverRotation + retinazerRotationSpeed) - npc.rotation = retinazerHoverRotation; - - if (Main.rand.NextBool(5)) - { - int retiDust = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + npc.height * 0.25f), npc.width, (int)(npc.height * 0.5f), 5, npc.velocity.X, 2f, 0, default, 1f); - Dust dust = Main.dust[retiDust]; - dust.velocity.X *= 0.5f; - dust.velocity.Y *= 0.1f; - } - - if (Main.netMode != NetmodeID.MultiplayerClient && !Main.player[npc.target].dead && npc.timeLeft < 10) - { - for (int i = 0; i < Main.maxNPCs; i++) - { - if (i != npc.whoAmI && Main.npc[i].active && (Main.npc[i].type == NPCID.Retinazer || Main.npc[i].type == NPCID.Spazmatism) && Main.npc[i].timeLeft - 1 > npc.timeLeft) - npc.timeLeft = Main.npc[i].timeLeft - 1; - - } - } - - Vector2 mechQueenSpacing = Vector2.Zero; - if (NPC.IsMechQueenUp) - { - NPC nPC = Main.npc[NPC.mechQueen]; - Vector2 mechQueenCenter = nPC.GetMechQueenCenter(); - Vector2 eyePosition = new Vector2(-150f, -250f); - eyePosition *= 0.75f; - float mechdusaRotation = nPC.velocity.X * 0.025f; - mechQueenSpacing = mechQueenCenter + eyePosition; - mechQueenSpacing = mechQueenSpacing.RotatedBy(mechdusaRotation, mechQueenCenter); - } - - npc.reflectsProjectiles = false; - - if (Main.player[npc.target].dead) - { - npc.velocity.Y -= 0.04f; - if (npc.timeLeft > 10) - { - npc.timeLeft = 10; - return false; - } - } - - else if (npc.ai[0] == 0f) - { - if (npc.ai[1] == 0f) - { - float retinazerPhase1MaxSpeed = 8.25f; - float retinazerPhase1Acceleration = 0.115f; - retinazerPhase1MaxSpeed += 4f * enrageScale; - retinazerPhase1Acceleration += 0.05f * enrageScale; - - if (death) - { - retinazerPhase1MaxSpeed += 8f * (1f - lifeRatio); - retinazerPhase1Acceleration += 0.1f * (1f - lifeRatio); - } - - if (Main.getGoodWorld) - { - retinazerPhase1MaxSpeed *= 1.15f; - retinazerPhase1Acceleration *= 1.15f; - } - - int retinazerFaceDirection = 1; - if (npc.position.X + (npc.width / 2) < Main.player[npc.target].position.X + Main.player[npc.target].width) - retinazerFaceDirection = -1; - - Vector2 retinazerPosition = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float retinazerTargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) + (retinazerFaceDirection * 300) - retinazerPosition.X; - float retinazerTargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - 300f - retinazerPosition.Y; - - if (NPC.IsMechQueenUp) - { - retinazerPhase1MaxSpeed = 14f; - retinazerTargetX = mechQueenSpacing.X; - retinazerTargetY = mechQueenSpacing.Y; - retinazerTargetX -= retinazerPosition.X; - retinazerTargetY -= retinazerPosition.Y; - } - - float retinazerTargetDist = (float)Math.Sqrt(retinazerTargetX * retinazerTargetX + retinazerTargetY * retinazerTargetY); - float retinazerTargetDistCopy = retinazerTargetDist; - - if (NPC.IsMechQueenUp) - { - if (retinazerTargetDist > retinazerPhase1MaxSpeed) - { - retinazerTargetDist = retinazerPhase1MaxSpeed / retinazerTargetDist; - retinazerTargetX *= retinazerTargetDist; - retinazerTargetY *= retinazerTargetDist; - } - - npc.velocity.X = (npc.velocity.X * 59f + retinazerTargetX) / 60f; - npc.velocity.Y = (npc.velocity.Y * 59f + retinazerTargetY) / 60f; - } - else - { - retinazerTargetDist = retinazerPhase1MaxSpeed / retinazerTargetDist; - retinazerTargetX *= retinazerTargetDist; - retinazerTargetY *= retinazerTargetDist; - - if (npc.velocity.X < retinazerTargetX) - { - npc.velocity.X += retinazerPhase1Acceleration; - if (npc.velocity.X < 0f && retinazerTargetX > 0f) - npc.velocity.X += retinazerPhase1Acceleration; - } - else if (npc.velocity.X > retinazerTargetX) - { - npc.velocity.X -= retinazerPhase1Acceleration; - if (npc.velocity.X > 0f && retinazerTargetX < 0f) - npc.velocity.X -= retinazerPhase1Acceleration; - } - if (npc.velocity.Y < retinazerTargetY) - { - npc.velocity.Y += retinazerPhase1Acceleration; - if (npc.velocity.Y < 0f && retinazerTargetY > 0f) - npc.velocity.Y += retinazerPhase1Acceleration; - } - else if (npc.velocity.Y > retinazerTargetY) - { - npc.velocity.Y -= retinazerPhase1Acceleration; - if (npc.velocity.Y > 0f && retinazerTargetY < 0f) - npc.velocity.Y -= retinazerPhase1Acceleration; - } - } - - npc.ai[2] += 1f; - float phaseGateValue = 450f - (death ? 900f * (1f - lifeRatio) : 0f); - float laserGateValue = 30f; - if (NPC.IsMechQueenUp) - { - phaseGateValue = 900f; - laserGateValue = ((!NPC.npcsFoundForCheckActive[NPCID.TheDestroyerBody]) ? 60f : 90f); - } - if (npc.ai[2] >= phaseGateValue) - { - npc.ai[1] = 1f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.TargetClosest(); - npc.netUpdate = true; - } - - else if (npc.position.Y + npc.height < Main.player[npc.target].position.Y && retinazerTargetDistCopy < 400f) - { - if (!Main.player[npc.target].dead) - { - npc.ai[3] += 1f; - if (Main.getGoodWorld) - npc.ai[3] += 0.5f; - } - - if (npc.ai[3] >= laserGateValue) - { - npc.ai[3] = 0f; - retinazerPosition = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - retinazerTargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - retinazerPosition.X; - retinazerTargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - retinazerPosition.Y; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - float retinazerSpeed = 10.5f; - retinazerSpeed += 3f * enrageScale; - int type = ProjectileID.EyeLaser; - int damage = npc.GetProjectileDamage(type); - - retinazerTargetDist = (float)Math.Sqrt(retinazerTargetX * retinazerTargetX + retinazerTargetY * retinazerTargetY); - retinazerTargetDist = retinazerSpeed / retinazerTargetDist; - retinazerTargetX *= retinazerTargetDist; - retinazerTargetY *= retinazerTargetDist; - retinazerPosition.X += retinazerTargetX * 15f; - retinazerPosition.Y += retinazerTargetY * 15f; - - Projectile.NewProjectile(npc.GetSource_FromAI(), retinazerPosition.X, retinazerPosition.Y, retinazerTargetX, retinazerTargetY, type, damage, 0f, Main.myPlayer, 0f, 0f); - } - } - } - } - - else if (npc.ai[1] == 1f) - { - npc.rotation = retinazerHoverRotation; - float retinazerChargeSpeed = 15f; - retinazerChargeSpeed += 10f * enrageScale; - if (death) - retinazerChargeSpeed += 12f * (1f - lifeRatio); - if (Main.getGoodWorld) - retinazerChargeSpeed += 2f; - - Vector2 retinazerChargePos = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float retinazerChargeTargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - retinazerChargePos.X; - float retinazerChargeTargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - retinazerChargePos.Y; - float retinazerChargeTargetDist = (float)Math.Sqrt(retinazerChargeTargetX * retinazerChargeTargetX + retinazerChargeTargetY * retinazerChargeTargetY); - retinazerChargeTargetDist = retinazerChargeSpeed / retinazerChargeTargetDist; - npc.velocity.X = retinazerChargeTargetX * retinazerChargeTargetDist; - npc.velocity.Y = retinazerChargeTargetY * retinazerChargeTargetDist; - npc.ai[1] = 2f; - } - else if (npc.ai[1] == 2f) - { - npc.ai[2] += 1f; - if (npc.ai[2] >= 25f) - { - npc.velocity *= 0.96f; - if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) - { - npc.velocity.X = 0f; - } - if (npc.velocity.Y > -0.1 && npc.velocity.Y < 0.1) - { - npc.velocity.Y = 0f; - } - } - else - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) - MathHelper.PiOver2; - - if (npc.ai[2] >= 70f) - { - npc.ai[3] += 1f; - npc.ai[2] = 0f; - npc.TargetClosest(); - npc.rotation = retinazerHoverRotation; - if (npc.ai[3] >= 3f) - { - npc.ai[1] = 0f; - npc.ai[3] = 0f; - } - else - npc.ai[1] = 1f; - } - } - - // Enter phase 2 earlier - if (lifeRatio < 0.7f) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.TargetClosest(); - npc.netUpdate = true; - } - } - - else if (npc.ai[0] == 1f || npc.ai[0] == 2f) - { - if (NPC.IsMechQueenUp) - npc.reflectsProjectiles = true; - - if (npc.ai[0] == 1f) - { - npc.ai[2] += 0.005f; - if (npc.ai[2] > 0.5) - npc.ai[2] = 0.5f; - } - else - { - npc.ai[2] -= 0.005f; - if (npc.ai[2] < 0f) - npc.ai[2] = 0f; - } - - npc.rotation += npc.ai[2]; - npc.ai[1] += 1f; - if (npc.ai[1] == 100f) - { - npc.ai[0] += 1f; - npc.ai[1] = 0f; - if (npc.ai[0] == 3f) - npc.ai[2] = 0f; - else - { - SoundEngine.PlaySound(SoundID.NPCHit1, npc.position); - - if (Main.netMode != NetmodeID.Server) - { - for (int i = 0; i < 2; i++) - { - Gore.NewGore(npc.GetSource_FromAI(), npc.position, new Vector2(Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f), 143, 1f); - Gore.NewGore(npc.GetSource_FromAI(), npc.position, new Vector2(Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f), 7, 1f); - Gore.NewGore(npc.GetSource_FromAI(), npc.position, new Vector2(Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f), 6, 1f); - } - } - - for (int j = 0; j < 20; j++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f, 0, default, 1f); - } - - SoundEngine.PlaySound(SoundID.Roar, npc.position); - } - } - - Dust.NewDust(npc.position, npc.width, npc.height, 5, Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f, 0, default, 1f); - - npc.velocity *= 0.98f; - - if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) - npc.velocity.X = 0f; - if (npc.velocity.Y > -0.1 && npc.velocity.Y < 0.1) - npc.velocity.Y = 0f; - } - else - { - // If in phase 2 but Spaz isn't - bool spazInPhase1 = false; - if (CalamityGlobalNPC.fireEye != -1) - { - if (Main.npc[CalamityGlobalNPC.fireEye].active) - spazInPhase1 = Main.npc[CalamityGlobalNPC.fireEye].ai[0] == 1f || Main.npc[CalamityGlobalNPC.fireEye].ai[0] == 2f || Main.npc[CalamityGlobalNPC.fireEye].ai[0] == 0f; - } - - npc.chaseable = !spazInPhase1; - - npc.damage = (int)(npc.defDamage * 1.5); - npc.defense = npc.defDefense + 10; - calamityGlobalNPC.DR = spazInPhase1 ? 0.9999f : 0.2f; - calamityGlobalNPC.unbreakableDR = spazInPhase1; - calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = spazInPhase1; - - npc.HitSound = SoundID.NPCHit4; - - if (npc.ai[1] == 0f) - { - float retinazerPhase2MaxSpeed = 9.5f + (death ? 3f * (0.7f - lifeRatio) : 0f); - float retinazerPhase2Accel = 0.175f + (death ? 0.05f * (0.7f - lifeRatio) : 0f); - retinazerPhase2MaxSpeed += 4.5f * enrageScale; - retinazerPhase2Accel += 0.075f * enrageScale; - - if (Main.getGoodWorld) - { - retinazerPhase2MaxSpeed *= 1.15f; - retinazerPhase2Accel *= 1.15f; - } - - // Reduce acceleration if target is holding a true melee weapon - if (Main.player[npc.target].HoldingTrueMeleeWeapon()) - { - retinazerPhase2MaxSpeed *= 0.75f; - retinazerPhase2Accel *= 0.5f; - } - - Vector2 eyePosition = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float retinazerPhase2TargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - eyePosition.X; - float retinazerPhase2TargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - 300f - eyePosition.Y; - - if (NPC.IsMechQueenUp) - { - retinazerPhase2MaxSpeed = 14f; - retinazerPhase2TargetX = mechQueenSpacing.X; - retinazerPhase2TargetY = mechQueenSpacing.Y; - retinazerPhase2TargetX -= eyePosition.X; - retinazerPhase2TargetY -= eyePosition.Y; - } - - float retinazerPhase2TargetDist = (float)Math.Sqrt(retinazerPhase2TargetX * retinazerPhase2TargetX + retinazerPhase2TargetY * retinazerPhase2TargetY); - - if (NPC.IsMechQueenUp) - { - if (retinazerPhase2TargetDist > retinazerPhase2MaxSpeed) - { - retinazerPhase2TargetDist = retinazerPhase2MaxSpeed / retinazerPhase2TargetDist; - retinazerPhase2TargetX *= retinazerPhase2TargetDist; - retinazerPhase2TargetY *= retinazerPhase2TargetDist; - } - - npc.velocity.X = (npc.velocity.X * 4f + retinazerPhase2TargetX) / 5f; - npc.velocity.Y = (npc.velocity.Y * 4f + retinazerPhase2TargetY) / 5f; - } - else - { - retinazerPhase2TargetDist = retinazerPhase2MaxSpeed / retinazerPhase2TargetDist; - retinazerPhase2TargetX *= retinazerPhase2TargetDist; - retinazerPhase2TargetY *= retinazerPhase2TargetDist; - - if (npc.velocity.X < retinazerPhase2TargetX) - { - npc.velocity.X += retinazerPhase2Accel; - if (npc.velocity.X < 0f && retinazerPhase2TargetX > 0f) - npc.velocity.X += retinazerPhase2Accel; - } - else if (npc.velocity.X > retinazerPhase2TargetX) - { - npc.velocity.X -= retinazerPhase2Accel; - if (npc.velocity.X > 0f && retinazerPhase2TargetX < 0f) - npc.velocity.X -= retinazerPhase2Accel; - } - if (npc.velocity.Y < retinazerPhase2TargetY) - { - npc.velocity.Y += retinazerPhase2Accel; - if (npc.velocity.Y < 0f && retinazerPhase2TargetY > 0f) - npc.velocity.Y += retinazerPhase2Accel; - } - else if (npc.velocity.Y > retinazerPhase2TargetY) - { - npc.velocity.Y -= retinazerPhase2Accel; - if (npc.velocity.Y > 0f && retinazerPhase2TargetY < 0f) - npc.velocity.Y -= retinazerPhase2Accel; - } - } - - npc.ai[2] += spazAlive ? 1f : 1.25f; - float phaseGateValue = NPC.IsMechQueenUp ? 900f : 300f - (death ? 120f * (0.7f - lifeRatio) : 0f); - if (npc.ai[2] >= phaseGateValue) - { - npc.ai[1] = 1f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.TargetClosest(); - npc.netUpdate = true; - } - - eyePosition = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - retinazerPhase2TargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - eyePosition.X; - retinazerPhase2TargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - eyePosition.Y; - npc.rotation = (float)Math.Atan2(retinazerPhase2TargetY, retinazerPhase2TargetX) - MathHelper.PiOver2; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[1] += 1f + (death ? 0.7f - lifeRatio : 0f); - if (npc.localAI[1] >= (spazAlive ? 72f : 24f)) - { - bool canHit = Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height); - if (canHit || !spazAlive || enrage) - { - npc.localAI[1] = 0f; - float retinazerPhase2LaserSpeed = 10f; - retinazerPhase2LaserSpeed += enrageScale; - int type = ProjectileID.DeathLaser; - int damage = npc.GetProjectileDamage(type); - - retinazerPhase2TargetDist = (float)Math.Sqrt(retinazerPhase2TargetX * retinazerPhase2TargetX + retinazerPhase2TargetY * retinazerPhase2TargetY); - retinazerPhase2TargetDist = retinazerPhase2LaserSpeed / retinazerPhase2TargetDist; - retinazerPhase2TargetX *= retinazerPhase2TargetDist; - retinazerPhase2TargetY *= retinazerPhase2TargetDist; - eyePosition.X += retinazerPhase2TargetX * 15f; - eyePosition.Y += retinazerPhase2TargetY * 15f; - - if (canHit) - Projectile.NewProjectile(npc.GetSource_FromAI(), eyePosition.X, eyePosition.Y, retinazerPhase2TargetX, retinazerPhase2TargetY, type, damage, 0f, Main.myPlayer, 0f, 0f); - else - { - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), eyePosition.X, eyePosition.Y, retinazerPhase2TargetX, retinazerPhase2TargetY, type, damage, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[proj].tileCollide = false; - Main.projectile[proj].timeLeft = 300; - } - } - } - } - } - else - { - if (npc.ai[1] == 1f) - { - int retinazerPhase2FaceDirection = 1; - if (npc.position.X + (npc.width / 2) < Main.player[npc.target].position.X + Main.player[npc.target].width) - retinazerPhase2FaceDirection = -1; - - float retinazerPhase2RapidFireMaxSpeed = 9.5f + (death ? 3f * (0.7f - lifeRatio) : 0f); - float retinazerPhase2RapidFireAccel = 0.25f + (death ? 0.075f * (0.7f - lifeRatio) : 0f); - retinazerPhase2RapidFireMaxSpeed += 4.5f * enrageScale; - retinazerPhase2RapidFireAccel += 0.15f * enrageScale; - - if (Main.getGoodWorld) - { - retinazerPhase2RapidFireMaxSpeed *= 1.15f; - retinazerPhase2RapidFireAccel *= 1.15f; - } - - // Reduce acceleration if target is holding a true melee weapon - if (Main.player[npc.target].HoldingTrueMeleeWeapon()) - { - retinazerPhase2RapidFireMaxSpeed *= 0.75f; - retinazerPhase2RapidFireAccel *= 0.5f; - } - - Vector2 retinazerPhase2RapidFirePos = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float retinazerPhase2RapidFireTargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) + (retinazerPhase2FaceDirection * 340) - retinazerPhase2RapidFirePos.X; - float retinazerPhase2RapidFireTargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - retinazerPhase2RapidFirePos.Y; - float retinazerPhase2RapidFireTargetDist = (float)Math.Sqrt(retinazerPhase2RapidFireTargetX * retinazerPhase2RapidFireTargetX + retinazerPhase2RapidFireTargetY * retinazerPhase2RapidFireTargetY); - retinazerPhase2RapidFireTargetDist = retinazerPhase2RapidFireMaxSpeed / retinazerPhase2RapidFireTargetDist; - retinazerPhase2RapidFireTargetX *= retinazerPhase2RapidFireTargetDist; - retinazerPhase2RapidFireTargetY *= retinazerPhase2RapidFireTargetDist; - - if (npc.velocity.X < retinazerPhase2RapidFireTargetX) - { - npc.velocity.X += retinazerPhase2RapidFireAccel; - if (npc.velocity.X < 0f && retinazerPhase2RapidFireTargetX > 0f) - npc.velocity.X += retinazerPhase2RapidFireAccel; - } - else if (npc.velocity.X > retinazerPhase2RapidFireTargetX) - { - npc.velocity.X -= retinazerPhase2RapidFireAccel; - if (npc.velocity.X > 0f && retinazerPhase2RapidFireTargetX < 0f) - npc.velocity.X -= retinazerPhase2RapidFireAccel; - } - if (npc.velocity.Y < retinazerPhase2RapidFireTargetY) - { - npc.velocity.Y += retinazerPhase2RapidFireAccel; - if (npc.velocity.Y < 0f && retinazerPhase2RapidFireTargetY > 0f) - npc.velocity.Y += retinazerPhase2RapidFireAccel; - } - else if (npc.velocity.Y > retinazerPhase2RapidFireTargetY) - { - npc.velocity.Y -= retinazerPhase2RapidFireAccel; - if (npc.velocity.Y > 0f && retinazerPhase2RapidFireTargetY < 0f) - npc.velocity.Y -= retinazerPhase2RapidFireAccel; - } - - retinazerPhase2RapidFirePos = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - retinazerPhase2RapidFireTargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - retinazerPhase2RapidFirePos.X; - retinazerPhase2RapidFireTargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - retinazerPhase2RapidFirePos.Y; - npc.rotation = (float)Math.Atan2(retinazerPhase2RapidFireTargetY, retinazerPhase2RapidFireTargetX) - MathHelper.PiOver2; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[1] += 1f + (death ? 0.7f - lifeRatio : 0f); - if (npc.localAI[1] > (spazAlive ? 24f : 8f)) - { - bool canHit = Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height); - if (canHit || !spazAlive || enrage) - { - npc.localAI[1] = 0f; - int type = ProjectileID.DeathLaser; - int damage = (int)Math.Round(npc.GetProjectileDamage(type) * 0.75); - - retinazerPhase2RapidFireTargetDist = (float)Math.Sqrt(retinazerPhase2RapidFireTargetX * retinazerPhase2RapidFireTargetX + retinazerPhase2RapidFireTargetY * retinazerPhase2RapidFireTargetY); - retinazerPhase2RapidFireTargetDist = 9f / retinazerPhase2RapidFireTargetDist; - retinazerPhase2RapidFireTargetX *= retinazerPhase2RapidFireTargetDist; - retinazerPhase2RapidFireTargetY *= retinazerPhase2RapidFireTargetDist; - retinazerPhase2RapidFirePos.X += retinazerPhase2RapidFireTargetX * 15f; - retinazerPhase2RapidFirePos.Y += retinazerPhase2RapidFireTargetY * 15f; - - if (canHit) - Projectile.NewProjectile(npc.GetSource_FromAI(), retinazerPhase2RapidFirePos.X, retinazerPhase2RapidFirePos.Y, retinazerPhase2RapidFireTargetX, retinazerPhase2RapidFireTargetY, type, damage, 0f, Main.myPlayer, 0f, 0f); - else - { - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), retinazerPhase2RapidFirePos.X, retinazerPhase2RapidFirePos.Y, retinazerPhase2RapidFireTargetX, retinazerPhase2RapidFireTargetY, type, damage, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[proj].tileCollide = false; - Main.projectile[proj].timeLeft = 300; - } - } - } - } - - npc.ai[2] += spazAlive ? 1f : 1.5f; - if (npc.ai[2] >= 180f - (death ? 90f * (0.7f - lifeRatio) : 0f)) - { - npc.ai[1] = (!spazAlive || enrage) ? 4f : 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.TargetClosest(); - npc.netUpdate = true; - } - } - - // Charge - else if (npc.ai[1] == 2f) - { - // Set rotation and velocity - npc.rotation = retinazerHoverRotation; - float retinazerPhase3ChargeSpeed = 22f + (death ? 8f * (0.7f - lifeRatio) : 0f); - retinazerPhase3ChargeSpeed += 10f * enrageScale; - - if (!spazAlive) - retinazerPhase3ChargeSpeed += 2f; - - if (Main.getGoodWorld) - retinazerPhase3ChargeSpeed += 2f; - - Vector2 retinazerPhase3ChargePos = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float retinazerPhase3ChargeTargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - retinazerPhase3ChargePos.X; - float retinazerPhase3ChargeTargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - retinazerPhase3ChargePos.Y; - float retinazerPhase3ChargeTargetDist = (float)Math.Sqrt(retinazerPhase3ChargeTargetX * retinazerPhase3ChargeTargetX + retinazerPhase3ChargeTargetY * retinazerPhase3ChargeTargetY); - retinazerPhase3ChargeTargetDist = retinazerPhase3ChargeSpeed / retinazerPhase3ChargeTargetDist; - npc.velocity.X = retinazerPhase3ChargeTargetX * retinazerPhase3ChargeTargetDist; - npc.velocity.Y = retinazerPhase3ChargeTargetY * retinazerPhase3ChargeTargetDist; - npc.ai[1] = 3f; - } - - else if (npc.ai[1] == 3f) - { - npc.ai[2] += 1f; - - float chargeTime = spazAlive ? 45f : 30f; - if (npc.ai[3] % 3f == 0f) - chargeTime = spazAlive ? 90f : 60f; - if (death) - chargeTime -= chargeTime * 0.25f * (0.7f - lifeRatio); - chargeTime -= chargeTime / 5 * enrageScale; - - // Slow down - if (npc.ai[2] >= chargeTime) - { - npc.velocity *= 0.93f; - if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) - npc.velocity.X = 0f; - if (npc.velocity.Y > -0.1 && npc.velocity.Y < 0.1) - npc.velocity.Y = 0f; - } - else - { - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) - MathHelper.PiOver2; - - if (npc.ai[3] % 3f == 0f) - { - float fireRate = spazAlive ? 13f : 9f; - - if (npc.ai[2] % fireRate == 0f) - { - Vector2 retinazerPhase3ChargeLaserPos = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float retinazerPhase3ChargeLaserTargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - retinazerPhase3ChargeLaserPos.X; - float retinazerPhase3ChargeLaserTargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - retinazerPhase3ChargeLaserPos.Y; - float retinazerPhase3ChargeLaserTargetDist = (float)Math.Sqrt(retinazerPhase3ChargeLaserTargetX * retinazerPhase3ChargeLaserTargetX + retinazerPhase3ChargeLaserTargetY * retinazerPhase3ChargeLaserTargetY); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - SoundEngine.PlaySound(SoundID.Item33, npc.position); - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - - retinazerPhase3ChargeLaserPos = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - retinazerPhase3ChargeLaserTargetX = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - retinazerPhase3ChargeLaserPos.X; - retinazerPhase3ChargeLaserTargetY = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - retinazerPhase3ChargeLaserPos.Y; - retinazerPhase3ChargeLaserTargetDist = (float)Math.Sqrt(retinazerPhase3ChargeLaserTargetX * retinazerPhase3ChargeLaserTargetX + retinazerPhase3ChargeLaserTargetY * retinazerPhase3ChargeLaserTargetY); - retinazerPhase3ChargeLaserTargetDist = 6f / retinazerPhase3ChargeLaserTargetDist; - retinazerPhase3ChargeLaserTargetX *= retinazerPhase3ChargeLaserTargetDist; - retinazerPhase3ChargeLaserTargetY *= retinazerPhase3ChargeLaserTargetDist; - retinazerPhase3ChargeLaserPos.X += retinazerPhase3ChargeLaserTargetX; - retinazerPhase3ChargeLaserPos.Y += retinazerPhase3ChargeLaserTargetY; - - Projectile.NewProjectile(npc.GetSource_FromAI(), retinazerPhase3ChargeLaserPos.X, retinazerPhase3ChargeLaserPos.Y, retinazerPhase3ChargeLaserTargetX, retinazerPhase3ChargeLaserTargetY, type, damage, 0f, Main.myPlayer, 0f, 0f); - } - } - } - } - - // Charge four times - float chargeGateValue = 30f; - chargeGateValue -= chargeGateValue / 4 * enrageScale; - if (npc.ai[2] >= chargeTime + chargeGateValue) - { - npc.ai[2] = 0f; - npc.ai[3] += 1f; - npc.TargetClosest(); - npc.rotation = retinazerHoverRotation; - float maxChargeAmt = spazAlive ? 2f : 4f; - if (npc.ai[3] >= maxChargeAmt) - { - npc.ai[1] = 0f; - npc.ai[3] = 0f; - } - else - npc.ai[1] = 4f; - } - } - - // Get in position for charge - else if (npc.ai[1] == 4f) - { - int chargeLineUpDist = spazAlive ? 600 : 500; - float chargeSpeed = 12f + (death ? 4f * (0.7f - lifeRatio) : 0f); - float chargeAccel = 0.3f + (death ? 0.1f * (0.7f - lifeRatio) : 0f); - - if (spazAlive) - { - chargeSpeed *= 0.75f; - chargeAccel *= 0.75f; - } - - if (Main.getGoodWorld) - { - chargeSpeed *= 1.15f; - chargeAccel *= 1.15f; - } - - int retinazerPhase2FaceDirection = 1; - if (npc.position.X + (npc.width / 2) < Main.player[npc.target].position.X + Main.player[npc.target].width) - retinazerPhase2FaceDirection = -1; - - Vector2 spazmatismRetDeadChargePos = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float chargeTargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) + (chargeLineUpDist * retinazerPhase2FaceDirection) - spazmatismRetDeadChargePos.X; - float chargeTargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - spazmatismRetDeadChargePos.Y; - float chargeTargetDist = (float)Math.Sqrt(chargeTargetX * chargeTargetX + chargeTargetY * chargeTargetY); - - chargeTargetDist = chargeSpeed / chargeTargetDist; - chargeTargetX *= chargeTargetDist; - chargeTargetY *= chargeTargetDist; - - if (npc.velocity.X < chargeTargetX) - { - npc.velocity.X += chargeAccel; - if (npc.velocity.X < 0f && chargeTargetX > 0f) - npc.velocity.X += chargeAccel; - } - else if (npc.velocity.X > chargeTargetX) - { - npc.velocity.X -= chargeAccel; - if (npc.velocity.X > 0f && chargeTargetX < 0f) - npc.velocity.X -= chargeAccel; - } - if (npc.velocity.Y < chargeTargetY) - { - npc.velocity.Y += chargeAccel; - if (npc.velocity.Y < 0f && chargeTargetY > 0f) - npc.velocity.Y += chargeAccel; - } - else if (npc.velocity.Y > chargeTargetY) - { - npc.velocity.Y -= chargeAccel; - if (npc.velocity.Y > 0f && chargeTargetY < 0f) - npc.velocity.Y -= chargeAccel; - } - - // Take 1.25 or 1 second to get in position, then charge - npc.ai[2] += 1f; - if (npc.ai[2] >= (spazAlive ? 75f : 60f) - (death ? 20f * (0.7f - lifeRatio) : 0f)) - { - npc.TargetClosest(); - npc.ai[1] = 2f; - npc.ai[2] = 0f; - npc.netUpdate = true; - } - } - } - } - - return false; - } - - public static bool BuffedSpazmatismAI(NPC npc, Mod mod) - { - CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; - - // Get a target - 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(); - - float enrageScale = bossRush ? 0.5f : 0f; - if (Main.dayTime || bossRush) - { - npc.Calamity().CurrentlyEnraged = !bossRush; - enrageScale += 1f; - } - - // Percent life remaining - float lifeRatio = npc.life / (float)npc.lifeMax; - - // Easier to send info to Retinazer - CalamityGlobalNPC.fireEye = npc.whoAmI; - - // Check for Retinazer - bool retAlive = false; - if (CalamityGlobalNPC.laserEye != -1) - retAlive = Main.npc[CalamityGlobalNPC.laserEye].active; - - bool enrage = lifeRatio < 0.25f; - - // Rotation - Vector2 npcCenter = new Vector2(npc.Center.X, npc.position.Y + npc.height - 59f); - Vector2 lookAt = new Vector2(Main.player[npc.target].position.X - (Main.player[npc.target].width / 2), Main.player[npc.target].position.Y - (Main.player[npc.target].height / 2)); - Vector2 rotationVector = npcCenter - lookAt; - - // Boss Rush predictive charge rotation - if (npc.ai[1] == 5f && !retAlive && bossRush) - { - // Velocity - float chargeVelocity = 20f + (death ? 6f * (0.7f - lifeRatio) : 0f); - chargeVelocity += 10f * enrageScale; - if (Main.getGoodWorld) - chargeVelocity += 2f; - if (npc.ai[2] == -1f || (!retAlive && npc.ai[3] == 4f)) - chargeVelocity *= 1.3f; - - lookAt += Main.player[npc.target].velocity * 20f; - rotationVector = Vector2.Normalize(npcCenter - lookAt) * chargeVelocity; - } - - float spazmatismRotation = (float)Math.Atan2(rotationVector.Y, rotationVector.X) + MathHelper.PiOver2; - if (spazmatismRotation < 0f) - spazmatismRotation += MathHelper.TwoPi; - else if (spazmatismRotation > MathHelper.TwoPi) - spazmatismRotation -= MathHelper.TwoPi; - - float spazmatismRotateSpeed = 0.15f; - if (NPC.IsMechQueenUp && npc.ai[0] == 3f && npc.ai[1] == 0f) - spazmatismRotateSpeed *= 0.25f; - - if (npc.rotation < spazmatismRotation) - { - if ((spazmatismRotation - npc.rotation) > MathHelper.Pi) - npc.rotation -= spazmatismRotateSpeed; - else - npc.rotation += spazmatismRotateSpeed; - } - else if (npc.rotation > spazmatismRotation) - { - if ((npc.rotation - spazmatismRotation) > MathHelper.Pi) - npc.rotation += spazmatismRotateSpeed; - else - npc.rotation -= spazmatismRotateSpeed; - } - - if (npc.rotation > spazmatismRotation - spazmatismRotateSpeed && npc.rotation < spazmatismRotation + spazmatismRotateSpeed) - npc.rotation = spazmatismRotation; - - if (npc.rotation < 0f) - npc.rotation += MathHelper.TwoPi; - else if (npc.rotation > MathHelper.TwoPi) - npc.rotation -= MathHelper.TwoPi; - - if (npc.rotation > spazmatismRotation - spazmatismRotateSpeed && npc.rotation < spazmatismRotation + spazmatismRotateSpeed) - npc.rotation = spazmatismRotation; - - // Dust - if (Main.rand.NextBool(5)) - { - int spazDust = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + npc.height * 0.25f), npc.width, (int)(npc.height * 0.5f), 5, npc.velocity.X, 2f, 0, default, 1f); - Dust dust = Main.dust[spazDust]; - dust.velocity.X *= 0.5f; - dust.velocity.Y *= 0.1f; - } - - // Despawn Twins at the same time - if (Main.netMode != NetmodeID.MultiplayerClient && !Main.player[npc.target].dead && npc.timeLeft < 10) - { - for (int i = 0; i < Main.maxNPCs; i++) - { - if (i != npc.whoAmI && Main.npc[i].active && (Main.npc[i].type == NPCID.Retinazer || Main.npc[i].type == NPCID.Spazmatism) && Main.npc[i].timeLeft - 1 > npc.timeLeft) - npc.timeLeft = Main.npc[i].timeLeft - 1; - - } - } - - Vector2 mechQueenSpacing = Vector2.Zero; - if (NPC.IsMechQueenUp) - { - NPC nPC2 = Main.npc[NPC.mechQueen]; - Vector2 mechQueenCenter2 = nPC2.GetMechQueenCenter(); - Vector2 mechdusaSpacingVector = new Vector2(150f, -250f); - mechdusaSpacingVector *= 0.75f; - float mechdusaSpacingVel = nPC2.velocity.X * 0.025f; - mechQueenSpacing = mechQueenCenter2 + mechdusaSpacingVector; - mechQueenSpacing = mechQueenSpacing.RotatedBy(mechdusaSpacingVel, mechQueenCenter2); - } - - npc.reflectsProjectiles = false; - - // Despawn - if (Main.player[npc.target].dead) - { - npc.velocity.Y -= 0.04f; - if (npc.timeLeft > 10) - { - npc.timeLeft = 10; - return false; - } - } - - // Phase 1 - else if (npc.ai[0] == 0f) - { - // Cursed fireball phase - if (npc.ai[1] == 0f) - { - // Velocity - float spazmatismFireballMaxSpeed = 12f; - float spazmatismFireballAccel = 0.4f; - spazmatismFireballMaxSpeed += 6f * enrageScale; - spazmatismFireballAccel += 0.2f * enrageScale; - - if (death) - { - spazmatismFireballMaxSpeed += 9f * (1f - lifeRatio); - spazmatismFireballAccel += 0.3f * (1f - lifeRatio); - } - - if (Main.getGoodWorld) - { - spazmatismFireballMaxSpeed *= 1.15f; - spazmatismFireballAccel *= 1.15f; - } - - int spazmatismFireballFaceDirection = 1; - if (npc.position.X + (npc.width / 2) < Main.player[npc.target].position.X + Main.player[npc.target].width) - spazmatismFireballFaceDirection = -1; - - Vector2 spazmatismFireballPos = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float spazmatismFireballTargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) + (spazmatismFireballFaceDirection * 400) - spazmatismFireballPos.X; - float spazmatismFireballTargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - spazmatismFireballPos.Y; - if (NPC.IsMechQueenUp) - { - spazmatismFireballMaxSpeed = 14f; - spazmatismFireballTargetX = mechQueenSpacing.X; - spazmatismFireballTargetY = mechQueenSpacing.Y; - spazmatismFireballTargetX -= spazmatismFireballPos.X; - spazmatismFireballTargetY -= spazmatismFireballPos.Y; - } - - float spazmatismFireballTargetDist = (float)Math.Sqrt(spazmatismFireballTargetX * spazmatismFireballTargetX + spazmatismFireballTargetY * spazmatismFireballTargetY); - - if (NPC.IsMechQueenUp) - { - if (spazmatismFireballTargetDist > spazmatismFireballMaxSpeed) - { - spazmatismFireballTargetDist = spazmatismFireballMaxSpeed / spazmatismFireballTargetDist; - spazmatismFireballTargetX *= spazmatismFireballTargetDist; - spazmatismFireballTargetY *= spazmatismFireballTargetDist; - } - - npc.velocity.X = (npc.velocity.X * 4f + spazmatismFireballTargetX) / 5f; - npc.velocity.Y = (npc.velocity.Y * 4f + spazmatismFireballTargetY) / 5f; - } - else - { - spazmatismFireballTargetDist = spazmatismFireballMaxSpeed / spazmatismFireballTargetDist; - spazmatismFireballTargetX *= spazmatismFireballTargetDist; - spazmatismFireballTargetY *= spazmatismFireballTargetDist; - - if (npc.velocity.X < spazmatismFireballTargetX) - { - npc.velocity.X += spazmatismFireballAccel; - if (npc.velocity.X < 0f && spazmatismFireballTargetX > 0f) - npc.velocity.X += spazmatismFireballAccel; - } - else if (npc.velocity.X > spazmatismFireballTargetX) - { - npc.velocity.X -= spazmatismFireballAccel; - if (npc.velocity.X > 0f && spazmatismFireballTargetX < 0f) - npc.velocity.X -= spazmatismFireballAccel; - } - if (npc.velocity.Y < spazmatismFireballTargetY) - { - npc.velocity.Y += spazmatismFireballAccel; - if (npc.velocity.Y < 0f && spazmatismFireballTargetY > 0f) - npc.velocity.Y += spazmatismFireballAccel; - } - else if (npc.velocity.Y > spazmatismFireballTargetY) - { - npc.velocity.Y -= spazmatismFireballAccel; - if (npc.velocity.Y > 0f && spazmatismFireballTargetY < 0f) - npc.velocity.Y -= spazmatismFireballAccel; - } - } - - // Fire cursed flames for 5 seconds - npc.ai[2] += 1f; - float phaseGateValue = NPC.IsMechQueenUp ? 900f : 300f - (death ? 600f * (1f - lifeRatio) : 0f); - if (npc.ai[2] >= phaseGateValue) - { - // Reset AI array and go to charging phase - npc.ai[1] = 1f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.TargetClosest(); - npc.netUpdate = true; - } - else - { - // Fire cursed flame every half second - if (!Main.player[npc.target].dead) - { - npc.ai[3] += 1f; - if (Main.getGoodWorld) - npc.ai[3] += 0.4f; - } - - if (npc.ai[3] >= 30f) - { - npc.ai[3] = 0f; - spazmatismFireballPos = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - spazmatismFireballTargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - spazmatismFireballPos.X; - spazmatismFireballTargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - spazmatismFireballPos.Y; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - float cursedFireballSpeed = 15f; - cursedFireballSpeed += 3f * enrageScale; - int type = ProjectileID.CursedFlameHostile; - int damage = npc.GetProjectileDamage(type); - - spazmatismFireballTargetDist = (float)Math.Sqrt(spazmatismFireballTargetX * spazmatismFireballTargetX + spazmatismFireballTargetY * spazmatismFireballTargetY); - spazmatismFireballTargetDist = cursedFireballSpeed / spazmatismFireballTargetDist; - spazmatismFireballTargetX *= spazmatismFireballTargetDist; - spazmatismFireballTargetY *= spazmatismFireballTargetDist; - spazmatismFireballTargetX += Main.rand.Next(-10, 11) * 0.05f; - spazmatismFireballTargetY += Main.rand.Next(-10, 11) * 0.05f; - spazmatismFireballPos.X += spazmatismFireballTargetX * 4f; - spazmatismFireballPos.Y += spazmatismFireballTargetY * 4f; - - Projectile.NewProjectile(npc.GetSource_FromAI(), spazmatismFireballPos.X, spazmatismFireballPos.Y, spazmatismFireballTargetX, spazmatismFireballTargetY, type, damage, 0f, Main.myPlayer, 0f, 0f); - } - } - } - } - - // Charging phase - else if (npc.ai[1] == 1f) - { - // Rotation and velocity - npc.rotation = spazmatismRotation; - float spazmatismPhase1ChargeSpeed = 16f; - spazmatismPhase1ChargeSpeed += 8f * enrageScale; - if (death) - spazmatismPhase1ChargeSpeed += 12f * (1f - lifeRatio); - if (Main.getGoodWorld) - spazmatismPhase1ChargeSpeed *= 1.2f; - - Vector2 spazmatismPhase1ChargePos = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float spazmatismPhase1ChargeTargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - spazmatismPhase1ChargePos.X; - float spazmatismPhase1ChargeTargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - spazmatismPhase1ChargePos.Y; - float spazmatismPhase1ChargeTargetDist = (float)Math.Sqrt(spazmatismPhase1ChargeTargetX * spazmatismPhase1ChargeTargetX + spazmatismPhase1ChargeTargetY * spazmatismPhase1ChargeTargetY); - spazmatismPhase1ChargeTargetDist = spazmatismPhase1ChargeSpeed / spazmatismPhase1ChargeTargetDist; - npc.velocity.X = spazmatismPhase1ChargeTargetX * spazmatismPhase1ChargeTargetDist; - npc.velocity.Y = spazmatismPhase1ChargeTargetY * spazmatismPhase1ChargeTargetDist; - npc.ai[1] = 2f; - } - else if (npc.ai[1] == 2f) - { - npc.ai[2] += 1f; - - float timeBeforeSlowDown = 12f; - if (npc.ai[2] >= timeBeforeSlowDown) - { - // Slow down - npc.velocity *= 0.9f; - - if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) - npc.velocity.X = 0f; - if (npc.velocity.Y > -0.1 && npc.velocity.Y < 0.1) - npc.velocity.Y = 0f; - } - else - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) - MathHelper.PiOver2; - - // Charge 8 times - float chargeTime = 38f; - if (npc.ai[2] >= chargeTime) - { - // Reset AI array and go to cursed fireball phase - npc.ai[3] += 1f; - npc.ai[2] = 0f; - npc.TargetClosest(); - npc.rotation = spazmatismRotation; - float totalCharges = 8f; - if (death) - totalCharges -= (float)Math.Round(16f * (1f - lifeRatio)); - - if (npc.ai[3] >= totalCharges) - { - npc.ai[1] = 0f; - npc.ai[3] = 0f; - } - else - npc.ai[1] = 1f; - } - } - - // Enter phase 2 earlier - if (lifeRatio < 0.7f) - { - // Reset AI array and go to transition phase - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.TargetClosest(); - npc.netUpdate = true; - } - } - - // Transition phase - else if (npc.ai[0] == 1f || npc.ai[0] == 2f) - { - if (NPC.IsMechQueenUp) - npc.reflectsProjectiles = true; - - // AI timer for rotation - if (npc.ai[0] == 1f) - { - npc.ai[2] += 0.005f; - if (npc.ai[2] > 0.5) - npc.ai[2] = 0.5f; - } - else - { - npc.ai[2] -= 0.005f; - if (npc.ai[2] < 0f) - npc.ai[2] = 0f; - } - - // Spin around like a moron while flinging blood and gore everywhere - npc.rotation += npc.ai[2]; - npc.ai[1] += 1f; - if (npc.ai[1] == 100f) - { - npc.ai[0] += 1f; - npc.ai[1] = 0f; - - if (npc.ai[0] == 3f) - npc.ai[2] = 0f; - else - { - SoundEngine.PlaySound(SoundID.NPCHit1, npc.position); - - if (Main.netMode != NetmodeID.Server) - { - for (int i = 0; i < 2; i++) - { - Gore.NewGore(npc.GetSource_FromAI(), npc.position, new Vector2(Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f), 144, 1f); - Gore.NewGore(npc.GetSource_FromAI(), npc.position, new Vector2(Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f), 7, 1f); - Gore.NewGore(npc.GetSource_FromAI(), npc.position, new Vector2(Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f), 6, 1f); - } - } - - for (int j = 0; j < 20; j++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f, 0, default, 1f); - } - - SoundEngine.PlaySound(SoundID.Roar, npc.position); - } - } - - Dust.NewDust(npc.position, npc.width, npc.height, 5, Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f, 0, default, 1f); - - npc.velocity *= 0.98f; - - if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) - npc.velocity.X = 0f; - if (npc.velocity.Y > -0.1 && npc.velocity.Y < 0.1) - npc.velocity.Y = 0f; - } - - // Phase 2 - else - { - // If in phase 2 but Ret isn't - bool retInPhase1 = false; - if (CalamityGlobalNPC.laserEye != -1) - { - if (Main.npc[CalamityGlobalNPC.laserEye].active) - retInPhase1 = Main.npc[CalamityGlobalNPC.laserEye].ai[0] == 1f || Main.npc[CalamityGlobalNPC.laserEye].ai[0] == 2f || Main.npc[CalamityGlobalNPC.laserEye].ai[0] == 0f; - } - - npc.chaseable = !retInPhase1; - - // Increase defense and damage - npc.damage = (int)(npc.defDamage * 1.5); - npc.defense = npc.defDefense + 18; - calamityGlobalNPC.DR = retInPhase1 ? 0.9999f : 0.2f; - calamityGlobalNPC.unbreakableDR = retInPhase1; - calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = retInPhase1; - - // Change hit sound to metal - npc.HitSound = SoundID.NPCHit4; - - // Shadowflamethrower phase - if (npc.ai[1] == 0f) - { - float spazmatismFlamethrowerMaxSpeed = 6.2f + (death ? 2f * (0.7f - lifeRatio) : 0f); - float spazmatismFlamethrowerAccel = 0.1f + (death ? 0.03f * (0.7f - lifeRatio) : 0f); - spazmatismFlamethrowerMaxSpeed += 4f * enrageScale; - spazmatismFlamethrowerAccel += 0.06f * enrageScale; - - int spazmatismFlamethrowerFaceDirection = 1; - if (npc.position.X + (npc.width / 2) < Main.player[npc.target].position.X + Main.player[npc.target].width) - spazmatismFlamethrowerFaceDirection = -1; - - Vector2 spazmatismFlamethrowerPos = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float spazmatismFlamethrowerTargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) + (spazmatismFlamethrowerFaceDirection * 180) - spazmatismFlamethrowerPos.X; - float spazmatismFlamethrowerTargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - spazmatismFlamethrowerPos.Y; - float spazmatismFlamethrowerTargetDist = (float)Math.Sqrt(spazmatismFlamethrowerTargetX * spazmatismFlamethrowerTargetX + spazmatismFlamethrowerTargetY * spazmatismFlamethrowerTargetY); - - if (!NPC.IsMechQueenUp) - { - // Boost speed if too far from target - if (spazmatismFlamethrowerTargetDist > 300f) - spazmatismFlamethrowerMaxSpeed += 0.5f; - if (spazmatismFlamethrowerTargetDist > 400f) - spazmatismFlamethrowerMaxSpeed += 0.5f; - - if (Main.getGoodWorld) - { - spazmatismFlamethrowerMaxSpeed *= 1.15f; - spazmatismFlamethrowerAccel *= 1.15f; - } - - spazmatismFlamethrowerTargetDist = spazmatismFlamethrowerMaxSpeed / spazmatismFlamethrowerTargetDist; - spazmatismFlamethrowerTargetX *= spazmatismFlamethrowerTargetDist; - spazmatismFlamethrowerTargetY *= spazmatismFlamethrowerTargetDist; - - if (npc.velocity.X < spazmatismFlamethrowerTargetX) - { - npc.velocity.X += spazmatismFlamethrowerAccel; - if (npc.velocity.X < 0f && spazmatismFlamethrowerTargetX > 0f) - npc.velocity.X += spazmatismFlamethrowerAccel; - } - else if (npc.velocity.X > spazmatismFlamethrowerTargetX) - { - npc.velocity.X -= spazmatismFlamethrowerAccel; - if (npc.velocity.X > 0f && spazmatismFlamethrowerTargetX < 0f) - npc.velocity.X -= spazmatismFlamethrowerAccel; - } - if (npc.velocity.Y < spazmatismFlamethrowerTargetY) - { - npc.velocity.Y += spazmatismFlamethrowerAccel; - if (npc.velocity.Y < 0f && spazmatismFlamethrowerTargetY > 0f) - npc.velocity.Y += spazmatismFlamethrowerAccel; - } - else if (npc.velocity.Y > spazmatismFlamethrowerTargetY) - { - npc.velocity.Y -= spazmatismFlamethrowerAccel; - if (npc.velocity.Y > 0f && spazmatismFlamethrowerTargetY < 0f) - npc.velocity.Y -= spazmatismFlamethrowerAccel; - } - } - - // Fire flamethrower for x seconds - npc.ai[2] += retAlive ? 1f : 2f; - float phaseGateValue = NPC.IsMechQueenUp ? 900f : 180f - (death ? 60f * (0.7f - lifeRatio) : 0f); - if (npc.ai[2] >= phaseGateValue) - { - npc.ai[1] = (!retAlive || enrage) ? 5f : 1f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.TargetClosest(); - npc.netUpdate = true; - } - - // Fire fireballs and flamethrower - bool canHit = Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height); - if (canHit || !retAlive || enrage) - { - // Play flame sound on timer - npc.localAI[2] += 1f; - if (npc.localAI[2] > 22f) - { - npc.localAI[2] = 0f; - SoundEngine.PlaySound(SoundID.Item34, npc.position); - } - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[1] += 1f; - if (npc.localAI[1] > 2f) - { - npc.localAI[1] = 0f; - - float spazmatismShadowFireballSpeed = 6f; - spazmatismShadowFireballSpeed += 2f * enrageScale; - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - - spazmatismFlamethrowerPos = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - spazmatismFlamethrowerTargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - spazmatismFlamethrowerPos.X; - spazmatismFlamethrowerTargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - spazmatismFlamethrowerPos.Y; - spazmatismFlamethrowerTargetDist = (float)Math.Sqrt(spazmatismFlamethrowerTargetX * spazmatismFlamethrowerTargetX + spazmatismFlamethrowerTargetY * spazmatismFlamethrowerTargetY); - spazmatismFlamethrowerTargetDist = spazmatismShadowFireballSpeed / spazmatismFlamethrowerTargetDist; - spazmatismFlamethrowerTargetX *= spazmatismFlamethrowerTargetDist; - spazmatismFlamethrowerTargetY *= spazmatismFlamethrowerTargetDist; - spazmatismFlamethrowerTargetY += Main.rand.Next(-10, 11) * 0.01f; - spazmatismFlamethrowerTargetX += Main.rand.Next(-10, 11) * 0.01f; - spazmatismFlamethrowerTargetY += npc.velocity.Y * 0.5f; - spazmatismFlamethrowerTargetX += npc.velocity.X * 0.5f; - spazmatismFlamethrowerPos.X -= spazmatismFlamethrowerTargetX * 1f; - spazmatismFlamethrowerPos.Y -= spazmatismFlamethrowerTargetY * 1f; - - if (NPC.IsMechQueenUp) - { - Vector2 mechdusaSpazShadowFireballPos = (npc.rotation + (float)Math.PI / 2f).ToRotationVector2() * spazmatismShadowFireballSpeed + npc.velocity * 0.5f; - spazmatismFlamethrowerTargetX = mechdusaSpazShadowFireballPos.X; - spazmatismFlamethrowerTargetY = mechdusaSpazShadowFireballPos.Y; - spazmatismFlamethrowerPos = npc.Center - mechdusaSpazShadowFireballPos * 3f; - } - - if (canHit) - Projectile.NewProjectile(npc.GetSource_FromAI(), spazmatismFlamethrowerPos.X, spazmatismFlamethrowerPos.Y, spazmatismFlamethrowerTargetX, spazmatismFlamethrowerTargetY, type, damage, 0f, Main.myPlayer, 0f, 0f); - else - { - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), spazmatismFlamethrowerPos.X, spazmatismFlamethrowerPos.Y, spazmatismFlamethrowerTargetX, spazmatismFlamethrowerTargetY, type, damage, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[proj].tileCollide = false; - } - } - } - } - - if (NPC.IsMechQueenUp) - { - spazmatismFlamethrowerMaxSpeed = 14f; - spazmatismFlamethrowerTargetX = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - spazmatismFlamethrowerPos.X; - spazmatismFlamethrowerTargetY = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - 300f - spazmatismFlamethrowerPos.Y; - spazmatismFlamethrowerTargetX = mechQueenSpacing.X; - spazmatismFlamethrowerTargetY = mechQueenSpacing.Y; - spazmatismFlamethrowerTargetX -= spazmatismFlamethrowerPos.X; - spazmatismFlamethrowerTargetY -= spazmatismFlamethrowerPos.Y; - spazmatismFlamethrowerTargetDist = (float)Math.Sqrt(spazmatismFlamethrowerTargetX * spazmatismFlamethrowerTargetX + spazmatismFlamethrowerTargetY * spazmatismFlamethrowerTargetY); - if (spazmatismFlamethrowerTargetDist > spazmatismFlamethrowerMaxSpeed) - { - spazmatismFlamethrowerTargetDist = spazmatismFlamethrowerMaxSpeed / spazmatismFlamethrowerTargetDist; - spazmatismFlamethrowerTargetX *= spazmatismFlamethrowerTargetDist; - spazmatismFlamethrowerTargetY *= spazmatismFlamethrowerTargetDist; - } - - npc.velocity.X = (npc.velocity.X * 59f + spazmatismFlamethrowerTargetX) / 60f; - npc.velocity.Y = (npc.velocity.Y * 59f + spazmatismFlamethrowerTargetY) / 60f; - } - } - - // Charging phase - else - { - // Charge - if (npc.ai[1] == 1f) - { - // Play charge sound - SoundEngine.PlaySound(SoundID.Roar, npc.position); - - // Set rotation and velocity - npc.rotation = spazmatismRotation; - float spazmatismPhase2ChargeSpeed = 16.75f + (death ? 5f * (0.7f - lifeRatio) : 0f); - spazmatismPhase2ChargeSpeed += 8f * enrageScale; - if (Main.getGoodWorld) - spazmatismPhase2ChargeSpeed *= 1.2f; - - Vector2 distanceVector = Main.player[npc.target].Center - npc.Center; - npc.velocity = Vector2.Normalize(distanceVector) * spazmatismPhase2ChargeSpeed; - npc.ai[1] = 2f; - return false; - } - - if (npc.ai[1] == 2f) - { - npc.ai[2] += retAlive ? 1f : 1.25f; - - float chargeTime = 50f - (death ? 12f * (0.7f - lifeRatio) : 0f); - - // Slow down - if (npc.ai[2] >= chargeTime) - { - npc.velocity *= 0.93f; - if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) - npc.velocity.X = 0f; - if (npc.velocity.Y > -0.1 && npc.velocity.Y < 0.1) - npc.velocity.Y = 0f; - } - else - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) - MathHelper.PiOver2; - - // Charges 5 times - if (npc.ai[2] >= chargeTime + 30f) - { - npc.ai[3] += 1f; - npc.ai[2] = 0f; - npc.TargetClosest(); - npc.rotation = spazmatismRotation; - if (npc.ai[3] >= 5f) - { - npc.ai[1] = 0f; - npc.ai[3] = 0f; - return false; - } - npc.ai[1] = 1f; - } - } - - // Crazy charge - else if (npc.ai[1] == 3f) - { - // Reset AI array and go to shadowflamethrower phase or fireball phase if ret is dead - float secondFastCharge = 4f; - if (npc.ai[3] >= (retAlive ? secondFastCharge : secondFastCharge + 1f)) - { - npc.TargetClosest(); - npc.ai[1] = retAlive ? 0f : 5f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - - if (npc.ai[1] == 0f) - npc.localAI[1] = -20f; - - npc.netUpdate = true; - - if (npc.netSpam > 10) - npc.netSpam = 10; - } - - // Set charging velocity - else if (Main.netMode != NetmodeID.MultiplayerClient) - { - // Velocity - float spazmatismPhase3ChargeSpeed = 20f + (death ? 6f * (0.7f - lifeRatio) : 0f); - spazmatismPhase3ChargeSpeed += 10f * enrageScale; - if (npc.ai[2] == -1f || (!retAlive && npc.ai[3] == secondFastCharge)) - spazmatismPhase3ChargeSpeed *= 1.3f; - if (Main.getGoodWorld) - spazmatismPhase3ChargeSpeed *= 1.2f; - - Vector2 distanceVector = Main.player[npc.target].Center + (!retAlive && bossRush ? Main.player[npc.target].velocity * 20f : Vector2.Zero) - npc.Center; - npc.velocity = Vector2.Normalize(distanceVector) * spazmatismPhase3ChargeSpeed; - - if (retAlive) - { - Vector2 spazmatismPhase3ChargePos = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float spazmatismPhase3ChargeTargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - spazmatismPhase3ChargePos.X; - float spazmatismPhase3ChargeTargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - spazmatismPhase3ChargePos.Y; - float spazmatismPhase3ChargeTargetDist = (float)Math.Sqrt(spazmatismPhase3ChargeTargetX * spazmatismPhase3ChargeTargetX + spazmatismPhase3ChargeTargetY * spazmatismPhase3ChargeTargetY); - float spazmatismPhase3ChargeTargetDistCopy = spazmatismPhase3ChargeTargetDist; - - if (spazmatismPhase3ChargeTargetDistCopy < 100f) - { - if (Math.Abs(npc.velocity.X) > Math.Abs(npc.velocity.Y)) - { - float absoluteSpazXVel = Math.Abs(npc.velocity.X); - float absoluteSpazYVel = Math.Abs(npc.velocity.Y); - - if (npc.Center.X > Main.player[npc.target].Center.X) - absoluteSpazYVel *= -1f; - if (npc.Center.Y > Main.player[npc.target].Center.Y) - absoluteSpazXVel *= -1f; - - npc.velocity.X = absoluteSpazYVel; - npc.velocity.Y = absoluteSpazXVel; - } - } - } - - npc.ai[1] = 4f; - npc.netUpdate = true; - - if (npc.netSpam > 10) - npc.netSpam = 10; - } - } - - // Crazy charge - else if (npc.ai[1] == 4f) - { - if (npc.ai[2] == 0f) - SoundEngine.PlaySound(SoundID.Roar, npc.position); - - float spazmatismRetDeadChargeSpeed = ((!retAlive && npc.ai[3] == 4f) ? 75f : 50f) - (float)Math.Round(death ? 14f * (0.7f - lifeRatio) : 0f); - - npc.ai[2] += 1f; - - if (npc.ai[2] == spazmatismRetDeadChargeSpeed && Vector2.Distance(npc.position, Main.player[npc.target].position) < (retAlive ? 200f : 150f)) - npc.ai[2] -= 1f; - - // Slow down - if (npc.ai[2] >= spazmatismRetDeadChargeSpeed) - { - npc.velocity *= 0.93f; - if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) - npc.velocity.X = 0f; - if (npc.velocity.Y > -0.1 && npc.velocity.Y < 0.1) - npc.velocity.Y = 0f; - } - else - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) - MathHelper.PiOver2; - - // Charge 3 times - float spazmatismRetDeadChargeTimer = spazmatismRetDeadChargeSpeed + 25f; - if (npc.ai[2] >= spazmatismRetDeadChargeTimer) - { - npc.netUpdate = true; - - if (npc.netSpam > 10) - npc.netSpam = 10; - - npc.ai[3] += 1f; - npc.ai[2] = 0f; - npc.ai[1] = 3f; - } - } - - // Get in position for charge - else if (npc.ai[1] == 5f) - { - float chargeLineUpDist = retAlive ? 600f : 500f; - float chargeSpeed = 16f + (death ? 5f * (0.7f - lifeRatio) : 0f); - float chargeAccel = 0.4f + (death ? 0.1f * (0.7f - lifeRatio) : 0f); - - if (retAlive) - { - chargeSpeed *= 0.75f; - chargeAccel *= 0.75f; - } - - if (Main.getGoodWorld) - { - chargeSpeed *= 1.15f; - chargeAccel *= 1.15f; - } - - Vector2 spazmatismRetDeadChargePos = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float chargeTargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - spazmatismRetDeadChargePos.X; - float chargeTargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) + chargeLineUpDist - spazmatismRetDeadChargePos.Y; - float chargeTargetDist = (float)Math.Sqrt(chargeTargetX * chargeTargetX + chargeTargetY * chargeTargetY); - - chargeTargetDist = chargeSpeed / chargeTargetDist; - chargeTargetX *= chargeTargetDist; - chargeTargetY *= chargeTargetDist; - - if (npc.velocity.X < chargeTargetX) - { - npc.velocity.X += chargeAccel; - if (npc.velocity.X < 0f && chargeTargetX > 0f) - npc.velocity.X += chargeAccel; - } - else if (npc.velocity.X > chargeTargetX) - { - npc.velocity.X -= chargeAccel; - if (npc.velocity.X > 0f && chargeTargetX < 0f) - npc.velocity.X -= chargeAccel; - } - if (npc.velocity.Y < chargeTargetY) - { - npc.velocity.Y += chargeAccel; - if (npc.velocity.Y < 0f && chargeTargetY > 0f) - npc.velocity.Y += chargeAccel; - } - else if (npc.velocity.Y > chargeTargetY) - { - npc.velocity.Y -= chargeAccel; - if (npc.velocity.Y > 0f && chargeTargetY < 0f) - npc.velocity.Y -= chargeAccel; - } - - npc.ai[2] += 1f; - - // Fire shadowflames - float fireRate = retAlive ? 30f : 20f; - if (npc.ai[2] % fireRate == 0f) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - float velocity = 16f; - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - Vector2 projectileVelocity = Vector2.Normalize(Main.player[npc.target].Center + (!retAlive && bossRush ? Main.player[npc.target].velocity * 20f : Vector2.Zero) - npc.Center) * velocity; - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + Vector2.Normalize(projectileVelocity) * 4f, projectileVelocity, type, damage, 0f, Main.myPlayer, 0f, retAlive ? 0f : 1f); - } - } - - // Take 3 seconds to get in position, then charge - if (npc.ai[2] >= (retAlive ? 180f : 135f) - (death ? 45f * (0.7f - lifeRatio) : 0f)) - { - npc.TargetClosest(); - npc.ai[1] = 3f; - npc.ai[2] = -1f; - } - - npc.netUpdate = true; - - if (npc.netSpam > 10) - npc.netSpam = 10; - } - } - } - - return false; - } - #endregion - } -} diff --git a/NPCs/VanillaNPCOverrides/Bosses/WallOfFleshAI.cs b/NPCs/VanillaNPCOverrides/Bosses/WallOfFleshAI.cs deleted file mode 100644 index a904b3cf91..0000000000 --- a/NPCs/VanillaNPCOverrides/Bosses/WallOfFleshAI.cs +++ /dev/null @@ -1,633 +0,0 @@ -using CalamityMod.Events; -using CalamityMod.World; -using Microsoft.Xna.Framework; -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Audio; - -namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses -{ - public static class WallOfFleshAI - { - public static bool BuffedWallofFleshAI(NPC npc, Mod mod) - { - CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; - - // Despawn - if (npc.position.X < 160f || npc.position.X > ((Main.maxTilesX - 10) * 16)) - npc.active = false; - - // Set Wall of Flesh variables - if (npc.localAI[0] == 0f) - { - npc.localAI[0] = 1f; - Main.wofDrawAreaBottom = -1; - Main.wofDrawAreaTop = -1; - } - - // Percent life remaining - float lifeRatio = npc.life / (float)npc.lifeMax; - - // Clamp life ratio to prevent bad velocity math. - lifeRatio = MathHelper.Clamp(lifeRatio, 0f, 1f); - - // Phases based on HP - bool phase2 = lifeRatio < 0.66f; - bool phase3 = lifeRatio < 0.33f; - - if (Main.getGoodWorld && Main.netMode != NetmodeID.MultiplayerClient && Main.rand.NextBool(180)) - { - if (NPC.CountNPCS(NPCID.FireImp) < 4) - { - for (int i = 0; i < 1000; i++) - { - int targetTileX = (int)(npc.Center.X / 16f); - int targetTileY = (int)(npc.Center.Y / 16f); - if (npc.target >= 0) - { - targetTileX = (int)(Main.player[npc.target].Center.X / 16f); - targetTileY = (int)(Main.player[npc.target].Center.Y / 16f); - } - - targetTileX += Main.rand.Next(-50, 51); - for (targetTileY += Main.rand.Next(-50, 51); targetTileY < Main.maxTilesY - 10 && !WorldGen.SolidTile(targetTileX, targetTileY); targetTileY++) - { - } - - targetTileY--; - if (!WorldGen.SolidTile(targetTileX, targetTileY)) - { - int impSpawn = NPC.NewNPC(npc.GetSource_FromAI(), targetTileX * 16 + 8, targetTileY * 16, 24); - if (Main.netMode == NetmodeID.Server && impSpawn < Main.maxNPCs) - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, impSpawn); - - break; - } - } - } - } - - // Start leech spawning based on HP - npc.ai[1] += 1f; - if (npc.ai[2] == 0f) - { - if (phase2) - npc.ai[1] += 1f; - if (phase3) - npc.ai[1] += 1f; - if (bossRush) - npc.ai[1] += 3f; - if (CalamityWorld.LegendaryMode) - npc.ai[1] += 9f; - - if (npc.ai[1] > 2700f) - npc.ai[2] = 1f; - } - - // Leech spawn - if (npc.ai[2] > 0f && npc.ai[1] > 60f) - { - int leechAmt = phase3 ? 3 : 2; - - npc.ai[2] += 1f; - npc.ai[1] = 0f; - if (npc.ai[2] > leechAmt) - npc.ai[2] = 0f; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int leechSpawn = NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.position.X + (npc.width / 2)), (int)(npc.position.Y + (npc.height / 2) + 20f), NPCID.LeechHead, 1); - Main.npc[leechSpawn].velocity.X = npc.direction * 9; - - if (phase2) - { - // Get target vector - Vector2 projectileVelocity = Vector2.Normalize(Main.player[npc.target].Center - npc.Center) * npc.velocity.Length(); - Vector2 projectileSpawn = npc.Center + projectileVelocity * 5f; - - int damage = npc.GetProjectileDamage(ProjectileID.DemonSickle); - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), projectileSpawn, projectileVelocity, ProjectileID.DemonSickle, damage, 0f, Main.myPlayer, 0f, projectileVelocity.Length() * 3f); - Main.projectile[proj].timeLeft = 600; - Main.projectile[proj].tileCollide = false; - } - } - } - - // Play sound - npc.localAI[3] += 1f; - if (npc.localAI[3] >= (600 + Main.rand.Next(1000))) - { - npc.localAI[3] = -Main.rand.Next(200); - SoundEngine.PlaySound(SoundID.NPCDeath10, npc.position); - } - - // Set whoAmI variable - Main.wofNPCIndex = npc.whoAmI; - - // Set eye positions - int currentEyeTileCenterX = (int)(npc.position.X / 16f); - int currentEyeTileWidthX = (int)((npc.position.X + npc.width) / 16f); - int currentEyeTileHeightY = (int)((npc.position.Y + (npc.height / 2)) / 16f); - int eyeMovementTries = 0; - int eyeMovementTileY = currentEyeTileHeightY + 7; - while (eyeMovementTries < 15 && eyeMovementTileY > Main.UnderworldLayer) - { - eyeMovementTileY++; - for (int eyeMovementTileX = currentEyeTileCenterX; eyeMovementTileX <= currentEyeTileWidthX; eyeMovementTileX++) - { - try - { - if (WorldGen.SolidTile(eyeMovementTileX, eyeMovementTileY) || Main.tile[eyeMovementTileX, eyeMovementTileY].LiquidAmount > 0) - eyeMovementTries++; - } - catch - { eyeMovementTries += 15; } - } - } - eyeMovementTileY += 4; - if (Main.wofDrawAreaBottom == -1) - Main.wofDrawAreaBottom = eyeMovementTileY * 16; - else if (Main.wofDrawAreaBottom > eyeMovementTileY * 16) - { - Main.wofDrawAreaBottom--; - if (Main.wofDrawAreaBottom < eyeMovementTileY * 16) - Main.wofDrawAreaBottom = eyeMovementTileY * 16; - } - else if (Main.wofDrawAreaBottom < eyeMovementTileY * 16) - { - Main.wofDrawAreaBottom++; - if (Main.wofDrawAreaBottom > eyeMovementTileY * 16) - Main.wofDrawAreaBottom = eyeMovementTileY * 16; - } - - eyeMovementTries = 0; - eyeMovementTileY = currentEyeTileHeightY - 7; - while (eyeMovementTries < 15 && eyeMovementTileY < Main.maxTilesY - 10) - { - eyeMovementTileY--; - for (int i = currentEyeTileCenterX; i <= currentEyeTileWidthX; i++) - { - try - { - if (WorldGen.SolidTile(i, eyeMovementTileY) || Main.tile[i, eyeMovementTileY].LiquidAmount > 0) - eyeMovementTries++; - } - catch - { eyeMovementTries += 15; } - } - } - eyeMovementTileY -= 4; - if (Main.wofDrawAreaTop == -1) - Main.wofDrawAreaTop = eyeMovementTileY * 16; - else if (Main.wofDrawAreaTop > eyeMovementTileY * 16) - { - Main.wofDrawAreaTop--; - if (Main.wofDrawAreaTop < eyeMovementTileY * 16) - Main.wofDrawAreaTop = eyeMovementTileY * 16; - } - else if (Main.wofDrawAreaTop < eyeMovementTileY * 16) - { - Main.wofDrawAreaTop++; - if (Main.wofDrawAreaTop > eyeMovementTileY * 16) - Main.wofDrawAreaTop = eyeMovementTileY * 16; - } - - // Set Y position - float mouthYPosition = (Main.wofDrawAreaBottom + Main.wofDrawAreaTop) / 2 - npc.height / 2; - int worldBottomTileY = (Main.maxTilesY - 180) * 16; - if (mouthYPosition < worldBottomTileY) - mouthYPosition = worldBottomTileY; - npc.position.Y = mouthYPosition; - - float targetPosition = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2); - float npcPosition = npc.position.X + (npc.width / 2); - - // Speed up if target is too far or if they're hiding behind tiles, slow down if too close - float distanceFromTarget; - if (npc.velocity.X < 0f) - distanceFromTarget = npcPosition - targetPosition; - else - distanceFromTarget = targetPosition - npcPosition; - - float halfAverageScreenWidth = 960f; - float distanceBeforeSlowingDown = 400f; - float timeBeforeEnrage = 600f - (death ? 390f * (1f - lifeRatio) : 0f); - float speedMult = 1f; - - if (bossRush) - timeBeforeEnrage *= 0.25f; - - if (calamityGlobalNPC.newAI[0] < timeBeforeEnrage) - { - if (distanceFromTarget > halfAverageScreenWidth || - !Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - speedMult += (distanceFromTarget - halfAverageScreenWidth) * 0.001f; - calamityGlobalNPC.newAI[0] += 1f; - - // Enrage after 10 seconds of target being off screen - if (calamityGlobalNPC.newAI[0] >= timeBeforeEnrage) - { - calamityGlobalNPC.newAI[1] = 1f; - - // Tell eyes to fire different lasers - npc.ai[3] = 1f; - - // Play roar sound on players nearby - if (Main.player[Main.myPlayer].active && !Main.player[Main.myPlayer].dead && Vector2.Distance(Main.player[Main.myPlayer].Center, npc.Center) < 2800f) - SoundEngine.PlaySound(SoundID.NPCDeath10 with { Pitch = SoundID.NPCDeath10.Pitch - 0.25f}, Main.player[Main.myPlayer].position); - } - } - else if (distanceFromTarget < distanceBeforeSlowingDown) - speedMult += (distanceFromTarget - distanceBeforeSlowingDown) * 0.002f; - - if (distanceFromTarget < halfAverageScreenWidth && - Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - if (calamityGlobalNPC.newAI[0] > 0f) - calamityGlobalNPC.newAI[0] -= 1f; - } - - speedMult = MathHelper.Clamp(speedMult, 0.75f, 2f); - } - - // Enrage if target is off screen for too long - if (calamityGlobalNPC.newAI[1] == 1f) - { - // Triple speed - speedMult = 3.25f; - - // Return to normal if very close to target - if (distanceFromTarget < distanceBeforeSlowingDown) - { - calamityGlobalNPC.newAI[0] = 0f; - calamityGlobalNPC.newAI[1] = 0f; - npc.ai[3] = 0f; - } - } - - if (bossRush) - speedMult += 0.2f; - - // NOTE: Max velocity is 8 in Expert Mode - // NOTE: Max velocity is 9 in For The Worthy - - float velocityBoost = 4f * (1f - lifeRatio); - float velocityX = (bossRush ? 7f : death ? 3.5f : 2f) + velocityBoost; - velocityX *= speedMult; - - if (Main.getGoodWorld) - { - velocityX *= 1.1f; - velocityX += 0.2f; - } - - // NOTE: Values below are based on Rev Mode only! - // Max velocity without enrage is 12 - // Min velocity is 1.5 - // Max velocity with enrage is 18 - - // Set X velocity - if (npc.velocity.X == 0f) - { - npc.TargetClosest(); - if (Main.player[npc.target].dead) - { - float wallVelocity = float.PositiveInfinity; - int wallDirection = 0; - for (int i = 0; i < Main.maxPlayers; i++) - { - Player player = Main.player[npc.target]; - if (player.active) - { - float playerDist = npc.Distance(player.Center); - if (wallVelocity > playerDist) - { - wallVelocity = playerDist; - wallDirection = (npc.Center.X < player.Center.X) ? 1 : -1; - } - } - } - - npc.direction = wallDirection; - } - - npc.velocity.X = npc.direction; - } - - if (npc.velocity.X < 0f) - { - npc.velocity.X = -velocityX; - npc.direction = -1; - } - else - { - npc.velocity.X = velocityX; - npc.direction = 1; - } - - if (Main.player[npc.target].dead || !Main.player[npc.target].gross) - npc.TargetClosest_WOF(); - - if (Main.player[npc.target].dead) - { - npc.localAI[1] += 0.0055555557f; - if (npc.localAI[1] >= 1f) - { - SoundEngine.PlaySound(SoundID.NPCDeath10, npc.position); - npc.life = 0; - npc.active = false; - if (Main.netMode != NetmodeID.MultiplayerClient) - NetMessage.SendData(MessageID.DamageNPC, -1, -1, null, npc.whoAmI, -1f); - - return false; - } - } - else - { - npc.localAI[1] = MathHelper.Clamp(npc.localAI[1] - 1f / 30f, 0f, 1f); - } - - // Direction - npc.spriteDirection = npc.direction; - Vector2 mouthLocation = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float mouthTargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - mouthLocation.X; - float mouthTargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - mouthLocation.Y; - float mouthTargetDist = (float)Math.Sqrt(mouthTargetX * mouthTargetX + mouthTargetY * mouthTargetY); - mouthTargetX *= mouthTargetDist; - mouthTargetY *= mouthTargetDist; - - // Rotation based on direction - if (npc.direction > 0) - { - if (Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) > npc.position.X + (npc.width / 2)) - npc.rotation = (float)Math.Atan2(-mouthTargetY, -mouthTargetX) + MathHelper.Pi; - else - npc.rotation = 0f; - } - else if (Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) < npc.position.X + (npc.width / 2)) - npc.rotation = (float)Math.Atan2(mouthTargetY, mouthTargetX) + MathHelper.Pi; - else - npc.rotation = 0f; - - // Expert hungry respawn over time - if (Main.netMode != NetmodeID.MultiplayerClient) - { - // Range of 2 to 11 - float spawnBoost = death ? 1f : (float)Math.Ceiling(lifeRatio * 10f); - int chance = (int)(1f + spawnBoost); - - // Range of 4 to 121 - chance *= chance; - - // Range of 23 to 134 - chance = (chance * 19 + 400) / 20; - - // Range of 32 to 59 - if (chance < 60) - chance = (chance * 3 + 60) / 4; - - // Range of 64 to 268 - chance *= 2; - - if (bossRush) - chance /= 4; - - if (Main.rand.NextBool(chance)) - { - int hungryAmt = 0; - float[] array = new float[10]; - for (int j = 0; j < Main.maxNPCs; j++) - { - if (hungryAmt < 10 && Main.npc[j].active && Main.npc[j].type == NPCID.TheHungry) - { - array[hungryAmt] = Main.npc[j].ai[0]; - hungryAmt++; - } - } - - int maxValue = 1 + hungryAmt * 2; - if (hungryAmt < 10 && Main.rand.Next(maxValue) <= 1) - { - int spawnHungryControl = -1; - for (int k = 0; k < 1000; k++) - { - int randomHungrySpawnValue = Main.rand.Next(10); - float hungryArrayValue = randomHungrySpawnValue * 0.1f - 0.05f; - bool shouldRespawnHungry = true; - for (int i = 0; i < hungryAmt; i++) - { - if (hungryArrayValue == array[i]) - { - shouldRespawnHungry = false; - break; - } - } - if (shouldRespawnHungry) - { - spawnHungryControl = randomHungrySpawnValue; - break; - } - } - if (spawnHungryControl >= 0) - { - int hungryRespawns = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.position.X, (int)mouthYPosition, NPCID.TheHungry, npc.whoAmI); - Main.npc[hungryRespawns].ai[0] = spawnHungryControl * 0.1f - 0.05f; - } - } - } - } - - // Spawn eyes and hungries - if (npc.localAI[0] == 1f && Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[0] = 2f; - - mouthYPosition = (Main.wofDrawAreaBottom + Main.wofDrawAreaTop) / 2; - mouthYPosition = (mouthYPosition + Main.wofDrawAreaTop) / 2f; - int eyeSpawn = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.position.X, (int)mouthYPosition, NPCID.WallofFleshEye, npc.whoAmI, 0f, 0f, 0f, 0f, 255); - Main.npc[eyeSpawn].ai[0] = 1f; - - mouthYPosition = (Main.wofDrawAreaBottom + Main.wofDrawAreaTop) / 2; - mouthYPosition = (mouthYPosition + Main.wofDrawAreaBottom) / 2f; - eyeSpawn = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.position.X, (int)mouthYPosition, NPCID.WallofFleshEye, npc.whoAmI, 0f, 0f, 0f, 0f, 255); - Main.npc[eyeSpawn].ai[0] = -1f; - - mouthYPosition = (Main.wofDrawAreaBottom + Main.wofDrawAreaTop) / 2; - mouthYPosition = (mouthYPosition + Main.wofDrawAreaBottom) / 2f; - - int hungryIncrement; - for (int j = 0; j < 11; j = hungryIncrement + 1) - { - int hungrySpawn = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.position.X, (int)mouthYPosition, NPCID.TheHungry, npc.whoAmI, 0f, 0f, 0f, 0f, 255); - Main.npc[hungrySpawn].ai[0] = j * 0.1f - 0.05f; - hungryIncrement = j; - } - } - - return false; - } - - public static bool BuffedWallofFleshEyeAI(NPC npc, Mod mod) - { - CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; - - // Despawn - if (Main.wofNPCIndex < 0) - { - npc.active = false; - return false; - } - - npc.realLife = Main.wofNPCIndex; - - if (Main.npc[Main.wofNPCIndex].life > 0) - npc.life = Main.npc[Main.wofNPCIndex].life; - - // Get a target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(); - - // Velocity, direction, and position - npc.position.X = Main.npc[Main.wofNPCIndex].position.X; - npc.direction = Main.npc[Main.wofNPCIndex].direction; - npc.spriteDirection = npc.direction; - - float expectedPosition = (Main.wofDrawAreaBottom + Main.wofDrawAreaTop) / 2; - if (npc.ai[0] > 0f) - expectedPosition = (expectedPosition + Main.wofDrawAreaTop) / 2f; - else - expectedPosition = (expectedPosition + Main.wofDrawAreaBottom) / 2f; - expectedPosition -= npc.height / 2; - - bool belowExpectedPosition = npc.position.Y > expectedPosition + 1f; - bool aboveExpectedPosition = npc.position.Y < expectedPosition - 1f; - if (belowExpectedPosition) - { - float distanceBelowExpectedPosition = npc.position.Y - expectedPosition + 1f; - float movementVelocity = MathHelper.Clamp(distanceBelowExpectedPosition * 0.03125f, 1f, 5f); - npc.velocity.Y = -movementVelocity; - } - else if (aboveExpectedPosition) - { - float distanceAboveExpectedPosition = expectedPosition - 1f - npc.position.Y; - float movementVelocity = MathHelper.Clamp(distanceAboveExpectedPosition * 0.03125f, 1f, 5f); - npc.velocity.Y = movementVelocity; - } - else - { - npc.velocity.Y = 0f; - npc.position.Y = expectedPosition; - } - - Vector2 eyeLocation = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float eyeTargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - eyeLocation.X; - float eyeTargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - eyeLocation.Y; - float wallVelocity = (float)Math.Sqrt(eyeTargetX * eyeTargetX + eyeTargetY * eyeTargetY); - eyeTargetX *= wallVelocity; - eyeTargetY *= wallVelocity; - - // Rotation based on direction and whether to fire lasers or not - bool shouldFireLasers = true; - if (npc.direction > 0) - { - if (Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) > npc.position.X + (npc.width / 2)) - { - npc.rotation = (float)Math.Atan2(-eyeTargetY, -eyeTargetX) + MathHelper.Pi; - } - else - { - npc.rotation = 0f; - shouldFireLasers = false; - } - } - else if (Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) < npc.position.X + (npc.width / 2)) - { - npc.rotation = (float)Math.Atan2(eyeTargetY, eyeTargetX) + MathHelper.Pi; - } - else - { - npc.rotation = 0f; - shouldFireLasers = false; - } - - // Fire lasers - if (Main.netMode != NetmodeID.MultiplayerClient) - { - // Percent life remaining - float lifeRatio = Main.npc[Main.wofNPCIndex].life / (float)Main.npc[Main.wofNPCIndex].lifeMax; - - bool charging = Main.npc[Main.wofNPCIndex].ai[3] == 1f; - - // Set up enraged laser firing timer - float enragedLaserTimer = 300f; - if (charging) - npc.localAI[3] = enragedLaserTimer; - - bool fireEnragedLasers = npc.localAI[3] > 0f && npc.localAI[3] < enragedLaserTimer; - - // Decrement the enraged laser timer - if (npc.localAI[3] > 0f) - { - npc.localAI[3] -= 1f; - - // Stop firing normal lasers when enrage ends - if (npc.localAI[3] == 0f) - npc.localAI[1] = 0f; - } - - float shootBoost = fireEnragedLasers ? (death ? 1.5f : 1.5f * (1f - lifeRatio)) : (death ? 3f : 3f * (1f - lifeRatio)); - npc.localAI[1] += 1f + shootBoost; - - bool canHit = Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height); - - if (npc.localAI[2] == 0f) - { - if (npc.localAI[1] > 400f || fireEnragedLasers) - { - npc.localAI[2] = 1f; - npc.localAI[1] = 0f; - npc.TargetClosest(); - } - } - else if (npc.localAI[1] > 45f && (canHit || fireEnragedLasers) && !charging) - { - npc.localAI[1] = 0f; - npc.localAI[2] += 1f; - if (npc.localAI[2] >= 4f) - npc.localAI[2] = 0f; - - if (shouldFireLasers) - { - bool phase2 = lifeRatio < 0.5 || bossRush; - float velocity = (fireEnragedLasers ? 3f : 4f) + shootBoost; - - int projectileType = phase2 ? ProjectileID.DeathLaser : ProjectileID.EyeLaser; - int damage = npc.GetProjectileDamage(projectileType); - - float laserSpawnDistance = fireEnragedLasers ? 30f : 22.5f; - Vector2 projectileVelocity = Vector2.Normalize(Main.player[npc.target].Center - npc.Center) * velocity; - Vector2 projectileSpawn = npc.Center + projectileVelocity * laserSpawnDistance; - - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), projectileSpawn, projectileVelocity, projectileType, damage, 0f, Main.myPlayer, 1f, 0f); - Main.projectile[proj].timeLeft = 900; - - if (!canHit) - Main.projectile[proj].tileCollide = false; - - } - } - } - - return false; - } - } -} diff --git a/NPCs/Yharon/YScreenShader.cs b/NPCs/Yharon/YScreenShader.cs index 5676c17ffe..af5d55aaed 100644 --- a/NPCs/Yharon/YScreenShader.cs +++ b/NPCs/Yharon/YScreenShader.cs @@ -36,10 +36,10 @@ namespace CalamityMod.NPCs.Yharon public override void Update(GameTime gameTime) { - if (YIndex == -1 || BossRushEvent.BossRushActive) + if ((YIndex == -1 && Main.LocalPlayer.Calamity().monolithYharonShader <= 0) || BossRushEvent.BossRushActive) { UpdateYIndex(); - if (YIndex == -1 || BossRushEvent.BossRushActive) + if ((YIndex == -1 && Main.LocalPlayer.Calamity().monolithYharonShader <= 0) || BossRushEvent.BossRushActive) Filters.Scene["CalamityMod:Yharon"].Deactivate(); } } @@ -51,6 +51,10 @@ namespace CalamityMod.NPCs.Yharon { UseTargetPosition(Main.npc[YIndex].Center); } + if (Main.LocalPlayer.Calamity().monolithYharonShader > 0) + { + UseTargetPosition(Main.LocalPlayer.Center); + } base.Apply(); } } diff --git a/NPCs/Yharon/YSky.cs b/NPCs/Yharon/YSky.cs index 8af8610893..bb673e8253 100644 --- a/NPCs/Yharon/YSky.cs +++ b/NPCs/Yharon/YSky.cs @@ -16,10 +16,10 @@ namespace CalamityMod.NPCs.Yharon public override void Update(GameTime gameTime) { - if (YIndex == -1 || BossRushEvent.BossRushActive) + if ((YIndex == -1 && Main.LocalPlayer.Calamity().monolithYharonShader <= 0) || BossRushEvent.BossRushActive) { UpdateYIndex(); - if (YIndex == -1 || BossRushEvent.BossRushActive) + if ((YIndex == -1 && Main.LocalPlayer.Calamity().monolithYharonShader <= 0) || BossRushEvent.BossRushActive) isActive = false; } @@ -56,7 +56,7 @@ namespace CalamityMod.NPCs.Yharon private bool UpdateYIndex() { int YType = ModContent.NPCType(); - if (YIndex >= 0 && Main.npc[YIndex].active && Main.npc[YIndex].type == YType) + if ((YIndex >= 0 && Main.npc[YIndex].active && Main.npc[YIndex].type == YType) || Main.LocalPlayer.Calamity().monolithYharonShader > 0) { return true; } diff --git a/NPCs/Yharon/Yharon.cs b/NPCs/Yharon/Yharon.cs index ad2d2f192f..400fdceecb 100644 --- a/NPCs/Yharon/Yharon.cs +++ b/NPCs/Yharon/Yharon.cs @@ -1,4 +1,6 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using System.IO; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Events; using CalamityMod.Items.Accessories; using CalamityMod.Items.Accessories.Wings; @@ -17,6 +19,7 @@ using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Items.Weapons.Summon; +using CalamityMod.NPCs.Bumblebirb; using CalamityMod.NPCs.TownNPCs; using CalamityMod.Particles; using CalamityMod.Projectiles.Boss; @@ -25,17 +28,15 @@ using CalamityMod.Tiles.Ores; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; +using ReLogic.Content; +using ReLogic.Utilities; using Terraria; +using Terraria.Audio; using Terraria.GameContent; using Terraria.GameContent.Bestiary; using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using ReLogic.Utilities; -using CalamityMod.NPCs.Bumblebirb; namespace CalamityMod.NPCs.Yharon { @@ -70,12 +71,16 @@ namespace CalamityMod.NPCs.Yharon public SlotId RoarSoundSlot; + public static Asset GlowTextureGreen; + public static Asset GlowTextureOrange; + public static Asset GlowTexturePurple; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 7; NPCID.Sets.TrailingMode[NPC.type] = 1; NPCID.Sets.BossBestiaryPriority.Add(Type); - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { Scale = 0.3f, PortraitScale = 0.4f, @@ -86,6 +91,12 @@ namespace CalamityMod.NPCs.Yharon value.Position.Y -= 14f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; NPCID.Sets.MPAllowedEnemies[Type] = true; + if (!Main.dedServ) + { + GlowTextureGreen = ModContent.Request(Texture + "GlowGreen", AssetRequestMode.AsyncLoad); + GlowTextureOrange = ModContent.Request(Texture + "GlowOrange", AssetRequestMode.AsyncLoad); + GlowTexturePurple = ModContent.Request(Texture + "GlowPurple", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -118,7 +129,7 @@ namespace CalamityMod.NPCs.Yharon public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Yharon") }); @@ -199,10 +210,12 @@ namespace CalamityMod.NPCs.Yharon CalamityGlobalNPC.yharon = NPC.whoAmI; CalamityGlobalNPC.yharonP2 = -1; + int setDamage = NPC.defDamage; + // Start phase 2 or not if (startSecondAI) { - Yharon_AI2(expertMode, revenge, death, bossRush, pie, lifeRatio, calamityGlobalNPC); + Yharon_AI2(expertMode, revenge, death, bossRush, pie, lifeRatio, calamityGlobalNPC, setDamage); return; } @@ -354,9 +367,9 @@ namespace CalamityMod.NPCs.Yharon if (Main.netMode != NetmodeID.MultiplayerClient) { safeBox.X = (int)(player.Center.X - (Main.zenithWorld ? 1500f : Main.getGoodWorld ? 1000f : bossRush ? 2000f : revenge ? 3000f : 3500f)); - safeBox.Y = (int)(player.Center.Y - 10500f); + safeBox.Y = (int)Main.topWorld; safeBox.Width = Main.zenithWorld ? 3000 : Main.getGoodWorld ? 2000 : bossRush ? 4000 : revenge ? 6000 : 7000; - safeBox.Height = 21000; + safeBox.Height = Main.maxTilesY * 16; Projectile.NewProjectile(NPC.GetSource_FromAI(), player.Center.X + (Main.zenithWorld ? 1500f : Main.getGoodWorld ? 1000f : bossRush ? 2000f : revenge ? 3000f : 3500f), player.Center.Y + 100f, 0f, 0f, ModContent.ProjectileType(), 0, 0f, Main.myPlayer); Projectile.NewProjectile(NPC.GetSource_FromAI(), player.Center.X - (Main.zenithWorld ? 1500f : Main.getGoodWorld ? 1000f : bossRush ? 2000f : revenge ? 3000f : 3500f), player.Center.Y + 100f, 0f, 0f, ModContent.ProjectileType(), 0, 0f, Main.myPlayer); } @@ -373,14 +386,11 @@ namespace CalamityMod.NPCs.Yharon { phaseSwitchTimer = 15; protectionBoost = true; - NPC.damage = NPC.defDamage * 5; + setDamage *= 5; chargeSpeed += 25f; } else - { - NPC.damage = NPC.defDamage; protectionBoost = false; - } } if (Main.getGoodWorld) @@ -412,9 +422,6 @@ namespace CalamityMod.NPCs.Yharon } } - if (bulletHell) - NPC.damage = 0; - NPC.dontTakeDamage = bulletHell; // Trigger spawn effects @@ -507,7 +514,7 @@ namespace CalamityMod.NPCs.Yharon Vector2 dustRotation = Vector2.Normalize(NPC.velocity) * new Vector2(NPC.width / 2f, NPC.height) * 0.75f * 0.5f; dustRotation = dustRotation.RotatedBy((i - (dustAmt / 2 - 1)) * MathHelper.TwoPi / dustAmt) + NPC.Center; Vector2 dustDirection = dustRotation - NPC.Center; - int orangeDust = Dust.NewDust(dustRotation + dustDirection, 0, 0, 244, dustDirection.X * 2f, dustDirection.Y * 2f, 100, default, 1.4f); + int orangeDust = Dust.NewDust(dustRotation + dustDirection, 0, 0, DustID.CopperCoin, dustDirection.X * 2f, dustDirection.Y * 2f, 100, default, 1.4f); Main.dust[orangeDust].noGravity = true; Main.dust[orangeDust].noLight = true; Main.dust[orangeDust].velocity = Vector2.Normalize(dustDirection) * 3f; @@ -531,6 +538,9 @@ namespace CalamityMod.NPCs.Yharon // Phase switch else if (NPC.ai[0] == 0f && !player.dead) { + // Avoid cheap bullshit + NPC.damage = 0; + if (NPC.ai[1] == 0f) NPC.ai[1] = Math.Sign((NPC.Center - player.Center).X); @@ -557,12 +567,6 @@ namespace CalamityMod.NPCs.Yharon NPC.spriteDirection = -NPC.direction; } - if (phase2Check) - { - // Avoid cheap bullshit - NPC.damage = 0; - } - NPC.ai[2] += 1f; if (NPC.ai[2] >= phaseSwitchTimer) { @@ -666,6 +670,9 @@ namespace CalamityMod.NPCs.Yharon // Charge else if (NPC.ai[0] == 1f) { + // Set damage + NPC.damage = setDamage; + ChargeDust(7, pie); NPC.ai[2] += 1f; @@ -683,6 +690,9 @@ namespace CalamityMod.NPCs.Yharon // Fireball breath else if (NPC.ai[0] == 2f) { + // Avoid cheap bullshit + NPC.damage = 0; + if (NPC.ai[1] == 0f) NPC.ai[1] = Math.Sign((NPC.Center - player.Center).X); @@ -733,6 +743,9 @@ namespace CalamityMod.NPCs.Yharon // Fire tornadoes else if (NPC.ai[0] == 3f) { + // Avoid cheap bullshit + NPC.damage = 0; + NPC.velocity *= 0.98f; NPC.velocity.Y = MathHelper.Lerp(NPC.velocity.Y, 0f, 0.02f); @@ -784,6 +797,9 @@ namespace CalamityMod.NPCs.Yharon // Fast charge else if (NPC.ai[0] == 5f) { + // Set damage + NPC.damage = setDamage; + ChargeDust(14, pie); NPC.ai[2] += 1f; @@ -803,6 +819,9 @@ namespace CalamityMod.NPCs.Yharon // Phase switch else if (NPC.ai[0] == 6f && !player.dead) { + // Avoid cheap bullshit + NPC.damage = 0; + if (NPC.ai[1] == 0f) NPC.ai[1] = Math.Sign((NPC.Center - player.Center).X); @@ -829,12 +848,6 @@ namespace CalamityMod.NPCs.Yharon NPC.spriteDirection = -NPC.direction; } - if (phase3Check) - { - // Avoid cheap bullshit - NPC.damage = 0; - } - NPC.ai[2] += 1f; if (NPC.ai[2] >= phaseSwitchTimer) { @@ -887,8 +900,6 @@ namespace CalamityMod.NPCs.Yharon } else if (aiState == 2) { - NPC.damage = 0; - if (NPC.Opacity > 0f) { NPC.Opacity -= 0.2f; @@ -903,7 +914,10 @@ namespace CalamityMod.NPCs.Yharon if (Main.netMode != NetmodeID.MultiplayerClient) { - Vector2 center = player.Center + new Vector2(0f, -540f); + float bulletHellTeleportLocationDistance = 540f; + Vector2 defaultTeleportLocation = new Vector2(0f, -bulletHellTeleportLocationDistance); + Vector2 teleportLocation = player.velocity.SafeNormalize(Vector2.Zero) * -1f * bulletHellTeleportLocationDistance; + Vector2 center = player.Center + (teleportLocation == Vector2.Zero ? defaultTeleportLocation : teleportLocation); NPC.Center = center; int type = ModContent.ProjectileType(); @@ -1007,6 +1021,9 @@ namespace CalamityMod.NPCs.Yharon // Charge else if (NPC.ai[0] == 7f) { + // Set damage + NPC.damage = setDamage; + ChargeDust(7, pie); NPC.ai[2] += 1f; @@ -1024,11 +1041,14 @@ namespace CalamityMod.NPCs.Yharon // Flare Dust bullet hell else if (NPC.ai[0] == 8f) { + // Avoid cheap bullshit + NPC.damage = 0; + if (NPC.ai[2] == 0f) { RoarSoundSlot = SoundEngine.PlaySound(RoarSound, NPC.Center); SoundEngine.PlaySound(OrbSound, NPC.Center); - } + } NPC.ai[2] += 1f; @@ -1055,6 +1075,9 @@ namespace CalamityMod.NPCs.Yharon // Infernado else if (NPC.ai[0] == 9f) { + // Avoid cheap bullshit + NPC.damage = 0; + NPC.velocity *= 0.98f; NPC.velocity.Y = MathHelper.Lerp(NPC.velocity.Y, 0f, 0.02f); @@ -1103,6 +1126,9 @@ namespace CalamityMod.NPCs.Yharon // Fast charge else if (NPC.ai[0] == 11f) { + // Set damage + NPC.damage = setDamage; + ChargeDust(14, pie); NPC.ai[2] += 1f; @@ -1120,6 +1146,9 @@ namespace CalamityMod.NPCs.Yharon // Flare Dust circle else if (NPC.ai[0] == 12f) { + // Set damage + NPC.damage = 0; + if (NPC.ai[2] == 0f) RoarSoundSlot = SoundEngine.PlaySound(RoarSound, NPC.Center); @@ -1158,6 +1187,9 @@ namespace CalamityMod.NPCs.Yharon // Phase switch else if (NPC.ai[0] == 13f && !player.dead) { + // Avoid cheap bullshit + NPC.damage = 0; + if (NPC.ai[1] == 0f) NPC.ai[1] = Math.Sign((NPC.Center - player.Center).X); @@ -1184,12 +1216,6 @@ namespace CalamityMod.NPCs.Yharon NPC.spriteDirection = -NPC.direction; } - if (phase4Check) - { - // Avoid cheap bullshit - NPC.damage = 0; - } - NPC.ai[2] += 1f; if (NPC.ai[2] >= phaseSwitchTimer) { @@ -1245,8 +1271,6 @@ namespace CalamityMod.NPCs.Yharon } else if (aiState == 2) { - NPC.damage = 0; - if (NPC.Opacity > 0f) { NPC.Opacity -= 0.2f; @@ -1261,7 +1285,10 @@ namespace CalamityMod.NPCs.Yharon if (Main.netMode != NetmodeID.MultiplayerClient) { - Vector2 center = player.Center + new Vector2(0f, -540f); + float bulletHellTeleportLocationDistance = 540f; + Vector2 defaultTeleportLocation = new Vector2(0f, -bulletHellTeleportLocationDistance); + Vector2 teleportLocation = player.velocity.SafeNormalize(Vector2.Zero) * -1f * bulletHellTeleportLocationDistance; + Vector2 center = player.Center + (teleportLocation == Vector2.Zero ? defaultTeleportLocation : teleportLocation); NPC.Center = center; int type = ModContent.ProjectileType(); @@ -1372,6 +1399,9 @@ namespace CalamityMod.NPCs.Yharon // Charge else if (NPC.ai[0] == 14f) { + // Set damage + NPC.damage = setDamage; + ChargeDust(7, pie); NPC.ai[2] += 1f; @@ -1389,6 +1419,9 @@ namespace CalamityMod.NPCs.Yharon // Flare Dust bullet hell else if (NPC.ai[0] == 15f) { + // Avoid cheap bullshit + NPC.damage = 0; + if (NPC.ai[2] == 0f) { RoarSoundSlot = SoundEngine.PlaySound(RoarSound, NPC.Center); @@ -1420,6 +1453,9 @@ namespace CalamityMod.NPCs.Yharon // Infernado else if (NPC.ai[0] == 16f) { + // Avoid cheap bullshit + NPC.damage = 0; + NPC.velocity *= 0.98f; NPC.velocity.Y = MathHelper.Lerp(NPC.velocity.Y, 0f, 0.02f); @@ -1470,6 +1506,9 @@ namespace CalamityMod.NPCs.Yharon // Fast charge else if (NPC.ai[0] == 18f) { + // Set damage + NPC.damage = setDamage; + ChargeDust(14, pie); NPC.ai[2] += 1f; @@ -1487,6 +1526,9 @@ namespace CalamityMod.NPCs.Yharon // Fireball ring else if (NPC.ai[0] == 19f) { + // Set damage + NPC.damage = 0; + if (NPC.ai[2] == 0f) RoarSoundSlot = SoundEngine.PlaySound(RoarSound, NPC.Center); @@ -1523,6 +1565,9 @@ namespace CalamityMod.NPCs.Yharon // Fireball breath else if (NPC.ai[0] == 20f) { + // Avoid cheap bullshit + NPC.damage = 0; + if (NPC.ai[1] == 0f) NPC.ai[1] = Math.Sign((NPC.Center - player.Center).X); @@ -1573,7 +1618,7 @@ namespace CalamityMod.NPCs.Yharon } #region AI2 - public void Yharon_AI2(bool expertMode, bool revenge, bool death, bool bossRush, float pie, float lifeRatio, CalamityGlobalNPC calamityGlobalNPC) + public void Yharon_AI2(bool expertMode, bool revenge, bool death, bool bossRush, float pie, float lifeRatio, CalamityGlobalNPC calamityGlobalNPC, int contactDamage) { CalamityGlobalNPC.yharonP2 = NPC.whoAmI; @@ -1601,6 +1646,8 @@ namespace CalamityMod.NPCs.Yharon CalamityUtils.DisplayLocalizedText(key, messageColor); } + int setDamage = contactDamage; + NPC.dontTakeDamage = false; bool invincible = invincibilityCounter < Phase2InvincibilityTime; @@ -1632,7 +1679,10 @@ namespace CalamityMod.NPCs.Yharon // 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(); + NPC.netUpdate = true; + } Player targetData = Main.player[NPC.target]; @@ -1641,6 +1691,7 @@ namespace CalamityMod.NPCs.Yharon if (targetData.dead || !targetData.active) { NPC.TargetClosest(); + NPC.netUpdate = true; targetData = Main.player[NPC.target]; if (targetData.dead || !targetData.active) { @@ -1662,13 +1713,10 @@ namespace CalamityMod.NPCs.Yharon if (enraged) { protectionBoost = true; - NPC.damage = NPC.defDamage * 5; + setDamage *= 5; } else - { protectionBoost = false; - NPC.damage = NPC.defDamage; - } // Set DR based on protection boost (aka enrage) bool bulletHell = NPC.ai[0] == 5f; @@ -1683,12 +1731,6 @@ namespace CalamityMod.NPCs.Yharon { case 1: - if (phase2) - { - // Avoid cheap bullshit - NPC.damage = 0; - } - calamityGlobalNPC.DR = phase2 ? (bossRush ? 0.99f : 0.7f) : normalDR; calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = phase2; @@ -1696,12 +1738,6 @@ namespace CalamityMod.NPCs.Yharon case 2: - if (phase3) - { - // Avoid cheap bullshit - NPC.damage = 0; - } - calamityGlobalNPC.DR = phase3 ? (bossRush ? 0.99f : 0.7f) : normalDR; calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = phase3; @@ -1709,12 +1745,6 @@ namespace CalamityMod.NPCs.Yharon case 3: - if (phase4) - { - // Avoid cheap bullshit - NPC.damage = 0; - } - calamityGlobalNPC.DR = phase4 ? (bossRush ? 0.99f : 0.7f) : normalDR; calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = phase4; @@ -1728,9 +1758,6 @@ namespace CalamityMod.NPCs.Yharon } } - if (bulletHell) - NPC.damage = 0; - float reduceSpeedChargeDistance = 500f; float reduceSpeedFireballSpitChargeDistance = 800f; float phaseSwitchTimer = bossRush ? 28f : expertMode ? 30f : 32f; @@ -1790,6 +1817,9 @@ namespace CalamityMod.NPCs.Yharon if (NPC.ai[0] == 0f) { + // Avoid cheap bullshit + NPC.damage = 0; + NPC.ai[1] += 1f; if (NPC.ai[1] >= 10f) { @@ -1801,6 +1831,9 @@ namespace CalamityMod.NPCs.Yharon } else if (NPC.ai[0] == 1f) { + // Avoid cheap bullshit + NPC.damage = 0; + if (NPC.ai[2] == 0f) NPC.ai[2] = (NPC.Center.X < targetData.Center.X) ? 1 : -1; @@ -1810,7 +1843,7 @@ namespace CalamityMod.NPCs.Yharon if (!targetDead) { if (Vector2.Distance(NPC.Center, destination) > reduceSpeedChargeDistance) - NPC.SimpleFlyMovement(desiredVelocity, acceleration); + NPC.SimpleFlyMovement(desiredVelocity, acceleration); else NPC.velocity *= 0.98f; } @@ -1827,14 +1860,14 @@ namespace CalamityMod.NPCs.Yharon switch ((int)NPC.ai[3]) { case 0: - phase2AttackType = 8; //teleport + phase2AttackType = 8; // Teleport break; case 1: case 2: - phase2AttackType = 7; //fast charge + phase2AttackType = 7; // Fast charge break; case 3: - phase2AttackType = 5; //fire circle + tornado (only once) + fireballs + phase2AttackType = 5; // Fire circle + tornado (only once) + fireballs break; } } @@ -1843,52 +1876,52 @@ namespace CalamityMod.NPCs.Yharon switch ((int)NPC.ai[3]) { case 0: - phase2AttackType = 6; //tornado + phase2AttackType = 6; // Tornado break; case 1: - phase2AttackType = 7; //fast charge + phase2AttackType = 7; // Fast charge break; case 2: - phase2AttackType = 8; //teleport + phase2AttackType = 8; // Teleport break; case 3: - phase2AttackType = 7; //fast charge + phase2AttackType = 7; // Fast charge break; case 4: - phase2AttackType = 5; //fire circle + phase2AttackType = 5; // Fire circle break; case 5: - phase2AttackType = Main.rand.NextBool() ? 3 : 4; //fireballs + phase2AttackType = Main.rand.NextBool() ? 3 : 4; // Fireballs break; case 6: - phase2AttackType = 7; //fast charge + phase2AttackType = 7; // Fast charge break; case 7: - phase2AttackType = 8; //teleport + phase2AttackType = 8; // Teleport break; case 8: - phase2AttackType = 7; //fast charge + phase2AttackType = 7; // Fast charge break; case 9: - phase2AttackType = Main.rand.NextBool() ? 4 : 3; //fireballs + phase2AttackType = Main.rand.NextBool() ? 4 : 3; // Fireballs break; case 10: - phase2AttackType = 6; //tornado + phase2AttackType = 6; // Tornado break; case 11: - phase2AttackType = 7; //fast charge + phase2AttackType = 7; // Fast charge break; case 12: - phase2AttackType = 8; //teleport + phase2AttackType = 8; // Teleport break; case 13: - phase2AttackType = 7; //fast charge + phase2AttackType = 7; // Fast charge break; case 14: - phase2AttackType = 5; //fire circle + phase2AttackType = 5; // Fire circle break; case 15: - phase2AttackType = Main.rand.NextBool() ? 3 : 4; //fireballs + phase2AttackType = Main.rand.NextBool() ? 3 : 4; // Fireballs break; } } @@ -1897,37 +1930,37 @@ namespace CalamityMod.NPCs.Yharon switch ((int)NPC.ai[3]) { case 0: - phase2AttackType = 6; //tornado + phase2AttackType = 6; // Tornado break; case 1: - phase2AttackType = 7; //fast charge + phase2AttackType = 7; // Fast charge break; case 2: - phase2AttackType = 2; //charge + phase2AttackType = 2; // Charge break; case 3: - phase2AttackType = 5; //fire circle + phase2AttackType = 5; // Fire circle break; case 4: - phase2AttackType = Main.rand.NextBool() ? 3 : 4; //fireballs + phase2AttackType = Main.rand.NextBool() ? 3 : 4; // Fireballs break; case 5: - phase2AttackType = 7; //fast charge + phase2AttackType = 7; // Fast charge break; case 6: - phase2AttackType = 2; //charge + phase2AttackType = 2; // Charge break; case 7: - phase2AttackType = Main.rand.NextBool() ? 4 : 3; //fireballs + phase2AttackType = Main.rand.NextBool() ? 4 : 3; // Fireballs break; case 8: - phase2AttackType = 7; //fast charge + phase2AttackType = 7; // Fast charge break; case 9: - phase2AttackType = 2; //charge + phase2AttackType = 2; // Charge break; case 10: - phase2AttackType = 5; //fire circle + phase2AttackType = 5; // Fire circle break; } } @@ -1936,36 +1969,34 @@ namespace CalamityMod.NPCs.Yharon switch ((int)NPC.ai[3]) { case 0: - phase2AttackType = 6; //tornado + phase2AttackType = 6; // Tornado break; case 1: case 2: - phase2AttackType = 2; //charge + phase2AttackType = 2; // Charge break; case 3: - phase2AttackType = Main.rand.NextBool() ? 3 : 4; //fireballs + phase2AttackType = Main.rand.NextBool() ? 3 : 4; // Fireballs break; case 4: case 5: - phase2AttackType = 7; //fast charge + phase2AttackType = 7; // Fast charge break; case 6: - phase2AttackType = Main.rand.NextBool() ? 4 : 3; //fireballs + phase2AttackType = Main.rand.NextBool() ? 4 : 3; // Fireballs break; case 7: case 8: - phase2AttackType = 2; //charge + phase2AttackType = 2; // Charge break; case 9: - phase2AttackType = 5; //fire circle + phase2AttackType = 5; // Fire circle break; } } if (phase2AttackType == 5 && NPC.ai[1] < phaseSwitchTimer + teleportPhaseTimer) { - NPC.damage = 0; - float newRotation = NPC.AngleTo(targetData.Center); float amount = 0.04f; @@ -1996,7 +2027,10 @@ namespace CalamityMod.NPCs.Yharon NPC.SpawnOnPlayer(NPC.FindClosestPlayer(), ModContent.NPCType()); } - Vector2 center = targetData.Center + new Vector2(0f, -540f); + float bulletHellTeleportLocationDistance = 540f; + Vector2 defaultTeleportLocation = new Vector2(0f, -bulletHellTeleportLocationDistance); + Vector2 teleportLocation = targetData.velocity.SafeNormalize(Vector2.Zero) * -1f * bulletHellTeleportLocationDistance; + Vector2 center = targetData.Center + (teleportLocation == Vector2.Zero ? defaultTeleportLocation : teleportLocation); NPC.Center = center; int type = ModContent.ProjectileType(); @@ -2062,6 +2096,7 @@ namespace CalamityMod.NPCs.Yharon NPC.ai[3] = Main.rand.Next(11); } break; + case 2: if (phase3) { @@ -2072,6 +2107,7 @@ namespace CalamityMod.NPCs.Yharon NPC.ai[3] = Main.rand.Next(16); } break; + case 3: if (phase4) { @@ -2099,49 +2135,51 @@ namespace CalamityMod.NPCs.Yharon switch (phase2AttackType) { - case 2: //charge - { - Vector2 vector = NPC.SafeDirectionTo(targetData.Center, Vector2.UnitX * NPC.spriteDirection); - NPC.spriteDirection = (vector.X > 0f) ? 1 : -1; - NPC.rotation = vector.ToRotation(); + case 2: // Charge + { + Vector2 vector = NPC.SafeDirectionTo(targetData.Center, Vector2.UnitX * NPC.spriteDirection); + NPC.spriteDirection = (vector.X > 0f) ? 1 : -1; + NPC.rotation = vector.ToRotation(); - if (NPC.spriteDirection == -1) - NPC.rotation += pie; + if (NPC.spriteDirection == -1) + NPC.rotation += pie; - NPC.velocity = vector * chargeSpeed; + NPC.velocity = vector * chargeSpeed; - break; - } - case 3: //fireballs - { - Vector2 fireSpitFaceDirection = new Vector2((targetData.Center.X > NPC.Center.X) ? 1 : -1, 0f); - NPC.spriteDirection = (fireSpitFaceDirection.X > 0f) ? 1 : -1; - NPC.velocity = fireSpitFaceDirection * -2f; + break; + } - break; - } - case 5: //spin move - { - NPC.damage = 0; - NPC.dontTakeDamage = true; - NPC.localAI[3] = Main.rand.Next(2); - NPC.velocity = Vector2.Zero; + case 3: // Fireballs + { + Vector2 fireSpitFaceDirection = new Vector2((targetData.Center.X > NPC.Center.X) ? 1 : -1, 0f); + NPC.spriteDirection = (fireSpitFaceDirection.X > 0f) ? 1 : -1; + NPC.velocity = fireSpitFaceDirection * -2f; - break; - } - case 7: //fast charge - { - Vector2 vector = NPC.SafeDirectionTo(targetData.Center, Vector2.UnitX * NPC.spriteDirection); - NPC.spriteDirection = (vector.X > 0f) ? 1 : -1; - NPC.rotation = vector.ToRotation(); + break; + } - if (NPC.spriteDirection == -1) - NPC.rotation += pie; + case 5: // Spin move + { + NPC.dontTakeDamage = true; + NPC.localAI[3] = Main.rand.Next(2); + NPC.velocity = Vector2.Zero; - NPC.velocity = vector * chargeSpeed * fastChargeVelocityMultiplier; + break; + } - break; - } + case 7: // Fast charge + { + Vector2 vector = NPC.SafeDirectionTo(targetData.Center, Vector2.UnitX * NPC.spriteDirection); + NPC.spriteDirection = (vector.X > 0f) ? 1 : -1; + NPC.rotation = vector.ToRotation(); + + if (NPC.spriteDirection == -1) + NPC.rotation += pie; + + NPC.velocity = vector * chargeSpeed * fastChargeVelocityMultiplier; + + break; + } } } } @@ -2149,6 +2187,9 @@ namespace CalamityMod.NPCs.Yharon // Charge else if (NPC.ai[0] == 2f) { + // Set damage + NPC.damage = setDamage; + if (NPC.ai[1] == 1f) SoundEngine.PlaySound(ShortRoarSound, NPC.Center); @@ -2167,6 +2208,9 @@ namespace CalamityMod.NPCs.Yharon // Fireball spit charge else if (NPC.ai[0] == 3f) { + // Avoid cheap bullshit + NPC.damage = 0; + int fireballFaceDirection = (NPC.Center.X < targetData.Center.X) ? 1 : -1; NPC.ai[1] += 1f; @@ -2232,6 +2276,9 @@ namespace CalamityMod.NPCs.Yharon // Splitting fireball breath else if (NPC.ai[0] == 4f) { + // Avoid cheap bullshit + NPC.damage = 0; + int splitFireFaceDirection = (NPC.Center.X < targetData.Center.X) ? 1 : -1; NPC.ai[2] = splitFireFaceDirection; @@ -2294,6 +2341,9 @@ namespace CalamityMod.NPCs.Yharon // Fireball spin else if (NPC.ai[0] == 5f) { + // Avoid cheap bullshit + NPC.damage = 0; + if (NPC.ai[1] == 1f) { RoarSoundSlot = SoundEngine.PlaySound(RoarSound, NPC.Center); @@ -2357,6 +2407,9 @@ namespace CalamityMod.NPCs.Yharon // Fire ring else if (NPC.ai[0] == 6f) { + // Avoid cheap bullshit + NPC.damage = 0; + if (NPC.ai[1] == 0f) { Vector2 destination2 = targetData.Center + new Vector2(0f, -200f); @@ -2418,6 +2471,9 @@ namespace CalamityMod.NPCs.Yharon // Fast charge else if (NPC.ai[0] == 7f) { + // Set damage + NPC.damage = setDamage; + if (NPC.ai[1] == 1f) SoundEngine.PlaySound(ShortRoarSound, NPC.Center); @@ -2577,7 +2633,7 @@ namespace CalamityMod.NPCs.Yharon Vector2 dustRotate = Vector2.Normalize(NPC.velocity) * new Vector2((NPC.width + 50) / 2f, NPC.height) * 0.75f; dustRotate = dustRotate.RotatedBy((i - (dustAmt / 2 - 1)) * (double)pie / (float)dustAmt) + NPC.Center; Vector2 dustVel = ((float)(Main.rand.NextDouble() * pie) - MathHelper.PiOver2).ToRotationVector2() * Main.rand.Next(3, 8); - int chargeDust = Dust.NewDust(dustRotate + dustVel, 0, 0, 244, dustVel.X * 2f, dustVel.Y * 2f, 100, default, 1.4f); + int chargeDust = Dust.NewDust(dustRotate + dustVel, 0, 0, DustID.CopperCoin, dustVel.X * 2f, dustVel.Y * 2f, 100, default, 1.4f); Main.dust[chargeDust].noGravity = true; Main.dust[chargeDust].noLight = true; Main.dust[chargeDust].velocity /= 4f; @@ -2782,15 +2838,15 @@ namespace CalamityMod.NPCs.Yharon if (enteredSubphase2 || NPC.ai[0] == 4f || startSecondAI) { - texture = ModContent.Request("CalamityMod/NPCs/Yharon/YharonGlowOrange").Value; + texture = GlowTextureOrange.Value; Color orangeGlowColor = Color.Lerp(Color.White, invincible ? invincibleColor : Color.Orange, 0.5f) * NPC.Opacity; lerpEndColor = invincible ? invincibleColor : Color.Orange; - Texture2D texture2 = ModContent.Request("CalamityMod/NPCs/Yharon/YharonGlowGreen").Value; + Texture2D texture2 = GlowTextureGreen.Value; Color greenGlowColorOpacity = Color.Lerp(Color.White, invincible ? invincibleColor : Color.Chartreuse, 0.5f) * NPC.Opacity; Color greenGlowColor = invincible ? invincibleColor : Color.Chartreuse; - Texture2D texture3 = ModContent.Request("CalamityMod/NPCs/Yharon/YharonGlowPurple").Value; + Texture2D texture3 = GlowTexturePurple.Value; Color blueGlowColorOpacity = Color.Lerp(Color.White, invincible ? invincibleColor : Color.BlueViolet, 0.5f) * NPC.Opacity; Color blueGlowColor = invincible ? invincibleColor : Color.BlueViolet; @@ -2929,7 +2985,7 @@ namespace CalamityMod.NPCs.Yharon ModContent.ItemType(), ModContent.ItemType(), // Yharon Kindle Staff ModContent.ItemType(), // Infernal Spear - ModContent.ItemType(), + ModContent.ItemType(), }; normalOnly.Add(DropHelper.CalamityStyle(DropHelper.NormalWeaponDropRateFraction, weapons)); normalOnly.Add(ModContent.ItemType(), 10); @@ -3028,7 +3084,7 @@ namespace CalamityMod.NPCs.Yharon public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { - NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } #endregion @@ -3069,13 +3125,13 @@ namespace CalamityMod.NPCs.Yharon } if (NPC.frame.Y >= frameHeight * 5) NPC.frame.Y = 0; - } + } else { NPC.frame.Y = frameHeight * 5; if (doTelegraphRoarAnimation) NPC.frame.Y = frameHeight * 6; - } + } return; } @@ -3183,7 +3239,7 @@ namespace CalamityMod.NPCs.Yharon NPC.position.Y = NPC.position.Y - (NPC.height / 2); for (int i = 0; i < 40; i++) { - int fieryDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 244, 0f, 0f, 100, default, 2f); + int fieryDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.CopperCoin, 0f, 0f, 100, default, 2f); Main.dust[fieryDust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -3193,10 +3249,10 @@ namespace CalamityMod.NPCs.Yharon } for (int j = 0; j < 70; j++) { - int fieryDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 244, 0f, 0f, 100, default, 3f); + int fieryDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.CopperCoin, 0f, 0f, 100, default, 3f); Main.dust[fieryDust2].noGravity = true; Main.dust[fieryDust2].velocity *= 5f; - fieryDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 244, 0f, 0f, 100, default, 2f); + fieryDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.CopperCoin, 0f, 0f, 100, default, 2f); Main.dust[fieryDust2].velocity *= 2f; } diff --git a/Particles/AltLineParticle.cs b/Particles/AltLineParticle.cs index 5dfd32e142..443112ff63 100644 --- a/Particles/AltLineParticle.cs +++ b/Particles/AltLineParticle.cs @@ -1,6 +1,6 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ModLoader; diff --git a/Particles/AltSparkParticle.cs b/Particles/AltSparkParticle.cs index 24fd3ec6c8..f3aaa1b2e8 100644 --- a/Particles/AltSparkParticle.cs +++ b/Particles/AltSparkParticle.cs @@ -1,6 +1,6 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ModLoader; diff --git a/Particles/AresCannonChargeParticleSet.cs b/Particles/AresCannonChargeParticleSet.cs index fdee9b8d30..5e9b00f425 100644 --- a/Particles/AresCannonChargeParticleSet.cs +++ b/Particles/AresCannonChargeParticleSet.cs @@ -1,5 +1,5 @@ -using Microsoft.Xna.Framework; -using System.Collections.Generic; +using System.Collections.Generic; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using static CalamityMod.CalamityUtils; diff --git a/Particles/AresSummonCrateParticle.cs b/Particles/AresSummonCrateParticle.cs index d79e48fd8f..a28169644a 100644 --- a/Particles/AresSummonCrateParticle.cs +++ b/Particles/AresSummonCrateParticle.cs @@ -1,7 +1,7 @@ -using Microsoft.Xna.Framework; -using Terraria; -using System; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using Terraria; namespace CalamityMod.Particles { diff --git a/Particles/ArianeFakeDust.cs b/Particles/ArianeFakeDust.cs new file mode 100644 index 0000000000..471a4462e1 --- /dev/null +++ b/Particles/ArianeFakeDust.cs @@ -0,0 +1,55 @@ +using System; +using CalamityMod.Projectiles.Summon; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Particles +{ + public class ArianeFakeDust : Particle + { + public override string Texture => "CalamityMod/Particles/FakeDust"; + public override bool UseAdditiveBlend => true; + public override bool UseCustomDraw => true; + public override bool SetLifetime => true; + + private Projectile Projectile; + private Vector2 RelativePosition; + private float Spin; + private float Opacity; + private bool Big; + + public ArianeFakeDust(Projectile proj, Vector2 relativePosition, Vector2 velocity, Color color, float scale, int lifeTime, float rotationSpeed = 1f, bool bigSize = false) + { + Projectile = proj; + RelativePosition = relativePosition; + Velocity = velocity; + Color = color; + Scale = scale; + Lifetime = lifeTime; + Rotation = Main.rand.NextFloat(MathHelper.TwoPi); + Spin = rotationSpeed; + Big = bigSize; + Variant = Main.rand.Next(3); + } + + public override void Update() + { + if (Projectile != null && Projectile.active && Projectile.type == ModContent.ProjectileType()) + Position = Projectile.Center + RelativePosition; + + Velocity *= 0.95f; + Scale *= 0.98f; + Rotation += Spin * ((Velocity.X > 0) ? 1f : -1f); + Opacity = (float)Math.Sin(LifetimeCompletion * MathHelper.Pi); + } + + public override void CustomDraw(SpriteBatch spriteBatch) + { + Texture2D dustTexture = Big ? ModContent.Request("CalamityMod/Particles/FakeDustBig").Value : ModContent.Request(Texture).Value; + Rectangle frame = new Rectangle(0, (Big ? 8 : 6) * Variant, (Big ? 8 : 6), (Big ? 8 : 6)); + spriteBatch.Draw(dustTexture, Position - Main.screenPosition, frame, Color * Opacity, Rotation, frame.Size() / 2f, Scale, SpriteEffects.None, 0); + } + } +} diff --git a/Particles/AuraPulseRing.cs b/Particles/AuraPulseRing.cs index ac9981d2a4..0de108aa45 100644 --- a/Particles/AuraPulseRing.cs +++ b/Particles/AuraPulseRing.cs @@ -1,9 +1,9 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using static CalamityMod.CalamityUtils; using Terraria; using Terraria.ModLoader; +using static CalamityMod.CalamityUtils; namespace CalamityMod.Particles { @@ -32,8 +32,8 @@ namespace CalamityMod.Particles public override void Update() { - float pulseProgress = PiecewiseAnimation(LifetimeCompletion, new CurveSegment[] { new CurveSegment(SineBumpEasing, 0f, 0f, 1f)}); - + float pulseProgress = PiecewiseAnimation(LifetimeCompletion, new CurveSegment[] { new CurveSegment(SineBumpEasing, 0f, 0f, 1f) }); + float heightProgress = PiecewiseAnimation(LifetimeCompletion, new CurveSegment[] { new CurveSegment(SineInOutEasing, 0f, 0f, 1f) }); opacity = (float)Math.Sin(LifetimeCompletion * MathHelper.Pi) * 0.8f + 0.2f; @@ -44,7 +44,7 @@ namespace CalamityMod.Particles if (StuckTo != null && StuckTo.active) { CurrentScale = Vector2.Lerp(OriginalScale, FinalScale, pulseProgress) * StuckTo.scale; - RelativeOffset = - Vector2.UnitY.RotatedBy(StuckTo.rotation) * StuckTo.height / 2f + Vector2.UnitY.RotatedBy(StuckTo.rotation) * StuckTo.height * heightProgress; + RelativeOffset = -Vector2.UnitY.RotatedBy(StuckTo.rotation) * StuckTo.height / 2f + Vector2.UnitY.RotatedBy(StuckTo.rotation) * StuckTo.height * heightProgress; Rotation = StuckTo.rotation; } } diff --git a/Particles/BaseParticleSet.cs b/Particles/BaseParticleSet.cs index 9c6c7c150e..16f6432ed3 100644 --- a/Particles/BaseParticleSet.cs +++ b/Particles/BaseParticleSet.cs @@ -1,8 +1,8 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; +using System; using System.Collections.Generic; using System.Linq; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -60,7 +60,7 @@ namespace CalamityMod.Particles } // Update and increment the time of all particles, alongside modifying their offset based on their velocity. - foreach(Particle particle in Particles) + foreach (Particle particle in Particles) { particle.RelativeOffset += particle.Velocity; particle.Time++; diff --git a/Particles/BloodParticle.cs b/Particles/BloodParticle.cs index 6f50f2f609..9bb8333486 100644 --- a/Particles/BloodParticle.cs +++ b/Particles/BloodParticle.cs @@ -1,6 +1,6 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ModLoader; diff --git a/Particles/BloodParticle2.cs b/Particles/BloodParticle2.cs index 5117d4edd5..ee8b9bf707 100644 --- a/Particles/BloodParticle2.cs +++ b/Particles/BloodParticle2.cs @@ -1,6 +1,6 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ModLoader; diff --git a/Particles/BloomLineVFX.cs b/Particles/BloomLineVFX.cs index 6943ad0b76..f4e6513561 100644 --- a/Particles/BloomLineVFX.cs +++ b/Particles/BloomLineVFX.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Particles { Texture2D tex = ModContent.Request(Texture).Value; float rot = LineVector.ToRotation() + MathHelper.PiOver2; - Vector2 origin = new Vector2(tex.Width/2f, tex.Height); + Vector2 origin = new Vector2(tex.Width / 2f, tex.Height); Vector2 scale = new Vector2(Scale, LineVector.Length() / tex.Height); spriteBatch.Draw(tex, Position - Main.screenPosition, null, Color, rot, origin, scale, SpriteEffects.None, 0); diff --git a/Particles/BloomParticle.cs b/Particles/BloomParticle.cs new file mode 100644 index 0000000000..5a788818cf --- /dev/null +++ b/Particles/BloomParticle.cs @@ -0,0 +1,53 @@ +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 BloomParticle : Particle + { + public override string Texture => "CalamityMod/Particles/BloomCircle"; + public override bool UseAdditiveBlend => true; + public override bool SetLifetime => true; + public override bool UseCustomDraw => true; + + private float OriginalScale; + private float FinalScale; + private float opacity; + private Color BaseColor; + private bool Fade; + + public BloomParticle(Vector2 position, Vector2 velocity, Color color, float originalScale, float finalScale, int lifeTime, bool fade = true) + { + Position = position; + Velocity = velocity; + BaseColor = color; + OriginalScale = originalScale; + FinalScale = finalScale; + Scale = originalScale; + Lifetime = lifeTime; + Fade = fade; + } + + public override void Update() + { + float pulseProgress = PiecewiseAnimation(LifetimeCompletion, new CurveSegment[] { new CurveSegment(EasingType.PolyOut, 0f, 0f, 1f, 4) }); + Scale = MathHelper.Lerp(OriginalScale, FinalScale, pulseProgress); + if (Fade) + opacity = (float)Math.Sin(MathHelper.PiOver2 + LifetimeCompletion * MathHelper.PiOver2); + + Color = BaseColor * (Fade ? opacity : 1); + Lighting.AddLight(Position, Color.R / 255f, Color.G / 255f, Color.B / 255f); + } + + public override void CustomDraw(SpriteBatch spriteBatch) + { + Texture2D tex = ModContent.Request(Texture).Value; + spriteBatch.Draw(tex, Position - Main.screenPosition, null, Color * (Fade ? opacity : 1), 0, tex.Size() / 2f, Scale, SpriteEffects.None, 0); + } + + } +} diff --git a/Particles/BloomRing.cs b/Particles/BloomRing.cs index ea8fe0f9ff..33a6921139 100644 --- a/Particles/BloomRing.cs +++ b/Particles/BloomRing.cs @@ -1,6 +1,6 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ModLoader; diff --git a/Particles/CentralGold.png b/Particles/CentralGold.png new file mode 100644 index 0000000000..f91e12cdb7 Binary files /dev/null and b/Particles/CentralGold.png differ diff --git a/Particles/ChargeUpLineVFX.cs b/Particles/ChargeUpLineVFX.cs index 1b3a6f9d7f..2d186b6e57 100644 --- a/Particles/ChargeUpLineVFX.cs +++ b/Particles/ChargeUpLineVFX.cs @@ -1,6 +1,6 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ModLoader; using static CalamityMod.CalamityUtils; @@ -46,7 +46,7 @@ namespace CalamityMod.Particles public CurveSegment goBack = new CurveSegment(EasingType.SineInOut, 0f, 1f, 0.25f); public CurveSegment goForward = new CurveSegment(EasingType.SineIn, 0.35f, 1.25f, -1.25f); - public float offsetPosition() => PiecewiseAnimation(LifetimeCompletion, new CurveSegment[] { goBack , goForward } ); + public float offsetPosition() => PiecewiseAnimation(LifetimeCompletion, new CurveSegment[] { goBack, goForward }); public CurveSegment noSquish = new CurveSegment(EasingType.Linear, 0f, 1f, 0f); public CurveSegment squishSpeed = new CurveSegment(EasingType.SineIn, 0.35f, 1f, 0.8f); diff --git a/Particles/ConstellationRing.cs b/Particles/ConstellationRing.cs index 49798eef21..b86e1c4fad 100644 --- a/Particles/ConstellationRing.cs +++ b/Particles/ConstellationRing.cs @@ -1,6 +1,6 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ModLoader; diff --git a/Particles/Crack.png b/Particles/Crack.png index ef945142ec..74dc9cb10d 100644 Binary files a/Particles/Crack.png and b/Particles/Crack.png differ diff --git a/Particles/CrackParticle.cs b/Particles/CrackParticle.cs index 5743457e80..c486aa04c1 100644 --- a/Particles/CrackParticle.cs +++ b/Particles/CrackParticle.cs @@ -1,9 +1,9 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using static CalamityMod.CalamityUtils; using Terraria; using Terraria.ModLoader; +using static CalamityMod.CalamityUtils; namespace CalamityMod.Particles { @@ -51,7 +51,7 @@ namespace CalamityMod.Particles public override void CustomDraw(SpriteBatch spriteBatch) { Texture2D tex = ModContent.Request(Texture).Value; - spriteBatch.Draw(tex, Position - Main.screenPosition, null, Color * opacity, Rotation, tex.Size() / 2f, Scale * Squish, SpriteEffects.None, 0); + spriteBatch.Draw(tex, Position - Main.screenPosition, null, Color * opacity, Rotation, tex.Size() / 2f, (Scale * Squish) / 3, SpriteEffects.None, 0); } } diff --git a/Particles/CritSpark.cs b/Particles/CritSpark.cs index a7f6d91373..9f1deb5e9f 100644 --- a/Particles/CritSpark.cs +++ b/Particles/CritSpark.cs @@ -1,6 +1,6 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ModLoader; diff --git a/Particles/CustomPulse.cs b/Particles/CustomPulse.cs new file mode 100644 index 0000000000..a3072597f7 --- /dev/null +++ b/Particles/CustomPulse.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 CustomPulse : Particle + { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public bool UseAltVisual = true; + public override bool UseAdditiveBlend => UseAltVisual; + public override bool SetLifetime => true; + public override bool UseCustomDraw => true; + + private string NewTexture; + private float OriginalScale; + private float FinalScale; + private float opacity; + private Vector2 Squish; + private Color BaseColor; + + public CustomPulse(Vector2 position, Vector2 velocity, Color color, string texture, Vector2 squish, float rotation, float originalScale, float finalScale, int lifeTime, bool UseAdditiveBlend = true) + { + Position = position; + Velocity = velocity; + BaseColor = color; + NewTexture = texture; + OriginalScale = originalScale; + FinalScale = finalScale; + Scale = originalScale; + Lifetime = lifeTime; + Squish = squish; + Rotation = rotation; + UseAltVisual = UseAdditiveBlend; + } + + public override void Update() + { + float pulseProgress = PiecewiseAnimation(LifetimeCompletion, new CurveSegment[] { new CurveSegment(EasingType.PolyOut, 0f, 0f, 1f, 4) }); + Scale = MathHelper.Lerp(OriginalScale, FinalScale, pulseProgress); + + opacity = (float)Math.Sin(MathHelper.PiOver2 + LifetimeCompletion * MathHelper.PiOver2); + + Color = BaseColor * opacity; + Lighting.AddLight(Position, Color.R / 255f, Color.G / 255f, Color.B / 255f); + Velocity *= 0.95f; + } + + public override void CustomDraw(SpriteBatch spriteBatch) + { + Texture2D tex = ModContent.Request(NewTexture).Value; + spriteBatch.Draw(tex, Position - Main.screenPosition, null, Color * opacity, Rotation, tex.Size() / 2f, Scale * Squish, SpriteEffects.None, 0); + } + + } +} diff --git a/Particles/CuteManaStarParticle.cs b/Particles/CuteManaStarParticle.cs index 94ec2f32e1..63461f1970 100644 --- a/Particles/CuteManaStarParticle.cs +++ b/Particles/CuteManaStarParticle.cs @@ -1,6 +1,6 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ModLoader; diff --git a/Particles/DeathAshParticle.cs b/Particles/DeathAshParticle.cs index 8e4464b4b2..58284da0b3 100644 --- a/Particles/DeathAshParticle.cs +++ b/Particles/DeathAshParticle.cs @@ -1,9 +1,9 @@ -using CalamityMod.Graphics; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; +using System; using System.Collections.Generic; using System.Linq; +using CalamityMod.Graphics; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; diff --git a/Particles/DesertProwlerSkullParticle.cs b/Particles/DesertProwlerSkullParticle.cs index 67a7da4384..924e70178a 100644 --- a/Particles/DesertProwlerSkullParticle.cs +++ b/Particles/DesertProwlerSkullParticle.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Particles ColorFade = colorFade; Scale = scale; Opacity = opacity; - BaseOpacity = opacity; + BaseOpacity = opacity; Rotation = Main.rand.NextFloat(MathHelper.PiOver4 * 0.5f) - MathHelper.PiOver4 * 0.25f; } diff --git a/Particles/DestroyerReticleTelegraph.cs b/Particles/DestroyerReticleTelegraph.cs new file mode 100644 index 0000000000..27adb4fd11 --- /dev/null +++ b/Particles/DestroyerReticleTelegraph.cs @@ -0,0 +1,57 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; +using static CalamityMod.CalamityUtils; + +namespace CalamityMod.Particles +{ + public class DestroyerReticleTelegraph : Particle + { + public override string Texture => "CalamityMod/Particles/DestroyerReticleTelegraph"; + public override bool UseAdditiveBlend => true; + public override bool SetLifetime => true; + public override bool UseCustomDraw => true; + public override bool Important => true; + + private NPC NPCToFollow; + private float OriginalScale; + private float FinalScale; + private float Opacity; + private int RotationDirection; + + public DestroyerReticleTelegraph(NPC npcToFollow, Color color, float originalScale, float finalScale, int lifeTime) + { + NPCToFollow = npcToFollow; + Color = color; + OriginalScale = originalScale; + Scale = originalScale; + FinalScale = finalScale; + Lifetime = lifeTime; + RotationDirection = Main.rand.NextBool().ToDirectionInt(); + } + + public override void Update() + { + float pulseProgress = PiecewiseAnimation(LifetimeCompletion, new CurveSegment[] { new(EasingType.PolyOut, 0f, 0f, 1f, 4) }); + Scale = MathHelper.Lerp(OriginalScale, FinalScale, pulseProgress); + Opacity = pulseProgress; + Rotation += MathHelper.ToRadians(8f) * (1f - pulseProgress) * RotationDirection; + + if (NPCToFollow != null && NPCToFollow.active && !Main.tile[NPCToFollow.Center.ToSafeTileCoordinates()].IsTileSolid()) + { + Position = NPCToFollow.Center; + if (NPCToFollow.ai[2] == 1f) + Kill(); + } + else + Kill(); + } + + public override void CustomDraw(SpriteBatch spriteBatch) + { + Texture2D tex = ModContent.Request(Texture).Value; + spriteBatch.Draw(tex, Position - Main.screenPosition, null, Color * Opacity, Rotation, tex.Size() / 2f, Scale, SpriteEffects.None, 0); + } + } +} diff --git a/Particles/DestroyerReticleTelegraph.png b/Particles/DestroyerReticleTelegraph.png new file mode 100644 index 0000000000..d8a1f4b142 Binary files /dev/null and b/Particles/DestroyerReticleTelegraph.png differ diff --git a/Particles/DestroyerSparkTelegraph.cs b/Particles/DestroyerSparkTelegraph.cs new file mode 100644 index 0000000000..6af1f925e2 --- /dev/null +++ b/Particles/DestroyerSparkTelegraph.cs @@ -0,0 +1,59 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Particles +{ + public class DestroyerSparkTelegraph : Particle + { + public override string Texture => "CalamityMod/Particles/Sparkle2"; + public override bool UseAdditiveBlend => true; + public override bool UseCustomDraw => true; + public override bool SetLifetime => true; + public override bool Important => true; + + private NPC NPCToFollow; + private float Spin; + private float Opacity; + private Color Bloom; + private float BloomScale; + + public DestroyerSparkTelegraph(NPC npcToFollow, Color color, Color bloom, float scale, int lifeTime, float rotationSpeed = 0f, float bloomScale = 1f) + { + NPCToFollow = npcToFollow; + Color = color; + Bloom = bloom; + Scale = scale; + Lifetime = lifeTime; + Spin = rotationSpeed; + BloomScale = bloomScale; + Rotation = Main.rand.NextFloat(MathHelper.TwoPi); + } + + public override void Update() + { + Opacity = MathF.Sin(LifetimeCompletion * MathHelper.Pi); + Rotation += Spin * ((Velocity.X > 0) ? 1f : -1f); + + if (NPCToFollow != null && NPCToFollow.active && !Main.tile[NPCToFollow.Center.ToSafeTileCoordinates()].IsTileSolid()) + Position = NPCToFollow.Center; + else + Kill(); + } + + public override void CustomDraw(SpriteBatch spriteBatch) + { + Texture2D starTexture = ModContent.Request(Texture).Value; + Texture2D bloomTexture = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; + + // Ajust the bloom's texture to be the same size as the star's. + float properBloomSize = (float)starTexture.Height / (float)bloomTexture.Height; + + spriteBatch.Draw(bloomTexture, Position - Main.screenPosition, null, Bloom * Opacity * 0.5f, 0, bloomTexture.Size() / 2f, Scale * BloomScale * properBloomSize, SpriteEffects.None, 0); + spriteBatch.Draw(starTexture, Position - Main.screenPosition, null, Color * Opacity * 0.5f, Rotation + MathHelper.PiOver4, starTexture.Size() / 2f, Scale * 0.75f, SpriteEffects.None, 0); + spriteBatch.Draw(starTexture, Position - Main.screenPosition, null, Color * Opacity, Rotation, starTexture.Size() / 2f, Scale, SpriteEffects.None, 0); + } + } +} diff --git a/Particles/DustyCircleHardEdge.png b/Particles/DustyCircleHardEdge.png new file mode 100644 index 0000000000..77d79d4071 Binary files /dev/null and b/Particles/DustyCircleHardEdge.png differ diff --git a/Particles/EnchantedParticleSet.cs b/Particles/EnchantedParticleSet.cs index 4b216e1ce3..3a480fd666 100644 --- a/Particles/EnchantedParticleSet.cs +++ b/Particles/EnchantedParticleSet.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; namespace CalamityMod.Particles diff --git a/Particles/FakeDustParticle.cs b/Particles/FakeDustParticle.cs index c4b5994393..617f1019b4 100644 --- a/Particles/FakeDustParticle.cs +++ b/Particles/FakeDustParticle.cs @@ -1,6 +1,6 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ModLoader; diff --git a/Particles/FireParticleSet.cs b/Particles/FireParticleSet.cs index 1efba278ab..5facf0179f 100644 --- a/Particles/FireParticleSet.cs +++ b/Particles/FireParticleSet.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; namespace CalamityMod.Particles diff --git a/Particles/FlameExplosion.png b/Particles/FlameExplosion.png new file mode 100644 index 0000000000..d678655a63 Binary files /dev/null and b/Particles/FlameExplosion.png differ diff --git a/Particles/FlameParticle.cs b/Particles/FlameParticle.cs index 7acd1586aa..dfa0e4ee07 100644 --- a/Particles/FlameParticle.cs +++ b/Particles/FlameParticle.cs @@ -9,12 +9,12 @@ namespace CalamityMod.Particles public override bool UseAdditiveBlend => true; public override bool SetLifetime => true; public float RelativePower; - - + + public Color BrightColor; public Color DarkColor; - + public FlameParticle(Vector2 position, int lifetime, float scale, float relativePower, Color brightColor, Color darkColor) { diff --git a/Particles/FlareShine.cs b/Particles/FlareShine.cs index 30035df3be..f42cfe03cf 100644 --- a/Particles/FlareShine.cs +++ b/Particles/FlareShine.cs @@ -1,6 +1,6 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ModLoader; using static CalamityMod.CalamityUtils; diff --git a/Particles/FlatGlow.cs b/Particles/FlatGlow.cs index 1ebab0905f..5b3b9167eb 100644 --- a/Particles/FlatGlow.cs +++ b/Particles/FlatGlow.cs @@ -1,6 +1,6 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ModLoader; diff --git a/Particles/GeneralParticleHandler.cs b/Particles/GeneralParticleHandler.cs index 6c340cebe1..ddcc4ff9da 100644 --- a/Particles/GeneralParticleHandler.cs +++ b/Particles/GeneralParticleHandler.cs @@ -1,10 +1,10 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using ReLogic.Content; -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Runtime.Serialization; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.ModLoader; using Terraria.ModLoader.Core; @@ -26,23 +26,26 @@ namespace CalamityMod.Particles private static List batchedNonPremultipliedParticles; private static List batchedAdditiveBlendParticles; - public static void LoadModParticleInstances(Mod mod) + public static void LoadModParticleInstances() { Type baseParticleType = typeof(Particle); - foreach (Type type in AssemblyManager.GetLoadableTypes(mod.Code)) + foreach (Mod mod in ModLoader.Mods) { - if (type.IsSubclassOf(baseParticleType) && !type.IsAbstract && type != baseParticleType) + foreach (Type type in AssemblyManager.GetLoadableTypes(mod.Code)) { - int ID = particleTypes.Count; //Get the ID of the particle - particleTypes[type] = ID; + if (type.IsSubclassOf(baseParticleType) && !type.IsAbstract && type != baseParticleType) + { + int ID = particleTypes.Count; //Get the ID of the particle + particleTypes[type] = ID; - Particle instance = (Particle)FormatterServices.GetUninitializedObject(type); - particleInstances.Add(instance); + Particle instance = (Particle)FormatterServices.GetUninitializedObject(type); + particleInstances.Add(instance); - string texturePath = type.Namespace.Replace('.', '/') + "/" + type.Name; - if (instance.Texture != "") - texturePath = instance.Texture; - particleTextures[ID] = ModContent.Request(texturePath, AssetRequestMode.ImmediateLoad).Value; + string texturePath = type.Namespace.Replace('.', '/') + "/" + type.Name; + if (instance.Texture != "") + texturePath = instance.Texture; + particleTextures[ID] = ModContent.Request(texturePath, AssetRequestMode.ImmediateLoad).Value; + } } } } @@ -58,8 +61,6 @@ namespace CalamityMod.Particles batchedAlphaBlendParticles = new List(); batchedNonPremultipliedParticles = new List(); batchedAdditiveBlendParticles = new List(); - - LoadModParticleInstances(CalamityMod.Instance); } internal static void Unload() @@ -116,13 +117,13 @@ namespace CalamityMod.Particles { if (particles.Count == 0) return; - + sb.End(); var rasterizer = Main.Rasterizer; rasterizer.ScissorTestEnable = true; Main.instance.GraphicsDevice.RasterizerState.ScissorTestEnable = true; Main.instance.GraphicsDevice.ScissorRectangle = new Rectangle(0, 0, Main.screenWidth, Main.screenHeight); - + //Batch the particles to avoid constant restarting of the spritebatch foreach (Particle particle in particles) { @@ -147,7 +148,7 @@ namespace CalamityMod.Particles else { Rectangle frame = particleTextures[particle.Type].Frame(1, particle.FrameVariants, 0, particle.Variant); - sb.Draw(particleTextures[particle.Type], particle.Position - Main.screenPosition, frame, particle.Color, particle.Rotation, frame.Size() * 0.5f, + sb.Draw(particleTextures[particle.Type], particle.Position - Main.screenPosition, frame, particle.Color, particle.Rotation, frame.Size() * 0.5f, particle.Scale, SpriteEffects.None, 0f); } } @@ -222,8 +223,8 @@ namespace CalamityMod.Particles ///
public static Texture2D GetTexture(int type) => particleTextures[type]; - #pragma warning disable CS0414 +#pragma warning disable CS0414 private static string noteToEveryone = "This particle system was inspired by spirit mod's own particle system, with permission granted by Yuyutsu. Love you spirit mod! -Iban"; - #pragma warning restore CS0414 +#pragma warning restore CS0414 } } diff --git a/Particles/GenericBloom.cs b/Particles/GenericBloom.cs index 52ca597791..d6966786d3 100644 --- a/Particles/GenericBloom.cs +++ b/Particles/GenericBloom.cs @@ -1,6 +1,6 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ModLoader; diff --git a/Particles/GenericSparkle.cs b/Particles/GenericSparkle.cs index 30ac5e68b5..58419dbcd3 100644 --- a/Particles/GenericSparkle.cs +++ b/Particles/GenericSparkle.cs @@ -1,6 +1,6 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ModLoader; @@ -50,7 +50,7 @@ namespace CalamityMod.Particles //Ajust the bloom's texture to be the same size as the star's float properBloomSize = (float)starTexture.Height / (float)bloomTexture.Height; - spriteBatch.Draw(bloomTexture, Position - Main.screenPosition, null, Bloom * opacity * 0.5f, 0, bloomTexture.Size()/2f, Scale * BloomScale * properBloomSize, SpriteEffects.None, 0); + spriteBatch.Draw(bloomTexture, Position - Main.screenPosition, null, Bloom * opacity * 0.5f, 0, bloomTexture.Size() / 2f, Scale * BloomScale * properBloomSize, SpriteEffects.None, 0); spriteBatch.Draw(starTexture, Position - Main.screenPosition, null, Color * opacity * 0.5f, Rotation + MathHelper.PiOver4, starTexture.Size() / 2f, Scale * 0.75f, SpriteEffects.None, 0); spriteBatch.Draw(starTexture, Position - Main.screenPosition, null, Color * opacity, Rotation, starTexture.Size() / 2f, Scale, SpriteEffects.None, 0); } diff --git a/Particles/GlowOrbParticle.cs b/Particles/GlowOrbParticle.cs new file mode 100644 index 0000000000..0da1945f2e --- /dev/null +++ b/Particles/GlowOrbParticle.cs @@ -0,0 +1,61 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Particles +{ + public class GlowOrbParticle : Particle + { + public Color InitialColor; + public bool AffectedByGravity; + public bool UseAltVisual = true; + public float fadeOut = 1; + public bool imporant; + public bool glowCenter; + public override bool SetLifetime => true; + public override bool UseCustomDraw => true; + public override bool UseAdditiveBlend => UseAltVisual; + public override bool Important => imporant; + + public override string Texture => "CalamityMod/Particles/GlowOrbParticle"; + + public GlowOrbParticle(Vector2 relativePosition, Vector2 velocity, bool affectedByGravity, int lifetime, float scale, Color color, bool AddativeBlend = true, bool needed = false, bool GlowCenter = true) + { + Position = relativePosition; + Velocity = velocity; + AffectedByGravity = affectedByGravity; + Scale = scale; + Lifetime = lifetime; + Color = InitialColor = color; + UseAltVisual = AddativeBlend; + imporant = needed; + glowCenter = GlowCenter; + } + + public override void Update() + { + fadeOut -= 0.1f; + Scale *= 0.93f; + Color = Color.Lerp(InitialColor, InitialColor * 0.2f, (float)Math.Pow(LifetimeCompletion, 3D)); + Velocity *= 0.95f; + if (Velocity.Length() < 12f && AffectedByGravity) + { + Velocity.X *= 0.94f; + Velocity.Y += 0.25f; + } + Rotation = Velocity.ToRotation() + MathHelper.PiOver2; + } + + public override void CustomDraw(SpriteBatch spriteBatch) + { + Vector2 scale = new Vector2(1f, 1f) * Scale; + Texture2D texture = ModContent.Request(Texture).Value; + + spriteBatch.Draw(texture, Position - Main.screenPosition, null, Color, Rotation, texture.Size() * 0.5f, scale, 0, 0f); + if (glowCenter) + spriteBatch.Draw(texture, Position - Main.screenPosition, null, Color.White * fadeOut, Rotation, texture.Size() * 0.5f, scale * new Vector2(0.5f, 0.5f), 0, 0f); + } + } +} diff --git a/Particles/GlowOrbParticle.png b/Particles/GlowOrbParticle.png new file mode 100644 index 0000000000..875fe73405 Binary files /dev/null and b/Particles/GlowOrbParticle.png differ diff --git a/Particles/GlowSpark.png b/Particles/GlowSpark.png new file mode 100644 index 0000000000..b014c58c89 Binary files /dev/null and b/Particles/GlowSpark.png differ diff --git a/Particles/GlowSparkParticle.cs b/Particles/GlowSparkParticle.cs new file mode 100644 index 0000000000..82dcb2b34d --- /dev/null +++ b/Particles/GlowSparkParticle.cs @@ -0,0 +1,64 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Particles +{ + public class GlowSparkParticle : Particle + { + public Color InitialColor; + public bool AffectedByGravity; + public bool QuickShrink; + public bool Glowing; + public Vector2 Squash = new Vector2(0.5f, 1.6f); + public override bool SetLifetime => true; + public override bool UseCustomDraw => true; + public override bool UseAdditiveBlend => true; + + public override string Texture => "CalamityMod/Particles/GlowSpark"; + + public GlowSparkParticle(Vector2 relativePosition, Vector2 velocity, bool affectedByGravity, int lifetime, float scale, Color color, Vector2 squash, bool quickShrink = false, bool glow = true) + { + Position = relativePosition; + Velocity = velocity; + AffectedByGravity = affectedByGravity; + Scale = scale; + Lifetime = lifetime; + Color = InitialColor = color; + Squash = squash; + QuickShrink = quickShrink; + Glowing = glow; + Rotation = Velocity.ToRotation() + MathHelper.PiOver2; + } + + public override void Update() + { + Scale *= 0.95f; + Color = Color.Lerp(InitialColor, Color.Transparent, (float)Math.Pow(LifetimeCompletion, 3D)); + Velocity *= 0.95f; + if (QuickShrink) + { + Squash.X *= 0.8f; + Squash.Y *= 1.25f; + } + if (Velocity.Length() < 12f && AffectedByGravity) + { + Velocity.X *= 0.94f; + Velocity.Y += 0.25f; + } + Rotation = Velocity.ToRotation() + MathHelper.PiOver2; + } + + public override void CustomDraw(SpriteBatch spriteBatch) + { + Vector2 scale = Squash * Scale; + Texture2D texture = ModContent.Request(Texture).Value; + + spriteBatch.Draw(texture, Position - Main.screenPosition, null, Color, Rotation, texture.Size() * 0.5f, scale, 0, 0f); + if (Glowing) + spriteBatch.Draw(texture, Position - Main.screenPosition, null, Color.White, Rotation, texture.Size() * 0.5f, scale * new Vector2(0.45f, 1f), 0, 0f); + } + } +} diff --git a/Particles/HealingPlus.cs b/Particles/HealingPlus.cs index 6e152bb148..b13f069536 100644 --- a/Particles/HealingPlus.cs +++ b/Particles/HealingPlus.cs @@ -1,8 +1,8 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ModLoader; -using System; using static Terraria.ModLoader.PlayerDrawLayer; namespace CalamityMod.Particles @@ -43,7 +43,7 @@ namespace CalamityMod.Particles { Texture2D tex = ModContent.Request(Texture).Value; - Vector2 Size = new Vector2 (Scale); + Vector2 Size = new Vector2(Scale); Vector2 origin = new Vector2(tex.Width, tex.Height); diff --git a/Particles/HeavySmoke.cs b/Particles/HeavySmoke.cs index 72103cd5f2..f82417fa07 100644 --- a/Particles/HeavySmoke.cs +++ b/Particles/HeavySmoke.cs @@ -1,6 +1,6 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ModLoader; diff --git a/Particles/HighResFoggyCircleHardEdge.png b/Particles/HighResFoggyCircleHardEdge.png new file mode 100644 index 0000000000..52cd77a39a Binary files /dev/null and b/Particles/HighResFoggyCircleHardEdge.png differ diff --git a/Particles/Jaws.cs b/Particles/Jaws.cs index 18af29b3d5..487d92a917 100644 --- a/Particles/Jaws.cs +++ b/Particles/Jaws.cs @@ -1,9 +1,9 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using static CalamityMod.CalamityUtils; using Terraria; using Terraria.ModLoader; +using static CalamityMod.CalamityUtils; namespace CalamityMod.Particles { diff --git a/Particles/LargeBloom.png b/Particles/LargeBloom.png new file mode 100644 index 0000000000..643741e8c9 Binary files /dev/null and b/Particles/LargeBloom.png differ diff --git a/Particles/LargeSpark.png b/Particles/LargeSpark.png new file mode 100644 index 0000000000..781d2bc251 Binary files /dev/null and b/Particles/LargeSpark.png differ diff --git a/Particles/LiliesOfFinalityHeartParticle.cs b/Particles/LiliesOfFinalityHeartParticle.cs new file mode 100644 index 0000000000..eedd9b7e8a --- /dev/null +++ b/Particles/LiliesOfFinalityHeartParticle.cs @@ -0,0 +1,39 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Particles +{ + public class LiliesOfFinalityHeartParticle : Particle + { + public override string Texture => "CalamityMod/Particles/LiliesOfFinalityHeartParticle"; + public override bool UseCustomDraw => true; + public override bool SetLifetime => true; + + public LiliesOfFinalityHeartParticle(Vector2 position, Vector2 velocity, int lifeTime, float scale = 1f) + { + Position = position; + Velocity = velocity; + Lifetime = lifeTime; + Scale = scale; + Rotation = velocity.ToRotation() + MathHelper.PiOver2; + Color = Color.White; + } + + public override void Update() + { + Velocity *= 0.96f; + Scale *= 0.97f; + } + + public override void CustomDraw(SpriteBatch spriteBatch) + { + Texture2D emoteTexture = ModContent.Request(Texture).Value; + Vector2 origin = emoteTexture.Size() * 0.5f; + float opacity = 1f - MathF.Pow(LifetimeCompletion, 4f); + spriteBatch.Draw(emoteTexture, Position - Main.screenPosition, null, Color * opacity * 0.7f, Rotation, origin, Scale, SpriteEffects.None, 0); + } + } +} diff --git a/Particles/LiliesOfFinalityHeartParticle.png b/Particles/LiliesOfFinalityHeartParticle.png new file mode 100644 index 0000000000..be555e9901 Binary files /dev/null and b/Particles/LiliesOfFinalityHeartParticle.png differ diff --git a/Particles/LineParticle.cs b/Particles/LineParticle.cs index 77eb2a91b3..195e143f55 100644 --- a/Particles/LineParticle.cs +++ b/Particles/LineParticle.cs @@ -1,6 +1,6 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ModLoader; diff --git a/Particles/LineVFX.cs b/Particles/LineVFX.cs index 24e46d83a2..3f138d9a12 100644 --- a/Particles/LineVFX.cs +++ b/Particles/LineVFX.cs @@ -1,6 +1,6 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ModLoader; @@ -46,7 +46,7 @@ namespace CalamityMod.Particles Vector2 expandedLine = LineVector + Utils.SafeNormalize(LineVector, Vector2.Zero) * (float)Math.Sqrt(1f - (float)Math.Pow(LifetimeCompletion - 1f, 2)) * Expansion; float rot = LineVector.ToRotation() + MathHelper.PiOver2; - Vector2 origin = new Vector2(tex.Width/2f, tex.Height); + Vector2 origin = new Vector2(tex.Width / 2f, tex.Height); Vector2 scale = new Vector2(Scale, expandedLine.Length() / tex.Height); spriteBatch.Draw(tex, drawPosition - Main.screenPosition, null, Color, rot, origin, scale, SpriteEffects.None, 0); diff --git a/Particles/ManaDrainBlobs.cs b/Particles/ManaDrainBlobs.cs index 92384644fc..21b23b13b8 100644 --- a/Particles/ManaDrainBlobs.cs +++ b/Particles/ManaDrainBlobs.cs @@ -1,7 +1,7 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; -using System; namespace CalamityMod.Particles { diff --git a/Particles/ManaDrainStreak.cs b/Particles/ManaDrainStreak.cs index 5af6d73faf..fe9d34aa9c 100644 --- a/Particles/ManaDrainStreak.cs +++ b/Particles/ManaDrainStreak.cs @@ -1,8 +1,8 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ModLoader; -using System; namespace CalamityMod.Particles { @@ -44,7 +44,7 @@ namespace CalamityMod.Particles Vector2 setPosition = OverridePosition != default ? OverridePosition : Owner.MountedCenter; Position = setPosition + Rotation.ToRotationVector2() * MathHelper.Lerp(StartDistanceFromPlayer, FinalDistanceFromPlayer, (float)Math.Pow(LifetimeCompletion, 2)); - Color = Color.Lerp(StartColor, FadeOut ? EndColor with {A = 0} : EndColor, LifetimeCompletion); + Color = Color.Lerp(StartColor, FadeOut ? EndColor with { A = 0 } : EndColor, LifetimeCompletion); Lighting.AddLight(Position, Color.ToVector3() * 0.2f); } diff --git a/Particles/MediumMistParticleAlphaBlend.cs b/Particles/MediumMistParticleAlphaBlend.cs new file mode 100644 index 0000000000..4ce8b0a507 --- /dev/null +++ b/Particles/MediumMistParticleAlphaBlend.cs @@ -0,0 +1,52 @@ +using Microsoft.Xna.Framework; +using Terraria; + +namespace CalamityMod.Particles +{ + public class MediumMistParticleAlphaBlend : Particle + { + public override string Texture => "CalamityMod/Particles/MediumSmoke"; + public override int FrameVariants => 3; + + private float Opacity; + private Color ColorFire; + private Color ColorFade; + private float Spin; + + public MediumMistParticleAlphaBlend(Vector2 position, Vector2 velocity, Color colorFire, Color colorFade, float scale, float opacity, float rotationSpeed = 0f) + { + Position = position; + Velocity = velocity; + ColorFire = colorFire; + ColorFade = colorFade; + Scale = scale; + Opacity = opacity; + Rotation = Main.rand.NextFloat(MathHelper.TwoPi); + Spin = rotationSpeed; + Variant = Main.rand.Next(3); + } + + public override void Update() + { + Rotation += Spin * ((Velocity.X > 0) ? 1f : -1f); + Velocity *= 0.85f; + + if (Opacity > 90) + { + Lighting.AddLight(Position, Color.ToVector3() * 0.1f); + Scale += 0.01f; + Opacity -= 3; + } + else + { + Scale *= 0.975f; + Opacity -= 2; + } + + if (Opacity < 0) + Kill(); + + Color = Color.Lerp(ColorFire, ColorFade, MathHelper.Clamp((float)((255 - Opacity) - 100) / 80, 0f, 1f)) * (Opacity / 255f); + } + } +} diff --git a/Particles/NanoParticle.cs b/Particles/NanoParticle.cs new file mode 100644 index 0000000000..f58fe0f7c2 --- /dev/null +++ b/Particles/NanoParticle.cs @@ -0,0 +1,62 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Particles +{ + public class NanoParticle : Particle + { + public override string Texture => "CalamityMod/Particles/NanoParticleSmall"; + public bool UseAltVisual = true; + public override bool UseAdditiveBlend => UseAltVisual; + public override bool UseCustomDraw => true; + public override bool SetLifetime => true; + + private float opacity; + private bool Big; + private bool EmitsLight; + private Vector2 Gravity; + private int Time = 0; + + public NanoParticle(Vector2 position, Vector2 velocity, Color color, float scale, int lifeTime, bool bigSize = false, bool emitsLight = false, bool AddativeBlend = true, Vector2? gravity = null) + { + Position = position; + Velocity = velocity; + Color = color; + Scale = scale; + Lifetime = lifeTime; + Rotation = 0; + Big = bigSize; + EmitsLight = emitsLight; + UseAltVisual = AddativeBlend; + Gravity = (Vector2)(gravity == null ? Vector2.Zero : gravity); + Variant = Main.rand.Next(3); + } + + public override void Update() + { + Time++; + Velocity += Gravity; + opacity = (float)Math.Sin(LifetimeCompletion * MathHelper.Pi); + + if (EmitsLight) + Lighting.AddLight(Position, opacity * Color.R / 255f, opacity * Color.G / 255f, opacity * Color.B / 255f); + + Velocity *= 0.95f; + Scale *= 0.98f; + if (Time % 3 == 0) + { + Position += Main.rand.NextVector2Circular(13, 13); + } + } + + public override void CustomDraw(SpriteBatch spriteBatch) + { + Texture2D nanoTexture = Big ? ModContent.Request("CalamityMod/Particles/NanoParticleBig").Value : ModContent.Request(Texture).Value; + Rectangle frame = new Rectangle(0, (Big ? 8 : 6), (Big ? 8 : 6), (Big ? 8 : 6)); + spriteBatch.Draw(nanoTexture, Position - Main.screenPosition, frame, Color * opacity, 0, frame.Size() / 2f, Scale, SpriteEffects.None, 0); + } + } +} diff --git a/Particles/NanoParticleBig.png b/Particles/NanoParticleBig.png new file mode 100644 index 0000000000..5a12d418d1 Binary files /dev/null and b/Particles/NanoParticleBig.png differ diff --git a/Particles/NanoParticleSmall.png b/Particles/NanoParticleSmall.png new file mode 100644 index 0000000000..45530fb783 Binary files /dev/null and b/Particles/NanoParticleSmall.png differ diff --git a/Particles/Particle.cs b/Particles/Particle.cs index 6c810b140a..1867364dcd 100644 --- a/Particles/Particle.cs +++ b/Particles/Particle.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; namespace CalamityMod.Particles diff --git a/Particles/PearlParticle.cs b/Particles/PearlParticle.cs new file mode 100644 index 0000000000..5edfb76c23 --- /dev/null +++ b/Particles/PearlParticle.cs @@ -0,0 +1,83 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Particles +{ + public class PearlParticle : Particle + { + public Color InitialColor; + public bool AffectedByGravity; + public float ShrinkSpeed; + public float RotationSpeed; + public bool HitTiles; + public bool hasTileHit; + public float pVelX; + public float pVelY; + public override bool SetLifetime => true; + public override bool UseCustomDraw => true; + public override bool UseAdditiveBlend => false; + + public override string Texture => "CalamityMod/Particles/PearlParticle"; + + public PearlParticle(Vector2 relativePosition, Vector2 velocity, bool affectedByGravity, int lifetime, float scale, Color color, float shrinkSpeed = 0.95f, float rotationSpeed = 0, bool hitTiles = false) + { + Position = relativePosition; + Velocity = velocity; + AffectedByGravity = affectedByGravity; + Scale = scale; + Lifetime = lifetime; + Color = InitialColor = color; + ShrinkSpeed = shrinkSpeed; + RotationSpeed = rotationSpeed; + HitTiles = hitTiles; + } + + public override void Update() + { + if (HitTiles) + { + if (hasTileHit) + { + if (Velocity.X != pVelX) + { + Velocity.X = -pVelX; + } + if (Velocity.Y != pVelY) + { + Velocity.Y = -pVelY; + } + HitTiles = false; + } + if (Collision.SolidCollision(Position, (int)(7f * Scale), (int)(7f * Scale))) + { + hasTileHit = true; + pVelX = Velocity.X; + pVelY = Velocity.Y; + } + } + Scale *= ShrinkSpeed; + RotationSpeed *= ShrinkSpeed; + Color = Color.Lerp(InitialColor, Color.Transparent, (float)Math.Pow(LifetimeCompletion, 3D)); + Velocity *= 0.95f; + if (Velocity.Length() < 12f && AffectedByGravity) + { + Velocity.X *= 0.94f; + Velocity.Y += 0.25f; + } + Rotation += RotationSpeed; + } + + public override void CustomDraw(SpriteBatch spriteBatch) + { + Vector2 scale = new Vector2(1f, 1f) * Scale; + Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture2 = ModContent.Request("CalamityMod/Particles/PearlParticleGlow").Value; + + spriteBatch.Draw(texture2, Position - Main.screenPosition, null, Color, Rotation, texture.Size() * 0.5f, scale, 0, 0f); + spriteBatch.Draw(texture, Position - Main.screenPosition, null, Color.Lerp(Color.White, Color.Transparent, (float)Math.Pow(LifetimeCompletion, 3D)), Rotation, texture.Size() * 0.5f, scale, 0, 0f); + } + } +} diff --git a/Particles/PearlParticle.png b/Particles/PearlParticle.png new file mode 100644 index 0000000000..4ae737c25d Binary files /dev/null and b/Particles/PearlParticle.png differ diff --git a/Particles/PearlParticleGlow.png b/Particles/PearlParticleGlow.png new file mode 100644 index 0000000000..0b18753df9 Binary files /dev/null and b/Particles/PearlParticleGlow.png differ diff --git a/Particles/PlagueHumidifierMist.cs b/Particles/PlagueHumidifierMist.cs new file mode 100644 index 0000000000..73c5b92342 --- /dev/null +++ b/Particles/PlagueHumidifierMist.cs @@ -0,0 +1,29 @@ +using System; +using Microsoft.Xna.Framework; +using Terraria; + +namespace CalamityMod.Particles +{ + public class PlagueHumidifierMist : Particle + { + public override bool SetLifetime => true; + public override int FrameVariants => 7; + + public override string Texture => "CalamityMod/Particles/PlagueHumidifierMist"; + + public PlagueHumidifierMist(Vector2 relativePosition, int lifetime, float scale, Vector2 speed) + { + Velocity = speed; + Scale = scale; + Variant = Main.rand.Next(7); + Lifetime = lifetime; + Position = relativePosition; + } + + public override void Update() + { + Color = Color.Lerp(Lighting.GetColor((Position / 16).ToPoint()), Color.Transparent, LifetimeCompletion); + } + + } +} diff --git a/Particles/PlagueHumidifierMist.png b/Particles/PlagueHumidifierMist.png new file mode 100644 index 0000000000..c1e3c611e9 Binary files /dev/null and b/Particles/PlagueHumidifierMist.png differ diff --git a/Particles/PlasmaExplosion.cs b/Particles/PlasmaExplosion.cs new file mode 100644 index 0000000000..3da9261e3c --- /dev/null +++ b/Particles/PlasmaExplosion.cs @@ -0,0 +1,55 @@ +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 PlasmaExplosion : Particle + { + public override string Texture => "CalamityMod/Particles/PlasmaExplosion"; + public override bool UseAdditiveBlend => true; + public override bool SetLifetime => true; + public override bool UseCustomDraw => true; + + private float OriginalScale; + private float FinalScale; + private float opacity; + private Vector2 Squish; + private Color BaseColor; + + public PlasmaExplosion(Vector2 position, Vector2 velocity, Color color, Vector2 squish, float rotation, float originalScale, float finalScale, int lifeTime) + { + Position = position; + Velocity = velocity; + BaseColor = color; + OriginalScale = originalScale; + FinalScale = finalScale; + Scale = originalScale; + Lifetime = lifeTime; + Squish = squish; + Rotation = rotation; + } + + public override void Update() + { + float pulseProgress = PiecewiseAnimation(LifetimeCompletion, new CurveSegment[] { new CurveSegment(EasingType.PolyOut, 0f, 0f, 1f, 4) }); + Scale = MathHelper.Lerp(OriginalScale, FinalScale, pulseProgress); + + opacity = (float)Math.Sin(MathHelper.PiOver2 + LifetimeCompletion * MathHelper.PiOver2); + + Color = BaseColor * opacity; + Lighting.AddLight(Position, Color.R / 255f, Color.G / 255f, Color.B / 255f); + Velocity *= 0.95f; + } + + public override void CustomDraw(SpriteBatch spriteBatch) + { + Texture2D tex = ModContent.Request(Texture).Value; + spriteBatch.Draw(tex, Position - Main.screenPosition, null, Color * opacity, Rotation, tex.Size() / 2f, Scale * Squish, SpriteEffects.None, 0); + } + + } +} diff --git a/Particles/PlasmaExplosion.png b/Particles/PlasmaExplosion.png new file mode 100644 index 0000000000..508c8eb5cb Binary files /dev/null and b/Particles/PlasmaExplosion.png differ diff --git a/Particles/PointParticle.cs b/Particles/PointParticle.cs new file mode 100644 index 0000000000..083c4ef296 --- /dev/null +++ b/Particles/PointParticle.cs @@ -0,0 +1,53 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Particles +{ + public class PointParticle : Particle + { + public Color InitialColor; + public bool AffectedByGravity; + public bool UseAltVisual = true; + public override bool SetLifetime => true; + public override bool UseCustomDraw => true; + public override bool UseAdditiveBlend => UseAltVisual; + + public override string Texture => "CalamityMod/Particles/PointParticle"; + + public PointParticle(Vector2 relativePosition, Vector2 velocity, bool affectedByGravity, int lifetime, float scale, Color color, bool AddativeBlend = true) + { + Position = relativePosition; + Velocity = velocity; + AffectedByGravity = affectedByGravity; + Scale = scale; + Lifetime = lifetime; + Color = InitialColor = color; + UseAltVisual = AddativeBlend; + } + + public override void Update() + { + Scale *= 0.95f; + Color = Color.Lerp(InitialColor, Color.Transparent, (float)Math.Pow(LifetimeCompletion, 3D)); + Velocity *= 0.95f; + if (Velocity.Length() < 12f && AffectedByGravity) + { + Velocity.X *= 0.94f; + Velocity.Y += 0.25f; + } + Rotation = Velocity.ToRotation() + MathHelper.PiOver2; + } + + public override void CustomDraw(SpriteBatch spriteBatch) + { + Vector2 scale = new Vector2(0.5f, 1.6f) * Scale; + Texture2D texture = ModContent.Request(Texture).Value; + + spriteBatch.Draw(texture, Position - Main.screenPosition, null, Color, Rotation, texture.Size() * 0.5f, scale, 0, 0f); + spriteBatch.Draw(texture, Position - Main.screenPosition, null, Color, Rotation, texture.Size() * 0.5f, scale * new Vector2(0.45f, 1f), 0, 0f); + } + } +} diff --git a/Particles/PointParticle.png b/Particles/PointParticle.png new file mode 100644 index 0000000000..6769438ea2 Binary files /dev/null and b/Particles/PointParticle.png differ diff --git a/Particles/PulseRing.cs b/Particles/PulseRing.cs index ceaa2509c1..9f22a6a35f 100644 --- a/Particles/PulseRing.cs +++ b/Particles/PulseRing.cs @@ -1,9 +1,9 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using static CalamityMod.CalamityUtils; using Terraria; using Terraria.ModLoader; +using static CalamityMod.CalamityUtils; namespace CalamityMod.Particles { @@ -32,7 +32,7 @@ namespace CalamityMod.Particles public override void Update() { - float pulseProgress = PiecewiseAnimation(LifetimeCompletion, new CurveSegment[] { new CurveSegment(EasingType.PolyOut, 0f, 0f, 1f, 4)}); + float pulseProgress = PiecewiseAnimation(LifetimeCompletion, new CurveSegment[] { new CurveSegment(EasingType.PolyOut, 0f, 0f, 1f, 4) }); Scale = MathHelper.Lerp(OriginalScale, FinalScale, pulseProgress); opacity = (float)Math.Sin(MathHelper.PiOver2 + LifetimeCompletion * MathHelper.PiOver2); diff --git a/Particles/SandyDustParticle.cs b/Particles/SandyDustParticle.cs index 06b561e5cc..8e66785c0d 100644 --- a/Particles/SandyDustParticle.cs +++ b/Particles/SandyDustParticle.cs @@ -1,6 +1,6 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ModLoader; diff --git a/Particles/SeaFoamParticle.cs b/Particles/SeaFoamParticle.cs index 2c6352052f..3ca662329f 100644 --- a/Particles/SeaFoamParticle.cs +++ b/Particles/SeaFoamParticle.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Particles Scale = BaseScale + Opacity / 255f; if (Opacity <= 0) Kill(); - Color = Color.Lerp(ColorStart, ColorFade, MathHelper.Clamp((float)((255 -Opacity) - 100) / 80, 0f, 1f)) * (Opacity / 255f); + Color = Color.Lerp(ColorStart, ColorFade, MathHelper.Clamp((float)((255 - Opacity) - 100) / 80, 0f, 1f)) * (Opacity / 255f); } } } diff --git a/Particles/SemiCircularSmearVertical.png b/Particles/SemiCircularSmearVertical.png new file mode 100644 index 0000000000..40306fac87 Binary files /dev/null and b/Particles/SemiCircularSmearVertical.png differ diff --git a/Particles/SlashThrough.cs b/Particles/SlashThrough.cs index 607770dd11..eccc93c3a1 100644 --- a/Particles/SlashThrough.cs +++ b/Particles/SlashThrough.cs @@ -1,6 +1,6 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ModLoader; diff --git a/Particles/SmallBloomRing.png b/Particles/SmallBloomRing.png new file mode 100644 index 0000000000..f51029ba21 Binary files /dev/null and b/Particles/SmallBloomRing.png differ diff --git a/Particles/SmallSmokeParticle.cs b/Particles/SmallSmokeParticle.cs index 6b8bd79945..a198853c93 100644 --- a/Particles/SmallSmokeParticle.cs +++ b/Particles/SmallSmokeParticle.cs @@ -45,7 +45,7 @@ namespace CalamityMod.Particles if (Opacity < 0) Kill(); - Color = Color.Lerp(ColorFire, ColorFade, MathHelper.Clamp((float)((255 -Opacity) - 100) / 80, 0f, 1f)) * (Opacity / 255f); + Color = Color.Lerp(ColorFire, ColorFade, MathHelper.Clamp((float)((255 - Opacity) - 100) / 80, 0f, 1f)) * (Opacity / 255f); } } diff --git a/Particles/SnowflakeSparkle.cs b/Particles/SnowflakeSparkle.cs index 3a5b130d6c..525602814e 100644 --- a/Particles/SnowflakeSparkle.cs +++ b/Particles/SnowflakeSparkle.cs @@ -1,6 +1,6 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ModLoader; diff --git a/Particles/SparkParticle.cs b/Particles/SparkParticle.cs index 6ce225db8e..a597cdd9b9 100644 --- a/Particles/SparkParticle.cs +++ b/Particles/SparkParticle.cs @@ -1,6 +1,6 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ModLoader; diff --git a/Particles/SparkleParticle.cs b/Particles/SparkleParticle.cs index 1ba9dc8c6a..700357e069 100644 --- a/Particles/SparkleParticle.cs +++ b/Particles/SparkleParticle.cs @@ -1,6 +1,6 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ModLoader; @@ -52,7 +52,7 @@ namespace CalamityMod.Particles //Ajust the bloom's texture to be the same size as the star's float properBloomSize = (float)starTexture.Height / (float)bloomTexture.Height; - spriteBatch.Draw(bloomTexture, Position - Main.screenPosition, null, Bloom * opacity * 0.5f, 0, bloomTexture.Size()/2f, Scale * BloomScale * properBloomSize, SpriteEffects.None, 0); + spriteBatch.Draw(bloomTexture, Position - Main.screenPosition, null, Bloom * opacity * 0.5f, 0, bloomTexture.Size() / 2f, Scale * BloomScale * properBloomSize, SpriteEffects.None, 0); spriteBatch.Draw(starTexture, Position - Main.screenPosition, null, Color * opacity * 0.5f, Rotation + MathHelper.PiOver4, starTexture.Size() / 2f, Scale * 0.75f, SpriteEffects.None, 0); spriteBatch.Draw(starTexture, Position - Main.screenPosition, null, Color * opacity, Rotation, starTexture.Size() / 2f, Scale, SpriteEffects.None, 0); } diff --git a/Particles/SquareParticle.cs b/Particles/SquareParticle.cs index 30cc36114d..811230e9fb 100644 --- a/Particles/SquareParticle.cs +++ b/Particles/SquareParticle.cs @@ -1,9 +1,9 @@ -using Microsoft.Xna.Framework; +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ModLoader; -using System.Collections.Generic; namespace CalamityMod.Particles { diff --git a/Particles/SquishyLightParticle.cs b/Particles/SquishyLightParticle.cs index 066346f511..ab80277fa6 100644 --- a/Particles/SquishyLightParticle.cs +++ b/Particles/SquishyLightParticle.cs @@ -1,6 +1,6 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ModLoader; diff --git a/Particles/StatDownArrow.cs b/Particles/StatDownArrow.cs new file mode 100644 index 0000000000..29624d1cd8 --- /dev/null +++ b/Particles/StatDownArrow.cs @@ -0,0 +1,47 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Particles +{ + public class StatDownArrow : Particle + { + public override string Texture => "CalamityMod/Particles/StatDownArrow"; + public override bool UseAdditiveBlend => true; + public override bool UseCustomDraw => true; + public override bool SetLifetime => true; + + public Color StartColor; + public Color EndColor; + + public StatDownArrow(Vector2 position, Vector2 velocity, Color startColor, Color endColor, float scale, int lifetime) + { + Position = position; + Velocity = velocity; + Color = startColor; + StartColor = startColor; + EndColor = endColor; + Scale = scale; + Lifetime = lifetime; + Rotation = 0; + } + + public override void Update() + { + Color = Color.Lerp(StartColor, EndColor, LifetimeCompletion); + Lighting.AddLight(Position, Color.ToVector3() * 0.2f); + } + + public override void CustomDraw(SpriteBatch spriteBatch) + { + Texture2D texture = ModContent.Request(Texture).Value; + Vector2 DrawSize = new Vector2(Scale); + Vector2 Origin = new Vector2(texture.Width, texture.Height); + + Vector2 PositionAdjust = new Vector2(-5, -11); + + spriteBatch.Draw(texture, Position - Main.screenPosition - PositionAdjust, null, Color, Rotation, Origin, DrawSize, SpriteEffects.None, 0); + } + } +} diff --git a/Particles/StatDownArrow.png b/Particles/StatDownArrow.png new file mode 100644 index 0000000000..1119f1534b Binary files /dev/null and b/Particles/StatDownArrow.png differ diff --git a/Particles/StaticPulseRing.cs b/Particles/StaticPulseRing.cs index 27649de303..9121efcec4 100644 --- a/Particles/StaticPulseRing.cs +++ b/Particles/StaticPulseRing.cs @@ -1,9 +1,9 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using static CalamityMod.CalamityUtils; using Terraria; using Terraria.ModLoader; +using static CalamityMod.CalamityUtils; namespace CalamityMod.Particles { diff --git a/Particles/StoneDebrisParticle.cs b/Particles/StoneDebrisParticle.cs index fb58e0feea..386fd0fc16 100644 --- a/Particles/StoneDebrisParticle.cs +++ b/Particles/StoneDebrisParticle.cs @@ -1,5 +1,5 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; namespace CalamityMod.Particles diff --git a/Particles/StrongBloom.cs b/Particles/StrongBloom.cs index 3595d0e5cb..d133913751 100644 --- a/Particles/StrongBloom.cs +++ b/Particles/StrongBloom.cs @@ -1,6 +1,6 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ModLoader; diff --git a/Particles/TechyHolosquareParticle.cs b/Particles/TechyHolosquareParticle.cs index 6a2562b249..c1c010b38d 100644 --- a/Particles/TechyHolosquareParticle.cs +++ b/Particles/TechyHolosquareParticle.cs @@ -1,8 +1,8 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ModLoader; -using System; -using Microsoft.Xna.Framework.Graphics; namespace CalamityMod.Particles { diff --git a/Particles/ThanatosSmokeParticle.cs b/Particles/ThanatosSmokeParticle.cs index 6caf2f7f57..0ebb765c55 100644 --- a/Particles/ThanatosSmokeParticle.cs +++ b/Particles/ThanatosSmokeParticle.cs @@ -1,5 +1,5 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; namespace CalamityMod.Particles diff --git a/Particles/ThanatosSmokeParticleSet.cs b/Particles/ThanatosSmokeParticleSet.cs index 90c7a59061..7f466545aa 100644 --- a/Particles/ThanatosSmokeParticleSet.cs +++ b/Particles/ThanatosSmokeParticleSet.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; namespace CalamityMod.Particles { diff --git a/Particles/ThunderBoltVFX.cs b/Particles/ThunderBoltVFX.cs index 2aee62fe35..83b6461954 100644 --- a/Particles/ThunderBoltVFX.cs +++ b/Particles/ThunderBoltVFX.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Particles public float ShakePower; public float Opacity; public Projectile AttachedProjectile; - public float DisplacementFromProjectile; + public float DisplacementFromProjectile; public ThunderBoltVFX(Vector2 position, Color color, float rotation, float scale, Vector2 squish, float opacity = 1f, float shakePower = 20f, Projectile projectileToFollow = null, float displacementFromProjectile = 0f) { diff --git a/Particles/TimedSmokeParticle.cs b/Particles/TimedSmokeParticle.cs index 445bbcbdf6..723f1cc0f8 100644 --- a/Particles/TimedSmokeParticle.cs +++ b/Particles/TimedSmokeParticle.cs @@ -1,6 +1,6 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Terraria; -using System; namespace CalamityMod.Particles { diff --git a/Particles/TitaniumRailgunShell.cs b/Particles/TitaniumRailgunShell.cs index 28352abf9a..6838e42651 100644 --- a/Particles/TitaniumRailgunShell.cs +++ b/Particles/TitaniumRailgunShell.cs @@ -1,6 +1,6 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ModLoader; diff --git a/Particles/UrchinSpikeParticle.cs b/Particles/UrchinSpikeParticle.cs index ce66863143..5c4848fdb4 100644 --- a/Particles/UrchinSpikeParticle.cs +++ b/Particles/UrchinSpikeParticle.cs @@ -1,6 +1,6 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ModLoader; diff --git a/Particles/VoidSparkParticle.cs b/Particles/VoidSparkParticle.cs new file mode 100644 index 0000000000..7aa4280992 --- /dev/null +++ b/Particles/VoidSparkParticle.cs @@ -0,0 +1,56 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Particles +{ + public class VoidSparkParticle : Particle + { + public Color InitialColor; + public bool AffectedByGravity; + public float Ylength = 1f; + public float Xlength = 0.6f; + public override bool SetLifetime => true; + public override bool UseCustomDraw => true; + public override bool UseAdditiveBlend => false; + + public override string Texture => "CalamityMod/Particles/LargeSpark"; + + public VoidSparkParticle(Vector2 relativePosition, Vector2 velocity, bool affectedByGravity, int lifetime, float scale, Color color) + { + Position = relativePosition; + Velocity = velocity; + AffectedByGravity = affectedByGravity; + Scale = scale; + Lifetime = lifetime; + Color = InitialColor = color; + } + + public override void Update() + { + Scale *= 0.9f; + Color = Color.Lerp(InitialColor, Color.Transparent, (float)Math.Pow(LifetimeCompletion, 3D)); + Velocity *= 0.95f; + Ylength *= 1.25f; + Xlength *= 0.7f; + + if (Velocity.Length() < 12f && AffectedByGravity) + { + Velocity.X *= 0.94f; + Velocity.Y += 0.25f; + } + Rotation = Velocity.ToRotation() + MathHelper.PiOver2; + } + + public override void CustomDraw(SpriteBatch spriteBatch) + { + Vector2 scale = new Vector2(Xlength, Ylength) * Scale; + Texture2D texture = ModContent.Request(Texture).Value; + + spriteBatch.Draw(texture, Position - Main.screenPosition, null, Color, Rotation, texture.Size() * 0.5f, scale, 0, 0f); + spriteBatch.Draw(texture, Position - Main.screenPosition, null, Color.Black, Rotation, texture.Size() * 0.5f, scale * new Vector2(0.85f, 1f), 0, 0f); + } + } +} diff --git a/Particles/WaterFlavored.png b/Particles/WaterFlavored.png new file mode 100644 index 0000000000..6059e0e6e3 Binary files /dev/null and b/Particles/WaterFlavored.png differ diff --git a/Particles/WaterFlavoredParticle.cs b/Particles/WaterFlavoredParticle.cs new file mode 100644 index 0000000000..58dcf1b993 --- /dev/null +++ b/Particles/WaterFlavoredParticle.cs @@ -0,0 +1,51 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Particles +{ + public class WaterFlavoredParticle : Particle + { + public Color InitialColor; + public bool AffectedByGravity; + public override bool SetLifetime => true; + public override bool UseCustomDraw => true; + public override bool UseAdditiveBlend => false; + + public override string Texture => "CalamityMod/Particles/WaterFlavored"; + + public WaterFlavoredParticle(Vector2 relativePosition, Vector2 velocity, bool affectedByGravity, int lifetime, float scale, Color color) + { + Position = relativePosition; + Velocity = velocity; + AffectedByGravity = affectedByGravity; + Scale = scale; + Lifetime = lifetime; + Color = InitialColor = color; + } + + public override void Update() + { + Scale *= 0.93f; + Color = Color.Lerp(InitialColor, Color.Transparent, (float)Math.Pow(LifetimeCompletion, 3D)); + Velocity *= 0.95f; + if (Velocity.Length() < 12f && AffectedByGravity) + { + Velocity.X *= 0.94f; + Velocity.Y += 0.25f; + } + Rotation = Velocity.ToRotation() + MathHelper.PiOver2; + } + + public override void CustomDraw(SpriteBatch spriteBatch) + { + Vector2 scale = new Vector2(0.65f, 1f) * Scale; + Texture2D texture = ModContent.Request(Texture).Value; + + spriteBatch.Draw(texture, Position - Main.screenPosition, null, Color, Rotation, texture.Size() * 0.5f, scale, 0, 0f); + spriteBatch.Draw(texture, Position - Main.screenPosition, null, Color, Rotation, texture.Size() * 0.5f, scale * new Vector2(0.45f, 1f), 0, 0f); + } + } +} diff --git a/Particles/WulfrumBastionPartsParticle.cs b/Particles/WulfrumBastionPartsParticle.cs index a96dc95a37..ce2526b388 100644 --- a/Particles/WulfrumBastionPartsParticle.cs +++ b/Particles/WulfrumBastionPartsParticle.cs @@ -1,8 +1,8 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ModLoader; -using System; -using Microsoft.Xna.Framework.Graphics; namespace CalamityMod.Particles { @@ -112,9 +112,9 @@ namespace CalamityMod.Particles spriteEffect = SpriteEffects.FlipHorizontally; origin.X = Frame.Width - Origin.X; } - - float opacity = Math.Clamp(LifetimeCompletionAdjusted * 4f ,0f, 1f); + + float opacity = Math.Clamp(LifetimeCompletionAdjusted * 4f, 0f, 1f); spriteBatch.Draw(baseTex, center + realDestinationOffset + realCurrentOffset - Main.screenPosition, Frame, lightColor * opacity, Rotation, origin, Scale, spriteEffect, 0); } diff --git a/Particles/WulfrumDroidEmote.cs b/Particles/WulfrumDroidEmote.cs index e4548ed528..2c92dc0f9a 100644 --- a/Particles/WulfrumDroidEmote.cs +++ b/Particles/WulfrumDroidEmote.cs @@ -1,6 +1,6 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ModLoader; diff --git a/Particles/WulfrumDroidSweatEmote.cs b/Particles/WulfrumDroidSweatEmote.cs index 1b6ecbc941..37076104ae 100644 --- a/Particles/WulfrumDroidSweatEmote.cs +++ b/Particles/WulfrumDroidSweatEmote.cs @@ -1,6 +1,6 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ModLoader; diff --git a/Particles/WulfrumHatParticle.cs b/Particles/WulfrumHatParticle.cs index e41b619957..1bb5ece6a6 100644 --- a/Particles/WulfrumHatParticle.cs +++ b/Particles/WulfrumHatParticle.cs @@ -1,7 +1,7 @@ -using Microsoft.Xna.Framework; -using Terraria; -using System; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using Terraria; namespace CalamityMod.Particles { @@ -42,9 +42,9 @@ namespace CalamityMod.Particles { spriteEffect = SpriteEffects.FlipHorizontally; } - - float opacity = Math.Clamp(1 - (float)Math.Pow(LifetimeCompletion , 3f), 0f, 1f); - spriteBatch.Draw(baseTex, Position - Main.screenPosition, null, lightColor * opacity, Rotation, baseTex.Size()/2f, Scale, spriteEffect, 0); + + float opacity = Math.Clamp(1 - (float)Math.Pow(LifetimeCompletion, 3f), 0f, 1f); + spriteBatch.Draw(baseTex, Position - Main.screenPosition, null, lightColor * opacity, Rotation, baseTex.Size() / 2f, Scale, spriteEffect, 0); } } } diff --git a/Prefixes/RogueAccessoryPrefix.cs b/Prefixes/RogueAccessoryPrefix.cs index 654b323a12..869966b261 100644 --- a/Prefixes/RogueAccessoryPrefix.cs +++ b/Prefixes/RogueAccessoryPrefix.cs @@ -1,70 +1,56 @@ -using Terraria; +using System; +using System.Collections.Generic; +using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Prefixes { - public class QuietPrefix : RogueAccessoryPrefix + [LegacyName("CloakedPrefix", "QuietPrefix")] + public class Cloaked : RogueAccessoryPrefix { - public override string Name => "Quiet"; - public QuietPrefix() : base(1.02f) { } + public override float stealthGenBonus => 0.04f; } - public class CloakedPrefix : RogueAccessoryPrefix + [LegacyName("SilentPrefix", "CamouflagedPrefix")] + public class Silent : RogueAccessoryPrefix { - public override string Name => "Cloaked"; - public CloakedPrefix() : base(1.04f) { } + public override float stealthGenBonus => 0.08f; } - public class CamouflagedPrefix : RogueAccessoryPrefix + public abstract class RogueAccessoryPrefix : ModPrefix, ILocalizedModType { - public override string Name => "Camouflaged"; - public CamouflagedPrefix() : base(1.06f) { } - } + public new string LocalizationCategory => "Prefixes.Accessory"; - public class SilentPrefix : RogueAccessoryPrefix - { - public override string Name => "Silent"; - public SilentPrefix() : base(1.08f) { } - } + // Stats + public virtual float stealthGenBonus => 0f; - public class RogueAccessoryPrefix : ModPrefix - { - internal float stealthGenBonus = 1f; + // Prefix roll logic public override PrefixCategory Category => PrefixCategory.Accessory; + public override bool CanRoll(Item item) => GetType() != typeof(RogueAccessoryPrefix); - public RogueAccessoryPrefix() { } - - public RogueAccessoryPrefix(float stealthGenBonus = 1f) + // Applying stealth generation + public override void ApplyAccessoryEffects(Player player) { - this.stealthGenBonus = stealthGenBonus; - } - - public override void Apply(Item item) - { - item.Calamity().StealthGenBonus = stealthGenBonus; + player.Calamity().accStealthGenBoost += stealthGenBonus; } + // Changing value based on prefix tier (rarity is set automatically around value multiplier) public override void ModifyValue(ref float valueMult) { - float extraValue = 1f + (2.5f * (stealthGenBonus - 1f)); + float extraValue = 1f + (2.5f * stealthGenBonus); valueMult *= extraValue; } - public override bool CanRoll(Item item) => GetType() != typeof(RogueAccessoryPrefix); - - public override float RollChance(Item item) + // Extra tooltip for new modifier stats + public LocalizedText StealthGenTooltip => CalamityUtils.GetText($"{LocalizationCategory}.StealthGenTooltip"); + public override IEnumerable GetTooltipLines(Item item) { - if (item.vanity) - return 0f; - if (item.type == ItemID.GuideVoodooDoll || item.type == ItemID.MusicBox || item.type == ItemID.ClothierVoodooDoll) - return 0f; - if (item.type >= ItemID.MusicBoxOverworldDay && item.type <= ItemID.MusicBoxBoss3) - return 0f; - if (item.type >= ItemID.MusicBoxSnow && item.type <= ItemID.MusicBoxMushrooms) - return 0f; - - return 1f; + yield return new TooltipLine(Mod, "PrefixStealthGenBoost", StealthGenTooltip.Format((stealthGenBonus * 100).ToString("N0"))) + { + IsModifier = true + }; } } } diff --git a/Prefixes/RogueWeaponPrefix.cs b/Prefixes/RogueWeaponPrefix.cs index b2e5adb058..1bccbf58de 100644 --- a/Prefixes/RogueWeaponPrefix.cs +++ b/Prefixes/RogueWeaponPrefix.cs @@ -1,162 +1,148 @@ -using Terraria; +using System; +using System.Collections.Generic; +using Terraria; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Prefixes { - public enum RoguePrefixType : byte + [LegacyName("PointyWeaponPrefix")] + public class Pointy : RogueWeaponPrefix { - Pointy, - Sharp, - Feathered, - Sleek, - Hefty, - Mighty, - Glorious, - Serrated, - Vicious, - Lethal, - Flawless, - Radical, - Blunt, - Flimsy, - Unbalanced, - Atrocious + public override float damageMult => 1.1f; } - public class PointyWeaponPrefix : RogueWeaponPrefix + [LegacyName("SharpWeaponPrefix")] + public class Sharp : RogueWeaponPrefix { - public override string Name => "Pointy"; - public PointyWeaponPrefix() : base(1.1f, 1f, 0, 1f, 1f) { } + public override float damageMult => 1.15f; } - public class SharpWeaponPrefix : RogueWeaponPrefix + [LegacyName("FeatheredWeaponPrefix")] + public class Feathered : RogueWeaponPrefix { - public override string Name => "Sharp"; - public SharpWeaponPrefix() : base(1.15f, 1f, 0, 1f, 1f) { } + public override float useTimeMult => 0.85f; + public override float shootSpeedMult => 1.1f; } - public class FeatheredWeaponPrefix : RogueWeaponPrefix + [LegacyName("SleekWeaponPrefix")] + public class Sleek : RogueWeaponPrefix { - public override string Name => "Feathered"; - public FeatheredWeaponPrefix() : base(1f, 0.85f, 0, 1.1f, 1f) { } + public override float damageMult => 1f; + public override float useTimeMult => 0.9f; + public override float shootSpeedMult => 1.15f; } - public class SleekWeaponPrefix : RogueWeaponPrefix + [LegacyName("HeftyWeaponPrefix")] + public class Hefty : RogueWeaponPrefix { - public override string Name => "Sleek"; - public SleekWeaponPrefix() : base(1f, 0.9f, 0, 1.15f, 1f) { } + public override float damageMult => 1.1f; + public override float stealthDmgMult => 1.15f; } - public class HeftyWeaponPrefix : RogueWeaponPrefix + [LegacyName("MightyWeaponPrefix")] + public class Mighty : RogueWeaponPrefix { - public override string Name => "Hefty"; - public HeftyWeaponPrefix() : base(1.1f, 1f, 0, 1f, 1.15f) { } + public override float damageMult => 1.15f; + public override float stealthDmgMult => 1.05f; } - public class MightyWeaponPrefix : RogueWeaponPrefix + [LegacyName("GloriousWeaponPrefix")] + public class Glorious : RogueWeaponPrefix { - public override string Name => "Mighty"; - public MightyWeaponPrefix() : base(1.15f, 1f, 0, 1f, 1.05f) { } + public override float damageMult => 1.1f; + public override float useTimeMult => 0.95f; } - public class GloriousWeaponPrefix : RogueWeaponPrefix + [LegacyName("SerratedWeaponPrefix")] + public class Serrated : RogueWeaponPrefix { - public override string Name => "Glorious"; - public GloriousWeaponPrefix() : base(1.1f, 0.95f, 0, 1f, 1f) { } + public override float damageMult => 1.1f; + public override float useTimeMult => 0.9f; + public override float shootSpeedMult => 1.05f; } - public class SerratedWeaponPrefix : RogueWeaponPrefix + [LegacyName("ViciousWeaponPrefix")] + public class Vicious : RogueWeaponPrefix { - public override string Name => "Serrated"; - public SerratedWeaponPrefix() : base(1.1f, 0.9f, 0, 1.05f, 1f) { } + public override float damageMult => 1.1f; + public override float useTimeMult => 0.95f; + public override float shootSpeedMult => 1.15f; } - public class ViciousWeaponPrefix : RogueWeaponPrefix + [LegacyName("LethalWeaponPrefix")] + public class Lethal : RogueWeaponPrefix { - public override string Name => "Vicious"; - public ViciousWeaponPrefix() : base(1.1f, 0.95f, 0, 1.15f, 1f) { } + public override float damageMult => 1.1f; + public override float useTimeMult => 0.95f; + public override int critBonus => 2; + public override float shootSpeedMult => 1.05f; + public override float stealthDmgMult => 1.05f; } - public class LethalWeaponPrefix : RogueWeaponPrefix + [LegacyName("FlawlessWeaponPrefix")] + public class Flawless : RogueWeaponPrefix { - public override string Name => "Lethal"; - public LethalWeaponPrefix() : base(1.1f, 0.95f, 2, 1.05f, 1.05f) { } + public override float damageMult => 1.15f; + public override float useTimeMult => 0.9f; + public override int critBonus => 5; + public override float shootSpeedMult => 1.1f; + public override float stealthDmgMult => 1.15f; } - public class FlawlessWeaponPrefix : RogueWeaponPrefix + [LegacyName("RadicalWeaponPrefix")] + public class Radical : RogueWeaponPrefix { - public override string Name => "Flawless"; - public FlawlessWeaponPrefix() : base(1.15f, 0.9f, 5, 1.1f, 1.15f) { } + public override float damageMult => 1.05f; + public override float useTimeMult => 0.95f; + public override float shootSpeedMult => 1.05f; + public override float stealthDmgMult => 0.9f; } - public class RadicalWeaponPrefix : RogueWeaponPrefix + [LegacyName("BluntWeaponPrefix")] + public class Blunt : RogueWeaponPrefix { - public override string Name => "Radical"; - public RadicalWeaponPrefix() : base(1.05f, 0.95f, 0, 1.05f, 0.9f) { } + public override float damageMult => 0.85f; } - public class BluntWeaponPrefix : RogueWeaponPrefix + [LegacyName("FlimsyWeaponPrefix")] + public class Flimsy : RogueWeaponPrefix { - public override string Name => "Blunt"; - public BluntWeaponPrefix() : base(0.85f, 1f, 0, 1f, 1f) { } + public override float damageMult => 0.9f; + public override float stealthDmgMult => 0.9f; } - public class FlimsyWeaponPrefix : RogueWeaponPrefix + [LegacyName("UnbalancedWeaponPrefix")] + public class Unbalanced : RogueWeaponPrefix { - public override string Name => "Flimsy"; - public FlimsyWeaponPrefix() : base(0.9f, 1f, 0, 1f, 0.9f) { } + public override float useTimeMult => 1.15f; + public override float shootSpeedMult => 0.95f; } - public class UnbalancedWeaponPrefix : RogueWeaponPrefix + [LegacyName("AtrociousWeaponPrefix")] + public class Atrocious : RogueWeaponPrefix { - public override string Name => "Unbalanced"; - public UnbalancedWeaponPrefix() : base(1f, 1.15f, 0, 0.95f, 1f) { } + public override float damageMult => 0.85f; + public override float shootSpeedMult => 0.9f; + public override float stealthDmgMult => 0.9f; } - public class AtrociousWeaponPrefix : RogueWeaponPrefix + public abstract class RogueWeaponPrefix : ModPrefix, ILocalizedModType { - public override string Name => "Atrocious"; - public AtrociousWeaponPrefix() : base(0.85f, 1f, 0, 0.9f, 0.9f) { } - } + public new string LocalizationCategory => "Prefixes.Weapon"; - public class RogueWeaponPrefix : ModPrefix - { - internal float damageMult = 1f; - internal float useTimeMult = 1f; - internal int critBonus = 0; - internal float shootSpeedMult = 1f; - internal float stealthDmgMult = 1f; + // Stats + public virtual float damageMult => 1f; + public virtual float useTimeMult => 1f; + public virtual int critBonus => 0; + public virtual float shootSpeedMult => 1f; + public virtual float stealthDmgMult => 1f; - // The part where it can only be rolled by rogue weapons is done by CanRoll below + // Prefix roll logic -- Can also be rolled by throwing weapons, even if stealth strikes don't exist public override PrefixCategory Category => PrefixCategory.AnyWeapon; - - public RogueWeaponPrefix() { } - - public RogueWeaponPrefix(float damageMult = 1f, float useTimeMult = 1f, int critBonus = 0, float shootSpeedMult = 1f, float stealthDmgMult = 1f) - { - this.damageMult = damageMult; - this.useTimeMult = useTimeMult; - this.critBonus = critBonus; - this.shootSpeedMult = shootSpeedMult; - this.stealthDmgMult = stealthDmgMult; - } - - public override void Apply(Item item) - { - if (item.CountsAsClass()) - item.Calamity().StealthStrikePrefixBonus = stealthDmgMult; - } - - public override void ModifyValue(ref float valueMult) - { - float extraStealthDamage = stealthDmgMult - 1f; - float stealthDamageValueMultiplier = 1f; - float extraValue = 1f + stealthDamageValueMultiplier * extraStealthDamage; - valueMult *= extraValue; - } - public override bool CanRoll(Item item) => item.CountsAsClass() && (item.maxStack == 1 || item.AllowReforgeForStackableItem) && GetType() != typeof(RogueWeaponPrefix); + // Applying normal weapon stats public override void SetStats(ref float damageMult, ref float knockbackMult, ref float useTimeMult, ref float scaleMult, ref float shootSpeedMult, ref float manaMult, ref int critBonus) { damageMult = this.damageMult; @@ -164,5 +150,36 @@ namespace CalamityMod.Prefixes critBonus = this.critBonus; shootSpeedMult = this.shootSpeedMult; } + + // Applying stealth strike damage + public override void Apply(Item item) + { + if (item.CountsAsClass()) + item.Calamity().StealthStrikePrefixBonus = stealthDmgMult; + } + + // Changing value based on prefix tier (rarity is set automatically around value multiplier) + public override void ModifyValue(ref float valueMult) + { + float extraStealthDamage = stealthDmgMult - 1f; + float stealthDamageValueMultiplier = 1f; + float extraValue = 1f + stealthDamageValueMultiplier * extraStealthDamage; + valueMult *= extraValue; + } + + // Extra tooltip for new modifier stats + public LocalizedText StealthDamageTooltip => CalamityUtils.GetText($"{LocalizationCategory}.StealthDamageTooltip"); + public override IEnumerable GetTooltipLines(Item item) + { + // Ignore this if there's no mult + if (stealthDmgMult == 1f) + yield break; + + yield return new TooltipLine(Mod, "PrefixStealthDamageBoost", StealthDamageTooltip.Format((stealthDmgMult >= 1f ? "+" : string.Empty) + ((stealthDmgMult * 100) - 100).ToString("N0"))) + { + IsModifier = true, + IsModifierBad = stealthDmgMult < 1f + }; + } } } diff --git a/Projectiles/BaseProjectiles/BaseGunHoldoutProjectile.cs b/Projectiles/BaseProjectiles/BaseGunHoldoutProjectile.cs new file mode 100644 index 0000000000..f231b4f8d2 --- /dev/null +++ b/Projectiles/BaseProjectiles/BaseGunHoldoutProjectile.cs @@ -0,0 +1,250 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.GameContent; +using Terraria.Localization; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.BaseProjectiles +{ + /// + /// An abstract class dedicated to ease the making of gun-like holdouts, regarding of the weapon class.
+ /// All the AI code goes to .
+ /// Sets the texture, localization and SetDefaults automatically.
+ /// You also have convenient properties for offsets, arm visuals and the tip of the gun.
+ /// You must name your holdout's class the name of the item's class plus "Holdout" at the end, you'll get errors otherwise. + ///
+ public abstract class BaseGunHoldoutProjectile : ModProjectile, ILocalizedModType + { + #region Overridable Properties + + /// + /// The ID of the item that this holdout belongs to. + /// + public abstract int AssociatedItemID { get; } + + /// + /// The position of the gun tip, used for spawning the holdout's shots.
+ /// Override if it isn't aligned properly. For example: when the tip is a bit upwards. + ///
+ public virtual Vector2 GunTipPosition => Projectile.Center + Vector2.UnitX.RotatedBy(Projectile.rotation) * Projectile.width * 0.5f; + + /// + /// How fast returns back to .
+ /// In consequence, this is how fast the holdout goes back to its position.
+ /// Defaults to 0.3f. + ///
+ public virtual float RecoilResolveSpeed => 0.3f; + + /// + /// The distance of the holdout to the arm.
+ /// Used to properly position the weapon to be held on the player's arms. + ///
+ public virtual float MaxOffsetLengthFromArm { get; } + + /// + /// The offset in the X-axis of the holdout when the player's pointing upwards. + /// + public virtual float OffsetXUpwards { get; } + + /// + /// The offset in the X-axis of the holdout when the player's pointing downwards. + /// + public virtual float OffsetXDownwards { get; } + + /// + /// The base offset on the Y-axis of the holdout.
+ /// Used to align the holdout when pointing horizontally. + ///
+ public virtual float BaseOffsetY { get; } + + /// + /// The offset in the Y-axis of the holdout when the player's pointing upwards. + /// + public virtual float OffsetYUpwards { get; } + + /// + /// The offset in the Y-axis of the holdout when the player's pointing downwards. + /// + public virtual float OffsetYDownwards { get; } + + #endregion + + #region Properties + + /// + /// The owner of this holdout.
+ /// It's set on . + ///
+ public Player Owner { get; private set; } + + /// + /// The item that the player's holding, correspondent to .
+ /// It's set on . + ///
+ public Item HeldItem { get; private set; } + + /// + /// Whether the holdout will have its set 2 constantly.
+ /// Used when you want to keep it alive for a bit longer after it should despawn.
+ /// Defaults to . + ///
+ public bool KeepRefreshingLifetime { get; set; } = true; + + /// + /// The current offset length from the arm of the holdout.
+ /// Used to make recoil effects by setting this to a lower value than . + ///
+ public float OffsetLengthFromArm { get; set; } + + /// + /// Extra rotation added to the front arm if you want to make it be held cooler or more naturally.
+ /// Direction is already taken care of, so you don't need to multiply anything. + ///
+ public float ExtraFrontArmRotation { get; set; } + + /// + /// Extra rotation added to the back arm if you want to make it be held cooler or more naturally.
+ /// Direction is already taken care of, so you don't need to multiply anything. + ///
+ public float ExtraBackArmRotation { get; set; } + + /// + /// The visual stretch of the owner's front arm.
+ /// Defaults to . + ///
+ public Player.CompositeArmStretchAmount FrontArmStretch { get; set; } = Player.CompositeArmStretchAmount.Full; + + /// + /// The visual stretch of the owner's back arm.
+ /// Defaults to . + ///
+ public Player.CompositeArmStretchAmount BackArmStretch { get; set; } = Player.CompositeArmStretchAmount.Full; + + private Type AssociatedItemType => ItemLoader.GetItem(AssociatedItemID).GetType(); + + #endregion + + #region Overridden Members + + // Gets the display name of the associated item. + public override LocalizedText DisplayName => CalamityUtils.GetItemName(AssociatedItemID); + + // Gets the texture of the associated item. + public override string Texture => (AssociatedItemType.Namespace + "." + AssociatedItemType.Name).Replace('.', '/'); + + public override void SetDefaults() + { + Projectile.width = Projectile.height = TextureAssets.Item[AssociatedItemID].Width(); + Projectile.tileCollide = false; + Projectile.netImportant = true; + } + + public override void OnSpawn(IEntitySource source) + { + Owner = Main.player[Projectile.owner]; + OffsetLengthFromArm = MaxOffsetLengthFromArm; + HeldItem = Owner.ActiveItem(); + Projectile.velocity = Owner.Calamity().mouseWorld - Owner.RotatedRelativePoint(Owner.MountedCenter); + } + + public override bool ShouldUpdatePosition() => false; + + public override bool? CanDamage() => false; + + #endregion + + #region AI + + public override void AI() + { + KillHoldoutLogic(); + ManageHoldout(); + HoldoutAI(); + } + + /// + /// Here goes the code for when the holdout needs to despawn.
+ /// Defaults to despawning when the owner isn't holding or isn't using the correspondent weapon. + ///
+ public virtual void KillHoldoutLogic() + { + if (Owner.CantUseHoldout()) + { + Projectile.netUpdate = true; + Projectile.Kill(); + } + } + + /// + /// Does all the needed code for a holdout to work. + /// + public virtual void ManageHoldout() + { + // The center of the player, taking into account if they have a mount or not. + Vector2 armPosition = Owner.RotatedRelativePoint(Owner.MountedCenter, true); + + // The vector between the player and the mouse, used for pointing the holdout. + Vector2 ownerToMouse = Owner.Calamity().mouseWorld - armPosition; + + // The direction this holdout's pointing at. + float holdoutDirection = Projectile.velocity.ToRotation(); + + // A range from -1 to 1 for when the holdout is pointing downards of upwards, respectively. + // Used for the offsets. + float proximityLookingUpwards = Vector2.Dot(ownerToMouse.SafeNormalize(Vector2.Zero), -Vector2.UnitY * Owner.gravDir); + + int direction = MathF.Sign(ownerToMouse.X); + + Vector2 lengthOffset = Projectile.rotation.ToRotationVector2() * OffsetLengthFromArm; + Vector2 armOffset = new Vector2(Utils.Remap(MathF.Abs(proximityLookingUpwards), 0f, 1f, 0f, proximityLookingUpwards > 0f ? OffsetXUpwards : OffsetXDownwards) * direction, BaseOffsetY * Owner.gravDir + Utils.Remap(MathF.Abs(proximityLookingUpwards), 0f, 1f, 0f, proximityLookingUpwards > 0f ? OffsetYUpwards : OffsetYDownwards) * Owner.gravDir); + Projectile.Center = armPosition + lengthOffset + armOffset; + Projectile.velocity = holdoutDirection.AngleTowards(ownerToMouse.ToRotation(), 0.2f).ToRotationVector2(); + Projectile.rotation = holdoutDirection; + + Projectile.spriteDirection = direction; + Owner.ChangeDir(direction); + + Owner.heldProj = Projectile.whoAmI; + Owner.itemTime = Owner.itemAnimation = 2; + Owner.itemRotation = (Projectile.velocity * Projectile.direction).ToRotation(); + + // -Pi/2 because the arms rotation starts with arms pointing down. + float armRotation = (Projectile.rotation - MathHelper.PiOver2) * Owner.gravDir + (Owner.gravDir == -1 ? MathHelper.Pi : 0f); + Owner.SetCompositeArmFront(true, FrontArmStretch, armRotation + ExtraFrontArmRotation * direction); + Owner.SetCompositeArmBack(true, BackArmStretch, armRotation + ExtraBackArmRotation * direction); + + if (KeepRefreshingLifetime) + Projectile.timeLeft = 2; + + if (OffsetLengthFromArm != MaxOffsetLengthFromArm) + OffsetLengthFromArm = MathHelper.Lerp(OffsetLengthFromArm, MaxOffsetLengthFromArm, RecoilResolveSpeed); + } + + /// + /// Where all the actual AI goes to. + /// + public abstract void HoldoutAI(); + + #endregion + + #region Drawing + + public override bool PreDraw(ref Color lightColor) + { + Texture2D texture = TextureAssets.Projectile[Type].Value; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f); + Vector2 rotationPoint = texture.Size() * 0.5f; + SpriteEffects flipSprite = (Projectile.spriteDirection * Owner.gravDir == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + + Main.EntitySpriteDraw(texture, drawPosition, null, Projectile.GetAlpha(lightColor), drawRotation, rotationPoint, Projectile.scale * Owner.gravDir, flipSprite); + + return false; + } + + #endregion + } +} diff --git a/Projectiles/BaseProjectiles/BaseIdleHoldoutProjectile.cs b/Projectiles/BaseProjectiles/BaseIdleHoldoutProjectile.cs index 0674196684..fa73780b80 100644 --- a/Projectiles/BaseProjectiles/BaseIdleHoldoutProjectile.cs +++ b/Projectiles/BaseProjectiles/BaseIdleHoldoutProjectile.cs @@ -1,8 +1,9 @@ -using Microsoft.Xna.Framework; -using System; +using System; using System.Collections.Generic; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; +using Terraria.ModLoader.Core; namespace CalamityMod.Projectiles.BaseProjectiles { @@ -25,7 +26,8 @@ namespace CalamityMod.Projectiles.BaseProjectiles // Look through every type in the mod, and check if it's derived from BaseIdleHoldoutProjectile. // If it is, cache it into the item/projectile relationship cache. - foreach (Type type in typeof(CalamityMod).Assembly.GetTypes()) + Type[] types = AssemblyManager.GetLoadableTypes(CalamityMod.Instance.Code); + foreach (Type type in types) { // Don't load abstract classes; they cannot have instances. if (type.IsAbstract) diff --git a/Projectiles/BaseProjectiles/BaseLaserbeamProjectile.cs b/Projectiles/BaseProjectiles/BaseLaserbeamProjectile.cs index e086267ab1..2a9b9923a2 100644 --- a/Projectiles/BaseProjectiles/BaseLaserbeamProjectile.cs +++ b/Projectiles/BaseProjectiles/BaseLaserbeamProjectile.cs @@ -1,7 +1,7 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; +using System; using System.Linq; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Enums; using Terraria.ID; diff --git a/Projectiles/BaseProjectiles/BaseMassiveExplosionProjectile.cs b/Projectiles/BaseProjectiles/BaseMassiveExplosionProjectile.cs index b2c881c818..e6fa7a953e 100644 --- a/Projectiles/BaseProjectiles/BaseMassiveExplosionProjectile.cs +++ b/Projectiles/BaseProjectiles/BaseMassiveExplosionProjectile.cs @@ -1,6 +1,6 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.DataStructures; using Terraria.Graphics.Shaders; diff --git a/Projectiles/BaseProjectiles/BaseMinionProjectile.cs b/Projectiles/BaseProjectiles/BaseMinionProjectile.cs index 06aebb26f5..39dfaebd12 100644 --- a/Projectiles/BaseProjectiles/BaseMinionProjectile.cs +++ b/Projectiles/BaseProjectiles/BaseMinionProjectile.cs @@ -1,4 +1,6 @@ -using CalamityMod.CalPlayer; +using System; +using CalamityMod.CalPlayer; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -73,6 +75,38 @@ namespace CalamityMod.Projectiles.BaseProjectiles ///
public virtual bool PreventTargettingUntilTargetHit => true; + /// + /// If , the minion will be considered grounded, this will turn on some features that are neccesary for grounded minions.
+ /// Defaults to . + ///
+ public virtual bool Grounded => false; + + /// + /// The speed at which the minion falls.
+ /// It'll take the absolute value of whatever you input, to ensure that it's on Terraria's coordinate system.
+ /// This is intended to use for grounded minions.
+ /// Defaults to 0.4f. + ///
+ public float Gravity + { + get => _gravity; + set => _gravity = MathF.Abs(value); + } + private float _gravity = 0.4f; + + /// + /// The max speed at which the minion falls.
+ /// It'll take the absolute value of whatever you input, to ensure that it's on Terraria's coordinate system.
+ /// This is intended to use for grounded minions.
+ /// Defaults to 20f. + ///
+ public float MaxGravity + { + get => _maxGravity; + set => _maxGravity = MathF.Abs(value); + } + private float _maxGravity = 20f; + /// /// The amount of animation frames this minion has.
/// Defaults to 1 frame. @@ -119,7 +153,7 @@ namespace CalamityMod.Projectiles.BaseProjectiles Projectile.penetrate = -1; Projectile.friendly = true; - Projectile.tileCollide = false; + Projectile.tileCollide = Grounded; Projectile.ignoreWater = true; Projectile.minion = true; Projectile.usesLocalNPCImmunity = true; @@ -141,6 +175,8 @@ namespace CalamityMod.Projectiles.BaseProjectiles MinionAI(); } + public override bool OnTileCollide(Vector2 oldVelocity) => false; + #region AI Methods /// @@ -188,7 +224,89 @@ namespace CalamityMod.Projectiles.BaseProjectiles { Owner = Main.player[Projectile.owner]; ModdedOwner = Owner.Calamity(); - Target = Owner.Center.MinionHoming(AdaptiveEnemyDistanceDetection, Owner, !PreHardmodeMinionTileVision || CalamityPlayer.areThereAnyDamnBosses); + Target = Owner.Center.MinionHoming(AdaptiveEnemyDistanceDetection, Owner, !PreHardmodeMinionTileVision || (CalamityPlayer.areThereAnyDamnBosses && !Grounded)); + + // When minions are grounded, they are affected by tiles, meaning they have a much limited movement. + // Pre-Hardmode minions are affected the most since they can't see through walls. + // In consequence, some targets that may seem valid, aren't detected due to this. + // If the minion hasn't detected any targets with the center being the player, we give them a second chance with the center being the minion itself. + // If there are bosses on the world, we don't do this check because if there wasn't any targets with tile X-Ray, this won't do anything. + if (Grounded && Target is null && PreHardmodeMinionTileVision) + Target = Projectile.Center.MinionHoming(AdaptiveEnemyDistanceDetection, Owner, false); + } + + #endregion + + #region Grounded Minion Utilities + + /// + /// A quick method to apply gravity to grounded minions.
+ /// You can choose to not use it and make your own if a simple one does not fit your need. + ///
+ public void DoGravity() + { + float speedY = Projectile.velocity.Y; + if (speedY < _maxGravity) + speedY = MathF.Min(speedY + _gravity, _maxGravity); + Projectile.velocity.Y = speedY; + } + + /// + /// Checks whether there's a tile between two vectors vertically.
+ /// This method has many shorthand variants.
+ /// Useful for grounded minion behavior. + ///
+ /// The starter vector. Its X component will be the one used, so put here the vector from where you want to check. + /// The ending vector. + /// Whether you want to check for platforms when is below + /// Returns if there's a tile between and , the X coordinate being the one from ; otherwise . + public bool IsTileBetweenTwoVectorsVertically(Vector2 startVector, Vector2 endVector, bool platformCheckDownwards = false) + { + Point startPoint = CalamityUtils.ToSafeTileCoordinates(startVector); + Point endPoint = CalamityUtils.ToSafeTileCoordinates(endVector); + + if (endVector.Y > startVector.Y) + { + for (int coordY = endPoint.Y; coordY >= startPoint.Y; coordY--) + { + if (Main.tile[startPoint.X, coordY].IsTileSolidGround()) + return true; + } + } + else + { + for (int coordY = endPoint.Y; coordY <= startPoint.Y; coordY++) + { + if (platformCheckDownwards) + { + if (Main.tile[startPoint.X, coordY].IsTileSolidGround()) + return true; + } + else if (Main.tile[startPoint.X, coordY].IsTileSolid()) + return true; + } + } + + return false; + } + + public bool IsTileBetweenOwnerAndVectorVertically(Vector2 vector, bool platformCheckDownwards = false) => IsTileBetweenTwoVectorsVertically(Owner.Center, vector, platformCheckDownwards); + + public bool IsTileBetweenTargetAndVectorVertically(Vector2 vector, bool platformCheckDownwards = false) => IsTileBetweenTwoVectorsVertically(Target.Center, vector, platformCheckDownwards); + + public bool IsTileBetweenVectorAndMinionVertically(Vector2 vector, bool platformCheckDownwards = false) => IsTileBetweenTwoVectorsVertically(vector, Projectile.Center, platformCheckDownwards); + + public bool IsTileBetweenOwnerAndMinionVertically(bool platformCheckDownwards = false) => IsTileBetweenTwoVectorsVertically(Owner.Center, Projectile.Center, platformCheckDownwards); + + public bool IsTileBetweenTargetAndMinionVertically(bool platformCheckDownwards = false) => IsTileBetweenTwoVectorsVertically(Target.Center, Projectile.Center, platformCheckDownwards); + + public bool IsMinionFacingTile() + { + Rectangle inflatedMinionHitbox = Projectile.getRect(); + inflatedMinionHitbox.Inflate(1, 0); + bool stuckOnLeftTile = Main.tile[new Vector2(inflatedMinionHitbox.X, inflatedMinionHitbox.Y + inflatedMinionHitbox.Height - 17).ToSafeTileCoordinates()].IsTileSolid(); + bool stuckOnRightTile = Main.tile[new Vector2(inflatedMinionHitbox.X + inflatedMinionHitbox.Width, inflatedMinionHitbox.Y + inflatedMinionHitbox.Height - 17).ToSafeTileCoordinates()].IsTileSolid(); + return stuckOnLeftTile || stuckOnRightTile; } #endregion diff --git a/Projectiles/BaseProjectiles/BaseShortswordProjectile.cs b/Projectiles/BaseProjectiles/BaseShortswordProjectile.cs index 8d8a3caa26..5cc792042f 100644 --- a/Projectiles/BaseProjectiles/BaseShortswordProjectile.cs +++ b/Projectiles/BaseProjectiles/BaseShortswordProjectile.cs @@ -1,5 +1,5 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; using Terraria.Enums; using Terraria.ModLoader; @@ -24,9 +24,9 @@ namespace CalamityMod.Projectiles.BaseProjectiles public virtual ShortswordType ShortswordAIType => ShortswordType.TypicalShortsword; #endregion - public float CollisionWidth => 4f * Projectile.scale; - public float FullUse => Timer / 14f; - public Player Owner => Main.player[Projectile.owner]; + public float CollisionWidth => 4f * Projectile.scale; + public float FullUse => Timer / 14f; + public Player Owner => Main.player[Projectile.owner]; public int Timer diff --git a/Projectiles/BaseProjectiles/BaseSpearProjectile.cs b/Projectiles/BaseProjectiles/BaseSpearProjectile.cs index 3120581e05..46700c42b6 100644 --- a/Projectiles/BaseProjectiles/BaseSpearProjectile.cs +++ b/Projectiles/BaseProjectiles/BaseSpearProjectile.cs @@ -1,6 +1,6 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ModLoader; @@ -162,7 +162,7 @@ namespace CalamityMod.Projectiles.BaseProjectiles { if (SpearAiType == SpearType.TypicalSpear) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Vector2 drawPosition = Projectile.Center - Main.screenPosition; Vector2 origin = Vector2.Zero; Main.EntitySpriteDraw(texture, drawPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, 0, 0); diff --git a/Projectiles/BaseProjectiles/BaseSporeSacProjectile.cs b/Projectiles/BaseProjectiles/BaseSporeSacProjectile.cs index 70e4e5ddaa..9674720332 100644 --- a/Projectiles/BaseProjectiles/BaseSporeSacProjectile.cs +++ b/Projectiles/BaseProjectiles/BaseSporeSacProjectile.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; diff --git a/Projectiles/BaseProjectiles/BaseWhipProjectile.cs b/Projectiles/BaseProjectiles/BaseWhipProjectile.cs index e71db0bed3..a35e02a794 100644 --- a/Projectiles/BaseProjectiles/BaseWhipProjectile.cs +++ b/Projectiles/BaseProjectiles/BaseWhipProjectile.cs @@ -1,6 +1,6 @@ +using System; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.Enums; using Terraria.ModLoader; @@ -101,7 +101,7 @@ namespace CalamityMod.Projectiles.BaseProjectiles Behavior(); ExtraBehavior(); } - public Texture2D FlailTexture => ModContent.Request(Texture).Value; + public Texture2D FlailTexture => Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; #region Virtual Values public virtual Color SpecialDrawColor => new Color(255, 200, 0); diff --git a/Projectiles/Boss/ApolloChargeTelegraph.cs b/Projectiles/Boss/ApolloChargeTelegraph.cs index 125a6dd6d7..66e6f36cc1 100644 --- a/Projectiles/Boss/ApolloChargeTelegraph.cs +++ b/Projectiles/Boss/ApolloChargeTelegraph.cs @@ -1,8 +1,8 @@ -using CalamityMod.Events; +using System.IO; +using CalamityMod.Events; using CalamityMod.Graphics.Primitives; using CalamityMod.World; using Microsoft.Xna.Framework; -using System.IO; using Terraria; using Terraria.Graphics.Shaders; using Terraria.ID; diff --git a/Projectiles/Boss/ApolloFireball.cs b/Projectiles/Boss/ApolloFireball.cs index 39a8db04fd..d86f5eec5a 100644 --- a/Projectiles/Boss/ApolloFireball.cs +++ b/Projectiles/Boss/ApolloFireball.cs @@ -1,14 +1,14 @@ -using CalamityMod.Events; +using System; +using System.IO; +using CalamityMod.Events; using CalamityMod.NPCs; +using CalamityMod.Sounds; using CalamityMod.World; using Microsoft.Xna.Framework; -using System; -using System.IO; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using CalamityMod.Sounds; namespace CalamityMod.Projectiles.Boss { @@ -86,7 +86,7 @@ namespace CalamityMod.Projectiles.Boss dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); int randomDustType = Main.rand.NextBool() ? 107 : 110; - int plasmaDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 200, default, 1.7f); + int plasmaDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 200, default, 1.7f); Main.dust[plasmaDust].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; Main.dust[plasmaDust].noGravity = true; @@ -94,7 +94,7 @@ namespace CalamityMod.Projectiles.Boss dust.velocity *= 3f; dust = Main.dust[plasmaDust]; - plasmaDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 100, default, 0.8f); + plasmaDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 100, default, 0.8f); Main.dust[plasmaDust].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; dust = Main.dust[plasmaDust]; @@ -114,7 +114,7 @@ namespace CalamityMod.Projectiles.Boss dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); int randomDustType = Main.rand.NextBool() ? 107 : 110; - int plasmaDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 0, default, 2f); + int plasmaDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 0, default, 2f); Main.dust[plasmaDust2].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(MathHelper.Pi).RotatedBy(Projectile.velocity.ToRotation()) * Projectile.width / 3f; Main.dust[plasmaDust2].noGravity = true; diff --git a/Projectiles/Boss/ApolloRocket.cs b/Projectiles/Boss/ApolloRocket.cs index 01c48380b6..7b0113ff24 100644 --- a/Projectiles/Boss/ApolloRocket.cs +++ b/Projectiles/Boss/ApolloRocket.cs @@ -1,13 +1,13 @@ -using CalamityMod.Events; +using System; +using System.IO; +using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { @@ -79,7 +79,7 @@ namespace CalamityMod.Projectiles.Boss dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); int randomDustType = Main.rand.NextBool() ? 107 : 110; - int plasmaDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 200, default, 1.7f); + int plasmaDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 200, default, 1.7f); Main.dust[plasmaDust].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; Main.dust[plasmaDust].noGravity = true; @@ -87,7 +87,7 @@ namespace CalamityMod.Projectiles.Boss dust.velocity *= 3f; dust = Main.dust[plasmaDust]; - plasmaDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 100, default, 0.8f); + plasmaDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 100, default, 0.8f); Main.dust[plasmaDust].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; dust = Main.dust[plasmaDust]; @@ -107,7 +107,7 @@ namespace CalamityMod.Projectiles.Boss dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); int randomDustType = Main.rand.NextBool() ? 107 : 110; - int plasmaDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 0, default, 2f); + int plasmaDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 0, default, 2f); Main.dust[plasmaDust2].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(MathHelper.Pi).RotatedBy(Projectile.velocity.ToRotation()) * Projectile.width / 3f; Main.dust[plasmaDust2].noGravity = true; @@ -196,7 +196,7 @@ namespace CalamityMod.Projectiles.Boss public override void PostDraw(Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; int height = texture.Height / Main.projFrames[Projectile.type]; int drawStart = height * Projectile.frame; Vector2 origin = Projectile.Size / 2; diff --git a/Projectiles/Boss/AresDeathBeamStart.cs b/Projectiles/Boss/AresDeathBeamStart.cs index 2e9c61f49f..b08a03cdca 100644 --- a/Projectiles/Boss/AresDeathBeamStart.cs +++ b/Projectiles/Boss/AresDeathBeamStart.cs @@ -1,4 +1,7 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using System.IO; +using System.Linq; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Events; using CalamityMod.NPCs.ExoMechs.Ares; using CalamityMod.NPCs.Other; @@ -7,9 +10,6 @@ using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; -using System; -using System.IO; -using System.Linq; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Projectiles/Boss/AresDeathBeamTelegraph.cs b/Projectiles/Boss/AresDeathBeamTelegraph.cs index b04a64c038..d447922d4a 100644 --- a/Projectiles/Boss/AresDeathBeamTelegraph.cs +++ b/Projectiles/Boss/AresDeathBeamTelegraph.cs @@ -1,8 +1,8 @@ -using CalamityMod.Events; +using System.IO; +using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Projectiles/Boss/AresGaussNukeProjectile.cs b/Projectiles/Boss/AresGaussNukeProjectile.cs index f1237a42cb..89aa0ed04a 100644 --- a/Projectiles/Boss/AresGaussNukeProjectile.cs +++ b/Projectiles/Boss/AresGaussNukeProjectile.cs @@ -1,17 +1,17 @@ -using CalamityMod.Events; +using System; +using System.IO; +using CalamityMod.Events; +using CalamityMod.Items.Weapons.DraedonsArsenal; +using CalamityMod.NPCs.ExoMechs.Ares; using CalamityMod.Skies; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; using Terraria; +using Terraria.Audio; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using CalamityMod.Items.Weapons.DraedonsArsenal; -using CalamityMod.NPCs.ExoMechs.Ares; namespace CalamityMod.Projectiles.Boss { @@ -169,7 +169,7 @@ namespace CalamityMod.Projectiles.Boss public override void PostDraw(Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; int height = texture.Height / Main.projFrames[Projectile.type]; int drawStart = height * Projectile.frame; Vector2 origin = Projectile.Size / 2; diff --git a/Projectiles/Boss/AresGaussNukeProjectileBoom.cs b/Projectiles/Boss/AresGaussNukeProjectileBoom.cs index 73ab40b866..a8c411f3be 100644 --- a/Projectiles/Boss/AresGaussNukeProjectileBoom.cs +++ b/Projectiles/Boss/AresGaussNukeProjectileBoom.cs @@ -1,6 +1,6 @@ -using CalamityMod.Projectiles.BaseProjectiles; +using System; +using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -51,11 +51,11 @@ namespace CalamityMod.Projectiles.Boss public override bool CanHitPlayer(Player target) => CalamityUtils.CircularHitboxCollision(Projectile.Center, CurrentRadius * Projectile.scale * 0.4f, target.Hitbox) && Projectile.timeLeft > 6; public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - if (info.Damage <= 0) - return; + { + if (info.Damage <= 0) + return; - target.AddBuff(BuffID.OnFire, 480); - } + target.AddBuff(BuffID.OnFire, 480); + } } } diff --git a/Projectiles/Boss/AresGaussNukeProjectileSpark.cs b/Projectiles/Boss/AresGaussNukeProjectileSpark.cs index 450c90b41e..2cebb4d08e 100644 --- a/Projectiles/Boss/AresGaussNukeProjectileSpark.cs +++ b/Projectiles/Boss/AresGaussNukeProjectileSpark.cs @@ -1,6 +1,6 @@ -using Microsoft.Xna.Framework; -using System; +using System; using System.IO; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Projectiles/Boss/AresLaserBeamStart.cs b/Projectiles/Boss/AresLaserBeamStart.cs index 72fd77af59..79dae329f9 100644 --- a/Projectiles/Boss/AresLaserBeamStart.cs +++ b/Projectiles/Boss/AresLaserBeamStart.cs @@ -1,16 +1,16 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using System.IO; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; using CalamityMod.NPCs; using CalamityMod.NPCs.ExoMechs.Ares; -using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; +using ReLogic.Content; using Terraria; using Terraria.Enums; using Terraria.ID; using Terraria.ModLoader; -using ReLogic.Content; namespace CalamityMod.Projectiles.Boss { @@ -125,7 +125,7 @@ namespace CalamityMod.Projectiles.Boss Vector2 dustPos = Projectile.Center + Projectile.velocity * (Projectile.localAI[1] - 14f); for (int i = 0; i < 2; i++) { - float dustRot = Projectile.velocity.ToRotation() + ((Main.rand.Next(2) == 1) ? -1f : 1f) * MathHelper.PiOver2; + float dustRot = Projectile.velocity.ToRotation() + ((Main.rand.NextBool(2)) ? -1f : 1f) * MathHelper.PiOver2; float dustVelMult = (float)Main.rand.NextDouble() * 2f + 2f; Vector2 dustVel = new Vector2((float)Math.Cos(dustRot) * dustVelMult, (float)Math.Sin(dustRot) * dustVelMult); int dust = Dust.NewDust(dustPos, 0, 0, dustType, dustVel.X, dustVel.Y, 0, default, 1f); @@ -150,7 +150,7 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.velocity == Vector2.Zero) return false; - Texture2D beamStart = ModContent.Request(Texture).Value; + Texture2D beamStart = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Texture2D beamMiddle = ModContent.Request("CalamityMod/ExtraTextures/Lasers/AresLaserBeamMiddle", AssetRequestMode.ImmediateLoad).Value; Texture2D beamEnd = ModContent.Request("CalamityMod/ExtraTextures/Lasers/AresLaserBeamEnd", AssetRequestMode.ImmediateLoad).Value; diff --git a/Projectiles/Boss/AresPlasmaBolt.cs b/Projectiles/Boss/AresPlasmaBolt.cs index 49f78f0df4..d291c6718e 100644 --- a/Projectiles/Boss/AresPlasmaBolt.cs +++ b/Projectiles/Boss/AresPlasmaBolt.cs @@ -1,5 +1,5 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Projectiles/Boss/AresPlasmaFireball.cs b/Projectiles/Boss/AresPlasmaFireball.cs index 7f31201977..15676d5635 100644 --- a/Projectiles/Boss/AresPlasmaFireball.cs +++ b/Projectiles/Boss/AresPlasmaFireball.cs @@ -1,14 +1,14 @@ -using CalamityMod.Events; +using System; +using System.IO; +using CalamityMod.Events; using CalamityMod.NPCs; +using CalamityMod.Sounds; using CalamityMod.World; using Microsoft.Xna.Framework; -using System; -using System.IO; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using CalamityMod.Sounds; namespace CalamityMod.Projectiles.Boss { @@ -89,14 +89,14 @@ namespace CalamityMod.Projectiles.Boss dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); int randomDustType = Main.rand.NextBool() ? 107 : 110; - int plasmaDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 200, default, 1.7f); + int plasmaDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 200, default, 1.7f); Main.dust[plasmaDust].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; Main.dust[plasmaDust].noGravity = true; Dust dust = Main.dust[plasmaDust]; dust.velocity *= 3f; - plasmaDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 100, default, 0.8f); + plasmaDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 100, default, 0.8f); Main.dust[plasmaDust].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; dust = Main.dust[plasmaDust]; @@ -114,7 +114,7 @@ namespace CalamityMod.Projectiles.Boss dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); int randomDustType = Main.rand.NextBool() ? 107 : 110; - int plasmaDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 0, default, 2f); + int plasmaDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 0, default, 2f); Main.dust[plasmaDust2].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(MathHelper.Pi).RotatedBy(Projectile.velocity.ToRotation()) * Projectile.width / 3f; Main.dust[plasmaDust2].noGravity = true; diff --git a/Projectiles/Boss/AresTeslaOrb.cs b/Projectiles/Boss/AresTeslaOrb.cs index 96c7223a95..cec82cf781 100644 --- a/Projectiles/Boss/AresTeslaOrb.cs +++ b/Projectiles/Boss/AresTeslaOrb.cs @@ -1,12 +1,12 @@ -using CalamityMod.Events; +using System; +using System.Collections.Generic; +using System.IO; +using CalamityMod.Events; using CalamityMod.Graphics.Primitives; using CalamityMod.NPCs; using CalamityMod.NPCs.ExoMechs.Ares; using CalamityMod.World; using Microsoft.Xna.Framework; -using System; -using System.Collections.Generic; -using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -97,14 +97,14 @@ namespace CalamityMod.Projectiles.Boss int randomDustType = Main.rand.Next(2) == 0 ? 206 : 229; float scale = randomDustType == 206 ? 1.5f : 1f; - int teslaDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 200, default, 2.5f * scale); + int teslaDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 200, default, 2.5f * scale); Main.dust[teslaDust].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; Main.dust[teslaDust].noGravity = true; Dust dust = Main.dust[teslaDust]; dust.velocity *= 3f; - teslaDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 100, default, 1.5f * scale); + teslaDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 100, default, 1.5f * scale); Main.dust[teslaDust].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; dust = Main.dust[teslaDust]; @@ -123,7 +123,7 @@ namespace CalamityMod.Projectiles.Boss int randomDustType = Main.rand.Next(2) == 0 ? 206 : 229; float scale = randomDustType == 206 ? 1.5f : 1f; - int teslaDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 0, default, 3f * scale); + int teslaDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 0, default, 3f * scale); Main.dust[teslaDust2].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(MathHelper.Pi).RotatedBy(Projectile.velocity.ToRotation()) * Projectile.width / 3f; Main.dust[teslaDust2].noGravity = true; diff --git a/Projectiles/Boss/ArtemisChargeTelegraph.cs b/Projectiles/Boss/ArtemisChargeTelegraph.cs index 8c0191b771..5370ee45f7 100644 --- a/Projectiles/Boss/ArtemisChargeTelegraph.cs +++ b/Projectiles/Boss/ArtemisChargeTelegraph.cs @@ -1,6 +1,6 @@ -using CalamityMod.Graphics.Primitives; +using System.IO; +using CalamityMod.Graphics.Primitives; using Microsoft.Xna.Framework; -using System.IO; using Terraria; using Terraria.Graphics.Shaders; using Terraria.ID; diff --git a/Projectiles/Boss/ArtemisDeathrayTelegraph.cs b/Projectiles/Boss/ArtemisDeathrayTelegraph.cs index 12b99b4a2a..132f4c959f 100644 --- a/Projectiles/Boss/ArtemisDeathrayTelegraph.cs +++ b/Projectiles/Boss/ArtemisDeathrayTelegraph.cs @@ -1,6 +1,6 @@ -using Microsoft.Xna.Framework; +using System.IO; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Projectiles/Boss/ArtemisLaser.cs b/Projectiles/Boss/ArtemisLaser.cs index b7dfca37aa..8232a47fdc 100644 --- a/Projectiles/Boss/ArtemisLaser.cs +++ b/Projectiles/Boss/ArtemisLaser.cs @@ -1,10 +1,10 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using System.IO; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System.IO; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -133,7 +133,7 @@ namespace CalamityMod.Projectiles.Boss else { Projectile.spriteDirection = 1; - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X); + Projectile.rotation = Projectile.velocity.ToRotation(); } } else if (Destination == Vector2.Zero) diff --git a/Projectiles/Boss/ArtemisSpinLaserbeam.cs b/Projectiles/Boss/ArtemisSpinLaserbeam.cs index a778ba6bb6..45d346d659 100644 --- a/Projectiles/Boss/ArtemisSpinLaserbeam.cs +++ b/Projectiles/Boss/ArtemisSpinLaserbeam.cs @@ -1,13 +1,13 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using System.IO; +using System.Linq; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Graphics.Primitives; using CalamityMod.NPCs.ExoMechs.Artemis; using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; -using System; -using System.IO; -using System.Linq; using Terraria; using Terraria.Graphics.Shaders; using Terraria.ID; @@ -30,7 +30,7 @@ namespace CalamityMod.Projectiles.Boss public override float Lifetime => 600; public override Color LaserOverlayColor => new Color(250, 180, 100, 100); public override Color LightCastColor => Color.White; - public override Texture2D LaserBeginTexture => ModContent.Request(Texture).Value; + public override Texture2D LaserBeginTexture => Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; public override Texture2D LaserMiddleTexture => ModContent.Request("CalamityMod/ExtraTextures/Lasers/AresLaserBeamMiddle", AssetRequestMode.ImmediateLoad).Value; public override Texture2D LaserEndTexture => ModContent.Request("CalamityMod/ExtraTextures/Lasers/AresLaserBeamEnd", AssetRequestMode.ImmediateLoad).Value; public override string Texture => "CalamityMod/Projectiles/Boss/AresLaserBeamStart"; diff --git a/Projectiles/Boss/AstralFlame.cs b/Projectiles/Boss/AstralFlame.cs index b7fd4f0366..3738d2946f 100644 --- a/Projectiles/Boss/AstralFlame.cs +++ b/Projectiles/Boss/AstralFlame.cs @@ -1,13 +1,13 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; -using Microsoft.Xna.Framework; -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Audio; using CalamityMod.Events; using CalamityMod.World; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { @@ -62,7 +62,7 @@ namespace CalamityMod.Projectiles.Boss else { Projectile.spriteDirection = 1; - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X); + Projectile.rotation = Projectile.velocity.ToRotation(); } Lighting.AddLight(Projectile.Center, 0.3f, 0.5f, 0.1f); @@ -78,7 +78,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.ai[0] += 1f; if (Projectile.ai[0] > 15f) { - int astralDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 0.8f); + int astralDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 0.8f); Main.dust[astralDust].noGravity = true; Main.dust[astralDust].velocity *= 0f; } @@ -162,14 +162,14 @@ namespace CalamityMod.Projectiles.Boss Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int i = 0; i < 2; i++) { - Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 50, default, 1f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 50, default, 1f); } for (int j = 0; j < 20; j++) { - int deathAstralDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 0, default, 1.5f); + int deathAstralDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 0, default, 1.5f); Main.dust[deathAstralDust].noGravity = true; Main.dust[deathAstralDust].velocity *= 3f; - deathAstralDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 50, default, 1f); + deathAstralDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, 0f, 0f, 50, default, 1f); Main.dust[deathAstralDust].velocity *= 2f; Main.dust[deathAstralDust].noGravity = true; } diff --git a/Projectiles/Boss/AstralGodRay.cs b/Projectiles/Boss/AstralGodRay.cs index 37bd12f1a6..d84d7ad212 100644 --- a/Projectiles/Boss/AstralGodRay.cs +++ b/Projectiles/Boss/AstralGodRay.cs @@ -1,7 +1,7 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Projectiles/Boss/AstralLaser.cs b/Projectiles/Boss/AstralLaser.cs index c5b9ce5fc7..fbc21c0d28 100644 --- a/Projectiles/Boss/AstralLaser.cs +++ b/Projectiles/Boss/AstralLaser.cs @@ -1,6 +1,6 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -63,7 +63,7 @@ namespace CalamityMod.Projectiles.Boss else { Projectile.spriteDirection = 1; - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X); + Projectile.rotation = Projectile.velocity.ToRotation(); } Lighting.AddLight(Projectile.Center, 0.3f, 0.3f, 0f); diff --git a/Projectiles/Boss/AstralShot2.cs b/Projectiles/Boss/AstralShot2.cs index 552a696794..a07a287af0 100644 --- a/Projectiles/Boss/AstralShot2.cs +++ b/Projectiles/Boss/AstralShot2.cs @@ -1,8 +1,8 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Projectiles/Boss/Basketball.png b/Projectiles/Boss/Basketball.png new file mode 100644 index 0000000000..e090379e6f Binary files /dev/null and b/Projectiles/Boss/Basketball.png differ diff --git a/Projectiles/Boss/BigFlare.cs b/Projectiles/Boss/BigFlare.cs index 2b31191ca4..48ca50b2c9 100644 --- a/Projectiles/Boss/BigFlare.cs +++ b/Projectiles/Boss/BigFlare.cs @@ -1,11 +1,11 @@ -using CalamityMod.Events; +using System.IO; +using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; -using System.IO; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { @@ -68,7 +68,7 @@ namespace CalamityMod.Projectiles.Boss Vector2 dustRotate = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; dustRotate = dustRotate.RotatedBy((double)(i - (dustAmt / 2 - 1)) * 3.1415926535897931 / (double)(float)dustAmt, default) + Projectile.Center; Vector2 randomDustPos = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); - int flareDust = Dust.NewDust(dustRotate + randomDustPos, 0, 0, 244, randomDustPos.X * 2f, randomDustPos.Y * 2f, 100, default, 1.4f); + int flareDust = Dust.NewDust(dustRotate + randomDustPos, 0, 0, DustID.CopperCoin, randomDustPos.X * 2f, randomDustPos.Y * 2f, 100, default, 1.4f); Main.dust[flareDust].noGravity = true; Main.dust[flareDust].noLight = true; Main.dust[flareDust].velocity /= 4f; @@ -120,7 +120,7 @@ namespace CalamityMod.Projectiles.Boss Vector2 rotation = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; rotation = rotation.RotatedBy((double)((float)(j - (dustAmtKill / 2 - 1)) * 6.28318548f / (float)dustAmtKill), default) + Projectile.Center; Vector2 faceDirection = rotation - Projectile.Center; - int flareDeath = Dust.NewDust(rotation + faceDirection, 0, 0, 244, faceDirection.X * 2f, faceDirection.Y * 2f, 100, default, 1.4f); + int flareDeath = Dust.NewDust(rotation + faceDirection, 0, 0, DustID.CopperCoin, faceDirection.X * 2f, faceDirection.Y * 2f, 100, default, 1.4f); Main.dust[flareDeath].noGravity = true; Main.dust[flareDeath].noLight = true; Main.dust[flareDeath].velocity = faceDirection; diff --git a/Projectiles/Boss/BigFlare2.cs b/Projectiles/Boss/BigFlare2.cs index ef29b09baa..32cd12277f 100644 --- a/Projectiles/Boss/BigFlare2.cs +++ b/Projectiles/Boss/BigFlare2.cs @@ -1,11 +1,11 @@ -using CalamityMod.Events; +using System.IO; +using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; -using System.IO; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { @@ -68,7 +68,7 @@ namespace CalamityMod.Projectiles.Boss Vector2 dustRotation = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; dustRotation = dustRotation.RotatedBy((double)(i - (dustAmt / 2 - 1)) * 3.1415926535897931 / (double)(float)dustAmt, default) + Projectile.Center; Vector2 randomDustPos = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); - int flareDust = Dust.NewDust(dustRotation + randomDustPos, 0, 0, 244, randomDustPos.X * 2f, randomDustPos.Y * 2f, 100, default, 1.4f); + int flareDust = Dust.NewDust(dustRotation + randomDustPos, 0, 0, DustID.CopperCoin, randomDustPos.X * 2f, randomDustPos.Y * 2f, 100, default, 1.4f); Main.dust[flareDust].noGravity = true; Main.dust[flareDust].noLight = true; Main.dust[flareDust].velocity /= 4f; @@ -120,7 +120,7 @@ namespace CalamityMod.Projectiles.Boss Vector2 killDustRotate = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; killDustRotate = killDustRotate.RotatedBy((double)((float)(i - (killDustAmt / 2 - 1)) * 6.28318548f / (float)killDustAmt), default) + Projectile.Center; Vector2 killDustDirection = killDustRotate - Projectile.Center; - int killFlareDust = Dust.NewDust(killDustRotate + killDustDirection, 0, 0, 244, killDustDirection.X * 2f, killDustDirection.Y * 2f, 100, default, 1.4f); + int killFlareDust = Dust.NewDust(killDustRotate + killDustDirection, 0, 0, DustID.CopperCoin, killDustDirection.X * 2f, killDustDirection.Y * 2f, 100, default, 1.4f); Main.dust[killFlareDust].noGravity = true; Main.dust[killFlareDust].noLight = true; Main.dust[killFlareDust].velocity = killDustDirection; diff --git a/Projectiles/Boss/BirbAura.cs b/Projectiles/Boss/BirbAura.cs index 65f3c62477..0cf7e9e6ba 100644 --- a/Projectiles/Boss/BirbAura.cs +++ b/Projectiles/Boss/BirbAura.cs @@ -132,7 +132,7 @@ namespace CalamityMod.Projectiles.Boss { return false; } - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Texture2D texture2 = ModContent.Request("CalamityMod/ExtraTextures/Lasers/BirbAuraStart", AssetRequestMode.ImmediateLoad).Value; Texture2D texture3 = ModContent.Request("CalamityMod/ExtraTextures/Lasers/BirbAuraEnd", AssetRequestMode.ImmediateLoad).Value; float auraDrawLength = Projectile.localAI[1]; //length of laser diff --git a/Projectiles/Boss/BirbAuraFlare.cs b/Projectiles/Boss/BirbAuraFlare.cs index a865c28167..cb17ddd3fd 100644 --- a/Projectiles/Boss/BirbAuraFlare.cs +++ b/Projectiles/Boss/BirbAuraFlare.cs @@ -1,11 +1,11 @@ -using CalamityMod.NPCs.Bumblebirb; -using Microsoft.Xna.Framework; -using System; +using System; using System.IO; +using CalamityMod.NPCs.Bumblebirb; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { @@ -54,7 +54,7 @@ namespace CalamityMod.Projectiles.Boss Vector2 dustRotation = Vector2.Normalize(Projectile.velocity) * new Vector2(Projectile.width / 2f, Projectile.height) * Projectile.localAI[1]; dustRotation = dustRotation.RotatedBy((i - (dustAmt / 2 - 1)) * 3.1415926535897931 / (float)dustAmt) + Projectile.Center; Vector2 randomDustPos = ((float)(Main.rand.NextDouble() * Math.PI) - MathHelper.PiOver2).ToRotationVector2() * Main.rand.Next(3, 8); - int lightningDust = Dust.NewDust(dustRotation + randomDustPos, 0, 0, 60, randomDustPos.X * 2f, randomDustPos.Y * 2f, 100, default, 1f); + int lightningDust = Dust.NewDust(dustRotation + randomDustPos, 0, 0, DustID.RedTorch, randomDustPos.X * 2f, randomDustPos.Y * 2f, 100, default, 1f); Main.dust[lightningDust].scale = 1.4f; Main.dust[lightningDust].noGravity = true; Main.dust[lightningDust].noLight = true; @@ -85,7 +85,7 @@ namespace CalamityMod.Projectiles.Boss Vector2 vector6 = Vector2.Normalize(Projectile.velocity) * new Vector2(Projectile.width / 2f, Projectile.height) * 0.75f; vector6 = vector6.RotatedBy((i - (killDustAmt / 2 - 1)) * MathHelper.TwoPi / killDustAmt) + Projectile.Center; Vector2 vector7 = vector6 - Projectile.Center; - int killLightningDust = Dust.NewDust(vector6 + vector7, 0, 0, 60, vector7.X, vector7.Y, 100, default, 1.4f); + int killLightningDust = Dust.NewDust(vector6 + vector7, 0, 0, DustID.RedTorch, vector7.X, vector7.Y, 100, default, 1.4f); Main.dust[killLightningDust].noGravity = true; Main.dust[killLightningDust].noLight = true; Main.dust[killLightningDust].velocity = vector7; diff --git a/Projectiles/Boss/BloodGeyser.cs b/Projectiles/Boss/BloodGeyser.cs index 5d81a128e5..c6d458821e 100644 --- a/Projectiles/Boss/BloodGeyser.cs +++ b/Projectiles/Boss/BloodGeyser.cs @@ -1,6 +1,6 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -33,7 +33,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver2; - int bloody = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, DustID.Blood, 0f, 0f, 100, default, 0.5f); + int bloody = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Blood, 0f, 0f, 100, default, 0.5f); Main.dust[bloody].noGravity = true; Main.dust[bloody].velocity *= 0f; diff --git a/Projectiles/Boss/BrimstoneBall.cs b/Projectiles/Boss/BrimstoneBall.cs index 74ee3fd7f0..8009e83729 100644 --- a/Projectiles/Boss/BrimstoneBall.cs +++ b/Projectiles/Boss/BrimstoneBall.cs @@ -1,5 +1,5 @@ -using CalamityMod.Dusts; -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; diff --git a/Projectiles/Boss/BrimstoneBarrage.cs b/Projectiles/Boss/BrimstoneBarrage.cs index 87d5eba4d6..5c4f0f70eb 100644 --- a/Projectiles/Boss/BrimstoneBarrage.cs +++ b/Projectiles/Boss/BrimstoneBarrage.cs @@ -1,11 +1,13 @@ -using CalamityMod.Buffs.DamageOverTime; +using System.IO; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; using CalamityMod.Events; using CalamityMod.NPCs; using CalamityMod.NPCs.CalClone; using CalamityMod.NPCs.SupremeCalamitas; +using CalamityMod.Particles; using CalamityMod.World; using Microsoft.Xna.Framework; -using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -14,6 +16,7 @@ namespace CalamityMod.Projectiles.Boss public class BrimstoneBarrage : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Boss"; + public int time = 0; public override void SetStaticDefaults() { Main.projFrames[Projectile.type] = 4; @@ -24,7 +27,7 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { Projectile.width = 18; - Projectile.height = 18; + Projectile.height = 44; Projectile.hostile = true; Projectile.ignoreWater = true; Projectile.tileCollide = false; @@ -47,8 +50,23 @@ namespace CalamityMod.Projectiles.Boss { bool bossRush = BossRushEvent.BossRushActive; - if (Projectile.velocity.Length() < (Projectile.ai[1] == 0f ? (bossRush ? 17.5f : 14f) : (bossRush ? 12.5f : 10f))) + int target = Player.FindClosest(Projectile.Center, 1, 1); + + float targetDist; + if (target != -1 && !Main.player[target].dead && Main.player[target].active && Main.player[target] != null) + targetDist = Vector2.Distance(Main.player[target].Center, Projectile.Center); + else + targetDist = 1000; + + if (Projectile.velocity.Length() < Projectile.ai[2]) + { Projectile.velocity *= bossRush ? 1.0125f : 1.01f; + if (Projectile.velocity.Length() > Projectile.ai[2]) + { + Projectile.velocity.Normalize(); + Projectile.velocity *= Projectile.ai[2]; + } + } Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; @@ -79,6 +97,29 @@ namespace CalamityMod.Projectiles.Boss } } + // This only runs for SCal projectiles. + if (Projectile.ai[1] == 2f || (Projectile.ai[1] == 4f && time > 10)) + { + if (targetDist < 1400f) + { + SparkParticle orb = new SparkParticle(Projectile.Center - Projectile.velocity * 0.5f, -Projectile.velocity * Main.rand.NextFloat(0.1f, 0.6f), false, (int)MathHelper.Clamp(9 * Utils.GetLerpValue(630, 690, Projectile.timeLeft), 2, 9), 1.1f, (Main.rand.NextBool() ? Color.Red : Color.Lerp(Color.Red, Color.Magenta, 0.5f)) * Projectile.Opacity * 0.85f); + GeneralParticleHandler.SpawnParticle(orb); + } + } + // This only runs for SCal seekers and Sepulcher projectiles. + if (Projectile.ai[1] == 3f) + { + if (Projectile.timeLeft > 600) + Projectile.velocity *= 1.015f; + + Projectile.scale = 0.85f; + + Dust trailDust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(4, 4), 182); + trailDust.noGravity = true; + trailDust.velocity = (-Projectile.velocity * 0.5f) * Main.rand.NextFloat(0.1f, 0.9f); + trailDust.scale = Main.rand.NextFloat(0.2f, 0.6f); + } + if (Projectile.localAI[0] == 0f) { Projectile.localAI[0] = 1f; @@ -88,6 +129,7 @@ namespace CalamityMod.Projectiles.Boss } Lighting.AddLight(Projectile.Center, 0.75f * Projectile.Opacity, 0f, 0f); + time++; } public override bool CanHitPlayer(Player target) => Projectile.Opacity == 1f; @@ -98,7 +140,7 @@ namespace CalamityMod.Projectiles.Boss return; if (Projectile.ai[0] == 0f || Main.zenithWorld) - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 180); else target.AddBuff(ModContent.BuffType(), 90); } @@ -107,7 +149,7 @@ namespace CalamityMod.Projectiles.Boss { lightColor.R = (byte)(255 * Projectile.Opacity); - if (CalamityGlobalNPC.SCal != -1) + if (CalamityGlobalNPC.SCal != -1 && NPC.AnyNPCs(ModContent.NPCType()) == true) { if (Main.npc[CalamityGlobalNPC.SCal].active) { @@ -119,5 +161,6 @@ namespace CalamityMod.Projectiles.Boss CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 18 * Projectile.scale, targetHitbox); } } diff --git a/Projectiles/Boss/BrimstoneFire.cs b/Projectiles/Boss/BrimstoneFire.cs index e4f7699ef2..42b6e2b860 100644 --- a/Projectiles/Boss/BrimstoneFire.cs +++ b/Projectiles/Boss/BrimstoneFire.cs @@ -1,9 +1,9 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -59,7 +59,7 @@ namespace CalamityMod.Projectiles.Boss public override bool OnTileCollide(Vector2 oldVelocity) { Projectile.velocity = oldVelocity * 0.95f; - Projectile.position -= Projectile.velocity; + Projectile.position -= Projectile.velocity; Time++; Projectile.timeLeft--; return false; @@ -100,7 +100,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { - Texture2D fire = ModContent.Request(Texture).Value; + Texture2D fire = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Texture2D mist = ModContent.Request("CalamityMod/Particles/MediumMist").Value; // The conga line of colors to sift through diff --git a/Projectiles/Boss/BrimstoneHellblast.cs b/Projectiles/Boss/BrimstoneHellblast.cs index 14501f1535..c30a023c2f 100644 --- a/Projectiles/Boss/BrimstoneHellblast.cs +++ b/Projectiles/Boss/BrimstoneHellblast.cs @@ -1,12 +1,13 @@ using System; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; -using CalamityMod.NPCs.SupremeCalamitas; using CalamityMod.NPCs; +using CalamityMod.NPCs.SupremeCalamitas; using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; +using CalamityMod.Particles; using Terraria.ID; using Terraria.ModLoader; @@ -46,14 +47,36 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.frame > 3) Projectile.frame = 0; + int target = Player.FindClosest(Projectile.Center, 1, 1); + + float targetDist; + if (target != -1 && !Main.player[target].dead && Main.player[target].active && Main.player[target] != null) + targetDist = Vector2.Distance(Main.player[target].Center, Projectile.Center); + else + targetDist = 1000; + Lighting.AddLight(Projectile.Center, 0.9f * Projectile.Opacity, 0f, 0f); + if (targetDist < 1400f && Projectile.ai[1] == 2f) + { + // Spawn in a helix-style pattern + float sine = (float)Math.Sin(Projectile.timeLeft * 0.575f / MathHelper.Pi); + + Vector2 offset = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(MathHelper.PiOver2) * sine * 16f; + + SparkParticle orb = new(Projectile.Center + offset, -Projectile.velocity * 0.05f, false, 8, 0.8f, Main.rand.NextBool() ? Color.Red : Color.Lerp(Color.Red, Color.Magenta, 0.5f)); + GeneralParticleHandler.SpawnParticle(orb); + + SparkParticle orb2 = new(Projectile.Center - offset, -Projectile.velocity * 0.05f, false, 8, 0.8f, Main.rand.NextBool() ? Color.Red : Color.Lerp(Color.Red, Color.Magenta, 0.5f)); + GeneralParticleHandler.SpawnParticle(orb2); + } + if (Projectile.timeLeft < 51) Projectile.Opacity -= 0.02f; - if (Projectile.ai[1] == 0f) + if (Projectile.ai[2] == 0f) { - Projectile.ai[1] = 1f; + Projectile.ai[2] = 1f; SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); } @@ -76,7 +99,7 @@ namespace CalamityMod.Projectiles.Boss { lightColor.R = (byte)(255 * Projectile.Opacity); - if (CalamityGlobalNPC.SCal != -1) + if (CalamityGlobalNPC.SCal != -1 && NPC.AnyNPCs(ModContent.NPCType()) == true) { if (Main.npc[CalamityGlobalNPC.SCal].active) { @@ -97,7 +120,7 @@ namespace CalamityMod.Projectiles.Boss return; if (Projectile.ai[0] == 0f || Main.zenithWorld) - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 180); else target.AddBuff(ModContent.BuffType(), 90); } diff --git a/Projectiles/Boss/BrimstoneHellblast2.cs b/Projectiles/Boss/BrimstoneHellblast2.cs index b2dbbc557d..d34e761d03 100644 --- a/Projectiles/Boss/BrimstoneHellblast2.cs +++ b/Projectiles/Boss/BrimstoneHellblast2.cs @@ -1,11 +1,11 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Events; -using CalamityMod.NPCs.SupremeCalamitas; using CalamityMod.NPCs; +using CalamityMod.NPCs.SupremeCalamitas; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -75,12 +75,12 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { SpriteEffects spriteEffects = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; int frameHeight = texture.Height / Main.projFrames[Projectile.type]; int drawStart = frameHeight * Projectile.frame; lightColor.R = (byte)(255 * Projectile.Opacity); - if (CalamityGlobalNPC.SCal != -1) + if (CalamityGlobalNPC.SCal != -1 && NPC.AnyNPCs(ModContent.NPCType()) == true) { if (Main.npc[CalamityGlobalNPC.SCal].active) { @@ -101,7 +101,7 @@ namespace CalamityMod.Projectiles.Boss return; if (Projectile.ai[0] == 0f || Main.zenithWorld) - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 180); else target.AddBuff(ModContent.BuffType(), 90); } diff --git a/Projectiles/Boss/BrimstoneHellfireball.cs b/Projectiles/Boss/BrimstoneHellfireball.cs index 626c209abc..1977fb8854 100644 --- a/Projectiles/Boss/BrimstoneHellfireball.cs +++ b/Projectiles/Boss/BrimstoneHellfireball.cs @@ -2,9 +2,9 @@ using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { public class BrimstoneHellfireball : ModProjectile, ILocalizedModType @@ -67,7 +67,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.localAI[0] += 1f; } - int brimDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 170, default, 1.1f); + int brimDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 170, default, 1.1f); Main.dust[brimDust].noGravity = true; Main.dust[brimDust].velocity *= 0.5f; Main.dust[brimDust].velocity += Projectile.velocity * 0.1f; diff --git a/Projectiles/Boss/BrimstoneMonster.cs b/Projectiles/Boss/BrimstoneMonster.cs index c71343f440..7ea0d0e4e0 100644 --- a/Projectiles/Boss/BrimstoneMonster.cs +++ b/Projectiles/Boss/BrimstoneMonster.cs @@ -1,15 +1,21 @@ -using CalamityMod.Buffs.DamageOverTime; +using System.Collections.Generic; +using System.IO; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.CalPlayer; +using CalamityMod.Dusts; using CalamityMod.Events; using CalamityMod.NPCs; using CalamityMod.NPCs.SupremeCalamitas; +using CalamityMod.Particles; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System.Collections.Generic; -using System.IO; +using ReLogic.Content; +using ReLogic.Utilities; using Terraria; using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.Graphics.Effects; using Terraria.ID; using Terraria.ModLoader; @@ -18,11 +24,31 @@ namespace CalamityMod.Projectiles.Boss public class BrimstoneMonster : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Boss"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public static readonly SoundStyle SpawnSound = new("CalamityMod/Sounds/Custom/SCalSounds/BrimstoneMonsterSpawn"); public static readonly SoundStyle DroneSound = new("CalamityMod/Sounds/Custom/SCalSounds/BrimstoneMonsterDrone"); + public SlotId RumbleSlot; + public static Asset screamTex; + + internal static readonly float CircularHitboxRadius = 170f; + public static int MinimumDamagePerFrame = 4; + public static int MaximumDamagePerFrame = 16; + public static float AdrenalineLossPerFrame = 0.04f; + public static float SpeedToForceMaxDamage = 25f; private float speedAdd = 0f; private float speedLimit = 0f; + private int time = 0; + private int sitStill = 90; + + public override void SetStaticDefaults() + { + if (!Main.dedServ) + { + screamTex = ModContent.Request("CalamityMod/ExtraTextures/ScreamyFace", AssetRequestMode.AsyncLoad); + } + } public override void SetDefaults() { @@ -55,11 +81,49 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { + if (time == 0) + { + Projectile.scale = 0.1f; + for (int i = 0; i < 2; i++) + { + Particle bloom = new BloomParticle(Projectile.Center, Vector2.Zero, Color.Lerp(Color.Red, Color.Magenta, 0.3f), 1.45f, 0, 120, false); + GeneralParticleHandler.SpawnParticle(bloom); + } + Particle bloom2 = new BloomParticle(Projectile.Center, Vector2.Zero, Color.White, 1.35f, 0, 120, false); + GeneralParticleHandler.SpawnParticle(bloom2); + } + + time++; + + if (Projectile.scale < 1.9f && Projectile.timeLeft > 90) + { + if (Projectile.scale < 1.5f) + { + for (int i = 0; i < 10; i++) + { + Vector2 dustVel = new Vector2(30, 30).RotatedByRandom(100) * Main.rand.NextFloat(0.05f, 1.2f); + Dust spawnDust = Dust.NewDustPerfect(Projectile.Center * (Projectile.scale * 5), (int)CalamityDusts.Brimstone, dustVel); + spawnDust.noGravity = true; + spawnDust.scale = Main.rand.NextFloat(1.7f, 2.8f) - Projectile.scale * 1.5f; + } + for (int i = 0; i < 3; i++) + { + Vector2 sparkVel = new Vector2(20, 20).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 1.1f); + GlowOrbParticle orb = new GlowOrbParticle(Projectile.Center + sparkVel * 2 * (Projectile.scale * 5), sparkVel, false, 60, Main.rand.NextFloat(1.55f, 2.75f) - Projectile.scale * 1.5f, Color.Lerp(Color.Red, Color.Magenta, 0.5f), true, true); + GeneralParticleHandler.SpawnParticle(orb); + } + } + Projectile.scale += 0.01f; + } + + if (SoundEngine.TryGetActiveSound(RumbleSlot, out var RumbleSound) && RumbleSound.IsPlaying) + RumbleSound.Position = Projectile.Center; + if (!CalamityPlayer.areThereAnyDamnBosses) { - Projectile.active = false; + if (Projectile.timeLeft > 90) + Projectile.timeLeft = 90; Projectile.netUpdate = true; - return; } int choice = (int)Projectile.ai[1]; @@ -67,55 +131,81 @@ namespace CalamityMod.Projectiles.Boss { Projectile.soundDelay = 1125 - (choice * 225); SoundEngine.PlaySound(SpawnSound, Projectile.Center); + if (Projectile.ai[1] == 0f && Projectile.timeLeft >= 90) + RumbleSlot = Main.zenithWorld ? SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/SCalSounds/GFBDrone") with { IsLooped = true }, Projectile.Center, _ => new ProjectileAudioTracker(Projectile).IsActiveAndInGame()) : SoundEngine.PlaySound(DroneSound with { IsLooped = true }, Projectile.Center, _ => new ProjectileAudioTracker(Projectile).IsActiveAndInGame()); Projectile.localAI[0] += 1f; - switch (choice) - { - case 0: - speedLimit = 10f; - break; - case 1: - speedLimit = 20f; - break; - case 2: - speedLimit = 30f; - break; - case 3: - speedLimit = 40f; - break; - default: - break; - } + speedLimit = 23; } if (speedAdd < speedLimit) speedAdd += 0.04f; - if (Projectile.soundDelay <= 0 && (choice == 0 || choice == 2)) + float targetDist; + if (!Main.player[choice].dead && Main.player[choice].active && Main.player[choice] != null) + targetDist = Vector2.Distance(Main.player[choice].Center, Projectile.Center); + else + targetDist = 2000; + + if (Projectile.ai[1] == 0f) { - Projectile.soundDelay = 420; - SoundEngine.PlaySound(DroneSound, Projectile.Center); + if (targetDist <= 1400) + { + float targetPitchShift = Utils.GetLerpValue(1400, 700, targetDist); + if (SoundEngine.TryGetActiveSound(RumbleSlot, out var RumblePitch) && RumblePitch.IsPlaying) + { + RumblePitch.Pitch = MathHelper.Lerp(Main.zenithWorld ? -0.7f : 0f, Main.zenithWorld ? 0.2f : 0.7f, targetPitchShift); + RumblePitch.Volume = MathHelper.Lerp(0.3f, 0.8f, targetPitchShift); + } + } + + Projectile.soundDelay--; + if (SoundEngine.TryGetActiveSound(RumbleSlot, out var RumblePlaying) && RumblePlaying.IsPlaying) + { + Projectile.soundDelay = 1; + } + + if (Projectile.soundDelay <= 0 && Projectile.timeLeft >= 90) + RumbleSlot = Main.zenithWorld ? SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/SCalSounds/GFBDrone") with { IsLooped = true }, Projectile.Center, _ => new ProjectileAudioTracker(Projectile).IsActiveAndInGame()) : SoundEngine.PlaySound(DroneSound with { IsLooped = true }, Projectile.Center, _ => new ProjectileAudioTracker(Projectile).IsActiveAndInGame()); + + if (Projectile.timeLeft < 90) + { + RumblePlaying?.Stop(); + } + if (CalamityGlobalNPC.SCal == -1) + { + RumblePlaying?.Stop(); + } } + if (Projectile.timeLeft < 90) + { + Projectile.Opacity = MathHelper.Clamp(Projectile.timeLeft / 90f, 0f, 1f); + } + else + { + Projectile.Opacity = MathHelper.Clamp(1f - ((Projectile.timeLeft - 35910) / 90f), 0f, 1f); + } + + if (Projectile.scale >= 1.9f) + sitStill--; + if (sitStill > 0) + return; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; bool death = CalamityWorld.death || BossRushEvent.BossRushActive; Lighting.AddLight(Projectile.Center, 3f * Projectile.Opacity, 0f, 0f); - float inertia = (revenge ? 4.5f : 5f) + speedAdd; - float speed = (revenge ? 1.5f : 1.35f) + (speedAdd * 0.25f); + float inertia = (revenge ? 5f : 5.5f) + speedAdd; + float speed = (revenge ? 2.9f : 2.2f) + (speedAdd * 0.25f); float minDist = 160f; - if (NPC.AnyNPCs(ModContent.NPCType())) + if (NPC.AnyNPCs(ModContent.NPCType()) || NPC.AnyNPCs(ModContent.NPCType())) { inertia *= 1.5f; - speed *= 0.5f; + speed *= 0.8f; } - if (Projectile.timeLeft < 90) - Projectile.Opacity = MathHelper.Clamp(Projectile.timeLeft / 90f, 0f, 1f); - else - Projectile.Opacity = MathHelper.Clamp(1f - ((Projectile.timeLeft - 35910) / 90f), 0f, 1f); - int target = (int)Projectile.ai[0]; if (target >= 0 && Main.player[target].active && !Main.player[target].dead) { @@ -132,7 +222,10 @@ namespace CalamityMod.Projectiles.Boss } if (death) + { + speedLimit = 15; return; + } // Fly away from other brimstone monsters. float pushForce = 0.05f; @@ -162,37 +255,84 @@ namespace CalamityMod.Projectiles.Boss } } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 170f, targetHitbox); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, CircularHitboxRadius * Projectile.scale * Projectile.Opacity, targetHitbox); - public override bool PreDraw(ref Color lightColor) + // This function serves double duty. + // It both ensures that Brimstone Monsters cannot deal damage except at full opacity, + // and deals their unavoidable overlap damage in lieu of a standard projectile hit. + public override bool CanHitPlayer(Player player) { - Texture2D tex = ModContent.Request(Texture).Value; - lightColor.R = (byte)(255 * Projectile.Opacity); + // If the Brimstone Monster is not yet fully formed, do nothing. + if (Projectile.Opacity < 1f) + return false; - if (CalamityGlobalNPC.SCal != -1) + // If Journey God Mode is active, or any effects which simulate, provide or equivalent to it, do not harm the player. + // Likewise, if the player has immunity frames, do not harm them. + bool cannotBeHurt = player.HasIFrames() || player.creativeGodMode; + if (cannotBeHurt) + return true; + + // Applies Vulnerability Hex and/or the effects of Supreme Cirrus' HAGE faces. + OnHitPlayer_Internal(player); + + // Compute distance for direct health reduction from overlap. + float distSQ = Projectile.DistanceSQ(player.Center); + float radiusSQ = CircularHitboxRadius * CircularHitboxRadius * Projectile.scale * Projectile.scale; + float radiusRatio = distSQ / radiusSQ; + + // Check the player's speed. If they are moving fast enough, damage them more severely; this prevents trying to rush straight through the vortex. + float playerSpeed = player.velocity.LengthSquared(); + float speedRatio = playerSpeed / (SpeedToForceMaxDamage * SpeedToForceMaxDamage); + + // Take the higher of the two to determine the damage application ratio. + float damageApplicationRatio = MathHelper.Max(radiusRatio, speedRatio); + + int healthToDrain = (int)MathHelper.Lerp(MaximumDamagePerFrame, MinimumDamagePerFrame, damageApplicationRatio); + if (healthToDrain < MinimumDamagePerFrame) + healthToDrain = MinimumDamagePerFrame; + + player.statLife -= healthToDrain; + + // Play a sound and visual to make the fact youre taking damage more obvious + if (time % 6 == 0) { - if (Main.npc[CalamityGlobalNPC.SCal].active) - { - if (Main.npc[CalamityGlobalNPC.SCal].ModNPC().cirrus) - { - tex = ModContent.Request("CalamityMod/Projectiles/Boss/BrimstoneMonsterII").Value; - lightColor.B = (byte)(255 * Projectile.Opacity); - } - } + SoundStyle burn = new("CalamityMod/Sounds/Item/WeldingBurn"); + SoundEngine.PlaySound(burn with { Volume = 0.25f, Pitch = 0.4f }, player.Center); + } + GlowOrbParticle orb = new GlowOrbParticle(player.Center, new Vector2(6, 6).RotatedByRandom(100) * Main.rand.NextFloat(0.3f, 1.1f), false, 60, Main.rand.NextFloat(1.55f, 3.75f), Main.rand.NextBool() ? Color.Red : Color.Lerp(Color.Red, Color.Magenta, 0.5f), true, true); + GeneralParticleHandler.SpawnParticle(orb); + if (Main.rand.NextBool()) + { + GlowOrbParticle orb2 = new GlowOrbParticle(player.Center, new Vector2(6, 6).RotatedByRandom(100) * Main.rand.NextFloat(0.3f, 1.1f), false, 60, Main.rand.NextFloat(1.55f, 3.75f), Color.Black, false, true, false); + GeneralParticleHandler.SpawnParticle(orb2); } - Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); + // Drain Adrenaline extremely rapidly. 4% of current Adrenaline is lost per frame. + CalamityPlayer modPlayer = player.Calamity(); + if (modPlayer.AdrenalineEnabled) + modPlayer.adrenaline *= 1f - AdrenalineLossPerFrame; + + // If this direct health reduction brings the player's health below zero, claim the Brimstone Monster killed them. + string path = Main.zenithWorld ? "GFB" : ""; + path += Main.rand.Next(1, 4).ToString(); + if (Main.myPlayer == player.whoAmI && player.statLife <= 0) + player.KillMe(PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.WhisperingMaelstrom" + path).Format(player.name)), 1000, -1); + + // Still do not allow a standard hit, but the player should surely be feeling the pain soon... return false; } - public override bool CanHitPlayer(Player target) => Projectile.Opacity == 1f; - public override void OnHitPlayer(Player target, Player.HurtInfo info) { if (info.Damage <= 0 || Projectile.Opacity != 1f) return; - target.AddBuff(ModContent.BuffType(), 300, true); + OnHitPlayer_Internal(target); + } + + private static void OnHitPlayer_Internal(Player target) + { + target.AddBuff(ModContent.BuffType(), 360, true); // Remove all positive buffs from the player if they're hit by HAGE while Cirrus is alive. if (CalamityGlobalNPC.SCal != -1) @@ -215,9 +355,80 @@ namespace CalamityMod.Projectiles.Boss } } + public override void OnKill(int timeLeft) + { + if (SoundEngine.TryGetActiveSound(RumbleSlot, out var RumblePlaying) && RumblePlaying.IsPlaying) + { + RumblePlaying?.Stop(); + } + } + + public override bool PreDraw(ref Color lightColor) + { + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + lightColor.R = (byte)(255 * Projectile.Opacity); + Main.spriteBatch.End(); + Effect shieldEffect = Filters.Scene["CalamityMod:HellBall"].GetShader().Shader; + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, shieldEffect, Main.GameViewMatrix.TransformationMatrix); + + float noiseScale = 0.6f; + + // Define shader parameters + + shieldEffect.Parameters["time"].SetValue(Projectile.timeLeft / 60f * 0.24f); + shieldEffect.Parameters["blowUpPower"].SetValue(3.2f); + shieldEffect.Parameters["blowUpSize"].SetValue(0.4f); + shieldEffect.Parameters["noiseScale"].SetValue(noiseScale); + + float opacity = Projectile.Opacity; + shieldEffect.Parameters["shieldOpacity"].SetValue(opacity); + shieldEffect.Parameters["shieldEdgeBlendStrenght"].SetValue(4f); + + Color edgeColor = Color.Black * opacity; + Color shieldColor = Color.Lerp(Color.Red, Color.Magenta, 0.5f) * opacity; + + // Define shader parameters for ball color + shieldEffect.Parameters["shieldColor"].SetValue(shieldColor.ToVector3()); + shieldEffect.Parameters["shieldEdgeColor"].SetValue(edgeColor.ToVector3()); + + Vector2 pos = Projectile.Center - Main.screenPosition; + + float scale = 0.715f; + Main.spriteBatch.Draw(screamTex.Value, pos, null, Color.White, 0, screamTex.Size() * 0.5f, scale * Projectile.scale * Projectile.Opacity, 0, 0); + + //Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale * 0.3f, SpriteEffects.None, 0); + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + + bool isCirrus = CalamityGlobalNPC.SCal != -1 && Main.npc[CalamityGlobalNPC.SCal].active && Main.npc[CalamityGlobalNPC.SCal].ModNPC().cirrus; + if (isCirrus) + { + Texture2D hageTex = ModContent.Request("CalamityMod/Projectiles/Boss/BrimstoneMonsterII").Value; + lightColor.B = (byte)(255 * Projectile.Opacity); + Main.EntitySpriteDraw(hageTex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, hageTex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); + } + else + { + Texture2D vortexTexture = ModContent.Request("CalamityMod/ExtraTextures/SoulVortex").Value; + Texture2D centerTexture = ModContent.Request("CalamityMod/Particles/LargeBloom").Value; + for (int i = 0; i < 10; i++) + { + float angle = MathHelper.TwoPi * i / 3f + Main.GlobalTimeWrappedHourly * MathHelper.TwoPi; + Color outerColor = Color.Lerp(Color.Red, Color.Magenta, i * 0.15f); + Color drawColor = Color.Lerp(outerColor, Color.Black, i * 0.2f) * 0.5f; + drawColor.A = 0; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + + drawPosition += (angle + Main.GlobalTimeWrappedHourly * i / 16f).ToRotationVector2() * 6f; + Main.EntitySpriteDraw(vortexTexture, drawPosition, null, drawColor * Projectile.Opacity, -angle + MathHelper.PiOver2, vortexTexture.Size() * 0.5f, (Projectile.scale * (1 - i * 0.05f)) * Projectile.Opacity, SpriteEffects.None, 0); + } + Main.EntitySpriteDraw(centerTexture, Projectile.Center - Main.screenPosition, null, Color.Black * Projectile.Opacity, Projectile.rotation, centerTexture.Size() * 0.5f, (Projectile.scale * 0.9f) * Projectile.Opacity, SpriteEffects.None, 0); + } + return false; + } + public override void DrawBehind(int index, List behindNPCsAndTiles, List behindNPCs, List behindProjectiles, List overPlayers, List overWiresUI) { - behindProjectiles.Add(index); behindNPCs.Add(index); } } diff --git a/Projectiles/Boss/BrimstoneRay.cs b/Projectiles/Boss/BrimstoneRay.cs index 0ea9bcbaa3..4630d227b5 100644 --- a/Projectiles/Boss/BrimstoneRay.cs +++ b/Projectiles/Boss/BrimstoneRay.cs @@ -125,6 +125,8 @@ namespace CalamityMod.Projectiles.Boss int projectileAmt = (int)(Projectile.localAI[1] / distanceBetweenProjectiles); int type = ModContent.ProjectileType(); int damage = Projectile.GetProjectileDamage(ModContent.NPCType()); + float projectileVelocityToPass = 12f; + for (int i = 0; i < projectileAmt; i++) { int totalProjectiles = 2; @@ -132,7 +134,7 @@ namespace CalamityMod.Projectiles.Boss for (int j = 0; j < totalProjectiles; j++) { Vector2 projVelocity = Projectile.velocity.RotatedBy(radians * j + MathHelper.PiOver2); - int proj = Projectile.NewProjectile(Projectile.GetSource_FromThis(), fireFrom, projVelocity, type, damage, 0f, Main.myPlayer, death ? 2f : 1f, 0f); + int proj = Projectile.NewProjectile(Projectile.GetSource_FromThis(), fireFrom, projVelocity, type, damage, 0f, Main.myPlayer, death ? 2f : 1f, 0f, projectileVelocityToPass); Main.projectile[proj].tileCollide = true; if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) Main.projectile[proj].extraUpdates += 1; @@ -143,7 +145,7 @@ namespace CalamityMod.Projectiles.Boss for (int j = 0; j < 2; j++) { - float dustRotation = Projectile.velocity.ToRotation() + ((Main.rand.Next(2) == 1) ? -1f : 1f) * MathHelper.PiOver2; + float dustRotation = Projectile.velocity.ToRotation() + ((Main.rand.NextBool(2)) ? -1f : 1f) * MathHelper.PiOver2; float randomFloatOffset = (float)Main.rand.NextDouble() * 2f + 2f; Vector2 dustDirection = new Vector2((float)Math.Cos(dustRotation) * randomFloatOffset, (float)Math.Sin(dustRotation) * randomFloatOffset); int brimDust = Dust.NewDust(dustSpawnPos, 0, 0, (int)CalamityDusts.Brimstone, dustDirection.X, dustDirection.Y, 0, default, 1f); @@ -170,7 +172,7 @@ namespace CalamityMod.Projectiles.Boss { return false; } - Texture2D texture2D19 = ModContent.Request(Texture).Value; + Texture2D texture2D19 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Texture2D texture2D20 = ModContent.Request("CalamityMod/ExtraTextures/Lasers/BrimstoneRayMid", AssetRequestMode.ImmediateLoad).Value; Texture2D texture2D21 = ModContent.Request("CalamityMod/ExtraTextures/Lasers/BrimstoneRayEnd", AssetRequestMode.ImmediateLoad).Value; float rayDrawLength = Projectile.localAI[1]; //length of laser @@ -220,7 +222,7 @@ namespace CalamityMod.Projectiles.Boss { return true; } - float useless = 0f; + float useless = 0f; if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + Projectile.velocity * Projectile.localAI[1], 22f * Projectile.scale, ref useless)) { return true; diff --git a/Projectiles/Boss/BrimstoneTargetRay.cs b/Projectiles/Boss/BrimstoneTargetRay.cs index 7b0aa10e12..8d402eab10 100644 --- a/Projectiles/Boss/BrimstoneTargetRay.cs +++ b/Projectiles/Boss/BrimstoneTargetRay.cs @@ -117,7 +117,7 @@ namespace CalamityMod.Projectiles.Boss { return false; } - Texture2D texture2D19 = ModContent.Request(Texture).Value; + Texture2D texture2D19 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Texture2D texture2D20 = ModContent.Request("CalamityMod/ExtraTextures/Lasers/BrimstoneRayMid", AssetRequestMode.ImmediateLoad).Value; Texture2D texture2D21 = ModContent.Request("CalamityMod/ExtraTextures/Lasers/BrimstoneRayEnd", AssetRequestMode.ImmediateLoad).Value; float rayDrawLength = Projectile.localAI[1]; //length of laser diff --git a/Projectiles/Boss/BrimstoneWave.cs b/Projectiles/Boss/BrimstoneWave.cs index d9cd6952b1..abb32499e3 100644 --- a/Projectiles/Boss/BrimstoneWave.cs +++ b/Projectiles/Boss/BrimstoneWave.cs @@ -1,10 +1,10 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.NPCs.SupremeCalamitas; +using System; +using System.IO; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.NPCs; +using CalamityMod.NPCs.SupremeCalamitas; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -45,6 +45,11 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { + Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(3) ? 60 : 114); + dust.noGravity = true; + dust.velocity = Projectile.velocity * Main.rand.NextFloat(0.1f, 0.7f); + dust.scale = Main.rand.NextFloat(0.9f, 1.8f); + x++; Projectile.velocity.Y = (float)(5D * Math.Sin(x / 5D)); @@ -73,7 +78,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { SpriteEffects spriteEffects = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; int framing = texture.Height / Main.projFrames[Projectile.type]; int y6 = framing * Projectile.frame; lightColor.R = (byte)(255 * Projectile.Opacity); diff --git a/Projectiles/Boss/CirrusBlast.cs b/Projectiles/Boss/CirrusBlast.cs index a9c6ee7895..3f0496de0d 100644 --- a/Projectiles/Boss/CirrusBlast.cs +++ b/Projectiles/Boss/CirrusBlast.cs @@ -1,10 +1,10 @@ -using CalamityMod.Projectiles.BaseProjectiles; +using System; +using System.IO; +using System.Linq; +using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; -using System; -using System.IO; -using System.Linq; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -97,7 +97,7 @@ namespace CalamityMod.Projectiles.Boss } public override bool CanHitPlayer(Player target) => Projectile.scale >= 0.5f; - + public override bool PreDraw(ref Color lightColor) { // This should never happen, but just in case. diff --git a/Projectiles/Boss/CirrusBlaster.cs b/Projectiles/Boss/CirrusBlaster.cs index cefe1a51b7..ab60a0adc6 100644 --- a/Projectiles/Boss/CirrusBlaster.cs +++ b/Projectiles/Boss/CirrusBlaster.cs @@ -1,9 +1,9 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { @@ -38,7 +38,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.velocity = Vector2.Zero; Projectile.netUpdate = true; Projectile.rotation = (float)Math.Atan2(storedVelocity.Y, storedVelocity.X) + MathHelper.PiOver2; - + SoundEngine.PlaySound(SANSCharge, Projectile.Center); // Funny Gaster Blaster sounds } else if (Projectile.ai[0] >= 55f) diff --git a/Projectiles/Boss/CirrusPhotonRipperPrismTooth.cs b/Projectiles/Boss/CirrusPhotonRipperPrismTooth.cs index ab1abcbb1e..7465dfea8a 100644 --- a/Projectiles/Boss/CirrusPhotonRipperPrismTooth.cs +++ b/Projectiles/Boss/CirrusPhotonRipperPrismTooth.cs @@ -1,9 +1,9 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Graphics.Primitives; using CalamityMod.NPCs.SupremeCalamitas; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.GameContent.Achievements; using Terraria.Graphics.Shaders; diff --git a/Projectiles/Boss/CirrusPhotonRipperProjectile.cs b/Projectiles/Boss/CirrusPhotonRipperProjectile.cs index d1ebade1d9..8e5c509e28 100644 --- a/Projectiles/Boss/CirrusPhotonRipperProjectile.cs +++ b/Projectiles/Boss/CirrusPhotonRipperProjectile.cs @@ -1,11 +1,11 @@ -using Microsoft.Xna.Framework; +using System; +using CalamityMod.NPCs.SupremeCalamitas; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using CalamityMod.NPCs.SupremeCalamitas; namespace CalamityMod.Projectiles.Boss { @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Texture2D glowmaskTexture = ModContent.Request("CalamityMod/Projectiles/Melee/PhotonRipperGlowmask").Value; Rectangle glowmaskRectangle = glowmaskTexture.Frame(1, 6, 0, Projectile.frame); Vector2 origin = texture.Size() * 0.5f; @@ -225,7 +225,7 @@ namespace CalamityMod.Projectiles.Boss shootReach = distanceFromTarget + 32f; else shootReach = 72f; - } + } Projectile.NewProjectile(Projectile.GetSource_FromThis(), Cirrus.Center, Projectile.velocity, ModContent.ProjectileType(), (int)ToothDamage, 0f, Projectile.owner, shootReach, Projectile.whoAmI, Projectile.ai[2]); } diff --git a/Projectiles/Boss/CirrusVolatileVodkaBottle.cs b/Projectiles/Boss/CirrusVolatileVodkaBottle.cs index 31fea0d3f4..b4efe39513 100644 --- a/Projectiles/Boss/CirrusVolatileVodkaBottle.cs +++ b/Projectiles/Boss/CirrusVolatileVodkaBottle.cs @@ -1,14 +1,14 @@ -using CalamityMod.Projectiles.Magic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Audio; +using System; using CalamityMod.Buffs.Alcohol; using CalamityMod.Dusts; using CalamityMod.Events; -using System; +using CalamityMod.Projectiles.Magic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { @@ -41,7 +41,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } diff --git a/Projectiles/Boss/DarkEnergyBall.cs b/Projectiles/Boss/DarkEnergyBall.cs index 237932a27f..85a46e55e9 100644 --- a/Projectiles/Boss/DarkEnergyBall.cs +++ b/Projectiles/Boss/DarkEnergyBall.cs @@ -76,7 +76,7 @@ namespace CalamityMod.Projectiles.Boss public override void PostDraw(Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; int height = texture.Height / Main.projFrames[Projectile.type]; int drawStart = height * Projectile.frame; Vector2 origin = Projectile.Size / 2; @@ -105,7 +105,7 @@ namespace CalamityMod.Projectiles.Boss { for (int i = 0; i < 3; i++) { - int cosmiliteDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 1.2f); + int cosmiliteDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 1.2f); Main.dust[cosmiliteDust].velocity *= 3f; Main.dust[cosmiliteDust].noGravity = true; if (Main.rand.NextBool()) @@ -116,10 +116,10 @@ namespace CalamityMod.Projectiles.Boss } for (int j = 0; j < 5; j++) { - int cosmiliteDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 1.7f); + int cosmiliteDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 1.7f); Main.dust[cosmiliteDust2].noGravity = true; Main.dust[cosmiliteDust2].velocity *= 5f; - cosmiliteDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 1f); + cosmiliteDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 1f); Main.dust[cosmiliteDust2].noGravity = true; Main.dust[cosmiliteDust2].velocity *= 2f; } diff --git a/Projectiles/Boss/DarkEnergyBall2.cs b/Projectiles/Boss/DarkEnergyBall2.cs index 67acbf3fb0..8cf3a9e8b2 100644 --- a/Projectiles/Boss/DarkEnergyBall2.cs +++ b/Projectiles/Boss/DarkEnergyBall2.cs @@ -74,7 +74,7 @@ namespace CalamityMod.Projectiles.Boss public override void PostDraw(Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; int height = texture.Height / Main.projFrames[Projectile.type]; int drawStart = height * Projectile.frame; Vector2 origin = Projectile.Size / 2; @@ -103,7 +103,7 @@ namespace CalamityMod.Projectiles.Boss { for (int i = 0; i < 3; i++) { - int cosmiliteDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 1.2f); + int cosmiliteDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 1.2f); Main.dust[cosmiliteDust].velocity *= 3f; Main.dust[cosmiliteDust].noGravity = true; if (Main.rand.NextBool()) @@ -114,10 +114,10 @@ namespace CalamityMod.Projectiles.Boss } for (int j = 0; j < 5; j++) { - int cosmiliteDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 1.7f); + int cosmiliteDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 1.7f); Main.dust[cosmiliteDust2].noGravity = true; Main.dust[cosmiliteDust2].velocity *= 5f; - cosmiliteDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 1f); + cosmiliteDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 1f); Main.dust[cosmiliteDust2].noGravity = true; Main.dust[cosmiliteDust2].velocity *= 2f; } diff --git a/Projectiles/Boss/DarkOrb.cs b/Projectiles/Boss/DarkOrb.cs index 71e1f6d263..3fbd229136 100644 --- a/Projectiles/Boss/DarkOrb.cs +++ b/Projectiles/Boss/DarkOrb.cs @@ -1,7 +1,7 @@ -using CalamityMod.Buffs.DamageOverTime; -using Microsoft.Xna.Framework; -using System; +using System; using System.IO; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Projectiles/Boss/DesertScourgeDiveSplash.cs b/Projectiles/Boss/DesertScourgeDiveSplash.cs new file mode 100644 index 0000000000..39d9946a5f --- /dev/null +++ b/Projectiles/Boss/DesertScourgeDiveSplash.cs @@ -0,0 +1,50 @@ +using System; +using System.IO; +using CalamityMod.Dusts; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class DesertScourgeDiveSplash : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Boss"; + + public override void SetStaticDefaults() + { + Main.projFrames[Projectile.type] = 14; + } + + public override void SetDefaults() + { + Projectile.width = 84; + Projectile.height = 84; + Projectile.hostile = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + } + + public override void AI() + { + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) + { + Projectile.frame++; + Projectile.frameCounter = 0; + } + if (Projectile.frame >= Main.projFrames[Projectile.type]) + Projectile.Kill(); + } + + public override bool PreDraw(ref Color lightColor) + { + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor); + return false; + } + } +} diff --git a/Projectiles/Boss/DesertScourgeDiveSplash.png b/Projectiles/Boss/DesertScourgeDiveSplash.png new file mode 100644 index 0000000000..cbb230d694 Binary files /dev/null and b/Projectiles/Boss/DesertScourgeDiveSplash.png differ diff --git a/Projectiles/Boss/DesertScourgeSpit.cs b/Projectiles/Boss/DesertScourgeSpit.cs new file mode 100644 index 0000000000..66d6e6d8e8 --- /dev/null +++ b/Projectiles/Boss/DesertScourgeSpit.cs @@ -0,0 +1,111 @@ +using System; +using System.IO; +using CalamityMod.Dusts; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class DesertScourgeSpit : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Boss"; + + public override void SetStaticDefaults() + { + Main.projFrames[Projectile.type] = 4; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + } + + public override void SetDefaults() + { + Projectile.width = 16; + Projectile.height = 16; + if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + Projectile.scale = 2f; + Projectile.hostile = true; + Projectile.tileCollide = false; + Projectile.penetrate = 1; + Projectile.timeLeft = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 900 : 600; + Projectile.aiStyle = ProjAIStyleID.Arrow; + Projectile.alpha = 255; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(Projectile.localAI[0]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + Projectile.localAI[0] = reader.ReadSingle(); + } + + public override void AI() + { + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) + { + Projectile.frame++; + Projectile.frameCounter = 0; + } + if (Projectile.frame >= Main.projFrames[Projectile.type]) + Projectile.frame = 0; + + Projectile.tileCollide = Projectile.timeLeft < (Projectile.aiStyle == ProjAIStyleID.Arrow ? 540 : 300); + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 4f) + { + Projectile.alpha -= 50; + if (Projectile.alpha < 0) + Projectile.alpha = 0; + + int sandyDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.SulphurousSeaAcid, 0f, 0f, 100, default, 1f); + Main.dust[sandyDust].noGravity = true; + Main.dust[sandyDust].velocity *= 0f; + } + } + + public override void OnKill(int timeLeft) + { + SoundEngine.PlaySound(SoundID.Dig, Projectile.Center); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = (int)(32 * Projectile.scale); + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); + int dustAmt = 36; + for (int i = 0; i < dustAmt; i++) + { + Vector2 dustRotate = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; + dustRotate = dustRotate.RotatedBy((double)((float)(i - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + Projectile.Center; + Vector2 dustDirection = dustRotate - Projectile.Center; + int killSand = Dust.NewDust(dustRotate + dustDirection, 0, 0, (int)CalamityDusts.SulphurousSeaAcid, dustDirection.X, dustDirection.Y, 100, default, 1.2f); + Main.dust[killSand].noGravity = true; + Main.dust[killSand].noLight = true; + Main.dust[killSand].velocity = dustDirection * 0.5f; + } + } + + public override void OnHitPlayer(Player target, Player.HurtInfo info) + { + if (info.Damage <= 0) + return; + + target.velocity *= 0.5f; + } + + public override bool PreDraw(ref Color lightColor) + { + lightColor.R = (byte)(255 * Projectile.Opacity); + lightColor.G = (byte)(255 * Projectile.Opacity); + lightColor.B = (byte)(255 * Projectile.Opacity); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + return false; + } + } +} diff --git a/Projectiles/Boss/DesertScourgeSpit.png b/Projectiles/Boss/DesertScourgeSpit.png new file mode 100644 index 0000000000..04d3900e49 Binary files /dev/null and b/Projectiles/Boss/DesertScourgeSpit.png differ diff --git a/Projectiles/Boss/DestroyerCursedLaser.cs b/Projectiles/Boss/DestroyerCursedLaser.cs index f07b58cf4f..f9ffe4065f 100644 --- a/Projectiles/Boss/DestroyerCursedLaser.cs +++ b/Projectiles/Boss/DestroyerCursedLaser.cs @@ -1,9 +1,9 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { public class DestroyerCursedLaser : ModProjectile, ILocalizedModType diff --git a/Projectiles/Boss/DestroyerElectricLaser.cs b/Projectiles/Boss/DestroyerElectricLaser.cs index aa9a763367..ecf9ffdfbd 100644 --- a/Projectiles/Boss/DestroyerElectricLaser.cs +++ b/Projectiles/Boss/DestroyerElectricLaser.cs @@ -1,9 +1,9 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { public class DestroyerElectricLaser : ModProjectile, ILocalizedModType @@ -17,7 +17,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.hostile = true; Projectile.penetrate = 1; Projectile.alpha = 255; - Projectile.scale = 1.2f; + Projectile.scale = 1.1f; Projectile.timeLeft = 600; Projectile.extraUpdates = 2; } diff --git a/Projectiles/Boss/DeusMine.cs b/Projectiles/Boss/DeusMine.cs index fab0dbc5ea..83a4612665 100644 --- a/Projectiles/Boss/DeusMine.cs +++ b/Projectiles/Boss/DeusMine.cs @@ -1,18 +1,20 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using System.IO; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.NPCs.AstrumDeus; using Microsoft.Xna.Framework; -using System; -using System.IO; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { public class DeusMine : ModProjectile, ILocalizedModType { + public static readonly SoundStyle ExplodeSound = new("CalamityMod/Sounds/Custom/AstrumDeus/DeusMineExplode"); + public new string LocalizationCategory => "Projectiles.Boss"; private const int MaxTimeLeft = 600; private const int FadeTime = 85; @@ -96,14 +98,14 @@ namespace CalamityMod.Projectiles.Boss // Explode and split into accelerating lasers if (Projectile.ai[0] == 1f) { - SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); + SoundEngine.PlaySound(ExplodeSound, Projectile.Center); Projectile.position = Projectile.Center; Projectile.width = Projectile.height = 96; Projectile.position.X = Projectile.position.X - (Projectile.width / 2); Projectile.position.Y = Projectile.position.Y - (Projectile.height / 2); for (int i = 0; i < 5; i++) { - int purpleDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 1.2f); + int purpleDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, 0f, 0f, 100, default, 1.2f); Main.dust[purpleDust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -113,10 +115,10 @@ namespace CalamityMod.Projectiles.Boss } for (int j = 0; j < 10; j++) { - int astralDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 1.7f); + int astralDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 1.7f); Main.dust[astralDust].noGravity = true; Main.dust[astralDust].velocity *= 1.5f; - Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 1f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 1f); } // Spawn diagonal lasers diff --git a/Projectiles/Boss/DeusRitualDrama.cs b/Projectiles/Boss/DeusRitualDrama.cs index 5c4e6148e9..0ba41b6cb2 100644 --- a/Projectiles/Boss/DeusRitualDrama.cs +++ b/Projectiles/Boss/DeusRitualDrama.cs @@ -1,13 +1,13 @@ -using CalamityMod.NPCs.AstrumDeus; +using System; +using CalamityMod.NPCs.AstrumDeus; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; using Terraria.DataStructures; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { @@ -118,7 +118,7 @@ namespace CalamityMod.Projectiles.Boss public void DrawStars(SpriteBatch spriteBatch, Vector2 offset) { - Texture2D starTexture = ModContent.Request(Texture).Value; + Texture2D starTexture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; for (int i = 0; i < 6; i++) { float angle = MathHelper.TwoPi * i / 6f + Time / 15f; diff --git a/Projectiles/Boss/DoGBeam.cs b/Projectiles/Boss/DoGBeam.cs index 7b87515033..109c0b94bf 100644 --- a/Projectiles/Boss/DoGBeam.cs +++ b/Projectiles/Boss/DoGBeam.cs @@ -1,6 +1,6 @@ -using CalamityMod.World; +using System; +using CalamityMod.World; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ModLoader; @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Boss Lighting.AddLight(Projectile.Center, 0f, 0.2f, 0.3f); - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + MathHelper.PiOver2; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; int playerTracker = Player.FindClosest(Projectile.Center, 1, 1); Projectile.ai[1] += 1f; diff --git a/Projectiles/Boss/DoGBeamPortal.cs b/Projectiles/Boss/DoGBeamPortal.cs index f505c744d5..8b54b531b6 100644 --- a/Projectiles/Boss/DoGBeamPortal.cs +++ b/Projectiles/Boss/DoGBeamPortal.cs @@ -1,14 +1,14 @@ -using CalamityMod.Dusts; +using System; +using System.IO; +using CalamityMod.Dusts; using CalamityMod.Events; using CalamityMod.NPCs; using CalamityMod.World; using Microsoft.Xna.Framework; -using System; -using System.IO; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { @@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Boss for (int i = 0; i < 15; i++) { - int ectoDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.Ectoplasm, 0f, 0f, 100, default, 1.2f); + int ectoDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.Ectoplasm, 0f, 0f, 100, default, 1.2f); Main.dust[ectoDust].velocity *= 3f; Main.dust[ectoDust].noGravity = true; if (Main.rand.NextBool()) @@ -71,10 +71,10 @@ namespace CalamityMod.Projectiles.Boss } for (int j = 0; j < 30; j++) { - int ectoDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.Ectoplasm, 0f, 0f, 100, default, 1.7f); + int ectoDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.Ectoplasm, 0f, 0f, 100, default, 1.7f); Main.dust[ectoDust2].noGravity = true; Main.dust[ectoDust2].velocity *= 5f; - ectoDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.Ectoplasm, 0f, 0f, 100, default, 1f); + ectoDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.Ectoplasm, 0f, 0f, 100, default, 1f); Main.dust[ectoDust2].noGravity = true; Main.dust[ectoDust2].velocity *= 2f; } diff --git a/Projectiles/Boss/DoGDeath.cs b/Projectiles/Boss/DoGDeath.cs index 8f5f2db940..38f7349271 100644 --- a/Projectiles/Boss/DoGDeath.cs +++ b/Projectiles/Boss/DoGDeath.cs @@ -1,9 +1,9 @@ -using CalamityMod.Buffs.DamageOverTime; +using System.IO; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Projectiles/Boss/DoGDeathBoom.cs b/Projectiles/Boss/DoGDeathBoom.cs index cac9d45382..8ffe85d908 100644 --- a/Projectiles/Boss/DoGDeathBoom.cs +++ b/Projectiles/Boss/DoGDeathBoom.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Projectiles.Boss } public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - public override void SetStaticDefaults() + public override void SetStaticDefaults() { ProjectileID.Sets.DrawScreenCheckFluff[Projectile.type] = 10000; } diff --git a/Projectiles/Boss/DoGFire.cs b/Projectiles/Boss/DoGFire.cs index 3437032d2d..cf979d61ab 100644 --- a/Projectiles/Boss/DoGFire.cs +++ b/Projectiles/Boss/DoGFire.cs @@ -1,10 +1,10 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { public class DoGFire : ModProjectile, ILocalizedModType @@ -48,7 +48,7 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.frame > 5) Projectile.frame = 0; - int dust = Dust.NewDust(new Vector2(Projectile.position.X + Projectile.velocity.X, Projectile.position.Y + Projectile.velocity.Y), Projectile.width, Projectile.height, 173, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 0.8f); + int dust = Dust.NewDust(new Vector2(Projectile.position.X + Projectile.velocity.X, Projectile.position.Y + Projectile.velocity.Y), Projectile.width, Projectile.height, DustID.ShadowbeamStaff, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 0.8f); Main.dust[dust].noGravity = true; Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver2; @@ -85,7 +85,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.position.Y = Projectile.position.Y - Projectile.height / 2; for (int i = 0; i < 5; i++) { - int godSlay = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 2f); + int godSlay = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, 0f, 0f, 100, default, 2f); Main.dust[godSlay].velocity *= 3f; if (Main.rand.NextBool()) { @@ -95,10 +95,10 @@ namespace CalamityMod.Projectiles.Boss } for (int j = 0; j < 10; j++) { - int godSlay2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 3f); + int godSlay2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, 0f, 0f, 100, default, 3f); Main.dust[godSlay2].noGravity = true; Main.dust[godSlay2].velocity *= 5f; - godSlay2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 2f); + godSlay2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, 0f, 0f, 100, default, 2f); Main.dust[godSlay2].velocity *= 2f; } for (int k = 0; k < 200; k++) @@ -111,7 +111,7 @@ namespace CalamityMod.Projectiles.Boss if (k < 50) dustScale = 3f; - int scalingDust = Dust.NewDust(Projectile.Center, 6, 6, 173, 0f, 0f, 100, default, 1f); + int scalingDust = Dust.NewDust(Projectile.Center, 6, 6, DustID.ShadowbeamStaff, 0f, 0f, 100, default, 1f); float scalingDustVelX = Main.dust[scalingDust].velocity.X; float scalingDustVelY = Main.dust[scalingDust].velocity.Y; diff --git a/Projectiles/Boss/DoGP1EndPortal.cs b/Projectiles/Boss/DoGP1EndPortal.cs index 4d7fda49f0..0a12f1f6e9 100644 --- a/Projectiles/Boss/DoGP1EndPortal.cs +++ b/Projectiles/Boss/DoGP1EndPortal.cs @@ -1,7 +1,7 @@ -using CalamityMod.NPCs; +using System.Collections.Generic; +using CalamityMod.NPCs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System.Collections.Generic; using Terraria; using Terraria.Graphics.Shaders; using Terraria.ID; diff --git a/Projectiles/Boss/DoGTeleportRift.cs b/Projectiles/Boss/DoGTeleportRift.cs index 308023085d..a57fd76e88 100644 --- a/Projectiles/Boss/DoGTeleportRift.cs +++ b/Projectiles/Boss/DoGTeleportRift.cs @@ -1,8 +1,9 @@ -using CalamityMod.Dusts; +using System; +using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss @@ -40,7 +41,7 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.Opacity == 1f && Main.rand.NextBool(15)) { - Dust dust = Main.dust[Dust.NewDust(Projectile.Top, 0, 0, 267, 0f, 0f, 100, new Color(150, 100, 255, 255), 1f)]; + Dust dust = Main.dust[Dust.NewDust(Projectile.Top, 0, 0, DustID.RainbowMk2, 0f, 0f, 100, new Color(150, 100, 255, 255), 1f)]; dust.velocity.X = 0f; dust.noGravity = true; dust.fadeIn = 1f; @@ -53,7 +54,7 @@ namespace CalamityMod.Projectiles.Boss { float lerpMult = Utils.GetLerpValue(15f, 30f, Projectile.timeLeft, clamped: true) * Utils.GetLerpValue(240f, 200f, Projectile.timeLeft, clamped: true) * (1f + 0.2f * (float)Math.Cos(Main.GlobalTimeWrappedHourly % 30f / 0.5f * (MathHelper.Pi * 2f) * 3f)) * 0.8f; - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Vector2 drawPos = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); Color baseColor = new Color(150, 100, 255, 255) * Projectile.Opacity; baseColor *= 0.5f; diff --git a/Projectiles/Boss/DraedonSummonLaser.cs b/Projectiles/Boss/DraedonSummonLaser.cs index aa3971225f..173b3f3adf 100644 --- a/Projectiles/Boss/DraedonSummonLaser.cs +++ b/Projectiles/Boss/DraedonSummonLaser.cs @@ -1,13 +1,13 @@ -using CalamityMod.World; +using System.Collections.Generic; +using CalamityMod.Graphics.Primitives; +using CalamityMod.Items.Weapons.DraedonsArsenal; +using CalamityMod.World; using Microsoft.Xna.Framework; -using System.Collections.Generic; using Terraria; +using Terraria.Audio; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using CalamityMod.Items.Weapons.DraedonsArsenal; -using CalamityMod.Graphics.Primitives; namespace CalamityMod.Projectiles.Boss { diff --git a/Projectiles/Boss/DyingSun.cs b/Projectiles/Boss/DyingSun.cs index 9696f6a6a6..bf24ecdc3e 100644 --- a/Projectiles/Boss/DyingSun.cs +++ b/Projectiles/Boss/DyingSun.cs @@ -45,7 +45,7 @@ namespace CalamityMod.Projectiles.Boss public Color SunColorFunction(float completionRatio) { - Color sunColor = Main.zenithWorld ? (new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB) * 0.8f) : (Main.dayTime ? Color.Yellow : Color.Cyan); + Color sunColor = Main.zenithWorld ? (new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB) * 0.8f) : (Main.IsItDay() ? Color.Yellow : Color.Cyan); return Color.Lerp(sunColor, Color.White, (float)Math.Sin(MathHelper.Pi * completionRatio) * 0.5f + 0.3f) * Projectile.Opacity; } diff --git a/Projectiles/Boss/EssenceDust.cs b/Projectiles/Boss/EssenceDust.cs index adac751278..b23f856311 100644 --- a/Projectiles/Boss/EssenceDust.cs +++ b/Projectiles/Boss/EssenceDust.cs @@ -1,8 +1,8 @@ using CalamityMod.Buffs.DamageOverTime; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { public class EssenceDust : ModProjectile, ILocalizedModType @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Boss Lighting.AddLight(Projectile.Center, 0.45f, 0f, 0.55f); for (int i = 0; i < 5; i++) { - int essenceDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 0.5f); + int essenceDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, 0f, 0f, 100, default, 0.5f); Main.dust[essenceDust].noGravity = true; Main.dust[essenceDust].velocity *= 0f; } @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int i = 0; i < 10; i++) { - int godSlay = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 1f); + int godSlay = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, 0f, 0f, 100, default, 1f); Main.dust[godSlay].velocity *= 3f; if (Main.rand.NextBool()) { @@ -52,10 +52,10 @@ namespace CalamityMod.Projectiles.Boss } for (int j = 0; j < 15; j++) { - int godSlay2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 2f); + int godSlay2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, 0f, 0f, 100, default, 2f); Main.dust[godSlay2].noGravity = true; Main.dust[godSlay2].velocity *= 5f; - godSlay2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 1f); + godSlay2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, 0f, 0f, 100, default, 1f); Main.dust[godSlay2].velocity *= 2f; } Projectile.Damage(); diff --git a/Projectiles/Boss/Flare.cs b/Projectiles/Boss/Flare.cs index ae7e75876f..c187276e6b 100644 --- a/Projectiles/Boss/Flare.cs +++ b/Projectiles/Boss/Flare.cs @@ -1,12 +1,12 @@ -using CalamityMod.Events; +using System; +using System.IO; +using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; -using System; -using System.IO; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { @@ -101,7 +101,7 @@ namespace CalamityMod.Projectiles.Boss Vector2 dustRotate = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; dustRotate = dustRotate.RotatedBy((double)((float)(i - (dustAmt / 2 - 1)) * 6.28318548f / (float)dustAmt), default) + Projectile.Center; Vector2 dustDirection = dustRotate - Projectile.Center; - int flareDust = Dust.NewDust(dustRotate + dustDirection, 0, 0, 244, dustDirection.X * 2f, dustDirection.Y * 2f, 100, default, 1.4f); + int flareDust = Dust.NewDust(dustRotate + dustDirection, 0, 0, DustID.CopperCoin, dustDirection.X * 2f, dustDirection.Y * 2f, 100, default, 1.4f); Main.dust[flareDust].noGravity = true; Main.dust[flareDust].noLight = true; Main.dust[flareDust].velocity = dustDirection; diff --git a/Projectiles/Boss/FlareBomb.cs b/Projectiles/Boss/FlareBomb.cs index 78ea47fe01..9039baeaf1 100644 --- a/Projectiles/Boss/FlareBomb.cs +++ b/Projectiles/Boss/FlareBomb.cs @@ -4,9 +4,9 @@ using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { public class FlareBomb : ModProjectile, ILocalizedModType @@ -107,7 +107,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; int framing = texture.Height / Main.projFrames[Projectile.type]; int y6 = framing * Projectile.frame; Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Rectangle(0, y6, texture.Width, framing), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, framing / 2f), Projectile.scale, SpriteEffects.None, 0); @@ -120,7 +120,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.ExpandHitboxBy(48); for (int d = 0; d < 2; d++) { - int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 1f); + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 100, default, 1f); Main.dust[idx].velocity *= 3f; if (Main.rand.NextBool()) { @@ -130,10 +130,10 @@ namespace CalamityMod.Projectiles.Boss } for (int d = 0; d < 4; d++) { - int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 100, default, 2f); Main.dust[idx].noGravity = true; Main.dust[idx].velocity *= 5f; - idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 1f); + idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 100, default, 1f); Main.dust[idx].velocity *= 2f; } diff --git a/Projectiles/Boss/FlareDust.cs b/Projectiles/Boss/FlareDust.cs index 8016bf2334..82112ea89f 100644 --- a/Projectiles/Boss/FlareDust.cs +++ b/Projectiles/Boss/FlareDust.cs @@ -1,12 +1,12 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using System.IO; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { public class FlareDust : ModProjectile, ILocalizedModType @@ -112,7 +112,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; int framing = texture.Height / Main.projFrames[Projectile.type]; int y6 = framing * Projectile.frame; Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture.Width / 2f, (float)framing / 2f), Projectile.scale, SpriteEffects.None, 0); @@ -125,7 +125,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.ExpandHitboxBy(48); for (int d = 0; d < 2; d++) { - int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 1f); + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 100, default, 1f); Main.dust[idx].velocity *= 3f; if (Main.rand.NextBool()) { @@ -135,10 +135,10 @@ namespace CalamityMod.Projectiles.Boss } for (int d = 0; d < 4; d++) { - int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 100, default, 2f); Main.dust[idx].noGravity = true; Main.dust[idx].velocity *= 5f; - idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 1f); + idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 100, default, 1f); Main.dust[idx].velocity *= 2f; } diff --git a/Projectiles/Boss/FlareDust2.cs b/Projectiles/Boss/FlareDust2.cs index 85c84343bb..afb50d3182 100644 --- a/Projectiles/Boss/FlareDust2.cs +++ b/Projectiles/Boss/FlareDust2.cs @@ -2,9 +2,9 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { public class FlareDust2 : ModProjectile, ILocalizedModType @@ -52,7 +52,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; int framing = texture.Height / Main.projFrames[Projectile.type]; int y6 = framing * Projectile.frame; Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture.Width / 2f, (float)framing / 2f), Projectile.scale, SpriteEffects.None, 0); @@ -65,7 +65,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.ExpandHitboxBy(48); for (int d = 0; d < 2; d++) { - int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 1f); + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 100, default, 1f); Main.dust[idx].velocity *= 3f; if (Main.rand.NextBool()) { @@ -75,10 +75,10 @@ namespace CalamityMod.Projectiles.Boss } for (int d = 0; d < 4; d++) { - int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 100, default, 2f); Main.dust[idx].noGravity = true; Main.dust[idx].velocity *= 5f; - idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 1f); + idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 100, default, 1f); Main.dust[idx].velocity *= 2f; } diff --git a/Projectiles/Boss/Flarenado.cs b/Projectiles/Boss/Flarenado.cs index 66c0b66ff5..f3e4b4c37a 100644 --- a/Projectiles/Boss/Flarenado.cs +++ b/Projectiles/Boss/Flarenado.cs @@ -116,7 +116,7 @@ namespace CalamityMod.Projectiles.Boss bool breakapart = Main.zenithWorld && Projectile.localAI[1] >= breakThreshold; if (Projectile.ai[0] <= 0f && !breakapart) { - float swaySize = 0.104719758f; + float swaySize = MathHelper.Pi / 30f; float smolWidth = (float)Projectile.width / 5f; smolWidth *= 2f; float projXChange = (float)(Math.Cos((double)(swaySize * -(double)Projectile.ai[0])) - 0.5) * smolWidth; @@ -146,7 +146,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; int framing = texture.Height / Main.projFrames[Projectile.type]; int y6 = framing * Projectile.frame; Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture.Width / 2f, (float)framing / 2f), Projectile.scale, SpriteEffects.None, 0); diff --git a/Projectiles/Boss/FrostMist.cs b/Projectiles/Boss/FrostMist.cs index f1836f7a07..8cddc3dd3d 100644 --- a/Projectiles/Boss/FrostMist.cs +++ b/Projectiles/Boss/FrostMist.cs @@ -1,6 +1,6 @@ -using Microsoft.Xna.Framework; -using System; +using System; using System.IO; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -57,7 +57,7 @@ namespace CalamityMod.Projectiles.Boss { for (int i = 0; i < 5; i++) { - int mistDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 187, 0f, 0f, 100, default, 2f); + int mistDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Flare_Blue, 0f, 0f, 100, default, 2f); Main.dust[mistDust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -77,7 +77,7 @@ namespace CalamityMod.Projectiles.Boss Vector2 dustRotation = Vector2.UnitX * -Projectile.width / 2f; dustRotation += -Vector2.UnitY.RotatedBy(l * MathHelper.Pi / 6f) * new Vector2(8f, 16f); dustRotation = dustRotation.RotatedBy(Projectile.rotation - MathHelper.PiOver2); - int extraMistDust = Dust.NewDust(Projectile.Center, 0, 0, 187, 0f, 0f, 160, default, 1f); + int extraMistDust = Dust.NewDust(Projectile.Center, 0, 0, DustID.Flare_Blue, 0f, 0f, 160, default, 1f); Main.dust[extraMistDust].scale = 1.1f; Main.dust[extraMistDust].noGravity = true; Main.dust[extraMistDust].position = Projectile.Center + dustRotation; diff --git a/Projectiles/Boss/GreatSandBlast.cs b/Projectiles/Boss/GreatSandBlast.cs index 7ffd48a1df..9a6e845e2d 100644 --- a/Projectiles/Boss/GreatSandBlast.cs +++ b/Projectiles/Boss/GreatSandBlast.cs @@ -1,11 +1,11 @@ -using Microsoft.Xna.Framework; -using System; +using System; using System.IO; +using CalamityMod.World; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using CalamityMod.World; namespace CalamityMod.Projectiles.Boss { @@ -45,7 +45,7 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { Projectile.tileCollide = Projectile.timeLeft < 540; - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; Projectile.localAI[0] += 1f; if (Projectile.localAI[0] > 4f) { @@ -54,7 +54,7 @@ namespace CalamityMod.Projectiles.Boss { Projectile.alpha = 0; } - int sandyDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 85, 0f, 0f, 100, default, 1f); + int sandyDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.UnusedBrown, 0f, 0f, 100, default, 1f); Main.dust[sandyDust].noGravity = true; Main.dust[sandyDust].velocity *= 0f; } @@ -73,7 +73,7 @@ namespace CalamityMod.Projectiles.Boss Vector2 dustRotate = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; dustRotate = dustRotate.RotatedBy((double)((float)(i - (dustAmt / 2 - 1)) * 6.28318548f / (float)dustAmt), default) + Projectile.Center; Vector2 dustDirection = dustRotate - Projectile.Center; - int killSand = Dust.NewDust(dustRotate + dustDirection, 0, 0, 85, dustDirection.X * 1.5f, dustDirection.Y * 1.5f, 100, default, 1.2f); + int killSand = Dust.NewDust(dustRotate + dustDirection, 0, 0, DustID.UnusedBrown, dustDirection.X * 1.5f, dustDirection.Y * 1.5f, 100, default, 1.2f); Main.dust[killSand].noGravity = true; Main.dust[killSand].noLight = true; Main.dust[killSand].velocity = dustDirection; diff --git a/Projectiles/Boss/HealOrbProv.cs b/Projectiles/Boss/HealOrbProv.cs index 511fcafcca..90da5ae250 100644 --- a/Projectiles/Boss/HealOrbProv.cs +++ b/Projectiles/Boss/HealOrbProv.cs @@ -1,9 +1,9 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { int playerTracker = (int)Projectile.ai[0]; - Vector2 projDirection = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); + Vector2 projDirection = Projectile.Center; float playerDistX = Main.player[playerTracker].Center.X - projDirection.X; float playerDistY = Main.player[playerTracker].Center.Y - projDirection.Y; float playerDistance = (float)Math.Sqrt((double)(playerDistX * playerDistX + playerDistY * playerDistY)); @@ -59,7 +59,7 @@ namespace CalamityMod.Projectiles.Boss { float shortXVel = Projectile.velocity.X * 0.2f * (float)i; float shortYVel = -(Projectile.velocity.Y * 0.2f) * (float)i; - int holyFire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 127, 0f, 0f, 100, default, 1f); + int holyFire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Flare, 0f, 0f, 100, default, 1f); Main.dust[holyFire].noGravity = true; Main.dust[holyFire].velocity *= 0f; Dust expr_154F9_cp_0 = Main.dust[holyFire]; diff --git a/Projectiles/Boss/HellfireExplosion.cs b/Projectiles/Boss/HellfireExplosion.cs index 54bc90aae8..c4a5810fd5 100644 --- a/Projectiles/Boss/HellfireExplosion.cs +++ b/Projectiles/Boss/HellfireExplosion.cs @@ -1,11 +1,11 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Dusts; -using System; +using System; using System.IO; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { public class HellfireExplosion : ModProjectile, ILocalizedModType diff --git a/Projectiles/Boss/HiveBombGoliath.cs b/Projectiles/Boss/HiveBombGoliath.cs index 3341fdd1e1..fb00892801 100644 --- a/Projectiles/Boss/HiveBombGoliath.cs +++ b/Projectiles/Boss/HiveBombGoliath.cs @@ -52,33 +52,33 @@ namespace CalamityMod.Projectiles.Boss { float randDustXVel = 0f; float randDustYVel = 0f; - if (Main.rand.Next(2) == 1) + if (Main.rand.NextBool(2)) { randDustXVel = Projectile.velocity.X * 0.5f; randDustYVel = Projectile.velocity.Y * 0.5f; } - int bombDust = Dust.NewDust(new Vector2(Projectile.position.X + 3f + randDustXVel, Projectile.position.Y + 3f + randDustYVel) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 6, 0f, 0f, 100, default, 0.5f); + int bombDust = Dust.NewDust(new Vector2(Projectile.position.X + 3f + randDustXVel, Projectile.position.Y + 3f + randDustYVel) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, DustID.Torch, 0f, 0f, 100, default, 0.5f); Main.dust[bombDust].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; Main.dust[bombDust].velocity *= 0.2f; Main.dust[bombDust].noGravity = true; - bombDust = Dust.NewDust(new Vector2(Projectile.position.X + 3f + randDustXVel, Projectile.position.Y + 3f + randDustYVel) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 31, 0f, 0f, 100, default, 0.25f); + bombDust = Dust.NewDust(new Vector2(Projectile.position.X + 3f + randDustXVel, Projectile.position.Y + 3f + randDustYVel) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, DustID.Smoke, 0f, 0f, 100, default, 0.25f); Main.dust[bombDust].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; Main.dust[bombDust].velocity *= 0.05f; } else if (Main.rand.NextBool(4)) { - int smoke = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 31, 0f, 0f, 100, default, 0.5f); + int smoke = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Smoke, 0f, 0f, 100, default, 0.5f); Main.dust[smoke].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f; Main.dust[smoke].fadeIn = 1.5f + (float)Main.rand.Next(5) * 0.1f; Main.dust[smoke].noGravity = true; Main.dust[smoke].position = Projectile.Center + new Vector2(0f, (float)(-(float)Projectile.height / 2)).RotatedBy((double)Projectile.rotation, default) * 1.1f; Main.rand.Next(2); - smoke = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 1f); + smoke = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 1f); Main.dust[smoke].scale = 1f + (float)Main.rand.Next(5) * 0.1f; Main.dust[smoke].noGravity = true; Main.dust[smoke].position = Projectile.Center + new Vector2(0f, (float)(-(float)Projectile.height / 2 - 6)).RotatedBy((double)Projectile.rotation, default) * 1.1f; } - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; } public override bool PreDraw(ref Color lightColor) @@ -102,7 +102,7 @@ namespace CalamityMod.Projectiles.Boss SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); for (int i = 0; i < 8; i++) { - int plagued = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 89, 0f, 0f, 100, default, 2f); + int plagued = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GemEmerald, 0f, 0f, 100, default, 2f); Main.dust[plagued].velocity *= 3f; if (Main.rand.NextBool()) { @@ -112,10 +112,10 @@ namespace CalamityMod.Projectiles.Boss } for (int j = 0; j < 10; j++) { - int plagued2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 89, 0f, 0f, 100, default, 3f); + int plagued2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GemEmerald, 0f, 0f, 100, default, 3f); Main.dust[plagued2].noGravity = true; Main.dust[plagued2].velocity *= 5f; - plagued2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 89, 0f, 0f, 100, default, 2f); + plagued2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GemEmerald, 0f, 0f, 100, default, 2f); Main.dust[plagued2].velocity *= 2f; } @@ -165,7 +165,7 @@ namespace CalamityMod.Projectiles.Boss if (Main.netMode != NetmodeID.MultiplayerClient && Main.zenithWorld) { - Vector2 valueBoom = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); + Vector2 valueBoom = Projectile.Center; float spreadBoom = 15f * 0.0174f; double startAngleBoom = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spreadBoom / 2; double deltaAngleBoom = spreadBoom / 8f; @@ -190,7 +190,7 @@ namespace CalamityMod.Projectiles.Boss { if (info.Damage <= 0) return; - + if (Main.zenithWorld) // it is the plague, you get very sick. { target.AddBuff(ModContent.BuffType(), 240, true); diff --git a/Projectiles/Boss/HolyAura.cs b/Projectiles/Boss/HolyAura.cs index 99e5da60a0..40c4680ee5 100644 --- a/Projectiles/Boss/HolyAura.cs +++ b/Projectiles/Boss/HolyAura.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Vector2 origin = texture.Size() / 2f; float time = Main.GlobalTimeWrappedHourly % 10f / 10f; Vector2 drawPosition = Projectile.Center - Main.screenPosition; @@ -71,7 +71,7 @@ namespace CalamityMod.Projectiles.Boss bool underworld = Projectile.ai[0] == 2f; if (!Main.zenithWorld) { - if (Main.dayTime) + if (Main.IsItDay()) { color.R = 255; if (underworld) diff --git a/Projectiles/Boss/HolyBlast.cs b/Projectiles/Boss/HolyBlast.cs index 4e3bf9a0d1..6736fc4ea1 100644 --- a/Projectiles/Boss/HolyBlast.cs +++ b/Projectiles/Boss/HolyBlast.cs @@ -1,14 +1,14 @@ -using CalamityMod.NPCs; +using System; +using System.IO; +using CalamityMod.NPCs; using CalamityMod.NPCs.Providence; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using System.IO; -using CalamityMod.World; namespace CalamityMod.Projectiles.Boss { @@ -75,7 +75,7 @@ namespace CalamityMod.Projectiles.Boss int dustType = ProvUtils.GetDustID(Projectile.maxPenetrate); for (int i = 0; i < 10; i++) { - int holyDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); + int holyDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); Main.dust[holyDust].velocity *= 3f; Main.dust[holyDust].noGravity = true; if (Main.rand.NextBool()) @@ -104,7 +104,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { - Texture2D texture = (Projectile.maxPenetrate != (int)Providence.BossMode.Day) ? ModContent.Request(Texture).Value : ModContent.Request("CalamityMod/Projectiles/Boss/HolyBlastNight").Value; + Texture2D texture = (Projectile.maxPenetrate != (int)Providence.BossMode.Day) ? Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value : ModContent.Request("CalamityMod/Projectiles/Boss/HolyBlastNight").Value; int framing = texture.Height / Main.projFrames[Projectile.type]; int y6 = framing * Projectile.frame; Projectile.DrawBackglow(ProvUtils.GetProjectileColor(Projectile.maxPenetrate, Projectile.alpha, true), 4f, texture); @@ -136,15 +136,15 @@ namespace CalamityMod.Projectiles.Boss int dustType = ProvUtils.GetDustID(Projectile.maxPenetrate); for (int j = 0; j < 4; j++) { - int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 50, default, 2f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 50, default, 2f); Main.dust[dust].noGravity = true; } for (int k = 0; k < 40; k++) { - int profaned = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 0, default, 4f); + int profaned = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 0, default, 4f); Main.dust[profaned].noGravity = true; Main.dust[profaned].velocity *= 3f; - profaned = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 50, default, 2f); + profaned = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 50, default, 2f); Main.dust[profaned].velocity *= 2f; Main.dust[profaned].noGravity = true; } diff --git a/Projectiles/Boss/HolyBomb.cs b/Projectiles/Boss/HolyBomb.cs index 8a64014ea6..7bdb4af478 100644 --- a/Projectiles/Boss/HolyBomb.cs +++ b/Projectiles/Boss/HolyBomb.cs @@ -1,14 +1,14 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using System.IO; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.NPCs; using CalamityMod.NPCs.Providence; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { @@ -59,15 +59,15 @@ namespace CalamityMod.Projectiles.Boss int dustType = ProvUtils.GetDustID(Projectile.maxPenetrate); for (int i = 0; i < 2; i++) { - int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, velocityY, 50, default, 1.5f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, velocityY, 50, default, 1.5f); Main.dust[dust].noGravity = true; } for (int j = 0; j < 20; j++) { - int holyDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, velocityY, 0, default, 2.5f); + int holyDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, velocityY, 0, default, 2.5f); Main.dust[holyDust].noGravity = true; Main.dust[holyDust].velocity *= 2f; - holyDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, velocityY, 50, default, 1.5f); + holyDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, velocityY, 50, default, 1.5f); Main.dust[holyDust].velocity *= 1.5f; Main.dust[holyDust].noGravity = true; } @@ -100,8 +100,8 @@ namespace CalamityMod.Projectiles.Boss } public override bool PreDraw(ref Color lightColor) - { - Texture2D texture = (Projectile.maxPenetrate == (int)Providence.BossMode.Day) ? ModContent.Request(Texture).Value : ModContent.Request("CalamityMod/Projectiles/Boss/HolyBombNight").Value; + { + Texture2D texture = (Projectile.maxPenetrate == (int)Providence.BossMode.Day) ? Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value : ModContent.Request("CalamityMod/Projectiles/Boss/HolyBombNight").Value; int framing = texture.Height / Main.projFrames[Projectile.type]; int y6 = framing * Projectile.frame; Projectile.DrawBackglow(ProvUtils.GetProjectileColor(Projectile.maxPenetrate, Projectile.alpha, true), 4f, texture); @@ -121,15 +121,15 @@ namespace CalamityMod.Projectiles.Boss int dustType = ProvUtils.GetDustID(Projectile.maxPenetrate); for (int i = 0; i < 2; i++) { - int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 50, default, 1.5f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 50, default, 1.5f); Main.dust[dust].noGravity = true; } for (int j = 0; j < 20; j++) { - int holyDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 0, default, 2.5f); + int holyDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 0, default, 2.5f); Main.dust[holyDust].noGravity = true; Main.dust[holyDust].velocity *= 3f; - holyDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 50, default, 1.5f); + holyDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 50, default, 1.5f); Main.dust[holyDust].velocity *= 2f; Main.dust[holyDust].noGravity = true; } diff --git a/Projectiles/Boss/HolyBurnOrb.cs b/Projectiles/Boss/HolyBurnOrb.cs index d01f75f3cd..7509889518 100644 --- a/Projectiles/Boss/HolyBurnOrb.cs +++ b/Projectiles/Boss/HolyBurnOrb.cs @@ -1,15 +1,15 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Events; using CalamityMod.NPCs; using CalamityMod.NPCs.Providence; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { @@ -75,7 +75,7 @@ namespace CalamityMod.Projectiles.Boss { float lerpMult = Utils.GetLerpValue(15f, 30f, Projectile.timeLeft, clamped: true) * Utils.GetLerpValue(240f, 200f, Projectile.timeLeft, clamped: true) * (1f + 0.2f * (float)Math.Cos(Main.GlobalTimeWrappedHourly % 30f / 0.5f * (MathHelper.Pi * 2f) * 3f)) * 0.8f; - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Vector2 drawPos = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); Color baseColor = ProvUtils.GetProjectileColor(Projectile.maxPenetrate, 255); baseColor *= 0.5f; diff --git a/Projectiles/Boss/HolyExplosionBoom.cs b/Projectiles/Boss/HolyExplosionBoom.cs index 48e7b8cf16..a543577f17 100644 --- a/Projectiles/Boss/HolyExplosionBoom.cs +++ b/Projectiles/Boss/HolyExplosionBoom.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Projectiles.Boss public override float GetScreenshakePower(float pulseCompletionRatio) => CalamityUtils.Convert01To010(pulseCompletionRatio) * 16f; public override Color GetCurrentExplosionColor(float pulseCompletionRatio) { - Color explosionColor = Main.zenithWorld ? new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB) : (Main.dayTime ? Color.Orange : Color.BlueViolet); + Color explosionColor = Main.zenithWorld ? new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB) : (Main.IsItDay() ? Color.Orange : Color.BlueViolet); return Color.Lerp(explosionColor * 1.6f, Color.White, MathHelper.Clamp(pulseCompletionRatio * 2.2f, 0f, 1f)); } public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; diff --git a/Projectiles/Boss/HolyFire.cs b/Projectiles/Boss/HolyFire.cs index 76946f295f..72a76cb870 100644 --- a/Projectiles/Boss/HolyFire.cs +++ b/Projectiles/Boss/HolyFire.cs @@ -5,9 +5,9 @@ using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { @@ -72,7 +72,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { - Texture2D texture = (Projectile.maxPenetrate == (int)Providence.BossMode.Day) ? ModContent.Request(Texture).Value : ModContent.Request("CalamityMod/Projectiles/Boss/HolyFireNight").Value; + Texture2D texture = (Projectile.maxPenetrate == (int)Providence.BossMode.Day) ? Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value : ModContent.Request("CalamityMod/Projectiles/Boss/HolyFireNight").Value; int framing = texture.Height / Main.projFrames[Projectile.type]; int y6 = framing * Projectile.frame; Projectile.DrawBackglow(ProvUtils.GetProjectileColor(Projectile.maxPenetrate, Projectile.alpha, true), 4f, texture); @@ -124,7 +124,7 @@ namespace CalamityMod.Projectiles.Boss int dustType = ProvUtils.GetDustID(Projectile.maxPenetrate); for (int i = 0; i < 5; i++) { - int holyDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); + int holyDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); Main.dust[holyDust].noGravity = true; if (Main.rand.NextBool()) { @@ -134,9 +134,9 @@ namespace CalamityMod.Projectiles.Boss } for (int j = 0; j < 10; j++) { - int holyDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 3f); + int holyDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 3f); Main.dust[holyDust2].noGravity = true; - holyDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); + holyDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); Main.dust[holyDust2].noGravity = true; } } diff --git a/Projectiles/Boss/HolyFire2.cs b/Projectiles/Boss/HolyFire2.cs index 9fc41594ac..d694d1753f 100644 --- a/Projectiles/Boss/HolyFire2.cs +++ b/Projectiles/Boss/HolyFire2.cs @@ -1,14 +1,14 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.NPCs; using CalamityMod.NPCs.Providence; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { @@ -85,7 +85,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { - Texture2D texture = (Projectile.maxPenetrate == (int)Providence.BossMode.Day) ? ModContent.Request(Texture).Value : ModContent.Request("CalamityMod/Projectiles/Boss/HolyFire2Night").Value; + Texture2D texture = (Projectile.maxPenetrate == (int)Providence.BossMode.Day) ? Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value : ModContent.Request("CalamityMod/Projectiles/Boss/HolyFire2Night").Value; int framing = texture.Height / Main.projFrames[Projectile.type]; int y6 = framing * Projectile.frame; Projectile.DrawBackglow(ProvUtils.GetProjectileColor(Projectile.maxPenetrate, Projectile.alpha, true), 4f, texture); @@ -105,7 +105,7 @@ namespace CalamityMod.Projectiles.Boss int dustType = ProvUtils.GetDustID(Projectile.maxPenetrate); for (int i = 0; i < 5; i++) { - int holyDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); + int holyDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); Main.dust[holyDust].noGravity = true; if (Main.rand.NextBool()) { @@ -115,9 +115,9 @@ namespace CalamityMod.Projectiles.Boss } for (int j = 0; j < 10; j++) { - int holyDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 3f); + int holyDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 3f); Main.dust[holyDust2].noGravity = true; - holyDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); + holyDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); Main.dust[holyDust2].noGravity = true; } } diff --git a/Projectiles/Boss/HolyFlare.cs b/Projectiles/Boss/HolyFlare.cs index 3ebb87ca7a..ce8b652245 100644 --- a/Projectiles/Boss/HolyFlare.cs +++ b/Projectiles/Boss/HolyFlare.cs @@ -5,9 +5,9 @@ using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { @@ -89,7 +89,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Projectile.maxPenetrate == (int)Providence.BossMode.Day ? ModContent.Request(Texture).Value : ModContent.Request("CalamityMod/Projectiles/Boss/HolyFlareNight").Value; + Texture2D texture = Projectile.maxPenetrate == (int)Providence.BossMode.Day ? Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value : ModContent.Request("CalamityMod/Projectiles/Boss/HolyFlareNight").Value; int framing = texture.Height / Main.projFrames[Projectile.type]; int y6 = framing * Projectile.frame; Projectile.DrawBackglow(ProvUtils.GetProjectileColor(Projectile.maxPenetrate, Projectile.alpha, true), 4f, texture); @@ -109,7 +109,7 @@ namespace CalamityMod.Projectiles.Boss int dustType = ProvUtils.GetDustID(Projectile.maxPenetrate); for (int i = 0; i < 5; i++) { - int holyDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); + int holyDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); Main.dust[holyDust].noGravity = true; if (Main.rand.NextBool()) { @@ -119,9 +119,9 @@ namespace CalamityMod.Projectiles.Boss } for (int j = 0; j < 10; j++) { - int holyDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 3f); + int holyDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 3f); Main.dust[holyDust2].noGravity = true; - holyDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); + holyDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); Main.dust[holyDust2].noGravity = true; } } diff --git a/Projectiles/Boss/HolyLight.cs b/Projectiles/Boss/HolyLight.cs index b0a662ad56..19fb29c30b 100644 --- a/Projectiles/Boss/HolyLight.cs +++ b/Projectiles/Boss/HolyLight.cs @@ -1,10 +1,10 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; -using Terraria.ModLoader; -using Terraria.ID; using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { @@ -62,7 +62,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { - Texture2D drawTexture = ModContent.Request(Texture).Value; + Texture2D drawTexture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Color brightGreen = new Color(54, 209, 54, 0); Vector2 projDirection = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); Vector2 halfTextureSize = drawTexture.Size() / 2f; @@ -103,7 +103,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.position.Y = Projectile.position.Y - (Projectile.height / 2); for (int i = 0; i < 5; i++) { - int holyYellow = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 246, 0f, 0f, 100, default, 2f); + int holyYellow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GoldCoin, 0f, 0f, 100, default, 2f); Main.dust[holyYellow].velocity *= 3f; Main.dust[holyYellow].noGravity = true; if (Main.rand.NextBool()) @@ -114,10 +114,10 @@ namespace CalamityMod.Projectiles.Boss } for (int j = 0; j < 8; j++) { - int holyYellow2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 247, 0f, 0f, 100, default, 3f); + int holyYellow2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.PlatinumCoin, 0f, 0f, 100, default, 3f); Main.dust[holyYellow2].noGravity = true; Main.dust[holyYellow2].velocity *= 5f; - holyYellow2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 246, 0f, 0f, 100, default, 2f); + holyYellow2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GoldCoin, 0f, 0f, 100, default, 2f); Main.dust[holyYellow2].velocity *= 2f; Main.dust[holyYellow2].noGravity = true; } diff --git a/Projectiles/Boss/HolySpear.cs b/Projectiles/Boss/HolySpear.cs index 4ea6fb76cd..03116c57ea 100644 --- a/Projectiles/Boss/HolySpear.cs +++ b/Projectiles/Boss/HolySpear.cs @@ -1,12 +1,12 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using System.IO; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Events; using CalamityMod.NPCs; using CalamityMod.NPCs.Providence; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -135,7 +135,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { - Texture2D drawTexture = ModContent.Request(Texture).Value; + Texture2D drawTexture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; bool aimedSpear = Projectile.ai[0] > 0f; int red = 255; @@ -178,17 +178,16 @@ namespace CalamityMod.Projectiles.Boss default: break; } - Color baseColor = new Color(red, green, blue, 255); + Color baseColor = new Color(red, green, blue, 0); - Color halfBaseColor = baseColor * 0.5f; - halfBaseColor.A = 0; + Color baseColor2 = baseColor; Vector2 projDirection = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); Vector2 halfTextureSize = drawTexture.Size() / 2f; - Color halfOfHalfBaseColor = halfBaseColor * 0.5f; + Color halfOfHalfBaseColor = baseColor2 * 0.5f; float timeLeftColorScale = Utils.GetLerpValue(15f, 30f, Projectile.timeLeft, clamped: true) * Utils.GetLerpValue(240f, 200f, Projectile.timeLeft, clamped: true) * (1f + 0.2f * (float)Math.Cos(Main.GlobalTimeWrappedHourly % 30f / 0.5f * ((float)Math.PI * 2f) * 3f)) * 0.8f; Vector2 timeLeftDrawEffect = new Vector2(1f, 1.5f) * timeLeftColorScale; Vector2 timeLeftDrawEffect2 = new Vector2(0.5f, 1f) * timeLeftColorScale; - halfBaseColor *= timeLeftColorScale; + baseColor2 *= timeLeftColorScale; halfOfHalfBaseColor *= timeLeftColorScale; SpriteEffects spriteEffects = SpriteEffects.None; @@ -200,7 +199,7 @@ namespace CalamityMod.Projectiles.Boss for (int i = 0; i < Projectile.oldPos.Length; i++) { Vector2 drawPos = Projectile.oldPos[i] + projDirection; - Color baseColorAlpha = Projectile.GetAlpha(halfBaseColor) * ((Projectile.oldPos.Length - i) / Projectile.oldPos.Length); + Color baseColorAlpha = Projectile.GetAlpha(baseColor2) * ((Projectile.oldPos.Length - i) / Projectile.oldPos.Length); Main.spriteBatch.Draw(drawTexture, drawPos, null, baseColorAlpha, Projectile.rotation, halfTextureSize, timeLeftDrawEffect, SpriteEffects.None, 0); Main.spriteBatch.Draw(drawTexture, drawPos, null, baseColorAlpha, Projectile.rotation, halfTextureSize, timeLeftDrawEffect2, SpriteEffects.None, 0); @@ -210,8 +209,8 @@ namespace CalamityMod.Projectiles.Boss } } - Main.EntitySpriteDraw(drawTexture, projDirection, null, halfBaseColor, Projectile.rotation, halfTextureSize, timeLeftDrawEffect, spriteEffects, 0); - Main.EntitySpriteDraw(drawTexture, projDirection, null, halfBaseColor, Projectile.rotation, halfTextureSize, timeLeftDrawEffect2, spriteEffects, 0); + Main.EntitySpriteDraw(drawTexture, projDirection, null, baseColor2, Projectile.rotation, halfTextureSize, timeLeftDrawEffect, spriteEffects, 0); + Main.EntitySpriteDraw(drawTexture, projDirection, null, baseColor2, Projectile.rotation, halfTextureSize, timeLeftDrawEffect2, spriteEffects, 0); Main.EntitySpriteDraw(drawTexture, projDirection, null, halfOfHalfBaseColor, Projectile.rotation, halfTextureSize, timeLeftDrawEffect * 0.6f, spriteEffects, 0); Main.EntitySpriteDraw(drawTexture, projDirection, null, halfOfHalfBaseColor, Projectile.rotation, halfTextureSize, timeLeftDrawEffect2 * 0.6f, spriteEffects, 0); diff --git a/Projectiles/Boss/HomingGasBulb.cs b/Projectiles/Boss/HomingGasBulb.cs index 84fbdc73d3..468aadc642 100644 --- a/Projectiles/Boss/HomingGasBulb.cs +++ b/Projectiles/Boss/HomingGasBulb.cs @@ -1,11 +1,14 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Events; +using CalamityMod.NPCs.TownNPCs; +using CalamityMod.World; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using System; -using CalamityMod.NPCs.TownNPCs; namespace CalamityMod.Projectiles.Boss { @@ -31,13 +34,15 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { + bool masterMode = Main.masterMode || BossRushEvent.BossRushActive; + if (Projectile.localAI[0] == 0f) { Projectile.localAI[0] = 1f; SoundEngine.PlaySound(SoundID.Item17, Projectile.Center); } - Lighting.AddLight(Projectile.Center, 0.4f, 0f, 0.4f); + Lighting.AddLight(Projectile.Center, 0.5f, 0.2f, 0.5f); Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver2; @@ -62,9 +67,24 @@ namespace CalamityMod.Projectiles.Boss } } - if (Projectile.ai[0] % 20f == 0f) + if (Projectile.ai[0] % (masterMode ? 15f : 20f) == 0f) { + int dustType = 73; + int totalDust = 12; + float radians = MathHelper.TwoPi / totalDust; + Vector2 spinningPoint = new Vector2(0f, -1f); + for (int k = 0; k < totalDust; k++) + { + Vector2 projectileVelocity = spinningPoint.RotatedBy(radians * k); + Vector2 spawnOffset = Projectile.Center + projectileVelocity.SafeNormalize(Vector2.UnitY) * 10f; + float randomSpeed = Main.rand.NextFloat(0.8f, 1.2f); + Vector2 dustVelocity = projectileVelocity * randomSpeed; + for (int l = 0; l < 2; l++) + Dust.NewDust(spawnOffset, 2, 2, dustType, dustVelocity.X, dustVelocity.Y); + } + SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); + if (Projectile.owner == Main.myPlayer) { int type = ModContent.ProjectileType(); @@ -74,17 +94,21 @@ namespace CalamityMod.Projectiles.Boss } } - public override Color? GetAlpha(Color lightColor) => new Color(255, 255, 255, Projectile.alpha); + public override bool PreDraw(ref Color lightColor) + { + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor); + return false; + } public override void OnKill(int timeLeft) { SoundEngine.PlaySound(SoundID.NPCDeath1, Projectile.Center); for (int i = 0; i < 15; i++) { - if (Main.rand.Next(3) != 0) - Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 166); + if (!Main.rand.NextBool(3)) + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Plantera_Pink); else - Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 167); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Plantera_Green); } } } diff --git a/Projectiles/Boss/HomingGasBulbSporeGas.cs b/Projectiles/Boss/HomingGasBulbSporeGas.cs index 16a3a7843f..bbe7f1e2c8 100644 --- a/Projectiles/Boss/HomingGasBulbSporeGas.cs +++ b/Projectiles/Boss/HomingGasBulbSporeGas.cs @@ -1,7 +1,7 @@ -using CalamityMod.World; +using System.IO; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -52,7 +52,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.localAI[0] = 255f; } - float lightValues = (255 - Projectile.alpha) * 0.3f / 255f; + float lightValues = (255 - Projectile.alpha) * 0.6f / 255f; Lighting.AddLight(Projectile.Center, lightValues, 0f, lightValues); Projectile.alpha = (int)(100.0 + Projectile.localAI[0] * 0.7); @@ -79,7 +79,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { // Changes the texture of the projectile - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; switch ((int)Projectile.ai[0]) { case 0: diff --git a/Projectiles/Boss/IceBlast.cs b/Projectiles/Boss/IceBlast.cs index a7c65ab9d4..5d27626298 100644 --- a/Projectiles/Boss/IceBlast.cs +++ b/Projectiles/Boss/IceBlast.cs @@ -1,11 +1,11 @@ -using Microsoft.Xna.Framework; +using System; +using CalamityMod.NPCs.Cryogen; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using CalamityMod.NPCs.Cryogen; namespace CalamityMod.Projectiles.Boss { @@ -56,7 +56,7 @@ namespace CalamityMod.Projectiles.Boss for (int i = 0; i < 2; i++) { - int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 92, Projectile.velocity.X, Projectile.velocity.Y, 50, default, 0.6f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Frost, Projectile.velocity.X, Projectile.velocity.Y, 50, default, 0.6f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 0.3f; } @@ -69,7 +69,7 @@ namespace CalamityMod.Projectiles.Boss //SoundEngine.PlaySound(SoundID.Item27, Projectile.Center); for (int i = 0; i < 5; i++) { - int iceDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 92, 0f, 0f, 0, default, 1f); + int iceDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Frost, 0f, 0f, 0, default, 1f); if (!Main.rand.NextBool(3)) { Dust dust = Main.dust[iceDust]; diff --git a/Projectiles/Boss/IceBomb.cs b/Projectiles/Boss/IceBomb.cs index 68c1303b1a..d963860aff 100644 --- a/Projectiles/Boss/IceBomb.cs +++ b/Projectiles/Boss/IceBomb.cs @@ -1,11 +1,11 @@ -using CalamityMod.Buffs.StatDebuffs; +using System; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.NPCs.Cryogen; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using CalamityMod.NPCs.Cryogen; namespace CalamityMod.Projectiles.Boss { @@ -37,7 +37,7 @@ namespace CalamityMod.Projectiles.Boss { for (int i = 0; i < 8; i++) { - int iceDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 67, 0f, 0f, 100, default, 2f); + int iceDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.IceRod, 0f, 0f, 100, default, 2f); Main.dust[iceDust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -47,10 +47,10 @@ namespace CalamityMod.Projectiles.Boss } for (int j = 0; j < 14; j++) { - int iceDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 67, 0f, 0f, 100, default, 3f); + int iceDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.IceRod, 0f, 0f, 100, default, 3f); Main.dust[iceDust2].noGravity = true; Main.dust[iceDust2].velocity *= 5f; - iceDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 67, 0f, 0f, 100, default, 2f); + iceDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.IceRod, 0f, 0f, 100, default, 2f); Main.dust[iceDust2].velocity *= 2f; } @@ -89,7 +89,7 @@ namespace CalamityMod.Projectiles.Boss } for (int k = 0; k < 10; k++) - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 67, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.IceRod, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } public override void OnHitPlayer(Player target, Player.HurtInfo info) diff --git a/Projectiles/Boss/IceRain.cs b/Projectiles/Boss/IceRain.cs index 8c97860c8b..53674d6619 100644 --- a/Projectiles/Boss/IceRain.cs +++ b/Projectiles/Boss/IceRain.cs @@ -1,13 +1,13 @@ -using CalamityMod.Events; +using System; +using System.IO; +using CalamityMod.Events; +using CalamityMod.NPCs.Cryogen; using CalamityMod.World; using Microsoft.Xna.Framework; -using System; -using System.IO; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using CalamityMod.NPCs.Cryogen; namespace CalamityMod.Projectiles.Boss { @@ -48,7 +48,7 @@ namespace CalamityMod.Projectiles.Boss for (int i = 0; i < 2; i++) { - int icyDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 92, Projectile.velocity.X, Projectile.velocity.Y, 50, default, 0.6f); + int icyDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Frost, Projectile.velocity.X, Projectile.velocity.Y, 50, default, 0.6f); Main.dust[icyDust].noGravity = true; Dust dust = Main.dust[icyDust]; dust.velocity *= 0.3f; @@ -63,7 +63,7 @@ namespace CalamityMod.Projectiles.Boss for (int i = 0; i < 2; i++) { - int icyDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 92, Projectile.velocity.X, Projectile.velocity.Y, 50, default, 0.6f); + int icyDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Frost, Projectile.velocity.X, Projectile.velocity.Y, 50, default, 0.6f); Main.dust[icyDust].noGravity = true; Dust dust = Main.dust[icyDust]; dust.velocity *= 0.3f; @@ -93,7 +93,7 @@ namespace CalamityMod.Projectiles.Boss //SoundEngine.PlaySound(SoundID.Item27 with { Volume = SoundID.Item27.Volume * 0.25f }, Projectile.Center); for (int j = 0; j < 3; j++) { - int snowDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 76, 0f, 0f, 0, default, 1f); + int snowDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Snow, 0f, 0f, 0, default, 1f); Main.dust[snowDust].noGravity = true; Main.dust[snowDust].noLight = true; Main.dust[snowDust].scale = 0.7f; diff --git a/Projectiles/Boss/IchorBlob.cs b/Projectiles/Boss/IchorBlob.cs index db0613fc66..8f266377bd 100644 --- a/Projectiles/Boss/IchorBlob.cs +++ b/Projectiles/Boss/IchorBlob.cs @@ -1,10 +1,10 @@ -using Microsoft.Xna.Framework; -using System; +using System; using System.IO; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { @@ -102,14 +102,14 @@ namespace CalamityMod.Projectiles.Boss Vector2 dustVelocity = dustRotation * Projectile.velocity.Length(); for (int i = 0; i < 10; i++) { - int ichorDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 170, 0f, 0f, 200, default, 1.6f); + int ichorDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Ichor, 0f, 0f, 200, default, 1.6f); Dust dust = Main.dust[ichorDust]; dust.position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; dust.noGravity = true; dust.velocity.Y -= 2f; dust.velocity *= 3f; dust.velocity += dustVelocity * Main.rand.NextFloat(); - ichorDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 170, 0f, 0f, 100, default, 0.8f); + ichorDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Ichor, 0f, 0f, 100, default, 0.8f); dust.position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; dust.velocity.Y -= 2f; dust.velocity *= 2f; @@ -119,7 +119,7 @@ namespace CalamityMod.Projectiles.Boss } for (int j = 0; j < 5; j++) { - int ichorDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 170, 0f, 0f, 0, default, 2f); + int ichorDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Ichor, 0f, 0f, 0, default, 2f); Dust dust = Main.dust[ichorDust2]; dust.position = Projectile.Center + Vector2.UnitX.RotatedByRandom(MathHelper.Pi).RotatedBy(Projectile.velocity.ToRotation()) * Projectile.width / 3f; dust.noGravity = true; diff --git a/Projectiles/Boss/IchorShot.cs b/Projectiles/Boss/IchorShot.cs index 7706b12242..0f7d9381e2 100644 --- a/Projectiles/Boss/IchorShot.cs +++ b/Projectiles/Boss/IchorShot.cs @@ -1,5 +1,5 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver2; - int ichorDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 170, 0f, 0f, 100, default, 0.5f); + int ichorDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Ichor, 0f, 0f, 100, default, 0.5f); Main.dust[ichorDust].noGravity = true; Main.dust[ichorDust].velocity *= 0f; diff --git a/Projectiles/Boss/Infernado.cs b/Projectiles/Boss/Infernado.cs index 5f3353a58a..0e50df4913 100644 --- a/Projectiles/Boss/Infernado.cs +++ b/Projectiles/Boss/Infernado.cs @@ -118,7 +118,7 @@ namespace CalamityMod.Projectiles.Boss bool breakapart = Main.zenithWorld && Projectile.localAI[1] >= breakThreshold; if (Projectile.ai[0] <= 0f && !breakapart) { - float swaySize = 0.104719758f; + float swaySize = MathHelper.Pi / 30f; float smolWidth = (float)Projectile.width / 5f; smolWidth *= 2f; float projXChange = (float)(Math.Cos((double)(swaySize * -(double)Projectile.ai[0])) - 0.5) * smolWidth; @@ -148,8 +148,8 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { - Texture2D texture2D13 = ModContent.Request(Texture).Value; - int framing = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; + Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + int framing = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; int y6 = framing * Projectile.frame; Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)framing / 2f), Projectile.scale, SpriteEffects.None, 0); return false; diff --git a/Projectiles/Boss/Infernado2.cs b/Projectiles/Boss/Infernado2.cs index f398fe5668..74b3d2dcec 100644 --- a/Projectiles/Boss/Infernado2.cs +++ b/Projectiles/Boss/Infernado2.cs @@ -115,7 +115,7 @@ namespace CalamityMod.Projectiles.Boss bool breakapart = Main.zenithWorld && Projectile.ai[0] <= breakThreshold; if (Projectile.ai[0] <= 0f && !breakapart) { - float swaySize = 0.104719758f; + float swaySize = MathHelper.Pi / 30f; float smolWidth = (float)Projectile.width / 5f; smolWidth *= 2f; float projXChange = (float)(Math.Cos((double)(swaySize * -(double)Projectile.ai[0])) - 0.5) * smolWidth; @@ -142,8 +142,8 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { - Texture2D texture2D13 = ModContent.Request(Texture).Value; - int framing = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; + Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + int framing = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; int y6 = framing * Projectile.frame; Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)framing / 2f), Projectile.scale, SpriteEffects.None, 0); return false; diff --git a/Projectiles/Boss/InfernadoRevenge.cs b/Projectiles/Boss/InfernadoRevenge.cs index e4dab247a0..dfb8a4e429 100644 --- a/Projectiles/Boss/InfernadoRevenge.cs +++ b/Projectiles/Boss/InfernadoRevenge.cs @@ -1,9 +1,9 @@ -using CalamityMod.Buffs.DamageOverTime; +using System.IO; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.CalPlayer; using CalamityMod.Graphics.Primitives; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System.IO; using Terraria; using Terraria.Graphics.Shaders; using Terraria.ID; diff --git a/Projectiles/Boss/JewelProjectile.cs b/Projectiles/Boss/JewelProjectile.cs index 3e71964aa0..39e6688a01 100644 --- a/Projectiles/Boss/JewelProjectile.cs +++ b/Projectiles/Boss/JewelProjectile.cs @@ -1,8 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { @@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.rotation += 0.3f * (float)Projectile.direction; for (int index = 0; index < 2; ++index) { - int ruby = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 90, Projectile.velocity.X, Projectile.velocity.Y, 90, new Color(), 1.2f); + int ruby = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GemRuby, Projectile.velocity.X, Projectile.velocity.Y, 90, new Color(), 1.2f); Dust dust = Main.dust[ruby]; dust.noGravity = true; dust.velocity *= 0.3f; @@ -40,7 +40,7 @@ namespace CalamityMod.Projectiles.Boss SoundEngine.PlaySound(SoundID.Dig, Projectile.Center); for (int index1 = 0; index1 < 15; ++index1) { - int ruby = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 90, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 50, new Color(), 1.2f); + int ruby = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GemRuby, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 50, new Color(), 1.2f); Dust dust = Main.dust[ruby]; dust.noGravity = true; dust.scale *= 1.25f; diff --git a/Projectiles/Boss/LeviathanBomb.cs b/Projectiles/Boss/LeviathanBomb.cs index fedea1cbde..ff64d08ed9 100644 --- a/Projectiles/Boss/LeviathanBomb.cs +++ b/Projectiles/Boss/LeviathanBomb.cs @@ -1,11 +1,11 @@ -using CalamityMod.Buffs.StatDebuffs; +using System.IO; +using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System.IO; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { public class LeviathanBomb : ModProjectile, ILocalizedModType @@ -53,7 +53,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } @@ -73,7 +73,7 @@ namespace CalamityMod.Projectiles.Boss SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); for (int i = 0; i < 10; i++) { - int meteorDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); + int meteorDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 100, default, 2f); Main.dust[meteorDust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -83,10 +83,10 @@ namespace CalamityMod.Projectiles.Boss } for (int j = 0; j < 15; j++) { - int meteorDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 3f); + int meteorDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 100, default, 3f); Main.dust[meteorDust2].noGravity = true; Main.dust[meteorDust2].velocity *= 5f; - meteorDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); + meteorDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 100, default, 2f); Main.dust[meteorDust2].velocity *= 2f; } } diff --git a/Projectiles/Boss/LeviathanSpawner.cs b/Projectiles/Boss/LeviathanSpawner.cs index 88427f4ba8..13873a7d62 100644 --- a/Projectiles/Boss/LeviathanSpawner.cs +++ b/Projectiles/Boss/LeviathanSpawner.cs @@ -1,6 +1,6 @@ -using CalamityMod.World; +using System; +using CalamityMod.World; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.Audio; using Terraria.GameContent.Shaders; diff --git a/Projectiles/Boss/MajesticSparkle.cs b/Projectiles/Boss/MajesticSparkle.cs index 4a4d9e3dba..aab013ceda 100644 --- a/Projectiles/Boss/MajesticSparkle.cs +++ b/Projectiles/Boss/MajesticSparkle.cs @@ -1,6 +1,6 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ModLoader; @@ -51,7 +51,7 @@ namespace CalamityMod.Projectiles.Boss } public override bool PreDraw(ref Color lightColor) { - Texture2D sparkleTexture = ModContent.Request(Texture).Value; + Texture2D sparkleTexture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Vector2 drawPosition = Projectile.Center - Main.screenPosition + Vector2.UnitY * Projectile.gfxOffY; Color sparkleColor = Main.hslToRgb(ColorSpectrumHue, 1f, 0.5f) * Projectile.Opacity * 0.5f; @@ -67,7 +67,7 @@ namespace CalamityMod.Projectiles.Boss Vector2 orthogonalsparkleScale = new Vector2(0.3f, 2f) * Projectile.Opacity * Projectile.scale; Main.EntitySpriteDraw(sparkleTexture, drawPosition, null, sparkleColor, MathHelper.PiOver2 + Projectile.rotation, origin, orthogonalsparkleScale, SpriteEffects.None, 0); - Main.EntitySpriteDraw(sparkleTexture, drawPosition, null,sparkleColor, Projectile.rotation, origin, sparkleScale, SpriteEffects.None, 0); + Main.EntitySpriteDraw(sparkleTexture, drawPosition, null, sparkleColor, Projectile.rotation, origin, sparkleScale, SpriteEffects.None, 0); Main.EntitySpriteDraw(sparkleTexture, drawPosition, null, orthogonalSparkleColor, MathHelper.PiOver2 + Projectile.rotation, origin, orthogonalsparkleScale * 0.6f, SpriteEffects.None, 0); Main.EntitySpriteDraw(sparkleTexture, drawPosition, null, orthogonalSparkleColor, Projectile.rotation, origin, sparkleScale * 0.6f, SpriteEffects.None, 0); return false; diff --git a/Projectiles/Boss/MoltenBlast.cs b/Projectiles/Boss/MoltenBlast.cs index a9fb3d86a6..f80225ae09 100644 --- a/Projectiles/Boss/MoltenBlast.cs +++ b/Projectiles/Boss/MoltenBlast.cs @@ -1,15 +1,15 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using System.IO; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.NPCs; using CalamityMod.NPCs.Providence; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { @@ -106,7 +106,7 @@ namespace CalamityMod.Projectiles.Boss } } - Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + 1.57f; + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver2; } public override Color? GetAlpha(Color lightColor) @@ -116,8 +116,8 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { - Texture2D texture = (Projectile.maxPenetrate == (int)Providence.BossMode.Day) ? ModContent.Request(Texture).Value : ModContent.Request("CalamityMod/Projectiles/Boss/MoltenBlastNight").Value; - int framing = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; + Texture2D texture = (Projectile.maxPenetrate == (int)Providence.BossMode.Day) ? Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value : ModContent.Request("CalamityMod/Projectiles/Boss/MoltenBlastNight").Value; + int framing = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; int y6 = framing * Projectile.frame; Projectile.DrawBackglow(ProvUtils.GetProjectileColor(Projectile.maxPenetrate, Projectile.alpha, true), 4f, texture); Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, framing / 2f), Projectile.scale, SpriteEffects.None, 0); diff --git a/Projectiles/Boss/MoltenBlob.cs b/Projectiles/Boss/MoltenBlob.cs index c551858525..2ff2619640 100644 --- a/Projectiles/Boss/MoltenBlob.cs +++ b/Projectiles/Boss/MoltenBlob.cs @@ -4,9 +4,9 @@ using CalamityMod.NPCs.Providence; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { public class MoltenBlob : ModProjectile, ILocalizedModType @@ -85,8 +85,8 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { - Texture2D texture = (Projectile.maxPenetrate == (int)Providence.BossMode.Day) ? ModContent.Request(Texture).Value : ModContent.Request("CalamityMod/Projectiles/Boss/MoltenBlobNight").Value; - int framing = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; + Texture2D texture = (Projectile.maxPenetrate == (int)Providence.BossMode.Day) ? Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value : ModContent.Request("CalamityMod/Projectiles/Boss/MoltenBlobNight").Value; + int framing = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; int y6 = framing * Projectile.frame; Projectile.DrawBackglow(ProvUtils.GetProjectileColor(Projectile.maxPenetrate, Projectile.alpha, true), 4f, texture); Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, framing / 2f), Projectile.scale, SpriteEffects.None, 0); @@ -105,7 +105,7 @@ namespace CalamityMod.Projectiles.Boss int dustType = ProvUtils.GetDustID(Projectile.maxPenetrate); for (int i = 0; i < 3; i++) { - int holyDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); + int holyDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); Main.dust[holyDust].noGravity = true; if (Main.rand.NextBool()) { @@ -115,9 +115,9 @@ namespace CalamityMod.Projectiles.Boss } for (int j = 0; j < 5; j++) { - int holyDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 3f); + int holyDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 3f); Main.dust[holyDust2].noGravity = true; - holyDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); + holyDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); Main.dust[holyDust2].noGravity = true; } } diff --git a/Projectiles/Boss/MushBomb.cs b/Projectiles/Boss/MushBomb.cs index 286c536e13..13f66d6d3f 100644 --- a/Projectiles/Boss/MushBomb.cs +++ b/Projectiles/Boss/MushBomb.cs @@ -1,4 +1,5 @@ -using CalamityMod.World; +using CalamityMod.Events; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -32,6 +33,9 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + if (Projectile.velocity.Y > 0f) { if (Projectile.Opacity < 1f) @@ -44,7 +48,7 @@ namespace CalamityMod.Projectiles.Boss Vector2 dustSpawnPosition = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.5f; dustSpawnPosition = dustSpawnPosition.RotatedBy((double)((float)(i - (dustAmount / 2 - 1)) * MathHelper.TwoPi / (float)dustAmount), default) + Projectile.Center; Vector2 dustVelocity = dustSpawnPosition - Projectile.Center; - int dust = Dust.NewDust(dustSpawnPosition + dustVelocity, 0, 0, 56, dustVelocity.X, dustVelocity.Y); + int dust = Dust.NewDust(dustSpawnPosition + dustVelocity, 0, 0, DustID.BlueFairy, dustVelocity.X, dustVelocity.Y); Main.dust[dust].noGravity = true; Main.dust[dust].noLight = true; Main.dust[dust].velocity = dustVelocity; @@ -53,7 +57,7 @@ namespace CalamityMod.Projectiles.Boss } else { - int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 56, 0f, 0f, 100, default, 0.8f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.BlueFairy, 0f, 0f, 100, default, 0.8f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 0f; } @@ -67,12 +71,13 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.frame > 3) Projectile.frame = 0; - if (Projectile.position.Y > Projectile.ai[1]) + if (Projectile.position.Y > Projectile.ai[1] && Projectile.velocity.Y > 0f) Projectile.tileCollide = true; Lighting.AddLight(Projectile.Center, 0f, 0.15f, 0.3f); - Projectile.velocity.X *= 0.995f; + float xVelocityMultiplier = death ? 0.999f : expertMode ? 0.9975f : 0.995f; + Projectile.velocity.X *= xVelocityMultiplier; } public override bool CanHitPlayer(Player target) => Projectile.Opacity == 1f; @@ -81,7 +86,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; int height = texture.Height / Main.projFrames[Projectile.type]; int drawStart = height * Projectile.frame; Vector2 origin = Projectile.Size / 2; @@ -91,7 +96,7 @@ namespace CalamityMod.Projectiles.Boss public override void PostDraw(Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; int height = texture.Height / Main.projFrames[Projectile.type]; int drawStart = height * Projectile.frame; Vector2 origin = Projectile.Size / 2; @@ -113,7 +118,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int i = 0; i < 4; i++) { - int shroomDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 56, 0f, 0f, 100, default, 2f); + int shroomDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.BlueFairy, 0f, 0f, 100, default, 1.5f); Main.dust[shroomDust].velocity *= 1.5f; if (Main.rand.NextBool()) { @@ -123,10 +128,10 @@ namespace CalamityMod.Projectiles.Boss } for (int j = 0; j < 12; j++) { - int shroomDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 56, 0f, 0f, 100, default, 3f); + int shroomDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.BlueFairy, 0f, 0f, 100, default, 2f); Main.dust[shroomDust2].noGravity = true; Main.dust[shroomDust2].velocity *= 2f; - Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 56, 0f, 0f, 100, default, 2f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.BlueFairy, 0f, 0f, 100, default, 1.5f); } } } diff --git a/Projectiles/Boss/MushBombFall.cs b/Projectiles/Boss/MushBombFall.cs index 2e82c649fd..bbc5cadcfe 100644 --- a/Projectiles/Boss/MushBombFall.cs +++ b/Projectiles/Boss/MushBombFall.cs @@ -1,12 +1,12 @@ -using CalamityMod.Events; +using System; +using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { @@ -44,7 +44,7 @@ namespace CalamityMod.Projectiles.Boss Vector2 dustSpawnPosition = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.5f; dustSpawnPosition = dustSpawnPosition.RotatedBy((double)((float)(i - (dustAmount / 2 - 1)) * MathHelper.TwoPi / (float)dustAmount), default) + Projectile.Center; Vector2 dustVelocity = dustSpawnPosition - Projectile.Center; - int dust = Dust.NewDust(dustSpawnPosition + dustVelocity, 0, 0, 56, dustVelocity.X, dustVelocity.Y); + int dust = Dust.NewDust(dustSpawnPosition + dustVelocity, 0, 0, DustID.BlueFairy, dustVelocity.X, dustVelocity.Y); Main.dust[dust].noGravity = true; Main.dust[dust].noLight = true; Main.dust[dust].velocity = dustVelocity; @@ -53,7 +53,7 @@ namespace CalamityMod.Projectiles.Boss } else { - int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 56, 0f, 0f, 100, default, 0.8f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.BlueFairy, 0f, 0f, 100, default, 0.8f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 0f; } @@ -67,7 +67,7 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.frame > 3) Projectile.frame = 0; - if (Projectile.position.Y > Projectile.ai[1]) + if (Projectile.position.Y > Projectile.ai[1] && Projectile.velocity.Y > 0f) Projectile.tileCollide = true; Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver2; @@ -86,10 +86,10 @@ namespace CalamityMod.Projectiles.Boss public override bool CanHitPlayer(Player target) => Projectile.Opacity == 1f; public override Color? GetAlpha(Color drawColor) => Main.zenithWorld ? new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, Projectile.alpha) : new Color(255, 255, 255, Projectile.alpha); - + public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; int height = texture.Height / Main.projFrames[Projectile.type]; int drawStart = height * Projectile.frame; Vector2 origin = Projectile.Size / 2; @@ -103,7 +103,7 @@ namespace CalamityMod.Projectiles.Boss public override void PostDraw(Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; int height = texture.Height / Main.projFrames[Projectile.type]; int drawStart = height * Projectile.frame; Vector2 origin = Projectile.Size / 2; @@ -121,7 +121,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int i = 0; i < 4; i++) { - int shroomDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 56, 0f, 0f, 100, default, 2f); + int shroomDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.BlueFairy, 0f, 0f, 100, default, 1.5f); Main.dust[shroomDust].velocity *= 1.5f; if (Main.rand.NextBool()) { @@ -131,10 +131,10 @@ namespace CalamityMod.Projectiles.Boss } for (int j = 0; j < 12; j++) { - int shroomDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 56, 0f, 0f, 100, default, 3f); + int shroomDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.BlueFairy, 0f, 0f, 100, default, 2f); Main.dust[shroomDust2].noGravity = true; Main.dust[shroomDust2].velocity *= 2f; - Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 56, 0f, 0f, 100, default, 2f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.BlueFairy, 0f, 0f, 100, default, 1.5f); } if (Main.zenithWorld && NPC.CountNPCS(NPCID.Crab) < 20 && Main.netMode != NetmodeID.MultiplayerClient) diff --git a/Projectiles/Boss/OldDukeGore.cs b/Projectiles/Boss/OldDukeGore.cs index f9e876528b..fb1110f055 100644 --- a/Projectiles/Boss/OldDukeGore.cs +++ b/Projectiles/Boss/OldDukeGore.cs @@ -2,9 +2,9 @@ using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { @@ -52,7 +52,7 @@ namespace CalamityMod.Projectiles.Boss Main.dust[blood].noGravity = true; Main.dust[blood].velocity *= 0f; - int acid = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default, 1f); + int acid = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.SulphurousSeaAcid, 0f, 0f, 100, default, 1f); Main.dust[acid].noGravity = true; Main.dust[acid].velocity *= 0f; } @@ -75,10 +75,10 @@ namespace CalamityMod.Projectiles.Boss for (int d = 0; d < 6; d++) { - int acid = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default(Color), 3f); + int acid = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.SulphurousSeaAcid, 0f, 0f, 100, default(Color), 3f); Main.dust[acid].noGravity = true; Main.dust[acid].velocity *= 5f; - acid = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default(Color), 2f); + acid = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.SulphurousSeaAcid, 0f, 0f, 100, default(Color), 2f); Main.dust[acid].velocity *= 2f; Main.dust[acid].noGravity = true; } diff --git a/Projectiles/Boss/OldDukeSummonDrop.cs b/Projectiles/Boss/OldDukeSummonDrop.cs index 509944c523..5dff1c3c95 100644 --- a/Projectiles/Boss/OldDukeSummonDrop.cs +++ b/Projectiles/Boss/OldDukeSummonDrop.cs @@ -1,9 +1,9 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; namespace CalamityMod.Projectiles.Boss { @@ -40,7 +40,7 @@ namespace CalamityMod.Projectiles.Boss // Water drip for (int i = 0; i < 4; i++) { - int idx = Dust.NewDust(Projectile.position - Projectile.velocity, 2, 2, 154, 0f, 0f, 0, new Color(112, 150, 42, 127), 1f); + int idx = Dust.NewDust(Projectile.position - Projectile.velocity, 2, 2, DustID.Rain, 0f, 0f, 0, new Color(112, 150, 42, 127), 1f); Dust dust = Main.dust[idx]; dust.position.X -= 2f; Main.dust[idx].alpha = 38; diff --git a/Projectiles/Boss/OldDukeToothBallSpike.cs b/Projectiles/Boss/OldDukeToothBallSpike.cs index 1852125aba..c165b6e4c4 100644 --- a/Projectiles/Boss/OldDukeToothBallSpike.cs +++ b/Projectiles/Boss/OldDukeToothBallSpike.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Projectiles.Boss for (int i = 0; i < 2; i++) { - int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.SulfurousSeaAcid, 0, 0, 0, default, 0.6f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.SulphurousSeaAcid, 0, 0, 0, default, 0.6f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 0.3f; } @@ -50,10 +50,10 @@ namespace CalamityMod.Projectiles.Boss { for (int i = 0; i <= 2; i++) { - int idx = Dust.NewDust(Projectile.position, 8, 8, (int)CalamityDusts.SulfurousSeaAcid, 0, 0, 0, default, 0.75f); + int idx = Dust.NewDust(Projectile.position, 8, 8, (int)CalamityDusts.SulphurousSeaAcid, 0, 0, 0, default, 0.75f); Main.dust[idx].noGravity = true; Main.dust[idx].velocity *= 3f; - idx = Dust.NewDust(Projectile.position, 8, 8, (int)CalamityDusts.SulfurousSeaAcid, 0, 0, 0, default, 0.75f); + idx = Dust.NewDust(Projectile.position, 8, 8, (int)CalamityDusts.SulphurousSeaAcid, 0, 0, 0, default, 0.75f); Main.dust[idx].noGravity = true; Main.dust[idx].velocity *= 3f; } diff --git a/Projectiles/Boss/OldDukeVortex.cs b/Projectiles/Boss/OldDukeVortex.cs index 4aafd1b355..02f6b1d5a7 100644 --- a/Projectiles/Boss/OldDukeVortex.cs +++ b/Projectiles/Boss/OldDukeVortex.cs @@ -114,7 +114,7 @@ namespace CalamityMod.Projectiles.Boss if (Main.rand.NextBool(var)) { dustOffset = dustOffset.RotatedBy(angleIncrement); - int dust = Dust.NewDust(Projectile.Center, 1, 1, (int)CalamityDusts.SulfurousSeaAcid); + int dust = Dust.NewDust(Projectile.Center, 1, 1, (int)CalamityDusts.SulphurousSeaAcid); Main.dust[dust].position = Projectile.Center + dustOffset; Main.dust[dust].noGravity = true; Main.dust[dust].velocity = Vector2.Normalize(Projectile.Center - Main.dust[dust].position) * 24f; diff --git a/Projectiles/Boss/OverlyDramaticDukeSummoner.cs b/Projectiles/Boss/OverlyDramaticDukeSummoner.cs index cb9ce5fdf4..d9f506ba87 100644 --- a/Projectiles/Boss/OverlyDramaticDukeSummoner.cs +++ b/Projectiles/Boss/OverlyDramaticDukeSummoner.cs @@ -123,7 +123,7 @@ namespace CalamityMod.Projectiles.Boss { for (int i = 0; i < 160; i++) { - Dust dust = Dust.NewDustPerfect(Projectile.Top + Vector2.UnitY * 100f, (int)CalamityDusts.SulfurousSeaAcid); + Dust dust = Dust.NewDustPerfect(Projectile.Top + Vector2.UnitY * 100f, (int)CalamityDusts.SulphurousSeaAcid); dust.velocity = Vector2.One.RotatedByRandom(MathHelper.TwoPi) * Main.rand.NextFloat(5f, 23f); dust.noGravity = true; dust.scale = 3f; @@ -181,7 +181,7 @@ namespace CalamityMod.Projectiles.Boss bottomY--; Vector2 bottomVector = new Vector2(centerAsTileCoords.X, bottomY) * 16f + new Vector2(8f); - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; float yMax = 1600f * Projectile.scale; for (int y = 0; y < yMax; y += 30) { diff --git a/Projectiles/Boss/PeanutRocket.cs b/Projectiles/Boss/PeanutRocket.cs index 7be5518b6f..e754966886 100644 --- a/Projectiles/Boss/PeanutRocket.cs +++ b/Projectiles/Boss/PeanutRocket.cs @@ -1,8 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { diff --git a/Projectiles/Boss/PhantomBlast.cs b/Projectiles/Boss/PhantomBlast.cs index a5b7b30f91..fb76be00e3 100644 --- a/Projectiles/Boss/PhantomBlast.cs +++ b/Projectiles/Boss/PhantomBlast.cs @@ -1,11 +1,11 @@ -using CalamityMod.Buffs.DamageOverTime; -using Microsoft.Xna.Framework; -using System; +using System; using System.IO; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { @@ -67,7 +67,7 @@ namespace CalamityMod.Projectiles.Boss Vector2 dustRotation = Vector2.UnitX * -Projectile.width / 2f; dustRotation += -Vector2.UnitY.RotatedBy(l * MathHelper.Pi / 6f) * new Vector2(8f, 16f); dustRotation = dustRotation.RotatedBy(Projectile.rotation - MathHelper.PiOver2); - int phantomDust = Dust.NewDust(Projectile.Center, 0, 0, 180, 0f, 0f, 160, default, 1f); + int phantomDust = Dust.NewDust(Projectile.Center, 0, 0, DustID.DungeonSpirit, 0f, 0f, 160, default, 1f); Main.dust[phantomDust].scale = 1.1f; Main.dust[phantomDust].noGravity = true; Main.dust[phantomDust].position = Projectile.Center + dustRotation; @@ -93,7 +93,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.position.Y = Projectile.position.Y - (Projectile.height / 2); for (int i = 0; i < 3; i++) { - int killGhostDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 180, 0f, 0f, 100, default, 1.2f); + int killGhostDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.DungeonSpirit, 0f, 0f, 100, default, 1.2f); Main.dust[killGhostDust].velocity *= 3f; Main.dust[killGhostDust].noGravity = true; if (Main.rand.NextBool()) @@ -104,10 +104,10 @@ namespace CalamityMod.Projectiles.Boss } for (int j = 0; j < 5; j++) { - int killGhostDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 180, 0f, 0f, 100, default, 1.7f); + int killGhostDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.DungeonSpirit, 0f, 0f, 100, default, 1.7f); Main.dust[killGhostDust2].noGravity = true; Main.dust[killGhostDust2].velocity *= 5f; - killGhostDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 180, 0f, 0f, 100, default, 1f); + killGhostDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.DungeonSpirit, 0f, 0f, 100, default, 1f); Main.dust[killGhostDust2].velocity *= 2f; } } diff --git a/Projectiles/Boss/PhantomBlast2.cs b/Projectiles/Boss/PhantomBlast2.cs index 6a2e5fd306..f581c4a065 100644 --- a/Projectiles/Boss/PhantomBlast2.cs +++ b/Projectiles/Boss/PhantomBlast2.cs @@ -1,11 +1,11 @@ -using CalamityMod.Buffs.StatDebuffs; -using Microsoft.Xna.Framework; -using System; +using System; using System.IO; +using CalamityMod.Buffs.StatDebuffs; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { @@ -67,7 +67,7 @@ namespace CalamityMod.Projectiles.Boss Vector2 dustRotation = Vector2.UnitX * -Projectile.width / 2f; dustRotation += -Vector2.UnitY.RotatedBy(l * MathHelper.Pi / 6f) * new Vector2(8f, 16f); dustRotation = dustRotation.RotatedBy(Projectile.rotation - MathHelper.PiOver2); - int phantomDust = Dust.NewDust(Projectile.Center, 0, 0, 60, 0f, 0f, 160, default, 1f); + int phantomDust = Dust.NewDust(Projectile.Center, 0, 0, DustID.RedTorch, 0f, 0f, 160, default, 1f); Main.dust[phantomDust].scale = 1.1f; Main.dust[phantomDust].noGravity = true; Main.dust[phantomDust].position = Projectile.Center + dustRotation; @@ -93,7 +93,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.position.Y = Projectile.position.Y - (Projectile.height / 2); for (int i = 0; i < 3; i++) { - int killGhostDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 100, default, 1.2f); + int killGhostDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RedTorch, 0f, 0f, 100, default, 1.2f); Main.dust[killGhostDust].velocity *= 3f; Main.dust[killGhostDust].noGravity = true; if (Main.rand.NextBool()) @@ -104,10 +104,10 @@ namespace CalamityMod.Projectiles.Boss } for (int j = 0; j < 5; j++) { - int killGhostDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 100, default, 1.7f); + int killGhostDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RedTorch, 0f, 0f, 100, default, 1.7f); Main.dust[killGhostDust2].noGravity = true; Main.dust[killGhostDust2].velocity *= 5f; - killGhostDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 100, default, 1f); + killGhostDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RedTorch, 0f, 0f, 100, default, 1f); Main.dust[killGhostDust2].velocity *= 2f; } } diff --git a/Projectiles/Boss/PhantomGhostShot.cs b/Projectiles/Boss/PhantomGhostShot.cs index c3e95d0d0e..61f6e7a116 100644 --- a/Projectiles/Boss/PhantomGhostShot.cs +++ b/Projectiles/Boss/PhantomGhostShot.cs @@ -1,11 +1,11 @@ -using CalamityMod.Buffs.StatDebuffs; -using Microsoft.Xna.Framework; -using System; +using System; using System.IO; +using CalamityMod.Buffs.StatDebuffs; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { @@ -50,7 +50,7 @@ namespace CalamityMod.Projectiles.Boss { for (int i = 0; i < 40; i++) { - int redDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 100, default, 1f); + int redDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RedTorch, 0f, 0f, 100, default, 1f); Main.dust[redDust].velocity *= 3f; Main.dust[redDust].velocity += Projectile.velocity * 0.75f; Main.dust[redDust].scale *= 1.2f; diff --git a/Projectiles/Boss/PhantomHookShot.cs b/Projectiles/Boss/PhantomHookShot.cs index ba8332c594..133cb9ef32 100644 --- a/Projectiles/Boss/PhantomHookShot.cs +++ b/Projectiles/Boss/PhantomHookShot.cs @@ -1,11 +1,11 @@ -using CalamityMod.Buffs.DamageOverTime; -using Microsoft.Xna.Framework; -using System; +using System; using System.IO; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { @@ -50,7 +50,7 @@ namespace CalamityMod.Projectiles.Boss { for (int i = 0; i < 40; i++) { - int redDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 180, 0f, 0f, 100, default, 1f); + int redDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.DungeonSpirit, 0f, 0f, 100, default, 1f); Main.dust[redDust].velocity *= 3f; Main.dust[redDust].velocity += Projectile.velocity * 0.75f; Main.dust[redDust].scale *= 1.2f; diff --git a/Projectiles/Boss/PhantomMine.cs b/Projectiles/Boss/PhantomMine.cs index 97897bc811..31c1331385 100644 --- a/Projectiles/Boss/PhantomMine.cs +++ b/Projectiles/Boss/PhantomMine.cs @@ -1,11 +1,11 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using CalamityMod.World; namespace CalamityMod.Projectiles.Boss { @@ -81,7 +81,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.position.Y = Projectile.position.Y - (Projectile.height / 2); for (int i = 0; i < 15; i++) { - int phantomDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 180, 0f, 0f, 100, default, 1.2f); + int phantomDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.DungeonSpirit, 0f, 0f, 100, default, 1.2f); Main.dust[phantomDust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -91,10 +91,10 @@ namespace CalamityMod.Projectiles.Boss } for (int j = 0; j < 30; j++) { - int phantomDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 180, 0f, 0f, 100, default, 1.7f); + int phantomDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.DungeonSpirit, 0f, 0f, 100, default, 1.7f); Main.dust[phantomDust2].noGravity = true; Main.dust[phantomDust2].velocity *= 5f; - phantomDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 100, default, 1f); + phantomDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RedTorch, 0f, 0f, 100, default, 1f); Main.dust[phantomDust2].velocity *= 2f; } } diff --git a/Projectiles/Boss/PhantomShot.cs b/Projectiles/Boss/PhantomShot.cs index c38d4c962c..3d1d3021cf 100644 --- a/Projectiles/Boss/PhantomShot.cs +++ b/Projectiles/Boss/PhantomShot.cs @@ -1,11 +1,11 @@ -using CalamityMod.Buffs.DamageOverTime; -using Microsoft.Xna.Framework; -using System; +using System; using System.IO; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.ai[1] = 1f; SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); } - Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + 1.57f; + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver2; Projectile.localAI[0] += 1f; if (Projectile.localAI[0] > 9f) { diff --git a/Projectiles/Boss/PhantomShot2.cs b/Projectiles/Boss/PhantomShot2.cs index 9263308bc6..fc48efce2d 100644 --- a/Projectiles/Boss/PhantomShot2.cs +++ b/Projectiles/Boss/PhantomShot2.cs @@ -1,11 +1,11 @@ -using CalamityMod.Buffs.StatDebuffs; -using Microsoft.Xna.Framework; -using System; +using System; using System.IO; +using CalamityMod.Buffs.StatDebuffs; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.ai[1] = 1f; SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); } - Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + 1.57f; + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver2; Projectile.localAI[0] += 1f; if (Projectile.localAI[0] > 9f) { diff --git a/Projectiles/Boss/PlagueExplosion.cs b/Projectiles/Boss/PlagueExplosion.cs index 88853e72ba..928427990d 100644 --- a/Projectiles/Boss/PlagueExplosion.cs +++ b/Projectiles/Boss/PlagueExplosion.cs @@ -1,6 +1,7 @@ -using CalamityMod.Buffs.DamageOverTime; -using System; +using System; +using CalamityMod.Buffs.DamageOverTime; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss @@ -46,7 +47,7 @@ namespace CalamityMod.Projectiles.Boss randoAdjuster = rando3 / randoAdjuster; rando1 *= randoAdjuster; rando2 *= randoAdjuster; - int greenPlague = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 89, 0f, 0f, 100, default); + int greenPlague = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GemEmerald, 0f, 0f, 100, default); Main.dust[greenPlague].noGravity = true; Main.dust[greenPlague].position.X = Projectile.Center.X; Main.dust[greenPlague].position.Y = Projectile.Center.Y; diff --git a/Projectiles/Boss/PlagueStingerGoliath.cs b/Projectiles/Boss/PlagueStingerGoliath.cs index 172b16a111..f8cb269e5c 100644 --- a/Projectiles/Boss/PlagueStingerGoliath.cs +++ b/Projectiles/Boss/PlagueStingerGoliath.cs @@ -1,7 +1,7 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss @@ -55,7 +55,7 @@ namespace CalamityMod.Projectiles.Boss public override void PostDraw(Color lightColor) { Vector2 center = new Vector2(Projectile.Center.X, Projectile.Center.Y); - Vector2 textureArea = new Vector2(ModContent.Request(Texture).Value.Width / 2, ModContent.Request(Texture).Value.Height / 2); + Vector2 textureArea = new Vector2(Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Width / 2, Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / 2); Vector2 drawArea = center - Main.screenPosition; drawArea -= new Vector2(ModContent.Request("CalamityMod/Projectiles/Boss/PlagueStingerGoliathGlow").Value.Width, ModContent.Request("CalamityMod/Projectiles/Boss/PlagueStingerGoliathGlow").Value.Height) * 1f / 2f; drawArea += textureArea * 1f + new Vector2(0f, 4f + Projectile.gfxOffY); diff --git a/Projectiles/Boss/PlagueStingerGoliathV2.cs b/Projectiles/Boss/PlagueStingerGoliathV2.cs index 90e307f0de..d379ddf72f 100644 --- a/Projectiles/Boss/PlagueStingerGoliathV2.cs +++ b/Projectiles/Boss/PlagueStingerGoliathV2.cs @@ -1,11 +1,11 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { diff --git a/Projectiles/Boss/ProfanedSpear.cs b/Projectiles/Boss/ProfanedSpear.cs index 056a330332..7187932d5e 100644 --- a/Projectiles/Boss/ProfanedSpear.cs +++ b/Projectiles/Boss/ProfanedSpear.cs @@ -1,6 +1,6 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -35,7 +35,7 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.timeLeft < 510) Projectile.tileCollide = true; - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + MathHelper.PiOver4; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4; Projectile.ai[0] += 1f; if (Projectile.ai[0] <= 20f) diff --git a/Projectiles/Boss/ProvidenceCrystal.cs b/Projectiles/Boss/ProvidenceCrystal.cs index 25c7473ed1..bf409a9f5d 100644 --- a/Projectiles/Boss/ProvidenceCrystal.cs +++ b/Projectiles/Boss/ProvidenceCrystal.cs @@ -1,15 +1,15 @@ -using CalamityMod.Events; +using System; +using System.IO; +using CalamityMod.Events; using CalamityMod.NPCs; using CalamityMod.NPCs.Providence; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { @@ -47,6 +47,12 @@ namespace CalamityMod.Projectiles.Boss return; } + if (Projectile.ai[2] > 0f) + { + if (Projectile.timeLeft > Projectile.ai[2]) + Projectile.timeLeft = (int)Projectile.ai[2]; + } + Player proviTarget = Main.player[Main.npc[CalamityGlobalNPC.holyBoss].target]; Projectile.maxPenetrate = (int)Main.npc[CalamityGlobalNPC.holyBoss].localAI[1]; @@ -74,7 +80,7 @@ namespace CalamityMod.Projectiles.Boss Color BaseColor = ProvUtils.GetProjectileColor(Projectile.maxPenetrate, 0); float Brightness = 0.8f; Color DustColor = Color.Lerp(BaseColor, Color.White, Brightness); - Dust crystalDust = Main.dust[Dust.NewDust(Projectile.Top, 0, 0, 267, 0f, 0f, 100, DustColor, 1f)]; + Dust crystalDust = Main.dust[Dust.NewDust(Projectile.Top, 0, 0, DustID.RainbowMk2, 0f, 0f, 100, DustColor, 1f)]; crystalDust.velocity.X = 0f; crystalDust.noGravity = true; crystalDust.fadeIn = 1f; @@ -128,7 +134,7 @@ namespace CalamityMod.Projectiles.Boss { Color colorArea = Lighting.GetColor((int)(Projectile.position.X + Projectile.width * 0.5) / 16, (int)((Projectile.position.Y + Projectile.height * 0.5) / 16.0)); Vector2 drawArea = Projectile.position + new Vector2(Projectile.width, Projectile.height) / 2f + Vector2.UnitY * Projectile.gfxOffY - Main.screenPosition; - Texture2D texture2D34 = ModContent.Request(Texture).Value; + Texture2D texture2D34 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Rectangle textureRect = texture2D34.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); Color colorAlpha = Projectile.GetAlpha(colorArea); Vector2 halfRect = textureRect.Size() / 2f; diff --git a/Projectiles/Boss/ProvidenceCrystalShard.cs b/Projectiles/Boss/ProvidenceCrystalShard.cs index 94da33c373..aec440d1d4 100644 --- a/Projectiles/Boss/ProvidenceCrystalShard.cs +++ b/Projectiles/Boss/ProvidenceCrystalShard.cs @@ -1,13 +1,13 @@ -using CalamityMod.NPCs; +using System; +using System.IO; +using CalamityMod.NPCs; using CalamityMod.NPCs.Providence; using CalamityMod.World; using Microsoft.Xna.Framework; -using System; -using System.IO; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { @@ -56,7 +56,7 @@ namespace CalamityMod.Projectiles.Boss } else Projectile.maxPenetrate = (int)Providence.BossMode.Day; - + // Night AI or Guardian Healer if (Projectile.maxPenetrate != (int)Providence.BossMode.Day || healerGuardianAlive) Projectile.extraUpdates = 1; @@ -101,7 +101,7 @@ namespace CalamityMod.Projectiles.Boss if (Main.rand.NextBool(10)) { Vector2 dustRotation = Vector2.UnitY.RotatedBy(i * MathHelper.Pi).RotatedBy(Projectile.rotation); - Dust crystalDust = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, 267, 0f, 0f, 225, newColor2, 1.5f)]; + Dust crystalDust = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, DustID.RainbowMk2, 0f, 0f, 225, newColor2, 1.5f)]; crystalDust.noGravity = true; crystalDust.noLight = true; crystalDust.scale = Projectile.Opacity * Projectile.localAI[0]; @@ -115,7 +115,7 @@ namespace CalamityMod.Projectiles.Boss if (Main.rand.NextBool(10)) { Vector2 dustRotate = Vector2.UnitY.RotatedBy(j * MathHelper.Pi); - Dust crystalDust2 = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, 267, 0f, 0f, 225, newColor2, 1.5f)]; + Dust crystalDust2 = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, DustID.RainbowMk2, 0f, 0f, 225, newColor2, 1.5f)]; crystalDust2.noGravity = true; crystalDust2.noLight = true; crystalDust2.scale = Projectile.Opacity * Projectile.localAI[0]; @@ -148,7 +148,7 @@ namespace CalamityMod.Projectiles.Boss } if (shouldSpawn) { - Dust holyDust = Main.dust[Dust.NewDust(dustPos, 0, 0, 267, 0f, 0f, 127, newColor2, 1f)]; + Dust holyDust = Main.dust[Dust.NewDust(dustPos, 0, 0, DustID.RainbowMk2, 0f, 0f, 127, newColor2, 1f)]; holyDust.noGravity = true; holyDust.position = dustPos; holyDust.velocity = -Vector2.UnitY * dustVelScale * (Main.rand.NextFloat() * 0.9f + 1.6f); @@ -175,7 +175,7 @@ namespace CalamityMod.Projectiles.Boss newColor.A = 255; for (float i = 0f; i < dustAmt; i++) { - int killDust = Dust.NewDust(Projectile.Center, 0, 0, 267, 0f, 0f, 0, newColor, 1f); + int killDust = Dust.NewDust(Projectile.Center, 0, 0, DustID.RainbowMk2, 0f, 0f, 0, newColor, 1f); Main.dust[killDust].position = Projectile.Center; Main.dust[killDust].velocity = spinningpoint.RotatedBy(MathHelper.TwoPi * i / dustAmt) * randomDustVelMod * (0.8f + Main.rand.NextFloat() * 0.4f); Main.dust[killDust].noGravity = true; @@ -190,7 +190,7 @@ namespace CalamityMod.Projectiles.Boss } for (float j = 0f; j < dustAmt; j++) { - int killDust2 = Dust.NewDust(Projectile.Center, 0, 0, 267, 0f, 0f, 0, newColor, 1f); + int killDust2 = Dust.NewDust(Projectile.Center, 0, 0, DustID.RainbowMk2, 0f, 0f, 0, newColor, 1f); Main.dust[killDust2].position = Projectile.Center; Main.dust[killDust2].velocity = spinningpoint.RotatedBy(MathHelper.TwoPi * j / dustAmt) * randomDustVelMod * (0.8f + Main.rand.NextFloat() * 0.4f); Dust dust = Main.dust[killDust2]; diff --git a/Projectiles/Boss/ProvidenceHolyRay.cs b/Projectiles/Boss/ProvidenceHolyRay.cs index 5baa4af276..0a5609302b 100644 --- a/Projectiles/Boss/ProvidenceHolyRay.cs +++ b/Projectiles/Boss/ProvidenceHolyRay.cs @@ -57,7 +57,7 @@ namespace CalamityMod.Projectiles.Boss } else Projectile.maxPenetrate = (int)Providence.BossMode.Day; - + bool scissorLasers = CalamityWorld.revenge || (Projectile.maxPenetrate != (int)Providence.BossMode.Day); Vector2? vector78 = null; @@ -144,11 +144,11 @@ namespace CalamityMod.Projectiles.Boss return false; bool dayTime = Projectile.maxPenetrate == (int)Providence.BossMode.Day; - Texture2D texture2D19 = dayTime ? ModContent.Request(Texture, AssetRequestMode.ImmediateLoad).Value : + Texture2D texture2D19 = dayTime ? ModContent.Request(Texture, AssetRequestMode.ImmediateLoad).Value : ModContent.Request("CalamityMod/Projectiles/Boss/ProvidenceHolyRayNight", AssetRequestMode.ImmediateLoad).Value; - Texture2D texture2D20 = dayTime ? ModContent.Request("CalamityMod/ExtraTextures/Lasers/ProvidenceHolyRayMid", AssetRequestMode.ImmediateLoad).Value : + Texture2D texture2D20 = dayTime ? ModContent.Request("CalamityMod/ExtraTextures/Lasers/ProvidenceHolyRayMid", AssetRequestMode.ImmediateLoad).Value : ModContent.Request("CalamityMod/ExtraTextures/Lasers/ProvidenceHolyRayMidNight", AssetRequestMode.ImmediateLoad).Value; - Texture2D texture2D21 = dayTime ? ModContent.Request("CalamityMod/ExtraTextures/Lasers/ProvidenceHolyRayEnd", AssetRequestMode.ImmediateLoad).Value : + Texture2D texture2D21 = dayTime ? ModContent.Request("CalamityMod/ExtraTextures/Lasers/ProvidenceHolyRayEnd", AssetRequestMode.ImmediateLoad).Value : ModContent.Request("CalamityMod/ExtraTextures/Lasers/ProvidenceHolyRayEndNight", AssetRequestMode.ImmediateLoad).Value; float rayDrawLength = Projectile.localAI[1]; //length of laser @@ -198,7 +198,7 @@ namespace CalamityMod.Projectiles.Boss { if (projHitbox.Intersects(targetHitbox)) return true; - + float useless = 0f; if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + Projectile.velocity * Projectile.localAI[1], 22f * Projectile.scale, ref useless)) return true; diff --git a/Projectiles/Boss/RavagerBlast.cs b/Projectiles/Boss/RavagerBlast.cs index ec7e63500d..61b4becedc 100644 --- a/Projectiles/Boss/RavagerBlast.cs +++ b/Projectiles/Boss/RavagerBlast.cs @@ -1,10 +1,10 @@ -using CalamityMod.Projectiles.BaseProjectiles; +using System; +using System.IO; +using System.Linq; +using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; -using System; -using System.IO; -using System.Linq; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -61,7 +61,6 @@ namespace CalamityMod.Projectiles.Boss Projectile.tileCollide = false; Projectile.timeLeft = 200; Projectile.Calamity().DealsDefenseDamage = true; - CooldownSlot = ImmunityCooldownID.Bosses; } public override void SendExtraAI(BinaryWriter writer) @@ -119,7 +118,7 @@ namespace CalamityMod.Projectiles.Boss // Can hit if white (regardless of condition) or blue only if the player is (close to) still public override bool CanHitPlayer(Player target) => (!blue || target.velocity.Length() <= 0.25f) && Projectile.scale >= 0.5f; - + public override bool PreDraw(ref Color lightColor) { // This should never happen, but just in case- diff --git a/Projectiles/Boss/RavagerBlaster.cs b/Projectiles/Boss/RavagerBlaster.cs index 5bff5ee0a7..a8b5432bab 100644 --- a/Projectiles/Boss/RavagerBlaster.cs +++ b/Projectiles/Boss/RavagerBlaster.cs @@ -1,9 +1,9 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { @@ -22,7 +22,6 @@ namespace CalamityMod.Projectiles.Boss Projectile.ignoreWater = true; Projectile.tileCollide = false; Projectile.timeLeft = 180; - CooldownSlot = ImmunityCooldownID.Bosses; } public override void AI() @@ -37,7 +36,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.velocity = Vector2.Zero; Projectile.netUpdate = true; Projectile.rotation = (float)Math.Atan2(storedVelocity.Y, storedVelocity.X) - MathHelper.PiOver2; - + SoundEngine.PlaySound(SANSCharge, Projectile.Center); //Funny Gaster Blaster sounds } else if (Projectile.ai[0] >= 55f) diff --git a/Projectiles/Boss/RavagerFlame.cs b/Projectiles/Boss/RavagerFlame.cs index 3902567863..69f81fa5da 100644 --- a/Projectiles/Boss/RavagerFlame.cs +++ b/Projectiles/Boss/RavagerFlame.cs @@ -1,9 +1,9 @@ using CalamityMod.Events; using CalamityMod.World; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { @@ -31,7 +31,7 @@ namespace CalamityMod.Projectiles.Boss { for (int i = 0; i < 2; i++) { - int icyFlame = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 135, 0f, 0f, 100, default, 3f); + int icyFlame = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.IceTorch, 0f, 0f, 100, default, 3f); Main.dust[icyFlame].noGravity = true; Main.dust[icyFlame].velocity *= 0f; } diff --git a/Projectiles/Boss/RedLightning.cs b/Projectiles/Boss/RedLightning.cs index 7f0a8ad5b8..ce86806f2b 100644 --- a/Projectiles/Boss/RedLightning.cs +++ b/Projectiles/Boss/RedLightning.cs @@ -1,7 +1,7 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; +using System; using System.IO; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -56,10 +56,10 @@ namespace CalamityMod.Projectiles.Boss Projectile.oldPos[0] = Projectile.position; if (Projectile.velocity == Vector2.Zero) { - float dustRotation = Projectile.rotation + MathHelper.PiOver2 + ((Main.rand.Next(2) == 1) ? -1f : 1f) * MathHelper.PiOver2; + float dustRotation = Projectile.rotation + MathHelper.PiOver2 + ((Main.rand.NextBool(2)) ? -1f : 1f) * MathHelper.PiOver2; float randDustRotateMod = (float)Main.rand.NextDouble() * 2f + 2f; Vector2 dustVelocity = new Vector2((float)Math.Cos((double)dustRotation) * randDustRotateMod, (float)Math.Sin((double)dustRotation) * randDustRotateMod); - int redDust = Dust.NewDust(Projectile.oldPos[Projectile.oldPos.Length - 1], 0, 0, 60, dustVelocity.X, dustVelocity.Y, 0, default, 1f); + int redDust = Dust.NewDust(Projectile.oldPos[Projectile.oldPos.Length - 1], 0, 0, DustID.RedTorch, dustVelocity.X, dustVelocity.Y, 0, default, 1f); Main.dust[redDust].noGravity = true; Main.dust[redDust].scale = 1.7f; } @@ -88,14 +88,14 @@ namespace CalamityMod.Projectiles.Boss return; } } - if (Main.rand.Next(Projectile.extraUpdates) == 0) + if (Main.rand.NextBool(Projectile.extraUpdates)) { for (int k = 0; k < 2; k = inc + 1) { - float extraDustRotate = Projectile.rotation + ((Main.rand.Next(2) == 1) ? -1f : 1f) * MathHelper.PiOver2; + float extraDustRotate = Projectile.rotation + ((Main.rand.NextBool(2)) ? -1f : 1f) * MathHelper.PiOver2; float extraRandRotate = (float)Main.rand.NextDouble() * 0.8f + 1f; Vector2 dustVelocity = new Vector2((float)Math.Cos((double)extraDustRotate) * extraRandRotate, (float)Math.Sin((double)extraDustRotate) * extraRandRotate); - int extraRedDust = Dust.NewDust(Projectile.Center, 0, 0, 60, dustVelocity.X, dustVelocity.Y, 0, default, 1f); + int extraRedDust = Dust.NewDust(Projectile.Center, 0, 0, DustID.RedTorch, dustVelocity.X, dustVelocity.Y, 0, default, 1f); Main.dust[extraRedDust].noGravity = true; Main.dust[extraRedDust].scale = 1.2f; inc = k; @@ -103,7 +103,7 @@ namespace CalamityMod.Projectiles.Boss if (Main.rand.NextBool(5)) { Vector2 moreDustRotation = Projectile.velocity.RotatedBy((double)MathHelper.PiOver2, default(Vector2)) * ((float)Main.rand.NextDouble() - 0.5f) * (float)Projectile.width; - int moreExtraRedDust = Dust.NewDust(Projectile.Center + moreDustRotation - Vector2.One * 4f, 8, 8, 60, 0f, 0f, 100, default, 1.5f); + int moreExtraRedDust = Dust.NewDust(Projectile.Center + moreDustRotation - Vector2.One * 4f, 8, 8, DustID.RedTorch, 0f, 0f, 100, default, 1.5f); Dust dust = Main.dust[moreExtraRedDust]; dust.velocity *= 0.5f; Main.dust[moreExtraRedDust].velocity.Y = -Math.Abs(Main.dust[moreExtraRedDust].velocity.Y); @@ -156,10 +156,10 @@ namespace CalamityMod.Projectiles.Boss goto IL_25092; - IL_25086: +IL_25086: randomLightningMovement = lightningYRotation; - IL_25092: +IL_25092: if (Projectile.velocity != Vector2.Zero) { Projectile.localAI[0] += randomLightningMovement.X * (float)(Projectile.extraUpdates + 1) * 2f * projSpeed; diff --git a/Projectiles/Boss/RedLightningFeather.cs b/Projectiles/Boss/RedLightningFeather.cs index c3a4960d09..b1177cb551 100644 --- a/Projectiles/Boss/RedLightningFeather.cs +++ b/Projectiles/Boss/RedLightningFeather.cs @@ -1,10 +1,10 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { @@ -89,7 +89,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1, ModContent.Request(Texture).Value, false); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1, Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value, false); return false; } @@ -108,14 +108,14 @@ namespace CalamityMod.Projectiles.Boss SoundEngine.PlaySound(SoundID.Item109, Projectile.Center); for (int j = 0; j < 6; j++) { - Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 100, default, 1.5f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RedTorch, 0f, 0f, 100, default, 1.5f); } for (int k = 0; k < 10; k++) { - int redDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 0, default, 2.5f); + int redDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RedTorch, 0f, 0f, 0, default, 2.5f); Main.dust[redDust].noGravity = true; Main.dust[redDust].velocity *= 3f; - redDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 100, default, 1.5f); + redDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RedTorch, 0f, 0f, 100, default, 1.5f); Main.dust[redDust].velocity *= 2f; Main.dust[redDust].noGravity = true; } diff --git a/Projectiles/Boss/SCalBrimstoneFireblast.cs b/Projectiles/Boss/SCalBrimstoneFireblast.cs index e47e4e401c..fce044dea7 100644 --- a/Projectiles/Boss/SCalBrimstoneFireblast.cs +++ b/Projectiles/Boss/SCalBrimstoneFireblast.cs @@ -1,16 +1,18 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Events; +using CalamityMod.NPCs; +using CalamityMod.NPCs.SupremeCalamitas; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; -using Terraria.ModLoader; -using Terraria.ID; using Terraria.Audio; -using CalamityMod.NPCs.SupremeCalamitas; -using CalamityMod.NPCs; +using Terraria.ID; +using Terraria.ModLoader; +using static Humanizer.In; +using CalamityMod.Particles; namespace CalamityMod.Projectiles.Boss { @@ -18,6 +20,8 @@ namespace CalamityMod.Projectiles.Boss { public new string LocalizationCategory => "Projectiles.Boss"; public static readonly SoundStyle ImpactSound = new("CalamityMod/Sounds/Custom/SCalSounds/BrimstoneFireblastImpact"); + public bool withinRange = false; + public bool setLifetime = false; public override void SetStaticDefaults() { Main.projFrames[Projectile.type] = 5; @@ -33,6 +37,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.penetrate = 1; Projectile.Opacity = 0f; Projectile.timeLeft = 150; + Projectile.tileCollide = false; CooldownSlot = ImmunityCooldownID.Bosses; } @@ -51,10 +56,13 @@ namespace CalamityMod.Projectiles.Boss Lighting.AddLight(Projectile.Center, 0.9f * Projectile.Opacity, 0f, 0f); - if (Projectile.ai[1] == 1f) - Projectile.Opacity = MathHelper.Clamp(Projectile.timeLeft / 60f, 0f, 1f); - else - Projectile.Opacity = MathHelper.Clamp(1f - ((Projectile.timeLeft - 90) / 60f), 0f, 1f); + if (!withinRange) + { + if (Projectile.ai[2] == 1f) + Projectile.Opacity = MathHelper.Clamp(Projectile.timeLeft / 60f, 0f, 1f); + else + Projectile.Opacity = MathHelper.Clamp(1f - ((Projectile.timeLeft - 130) / 20f), 0f, 1f); + } Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; @@ -64,31 +72,94 @@ namespace CalamityMod.Projectiles.Boss SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); } - float inertia = revenge ? 80f : 100f; - float homeSpeed = revenge ? 20f : 15f; - float minDist = 40f; int target = (int)Projectile.ai[0]; - if (target >= 0 && Main.player[target].active && !Main.player[target].dead) + + if (!withinRange) { - if (Projectile.Distance(Main.player[target].Center) > minDist) + float inertia = revenge ? 80f : 100f; + float homeSpeed = revenge ? 13f : 9f; + float minDist = 40f; + if (target >= 0 && Main.player[target].active && !Main.player[target].dead) { - Vector2 moveDirection = Projectile.SafeDirectionTo(Main.player[target].Center, Vector2.UnitY); - Projectile.velocity = (Projectile.velocity * (inertia - 1f) + moveDirection * homeSpeed) / inertia; + if (Projectile.Distance(Main.player[target].Center) > minDist) + { + Vector2 moveDirection = Projectile.SafeDirectionTo(Main.player[target].Center, Vector2.UnitY); + Projectile.velocity = (Projectile.velocity * (inertia - 1f) + moveDirection * homeSpeed) / inertia; + } + } + else + { + if (Projectile.ai[0] != -1f) + { + Projectile.ai[0] = -1f; + Projectile.netUpdate = true; + } } } + + float targetDist; + if (target != -1 && !Main.player[target].dead && Main.player[target].active && Main.player[target] != null) + targetDist = Vector2.Distance(Main.player[target].Center, Projectile.Center); else + targetDist = 1000; + + if (Projectile.ai[1] == 2f && !withinRange && Main.rand.NextBool()) { - if (Projectile.ai[0] != -1f) + SparkParticle orb = new SparkParticle(Projectile.Center - Projectile.velocity + Main.rand.NextVector2Circular(20, 20), -Projectile.velocity * Main.rand.NextFloat(0.1f, 1f), false, 14, Main.rand.NextFloat(0.35f, 0.6f), (Main.rand.NextBool() ? Color.Lerp(Color.Red, Color.Magenta, 0.5f) : Color.Red) * Projectile.Opacity); + GeneralParticleHandler.SpawnParticle(orb); + } + if ((Projectile.timeLeft == 1 && !withinRange) || (targetDist < 224 && Projectile.Opacity == 1f)) // When within 14 blocks of player or when it runs out of time + { + if (!setLifetime) { - Projectile.ai[0] = -1f; - Projectile.netUpdate = true; + Projectile.timeLeft = 60; + setLifetime = true; + } + withinRange = true; + } + if (withinRange && Projectile.ai[2] == 0f) + { + Projectile.velocity *= 0.9f; + for (int i = 0; i < 2; i++) + { + Dust failShotDust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(3) ? 60 : 114); + failShotDust.noGravity = true; + failShotDust.velocity = new Vector2(4, 4).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1.3f); + failShotDust.scale = Main.rand.NextFloat(0.7f, 1.8f); + } + if (Projectile.timeLeft <= 40) + { + if (Projectile.Opacity > 0) + Projectile.Opacity -= 0.05f; + } + if (Projectile.timeLeft == 30) + { + Projectile.Opacity = 0; + Projectile.velocity *= 0; + for (int i = 0; i < 2; i++) + { + Particle bloom = new BloomParticle(Projectile.Center, Vector2.Zero, new Color(121, 21, 77), 0.1f, 0.7f, 30, false); + GeneralParticleHandler.SpawnParticle(bloom); + if (Projectile.ai[2] == 1f) + bloom.Lifetime = 0; + } + } + if (Projectile.timeLeft == 15) + { + Particle bloom = new BloomParticle(Projectile.Center, Vector2.Zero, Color.Red, 0.1f, 0.65f, 15, false); + GeneralParticleHandler.SpawnParticle(bloom); + } + if (Projectile.timeLeft == 8) + { + Particle bloom = new BloomParticle(Projectile.Center, Vector2.Zero, Color.White, 0.1f, 0.5f, 8, false); + GeneralParticleHandler.SpawnParticle(bloom); } } } public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; int frameHeight = texture.Height / Main.projFrames[Projectile.type]; int drawStart = frameHeight * Projectile.frame; lightColor.R = (byte)(255 * Projectile.Opacity); @@ -113,7 +184,7 @@ namespace CalamityMod.Projectiles.Boss if (info.Damage <= 0 || Projectile.Opacity != 1f) return; - target.AddBuff(ModContent.BuffType(), 180, true); + target.AddBuff(ModContent.BuffType(), 240, true); } public override void OnKill(int timeLeft) @@ -126,43 +197,39 @@ namespace CalamityMod.Projectiles.Boss bool revenge = CalamityWorld.revenge || bossRush; bool expertMode = Main.expertMode || bossRush; - if (Projectile.ai[1] == 0f) + if (Projectile.ai[2] == 0f) { if (Projectile.owner == Main.myPlayer) { int totalProjectiles = bossRush ? 20 : death ? 16 : revenge ? 14 : expertMode ? 12 : 8; float radians = MathHelper.TwoPi / totalProjectiles; int type = ModContent.ProjectileType(); - float velocity = 7f; + float velocity = 8f; Vector2 spinningPoint = new Vector2(0f, -velocity); for (int k = 0; k < totalProjectiles; k++) { Vector2 velocity2 = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity2, type, (int)Math.Round(Projectile.damage * 0.75), 0f, Projectile.owner, 0f, 1f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity2, type, (int)Math.Round(Projectile.damage * 0.75), 0f, Projectile.owner, 0f, Projectile.ai[1], velocity * 1.5f); } } - } - int dustType = (int)CalamityDusts.Brimstone; - if (CalamityGlobalNPC.SCal != -1) - { - if (Main.npc[CalamityGlobalNPC.SCal].active) + if (Projectile.ai[1] == 2f) { - if (Main.npc[CalamityGlobalNPC.SCal].ModNPC().cirrus) - dustType = (int)CalamityDusts.PurpleCosmilite; + for (int i = 0; i < 18; i++) + { + Vector2 velocity = new Vector2(12, 12).RotatedByRandom(100); + PointParticle spark2 = new PointParticle(Projectile.Center + velocity, velocity * Main.rand.NextFloat(0.3f, 1f), false, 15, 1.1f, (Main.rand.NextBool() ? Color.Lerp(Color.Red, Color.Magenta, 0.5f) : Color.Red) * 0.6f); + GeneralParticleHandler.SpawnParticle(spark2); + } + for (int i = 0; i < 18; i++) + { + Dust failShotDust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(3) ? 60 : 114); + failShotDust.noGravity = true; + failShotDust.velocity = new Vector2(16, 16).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1.3f); + failShotDust.scale = Main.rand.NextFloat(0.75f, 1.3f); + } } } - - Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 50, default, 1f); - for (int j = 0; j < 10; j++) - { - int redFire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 0, default, 1.5f); - Main.dust[redFire].noGravity = true; - Main.dust[redFire].velocity *= 3f; - redFire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 50, default, 1f); - Main.dust[redFire].velocity *= 2f; - Main.dust[redFire].noGravity = true; - } } } } diff --git a/Projectiles/Boss/SCalBrimstoneGigablast.cs b/Projectiles/Boss/SCalBrimstoneGigablast.cs index 2d9a1cf7df..c0c1fab63b 100644 --- a/Projectiles/Boss/SCalBrimstoneGigablast.cs +++ b/Projectiles/Boss/SCalBrimstoneGigablast.cs @@ -1,16 +1,17 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Events; +using CalamityMod.NPCs; +using CalamityMod.NPCs.SupremeCalamitas; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; -using Terraria.ModLoader; -using Terraria.ID; using Terraria.Audio; -using CalamityMod.NPCs.SupremeCalamitas; -using CalamityMod.NPCs; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Particles; namespace CalamityMod.Projectiles.Boss { @@ -18,7 +19,8 @@ namespace CalamityMod.Projectiles.Boss { public new string LocalizationCategory => "Projectiles.Boss"; public static readonly SoundStyle ImpactSound = new("CalamityMod/Sounds/Custom/SCalSounds/BrimstoneGigablastImpact"); - + public bool withinRange = false; + public bool setLifetime = false; public override void SetStaticDefaults() { Main.projFrames[Projectile.type] = 6; @@ -34,6 +36,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.penetrate = 1; Projectile.timeLeft = 120; Projectile.Opacity = 0f; + Projectile.tileCollide = false; CooldownSlot = ImmunityCooldownID.Bosses; } @@ -48,10 +51,13 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.frame > 5) Projectile.frame = 0; - if (Projectile.ai[1] == 1f) - Projectile.Opacity = MathHelper.Clamp(Projectile.timeLeft / 60f, 0f, 1f); - else - Projectile.Opacity = MathHelper.Clamp(1f - ((Projectile.timeLeft - 60) / 60f), 0f, 1f); + if (!withinRange) + { + if (Projectile.ai[2] == 1f) + Projectile.Opacity = MathHelper.Clamp(Projectile.timeLeft / 60f, 0f, 1f); + else + Projectile.Opacity = MathHelper.Clamp(1f - ((Projectile.timeLeft - 130) / 20f), 0f, 1f); + } Lighting.AddLight(Projectile.Center, 0.9f * Projectile.Opacity, 0f, 0f); @@ -64,23 +70,86 @@ namespace CalamityMod.Projectiles.Boss } int target = Player.FindClosest(Projectile.Center, 1, 1); - float projSpeed = Projectile.velocity.Length(); - Vector2 playerVec = Main.player[target].Center - Projectile.Center; - playerVec.Normalize(); - playerVec *= projSpeed; - Projectile.velocity = (Projectile.velocity * 24f + playerVec) / 25f; - Projectile.velocity.Normalize(); - Projectile.velocity *= projSpeed; + + if (!withinRange) + { + float projSpeed = Projectile.velocity.Length(); + Vector2 playerVec = Main.player[target].Center - Projectile.Center; + playerVec.Normalize(); + playerVec *= projSpeed; + Projectile.velocity = (Projectile.velocity * 24f + playerVec) / 25f; + Projectile.velocity.Normalize(); + Projectile.velocity *= projSpeed; + } + + float targetDist; + if (target != -1 && !Main.player[target].dead && Main.player[target].active && Main.player[target] != null) + targetDist = Vector2.Distance(Main.player[target].Center, Projectile.Center); + else + targetDist = 1000; + + if (Projectile.ai[1] == 2f && !withinRange && Main.rand.NextBool()) + { + SparkParticle orb = new SparkParticle(Projectile.Center - Projectile.velocity + Main.rand.NextVector2Circular(30, 30), -Projectile.velocity * Main.rand.NextFloat(0.1f, 1f), false, 14, Main.rand.NextFloat(0.5f, 0.75f), (Main.rand.NextBool() ? Color.Lerp(Color.Red, Color.Magenta, 0.5f) : Color.Red) * Projectile.Opacity); + GeneralParticleHandler.SpawnParticle(orb); + } + if ((Projectile.timeLeft == 1 && !withinRange) || (targetDist < 224 && Projectile.Opacity == 1f)) // When within 14 blocks of player or when it runs out of time + { + if (!setLifetime) + { + Projectile.timeLeft = 60; + setLifetime = true; + } + withinRange = true; + } + if (withinRange && Projectile.ai[2] == 0f) + { + Projectile.velocity *= 0.9f; + for (int i = 0; i < 2; i++) + { + Dust failShotDust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(3) ? 60 : 114); + failShotDust.noGravity = true; + failShotDust.velocity = new Vector2(4, 4).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1.3f); + failShotDust.scale = Main.rand.NextFloat(0.7f, 1.8f); + } + if (Projectile.timeLeft <= 40) + { + if (Projectile.Opacity > 0) + Projectile.Opacity -= 0.05f; + } + if (Projectile.timeLeft == 30) + { + Projectile.Opacity = 0; + Projectile.velocity *= 0; + for (int i = 0; i < 2; i++) + { + Particle bloom = new BloomParticle(Projectile.Center, Vector2.Zero, new Color(121, 21, 77), 0.1f, 0.85f, 30, false); + GeneralParticleHandler.SpawnParticle(bloom); + if (Projectile.ai[2] == 1f) + bloom.Lifetime = 0; + } + } + if (Projectile.timeLeft == 15) + { + Particle bloom = new BloomParticle(Projectile.Center, Vector2.Zero, Color.Red, 0.1f, 0.8f, 15, false); + GeneralParticleHandler.SpawnParticle(bloom); + } + if (Projectile.timeLeft == 8) + { + Particle bloom = new BloomParticle(Projectile.Center, Vector2.Zero, Color.White, 0.1f, 0.7f, 8, false); + GeneralParticleHandler.SpawnParticle(bloom); + } + } } public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; int frameHeight = texture.Height / Main.projFrames[Projectile.type]; int drawStart = frameHeight * Projectile.frame; lightColor.R = (byte)(255 * Projectile.Opacity); - if (CalamityGlobalNPC.SCal != -1) + if (CalamityGlobalNPC.SCal != -1 && NPC.AnyNPCs(ModContent.NPCType()) == true) { if (Main.npc[CalamityGlobalNPC.SCal].active) { @@ -100,7 +169,7 @@ namespace CalamityMod.Projectiles.Boss if (info.Damage <= 0 || Projectile.Opacity != 1f) return; - target.AddBuff(ModContent.BuffType(), 180, true); + target.AddBuff(ModContent.BuffType(), 300, true); } public override void OnKill(int timeLeft) @@ -113,45 +182,39 @@ namespace CalamityMod.Projectiles.Boss bool revenge = CalamityWorld.revenge || bossRush; bool expertMode = Main.expertMode || bossRush; - if (Projectile.ai[1] == 0f) + if (Projectile.ai[2] == 0f) { if (Projectile.owner == Main.myPlayer) { int totalProjectiles = bossRush ? 44 : death ? 36 : revenge ? 32 : expertMode ? 28 : 20; float radians = MathHelper.TwoPi / totalProjectiles; int type = ModContent.ProjectileType(); - float velocity = 5f; + float velocity = 6.5f; Vector2 spinningPoint = new Vector2(0f, -velocity); for (int k = 0; k < totalProjectiles; k++) { Vector2 velocity2 = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity2, type, (int)Math.Round(Projectile.damage * 0.75), 0f, Projectile.owner, 0f, 1f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity2, type, (int)Math.Round(Projectile.damage * 0.75), 0f, Projectile.owner, 0f, Projectile.ai[1], velocity * 1.5f); } } - } - int dustType = (int)CalamityDusts.Brimstone; - if (CalamityGlobalNPC.SCal != -1) - { - if (Main.npc[CalamityGlobalNPC.SCal].active) + if (Projectile.ai[1] == 2f) { - if (Main.npc[CalamityGlobalNPC.SCal].ModNPC().cirrus) - dustType = (int)CalamityDusts.PurpleCosmilite; + for (int i = 0; i < 25; i++) + { + Vector2 velocity = new Vector2(15, 15).RotatedByRandom(100); + PointParticle spark2 = new PointParticle(Projectile.Center + velocity, velocity * Main.rand.NextFloat(0.3f, 1f), false, 15, 1.25f, (Main.rand.NextBool() ? Color.Lerp(Color.Red, Color.Magenta, 0.5f) : Color.Red) * 0.6f); + GeneralParticleHandler.SpawnParticle(spark2); + } + for (int i = 0; i < 25; i++) + { + Dust failShotDust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(3) ? 60 : 114); + failShotDust.noGravity = true; + failShotDust.velocity = new Vector2(20, 20).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1.3f); + failShotDust.scale = Main.rand.NextFloat(0.9f, 1.8f); + } } } - - for (int j = 0; j < 2; j++) - Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 50, default, 1f); - - for (int k = 0; k < 20; k++) - { - int redFire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 0, default, 1.5f); - Main.dust[redFire].noGravity = true; - Main.dust[redFire].velocity *= 3f; - redFire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 50, default, 1f); - Main.dust[redFire].velocity *= 2f; - Main.dust[redFire].noGravity = true; - } } } } diff --git a/Projectiles/Boss/SCalRitualDrama.cs b/Projectiles/Boss/SCalRitualDrama.cs index 74d8e31bb8..f72cbabdbf 100644 --- a/Projectiles/Boss/SCalRitualDrama.cs +++ b/Projectiles/Boss/SCalRitualDrama.cs @@ -1,11 +1,13 @@ using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.Summon; using CalamityMod.NPCs.SupremeCalamitas; +using CalamityMod.Particles; using CalamityMod.Skies; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { @@ -30,6 +32,22 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { + if (Projectile.timeLeft == 689) + { + for (int i = 0; i < 2; i++) + { + Particle bloom = new BloomParticle(Projectile.Center, Vector2.Zero, Color.Lerp(Color.Red, Color.Magenta, 0.3f), 0f, 0.55f, 270, false); + GeneralParticleHandler.SpawnParticle(bloom); + } + Particle bloom2 = new BloomParticle(Projectile.Center, Vector2.Zero, Color.White, 0f, 0.5f, 270, false); + GeneralParticleHandler.SpawnParticle(bloom2); + } + if (Projectile.timeLeft == 689 - 180) + { + Particle bloom = new BloomParticle(Projectile.Center, Vector2.Zero, new Color(121, 21, 77), 0f, 0.85f, 90, false); + GeneralParticleHandler.SpawnParticle(bloom); + } + // If needed, these effects may continue after the ritual timer, to ensure that there are no awkward // background changes between the time it takes for SCal to appear after this projectile is gone. // If SCal is already present, this does not happen. @@ -55,13 +73,14 @@ namespace CalamityMod.Projectiles.Boss int fireReleaseRate = Time > 150f ? 2 : 1; for (int i = 0; i < fireReleaseRate; i++) { - if (Main.rand.NextBool(4)) + if (Main.rand.NextBool()) { - Dust brimstone = Dust.NewDustPerfect(Projectile.Center + new Vector2(Main.rand.NextFloat(-20f, 24f), Main.rand.NextFloat(10f, 18f)), 267); - brimstone.scale = Main.rand.NextFloat(0.7f, 1f); - brimstone.color = Color.Lerp(Color.Orange, Color.Red, Main.rand.NextFloat()); + float variance = Main.rand.NextFloat(-25f, 25f); + Dust brimstone = Dust.NewDustPerfect(Projectile.Center + new Vector2(variance, 20), 267); + brimstone.scale = Main.rand.NextFloat(0.35f, 1.2f); + brimstone.color = Main.rand.NextBool() ? Color.Red : new Color(121, 21, 77); brimstone.fadeIn = 0.7f; - brimstone.velocity = -Vector2.UnitY * Main.rand.NextFloat(1.5f, 2.8f); + brimstone.velocity = -Vector2.UnitY.RotatedBy(variance * 0.02f) * Main.rand.NextFloat(1.1f, 2.1f) * (Time * 0.023f); brimstone.noGravity = true; } } @@ -71,11 +90,12 @@ namespace CalamityMod.Projectiles.Boss public void SummonSCal() { + Vector2 spawnPosition = Projectile.Center - new Vector2(53f, 39f); // Summon SCal serverside. // All the other acoustic and visual effects can happen client-side. if (Main.netMode != NetmodeID.MultiplayerClient) { - NPC scal = CalamityUtils.SpawnBossBetter(Projectile.Center - new Vector2(60f), ModContent.NPCType()); + NPC scal = CalamityUtils.SpawnBossBetter(spawnPosition, ModContent.NPCType()); if (Projectile.ai[1] == 1) { scal.ModNPC().cirrus = true; @@ -90,22 +110,22 @@ namespace CalamityMod.Projectiles.Boss Main.LocalPlayer.Calamity().GeneralScreenShakePower = Utils.GetLerpValue(3400f, 1560f, Main.LocalPlayer.Distance(Projectile.Center), true) * 16f; // Generate a dust explosion at the ritual's position. - float burstDirectionVariance = 3; - float burstSpeed = 14f; - for (int j = 0; j < 16; j++) + for (int i = 0; i < 90; i++) { - burstDirectionVariance += j * 2; - for (int k = 0; k < 40; k++) - { - int type = Projectile.ai[1] == 1 ? 69 : (int)CalamityDusts.Brimstone; - Dust burstDust = Dust.NewDustPerfect(Projectile.Center, type); - burstDust.scale = Main.rand.NextFloat(3.1f, 3.5f); - burstDust.position += Main.rand.NextVector2Circular(10f, 10f); - burstDust.velocity = Main.rand.NextVector2Square(-burstDirectionVariance, burstDirectionVariance).SafeNormalize(Vector2.UnitY) * burstSpeed; - burstDust.noGravity = true; - } - burstSpeed += 1.8f; + Dust spawnDust = Dust.NewDustPerfect(Projectile.Center, Projectile.ai[1] == 1 ? (int)CalamityDusts.PurpleCosmilite : (int)CalamityDusts.Brimstone, new Vector2(30, 30).RotatedByRandom(100) * Main.rand.NextFloat(0.05f, 1.2f)); + spawnDust.noGravity = true; + spawnDust.scale = Main.rand.NextFloat(1.2f, 2.3f); } + for (int i = 0; i < 40; i++) + { + Vector2 sparkVel = new Vector2(20, 20).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 1.1f); + GlowOrbParticle orb = new GlowOrbParticle(Projectile.Center + sparkVel * 2, sparkVel, false, 120, Main.rand.NextFloat(1.55f, 2.75f), Projectile.ai[1] == 1 ? Color.Magenta : Color.Red, true, true); + GeneralParticleHandler.SpawnParticle(orb); + } + Particle pulse = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, Projectile.ai[1] == 1 ? Color.Magenta : Color.Red, new Vector2(2f, 2f), 0, 0f, 2.7f, 60); + GeneralParticleHandler.SpawnParticle(pulse); + Particle pulse2 = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, Projectile.ai[1] == 1 ? Color.Magenta : new Color(121, 21, 77), new Vector2(2f, 2f), 0, 0f, 2.1f, 60); + GeneralParticleHandler.SpawnParticle(pulse2); } } } diff --git a/Projectiles/Boss/SandBlast.cs b/Projectiles/Boss/SandBlast.cs index 1cc9041def..53a8ae4d8c 100644 --- a/Projectiles/Boss/SandBlast.cs +++ b/Projectiles/Boss/SandBlast.cs @@ -1,9 +1,9 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { @@ -36,7 +36,7 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.Opacity > 1f) Projectile.Opacity = 1f; - int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 85, 0f, 0f, 100, default, 0.8f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.UnusedBrown, 0f, 0f, 100, default, 0.8f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 0f; } @@ -53,7 +53,7 @@ namespace CalamityMod.Projectiles.Boss randoAdjuster = rando3 / randoAdjuster; rando1 *= randoAdjuster; rando2 *= randoAdjuster; - int sandyDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 85, 0f, 0f, 100, default, 1.2f); + int sandyDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.UnusedBrown, 0f, 0f, 100, default, 1.2f); Main.dust[sandyDust].noGravity = true; Main.dust[sandyDust].position.X = Projectile.Center.X; Main.dust[sandyDust].position.Y = Projectile.Center.Y; diff --git a/Projectiles/Boss/SandPoisonCloud.cs b/Projectiles/Boss/SandPoisonCloud.cs index 5728f6d3b8..f769f853b0 100644 --- a/Projectiles/Boss/SandPoisonCloud.cs +++ b/Projectiles/Boss/SandPoisonCloud.cs @@ -1,9 +1,9 @@ -using CalamityMod.Buffs.StatDebuffs; +using System; +using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using System; namespace CalamityMod.Projectiles.Boss { @@ -70,6 +70,7 @@ namespace CalamityMod.Projectiles.Boss lightColor.R = (byte)(255 * Projectile.Opacity); lightColor.G = (byte)(255 * Projectile.Opacity); lightColor.B = (byte)(255 * Projectile.Opacity); + CalamityUtils.DrawProjectileWithBackglow(Projectile, new Color(255, 102, 56), lightColor, 3.75f); CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Boss/SandPoisonCloudOldDuke.cs b/Projectiles/Boss/SandPoisonCloudOldDuke.cs index c644588d14..c79b6a8733 100644 --- a/Projectiles/Boss/SandPoisonCloudOldDuke.cs +++ b/Projectiles/Boss/SandPoisonCloudOldDuke.cs @@ -1,9 +1,9 @@ -using CalamityMod.Buffs.StatDebuffs; +using System; +using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using System; namespace CalamityMod.Projectiles.Boss { @@ -70,6 +70,7 @@ namespace CalamityMod.Projectiles.Boss lightColor.R = (byte)(255 * Projectile.Opacity); lightColor.G = (byte)(255 * Projectile.Opacity); lightColor.B = (byte)(255 * Projectile.Opacity); + CalamityUtils.DrawProjectileWithBackglow(Projectile, new Color(66, 236, 113), lightColor, 3.75f); CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Boss/SandTooth.cs b/Projectiles/Boss/SandTooth.cs index f2ae2e532c..2278a12abd 100644 --- a/Projectiles/Boss/SandTooth.cs +++ b/Projectiles/Boss/SandTooth.cs @@ -1,5 +1,5 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Projectiles/Boss/ScavengerLaser.cs b/Projectiles/Boss/ScavengerLaser.cs index 9003cd2f52..418907350e 100644 --- a/Projectiles/Boss/ScavengerLaser.cs +++ b/Projectiles/Boss/ScavengerLaser.cs @@ -1,17 +1,18 @@ -using CalamityMod.Events; +using System.IO; +using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; -using System.IO; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { public class ScavengerLaser : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Boss"; + public override void SetStaticDefaults() { Main.projFrames[Projectile.type] = 5; @@ -27,7 +28,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.tileCollide = false; Projectile.penetrate = -1; Projectile.alpha = 255; - Projectile.timeLeft = 600; + Projectile.timeLeft = 900; } public override void SendExtraAI(BinaryWriter writer) @@ -45,6 +46,7 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; Projectile.frameCounter++; if (Projectile.frameCounter > 5) @@ -61,7 +63,7 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.alpha < 40) { - int laserDust = Dust.NewDust(Projectile.Center - Vector2.One * 5f, 10, 10, 244, -Projectile.velocity.X / 3f, -Projectile.velocity.Y / 3f, 150, Color.Transparent, 0.6f); + int laserDust = Dust.NewDust(Projectile.Center - Vector2.One * 5f, 10, 10, DustID.CopperCoin, -Projectile.velocity.X / 3f, -Projectile.velocity.Y / 3f, 150, Color.Transparent, 0.6f); Main.dust[laserDust].noGravity = true; } @@ -77,10 +79,14 @@ namespace CalamityMod.Projectiles.Boss return; } + Vector2 maxVelocity = new Vector2(death ? 13.2f : 12f, death ? 13.2f : 12f); + float maxAcceleration = death ? 0.44f : 0.4f; + float timeBeforeHoming = death ? 30f : 45f; + float distanceAboveTargetBeforeHomingDownward = death ? 400f : 480f; if (Projectile.ai[0] == 0f) { Projectile.localAI[0] += 1f; - if (Projectile.localAI[0] >= 45f) + if (Projectile.localAI[0] >= timeBeforeHoming) { Projectile.localAI[0] = 0f; Projectile.ai[0] = 1f; @@ -88,77 +94,101 @@ namespace CalamityMod.Projectiles.Boss Projectile.netUpdate = true; } - Projectile.velocity.X = Projectile.velocity.RotatedBy(0.0, default).X; - Projectile.velocity.X = MathHelper.Clamp(Projectile.velocity.X, -6f, 6f); + Projectile.velocity.X = Projectile.velocity.RotatedBy(0D).X; + Projectile.velocity.X = MathHelper.Clamp(Projectile.velocity.X, -maxVelocity.X, maxVelocity.X); - Projectile.velocity.Y = Projectile.velocity.Y - 0.08f; + Projectile.velocity.Y -= maxAcceleration * 0.2f; if (Projectile.velocity.Y > 0f) - Projectile.velocity.Y = Projectile.velocity.Y - 0.2f; - if (Projectile.velocity.Y < -7f) - Projectile.velocity.Y = -7f; + Projectile.velocity.Y -= maxAcceleration * 0.5f; + if (Projectile.velocity.Y < -maxVelocity.Y) + Projectile.velocity.Y = -maxVelocity.Y; } else if (Projectile.ai[0] == 1f) { - if (Main.player[(int)Projectile.ai[1]].Center.Y > Projectile.Center.Y + 90f) + if (Main.player[(int)Projectile.ai[1]].Center.Y > Projectile.Center.Y + distanceAboveTargetBeforeHomingDownward) { Projectile.ai[0] = 2f; Projectile.netUpdate = true; } - Projectile.velocity.X = Projectile.velocity.RotatedBy(0.0, default).X; - Projectile.velocity.X = MathHelper.Clamp(Projectile.velocity.X, -6f, 6f); + Projectile.velocity.X = Projectile.velocity.RotatedBy(0D).X; + Projectile.velocity.X = MathHelper.Clamp(Projectile.velocity.X, -maxVelocity.X, maxVelocity.X); - Projectile.velocity.Y = Projectile.velocity.Y - 0.08f; + Projectile.velocity.Y -= maxAcceleration * 0.2f; if (Projectile.velocity.Y > 0f) - Projectile.velocity.Y = Projectile.velocity.Y - 0.2f; - if (Projectile.velocity.Y < -7f) - Projectile.velocity.Y = -7f; + Projectile.velocity.Y -= maxAcceleration * 0.5f; + if (Projectile.velocity.Y < -maxVelocity.Y) + Projectile.velocity.Y = -maxVelocity.Y; } else if (Projectile.ai[0] == 2f) { if (Main.player[(int)Projectile.ai[1]].Center.Y < Projectile.Center.Y) Projectile.tileCollide = true; - float speed = revenge ? 9f : 7.5f; - Vector2 playerDistance = Main.player[(int)Projectile.ai[1]].Center - Projectile.Center; - if (playerDistance.Length() < 20f) + if (Projectile.Hitbox.Intersects(Main.player[(int)Projectile.ai[1]].Hitbox)) { Projectile.Kill(); return; } - playerDistance.Normalize(); - playerDistance *= 14f; - playerDistance = Vector2.Lerp(Projectile.velocity, playerDistance, 0.6f); - if (playerDistance.Y < speed) - playerDistance.Y = speed; + Vector2 projectileVelocity = playerDistance.SafeNormalize(Vector2.UnitY); + projectileVelocity *= maxVelocity.Length(); + projectileVelocity = Vector2.Lerp(Projectile.velocity, projectileVelocity, 0.6f); + if (projectileVelocity.Y < maxVelocity.Y) + projectileVelocity.Y = maxVelocity.Y; - float projVelocityMult = 0.4f; - if (Projectile.velocity.X < playerDistance.X) + if (Projectile.velocity.X < projectileVelocity.X) { - Projectile.velocity.X = Projectile.velocity.X + projVelocityMult; - if (Projectile.velocity.X < 0f && playerDistance.X > 0f) - Projectile.velocity.X = Projectile.velocity.X + projVelocityMult; + Projectile.velocity.X += maxAcceleration; + if (Projectile.velocity.X < 0f && projectileVelocity.X > 0f) + Projectile.velocity.X += maxAcceleration; } - else if (Projectile.velocity.X > playerDistance.X) + else if (Projectile.velocity.X > projectileVelocity.X) { - Projectile.velocity.X = Projectile.velocity.X - projVelocityMult; - if (Projectile.velocity.X > 0f && playerDistance.X < 0f) - Projectile.velocity.X = Projectile.velocity.X - projVelocityMult; + Projectile.velocity.X -= maxAcceleration; + if (Projectile.velocity.X > 0f && projectileVelocity.X < 0f) + Projectile.velocity.X -= maxAcceleration; } - if (Projectile.velocity.Y < playerDistance.Y) + if (Projectile.velocity.Y < projectileVelocity.Y) { - Projectile.velocity.Y = Projectile.velocity.Y + projVelocityMult; - if (Projectile.velocity.Y < 0f && playerDistance.Y > 0f) - Projectile.velocity.Y = Projectile.velocity.Y + projVelocityMult; + Projectile.velocity.Y += maxAcceleration; + if (Projectile.velocity.Y < 0f && projectileVelocity.Y > 0f) + Projectile.velocity.Y += maxAcceleration; } - else if (Projectile.velocity.Y > playerDistance.Y) + else if (Projectile.velocity.Y > projectileVelocity.Y) { - Projectile.velocity.Y = Projectile.velocity.Y - projVelocityMult; - if (Projectile.velocity.Y > 0f && playerDistance.Y < 0f) - Projectile.velocity.Y = Projectile.velocity.Y - projVelocityMult; + Projectile.velocity.Y -= maxAcceleration; + if (Projectile.velocity.Y > 0f && projectileVelocity.Y < 0f) + Projectile.velocity.Y -= maxAcceleration; + } + + // Fly away from other lasers + float pushForce = death ? 0.12f : 0.08f; + float pushDistance = death ? 60f : 40f; + for (int k = 0; k < Main.maxProjectiles; k++) + { + Projectile otherProj = Main.projectile[k]; + // Short circuits to make the loop as fast as possible + if (!otherProj.active || k == Projectile.whoAmI) + continue; + + // If the other projectile is indeed the same owned by the same player and they're too close, nudge them away. + bool sameProjType = otherProj.type == Projectile.type; + float taxicabDist = Vector2.Distance(Projectile.Center, otherProj.Center); + if (sameProjType && taxicabDist < pushDistance) + { + if (Projectile.position.X < otherProj.position.X) + Projectile.velocity.X -= pushForce; + else + Projectile.velocity.X += pushForce; + + if (Projectile.position.Y < otherProj.position.Y) + Projectile.velocity.Y -= pushForce; + else + Projectile.velocity.Y += pushForce; + } } } } @@ -171,10 +201,7 @@ namespace CalamityMod.Projectiles.Boss target.AddBuff(BuffID.OnFire, 180); } - public override Color? GetAlpha(Color lightColor) - { - return new Color(255, 50, 50, Projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) => new Color(255, 50, 50, Projectile.alpha); public override bool PreDraw(ref Color lightColor) { @@ -186,23 +213,22 @@ namespace CalamityMod.Projectiles.Boss { SoundEngine.PlaySound(SoundID.Zombie103, Projectile.Center); Projectile.position = Projectile.Center; - Projectile.width = Projectile.height = 64; + Projectile.width = Projectile.height = 96; Projectile.position.X = Projectile.position.X - (Projectile.width / 2); Projectile.position.Y = Projectile.position.Y - (Projectile.height / 2); - for (int i = 0; i < 2; i++) + + for (int i = 0; i < 3; i++) + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Smoke, 0f, 0f, 100, default, 1.5f); + + for (int j = 0; j < 30; j++) { - Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 31, 0f, 0f, 100, default, 1.5f); - } - for (int j = 0; j < 20; j++) - { - int killDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 0, default, 2.5f); + int killDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 0, default, 2.5f); Main.dust[killDust].noGravity = true; Main.dust[killDust].velocity *= 3f; - killDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 1.5f); + killDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 100, default, 1.5f); Main.dust[killDust].velocity *= 2f; Main.dust[killDust].noGravity = true; } - Projectile.Damage(); } } } diff --git a/Projectiles/Boss/ScavengerNuke.cs b/Projectiles/Boss/ScavengerNuke.cs index 41a14e4ea0..082ee5c27a 100644 --- a/Projectiles/Boss/ScavengerNuke.cs +++ b/Projectiles/Boss/ScavengerNuke.cs @@ -1,11 +1,11 @@ -using CalamityMod.Events; +using System; +using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { public class ScavengerNuke : ModProjectile, ILocalizedModType @@ -91,7 +91,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.Damage(); for (int i = 0; i < 30; i++) { - int nukeDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); + int nukeDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 100, default, 2f); Main.dust[nukeDust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -101,10 +101,10 @@ namespace CalamityMod.Projectiles.Boss } for (int j = 0; j < 40; j++) { - int nukeDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 3f); + int nukeDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 100, default, 3f); Main.dust[nukeDust2].noGravity = true; Main.dust[nukeDust2].velocity *= 5f; - nukeDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); + nukeDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 100, default, 2f); Main.dust[nukeDust2].velocity *= 2f; } diff --git a/Projectiles/Boss/ShaderainHostile.cs b/Projectiles/Boss/ShaderainHostile.cs index a38be847da..acb42b090b 100644 --- a/Projectiles/Boss/ShaderainHostile.cs +++ b/Projectiles/Boss/ShaderainHostile.cs @@ -1,6 +1,7 @@ using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss @@ -26,7 +27,7 @@ namespace CalamityMod.Projectiles.Boss public override void OnKill(int timeLeft) { - int shadeDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y + (float)Projectile.height - 2f), 2, 2, 14, 0f, 0f, 0, default, 1f); + int shadeDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y + (float)Projectile.height - 2f), 2, 2, DustID.Demonite, 0f, 0f, 0, default, 1f); Dust dust = Main.dust[shadeDust]; dust.position.X -= 2f; dust.alpha = 38; diff --git a/Projectiles/Boss/ShadowflameFireball.cs b/Projectiles/Boss/ShadowflameFireball.cs index 3d7dffc402..cb57385f1b 100644 --- a/Projectiles/Boss/ShadowflameFireball.cs +++ b/Projectiles/Boss/ShadowflameFireball.cs @@ -1,9 +1,9 @@ using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { @@ -56,7 +56,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.rotation += 0.3f * (float)Projectile.direction; - if (Projectile.ai[1] == 1f) + if (Projectile.ai[1] > 0f) { int playerTracker = (int)Player.FindClosest(Projectile.Center, 1, 1); Vector2 playerDirection = Main.player[playerTracker].Center - Projectile.Center; @@ -65,10 +65,11 @@ namespace CalamityMod.Projectiles.Boss { if (Projectile.ai[0] < 240f) { + float inertia = 25f; float scaleFactor = Projectile.velocity.Length(); playerDirection.Normalize(); playerDirection *= scaleFactor; - Projectile.velocity = (Projectile.velocity * 24f + playerDirection) / 25f; + Projectile.velocity = (Projectile.velocity * (inertia - 1f) + playerDirection) / inertia; Projectile.velocity.Normalize(); Projectile.velocity *= scaleFactor; } @@ -86,7 +87,7 @@ namespace CalamityMod.Projectiles.Boss if (info.Damage <= 0) return; - target.AddBuff(ModContent.BuffType(), 180, true); + target.AddBuff(ModContent.BuffType(), 120, true); } public override void OnKill(int timeLeft) diff --git a/Projectiles/Boss/Shadowflamethrower.cs b/Projectiles/Boss/Shadowflamethrower.cs index fff105c260..6221002bca 100644 --- a/Projectiles/Boss/Shadowflamethrower.cs +++ b/Projectiles/Boss/Shadowflamethrower.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.ai[0] > 7f) { int[] dustTypes = new int[] { 27, 27, 112, 173 }; - if(true) + if (true) { int dustType = dustTypes[Main.rand.Next(4)]; int dustID; @@ -69,7 +69,7 @@ namespace CalamityMod.Projectiles.Boss if (info.Damage <= 0) return; - target.AddBuff(ModContent.BuffType(), 300, true); + target.AddBuff(ModContent.BuffType(), 120, true); } } } diff --git a/Projectiles/Boss/SignusScythe.cs b/Projectiles/Boss/SignusScythe.cs index 9ec4ca3095..fba7051dee 100644 --- a/Projectiles/Boss/SignusScythe.cs +++ b/Projectiles/Boss/SignusScythe.cs @@ -1,10 +1,10 @@ -using CalamityMod.Buffs.StatDebuffs; +using System.IO; +using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; -using System.IO; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { public class SignusScythe : ModProjectile, ILocalizedModType @@ -54,7 +54,7 @@ namespace CalamityMod.Projectiles.Boss SoundEngine.PlaySound(SoundID.Item73, Projectile.Center); } - int shadowDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 1f); + int shadowDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, 0f, 0f, 100, default, 1f); Main.dust[shadowDust].noGravity = true; Main.dust[shadowDust].velocity *= 0f; @@ -97,7 +97,7 @@ namespace CalamityMod.Projectiles.Boss SoundEngine.PlaySound(SoundID.Item74, Projectile.Center); for (int i = 0; i < 5; i++) { - int killDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 1f); + int killDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, 0f, 0f, 100, default, 1f); Main.dust[killDust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -107,10 +107,10 @@ namespace CalamityMod.Projectiles.Boss } for (int j = 0; j < 10; j++) { - int killDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 1.5f); + int killDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, 0f, 0f, 100, default, 1.5f); Main.dust[killDust2].noGravity = true; Main.dust[killDust2].velocity *= 5f; - killDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 1f); + killDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, 0f, 0f, 100, default, 1f); Main.dust[killDust2].velocity *= 2f; } } diff --git a/Projectiles/Boss/SirenSong.cs b/Projectiles/Boss/SirenSong.cs index a72294880a..c119d5920f 100644 --- a/Projectiles/Boss/SirenSong.cs +++ b/Projectiles/Boss/SirenSong.cs @@ -1,6 +1,6 @@ -using CalamityMod.NPCs; +using System.IO; +using CalamityMod.NPCs; using Microsoft.Xna.Framework; -using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Projectiles/Boss/SkyFlare.cs b/Projectiles/Boss/SkyFlare.cs index 6375930d03..8a7349e2c2 100644 --- a/Projectiles/Boss/SkyFlare.cs +++ b/Projectiles/Boss/SkyFlare.cs @@ -3,9 +3,9 @@ using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { public class SkyFlare : ModProjectile, ILocalizedModType @@ -56,8 +56,8 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { - Texture2D texture2D13 = ModContent.Request(Texture).Value; - int framing = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; + Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + int framing = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; int y6 = framing * Projectile.frame; Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)framing / 2f), Projectile.scale, SpriteEffects.None, 0); return false; @@ -73,7 +73,7 @@ namespace CalamityMod.Projectiles.Boss Vector2 dustRotate = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; dustRotate = dustRotate.RotatedBy((double)((float)(i - (dustAmt / 2 - 1)) * 6.28318548f / (float)dustAmt), default) + Projectile.Center; Vector2 dustDirection = dustRotate - Projectile.Center; - int flareDust = Dust.NewDust(dustRotate + dustDirection, 0, 0, 244, dustDirection.X * 2f, dustDirection.Y * 2f, 100, default, 1.4f); + int flareDust = Dust.NewDust(dustRotate + dustDirection, 0, 0, DustID.CopperCoin, dustDirection.X * 2f, dustDirection.Y * 2f, 100, default, 1.4f); Main.dust[flareDust].noGravity = true; Main.dust[flareDust].noLight = true; Main.dust[flareDust].velocity = dustDirection; diff --git a/Projectiles/Boss/SkyFlareRevenge.cs b/Projectiles/Boss/SkyFlareRevenge.cs index bc3a7fbde6..8563018980 100644 --- a/Projectiles/Boss/SkyFlareRevenge.cs +++ b/Projectiles/Boss/SkyFlareRevenge.cs @@ -2,9 +2,9 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { @@ -46,8 +46,8 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { - Texture2D texture2D13 = ModContent.Request(Texture).Value; - int framing = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; + Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + int framing = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; int y6 = framing * Projectile.frame; Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)framing / 2f), Projectile.scale, SpriteEffects.None, 0); return false; @@ -67,7 +67,7 @@ namespace CalamityMod.Projectiles.Boss Vector2 dustSource = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; dustSource = dustSource.RotatedBy((double)((float)(d - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + Projectile.Center; Vector2 dustVel = dustSource - Projectile.Center; - int idx = Dust.NewDust(dustSource + dustVel, 0, 0, 244, dustVel.X * 2f, dustVel.Y * 2f, 100, default, 1.4f); + int idx = Dust.NewDust(dustSource + dustVel, 0, 0, DustID.CopperCoin, dustVel.X * 2f, dustVel.Y * 2f, 100, default, 1.4f); Main.dust[idx].noGravity = true; Main.dust[idx].noLight = true; Main.dust[idx].velocity = dustVel; diff --git a/Projectiles/Boss/SporeGasPlantera.cs b/Projectiles/Boss/SporeGasPlantera.cs index 395eca6ce9..3ab5f9af80 100644 --- a/Projectiles/Boss/SporeGasPlantera.cs +++ b/Projectiles/Boss/SporeGasPlantera.cs @@ -1,7 +1,7 @@ -using CalamityMod.World; +using System.IO; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -80,7 +80,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { // Changes the texture of the projectile - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; switch ((int)Projectile.ai[0]) { case 0: diff --git a/Projectiles/Boss/StormWeaverFrostWaveTelegraph.cs b/Projectiles/Boss/StormWeaverFrostWaveTelegraph.cs index edf43f9d7e..8682e81876 100644 --- a/Projectiles/Boss/StormWeaverFrostWaveTelegraph.cs +++ b/Projectiles/Boss/StormWeaverFrostWaveTelegraph.cs @@ -1,6 +1,6 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ModLoader; diff --git a/Projectiles/Boss/SupremeCataclysmFist.cs b/Projectiles/Boss/SupremeCataclysmFist.cs index 4dd718f5ab..c6aa6cdf6c 100644 --- a/Projectiles/Boss/SupremeCataclysmFist.cs +++ b/Projectiles/Boss/SupremeCataclysmFist.cs @@ -1,8 +1,14 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Accessories; +using CalamityMod.NPCs.SupremeCalamitas; +using CalamityMod.Particles; +using CalamityMod.Events; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -12,6 +18,9 @@ namespace CalamityMod.Projectiles.Boss { public new string LocalizationCategory => "Projectiles.Boss"; public ref float Time => ref Projectile.ai[0]; + public Vector2 shootVel; + public int rotDirection = 1; + public bool broIsAlive = true; public override void SetStaticDefaults() { @@ -20,7 +29,8 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - Projectile.width = Projectile.height = 44; + Projectile.width = 126; + Projectile.height = 54; Projectile.hostile = true; Projectile.ignoreWater = true; Projectile.tileCollide = false; @@ -32,46 +42,267 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { - // Fly in a sinusoidal wave. - Projectile.velocity.Y = (float)Math.Sin(Time / 5D) * 5f; + // Difficulty modes + bool bossRush = BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || bossRush; + bool revenge = CalamityWorld.revenge || bossRush; + bool expertMode = Main.expertMode || bossRush; + + // The Orb + if (Projectile.ai[2] >= 3) + { + if (Main.zenithWorld) + { + if (Projectile.timeLeft > 400) + { + shootVel = Projectile.velocity * 0.4f; + Projectile.timeLeft = 400; + rotDirection = Main.rand.NextBool() ? -1 : 1; + Projectile.velocity *= 6f; + broIsAlive = NPC.AnyNPCs(ModContent.NPCType()); + } + else + { + if (Time > 10) + Projectile.tileCollide = true; + else + Projectile.velocity *= 0.99f; + Projectile.rotation += 0.02f; + } + + if (Projectile.timeLeft == 1) + { + int points = 25; + float radians = MathHelper.TwoPi / points; + Vector2 spinningPoint = Vector2.Normalize(new Vector2(-4f, -4f)); + for (int b = 0; b < 2; b++) + { + float rotRando = Main.rand.NextFloat(0.1f, 2.5f); + for (int k = 0; k < points; k++) + { + Vector2 velocity = spinningPoint.RotatedBy(radians * k).RotatedBy(-0.45f * rotRando); + + Dust cataclysmdust = Dust.NewDustPerfect(Projectile.Center + velocity * (b == 0 ? 7 : 5), 279, velocity * (b == 0 ? 9 : 7)); + cataclysmdust.noGravity = true; + cataclysmdust.scale = Main.rand.NextFloat(1.3f, 1.9f); + cataclysmdust.color = Color.Red; + } + } + Projectile.Kill(); + } + + Vector2 vel = new Vector2(14, 14).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 2.5f); + Dust cataclysmdust2 = Dust.NewDustPerfect(Projectile.Center + vel * 2, 279, vel); + cataclysmdust2.noGravity = true; + cataclysmdust2.scale = Main.rand.NextFloat(0.9f, 1.2f); + cataclysmdust2.color = Color.Red; + } + else + { + if (Projectile.timeLeft > 240) + { + shootVel = Projectile.velocity * 0.4f; + Projectile.timeLeft = 240; + rotDirection = Main.rand.NextBool() ? -1 : 1; + Projectile.velocity *= 5.5f; + broIsAlive = NPC.AnyNPCs(ModContent.NPCType()); + } + else + { + float randSize = Main.rand.NextFloat(0.8f, 1.2f); + for (int i = 0; i < 2; i++) + { + Particle bloom = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Lerp(Color.Red, Color.Magenta, 0.5f), "CalamityMod/Particles/LargeBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 1.7f * randSize, 0f, 10); + GeneralParticleHandler.SpawnParticle(bloom); + } + Particle bloom3 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White * 0.9f, "CalamityMod/Particles/LargeBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 1.4f * randSize, 0f, 10); + GeneralParticleHandler.SpawnParticle(bloom3); + + Projectile.velocity *= 0.945f; + } + + // Adds rotation, but it's SUPER unfair a lot of the time + //shootVel = shootVel.RotatedBy(Time * 0.00011f * rotDirection); + + + if (Projectile.timeLeft == 205) // Fist direction telegraphs + { + for (int k = 0; k < 28; k++) + { + Vector2 vel1 = -shootVel * MathHelper.Clamp(Time * 0.1f, 1, 1.8f); + GlowSparkParticle spark = new GlowSparkParticle(Projectile.Center + vel1 * (9 + k * 11), vel1, false, 7, 0.17f, Color.Lerp(Color.Red, Color.Magenta, 0.5f) * 0.5f, new Vector2(0.9f, 0.4f), true, false); + GeneralParticleHandler.SpawnParticle(spark); + } + if (broIsAlive == false) + { + for (int k = 0; k < 28; k++) + { + Vector2 vel2 = (-shootVel * MathHelper.Clamp(Time * 0.1f, 1, 1.8f)).RotatedBy(MathHelper.ToRadians(120f)); + GlowSparkParticle spark2 = new GlowSparkParticle(Projectile.Center + vel2 * (9 + k * 11), vel2, false, 7, 0.17f, Color.Lerp(Color.Red, Color.Magenta, 0.5f) * 0.5f, new Vector2(0.9f, 0.4f), true, false); + GeneralParticleHandler.SpawnParticle(spark2); + } + for (int k = 0; k < 28; k++) + { + Vector2 vel3 = (-shootVel * MathHelper.Clamp(Time * 0.1f, 1, 1.8f)).RotatedBy(MathHelper.ToRadians(-120f)); + GlowSparkParticle spark3 = new GlowSparkParticle(Projectile.Center + vel3 * (9 + k * 11), vel3, false, 7, 0.17f, Color.Lerp(Color.Red, Color.Magenta, 0.5f) * 0.5f, new Vector2(0.9f, 0.4f), true, false); + GeneralParticleHandler.SpawnParticle(spark3); + } + } + } + + if (Projectile.timeLeft <= 200 && Time % 3 == 0) + { + Vector2 randPos = (-shootVel * 1.5f).RotatedByRandom(1) * Main.rand.NextFloat(5, 15); + int type = ModContent.ProjectileType(); + SoundEngine.PlaySound(SupremeCalamitas.BrimstoneShotSound with { Volume = 1.2f, Pitch = 0.55f }, Projectile.Center); + Projectile.NewProjectile(Projectile.GetSource_FromAI(), Projectile.Center + randPos, (-shootVel * MathHelper.Clamp(Time * 0.02f, 0.1f, 1.8f)) * Main.rand.NextFloat(0.75f, 1f), type, Projectile.damage, 0f, Main.myPlayer, 0f, Main.rand.Next(0, 1 + 1), 0); + } + if (Projectile.timeLeft <= 200 && Time % 3 == 0 && broIsAlive == false) + { + Vector2 randPos = (-shootVel * 1.5f).RotatedBy(MathHelper.ToRadians(120f)).RotatedByRandom(1) * Main.rand.NextFloat(5, 15); + Vector2 randPos2 = (-shootVel * 1.5f).RotatedBy(MathHelper.ToRadians(-120f)).RotatedByRandom(1) * Main.rand.NextFloat(5, 15); + int type = ModContent.ProjectileType(); + Projectile.NewProjectile(Projectile.GetSource_FromAI(), Projectile.Center + randPos, (-shootVel * MathHelper.Clamp(Time * 0.02f, 0.1f, 1.8f)).RotatedBy(MathHelper.ToRadians(120f)) * Main.rand.NextFloat(0.75f, 1f), type, Projectile.damage, 0f, Main.myPlayer, 0f, Main.rand.Next(0, 1 + 1), 0); + Projectile.NewProjectile(Projectile.GetSource_FromAI(), Projectile.Center + randPos2, (-shootVel * MathHelper.Clamp(Time * 0.02f, 0.1f, 1.8f)).RotatedBy(MathHelper.ToRadians(-120f)) * Main.rand.NextFloat(0.75f, 1f), type, Projectile.damage, 0f, Main.myPlayer, 0f, Main.rand.Next(0, 1 + 1), 0); + } + if (Projectile.timeLeft == 1) + { + int points = 25; + float radians = MathHelper.TwoPi / points; + Vector2 spinningPoint = Vector2.Normalize(new Vector2(-4f, -4f)); + for (int b = 0; b < 2; b++) + { + float rotRando = Main.rand.NextFloat(0.1f, 2.5f); + for (int k = 0; k < points; k++) + { + Vector2 velocity = spinningPoint.RotatedBy(radians * k).RotatedBy(-0.45f * rotRando); + + Dust cataclysmdust = Dust.NewDustPerfect(Projectile.Center + velocity * (b == 0 ? 7 : 5), 279, velocity * (b == 0 ? 9 : 7)); + cataclysmdust.noGravity = true; + cataclysmdust.scale = Main.rand.NextFloat(1.3f, 1.9f); + cataclysmdust.color = Color.Red; + } + } + Projectile.Kill(); + } + + Vector2 vel = new Vector2(14, 14).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 2.5f); + Dust cataclysmdust2 = Dust.NewDustPerfect(Projectile.Center + vel * 2, 279, vel); + cataclysmdust2.noGravity = true; + cataclysmdust2.scale = Main.rand.NextFloat(0.9f, 1.2f); + cataclysmdust2.color = Color.Red; + } + } + else if (Projectile.ai[2] <= 2) + { + // Rapid punches + if (Projectile.ai[2] == 1) + { + Projectile.extraUpdates = 2; + } + else // Regular punches + Projectile.velocity *= 1.0055f; + + // Orb mini fists + if (Projectile.ai[2] == 0) + { + Projectile.scale = 0.8f; + Projectile.extraUpdates = 2; + Projectile.Opacity = 1; + if (Projectile.timeLeft > 300) + Projectile.timeLeft = 300; + Projectile.velocity *= 1.006f; + } + + if (Main.zenithWorld && Projectile.ai[2] >= 3) + return; + + if (Projectile.velocity.X < 0f) + { + Projectile.spriteDirection = -1; + Projectile.rotation = (float)Math.Atan2(-Projectile.velocity.Y, -Projectile.velocity.X); + } + else + { + Projectile.spriteDirection = 1; + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X); + } + } // Decide frames. Projectile.frameCounter++; Projectile.frame = Projectile.frameCounter / 5 % Main.projFrames[Projectile.type]; // Fade in and handle visuals. - Projectile.Opacity = Utils.GetLerpValue(0f, 12f, Projectile.timeLeft, true) * Utils.GetLerpValue(1200f, 1188f, Projectile.timeLeft, true); - Projectile.spriteDirection = (Projectile.velocity.X > 0f).ToDirectionInt(); + if (Projectile.ai[2] < 3) + Projectile.Opacity = Utils.GetLerpValue(0f, 12f, Projectile.timeLeft, true) * Utils.GetLerpValue(1200f, 1193f, Projectile.timeLeft, true); + Time++; + if (NPC.AnyNPCs(ModContent.NPCType()) == false && !Main.zenithWorld) + { + Projectile.timeLeft = 1; + for (int k = 0; k < 10; k++) + { + Vector2 velocity = new Vector2(7, 7).RotatedByRandom(100) * Main.rand.NextFloat(0.8f, 1.2f); + + Dust dust = Dust.NewDustPerfect(Projectile.Center + velocity, 66, velocity * Main.rand.NextFloat(0.2f, 1f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(1.3f, 1.9f); + dust.color = Color.Lerp(Color.Red, Color.Magenta, 0.5f); + } + } + // Emit light. Lighting.AddLight(Projectile.Center, 0.5f * Projectile.Opacity, 0f, 0f); } public override bool PreDraw(ref Color lightColor) { + if (Main.zenithWorld && Projectile.ai[2] >= 3) + { + Texture2D ballTexture = ModContent.Request("CalamityMod/Projectiles/Boss/Basketball").Value; + Main.EntitySpriteDraw(ballTexture, Projectile.Center - Main.screenPosition, null, lightColor, Projectile.rotation, ballTexture.Size() * 0.5f, Projectile.scale / 1.8f, SpriteEffects.None, 0); + return false; + } + lightColor.R = (byte)(255 * Projectile.Opacity); SpriteEffects direction = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; if (Projectile.ai[1] == 1f) texture = ModContent.Request("CalamityMod/Projectiles/Boss/SupremeCataclysmFistAlt").Value; - Vector2 drawPosition = Projectile.Center - Main.screenPosition + Vector2.UnitY * Projectile.gfxOffY; - drawPosition.X -= Math.Sign(Projectile.velocity.X) * 40f; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; Rectangle frame = texture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); Main.EntitySpriteDraw(texture, drawPosition, frame, Projectile.GetAlpha(lightColor), Projectile.rotation, frame.Size() * 0.5f, Projectile.scale, direction, 0); return false; } - public override bool CanHitPlayer(Player target) => Projectile.Opacity >= 1f; + public override bool CanHitPlayer(Player target) => (Projectile.Opacity >= 1f || Projectile.ai[2] >= 3); public override void OnHitPlayer(Player target, Player.HurtInfo info) { if (info.Damage <= 0 || Projectile.Opacity != 1f) return; - target.AddBuff(ModContent.BuffType(), 120, true); + target.AddBuff(ModContent.BuffType(), 240, true); } + public override bool OnTileCollide(Vector2 oldVelocity) + { + SoundStyle b = new("CalamityMod/Sounds/Custom/Kickball"); + SoundEngine.PlaySound(b with { PitchVariance = 0.15f }, Projectile.Center); + + if (Projectile.velocity.X != oldVelocity.X) + { + Projectile.velocity.X = -oldVelocity.X; + } + if (Projectile.velocity.Y != oldVelocity.Y) + { + Projectile.velocity.Y = -oldVelocity.Y; + } + return false; + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, (Projectile.ai[2] >= 3 ? 90 : 35 * Projectile.scale), targetHitbox); } } diff --git a/Projectiles/Boss/SupremeCatastropheSlash.cs b/Projectiles/Boss/SupremeCatastropheSlash.cs index 2a53379e3a..9048168f99 100644 --- a/Projectiles/Boss/SupremeCatastropheSlash.cs +++ b/Projectiles/Boss/SupremeCatastropheSlash.cs @@ -1,9 +1,15 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; +using CalamityMod.Events; +using CalamityMod.World; +using CalamityMod.Particles; using Terraria.ModLoader; +using Terraria.Audio; +using CalamityMod.NPCs.SupremeCalamitas; namespace CalamityMod.Projectiles.Boss { @@ -11,6 +17,7 @@ namespace CalamityMod.Projectiles.Boss { public new string LocalizationCategory => "Projectiles.Boss"; public ref float Time => ref Projectile.ai[0]; + public bool dashSlashExplode = false; public override void SetStaticDefaults() { @@ -36,14 +43,151 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { + Time++; + + // Difficulty modes + bool bossRush = BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || bossRush; + bool revenge = CalamityWorld.revenge || bossRush; + bool expertMode = Main.expertMode || bossRush; + // Decide frames. Projectile.frameCounter++; Projectile.frame = Projectile.frameCounter / 7 % Main.projFrames[Projectile.type]; // Fade in and handle visuals. - Projectile.Opacity = Utils.GetLerpValue(0f, 8f, Projectile.timeLeft, true) * Utils.GetLerpValue(1500f, 1492f, Projectile.timeLeft, true); - Projectile.spriteDirection = (Projectile.velocity.X > 0f).ToDirectionInt(); - Time++; + if (Projectile.ai[2] < 4 && Projectile.ai[2] < 50) + Projectile.Opacity = Utils.GetLerpValue(0f, 8f, Projectile.timeLeft, true) * Utils.GetLerpValue(1500f, 1492f, Projectile.timeLeft, true); + + if (Projectile.velocity.X < 0f) + { + Projectile.spriteDirection = -1; + Projectile.rotation = (float)Math.Atan2(-Projectile.velocity.Y, -Projectile.velocity.X); + } + else + { + Projectile.spriteDirection = 1; + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X); + } + // Non dash slash trails + if (Projectile.ai[2] == 50) + { + Projectile.extraUpdates = 0; + if (Projectile.timeLeft > 30) + Projectile.timeLeft = 30; + Projectile.Opacity = 0f; + if (Main.rand.NextBool()) + { + Dust catastrophedust = Dust.NewDustPerfect(Projectile.Center, 66, -Projectile.velocity * Main.rand.NextFloat(0.1f, 1.5f)); + catastrophedust.noGravity = true; + catastrophedust.scale = Main.rand.NextFloat(0.5f, 0.7f); + catastrophedust.color = Color.DeepSkyBlue; + catastrophedust.alpha = 100; + } + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity.SafeNormalize(Vector2.UnitY) * 0.1f, ModContent.ProjectileType(), Projectile.damage, 0f, Main.myPlayer, 0f, 5, 3 + Time); + return; + } + if (Projectile.ai[2] == 1 || Projectile.ai[2] == 2) + { + // Rapid slashes + if (Projectile.ai[2] == 1) + Projectile.extraUpdates = 2; + else // Regular slashes + Projectile.velocity *= 1.0045f; + } + // Acceleration slashes + else if (Projectile.ai[2] == 3) + { + Projectile.extraUpdates = 5; + if (Time > 30) + Projectile.velocity *= 1.015f; + if (Main.rand.NextBool(3)) + { + Dust catastrophedust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(50, 50) - Projectile.velocity.SafeNormalize(Vector2.UnitY) * 8.5f, 66, -Projectile.velocity * Main.rand.NextFloat(0.2f, 1.2f)); + catastrophedust.noGravity = true; + catastrophedust.scale = Main.rand.NextFloat(0.5f, 0.7f); + catastrophedust.color = Color.DeepSkyBlue; + } + } + // Slash trails + else if (Projectile.ai[2] >= 4 && Projectile.ai[2] < 50) + { + Projectile.extraUpdates = 0; + if (Projectile.ai[1] == 5) // Non dash trails + { + if (Projectile.timeLeft == 1500) + { + Projectile.timeLeft = (death ? 35 : 45) - (int)(Projectile.ai[2] - 4); + SparkParticle spark1 = new SparkParticle(Projectile.Center, Projectile.velocity, false, 25, 5f, Color.DeepSkyBlue * 0.35f); + GeneralParticleHandler.SpawnParticle(spark1); + } + else if (Projectile.timeLeft == 1 && NPC.AnyNPCs(ModContent.NPCType()) == true) + { + dashSlashExplode = true; + VoidSparkParticle spark = new VoidSparkParticle(Projectile.Center, Projectile.velocity, false, 9, 0.7f, Color.Cyan * 0.7f); + GeneralParticleHandler.SpawnParticle(spark); + if (Projectile.ai[2] >= 4) + { + SoundStyle charge = new("CalamityMod/Sounds/Item/ExobladeBeamSlash"); + SoundEngine.PlaySound(charge with { Volume = 0.65f, Pitch = 0.8f }, Projectile.Center); + } + for (int i = 0; i < 3; i++) + { + Vector2 vel = new Vector2(14, 14).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 2.5f); + Dust catastrophedust = Dust.NewDustPerfect(Projectile.Center + vel * 2, 279, vel); + catastrophedust.noGravity = true; + catastrophedust.scale = Main.rand.NextFloat(1.2f, 1.8f); + catastrophedust.color = Color.DeepSkyBlue; + } + } + } + else // Dash trails + { + if (Projectile.timeLeft == 1500) + { + Projectile.timeLeft = 40 - (int)(Projectile.ai[2] - 4); + SparkParticle spark1 = new SparkParticle(Projectile.Center, Projectile.velocity, false, 25, 5f, Color.DeepSkyBlue * 0.35f); + GeneralParticleHandler.SpawnParticle(spark1); + SparkParticle spark2 = new SparkParticle(Projectile.Center + Projectile.velocity * 50, Projectile.velocity, false, 25, 5f, Color.DeepSkyBlue * 0.35f); + GeneralParticleHandler.SpawnParticle(spark2); + SparkParticle spark3 = new SparkParticle(Projectile.Center - Projectile.velocity * 50, Projectile.velocity, false, 25, 5f, Color.DeepSkyBlue * 0.35f); + GeneralParticleHandler.SpawnParticle(spark3); + } + else if (Projectile.timeLeft == 1 && NPC.AnyNPCs(ModContent.NPCType()) == true) + { + dashSlashExplode = true; + VoidSparkParticle spark = new VoidSparkParticle(Projectile.Center, Projectile.velocity, false, 9, 1.3f, Color.Cyan * 0.7f); + GeneralParticleHandler.SpawnParticle(spark); + if (Projectile.ai[2] >= 4) + { + SoundStyle charge = new("CalamityMod/Sounds/Item/ExobladeBeamSlash"); + SoundEngine.PlaySound(charge with { Volume = 0.65f, Pitch = 0.8f }, Projectile.Center); + } + for (int i = 0; i < 3; i++) + { + Vector2 vel = new Vector2(14, 14).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 2.5f); + Dust catastrophedust = Dust.NewDustPerfect(Projectile.Center + vel * 2, 279, vel); + catastrophedust.noGravity = true; + catastrophedust.scale = Main.rand.NextFloat(1.2f, 1.8f); + catastrophedust.color = Color.DeepSkyBlue; + } + } + } + } + + if (NPC.AnyNPCs(ModContent.NPCType()) == false && !Main.zenithWorld) + { + Projectile.timeLeft = 1; + for (int k = 0; k < 10; k++) + { + Vector2 velocity = new Vector2(7, 7).RotatedByRandom(100) * Main.rand.NextFloat(0.8f, 1.2f); + + Dust dust = Dust.NewDustPerfect(Projectile.Center + velocity, 66, velocity * Main.rand.NextFloat(0.2f, 1f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(1.3f, 1.9f); + dust.color = Color.Cyan; + } + } // Emit light. Lighting.AddLight(Projectile.Center, 0.5f * Projectile.Opacity, 0f, 0f); @@ -52,11 +196,11 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { SpriteEffects direction = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; if (Projectile.ai[1] == 0f) texture = ModContent.Request("CalamityMod/Projectiles/Boss/SupremeCatastropheSlashAlt").Value; - Vector2 drawPosition = Projectile.Center - Main.screenPosition + Vector2.UnitY * Projectile.gfxOffY; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; drawPosition -= Projectile.velocity.SafeNormalize(Vector2.UnitX) * 38f; Rectangle frame = texture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); @@ -71,14 +215,13 @@ namespace CalamityMod.Projectiles.Boss return false; } - public override bool CanHitPlayer(Player target) => Projectile.Opacity >= 1f; + public override bool CanHitPlayer(Player target) => Projectile.Opacity >= 1f && Projectile.ai[2] < 4 || dashSlashExplode && Projectile.ai[2] >= 4; public override void OnHitPlayer(Player target, Player.HurtInfo info) { - if (info.Damage <= 0 || Projectile.Opacity != 1f) + if (info.Damage <= 0 || Projectile.Opacity != 1f && Projectile.ai[2] < 4 || !dashSlashExplode && Projectile.ai[2] >= 4) return; - - target.AddBuff(ModContent.BuffType(), 120, true); } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, (Projectile.ai[1] == 5 ? 70 : Projectile.ai[2] >= 4 ? 100 : 43), targetHitbox); } } diff --git a/Projectiles/Boss/SwirlingFire.cs b/Projectiles/Boss/SwirlingFire.cs index 1272700ac8..a1d5261879 100644 --- a/Projectiles/Boss/SwirlingFire.cs +++ b/Projectiles/Boss/SwirlingFire.cs @@ -27,13 +27,13 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { Vector2 fireVelocity = (Time / 6f).ToRotationVector2() * Main.rand.NextFloat(1.7f, 2.2f); - Dust fire = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(3f, 3f), Main.zenithWorld || !Main.dayTime ? 267 : 6); + Dust fire = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(3f, 3f), Main.zenithWorld || !Main.IsItDay() ? 267 : 6); fire.velocity = fireVelocity.RotatedBy(MathHelper.PiOver2); fire.scale = Main.rand.NextFloat(1.3f, 1.45f); fire.noGravity = true; if (Main.zenithWorld) fire.color = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB); - else if (!Main.dayTime) + else if (!Main.IsItDay()) fire.color = Color.Lerp(Color.Cyan, Color.BlueViolet, Main.rand.NextFloat()); Dust.CloneDust(fire).velocity = fireVelocity.RotatedBy(-MathHelper.PiOver2); diff --git a/Projectiles/Boss/THanosSideLaser.cs b/Projectiles/Boss/THanosSideLaser.cs new file mode 100644 index 0000000000..4e6a1aa74a --- /dev/null +++ b/Projectiles/Boss/THanosSideLaser.cs @@ -0,0 +1,188 @@ +using System; +using System.IO; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Events; +using CalamityMod.NPCs.ExoMechs.Ares; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class THanosSideLaser : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Boss"; + public float TelegraphDelay + { + get => Projectile.ai[0]; + set => Projectile.ai[0] = value; + } + + public NPC ThingToAttachTo => Main.npc.IndexInRange((int)Projectile.ai[1]) ? Main.npc[(int)Projectile.ai[1]] : null; + + public Vector2 Destination; + public Vector2 Velocity; + public const float TelegraphTotalTime = 60f; + public const float TelegraphFadeTime = 30f; + public const float TelegraphWidth = 4200f; + public const float LaserVelocity = 7.5f; + + public override void SetStaticDefaults() + { + Main.projFrames[Projectile.type] = 4; + ProjectileID.Sets.DrawScreenCheckFluff[Projectile.type] = 10000; + } + + public override void SetDefaults() + { + Projectile.Calamity().DealsDefenseDamage = true; + Projectile.width = 22; + Projectile.height = 22; + Projectile.hostile = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.alpha = 255; + Projectile.penetrate = -1; + Projectile.extraUpdates = 1; + Projectile.timeLeft = 1200; + CooldownSlot = ImmunityCooldownID.Bosses; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(Projectile.extraUpdates); + writer.WriteVector2(Destination); + writer.WriteVector2(Velocity); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + Projectile.extraUpdates = reader.ReadInt32(); + Destination = reader.ReadVector2(); + Velocity = reader.ReadVector2(); + } + + public override void AI() + { + // Determine the relative opacities for each player based on their distance. + // This has a lower bound of 0.35 to prevent the laser from going completely invisible and players getting hit by cheap shots. + if (Projectile.localAI[0] == 0f) + { + Projectile.localAI[0] = 1f; + Projectile.netUpdate = true; + } + + Projectile.frameCounter++; + if (Projectile.frameCounter > 12) + { + Projectile.frame++; + Projectile.frameCounter = 0; + } + if (Projectile.frame > 3) + Projectile.frame = 0; + + // Fade in after telegraphs have faded. + if (TelegraphDelay > TelegraphTotalTime) + { + if (Projectile.alpha > 0) + Projectile.alpha -= 25; + if (Projectile.alpha < 0) + Projectile.alpha = 0; + // If a velocity is in reserve, set the true velocity to it and make it as "taken" by setting it to <0,0> + if (Velocity != Vector2.Zero) + { + Projectile.extraUpdates = Main.getGoodWorld ? 4 : 3; + Projectile.velocity = Velocity * (BossRushEvent.BossRushActive ? 1.25f : 1f); + Velocity = Vector2.Zero; + Projectile.netUpdate = true; + } + + // Direction and rotation. + if (Projectile.velocity.X < 0f) + { + Projectile.spriteDirection = -1; + Projectile.rotation = (float)Math.Atan2((double)-(double)Projectile.velocity.Y, (double)-(double)Projectile.velocity.X); + } + else + { + Projectile.spriteDirection = 1; + Projectile.rotation = Projectile.velocity.ToRotation(); + } + } + else if (Velocity == Vector2.Zero) + { + Velocity = Projectile.velocity; + Projectile.velocity = Vector2.Zero; + Projectile.netUpdate = true; + + // Direction and rotation. + if (Projectile.velocity.X < 0f) + { + Projectile.spriteDirection = -1; + Projectile.rotation = (float)Math.Atan2((double)-(double)Velocity.Y, (double)-(double)Velocity.X); + } + else + { + Projectile.spriteDirection = 1; + Projectile.rotation = (float)Math.Atan2((double)Velocity.Y, (double)Velocity.X); + } + } + TelegraphDelay++; + } + + public override bool CanHitPlayer(Player target) => TelegraphDelay > TelegraphTotalTime; + + public override void OnHitPlayer(Player target, Player.HurtInfo info) + { + if (info.Damage <= 0 || TelegraphDelay <= TelegraphTotalTime) + return; + + target.AddBuff(ModContent.BuffType(), 120); + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + return CalamityUtils.CircularHitboxCollision(projHitbox.Center(), Projectile.Size.Length() * 0.5f, targetHitbox); + } + + public override bool PreDraw(ref Color lightColor) + { + if (TelegraphDelay >= TelegraphTotalTime) + { + lightColor.R = (byte)(255 * Projectile.Opacity); + lightColor.G = (byte)(255 * Projectile.Opacity); + lightColor.B = (byte)(255 * Projectile.Opacity); + Vector2 drawOffset = Projectile.velocity.SafeNormalize(Vector2.Zero) * -30f; + Projectile.Center += drawOffset; + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + Projectile.Center -= drawOffset; + return false; + } + + Texture2D laserTelegraph = ModContent.Request("CalamityMod/ExtraTextures/LaserWallTelegraphBeam").Value; + + float yScale = 2f; + if (TelegraphDelay < TelegraphFadeTime) + yScale = MathHelper.Lerp(0f, 2f, TelegraphDelay / 15f); + if (TelegraphDelay > TelegraphTotalTime - TelegraphFadeTime) + yScale = MathHelper.Lerp(2f, 0f, (TelegraphDelay - (TelegraphTotalTime - TelegraphFadeTime)) / 15f); + + Vector2 scaleInner = new Vector2(TelegraphWidth / laserTelegraph.Width, yScale); + Vector2 origin = laserTelegraph.Size() * new Vector2(0f, 0.5f); + Vector2 scaleOuter = scaleInner * new Vector2(1f, 2.2f); + + Color colorOuter = Color.Lerp(Color.Blue, Color.CornflowerBlue, TelegraphDelay / TelegraphTotalTime * 2f % 1f); // Iterate through blue and cornflower blue once and then flash. + Color colorInner = Color.Lerp(colorOuter, Color.White, 0.75f); + + colorOuter *= 0.6f; + colorInner *= 0.6f; + + Main.EntitySpriteDraw(laserTelegraph, Projectile.Center - Main.screenPosition, null, colorInner, Velocity.ToRotation(), origin, scaleInner, SpriteEffects.None, 0); + Main.EntitySpriteDraw(laserTelegraph, Projectile.Center - Main.screenPosition, null, colorOuter, Velocity.ToRotation(), origin, scaleOuter, SpriteEffects.None, 0); + return false; + } + } +} diff --git a/Projectiles/Boss/THanosSideLaser.png b/Projectiles/Boss/THanosSideLaser.png new file mode 100644 index 0000000000..182e92d4be Binary files /dev/null and b/Projectiles/Boss/THanosSideLaser.png differ diff --git a/Projectiles/Boss/ThanatosBeamStart.cs b/Projectiles/Boss/ThanatosBeamStart.cs index f1d952691b..79a3657cbb 100644 --- a/Projectiles/Boss/ThanatosBeamStart.cs +++ b/Projectiles/Boss/ThanatosBeamStart.cs @@ -1,19 +1,19 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using System.IO; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Events; using CalamityMod.NPCs.ExoMechs.Thanatos; using CalamityMod.Projectiles.BaseProjectiles; +using CalamityMod.Sounds; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; +using ReLogic.Content; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using ReLogic.Content; -using CalamityMod.Sounds; namespace CalamityMod.Projectiles.Boss { @@ -33,7 +33,7 @@ namespace CalamityMod.Projectiles.Boss public override float Lifetime => 180; public override Color LaserOverlayColor => new(250, 250, 250, 100); public override Color LightCastColor => Color.White; - public override Texture2D LaserBeginTexture => ModContent.Request(Texture).Value; + public override Texture2D LaserBeginTexture => Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; public override Texture2D LaserMiddleTexture => ModContent.Request("CalamityMod/ExtraTextures/Lasers/ThanatosBeamMiddle", AssetRequestMode.ImmediateLoad).Value; public override Texture2D LaserEndTexture => ModContent.Request("CalamityMod/ExtraTextures/Lasers/ThanatosBeamEnd", AssetRequestMode.ImmediateLoad).Value; @@ -149,7 +149,7 @@ namespace CalamityMod.Projectiles.Boss float distanceBetweenProjectiles = bossRush ? 160f : death ? 256f : revenge ? 288f : 320f; Vector2 laserFirePosition = Main.npc[OwnerIndex].Center + beamDirection * distanceBetweenProjectiles; int laserCount = (int)(LaserLength / distanceBetweenProjectiles); - int type = ModContent.ProjectileType(); + int type = ModContent.ProjectileType(); int damage = Projectile.GetProjectileDamage(Main.npc[OwnerIndex].type); for (int i = 0; i < laserCount; i++) { @@ -242,7 +242,7 @@ namespace CalamityMod.Projectiles.Boss if (info.Damage <= 0) return; - target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), 240); } public override bool CanHitPlayer(Player target) => OwnerIsValid && Projectile.scale >= 0.5f; diff --git a/Projectiles/Boss/ThanatosBeamStart.png b/Projectiles/Boss/ThanatosBeamStart.png index e565bcab1e..b10fc03d86 100644 Binary files a/Projectiles/Boss/ThanatosBeamStart.png and b/Projectiles/Boss/ThanatosBeamStart.png differ diff --git a/Projectiles/Boss/ThanatosBeamTelegraph.cs b/Projectiles/Boss/ThanatosBeamTelegraph.cs index 51370a2db8..9eb50bc6c2 100644 --- a/Projectiles/Boss/ThanatosBeamTelegraph.cs +++ b/Projectiles/Boss/ThanatosBeamTelegraph.cs @@ -1,6 +1,6 @@ -using Microsoft.Xna.Framework; +using System.IO; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -84,7 +84,7 @@ namespace CalamityMod.Projectiles.Boss Vector2 scaleInner = new Vector2(TelegraphWidth / laserTelegraph.Width, verticalScale); Vector2 scaleOuter = scaleInner * new Vector2(1f, 2.2f); - Color colorOuter = Color.Lerp(Color.Red, Color.Crimson, Time / Lifetime * 2f % 1f); // Iterate through crimson and red twice and then flash. + Color colorOuter = Color.Lerp(Color.Red, Color.CornflowerBlue, Time / Lifetime); // Smoothly scale from red to blue, as if heating up. colorOuter = Color.Lerp(colorOuter, Color.White, Utils.GetLerpValue(40f, 0f, Projectile.timeLeft, true) * 0.8f); Color colorInner = Color.Lerp(colorOuter, Color.White, 0.5f); diff --git a/Projectiles/Boss/ThanatosLaser.cs b/Projectiles/Boss/ThanatosLaser.cs index 7cc6f5dfa5..24e844b4d6 100644 --- a/Projectiles/Boss/ThanatosLaser.cs +++ b/Projectiles/Boss/ThanatosLaser.cs @@ -1,11 +1,11 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using System.IO; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Events; using CalamityMod.NPCs.ExoMechs.Ares; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System.IO; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -113,7 +113,7 @@ namespace CalamityMod.Projectiles.Boss else { Projectile.spriteDirection = 1; - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X); + Projectile.rotation = Projectile.velocity.ToRotation(); } } else if (Velocity == Vector2.Zero) @@ -176,7 +176,7 @@ namespace CalamityMod.Projectiles.Boss else { Projectile.spriteDirection = 1; - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X); + Projectile.rotation = Projectile.velocity.ToRotation(); } } else if (Destination == Vector2.Zero) diff --git a/Projectiles/Boss/ThornBallSpike.cs b/Projectiles/Boss/ThornBallSpike.cs index eca5b20949..f3db9317e9 100644 --- a/Projectiles/Boss/ThornBallSpike.cs +++ b/Projectiles/Boss/ThornBallSpike.cs @@ -1,7 +1,8 @@ -using Microsoft.CodeAnalysis; +using System; +using Microsoft.CodeAnalysis; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -10,7 +11,9 @@ namespace CalamityMod.Projectiles.Boss public class ThornBallSpike : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Boss"; + private const float MaxVelocity = 12f; + private const int TimeLeft = 600; public override void SetStaticDefaults() @@ -26,31 +29,65 @@ namespace CalamityMod.Projectiles.Boss Projectile.hostile = true; Projectile.penetrate = 1; Projectile.timeLeft = TimeLeft; + Projectile.tileCollide = false; } public override void AI() { if (Projectile.velocity.Length() < MaxVelocity) { - Projectile.velocity *= 1.035f; + Projectile.velocity *= 1.05f; if (Projectile.velocity.Length() > MaxVelocity) { Projectile.velocity.Normalize(); Projectile.velocity *= MaxVelocity; } } + + if (Projectile.timeLeft < TimeLeft - 30) + Projectile.tileCollide = true; + + int dustType = DustID.Venom; + int dust = Dust.NewDust(new Vector2(Projectile.position.X - Projectile.velocity.X + 2f, Projectile.position.Y + 2f - Projectile.velocity.Y), 8, 8, dustType, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, Projectile.alpha); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= -0.25f; + Main.dust[dust].fadeIn = 1.5f; Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver2; } - public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(BuffID.Poisoned, 90); + public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(BuffID.Venom, 90); public override bool PreDraw(ref Color lightColor) { - lightColor = Color.White; - lightColor.A = (byte)Projectile.alpha; + if (Projectile.timeLeft > TimeLeft - 5) + return false; + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } + + public override void OnKill(int timeLeft) + { + SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); + + for (int i = 2; i < 16; i++) + { + float oldXVel = Projectile.oldVelocity.X * (15f / (float)i); + float oldYVel = Projectile.oldVelocity.Y * (15f / (float)i); + + float dustScale = 1.4f; + int dustType = DustID.Venom; + int dust = Dust.NewDust(new Vector2(Projectile.oldPosition.X - oldXVel * 0.5f, Projectile.oldPosition.Y - oldYVel * 0.5f), 8, 8, dustType, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, Projectile.alpha, default, dustScale); + Main.dust[dust].noGravity = true; + Main.dust[dust].fadeIn = 1.5f; + + dustScale = 1.2f; + dust = Dust.NewDust(new Vector2(Projectile.oldPosition.X - oldXVel * 0.5f, Projectile.oldPosition.Y - oldYVel * 0.5f), 8, 8, dustType, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, Projectile.alpha, default, dustScale); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0.1f; + Main.dust[dust].fadeIn = 1.5f; + } + } } } diff --git a/Projectiles/Boss/ToxicCloud.cs b/Projectiles/Boss/ToxicCloud.cs index 27a9dcf091..81f4051732 100644 --- a/Projectiles/Boss/ToxicCloud.cs +++ b/Projectiles/Boss/ToxicCloud.cs @@ -1,11 +1,11 @@ -using CalamityMod.Buffs.StatDebuffs; +using System; +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using System; namespace CalamityMod.Projectiles.Boss { @@ -74,6 +74,7 @@ namespace CalamityMod.Projectiles.Boss lightColor.R = (byte)(255 * Projectile.Opacity); lightColor.G = (byte)(255 * Projectile.Opacity); lightColor.B = (byte)(255 * Projectile.Opacity); + CalamityUtils.DrawProjectileWithBackglow(Projectile, new Color(66, 236, 113), lightColor, 3.75f); CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Boss/UnstableCrimulanGlob.cs b/Projectiles/Boss/UnstableCrimulanGlob.cs index 4ab56de3ec..5885c845be 100644 --- a/Projectiles/Boss/UnstableCrimulanGlob.cs +++ b/Projectiles/Boss/UnstableCrimulanGlob.cs @@ -1,7 +1,7 @@ -using CalamityMod.Events; +using System; +using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -59,7 +59,7 @@ namespace CalamityMod.Projectiles.Boss { Color dustColor = Color.Crimson; dustColor.A = 150; - int dust = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 4, 0f, 0f, Projectile.alpha, dustColor); + int dust = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.TintableDust, 0f, 0f, Projectile.alpha, dustColor); Main.dust[dust].noGravity = true; } diff --git a/Projectiles/Boss/UnstableEbonianGlob.cs b/Projectiles/Boss/UnstableEbonianGlob.cs index 096dc7e817..e0f48c3df2 100644 --- a/Projectiles/Boss/UnstableEbonianGlob.cs +++ b/Projectiles/Boss/UnstableEbonianGlob.cs @@ -1,7 +1,7 @@ -using CalamityMod.Events; +using System; +using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -41,7 +41,7 @@ namespace CalamityMod.Projectiles.Boss { Color dustColor = Color.Lavender; dustColor.A = 150; - int dust = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 4, 0f, 0f, Projectile.alpha, dustColor); + int dust = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.TintableDust, 0f, 0f, Projectile.alpha, dustColor); Main.dust[dust].noGravity = true; } diff --git a/Projectiles/Boss/VileClot.cs b/Projectiles/Boss/VileClot.cs index 318e4c2e35..b793e0bd72 100644 --- a/Projectiles/Boss/VileClot.cs +++ b/Projectiles/Boss/VileClot.cs @@ -1,9 +1,9 @@ using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { @@ -31,8 +31,8 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.velocity.Length() < 12f) Projectile.velocity *= 1.01f; - int vileDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), - Projectile.width, Projectile.height, (int)CalamityDusts.SulfurousSeaAcid, Projectile.velocity.X * 0.1f, Projectile.velocity.Y * 0.1f, 100, default, 1.5f); + int vileDust = Dust.NewDust(Projectile.position, + Projectile.width, Projectile.height, (int)CalamityDusts.SulphurousSeaAcid, Projectile.velocity.X * 0.1f, Projectile.velocity.Y * 0.1f, 100, default, 1.5f); Main.dust[vileDust].noGravity = true; Projectile.rotation += 0.3f * (float)Projectile.direction; @@ -51,11 +51,11 @@ namespace CalamityMod.Projectiles.Boss SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); for (int i = 0; i < 6; i++) { - int killDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.SulfurousSeaAcid, -Projectile.velocity.X * 0.2f, -Projectile.velocity.Y * 0.2f, 100, default, 2.5f); + int killDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.SulphurousSeaAcid, -Projectile.velocity.X * 0.2f, -Projectile.velocity.Y * 0.2f, 100, default, 2.5f); Main.dust[killDust].noGravity = true; Dust dust = Main.dust[killDust]; dust.velocity *= 2f; - killDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.SulfurousSeaAcid, -Projectile.velocity.X * 0.2f, -Projectile.velocity.Y * 0.2f, 100, default, 1.2f); + killDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.SulphurousSeaAcid, -Projectile.velocity.X * 0.2f, -Projectile.velocity.Y * 0.2f, 100, default, 1.2f); dust = Main.dust[killDust]; dust.velocity *= 2f; } diff --git a/Projectiles/Boss/WaterSpear.cs b/Projectiles/Boss/WaterSpear.cs index a3323c537b..0580bbf1e2 100644 --- a/Projectiles/Boss/WaterSpear.cs +++ b/Projectiles/Boss/WaterSpear.cs @@ -1,6 +1,6 @@ -using Microsoft.Xna.Framework; -using System; +using System; using System.IO; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -47,7 +47,7 @@ namespace CalamityMod.Projectiles.Boss { for (int i = 0; i < 10; i++) { - int waterDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 2f); + int waterDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Water, 0f, 0f, 100, default, 2f); Main.dust[waterDust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -83,7 +83,7 @@ namespace CalamityMod.Projectiles.Boss { for (int k = 0; k < 5; k++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 33, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Water, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } } diff --git a/Projectiles/Boss/YharonFireball.cs b/Projectiles/Boss/YharonFireball.cs index 61e420c2a0..aa5a68dc69 100644 --- a/Projectiles/Boss/YharonFireball.cs +++ b/Projectiles/Boss/YharonFireball.cs @@ -1,7 +1,7 @@ -using CalamityMod.Buffs.DamageOverTime; +using System.IO; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -11,8 +11,8 @@ namespace CalamityMod.Projectiles.Boss public class YharonFireball : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Boss"; - private float speedX = -3f; - private float speedX2 = -5f; + private float speedX = -1f; + private float speedX2 = -2f; public override void SetStaticDefaults() { @@ -68,7 +68,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; int frameHeight = texture.Height / Main.projFrames[Projectile.type]; int frameY = frameHeight * Projectile.frame; Rectangle rectangle = new Rectangle(0, frameY, texture.Width, frameHeight); @@ -95,26 +95,26 @@ namespace CalamityMod.Projectiles.Boss { for (int x = 0; x < 3; x++) { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, speedX, -50f, ModContent.ProjectileType(), Projectile.damage, 0f, Main.myPlayer, 0f, 0f); - speedX += 3f; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, speedX, -6f, ModContent.ProjectileType(), Projectile.damage, 0f, Main.myPlayer); + speedX += 1f; } for (int x = 0; x < 2; x++) { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, speedX2, -75f, ModContent.ProjectileType(), Projectile.damage, 0f, Main.myPlayer, 0f, 0f); - speedX2 += 10f; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, speedX2, -6f, ModContent.ProjectileType(), Projectile.damage, 0f, Main.myPlayer); + speedX2 += 4f; } } Projectile.ExpandHitboxBy(144); for (int d = 0; d < 2; d++) { - Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 55, 0f, 0f, 50, default, 1.5f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Pixie, 0f, 0f, 50, default, 1.5f); } for (int d = 0; d < 20; d++) { - int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 55, 0f, 0f, 0, default, 2.5f); + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Pixie, 0f, 0f, 0, default, 2.5f); Main.dust[idx].noGravity = true; Main.dust[idx].velocity *= 3f; - idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 55, 0f, 0f, 50, default, 1.5f); + idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Pixie, 0f, 0f, 50, default, 1.5f); Main.dust[idx].velocity *= 2f; Main.dust[idx].noGravity = true; } diff --git a/Projectiles/Boss/YharonFireball2.cs b/Projectiles/Boss/YharonFireball2.cs index fb323d085f..52db19e003 100644 --- a/Projectiles/Boss/YharonFireball2.cs +++ b/Projectiles/Boss/YharonFireball2.cs @@ -1,10 +1,10 @@ -using CalamityMod.Buffs.DamageOverTime; +using System.IO; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; -using System.IO; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { @@ -16,6 +16,10 @@ namespace CalamityMod.Projectiles.Boss public static readonly SoundStyle FireballSound = new("CalamityMod/Sounds/Custom/Yharon/YharonFireball", 3); + private const float TimeBeforeFalling = 180f; + private const float MaxUpwardVelocity = -24f; + private const float MaxDownwardVelocity = 16f; + public override void SetStaticDefaults() { Main.projFrames[Projectile.type] = 5; @@ -29,7 +33,6 @@ namespace CalamityMod.Projectiles.Boss Projectile.width = 34; Projectile.height = 34; Projectile.hostile = true; - Projectile.Opacity = 0.25f; Projectile.alpha = 255; Projectile.penetrate = -1; Projectile.timeLeft = 3600; @@ -57,41 +60,21 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.frame >= Main.projFrames[Projectile.type]) Projectile.frame = 0; - if (Projectile.velocity.Y >= -16f) + if (Projectile.ai[0] < TimeBeforeFalling) { - if (Projectile.Opacity < 1f) - { - Projectile.Opacity = 1f; - SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); - int dustAmount = 36; - for (int i = 0; i < dustAmount; i++) - { - Vector2 dustSpawnPosition = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.5f; - dustSpawnPosition = dustSpawnPosition.RotatedBy((double)((float)(i - (dustAmount / 2 - 1)) * MathHelper.TwoPi / (float)dustAmount), default) + Projectile.Center; - Vector2 dustVelocity = dustSpawnPosition - Projectile.Center; - int dust = Dust.NewDust(dustSpawnPosition + dustVelocity, 0, 0, 55, dustVelocity.X, dustVelocity.Y); - Main.dust[dust].noGravity = true; - Main.dust[dust].noLight = true; - Main.dust[dust].velocity = dustVelocity; - } - } - } - - if (Projectile.velocity.Y < -1f) - { - // 129 frames to get from -50 to -1 - Projectile.velocity.Y *= 0.97f; + Projectile.ai[0] += 1f; + Projectile.velocity.Y -= 0.1f; + if (Projectile.velocity.Y < MaxUpwardVelocity) + Projectile.velocity.Y = MaxUpwardVelocity; } else { - // 85 frames to get from -1 to 16 + Projectile.velocity.X *= 0.8f; Projectile.velocity.Y += 0.2f; - if (Projectile.velocity.Y > 16f) - Projectile.velocity.Y = 16f; + if (Projectile.velocity.Y > MaxDownwardVelocity) + Projectile.velocity.Y = MaxDownwardVelocity; } - Projectile.velocity.X *= 0.995f; - Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; if (Projectile.localAI[0] == 0f) @@ -100,23 +83,14 @@ namespace CalamityMod.Projectiles.Boss SoundEngine.PlaySound(FireballSound, Projectile.Center); } - if (Projectile.ai[0] >= 2f) - { - Projectile.alpha -= 25; - if (Projectile.alpha < 0) - Projectile.alpha = 0; - } - if (Main.rand.NextBool(16)) { - Dust dust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, 55, 0f, 0f, 200, default, 1f); + Dust dust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.Pixie, 0f, 0f, 200, default, 1f); dust.scale *= 0.7f; dust.velocity += Projectile.velocity * 0.25f; } } - public override bool CanHitPlayer(Player target) => Projectile.velocity.Y >= -16f; - public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, Projectile.alpha); public override bool PreDraw(ref Color lightColor) @@ -131,14 +105,14 @@ namespace CalamityMod.Projectiles.Boss Projectile.ExpandHitboxBy(144); for (int d = 0; d < 2; d++) { - Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 55, 0f, 0f, 100, default, 1.5f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Pixie, 0f, 0f, 100, default, 1.5f); } for (int d = 0; d < 20; d++) { - int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 55, 0f, 0f, 0, default, 2.5f); + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Pixie, 0f, 0f, 0, default, 2.5f); Main.dust[idx].noGravity = true; Main.dust[idx].velocity *= 3f; - idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 55, 0f, 0f, 100, default, 1.5f); + idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Pixie, 0f, 0f, 100, default, 1.5f); Main.dust[idx].velocity *= 2f; Main.dust[idx].noGravity = true; } @@ -150,8 +124,7 @@ namespace CalamityMod.Projectiles.Boss if (info.Damage <= 0) return; - if (Projectile.velocity.Y >= -16f) - target.AddBuff(ModContent.BuffType(), 60); + target.AddBuff(ModContent.BuffType(), 60); } } } diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 234d740617..5ac6a49d8b 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -1,4 +1,6 @@ -using CalamityMod.Buffs; +using System; +using System.Collections.Generic; +using CalamityMod.Buffs; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.CalPlayer; @@ -8,6 +10,8 @@ using CalamityMod.Events; using CalamityMod.Items.Accessories; using CalamityMod.Items.Potions.Alcohol; using CalamityMod.NPCs; +using CalamityMod.NPCs.NormalNPCs; +using CalamityMod.NPCs.PlagueEnemies; using CalamityMod.Particles; using CalamityMod.Projectiles.Boss; using CalamityMod.Projectiles.Melee; @@ -16,11 +20,11 @@ using CalamityMod.Projectiles.Rogue; using CalamityMod.Projectiles.Summon; using CalamityMod.Projectiles.Typeless; using CalamityMod.Projectiles.VanillaProjectileOverrides; +using CalamityMod.Tiles.FurnitureAuric; +using CalamityMod.Tiles.Ores; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.Collections.Generic; using Terraria; using Terraria.Audio; using Terraria.DataStructures; @@ -47,6 +51,9 @@ namespace CalamityMod.Projectiles // Source variables. public bool CreatedByPlayerDash = false; + // Speed cap for accelerating boss laser projectiles with 2 extraUpdates. + public const float AcceleratingBossLaserVelocityCap = 10f; + // Damage Adjusters public const float PierceResistHarshness = 0.12f; public const float PierceResistCap = 0.8f; @@ -58,9 +65,9 @@ namespace CalamityMod.Projectiles // For every 100% critical strike chance over 100%, "supercrit" projectiles do a guaranteed +100% damage. // They then take the remainder (e.g. the remaining 16%) and roll against that for a final +100% (like normal crits). // For example if you have 716% critical strike chance, you are guaranteed +700% damage and then have a 16% chance for +800% damage instead. - // These are currently only enabled for Soma Prime, but any bullet fired from that gun can supercrit. + // An example of this is Soma Prime, but any bullet fired from that gun can supercrit when this bool is activated. // Set this to -1 if you want the projectile to supercrit forever, and to any positive value to make it supercrit only x times - public int supercritHits = 0; + public int supercritHits = 0; // Without adjusting underlying crit calculations, set this to true to force a projectile as a crit. // TODO -- In the TML 1.4.4 port, there is a much better way to set NPC strike events to be forced crits. @@ -72,6 +79,33 @@ namespace CalamityMod.Projectiles // If true, this projectile can apply the infinitely-stacking Shred debuff iconic to Soma Prime. public bool appliesSomaShred = false; + // Adds Brimstone flames to bullets, currently only used by Animosity + public bool brimstoneBullets = false; + + // Adds fire to bullets, currently used by Thermocline Blaster + public bool fireBullet = false; + + // Adds ice to bullets, currently used by Thermocline Blaster + public bool iceBullet = false; + + // Adds shock to bullets, currently used by Arietes 41 + public bool shockBullet = false; + + // Adds... pearl? to bullets (visual 1, blue), currently used by Pearl God + public bool pearlBullet1 = false; + // Adds... pearl? to bullets (visual 2, pink), currently used by Pearl God + public bool pearlBullet2 = false; + // Adds... pearl? to bullets (visual 3, yellow), currently used by Pearl God + public bool pearlBullet3 = false; + + // Adds lifesteal to bullets, currently used by Arietes 41 + public bool lifeBullet = false; + + // Adds lifesteal to bullets (visual 1), currently used by Pearl God + public bool betterLifeBullet1 = false; + // Adds lifesteal to bullets (visual 2), currently used by Pearl God + public bool betterLifeBullet2 = false; + // If true, this projectile creates impact sparks upon hitting enemies public bool deepcoreBullet = false; @@ -90,6 +124,16 @@ namespace CalamityMod.Projectiles public const int DefaultPointBlankDuration = 18; // 18 frames public const float PointBlankShotDistanceLimit = 240f; // 15 tiles + // Empress of Light variables + private const float EmpressRainbowStreakSpreadOutCutoff = 140f; + private const int EmpressLastingRainbowTotalDuration = 660; + private const int EmpressLastingRainbowTimeBeforeDealingDamage = 60; + + // Duke Fishron variables + private const int FishronSharknadoTotalDuration = 540; + private const int FishronCthulhunadoTotalDuration = 840; + private const int FishronTornadoTimeBeforeDealingDamage = 60; + // Temporary flat damage reduction effects. This is typically used for parry effects such as Ark of the Ancients public int flatDRTimer = 0; /// @@ -111,6 +155,7 @@ namespace CalamityMod.Projectiles public bool extorterBoost = false; public bool LocketClone = false; public bool CannotProc = false; + public bool JewelSpikeSpawned = false; // Note: Although this was intended for fishing line colors, I use this as an AI variable a lot because vanilla only has 4 that sometimes are already in use. ~Ben // TODO -- uses of this variable are undocumented and unstable. Remove it from the API surface. @@ -120,24 +165,6 @@ namespace CalamityMod.Projectiles // There are several enemies/NPCs in Calamity which do not take damage from minions in certain circumstances. public bool overridesMinionDamagePrevention = false; - public static List MechBossProjectileIDs = new() - { - ProjectileID.DeathLaser, - ProjectileID.PinkLaser, - ProjectileID.BombSkeletronPrime, - ProjectileID.CursedFlameHostile, - ProjectileID.EyeFire, - ProjectileID.EyeLaser, - ProjectileID.Skull, - ProjectileID.SaucerMissile, - ProjectileID.RocketSkeleton, - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType() - }; - // Enchantment variables. public int ExplosiveEnchantCountdown = 0; public const int ExplosiveEnchantTime = 2400; @@ -185,7 +212,7 @@ namespace CalamityMod.Projectiles // Hornet Staff's minion changes. if (projectile.type == ProjectileID.Hornet) return HornetMinionAI.DoHornetMinionAI(projectile); - + // Imp Staff's minion changes. if (projectile.type == ProjectileID.FlyingImp) return ImpMinionAI.DoImpMinionAI(projectile); @@ -203,7 +230,7 @@ namespace CalamityMod.Projectiles return HoundiusShootiusFireballAI.DoHoundiusShootiusFireballAI(projectile); #endregion - + if (!Main.player[projectile.owner].ActiveItem().IsAir && !Main.player[projectile.owner].ActiveItem().Calamity().canFirePointBlankShots) pointBlankShotDuration = 0; @@ -285,8 +312,16 @@ namespace CalamityMod.Projectiles } } - if (projectile.type == ProjectileID.Skull && (projectile.ai[0] == 0f || projectile.ai[0] == -2f)) + if (projectile.type == ProjectileID.Skull) { + bool fromRevSkeletron = projectile.ai[0] < 0f; + bool revSkeletronHomingSkull = projectile.ai[0] == -1f; + bool revSkeletronAcceleratingSkull = projectile.ai[0] == -2f; + bool revSkeletronPrimeHomingSkull = projectile.ai[0] == -3f; + + if (revSkeletronHomingSkull || revSkeletronPrimeHomingSkull) + projectile.alpha = 0; + if (projectile.alpha > 0) projectile.alpha -= 75; @@ -297,26 +332,90 @@ namespace CalamityMod.Projectiles if (projectile.frame > 2) projectile.frame = 0; - // Accelerate if fired in a spread from Skeletron - if (projectile.ai[0] == -2f) + // Accelerate if fired in a spread from Skeletron in Rev+ + if (revSkeletronAcceleratingSkull) { - if (projectile.velocity.Length() < 15f) + float maxVelocity = (Main.masterMode || BossRushEvent.BossRushActive) ? 20f : CalamityWorld.death ? 18f : 15f; + if (projectile.velocity.Length() < maxVelocity) { - projectile.velocity *= 1.02f; - if (projectile.velocity.Length() > 15f) + float acceleration = (Main.masterMode || BossRushEvent.BossRushActive) ? 1.02f : 1.015f; + projectile.velocity *= acceleration; + if (projectile.velocity.Length() > maxVelocity) { projectile.velocity.Normalize(); - projectile.velocity *= 12f; + projectile.velocity *= maxVelocity; } } } - for (int num172 = 0; num172 < 2; num172++) + if (!revSkeletronHomingSkull && !revSkeletronPrimeHomingSkull) { - Dust flame = Dust.NewDustDirect(new Vector2(projectile.position.X + 4f, projectile.position.Y + 4f), projectile.width - 8, projectile.height - 8, 6, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default(Color), 2f); - flame.position -= projectile.velocity * 2f; - flame.noGravity = true; - flame.velocity *= 0.3f; + int numDust = revSkeletronAcceleratingSkull ? 1 : 2; + int dustType = revSkeletronAcceleratingSkull ? 91 : 6; + float dustScale = revSkeletronAcceleratingSkull ? 1f : 2f; + float dustVelocityOffset = revSkeletronAcceleratingSkull ? 1f : 2f; + for (int i = 0; i < numDust; i++) + { + Dust flame = Dust.NewDustDirect(new Vector2(projectile.position.X + 4f, projectile.position.Y + 4f), projectile.width - 8, projectile.height - 8, dustType, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default(Color), dustScale); + flame.position -= projectile.velocity * dustVelocityOffset; + flame.noGravity = true; + flame.velocity *= 0.3f; + } + } + else + { + for (int num173 = 0; num173 < 2; num173++) + { + int num174 = Dust.NewDust(new Vector2(projectile.position.X + 4f, projectile.position.Y + 4f), projectile.width - 8, projectile.height - 8, DustID.Blood, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default(Color), 1.5f); + Main.dust[num174].position -= projectile.velocity; + Main.dust[num174].noGravity = true; + Main.dust[num174].velocity.X *= 0.3f; + Main.dust[num174].velocity.Y *= 0.3f; + } + + int num133 = 0; + num133 = Player.FindClosest(projectile.Center, 1, 1); + projectile.ai[1] += 1f; + float homingStartTime = revSkeletronPrimeHomingSkull ? 10f : 30f; + float homingEndTime = (Main.masterMode || BossRushEvent.BossRushActive) ? 120f : CalamityWorld.death ? 105f : 90f; + if (revSkeletronPrimeHomingSkull) + homingEndTime += 90f; + + // Stop homing when within a certain distance of the target + if (Vector2.Distance(projectile.Center, Main.player[num133].Center) < ((revSkeletronPrimeHomingSkull && ((Main.masterMode && CalamityWorld.revenge) || BossRushEvent.BossRushActive)) ? 192f : 96f) && projectile.ai[1] < homingEndTime) + projectile.ai[1] = homingEndTime; + + if (projectile.ai[1] < homingEndTime && projectile.ai[1] > homingStartTime) + { + float num134 = projectile.velocity.Length(); + Vector2 vector24 = Main.player[num133].Center - projectile.Center; + vector24.Normalize(); + vector24 *= num134; + float inertia = (CalamityWorld.death || BossRushEvent.BossRushActive) ? (revSkeletronPrimeHomingSkull ? 20f : 25f) : (revSkeletronPrimeHomingSkull ? 25f : 30f); + projectile.velocity = (projectile.velocity * (inertia - 1f) + vector24) / inertia; + projectile.velocity.Normalize(); + projectile.velocity *= num134; + } + + float maxVelocity = (CalamityWorld.death || BossRushEvent.BossRushActive) ? 18f : 15f; + float acceleration = (Main.masterMode || BossRushEvent.BossRushActive) ? 1.02f : 1.015f; + if (projectile.velocity.Length() < maxVelocity) + projectile.velocity *= acceleration; + + if (projectile.localAI[0] == 0f) + { + projectile.localAI[0] = 1f; + SoundEngine.PlaySound(SoundID.Item8, projectile.Center); + for (int num135 = 0; num135 < 10; num135++) + { + int num136 = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Blood, projectile.velocity.X, projectile.velocity.Y, 0, default(Color), 2f); + Main.dust[num136].noGravity = true; + Main.dust[num136].velocity = projectile.Center - Main.dust[num136].position; + Main.dust[num136].velocity.Normalize(); + Main.dust[num136].velocity *= -5f; + Main.dust[num136].velocity += projectile.velocity / 2f; + } + } } if (projectile.ai[0] == 0f) @@ -409,15 +508,87 @@ namespace CalamityMod.Projectiles return false; } + // This has 2 extra updates, dust was reduced because of this fact + else if (projectile.type == ProjectileID.Shadowflames && projectile.ai[1] == 1f) + { + float spawnDustGateValue = 2f * projectile.MaxUpdates; + if (projectile.localAI[0] == spawnDustGateValue) + { + SoundEngine.PlaySound(SoundID.Item8, projectile.Center); + for (int i = 0; i < 20; i++) + { + int dust = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.GemDiamond, 0f, 0f, 100); + Main.dust[dust].velocity *= 3f; + Main.dust[dust].velocity += projectile.velocity * 0.75f; + Main.dust[dust].scale *= 1.2f; + Main.dust[dust].noGravity = true; + } + } + + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > spawnDustGateValue) + { + for (int i = 0; i < 2; i++) + { + int dust = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.GemDiamond, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100); + Main.dust[dust].velocity *= 0.6f; + Main.dust[dust].scale *= 1.4f; + Main.dust[dust].noGravity = true; + } + } + + projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; + + return false; + } + + else if (projectile.type == ProjectileID.BloodShot) + { + if (projectile.localAI[0] == 0f) + { + if (Main.masterMode && !CalamityPlayer.areThereAnyDamnBosses) + projectile.damage = (int)Math.Round(projectile.damage * CalamityGlobalNPC.MasterModeEnemyDamageMultiplier); + if (!CalamityPlayer.areThereAnyDamnBosses) + projectile.damage = (int)Math.Round(projectile.damage * 0.65); + + SoundEngine.PlaySound(SoundID.Item17, projectile.Center); + projectile.localAI[0] = 1f; + for (int i = 0; i < 8; i++) + { + Dust blood1 = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Blood, projectile.velocity.X, projectile.velocity.Y, 100)]; + blood1.velocity = (Main.rand.NextFloatDirection() * (float)Math.PI).ToRotationVector2() * 2f + projectile.velocity.SafeNormalize(Vector2.Zero) * 3f; + blood1.scale = 1.5f; + blood1.fadeIn = 1.7f; + blood1.position = projectile.Center; + } + } + + projectile.alpha = 0; + + Dust blood2 = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Blood, projectile.velocity.X, projectile.velocity.Y, 100)]; + blood2.velocity = blood2.velocity / 4f + projectile.velocity / 2f; + blood2.scale = 1.2f; + blood2.position = projectile.Center + Main.rand.NextFloat() * projectile.velocity * 2f; + + projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; + + return false; + } + else if (projectile.type == ProjectileID.BloodNautilusShot) { if (projectile.localAI[0] == 0f) { + if (Main.masterMode && !CalamityPlayer.areThereAnyDamnBosses) + projectile.damage = (int)Math.Round(projectile.damage * CalamityGlobalNPC.MasterModeEnemyDamageMultiplier); + if (!CalamityPlayer.areThereAnyDamnBosses) + projectile.damage = (int)Math.Round(projectile.damage * 0.65); + SoundEngine.PlaySound(SoundID.Item171, projectile.Center); projectile.localAI[0] = 1f; - for (int num160 = 0; num160 < 8; num160++) + for (int i = 0; i < 8; i++) { - Dust blood1 = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, 5, projectile.velocity.X, projectile.velocity.Y, 100); + Dust blood1 = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, DustID.Blood, projectile.velocity.X, projectile.velocity.Y, 100); blood1.velocity = (Main.rand.NextFloatDirection() * MathHelper.Pi).ToRotationVector2() * 2f + projectile.velocity.SafeNormalize(Vector2.Zero) * 2f; blood1.scale = 0.9f; blood1.fadeIn = 1.1f; @@ -425,26 +596,21 @@ namespace CalamityMod.Projectiles } } - projectile.alpha -= 20; - if (projectile.alpha < 0) - projectile.alpha = 0; + projectile.alpha = 0; - for (int num161 = 0; num161 < 2; num161++) - { - Dust blood2 = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, 5, projectile.velocity.X, projectile.velocity.Y, 100); - blood2.velocity = blood2.velocity / 4f + projectile.velocity / 2f; - blood2.scale = 1.2f; - blood2.position = projectile.Center + Main.rand.NextFloat() * projectile.velocity * 2f; - } + Dust blood2 = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, DustID.Blood, projectile.velocity.X, projectile.velocity.Y, 100); + blood2.velocity = blood2.velocity / 4f + projectile.velocity / 2f; + blood2.scale = 1.2f; + blood2.position = projectile.Center + Main.rand.NextFloat() * projectile.velocity * 2f; - for (int num162 = 1; num162 < projectile.oldPos.Length && !(projectile.oldPos[num162] == Vector2.Zero); num162++) + for (int j = 1; j < projectile.oldPos.Length && !(projectile.oldPos[j] == Vector2.Zero); j++) { - if (Main.rand.Next(3) == 0) + if (Main.rand.NextBool(3)) { - Dust blood3 = Dust.NewDustDirect(projectile.oldPos[num162], projectile.width, projectile.height, 5, projectile.velocity.X, projectile.velocity.Y, 100); + Dust blood3 = Dust.NewDustDirect(projectile.oldPos[j], projectile.width, projectile.height, DustID.Blood, projectile.velocity.X, projectile.velocity.Y, 100); blood3.velocity = blood3.velocity / 4f + projectile.velocity / 2f; blood3.scale = 1.2f; - blood3.position = projectile.oldPos[num162] + projectile.Size / 2f + Main.rand.NextFloat() * projectile.velocity * 2f; + blood3.position = projectile.oldPos[j] + projectile.Size / 2f + Main.rand.NextFloat() * projectile.velocity * 2f; } } @@ -453,6 +619,214 @@ namespace CalamityMod.Projectiles return false; } + else if (projectile.type == ProjectileID.QueenBeeStinger) + { + if (projectile.ai[1] != 0f) + { + if (projectile.position.Y > projectile.ai[1]) + projectile.tileCollide = true; + } + + if (Main.rand.NextBool()) + Dust.NewDustDirect(projectile.position - projectile.velocity, projectile.width, projectile.height, DustID.t_Honey, 0f, 0f, 0, default(Color), 0.9f).noGravity = true; + + if (projectile.localAI[0] == 0f) + { + projectile.localAI[0] = 1f; + for (int num99 = 0; num99 < 20; num99++) + { + Dust dust3 = Dust.NewDustDirect(projectile.position - projectile.velocity, projectile.width, projectile.height, DustID.t_Honey, 0f, 0f, 0, default(Color), 1.3f); + dust3.noGravity = true; + dust3.velocity += projectile.velocity * 0.75f; + } + + for (int num100 = 0; num100 < 10; num100++) + { + Dust dust4 = Dust.NewDustDirect(projectile.position - projectile.velocity, projectile.width, projectile.height, DustID.t_Honey, 0f, 0f, 0, default(Color), 1.3f); + dust4.noGravity = true; + dust4.velocity *= 2f; + } + } + + projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; + + return false; + } + + else if (projectile.type == ProjectileID.EyeLaser && projectile.ai[0] == 1f) + { + projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; + + Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.3f / 255f, 0f, (255 - projectile.alpha) * 0.3f / 255f); + + if (projectile.alpha > 0) + projectile.alpha -= 125; + if (projectile.alpha < 0) + projectile.alpha = 0; + + if (projectile.localAI[1] == 0f) + { + SoundEngine.PlaySound(SoundID.Item33, projectile.Center); + projectile.localAI[1] = 1f; + } + + if (projectile.velocity.Length() < AcceleratingBossLaserVelocityCap) + projectile.velocity *= 1.0025f; + + return false; + } + + else if (projectile.type == ProjectileID.DeathLaser && projectile.ai[0] == 1f) + { + projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; + + Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.75f / 255f, 0f, 0f); + + if (projectile.alpha > 0) + projectile.alpha -= 125; + if (projectile.alpha < 0) + projectile.alpha = 0; + + if (projectile.localAI[1] == 0f) + { + SoundEngine.PlaySound(SoundID.Item33, projectile.Center); + projectile.localAI[1] = 1f; + } + + if (projectile.velocity.Length() < AcceleratingBossLaserVelocityCap) + projectile.velocity *= 1.0025f; + + return false; + } + + else if (projectile.type == ProjectileID.DD2OgreSmash || projectile.type == ProjectileID.QueenSlimeSmash) + { + float maxHitboxSize = 30f; + if (projectile.type == ProjectileID.QueenSlimeSmash) + maxHitboxSize = 20f; + + projectile.ai[0] += 1f; + if (projectile.ai[0] <= 0f) + { + if (projectile.ai[0] == 0f) + SoundEngine.PlaySound(SoundID.Item167, projectile.Center); + + return false; + } + if (projectile.ai[0] > 9f) + { + projectile.Kill(); + return false; + } + + projectile.velocity = Vector2.Zero; + projectile.position = projectile.Center; + projectile.Size = new Vector2(16f, 8f) * MathHelper.Lerp(5f, maxHitboxSize, Utils.GetLerpValue(0f, 9f, projectile.ai[0])); + projectile.Center = projectile.position; + Point point = projectile.TopLeft.ToTileCoordinates(); + Point point2 = projectile.BottomRight.ToTileCoordinates(); + int num2 = point.X / 2 + point2.X / 2; + int num3 = projectile.width / 2; + if ((int)projectile.ai[0] % 3 != 0) + return false; + + int num4 = (int)projectile.ai[0] / 3; + for (int i = point.X; i <= point2.X; i++) + { + for (int j = point.Y; j <= point2.Y; j++) + { + if (Vector2.Distance(projectile.Center, new Vector2(i * 16, j * 16)) > (float)num3) + continue; + + Tile tileSafely = Framing.GetTileSafely(i, j); + bool isPlatform = tileSafely.HasTile && (TileID.Sets.Platforms[tileSafely.TileType] || tileSafely.TileType == TileID.PlanterBox); + if (!isPlatform) + { + if (!tileSafely.HasTile || !Main.tileSolid[tileSafely.TileType] || Main.tileSolidTop[tileSafely.TileType] || Main.tileFrameImportant[tileSafely.TileType]) + continue; + + Tile tileSafely2 = Framing.GetTileSafely(i, j - 1); + if (tileSafely2.HasTile && Main.tileSolid[tileSafely2.TileType] && !Main.tileSolidTop[tileSafely2.TileType]) + continue; + } + + int num5 = WorldGen.KillTile_GetTileDustAmount(fail: true, tileSafely, i, j); + for (int k = 0; k < num5; k++) + { + Dust obj = Main.dust[WorldGen.KillTile_MakeTileDust(i, j, tileSafely)]; + obj.velocity.Y -= 3f + (float)num4 * 1.5f; + obj.velocity.Y *= Main.rand.NextFloat(); + obj.velocity.Y *= 0.75f; + obj.scale += (float)num4 * 0.03f; + } + + if (num4 >= 2) + { + if (projectile.type == ProjectileID.QueenSlimeSmash) + { + Color newColor = NPC.AI_121_QueenSlime_GetDustColor(); + newColor.A = 150; + for (int l = 0; l < num5 - 1; l++) + { + int num6 = Dust.NewDust(projectile.position, 12, 12, DustID.TintableDust, 0f, 0f, 50, newColor, 1.5f); + Main.dust[num6].velocity.Y -= 0.1f + (float)num4 * 0.5f; + Main.dust[num6].velocity.Y *= Main.rand.NextFloat(); + Main.dust[num6].velocity.X *= Main.rand.NextFloatDirection() * 3f; + Main.dust[num6].position = new Vector2(i * 16 + Main.rand.Next(16), j * 16 + Main.rand.Next(16)); + if (!Main.rand.NextBool(3)) + { + Main.dust[num6].velocity *= 0.5f; + Main.dust[num6].noGravity = true; + } + } + } + else + { + for (int m = 0; m < num5 - 1; m++) + { + Dust obj2 = Main.dust[WorldGen.KillTile_MakeTileDust(i, j, tileSafely)]; + obj2.velocity.Y -= 1f + (float)num4; + obj2.velocity.Y *= Main.rand.NextFloat(); + obj2.velocity.Y *= 0.75f; + } + } + } + + if (num5 <= 0 || Main.rand.NextBool(3)) + continue; + + float num7 = (float)Math.Abs(num2 - i) / (maxHitboxSize / 2f); + if (projectile.type == ProjectileID.QueenSlimeSmash) + { + Color newColor2 = NPC.AI_121_QueenSlime_GetDustColor(); + newColor2.A = 150; + for (int n = 0; n < 3; n++) + { + int num8 = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Smoke, 0f, 0f, 50, newColor2, 2f - (float)num4 * 0.15f + num7 * 0.5f); + Main.dust[num8].velocity.Y -= 0.1f + (float)num4 * 0.5f + num7 * (float)num4 * 1f; + Main.dust[num8].velocity.Y *= Main.rand.NextFloat(); + Main.dust[num8].velocity.X *= Main.rand.NextFloatDirection() * 3f; + Main.dust[num8].position = new Vector2(i * 16 + 20, j * 16 + 20); + if (!Main.rand.NextBool(3)) + { + Main.dust[num8].velocity *= 0.5f; + Main.dust[num8].noGravity = true; + } + } + } + else + { + Gore gore = Gore.NewGoreDirect(projectile.GetSource_FromAI(), projectile.position, Vector2.Zero, 61 + Main.rand.Next(3), 1f - (float)num4 * 0.15f + num7 * 0.5f); + gore.velocity.Y -= 0.1f + (float)num4 * 0.5f + num7 * (float)num4 * 1f; + gore.velocity.Y *= Main.rand.NextFloat(); + gore.position = new Vector2(i * 16 + 20, j * 16 + 20); + } + } + } + + return false; + } + else if (projectile.type == ProjectileID.FrostWave && projectile.ai[1] > 0f) { if (projectile.ai[0] < 0f) @@ -500,6 +874,478 @@ namespace CalamityMod.Projectiles return false; } + // Phase 1 sharknado + else if (projectile.type == ProjectileID.SharknadoBolt) + { + if (projectile.ai[1] == 0f) + { + float num552 = (float)Math.PI / 15f; + float num553 = 4f; + float num554 = (float)(Math.Cos(num552 * projectile.ai[0]) - 0.5) * num553; + projectile.velocity.Y -= num554; + projectile.ai[0]++; + num554 = (float)(Math.Cos(num552 * projectile.ai[0]) - 0.5) * num553; + projectile.velocity.Y += num554; + projectile.localAI[0]++; + if (projectile.localAI[0] > 10f) + { + projectile.alpha -= 5; + if (projectile.alpha < 100) + projectile.alpha = 100; + + projectile.rotation += projectile.velocity.X * 0.1f; + projectile.frame = (int)(projectile.localAI[0] / 3f) % 3; + } + + if (projectile.wet) + { + projectile.position.Y -= 16f; + projectile.Kill(); + } + + return false; + } + else if (projectile.ai[1] < 0f) + { + projectile.timeLeft -= 2; + + float num623 = (float)Math.PI / 15f; + float num624 = -2f; + float num625 = (float)(Math.Cos(num623 * projectile.ai[0]) - 0.5) * num624; + + projectile.velocity.Y -= num625; + + projectile.ai[0] += 1f; + + num625 = (float)(Math.Cos(num623 * projectile.ai[0]) - 0.5) * num624; + + projectile.velocity.Y += num625; + + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 10f) + { + projectile.alpha -= 5; + if (projectile.alpha < 100) + projectile.alpha = 100; + + projectile.rotation += projectile.velocity.X * 0.1f; + projectile.frame = (int)(projectile.localAI[0] / 3f) % 3; + } + + if (projectile.wet) + { + projectile.position.Y -= 16f; + projectile.Kill(); + } + + return false; + } + } + + else if (projectile.type == ProjectileID.Sharknado) + { + projectile.damage = projectile.GetProjectileDamage(NPCID.DukeFishron); + + int num535 = 10; + int num536 = 15; + float num537 = 1f; + int num538 = 150; + int num539 = 42; + + if (projectile.velocity.X != 0f) + projectile.direction = (projectile.spriteDirection = -Math.Sign(projectile.velocity.X)); + + projectile.frameCounter++; + if (projectile.frameCounter > 2) + { + projectile.frame++; + projectile.frameCounter = 0; + } + + if (projectile.frame >= 6) + projectile.frame = 0; + + if (projectile.localAI[0] == 0f && Main.myPlayer == projectile.owner) + { + projectile.localAI[0] = 1f; + projectile.position.X += projectile.width / 2; + projectile.position.Y += projectile.height / 2; + projectile.scale = ((float)(num535 + num536) - projectile.ai[1]) * num537 / (float)(num536 + num535); + projectile.width = (int)((float)num538 * projectile.scale); + projectile.height = (int)((float)num539 * projectile.scale); + projectile.position.X -= projectile.width / 2; + projectile.position.Y -= projectile.height / 2; + projectile.netUpdate = true; + } + + if (projectile.ai[1] != -1f) + { + projectile.scale = ((float)(num535 + num536) - projectile.ai[1]) * num537 / (float)(num536 + num535); + projectile.width = (int)((float)num538 * projectile.scale); + projectile.height = (int)((float)num539 * projectile.scale); + } + + int maxAlpha = 150; + int minAlpha = 60; + if (projectile.timeLeft > FishronSharknadoTotalDuration - FishronTornadoTimeBeforeDealingDamage) + { + maxAlpha = 220; + minAlpha = 180; + } + + if (!Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + { + projectile.alpha -= 30; + if (projectile.alpha < minAlpha) + projectile.alpha = minAlpha; + } + else + { + projectile.alpha += 30; + if (projectile.alpha > maxAlpha) + projectile.alpha = maxAlpha; + } + + if (projectile.ai[0] > 0f) + projectile.ai[0]--; + + if (projectile.ai[0] == 1f && projectile.ai[1] > 0f && projectile.owner == Main.myPlayer) + { + projectile.netUpdate = true; + Vector2 center4 = projectile.Center; + center4.Y -= (float)num539 * projectile.scale / 2f; + float num540 = ((float)(num535 + num536) - projectile.ai[1] + 1f) * num537 / (float)(num536 + num535); + center4.Y -= (float)num539 * num540 / 2f; + center4.Y += 2f; + Projectile.NewProjectile(projectile.GetSource_FromAI(), center4, projectile.velocity, projectile.type, projectile.damage, projectile.knockBack, projectile.owner, 10f, projectile.ai[1] - 1f); + int num541 = 4; + + if ((int)projectile.ai[1] % num541 == 0 && projectile.ai[1] != 0f) + { + int num542 = NPCID.Sharkron; + int num543 = NPC.NewNPC(projectile.GetSource_FromAI(), (int)center4.X, (int)center4.Y, num542); + Main.npc[num543].velocity = projectile.velocity; + Main.npc[num543].netUpdate = true; + } + } + + if (projectile.ai[0] <= 0f) + { + float num544 = MathHelper.Pi / 30f; + float num545 = (float)projectile.width / 5f; + float num546 = (float)(Math.Cos(num544 * (0f - projectile.ai[0])) - 0.5) * num545; + projectile.position.X -= num546 * (float)(-projectile.direction); + projectile.ai[0]--; + num546 = (float)(Math.Cos(num544 * (0f - projectile.ai[0])) - 0.5) * num545; + projectile.position.X += num546 * (float)(-projectile.direction); + } + + return false; + } + + // Larger cthulhunadoes + else if (projectile.type == ProjectileID.Cthulunado) + { + projectile.damage = projectile.GetProjectileDamage(NPCID.DukeFishron); + + if (CalamityWorld.revenge || BossRushEvent.BossRushActive) + { + bool masterMode = Main.masterMode || BossRushEvent.BossRushActive; + + int num606 = 16; + int num607 = 16; + float segmentScale = masterMode ? 2.5f : 2f; + int segmentWidth = 150; + int segmentHeight = 42; + + if (projectile.velocity.X != 0f) + projectile.direction = projectile.spriteDirection = -Math.Sign(projectile.velocity.X); + + int num3 = projectile.frameCounter; + projectile.frameCounter = num3 + 1; + if (projectile.frameCounter > 2) + { + num3 = projectile.frame; + projectile.frame = num3 + 1; + projectile.frameCounter = 0; + } + if (projectile.frame >= 6) + projectile.frame = 0; + + if (projectile.localAI[0] == 0f && Main.myPlayer == projectile.owner) + { + projectile.localAI[0] = 1f; + projectile.position.X += projectile.width / 2; + projectile.position.Y += projectile.height / 2; + projectile.scale = (num606 + num607 - projectile.ai[1]) * segmentScale / (num607 + num606); + projectile.width = (int)(segmentWidth * projectile.scale); + projectile.height = (int)(segmentHeight * projectile.scale); + projectile.position.X -= projectile.width / 2; + projectile.position.Y -= projectile.height / 2; + projectile.netUpdate = true; + } + + if (projectile.ai[1] != -1f) + { + projectile.scale = (num606 + num607 - projectile.ai[1]) * segmentScale / (num607 + num606); + projectile.width = (int)(segmentWidth * projectile.scale); + projectile.height = (int)(segmentHeight * projectile.scale); + } + + int maxAlpha = 150; + int minAlpha = 100; + if (projectile.timeLeft > FishronCthulhunadoTotalDuration - FishronTornadoTimeBeforeDealingDamage) + { + maxAlpha = 220; + minAlpha = 200; + } + + if (!Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + { + projectile.alpha -= 30; + if (projectile.alpha < minAlpha) + projectile.alpha = minAlpha; + } + else + { + projectile.alpha += 30; + if (projectile.alpha > maxAlpha) + projectile.alpha = maxAlpha; + } + + if (projectile.ai[0] > 0f) + projectile.ai[0] -= 1f; + + if (projectile.ai[0] == 1f && projectile.ai[1] > 0f && projectile.owner == Main.myPlayer) + { + projectile.netUpdate = true; + + Vector2 center = projectile.Center; + center.Y -= segmentHeight * projectile.scale / 2f; + + float num611 = (num606 + num607 - projectile.ai[1] + 1f) * segmentScale / (num607 + num606); + center.Y -= segmentHeight * num611 / 2f; + center.Y += 2f; + + float segmentSpawnDelay = 10f; + Projectile.NewProjectile(projectile.GetSource_FromThis(), center, projectile.velocity, projectile.type, projectile.damage, projectile.knockBack, projectile.owner, segmentSpawnDelay, projectile.ai[1] - 1f); + + int sharkronSpawnGateValue = masterMode ? 2 : 3; + if ((int)projectile.ai[1] % sharkronSpawnGateValue == 0 && projectile.ai[1] != 0f) + { + int sharkron = NPC.NewNPC(projectile.GetSource_FromAI(), (int)center.X, (int)center.Y, NPCID.Sharkron2); + Main.npc[sharkron].velocity = projectile.velocity; + Main.npc[sharkron].scale = masterMode ? 2f : 1.5f; + Main.npc[sharkron].netUpdate = true; + Main.npc[sharkron].ai[2] = projectile.width; + Main.npc[sharkron].ai[3] = -1.5f; + } + } + + if (projectile.ai[0] <= 0f) + { + float swayAmount = MathHelper.Pi / 30f; + float widthSwayScale = projectile.width / 5f * 2.5f; + float sway = (float)(Math.Cos(swayAmount * -(double)projectile.ai[0]) - 0.5) * widthSwayScale; + + projectile.position.X -= sway * -projectile.direction; + + projectile.ai[0] -= 1f; + + sway = (float)(Math.Cos(swayAmount * -(double)projectile.ai[0]) - 0.5) * widthSwayScale; + projectile.position.X += sway * -projectile.direction; + } + + return false; + } + else + { + int minAlpha = 100; + if (projectile.timeLeft > FishronCthulhunadoTotalDuration - FishronTornadoTimeBeforeDealingDamage) + minAlpha = 200; + + int alphaChange = 30; + if (!Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + { + projectile.alpha -= alphaChange; + if (projectile.alpha < minAlpha + alphaChange) + projectile.alpha = minAlpha + alphaChange; + } + } + } + + else if (projectile.type == ProjectileID.HallowBossRainbowStreak && projectile.hostile) + { + bool revMasterMode = (Main.masterMode && CalamityWorld.revenge) || BossRushEvent.BossRushActive; + + bool spreadOut = false; + bool homeIn = false; + float spreadOutCutoffTime = EmpressRainbowStreakSpreadOutCutoff; + float homeInCutoffTime = NPC.ShouldEmpressBeEnraged() ? (revMasterMode ? 55f : 65f) : (revMasterMode ? 70f : 80f); + float spreadDeceleration = 0.97f; + float minAcceleration = revMasterMode ? 0.075f : 0.05f; + float maxAcceleration = revMasterMode ? 0.15f : 0.1f; + float homingVelocity = revMasterMode ? 36f : 30f; + float maxVelocity = homingVelocity * 1.5f; + float accelerationToMaxVelocity = 1.01f; + + if (projectile.timeLeft > spreadOutCutoffTime) + spreadOut = true; + else if (projectile.timeLeft > homeInCutoffTime) + homeIn = true; + + if (spreadOut) + { + float spreadVelocity = (float)Math.Cos(projectile.whoAmI % 6f / 6f + projectile.position.X / 320f + projectile.position.Y / 160f); + projectile.velocity *= spreadDeceleration; + projectile.velocity = projectile.velocity.RotatedBy(spreadVelocity * MathHelper.TwoPi * 0.125f * 1f / 30f); + } + + if (homeIn) + { + int playerIndex = (int)projectile.ai[0]; + Vector2 velocity = projectile.velocity; + if (Main.player.IndexInRange(playerIndex)) + { + Player player = Main.player[playerIndex]; + velocity = projectile.DirectionTo(player.Center) * homingVelocity; + } + + float amount = MathHelper.Lerp(minAcceleration, maxAcceleration, Utils.GetLerpValue(spreadOutCutoffTime, 30f, projectile.timeLeft, clamped: true)); + projectile.velocity = Vector2.SmoothStep(projectile.velocity, velocity, amount); + } + else + { + if (projectile.velocity.Length() < maxVelocity) + { + projectile.velocity *= accelerationToMaxVelocity; + if (projectile.velocity.Length() > maxVelocity) + { + projectile.velocity.Normalize(); + projectile.velocity *= maxVelocity; + } + } + } + + projectile.Opacity = spreadOut ? 0.4f : Utils.GetLerpValue(240f, 220f, projectile.timeLeft, clamped: true); + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + + return false; + } + + else if (projectile.type == ProjectileID.CultistBossLightningOrb) + { + if (NPC.AnyNPCs(NPCID.CultistBoss)) + { + if (projectile.localAI[1] == 0f) + { + SoundEngine.PlaySound(SoundID.Item121, projectile.Center); + projectile.localAI[1] = 1f; + } + + if (projectile.ai[0] < 180f) + { + projectile.alpha -= 5; + if (projectile.alpha < 0) + projectile.alpha = 0; + } + else + { + projectile.alpha += 5; + if (projectile.alpha > 255) + { + projectile.alpha = 255; + projectile.Kill(); + return false; + } + } + + ref float reference = ref projectile.ai[0]; + ref float reference46 = ref reference; + float num15 = reference; + reference46 = num15 + 1f; + + if (projectile.ai[0] % 30f == 0f && projectile.ai[0] < 180f && Main.netMode != NetmodeID.MultiplayerClient) + { + int maxTargets = 2; + int[] array6 = new int[maxTargets]; + Vector2[] array7 = new Vector2[maxTargets]; + int num731 = 0; + float num732 = 2000f; + + for (int num733 = 0; num733 < Main.maxPlayers; num733++) + { + if (!Main.player[num733].active || Main.player[num733].dead) + continue; + + Vector2 center9 = Main.player[num733].Center; + float num734 = Vector2.Distance(center9, projectile.Center); + if (num734 < num732 && Collision.CanHit(projectile.Center, 1, 1, center9, 1, 1)) + { + array6[num731] = num733; + array7[num731] = center9; + int num34 = num731 + 1; + num731 = num34; + if (num34 >= array7.Length) + break; + } + } + + for (int num735 = 0; num735 < num731; num735++) + { + Vector2 vector52 = array7[num735] - projectile.Center; + float ai = Main.rand.Next(100); + Vector2 vector53 = Vector2.Normalize(vector52.RotatedByRandom(MathHelper.PiOver4)) * 7f; + Projectile.NewProjectile(projectile.GetSource_FromThis(), projectile.Center, vector53, ProjectileID.CultistBossLightningOrbArc, projectile.damage, 0f, Main.myPlayer, vector52.ToRotation(), ai); + } + } + + Lighting.AddLight(projectile.Center, 0.4f, 0.85f, 0.9f); + + if (++projectile.frameCounter >= 4) + { + projectile.frameCounter = 0; + if (++projectile.frame >= Main.projFrames[projectile.type]) + projectile.frame = 0; + } + + if (projectile.alpha >= 150 || !(projectile.ai[0] < 180f)) + return false; + + for (int num736 = 0; num736 < 1; num736++) + { + float num737 = (float)Main.rand.NextDouble() * 1f - 0.5f; + if (num737 < -0.5f) + num737 = -0.5f; + if (num737 > 0.5f) + num737 = 0.5f; + + Vector2 value40 = new Vector2(-projectile.width * 0.2f * projectile.scale, 0f).RotatedBy(num737 * MathHelper.TwoPi).RotatedBy(projectile.velocity.ToRotation()); + Dust zap = Dust.NewDustDirect(projectile.Center - Vector2.One * 5f, 10, 10, DustID.Electric, (0f - projectile.velocity.X) / 3f, (0f - projectile.velocity.Y) / 3f, 150, Color.Transparent, 0.7f); + zap.position = projectile.Center + value40; + zap.velocity = Vector2.Normalize(zap.position - projectile.Center) * 2f; + zap.noGravity = true; + } + + for (int num739 = 0; num739 < 1; num739++) + { + float num740 = (float)Main.rand.NextDouble() * 1f - 0.5f; + if (num740 < -0.5f) + num740 = -0.5f; + if (num740 > 0.5f) + num740 = 0.5f; + + Vector2 value41 = new Vector2(-projectile.width * 0.6f * projectile.scale, 0f).RotatedBy(num740 * MathHelper.TwoPi).RotatedBy(projectile.velocity.ToRotation()); + Dust zap = Dust.NewDustDirect(projectile.Center - Vector2.One * 5f, 10, 10, DustID.Electric, (0f - projectile.velocity.X) / 3f, (0f - projectile.velocity.Y) / 3f, 150, Color.Transparent, 0.7f); + zap.velocity = Vector2.Zero; + zap.position = projectile.Center + value41; + zap.noGravity = true; + } + + return false; + } + } + else if (projectile.type == ProjectileID.Starfury) { if (projectile.timeLeft > 75) @@ -514,7 +1360,7 @@ namespace CalamityMod.Projectiles if (projectile.soundDelay == 0) { projectile.soundDelay = 20 + Main.rand.Next(40); - SoundEngine.PlaySound(SoundID.Item9, projectile.position); + SoundEngine.PlaySound(SoundID.Item9, projectile.Center); } if (projectile.localAI[0] == 0f) @@ -539,7 +1385,7 @@ namespace CalamityMod.Projectiles projectile.light = 0.9f; if (Main.rand.NextBool(10)) - Dust.NewDust(projectile.position, projectile.width, projectile.height, 58, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default, 1.2f); + Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Enchanted_Pink, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default, 1.2f); if (Main.rand.NextBool(20) && Main.netMode != NetmodeID.Server) Gore.NewGore(projectile.GetSource_FromAI(), projectile.position, projectile.velocity * 0.2f, Main.rand.Next(16, 18), 1f); @@ -553,7 +1399,7 @@ namespace CalamityMod.Projectiles { float maxSpeed = 12f; int accelerationTime = 30; - + if (projectile.localAI[0] > 0f) projectile.localAI[0]--; @@ -605,9 +1451,9 @@ namespace CalamityMod.Projectiles float num1036 = projectile.ai[1] / 180f * MathHelper.TwoPi; for (float num1037 = 0f; num1037 < 3f; num1037++) { - if (Main.rand.Next(3) == 0) + if (Main.rand.NextBool(3)) { - Dust shflame = Dust.NewDustDirect(projectile.Center, 0, 0, 27, 0f, -2f, 200); + Dust shflame = Dust.NewDustDirect(projectile.Center, 0, 0, DustID.Shadowflame, 0f, -2f, 200); shflame.position = projectile.Center + Vector2.UnitY.RotatedBy(num1037 * MathHelper.TwoPi / 3f + projectile.ai[1]) * 10f; shflame.noGravity = true; shflame.velocity = projectile.DirectionFrom(shflame.position); @@ -660,7 +1506,278 @@ namespace CalamityMod.Projectiles return false; } - if (projectile.type == ProjectileID.NurseSyringeHeal) + else if (projectile.type == ProjectileID.TrueNightsEdge) + { + float fadeInTime = 50f; + float fadeOutTime = 15f; + float timeBeforeFadeOut = projectile.ai[1] + fadeInTime; + float projectileDuration = timeBeforeFadeOut + fadeOutTime; + float stopDealingDamageTime = 80f; + + if (projectile.localAI[0] == 0f) + SoundEngine.PlaySound(SoundID.Item8, projectile.Center); + + projectile.localAI[0] += 1f; + if (projectile.damage == 0 && projectile.localAI[0] < MathHelper.Lerp(timeBeforeFadeOut, projectileDuration, 0.5f)) + projectile.localAI[0] += 6f; + + projectile.Opacity = Utils.Remap(projectile.localAI[0], 0f, projectile.ai[1], 0f, 1f) * Utils.Remap(projectile.localAI[0], timeBeforeFadeOut, projectileDuration, 1f, 0f); + if (projectile.localAI[0] >= projectileDuration) + { + projectile.localAI[1] = 1f; + projectile.Kill(); + return false; + } + + Player player = Main.player[projectile.owner]; + float fromValue = projectile.localAI[0] / projectile.ai[1]; + projectile.direction = (projectile.spriteDirection = (int)projectile.ai[0]); + + if (projectile.damage != 0 && projectile.localAI[0] >= stopDealingDamageTime) + projectile.damage = 0; + + if (projectile.damage != 0) + { + int size = 80; + bool notInsideTiles = false; + float rotation = projectile.velocity.ToRotation(); + for (float i = -1f; i <= 1f; i += 0.5f) + { + Vector2 position = projectile.Center + (rotation + i * MathHelper.PiOver4 * 0.25f).ToRotationVector2() * size * 0.5f * projectile.scale; + Vector2 position2 = projectile.Center + (rotation + i * MathHelper.PiOver4 * 0.25f).ToRotationVector2() * size * projectile.scale; + if (!Collision.SolidTiles(projectile.Center, 0, 0) && Collision.CanHit(position, 0, 0, position2, 0, 0)) + { + notInsideTiles = true; + break; + } + } + + if (!notInsideTiles) + projectile.damage = 0; + } + + fromValue = projectile.localAI[0] / projectile.ai[1]; + projectile.localAI[1] += 1f; + projectile.rotation += projectile.ai[0] * MathHelper.TwoPi * (4f + projectile.Opacity * 4f) / 90f; + projectile.scale = Utils.Remap(projectile.localAI[0], projectile.ai[1] + 2f, projectileDuration, 1.12f, 1f) * projectile.ai[2]; + float randomDustSpawnLocation = projectile.rotation + Main.rand.NextFloatDirection() * MathHelper.PiOver2 * 0.7f; + Vector2 dustPosition = projectile.Center + randomDustSpawnLocation.ToRotationVector2() * 84f * projectile.scale; + if (Main.rand.NextBool(5)) + { + Dust dust = Dust.NewDustPerfect(dustPosition, 14, null, 150, default, 1.4f); + dust.noLight = (dust.noLightEmittence = true); + } + + for (int i = 0; (float)i < 3f * projectile.Opacity; i++) + { + Vector2 dustVelocity = projectile.velocity.SafeNormalize(Vector2.UnitX); + int dustType = ((Main.rand.NextFloat() < projectile.Opacity) ? 75 : 27); + Dust dust = Dust.NewDustPerfect(dustPosition, dustType, projectile.velocity * 0.2f + dustVelocity * 3f, 100, default, 1.4f); + dust.noGravity = true; + dust.customData = projectile.Opacity * 0.2f; + } + + return false; + } + + else if (projectile.type == ProjectileID.ChlorophyteBullet) + { + if (projectile.alpha < 170) + { + int totalDust = 5; + for (int i = 0; i < totalDust; i++) + { + float x2 = projectile.position.X - projectile.velocity.X / (float)totalDust * (float)i; + float y2 = projectile.position.Y - projectile.velocity.Y / (float)totalDust * (float)i; + int dust = Dust.NewDust(new Vector2(x2, y2), 1, 1, 75); + Main.dust[dust].alpha = projectile.alpha; + Main.dust[dust].position.X = x2; + Main.dust[dust].position.Y = y2; + Main.dust[dust].velocity *= 0f; + Main.dust[dust].noGravity = true; + } + } + + float velocityLength = (float)Math.Sqrt(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y); + float cachedVelocityLength = projectile.localAI[0]; + if (cachedVelocityLength == 0f) + { + projectile.localAI[0] = velocityLength; + cachedVelocityLength = velocityLength; + } + + if (projectile.alpha > 0) + projectile.alpha -= 25; + + if (projectile.alpha < 0) + projectile.alpha = 0; + + float posX = projectile.position.X; + float posY = projectile.position.Y; + float homingDistance = 300f; + bool homeIn = false; + int target = 0; + if (projectile.ai[1] == 0f) + { + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].CanBeChasedBy(this) && (projectile.ai[1] == 0f || projectile.ai[1] == (float)(i + 1))) + { + float targetCenterX = Main.npc[i].Center.X; + float targetCenterY = Main.npc[i].Center.Y; + float targetDistance = Math.Abs(projectile.Center.X - targetCenterX) + Math.Abs(projectile.Center.Y - targetCenterY); + if (targetDistance < homingDistance && Collision.CanHit(projectile.Center, 1, 1, Main.npc[i].position, Main.npc[i].width, Main.npc[i].height)) + { + homingDistance = targetDistance; + posX = targetCenterX; + posY = targetCenterY; + homeIn = true; + target = i; + } + } + } + + if (homeIn) + projectile.ai[1] = target + 1; + + homeIn = false; + } + + if (projectile.ai[1] > 0f) + { + int targetIndex = (int)(projectile.ai[1] - 1f); + if (Main.npc[targetIndex].active && Main.npc[targetIndex].CanBeChasedBy(this, ignoreDontTakeDamage: true) && !Main.npc[targetIndex].dontTakeDamage) + { + float targetCenterX = Main.npc[targetIndex].Center.X; + float targetCenterY = Main.npc[targetIndex].Center.Y; + float homingCutOffDistance = 1000f; + if (Math.Abs(projectile.Center.X - targetCenterX) + Math.Abs(projectile.Center.Y - targetCenterY) < homingCutOffDistance) + { + homeIn = true; + posX = Main.npc[targetIndex].Center.X; + posY = Main.npc[targetIndex].Center.Y; + } + } + else + projectile.ai[1] = 0f; + } + + if (!projectile.friendly) + homeIn = false; + + if (homeIn) + { + int inertia = 8; + float homingSpeed = cachedVelocityLength; + Vector2 destination = new Vector2(posX, posY); + Vector2 homeDirection = (destination - projectile.Center).SafeNormalize(Vector2.UnitY); + projectile.velocity = (projectile.velocity * inertia + homeDirection * homingSpeed) / (inertia + 1f); + } + + projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; + + return false; + } + + // Adjust dust to avoid lag. + else if (projectile.type == ProjectileID.VampireHeal) + { + projectile.HealingProjectile((int)projectile.ai[1], (int)projectile.ai[0], 4f, 15f); + + int dust = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.VampireHeal, 0f, 0f, 100); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0f; + Main.dust[dust].position.X -= projectile.velocity.X * 0.2f; + Main.dust[dust].position.Y += projectile.velocity.Y * 0.2f; + + return false; + } + + // Adjust dust to avoid lag. + else if (projectile.type == ProjectileID.SpectreWrath) + { + projectile.ai[1] += 1f; + if (projectile.ai[1] >= 60f) + { + projectile.friendly = true; + int target = (int)projectile.ai[0]; + if (Main.myPlayer == projectile.owner && (target == -1 || !Main.npc[target].CanBeChasedBy(projectile))) + { + target = -1; + int[] array = new int[Main.maxNPCs]; + int randomTargets = 0; + float homingDistance = 800f; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].CanBeChasedBy(projectile)) + { + float distanceFromTarget = Math.Abs(Main.npc[i].Center.X - projectile.Center.X) + Math.Abs(Main.npc[i].Center.Y - projectile.Center.Y); + if (distanceFromTarget < homingDistance) + { + array[randomTargets] = i; + randomTargets++; + } + } + } + + if (randomTargets == 0) + { + projectile.Kill(); + return false; + } + + target = array[Main.rand.Next(randomTargets)]; + projectile.ai[0] = target; + projectile.netUpdate = true; + } + + if (target != -1) + { + int inertia = 30; + float homingSpeed = 4f; + Vector2 homeDirection = (Main.npc[target].Center - projectile.Center).SafeNormalize(Vector2.UnitY); + projectile.velocity = (projectile.velocity * inertia + homeDirection * homingSpeed) / (inertia + 1f); + } + } + + int maxDust = 3; + float dustOffsetMultiplier = 1f / (float)maxDust; + for (int i = 0; i < maxDust; i++) + { + float dustOffsetX = projectile.velocity.X * dustOffsetMultiplier * (float)i; + float dustOffsetY = (0f - projectile.velocity.Y * dustOffsetMultiplier) * (float)i; + int dust = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.SpectreStaff, 0f, 0f, 100, default, 1.3f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0f; + Main.dust[dust].position.X -= dustOffsetX; + Main.dust[dust].position.Y -= dustOffsetY; + } + + return false; + } + + // Adjust dust to avoid lag. + else if (projectile.type == ProjectileID.SpiritHeal) + { + projectile.HealingProjectile((int)projectile.ai[1], (int)projectile.ai[0], 4f, 15f); + + int maxDust = 3; + float dustOffsetMultiplier = 1f / (float)maxDust; + for (int i = 0; i < maxDust; i++) + { + float dustOffsetX = projectile.velocity.X * dustOffsetMultiplier * (float)i; + float dustOffsetY = (0f - projectile.velocity.Y * dustOffsetMultiplier) * (float)i; + int dust = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.SpectreStaff, 0f, 0f, 100, default, 1.3f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0f; + Main.dust[dust].position.X -= dustOffsetX; + Main.dust[dust].position.Y -= dustOffsetY; + } + + return false; + } + + else if (projectile.type == ProjectileID.NurseSyringeHeal) { ref float initialSpeed = ref projectile.localAI[1]; if (initialSpeed == 0f) @@ -730,7 +1847,7 @@ namespace CalamityMod.Projectiles if (projectile.ai[1] == 0f) { projectile.ai[1] = 1f; - SoundEngine.PlaySound(SoundID.Item34, projectile.position); + SoundEngine.PlaySound(SoundID.Item34, projectile.Center); } else if (projectile.ai[1] == 1f && Main.netMode != NetmodeID.MultiplayerClient) { @@ -814,33 +1931,33 @@ namespace CalamityMod.Projectiles projectile.frame = 0; } - if (Main.rand.Next(4) == 0) + if (Main.rand.NextBool(4)) { Vector2 value4 = -Vector2.UnitX.RotatedByRandom(MathHelper.ToRadians(11.25f)).RotatedBy(projectile.velocity.ToRotation()); - Dust smoke = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, 31, 0f, 0f, 100); + Dust smoke = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, DustID.Smoke, 0f, 0f, 100); smoke.velocity *= 0.1f; smoke.position = projectile.Center + value4 * projectile.width / 2f; smoke.fadeIn = 0.9f; } - if (Main.rand.Next(32) == 0) + if (Main.rand.NextBool(32)) { Vector2 value5 = -Vector2.UnitX.RotatedByRandom(MathHelper.ToRadians(22.5f)).RotatedBy(projectile.velocity.ToRotation()); - Dust smoke = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, 31, 0f, 0f, 155, default, 0.8f); + Dust smoke = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, DustID.Smoke, 0f, 0f, 155, default, 0.8f); smoke.velocity *= 0.3f; smoke.position = projectile.Center + value5 * projectile.width / 2f; - if (Main.rand.Next(2) == 0) + if (Main.rand.NextBool(2)) smoke.fadeIn = 1.4f; } - if (Main.rand.Next(2) == 0) + if (Main.rand.NextBool(2)) { Vector2 value6 = -Vector2.UnitX.RotatedByRandom(MathHelper.ToRadians(45f)).RotatedBy(projectile.velocity.ToRotation()); - Dust shflame = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, 27, 0f, 0f, 0, default, 1.2f); + Dust shflame = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, DustID.Shadowflame, 0f, 0f, 0, default, 1.2f); shflame.velocity *= 0.3f; shflame.noGravity = true; shflame.position = projectile.Center + value6 * projectile.width / 2f; - if (Main.rand.Next(2) == 0) + if (Main.rand.NextBool(2)) shflame.fadeIn = 1.4f; } @@ -851,7 +1968,7 @@ namespace CalamityMod.Projectiles if (projectile.localAI[1] == 0f) { projectile.localAI[1] = 1f; - SoundEngine.PlaySound(SoundID.Item120, projectile.position); + SoundEngine.PlaySound(SoundID.Item120, projectile.Center); } projectile.ai[0] += 1f; @@ -922,7 +2039,7 @@ namespace CalamityMod.Projectiles for (int num724 = 0; num724 < 6; num724++) { Vector2 vector51 = projectile.Center + spinningpoint13.RotatedBy(num724 * MathHelper.TwoPi / 6f); - Dust ice = Dust.NewDustDirect(vector51 + Utils.RandomVector2(Main.rand, -8f, 8f) / 2f, 8, 8, 197, 0f, 0f, 100, Color.Transparent); + Dust ice = Dust.NewDustDirect(vector51 + Utils.RandomVector2(Main.rand, -8f, 8f) / 2f, 8, 8, DustID.NorthPole, 0f, 0f, 100, Color.Transparent); ice.noGravity = true; } @@ -1014,8 +2131,21 @@ namespace CalamityMod.Projectiles } } + // Making Rocket Launcher, Grenade Launcher, Proximity Mine Launcher, and Cluster Rocket fragments not damage the player. + bool isGrenadeLauncherProj = (projectile.type == 133 || projectile.type == 136 || projectile.type == 139 || projectile.type == 142 || projectile.type == 777 || projectile.type == 781 || projectile.type == 785 || projectile.type == 788 || projectile.type == 791 || projectile.type == 794 || projectile.type == 797 || projectile.type == 800); + bool isRocketLauncherProj = (projectile.type == 134 || projectile.type == 137 || projectile.type == 140 || projectile.type == 143 || projectile.type == 776 || projectile.type == 780 || projectile.type == 784 || projectile.type == 787 || projectile.type == 790 || projectile.type == 793 || projectile.type == 796 || projectile.type == 799); + bool isProximityMineProj = (projectile.type == 135 || projectile.type == 138 || projectile.type == 141 || projectile.type == 144 || projectile.type == 778 || projectile.type == 782 || projectile.type == 786 || projectile.type == 789 || projectile.type == 792 || projectile.type == 795 || projectile.type == 798 || projectile.type == 801); + + if (isGrenadeLauncherProj || isRocketLauncherProj || isProximityMineProj || projectile.type == ProjectileID.ClusterFragmentsI || projectile.type == ProjectileID.ClusterFragmentsII) + { + ProjectileID.Sets.RocketsSkipDamageForPlayers[projectile.type] = true; + } + if (CalamityWorld.revenge || BossRushEvent.BossRushActive) { + bool masterMode = Main.masterMode || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + if (projectile.type == ProjectileID.DeerclopsIceSpike) { int dustType = 16; @@ -1023,8 +2153,8 @@ namespace CalamityMod.Projectiles int numDust = 5; int numDust2 = 5; int fadeInTime = 10; - int fadeOutGateValue = 10; - float killGateValue = 20f; + int fadeOutGateValue = masterMode ? 80 : death ? 50 : 10; + float killGateValue = masterMode ? 90f : death ? 60f : 20f; int maxFrames = 5; bool fadeIn = projectile.ai[0] < (float)fadeInTime; @@ -1058,6 +2188,9 @@ namespace CalamityMod.Projectiles if (fadeIn) { projectile.Opacity += 0.1f; + if (projectile.Opacity > 1f) + projectile.Opacity = 1f; + projectile.scale = projectile.Opacity * projectile.ai[1]; } @@ -1099,32 +2232,36 @@ namespace CalamityMod.Projectiles } if (projectile.ai[0] >= 5f + projectile.ai[2]) - projectile.velocity.Y += 0.15f; + projectile.velocity.Y += 0.3f; // Create a wave of rubble // Make sure the projectile doesn't despawn before it starts going up if (projectile.ai[0] <= projectile.ai[2]) { + projectile.Opacity = 0.4f; + projectile.timeLeft += 1; // Use the expected velocity when the time is right if (projectile.ai[0] == projectile.ai[2]) { projectile.velocity *= 100f; - projectile.velocity *= 12f + Main.rand.NextFloat() * 2f; + projectile.velocity *= (masterMode ? 20f : death ? 16f : 12f) + Main.rand.NextFloat() * 2f; } } + else + projectile.Opacity = 1f; return false; } else if (projectile.type == ProjectileID.DemonSickle) { - if (Main.wofNPCIndex < 0 || !Main.npc[Main.wofNPCIndex].active || Main.npc[Main.wofNPCIndex].life <= 0) + if (Main.wofNPCIndex < 0 || !Main.npc[Main.wofNPCIndex].active || Main.npc[Main.wofNPCIndex].life <= 0 || projectile.tileCollide) return true; if (projectile.ai[0] == 0f) - SoundEngine.PlaySound(SoundID.Item8, projectile.position); + SoundEngine.PlaySound(SoundID.Item8, projectile.Center); projectile.rotation += projectile.direction * 0.8f; @@ -1154,48 +2291,25 @@ namespace CalamityMod.Projectiles for (int i = 0; i < 2; i++) { - Dust shflame = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, 27, 0f, 0f, 100); + Dust shflame = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, DustID.Shadowflame, 0f, 0f, 100); shflame.noGravity = true; } return false; } - else if (projectile.type == ProjectileID.EyeLaser && projectile.ai[0] == 1f) - { - projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; - - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.3f / 255f, 0f, (255 - projectile.alpha) * 0.3f / 255f); - - if (projectile.alpha > 0) - projectile.alpha -= 125; - if (projectile.alpha < 0) - projectile.alpha = 0; - - if (projectile.localAI[1] == 0f) - { - SoundEngine.PlaySound(SoundID.Item33, projectile.position); - projectile.localAI[1] = 1f; - } - - if (projectile.velocity.Length() < 12f) - projectile.velocity *= 1.0025f; - - return false; - } - else if (projectile.type == ProjectileID.QueenSlimeGelAttack) { - // Phase 1 and 2 projectiles do not bounce and do not have gravity. + // Phase 1 and 2 projectiles do not bounce. if (projectile.ai[1] == -2f) { - if (projectile.alpha == 0 && Main.rand.Next(3) == 0) + if (projectile.alpha == 0 && Main.rand.NextBool(3)) { Color newColor = NPC.AI_121_QueenSlime_GetDustColor(); newColor.A = 150; int num72 = 8; bool noGravity = Main.rand.NextBool(); - Dust slime = Dust.NewDustDirect(projectile.position - new Vector2(num72, num72) + projectile.velocity, projectile.width + num72 * 2, projectile.height + num72 * 2, 4, 0f, 0f, 50, newColor, 1.2f); + Dust slime = Dust.NewDustDirect(projectile.position - new Vector2(num72, num72) + projectile.velocity, projectile.width + num72 * 2, projectile.height + num72 * 2, DustID.TintableDust, 0f, 0f, 50, newColor, 1.2f); slime.velocity *= 0.3f; slime.velocity += projectile.velocity * 0.3f; slime.noGravity = noGravity; @@ -1207,7 +2321,11 @@ namespace CalamityMod.Projectiles projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.05f; - if (CalamityWorld.LegendaryMode && projectile.velocity.Length() > 2f) + projectile.velocity.Y += 0.1f; + if (projectile.velocity.Y > 16f) + projectile.velocity.Y = 16f; + + if (CalamityWorld.LegendaryMode && projectile.velocity.Length() > 4f) projectile.velocity *= 0.985f; return false; @@ -1225,10 +2343,10 @@ namespace CalamityMod.Projectiles projectile.frame = Main.rand.Next(3); } - if (projectile.alpha == 0 && Main.rand.Next(3) == 0) + if (projectile.alpha == 0 && Main.rand.NextBool(3)) { Color newColor = new Color(78, 136, 255, 150); - Dust slime = Dust.NewDustDirect(projectile.position + projectile.velocity, projectile.width, projectile.height, 4, 0f, 0f, 50, newColor, 1.2f); + Dust slime = Dust.NewDustDirect(projectile.position + projectile.velocity, projectile.width, projectile.height, DustID.TintableDust, 0f, 0f, 50, newColor, 1.2f); slime.velocity *= 0.3f; slime.velocity += projectile.velocity * 0.3f; slime.noGravity = true; @@ -1255,27 +2373,120 @@ namespace CalamityMod.Projectiles } } - else if (projectile.type == ProjectileID.DeathLaser && projectile.ai[0] == 1f) + else if (projectile.type == ProjectileID.BombSkeletronPrime && projectile.ai[0] < 0f && masterMode) { - // Unlikely that vanilla sets originalDamage for hostile projectiles. - // TODO -- this might not work and mech boss projectiles might deal too much damage again. - if (projectile.originalDamage == 0) + int num = (int)(projectile.Center.X / 16f); + int num2 = (int)(projectile.Center.Y / 16f); + if (WorldGen.InWorld(num, num2) && projectile.tileCollide) { - // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + Tile tile = Main.tile[num, num2]; + if (tile != null && tile.HasTile && (TileID.Sets.Platforms[tile.TileType] || tile.TileType == TileID.PlanterBox)) { - if (!NPC.downedMechBossAny) - projectile.damage = (int)(projectile.damage * 0.8); - else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) - projectile.damage = (int)(projectile.damage * 0.9); + projectile.Kill(); + return false; } - - projectile.originalDamage = projectile.damage; } + bool masterModeSkeletronPrimeHomingBomb = projectile.ai[0] == -1f; + bool masterModeSkeletronPrimeFallingBomb = projectile.ai[0] == -2f; + + int target = 0; + target = Player.FindClosest(projectile.Center, 1, 1); + + if (projectile.Hitbox.Intersects(Main.player[target].Hitbox)) + { + projectile.Kill(); + return false; + } + + if (projectile.timeLeft < SkeletronPrime2.BombTimeLeft / 2 && projectile.timeLeft > 3) + projectile.tileCollide = true; + + if (masterModeSkeletronPrimeHomingBomb) + { + projectile.ai[1] += 1f; + float homingStartTime = 20f; + float homingEndTime = death ? 140f : 110f; + + if (Vector2.Distance(projectile.Center, Main.player[target].Center) < 192f && projectile.ai[1] < homingEndTime) + projectile.ai[1] = homingEndTime; + + if (projectile.ai[1] < homingEndTime && projectile.ai[1] > homingStartTime) + { + float num134 = projectile.velocity.Length(); + Vector2 vector24 = Main.player[target].Center - projectile.Center; + vector24.Normalize(); + vector24 *= num134; + float inertia = death ? 25f : 30f; + projectile.velocity = (projectile.velocity * (inertia - 1f) + vector24) / inertia; + projectile.velocity.Normalize(); + projectile.velocity *= num134; + } + + float maxVelocity = death ? 18f : 15f; + float acceleration = 1.02f; + if (projectile.velocity.Length() < maxVelocity) + projectile.velocity *= acceleration; + } + else + { + if (projectile.velocity.Y > 10f) + projectile.velocity.Y = 10f; + } + + if (projectile.localAI[0] == 0f) + { + projectile.localAI[0] = 1f; + SoundEngine.PlaySound(SoundID.Item10, projectile.Center); + } + + projectile.frameCounter++; + if (projectile.frameCounter > 3) + { + projectile.frame++; + projectile.frameCounter = 0; + } + + if (projectile.frame > 1) + projectile.frame = 0; + + if (projectile.owner == Main.myPlayer && projectile.timeLeft <= 3) + { + projectile.tileCollide = false; + projectile.ai[2] = 0f; + projectile.alpha = 255; + } + else if (Main.rand.NextBool()) + { + int num28 = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Smoke, 0f, 0f, 100); + Main.dust[num28].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[num28].fadeIn = 1.5f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[num28].noGravity = true; + Main.dust[num28].position = projectile.Center + new Vector2(0f, -projectile.height / 2).RotatedBy(projectile.rotation) * 1.1f; + int num29 = 6; + Dust dust8 = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, num29, 0f, 0f, 100); + dust8.scale = 1f + (float)Main.rand.Next(5) * 0.1f; + dust8.noGravity = true; + dust8.position = projectile.Center + new Vector2(0f, -projectile.height / 2 - 6).RotatedBy(projectile.rotation) * 1.1f; + } + + if (masterModeSkeletronPrimeFallingBomb) + { + projectile.ai[2] += 1f; + if (projectile.ai[2] > 60f) + projectile.velocity.Y += 0.2f; + } + + projectile.rotation += projectile.velocity.X * 0.1f; + + return false; + } + + else if (projectile.type == ProjectileID.FrostBeam && projectile.ai[0] == 1f) + { projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.75f / 255f, 0f, 0f); + Lighting.AddLight(projectile.Center, 0f, (255 - projectile.alpha) * 0.15f / 255f, (255 - projectile.alpha) * 0.6f / 255f); if (projectile.alpha > 0) projectile.alpha -= 125; @@ -1284,11 +2495,11 @@ namespace CalamityMod.Projectiles if (projectile.localAI[1] == 0f) { - SoundEngine.PlaySound(SoundID.Item33, projectile.position); + SoundEngine.PlaySound(SoundID.Item33, projectile.Center); projectile.localAI[1] = 1f; } - if (projectile.velocity.Length() < 12f) + if (projectile.velocity.Length() < AcceleratingBossLaserVelocityCap) projectile.velocity *= 1.0025f; return false; @@ -1296,17 +2507,28 @@ namespace CalamityMod.Projectiles else if (projectile.type == ProjectileID.RocketSkeleton && projectile.ai[1] == 1f) { + bool primeCannonProjectile = projectile.ai[1] == 2f; bool homeIn = false; - float spreadOutCutoffTime = 510f; - float homeInCutoffTime = 420f; - float minAcceleration = 0.05f; - float maxAcceleration = 0.1f; - float homingVelocity = 25f; + float homingTime = masterMode ? 90f : 180f; + float spreadOutCutoffTime = 555f; + float homeInCutoffTime = spreadOutCutoffTime - homingTime; + float minAcceleration = masterMode ? 0.072f : 0.08f; + float maxAcceleration = masterMode ? 0.108f : 0.12f; + float homingVelocity = masterMode ? 22.5f : 25f; + float maxVelocity = masterMode ? 13.5f : 15f; - if (projectile.timeLeft > homeInCutoffTime && projectile.timeLeft <= spreadOutCutoffTime) - homeIn = true; - else if (projectile.velocity.Length() < 15f) - projectile.velocity *= 1.1f; + if (!primeCannonProjectile) + { + if (projectile.timeLeft > homeInCutoffTime && projectile.timeLeft <= spreadOutCutoffTime) + homeIn = true; + else if (projectile.velocity.Length() < maxVelocity) + projectile.velocity *= 1.01f; + } + else + { + if (projectile.velocity.Length() < maxVelocity) + projectile.velocity *= 1.01f; + } if (homeIn) { @@ -1320,14 +2542,16 @@ namespace CalamityMod.Projectiles float amount = MathHelper.Lerp(minAcceleration, maxAcceleration, Utils.GetLerpValue(spreadOutCutoffTime, 30f, projectile.timeLeft, clamped: true)); projectile.velocity = Vector2.SmoothStep(projectile.velocity, velocity, amount); + + // Stop homing when within a certain distance of the target + if (Vector2.Distance(projectile.Center, Main.player[playerIndex].Center) < (masterMode ? 192f : 96f) && projectile.timeLeft > homeInCutoffTime) + projectile.timeLeft = (int)homeInCutoffTime; } if (projectile.timeLeft <= 3) { - projectile.position.X += projectile.width / 2; - projectile.position.Y += projectile.height / 2; - projectile.width = 128; - projectile.height = 128; + projectile.position = projectile.Center; + projectile.width = projectile.height = 128; projectile.position.X -= projectile.width / 2; projectile.position.Y -= projectile.height / 2; } @@ -1349,12 +2573,12 @@ namespace CalamityMod.Projectiles num23 = projectile.velocity.Y * 0.5f; } - Dust fire = Dust.NewDustDirect(new Vector2(projectile.position.X + 3f + num22, projectile.position.Y + 3f + num23) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 6, 0f, 0f, 100); + Dust fire = Dust.NewDustDirect(new Vector2(projectile.position.X + 3f + num22, projectile.position.Y + 3f + num23) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, DustID.Torch, 0f, 0f, 100); fire.scale *= 2f + Main.rand.Next(10) * 0.1f; fire.velocity *= 0.2f; fire.noGravity = true; - Dust smoke = Dust.NewDustDirect(new Vector2(projectile.position.X + 3f + num22, projectile.position.Y + 3f + num23) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 31, 0f, 0f, 100, default(Color), 0.5f); + Dust smoke = Dust.NewDustDirect(new Vector2(projectile.position.X + 3f + num22, projectile.position.Y + 3f + num23) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, DustID.Smoke, 0f, 0f, 100, default(Color), 0.5f); smoke.fadeIn = 1f + Main.rand.Next(5) * 0.1f; smoke.velocity *= 0.05f; } @@ -1368,6 +2592,14 @@ namespace CalamityMod.Projectiles else if (projectile.type == ProjectileID.SeedPlantera || projectile.type == ProjectileID.PoisonSeedPlantera) { + // For Plantera's shotgun spread. + // Make the seeds faster until they hit the intended velocity to avoid unfair hits after charges. + if (projectile.ai[2] > 0f) + { + if (projectile.velocity.Length() < projectile.ai[2]) + projectile.velocity *= 1.012f; + } + projectile.frameCounter++; if (projectile.frameCounter > 1) { @@ -1381,7 +2613,7 @@ namespace CalamityMod.Projectiles if (projectile.ai[1] == 0f) { projectile.ai[1] = 1f; - SoundEngine.PlaySound(SoundID.Item17, projectile.position); + SoundEngine.PlaySound(SoundID.Item17, projectile.Center); } if (projectile.alpha > 0) @@ -1390,14 +2622,14 @@ namespace CalamityMod.Projectiles projectile.alpha = 0; projectile.ai[0] += 1f; - if (projectile.ai[0] >= 120f) + if (projectile.ai[0] >= (masterMode ? 60f : 120f)) { if (projectile.velocity.Length() < 18f) projectile.velocity *= 1.01f; } projectile.tileCollide = projectile.ai[0] >= 300f; - + if (projectile.timeLeft > 600) projectile.timeLeft = 600; @@ -1427,7 +2659,7 @@ namespace CalamityMod.Projectiles { if (projectile.owner == Main.myPlayer) { - int totalProjectiles = 8; + int totalProjectiles = masterMode ? 12 : 8; float radians = MathHelper.TwoPi / totalProjectiles; int type = ModContent.ProjectileType(); float velocity = 1f; @@ -1439,7 +2671,7 @@ namespace CalamityMod.Projectiles } } - SoundEngine.PlaySound(SoundID.Item17, projectile.position); + SoundEngine.PlaySound(SoundID.Item17, projectile.Center); for (int i = 0; i < 8; i++) { @@ -1468,9 +2700,9 @@ namespace CalamityMod.Projectiles else { int closestPlayer = Player.FindClosest(projectile.Center, 1, 1); - float homingSpeed = 7.5f + Vector2.Distance(Main.player[closestPlayer].Center, projectile.Center) * 0.01f; + float homingSpeed = (masterMode ? 9f : 7.5f) + Vector2.Distance(Main.player[closestPlayer].Center, projectile.Center) * 0.01f; Vector2 homingVelocity = Vector2.Normalize(Main.player[closestPlayer].Center - projectile.Center) * homingSpeed; - int inertia = 200; + int inertia = masterMode ? 150 : 200; projectile.velocity.X = (projectile.velocity.X * (inertia - 1) + homingVelocity.X) / inertia; if (projectile.velocity.Length() > 16f) @@ -1492,306 +2724,114 @@ namespace CalamityMod.Projectiles return false; } - else if (projectile.type == ProjectileID.HallowBossRainbowStreak && projectile.hostile) + else if (projectile.type == ProjectileID.InfernoHostileBolt && projectile.ai[2] > 0f) { - bool spreadOut = false; - bool homeIn = false; - float spreadOutCutoffTime = 140f; - float homeInCutoffTime = Main.dayTime ? 55f : 80f; - float spreadDeceleration = 0.98f; - float minAcceleration = 0.05f; - float maxAcceleration = 0.1f; - float homingVelocity = 30f; - - if (projectile.timeLeft > spreadOutCutoffTime) - spreadOut = true; - else if (projectile.timeLeft > homeInCutoffTime) - homeIn = true; - - if (spreadOut) + if (projectile.localAI[0] == 0f) { - float spreadVelocity = (float)Math.Cos(projectile.whoAmI % 6f / 6f + projectile.position.X / 320f + projectile.position.Y / 160f); - projectile.velocity *= spreadDeceleration; - projectile.velocity = projectile.velocity.RotatedBy(spreadVelocity * MathHelper.TwoPi * 0.125f * 1f / 30f); + SoundEngine.PlaySound(SoundID.Item20, projectile.position); + projectile.localAI[0] += 1f; } - if (homeIn) - { - int playerIndex = (int)projectile.ai[0]; - Vector2 velocity = projectile.velocity; - if (Main.player.IndexInRange(playerIndex)) - { - Player player = Main.player[playerIndex]; - velocity = projectile.DirectionTo(player.Center) * homingVelocity; - } + bool killX = false; + bool killY = false; + if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) + killX = true; - float amount = MathHelper.Lerp(minAcceleration, maxAcceleration, Utils.GetLerpValue(spreadOutCutoffTime, 30f, projectile.timeLeft, clamped: true)); - projectile.velocity = Vector2.SmoothStep(projectile.velocity, velocity, amount); + if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) + killX = true; + + if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) + killY = true; + + if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) + killY = true; + + if (killX && killY) + projectile.Kill(); + + for (int i = 0; i < 10; i++) + { + int dust = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.IchorTorch, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1.6f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0.3f; + Main.dust[dust].velocity += projectile.velocity * 0.1f; + if (Main.getGoodWorld) + Main.dust[dust].noLight = true; } - projectile.Opacity = Utils.GetLerpValue(240f, 220f, projectile.timeLeft, clamped: true); - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.Pi / 2f; + Particle theSpark = new AltSparkParticle(projectile.Center, projectile.velocity * 0.06f + projectile.velocity * 0.1f, false, 40, 1f, new Color(255, 255, 100)); + GeneralParticleHandler.SpawnParticle(theSpark); return false; } - // Phase 1 sharknado - else if (projectile.type == ProjectileID.SharknadoBolt) + else if (projectile.type == ProjectileID.InfernoHostileBlast && projectile.ai[2] > 0f) { - if (projectile.ai[1] < 0f) + if (projectile.localAI[0] == 0f) { - float num623 = 0.209439516f; - float num624 = -2f; - float num625 = (float)(Math.Cos(num623 * projectile.ai[0]) - 0.5) * num624; - - projectile.velocity.Y -= num625; - - projectile.ai[0] += 1f; - - num625 = (float)(Math.Cos(num623 * projectile.ai[0]) - 0.5) * num624; - - projectile.velocity.Y += num625; - + SoundEngine.PlaySound(SoundID.Item74, projectile.position); projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 10f) - { - projectile.alpha -= 5; - if (projectile.alpha < 100) - projectile.alpha = 100; - - projectile.rotation += projectile.velocity.X * 0.1f; - projectile.frame = (int)(projectile.localAI[0] / 3f) % 3; - } - - return false; } - } - else if (projectile.type == ProjectileID.Sharknado) - { - projectile.damage = projectile.GetProjectileDamage(NPCID.DukeFishron); - } + projectile.ai[0] += 1f; - // Larger cthulhunadoes - else if (projectile.type == ProjectileID.Cthulunado) - { - projectile.damage = projectile.GetProjectileDamage(NPCID.DukeFishron); + float totalDust = 20f; + if (projectile.ai[0] > 540f) + totalDust -= (projectile.ai[0] - 180f) / 2f; - int num606 = 16; - int num607 = 16; - float num608 = 2f; - int num609 = 150; - int num610 = 42; - - if (projectile.velocity.X != 0f) - projectile.direction = projectile.spriteDirection = -Math.Sign(projectile.velocity.X); - - int num3 = projectile.frameCounter; - projectile.frameCounter = num3 + 1; - if (projectile.frameCounter > 2) + if (totalDust <= 0f) { - num3 = projectile.frame; - projectile.frame = num3 + 1; - projectile.frameCounter = 0; + totalDust = 0f; + projectile.Kill(); } - if (projectile.frame >= 6) - projectile.frame = 0; - if (projectile.localAI[0] == 0f && Main.myPlayer == projectile.owner) + float maxDustVelocityX = 10f; + float maxDustVelocityY = 10f; + float minDustSpeed = 3f; + float maxDustSpeed = 8f; + + for (int i = 0; i < (int)totalDust; i++) { - projectile.localAI[0] = 1f; - projectile.position.X += projectile.width / 2; - projectile.position.Y += projectile.height / 2; - projectile.scale = (num606 + num607 - projectile.ai[1]) * num608 / (num607 + num606); - projectile.width = (int)(num609 * projectile.scale); - projectile.height = (int)(num610 * projectile.scale); - projectile.position.X -= projectile.width / 2; - projectile.position.Y -= projectile.height / 2; - projectile.netUpdate = true; + float dustVelocityX = Main.rand.NextFloat(-maxDustVelocityX, maxDustVelocityX); + float dustVelocityY = Main.rand.NextFloat(-maxDustVelocityY, maxDustVelocityY); + float randomDustSpeed = Main.rand.NextFloat(minDustSpeed, maxDustSpeed); + float velocityLength = (float)Math.Sqrt(dustVelocityX * dustVelocityX + dustVelocityY * dustVelocityY); + velocityLength = randomDustSpeed / velocityLength; + dustVelocityX *= velocityLength; + dustVelocityY *= velocityLength; + Vector2 dustVelocity = new Vector2(dustVelocityX, dustVelocityY); + Vector2 dustPosition = projectile.Center + new Vector2(Main.rand.NextFloat(-10f, 10f), Main.rand.NextFloat(-10f, 10f)); + int dust = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.IchorTorch, 0f, 0f, 100, default, 1.8f); + Main.dust[dust].noGravity = true; + Main.dust[dust].position = dustPosition; + Main.dust[dust].velocity = dustVelocity; + if (Main.getGoodWorld) + Main.dust[dust].noLight = true; } - if (projectile.ai[1] != -1f) - { - projectile.scale = (num606 + num607 - projectile.ai[1]) * num608 / (num607 + num606); - projectile.width = (int)(num609 * projectile.scale); - projectile.height = (int)(num610 * projectile.scale); - } + float maxSparkVelocityX = 10f; + float maxSparkVelocityY = 10f; + float minSparkSpeed = 3f; + float maxSparkSpeed = 7f; - if (!Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - projectile.alpha -= 30; - if (projectile.alpha < 60) - projectile.alpha = 60; - if (projectile.alpha < 100) - projectile.alpha = 100; - } - else - { - projectile.alpha += 30; - if (projectile.alpha > 150) - projectile.alpha = 150; - } + float sparkVelocityX = Main.rand.NextFloat(-maxSparkVelocityX, maxSparkVelocityX); + float sparkVelocityY = Main.rand.NextFloat(-maxSparkVelocityY, maxSparkVelocityY); + float randSparkSpeed = Main.rand.NextFloat(minSparkSpeed, maxSparkSpeed); + float sparkLength = (float)Math.Sqrt(sparkVelocityX * sparkVelocityX + sparkVelocityY * sparkVelocityY); + sparkLength = randSparkSpeed / sparkLength; + sparkVelocityX *= sparkLength; + sparkVelocityY *= sparkLength; - if (projectile.ai[0] > 0f) - projectile.ai[0] -= 1f; - - if (projectile.ai[0] == 1f && projectile.ai[1] > 0f && projectile.owner == Main.myPlayer) - { - projectile.netUpdate = true; - - Vector2 center = projectile.Center; - center.Y -= num610 * projectile.scale / 2f; - - float num611 = (num606 + num607 - projectile.ai[1] + 1f) * num608 / (num607 + num606); - center.Y -= num610 * num611 / 2f; - center.Y += 2f; - - Projectile.NewProjectile(projectile.GetSource_FromThis(), center.X, center.Y, projectile.velocity.X, projectile.velocity.Y, projectile.type, projectile.damage, projectile.knockBack, projectile.owner, 10f, projectile.ai[1] - 1f); - - if ((int)projectile.ai[1] % 3 == 0 && projectile.ai[1] != 0f) - { - int num614 = NPC.NewNPC(projectile.GetSource_FromAI(), (int)center.X, (int)center.Y, NPCID.Sharkron2); - Main.npc[num614].velocity = projectile.velocity; - Main.npc[num614].scale = 1.5f; - Main.npc[num614].netUpdate = true; - Main.npc[num614].ai[2] = projectile.width; - Main.npc[num614].ai[3] = -1.5f; - } - } - - if (projectile.ai[0] <= 0f) - { - float num615 = 0.104719758f; - float num616 = projectile.width / 5f * 2.5f; - float num617 = (float)(Math.Cos(num615 * -(double)projectile.ai[0]) - 0.5) * num616; - - projectile.position.X -= num617 * -projectile.direction; - - projectile.ai[0] -= 1f; - - num617 = (float)(Math.Cos(num615 * -(double)projectile.ai[0]) - 0.5) * num616; - projectile.position.X += num617 * -projectile.direction; - } + Particle theSpark = new AltSparkParticle(projectile.Center, new Vector2(sparkVelocityX, sparkVelocityY), false, 40, 1f, new Color(255, 255, 100)); + GeneralParticleHandler.SpawnParticle(theSpark); return false; } else if (projectile.type == ProjectileID.AncientDoomProjectile) { - if (projectile.velocity.Length() < 8f) - projectile.velocity *= 1.01f; - } - - else if (projectile.type == ProjectileID.CultistBossLightningOrb && BossRushEvent.BossRushActive) - { - if (NPC.AnyNPCs(NPCID.CultistBoss)) - { - if (projectile.localAI[1] == 0f) - { - SoundEngine.PlaySound(SoundID.Item121, projectile.position); - projectile.localAI[1] = 1f; - } - - if (projectile.ai[0] < 180f) - { - projectile.alpha -= 5; - if (projectile.alpha < 0) - projectile.alpha = 0; - } - else - { - projectile.alpha += 5; - if (projectile.alpha > 255) - { - projectile.alpha = 255; - projectile.Kill(); - return false; - } - } - - ref float reference = ref projectile.ai[0]; - ref float reference46 = ref reference; - float num15 = reference; - reference46 = num15 + 1f; - - if (projectile.ai[0] % 30f == 0f && projectile.ai[0] < 180f && Main.netMode != NetmodeID.MultiplayerClient) - { - int[] array6 = new int[5]; - Vector2[] array7 = new Vector2[5]; - int num731 = 0; - float num732 = 2000f; - - for (int num733 = 0; num733 < 255; num733++) - { - if (!Main.player[num733].active || Main.player[num733].dead) - continue; - - Vector2 center9 = Main.player[num733].Center; - float num734 = Vector2.Distance(center9, projectile.Center); - if (num734 < num732 && Collision.CanHit(projectile.Center, 1, 1, center9, 1, 1)) - { - array6[num731] = num733; - array7[num731] = center9; - int num34 = num731 + 1; - num731 = num34; - if (num34 >= array7.Length) - break; - } - } - - for (int num735 = 0; num735 < num731; num735++) - { - Vector2 vector52 = array7[num735] + Main.player[array6[num735]].velocity * 40f - projectile.Center; - float ai = Main.rand.Next(100); - Vector2 vector53 = Vector2.Normalize(vector52.RotatedByRandom(MathHelper.PiOver4)) * 7f; - Projectile.NewProjectile(projectile.GetSource_FromThis(), projectile.Center, vector53, 466, projectile.damage, 0f, Main.myPlayer, vector52.ToRotation(), ai); - } - } - - Lighting.AddLight(projectile.Center, 0.4f, 0.85f, 0.9f); - - if (++projectile.frameCounter >= 4) - { - projectile.frameCounter = 0; - if (++projectile.frame >= Main.projFrames[projectile.type]) - projectile.frame = 0; - } - - if (projectile.alpha >= 150 || !(projectile.ai[0] < 180f)) - return false; - - for (int num736 = 0; num736 < 1; num736++) - { - float num737 = (float)Main.rand.NextDouble() * 1f - 0.5f; - if (num737 < -0.5f) - num737 = -0.5f; - if (num737 > 0.5f) - num737 = 0.5f; - - Vector2 value40 = new Vector2(-projectile.width * 0.2f * projectile.scale, 0f).RotatedBy(num737 * MathHelper.TwoPi).RotatedBy(projectile.velocity.ToRotation()); - Dust zap = Dust.NewDustDirect(projectile.Center - Vector2.One * 5f, 10, 10, 226, (0f - projectile.velocity.X) / 3f, (0f - projectile.velocity.Y) / 3f, 150, Color.Transparent, 0.7f); - zap.position = projectile.Center + value40; - zap.velocity = Vector2.Normalize(zap.position - projectile.Center) * 2f; - zap.noGravity = true; - } - - for (int num739 = 0; num739 < 1; num739++) - { - float num740 = (float)Main.rand.NextDouble() * 1f - 0.5f; - if (num740 < -0.5f) - num740 = -0.5f; - if (num740 > 0.5f) - num740 = 0.5f; - - Vector2 value41 = new Vector2(-projectile.width * 0.6f * projectile.scale, 0f).RotatedBy(num740 * MathHelper.TwoPi).RotatedBy(projectile.velocity.ToRotation()); - Dust zap = Dust.NewDustDirect(projectile.Center - Vector2.One * 5f, 10, 10, 226, (0f - projectile.velocity.X) / 3f, (0f - projectile.velocity.Y) / 3f, 150, Color.Transparent, 0.7f); - zap.velocity = Vector2.Zero; - zap.position = projectile.Center + value41; - zap.noGravity = true; - } - - return false; - } + if (projectile.velocity.Length() < 6f) + projectile.velocity *= 1.005f; } else if (projectile.type == ProjectileID.CultistBossIceMist) @@ -1799,7 +2839,7 @@ namespace CalamityMod.Projectiles if (projectile.localAI[1] == 0f) { projectile.localAI[1] = 1f; - SoundEngine.PlaySound(SoundID.Item120, projectile.position); + SoundEngine.PlaySound(SoundID.Item120, projectile.Center); } projectile.ai[0] += 1f; @@ -1833,7 +2873,37 @@ namespace CalamityMod.Projectiles projectile.velocity.Normalize(); projectile.velocity *= scaleFactor2; - if (projectile.ai[0] % 60f == 0f && Main.netMode != NetmodeID.MultiplayerClient) + // Fly away from other Ice Mists in Master + if (masterMode) + { + float pushForce = 0.06f; + float pushDistance = 120f; + for (int k = 0; k < Main.maxProjectiles; k++) + { + Projectile otherProj = Main.projectile[k]; + // Short circuits to make the loop as fast as possible + if (!otherProj.active || k == projectile.whoAmI) + continue; + + // If the other projectile is indeed the same owned by the same player and they're too close, nudge them away + bool sameProjType = otherProj.type == projectile.type; + float taxicabDist = Vector2.Distance(projectile.Center, otherProj.Center); + if (sameProjType && taxicabDist < pushDistance) + { + if (projectile.position.X < otherProj.position.X) + projectile.velocity.X -= pushForce; + else + projectile.velocity.X += pushForce; + + if (projectile.position.Y < otherProj.position.Y) + projectile.velocity.Y -= pushForce; + else + projectile.velocity.Y += pushForce; + } + } + } + + if (projectile.ai[0] % (masterMode ? 30f : 60f) == 0f && Main.netMode != NetmodeID.MultiplayerClient) { Vector2 vector50 = projectile.rotation.ToRotationVector2(); Projectile.NewProjectile(projectile.GetSource_FromThis(), projectile.Center, vector50, projectile.type, projectile.damage, projectile.knockBack, projectile.owner); @@ -1847,9 +2917,12 @@ namespace CalamityMod.Projectiles } // Split projectiles + // MOST WACK ASS JANK FUCKING SHIT EVER + // WHAT THE FUCK projectile.position -= projectile.velocity; - if (projectile.ai[0] >= duration - 260f) + float splitProjectileDuration = duration - 255f; + if (projectile.ai[0] >= splitProjectileDuration - 5f) projectile.alpha += 3; else projectile.alpha -= 40; @@ -1859,14 +2932,14 @@ namespace CalamityMod.Projectiles if (projectile.alpha > 255) projectile.alpha = 255; - if (projectile.ai[0] >= duration - 255f) + if (projectile.ai[0] >= splitProjectileDuration) { projectile.Kill(); return false; } Vector2 value39 = new Vector2(0f, -720f).RotatedBy(projectile.velocity.ToRotation()); - float scaleFactor3 = projectile.ai[0] % (duration - 255f) / (duration - 255f); + float scaleFactor3 = projectile.ai[0] % splitProjectileDuration / splitProjectileDuration; Vector2 spinningpoint13 = value39 * scaleFactor3; for (int num724 = 0; num724 < 6; num724++) @@ -1877,7 +2950,7 @@ namespace CalamityMod.Projectiles for (int num725 = 0; num725 < 2; num725++) { - Dust ice = Dust.NewDustDirect(vector51 + Utils.RandomVector2(Main.rand, -8f, 8f) / 2f, 8, 8, 197, 0f, 0f, 100, Color.Transparent); + Dust ice = Dust.NewDustDirect(vector51 + Utils.RandomVector2(Main.rand, -8f, 8f) / 2f, 8, 8, DustID.NorthPole, 0f, 0f, 100, Color.Transparent); ice.noGravity = true; } } @@ -1982,14 +3055,14 @@ namespace CalamityMod.Projectiles return false; } - float velocityLimit = ((CalamityWorld.death || BossRushEvent.BossRushActive) ? 28f : 24f) / MathHelper.Clamp(lineColor * 0.75f, 1f, 3f); + float velocityLimit = (death ? 28f : 24f) / MathHelper.Clamp(lineColor * 0.75f, 1f, 3f); if (projectile.velocity.Length() < velocityLimit) projectile.velocity *= 1.01f; } if (projectile.alpha < 40) { - Dust dust = Dust.NewDustDirect(projectile.Center - Vector2.One * 5f, 10, 10, 229, (0f - projectile.velocity.X) / 3f, (0f - projectile.velocity.Y) / 3f, 150, Color.Transparent, 1.2f); + Dust dust = Dust.NewDustDirect(projectile.Center - Vector2.One * 5f, 10, 10, DustID.Vortex, (0f - projectile.velocity.X) / 3f, (0f - projectile.velocity.Y) / 3f, 150, Color.Transparent, 1.2f); dust.noGravity = true; } @@ -2001,7 +3074,7 @@ namespace CalamityMod.Projectiles // Moon Lord big eye spheres else if (projectile.type == ProjectileID.PhantasmalSphere && Main.npc[(int)projectile.ai[1]].type == NPCID.MoonLordHand) { - float velocityLimit = (CalamityWorld.death || BossRushEvent.BossRushActive) ? 14f : 12f; + float velocityLimit = death ? 14f : 12f; if (projectile.velocity.Length() < velocityLimit) projectile.velocity *= 1.0075f; @@ -2025,7 +3098,7 @@ namespace CalamityMod.Projectiles } projectile.localAI[0]++; - if (projectile.localAI[0] >= 330f && projectile.ai[0] > 0f && Main.netMode != 1) + if (projectile.localAI[0] >= 330f && projectile.ai[0] > 0f && Main.netMode != NetmodeID.MultiplayerClient) { projectile.ai[0] *= -1f; projectile.netUpdate = true; @@ -2093,7 +3166,7 @@ namespace CalamityMod.Projectiles projectile.velocity = -Vector2.UnitY; if (projectile.localAI[0] == 0f) - SoundEngine.PlaySound(SoundID.Zombie104, projectile.position); + SoundEngine.PlaySound(SoundID.Zombie104, projectile.Center); float num801 = 1f; projectile.localAI[0] += 1f; @@ -2145,19 +3218,19 @@ namespace CalamityMod.Projectiles Vector2 vector79 = projectile.Center + projectile.velocity * (projectile.localAI[1] - 14f); for (int num809 = 0; num809 < 2; num809 = num3 + 1) { - float num810 = projectile.velocity.ToRotation() + ((Main.rand.Next(2) == 1) ? -1f : 1f) * MathHelper.PiOver2; + float num810 = projectile.velocity.ToRotation() + ((Main.rand.NextBool(2)) ? -1f : 1f) * MathHelper.PiOver2; float num811 = (float)Main.rand.NextDouble() * 2f + 2f; Vector2 vector80 = new((float)Math.Cos(num810) * num811, (float)Math.Sin(num810) * num811); - Dust dust = Dust.NewDustDirect(vector79, 0, 0, 229, vector80.X, vector80.Y); + Dust dust = Dust.NewDustDirect(vector79, 0, 0, DustID.Vortex, vector80.X, vector80.Y); dust.noGravity = true; dust.scale = 1.7f; num3 = num809; } - if (Main.rand.Next(5) == 0) + if (Main.rand.NextBool(5)) { Vector2 value29 = projectile.velocity.RotatedBy(MathHelper.PiOver2) * ((float)Main.rand.NextDouble() - 0.5f) * projectile.width; - Dust smoke = Dust.NewDustDirect(vector79 + value29 - Vector2.One * 4f, 8, 8, 31, 0f, 0f, 100, default, 1.5f); + Dust smoke = Dust.NewDustDirect(vector79 + value29 - Vector2.One * 4f, 8, 8, DustID.Smoke, 0f, 0f, 100, default, 1.5f); smoke.velocity *= 0.5f; smoke.velocity.Y = -Math.Abs(smoke.velocity.Y); } @@ -2184,35 +3257,126 @@ namespace CalamityMod.Projectiles { if (projectile.hostile) { - // These projectiles are way too fucking fast so they need to be slower - if ((projectile.type == ProjectileID.QueenSlimeMinionBlueSpike && projectile.ai[1] >= 0f) || projectile.type == ProjectileID.QueenSlimeMinionPinkBall) - projectile.velocity *= 0.5f; - // Reduce Nail damage from Nailheads because they're stupid if (projectile.type == ProjectileID.Nail && Main.expertMode) projectile.damage /= 2; - if ((CalamityLists.hardModeNerfList.Contains(projectile.type) && Main.hardMode && !CalamityPlayer.areThereAnyDamnBosses && !Main.snowMoon) || projectile.type == ProjectileID.JavelinHostile) - projectile.damage = (int)(projectile.damage * 0.65); - - // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + // Nerf all these Master Mode enemy projectiles + if (Main.masterMode && !CalamityPlayer.areThereAnyDamnBosses) { - if (!NPC.downedMechBossAny) + switch (projectile.type) { - if (MechBossProjectileIDs.Contains(projectile.type)) - { - if (CalamityUtils.AnyBossNPCS(true)) - projectile.damage = (int)(projectile.damage * 0.8); - } + case ProjectileID.DemonSickle: + case ProjectileID.HarpyFeather: + case ProjectileID.JavelinHostile: + case ProjectileID.SalamanderSpit: + case ProjectileID.SkeletonBone: + case ProjectileID.IceSpike: + case ProjectileID.JungleSpike: + case ProjectileID.PinkLaser: + case ProjectileID.FrostBlastHostile: + case ProjectileID.GoldenShowerHostile: + case ProjectileID.RainNimbus: + case ProjectileID.FlamingArrow: + case ProjectileID.BulletDeadeye: + case ProjectileID.CannonballHostile: + case ProjectileID.UnholyTridentHostile: + case ProjectileID.FrostBeam: + case ProjectileID.CursedFlameHostile: + case ProjectileID.Stinger: + case ProjectileID.BloodNautilusTears: + case ProjectileID.RockGolemRock: + case ProjectileID.IcewaterSpit: + case ProjectileID.RocketSkeleton: + case ProjectileID.SniperBullet: + case ProjectileID.DrManFlyFlask: + case ProjectileID.DesertDjinnCurse: + case ProjectileID.InfernoHostileBlast: + case ProjectileID.InfernoHostileBolt: + case ProjectileID.Shadowflames: + case ProjectileID.ShadowBeamHostile: + case ProjectileID.PaladinsHammerHostile: + case ProjectileID.LostSoulHostile: + case ProjectileID.RuneBlast: + case ProjectileID.DandelionSeed: + case ProjectileID.SandnadoHostile: + case ProjectileID.SandnadoHostileMark: + case ProjectileID.SnowBallHostile: + case ProjectileID.EyeLaser: + case ProjectileID.Nail: + case ProjectileID.BrainScramblerBolt: + case ProjectileID.GigaZapperSpear: + case ProjectileID.MartianWalkerLaser: + case ProjectileID.RayGunnerLaser: + case ProjectileID.MartianTurretBolt: + case ProjectileID.NebulaSphere: + case ProjectileID.NebulaLaser: + case ProjectileID.NebulaBolt: + case ProjectileID.StardustJellyfishSmall: + case ProjectileID.StardustSoldierLaser: + case ProjectileID.Twinkle: + case ProjectileID.VortexAcid: + case ProjectileID.VortexLaser: + case ProjectileID.VortexLightning: + case ProjectileID.VortexVortexLightning: + case ProjectileID.FlamingWood: + case ProjectileID.GreekFire1: + case ProjectileID.GreekFire2: + case ProjectileID.GreekFire3: + case ProjectileID.FlamingScythe: + case ProjectileID.OrnamentHostile: + case ProjectileID.OrnamentHostileShrapnel: + case ProjectileID.PineNeedleHostile: + case ProjectileID.FrostShard: + case ProjectileID.FrostWave: + case ProjectileID.Missile: + case ProjectileID.Present: + case ProjectileID.Spike: + case ProjectileID.SaucerDeathray: + case ProjectileID.SaucerLaser: + case ProjectileID.SaucerMissile: + case ProjectileID.SaucerScrap: + case ProjectileID.DD2GoblinBomb: + case ProjectileID.DD2JavelinHostile: + case ProjectileID.DD2JavelinHostileT3: + case ProjectileID.DD2DarkMageBolt: + case ProjectileID.DD2DrakinShot: + case ProjectileID.DD2OgreSmash: + case ProjectileID.DD2OgreSpit: + case ProjectileID.DD2OgreStomp: + case ProjectileID.DD2LightningBugZap: + case ProjectileID.DD2BetsyFireball: + case ProjectileID.DD2BetsyFlameBreath: + projectile.damage = (int)Math.Round(projectile.damage * CalamityGlobalNPC.MasterModeEnemyDamageMultiplier); + break; } - else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) + } + + // Nerf several Hardmode enemy projectiles because they deal way too much damage + if (!CalamityPlayer.areThereAnyDamnBosses) + { + switch (projectile.type) { - if (MechBossProjectileIDs.Contains(projectile.type)) - { - if (CalamityUtils.AnyBossNPCS(true)) - projectile.damage = (int)(projectile.damage * 0.9); - } + case ProjectileID.JavelinHostile: + case ProjectileID.PinkLaser: + case ProjectileID.FrostBlastHostile: + case ProjectileID.GoldenShowerHostile: + case ProjectileID.RainNimbus: + case ProjectileID.FlamingArrow: + case ProjectileID.BulletDeadeye: + case ProjectileID.CannonballHostile: + case ProjectileID.UnholyTridentHostile: + case ProjectileID.FrostBeam: + case ProjectileID.CursedFlameHostile: + case ProjectileID.Stinger: + case ProjectileID.BloodNautilusTears: + case ProjectileID.RockGolemRock: + case ProjectileID.IcewaterSpit: + case ProjectileID.RocketSkeleton: + case ProjectileID.SniperBullet: + case ProjectileID.DrManFlyFlask: + projectile.damage = (int)Math.Round(projectile.damage * 0.65); + break; } } } @@ -2245,10 +3409,10 @@ namespace CalamityMod.Projectiles if (CalamityLists.dungeonProjectileBuffList.Contains(projectile.type)) { // ai[1] being set to 1 is done only by the Calamity usages of these projectiles in Skeletron and Skeletron Prime boss fights - bool isSkeletronBossProjectile = (projectile.type == ProjectileID.RocketSkeleton || projectile.type == ProjectileID.Shadowflames) && projectile.ai[1] == 1f; + bool isSkeletronBossProjectile = (projectile.type == ProjectileID.RocketSkeleton || projectile.type == ProjectileID.Shadowflames) && projectile.ai[1] > 0f; - // These projectiles will not be buffed if Golem is alive - bool isGolemBossProjectile = NPC.golemBoss > 0 && (projectile.type == ProjectileID.InfernoHostileBolt || projectile.type == ProjectileID.InfernoHostileBlast); + // These projectiles will not be buffed if Golem fires them + bool isGolemBossProjectile = (projectile.type == ProjectileID.InfernoHostileBolt || projectile.type == ProjectileID.InfernoHostileBlast) && projectile.ai[2] > 0f; if (!isSkeletronBossProjectile && !isGolemBossProjectile) projectile.damage += 30; @@ -2344,8 +3508,77 @@ namespace CalamityMod.Projectiles // Accelerate for 1.5 seconds to full velocity if (projectile.type == ProjectileID.HallowBossLastingRainbow && (CalamityWorld.revenge || BossRushEvent.BossRushActive)) { - if (projectile.timeLeft > 570) - projectile.velocity *= 1.015525f; + int spreadOutTime = 90; + if (projectile.timeLeft > EmpressLastingRainbowTotalDuration - spreadOutTime) + projectile.velocity *= ((Main.masterMode || BossRushEvent.BossRushActive) ? 1.017078f : 1.015525f); + } + + // Golf Balls go nyoom on touching Auric Ore/Repulsers + if (ProjectileID.Sets.IsAGolfBall[projectile.type]) + { + int auricOreID = TileType(); + int auricRepulserID = TileType(); + // Get a list of tiles that are colliding with the ball. + // This is just Collision.GetEntityTiles but with a larger detection square because golf balls are too small and dumb to get detected half the time apparently + List EdgeTiles = new List(); + int extraDist = 8; + int left = (int)projectile.position.X - extraDist; + int up = (int)projectile.position.Y - extraDist; + int right = (int)projectile.Right.X + extraDist; + int down = (int)projectile.Bottom.Y + extraDist; + if (left % 16 == 0) + { + left--; + } + + if (up % 16 == 0) + { + up--; + } + + if (right % 16 == 0) + { + right++; + } + + if (down % 16 == 0) + { + down++; + } + + int width = right / 16 - left / 16; + int height = down / 16 - up / 16; + left /= 16; + up /= 16; + for (int i = left; i <= left + width; i++) + { + EdgeTiles.Add(new Point(i, up)); + EdgeTiles.Add(new Point(i, up + height)); + } + + for (int j = up; j < up + height; j++) + { + EdgeTiles.Add(new Point(left, j)); + EdgeTiles.Add(new Point(left + width, j)); + } + foreach (Point touchedTile in EdgeTiles) + { + Tile tile = Framing.GetTileSafely(touchedTile); + if (!tile.HasTile || !tile.HasUnactuatedTile) + continue; + if (tile.TileType == auricOreID || tile.TileType == auricRepulserID) + { + // Force Auric Ore to animate with its crackling electricity + if (tile.TileType == auricOreID) + { + AuricOre.Animate = true; + } + + var yeetVec = Vector2.Normalize(projectile.Center - touchedTile.ToWorldCoordinates()); + projectile.velocity += yeetVec * 40f; + SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/ExoMechs/TeslaShoot1") with { Pitch = 0.4f }); + } + } } if (projectile.type == ProjectileID.OrnamentFriendly && lineColor == 1) //spawned by Festive Wings @@ -2491,7 +3724,7 @@ namespace CalamityMod.Projectiles case 1: if (!Main.rand.NextBool(3)) { - Dust venom = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, 171, 0f, 0f, 100); + Dust venom = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, DustID.Venom, 0f, 0f, 100); venom.noGravity = true; venom.fadeIn = 1.5f; venom.velocity *= 0.25f; @@ -2500,7 +3733,7 @@ namespace CalamityMod.Projectiles case 2: if (Main.rand.NextBool()) { - Dust cflame = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, 75, projectile.velocity.X * 0.2f + (projectile.direction * 3), projectile.velocity.Y * 0.2f, 100, new Color(), 2.5f); + Dust cflame = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, DustID.CursedTorch, projectile.velocity.X * 0.2f + (projectile.direction * 3), projectile.velocity.Y * 0.2f, 100, new Color(), 2.5f); cflame.noGravity = true; cflame.velocity *= 0.7f; cflame.velocity.Y -= 0.5f; @@ -2509,7 +3742,7 @@ namespace CalamityMod.Projectiles case 3: if (Main.rand.NextBool()) { - Dust fire = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, 6, projectile.velocity.X * 0.2f + (projectile.direction * 3), projectile.velocity.Y * 0.2f, 100, new Color(), 2.5f); + Dust fire = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, DustID.Torch, projectile.velocity.X * 0.2f + (projectile.direction * 3), projectile.velocity.Y * 0.2f, 100, new Color(), 2.5f); fire.noGravity = true; fire.velocity *= 0.7f; fire.velocity.Y -= 0.5f; @@ -2518,7 +3751,7 @@ namespace CalamityMod.Projectiles case 4: if (Main.rand.NextBool()) { - Dust gold = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, 57, projectile.velocity.X * 0.2f + (projectile.direction * 3), projectile.velocity.Y * 0.2f, 100, new Color(), 1.1f); + Dust gold = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, DustID.Enchanted_Gold, projectile.velocity.X * 0.2f + (projectile.direction * 3), projectile.velocity.Y * 0.2f, 100, new Color(), 1.1f); gold.noGravity = true; gold.velocity *= 0.5f; } @@ -2526,7 +3759,7 @@ namespace CalamityMod.Projectiles case 5: if (Main.rand.NextBool()) { - Dust ichor = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, 169, 0f, 0f, 100); + Dust ichor = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, DustID.IchorTorch, 0f, 0f, 100); ichor.velocity.X += projectile.direction; ichor.velocity.Y += 0.2f; ichor.noGravity = true; @@ -2535,7 +3768,7 @@ namespace CalamityMod.Projectiles case 6: if (Main.rand.NextBool()) { - Dust nanite = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, 135, 0f, 0f, 100); + Dust nanite = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, DustID.IceTorch, 0f, 0f, 100); nanite.velocity.X += projectile.direction; nanite.velocity.Y += 0.2f; nanite.noGravity = true; @@ -2544,7 +3777,7 @@ namespace CalamityMod.Projectiles case 8: if (Main.rand.NextBool(4)) { - Dust poison = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, 46, 0f, 0f, 100); + Dust poison = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, DustID.Poisoned, 0f, 0f, 100); poison.noGravity = true; poison.fadeIn = 1.5f; poison.velocity *= 0.25f; @@ -2572,12 +3805,12 @@ namespace CalamityMod.Projectiles if ((player.Calamity().flaskBrimstone || player.Calamity().flaskCrumbling || player.Calamity().flaskHoly) && !projectile.noEnchantments && !projectile.noEnchantmentVisuals) { int dustType = player.Calamity().flaskHoly ? (Main.rand.NextBool() ? 87 : (int)CalamityDusts.ProfanedFire) : player.Calamity().flaskBrimstone ? (Main.rand.NextBool() ? 114 : ModContent.DustType()) : (Main.rand.NextBool() ? 121 : DustID.Stone); - if (Main.rand.NextBool(4)) + if (Main.rand.NextBool(player.Calamity().flaskCrumbling ? 5 : 4)) { Dust dust = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, dustType, 0f, 0f, 100, default, Main.rand.NextFloat(0.6f, 0.9f)); dust.noGravity = dust.type == 121 ? false : true; - if (!player.Calamity().flaskHoly) - dust.fadeIn = 1f; + if (player.Calamity().flaskBrimstone) + dust.fadeIn = 0.8f; dust.velocity = player.Calamity().flaskHoly && Main.rand.NextBool(3) ? new Vector2(Main.rand.NextFloat(-0.9f, 0.9f), Main.rand.NextFloat(-6.6f, -9.8f)) : dust.type == 121 ? new Vector2(Main.rand.NextFloat(-0.7f, 0.7f), Main.rand.NextFloat(0.6f, 1.8f)) : -projectile.velocity * 0.2f; } } @@ -2588,7 +3821,7 @@ namespace CalamityMod.Projectiles bool lifeAndShieldCondition = player.statLife >= player.statLifeMax2 && (!modPlayer.HasAnyEnergyShield || modPlayer.TotalEnergyShielding >= modPlayer.TotalMaxShieldDurability); if (lifeAndShieldCondition && Main.rand.NextBool(5)) { - Dust dust = Dust.NewDustDirect(projectile.position + projectile.velocity, projectile.width, projectile.height, 91, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f, 0, default, 0.5f); + Dust dust = Dust.NewDustDirect(projectile.position + projectile.velocity, projectile.width, projectile.height, DustID.GemDiamond, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f, 0, default, 0.5f); dust.noGravity = true; } } @@ -2623,6 +3856,153 @@ namespace CalamityMod.Projectiles { CalamityUtils.HomeInOnNPC(projectile, !projectile.tileCollide, 300f, 12f, 20f); } + if (brimstoneBullets) + { + PointParticle spark = new PointParticle(projectile.Center + projectile.velocity * 3, projectile.velocity, false, 2, 0.9f, Color.Crimson * 0.7f); + GeneralParticleHandler.SpawnParticle(spark); + + Dust dust = Dust.NewDustPerfect(projectile.Center - projectile.velocity, Main.rand.NextBool(3) ? 90 : ModContent.DustType(), projectile.velocity * Main.rand.NextFloat(0.05f, 0.9f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.5f, 1f); + } + if (fireBullet) + { + if (projectile.timeLeft > 200) + { + float helixOffset = (float)Math.Sin(projectile.timeLeft / 25f * MathHelper.TwoPi) * 8f; + Vector2 spawnOffset = new Vector2(helixOffset, 10f).RotatedBy(projectile.rotation); + + for (int i = 0; i < 2; ++i) + { + Dust dust = Dust.NewDustPerfect(projectile.Center + spawnOffset, Main.rand.NextBool() ? 174 : 6, projectile.velocity * Main.rand.NextFloat(0.1f, 0.9f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.4f, 0.8f); + } + } + } + if (iceBullet) + { + if (projectile.timeLeft > 200) + { + float helixOffset = (float)Math.Sin(projectile.timeLeft / 25f * MathHelper.TwoPi) * -8f; + Vector2 spawnOffset = new Vector2(helixOffset, 10f).RotatedBy(projectile.rotation); + + for (int i = 0; i < 2; ++i) + { + Dust dust = Dust.NewDustPerfect(projectile.Center + spawnOffset, Main.rand.NextBool() ? 135 : 137, projectile.velocity * Main.rand.NextFloat(0.1f, 0.9f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.4f, 0.8f); + } + } + } + if (shockBullet) + { + float targetDist = Vector2.Distance(player.Center, projectile.Center); + if (projectile.timeLeft > 200 && targetDist < 1400f) + { + SparkParticle spark = new SparkParticle(projectile.Center + projectile.velocity, -projectile.velocity * 0.05f, false, 2, 1.1f, Color.Turquoise * 0.75f); + GeneralParticleHandler.SpawnParticle(spark); + if (Main.rand.NextBool(3)) + { + SparkParticle spark2 = new SparkParticle(projectile.Center + Main.rand.NextVector2Circular(6, 6), -projectile.velocity * Main.rand.NextFloat(0.05f, 0.4f), false, 20, 0.4f, Color.Turquoise * 0.75f); + GeneralParticleHandler.SpawnParticle(spark2); + } + } + } + if ((pearlBullet1 || pearlBullet2 || pearlBullet3)) + { + float targetDist = Vector2.Distance(player.Center, projectile.Center); + if (projectile.timeLeft > 200 && targetDist < 1400f) + { + Color color = pearlBullet1 ? Color.LightBlue : pearlBullet2 ? Color.LightPink : Color.Khaki; + Particle spark = new GlowSparkParticle(projectile.Center + projectile.velocity * 1.5f, -projectile.velocity * 0.05f, false, 3, 0.0093f, color, new Vector2(0.6f, 1.8f), false, false); + GeneralParticleHandler.SpawnParticle(spark); + if (Main.rand.NextBool(5)) + { + PearlParticle pearl1 = new PearlParticle(projectile.Center + Main.rand.NextVector2Circular(6, 6), -projectile.velocity * Main.rand.NextFloat(0.05f, 0.3f), false, Main.rand.Next(15, 20 + 1), Main.rand.NextFloat(0.4f, 0.55f), color, 0.9f, Main.rand.NextFloat(1, -1), true); + GeneralParticleHandler.SpawnParticle(pearl1); + } + } + } + if (lifeBullet) + { + float targetDist = Vector2.Distance(player.Center, projectile.Center); + if (projectile.timeLeft > 200 && targetDist < 1400f) + { + SparkParticle spark = new SparkParticle(projectile.Center + projectile.velocity, -projectile.velocity * 0.05f, false, 2, 0.85f, Color.White * 0.75f); + GeneralParticleHandler.SpawnParticle(spark); + + for (int i = 0; i < 2; ++i) + { + Dust dust = Dust.NewDustPerfect(projectile.Center + projectile.velocity, 261, -projectile.velocity * Main.rand.NextFloat(0.1f, 0.9f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.65f, 0.9f); + dust.alpha = 100; + } + + } + } + + #region betterLifeBullet + if (betterLifeBullet1) + { + float targetDist = Vector2.Distance(player.Center, projectile.Center); + if (projectile.timeLeft > 200 && targetDist < 1400f) + { + int randomColor = Main.rand.Next(1, 3 + 1); + Color color = randomColor == 1 ? Color.LightBlue : randomColor == 2 ? Color.LightPink : Color.Khaki; + + float helixOffset = (float)Math.Sin(projectile.timeLeft / 25f * MathHelper.TwoPi) * -8f; + Vector2 spawnOffset = new Vector2(helixOffset, 10f).RotatedBy(projectile.rotation); + + for (int i = 0; i < 3; ++i) + { + Dust dust = Dust.NewDustPerfect(projectile.Center + spawnOffset, 278, projectile.velocity * Main.rand.NextFloat(0.05f, 0.2f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.35f, 0.45f); + dust.color = color; + } + + SparkParticle spark = new SparkParticle(projectile.Center + projectile.velocity, projectile.velocity * 0.05f, false, 2, 0.85f, color); + GeneralParticleHandler.SpawnParticle(spark); + + if (Main.rand.NextBool(3)) + { + SparkParticle spark3 = new SparkParticle(projectile.Center + Main.rand.NextVector2Circular(6, 6), -projectile.velocity * Main.rand.NextFloat(0.05f, 0.3f), false, 20, 0.55f, color * 0.5f); + GeneralParticleHandler.SpawnParticle(spark3); + } + } + } + if (betterLifeBullet2) + { + float targetDist = Vector2.Distance(player.Center, projectile.Center); + if (projectile.timeLeft > 200 && targetDist < 1400f) + { + int randomColor = Main.rand.Next(1, 3 + 1); + Color color = randomColor == 1 ? Color.LightBlue : randomColor == 2 ? Color.LightPink : Color.Khaki; + + float helixOffset = (float)Math.Sin(projectile.timeLeft / 25f * MathHelper.TwoPi) * 8f; + Vector2 spawnOffset = new Vector2(helixOffset, 10f).RotatedBy(projectile.rotation); + + for (int i = 0; i < 3; ++i) + { + Dust dust = Dust.NewDustPerfect(projectile.Center + spawnOffset, 278, projectile.velocity * Main.rand.NextFloat(0.05f, 0.2f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.35f, 0.45f); + dust.color = color; + } + + SparkParticle spark = new SparkParticle(projectile.Center + projectile.velocity, projectile.velocity * 0.05f, false, 2, 0.85f, color); + GeneralParticleHandler.SpawnParticle(spark); + + if (Main.rand.NextBool(3)) + { + SparkParticle spark3 = new SparkParticle(projectile.Center + Main.rand.NextVector2Circular(6, 6), -projectile.velocity * Main.rand.NextFloat(0.05f, 0.3f), false, 20, 0.55f, color * 0.5f); + GeneralParticleHandler.SpawnParticle(spark3); + } + } + } + #endregion } } #endregion @@ -2843,7 +4223,7 @@ namespace CalamityMod.Projectiles modifiers.SourceDamage /= 1.5f; } - // create sparks on hit to hammer in the defense shredding + // Create sparks on hit to hammer in the defense shredding. if (deepcoreBullet) { if (Main.netMode != NetmodeID.Server) @@ -2860,6 +4240,20 @@ namespace CalamityMod.Projectiles } } } + + // Scuttler's Jewel projectiles can spawn either on-hit or on-kill, but only spawn once per projectile. + if (projectile.owner == Main.myPlayer && !projectile.npcProj && !projectile.trap && projectile.CountsAsClass() && modPlayer.scuttlersJewel && stealthStrike && modPlayer.scuttlerCooldown <= 0 && !JewelSpikeSpawned) + { + int damage = (int)player.GetTotalDamage().ApplyTo(16); + damage = player.ApplyArmorAccDamageBonusesTo(damage); + + int spike = Projectile.NewProjectile(projectile.GetSource_FromThis(), projectile.Center, Vector2.Zero, ProjectileType(), damage, projectile.knockBack, projectile.owner); + Main.projectile[spike].frame = 4; + if (spike.WithinBounds(Main.maxProjectiles)) + Main.projectile[spike].DamageType = DamageClass.Generic; + modPlayer.scuttlerCooldown = 30; + JewelSpikeSpawned = true; + } } #endregion @@ -2876,12 +4270,19 @@ namespace CalamityMod.Projectiles if (projectile.hostile && (projectile.damage - flatDR <= 0)) return false; + bool masterMode = Main.masterMode || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + switch (projectile.type) { // Rev+ Deerclops ice spikes can only deal damage while they're not fading out case ProjectileID.DeerclopsIceSpike: if (CalamityWorld.revenge || BossRushEvent.BossRushActive) - return projectile.ai[0] < 10f; + { + float fadeInTime = 10f; + float fadeOutGateValue = masterMode ? 80f : death ? 50f : 10f; + return (projectile.ai[0] >= fadeInTime && projectile.ai[0] < fadeOutGateValue); + } break; // Rev+ Deerclops rubble doesn't deal damage while it's not flying upwards @@ -2890,20 +4291,38 @@ namespace CalamityMod.Projectiles return projectile.ai[0] > projectile.ai[2]; break; + // Additional slams in the Master Mode shockwave have a delay before expanding and dealing damage + case ProjectileID.QueenSlimeSmash: + if (masterMode) + return projectile.ai[0] > 0f; + break; + // Storm Weaver frost waves don't deal damage unless they're at their max velocity case ProjectileID.FrostWave: if (projectile.ai[1] > 0f) return projectile.velocity.Length() >= projectile.ai[1]; break; - // Duke Fishron tornadoes don't deal damage for a bit after they spawn + // Duke Fishron tornadoes deal no damage for 1 second after spawning case ProjectileID.Sharknado: - if (projectile.timeLeft > 420) + if (projectile.timeLeft > FishronSharknadoTotalDuration - FishronTornadoTimeBeforeDealingDamage) return false; break; case ProjectileID.Cthulunado: - if (projectile.timeLeft > 720) + if (projectile.timeLeft > FishronCthulhunadoTotalDuration - FishronTornadoTimeBeforeDealingDamage) + return false; + break; + + // Empress Rainbow Streaks deal no damage if they haven't started homing + case ProjectileID.HallowBossRainbowStreak: + if (projectile.hostile) + return projectile.timeLeft <= EmpressRainbowStreakSpreadOutCutoff; + break; + + // Empress Lasting Rainbows deal no damage for 1 second after spawning + case ProjectileID.HallowBossLastingRainbow: + if (projectile.timeLeft > EmpressLastingRainbowTotalDuration - EmpressLastingRainbowTimeBeforeDealingDamage) return false; break; @@ -2928,7 +4347,7 @@ namespace CalamityMod.Projectiles public override Color? GetAlpha(Projectile projectile, Color lightColor) { if (Main.player[Main.myPlayer].Calamity().trippy) - return new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, projectile.alpha); + return new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, Main.DiscoR); if (Main.LocalPlayer.Calamity().omniscience && projectile.hostile && projectile.damage > 0 && projectile.alpha < 255) { @@ -2936,6 +4355,9 @@ namespace CalamityMod.Projectiles return Color.Coral; } + if (projectile.type == ProjectileID.BloodNautilusShot) + return new Color(200, 0, 0, projectile.alpha); + if (projectile.type == ProjectileID.Stinger) return new Color(200, 200, 0, projectile.alpha); @@ -2971,10 +4393,9 @@ namespace CalamityMod.Projectiles float startTurningBrownGateValue = 420f; float timeToReachFullBrown = 180f; float timeToReachThornExplosion = startTurningBrownGateValue + timeToReachFullBrown; - Color initialColor = Color.White; - initialColor.A = (byte)projectile.alpha; - Color finalColor = Color.RosyBrown; - finalColor.A = (byte)projectile.alpha; + Color initialColor = lightColor; + Color finalColor = new Color(125, 75, 75); + finalColor.A = (byte)(255 - projectile.alpha); if (projectile.ai[1] > startTurningBrownGateValue) { float colorTransitionRatio = (projectile.ai[1] - startTurningBrownGateValue) / timeToReachFullBrown; @@ -3013,6 +4434,26 @@ namespace CalamityMod.Projectiles #endregion + if (projectile.type == ProjectileID.DemonSickle) + { + if (Main.wofNPCIndex < 0 || !Main.npc[Main.wofNPCIndex].active || Main.npc[Main.wofNPCIndex].life <= 0 || projectile.tileCollide) + return true; + + Texture2D texture = CalamityMod.WallOfFleshDemonSickleTexture.Value; + int frameHeight = texture.Height / Main.projFrames[projectile.type]; + int frameY = frameHeight * projectile.frame; + Rectangle rectangle = new Rectangle(0, frameY, texture.Width, frameHeight); + Vector2 origin = rectangle.Size() / 2f; + + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + spriteEffects = SpriteEffects.FlipHorizontally; + + Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), rectangle, projectile.GetAlpha(lightColor), projectile.rotation, origin, projectile.scale, spriteEffects, 0f); + + return false; + } + // Chlorophyte Crystal AI rework. if (projectile.type == ProjectileID.CrystalLeaf) return ChlorophyteCrystalAI.DoChlorophyteCrystalDrawing(projectile); @@ -3025,37 +4466,123 @@ namespace CalamityMod.Projectiles if (projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally; - Vector2 vector11 = new(texture.Width / 2, texture.Height / Main.projFrames[projectile.type] / 2); - Color color9 = new(Main.DiscoR, Main.DiscoG, Main.DiscoB, projectile.alpha); - Color alpha15 = projectile.GetAlpha(color9); - - float offsetX = Main.screenPosition.X + (projectile.width / 2) - texture.Width * projectile.scale / 2f + vector11.X * projectile.scale; - float offsetY = Main.screenPosition.Y + projectile.height - texture.Height * projectile.scale / Main.projFrames[projectile.type] + 4f + vector11.Y * projectile.scale + projectile.gfxOffY; - for (int num213 = 0; num213 < 4; num213++) + Color rainbow = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, Main.DiscoR); + Color alphaColor = projectile.GetAlpha(rainbow); + float RGBMult = 0.99f; + alphaColor.R = (byte)(alphaColor.R * RGBMult); + alphaColor.G = (byte)(alphaColor.G * RGBMult); + alphaColor.B = (byte)(alphaColor.B * RGBMult); + alphaColor.A = (byte)(alphaColor.A * RGBMult); + int totalAfterimages = Main.player[Main.myPlayer].Calamity().trippyLevel == 3 ? 16 : (Main.player[Main.myPlayer].Calamity().trippyLevel == 2 ? 12 : 4); + for (int i = 0; i < totalAfterimages; i++) { - Vector2 position9 = projectile.position; - float num214 = Math.Abs(projectile.Center.X - Main.player[Main.myPlayer].Center.X); - float num215 = Math.Abs(projectile.Center.Y - Main.player[Main.myPlayer].Center.Y); + Vector2 position = projectile.position; + float distanceFromTargetX = Math.Abs(projectile.Center.X - Main.player[Main.myPlayer].Center.X); + float distanceFromTargetY = Math.Abs(projectile.Center.Y - Main.player[Main.myPlayer].Center.Y); - if (num213 == 0 || num213 == 2) - position9.X = Main.player[Main.myPlayer].Center.X + num214; - else - position9.X = Main.player[Main.myPlayer].Center.X - num214; + float smallDistanceMult = 0.48f; + float largeDistanceMult = 1.33f; + bool whatTheFuck = Main.player[Main.myPlayer].Calamity().trippyLevel == 3; - position9.X -= projectile.width / 2; + switch (i) + { + case 0: + position.X = Main.player[Main.myPlayer].Center.X - distanceFromTargetX; + position.Y = Main.player[Main.myPlayer].Center.Y - distanceFromTargetY; + break; - if (num213 == 0 || num213 == 1) - position9.Y = Main.player[Main.myPlayer].Center.Y + num215; - else - position9.Y = Main.player[Main.myPlayer].Center.Y - num215; + case 1: + position.X = Main.player[Main.myPlayer].Center.X + distanceFromTargetX; + position.Y = Main.player[Main.myPlayer].Center.Y - distanceFromTargetY; + break; - int frames = texture.Height / Main.projFrames[projectile.type]; - int y = frames * projectile.frame; - position9.Y -= projectile.height / 2; + case 2: + position.X = Main.player[Main.myPlayer].Center.X + distanceFromTargetX; + position.Y = Main.player[Main.myPlayer].Center.Y + distanceFromTargetY; + break; + + case 3: + position.X = Main.player[Main.myPlayer].Center.X - distanceFromTargetX; + position.Y = Main.player[Main.myPlayer].Center.Y + distanceFromTargetY; + break; + + case 4: // 1 o'clock position + position.X = Main.player[Main.myPlayer].Center.X + (distanceFromTargetX * (whatTheFuck ? 1f : smallDistanceMult)); + position.Y = Main.player[Main.myPlayer].Center.Y - (distanceFromTargetY * (whatTheFuck ? 0f : largeDistanceMult)); + break; + + case 5: // 4 o'clock position + position.X = Main.player[Main.myPlayer].Center.X + (distanceFromTargetX * (whatTheFuck ? 0f : largeDistanceMult)); + position.Y = Main.player[Main.myPlayer].Center.Y + (distanceFromTargetY * (whatTheFuck ? 1f : smallDistanceMult)); + break; + + case 6: // 7 o'clock position + position.X = Main.player[Main.myPlayer].Center.X - (distanceFromTargetX * (whatTheFuck ? 1f : smallDistanceMult)); + position.Y = Main.player[Main.myPlayer].Center.Y + (distanceFromTargetY * (whatTheFuck ? 0f : largeDistanceMult)); + break; + + case 7: // 10 o'clock position + position.X = Main.player[Main.myPlayer].Center.X - (distanceFromTargetX * (whatTheFuck ? 0f : largeDistanceMult)); + position.Y = Main.player[Main.myPlayer].Center.Y - (distanceFromTargetY * (whatTheFuck ? 1f : smallDistanceMult)); + break; + + case 8: // 11 o'clock position + position.X = Main.player[Main.myPlayer].Center.X - (distanceFromTargetX * (whatTheFuck ? 0f : smallDistanceMult)); + position.Y = Main.player[Main.myPlayer].Center.Y - (distanceFromTargetY * (whatTheFuck ? 0.5f : largeDistanceMult)); + break; + + case 9: // 2 o'clock position + position.X = Main.player[Main.myPlayer].Center.X + (distanceFromTargetX * (whatTheFuck ? 0.5f : largeDistanceMult)); + position.Y = Main.player[Main.myPlayer].Center.Y - (distanceFromTargetY * (whatTheFuck ? 0f : smallDistanceMult)); + break; + + case 10: // 5 o'clock position + position.X = Main.player[Main.myPlayer].Center.X + (distanceFromTargetX * (whatTheFuck ? 0f : smallDistanceMult)); + position.Y = Main.player[Main.myPlayer].Center.Y + (distanceFromTargetY * (whatTheFuck ? 0.5f : largeDistanceMult)); + break; + + case 11: // 8 o'clock position + position.X = Main.player[Main.myPlayer].Center.X - (distanceFromTargetX * (whatTheFuck ? 0.5f : largeDistanceMult)); + position.Y = Main.player[Main.myPlayer].Center.Y + (distanceFromTargetY * (whatTheFuck ? 0f : smallDistanceMult)); + break; + + case 12: + position.X = Main.player[Main.myPlayer].Center.X - distanceFromTargetX * 0.5f; + position.Y = Main.player[Main.myPlayer].Center.Y - distanceFromTargetY * 0.5f; + break; + + case 13: + position.X = Main.player[Main.myPlayer].Center.X + distanceFromTargetX * 0.5f; + position.Y = Main.player[Main.myPlayer].Center.Y - distanceFromTargetY * 0.5f; + break; + + case 14: + position.X = Main.player[Main.myPlayer].Center.X + distanceFromTargetX * 0.5f; + position.Y = Main.player[Main.myPlayer].Center.Y + distanceFromTargetY * 0.5f; + break; + + case 15: + position.X = Main.player[Main.myPlayer].Center.X - distanceFromTargetX * 0.5f; + position.Y = Main.player[Main.myPlayer].Center.Y + distanceFromTargetY * 0.5f; + break; + + default: + break; + } + + position.X -= projectile.width / 2; + position.Y -= projectile.height / 2; + + int frameHeight = texture.Height / Main.projFrames[projectile.type]; + int currentframeHeight = frameHeight * projectile.frame; + Rectangle frame = new Rectangle(0, currentframeHeight, texture.Width, frameHeight); + + Vector2 halfSize = frame.Size() / 2; Main.spriteBatch.Draw(texture, - new Vector2(position9.X - offsetX, position9.Y - offsetY), - new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y, texture.Width, frames)), alpha15, projectile.rotation, vector11, projectile.scale, spriteEffects, 0); + new Vector2(position.X - Main.screenPosition.X + (float)(projectile.width / 2) - (float)TextureAssets.Projectile[projectile.type].Width() * projectile.scale / 2f + halfSize.X * projectile.scale, + position.Y - Main.screenPosition.Y + (float)projectile.height - (float)TextureAssets.Projectile[projectile.type].Height() * projectile.scale / (float)Main.projFrames[projectile.type] + 4f + halfSize.Y * projectile.scale + projectile.gfxOffY), + frame, alphaColor, projectile.rotation, halfSize, projectile.scale, spriteEffects, 0f); } } @@ -3074,66 +4601,253 @@ namespace CalamityMod.Projectiles } #endregion + #region Pre Kill + public override bool PreKill(Projectile projectile, int timeLeft) + { + bool masterRevSkeletronPrimeBomb = projectile.type == ProjectileID.BombSkeletronPrime && projectile.ai[0] < 0f && (Main.masterMode || BossRushEvent.BossRushActive); + bool revQueenBeeBeeHive = projectile.type == ProjectileID.BeeHive && (CalamityWorld.revenge || BossRushEvent.BossRushActive) && (projectile.ai[2] == 1f || CalamityWorld.death) && projectile.wet; + bool revGolemInferno = projectile.type == ProjectileID.InfernoHostileBolt && projectile.ai[2] > 0f; + + if (revQueenBeeBeeHive) + { + SoundEngine.PlaySound(SoundID.NPCDeath1, projectile.Center); + for (int num573 = 0; num573 < 30; num573++) + { + int num574 = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.t_Honey); + if (Main.rand.NextBool()) + { + Dust dust2 = Main.dust[num574]; + dust2.scale *= 1.4f; + } + + projectile.velocity *= 1.9f; + } + } + + if (projectile.owner == Main.myPlayer) + { + if (masterRevSkeletronPrimeBomb) + { + SoundEngine.PlaySound(SoundID.Item14, projectile.Center); + projectile.position.X += projectile.width / 2; + projectile.position.Y += projectile.height / 2; + projectile.width = projectile.height = 22; + projectile.position.X -= projectile.width / 2; + projectile.position.Y -= projectile.height / 2; + + for (int num951 = 0; num951 < 20; num951++) + { + int num952 = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Smoke, 0f, 0f, 100, default(Color), 1.5f); + Dust dust2 = Main.dust[num952]; + dust2.velocity *= 1.4f; + } + + int num950 = 6; + for (int num953 = 0; num953 < 10; num953++) + { + int num954 = Dust.NewDust(projectile.position, projectile.width, projectile.height, num950, 0f, 0f, 100, default(Color), 2.5f); + Main.dust[num954].noGravity = true; + Dust dust2 = Main.dust[num954]; + dust2.velocity *= 5f; + num954 = Dust.NewDust(projectile.position, projectile.width, projectile.height, num950, 0f, 0f, 100, default(Color), 1.5f); + dust2 = Main.dust[num954]; + dust2.velocity *= 3f; + } + + int num955 = Gore.NewGore(projectile.GetSource_FromAI(), projectile.position, default(Vector2), Main.rand.Next(61, 64)); + Gore gore2 = Main.gore[num955]; + gore2.velocity *= 0.4f; + Main.gore[num955].velocity.X += 1f; + Main.gore[num955].velocity.Y += 1f; + num955 = Gore.NewGore(projectile.GetSource_FromAI(), projectile.position, default(Vector2), Main.rand.Next(61, 64)); + gore2 = Main.gore[num955]; + gore2.velocity *= 0.4f; + Main.gore[num955].velocity.X -= 1f; + Main.gore[num955].velocity.Y += 1f; + num955 = Gore.NewGore(projectile.GetSource_FromAI(), projectile.position, default(Vector2), Main.rand.Next(61, 64)); + gore2 = Main.gore[num955]; + gore2.velocity *= 0.4f; + Main.gore[num955].velocity.X += 1f; + Main.gore[num955].velocity.Y -= 1f; + num955 = Gore.NewGore(projectile.GetSource_FromAI(), projectile.position, default(Vector2), Main.rand.Next(61, 64)); + gore2 = Main.gore[num955]; + gore2.velocity *= 0.4f; + Main.gore[num955].velocity.X -= 1f; + Main.gore[num955].velocity.Y -= 1f; + + Vector2 vector76 = projectile.position; + projectile.position.X += projectile.width / 2; + projectile.position.Y += projectile.height / 2; + projectile.width = projectile.height = 128; + projectile.position.X -= projectile.width / 2; + projectile.position.Y -= projectile.height / 2; + projectile.Damage(); + projectile.position = vector76; + projectile.width = projectile.height = 22; + + if (Main.getGoodWorld && !Main.remixWorld) + { + int num1011 = 4; + Vector2 center3 = projectile.position; + int num1012 = num1011; + int num1013 = num1011; + int num1014 = (int)(center3.X / 16f - (float)num1012); + int num1015 = (int)(center3.X / 16f + (float)num1012); + int num1016 = (int)(center3.Y / 16f - (float)num1013); + int num1017 = (int)(center3.Y / 16f + (float)num1013); + if (num1014 < 0) + num1014 = 0; + + if (num1015 > Main.maxTilesX) + num1015 = Main.maxTilesX; + + if (num1016 < 0) + num1016 = 0; + + if (num1017 > Main.maxTilesY) + num1017 = Main.maxTilesY; + + bool wallSplode2 = projectile.ShouldWallExplode(center3, num1011, num1014, num1015, num1016, num1017); + projectile.ExplodeTiles(center3, num1011, num1014, num1015, num1016, num1017, wallSplode2); + } + + if (Main.netMode != NetmodeID.SinglePlayer) + NetMessage.SendData(MessageID.KillProjectile, -1, -1, null, projectile.identity, projectile.owner); + } + + else if (revQueenBeeBeeHive) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int beeAmt = Main.rand.Next(2, 6); + int availableAmountOfNPCsToSpawnUpToSlot = NPC.GetAvailableAmountOfNPCsToSpawnUpToSlot(beeAmt); + for (int i = 0; i < availableAmountOfNPCsToSpawnUpToSlot; i++) + { + int beeType = Main.rand.Next(NPCID.Bee, NPCID.BeeSmall + 1); + if (Main.zenithWorld) + { + beeType = Main.rand.NextBool(3) ? ModContent.NPCType() : ModContent.NPCType(); + } + else if (Main.masterMode || BossRushEvent.BossRushActive) + { + switch (Main.rand.Next(12)) + { + default: + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + + case 6: + case 7: + case 8: + beeType = NPCID.LittleHornetHoney; + break; + + case 9: + case 10: + beeType = NPCID.HornetHoney; + break; + + case 11: + beeType = NPCID.BigHornetHoney; + break; + } + } + + int beeSpawn = NPC.NewNPC(projectile.GetSource_FromThis(), (int)projectile.Center.X, (int)projectile.Center.Y, beeType, 1); + Main.npc[beeSpawn].velocity.X = (float)Main.rand.Next(-200, 201) * 0.002f; + Main.npc[beeSpawn].velocity.Y = (float)Main.rand.Next(-200, 201) * 0.002f; + Main.npc[beeSpawn].ai[3] = 1f; + Main.npc[beeSpawn].timeLeft = 600; + Main.npc[beeSpawn].netUpdate = true; + } + } + + if (Main.netMode != NetmodeID.SinglePlayer) + NetMessage.SendData(MessageID.KillProjectile, -1, -1, null, projectile.identity, projectile.owner); + } + + else if (revGolemInferno) + { + Projectile.NewProjectile(projectile.GetSource_FromThis(), projectile.Center, Vector2.Zero, ProjectileID.InfernoHostileBlast, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f, projectile.ai[2]); + + if (Main.netMode != NetmodeID.SinglePlayer) + NetMessage.SendData(MessageID.KillProjectile, -1, -1, null, projectile.identity, projectile.owner); + } + } + + if (masterRevSkeletronPrimeBomb || revQueenBeeBeeHive || revGolemInferno) + { + projectile.active = false; + return false; + } + + return true; + } + #endregion + #region Kill public override void OnKill(Projectile projectile, int timeLeft) { Player player = Main.player[projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - if (projectile.owner == Main.myPlayer && !projectile.npcProj && !projectile.trap) + if (projectile.owner == Main.myPlayer) { - if (projectile.CountsAsClass()) + if (!projectile.npcProj && !projectile.trap) { - if (modPlayer.etherealExtorter && extorterBoost && Main.player[projectile.owner].ownedProjectileCounts[ProjectileType()] < 5) + if (projectile.CountsAsClass()) { - for (int i = 0; i < 2; i++) + if (modPlayer.etherealExtorter && extorterBoost && Main.player[projectile.owner].ownedProjectileCounts[ProjectileType()] < 5) { - Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); + for (int i = 0; i < 2; i++) + { + Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); - int damage = (int)player.GetTotalDamage().ApplyTo(20); + int damage = (int)player.GetTotalDamage().ApplyTo(20); + damage = player.ApplyArmorAccDamageBonusesTo(damage); + + int soul = Projectile.NewProjectile(projectile.GetSource_FromThis(), projectile.Center, velocity, ProjectileType(), damage, 0f, projectile.owner); + Main.projectile[soul].tileCollide = false; + if (soul.WithinBounds(Main.maxProjectiles)) + Main.projectile[soul].DamageType = DamageClass.Generic; + } + } + + // Make sure the spike doesn't spawn again if it's already been spawned by on-hit. + if (modPlayer.scuttlersJewel && stealthStrike && modPlayer.scuttlerCooldown <= 0 && !JewelSpikeSpawned) + { + int damage = (int)player.GetTotalDamage().ApplyTo(16); damage = player.ApplyArmorAccDamageBonusesTo(damage); - int soul = Projectile.NewProjectile(projectile.GetSource_FromThis(), projectile.Center, velocity, ProjectileType(), damage, 0f, projectile.owner); - Main.projectile[soul].tileCollide = false; - if (soul.WithinBounds(Main.maxProjectiles)) - Main.projectile[soul].DamageType = DamageClass.Generic; + int spike = Projectile.NewProjectile(projectile.GetSource_FromThis(), projectile.Center, Vector2.Zero, ProjectileType(), damage, projectile.knockBack, projectile.owner); + Main.projectile[spike].frame = 4; + if (spike.WithinBounds(Main.maxProjectiles)) + Main.projectile[spike].DamageType = DamageClass.Generic; + modPlayer.scuttlerCooldown = 30; } } - if (modPlayer.scuttlersJewel && stealthStrike && modPlayer.scuttlerCooldown <= 0) - { - int damage = (int)player.GetTotalDamage().ApplyTo(18); - damage = player.ApplyArmorAccDamageBonusesTo(damage); + if (projectile.type == ProjectileID.UnholyWater) + Projectile.NewProjectile(projectile.GetSource_FromThis(), projectile.Center, Vector2.Zero, ProjectileType(), 0, 0f, projectile.owner, 1f); - int spike = Projectile.NewProjectile(projectile.GetSource_FromThis(), projectile.Center, Vector2.Zero, ProjectileType(), damage, projectile.knockBack, projectile.owner); - Main.projectile[spike].frame = 4; - if (spike.WithinBounds(Main.maxProjectiles)) - Main.projectile[spike].DamageType = DamageClass.Generic; - modPlayer.scuttlerCooldown = 30; - } + if (projectile.type == ProjectileID.BloodWater) + Projectile.NewProjectile(projectile.GetSource_FromThis(), projectile.Center, Vector2.Zero, ProjectileType(), 0, 0f, projectile.owner, 2f); + + if (projectile.type == ProjectileID.HolyWater) + Projectile.NewProjectile(projectile.GetSource_FromThis(), projectile.Center, Vector2.Zero, ProjectileType(), 0, 0f, projectile.owner, 3f); } - - if (projectile.type == ProjectileID.UnholyWater) - Projectile.NewProjectile(projectile.GetSource_FromThis(), projectile.Center, Vector2.Zero, ProjectileType(), 0, 0f, projectile.owner, 1f); - - if (projectile.type == ProjectileID.BloodWater) - Projectile.NewProjectile(projectile.GetSource_FromThis(), projectile.Center, Vector2.Zero, ProjectileType(), 0, 0f, projectile.owner, 2f); - - if (projectile.type == ProjectileID.HolyWater) - Projectile.NewProjectile(projectile.GetSource_FromThis(), projectile.Center, Vector2.Zero, ProjectileType(), 0, 0f, projectile.owner, 3f); } } #endregion #region Life Steal - public static bool CanSpawnLifeStealProjectile(float healMultiplier, float healAmount) - { - if (healMultiplier <= 0f || (int)healAmount <= 0) - return false; + public static bool CanSpawnLifeStealProjectile(double healMultiplier, float healAmount) => healMultiplier > 0D && (int)healAmount > 0; - return true; - } - - public static void SpawnLifeStealProjectile(Projectile projectile, Player player, float healAmount, int healProjectileType, float distanceRequired, float cooldownMultiplier) + public static void SpawnLifeStealProjectile(Projectile projectile, Player player, float healAmount, int healProjectileType, float distanceRequired, float cooldownMultiplier = 1f) { if (Main.player[Main.myPlayer].moonLeech) return; diff --git a/Projectiles/CalamityGlobalProjectileTweaks.cs b/Projectiles/CalamityGlobalProjectileTweaks.cs index 6273a0bc92..916a1412a8 100644 --- a/Projectiles/CalamityGlobalProjectileTweaks.cs +++ b/Projectiles/CalamityGlobalProjectileTweaks.cs @@ -125,12 +125,19 @@ namespace CalamityMod.Projectiles { ProjectileID.ButchersChainsaw, Do(TrueMeleeNoSpeed, ArmorPenetrationDelta(+15), LocalIFrames(5), ScaleExact(1.5f)) }, { ProjectileID.ChlorophyteChainsaw, standardChainsawTweaks }, { ProjectileID.ChlorophyteDrill, standardDrillTweaks }, + { ProjectileID.ChlorophyteOrb, Do(NoPiercing) }, { ProjectileID.CobaltChainsaw, standardChainsawTweaks }, { ProjectileID.CobaltDrill, standardDrillTweaks }, { ProjectileID.CrystalBullet, standardBulletTweaks }, { ProjectileID.CrystalVileShardHead, Do(LocalIFrames(23)) }, { ProjectileID.CrystalVileShardShaft, Do(LocalIFrames(23)) }, { ProjectileID.CursedBullet, standardBulletTweaks }, + { ProjectileID.ClusterRocketI, Do(LocalIFrames(15)) }, + { ProjectileID.ClusterFragmentsI, Do(IDStaticIFrames(15)) }, + { ProjectileID.ClusterRocketII, Do(LocalIFrames(15)) }, + { ProjectileID.ClusterFragmentsII, Do(IDStaticIFrames(15)) }, + { ProjectileID.ClusterSnowmanRocketI, Do(LocalIFrames(15)) }, + { ProjectileID.ClusterSnowmanRocketII, Do(LocalIFrames(15)) }, { ProjectileID.DD2SquireSonicBoom, Do(PiercingExact(3)) }, // Flying Dragon { ProjectileID.EmeraldBolt, Do(NoPiercing) }, { ProjectileID.EmpressBlade, Do(LocalIFrames(30)) }, // Terraprisma @@ -139,21 +146,24 @@ namespace CalamityMod.Projectiles { ProjectileID.FairyQueenRangedItemShot, Do(PiercingExact(7), ExtraUpdatesExact(1)) }, // Eventide Convert { ProjectileID.FlaironBubble, Do(ExtraUpdatesExact(1), TimeLeftExact(400)) }, { ProjectileID.Flamarang, Do(ExtraUpdatesExact(2)) }, - { ProjectileID.Flames, Do(IDStaticIFrames(5)) }, // Flamethrower AND Elf Melter flames + { ProjectileID.Flames, Do(IDStaticIFrames(5)) }, // Flamethrower AND Elf Melter flames { ProjectileID.FlamingJack, Do(ExtraUpdatesExact(1)) }, { ProjectileID.FlowerPetal, Do(MaxUpdatesExact(4), LocalIFrames(10)) }, // Orichalcum armor { ProjectileID.FlowerPow, Do(ExtraUpdatesExact(1)) }, - { ProjectileID.FlyingKnife, Do(ExtraUpdatesExact(1)) }, + { ProjectileID.FlyingKnife, Do(ExtraUpdatesExact(1)) }, { ProjectileID.FrostBoltStaff, Do(ExtraUpdatesExact(1)) }, { ProjectileID.FruitcakeChakram, Do(ExtraUpdatesExact(1)) }, { ProjectileID.GiantBee, Do(PiercingExact(2)) }, { ProjectileID.GoldenBullet, standardBulletTweaks }, + { ProjectileID.GoldenShowerFriendly, Do(PiercingExact(2)) }, { ProjectileID.GreenCounterweight, counterweightTweaks }, { ProjectileID.Hamdrax, standardDrillTweaks }, // Drax (never internally renamed since 1.1) { ProjectileID.IceBoomerang, Do(ExtraUpdatesExact(1)) }, { ProjectileID.IceSickle, Do(ExtraUpdatesExact(1)) }, { ProjectileID.IchorBullet, standardBulletTweaks }, { ProjectileID.InfluxWaver, Do(ExtraUpdatesExact(1)) }, + { ProjectileID.InfernoFriendlyBolt, Do(ExtraUpdatesExact(1)) }, + { ProjectileID.InfernoFriendlyBlast, Do(ExtraUpdatesExact(2)) }, { ProjectileID.LaserDrill, Do(ArmorPenetrationDelta(+25), LocalIFrames(5)) }, { ProjectileID.LightDisc, Do(MaxUpdatesExact(3)) }, { ProjectileID.LostSoulHostile, Do(TileCollide) }, // Ragged Caster @@ -178,6 +188,10 @@ namespace CalamityMod.Projectiles { ProjectileID.QueenSlimeGelAttack, Do(NoPiercing) }, { ProjectileID.QueenSlimeMinionPinkBall, Do(NoPiercing) }, { ProjectileID.RedCounterweight, counterweightTweaks }, + { ProjectileID.RocketFireworkBlue, Do(TimeLeftDelta(+45)) }, + { ProjectileID.RocketFireworkGreen, Do(TimeLeftDelta(+45)) }, + { ProjectileID.RocketFireworkRed, Do(TimeLeftDelta(+45)) }, + { ProjectileID.RocketFireworkYellow, Do(TimeLeftDelta(+45)) }, { ProjectileID.SawtoothShark, Do(TrueMeleeNoSpeed, ArmorPenetrationDelta(+15), LocalIFrames(6)) }, { ProjectileID.ShadowBeamHostile, Do(TimeLeftExact(60)) }, { ProjectileID.Shroomerang, Do(ExtraUpdatesExact(1)) }, @@ -186,6 +200,7 @@ namespace CalamityMod.Projectiles { ProjectileID.StarWrath, Do(NoPiercing) }, { ProjectileID.Sunfury, Do(ExtraUpdatesExact(1)) }, { ProjectileID.SwordBeam, Do(ExtraUpdatesExact(1)) }, // Beam Sword projectile + { ProjectileID.ThunderStaffShot, Do(PiercingExact(3)) }, //Thunder Zapper projectile { ProjectileID.TitaniumChainsaw, standardChainsawTweaks }, { ProjectileID.TitaniumDrill, standardDrillTweaks }, { ProjectileID.Trimarang, Do(ExtraUpdatesExact(1)) }, @@ -193,6 +208,7 @@ namespace CalamityMod.Projectiles { ProjectileID.VenomBullet, standardBulletTweaks }, { ProjectileID.VenomFang, Do(LocalIFrames(10)) }, { ProjectileID.VortexDrill, standardDrillTweaks }, + { ProjectileID.Wasp, Do(PiercingExact(2)) }, { ProjectileID.YellowCounterweight, counterweightTweaks }, #endregion diff --git a/Projectiles/Damageable/DamageableProjectile.cs b/Projectiles/Damageable/DamageableProjectile.cs index 8e53c481f7..74b0bfe440 100644 --- a/Projectiles/Damageable/DamageableProjectile.cs +++ b/Projectiles/Damageable/DamageableProjectile.cs @@ -1,8 +1,8 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; +using System; using System.Collections.Generic; using System.IO; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; using Terraria.ID; diff --git a/Projectiles/DraedonsArsenal/AnomalysNanogunHoldout.cs b/Projectiles/DraedonsArsenal/AnomalysNanogunHoldout.cs index 58828e6e53..25ce8ce434 100644 --- a/Projectiles/DraedonsArsenal/AnomalysNanogunHoldout.cs +++ b/Projectiles/DraedonsArsenal/AnomalysNanogunHoldout.cs @@ -1,14 +1,14 @@ using System; +using CalamityMod.Items.Weapons.DraedonsArsenal; +using CalamityMod.Particles; using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Items.Weapons.DraedonsArsenal; -using Microsoft.Xna.Framework.Graphics; -using CalamityMod.Particles; namespace CalamityMod.Projectiles.DraedonsArsenal { @@ -39,7 +39,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public const int PlasmaChargeupTimer = 40; public const int PlasmaCooldownTimer = 24; - public const int PlasmaShotCooldown = 20; + public const int PlasmaShotCooldown = 15; public const int PlasmaShotCount = 5; public static int PlasmaFireTimer { @@ -90,7 +90,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { int proj = Projectile.NewProjectile(new EntitySource_ItemUse_WithAmmo(Owner, Owner.HeldItem, -1), Projectile.Center + Projectile.rotation.ToRotationVector2() * GunLength, - Projectile.velocity * (1f - i * 0.18f), + Projectile.velocity * (1.5f - i * 0.24f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, diff --git a/Projectiles/DraedonsArsenal/AnomalysNanogunMPFBBoom.cs b/Projectiles/DraedonsArsenal/AnomalysNanogunMPFBBoom.cs index d78c66a19f..18fdff754d 100644 --- a/Projectiles/DraedonsArsenal/AnomalysNanogunMPFBBoom.cs +++ b/Projectiles/DraedonsArsenal/AnomalysNanogunMPFBBoom.cs @@ -27,6 +27,16 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Projectile.DamageType = DamageClass.Ranged; } - public override void PostAI() => Lighting.AddLight(Projectile.Center, 0, Projectile.Opacity * 0.7f / 255f, Projectile.Opacity); + public override void PostAI() + { + Lighting.AddLight(Projectile.Center, 0, Projectile.Opacity * 0.7f / 255f, Projectile.Opacity); + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + if (Projectile.numHits > 0) + Projectile.damage = (int)(Projectile.damage * 0.6f); + if (Projectile.damage < 1) + Projectile.damage = 1; + } } } diff --git a/Projectiles/DraedonsArsenal/AnomalysNanogunMPFBDevastator.cs b/Projectiles/DraedonsArsenal/AnomalysNanogunMPFBDevastator.cs index 9e6eec466b..7a763570fa 100644 --- a/Projectiles/DraedonsArsenal/AnomalysNanogunMPFBDevastator.cs +++ b/Projectiles/DraedonsArsenal/AnomalysNanogunMPFBDevastator.cs @@ -1,11 +1,11 @@ using System; +using CalamityMod.Items.Weapons.DraedonsArsenal; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Items.Weapons.DraedonsArsenal; namespace CalamityMod.Projectiles.DraedonsArsenal { @@ -57,16 +57,16 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; int yPos = texture.Height / Main.projFrames[Type] * Projectile.frame; - Main.EntitySpriteDraw(texture, - Projectile.position - Main.screenPosition, - new Rectangle(0, yPos, texture.Width, texture.Height / Main.projFrames[Type]), - lightColor, - 0f, - Vector2.Zero, - 1f, - SpriteEffects.None, + Main.EntitySpriteDraw(texture, + Projectile.position - Main.screenPosition, + new Rectangle(0, yPos, texture.Width, texture.Height / Main.projFrames[Type]), + lightColor, + 0f, + Vector2.Zero, + 1f, + SpriteEffects.None, 0); return false; @@ -74,12 +74,19 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override void OnKill(int timeLeft) { + for (int i = 0; i < 18; i++) + { + Vector2 vel = new Vector2(10, 10).RotatedByRandom(100) * Main.rand.NextFloat(0.8f, 1.2f); + Dust dust = Dust.NewDustPerfect(Projectile.Center + vel * 1.5f, 226, vel * Main.rand.NextFloat(0.1f, 1.2f) + new Vector2(0, -2)); + dust.noGravity = false; + dust.scale = Main.rand.NextFloat(0.65f, 1.2f); + } SoundEngine.PlaySound(AnomalysNanogunMPFBBoom.MPFBExplosion, Projectile.Center); if (Main.myPlayer == Projectile.owner) { for (int i = 0; i < 4; i++) { - Projectile explosion = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.2f), Projectile.knockBack, Projectile.owner); + Projectile explosion = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.075f), Projectile.knockBack, Projectile.owner); explosion.ai[1] = Main.rand.NextFloat(110f, 200f) + i * 20f; // Randomize the maximum radius. explosion.localAI[1] = Main.rand.NextFloat(0.18f, 0.3f); // And the interpolation step. explosion.netUpdate = true; diff --git a/Projectiles/DraedonsArsenal/AnomalysNanogunPlasmaBeam.cs b/Projectiles/DraedonsArsenal/AnomalysNanogunPlasmaBeam.cs index d2e942b6a8..f910d2c453 100644 --- a/Projectiles/DraedonsArsenal/AnomalysNanogunPlasmaBeam.cs +++ b/Projectiles/DraedonsArsenal/AnomalysNanogunPlasmaBeam.cs @@ -1,12 +1,12 @@ -using CalamityMod.Projectiles.BaseProjectiles; +using System; +using CalamityMod.Particles; +using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; using Terraria; using Terraria.Enums; using Terraria.ModLoader; -using CalamityMod.Particles; -using System; namespace CalamityMod.Projectiles.DraedonsArsenal { @@ -69,8 +69,15 @@ namespace CalamityMod.Projectiles.DraedonsArsenal int step = 10; while (step < LaserLength) { - Particle pulse = new DirectionalPulseRing(Projectile.Center + MathHelper.WrapAngle(Projectile.rotation + MathHelper.PiOver2).ToRotationVector2() * step, Vector2.Zero, Color.Red, new Vector2(0.5f, 1f), MathHelper.WrapAngle(Projectile.rotation + MathHelper.PiOver2), 0.1f, 1f, 12); - GeneralParticleHandler.SpawnParticle(pulse); + //Particle pulse = new DirectionalPulseRing(Projectile.Center + MathHelper.WrapAngle(Projectile.rotation + MathHelper.PiOver2).ToRotationVector2() * step, Vector2.Zero, Color.Red, new Vector2(0.5f, 1f), MathHelper.WrapAngle(Projectile.rotation + MathHelper.PiOver2), 0.1f, 1f, 12); + //GeneralParticleHandler.SpawnParticle(pulse); + for (int i = 0; i < 2; i++) + { + Particle pulse2 = new CustomPulse(Projectile.Center + MathHelper.WrapAngle(Projectile.rotation + MathHelper.PiOver2).ToRotationVector2() * step, Vector2.Zero, Color.Red, "CalamityMod/Particles/SmallBloomRing", new Vector2(0.4f, 1.1f), MathHelper.WrapAngle(Projectile.rotation + MathHelper.PiOver2), 0.1f, 1f, 12); + GeneralParticleHandler.SpawnParticle(pulse2); + Particle pulse3 = new CustomPulse(Projectile.Center + MathHelper.WrapAngle(Projectile.rotation + MathHelper.PiOver2).ToRotationVector2() * step, Vector2.Zero, Color.White, "CalamityMod/Particles/SmallBloomRing", new Vector2(0.4f, 1.1f), MathHelper.WrapAngle(Projectile.rotation + MathHelper.PiOver2), 0.1f, 0.9f, 12); + GeneralParticleHandler.SpawnParticle(pulse3); + } step += 100; } } @@ -78,6 +85,19 @@ namespace CalamityMod.Projectiles.DraedonsArsenal else Projectile.frameCounter++; } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + for (int i = 0; i <= 8; i++) + { + Dust dust = Dust.NewDustPerfect(target.Center, 218, (Projectile.velocity * 30).RotatedByRandom(MathHelper.ToRadians(25f)) * Main.rand.NextFloat(0.1f, 0.8f), 0, default, Main.rand.NextFloat(1.2f, 1.6f)); + dust.noGravity = true; + } + + if (Projectile.numHits > 0) + Projectile.damage = (int)(Projectile.damage * 0.5f); + if (Projectile.damage < 1) + Projectile.damage = 1; + } public override void DetermineScale() => Projectile.scale = 1f; diff --git a/Projectiles/DraedonsArsenal/FrequencyManipulatorProjectile.cs b/Projectiles/DraedonsArsenal/FrequencyManipulatorProjectile.cs index 69527765f3..fae768a21d 100644 --- a/Projectiles/DraedonsArsenal/FrequencyManipulatorProjectile.cs +++ b/Projectiles/DraedonsArsenal/FrequencyManipulatorProjectile.cs @@ -1,8 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.DraedonsArsenal { diff --git a/Projectiles/DraedonsArsenal/GalvanizingGlaiveProjectile.cs b/Projectiles/DraedonsArsenal/GalvanizingGlaiveProjectile.cs index eb98f994f7..e51c3a9d58 100644 --- a/Projectiles/DraedonsArsenal/GalvanizingGlaiveProjectile.cs +++ b/Projectiles/DraedonsArsenal/GalvanizingGlaiveProjectile.cs @@ -1,9 +1,9 @@ -using CalamityMod.Projectiles.BaseProjectiles; +using System; +using System.Collections.Generic; using CalamityMod.Items.Weapons.DraedonsArsenal; +using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.Localization; @@ -47,7 +47,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override bool PreDraw(ref Color lightColor) { Vector2 drawPosition = Projectile.position + new Vector2(Projectile.width, Projectile.height) / 2f + Vector2.UnitY * Projectile.gfxOffY - Main.screenPosition; - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Vector2 origin = texture.Size() * 0.5f; Main.EntitySpriteDraw(texture, drawPosition, null, lightColor, Projectile.rotation, origin, Projectile.scale, Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); return false; diff --git a/Projectiles/DraedonsArsenal/GatlingLaserProj.cs b/Projectiles/DraedonsArsenal/GatlingLaserProj.cs index f6b0fe0b94..1b90b5bb90 100644 --- a/Projectiles/DraedonsArsenal/GatlingLaserProj.cs +++ b/Projectiles/DraedonsArsenal/GatlingLaserProj.cs @@ -1,8 +1,8 @@ -using CalamityMod.Items; +using System; +using CalamityMod.Items; using CalamityMod.Items.Weapons.DraedonsArsenal; using Microsoft.Xna.Framework; using ReLogic.Utilities; -using System; using Terraria; using Terraria.Audio; using Terraria.Localization; @@ -16,6 +16,11 @@ namespace CalamityMod.Projectiles.DraedonsArsenal private SlotId gatlingLaserLoopID; private bool fireLasers = false; + public override void SetStaticDefaults() + { + Main.projFrames[Projectile.type] = 4; + } + public override void SetDefaults() { Projectile.width = 24; @@ -29,6 +34,15 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override void AI() { + Projectile.frameCounter++; + if (Projectile.frameCounter >= 13) + { + Projectile.frameCounter = 10; + Projectile.frame++; + if (Projectile.frame >= Main.projFrames[Projectile.type]) + Projectile.frame = 0; + } + if (SoundEngine.TryGetActiveSound(gatlingLaserLoopID, out var ShootingSound) && ShootingSound.IsPlaying) ShootingSound.Position = Projectile.Center; Player player = Main.player[Projectile.owner]; @@ -58,7 +72,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { fireLasers = true; Projectile.soundDelay *= 6; - gatlingLaserLoopID = SoundEngine.PlaySound(GatlingLaser.FireLoopSound, Projectile.position); + gatlingLaserLoopID = SoundEngine.PlaySound(GatlingLaser.FireLoopSound, Projectile.Center); } } if (shootThisFrame && Main.myPlayer == Projectile.owner && fireLasers) @@ -68,7 +82,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal // This grabs the weapon's current damage, taking current charge level into account. int currentDamage = player.GetWeaponDamage(gatling); - bool stillInUse = player.channel && !player.noItems && !player.CCed; + bool stillInUse = !player.CantUseHoldout(); // This both checks if the player has sufficient mana and consumes it if they do. // If this is false, the Gatling Laser stops functioning. @@ -130,7 +144,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal if (SoundEngine.TryGetActiveSound(gatlingLaserLoopID, out result)) result.Stop(); - SoundEngine.PlaySound(GatlingLaser.FireEndSound, Projectile.position); + SoundEngine.PlaySound(GatlingLaser.FireEndSound, Projectile.Center); Projectile.Kill(); } } diff --git a/Projectiles/DraedonsArsenal/GatlingLaserProj.png b/Projectiles/DraedonsArsenal/GatlingLaserProj.png index f5138b81bf..c4b477bdc8 100644 Binary files a/Projectiles/DraedonsArsenal/GatlingLaserProj.png and b/Projectiles/DraedonsArsenal/GatlingLaserProj.png differ diff --git a/Projectiles/DraedonsArsenal/GatlingLaserShot.cs b/Projectiles/DraedonsArsenal/GatlingLaserShot.cs index aae0a0d746..f1292b9b35 100644 --- a/Projectiles/DraedonsArsenal/GatlingLaserShot.cs +++ b/Projectiles/DraedonsArsenal/GatlingLaserShot.cs @@ -33,12 +33,12 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { Time++; Lighting.AddLight(Projectile.Center, 0.2f, 0f, 0f); - if (Projectile.timeLeft % 11 == 0 && Time > 12 && Time < 460) + if (Projectile.timeLeft % 11 == 0 && Time > 15 && Time < 460) { SparkParticle spark = new SparkParticle(Projectile.Center, Projectile.velocity * 0.01f, false, 6, 1.7f, Color.Red); GeneralParticleHandler.SpawnParticle(spark); } - if (Projectile.timeLeft % 4 == 0 && Time > 12 && Time < 460) + if (Projectile.timeLeft % 4 == 0 && Time > 15 && Time < 460) { SparkParticle spark2 = new SparkParticle(Projectile.Center, Projectile.velocity * 0.01f, false, 6, 0.4f, Color.White); GeneralParticleHandler.SpawnParticle(spark2); @@ -93,7 +93,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal dustVel = dustVel.RotatedBy(-angleRandom); dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); - int burstDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dust, dustVel.X, dustVel.Y, 200, default, 0.9f); + int burstDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dust, dustVel.X, dustVel.Y, 200, default, 0.9f); Main.dust[burstDust].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; Main.dust[burstDust].noGravity = true; @@ -101,7 +101,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal dust2.velocity *= 3f; dust2 = Main.dust[burstDust]; - burstDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dust, dustVel.X, dustVel.Y, 100, default, 0.66f); + burstDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dust, dustVel.X, dustVel.Y, 100, default, 0.66f); Main.dust[burstDust].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; dust2 = Main.dust[burstDust]; @@ -122,7 +122,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal dustVel = dustVel.RotatedBy(-angleRandom); dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); - int moreBurstDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dust, dustVel.X, dustVel.Y, 0, default, 1.2f); + int moreBurstDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dust, dustVel.X, dustVel.Y, 0, default, 1.2f); Main.dust[moreBurstDust].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(MathHelper.Pi).RotatedBy(Projectile.velocity.ToRotation()) * Projectile.width / 3f; Main.dust[moreBurstDust].noGravity = true; diff --git a/Projectiles/DraedonsArsenal/GaussFlux.cs b/Projectiles/DraedonsArsenal/GaussFlux.cs index 85077abc31..62f23c5416 100644 --- a/Projectiles/DraedonsArsenal/GaussFlux.cs +++ b/Projectiles/DraedonsArsenal/GaussFlux.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Projectile.penetrate = -1; Projectile.timeLeft = 180; Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 10; + Projectile.idStaticNPCHitCooldown = 15; } public override void AI() diff --git a/Projectiles/DraedonsArsenal/GaussPistolShot.cs b/Projectiles/DraedonsArsenal/GaussPistolShot.cs index d1e07c30f8..552d68adc5 100644 --- a/Projectiles/DraedonsArsenal/GaussPistolShot.cs +++ b/Projectiles/DraedonsArsenal/GaussPistolShot.cs @@ -1,6 +1,6 @@ -using Microsoft.Xna.Framework; -using System; +using System; using System.IO; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Projectiles/DraedonsArsenal/GaussRifleBlast.cs b/Projectiles/DraedonsArsenal/GaussRifleBlast.cs index 3b376c9244..ca19c0f2e9 100644 --- a/Projectiles/DraedonsArsenal/GaussRifleBlast.cs +++ b/Projectiles/DraedonsArsenal/GaussRifleBlast.cs @@ -1,9 +1,9 @@ -using Microsoft.Xna.Framework; -using System; -using Terraria; -using Terraria.ModLoader; -using Terraria.Audio; +using System; using CalamityMod.Items.Weapons.DraedonsArsenal; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.DraedonsArsenal { diff --git a/Projectiles/DraedonsArsenal/HydraulicVoltCrasherProjectile.cs b/Projectiles/DraedonsArsenal/HydraulicVoltCrasherProjectile.cs index f750ec6e0d..5c1b0f93f2 100644 --- a/Projectiles/DraedonsArsenal/HydraulicVoltCrasherProjectile.cs +++ b/Projectiles/DraedonsArsenal/HydraulicVoltCrasherProjectile.cs @@ -4,8 +4,8 @@ using CalamityMod.Sounds; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; -using Terraria.ID; using Terraria.Audio; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -54,7 +54,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal // Play idle sounds every so often. if (Projectile.soundDelay <= 0) { - SoundEngine.PlaySound(SoundID.Item22, Projectile.position); + SoundEngine.PlaySound(SoundID.Item22, Projectile.Center); Projectile.soundDelay = 30; } Vector2 center = Owner.RotatedRelativePoint(Owner.MountedCenter); @@ -74,7 +74,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal // Check if the player's held item still has sufficient charge. If so, and they're still using it, take a tiny bit of charge from it. CalamityGlobalItem modItem = heldItem.Calamity(); - if (Owner.channel && modItem.Charge >= HydraulicVoltCrasher.HoldoutChargeUse) + if ((Owner.channel || Owner.Calamity().mouseRight) && modItem.Charge >= HydraulicVoltCrasher.HoldoutChargeUse) { modItem.Charge -= HydraulicVoltCrasher.HoldoutChargeUse; @@ -136,7 +136,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Main.npc[i].Distance(target.Center) < 240f && extraZaps < 3) { - + if (TryToSuperchargeNPC(Main.npc[i])) { for (float increment = 0f; increment <= 1f; increment += 0.05f) @@ -160,7 +160,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal // No more than 3 enemies with streams if (Owner.ownedProjectileCounts[attackType] > 3) return false; - + // Prevent supercharging an enemy twice. for (int i = 0; i < Main.projectile.Length; i++) { @@ -184,7 +184,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; int height = texture.Height / Main.projFrames[Projectile.type]; int frameHeight = height * Projectile.frame; SpriteEffects spriteEffects = SpriteEffects.None; diff --git a/Projectiles/DraedonsArsenal/LaserRifleShot.cs b/Projectiles/DraedonsArsenal/LaserRifleShot.cs index 29e284b6fc..8e084688a8 100644 --- a/Projectiles/DraedonsArsenal/LaserRifleShot.cs +++ b/Projectiles/DraedonsArsenal/LaserRifleShot.cs @@ -92,7 +92,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal dustVel = dustVel.RotatedBy(-angleRandom); dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); - int burstDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dust, dustVel.X, dustVel.Y, 200, default, 2.5f); + int burstDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dust, dustVel.X, dustVel.Y, 200, default, 2.5f); Main.dust[burstDust].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; Main.dust[burstDust].noGravity = true; @@ -100,7 +100,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal dust2.velocity *= 3f; dust2 = Main.dust[burstDust]; - burstDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dust, dustVel.X, dustVel.Y, 100, default, 1.9f); + burstDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dust, dustVel.X, dustVel.Y, 100, default, 1.9f); Main.dust[burstDust].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; dust2 = Main.dust[burstDust]; @@ -119,7 +119,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal dustVel = dustVel.RotatedBy(-angleRandom); dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); - int burstDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dust, dustVel.X, dustVel.Y, 0, default, 3.2f); + int burstDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dust, dustVel.X, dustVel.Y, 0, default, 3.2f); Main.dust[burstDust2].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(MathHelper.Pi).RotatedBy(Projectile.velocity.ToRotation()) * Projectile.width / 3f; Main.dust[burstDust2].noGravity = true; diff --git a/Projectiles/DraedonsArsenal/MassivePlasmaExplosion.cs b/Projectiles/DraedonsArsenal/MassivePlasmaExplosion.cs index a46cb9f597..b0e8e818b4 100644 --- a/Projectiles/DraedonsArsenal/MassivePlasmaExplosion.cs +++ b/Projectiles/DraedonsArsenal/MassivePlasmaExplosion.cs @@ -1,11 +1,11 @@ using System; +using CalamityMod.Sounds; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; -using Terraria.ModLoader; using Terraria.Audio; -using CalamityMod.Sounds; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.DraedonsArsenal { @@ -80,7 +80,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; int length = texture.Width / horizontalFrames; int height = texture.Height / verticalFrames; Vector2 drawPos = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); diff --git a/Projectiles/DraedonsArsenal/MountedScannerLaser.cs b/Projectiles/DraedonsArsenal/MountedScannerLaser.cs index 2123122dca..4e1fd3599e 100644 --- a/Projectiles/DraedonsArsenal/MountedScannerLaser.cs +++ b/Projectiles/DraedonsArsenal/MountedScannerLaser.cs @@ -1,9 +1,9 @@ -using CalamityMod.Projectiles.BaseProjectiles; +using System; +using System.Linq; +using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; -using System; -using System.Linq; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -39,7 +39,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Projectile.friendly = true; Projectile.penetrate = -1; Projectile.alpha = 255; - Projectile.localNPCHitCooldown = 15; + Projectile.localNPCHitCooldown = 20; Projectile.usesLocalNPCImmunity = true; Projectile.DamageType = DamageClass.Summon; } @@ -75,7 +75,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal if (Main.projectile[OwnerIndex].localAI[0] == 0f) Projectile.Kill(); } - + public override bool ShouldUpdatePosition() => false; public override void ExtraBehavior() @@ -93,15 +93,5 @@ namespace CalamityMod.Projectiles.DraedonsArsenal } } } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - Projectile.damage = (int)(Projectile.damage * 0.6); - } - - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - Projectile.damage = (int)(Projectile.damage * 0.6); - } } } diff --git a/Projectiles/DraedonsArsenal/MountedScannerSummon.cs b/Projectiles/DraedonsArsenal/MountedScannerSummon.cs index 773fb6e562..996aca33d1 100644 --- a/Projectiles/DraedonsArsenal/MountedScannerSummon.cs +++ b/Projectiles/DraedonsArsenal/MountedScannerSummon.cs @@ -1,10 +1,10 @@ using CalamityMod.Buffs.Summon; +using CalamityMod.Sounds; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using CalamityMod.Sounds; namespace CalamityMod.Projectiles.DraedonsArsenal { @@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal set => Projectile.ai[1] = value; } - public const int LaserFireRate = 300; + public const int LaserFireRate = 125; public const float OffsetDistanceFromPlayer = 60f; diff --git a/Projectiles/DraedonsArsenal/PhaseslayerBeam.cs b/Projectiles/DraedonsArsenal/PhaseslayerBeam.cs index 9ec4b6b6e8..0246fc0784 100644 --- a/Projectiles/DraedonsArsenal/PhaseslayerBeam.cs +++ b/Projectiles/DraedonsArsenal/PhaseslayerBeam.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override bool PreDraw(ref Color lightColor) { - Texture2D bladeTexture = ModContent.Request(Texture).Value ; + Texture2D bladeTexture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); diff --git a/Projectiles/DraedonsArsenal/PhaseslayerProjectile.cs b/Projectiles/DraedonsArsenal/PhaseslayerProjectile.cs index 01c8f34799..d11e1de3a4 100644 --- a/Projectiles/DraedonsArsenal/PhaseslayerProjectile.cs +++ b/Projectiles/DraedonsArsenal/PhaseslayerProjectile.cs @@ -1,4 +1,7 @@ -using CalamityMod.Dusts; +using System; +using System.IO; +using System.Linq; +using CalamityMod.Dusts; using CalamityMod.Graphics.Primitives; using CalamityMod.Items; using CalamityMod.Items.Weapons.DraedonsArsenal; @@ -6,9 +9,6 @@ using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Sounds; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; -using System.Linq; using Terraria; using Terraria.Audio; using Terraria.Graphics.Shaders; @@ -130,7 +130,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal // In addition to typical channel cancellation criteria, the sword fizzles out if it runs out of charge. Item playerItem = player.ActiveItem(); bool hasCharge = modItem.Charge > 0f; - if (player.channel && !player.noItems && !player.CCed && playerItem.type == ModContent.ItemType() && hasCharge) + if (!player.CantUseHoldout() && playerItem.type == ModContent.ItemType() && hasCharge) { // The distance ratio ranges from 0 (your mouse is directly on the player) to 1 (your mouse is at the max range considered, or any further distance). float mouseDistance = Projectile.Distance(Main.MouseWorld); @@ -296,7 +296,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override bool PreDraw(ref Color lightColor) { Texture2D bladeTexture = ModContent.Request("CalamityMod/Projectiles/DraedonsArsenal/PhaseslayerBlade").Value; - Texture2D hiltTexture = ModContent.Request(Texture).Value; + Texture2D hiltTexture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; if (IsSmall) bladeTexture = ModContent.Request("CalamityMod/Projectiles/DraedonsArsenal/PhaseslayerBladeSmall").Value; diff --git a/Projectiles/DraedonsArsenal/PlasmaCasterShot.cs b/Projectiles/DraedonsArsenal/PlasmaCasterShot.cs index dc43fcf7ea..818b637bfe 100644 --- a/Projectiles/DraedonsArsenal/PlasmaCasterShot.cs +++ b/Projectiles/DraedonsArsenal/PlasmaCasterShot.cs @@ -1,9 +1,9 @@ using System; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.DraedonsArsenal { @@ -162,9 +162,9 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(Projectile.velocity.ToRotation()); dustVel = dustVel.RotatedBy(-angleRandom); dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); - int randomDustType = Main.rand.Next(2) == 0 ? dust1 : dust2; + int randomDustType = Main.rand.NextBool(2)? dust1 : dust2; - int plasmaBurstDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 200, default, 1.7f); + int plasmaBurstDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 200, default, 1.7f); Main.dust[plasmaBurstDust].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; Main.dust[plasmaBurstDust].noGravity = true; @@ -172,7 +172,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal dust.velocity *= 3f; dust = Main.dust[plasmaBurstDust]; - plasmaBurstDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 100, default, 0.8f); + plasmaBurstDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 100, default, 0.8f); Main.dust[plasmaBurstDust].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; dust = Main.dust[plasmaBurstDust]; @@ -190,9 +190,9 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(Projectile.velocity.ToRotation()); dustVel = dustVel.RotatedBy(-angleRandom); dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); - int randomDustType = Main.rand.Next(2) == 0 ? dust1 : dust2; + int randomDustType = Main.rand.NextBool(2)? dust1 : dust2; - int plasmaBurstDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 0, default, 2f); + int plasmaBurstDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 0, default, 2f); Main.dust[plasmaBurstDust2].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(MathHelper.Pi).RotatedBy(Projectile.velocity.ToRotation()) * Projectile.width / 3f; Main.dust[plasmaBurstDust2].noGravity = true; diff --git a/Projectiles/DraedonsArsenal/PlasmaGrenadeProjectile.cs b/Projectiles/DraedonsArsenal/PlasmaGrenadeProjectile.cs index 5dcc6feb76..b51b788150 100644 --- a/Projectiles/DraedonsArsenal/PlasmaGrenadeProjectile.cs +++ b/Projectiles/DraedonsArsenal/PlasmaGrenadeProjectile.cs @@ -1,10 +1,10 @@ using CalamityMod.Dusts; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; -using Terraria.Audio; using CalamityMod.Items.Weapons.DraedonsArsenal; using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.DraedonsArsenal { @@ -44,8 +44,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal if (!Main.dedServ && Main.rand.NextBool()) // 50% chance to spawn smoke { Color plasmaLime = Color.Lerp(Color.Lime, Color.LimeGreen, Main.rand.NextFloat(1f)); - Color fadeColor = Color.Lerp(Color.LightGreen, plasmaLime, Main.rand.NextFloat(0.5f,1f)); - Particle plasma = new SmallSmokeParticle(projectileTop, Projectile.oldVelocity*0.7f, Color.LightGreen, fadeColor, Main.rand.NextFloat(0.4f,0.9f), 100f); + Color fadeColor = Color.Lerp(Color.LightGreen, plasmaLime, Main.rand.NextFloat(0.5f, 1f)); + Particle plasma = new SmallSmokeParticle(projectileTop, Projectile.oldVelocity * 0.7f, Color.LightGreen, fadeColor, Main.rand.NextFloat(0.4f, 0.9f), 100f); GeneralParticleHandler.SpawnParticle(plasma); } Time++; @@ -54,7 +54,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(PlasmaGrenade.ExplosionSound, Projectile.position); + SoundEngine.PlaySound(PlasmaGrenade.ExplosionSound, Projectile.Center); if (Projectile.Calamity().stealthStrike) { if (Main.myPlayer == Projectile.owner) @@ -88,7 +88,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { for (int i = 0; i < 120; i++) { - int type = Main.rand.NextBool(3) ? 261 : (int)CalamityDusts.SulfurousSeaAcid; + int type = Main.rand.NextBool(3) ? 261 : (int)CalamityDusts.SulphurousSeaAcid; Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(10f, 10f), type); dust.scale = Main.rand.NextFloat(1.3f, 1.5f); dust.velocity = Main.rand.NextVector2CircularEdge(15f, 15f); diff --git a/Projectiles/DraedonsArsenal/PlasmaGrenadeSmallExplosion.cs b/Projectiles/DraedonsArsenal/PlasmaGrenadeSmallExplosion.cs index 359a08b78f..f2e91c5f2c 100644 --- a/Projectiles/DraedonsArsenal/PlasmaGrenadeSmallExplosion.cs +++ b/Projectiles/DraedonsArsenal/PlasmaGrenadeSmallExplosion.cs @@ -1,8 +1,8 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.DraedonsArsenal { @@ -64,7 +64,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal } public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; int length = texture.Width / horizontalFrames; int height = texture.Height / verticalFrames; Vector2 drawPos = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); diff --git a/Projectiles/DraedonsArsenal/PoleWarperSummon.cs b/Projectiles/DraedonsArsenal/PoleWarperSummon.cs index 93fab2bf0e..4458db75aa 100644 --- a/Projectiles/DraedonsArsenal/PoleWarperSummon.cs +++ b/Projectiles/DraedonsArsenal/PoleWarperSummon.cs @@ -1,6 +1,6 @@ -using CalamityMod.Buffs.Summon; +using System; +using CalamityMod.Buffs.Summon; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Projectiles/DraedonsArsenal/PulseDragonProjectile.cs b/Projectiles/DraedonsArsenal/PulseDragonProjectile.cs index 756c4112b3..5f91f4bfe4 100644 --- a/Projectiles/DraedonsArsenal/PulseDragonProjectile.cs +++ b/Projectiles/DraedonsArsenal/PulseDragonProjectile.cs @@ -1,9 +1,9 @@ -using CalamityMod.DataStructures; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; +using System; using System.Collections.Generic; using System.IO; +using CalamityMod.DataStructures; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Projectiles/DraedonsArsenal/PulsePistolShot.cs b/Projectiles/DraedonsArsenal/PulsePistolShot.cs index a121b81a2c..abd03aceaf 100644 --- a/Projectiles/DraedonsArsenal/PulsePistolShot.cs +++ b/Projectiles/DraedonsArsenal/PulsePistolShot.cs @@ -1,6 +1,6 @@ -using Microsoft.Xna.Framework; -using System; +using System; using System.Collections.Generic; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Projectiles/DraedonsArsenal/PulseRifleShot.cs b/Projectiles/DraedonsArsenal/PulseRifleShot.cs index 8f8b09c5af..1f7f997a7a 100644 --- a/Projectiles/DraedonsArsenal/PulseRifleShot.cs +++ b/Projectiles/DraedonsArsenal/PulseRifleShot.cs @@ -1,9 +1,17 @@ using System; +using System.Net.NetworkInformation; +using System.Net.Sockets; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Ranged; +using Humanizer; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; + namespace CalamityMod.Projectiles.DraedonsArsenal { @@ -12,241 +20,275 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public new string LocalizationCategory => "Projectiles.Misc"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - private int dust1 = 27; //purple - private int dust2 = 173; //shortlived purple - private int dust3 = 234; //cyan and pink - private bool hasHit = false; - + private Color mainColor = Color.Orchid; + private bool notSplit; + private bool doDamage = false; + private NPC closestTarget = null; + private NPC lastTarget = null; + private float distance; + private int timesItCanHit = 3; public override void SetDefaults() { - Projectile.width = 4; - Projectile.height = 4; + Projectile.width = 16; + Projectile.height = 16; Projectile.friendly = true; Projectile.DamageType = DamageClass.Ranged; - Projectile.penetrate = 1; - Projectile.extraUpdates = 100; - Projectile.timeLeft = 500; + Projectile.penetrate = -1; + Projectile.timeLeft = 900; + Projectile.tileCollide = false; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 20; } public override void AI() { - bool notSplitProjectile = Projectile.ai[1] == 0f; + // If it's hit targeted enemies enough, kill it + if (timesItCanHit <= 0) + Projectile.Kill(); + + notSplit = Projectile.ai[1] == 0f; Lighting.AddLight(Projectile.Center, 0.3f, 0f, 0.5f); + Player Owner = Main.player[Projectile.owner]; + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); + Projectile.rotation = Projectile.velocity.ToRotation(); float createDustVar = 10f; - Projectile.localAI[0] += 1f; - if (Projectile.localAI[0] > createDustVar) - { - for (int i = 0; i < 2; i++) - { - Vector2 projPos = Projectile.position; - projPos -= Projectile.velocity * (i * 0.25f); - int purpleDust = Dust.NewDust(projPos, 1, 1, dust1, 0f, 0f, 0, default, 1f); - Main.dust[purpleDust].noGravity = true; - Main.dust[purpleDust].position = projPos; - Main.dust[purpleDust].scale = Main.rand.Next(70, 110) * 0.013f; - int pinkDust = Dust.NewDust(projPos, 1, 1, dust3, 0f, 0f, 0, default, 1f); - Main.dust[pinkDust].noGravity = true; - Main.dust[pinkDust].position = projPos; - Main.dust[pinkDust].scale = Main.rand.Next(70, 110) * 0.013f; + // Set split projectile stats + if (Projectile.localAI[0] == 0 && !notSplit) + { + Projectile.extraUpdates = 1; + Projectile.timeLeft = 1240; + if (Projectile.ai[1] == 1) + SoundEngine.PlaySound(SoundID.DD2_DarkMageCastHeal with { Volume = 1.7f, Pitch = 0.3f }, Projectile.Center); + } + if (notSplit) + { + doDamage = true; + Projectile.extraUpdates = 100; + } + + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > createDustVar && notSplit) + { + // Main projectile visual + float sizeBonus = MathHelper.Clamp(Projectile.localAI[0] * 0.009f, 0, 3.5f); + if (targetDist < 1400f) + { + GlowOrbParticle spark = new GlowOrbParticle(Projectile.Center, -Projectile.velocity * Main.rand.NextFloat(-0.01f, 0.01f), false, 30, 1.1f - Projectile.ai[1] + sizeBonus, Main.rand.NextBool(3) ? Color.DarkViolet : mainColor); + GeneralParticleHandler.SpawnParticle(spark); } - if (notSplitProjectile) + if (targetDist < 1400f && Main.rand.NextBool()) { - Vector2 dustRotateVector = new Vector2(5f, 10f); - Vector2 dustRotate = Vector2.UnitX * -12f; + GlowOrbParticle spark = new GlowOrbParticle(Projectile.Center + Projectile.velocity * Main.rand.NextFloat(-2f, 2f), -Projectile.velocity * Main.rand.NextFloat(-0.01f, 0.01f), false, 30, 1.1f - Projectile.ai[1] + sizeBonus, Main.rand.NextBool(3) ? Color.DarkViolet : mainColor); + GeneralParticleHandler.SpawnParticle(spark); + } - for (int k = 0; k < 2; k++) - { - dustRotate = -Vector2.UnitY.RotatedBy(24f * 0.1308997f + 0f * MathHelper.Pi) * dustRotateVector; - int darkPurpDust = Dust.NewDust(Projectile.Center, 0, 0, dust2, 0f, 0f, 160, default, 1f); - Main.dust[darkPurpDust].scale = 1.5f; - Main.dust[darkPurpDust].noGravity = true; - Main.dust[darkPurpDust].position = Projectile.Center + dustRotate; - } - - for (int k = 0; k < 2; k++) - { - dustRotate = -Vector2.UnitY.RotatedBy(24f * 0.1308997f + 1f * MathHelper.Pi) * dustRotateVector; - int darkPurpDust = Dust.NewDust(Projectile.Center, 0, 0, dust2, 0f, 0f, 160, default, 1f); - Main.dust[darkPurpDust].scale = 1.5f; - Main.dust[darkPurpDust].noGravity = true; - Main.dust[darkPurpDust].position = Projectile.Center + dustRotate; - } + // A lingering trail of dust you can see after the particle trail disipates + if (Projectile.localAI[0] > 20 && Main.rand.NextBool()) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(5, 5), 66); + dust.scale = Main.rand.NextFloat(0.7f, 1.5f); + dust.velocity = Projectile.velocity * Main.rand.NextFloat(-3, 3); + dust.noGravity = true; + dust.color = Main.rand.NextBool(3) ? Color.DarkViolet : mainColor; + dust.noLight = true; } } - if (Projectile.localAI[0] == createDustVar && notSplitProjectile) + #region Split Projectile AI + if (!notSplit) + { + // Split projectile visuals + if (targetDist < 1400f) + { + GlowOrbParticle spark = new GlowOrbParticle(Projectile.Center, -Projectile.velocity * Main.rand.NextFloat(-0.01f, 0.01f), false, 5, 1.7f - Projectile.ai[1] * 0.18f, Main.rand.NextBool(3) ? Color.DarkViolet : mainColor); + GeneralParticleHandler.SpawnParticle(spark); + } + if (targetDist < 1400f && Main.rand.NextBool()) + { + GlowOrbParticle spark = new GlowOrbParticle(Projectile.Center + Projectile.velocity * Main.rand.NextFloat(-2f, 2f), -Projectile.velocity * Main.rand.NextFloat(-0.01f, 0.01f), false, 5, 1.7f - Projectile.ai[1] * 0.18f, Main.rand.NextBool(3) ? Color.DarkViolet : mainColor); + GeneralParticleHandler.SpawnParticle(spark); + } + + if (Projectile.localAI[0] > 90) + { + // Velocity must look like it has stoped, but can't actually be zero otherwise homing code doesn't work + if (Projectile.localAI[0] == 91) + Projectile.velocity *= 0.001f; + + // When they begin the homing after a hit of spawning, do a few visuals + if (Projectile.localAI[0] == 120) + { + distance = 3000; + + SoundStyle fire = new("CalamityMod/Sounds/Item/PulseSound"); + SoundEngine.PlaySound(fire with { Volume = 0.35f, Pitch = 0.3f, MaxInstances = -1 }, Projectile.Center); + + + Particle pulse = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, mainColor, new Vector2(1f, 1f), Main.rand.NextFloat(12f, 25f), 0f, 0.5f, 15); + GeneralParticleHandler.SpawnParticle(pulse); + + for (int k = 0; k < 6; k++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, 66); + dust.scale = Main.rand.NextFloat(0.6f, 1.1f); + dust.velocity = new Vector2(6, 6).RotatedByRandom(100) * Main.rand.NextFloat(0.05f, 0.8f); + dust.noGravity = true; + dust.color = Main.rand.NextBool(3) ? Color.DarkViolet : mainColor; + dust.noLight = true; + } + } + // Homing code + if (Projectile.localAI[0] > 120) + { + // Do damage if it's near its target otherwise don't, this is to prevent excessive hits as orbs rail through worm bosses and such + if (closestTarget is not null) + doDamage = Vector2.Distance(Projectile.Center, closestTarget.Center) < 10; + else + doDamage = false; + + // Tracking code, originally was going to try only tracking the closest target not including the last target you hit, but I couldn't make it work + // Eventually I settled on how it works now and it seems to home consistently so I'm happy enough there + float projectileSpeed = 9.5f; + if (closestTarget is not null && closestTarget.active) + { + float targetDirectionRotation = Projectile.SafeDirectionTo(closestTarget.Center).ToRotation(); + float turningRate = 10f + Projectile.localAI[0] * 0.00008f; + Projectile.velocity = Projectile.velocity.ToRotation().AngleTowards(targetDirectionRotation, turningRate).ToRotationVector2() * projectileSpeed; + } + else + { + Projectile.velocity = Projectile.rotation.ToRotationVector2() * projectileSpeed; + Projectile.velocity *= 0.999f; + } + if (closestTarget is not null && Vector2.Distance(Projectile.Center, closestTarget.Center) < 10) + { + closestTarget = null; + distance = 3000; + } + + // Add extra updates as it hits more times, this smoothy increases the speed without destroying velocity based visual effects + Projectile.extraUpdates = 5 + (int)(Projectile.numHits * 0.3f); + { + // Actual homing movement + for (int index = 0; index < Main.npc.Length; index++) + { + if (Main.npc[index].CanBeChasedBy(null, false) || Main.npc[index] == lastTarget) + { + float extraDistance = (Main.npc[index].width / 2) + (Main.npc[index].height / 2); + + if (Vector2.Distance(Projectile.Center, Main.npc[index].Center) < (distance + extraDistance)) + { + closestTarget = Main.npc[index]; + distance = Vector2.Distance(Projectile.Center, Main.npc[index].Center); + } + } + } + } + } + } + else + { + // Minor dust trail for when they first spawn + if (Main.rand.NextBool(5)) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(5, 5), 66); + dust.scale = Main.rand.NextFloat(0.8f, 1.4f); + dust.velocity = -Projectile.velocity * Main.rand.NextFloat(0.2f, 0.5f); + dust.noGravity = true; + dust.color = Main.rand.NextBool(3) ? Color.DarkViolet : mainColor; + dust.noLight = true; + } + Projectile.velocity *= 0.98f; + } + } + #endregion + + // Visuals for the shot as it exits the tip of the rifle + if (Projectile.localAI[0] == createDustVar && notSplit) PulseBurst(4f, 5f); } - public override bool? CanHitNPC(NPC target) => Projectile.timeLeft < 480 && target.CanBeChasedBy(Projectile); + public override bool? CanHitNPC(NPC target) => doDamage ? null : false; - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - if (Projectile.ai[1] < 3f && !hasHit && Main.myPlayer == Projectile.owner) + bool onKill = target.life <= 0; + if (notSplit) { - hasHit = true; + Projectile.Kill(); - int alreadyTargetedNPCType = 0; - if (Projectile.ai[1] > 0f) - alreadyTargetedNPCType = (int)Projectile.ai[0]; - else - alreadyTargetedNPCType = target.whoAmI; - - for (int i = 0; i < Main.maxNPCs; i++) + for (int i = 0; i <= 9; i++) { - if (!Main.npc[i].CanBeChasedBy(Projectile, false) || !Collision.CanHit(Projectile.Center, 1, 1, Main.npc[i].Center, 1, 1)) - continue; + Dust dust = Dust.NewDustPerfect(Projectile.Center, 66); + dust.scale = Main.rand.NextFloat(0.4f, 1.1f); + dust.velocity = (Projectile.velocity * 4).RotateRandom(0.6f) * Main.rand.NextFloat(0.2f, 0.9f); + dust.noGravity = true; + dust.color = Main.rand.NextBool(3) ? Color.DarkViolet : mainColor; + dust.noLight = true; + } - if (alreadyTargetedNPCType != Main.npc[i].whoAmI && Projectile.Center.ManhattanDistance(Main.npc[i].Center) < 600f) - { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.SafeDirectionTo(Main.npc[i].Center) * 5f, Projectile.type, (int)(Projectile.damage * 0.4f), 0f, Projectile.owner, Main.npc[i].whoAmI, Projectile.ai[1] + 1f); - break; - } + // Since the beam looks wider as it travels, these hit particles scale a bit to fit that + float sizeBonus = MathHelper.Clamp(Projectile.localAI[0] * 0.01f, 0, 3.5f); + for (int k = 0; k < 9; k++) + { + SparkParticle spark = new SparkParticle(Projectile.Center + Main.rand.NextVector2Circular(8, 8) - Projectile.velocity * 7, Projectile.velocity * Main.rand.NextFloat(0.7f, 3.1f), false, 30, 0.9f * Main.rand.NextFloat(0.9f, 1.1f) + sizeBonus, mainColor); + GeneralParticleHandler.SpawnParticle(spark); + } + + // Spawn the 4 energy orbs + // These should do a large fraction of the beam's damage so they will easily kill even some decently bulky enemies regular enemies in one hit + // This is so it can better proc its on kill effect + int numProj = 4; + int projectileDamage = (int)(Projectile.damage * 0.5f); + for (int i = 0; i < numProj; i++) + { + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, (Projectile.velocity.SafeNormalize(Vector2.Zero) * (14f - i * 0.7f)) * ((i + 1) * 0.25f), ModContent.ProjectileType(), projectileDamage, Projectile.knockBack, Projectile.owner, 0f, 1f + i); + } + } + // Split projectile on hit effects + else + { + // Set some values to get ready foir it to home again for its next hit + lastTarget = target; + distance = 3000; + Projectile.localAI[0] = 60; + Projectile.velocity *= MathHelper.Clamp(1.5f - Projectile.numHits * 0.5f, 1f, 1.5f); + + for (int i = 0; i <= 2; i++) + { + SquishyLightParticle energy = new SquishyLightParticle(Projectile.Center, (Projectile.velocity * 2).RotatedByRandom(0.7f) * Main.rand.NextFloat(0.1f, 0.4f), Main.rand.NextFloat(0.1f, 0.25f), Main.rand.NextBool(3) ? Color.DarkViolet : mainColor, Main.rand.Next(20, 30 + 1), 0.25f, 2f); + GeneralParticleHandler.SpawnParticle(energy); + } + + if (hit.Damage > 2 && target == closestTarget) + timesItCanHit--; + + if (onKill) + { + timesItCanHit += 1; + Projectile.timeLeft += 90; } } } - - public override void OnKill(int timeLeft) - { - int timesSplit = (int)Projectile.ai[1]; - - int height = 40; - int totalDust = 400; - float speed1 = 10f; - switch (timesSplit) - { - case 1: - height = 35; - totalDust = 350; - speed1 = 8.5f; - break; - case 2: - height = 30; - totalDust = 300; - speed1 = 7f; - break; - case 3: - height = 25; - totalDust = 250; - speed1 = 5.5f; - break; - default: - break; - } - - Projectile.position = Projectile.Center; - Projectile.width = Projectile.height = height; - Projectile.Center = Projectile.position; - Projectile.maxPenetrate = -1; - Projectile.penetrate = -1; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; - Projectile.Damage(); - - SoundEngine.PlaySound(SoundID.Item93, Projectile.Center); - - int fourth = totalDust / 4; - int half = totalDust / 2; - int x = (int)(totalDust * 0.625f); - - for (int i = 0; i < totalDust; i++) - { - float dustSpeed = 2f * (i / (float)fourth); - int dustType = dust1; - if (i > fourth) - { - dustSpeed = speed1; - } - if (i > x) - { - dustSpeed = speed1 * 1.3f; - dustType = dust3; - } - - int killDust = Dust.NewDust(Projectile.Center, 6, 6, dustType, 0f, 0f, 100, default, 1f); - float killDustX = Main.dust[killDust].velocity.X; - float killDustY = Main.dust[killDust].velocity.Y; - if (killDustX == 0f && killDustY == 0f) - { - killDustX = 1f; - } - - float killDustYVel = (float)Math.Sqrt(killDustX * killDustX + killDustY * killDustY); - killDustYVel = dustSpeed / killDustYVel; - if (i <= half) - { - killDustX *= killDustYVel; - killDustY *= killDustYVel; - } - else - { - killDustX = killDustX * killDustYVel * 1.25f; - killDustY = killDustY * killDustYVel * 0.75f; - } - - Dust dust2 = Main.dust[killDust]; - dust2.velocity *= 0.5f; - dust2.velocity.X = dust2.velocity.X + killDustX; - dust2.velocity.Y = dust2.velocity.Y + killDustY; - - if (i > fourth) - { - dust2.scale = 1.3f; - } - - dust2.noGravity = true; - } - } - private void PulseBurst(float speed1, float speed2) { - float angleRandom = 0.05f; - - for (int i = 0; i < 50; i++) + for (int i = 0; i <= 15; i++) { - float dustSpeed = Main.rand.NextFloat(speed1, speed2); - Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(Projectile.velocity.ToRotation()); - dustVel = dustVel.RotatedBy(-angleRandom); - dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); - - int pulseDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dust3, dustVel.X, dustVel.Y, 200, default, 1.7f); - Main.dust[pulseDust].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; - Main.dust[pulseDust].noGravity = true; - - Dust dust = Main.dust[pulseDust]; - dust.velocity *= 3f; - dust = Main.dust[pulseDust]; - - pulseDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dust1, dustVel.X, dustVel.Y, 100, default, 1f); - Main.dust[pulseDust].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; - - dust = Main.dust[pulseDust]; - dust.velocity *= 2f; - - Main.dust[pulseDust].noGravity = true; - Main.dust[pulseDust].fadeIn = 1f; - Main.dust[pulseDust].color = Color.Green * 0.5f; - - dust = Main.dust[pulseDust]; + Dust dust = Dust.NewDustPerfect(Projectile.Center, 66); + dust.scale = Main.rand.NextFloat(0.4f, 1.4f); + dust.velocity = (Projectile.velocity * 4).RotateRandom(0.6f) * Main.rand.NextFloat(0.2f, 0.9f); + dust.noGravity = true; + dust.color = Main.rand.NextBool(3) ? Color.DarkViolet : mainColor; + dust.noLight = true; } - for (int j = 0; j < 25; j++) + for (int i = 0; i <= 15; i++) { - float dustSpeed = Main.rand.NextFloat(speed1, speed2); - Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(Projectile.velocity.ToRotation()); - dustVel = dustVel.RotatedBy(-angleRandom); - dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); - - int pulseDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dust2, dustVel.X, dustVel.Y, 0, default, 3f); - Main.dust[pulseDust2].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy(Projectile.velocity.ToRotation()) * Projectile.width / 3f; - Main.dust[pulseDust2].noGravity = true; - - Dust dust = Main.dust[pulseDust2]; - dust.velocity *= 0.5f; - dust = Main.dust[pulseDust2]; + SquishyLightParticle energy = new SquishyLightParticle(Projectile.Center, (Projectile.velocity * 4).RotatedByRandom(0.6f) * Main.rand.NextFloat(0.1f, 0.4f), Main.rand.NextFloat(0.2f, 0.6f), Main.rand.NextBool(3) ? Color.DarkViolet : mainColor, Main.rand.Next(30, 40 + 1), 0.25f, 2f); + GeneralParticleHandler.SpawnParticle(energy); } } } diff --git a/Projectiles/DraedonsArsenal/PulseTurret.cs b/Projectiles/DraedonsArsenal/PulseTurret.cs index 8612a69031..80ee8dd273 100644 --- a/Projectiles/DraedonsArsenal/PulseTurret.cs +++ b/Projectiles/DraedonsArsenal/PulseTurret.cs @@ -1,11 +1,11 @@ -using Microsoft.Xna.Framework; +using System; +using CalamityMod.Items.Weapons.DraedonsArsenal; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using CalamityMod.Items.Weapons.DraedonsArsenal; namespace CalamityMod.Projectiles.DraedonsArsenal { @@ -106,14 +106,12 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { Projectile.rotation = Projectile.rotation.AngleLerp(0f, MathHelper.TwoPi / 50f); } - - Projectile.StickToTiles(false, false); } public override bool PreDraw(ref Color lightColor) { Texture2D standTexture = ModContent.Request("CalamityMod/Projectiles/DraedonsArsenal/PulseTurretStand").Value; - Main.EntitySpriteDraw(ModContent.Request(Texture).Value, + Main.EntitySpriteDraw(Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value, Projectile.Center - ((standTexture.Height / 2 + 6f) * Vector2.UnitY) - Main.screenPosition, null, lightColor, @@ -136,5 +134,11 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override bool? CanDamage() => false; public override bool OnTileCollide(Vector2 oldVelocity) => false; + + public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough, ref Vector2 hitboxCenterFrac) + { + fallThrough = false; + return true; + } } } diff --git a/Projectiles/DraedonsArsenal/SnakeEyesProjectile.cs b/Projectiles/DraedonsArsenal/SnakeEyesProjectile.cs index 62dc95c8a0..affaef2451 100644 --- a/Projectiles/DraedonsArsenal/SnakeEyesProjectile.cs +++ b/Projectiles/DraedonsArsenal/SnakeEyesProjectile.cs @@ -135,7 +135,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal for (int i = 0; i < 20; i++) { - Dust boomDust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, 261, Scale: 2f); + Dust boomDust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.AncientLight, Scale: 2f); boomDust.noGravity = true; } @@ -179,7 +179,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Vector2 drawPosition = Projectile.Center - Main.screenPosition; Rectangle frame = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); Vector2 origin = frame.Size() * 0.5f; diff --git a/Projectiles/DraedonsArsenal/SnakeEyesSummon.cs b/Projectiles/DraedonsArsenal/SnakeEyesSummon.cs index a789a53b17..62127086be 100644 --- a/Projectiles/DraedonsArsenal/SnakeEyesSummon.cs +++ b/Projectiles/DraedonsArsenal/SnakeEyesSummon.cs @@ -241,7 +241,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Vector2 drawPosition = Projectile.Center - Main.screenPosition; Rectangle frame = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); Vector2 origin = frame.Size() * 0.5f; diff --git a/Projectiles/DraedonsArsenal/StarSwallowerAcid.cs b/Projectiles/DraedonsArsenal/StarSwallowerAcid.cs index 935503165e..d4ac4417e8 100644 --- a/Projectiles/DraedonsArsenal/StarSwallowerAcid.cs +++ b/Projectiles/DraedonsArsenal/StarSwallowerAcid.cs @@ -48,7 +48,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal // Water drip for (int i = 0; i < 4; i++) { - int idx = Dust.NewDust(Projectile.position - Projectile.velocity, 2, 2, 154, 0f, 0f, 0, new Color(112, 150, 42, 127), 1f); + int idx = Dust.NewDust(Projectile.position - Projectile.velocity, 2, 2, DustID.Rain, 0f, 0f, 0, new Color(112, 150, 42, 127), 1f); Dust dust = Main.dust[idx]; dust.position.X -= 2f; Main.dust[idx].alpha = 38; diff --git a/Projectiles/DraedonsArsenal/StarSwallowerSummon.cs b/Projectiles/DraedonsArsenal/StarSwallowerSummon.cs index fd8f09b006..6de89b202f 100644 --- a/Projectiles/DraedonsArsenal/StarSwallowerSummon.cs +++ b/Projectiles/DraedonsArsenal/StarSwallowerSummon.cs @@ -1,13 +1,13 @@ -using CalamityMod.Buffs.Summon; +using System; +using System.IO; +using CalamityMod.Buffs.Summon; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; using Terraria.WorldBuilding; -using Terraria.Audio; namespace CalamityMod.Projectiles.DraedonsArsenal { public class StarSwallowerSummon : ModProjectile, ILocalizedModType @@ -271,7 +271,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Rectangle frame = texture.Frame(2, Main.projFrames[Projectile.type], ReleasingAcid.ToInt(), Projectile.frame); Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, diff --git a/Projectiles/DraedonsArsenal/SystemBaneLightning.cs b/Projectiles/DraedonsArsenal/SystemBaneLightning.cs index 8394d7c799..3abc224117 100644 --- a/Projectiles/DraedonsArsenal/SystemBaneLightning.cs +++ b/Projectiles/DraedonsArsenal/SystemBaneLightning.cs @@ -1,7 +1,7 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -113,11 +113,11 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Vector2 start = oldPositions[i] + Projectile.Size * 0.5f - Main.screenPosition; Vector2 end = oldPositions[i + 1] + Projectile.Size * 0.5f - Main.screenPosition; - Utils.DrawLaser(Main.spriteBatch, ModContent.Request(Texture).Value, start, end, new Vector2(OuterLightningScale), new Utils.LaserLineFraming(DelegateMethods.LightningLaserDraw)); + Utils.DrawLaser(Main.spriteBatch, Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value, start, end, new Vector2(OuterLightningScale), new Utils.LaserLineFraming(DelegateMethods.LightningLaserDraw)); DelegateMethods.f_1 = InnerLightningOpacity; DelegateMethods.c_1 = InnerLightningColor; - Utils.DrawLaser(Main.spriteBatch, ModContent.Request(Texture).Value, start, end, new Vector2(InnerLightningScale), new Utils.LaserLineFraming(DelegateMethods.LightningLaserDraw)); + Utils.DrawLaser(Main.spriteBatch, Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value, start, end, new Vector2(InnerLightningScale), new Utils.LaserLineFraming(DelegateMethods.LightningLaserDraw)); } return false; } diff --git a/Projectiles/DraedonsArsenal/SystemBaneProjectile.cs b/Projectiles/DraedonsArsenal/SystemBaneProjectile.cs index 2cb2c34cc7..51ade30681 100644 --- a/Projectiles/DraedonsArsenal/SystemBaneProjectile.cs +++ b/Projectiles/DraedonsArsenal/SystemBaneProjectile.cs @@ -1,6 +1,6 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ModLoader; @@ -21,8 +21,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public const float FieldRadius = 360f; public override void SetDefaults() { - Projectile.width = 36; - Projectile.height = 36; + Projectile.width = Projectile.height = 34; Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.penetrate = -1; @@ -35,8 +34,6 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override void AI() { - Projectile.StickToTiles(false, true); - Time++; Projectile.rotation = Projectile.velocity.ToRotation(); if (Projectile.velocity.Y < 15f) @@ -107,6 +104,12 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Projectile.velocity.X *= 0.8f; return false; } + + public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough, ref Vector2 hitboxCenterFrac) + { + fallThrough = false; + return true; + } } } diff --git a/Projectiles/DraedonsArsenal/TaserHook.cs b/Projectiles/DraedonsArsenal/TaserHook.cs index b86bddc9fc..07c71d3c9e 100644 --- a/Projectiles/DraedonsArsenal/TaserHook.cs +++ b/Projectiles/DraedonsArsenal/TaserHook.cs @@ -110,7 +110,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override bool PreDraw(ref Color lightColor) { Player player = Main.player[Projectile.owner]; - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Utils.DrawLine(Main.spriteBatch, player.MountedCenter, Projectile.Center, Color.Cyan, Color.White, 4f); Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, null, lightColor, Projectile.rotation, texture.Size() * 0.5f, Projectile.scale, SpriteEffects.None, 0); return false; diff --git a/Projectiles/DraedonsArsenal/TeslaCannonShot.cs b/Projectiles/DraedonsArsenal/TeslaCannonShot.cs index a9ac5ec782..6a6464955a 100644 --- a/Projectiles/DraedonsArsenal/TeslaCannonShot.cs +++ b/Projectiles/DraedonsArsenal/TeslaCannonShot.cs @@ -1,9 +1,9 @@ using System; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.DraedonsArsenal { @@ -47,7 +47,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Main.dust[teslaDust].scale = Main.rand.Next(70, 110) * 0.026f; } - if (Main.rand.Next(6) == 0) + if (Main.rand.NextBool(6)) Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, dustArray[6], 0f, 0f); if (notArcingProjectile) @@ -233,10 +233,10 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(Projectile.velocity.ToRotation()); dustVel = dustVel.RotatedBy(-angleRandom); dustVel = dustVel.RotatedByRandom(2f * angleRandom); - int randomDustType = Main.rand.Next(2) == 0 ? dustArray[4] : dustArray[5]; + int randomDustType = Main.rand.NextBool(2)? dustArray[4] : dustArray[5]; float scale = randomDustType == dustArray[4] ? 1.5f : 1f; - int electricDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 200, default, 2.5f * scale); + int electricDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 200, default, 2.5f * scale); Main.dust[electricDust].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; Main.dust[electricDust].noGravity = true; @@ -244,7 +244,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal dust.velocity *= 3f; dust = Main.dust[electricDust]; - electricDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 100, default, 1.5f * scale); + electricDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 100, default, 1.5f * scale); Main.dust[electricDust].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; dust = Main.dust[electricDust]; @@ -262,10 +262,10 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Vector2 dustVel = new Vector2(dustSpeed, 0f).RotatedBy(Projectile.velocity.ToRotation()); dustVel = dustVel.RotatedBy(-angleRandom); dustVel = dustVel.RotatedByRandom(2f * angleRandom); - int randomDustType = Main.rand.Next(2) == 0 ? dustArray[4] : dustArray[5]; + int randomDustType = Main.rand.NextBool(2)? dustArray[4] : dustArray[5]; float scale = randomDustType == dustArray[4] ? 1.5f : 1f; - int electricDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 0, default, 3f * scale); + int electricDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 0, default, 3f * scale); Main.dust[electricDust2].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(MathHelper.Pi).RotatedBy(Projectile.velocity.ToRotation()) * Projectile.width / 3f; Main.dust[electricDust2].noGravity = true; diff --git a/Projectiles/DraedonsArsenal/TrackingDiskLaser.cs b/Projectiles/DraedonsArsenal/TrackingDiskLaser.cs index 55323fe7ff..6ce29dbe3a 100644 --- a/Projectiles/DraedonsArsenal/TrackingDiskLaser.cs +++ b/Projectiles/DraedonsArsenal/TrackingDiskLaser.cs @@ -1,4 +1,5 @@ -using Terraria; +using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.DraedonsArsenal @@ -23,6 +24,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Projectile.penetrate = 1; Projectile.extraUpdates = 100; Projectile.timeLeft = 600; + Projectile.ArmorPenetration = 10; } public override void AI() @@ -34,7 +36,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { for (int i = 0; i < 2; i++) { - Dust dust = Dust.NewDustDirect(Projectile.Center, 0, 0, 182, 0f, 0f, 160, default, 2f); + Dust dust = Dust.NewDustDirect(Projectile.Center, 0, 0, DustID.TheDestroyer, 0f, 0f, 160, default, 2f); dust.position = Projectile.Center; dust.velocity = Projectile.velocity; dust.scale = Projectile.scale; diff --git a/Projectiles/DraedonsArsenal/TrackingDiskProjectile.cs b/Projectiles/DraedonsArsenal/TrackingDiskProjectile.cs index a1ce240be0..31e59fe162 100644 --- a/Projectiles/DraedonsArsenal/TrackingDiskProjectile.cs +++ b/Projectiles/DraedonsArsenal/TrackingDiskProjectile.cs @@ -1,7 +1,7 @@ -using Microsoft.Xna.Framework; -using System; +using System; using System.Collections.Generic; using System.Linq; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -26,9 +26,11 @@ namespace CalamityMod.Projectiles.DraedonsArsenal } public const int LaserFireRate = 20; + public const int LaserFireRateStealth = 16; public const int MaxLaserCountPerShot = 4; // This only applies to stealth strikes. public const float MaxTargetSearchDistance = 480f; - public const float ReturnAcceleration = 0.15f; + public const float MaxTargetSearchStealth = 800f; + public const float ReturnAccelerationFactor = 0.0012f; public const float ReturnMaxSpeed = 12f; public override void SetStaticDefaults() @@ -72,10 +74,10 @@ namespace CalamityMod.Projectiles.DraedonsArsenal // This is done instead of a Normalize or DirectionTo call because the variables needed are already present and calculating the square root again would be unnecessary. Vector2 idealVelocity = (player.Center - Projectile.Center) / distanceFromPlayer * ReturnMaxSpeed; - Projectile.velocity.X += Math.Sign(idealVelocity.X - Projectile.velocity.X) * ReturnAcceleration; - Projectile.velocity.Y += Math.Sign(idealVelocity.Y - Projectile.velocity.Y) * ReturnAcceleration; + Projectile.velocity.X += Math.Sign(idealVelocity.X - Projectile.velocity.X) * (ReturnAccelerationFactor * Time); + Projectile.velocity.Y += Math.Sign(idealVelocity.Y - Projectile.velocity.Y) * (ReturnAccelerationFactor * Time); - if (Time % LaserFireRate == 0f) + if (Time % (Projectile.Calamity().stealthStrike ? LaserFireRateStealth : LaserFireRate) == 0f) AttemptToFireLasers((int)(Projectile.damage * 0.25)); if (Main.myPlayer == Projectile.owner) @@ -97,7 +99,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal int targetCount = 0; List targets = Main.npc.Where(npc => { - return npc.active && Projectile.Distance(npc.Center) < MaxTargetSearchDistance && npc.CanBeChasedBy(); + return npc.active && Projectile.Distance(npc.Center) < MaxTargetSearchStealth && npc.CanBeChasedBy(); }).ToList(); foreach (var target in targets) { diff --git a/Projectiles/DraedonsArsenal/UnstableMatter.cs b/Projectiles/DraedonsArsenal/UnstableMatter.cs index ff03dbeaca..34f8e8b7b6 100644 --- a/Projectiles/DraedonsArsenal/UnstableMatter.cs +++ b/Projectiles/DraedonsArsenal/UnstableMatter.cs @@ -1,5 +1,5 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; diff --git a/Projectiles/DraedonsArsenal/WavePounderProjectile.cs b/Projectiles/DraedonsArsenal/WavePounderProjectile.cs index 4aee34771d..9a8ecefceb 100644 --- a/Projectiles/DraedonsArsenal/WavePounderProjectile.cs +++ b/Projectiles/DraedonsArsenal/WavePounderProjectile.cs @@ -1,8 +1,8 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Items.Weapons.DraedonsArsenal; +using Microsoft.Xna.Framework; using Terraria; -using Terraria.ModLoader; using Terraria.Audio; -using CalamityMod.Items.Weapons.DraedonsArsenal; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.DraedonsArsenal { diff --git a/Projectiles/Enemy/AstralMeteorProj.cs b/Projectiles/Enemy/AstralMeteorProj.cs index eab2f37ba1..9048e87fa1 100644 --- a/Projectiles/Enemy/AstralMeteorProj.cs +++ b/Projectiles/Enemy/AstralMeteorProj.cs @@ -1,10 +1,10 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Dusts; namespace CalamityMod.Projectiles.Enemy { @@ -48,7 +48,7 @@ namespace CalamityMod.Projectiles.Enemy public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.NPCDeath14, Projectile.position); + SoundEngine.PlaySound(SoundID.NPCDeath14, Projectile.Center); Projectile.ExpandHitboxBy(60); for (int i = 0; i < 15; i++) @@ -111,6 +111,6 @@ namespace CalamityMod.Projectiles.Enemy return; target.AddBuff(ModContent.BuffType(), 45); - } + } } } diff --git a/Projectiles/Enemy/BelchingCoralSpike.cs b/Projectiles/Enemy/BelchingCoralSpike.cs index a2cb683d63..5bb82dcfd8 100644 --- a/Projectiles/Enemy/BelchingCoralSpike.cs +++ b/Projectiles/Enemy/BelchingCoralSpike.cs @@ -1,4 +1,4 @@ -using CalamityMod.Dusts; +using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -46,10 +46,10 @@ namespace CalamityMod.Projectiles.Enemy { for (int i = 0; i <= 2; i++) { - int idx = Dust.NewDust(Projectile.position, 8, 8, (int)CalamityDusts.SulfurousSeaAcid, 0, 0, 0, default, 0.75f); + int idx = Dust.NewDust(Projectile.position, 8, 8, (int)CalamityDusts.SulphurousSeaAcid, 0, 0, 0, default, 0.75f); Main.dust[idx].noGravity = true; Main.dust[idx].velocity *= 3f; - idx = Dust.NewDust(Projectile.position, 8, 8, (int)CalamityDusts.SulfurousSeaAcid, 0, 0, 0, default, 0.75f); + idx = Dust.NewDust(Projectile.position, 8, 8, (int)CalamityDusts.SulphurousSeaAcid, 0, 0, 0, default, 0.75f); Main.dust[idx].noGravity = true; Main.dust[idx].velocity *= 3f; } diff --git a/Projectiles/Enemy/CrabBoulder.cs b/Projectiles/Enemy/CrabBoulder.cs index 7edf428b29..4a332d07f3 100644 --- a/Projectiles/Enemy/CrabBoulder.cs +++ b/Projectiles/Enemy/CrabBoulder.cs @@ -1,5 +1,5 @@ +using System; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Projectiles/Enemy/CragmawBeam.cs b/Projectiles/Enemy/CragmawBeam.cs index 2e9b7207b3..0cff38bfcf 100644 --- a/Projectiles/Enemy/CragmawBeam.cs +++ b/Projectiles/Enemy/CragmawBeam.cs @@ -1,10 +1,10 @@ -using CalamityMod.Buffs.StatDebuffs; +using System; +using System.IO; +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; -using System; -using System.IO; using Terraria; using Terraria.Enums; using Terraria.ID; @@ -117,21 +117,21 @@ namespace CalamityMod.Projectiles.Enemy float theta = Projectile.velocity.ToRotation() + Main.rand.NextBool().ToDirectionInt() * MathHelper.PiOver2; float speed = (float)Main.rand.NextDouble() * 2f + 2f; Vector2 velocity = theta.ToRotationVector2() * speed; - Dust dust = Dust.NewDustDirect(beamEndPosiiton, 0, 0, (int)CalamityDusts.SulfurousSeaAcid, velocity.X, velocity.Y, 0, default, 1f); + Dust dust = Dust.NewDustDirect(beamEndPosiiton, 0, 0, (int)CalamityDusts.SulphurousSeaAcid, velocity.X, velocity.Y, 0, default, 1f); dust.noGravity = true; dust.scale = 2.1f; } for (int i = 0; i < 8; i++) { - Dust dust = Dust.NewDustPerfect(beamEndPosiiton, (int)CalamityDusts.SulfurousSeaAcid); + Dust dust = Dust.NewDustPerfect(beamEndPosiiton, (int)CalamityDusts.SulphurousSeaAcid); dust.velocity = Vector2.UnitY.RotatedByRandom(MathHelper.ToRadians(55f)).RotatedBy(Projectile.rotation); dust.noGravity = true; dust.scale = 1.8f; } for (int i = 0; i < 16; i++) { - Dust dust = Dust.NewDustPerfect(beamEndPosiiton, (int)CalamityDusts.SulfurousSeaAcid); + Dust dust = Dust.NewDustPerfect(beamEndPosiiton, (int)CalamityDusts.SulphurousSeaAcid); dust.velocity = (i / 16f * MathHelper.TwoPi).ToRotationVector2() * 3f; dust.noGravity = true; dust.scale = 2.4f; diff --git a/Projectiles/Enemy/CragmawExplosion.cs b/Projectiles/Enemy/CragmawExplosion.cs index 4bb30d7208..e4e2ad429e 100644 --- a/Projectiles/Enemy/CragmawExplosion.cs +++ b/Projectiles/Enemy/CragmawExplosion.cs @@ -1,7 +1,7 @@ -using CalamityMod.Buffs.StatDebuffs; +using System.Collections.Generic; +using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System.Collections.Generic; using Terraria; using Terraria.ModLoader; diff --git a/Projectiles/Enemy/CragmawSpike.cs b/Projectiles/Enemy/CragmawSpike.cs index a4e673af73..65cb656f60 100644 --- a/Projectiles/Enemy/CragmawSpike.cs +++ b/Projectiles/Enemy/CragmawSpike.cs @@ -42,10 +42,10 @@ namespace CalamityMod.Projectiles.Enemy { for (int i = 0; i < 3; i++) { - int idx = Dust.NewDust(Projectile.position, 8, 8, (int)CalamityDusts.SulfurousSeaAcid, 0, 0, 0, default, 0.75f); + int idx = Dust.NewDust(Projectile.position, 8, 8, (int)CalamityDusts.SulphurousSeaAcid, 0, 0, 0, default, 0.75f); Main.dust[idx].noGravity = true; Main.dust[idx].velocity *= 3f; - idx = Dust.NewDust(Projectile.position, 8, 8, (int)CalamityDusts.SulfurousSeaAcid, 0, 0, 0, default, 0.75f); + idx = Dust.NewDust(Projectile.position, 8, 8, (int)CalamityDusts.SulphurousSeaAcid, 0, 0, 0, default, 0.75f); Main.dust[idx].noGravity = true; Main.dust[idx].velocity *= 3f; } diff --git a/Projectiles/Enemy/CragmawVibeCheckChain.cs b/Projectiles/Enemy/CragmawVibeCheckChain.cs index 4b931db4f5..1b4a1cd930 100644 --- a/Projectiles/Enemy/CragmawVibeCheckChain.cs +++ b/Projectiles/Enemy/CragmawVibeCheckChain.cs @@ -81,7 +81,7 @@ namespace CalamityMod.Projectiles.Enemy public override bool PreDraw(ref Color lightColor) { - Texture2D endTexture = ModContent.Request(Texture).Value; + Texture2D endTexture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Texture2D chainTexture = ModContent.Request("CalamityMod/Projectiles/Enemy/CragmawVibeCheckMid").Value; Vector2 drawPosition = ReelingPlayer ? Main.player[(int)Projectile.ai[1]].Center : Projectile.Center; Vector2 distanceVectorToStart = Main.npc[(int)Projectile.ai[0]].Top + Vector2.UnitY * 30f - drawPosition; diff --git a/Projectiles/Enemy/CrimsonSpike.cs b/Projectiles/Enemy/CrimsonSpike.cs index 8308f706c3..c44c0e7349 100644 --- a/Projectiles/Enemy/CrimsonSpike.cs +++ b/Projectiles/Enemy/CrimsonSpike.cs @@ -1,8 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Enemy { @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Enemy { Color dustColor = Color.Crimson; dustColor.A = 150; - int redSpiky = Dust.NewDust(Projectile.position - Projectile.velocity * 3f, Projectile.width, Projectile.height, 260, 0f, 0f, 50, dustColor, 1.2f); + int redSpiky = Dust.NewDust(Projectile.position - Projectile.velocity * 3f, Projectile.width, Projectile.height, DustID.SparksMech, 0f, 0f, 50, dustColor, 1.2f); Main.dust[redSpiky].velocity *= 0.3f; Main.dust[redSpiky].velocity += Projectile.velocity * 0.3f; Main.dust[redSpiky].noGravity = true; @@ -38,7 +38,7 @@ namespace CalamityMod.Projectiles.Enemy if (Projectile.ai[1] == 0f) { Projectile.ai[1] = 1f; - SoundEngine.PlaySound(SoundID.Item17, Projectile.position); + SoundEngine.PlaySound(SoundID.Item17, Projectile.Center); } Projectile.ai[0] += 1f; @@ -63,7 +63,7 @@ namespace CalamityMod.Projectiles.Enemy dustColor.A = 150; for (int k = 0; k < 5; k++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 260, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f, 50, dustColor, 1f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.SparksMech, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f, 50, dustColor, 1f); } } diff --git a/Projectiles/Enemy/EarthRockBig.cs b/Projectiles/Enemy/EarthRockBig.cs index edc68e0e4b..adb9ae03d4 100644 --- a/Projectiles/Enemy/EarthRockBig.cs +++ b/Projectiles/Enemy/EarthRockBig.cs @@ -2,9 +2,9 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Enemy { public class EarthRockBig : ModProjectile, ILocalizedModType @@ -43,14 +43,14 @@ namespace CalamityMod.Projectiles.Enemy public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.NPCDeath14, Projectile.position); + SoundEngine.PlaySound(SoundID.NPCDeath14, Projectile.Center); Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); Projectile.width = 60; @@ -59,7 +59,7 @@ namespace CalamityMod.Projectiles.Enemy Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int i = 0; i < 15; i++) { - int earthyDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 8, 0f, 0f, 100, default, 1.2f); + int earthyDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Iron, 0f, 0f, 100, default, 1.2f); Main.dust[earthyDust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -69,10 +69,10 @@ namespace CalamityMod.Projectiles.Enemy } for (int j = 0; j < 30; j++) { - int earthyDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 1, 0f, 0f, 100, default, 1.7f); + int earthyDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Stone, 0f, 0f, 100, default, 1.7f); Main.dust[earthyDust2].noGravity = true; Main.dust[earthyDust2].velocity *= 5f; - earthyDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 8, 0f, 0f, 100, default, 1f); + earthyDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Iron, 0f, 0f, 100, default, 1f); Main.dust[earthyDust2].velocity *= 2f; } diff --git a/Projectiles/Enemy/EarthRockSmall.cs b/Projectiles/Enemy/EarthRockSmall.cs index 299f26e190..4620b5eee9 100644 --- a/Projectiles/Enemy/EarthRockSmall.cs +++ b/Projectiles/Enemy/EarthRockSmall.cs @@ -2,9 +2,9 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Enemy { public class EarthRockSmall : ModProjectile, ILocalizedModType @@ -21,14 +21,14 @@ namespace CalamityMod.Projectiles.Enemy public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.NPCDeath14, Projectile.position); + SoundEngine.PlaySound(SoundID.NPCDeath14, Projectile.Center); Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); Projectile.width = 50; @@ -37,7 +37,7 @@ namespace CalamityMod.Projectiles.Enemy Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int i = 0; i < 10; i++) { - int earthyDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 8, 0f, 0f, 100, default, 1.2f); + int earthyDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Iron, 0f, 0f, 100, default, 1.2f); Main.dust[earthyDust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -47,10 +47,10 @@ namespace CalamityMod.Projectiles.Enemy } for (int j = 0; j < 20; j++) { - int earthyDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 1, 0f, 0f, 100, default, 1.7f); + int earthyDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Stone, 0f, 0f, 100, default, 1.7f); Main.dust[earthyDust2].noGravity = true; Main.dust[earthyDust2].velocity *= 5f; - earthyDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 8, 0f, 0f, 100, default, 1f); + earthyDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Iron, 0f, 0f, 100, default, 1f); Main.dust[earthyDust2].velocity *= 2f; } diff --git a/Projectiles/Enemy/FlakAcid.cs b/Projectiles/Enemy/FlakAcid.cs index af856067b2..f51e4bc8d5 100644 --- a/Projectiles/Enemy/FlakAcid.cs +++ b/Projectiles/Enemy/FlakAcid.cs @@ -1,7 +1,7 @@ -using CalamityMod.Buffs.StatDebuffs; +using System; +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -61,14 +61,14 @@ namespace CalamityMod.Projectiles.Enemy Projectile.Damage(); for (int i = 0; i <= 40; i++) { - int idx = Dust.NewDust(Projectile.position, 200, 200, (int)CalamityDusts.SulfurousSeaAcid, 0, 0, 0, default, 0.75f); + int idx = Dust.NewDust(Projectile.position, 200, 200, (int)CalamityDusts.SulphurousSeaAcid, 0, 0, 0, default, 0.75f); Main.dust[idx].noGravity = true; Main.dust[idx].velocity = Vector2.One.RotatedByRandom(MathHelper.TwoPi) * (Main.dust[idx].position - Projectile.Center).Length() / 30f; Main.dust[idx].scale = 2.5f; } for (int i = 0; i <= 90; i++) { - int idx = Dust.NewDust(Projectile.Center, 0, 0, (int)CalamityDusts.SulfurousSeaAcid); + int idx = Dust.NewDust(Projectile.Center, 0, 0, (int)CalamityDusts.SulphurousSeaAcid); Main.dust[idx].velocity = Vector2.One.RotatedByRandom(MathHelper.TwoPi) * 8f; Main.dust[idx].scale = 3f; Main.dust[idx].noGravity = true; diff --git a/Projectiles/Enemy/FlameBurstHostile.cs b/Projectiles/Enemy/FlameBurstHostile.cs index 330565f9d5..64a1315e15 100644 --- a/Projectiles/Enemy/FlameBurstHostile.cs +++ b/Projectiles/Enemy/FlameBurstHostile.cs @@ -1,9 +1,9 @@ using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Enemy { public class FlameBurstHostile : ModProjectile, ILocalizedModType @@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Enemy { if (count == 0f) { - SoundEngine.PlaySound(SoundID.Item73, Projectile.position); + SoundEngine.PlaySound(SoundID.Item73, Projectile.Center); Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); Projectile.width = 20; @@ -36,7 +36,7 @@ namespace CalamityMod.Projectiles.Enemy Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int i = 0; i < 10; i++) { - int flameDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); + int flameDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 100, default, 2f); Main.dust[flameDust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -46,10 +46,10 @@ namespace CalamityMod.Projectiles.Enemy } for (int j = 0; j < 20; j++) { - int sparkDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 246, 0f, 0f, 100, default, 3f); + int sparkDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GoldCoin, 0f, 0f, 100, default, 3f); Main.dust[sparkDust].noGravity = true; Main.dust[sparkDust].velocity *= 5f; - sparkDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 246, 0f, 0f, 100, default, 2f); + sparkDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GoldCoin, 0f, 0f, 100, default, 2f); Main.dust[sparkDust].velocity *= 2f; } count += 1f; @@ -59,7 +59,7 @@ namespace CalamityMod.Projectiles.Enemy { for (int k = 0; k < 5; k++) { - int sparky = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 246, 0f, 0f, 100, default, 0.75f); + int sparky = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GoldCoin, 0f, 0f, 100, default, 0.75f); Main.dust[sparky].velocity *= 0f; } } @@ -96,7 +96,7 @@ namespace CalamityMod.Projectiles.Enemy { for (int k = 0; k < 5; k++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 246, Projectile.oldVelocity.X * 0f, Projectile.oldVelocity.Y * 0f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.GoldCoin, Projectile.oldVelocity.X * 0f, Projectile.oldVelocity.Y * 0f); } } } diff --git a/Projectiles/Enemy/GammRayBurst.cs b/Projectiles/Enemy/GammRayBurst.cs index ca00fcc4c4..0c8edea13a 100644 --- a/Projectiles/Enemy/GammRayBurst.cs +++ b/Projectiles/Enemy/GammRayBurst.cs @@ -1,13 +1,13 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using System.IO; +using System.Linq; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Graphics.Primitives; using CalamityMod.NPCs.AcidRain; using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; -using System; -using System.IO; -using System.Linq; using Terraria; using Terraria.Graphics.Shaders; using Terraria.ID; @@ -30,7 +30,7 @@ namespace CalamityMod.Projectiles.Enemy public override float Lifetime => 300; public override Color LaserOverlayColor => new Color(0, 200, 50, 100); public override Color LightCastColor => Color.White; - public override Texture2D LaserBeginTexture => ModContent.Request(Texture).Value; + public override Texture2D LaserBeginTexture => Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; public override Texture2D LaserMiddleTexture => ModContent.Request("CalamityMod/ExtraTextures/Lasers/AresLaserBeamMiddle", AssetRequestMode.ImmediateLoad).Value; public override Texture2D LaserEndTexture => ModContent.Request("CalamityMod/ExtraTextures/Lasers/AresLaserBeamEnd", AssetRequestMode.ImmediateLoad).Value; public override string Texture => "CalamityMod/Projectiles/Boss/AresLaserBeamStart"; diff --git a/Projectiles/Enemy/GammaAcid.cs b/Projectiles/Enemy/GammaAcid.cs index f0a45fdd35..f917bb3e8e 100644 --- a/Projectiles/Enemy/GammaAcid.cs +++ b/Projectiles/Enemy/GammaAcid.cs @@ -48,14 +48,14 @@ namespace CalamityMod.Projectiles.Enemy Projectile.Damage(); for (int i = 0; i <= 40; i++) { - int idx = Dust.NewDust(Projectile.position, 100, 100, (int)CalamityDusts.SulfurousSeaAcid, 0, 0, 0, default, 0.75f); + int idx = Dust.NewDust(Projectile.position, 100, 100, (int)CalamityDusts.SulphurousSeaAcid, 0, 0, 0, default, 0.75f); Main.dust[idx].noGravity = true; Main.dust[idx].velocity = Vector2.One.RotatedByRandom(MathHelper.TwoPi) * (Main.dust[idx].position - Projectile.Center).Length() / 30f; Main.dust[idx].scale = 2.5f; } for (int i = 0; i <= 90; i++) { - int idx = Dust.NewDust(Projectile.Center, 0, 0, (int)CalamityDusts.SulfurousSeaAcid); + int idx = Dust.NewDust(Projectile.Center, 0, 0, (int)CalamityDusts.SulphurousSeaAcid); Main.dust[idx].velocity = Vector2.One.RotatedByRandom(MathHelper.TwoPi) * 8f; Main.dust[idx].scale = 3f; Main.dust[idx].noGravity = true; diff --git a/Projectiles/Enemy/GammaBeam.cs b/Projectiles/Enemy/GammaBeam.cs index 47a519e3a9..7ff1f7c5e4 100644 --- a/Projectiles/Enemy/GammaBeam.cs +++ b/Projectiles/Enemy/GammaBeam.cs @@ -1,10 +1,10 @@ -using CalamityMod.Buffs.StatDebuffs; +using System; +using System.IO; +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; -using System; -using System.IO; using Terraria; using Terraria.Enums; using Terraria.ModLoader; @@ -112,21 +112,21 @@ namespace CalamityMod.Projectiles.Enemy float theta = Projectile.velocity.ToRotation() + Main.rand.NextBool().ToDirectionInt() * MathHelper.PiOver2; float speed = (float)Main.rand.NextDouble() * 2f + 2f; Vector2 velocity = theta.ToRotationVector2() * speed; - Dust dust = Dust.NewDustDirect(beamEndPosiiton, 0, 0, (int)CalamityDusts.SulfurousSeaAcid, velocity.X, velocity.Y, 0, default, 1f); + Dust dust = Dust.NewDustDirect(beamEndPosiiton, 0, 0, (int)CalamityDusts.SulphurousSeaAcid, velocity.X, velocity.Y, 0, default, 1f); dust.noGravity = true; dust.scale = 2.1f; } for (int i = 0; i < 8; i++) { - Dust dust = Dust.NewDustPerfect(beamEndPosiiton, (int)CalamityDusts.SulfurousSeaAcid); + Dust dust = Dust.NewDustPerfect(beamEndPosiiton, (int)CalamityDusts.SulphurousSeaAcid); dust.velocity = Vector2.UnitY.RotatedByRandom(MathHelper.ToRadians(55f)).RotatedBy(Projectile.rotation); dust.noGravity = true; dust.scale = 1.8f; } for (int i = 0; i < 16; i++) { - Dust dust = Dust.NewDustPerfect(beamEndPosiiton, (int)CalamityDusts.SulfurousSeaAcid); + Dust dust = Dust.NewDustPerfect(beamEndPosiiton, (int)CalamityDusts.SulphurousSeaAcid); dust.velocity = (i / 16f * MathHelper.TwoPi).ToRotationVector2() * 3f; dust.noGravity = true; dust.scale = 2.4f; diff --git a/Projectiles/Enemy/HorsWaterBlast.cs b/Projectiles/Enemy/HorsWaterBlast.cs index 63afd6fa39..ea5ecff51a 100644 --- a/Projectiles/Enemy/HorsWaterBlast.cs +++ b/Projectiles/Enemy/HorsWaterBlast.cs @@ -1,9 +1,9 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Enemy { @@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Enemy { for (int i = 0; i < 20; i++) { - int waterDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 2f); + int waterDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Water, 0f, 0f, 100, default, 2f); Main.dust[waterDust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -37,12 +37,12 @@ namespace CalamityMod.Projectiles.Enemy } } Projectile.ai[1] = 1f; - SoundEngine.PlaySound(SoundID.Item21, Projectile.position); + SoundEngine.PlaySound(SoundID.Item21, Projectile.Center); } Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.35f / 255f); for (int j = 0; j < 10; j++) { - int watery = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 1.2f); + int watery = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Water, 0f, 0f, 100, default, 1.2f); Main.dust[watery].noGravity = true; Main.dust[watery].velocity *= 0.5f; Main.dust[watery].velocity += Projectile.velocity * 0.1f; @@ -51,7 +51,7 @@ namespace CalamityMod.Projectiles.Enemy public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item21, Projectile.position); + SoundEngine.PlaySound(SoundID.Item21, Projectile.Center); for (int dust = 0; dust <= 40; dust++) { float rando1 = (float)Main.rand.Next(-10, 11); @@ -61,7 +61,7 @@ namespace CalamityMod.Projectiles.Enemy randoAdjuster = rando3 / randoAdjuster; rando1 *= randoAdjuster; rando2 *= randoAdjuster; - int killWaterDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 1.2f); + int killWaterDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Water, 0f, 0f, 100, default, 1.2f); Main.dust[killWaterDust].noGravity = true; Main.dust[killWaterDust].position.X = Projectile.Center.X; Main.dust[killWaterDust].position.Y = Projectile.Center.Y; diff --git a/Projectiles/Enemy/IceClasperEnemyProjectile.cs b/Projectiles/Enemy/IceClasperEnemyProjectile.cs index 2c542b9cdb..f9c5b9df8e 100644 --- a/Projectiles/Enemy/IceClasperEnemyProjectile.cs +++ b/Projectiles/Enemy/IceClasperEnemyProjectile.cs @@ -1,8 +1,8 @@ +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using Microsoft.Xna.Framework; namespace CalamityMod.Projectiles.Enemy { @@ -37,7 +37,7 @@ namespace CalamityMod.Projectiles.Enemy Projectile.velocity *= 1.01f; // Trail dust. - int trailDust = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, 172, Projectile.velocity.X, Projectile.velocity.Y, 0, default, 1.5f); + int trailDust = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, DustID.DungeonWater, Projectile.velocity.X, Projectile.velocity.Y, 0, default, 1.5f); Main.dust[trailDust].noGravity = true; } @@ -53,7 +53,7 @@ namespace CalamityMod.Projectiles.Enemy { if (CalamityConfig.Instance.Afterimages) CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor); - + return true; } } diff --git a/Projectiles/Enemy/InkBombHostile.cs b/Projectiles/Enemy/InkBombHostile.cs index 62983c68ea..5a60fec270 100644 --- a/Projectiles/Enemy/InkBombHostile.cs +++ b/Projectiles/Enemy/InkBombHostile.cs @@ -1,10 +1,10 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Enemy { @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Enemy public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Vector2 drawOrigin = new(tex.Width * 0.5f, Projectile.height * 0.5f); Vector2 vector = new Vector2(Projectile.Center.X, Projectile.Center.Y) - Main.screenPosition + new Vector2(0, Projectile.gfxOffY); Rectangle rectangle = new(0, tex.Height / Main.projFrames[Projectile.type] * Projectile.frame, tex.Width, tex.Height / Main.projFrames[Projectile.type]); @@ -53,7 +53,7 @@ namespace CalamityMod.Projectiles.Enemy public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.NPCDeath28, Projectile.position); + SoundEngine.PlaySound(SoundID.NPCDeath28, Projectile.Center); if (Projectile.owner == Main.myPlayer) { int randProjAmt = Main.rand.Next(5, 9); @@ -73,7 +73,7 @@ namespace CalamityMod.Projectiles.Enemy Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int i = 0; i < 10; i++) { - int inkDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 54, 0f, 0f, 100, default, 2f); + int inkDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Wraith, 0f, 0f, 100, default, 2f); Main.dust[inkDust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -83,10 +83,10 @@ namespace CalamityMod.Projectiles.Enemy } for (int j = 0; j < 15; j++) { - int inkDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 109, 0f, 0f, 100, default, 3f); + int inkDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Asphalt, 0f, 0f, 100, default, 3f); Main.dust[inkDust2].noGravity = true; Main.dust[inkDust2].velocity *= 5f; - inkDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 109, 0f, 0f, 100, default, 2f); + inkDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Asphalt, 0f, 0f, 100, default, 2f); Main.dust[inkDust2].velocity *= 2f; } } diff --git a/Projectiles/Enemy/InkPoisonCloud.cs b/Projectiles/Enemy/InkPoisonCloud.cs index cecaa2db8a..d74d2a8f1e 100644 --- a/Projectiles/Enemy/InkPoisonCloud.cs +++ b/Projectiles/Enemy/InkPoisonCloud.cs @@ -1,9 +1,9 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using System; namespace CalamityMod.Projectiles.Enemy { @@ -61,7 +61,7 @@ namespace CalamityMod.Projectiles.Enemy public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; var effects = Projectile.direction == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; Vector2 drawOrigin = new(tex.Width * 0.5f, Projectile.height * 0.5f); Vector2 vector = new Vector2(Projectile.Center.X, Projectile.Center.Y) - Main.screenPosition + new Vector2(0, Projectile.gfxOffY); diff --git a/Projectiles/Enemy/LightningCloud.cs b/Projectiles/Enemy/LightningCloud.cs index fdb42b3997..8d0e6037df 100644 --- a/Projectiles/Enemy/LightningCloud.cs +++ b/Projectiles/Enemy/LightningCloud.cs @@ -1,9 +1,9 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Sounds; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using CalamityMod.Sounds; namespace CalamityMod.Projectiles.Enemy { diff --git a/Projectiles/Enemy/MantisRing.cs b/Projectiles/Enemy/MantisRing.cs index ca3ee4ce56..5daadcdeef 100644 --- a/Projectiles/Enemy/MantisRing.cs +++ b/Projectiles/Enemy/MantisRing.cs @@ -3,9 +3,9 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Enemy { public class MantisRing : ModProjectile, ILocalizedModType diff --git a/Projectiles/Enemy/MaulerAcidBubble.cs b/Projectiles/Enemy/MaulerAcidBubble.cs index 1888f05321..e649011ecf 100644 --- a/Projectiles/Enemy/MaulerAcidBubble.cs +++ b/Projectiles/Enemy/MaulerAcidBubble.cs @@ -2,9 +2,9 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Enemy { @@ -55,7 +55,7 @@ namespace CalamityMod.Projectiles.Enemy public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Rectangle frame = texture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); Vector2 origin = frame.Size() * 0.5f; Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, frame, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0); @@ -72,7 +72,7 @@ namespace CalamityMod.Projectiles.Enemy public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item54, Projectile.position); + SoundEngine.PlaySound(SoundID.Item54, Projectile.Center); } } } diff --git a/Projectiles/Enemy/NuclearBulletLarge.cs b/Projectiles/Enemy/NuclearBulletLarge.cs index d0f9cb2e17..ce64c5b1b6 100644 --- a/Projectiles/Enemy/NuclearBulletLarge.cs +++ b/Projectiles/Enemy/NuclearBulletLarge.cs @@ -1,6 +1,6 @@ -using Microsoft.Xna.Framework; -using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Enemy @@ -34,10 +34,10 @@ namespace CalamityMod.Projectiles.Enemy { for (int i = 0; i <= 2; i++) { - int idx = Dust.NewDust(Projectile.position, 8, 8, (int)CalamityDusts.SulfurousSeaAcid, 0, 0, 0, default, 0.75f); + int idx = Dust.NewDust(Projectile.position, 8, 8, (int)CalamityDusts.SulphurousSeaAcid, 0, 0, 0, default, 0.75f); Main.dust[idx].noGravity = true; Main.dust[idx].velocity *= 3f; - idx = Dust.NewDust(Projectile.position, 8, 8, (int)CalamityDusts.SulfurousSeaAcid, 0, 0, 0, default, 0.75f); + idx = Dust.NewDust(Projectile.position, 8, 8, (int)CalamityDusts.SulphurousSeaAcid, 0, 0, 0, default, 0.75f); Main.dust[idx].noGravity = true; Main.dust[idx].velocity *= 3f; } diff --git a/Projectiles/Enemy/NuclearBulletMedium.cs b/Projectiles/Enemy/NuclearBulletMedium.cs index 3947dbbc14..55a241d174 100644 --- a/Projectiles/Enemy/NuclearBulletMedium.cs +++ b/Projectiles/Enemy/NuclearBulletMedium.cs @@ -1,7 +1,7 @@ -using Microsoft.Xna.Framework; +using System; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; -using System; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Enemy @@ -57,10 +57,10 @@ namespace CalamityMod.Projectiles.Enemy { for (int i = 0; i <= 2; i++) { - int idx = Dust.NewDust(Projectile.position, 8, 8, (int)CalamityDusts.SulfurousSeaAcid, 0, 0, 0, default, 0.75f); + int idx = Dust.NewDust(Projectile.position, 8, 8, (int)CalamityDusts.SulphurousSeaAcid, 0, 0, 0, default, 0.75f); Main.dust[idx].noGravity = true; Main.dust[idx].velocity *= 3f; - idx = Dust.NewDust(Projectile.position, 8, 8, (int)CalamityDusts.SulfurousSeaAcid, 0, 0, 0, default, 0.75f); + idx = Dust.NewDust(Projectile.position, 8, 8, (int)CalamityDusts.SulphurousSeaAcid, 0, 0, 0, default, 0.75f); Main.dust[idx].noGravity = true; Main.dust[idx].velocity *= 3f; } diff --git a/Projectiles/Enemy/NuclearToadGoo.cs b/Projectiles/Enemy/NuclearToadGoo.cs index e8a2574f16..c38799573f 100644 --- a/Projectiles/Enemy/NuclearToadGoo.cs +++ b/Projectiles/Enemy/NuclearToadGoo.cs @@ -43,10 +43,10 @@ namespace CalamityMod.Projectiles.Enemy { for (int i = 0; i <= 4; i++) { - int idx = Dust.NewDust(Projectile.position, 8, 8, (int)CalamityDusts.SulfurousSeaAcid, 0, 0, 0, default, 0.75f); + int idx = Dust.NewDust(Projectile.position, 8, 8, (int)CalamityDusts.SulphurousSeaAcid, 0, 0, 0, default, 0.75f); Main.dust[idx].noGravity = true; Main.dust[idx].velocity *= 3f; - idx = Dust.NewDust(Projectile.position, 8, 8, (int)CalamityDusts.SulfurousSeaAcid, 0, 0, 0, default, 0.75f); + idx = Dust.NewDust(Projectile.position, 8, 8, (int)CalamityDusts.SulphurousSeaAcid, 0, 0, 0, default, 0.75f); Main.dust[idx].noGravity = true; Main.dust[idx].velocity *= 3f; } diff --git a/Projectiles/Enemy/OrthoceraStream.cs b/Projectiles/Enemy/OrthoceraStream.cs index 3c9bc7ba40..724abe7401 100644 --- a/Projectiles/Enemy/OrthoceraStream.cs +++ b/Projectiles/Enemy/OrthoceraStream.cs @@ -1,8 +1,8 @@ -using CalamityMod.Dusts; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; -using CalamityMod.Buffs.StatDebuffs; namespace CalamityMod.Projectiles.Enemy { public class OrthoceraStream : ModProjectile, ILocalizedModType @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.Enemy { Vector2 positionDelta = Projectile.velocity / 3f * i; int spawnDelta = 14; - int dustIdx = Dust.NewDust(new Vector2(Projectile.position.X + spawnDelta, Projectile.position.Y + spawnDelta), Projectile.width - spawnDelta * 2, Projectile.height - spawnDelta * 2, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default, 1f); + int dustIdx = Dust.NewDust(new Vector2(Projectile.position.X + spawnDelta, Projectile.position.Y + spawnDelta), Projectile.width - spawnDelta * 2, Projectile.height - spawnDelta * 2, (int)CalamityDusts.SulphurousSeaAcid, 0f, 0f, 100, default, 1f); Dust dust = Main.dust[dustIdx]; dust.noGravity = true; dust.velocity *= 0.1f; @@ -53,7 +53,7 @@ namespace CalamityMod.Projectiles.Enemy if (Main.rand.NextBool(8)) { int spawnDelta = 16; - int dustIdx = Dust.NewDust(new Vector2(Projectile.position.X + spawnDelta, Projectile.position.Y + spawnDelta), Projectile.width - spawnDelta * 2, Projectile.height - spawnDelta * 2, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default, 0.5f); + int dustIdx = Dust.NewDust(new Vector2(Projectile.position.X + spawnDelta, Projectile.position.Y + spawnDelta), Projectile.width - spawnDelta * 2, Projectile.height - spawnDelta * 2, (int)CalamityDusts.SulphurousSeaAcid, 0f, 0f, 100, default, 0.5f); Main.dust[dustIdx].velocity *= 0.25f; Main.dust[dustIdx].velocity += Projectile.velocity * 0.5f; } diff --git a/Projectiles/Enemy/PearlBurst.cs b/Projectiles/Enemy/PearlBurst.cs index 479090ce09..3e35181991 100644 --- a/Projectiles/Enemy/PearlBurst.cs +++ b/Projectiles/Enemy/PearlBurst.cs @@ -1,7 +1,9 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Enemy { public class PearlBurst : ModProjectile, ILocalizedModType @@ -31,7 +33,7 @@ namespace CalamityMod.Projectiles.Enemy Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0.5f / 255f); if (Main.rand.NextBool(5)) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 92, Projectile.velocity.X * 0.25f, Projectile.velocity.Y * 0.25f, 0, new Color(255, 255, 255), 0.7f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Frost, Projectile.velocity.X * 0.25f, Projectile.velocity.Y * 0.25f, 0, new Color(255, 255, 255), 0.7f); } } Projectile.frameCounter++; @@ -44,7 +46,7 @@ namespace CalamityMod.Projectiles.Enemy { Projectile.frame = 0; } - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) - 1.57f; + Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; Projectile.alpha -= 6; Projectile.ai[1] += 1f; if (Projectile.ai[1] <= 20f) @@ -70,7 +72,7 @@ namespace CalamityMod.Projectiles.Enemy Vector2 dustRotation = Vector2.UnitX * (float)-(float)Projectile.width / 2f; dustRotation += -Vector2.UnitY.RotatedBy((double)((float)l * 3.14159274f / 6f), default) * new Vector2(8f, 16f); dustRotation = dustRotation.RotatedBy((double)(Projectile.rotation - 1.57079637f), default); - int pearlDust = Dust.NewDust(Projectile.Center, 0, 0, 92, 0f, 0f, 160, default, 1f); + int pearlDust = Dust.NewDust(Projectile.Center, 0, 0, DustID.Frost, 0f, 0f, 160, default, 1f); Main.dust[pearlDust].scale = 1.1f; Main.dust[pearlDust].noGravity = true; Main.dust[pearlDust].position = Projectile.Center + dustRotation; diff --git a/Projectiles/Enemy/PearlRain.cs b/Projectiles/Enemy/PearlRain.cs index dcfa776ed1..97435f618b 100644 --- a/Projectiles/Enemy/PearlRain.cs +++ b/Projectiles/Enemy/PearlRain.cs @@ -1,7 +1,9 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Enemy { public class PearlRain : ModProjectile, ILocalizedModType @@ -33,7 +35,7 @@ namespace CalamityMod.Projectiles.Enemy Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0.5f / 255f); if (Main.rand.NextBool(5)) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 92, Projectile.velocity.X * 0.25f, Projectile.velocity.Y * 0.25f, 0, new Color(255, 255, 255), 0.7f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Frost, Projectile.velocity.X * 0.25f, Projectile.velocity.Y * 0.25f, 0, new Color(255, 255, 255), 0.7f); } } Projectile.frameCounter++; @@ -46,7 +48,7 @@ namespace CalamityMod.Projectiles.Enemy { Projectile.frame = 0; } - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) - 1.57f; + Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; Projectile.alpha -= 6; } diff --git a/Projectiles/Enemy/PufferExplosion.cs b/Projectiles/Enemy/PufferExplosion.cs index 0538e7a4b8..dc22fa1f93 100644 --- a/Projectiles/Enemy/PufferExplosion.cs +++ b/Projectiles/Enemy/PufferExplosion.cs @@ -1,10 +1,10 @@ +using System; using CalamityMod.Dusts; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Enemy { public class PufferExplosion : ModProjectile, ILocalizedModType @@ -31,7 +31,7 @@ namespace CalamityMod.Projectiles.Enemy Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.75f / 255f, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0.01f / 255f); if (Projectile.localAI[0] == 0f) { - SoundEngine.PlaySound(SoundID.Item20, Projectile.position); + SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); Projectile.localAI[0] += 1f; } bool xflag = false; @@ -78,7 +78,7 @@ namespace CalamityMod.Projectiles.Enemy randoAdjuster = rando3 / randoAdjuster; rando1 *= randoAdjuster; rando2 *= randoAdjuster; - int explodeBrimStyle = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1.5f); + int explodeBrimStyle = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1.5f); Main.dust[explodeBrimStyle].noGravity = true; Main.dust[explodeBrimStyle].position.X = Projectile.Center.X; Main.dust[explodeBrimStyle].position.Y = Projectile.Center.Y; diff --git a/Projectiles/Enemy/StormMarkHostile.cs b/Projectiles/Enemy/StormMarkHostile.cs index 21b06efcf0..ead43ea48d 100644 --- a/Projectiles/Enemy/StormMarkHostile.cs +++ b/Projectiles/Enemy/StormMarkHostile.cs @@ -1,9 +1,9 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Enemy { public class StormMarkHostile : ModProjectile, ILocalizedModType @@ -44,7 +44,7 @@ namespace CalamityMod.Projectiles.Enemy dustMovement.X *= -1f; Vector2 dustMovement2 = new Vector2(2f, 10f); Vector2 position4 = Projectile.Center + new Vector2(60f, Projectile.ai[0] != 0f ? 800f : 200f) * dustMovement * 0.5f + dustMovement2; - Dust stormy = Main.dust[Dust.NewDust(position4, 0, 0, 16, 0f, 0f, 0, default, 0.5f)]; + Dust stormy = Main.dust[Dust.NewDust(position4, 0, 0, DustID.Cloud, 0f, 0f, 0, default, 0.5f)]; stormy.position = position4; stormy.customData = Projectile.Center + dustMovement2; stormy.fadeIn = 1f; @@ -95,7 +95,7 @@ namespace CalamityMod.Projectiles.Enemy if (Main.rand.NextBool(10)) { Vector2 dustVel = Vector2.UnitY.RotatedBy((double)((float)j * 3.14159274f), default).RotatedBy((double)Projectile.rotation, default); - Dust stormDust = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, 16, 0f, 0f, 225, newColor3, 1f)]; + Dust stormDust = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, DustID.Cloud, 0f, 0f, 225, newColor3, 1f)]; stormDust.noGravity = true; stormDust.noLight = true; stormDust.scale = Projectile.Opacity * Projectile.localAI[0]; @@ -108,7 +108,7 @@ namespace CalamityMod.Projectiles.Enemy if (Main.rand.NextBool(10)) { Vector2 dustVel2 = Vector2.UnitY.RotatedBy((double)((float)k * 3.14159274f), default); - Dust stormDust2 = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, 16, 0f, 0f, 225, newColor3, 1.5f)]; + Dust stormDust2 = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, DustID.Cloud, 0f, 0f, 225, newColor3, 1.5f)]; stormDust2.noGravity = true; stormDust2.noLight = true; stormDust2.scale = Projectile.Opacity * Projectile.localAI[0]; @@ -124,7 +124,7 @@ namespace CalamityMod.Projectiles.Enemy Projectile.localAI[1] += 1f; if (Projectile.localAI[1] == 60f && Projectile.owner == Main.myPlayer) { - int projectileDamage = Projectile.ai[0] != 0f ? (int)Projectile.ai[0] : Main.expertMode ? 25 : 40; + int projectileDamage = Projectile.ai[0] != 0f ? (int)Projectile.ai[0] : Main.masterMode ? 21 : Main.expertMode ? 25 : 40; Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectileDamage, 3f, Projectile.owner, 0f, Projectile.ai[1]); } if (Projectile.localAI[1] >= 120f) @@ -137,7 +137,7 @@ namespace CalamityMod.Projectiles.Enemy { Color originalColor = Lighting.GetColor((int)((double)Projectile.position.X + (double)Projectile.width * 0.5) / 16, (int)(((double)Projectile.position.Y + (double)Projectile.height * 0.5) / 16.0)); Vector2 drawPos = Projectile.position + new Vector2((float)Projectile.width, (float)Projectile.height) / 2f + Vector2.UnitY * Projectile.gfxOffY - Main.screenPosition; - Texture2D texture2D27 = ModContent.Request(Texture).Value; + Texture2D texture2D27 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Rectangle rectangl = texture2D27.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); Color alphaColor = Projectile.GetAlpha(originalColor); Vector2 halfRect = rectangl.Size() / 2f; diff --git a/Projectiles/Enemy/SulphuricAcidBubble.cs b/Projectiles/Enemy/SulphuricAcidBubble.cs index acc97e0f35..3b0544545e 100644 --- a/Projectiles/Enemy/SulphuricAcidBubble.cs +++ b/Projectiles/Enemy/SulphuricAcidBubble.cs @@ -2,9 +2,9 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Enemy { @@ -85,8 +85,8 @@ namespace CalamityMod.Projectiles.Enemy public override bool PreDraw(ref Color lightColor) { - Texture2D texture2D13 = ModContent.Request(Texture).Value; - int framing = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; + Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + int framing = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; int y6 = framing * Projectile.frame; lightColor.R = (byte)(255 * Projectile.Opacity); lightColor.G = (byte)(255 * Projectile.Opacity); @@ -106,7 +106,7 @@ namespace CalamityMod.Projectiles.Enemy public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item54, Projectile.position); + SoundEngine.PlaySound(SoundID.Item54, Projectile.Center); Projectile.position = Projectile.Center; Projectile.width = Projectile.height = 60; @@ -115,7 +115,7 @@ namespace CalamityMod.Projectiles.Enemy for (int i = 0; i < 25; i++) { - int toxicDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 31, 0f, 0f, 0, default, 1f); + int toxicDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Smoke, 0f, 0f, 0, default, 1f); Main.dust[toxicDust].position = (Main.dust[toxicDust].position + Projectile.position) / 2f; Main.dust[toxicDust].velocity = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); Main.dust[toxicDust].velocity.Normalize(); diff --git a/Projectiles/Enemy/SulphuricAcidMist.cs b/Projectiles/Enemy/SulphuricAcidMist.cs index 9c79e3d179..b037e6fabc 100644 --- a/Projectiles/Enemy/SulphuricAcidMist.cs +++ b/Projectiles/Enemy/SulphuricAcidMist.cs @@ -1,10 +1,10 @@ -using CalamityMod.Buffs.StatDebuffs; +using System; +using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Enemy { @@ -44,7 +44,7 @@ namespace CalamityMod.Projectiles.Enemy if (Projectile.ai[1] == 0f) { Projectile.ai[1] = 1f; - SoundEngine.PlaySound(SoundID.Item111, Projectile.position); + SoundEngine.PlaySound(SoundID.Item111, Projectile.Center); } if (Projectile.velocity.X < 0f) @@ -55,7 +55,7 @@ namespace CalamityMod.Projectiles.Enemy else { Projectile.spriteDirection = 1; - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X); + Projectile.rotation = Projectile.velocity.ToRotation(); } if (Projectile.ai[0] >= 480f) diff --git a/Projectiles/Enemy/TornadoHostile.cs b/Projectiles/Enemy/TornadoHostile.cs index 61def509db..ae8c8e1392 100644 --- a/Projectiles/Enemy/TornadoHostile.cs +++ b/Projectiles/Enemy/TornadoHostile.cs @@ -1,9 +1,9 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Enemy { public class TornadoHostile : ModProjectile, ILocalizedModType @@ -32,7 +32,7 @@ namespace CalamityMod.Projectiles.Enemy if (Projectile.soundDelay == 0) { Projectile.soundDelay = -1; - SoundEngine.PlaySound(SoundID.Item122, Projectile.position); + SoundEngine.PlaySound(SoundID.Item122, Projectile.Center); } Projectile.ai[0] += 1f; if (Projectile.ai[0] >= projTimer) @@ -86,7 +86,7 @@ namespace CalamityMod.Projectiles.Enemy dustVelocity.X *= -1f; Vector2 dustCustomData = new Vector2(6f, 10f); Vector2 dustPosition = centering + sizeModPos * dustVelocity * 0.5f + dustCustomData; - Dust cloudDust = Main.dust[Dust.NewDust(dustPosition, 0, 0, 16, 0f, 0f, 0, default, 1.5f)]; + Dust cloudDust = Main.dust[Dust.NewDust(dustPosition, 0, 0, DustID.Cloud, 0f, 0f, 0, default, 1.5f)]; cloudDust.position = dustPosition; cloudDust.customData = centering + dustCustomData; cloudDust.fadeIn = 1f; @@ -126,7 +126,7 @@ namespace CalamityMod.Projectiles.Enemy Vector2 sizeModdingPos = new Vector2(0f, sizeModdingVector2.Y - sizeModdingVector.Y); sizeModdingPos.X = sizeModdingPos.Y * vectorMult; new Vector2(sizeModdingVector.X - sizeModdingPos.X / 2f, sizeModdingVector.Y); - Texture2D texture2D23 = ModContent.Request(Texture).Value; + Texture2D texture2D23 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Rectangle drawRectangle = texture2D23.Frame(1, 1, 0, 0); Vector2 smallRect = drawRectangle.Size() / 2f; float aiTrackMult = -0.06283186f * aiTracker; diff --git a/Projectiles/Enemy/ToxicMinnowCloud.cs b/Projectiles/Enemy/ToxicMinnowCloud.cs index 580ceac880..40254c224a 100644 --- a/Projectiles/Enemy/ToxicMinnowCloud.cs +++ b/Projectiles/Enemy/ToxicMinnowCloud.cs @@ -1,8 +1,8 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using System; namespace CalamityMod.Projectiles.Enemy { @@ -88,7 +88,7 @@ namespace CalamityMod.Projectiles.Enemy { if (info.Damage <= 0) return; - + target.AddBuff(BuffID.Poisoned, 240); } diff --git a/Projectiles/Enemy/TrilobiteSpike.cs b/Projectiles/Enemy/TrilobiteSpike.cs index 208ea707f0..41c3b04919 100644 --- a/Projectiles/Enemy/TrilobiteSpike.cs +++ b/Projectiles/Enemy/TrilobiteSpike.cs @@ -38,10 +38,10 @@ namespace CalamityMod.Projectiles.Enemy { for (int i = 0; i <= 2; i++) { - int idx = Dust.NewDust(Projectile.position, 8, 8, (int)CalamityDusts.SulfurousSeaAcid, 0, 0, 0, default, 0.75f); + int idx = Dust.NewDust(Projectile.position, 8, 8, (int)CalamityDusts.SulphurousSeaAcid, 0, 0, 0, default, 0.75f); Main.dust[idx].noGravity = true; Main.dust[idx].velocity *= 3f; - idx = Dust.NewDust(Projectile.position, 8, 8, (int)CalamityDusts.SulfurousSeaAcid, 0, 0, 0, default, 0.75f); + idx = Dust.NewDust(Projectile.position, 8, 8, (int)CalamityDusts.SulphurousSeaAcid, 0, 0, 0, default, 0.75f); Main.dust[idx].noGravity = true; Main.dust[idx].velocity *= 3f; } diff --git a/Projectiles/Environment/AcidDrop.cs b/Projectiles/Environment/AcidDrop.cs index ceedcbaaec..e027fa1379 100644 --- a/Projectiles/Environment/AcidDrop.cs +++ b/Projectiles/Environment/AcidDrop.cs @@ -1,9 +1,9 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; namespace CalamityMod.Projectiles.Environment { @@ -34,7 +34,7 @@ namespace CalamityMod.Projectiles.Environment // Water drip for (int i = 0; i < 4; i++) { - int idx = Dust.NewDust(Projectile.position - Projectile.velocity, 2, 2, 154, 0f, 0f, 0, new Color(112, 150, 42, 127), 1f); + int idx = Dust.NewDust(Projectile.position - Projectile.velocity, 2, 2, DustID.Rain, 0f, 0f, 0, new Color(112, 150, 42, 127), 1f); Dust dust = Main.dust[idx]; dust.position.X -= 2f; Main.dust[idx].alpha = 38; diff --git a/Projectiles/Environment/BrimstoneGeyser.cs b/Projectiles/Environment/BrimstoneGeyser.cs index 1de3662158..0d99d274b5 100644 --- a/Projectiles/Environment/BrimstoneGeyser.cs +++ b/Projectiles/Environment/BrimstoneGeyser.cs @@ -1,11 +1,11 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Environment { public class BrimstoneGeyser : ModProjectile, ILocalizedModType @@ -33,9 +33,9 @@ namespace CalamityMod.Projectiles.Environment int dustCustomData = isActive == -1 ? 0 : 1; if (Projectile.ai[0] == 0f) { - if (!Collision.SolidCollision(Projectile.position + new Vector2(0f, isActive == -1 ? (float) (Projectile.height - 48) : 0f), Projectile.width, 48) && !Collision.WetCollision(Projectile.position + new Vector2(0f, isActive == -1 ? (float) (Projectile.height - 20) : 0f), Projectile.width, 20)) + if (!Collision.SolidCollision(Projectile.position + new Vector2(0f, isActive == -1 ? (float)(Projectile.height - 48) : 0f), Projectile.width, 48) && !Collision.WetCollision(Projectile.position + new Vector2(0f, isActive == -1 ? (float)(Projectile.height - 20) : 0f), Projectile.width, 20)) { - Projectile.velocity = new Vector2(0f, (float) Math.Sign(Projectile.velocity.Y) * (1f / 1000f)); + Projectile.velocity = new Vector2(0f, (float)Math.Sign(Projectile.velocity.Y) * (1f / 1000f)); Projectile.ai[0] = 1f; Projectile.ai[1] = 0f; Projectile.timeLeft = 60; @@ -51,14 +51,14 @@ namespace CalamityMod.Projectiles.Environment Main.dust[brimDust].scale = 0.1f + Main.rand.Next(5) * 0.1f; Main.dust[brimDust].fadeIn = 1.5f + Main.rand.Next(5) * 0.1f; Main.dust[brimDust].noGravity = true; - Main.dust[brimDust].position = Projectile.Center + new Vector2(0f, (float) (-Projectile.height / 2)).RotatedBy((double)Projectile.rotation, new Vector2()) * 1.1f; + Main.dust[brimDust].position = Projectile.Center + new Vector2(0f, (float)(-Projectile.height / 2)).RotatedBy((double)Projectile.rotation, new Vector2()) * 1.1f; } } if (Projectile.ai[0] != 1f) return; - Projectile.velocity = new Vector2(0f, (float) Math.Sign(Projectile.velocity.Y) * (1f / 1000f)); + Projectile.velocity = new Vector2(0f, (float)Math.Sign(Projectile.velocity.Y) * (1f / 1000f)); if (isActive != 0) { @@ -86,34 +86,34 @@ namespace CalamityMod.Projectiles.Environment Projectile.localAI[0] = 1f; for (int i = 0; i < 60; ++i) { - int brimDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, -2.5f * (float) -isActive, 0, new Color(), 1f); + int brimDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, -2.5f * (float)-isActive, 0, new Color(), 1f); Dust dust = Main.dust[brimDust]; dust.alpha = 200; dust.velocity *= new Vector2(0.3f, 2f); dust.velocity.Y += (float)(2 * isActive); dust.scale += Main.rand.NextFloat(); - dust.position = new Vector2(Projectile.Center.X, Projectile.Center.Y + (float) Projectile.height * 0.5f * (float) -isActive); - dust.customData = (object) dustCustomData; - if (isActive == -1 && Main.rand.Next(4) != 0) + dust.position = new Vector2(Projectile.Center.X, Projectile.Center.Y + (float)Projectile.height * 0.5f * (float)-isActive); + dust.customData = (object)dustCustomData; + if (isActive == -1 && !Main.rand.NextBool(4)) { dust.velocity.Y -= 0.2f; } } - SoundEngine.PlaySound(SoundID.Item34, Projectile.position); + SoundEngine.PlaySound(SoundID.Item34, Projectile.Center); } if (isActive == 1) { for (int i = 0; i < 9; ++i) { - int brimDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, -2.5f * (float) -isActive, 0, new Color(), 1f); + int brimDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, -2.5f * (float)-isActive, 0, new Color(), 1f); Dust dust = Main.dust[brimDust]; dust.alpha = 200; dust.velocity *= new Vector2(0.3f, 2f); dust.velocity.Y += (float)(2 * isActive); dust.scale += Main.rand.NextFloat(); - dust.position = new Vector2(Projectile.Center.X, Projectile.Center.Y + (float) Projectile.height * 0.5f * (float) -isActive); + dust.position = new Vector2(Projectile.Center.X, Projectile.Center.Y + (float)Projectile.height * 0.5f * (float)-isActive); dust.customData = (object)dustCustomData; - if (isActive == -1 && Main.rand.Next(4) != 0) + if (isActive == -1 && !Main.rand.NextBool(4)) { Main.dust[brimDust].velocity.Y -= 0.2f; } @@ -122,8 +122,8 @@ namespace CalamityMod.Projectiles.Environment int Height = (int)(Projectile.ai[1] / 60f * (float)Projectile.height) * 3; if (Height > Projectile.height) Height = Projectile.height; - Vector2 Position = Projectile.position + (isActive == -1 ? new Vector2(0f, (float) (Projectile.height - Height)) : Vector2.Zero); - Vector2 vector2 = Projectile.position + (isActive == -1 ? new Vector2(0f, (float) Projectile.height) : Vector2.Zero); + Vector2 Position = Projectile.position + (isActive == -1 ? new Vector2(0f, (float)(Projectile.height - Height)) : Vector2.Zero); + Vector2 vector2 = Projectile.position + (isActive == -1 ? new Vector2(0f, (float)Projectile.height) : Vector2.Zero); for (int i = 0; i < 6; ++i) { if (Main.rand.Next(3) < 2) @@ -157,12 +157,12 @@ namespace CalamityMod.Projectiles.Environment { if (Main.rand.NextFloat() >= 0.5f) { - int brimDust = Dust.NewDust(Position, Projectile.width, Height, dustType, 0f, -2.5f * (float) -isActive, 0, new Color(), 1f); + int brimDust = Dust.NewDust(Position, Projectile.width, Height, dustType, 0f, -2.5f * (float)-isActive, 0, new Color(), 1f); Dust dust = Main.dust[brimDust]; dust.alpha = 200; dust.velocity *= new Vector2(0.6f, 1.5f); dust.scale += Main.rand.NextFloat(); - if (isActive == -1 && Main.rand.Next(4) != 0) + if (isActive == -1 && !Main.rand.NextBool(4)) { dust.velocity.Y -= 0.2f; } diff --git a/Projectiles/Environment/HotSteam.cs b/Projectiles/Environment/HotSteam.cs index 4c11cc1128..861ef86c45 100644 --- a/Projectiles/Environment/HotSteam.cs +++ b/Projectiles/Environment/HotSteam.cs @@ -36,8 +36,8 @@ namespace CalamityMod.Projectiles.Environment public override void AI() { Projectile.localAI[0] = 0f; - Projectile.scale = Utils.Remap((Projectile.timeLeft+Lifetime), 180, 0.4f, 0.02f, 1.4f); - Projectile.Opacity = Utils.Remap((Projectile.timeLeft+Lifetime), 160f, 50f, 1.15f, 0.01f); + Projectile.scale = Utils.Remap((Projectile.timeLeft + Lifetime), 180, 0.4f, 0.02f, 1.4f); + Projectile.Opacity = Utils.Remap((Projectile.timeLeft + Lifetime), 160f, 50f, 1.15f, 0.01f); Projectile.velocity.Y *= 0.97f; } @@ -61,7 +61,7 @@ namespace CalamityMod.Projectiles.Environment if (Projectile.localAI[0] == 1f) return; - Texture2D texture = TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Vector2 origin = texture.Size() * 0.5f; Vector2 drawPosition = Projectile.Center - Main.screenPosition; float opacity = Projectile.Opacity * 0.45f; diff --git a/Projectiles/Environment/LavaChunk.cs b/Projectiles/Environment/LavaChunk.cs index 95ee91bc2d..6bf6a55c07 100644 --- a/Projectiles/Environment/LavaChunk.cs +++ b/Projectiles/Environment/LavaChunk.cs @@ -1,7 +1,9 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Environment { public class LavaChunk : ModProjectile, ILocalizedModType @@ -53,11 +55,11 @@ namespace CalamityMod.Projectiles.Environment { dustYOffset = Projectile.velocity.Y * 0.5f; } - int lavaDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y + 3f + dustYOffset) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 6, 0f, 0f, 100, default, Projectile.scale); + int lavaDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y + 3f + dustYOffset) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, DustID.Torch, 0f, 0f, 100, default, Projectile.scale); Main.dust[lavaDust].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; Main.dust[lavaDust].velocity *= 0.2f; Main.dust[lavaDust].noGravity = true; - lavaDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y + 3f + dustYOffset) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 31, 0f, 0f, 100, default, Projectile.scale * 0.5f); + lavaDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y + 3f + dustYOffset) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, DustID.Smoke, 0f, 0f, 100, default, Projectile.scale * 0.5f); Main.dust[lavaDust].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; Main.dust[lavaDust].velocity *= 0.05f; } @@ -85,8 +87,8 @@ namespace CalamityMod.Projectiles.Environment public override bool PreDraw(ref Color lightColor) { - Texture2D texture2D13 = ModContent.Request(Texture).Value; - int framing = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; + Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + int framing = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; int y6 = framing * Projectile.frame; Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)framing / 2f), Projectile.scale, SpriteEffects.None, 0); return false; diff --git a/Projectiles/Environment/MurkySteam.cs b/Projectiles/Environment/MurkySteam.cs index a48fb93067..27dd0b7e11 100644 --- a/Projectiles/Environment/MurkySteam.cs +++ b/Projectiles/Environment/MurkySteam.cs @@ -36,8 +36,8 @@ namespace CalamityMod.Projectiles.Environment public override void AI() { Projectile.localAI[0] = 0f; - Projectile.scale = Utils.Remap((Projectile.timeLeft+Lifetime), 180, 0.4f, 0.02f, 1.4f); - Projectile.Opacity = Utils.Remap((Projectile.timeLeft+Lifetime), 160f, 50f, 1.15f, 0.01f); + Projectile.scale = Utils.Remap((Projectile.timeLeft + Lifetime), 180, 0.4f, 0.02f, 1.4f); + Projectile.Opacity = Utils.Remap((Projectile.timeLeft + Lifetime), 160f, 50f, 1.15f, 0.01f); Projectile.velocity.Y *= 0.97f; } @@ -61,7 +61,7 @@ namespace CalamityMod.Projectiles.Environment if (Projectile.localAI[0] == 1f) return; - Texture2D texture = TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Vector2 origin = texture.Size() * 0.5f; Vector2 drawPosition = Projectile.Center - Main.screenPosition; float opacity = Projectile.Opacity * 0.45f; diff --git a/Projectiles/Environment/SmokeTelegraph.cs b/Projectiles/Environment/SmokeTelegraph.cs index 9d214531f1..7677fcc2f3 100644 --- a/Projectiles/Environment/SmokeTelegraph.cs +++ b/Projectiles/Environment/SmokeTelegraph.cs @@ -1,9 +1,9 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Environment { public class SmokeTelegraph : ModProjectile, ILocalizedModType @@ -31,9 +31,9 @@ namespace CalamityMod.Projectiles.Environment int dustCustomData = isActive == -1 ? 0 : 1; if (Projectile.ai[0] == 0f) { - if (!Collision.SolidCollision(Projectile.position + new Vector2(0f, isActive == -1 ? (float) (Projectile.height - 48) : 0f), Projectile.width, 48) && !Collision.WetCollision(Projectile.position + new Vector2(0f, isActive == -1 ? (float) (Projectile.height - 20) : 0f), Projectile.width, 20)) + if (!Collision.SolidCollision(Projectile.position + new Vector2(0f, isActive == -1 ? (float)(Projectile.height - 48) : 0f), Projectile.width, 48) && !Collision.WetCollision(Projectile.position + new Vector2(0f, isActive == -1 ? (float)(Projectile.height - 20) : 0f), Projectile.width, 20)) { - Projectile.velocity = new Vector2(0f, (float) Math.Sign(Projectile.velocity.Y) * (1f / 1000f)); + Projectile.velocity = new Vector2(0f, (float)Math.Sign(Projectile.velocity.Y) * (1f / 1000f)); Projectile.ai[0] = 1f; Projectile.ai[1] = 0f; Projectile.timeLeft = 60; @@ -49,14 +49,14 @@ namespace CalamityMod.Projectiles.Environment Main.dust[smoky].scale = 0.1f + Main.rand.Next(5) * 0.1f; Main.dust[smoky].fadeIn = 1.5f + Main.rand.Next(5) * 0.1f; Main.dust[smoky].noGravity = true; - Main.dust[smoky].position = Projectile.Center + new Vector2(0f, (float) (-Projectile.height / 2)).RotatedBy((double)Projectile.rotation, new Vector2()) * 1.1f; + Main.dust[smoky].position = Projectile.Center + new Vector2(0f, (float)(-Projectile.height / 2)).RotatedBy((double)Projectile.rotation, new Vector2()) * 1.1f; } } if (Projectile.ai[0] != 1f) return; - Projectile.velocity = new Vector2(0f, (float) Math.Sign(Projectile.velocity.Y) * (1f / 1000f)); + Projectile.velocity = new Vector2(0f, (float)Math.Sign(Projectile.velocity.Y) * (1f / 1000f)); if (isActive != 0) { @@ -84,34 +84,34 @@ namespace CalamityMod.Projectiles.Environment Projectile.localAI[0] = 1f; for (int i = 0; i < 60; ++i) { - int smoky = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, -2.5f * (float) -isActive, 0, new Color(), 1f); + int smoky = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, -2.5f * (float)-isActive, 0, new Color(), 1f); Dust dust = Main.dust[smoky]; dust.alpha = 200; dust.velocity *= new Vector2(0.3f, 2f); dust.velocity.Y += (float)(2 * isActive); dust.scale += Main.rand.NextFloat(); - dust.position = new Vector2(Projectile.Center.X, Projectile.Center.Y + (float) Projectile.height * 0.5f * (float) -isActive); - dust.customData = (object) dustCustomData; - if (isActive == -1 && Main.rand.Next(4) != 0) + dust.position = new Vector2(Projectile.Center.X, Projectile.Center.Y + (float)Projectile.height * 0.5f * (float)-isActive); + dust.customData = (object)dustCustomData; + if (isActive == -1 && !Main.rand.NextBool(4)) { dust.velocity.Y -= 0.2f; } } - SoundEngine.PlaySound(SoundID.Item34, Projectile.position); + SoundEngine.PlaySound(SoundID.Item34, Projectile.Center); } if (isActive == 1) { for (int i = 0; i < 9; ++i) { - int smoky = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, -2.5f * (float) -isActive, 0, new Color(), 1f); + int smoky = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, -2.5f * (float)-isActive, 0, new Color(), 1f); Dust dust = Main.dust[smoky]; dust.alpha = 200; dust.velocity *= new Vector2(0.3f, 2f); dust.velocity.Y += (float)(2 * isActive); dust.scale += Main.rand.NextFloat(); - dust.position = new Vector2(Projectile.Center.X, Projectile.Center.Y + (float) Projectile.height * 0.5f * (float) -isActive); + dust.position = new Vector2(Projectile.Center.X, Projectile.Center.Y + (float)Projectile.height * 0.5f * (float)-isActive); dust.customData = (object)dustCustomData; - if (isActive == -1 && Main.rand.Next(4) != 0) + if (isActive == -1 && !Main.rand.NextBool(4)) { Main.dust[smoky].velocity.Y -= 0.2f; } @@ -120,8 +120,8 @@ namespace CalamityMod.Projectiles.Environment int Height = (int)(Projectile.ai[1] / 60f * (float)Projectile.height) * 3; if (Height > Projectile.height) Height = Projectile.height; - Vector2 Position = Projectile.position + (isActive == -1 ? new Vector2(0f, (float) (Projectile.height - Height)) : Vector2.Zero); - Vector2 vector2 = Projectile.position + (isActive == -1 ? new Vector2(0f, (float) Projectile.height) : Vector2.Zero); + Vector2 Position = Projectile.position + (isActive == -1 ? new Vector2(0f, (float)(Projectile.height - Height)) : Vector2.Zero); + Vector2 vector2 = Projectile.position + (isActive == -1 ? new Vector2(0f, (float)Projectile.height) : Vector2.Zero); for (int i = 0; i < 6; ++i) { if (Main.rand.Next(3) < 2) @@ -155,12 +155,12 @@ namespace CalamityMod.Projectiles.Environment { if (Main.rand.NextFloat() >= 0.5f) { - int smoky = Dust.NewDust(Position, Projectile.width, Height, dustType, 0f, -2.5f * (float) -isActive, 0, new Color(), 1f); + int smoky = Dust.NewDust(Position, Projectile.width, Height, dustType, 0f, -2.5f * (float)-isActive, 0, new Color(), 1f); Dust dust = Main.dust[smoky]; dust.alpha = 200; dust.velocity *= new Vector2(0.6f, 1.5f); dust.scale += Main.rand.NextFloat(); - if (isActive == -1 && Main.rand.Next(4) != 0) + if (isActive == -1 && !Main.rand.NextBool(4)) { dust.velocity.Y -= 0.2f; } diff --git a/Projectiles/Environment/ThermalSteam.cs b/Projectiles/Environment/ThermalSteam.cs index c214352ecb..cff4ecee12 100644 --- a/Projectiles/Environment/ThermalSteam.cs +++ b/Projectiles/Environment/ThermalSteam.cs @@ -36,8 +36,8 @@ namespace CalamityMod.Projectiles.Environment public override void AI() { Projectile.localAI[0] = 0f; - Projectile.scale = Utils.Remap((Projectile.timeLeft+Lifetime), 180, 0.4f, 0.02f, 1.4f); - Projectile.Opacity = Utils.Remap((Projectile.timeLeft+Lifetime), 160f, 50f, 1.15f, 0.01f); + Projectile.scale = Utils.Remap((Projectile.timeLeft + Lifetime), 180, 0.4f, 0.02f, 1.4f); + Projectile.Opacity = Utils.Remap((Projectile.timeLeft + Lifetime), 160f, 50f, 1.15f, 0.01f); Projectile.velocity.Y *= 0.97f; } @@ -61,7 +61,7 @@ namespace CalamityMod.Projectiles.Environment if (Projectile.localAI[0] == 1f) return; - Texture2D texture = TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Vector2 origin = texture.Size() * 0.5f; Vector2 drawPosition = Projectile.Center - Main.screenPosition; float opacity = Projectile.Opacity * 0.45f; diff --git a/Projectiles/Healing/AbsorberAura.cs b/Projectiles/Healing/AbsorberAura.cs index 0d682a3905..383d84cc4f 100644 --- a/Projectiles/Healing/AbsorberAura.cs +++ b/Projectiles/Healing/AbsorberAura.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatBuffs; using CalamityMod.Buffs.StatDebuffs; @@ -10,7 +11,6 @@ using Terraria; using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using System.Collections.Generic; namespace CalamityMod.Projectiles.Healing { diff --git a/Projectiles/Healing/AltTransfusionTrail.cs b/Projectiles/Healing/AltTransfusionTrail.cs new file mode 100644 index 0000000000..cb362dbc53 --- /dev/null +++ b/Projectiles/Healing/AltTransfusionTrail.cs @@ -0,0 +1,67 @@ +using Microsoft.CodeAnalysis; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Particles; + +namespace CalamityMod.Projectiles.Healing +{ + public class AltTransfusionTrail : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Healing"; + + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public int time = 0; + public float opacity = 0.3f; + + public override void SetDefaults() + { + Projectile.width = 4; + Projectile.height = 4; + Projectile.penetrate = 1; + Projectile.timeLeft = 600; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.extraUpdates = 5; + } + + public override void AI() + { + Projectile.HealingProjectile((int)Projectile.ai[1], (int)Projectile.ai[0], 15f, MathHelper.Clamp(80f - time, 5, 80)); + if (time == 1) + { + bool direction = Main.rand.NextBool(); + Projectile.velocity = (Projectile.velocity * 10).RotatedBy(direction ? Main.rand.NextFloat(0.6f, 1.8f) : Main.rand.NextFloat(-0.6f, -1.8f)) * 2f; + } + + SparkParticle orb = new SparkParticle(Projectile.Center, -Projectile.velocity * Main.rand.NextFloat(0.05f, 0.1f), false, 5, 0.6f, Color.White * opacity); + GeneralParticleHandler.SpawnParticle(orb); + if (Main.rand.NextBool(3)) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(5) ? 63 : 91, -Projectile.velocity * Main.rand.NextFloat(0.05f, 0.25f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.75f, 0.9f); + dust.alpha = 100; + dust.noLight = true; + } + + if (Projectile.timeLeft < 300) + { + Projectile.extraUpdates = 12; + if (opacity > 0) + opacity -= 0.01f; + } + time++; + } + public override void OnKill(int timeLeft) + { + Player Owner = Main.player[Projectile.owner]; + for (int i = 0; i < 2; ++i) + { + Particle Plus = new HealingPlus(Owner.Center - new Vector2(Main.rand.Next(-4, 24 + 1), 2), Main.rand.NextFloat(0.2f, 0.5f), new Vector2(0, Main.rand.NextFloat(-2f, -4.5f)) + Owner.velocity, Color.SlateGray * 0.75f, Color.White * 0.75f, Main.rand.Next(15, 20)); + GeneralParticleHandler.SpawnParticle(Plus); + } + } + } +} diff --git a/Projectiles/Healing/BlueJellyAura.cs b/Projectiles/Healing/BlueJellyAura.cs index 5f9a35526e..0d34658e28 100644 --- a/Projectiles/Healing/BlueJellyAura.cs +++ b/Projectiles/Healing/BlueJellyAura.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatBuffs; using CalamityMod.Buffs.StatDebuffs; @@ -10,7 +11,6 @@ using Terraria; using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using System.Collections.Generic; namespace CalamityMod.Projectiles.Healing { @@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Healing public static readonly SoundStyle Spawnsound = new("CalamityMod/Sounds/Custom/OrbHeal1") { Volume = 0.5f }; public ref int CleansingEffect => ref Main.player[Projectile.owner].Calamity().CleansingEffect; public List cleanseList = new List(new bool[Main.maxPlayers]); - + public override void SetDefaults() { @@ -63,7 +63,7 @@ namespace CalamityMod.Projectiles.Healing } for (int i = 0; i < 55; i++) { - int dust = Dust.NewDust(player.Center, player.width + 4, player.height + 4, 187, player.velocity.X * 0.2f, player.velocity.Y * 0.2f, 100, default, 5.5f); + int dust = Dust.NewDust(player.Center, player.width + 4, player.height + 4, DustID.Flare_Blue, player.velocity.X * 0.2f, player.velocity.Y * 0.2f, 100, default, 5.5f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 1.2f; Main.dust[dust].velocity.Y -= 0.5f; diff --git a/Projectiles/Healing/BurntSiennaProj.cs b/Projectiles/Healing/BurntSiennaProj.cs index 4782b456b1..76a4347133 100644 --- a/Projectiles/Healing/BurntSiennaProj.cs +++ b/Projectiles/Healing/BurntSiennaProj.cs @@ -1,6 +1,8 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Healing { public class BurntSiennaProj : ModProjectile, ILocalizedModType @@ -17,7 +19,7 @@ namespace CalamityMod.Projectiles.Healing Projectile.alpha = 255; Projectile.penetrate = 1; Projectile.timeLeft = 180; - Projectile.tileCollide = false; + Projectile.tileCollide = false; } public override void AI() @@ -25,7 +27,7 @@ namespace CalamityMod.Projectiles.Healing Projectile.velocity *= 0.95f; Projectile.HealingProjectile(3, (int)Projectile.ai[0], 6f, 15f, false); - int dusty = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 246, 0f, 0f, 100, default, 1f); + int dusty = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GoldCoin, 0f, 0f, 100, default, 1f); Dust dust = Main.dust[dusty]; dust.noGravity = true; dust.position.X -= Projectile.velocity.X * 0.2f; diff --git a/Projectiles/Healing/CactusHealOrb.cs b/Projectiles/Healing/CactusHealOrb.cs index 43a7d027b1..23f54b162e 100644 --- a/Projectiles/Healing/CactusHealOrb.cs +++ b/Projectiles/Healing/CactusHealOrb.cs @@ -1,6 +1,8 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Healing { public class CactusHealOrb : ModProjectile, ILocalizedModType @@ -17,7 +19,7 @@ namespace CalamityMod.Projectiles.Healing Projectile.alpha = 255; Projectile.penetrate = 1; Projectile.timeLeft = 180; - Projectile.tileCollide = false; + Projectile.tileCollide = false; } public override void AI() @@ -25,7 +27,7 @@ namespace CalamityMod.Projectiles.Healing Projectile.velocity.Y *= 0.98f; Projectile.HealingProjectile(15, Projectile.owner, 12f, 15f, false); - int dusty = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, new Color(0, 200, 0), 1.5f); + int dusty = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.TerraBlade, 0f, 0f, 100, new Color(0, 200, 0), 1.5f); Dust dust = Main.dust[dusty]; dust.noGravity = true; dust.position.X -= Projectile.velocity.X * 0.2f; diff --git a/Projectiles/Healing/DemonHeal.cs b/Projectiles/Healing/DemonHeal.cs index d49332ad35..550e365b49 100644 --- a/Projectiles/Healing/DemonHeal.cs +++ b/Projectiles/Healing/DemonHeal.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Projectiles.Healing Projectile.friendly = true; Projectile.penetrate = 1; Projectile.timeLeft = 640; - Projectile.tileCollide = false; + Projectile.tileCollide = false; } public override void AI() diff --git a/Projectiles/Healing/EarthHealOrb.cs b/Projectiles/Healing/EarthHealOrb.cs index 3dfb70c4b6..a16880d89a 100644 --- a/Projectiles/Healing/EarthHealOrb.cs +++ b/Projectiles/Healing/EarthHealOrb.cs @@ -1,11 +1,14 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Healing { public class EarthHealOrb : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Healing"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; public override void SetDefaults() @@ -22,11 +25,11 @@ namespace CalamityMod.Projectiles.Healing public override void AI() { Projectile.HealingProjectile((int)Projectile.ai[1], (int)Projectile.ai[0], 8f, 15f); - int dusty = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 74, 0f, 0f, 100, default, 1f); - Dust dust = Main.dust[dusty]; - dust.noGravity = true; - dust.position.X -= Projectile.velocity.X * 0.2f; - dust.position.Y += Projectile.velocity.Y * 0.2f; + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GreenFairy, 0f, 0f, 100); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0f; + Main.dust[dust].position.X -= Projectile.velocity.X * 0.2f; + Main.dust[dust].position.Y += Projectile.velocity.Y * 0.2f; } } } diff --git a/Projectiles/Healing/EmpyreanHealOrb.cs b/Projectiles/Healing/EmpyreanHealOrb.cs index 7b46370a34..f876e0cf8a 100644 --- a/Projectiles/Healing/EmpyreanHealOrb.cs +++ b/Projectiles/Healing/EmpyreanHealOrb.cs @@ -1,35 +1,33 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Healing { public class EmpyreanHealOrb : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Healing"; + public override void SetDefaults() { - Projectile.width = 4; - Projectile.height = 4; + Projectile.width = 12; + Projectile.height = 12; Projectile.friendly = true; Projectile.penetrate = 1; Projectile.tileCollide = false; - Projectile.timeLeft = 240; + Projectile.timeLeft = 300; Projectile.extraUpdates = 3; } public override void AI() { - Projectile.HealingProjectile((int)Projectile.ai[1], (int)Projectile.ai[0], 5.5f, 15f); - float dustX = Projectile.velocity.X * 0.2f; - float dustY = -(Projectile.velocity.Y * 0.2f); - if (Projectile.timeLeft % 2 == 0) - { - int healDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 62, 0f, 0f, 100, default, 2f); - Dust dust = Main.dust[healDust]; - dust.noGravity = true; - dust.position.X -= dustX; - dust.position.Y -= dustY; - } + Projectile.HealingProjectile((int)Projectile.ai[1], (int)Projectile.ai[0], 6f, 15f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.PurpleTorch, 0f, 0f, 100); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0f; + Main.dust[dust].position.X -= Projectile.velocity.X * 0.2f; + Main.dust[dust].position.Y += Projectile.velocity.Y * 0.2f; } } } diff --git a/Projectiles/Healing/EssenceFlame.cs b/Projectiles/Healing/EssenceFlame.cs index c5877a25e2..2b07b2e939 100644 --- a/Projectiles/Healing/EssenceFlame.cs +++ b/Projectiles/Healing/EssenceFlame.cs @@ -1,8 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Healing { public class EssenceFlame : ModProjectile, ILocalizedModType @@ -45,7 +45,7 @@ namespace CalamityMod.Projectiles.Healing public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item74, Projectile.position); + SoundEngine.PlaySound(SoundID.Item74, Projectile.Center); Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); Projectile.width = 50; @@ -54,7 +54,7 @@ namespace CalamityMod.Projectiles.Healing Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int i = 0; i < 10; i++) { - int godSlay = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 2f); + int godSlay = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, 0f, 0f, 100, default, 2f); Main.dust[godSlay].velocity *= 3f; if (Main.rand.NextBool()) { @@ -64,10 +64,10 @@ namespace CalamityMod.Projectiles.Healing } for (int j = 0; j < 15; j++) { - int godSlay2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 3f); + int godSlay2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, 0f, 0f, 100, default, 3f); Main.dust[godSlay2].noGravity = true; Main.dust[godSlay2].velocity *= 5f; - godSlay2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 2f); + godSlay2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, 0f, 0f, 100, default, 2f); Main.dust[godSlay2].velocity *= 2f; } } diff --git a/Projectiles/Healing/Exoheal.cs b/Projectiles/Healing/Exoheal.cs index 78005e87ca..5df6ba4dd6 100644 --- a/Projectiles/Healing/Exoheal.cs +++ b/Projectiles/Healing/Exoheal.cs @@ -1,11 +1,14 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Healing { public class Exoheal : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Healing"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; public override void SetDefaults() @@ -22,11 +25,11 @@ namespace CalamityMod.Projectiles.Healing public override void AI() { Projectile.HealingProjectile((int)Projectile.ai[1], (int)Projectile.ai[0], 8f, 15f); - int dusty = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1f); - Dust dust = Main.dust[dusty]; - dust.noGravity = true; - dust.position.X -= Projectile.velocity.X * 0.2f; - dust.position.Y += Projectile.velocity.Y * 0.2f; + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.TerraBlade, 0f, 0f, 100, new Color(0, 255, 255)); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0f; + Main.dust[dust].position.X -= Projectile.velocity.X * 0.2f; + Main.dust[dust].position.Y += Projectile.velocity.Y * 0.2f; } } } diff --git a/Projectiles/Healing/FungalHeal.cs b/Projectiles/Healing/FungalHeal.cs index 8f13ec8042..1dcb6e2a4f 100644 --- a/Projectiles/Healing/FungalHeal.cs +++ b/Projectiles/Healing/FungalHeal.cs @@ -1,39 +1,34 @@ using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Healing { public class FungalHeal : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Healing"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; public override void SetDefaults() { - Projectile.width = 6; - Projectile.height = 6; - Projectile.alpha = 255; + Projectile.width = 4; + Projectile.height = 4; + Projectile.penetrate = 1; + Projectile.friendly = true; Projectile.tileCollide = false; - Projectile.extraUpdates = 10; - Projectile.timeLeft = 600; + Projectile.extraUpdates = 3; + Projectile.timeLeft = 300; } public override void AI() { - Projectile.HealingProjectile((int)Projectile.ai[1], (int)Projectile.ai[0], 5f, 15f); - float dustX = Projectile.velocity.X * 0.334f; - float dustY = -(Projectile.velocity.Y * 0.334f); - int fungi = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 56, 0f, 0f, 100, default, 0.5f); - Dust dust = Main.dust[fungi]; - dust.noGravity = true; - dust.position.X -= dustX; - dust.position.Y -= dustY; - float dustX2 = Projectile.velocity.X * 0.2f; - float dustY2 = -(Projectile.velocity.Y * 0.2f); - int fungi2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 56, 0f, 0f, 100, default, 0.7f); - Dust dust2 = Main.dust[fungi2]; - dust2.noGravity = true; - dust2.position.X -= dustX2; - dust2.position.Y -= dustY2; + Projectile.HealingProjectile((int)Projectile.ai[1], (int)Projectile.ai[0], 3f, 15f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.BlueFairy, 0f, 0f, 100); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0f; + Main.dust[dust].position.X -= Projectile.velocity.X * 0.2f; + Main.dust[dust].position.Y += Projectile.velocity.Y * 0.2f; } } } diff --git a/Projectiles/Healing/GladiatorHealOrb.cs b/Projectiles/Healing/GladiatorHealOrb.cs index be4616ac77..1fc627f2a4 100644 --- a/Projectiles/Healing/GladiatorHealOrb.cs +++ b/Projectiles/Healing/GladiatorHealOrb.cs @@ -1,9 +1,10 @@ -using Microsoft.Xna.Framework; +using System; +using CalamityMod.Balancing; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; -using Terraria.ID; using Terraria.Audio; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Healing @@ -11,8 +12,11 @@ namespace CalamityMod.Projectiles.Healing public class GladiatorHealOrb : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Healing"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public int target = -1; + public override void SetStaticDefaults() { ProjectileID.Sets.TrailingMode[Projectile.type] = 0; @@ -28,7 +32,7 @@ namespace CalamityMod.Projectiles.Healing Projectile.alpha = 255; Projectile.penetrate = 1; Projectile.timeLeft = 4800; - Projectile.tileCollide = false; + Projectile.tileCollide = false; Projectile.extraUpdates = 3; } @@ -52,6 +56,7 @@ namespace CalamityMod.Projectiles.Healing } else HealHome(); } + public void PassiveBehavior() { float maxYVelocity = 2f; @@ -61,6 +66,7 @@ namespace CalamityMod.Projectiles.Healing Projectile.velocity.Y += 0.02f; if (Projectile.velocity.Y > maxYVelocity) { Projectile.velocity.Y = maxYVelocity; } } + public void HealHome() { Player player = Main.player[target]; @@ -69,20 +75,22 @@ namespace CalamityMod.Projectiles.Healing float playerDist = playerVector.Length(); if (playerDist < 50f && Projectile.position.X < player.position.X + player.width && Projectile.position.X + Projectile.width > player.position.X && Projectile.position.Y < player.position.Y + player.height && Projectile.position.Y + Projectile.height > player.position.Y) { - int healAmt = 10; - player.HealEffect(healAmt, false); - player.statLife += healAmt; + int heal = 10; + player.HealEffect(heal, false); + player.statLife += heal; if (player.statLife > player.statLifeMax2) - { player.statLife = player.statLifeMax2; - } + SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/OrbHeal", 5) { Volume = 0.15f }, Projectile.Center); - NetMessage.SendData(MessageID.SpiritHeal, -1, -1, null, target, healAmt, 0f, 0f, 0, 0, 0); + + NetMessage.SendData(MessageID.SpiritHeal, -1, -1, null, target, heal, 0f, 0f, 0, 0, 0); + Projectile.Kill(); } Projectile.velocity = (playerVector.SafeNormalize(Vector2.UnitY) * 3.5f) + (player.velocity / 4); } + public override bool PreDraw(ref Color lightColor) { Texture2D lightTexture = ModContent.Request("CalamityMod/ExtraTextures/SmallGreyscaleCircle").Value; diff --git a/Projectiles/Healing/GodSlayerHealOrb.cs b/Projectiles/Healing/GodSlayerHealOrb.cs index 2f8c1331df..bd309f1cf4 100644 --- a/Projectiles/Healing/GodSlayerHealOrb.cs +++ b/Projectiles/Healing/GodSlayerHealOrb.cs @@ -1,6 +1,8 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Healing { public class GodSlayerHealOrb : ModProjectile, ILocalizedModType @@ -22,7 +24,7 @@ namespace CalamityMod.Projectiles.Healing public override void AI() { Projectile.HealingProjectile((int)Projectile.ai[1], (int)Projectile.ai[0], 6.5f, 15f); - int dusty = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 2f); + int dusty = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, 0f, 0f, 100, default, 2f); Dust dust = Main.dust[dusty]; dust.noGravity = true; dust.position.X -= Projectile.velocity.X * 0.2f; diff --git a/Projectiles/Healing/GreenJellyAura.cs b/Projectiles/Healing/GreenJellyAura.cs index 4a8c181709..8621e6f659 100644 --- a/Projectiles/Healing/GreenJellyAura.cs +++ b/Projectiles/Healing/GreenJellyAura.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatBuffs; using CalamityMod.Buffs.StatDebuffs; @@ -10,7 +11,6 @@ using Terraria; using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using System.Collections.Generic; namespace CalamityMod.Projectiles.Healing { @@ -65,7 +65,7 @@ namespace CalamityMod.Projectiles.Healing } for (int i = 0; i < 55; i++) { - int dust = Dust.NewDust(player.Center, player.width + 4, player.height + 4, 298, player.velocity.X * 0.2f, player.velocity.Y * 0.2f, 100, default, 5.5f); + int dust = Dust.NewDust(player.Center, player.width + 4, player.height + 4, DustID.JungleTorch, player.velocity.X * 0.2f, player.velocity.Y * 0.2f, 100, default, 5.5f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 1.5f; Main.dust[dust].velocity.Y -= 0.5f; diff --git a/Projectiles/Healing/HydrothermicHealOrb.cs b/Projectiles/Healing/HydrothermicHealOrb.cs index e4b68a9846..e1df042f9f 100644 --- a/Projectiles/Healing/HydrothermicHealOrb.cs +++ b/Projectiles/Healing/HydrothermicHealOrb.cs @@ -1,11 +1,14 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Healing { public class HydrothermicHealOrb : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Healing"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; public override void SetDefaults() @@ -15,18 +18,18 @@ namespace CalamityMod.Projectiles.Healing Projectile.friendly = true; Projectile.penetrate = 1; Projectile.tileCollide = false; - Projectile.timeLeft = 240; + Projectile.timeLeft = 300; Projectile.extraUpdates = 3; } public override void AI() { - Projectile.HealingProjectile((int)Projectile.ai[1], (int)Projectile.ai[0], 5.5f, 15f); - int dusty = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 127, 0f, 0f, 100, default, 2f); - Dust dust = Main.dust[dusty]; - dust.noGravity = true; - dust.position.X -= Projectile.velocity.X * 0.2f; - dust.position.Y += Projectile.velocity.Y * 0.2f; + Projectile.HealingProjectile((int)Projectile.ai[1], (int)Projectile.ai[0], 5f, 15f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Flare, 0f, 0f, 100); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0f; + Main.dust[dust].position.X -= Projectile.velocity.X * 0.2f; + Main.dust[dust].position.Y += Projectile.velocity.Y * 0.2f; } } } diff --git a/Projectiles/Healing/IridescentExcaliburHeal.cs b/Projectiles/Healing/IridescentExcaliburHeal.cs new file mode 100644 index 0000000000..c71e6050d7 --- /dev/null +++ b/Projectiles/Healing/IridescentExcaliburHeal.cs @@ -0,0 +1,56 @@ +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Healing +{ + public class IridescentExcaliburHeal : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Healing"; + + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override void SetDefaults() + { + Projectile.width = 4; + Projectile.height = 4; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 300; + Projectile.tileCollide = false; + Projectile.extraUpdates = 3; + } + + public override void AI() + { + Projectile.HealingProjectile((int)Projectile.ai[1], (int)Projectile.ai[0], 10f, 15f); + + Color dustColor = Color.White; + switch (Main.rand.Next(3)) + { + default: + case 0: + dustColor = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB); + break; + + case 1: + dustColor = new Color(255 - Main.DiscoR, 255 - Main.DiscoG, 255 - Main.DiscoB); + break; + + case 2: + dustColor = new Color(Math.Abs(128 - Main.DiscoR) * 2 - 1, Math.Abs(128 - Main.DiscoG) * 2 - 1, Math.Abs(128 - Main.DiscoB) * 2 - 1); + break; + } + + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 278, 0f, 0f, 100); + Main.dust[dust].color = dustColor; + Main.dust[dust].fadeIn = 0.4f + Main.rand.NextFloat() * 0.15f; + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0f; + Main.dust[dust].position.X -= Projectile.velocity.X * 0.2f; + Main.dust[dust].position.Y += Projectile.velocity.Y * 0.2f; + } + } +} diff --git a/Projectiles/Healing/ManaPolarizerHealOrb.cs b/Projectiles/Healing/ManaPolarizerHealOrb.cs index 65c28adc5c..373c1b9518 100644 --- a/Projectiles/Healing/ManaPolarizerHealOrb.cs +++ b/Projectiles/Healing/ManaPolarizerHealOrb.cs @@ -1,11 +1,14 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Healing { public class ManaPolarizerHealOrb : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Healing"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; public override void SetDefaults() @@ -15,18 +18,18 @@ namespace CalamityMod.Projectiles.Healing Projectile.friendly = true; Projectile.penetrate = 1; Projectile.tileCollide = false; - Projectile.timeLeft = 180; + Projectile.timeLeft = 300; Projectile.extraUpdates = 3; } public override void AI() { Projectile.HealingProjectile((int)Projectile.ai[1], (int)Projectile.ai[0], 3f, 15f); - int dusty = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 175, 0f, 0f, 100, default, 1.3f); - Dust dust = Main.dust[dusty]; - dust.noGravity = true; - dust.position.X -= Projectile.velocity.X * 0.2f; - dust.position.Y += Projectile.velocity.Y * 0.2f; + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.SpectreStaff, 0f, 0f, 100); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0f; + Main.dust[dust].position.X -= Projectile.velocity.X * 0.2f; + Main.dust[dust].position.Y += Projectile.velocity.Y * 0.2f; } } } diff --git a/Projectiles/Healing/PhantomicHeart.cs b/Projectiles/Healing/PhantomicHeart.cs index 10a6e444a6..ad93a844e0 100644 --- a/Projectiles/Healing/PhantomicHeart.cs +++ b/Projectiles/Healing/PhantomicHeart.cs @@ -1,6 +1,6 @@ -using CalamityMod.CalPlayer; +using System.IO; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; -using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -57,7 +57,7 @@ namespace CalamityMod.Projectiles.Healing for (int i = 0; i < 3; i++) { - Dust.NewDust(Projectile.TopLeft, Projectile.width, Projectile.height, 5, Main.rand.NextFloat(-3, 3), -5f, 0, new Color(99, 54, 84), Main.rand.NextFloat(0.5f, 1.5f)); + Dust.NewDust(Projectile.TopLeft, Projectile.width, Projectile.height, DustID.Blood, Main.rand.NextFloat(-3, 3), -5f, 0, new Color(99, 54, 84), Main.rand.NextFloat(0.5f, 1.5f)); } Player player = Main.player[Projectile.owner]; diff --git a/Projectiles/Healing/PinkJellyAura.cs b/Projectiles/Healing/PinkJellyAura.cs index 25212adfce..709e391de8 100644 --- a/Projectiles/Healing/PinkJellyAura.cs +++ b/Projectiles/Healing/PinkJellyAura.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Projectiles.Healing public override void AI() { Framecounter++; - + for (int playerIndex = 0; playerIndex < Main.maxPlayers; playerIndex++) { Player player = Main.player[playerIndex]; diff --git a/Projectiles/Healing/RainHeal.cs b/Projectiles/Healing/RainHeal.cs index b9b3902bb3..4b72eba2a6 100644 --- a/Projectiles/Healing/RainHeal.cs +++ b/Projectiles/Healing/RainHeal.cs @@ -1,42 +1,50 @@ +using CalamityMod.Items.Weapons.Melee; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Healing { public class RainHeal : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Healing"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + private const int TimeLeft = 300; + + private const int HomingTime = TimeLeft - 120; + + private const int SlowDownTime = TimeLeft - 150; + public override void SetDefaults() { Projectile.width = 4; Projectile.height = 4; Projectile.friendly = true; Projectile.ignoreWater = true; - Projectile.alpha = 255; Projectile.penetrate = 1; - Projectile.timeLeft = 180; - Projectile.tileCollide = false; + Projectile.timeLeft = TimeLeft; + Projectile.tileCollide = false; + Projectile.extraUpdates = 3; } public override void AI() { - if (Projectile.timeLeft < 165) + if (Projectile.timeLeft < HomingTime) { - if (Projectile.timeLeft > 150) + if (Projectile.timeLeft > SlowDownTime) Projectile.velocity *= 0.9f; else - Projectile.HealingProjectile(8, Projectile.owner, 12f, 15f, false); + Projectile.HealingProjectile(GrandGuardian.HealPerOrb, Projectile.owner, 12f, 15f); } - float dustX = Projectile.velocity.X * 0.2f; - float dustY = -(Projectile.velocity.Y * 0.2f); - int rainbow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); - Dust dust = Main.dust[rainbow]; - dust.noGravity = true; - dust.position.X -= dustX; - dust.position.Y -= dustY; + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RainbowTorch, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB)); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0f; + Main.dust[dust].position.X -= Projectile.velocity.X * 0.2f; + Main.dust[dust].position.Y += Projectile.velocity.Y * 0.2f; } } } diff --git a/Projectiles/Healing/ReaverHealOrb.cs b/Projectiles/Healing/ReaverHealOrb.cs index 29df783d68..23d5fb22c0 100644 --- a/Projectiles/Healing/ReaverHealOrb.cs +++ b/Projectiles/Healing/ReaverHealOrb.cs @@ -1,12 +1,16 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Healing { public class ReaverHealOrb : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Healing"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetDefaults() { Projectile.width = 4; @@ -14,18 +18,18 @@ namespace CalamityMod.Projectiles.Healing Projectile.friendly = true; Projectile.penetrate = 1; Projectile.tileCollide = false; - Projectile.timeLeft = 240; + Projectile.timeLeft = 300; Projectile.extraUpdates = 3; } public override void AI() { - Projectile.HealingProjectile((int)Projectile.ai[1], (int)Projectile.ai[0], 5.5f, 15f); - int dusty = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 74, 0f, 0f, 100, default, 2f); - Dust dust = Main.dust[dusty]; - dust.noGravity = true; - dust.position.X -= Projectile.velocity.X * 0.2f; - dust.position.Y += Projectile.velocity.Y * 0.2f; + Projectile.HealingProjectile((int)Projectile.ai[1], (int)Projectile.ai[0], 5f, 15f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GreenFairy, 0f, 0f, 100); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0f; + Main.dust[dust].position.X -= Projectile.velocity.X * 0.2f; + Main.dust[dust].position.Y += Projectile.velocity.Y * 0.2f; } } } diff --git a/Projectiles/Healing/RoyalHeal.cs b/Projectiles/Healing/RoyalHeal.cs index f65c93ec2a..145c21fc49 100644 --- a/Projectiles/Healing/RoyalHeal.cs +++ b/Projectiles/Healing/RoyalHeal.cs @@ -1,45 +1,35 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Healing { public class RoyalHeal : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Healing"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; public override void SetDefaults() { - Projectile.width = 6; - Projectile.height = 6; - Projectile.alpha = 255; + Projectile.width = 4; + Projectile.height = 4; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 300; Projectile.tileCollide = false; - Projectile.extraUpdates = 10; + Projectile.extraUpdates = 3; } public override void AI() { - Projectile.HealingProjectile((int)Projectile.ai[1], (int)Projectile.ai[0], 5.5f, 15f); - for (int i = 0; i < 3; i++) - { - float dustX = Projectile.velocity.X * 0.334f * (float)i; - float dustY = -(Projectile.velocity.Y * 0.334f) * (float)i; - int pureHeal = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 20, 0f, 0f, 100, default, 1.1f); - Dust dust = Main.dust[pureHeal]; - dust.noGravity = true; - dust.position.X -= dustX; - dust.position.Y -= dustY; - } - for (int j = 0; j < 5; j++) - { - float dustX2 = Projectile.velocity.X * 0.2f * (float)j; - float dustY2 = -(Projectile.velocity.Y * 0.2f) * (float)j; - int pureHeal2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 20, 0f, 0f, 100, default, 1.3f); - Dust dust2 = Main.dust[pureHeal2]; - dust2.noGravity = true; - dust2.position.X -= dustX2; - dust2.position.Y -= dustY2; - } + Projectile.HealingProjectile((int)Projectile.ai[1], (int)Projectile.ai[0], 18f, 10f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.PurificationPowder, 0f, 0f, 100); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0f; + Main.dust[dust].position.X -= Projectile.velocity.X * 0.2f; + Main.dust[dust].position.Y += Projectile.velocity.Y * 0.2f; } } } diff --git a/Projectiles/Healing/ShinobiHealOrb.cs b/Projectiles/Healing/ShinobiHealOrb.cs index be3d5edd5e..b7027a962e 100644 --- a/Projectiles/Healing/ShinobiHealOrb.cs +++ b/Projectiles/Healing/ShinobiHealOrb.cs @@ -1,6 +1,8 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Healing { public class ShinobiHealOrb : ModProjectile, ILocalizedModType @@ -25,7 +27,7 @@ namespace CalamityMod.Projectiles.Healing for (int i = 0; i < 3; i++) { - int magicHeal = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 15, 0f, 0f, 100, default, 1.3f); + int magicHeal = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.MagicMirror, 0f, 0f, 100, default, 1.3f); Main.dust[magicHeal].noGravity = true; Main.dust[magicHeal].velocity *= 0f; } diff --git a/Projectiles/Healing/SilvaOrb.cs b/Projectiles/Healing/SilvaOrb.cs index a78c26ef64..1d12d7230d 100644 --- a/Projectiles/Healing/SilvaOrb.cs +++ b/Projectiles/Healing/SilvaOrb.cs @@ -1,11 +1,14 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Healing { public class SilvaOrb : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Healing"; + public override void SetDefaults() { Projectile.width = 22; @@ -15,7 +18,7 @@ namespace CalamityMod.Projectiles.Healing Projectile.penetrate = 1; Projectile.timeLeft = 300; Projectile.extraUpdates = 3; - Projectile.tileCollide = false; + Projectile.tileCollide = false; } public override void AI() @@ -25,36 +28,28 @@ namespace CalamityMod.Projectiles.Healing { Projectile.scale += 0.05f; if (Projectile.scale > 1.2f) - { Projectile.localAI[0] = 1f; - } } else { Projectile.scale -= 0.05f; if (Projectile.scale < 0.8f) - { Projectile.localAI[0] = 0f; - } } Projectile.HealingProjectile((int)Projectile.ai[1], (int)Projectile.ai[0], 6f, 15f); return; } - public override Color? GetAlpha(Color lightColor) - { - return new Color(Main.DiscoR, 203, 103, Projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) => new Color(Main.DiscoR, 203, 103, Projectile.alpha); public override void OnKill(int timeLeft) { for (int i = 0; i < 5; i++) { - int silvaHeal = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 157, 0f, 0f, 0, new Color(Main.DiscoR, 203, 103), 1f); + int silvaHeal = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.ChlorophyteWeapon, 0f, 0f, 0, new Color(Main.DiscoR, 203, 103), 1.5f); Main.dust[silvaHeal].noGravity = true; - Main.dust[silvaHeal].velocity *= 1.5f; - Main.dust[silvaHeal].scale = 1.5f; + Main.dust[silvaHeal].velocity *= 0f; } } } diff --git a/Projectiles/Healing/TransfusionTrail.cs b/Projectiles/Healing/TransfusionTrail.cs index 74a3c75371..55d1326d47 100644 --- a/Projectiles/Healing/TransfusionTrail.cs +++ b/Projectiles/Healing/TransfusionTrail.cs @@ -1,42 +1,35 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Healing { public class TransfusionTrail : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Healing"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; public override void SetDefaults() { - Projectile.width = 6; - Projectile.height = 6; - Projectile.alpha = 255; + Projectile.width = 4; + Projectile.height = 4; + Projectile.penetrate = 1; + Projectile.timeLeft = 300; + Projectile.friendly = true; Projectile.tileCollide = false; - Projectile.extraUpdates = 10; + Projectile.extraUpdates = 3; } public override void AI() { - Projectile.HealingProjectile((int)Projectile.ai[1], (int)Projectile.ai[0], 6.5f, 15f); - float dustX = Projectile.velocity.X * 0.334f; - float dustY = -(Projectile.velocity.Y * 0.334f); - int healRed = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 183, 0f, 0f, 100, default, 0.7f); - Dust dust = Main.dust[healRed]; - dust.noGravity = true; - dust.position.X -= dustX; - dust.position.Y -= dustY; - for (int i = 0; i < 2; i++) - { - float dustyX = Projectile.velocity.X * 0.2f * (float)i; - float dustyY = -(Projectile.velocity.Y * 0.2f) * (float)i; - int healRedMore = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 183, 0f, 0f, 100, default, 0.9f); - Dust dust2 = Main.dust[healRedMore]; - dust2.noGravity = true; - dust2.position.X -= dustyX; - dust2.position.Y -= dustyY; - } + Projectile.HealingProjectile((int)Projectile.ai[1], (int)Projectile.ai[0], 5f, 15f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.VampireHeal, 0f, 0f, 100); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0f; + Main.dust[dust].position.X -= Projectile.velocity.X * 0.2f; + Main.dust[dust].position.Y += Projectile.velocity.Y * 0.2f; } } } diff --git a/Projectiles/Magic/AbyssBall.cs b/Projectiles/Magic/AbyssBall.cs index be7d0bb39e..7b1c806410 100644 --- a/Projectiles/Magic/AbyssBall.cs +++ b/Projectiles/Magic/AbyssBall.cs @@ -1,8 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; -using Terraria.ModLoader; -using Terraria.ID; using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { @@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Magic { Projectile.velocity.X *= 0.985f; Projectile.velocity.Y *= 0.985f; - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 173, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } public override void OnKill(int timeLeft) @@ -44,7 +44,7 @@ namespace CalamityMod.Projectiles.Magic SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); for (int i = 0; i < 30; i++) { - int abyssal = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 1.2f); + int abyssal = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, 0f, 0f, 100, default, 1.2f); Main.dust[abyssal].velocity *= 3f; if (Main.rand.NextBool()) { @@ -54,10 +54,10 @@ namespace CalamityMod.Projectiles.Magic } for (int j = 0; j < 60; j++) { - int abyssal2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 1.7f); + int abyssal2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, 0f, 0f, 100, default, 1.7f); Main.dust[abyssal2].noGravity = true; Main.dust[abyssal2].velocity *= 5f; - abyssal2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 1f); + abyssal2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, 0f, 0f, 100, default, 1f); Main.dust[abyssal2].velocity *= 2f; } } diff --git a/Projectiles/Magic/AcidGunStream.cs b/Projectiles/Magic/AcidGunStream.cs index 5ebffcd0cb..14d510b68c 100644 --- a/Projectiles/Magic/AcidGunStream.cs +++ b/Projectiles/Magic/AcidGunStream.cs @@ -1,4 +1,4 @@ -using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Terraria; @@ -20,6 +20,8 @@ namespace CalamityMod.Projectiles.Magic Projectile.penetrate = 3; Projectile.extraUpdates = 2; Projectile.tileCollide = false; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() @@ -43,7 +45,7 @@ namespace CalamityMod.Projectiles.Magic { Vector2 positionDelta = Projectile.velocity / 3f * i; int spawnDelta = 14; - int dustIdx = Dust.NewDust(new Vector2(Projectile.position.X + spawnDelta, Projectile.position.Y + spawnDelta), Projectile.width - spawnDelta * 2, Projectile.height - spawnDelta * 2, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default, 1f); + int dustIdx = Dust.NewDust(new Vector2(Projectile.position.X + spawnDelta, Projectile.position.Y + spawnDelta), Projectile.width - spawnDelta * 2, Projectile.height - spawnDelta * 2, (int)CalamityDusts.SulphurousSeaAcid, 0f, 0f, 100, default, 1f); Dust dust = Main.dust[dustIdx]; dust.noGravity = true; dust.velocity *= 0.1f; @@ -53,7 +55,7 @@ namespace CalamityMod.Projectiles.Magic if (Main.rand.NextBool(8)) { int spawnDelta = 16; - int dustIdx = Dust.NewDust(new Vector2(Projectile.position.X + spawnDelta, Projectile.position.Y + spawnDelta), Projectile.width - spawnDelta * 2, Projectile.height - spawnDelta * 2, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default, 0.5f); + int dustIdx = Dust.NewDust(new Vector2(Projectile.position.X + spawnDelta, Projectile.position.Y + spawnDelta), Projectile.width - spawnDelta * 2, Projectile.height - spawnDelta * 2, (int)CalamityDusts.SulphurousSeaAcid, 0f, 0f, 100, default, 0.5f); Main.dust[dustIdx].velocity *= 0.25f; Main.dust[dustIdx].velocity += Projectile.velocity * 0.5f; } diff --git a/Projectiles/Magic/AcidicReed.cs b/Projectiles/Magic/AcidicReed.cs index 1e4d0fb3f1..709530df1f 100644 --- a/Projectiles/Magic/AcidicReed.cs +++ b/Projectiles/Magic/AcidicReed.cs @@ -1,8 +1,8 @@ using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; using Terraria; -using Terraria.ModLoader; using Terraria.Audio; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { public class AcidicReed : ModProjectile, ILocalizedModType @@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Magic { if (Projectile.ai[0] == 1f) { - SoundEngine.PlaySound(SaxSound, Projectile.position); + SoundEngine.PlaySound(SaxSound, Projectile.Center); Projectile.ai[0] = 0f; } if (Projectile.velocity.Y < 10f) @@ -49,10 +49,10 @@ namespace CalamityMod.Projectiles.Magic { for (int i = 0; i <= 2; i++) { - int idx = Dust.NewDust(Projectile.position, 8, 8, (int)CalamityDusts.SulfurousSeaAcid, 0, 0, 0, default, 0.75f); + int idx = Dust.NewDust(Projectile.position, 8, 8, (int)CalamityDusts.SulphurousSeaAcid, 0, 0, 0, default, 0.75f); Main.dust[idx].noGravity = true; Main.dust[idx].velocity *= 3f; - idx = Dust.NewDust(Projectile.position, 8, 8, (int)CalamityDusts.SulfurousSeaAcid, 0, 0, 0, default, 0.75f); + idx = Dust.NewDust(Projectile.position, 8, 8, (int)CalamityDusts.SulphurousSeaAcid, 0, 0, 0, default, 0.75f); Main.dust[idx].noGravity = true; Main.dust[idx].velocity *= 3f; } diff --git a/Projectiles/Magic/AcidicSaxBubble.cs b/Projectiles/Magic/AcidicSaxBubble.cs index bbe7b4eae8..8173932661 100644 --- a/Projectiles/Magic/AcidicSaxBubble.cs +++ b/Projectiles/Magic/AcidicSaxBubble.cs @@ -1,5 +1,5 @@ -using CalamityMod.Dusts; -using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Dusts; using CalamityMod.Items.Weapons.Magic; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -127,8 +127,8 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { - Texture2D texture2D13 = ModContent.Request(Texture).Value; - int framing = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; + Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + int framing = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; int y6 = framing * Projectile.frame; Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)framing / 2f), Projectile.scale, SpriteEffects.None, 0); return false; @@ -137,11 +137,15 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(ModContent.BuffType(), 180); + if (Projectile.ai[2] == 1f) // For GFB Animosity + target.AddBuff(BuffID.Poisoned, 180); } public override void OnHitPlayer(Player target, Player.HurtInfo info) { target.AddBuff(ModContent.BuffType(), 180); + if (Projectile.ai[2] == 1f) // For GFB Animosity + target.AddBuff(BuffID.Poisoned, 180); } public override void OnKill(int timeLeft) @@ -154,7 +158,7 @@ namespace CalamityMod.Projectiles.Magic int inc; for (int i = 0; i < 25; i = inc + 1) { - int toxicDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 0, default, 1f); + int toxicDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.SulphurousSeaAcid, 0f, 0f, 0, default, 1f); Main.dust[toxicDust].position = (Main.dust[toxicDust].position + Projectile.position) / 2f; Main.dust[toxicDust].velocity = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); Main.dust[toxicDust].velocity.Normalize(); diff --git a/Projectiles/Magic/AcidicSaxMist.cs b/Projectiles/Magic/AcidicSaxMist.cs index d5a33f7f51..4ff3e96349 100644 --- a/Projectiles/Magic/AcidicSaxMist.cs +++ b/Projectiles/Magic/AcidicSaxMist.cs @@ -1,5 +1,5 @@ +using System; using CalamityMod.Buffs.StatDebuffs; -using System; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -44,7 +44,7 @@ namespace CalamityMod.Projectiles.Magic if (Projectile.ai[1] == 0f) { Projectile.ai[1] = 1f; - SoundEngine.PlaySound(SoundID.Item111, Projectile.position); + SoundEngine.PlaySound(SoundID.Item111, Projectile.Center); } if (Projectile.velocity.X < 0f) { @@ -54,7 +54,7 @@ namespace CalamityMod.Projectiles.Magic else { Projectile.spriteDirection = 1; - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X); + Projectile.rotation = Projectile.velocity.ToRotation(); } Projectile.ai[0] += 1f; if (Projectile.ai[0] >= 90f) diff --git a/Projectiles/Magic/AetherBeam.cs b/Projectiles/Magic/AetherBeam.cs index 803b2676cc..838d3a474e 100644 --- a/Projectiles/Magic/AetherBeam.cs +++ b/Projectiles/Magic/AetherBeam.cs @@ -1,5 +1,5 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Projectiles/Magic/AetherfluxCannonHoldout.cs b/Projectiles/Magic/AetherfluxCannonHoldout.cs index 1b544e3520..94e57a3010 100644 --- a/Projectiles/Magic/AetherfluxCannonHoldout.cs +++ b/Projectiles/Magic/AetherfluxCannonHoldout.cs @@ -14,7 +14,6 @@ namespace CalamityMod.Projectiles.Magic private const int FramesPerFireRateIncrease = 36; private Player Owner => Main.player[Projectile.owner]; - private bool OwnerCanShoot => Owner.channel && Owner.HasAmmo(Owner.ActiveItem()) && !Owner.noItems && !Owner.CCed; private ref float DeployedFrames => ref Projectile.ai[0]; private ref float AnimationRate => ref Projectile.ai[1]; @@ -43,7 +42,7 @@ namespace CalamityMod.Projectiles.Magic Vector2 gunBarrelPos = armPosition + Projectile.velocity * Projectile.height * 0.4f; // If the player is unable to continue using the holdout, delete it. - if (!OwnerCanShoot) + if (Owner.CantUseHoldout() || !Owner.HasAmmo(Owner.ActiveItem())) { Projectile.Kill(); return; @@ -52,7 +51,7 @@ namespace CalamityMod.Projectiles.Magic // Play a sound frame 1. if (DeployedFrames <= 0f) { - SoundEngine.PlaySound(SoundID.DD2_DarkMageCastHeal with { Volume = SoundID.DD2_DarkMageCastHeal.Volume * 1.5f}, Projectile.Center); + SoundEngine.PlaySound(SoundID.DD2_DarkMageCastHeal with { Volume = SoundID.DD2_DarkMageCastHeal.Volume * 1.5f }, Projectile.Center); } // Update damage based on curent magic damage stat (so Mana Sickness affects it) @@ -101,7 +100,7 @@ namespace CalamityMod.Projectiles.Magic // Dust chaotically sheds off the crystal while charging or firing. float dustInaccuracy = 0.045f; - for (int i = -1; i <= 1 ; i += 2) + for (int i = -1; i <= 1; i += 2) { Vector2 laserStartPos = gunBarrelPos + i * perp + Main.rand.NextVector2CircularEdge(6f, 6f); Vector2 dustOnlySpread = Main.rand.NextVector2Circular(shootSpeed, shootSpeed); diff --git a/Projectiles/Magic/AnahitasArpeggioNote.cs b/Projectiles/Magic/AnahitasArpeggioNote.cs index 08a26cdde9..eb160c34f5 100644 --- a/Projectiles/Magic/AnahitasArpeggioNote.cs +++ b/Projectiles/Magic/AnahitasArpeggioNote.cs @@ -1,9 +1,9 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -25,6 +25,8 @@ namespace CalamityMod.Projectiles.Magic Projectile.ignoreWater = true; Projectile.penetrate = 5; Projectile.timeLeft = 420; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 7; } public override void AI() @@ -49,7 +51,7 @@ namespace CalamityMod.Projectiles.Magic { Projectile.ai[1] = 1f; Main.musicPitch = Projectile.ai[0]; - SoundEngine.PlaySound(SoundID.Item26, Projectile.position); + SoundEngine.PlaySound(SoundID.Item26, Projectile.Center); } Lighting.AddLight(Projectile.Center, 0f, 0f, 1.2f); @@ -88,10 +90,6 @@ namespace CalamityMod.Projectiles.Magic return false; } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.immune[Projectile.owner] = 7; - target.AddBuff(BuffID.Confused, 300); - } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.Confused, 300); } } diff --git a/Projectiles/Magic/Ancient.cs b/Projectiles/Magic/Ancient.cs index 29ce6a3375..6ae30cd116 100644 --- a/Projectiles/Magic/Ancient.cs +++ b/Projectiles/Magic/Ancient.cs @@ -1,8 +1,8 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.DataStructures; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -115,7 +115,7 @@ namespace CalamityMod.Projectiles.Magic Vector2 dustPos = dustCircle.RandomPointInCircle(); if ((dustPos - Projectile.Center).Length() > 48) { - int dustIndex = Dust.NewDust(dustPos, 1, 1, 22); + int dustIndex = Dust.NewDust(dustPos, 1, 1, DustID.Pot); Main.dust[dustIndex].noGravity = true; Main.dust[dustIndex].fadeIn = 1f; Vector2 dustVelocity = Projectile.Center - Main.dust[dustIndex].position; diff --git a/Projectiles/Magic/Ancient2.cs b/Projectiles/Magic/Ancient2.cs index b16c9649fc..e9a2a6ef13 100644 --- a/Projectiles/Magic/Ancient2.cs +++ b/Projectiles/Magic/Ancient2.cs @@ -1,10 +1,12 @@ -using CalamityMod.Buffs.StatDebuffs; +using System; +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.DataStructures; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Magic { public class Ancient2 : ModProjectile, ILocalizedModType @@ -89,7 +91,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Vector2 drawPos = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); int height = texture.Height / Main.projFrames[Projectile.type]; int frameHeight = height * Projectile.frame; @@ -106,7 +108,7 @@ namespace CalamityMod.Projectiles.Magic Vector2 dustPos = dustCircle.RandomPointInCircle(); if ((dustPos - Projectile.Center).Length() > 48) { - int dustIndex = Dust.NewDust(dustPos, 1, 1, 22); + int dustIndex = Dust.NewDust(dustPos, 1, 1, DustID.Pot); Main.dust[dustIndex].noGravity = true; Main.dust[dustIndex].fadeIn = 1f; Vector2 dustVelocity = Projectile.Center - Main.dust[dustIndex].position; diff --git a/Projectiles/Magic/ApotheosisEnergy.cs b/Projectiles/Magic/ApotheosisEnergy.cs index 409d2dcbf4..9c286d69a2 100644 --- a/Projectiles/Magic/ApotheosisEnergy.cs +++ b/Projectiles/Magic/ApotheosisEnergy.cs @@ -1,6 +1,6 @@ -using CalamityMod.Graphics.Primitives; +using System; +using CalamityMod.Graphics.Primitives; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -24,6 +24,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.tileCollide = false; Projectile.DamageType = DamageClass.Magic; Projectile.penetrate = -1; + Projectile.extraUpdates = 1; Projectile.timeLeft = 210; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 1; diff --git a/Projectiles/Magic/ApotheosisWorm.cs b/Projectiles/Magic/ApotheosisWorm.cs index d0a4c66798..beb25bb0cd 100644 --- a/Projectiles/Magic/ApotheosisWorm.cs +++ b/Projectiles/Magic/ApotheosisWorm.cs @@ -1,14 +1,14 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using System.IO; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Items.Weapons.DraedonsArsenal; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using CalamityMod.Items.Weapons.DraedonsArsenal; namespace CalamityMod.Projectiles.Magic { @@ -260,9 +260,9 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { - Texture2D headTexture = ModContent.Request(Texture).Value; + Texture2D headTexture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Vector2 drawPosition = Projectile.Center - Main.screenPosition; - Vector2 headTextureOrigin = ModContent.Request(Texture).Value.Size() * 0.5f; + Vector2 headTextureOrigin = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Size() * 0.5f; drawPosition -= headTexture.Size() * Projectile.scale * 0.5f; drawPosition += headTextureOrigin * Projectile.scale + new Vector2(0f, 4f + Projectile.gfxOffY); diff --git a/Projectiles/Magic/AquamarineBolt.cs b/Projectiles/Magic/AquamarineBolt.cs index 2d4c0481b6..84a1716635 100644 --- a/Projectiles/Magic/AquamarineBolt.cs +++ b/Projectiles/Magic/AquamarineBolt.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -26,13 +26,13 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.25f / 255f, (255 - Projectile.alpha) * 0.25f / 255f); - int aquaDust = Dust.NewDust(Projectile.Center, Projectile.width - 28, Projectile.height - 28, 68, 0f, 0f, 100, default, 1.5f); + int aquaDust = Dust.NewDust(Projectile.Center, Projectile.width - 28, Projectile.height - 28, DustID.BlueCrystalShard, 0f, 0f, 100, default, 1.5f); Main.dust[aquaDust].noGravity = true; Main.dust[aquaDust].velocity *= 0.1f; Main.dust[aquaDust].velocity += Projectile.velocity * 0.5f; if (Main.rand.NextBool(16)) { - int aquaticDust = Dust.NewDust(Projectile.Center, Projectile.width - 32, Projectile.height - 32, 68, 0f, 0f, 100, default, 1f); + int aquaticDust = Dust.NewDust(Projectile.Center, Projectile.width - 32, Projectile.height - 32, DustID.BlueCrystalShard, 0f, 0f, 100, default, 1f); Main.dust[aquaticDust].velocity *= 0.25f; Main.dust[aquaticDust].velocity += Projectile.velocity * 0.5f; } diff --git a/Projectiles/Magic/ArcticBearPawProj.cs b/Projectiles/Magic/ArcticBearPawProj.cs index 10f06e83a4..900684983b 100644 --- a/Projectiles/Magic/ArcticBearPawProj.cs +++ b/Projectiles/Magic/ArcticBearPawProj.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { //make pretty dust - int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 88); + int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GemSapphire); Main.dust[index2].noGravity = true; if (Projectile.velocity.X > -0.05f && Projectile.velocity.X < 0.05f & diff --git a/Projectiles/Magic/ArtAttackStar.cs b/Projectiles/Magic/ArtAttackStar.cs index b1b740d1b6..ecbbfc032d 100644 --- a/Projectiles/Magic/ArtAttackStar.cs +++ b/Projectiles/Magic/ArtAttackStar.cs @@ -1,10 +1,10 @@ -using CalamityMod.Graphics.Primitives; +using System; +using System.Collections.Generic; +using System.Linq; +using CalamityMod.Graphics.Primitives; using CalamityMod.Items.Weapons.Magic; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.Collections.Generic; -using System.Linq; using Terraria; using Terraria.Audio; using Terraria.Graphics.Shaders; @@ -16,9 +16,13 @@ namespace CalamityMod.Projectiles.Magic public class ArtAttackStar : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Magic"; + public Player Owner => Main.player[Projectile.owner]; + public ref float Time => ref Projectile.ai[0]; + public const int StarShapeCreationDelay = 12; + public override void SetStaticDefaults() { ProjectileID.Sets.TrailingMode[Projectile.type] = 2; @@ -38,7 +42,6 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - // Die if the holdout is gone. if (Owner.ownedProjectileCounts[ModContent.ProjectileType()] <= 0 && Time >= 2f) { @@ -115,12 +118,10 @@ namespace CalamityMod.Projectiles.Magic public void EmitIdleDust() { - for (int i = 0; i < 3; i++) { Dust rainbowMagic = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(8f, 8f), 261); - rainbowMagic.velocity = Main.rand.NextVector2Circular(6f, 6f) - ((Projectile.position - Projectile.oldPos[1])/3f).RotatedByRandom(0.51f); - + rainbowMagic.velocity = Main.rand.NextVector2Circular(6f, 6f) - ((Projectile.position - Projectile.oldPos[1]) / 3f).RotatedByRandom(0.51f); rainbowMagic.color = Main.hslToRgb(Main.rand.NextFloat(), 1f, Main.rand.NextFloat(0.5f, 0.9f)); rainbowMagic.color.A = 128; rainbowMagic.scale = Main.rand.NextFloat(1.3f, 1.6f); @@ -217,7 +218,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Vector2 drawPosition = Projectile.Center - Main.screenPosition + Vector2.UnitY * Projectile.gfxOffY; Vector2 origin = texture.Size() * 0.5f; diff --git a/Projectiles/Magic/ArtAttackStrike.cs b/Projectiles/Magic/ArtAttackStrike.cs index ce9a236719..8c38c8ff5c 100644 --- a/Projectiles/Magic/ArtAttackStrike.cs +++ b/Projectiles/Magic/ArtAttackStrike.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic diff --git a/Projectiles/Magic/Asteroid.cs b/Projectiles/Magic/Asteroid.cs index 18011bb5ab..c109d2a738 100644 --- a/Projectiles/Magic/Asteroid.cs +++ b/Projectiles/Magic/Asteroid.cs @@ -1,8 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -38,20 +38,20 @@ namespace CalamityMod.Projectiles.Magic Projectile.scale = Projectile.ai[1]; Projectile.rotation += Projectile.velocity.X * 2f; Vector2 position = Projectile.Center + Vector2.Normalize(Projectile.velocity) * 10f; - Dust greenDust = Main.dust[Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 107, 0f, 0f, 0, default, 1f)]; + Dust greenDust = Main.dust[Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.TerraBlade, 0f, 0f, 0, default, 1f)]; greenDust.position = position; greenDust.velocity = Projectile.velocity.RotatedBy(1.5707963705062866, default) * 0.33f + Projectile.velocity / 4f; greenDust.position += Projectile.velocity.RotatedBy(1.5707963705062866, default); greenDust.fadeIn = 0.5f; greenDust.noGravity = true; - greenDust = Main.dust[Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 107, 0f, 0f, 0, default, 1f)]; + greenDust = Main.dust[Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.TerraBlade, 0f, 0f, 0, default, 1f)]; greenDust.position = position; greenDust.velocity = Projectile.velocity.RotatedBy(-1.5707963705062866, default) * 0.33f + Projectile.velocity / 4f; greenDust.position += Projectile.velocity.RotatedBy(-1.5707963705062866, default); greenDust.fadeIn = 0.5f; greenDust.noGravity = true; - int moreGreen = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 0, default, 1f); + int moreGreen = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.TerraBlade, 0f, 0f, 0, default, 1f); Main.dust[moreGreen].velocity *= 0.5f; Main.dust[moreGreen].scale *= 1.3f; Main.dust[moreGreen].fadeIn = 1f; @@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item89, Projectile.position); + SoundEngine.PlaySound(SoundID.Item89, Projectile.Center); Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); Projectile.width = (int)(128f * Projectile.scale); @@ -69,14 +69,14 @@ namespace CalamityMod.Projectiles.Magic Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int i = 0; i < 4; i++) { - Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 31, 0f, 0f, 100, default, 1.5f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Smoke, 0f, 0f, 100, default, 1.5f); } for (int j = 0; j < 16; j++) { - int killDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, default, 2.5f); + int killDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.TerraBlade, 0f, 0f, 100, default, 2.5f); Main.dust[killDust].noGravity = true; Main.dust[killDust].velocity *= 3f; - killDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, default, 1.5f); + killDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.TerraBlade, 0f, 0f, 100, default, 1.5f); Main.dust[killDust].velocity *= 2f; Main.dust[killDust].noGravity = true; } @@ -112,11 +112,6 @@ namespace CalamityMod.Projectiles.Magic } } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.immune[Projectile.owner] = 2; - } - public override bool PreDraw(ref Color lightColor) { CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); diff --git a/Projectiles/Magic/AsteroidMolten.cs b/Projectiles/Magic/AsteroidMolten.cs index 8046e5fdf2..5c16a3b188 100644 --- a/Projectiles/Magic/AsteroidMolten.cs +++ b/Projectiles/Magic/AsteroidMolten.cs @@ -2,9 +2,9 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { public class AsteroidMolten : ModProjectile, ILocalizedModType @@ -39,20 +39,20 @@ namespace CalamityMod.Projectiles.Magic Projectile.scale = Projectile.ai[1]; Projectile.rotation += Projectile.velocity.X * 2f; Vector2 position = Projectile.Center + Vector2.Normalize(Projectile.velocity) * 10f; - Dust flaming = Main.dust[Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 0, new Color(255, Main.DiscoG, 0), 1f)]; + Dust flaming = Main.dust[Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 0, new Color(255, Main.DiscoG, 0), 1f)]; flaming.position = position; flaming.velocity = Projectile.velocity.RotatedBy(1.5707963705062866, default) * 0.33f + Projectile.velocity / 4f; flaming.position += Projectile.velocity.RotatedBy(1.5707963705062866, default); flaming.fadeIn = 0.5f; flaming.noGravity = true; - flaming = Main.dust[Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 0, new Color(255, Main.DiscoG, 0), 1f)]; + flaming = Main.dust[Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 0, new Color(255, Main.DiscoG, 0), 1f)]; flaming.position = position; flaming.velocity = Projectile.velocity.RotatedBy(-1.5707963705062866, default) * 0.33f + Projectile.velocity / 4f; flaming.position += Projectile.velocity.RotatedBy(-1.5707963705062866, default); flaming.fadeIn = 0.5f; flaming.noGravity = true; - int fiery = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 0, new Color(255, Main.DiscoG, 0), 1f); + int fiery = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 0, new Color(255, Main.DiscoG, 0), 1f); Main.dust[fiery].velocity *= 0.5f; Main.dust[fiery].scale *= 1.3f; Main.dust[fiery].fadeIn = 1f; @@ -61,7 +61,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item89, Projectile.position); + SoundEngine.PlaySound(SoundID.Item89, Projectile.Center); Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); Projectile.width = (int)(128f * Projectile.scale); @@ -70,14 +70,14 @@ namespace CalamityMod.Projectiles.Magic Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int i = 0; i < 8; i++) { - Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, new Color(255, Main.DiscoG, 0), 1.5f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 100, new Color(255, Main.DiscoG, 0), 1.5f); } for (int j = 0; j < 32; j++) { - int killFire = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, new Color(255, Main.DiscoG, 0), 2.5f); + int killFire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 100, new Color(255, Main.DiscoG, 0), 2.5f); Main.dust[killFire].noGravity = true; Main.dust[killFire].velocity *= 3f; - killFire = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, new Color(255, Main.DiscoG, 0), 1.5f); + killFire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 100, new Color(255, Main.DiscoG, 0), 1.5f); Main.dust[killFire].velocity *= 2f; Main.dust[killFire].noGravity = true; } @@ -120,7 +120,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { //Changes the texture of the projectile - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; switch ((int)Projectile.ai[0]) { case 0: diff --git a/Projectiles/Magic/AstralCrystal.cs b/Projectiles/Magic/AstralCrystal.cs index beca08bfcd..366c34f1db 100644 --- a/Projectiles/Magic/AstralCrystal.cs +++ b/Projectiles/Magic/AstralCrystal.cs @@ -1,11 +1,11 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { diff --git a/Projectiles/Magic/AstralCrystalInvisibleExplosion.cs b/Projectiles/Magic/AstralCrystalInvisibleExplosion.cs index cfd80174c6..a958dd9dc9 100644 --- a/Projectiles/Magic/AstralCrystalInvisibleExplosion.cs +++ b/Projectiles/Magic/AstralCrystalInvisibleExplosion.cs @@ -1,4 +1,4 @@ -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; diff --git a/Projectiles/Magic/AstralStarMagic.cs b/Projectiles/Magic/AstralStarMagic.cs index c1d7418456..669f7ca602 100644 --- a/Projectiles/Magic/AstralStarMagic.cs +++ b/Projectiles/Magic/AstralStarMagic.cs @@ -1,12 +1,12 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -15,7 +15,7 @@ namespace CalamityMod.Projectiles.Magic public new string LocalizationCategory => "Projectiles.Magic"; public override string Texture => "CalamityMod/Projectiles/Typeless/AstralStar"; - private int noTileHitCounter = 120; + private const int NoTileCollideTime = 30; public override void SetStaticDefaults() { @@ -29,7 +29,6 @@ namespace CalamityMod.Projectiles.Magic Projectile.height = 24; Projectile.friendly = true; Projectile.DamageType = DamageClass.Magic; - Projectile.alpha = 50; Projectile.penetrate = 1; Projectile.tileCollide = false; Projectile.ignoreWater = true; @@ -37,64 +36,85 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - int randomToSubtract = Main.rand.Next(1, 3); - noTileHitCounter -= randomToSubtract; - if (noTileHitCounter == 0) - { + Projectile.ai[1] += 1f; + if (Projectile.ai[1] >= NoTileCollideTime) Projectile.tileCollide = true; - } + if (Projectile.soundDelay == 0) { Projectile.soundDelay = 20 + Main.rand.Next(40); if (Main.rand.NextBool(5)) - { - SoundEngine.PlaySound(SoundID.Item9, Projectile.position); - } - } - Projectile.alpha -= 15; - int opacity = 150; - if (Projectile.Center.Y >= Projectile.ai[1]) - { - opacity = 0; - } - if (Projectile.alpha < opacity) - { - Projectile.alpha = opacity; + SoundEngine.PlaySound(SoundID.Item9, Projectile.Center); } + Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.01f * (float)Projectile.direction; - if (Main.rand.NextBool(16)) + + if (Main.rand.NextBool(8)) { - Vector2 velocity = Vector2.UnitX.RotatedByRandom(Math.PI / 2D).RotatedBy((double)Projectile.velocity.ToRotation(), default); - int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType(), Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1.2f); - Main.dust[idx].velocity = velocity * 0.66f; - Main.dust[idx].position = Projectile.Center + velocity * 12f; + int spawnDustAmount = 2; + for (int i = 0; i < spawnDustAmount; i++) + { + Color newColor = Main.hslToRgb(0.5f, 1f, 0.5f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RainbowMk2, 0f, 0f, 0, newColor); + Main.dust[dust].position = Projectile.Center + Main.rand.NextVector2Circular((float)Projectile.width, (float)Projectile.height) * 0.5f; + Main.dust[dust].velocity *= Main.rand.NextFloat() * 0.8f; + Main.dust[dust].noGravity = true; + Main.dust[dust].fadeIn = 0.6f + Main.rand.NextFloat(); + Main.dust[dust].velocity += Projectile.velocity.SafeNormalize(Vector2.UnitY) * 3f; + Main.dust[dust].scale = 0.7f; + if (dust != Main.maxDust) + { + Dust dust2 = Dust.CloneDust(dust); + dust2.scale /= 2f; + dust2.fadeIn *= 0.85f; + dust2.color = new Color(255, 255, 255, 255); + } + } + + Vector2 velocity = Vector2.UnitX.RotatedByRandom(MathHelper.PiOver2).RotatedBy((double)Projectile.velocity.ToRotation(), default); + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType(), Projectile.velocity.X * 0.25f, Projectile.velocity.Y * 0.25f, 150); + Main.dust[idx].velocity = velocity * 0.33f; + Main.dust[idx].position = Projectile.Center + velocity * 6f; } - if (Main.rand.NextBool(48) && Main.netMode != NetmodeID.Server) + + if (Main.rand.NextBool(24) && Main.netMode != NetmodeID.Server) { - int idx = Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.Center, new Vector2(Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f), 16, 1f); + int idx = Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.Center, Projectile.velocity * 0.1f, 16, 1f); Main.gore[idx].velocity *= 0.66f; - Main.gore[idx].velocity += Projectile.velocity * 0.3f; + Main.gore[idx].velocity += Projectile.velocity * 0.15f; } - if (Projectile.ai[1] == 1f) + + Projectile.light = 0.9f; + + if (Main.rand.NextBool(5)) { - Projectile.light = 0.9f; - if (Main.rand.NextBool(10)) + Color newColor = Main.hslToRgb(1f, 1f, 0.5f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RainbowMk2, 0f, 0f, 0, newColor); + Main.dust[dust].position = Projectile.Center + Main.rand.NextVector2Circular((float)Projectile.width, (float)Projectile.height) * 0.5f; + Main.dust[dust].velocity *= Main.rand.NextFloat() * 0.8f; + Main.dust[dust].noGravity = true; + Main.dust[dust].fadeIn = 0.6f + Main.rand.NextFloat(); + Main.dust[dust].velocity += Projectile.velocity * 0.25f; + Main.dust[dust].scale = 0.7f; + if (dust != Main.maxDust) { - Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType(), Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1.2f); - } - if (Main.rand.NextBool(20) && Main.netMode != NetmodeID.Server) - { - Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.position, new Vector2(Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f), Main.rand.Next(16, 18), 1f); + Dust dust2 = Dust.CloneDust(dust); + dust2.scale /= 2f; + dust2.fadeIn *= 0.85f; + dust2.color = new Color(255, 255, 255, 255); } + + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType(), Projectile.velocity.X * 0.25f, Projectile.velocity.Y * 0.25f, 150); } + + if (Main.rand.NextBool(10) && Main.netMode != NetmodeID.Server) + Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.position, Projectile.velocity * 0.1f, Main.rand.Next(16, 18), 1f); + if (Projectile.ai[0] == 1f) CalamityUtils.HomeInOnNPC(Projectile, Projectile.tileCollide, 500f, 15f, 20f); } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 180); - } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 180); public override Color? GetAlpha(Color lightColor) => new Color(200, 100, 250, Projectile.alpha); @@ -105,12 +125,39 @@ namespace CalamityMod.Projectiles.Magic return false; } + public override bool OnTileCollide(Vector2 oldVelocity) + { + Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); + SoundEngine.PlaySound(SoundID.Dig, Projectile.Center); + return true; + } + public override void OnKill(int timeLeft) { - Projectile.ExpandHitboxBy(50); - for (int i = 0; i < 5; i++) + Projectile.ExpandHitboxBy(50); + + int spawnDustAmount = 3; + for (int i = 0; i < spawnDustAmount; i++) { - int idx = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 1.2f); + Color newColor = Main.hslToRgb(1f, 1f, 0.5f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RainbowMk2, 0f, 0f, 0, newColor); + Main.dust[dust].position = Projectile.Center + Main.rand.NextVector2Circular((float)Projectile.width, (float)Projectile.height); + Main.dust[dust].velocity *= Main.rand.NextFloat() * 2.4f; + Main.dust[dust].noGravity = true; + Main.dust[dust].fadeIn = 0.6f + Main.rand.NextFloat(); + Main.dust[dust].scale = 1.4f; + if (dust != Main.maxDust) + { + Dust dust2 = Dust.CloneDust(dust); + dust2.scale /= 2f; + dust2.fadeIn *= 0.85f; + dust2.color = new Color(255, 255, 255, 255); + } + } + + for (int i = 0; i < 3; i++) + { + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 100); Main.dust[idx].velocity *= 3f; if (Main.rand.NextBool()) { @@ -118,20 +165,20 @@ namespace CalamityMod.Projectiles.Magic Main.dust[idx].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - for (int i = 0; i < 5; i++) + + for (int i = 0; i < 3; i++) { - int idx = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 1.7f); + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 1.5f); Main.dust[idx].noGravity = true; Main.dust[idx].velocity *= 5f; - idx = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 1f); + idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 100); Main.dust[idx].velocity *= 2f; } + if (Main.netMode != NetmodeID.Server) { for (int i = 0; i < 3; i++) - { - Gore.NewGore(Projectile.GetSource_Death(), Projectile.position, new Vector2(Projectile.velocity.X * 0.05f, Projectile.velocity.Y * 0.05f), Main.rand.Next(16, 18), 1f); - } + Gore.NewGore(Projectile.GetSource_Death(), Projectile.position, Projectile.velocity * 0.05f, Main.rand.Next(16, 18), 1f); } } } diff --git a/Projectiles/Magic/AstralachneaFang.cs b/Projectiles/Magic/AstralachneaFang.cs index 0b0c77cbc8..13bf333d7f 100644 --- a/Projectiles/Magic/AstralachneaFang.cs +++ b/Projectiles/Magic/AstralachneaFang.cs @@ -1,10 +1,10 @@ -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { public class AstralachneaFang : ModProjectile, ILocalizedModType @@ -38,7 +38,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item10, Projectile.position); + SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); for (int k = 0; k < 3; k++) { Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f); diff --git a/Projectiles/Magic/AtlantisSpear.cs b/Projectiles/Magic/AtlantisSpear.cs index 732589d7ca..282e319f4b 100644 --- a/Projectiles/Magic/AtlantisSpear.cs +++ b/Projectiles/Magic/AtlantisSpear.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.penetrate = -1; Projectile.extraUpdates = (Main.zenithWorld && devourer) ? 1 : 0; Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = (Main.zenithWorld && devourer) ? 2 : 6; + Projectile.idStaticNPCHitCooldown = (Main.zenithWorld && devourer) ? 2 : 8; } public override void AI() @@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Magic { for (int i = 0; i < 8; i++) { - Dust blue = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, 206, Projectile.velocity.X * 0.005f, Projectile.velocity.Y * 0.005f, 200, default, 1f); + Dust blue = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.UnusedWhiteBluePurple, Projectile.velocity.X * 0.005f, Projectile.velocity.Y * 0.005f, 200, default, 1f); blue.noGravity = true; blue.velocity *= 0.5f; } @@ -70,7 +70,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.Kill(); } if (Main.rand.NextBool(4)) - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 206, Projectile.velocity.X * 0.005f, Projectile.velocity.Y * 0.005f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.UnusedWhiteBluePurple, Projectile.velocity.X * 0.005f, Projectile.velocity.Y * 0.005f); } // This is essential for Vilethorn-type projectiles, as velocity is a stored parameter and isn't supposed to actually move the projectile @@ -82,7 +82,7 @@ namespace CalamityMod.Projectiles.Magic { for (int k = 0; k < 3; k++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 206, Projectile.oldVelocity.X * 0.005f, Projectile.oldVelocity.Y * 0.005f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.UnusedWhiteBluePurple, Projectile.oldVelocity.X * 0.005f, Projectile.oldVelocity.Y * 0.005f); } // Prevent recursion: the segments that are being spawned here will deliberately be set higher than total segments diff --git a/Projectiles/Magic/AuraRain.cs b/Projectiles/Magic/AuraRain.cs index a26a900118..3abea1c3f3 100644 --- a/Projectiles/Magic/AuraRain.cs +++ b/Projectiles/Magic/AuraRain.cs @@ -1,6 +1,6 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -27,8 +27,8 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) - MathHelper.PiOver2; - Dust dust = Main.dust[Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 14, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 1f)]; + Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; + Dust dust = Main.dust[Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Demonite, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 1f)]; dust.velocity = Vector2.Zero; dust.position -= Projectile.velocity / 5f; dust.noGravity = true; @@ -38,7 +38,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } diff --git a/Projectiles/Magic/AuroraAustralis.cs b/Projectiles/Magic/AuroraAustralis.cs index 338e92b033..ae1b9ec827 100644 --- a/Projectiles/Magic/AuroraAustralis.cs +++ b/Projectiles/Magic/AuroraAustralis.cs @@ -2,6 +2,7 @@ using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic @@ -62,7 +63,7 @@ namespace CalamityMod.Projectiles.Magic { Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, Main.rand.Next(dustTypes), Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } - int rainbow = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + int rainbow = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, DustID.RainbowTorch, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); Dust dust = Main.dust[rainbow]; dust.velocity *= 0.1f; dust.velocity += Projectile.velocity * 0.2f; diff --git a/Projectiles/Magic/BeamStar.cs b/Projectiles/Magic/BeamStar.cs index 807217ea5d..8896ef18c3 100644 --- a/Projectiles/Magic/BeamStar.cs +++ b/Projectiles/Magic/BeamStar.cs @@ -1,6 +1,6 @@ +using System; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -52,7 +52,7 @@ namespace CalamityMod.Projectiles.Magic if (Main.rand.NextBool(4)) { - Dust stardust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, 180, 0f, 0f, 100, default, 1f); + Dust stardust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.DungeonSpirit, 0f, 0f, 100, default, 1f); stardust.position = Projectile.Center; stardust.scale += Main.rand.NextFloat(0.5f); stardust.noGravity = true; @@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Magic } if (Main.rand.NextBool(6)) { - Dust stardust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, 176, 0f, 0f, 100, default, 1f); + Dust stardust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.BubbleBurst_Blue, 0f, 0f, 100, default, 1f); stardust.position = Projectile.Center; stardust.scale += Main.rand.NextFloat(0.3f, 1.1f); stardust.noGravity = true; @@ -71,7 +71,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { Vector2 drawPosition; - Texture2D starTexture = ModContent.Request(Texture).Value; + Texture2D starTexture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; for (int i = 1; i < Projectile.oldPos.Length; i++) { float scale = Projectile.scale * MathHelper.Lerp(0.9f, 0.6f, i / (float)Projectile.oldPos.Length) * 0.56f; @@ -88,8 +88,8 @@ namespace CalamityMod.Projectiles.Magic { for (int k = 0; k < 10; k++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 176, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 180, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.BubbleBurst_Blue, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.DungeonSpirit, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } } diff --git a/Projectiles/Magic/BeamingBolt.cs b/Projectiles/Magic/BeamingBolt.cs index 0934bbc373..fb30fb008e 100644 --- a/Projectiles/Magic/BeamingBolt.cs +++ b/Projectiles/Magic/BeamingBolt.cs @@ -1,10 +1,10 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { public class BeamingBolt : ModProjectile, ILocalizedModType @@ -21,7 +21,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; if (Projectile.ai[0] == 1f) tex = ModContent.Request("CalamityMod/Projectiles/Magic/BeamingThornBlossom").Value; @@ -65,7 +65,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 1), Projectile.knockBack, Projectile.owner, Projectile.ai[0]); } } - SoundEngine.PlaySound(SoundID.Item105, Projectile.position); + SoundEngine.PlaySound(SoundID.Item105, Projectile.Center); } } } diff --git a/Projectiles/Magic/BeamingBolt2.cs b/Projectiles/Magic/BeamingBolt2.cs index 4e24873c4c..35f28eca62 100644 --- a/Projectiles/Magic/BeamingBolt2.cs +++ b/Projectiles/Magic/BeamingBolt2.cs @@ -1,6 +1,6 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic @@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; if (Projectile.ai[0] == 1f) tex = ModContent.Request("CalamityMod/Projectiles/Magic/BeamingThorn").Value; diff --git a/Projectiles/Magic/BeastScythe.cs b/Projectiles/Magic/BeastScythe.cs index bcbf924648..58223b592f 100644 --- a/Projectiles/Magic/BeastScythe.cs +++ b/Projectiles/Magic/BeastScythe.cs @@ -1,10 +1,10 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -48,7 +48,7 @@ namespace CalamityMod.Projectiles.Magic Lighting.AddLight(Projectile.Center, 0.35f, 0f, 0.35f); if (Main.rand.NextBool(3)) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 173, Projectile.velocity.X * 0.25f, Projectile.velocity.Y * 0.25f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, Projectile.velocity.X * 0.25f, Projectile.velocity.Y * 0.25f); } Projectile.ai[0] += 1f; @@ -61,7 +61,7 @@ namespace CalamityMod.Projectiles.Magic if (Main.player[Projectile.owner].channel) { float projDelay = 20f; - Vector2 vector10 = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); + Vector2 vector10 = Projectile.Center; float projXDirection = (float)Main.mouseX + Main.screenPosition.X - vector10.X; float projYDirection = (float)Main.mouseY + Main.screenPosition.Y - vector10.Y; if (Main.player[Projectile.owner].gravDir == -1f) @@ -103,7 +103,7 @@ namespace CalamityMod.Projectiles.Magic else { Projectile.netUpdate = true; - Vector2 projDirection = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); + Vector2 projDirection = Projectile.Center; float projXDir = (float)Main.mouseX + Main.screenPosition.X - projDirection.X; float projYDir = (float)Main.mouseY + Main.screenPosition.Y - projDirection.Y; if (Main.player[Projectile.owner].gravDir == -1f) @@ -135,7 +135,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item14, Projectile.position); + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); Projectile.position = Projectile.Center; Projectile.width = Projectile.height = 100; Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); @@ -149,18 +149,18 @@ namespace CalamityMod.Projectiles.Magic bool isInTile = WorldGen.SolidTile(Framing.GetTileSafely((int)Projectile.position.X / 16, (int)Projectile.position.Y / 16)); for (int m = 0; m < 4; m++) { - Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 1.5f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, 0f, 0f, 100, default, 1.5f); } for (int n = 0; n < 4; n++) { - int beastial = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 0, default, 2.5f); + int beastial = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, 0f, 0f, 0, default, 2.5f); Main.dust[beastial].noGravity = true; Main.dust[beastial].velocity *= 3f; if (isInTile) { Main.dust[beastial].noLight = true; } - beastial = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 1.5f); + beastial = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, 0f, 0f, 100, default, 1.5f); Main.dust[beastial].velocity *= 2f; Main.dust[beastial].noGravity = true; if (isInTile) diff --git a/Projectiles/Magic/BigBeamofDeath.cs b/Projectiles/Magic/BigBeamofDeath.cs deleted file mode 100644 index c56ea64535..0000000000 --- a/Projectiles/Magic/BigBeamofDeath.cs +++ /dev/null @@ -1,52 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Magic -{ - public class BigBeamofDeath : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Magic"; - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public override void SetDefaults() - { - Projectile.width = 12; - Projectile.height = 12; - Projectile.friendly = true; - Projectile.DamageType = DamageClass.Magic; - Projectile.tileCollide = false; - Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 6; - Projectile.penetrate = -1; - Projectile.extraUpdates = 100; - Projectile.timeLeft = 80; - } - - public override void OnKill(int timeLeft) - { - int numProj = 2; - float rotation = MathHelper.ToRadians(20); - if (Projectile.owner == Main.myPlayer) - { - for (int i = 0; i < numProj; i++) - { - Vector2 perturbedSpeed = Projectile.velocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, perturbedSpeed, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); - } - } - } - - public override void AI() - { - Projectile.localAI[0] += 1f; - if (Projectile.localAI[0] > 9f) - { - Vector2 projPos = Projectile.position; - projPos -= Projectile.velocity * 0.25f; - int beamDust = Dust.NewDust(projPos, 1, 1, 206, 0f, 0f, 0, default, 3f); - Main.dust[beamDust].position = projPos; - Main.dust[beamDust].velocity *= 0.1f; - } - } - } -} diff --git a/Projectiles/Magic/BigBeamofDeath2.cs b/Projectiles/Magic/BigBeamofDeath2.cs deleted file mode 100644 index 0670ca4928..0000000000 --- a/Projectiles/Magic/BigBeamofDeath2.cs +++ /dev/null @@ -1,34 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Magic -{ - public class BigBeamofDeath2 : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Magic"; - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public override void SetDefaults() - { - Projectile.width = 12; - Projectile.height = 12; - Projectile.friendly = true; - Projectile.DamageType = DamageClass.Magic; - Projectile.tileCollide = false; - Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 6; - Projectile.penetrate = -1; - Projectile.extraUpdates = 100; - Projectile.timeLeft = 80; - } - - public override void AI() - { - Vector2 projPos = Projectile.position; - projPos -= Projectile.velocity * 0.25f; - int beamDust = Dust.NewDust(projPos, 1, 1, 206, 0f, 0f, 0, default, 3f); - Main.dust[beamDust].position = projPos; - Main.dust[beamDust].velocity *= 0.1f; - } - } -} diff --git a/Projectiles/Magic/BlackAnurianBubble.cs b/Projectiles/Magic/BlackAnurianBubble.cs index e7357805fb..e1cb87a269 100644 --- a/Projectiles/Magic/BlackAnurianBubble.cs +++ b/Projectiles/Magic/BlackAnurianBubble.cs @@ -1,8 +1,8 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -62,11 +62,11 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item54, Projectile.position); + SoundEngine.PlaySound(SoundID.Item54, Projectile.Center); int inc; for (int i = 0; i < 25; i = inc + 1) { - int blackDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 14, 0f, 0f, 0, default, 1f); + int blackDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Demonite, 0f, 0f, 0, default, 1f); Main.dust[blackDust].position = (Main.dust[blackDust].position + Projectile.position) / 2f; Main.dust[blackDust].velocity = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); Main.dust[blackDust].velocity.Normalize(); diff --git a/Projectiles/Magic/BlackAnurianPlankton.cs b/Projectiles/Magic/BlackAnurianPlankton.cs index e60b867d46..4269f14e51 100644 --- a/Projectiles/Magic/BlackAnurianPlankton.cs +++ b/Projectiles/Magic/BlackAnurianPlankton.cs @@ -1,5 +1,5 @@ +using System; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic @@ -48,7 +48,7 @@ namespace CalamityMod.Projectiles.Magic { Projectile.alpha = 0; } - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; float projX = Projectile.position.X; float projY = Projectile.position.Y; float homingRange = 100000f; @@ -81,7 +81,7 @@ namespace CalamityMod.Projectiles.Magic } float projVelModifier = 0.1f; - Vector2 projDirection = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); + Vector2 projDirection = Projectile.Center; float xDest = projX - projDirection.X; float yDest = projY - projDirection.Y; float destinationDist = (float)Math.Sqrt((double)(xDest * xDest + yDest * yDest)); diff --git a/Projectiles/Magic/BlindingLight.cs b/Projectiles/Magic/BlindingLight.cs index 6f34a06510..8b4252e738 100644 --- a/Projectiles/Magic/BlindingLight.cs +++ b/Projectiles/Magic/BlindingLight.cs @@ -1,5 +1,5 @@ +using System; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.Graphics.Effects; using Terraria.ID; diff --git a/Projectiles/Magic/BloodBeam.cs b/Projectiles/Magic/BloodBeam.cs index 33cbe0c09f..19dd655fa2 100644 --- a/Projectiles/Magic/BloodBeam.cs +++ b/Projectiles/Magic/BloodBeam.cs @@ -1,6 +1,6 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -14,16 +14,22 @@ namespace CalamityMod.Projectiles.Magic Projectile.width = 12; Projectile.height = 12; Projectile.friendly = true; - Projectile.tileCollide = true; + Projectile.tileCollide = false; Projectile.DamageType = DamageClass.Magic; Projectile.penetrate = -1; Projectile.extraUpdates = 3; Projectile.timeLeft = 120; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() { Lighting.AddLight(Projectile.Center, 0.35f, 0f, 0f); + if (Projectile.position.Y > Main.player[Projectile.owner].position.Y - 160f) + { + Projectile.tileCollide = true; + } if (Projectile.ai[0] > 7f) { float scalar = 1f; @@ -41,7 +47,7 @@ namespace CalamityMod.Projectiles.Magic } Projectile.ai[0] += 1f; int dustType = DustID.Blood; - int blood = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 100, default, 1f); + int blood = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 100, default, 1f); Dust dust = Main.dust[blood]; if (Main.rand.NextBool(3)) { @@ -58,7 +64,7 @@ namespace CalamityMod.Projectiles.Magic { Projectile.ai[0] += 1f; } - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) - MathHelper.PiOver2; + Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 120); diff --git a/Projectiles/Magic/BloodBlast.cs b/Projectiles/Magic/BloodBlast.cs index c7e058c507..340b745e51 100644 --- a/Projectiles/Magic/BloodBlast.cs +++ b/Projectiles/Magic/BloodBlast.cs @@ -1,6 +1,8 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Magic { public class BloodBlast : ModProjectile, ILocalizedModType @@ -30,7 +32,7 @@ namespace CalamityMod.Projectiles.Magic float shortXVel = Projectile.velocity.X / 3f * (float)i; float shortYVel = Projectile.velocity.Y / 3f * (float)i; int fourConst = 4; - int bloody = Dust.NewDust(new Vector2(Projectile.position.X + (float)fourConst, Projectile.position.Y + (float)fourConst), Projectile.width - fourConst * 2, Projectile.height - fourConst * 2, 5, 0f, 0f, 100, default, 1.2f); + int bloody = Dust.NewDust(new Vector2(Projectile.position.X + (float)fourConst, Projectile.position.Y + (float)fourConst), Projectile.width - fourConst * 2, Projectile.height - fourConst * 2, DustID.Blood, 0f, 0f, 100, default, 1.2f); Dust dust = Main.dust[bloody]; dust.noGravity = true; dust.velocity *= 0.1f; @@ -41,7 +43,7 @@ namespace CalamityMod.Projectiles.Magic if (Main.rand.NextBool(5)) { int otherFourConst = 4; - int graphicContent = Dust.NewDust(new Vector2(Projectile.position.X + (float)otherFourConst, Projectile.position.Y + (float)otherFourConst), Projectile.width - otherFourConst * 2, Projectile.height - otherFourConst * 2, 5, 0f, 0f, 100, default, 0.6f); + int graphicContent = Dust.NewDust(new Vector2(Projectile.position.X + (float)otherFourConst, Projectile.position.Y + (float)otherFourConst), Projectile.width - otherFourConst * 2, Projectile.height - otherFourConst * 2, DustID.Blood, 0f, 0f, 100, default, 0.6f); Main.dust[graphicContent].velocity *= 0.25f; Main.dust[graphicContent].velocity += Projectile.velocity * 0.5f; } diff --git a/Projectiles/Magic/BloodRay.cs b/Projectiles/Magic/BloodRay.cs index a8e96049ac..04b524b607 100644 --- a/Projectiles/Magic/BloodRay.cs +++ b/Projectiles/Magic/BloodRay.cs @@ -1,6 +1,6 @@ +using System; using CalamityMod.Dusts; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic diff --git a/Projectiles/Magic/BlueBubble.cs b/Projectiles/Magic/BlueBubble.cs index 342bfd69d2..6470675324 100644 --- a/Projectiles/Magic/BlueBubble.cs +++ b/Projectiles/Magic/BlueBubble.cs @@ -1,8 +1,8 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; -using Terraria.ModLoader; -using Terraria.ID; using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { @@ -56,7 +56,7 @@ namespace CalamityMod.Projectiles.Magic int num190 = Main.rand.Next(5, 9); for (int i = 0; i < num190; i++) { - int bubbly = Dust.NewDust(Projectile.Center, 0, 0, 206, 0f, 0f, 100, default, 1.4f); + int bubbly = Dust.NewDust(Projectile.Center, 0, 0, DustID.UnusedWhiteBluePurple, 0f, 0f, 100, default, 1.4f); Main.dust[bubbly].velocity *= 0.8f; Main.dust[bubbly].position = Vector2.Lerp(Main.dust[bubbly].position, Projectile.Center, 0.5f); Main.dust[bubbly].noGravity = true; diff --git a/Projectiles/Magic/BlushieStaffProj.cs b/Projectiles/Magic/BlushieStaffProj.cs index 4df959828f..98e2af8c09 100644 --- a/Projectiles/Magic/BlushieStaffProj.cs +++ b/Projectiles/Magic/BlushieStaffProj.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using rail; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -29,7 +30,7 @@ namespace CalamityMod.Projectiles.Magic Player player = Main.player[Projectile.owner]; if (Main.myPlayer == Projectile.owner) { - if (!player.channel || player.noItems || player.CCed || Projectile.ai[0] > 3600f) + if (player.CantUseHoldout() || Projectile.ai[0] > 3600f) { Projectile.Kill(); } diff --git a/Projectiles/Magic/BrimstoneFireball.cs b/Projectiles/Magic/BrimstoneFireball.cs index 4b77316d5d..2ea07787ae 100644 --- a/Projectiles/Magic/BrimstoneFireball.cs +++ b/Projectiles/Magic/BrimstoneFireball.cs @@ -1,11 +1,11 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { public class BrimstoneFireball : ModProjectile, ILocalizedModType @@ -53,7 +53,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.localAI[0] += 1f; if (Projectile.localAI[0] > 4f) { - int brimstone = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); + int brimstone = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); Main.dust[brimstone].noGravity = true; Main.dust[brimstone].velocity *= 0f; } @@ -80,7 +80,7 @@ namespace CalamityMod.Projectiles.Magic public override bool OnTileCollide(Vector2 oldVelocity) { - SoundEngine.PlaySound(SoundID.Item20, Projectile.position); + SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); Projectile.penetrate--; if (Projectile.penetrate <= 0) { @@ -110,7 +110,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item20, Projectile.position); + SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 120); diff --git a/Projectiles/Magic/BrimstoneHellfireballFriendly.cs b/Projectiles/Magic/BrimstoneHellfireballFriendly.cs index dff62e6cec..1f9ae38242 100644 --- a/Projectiles/Magic/BrimstoneHellfireballFriendly.cs +++ b/Projectiles/Magic/BrimstoneHellfireballFriendly.cs @@ -2,9 +2,9 @@ using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { public class BrimstoneHellfireballFriendly : ModProjectile, ILocalizedModType diff --git a/Projectiles/Magic/BrimstoneHomer.cs b/Projectiles/Magic/BrimstoneHomer.cs index b8b9be8dd4..a50b9a5251 100644 --- a/Projectiles/Magic/BrimstoneHomer.cs +++ b/Projectiles/Magic/BrimstoneHomer.cs @@ -1,4 +1,4 @@ -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Terraria; @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Magic { Projectile.rotation += 0.7f * Projectile.direction; - int brimstone = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1f); + int brimstone = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1f); Main.dust[brimstone].noGravity = true; if (Projectile.timeLeft < 150) diff --git a/Projectiles/Magic/BrimstoneTentacle.cs b/Projectiles/Magic/BrimstoneTentacle.cs index 3e243f00b8..d49ed65926 100644 --- a/Projectiles/Magic/BrimstoneTentacle.cs +++ b/Projectiles/Magic/BrimstoneTentacle.cs @@ -1,7 +1,7 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic @@ -19,6 +19,8 @@ namespace CalamityMod.Projectiles.Magic Projectile.penetrate = 5; Projectile.MaxUpdates = 3; Projectile.DamageType = DamageClass.Magic; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 5; } public override void AI() @@ -78,7 +80,7 @@ namespace CalamityMod.Projectiles.Magic int scaleLoopCheck = 0; while ((float)scaleLoopCheck < Projectile.scale * 10f) { - int brimDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 1.5f); + int brimDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 1.5f); Main.dust[brimDust].position = (Main.dust[brimDust].position + Projectile.Center) / 2f; Main.dust[brimDust].noGravity = true; Main.dust[brimDust].velocity *= 0.1f; @@ -89,10 +91,5 @@ namespace CalamityMod.Projectiles.Magic } } } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.immune[Projectile.owner] = 5; - } } } diff --git a/Projectiles/Magic/ChronoIcicleLarge.cs b/Projectiles/Magic/ChronoIcicleLarge.cs new file mode 100644 index 0000000000..79fa04c391 --- /dev/null +++ b/Projectiles/Magic/ChronoIcicleLarge.cs @@ -0,0 +1,146 @@ +using System; +using CalamityMod.Buffs.StatDebuffs; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class ChronoIcicleLarge : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Magic"; + public static int HomingSpeed = 16; + public static int IdleSpeedMax = 7; + public override void SetDefaults() + { + Projectile.width = 12; + Projectile.height = 12; + Projectile.aiStyle = -1; + Projectile.coldDamage = true; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.DamageType = DamageClass.Magic; + Projectile.coldDamage = true; + Projectile.tileCollide = false; + Projectile.timeLeft = 180; + } + + public override void AI() + { + Projectile.ai[1]++; + switch (Projectile.ai[0]) + { + // stay in an evenly spaced circle around the player, resembling the 12 ticks on a clock + case 0: + if (Projectile.velocity.Length() > 0.01f) + { + Projectile.velocity *= 0.001f; + } + bool isCounter = Projectile.ai[2] < 0; + if (Main.player[Projectile.owner].active && !Main.player[Projectile.owner].dead) + { + float shardNum = Math.Abs(Projectile.ai[2]) - 1; + float aivar = isCounter ? 1 - shardNum - 1 : shardNum; + Projectile.position = Main.player[Projectile.owner].Center + (2 * MathHelper.Pi / 12 * aivar - MathHelper.PiOver2).ToRotationVector2() * 160 - Projectile.Size / 2; + } + if (Projectile.ai[1] >= (12 - Math.Abs(Projectile.ai[2])) * 5 + 2) + { + SoundEngine.PlaySound(SoundID.NPCHit5, Projectile.Center); + for (int i = 0; i < 10; i++) + { + int dusttype = Main.rand.NextBool() ? 68 : 67; + if (Main.rand.NextBool(4)) + { + dusttype = 80; + } + Vector2 dspeed = new Vector2(Main.rand.NextFloat(-7f, 7f), Main.rand.NextFloat(-7f, 7f)); + int dust = Dust.NewDust(Projectile.Center, 1, 1, dusttype, dspeed.X, dspeed.Y, 50, default, 1.1f); + Main.dust[dust].noGravity = true; + } + Projectile.ai[0] = 1; + Projectile.ai[1] = 0; + } + break; + // jet out + case 1: + if (Projectile.velocity.Length() < IdleSpeedMax) + { + Projectile.velocity *= 3f; + } + if (Projectile.ai[1] > 20) + { + Projectile.ai[0] = 2; + } + break; + // home if possible + case 2: + // Set amount of extra updates. + if (Projectile.Calamity().defExtraUpdates == -1) + Projectile.Calamity().defExtraUpdates = Projectile.extraUpdates; + + Vector2 destination = Projectile.Center; + float maxDistance = 1400; + bool locatedTarget = false; + + // Find a target. + for (int i = 0; i < Main.maxNPCs; i++) + { + float extraDistance = (Main.npc[i].width / 2) + (Main.npc[i].height / 2); + if (!Main.npc[i].CanBeChasedBy(Projectile, false) || !Projectile.WithinRange(Main.npc[i].Center, maxDistance + extraDistance)) + continue; + destination = Main.npc[i].Center; + locatedTarget = true; + break; + } + + if (locatedTarget) + { + // Increase amount of extra updates to greatly increase homing velocity. + Projectile.extraUpdates = Projectile.Calamity().defExtraUpdates + 1; + + // Home in on the target. + Vector2 homeDirection = (destination - Projectile.Center).SafeNormalize(Vector2.UnitY); + Projectile.velocity = (Projectile.velocity * 0.2f + homeDirection * HomingSpeed) / (0.2f + 1f); + } + else + { + // Set amount of extra updates to default amount. + Projectile.extraUpdates = Projectile.Calamity().defExtraUpdates; + if (Projectile.velocity.Length() < IdleSpeedMax) + { + Projectile.velocity *= 3f; + } + } + break; + } + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + SoundEngine.PlaySound(SoundID.Item27, Projectile.position); + target.AddBuff(ModContent.BuffType(), 60); + } + + public override void OnKill(int timeLeft) + { + for (int index1 = 0; index1 < 3; ++index1) + { + int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Snow); + Main.dust[index2].noGravity = true; + Main.dust[index2].noLight = true; + Main.dust[index2].scale = 0.7f; + } + } + public override bool? CanHitNPC(NPC target) + { + // the icicles cannot hit while glued to the player + if (Projectile.ai[0] > 0) + return null; + else + return false; + } + } +} diff --git a/Projectiles/Magic/ChronoIcicleLarge.png b/Projectiles/Magic/ChronoIcicleLarge.png new file mode 100644 index 0000000000..ca612eb647 Binary files /dev/null and b/Projectiles/Magic/ChronoIcicleLarge.png differ diff --git a/Projectiles/Magic/ChronoIcicleSmall.cs b/Projectiles/Magic/ChronoIcicleSmall.cs new file mode 100644 index 0000000000..e3c8e83f67 --- /dev/null +++ b/Projectiles/Magic/ChronoIcicleSmall.cs @@ -0,0 +1,47 @@ +using CalamityMod.Buffs.StatDebuffs; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class ChronoIcicleSmall : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Magic"; + public override void SetDefaults() + { + Projectile.width = 12; + Projectile.height = 12; + Projectile.aiStyle = ProjAIStyleID.Arrow; + Projectile.coldDamage = true; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.DamageType = DamageClass.Magic; + Projectile.coldDamage = true; + } + + public override void AI() + { + Projectile.velocity.Y += 0.05f; + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + SoundEngine.PlaySound(SoundID.Item27 with { Volume = SoundID.Item12.Volume * 0.7f }, Projectile.position); + target.AddBuff(ModContent.BuffType(), 30); + } + + public override void OnKill(int timeLeft) + { + for (int index1 = 0; index1 < 3; ++index1) + { + int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Snow); + Main.dust[index2].noGravity = true; + Main.dust[index2].noLight = true; + Main.dust[index2].scale = 0.7f; + } + } + } +} diff --git a/Projectiles/Magic/ChronoIcicleSmall.png b/Projectiles/Magic/ChronoIcicleSmall.png new file mode 100644 index 0000000000..6e86a39a2c Binary files /dev/null and b/Projectiles/Magic/ChronoIcicleSmall.png differ diff --git a/Projectiles/Magic/ChronomancersScytheHoldout.cs b/Projectiles/Magic/ChronomancersScytheHoldout.cs new file mode 100644 index 0000000000..d5861097b5 --- /dev/null +++ b/Projectiles/Magic/ChronomancersScytheHoldout.cs @@ -0,0 +1,121 @@ +using System; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class ChronomancersScytheHoldout : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Magic"; + public Player Owner => Main.player[Projectile.owner]; + public override string Texture => "CalamityMod/Items/Weapons/Magic/ChronomancersScythe"; + public static int ClockChance = 30; + + public override void SetDefaults() + { + Projectile.width = 60; + Projectile.height = 60; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.ownerHitCheck = true; + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + float collisionPoint = 0f; + float bladeLength = 130 * Projectile.scale; + float bladeWidth = 90 * Projectile.scale; + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + (Projectile.rotation.ToRotationVector2() * bladeLength), bladeWidth, ref collisionPoint); + } + + public override void AI() + { + Owner.ChangeDir((int)Projectile.ai[2]); + + Projectile.velocity = Vector2.Zero; + + Projectile.rotation += (2 * MathHelper.Pi / 60) * Projectile.ai[2]; + + UpdateOwnerVars(); + + Projectile.Center = Owner.MountedCenter + Projectile.rotation.ToRotationVector2() * 10f - Vector2.UnitX * 4 * Owner.direction; + + // once the scythe has completed a rotation, die + if ((Projectile.rotation > 2 * MathHelper.Pi - MathHelper.PiOver2 + MathHelper.PiOver4 && Projectile.ai[2] == 1) || (Projectile.rotation < -(2 * MathHelper.Pi - MathHelper.PiOver2 + MathHelper.PiOver4) && Projectile.ai[2] == -1)) + { + Projectile.Kill(); + } + + // spawn 12 clock hand icicles + Projectile.ai[0]++; + float HandInterval = 60 / 12; + if (Projectile.ai[0] >= HandInterval) + { + if (Projectile.owner == Main.myPlayer) + { + // Math is beautiful + float aivar = Projectile.ai[2] == -1 ? 1 - Projectile.ai[1] - 1 : Projectile.ai[1]; + Vector2 spawnPos = Main.player[Projectile.owner].Center + (2 * MathHelper.Pi / 12 * aivar - MathHelper.PiOver2).ToRotationVector2() * 160; + Vector2 rotationVector = spawnPos - Main.player[Projectile.owner].Center; + int p = Projectile.NewProjectile(Projectile.GetSource_FromThis(), spawnPos, rotationVector * 5, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, ai2: Projectile.ai[2] * (Projectile.ai[1] + 1)); + Main.projectile[p].rotation = (spawnPos - Main.player[Projectile.owner].Center).ToRotation() + MathHelper.PiOver2; + } + Projectile.ai[1]++; + Projectile.ai[0] = 0; + } + } + + public void UpdateOwnerVars() + { + float rotOffset = Projectile.ai[2] == -1 ? 3 * MathHelper.Pi : MathHelper.PiOver2; + Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, Projectile.rotation - rotOffset); + Owner.heldProj = Projectile.whoAmI; + Owner.itemTime = 2; + Owner.itemAnimation = 2; + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 60); + if (Main.rand.NextBool(ClockChance)) + { + Projectile.NewProjectile(Projectile.GetSource_FromThis(), target.Center, Main.rand.NextVector2Circular(-2, 2), ModContent.ProjectileType(), 0, 0, Projectile.owner); + } + } + + //If we don't do that, the hit enemies get knocked back towards you if you hit them from the right?? + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + // This would knock enemies away consistently, but i'm choosing to go with the other option + //hitDirection = Math.Sign(target.Center.X - Owner.Center.X); + + //Doing it this way lets the player choose if they want to knockback enemies towards them by pointing away from them + modifiers.HitDirectionOverride = Owner.direction; + } + + public override bool PreDraw(ref Color lightColor) + { + Owner.ChangeDir((int)Projectile.ai[2]); + + Texture2D scytheTexture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + + Vector2 handleOrigin = Projectile.ai[2] == -1 ? new Vector2(scytheTexture.Width, scytheTexture.Height) : new Vector2(0, scytheTexture.Height); + float scytheRotation = Projectile.rotation; + Main.EntitySpriteDraw(scytheTexture, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), scytheRotation, handleOrigin, Projectile.scale, Projectile.ai[2] == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); + + return false; + } + } +} diff --git a/Projectiles/Magic/ChronomancersScytheSwing.cs b/Projectiles/Magic/ChronomancersScytheSwing.cs new file mode 100644 index 0000000000..5cbd28a35b --- /dev/null +++ b/Projectiles/Magic/ChronomancersScytheSwing.cs @@ -0,0 +1,142 @@ +using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class ChronomancersScytheSwing : ModProjectile + { + public override LocalizedText DisplayName => CalamityUtils.GetItemName(); + public static int IcicleSpeed = 24; + public static int IcicleVariance = 4; + public static int IcicleFrequency = 5; + public static float IcicleDamageMultiplier = 1.2f; + public static int ClockChance = 30; + public override void SetStaticDefaults() + { + Main.projFrames[Projectile.type] = 6; + } + + public override void SetDefaults() + { + Projectile.width = 148; + Projectile.height = 68; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Magic; + Projectile.ownerHitCheck = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 5; + Projectile.coldDamage = true; + } + + public override void AI() + { + Player Owner = Main.player[Projectile.owner]; + Projectile.damage = (int)(Owner.GetTotalDamage(Projectile.DamageType).ApplyTo(Projectile.originalDamage) * (1f + Utils.GetLerpValue(0f, 300f, Projectile.ai[1], true))); + + Projectile.frameCounter++; + if (Projectile.frameCounter >= 1) + { + Projectile.frame++; + Projectile.frameCounter = 0; + } + if (Projectile.frame >= Main.projFrames[Projectile.type]) + Projectile.frame = 0; + + Projectile.soundDelay--; + if (Projectile.soundDelay <= 0) + { + SoundEngine.PlaySound(SoundID.Item71, Projectile.Center); + Projectile.soundDelay = 24; + } + + if (Projectile.ai[2] >= 32) + { + bool manaCostPaid = Owner.CheckMana(Owner.ActiveItem(), -1, true, false); + if (!manaCostPaid) + { + Projectile.Kill(); + return; + } + Projectile.ai[2] = 0; + } + Projectile.ai[2]++; + + if (Main.myPlayer == Projectile.owner) + { + if (!Owner.CantUseHoldout()) + { + float scaleFactor6 = 1f; + + if (Owner.ActiveItem().shoot == Projectile.type) + scaleFactor6 = Owner.ActiveItem().shootSpeed * Projectile.scale; + + Vector2 slashDirection = Main.MouseWorld - Owner.RotatedRelativePoint(Owner.MountedCenter, true); + slashDirection.Normalize(); + if (slashDirection.HasNaNs()) + slashDirection = Vector2.UnitX * (float)Owner.direction; + + slashDirection *= scaleFactor6; + if (slashDirection.X != Projectile.velocity.X || slashDirection.Y != Projectile.velocity.Y) + Projectile.netUpdate = true; + + Projectile.velocity = slashDirection; + } + else + Projectile.Kill(); + } + + Projectile.ai[0]++; + // rapidly fire icicles + if (Projectile.ai[0] % IcicleFrequency == 0) + { + if (Main.myPlayer == Projectile.owner) + { + Vector2 velocity = Projectile.Center.DirectionTo(Main.MouseWorld) * IcicleSpeed + new Vector2(Main.rand.NextFloat(-IcicleVariance, IcicleVariance), Main.rand.NextFloat(-IcicleVariance, IcicleVariance)); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * IcicleDamageMultiplier), Projectile.knockBack, Projectile.owner); + } + } + + Vector2 dustSpawn = Projectile.Center + Projectile.velocity * 3f; + Lighting.AddLight(dustSpawn, Color.LightBlue.R * 0.001f, Color.LightBlue.G * 0.001f, Color.LightBlue.B * 0.001f); + + if (Main.rand.NextBool(3)) + { + int dust = Dust.NewDust(dustSpawn - Projectile.Size * 0.5f, Projectile.width, Projectile.height, DustID.IceRod, Projectile.velocity.X, Projectile.velocity.Y, 100); + Main.dust[dust].noGravity = true; + Main.dust[dust].position -= Projectile.velocity; + } + + Projectile.position = Owner.RotatedRelativePoint(Owner.MountedCenter, true) - Projectile.Size * 0.5f + Vector2.UnitX * 8 + Vector2.UnitY * 4; + Projectile.rotation = Projectile.velocity.ToRotation(); + if (Projectile.spriteDirection == 1) + Projectile.rotation += MathHelper.Pi; + Projectile.spriteDirection = Projectile.direction; + Projectile.timeLeft = 2; + Owner.ChangeDir(Projectile.direction); + Owner.heldProj = Projectile.whoAmI; + Owner.itemTime = 2; + Owner.itemAnimation = 2; + Owner.itemRotation = (Projectile.velocity * Projectile.direction).ToRotation(); + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 60); + if (Main.rand.NextBool(ClockChance)) + { + Projectile.NewProjectile(Projectile.GetSource_FromThis(), target.Center, Main.rand.NextVector2Circular(-2, 2), ModContent.ProjectileType(), 0, 0, Projectile.owner); + } + } + } +} diff --git a/Projectiles/Magic/ChronomancersScytheSwing.png b/Projectiles/Magic/ChronomancersScytheSwing.png new file mode 100644 index 0000000000..134f00bf65 Binary files /dev/null and b/Projectiles/Magic/ChronomancersScytheSwing.png differ diff --git a/Projectiles/Magic/ClamorNoctusStar.cs b/Projectiles/Magic/ClamorNoctusStar.cs index fac42d9be0..36e9c1e8df 100644 --- a/Projectiles/Magic/ClamorNoctusStar.cs +++ b/Projectiles/Magic/ClamorNoctusStar.cs @@ -1,9 +1,9 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Buffs.DamageOverTime; -using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -38,12 +38,12 @@ namespace CalamityMod.Projectiles.Magic Projectile.soundDelay = 20 + Main.rand.Next(40); if (Main.rand.NextBool(5)) { - SoundEngine.PlaySound(SoundID.Item9, Projectile.position); + SoundEngine.PlaySound(SoundID.Item9, Projectile.Center); } } if (Main.rand.NextBool(3)) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 20, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.PurificationPowder, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } } @@ -54,7 +54,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item14, Projectile.position); + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); Projectile.width = 50; @@ -65,7 +65,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.localNPCHitCooldown = 10; for (int i = 0; i < 15; i++) { - int brightDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 20, 0f, 0f, 100, default, 1.2f); + int brightDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.PurificationPowder, 0f, 0f, 100, default, 1.2f); Main.dust[brightDust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -75,10 +75,10 @@ namespace CalamityMod.Projectiles.Magic } for (int j = 0; j < 30; j++) { - int brightDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 20, 0f, 0f, 100, default, 1.7f); + int brightDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.PurificationPowder, 0f, 0f, 100, default, 1.7f); Main.dust[brightDust2].noGravity = true; Main.dust[brightDust2].velocity *= 5f; - brightDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 20, 0f, 0f, 100, default, 1f); + brightDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.PurificationPowder, 0f, 0f, 100, default, 1f); Main.dust[brightDust2].velocity *= 2f; } if (Main.netMode != NetmodeID.Server) diff --git a/Projectiles/Magic/ClamorNoctusWyvern.cs b/Projectiles/Magic/ClamorNoctusWyvern.cs index 61c1c6b9eb..db0583c6e5 100644 --- a/Projectiles/Magic/ClamorNoctusWyvern.cs +++ b/Projectiles/Magic/ClamorNoctusWyvern.cs @@ -1,9 +1,9 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -24,9 +24,9 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - if (Main.rand.Next(5) == 0) + if (Main.rand.NextBool(5)) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 126, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Shadewood, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } } @@ -44,7 +44,7 @@ namespace CalamityMod.Projectiles.Magic SoundEngine.PlaySound(SoundID.NPCHit7, Projectile.Center); for (int i = 0; i <= 10; i++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 126, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Shadewood, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } if (Main.netMode != NetmodeID.Server) { @@ -59,7 +59,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } diff --git a/Projectiles/Magic/ClimaxBeam.cs b/Projectiles/Magic/ClimaxBeam.cs index 95d13c8bf5..8cd668dbf0 100644 --- a/Projectiles/Magic/ClimaxBeam.cs +++ b/Projectiles/Magic/ClimaxBeam.cs @@ -1,6 +1,9 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Particles; + namespace CalamityMod.Projectiles.Magic { public class ClimaxBeam : ModProjectile, ILocalizedModType @@ -12,9 +15,12 @@ namespace CalamityMod.Projectiles.Magic { Projectile.width = 4; Projectile.height = 4; - Projectile.extraUpdates = 100; + Projectile.extraUpdates = 70; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; Projectile.friendly = true; - Projectile.timeLeft = 90; + Projectile.timeLeft = 500; Projectile.DamageType = DamageClass.Magic; Projectile.ignoreWater = true; Projectile.tileCollide = false; @@ -22,12 +28,46 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { + /* Vector2 projPos = Projectile.position; projPos -= Projectile.velocity * 0.25f; - int boltDust = Dust.NewDust(projPos, 1, 1, 206, 0f, 0f, 0, default, 1.25f); + int boltDust = Dust.NewDust(projPos, 1, 1, DustID.UnusedWhiteBluePurple, 0f, 0f, 0, default, 1.25f); Main.dust[boltDust].position = projPos; Main.dust[boltDust].scale = (float)Main.rand.Next(70, 110) * 0.013f; Main.dust[boltDust].velocity *= 0.1f; + */ + + if (Projectile.timeLeft == 500) + { + Particle orb = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Aqua, "CalamityMod/Particles/LargeBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0.2f, 0.2f, 3); + GeneralParticleHandler.SpawnParticle(orb); + Particle orb2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/LargeBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0.13f, 0.13f, 3); + GeneralParticleHandler.SpawnParticle(orb2); + } + + if (Projectile.timeLeft % 3 == 0 && Projectile.timeLeft < 499) + { + LineParticle spark2 = new LineParticle(Projectile.Center, -Projectile.velocity * 0.05f, false, 6, 1.8f, Color.Aqua * 0.6f); + GeneralParticleHandler.SpawnParticle(spark2); + LineParticle spark3 = new LineParticle(Projectile.Center, -Projectile.velocity * 0.05f, false, 6, 1.3f, Color.White * 0.6f); + GeneralParticleHandler.SpawnParticle(spark3); + } + + } + public override void OnKill(int timeLeft) + { + for (int i = 0; i <= 4; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(4, 4), 226, (Projectile.velocity * 2) * Main.rand.NextFloat(0.1f, 0.9f)); + dust.scale = Main.rand.NextFloat(0.3f, 0.5f); + dust.noGravity = true; + } + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(BuffID.Electrified, 90); + if (hit.Damage > 1) + Projectile.Kill(); } } } diff --git a/Projectiles/Magic/ClimaxProj.cs b/Projectiles/Magic/ClimaxProj.cs index 842271fce3..8ff285b156 100644 --- a/Projectiles/Magic/ClimaxProj.cs +++ b/Projectiles/Magic/ClimaxProj.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -9,6 +10,7 @@ namespace CalamityMod.Projectiles.Magic public class ClimaxProj : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Magic"; + public bool firedBeam = false; public override void SetStaticDefaults() { Main.projFrames[Projectile.type] = 5; @@ -28,6 +30,9 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { + if (Projectile.timeLeft == 48) + Projectile.frame = Main.rand.Next(0, 4 + 1); + // Rapidly screech to a halt once spawned. Projectile.velocity *= 0.86f; @@ -35,11 +40,10 @@ namespace CalamityMod.Projectiles.Magic float spinTheta = 0.11f; if (Projectile.localAI[0] == 0f) Projectile.localAI[0] = Main.rand.NextBool() ? -spinTheta : spinTheta; - Projectile.rotation += Projectile.localAI[0]; // Animate the lightning orb. Projectile.frameCounter++; - if (Projectile.frameCounter > 6) + if (Projectile.frameCounter > 3) { Projectile.frameCounter = 0; Projectile.frame++; @@ -51,9 +55,15 @@ namespace CalamityMod.Projectiles.Magic // Initial stagger in frames needs to be skipped over before it starts shooting, // but once it's past that then it can fire constantly + + NPC target = Projectile.Center.ClosestNPCAt(800); + --Projectile.ai[0]; - if (Projectile.ai[0] < 0f) - CalamityUtils.MagnetSphereHitscan(Projectile, 640f, 8f, VoltaicClimax.OrbFireRate, 2, ModContent.ProjectileType(), 1D, true); + if (Projectile.ai[0] < 0f && firedBeam == false && target != null) + { + firedBeam = true; + CalamityUtils.MagnetSphereHitscan(Projectile, Vector2.Distance(Projectile.Center, target.Center), 8f, 0, 5, ModContent.ProjectileType(), 1D, false); + } } public override Color? GetAlpha(Color lightColor) @@ -68,8 +78,8 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { - Texture2D texture2D13 = ModContent.Request(Texture).Value; - int framing = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; + Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + int framing = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; int y6 = framing * Projectile.frame; Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture2D13.Width / 2f, framing / 2f), Projectile.scale, SpriteEffects.None, 0); return false; diff --git a/Projectiles/Magic/CoralSpike.cs b/Projectiles/Magic/CoralSpike.cs index c0f52b8cfd..92e4ac1b18 100644 --- a/Projectiles/Magic/CoralSpike.cs +++ b/Projectiles/Magic/CoralSpike.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { Projectile.velocity *= 0.96f; - Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + 1.57f; + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver2; if (Projectile.velocity.Length() < 2f) Projectile.Kill(); @@ -40,14 +40,14 @@ namespace CalamityMod.Projectiles.Magic int dustOpacity = (int)(200 * (1 - ChargeCompletion)); float dustScale = Main.rand.NextFloat(1f, 1.4f) * (0.6f + 0.4f * ChargeCompletion); Vector2 dustVelocity = Projectile.velocity.SafeNormalize(Vector2.Zero).RotatedByRandom(MathHelper.PiOver4 * 0.6f) * 4f + Main.rand.NextVector2Circular(4f, 4f); - Dust dust = Dust.NewDustPerfect(Projectile.Center, DustPick, dustVelocity, Alpha: dustOpacity, Scale : dustScale); + Dust dust = Dust.NewDustPerfect(Projectile.Center, DustPick, dustVelocity, Alpha: dustOpacity, Scale: dustScale); dust.noGravity = true; } public override void OnKill(int timeLeft) { if (timeLeft != 0) - SoundEngine.PlaySound(SoundID.Dig with { Volume = SoundID.Dig.Volume * 0.4f}, Projectile.Center); + SoundEngine.PlaySound(SoundID.Dig with { Volume = SoundID.Dig.Volume * 0.4f }, Projectile.Center); for (int i = 0; i < 3; i++) { diff --git a/Projectiles/Magic/CoralSpoutHoldout.cs b/Projectiles/Magic/CoralSpoutHoldout.cs index 1116d172a7..ffee1f9bad 100644 --- a/Projectiles/Magic/CoralSpoutHoldout.cs +++ b/Projectiles/Magic/CoralSpoutHoldout.cs @@ -1,8 +1,8 @@ -using CalamityMod.Items.Weapons.Magic; +using System; +using CalamityMod.Items.Weapons.Magic; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.Audio; using Terraria.Graphics.Effects; @@ -64,7 +64,7 @@ namespace CalamityMod.Projectiles.Magic if (Projectile.soundDelay <= 0) { - SoundEngine.PlaySound(CoralSpout.ChargeSound with { Pitch = 0.5f * ChargeProgress}, Owner.MountedCenter); + SoundEngine.PlaySound(CoralSpout.ChargeSound with { Pitch = 0.5f * ChargeProgress }, Owner.MountedCenter); Projectile.soundDelay = 10; } @@ -91,17 +91,17 @@ namespace CalamityMod.Projectiles.Magic effect.Parameters["centerOpacity"].SetValue(0.7f); effect.Parameters["mainOpacity"].SetValue((float)Math.Sqrt(ChargeProgress)); effect.Parameters["halfSpreadAngle"].SetValue(Spread / 2f); - effect.Parameters["edgeColor"].SetValue(Color.Lerp(Color.DeepSkyBlue, Color.Coral, blinkage ).ToVector3()); + effect.Parameters["edgeColor"].SetValue(Color.Lerp(Color.DeepSkyBlue, Color.Coral, blinkage).ToVector3()); effect.Parameters["centerColor"].SetValue(Color.Lerp(Color.DodgerBlue, Color.Coral, blinkage).ToVector3()); effect.Parameters["edgeBlendLength"].SetValue(0.07f); effect.Parameters["edgeBlendStrength"].SetValue(8f); Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, effect, Main.GameViewMatrix.TransformationMatrix); - + Texture2D texture = ModContent.Request("CalamityMod/Projectiles/InvisibleProj").Value; - Main.EntitySpriteDraw(texture, Owner.MountedCenter - Main.screenPosition, null, Color.White, angle, new Vector2(texture.Width / 2f, texture.Height/2f), 700f, 0, 0); + Main.EntitySpriteDraw(texture, Owner.MountedCenter - Main.screenPosition, null, Color.White, angle, new Vector2(texture.Width / 2f, texture.Height / 2f), 700f, 0, 0); Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); diff --git a/Projectiles/Magic/CosmicTentacle.cs b/Projectiles/Magic/CosmicTentacle.cs index ac18c8d0d9..56b7b6ac47 100644 --- a/Projectiles/Magic/CosmicTentacle.cs +++ b/Projectiles/Magic/CosmicTentacle.cs @@ -1,6 +1,7 @@ +using System; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic @@ -18,6 +19,8 @@ namespace CalamityMod.Projectiles.Magic Projectile.penetrate = 5; Projectile.MaxUpdates = 3; Projectile.DamageType = DamageClass.Magic; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 5; } public override void AI() @@ -77,7 +80,7 @@ namespace CalamityMod.Projectiles.Magic int scaleLoopCheck = 0; while ((float)scaleLoopCheck < Projectile.scale * 10f) { - int purpleDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 62, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 1.1f); + int purpleDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.PurpleTorch, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 1.1f); Main.dust[purpleDust].position = (Main.dust[purpleDust].position + Projectile.Center) / 2f; Main.dust[purpleDust].noGravity = true; Main.dust[purpleDust].velocity *= 0.1f; @@ -88,10 +91,5 @@ namespace CalamityMod.Projectiles.Magic } } } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.immune[Projectile.owner] = 5; - } } } diff --git a/Projectiles/Magic/CryoBlast.cs b/Projectiles/Magic/CryoBlast.cs index 636f59fc64..2a0515bc4d 100644 --- a/Projectiles/Magic/CryoBlast.cs +++ b/Projectiles/Magic/CryoBlast.cs @@ -2,9 +2,9 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { public class CryoBlast : ModProjectile, ILocalizedModType @@ -72,10 +72,10 @@ namespace CalamityMod.Projectiles.Magic Projectile.localAI[0] += 1f; if (Projectile.localAI[0] > 4f || Projectile.ai[0] > 0f) { - int ice = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 66, 0f, 0f, 100, default, Projectile.scale * 0.5f); + int ice = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RainbowTorch, 0f, 0f, 100, default, Projectile.scale * 0.5f); Main.dust[ice].noGravity = true; Main.dust[ice].velocity *= 0f; - int snow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 185, 0f, 0f, 100, default, Projectile.scale * 0.5f); + int snow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.FrostHydra, 0f, 0f, 100, default, Projectile.scale * 0.5f); Main.dust[snow].noGravity = true; Main.dust[snow].velocity *= 0f; } @@ -86,7 +86,7 @@ namespace CalamityMod.Projectiles.Magic if ((Projectile.timeLeft > 596 && Projectile.ai[0] == 0f) || (Projectile.timeLeft > 599 && Projectile.ai[0] > 0f)) return false; - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Vector2 drawPos = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); int height = texture.Height / Main.projFrames[Projectile.type]; int frameHeight = height * Projectile.frame; @@ -105,7 +105,7 @@ namespace CalamityMod.Projectiles.Magic SoundEngine.PlaySound(SoundID.Item27, Projectile.Center); for (int index1 = 0; index1 < 15; ++index1) { - int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 88, 0f, 0f, 0, new Color(), 0.9f); + int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GemSapphire, 0f, 0f, 0, new Color(), 0.9f); Main.dust[index2].noGravity = true; Main.dust[index2].velocity *= 1.5f; } diff --git a/Projectiles/Magic/DarkSparkBeam.cs b/Projectiles/Magic/DarkSparkBeam.cs index daf5eadd81..99543487e8 100644 --- a/Projectiles/Magic/DarkSparkBeam.cs +++ b/Projectiles/Magic/DarkSparkBeam.cs @@ -163,10 +163,10 @@ namespace CalamityMod.Projectiles.Magic Vector2 dustSpawn = Projectile.Center + Projectile.velocity * (Projectile.localAI[1] - 14.5f * Projectile.scale); for (int j = 0; j < 2; j++) { - float dustRotate = Projectile.velocity.ToRotation() + ((Main.rand.Next(2) == 1) ? -1f : 1f) * MathHelper.PiOver2; + float dustRotate = Projectile.velocity.ToRotation() + ((Main.rand.NextBool(2)) ? -1f : 1f) * MathHelper.PiOver2; float dustRandom = (float)Main.rand.NextDouble() * 0.8f + 1f; Vector2 randomRotate = new Vector2((float)Math.Cos(dustRotate) * dustRandom, (float)Math.Sin(dustRotate) * dustRandom); - int rainbowDust = Dust.NewDust(dustSpawn, 0, 0, 267, randomRotate.X, randomRotate.Y, 0, color, 3.3f); + int rainbowDust = Dust.NewDust(dustSpawn, 0, 0, DustID.RainbowMk2, randomRotate.X, randomRotate.Y, 0, color, 3.3f); Main.dust[rainbowDust].color = color; Main.dust[rainbowDust].scale = 1.2f; if (Projectile.scale > 1f) @@ -188,7 +188,7 @@ namespace CalamityMod.Projectiles.Magic if (Main.rand.NextBool(5)) { Vector2 extraDustSpawn = Projectile.velocity.RotatedBy(MathHelper.PiOver2) * ((float)Main.rand.NextDouble() - 0.5f) * Projectile.width; - int extraRainbows = Dust.NewDust(dustSpawn + extraDustSpawn - Vector2.One * 4f, 8, 8, 267, 0f, 0f, 100, color, 5f); + int extraRainbows = Dust.NewDust(dustSpawn + extraDustSpawn - Vector2.One * 4f, 8, 8, DustID.RainbowMk2, 0f, 0f, 100, color, 5f); Main.dust[extraRainbows].velocity *= 0.5f; Main.dust[extraRainbows].noGravity = true; Main.dust[extraRainbows].velocity.Y = -Math.Abs(Main.dust[extraRainbows].velocity.Y); @@ -209,7 +209,7 @@ namespace CalamityMod.Projectiles.Magic if (Projectile.velocity == Vector2.Zero) return false; - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; float drawArea = Projectile.localAI[1]; Projectile projectile2 = Main.projectile[(int)Projectile.ai[1]]; Color color = new Color(1, 1, 1, 127); diff --git a/Projectiles/Magic/DarkSparkPrism.cs b/Projectiles/Magic/DarkSparkPrism.cs index 47c4b5985e..e3c0d1a384 100644 --- a/Projectiles/Magic/DarkSparkPrism.cs +++ b/Projectiles/Magic/DarkSparkPrism.cs @@ -1,11 +1,11 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; +using System; using System.IO; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -120,14 +120,13 @@ namespace CalamityMod.Projectiles.Magic Projectile.soundDelay = 10; Projectile.soundDelay *= 2; if (Projectile.ai[0] != 1f) - SoundEngine.PlaySound(SoundID.Item15, Projectile.position); + SoundEngine.PlaySound(SoundID.Item15, Projectile.Center); } if (shouldHitChargedUp && Main.myPlayer == Projectile.owner) { bool hasMana = !shouldHitNotCharged || player.CheckMana(player.ActiveItem(), -1, true, false); - bool canUseItem = player.channel && hasMana && !player.noItems && !player.CCed; - if (canUseItem) + if (!player.CantUseHoldout() && hasMana) { if (Projectile.ai[0] == 1f) { @@ -170,8 +169,8 @@ namespace CalamityMod.Projectiles.Magic { spriteEffects = SpriteEffects.FlipHorizontally; } - Texture2D texture2D14 = ModContent.Request(Texture).Value; - int framing = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; + Texture2D texture2D14 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + int framing = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; int y7 = framing * Projectile.frame; Vector2 drawStart = (Projectile.position + new Vector2((float)Projectile.width, (float)Projectile.height) / 2f + Vector2.UnitY * Projectile.gfxOffY - Main.screenPosition).Floor(); if (Main.player[Projectile.owner].shroomiteStealth && Main.player[Projectile.owner].inventory[Main.player[Projectile.owner].selectedItem].CountsAsClass()) diff --git a/Projectiles/Magic/DivineRetributionSpear.cs b/Projectiles/Magic/DivineRetributionSpear.cs index 37658c254d..776538b8cb 100644 --- a/Projectiles/Magic/DivineRetributionSpear.cs +++ b/Projectiles/Magic/DivineRetributionSpear.cs @@ -1,10 +1,10 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -44,7 +44,7 @@ namespace CalamityMod.Projectiles.Magic else { Projectile.spriteDirection = 1; - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X); + Projectile.rotation = Projectile.velocity.ToRotation(); } Lighting.AddLight(Projectile.Center, 0.7f, 0.3f, 0f); @@ -92,14 +92,14 @@ namespace CalamityMod.Projectiles.Magic SoundEngine.PlaySound(SoundID.Item74, Projectile.Center); for (int i = 0; i < 6; i++) { - Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0, 0); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0, 0); } for (int j = 0; j < 10; j++) { - int divinity = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0, 0); + int divinity = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0, 0); Main.dust[divinity].noGravity = true; Main.dust[divinity].velocity *= 3f; - divinity = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0, 0); + divinity = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0, 0); Main.dust[divinity].velocity *= 2f; Main.dust[divinity].noGravity = true; } diff --git a/Projectiles/Magic/DustProjectile.cs b/Projectiles/Magic/DustProjectile.cs index d2966d80df..656d045e7f 100644 --- a/Projectiles/Magic/DustProjectile.cs +++ b/Projectiles/Magic/DustProjectile.cs @@ -1,7 +1,7 @@ -using CalamityMod.Buffs.StatDebuffs; +using System; +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.DataStructures; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.ignoreWater = true; Projectile.tileCollide = false; Projectile.DamageType = DamageClass.Magic; - Projectile.penetrate = 4; + Projectile.penetrate = 3; Projectile.MaxUpdates = 4; Projectile.timeLeft = 30 * Projectile.MaxUpdates; // 30 effectively, 120 total Projectile.usesLocalNPCImmunity = true; @@ -86,7 +86,7 @@ namespace CalamityMod.Projectiles.Magic Vector2 dustPos = dustCircle.RandomPointInCircle(); if ((dustPos - Projectile.Center).Length() > 48) { - int dustIndex = Dust.NewDust(dustPos, 1, 1, 22); + int dustIndex = Dust.NewDust(dustPos, 1, 1, DustID.Pot); Main.dust[dustIndex].noGravity = true; Main.dust[dustIndex].fadeIn = 1f; Vector2 dustVelocity = Projectile.Center - Main.dust[dustIndex].position; diff --git a/Projectiles/Magic/EelDrop.cs b/Projectiles/Magic/EelDrop.cs index a1b2ff7238..e932ba247a 100644 --- a/Projectiles/Magic/EelDrop.cs +++ b/Projectiles/Magic/EelDrop.cs @@ -1,8 +1,8 @@ +using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Buffs.StatDebuffs; namespace CalamityMod.Projectiles.Magic { @@ -38,7 +38,7 @@ namespace CalamityMod.Projectiles.Magic // Water drip for (int i = 0; i < 4; i++) { - int idx = Dust.NewDust(Projectile.position - Projectile.velocity, 2, 2, 154, 0f, 0f, 0, new Color(112, 150, 42, 127), 1f); + int idx = Dust.NewDust(Projectile.position - Projectile.velocity, 2, 2, DustID.Rain, 0f, 0f, 0, new Color(112, 150, 42, 127), 1f); Dust dust = Main.dust[idx]; dust.position.X -= 2f; Main.dust[idx].alpha = 38; diff --git a/Projectiles/Magic/EidolicWailSoundwave.cs b/Projectiles/Magic/EidolicWailSoundwave.cs index e6fa71eca8..9d5fc819c4 100644 --- a/Projectiles/Magic/EidolicWailSoundwave.cs +++ b/Projectiles/Magic/EidolicWailSoundwave.cs @@ -1,6 +1,6 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -45,7 +45,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.width = 36; Projectile.height = 36; } - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X); + Projectile.rotation = Projectile.velocity.ToRotation(); } public override bool OnTileCollide(Vector2 oldVelocity) @@ -69,7 +69,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.damage = (int)(Projectile.damage * 0.75f); // 25% damage nerf for every enemy hit if (Projectile.damage < 1) Projectile.damage = 1; - + } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) diff --git a/Projectiles/Magic/EldritchTentacle.cs b/Projectiles/Magic/EldritchTentacle.cs index 33e69041c7..d9773dcf12 100644 --- a/Projectiles/Magic/EldritchTentacle.cs +++ b/Projectiles/Magic/EldritchTentacle.cs @@ -1,7 +1,9 @@ +using System; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Magic { public class EldritchTentacle : ModProjectile, ILocalizedModType @@ -17,6 +19,8 @@ namespace CalamityMod.Projectiles.Magic Projectile.penetrate = 2; Projectile.MaxUpdates = 3; Projectile.DamageType = DamageClass.Magic; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() @@ -75,7 +79,7 @@ namespace CalamityMod.Projectiles.Magic int scaleLoopCheck = 0; while ((float)scaleLoopCheck < Projectile.scale * 10f) { - int eldritchRed = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 1.1f); + int eldritchRed = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RedTorch, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 1.1f); Main.dust[eldritchRed].position = (Main.dust[eldritchRed].position + Projectile.Center) / 2f; Main.dust[eldritchRed].noGravity = true; Main.dust[eldritchRed].velocity *= 0.1f; diff --git a/Projectiles/Magic/ElementTentacle.cs b/Projectiles/Magic/ElementTentacle.cs index 76ba460e0c..2cd1d493bf 100644 --- a/Projectiles/Magic/ElementTentacle.cs +++ b/Projectiles/Magic/ElementTentacle.cs @@ -1,6 +1,6 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -78,7 +78,7 @@ namespace CalamityMod.Projectiles.Magic int scaleLoopCheck = 0; while ((float)scaleLoopCheck < Projectile.scale * 10f) { - int rainbow = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 66, Projectile.velocity.X, Projectile.velocity.Y, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.1f); + int rainbow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RainbowTorch, Projectile.velocity.X, Projectile.velocity.Y, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.1f); Main.dust[rainbow].position = (Main.dust[rainbow].position + Projectile.Center) / 2f; Main.dust[rainbow].noGravity = true; Main.dust[rainbow].velocity *= 0.1f; diff --git a/Projectiles/Magic/EnormousConsumingVortex.cs b/Projectiles/Magic/EnormousConsumingVortex.cs index 942699f649..7720dae937 100644 --- a/Projectiles/Magic/EnormousConsumingVortex.cs +++ b/Projectiles/Magic/EnormousConsumingVortex.cs @@ -1,15 +1,15 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; +using System; +using System.Collections.Generic; using System.IO; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; -using Terraria.ID; -using Terraria.ModLoader; using Terraria.Audio; using Terraria.Graphics.Shaders; -using CalamityMod.Particles; -using CalamityMod.Items.Weapons.Magic; -using System.Collections.Generic; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { @@ -217,9 +217,9 @@ namespace CalamityMod.Projectiles.Magic Vector2 drawPosition = Projectile.Center - Main.screenPosition; Vector2 scale = Projectile.Size / worleyNoise.Size() * 2f; float spinRotation = Main.GlobalTimeWrappedHourly * 2.4f; - + GameShaders.Misc["CalamityMod:ExoVortex"].Apply(); - + // Draw the vortex. for (int i = 0; i < CalamityUtils.ExoPalette.Length; i++) { diff --git a/Projectiles/Magic/EternityBook.cs b/Projectiles/Magic/EternityBook.cs index d85f9649f2..a2b8f21950 100644 --- a/Projectiles/Magic/EternityBook.cs +++ b/Projectiles/Magic/EternityBook.cs @@ -1,7 +1,7 @@ -using CalamityMod.Items.Weapons.Magic; +using System; +using CalamityMod.Items.Weapons.Magic; using CalamityMod.NPCs.Providence; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.Audio; using Terraria.Localization; @@ -38,7 +38,7 @@ namespace CalamityMod.Projectiles.Magic Player player = Main.player[Projectile.owner]; // If the player is no longer able to hold the book, kill it (and by extension the other projectiles). - if (!player.channel || player.noItems || player.CCed) + if (player.CantUseHoldout()) { Projectile.Kill(); return; diff --git a/Projectiles/Magic/EternityCircle.cs b/Projectiles/Magic/EternityCircle.cs index 3de51a37ce..d12cc1eddb 100644 --- a/Projectiles/Magic/EternityCircle.cs +++ b/Projectiles/Magic/EternityCircle.cs @@ -1,5 +1,5 @@ +using System; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ModLoader; diff --git a/Projectiles/Magic/EternityCrystal.cs b/Projectiles/Magic/EternityCrystal.cs index a489acde0e..afaa3fc468 100644 --- a/Projectiles/Magic/EternityCrystal.cs +++ b/Projectiles/Magic/EternityCrystal.cs @@ -1,12 +1,12 @@ -using CalamityMod.Items.Weapons.Magic; +using System; +using System.IO; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Sounds; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; using Terraria; -using Terraria.ModLoader; using Terraria.Audio; -using CalamityMod.Sounds; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { @@ -166,7 +166,7 @@ namespace CalamityMod.Projectiles.Magic } public override bool PreDraw(ref Color lightColor) { - Texture2D myTexture = ModContent.Request(Texture).Value; + Texture2D myTexture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Rectangle frame = myTexture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); Color trasparentCrystalColor = Projectile.GetAlpha(lightColor) * 0.6f; Vector2 origin = frame.Size() / 2f; diff --git a/Projectiles/Magic/EternityHex.cs b/Projectiles/Magic/EternityHex.cs index a8906062d9..b7d62c4130 100644 --- a/Projectiles/Magic/EternityHex.cs +++ b/Projectiles/Magic/EternityHex.cs @@ -1,9 +1,9 @@ -using CalamityMod.Graphics.Primitives; +using System; +using CalamityMod.Graphics.Primitives; using CalamityMod.Items.Weapons.Magic; using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.GameContent.Drawing; using Terraria.Graphics.Shaders; diff --git a/Projectiles/Magic/EternityHoming.cs b/Projectiles/Magic/EternityHoming.cs index db6af1b6af..ebcf9fca92 100644 --- a/Projectiles/Magic/EternityHoming.cs +++ b/Projectiles/Magic/EternityHoming.cs @@ -1,6 +1,6 @@ +using System; using CalamityMod.Items.Weapons.Magic; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ModLoader; diff --git a/Projectiles/Magic/EventHorizonStar.cs b/Projectiles/Magic/EventHorizonStar.cs index e5ad6b45e2..3b7ec095cf 100644 --- a/Projectiles/Magic/EventHorizonStar.cs +++ b/Projectiles/Magic/EventHorizonStar.cs @@ -1,10 +1,10 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -43,14 +43,14 @@ namespace CalamityMod.Projectiles.Magic Projectile.soundDelay = 20 + Main.rand.Next(40); if (Main.rand.NextBool(5)) { - SoundEngine.PlaySound(SoundID.Item9, Projectile.position); + SoundEngine.PlaySound(SoundID.Item9, Projectile.Center); } } //dust effects if (Main.rand.NextBool(10)) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 262, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 0, default, 0.75f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.AmberBolt, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 0, default, 0.75f); } Projectile.localAI[0]++; @@ -133,7 +133,7 @@ namespace CalamityMod.Projectiles.Magic public override void PostDraw(Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, 0, texture.Width, texture.Height)), new Color(255, 255, 255, 127), Projectile.rotation, texture.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); } } diff --git a/Projectiles/Magic/EvergladeSprayProjectile.cs b/Projectiles/Magic/EvergladeSprayProjectile.cs index 8d3992e0a8..db5714d406 100644 --- a/Projectiles/Magic/EvergladeSprayProjectile.cs +++ b/Projectiles/Magic/EvergladeSprayProjectile.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Magic { float shortXVel = Projectile.velocity.X / 3f * (float)i; float shortYVel = Projectile.velocity.Y / 3f * (float)i; - int natureDust = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, 157, 0f, 0f, 100, default, 1f); + int natureDust = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, DustID.ChlorophyteWeapon, 0f, 0f, 100, default, 1f); Dust dust = Main.dust[natureDust]; dust.noGravity = true; dust.velocity *= 0.1f; @@ -52,7 +52,7 @@ namespace CalamityMod.Projectiles.Magic } if (Main.rand.NextBool(8)) { - int natual = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, 157, 0f, 0f, 100, default, 0.5f); + int natual = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, DustID.ChlorophyteWeapon, 0f, 0f, 100, default, 0.5f); Main.dust[natual].velocity *= 0.25f; Main.dust[natual].velocity += Projectile.velocity * 0.5f; } @@ -66,7 +66,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } diff --git a/Projectiles/Magic/ExoVortex.cs b/Projectiles/Magic/ExoVortex.cs index 0a62500f66..aba7ceed69 100644 --- a/Projectiles/Magic/ExoVortex.cs +++ b/Projectiles/Magic/ExoVortex.cs @@ -1,5 +1,6 @@ -using CalamityMod.Buffs.DamageOverTime; -using System.Collections.Generic; +using System.Collections.Generic; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Graphics.Primitives; using CalamityMod.Items.Weapons.Magic; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -50,7 +51,7 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { Time++; - + // Move sharply towards nearby targets. NPC potentialTarget = Projectile.Center.ClosestNPCAt(SubsumingVortex.SmallVortexTargetRange); if (potentialTarget != null) @@ -119,7 +120,7 @@ namespace CalamityMod.Projectiles.Magic GameShaders.Misc["CalamityMod:SideStreakTrail"].UseImage1("Images/Misc/Perlin"); PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(PrimitiveWidthFunction, PrimitiveTrailColor, PrimitiveOffsetFunction, shader: GameShaders.Misc["CalamityMod:SideStreakTrail"]), 51); Main.spriteBatch.EnterShaderRegion(BlendState.Additive); - + GameShaders.Misc["CalamityMod:ExoVortex"].Apply(); // Draw the vortex, along with some afterimages. diff --git a/Projectiles/Magic/ExoVortex2.cs b/Projectiles/Magic/ExoVortex2.cs index e9a5505221..594aac4474 100644 --- a/Projectiles/Magic/ExoVortex2.cs +++ b/Projectiles/Magic/ExoVortex2.cs @@ -1,5 +1,6 @@ -using CalamityMod.Buffs.DamageOverTime; -using System.Collections.Generic; +using System.Collections.Generic; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Graphics.Primitives; using CalamityMod.Items.Weapons.Magic; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -50,7 +51,7 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { Time++; - + // Move sharply towards nearby targets. // This is the same movement code that the old Subsuming Vortices used. NPC potentialTarget = Projectile.Center.ClosestNPCAt(SubsumingVortex.SmallVortexTargetRange); @@ -123,7 +124,7 @@ namespace CalamityMod.Projectiles.Magic GameShaders.Misc["CalamityMod:SideStreakTrail"].UseImage1("Images/Misc/Perlin"); PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(PrimitiveWidthFunction, PrimitiveTrailColor, PrimitiveOffsetFunction, shader: GameShaders.Misc["CalamityMod:SideStreakTrail"]), 51); Main.spriteBatch.EnterShaderRegion(BlendState.Additive); - + GameShaders.Misc["CalamityMod:ExoVortex"].Apply(); // Draw the vortex, along with some afterimages. diff --git a/Projectiles/Magic/FabBolt.cs b/Projectiles/Magic/FabBolt.cs index 0c2fe68207..e31698e9c6 100644 --- a/Projectiles/Magic/FabBolt.cs +++ b/Projectiles/Magic/FabBolt.cs @@ -1,7 +1,7 @@ -using CalamityMod.Graphics.Primitives; +using System; +using CalamityMod.Graphics.Primitives; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.Graphics.Shaders; using Terraria.ID; diff --git a/Projectiles/Magic/FabRay.cs b/Projectiles/Magic/FabRay.cs index 2613214198..a58f5f7bfa 100644 --- a/Projectiles/Magic/FabRay.cs +++ b/Projectiles/Magic/FabRay.cs @@ -1,8 +1,8 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; using CalamityMod.Graphics.Primitives; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.Graphics.Shaders; using Terraria.ID; diff --git a/Projectiles/Magic/FatesRevealFlame.cs b/Projectiles/Magic/FatesRevealFlame.cs index b3e94ed397..28d0743a61 100644 --- a/Projectiles/Magic/FatesRevealFlame.cs +++ b/Projectiles/Magic/FatesRevealFlame.cs @@ -1,8 +1,8 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -68,11 +68,11 @@ namespace CalamityMod.Projectiles.Magic var_2_2A211_cp_0[var_2_2A211_cp_1] = dustIncr + 1f; for (float j = 0f; j < 3f; j = dustIncr + 1f) { - if (Main.rand.Next(3) != 0) + if (!Main.rand.NextBool(3)) { return; } - Dust fateful = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, 60, 0f, -2f, 0, default, 1f)]; + Dust fateful = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, DustID.RedTorch, 0f, -2f, 0, default, 1f)]; fateful.position = Projectile.Center + Vector2.UnitY.RotatedBy((double)(j * 6.28318548f / 3f + Projectile.ai[1]), default) * 10f; fateful.noGravity = true; fateful.velocity = Projectile.DirectionFrom(fateful.position); @@ -90,7 +90,7 @@ namespace CalamityMod.Projectiles.Magic // projectile.damage = 800; for (int i = 0; i < 10; i = inc + 1) { - Dust fateful = Main.dust[Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 60, 0f, -2f, 0, default, 1f)]; + Dust fateful = Main.dust[Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RedTorch, 0f, -2f, 0, default, 1f)]; fateful.noGravity = true; if (fateful.position != Projectile.Center) fateful.velocity = Projectile.SafeDirectionTo(fateful.position) * 3f; @@ -143,13 +143,13 @@ namespace CalamityMod.Projectiles.Magic int inc; for (int i = 0; i < 3; i = inc + 1) { - int redFate = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 100, default, 1.5f); + int redFate = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RedTorch, 0f, 0f, 100, default, 1.5f); Main.dust[redFate].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; inc = i; } for (int j = 0; j < 10; j = inc + 1) { - int redFate2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 0, default, 2.5f); + int redFate2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RedTorch, 0f, 0f, 0, default, 2.5f); Main.dust[redFate2].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; Main.dust[redFate2].noGravity = true; Dust dust = Main.dust[redFate2]; @@ -158,7 +158,7 @@ namespace CalamityMod.Projectiles.Magic } for (int k = 0; k < 5; k = inc + 1) { - int redFate3 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 0, default, 1.5f); + int redFate3 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RedTorch, 0f, 0f, 0, default, 1.5f); Main.dust[redFate3].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)Projectile.velocity.ToRotation(), default) * (float)Projectile.width / 2f; Main.dust[redFate3].noGravity = true; Dust dust = Main.dust[redFate3]; diff --git a/Projectiles/Magic/FlamingPumpkin.cs b/Projectiles/Magic/FlamingPumpkin.cs deleted file mode 100644 index c60ddc12d8..0000000000 --- a/Projectiles/Magic/FlamingPumpkin.cs +++ /dev/null @@ -1,28 +0,0 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Magic -{ - public class FlamingPumpkin : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Magic"; - public override void SetDefaults() - { - Projectile.width = 14; - Projectile.height = 14; - Projectile.aiStyle = ProjAIStyleID.GroundProjectile; - Projectile.penetrate = 2; - Projectile.timeLeft = 200; - Projectile.DamageType = DamageClass.Magic; - Projectile.friendly = true; - } - - public override void AI() - { - if (Main.rand.NextBool(3)) - { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 64, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); - } - } - } -} diff --git a/Projectiles/Magic/FlamingPumpkin.png b/Projectiles/Magic/FlamingPumpkin.png deleted file mode 100644 index ee9283758a..0000000000 Binary files a/Projectiles/Magic/FlamingPumpkin.png and /dev/null differ diff --git a/Projectiles/Magic/FlareBoltProjectile.cs b/Projectiles/Magic/FlareBoltProjectile.cs index 9b0232fb20..d744d9eb4f 100644 --- a/Projectiles/Magic/FlareBoltProjectile.cs +++ b/Projectiles/Magic/FlareBoltProjectile.cs @@ -1,8 +1,8 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.timeLeft = 480; Projectile.DamageType = DamageClass.Magic; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; + Projectile.localNPCHitCooldown = 20; } public override void AI() @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Magic float shortXVel = Projectile.velocity.X / 3f * (float)i; float shortYVel = Projectile.velocity.Y / 3f * (float)i; int fourConst = 4; - int fireDust = Dust.NewDust(new Vector2(Projectile.position.X + (float)fourConst, Projectile.position.Y + (float)fourConst), Projectile.width - fourConst * 2, Projectile.height - fourConst * 2, 174, 0f, 0f, 100, default, 1.2f); + int fireDust = Dust.NewDust(new Vector2(Projectile.position.X + (float)fourConst, Projectile.position.Y + (float)fourConst), Projectile.width - fourConst * 2, Projectile.height - fourConst * 2, DustID.InfernoFork, 0f, 0f, 100, default, 1.2f); Dust dust = Main.dust[fireDust]; dust.noGravity = true; dust.velocity *= 0.1f; @@ -53,7 +53,7 @@ namespace CalamityMod.Projectiles.Magic if (Main.rand.NextBool(10)) { int otherFourConst = 4; - int fireDustSmol = Dust.NewDust(new Vector2(Projectile.position.X + (float)otherFourConst, Projectile.position.Y + (float)otherFourConst), Projectile.width - otherFourConst * 2, Projectile.height - otherFourConst * 2, 174, 0f, 0f, 100, default, 0.6f); + int fireDustSmol = Dust.NewDust(new Vector2(Projectile.position.X + (float)otherFourConst, Projectile.position.Y + (float)otherFourConst), Projectile.width - otherFourConst * 2, Projectile.height - otherFourConst * 2, DustID.InfernoFork, 0f, 0f, 100, default, 0.6f); Main.dust[fireDustSmol].velocity *= 0.25f; Main.dust[fireDustSmol].velocity += Projectile.velocity * 0.5f; } @@ -83,17 +83,17 @@ namespace CalamityMod.Projectiles.Magic { Projectile.velocity.Y = -oldVelocity.Y; } - SoundEngine.PlaySound(SoundID.Item10, Projectile.position); + SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); } return false; } public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item10, Projectile.position); + SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); for (int k = 0; k < 5; k++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 174, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.InfernoFork, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } diff --git a/Projectiles/Magic/ForbiddenAxeBlade.cs b/Projectiles/Magic/ForbiddenAxeBlade.cs index 88d2c95cc5..d4a3f84892 100644 --- a/Projectiles/Magic/ForbiddenAxeBlade.cs +++ b/Projectiles/Magic/ForbiddenAxeBlade.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -47,7 +47,7 @@ namespace CalamityMod.Projectiles.Magic if (Main.rand.NextBool(8)) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 159, Projectile.velocity.X * 0.1f, Projectile.velocity.Y * 0.1f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Teleporter, Projectile.velocity.X * 0.1f, Projectile.velocity.Y * 0.1f); } } @@ -55,7 +55,7 @@ namespace CalamityMod.Projectiles.Magic { for (int k = 0; k < 3; k++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 159, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Teleporter, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } diff --git a/Projectiles/Magic/ForbiddenSunProjectile.cs b/Projectiles/Magic/ForbiddenSunProjectile.cs index 6f673e29b3..5fb8696413 100644 --- a/Projectiles/Magic/ForbiddenSunProjectile.cs +++ b/Projectiles/Magic/ForbiddenSunProjectile.cs @@ -1,7 +1,7 @@ using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.Magic } if (Projectile.localAI[0] == 0f) { - SoundEngine.PlaySound(SoundID.Item20, Projectile.position); + SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); Projectile.localAI[0] += 1f; } if (Main.rand.NextBool(4)) diff --git a/Projectiles/Magic/ForbiddenSunburst.cs b/Projectiles/Magic/ForbiddenSunburst.cs index 6585b0a41d..03785ec273 100644 --- a/Projectiles/Magic/ForbiddenSunburst.cs +++ b/Projectiles/Magic/ForbiddenSunburst.cs @@ -1,9 +1,9 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -37,7 +37,7 @@ namespace CalamityMod.Projectiles.Magic } if (Projectile.localAI[0] == 0f) { - SoundEngine.PlaySound(SoundID.Item20, Projectile.position); + SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); Projectile.localAI[0] += 1f; } float projTimer = 25f; @@ -62,7 +62,7 @@ namespace CalamityMod.Projectiles.Magic randoAdjuster = rando3 / randoAdjuster; rando1 *= randoAdjuster; rando2 *= randoAdjuster; - int orngDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 55, 0f, 0f, 100, default, 2.5f); + int orngDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Pixie, 0f, 0f, 100, default, 2.5f); Dust dust = Main.dust[orngDust]; dust.noGravity = true; dust.position.X = Projectile.Center.X; diff --git a/Projectiles/Magic/FrigidflashBoltProjectile.cs b/Projectiles/Magic/FrigidflashBoltProjectile.cs index 8949b8a4b5..4caa6bf043 100644 --- a/Projectiles/Magic/FrigidflashBoltProjectile.cs +++ b/Projectiles/Magic/FrigidflashBoltProjectile.cs @@ -1,8 +1,9 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Items.Weapons.Magic; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -42,7 +43,7 @@ namespace CalamityMod.Projectiles.Magic float shortXVel = Projectile.velocity.X / 3f * (float)i; float shortYVel = Projectile.velocity.Y / 3f * (float)i; int fourConst = 4; - int fireDust = Dust.NewDust(new Vector2(Projectile.position.X + (float)fourConst, Projectile.position.Y + (float)fourConst), Projectile.width - fourConst * 2, Projectile.height - fourConst * 2, 174, 0f, 0f, 100, default, 1.2f); + int fireDust = Dust.NewDust(new Vector2(Projectile.position.X + (float)fourConst, Projectile.position.Y + (float)fourConst), Projectile.width - fourConst * 2, Projectile.height - fourConst * 2, DustID.InfernoFork, 0f, 0f, 100, default, 1.2f); Dust dust = Main.dust[fireDust]; dust.noGravity = true; dust.velocity *= 0.1f; @@ -53,7 +54,7 @@ namespace CalamityMod.Projectiles.Magic if (Main.rand.NextBool(10)) { int otherFourConst = 4; - int fireDustSmol = Dust.NewDust(new Vector2(Projectile.position.X + (float)otherFourConst, Projectile.position.Y + (float)otherFourConst), Projectile.width - otherFourConst * 2, Projectile.height - otherFourConst * 2, 174, 0f, 0f, 100, default, 0.6f); + int fireDustSmol = Dust.NewDust(new Vector2(Projectile.position.X + (float)otherFourConst, Projectile.position.Y + (float)otherFourConst), Projectile.width - otherFourConst * 2, Projectile.height - otherFourConst * 2, DustID.InfernoFork, 0f, 0f, 100, default, 0.6f); Main.dust[fireDustSmol].velocity *= 0.25f; Main.dust[fireDustSmol].velocity += Projectile.velocity * 0.5f; } @@ -62,7 +63,7 @@ namespace CalamityMod.Projectiles.Magic float shortyX = Projectile.velocity.X / 3f * (float)j; float shortyY = Projectile.velocity.Y / 3f * (float)j; int itsAFour = 4; - int frostDust = Dust.NewDust(new Vector2(Projectile.position.X + (float)itsAFour, Projectile.position.Y + (float)itsAFour), Projectile.width - itsAFour * 2, Projectile.height - itsAFour * 2, 92, 0f, 0f, 100, default, 1.2f); + int frostDust = Dust.NewDust(new Vector2(Projectile.position.X + (float)itsAFour, Projectile.position.Y + (float)itsAFour), Projectile.width - itsAFour * 2, Projectile.height - itsAFour * 2, DustID.Frost, 0f, 0f, 100, default, 1.2f); Dust dust = Main.dust[frostDust]; dust.noGravity = true; dust.velocity *= 0.1f; @@ -73,7 +74,7 @@ namespace CalamityMod.Projectiles.Magic if (Main.rand.NextBool(10)) { int itsStillAFour = 4; - int frostDustSmol = Dust.NewDust(new Vector2(Projectile.position.X + (float)itsStillAFour, Projectile.position.Y + (float)itsStillAFour), Projectile.width - itsStillAFour * 2, Projectile.height - itsStillAFour * 2, 92, 0f, 0f, 100, default, 0.6f); + int frostDustSmol = Dust.NewDust(new Vector2(Projectile.position.X + (float)itsStillAFour, Projectile.position.Y + (float)itsStillAFour), Projectile.width - itsStillAFour * 2, Projectile.height - itsStillAFour * 2, DustID.Frost, 0f, 0f, 100, default, 0.6f); Main.dust[frostDustSmol].velocity *= 0.25f; Main.dust[frostDustSmol].velocity += Projectile.velocity * 0.5f; } @@ -103,18 +104,18 @@ namespace CalamityMod.Projectiles.Magic { Projectile.velocity.Y = -oldVelocity.Y; } - SoundEngine.PlaySound(SoundID.Item10, Projectile.position); + SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); } return false; } public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item27, Projectile.position); + SoundEngine.PlaySound(FrigidflashBolt.ProjDeathSound, Projectile.Center); for (int k = 0; k < 3; k++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 174, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 92, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.InfernoFork, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Frost, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } diff --git a/Projectiles/Magic/FrostBoltProjectile.cs b/Projectiles/Magic/FrostBoltProjectile.cs index 3c0d3e3678..06cadcc66d 100644 --- a/Projectiles/Magic/FrostBoltProjectile.cs +++ b/Projectiles/Magic/FrostBoltProjectile.cs @@ -1,8 +1,8 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.Magic float shortXVel = Projectile.velocity.X / 3f * (float)i; float shortYVel = Projectile.velocity.Y / 3f * (float)i; int fourConst = 4; - int frostDust = Dust.NewDust(new Vector2(Projectile.position.X + (float)fourConst, Projectile.position.Y + (float)fourConst), Projectile.width - fourConst * 2, Projectile.height - fourConst * 2, 92, 0f, 0f, 100, default, 1.2f); + int frostDust = Dust.NewDust(new Vector2(Projectile.position.X + (float)fourConst, Projectile.position.Y + (float)fourConst), Projectile.width - fourConst * 2, Projectile.height - fourConst * 2, DustID.Frost, 0f, 0f, 100, default, 1.2f); Dust dust = Main.dust[frostDust]; dust.noGravity = true; dust.velocity *= 0.1f; @@ -54,7 +54,7 @@ namespace CalamityMod.Projectiles.Magic if (Main.rand.NextBool(10)) { int otherFourConst = 4; - int frostDustSmol = Dust.NewDust(new Vector2(Projectile.position.X + (float)otherFourConst, Projectile.position.Y + (float)otherFourConst), Projectile.width - otherFourConst * 2, Projectile.height - otherFourConst * 2, 92, 0f, 0f, 100, default, 0.6f); + int frostDustSmol = Dust.NewDust(new Vector2(Projectile.position.X + (float)otherFourConst, Projectile.position.Y + (float)otherFourConst), Projectile.width - otherFourConst * 2, Projectile.height - otherFourConst * 2, DustID.Frost, 0f, 0f, 100, default, 0.6f); Main.dust[frostDustSmol].velocity *= 0.25f; Main.dust[frostDustSmol].velocity += Projectile.velocity * 0.5f; } @@ -84,17 +84,17 @@ namespace CalamityMod.Projectiles.Magic { Projectile.velocity.Y = -oldVelocity.Y; } - SoundEngine.PlaySound(SoundID.Item10, Projectile.position); + SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); } return false; } public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item27, Projectile.position); + SoundEngine.PlaySound(SoundID.Item27, Projectile.Center); for (int k = 0; k < 5; k++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 92, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Frost, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } diff --git a/Projectiles/Magic/GammaLaser.cs b/Projectiles/Magic/GammaLaser.cs index 1e087b7a56..85f8aa17ec 100644 --- a/Projectiles/Magic/GammaLaser.cs +++ b/Projectiles/Magic/GammaLaser.cs @@ -1,5 +1,5 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -30,10 +30,10 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { Lighting.AddLight(Projectile.Center, 0.1f, 0.35f, 0f); - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) - 1.57f; + Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; if (Main.rand.NextBool(7)) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 74, 0f, 0f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.GreenFairy, 0f, 0f); } } diff --git a/Projectiles/Magic/GenesisBeam.cs b/Projectiles/Magic/GenesisBeam.cs new file mode 100644 index 0000000000..a1b782a551 --- /dev/null +++ b/Projectiles/Magic/GenesisBeam.cs @@ -0,0 +1,121 @@ +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class GenesisBeam : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Magic"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public ref float time => ref Projectile.ai[0]; + public ref float isSplit => ref Projectile.ai[1]; + public bool splitShot = false; + + public Color mainColor = Color.MediumSlateBlue; + public override void SetDefaults() + { + Projectile.width = 12; + Projectile.height = 12; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.tileCollide = false; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 31; + Projectile.penetrate = -1; + Projectile.extraUpdates = 75; + Projectile.timeLeft = 20; + } + public override void AI() + { + if (isSplit == 0) + splitShot = true; + if (time == 0) + { + if (splitShot) + Projectile.penetrate = 1; + else + Projectile.timeLeft = 50; + } + + if (Projectile.timeLeft % 2 == 0 && (!splitShot && time > 2 || (splitShot && time > 3 && Projectile.timeLeft > 2))) + { + Particle spark = new GlowSparkParticle(Projectile.Center, -Projectile.velocity * 0.05f, false, 17, 0.06f, mainColor, new Vector2(0.5f, 1.3f)); + GeneralParticleHandler.SpawnParticle(spark); + } + + Vector2 dustVel = new Vector2(2, 2).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 0.8f); + Dust dust = Dust.NewDustPerfect(Projectile.Center + dustVel, Main.rand.NextBool(4) ? 264 : 66, dustVel, 0, default, Main.rand.NextFloat(0.9f, 1.2f)); + dust.noGravity = true; + dust.color = Main.rand.NextBool() ? Color.Lerp(mainColor, Color.White, 0.5f) : mainColor; + + time++; + } + public override void OnKill(int timeLeft) + { + int numProj = 2; + float rotation = MathHelper.ToRadians(20); + if (splitShot) + { + for (int i = 0; i < numProj; i++) + { + Vector2 perturbedSpeed = Projectile.velocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, perturbedSpeed, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 1f); + for (int k = 0; k < 3; k++) + { + Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, mainColor, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 0.5f, 0.4f, 35); + GeneralParticleHandler.SpawnParticle(blastRing); + Particle blastRing2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 0.4f, 0.3f, 35); + GeneralParticleHandler.SpawnParticle(blastRing2); + } + } + + for (int i = 0; i < 20; i++) + { + Vector2 dustVel = new Vector2(13, 13).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 0.8f); + Dust dust = Dust.NewDustPerfect(Projectile.Center + dustVel, Main.rand.NextBool(4) ? 264 : 66, dustVel, 0, default, Main.rand.NextFloat(0.9f, 1.2f)); + dust.noGravity = true; + dust.color = Main.rand.NextBool() ? Color.Lerp(mainColor, Color.White, 0.5f) : mainColor; + } + } + else + { + for (int i = 0; i < 18; i++) + { + Vector2 dustVel = Projectile.velocity * Main.rand.NextFloat(0.1f, 1.5f); + Dust dust = Dust.NewDustPerfect(Projectile.Center + dustVel + Main.rand.NextVector2Circular(6, 6), Main.rand.NextBool(4) ? 264 : 66, dustVel, 0, default, Main.rand.NextFloat(0.9f, 1.2f)); + dust.noGravity = true; + dust.color = Main.rand.NextBool() ? Color.Lerp(mainColor, Color.White, 0.5f) : mainColor; + } + } + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + if (splitShot) // This is the sweet spot + { + modifiers.SourceDamage *= 1.5f; + + int points = 10; + float radians = MathHelper.TwoPi / points; + Vector2 spinningPoint = Vector2.Normalize(new Vector2(-1f, -1f)); + float rotRando = Main.rand.NextFloat(0.1f, 2.5f); + for (int k = 0; k < points; k++) + { + Vector2 velocity = spinningPoint.RotatedBy(radians * k).RotatedBy(-0.45f * rotRando); + Particle subTrail = new GlowSparkParticle(Projectile.Center + velocity * 10.5f, velocity * 5, false, 10, 0.045f, mainColor, new Vector2(2, 0.4f), true); + GeneralParticleHandler.SpawnParticle(subTrail); + } + + SoundStyle fire = new("CalamityMod/Sounds/Item/ArcNovaDiffuserChargeImpact"); + SoundEngine.PlaySound(fire with { Volume = 1.25f, Pitch = 0.4f, PitchVariance = 0.15f }, Projectile.Center); + } + if (Projectile.numHits > 0) + Projectile.damage = (int)(Projectile.damage * 0.95f); + if (Projectile.damage < 1) + Projectile.damage = 1; + } + } +} diff --git a/Projectiles/Magic/GenesisHoldout.cs b/Projectiles/Magic/GenesisHoldout.cs new file mode 100644 index 0000000000..5f25eaeac0 --- /dev/null +++ b/Projectiles/Magic/GenesisHoldout.cs @@ -0,0 +1,160 @@ +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Particles; +using CalamityMod.Projectiles.BaseProjectiles; +using Microsoft.Xna.Framework; +using ReLogic.Utilities; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class GenesisHoldout : BaseGunHoldoutProjectile + { + public override int AssociatedItemID => ModContent.ItemType(); + public override Vector2 GunTipPosition => base.GunTipPosition - Vector2.UnitY.RotatedBy(Projectile.rotation) * 2.5f * Projectile.spriteDirection; + public override float MaxOffsetLengthFromArm => 10f; + public override float OffsetXUpwards => -5f; + public override float BaseOffsetY => -5f; + public override float OffsetYDownwards => 5f; + + public Color StaticEffectsColor = Color.MediumSlateBlue; + + public float FiringTime = 15; + public float Windup = 60; + public bool WindingUp = false; + public int time = 0; + public bool fireYBeam = false; + public int maxFirerateShots = 0; + + private ref float ShootingTimer => ref Projectile.ai[0]; + + public override void KillHoldoutLogic() + { + if (HeldItem.type != Owner.ActiveItem().type || Owner is null || !Owner.active || Owner.CCed || Owner.dead || Owner.noItems) + { + Projectile.Kill(); + Projectile.netUpdate = true; + } + } + + public override void HoldoutAI() + { + Item heldItem = Owner.ActiveItem(); + // Fire if the owner stops channeling or otherwise cannot use the weapon. + if (Owner.CantUseHoldout()) + { + Projectile.Kill(); + } + else if (ShootingTimer >= FiringTime) + { + if (Owner.CheckMana(Owner.ActiveItem(), -1, true, false)) + { + maxFirerateShots++; + + if (maxFirerateShots == 6) + { + fireYBeam = true; + Windup = 60; + } + + if (fireYBeam) + { + Shoot(heldItem, true); + maxFirerateShots = 0; + } + else + Shoot(heldItem, false); + + ShootingTimer = 0; + + if (Windup > 10) + { + if (!fireYBeam) + Windup -= 12; + } + else + { + Windup = 10; + } + + fireYBeam = false; + } + else + { + SoundEngine.PlaySound(SoundID.MaxMana with { Pitch = -0.5f }, Projectile.Center); + Projectile.Kill(); + } + + } + ShootingTimer++; + } + private void Shoot(Item item, bool yBeam) + { + Vector2 shootDirection = Projectile.velocity.SafeNormalize(Vector2.Zero); + + // Spawns the projectile. + + Vector2 firingVelocity1 = (shootDirection * 8).RotatedBy(0.1f * Utils.GetLerpValue(10, 55, Windup, true)); + Vector2 firingVelocity2 = (shootDirection * 8).RotatedBy(-0.1f * Utils.GetLerpValue(10, 55, Windup, true)); + Vector2 firingVelocity3 = (shootDirection * 10); + + if (yBeam) + { + SoundStyle fire = new("CalamityMod/Sounds/Item/LanceofDestinyStrong"); + SoundEngine.PlaySound(fire with { Volume = 0.35f, Pitch = 1f, PitchVariance = 0.15f }, Projectile.Center); + + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), GunTipPosition, firingVelocity3, ModContent.ProjectileType(), Projectile.damage * 9, Projectile.knockBack, Projectile.owner, 0, 0); + + Particle pulse3 = new GlowSparkParticle(GunTipPosition, shootDirection * 18, false, 6, 0.057f, StaticEffectsColor, new Vector2(1.7f, 0.8f), true); + GeneralParticleHandler.SpawnParticle(pulse3); + for (int i = 0; i < 8; i++) + { + SparkParticle spark2 = new SparkParticle(GunTipPosition + Main.rand.NextVector2Circular(10, 10), firingVelocity3 * Main.rand.NextFloat(0.7f, 1.3f), false, Main.rand.Next(20, 30), Main.rand.NextFloat(0.4f, 0.55f), StaticEffectsColor); + GeneralParticleHandler.SpawnParticle(spark2); + } + } + else + { + SoundStyle fire = new("CalamityMod/Sounds/Item/MagnaCannonShot"); + SoundEngine.PlaySound(fire with { Volume = 0.25f, Pitch = 1f, PitchVariance = 0.35f }, Projectile.Center); + + for (int i = 0; i < 4; i++) + { + firingVelocity3 = (shootDirection * 10).RotatedBy((0.05f * (i + 1)) * Utils.GetLerpValue(0, 55, Windup, true)); + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), GunTipPosition, firingVelocity3 * (1 - i * 0.1f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0, 1); + } + for (int i = 0; i < 4; i++) + { + firingVelocity3 = (shootDirection * 10).RotatedBy((-0.05f * (i + 1)) * Utils.GetLerpValue(0, 55, Windup, true)); + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), GunTipPosition, firingVelocity3 * (1 - i * 0.1f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0, 1); + } + + Particle pulse3 = new GlowSparkParticle(GunTipPosition, shootDirection * 18, false, 6, 0.057f, StaticEffectsColor, new Vector2(1.7f, 0.8f), true); + GeneralParticleHandler.SpawnParticle(pulse3); + } + + // Inside here go all the things that dedicated servers shouldn't spend resources on. + // Like visuals and sounds. + if (Main.dedServ) + return; + + for (int k = 0; k < 10; k++) + { + Vector2 shootVel = (shootDirection * 15).RotatedByRandom(0.5f) * Main.rand.NextFloat(0.1f, 1.8f); + + Dust dust2 = Dust.NewDustPerfect(GunTipPosition, Main.rand.NextBool(4) ? 267 : 66, shootVel); + dust2.scale = Main.rand.NextFloat(1.15f, 1.45f); + dust2.noGravity = true; + dust2.color = Main.rand.NextBool() ? Color.Lerp(StaticEffectsColor, Color.White, 0.5f) : StaticEffectsColor; + } + + // By decreasing the offset length of the gun from the arms, we give an effect of recoil. + if (yBeam) + OffsetLengthFromArm -= 27f; + else + OffsetLengthFromArm -= 5f; + } + } +} diff --git a/Projectiles/Magic/GhastlyBlast.cs b/Projectiles/Magic/GhastlyBlast.cs index e14eaeca67..20c61f0dab 100644 --- a/Projectiles/Magic/GhastlyBlast.cs +++ b/Projectiles/Magic/GhastlyBlast.cs @@ -1,9 +1,9 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -51,7 +51,7 @@ namespace CalamityMod.Projectiles.Magic if (!goingSlow && !currentlyHoming) { // Spin at a certain rate - Projectile.rotation -= 0.104719758f; + Projectile.rotation -= MathHelper.Pi / 30f; // Dust, randomly if (Main.rand.NextBool(3)) @@ -59,7 +59,7 @@ namespace CalamityMod.Projectiles.Magic if (Main.rand.NextBool()) { Vector2 vector140 = Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi); - Dust ghostlyRed = Main.dust[Dust.NewDust(Projectile.Center - vector140 * 30f, 0, 0, 60, 0f, 0f, 0, default, 1f)]; + Dust ghostlyRed = Main.dust[Dust.NewDust(Projectile.Center - vector140 * 30f, 0, 0, DustID.RedTorch, 0f, 0f, 0, default, 1f)]; ghostlyRed.noGravity = true; ghostlyRed.position = Projectile.Center - vector140 * Main.rand.Next(10, 21); ghostlyRed.velocity = vector140.RotatedBy(MathHelper.PiOver2) * 6f; @@ -70,7 +70,7 @@ namespace CalamityMod.Projectiles.Magic else { Vector2 vector141 = Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi); - Dust ghostlyRedder = Main.dust[Dust.NewDust(Projectile.Center - vector141 * 30f, 0, 0, 60, 0f, 0f, 0, default, 1f)]; + Dust ghostlyRedder = Main.dust[Dust.NewDust(Projectile.Center - vector141 * 30f, 0, 0, DustID.RedTorch, 0f, 0f, 0, default, 1f)]; ghostlyRedder.noGravity = true; ghostlyRedder.position = Projectile.Center - vector141 * 30f; ghostlyRedder.velocity = vector141.RotatedBy(-MathHelper.PiOver2) * 3f; @@ -105,7 +105,7 @@ namespace CalamityMod.Projectiles.Magic else { // Spin at the exact same rate anyway - Projectile.rotation -= 0.104719758f; + Projectile.rotation -= MathHelper.Pi / 30f; // Excessively complicated dust int inc; @@ -114,7 +114,7 @@ namespace CalamityMod.Projectiles.Magic if (Main.rand.NextBool()) { Vector2 dustRotate = Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi); - Dust complexDust = Main.dust[Dust.NewDust(Projectile.Center - dustRotate * 30f, 0, 0, 60, 0f, 0f, 0, default, 1f)]; + Dust complexDust = Main.dust[Dust.NewDust(Projectile.Center - dustRotate * 30f, 0, 0, DustID.RedTorch, 0f, 0f, 0, default, 1f)]; complexDust.noGravity = true; complexDust.position = Projectile.Center - dustRotate * Main.rand.Next(10, 21); complexDust.velocity = dustRotate.RotatedBy(MathHelper.PiOver2) * 6f; @@ -133,7 +133,7 @@ namespace CalamityMod.Projectiles.Magic else { Vector2 moreDustRotate = Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi); - Dust complicatedDust = Main.dust[Dust.NewDust(Projectile.Center - moreDustRotate * 30f, 0, 0, 60, 0f, 0f, 0, default, 1f)]; + Dust complicatedDust = Main.dust[Dust.NewDust(Projectile.Center - moreDustRotate * 30f, 0, 0, DustID.RedTorch, 0f, 0f, 0, default, 1f)]; complicatedDust.noGravity = true; complicatedDust.position = Projectile.Center - moreDustRotate * Main.rand.Next(20, 31); complicatedDust.velocity = moreDustRotate.RotatedBy(-MathHelper.PiOver2) * 5f; @@ -153,7 +153,7 @@ namespace CalamityMod.Projectiles.Magic // Undocumented, unrefactored homing. Will not home through walls. // Apparently has two different homing distances. - // ^ See, this is why num variables are EVIL.... -CIT + // ^ See, this is why num variables are EVIL.... -CIT Vector2 projCenter = Projectile.Center; float homingRange = 500f; bool isHoming = false; @@ -206,7 +206,7 @@ namespace CalamityMod.Projectiles.Magic { float HomingVelocity = 24f; int HomingN = 8; - Vector2 projDistance = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); + Vector2 projDistance = Projectile.Center; float dx = projCenter.X - projDistance.X; float dy = projCenter.Y - projDistance.Y; float dist = (float)Math.Sqrt((double)(dx * dx + dy * dy)); @@ -249,21 +249,21 @@ namespace CalamityMod.Projectiles.Magic Projectile.maxPenetrate = -1; Projectile.penetrate = -1; Projectile.Damage(); - SoundEngine.PlaySound(SoundID.Item14, Projectile.position); + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); for (int i = 0; i < 4; i++) { - int killRed = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 100, default, 1.5f); + int killRed = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RedTorch, 0f, 0f, 100, default, 1.5f); Main.dust[killRed].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; } for (int j = 0; j < 30; j++) { - int killRed2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 200, default, 3.7f); + int killRed2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RedTorch, 0f, 0f, 200, default, 3.7f); Dust dust = Main.dust[killRed2]; dust.position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; dust.noGravity = true; dust.velocity *= 3f; - killRed2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 100, default, 1.5f); + killRed2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RedTorch, 0f, 0f, 100, default, 1.5f); dust.position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; dust.velocity *= 2f; dust.noGravity = true; @@ -272,7 +272,7 @@ namespace CalamityMod.Projectiles.Magic } for (int k = 0; k < 10; k++) { - int killRed3 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 0, default, 2.7f); + int killRed3 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RedTorch, 0f, 0f, 0, default, 2.7f); Dust dust = Main.dust[killRed3]; dust.position = Projectile.Center + Vector2.UnitX.RotatedByRandom(MathHelper.Pi).RotatedBy(Projectile.velocity.ToRotation()) * Projectile.width / 2f; dust.noGravity = true; @@ -280,7 +280,7 @@ namespace CalamityMod.Projectiles.Magic } for (int l = 0; l < 10; l++) { - int killRed4 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 0, default, 1.5f); + int killRed4 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RedTorch, 0f, 0f, 0, default, 1.5f); Dust dust = Main.dust[killRed4]; dust.position = Projectile.Center + Vector2.UnitX.RotatedByRandom(MathHelper.Pi).RotatedBy(Projectile.velocity.ToRotation()) * Projectile.width / 2f; dust.noGravity = true; diff --git a/Projectiles/Magic/GhastlyExplosion.cs b/Projectiles/Magic/GhastlyExplosion.cs index 265bd0bd31..1f353d8258 100644 --- a/Projectiles/Magic/GhastlyExplosion.cs +++ b/Projectiles/Magic/GhastlyExplosion.cs @@ -1,8 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Magic int dustType = (int)Projectile.ai[0]; for (int i = 0; i < 3; i = inc + 1) { - int ghostlyRed = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, Projectile.velocity.X, Projectile.velocity.Y, dustType, default, 1.2f); + int ghostlyRed = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RedTorch, Projectile.velocity.X, Projectile.velocity.Y, dustType, default, 1.2f); Main.dust[ghostlyRed].position = (Main.dust[ghostlyRed].position + Projectile.Center) / 2f; Main.dust[ghostlyRed].noGravity = true; Dust dust = Main.dust[ghostlyRed]; @@ -36,7 +36,7 @@ namespace CalamityMod.Projectiles.Magic } for (int j = 0; j < 2; j = inc + 1) { - int ghostlyRed = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, Projectile.velocity.X, Projectile.velocity.Y, dustType, default, 0.4f); + int ghostlyRed = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RedTorch, Projectile.velocity.X, Projectile.velocity.Y, dustType, default, 0.4f); if (j == 0) { Main.dust[ghostlyRed].position = (Main.dust[ghostlyRed].position + Projectile.Center * 5f) / 6f; @@ -56,11 +56,11 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item50, Projectile.position); + SoundEngine.PlaySound(SoundID.Item50, Projectile.Center); int inc; for (int i = 0; i < 20; i = inc + 1) { - int killDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)Projectile.ai[0], Projectile.velocity.X * 0.1f, Projectile.velocity.Y * 0.1f, 0, default, 0.5f); + int killDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)Projectile.ai[0], Projectile.velocity.X * 0.1f, Projectile.velocity.Y * 0.1f, 0, default, 0.5f); Dust dust; Main.dust[killDust].scale = 1.2f + (float)Main.rand.Next(-10, 11) * 0.01f; Main.dust[killDust].noGravity = true; diff --git a/Projectiles/Magic/GhastlyExplosionShard.cs b/Projectiles/Magic/GhastlyExplosionShard.cs index 2542eb568f..e5cffcf043 100644 --- a/Projectiles/Magic/GhastlyExplosionShard.cs +++ b/Projectiles/Magic/GhastlyExplosionShard.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic @@ -40,7 +40,7 @@ namespace CalamityMod.Projectiles.Magic int inc; for (int i = 0; i < 2; i = inc + 1) { - int explodeDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, Projectile.velocity.X, Projectile.velocity.Y, 50, default, 1.1f); + int explodeDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, Projectile.velocity.X, Projectile.velocity.Y, 50, default, 1.1f); Main.dust[explodeDust].position = (Main.dust[explodeDust].position + Projectile.Center) / 2f; Main.dust[explodeDust].noGravity = true; Dust dust = Main.dust[explodeDust]; @@ -52,7 +52,7 @@ namespace CalamityMod.Projectiles.Magic for (int j = 0; j < 1; j = inc + 1) { - int explodeDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, Projectile.velocity.X, Projectile.velocity.Y, 50, default, 0.6f); + int explodeDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, Projectile.velocity.X, Projectile.velocity.Y, 50, default, 0.6f); Main.dust[explodeDust].position = (Main.dust[explodeDust].position + Projectile.Center * 5f) / 6f; Dust dust = Main.dust[explodeDust]; dust.velocity *= 0.1f; @@ -72,7 +72,7 @@ namespace CalamityMod.Projectiles.Magic int inc; for (int i = 0; i < 10; i = inc + 1) { - int killDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)Projectile.ai[0], Projectile.velocity.X * 0.1f, Projectile.velocity.Y * 0.1f, 0, default, 0.5f); + int killDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)Projectile.ai[0], Projectile.velocity.X * 0.1f, Projectile.velocity.Y * 0.1f, 0, default, 0.5f); Dust dust; Main.dust[killDust].scale = 1f + Main.rand.Next(-10, 11) * 0.01f; Main.dust[killDust].noGravity = true; diff --git a/Projectiles/Magic/GhastlySubBlast.cs b/Projectiles/Magic/GhastlySubBlast.cs index 56147fae13..2521ebc877 100644 --- a/Projectiles/Magic/GhastlySubBlast.cs +++ b/Projectiles/Magic/GhastlySubBlast.cs @@ -1,7 +1,9 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Magic { public class GhastlySubBlast : ModProjectile, ILocalizedModType @@ -70,7 +72,7 @@ namespace CalamityMod.Projectiles.Magic } if (Main.rand.NextBool()) { - int ghostlyRed = Dust.NewDust(Projectile.Center, 8, 8, 60, 0f, 0f, 0, default, 1f); + int ghostlyRed = Dust.NewDust(Projectile.Center, 8, 8, DustID.RedTorch, 0f, 0f, 0, default, 1f); Main.dust[ghostlyRed].position = Projectile.Center; Main.dust[ghostlyRed].velocity = Projectile.velocity; Main.dust[ghostlyRed].noGravity = true; diff --git a/Projectiles/Magic/GhastlyVisageProj.cs b/Projectiles/Magic/GhastlyVisageProj.cs index 5ac1b0be89..1946027091 100644 --- a/Projectiles/Magic/GhastlyVisageProj.cs +++ b/Projectiles/Magic/GhastlyVisageProj.cs @@ -1,7 +1,7 @@ -using CalamityMod.Items.Weapons.Magic; +using System; +using CalamityMod.Items.Weapons.Magic; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -68,7 +68,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.ai[1] = (float)(soundDelayer - soundDelayMult * aiSoundDelay); isActive = true; } - bool canUseItem = player.channel && !player.noItems && !player.CCed; + bool canUseItem = !player.CantUseHoldout(); if (Projectile.localAI[0] > 0f) { Projectile.localAI[0] -= 1f; @@ -110,7 +110,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.soundDelay = soundDelayer - soundDelayMult * aiSoundDelay; if (isActive) - SoundEngine.PlaySound(SoundID.Item117, Projectile.position); + SoundEngine.PlaySound(SoundID.Item117, Projectile.Center); } else if (Projectile.soundDelay <= 0 && canUseItem) { @@ -147,7 +147,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.soundDelay = soundDelayer - soundDelayMult * aiSoundDelay; if (Projectile.ai[0] != 1f && isActive) { - SoundEngine.PlaySound(SoundID.Item117, Projectile.position); + SoundEngine.PlaySound(SoundID.Item117, Projectile.Center); } Projectile.localAI[0] = 12f; } @@ -203,8 +203,8 @@ namespace CalamityMod.Projectiles.Magic public override void PostDraw(Color lightColor) { - Texture2D texture2D13 = ModContent.Request(Texture).Value; - int framing = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; + Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + int framing = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; int y6 = framing * Projectile.frame; Vector2 origin = new Vector2(13f, 16f); SpriteEffects spriteEffects = SpriteEffects.None; diff --git a/Projectiles/Magic/GleamingBolt.cs b/Projectiles/Magic/GleamingBolt.cs index dd44f71df5..1443b9062c 100644 --- a/Projectiles/Magic/GleamingBolt.cs +++ b/Projectiles/Magic/GleamingBolt.cs @@ -1,8 +1,8 @@ using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { public class GleamingBolt : ModProjectile, ILocalizedModType @@ -57,7 +57,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)(Projectile.damage * 0.75), Projectile.knockBack, Projectile.owner, 0f, 0f); } } - SoundEngine.PlaySound(SoundID.Item105, Projectile.position); + SoundEngine.PlaySound(SoundID.Item105, Projectile.Center); } } } diff --git a/Projectiles/Magic/GleamingBolt2.cs b/Projectiles/Magic/GleamingBolt2.cs index d7ef4c1b36..a00c158bd9 100644 --- a/Projectiles/Magic/GleamingBolt2.cs +++ b/Projectiles/Magic/GleamingBolt2.cs @@ -1,5 +1,5 @@ +using System; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic diff --git a/Projectiles/Magic/GraniteEnergy.cs b/Projectiles/Magic/GraniteEnergy.cs index 15dc5a5d4f..3cdddd4d79 100644 --- a/Projectiles/Magic/GraniteEnergy.cs +++ b/Projectiles/Magic/GraniteEnergy.cs @@ -1,7 +1,9 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Magic { public class GraniteEnergy : ModProjectile, ILocalizedModType @@ -23,7 +25,7 @@ namespace CalamityMod.Projectiles.Magic { Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.ToRadians(90); if (Main.rand.NextBool()) - Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 229, 0f, 0f, 100, default, 0.6f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Vortex, 0f, 0f, 100, default, 0.6f); if (Projectile.timeLeft < 60) CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 600f, 12f, 20f); diff --git a/Projectiles/Magic/GranitePulse.cs b/Projectiles/Magic/GranitePulse.cs index ed6cc4df7c..2a75dd05e4 100644 --- a/Projectiles/Magic/GranitePulse.cs +++ b/Projectiles/Magic/GranitePulse.cs @@ -1,10 +1,10 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { public class GranitePulse : ModProjectile, ILocalizedModType @@ -93,7 +93,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.ExpandHitboxBy(20); for (int d = 0; d < 5; d++) { - int ecto = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 229, 0f, 0f, 100, default, 0.5f); + int ecto = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Vortex, 0f, 0f, 100, default, 0.5f); Main.dust[ecto].velocity *= 3f; if (Main.rand.NextBool()) { @@ -103,10 +103,10 @@ namespace CalamityMod.Projectiles.Magic } for (int d = 0; d < 10; d++) { - int ecto = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 206, 0f, 0f, 100, default, 1f); + int ecto = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.UnusedWhiteBluePurple, 0f, 0f, 100, default, 1f); Main.dust[ecto].noGravity = true; Main.dust[ecto].velocity *= 5f; - ecto = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 206, 0f, 0f, 100, default, 0.5f); + ecto = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.UnusedWhiteBluePurple, 0f, 0f, 100, default, 0.5f); Main.dust[ecto].velocity *= 2f; } initialized = true; @@ -117,7 +117,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.ExpandHitboxBy(20); for (int d = 0; d < 5; d++) { - int ecto = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 229, 0f, 0f, 100, default, 0.5f); + int ecto = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Vortex, 0f, 0f, 100, default, 0.5f); Main.dust[ecto].velocity *= 3f; if (Main.rand.NextBool()) { @@ -127,10 +127,10 @@ namespace CalamityMod.Projectiles.Magic } for (int d = 0; d < 10; d++) { - int ecto = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 206, 0f, 0f, 100, default, 1f); + int ecto = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.UnusedWhiteBluePurple, 0f, 0f, 100, default, 1f); Main.dust[ecto].noGravity = true; Main.dust[ecto].velocity *= 5f; - ecto = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 206, 0f, 0f, 100, default, 0.5f); + ecto = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.UnusedWhiteBluePurple, 0f, 0f, 100, default, 0.5f); Main.dust[ecto].velocity *= 2f; } if (Projectile.owner == Main.myPlayer) @@ -146,7 +146,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; int height = texture.Height / Main.projFrames[Projectile.type]; int frameHeight = height * Projectile.frame; Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, frameHeight, texture.Width, height)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, height / 2f), Projectile.scale, SpriteEffects.None, 0); diff --git a/Projectiles/Magic/HadalUrnHoldout.cs b/Projectiles/Magic/HadalUrnHoldout.cs index 123b87d3a3..1a806f98cf 100644 --- a/Projectiles/Magic/HadalUrnHoldout.cs +++ b/Projectiles/Magic/HadalUrnHoldout.cs @@ -1,6 +1,6 @@ -using CalamityMod.Items.Weapons.Magic; +using System; +using CalamityMod.Items.Weapons.Magic; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -32,7 +32,7 @@ namespace CalamityMod.Projectiles.Magic Player player = Main.player[Projectile.owner]; float rotoffset = MathHelper.PiOver2; Vector2 playerpos = player.RotatedRelativePoint(player.MountedCenter, true); - bool shouldBeHeld = player.channel && !player.noItems && !player.CCed; + bool shouldBeHeld = !player.CantUseHoldout(); Projectile.damage = player.ActiveItem() is null ? 0 : player.GetWeaponDamage(player.ActiveItem()); if (Projectile.ai[0] > 0f) { @@ -66,7 +66,7 @@ namespace CalamityMod.Projectiles.Magic bool manaCostPaid = player.CheckMana(player.ActiveItem(), -1, true, false); if (manaCostPaid) { - SoundEngine.PlaySound(SoundID.Item111, Projectile.position); + SoundEngine.PlaySound(SoundID.Item111, Projectile.Center); int projcount = 3; for (int i = 0; i < projcount; ++i) { @@ -94,7 +94,7 @@ namespace CalamityMod.Projectiles.Magic break; default: projType = ModContent.ProjectileType(); - projDamage = (int)(projDamage * 1.5f); + projDamage = (int)(projDamage * 1.75f); speedscale = speedscale * 1.5f; break; } @@ -107,18 +107,18 @@ namespace CalamityMod.Projectiles.Magic } Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, shotSpeed, projType, projDamage, Projectile.knockBack, player.whoAmI, ai); } - Projectile.ai[0] = 12; + Projectile.ai[0] = 16; } else { - SoundEngine.PlaySound(UrnSound, Projectile.position); + SoundEngine.PlaySound(UrnSound, Projectile.Center); Projectile.Kill(); } } } else { - SoundEngine.PlaySound(UrnSound, Projectile.position); + SoundEngine.PlaySound(UrnSound, Projectile.Center); Projectile.Kill(); } } diff --git a/Projectiles/Magic/HadalUrnIsopod.cs b/Projectiles/Magic/HadalUrnIsopod.cs index 6ecee1d2a5..1ac62e58f1 100644 --- a/Projectiles/Magic/HadalUrnIsopod.cs +++ b/Projectiles/Magic/HadalUrnIsopod.cs @@ -1,9 +1,9 @@ using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -24,6 +24,8 @@ namespace CalamityMod.Projectiles.Magic Projectile.timeLeft = 240; Projectile.DamageType = DamageClass.Magic; Projectile.ignoreWater = true; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() @@ -56,12 +58,12 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item10, Projectile.position); + SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); //Black Anurian bubble dust int inc; for (int i = 0; i < 25; i = inc + 1) { - int hadalDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 14, 0f, 0f, 0, default, 1f); + int hadalDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Demonite, 0f, 0f, 0, default, 1f); Main.dust[hadalDust].position = (Main.dust[hadalDust].position + Projectile.position) / 2f; Main.dust[hadalDust].velocity = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); Main.dust[hadalDust].velocity.Normalize(); diff --git a/Projectiles/Magic/HadalUrnJellyfish.cs b/Projectiles/Magic/HadalUrnJellyfish.cs index 4d4aef0ef4..ed56c37ba2 100644 --- a/Projectiles/Magic/HadalUrnJellyfish.cs +++ b/Projectiles/Magic/HadalUrnJellyfish.cs @@ -113,7 +113,7 @@ namespace CalamityMod.Projectiles.Magic Bloom.Position = Projectile.Center; Projectile.penetrate = -1; - Projectile.localNPCHitCooldown = 6; + Projectile.localNPCHitCooldown = 10; } } //Once the aura dies, shrink back to normal size and disappear (it ran out of juice) @@ -130,7 +130,7 @@ namespace CalamityMod.Projectiles.Magic } public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; int textureheight = tex.Height / Main.projFrames[Projectile.type]; int y = textureheight * Projectile.frame; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y, tex.Width, textureheight)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)tex.Width / 2f, (float)textureheight / 2f), Projectile.scale, SpriteEffects.None, 0); diff --git a/Projectiles/Magic/HadalUrnLamprey.cs b/Projectiles/Magic/HadalUrnLamprey.cs index 8a1007c8b2..972180a9d2 100644 --- a/Projectiles/Magic/HadalUrnLamprey.cs +++ b/Projectiles/Magic/HadalUrnLamprey.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic @@ -20,12 +21,12 @@ namespace CalamityMod.Projectiles.Magic Projectile.width = 18; Projectile.height = 18; Projectile.friendly = true; - Projectile.penetrate = -1; + Projectile.penetrate = 5; Projectile.alpha = 255; Projectile.DamageType = DamageClass.Magic; Projectile.timeLeft = 600; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 45; + Projectile.localNPCHitCooldown = 60; } public override void AI() @@ -85,7 +86,7 @@ namespace CalamityMod.Projectiles.Magic } } - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) => Projectile.ModifyHitNPCSticky(5); + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) => Projectile.ModifyHitNPCSticky(4); public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { @@ -98,7 +99,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; int textureheight = tex.Height / Main.projFrames[Projectile.type]; int y = textureheight * Projectile.frame; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y, tex.Width, textureheight)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(tex.Width, tex.Height / 16f), Projectile.scale, SpriteEffects.None, 0); @@ -111,7 +112,7 @@ namespace CalamityMod.Projectiles.Magic int inc; for (int i = 0; i < 25; i = inc + 1) { - int hadalDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 14, 0f, 0f, 0, default, 1f); + int hadalDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Demonite, 0f, 0f, 0, default, 1f); Main.dust[hadalDust].position = (Main.dust[hadalDust].position + Projectile.position) / 2f; Main.dust[hadalDust].velocity = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); Main.dust[hadalDust].velocity.Normalize(); diff --git a/Projectiles/Magic/HadalUrnStarfish.cs b/Projectiles/Magic/HadalUrnStarfish.cs index 704a017d17..d2043be509 100644 --- a/Projectiles/Magic/HadalUrnStarfish.cs +++ b/Projectiles/Magic/HadalUrnStarfish.cs @@ -1,10 +1,10 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.Magic { Projectile.frame = 0; Shards(); - SoundEngine.PlaySound(SoundID.Item42, Projectile.position); + SoundEngine.PlaySound(SoundID.Item42, Projectile.Center); Projectile.ai[1]++; Projectile.ai[0] = 0; } @@ -61,7 +61,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { if (Projectile.ai[1] < 2) //Do not shoot more spikes if two rounds have already been shot - Shards(); + Shards(); } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) @@ -76,7 +76,7 @@ namespace CalamityMod.Projectiles.Magic { Vector2 velocity = new Vector2(0f, 10f); velocity = velocity.RotatedBy(variance * i + Projectile.rotation); - int p = Projectile.NewProjectile(Projectile.GetSource_FromAI(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(0.33f * Projectile.damage), 0, Projectile.owner); + int p = Projectile.NewProjectile(Projectile.GetSource_FromAI(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(0.25f * Projectile.damage), 0, Projectile.owner); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Projectile.originalDamage; } diff --git a/Projectiles/Magic/HadalUrnStarfishShard.cs b/Projectiles/Magic/HadalUrnStarfishShard.cs index a445e491b3..920f9a1dd1 100644 --- a/Projectiles/Magic/HadalUrnStarfishShard.cs +++ b/Projectiles/Magic/HadalUrnStarfishShard.cs @@ -1,5 +1,5 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Magic { Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver2; if (Projectile.timeLeft <= 50) - CalamityUtils.HomeInOnNPC(Projectile, true, 600f, 20f, 20f); + CalamityUtils.HomeInOnNPC(Projectile, true, 600f, 20f, 20f); } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { diff --git a/Projectiles/Magic/HeliumFlashBlast.cs b/Projectiles/Magic/HeliumFlashBlast.cs index 3840e851ff..5e8cf54258 100644 --- a/Projectiles/Magic/HeliumFlashBlast.cs +++ b/Projectiles/Magic/HeliumFlashBlast.cs @@ -1,9 +1,9 @@ +using System; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { diff --git a/Projectiles/Magic/HellfireExplosionFriendly.cs b/Projectiles/Magic/HellfireExplosionFriendly.cs index f1a07045f4..f9d00ac445 100644 --- a/Projectiles/Magic/HellfireExplosionFriendly.cs +++ b/Projectiles/Magic/HellfireExplosionFriendly.cs @@ -1,11 +1,11 @@ +using System; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { public class HellfireExplosionFriendly : ModProjectile, ILocalizedModType @@ -32,7 +32,7 @@ namespace CalamityMod.Projectiles.Magic Lighting.AddLight(Projectile.Center, 0.9f, 0f, 0f); if (Projectile.localAI[0] == 0f) { - SoundEngine.PlaySound(SoundID.Item20, Projectile.position); + SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); Projectile.localAI[0] += 1f; } float projTimer = 25f; @@ -57,7 +57,7 @@ namespace CalamityMod.Projectiles.Magic randoAdjuster = rando3 / randoAdjuster; rando1 *= randoAdjuster; rando2 *= randoAdjuster; - int brimDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1.5f); + int brimDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1.5f); Dust dust = Main.dust[brimDust]; dust.noGravity = true; dust.position.X = Projectile.Center.X; diff --git a/Projectiles/Magic/HellwingPillar.cs b/Projectiles/Magic/HellwingBat.cs similarity index 82% rename from Projectiles/Magic/HellwingPillar.cs rename to Projectiles/Magic/HellwingBat.cs index 40a84f7224..735877902a 100644 --- a/Projectiles/Magic/HellwingPillar.cs +++ b/Projectiles/Magic/HellwingBat.cs @@ -1,25 +1,24 @@ +using System; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { - public class HellwingPillar : ModProjectile, ILocalizedModType + public class HellwingBat : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Magic"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 3; + Main.projFrames[Projectile.type] = 12; ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - Projectile.width = 26; - Projectile.height = 26; + Projectile.width = Projectile.height = 36; Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.tileCollide = false; @@ -32,7 +31,7 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { Projectile.frameCounter++; - if (Projectile.frameCounter > 4) + if (Projectile.frameCounter > 5) { Projectile.frame++; Projectile.frameCounter = 0; @@ -60,7 +59,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.ai[0] += 1f; if (Main.rand.NextBool(3)) { - int flareDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 127, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 100, default, 1f); + int flareDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Flare, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 100, default, 1f); Dust dust = Main.dust[flareDust]; if (Main.rand.NextBool(3)) { @@ -82,7 +81,7 @@ namespace CalamityMod.Projectiles.Magic { Projectile.ai[0] += 1f; } - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) - MathHelper.PiOver2; + Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) diff --git a/Projectiles/Magic/HellwingBat.png b/Projectiles/Magic/HellwingBat.png new file mode 100644 index 0000000000..d3ca097583 Binary files /dev/null and b/Projectiles/Magic/HellwingBat.png differ diff --git a/Projectiles/Magic/HellwingPillar.png b/Projectiles/Magic/HellwingPillar.png deleted file mode 100644 index d1b30af298..0000000000 Binary files a/Projectiles/Magic/HellwingPillar.png and /dev/null differ diff --git a/Projectiles/Magic/HeresyProj.cs b/Projectiles/Magic/HeresyProj.cs index 36d1749ddf..0c48a337cb 100644 --- a/Projectiles/Magic/HeresyProj.cs +++ b/Projectiles/Magic/HeresyProj.cs @@ -1,7 +1,7 @@ -using CalamityMod.Items.Weapons.Magic; +using System; +using CalamityMod.Items.Weapons.Magic; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -37,7 +37,7 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { // If the player is no longer able to hold the book, kill it. - if (!Owner.channel || Owner.noItems || Owner.CCed) + if (Owner.CantUseHoldout()) { Projectile.Kill(); return; @@ -112,7 +112,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { float glowOutwardness = MathHelper.SmoothStep(0f, 4f, Utils.GetLerpValue(90f, 270f, Time, true)); - Texture2D bookTexture = ModContent.Request(Texture).Value; + Texture2D bookTexture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Rectangle frame = bookTexture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); Vector2 drawPosition; Vector2 origin = frame.Size() * 0.5f; diff --git a/Projectiles/Magic/HolyFlame.cs b/Projectiles/Magic/HolyFlame.cs index 11dd7cc85a..0d58ed03c6 100644 --- a/Projectiles/Magic/HolyFlame.cs +++ b/Projectiles/Magic/HolyFlame.cs @@ -1,9 +1,9 @@ using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { public class HolyFlame : ModProjectile, ILocalizedModType @@ -48,7 +48,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item14, Projectile.position); + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); Projectile.width = 50; @@ -57,7 +57,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int i = 0; i < 20; i++) { - int holyDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 246, 0f, 0f, 100, default, 2f); + int holyDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GoldCoin, 0f, 0f, 100, default, 2f); Main.dust[holyDust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -67,10 +67,10 @@ namespace CalamityMod.Projectiles.Magic } for (int j = 0; j < 35; j++) { - int holyDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 247, 0f, 0f, 100, default, 3f); + int holyDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.PlatinumCoin, 0f, 0f, 100, default, 3f); Main.dust[holyDust2].noGravity = true; Main.dust[holyDust2].velocity *= 5f; - holyDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 246, 0f, 0f, 100, default, 2f); + holyDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GoldCoin, 0f, 0f, 100, default, 2f); Main.dust[holyDust2].velocity *= 2f; } } diff --git a/Projectiles/Magic/IceBarrageMain.cs b/Projectiles/Magic/IceBarrageMain.cs index c2b29e4ddd..a4b5c68f74 100644 --- a/Projectiles/Magic/IceBarrageMain.cs +++ b/Projectiles/Magic/IceBarrageMain.cs @@ -1,8 +1,8 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.StatDebuffs; +using Microsoft.Xna.Framework; using Terraria; -using Terraria.ModLoader; using Terraria.ID; -using CalamityMod.Buffs.StatDebuffs; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { @@ -96,7 +96,7 @@ namespace CalamityMod.Projectiles.Magic Vector2 Dpos = Projectile.Center + new Vector2(Main.rand.NextFloat(250f, 270f), Main.rand.NextFloat(250f, 270f)).RotatedBy(MathHelper.ToRadians(Main.rand.Next(1, 360))); Vector2 Dspeed = Projectile.Center - Dpos; Dspeed.Normalize(); - Dspeed *= Main.rand.NextFloat(8f,34f); + Dspeed *= Main.rand.NextFloat(8f, 34f); float Dscale = Main.rand.NextFloat(1.5f, 2f); int d1 = Dust.NewDust(Dpos, 1, 1, dtype2, Dspeed.X, Dspeed.Y, 0, default, Dscale); Main.dust[d1].velocity = Dspeed; diff --git a/Projectiles/Magic/IceBlock.cs b/Projectiles/Magic/IceBlock.cs index 47f2706639..da684fba9f 100644 --- a/Projectiles/Magic/IceBlock.cs +++ b/Projectiles/Magic/IceBlock.cs @@ -1,8 +1,8 @@ -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using Terraria; using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { @@ -31,7 +31,7 @@ namespace CalamityMod.Projectiles.Magic { Projectile.alpha -= 12; } - if(Projectile.alpha < 20) + if (Projectile.alpha < 20) { Projectile.alpha = 20; } @@ -46,26 +46,33 @@ namespace CalamityMod.Projectiles.Magic Vector2 pos4 = new Vector2(proj.Center.X - (proj.width * 0.5f) - 49f, proj.Center.Y); switch (Projectile.ai[0]) { - case 0: Projectile.Center = pos1; - break; - case 1: Projectile.Center = pos2; - break; - case 2: Projectile.Center = pos3; - break; - case 3: Projectile.Center = pos4; - break; + case 0: + Projectile.Center = pos1; + break; + case 1: + Projectile.Center = pos2; + break; + case 2: + Projectile.Center = pos3; + break; + case 3: + Projectile.Center = pos4; + break; default: break; } } } switch (Projectile.ai[0]) { - case 1: Projectile.rotation = (MathHelper.Pi * 0.5f); - break; - case 2: Projectile.rotation = MathHelper.Pi; - break; - case 3: Projectile.rotation = (MathHelper.Pi * 1.5f); - break; + case 1: + Projectile.rotation = (MathHelper.Pi * 0.5f); + break; + case 2: + Projectile.rotation = MathHelper.Pi; + break; + case 3: + Projectile.rotation = (MathHelper.Pi * 1.5f); + break; default: break; } } @@ -84,7 +91,7 @@ namespace CalamityMod.Projectiles.Magic Main.dust[dust].noGravity = true; } SoundEngine.PlaySound(SoundID.NPCHit5, Projectile.Center); - for (int i = 0; i< 8; i++) + for (int i = 0; i < 8; i++) { Vector2 projdir = new Vector2(Main.rand.NextFloat(-10f, 10f), Main.rand.NextFloat(-10f, 10f)); Vector2 projpos = Projectile.Center + new Vector2(Main.rand.NextFloat(-50f, 50f), Main.rand.NextFloat(-50f, 50f)); diff --git a/Projectiles/Magic/IceBlockIcicle.cs b/Projectiles/Magic/IceBlockIcicle.cs index 1982e25c6a..85d0ece25b 100644 --- a/Projectiles/Magic/IceBlockIcicle.cs +++ b/Projectiles/Magic/IceBlockIcicle.cs @@ -1,9 +1,9 @@ -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using Terraria; using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi) + (MathHelper.Pi * 0.5f * Projectile.direction); Projectile.velocity.Y += 0.25f; - if(Projectile.velocity.Y > 16f) + if (Projectile.velocity.Y > 16f) { Projectile.velocity.Y = 16f; } diff --git a/Projectiles/Magic/IceCluster.cs b/Projectiles/Magic/IceCluster.cs index cf5ae8e2e7..c5a292e024 100644 --- a/Projectiles/Magic/IceCluster.cs +++ b/Projectiles/Magic/IceCluster.cs @@ -1,9 +1,9 @@ using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { public class IceCluster : ModProjectile, ILocalizedModType @@ -35,7 +35,7 @@ namespace CalamityMod.Projectiles.Magic if (Projectile.localAI[1] == 0f) { Projectile.localAI[1] = 1f; - SoundEngine.PlaySound(SoundID.Item120, Projectile.position); + SoundEngine.PlaySound(SoundID.Item120, Projectile.Center); } Projectile.ai[0] += 1f; diff --git a/Projectiles/Magic/Icicle.cs b/Projectiles/Magic/Icicle.cs index 712f0a525d..c9cf8e1009 100644 --- a/Projectiles/Magic/Icicle.cs +++ b/Projectiles/Magic/Icicle.cs @@ -1,8 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -34,10 +34,10 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item27, Projectile.position); + SoundEngine.PlaySound(SoundID.Item27, Projectile.Center); for (int index1 = 0; index1 < 5; ++index1) { - int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 68, 0f, 0f, 0, new Color(), 1f); + int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.BlueCrystalShard, 0f, 0f, 0, new Color(), 1f); Main.dust[index2].noGravity = true; Main.dust[index2].velocity *= 1.5f; Main.dust[index2].scale *= 0.9f; diff --git a/Projectiles/Magic/IcicleStaffProj.cs b/Projectiles/Magic/IcicleStaffProj.cs index e9057dda96..d5790eb209 100644 --- a/Projectiles/Magic/IcicleStaffProj.cs +++ b/Projectiles/Magic/IcicleStaffProj.cs @@ -1,9 +1,9 @@ +using System; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { public class IcicleStaffProj : ModProjectile, ILocalizedModType @@ -23,13 +23,13 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; Projectile.localAI[0] += 1f; if (Projectile.localAI[0] > 4f) { for (int i = 0; i < 3; i++) { - int icyDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 67, 0f, 0f, 100, default, 0.75f); + int icyDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.IceRod, 0f, 0f, 100, default, 0.75f); Main.dust[icyDust].noGravity = true; Main.dust[icyDust].velocity *= 0f; } @@ -38,10 +38,10 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item27, Projectile.position); + SoundEngine.PlaySound(SoundID.Item27, Projectile.Center); for (int k = 0; k < 5; k++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 67, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.IceRod, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } } diff --git a/Projectiles/Magic/InfernadoFriendly.cs b/Projectiles/Magic/InfernadoFriendly.cs index 3e0901e896..46ab217618 100644 --- a/Projectiles/Magic/InfernadoFriendly.cs +++ b/Projectiles/Magic/InfernadoFriendly.cs @@ -1,10 +1,12 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Magic { public class InfernadoFriendly : ModProjectile, ILocalizedModType @@ -44,7 +46,7 @@ namespace CalamityMod.Projectiles.Magic if (Main.rand.NextBool(25)) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 244, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.CopperCoin, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } if (Projectile.velocity.X != 0f) { @@ -114,7 +116,7 @@ namespace CalamityMod.Projectiles.Magic } if (Projectile.ai[0] <= 0f) { - float swaySize = 0.104719758f; + float swaySize = MathHelper.Pi / 30f; float smolWidth = (float)Projectile.width / 5f; smolWidth *= 2f; float projXChange = (float)(Math.Cos((double)(swaySize * -(double)Projectile.ai[0])) - 0.5) * smolWidth; @@ -142,8 +144,8 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { - Texture2D texture2D13 = ModContent.Request(Texture).Value; - int framing = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; + Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + int framing = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; int y6 = framing * Projectile.frame; Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)framing / 2f), Projectile.scale, SpriteEffects.None, 0); return false; diff --git a/Projectiles/Magic/InfernadoMarkFriendly.cs b/Projectiles/Magic/InfernadoMarkFriendly.cs index 9bb73962b2..14ca4ee0ed 100644 --- a/Projectiles/Magic/InfernadoMarkFriendly.cs +++ b/Projectiles/Magic/InfernadoMarkFriendly.cs @@ -1,9 +1,9 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { public class InfernadoMarkFriendly : ModProjectile, ILocalizedModType @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Magic Vector2 dustRotate = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; dustRotate = dustRotate.RotatedBy((double)(i - (dustAmt / 2 - 1)) * 3.1415926535897931 / (double)(float)dustAmt, default) + Projectile.Center; Vector2 randDustOffset = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); - int fiery = Dust.NewDust(dustRotate + randDustOffset, 0, 0, 244, randDustOffset.X * 2f, randDustOffset.Y * 2f, 100, default, 1.4f); + int fiery = Dust.NewDust(dustRotate + randDustOffset, 0, 0, DustID.CopperCoin, randDustOffset.X * 2f, randDustOffset.Y * 2f, 100, default, 1.4f); Main.dust[fiery].noGravity = true; Main.dust[fiery].noLight = true; Main.dust[fiery].velocity /= 4f; @@ -93,14 +93,14 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(FlareSound, Projectile.position); + SoundEngine.PlaySound(FlareSound, Projectile.Center); int dustAmt = 36; for (int i = 0; i < dustAmt; i++) { Vector2 rotate = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; rotate = rotate.RotatedBy((double)((float)(i - (dustAmt / 2 - 1)) * 6.28318548f / (float)dustAmt), default) + Projectile.Center; Vector2 faceDirection = rotate - Projectile.Center; - int infernadoDust = Dust.NewDust(rotate + faceDirection, 0, 0, 244, faceDirection.X * 2f, faceDirection.Y * 2f, 100, default, 1.4f); + int infernadoDust = Dust.NewDust(rotate + faceDirection, 0, 0, DustID.CopperCoin, faceDirection.X * 2f, faceDirection.Y * 2f, 100, default, 1.4f); Main.dust[infernadoDust].noGravity = true; Main.dust[infernadoDust].noLight = true; Main.dust[infernadoDust].velocity = faceDirection; diff --git a/Projectiles/Magic/InfernalBlade.cs b/Projectiles/Magic/InfernalBlade.cs index 3ff465d10d..4d960c272a 100644 --- a/Projectiles/Magic/InfernalBlade.cs +++ b/Projectiles/Magic/InfernalBlade.cs @@ -2,9 +2,9 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { public class InfernalBlade : ModProjectile, ILocalizedModType @@ -40,7 +40,7 @@ namespace CalamityMod.Projectiles.Magic Vector2 dustRotate = Vector2.UnitX * 0f; dustRotate += -Vector2.UnitY.RotatedBy((double)((float)dustIncr * (6.28318548f / dustLoopcheck)), default) * new Vector2(1f, 4f); dustRotate = dustRotate.RotatedBy((double)Projectile.velocity.ToRotation(), default); - int deepRed = Dust.NewDust(Projectile.Center, 0, 0, 182, 0f, 0f, 0, default, 1f); + int deepRed = Dust.NewDust(Projectile.Center, 0, 0, DustID.TheDestroyer, 0f, 0f, 0, default, 1f); Main.dust[deepRed].scale = 1.5f; Main.dust[deepRed].noGravity = true; Main.dust[deepRed].position = Projectile.Center + dustRotate; @@ -54,11 +54,11 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); - SoundEngine.PlaySound(SoundID.Item10, Projectile.position); + SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); int dustAmt = Main.rand.Next(4, 10); for (int d = 0; d < dustAmt; d++) { - int fire = Dust.NewDust(Projectile.Center, 0, 0, 182, 0f, 0f, 100, default, 1f); + int fire = Dust.NewDust(Projectile.Center, 0, 0, DustID.TheDestroyer, 0f, 0f, 100, default, 1f); Dust dust = Main.dust[fire]; dust.velocity *= 1.6f; dust.velocity.Y -= 1f; @@ -79,8 +79,8 @@ namespace CalamityMod.Projectiles.Magic spriteEffects = SpriteEffects.FlipHorizontally; } Color colorArea = Lighting.GetColor((int)((double)Projectile.position.X + (double)Projectile.width * 0.5) / 16, (int)(((double)Projectile.position.Y + (double)Projectile.height * 0.5) / 16.0)); - Texture2D texture2D3 = ModContent.Request(Texture).Value; - int textureArea = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; + Texture2D texture2D3 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + int textureArea = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; int y3 = textureArea * Projectile.frame; Rectangle rectangle = new Rectangle(0, y3, texture2D3.Width, textureArea); Vector2 halfRect = rectangle.Size() / 2f; diff --git a/Projectiles/Magic/InfernalBlade2.cs b/Projectiles/Magic/InfernalBlade2.cs index 5e9cb88dcf..55094dd6c6 100644 --- a/Projectiles/Magic/InfernalBlade2.cs +++ b/Projectiles/Magic/InfernalBlade2.cs @@ -2,9 +2,9 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { public class InfernalBlade2 : ModProjectile, ILocalizedModType @@ -23,6 +23,8 @@ namespace CalamityMod.Projectiles.Magic Projectile.tileCollide = false; Projectile.timeLeft = 180; Projectile.DamageType = DamageClass.Magic; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() @@ -42,7 +44,7 @@ namespace CalamityMod.Projectiles.Magic Vector2 dustRotate = Vector2.UnitX * 0f; dustRotate += -Vector2.UnitY.RotatedBy((double)((float)dustIncr * (6.28318548f / dustLoopCheck)), default) * new Vector2(1f, 4f); dustRotate = dustRotate.RotatedBy((double)Projectile.velocity.ToRotation(), default); - int deepRed = Dust.NewDust(Projectile.Center, 0, 0, 182, 0f, 0f, 0, default, 1f); + int deepRed = Dust.NewDust(Projectile.Center, 0, 0, DustID.TheDestroyer, 0f, 0f, 0, default, 1f); Main.dust[deepRed].scale = 1.5f; Main.dust[deepRed].noGravity = true; Main.dust[deepRed].position = Projectile.Center + dustRotate; @@ -56,11 +58,11 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); - SoundEngine.PlaySound(SoundID.Item10, Projectile.position); + SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); int randDustAmt = Main.rand.Next(4, 10); for (int i = 0; i < randDustAmt; i++) { - int killDeepRed = Dust.NewDust(Projectile.Center, 0, 0, 182, 0f, 0f, 100, default, 1f); + int killDeepRed = Dust.NewDust(Projectile.Center, 0, 0, DustID.TheDestroyer, 0f, 0f, 100, default, 1f); Main.dust[killDeepRed].velocity *= 1.6f; Dust expr_FEDF_cp_0 = Main.dust[killDeepRed]; expr_FEDF_cp_0.velocity.Y -= 1f; @@ -84,8 +86,8 @@ namespace CalamityMod.Projectiles.Magic spriteEffects = SpriteEffects.FlipHorizontally; } Color colorArea = Lighting.GetColor((int)((double)Projectile.position.X + (double)Projectile.width * 0.5) / 16, (int)(((double)Projectile.position.Y + (double)Projectile.height * 0.5) / 16.0)); - Texture2D texture2D3 = ModContent.Request(Texture).Value; - int textureArea = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; + Texture2D texture2D3 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + int textureArea = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; int y3 = textureArea * Projectile.frame; Rectangle rectangle = new Rectangle(0, y3, texture2D3.Width, textureArea); Vector2 halfRect = rectangle.Size() / 2f; diff --git a/Projectiles/Magic/IonBlast.cs b/Projectiles/Magic/IonBlast.cs index ecab146b29..16f2ce592a 100644 --- a/Projectiles/Magic/IonBlast.cs +++ b/Projectiles/Magic/IonBlast.cs @@ -1,10 +1,10 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { public class IonBlast : ModProjectile, ILocalizedModType @@ -31,7 +31,7 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + MathHelper.PiOver2; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; Projectile.velocity *= 1.015f; if (Projectile.alpha > 0) { @@ -77,7 +77,7 @@ namespace CalamityMod.Projectiles.Magic int randDustAmt = Main.rand.Next(15, 30); for (int i = 0; i < randDustAmt; i++) { - int reddish = Dust.NewDust(Projectile.Center - Projectile.velocity / 2f, 0, 0, 130, 0f, 0f, 100, default, 1f); + int reddish = Dust.NewDust(Projectile.Center - Projectile.velocity / 2f, 0, 0, DustID.Firework_Red, 0f, 0f, 100, default, 1f); Main.dust[reddish].velocity *= 2f; Main.dust[reddish].noGravity = true; } diff --git a/Projectiles/Magic/KeelhaulGeyserBottom.cs b/Projectiles/Magic/KeelhaulGeyserBottom.cs index 8401db062f..97cc0ab147 100644 --- a/Projectiles/Magic/KeelhaulGeyserBottom.cs +++ b/Projectiles/Magic/KeelhaulGeyserBottom.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { diff --git a/Projectiles/Magic/KeelhaulGeyserTop.cs b/Projectiles/Magic/KeelhaulGeyserTop.cs index 30dac8212e..70fa1eabeb 100644 --- a/Projectiles/Magic/KeelhaulGeyserTop.cs +++ b/Projectiles/Magic/KeelhaulGeyserTop.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { diff --git a/Projectiles/Magic/LazharSolarBeam.cs b/Projectiles/Magic/LazharSolarBeam.cs index 0cb34d1d67..41cd01de7b 100644 --- a/Projectiles/Magic/LazharSolarBeam.cs +++ b/Projectiles/Magic/LazharSolarBeam.cs @@ -1,7 +1,7 @@ using CalamityMod.Projectiles.Typeless; -using Terraria.ID; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { @@ -31,7 +31,7 @@ namespace CalamityMod.Projectiles.Magic Vector2 projPos = Projectile.position; projPos -= Projectile.velocity * ((float)i * 0.25f); Projectile.alpha = 255; - int heatGold = Dust.NewDust(projPos, 1, 1, 246, 0f, 0f, 0, default, 1f); + int heatGold = Dust.NewDust(projPos, 1, 1, DustID.GoldCoin, 0f, 0f, 0, default, 1f); Main.dust[heatGold].position = projPos; Main.dust[heatGold].scale = (float)Main.rand.Next(70, 110) * 0.013f; Main.dust[heatGold].velocity *= 0.2f; diff --git a/Projectiles/Magic/LightBall.cs b/Projectiles/Magic/LightBall.cs index a55997a16c..c3ba7a74c3 100644 --- a/Projectiles/Magic/LightBall.cs +++ b/Projectiles/Magic/LightBall.cs @@ -1,8 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { public class LightBall : ModProjectile, ILocalizedModType @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Magic Lighting.AddLight(Projectile.Center, 0.5f, 0.5f, 0.5f); Projectile.velocity.X *= 0.995f; Projectile.velocity.Y *= 0.995f; - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 244, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.CopperCoin, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } public override Color? GetAlpha(Color lightColor) @@ -34,7 +34,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item14, Projectile.position); + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); Projectile.width = 300; @@ -44,7 +44,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); for (int i = 0; i < 10; i++) { - int lightDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 1.2f); + int lightDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 100, default, 1.2f); Main.dust[lightDust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -54,10 +54,10 @@ namespace CalamityMod.Projectiles.Magic } for (int j = 0; j < 20; j++) { - int lightDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 1.7f); + int lightDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 100, default, 1.7f); Main.dust[lightDust2].noGravity = true; Main.dust[lightDust2].velocity *= 5f; - lightDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 1f); + lightDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 100, default, 1f); Main.dust[lightDust2].velocity *= 2f; } } diff --git a/Projectiles/Magic/LightBallExplosion.cs b/Projectiles/Magic/LightBallExplosion.cs index 2e3df7a2f0..8c34e668a7 100644 --- a/Projectiles/Magic/LightBallExplosion.cs +++ b/Projectiles/Magic/LightBallExplosion.cs @@ -1,4 +1,4 @@ -using Terraria.ModLoader; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { public class LightBallExplosion : ModProjectile, ILocalizedModType diff --git a/Projectiles/Magic/LightBead.cs b/Projectiles/Magic/LightBead.cs index ee1fdaa88d..42c4ece225 100644 --- a/Projectiles/Magic/LightBead.cs +++ b/Projectiles/Magic/LightBead.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic @@ -26,7 +27,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.ai[1] += 1f; if (Main.rand.NextBool(5)) { - Dust whiteMagic = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 0, default, 1f); + Dust whiteMagic = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 0, default, 1f); whiteMagic.noGravity = true; whiteMagic.velocity *= 0.5f; whiteMagic.scale *= 0.9f; @@ -53,7 +54,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { for (int k = 0; k < 4; k++) - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 244, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.CopperCoin, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); int beadAmt = Main.rand.Next(2, 3); if (Projectile.owner == Main.myPlayer) diff --git a/Projectiles/Magic/LightBeadSplit.cs b/Projectiles/Magic/LightBeadSplit.cs index 39c5958b1b..4271f56123 100644 --- a/Projectiles/Magic/LightBeadSplit.cs +++ b/Projectiles/Magic/LightBeadSplit.cs @@ -1,5 +1,7 @@ -using Terraria; +using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Magic { public class LightBeadSplit : ModProjectile, ILocalizedModType @@ -30,7 +32,7 @@ namespace CalamityMod.Projectiles.Magic { for (int k = 0; k < 3; k++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 212, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.BubbleBurst_White, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } } diff --git a/Projectiles/Magic/LightBlade.cs b/Projectiles/Magic/LightBlade.cs index ca285e42e1..c53a8b7705 100644 --- a/Projectiles/Magic/LightBlade.cs +++ b/Projectiles/Magic/LightBlade.cs @@ -3,9 +3,9 @@ using CalamityMod.Items.Weapons.Magic; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -129,7 +129,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.NPCHit3, Projectile.position); + SoundEngine.PlaySound(SoundID.NPCHit3, Projectile.Center); int numDust = Main.rand.Next(4, 10); for (int i = 0; i < numDust; i++) { @@ -151,7 +151,7 @@ namespace CalamityMod.Projectiles.Magic Point projTile = Projectile.Center.ToTileCoordinates(); Color localLight = Lighting.GetColor(projTile.X, projTile.Y); - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Rectangle rect = new Rectangle(38 * Projectile.frame, 0, 38, 38); Vector2 halfSpriteSize = rect.Size() / 2f; diff --git a/Projectiles/Magic/LightningArc.cs b/Projectiles/Magic/LightningArc.cs index 4e549389e2..667902b6c8 100644 --- a/Projectiles/Magic/LightningArc.cs +++ b/Projectiles/Magic/LightningArc.cs @@ -1,6 +1,6 @@ -using Microsoft.Xna.Framework; -using System; +using System; using System.Collections.Generic; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.ignoreWater = true; Projectile.DamageType = DamageClass.Magic; Projectile.timeLeft = 20; - Projectile.penetrate = 6; + Projectile.penetrate = 5; Projectile.tileCollide = true; } @@ -105,7 +105,7 @@ namespace CalamityMod.Projectiles.Magic for (int i = 0; i < 20; i++) { - int dust = Dust.NewDust(current, Projectile.width, Projectile.height, 20, 0, 0); + int dust = Dust.NewDust(current, Projectile.width, Projectile.height, DustID.PurificationPowder, 0, 0); Main.dust[dust].velocity = new Vector2(0); current += move / 20f; } diff --git a/Projectiles/Magic/LiquidBlade.cs b/Projectiles/Magic/LiquidBlade.cs index 6e378be143..fbf6ce611f 100644 --- a/Projectiles/Magic/LiquidBlade.cs +++ b/Projectiles/Magic/LiquidBlade.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Projectiles.Magic Utils.PlotTileLine(Projectile.Center, Projectile.Center + Projectile.velocity * 10f, 8f, DelegateMethods.CastLightOpen); if (Projectile.alpha > 0) { - SoundEngine.PlaySound(SoundID.Item9, Projectile.position); + SoundEngine.PlaySound(SoundID.Item9, Projectile.Center); Projectile.alpha = 0; Projectile.scale = 1.1f; Projectile.frame = Main.rand.Next(14); @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.Magic Vector2 dustRotate = Vector2.UnitX * 0f; dustRotate += -Vector2.UnitY.RotatedBy((double)((float)dustIncr * (6.28318548f / dustLoopCheck)), default) * new Vector2(1f, 4f); dustRotate = dustRotate.RotatedBy((double)Projectile.velocity.ToRotation(), default); - int rainbow = Dust.NewDust(Projectile.Center, 0, 0, 66, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + int rainbow = Dust.NewDust(Projectile.Center, 0, 0, DustID.RainbowTorch, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); Main.dust[rainbow].scale = 1.5f; Main.dust[rainbow].noGravity = true; Main.dust[rainbow].position = Projectile.Center + dustRotate; @@ -57,11 +57,11 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); - SoundEngine.PlaySound(SoundID.Item10, Projectile.position); + SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); int randDustAmt = Main.rand.Next(4, 10); for (int j = 0; j < randDustAmt; j++) { - int rainbowDeath = Dust.NewDust(Projectile.Center, 0, 0, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + int rainbowDeath = Dust.NewDust(Projectile.Center, 0, 0, DustID.RainbowTorch, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); Dust dust = Main.dust[rainbowDeath]; dust.velocity *= 1.6f; dust.velocity.Y -= 1f; @@ -85,8 +85,8 @@ namespace CalamityMod.Projectiles.Magic spriteEffects = SpriteEffects.FlipHorizontally; } Color colorArea = Lighting.GetColor((int)((double)Projectile.position.X + (double)Projectile.width * 0.5) / 16, (int)(((double)Projectile.position.Y + (double)Projectile.height * 0.5) / 16.0)); - Texture2D texture2D3 = ModContent.Request(Texture).Value; - int textureArea = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; + Texture2D texture2D3 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + int textureArea = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; int y3 = textureArea * Projectile.frame; Rectangle rectangle = new Rectangle(0, y3, texture2D3.Width, textureArea); Vector2 halfRect = rectangle.Size() / 2f; diff --git a/Projectiles/Magic/LiquidBlade2.cs b/Projectiles/Magic/LiquidBlade2.cs index 01552c0385..21876dd11d 100644 --- a/Projectiles/Magic/LiquidBlade2.cs +++ b/Projectiles/Magic/LiquidBlade2.cs @@ -2,9 +2,9 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -33,7 +33,7 @@ namespace CalamityMod.Projectiles.Magic Utils.PlotTileLine(Projectile.Center, Projectile.Center + Projectile.velocity * 10f, 8f, DelegateMethods.CastLightOpen); if (Projectile.alpha > 0) { - SoundEngine.PlaySound(SoundID.Item9, Projectile.position); + SoundEngine.PlaySound(SoundID.Item9, Projectile.Center); Projectile.alpha = 0; Projectile.scale = 1.1f; Projectile.frame = Main.rand.Next(14); @@ -44,7 +44,7 @@ namespace CalamityMod.Projectiles.Magic Vector2 dustRotate = Vector2.UnitX * 0f; dustRotate += -Vector2.UnitY.RotatedBy((double)((float)dustIncr * (6.28318548f / dustLoopCheck)), default) * new Vector2(1f, 4f); dustRotate = dustRotate.RotatedBy((double)Projectile.velocity.ToRotation(), default); - int rainbow = Dust.NewDust(Projectile.Center, 0, 0, 66, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + int rainbow = Dust.NewDust(Projectile.Center, 0, 0, DustID.RainbowTorch, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); Main.dust[rainbow].scale = 1.5f; Main.dust[rainbow].noGravity = true; Main.dust[rainbow].position = Projectile.Center + dustRotate; @@ -58,11 +58,11 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); - SoundEngine.PlaySound(SoundID.Item10, Projectile.position); + SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); int randDustAmt = Main.rand.Next(4, 10); for (int i = 0; i < randDustAmt; i++) { - int rainbowDeath = Dust.NewDust(Projectile.Center, 0, 0, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + int rainbowDeath = Dust.NewDust(Projectile.Center, 0, 0, DustID.RainbowTorch, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); Dust dust = Main.dust[rainbowDeath]; dust.velocity *= 1.6f; dust.velocity.Y -= 1f; @@ -86,8 +86,8 @@ namespace CalamityMod.Projectiles.Magic spriteEffects = SpriteEffects.FlipHorizontally; } Color colorArea = Lighting.GetColor((int)((double)Projectile.position.X + (double)Projectile.width * 0.5) / 16, (int)(((double)Projectile.position.Y + (double)Projectile.height * 0.5) / 16.0)); - Texture2D texture2D3 = ModContent.Request(Texture).Value; - int textureArea = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; + Texture2D texture2D3 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + int textureArea = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; int y3 = textureArea * Projectile.frame; Rectangle rectangle = new Rectangle(0, y3, texture2D3.Width, textureArea); Vector2 halfRect = rectangle.Size() / 2f; diff --git a/Projectiles/Magic/LuxorsGiftMagic.cs b/Projectiles/Magic/LuxorsGiftMagic.cs index 8be8db8a32..01915b5d3e 100644 --- a/Projectiles/Magic/LuxorsGiftMagic.cs +++ b/Projectiles/Magic/LuxorsGiftMagic.cs @@ -1,5 +1,5 @@ +using System; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -30,7 +30,7 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; if (Projectile.localAI[0] == 0f) { Projectile.scale -= 0.01f; @@ -59,7 +59,7 @@ namespace CalamityMod.Projectiles.Magic Vector2 dustRotate = Vector2.UnitX * (float)-(float)Projectile.width / 2f; dustRotate += -Vector2.UnitY.RotatedBy((double)((float)l * 3.14159274f / 6f), default) * new Vector2(8f, 16f); dustRotate = dustRotate.RotatedBy((double)(Projectile.rotation - 1.57079637f), default); - int dusty = Dust.NewDust(Projectile.Center, 0, 0, 244, 0f, 0f, 160, default, 1f); + int dusty = Dust.NewDust(Projectile.Center, 0, 0, DustID.CopperCoin, 0f, 0f, 160, default, 1f); Main.dust[dusty].scale = 1.1f; Main.dust[dusty].noGravity = true; Main.dust[dusty].position = Projectile.Center + dustRotate; diff --git a/Projectiles/Magic/LuxorsGiftMagic.png b/Projectiles/Magic/LuxorsGiftMagic.png index 3c066fade0..e3e09a3ae8 100644 Binary files a/Projectiles/Magic/LuxorsGiftMagic.png and b/Projectiles/Magic/LuxorsGiftMagic.png differ diff --git a/Projectiles/Magic/MadAlchemistsCocktailAlt.cs b/Projectiles/Magic/MadAlchemistsCocktailAlt.cs index 147f7ba1af..ee27293b30 100644 --- a/Projectiles/Magic/MadAlchemistsCocktailAlt.cs +++ b/Projectiles/Magic/MadAlchemistsCocktailAlt.cs @@ -1,10 +1,10 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { public class MadAlchemistsCocktailAlt : ModProjectile, ILocalizedModType @@ -69,25 +69,25 @@ namespace CalamityMod.Projectiles.Magic Projectile.Damage(); // I don't even know what this dust code does - // So true bestie! -CIT + // So true bestie! -CIT Vector2 dustRotation = (0f - 1.57079637f).ToRotationVector2(); Vector2 dustVelocity = dustRotation * Projectile.velocity.Length() * (float)Projectile.MaxUpdates; int inc; for (int i = 0; i < 40; i = inc + 1) { - int alchDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 200, default, 2.5f); + int alchDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, 0f, 0f, 200, default, 2.5f); Main.dust[alchDust].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; Main.dust[alchDust].noGravity = true; Dust dust = Main.dust[alchDust]; dust.velocity *= 4f; dust = Main.dust[alchDust]; dust.velocity += dustVelocity * Main.rand.NextFloat(); - alchDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 174, 0f, 0f, 100, default, 1.8f); + alchDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.InfernoFork, 0f, 0f, 100, default, 1.8f); Main.dust[alchDust].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; dust = Main.dust[alchDust]; dust.velocity *= 3f; Main.dust[alchDust].noGravity = true; - alchDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 229, 0f, 0f, 100, default, 1.8f); + alchDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Vortex, 0f, 0f, 100, default, 1.8f); Main.dust[alchDust].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; dust = Main.dust[alchDust]; dust.velocity *= 2f; @@ -100,7 +100,7 @@ namespace CalamityMod.Projectiles.Magic } for (int j = 0; j < 20; j = inc + 1) { - int alchDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 206, 0f, 0f, 0, default, 2.5f); + int alchDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.UnusedWhiteBluePurple, 0f, 0f, 0, default, 2.5f); Main.dust[alchDust2].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)Projectile.velocity.ToRotation(), default) * (float)Projectile.width / 3f; Main.dust[alchDust2].noGravity = true; Dust dust = Main.dust[alchDust2]; diff --git a/Projectiles/Magic/MadAlchemistsCocktailBlue.cs b/Projectiles/Magic/MadAlchemistsCocktailBlue.cs index 691e8d05d0..a1a816d07b 100644 --- a/Projectiles/Magic/MadAlchemistsCocktailBlue.cs +++ b/Projectiles/Magic/MadAlchemistsCocktailBlue.cs @@ -1,9 +1,9 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -37,7 +37,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item107, Projectile.position); + SoundEngine.PlaySound(SoundID.Item107, Projectile.Center); if (Main.netMode != NetmodeID.Server) { diff --git a/Projectiles/Magic/MadAlchemistsCocktailGasCloud.cs b/Projectiles/Magic/MadAlchemistsCocktailGasCloud.cs index b6dfabe047..6421a246a9 100644 --- a/Projectiles/Magic/MadAlchemistsCocktailGasCloud.cs +++ b/Projectiles/Magic/MadAlchemistsCocktailGasCloud.cs @@ -1,4 +1,4 @@ -using Terraria.ModLoader; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { public class MadAlchemistsCocktailGasCloud : ModProjectile, ILocalizedModType diff --git a/Projectiles/Magic/MadAlchemistsCocktailGreen.cs b/Projectiles/Magic/MadAlchemistsCocktailGreen.cs index fe9ae63c68..6114267a51 100644 --- a/Projectiles/Magic/MadAlchemistsCocktailGreen.cs +++ b/Projectiles/Magic/MadAlchemistsCocktailGreen.cs @@ -1,9 +1,9 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -37,8 +37,8 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item107, Projectile.position); - SoundEngine.PlaySound(SoundID.Item88, Projectile.position); + SoundEngine.PlaySound(SoundID.Item107, Projectile.Center); + SoundEngine.PlaySound(SoundID.Item88, Projectile.Center); if (Main.netMode != NetmodeID.Server) { diff --git a/Projectiles/Magic/MadAlchemistsCocktailPurple.cs b/Projectiles/Magic/MadAlchemistsCocktailPurple.cs index 21be9804fc..3fc98ecb6c 100644 --- a/Projectiles/Magic/MadAlchemistsCocktailPurple.cs +++ b/Projectiles/Magic/MadAlchemistsCocktailPurple.cs @@ -1,9 +1,9 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -37,7 +37,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item107, Projectile.position); + SoundEngine.PlaySound(SoundID.Item107, Projectile.Center); if (Main.netMode != NetmodeID.Server) { diff --git a/Projectiles/Magic/MadAlchemistsCocktailRed.cs b/Projectiles/Magic/MadAlchemistsCocktailRed.cs index a1d38bc5f8..9a7fb721b2 100644 --- a/Projectiles/Magic/MadAlchemistsCocktailRed.cs +++ b/Projectiles/Magic/MadAlchemistsCocktailRed.cs @@ -1,9 +1,9 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -66,14 +66,14 @@ namespace CalamityMod.Projectiles.Magic int inc; for (int i = 0; i < 60; i = inc + 1) { - int fiery = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 174, 0f, 0f, 200, default, 3f); + int fiery = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.InfernoFork, 0f, 0f, 200, default, 3f); Main.dust[fiery].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; Main.dust[fiery].noGravity = true; Dust dust = Main.dust[fiery]; dust.velocity *= 8f; dust = Main.dust[fiery]; dust.velocity += dustVelocity * Main.rand.NextFloat(); - fiery = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 174, 0f, 0f, 100, default, dustAI); + fiery = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.InfernoFork, 0f, 0f, 100, default, dustAI); Main.dust[fiery].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; dust = Main.dust[fiery]; dust.velocity *= 6f; @@ -82,7 +82,7 @@ namespace CalamityMod.Projectiles.Magic Main.dust[fiery].color = Color.Crimson * 0.5f; dust = Main.dust[fiery]; dust.velocity += dustVelocity * Main.rand.NextFloat(); - fiery = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 174, 0f, 0f, 100, default, dustAI); + fiery = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.InfernoFork, 0f, 0f, 100, default, dustAI); Main.dust[fiery].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; dust = Main.dust[fiery]; dust.velocity *= 4f; @@ -91,7 +91,7 @@ namespace CalamityMod.Projectiles.Magic Main.dust[fiery].color = Color.Crimson * 0.5f; dust = Main.dust[fiery]; dust.velocity += dustVelocity * Main.rand.NextFloat(); - fiery = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 174, 0f, 0f, 100, default, dustAI); + fiery = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.InfernoFork, 0f, 0f, 100, default, dustAI); Main.dust[fiery].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; dust = Main.dust[fiery]; dust.velocity *= 2f; @@ -104,7 +104,7 @@ namespace CalamityMod.Projectiles.Magic } for (int j = 0; j < 30; j = inc + 1) { - int fiery2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 174, 0f, 0f, 0, default, 3.8f); + int fiery2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.InfernoFork, 0f, 0f, 0, default, 3.8f); Main.dust[fiery2].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)Projectile.velocity.ToRotation(), default) * (float)Projectile.width / 3f; Main.dust[fiery2].noGravity = true; Dust dust = Main.dust[fiery2]; diff --git a/Projectiles/Magic/MadAlchemistsCocktailShrapnel.cs b/Projectiles/Magic/MadAlchemistsCocktailShrapnel.cs index 9fc5bfe392..36b15d16a3 100644 --- a/Projectiles/Magic/MadAlchemistsCocktailShrapnel.cs +++ b/Projectiles/Magic/MadAlchemistsCocktailShrapnel.cs @@ -1,6 +1,8 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Magic { public class MadAlchemistsCocktailShrapnel : ModProjectile, ILocalizedModType @@ -36,14 +38,14 @@ namespace CalamityMod.Projectiles.Magic { Vector2 dustRotation = Vector2.UnitX * -15f; dustRotation = -Vector2.UnitY.RotatedBy((double)(Projectile.localAI[0] * 0.1308997f + (float)i * 3.14159274f), default) * rotationMult * 0.75f; - int shrapnelDust = Dust.NewDust(Projectile.Center, 0, 0, 173, 0f, 0f, 160, default, 0.75f); + int shrapnelDust = Dust.NewDust(Projectile.Center, 0, 0, DustID.ShadowbeamStaff, 0f, 0f, 160, default, 0.75f); Main.dust[shrapnelDust].noGravity = true; Main.dust[shrapnelDust].position = Projectile.Center + dustRotation; Main.dust[shrapnelDust].velocity = Projectile.velocity; } } - int extraDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 1f); + int extraDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, 0f, 0f, 100, default, 1f); Main.dust[extraDust].noGravity = true; if (Projectile.timeLeft < 150) diff --git a/Projectiles/Magic/MagneticBeam.cs b/Projectiles/Magic/MagneticBeam.cs index 79bffa3f90..0b46e5390d 100644 --- a/Projectiles/Magic/MagneticBeam.cs +++ b/Projectiles/Magic/MagneticBeam.cs @@ -1,6 +1,9 @@ +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Magic { public class MagneticBeam : ModProjectile, ILocalizedModType @@ -12,21 +15,39 @@ namespace CalamityMod.Projectiles.Magic { Projectile.width = 4; Projectile.height = 4; - Projectile.extraUpdates = 100; + Projectile.extraUpdates = 70; Projectile.friendly = true; - Projectile.timeLeft = 90; + Projectile.timeLeft = 500; Projectile.DamageType = DamageClass.Magic; Projectile.ignoreWater = true; } public override void AI() { - Vector2 projPos = Projectile.position; - projPos -= Projectile.velocity * 0.25f; - int dust = Dust.NewDust(projPos, 1, 1, 173, 0f, 0f, 0, default, 1.25f); - Main.dust[dust].position = projPos; - Main.dust[dust].scale = (float)Main.rand.Next(70, 110) * 0.013f; - Main.dust[dust].velocity *= 0.1f; + if (Projectile.timeLeft == 500) + { + Particle orb = new CustomPulse(Projectile.Center, Vector2.Zero, Color.DarkOrchid, "CalamityMod/Particles/LargeBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0.2f, 0.2f, 3); + GeneralParticleHandler.SpawnParticle(orb); + Particle orb2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/LargeBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0.13f, 0.13f, 3); + GeneralParticleHandler.SpawnParticle(orb2); + } + + if (Projectile.timeLeft % 3 == 0 && Projectile.timeLeft < 499) + { + LineParticle spark2 = new LineParticle(Projectile.Center, -Projectile.velocity * 0.05f, false, 6, 1.4f, Color.DarkOrchid * 0.6f); + GeneralParticleHandler.SpawnParticle(spark2); + LineParticle spark3 = new LineParticle(Projectile.Center, -Projectile.velocity * 0.05f, false, 6, 1f, Color.White * 0.6f); + GeneralParticleHandler.SpawnParticle(spark3); + } + } + public override void OnKill(int timeLeft) + { + for (int i = 0; i <= 4; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(4, 4), 272, (Projectile.velocity * 3) * Main.rand.NextFloat(0.1f, 0.9f)); + dust.scale = Main.rand.NextFloat(0.3f, 0.5f); + dust.noGravity = true; + } } } } diff --git a/Projectiles/Magic/MagneticOrb.cs b/Projectiles/Magic/MagneticOrb.cs index b24092abef..8a6e384e68 100644 --- a/Projectiles/Magic/MagneticOrb.cs +++ b/Projectiles/Magic/MagneticOrb.cs @@ -1,6 +1,6 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ModLoader; @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.tileCollide = false; Projectile.ignoreWater = true; Projectile.penetrate = 1; - Projectile.timeLeft = 120; + Projectile.timeLeft = 50; Projectile.DamageType = DamageClass.Magic; } @@ -34,7 +34,8 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { // Drift to a stop after being launched - Projectile.velocity *= 0.972f; + if (Projectile.timeLeft < 40) + Projectile.velocity *= 0.882f; // On frame 1, pick a random offset to use for the firing pattern. if (Projectile.timeLeft == Lifetime) @@ -52,7 +53,7 @@ namespace CalamityMod.Projectiles.Magic // Update animation Projectile.frameCounter++; - if (Projectile.frameCounter > 6) + if (Projectile.frameCounter > 4) { Projectile.frameCounter = 0; Projectile.frame++; @@ -62,7 +63,10 @@ namespace CalamityMod.Projectiles.Magic } } - CalamityUtils.MagnetSphereHitscan(Projectile, 300f, 8f, FramesPerBeam, 1, ModContent.ProjectileType(), 1D, true); + NPC target = Projectile.Center.ClosestNPCAt(550); + + if ((Projectile.timeLeft == 30 || Projectile.timeLeft == 10) && target != null) + CalamityUtils.MagnetSphereHitscan(Projectile, Vector2.Distance(Projectile.Center, target.Center), 8f, 0, 1, ModContent.ProjectileType(), 1D, true); } public override Color? GetAlpha(Color lightColor) @@ -77,8 +81,8 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { - Texture2D texture2D13 = ModContent.Request(Texture).Value; - int framing = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; + Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + int framing = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; int y6 = framing * Projectile.frame; Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)framing / 2f), Projectile.scale, SpriteEffects.None, 0); return false; diff --git a/Projectiles/Magic/ManaBolt.cs b/Projectiles/Magic/ManaBolt.cs index 47c0c2c2c3..de520ad65e 100644 --- a/Projectiles/Magic/ManaBolt.cs +++ b/Projectiles/Magic/ManaBolt.cs @@ -1,8 +1,8 @@ using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { public class ManaBolt : ModProjectile, ILocalizedModType @@ -34,8 +34,8 @@ namespace CalamityMod.Projectiles.Magic { for (int k = 0; k < 5; k++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 15, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 107, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.MagicMirror, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.TerraBlade, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } float spread = 90f * 0.0174f; double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2; @@ -50,7 +50,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack, Projectile.owner); } } - SoundEngine.PlaySound(SoundID.Item10, Projectile.position); + SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); } } } diff --git a/Projectiles/Magic/ManaBoltSmall.cs b/Projectiles/Magic/ManaBoltSmall.cs index 96f6d88ff2..9b8c894790 100644 --- a/Projectiles/Magic/ManaBoltSmall.cs +++ b/Projectiles/Magic/ManaBoltSmall.cs @@ -1,9 +1,9 @@ +using System; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { public class ManaBoltSmall : ModProjectile, ILocalizedModType @@ -31,16 +31,16 @@ namespace CalamityMod.Projectiles.Magic Projectile.velocity *= 0.975f; if (Projectile.timeLeft % 4 == 0) - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 15, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.MagicMirror, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } public override void OnKill(int timeLeft) { for (int k = 0; k < 10; k++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 15, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.MagicMirror, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } - SoundEngine.PlaySound(SoundID.Item10, Projectile.position); + SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); } } } diff --git a/Projectiles/Magic/ManaBoltSmall2.cs b/Projectiles/Magic/ManaBoltSmall2.cs index ee795d7a2c..2278759d9f 100644 --- a/Projectiles/Magic/ManaBoltSmall2.cs +++ b/Projectiles/Magic/ManaBoltSmall2.cs @@ -1,9 +1,9 @@ +using System; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { public class ManaBoltSmall2 : ModProjectile, ILocalizedModType @@ -24,20 +24,20 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + MathHelper.PiOver2; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; Projectile.velocity.X *= 0.975f; Projectile.velocity.Y *= 0.975f; if (Projectile.timeLeft % 4 == 0) - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 107, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.TerraBlade, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } public override void OnKill(int timeLeft) { for (int k = 0; k < 10; k++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 107, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.TerraBlade, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } - SoundEngine.PlaySound(SoundID.Item10, Projectile.position); + SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); } } } diff --git a/Projectiles/Magic/ManaChargedCoral.cs b/Projectiles/Magic/ManaChargedCoral.cs index 8349e5cc4a..9fd20d08f4 100644 --- a/Projectiles/Magic/ManaChargedCoral.cs +++ b/Projectiles/Magic/ManaChargedCoral.cs @@ -1,4 +1,6 @@ using System; +using CalamityMod.Buffs.StatBuffs; +using CalamityMod.Items.Weapons.Magic; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -6,8 +8,6 @@ using Terraria; using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Buffs.StatBuffs; -using CalamityMod.Items.Weapons.Magic; namespace CalamityMod.Projectiles.Magic { @@ -117,7 +117,7 @@ namespace CalamityMod.Projectiles.Magic if (Main.rand.NextBool()) { Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(15f, 15f), 45, Vector2.UnitY * -7f, Alpha: Main.rand.Next(100) + 120, Scale: Main.rand.NextFloat(1f, 2f)); - dust.noGravity = true; + dust.noGravity = true; } if (Main.rand.NextBool(5)) @@ -133,14 +133,14 @@ namespace CalamityMod.Projectiles.Magic float fallSpeed = Projectile.velocity.Y; if (Projectile.velocity.X != 0) Projectile.rotation += 0.02f * Math.Sign(Projectile.velocity.X) * Math.Clamp(Projectile.velocity.Length(), 0f, 5f); - + if (Projectile.timeLeft < 345) Projectile.velocity += Vector2.UnitY * 0.5f * (1 - Math.Clamp((Projectile.timeLeft - 310f) / 35f, 0f, 1f)); Projectile.velocity *= 0.98f; if (Projectile.velocity.Y > 0) - Projectile.velocity.Y = Math.Clamp(Projectile.velocity.Y, 0, Math.Max(18f, fallSpeed)); + Projectile.velocity.Y = Math.Clamp(Projectile.velocity.Y, 0, Math.Max(18f, fallSpeed)); //Sharticles if (Main.rand.NextBool()) @@ -239,7 +239,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Vector2 position = Projectile.Center - Main.screenPosition; int variant = (int)(Projectile.frame - 1); Rectangle frame = new Rectangle(0, 26 * variant, 24, 24); diff --git a/Projectiles/Magic/ManaMonster.cs b/Projectiles/Magic/ManaMonster.cs index a9f13428ed..c8c85b203f 100644 --- a/Projectiles/Magic/ManaMonster.cs +++ b/Projectiles/Magic/ManaMonster.cs @@ -1,10 +1,10 @@ -using CalamityMod.Dusts; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using CalamityMod.Buffs.DamageOverTime; namespace CalamityMod.Projectiles.Magic { diff --git a/Projectiles/Magic/MelterAmp.cs b/Projectiles/Magic/MelterAmp.cs index 4623c92bb4..12729568a3 100644 --- a/Projectiles/Magic/MelterAmp.cs +++ b/Projectiles/Magic/MelterAmp.cs @@ -1,5 +1,5 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic @@ -64,7 +64,7 @@ namespace CalamityMod.Projectiles.Magic int Damage = Projectile.damage; int type; Projectile.netUpdate = true; - Vector2 projAimDirection = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); + Vector2 projAimDirection = Projectile.Center; float ampXDirection = (float)Main.mouseX + Main.screenPosition.X - projAimDirection.X; float ampYDirection = (float)Main.mouseY + Main.screenPosition.Y - projAimDirection.Y; if (player.gravDir == -1f) diff --git a/Projectiles/Magic/MelterNote1.cs b/Projectiles/Magic/MelterNote1.cs index 631360e654..78d0e6101a 100644 --- a/Projectiles/Magic/MelterNote1.cs +++ b/Projectiles/Magic/MelterNote1.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { diff --git a/Projectiles/Magic/MelterNote2.cs b/Projectiles/Magic/MelterNote2.cs index 6aab62507c..f6f2b3ff78 100644 --- a/Projectiles/Magic/MelterNote2.cs +++ b/Projectiles/Magic/MelterNote2.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { diff --git a/Projectiles/Magic/MeteorStar.cs b/Projectiles/Magic/MeteorStar.cs index 9e5de057f1..e123f24b7b 100644 --- a/Projectiles/Magic/MeteorStar.cs +++ b/Projectiles/Magic/MeteorStar.cs @@ -1,9 +1,9 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -166,7 +166,7 @@ namespace CalamityMod.Projectiles.Magic CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); // Draw the main texture in fullbright - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; int frameHeight = texture.Height / Main.projFrames[Projectile.type]; int frameY = frameHeight * Projectile.frame; diff --git a/Projectiles/Magic/MeteorStarExplosion.cs b/Projectiles/Magic/MeteorStarExplosion.cs index b992d79b82..aa7a66e539 100644 --- a/Projectiles/Magic/MeteorStarExplosion.cs +++ b/Projectiles/Magic/MeteorStarExplosion.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Items.Weapons.Magic; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Projectiles/Magic/MiasmaGas.cs b/Projectiles/Magic/MiasmaGas.cs index b3fbcb261c..d7df7b79ea 100644 --- a/Projectiles/Magic/MiasmaGas.cs +++ b/Projectiles/Magic/MiasmaGas.cs @@ -1,8 +1,8 @@ +using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Buffs.StatDebuffs; namespace CalamityMod.Projectiles.Magic { public class MiasmaGas : ModProjectile, ILocalizedModType @@ -62,7 +62,7 @@ namespace CalamityMod.Projectiles.Magic { for (int i = 0; i < 25; i++) { - Dust dust = Dust.NewDustDirect(Projectile.position, 48, 30, 189, 0f, 0f); + Dust dust = Dust.NewDustDirect(Projectile.position, 48, 30, DustID.Pumpkin, 0f, 0f); dust.velocity = Projectile.velocity.RotatedByRandom(MathHelper.ToRadians(39f)); dust.alpha = 127; } diff --git a/Projectiles/Magic/NanoPurgeHoldout.cs b/Projectiles/Magic/NanoPurgeHoldout.cs index 50a24ff00b..b68d0f826f 100644 --- a/Projectiles/Magic/NanoPurgeHoldout.cs +++ b/Projectiles/Magic/NanoPurgeHoldout.cs @@ -15,7 +15,6 @@ namespace CalamityMod.Projectiles.Magic private static int[] LaserOffsetByAnimationFrame = { 4, 3, 0, 3 }; private Player Owner => Main.player[Projectile.owner]; - private bool OwnerCanShoot => Owner.channel && Owner.HasAmmo(Owner.ActiveItem()) && !Owner.noItems && !Owner.CCed; private ref float DeployedFrames => ref Projectile.ai[0]; private ref float ChargeTowardsNextShot => ref Projectile.ai[1]; @@ -41,7 +40,7 @@ namespace CalamityMod.Projectiles.Magic Vector2 gunBarrelPos = armPosition + Projectile.velocity * Projectile.height * 0.5f; // If the player is unable to continue using the holdout, delete it. - if (!OwnerCanShoot) + if (Owner.CantUseHoldout() || !Owner.HasAmmo(Owner.ActiveItem())) { Projectile.Kill(); return; diff --git a/Projectiles/Magic/NanoPurgeLaser.cs b/Projectiles/Magic/NanoPurgeLaser.cs index fffc37ff6b..048457cf86 100644 --- a/Projectiles/Magic/NanoPurgeLaser.cs +++ b/Projectiles/Magic/NanoPurgeLaser.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic diff --git a/Projectiles/Magic/NebulaCloud.cs b/Projectiles/Magic/NebulaCloud.cs index 9e97e763f2..89797b1b20 100644 --- a/Projectiles/Magic/NebulaCloud.cs +++ b/Projectiles/Magic/NebulaCloud.cs @@ -1,5 +1,5 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -81,7 +81,7 @@ namespace CalamityMod.Projectiles.Magic if (Main.rand.NextBool()) { - int purpleDust = Dust.NewDust(Projectile.Center, 8, 8, 86); + int purpleDust = Dust.NewDust(Projectile.Center, 8, 8, DustID.GemAmethyst); Main.dust[purpleDust].position = Projectile.Center; Main.dust[purpleDust].velocity = Projectile.velocity; Main.dust[purpleDust].noGravity = true; @@ -98,7 +98,7 @@ namespace CalamityMod.Projectiles.Magic for (int i = 0; i < 15; i++) { - int killDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)Projectile.ai[0], Projectile.velocity.X * 0.1f, Projectile.velocity.Y * 0.1f, 0, default(Color), 0.75f); + int killDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)Projectile.ai[0], Projectile.velocity.X * 0.1f, Projectile.velocity.Y * 0.1f, 0, default(Color), 0.75f); Dust dust; if (Main.rand.NextBool(3)) { diff --git a/Projectiles/Magic/NebulaCloudCore.cs b/Projectiles/Magic/NebulaCloudCore.cs index d6666420d1..155380efe0 100644 --- a/Projectiles/Magic/NebulaCloudCore.cs +++ b/Projectiles/Magic/NebulaCloudCore.cs @@ -1,11 +1,11 @@ -using Microsoft.Xna.Framework; -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Audio; +using System; +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 { @@ -85,7 +85,7 @@ namespace CalamityMod.Projectiles.Magic else { Vector2 prettyDustDirect2 = Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi); - Dust prettyDust2 = Main.dust[Dust.NewDust(Projectile.Center - prettyDustDirect2 * 45f, 0, 0, 240)]; + Dust prettyDust2 = Main.dust[Dust.NewDust(Projectile.Center - prettyDustDirect2 * 45f, 0, 0, DustID.Granite)]; prettyDust2.noGravity = true; prettyDust2.position = Projectile.Center - prettyDustDirect2 * 45f; prettyDust2.velocity = prettyDustDirect2.RotatedBy(-MathHelper.PiOver2) * 4f; @@ -126,7 +126,7 @@ namespace CalamityMod.Projectiles.Magic if (Main.rand.NextBool()) { Vector2 slowPrettyDustDirect = Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi); - Dust slowPrettyDust = Main.dust[Dust.NewDust(Projectile.Center - slowPrettyDustDirect * 45f, 0, 0, 86)]; + Dust slowPrettyDust = Main.dust[Dust.NewDust(Projectile.Center - slowPrettyDustDirect * 45f, 0, 0, DustID.GemAmethyst)]; slowPrettyDust.noGravity = true; slowPrettyDust.position = Projectile.Center - slowPrettyDustDirect * Main.rand.Next(20, 31); slowPrettyDust.velocity = slowPrettyDustDirect.RotatedBy(MathHelper.PiOver2) * 9f; @@ -134,7 +134,7 @@ namespace CalamityMod.Projectiles.Magic slowPrettyDust.fadeIn = 0.5f; slowPrettyDust.customData = this; slowPrettyDustDirect = Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi); - slowPrettyDust = Main.dust[Dust.NewDust(Projectile.Center - slowPrettyDustDirect * 45f, 0, 0, 90)]; + slowPrettyDust = Main.dust[Dust.NewDust(Projectile.Center - slowPrettyDustDirect * 45f, 0, 0, DustID.GemRuby)]; slowPrettyDust.noGravity = true; slowPrettyDust.position = Projectile.Center - slowPrettyDustDirect * Main.rand.Next(20, 31); slowPrettyDust.velocity = slowPrettyDustDirect.RotatedBy(MathHelper.PiOver2) * 9f; @@ -146,7 +146,7 @@ namespace CalamityMod.Projectiles.Magic else { Vector2 slowPrettyDustDirect2 = Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi); - Dust slowPrettyDust2 = Main.dust[Dust.NewDust(Projectile.Center - slowPrettyDustDirect2 * 45f, 0, 0, 240)]; + Dust slowPrettyDust2 = Main.dust[Dust.NewDust(Projectile.Center - slowPrettyDustDirect2 * 45f, 0, 0, DustID.Granite)]; slowPrettyDust2.noGravity = true; slowPrettyDust2.position = Projectile.Center - slowPrettyDustDirect2 * Main.rand.Next(30, 41); slowPrettyDust2.velocity = slowPrettyDustDirect2.RotatedBy(-MathHelper.PiOver2) * 6f; @@ -260,7 +260,7 @@ namespace CalamityMod.Projectiles.Magic float rotationScale = 0.95f + (Projectile.rotation * 0.75f).ToRotationVector2().Y * 0.1f; cloudColor *= rotationScale; float cloudScale = 0.6f + Projectile.scale * 0.6f * rotationScale; - Texture2D coreTexture = ModContent.Request(Texture).Value; + Texture2D coreTexture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Texture2D nebulaCloudTexture = ModContent.Request("CalamityMod/Projectiles/Magic/NebulaCloud", AssetRequestMode.ImmediateLoad).Value; Vector2 position = Projectile.Center - Main.screenPosition; Vector2 coreOrigin = coreTexture.Size() / new Vector2(0, Main.projFrames[Projectile.type]) * 0.5f; @@ -287,22 +287,22 @@ namespace CalamityMod.Projectiles.Magic Projectile.penetrate = -1; Projectile.Damage(); - SoundEngine.PlaySound(SoundID.Item14, Projectile.position); + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); for (int i = 0; i < 6; i++) { - int blackDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 240, 0f, 0f, 100, default(Color), 1.75f); + int blackDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Granite, 0f, 0f, 100, default(Color), 1.75f); Main.dust[blackDust].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(Math.PI) * (float)Main.rand.NextDouble() * Projectile.width / 2f; } for (int j = 0; j < 45; j++) { - int purpleDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 62, 0f, 0f, 200, default(Color), 5.05f); + int purpleDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.PurpleTorch, 0f, 0f, 200, default(Color), 5.05f); Main.dust[purpleDust].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(Math.PI) * (float)Main.rand.NextDouble() * Projectile.width / 2f; Main.dust[purpleDust].noGravity = true; Dust dust = Main.dust[purpleDust]; dust.velocity *= 4f; - purpleDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 90, 0f, 0f, 100, default(Color), 1.75f); + purpleDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GemRuby, 0f, 0f, 100, default(Color), 1.75f); Main.dust[purpleDust].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(Math.PI) * (float)Main.rand.NextDouble() * Projectile.width / 2f; dust = Main.dust[purpleDust]; dust.velocity *= 2.5f; @@ -313,7 +313,7 @@ namespace CalamityMod.Projectiles.Magic for (int k = 0; k < 15; k++) { - int purpleDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 62, 0f, 0f, 0, default(Color), 3.55f); + int purpleDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.PurpleTorch, 0f, 0f, 0, default(Color), 3.55f); Main.dust[purpleDust2].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(Math.PI).RotatedBy(Projectile.velocity.ToRotation()) * Projectile.width / 2f; Main.dust[purpleDust2].noGravity = true; Dust dust = Main.dust[purpleDust2]; @@ -322,7 +322,7 @@ namespace CalamityMod.Projectiles.Magic for (int l = 0; l < 15; l++) { - int blackDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 240, 0f, 0f, 0, default(Color), 1.75f); + int blackDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Granite, 0f, 0f, 0, default(Color), 1.75f); Main.dust[blackDust2].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(Math.PI).RotatedBy(Projectile.velocity.ToRotation()) * Projectile.width / 2f; Main.dust[blackDust2].noGravity = true; Dust dust = Main.dust[blackDust2]; diff --git a/Projectiles/Magic/NebulaNova.cs b/Projectiles/Magic/NebulaNova.cs index 9210e47740..141a2e4745 100644 --- a/Projectiles/Magic/NebulaNova.cs +++ b/Projectiles/Magic/NebulaNova.cs @@ -56,7 +56,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Vector2 position = Projectile.Center - Main.screenPosition; Vector2 origin = texture.Size() / new Vector2(TotalXFrames, TotalYFrames) * 0.5f; Rectangle frame = texture.Frame(TotalXFrames, TotalYFrames, frameX, frameY); diff --git a/Projectiles/Magic/NebulousCataclysm_Held.cs b/Projectiles/Magic/NebulousCataclysm_Held.cs index a953411c23..1e137421ee 100644 --- a/Projectiles/Magic/NebulousCataclysm_Held.cs +++ b/Projectiles/Magic/NebulousCataclysm_Held.cs @@ -1,7 +1,7 @@ -using CalamityMod.Items.Weapons.Magic; +using System; +using CalamityMod.Items.Weapons.Magic; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -61,7 +61,7 @@ namespace CalamityMod.Projectiles.Magic bool shoot = CurrentFrame == ShootFrame && Projectile.ai[0] == 0f; bool ableToShoot = true; - bool weaponInUse = Owner.channel && !Owner.noItems && !Owner.CCed; + bool weaponInUse = !Owner.CantUseHoldout(); int manaCost = (int)(30f * Owner.manaCost); Vector2 halvedSize = Projectile.Size / 2f; Vector2 staffOffset = halvedSize + new Vector2(24f, 24f); @@ -104,7 +104,7 @@ namespace CalamityMod.Projectiles.Magic } if (ableToShoot) - SoundEngine.PlaySound(SoundID.Item117, Projectile.position); + SoundEngine.PlaySound(SoundID.Item117, Projectile.Center); } if (Main.myPlayer == Projectile.owner && ableToShoot) @@ -162,7 +162,7 @@ namespace CalamityMod.Projectiles.Magic if (Projectile.frameCounter < 5) return; - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Vector2 position = Projectile.Center - Main.screenPosition; Vector2 origin = texture.Size() / new Vector2(TotalXFrames, TotalYFrames) * 0.5f; Rectangle frame = texture.Frame(TotalXFrames, TotalYFrames, frameX, frameY); diff --git a/Projectiles/Magic/NettleRight.cs b/Projectiles/Magic/NettleRight.cs index 5659b2f4a7..6029ca4ce6 100644 --- a/Projectiles/Magic/NettleRight.cs +++ b/Projectiles/Magic/NettleRight.cs @@ -21,6 +21,8 @@ namespace CalamityMod.Projectiles.Magic Projectile.ignoreWater = true; Projectile.DamageType = DamageClass.Magic; Projectile.penetrate = -1; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() @@ -58,7 +60,7 @@ namespace CalamityMod.Projectiles.Magic { for (int i = 0; i < 8; i++) { - Dust thorn = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, 7, Projectile.velocity.X * 0.025f, Projectile.velocity.Y * 0.025f, 200, default, 1.3f); + Dust thorn = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.WoodFurniture, Projectile.velocity.X * 0.025f, Projectile.velocity.Y * 0.025f, 200, default, 1.3f); thorn.noGravity = true; thorn.velocity *= 0.5f; } @@ -75,7 +77,7 @@ namespace CalamityMod.Projectiles.Magic // Draw the tip for the final thorn public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; if (Projectile.ai[0] == TotalSegments) texture = ModContent.Request("CalamityMod/Projectiles/Magic/NettleTip").Value; diff --git a/Projectiles/Magic/NightBolt.cs b/Projectiles/Magic/NightBolt.cs index e151d3486d..887a8c6869 100644 --- a/Projectiles/Magic/NightBolt.cs +++ b/Projectiles/Magic/NightBolt.cs @@ -1,6 +1,8 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Magic { public class NightBolt : ModProjectile, ILocalizedModType @@ -25,7 +27,7 @@ namespace CalamityMod.Projectiles.Magic { Vector2 projPos = Projectile.position; projPos -= Projectile.velocity * ((float)i * 0.25f); - int nightDust = Dust.NewDust(projPos, 1, 1, 27, 0f, 0f, 0, default, 1.25f); + int nightDust = Dust.NewDust(projPos, 1, 1, DustID.Shadowflame, 0f, 0f, 0, default, 1.25f); Main.dust[nightDust].position = projPos; Main.dust[nightDust].scale = (float)Main.rand.Next(70, 110) * 0.013f; Main.dust[nightDust].velocity *= 0.1f; diff --git a/Projectiles/Magic/NightOrb.cs b/Projectiles/Magic/NightOrb.cs index 644b8a9a28..c5373229e3 100644 --- a/Projectiles/Magic/NightOrb.cs +++ b/Projectiles/Magic/NightOrb.cs @@ -1,4 +1,4 @@ -using Terraria.ModLoader; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { public class NightOrb : ModProjectile, ILocalizedModType diff --git a/Projectiles/Magic/NuclearFuryProjectile.cs b/Projectiles/Magic/NuclearFuryProjectile.cs index 8a500ae385..6c38dbd006 100644 --- a/Projectiles/Magic/NuclearFuryProjectile.cs +++ b/Projectiles/Magic/NuclearFuryProjectile.cs @@ -1,9 +1,9 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -34,8 +34,8 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - if (Projectile.ai[1] == 1f) - Projectile.penetrate = -1; // Gives infinite pierce to Valediction typhoons + if (Projectile.ai[1] == 1f) + Projectile.penetrate = -1; // Gives infinite pierce to Valediction typhoons Projectile.localAI[1] += 1f; if (Projectile.localAI[1] > 10f && Main.rand.NextBool(3)) @@ -45,7 +45,7 @@ namespace CalamityMod.Projectiles.Magic { Vector2 dustRotation = (Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width, (float)Projectile.height) / 2f).RotatedBy((double)(i - (dustAmt / 2 - 1)) * Math.PI / (double)dustAmt, new Vector2()) + Projectile.Center; Vector2 randomRotation = ((Main.rand.NextFloat() * MathHelper.Pi) - MathHelper.PiOver2).ToRotationVector2() * (float)Main.rand.Next(3, 8); - int nuclearDust = Dust.NewDust(dustRotation + randomRotation, 0, 0, 217, randomRotation.X * 2f, randomRotation.Y * 2f, 100, new Color(), 1.4f); + int nuclearDust = Dust.NewDust(dustRotation + randomRotation, 0, 0, DustID.FishronWings, randomRotation.X * 2f, randomRotation.Y * 2f, 100, new Color(), 1.4f); Dust dust = Main.dust[nuclearDust]; dust.noGravity = true; dust.noLight = true; @@ -131,10 +131,10 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item10, Projectile.position); + SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); for (int k = 0; k < 5; k++) { - int dust = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 34, 0f, 0f); + int dust = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.BreatheBubble, 0f, 0f); Main.dust[dust].velocity *= 0f; Main.dust[dust].noGravity = true; } diff --git a/Projectiles/Magic/OmicronBeam.cs b/Projectiles/Magic/OmicronBeam.cs new file mode 100644 index 0000000000..ab72615ff1 --- /dev/null +++ b/Projectiles/Magic/OmicronBeam.cs @@ -0,0 +1,140 @@ +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class OmicronBeam : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Magic"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public ref float time => ref Projectile.ai[0]; + + public Color mainColor = Color.MediumVioletRed; + public bool HitDirect = false; + public override void SetDefaults() + { + Projectile.width = 50; + Projectile.height = 50; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 300; + Projectile.extraUpdates = 75; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 91; + } + public override void AI() + { + Player Owner = Main.player[Projectile.owner]; + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); + if (Projectile.timeLeft % 2 == 0 && time > 2 && targetDist < 1400f) + { + Particle spark = new GlowSparkParticle(Projectile.Center, -Projectile.velocity * 0.05f, false, 25, MathHelper.Clamp(0.34f - time * 0.07f, 0.085f, 0.34f), mainColor, new Vector2(0.5f, 1.3f)); + GeneralParticleHandler.SpawnParticle(spark); + } + if (Main.rand.NextBool()) + { + Vector2 trailPos = Projectile.Center; + float trailScale = Main.rand.NextFloat(1.9f, 2.3f); + Particle Trail = new SparkParticle(trailPos, Projectile.velocity * Main.rand.NextFloat(0.2f, 0.9f), false, Main.rand.Next(40, 50 + 1), trailScale, mainColor); + GeneralParticleHandler.SpawnParticle(Trail); + } + Vector2 dustVel = new Vector2(2, 2).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 0.8f); + Dust dust = Dust.NewDustPerfect(Projectile.Center + dustVel, Main.rand.NextBool(4) ? 264 : 66, dustVel, 0, default, Main.rand.NextFloat(0.9f, 1.2f)); + dust.noGravity = true; + dust.color = Main.rand.NextBool() ? Color.Lerp(mainColor, Color.White, 0.5f) : mainColor; + + time++; + } + public override void OnKill(int timeLeft) + { + int numProj = 2; + float rotation = MathHelper.ToRadians(10); + if (Projectile.ai[1] == 0 && time < 250 && !HitDirect) + { + for (int i = 0; i < numProj; i++) + { + Vector2 perturbedSpeed = Projectile.velocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, perturbedSpeed, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 1f); + for (int k = 0; k < 3; k++) + { + Particle blastRing = new CustomPulse(Projectile.Center + Projectile.velocity * 2, Vector2.Zero, mainColor, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 0.8f, 0.4f, 35); + GeneralParticleHandler.SpawnParticle(blastRing); + Particle blastRing2 = new CustomPulse(Projectile.Center + Projectile.velocity * 2, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 0.7f, 0.3f, 35); + GeneralParticleHandler.SpawnParticle(blastRing2); + } + } + + for (int i = 0; i <= 6; i++) + { + Particle energy = new GlowSparkParticle(Projectile.Center, (Projectile.velocity * 15).RotatedByRandom(0.5f) * Main.rand.NextFloat(0.1f, 0.4f), false, 10, Main.rand.NextFloat(0.02f, 0.04f), mainColor, new Vector2(2, 0.7f), true); + GeneralParticleHandler.SpawnParticle(energy); + } + for (int i = 0; i <= 9; i++) + { + Particle energy = new SparkParticle(Projectile.Center, (Projectile.velocity * 5).RotatedByRandom(0.5f) * Main.rand.NextFloat(0.1f, 0.4f), false, 25, Main.rand.NextFloat(0.7f, 0.9f), mainColor); + GeneralParticleHandler.SpawnParticle(energy); + } + } + for (int i = 0; i < 28; i++) + { + Vector2 dustVel = Projectile.velocity * Main.rand.NextFloat(0.1f, 1.5f); + Dust dust = Dust.NewDustPerfect(Projectile.Center + dustVel + Main.rand.NextVector2Circular(6, 6), Main.rand.NextBool(4) ? 264 : 66, dustVel, 0, default, Main.rand.NextFloat(0.9f, 1.2f)); + dust.noGravity = true; + dust.color = Main.rand.NextBool() ? Color.Lerp(mainColor, Color.White, 0.5f) : mainColor; + } + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + if (Projectile.ai[1] == 0 && time > 7 && !HitDirect) + Projectile.Kill(); + + Player Owner = Main.player[Projectile.owner]; + for (int i = 0; i <= 8; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(4) ? 264 : 66, (Projectile.velocity.SafeNormalize(Vector2.UnitY) * 15f).RotatedByRandom(MathHelper.ToRadians(15f)) * Main.rand.NextFloat(0.1f, 0.8f), 0, default, Main.rand.NextFloat(1.2f, 1.6f)); + dust.noGravity = true; + dust.color = Main.rand.NextBool() ? Color.Lerp(mainColor, Color.White, 0.5f) : mainColor; + } + if (time <= 7 && Projectile.ai[1] == 0) // This is the sweet spot + { + modifiers.SourceDamage *= 5; + + if (!HitDirect) + { + Owner.velocity += -Projectile.velocity; + for (int i = 0; i <= 9; i++) + { + Particle energy = new GlowSparkParticle(Projectile.Center, (Projectile.velocity * 15).RotatedByRandom(0.5f) * Main.rand.NextFloat(0.1f, 0.4f), false, 11, Main.rand.NextFloat(0.05f, 0.07f), mainColor, new Vector2(2, 0.5f), true); + GeneralParticleHandler.SpawnParticle(energy); + } + for (int i = 0; i <= 13; i++) + { + Particle energy = new SparkParticle(Projectile.Center, (Projectile.velocity * 10).RotatedByRandom(0.5f) * Main.rand.NextFloat(0.1f, 0.4f), false, 25, Main.rand.NextFloat(0.7f, 0.9f), mainColor); + GeneralParticleHandler.SpawnParticle(energy); + } + for (int k = 0; k < 20; k++) + { + Vector2 shootVel = (Projectile.velocity * 20).RotatedByRandom(0.5f) * Main.rand.NextFloat(0.1f, 1.8f); + + Dust dust2 = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(4) ? 267 : 66, shootVel); + dust2.scale = Main.rand.NextFloat(1.15f, 1.45f); + dust2.noGravity = true; + dust2.color = Main.rand.NextBool() ? Color.Lerp(mainColor, Color.White, 0.5f) : mainColor; + } + + SoundStyle fire = new("CalamityMod/Sounds/Custom/ExoMechs/ArtemisApolloDash"); + SoundEngine.PlaySound(fire with { Volume = 1.25f, Pitch = 0.6f }, Projectile.Center); + } + + HitDirect = true; + } + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, time <= 7 ? 90 : 20, targetHitbox); + } +} diff --git a/Projectiles/Magic/OmicronHoldout.cs b/Projectiles/Magic/OmicronHoldout.cs new file mode 100644 index 0000000000..35fe35a888 --- /dev/null +++ b/Projectiles/Magic/OmicronHoldout.cs @@ -0,0 +1,199 @@ +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Particles; +using CalamityMod.Projectiles.BaseProjectiles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class OmicronHoldout : BaseGunHoldoutProjectile + { + public override int AssociatedItemID => ModContent.ItemType(); + public override Vector2 GunTipPosition => base.GunTipPosition - Vector2.UnitY.RotatedBy(Projectile.rotation) * 4f * Projectile.spriteDirection; + public override float MaxOffsetLengthFromArm => 10f; + public override float OffsetXUpwards => -5f; + public override float BaseOffsetY => -5f; + public override float OffsetYDownwards => 5f; + + public Color StaticEffectsColor = Color.MediumVioletRed; + + public float FiringTime = 15; + public float Windup = 60; + public bool WindingUp = false; + public int time = 0; + public int PostFireCooldown = 0; + public bool fireYBeam = false; + public int maxFirerateShots = 0; + + private ref float ShootingTimer => ref Projectile.ai[0]; + + public override void KillHoldoutLogic() + { + if (Owner is null || !Owner.active || Owner.CCed || Owner.dead || Owner.noItems) + { + if (PostFireCooldown <= 0) + Projectile.Kill(); + Projectile.netUpdate = true; + } + } + + public override void HoldoutAI() + { + Item heldItem = Owner.ActiveItem(); + + // Fire if the owner stops channeling or otherwise cannot use the weapon. + if (Owner.CantUseHoldout()) + { + if (PostFireCooldown <= 0) + Projectile.Kill(); + } + + if (PostFireCooldown > 0) + { + PostFiringCooldown(); + } + + if (Owner.Calamity().mouseRight && PostFireCooldown <= 0) + { + if (Owner.CheckMana(Owner.ActiveItem(), (int)(heldItem.mana * Owner.manaCost) * 16, true, false)) + { + PostFireCooldown = 100; + Shoot(heldItem, true); + ShootingTimer = 0; + } + else + { + if (Projectile.soundDelay <= 0) + { + SoundEngine.PlaySound(SoundID.MaxMana with { Pitch = -0.5f }, Projectile.Center); + Projectile.soundDelay = 50; + ShootingTimer = 0; + } + } + } + else if (ShootingTimer >= FiringTime) + { + if (Owner.CheckMana(Owner.ActiveItem(), -1, true, false) && PostFireCooldown <= 0) + { + maxFirerateShots++; + + if (maxFirerateShots == 5) + { + Windup = 60; + maxFirerateShots = 0; + } + + Shoot(heldItem, false); + + ShootingTimer = 0; + + if (Windup > 10) + { + if (maxFirerateShots > 0) + Windup -= 12; + } + else + { + Windup = 10; + } + } + else if (PostFireCooldown <= 0) + { + SoundEngine.PlaySound(SoundID.MaxMana with { Pitch = -0.5f }, Projectile.Center); + Projectile.Kill(); + } + + } + ShootingTimer++; + } + private void Shoot(Item item, bool yBeam) + { + Vector2 shootDirection = Projectile.velocity.SafeNormalize(Vector2.Zero); + + // Spawns the projectile. + + Vector2 firingVelocity1 = (shootDirection * 8).RotatedBy(0.1f * Utils.GetLerpValue(10, 55, Windup, true)); + Vector2 firingVelocity2 = (shootDirection * 8).RotatedBy(-0.1f * Utils.GetLerpValue(10, 55, Windup, true)); + Vector2 firingVelocity3 = (shootDirection * 10); + + if (yBeam) + { + SoundStyle fire = new("CalamityMod/Sounds/Item/OmicronBeam"); + SoundEngine.PlaySound(fire with { Volume = 0.9f }, Projectile.Center); + + for (int k = 0; k < 6; k++) + { + Particle pulse2 = new GlowSparkParticle(GunTipPosition, shootDirection * 28, false, 8, 0.087f, StaticEffectsColor, new Vector2(2.3f, 0.9f), true); + GeneralParticleHandler.SpawnParticle(pulse2); + } + + Owner.Calamity().GeneralScreenShakePower = 6.5f; + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), GunTipPosition, firingVelocity3, ModContent.ProjectileType(), Projectile.damage * 32, Projectile.knockBack, Projectile.owner, 0, 0); + + for (int i = 0; i < 8; i++) + { + SparkParticle spark2 = new SparkParticle(GunTipPosition + Main.rand.NextVector2Circular(10, 10), firingVelocity3 * Main.rand.NextFloat(0.7f, 1.3f), false, Main.rand.Next(20, 30), Main.rand.NextFloat(0.4f, 0.55f), StaticEffectsColor); + GeneralParticleHandler.SpawnParticle(spark2); + } + } + else + { + SoundStyle fire = new("CalamityMod/Sounds/Item/ArcNovaDiffuserBigShot"); + SoundEngine.PlaySound(fire with { Volume = 0.2f, Pitch = 0.9f }, Projectile.Center); + + for (int i = 0; i < 5; i++) + { + firingVelocity3 = (shootDirection * 10).RotatedBy((0.04f * (i + 1)) * Utils.GetLerpValue(0, 55, Windup, true)); + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), GunTipPosition, firingVelocity3 * (1 - i * 0.1f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0, 2); + } + for (int i = 0; i < 5; i++) + { + firingVelocity3 = (shootDirection * 10).RotatedBy((-0.04f * (i + 1)) * Utils.GetLerpValue(0, 55, Windup, true)); + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), GunTipPosition, firingVelocity3 * (1 - i * 0.1f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0, 2); + } + + Particle pulse3 = new GlowSparkParticle(GunTipPosition, shootDirection * 18, false, 6, 0.057f, StaticEffectsColor, new Vector2(1.7f, 0.8f), true); + GeneralParticleHandler.SpawnParticle(pulse3); + } + + // Inside here go all the things that dedicated servers shouldn't spend resources on. + // Like visuals and sounds. + if (Main.dedServ) + return; + + for (int k = 0; k < 10; k++) + { + Vector2 shootVel = (shootDirection * 15).RotatedByRandom(0.5f) * Main.rand.NextFloat(0.1f, 1.8f); + + Dust dust2 = Dust.NewDustPerfect(GunTipPosition, Main.rand.NextBool(4) ? 267 : 66, shootVel); + dust2.scale = Main.rand.NextFloat(1.15f, 1.45f); + dust2.noGravity = true; + dust2.color = Main.rand.NextBool() ? Color.Lerp(StaticEffectsColor, Color.White, 0.5f) : StaticEffectsColor; + } + + // By decreasing the offset length of the gun from the arms, we give an effect of recoil. + if (yBeam) + OffsetLengthFromArm -= 32f; + else + OffsetLengthFromArm -= 6f; + } + private void PostFiringCooldown() + { + if (PostFireCooldown > 0 && Main.rand.NextBool()) + { + Vector2 smokeVel = new Vector2(0, -8) * Main.rand.NextFloat(0.1f, 1.1f); + Particle smoke = new HeavySmokeParticle(GunTipPosition, smokeVel, StaticEffectsColor, Main.rand.Next(30, 50 + 1), Main.rand.NextFloat(0.1f, 0.4f), 0.5f, Main.rand.NextFloat(-0.2f, 0.2f), Main.rand.NextBool(), required: true); + GeneralParticleHandler.SpawnParticle(smoke); + + Dust dust = Dust.NewDustPerfect(GunTipPosition, 303, smokeVel.RotatedByRandom(0.1f), 80, default, Main.rand.NextFloat(0.2f, 0.8f)); + dust.noGravity = false; + dust.color = StaticEffectsColor; + } + ShootingTimer = 0; + PostFireCooldown--; + } + } +} diff --git a/Projectiles/Magic/OmicronWingman.cs b/Projectiles/Magic/OmicronWingman.cs new file mode 100644 index 0000000000..1e4dd25840 --- /dev/null +++ b/Projectiles/Magic/OmicronWingman.cs @@ -0,0 +1,298 @@ +using System; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Particles; +using Humanizer; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Utilities; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using System.Collections.Generic; +using System.IO; +using CalamityMod.Graphics.Renderers; + +namespace CalamityMod.Projectiles.Magic +{ + public class OmicronWingman : ModProjectile + { + public override LocalizedText DisplayName => CalamityUtils.GetItemName(); + public override string Texture => "CalamityMod/Items/Weapons/Magic/Wingman"; + + public Color StaticEffectsColor = Color.MediumVioletRed; + private ref float ShootingTimer => ref Projectile.ai[0]; + private float FiringTime = 10; + private float PostFireCooldown = 0; + private Vector2 MovementOffset; + public bool MovingUp = true; + public float xOffset = 1; + public float yOffset = 0; + public int time = 0; + public int firingDelay = 15; + public int launchDelay = 0; + + private ref float OffsetLength => ref Projectile.localAI[0]; + + private Player Owner; + + private float MaxOffsetLength = 5f; + + public bool recharging = false; + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 142; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.netImportant = true; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 9; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + Projectile.hide = true; + } + + public override void AI() + { + if (time > 1 && Owner.ownedProjectileCounts[ModContent.ProjectileType()] < 1 && PostFireCooldown <= 0) + Projectile.Kill(); + Lighting.AddLight(Projectile.Center, StaticEffectsColor.ToVector3() * 0.2f); + if (time == 0) + { + MovingUp = Projectile.ai[2] == 1 ? true : false; + } + firingDelay--; + Item heldItem = Owner.ActiveItem(); + + // Update damage based on curent magic damage stat (so Mana Sickness affects it) + Projectile.damage = heldItem is null ? 0 : Owner.GetWeaponDamage(heldItem); + + Vector2 tipPosition = Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.Zero).RotatedBy(-0.05f * Projectile.direction) * 12f; + // If there's no player, or the player is the server, or the owner's stunned, there'll be no holdout. + if (PostFireCooldown == 0 && launchDelay == 0 && Owner.CantUseHoldout() || heldItem.type != ModContent.ItemType()) + { + NetUpdate(); + if (PostFireCooldown <= 0) + Projectile.Kill(); + } + + if (PostFireCooldown > 0) + { + PostFiringCooldown(); + } + + if (launchDelay > 0 || (PostFireCooldown <= 0 && (Owner.Calamity().mouseRight || (firingDelay <= 0 && Projectile.ai[2] == 1 || Projectile.ai[2] == -1)))) + { + // If the player's pressing RMB, it'll shoot the grenade. + if (launchDelay > 0 || Owner.Calamity().mouseRight) + { + if (launchDelay < 50) + launchDelay++; + + if (launchDelay >= 50 && (Owner.CheckMana(Owner.ActiveItem(), (int)(heldItem.mana * Owner.manaCost) * 2, true, false))) + { + Shoot(heldItem, true); + PostFireCooldown = 50; + ShootingTimer = 0; + launchDelay = 0; + } + } + else if (ShootingTimer >= FiringTime) + { + if (Owner.CheckMana(Owner.ActiveItem(), -1, false, false)) + { + Shoot(heldItem, false); + ShootingTimer = 0; + } + else if (PostFireCooldown <= 0) + { + Projectile.Kill(); + } + } + } + + // The center of the player, taking into account if they have a mount or not. + Vector2 ownerPosition = Owner.MountedCenter; + + // The vector between the player and the mouse. + Vector2 ownerToMouse = Owner.Calamity().mouseWorld - ownerPosition; + + // Deals with the holdout's rotation and direction, the owner's arms, etc. + ManageHoldout(ownerPosition, ownerToMouse); + + // When we change the distance of the gun from the arms for the recoil, + // recover to the original position smoothly. + if (OffsetLength != MaxOffsetLength) + OffsetLength = MathHelper.Lerp(OffsetLength, MaxOffsetLength, 0.1f); + + ShootingTimer++; + + // Inside here go all the things that dedicated servers shouldn't spend resources on. + // Like visuals and sounds. + if (Main.dedServ) + return; + + Vector2 shootDirection = Projectile.velocity.SafeNormalize(Vector2.Zero) * 20; + time++; + Projectile.soundDelay--; + } + + private void ManageHoldout(Vector2 mountedCenter, Vector2 ownerToMouse) + { + Vector2 rotationVector = Projectile.rotation.ToRotationVector2(); + float velocityRotation = Projectile.velocity.ToRotation(); + float proximityLookingUpwards = Vector2.Dot(ownerToMouse.SafeNormalize(Vector2.Zero), -Vector2.UnitY); + int direction = MathF.Sign(ownerToMouse.X); + + Vector2 armPosition = Owner.RotatedRelativePoint(mountedCenter, true); + Vector2 lengthOffset = rotationVector * OffsetLength; + Vector2 armOffset = new Vector2(Utils.Remap(proximityLookingUpwards, -1f, 1f, 0f, -12f) * direction, -10f + Utils.Remap(MathF.Abs(proximityLookingUpwards), 0f, 1f, 0f, proximityLookingUpwards > 0f ? 15f : 0f)); + + if (time % 30 == 0) + { + MovingUp = !MovingUp; + } + + //xOffset = MathHelper.Lerp(xOffset, placementOffset.X, 0.01f); + yOffset = MathHelper.Lerp(yOffset, 150 * (MovingUp ? -1 : 1), (0.085f - (FiringTime * 0.0012f))); + + Vector2 placementOffset = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(MathHelper.PiOver2) * (yOffset); + + Vector2 location = Owner.MountedCenter + placementOffset; + Projectile.Center = lengthOffset + location; + + + Projectile.velocity = velocityRotation.AngleTowards(ownerToMouse.ToRotation(), 0.2f).ToRotationVector2(); + Projectile.rotation = (Main.MouseWorld - Projectile.Center).SafeNormalize(Vector2.UnitX).ToRotation(); + Projectile.timeLeft = 2; + + Owner.heldProj = Projectile.whoAmI; + Owner.itemTime = Owner.itemAnimation = 2; + Owner.itemRotation = (Projectile.velocity * Projectile.direction).ToRotation(); + + Projectile.spriteDirection = Projectile.direction = direction; + } + + private void Shoot(Item item, bool isGrenade) + { + Vector2 shootDirection = (Main.MouseWorld - Projectile.Center).SafeNormalize(Vector2.UnitX); + + // The position of the tip of the gun. + Vector2 tipPosition = Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.Zero).RotatedBy(-0.05f * Projectile.direction) * 12f; + + // Spawns the projectile. + + Vector2 firingVelocity = shootDirection * 10; + if (isGrenade) + { + SoundStyle fire = new("CalamityMod/Sounds/Item/DeadSunExplosion"); + SoundEngine.PlaySound(fire with { Volume = 0.2f, Pitch = -0.4f, PitchVariance = 0.2f }, Projectile.Center); + Projectile bomb = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), tipPosition, firingVelocity, ModContent.ProjectileType(), Projectile.damage * 14, Projectile.knockBack * 5, Projectile.owner, 0, 2); + bomb.timeLeft = 530; + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), tipPosition, firingVelocity * 1.2f, ModContent.ProjectileType(), Projectile.damage * 14, Projectile.knockBack * 5, Projectile.owner, 0, 2); + } + else + { + SoundStyle fire = new("CalamityMod/Sounds/Item/MagnaCannonShot"); + SoundEngine.PlaySound(fire with { Volume = 0.25f, Pitch = 1f, PitchVariance = 0.35f }, Projectile.Center); + + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), tipPosition, firingVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0, 2); + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), tipPosition, firingVelocity.RotatedBy(-0.05) * 0.85f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0, 2); + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), tipPosition, firingVelocity.RotatedBy(0.05) * 0.85f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0, 2); + } + + NetUpdate(); + + // Inside here go all the things that dedicated servers shouldn't spend resources on. + // Like visuals and sounds. + if (Main.dedServ) + return; + + for (int k = 0; k < 6; k++) + { + Vector2 shootVel = (shootDirection * 10).RotatedByRandom(0.5f) * Main.rand.NextFloat(0.1f, 1.8f); + + Dust dust2 = Dust.NewDustPerfect(tipPosition, Main.rand.NextBool(4) ? 264 : 66, shootVel); + dust2.scale = Main.rand.NextFloat(1.15f, 1.45f); + dust2.noGravity = true; + dust2.color = Main.rand.NextBool() ? Color.Lerp(StaticEffectsColor, Color.White, 0.5f) : StaticEffectsColor; + } + Particle pulse = new GlowSparkParticle((tipPosition - shootDirection * 14), shootDirection * 20, false, Main.rand.Next(7, 11 + 1), 0.035f, StaticEffectsColor, new Vector2(1.5f, 0.9f), true); + GeneralParticleHandler.SpawnParticle(pulse); + + // By decreasing the offset length of the gun from the arms, we give an effect of recoil. + if (isGrenade) + OffsetLength -= 27f; + else + OffsetLength -= 5f; + } + private void PostFiringCooldown() + { + Vector2 tipPosition = Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.Zero).RotatedBy(-0.05f * Projectile.direction) * 12f; + + if (PostFireCooldown > 0 && Main.rand.NextBool()) + { + Vector2 smokeVel = new Vector2(0, -8) * Main.rand.NextFloat(0.1f, 1.1f); + Particle smoke = new HeavySmokeParticle(tipPosition, smokeVel, StaticEffectsColor, Main.rand.Next(30, 50 + 1), Main.rand.NextFloat(0.1f, 0.4f), 0.5f, Main.rand.NextFloat(-0.2f, 0.2f), Main.rand.NextBool(), required: true); + GeneralParticleHandler.SpawnParticle(smoke); + + Dust dust = Dust.NewDustPerfect(tipPosition, 303, smokeVel.RotatedByRandom(0.1f), 80, default, Main.rand.NextFloat(0.2f, 0.8f)); + dust.noGravity = false; + dust.color = StaticEffectsColor; + } + ShootingTimer = 0; + firingDelay = 15; + PostFireCooldown--; + } + + private void NetUpdate() + { + Projectile.netUpdate = true; + if (Projectile.netSpam >= 10) + Projectile.netSpam = 9; + } + + public override void OnSpawn(IEntitySource source) + { + Owner = Main.player[Projectile.owner]; + OffsetLength = MaxOffsetLength; + } + + // Because we use the velocity as a direction, we don't need it to change its position. + public override bool ShouldUpdatePosition() => false; + + public override bool? CanDamage() => false; + + public override bool PreDraw(ref Color lightColor) + { + if (time <= 0) + return false; + + Texture2D texture = ModContent.Request("CalamityMod/Items/Weapons/Magic/Wingman").Value; + + if (Projectile.ai[2] == 1) + texture = ModContent.Request("CalamityMod/Projectiles/Magic/OmicronWingman").Value; + else + texture = ModContent.Request("CalamityMod/Projectiles/Magic/OmicronWingmanAlt").Value; + + + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + Color drawColor = Projectile.GetAlpha(lightColor); + float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f); + Vector2 rotationPoint = texture.Size() * 0.5f; + SpriteEffects flipSprite = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + if (Projectile.spriteDirection == -1 ? MovingUp : !MovingUp) + flipSprite |= SpriteEffects.FlipVertically; + + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], Color.Lerp(StaticEffectsColor, Color.White, 0.5f) * 0.2f, 1, texture); + Main.EntitySpriteDraw(texture, drawPosition, null, drawColor, drawRotation, rotationPoint, Projectile.scale, flipSprite); + + return false; + } + public override void DrawBehind(int index, List behindNPCsAndTiles, List behindNPCs, List behindProjectiles, List overPlayers, List overWiresUI) + { + behindNPCs.Add(index); + } + } +} diff --git a/Projectiles/Magic/OmicronWingman.png b/Projectiles/Magic/OmicronWingman.png new file mode 100644 index 0000000000..d1aa882f83 Binary files /dev/null and b/Projectiles/Magic/OmicronWingman.png differ diff --git a/Projectiles/Magic/OmicronWingmanAlt.png b/Projectiles/Magic/OmicronWingmanAlt.png new file mode 100644 index 0000000000..5fc22bc984 Binary files /dev/null and b/Projectiles/Magic/OmicronWingmanAlt.png differ diff --git a/Projectiles/Magic/ParticleBeamofDoom.cs b/Projectiles/Magic/ParticleBeamofDoom.cs deleted file mode 100644 index 9f9892d94d..0000000000 --- a/Projectiles/Magic/ParticleBeamofDoom.cs +++ /dev/null @@ -1,38 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Magic -{ - public class ParticleBeamofDoom : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Magic"; - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public override void SetDefaults() - { - Projectile.width = 6; - Projectile.height = 6; - Projectile.friendly = true; - Projectile.DamageType = DamageClass.Magic; - Projectile.tileCollide = false; - Projectile.penetrate = -1; - Projectile.extraUpdates = 100; - Projectile.timeLeft = 100; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 30; - } - - public override void AI() - { - Projectile.localAI[0] += 1f; - if (Projectile.localAI[0] > 9f) - { - Vector2 projPos = Projectile.position; - projPos -= Projectile.velocity * 0.25f; - int particleDust = Dust.NewDust(projPos, 1, 1, 206, 0f, 0f, 0, default, 2.5f); - Main.dust[particleDust].position = projPos; - Main.dust[particleDust].velocity *= 0.1f; - } - } - } -} diff --git a/Projectiles/Magic/PartySparkle.cs b/Projectiles/Magic/PartySparkle.cs index 35da0ee3a0..f9d953761f 100644 --- a/Projectiles/Magic/PartySparkle.cs +++ b/Projectiles/Magic/PartySparkle.cs @@ -1,7 +1,7 @@ -using CalamityMod.Items.Weapons.Magic; +using System; +using CalamityMod.Items.Weapons.Magic; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ModLoader; @@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Magic } public override bool PreDraw(ref Color lightColor) { - Texture2D sparkleTexture = ModContent.Request(Texture).Value; + Texture2D sparkleTexture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Color sparkleColor = CalamityUtils.MulticolorLerp(ColorSpectrumHue, RainbowPartyCannon.ColorSet) * Projectile.Opacity * 0.5f; sparkleColor.A = 0; diff --git a/Projectiles/Magic/PhantasmalFuryProj.cs b/Projectiles/Magic/PhantasmalFuryProj.cs index 8cb79d5db9..806fdadff5 100644 --- a/Projectiles/Magic/PhantasmalFuryProj.cs +++ b/Projectiles/Magic/PhantasmalFuryProj.cs @@ -1,9 +1,9 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { public class PhantasmalFuryProj : ModProjectile, ILocalizedModType @@ -52,7 +52,7 @@ namespace CalamityMod.Projectiles.Magic for (int i = 0; i < 3; i++) { - int spectre = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 175, 0f, 0f, 100, default, 2f); + int spectre = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.SpectreStaff, 0f, 0f, 100, default, 2f); Main.dust[spectre].noGravity = true; Main.dust[spectre].velocity *= 0.5f; Main.dust[spectre].velocity += Projectile.velocity * 0.1f; @@ -65,10 +65,10 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item43, Projectile.position); + SoundEngine.PlaySound(SoundID.Item43, Projectile.Center); for (int j = 0; j <= 10; j++) { - Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 175, 0f, 0f, 100, default, 1f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.SpectreStaff, 0f, 0f, 100, default, 1f); } if (Projectile.owner == Main.myPlayer) { diff --git a/Projectiles/Magic/Phantom.cs b/Projectiles/Magic/Phantom.cs index 17efcbd8a3..16f456274e 100644 --- a/Projectiles/Magic/Phantom.cs +++ b/Projectiles/Magic/Phantom.cs @@ -1,6 +1,8 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Magic { public class Phantom : ModProjectile, ILocalizedModType @@ -26,7 +28,7 @@ namespace CalamityMod.Projectiles.Magic for (int i = 0; i < 2; i++) { - int spectre = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 175, 0f, 0f, 100, default, 1f); + int spectre = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.SpectreStaff, 0f, 0f, 100, default, 1f); Main.dust[spectre].noGravity = true; } diff --git a/Projectiles/Magic/PhasedGodRay.cs b/Projectiles/Magic/PhasedGodRay.cs index b32fcba2a4..97b300715c 100644 --- a/Projectiles/Magic/PhasedGodRay.cs +++ b/Projectiles/Magic/PhasedGodRay.cs @@ -1,6 +1,6 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Projectiles/Magic/TerraShard.cs b/Projectiles/Magic/PhotosyntheticShard.cs similarity index 83% rename from Projectiles/Magic/TerraShard.cs rename to Projectiles/Magic/PhotosyntheticShard.cs index 26a136bb6b..750b53b166 100644 --- a/Projectiles/Magic/TerraShard.cs +++ b/Projectiles/Magic/PhotosyntheticShard.cs @@ -1,8 +1,10 @@ -using Terraria; +using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Magic { - public class TerraShard : ModProjectile, ILocalizedModType + public class PhotosyntheticShard : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Magic"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; @@ -20,7 +22,7 @@ namespace CalamityMod.Projectiles.Magic { for (int i = 0; i < 4; i++) { - Dust terraMagic = Dust.NewDustDirect(Projectile.Center, 1, 1, 107, 0f, 0f, 0, default, 0.5f); + Dust terraMagic = Dust.NewDustDirect(Projectile.Center, 1, 1, DustID.TerraBlade, 0f, 0f, 0, default, 0.5f); terraMagic.scale = 0.42f; terraMagic.velocity *= 0.1f; } diff --git a/Projectiles/Magic/TerraBeam.cs b/Projectiles/Magic/PhotosyntheticSolarBeam.cs similarity index 91% rename from Projectiles/Magic/TerraBeam.cs rename to Projectiles/Magic/PhotosyntheticSolarBeam.cs index a8cdb69688..fb6fd037ed 100644 --- a/Projectiles/Magic/TerraBeam.cs +++ b/Projectiles/Magic/PhotosyntheticSolarBeam.cs @@ -7,7 +7,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { - public class TerraBeam : BaseLaserbeamProjectile, ILocalizedModType + public class PhotosyntheticSolarBeam : BaseLaserbeamProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Magic"; public override float MaxScale => 1f; @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.friendly = true; Projectile.DamageType = DamageClass.Magic; Projectile.ignoreWater = true; - Projectile.penetrate = 10; + Projectile.penetrate = -1; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 12; Projectile.tileCollide = false; @@ -79,6 +79,13 @@ namespace CalamityMod.Projectiles.Magic DrawBeamWithColor(Color.Yellow * 1.1f, Projectile.scale * 0.5f); return false; } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + if (Projectile.numHits > 0) + Projectile.damage = (int)(Projectile.damage * 0.95f); + if (Projectile.damage < 1) + Projectile.damage = 1; + } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { @@ -91,7 +98,7 @@ namespace CalamityMod.Projectiles.Magic float lengthFromStart = Projectile.Distance(target.Center); int totalShards = (int)MathHelper.Lerp(1, 3, MathHelper.Clamp(lengthFromStart / MaxLaserLength * 1.5f, 0f, 1f)); - int shardType = ModContent.ProjectileType(); + int shardType = ModContent.ProjectileType(); int shardDamage = (int)(Projectile.damage * 0.5); for (int i = 0; i < totalShards; i++) { diff --git a/Projectiles/Magic/PlagueFang.cs b/Projectiles/Magic/PlagueFang.cs index e30b11763e..443df05763 100644 --- a/Projectiles/Magic/PlagueFang.cs +++ b/Projectiles/Magic/PlagueFang.cs @@ -1,10 +1,10 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; -using System; using Terraria; -using Terraria.ModLoader; -using Terraria.ID; using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; if (Projectile.alpha > 0) { Projectile.alpha -= 50; @@ -37,12 +37,12 @@ namespace CalamityMod.Projectiles.Magic } if (Projectile.alpha == 0) { - int plagued = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 163, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 1f); + int plagued = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.PoisonStaff, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 1f); Main.dust[plagued].noGravity = true; Main.dust[plagued].velocity *= 0.6f; Main.dust[plagued].velocity -= Projectile.velocity * 0.4f; - int venomed = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 205, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 1f); + int venomed = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.VenomStaff, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 1f); Main.dust[venomed].noGravity = true; Main.dust[venomed].velocity *= 0.2f; Main.dust[venomed].velocity -= Projectile.velocity * 0.4f; @@ -60,15 +60,15 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Dig, Projectile.position); + SoundEngine.PlaySound(SoundID.Dig, Projectile.Center); for (int i = 0; i < 7; i++) { - int killPlague = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 163, 0f, 0f, 100, default, 1f); + int killPlague = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.PoisonStaff, 0f, 0f, 100, default, 1f); Main.dust[killPlague].noGravity = true; Main.dust[killPlague].velocity *= 1.2f; Main.dust[killPlague].velocity -= Projectile.oldVelocity * 0.3f; - int killVenom = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 205, 0f, 0f, 100, default, 1f); + int killVenom = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.VenomStaff, 0f, 0f, 100, default, 1f); Dust dust = Main.dust[killVenom]; dust.noGravity = true; dust.velocity *= 1.2f; diff --git a/Projectiles/Magic/PlasmaBolt.cs b/Projectiles/Magic/PlasmaBolt.cs index 5381ab355a..a7db8784ad 100644 --- a/Projectiles/Magic/PlasmaBolt.cs +++ b/Projectiles/Magic/PlasmaBolt.cs @@ -1,6 +1,8 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Magic { public class PlasmaBolt : ModProjectile, ILocalizedModType @@ -27,7 +29,7 @@ namespace CalamityMod.Projectiles.Magic { for (int d = 0; d < 5; d++) { - Dust dust = Main.dust[Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 107, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 1f)]; + Dust dust = Main.dust[Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.TerraBlade, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 1f)]; dust.velocity = Vector2.Zero; dust.position -= Projectile.velocity / 5f * d; dust.noGravity = true; diff --git a/Projectiles/Magic/PlasmaRay.cs b/Projectiles/Magic/PlasmaRay.cs index 2c90f26dfb..b0c6fe4ce1 100644 --- a/Projectiles/Magic/PlasmaRay.cs +++ b/Projectiles/Magic/PlasmaRay.cs @@ -1,5 +1,5 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 65, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.DemonTorch, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); if (Projectile.velocity.X != Projectile.velocity.X) { Projectile.position.X = Projectile.position.X + Projectile.velocity.X; @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.Magic Vector2 projPos = Projectile.position; projPos -= Projectile.velocity * ((float)i * 0.25f); Projectile.alpha = 255; - int purpDust = Dust.NewDust(projPos, 1, 1, 173, 0f, 0f, 0, default, 0.75f); + int purpDust = Dust.NewDust(projPos, 1, 1, DustID.ShadowbeamStaff, 0f, 0f, 0, default, 0.75f); Main.dust[purpDust].position = projPos; Main.dust[purpDust].scale = (float)Main.rand.Next(70, 110) * 0.013f; Main.dust[purpDust].velocity *= 0.2f; @@ -80,7 +80,7 @@ namespace CalamityMod.Projectiles.Magic { for (int k = 0; k < 5; k++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 173, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } diff --git a/Projectiles/Magic/PlasmaRay2.cs b/Projectiles/Magic/PlasmaRay2.cs index b055d0643a..cb246a839a 100644 --- a/Projectiles/Magic/PlasmaRay2.cs +++ b/Projectiles/Magic/PlasmaRay2.cs @@ -1,6 +1,8 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Magic { public class PlasmaRay2 : ModProjectile, ILocalizedModType @@ -22,7 +24,7 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 65, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.DemonTorch, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); if (Projectile.velocity.X != Projectile.velocity.X) { Projectile.position.X = Projectile.position.X + Projectile.velocity.X; @@ -41,7 +43,7 @@ namespace CalamityMod.Projectiles.Magic Vector2 projPos = Projectile.position; projPos -= Projectile.velocity * ((float)i * 0.25f); Projectile.alpha = 255; - int purpDust = Dust.NewDust(projPos, 1, 1, 173, 0f, 0f, 0, default, 0.25f); + int purpDust = Dust.NewDust(projPos, 1, 1, DustID.ShadowbeamStaff, 0f, 0f, 0, default, 0.25f); Main.dust[purpDust].position = projPos; Main.dust[purpDust].scale = (float)Main.rand.Next(70, 110) * 0.013f; Main.dust[purpDust].velocity *= 0.2f; diff --git a/Projectiles/Magic/PlasmaShot.cs b/Projectiles/Magic/PlasmaShot.cs index db4a6c3c25..6107767870 100644 --- a/Projectiles/Magic/PlasmaShot.cs +++ b/Projectiles/Magic/PlasmaShot.cs @@ -1,8 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { public class PlasmaShot : ModProjectile, ILocalizedModType @@ -29,7 +29,7 @@ namespace CalamityMod.Projectiles.Magic { for (int d = 0; d < 10; d++) { - Dust dust = Main.dust[Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 107, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 1f)]; + Dust dust = Main.dust[Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.TerraBlade, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 1f)]; dust.velocity = Vector2.Zero; dust.position -= Projectile.velocity / 5f * d; dust.noGravity = true; @@ -40,21 +40,21 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item14, Projectile.position); + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); int cloudAmt = Main.rand.Next(20, 31); if (Projectile.owner == Main.myPlayer) { for (int i = 0; i < cloudAmt; i++) { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 10f, 200f, 0.01f); - Projectile cloud = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ProjectileID.ToxicCloud + Main.rand.Next(3), Projectile.damage, 1f, Projectile.owner, 0f, Main.rand.Next(-45, 1)); + Projectile cloud = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ProjectileID.ToxicCloud + Main.rand.Next(3), (int)(Projectile.damage * 0.3f), 1f, Projectile.owner, 0f, Main.rand.Next(-45, 1)); cloud.usesIDStaticNPCImmunity = true; cloud.idStaticNPCHitCooldown = 10; } } for (int k = 0; k < 5; k++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 107, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.TerraBlade, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } } diff --git a/Projectiles/Magic/PoseidonTyphoon.cs b/Projectiles/Magic/PoseidonTyphoon.cs index 3710bf2918..b53fafad64 100644 --- a/Projectiles/Magic/PoseidonTyphoon.cs +++ b/Projectiles/Magic/PoseidonTyphoon.cs @@ -1,11 +1,11 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using Microsoft.Xna.Framework.Graphics; -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; namespace CalamityMod.Projectiles.Magic { @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item10, Projectile.position); + SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); } public override Color? GetAlpha(Color lightColor) @@ -73,7 +73,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, null, lightColor, Projectile.rotation, texture.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } diff --git a/Projectiles/Magic/PrinceFlameLarge.cs b/Projectiles/Magic/PrinceFlameLarge.cs index 84af6def6c..d29aae3dde 100644 --- a/Projectiles/Magic/PrinceFlameLarge.cs +++ b/Projectiles/Magic/PrinceFlameLarge.cs @@ -1,12 +1,12 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Items.Weapons.Magic; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { diff --git a/Projectiles/Magic/RainbowComet.cs b/Projectiles/Magic/RainbowComet.cs index a75810805a..b6fa5e20be 100644 --- a/Projectiles/Magic/RainbowComet.cs +++ b/Projectiles/Magic/RainbowComet.cs @@ -1,12 +1,12 @@ -using CalamityMod.Items.Weapons.Magic; +using System; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Sounds; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using CalamityMod.Sounds; namespace CalamityMod.Projectiles.Magic { @@ -46,7 +46,7 @@ namespace CalamityMod.Projectiles.Magic } public override bool PreDraw(ref Color lightColor) { - Texture2D cometTexture = ModContent.Request(Texture).Value; + Texture2D cometTexture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(cometTexture, Projectile.Center + Vector2.UnitY * Projectile.gfxOffY - Main.screenPosition, cometTexture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame), diff --git a/Projectiles/Magic/RainbowPartyCannonProjectile.cs b/Projectiles/Magic/RainbowPartyCannonProjectile.cs index 4f9c2b43df..4472644d00 100644 --- a/Projectiles/Magic/RainbowPartyCannonProjectile.cs +++ b/Projectiles/Magic/RainbowPartyCannonProjectile.cs @@ -1,6 +1,6 @@ -using CalamityMod.Items.Weapons.Magic; +using System; +using CalamityMod.Items.Weapons.Magic; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.Audio; using Terraria.Localization; @@ -31,8 +31,7 @@ namespace CalamityMod.Projectiles.Magic UpdatePlayerVisuals(Owner.Center); - bool stillUsingCannon = Owner.channel && !Owner.noItems && !Owner.CCed; - if (!stillUsingCannon) + if (Owner.CantUseHoldout()) { Projectile.Kill(); return; diff --git a/Projectiles/Magic/RainbowRocket.cs b/Projectiles/Magic/RainbowRocket.cs index 47fc617a81..e67fd17d8a 100644 --- a/Projectiles/Magic/RainbowRocket.cs +++ b/Projectiles/Magic/RainbowRocket.cs @@ -1,12 +1,12 @@ -using CalamityMod.DataStructures; +using System; +using CalamityMod.DataStructures; +using CalamityMod.Graphics.Primitives; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using CalamityMod.Graphics.Primitives; namespace CalamityMod.Projectiles.Magic { @@ -138,7 +138,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.oldPos[0] = Projectile.position + Projectile.velocity.SafeNormalize(Vector2.Zero) * 50f; PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(WidthFunction, ColorFunction, (_) => Projectile.Size * 0.5f + Projectile.velocity), 80); - Texture2D rocketTexture = ModContent.Request(Texture).Value; + Texture2D rocketTexture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(rocketTexture, Projectile.Center - Main.screenPosition, rocketTexture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame), diff --git a/Projectiles/Magic/RancorArm.cs b/Projectiles/Magic/RancorArm.cs index f909f2d0a9..e9247e6092 100644 --- a/Projectiles/Magic/RancorArm.cs +++ b/Projectiles/Magic/RancorArm.cs @@ -1,14 +1,14 @@ -using CalamityMod.World; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; +using System; using System.Collections.Generic; using System.IO; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; using Terraria.WorldBuilding; -using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -148,7 +148,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Rectangle frame = texture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); Vector2 origin = frame.Size() * 0.5f; Vector2 drawPosition = Projectile.Center - Main.screenPosition; diff --git a/Projectiles/Magic/RancorFog.cs b/Projectiles/Magic/RancorFog.cs index 1896f3c3ab..cc971a645e 100644 --- a/Projectiles/Magic/RancorFog.cs +++ b/Projectiles/Magic/RancorFog.cs @@ -57,7 +57,7 @@ namespace CalamityMod.Projectiles.Magic { Main.spriteBatch.SetBlendState(BlendState.Additive); - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Vector2 origin = texture.Size() * 0.5f; Vector2 drawPosition = Projectile.Center - Main.screenPosition; float opacity = Utils.GetLerpValue(0f, 0.08f, LightPower, true) * Projectile.Opacity * 0.5f; diff --git a/Projectiles/Magic/RancorLaserbeam.cs b/Projectiles/Magic/RancorLaserbeam.cs index 023978211a..df0f3ecfc8 100644 --- a/Projectiles/Magic/RancorLaserbeam.cs +++ b/Projectiles/Magic/RancorLaserbeam.cs @@ -1,11 +1,11 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using System.Collections.Generic; +using System.Linq; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Graphics.Metaballs; using CalamityMod.Graphics.Primitives; using CalamityMod.World; using Microsoft.Xna.Framework; -using System; -using System.Collections.Generic; -using System.Linq; using Terraria; using Terraria.Graphics.Shaders; using Terraria.ModLoader; diff --git a/Projectiles/Magic/RancorMagicCircle.cs b/Projectiles/Magic/RancorMagicCircle.cs index c5a5189628..f048530309 100644 --- a/Projectiles/Magic/RancorMagicCircle.cs +++ b/Projectiles/Magic/RancorMagicCircle.cs @@ -1,7 +1,8 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Particles; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Utilities; -using System; using Terraria; using Terraria.Audio; using Terraria.Graphics.Shaders; @@ -27,7 +28,7 @@ namespace CalamityMod.Projectiles.Magic } } public float ChargeupCompletion => MathHelper.Clamp(Time / ChargeupTime, 0f, 1f); - public const int ChargeupTime = 240; + public const int ChargeupTime = 180; public override void SetDefaults() { @@ -121,7 +122,7 @@ namespace CalamityMod.Projectiles.Magic public void DoPrettyDustEffects() { - int dustSpawnChance = (int)MathHelper.SmoothStep(16f, 4f, ChargeupCompletion); + int dustSpawnChance = (int)MathHelper.SmoothStep(20f, 2f, ChargeupCompletion); for (int i = 0; i < 2; i++) { if (!Main.rand.NextBool(dustSpawnChance)) @@ -140,10 +141,26 @@ namespace CalamityMod.Projectiles.Magic magic.noLight = true; magic.noGravity = true; } + + // Light particle effects, which get bigger and turn from white to red as the beam charges. + // It then stays at max size and red color as long as the beam is firing. + if (Time > 30 && Time % 5 == 0) + { + Vector2 particleVel = Main.rand.NextVector2CircularEdge(1f, 1f); + particleVel.SafeNormalize(Vector2.Zero); + particleVel *= Main.rand.NextFloat(5f, 10f); + + Particle chargeParticle = new GenericBloom(Projectile.Center, particleVel, Color.Lerp(Color.White, Color.Red, ChargeupCompletion), MathHelper.Lerp(0.075f, 0.35f, ChargeupCompletion), 30); + GeneralParticleHandler.SpawnParticle(chargeParticle); + } } public void HandleChargeEffects() { + // Play charge-up sound. + if (Time == 30) + SoundEngine.PlaySound(new("CalamityMod/Sounds/Custom/MoonLordLaserCharge"), Projectile.Center, _ => new ProjectileAudioTracker(Projectile).IsActiveAndInGame()); + // Create dust that fires parallel to the direction of the circle. if (Main.rand.NextBool(3)) { @@ -174,7 +191,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { - Texture2D outerCircleTexture = ModContent.Request(Texture).Value; + Texture2D outerCircleTexture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Texture2D outerCircleGlowmask = ModContent.Request(Texture + "Glowmask").Value; Texture2D innerCircleTexture = ModContent.Request(Texture + "Inner").Value; Texture2D innerCircleGlowmask = ModContent.Request(Texture + "InnerGlowmask").Value; diff --git a/Projectiles/Magic/RedirectingFire.cs b/Projectiles/Magic/RedirectingFire.cs index a554461506..8b9b9fb929 100644 --- a/Projectiles/Magic/RedirectingFire.cs +++ b/Projectiles/Magic/RedirectingFire.cs @@ -1,9 +1,9 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { diff --git a/Projectiles/Magic/RedirectingGildedSoul.cs b/Projectiles/Magic/RedirectingGildedSoul.cs index 65ec69a8c7..c2ce615eb3 100644 --- a/Projectiles/Magic/RedirectingGildedSoul.cs +++ b/Projectiles/Magic/RedirectingGildedSoul.cs @@ -1,10 +1,10 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Rectangle frame = texture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); SpriteEffects direction = Projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; for (int i = 0; i < 4; i++) diff --git a/Projectiles/Magic/RedirectingLostSoul.cs b/Projectiles/Magic/RedirectingLostSoul.cs index 14b0d63b95..979cc77c90 100644 --- a/Projectiles/Magic/RedirectingLostSoul.cs +++ b/Projectiles/Magic/RedirectingLostSoul.cs @@ -1,10 +1,10 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { SpriteEffects direction = Projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Rectangle frame = texture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); for (int j = 0; j < Projectile.oldPos.Length / 2; j++) diff --git a/Projectiles/Magic/RedirectingVengefulSoul.cs b/Projectiles/Magic/RedirectingVengefulSoul.cs index 15dba74247..88f6a69fbb 100644 --- a/Projectiles/Magic/RedirectingVengefulSoul.cs +++ b/Projectiles/Magic/RedirectingVengefulSoul.cs @@ -1,10 +1,10 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -79,7 +79,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { SpriteEffects direction = Projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Rectangle frame = texture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); for (int i = 0; i < 4; i++) { diff --git a/Projectiles/Magic/RougeSlashLarge.cs b/Projectiles/Magic/RougeSlashLarge.cs index 355e833247..135719035b 100644 --- a/Projectiles/Magic/RougeSlashLarge.cs +++ b/Projectiles/Magic/RougeSlashLarge.cs @@ -1,5 +1,5 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -48,7 +48,7 @@ namespace CalamityMod.Projectiles.Magic Vector2 dustRotation = Vector2.UnitX * -Projectile.width / 2f; dustRotation += -Vector2.UnitY.RotatedBy(l * MathHelper.Pi / 6f) * new Vector2(8f, 16f); dustRotation = dustRotation.RotatedBy(Projectile.rotation - MathHelper.PiOver2); - int rougeDust = Dust.NewDust(Projectile.Center, 0, 0, 60, 0f, 0f, 160, default, 1f); + int rougeDust = Dust.NewDust(Projectile.Center, 0, 0, DustID.RedTorch, 0f, 0f, 160, default, 1f); Main.dust[rougeDust].scale = 1.1f; Main.dust[rougeDust].noGravity = true; Main.dust[rougeDust].position = Projectile.Center + dustRotation; diff --git a/Projectiles/Magic/RougeSlashMedium.cs b/Projectiles/Magic/RougeSlashMedium.cs index c7f0d4712b..76c9ccf14d 100644 --- a/Projectiles/Magic/RougeSlashMedium.cs +++ b/Projectiles/Magic/RougeSlashMedium.cs @@ -1,5 +1,5 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -48,7 +48,7 @@ namespace CalamityMod.Projectiles.Magic Vector2 dustRotation = Vector2.UnitX * -Projectile.width / 2f; dustRotation += -Vector2.UnitY.RotatedBy(l * MathHelper.Pi / 6f) * new Vector2(8f, 16f); dustRotation = dustRotation.RotatedBy(Projectile.rotation - MathHelper.PiOver2); - int rougeDust = Dust.NewDust(Projectile.Center, 0, 0, 60, 0f, 0f, 160, default, 1f); + int rougeDust = Dust.NewDust(Projectile.Center, 0, 0, DustID.RedTorch, 0f, 0f, 160, default, 1f); Main.dust[rougeDust].scale = 1.1f; Main.dust[rougeDust].noGravity = true; Main.dust[rougeDust].position = Projectile.Center + dustRotation; diff --git a/Projectiles/Magic/RougeSlashSmall.cs b/Projectiles/Magic/RougeSlashSmall.cs index 554c6f2d92..9e595d029b 100644 --- a/Projectiles/Magic/RougeSlashSmall.cs +++ b/Projectiles/Magic/RougeSlashSmall.cs @@ -1,5 +1,5 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -48,7 +48,7 @@ namespace CalamityMod.Projectiles.Magic Vector2 dustRotation = Vector2.UnitX * -Projectile.width / 2f; dustRotation += -Vector2.UnitY.RotatedBy(l * MathHelper.Pi / 6f) * new Vector2(8f, 16f); dustRotation = dustRotation.RotatedBy(Projectile.rotation - MathHelper.PiOver2); - int rougeDust = Dust.NewDust(Projectile.Center, 0, 0, 60, 0f, 0f, 160, default, 1f); + int rougeDust = Dust.NewDust(Projectile.Center, 0, 0, DustID.RedTorch, 0f, 0f, 160, default, 1f); Main.dust[rougeDust].scale = 1.1f; Main.dust[rougeDust].noGravity = true; Main.dust[rougeDust].position = Projectile.Center + dustRotation; diff --git a/Projectiles/Magic/SHPB.cs b/Projectiles/Magic/SHPB.cs index 0e15e88b72..5b7c11d916 100644 --- a/Projectiles/Magic/SHPB.cs +++ b/Projectiles/Magic/SHPB.cs @@ -1,10 +1,10 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { public class SHPB : ModProjectile, ILocalizedModType @@ -99,8 +99,8 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { - Texture2D texture2D13 = ModContent.Request(Texture).Value; - int framing = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; + Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + int framing = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; int y6 = framing * Projectile.frame; Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)framing / 2f), Projectile.scale, SpriteEffects.None, 0); return false; @@ -108,7 +108,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item105, Projectile.position); + SoundEngine.PlaySound(SoundID.Item105, Projectile.Center); if (Projectile.owner == Main.myPlayer) { Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); diff --git a/Projectiles/Magic/SHPExplosion.cs b/Projectiles/Magic/SHPExplosion.cs index 1534873dc1..10f9bacce6 100644 --- a/Projectiles/Magic/SHPExplosion.cs +++ b/Projectiles/Magic/SHPExplosion.cs @@ -1,5 +1,5 @@ +using System; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic @@ -20,7 +20,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.penetrate = -1; Projectile.timeLeft = 60; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; + Projectile.localNPCHitCooldown = 15; } public override void AI() @@ -63,7 +63,7 @@ namespace CalamityMod.Projectiles.Magic { randomDust = 187; } - int EXPLODE = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDust, 0f, 0f, 100, default, 2f); + int EXPLODE = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, randomDust, 0f, 0f, 100, default, 2f); Main.dust[EXPLODE].noGravity = true; Main.dust[EXPLODE].position.X = Projectile.Center.X; Main.dust[EXPLODE].position.Y = Projectile.Center.Y; diff --git a/Projectiles/Magic/SHPL.cs b/Projectiles/Magic/SHPL.cs index db74a57ca1..38f612c3a0 100644 --- a/Projectiles/Magic/SHPL.cs +++ b/Projectiles/Magic/SHPL.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic diff --git a/Projectiles/Magic/Sandstream.cs b/Projectiles/Magic/Sandstream.cs index ba1a111ee5..3333fb74ac 100644 --- a/Projectiles/Magic/Sandstream.cs +++ b/Projectiles/Magic/Sandstream.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Projectiles.Magic { for (int i = 0; i <= 10; i++) { - Dust dust = Dust.NewDustPerfect(Projectile.Center,313, Projectile.velocity.RotatedByRandom(MathHelper.ToRadians(35f)) * Main.rand.NextFloat(0.2f, 1.2f), 0, default, Main.rand.NextFloat(1.3f, 1.7f)); + Dust dust = Dust.NewDustPerfect(Projectile.Center, 313, Projectile.velocity.RotatedByRandom(MathHelper.ToRadians(35f)) * Main.rand.NextFloat(0.2f, 1.2f), 0, default, Main.rand.NextFloat(1.3f, 1.7f)); dust.noGravity = true; dust.scale = Main.rand.NextFloat(1.7f, 2.3f); } diff --git a/Projectiles/Magic/SanguineFlareProj.cs b/Projectiles/Magic/SanguineFlareProj.cs index cf6e69a93e..1d75f56d9a 100644 --- a/Projectiles/Magic/SanguineFlareProj.cs +++ b/Projectiles/Magic/SanguineFlareProj.cs @@ -1,11 +1,12 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Balancing; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -65,7 +66,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item14, Projectile.position); + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); Projectile.width = 10; @@ -74,7 +75,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int i = 0; i < 3; i++) { - int brimDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1.2f); + int brimDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1.2f); Main.dust[brimDust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -84,22 +85,24 @@ namespace CalamityMod.Projectiles.Magic } for (int j = 0; j < 6; j++) { - int brimDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1.7f); + int brimDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1.7f); Main.dust[brimDust2].noGravity = true; Main.dust[brimDust2].velocity *= 5f; - brimDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1f); + brimDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1f); Main.dust[brimDust2].velocity *= 2f; } } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - if (!target.canGhostHeal || Main.player[Projectile.owner].moonLeech) + int heal = (int)Math.Round(hit.Damage * 0.025); + if (heal > BalancingConstants.LifeStealCap) + heal = BalancingConstants.LifeStealCap; + + if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) return; - Player player = Main.player[Projectile.owner]; - player.statLife += 1; - player.HealEffect(1); + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); } public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Magic/SeethingDischargeBrimstoneBarrage.cs b/Projectiles/Magic/SeethingDischargeBrimstoneBarrage.cs index f63e09685a..82a333a554 100644 --- a/Projectiles/Magic/SeethingDischargeBrimstoneBarrage.cs +++ b/Projectiles/Magic/SeethingDischargeBrimstoneBarrage.cs @@ -1,6 +1,6 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -37,7 +37,7 @@ namespace CalamityMod.Projectiles.Magic { Projectile.velocity *= 1.01f; } - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; Projectile.frameCounter++; if (Projectile.frameCounter > 4) { diff --git a/Projectiles/Magic/SeethingDischargeBrimstoneHellblast.cs b/Projectiles/Magic/SeethingDischargeBrimstoneHellblast.cs index a6f3f9d824..f7ff1b9085 100644 --- a/Projectiles/Magic/SeethingDischargeBrimstoneHellblast.cs +++ b/Projectiles/Magic/SeethingDischargeBrimstoneHellblast.cs @@ -1,11 +1,11 @@ -using CalamityMod.Dusts; +using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using CalamityMod.Buffs.DamageOverTime; namespace CalamityMod.Projectiles.Magic { @@ -62,7 +62,7 @@ namespace CalamityMod.Projectiles.Magic if (Projectile.ai[1] == 0f) { Projectile.ai[1] = 1f; - SoundEngine.PlaySound(SoundID.Item20, Projectile.position); + SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); } Projectile.velocity.X *= 1.03f; Projectile.velocity.Y *= 1.03f; @@ -74,7 +74,7 @@ namespace CalamityMod.Projectiles.Magic else { Projectile.spriteDirection = 1; - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X); + Projectile.rotation = Projectile.velocity.ToRotation(); } } @@ -95,7 +95,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item20, Projectile.position); + SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); for (int dust = 0; dust <= 5; dust++) { Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f); diff --git a/Projectiles/Magic/SerpentineBody.cs b/Projectiles/Magic/SerpentineBody.cs index 88aba041e0..c3586ae240 100644 --- a/Projectiles/Magic/SerpentineBody.cs +++ b/Projectiles/Magic/SerpentineBody.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.DamageType = DamageClass.Magic; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 20; - Projectile.ArmorPenetration = 15; + Projectile.ArmorPenetration = 15; } public override void AI() @@ -54,7 +54,7 @@ namespace CalamityMod.Projectiles.Magic { for (int k = 0; k < 8; k++) { - int seaDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 68, 0f, 0f, 100, default, 1.25f); + int seaDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.BlueCrystalShard, 0f, 0f, 100, default, 1.25f); Dust dust = Main.dust[seaDust]; dust.velocity *= 0.3f; Main.dust[seaDust].position.X = Projectile.position.X + (float)(Projectile.width / 2) + 4f + (float)Main.rand.Next(-4, 5); diff --git a/Projectiles/Magic/SerpentineHead.cs b/Projectiles/Magic/SerpentineHead.cs index eda87d1e9a..b49cdfa57a 100644 --- a/Projectiles/Magic/SerpentineHead.cs +++ b/Projectiles/Magic/SerpentineHead.cs @@ -1,9 +1,9 @@ +using System; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.DamageType = DamageClass.Magic; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 20; - Projectile.ArmorPenetration = 15; + Projectile.ArmorPenetration = 15; } public override void AI() @@ -41,7 +41,7 @@ namespace CalamityMod.Projectiles.Magic { Projectile.alpha = 0; } - int seaDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 68, 0f, 0f, 100, default, 1.25f); + int seaDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.BlueCrystalShard, 0f, 0f, 100, default, 1.25f); Dust dust = Main.dust[seaDust]; dust.velocity *= 0.3f; Main.dust[seaDust].position.X = Projectile.position.X + (float)(Projectile.width / 2) + 4f + (float)Main.rand.Next(-4, 5); @@ -78,7 +78,7 @@ namespace CalamityMod.Projectiles.Magic if (Main.player[Projectile.owner].channel) { float chaseMouseDist = 18f; - Vector2 projDirection = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); + Vector2 projDirection = Projectile.Center; float mouseX = (float)Main.mouseX + Main.screenPosition.X - projDirection.X; float mouseY = (float)Main.mouseY + Main.screenPosition.Y - projDirection.Y; if (Main.player[Projectile.owner].gravDir == -1f) @@ -120,7 +120,7 @@ namespace CalamityMod.Projectiles.Magic else if (Projectile.ai[0] <= 0f) { Projectile.netUpdate = true; - Vector2 faceDirection = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); + Vector2 faceDirection = Projectile.Center; float miceX = (float)Main.mouseX + Main.screenPosition.X - faceDirection.X; float miceY = (float)Main.mouseY + Main.screenPosition.Y - faceDirection.Y; if (Main.player[Projectile.owner].gravDir == -1f) @@ -149,7 +149,7 @@ namespace CalamityMod.Projectiles.Magic } if (Projectile.velocity.X != 0f || Projectile.velocity.Y != 0f) { - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; } if (Projectile.velocity.Y > 16f) { @@ -159,10 +159,10 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item10, Projectile.position); + SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); for (int k = 0; k < 8; k++) { - int seaDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 68, 0f, 0f, 100, default, 1.25f); + int seaDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.BlueCrystalShard, 0f, 0f, 100, default, 1.25f); Dust dust = Main.dust[seaDust]; dust.velocity *= 0.3f; Main.dust[seaDust].position.X = Projectile.position.X + (float)(Projectile.width / 2) + 4f + (float)Main.rand.Next(-4, 5); diff --git a/Projectiles/Magic/SerpentineTail.cs b/Projectiles/Magic/SerpentineTail.cs index 671cc97aa0..0d147b0b30 100644 --- a/Projectiles/Magic/SerpentineTail.cs +++ b/Projectiles/Magic/SerpentineTail.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.DamageType = DamageClass.Magic; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 20; - Projectile.ArmorPenetration = 15; + Projectile.ArmorPenetration = 15; } public override void AI() @@ -54,7 +54,7 @@ namespace CalamityMod.Projectiles.Magic { for (int k = 0; k < 8; k++) { - int seaDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 68, 0f, 0f, 100, default, 1.25f); + int seaDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.BlueCrystalShard, 0f, 0f, 100, default, 1.25f); Dust dust = Main.dust[seaDust]; dust.velocity *= 0.3f; Main.dust[seaDust].position.X = Projectile.position.X + (float)(Projectile.width / 2) + 4f + (float)Main.rand.Next(-4, 5); diff --git a/Projectiles/Magic/ShadeNimbusCloud.cs b/Projectiles/Magic/ShadeNimbusCloud.cs index 9fc8ab88fa..2556ed189a 100644 --- a/Projectiles/Magic/ShadeNimbusCloud.cs +++ b/Projectiles/Magic/ShadeNimbusCloud.cs @@ -1,6 +1,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Weapons.Magic; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic @@ -9,7 +10,7 @@ namespace CalamityMod.Projectiles.Magic { public new string LocalizationCategory => "Projectiles.Magic"; public bool StartFading = false; - + public override void SetStaticDefaults() { Main.projFrames[Projectile.type] = 4; @@ -18,7 +19,7 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { Projectile.timeLeft = 300; - + Projectile.width = Projectile.height = 28; Projectile.netImportant = true; @@ -32,7 +33,7 @@ namespace CalamityMod.Projectiles.Magic { // Makes the projectile deaccelerate. Projectile.velocity *= ShaderainStaff.DeaccelerationStrenght; - + // Does the animation of the projectile, the number in the middle determines the speed of the animatino. Projectile.frameCounter++; Projectile.frame = Projectile.frameCounter / 8 % Main.projFrames[Projectile.type]; @@ -56,7 +57,7 @@ namespace CalamityMod.Projectiles.Magic for (int dustIndex = 0; dustIndex < 40; dustIndex++) { // I choose .position (Which is the top left) instead of .Center because Dust.NewDust was made to spawn given .position. - Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 14, 0, 0, 0, default, 0.5f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Demonite, 0, 0, 0, default, 0.5f); } target.AddBuff(ModContent.BuffType(), 90); diff --git a/Projectiles/Magic/ShadecrystalProjectile.cs b/Projectiles/Magic/ShadecrystalProjectile.cs index f224c93e2e..2284b4a2da 100644 --- a/Projectiles/Magic/ShadecrystalProjectile.cs +++ b/Projectiles/Magic/ShadecrystalProjectile.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,13 +9,20 @@ namespace CalamityMod.Projectiles.Magic public class ShadecrystalProjectile : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Magic"; + + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + } + public override void SetDefaults() { Projectile.width = 6; Projectile.height = 6; - Projectile.scale = 1.5f; Projectile.friendly = true; Projectile.alpha = 50; + Projectile.MaxUpdates = 3; Projectile.penetrate = 1; Projectile.timeLeft = 600; Projectile.DamageType = DamageClass.Magic; @@ -22,25 +30,43 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - Lighting.AddLight(Projectile.Center, 0.15f, 0f, 0.15f); + if (Projectile.ai[2] < 255f) + { + Projectile.ai[2] += 3f; + if (Projectile.ai[2] >= 255f) + Projectile.ai[2] = -255f; + } + + Lighting.AddLight(Projectile.Center, 0.15f * Projectile.scale, 0f, 0.15f * Projectile.scale); Projectile.rotation += Projectile.velocity.X * 0.2f; - if (Main.rand.NextBool(4)) + if (Main.rand.NextBool(6)) { - int crystalDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 70, 0f, 0f, 0, default, 1f); + int crystalDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.PurpleCrystalShard, 0f, 0f, Projectile.alpha, new Color(Math.Abs(Projectile.ai[2]), 0, 255, Projectile.alpha)); Main.dust[crystalDust].noGravity = true; - Main.dust[crystalDust].velocity *= 0.2f; - Main.dust[crystalDust].scale *= 0.8f; + Main.dust[crystalDust].velocity = Projectile.velocity * 0.2f; + Main.dust[crystalDust].scale = Projectile.scale; } - Projectile.velocity *= 0.99f; - - Projectile.ai[1] += 1f; - if (Projectile.ai[1] > 90f) + float maxVelocity = 6f; + if (Projectile.velocity.Length() < maxVelocity) { - Projectile.scale -= 0.05f; - if (Projectile.scale <= 0.2) + Projectile.velocity *= Projectile.ai[1]; + if (Projectile.velocity.Length() > maxVelocity) + { + Projectile.velocity.Normalize(); + Projectile.velocity *= maxVelocity; + } + } + else + CalamityUtils.HomeInOnNPC(Projectile, false, 224f, maxVelocity * 1.25f, 30f); + + Projectile.ai[0] += 1f; + if (Projectile.ai[0] >= 520f) + { + Projectile.scale -= 0.01f; + if (Projectile.scale <= 0.2f) { Projectile.scale = 0.2f; Projectile.Kill(); @@ -63,18 +89,23 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { - for (int k = 0; k < 5; k++) - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 70, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); + for (int k = 0; k < 3; k++) + { + int dust = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.PurpleCrystalShard, 0f, 0f, Projectile.alpha, new Color(Math.Abs(Projectile.ai[2]), 0, 255, Projectile.alpha)); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity = Projectile.oldVelocity * 0.5f; + Main.dust[dust].scale = Projectile.scale; + } } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(BuffID.Frostburn2, 120); - } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.Frostburn2, 120); - public override Color? GetAlpha(Color lightColor) + public override Color? GetAlpha(Color lightColor) => new Color(Math.Abs(Projectile.ai[2]), 0, 255, Projectile.alpha); + + public override bool PreDraw(ref Color lightColor) { - return new Color(200, 200, 200, 0); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + return false; } } } diff --git a/Projectiles/Magic/Shaderain.cs b/Projectiles/Magic/Shaderain.cs index a16c0c0008..c2c0650580 100644 --- a/Projectiles/Magic/Shaderain.cs +++ b/Projectiles/Magic/Shaderain.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { Projectile.timeLeft = 600; - + Projectile.width = 20; Projectile.height = 20; @@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Magic { // The projectile will fall. Projectile.velocity.Y += ShaderainStaff.GravityStrenght; - + // The projectile will look towards where it's going. Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; diff --git a/Projectiles/Magic/Shadowbolt.cs b/Projectiles/Magic/Shadowbolt.cs index 5b559abf06..333ed9a895 100644 --- a/Projectiles/Magic/Shadowbolt.cs +++ b/Projectiles/Magic/Shadowbolt.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic @@ -61,7 +62,7 @@ namespace CalamityMod.Projectiles.Magic Vector2 projPos = Projectile.position; projPos -= Projectile.velocity * ((float)i * 0.25f); Projectile.alpha = 255; - int shadowDust = Dust.NewDust(projPos, 1, 1, 173, 0f, 0f, 0, default, 1f); + int shadowDust = Dust.NewDust(projPos, 1, 1, DustID.ShadowbeamStaff, 0f, 0f, 0, default, 1f); Main.dust[shadowDust].position = projPos; Main.dust[shadowDust].scale = (float)Main.rand.Next(70, 110) * 0.013f; Main.dust[shadowDust].velocity *= 0.2f; diff --git a/Projectiles/Magic/ShiftingSandsProj.cs b/Projectiles/Magic/ShiftingSandsProj.cs index a31fc72f0a..509fa87d59 100644 --- a/Projectiles/Magic/ShiftingSandsProj.cs +++ b/Projectiles/Magic/ShiftingSandsProj.cs @@ -1,9 +1,9 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -35,7 +35,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.soundDelay = 10; SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); } - int sand = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 85, 0f, 0f, 100, default, 2f); + int sand = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.UnusedBrown, 0f, 0f, 100, default, 2f); Dust dust = Main.dust[sand]; dust.velocity *= 0.3f; dust.position.X = Projectile.Center.X + 4f + (float)Main.rand.Next(-4, 5); @@ -154,7 +154,7 @@ namespace CalamityMod.Projectiles.Magic Vector2 dustPos = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; dustPos = dustPos.RotatedBy((double)((float)(index - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + Projectile.Center; Vector2 dustVel = dustPos - Projectile.Center; - int sand = Dust.NewDust(dustPos + dustVel, 0, 0, 85, dustVel.X * 1.5f, dustVel.Y * 1.5f, 100, default, 1.2f); + int sand = Dust.NewDust(dustPos + dustVel, 0, 0, DustID.UnusedBrown, dustVel.X * 1.5f, dustVel.Y * 1.5f, 100, default, 1.2f); Main.dust[sand].noGravity = true; Main.dust[sand].noLight = true; Main.dust[sand].velocity = dustVel; diff --git a/Projectiles/Magic/SlitheringEelProjectile.cs b/Projectiles/Magic/SlitheringEelProjectile.cs index 3132a3d38c..21beaa4a6d 100644 --- a/Projectiles/Magic/SlitheringEelProjectile.cs +++ b/Projectiles/Magic/SlitheringEelProjectile.cs @@ -1,10 +1,10 @@ -using CalamityMod.Dusts; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Buffs.StatDebuffs; namespace CalamityMod.Projectiles.Magic { @@ -41,6 +41,8 @@ namespace CalamityMod.Projectiles.Magic Projectile.penetrate = -1; Projectile.timeLeft = 360; Projectile.Opacity = 0f; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() @@ -146,7 +148,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { for (int i = 0; i < 23; i++) - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, (int)CalamityDusts.SulphurousSeaAcid, 0f, 0f); } } } diff --git a/Projectiles/Magic/SmallSpirit.cs b/Projectiles/Magic/SmallSpirit.cs index 3c24b7b56c..fb98eb148e 100644 --- a/Projectiles/Magic/SmallSpirit.cs +++ b/Projectiles/Magic/SmallSpirit.cs @@ -1,6 +1,6 @@ -using CalamityMod.Graphics.Metaballs; +using System; +using CalamityMod.Graphics.Metaballs; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ModLoader; @@ -117,11 +117,11 @@ namespace CalamityMod.Projectiles.Magic { for (int i = 0; i < 6; i++) { - Dust polterplasm = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(12f, 12f), 261); - polterplasm.color = Color.Lerp(Color.LightPink, Color.Red, Main.rand.NextFloat(0.67f)); - polterplasm.scale = 1.2f; - polterplasm.fadeIn = 0.55f; - polterplasm.noGravity = true; + Dust necroplasm = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(12f, 12f), 261); + necroplasm.color = Color.Lerp(Color.LightPink, Color.Red, Main.rand.NextFloat(0.67f)); + necroplasm.scale = 1.2f; + necroplasm.fadeIn = 0.55f; + necroplasm.noGravity = true; } } } diff --git a/Projectiles/Magic/Snowball.cs b/Projectiles/Magic/Snowball.cs index cf0c9f0d3c..451b62000a 100644 --- a/Projectiles/Magic/Snowball.cs +++ b/Projectiles/Magic/Snowball.cs @@ -1,9 +1,9 @@ using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -36,11 +36,11 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item27, Projectile.position); + SoundEngine.PlaySound(SoundID.Item27, Projectile.Center); //crystal bullet shards for (int i = 0; i < 10; ++i) { - int snow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 68, 0f, 0f, 0, new Color(), 1f); + int snow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.BlueCrystalShard, 0f, 0f, 0, new Color(), 1f); Main.dust[snow].noGravity = true; Main.dust[snow].velocity *= 2f; } diff --git a/Projectiles/Magic/Snowflake.cs b/Projectiles/Magic/Snowflake.cs index 91c4648baf..85f625591f 100644 --- a/Projectiles/Magic/Snowflake.cs +++ b/Projectiles/Magic/Snowflake.cs @@ -1,8 +1,10 @@ -using Microsoft.Xna.Framework; +using System; +using CalamityMod.Items.Weapons.Magic; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -19,23 +21,146 @@ namespace CalamityMod.Projectiles.Magic { Projectile.width = 20; Projectile.height = 20; - Projectile.aiStyle = ProjAIStyleID.MagicMissile; Projectile.friendly = true; Projectile.tileCollide = false; Projectile.alpha = 70; Projectile.penetrate = -1; - Projectile.timeLeft = 600; + Projectile.timeLeft = 280; Projectile.DamageType = DamageClass.Magic; - AIType = ProjectileID.FlyingKnife; Projectile.coldDamage = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 40; } public override void AI() { - Projectile.rotation += 0.15f; + Player player = Main.player[Projectile.owner]; + if (player == null) + return; + if (player.CantUseHoldout()) + Projectile.Kill(); + if (Projectile.type != ModContent.ProjectileType() || + Main.player[Projectile.owner].HeldItem.type != ModContent.ItemType() || !Main.player[Projectile.owner].channel) + { + Projectile.Kill(); + return; + } + if (Projectile.ai[2] > 0) + { + Projectile.ai[2]--; + } + + // This code uses player-specific fields (such as the mouse), and does not need to be run for anyone + // other than its owner. + if (Main.myPlayer != Projectile.owner) + return; + + Projectile.rotation += 0.2f; + if (Projectile.localAI[0] < 1f) + { + Projectile.localAI[0] += 0.002f; + } + else + { + Projectile.width = Projectile.height = 50; + } + Vector2 projPos = player.RotatedRelativePoint(player.MountedCenter, true); + float projX = (float)Main.mouseX + Main.screenPosition.X - projPos.X; + float projY = (float)Main.mouseY + Main.screenPosition.Y - projPos.Y; + if (player.gravDir == -1f) + { + projY = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - projPos.Y; + } + if ((float.IsNaN(projX) && float.IsNaN(projY)) || (projX == 0f && projY == 0f)) + { + projX = (float)player.direction; + projY = 0f; + } + projPos += new Vector2(projX, projY); + float speed = 30f; + float speedScale = 3f; + Vector2 vectorPos = Projectile.Center; + if (Vector2.Distance(projPos, vectorPos) < 90f) + { + speed = 10f; + speedScale = 1f; + } + if (Vector2.Distance(projPos, vectorPos) < 30f) + { + speed = 3f; + speedScale = 0.3f; + } + if (Vector2.Distance(projPos, vectorPos) < 10f) + { + speed = 1f; + speedScale = 0.1f; + } + float projectileX = projPos.X - vectorPos.X; + float projectileY = projPos.Y - vectorPos.Y; + float projectileAdjust = (float)Math.Sqrt((double)(projectileX * projectileX + projectileY * projectileY)); + projectileAdjust = speed / projectileAdjust; + projectileX *= projectileAdjust; + projectileY *= projectileAdjust; + if (Projectile.velocity.X < projectileX) + { + Projectile.velocity.X = Projectile.velocity.X + speedScale; + if (Projectile.velocity.X < 0f && projectileX > 0f) + { + Projectile.velocity.X = Projectile.velocity.X + speedScale; + } + } + else if (Projectile.velocity.X > projectileX) + { + Projectile.velocity.X = Projectile.velocity.X - speedScale; + if (Projectile.velocity.X > 0f && projectileX < 0f) + { + Projectile.velocity.X = Projectile.velocity.X - speedScale; + } + } + if (Projectile.velocity.Y < projectileY) + { + Projectile.velocity.Y = Projectile.velocity.Y + speedScale; + if (Projectile.velocity.Y < 0f && projectileY > 0f) + { + Projectile.velocity.Y = Projectile.velocity.Y + speedScale; + } + } + else if (Projectile.velocity.Y > projectileY) + { + Projectile.velocity.Y = Projectile.velocity.Y - speedScale; + if (Projectile.velocity.Y > 0f && projectileY < 0f) + { + Projectile.velocity.Y = Projectile.velocity.Y - speedScale; + } + } if (Main.rand.NextBool(5)) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 67, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.IceRod, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + } + float pushForce = 0.15f; + for (int k = 0; k < Main.maxProjectiles; k++) + { + Projectile otherProj = Main.projectile[k]; + // Short circuits to make the loop as fast as possible. + if (!otherProj.active || k == Projectile.whoAmI) + continue; + + // If the other projectile is indeed the same owned by the same player and they're too close, nudge them away. + bool sameProjType = otherProj.type == Projectile.type; + float taxicabDist = Vector2.Distance(Projectile.Center, otherProj.Center); + float distancegate = 100f; + if (sameProjType && taxicabDist < distancegate) + { + if (Projectile.position.X < otherProj.position.X) + Projectile.velocity.X -= pushForce; + else + Projectile.velocity.X += pushForce; + + if (Projectile.position.Y < otherProj.position.Y) + Projectile.velocity.Y -= pushForce; + else + Projectile.velocity.Y += pushForce; + } } } @@ -47,17 +172,37 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item27, Projectile.position); + SoundEngine.PlaySound(SoundID.Item27, Projectile.Center); for (int k = 0; k < 5; k++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 67, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.IceRod, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); + } + if (Projectile.owner == Main.myPlayer) + { + for (int x = 1; x <= 2; x++) + { + Gore.NewGore(Projectile.GetSource_Death(), Projectile.Center, Projectile.velocity * 0.5f + Main.rand.NextVector2Square(-4, 4), Mod.Find("CryoShieldGore" + Main.rand.Next(1, 5)).Type, 0.7f); + } } } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.immune[Projectile.owner] = 7; target.AddBuff(BuffID.Frostburn2, 180); + float randOffset = Main.rand.NextFloat(0, 2 * MathHelper.Pi); + // spawn mini stars on hit with a 4 second cooldown + if (Projectile.owner == Main.myPlayer && Projectile.ai[2] <= 0) + { + for (int i = 0; i < 3; i++) + { + Vector2 velocity = (MathHelper.TwoPi * i / 3f + randOffset).ToRotationVector2() * 4f; + int p = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack * 0.5f, Projectile.owner); + Main.projectile[p].DamageType = DamageClass.Magic; + } + SoundEngine.PlaySound(SoundID.Item30, Projectile.Center); + // set the 4 second cooldown + Projectile.ai[2] = 240; + } } } } diff --git a/Projectiles/Magic/SnowflakeIceStar.cs b/Projectiles/Magic/SnowflakeIceStar.cs new file mode 100644 index 0000000000..8c7f685a45 --- /dev/null +++ b/Projectiles/Magic/SnowflakeIceStar.cs @@ -0,0 +1,86 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class SnowflakeIceStar : ModProjectile, ILocalizedModType + { + public override string Texture => "CalamityMod/Projectiles/Typeless/KelvinCatalystStar"; + public new string LocalizationCategory => "Projectiles.Magic"; + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + } + + public override void SetDefaults() + { + Projectile.width = 16; + Projectile.height = 16; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.tileCollide = false; + Projectile.timeLeft = 300; + Projectile.DamageType = DamageClass.Magic; + Projectile.coldDamage = true; + } + + public override void AI() + { + if (Projectile.ai[0] < 90f) + { + Projectile.ai[0] += 1f; + Projectile.velocity.X *= 0.98f; + Projectile.velocity.Y *= 0.98f; + } + else + { + CalamityUtils.HomeInOnNPC(Projectile, true, 500f, 12f, 20f); + } + + Lighting.AddLight(Projectile.Center, Main.DiscoR * 0.075f / 255f, Main.DiscoR * 0.1f / 255f, Main.DiscoR * 0.125f / 255f); + + if (Main.rand.NextBool(6)) + { + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.IceRod, 0f, 0f, 100, default, 0.4f); + Main.dust[dust].velocity *= 0.3f; + Main.dust[dust].noGravity = true; + } + + Projectile.rotation += 0.25f; + } + + public override bool? CanDamage() + { + return Projectile.ai[0] >= 90f ? null : false; + } + + public override bool PreDraw(ref Color lightColor) + { + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + return false; + } + + public override void OnKill(int timeLeft) + { + SoundEngine.PlaySound(SoundID.Item27, Projectile.Center); + Projectile.ExpandHitboxBy(24); + int dustAmt = 36; + for (int j = 0; j < dustAmt; j++) + { + Vector2 rotate = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; + rotate = rotate.RotatedBy((double)((float)(j - (dustAmt / 2 - 1)) * 6.28318548f / (float)dustAmt), default) + Projectile.Center; + Vector2 faceDirection = rotate - Projectile.Center; + int icyDust = Dust.NewDust(rotate + faceDirection, 0, 0, DustID.IceRod, faceDirection.X * 0.5f, faceDirection.Y * 0.5f, 100, default, 0.75f); + Main.dust[icyDust].noGravity = true; + } + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.Frostburn2, 60); + + public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(BuffID.Frostburn2, 60); + } +} diff --git a/Projectiles/Magic/SoulPiercerBeam.cs b/Projectiles/Magic/SoulPiercerBeam.cs index 32865cc081..9fee7806ad 100644 --- a/Projectiles/Magic/SoulPiercerBeam.cs +++ b/Projectiles/Magic/SoulPiercerBeam.cs @@ -1,7 +1,9 @@ using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Magic { public class SoulPiercerBeam : ModProjectile, ILocalizedModType @@ -31,7 +33,7 @@ namespace CalamityMod.Projectiles.Magic Vector2 projPos = Projectile.position; projPos -= Projectile.velocity; Projectile.alpha = 255; - int godSlay = Dust.NewDust(projPos, 1, 1, 173, 0f, 0f, 0, default, 0.5f); + int godSlay = Dust.NewDust(projPos, 1, 1, DustID.ShadowbeamStaff, 0f, 0f, 0, default, 0.5f); Main.dust[godSlay].position = projPos; Main.dust[godSlay].scale = Main.rand.Next(70, 110) * 0.014f; Main.dust[godSlay].velocity *= 0.2f; diff --git a/Projectiles/Magic/SoulPiercerBolt.cs b/Projectiles/Magic/SoulPiercerBolt.cs index 6d7e9ad409..508761a07e 100644 --- a/Projectiles/Magic/SoulPiercerBolt.cs +++ b/Projectiles/Magic/SoulPiercerBolt.cs @@ -1,7 +1,9 @@ using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Magic { public class SoulPiercerBolt : ModProjectile, ILocalizedModType @@ -28,7 +30,7 @@ namespace CalamityMod.Projectiles.Magic { Vector2 projPos = Projectile.position; projPos -= Projectile.velocity; - int godSlay = Dust.NewDust(projPos, 1, 1, 173, 0f, 0f, 0, default, 0.5f); + int godSlay = Dust.NewDust(projPos, 1, 1, DustID.ShadowbeamStaff, 0f, 0f, 0, default, 0.5f); Main.dust[godSlay].position = projPos; Main.dust[godSlay].scale = Main.rand.Next(70, 110) * 0.014f; Main.dust[godSlay].velocity *= 0.2f; diff --git a/Projectiles/Magic/SparkInfernal.cs b/Projectiles/Magic/SparkInfernal.cs index dd15244591..f4ab83896c 100644 --- a/Projectiles/Magic/SparkInfernal.cs +++ b/Projectiles/Magic/SparkInfernal.cs @@ -1,9 +1,9 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Weapons.Magic; using Microsoft.Xna.Framework; -using CalamityMod.Buffs.DamageOverTime; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 6, Projectile.velocity.X * 0.1f, Projectile.velocity.Y * 0.1f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Torch, Projectile.velocity.X * 0.1f, Projectile.velocity.Y * 0.1f); } public override void OnKill(int timeLeft) diff --git a/Projectiles/Magic/SparklingLaser.cs b/Projectiles/Magic/SparklingLaser.cs index 3433633dc9..1adfe56d9c 100644 --- a/Projectiles/Magic/SparklingLaser.cs +++ b/Projectiles/Magic/SparklingLaser.cs @@ -1,9 +1,9 @@ -using CalamityMod.Projectiles.BaseProjectiles; +using System; +using CalamityMod.Projectiles.BaseProjectiles; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; -using System; using Terraria; using Terraria.Audio; using Terraria.Enums; @@ -99,7 +99,7 @@ namespace CalamityMod.Projectiles.Magic Vector2 spawnPos = Projectile.Center; for (int k = 0; k < dustCount + 1; k++) { - Dust dust = Dust.NewDustDirect(spawnPos, 1, 1, 226, Projectile.velocity.X / 2f, Projectile.velocity.Y / 2f); + Dust dust = Dust.NewDustDirect(spawnPos, 1, 1, DustID.Electric, Projectile.velocity.X / 2f, Projectile.velocity.Y / 2f); dust.position += Main.rand.NextVector2Square(-10f, 10f); dust.velocity = Main.rand.NextVector2Unit() * (10f - dustCount * 2f) / 10f; dust.scale = Main.rand.NextFloat(0.5f, 1f); @@ -112,7 +112,7 @@ namespace CalamityMod.Projectiles.Magic // Play a cool sound when fully charged. if (!playedSound) { - SoundEngine.PlaySound(SoundID.Item68, Projectile.position); + SoundEngine.PlaySound(SoundID.Item68, Projectile.Center); playedSound = true; } return true; diff --git a/Projectiles/Magic/SpiritCongregation.cs b/Projectiles/Magic/SpiritCongregation.cs index 48ffe84e32..71f1e234be 100644 --- a/Projectiles/Magic/SpiritCongregation.cs +++ b/Projectiles/Magic/SpiritCongregation.cs @@ -1,13 +1,13 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; +using System; +using System.Collections.Generic; using System.IO; +using CalamityMod.Graphics.Metaballs; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using System.Collections.Generic; -using CalamityMod.Graphics.Metaballs; namespace CalamityMod.Projectiles.Magic { @@ -30,13 +30,13 @@ namespace CalamityMod.Projectiles.Magic { get { - float movementSpeed = 9f; + float movementSpeed = 10f; // Make speed gradually build up over time, with growths at certain points. movementSpeed += MathHelper.SmoothStep(0f, 2.2f, Utils.GetLerpValue(0.18f, 0.3f, CurrentPower, true)); movementSpeed += MathHelper.SmoothStep(0f, 4f, Utils.GetLerpValue(0.4f, 0.52f, CurrentPower, true)); movementSpeed += MathHelper.SmoothStep(0f, 5f, Utils.GetLerpValue(0.6f, 0.72f, CurrentPower, true)); - movementSpeed += MathHelper.SmoothStep(0f, 6f, Utils.GetLerpValue(0.8f, 0.92f, CurrentPower, true)); + movementSpeed += MathHelper.SmoothStep(0f, 6f, Utils.GetLerpValue(0.8f, 1.2f, CurrentPower, true)); return movementSpeed; } @@ -58,7 +58,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.tileCollide = false; Projectile.ignoreWater = true; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 12; + Projectile.localNPCHitCooldown = 11; Projectile.timeLeft = 90000; Projectile.hide = true; } @@ -273,7 +273,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; if (CurrentPower > LargeMouthPowerLowerBound) texture = ModContent.Request("CalamityMod/Projectiles/Magic/SpiritCongregationBig").Value; diff --git a/Projectiles/Magic/Starblast.cs b/Projectiles/Magic/Starblast.cs index fe398010f4..f590783b6c 100644 --- a/Projectiles/Magic/Starblast.cs +++ b/Projectiles/Magic/Starblast.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Projectiles.Magic if (Main.rand.NextBool(4)) { - int stardust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 180, 0f, 0f, 100, default, 1f); + int stardust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.DungeonSpirit, 0f, 0f, 100, default, 1f); Main.dust[stardust].position = Projectile.Center; Main.dust[stardust].scale += (float)Main.rand.Next(50) * 0.01f; Main.dust[stardust].noGravity = true; @@ -48,7 +48,7 @@ namespace CalamityMod.Projectiles.Magic if (Main.rand.NextBool(6)) { - int stardustier = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 176, 0f, 0f, 100, default, 1f); + int stardustier = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.BubbleBurst_Blue, 0f, 0f, 100, default, 1f); Main.dust[stardustier].position = Projectile.Center; Main.dust[stardustier].scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; Main.dust[stardustier].noGravity = true; @@ -68,8 +68,8 @@ namespace CalamityMod.Projectiles.Magic { for (int k = 0; k < 5; k++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 176, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 180, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.BubbleBurst_Blue, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.DungeonSpirit, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } } diff --git a/Projectiles/Magic/StickyFeather.cs b/Projectiles/Magic/StickyFeather.cs index 4bff0a1df1..233d5383dd 100644 --- a/Projectiles/Magic/StickyFeather.cs +++ b/Projectiles/Magic/StickyFeather.cs @@ -1,8 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -31,7 +31,7 @@ namespace CalamityMod.Projectiles.Magic { if (Main.rand.NextBool(3)) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 206, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.UnusedWhiteBluePurple, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } } @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item14, Projectile.position); + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); Projectile.width = 50; @@ -51,7 +51,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int i = 0; i < 15; i++) { - int blueDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 206, 0f, 0f, 100, default, 1.2f); + int blueDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.UnusedWhiteBluePurple, 0f, 0f, 100, default, 1.2f); Main.dust[blueDust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -61,10 +61,10 @@ namespace CalamityMod.Projectiles.Magic } for (int j = 0; j < 30; j++) { - int blueDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 206, 0f, 0f, 100, default, 1.7f); + int blueDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.UnusedWhiteBluePurple, 0f, 0f, 100, default, 1.7f); Main.dust[blueDust2].noGravity = true; Main.dust[blueDust2].velocity *= 5f; - blueDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 206, 0f, 0f, 100, default, 1f); + blueDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.UnusedWhiteBluePurple, 0f, 0f, 100, default, 1f); Main.dust[blueDust2].velocity *= 2f; } } diff --git a/Projectiles/Magic/SupremeDustFlakProjectile.cs b/Projectiles/Magic/SupremeDustFlakProjectile.cs index 3da2e15002..89a42b04c2 100644 --- a/Projectiles/Magic/SupremeDustFlakProjectile.cs +++ b/Projectiles/Magic/SupremeDustFlakProjectile.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Magic int dustType = 32; for (int i = 0; i < 2; i++) { - int earthyDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 100, default, 1f); + int earthyDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 100, default, 1f); Dust dust = Main.dust[earthyDust]; if (Main.rand.NextBool(3)) { @@ -61,7 +61,7 @@ namespace CalamityMod.Projectiles.Magic } for (int i = 0; i < 2; i++) { - int earthyDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 100, default, 1f); + int earthyDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 100, default, 1f); Dust dust = Main.dust[earthyDust]; if (Main.rand.NextBool(3)) { diff --git a/Projectiles/Magic/SupremeDustProjectile.cs b/Projectiles/Magic/SupremeDustProjectile.cs index 4eb19e2b62..ef060f5907 100644 --- a/Projectiles/Magic/SupremeDustProjectile.cs +++ b/Projectiles/Magic/SupremeDustProjectile.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Magic } Projectile.ai[0] += 1f; int dustType = 32; - int earthyDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 100, default, 1f); + int earthyDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 100, default, 1f); Dust dust = Main.dust[earthyDust]; if (Main.rand.NextBool()) { @@ -58,7 +58,7 @@ namespace CalamityMod.Projectiles.Magic dust.velocity.X *= 1.2f; dust.velocity.Y *= 1.2f; dust.scale *= dustScale; - int earthyDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 100, default, 1f); + int earthyDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 100, default, 1f); Dust dust2 = Main.dust[earthyDust2]; if (Main.rand.NextBool(3)) { diff --git a/Projectiles/Magic/TacticiansElectricBoom.cs b/Projectiles/Magic/TacticiansElectricBoom.cs index 5c7718c538..f9ee0609bb 100644 --- a/Projectiles/Magic/TacticiansElectricBoom.cs +++ b/Projectiles/Magic/TacticiansElectricBoom.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Projectiles/Magic/TacticiansTrumpCardProj.cs b/Projectiles/Magic/TacticiansTrumpCardProj.cs index fb26542464..8d57cb81ef 100644 --- a/Projectiles/Magic/TacticiansTrumpCardProj.cs +++ b/Projectiles/Magic/TacticiansTrumpCardProj.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Magic Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.37f / 255f, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0.47f / 255f); if (Main.rand.NextBool(5)) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 132, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Firework_Blue, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } Projectile.rotation = Projectile.velocity.ToRotation(); } @@ -38,7 +38,7 @@ namespace CalamityMod.Projectiles.Magic if (Projectile.timeLeft > 295) return false; - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } @@ -47,7 +47,7 @@ namespace CalamityMod.Projectiles.Magic { for (int k = 0; k < 5; k++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 132, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Firework_Blue, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } diff --git a/Projectiles/Magic/TearsofHeavenProjectile.cs b/Projectiles/Magic/TearsofHeavenProjectile.cs index db198c1f1b..55f39a937c 100644 --- a/Projectiles/Magic/TearsofHeavenProjectile.cs +++ b/Projectiles/Magic/TearsofHeavenProjectile.cs @@ -1,9 +1,9 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Dusts; namespace CalamityMod.Projectiles.Magic { public class TearsofHeavenProjectile : ModProjectile, ILocalizedModType @@ -42,9 +42,9 @@ namespace CalamityMod.Projectiles.Magic Projectile.localAI[0] += 1f; if (Projectile.localAI[0] > 4f) { - int Smalldust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.ProfanedFire, 0f, 0f, 100, default, 1f); + int Smalldust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.ProfanedFire, 0f, 0f, 100, default, 1f); Main.dust[Smalldust].noGravity = true; - int Bigdust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.ProfanedFire, 0f, 0f, 100, default, 2f); + int Bigdust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.ProfanedFire, 0f, 0f, 100, default, 2f); Main.dust[Bigdust].noGravity = true; } diff --git a/Projectiles/Magic/Teslabeam.cs b/Projectiles/Magic/Teslabeam.cs new file mode 100644 index 0000000000..ba7bb2f167 --- /dev/null +++ b/Projectiles/Magic/Teslabeam.cs @@ -0,0 +1,237 @@ +using System; +using System.Collections.Generic; +using System.IO; +using CalamityMod.Graphics.Primitives; +using CalamityMod.Projectiles.BaseProjectiles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.Audio; +using Terraria.Enums; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class Teslabeam : BaseLaserbeamProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Magic"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public Player Owner => Main.player[Projectile.owner]; + public override Color LightCastColor => new Color(92, 144, 245); + public override float Lifetime => 18000f; + public override float MaxScale => 1f; + public override float MaxLaserLength => 1600f; //100 tiles + public override Texture2D LaserBeginTexture => ModContent.Request("CalamityMod/Projectiles/InvisibleProj", AssetRequestMode.ImmediateLoad).Value; + public override Texture2D LaserMiddleTexture => ModContent.Request("CalamityMod/Projectiles/InvisibleProj", AssetRequestMode.ImmediateLoad).Value; + public override Texture2D LaserEndTexture => ModContent.Request("CalamityMod/Projectiles/InvisibleProj", AssetRequestMode.ImmediateLoad).Value; + + List offsetPoints = new List(); + NPC Victim; + public float damageMultiplier = 1f; // a multiplier for how much damage the beam deals + public bool damageShouldDecay = false; // if this is true, the weapon's damage will decay if the grace period is over + public float decayGracePeriod = 0; // while the grace period is above 0, the weapon's damage won't decay + + public const float MaxDamageMultiplier = 5f; // the maximum damage multiplier + public const float GracePeriod = 10; // this controls the amount of frames that the grace period lasts for. It is combined with the beam's i frame cooldown + public const float DamagePerHit = 0.1f; // how much the damage multiplier increases for each enemy hit + public const float DamageDecayPerFrame = 0.01f; // how much the damage multiplier decreases if damage is decaying + public const float AimResponsiveness = 0.965f; // Last Prism is 0.92f. Lower makes the laser turn faster. + + public override void SetStaticDefaults() + { + Main.projFrames[Projectile.type] = 1; + } + + public override void SetDefaults() + { + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.hide = true; + Projectile.timeLeft = 18000; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 6; + } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(damageMultiplier); + writer.Write(damageShouldDecay); + writer.Write(decayGracePeriod); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + damageMultiplier = reader.ReadSingle(); + decayGracePeriod = reader.ReadSingle(); + damageShouldDecay = reader.ReadBoolean(); + } + + public override bool PreAI() + { + // Multiplayer support here, only run this code if the client running it is the owner of the projectile + if (Projectile.owner == Main.myPlayer) + { + Vector2 rrp = Owner.RotatedRelativePoint(Owner.MountedCenter, true); + UpdateAim(rrp); + Projectile.direction = Main.MouseWorld.X > Owner.Center.X ? 1 : -1; + Projectile.netUpdate = true; + } + + int dir = Math.Sign(Projectile.velocity.X); + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + Projectile.Center = Owner.Center + Projectile.velocity * 56f; //Distance offset + Projectile.timeLeft = 18000; //Infinite lifespan + Owner.ChangeDir(dir); + Owner.heldProj = Projectile.whoAmI; + Owner.itemTime = 2; + Owner.itemAnimation = 2; + Owner.itemRotation = ((Projectile.rotation + MathHelper.PiOver2).ToRotationVector2() * -Owner.direction).ToRotation(); + + if (!Owner.channel) + { + Projectile.Kill(); + return false; + } + // Do we still have enough mana? If not, we kill the projectile because we cannot use it anymore + if (Owner.miscCounter % 10 == 0 && !Owner.CheckMana(Owner.ActiveItem(), -1, true)) + { + Projectile.Kill(); + return false; + } + + Projectile.ai[2]++; + + // Play zap sounds idly + if (Projectile.ai[2] % 5 == 0) + { + SoundEngine.PlaySound(SoundID.DD2_LightningBugZap with { Pitch = 1.1f }, Projectile.Center); + } + // If the weapon's target hasn't just been hit, tick down the grace period timer + if (decayGracePeriod > 0 && damageShouldDecay) + { + decayGracePeriod--; + } + + // If the grace period timer runs out, start decaying damage + if (damageShouldDecay && damageMultiplier > 1f && decayGracePeriod <= 0) + { + damageMultiplier = MathHelper.Max(damageMultiplier - DamageDecayPerFrame, 1f); + } + // Update the beam's damage + Projectile.damage = (int)MathHelper.Clamp(Projectile.originalDamage * damageMultiplier, 0, Projectile.originalDamage * MaxDamageMultiplier); + // After damage has been set, set the decay flag to true. If the beams hits the target, this will be set back to false, but if not, damage will start decaying in the next tick + damageShouldDecay = true; + + return true; + } + + internal float WidthFunction(float completionRatio) + { + return MathHelper.Clamp(completionRatio * 15, 1, 1.5f); + } + + internal Color ColorFunction(float completionRatio) + { + return new Color(174, 227, 244); // directly color picked from the source material + } + + internal float BackgroundWidthFunction(float completionRatio) => WidthFunction(completionRatio) * 4f; + + internal Color BackgroundColorFunction(float completionRatio) + { + return new Color(92, 144, 245) * 0.6f; // directly color picked from the source material + } + public override bool PreDraw(ref Color lightColor) + { + Main.spriteBatch.EnterShaderRegion(); + GameShaders.Misc["CalamityMod:TeslaTrail"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/ZapTrail")); + + // every 2 frames update the offsets are randomized. This is effectively control for the lightning's fps + if (Projectile.ai[2] % 2 == 0) + { + offsetPoints.Clear(); + for (int i = 0; i <= 75; i++) + { + Vector2 baseVec = Vector2.Zero; + float width = 16; + if (i > 0) + { + baseVec += Main.rand.NextVector2Square(-width, width); + } + offsetPoints.Add(Main.rand.NextVector2Square(-width, width)); + } + } + // do not try to draw the lightning if the offset list isn't filled yet or an index error will occur + if (offsetPoints.Count < 75) + return false; + + // the final list of points that will be used to draw the lightning which combines a series of points travelling up the beam with the random values from the offset list + List finalPoints = new List(); + for (int i = 0; i <= 75; i++) + { + Vector2 baseVec = Vector2.Lerp(Projectile.Center, Projectile.Center + Projectile.velocity * LaserLength, i / 73.5f); + float width = 16 + (i / 75 * 10); + if (i > 0) + { + baseVec += offsetPoints[i]; + } + finalPoints.Add(baseVec); + } + + // 29FEB2024: Ozzatron: hopefully ported this correctly to the new prim system by Toasty + PrimitiveRenderer.RenderTrail(finalPoints, new(BackgroundWidthFunction, BackgroundColorFunction, smoothen: false, shader: GameShaders.Misc["CalamityMod:TeslaTrail"]), 75); + PrimitiveRenderer.RenderTrail(finalPoints, new(WidthFunction, ColorFunction, smoothen: false, shader: GameShaders.Misc["CalamityMod:TeslaTrail"]), 75); + + Main.spriteBatch.ExitShaderRegion(); + return false; + } + // Gently adjusts the aim vector of the laser to point towards the mouse. + private void UpdateAim(Vector2 source) + { + Vector2 aimVector = Vector2.Normalize(Main.MouseWorld - source); + if (aimVector.HasNaNs()) + aimVector = -Vector2.UnitY; + aimVector = Vector2.Normalize(Vector2.Lerp(aimVector, Vector2.Normalize(Projectile.velocity), AimResponsiveness)); + + if (aimVector != Projectile.velocity) + Projectile.netUpdate = true; + Projectile.velocity = aimVector; + } + + public override bool ShouldUpdatePosition() => false; + + // Update CutTiles so the laser will cut tiles (like grass). + public override void CutTiles() + { + DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile; + Vector2 unit = Projectile.velocity; + Utils.PlotTileLine(Projectile.Center, Projectile.Center + unit * LaserLength, Projectile.width + 16, DelegateMethods.CutTiles); + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + // if the beam's damage multiplier is at default value, the hit enemy becomes the beam's new target + if (damageMultiplier <= 1f) + { + Victim = target; + } + // if the beam hits its current target, disable damage decay for the frame, reset its grace period, and increase its damage + if (Victim == target) + { + damageShouldDecay = false; + decayGracePeriod = Projectile.idStaticNPCHitCooldown + GracePeriod; + if (damageMultiplier < MaxDamageMultiplier) + { + damageMultiplier = Math.Min(damageMultiplier + DamagePerHit, MaxDamageMultiplier); + } + } + target.AddBuff(BuffID.Electrified, 30); + } + } +} diff --git a/Projectiles/Magic/ThunderstormShot.cs b/Projectiles/Magic/ThunderstormShot.cs index b023cbf19a..b5b06e5ebd 100644 --- a/Projectiles/Magic/ThunderstormShot.cs +++ b/Projectiles/Magic/ThunderstormShot.cs @@ -1,8 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { public class ThunderstormShot : ModProjectile, ILocalizedModType @@ -29,12 +29,12 @@ namespace CalamityMod.Projectiles.Magic { for (int i = 0; i < 5; i++) { - Dust greenDust = Main.dust[Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 107, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 1f)]; + Dust greenDust = Main.dust[Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.TerraBlade, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 1f)]; greenDust.velocity = Vector2.Zero; greenDust.position -= Projectile.velocity / 5f * (float)i; greenDust.noGravity = true; greenDust.noLight = true; - Dust lightningDust = Main.dust[Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 229, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 1f)]; + Dust lightningDust = Main.dust[Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Vortex, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 1f)]; lightningDust.velocity = Vector2.Zero; lightningDust.position -= Projectile.velocity / 5f * (float)i; lightningDust.noGravity = true; @@ -58,7 +58,7 @@ namespace CalamityMod.Projectiles.Magic Vector2 dustRotate = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 1f; //0.75 dustRotate = dustRotate.RotatedBy((double)((float)(j - (dustAmt / 2 - 1)) * 6.28318548f / (float)dustAmt), default) + Projectile.Center; Vector2 dustDirection = dustRotate - Projectile.Center; - int killDust = Dust.NewDust(dustRotate + dustDirection, 0, 0, 229, dustDirection.X, dustDirection.Y, 100, default, 1.2f); + int killDust = Dust.NewDust(dustRotate + dustDirection, 0, 0, DustID.Vortex, dustDirection.X, dustDirection.Y, 100, default, 1.2f); Main.dust[killDust].noGravity = true; Main.dust[killDust].noLight = true; Main.dust[killDust].velocity = dustDirection; @@ -68,7 +68,7 @@ namespace CalamityMod.Projectiles.Magic Vector2 dustRotate = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; dustRotate = dustRotate.RotatedBy((double)((float)(j - (dustAmt / 2 - 1)) * 6.28318548f / (float)dustAmt), default) + Projectile.Center; Vector2 dustDirection = dustRotate - Projectile.Center; - int killDust = Dust.NewDust(dustRotate + dustDirection, 0, 0, 107, dustDirection.X, dustDirection.Y, 100, default, 1.2f); + int killDust = Dust.NewDust(dustRotate + dustDirection, 0, 0, DustID.TerraBlade, dustDirection.X, dustDirection.Y, 100, default, 1.2f); Main.dust[killDust].noGravity = true; Main.dust[killDust].noLight = true; Main.dust[killDust].velocity = dustDirection; diff --git a/Projectiles/Magic/ThunderstormShotSplit.cs b/Projectiles/Magic/ThunderstormShotSplit.cs index 6fbee3472d..bb8fd4fc86 100644 --- a/Projectiles/Magic/ThunderstormShotSplit.cs +++ b/Projectiles/Magic/ThunderstormShotSplit.cs @@ -1,8 +1,8 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { public class ThunderstormShotSplit : ModProjectile, ILocalizedModType @@ -34,12 +34,12 @@ namespace CalamityMod.Projectiles.Magic { for (int i = 0; i < 5; i++) { - Dust dust = Main.dust[Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 107, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 0.5f)]; + Dust dust = Main.dust[Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.TerraBlade, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 0.5f)]; dust.velocity = Vector2.Zero; dust.position -= Projectile.velocity / 5f * (float)i; dust.noGravity = true; dust.noLight = true; - Dust dust2 = Main.dust[Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 229, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 0.5f)]; + Dust dust2 = Main.dust[Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Vortex, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 0.5f)]; dust2.velocity = Vector2.Zero; dust2.position -= Projectile.velocity / 5f * (float)i; dust2.noGravity = true; @@ -50,7 +50,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item125, Projectile.position); + SoundEngine.PlaySound(SoundID.Item125, Projectile.Center); Projectile.position = Projectile.Center; Projectile.width = Projectile.height = 16; Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); @@ -61,7 +61,7 @@ namespace CalamityMod.Projectiles.Magic Vector2 dustRotate = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; //0.75 dustRotate = dustRotate.RotatedBy((double)((float)(j - (dustAmt / 2 - 1)) * 6.28318548f / (float)dustAmt), default) + Projectile.Center; Vector2 dustDirection = dustRotate - Projectile.Center; - int killDust = Dust.NewDust(dustRotate + dustDirection, 0, 0, 229, dustDirection.X, dustDirection.Y, 100, default, 0.6f); + int killDust = Dust.NewDust(dustRotate + dustDirection, 0, 0, DustID.Vortex, dustDirection.X, dustDirection.Y, 100, default, 0.6f); Main.dust[killDust].noGravity = true; Main.dust[killDust].noLight = true; Main.dust[killDust].velocity = dustDirection; @@ -71,7 +71,7 @@ namespace CalamityMod.Projectiles.Magic Vector2 dustRotate = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.5f; dustRotate = dustRotate.RotatedBy((double)((float)(j - (dustAmt / 2 - 1)) * 6.28318548f / (float)dustAmt), default) + Projectile.Center; Vector2 dustDirection = dustRotate - Projectile.Center; - int killDust = Dust.NewDust(dustRotate + dustDirection, 0, 0, 107, dustDirection.X, dustDirection.Y, 100, default, 0.6f); + int killDust = Dust.NewDust(dustRotate + dustDirection, 0, 0, DustID.TerraBlade, dustDirection.X, dustDirection.Y, 100, default, 0.6f); Main.dust[killDust].noGravity = true; Main.dust[killDust].noLight = true; Main.dust[killDust].velocity = dustDirection; diff --git a/Projectiles/Magic/TradewindsProjectile.cs b/Projectiles/Magic/TradewindsProjectile.cs index 6d089f127c..3963edfbe5 100644 --- a/Projectiles/Magic/TradewindsProjectile.cs +++ b/Projectiles/Magic/TradewindsProjectile.cs @@ -1,5 +1,5 @@ +using System; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -23,14 +23,16 @@ namespace CalamityMod.Projectiles.Magic Projectile.penetrate = 2; Projectile.timeLeft = 600; Projectile.DamageType = DamageClass.Magic; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() { - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; if (Main.rand.NextBool(3)) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 64, 0f, 0f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.YellowTorch, 0f, 0f); } } diff --git a/Projectiles/Magic/TridentIcicle.cs b/Projectiles/Magic/TridentIcicle.cs index 21c84d3327..4fc8c59b59 100644 --- a/Projectiles/Magic/TridentIcicle.cs +++ b/Projectiles/Magic/TridentIcicle.cs @@ -1,9 +1,9 @@ using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -22,12 +22,14 @@ namespace CalamityMod.Projectiles.Magic Projectile.penetrate = 2; Projectile.ignoreWater = true; Projectile.coldDamage = true; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() { //make pretty dust - int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 88); + int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GemSapphire); Main.dust[index2].noGravity = true; } @@ -43,10 +45,10 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item27, Projectile.position); + SoundEngine.PlaySound(SoundID.Item27, Projectile.Center); for (int i = 0; i < 10; i++) { - int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 88); + int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GemSapphire); Main.dust[index2].noGravity = true; Main.dust[index2].velocity *= 2f; } diff --git a/Projectiles/Magic/UberBubble.cs b/Projectiles/Magic/UberBubble.cs index b0f20140a9..2e77928b40 100644 --- a/Projectiles/Magic/UberBubble.cs +++ b/Projectiles/Magic/UberBubble.cs @@ -1,8 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { public class UberBubble : ModProjectile, ILocalizedModType @@ -44,11 +44,11 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item96, Projectile.position); + SoundEngine.PlaySound(SoundID.Item96, Projectile.Center); int randDustAmt = Main.rand.Next(4, 6); for (int i = 0; i < randDustAmt; i++) { - int purpleDust = Dust.NewDust(Projectile.Center, 0, 0, 171, 0f, 0f, 100, default, 1.4f); + int purpleDust = Dust.NewDust(Projectile.Center, 0, 0, DustID.Venom, 0f, 0f, 100, default, 1.4f); Main.dust[purpleDust].velocity *= 0.8f; Main.dust[purpleDust].position = Vector2.Lerp(Main.dust[purpleDust].position, Projectile.Center, 0.5f); Main.dust[purpleDust].noGravity = true; diff --git a/Projectiles/Magic/UndinesRetributionSpear.cs b/Projectiles/Magic/UndinesRetributionSpear.cs index fbd5a1bc29..26aa156310 100644 --- a/Projectiles/Magic/UndinesRetributionSpear.cs +++ b/Projectiles/Magic/UndinesRetributionSpear.cs @@ -1,10 +1,10 @@ +using System; using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -54,7 +54,7 @@ namespace CalamityMod.Projectiles.Magic else { Projectile.spriteDirection = 1; - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X); + Projectile.rotation = Projectile.velocity.ToRotation(); } Lighting.AddLight(Projectile.Center, 0f, 0.1f, 0.7f); if (Main.player[Projectile.owner].active && !Main.player[Projectile.owner].dead) @@ -100,17 +100,17 @@ namespace CalamityMod.Projectiles.Magic Projectile.localNPCHitCooldown = 10; Projectile.damage /= 2; Projectile.Damage(); - SoundEngine.PlaySound(SoundID.Item21, Projectile.position); + SoundEngine.PlaySound(SoundID.Item21, Projectile.Center); for (int i = 0; i < 4; i++) { - Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 33, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Water, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); } for (int j = 0; j < 6; j++) { - int undust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 186, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); + int undust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RedsWingsRun, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); Main.dust[undust].noGravity = true; Main.dust[undust].velocity *= 3f; - undust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 186, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + undust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RedsWingsRun, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); Main.dust[undust].velocity *= 2f; Main.dust[undust].noGravity = true; } diff --git a/Projectiles/Magic/ValkyrieRayBeam.cs b/Projectiles/Magic/ValkyrieRayBeam.cs index 895d2ff2a5..f1ab86759c 100644 --- a/Projectiles/Magic/ValkyrieRayBeam.cs +++ b/Projectiles/Magic/ValkyrieRayBeam.cs @@ -1,7 +1,7 @@ -using CalamityMod.Items.Weapons.Magic; +using System; +using CalamityMod.Items.Weapons.Magic; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.Enums; using Terraria.GameContent.Shaders; @@ -64,7 +64,7 @@ namespace CalamityMod.Projectiles.Magic } // On frame 1, set the beam vector and rotation, but set the real velocity to zero. - if(Projectile.velocity != Vector2.Zero) + if (Projectile.velocity != Vector2.Zero) { beamVector = Vector2.Normalize(Projectile.velocity); Projectile.rotation = Projectile.velocity.ToRotation(); @@ -141,7 +141,7 @@ namespace CalamityMod.Projectiles.Magic if (beamVector == Vector2.Zero || Projectile.velocity != Vector2.Zero) return false; - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; float beamLength = Projectile.ai[0]; Vector2 centerFloored = Projectile.Center.Floor() + beamVector * Projectile.scale * BeamRenderTileOffset; Vector2 scaleVec = new Vector2(Projectile.scale); diff --git a/Projectiles/Magic/ValkyrieRayStaff.cs b/Projectiles/Magic/ValkyrieRayStaff.cs index a43a621bef..439fb9d839 100644 --- a/Projectiles/Magic/ValkyrieRayStaff.cs +++ b/Projectiles/Magic/ValkyrieRayStaff.cs @@ -1,9 +1,9 @@ using CalamityMod.Items.Weapons.Magic; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { diff --git a/Projectiles/Magic/VeeringWindAirWave.cs b/Projectiles/Magic/VeeringWindAirWave.cs index c247a336ef..debc0d10d9 100644 --- a/Projectiles/Magic/VeeringWindAirWave.cs +++ b/Projectiles/Magic/VeeringWindAirWave.cs @@ -1,7 +1,7 @@ -using CalamityMod.CalPlayer; +using System; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.width = Projectile.height = 48; Projectile.friendly = true; Projectile.tileCollide = false; - Projectile.penetrate = -1; + Projectile.penetrate = 2; Projectile.extraUpdates = 1; Projectile.timeLeft = 45; Projectile.DamageType = DamageClass.Magic; @@ -37,9 +37,17 @@ namespace CalamityMod.Projectiles.Magic Lighting.AddLight(Projectile.Center, Color.White.ToVector3() * 0.3f); } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + if (Projectile.numHits > 0) + Projectile.damage = (int)(Projectile.damage * 0.5); + if (Projectile.damage < 1) + Projectile.damage = 1; + } + public override bool PreDraw(ref Color lightColor) // Photoviscerator ball drawcode, slightly edited. { - Texture2D lightTexture = ModContent.Request(Texture).Value; + Texture2D lightTexture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; for (int i = 0; i < Projectile.oldPos.Length; i++) { float colorInterpolation = (float)Math.Cos(Projectile.timeLeft / 2.4f + Main.GlobalTimeWrappedHourly / 20f + i / (float)Projectile.oldPos.Length * MathHelper.Pi) * 0.5f + 0.5f; diff --git a/Projectiles/Magic/VeeringWindFrostWave.cs b/Projectiles/Magic/VeeringWindFrostWave.cs index 63232c64ff..c5d52e0493 100644 --- a/Projectiles/Magic/VeeringWindFrostWave.cs +++ b/Projectiles/Magic/VeeringWindFrostWave.cs @@ -1,8 +1,8 @@ -using CalamityMod.Buffs.StatDebuffs; +using System; +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.width = Projectile.height = 48; Projectile.friendly = true; Projectile.tileCollide = false; - Projectile.penetrate = -1; + Projectile.penetrate = 2; Projectile.timeLeft = 90; Projectile.DamageType = DamageClass.Magic; Projectile.usesIDStaticNPCImmunity = true; @@ -37,9 +37,17 @@ namespace CalamityMod.Projectiles.Magic Lighting.AddLight(Projectile.Center, Color.Blue.ToVector3() * 0.6f); } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + if (Projectile.numHits > 0) + Projectile.damage = (int)(Projectile.damage * 0.5); + if (Projectile.damage < 1) + Projectile.damage = 1; + } + public override bool PreDraw(ref Color lightColor) // Photoviscerator ball drawcode, slightly edited. { - Texture2D lightTexture = ModContent.Request(Texture).Value; + Texture2D lightTexture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; for (int i = 0; i < Projectile.oldPos.Length; i++) { float colorInterpolation = (float)Math.Cos(Projectile.timeLeft / 4.8f + Main.GlobalTimeWrappedHourly / 20f + i / (float)Projectile.oldPos.Length * MathHelper.Pi) * 0.5f + 0.5f; diff --git a/Projectiles/Magic/Vehemence.cs b/Projectiles/Magic/Vehemence.cs index 89f981aec6..1cafa7da21 100644 --- a/Projectiles/Magic/Vehemence.cs +++ b/Projectiles/Magic/Vehemence.cs @@ -1,12 +1,12 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Items.Weapons.Magic; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -81,7 +81,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item74, Projectile.position); + SoundEngine.PlaySound(SoundID.Item74, Projectile.Center); if (Main.myPlayer == Projectile.owner) { int skullID = ModContent.ProjectileType(); diff --git a/Projectiles/Magic/VehemenceHoldout.cs b/Projectiles/Magic/VehemenceHoldout.cs index 393eb2663d..54063d974c 100644 --- a/Projectiles/Magic/VehemenceHoldout.cs +++ b/Projectiles/Magic/VehemenceHoldout.cs @@ -1,6 +1,6 @@ -using CalamityMod.Dusts; +using System; +using CalamityMod.Dusts; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.Localization; using Terraria.ModLoader; diff --git a/Projectiles/Magic/VehemenceSkull.cs b/Projectiles/Magic/VehemenceSkull.cs index 11abd21183..514291573a 100644 --- a/Projectiles/Magic/VehemenceSkull.cs +++ b/Projectiles/Magic/VehemenceSkull.cs @@ -1,6 +1,6 @@ +using System; using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ModLoader; diff --git a/Projectiles/Magic/VenusianBolt.cs b/Projectiles/Magic/VenusianBolt.cs index 74551fa85b..55c7c4f354 100644 --- a/Projectiles/Magic/VenusianBolt.cs +++ b/Projectiles/Magic/VenusianBolt.cs @@ -1,9 +1,9 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -29,7 +29,7 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + MathHelper.ToRadians(45); + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.ToRadians(45); Lighting.AddLight(Projectile.Center, 0.25f, 0.2f, 0f); if (Projectile.wet && !Projectile.lavaWet) { @@ -37,12 +37,12 @@ namespace CalamityMod.Projectiles.Magic } if (Projectile.localAI[0] == 0f) { - SoundEngine.PlaySound(SoundID.Item73, Projectile.position); + SoundEngine.PlaySound(SoundID.Item73, Projectile.Center); Projectile.localAI[0] += 1f; } for (int i = 0; i < 3; i++) { - int venusDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 55, 0f, 0f, 100, default, 1.2f); + int venusDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Pixie, 0f, 0f, 100, default, 1.2f); Main.dust[venusDust].noGravity = true; Main.dust[venusDust].velocity *= 0.5f; Main.dust[venusDust].velocity += Projectile.velocity * 0.1f; diff --git a/Projectiles/Magic/VenusianExplosion.cs b/Projectiles/Magic/VenusianExplosion.cs index f1907324d1..199f6ca856 100644 --- a/Projectiles/Magic/VenusianExplosion.cs +++ b/Projectiles/Magic/VenusianExplosion.cs @@ -1,9 +1,9 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -31,7 +31,7 @@ namespace CalamityMod.Projectiles.Magic Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.75f / 255f, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0.01f / 255f); if (Projectile.localAI[0] == 0f) { - SoundEngine.PlaySound(SoundID.Item74, Projectile.position); + SoundEngine.PlaySound(SoundID.Item74, Projectile.Center); Projectile.localAI[0] += 1f; } float projTimer = 25f; @@ -56,7 +56,7 @@ namespace CalamityMod.Projectiles.Magic randoAdjuster = rando3 / randoAdjuster; rando1 *= randoAdjuster; rando2 *= randoAdjuster; - int venusDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 55, 0f, 0f, 100, default, 2.5f); + int venusDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Pixie, 0f, 0f, 100, default, 2.5f); Dust dust = Main.dust[venusDust]; dust.noGravity = true; dust.position.X = Projectile.Center.X; diff --git a/Projectiles/Magic/VenusianFlame.cs b/Projectiles/Magic/VenusianFlame.cs index 29f067287f..a30274e76a 100644 --- a/Projectiles/Magic/VenusianFlame.cs +++ b/Projectiles/Magic/VenusianFlame.cs @@ -107,7 +107,7 @@ namespace CalamityMod.Projectiles.Magic //Dust if (Main.rand.NextBool(4)) { - int venusDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 55, 0f, 0f, 100, default, 1f); + int venusDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Pixie, 0f, 0f, 100, default, 1f); Dust dust = Main.dust[venusDust]; dust.position.X -= 2f; dust.position.Y += 2f; @@ -117,7 +117,7 @@ namespace CalamityMod.Projectiles.Magic } if (Main.rand.NextBool(10)) { - int venusDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 55, 0f, 0f, 100, default, 1f); + int venusDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Pixie, 0f, 0f, 100, default, 1f); Dust dust2 = Main.dust[venusDust2]; dust2.position.X -= 2f; dust2.position.Y += 2f; diff --git a/Projectiles/Magic/VisceraBeam.cs b/Projectiles/Magic/VisceraBeam.cs index 1af449b9f2..33e7e3124b 100644 --- a/Projectiles/Magic/VisceraBeam.cs +++ b/Projectiles/Magic/VisceraBeam.cs @@ -1,6 +1,14 @@ +using CalamityMod.Graphics.Metaballs; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Particles; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; +using CalamityMod.Balancing; +using System; namespace CalamityMod.Projectiles.Magic { @@ -9,70 +17,142 @@ namespace CalamityMod.Projectiles.Magic public new string LocalizationCategory => "Projectiles.Magic"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - public float healAmt = 1f; + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 20; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + } public override void SetDefaults() { - Projectile.width = 4; - Projectile.height = 4; + Projectile.width = 9; + Projectile.height = 9; Projectile.friendly = true; Projectile.DamageType = DamageClass.Magic; Projectile.ignoreWater = true; - Projectile.penetrate = 9; - Projectile.extraUpdates = 100; - Projectile.timeLeft = 300; + Projectile.penetrate = 7; + Projectile.MaxUpdates = 100; + Projectile.timeLeft = 900; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 5; + Projectile.localNPCHitCooldown = -1; } public override bool OnTileCollide(Vector2 oldVelocity) { - healAmt *= 1.25f; - Projectile.penetrate--; - if (Projectile.penetrate <= 0) + if (Projectile.velocity.X != oldVelocity.X) { - Projectile.Kill(); + Projectile.velocity.X = -oldVelocity.X; } - else + if (Projectile.velocity.Y != oldVelocity.Y) { - if (Projectile.velocity.X != oldVelocity.X) - { - Projectile.velocity.X = -oldVelocity.X; - } - if (Projectile.velocity.Y != oldVelocity.Y) - { - Projectile.velocity.Y = -oldVelocity.Y; - } + Projectile.velocity.Y = -oldVelocity.Y; + } + for (int i = 0; i <= 15; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool() ? 60 : DustID.Blood); + dust.position = Projectile.Center; + dust.scale = Main.rand.NextFloat(0.8f, 1.3f); + dust.velocity = new Vector2(7, 7).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 0.9f); + dust.noGravity = true; } return false; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - if (!target.canGhostHeal || Main.player[Projectile.owner].moonLeech) + if (Projectile.ai[1] > 0) + { + SoundStyle hitSound = new("CalamityMod/Sounds/NPCKilled/PerfLargeDeath"); + SoundEngine.PlaySound(hitSound with { Volume = 0.5f }, Projectile.Center); + for (int i = 0; i <= 14; i++) + { + BloodParticle blood = new BloodParticle(Projectile.Center, new Vector2(15, 15).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 0.9f) + new Vector2(0, -7), 60, Main.rand.NextFloat(0.4f, 0.65f), Color.Red); + GeneralParticleHandler.SpawnParticle(blood); + } + + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.75f), Projectile.knockBack * 4, Projectile.owner, 0f, Projectile.ai[1]); + + Particle bloodsplosion = new CustomPulse(Projectile.Center, Vector2.Zero, Color.DarkRed, "CalamityMod/Particles/DetailedExplosion", Vector2.One, Main.rand.NextFloat(-15f, 15f), 0.16f, 0.87f, (int)(Viscera.BoomLifetime * 0.38f), false); + GeneralParticleHandler.SpawnParticle(bloodsplosion); + Particle bloodsplosion2 = new CustomPulse(Projectile.Center, Vector2.Zero, new Color(255, 32, 32), "CalamityMod/Particles/DustyCircleHardEdge", Vector2.One, Main.rand.NextFloat(-15f, 15f), 0.03f, 0.155f, Viscera.BoomLifetime); + GeneralParticleHandler.SpawnParticle(bloodsplosion2); + } + else + { + SoundStyle hitSound = new("CalamityMod/Sounds/NPCHit/PerfLargeHit", 3); + SoundEngine.PlaySound(hitSound with { Volume = 0.7f }, Projectile.Center); + + for (int i = 0; i <= 6; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool() ? 60 : DustID.Blood); + dust.scale = Main.rand.NextFloat(0.7f, 1.4f); + dust.velocity = Projectile.velocity.RotatedByRandom(0.5) * Main.rand.NextFloat(0.8f, 1.9f); + dust.noGravity = true; + } + } + + int heal = (int)Math.Round(hit.Damage * 0.05); + if (heal > BalancingConstants.LifeStealCap) + heal = BalancingConstants.LifeStealCap; + + if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) return; - healAmt *= 1.25f; - Player player = Main.player[Projectile.owner]; - player.statLife += (int)healAmt; - player.HealEffect((int)healAmt); + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); } public override void AI() { + Player Owner = Main.player[Projectile.owner]; + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); + + if (Projectile.ai[1] > 0) + Projectile.penetrate = 1; + Projectile.localAI[0] += 1f; - if (Projectile.localAI[0] > 9f) + if (Projectile.localAI[0] == 16f) { - for (int i = 0; i < 4; i++) + if (Projectile.ai[1] > 0) { - Vector2 projPos = Projectile.position; - projPos -= Projectile.velocity * ((float)i * 0.25f); - int bloody = Dust.NewDust(projPos, 1, 1, 5, 0f, 0f, 0, default, 1f); - Main.dust[bloody].position = projPos; - Main.dust[bloody].scale = (float)Main.rand.Next(70, 110) * 0.013f; - Main.dust[bloody].velocity *= 0.1f; + for (int i = 0; i <= 25; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool() ? 60 : DustID.Blood); + dust.scale = Main.rand.NextFloat(0.9f, 1.9f); + dust.velocity = Projectile.velocity.RotatedByRandom(0.6) * Main.rand.NextFloat(1.8f, 2.9f); + dust.noGravity = true; + } + } + else + { + for (int i = 0; i <= 10; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool() ? 60 : DustID.Blood); + dust.scale = Main.rand.NextFloat(0.7f, 1.4f); + dust.velocity = Projectile.velocity.RotatedByRandom(0.6) * Main.rand.NextFloat(0.8f, 1.9f); + dust.noGravity = true; + } + } + } + if (Projectile.localAI[0] > 16f) + { + int bloody = Dust.NewDust(Projectile.Center, 1, 1, DustID.Blood); + Main.dust[bloody].position = Projectile.Center + Main.rand.NextVector2Circular(8, 8); + Main.dust[bloody].scale = Main.rand.NextFloat(0.3f, 0.8f); + Main.dust[bloody].velocity = -Projectile.velocity * Main.rand.NextFloat(0.3f, 0.6f); + Main.dust[bloody].noGravity = true; + if (Projectile.localAI[0] % 3 == 0 && targetDist < 1400f) + { + AltSparkParticle spark = new AltSparkParticle(Projectile.Center - Projectile.velocity * 0.5f, Projectile.velocity * 0.01f, false, 7, 0.8f, Color.DarkRed); + GeneralParticleHandler.SpawnParticle(spark); + SparkParticle spark2 = new SparkParticle(Projectile.Center - Projectile.velocity * 0.5f, Projectile.velocity * 0.01f, false, 4, 0.65f, Color.Red); + GeneralParticleHandler.SpawnParticle(spark2); } } } + + public override bool PreDraw(ref Color lightColor) + { + return false; + } } } diff --git a/Projectiles/Magic/VisceraBoom.cs b/Projectiles/Magic/VisceraBoom.cs new file mode 100644 index 0000000000..b347d6661c --- /dev/null +++ b/Projectiles/Magic/VisceraBoom.cs @@ -0,0 +1,46 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Weapons.Magic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; + +namespace CalamityMod.Projectiles.Magic +{ + public class VisceraBoom : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Magic"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 250; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.penetrate = -1; + Projectile.timeLeft = Viscera.BoomLifetime; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + public override void AI() + { + for (int i = 0; i <= 2; i++) + { + float speed = Projectile.ai[1] > 0 ? 25 : 15; + Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool() ? 60 : DustID.Blood); + dust.scale = Main.rand.NextFloat(1f, 2f) * Utils.GetLerpValue(0, Viscera.BoomLifetime, Projectile.timeLeft, true); + dust.velocity = new Vector2(speed, speed).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 0.9f); + dust.noGravity = true; + } + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 180); + } + + public override void OnHitPlayer(Player target, Player.HurtInfo info) + { + target.AddBuff(ModContent.BuffType(), 180); + } + } +} diff --git a/Projectiles/Magic/VitriolicViperFang.cs b/Projectiles/Magic/VitriolicViperFang.cs index b95023a4fe..692d1cc032 100644 --- a/Projectiles/Magic/VitriolicViperFang.cs +++ b/Projectiles/Magic/VitriolicViperFang.cs @@ -1,9 +1,9 @@ +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Buffs.DamageOverTime; namespace CalamityMod.Projectiles.Magic { @@ -44,7 +44,7 @@ namespace CalamityMod.Projectiles.Magic { for (int i = 0; i < 10; i++) { - Dust dust = Dust.NewDustDirect(Projectile.position, 10, 10, (int)CalamityDusts.SulfurousSeaAcid); + Dust dust = Dust.NewDustDirect(Projectile.position, 10, 10, (int)CalamityDusts.SulphurousSeaAcid); dust.noGravity = true; } } diff --git a/Projectiles/Magic/VitriolicViperSpit.cs b/Projectiles/Magic/VitriolicViperSpit.cs index b80cf515dd..5006073273 100644 --- a/Projectiles/Magic/VitriolicViperSpit.cs +++ b/Projectiles/Magic/VitriolicViperSpit.cs @@ -1,7 +1,8 @@ +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Buffs.DamageOverTime; namespace CalamityMod.Projectiles.Magic { @@ -26,7 +27,7 @@ namespace CalamityMod.Projectiles.Magic { for (int i = 0; i < 14; i++) { - Dust dust = Dust.NewDustDirect(Projectile.position, 10, 10, 27); + Dust dust = Dust.NewDustDirect(Projectile.position, 10, 10, DustID.Shadowflame); dust.noGravity = true; } } diff --git a/Projectiles/Magic/VividBeam.cs b/Projectiles/Magic/VividBeam.cs index 160a7d12a1..028a3a5681 100644 --- a/Projectiles/Magic/VividBeam.cs +++ b/Projectiles/Magic/VividBeam.cs @@ -1,10 +1,12 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Weapons.Magic; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.Audio; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Magic { public class VividBeam : ModProjectile, ILocalizedModType @@ -38,7 +40,7 @@ namespace CalamityMod.Projectiles.Magic Vector2 offset = Vector2.UnitX * 0f; offset += -Vector2.UnitY.RotatedBy((double)((float)d * (MathHelper.TwoPi / dustAmt)), default) * new Vector2(1f, 4f); offset = offset.RotatedBy((double)Projectile.velocity.ToRotation(), default); - int i = Dust.NewDust(Projectile.Center, 0, 0, 66, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + int i = Dust.NewDust(Projectile.Center, 0, 0, DustID.RainbowTorch, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); Main.dust[i].scale = 1.5f; Main.dust[i].noGravity = true; Main.dust[i].position = Projectile.Center + offset; @@ -59,7 +61,7 @@ namespace CalamityMod.Projectiles.Magic { Vector2 offset = Vector2.UnitX * -12f; offset = -Vector2.UnitY.RotatedBy((double)(Projectile.ai[0] * pi / 24f + (float)d * pi), default) * new Vector2(5f, 10f) - Projectile.rotation.ToRotationVector2() * 10f; - int i = Dust.NewDust(Projectile.Center, 0, 0, 66, 0f, 0f, 160, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + int i = Dust.NewDust(Projectile.Center, 0, 0, DustID.RainbowTorch, 0f, 0f, 160, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); Main.dust[i].scale = 0.75f; Main.dust[i].noGravity = true; Main.dust[i].position = Projectile.Center + offset; @@ -115,7 +117,7 @@ namespace CalamityMod.Projectiles.Magic switch (Projectile.ai[1]) { case 0f: - CalamityUtils.ProjectileRain(source, Projectile.Center, 400f, 100f, 500f, 800f, 6f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.7), Projectile.knockBack, Projectile.owner); + CalamityUtils.ProjectileRain(source, Projectile.Center, 320f, 100f, 400f, 640f, 6f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); break; case 1f: diff --git a/Projectiles/Magic/VividBolt.cs b/Projectiles/Magic/VividBolt.cs index dcb2e61d1e..0d9ec716f5 100644 --- a/Projectiles/Magic/VividBolt.cs +++ b/Projectiles/Magic/VividBolt.cs @@ -1,7 +1,9 @@ using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Magic { public class VividBolt : ModProjectile, ILocalizedModType @@ -37,7 +39,7 @@ namespace CalamityMod.Projectiles.Magic { Vector2 dustRotation = Vector2.UnitX * -12f; dustRotation = -Vector2.UnitY.RotatedBy((double)(Projectile.ai[0] * 0.1308997f + (float)i * 3.14159274f), default) * rotateVector - Projectile.rotation.ToRotationVector2() * 10f; - int exo = Dust.NewDust(Projectile.Center, 0, 0, 66, 0f, 0f, 160, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + int exo = Dust.NewDust(Projectile.Center, 0, 0, DustID.RainbowTorch, 0f, 0f, 160, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); Main.dust[exo].scale = 0.33f; Main.dust[exo].noGravity = true; Main.dust[exo].position = Projectile.Center + dustRotation; @@ -51,7 +53,7 @@ namespace CalamityMod.Projectiles.Magic { Vector2 projPos = Projectile.position; projPos -= Projectile.velocity * ((float)j * 0.25f); - int exod = Dust.NewDust(projPos, 1, 1, 66, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + int exod = Dust.NewDust(projPos, 1, 1, DustID.RainbowTorch, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); Main.dust[exod].noGravity = true; Main.dust[exod].position = projPos; Main.dust[exod].scale = (float)Main.rand.Next(70, 110) * 0.01f; diff --git a/Projectiles/Magic/VividClarityBeam.cs b/Projectiles/Magic/VividClarityBeam.cs index c1166dcde3..770171b668 100644 --- a/Projectiles/Magic/VividClarityBeam.cs +++ b/Projectiles/Magic/VividClarityBeam.cs @@ -1,6 +1,7 @@ using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic @@ -20,6 +21,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.penetrate = 10; Projectile.extraUpdates = 100; Projectile.timeLeft = 300; + Projectile.tileCollide = false; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 10; } @@ -27,6 +29,10 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { Vector2 rotateVector = new Vector2(5f, 10f); + if (Projectile.position.Y > Main.player[Projectile.owner].position.Y - 50f) + { + Projectile.tileCollide = true; + } Projectile.ai[0] += 1f; if (Projectile.ai[0] == 48f) { @@ -38,7 +44,7 @@ namespace CalamityMod.Projectiles.Magic { Vector2 dustRotation = Vector2.UnitX * -12f; dustRotation = -Vector2.UnitY.RotatedBy((double)(Projectile.ai[0] * 0.1308997f + (float)i * 3.14159274f), default) * rotateVector - Projectile.rotation.ToRotationVector2() * 10f; - int exo = Dust.NewDust(Projectile.Center, 0, 0, 66, 0f, 0f, 160, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + int exo = Dust.NewDust(Projectile.Center, 0, 0, DustID.RainbowTorch, 0f, 0f, 160, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); Main.dust[exo].scale = 0.75f; Main.dust[exo].noGravity = true; Main.dust[exo].position = Projectile.Center + dustRotation; @@ -47,10 +53,10 @@ namespace CalamityMod.Projectiles.Magic } Projectile.localAI[1] += 1f; - if (Projectile.localAI[1] >= 29f && Projectile.owner == Main.myPlayer) + if (Projectile.localAI[1] >= 49f && Projectile.owner == Main.myPlayer) { Projectile.localAI[1] = 0f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.66f), Projectile.knockBack, Projectile.owner, 0f, 0f); } Projectile.localAI[0] += 1f; @@ -60,7 +66,7 @@ namespace CalamityMod.Projectiles.Magic { Vector2 projPos = Projectile.position; projPos -= Projectile.velocity * ((float)j * 0.25f); - int exod = Dust.NewDust(projPos, 1, 1, 66, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + int exod = Dust.NewDust(projPos, 1, 1, DustID.RainbowTorch, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); Main.dust[exod].noGravity = true; Main.dust[exod].position = projPos; Main.dust[exod].scale = (float)Main.rand.Next(70, 110) * 0.013f; diff --git a/Projectiles/Magic/VividLaser2.cs b/Projectiles/Magic/VividLaser2.cs index ec6e500815..8b7fbb544b 100644 --- a/Projectiles/Magic/VividLaser2.cs +++ b/Projectiles/Magic/VividLaser2.cs @@ -1,7 +1,9 @@ using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Magic { public class VividLaser2 : ModProjectile, ILocalizedModType @@ -29,7 +31,7 @@ namespace CalamityMod.Projectiles.Magic { Vector2 dustPosOffset = Vector2.UnitX * -12f; dustPosOffset = -Vector2.UnitY.RotatedBy((double)(Projectile.ai[1] * 0.1308997f + (float)dust * 3.14159274f), default) * value7 - Projectile.rotation.ToRotationVector2() * 10f; - int exo = Dust.NewDust(Projectile.Center, 0, 0, 66, 0f, 0f, 160, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + int exo = Dust.NewDust(Projectile.Center, 0, 0, DustID.RainbowTorch, 0f, 0f, 160, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); Main.dust[exo].scale = 0.75f; Main.dust[exo].noGravity = true; Main.dust[exo].position = Projectile.Center + dustPosOffset; diff --git a/Projectiles/Magic/VividOrb.cs b/Projectiles/Magic/VividOrb.cs index eafc7e247d..793b9ff143 100644 --- a/Projectiles/Magic/VividOrb.cs +++ b/Projectiles/Magic/VividOrb.cs @@ -1,4 +1,4 @@ -using Terraria.ModLoader; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { public class VividOrb : ModProjectile, ILocalizedModType diff --git a/Projectiles/Magic/VoidVortexProj.cs b/Projectiles/Magic/VoidVortexProj.cs index 89b31722cd..f8c424ab86 100644 --- a/Projectiles/Magic/VoidVortexProj.cs +++ b/Projectiles/Magic/VoidVortexProj.cs @@ -1,7 +1,13 @@ -using CalamityMod.Items.Weapons.Magic; +using System; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using Mono.Cecil; using Terraria; +using Terraria.Audio; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic @@ -9,9 +15,16 @@ namespace CalamityMod.Projectiles.Magic public class VoidVortexProj : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Magic"; + public int time = 0; + public int timeOffset = 0; + public bool doDamage = false; + public bool fireBeam = true; + public bool rotDirection = false; public override void SetStaticDefaults() { Main.projFrames[Projectile.type] = 5; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 15; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; } public override void SetDefaults() @@ -22,21 +35,94 @@ namespace CalamityMod.Projectiles.Magic Projectile.ignoreWater = true; Projectile.tileCollide = false; Projectile.penetrate = -1; - Projectile.timeLeft = 135; + Projectile.timeLeft = 90; + Projectile.extraUpdates = 2; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; Projectile.DamageType = DamageClass.Magic; } public override void AI() { - // Spin chaotically given a pre-defined spin direction. Choose one initially at random. - float spinTheta = 0.11f; - if (Projectile.localAI[0] == 0f) - Projectile.localAI[0] = Main.rand.NextBool() ? -spinTheta : spinTheta; - Projectile.rotation += Projectile.localAI[0]; + if (Projectile.ai[2] == 3) + { + if (time == 0) + { + timeOffset = Main.rand.Next(20, 40 + 1); + Projectile.timeLeft = 500; + Projectile.extraUpdates = 2; + Projectile.scale = Main.rand.NextFloat(0.35f, 0.55f); + rotDirection = Main.rand.NextBool(); + } + + if (time >= 20) + doDamage = true; + if (time >= timeOffset && time % 25 == 0) + { + Projectile.velocity = Projectile.velocity.RotatedBy(rotDirection ? 0.65f : -0.65f); + rotDirection = !rotDirection; + } + CalamityUtils.HomeInOnNPC(Projectile, true, 1000f, 15, MathHelper.Clamp(100f - time * 0.3f, 40, 100)); + if (Main.rand.NextBool()) + { + Dust dust2 = Dust.NewDustPerfect(Projectile.Center, 226, -Projectile.velocity * Main.rand.NextFloat(0.05f, 0.3f)); + dust2.scale = Main.rand.NextFloat(0.35f, 0.75f); + dust2.noGravity = true; + } + + } + else + { + if (Projectile.timeLeft < 65) + { + Projectile.velocity *= 0.98f; + } + else + { + // Spin chaotically given a pre-defined spin direction. Choose one initially at random. + float spinTheta = 0.11f; + if (Projectile.localAI[0] == 0f) + Projectile.localAI[0] = Main.rand.NextBool() ? -spinTheta : spinTheta; + //Projectile.rotation += Projectile.localAI[0]; + + // Spiral outwards in an increasingly chaotic fashion. + float revolutionTheta = 0.14f * Projectile.ai[1]; + if (Projectile.ai[0] % 2 == 0f) + Projectile.velocity = Projectile.velocity.RotatedBy(revolutionTheta) * 1.0092f; + + } + if (time == 25 && Projectile.ai[2] == 1) + { + Projectile.scale = 1.5f; + Projectile.alpha = 0; + for (int k = 0; k < 25; k++) + { + Dust dust2 = Dust.NewDustPerfect(Projectile.Center, 226, new Vector2(15, 15).RotatedByRandom(100) * Main.rand.NextFloat(0.05f, 0.8f)); + dust2.scale = Main.rand.NextFloat(0.45f, 0.95f); + dust2.noGravity = true; + } + Projectile.ai[0] = 0; + } + if (time >= 25 && Projectile.ai[2] == 1 && time % 2 == 0 && Projectile.timeLeft > 20) + { + Particle bolt = new CrackParticle(Projectile.Center, new Vector2(8, 8).RotatedByRandom(100), Color.Aqua * 0.65f, Vector2.One, 0, 0, Main.rand.NextFloat(0.4f, 0.65f), 11); + GeneralParticleHandler.SpawnParticle(bolt); + } + + --Projectile.ai[0]; + + NPC target = Projectile.Center.ClosestNPCAt(1000); + + if (fireBeam && Projectile.ai[0] == -30 && Projectile.ai[2] <= 0 && target != null) + { + CalamityUtils.MagnetSphereHitscan(Projectile, Vector2.Distance(Projectile.Center, target.Center), 8f, 0, 1, ModContent.ProjectileType(), 1D, true); + fireBeam = false; + } + } // Animate the lightning orb. Projectile.frameCounter++; - if (Projectile.frameCounter > 6) + if (Projectile.frameCounter > 3) { Projectile.frameCounter = 0; Projectile.frame++; @@ -46,36 +132,73 @@ namespace CalamityMod.Projectiles.Magic } } - // Spiral outwards in an increasingly chaotic fashion. - float revolutionTheta = 0.12f * Projectile.ai[1]; - Projectile.velocity = Projectile.velocity.RotatedBy(revolutionTheta) * 1.0092f; + if (Projectile.ai[0] <= 0) + time++; + } + public override void OnKill(int timeLeft) + { + if (Projectile.ai[2] == 1) + { + doDamage = true; + Projectile.ExpandHitboxBy(400); + Projectile.Damage(); - // Initial stagger in frames needs to be skipped over before it starts shooting, - // but once it's past that then it can fire constantly - --Projectile.ai[0]; - if (Projectile.ai[0] < 0f) - CalamityUtils.MagnetSphereHitscan(Projectile, 400f, 8f, VoidVortex.OrbFireRate, 2, ModContent.ProjectileType(), 1D, true); + for (int k = 0; k < 12; k++) + { + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, new Vector2(10, 10).RotatedByRandom(100) * Main.rand.NextFloat(0.4f, 0.55f), ModContent.ProjectileType(), Projectile.damage / 6, 0f, Main.myPlayer, 0f, 0f, 3f); + } + for (int k = 0; k < 40; k++) + { + Dust dust2 = Dust.NewDustPerfect(Projectile.Center, 226, new Vector2(25, 25).RotatedByRandom(100) * Main.rand.NextFloat(0.05f, 0.8f)); + dust2.scale = Main.rand.NextFloat(0.65f, 1.15f); + dust2.noGravity = true; + } + SoundStyle fire = new("CalamityMod/Sounds/Item/AuricBulletHit"); + SoundEngine.PlaySound(fire with { Volume = 0.4f, Pitch = 0f }, Projectile.Center); + Particle bolt = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Aqua, "CalamityMod/Particles/HighResFoggyCircleHardEdge", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0.03f, 0.16f, 16); + GeneralParticleHandler.SpawnParticle(bolt); + } + if (Projectile.ai[2] == 3) + { + for (int k = 0; k < 7; k++) + { + Dust dust2 = Dust.NewDustPerfect(Projectile.Center, 226, new Vector2(5, 5).RotatedByRandom(100) * Main.rand.NextFloat(0.05f, 0.8f)); + dust2.scale = Main.rand.NextFloat(0.45f, 0.75f); + dust2.noGravity = true; + } + } + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(BuffID.Electrified, 180); + if (hit.Damage > 1 && Projectile.ai[2] == 3) + Projectile.Kill(); } public override Color? GetAlpha(Color lightColor) { - if (Projectile.timeLeft < 30) + if (Projectile.timeLeft < 20) { - float timerAlpha = Projectile.timeLeft / 30f; + float timerAlpha = Projectile.timeLeft / 20f; Projectile.alpha = (int)(255f - 255f * timerAlpha); } + if (time < 25 && Projectile.ai[2] == 1) + Projectile.alpha = 255; return new Color(255 - Projectile.alpha, 255 - Projectile.alpha, 255 - Projectile.alpha, 0); } public override bool PreDraw(ref Color lightColor) { - Texture2D texture2D13 = ModContent.Request(Texture).Value; - int framing = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; + Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + int framing = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; int y6 = framing * Projectile.frame; - Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture2D13.Width / 2f, framing / 2f), Projectile.scale, SpriteEffects.None, 0); + Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture2D13.Width / 2f, framing / 2f), Projectile.scale * (Projectile.ai[2] == 3 ? 1.3f : 1f), SpriteEffects.None, 0); + + if (Projectile.ai[2] == 3) + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor * 0.3f, 1, texture2D13); return false; } - public override bool? CanDamage() => false; + public override bool? CanDamage() => doDamage ? null : false; } } diff --git a/Projectiles/Magic/VolatileStarcore.cs b/Projectiles/Magic/VolatileStarcore.cs index c95c6b1ffe..075df64777 100644 --- a/Projectiles/Magic/VolatileStarcore.cs +++ b/Projectiles/Magic/VolatileStarcore.cs @@ -2,9 +2,9 @@ using CalamityMod.Items.Weapons.Magic; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { public class VolatileStarcore : ModProjectile, ILocalizedModType diff --git a/Projectiles/Magic/VortexElementalBeam.cs b/Projectiles/Magic/VortexElementalBeam.cs index 904ba805d5..588e6a436f 100644 --- a/Projectiles/Magic/VortexElementalBeam.cs +++ b/Projectiles/Magic/VortexElementalBeam.cs @@ -1,8 +1,8 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using System.IO; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -118,7 +118,7 @@ namespace CalamityMod.Projectiles.Magic #region Drawing public override bool PreDraw(ref Color lightColor) { - Texture2D lightningSegmentTexture = ModContent.Request(Texture).Value; + Texture2D lightningSegmentTexture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Projectile.GetAlpha(lightColor); Vector2 lightningScale = new Vector2(Projectile.scale) / 2f; for (int i = 0; i < 3; i++) diff --git a/Projectiles/Magic/WaterLeechProj.cs b/Projectiles/Magic/WaterLeechProj.cs index 5c2e3b39dd..6345b2e1f5 100644 --- a/Projectiles/Magic/WaterLeechProj.cs +++ b/Projectiles/Magic/WaterLeechProj.cs @@ -1,12 +1,12 @@ -using CalamityMod.Buffs.StatDebuffs; +using System; +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; -using Terraria.ModLoader; -using Terraria.ID; using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Magic if (Projectile.ai[0] == 0f) { - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + MathHelper.Pi; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.Pi; } //Sticky Behaviour Projectile.StickyProjAI(5); @@ -70,7 +70,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; int height = texture.Height / Main.projFrames[Projectile.type]; int drawStart = height * Projectile.frame; Vector2 origin = Projectile.Size / 2; @@ -85,7 +85,7 @@ namespace CalamityMod.Projectiles.Magic public override void PostDraw(Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; int height = texture.Height / Main.projFrames[Projectile.type]; int drawStart = height * Projectile.frame; Vector2 origin = Projectile.Size / 2; @@ -99,10 +99,10 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.NPCDeath1 with { Volume = SoundID.NPCDeath1.Volume * 0.5f }, Projectile.position); + SoundEngine.PlaySound(SoundID.NPCDeath1 with { Volume = SoundID.NPCDeath1.Volume * 0.5f }, Projectile.Center); for (int i = 0; i < 5; i++) { - int dust = Dust.NewDust(Projectile.Center, 1, 1, (int)CalamityDusts.SulfurousSeaAcid, 0, 0, 0, default, 1.5f); + int dust = Dust.NewDust(Projectile.Center, 1, 1, (int)CalamityDusts.SulphurousSeaAcid, 0, 0, 0, default, 1.5f); Main.dust[dust].noGravity = true; } } diff --git a/Projectiles/Magic/WaywasherProj.cs b/Projectiles/Magic/WaywasherProj.cs index aec8731d96..83e2a7f9b6 100644 --- a/Projectiles/Magic/WaywasherProj.cs +++ b/Projectiles/Magic/WaywasherProj.cs @@ -1,9 +1,9 @@ +using System; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { public class WaywasherProj : ModProjectile, ILocalizedModType @@ -19,6 +19,8 @@ namespace CalamityMod.Projectiles.Magic Projectile.penetrate = 2; Projectile.timeLeft = 300; Projectile.DamageType = DamageClass.Magic; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() @@ -30,7 +32,7 @@ namespace CalamityMod.Projectiles.Magic float shortXVel = Projectile.velocity.X / 3f * (float)i; float shortYVel = Projectile.velocity.Y / 3f * (float)i; int fourConst = 4; - int waterDust = Dust.NewDust(new Vector2(Projectile.position.X + (float)fourConst, Projectile.position.Y + (float)fourConst), Projectile.width - fourConst * 2, Projectile.height - fourConst * 2, 33, 0f, 0f, 0, new Color(64, 224, 208), 1.2f); + int waterDust = Dust.NewDust(new Vector2(Projectile.position.X + (float)fourConst, Projectile.position.Y + (float)fourConst), Projectile.width - fourConst * 2, Projectile.height - fourConst * 2, DustID.Water, 0f, 0f, 0, new Color(64, 224, 208), 1.2f); Dust dust = Main.dust[waterDust]; dust.noGravity = true; dust.velocity *= 0.1f; @@ -41,7 +43,7 @@ namespace CalamityMod.Projectiles.Magic if (Main.rand.NextBool(5)) { int otherFourConst = 4; - int otherWaterDust = Dust.NewDust(new Vector2(Projectile.position.X + (float)otherFourConst, Projectile.position.Y + (float)otherFourConst), Projectile.width - otherFourConst * 2, Projectile.height - otherFourConst * 2, 33, 0f, 0f, 0, new Color(64, 224, 208), 0.6f); + int otherWaterDust = Dust.NewDust(new Vector2(Projectile.position.X + (float)otherFourConst, Projectile.position.Y + (float)otherFourConst), Projectile.width - otherFourConst * 2, Projectile.height - otherFourConst * 2, DustID.Water, 0f, 0f, 0, new Color(64, 224, 208), 0.6f); Main.dust[otherWaterDust].velocity *= 0.25f; Main.dust[otherWaterDust].velocity += Projectile.velocity * 0.5f; } @@ -53,10 +55,10 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item10, Projectile.position); + SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); for (int k = 0; k < 10; k++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 33, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f, 0, new Color(0, 142, 255), 1f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Water, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f, 0, new Color(0, 142, 255), 1f); } } } diff --git a/Projectiles/Magic/WingmanGrenade.cs b/Projectiles/Magic/WingmanGrenade.cs new file mode 100644 index 0000000000..fe6b7fb52a --- /dev/null +++ b/Projectiles/Magic/WingmanGrenade.cs @@ -0,0 +1,147 @@ +using CalamityMod.Particles; +using CalamityMod.Projectiles.Summon; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Magic +{ + public class WingmanGrenade : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Magic"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public int BounceHits = 0; + public Color mainColor = Color.White; + public bool exploding = false; + public float sizeBonus = 1; + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 14; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + } + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 20; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 480; + Projectile.DamageType = DamageClass.Magic; + Projectile.extraUpdates = 6; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + + public override void AI() + { + if (mainColor == Color.White) + { + Projectile.scale = 0.4f; + if (Projectile.ai[1] == 0) + mainColor = Color.HotPink; + + if (Projectile.ai[1] == 2) + { + mainColor = Color.MediumVioletRed; + Projectile.scale = 0.5f; + sizeBonus = 1.5f; + } + } + + if (Projectile.timeLeft % 2 == 0) + Projectile.scale = Main.rand.NextFloat(0.35f, 0.5f); + + if (Projectile.timeLeft <= 65) + exploding = true; + + if (exploding) + { + Projectile.velocity = Vector2.Zero; + if (Projectile.timeLeft > 65) + Projectile.timeLeft = 65; + if (Projectile.timeLeft == 65) + { + Particle blastRing2 = new CustomPulse(Projectile.Center, Vector2.Zero, mainColor, "CalamityMod/Particles/HighResHollowCircleHardEdge", Vector2.One, Main.rand.NextFloat(-10, 10), 0f, 0.12f * sizeBonus, 15); + GeneralParticleHandler.SpawnParticle(blastRing2); + Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Lerp(mainColor, Color.White, 0.5f), "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 3f * sizeBonus, 0f, 25); + GeneralParticleHandler.SpawnParticle(blastRing); + SoundStyle fire = new("CalamityMod/Sounds/Item/ArcNovaDiffuserChargeImpact"); + SoundEngine.PlaySound(fire with { Volume = 1.25f, Pitch = -0.2f, PitchVariance = 0.15f }, Projectile.Center); + } + if (Projectile.timeLeft == 65) + { + Particle blastRing2 = new CustomPulse(Projectile.Center, Vector2.Zero, mainColor, "CalamityMod/Particles/HighResHollowCircleHardEdge", Vector2.One, Main.rand.NextFloat(-10, 10), 0.12f * sizeBonus, 0.135f * sizeBonus, 50); + GeneralParticleHandler.SpawnParticle(blastRing2); + } + + if (Projectile.timeLeft % 4 == 0) + { + Particle blastRing2 = new CustomPulse(Projectile.Center + new Vector2(95, 95).RotatedByRandom(100) * sizeBonus * Main.rand.NextFloat(0.7f, 1.1f), Vector2.Zero, mainColor, "CalamityMod/Particles/HighResHollowCircleHardEdge", Vector2.One, Main.rand.NextFloat(-10, 10), 0f, Main.rand.NextFloat(0.04f, 0.07f) * sizeBonus, 13); + GeneralParticleHandler.SpawnParticle(blastRing2); + } + } + Lighting.AddLight(Projectile.Center, mainColor.ToVector3() * 0.7f); + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + + Projectile.velocity *= 0.988f; + if (Projectile.timeLeft % 2 == 0) + { + if (!exploding && Main.rand.NextBool() || exploding) + { + Vector2 dustVel = new Vector2(4, 4).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 0.8f) * (exploding ? sizeBonus : 1); + Dust dust = Dust.NewDustPerfect(Projectile.Center + dustVel * (exploding ? 5 : 1), Main.rand.NextBool(4) ? 264 : 66, dustVel * (exploding ? 5 : 1), 0, default, Main.rand.NextFloat(0.9f, 1.2f) * (exploding ? 1.5f : 1)); + dust.noGravity = true; + dust.color = Main.rand.NextBool() ? Color.Lerp(mainColor, Color.White, 0.5f) : mainColor; + } + } + } + public override bool PreDraw(ref Color lightColor) + { + Texture2D texture = ModContent.Request("CalamityMod/Particles/Light").Value; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + Color drawColor = Projectile.GetAlpha(lightColor); + float drawRotation = Projectile.rotation; + Vector2 rotationPoint = texture.Size() * 0.5f; + + if (!exploding) + { + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], Color.Lerp(mainColor, Color.White, 0.5f) * 0.6f, 1); + Main.EntitySpriteDraw(texture, drawPosition, null, mainColor with { A = 0 }, drawRotation, rotationPoint, Projectile.scale, SpriteEffects.None); + Main.EntitySpriteDraw(texture, drawPosition, null, Color.White with { A = 0 }, drawRotation, rotationPoint, Projectile.scale, SpriteEffects.None); + + } + return false; + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + if (!exploding) + { + exploding = true; + } + if (Projectile.numHits > 0) + Projectile.damage = (int)(Projectile.damage * 0.80f); + if (Projectile.damage < 1) + Projectile.damage = 1; + } + public override void OnKill(int timeLeft) + { + for (int i = 0; i <= 5; i++) + { + //Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(4) ? 264 : 66, (Projectile.velocity.SafeNormalize(Vector2.UnitY) * 15f).RotatedByRandom(MathHelper.ToRadians(15f)) * Main.rand.NextFloat(0.1f, 0.8f), 0, default, Main.rand.NextFloat(1.2f, 1.6f)); + //dust.noGravity = true; + //dust.color = Main.rand.NextBool() ? Color.Lerp(mainColor, Color.White, 0.5f) : mainColor; + } + } + public override bool OnTileCollide(Vector2 oldVelocity) + { + Projectile.tileCollide = false; + exploding = true; + return false; + } + public override bool? CanDamage() => null; + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, exploding ? 120 * sizeBonus : 20 * sizeBonus, targetHitbox); + } +} diff --git a/Projectiles/Magic/WingmanHoldout.cs b/Projectiles/Magic/WingmanHoldout.cs new file mode 100644 index 0000000000..32fa2ba935 --- /dev/null +++ b/Projectiles/Magic/WingmanHoldout.cs @@ -0,0 +1,316 @@ +using System; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Particles; +using Humanizer; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Utilities; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using System.Collections.Generic; +using System.IO; +using CalamityMod.Graphics.Renderers; + +namespace CalamityMod.Projectiles.Magic +{ + public class WingmanHoldout : ModProjectile + { + public override LocalizedText DisplayName => CalamityUtils.GetItemName(); + public override string Texture => "CalamityMod/Items/Weapons/Magic/Wingman"; + + public Color StaticEffectsColor = Color.HotPink; + private ref float ShootingTimer => ref Projectile.ai[0]; + private float FiringTime = 40; + private float PostFireCooldown = 0; + private Vector2 MovementOffset; + public bool MovingUp = true; + public float xOffset = 1; + public float yOffset = 0; + public int time = 0; + public int firingDelay = 45; + + private ref float OffsetLength => ref Projectile.localAI[0]; + + private Player Owner; + + private float MaxOffsetLength = 5f; + + public bool recharging = false; + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 142; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.netImportant = true; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 9; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + Projectile.hide = true; + } + + public override void AI() + { + Lighting.AddLight(Projectile.Center, StaticEffectsColor.ToVector3() * 0.2f); + if (time == 0) + { + MovingUp = Projectile.ai[2] == 1 ? true : false; + } + firingDelay--; + Item heldItem = Owner.ActiveItem(); + + // Update damage based on curent magic damage stat (so Mana Sickness affects it) + Projectile.damage = heldItem is null ? 0 : Owner.GetWeaponDamage(heldItem); + + if (PostFireCooldown > 0) + { + PostFiringCooldown(); + } + + Vector2 tipPosition = Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.Zero).RotatedBy(-0.05f * Projectile.direction) * 12f; + // If there's no player, or the player is the server, or the owner's stunned, there'll be no holdout. + if (Owner.CantUseHoldout() || heldItem.type != ModContent.ItemType() ) + { + NetUpdate(); + if (PostFireCooldown <= 0) + Projectile.Kill(); + } + else if (PostFireCooldown <= 0 && (Owner.Calamity().mouseRight || (firingDelay <= 0 && Projectile.ai[2] == 1 || Projectile.ai[2] == -1))) + { + // If the player's pressing RMB, it'll shoot the grenade. + if (Owner.Calamity().mouseRight) + { + if ((Owner.CheckMana(Owner.ActiveItem(), (int)(heldItem.mana * Owner.manaCost) * 5, true, false))) + { + Shoot(heldItem, true); + PostFireCooldown = 35 + 55 * Utils.GetLerpValue(10, 40, FiringTime, true); + ShootingTimer = 0; + FiringTime = 40; + } + else + { + if (Projectile.soundDelay <= 0) + { + SoundEngine.PlaySound(SoundID.MaxMana with { Pitch = -0.5f }, Projectile.Center); + Projectile.soundDelay = 50; + } + ShootingTimer = 0; + } + } + else if (ShootingTimer >= FiringTime) + { + if (Owner.CheckMana(Owner.ActiveItem(), -1, true, false)) + { + Shoot(heldItem, false); + ShootingTimer = 0; + + if (FiringTime > 10) + FiringTime -= 5; + else + FiringTime = 10; + } + else + { + if (Projectile.soundDelay <= 0) + { + SoundEngine.PlaySound(SoundID.MaxMana with { Pitch = -0.5f }, Projectile.Center); + Projectile.soundDelay = 50; + } + ShootingTimer = 0; + } + + } + } + + // The center of the player, taking into account if they have a mount or not. + Vector2 ownerPosition = Owner.MountedCenter; + + // The vector between the player and the mouse. + Vector2 ownerToMouse = Owner.Calamity().mouseWorld - ownerPosition; + + // Deals with the holdout's rotation and direction, the owner's arms, etc. + ManageHoldout(ownerPosition, ownerToMouse); + + // When we change the distance of the gun from the arms for the recoil, + // recover to the original position smoothly. + if (OffsetLength != MaxOffsetLength) + OffsetLength = MathHelper.Lerp(OffsetLength, MaxOffsetLength, 0.1f); + + ShootingTimer++; + + // Inside here go all the things that dedicated servers shouldn't spend resources on. + // Like visuals and sounds. + if (Main.dedServ) + return; + + Vector2 shootDirection = Projectile.velocity.SafeNormalize(Vector2.Zero) * 20; + time++; + Projectile.soundDelay--; + } + + private void ManageHoldout(Vector2 mountedCenter, Vector2 ownerToMouse) + { + Vector2 rotationVector = Projectile.rotation.ToRotationVector2(); + float velocityRotation = Projectile.velocity.ToRotation(); + float proximityLookingUpwards = Vector2.Dot(ownerToMouse.SafeNormalize(Vector2.Zero), -Vector2.UnitY); + int direction = MathF.Sign(ownerToMouse.X); + + Vector2 armPosition = Owner.RotatedRelativePoint(mountedCenter, true); + Vector2 lengthOffset = rotationVector * OffsetLength; + Vector2 armOffset = new Vector2(Utils.Remap(proximityLookingUpwards, -1f, 1f, 0f, -12f) * direction, -10f + Utils.Remap(MathF.Abs(proximityLookingUpwards), 0f, 1f, 0f, proximityLookingUpwards > 0f ? 15f : 0f)); + + if (time % 40 == 0) + { + MovingUp = !MovingUp; + } + + //xOffset = MathHelper.Lerp(xOffset, placementOffset.X, 0.01f); + yOffset = MathHelper.Lerp(yOffset, 150 * (MovingUp ? -1 : 1), (0.085f - (FiringTime * 0.0012f))); + + Vector2 placementOffset = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(MathHelper.PiOver2) * (yOffset); + + Vector2 location = Owner.MountedCenter + placementOffset; + Projectile.Center = lengthOffset + location; + + + Projectile.velocity = velocityRotation.AngleTowards(ownerToMouse.ToRotation(), 0.2f).ToRotationVector2(); + Projectile.rotation = (Main.MouseWorld - Projectile.Center).SafeNormalize(Vector2.UnitX).ToRotation(); + Projectile.timeLeft = 2; + + Owner.heldProj = Projectile.whoAmI; + Owner.itemTime = Owner.itemAnimation = 2; + Owner.itemRotation = (Projectile.velocity * Projectile.direction).ToRotation(); + + Projectile.spriteDirection = Projectile.direction = direction; + Owner.ChangeDir(direction); + + float armRotation = (Projectile.rotation - MathHelper.PiOver2); // -Pi/2 because the arms rotation starts with arms pointing down. + if (Projectile.ai[2] == 1) + { + Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Quarter, armRotation); + } + else + { + Owner.SetCompositeArmBack(true, Player.CompositeArmStretchAmount.Full, armRotation); + } + } + + private void Shoot(Item item, bool isGrenade) + { + Vector2 shootDirection = (Main.MouseWorld - Projectile.Center).SafeNormalize(Vector2.UnitX); + + // The position of the tip of the gun. + Vector2 tipPosition = Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.Zero).RotatedBy(-0.05f * Projectile.direction) * 12f; + + // Spawns the projectile. + + Vector2 firingVelocity = shootDirection * 10; + if (isGrenade) + { + SoundStyle fire = new("CalamityMod/Sounds/Item/DeadSunExplosion"); + SoundEngine.PlaySound(fire with { Volume = 0.35f, Pitch = -0.4f, PitchVariance = 0.2f }, Projectile.Center); + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), tipPosition, (firingVelocity * 2) * Utils.GetLerpValue(60, 10, FiringTime, true), ModContent.ProjectileType(), (int)(Projectile.damage * 6), Projectile.knockBack * 5, Projectile.owner, 0); + } + else + { + SoundStyle fire = new("CalamityMod/Sounds/Item/MagnaCannonShot"); + SoundEngine.PlaySound(fire with { Volume = 0.25f, Pitch = 1f, PitchVariance = 0.35f }, Projectile.Center); + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), tipPosition, firingVelocity * Utils.GetLerpValue(80, 10, FiringTime, true), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0); + } + + NetUpdate(); + + // Inside here go all the things that dedicated servers shouldn't spend resources on. + // Like visuals and sounds. + if (Main.dedServ) + return; + + for (int k = 0; k < 6; k++) + { + Vector2 shootVel = (shootDirection * 10).RotatedByRandom(0.5f) * Main.rand.NextFloat(0.1f, 1.8f); + + Dust dust2 = Dust.NewDustPerfect(tipPosition, Main.rand.NextBool(4) ? 264 : 66, shootVel); + dust2.scale = Main.rand.NextFloat(1.15f, 1.45f); + dust2.noGravity = true; + dust2.color = Main.rand.NextBool() ? Color.Lerp(StaticEffectsColor, Color.White, 0.5f) : StaticEffectsColor; + } + Particle pulse = new GlowSparkParticle((tipPosition - shootDirection * 14), shootDirection * 20, false, Main.rand.Next(7, 11 + 1), 0.035f, StaticEffectsColor, new Vector2(1.5f, 0.9f), true); + GeneralParticleHandler.SpawnParticle(pulse); + + // By decreasing the offset length of the gun from the arms, we give an effect of recoil. + if (isGrenade) + OffsetLength -= 27f; + else + OffsetLength -= 5f; + } + private void PostFiringCooldown() + { + Vector2 tipPosition = Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.Zero).RotatedBy(-0.05f * Projectile.direction) * 12f; + + if (PostFireCooldown > 0 && Main.rand.NextBool()) + { + Vector2 smokeVel = new Vector2(0, -8) * Main.rand.NextFloat(0.1f, 1.1f); + Particle smoke = new HeavySmokeParticle(tipPosition, smokeVel, StaticEffectsColor, Main.rand.Next(30, 50 + 1), Main.rand.NextFloat(0.1f, 0.4f), 0.5f, Main.rand.NextFloat(-0.2f, 0.2f), Main.rand.NextBool(), required: true); + GeneralParticleHandler.SpawnParticle(smoke); + + Dust dust = Dust.NewDustPerfect(tipPosition, 303, smokeVel.RotatedByRandom(0.1f), 80, default, Main.rand.NextFloat(0.2f, 0.8f)); + dust.noGravity = false; + dust.color = StaticEffectsColor; + } + ShootingTimer = 0; + firingDelay = 45; + PostFireCooldown--; + } + + private void NetUpdate() + { + Projectile.netUpdate = true; + if (Projectile.netSpam >= 10) + Projectile.netSpam = 9; + } + + public override void OnSpawn(IEntitySource source) + { + Owner = Main.player[Projectile.owner]; + OffsetLength = MaxOffsetLength; + } + + // Because we use the velocity as a direction, we don't need it to change its position. + public override bool ShouldUpdatePosition() => false; + + public override bool? CanDamage() => false; + + public override bool PreDraw(ref Color lightColor) + { + if (time <= 0) + return false; + + Texture2D texture = ModContent.Request("CalamityMod/Items/Weapons/Magic/Wingman").Value; + + if (Projectile.ai[2] == 1) + texture = ModContent.Request("CalamityMod/Items/Weapons/Magic/Wingman").Value; + else + texture = ModContent.Request("CalamityMod/Items/Weapons/Magic/WingmanAlt").Value; + + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + Color drawColor = Projectile.GetAlpha(lightColor); + float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f); + Vector2 rotationPoint = texture.Size() * 0.5f; + SpriteEffects flipSprite = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + if (Projectile.spriteDirection == -1 ? MovingUp : !MovingUp) + flipSprite |= SpriteEffects.FlipVertically; + + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], Color.Lerp(StaticEffectsColor, Color.White, 0.5f) * 0.2f, 1, texture); + Main.EntitySpriteDraw(texture, drawPosition, null, drawColor, drawRotation, rotationPoint, Projectile.scale, flipSprite); + + return false; + } + public override void DrawBehind(int index, List behindNPCsAndTiles, List behindNPCs, List behindProjectiles, List overPlayers, List overWiresUI) + { + behindNPCs.Add(index); + } + } +} diff --git a/Projectiles/Magic/WingmanShot.cs b/Projectiles/Magic/WingmanShot.cs new file mode 100644 index 0000000000..d964fb366e --- /dev/null +++ b/Projectiles/Magic/WingmanShot.cs @@ -0,0 +1,104 @@ +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Magic +{ + public class WingmanShot : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Magic"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public int BounceHits = 0; + public Color mainColor = Color.White; + public int time = 0; + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 14; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + } + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 5; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.penetrate = 2; + Projectile.timeLeft = 240; + Projectile.DamageType = DamageClass.Magic; + Projectile.extraUpdates = 4; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + + public override void AI() + { + if (mainColor == Color.White) + { + if (Projectile.ai[1] == 0) + mainColor = Color.HotPink; + if (Projectile.ai[1] == 1) + mainColor = Color.MediumSlateBlue; + if (Projectile.ai[1] == 2) + { + mainColor = Color.MediumVioletRed; + Projectile.scale = 1.25f; + Projectile.extraUpdates = 5; + Projectile.penetrate = 3; + } + + } + + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + //Dust dust = Dust.NewDustPerfect(Projectile.Center, 107); // + Main.rand.NextVector2Circular(-3, 3) + //dust.noGravity = true; + //dust.scale = 0.5f; + if (time < 180) + Projectile.velocity *= 0.995f; + if (time % 2 == 0 && Projectile.timeLeft > 15) + { + SparkParticle spark = new SparkParticle(Projectile.Center - Projectile.velocity.SafeNormalize(Vector2.UnitY) * 3.5f, Projectile.velocity * 0.01f, false, 5, 1f * Projectile.scale, mainColor * 0.4f); + GeneralParticleHandler.SpawnParticle(spark); + } + time++; + } + public override bool PreDraw(ref Color lightColor) + { + if (time == 0) + return false; + Texture2D texture = ModContent.Request("CalamityMod/Particles/GlowSpark").Value; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + Color drawColor = Projectile.GetAlpha(lightColor); + float drawRotation = Projectile.rotation; + Vector2 rotationPoint = texture.Size() * 0.5f; + + //CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], Color.Lerp(Color.Cyan, Color.White, 0.7f) * 0.6f, 1); + Main.EntitySpriteDraw(texture, drawPosition, null, mainColor with { A = 0 }, drawRotation, rotationPoint, new Vector2(0.5f, 1.4f) * 0.025f * Projectile.scale, SpriteEffects.None); + Main.EntitySpriteDraw(texture, drawPosition, null, Color.White with { A = 0 }, drawRotation, rotationPoint, new Vector2(0.5f, 1.4f) * 0.02f * Projectile.scale, SpriteEffects.None); + return false; + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + if (Projectile.ai[1] != 2) + { + if (Projectile.numHits > 0) + Projectile.damage = (int)(Projectile.damage * 0.9f); + if (Projectile.damage < 1) + Projectile.damage = 1; + } + } + public override void OnKill(int timeLeft) + { + for (int i = 0; i <= 2; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(4) ? 264 : 66, (Projectile.velocity.SafeNormalize(Vector2.UnitY) * 15f).RotatedByRandom(MathHelper.ToRadians(15f)) * Main.rand.NextFloat(0.1f, 0.8f), 0, default, Main.rand.NextFloat(1.2f, 1.6f)); + dust.noGravity = true; + dust.color = Main.rand.NextBool() ? Color.Lerp(mainColor, Color.White, 0.5f) : mainColor; + dust.noLightEmittence = true; + dust.noLight = true; + } + } + } +} diff --git a/Projectiles/Magic/WulfrumBolt.cs b/Projectiles/Magic/WulfrumBolt.cs index cfc61cf935..fcc64df360 100644 --- a/Projectiles/Magic/WulfrumBolt.cs +++ b/Projectiles/Magic/WulfrumBolt.cs @@ -1,5 +1,7 @@ using System; +using CalamityMod.Graphics.Primitives; using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -8,8 +10,6 @@ using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; -using CalamityMod.Particles; -using CalamityMod.Graphics.Primitives; namespace CalamityMod.Projectiles.Magic { diff --git a/Projectiles/Magic/WulfrumManaDrain.cs b/Projectiles/Magic/WulfrumManaDrain.cs index 91f819ab36..258f09e141 100644 --- a/Projectiles/Magic/WulfrumManaDrain.cs +++ b/Projectiles/Magic/WulfrumManaDrain.cs @@ -46,7 +46,7 @@ namespace CalamityMod.Projectiles.Magic if (!SoundEngine.TryGetActiveSound(SuccSoundSlot, out var idleSoundOut) || !idleSoundOut.IsPlaying) { - SuccSoundSlot = SoundEngine.PlaySound(WulfrumProsthesis.SuckSound with { Volume = WulfrumProsthesis.SuckSound.Volume * 0.01f ,IsLooped = true }, Owner.Center); + SuccSoundSlot = SoundEngine.PlaySound(WulfrumProsthesis.SuckSound with { Volume = WulfrumProsthesis.SuckSound.Volume * 0.01f, IsLooped = true }, Owner.Center); } @@ -55,7 +55,7 @@ namespace CalamityMod.Projectiles.Magic idleSoundOut.Position = Owner.Center; idleSoundOut.Volume = Math.Clamp((Timer / 30f) + 0.001f, 0f, 1f) * 100f; } - + Projectile.timeLeft = 2; Projectile.Center = Owner.MountedCenter; @@ -147,7 +147,7 @@ namespace CalamityMod.Projectiles.Magic { soundOut.Stop(); - SoundEngine.PlaySound(WulfrumProsthesis.SuckStopSound with { Volume = WulfrumProsthesis.SuckStopSound.Volume * Timer / 30f}, Projectile.Center); + SoundEngine.PlaySound(WulfrumProsthesis.SuckStopSound with { Volume = WulfrumProsthesis.SuckStopSound.Volume * Timer / 30f }, Projectile.Center); } } diff --git a/Projectiles/Magic/WyvernFeatherGreen.cs b/Projectiles/Magic/WyvernFeatherGreen.cs index bfc5d20753..77753bde0f 100644 --- a/Projectiles/Magic/WyvernFeatherGreen.cs +++ b/Projectiles/Magic/WyvernFeatherGreen.cs @@ -1,8 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -31,13 +31,13 @@ namespace CalamityMod.Projectiles.Magic { if (Main.rand.NextBool(6)) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 61, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.GreenTorch, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } } public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item14, Projectile.position); + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); Projectile.width = 50; @@ -48,7 +48,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.localNPCHitCooldown = 10; for (int i = 0; i < 15; i++) { - int greenDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 61, 0f, 0f, 100, default, 1.2f); + int greenDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GreenTorch, 0f, 0f, 100, default, 1.2f); Main.dust[greenDust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -58,10 +58,10 @@ namespace CalamityMod.Projectiles.Magic } for (int j = 0; j < 30; j++) { - int greenDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 61, 0f, 0f, 100, default, 1.7f); + int greenDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GreenTorch, 0f, 0f, 100, default, 1.7f); Main.dust[greenDust2].noGravity = true; Main.dust[greenDust2].velocity *= 5f; - greenDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 61, 0f, 0f, 100, default, 1f); + greenDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GreenTorch, 0f, 0f, 100, default, 1f); Main.dust[greenDust2].velocity *= 2f; } } diff --git a/Projectiles/Magic/WyvernFeatherPink.cs b/Projectiles/Magic/WyvernFeatherPink.cs index bf713571f4..0603088547 100644 --- a/Projectiles/Magic/WyvernFeatherPink.cs +++ b/Projectiles/Magic/WyvernFeatherPink.cs @@ -1,8 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -31,13 +31,13 @@ namespace CalamityMod.Projectiles.Magic { if (Main.rand.NextBool(3)) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 242, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.PinkTorch, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } } public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item14, Projectile.position); + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); Projectile.width = 50; @@ -48,7 +48,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.localNPCHitCooldown = 10; for (int i = 0; i < 15; i++) { - int pinkDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 242, 0f, 0f, 100, default, 1.2f); + int pinkDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.PinkTorch, 0f, 0f, 100, default, 1.2f); Main.dust[pinkDust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -58,10 +58,10 @@ namespace CalamityMod.Projectiles.Magic } for (int j = 0; j < 30; j++) { - int pinkDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 242, 0f, 0f, 100, default, 1.7f); + int pinkDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.PinkTorch, 0f, 0f, 100, default, 1.7f); Main.dust[pinkDust2].noGravity = true; Main.dust[pinkDust2].velocity *= 5f; - pinkDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 242, 0f, 0f, 100, default, 1f); + pinkDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.PinkTorch, 0f, 0f, 100, default, 1f); Main.dust[pinkDust2].velocity *= 2f; } } diff --git a/Projectiles/Magic/WyvernFeatherPurple.cs b/Projectiles/Magic/WyvernFeatherPurple.cs index d0ac60594d..11dab5c10b 100644 --- a/Projectiles/Magic/WyvernFeatherPurple.cs +++ b/Projectiles/Magic/WyvernFeatherPurple.cs @@ -1,8 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -31,13 +31,13 @@ namespace CalamityMod.Projectiles.Magic { if (Main.rand.NextBool(3)) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 173, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } } public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item14, Projectile.position); + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); Projectile.width = 50; @@ -48,7 +48,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.localNPCHitCooldown = 10; for (int i = 0; i < 15; i++) { - int purpleDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 1.2f); + int purpleDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, 0f, 0f, 100, default, 1.2f); Main.dust[purpleDust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -58,10 +58,10 @@ namespace CalamityMod.Projectiles.Magic } for (int j = 0; j < 30; j++) { - int purpleDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 1.7f); + int purpleDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, 0f, 0f, 100, default, 1.7f); Main.dust[purpleDust2].noGravity = true; Main.dust[purpleDust2].velocity *= 5f; - purpleDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 1f); + purpleDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, 0f, 0f, 100, default, 1f); Main.dust[purpleDust2].velocity *= 2f; } } diff --git a/Projectiles/Magic/WyvernProjectile.cs b/Projectiles/Magic/WyvernProjectile.cs index 5565bb9e19..97a304fa72 100644 --- a/Projectiles/Magic/WyvernProjectile.cs +++ b/Projectiles/Magic/WyvernProjectile.cs @@ -1,9 +1,9 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -23,9 +23,9 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - if (Main.rand.Next(5) == 0) + if (Main.rand.NextBool(5)) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 16, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Cloud, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } } @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.Magic SoundEngine.PlaySound(SoundID.NPCHit7, Projectile.Center); for (int i = 0; i <= 10; i++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 16, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Cloud, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } if (Main.netMode != NetmodeID.Server) { @@ -58,7 +58,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } diff --git a/Projectiles/Magic/YharimsCrystalBeam.cs b/Projectiles/Magic/YharimsCrystalBeam.cs index 7c34e3c309..9f3bf8f341 100644 --- a/Projectiles/Magic/YharimsCrystalBeam.cs +++ b/Projectiles/Magic/YharimsCrystalBeam.cs @@ -1,8 +1,8 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using System.IO; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; using Terraria; using Terraria.Enums; using Terraria.GameContent.Shaders; @@ -148,7 +148,7 @@ namespace CalamityMod.Projectiles.Magic // If the host crystal is fully charged, the interpolation starts at the host crystal's center instead. // Overriding that, if the player shoves the crystal into or through a wall, the interpolation starts at the player's center. Vector2 samplingPoint = Projectile.Center; - if(hostCrystal.ai[0] >= YharimsCrystalPrism.MaxCharge) + if (hostCrystal.ai[0] >= YharimsCrystalPrism.MaxCharge) samplingPoint = hostCrystal.Center; if (!Collision.CanHitLine(Main.player[Projectile.owner].Center, 0, 0, hostCrystal.Center, 0, 0)) samplingPoint = Main.player[Projectile.owner].Center; @@ -221,7 +221,7 @@ namespace CalamityMod.Projectiles.Magic if (Projectile.velocity == Vector2.Zero) return false; - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; float beamLength = Projectile.localAI[1]; Vector2 centerFloored = Projectile.Center.Floor() + Projectile.velocity * Projectile.scale * BeamRenderTileOffset; Vector2 scaleVec = new Vector2(Projectile.scale); @@ -258,7 +258,7 @@ namespace CalamityMod.Projectiles.Magic float dustAngle = Projectile.rotation + (Main.rand.NextBool() ? 1f : -1f) * MathHelper.PiOver2; float dustStartDist = Main.rand.NextFloat(1f, 1.8f); Vector2 dustVel = dustAngle.ToRotationVector2() * dustStartDist; - int d = Dust.NewDust(laserEndPos, 0, 0, 244, dustVel.X, dustVel.Y, 0, beamColor, 3.3f); + int d = Dust.NewDust(laserEndPos, 0, 0, DustID.CopperCoin, dustVel.X, dustVel.Y, 0, beamColor, 3.3f); Main.dust[d].color = beamColor; Main.dust[d].noGravity = true; Main.dust[d].scale = 1.2f; diff --git a/Projectiles/Magic/YharimsCrystalPrism.cs b/Projectiles/Magic/YharimsCrystalPrism.cs index 63521620f7..d1b1673700 100644 --- a/Projectiles/Magic/YharimsCrystalPrism.cs +++ b/Projectiles/Magic/YharimsCrystalPrism.cs @@ -1,9 +1,9 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -66,7 +66,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.soundDelay = SoundInterval; // Don't play the continuous beam sound the first time around if (Projectile.ai[0] > 1f) - SoundEngine.PlaySound(SoundID.Item15, Projectile.position); + SoundEngine.PlaySound(SoundID.Item15, Projectile.Center); } // Once the crystal reaches a certain charge, start producing dust. More charge = more dust. @@ -84,7 +84,7 @@ namespace CalamityMod.Projectiles.Magic // CheckMana returns true if the mana cost can be paid. If mana isn't consumed this frame, the CheckMana short-circuits out of being evaluated. bool allowContinuedUse = !ShouldConsumeMana() || player.CheckMana(player.ActiveItem(), -1, true, false); - bool crystalStillInUse = player.channel && allowContinuedUse && !player.noItems && !player.CCed; + bool crystalStillInUse = !player.CantUseHoldout() && allowContinuedUse; // The beams are only projected once (on frame 1). if (crystalStillInUse && Projectile.ai[0] == 1f) @@ -116,7 +116,7 @@ namespace CalamityMod.Projectiles.Magic return true; } bool consume = Projectile.ai[0] == Projectile.ai[1]; - if(consume) + if (consume) { Projectile.localAI[0] = MathHelper.Clamp(Projectile.localAI[0] - 1f, MinManaConsumptionDelay, MaxManaConsumptionDelay); Projectile.ai[1] += Projectile.localAI[0]; @@ -176,8 +176,8 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { SpriteEffects eff = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Texture2D tex = ModContent.Request(Texture).Value; - int frameHeight = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + int frameHeight = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; int texYOffset = frameHeight * Projectile.frame; Vector2 sheetInsertVec = (Projectile.Center + Vector2.UnitY * Projectile.gfxOffY - Main.screenPosition).Floor(); Main.spriteBatch.Draw(tex, sheetInsertVec, new Rectangle?(new Rectangle(0, texYOffset, tex.Width, frameHeight)), Color.White, Projectile.rotation, new Vector2(tex.Width / 2f, frameHeight / 2f), Projectile.scale, eff, 0f); diff --git a/Projectiles/Melee/AbyssBladeProjectile.cs b/Projectiles/Melee/AbyssBladeProjectile.cs new file mode 100644 index 0000000000..37e8ba9665 --- /dev/null +++ b/Projectiles/Melee/AbyssBladeProjectile.cs @@ -0,0 +1,249 @@ +using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Ranged; +using Humanizer; +using Microsoft.CodeAnalysis; +using Microsoft.Xna.Framework; +using ReLogic.Utilities; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; +using static CalamityMod.CalamityUtils; + +namespace CalamityMod.Projectiles.Melee +{ + public class AbyssBladeProjectile : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + public override string Texture => "CalamityMod/Items/Weapons/Melee/AbyssBlade"; + + public int Time = 0; + public int ChargeupTime = 25; + public int Lifetime = 300; + public int startDamage; + public bool setDamage = false; + public int dustType1 = 104; + public int dustType2 = 29; + public bool spinMode = true; + public Vector2 NPCDestination = new Vector2(0, 0); + public float OverallProgress => 1 - Projectile.timeLeft / (float)Lifetime; + public float ThrowProgress => 1 - Projectile.timeLeft / (float)(Lifetime); + public float ChargeProgress => 1 - (Projectile.timeLeft - Lifetime) / (float)(ChargeupTime); + + public Player Owner => Main.player[Projectile.owner]; + public SlotId SpinSoundSlot; + + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + } + + public override void SetDefaults() + { + Projectile.width = 80; + Projectile.height = 80; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = Lifetime + ChargeupTime; + Projectile.DamageType = DamageClass.Melee; + Projectile.ignoreWater = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 15; + } + + public override bool ShouldUpdatePosition() + { + return ChargeProgress >= 1; + } + + public override bool? CanDamage() + { + //We don't want the anticipation to deal damage. + if (ChargeProgress < 1) + return false; + + return base.CanDamage(); + } + + //Swing animation keys + public CurveSegment pullback = new CurveSegment(EasingType.PolyOut, 0f, 0f, MathHelper.PiOver4 * -1.2f, 2); + public CurveSegment throwout = new CurveSegment(EasingType.PolyOut, 0.7f, MathHelper.PiOver4 * -1.2f, MathHelper.PiOver4 * 1.2f + MathHelper.PiOver2, 3); + internal float ArmAnticipationMovement() => PiecewiseAnimation(ChargeProgress, new CurveSegment[] { pullback, throwout }); + + public override void AI() + { + if (SoundEngine.TryGetActiveSound(SpinSoundSlot, out var SpinSound) && SpinSound.IsPlaying) + SpinSound.Position = Projectile.Center; + + float playerDist = Vector2.Distance(Owner.Center, Projectile.Center); + + Time++; + Projectile.spriteDirection = Projectile.direction; + Vector3 Light = new Vector3(0.070f, 0.070f, 0.250f); + Lighting.AddLight(Projectile.Center, Light * 3); + + //Anticipation animation. Make the player look like theyre holding the depth crusher + if (ChargeProgress < 1) + { + Owner.ChangeDir(MathF.Sign(Main.MouseWorld.X - Owner.Center.X)); + + float armRotation = ArmAnticipationMovement() * Owner.direction; + + Owner.heldProj = Projectile.whoAmI; + Projectile.spriteDirection = Owner.direction; + Projectile.direction = Owner.direction; + + Projectile.Center = Owner.MountedCenter + Vector2.UnitY.RotatedBy(armRotation * Owner.gravDir) * -55f * Owner.gravDir; + Projectile.rotation = (-MathHelper.PiOver4 * Projectile.direction + armRotation) * Owner.gravDir; + + Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, MathHelper.Pi + armRotation); + + return; + } + + //Play the throw sound when the throw ACTUALLY BEGINS. + //Additionally, make the projectile collide and set its speed and velocity + if (Projectile.timeLeft == Lifetime) + { + Projectile.netUpdate = true; + SoundEngine.PlaySound(SoundID.Item1, Projectile.Center); + Projectile.Center = Owner.MountedCenter + Projectile.velocity * 12f; + Projectile.velocity = (Main.MouseWorld - Owner.Center).SafeNormalize(Vector2.UnitX * Owner.direction) * 20; + startDamage = Projectile.damage; + Projectile.spriteDirection = Projectile.direction; + SpinSoundSlot = SoundEngine.PlaySound(AbyssBlade.SpinSound, Projectile.Center); + Time = 0; + } + + if (Projectile.velocity.X > 0) + Projectile.direction = 1; + else + Projectile.direction = -1; + + if (spinMode) + { + Projectile.rotation += (0.9f * (MathF.Abs(Projectile.velocity.Y) * 0.03f + 0.85f)) * Projectile.direction; + Projectile.spriteDirection = Projectile.direction; + + if (Projectile.velocity.Y < 25) + Projectile.velocity.Y += 0.42f; + + if (Projectile.velocity.Y > 0) + Projectile.velocity.X *= 0.975f; + + Vector2 particlePosition = Projectile.Center + new Vector2(13.5f * Projectile.direction, 0) + Projectile.velocity * 0.5f; + if (Time % 3 == 0) + { + Particle Smear = new CircularSmearVFX(particlePosition, Color.DeepSkyBlue * Main.rand.NextFloat(0.78f, 0.85f), Main.rand.NextFloat(-8, 8), Main.rand.NextFloat(0.8f, 0.9f)); + GeneralParticleHandler.SpawnParticle(Smear); + } + for (int i = 0; i < 2; i++) + { + Vector2 dustPos = Projectile.Center + (i * MathHelper.Pi + Projectile.rotation + MathHelper.PiOver2).ToRotationVector2() * 40f; + Dust dust = Dust.NewDustPerfect(dustPos, Main.rand.NextBool(3) ? dustType1 : dustType2, (i * MathHelper.Pi + Projectile.rotation * Math.Sign(Projectile.velocity.X)).ToRotationVector2() * 3f); + dust.noGravity = true; + dust.scale = 1.8f; + } + + if (Collision.SolidCollision(Projectile.Center, 10, 10) && Time >= 2) + { + Projectile.extraUpdates = 2; + Projectile.rotation = 0; + spinMode = false; + SoundEngine.PlaySound(new("CalamityMod/Sounds/Custom/CeramicImpact", 2) { Volume = 0.65f, PitchVariance = 0.3f }, Projectile.Center); + for (int i = 0; i < 3; i++) + { + GenericSparkle sparker = new GenericSparkle(Projectile.Center, Vector2.Zero, Color.DodgerBlue, Color.MediumBlue, Main.rand.NextFloat(2.5f, 2.9f) - i * 0.55f, 14, Main.rand.NextFloat(-0.01f, 0.01f), 2.5f); + GeneralParticleHandler.SpawnParticle(sparker); + } + Projectile.penetrate = 1; + Projectile.damage = (int)(startDamage * 2); // Launched blade deals 200% damage + Time = 0; + + bool foundTarget = false; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].CanBeChasedBy(Projectile.GetSource_FromThis(), false)) + NPCDestination = Main.npc[i].Center + Main.npc[i].velocity * 5f; + + if (NPCDestination == new Vector2(0, 0)) + foundTarget = false; + else + foundTarget = true; + } + + if (!foundTarget) + { + Projectile.velocity = (-Projectile.velocity).SafeNormalize(Vector2.UnitX * Projectile.direction) * 25; + } + else + { + Projectile.velocity = (NPCDestination - Projectile.Center).SafeNormalize(Vector2.UnitX * Projectile.direction) * 25; + } + + for (int i = 0; i < 6; i++) + { + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, ((Projectile.velocity).SafeNormalize(Vector2.UnitX * Projectile.direction) * 5).RotatedByRandom(0.75f) * Main.rand.NextFloat(1.4f, 2.2f), ModContent.ProjectileType(), (int)(startDamage * 0.3), Projectile.knockBack / 4, Projectile.owner); + } + } + } + else + { + SpinSound?.Stop(); + + Projectile.rotation = (Projectile.velocity.ToRotation() + MathHelper.PiOver4 * (Projectile.direction == 1 ? 1 : 3)); + + if (Time > 9) + { + for (int i = 0; i < 6; i++) + { + Vector2 dustPos = Projectile.Center - Projectile.velocity * 3 + Main.rand.NextVector2Circular(15, 15); + Dust dust = Dust.NewDustPerfect(dustPos, Main.rand.NextBool(3) ? dustType2 : dustType1); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(1.3f, 1.6f); + dust.velocity = -Projectile.velocity * Main.rand.NextFloat(0.05f, 0.7f); + } + } + } + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 180); + SoundStyle HitSound = new("CalamityMod/Sounds/Custom/AbyssGravelMine2") { Volume = 0.7f, PitchVariance = 0.3f }; + if (!spinMode) + { + SoundEngine.PlaySound(HitSound, Projectile.Center); + for (int i = 0; i < 30; i++) + { + Vector2 dustPos = Projectile.Center; + Dust dust = Dust.NewDustPerfect(dustPos, Main.rand.NextBool(3) ? dustType1 : dustType2); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(1.1f, 1.8f); + dust.velocity = new Vector2(3, 3).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 1.7f); + } + } + } + + public override void OnKill(int timeLeft) + { + if (SoundEngine.TryGetActiveSound(SpinSoundSlot, out var SpinSound)) + SpinSound?.Stop(); + + for (int i = 0; i < 40; i++) + { + float dustMulti = Main.rand.NextFloat(0.3f, 1.5f); + Vector2 dustPos = Projectile.Center; + Dust dust = Dust.NewDustPerfect(dustPos, Main.rand.NextBool(3) ? dustType1 : dustType2); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(1.6f, 2.5f) - dustMulti; + dust.velocity = new Vector2(5, 5).RotatedByRandom(100) * Main.rand.NextFloat(0.3f, 1f) * dustMulti; + } + } + } +} diff --git a/Projectiles/Melee/AbyssBladeSplitProjectile.cs b/Projectiles/Melee/AbyssBladeSplitProjectile.cs new file mode 100644 index 0000000000..bd533f5fbe --- /dev/null +++ b/Projectiles/Melee/AbyssBladeSplitProjectile.cs @@ -0,0 +1,77 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.NPCs.SupremeCalamitas; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Healing; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Audio; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Melee +{ + public class AbyssBladeSplitProjectile : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public int Time = 0; + public int randTimer; + public int dustType1 = 104; + public int dustType2 = 29; + public override void SetDefaults() + { + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.tileCollide = false; + Projectile.penetrate = 1; + Projectile.timeLeft = 240; + Projectile.ignoreWater = true; + } + + public override void AI() + { + Time++; + if (Time == 1) + { + randTimer = Main.rand.Next(240, 301); + Projectile.timeLeft = randTimer; + } + if (Time > 20 && Time < (randTimer - 70)) + { + CalamityUtils.HomeInOnNPC(Projectile, true, 350f, MathHelper.Clamp(1f + Time * 0.075f, 1, 10), 20f); + } + else if (Time >= (randTimer - 70)) + { + if (Projectile.velocity.Y < 10) + Projectile.velocity.Y += 0.4f; + Projectile.velocity.X *= 0.97f; + } + if (Time % 2 == 0) + { + Color smokeColor = Color.MediumBlue; + Particle smoke = new HeavySmokeParticle(Projectile.Center, Projectile.velocity * Main.rand.NextFloat(-0.2f, -0.6f), smokeColor, 30, Main.rand.NextFloat(0.45f, 0.6f), 0.3f, Main.rand.NextFloat(-0.2f, 0.2f), false, required: true); + GeneralParticleHandler.SpawnParticle(smoke); + } + for (int i = 0; i < 3; i++) + { + Vector2 dustPos = Projectile.Center; + int dustType = Main.rand.NextBool(3) ? dustType1 : dustType2; + Dust dust = Dust.NewDustPerfect(dustPos, dustType); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.95f, 1.7f); + dust.velocity = new Vector2(0.5f, 0.5f).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1.1f); + } + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 120); + + SoundEngine.PlaySound(SoundID.ShimmerWeak1 with { Pitch = 0.35f }, Projectile.Center); + } + } +} diff --git a/Projectiles/Melee/AegisBeam.cs b/Projectiles/Melee/AegisBeam.cs index bd40232028..ac9281d0db 100644 --- a/Projectiles/Melee/AegisBeam.cs +++ b/Projectiles/Melee/AegisBeam.cs @@ -1,9 +1,9 @@ +using System; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -35,7 +35,7 @@ namespace CalamityMod.Projectiles.Melee SoundEngine.PlaySound(SoundID.Item73, Projectile.position); Projectile.localAI[0] += 1f; } - int goldDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 246, 0f, 0f, 100, new Color(255, Main.DiscoG, 53), 0.8f); + int goldDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GoldCoin, 0f, 0f, 100, new Color(255, Main.DiscoG, 53), 0.8f); Main.dust[goldDust].noGravity = true; Main.dust[goldDust].velocity *= 0.5f; Main.dust[goldDust].velocity += Projectile.velocity * 0.1f; @@ -62,7 +62,7 @@ namespace CalamityMod.Projectiles.Melee randoAdjuster = speed / randoAdjuster; rando *= randoAdjuster; rando2 *= randoAdjuster; - int deathDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 246, 0f, 0f, 100, new Color(255, Main.DiscoG, 53), 1.2f); + int deathDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GoldCoin, 0f, 0f, 100, new Color(255, Main.DiscoG, 53), 1.2f); Dust dust = Main.dust[deathDust]; dust.noGravity = true; dust.position.X = Projectile.Center.X; diff --git a/Projectiles/Melee/AegisBlast.cs b/Projectiles/Melee/AegisBlast.cs index 623d48f4b4..21b5584084 100644 --- a/Projectiles/Melee/AegisBlast.cs +++ b/Projectiles/Melee/AegisBlast.cs @@ -1,9 +1,9 @@ +using System; using Microsoft.Xna.Framework; -using System; using Terraria; -using Terraria.ModLoader; -using Terraria.ID; using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { @@ -20,10 +20,10 @@ namespace CalamityMod.Projectiles.Melee Projectile.ignoreWater = false; Projectile.tileCollide = false; Projectile.penetrate = -1; - Projectile.timeLeft = 60; - Projectile.DamageType = DamageClass.Melee; + Projectile.timeLeft = 40; + Projectile.DamageType = TrueMeleeDamageClass.Instance; Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 10; + Projectile.idStaticNPCHitCooldown = 20; } public override void AI() @@ -78,7 +78,7 @@ namespace CalamityMod.Projectiles.Melee randoAdjuster = rando3 / randoAdjuster; rando1 *= randoAdjuster; rando2 *= randoAdjuster; - int goldDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 246, 0f, 0f, 100, new Color(255, Main.DiscoG, 53), 1.5f); + int goldDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GoldCoin, 0f, 0f, 100, new Color(255, Main.DiscoG, 53), 1.5f); Main.dust[goldDust].noGravity = true; Main.dust[goldDust].position.X = Projectile.Center.X; Main.dust[goldDust].position.Y = Projectile.Center.Y; diff --git a/Projectiles/Melee/AegisBlast2.cs b/Projectiles/Melee/AegisBlast2.cs index 14462ca888..b35cb4ca2a 100644 --- a/Projectiles/Melee/AegisBlast2.cs +++ b/Projectiles/Melee/AegisBlast2.cs @@ -1,7 +1,9 @@ +using System; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Melee { public class AegisBlast2 : ModProjectile, ILocalizedModType @@ -70,7 +72,7 @@ namespace CalamityMod.Projectiles.Melee randoAdjuster = rando3 / randoAdjuster; rando1 *= randoAdjuster; rando2 *= randoAdjuster; - int goldDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 246, 0f, 0f, 100, new Color(255, Main.DiscoG, 53), 1.5f); + int goldDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GoldCoin, 0f, 0f, 100, new Color(255, Main.DiscoG, 53), 1.5f); Main.dust[goldDust].noGravity = true; Main.dust[goldDust].position.X = Projectile.Center.X; Main.dust[goldDust].position.Y = Projectile.Center.Y; diff --git a/Projectiles/Melee/AegisFlame.cs b/Projectiles/Melee/AegisFlame.cs index f5c7d0dddd..a834bf8f78 100644 --- a/Projectiles/Melee/AegisFlame.cs +++ b/Projectiles/Melee/AegisFlame.cs @@ -1,6 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Melee { public class AegisFlame : ModProjectile, ILocalizedModType @@ -48,7 +50,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.velocity.Y = Projectile.velocity.Y + 0.2f; } Projectile.rotation += Projectile.velocity.X * 0.1f; - int goldFlameDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 246, 0f, 0f, 100, new Color(255, Main.DiscoG, 53), 1f); + int goldFlameDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GoldCoin, 0f, 0f, 100, new Color(255, Main.DiscoG, 53), 1f); Dust expr_8976_cp_0 = Main.dust[goldFlameDust]; expr_8976_cp_0.position.X -= 2f; Dust expr_8994_cp_0 = Main.dust[goldFlameDust]; @@ -59,7 +61,7 @@ namespace CalamityMod.Projectiles.Melee expr_89E7_cp_0.velocity.Y -= 2f; if (Main.rand.NextBool()) { - int goldFlameDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 246, 0f, 0f, 100, new Color(255, Main.DiscoG, 53), 1f); + int goldFlameDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GoldCoin, 0f, 0f, 100, new Color(255, Main.DiscoG, 53), 1f); Dust expr_8A4E_cp_0 = Main.dust[goldFlameDust2]; expr_8A4E_cp_0.position.X -= 2f; Dust expr_8A6C_cp_0 = Main.dust[goldFlameDust2]; diff --git a/Projectiles/Melee/AftershockRock.cs b/Projectiles/Melee/AftershockRock.cs index 900653dc14..8686851e54 100644 --- a/Projectiles/Melee/AftershockRock.cs +++ b/Projectiles/Melee/AftershockRock.cs @@ -1,23 +1,35 @@ -using Terraria.ID; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Melee { public class AftershockRock : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; + public override void SetDefaults() { - Projectile.width = 32; - Projectile.height = 34; + Projectile.width = 38; + Projectile.height = 38; Projectile.aiStyle = ProjAIStyleID.GroundProjectile; Projectile.friendly = true; - Projectile.penetrate = 6; - Projectile.extraUpdates = 1; + Projectile.penetrate = 3; + Projectile.MaxUpdates = 3; Projectile.DamageType = DamageClass.Melee; + Projectile.timeLeft = 300 * Projectile.MaxUpdates; Projectile.ignoreWater = true; AIType = ProjectileID.BoulderStaffOfEarth; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; + Projectile.localNPCHitCooldown = 10 * Projectile.MaxUpdates; + Projectile.tileCollide = false; + } + + public override void AI() + { + if (Projectile.Center.Y > Projectile.ai[2]) + Projectile.tileCollide = true; + else + Projectile.tileCollide = false; } } } diff --git a/Projectiles/Melee/AmidiasWhirlpool.cs b/Projectiles/Melee/AmidiasWhirlpool.cs index 1d14113510..b0277b9fcd 100644 --- a/Projectiles/Melee/AmidiasWhirlpool.cs +++ b/Projectiles/Melee/AmidiasWhirlpool.cs @@ -1,9 +1,9 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -36,7 +36,7 @@ namespace CalamityMod.Projectiles.Melee float shortXVel = Projectile.velocity.X / 3f * (float)i; float shortYVel = Projectile.velocity.Y / 3f * (float)i; int fourConst = 4; - int waterDust = Dust.NewDust(new Vector2(Projectile.position.X + (float)fourConst, Projectile.position.Y + (float)fourConst), Projectile.width - fourConst * 2, Projectile.height - fourConst * 2, 33, 0f, 0f, 0, new Color(0, 142, 255), 1.5f); + int waterDust = Dust.NewDust(new Vector2(Projectile.position.X + (float)fourConst, Projectile.position.Y + (float)fourConst), Projectile.width - fourConst * 2, Projectile.height - fourConst * 2, DustID.Water, 0f, 0f, 0, new Color(0, 142, 255), 1.5f); Dust dust = Main.dust[waterDust]; dust.noGravity = true; dust.velocity *= 0.1f; @@ -52,7 +52,7 @@ namespace CalamityMod.Projectiles.Melee } if (homeTracker == 0) { - Projectile.rotation -= 0.104719758f; + Projectile.rotation -= MathHelper.Pi / 30f; if (Projectile.ai[0] >= 30f) { @@ -69,7 +69,7 @@ namespace CalamityMod.Projectiles.Melee else if (homeTracker == 1) { int inc; - Projectile.rotation -= 0.104719758f; + Projectile.rotation -= MathHelper.Pi / 30f; Vector2 projCenter = Projectile.Center; float homingRange = 150f; bool isHoming = false; @@ -118,7 +118,7 @@ namespace CalamityMod.Projectiles.Melee if (isHoming) { int waterDust0 = 10; - Vector2 dustDirection = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); + Vector2 dustDirection = Projectile.Center; float waterDust1 = projCenter.X - dustDirection.X; float waterDust2 = projCenter.Y - dustDirection.Y; float waterDust3 = (float)Math.Sqrt((double)(waterDust1 * waterDust1 + waterDust2 * waterDust2)); @@ -146,7 +146,7 @@ namespace CalamityMod.Projectiles.Melee SoundEngine.PlaySound(SoundID.Item10, Projectile.position); for (int k = 0; k < 20; k++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 33, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 0, new Color(0, 142, 255), 1f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Water, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 0, new Color(0, 142, 255), 1f); } } } diff --git a/Projectiles/Melee/AncientBeam.cs b/Projectiles/Melee/AncientBeam.cs index f93f548cd9..5ae73dd099 100644 --- a/Projectiles/Melee/AncientBeam.cs +++ b/Projectiles/Melee/AncientBeam.cs @@ -1,11 +1,11 @@ -using CalamityMod.Particles; +using System; +using CalamityMod.Particles; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; using static CalamityMod.CalamityUtils; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee @@ -58,7 +58,7 @@ namespace CalamityMod.Projectiles.Melee if (Main.rand.NextBool(3)) { - int dustTrail = Dust.NewDust(Projectile.Center, 14, 14, 66, Projectile.velocity.X * 0.05f, Projectile.velocity.Y * 0.05f, 150, new Color(Main.DiscoR, 100, 255), 1.2f); + int dustTrail = Dust.NewDust(Projectile.Center, 14, 14, DustID.RainbowTorch, Projectile.velocity.X * 0.05f, Projectile.velocity.Y * 0.05f, 150, new Color(Main.DiscoR, 100, 255), 1.2f); Main.dust[dustTrail].noGravity = true; } diff --git a/Projectiles/Melee/AncientStar.cs b/Projectiles/Melee/AncientStar.cs index 20fc8c16ee..8da00d49e2 100644 --- a/Projectiles/Melee/AncientStar.cs +++ b/Projectiles/Melee/AncientStar.cs @@ -1,11 +1,11 @@ -using CalamityMod.Particles; +using System; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -87,7 +87,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.01f * (float)Projectile.direction; - CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 200f, 12f, 20f); + CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 256f, 12f, 20f); } public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Melee/ArkOfTheAncients_ParryHoldout.cs b/Projectiles/Melee/ArkOfTheAncients_ParryHoldout.cs index 0b157c8738..af6256b14a 100644 --- a/Projectiles/Melee/ArkOfTheAncients_ParryHoldout.cs +++ b/Projectiles/Melee/ArkOfTheAncients_ParryHoldout.cs @@ -1,14 +1,14 @@ -using CalamityMod.Particles; +using System; +using System.IO; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee @@ -65,9 +65,13 @@ namespace CalamityMod.Projectiles.Melee GeneralParryEffects(); - //only get iframes if the enemy has contact damage :) + // 17APR2024: Ozzatron: Ark of the Ancients is a parry. It uses vanilla parry iframes and benefits from Cross Necklace. + // However, iframes are only granted if the target has contact damage. This means it won't work on Providence. Too bad. I have no sympathy for you if you are using this weapon line. if (target.damage > 0) - Owner.GiveIFrames(35); + { + int arkParryIFrames = Owner.ComputeParryIFrames(); + Owner.GiveUniversalIFrames(arkParryIFrames, false); + } Vector2 particleOrigin = target.Hitbox.Size().Length() < 140 ? target.Center : Projectile.Center + Projectile.rotation.ToRotationVector2() * 60f; Particle spark = new GenericSparkle(particleOrigin, Vector2.Zero, Color.White, Color.HotPink, 1.2f, 35, 0.1f, 2); @@ -98,7 +102,7 @@ namespace CalamityMod.Projectiles.Melee } //Manage position and rotation - Projectile.Center = Owner.Center + DistanceFromPlayer ; + Projectile.Center = Owner.Center + DistanceFromPlayer; Projectile.scale = 1.4f + ((float)Math.Sin(Timer / 160f * MathHelper.Pi) * 0.6f); //SWAGGER if (Timer > ParryTime) diff --git a/Projectiles/Melee/ArkOfTheAncients_SwungBlade.cs b/Projectiles/Melee/ArkOfTheAncients_SwungBlade.cs index fe2c495ee8..9e78cc627b 100644 --- a/Projectiles/Melee/ArkOfTheAncients_SwungBlade.cs +++ b/Projectiles/Melee/ArkOfTheAncients_SwungBlade.cs @@ -1,16 +1,16 @@ -using CalamityMod.Particles; +using System; +using System.IO; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Particles; +using CalamityMod.Sounds; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using static Terraria.ModLoader.ModContent; using static CalamityMod.CalamityUtils; -using Terraria.Audio; -using CalamityMod.Sounds; +using static Terraria.ModLoader.ModContent; namespace CalamityMod.Projectiles.Melee { @@ -93,7 +93,7 @@ namespace CalamityMod.Projectiles.Melee if (Owner.whoAmI == Main.myPlayer && SwingRatio() > 0.5f && HasFired == 0f && Charge > 0) { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Owner.Center + direction * 30f, Projectile.velocity * 1.25f, ProjectileType(), (int)(Projectile.damage * FracturedArk.beamDamageMultiplier), 2f, Owner.whoAmI) ; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Owner.Center + direction * 30f, Projectile.velocity * 1.25f, ProjectileType(), (int)(Projectile.damage * FracturedArk.beamDamageMultiplier), 2f, Owner.whoAmI); HasFired = 1f; } @@ -108,7 +108,7 @@ namespace CalamityMod.Projectiles.Melee } Owner.itemRotation = MathHelper.WrapAngle(Owner.itemRotation); - if (Charge > 0 && Main.rand.Next(2) == 0) + if (Charge > 0 && Main.rand.NextBool(2)) { Vector2 particleOrigin = Projectile.Center + Projectile.rotation.ToRotationVector2() * 75 * Projectile.scale; Vector2 particleSpeed = Projectile.rotation.ToRotationVector2().RotatedByRandom(MathHelper.PiOver4) * Main.rand.NextFloat(1.2f, 2f); @@ -128,7 +128,7 @@ namespace CalamityMod.Projectiles.Melee float drawAngle = Projectile.rotation; float drawRotation = Projectile.rotation + MathHelper.PiOver4 + extraAngle; - Vector2 drawOrigin = new Vector2(Owner.direction < 0 ? sword.Width : 0f , sword.Height); + Vector2 drawOrigin = new Vector2(Owner.direction < 0 ? sword.Width : 0f, sword.Height); Vector2 drawOffset = Owner.Center + drawAngle.ToRotationVector2() * 10f - Main.screenPosition; if (CalamityConfig.Instance.Afterimages && Timer > ProjectileID.Sets.TrailCacheLength[Projectile.type]) diff --git a/Projectiles/Melee/ArkOfTheCosmos_BlastAttack.cs b/Projectiles/Melee/ArkOfTheCosmos_BlastAttack.cs index 17537921c5..e2b1ac7c17 100644 --- a/Projectiles/Melee/ArkOfTheCosmos_BlastAttack.cs +++ b/Projectiles/Melee/ArkOfTheCosmos_BlastAttack.cs @@ -1,16 +1,16 @@ -using CalamityMod.Particles; +using System; +using System.IO; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Particles; +using CalamityMod.Sounds; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using static Terraria.ModLoader.ModContent; using static CalamityMod.CalamityUtils; -using Terraria.Audio; -using CalamityMod.Sounds; +using static Terraria.ModLoader.ModContent; namespace CalamityMod.Projectiles.Melee { @@ -121,9 +121,9 @@ namespace CalamityMod.Projectiles.Melee //Check for the up arrow once more so if the player has good reflexes they can avoid the dash. Gives them more control if (Owner.controlUp && Charge >= 5) { - Owner.GiveIFrames(ArkoftheCosmos.DashIframes); + // 17APR2024: Ozzatron: Dash iframes are not boosted by Cross Necklace at all and are fixed. + Owner.GiveUniversalIFrames(ArkoftheCosmos.DashIframes); Dashing = true; - } for (int i = 0; i < 20; i++) @@ -268,7 +268,7 @@ namespace CalamityMod.Projectiles.Melee Texture2D sliceTex = Request("CalamityMod/Particles/BloomLine").Value; Color sliceColor = Color.Lerp(Color.OrangeRed, Color.White, SnapProgress); float rot = Projectile.rotation + MathHelper.PiOver2; - Vector2 sliceScale = new Vector2(0.2f * (1 - SnapProgress) ,ThrustDisplaceRatio() * 242f); + Vector2 sliceScale = new Vector2(0.2f * (1 - SnapProgress), ThrustDisplaceRatio() * 242f); Main.EntitySpriteDraw(sliceTex, Projectile.Center - Main.screenPosition, null, sliceColor, rot, new Vector2(sliceTex.Width / 2f, sliceTex.Height), sliceScale, 0f, 0); //Draw the scissors diff --git a/Projectiles/Melee/ArkOfTheCosmos_ParryHoldout.cs b/Projectiles/Melee/ArkOfTheCosmos_ParryHoldout.cs index 0ac82786cb..3e652c4683 100644 --- a/Projectiles/Melee/ArkOfTheCosmos_ParryHoldout.cs +++ b/Projectiles/Melee/ArkOfTheCosmos_ParryHoldout.cs @@ -1,16 +1,16 @@ -using CalamityMod.Particles; +using System; +using System.IO; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Particles; +using CalamityMod.Sounds; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using static Terraria.ModLoader.ModContent; using static CalamityMod.CalamityUtils; -using CalamityMod.Sounds; +using static Terraria.ModLoader.ModContent; namespace CalamityMod.Projectiles.Melee @@ -56,7 +56,7 @@ namespace CalamityMod.Projectiles.Melee ArkoftheCosmos sword = (Owner.HeldItem.ModItem as ArkoftheCosmos); if (sword != null) { - sword.Charge = 10f; + sword.Charge = ArkoftheCosmos.MaxCharge; sword.Combo = 0f; } SoundEngine.PlaySound(SoundID.DD2_WitherBeastCrystalImpact); @@ -64,11 +64,11 @@ namespace CalamityMod.Projectiles.Melee CombatText.NewText(Projectile.Hitbox, new Color(111, 247, 200), CalamityUtils.GetTextValue("Misc.ArkParry"), true); - for (int i = 0; i < 5; i ++) //Don't loose your way + for (int i = 0; i < 5; i++) //Don't loose your way { Vector2 particleDispalce = Main.rand.NextVector2Circular(Owner.Hitbox.Width * 2f, Owner.Hitbox.Height * 1.2f); float particleScale = Main.rand.NextFloat(0.5f, 1.4f); - Particle shine = new FlareShine(Owner.Center + particleDispalce, particleDispalce * 0.01f, Color.White, Color.Red, 0f, new Vector2(0.6f, 1f) * particleScale, new Vector2(1.5f, 2.7f) * particleScale, 20 + Main.rand.Next(6), bloomScale: 3f, spawnDelay : Main.rand.Next(7) * 2); + Particle shine = new FlareShine(Owner.Center + particleDispalce, particleDispalce * 0.01f, Color.White, Color.Red, 0f, new Vector2(0.6f, 1f) * particleScale, new Vector2(1.5f, 2.7f) * particleScale, 20 + Main.rand.Next(6), bloomScale: 3f, spawnDelay: Main.rand.Next(7) * 2); GeneralParticleHandler.SpawnParticle(shine); } @@ -82,9 +82,13 @@ namespace CalamityMod.Projectiles.Melee GeneralParryEffects(); - //only get iframes if the enemy has contact damage :) + // 17APR2024: Ozzatron: Ark of the Cosmos is a parry. It uses vanilla parry iframes and benefits from Cross Necklace. + // However, iframes are only granted if the target has contact damage. This means it won't work on Providence. Too bad. I have no sympathy for you if you are using this weapon line. if (target.damage > 0) - Owner.GiveIFrames(35); + { + int arkParryIFrames = Owner.ComputeParryIFrames(); + Owner.GiveUniversalIFrames(arkParryIFrames, false); + } Vector2 particleOrigin = target.Hitbox.Size().Length() < 140 ? target.Center : Projectile.Center + Projectile.rotation.ToRotationVector2() * 60f; Particle spark = new GenericSparkle(particleOrigin, Vector2.Zero, Color.White, Color.HotPink, 1.2f, 35, 0.1f, 2); @@ -115,7 +119,7 @@ namespace CalamityMod.Projectiles.Melee } //Manage position and rotation - Projectile.Center = Owner.Center + DistanceFromPlayer ; + Projectile.Center = Owner.Center + DistanceFromPlayer; Projectile.scale = 1.4f + ThrustDisplaceRatio() * 0.2f; if (Timer > ParryTime) diff --git a/Projectiles/Melee/ArkOfTheCosmos_SwungBlade.cs b/Projectiles/Melee/ArkOfTheCosmos_SwungBlade.cs index 7881de6e2b..5b3bb7fb7e 100644 --- a/Projectiles/Melee/ArkOfTheCosmos_SwungBlade.cs +++ b/Projectiles/Melee/ArkOfTheCosmos_SwungBlade.cs @@ -1,16 +1,16 @@ -using CalamityMod.Particles; +using System; +using System.IO; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Particles; +using CalamityMod.Sounds; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using static Terraria.ModLoader.ModContent; using static CalamityMod.CalamityUtils; -using Terraria.Audio; -using CalamityMod.Sounds; +using static Terraria.ModLoader.ModContent; namespace CalamityMod.Projectiles.Melee { @@ -58,14 +58,14 @@ namespace CalamityMod.Projectiles.Melee #region Throw variables //Only used for the long range throw - private bool OwnerCanShoot => Owner.channel && !Owner.noItems && !Owner.CCed && Owner.HeldItem.type == ItemType(); + private bool OwnerCanShoot => !Owner.CantUseHoldout() && Owner.HeldItem.type == ItemType(); public bool Thrown => Combo == 2 || Combo == 3; public const float MaxThrowTime = 140; public float ThrowReach; public float ThrowTimer => MaxThrowTime - Projectile.timeLeft; public float ThrowCompletion => ThrowTimer / MaxThrowTime; - public const float SnapWindowStart = 0.2f; + public const float SnapWindowStart = 0.35f; public const float SnapWindowEnd = 0.75f; public float SnapEndTime => (MaxThrowTime - (MaxThrowTime * SnapWindowEnd)); public float SnapEndCompletion => (SnapEndTime - Projectile.timeLeft) / SnapEndTime; @@ -141,7 +141,7 @@ namespace CalamityMod.Projectiles.Melee { if (!initialized) //Initialization { - Projectile.timeLeft = Thrown ? (int) MaxThrowTime : (int)MaxSwingTime; + Projectile.timeLeft = Thrown ? (int)MaxThrowTime : (int)MaxSwingTime; SoundStyle sound = (Charge > 0 || Thrown) ? CommonCalamitySounds.LouderPhantomPhoenix : SoundID.Item71; SoundEngine.PlaySound(sound, Projectile.Center); direction = Projectile.velocity; @@ -182,11 +182,11 @@ namespace CalamityMod.Projectiles.Melee //Slightly shift the blasts up so the final close shots don't go BELOW the cursor and instead go right on it. float adjustedBlastRotation = Projectile.rotation - MathHelper.PiOver4 * 1.15f * Owner.direction; - var source = Projectile.GetSource_FromThis(); - Projectile blast = Projectile.NewProjectileDirect(source, Owner.Center + adjustedBlastRotation.ToRotationVector2() * 10f, adjustedBlastRotation.ToRotationVector2() * 20f, ProjectileType(), (int)(ArkoftheCosmos.SwirlBoltDamageMultiplier / ArkoftheCosmos.SwirlBoltAmount * Projectile.damage), 0f, Owner.whoAmI, 0.55f, MathHelper.Pi * 0.05f); - { + var source = Projectile.GetSource_FromThis(); + Projectile blast = Projectile.NewProjectileDirect(source, Owner.Center + adjustedBlastRotation.ToRotationVector2() * 10f, adjustedBlastRotation.ToRotationVector2() * 20f, ProjectileType(), (int)(ArkoftheCosmos.SwirlBoltDamageMultiplier / ArkoftheCosmos.SwirlBoltAmount * Projectile.damage), 0f, Owner.whoAmI, 0.55f, MathHelper.Pi * 0.05f); + { blast.timeLeft = 100; - } + } } } @@ -268,7 +268,7 @@ namespace CalamityMod.Projectiles.Melee if (Combo == 3f) { //Slow down the projectile's retraction - float curveDownGently = MathHelper.Lerp(1f, 0.8f, 1f - (float)Math.Sqrt(1f - (float)Math.Pow(SnapEndCompletion , 2f))); + float curveDownGently = MathHelper.Lerp(1f, 0.8f, 1f - (float)Math.Sqrt(1f - (float)Math.Pow(SnapEndCompletion, 2f))); Projectile.Center = Owner.Center + direction * curveDownGently; Projectile.scale = 1.5f; @@ -276,7 +276,7 @@ namespace CalamityMod.Projectiles.Melee float extraRotations = (direction.ToRotation() + MathHelper.PiOver4 > Projectile.velocity.ToRotation()) ? -MathHelper.TwoPi : 0f; - Projectile.rotation = MathHelper.Lerp(Projectile.velocity.ToRotation(), direction.ToRotation() + extraRotations, orientateProperly); + Projectile.rotation = MathHelper.Lerp(Projectile.velocity.ToRotation(), direction.ToRotation() + extraRotations, orientateProperly); } //Sharticles @@ -325,7 +325,7 @@ namespace CalamityMod.Projectiles.Melee float maxDistance = Projectile.scale * 78f; Vector2 distance = Main.rand.NextVector2Circular(maxDistance, maxDistance); Vector2 angularVelocity = Utils.SafeNormalize(distance.RotatedBy(MathHelper.PiOver2 * Owner.direction), Vector2.Zero) * 2 * (1f + distance.Length() / 15f); - Particle glitter = new CritSpark(Owner.Center + distance, Owner.velocity + angularVelocity, Main.rand.Next(3) == 0 ? Color.Turquoise : Color.Coral, currentColor, 1f + 1 * (distance.Length() / maxDistance), 10, 0.05f, 3f); + Particle glitter = new CritSpark(Owner.Center + distance, Owner.velocity + angularVelocity, Main.rand.NextBool(3)? Color.Turquoise : Color.Coral, currentColor, 1f + 1 * (distance.Length() / maxDistance), 10, 0.05f, 3f); GeneralParticleHandler.SpawnParticle(glitter); } @@ -343,9 +343,9 @@ namespace CalamityMod.Projectiles.Melee Particle smoke = new HeavySmokeParticle(smokepos, smokespeed, Color.Lerp(Color.DodgerBlue, Color.MediumVioletRed, i), 6 + Main.rand.Next(5), scaleFactor * Main.rand.NextFloat(2.8f, 3.1f), Opacity + Main.rand.NextFloat(0f, 0.2f), 0f, false, 0, true); GeneralParticleHandler.SpawnParticle(smoke); - if (Main.rand.Next(3) == 0) + if (Main.rand.NextBool(3)) { - Particle smokeGlow = new HeavySmokeParticle(smokepos, smokespeed, Main.rand.Next(5) == 0 ? Color.Gold : Color.Chocolate, 5, scaleFactor * Main.rand.NextFloat(2f, 2.4f), Opacity * 2.5f, 0f, true, 0.004f, true); + Particle smokeGlow = new HeavySmokeParticle(smokepos, smokespeed, Main.rand.NextBool(5)? Color.Gold : Color.Chocolate, 5, scaleFactor * Main.rand.NextFloat(2f, 2.4f), Opacity * 2.5f, 0f, true, 0.004f, true); GeneralParticleHandler.SpawnParticle(smokeGlow); } } @@ -385,7 +385,7 @@ namespace CalamityMod.Projectiles.Melee Vector2 distance = Main.rand.NextVector2Circular(maxDistance, maxDistance); Vector2 angularVelocity = Utils.SafeNormalize(distance.RotatedBy(-MathHelper.PiOver2), Vector2.Zero) * 2 * (1f + distance.Length() / 15f); Color glitterColor = Main.hslToRgb(Main.rand.NextFloat(), 1, 0.5f); - Particle glitter = new CritSpark(Projectile.Center + distance, Owner.velocity + angularVelocity, Color.White , glitterColor, 1f + 1 * (distance.Length() / maxDistance), 10, 0.05f, 3f); + Particle glitter = new CritSpark(Projectile.Center + distance, Owner.velocity + angularVelocity, Color.White, glitterColor, 1f + 1 * (distance.Length() / maxDistance), 10, 0.05f, 3f); GeneralParticleHandler.SpawnParticle(glitter); } @@ -403,9 +403,9 @@ namespace CalamityMod.Projectiles.Melee Particle smoke = new HeavySmokeParticle(smokepos, smokespeed, Color.Lerp(Color.DodgerBlue, Color.MediumVioletRed, i), 10 + Main.rand.Next(5), scaleFactor * Main.rand.NextFloat(2.8f, 3.1f), opacity + Main.rand.NextFloat(0f, 0.2f), 0f, false, 0, true); GeneralParticleHandler.SpawnParticle(smoke); - if (Main.rand.Next(3) == 0) + if (Main.rand.NextBool(3)) { - Particle smokeGlow = new HeavySmokeParticle(smokepos, smokespeed, Main.rand.Next(5) == 0 ? Color.Gold : Color.Chocolate, 7, scaleFactor * Main.rand.NextFloat(2f, 2.4f), opacity * 2.5f, 0f, true, 0.004f, true); + Particle smokeGlow = new HeavySmokeParticle(smokepos, smokespeed, Main.rand.NextBool(5)? Color.Gold : Color.Chocolate, 7, scaleFactor * Main.rand.NextFloat(2f, 2.4f), opacity * 2.5f, 0f, true, 0.004f, true); GeneralParticleHandler.SpawnParticle(smokeGlow); } } @@ -424,14 +424,14 @@ namespace CalamityMod.Projectiles.Melee { for (int i = 0; i < 5; i++) { - Vector2 particleSpeed = Utils.SafeNormalize(target.Center - Projectile.Center , Vector2.One).RotatedByRandom(MathHelper.PiOver4 * 0.8f) * Main.rand.NextFloat(3.6f, 8f); + Vector2 particleSpeed = Utils.SafeNormalize(target.Center - Projectile.Center, Vector2.One).RotatedByRandom(MathHelper.PiOver4 * 0.8f) * Main.rand.NextFloat(3.6f, 8f); Particle energyLeak = new SquishyLightParticle(target.Center, particleSpeed, Main.rand.NextFloat(0.3f, 0.6f), Color.OrangeRed, 60, 2, 2.5f, hueShift: 0.06f); GeneralParticleHandler.SpawnParticle(energyLeak); } if (Combo == 3f) { - SoundEngine.PlaySound(CommonCalamitySounds.ScissorGuillotineSnapSound with { Volume =CommonCalamitySounds.ScissorGuillotineSnapSound.Volume * 1.3f }, Projectile.Center); + SoundEngine.PlaySound(CommonCalamitySounds.ScissorGuillotineSnapSound with { Volume = CommonCalamitySounds.ScissorGuillotineSnapSound.Volume * 1.3f }, Projectile.Center); } } @@ -445,7 +445,7 @@ namespace CalamityMod.Projectiles.Melee SoundEngine.PlaySound(SoundID.Item84, Projectile.Center); Vector2 sliceDirection = Utils.SafeNormalize(direction, Vector2.One) * 40; - Particle SliceLine = new LineVFX(Projectile.Center - sliceDirection, sliceDirection * 2f, 0.2f, Color.Orange * 0.7f, expansion : 250f) + Particle SliceLine = new LineVFX(Projectile.Center - sliceDirection, sliceDirection * 2f, 0.2f, Color.Orange * 0.7f, expansion: 250f) { Lifetime = 10 }; diff --git a/Projectiles/Melee/ArkOfTheElements_ParryHoldout.cs b/Projectiles/Melee/ArkOfTheElements_ParryHoldout.cs index ae1dfe97fc..d2d6ff0273 100644 --- a/Projectiles/Melee/ArkOfTheElements_ParryHoldout.cs +++ b/Projectiles/Melee/ArkOfTheElements_ParryHoldout.cs @@ -1,17 +1,17 @@ -using CalamityMod.Particles; +using System; +using System.IO; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Particles; +using CalamityMod.Sounds; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using static Terraria.ModLoader.ModContent; using static CalamityMod.CalamityUtils; -using Terraria.Audio; -using CalamityMod.Sounds; -using CalamityMod.Buffs.DamageOverTime; +using static Terraria.ModLoader.ModContent; namespace CalamityMod.Projectiles.Melee { @@ -63,11 +63,11 @@ namespace CalamityMod.Projectiles.Melee SoundEngine.PlaySound(CommonCalamitySounds.ScissorGuillotineSnapSound with { Volume = CommonCalamitySounds.ScissorGuillotineSnapSound.Volume * 1.3f }, Projectile.Center); CombatText.NewText(Projectile.Hitbox, new Color(111, 247, 200), CalamityUtils.GetTextValue("Misc.ArkParry"), true); - for (int i = 0; i < 5; i ++) //Don't loose your way + for (int i = 0; i < 5; i++) //Don't loose your way { Vector2 particleDispalce = Main.rand.NextVector2Circular(Owner.Hitbox.Width * 2f, Owner.Hitbox.Height * 1.2f); float particleScale = Main.rand.NextFloat(0.5f, 1.4f); - Particle shine = new FlareShine(Owner.Center + particleDispalce, particleDispalce * 0.01f, Color.White, Color.Red, 0f, new Vector2(0.6f, 1f) * particleScale, new Vector2(1.5f, 2.7f) * particleScale, 20 + Main.rand.Next(6), bloomScale: 3f, spawnDelay : Main.rand.Next(7) * 2); + Particle shine = new FlareShine(Owner.Center + particleDispalce, particleDispalce * 0.01f, Color.White, Color.Red, 0f, new Vector2(0.6f, 1f) * particleScale, new Vector2(1.5f, 2.7f) * particleScale, 20 + Main.rand.Next(6), bloomScale: 3f, spawnDelay: Main.rand.Next(7) * 2); GeneralParticleHandler.SpawnParticle(shine); } @@ -82,9 +82,13 @@ namespace CalamityMod.Projectiles.Melee GeneralParryEffects(); - //only get iframes if the enemy has contact damage :) + // 17APR2024: Ozzatron: Ark of the Elements is a parry. It uses vanilla parry iframes and benefits from Cross Necklace. + // However, iframes are only granted if the target has contact damage. This means it won't work on Providence. Too bad. I have no sympathy for you if you are using this weapon line. if (target.damage > 0) - Owner.GiveIFrames(35); + { + int arkParryIFrames = Owner.ComputeParryIFrames(); + Owner.GiveUniversalIFrames(arkParryIFrames, false); + } Vector2 particleOrigin = target.Hitbox.Size().Length() < 140 ? target.Center : Projectile.Center + Projectile.rotation.ToRotationVector2() * 60f; Particle spark = new GenericSparkle(particleOrigin, Vector2.Zero, Color.White, Color.HotPink, 1.2f, 35, 0.1f, 2); @@ -115,7 +119,7 @@ namespace CalamityMod.Projectiles.Melee } //Manage position and rotation - Projectile.Center = Owner.Center + DistanceFromPlayer ; + Projectile.Center = Owner.Center + DistanceFromPlayer; Projectile.scale = 1.4f + ThrustDisplaceRatio() * 0.2f; if (Timer > ParryTime) diff --git a/Projectiles/Melee/ArkOfTheElements_SnapBlast.cs b/Projectiles/Melee/ArkOfTheElements_SnapBlast.cs index 54483004d5..97ca32cb42 100644 --- a/Projectiles/Melee/ArkOfTheElements_SnapBlast.cs +++ b/Projectiles/Melee/ArkOfTheElements_SnapBlast.cs @@ -1,15 +1,15 @@ -using CalamityMod.Particles; +using System; +using System.IO; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using static Terraria.ModLoader.ModContent; using static CalamityMod.CalamityUtils; -using Terraria.Audio; +using static Terraria.ModLoader.ModContent; namespace CalamityMod.Projectiles.Melee @@ -186,7 +186,7 @@ namespace CalamityMod.Projectiles.Melee Color sliceColor = Color.Lerp(Color.OrangeRed, Color.White, SnapProgress); float rot = Projectile.rotation + MathHelper.PiOver2; Vector2 nitpickShiftCorrection = (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2() * 10f; //Ngl these minor nitpick variables probably be horrible to understand when decompiled into Vector43 - Vector2 sliceScale = new Vector2(0.2f * (1 - SnapProgress) ,ThrustDisplaceRatio() * 242f); + Vector2 sliceScale = new Vector2(0.2f * (1 - SnapProgress), ThrustDisplaceRatio() * 242f); Main.EntitySpriteDraw(sliceTex, Projectile.Center + nitpickShiftCorrection - Main.screenPosition, null, sliceColor, rot, new Vector2(sliceTex.Width / 2f, sliceTex.Height), sliceScale, 0f, 0); //Draw the scissors diff --git a/Projectiles/Melee/ArkOfTheElements_SwungBlade.cs b/Projectiles/Melee/ArkOfTheElements_SwungBlade.cs index e91203497f..6ad36b293e 100644 --- a/Projectiles/Melee/ArkOfTheElements_SwungBlade.cs +++ b/Projectiles/Melee/ArkOfTheElements_SwungBlade.cs @@ -1,17 +1,17 @@ -using CalamityMod.Particles; +using System; +using System.IO; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Particles; +using CalamityMod.Sounds; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using static Terraria.ModLoader.ModContent; using static CalamityMod.CalamityUtils; -using Terraria.Audio; -using CalamityMod.Sounds; -using CalamityMod.Buffs.DamageOverTime; +using static Terraria.ModLoader.ModContent; namespace CalamityMod.Projectiles.Melee { @@ -55,7 +55,7 @@ namespace CalamityMod.Projectiles.Melee #region Throw variables //Only used for the long range throw - private bool OwnerCanShoot => Owner.channel && !Owner.noItems && !Owner.CCed && Owner.HeldItem.type == ItemType(); + private bool OwnerCanShoot => !Owner.CantUseHoldout() && Owner.HeldItem.type == ItemType(); public bool Thrown => Combo == 2 || Combo == 3; const float MaxThrowTime = 80; const float ThrowReachMax = 500; @@ -64,8 +64,8 @@ namespace CalamityMod.Projectiles.Melee public float ThrowTimer => MaxThrowTime - Projectile.timeLeft; public float ThrowCompletion => ThrowTimer / MaxThrowTime; - const float SnapWindowStart = 0.4f; - const float SnapWindowEnd = 0.6f; + const float SnapWindowStart = 0.25f; + const float SnapWindowEnd = 0.75f; public float SnapEndTime => (MaxThrowTime - (MaxThrowTime * SnapWindowEnd)); public float SnapEndCompletion => (SnapEndTime - Projectile.timeLeft) / SnapEndTime; public ref float ChanceMissed => ref Projectile.localAI[1]; @@ -136,7 +136,7 @@ namespace CalamityMod.Projectiles.Melee { if (!initialized) //Initialization { - Projectile.timeLeft = Thrown ? (int) MaxThrowTime : (int)MaxSwingTime; + Projectile.timeLeft = Thrown ? (int)MaxThrowTime : (int)MaxSwingTime; SoundStyle sound = (Charge > 0 || Thrown) ? CommonCalamitySounds.LouderPhantomPhoenix : SoundID.Item71; SoundEngine.PlaySound(sound, Projectile.Center); direction = Projectile.velocity; @@ -209,7 +209,7 @@ namespace CalamityMod.Projectiles.Melee if (Combo == 3f) { //Slow down the projectile's retraction - float curveDownGently = MathHelper.Lerp(1f, 0.8f, 1f - (float)Math.Sqrt(1f - (float)Math.Pow(SnapEndCompletion , 2f))); + float curveDownGently = MathHelper.Lerp(1f, 0.8f, 1f - (float)Math.Sqrt(1f - (float)Math.Pow(SnapEndCompletion, 2f))); Projectile.Center = Owner.Center + direction * ThrowReach * curveDownGently; Projectile.scale = 1.5f; @@ -245,22 +245,13 @@ namespace CalamityMod.Projectiles.Melee target.AddBuff(ModContent.BuffType(), 60); for (int i = 0; i < 5; i++) { - Vector2 particleSpeed = Utils.SafeNormalize(target.Center - Projectile.Center , Vector2.One).RotatedByRandom(MathHelper.PiOver4 * 0.8f) * Main.rand.NextFloat(3.6f, 8f); + Vector2 particleSpeed = Utils.SafeNormalize(target.Center - Projectile.Center, Vector2.One).RotatedByRandom(MathHelper.PiOver4 * 0.8f) * Main.rand.NextFloat(3.6f, 8f); Particle energyLeak = new SquishyLightParticle(target.Center, particleSpeed, Main.rand.NextFloat(0.3f, 0.6f), Color.OrangeRed, 60, 2, 2.5f, hueShift: 0.06f); GeneralParticleHandler.SpawnParticle(energyLeak); } if (Combo == 3f) - { SoundEngine.PlaySound(CommonCalamitySounds.ScissorGuillotineSnapSound with { Volume = CommonCalamitySounds.ScissorGuillotineSnapSound.Volume * 1.3f }, Projectile.Center); - - if (Charge <= 1) - { - ArkoftheElements sword = (Owner.HeldItem.ModItem as ArkoftheElements); - if (sword != null) - sword.Charge = 2f; - } - } } public override void OnKill(int timeLeft) @@ -273,7 +264,7 @@ namespace CalamityMod.Projectiles.Melee SoundEngine.PlaySound(SoundID.Item84, Projectile.Center); Vector2 sliceDirection = direction * 40; - Particle SliceLine = new LineVFX(Projectile.Center - sliceDirection, sliceDirection * 2f, 0.2f, Color.Orange * 0.7f, expansion : 250f) + Particle SliceLine = new LineVFX(Projectile.Center - sliceDirection, sliceDirection * 2f, 0.2f, Color.Orange * 0.7f, expansion: 250f) { Lifetime = 10 }; diff --git a/Projectiles/Melee/ArkoftheCosmos_Constellation.cs b/Projectiles/Melee/ArkoftheCosmos_Constellation.cs index ef7f587d7a..279ffadd27 100644 --- a/Projectiles/Melee/ArkoftheCosmos_Constellation.cs +++ b/Projectiles/Melee/ArkoftheCosmos_Constellation.cs @@ -1,11 +1,11 @@ -using CalamityMod.Particles; +using System.Collections.Generic; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using System.Collections.Generic; namespace CalamityMod.Projectiles.Melee { @@ -95,7 +95,7 @@ namespace CalamityMod.Projectiles.Melee Line = new BloomLineVFX(previousStar, AnchorStart + SizeVector * i + offset - previousStar, 0.8f, constellationColor * 0.75f, 20, true, true); BootlegSpawnParticle(Line); - if (Main.rand.Next(3) == 0) + if (Main.rand.NextBool(3)) { constellationColorHue = (constellationColorHue + 0.16f) % 1; constellationColor = Main.hslToRgb(constellationColorHue, 1, 0.8f); diff --git a/Projectiles/Melee/AstralScytheProjectile.cs b/Projectiles/Melee/AstralScytheProjectile.cs index 0e573b1dc8..f57ef7acea 100644 --- a/Projectiles/Melee/AstralScytheProjectile.cs +++ b/Projectiles/Melee/AstralScytheProjectile.cs @@ -1,10 +1,10 @@ -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { public class AstralScytheProjectile : ModProjectile, ILocalizedModType diff --git a/Projectiles/Melee/AtaraxiaBoom.cs b/Projectiles/Melee/AtaraxiaBoom.cs new file mode 100644 index 0000000000..e3aed7c831 --- /dev/null +++ b/Projectiles/Melee/AtaraxiaBoom.cs @@ -0,0 +1,79 @@ +using System; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + // TODO -- Abstract away most of the direct vector math away in here into things like SafeDirectionTo calls. + public class AtaraxiaBoom : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override void SetDefaults() + { + Projectile.width = 8; + Projectile.height = 8; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = -1; + Projectile.timeLeft = 1; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + public override void AI() + { + Player Owner = Main.player[Projectile.owner]; + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); + + // Light + Lighting.AddLight(Projectile.Center, 0.3f, 0.1f, 0.45f); + + } + public override void OnKill(int timeLeft) + { + if (Projectile.ai[0] == 0) + { + int flowerPetalCount = 6; + float thetaDelta = new Vector2(3, 3).RotatedByRandom(100).ToRotation(); + float weaveDistanceMin = 0.5f; + float weaveDistanceOutwardMax = 10f; + float weaveDistanceInner = 0.5f; + for (float theta = 0f; theta < MathHelper.TwoPi; theta += 0.05f) + { + float colorRando = Main.rand.NextFloat(0, 1); + Vector2 velocity = theta.ToRotationVector2() * + (weaveDistanceMin + + // The 0.5 in here is to prevent the petal from looping back into itself. With a 0.5 addition, it is perfect, coming back to (0,0) + // instead of weaving backwards. + (float)(Math.Sin(thetaDelta + theta * flowerPetalCount) + 0.5f + weaveDistanceInner) * + weaveDistanceOutwardMax); + Dust dust = Dust.NewDustPerfect(Projectile.Center, 267, velocity); + dust.noGravity = true; + dust.scale = 1.15f; + dust.color = Color.Lerp(Color.DarkOrchid, Color.IndianRed, colorRando); + } + for (int k = 0; k < 5; k++) + { + Vector2 velocity = new Vector2(15, 15).RotatedByRandom(100) * Main.rand.NextFloat(0.6f, 1.2f); + float colorRando = Main.rand.NextFloat(0, 1); + Particle spark = new SparkParticle(Projectile.Center + velocity, velocity, true, 50, Main.rand.NextFloat(0.7f, 0.95f), Color.Lerp(Color.DarkOrchid, Color.IndianRed, colorRando)); + GeneralParticleHandler.SpawnParticle(spark); + } + } + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + if (Projectile.numHits > 0) + Projectile.damage = (int)(Projectile.damage * 0.88f); + if (Projectile.damage < 1) + Projectile.damage = 1; + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.ai[0] == 1 ? 130 : 200, targetHitbox); + } +} diff --git a/Projectiles/Melee/AtaraxiaHoming.cs b/Projectiles/Melee/AtaraxiaHoming.cs deleted file mode 100644 index 8391011adf..0000000000 --- a/Projectiles/Melee/AtaraxiaHoming.cs +++ /dev/null @@ -1,167 +0,0 @@ -using Microsoft.Xna.Framework; -using System; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - // TODO -- Abstract away most of the direct vector math away in here into things like SafeDirectionTo calls. - public class AtaraxiaHoming : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Melee"; - private static int NumAnimationFrames = 5; - private static int AnimationFrameTime = 9; - private static float HomingStartRange = 300f; - private static float HomingBreakRange = 1000f; - - private static int Lifespan = 180; - private static int IntangibleFrames = 12; - - public override void SetStaticDefaults() - { - Main.projFrames[Projectile.type] = NumAnimationFrames; - } - - public override void SetDefaults() - { - Projectile.width = 8; - Projectile.height = 8; - Projectile.friendly = true; - Projectile.DamageType = DamageClass.Melee; - Projectile.penetrate = 1; - Projectile.extraUpdates = 1; - Projectile.timeLeft = Lifespan; - Projectile.ignoreWater = true; - } - - private bool HomingAI() - { - // Save current speed to AI variables - float speed = Projectile.velocity.Length(); - if (Projectile.ai[0] == 0f) - Projectile.ai[0] = speed; - - // Variables for choosing an NPC to home in on - float posX = Projectile.position.X; - float posY = Projectile.position.Y; - float homingRange = HomingStartRange; - bool foundTarget = false; - int targetIndex = 0; - - // ai[1] stores the index of the current target plus one. 0 is none. - if (Projectile.ai[1] == 0f) - { - // Find the closest target. The range decreases each time you find a closer target. - for (int i = 0; i < Main.maxNPCs; ++i) - { - if (Main.npc[i].CanBeChasedBy(Projectile, false)) - { - // Chlorophyte Bullets actually home in a diamond instead of a circle because they don't perform a square root here. - float d = Math.Abs(Projectile.Center.X - Main.npc[i].Center.X) + Math.Abs(Projectile.Center.Y - Main.npc[i].Center.Y); - if (d < homingRange && Collision.CanHit(Projectile.Center, 1, 1, Main.npc[i].position, Main.npc[i].width, Main.npc[i].height)) - { - homingRange = d; - posX = Main.npc[i].Center.X; - posY = Main.npc[i].Center.Y; - foundTarget = true; - targetIndex = i; - } - } - } - - // If at least one valid target was found, set ai[1] to store its index plus one. - if (foundTarget) - Projectile.ai[1] = (float)(targetIndex + 1); - } - - // This is always the case after that loop for some reason. - foundTarget = false; - - // Ensure the current target is still valid - if (Projectile.ai[1] > 0f) - { - targetIndex = (int)(Projectile.ai[1] - 1f); - - // Chlorophyte Bullets will continue homing in unless their target is invincible. - if (Main.npc[targetIndex].active && Main.npc[targetIndex].CanBeChasedBy(Projectile, false)) - { - float targetX = Main.npc[targetIndex].Center.X; - float targetY = Main.npc[targetIndex].Center.Y; - float d = Math.Abs(Projectile.Center.X - targetX) + Math.Abs(Projectile.Center.Y - targetY); - if (d < HomingBreakRange) - { - foundTarget = true; - posX = targetX; - posY = targetY; - } - } - else - Projectile.ai[1] = 0f; - } - - // Non-friendly Chlorophyte Bullets will never actually home in, despite maintaining a target. - if (foundTarget && Projectile.friendly) - { - float dx = posX - Projectile.Center.X; - float dy = posY - Projectile.Center.Y; - float distance = (float)Math.Sqrt(dx * dx + dy * dy); - float homingFactor = speed / distance; - dx *= homingFactor; - dy *= homingFactor; - - // The projectile loses 1/5th of its current velocity and replaces it with homing power. - float homingStrength = 5f; - Projectile.velocity.X = (Projectile.velocity.X * (homingStrength - 1f) + dx) / homingStrength; - Projectile.velocity.Y = (Projectile.velocity.Y * (homingStrength - 1f) + dy) / homingStrength; - - // And then approaches the homing velocity by an increment of 0.3. - Projectile.velocity = Projectile.velocity.MoveTowards(new Vector2(dx, dy), 0.3f); - - // Re-scale resulting velocity to the projectile's set maximum speed - Projectile.velocity.Normalize(); - Projectile.velocity *= speed; - return true; - } - return false; - } - - public override void AI() - { - DrawOffsetX = -28; - DrawOriginOffsetY = -2; - DrawOriginOffsetX = 12; - Projectile.rotation = Projectile.velocity.ToRotation(); - - // Run homing code - bool homing = HomingAI(); - - // Light - Lighting.AddLight(Projectile.Center, 0.3f, 0.1f, 0.45f); - - // Spawn dust with a 3/4 chance if currently homing in - if (homing && Main.rand.Next(4) != 3) - { - int idx = Dust.NewDust(Projectile.Center, 1, 1, 70); - Main.dust[idx].position = Projectile.Center; - Main.dust[idx].noGravity = true; - Main.dust[idx].velocity *= 0.25f; - } - - // Update animation - Projectile.frameCounter++; - if (Projectile.frameCounter > AnimationFrameTime) - { - Projectile.frame++; - Projectile.frameCounter = 0; - } - if (Projectile.frame >= NumAnimationFrames) - Projectile.frame = 0; - } - - // Cannot deal damage for the first several frames of existence. - public override bool? CanDamage() - { - return Projectile.timeLeft < Lifespan - IntangibleFrames; - } - } -} diff --git a/Projectiles/Melee/AtaraxiaHoming.png b/Projectiles/Melee/AtaraxiaHoming.png deleted file mode 100644 index 47e460cede..0000000000 Binary files a/Projectiles/Melee/AtaraxiaHoming.png and /dev/null differ diff --git a/Projectiles/Melee/AtaraxiaMain.cs b/Projectiles/Melee/AtaraxiaMain.cs index 9a0527f940..b359302337 100644 --- a/Projectiles/Melee/AtaraxiaMain.cs +++ b/Projectiles/Melee/AtaraxiaMain.cs @@ -1,8 +1,12 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Items.Ammo; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Mono.Cecil; +using SteelSeries.GameSense; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -11,6 +15,7 @@ namespace CalamityMod.Projectiles.Melee public new string LocalizationCategory => "Projectiles.Melee"; private static int NumAnimationFrames = 5; private static int AnimationFrameTime = 9; + public int time = 0; public override void SetStaticDefaults() { @@ -25,12 +30,18 @@ namespace CalamityMod.Projectiles.Melee Projectile.DamageType = DamageClass.Melee; Projectile.ignoreWater = true; Projectile.penetrate = 1; - Projectile.extraUpdates = 3; - Projectile.timeLeft = 180; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.tileCollide = false; + Projectile.extraUpdates = 5; + Projectile.timeLeft = 300; } public override void AI() { + Player Owner = Main.player[Projectile.owner]; + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); + DrawOffsetX = -40; DrawOriginOffsetY = -3; DrawOriginOffsetX = 18; @@ -39,13 +50,23 @@ namespace CalamityMod.Projectiles.Melee // Light Lighting.AddLight(Projectile.Center, 0.45f, 0.1f, 0.1f); - // Spawn dust with a 1/2 chance - if (Main.rand.NextBool()) + if (time > 8f && targetDist < 1400f) { - int idx = Dust.NewDust(Projectile.Center, 1, 1, 90); - Main.dust[idx].position = Projectile.Center; - Main.dust[idx].noGravity = true; - Main.dust[idx].velocity *= 0.6f; + SparkParticle spark = new SparkParticle(Projectile.Center - Projectile.velocity * 1.5f, -Projectile.velocity * Main.rand.NextFloat(0.3f, 1.5f), false, 8, 0.8f, Color.Lerp(Color.DarkOrchid, Color.IndianRed, Main.rand.NextFloat(0, 1)) * 0.7f); + GeneralParticleHandler.SpawnParticle(spark); + } + if (time > 8f && targetDist < 1400f) + { + Particle spark = new SparkParticle(Projectile.Center + Projectile.velocity * 2f, Projectile.velocity, false, 2, 1.9f, Color.Lerp(Color.DarkOrchid, Color.IndianRed, Main.rand.NextFloat(0, 1)) * 0.85f); + GeneralParticleHandler.SpawnParticle(spark); + } + + if (time > 8 && Main.rand.NextBool()) + { + Vector2 dustvel = -Projectile.velocity; + Dust dust = Dust.NewDustPerfect(Projectile.Center, 267, dustvel * Main.rand.NextFloat(0.1f, 1.2f), 0, default, Main.rand.NextFloat(0.7f, 0.9f)); + dust.noGravity = true; + dust.color = Color.Lerp(Color.DarkOrchid, Color.IndianRed, Main.rand.NextFloat(0, 1)); } // Update animation @@ -57,6 +78,8 @@ namespace CalamityMod.Projectiles.Melee } if (Projectile.frame >= NumAnimationFrames) Projectile.frame = 0; + + time++; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) @@ -69,34 +92,38 @@ namespace CalamityMod.Projectiles.Melee { SoundEngine.PlaySound(SoundID.NPCDeath55, Projectile.Center); - // Transform the projectile's hitbox into a big explosion - Projectile.position = Projectile.Center; - Projectile.width = Projectile.height = 140; - Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); - - Vector2 corner = new Vector2(Projectile.position.X, Projectile.position.Y); - for (int i = 0; i < 50; i++) + if (Projectile.owner == Main.myPlayer) { - int idx = Dust.NewDust(corner, Projectile.width, Projectile.height, 86, 0f, 0f, 0, new Color(210, 0, 255), 2.2f); - Main.dust[idx].noGravity = true; - Main.dust[idx].velocity *= 2.5f; - - idx = Dust.NewDust(corner, Projectile.width, Projectile.height, 118, 0f, 0f, 100, new Color(210, 0, 255), 1.8f); - Main.dust[idx].noGravity = true; - Main.dust[idx].velocity *= 1.8f; - - idx = Dust.NewDust(corner, Projectile.width, Projectile.height, 71, 0f, 0f, 100, new Color(210, 0, 255), 1.0f); - Main.dust[idx].noGravity = true; - Main.dust[idx].velocity *= 4.0f; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage / 2, 0, Projectile.owner, 1f, 0f, 0f); + } + for (int k = 0; k < 10; k++) + { + Vector2 velocity = new Vector2(20, 20).RotatedByRandom(100) * Main.rand.NextFloat(0.3f, 1.2f); + float colorRando = Main.rand.NextFloat(0, 1); + Dust dust = Dust.NewDustPerfect(Projectile.Center + velocity, 278, velocity * Main.rand.NextFloat(0.2f, 1f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.3f, 0.65f); + dust.color = Color.Lerp(Color.DarkOrchid, Color.IndianRed, colorRando); + dust.noLight = true; + dust.noLightEmittence = true; + } + for (int k = 0; k < 10; k++) + { + Vector2 velocity = new Vector2(15, 15).RotatedByRandom(100) * Main.rand.NextFloat(0.3f, 1.2f); + float colorRando = Main.rand.NextFloat(0, 1); + Particle spark = new GlowSparkParticle(Projectile.Center + velocity, velocity, false, 11, Main.rand.NextFloat(0.015f, 0.025f), Color.Lerp(Color.DarkOrchid, Color.IndianRed, colorRando), new Vector2(2.2f, 0.9f), true); + GeneralParticleHandler.SpawnParticle(spark); + } + for (float k = 0; k < 3; k++) + { + float colorRando = Main.rand.NextFloat(0, 1); + int partLifetime = Main.rand.Next(13, 15 + 1); + float scale = Main.rand.NextFloat(0.12f, 0.18f); + Vector2 spawnPos = Projectile.Center + (Main.rand.NextVector2Circular(20, 20) * (k + 1)); + Particle blastRing = new CustomPulse(spawnPos, Vector2.Zero, Color.Lerp(Color.DarkOrchid, Color.IndianRed, colorRando) * 0.6f, "CalamityMod/Particles/FlameExplosion", Vector2.One, Main.rand.NextFloat(-10, 10), 0.07f, scale, partLifetime); + GeneralParticleHandler.SpawnParticle(blastRing); } - - // Make the projectile ignore iframes while exploding - Projectile.maxPenetrate = -1; - Projectile.penetrate = -1; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; - Projectile.Damage(); } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 30, targetHitbox); } } diff --git a/Projectiles/Melee/AtaraxiaSide.cs b/Projectiles/Melee/AtaraxiaSide.cs index 9bea310b57..9af813ba37 100644 --- a/Projectiles/Melee/AtaraxiaSide.cs +++ b/Projectiles/Melee/AtaraxiaSide.cs @@ -1,8 +1,9 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -11,6 +12,7 @@ namespace CalamityMod.Projectiles.Melee public new string LocalizationCategory => "Projectiles.Melee"; private static int NumAnimationFrames = 5; private static int AnimationFrameTime = 9; + public int time = 0; public override void SetStaticDefaults() { @@ -25,27 +27,38 @@ namespace CalamityMod.Projectiles.Melee Projectile.DamageType = DamageClass.Melee; Projectile.ignoreWater = true; Projectile.penetrate = 1; - Projectile.extraUpdates = 3; - Projectile.timeLeft = 180; + Projectile.tileCollide = false; + Projectile.extraUpdates = 5; + Projectile.timeLeft = 300; } public override void AI() { + Player Owner = Main.player[Projectile.owner]; + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); + DrawOffsetX = -28; DrawOriginOffsetY = -2; DrawOriginOffsetX = 12; - Projectile.rotation = Projectile.velocity.ToRotation(); + if (Projectile.ai[1] == 2) + { + Projectile.rotation = (Projectile.velocity.RotatedBy(0.2f)).ToRotation(); + } + else + { + Projectile.rotation = (Projectile.velocity.RotatedBy(-0.2f)).ToRotation(); + } // Light Lighting.AddLight(Projectile.Center, 0.3f, 0.1f, 0.45f); - // Spawn dust with a 3/4 chance - if (Main.rand.Next(4) != 3) + if (time > 8 && Main.rand.NextBool()) { - int idx = Dust.NewDust(Projectile.Center, 1, 1, 70); - Main.dust[idx].position = Projectile.Center; - Main.dust[idx].noGravity = true; - Main.dust[idx].velocity *= 0.25f; + float colorRando = Main.rand.NextFloat(0, 1); + Vector2 dustvel = Projectile.ai[1] == 2 ? Projectile.velocity.RotatedBy(0.2f) : Projectile.velocity.RotatedBy(-0.2f); + Dust dust = Dust.NewDustPerfect(Projectile.Center + Projectile.velocity, 261, -dustvel * Main.rand.NextFloat(0.2f, 1.2f), 0, default, Main.rand.NextFloat(0.4f, 0.6f)); + dust.noGravity = true; + dust.color = Color.Lerp(Color.DarkOrchid, Color.IndianRed, colorRando); } // Update animation @@ -57,6 +70,8 @@ namespace CalamityMod.Projectiles.Melee } if (Projectile.frame >= NumAnimationFrames) Projectile.frame = 0; + + time++; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) @@ -69,10 +84,10 @@ namespace CalamityMod.Projectiles.Melee { SoundEngine.PlaySound(SoundID.Item89, Projectile.Center); - // Individual split projectiles deal 5% damage per hit. + // Individual split projectiles deal 2% damage per hit. int numSplits = 6; int splitID = ModContent.ProjectileType(); - int damage = (int)(Projectile.damage * 0.05f); + int damage = (int)(Projectile.damage * 0.02f); float angleVariance = MathHelper.TwoPi / numSplits; Vector2 projVec = new Vector2(4.5f, 0f).RotatedByRandom(MathHelper.TwoPi); @@ -83,5 +98,6 @@ namespace CalamityMod.Projectiles.Melee Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, projVec, splitID, damage, 1.5f, Main.myPlayer); } } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 15, targetHitbox); } } diff --git a/Projectiles/Melee/AtaraxiaSplit.cs b/Projectiles/Melee/AtaraxiaSplit.cs index 3e9049d21a..f31f690d52 100644 --- a/Projectiles/Melee/AtaraxiaSplit.cs +++ b/Projectiles/Melee/AtaraxiaSplit.cs @@ -1,5 +1,7 @@ using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Melee { public class AtaraxiaSplit : ModProjectile, ILocalizedModType @@ -12,6 +14,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.friendly = true; Projectile.DamageType = DamageClass.Melee; Projectile.penetrate = -1; + Projectile.extraUpdates = 2; Projectile.usesIDStaticNPCImmunity = true; Projectile.idStaticNPCHitCooldown = 6; Projectile.timeLeft = 25; @@ -38,7 +41,7 @@ namespace CalamityMod.Projectiles.Melee // Spawn dust, with less dust as it fades away if (Main.rand.Next(256) > Projectile.alpha - 60) { - int idx = Dust.NewDust(Projectile.Center, 1, 1, 71); + int idx = Dust.NewDust(Projectile.Center, 1, 1, DustID.UndergroundHallowedEnemies); Main.dust[idx].position = Projectile.Center - Projectile.velocity * 0.7f; Main.dust[idx].noGravity = true; Main.dust[idx].velocity *= 0.3f; diff --git a/Projectiles/Melee/BalefulHarvesterProjectile.cs b/Projectiles/Melee/BalefulHarvesterProjectile.cs index 6abc9e648a..d5371d6a92 100644 --- a/Projectiles/Melee/BalefulHarvesterProjectile.cs +++ b/Projectiles/Melee/BalefulHarvesterProjectile.cs @@ -1,9 +1,9 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -14,7 +14,7 @@ namespace CalamityMod.Projectiles.Melee { ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; ProjectileID.Sets.TrailingMode[Projectile.type] = 0; - Main.projFrames[Projectile.type] = 5; + Main.projFrames[Projectile.type] = 5; } public override void SetDefaults() @@ -46,7 +46,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.alpha = 0; } - Projectile.frameCounter++; + Projectile.frameCounter++; if (Projectile.frameCounter > 6) { Projectile.frame++; @@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Melee int npcTracker = (int)Projectile.ai[0]; if (Main.npc[npcTracker].active) { - Vector2 projDirection = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); + Vector2 projDirection = Projectile.Center; float projXVel = Main.npc[npcTracker].position.X - projDirection.X; float projYVel = Main.npc[npcTracker].position.Y - projDirection.Y; float projVelocity = (float)Math.Sqrt((double)(projXVel * projXVel + projYVel * projYVel)); @@ -99,7 +99,7 @@ namespace CalamityMod.Projectiles.Melee else { Projectile.spriteDirection = 1; - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X); + Projectile.rotation = Projectile.velocity.ToRotation(); } for (int j = 0; j < 2; j++) @@ -135,7 +135,7 @@ namespace CalamityMod.Projectiles.Melee SoundEngine.PlaySound(SoundID.Dig, Projectile.position); for (int j = 0; j < 5; j++) { - int deathDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 5, 0f, 0f, 100, default, 2f); + int deathDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Blood, 0f, 0f, 100, default, 2f); Main.dust[deathDust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -145,10 +145,10 @@ namespace CalamityMod.Projectiles.Melee } for (int k = 0; k < 10; k++) { - int deathDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 3f); + int deathDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 3f); Main.dust[deathDust2].noGravity = true; Main.dust[deathDust2].velocity *= 5f; - deathDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 2f); + deathDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 2f); Main.dust[deathDust2].velocity *= 2f; } } @@ -158,11 +158,11 @@ namespace CalamityMod.Projectiles.Melee target.AddBuff(BuffID.OnFire3, 240); if (Projectile.owner == Main.myPlayer) { - for (int k = 0; k < 2; k++) + int maxProjectiles = 2; + for (int k = 0; k < maxProjectiles; k++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 174, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, Main.rand.Next(-35, 36) * 0.2f, Main.rand.Next(-35, 36) * 0.2f, ModContent.ProjectileType(), - (int)(Projectile.damage * 0.35), Projectile.knockBack * 0.35f, Main.myPlayer, 0f, 0f); + Vector2 flareVelocity = Main.rand.NextVector2CircularEdge(3.5f, 3.5f) + Projectile.oldVelocity; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, flareVelocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.35), Projectile.knockBack * 0.35f, Main.myPlayer); } } } diff --git a/Projectiles/Melee/BallOFuguProj.cs b/Projectiles/Melee/BallOFuguProj.cs index fc786dfeac..08ab2fec41 100644 --- a/Projectiles/Melee/BallOFuguProj.cs +++ b/Projectiles/Melee/BallOFuguProj.cs @@ -1,10 +1,10 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Melee { Player player = Main.player[Projectile.owner]; Vector2 projVector = player.Center - Projectile.Center; - Projectile.rotation = projVector.ToRotation() - 1.57f; + Projectile.rotation = projVector.ToRotation() - MathHelper.PiOver2; if (player.dead) { Projectile.Kill(); @@ -108,7 +108,7 @@ namespace CalamityMod.Projectiles.Melee Vector2 origin = new Vector2((float)texture2D2.Width * 0.5f, (float)texture2D2.Height * 0.5f); float projHeight = (float)texture2D2.Height; Vector2 actualCenter = mountedCenter - projCenter; - float drawRotation = (float)Math.Atan2((double)actualCenter.Y, (double)actualCenter.X) - 1.57f; + float drawRotation = (float)Math.Atan2((double)actualCenter.Y, (double)actualCenter.X) - MathHelper.PiOver2; bool isActive = true; if (float.IsNaN(projCenter.X) && float.IsNaN(projCenter.Y)) { diff --git a/Projectiles/Melee/BansheeHookBoom.cs b/Projectiles/Melee/BansheeHookBoom.cs index 81d597f932..98a6105057 100644 --- a/Projectiles/Melee/BansheeHookBoom.cs +++ b/Projectiles/Melee/BansheeHookBoom.cs @@ -1,6 +1,8 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Melee { public class BansheeHookBoom : ModProjectile, ILocalizedModType @@ -42,16 +44,16 @@ namespace CalamityMod.Projectiles.Melee Projectile.Damage(); for (int i = 0; i < 2; i++) { - int bansheeDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 100, default, 1.5f); + 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; } for (int j = 0; j < 5; j++) { - int bansheeDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 200, default, 2.7f); + 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].noGravity = true; Main.dust[bansheeDust2].velocity *= 3f; - bansheeDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 100, default, 1.5f); + 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].velocity *= 2f; Main.dust[bansheeDust2].noGravity = true; @@ -59,14 +61,14 @@ namespace CalamityMod.Projectiles.Melee } for (int k = 0; k < 2; k++) { - int bansheeDust3 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 0, default, 2.7f); + 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].noGravity = true; Main.dust[bansheeDust3].velocity *= 3f; } for (int l = 0; l < 5; l++) { - int spiritDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 180, 0f, 0f, 0, default, 1.5f); + 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].noGravity = true; Main.dust[spiritDust].velocity *= 3f; diff --git a/Projectiles/Melee/BansheeHookScythe.png b/Projectiles/Melee/BansheeHookScythe.png index c1c6f23d01..919bc83d16 100644 Binary files a/Projectiles/Melee/BansheeHookScythe.png and b/Projectiles/Melee/BansheeHookScythe.png differ diff --git a/Projectiles/Melee/BiomeBladeHoldout.cs b/Projectiles/Melee/BiomeBladeHoldout.cs index 7b1c20ffe2..c87f35d666 100644 --- a/Projectiles/Melee/BiomeBladeHoldout.cs +++ b/Projectiles/Melee/BiomeBladeHoldout.cs @@ -1,15 +1,16 @@ -using CalamityMod.DataStructures; +using System; +using CalamityMod.DataStructures; +using CalamityMod.Items.Weapons.Melee; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Items.Weapons.Melee; -using static Terraria.ModLoader.ModContent; using static CalamityMod.CalamityUtils; -using Terraria.Audio; +using static Terraria.ModLoader.ModContent; namespace CalamityMod.Projectiles.Melee { @@ -177,7 +178,7 @@ namespace CalamityMod.Projectiles.Melee else if (ChanneledState == 1f) { - Texture2D tex = Request(Texture).Value; + Texture2D tex = TextureAssets.Projectile[Projectile.type].Value; Vector2 squishyScale = new Vector2(Math.Abs((float)Math.Sin(MathHelper.Pi + MathHelper.TwoPi * Projectile.timeLeft / 30f)), 1f); SpriteEffects flip = (float)Math.Sin(MathHelper.Pi + MathHelper.TwoPi * Projectile.timeLeft / 30f) > 0 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; Main.EntitySpriteDraw(tex, Projectile.position - Main.screenPosition, null, lightColor * (Projectile.timeLeft / 60f), 0, tex.Size() / 2, squishyScale * (2f - (Projectile.timeLeft / 60f)), flip, 0); diff --git a/Projectiles/Melee/BladecrestOathswordProj.cs b/Projectiles/Melee/BladecrestOathswordProj.cs index 110a0ce3bd..a7d2d28243 100644 --- a/Projectiles/Melee/BladecrestOathswordProj.cs +++ b/Projectiles/Melee/BladecrestOathswordProj.cs @@ -1,9 +1,9 @@ -using CalamityMod.Items.Weapons.Melee; -using CalamityMod.Projectiles.BaseProjectiles; -using Microsoft.Xna.Framework; -using System; +using System; using System.IO; using CalamityMod.Effects; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Projectiles.BaseProjectiles; +using Microsoft.Xna.Framework; using Terraria; using Terraria.Graphics.Effects; using Terraria.Graphics.Shaders; @@ -77,7 +77,7 @@ namespace CalamityMod.Projectiles.Melee DecideCurrentState(); Direction = Owner.direction; - + //Set the owner's arm to rotate with the blade if (Owner.itemAnimation > 0) { @@ -137,7 +137,7 @@ namespace CalamityMod.Projectiles.Melee // Offset the blade so that the handle is attached to the owner's hand. Vector2 bladeOffset = (Projectile.rotation - MathHelper.PiOver4).ToRotationVector2() * Projectile.width * 0.65f; - bladeOffset += Vector2.UnitY * Owner.gfxOffY; + bladeOffset += Vector2.UnitY * Owner.gfxOffY; Projectile.position += bladeOffset; // Create demon magic dust along the blade when swinging, as well as demon blood scythes. @@ -186,7 +186,7 @@ namespace CalamityMod.Projectiles.Melee CurrentState = SwingState.Default; } } - + public override bool PreDraw(ref Color lightColor) { Main.spriteBatch.EnterShaderRegion(); @@ -206,14 +206,14 @@ namespace CalamityMod.Projectiles.Melee GameShaders.Misc["CalamityMod:LinearTransformation"].Apply(); CalamityUtils.DrawAfterimagesCentered(Projectile, 2, lightColor); - + Main.spriteBatch.ExitShaderRegion(); - + CalamityUtils.CalculatePerspectiveMatricies(out var view, out var proj); CalamityShaders.PrimitiveClearShader.Parameters["uWorldViewProjection"].SetValue(view * proj); CalamityShaders.PrimitiveClearShader.CurrentTechnique.Passes[0].Apply(); Filters.Scene["CalamityMod:PrimitiveClearShader"].GetShader().Shader.CurrentTechnique.Passes[0].Apply(); - + return false; } diff --git a/Projectiles/Melee/BlazingPhantomBlade.cs b/Projectiles/Melee/BlazingPhantomBlade.cs index cfd9547d08..98223ec271 100644 --- a/Projectiles/Melee/BlazingPhantomBlade.cs +++ b/Projectiles/Melee/BlazingPhantomBlade.cs @@ -1,5 +1,11 @@ -using Microsoft.Xna.Framework; +using System; +using CalamityMod.DataStructures; +using CalamityMod.Items.Weapons.Melee; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; @@ -8,58 +14,277 @@ namespace CalamityMod.Projectiles.Melee public class BlazingPhantomBlade : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; + + internal const float StartingScale = 1f; + + internal const float SunlightBladeMaxVelocity = DefiledGreatsword.ShootSpeed * 2f; + internal const int SunlightBladePierce = 10; + + internal const float FadeInTime = 30f; + internal const float FadeOutTime = 30f; + public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 20; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.NoMeleeSpeedVelocityScaling[Projectile.type] = true; + Main.projFrames[Projectile.type] = 4; } public override void SetDefaults() { - Projectile.width = 50; - Projectile.height = 50; - Projectile.aiStyle = ProjAIStyleID.Sickle; - Projectile.alpha = 100; + Projectile.width = 30; + Projectile.height = 30; + Projectile.alpha = 255; Projectile.friendly = true; Projectile.DamageType = DamageClass.Melee; Projectile.tileCollide = false; - Projectile.penetrate = 5; + Projectile.penetrate = -1; // Blazing blades and hyper blades hit four times, sunlight blades hit ten times. Projectile.ignoreWater = true; - AIType = ProjectileID.DeathSickle; - Projectile.MaxUpdates = 2; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 20 * Projectile.MaxUpdates; - Projectile.timeLeft = 210 * Projectile.MaxUpdates; + Projectile.localNPCHitCooldown = 20; + Projectile.timeLeft = 220; + Projectile.noEnchantmentVisuals = true; + Projectile.scale = StartingScale; } public override void AI() { - Lighting.AddLight(Projectile.Center, 0.6f, 0f, 0f); + // True Night's Edge AI + //float fadeInTime = 30f; + //float fadeOutTime = 30f; - float homingSpeed = (Projectile.ai[0] == 1f ? 8f : 4f); - CalamityUtils.HomeInOnNPC(Projectile, true, 250f, homingSpeed, 20f); + // Defiled Greatsword has three variants for this projectile + float fullyVisibleDuration = Projectile.ai[1]; + bool hyperBlade = fullyVisibleDuration == DefiledGreatsword.ProjectileFullyVisibleDuration + DefiledGreatsword.ProjectileFullyVisibleDurationIncreasePerAdditionalProjectile; + bool sunlightBlade = fullyVisibleDuration == DefiledGreatsword.ProjectileFullyVisibleDuration + DefiledGreatsword.ProjectileFullyVisibleDurationIncreasePerAdditionalProjectile * 2f; + + float timeBeforeFadeOut = fullyVisibleDuration + FadeInTime; + float projectileDuration = timeBeforeFadeOut + FadeOutTime; + + if (Projectile.localAI[0] == 0f) + SoundEngine.PlaySound(SoundID.Item8, Projectile.Center); + + Projectile.localAI[0] += 1f; + Projectile.Opacity = Utils.Remap(Projectile.localAI[0], 0f, fullyVisibleDuration, 0f, 1f) * Utils.Remap(Projectile.localAI[0], timeBeforeFadeOut, projectileDuration, 1f, 0f); + if (Projectile.localAI[0] >= projectileDuration) + { + Projectile.localAI[1] = 1f; + Projectile.Kill(); + return; + } + + Player player = Main.player[Projectile.owner]; + Projectile.direction = (Projectile.spriteDirection = (int)Projectile.ai[0]); + + Projectile.localAI[1] += 1f; + Projectile.rotation += Projectile.ai[0] * MathHelper.TwoPi * (4f + Projectile.Opacity * 4f) / 90f; + Projectile.scale = Utils.Remap(Projectile.localAI[0], fullyVisibleDuration + 2f, projectileDuration, 1.12f, 1f) * Projectile.ai[2] * StartingScale; + float randomDustSpawnLocation = Projectile.rotation + Main.rand.NextFloatDirection() * MathHelper.PiOver2 * 0.7f; + Vector2 dustPosition = Projectile.Center + randomDustSpawnLocation.ToRotationVector2() * 84f * Projectile.scale; + if (Main.rand.NextBool(3)) + { + Dust dust = Dust.NewDustPerfect(dustPosition, DustID.Venom, null, 100, default, 1.4f); + dust.noGravity = true; + dust.velocity *= 0f; + dust.fadeIn = 1.5f; + } + + for (int i = 0; (float)i < 3f * Projectile.Opacity; i++) + { + Vector2 dustVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitX); + int dustType1 = sunlightBlade ? DustID.IchorTorch : hyperBlade ? DustID.CursedTorch : DustID.CrimsonTorch; + int dustType2 = sunlightBlade ? DustID.YellowTorch : hyperBlade ? DustID.GreenTorch : DustID.RedTorch; + int dustType = ((Main.rand.NextFloat() < Projectile.Opacity) ? dustType1 : dustType2); + Dust dust = Dust.NewDustPerfect(dustPosition, dustType, Projectile.velocity * 0.2f + dustVelocity * 3f, 100, default, 1.4f); + dust.noGravity = true; + dust.customData = Projectile.Opacity * 0.2f; + } + + // Home in on targets + if (!sunlightBlade) + { + CalamityUtils.HomeInOnNPC(Projectile, true, hyperBlade ? 500f : 250f, hyperBlade ? 16f : 8f, hyperBlade ? 10f : 15f); + } + + // Sunlight Blades accelerate + else + { + if (Projectile.velocity.Length() < SunlightBladeMaxVelocity) + { + Projectile.velocity *= 1.05f; + if (Projectile.velocity.Length() > SunlightBladeMaxVelocity) + { + Projectile.velocity.Normalize(); + Projectile.velocity *= SunlightBladeMaxVelocity; + } + } + } + + // Enchantment visual bullshit + Vector2 boxPosition = Projectile.position; + int boxWidth = Projectile.width; + int boxHeight = Projectile.height; + for (float i = -MathHelper.PiOver4; i <= MathHelper.PiOver4; i += MathHelper.PiOver2) + { + Rectangle rect = Utils.CenteredRectangle(Projectile.Center + (Projectile.rotation + i).ToRotationVector2() * 70f * Projectile.scale, new Vector2(60f * Projectile.scale, 60f * Projectile.scale)); + Projectile.EmitEnchantmentVisualsAt(rect.TopLeft(), rect.Width, rect.Height); + } } - public override Color? GetAlpha(Color lightColor) + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { - if (Projectile.timeLeft < 85) - { - byte b2 = (byte)(Projectile.timeLeft * 3); - byte a2 = (byte)(100f * (b2 / 255f)); - return new Color(b2, b2, b2, a2); - } - return new Color(255, 255, 255, 100); + Vector2 distanceFromTarget = targetHitbox.ClosestPointInRect(Projectile.Center) - Projectile.Center; + distanceFromTarget.SafeNormalize(Vector2.UnitX); + float projectileSize = 100f * Projectile.scale; + if (distanceFromTarget.Length() < projectileSize && Collision.CanHit(Projectile.Center, 0, 0, targetHitbox.Center.ToVector2(), 0, 0)) + return true; + + return null; + } + + public override void CutTiles() + { + Vector2 startPoint = (Projectile.rotation - MathHelper.PiOver4).ToRotationVector2() * 60f * Projectile.scale; + Vector2 endPoint = (Projectile.rotation + MathHelper.PiOver4).ToRotationVector2() * 60f * Projectile.scale; + float projectileSize = 60f * Projectile.scale; + Utils.PlotTileLine(Projectile.Center + startPoint, Projectile.Center + endPoint, projectileSize, DelegateMethods.CutTiles); } public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + // Defiled Greatsword has three variants for this projectile + float fullyVisibleDuration = Projectile.ai[1]; + bool hyperBlade = fullyVisibleDuration == DefiledGreatsword.ProjectileFullyVisibleDuration + DefiledGreatsword.ProjectileFullyVisibleDurationIncreasePerAdditionalProjectile; + bool sunlightBlade = fullyVisibleDuration == DefiledGreatsword.ProjectileFullyVisibleDuration + DefiledGreatsword.ProjectileFullyVisibleDurationIncreasePerAdditionalProjectile * 2f; + + Texture2D asset = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Microsoft.Xna.Framework.Rectangle rectangle = asset.Frame(1, 4); + Vector2 origin = rectangle.Size() / 2f; + float num = Projectile.scale * 1.1f; + SpriteEffects effects = ((!(Projectile.ai[0] >= 0f)) ? SpriteEffects.FlipVertically : SpriteEffects.None); + float num2 = 0.975f; + float fromValue = Lighting.GetColor(Projectile.Center.ToTileCoordinates()).ToVector3().Length() / (float)Math.Sqrt(3D); + fromValue = Utils.Remap(fromValue, 0.2f, 1f, 0f, 1f); + float num3 = MathHelper.Min(0.15f + fromValue * 0.85f, Utils.Remap(Projectile.localAI[0], 30f, 96f, 1f, 0f)); + float num4 = 2f; + for (float num5 = num4; num5 >= 0f; num5 -= 1f) + { + if (!(Projectile.oldPos[(int)num5] == Vector2.Zero)) + { + Vector2 vectorScale = Projectile.Center - Projectile.velocity * 0.5f * num5; + float num6 = Projectile.oldRot[(int)num5] + Projectile.ai[0] * MathHelper.TwoPi * 0.1f * (0f - num5); + Vector2 position = vectorScale - Main.screenPosition; + float num7 = 1f - num5 / num4; + float num8 = Projectile.Opacity * num7 * num7 * 0.85f; + float amount = Projectile.Opacity * Projectile.Opacity; + + Color colorOne = Color.Lerp(new Color(sunlightBlade ? 20 : hyperBlade ? 60 : 40, sunlightBlade ? 40 : hyperBlade ? 20 : 60, sunlightBlade ? 60 : hyperBlade ? 40 : 20, 120), + new Color(sunlightBlade ? 225 : hyperBlade ? 25 : 225, sunlightBlade ? 225 : hyperBlade ? 225 : 40, sunlightBlade ? 25 : hyperBlade ? 40 : 25, 120), amount); + + Main.spriteBatch.Draw(asset, position, rectangle, colorOne * num3 * num8, num6 + Projectile.ai[0] * MathHelper.PiOver4 * -1f, origin, num * num2, effects, 0f); + + Color colorTwo = Color.Lerp(new Color(sunlightBlade ? 40 : hyperBlade ? 180 : 80, sunlightBlade ? 80 : hyperBlade ? 40 : 180, sunlightBlade ? 180 : hyperBlade ? 80 : 40), + new Color(sunlightBlade ? 255 : hyperBlade ? 100 : 155, sunlightBlade ? 255 : hyperBlade ? 255 : 100, sunlightBlade ? 100 : hyperBlade ? 155 : 255), amount); + + Color color3 = Color.White * num8 * 0.5f; + color3.A = (byte)((float)(int)color3.A * (1f - num3)); + + Color color4 = color3 * num3 * 0.5f; + if (sunlightBlade) + { + color4.B = (byte)((float)(int)color4.B * num3); + color4.R = (byte)((float)(int)color4.R * (0.25f + num3 * 0.75f)); + } + else if (hyperBlade) + { + color4.G = (byte)((float)(int)color4.G * num3); + color4.B = (byte)((float)(int)color4.B * (0.25f + num3 * 0.75f)); + } + else + { + color4.R = (byte)((float)(int)color4.R * num3); + color4.G = (byte)((float)(int)color4.G * (0.25f + num3 * 0.75f)); + } + + float num9 = 3f; + for (float num10 = -MathHelper.TwoPi + MathHelper.TwoPi / num9; num10 < 0f; num10 += MathHelper.TwoPi / num9) + { + float num11 = Utils.Remap(num10, -MathHelper.TwoPi, 0f, 0f, 0.5f); + Main.spriteBatch.Draw(asset, position, rectangle, color4 * 0.15f * num11, num6 + Projectile.ai[0] * 0.01f + num10, origin, num, effects, 0f); + + Main.spriteBatch.Draw(asset, position, rectangle, Color.Lerp(new Color(sunlightBlade ? 30 : hyperBlade ? 160 : 80, sunlightBlade ? 80 : hyperBlade ? 30 : 160, sunlightBlade ? 160 : hyperBlade ? 80 : 30), + new Color(sunlightBlade ? 200 : hyperBlade ? 255 : 200, sunlightBlade ? 200 : hyperBlade ? 200 : 0, sunlightBlade ? 255 : hyperBlade ? 0 : 255), amount) * fromValue * num8 * num11, + num6 + num10, origin, num * 0.8f, effects, 0f); + + Main.spriteBatch.Draw(asset, position, rectangle, colorTwo * fromValue * num8 * MathHelper.Lerp(0.05f, 0.4f, fromValue) * num11, num6 + num10, origin, num * num2, effects, 0f); + + Main.spriteBatch.Draw(asset, position, asset.Frame(1, 4, 0, 3), + new Color(sunlightBlade ? 150 : hyperBlade ? 255 : 200, sunlightBlade ? 255 : hyperBlade ? 200 : 150, sunlightBlade ? 200 : hyperBlade ? 150 : 255) * MathHelper.Lerp(0.05f, 0.5f, fromValue) * num8 * num11, + num6 + num10, origin, num, effects, 0f); + } + + Main.spriteBatch.Draw(asset, position, rectangle, color4 * 0.15f, num6 + Projectile.ai[0] * 0.01f, origin, num, effects, 0f); + + Main.spriteBatch.Draw(asset, position, rectangle, Color.Lerp(new Color(sunlightBlade ? 30 : hyperBlade ? 160 : 80, sunlightBlade ? 80 : hyperBlade ? 30 : 160, sunlightBlade ? 160 : hyperBlade ? 80 : 30), + new Color(sunlightBlade ? 255 : hyperBlade ? 0 : 255, sunlightBlade ? 255 : hyperBlade ? 255 : 100, sunlightBlade ? 0 : hyperBlade ? 100 : 0), amount) * num3 * num8, num6, origin, num * 0.8f, effects, 0f); + + Main.spriteBatch.Draw(asset, position, rectangle, colorTwo * fromValue * num8 * MathHelper.Lerp(0.05f, 0.4f, num3), num6, origin, num * num2, effects, 0f); + + Main.spriteBatch.Draw(asset, position, asset.Frame(1, 4, 0, 3), + new Color(sunlightBlade ? 255 : hyperBlade ? 100 : 255, sunlightBlade ? 255 : hyperBlade ? 255 : 75, sunlightBlade ? 75 : hyperBlade ? 75 : 100) * MathHelper.Lerp(0.05f, 0.5f, num3) * num8, + num6, origin, num, effects, 0f); + } + } + + float num12 = 1f - Projectile.localAI[0] * 1f / 80f; + if (num12 < 0.5f) + num12 = 0.5f; + + float num13 = MathHelper.Min(num3, MathHelper.Lerp(1f, fromValue, Utils.Remap(Projectile.localAI[0], 0f, 80f, 0f, 1f))); + + Texture2D value = TextureAssets.Extra[98].Value; + SpriteEffects dir = SpriteEffects.None; + Vector2 drawpos = Projectile.Center - Main.screenPosition + (Projectile.rotation + (MathHelper.Pi / (20f / 3f)) * Projectile.ai[0]).ToRotationVector2() * ((float)asset.Width * 0.5f - 4f) * num * num12; + Color drawColor = new Color(255, 255, 255, 0) * Projectile.Opacity * 0.5f * num13; + Color shineColor = new Color(sunlightBlade ? 255 : hyperBlade ? 50 : 255, sunlightBlade ? 255 : hyperBlade ? 255 : 75, sunlightBlade ? 50 : hyperBlade ? 75 : 50) * num13; + Color color = shineColor * Projectile.Opacity * 0.5f; + color.A = 0; + float flareCounter = Projectile.Opacity; + float fadeInStart = 0f; + float fadeInEnd = 1f; + float fadeOutStart = 1f; + float fadeOutEnd = 2f; + float rotation = MathHelper.PiOver4; + Vector2 scale = new Vector2(2f, 2f); + Vector2 fatness = Vector2.One; + Vector2 origin2 = value.Size() / 2f; + Color color2 = drawColor * 0.5f; + float num14 = Utils.GetLerpValue(fadeInStart, fadeInEnd, flareCounter, clamped: true) * Utils.GetLerpValue(fadeOutEnd, fadeOutStart, flareCounter, clamped: true); + Vector2 vector = new Vector2(fatness.X * 0.5f, scale.X) * num14; + Vector2 vector2 = new Vector2(fatness.Y * 0.5f, scale.Y) * num14; + color *= num14; + color2 *= num14; + Main.EntitySpriteDraw(value, drawpos, null, color, MathHelper.PiOver2 + rotation, origin2, vector, dir); + Main.EntitySpriteDraw(value, drawpos, null, color, 0f + rotation, origin2, vector2, dir); + Main.EntitySpriteDraw(value, drawpos, null, color2, MathHelper.PiOver2 + rotation, origin2, vector * 0.6f, dir); + Main.EntitySpriteDraw(value, drawpos, null, color2, 0f + rotation, origin2, vector2 * 0.6f, dir); + return false; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(BuffID.OnFire3, 180); + target.AddBuff(BuffID.Venom, 120); + target.AddBuff(BuffID.OnFire3, 120); + + bool sunlightBlade = Projectile.ai[1] == DefiledGreatsword.ProjectileFullyVisibleDuration + DefiledGreatsword.ProjectileFullyVisibleDurationIncreasePerAdditionalProjectile * 2f; + if (Projectile.numHits >= (sunlightBlade ? SunlightBladePierce : 3)) + { + Projectile.localAI[0] = Projectile.ai[1] + FadeInTime; + } } + + public override bool? CanDamage() => Projectile.localAI[0] > Projectile.ai[1] + FadeInTime ? false : null; } } diff --git a/Projectiles/Melee/BlazingPhantomBlade.png b/Projectiles/Melee/BlazingPhantomBlade.png index 2041e18546..9a31d6718a 100644 Binary files a/Projectiles/Melee/BlazingPhantomBlade.png and b/Projectiles/Melee/BlazingPhantomBlade.png differ diff --git a/Projectiles/Melee/Blood.cs b/Projectiles/Melee/Blood.cs index bfa2b4bc7a..c0791c05b1 100644 --- a/Projectiles/Melee/Blood.cs +++ b/Projectiles/Melee/Blood.cs @@ -1,6 +1,10 @@ +using CalamityMod.Balancing; +using System; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Melee { public class Blood : ModProjectile, ILocalizedModType @@ -27,7 +31,7 @@ namespace CalamityMod.Projectiles.Melee { for (int i = 0; i < 2; i++) { - int blood = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 5, 0f, 0f, 100, default, 1f); + int blood = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Blood, 0f, 0f, 100, default, 1f); Main.dust[blood].noGravity = true; Main.dust[blood].velocity *= 0f; } @@ -39,13 +43,14 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - Player player = Main.player[Projectile.owner]; - if (player.moonLeech) + int heal = (int)Math.Round(hit.Damage * 0.075); + if (heal > BalancingConstants.LifeStealCap) + heal = BalancingConstants.LifeStealCap; + + if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) return; - int healAmt = 2; - player.statLife += healAmt; - player.HealEffect(healAmt); + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); } } } diff --git a/Projectiles/Melee/Blood2.cs b/Projectiles/Melee/Blood2.cs index 41e14a6e26..ee996f3ebe 100644 --- a/Projectiles/Melee/Blood2.cs +++ b/Projectiles/Melee/Blood2.cs @@ -1,7 +1,9 @@ using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Melee { public class Blood2 : ModProjectile, ILocalizedModType @@ -28,7 +30,7 @@ namespace CalamityMod.Projectiles.Melee { for (int i = 0; i < 2; i++) { - int blood = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 5, 0f, 0f, 100, default, 1f); + int blood = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Blood, 0f, 0f, 100, default, 1f); Main.dust[blood].noGravity = true; Main.dust[blood].velocity *= 0f; } diff --git a/Projectiles/Melee/BloodBall.cs b/Projectiles/Melee/BloodBall.cs index 89ab005342..f9ad15cf39 100644 --- a/Projectiles/Melee/BloodBall.cs +++ b/Projectiles/Melee/BloodBall.cs @@ -1,9 +1,9 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using Terraria; -using Terraria.ModLoader; -using Terraria.ID; using Terraria.Audio; -using CalamityMod.Buffs.DamageOverTime; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { @@ -62,7 +62,8 @@ namespace CalamityMod.Projectiles.Melee } } } - } catch + } + catch { } if (Projectile.owner == Main.myPlayer && Projectile.timeLeft <= 3) @@ -91,7 +92,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.netUpdate = true; } } - Projectile.velocity.Y = Projectile.velocity.Y + 0.2f; + Projectile.velocity.Y = Projectile.velocity.Y + 0.16f; } Projectile.rotation += Projectile.velocity.X * 0.1f; } @@ -107,15 +108,15 @@ namespace CalamityMod.Projectiles.Melee Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int i = 0; i < 20; i++) { - int blood = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 5, 0f, 0f, 100, default, 1.5f); + int blood = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Blood, 0f, 0f, 100, default, 1.5f); Main.dust[blood].velocity *= 1.4f; } for (int j = 0; j < 10; j++) { - int bloody = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 5, 0f, 0f, 100, default, 2.5f); + int bloody = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Blood, 0f, 0f, 100, default, 2.5f); Main.dust[bloody].noGravity = true; Main.dust[bloody].velocity *= 5f; - bloody = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 5, 0f, 0f, 100, default, 1.5f); + bloody = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Blood, 0f, 0f, 100, default, 1.5f); Main.dust[bloody].velocity *= 3f; } } diff --git a/Projectiles/Melee/BloodExplosion.cs b/Projectiles/Melee/BloodExplosion.cs index 6657e3bdfc..1b0c3b97fa 100644 --- a/Projectiles/Melee/BloodExplosion.cs +++ b/Projectiles/Melee/BloodExplosion.cs @@ -1,8 +1,8 @@ using CalamityMod.Buffs.DamageOverTime; using Terraria; -using Terraria.ModLoader; -using Terraria.ID; using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { diff --git a/Projectiles/Melee/BloodScythe.cs b/Projectiles/Melee/BloodScythe.cs index 5a760e6f83..4d993b0a31 100644 --- a/Projectiles/Melee/BloodScythe.cs +++ b/Projectiles/Melee/BloodScythe.cs @@ -1,6 +1,6 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -46,12 +46,12 @@ namespace CalamityMod.Projectiles.Melee } if (Main.rand.NextBool(5)) - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 5, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Blood, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } diff --git a/Projectiles/Melee/BonebreakerFragment1.cs b/Projectiles/Melee/BonebreakerFragment1.cs index 06c1a8592a..87dd2545b2 100644 --- a/Projectiles/Melee/BonebreakerFragment1.cs +++ b/Projectiles/Melee/BonebreakerFragment1.cs @@ -1,9 +1,9 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.StatDebuffs; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; -using Terraria.ModLoader; using Terraria.ID; -using CalamityMod.Buffs.StatDebuffs; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { diff --git a/Projectiles/Melee/BonebreakerProjectile.cs b/Projectiles/Melee/BonebreakerProjectile.cs index 17580a6fe9..817f36b1d3 100644 --- a/Projectiles/Melee/BonebreakerProjectile.cs +++ b/Projectiles/Melee/BonebreakerProjectile.cs @@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } @@ -69,7 +69,7 @@ namespace CalamityMod.Projectiles.Melee { for (int i = 0; i <= 3; i++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 78, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f, 0, default, 0.8f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.t_LivingWood, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f, 0, default, 0.8f); } if (Projectile.owner == Main.myPlayer) { @@ -82,7 +82,7 @@ namespace CalamityMod.Projectiles.Melee } velocity.Normalize(); velocity *= (float)Main.rand.Next(70, 101) * 0.1f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5f), Projectile.knockBack * 0.5f, Projectile.owner, Main.rand.Next(0,4), 0f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5f), Projectile.knockBack * 0.5f, Projectile.owner, Main.rand.Next(0, 4), 0f); } } } diff --git a/Projectiles/Melee/BotanicSpear.cs b/Projectiles/Melee/BotanicSpear.cs new file mode 100644 index 0000000000..75496fa354 --- /dev/null +++ b/Projectiles/Melee/BotanicSpear.cs @@ -0,0 +1,97 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class BotanicSpear : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + + private const int TimeLeft = 180; + + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + } + + public override void SetDefaults() + { + Projectile.width = 16; + Projectile.height = 16; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = -1; + Projectile.timeLeft = TimeLeft; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + } + + public override void AI() + { + Lighting.AddLight(Projectile.Center, 0f, 1f, 0f); + + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4; + + if (Projectile.localAI[1] == 0f) + { + Projectile.scale -= 0.01f; + Projectile.alpha += 15; + if (Projectile.alpha >= 125) + { + Projectile.alpha = 130; + Projectile.localAI[1] = 1f; + } + } + else if (Projectile.localAI[1] == 1f) + { + Projectile.scale += 0.01f; + Projectile.alpha -= 15; + if (Projectile.alpha <= 0) + { + Projectile.alpha = 0; + Projectile.localAI[1] = 0f; + } + } + + int dust = Dust.NewDust(Projectile.oldPosition + Projectile.oldVelocity, Projectile.width, Projectile.height, DustID.TerraBlade, 0f, 0f, 100, default, 1.25f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0f; + Main.dust[dust].noLightEmittence = true; + } + + public override void OnKill(int timeLeft) + { + SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); + for (int i = 4; i < 31; i++) + { + float projOldX = Projectile.oldVelocity.X * (30f / i); + float projOldY = Projectile.oldVelocity.Y * (30f / i); + int dust = Dust.NewDust(new Vector2(Projectile.oldPosition.X - projOldX, Projectile.oldPosition.Y - projOldY), 8, 8, DustID.TerraBlade, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.8f); + Main.dust[dust].noGravity = true; + Main.dust[dust].noLightEmittence = true; + + dust = Dust.NewDust(new Vector2(Projectile.oldPosition.X - projOldX, Projectile.oldPosition.Y - projOldY), 8, 8, DustID.TerraBlade, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.4f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0.1f; + Main.dust[dust].noLightEmittence = true; + } + } + + public override Color? GetAlpha(Color lightColor) => new Color(128, byte.MaxValue, 128); + + public override bool PreDraw(ref Color lightColor) + { + if (Projectile.timeLeft > TimeLeft - 5) + return false; + + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); + return false; + } + } +} diff --git a/Projectiles/Melee/TerraSpear.png b/Projectiles/Melee/BotanicSpear.png similarity index 100% rename from Projectiles/Melee/TerraSpear.png rename to Projectiles/Melee/BotanicSpear.png diff --git a/Projectiles/Melee/Brimblast.cs b/Projectiles/Melee/Brimblast.cs index c71cbaf998..035073dad3 100644 --- a/Projectiles/Melee/Brimblast.cs +++ b/Projectiles/Melee/Brimblast.cs @@ -1,5 +1,5 @@ -using CalamityMod.Dusts; -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; diff --git a/Projectiles/Melee/BrimlanceHellfireExplosion.cs b/Projectiles/Melee/BrimlanceHellfireExplosion.cs index 0a5c3cda46..49d5d4b713 100644 --- a/Projectiles/Melee/BrimlanceHellfireExplosion.cs +++ b/Projectiles/Melee/BrimlanceHellfireExplosion.cs @@ -1,11 +1,11 @@ -using CalamityMod.Dusts; +using System; using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; using Microsoft.Xna.Framework; -using System; using Terraria; -using Terraria.ModLoader; -using Terraria.ID; using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { @@ -80,7 +80,7 @@ namespace CalamityMod.Projectiles.Melee randAdjuster = rand3 / randAdjuster; rand1 *= randAdjuster; rand2 *= randAdjuster; - int brimDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1.5f); + int brimDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1.5f); Dust dust = Main.dust[brimDust]; dust.noGravity = true; dust.position.X = Projectile.Center.X; diff --git a/Projectiles/Melee/BrimlanceStandingFire.cs b/Projectiles/Melee/BrimlanceStandingFire.cs index bd898c12e0..a61c779db2 100644 --- a/Projectiles/Melee/BrimlanceStandingFire.cs +++ b/Projectiles/Melee/BrimlanceStandingFire.cs @@ -2,9 +2,9 @@ using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Terraria; -using Terraria.ModLoader; -using Terraria.ID; using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { diff --git a/Projectiles/Melee/Brimlash2.cs b/Projectiles/Melee/Brimlash2.cs index 252b5827c5..aab7079a2a 100644 --- a/Projectiles/Melee/Brimlash2.cs +++ b/Projectiles/Melee/Brimlash2.cs @@ -1,9 +1,9 @@ -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -38,7 +38,7 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.timeLeft < 90) CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 600f, 12f, 15f); - int redderDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 235, 0f, 0f, 100, default, 1f); + int redderDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.LifeDrain, 0f, 0f, 100, default, 1f); Main.dust[redderDust].noGravity = true; Main.dust[redderDust].velocity *= 0.5f; Main.dust[redderDust].velocity += Projectile.velocity * 0.1f; @@ -66,11 +66,11 @@ namespace CalamityMod.Projectiles.Melee { float dustX = Projectile.oldVelocity.X * (30f / (float)i); float dustY = Projectile.oldVelocity.Y * (30f / (float)i); - int deathDust = Dust.NewDust(new Vector2(Projectile.oldPosition.X - dustX, Projectile.oldPosition.Y - dustY), 8, 8, 235, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.8f); + int deathDust = Dust.NewDust(new Vector2(Projectile.oldPosition.X - dustX, Projectile.oldPosition.Y - dustY), 8, 8, DustID.LifeDrain, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.8f); Main.dust[deathDust].noGravity = true; Dust dust = Main.dust[deathDust]; dust.velocity *= 0.5f; - deathDust = Dust.NewDust(new Vector2(Projectile.oldPosition.X - dustX, Projectile.oldPosition.Y - dustY), 8, 8, 235, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.4f); + deathDust = Dust.NewDust(new Vector2(Projectile.oldPosition.X - dustX, Projectile.oldPosition.Y - dustY), 8, 8, DustID.LifeDrain, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.4f); dust = Main.dust[deathDust]; dust.velocity *= 0.05f; inc = i; diff --git a/Projectiles/Melee/BrimlashProj.cs b/Projectiles/Melee/BrimlashProj.cs index 58f21983d3..ce54bdae0b 100644 --- a/Projectiles/Melee/BrimlashProj.cs +++ b/Projectiles/Melee/BrimlashProj.cs @@ -1,11 +1,11 @@ +using System; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -41,7 +41,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.Kill(); } Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0.05f / 255f, (255 - Projectile.alpha) * 0.05f / 255f); - int brimDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1f); + int brimDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1f); Main.dust[brimDust].noGravity = true; Main.dust[brimDust].velocity *= 0.5f; Main.dust[brimDust].velocity += Projectile.velocity * 0.1f; diff --git a/Projectiles/Melee/BrimstoneBoom.cs b/Projectiles/Melee/BrimstoneBoom.cs index 9f40aef9c7..eadf3c961e 100644 --- a/Projectiles/Melee/BrimstoneBoom.cs +++ b/Projectiles/Melee/BrimstoneBoom.cs @@ -1,6 +1,6 @@ -using CalamityMod.Dusts; +using System; +using CalamityMod.Dusts; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee @@ -49,7 +49,7 @@ namespace CalamityMod.Projectiles.Melee randoAdjuster = rando3 / randoAdjuster; rando1 *= randoAdjuster; rando2 *= randoAdjuster; - int brimDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1f); + int brimDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1f); Main.dust[brimDust].noGravity = true; Main.dust[brimDust].position.X = Projectile.Center.X; Main.dust[brimDust].position.Y = Projectile.Center.Y; diff --git a/Projectiles/Melee/BrimstoneLaserFriendly.cs b/Projectiles/Melee/BrimstoneLaserFriendly.cs index 699823639d..74ccad171c 100644 --- a/Projectiles/Melee/BrimstoneLaserFriendly.cs +++ b/Projectiles/Melee/BrimstoneLaserFriendly.cs @@ -1,8 +1,8 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -33,7 +33,7 @@ namespace CalamityMod.Projectiles.Melee Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0.05f / 255f, (255 - Projectile.alpha) * 0.05f / 255f); Projectile.velocity.X *= 1.05f; Projectile.velocity.Y *= 1.05f; - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; Projectile.velocity.Y += Projectile.ai[0]; if (Main.rand.NextBool()) { @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } diff --git a/Projectiles/Melee/BrimstoneSwordExplosion.cs b/Projectiles/Melee/BrimstoneSwordExplosion.cs index 4424898918..582e18faaf 100644 --- a/Projectiles/Melee/BrimstoneSwordExplosion.cs +++ b/Projectiles/Melee/BrimstoneSwordExplosion.cs @@ -1,11 +1,11 @@ -using CalamityMod.Dusts; +using System; using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; using Microsoft.Xna.Framework; -using System; using Terraria; -using Terraria.ModLoader; -using Terraria.ID; using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { @@ -80,7 +80,7 @@ namespace CalamityMod.Projectiles.Melee randoAdjuster = rando3 / randoAdjuster; rando1 *= randoAdjuster; rando2 *= randoAdjuster; - int brimDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1.5f); + int brimDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1.5f); Dust dust = Main.dust[brimDust]; dust.noGravity = true; dust.position.X = Projectile.Center.X; diff --git a/Projectiles/Melee/BrimstoneSwordProj.cs b/Projectiles/Melee/BrimstoneSwordProj.cs index 2775358a60..4a38898b22 100644 --- a/Projectiles/Melee/BrimstoneSwordProj.cs +++ b/Projectiles/Melee/BrimstoneSwordProj.cs @@ -1,8 +1,8 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -30,7 +30,7 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + MathHelper.ToRadians(45f); + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.ToRadians(45f); if (Main.rand.NextBool(4)) { Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); @@ -46,7 +46,7 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.timeLeft > 595) return false; - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } diff --git a/Projectiles/Melee/BrinySpout.cs b/Projectiles/Melee/BrinySpout.cs index bd4cbec34a..8d243f41f0 100644 --- a/Projectiles/Melee/BrinySpout.cs +++ b/Projectiles/Melee/BrinySpout.cs @@ -1,6 +1,7 @@ -using Microsoft.Xna.Framework; +using System; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee @@ -98,7 +99,7 @@ namespace CalamityMod.Projectiles.Melee } if (Projectile.ai[0] <= 0f) { - float swaySize = 0.104719758f; + float swaySize = MathHelper.Pi / 30f; float smolWidth = (float)Projectile.width / 5f; smolWidth *= 2f; float projXChange = (float)(Math.Cos((double)(swaySize * -(double)Projectile.ai[0])) - 0.5) * smolWidth; @@ -116,11 +117,16 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - Texture2D texture2D13 = ModContent.Request(Texture).Value; - int framing = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; + Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + int framing = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; int y6 = framing * Projectile.frame; Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)framing / 2f), Projectile.scale, SpriteEffects.None, 0); return false; } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 180); + } } } diff --git a/Projectiles/Melee/BrinyTyphoonBubble.cs b/Projectiles/Melee/BrinyTyphoonBubble.cs index 5afc1be218..ad9261f9bd 100644 --- a/Projectiles/Melee/BrinyTyphoonBubble.cs +++ b/Projectiles/Melee/BrinyTyphoonBubble.cs @@ -1,9 +1,9 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; -using Terraria.ModLoader; -using Terraria.ID; using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Melee Vector2 dustRotate = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; dustRotate = dustRotate.RotatedBy((double)(i - (dustAmt / 2 - 1)) * 3.1415926535897931 / (double)(float)dustAmt, default) + Projectile.Center; Vector2 faceDirection = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); - int bluishDust = Dust.NewDust(dustRotate + faceDirection, 0, 0, 187, faceDirection.X * 2f, faceDirection.Y * 2f, 100, new Color(53, Main.DiscoG, 255), 1.4f); + int bluishDust = Dust.NewDust(dustRotate + faceDirection, 0, 0, DustID.Flare_Blue, faceDirection.X * 2f, faceDirection.Y * 2f, 100, new Color(53, Main.DiscoG, 255), 1.4f); Main.dust[bluishDust].noGravity = true; Main.dust[bluishDust].noLight = true; Main.dust[bluishDust].velocity /= 4f; @@ -103,7 +103,7 @@ namespace CalamityMod.Projectiles.Melee Vector2 rotate = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; rotate = rotate.RotatedBy((double)((float)(j - (moreDustAmt / 2 - 1)) * 6.28318548f / (float)moreDustAmt), default) + Projectile.Center; Vector2 facingDirection = rotate - Projectile.Center; - int killDust = Dust.NewDust(rotate + facingDirection, 0, 0, 187, facingDirection.X * 2f, facingDirection.Y * 2f, 100, new Color(53, Main.DiscoG, 255), 1.4f); + int killDust = Dust.NewDust(rotate + facingDirection, 0, 0, DustID.Flare_Blue, facingDirection.X * 2f, facingDirection.Y * 2f, 100, new Color(53, Main.DiscoG, 255), 1.4f); Main.dust[killDust].noGravity = true; Main.dust[killDust].noLight = true; Main.dust[killDust].velocity = facingDirection; @@ -138,7 +138,7 @@ namespace CalamityMod.Projectiles.Melee break; } } - int SPOUT = Projectile.NewProjectile(Projectile.GetSource_FromThis(), (float)(projTileY * 16 + 8), (float)(projTileX * 16 - 24), 0f, 0f, ModContent.ProjectileType(), Projectile.damage, 6f, Main.myPlayer, 8f, 25f); + int SPOUT = Projectile.NewProjectile(Projectile.GetSource_FromThis(), (float)(projTileY * 16 + 8), (float)(projTileX * 16 - 32), 0f, 0f, ModContent.ProjectileType(), Projectile.damage, 6f, Main.myPlayer, 3f, 7f); //First overload seems to deal with timing, second is segment amount Main.projectile[SPOUT].netUpdate = true; } } diff --git a/Projectiles/Melee/BrokenBiomeBladeHoldout.cs b/Projectiles/Melee/BrokenBiomeBladeHoldout.cs index 0617c875c0..08f7b76c91 100644 --- a/Projectiles/Melee/BrokenBiomeBladeHoldout.cs +++ b/Projectiles/Melee/BrokenBiomeBladeHoldout.cs @@ -1,15 +1,15 @@ -using CalamityMod.DataStructures; +using System; +using CalamityMod.DataStructures; +using CalamityMod.Items.Weapons.Melee; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Items.Weapons.Melee; -using static Terraria.ModLoader.ModContent; using static CalamityMod.CalamityUtils; -using Terraria.Audio; +using static Terraria.ModLoader.ModContent; namespace CalamityMod.Projectiles.Melee { @@ -182,7 +182,7 @@ namespace CalamityMod.Projectiles.Melee else if (ChanneledState == 1f) { - Texture2D tex = Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Vector2 squishyScale = new Vector2(Math.Abs((float)Math.Sin(MathHelper.Pi + MathHelper.TwoPi * Projectile.timeLeft / 30f)), 1f); SpriteEffects flip = (float)Math.Sin(MathHelper.Pi + MathHelper.TwoPi * Projectile.timeLeft / 30f) > 0 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; Main.EntitySpriteDraw(tex, Projectile.position - Main.screenPosition, null, lightColor * (Projectile.timeLeft / 60f), 0, tex.Size() / 2, squishyScale * (2f - (Projectile.timeLeft / 60f)), flip, 0); diff --git a/Projectiles/Melee/BrokenBiomeBlade_AridGrandeur.cs b/Projectiles/Melee/BrokenBiomeBlade_AridGrandeur.cs index babd63e22f..52e1b475a3 100644 --- a/Projectiles/Melee/BrokenBiomeBlade_AridGrandeur.cs +++ b/Projectiles/Melee/BrokenBiomeBlade_AridGrandeur.cs @@ -1,14 +1,14 @@ -using CalamityMod.Particles; +using System; +using System.IO; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee @@ -24,14 +24,10 @@ namespace CalamityMod.Projectiles.Melee public ref float PogoCooldown => ref Projectile.ai[1]; //Cooldown for the pogo public Player Owner => Main.player[Projectile.owner]; public bool CanPogo => Owner.velocity.Y != 0 && PogoCooldown <= 0; //Only pogo when in the air and if the cooldown is zero - private bool OwnerCanShoot => Owner.channel && !Owner.noItems && !Owner.CCed; public const float pogoStrenght = 16f; //How much the player gets pogoed up public const float maxShred = 500; //How much shred you get - public override void SetStaticDefaults() - { - } public override void SetDefaults() { Projectile.DamageType = DamageClass.Melee; @@ -102,7 +98,7 @@ namespace CalamityMod.Projectiles.Melee initialized = true; } - if (!OwnerCanShoot) + if (Owner.CantUseHoldout()) { Projectile.Kill(); return; @@ -139,7 +135,7 @@ namespace CalamityMod.Projectiles.Melee Owner.itemRotation = direction.ToRotation(); if (Owner.direction != 1) { - Owner.itemRotation -= 3.14f; + Owner.itemRotation -= MathHelper.Pi; } Owner.itemRotation = MathHelper.WrapAngle(Owner.itemRotation); Owner.itemTime = 2; @@ -186,7 +182,11 @@ namespace CalamityMod.Projectiles.Melee Shred += 62; //Augment the shredspeed if (Owner.velocity.Y > 0) Owner.velocity.Y = -2f; //Get "stuck" into the enemy partly - Owner.GiveIFrames(BrokenBiomeBlade.HotAttunement_ShredIFrames); // i framez. + + // 17APR2024: Ozzatron: Broken Biome Blade's pogo gives iframes when striking enemies in a similar manner to a bonk dash. + // This is a fixed and intentionally very low number of iframes, and is not boosted by Cross Necklace. + Owner.GiveUniversalIFrames(BrokenBiomeBlade.HotAttunement_ShredIFrames); + PogoCooldown = 20; } } diff --git a/Projectiles/Melee/BrokenBiomeBlade_BitingEmbrace.cs b/Projectiles/Melee/BrokenBiomeBlade_BitingEmbrace.cs index 53e79d75f0..89c1276071 100644 --- a/Projectiles/Melee/BrokenBiomeBlade_BitingEmbrace.cs +++ b/Projectiles/Melee/BrokenBiomeBlade_BitingEmbrace.cs @@ -1,16 +1,16 @@ -using CalamityMod.Buffs.StatDebuffs; -using CalamityMod.Particles; +using System; +using System.IO; +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using static Terraria.ModLoader.ModContent; using static CalamityMod.CalamityUtils; -using Terraria.Audio; +using static Terraria.ModLoader.ModContent; namespace CalamityMod.Projectiles.Melee @@ -119,7 +119,6 @@ namespace CalamityMod.Projectiles.Melee case 1: Projectile.width = Projectile.height = 140; SoundEngine.PlaySound(SoundID.DD2_OgreSpit, Projectile.Center); - Projectile.damage = (int)(Projectile.damage * BrokenBiomeBlade.ColdAttunement_SecondSwingBoost); break; case 2: Projectile.width = Projectile.height = 130; diff --git a/Projectiles/Melee/BrokenBiomeBlade_DecaysRetort.cs b/Projectiles/Melee/BrokenBiomeBlade_DecaysRetort.cs index 1723f6e38b..805df34b78 100644 --- a/Projectiles/Melee/BrokenBiomeBlade_DecaysRetort.cs +++ b/Projectiles/Melee/BrokenBiomeBlade_DecaysRetort.cs @@ -1,13 +1,13 @@ -using CalamityMod.Items.Weapons.Melee; +using System; +using System.IO; +using CalamityMod.Items.Weapons.Melee; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.Melee { float collisionPoint = 0f; float bladeLength = 120f * Projectile.scale; - Vector2 displace = direction * ((float)Math.Sin(Timer / MaxTime * 3.14f) * 60); + Vector2 displace = direction * ((float)Math.Sin(Timer / MaxTime * MathHelper.Pi) * 60); return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center + displace, Owner.Center + displace + (direction * bladeLength), 24, ref collisionPoint); } @@ -89,7 +89,7 @@ namespace CalamityMod.Projectiles.Melee Owner.velocity = direction.SafeNormalize(Vector2.UnitX * Owner.direction) * LungeSpeed; } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => OnHitEffects(!target.canGhostHeal || Main.player[Projectile.owner].moonLeech); + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => OnHitEffects(Main.player[Projectile.owner].moonLeech); public override void OnHitPlayer(Player target, Player.HurtInfo info) => OnHitEffects(Main.player[Projectile.owner].moonLeech); private void OnHitEffects(bool cannotLifesteal) @@ -113,7 +113,10 @@ namespace CalamityMod.Projectiles.Melee bounceStrength *= Owner.velocity.Y == 0 ? 0.2f : 1f; //Reduce the bounce if the player is on the ground Owner.velocity = -direction.SafeNormalize(Vector2.Zero) * MathHelper.Clamp(bounceStrength, 0f, 22f); CanBounce = 0f; - Owner.GiveIFrames(BrokenBiomeBlade.EvilAttunement_BounceIFrames); // i frames for free! + + // 17APR2024: Ozzatron: Broken Biome Blade's lunge gives iframes when striking enemies in a similar manner to a bonk dash. + // This is a fixed and intentionally very low number of iframes, and is not boosted by Cross Necklace. + Owner.GiveUniversalIFrames(BrokenBiomeBlade.EvilAttunement_BounceIFrames); } public override bool PreDraw(ref Color lightColor) @@ -124,7 +127,7 @@ namespace CalamityMod.Projectiles.Melee float drawAngle = direction.ToRotation(); float drawRotation = drawAngle + MathHelper.PiOver4; - Vector2 displace = direction * ((float)Math.Sin(Timer / MaxTime * 3.14f) * 60); + Vector2 displace = direction * ((float)Math.Sin(Timer / MaxTime * MathHelper.Pi) * 60); Vector2 drawOrigin = new Vector2(0f, handle.Height); Vector2 drawOffset = Owner.Center + direction * 10f - Main.screenPosition; diff --git a/Projectiles/Melee/BrokenBiomeBlade_GrovetendersTouch.cs b/Projectiles/Melee/BrokenBiomeBlade_GrovetendersTouch.cs index 430e73ca0a..ce446cb580 100644 --- a/Projectiles/Melee/BrokenBiomeBlade_GrovetendersTouch.cs +++ b/Projectiles/Melee/BrokenBiomeBlade_GrovetendersTouch.cs @@ -1,15 +1,15 @@ -using CalamityMod.DataStructures; -using CalamityMod.Particles; +using System; +using System.IO; +using CalamityMod.DataStructures; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee diff --git a/Projectiles/Melee/BrokenBiomeBlade_PurityProjection.cs b/Projectiles/Melee/BrokenBiomeBlade_PurityProjection.cs index ac58050d38..cf1ff9c56c 100644 --- a/Projectiles/Melee/BrokenBiomeBlade_PurityProjection.cs +++ b/Projectiles/Melee/BrokenBiomeBlade_PurityProjection.cs @@ -1,11 +1,11 @@ using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using static Terraria.ModLoader.ModContent; using static CalamityMod.CalamityUtils; -using Terraria.Audio; +using static Terraria.ModLoader.ModContent; namespace CalamityMod.Projectiles.Melee @@ -39,7 +39,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.tileCollide = true; Lighting.AddLight(Projectile.Center, 0.75f, 1f, 0.24f); - int dustParticle = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 75, 0f, 0f, 100, default, 0.9f); + int dustParticle = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CursedTorch, 0f, 0f, 100, default, 0.9f); Main.dust[dustParticle].noGravity = true; Main.dust[dustParticle].velocity *= 0.5f; Main.dust[dustParticle].velocity += Projectile.velocity * 0.1f; @@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Melee for (int i = 0; i <= 15; i++) { Vector2 displace = (Projectile.rotation - MathHelper.PiOver4).ToRotationVector2() * (-0.5f + (i / 15f)) * 88f; - int dustParticle = Dust.NewDust(Projectile.Center + displace, Projectile.width, Projectile.height, 75, 0f, 0f, 100, default, 2f); + int dustParticle = Dust.NewDust(Projectile.Center + displace, Projectile.width, Projectile.height, DustID.CursedTorch, 0f, 0f, 100, default, 2f); Main.dust[dustParticle].noGravity = true; Main.dust[dustParticle].velocity = Projectile.oldVelocity; } diff --git a/Projectiles/Melee/BurningMeteor.cs b/Projectiles/Melee/BurningMeteor.cs index 8185479e74..9602d219c3 100644 --- a/Projectiles/Melee/BurningMeteor.cs +++ b/Projectiles/Melee/BurningMeteor.cs @@ -1,9 +1,9 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using CalamityMod.Buffs.DamageOverTime; namespace CalamityMod.Projectiles.Melee { @@ -57,7 +57,7 @@ namespace CalamityMod.Projectiles.Melee Vector2 dustRotate = Vector2.UnitX * (float)-(float)Projectile.width / 2f; dustRotate += -Vector2.UnitY.RotatedBy((double)((float)l * 3.14159274f / 6f), default) * new Vector2(8f, 16f); dustRotate = dustRotate.RotatedBy((double)(Projectile.rotation - 1.57079637f), default); - int burntDust = Dust.NewDust(Projectile.Center, 0, 0, 244, 0f, 0f, 160, default, 1f); + int burntDust = Dust.NewDust(Projectile.Center, 0, 0, DustID.CopperCoin, 0f, 0f, 160, default, 1f); Main.dust[burntDust].scale = 1.1f; Main.dust[burntDust].noGravity = true; Main.dust[burntDust].position = Projectile.Center + dustRotate; @@ -82,7 +82,7 @@ namespace CalamityMod.Projectiles.Melee { for (int k = 0; k < 5; k++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 244, 0f, 0f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f); } } diff --git a/Projectiles/Melee/CatastropheClaymoreSparkle.cs b/Projectiles/Melee/CatastropheClaymoreSparkle.cs index 19817bcb6d..01a6f6e2b0 100644 --- a/Projectiles/Melee/CatastropheClaymoreSparkle.cs +++ b/Projectiles/Melee/CatastropheClaymoreSparkle.cs @@ -1,8 +1,8 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { diff --git a/Projectiles/Melee/CausticEdgeProjectile.cs b/Projectiles/Melee/CausticEdgeProjectile.cs new file mode 100644 index 0000000000..82ae873f32 --- /dev/null +++ b/Projectiles/Melee/CausticEdgeProjectile.cs @@ -0,0 +1,180 @@ +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class CausticEdgeProjectile : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + + private const float ColorAlternateTime = 30f; + + private const int TimeLeft = 600; + + private const int MaxAlpha = 128; + + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + } + + public override void SetDefaults() + { + Projectile.width = 16; + Projectile.height = 16; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = 3; + Projectile.timeLeft = TimeLeft; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.alpha = MaxAlpha; + } + + public override void AI() + { + Projectile.ai[2] += 1f; + if (Projectile.ai[2] >= ColorAlternateTime) + Projectile.ai[2] = -ColorAlternateTime; + + Vector3 colorOne = new Vector3(0.9f, 0f, 0.9f); + Vector3 colorTwo = new Vector3(0.6f, 1.2f, 0f); + float colorScalar = Math.Abs(Projectile.ai[2]) / ColorAlternateTime; + Vector3 lightColor = Vector3.Lerp(colorOne, colorTwo, colorScalar); + Lighting.AddLight(Projectile.Center, lightColor.X, lightColor.Y, lightColor.Z); + + if (Projectile.localAI[1] > 7f) + { + float dustScale = 1.25f * Projectile.scale; + int maxRandom = 10; + int chanceOfGreenDust = (int)Math.Round(MathHelper.Lerp(0f, (float)maxRandom, colorScalar)); + int dustType = Main.rand.Next(maxRandom) < chanceOfGreenDust ? DustID.GreenFairy : DustID.Venom; + int dust = Dust.NewDust(new Vector2(Projectile.position.X - Projectile.velocity.X + 2f, Projectile.position.Y + 2f - Projectile.velocity.Y), 8, 8, dustType, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, Projectile.alpha, default, dustScale); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= -0.25f; + if (dustType == DustID.Venom) + Main.dust[dust].fadeIn = 1.5f; + + dustType = Main.rand.Next(maxRandom) < chanceOfGreenDust ? DustID.GreenFairy : DustID.Venom; + dust = Dust.NewDust(new Vector2(Projectile.position.X - Projectile.velocity.X + 2f, Projectile.position.Y + 2f - Projectile.velocity.Y), 8, 8, dustType, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, Projectile.alpha, default, dustScale); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= -0.25f; + Main.dust[dust].position -= Projectile.velocity * 0.5f; + if (dustType == DustID.Venom) + Main.dust[dust].fadeIn = 1.5f; + } + + if (Projectile.localAI[1] < 15f) + { + Projectile.localAI[1] += 1f; + } + else + { + if (Projectile.localAI[0] == 0f) + { + Projectile.scale -= 0.02f; + Projectile.alpha += 15; + if (Projectile.alpha >= MaxAlpha - 5) + { + Projectile.alpha = MaxAlpha; + Projectile.localAI[0] = 1f; + } + } + else if (Projectile.localAI[0] == 1f) + { + Projectile.scale += 0.02f; + Projectile.alpha -= 15; + if (Projectile.alpha <= 0) + { + Projectile.alpha = 0; + Projectile.localAI[0] = 0f; + } + } + } + + if (Projectile.ai[1] == 0f) + { + Projectile.ai[1] = 1f; + SoundEngine.PlaySound(SoundID.Item8, Projectile.Center); + } + + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver4; + } + + public override bool PreDraw(ref Color lightColor) + { + if (Projectile.timeLeft > TimeLeft - 5) + return false; + + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); + return false; + } + + public override Color? GetAlpha(Color lightColor) + { + Vector3 colorOne = new Vector3(100f, 0f, 100f); + Vector3 colorTwo = new Vector3(67f, 133f, 0f); + Vector3 newLightColor = Vector3.Lerp(colorOne, colorTwo, Math.Abs(Projectile.ai[2]) / ColorAlternateTime); + return new Color((int)newLightColor.X, (int)newLightColor.Y, (int)newLightColor.Z, 0); + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + 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; + + Projectile.velocity *= 0.5f; + + SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); + } + + return false; + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(BuffID.Venom, 60); + Projectile.velocity *= 0.5f; + } + + public override void OnKill(int timeLeft) + { + SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); + + for (int i = 4; i < 31; i++) + { + float oldXVel = Projectile.oldVelocity.X * (30f / (float)i); + float oldYVel = Projectile.oldVelocity.Y * (30f / (float)i); + + float dustScale = 1.8f * Projectile.scale; + int dustType = Main.rand.NextBool() ? DustID.GreenFairy : DustID.Venom; + int dust = Dust.NewDust(new Vector2(Projectile.oldPosition.X - oldXVel * 0.5f, Projectile.oldPosition.Y - oldYVel * 0.5f), 8, 8, dustType, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, Projectile.alpha, default, dustScale); + Main.dust[dust].noGravity = true; + if (dustType == DustID.Venom) + Main.dust[dust].fadeIn = 1.5f; + + dustScale = 1.4f * Projectile.scale; + dustType = Main.rand.NextBool() ? DustID.GreenFairy : DustID.Venom; + dust = Dust.NewDust(new Vector2(Projectile.oldPosition.X - oldXVel * 0.5f, Projectile.oldPosition.Y - oldYVel * 0.5f), 8, 8, dustType, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, Projectile.alpha, default, dustScale); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0.1f; + if (dustType == DustID.Venom) + Main.dust[dust].fadeIn = 1.5f; + } + } + } +} diff --git a/Projectiles/Melee/TrueCausticEdgeProjectile.png b/Projectiles/Melee/CausticEdgeProjectile.png similarity index 100% rename from Projectiles/Melee/TrueCausticEdgeProjectile.png rename to Projectiles/Melee/CausticEdgeProjectile.png diff --git a/Projectiles/Melee/ClamCrusherFlail.cs b/Projectiles/Melee/ClamCrusherFlail.cs index 419dc954fe..3ce47bbf54 100644 --- a/Projectiles/Melee/ClamCrusherFlail.cs +++ b/Projectiles/Melee/ClamCrusherFlail.cs @@ -1,11 +1,12 @@ -using CalamityMod.Buffs.StatDebuffs; +using System; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.NPCs.SunkenSea; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; -using Terraria.ModLoader; using Terraria.Audio; -using CalamityMod.NPCs.SunkenSea; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { @@ -40,7 +41,7 @@ namespace CalamityMod.Projectiles.Melee float shortXVel = Projectile.velocity.X / 3f * (float)i; float shortYVel = Projectile.velocity.Y / 3f * (float)i; int dustPos = 4; - int waterDust = Dust.NewDust(new Vector2(Projectile.position.X + (float)dustPos, Projectile.position.Y + (float)dustPos), Projectile.width - dustPos * 2, Projectile.height - dustPos * 2, 33, 0f, 0f, 0, new Color(0, 142, 255), 1.5f); + int waterDust = Dust.NewDust(new Vector2(Projectile.position.X + (float)dustPos, Projectile.position.Y + (float)dustPos), Projectile.width - dustPos * 2, Projectile.height - dustPos * 2, DustID.Water, 0f, 0f, 0, new Color(0, 142, 255), 1.5f); Dust waterdust = Main.dust[waterDust]; waterdust.noGravity = true; waterdust.velocity *= 0.1f; @@ -54,7 +55,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.tileCollide = true; } Vector2 flailDirection = Main.player[Projectile.owner].Center - Projectile.Center; - Projectile.rotation = flailDirection.ToRotation() - 1.57f; + Projectile.rotation = flailDirection.ToRotation() - MathHelper.PiOver2; if (Main.player[Projectile.owner].dead) { Projectile.Kill(); @@ -127,7 +128,7 @@ namespace CalamityMod.Projectiles.Melee for (int i = 0; i < 50; i++) { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); - int waterDust = Dust.NewDust(new Vector2(Projectile.Center.X, Projectile.Center.Y), Projectile.width / 2, Projectile.height / 2, 33, velocity.X, velocity.Y, 0, new Color(0, 142, 255), 1.5f); + int waterDust = Dust.NewDust(new Vector2(Projectile.Center.X, Projectile.Center.Y), Projectile.width / 2, Projectile.height / 2, DustID.Water, velocity.X, velocity.Y, 0, new Color(0, 142, 255), 1.5f); Main.dust[waterDust].velocity *= 2f; } } @@ -143,7 +144,7 @@ namespace CalamityMod.Projectiles.Melee Vector2 origin = new Vector2((float)texture2D2.Width * 0.5f, (float)texture2D2.Height * 0.5f); float projHeight = (float)texture2D2.Height; Vector2 actualCenter = mountedCenter - projCenter; - float flailRotate = (float)Math.Atan2((double)actualCenter.Y, (double)actualCenter.X) - 1.57f; + float flailRotate = (float)Math.Atan2((double)actualCenter.Y, (double)actualCenter.X) - MathHelper.PiOver2; bool isActive = true; if (float.IsNaN(projCenter.X) && float.IsNaN(projCenter.Y)) { diff --git a/Projectiles/Melee/CometQuasherMeteor.cs b/Projectiles/Melee/CometQuasherMeteor.cs index cbdc26cee8..a4649464c0 100644 --- a/Projectiles/Melee/CometQuasherMeteor.cs +++ b/Projectiles/Melee/CometQuasherMeteor.cs @@ -1,14 +1,16 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; + namespace CalamityMod.Projectiles.Melee { public class CometQuasherMeteor : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; + public override void SetStaticDefaults() { ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; @@ -27,9 +29,17 @@ namespace CalamityMod.Projectiles.Melee AIType = ProjectileID.Meteor1; } + public override void AI() + { + if (Projectile.Center.Y > Projectile.ai[2]) + Projectile.tileCollide = true; + else + Projectile.tileCollide = false; + } + public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; if (Projectile.Calamity().lineColor == 1) tex = ModContent.Request("CalamityMod/Projectiles/Melee/CometQuasherMeteor2").Value; if (Projectile.Calamity().lineColor == 2) @@ -42,20 +52,24 @@ namespace CalamityMod.Projectiles.Melee public override void OnKill(int timeLeft) { SoundEngine.PlaySound(SoundID.Item89, Projectile.position); + Projectile.ExpandHitboxBy((int)(128f * Projectile.scale)); + for (int i = 0; i < 8; ++i) - Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 31, 0.0f, 0.0f, 100, new Color(), 1.5f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Smoke, 0.0f, 0.0f, 100, new Color(), 1.5f); + for (int j = 0; j < 32; ++j) { - int fieryDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 6, 0.0f, 0.0f, 100, new Color(), 2.5f); + int fieryDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0.0f, 0.0f, 100, new Color(), 2.5f); Dust dust1 = Main.dust[fieryDust]; dust1.noGravity = true; dust1.velocity *= 3f; - int fieryDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 6, 0.0f, 0.0f, 100, new Color(), 1.5f); + int fieryDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0.0f, 0.0f, 100, new Color(), 1.5f); Dust dust2 = Main.dust[fieryDust2]; dust2.velocity *= 2f; dust2.noGravity = true; } + if (Main.netMode != NetmodeID.Server) { for (int j = 0; j < 2; ++j) @@ -67,6 +81,7 @@ namespace CalamityMod.Projectiles.Melee gore.velocity.Y += (float)Main.rand.Next(-10, 11) * 0.05f; } } + if (Projectile.owner == Main.myPlayer) { Projectile.usesLocalNPCImmunity = true; @@ -75,9 +90,10 @@ namespace CalamityMod.Projectiles.Melee Projectile.maxPenetrate = 0; Projectile.Damage(); } + for (int j = 0; j < 5; ++j) { - int fieryDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, Utils.SelectRandom(Main.rand, new int[3]{ 6, 259, 158 }), 2.5f * (float) Projectile.direction, -2.5f, 0, new Color(), 1f); + int fieryDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, Utils.SelectRandom(Main.rand, new int[3] { 6, 259, 158 }), 2.5f * (float)Projectile.direction, -2.5f, 0, new Color(), 1f); Dust dust1 = Main.dust[fieryDust]; dust1.alpha = 200; dust1.velocity *= 2.4f; diff --git a/Projectiles/Melee/CosmicBolt.cs b/Projectiles/Melee/CosmicBolt.cs index 41d42c37f8..7aadbb2336 100644 --- a/Projectiles/Melee/CosmicBolt.cs +++ b/Projectiles/Melee/CosmicBolt.cs @@ -1,6 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Melee { public class CosmicBolt : ModProjectile, ILocalizedModType @@ -28,7 +30,7 @@ namespace CalamityMod.Projectiles.Melee Vector2 spawnPos = Projectile.position; spawnPos -= Projectile.velocity * ((float)i * 0.25f); Projectile.alpha = 255; - int d = Dust.NewDust(spawnPos, 1, 1, 242, 0f, 0f, 0, default, 1.3f); + int d = Dust.NewDust(spawnPos, 1, 1, DustID.PinkTorch, 0f, 0f, 0, default, 1.3f); Dust dust = Main.dust[d]; dust.position = spawnPos; dust.position.X += (float)(Projectile.width / 2); diff --git a/Projectiles/Melee/CosmicDischargeFlail.cs b/Projectiles/Melee/CosmicDischargeFlail.cs index cbb4681399..9ec472431d 100644 --- a/Projectiles/Melee/CosmicDischargeFlail.cs +++ b/Projectiles/Melee/CosmicDischargeFlail.cs @@ -1,12 +1,12 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatBuffs; using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Projectiles.BaseProjectiles; namespace CalamityMod.Projectiles.Melee { diff --git a/Projectiles/Melee/CosmicIceBurst.cs b/Projectiles/Melee/CosmicIceBurst.cs index 5de6f01074..41079c62fd 100644 --- a/Projectiles/Melee/CosmicIceBurst.cs +++ b/Projectiles/Melee/CosmicIceBurst.cs @@ -2,9 +2,9 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -65,16 +65,16 @@ namespace CalamityMod.Projectiles.Melee SoundEngine.PlaySound(SoundID.Item62, Projectile.position); for (int i = 0; i < 2; i++) { - int cosmicDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 187, 0f, 0f, 100, new Color(150, 255, 255), 1f); + int cosmicDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Flare_Blue, 0f, 0f, 100, new Color(150, 255, 255), 1f); Main.dust[cosmicDust].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; } for (int j = 0; j < 3; j++) { - int iceDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 67, 0f, 0f, 200, new Color(150, 255, 255), 1f); + int iceDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.IceRod, 0f, 0f, 200, new Color(150, 255, 255), 1f); Main.dust[iceDust].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; Main.dust[iceDust].noGravity = true; Main.dust[iceDust].velocity *= 3f; - iceDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 67, 0f, 0f, 100, new Color(150, 255, 255), 0.6f); + iceDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.IceRod, 0f, 0f, 100, new Color(150, 255, 255), 0.6f); Main.dust[iceDust].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; Main.dust[iceDust].velocity *= 2f; Main.dust[iceDust].noGravity = true; @@ -82,14 +82,14 @@ namespace CalamityMod.Projectiles.Melee } for (int k = 0; k < 2; k++) { - int icyDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 67, 0f, 0f, 0, new Color(150, 255, 255), 1f); + int icyDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.IceRod, 0f, 0f, 0, new Color(150, 255, 255), 1f); Main.dust[icyDust].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)Projectile.velocity.ToRotation(), default) * (float)Projectile.width / 2f; Main.dust[icyDust].noGravity = true; Main.dust[icyDust].velocity *= 3f; } for (int l = 0; l < 3; l++) { - int freezeDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 187, 0f, 0f, 0, new Color(150, 255, 255), 0.6f); + int freezeDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Flare_Blue, 0f, 0f, 0, new Color(150, 255, 255), 0.6f); Main.dust[freezeDust].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)Projectile.velocity.ToRotation(), default) * (float)Projectile.width / 2f; Main.dust[freezeDust].noGravity = true; Main.dust[freezeDust].velocity *= 3f; @@ -105,7 +105,7 @@ namespace CalamityMod.Projectiles.Melee { colorArea = Lighting.GetColor((int)mountedCenter.X / 16, (int)(mountedCenter.Y / 16f)); } - Texture2D texture2D33 = ModContent.Request(Texture).Value; + Texture2D texture2D33 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Rectangle rectangl = texture2D33.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); return true; } diff --git a/Projectiles/Melee/CosmicOrb.cs b/Projectiles/Melee/CosmicOrb.cs index d26d6aaea9..857eb8bb36 100644 --- a/Projectiles/Melee/CosmicOrb.cs +++ b/Projectiles/Melee/CosmicOrb.cs @@ -1,8 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -49,7 +49,8 @@ namespace CalamityMod.Projectiles.Melee } } - CalamityUtils.MagnetSphereHitscan(Projectile, 300f, 6f, 8f, 5, ModContent.ProjectileType()); + if (Main.rand.NextBool(2)) + CalamityUtils.MagnetSphereHitscan(Projectile, 500f, 6f, 8f, 5, ModContent.ProjectileType()); } public override void OnKill(int timeLeft) @@ -58,7 +59,7 @@ namespace CalamityMod.Projectiles.Melee for (int i = 0; i < 10; i++) { int dustScale = (int)(10f * Projectile.scale); - int d = Dust.NewDust(Projectile.Center - Vector2.One * (float)dustScale, dustScale * 2, dustScale * 2, 242, 0f, 0f, 0, default, 1f); + int d = Dust.NewDust(Projectile.Center - Vector2.One * (float)dustScale, dustScale * 2, dustScale * 2, DustID.PinkTorch, 0f, 0f, 0, default, 1f); Dust dust = Main.dust[d]; Vector2 offset = Vector2.Normalize(dust.position - Projectile.Center); dust.position = Projectile.Center + offset * (float)dustScale * Projectile.scale; diff --git a/Projectiles/Melee/CosmicShivAura.cs b/Projectiles/Melee/CosmicShivAura.cs index ff62c67b0e..43e42687bb 100644 --- a/Projectiles/Melee/CosmicShivAura.cs +++ b/Projectiles/Melee/CosmicShivAura.cs @@ -13,7 +13,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { - public class CosmicShivAura : ModProjectile + public class CosmicShivAura : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; @@ -30,13 +30,13 @@ namespace CalamityMod.Projectiles.Melee Projectile.tileCollide = false; Projectile.ignoreWater = true; Projectile.penetrate = -1; - Projectile.timeLeft = 300; + Projectile.timeLeft = 240; } public override void OnSpawn(IEntitySource source) { if (Main.npc[(int)Projectile.ai[0]] is not null || Main.npc[(int)Projectile.ai[0]].active) - target = Main.npc[(int)Projectile.ai[0]]; // Convert target.whoAmI to object + target = Main.npc[(int)Projectile.ai[0]]; // Convert target.whoAmI to object } // ai[0] for ID of target to follow until the end of projectile's lifespan or the target cannot be found @@ -44,11 +44,13 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { // Unexist with target - if (target is null || !target.active) { + if (target is null || !target.active) + { Projectile.Kill(); } - - Projectile.Center = Main.npc[(int)Projectile.ai[0]].Center; // Stay with target + + // Stay with target + Projectile.Center = Main.npc[(int)Projectile.ai[0]].Center; if (Projectile.ai[1] == CurrentSwordTimer) { @@ -56,10 +58,16 @@ namespace CalamityMod.Projectiles.Melee randomDirection.Normalize(); int randomDistance = Main.rand.Next(200, 426); Vector2 spawnPos = Projectile.Center + (randomDirection * randomDistance); - Vector2 velocity = Vector2.Normalize(Projectile.Center - spawnPos) * Utils.GetLerpValue(-100, 426, randomDistance, clamped: true) * 20f; // Sword moves a bit slower if spawned closer, moves faster if spawned further + + // Sword moves a bit slower if spawned closer, moves faster if spawned further + Vector2 velocity = Vector2.Normalize(Projectile.Center - spawnPos) * Utils.GetLerpValue(-100, 426, randomDistance, clamped: true) * 20f; Projectile.NewProjectile(Projectile.GetSource_FromThis(), spawnPos.X, spawnPos.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack * 0.8f, Projectile.owner, randomDistance); - Projectile.ai[1] = 0; // Reset timer - CurrentSwordTimer = Main.rand.Next(SwordsAverageDelay - SwordsRandomOffset, SwordsAverageDelay + SwordsRandomOffset); // Determine when next sword will spawn + + // Reset timer + Projectile.ai[1] = 0; + + // Determine when next sword will spawn + CurrentSwordTimer = Main.rand.Next(SwordsAverageDelay - SwordsRandomOffset, SwordsAverageDelay + SwordsRandomOffset); } Projectile.ai[1]++; diff --git a/Projectiles/Melee/CosmicShivBlade.cs b/Projectiles/Melee/CosmicShivBlade.cs index 29b208bbbe..5ae1c83de6 100644 --- a/Projectiles/Melee/CosmicShivBlade.cs +++ b/Projectiles/Melee/CosmicShivBlade.cs @@ -1,15 +1,11 @@ -using System; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.DataStructures; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Buffs.DamageOverTime; -using Microsoft.Xna.Framework.Graphics; -using Terraria.GameContent; -using Terraria.DataStructures; -using Newtonsoft.Json.Linq; -using Terraria.Graphics.Shaders; -using Terraria.Graphics; namespace CalamityMod.Projectiles.Melee { @@ -35,7 +31,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.timeLeft = 6000; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = -1; - Projectile.extraUpdates = 2; + Projectile.extraUpdates = 3; Projectile.alpha = 0; Projectile.scale = 1.2f; } @@ -64,19 +60,24 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - Texture2D texture = TextureAssets.Projectile[Type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; Rectangle sourceRectangle = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); Vector2 origin = sourceRectangle.Size() / 2f; float rotation = Projectile.rotation; Color randomColor = Projectile.GetAlpha(lightColor); + // Afterimages to make the blade look longer float scaleMult = 1.2f; - for (int i = 0; i < Projectile.oldPos.Length; i++) // Afterimages to make the blade look longer + for (int i = 0; i < Projectile.oldPos.Length; i++) { Vector2 drawPos = Projectile.oldPos[i] + (Projectile.Size / 2f) - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); Color color = randomColor * ((float)(Projectile.oldPos.Length - i) / (float)Projectile.oldPos.Length); - Main.spriteBatch.Draw(texture, drawPos, new Rectangle?(sourceRectangle), color, rotation, origin, Projectile.scale * scaleMult, SpriteEffects.None, 0f); // Smaller, more visible layer - Main.spriteBatch.Draw(texture, drawPos, new Rectangle?(sourceRectangle), color * 0.5f, rotation, origin, Projectile.scale * 1.6f * scaleMult, SpriteEffects.None, 0f); // Bigger, less visible layer + + // Smaller, more visible layer + Main.spriteBatch.Draw(texture, drawPos, new Rectangle?(sourceRectangle), color, rotation, origin, Projectile.scale * scaleMult, SpriteEffects.None, 0f); + + // Bigger, less visible layer + Main.spriteBatch.Draw(texture, drawPos, new Rectangle?(sourceRectangle), color * 0.5f, rotation, origin, Projectile.scale * 1.6f * scaleMult, SpriteEffects.None, 0f); scaleMult *= 0.95f; } @@ -92,12 +93,14 @@ namespace CalamityMod.Projectiles.Melee } } - public override Color? GetAlpha(Color lightColor) // Probably not the right way to use this function, but it works (hopefully) + // Probably not the right way to use this function, but it works (hopefully) + public override Color? GetAlpha(Color lightColor) { + // Take random color from a list and make it more white Color color = CosmicShivTrail.DustColors[ColorIndex] * Projectile.Opacity; color = Color.Lerp(color, Color.White, 0.6f); color.A = 0; - return color; // Take random color from a list and make it more white + return color; } } } diff --git a/Projectiles/Melee/CosmicShivTrail.cs b/Projectiles/Melee/CosmicShivTrail.cs index 01c7d802d6..d5ba91fb4c 100644 --- a/Projectiles/Melee/CosmicShivTrail.cs +++ b/Projectiles/Melee/CosmicShivTrail.cs @@ -1,6 +1,10 @@ using System; +using System.Collections.Generic; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; using CalamityMod.Buffs.DamageOverTime; @@ -94,7 +98,7 @@ namespace CalamityMod.Projectiles.Melee float multiplier = Projectile.velocity.Length() < 4f ? Projectile.velocity.Length() + 1f : 1f; // Probably a better way to do this, but just a bandaid fix for if the trail velocity ends up being low targetVelocity *= Projectile.velocity.Length() + multiplier; - Projectile.velocity = Vector2.Lerp(Projectile.velocity, targetVelocity, 0.12f); + Projectile.velocity = Vector2.Lerp(Projectile.velocity, targetVelocity, 0.12f); } // lifespan timer @@ -145,7 +149,7 @@ namespace CalamityMod.Projectiles.Melee // Very similar to CosmicShivBlade PreDraw public override bool PreDraw(ref Color lightColor) { - Texture2D texture = TextureAssets.Projectile[Type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; Rectangle sourceRectangle = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); Vector2 origin = sourceRectangle.Size() / 2f; float rotation = Projectile.rotation; @@ -160,8 +164,8 @@ namespace CalamityMod.Projectiles.Melee Main.spriteBatch.Draw(texture, drawPos, new Rectangle?(sourceRectangle), color, rotation, origin, Projectile.scale * scaleMult, SpriteEffects.None, 0f); scaleMult *= 0.9f; } - - return false; + + return false; } @@ -175,7 +179,8 @@ namespace CalamityMod.Projectiles.Melee float speed = Main.rand.Next(6, 11); // Size int rand = Main.rand.Next(0, 10); // 10% chance rose, 10% chance big wavy shape, and 80% chance small undetail wavy shape - if (rand == 0) { + if (rand == 0) + { for (float k = 0f; k < MathHelper.TwoPi; k += 0.03f) { float scale = Main.rand.NextFloat(1.1f, 1.4f); @@ -191,7 +196,9 @@ namespace CalamityMod.Projectiles.Melee dust2.noGravity = true; dust2.fadeIn = -1f; } - } else if (rand == 1) { + } + else if (rand == 1) + { for (float k = 0f; k < MathHelper.TwoPi; k += 0.08f) { float scale = Main.rand.NextFloat(1.2f, 1.6f); @@ -207,7 +214,9 @@ namespace CalamityMod.Projectiles.Melee dust2.noGravity = true; dust2.fadeIn = -1f; } - } else { + } + else + { for (float k = 0f; k < MathHelper.TwoPi; k += 0.2f) { float scale = Main.rand.NextFloat(1f, 1.2f); diff --git a/Projectiles/Melee/CosmicSpiritBomb1.cs b/Projectiles/Melee/CosmicSpiritBomb1.cs index 74e36e75d3..cc4f4d99c0 100644 --- a/Projectiles/Melee/CosmicSpiritBomb1.cs +++ b/Projectiles/Melee/CosmicSpiritBomb1.cs @@ -1,9 +1,9 @@ -using System; +using System; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -74,7 +74,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(BuffID.Frostburn, 180); + target.AddBuff(BuffID.Frostburn2, 120); } public override void OnKill(int timeLeft) @@ -88,7 +88,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int k = 0; k < 10; k++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 15, Projectile.oldVelocity.X * 2.5f, Projectile.oldVelocity.Y * 2.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.MagicMirror, Projectile.oldVelocity.X * 2.5f, Projectile.oldVelocity.Y * 2.5f); } } } diff --git a/Projectiles/Melee/CosmicSpiritBomb2.cs b/Projectiles/Melee/CosmicSpiritBomb2.cs index 0635b3f57b..e17aa1fdeb 100644 --- a/Projectiles/Melee/CosmicSpiritBomb2.cs +++ b/Projectiles/Melee/CosmicSpiritBomb2.cs @@ -1,9 +1,9 @@ -using System; +using System; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -74,7 +74,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(BuffID.OnFire, 180); + target.AddBuff(BuffID.OnFire3, 120); } public override void OnKill(int timeLeft) @@ -88,7 +88,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int k = 0; k < 10; k++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 73, Projectile.oldVelocity.X * 2.5f, Projectile.oldVelocity.Y * 2.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.PinkFairy, Projectile.oldVelocity.X * 2.5f, Projectile.oldVelocity.Y * 2.5f); } } } diff --git a/Projectiles/Melee/CosmicSpiritBomb3.cs b/Projectiles/Melee/CosmicSpiritBomb3.cs index f267b25d63..4ec38d83a4 100644 --- a/Projectiles/Melee/CosmicSpiritBomb3.cs +++ b/Projectiles/Melee/CosmicSpiritBomb3.cs @@ -1,9 +1,9 @@ -using System; +using System; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -88,7 +88,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int k = 0; k < 10; k++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 244, Projectile.oldVelocity.X * 2.5f, Projectile.oldVelocity.Y * 2.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.CopperCoin, Projectile.oldVelocity.X * 2.5f, Projectile.oldVelocity.Y * 2.5f); } } } diff --git a/Projectiles/Melee/CrescentMoonFlail.cs b/Projectiles/Melee/CrescentMoonFlail.cs index 7e2e9cc68b..125511774e 100644 --- a/Projectiles/Melee/CrescentMoonFlail.cs +++ b/Projectiles/Melee/CrescentMoonFlail.cs @@ -1,8 +1,8 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; -using CalamityMod.Projectiles.BaseProjectiles; namespace CalamityMod.Projectiles.Melee { diff --git a/Projectiles/Melee/CrescentMoonProj.cs b/Projectiles/Melee/CrescentMoonProj.cs index 974856f21b..907fa657ae 100644 --- a/Projectiles/Melee/CrescentMoonProj.cs +++ b/Projectiles/Melee/CrescentMoonProj.cs @@ -1,9 +1,9 @@ -using Microsoft.Xna.Framework; -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -24,12 +24,12 @@ namespace CalamityMod.Projectiles.Melee Projectile.friendly = true; Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.tileCollide = false; - Projectile.penetrate = 5; - Projectile.timeLeft = 180; + Projectile.penetrate = -1; + Projectile.timeLeft = 140; Projectile.ignoreWater = true; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; - Projectile.extraUpdates = 1; + Projectile.localNPCHitCooldown = 20; + Projectile.extraUpdates = 2; Projectile.aiStyle = ProjAIStyleID.Sickle; AIType = ProjectileID.DeathSickle; } diff --git a/Projectiles/Melee/CrystylCrusherRay.cs b/Projectiles/Melee/CrystylCrusherRay.cs index faedfd0d5f..6fe3b3ff24 100644 --- a/Projectiles/Melee/CrystylCrusherRay.cs +++ b/Projectiles/Melee/CrystylCrusherRay.cs @@ -1,13 +1,13 @@ -using Microsoft.Xna.Framework; +using System; +using CalamityMod.Items.Tools; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; using Terraria.Enums; using Terraria.GameContent.Achievements; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using CalamityMod.Items.Tools; namespace CalamityMod.Projectiles.Melee { @@ -65,8 +65,8 @@ namespace CalamityMod.Projectiles.Melee { Vector2 maxLength = Main.MouseWorld - Main.player[Projectile.owner].Center; - DrawLaser(ModContent.Request(Texture).Value, Main.player[Projectile.owner].Center, - Projectile.velocity, 15f, Projectile.damage, -1.57f, Projectile.scale, maxLength.Length(), new Color(Main.DiscoR, 0, 255), (int)MOVE_DISTANCE); + DrawLaser(Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value, Main.player[Projectile.owner].Center, + Projectile.velocity, 15f, Projectile.damage, -MathHelper.PiOver2, Projectile.scale, maxLength.Length(), new Color(Main.DiscoR, 0, 255), (int)MOVE_DISTANCE); } return false; } @@ -170,7 +170,7 @@ namespace CalamityMod.Projectiles.Melee } int chargeFact = (int)(Charge / 20f); Vector2 dustVelocity = Vector2.UnitX * 18f; - dustVelocity = dustVelocity.RotatedBy(Projectile.rotation - 1.57f); + dustVelocity = dustVelocity.RotatedBy(Projectile.rotation - MathHelper.PiOver2); Vector2 spawnPos = Projectile.Center + dustVelocity; for (int k = 0; k < chargeFact + 1; k++) { diff --git a/Projectiles/Melee/Cyclone.cs b/Projectiles/Melee/Cyclone.cs index 155fe2442c..ffd4d3fa0e 100644 --- a/Projectiles/Melee/Cyclone.cs +++ b/Projectiles/Melee/Cyclone.cs @@ -1,10 +1,10 @@ -using CalamityMod.CalPlayer; +using System; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -20,8 +20,8 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - Projectile.width = 56; - Projectile.height = 56; + Projectile.width = 36; + Projectile.height = 36; Projectile.alpha = 255; Projectile.friendly = true; Projectile.DamageType = DamageClass.Melee; @@ -54,7 +54,7 @@ namespace CalamityMod.Projectiles.Melee for (int i = 1; i <= 6; i++) { Vector2 dustspeed = new Vector2(3f, 3f).RotatedBy(MathHelper.ToRadians(dustvortex)); - int d = Dust.NewDust(Projectile.Center, Projectile.width / 2, Projectile.height / 2, 31, dustspeed.X, dustspeed.Y, 200, new Color(232, 251, 250, 200), 1.3f); + int d = Dust.NewDust(Projectile.Center, Projectile.width / 2, Projectile.height / 2, DustID.Smoke, dustspeed.X, dustspeed.Y, 200, new Color(232, 251, 250, 200), 1.3f); Main.dust[d].noGravity = true; Main.dust[d].velocity = dustspeed; dustvortex += 60; @@ -109,12 +109,12 @@ namespace CalamityMod.Projectiles.Melee public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item60 with { Volume = SoundID.Item60.Volume * 0.6f}, Projectile.Center); + SoundEngine.PlaySound(SoundID.Item60 with { Volume = SoundID.Item60.Volume * 0.6f }, Projectile.Center); for (int i = 0; i <= 360; i += 3) { Vector2 dustspeed = new Vector2(3f, 3f).RotatedBy(MathHelper.ToRadians(i)); - int d = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, 31, dustspeed.X, dustspeed.Y, 200, new Color(232, 251, 250, 200), 1.4f); + int d = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, DustID.Smoke, dustspeed.X, dustspeed.Y, 200, new Color(232, 251, 250, 200), 1.4f); Main.dust[d].noGravity = true; Main.dust[d].position = Projectile.Center; Main.dust[d].velocity = dustspeed; diff --git a/Projectiles/Melee/DNA.cs b/Projectiles/Melee/DNA.cs index f173689d53..a3305715ba 100644 --- a/Projectiles/Melee/DNA.cs +++ b/Projectiles/Melee/DNA.cs @@ -9,8 +9,7 @@ namespace CalamityMod.Projectiles.Melee { public new string LocalizationCategory => "Projectiles.Melee"; - public static int OnHitIFrames = 3; - public static int TotalSegments = 6; + public static int TotalSegments = 10; public override void SetDefaults() { @@ -23,7 +22,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.DamageType = DamageClass.Melee; Projectile.penetrate = -1; Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 12; + Projectile.idStaticNPCHitCooldown = 6; } public override void AI() @@ -61,7 +60,7 @@ namespace CalamityMod.Projectiles.Melee { for (int i = 0; i < 3; i++) { - Dust dust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, 234, Projectile.velocity.X * 0.005f, Projectile.velocity.Y * 0.005f, 200, default, 1f); + Dust dust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.BoneTorch, Projectile.velocity.X * 0.005f, Projectile.velocity.Y * 0.005f, 200, default, 1f); dust.noGravity = true; dust.velocity *= 0.5f; } @@ -71,7 +70,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.Kill(); } if (Main.rand.NextBool(10)) - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 234, Projectile.velocity.X * 0.005f, Projectile.velocity.Y * 0.005f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.BoneTorch, Projectile.velocity.X * 0.005f, Projectile.velocity.Y * 0.005f); } // This is essential for Vilethorn-type projectiles, as velocity is a stored parameter and isn't supposed to actually move the projectile @@ -81,12 +80,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnKill(int timeLeft) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 234, Projectile.oldVelocity.X * 0.005f, Projectile.oldVelocity.Y * 0.005f); - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - Main.player[Projectile.owner].GiveIFrames(OnHitIFrames); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.BoneTorch, Projectile.oldVelocity.X * 0.005f, Projectile.oldVelocity.Y * 0.005f); } } } diff --git a/Projectiles/Melee/DarkBall.cs b/Projectiles/Melee/DarkBall.cs index 1888333251..93c4930826 100644 --- a/Projectiles/Melee/DarkBall.cs +++ b/Projectiles/Melee/DarkBall.cs @@ -1,9 +1,9 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using CalamityMod.Buffs.DamageOverTime; namespace CalamityMod.Projectiles.Melee { @@ -63,7 +63,8 @@ namespace CalamityMod.Projectiles.Melee } } } - } catch + } + catch { } if (Projectile.owner == Main.myPlayer && Projectile.timeLeft <= 3) @@ -92,7 +93,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.netUpdate = true; } } - Projectile.velocity.Y = Projectile.velocity.Y + 0.2f; + Projectile.velocity.Y = Projectile.velocity.Y + 0.18f; } Projectile.rotation += Projectile.velocity.X * 0.1f; } @@ -108,15 +109,15 @@ namespace CalamityMod.Projectiles.Melee Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int i = 0; i < 20; i++) { - int corruptDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 14, 0f, 0f, 100, default, 1.5f); + int corruptDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Demonite, 0f, 0f, 100, default, 1.5f); Main.dust[corruptDust].velocity *= 1.4f; } for (int j = 0; j < 10; j++) { - int corruptDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 14, 0f, 0f, 100, default, 2.5f); + int corruptDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Demonite, 0f, 0f, 100, default, 2.5f); Main.dust[corruptDust2].noGravity = true; Main.dust[corruptDust2].velocity *= 5f; - corruptDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 14, 0f, 0f, 100, default, 1.5f); + corruptDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Demonite, 0f, 0f, 100, default, 1.5f); Main.dust[corruptDust2].velocity *= 3f; } } diff --git a/Projectiles/Melee/DarkBeam.cs b/Projectiles/Melee/DarkBeam.cs index 05b88ae4cd..892b90beb5 100644 --- a/Projectiles/Melee/DarkBeam.cs +++ b/Projectiles/Melee/DarkBeam.cs @@ -1,5 +1,7 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Items.Weapons.Melee; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -8,6 +10,17 @@ namespace CalamityMod.Projectiles.Melee public class DarkBeam : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; + + public Player Owner => Main.player[Projectile.owner]; + + private const float MaxVelocity = DarklightGreatsword.ShootSpeed * 12f; + + private const int FadeOutTime = 85; + + private const int TimeLeft = 215 + FadeOutTime; + + private const int Alpha = 100; + public override void SetStaticDefaults() { ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; @@ -16,33 +29,52 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - Projectile.width = 74; - Projectile.height = 74; - Projectile.aiStyle = ProjAIStyleID.Sickle; - AIType = ProjectileID.DeathSickle; + Projectile.width = 36; + Projectile.height = 36; Projectile.friendly = true; + Projectile.ignoreWater = true; Projectile.DamageType = DamageClass.Melee; - Projectile.penetrate = 1; - Projectile.timeLeft = 300; + Projectile.penetrate = -1; // Actually only hits three times, set to infinite so the fade out works still + Projectile.timeLeft = TimeLeft; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 24; + Projectile.alpha = Alpha; } public override void AI() { - Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.2f / 255f, 0f, (255 - Projectile.alpha) * 0.6f / 255f); + float alphaLightScale = Projectile.alpha / (float)Alpha; + Lighting.AddLight(Projectile.Center, 0.4f * alphaLightScale, 0f, 1.2f * alphaLightScale); - if (Projectile.velocity.Length() < 12f) - Projectile.velocity *= 1.1f; + if (Projectile.timeLeft > FadeOutTime) + { + if (Projectile.velocity.Length() < MaxVelocity) + Projectile.velocity *= 1.055f; + } + else + Projectile.velocity *= 0.95f; + + if (Projectile.velocity.X < 0f) + Projectile.spriteDirection = -1; + + Projectile.rotation += Projectile.direction * 0.05f; + if (Projectile.timeLeft > FadeOutTime) + Projectile.rotation += Projectile.direction * 0.5f; + else + Projectile.rotation += Projectile.direction * 0.5f * (Projectile.timeLeft / (float)FadeOutTime); } public override Color? GetAlpha(Color lightColor) { - if (Projectile.timeLeft < 85) + if (Projectile.timeLeft < FadeOutTime) { byte b2 = (byte)(Projectile.timeLeft * 3); - byte a2 = (byte)(100f * (b2 / 255f)); - return new Color(b2, b2, b2, a2); + byte a2 = (byte)(Alpha * ((float)b2 / byte.MaxValue)); + Projectile.alpha = a2; + return new Color(b2, b2, b2, Projectile.alpha); } - return new Color(255, 255, 255, 100); + Projectile.alpha = Alpha; + return new Color(byte.MaxValue, byte.MaxValue, byte.MaxValue, Projectile.alpha); } public override bool PreDraw(ref Color lightColor) @@ -51,27 +83,36 @@ namespace CalamityMod.Projectiles.Melee return false; } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + public override bool OnTileCollide(Vector2 oldVelocity) { - target.AddBuff(BuffID.Frostburn2, 180); + if (Projectile.timeLeft > FadeOutTime) + { + Projectile.velocity = Projectile.oldVelocity; + Projectile.tileCollide = false; + Projectile.timeLeft = FadeOutTime; + } + + return false; } - public override void OnKill(int timeLeft) + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - for (int i = 0; i < 20; i++) + target.AddBuff(BuffID.Frostburn2, 120); + if (Projectile.numHits >= 2) // Fades out after the third hit + Projectile.timeLeft = FadeOutTime; + + int slashCreatorID = ModContent.ProjectileType(); + int damage = (int)(Projectile.damage * DarklightGreatsword.SlashProjectileDamageMultiplier); + float knockback = Projectile.knockBack * DarklightGreatsword.SlashProjectileDamageMultiplier; + if (Owner.ownedProjectileCounts[slashCreatorID] < DarklightGreatsword.SlashProjectileLimit) { - int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 56, 0f, 0f, 0, default, 1f); - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity += Projectile.velocity * 0.1f; - } - if (Projectile.owner == Main.myPlayer) - { - for (int k = 0; k < 3; k++) - { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, Main.rand.Next(-35, 36) * 0.2f, Main.rand.Next(-35, 36) * 0.2f, ModContent.ProjectileType(), - (int)(Projectile.damage * 0.5), Projectile.knockBack * 0.15f, Main.myPlayer); - } + Projectile.NewProjectile(Projectile.GetSource_FromThis(), target.Center, Vector2.Zero, slashCreatorID, damage, knockback, Projectile.owner, target.whoAmI, Projectile.rotation, 0f); + Owner.ownedProjectileCounts[slashCreatorID]++; } } + + public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(BuffID.Frostburn2, 120); + + public override bool? CanDamage() => Projectile.timeLeft < FadeOutTime ? false : null; } } diff --git a/Projectiles/Melee/DarkIceZero.cs b/Projectiles/Melee/DarkIceZero.cs index 8ac81e90c0..ea6cc9d671 100644 --- a/Projectiles/Melee/DarkIceZero.cs +++ b/Projectiles/Melee/DarkIceZero.cs @@ -1,10 +1,10 @@ -using CalamityMod.Buffs.StatDebuffs; +using System; +using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; using Terraria.WorldBuilding; namespace CalamityMod.Projectiles.Melee @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.Melee } //make pretty dust - int dustSpawns = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 172, Projectile.velocity.X, Projectile.velocity.Y, 0, default, 1.25f); + int dustSpawns = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.DungeonWater, Projectile.velocity.X, Projectile.velocity.Y, 0, default, 1.25f); Main.dust[dustSpawns].noGravity = true; } @@ -75,13 +75,13 @@ namespace CalamityMod.Projectiles.Melee SoundEngine.PlaySound(SoundID.Item27, Projectile.Center); for (int i = 0; i < 30; i++) { - int dustSpawns = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 172, 0f, 0f, 0, default, Main.rand.NextFloat(1f, 2f)); + int dustSpawns = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.DungeonWater, 0f, 0f, 0, default, Main.rand.NextFloat(1f, 2f)); Main.dust[dustSpawns].noGravity = true; Main.dust[dustSpawns].velocity *= 4f; } for (int j = 0; j < 20; ++j) { - int dustSpawns = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 68, 0f, 0f, 0, new Color(), 1.3f); + int dustSpawns = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.BlueCrystalShard, 0f, 0f, 0, new Color(), 1.3f); Main.dust[dustSpawns].noGravity = true; Main.dust[dustSpawns].velocity *= 1.5f; } diff --git a/Projectiles/Melee/DarkMasterBeam.cs b/Projectiles/Melee/DarkMasterBeam.cs new file mode 100644 index 0000000000..65cd9deac0 --- /dev/null +++ b/Projectiles/Melee/DarkMasterBeam.cs @@ -0,0 +1,84 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class DarkMasterBeam : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + + private int tileCounter = 5; // assure that the beams don't instantly die due to their size + + public override void SetStaticDefaults() + { + Main.projFrames[Projectile.type] = 6; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + } + + public override void SetDefaults() + { + Projectile.width = 32; + Projectile.height = 32; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.timeLeft = 300; + Projectile.penetrate = 2; + Projectile.alpha = 255; + Projectile.tileCollide = false; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 30; + } + + public override void AI() + { + if (tileCounter > 0) + tileCounter--; + if (tileCounter <= 0 && Projectile.ai[1] == 0) + Projectile.tileCollide = true; + + Projectile.velocity *= 1.03f; + + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) + { + Projectile.frame++; + Projectile.frameCounter = 0; + if (Projectile.frame > 5) + { + Projectile.frame = 0; + } + } + Lighting.AddLight(Projectile.Center, TorchID.Red); // til there's a torch id + } + + public override void OnKill(int timeLeft) + { + SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); + + for (int i = 0; i < 30; i++) + { + float angle = MathHelper.TwoPi * Main.rand.NextFloat(0f, 1f); + Vector2 angleVec = angle.ToRotationVector2(); + float distance = Main.rand.NextFloat(7f, 18f); + Vector2 off = angleVec * distance; + off.Y *= (float)Projectile.height / Projectile.width; + Vector2 pos = Projectile.Center + off; + Dust d = Dust.NewDustPerfect(pos, DustID.GemRuby, angleVec * Main.rand.NextFloat(2f, 4f)); + d.customData = true; + } + } + + public override Color? GetAlpha(Color drawColor) => Projectile.ai[0] == 1 ? new Color(100, 100, 100, Projectile.alpha) : new Color(255, 255, 255, Projectile.alpha); + + public override bool PreDraw(ref Color lightColor) + { + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + return false; + } + } +} diff --git a/Projectiles/Melee/DarkMasterBeam.png b/Projectiles/Melee/DarkMasterBeam.png new file mode 100644 index 0000000000..9e73ffe7ad Binary files /dev/null and b/Projectiles/Melee/DarkMasterBeam.png differ diff --git a/Projectiles/Melee/DarkMasterClone.cs b/Projectiles/Melee/DarkMasterClone.cs new file mode 100644 index 0000000000..d225c57331 --- /dev/null +++ b/Projectiles/Melee/DarkMasterClone.cs @@ -0,0 +1,153 @@ +using System; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class DarkMasterClone : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + 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; + } + + public override void AI() + { + // 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); + switch (Projectile.ai[0]) + { + case 1: + moveTo = new Vector2(-180, 120); + break; + case 2: + 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; + // move the clone to the desired position + Projectile.Center = Vector2.Lerp(Projectile.Center, owner.Center + moveTo, 0.4f); + // produce smoke during initial move + 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); + 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()) + { + 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); + } + } + } + + public override void OnKill(int timeLeft) + { + SoundEngine.PlaySound(SoundID.NPCDeath6, Projectile.Center); + + for (int i = 0; i < 8; i++) + { + float angle = MathHelper.TwoPi * Main.rand.NextFloat(0f, 1f); + 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); + } + } + + 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; + // become one with the shadows + for (int i = 0; i < player.dye.Length; i++) + { + if (player.dye[i].type != ItemID.ShadowDye) + { + player.dye[i].SetDefaults(ItemID.ShadowDye); + } + } + // update everything for our little dummy player + player.ResetEffects(); + player.ResetVisibleAccessories(); + player.DisplayDollUpdate(); + player.UpdateSocialShadow(); + player.UpdateDyes(); + player.PlayerFrame(); + // copy the player's arm movements while swinging, otherwise idle + if (owner.ItemAnimationActive && owner.altFunctionUse != 2) + player.bodyFrame = owner.bodyFrame; + else + player.bodyFrame.Y = 0; + // legs never jump or walk + player.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); + // draw the sword + 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); + } + return false; + } + + public override bool? CanDamage() + { + return false; + } + } +} diff --git a/Projectiles/Melee/DarklightGreatswordSlash.cs b/Projectiles/Melee/DarklightGreatswordSlash.cs new file mode 100644 index 0000000000..240b16bdc5 --- /dev/null +++ b/Projectiles/Melee/DarklightGreatswordSlash.cs @@ -0,0 +1,74 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class DarklightGreatswordSlash : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + + public override string Texture => "CalamityMod/Projectiles/Melee/ExobeamSlash"; + + public override void SetDefaults() + { + Projectile.width = 512; + Projectile.height = 24; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.MeleeNoSpeed; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = 2; + Projectile.Opacity = 1f; + Projectile.timeLeft = 35; + Projectile.MaxUpdates = 2; + Projectile.scale = 0.75f; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = Projectile.MaxUpdates * 12; + Projectile.noEnchantmentVisuals = true; + } + + public override void AI() + { + Projectile.rotation = Projectile.velocity.ToRotation(); + Projectile.Opacity = Projectile.timeLeft / 35f; + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => Projectile.RotatingHitboxCollision(targetHitbox.TopLeft(), targetHitbox.Size()); + + public override bool ShouldUpdatePosition() => true; + + public override Color? GetAlpha(Color lightColor) => Color.Lerp(Projectile.ai[2] == 0f ? Color.Cyan : Color.Pink, Projectile.ai[2] == 0f ? Color.DarkBlue : Color.DarkRed, Projectile.identity / 7f % 1f) * Projectile.Opacity; + + public override bool PreDraw(ref Color lightColor) + { + if (Projectile.timeLeft >= 34f) + return false; + + Main.spriteBatch.SetBlendState(BlendState.Additive); + + float progress = (33f - Projectile.timeLeft) / 33f; + + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D bloomTexture = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; + + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + Vector2 origin = texture.Size() * 0.5f; + Vector2 scale = new Vector2(MathHelper.Lerp(0.8f, 1.25f, (float)Math.Pow(progress, 0.45)), MathHelper.Lerp(0.6f, 0.24f, (float)Math.Pow(progress, 0.4))) * Projectile.scale; + + // Draw an inner bloom circle to signify power at the center of the strike along with two thinner lines. + Vector2 bloomScale = Projectile.Size / bloomTexture.Size() * new Vector2(1f, 2f); + Vector2 bloomOrigin = bloomTexture.Size() * 0.5f; + Color outerSlashColor = Projectile.ai[2] == 0f ? Color.DarkBlue : Color.DarkRed; + Color innerSlashColor = Projectile.ai[2] == 0f ? Color.Cyan : Color.Pink; + Main.spriteBatch.Draw(bloomTexture, drawPosition, null, outerSlashColor * Projectile.Opacity, Projectile.rotation, bloomOrigin, bloomScale, 0, 0f); + Main.spriteBatch.Draw(texture, drawPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, scale, 0, 0f); + Main.spriteBatch.Draw(texture, drawPosition, null, innerSlashColor * Projectile.Opacity, Projectile.rotation, origin, scale * new Vector2(1f, 0.6f), 0, 0f); + + Main.spriteBatch.SetBlendState(BlendState.AlphaBlend); + return false; + } + } +} diff --git a/Projectiles/Melee/DarklightGreatswordSlashCreator.cs b/Projectiles/Melee/DarklightGreatswordSlashCreator.cs new file mode 100644 index 0000000000..a50f6c4765 --- /dev/null +++ b/Projectiles/Melee/DarklightGreatswordSlashCreator.cs @@ -0,0 +1,63 @@ +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Sounds; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class DarklightGreatswordSlashCreator : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + + public NPC Target => Main.npc[(int)Projectile.ai[0]]; + + public float SlashDirection + { + get + { + if (Projectile.ai[1] > MathHelper.Pi) + return Main.rand.NextFloatDirection(); + + return Projectile.ai[1] + Main.rand.NextFloatDirection() * 0.2f; + } + } + + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override void SetDefaults() + { + Projectile.width = 2; + Projectile.height = 2; + Projectile.ignoreWater = false; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 36; + Projectile.MaxUpdates = 2; + Projectile.noEnchantmentVisuals = true; + } + + public override void AI() + { + if (Projectile.timeLeft % DarklightGreatsword.SlashCreationRate == 0) + { + SoundEngine.PlaySound(CommonCalamitySounds.SwiftSliceSound with { Volume = CommonCalamitySounds.SwiftSliceSound.Volume * 0.5f }, Projectile.Center); + if (Main.myPlayer == Projectile.owner) + { + float maxOffset = Target.width * 0.4f; + if (maxOffset > 300f) + maxOffset = 300f; + + Vector2 spawnOffset = SlashDirection.ToRotationVector2() * Main.rand.NextFloatDirection() * maxOffset; + Vector2 sliceVelocity = spawnOffset.SafeNormalize(Vector2.UnitY) * 0.1f; + + int damage = Projectile.damage; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Target.Center + spawnOffset, sliceVelocity, ModContent.ProjectileType(), damage, 0f, Projectile.owner, 0f, 0f, Projectile.ai[2]); + } + } + } + + public override bool? CanDamage() => false; + } +} diff --git a/Projectiles/Melee/DeathsAscensionProjectile.cs b/Projectiles/Melee/DeathsAscensionProjectile.cs index 962f5dcddd..ab1f7ba83d 100644 --- a/Projectiles/Melee/DeathsAscensionProjectile.cs +++ b/Projectiles/Melee/DeathsAscensionProjectile.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Projectiles.Melee if (Main.rand.NextBool(3)) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 173, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } CalamityUtils.HomeInOnNPC(Projectile, true, 900f, 18f, 20f); diff --git a/Projectiles/Melee/DeathsAscensionSwing.cs b/Projectiles/Melee/DeathsAscensionSwing.cs index 076d9591d3..46aa29cd7f 100644 --- a/Projectiles/Melee/DeathsAscensionSwing.cs +++ b/Projectiles/Melee/DeathsAscensionSwing.cs @@ -69,7 +69,7 @@ namespace CalamityMod.Projectiles.Melee Vector2 playerRotatedPoint = Owner.RotatedRelativePoint(Owner.MountedCenter, true); if (Main.myPlayer == Projectile.owner) { - if (Owner.channel && !Owner.noItems && !Owner.CCed) + if (!Owner.CantUseHoldout()) HandleChannelMovement(playerRotatedPoint); else Projectile.Kill(); @@ -81,9 +81,9 @@ namespace CalamityMod.Projectiles.Melee // Sprite and player directioning. Projectile.spriteDirection = Projectile.direction; if (Projectile.direction == 1) - Projectile.Left = Owner.Center; + Projectile.Left = Owner.MountedCenter; else - Projectile.Right = Owner.Center; + Projectile.Right = Owner.MountedCenter; Projectile.position.X += Projectile.spriteDirection == -1 ? 26f : -26f; Projectile.position.Y -= Projectile.scale * 2f; Owner.ChangeDir(Projectile.direction); @@ -113,7 +113,7 @@ namespace CalamityMod.Projectiles.Melee { if (Projectile.frameCounter <= 1) return false; - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Vector2 position = Projectile.Center - Main.screenPosition + (Projectile.spriteDirection == -1 ? new Vector2(60, 0) : new Vector2(-60, 0)); Vector2 origin = texture.Size() / new Vector2(2f, 6f) * 0.5f; Rectangle frame = texture.Frame(2, 6, frameX, frameY); diff --git a/Projectiles/Melee/DemonBlast.cs b/Projectiles/Melee/DemonBlast.cs index 02b1c6a9fa..1350840642 100644 --- a/Projectiles/Melee/DemonBlast.cs +++ b/Projectiles/Melee/DemonBlast.cs @@ -1,9 +1,9 @@ using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { diff --git a/Projectiles/Melee/DepthCrusherProjectile.cs b/Projectiles/Melee/DepthCrusherProjectile.cs new file mode 100644 index 0000000000..8e65dbcd00 --- /dev/null +++ b/Projectiles/Melee/DepthCrusherProjectile.cs @@ -0,0 +1,206 @@ +using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Ranged; +using Humanizer; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; +using static CalamityMod.CalamityUtils; + +namespace CalamityMod.Projectiles.Melee +{ + public class DepthCrusherProjectile : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + public override string Texture => "CalamityMod/Items/Weapons/Melee/DepthCrusher"; + + public int ChargeupTime = 25; + public int Lifetime = 255; + public int startDamage; + public bool setDamage = false; + public int dustType1 = 104; + public int dustType2 = 96; + public float OverallProgress => 1 - Projectile.timeLeft / (float)Lifetime; + public float ThrowProgress => 1 - Projectile.timeLeft / (float)(Lifetime); + public float ChargeProgress => 1 - (Projectile.timeLeft - Lifetime) / (float)(ChargeupTime); + + public Player Owner => Main.player[Projectile.owner]; + + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + } + + public override void SetDefaults() + { + Projectile.width = 50; + Projectile.height = 50; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = Lifetime + ChargeupTime; + Projectile.DamageType = DamageClass.Melee; + Projectile.ignoreWater = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 30; + } + + public override bool ShouldUpdatePosition() + { + return ChargeProgress >= 1; + } + + public override bool? CanDamage() + { + //We don't want the anticipation to deal damage. + if (ChargeProgress < 1) + return false; + + return base.CanDamage(); + } + + //Swing animation keys + public CurveSegment pullback = new CurveSegment(EasingType.PolyOut, 0f, 0f, MathHelper.PiOver4 * -1.2f, 2); + public CurveSegment throwout = new CurveSegment(EasingType.PolyOut, 0.7f, MathHelper.PiOver4 * -1.2f, MathHelper.PiOver4 * 1.2f + MathHelper.PiOver2, 3); + internal float ArmAnticipationMovement() => PiecewiseAnimation(ChargeProgress, new CurveSegment[] { pullback, throwout }); + + public override void AI() + { + Projectile.spriteDirection = Projectile.direction; + Vector3 Light = new Vector3(0.050f, 0.050f, 0.250f); + Lighting.AddLight(Projectile.Center, Light * 2); + + //Anticipation animation. Make the player look like theyre holding the depth crusher + if (ChargeProgress < 1) + { + Owner.ChangeDir(MathF.Sign(Main.MouseWorld.X - Owner.Center.X)); + + float armRotation = ArmAnticipationMovement() * Owner.direction; + + Owner.heldProj = Projectile.whoAmI; + + Projectile.Center = Owner.MountedCenter + Vector2.UnitY.RotatedBy(armRotation * Owner.gravDir) * -45f * Owner.gravDir; + Projectile.rotation = (-MathHelper.PiOver4 * Projectile.direction + armRotation) * Owner.gravDir; + + Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, MathHelper.Pi + armRotation); + + return; + } + + //Play the throw sound when the throw ACTUALLY BEGINS. + //Additionally, make the projectile collide and set its speed and velocity + if (Projectile.timeLeft == Lifetime) + { + Projectile.netUpdate = true; + SoundEngine.PlaySound(SoundID.Item1, Projectile.Center); + Projectile.Center = Owner.MountedCenter + Projectile.velocity * 12f; + Projectile.velocity = (Main.MouseWorld - Owner.Center).SafeNormalize(Vector2.UnitX * Owner.direction) * 15; + startDamage = Projectile.damage; + Projectile.spriteDirection = Projectile.direction; + } + + Projectile.rotation += (0.4f * (MathF.Abs(Projectile.velocity.Y) * 0.2f + 0.6f)) * Projectile.direction; + if (Projectile.velocity.Y < 20) + Projectile.velocity.Y += Projectile.numHits >= 3 ? 0.7f : 0.4f; + if (Projectile.numHits >= 3) + { + Projectile.penetrate = -1; + if (!setDamage) + { + Projectile.damage = (int)(Projectile.damage * 0.2f); + setDamage = true; + } + } + if (Projectile.velocity.Y > 0) + Projectile.velocity.X *= 0.975f; + + if (Collision.SolidCollision(Projectile.Center, 15, 15)) + { + Projectile.tileCollide = true; + } + else + Projectile.tileCollide = false; + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + Projectile.timeLeft = 240; + if (!setDamage) + { + if (Projectile.velocity.Y > 0) + Projectile.velocity.Y = -9; + else + Projectile.velocity.Y = -7; + } + + for (int i = 0; i < 15; i++) + { + Vector2 dustPos = Projectile.Center; + Dust dust = Dust.NewDustPerfect(dustPos, Main.rand.NextBool(3) ? dustType1 : dustType2); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.5f, 1.1f); + dust.velocity = new Vector2(3, 3).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1.5f); + } + } + + public override void OnKill(int timeLeft) + { + for (int i = 0; i < 40; i++) + { + float dustMulti = Main.rand.NextFloat(0.3f, 1.5f); + Vector2 dustPos = Projectile.Center; + Dust dust = Dust.NewDustPerfect(dustPos, Main.rand.NextBool(3) ? dustType1 : dustType2); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(1.6f, 2.5f) - dustMulti; + dust.velocity = new Vector2(5, 5).RotatedByRandom(100) * Main.rand.NextFloat(0.3f, 1f) * dustMulti; + } + } + public override bool OnTileCollide(Vector2 oldVelocity) + { + SoundStyle HitSound = new("CalamityMod/Sounds/Custom/AbyssGravelMine2") { Volume = 0.6f, PitchVariance = 0.3f }; + + Projectile.timeLeft = 240; + if (Projectile.numHits < 3) + { + Projectile.numHits++; + + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, new Vector2(0, -5).RotatedByRandom(0.6f) * Main.rand.NextFloat(0.9f, 1.1f), ModContent.ProjectileType(), startDamage / 4, Projectile.knockBack / 4, Projectile.owner); + + if (Projectile.velocity.X != oldVelocity.X) + { + Projectile.velocity.X = -oldVelocity.X * 0.8f; + } + if (Projectile.velocity.Y != oldVelocity.Y) + { + Projectile.velocity.Y = -oldVelocity.Y * 0.8f; + } + SoundEngine.PlaySound(HitSound with { Pitch = 0.15f }, Projectile.Center); + for (int i = 0; i < 25; i++) + { + float dustMulti = Main.rand.NextFloat(0.3f, 1.5f); + Vector2 dustPos = Projectile.Center; + Dust dust = Dust.NewDustPerfect(dustPos, Main.rand.NextBool(3) ? dustType1 : dustType2); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(1.6f, 2.5f) - dustMulti; + dust.velocity = new Vector2(3, 3).RotatedByRandom(100) * Main.rand.NextFloat(0.3f, 1f) * dustMulti; + } + } + else + { + SoundEngine.PlaySound(HitSound, Projectile.Center); + for (int i = 0; i < 3; i++) + { + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, new Vector2(0, -5).RotatedByRandom(0.6f) * Main.rand.NextFloat(0.9f, 1.1f), ModContent.ProjectileType(), startDamage / 4, Projectile.knockBack / 4, Projectile.owner); + } + Projectile.Kill(); + } + + return false; + } + } +} diff --git a/Projectiles/Melee/DepthCrusherSplitProjectile.cs b/Projectiles/Melee/DepthCrusherSplitProjectile.cs new file mode 100644 index 0000000000..5c2b6ef338 --- /dev/null +++ b/Projectiles/Melee/DepthCrusherSplitProjectile.cs @@ -0,0 +1,77 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.NPCs.SupremeCalamitas; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Healing; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Audio; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Melee +{ + public class DepthCrusherSplitProjectile : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public int Time = 0; + public int randTimer; + public int dustType1 = 104; + public int dustType2 = 96; + public override void SetDefaults() + { + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.tileCollide = false; + Projectile.penetrate = 1; + Projectile.timeLeft = 240; + Projectile.ignoreWater = true; + } + + public override void AI() + { + Time++; + if (Time == 1) + { + randTimer = Main.rand.Next(200, 261); + Projectile.timeLeft = randTimer; + } + if (Time > 20 && Time < (randTimer - 70)) + { + CalamityUtils.HomeInOnNPC(Projectile, true, 280f, MathHelper.Clamp(1f + Time * 0.06f, 1, 10), 20f); + } + else if (Time >= (randTimer - 70)) + { + if (Projectile.velocity.Y < 10) + Projectile.velocity.Y += 0.4f; + Projectile.velocity.X *= 0.97f; + } + if (Time % 2 == 0) + { + Color smokeColor = Color.MediumBlue; + Particle smoke = new HeavySmokeParticle(Projectile.Center, Projectile.velocity * Main.rand.NextFloat(-0.2f, -0.6f), smokeColor, 30, Main.rand.NextFloat(0.35f, 0.5f), 0.3f, Main.rand.NextFloat(-0.2f, 0.2f), false, required: true); + GeneralParticleHandler.SpawnParticle(smoke); + } + for (int i = 0; i < 3; i++) + { + Vector2 dustPos = Projectile.Center; + int dustType = Main.rand.NextBool(3) ? dustType1 : dustType2; + Dust dust = Dust.NewDustPerfect(dustPos, dustType); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.8f, 1.5f); + dust.velocity = new Vector2(0.5f, 0.5f).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1.1f); + } + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 180); + + SoundEngine.PlaySound(SoundID.ShimmerWeak1 with { Pitch = 0.35f }, Projectile.Center); + } + } +} diff --git a/Projectiles/Melee/DepthOrb.cs b/Projectiles/Melee/DepthOrb.cs index 418534f0ce..f8ae7bc5d0 100644 --- a/Projectiles/Melee/DepthOrb.cs +++ b/Projectiles/Melee/DepthOrb.cs @@ -1,11 +1,11 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { public class DepthOrb : ModProjectile, ILocalizedModType @@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { Lighting.AddLight(Projectile.Center, 0f, 0f, 0.5f); - int waterDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 0.6f); + int waterDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Water, 0f, 0f, 100, default, 0.6f); Main.dust[waterDust].noGravity = true; Main.dust[waterDust].velocity *= 0.5f; Main.dust[waterDust].velocity += Projectile.velocity * 0.1f; @@ -38,7 +38,7 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.timeLeft > 70) return false; - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } @@ -63,7 +63,7 @@ namespace CalamityMod.Projectiles.Melee randoAdjust = rando3 / randoAdjust; rando1 *= randoAdjust; rando2 *= randoAdjust; - int killWaterDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 1.2f); + int killWaterDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Water, 0f, 0f, 100, default, 1.2f); Dust dust = Main.dust[killWaterDust]; dust.noGravity = true; dust.position.X = Projectile.Center.X; diff --git a/Projectiles/Melee/DepthOrb2.cs b/Projectiles/Melee/DepthOrb2.cs index d1d2ad2813..1e55362d76 100644 --- a/Projectiles/Melee/DepthOrb2.cs +++ b/Projectiles/Melee/DepthOrb2.cs @@ -1,11 +1,11 @@ +using System; using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { public class DepthOrb2 : ModProjectile, ILocalizedModType @@ -30,7 +30,7 @@ namespace CalamityMod.Projectiles.Melee { Lighting.AddLight(Projectile.Center, 0f, 0f, 0.5f); - int waterDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 0.4f); + int waterDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Water, 0f, 0f, 100, default, 0.4f); Main.dust[waterDust].noGravity = true; Main.dust[waterDust].velocity *= 0.5f; Main.dust[waterDust].velocity += Projectile.velocity * 0.1f; @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.timeLeft > 115) return false; - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } @@ -69,7 +69,7 @@ namespace CalamityMod.Projectiles.Melee randoAdjust = rando3 / randoAdjust; rando1 *= randoAdjust; rando2 *= randoAdjust; - int killWaterDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 1.2f); + int killWaterDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Water, 0f, 0f, 100, default, 1.2f); Dust dust = Main.dust[killWaterDust]; dust.noGravity = true; dust.position.X = Projectile.Center.X; diff --git a/Projectiles/Melee/DevilsSunriseCyclone.cs b/Projectiles/Melee/DevilsSunriseCyclone.cs index 8a418a3c09..8c04e8c38f 100644 --- a/Projectiles/Melee/DevilsSunriseCyclone.cs +++ b/Projectiles/Melee/DevilsSunriseCyclone.cs @@ -1,10 +1,10 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -34,32 +34,29 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - if (Projectile.ai[1] < 510f && Projectile.ai[1] != -1f) - Projectile.ai[1] += 1f; + Player Owner = Main.player[Projectile.owner]; + if (Projectile.ai[1] < 480f && Projectile.ai[1] != -1f) + Projectile.ai[1]++; if (Main.myPlayer == Projectile.owner) { - if (!Main.player[Projectile.owner].channel) - { + if (!Owner.channel) Projectile.ai[1] = -1f; - Projectile.damage = Projectile.originalDamage; - } } - if (Projectile.ai[1] >= 255f) - Projectile.damage = 2 * Projectile.originalDamage; + Projectile.damage = (int)(Owner.GetTotalDamage(Projectile.DamageType).ApplyTo(Projectile.originalDamage) * (1f + Utils.GetLerpValue(0f, 300f, Projectile.ai[1], true))); - red = 64 + (int)(Projectile.ai[1] * 0.75f); + red = 30 + (int)(Projectile.ai[1] * 0.75f); if (red > 255) red = 255; - int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 66, 0f, 0f, 100, new Color(red, greenAndBlue, greenAndBlue), 1f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RainbowTorch, 0f, 0f, 100, new Color(red, greenAndBlue, greenAndBlue), 1f); Main.dust[dust].velocity *= 0.3f; Main.dust[dust].noGravity = true; - Vector2 projDirection = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); - float x = Main.player[Projectile.owner].position.X + (float)(Main.player[Projectile.owner].width / 2) - projDirection.X; - float y = Main.player[Projectile.owner].position.Y + (float)(Main.player[Projectile.owner].height / 2) - projDirection.Y; + Vector2 projDirection = Projectile.Center; + float x = Owner.position.X + (float)(Owner.width / 2) - projDirection.X; + float y = Owner.position.Y + (float)(Owner.height / 2) - projDirection.Y; float distanceFromOwner = (float)Math.Sqrt((double)(x * x + y * y)); float speed = 25f; @@ -68,7 +65,7 @@ namespace CalamityMod.Projectiles.Melee if (speed < 2f) speed = 2f; - if (speed <= 2f || Projectile.ai[1] >= 510f || Projectile.ai[1] == -1f) + if (speed <= 2f || Projectile.ai[1] >= 480f || Projectile.ai[1] == -1f) { float returnSpeedMax = 30f; float returnSpeed = 6f; @@ -104,20 +101,20 @@ namespace CalamityMod.Projectiles.Melee if (Main.myPlayer == Projectile.owner) { Rectangle rectangle = new Rectangle((int)Projectile.position.X, (int)Projectile.position.Y, Projectile.width, Projectile.height); - Rectangle playerPos = new Rectangle((int)Main.player[Projectile.owner].position.X, (int)Main.player[Projectile.owner].position.Y, Main.player[Projectile.owner].width, Main.player[Projectile.owner].height); + Rectangle playerPos = new Rectangle((int)Owner.position.X, (int)Owner.position.Y, Owner.width, Owner.height); if (rectangle.Intersects(playerPos)) Projectile.Kill(); } } else if (Main.myPlayer == Projectile.owner && Projectile.ai[0] <= 0f) { - if (Main.player[Projectile.owner].channel) + if (Owner.channel) { - Vector2 projTravel = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); + Vector2 projTravel = Projectile.Center; float mouseDestX = (float)Main.mouseX + Main.screenPosition.X - projTravel.X; float mouseDestY = (float)Main.mouseY + Main.screenPosition.Y - projTravel.Y; - if (Main.player[Projectile.owner].gravDir == -1f) + if (Owner.gravDir == -1f) mouseDestY = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - projTravel.Y; if (Projectile.ai[0] < 0f) @@ -158,17 +155,17 @@ namespace CalamityMod.Projectiles.Melee else if (Projectile.ai[0] <= 0f) { Projectile.netUpdate = true; - Vector2 projDirect = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); + Vector2 projDirect = Projectile.Center; float miceX = (float)Main.mouseX + Main.screenPosition.X - projDirect.X; float miceY = (float)Main.mouseY + Main.screenPosition.Y - projDirect.Y; - if (Main.player[Projectile.owner].gravDir == -1f) + if (Owner.gravDir == -1f) miceY = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - projDirect.Y; float miceDistancing = (float)Math.Sqrt((double)(miceX * miceX + miceY * miceY)); if (miceDistancing == 0f || Projectile.ai[0] < 0f) { - projDirect = new Vector2(Main.player[Projectile.owner].position.X + (float)(Main.player[Projectile.owner].width / 2), Main.player[Projectile.owner].position.Y + (float)(Main.player[Projectile.owner].height / 2)); + projDirect = new Vector2(Owner.position.X + (float)(Owner.width / 2), Owner.position.Y + (float)(Owner.height / 2)); miceX = Projectile.position.X + (float)Projectile.width * 0.5f - projDirect.X; miceY = Projectile.position.Y + (float)Projectile.height * 0.5f - projDirect.Y; miceDistancing = (float)Math.Sqrt((double)(miceX * miceX + miceY * miceY)); @@ -216,7 +213,7 @@ namespace CalamityMod.Projectiles.Melee Vector2 rotate = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; rotate = rotate.RotatedBy((double)((float)(i - (dustAmt / 2 - 1)) * 6.28318548f / (float)dustAmt), default) + Projectile.Center; Vector2 faceDirection = rotate - Projectile.Center; - int cycloneDust = Dust.NewDust(rotate + faceDirection, 0, 0, 66, faceDirection.X, faceDirection.Y, 100, new Color(red, greenAndBlue, greenAndBlue), 1f); + int cycloneDust = Dust.NewDust(rotate + faceDirection, 0, 0, DustID.RainbowTorch, faceDirection.X, faceDirection.Y, 100, new Color(red, greenAndBlue, greenAndBlue), 1f); Main.dust[cycloneDust].noGravity = true; Main.dust[cycloneDust].noLight = true; Main.dust[cycloneDust].velocity = faceDirection; diff --git a/Projectiles/Melee/DevilsSunriseProj.cs b/Projectiles/Melee/DevilsSunriseProj.cs index 4f05159cff..186640c5ad 100644 --- a/Projectiles/Melee/DevilsSunriseProj.cs +++ b/Projectiles/Melee/DevilsSunriseProj.cs @@ -1,7 +1,7 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Weapons.Melee; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -36,23 +36,16 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - if (Projectile.ai[1] < 255f) - Projectile.ai[1] += 1f; + Player Owner = Main.player[Projectile.owner]; + if (Projectile.ai[1] < 300f) + Projectile.ai[1]++; - if (Projectile.ai[1] == 255f) - Projectile.damage = 2 * Projectile.originalDamage; + Projectile.damage = (int)(Owner.GetTotalDamage(Projectile.DamageType).ApplyTo(Projectile.originalDamage) * (1f + Utils.GetLerpValue(0f, 300f, Projectile.ai[1], true))); - red = 64 + (int)(Projectile.ai[1] * 0.75f); + red = 30 + (int)(Projectile.ai[1] * 0.75f); if (red > 255) red = 255; - Player player = Main.player[Projectile.owner]; - float pi = 0f; - Vector2 playerRotate = player.RotatedRelativePoint(player.MountedCenter, true); - - if (Projectile.spriteDirection == -1) - pi = 3.14159274f; - if (++Projectile.frame >= Main.projFrames[Projectile.type]) Projectile.frame = 0; @@ -65,17 +58,17 @@ namespace CalamityMod.Projectiles.Melee if (Main.myPlayer == Projectile.owner) { - if (player.channel && !player.noItems && !player.CCed) + if (!Owner.CantUseHoldout()) { float scaleFactor6 = 1f; - if (player.ActiveItem().shoot == Projectile.type) - scaleFactor6 = player.ActiveItem().shootSpeed * Projectile.scale; + if (Owner.ActiveItem().shoot == Projectile.type) + scaleFactor6 = Owner.ActiveItem().shootSpeed * Projectile.scale; - Vector2 slashDirection = Main.MouseWorld - playerRotate; + Vector2 slashDirection = Main.MouseWorld - Owner.RotatedRelativePoint(Owner.MountedCenter, true); slashDirection.Normalize(); if (slashDirection.HasNaNs()) - slashDirection = Vector2.UnitX * (float)player.direction; + slashDirection = Vector2.UnitX * (float)Owner.direction; slashDirection *= scaleFactor6; if (slashDirection.X != Projectile.velocity.X || slashDirection.Y != Projectile.velocity.Y) @@ -88,24 +81,26 @@ namespace CalamityMod.Projectiles.Melee } Vector2 dustSpawn = Projectile.Center + Projectile.velocity * 3f; - Lighting.AddLight(dustSpawn, (float)((double)red * 0.001), 0.1f, 0.1f); + Lighting.AddLight(dustSpawn, red * 0.001f, 0.1f, 0.1f); if (Main.rand.NextBool(3)) { - int dust = Dust.NewDust(dustSpawn - Projectile.Size / 2f, Projectile.width, Projectile.height, 66, Projectile.velocity.X, Projectile.velocity.Y, 100, new Color(red, greenAndBlue, greenAndBlue), 1f); + int dust = Dust.NewDust(dustSpawn - Projectile.Size * 0.5f, Projectile.width, Projectile.height, DustID.RainbowTorch, Projectile.velocity.X, Projectile.velocity.Y, 100, new Color(red, greenAndBlue, greenAndBlue), 1f); Main.dust[dust].noGravity = true; Main.dust[dust].position -= Projectile.velocity; } - Projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - Projectile.Size / 2f; - Projectile.rotation = Projectile.velocity.ToRotation() + pi; + Projectile.position = Owner.RotatedRelativePoint(Owner.MountedCenter, true) - Projectile.Size * 0.5f; + Projectile.rotation = Projectile.velocity.ToRotation(); + if (Projectile.spriteDirection == -1) + Projectile.rotation += MathHelper.Pi; 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)); + Owner.ChangeDir(Projectile.direction); + Owner.heldProj = Projectile.whoAmI; + Owner.itemTime = 2; + Owner.itemAnimation = 2; + Owner.itemRotation = (Projectile.velocity * Projectile.direction).ToRotation(); } public override Color? GetAlpha(Color lightColor) diff --git a/Projectiles/Melee/DivineHatchetBoomerang.cs b/Projectiles/Melee/DivineHatchetBoomerang.cs index bb9734bcd1..a37d582fb4 100644 --- a/Projectiles/Melee/DivineHatchetBoomerang.cs +++ b/Projectiles/Melee/DivineHatchetBoomerang.cs @@ -1,11 +1,11 @@ -using CalamityMod.Buffs.DamageOverTime; -using Microsoft.Xna.Framework; -using System; +using System; using System.Collections.Generic; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -45,7 +45,7 @@ namespace CalamityMod.Projectiles.Melee //holy dust if (Main.rand.NextBool(8)) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 244, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.CopperCoin, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } // Boomerang rotation diff --git a/Projectiles/Melee/DracoBeam.cs b/Projectiles/Melee/DracoBeam.cs index 73acde13f8..a213272e50 100644 --- a/Projectiles/Melee/DracoBeam.cs +++ b/Projectiles/Melee/DracoBeam.cs @@ -1,5 +1,6 @@ +using System; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -23,7 +24,9 @@ namespace CalamityMod.Projectiles.Melee Projectile.friendly = true; Projectile.DamageType = DamageClass.Melee; Projectile.ignoreWater = true; - Projectile.penetrate = 1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 2; Projectile.extraUpdates = 1; Projectile.timeLeft = 600; } @@ -44,29 +47,36 @@ namespace CalamityMod.Projectiles.Melee public override void OnKill(int timeLeft) { - float spread = 30f * 0.0174f; - double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int i; - if (Projectile.owner == Main.myPlayer) - { - for (i = 0; i < 4; i++) - { - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - 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); - 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); - } - } for (int k = 0; k < 10; k++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 244, 0f, 0f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f); } } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(BuffID.Daybreak, 180); + if (Projectile.numHits < 1) + { + float spread = 30f * 0.0174f; + double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + int i; + if (Projectile.owner == Main.myPlayer) + { + for (i = 0; i < 4; i++) + { + offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 2f), (float)(Math.Cos(offsetAngle) * 2f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 2f), (float)(-Math.Cos(offsetAngle) * 2f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); + } + } + } + + target.AddBuff(ModContent.BuffType(), 90); + target.AddBuff(BuffID.Slimed, 90); + target.AddBuff(BuffID.Oiled, 90); + target.AddBuff(BuffID.Daybreak, 90); } } } diff --git a/Projectiles/Melee/DracoBeam2.cs b/Projectiles/Melee/DracoBeam2.cs index d426f34cc9..359ea9af86 100644 --- a/Projectiles/Melee/DracoBeam2.cs +++ b/Projectiles/Melee/DracoBeam2.cs @@ -1,3 +1,4 @@ +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -11,48 +12,64 @@ namespace CalamityMod.Projectiles.Melee public override string Texture => "CalamityMod/Projectiles/Melee/DracoBeam"; private int start = 60; - private int speedTimer = 120; + private int speedTimer = 60; + private Vector2 setVel = Vector2.Zero; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 14; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 20; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; } public override void SetDefaults() { Projectile.width = 50; Projectile.height = 50; - Projectile.aiStyle = ProjAIStyleID.Beam; Projectile.friendly = true; Projectile.DamageType = DamageClass.Melee; Projectile.ignoreWater = true; Projectile.tileCollide = false; Projectile.penetrate = -1; - Projectile.timeLeft = 240; + Projectile.extraUpdates = 1; + Projectile.timeLeft = 300; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 10; } public override void AI() { + Projectile.rotation = Projectile.rotation.AngleLerp(Projectile.velocity.ToRotation() + MathHelper.PiOver4, 0.25f); + + if (setVel == Vector2.Zero) + setVel = Projectile.velocity * 3; + start--; if (start <= 0) { speedTimer--; - if (speedTimer > 60) + if (speedTimer > 30) { - Projectile.velocity.X = 0f; - Projectile.velocity.Y = 10f; + if (speedTimer == 59) + { + Projectile.velocity.X = 0f; + Projectile.velocity.Y = 2f; + } + Projectile.velocity *= 1.11f; } - else if (speedTimer <= 60) + else if (speedTimer <= 30) { - Projectile.velocity.X = 0f; - Projectile.velocity.Y = -10f; + if (speedTimer == 30) + { + Projectile.velocity.X = 0f; + Projectile.velocity.Y = -2f; + } + Projectile.velocity *= 1.11f; } if (speedTimer <= 0) { - speedTimer = 120; + speedTimer = 60; + start = 20; + Projectile.velocity = setVel; } } Lighting.AddLight(Projectile.Center, 0.5f, 0.25f, 0f); @@ -60,9 +77,6 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - if (Projectile.timeLeft > 235) - return false; - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); return false; } @@ -71,13 +85,13 @@ namespace CalamityMod.Projectiles.Melee { for (int k = 0; k < 5; k++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 244, 0f, 0f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f); } } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(BuffID.Daybreak, 180); + target.AddBuff(ModContent.BuffType(), 90); } } } diff --git a/Projectiles/Melee/DraconicSpark.cs b/Projectiles/Melee/DraconicSpark.cs index 0f0d594376..3ae085492e 100644 --- a/Projectiles/Melee/DraconicSpark.cs +++ b/Projectiles/Melee/DraconicSpark.cs @@ -1,6 +1,6 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -65,7 +65,7 @@ namespace CalamityMod.Projectiles.Melee if (foundTarget) { float speed = HomingVelocity; - Vector2 projCenter = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); + Vector2 projCenter = Projectile.Center; float xDist = targetX - projCenter.X; float yDist = targetY - projCenter.Y; float dist = (float)Math.Sqrt((double)(xDist * xDist + yDist * yDist)); @@ -93,7 +93,7 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.ai[0] == 0) // daybroken spark { int dustID = 244; - if (Main.rand.Next(3) != 0) + if (!Main.rand.NextBool(3)) { float scale = Main.rand.NextFloat(0.8f, 1.4f); int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustID); @@ -104,7 +104,7 @@ namespace CalamityMod.Projectiles.Melee else if (Projectile.ai[0] == 1) // abyssal flames spark { int dustID = 235; - if (Main.rand.Next(3) != 0) + if (!Main.rand.NextBool(3)) { float scale = Main.rand.NextFloat(0.6f, 1.2f); int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustID, 0f, 0f, 100, default, scale); @@ -115,7 +115,7 @@ namespace CalamityMod.Projectiles.Melee else if (Projectile.ai[0] == 2) // holy flames spark { int dustID = 246; - if (Main.rand.Next(3) != 0) + if (!Main.rand.NextBool(3)) { float scale = Main.rand.NextFloat(0.8f, 1.4f); int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustID); diff --git a/Projectiles/Melee/DragonPowFlail.cs b/Projectiles/Melee/DragonPowFlail.cs index 4287fc3f7c..4ddae172c7 100644 --- a/Projectiles/Melee/DragonPowFlail.cs +++ b/Projectiles/Melee/DragonPowFlail.cs @@ -1,12 +1,12 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Weapons.Melee; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { public class DragonPowFlail : ModProjectile, ILocalizedModType diff --git a/Projectiles/Melee/DragonRageFireball.cs b/Projectiles/Melee/DragonRageFireball.cs index 381d94642f..643bddf962 100644 --- a/Projectiles/Melee/DragonRageFireball.cs +++ b/Projectiles/Melee/DragonRageFireball.cs @@ -1,10 +1,10 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using CalamityMod.Buffs.DamageOverTime; namespace CalamityMod.Projectiles.Melee { @@ -65,8 +65,8 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - Texture2D projectileTexture = ModContent.Request(Texture).Value; - int frameHeight = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; + Texture2D projectileTexture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + int frameHeight = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; int frameY = frameHeight * Projectile.frame; Main.spriteBatch.Draw(projectileTexture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, frameY, projectileTexture.Width, frameHeight)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)projectileTexture.Width / 2f, (float)frameHeight / 2f), Projectile.scale, SpriteEffects.None, 0); return false; @@ -78,7 +78,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.ExpandHitboxBy(80); for (int d = 0; d < 5; d++) { - int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 1f); + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 100, default, 1f); Main.dust[idx].velocity *= 3f; if (Main.rand.NextBool()) { @@ -88,10 +88,10 @@ namespace CalamityMod.Projectiles.Melee } for (int d = 0; d < 8; d++) { - int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 100, default, 2f); Main.dust[idx].noGravity = true; Main.dust[idx].velocity *= 5f; - idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 1f); + idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 100, default, 1f); Main.dust[idx].velocity *= 2f; } diff --git a/Projectiles/Melee/DragonRageStaff.cs b/Projectiles/Melee/DragonRageStaff.cs index 5973f399e6..c02a0bbd26 100644 --- a/Projectiles/Melee/DragonRageStaff.cs +++ b/Projectiles/Melee/DragonRageStaff.cs @@ -81,7 +81,7 @@ namespace CalamityMod.Projectiles.Melee if (Main.rand.NextBool()) { - Dust dust = Dust.NewDustDirect(dustSpawn - new Vector2(5f), 10, 10, 244, player.velocity.X, player.velocity.Y, 150, default, 1f); + Dust dust = Dust.NewDustDirect(dustSpawn - new Vector2(5f), 10, 10, DustID.CopperCoin, player.velocity.X, player.velocity.Y, 150, default, 1f); dust.velocity = Projectile.SafeDirectionTo(dust.position) * 0.1f + dust.velocity * 0.1f; } for (int j = 0; j < 4; j++) @@ -102,9 +102,9 @@ namespace CalamityMod.Projectiles.Melee dustVelMult = 0.5f; break; } - if (Main.rand.Next(6) != 0) + if (!Main.rand.NextBool(6)) { - Dust dust = Dust.NewDustDirect(Projectile.position, 0, 0, 244, 0f, 0f, 100, default, 1f); + Dust dust = Dust.NewDustDirect(Projectile.position, 0, 0, DustID.CopperCoin, 0f, 0f, 100, default, 1f); dust.position = Projectile.Center + staffTipDirection * (60f + Main.rand.NextFloat() * 20f) * dustVelMult2; dust.velocity = tipDustDirection * (4f + 4f * Main.rand.NextFloat()) * dustVelMult2 * dustVelMult; dust.noGravity = true; @@ -252,7 +252,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Vector2 drawPos = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); Rectangle rectangle = new Rectangle(0, 0, tex.Width, tex.Height); Vector2 origin = tex.Size() / 2f; diff --git a/Projectiles/Melee/Earth2.cs b/Projectiles/Melee/Earth2.cs index 6ad47c4d86..6174b81d72 100644 --- a/Projectiles/Melee/Earth2.cs +++ b/Projectiles/Melee/Earth2.cs @@ -1,9 +1,9 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { public class Earth2 : ModProjectile, ILocalizedModType @@ -56,7 +56,7 @@ namespace CalamityMod.Projectiles.Melee if (Main.rand.NextBool(16)) { Vector2 dustDirection = Vector2.UnitX.RotatedByRandom(1.5707963705062866).RotatedBy((double)Projectile.velocity.ToRotation(), default); - int greenishDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 229, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1.2f); + int greenishDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Vortex, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1.2f); Main.dust[greenishDust].velocity = dustDirection * 0.66f; Main.dust[greenishDust].position = Projectile.Center + dustDirection * 12f; } @@ -71,7 +71,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.light = 0.9f; if (Main.rand.NextBool(10)) { - Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 229, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1.2f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Vortex, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1.2f); } if (Main.rand.NextBool(20) && Main.netMode != NetmodeID.Server) { @@ -86,7 +86,7 @@ namespace CalamityMod.Projectiles.Melee SoundEngine.PlaySound(SoundID.Item10, Projectile.position); for (int k = 0; k < 15; k++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 229, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Vortex, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } } diff --git a/Projectiles/Melee/Earth3.cs b/Projectiles/Melee/Earth3.cs index 60691b5e4e..1b48604698 100644 --- a/Projectiles/Melee/Earth3.cs +++ b/Projectiles/Melee/Earth3.cs @@ -1,10 +1,10 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { public class Earth3 : ModProjectile, ILocalizedModType @@ -56,7 +56,7 @@ namespace CalamityMod.Projectiles.Melee if (Main.rand.NextBool(16)) { Vector2 dustDirection = Vector2.UnitX.RotatedByRandom(1.5707963705062866).RotatedBy((double)Projectile.velocity.ToRotation(), default); - int brownDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1.2f); + int brownDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1.2f); Main.dust[brownDust].velocity = dustDirection * 0.66f; Main.dust[brownDust].position = Projectile.Center + dustDirection * 12f; } @@ -71,7 +71,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.light = 0.9f; if (Main.rand.NextBool(10)) { - Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1.2f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1.2f); } if (Main.rand.NextBool(20) && Main.netMode != NetmodeID.Server) { @@ -92,7 +92,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int i = 0; i < 20; i++) { - int dusty = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); + int dusty = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 100, default, 2f); Main.dust[dusty].velocity *= 3f; if (Main.rand.NextBool()) { @@ -102,10 +102,10 @@ namespace CalamityMod.Projectiles.Melee } for (int num623 = 0; num623 < 35; num623++) { - int dusty2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 3f); + int dusty2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 100, default, 3f); Main.dust[dusty2].noGravity = true; Main.dust[dusty2].velocity *= 5f; - dusty2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); + dusty2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 100, default, 2f); Main.dust[dusty2].velocity *= 2f; } diff --git a/Projectiles/Melee/Earth4.cs b/Projectiles/Melee/Earth4.cs index 3f6f3696ec..45697eb278 100644 --- a/Projectiles/Melee/Earth4.cs +++ b/Projectiles/Melee/Earth4.cs @@ -1,10 +1,11 @@ -using CalamityMod.Projectiles.Healing; +using System; +using CalamityMod.Balancing; +using CalamityMod.Projectiles.Healing; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { public class Earth4 : ModProjectile, ILocalizedModType @@ -56,7 +57,7 @@ namespace CalamityMod.Projectiles.Melee if (Main.rand.NextBool(16)) { Vector2 dustDirection = Vector2.UnitX.RotatedByRandom(1.5707963705062866).RotatedBy((double)Projectile.velocity.ToRotation(), default); - int brightGreenDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 74, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1.2f); + int brightGreenDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GreenFairy, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1.2f); Main.dust[brightGreenDust].velocity = dustDirection * 0.66f; Main.dust[brightGreenDust].position = Projectile.Center + dustDirection * 12f; } @@ -71,7 +72,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.light = 0.9f; if (Main.rand.NextBool(10)) { - Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 74, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1.2f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GreenFairy, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1.2f); } if (Main.rand.NextBool(20) && Main.netMode != NetmodeID.Server) { @@ -86,7 +87,7 @@ namespace CalamityMod.Projectiles.Melee SoundEngine.PlaySound(SoundID.Item10, Projectile.position); for (int k = 0; k < 15; k++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 74, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.GreenFairy, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } } @@ -94,17 +95,14 @@ namespace CalamityMod.Projectiles.Melee { SoundEngine.PlaySound(SoundID.Item4, Projectile.position); - float healAmt = hit.Damage * 0.075f; - if ((int)healAmt == 0) + int heal = (int)Math.Round(hit.Damage * 0.075); + if (heal > BalancingConstants.LifeStealCap) + heal = BalancingConstants.LifeStealCap; + + if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) return; - if (Main.player[Main.myPlayer].lifeSteal <= 0f) - return; - - if (healAmt > CalamityMod.lifeStealCap) - healAmt = CalamityMod.lifeStealCap; - - CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], healAmt, ModContent.ProjectileType(), 1200f, 3f); + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ModContent.ProjectileType(), BalancingConstants.LifeStealRange); } } } diff --git a/Projectiles/Melee/EarthProj.cs b/Projectiles/Melee/EarthProj.cs index 204ba36e80..753f34b147 100644 --- a/Projectiles/Melee/EarthProj.cs +++ b/Projectiles/Melee/EarthProj.cs @@ -1,9 +1,9 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { diff --git a/Projectiles/Melee/ElementBall.cs b/Projectiles/Melee/ElementBall.cs index 86233f22be..1999237276 100644 --- a/Projectiles/Melee/ElementBall.cs +++ b/Projectiles/Melee/ElementBall.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - int rainbowDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 66, (float)(Projectile.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + int rainbowDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RainbowTorch, (float)(Projectile.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); Main.dust[rainbowDust].noGravity = true; Main.dust[rainbowDust].velocity *= 0f; diff --git a/Projectiles/Melee/ElementBallShiv.cs b/Projectiles/Melee/ElementBallShiv.cs index 619d7eed17..0a114c1225 100644 --- a/Projectiles/Melee/ElementBallShiv.cs +++ b/Projectiles/Melee/ElementBallShiv.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - int rainbow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 66, (float)(Projectile.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.3f); + int rainbow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RainbowTorch, (float)(Projectile.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.3f); Main.dust[rainbow].noGravity = true; Main.dust[rainbow].velocity = Vector2.Zero; @@ -44,7 +44,7 @@ namespace CalamityMod.Projectiles.Melee { for (int k = 0; k < 2; k++) { - int rainbow = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 66, (float)(Projectile.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + int rainbow = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.RainbowTorch, (float)(Projectile.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); Main.dust[rainbow].noGravity = true; } } diff --git a/Projectiles/Melee/ElementalGlassStar.cs b/Projectiles/Melee/ElementalGlassStar.cs index f8e9143f81..27445e7ef2 100644 --- a/Projectiles/Melee/ElementalGlassStar.cs +++ b/Projectiles/Melee/ElementalGlassStar.cs @@ -1,12 +1,12 @@ -using CalamityMod.Particles; +using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using CalamityMod.Buffs.DamageOverTime; namespace CalamityMod.Projectiles.Melee { @@ -38,7 +38,7 @@ namespace CalamityMod.Projectiles.Melee { if (Timer == 0) { - Particle spark = new FlareShine(Projectile.Center, Vector2.Zero, Color.White, Color.OrangeRed, 0f,new Vector2(0.5f, 1f), new Vector2(1.5f, 3f), 20, 0f, hueShift: 0.01f); + Particle spark = new FlareShine(Projectile.Center, Vector2.Zero, Color.White, Color.OrangeRed, 0f, new Vector2(0.5f, 1f), new Vector2(1.5f, 3f), 20, 0f, hueShift: 0.01f); GeneralParticleHandler.SpawnParticle(spark); for (int i = 0; i < 2; i++) @@ -59,7 +59,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.velocity *= 0.95f; } - if (Main.rand.Next(3) == 0) + if (Main.rand.NextBool(3)) { int dustType = Main.rand.Next(3); dustType = dustType == 0 ? 15 : dustType == 1 ? 57 : 58; diff --git a/Projectiles/Melee/EmpyreanKnife.cs b/Projectiles/Melee/EmpyreanKnife.cs index b37700d8f2..f34ef00167 100644 --- a/Projectiles/Melee/EmpyreanKnife.cs +++ b/Projectiles/Melee/EmpyreanKnife.cs @@ -1,5 +1,6 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using CalamityMod.Balancing; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -47,7 +48,7 @@ namespace CalamityMod.Projectiles.Melee } CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 150f, 12f, 20f); if (Main.rand.NextBool(6)) - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 58, Projectile.velocity.X * 0.1f, Projectile.velocity.Y * 0.1f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Enchanted_Pink, Projectile.velocity.X * 0.1f, Projectile.velocity.Y * 0.1f); } public override bool OnTileCollide(Vector2 oldVelocity) @@ -69,7 +70,7 @@ namespace CalamityMod.Projectiles.Melee { for (int i = 0; i < 3; i++) { - int empyreanDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 58, 0f, 0f, 100, default, 0.8f); + int empyreanDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Enchanted_Pink, 0f, 0f, 100, default, 0.8f); Main.dust[empyreanDust].noGravity = true; Main.dust[empyreanDust].velocity *= 1.2f; Main.dust[empyreanDust].velocity -= Projectile.oldVelocity * 0.3f; @@ -78,32 +79,26 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - float healAmt = hit.Damage * 0.0075f; - if ((int)healAmt == 0) + int heal = (int)Math.Round(hit.Damage * 0.015); + if (heal > BalancingConstants.LifeStealCap) + heal = BalancingConstants.LifeStealCap; + + if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) return; - if (Main.player[Main.myPlayer].lifeSteal <= 0f) - return; - - if (healAmt > CalamityMod.lifeStealCap) - healAmt = CalamityMod.lifeStealCap; - - CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], healAmt, ProjectileID.VampireHeal, 1200f, 3f); + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); } public override void OnHitPlayer(Player target, Player.HurtInfo info) { - float healAmt = info.Damage * 0.005f; - if ((int)healAmt == 0) + int heal = (int)Math.Round(info.Damage * 0.015); + if (heal > BalancingConstants.LifeStealCap) + heal = BalancingConstants.LifeStealCap; + + if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0) return; - if (Main.player[Main.myPlayer].lifeSteal <= 0f) - return; - - if (healAmt > CalamityMod.lifeStealCap) - healAmt = CalamityMod.lifeStealCap; - - CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], healAmt, ProjectileID.VampireHeal, 1200f, 3f); + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); } public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Melee/EntropicFlechette.cs b/Projectiles/Melee/EntropicFlechette.cs index f598ca5a90..d71aa2f35e 100644 --- a/Projectiles/Melee/EntropicFlechette.cs +++ b/Projectiles/Melee/EntropicFlechette.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Projectiles.Melee for (int i = 0; i < 2; i++) { Vector2 dustRotate = -Vector2.UnitY.RotatedBy((double)(Projectile.localAI[0] * 0.1308997f + (float)i * 3.14159274f), default) * rotateVector; - int darkDust = Dust.NewDust(Projectile.Center, 0, 0, 27, 0f, 0f, 160, default, 1f); + int darkDust = Dust.NewDust(Projectile.Center, 0, 0, DustID.Shadowflame, 0f, 0f, 160, default, 1f); Main.dust[darkDust].scale = 1f; Main.dust[darkDust].noGravity = true; Main.dust[darkDust].position = Projectile.Center + dustRotate; @@ -46,7 +46,7 @@ namespace CalamityMod.Projectiles.Melee } } - int darkestDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 27, 0f, 0f, 100, default, 0.8f); + int darkestDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Shadowflame, 0f, 0f, 100, default, 0.8f); Main.dust[darkestDust].noGravity = true; Main.dust[darkestDust].velocity *= 0f; diff --git a/Projectiles/Melee/EntropicFlechetteLarge.cs b/Projectiles/Melee/EntropicFlechetteLarge.cs index 08aa4c6067..b54b35ec53 100644 --- a/Projectiles/Melee/EntropicFlechetteLarge.cs +++ b/Projectiles/Melee/EntropicFlechetteLarge.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Projectiles.Melee for (int i = 0; i < 2; i++) { Vector2 dustRotate = -Vector2.UnitY.RotatedBy((double)(Projectile.localAI[0] * 0.1308997f + (float)i * 3.14159274f), default) * rotateVector; - int darkDust = Dust.NewDust(Projectile.Center, 0, 0, 27, 0f, 0f, 160, default, 1f); + int darkDust = Dust.NewDust(Projectile.Center, 0, 0, DustID.Shadowflame, 0f, 0f, 160, default, 1f); Main.dust[darkDust].scale = 1f; Main.dust[darkDust].noGravity = true; Main.dust[darkDust].position = Projectile.Center + dustRotate; @@ -46,7 +46,7 @@ namespace CalamityMod.Projectiles.Melee } } - int darkestDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 27, 0f, 0f, 100, default, 0.8f); + int darkestDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Shadowflame, 0f, 0f, 100, default, 0.8f); Main.dust[darkestDust].noGravity = true; Main.dust[darkestDust].velocity *= 0f; diff --git a/Projectiles/Melee/EntropicFlechetteSmall.cs b/Projectiles/Melee/EntropicFlechetteSmall.cs index 1396ebc85d..1db25a8648 100644 --- a/Projectiles/Melee/EntropicFlechetteSmall.cs +++ b/Projectiles/Melee/EntropicFlechetteSmall.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Projectiles.Melee for (int i = 0; i < 2; i++) { Vector2 dustRotate = -Vector2.UnitY.RotatedBy((double)(Projectile.localAI[0] * 0.1308997f + (float)i * 3.14159274f), default) * rotateVector; - int darkDust = Dust.NewDust(Projectile.Center, 0, 0, 27, 0f, 0f, 160, default, 1f); + int darkDust = Dust.NewDust(Projectile.Center, 0, 0, DustID.Shadowflame, 0f, 0f, 160, default, 1f); Main.dust[darkDust].scale = 1f; Main.dust[darkDust].noGravity = true; Main.dust[darkDust].position = Projectile.Center + dustRotate; @@ -46,7 +46,7 @@ namespace CalamityMod.Projectiles.Melee } } - int darkestDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 27, 0f, 0f, 100, default, 0.8f); + int darkestDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Shadowflame, 0f, 0f, 100, default, 0.8f); Main.dust[darkestDust].noGravity = true; Main.dust[darkestDust].velocity *= 0f; diff --git a/Projectiles/Melee/EonBolt.cs b/Projectiles/Melee/EonBolt.cs index 7dfa68a3c0..ff20bd185c 100644 --- a/Projectiles/Melee/EonBolt.cs +++ b/Projectiles/Melee/EonBolt.cs @@ -1,9 +1,10 @@ -using CalamityMod.Particles; -using Terraria.Graphics.Shaders; +using System; +using CalamityMod.Graphics.Primitives; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; @@ -71,12 +72,12 @@ namespace CalamityMod.Projectiles.Melee Lighting.AddLight(Projectile.Center, 0.75f, 1f, 0.24f); - if (Main.rand.Next(2) == 0) + if (Main.rand.NextBool(2)) { Particle smoke = new HeavySmokeParticle(Projectile.Center, Projectile.velocity * 0.5f, Color.Lerp(Color.DodgerBlue, Color.MediumVioletRed, (float)Math.Sin(Main.GlobalTimeWrappedHourly * 6f)), 20, Main.rand.NextFloat(0.6f, 1.2f) * Projectile.scale, 0.28f, 0, false, 0, true); GeneralParticleHandler.SpawnParticle(smoke); - if (Main.rand.Next(3) == 0) + if (Main.rand.NextBool(3)) { Particle smokeGlow = new HeavySmokeParticle(Projectile.Center, Projectile.velocity * 0.5f, Main.hslToRgb(Hue, 1, 0.7f), 15, Main.rand.NextFloat(0.4f, 0.7f) * Projectile.scale, 0.8f, 0, true, 0.05f, true); GeneralParticleHandler.SpawnParticle(smokeGlow); diff --git a/Projectiles/Melee/EssenceFlame2.cs b/Projectiles/Melee/EssenceFlame2.cs index a99f7fc64d..1b4a23fa60 100644 --- a/Projectiles/Melee/EssenceFlame2.cs +++ b/Projectiles/Melee/EssenceFlame2.cs @@ -1,8 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { public class EssenceFlame2 : ModProjectile, ILocalizedModType @@ -58,7 +58,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int i = 0; i < 5; i++) { - int essenceDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 2f); + int essenceDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, 0f, 0f, 100, default, 2f); Main.dust[essenceDust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -68,10 +68,10 @@ namespace CalamityMod.Projectiles.Melee } for (int j = 0; j < 8; j++) { - int essenceDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 3f); + int essenceDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, 0f, 0f, 100, default, 3f); Main.dust[essenceDust2].noGravity = true; Main.dust[essenceDust2].velocity *= 5f; - essenceDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 2f); + essenceDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, 0f, 0f, 100, default, 2f); Main.dust[essenceDust2].velocity *= 2f; } } diff --git a/Projectiles/Melee/EssenceScythe.cs b/Projectiles/Melee/EssenceScythe.cs index 497d6b5826..2fedb0d73e 100644 --- a/Projectiles/Melee/EssenceScythe.cs +++ b/Projectiles/Melee/EssenceScythe.cs @@ -1,3 +1,4 @@ +using CalamityMod.Balancing; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Projectiles.Healing; using Microsoft.Xna.Framework; @@ -29,6 +30,8 @@ namespace CalamityMod.Projectiles.Melee Projectile.timeLeft = 300; Projectile.ignoreWater = true; AIType = ProjectileID.DeathSickle; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 2; } public override void AI() @@ -37,7 +40,7 @@ namespace CalamityMod.Projectiles.Melee if (Main.rand.NextBool(3)) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 173, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } CalamityUtils.HomeInOnNPC(Projectile, true, 300f, 12f, 20f); @@ -63,7 +66,7 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally; - Main.EntitySpriteDraw(ModContent.Request(Texture).Value, Projectile.Center - Main.screenPosition, null, color, Projectile.rotation, origin, 1f, spriteEffects, 0); + Main.EntitySpriteDraw(Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value, Projectile.Center - Main.screenPosition, null, color, Projectile.rotation, origin, 1f, spriteEffects, 0); } public override Color? GetAlpha(Color lightColor) @@ -73,12 +76,11 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.immune[Projectile.owner] = 2; target.AddBuff(ModContent.BuffType(), 180); - if (target.life <= 0) + if (target.life <= 0 && target.lifeMax > 5) { if (Projectile.owner == Main.myPlayer) - CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], 8, ModContent.ProjectileType(), 1200f, 0f); + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], 8, ModContent.ProjectileType(), BalancingConstants.LifeStealRange, 0f); } } } diff --git a/Projectiles/Melee/EutrophicScimitarProj.cs b/Projectiles/Melee/EutrophicScimitarProj.cs index f285071702..a5564d719a 100644 --- a/Projectiles/Melee/EutrophicScimitarProj.cs +++ b/Projectiles/Melee/EutrophicScimitarProj.cs @@ -1,8 +1,10 @@ -using CalamityMod.Buffs.StatDebuffs; +using System; +using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Melee { public class EutrophicScimitarProj : ModProjectile, ILocalizedModType @@ -48,17 +50,17 @@ namespace CalamityMod.Projectiles.Melee } if (Projectile.velocity.X < 0f) { - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X); + Projectile.rotation = Projectile.velocity.ToRotation(); } else { - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X); + Projectile.rotation = Projectile.velocity.ToRotation(); } if (Main.rand.NextBool()) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 226, Projectile.velocity.X * 0.25f, Projectile.velocity.Y * 0.25f, 0, new Color(255, 255, 255), 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Electric, Projectile.velocity.X * 0.25f, Projectile.velocity.Y * 0.25f, 0, new Color(255, 255, 255), 0.5f); } - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X); + Projectile.rotation = Projectile.velocity.ToRotation(); } public override void OnKill(int timeLeft) @@ -67,7 +69,7 @@ namespace CalamityMod.Projectiles.Melee { Dust dust; Vector2 position = new Vector2(Projectile.position.X - 4, Projectile.position.Y - 4); - dust = Main.dust[Terraria.Dust.NewDust(position, 58, 58, 226, 0f, 0f, 0, new Color(255, 255, 255), 0.4605263f)]; + dust = Main.dust[Terraria.Dust.NewDust(position, 58, 58, DustID.Electric, 0f, 0f, 0, new Color(255, 255, 255), 0.4605263f)]; dust.noGravity = true; dust.fadeIn = 0.9473684f; } diff --git a/Projectiles/Melee/EutrophicSpark.cs b/Projectiles/Melee/EutrophicSpark.cs index 7dd42bd447..c305f82456 100644 --- a/Projectiles/Melee/EutrophicSpark.cs +++ b/Projectiles/Melee/EutrophicSpark.cs @@ -1,6 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Melee { public class EutrophicSpark : ModProjectile, ILocalizedModType @@ -50,7 +52,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.velocity.Y = Projectile.velocity.Y + 0.2f; } Projectile.rotation += Projectile.velocity.X * 0.1f; - int eutrophicDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 206, 0f, 0f, 100, default, 1f); + int eutrophicDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.UnusedWhiteBluePurple, 0f, 0f, 100, default, 1f); Dust expr_8976_cp_0 = Main.dust[eutrophicDust]; expr_8976_cp_0.position.X -= 2f; Dust expr_8994_cp_0 = Main.dust[eutrophicDust]; @@ -61,7 +63,7 @@ namespace CalamityMod.Projectiles.Melee expr_89E7_cp_0.velocity.Y -= 2f; if (Main.rand.NextBool()) { - int eutrophicDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 206, 0f, 0f, 100, default, 1f); + int eutrophicDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.UnusedWhiteBluePurple, 0f, 0f, 100, default, 1f); Dust expr_8A4E_cp_0 = Main.dust[eutrophicDust2]; expr_8A4E_cp_0.position.X -= 2f; Dust expr_8A6C_cp_0 = Main.dust[eutrophicDust2]; diff --git a/Projectiles/Melee/ExcelsusBlue.cs b/Projectiles/Melee/ExcelsusBlue.cs index 28c9194154..df52f54cfd 100644 --- a/Projectiles/Melee/ExcelsusBlue.cs +++ b/Projectiles/Melee/ExcelsusBlue.cs @@ -1,7 +1,7 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -38,7 +38,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.02f; if (Main.rand.NextBool(8)) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 56, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.BlueFairy, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } } @@ -65,7 +65,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } diff --git a/Projectiles/Melee/ExcelsusMain.cs b/Projectiles/Melee/ExcelsusMain.cs index c756cb4c50..55d116045f 100644 --- a/Projectiles/Melee/ExcelsusMain.cs +++ b/Projectiles/Melee/ExcelsusMain.cs @@ -1,7 +1,7 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -65,7 +65,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } diff --git a/Projectiles/Melee/ExcelsusPink.cs b/Projectiles/Melee/ExcelsusPink.cs index 85661b3787..d260c54745 100644 --- a/Projectiles/Melee/ExcelsusPink.cs +++ b/Projectiles/Melee/ExcelsusPink.cs @@ -1,7 +1,7 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -38,7 +38,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.02f; if (Main.rand.NextBool(8)) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 242, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.PinkTorch, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } } @@ -65,7 +65,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } diff --git a/Projectiles/Melee/Exobeam.cs b/Projectiles/Melee/Exobeam.cs index c7d6d046fd..96b0c2a0b9 100644 --- a/Projectiles/Melee/Exobeam.cs +++ b/Projectiles/Melee/Exobeam.cs @@ -1,17 +1,17 @@ -using CalamityMod.Buffs.DamageOverTime; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Audio; +using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Graphics.Primitives; using CalamityMod.Items.Weapons.Melee; -using Terraria.Graphics.Shaders; -using static CalamityMod.CalamityUtils; -using static Terraria.ModLoader.ModContent; -using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; -using CalamityMod.Graphics.Primitives; +using Terraria; +using Terraria.Audio; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; +using static CalamityMod.CalamityUtils; +using static Terraria.ModLoader.ModContent; namespace CalamityMod.Projectiles.Melee { @@ -63,7 +63,7 @@ namespace CalamityMod.Projectiles.Melee else { - Vector2 idealVelocity = Projectile.SafeDirectionTo(Main.npc[TargetIndex].Center) * (Projectile.velocity.Length() + 3.5f); + Vector2 idealVelocity = Projectile.SafeDirectionTo(Main.npc[TargetIndex].Center) * (Projectile.velocity.Length() + 6.5f); Projectile.velocity = Vector2.Lerp(Projectile.velocity, idealVelocity, 0.08f); } } diff --git a/Projectiles/Melee/ExobeamSlash.cs b/Projectiles/Melee/ExobeamSlash.cs index 244c5af664..556a8b8b79 100644 --- a/Projectiles/Melee/ExobeamSlash.cs +++ b/Projectiles/Melee/ExobeamSlash.cs @@ -1,9 +1,9 @@ -using Microsoft.Xna.Framework; +using System; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ModLoader; -using System; -using CalamityMod.Buffs.DamageOverTime; namespace CalamityMod.Projectiles.Melee { @@ -62,7 +62,7 @@ namespace CalamityMod.Projectiles.Melee float progress = (33 - Projectile.timeLeft) / 33f; - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Texture2D bloomTexture = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; Vector2 drawPosition = Projectile.Center - Main.screenPosition; diff --git a/Projectiles/Melee/ExobeamSlashCreator.cs b/Projectiles/Melee/ExobeamSlashCreator.cs index 3ff3b0f1f5..4ad18c1c87 100644 --- a/Projectiles/Melee/ExobeamSlashCreator.cs +++ b/Projectiles/Melee/ExobeamSlashCreator.cs @@ -1,5 +1,5 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Projectiles/Melee/ExobladeProj.cs b/Projectiles/Melee/ExobladeProj.cs index 9084d6c121..028976e98e 100644 --- a/Projectiles/Melee/ExobladeProj.cs +++ b/Projectiles/Melee/ExobladeProj.cs @@ -2,11 +2,13 @@ using System.Collections.Generic; using System.IO; using System.Linq; +using CalamityMod.Balancing; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; using CalamityMod.Graphics.Primitives; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Particles; +using CalamityMod.Projectiles.Healing; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; @@ -59,7 +61,7 @@ namespace CalamityMod.Projectiles.Melee return SwingState.Swinging; } - + set { Projectile.ai[0] = (int)value; @@ -76,7 +78,7 @@ namespace CalamityMod.Projectiles.Melee get => Projectile.ai[1] > 0; set => Projectile.ai[1] = value ? 1 : 0; } - + public ref float SwingTime => ref Projectile.localAI[0]; public ref float SquishFactor => ref Projectile.localAI[1]; @@ -90,9 +92,9 @@ namespace CalamityMod.Projectiles.Melee public static float MaxSwingAngle = MathHelper.PiOver2 * 1.8f; - public CurveSegment SlowStart = new (PolyOutEasing, 0f, -1f, 0.3f, 2); - public CurveSegment SwingFast = new (PolyInEasing, 0.27f, -0.7f, 1.6f, 4); - public CurveSegment EndSwing = new (PolyOutEasing, 0.85f, 0.9f, 0.1f, 2); + public CurveSegment SlowStart = new(PolyOutEasing, 0f, -1f, 0.3f, 2); + public CurveSegment SwingFast = new(PolyInEasing, 0.27f, -0.7f, 1.6f, 4); + public CurveSegment EndSwing = new(PolyOutEasing, 0.85f, 0.9f, 0.1f, 2); public float SwingAngleShiftAtProgress(float progress) => State == SwingState.BonkDash ? 0 : MaxSwingAngle * PiecewiseAnimation(progress, new CurveSegment[] { SlowStart, SwingFast, EndSwing }); public float SwordRotationAtProgress(float progress) => State == SwingState.BonkDash ? BaseRotation : BaseRotation + SwingAngleShiftAtProgress(progress) * Direction; public float SquishAtProgress(float progress) => State == SwingState.BonkDash ? 1 : MathHelper.Lerp(SquishVector.X, SquishVector.Y, (float)Math.Abs(Math.Sin(SwingAngleShiftAtProgress(progress)))); @@ -231,7 +233,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.velocity = Owner.MountedCenter.DirectionTo(Owner.Calamity().mouseWorld); //Give the sword slash a random squouish SquishFactor = Main.rand.NextFloat(0.67f, 1f); //Note higher squishes make the trail look wonky - + //If youre doing a slash and this is the first slash you do, you start small so it grows big if (startInitialization && State != SwingState.BonkDash) Projectile.scale = 0.02f; @@ -333,7 +335,7 @@ namespace CalamityMod.Projectiles.Melee // Create a bunch of homing beams. int beamShootStart = (int)(SwingTime * 0.6f); - int beamShootPeriod = (int)(SwingTime * 0.35f); + int beamShootPeriod = (int)(SwingTime * 0.4f); int beamShootEnd = beamShootStart + beamShootPeriod; beamShootPeriod /= (Exoblade.BeamsPerSwing - 1); @@ -505,7 +507,7 @@ namespace CalamityMod.Projectiles.Melee public void DrawBlade() { - var texture = ModContent.Request(Texture).Value; + var texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; SpriteEffects direction = Direction == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; if (State == SwingState.Swinging) @@ -591,7 +593,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.netUpdate = true; SoundEngine.PlaySound(Exoblade.DashHitSound, target.Center); - SoundEngine.PlaySound(Exoblade.BeamHitSound with { Volume = Exoblade.BeamHitSound.Volume * 1.2f}, target.Center); + SoundEngine.PlaySound(Exoblade.BeamHitSound with { Volume = Exoblade.BeamHitSound.Volume * 1.2f }, target.Center); if (Main.myPlayer == Projectile.owner) { int lungeHitDamage = (int)(Projectile.damage * Exoblade.LungeDamageFactor); @@ -615,6 +617,18 @@ namespace CalamityMod.Projectiles.Melee int explosionDamage = (int)(Projectile.damage * Exoblade.ExplosionDamageFactor); Projectile.NewProjectile(Projectile.GetSource_FromAI(), target.Center, Vector2.Zero, ModContent.ProjectileType(), explosionDamage, 0f, Projectile.owner); } + + if (target.lifeMax <= 5 || Owner.lifeSteal <= 0) + return; + + int healAmt = (int)Math.Round(hit.Damage * 0.04); + if (healAmt > BalancingConstants.LifeStealCap) + healAmt = BalancingConstants.LifeStealCap; + + if (healAmt <= 0) + return; + + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Owner, healAmt, ModContent.ProjectileType(), BalancingConstants.LifeStealRange); } } diff --git a/Projectiles/Melee/Exoboom.cs b/Projectiles/Melee/Exoboom.cs index 334b85f982..84b5f260be 100644 --- a/Projectiles/Melee/Exoboom.cs +++ b/Projectiles/Melee/Exoboom.cs @@ -1,8 +1,8 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; -using CalamityMod.Particles; namespace CalamityMod.Projectiles.Melee { diff --git a/Projectiles/Melee/Exocomet.cs b/Projectiles/Melee/Exocomet.cs index 0caae195ec..f25747109b 100644 --- a/Projectiles/Melee/Exocomet.cs +++ b/Projectiles/Melee/Exocomet.cs @@ -1,10 +1,12 @@ -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Balancing; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Projectiles.Healing; using Microsoft.Xna.Framework; +using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -53,9 +55,9 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.alpha < 40) { - int exo = Dust.NewDust(new Vector2(Projectile.position.X - Projectile.velocity.X * 4f + 2f, Projectile.position.Y + 2f - Projectile.velocity.Y * 4f), 8, 8, 107, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, new Color(0, 255, 255), 0.5f); + int exo = Dust.NewDust(new Vector2(Projectile.position.X - Projectile.velocity.X * 4f + 2f, Projectile.position.Y + 2f - Projectile.velocity.Y * 4f), 8, 8, DustID.TerraBlade, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, new Color(0, 255, 255), 0.5f); Main.dust[exo].velocity *= -0.25f; - exo = Dust.NewDust(new Vector2(Projectile.position.X - Projectile.velocity.X * 4f + 2f, Projectile.position.Y + 2f - Projectile.velocity.Y * 4f), 8, 8, 107, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, new Color(0, 255, 255), 0.5f); + exo = Dust.NewDust(new Vector2(Projectile.position.X - Projectile.velocity.X * 4f + 2f, Projectile.position.Y + 2f - Projectile.velocity.Y * 4f), 8, 8, DustID.TerraBlade, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, new Color(0, 255, 255), 0.5f); Main.dust[exo].velocity *= -0.25f; Main.dust[exo].position -= Projectile.velocity * 0.5f; } @@ -85,34 +87,28 @@ namespace CalamityMod.Projectiles.Melee { target.AddBuff(ModContent.BuffType(), 300); - float healAmt = hit.Damage * 0.01f; - if ((int)healAmt == 0) + int heal = (int)Math.Round(hit.Damage * 0.01); + if (heal > BalancingConstants.LifeStealCap) + heal = BalancingConstants.LifeStealCap; + + if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) return; - if (Main.player[Main.myPlayer].lifeSteal <= 0f) - return; - - if (healAmt > CalamityMod.lifeStealCap) - healAmt = CalamityMod.lifeStealCap; - - CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], healAmt, ModContent.ProjectileType(), 1200f, 3f); + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ModContent.ProjectileType(), BalancingConstants.LifeStealRange); } public override void OnHitPlayer(Player target, Player.HurtInfo info) { target.AddBuff(ModContent.BuffType(), 300); - float healAmt = info.Damage * 0.01f; - if ((int)healAmt == 0) + int heal = (int)Math.Round(info.Damage * 0.01); + if (heal > BalancingConstants.LifeStealCap) + heal = BalancingConstants.LifeStealCap; + + if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0) return; - if (Main.player[Main.myPlayer].lifeSteal <= 0f) - return; - - if (healAmt > CalamityMod.lifeStealCap) - healAmt = CalamityMod.lifeStealCap; - - CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], healAmt, ModContent.ProjectileType(), 1200f, 3f); + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ModContent.ProjectileType(), BalancingConstants.LifeStealRange); } public override bool PreDraw(ref Color lightColor) @@ -135,14 +131,14 @@ namespace CalamityMod.Projectiles.Melee Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int i = 0; i < 2; i++) { - Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.TerraBlade, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); } for (int j = 0; j < 20; j++) { - int exoDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); + int exoDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.TerraBlade, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); Main.dust[exoDust].noGravity = true; Main.dust[exoDust].velocity *= 3f; - exoDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + exoDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.TerraBlade, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); Main.dust[exoDust].velocity *= 2f; Main.dust[exoDust].noGravity = true; } diff --git a/Projectiles/Melee/FallenBlast.cs b/Projectiles/Melee/FallenBlast.cs index 079c70016e..d892997ff2 100644 --- a/Projectiles/Melee/FallenBlast.cs +++ b/Projectiles/Melee/FallenBlast.cs @@ -3,10 +3,10 @@ using System.IO; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; -using Terraria.ID; -using Terraria.ModLoader; using Terraria.Audio; using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { diff --git a/Projectiles/Melee/FallenPaladinsHammerEcho.cs b/Projectiles/Melee/FallenPaladinsHammerEcho.cs index ffa8d34c22..9105b741dd 100644 --- a/Projectiles/Melee/FallenPaladinsHammerEcho.cs +++ b/Projectiles/Melee/FallenPaladinsHammerEcho.cs @@ -3,9 +3,9 @@ using System.IO; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -73,7 +73,7 @@ namespace CalamityMod.Projectiles.Melee { Vector2 offset = new Vector2(7, 0).RotatedByRandom(MathHelper.ToRadians(360f)); Vector2 velOffset = new Vector2(3, 0).RotatedBy(offset.ToRotation()); - Dust dust = Dust.NewDustPerfect(new Vector2(Projectile.position.X, Projectile.position.Y) + offset, DustID.RedTorch, new Vector2(Projectile.velocity.X * 0.2f + velOffset.X, Projectile.velocity.Y * 0.2f + velOffset.Y), 100, new Color(255, 245, 198), 2f); + Dust dust = Dust.NewDustPerfect(Projectile.position + offset, DustID.RedTorch, new Vector2(Projectile.velocity.X * 0.2f + velOffset.X, Projectile.velocity.Y * 0.2f + velOffset.Y), 100, new Color(255, 245, 198), 2f); dust.noGravity = true; } @@ -81,7 +81,7 @@ namespace CalamityMod.Projectiles.Melee { Vector2 offset = new Vector2(7, 0).RotatedByRandom(MathHelper.ToRadians(360f)); Vector2 velOffset = new Vector2(3, 0).RotatedBy(offset.ToRotation()); - Dust dust = Dust.NewDustPerfect(new Vector2(Projectile.position.X, Projectile.position.Y) + offset, DustID.RedTorch, new Vector2(Projectile.velocity.X * 0.2f + velOffset.X, Projectile.velocity.Y * 0.2f + velOffset.Y), 100, new Color(255, 245, 198), 2f); + Dust dust = Dust.NewDustPerfect(Projectile.position + offset, DustID.RedTorch, new Vector2(Projectile.velocity.X * 0.2f + velOffset.X, Projectile.velocity.Y * 0.2f + velOffset.Y), 100, new Color(255, 245, 198), 2f); dust.noGravity = true; } } @@ -121,7 +121,7 @@ namespace CalamityMod.Projectiles.Melee SpriteEffects spriteEffects = SpriteEffects.None; if (Projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Rectangle sourceRectangle = new Rectangle(0, 0, texture.Width, texture.Height); Vector2 origin = sourceRectangle.Size() / 2f; diff --git a/Projectiles/Melee/FallenPaladinsHammerProj.cs b/Projectiles/Melee/FallenPaladinsHammerProj.cs index c349f3ce14..fc5331c3a0 100644 --- a/Projectiles/Melee/FallenPaladinsHammerProj.cs +++ b/Projectiles/Melee/FallenPaladinsHammerProj.cs @@ -1,13 +1,13 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using System.IO; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; -using System; -using System.IO; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -15,10 +15,10 @@ namespace CalamityMod.Projectiles.Melee { public new string LocalizationCategory => "Projectiles.Melee"; public override string Texture => "CalamityMod/Items/Weapons/Melee/FallenPaladinsHammer"; - public static readonly SoundStyle UseSound = new("CalamityMod/Sounds/Item/PwnagehammerSound") { Volume = 0.35f}; - public static readonly SoundStyle UseSoundFunny = new("CalamityMod/Sounds/Item/CalamityBell") { Volume = 1.5f}; + public static readonly SoundStyle UseSound = new("CalamityMod/Sounds/Item/PwnagehammerSound") { Volume = 0.35f }; + public static readonly SoundStyle UseSoundFunny = new("CalamityMod/Sounds/Item/CalamityBell") { Volume = 1.5f }; public static readonly SoundStyle RedHamSound = new("CalamityMod/Sounds/Item/FallenPaladinsHammerClone") { Volume = 0.6f }; - public ref int EmpoweredHammer => ref Main.player[Projectile.owner].Calamity().PHAThammer; + public ref int EmpoweredHammer => ref Main.player[Projectile.owner].Calamity().PHAThammer; public int returnhammer = 0; public override void SetStaticDefaults() @@ -52,106 +52,106 @@ namespace CalamityMod.Projectiles.Melee Projectile.velocity.X *= 0.9711f; Projectile.velocity.Y += 0.426f; } - + if (returnhammer == 1) - { - Projectile.velocity.Y *= 0.926f; - Projectile.velocity.X *= 0.811f; - if (Projectile.velocity.X > -1.05f && Projectile.velocity.X < 1.05f & Projectile.velocity.Y > -1.05f && Projectile.velocity.Y < 1.05f) - + { + Projectile.velocity.Y *= 0.926f; + Projectile.velocity.X *= 0.811f; + if (Projectile.velocity.X > -1.05f && Projectile.velocity.X < 1.05f & Projectile.velocity.Y > -1.05f && Projectile.velocity.Y < 1.05f) + returnhammer = 2; - } - + } + if (returnhammer == 2) + { + float returnSpeed = FallenPaladinsHammer.Speed; + float acceleration = 1.1f; + Player owner = Main.player[Projectile.owner]; + Vector2 playerCenter = owner.Center; + float xDist = playerCenter.X - Projectile.Center.X; + float yDist = playerCenter.Y - Projectile.Center.Y; + float dist = (float)Math.Sqrt(xDist * xDist + yDist * yDist); + dist = returnSpeed / dist; + xDist *= dist; + yDist *= dist; + + if (Projectile.velocity.X < xDist) + { + Projectile.velocity.X = Projectile.velocity.X + acceleration; + if (Projectile.velocity.X < 0f && xDist > 0f) + Projectile.velocity.X += acceleration; + } + else if (Projectile.velocity.X > xDist) + { + Projectile.velocity.X = Projectile.velocity.X - acceleration; + if (Projectile.velocity.X > 0f && xDist < 0f) + Projectile.velocity.X -= acceleration; + } + if (Projectile.velocity.Y < yDist) + { + Projectile.velocity.Y = Projectile.velocity.Y + acceleration; + if (Projectile.velocity.Y < 0f && yDist > 0f) + Projectile.velocity.Y += acceleration; + } + else if (Projectile.velocity.Y > yDist) + { + Projectile.velocity.Y = Projectile.velocity.Y - acceleration; + if (Projectile.velocity.Y > 0f && yDist < 0f) + Projectile.velocity.Y -= acceleration; + } + // Delete the projectile if it touches its owner, increase counter to the big hammer, and spawn a dustsplosion on the player that scales with how close they are to getting a big hammer. + if (Main.myPlayer == Projectile.owner) + { + if (Projectile.Hitbox.Intersects(player.Hitbox)) + { + EmpoweredHammer++; + if (EmpoweredHammer == 3) { - float returnSpeed = FallenPaladinsHammer.Speed; - float acceleration = 1.1f; - Player owner = Main.player[Projectile.owner]; - Vector2 playerCenter = owner.Center; - float xDist = playerCenter.X - Projectile.Center.X; - float yDist = playerCenter.Y - Projectile.Center.Y; - float dist = (float)Math.Sqrt(xDist * xDist + yDist * yDist); - dist = returnSpeed / dist; - xDist *= dist; - yDist *= dist; - - if (Projectile.velocity.X < xDist) + SoundEngine.PlaySound(RedHamSound, Projectile.Center); + for (int i = 0; i < 30; i++) { - Projectile.velocity.X = Projectile.velocity.X + acceleration; - if (Projectile.velocity.X < 0f && xDist > 0f) - Projectile.velocity.X += acceleration; + Dust fire = Dust.NewDustPerfect(Projectile.Center, 218); + fire.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedByRandom(0.8f) * new Vector2(4f, 1.25f) * Main.rand.NextFloat(0.9f, 1f); + fire.velocity = fire.velocity.RotatedBy(Projectile.rotation - MathHelper.PiOver2); + fire.velocity += Projectile.velocity * (EmpoweredHammer * 0.1f); + + fire.noGravity = true; + fire.scale = Main.rand.NextFloat(0.5f, 1.5f) * EmpoweredHammer; + + fire = Dust.CloneDust(fire); + fire.velocity = Main.rand.NextVector2Circular(3f, 3f); + fire.velocity += Projectile.velocity * (EmpoweredHammer * 0.1f); } - else if (Projectile.velocity.X > xDist) - { - Projectile.velocity.X = Projectile.velocity.X - acceleration; - if (Projectile.velocity.X > 0f && xDist < 0f) - Projectile.velocity.X -= acceleration; - } - if (Projectile.velocity.Y < yDist) - { - Projectile.velocity.Y = Projectile.velocity.Y + acceleration; - if (Projectile.velocity.Y < 0f && yDist > 0f) - Projectile.velocity.Y += acceleration; - } - else if (Projectile.velocity.Y > yDist) - { - Projectile.velocity.Y = Projectile.velocity.Y - acceleration; - if (Projectile.velocity.Y > 0f && yDist < 0f) - Projectile.velocity.Y -= acceleration; - } - // Delete the projectile if it touches its owner, increase counter to the big hammer, and spawn a dustsplosion on the player that scales with how close they are to getting a big hammer. - if (Main.myPlayer == Projectile.owner) - { - if (Projectile.Hitbox.Intersects(player.Hitbox)) - { - EmpoweredHammer++; - if (EmpoweredHammer == 3) - { - SoundEngine.PlaySound(RedHamSound, Projectile.Center); - for (int i = 0; i < 30; i++) - { - Dust fire = Dust.NewDustPerfect(Projectile.Center, 218); - fire.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedByRandom(0.8f) * new Vector2(4f, 1.25f) * Main.rand.NextFloat(0.9f, 1f); - fire.velocity = fire.velocity.RotatedBy(Projectile.rotation - MathHelper.PiOver2); - fire.velocity += Projectile.velocity * (EmpoweredHammer * 0.1f); - fire.noGravity = true; - fire.scale = Main.rand.NextFloat(0.5f, 1.5f) * EmpoweredHammer; - - fire = Dust.CloneDust(fire); - fire.velocity = Main.rand.NextVector2Circular(3f, 3f); - fire.velocity += Projectile.velocity * (EmpoweredHammer * 0.1f); - } - - int hammer = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity, ModContent.ProjectileType(), Projectile.damage * 2, Projectile.knockBack, Projectile.owner, 0f, Projectile.ai[1]); - Main.projectile[hammer].localAI[0] = Math.Sign(Projectile.velocity.X); - Main.projectile[hammer].netUpdate = true; - EmpoweredHammer = 0; - } - else - { - SoundEngine.PlaySound(SoundID.DD2_BetsysWrathShot with { Volume = 0.4f }, Projectile.Center); - for (int i = 0; i < 30; i++) - { - Dust fire = Dust.NewDustPerfect(Projectile.Center, 218); - fire.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedByRandom(0.8f) * new Vector2(4f, 1.25f) * Main.rand.NextFloat(0.9f, 1f); - fire.velocity = fire.velocity.RotatedBy(Projectile.rotation - MathHelper.PiOver2); - fire.velocity += Projectile.velocity * (EmpoweredHammer * 0.1f); - - fire.noGravity = true; - fire.scale = Main.rand.NextFloat(0.5f, 1.5f) * EmpoweredHammer; - - fire = Dust.CloneDust(fire); - fire.velocity = Main.rand.NextVector2Circular(3f, 3f); - fire.velocity += Projectile.velocity * (EmpoweredHammer * 0.1f); - } - } - - Projectile.Kill(); - } - } + int hammer = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity, ModContent.ProjectileType(), Projectile.damage * 2, Projectile.knockBack, Projectile.owner, 0f, Projectile.ai[1]); + Main.projectile[hammer].localAI[0] = Math.Sign(Projectile.velocity.X); + Main.projectile[hammer].netUpdate = true; + EmpoweredHammer = 0; } - + else + { + SoundEngine.PlaySound(SoundID.DD2_BetsysWrathShot with { Volume = 0.4f }, Projectile.Center); + for (int i = 0; i < 30; i++) + { + Dust fire = Dust.NewDustPerfect(Projectile.Center, 218); + fire.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedByRandom(0.8f) * new Vector2(4f, 1.25f) * Main.rand.NextFloat(0.9f, 1f); + fire.velocity = fire.velocity.RotatedBy(Projectile.rotation - MathHelper.PiOver2); + fire.velocity += Projectile.velocity * (EmpoweredHammer * 0.1f); + + fire.noGravity = true; + fire.scale = Main.rand.NextFloat(0.5f, 1.5f) * EmpoweredHammer; + + fire = Dust.CloneDust(fire); + fire.velocity = Main.rand.NextVector2Circular(3f, 3f); + fire.velocity += Projectile.velocity * (EmpoweredHammer * 0.1f); + } + } + + Projectile.Kill(); + } + } + } + //Spawn dust as the hammer travels. if (Main.rand.NextBool()) { @@ -173,40 +173,40 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { Player player = Main.player[Projectile.owner]; - if (returnhammer == 0) - { - if (Main.zenithWorld) - SoundEngine.PlaySound(UseSoundFunny with { Pitch = EmpoweredHammer * 0.2f - 0.4f }, Projectile.Center); + if (returnhammer == 0) + { + if (Main.zenithWorld) + SoundEngine.PlaySound(UseSoundFunny with { Pitch = EmpoweredHammer * 0.2f - 0.4f }, Projectile.Center); - else - SoundEngine.PlaySound(UseSound with { Pitch = EmpoweredHammer * 0.2f - 0.4f }, Projectile.Center); + else + SoundEngine.PlaySound(UseSound with { Pitch = EmpoweredHammer * 0.2f - 0.4f }, Projectile.Center); returnhammer = 1; - } - float numberOfDusts = 35f; - float rotFactor = 360f / numberOfDusts; - for (int i = 0; i < numberOfDusts; i++) - { - float rot = MathHelper.ToRadians(i * rotFactor); - Vector2 offset = new Vector2(3.6f, 0).RotatedBy(rot * Main.rand.NextFloat(1.1f, 4.1f)); - Vector2 velOffset = new Vector2(3f, 0).RotatedBy(rot * Main.rand.NextFloat(1.1f, 4.1f)); - Dust dust = Dust.NewDustPerfect(Projectile.Center + offset, 90, new Vector2(velOffset.X, velOffset.Y)); - dust.noGravity = true; - dust.velocity = velOffset; - dust.scale = Main.rand.NextFloat(1.5f, 3.2f); - } + } + float numberOfDusts = 35f; + float rotFactor = 360f / numberOfDusts; + for (int i = 0; i < numberOfDusts; i++) + { + float rot = MathHelper.ToRadians(i * rotFactor); + Vector2 offset = new Vector2(3.6f, 0).RotatedBy(rot * Main.rand.NextFloat(1.1f, 4.1f)); + Vector2 velOffset = new Vector2(3f, 0).RotatedBy(rot * Main.rand.NextFloat(1.1f, 4.1f)); + Dust dust = Dust.NewDustPerfect(Projectile.Center + offset, 90, new Vector2(velOffset.X, velOffset.Y)); + dust.noGravity = true; + dust.velocity = velOffset; + dust.scale = Main.rand.NextFloat(1.5f, 3.2f); + } - SoundEngine.PlaySound(SoundID.Item14 with { Volume = 0.22f }, Projectile.Center); - Projectile.ai[1] = target.whoAmI; + SoundEngine.PlaySound(SoundID.Item14 with { Volume = 0.22f }, Projectile.Center); + Projectile.ai[1] = target.whoAmI; } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { if (Projectile.numHits > 0) Projectile.damage = (int)(Projectile.damage * 0.9f); if (Projectile.damage < 1) - Projectile.damage = 1; + Projectile.damage = 1; } - + public override bool PreDraw(ref Color lightColor) { CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); diff --git a/Projectiles/Melee/Feather.cs b/Projectiles/Melee/Feather.cs index 46df7b87bf..fade5444c1 100644 --- a/Projectiles/Melee/Feather.cs +++ b/Projectiles/Melee/Feather.cs @@ -1,15 +1,19 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Melee { public class Feather : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; + public override string Texture => "CalamityMod/Projectiles/Magic/TradewindsProjectile"; + private const int TimeLeft = 150; + public override void SetDefaults() { Projectile.width = 14; @@ -17,22 +21,30 @@ namespace CalamityMod.Projectiles.Melee Projectile.friendly = true; Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.penetrate = 1; - Projectile.timeLeft = 150; + Projectile.timeLeft = TimeLeft; Projectile.aiStyle = ProjAIStyleID.Arrow; } public override void AI() { - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + } + + public override bool PreDraw(ref Color lightColor) + { + if (Projectile.timeLeft > TimeLeft - 5) + return false; + + return true; } public override void OnKill(int timeLeft) { - int inc; - for (int i = 0; i < 10; i = inc + 1) + for (int i = 0; i < 10; i++) { - Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 64, Projectile.velocity.X * 0.1f, Projectile.velocity.Y * 0.1f, 0, default, 1f); - inc = i; + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.YellowTorch, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.4f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0.5f; } } } diff --git a/Projectiles/Melee/Flarefrost.cs b/Projectiles/Melee/Flarefrost.cs index eece894ca7..29509bde38 100644 --- a/Projectiles/Melee/Flarefrost.cs +++ b/Projectiles/Melee/Flarefrost.cs @@ -1,8 +1,8 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.Melee Main.dust[flarefrost].noGravity = true; Main.dust[flarefrost].position = Projectile.Center + dustRotate; Main.dust[flarefrost].velocity = Projectile.velocity; - int frostflare = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 0.8f); + int frostflare = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 0.8f); Main.dust[frostflare].noGravity = true; Main.dust[frostflare].velocity *= 0f; } @@ -57,8 +57,8 @@ namespace CalamityMod.Projectiles.Melee SoundEngine.PlaySound(SoundID.Item27, Projectile.Center); for (int k = 0; k < 2; k++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 67, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 174, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.IceRod, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.InfernoFork, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } diff --git a/Projectiles/Melee/FloodtideShark.cs b/Projectiles/Melee/FloodtideShark.cs new file mode 100644 index 0000000000..45761fdc3f --- /dev/null +++ b/Projectiles/Melee/FloodtideShark.cs @@ -0,0 +1,33 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Melee +{ + public class FloodtideShark : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + + public override void SetDefaults() + { + Projectile.width = 66; + Projectile.height = 28; + Projectile.aiStyle = ProjAIStyleID.Arrow; + AIType = ProjectileID.MiniSharkron; + Projectile.friendly = true; + Projectile.alpha = 255; + Projectile.ignoreWater = true; + Projectile.DamageType = DamageClass.Melee; + } + + public override void OnKill(int timeLeft) + { + for (int d = 0; d < 15; ++d) + { + int idx = Dust.NewDust(Projectile.Center - Vector2.One * 10f, 50, 50, DustID.Blood, 0f, -2f, 0, default, 1f); + Dust dust = Main.dust[idx]; + dust.velocity /= 2f; + } + } + } +} diff --git a/Projectiles/Melee/FloodtideShark.png b/Projectiles/Melee/FloodtideShark.png new file mode 100644 index 0000000000..d708dc16ce Binary files /dev/null and b/Projectiles/Melee/FloodtideShark.png differ diff --git a/Projectiles/Melee/ForbiddenOathbladeProjectile.cs b/Projectiles/Melee/ForbiddenOathbladeProjectile.cs index 00d9a54e87..638be16b0c 100644 --- a/Projectiles/Melee/ForbiddenOathbladeProjectile.cs +++ b/Projectiles/Melee/ForbiddenOathbladeProjectile.cs @@ -1,3 +1,4 @@ +using CalamityMod.Items.Weapons.Melee; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -8,6 +9,15 @@ namespace CalamityMod.Projectiles.Melee public class ForbiddenOathbladeProjectile : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; + + private const float MaxVelocity = ExaltedOathblade.ShootSpeed * 4f; + + private const int FadeOutTime = 85; + + private const int TimeLeft = 435 + FadeOutTime; + + private const int Alpha = 100; + public override void SetStaticDefaults() { ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; @@ -18,23 +28,51 @@ namespace CalamityMod.Projectiles.Melee { Projectile.width = 46; Projectile.height = 46; - Projectile.aiStyle = ProjAIStyleID.Sickle; - Projectile.alpha = 100; + Projectile.alpha = Alpha; + Projectile.timeLeft = TimeLeft; + Projectile.ignoreWater = true; Projectile.friendly = true; Projectile.DamageType = DamageClass.Melee; - Projectile.tileCollide = true; Projectile.penetrate = 3; + Projectile.MaxUpdates = 2; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 20; - AIType = ProjectileID.DemonScythe; + Projectile.localNPCHitCooldown = 20 * Projectile.MaxUpdates; } public override void AI() { - Lighting.AddLight(Projectile.Center, 0.35f, 0f, 0.35f); + float alphaLightScale = Projectile.alpha / (float)Alpha; + Lighting.AddLight(Projectile.Center, 0.5f * alphaLightScale, 0f, 0.5f * alphaLightScale); - if (Main.rand.NextBool(3)) - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 173, Projectile.velocity.X * 0.25f, Projectile.velocity.Y * 0.25f); + if (Projectile.timeLeft > FadeOutTime) + { + if (Projectile.velocity.Length() < MaxVelocity) + Projectile.velocity *= 1.03f; + } + else + Projectile.velocity *= 0.95f; + + if (Projectile.velocity.X < 0f) + Projectile.spriteDirection = -1; + + Projectile.rotation += Projectile.direction * 0.025f; + if (Projectile.timeLeft > FadeOutTime) + Projectile.rotation += Projectile.direction * 0.25f; + else + Projectile.rotation += Projectile.direction * 0.25f * (Projectile.timeLeft / (float)FadeOutTime); + } + + public override Color? GetAlpha(Color lightColor) + { + if (Projectile.timeLeft < FadeOutTime) + { + byte b2 = (byte)(Projectile.timeLeft * 3); + byte a2 = (byte)(Alpha * ((float)b2 / byte.MaxValue)); + Projectile.alpha = a2; + return new Color(b2, b2, b2, Projectile.alpha); + } + Projectile.alpha = Alpha; + return new Color(byte.MaxValue, byte.MaxValue, byte.MaxValue, Projectile.alpha); } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) diff --git a/Projectiles/Melee/GaelExplosion.cs b/Projectiles/Melee/GaelExplosion.cs index 0ce3b94ef1..141812c720 100644 --- a/Projectiles/Melee/GaelExplosion.cs +++ b/Projectiles/Melee/GaelExplosion.cs @@ -1,10 +1,10 @@ +using System; using CalamityMod.Items.Weapons.Melee; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -79,7 +79,7 @@ namespace CalamityMod.Projectiles.Melee randoAdjuster = rando3 / randoAdjuster; rando1 *= randoAdjuster; rando2 *= randoAdjuster; - int gaelDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 218, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + int gaelDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Rain_BloodMoon, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); Main.dust[gaelDust].noGravity = true; Main.dust[gaelDust].position.X = Projectile.Center.X; Main.dust[gaelDust].position.Y = Projectile.Center.Y; diff --git a/Projectiles/Melee/GaelSkull.cs b/Projectiles/Melee/GaelSkull.cs index 3da0548c21..cc8938bb6d 100644 --- a/Projectiles/Melee/GaelSkull.cs +++ b/Projectiles/Melee/GaelSkull.cs @@ -1,10 +1,10 @@ -using CalamityMod.Items.Weapons.Melee; +using System; +using CalamityMod.Items.Weapons.Melee; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -81,7 +81,7 @@ namespace CalamityMod.Projectiles.Melee Vector2 spawnPositionAdditive = Vector2.UnitX * (float)-(float)Projectile.width / 2f; spawnPositionAdditive += -Vector2.UnitY.RotatedBy((double)((float)l * MathHelper.TwoPi / 14f), default) * new Vector2(8f, 16f) * Projectile.scale; spawnPositionAdditive = spawnPositionAdditive.RotatedBy((double)(Projectile.rotation), default); - int dustIndex = Dust.NewDust(Projectile.Center, 0, 0, 218, 0f, 0f, 0, new Color(188, 126, 154), 1.5f); + int dustIndex = Dust.NewDust(Projectile.Center, 0, 0, DustID.Rain_BloodMoon, 0f, 0f, 0, new Color(188, 126, 154), 1.5f); Main.dust[dustIndex].noGravity = true; Main.dust[dustIndex].position = Projectile.Center + spawnPositionAdditive; Main.dust[dustIndex].velocity = Projectile.velocity * 0.1f; @@ -105,8 +105,8 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.ai[1] == 1f) { Projectile.penetrate = -1; + Projectile.velocity *= 1.05f; Projectile.alpha += 1; - Projectile.damage = (int)Math.Ceiling(Projectile.damage * 0.992); //Exponentially decays to a factor of 0.12896 of the original damage if (Projectile.alpha >= 255) { Projectile.Kill(); @@ -141,18 +141,18 @@ namespace CalamityMod.Projectiles.Melee SoundEngine.PlaySound(SoundID.NPCDeath52, Projectile.Center); for (int i = 0; i < 3; i++) { - Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 218, 0f, 0f, 100, default, 1.5f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Rain_BloodMoon, 0f, 0f, 100, default, 1.5f); } for (int i = 0; i < 30; i++) { float angle = MathHelper.TwoPi * i / 30f; - int dustIndex = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 218, 0f, 0f, 0, default, 2.5f); + int dustIndex = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Rain_BloodMoon, 0f, 0f, 0, default, 2.5f); Main.dust[dustIndex].noGravity = true; Main.dust[dustIndex].velocity *= 3f; - dustIndex = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 218, 0f, 0f, 100, default, 1.5f); + dustIndex = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Rain_BloodMoon, 0f, 0f, 100, default, 1.5f); Main.dust[dustIndex].velocity *= 2f; Main.dust[dustIndex].noGravity = true; - Dust.NewDust(Projectile.Center + angle.ToRotationVector2() * 160f, 0, 0, 218, 0f, 0f, 100, default, 1.5f); + Dust.NewDust(Projectile.Center + angle.ToRotationVector2() * 160f, 0, 0, DustID.Rain_BloodMoon, 0f, 0f, 100, default, 1.5f); } } } diff --git a/Projectiles/Melee/GaelSkull2.cs b/Projectiles/Melee/GaelSkull2.cs index 640ea3929a..5e09a998e6 100644 --- a/Projectiles/Melee/GaelSkull2.cs +++ b/Projectiles/Melee/GaelSkull2.cs @@ -1,9 +1,9 @@ using CalamityMod.Items.Weapons.Melee; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { public class GaelSkull2 : ModProjectile, ILocalizedModType @@ -60,10 +60,10 @@ namespace CalamityMod.Projectiles.Melee Projectile.tileCollide = target != null; //Go through walls if we're hunting an NPC if (target != null) { - float homingSpeed = Projectile.velocity.Length() * (Projectile.Distance(target.Center) < 220f ? 1.3f : 1f); + float homingSpeed = Projectile.velocity.Length() * (Projectile.Distance(target.Center) < 420f ? 1.3f : 1.1f); Vector2 idealVelocity = Projectile.SafeDirectionTo(target.Center) * homingSpeed; - float inertia = Projectile.Distance(target.Center) < 240f ? 4f : 13f; + float inertia = Projectile.Distance(target.Center) < 420f ? 4f : 8f; Projectile.velocity = (Projectile.velocity * inertia + idealVelocity) / (inertia + 1f); Projectile.velocity.Normalize(); Projectile.velocity *= homingSpeed; @@ -78,7 +78,7 @@ namespace CalamityMod.Projectiles.Melee Vector2 spawnPositionAdditive = Vector2.UnitX * (float)-(float)Projectile.width / 2f; spawnPositionAdditive += -Vector2.UnitY.RotatedBy((double)((float)l * MathHelper.TwoPi / 14f), default) * new Vector2(8f, 16f) * Projectile.scale; spawnPositionAdditive = spawnPositionAdditive.RotatedBy((double)(Projectile.rotation), default); - int dustIndex = Dust.NewDust(Projectile.Center, 0, 0, 218, 0f, 0f, 0, new Color(188, 126, 154), 1.5f); + int dustIndex = Dust.NewDust(Projectile.Center, 0, 0, DustID.Rain_BloodMoon, 0f, 0f, 0, new Color(188, 126, 154), 1.5f); Main.dust[dustIndex].noGravity = true; Main.dust[dustIndex].position = Projectile.Center + spawnPositionAdditive; Main.dust[dustIndex].velocity = Projectile.velocity * 0.1f; @@ -124,18 +124,18 @@ namespace CalamityMod.Projectiles.Melee SoundEngine.PlaySound(SoundID.NPCDeath52, Projectile.Center); for (int i = 0; i < 3; i++) { - Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 218, 0f, 0f, 100, default, 1.5f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Rain_BloodMoon, 0f, 0f, 100, default, 1.5f); } for (int i = 0; i < 30; i++) { float angle = MathHelper.TwoPi * i / 30f; - int dustIndex = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 218, 0f, 0f, 0, default, 2.5f); + int dustIndex = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Rain_BloodMoon, 0f, 0f, 0, default, 2.5f); Main.dust[dustIndex].noGravity = true; Main.dust[dustIndex].velocity *= 3f; - dustIndex = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 218, 0f, 0f, 100, default, 1.5f); + dustIndex = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Rain_BloodMoon, 0f, 0f, 100, default, 1.5f); Main.dust[dustIndex].velocity *= 2f; Main.dust[dustIndex].noGravity = true; - Dust.NewDust(Projectile.Center + angle.ToRotationVector2() * 160f, 0, 0, 218, 0f, 0f, 100, default, 1.5f); + Dust.NewDust(Projectile.Center + angle.ToRotationVector2() * 160f, 0, 0, DustID.Rain_BloodMoon, 0f, 0f, 100, default, 1.5f); } } } diff --git a/Projectiles/Melee/GalacticaComet.cs b/Projectiles/Melee/GalacticaComet.cs index 159797a916..fedde06c1d 100644 --- a/Projectiles/Melee/GalacticaComet.cs +++ b/Projectiles/Melee/GalacticaComet.cs @@ -1,9 +1,9 @@ using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -74,7 +74,7 @@ namespace CalamityMod.Projectiles.Melee if (Main.rand.NextBool(16)) { Vector2 rotation = Vector2.UnitX.RotatedByRandom(MathHelper.PiOver2).RotatedBy((double)Projectile.velocity.ToRotation(), default); - int pinkDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 164, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1f); + int pinkDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.TeleportationPotion, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1f); Main.dust[pinkDust].velocity = rotation * 0.66f; Main.dust[pinkDust].position = Projectile.Center + rotation * 12f; } @@ -90,7 +90,7 @@ namespace CalamityMod.Projectiles.Melee { Projectile.light = 0.5f; if (Main.rand.NextBool(10)) - Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 229, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Vortex, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1f); if (Main.rand.NextBool(20) && Main.netMode != NetmodeID.Server) Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.position, new Vector2(Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f), Main.rand.Next(16, 18), 1f); } @@ -122,14 +122,14 @@ namespace CalamityMod.Projectiles.Melee Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int i = 0; i < 4; i++) { - Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 164, 0f, 0f, 50, default, 1.5f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.TeleportationPotion, 0f, 0f, 50, default, 1.5f); } for (int j = 0; j < 20; j++) { - int galaxyDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 229, 0f, 0f, 0, default, 2.5f); + int galaxyDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Vortex, 0f, 0f, 0, default, 2.5f); Main.dust[galaxyDust].noGravity = true; Main.dust[galaxyDust].velocity *= 3f; - galaxyDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 229, 0f, 0f, 50, default, 1.5f); + galaxyDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Vortex, 0f, 0f, 50, default, 1.5f); Main.dust[galaxyDust].velocity *= 2f; Main.dust[galaxyDust].noGravity = true; } diff --git a/Projectiles/Melee/GalaxiaBolt.cs b/Projectiles/Melee/GalaxiaBolt.cs index b8eee3f98f..1e9c160c2b 100644 --- a/Projectiles/Melee/GalaxiaBolt.cs +++ b/Projectiles/Melee/GalaxiaBolt.cs @@ -1,6 +1,6 @@ -using CalamityMod.Particles; +using System; +using CalamityMod.Particles; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -65,12 +65,12 @@ namespace CalamityMod.Projectiles.Melee Lighting.AddLight(Projectile.Center, 0.75f, 1f, 0.24f); - if (Main.rand.Next(2) == 0) + if (Main.rand.NextBool(2)) { Particle smoke = new HeavySmokeParticle(Projectile.Center, Projectile.velocity * 0.5f, Color.Lerp(Color.MidnightBlue, Color.Indigo, (float)Math.Sin(Main.GlobalTimeWrappedHourly * 6f)), 30, Main.rand.NextFloat(0.6f, 1.2f) * Projectile.scale, 0.8f, 0, false, 0, true); GeneralParticleHandler.SpawnParticle(smoke); - if (Main.rand.Next(3) == 0) + if (Main.rand.NextBool(3)) { Particle smokeGlow = new HeavySmokeParticle(Projectile.Center, Projectile.velocity * 0.5f, Main.hslToRgb(Hue, 1, 0.7f), 20, Main.rand.NextFloat(0.4f, 0.7f) * Projectile.scale, 0.8f, 0, true, 0.005f, true); GeneralParticleHandler.SpawnParticle(smokeGlow); diff --git a/Projectiles/Melee/GalaxiaHoldout.cs b/Projectiles/Melee/GalaxiaHoldout.cs index 75be43e407..14426ffbcf 100644 --- a/Projectiles/Melee/GalaxiaHoldout.cs +++ b/Projectiles/Melee/GalaxiaHoldout.cs @@ -1,13 +1,13 @@ -using CalamityMod.DataStructures; +using System.Collections.Generic; +using CalamityMod.DataStructures; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Particles; +using CalamityMod.Sounds; using Microsoft.Xna.Framework; -using System.Collections.Generic; using Terraria; +using Terraria.Audio; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; -using Terraria.Audio; -using CalamityMod.Sounds; namespace CalamityMod.Projectiles.Melee { diff --git a/Projectiles/Melee/GalaxiaTropicRing.cs b/Projectiles/Melee/GalaxiaTropicRing.cs index 597b76f9cb..c0fb8cc795 100644 --- a/Projectiles/Melee/GalaxiaTropicRing.cs +++ b/Projectiles/Melee/GalaxiaTropicRing.cs @@ -1,8 +1,8 @@ -using CalamityMod.Buffs.StatDebuffs; +using System; +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Weapons.Melee; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; diff --git a/Projectiles/Melee/Galaxia_AndromedasStride.cs b/Projectiles/Melee/Galaxia_AndromedasStride.cs index c356147811..63dde30024 100644 --- a/Projectiles/Melee/Galaxia_AndromedasStride.cs +++ b/Projectiles/Melee/Galaxia_AndromedasStride.cs @@ -1,17 +1,17 @@ -using CalamityMod.Particles; +using System; +using System.IO; using CalamityMod.Items.Weapons.Melee; -using Terraria.Graphics.Shaders; +using CalamityMod.Particles; +using CalamityMod.Tiles.Astral; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; using Terraria; +using Terraria.Audio; +using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; -using static Terraria.ModLoader.ModContent; using static CalamityMod.CalamityUtils; -using Terraria.Audio; -using CalamityMod.Tiles.Astral; +using static Terraria.ModLoader.ModContent; namespace CalamityMod.Projectiles.Melee { @@ -27,15 +27,11 @@ namespace CalamityMod.Projectiles.Melee public ref float CurrentIndicator => ref Projectile.localAI[0]; //What "indicator" stage are you on. public ref float OverCharge => ref Projectile.localAI[1]; - private bool OwnerCanShoot => Owner.channel && !Owner.noItems && !Owner.CCed; const float MaxCharge = 360; public Vector2 lastDisplacement; public float dashDuration; - public override void SetStaticDefaults() - { - } public override void SetDefaults() { Projectile.DamageType = DamageClass.Melee; @@ -79,7 +75,7 @@ namespace CalamityMod.Projectiles.Melee initialized = true; } - if (!OwnerCanShoot) + if (Owner.CantUseHoldout()) { if (State == 0f) { @@ -138,7 +134,7 @@ namespace CalamityMod.Projectiles.Melee Particle smoke = new HeavySmokeParticle(Projectile.Center + direction * 50f, smokeSpeed + Owner.velocity, Color.Lerp(Color.Purple, Color.Indigo, (float)Math.Sin(Main.GlobalTimeWrappedHourly * 6f)), 30, Main.rand.NextFloat(0.6f, 1.2f), 0.8f, 0, false, 0, true); GeneralParticleHandler.SpawnParticle(smoke); - if (Main.rand.Next(3) == 0) + if (Main.rand.NextBool(3)) { Particle smokeGlow = new HeavySmokeParticle(Projectile.Center + direction * 50f, smokeSpeed + Owner.velocity, Main.hslToRgb(0.85f, 1, 0.8f), 20, Main.rand.NextFloat(0.4f, 0.7f), 0.8f, 0, true, 0.01f, true); GeneralParticleHandler.SpawnParticle(smokeGlow); @@ -202,7 +198,7 @@ namespace CalamityMod.Projectiles.Melee if (Owner.direction != 1) { - Owner.itemRotation -= 3.14f; + Owner.itemRotation -= MathHelper.Pi; } Owner.itemRotation = MathHelper.WrapAngle(Owner.itemRotation); @@ -265,7 +261,9 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - Owner.GiveIFrames(FourSeasonsGalaxia.AndromedaAttunement_DashHitIFrames); + // 17APR2024: Ozzatron: Galaxia's dash gives iframes when striking enemies in a similar manner to a ram dash. + // This is a fixed and intentionally very low number of iframes, and is not boosted by Cross Necklace. + Owner.GiveUniversalIFrames(FourSeasonsGalaxia.AndromedaAttunement_DashHitIFrames); } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) diff --git a/Projectiles/Melee/Galaxia_AndromedasStrideBoltSpawner.cs b/Projectiles/Melee/Galaxia_AndromedasStrideBoltSpawner.cs index a3ecbd7841..1e34f170f6 100644 --- a/Projectiles/Melee/Galaxia_AndromedasStrideBoltSpawner.cs +++ b/Projectiles/Melee/Galaxia_AndromedasStrideBoltSpawner.cs @@ -1,12 +1,12 @@ -using CalamityMod.Particles; -using Microsoft.Xna.Framework; -using System; +using System; using System.IO; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.timeLeft < 29) { - if (Main.rand.Next(3) == 0) + if (Main.rand.NextBool(3)) { Vector2 particleDirection = (Projectile.rotation - MathHelper.PiOver4).ToRotationVector2(); Vector2 flyDirection = particleDirection.RotatedBy(Main.rand.NextFloat(-MathHelper.PiOver4 / 2f, MathHelper.PiOver4 / 2f)) * Main.rand.NextFloat(15f, 35f); @@ -68,7 +68,7 @@ namespace CalamityMod.Projectiles.Melee Particle smoke = new HeavySmokeParticle(Projectile.Center, flyDirection, Color.Lerp(Color.MidnightBlue, Color.Indigo, (float)Math.Sin(Main.GlobalTimeWrappedHourly * 6f)), 30, Main.rand.NextFloat(0.4f, 1.3f) * Projectile.scale, 0.8f, 0, false, 0, true); GeneralParticleHandler.SpawnParticle(smoke); - if (Main.rand.Next(3) == 0) + if (Main.rand.NextBool(3)) { Particle smokeGlow = new HeavySmokeParticle(Projectile.Center, flyDirection, Color.Red, 20, Main.rand.NextFloat(0.1f, 0.7f) * Projectile.scale, 0.8f, 0, true, 0.01f, true); GeneralParticleHandler.SpawnParticle(smokeGlow); @@ -98,7 +98,7 @@ namespace CalamityMod.Projectiles.Melee Particle smoke = new HeavySmokeParticle(Projectile.Center + hitPositionDisplace, flyDirection, Color.Lerp(Color.MidnightBlue, Color.Indigo, (float)Math.Sin(Main.GlobalTimeWrappedHourly * 6f)), 30, Main.rand.NextFloat(1.6f, 2.2f) * Projectile.scale, 0.8f, 0, false, 0, true); GeneralParticleHandler.SpawnParticle(smoke); - if (Main.rand.Next(3) == 0) + if (Main.rand.NextBool(3)) { Particle smokeGlow = new HeavySmokeParticle(Projectile.Center + hitPositionDisplace, flyDirection, Color.Red, 20, Main.rand.NextFloat(1.4f, 1.7f) * Projectile.scale, 0.8f, 0, true, 0.005f, true); GeneralParticleHandler.SpawnParticle(smokeGlow); diff --git a/Projectiles/Melee/Galaxia_AriesWrath.cs b/Projectiles/Melee/Galaxia_AriesWrath.cs index d0e7cd2ecc..c948b565c9 100644 --- a/Projectiles/Melee/Galaxia_AriesWrath.cs +++ b/Projectiles/Melee/Galaxia_AriesWrath.cs @@ -1,15 +1,15 @@ -using CalamityMod.Particles; +using System; +using System.Linq; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.Linq; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using static Terraria.ModLoader.ModContent; using static CalamityMod.CalamityUtils; -using Terraria.Audio; +using static Terraria.ModLoader.ModContent; namespace CalamityMod.Projectiles.Melee { @@ -21,7 +21,6 @@ namespace CalamityMod.Projectiles.Melee public Player Owner => Main.player[Projectile.owner]; public ref float ChainSwapTimer => ref Projectile.ai[0]; public ref float BlastCooldown => ref Projectile.ai[1]; - private bool OwnerCanShoot => Owner.channel && !Owner.noItems && !Owner.CCed && Owner.HeldItem.type == ItemType(); const float MaxProjReach = 500f; //How far away do you check for enemies for the extra projs from crits be @@ -120,7 +119,7 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - if (!OwnerCanShoot) + if (Owner.CantUseHoldout() || Owner.HeldItem.type != ItemType()) { //Kill the projectile if too far away from the player or close enough to get "re-absorbed) if ((Owner.Center - Projectile.Center).Length() < 30f || (Owner.Center - Projectile.Center).Length() > 2000f || Projectile.velocity.Length() > 100f) @@ -170,7 +169,7 @@ namespace CalamityMod.Projectiles.Melee Owner.itemRotation = Projectile.velocity.ToRotation(); if (Owner.direction != 1) { - Owner.itemRotation -= 3.14f; + Owner.itemRotation -= MathHelper.Pi; } Owner.itemRotation = MathHelper.WrapAngle(Owner.itemRotation); Owner.itemTime = 2; @@ -195,7 +194,7 @@ namespace CalamityMod.Projectiles.Melee float maxDistance = Projectile.scale * 82f; Vector2 distance = Main.rand.NextVector2Circular(maxDistance, maxDistance); Vector2 angularVelocity = Utils.SafeNormalize(distance.RotatedBy(MathHelper.PiOver2), Vector2.Zero) * 2f * (1f + distance.Length() / 15f); - Particle glitter = new CritSpark(Projectile.Center + distance, angularVelocity, Main.rand.Next(3) == 0 ? Color.HotPink : Color.Plum, Color.DarkOrchid, 1f + 1 * (distance.Length() / maxDistance), 10, 0.05f, 3f); + Particle glitter = new CritSpark(Projectile.Center + distance, angularVelocity, Main.rand.NextBool(3)? Color.HotPink : Color.Plum, Color.DarkOrchid, 1f + 1 * (distance.Length() / maxDistance), 10, 0.05f, 3f); GeneralParticleHandler.SpawnParticle(glitter); } @@ -205,7 +204,7 @@ namespace CalamityMod.Projectiles.Melee Particle smoke = new HeavySmokeParticle(Projectile.Center + smokePos, smokeSpeed, Color.Lerp(Color.Navy, Color.Indigo, (float)Math.Sin(Main.GlobalTimeWrappedHourly * 6f)), 30, Main.rand.NextFloat(0.4f, 1f) * Projectile.scale, 0.8f, 0, false, 0, true); GeneralParticleHandler.SpawnParticle(smoke); - if (Main.rand.Next(3) == 0) + if (Main.rand.NextBool(3)) { Particle smokeGlow = new HeavySmokeParticle(Projectile.Center + smokePos, smokeSpeed, Main.hslToRgb(0.85f, 1, 0.5f), 20, Main.rand.NextFloat(0.4f, 1f) * Projectile.scale, 0.8f, 0, true, 0.01f, true); GeneralParticleHandler.SpawnParticle(smokeGlow); diff --git a/Projectiles/Melee/Galaxia_AriesWrathConstellation.cs b/Projectiles/Melee/Galaxia_AriesWrathConstellation.cs index 530d4b9573..12ed46f183 100644 --- a/Projectiles/Melee/Galaxia_AriesWrathConstellation.cs +++ b/Projectiles/Melee/Galaxia_AriesWrathConstellation.cs @@ -1,11 +1,11 @@ -using CalamityMod.Particles; +using System.Collections.Generic; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using System.Collections.Generic; namespace CalamityMod.Projectiles.Melee { @@ -96,7 +96,7 @@ namespace CalamityMod.Projectiles.Melee Line = new BloomLineVFX(previousStar, Projectile.Center + SizeVector * i + offset - previousStar, 0.8f, Color.MediumVioletRed * 0.75f, 20, true, true); BootlegSpawnParticle(Line); - if (Main.rand.Next(3) == 0) + if (Main.rand.NextBool(3)) { offset = Main.rand.NextFloat(-50f, 50f) * Utils.SafeNormalize(SizeVector.RotatedBy(MathHelper.PiOver2), Vector2.Zero); Star = new GenericSparkle(Projectile.Center + SizeVector * i + offset, Vector2.Zero, Color.White, Color.Plum, Main.rand.NextFloat(1f, 1.5f), 20, 0f, 3f); diff --git a/Projectiles/Melee/Galaxia_PhoenixsPride.cs b/Projectiles/Melee/Galaxia_PhoenixsPride.cs index 5b216395f9..dea78a8c39 100644 --- a/Projectiles/Melee/Galaxia_PhoenixsPride.cs +++ b/Projectiles/Melee/Galaxia_PhoenixsPride.cs @@ -1,16 +1,16 @@ -using CalamityMod.Particles; +using System; +using System.IO; using CalamityMod.Items.Weapons.Melee; -using Terraria.Graphics.Shaders; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; using Terraria; +using Terraria.Audio; +using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; -using static Terraria.ModLoader.ModContent; using static CalamityMod.CalamityUtils; -using Terraria.Audio; +using static Terraria.ModLoader.ModContent; namespace CalamityMod.Projectiles.Melee { @@ -22,7 +22,6 @@ namespace CalamityMod.Projectiles.Melee Vector2 direction = Vector2.Zero; public ref float CurrentState => ref Projectile.ai[0]; public Player Owner => Main.player[Projectile.owner]; - private bool OwnerCanShoot => Owner.channel && !Owner.noItems && !Owner.CCed; public const float throwOutTime = 90f; public const float throwOutDistance = 440f; @@ -87,7 +86,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.rotation = direction.ToRotation(); //Only done for afterimages - if (!OwnerCanShoot) + if (Owner.CantUseHoldout()) { if (CurrentState == 2f || (CurrentState == 0f && Empowerment / maxEmpowerment < 0.5)) { @@ -152,7 +151,7 @@ namespace CalamityMod.Projectiles.Melee { Empowerment++; //Charge faster when near the end - if (Main.rand.Next(2) == 0) + if (Main.rand.NextBool(2)) { @@ -167,7 +166,7 @@ namespace CalamityMod.Projectiles.Melee Particle smoke = new HeavySmokeParticle(smokepos, direction.RotatedBy(-MathHelper.PiOver2) * 20f * scaleFactor + Owner.velocity, Color.Lerp(Color.MidnightBlue, Color.Indigo, i), 10 + Main.rand.Next(5), scaleFactor * Main.rand.NextFloat(2.8f, 3.1f), Opacity + Main.rand.NextFloat(0f, 0.2f), 0f, false, 0, true); GeneralParticleHandler.SpawnParticle(smoke); - if (Main.rand.Next(3) == 0) + if (Main.rand.NextBool(3)) { Particle smokeGlow = new HeavySmokeParticle(smokepos, direction.RotatedBy(-MathHelper.PiOver2) * 20f * scaleFactor + Owner.velocity, Color.OrangeRed, 7, scaleFactor * Main.rand.NextFloat(2f, 2.4f), Opacity * 2, 0f, true, 0.001f, true); GeneralParticleHandler.SpawnParticle(smokeGlow); @@ -221,7 +220,7 @@ namespace CalamityMod.Projectiles.Melee float maxDistance = Projectile.scale * 1.9f * 78f; Vector2 distance = Main.rand.NextVector2Circular(maxDistance, maxDistance); Vector2 angularVelocity = Utils.SafeNormalize(distance.RotatedBy(MathHelper.PiOver2), Vector2.Zero) * 2f * (1f + distance.Length() / 15f); - Particle glitter = new CritSpark(Owner.Center + distance, Owner.velocity + angularVelocity, Main.rand.Next(3) == 0 ? Color.Turquoise : Color.Coral, currentColor, 1f + 1 * (distance.Length() / maxDistance), 10, 0.05f, 3f); + Particle glitter = new CritSpark(Owner.Center + distance, Owner.velocity + angularVelocity, Main.rand.NextBool(3)? Color.Turquoise : Color.Coral, currentColor, 1f + 1 * (distance.Length() / maxDistance), 10, 0.05f, 3f); GeneralParticleHandler.SpawnParticle(glitter); } } @@ -255,7 +254,7 @@ namespace CalamityMod.Projectiles.Melee Owner.itemRotation = direction.ToRotation(); if (Owner.direction != 1) { - Owner.itemRotation -= 3.14f; + Owner.itemRotation -= MathHelper.Pi; } Owner.itemRotation = MathHelper.WrapAngle(Owner.itemRotation); Owner.itemTime = 2; diff --git a/Projectiles/Melee/Galaxia_PolarisGaze.cs b/Projectiles/Melee/Galaxia_PolarisGaze.cs index 4516bc10f3..fc1201ae05 100644 --- a/Projectiles/Melee/Galaxia_PolarisGaze.cs +++ b/Projectiles/Melee/Galaxia_PolarisGaze.cs @@ -1,15 +1,15 @@ -using CalamityMod.Particles; +using System; +using System.IO; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Particles; +using CalamityMod.Sounds; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; -using Terraria.Audio; -using CalamityMod.Sounds; namespace CalamityMod.Projectiles.Melee { @@ -25,7 +25,6 @@ namespace CalamityMod.Projectiles.Melee public float Bounce(float x) => x <= 50 ? x / 50f : x <= 65 ? 1 + 0.15f * (float)Math.Sin((x - 50f) / 15f * MathHelper.Pi) : 1f; public float ShredRatio => MathHelper.Clamp(Shred / (maxShred * 0.5f), 0f, 1f); public Player Owner => Main.player[Projectile.owner]; - private bool OwnerCanShoot => Owner.channel && !Owner.noItems && !Owner.CCed; public const float maxShred = 650; //How much shred you get @@ -36,10 +35,6 @@ namespace CalamityMod.Projectiles.Melee public Particle[] Rings = new Particle[3]; public Particle PolarStar; - - public override void SetStaticDefaults() - { - } public override void SetDefaults() { Projectile.DamageType = DamageClass.Melee; @@ -87,13 +82,17 @@ namespace CalamityMod.Projectiles.Melee Dashing = true; DashStart = Owner.Center; Wheel.timeLeft = 60; - Owner.GiveIFrames(FourSeasonsGalaxia.PolarisAttunement_SlashIFrames); + + // 17APR2024: Ozzatron: Galaxia's spiral gives iframes when striking enemies in a similar manner to a ram dash. + // This is a fixed and intentionally very low number of iframes, and is not boosted by Cross Necklace. + Owner.GiveUniversalIFrames(FourSeasonsGalaxia.PolarisAttunement_SlashIFrames); + break; } } } - if (!OwnerCanShoot) + if (Owner.CantUseHoldout()) { Projectile.Kill(); return; @@ -139,7 +138,7 @@ namespace CalamityMod.Projectiles.Melee Particle smoke = new HeavySmokeParticle(Projectile.Center, smokeSpeed + Owner.velocity, Color.Lerp(Color.Purple, Color.Indigo, (float)Math.Sin(Main.GlobalTimeWrappedHourly * 6f)), 30, Main.rand.NextFloat(0.6f, 1.2f) * (ShredRatio * 0.5f + 1f), 0.8f, 0, false, 0, true); GeneralParticleHandler.SpawnParticle(smoke); - if (Main.rand.Next(3) == 0) + if (Main.rand.NextBool(3)) { Particle smokeGlow = new HeavySmokeParticle(Projectile.Center, smokeSpeed + Owner.velocity, Main.hslToRgb(0.55f, 1, 0.5f + 0.2f * ShredRatio), 20, Main.rand.NextFloat(0.4f, 0.7f) * (ShredRatio * 0.5f + 1f), 0.8f, 0, true, 0.01f, true); GeneralParticleHandler.SpawnParticle(smokeGlow); @@ -209,7 +208,7 @@ namespace CalamityMod.Projectiles.Melee Owner.itemRotation = direction.ToRotation(); if (Owner.direction != 1) { - Owner.itemRotation -= 3.14f; + Owner.itemRotation -= MathHelper.Pi; } Owner.itemRotation = MathHelper.WrapAngle(Owner.itemRotation); Owner.itemTime = 2; @@ -274,7 +273,11 @@ namespace CalamityMod.Projectiles.Melee Shred += 80; //Augment the shredspeed if (Owner.velocity.Y > 0) Owner.velocity.Y = -2f; //Get "stuck" into the enemy partly - Owner.GiveIFrames(FourSeasonsGalaxia.PolarisAttunement_ShredIFrames); // i framez. + + // 17APR2024: Ozzatron: Galaxia's pogo gives iframes when striking enemies in a similar manner to a bonk dash. + // This is a fixed and intentionally very low number of iframes, and is not boosted by Cross Necklace. + Owner.GiveUniversalIFrames(FourSeasonsGalaxia.PolarisAttunement_ShredIFrames); + HitChargeCooldown = 20; } } diff --git a/Projectiles/Melee/Galaxia_PolarisGazeDash.cs b/Projectiles/Melee/Galaxia_PolarisGazeDash.cs index b97b767902..93dde5a6cc 100644 --- a/Projectiles/Melee/Galaxia_PolarisGazeDash.cs +++ b/Projectiles/Melee/Galaxia_PolarisGazeDash.cs @@ -1,8 +1,8 @@ -using CalamityMod.Particles; +using System; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; diff --git a/Projectiles/Melee/Galaxia_PolarisGazeStar.cs b/Projectiles/Melee/Galaxia_PolarisGazeStar.cs index 7692145125..b3b897d19e 100644 --- a/Projectiles/Melee/Galaxia_PolarisGazeStar.cs +++ b/Projectiles/Melee/Galaxia_PolarisGazeStar.cs @@ -1,12 +1,12 @@ -using CalamityMod.Particles; +using System; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -98,7 +98,7 @@ namespace CalamityMod.Projectiles.Melee Particle smoke = new HeavySmokeParticle(Projectile.Center, smokeSpeed + Projectile.velocity / 2, Color.Lerp(Color.Purple, Color.Indigo, (float)Math.Sin(Main.GlobalTimeWrappedHourly * 6f)), 30, Main.rand.NextFloat(0.6f, 1.2f), 0.8f, 0, false, 0, true); GeneralParticleHandler.SpawnParticle(smoke); - if (Main.rand.Next(3) == 0) + if (Main.rand.NextBool(3)) { Particle smokeGlow = new HeavySmokeParticle(Projectile.Center, smokeSpeed + Projectile.velocity / 2, Main.hslToRgb(0.55f, 1, 0.5f), 20, Main.rand.NextFloat(0.4f, 0.7f), 0.8f, 0, true, 0.01f, true); GeneralParticleHandler.SpawnParticle(smokeGlow); @@ -137,7 +137,7 @@ namespace CalamityMod.Projectiles.Melee Particle smoke = new HeavySmokeParticle(Projectile.Center, smokeSpeed + Projectile.velocity / 2, Color.Lerp(Color.DarkRed, Color.Indigo, (float)Math.Sin(Main.GlobalTimeWrappedHourly * 6f)), 30, Main.rand.NextFloat(1.5f, 2.2f), 0.8f, 0, false, 0, true); GeneralParticleHandler.SpawnParticle(smoke); - if (Main.rand.Next(3) == 0) + if (Main.rand.NextBool(3)) { Particle smokeGlow = new HeavySmokeParticle(Projectile.Center, smokeSpeed + Projectile.velocity / 2, Main.hslToRgb(0.55f, 1, 0.5f), 20, Main.rand.NextFloat(1.4f, 1.5f), 0.8f, 0, true, 0.01f, true); GeneralParticleHandler.SpawnParticle(smokeGlow); diff --git a/Projectiles/Melee/GalaxyBlast.cs b/Projectiles/Melee/GalaxyBlast.cs index fffe60486e..f5065f0ba0 100644 --- a/Projectiles/Melee/GalaxyBlast.cs +++ b/Projectiles/Melee/GalaxyBlast.cs @@ -1,9 +1,9 @@ using System; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -41,7 +41,7 @@ namespace CalamityMod.Projectiles.Melee return; } bool isInTile = WorldGen.SolidTile(Framing.GetTileSafely((int)Projectile.position.X / 16, (int)Projectile.position.Y / 16)); - Dust blastDust = Main.dust[Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 0, default, 1f)]; + Dust blastDust = Main.dust[Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, 0f, 0f, 0, default, 1f)]; blastDust.position = Projectile.Center; blastDust.velocity = Vector2.Zero; blastDust.noGravity = true; @@ -107,18 +107,18 @@ namespace CalamityMod.Projectiles.Melee bool insideTile = WorldGen.SolidTile(Framing.GetTileSafely((int)Projectile.position.X / 16, (int)Projectile.position.Y / 16)); for (int m = 0; m < 4; m++) { - Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 1.5f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, 0f, 0f, 100, default, 1.5f); } for (int n = 0; n < 4; n++) { - int killingPeople = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 0, default, 2.5f); + int killingPeople = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, 0f, 0f, 0, default, 2.5f); Main.dust[killingPeople].noGravity = true; Main.dust[killingPeople].velocity *= 3f; if (insideTile) { Main.dust[killingPeople].noLight = true; } - killingPeople = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 1.5f); + killingPeople = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, 0f, 0f, 100, default, 1.5f); Main.dust[killingPeople].velocity *= 2f; Main.dust[killingPeople].noGravity = true; if (insideTile) diff --git a/Projectiles/Melee/GalaxyBlastType2.cs b/Projectiles/Melee/GalaxyBlastType2.cs index d48506f7bc..c511cee1ba 100644 --- a/Projectiles/Melee/GalaxyBlastType2.cs +++ b/Projectiles/Melee/GalaxyBlastType2.cs @@ -2,9 +2,9 @@ using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Melee return; } bool isInTile = WorldGen.SolidTile(Framing.GetTileSafely((int)Projectile.position.X / 16, (int)Projectile.position.Y / 16)); - Dust blastDust = Main.dust[Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 0, default, 1f)]; + Dust blastDust = Main.dust[Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 0, default, 1f)]; blastDust.position = Projectile.Center; blastDust.velocity = Vector2.Zero; blastDust.noGravity = true; @@ -108,18 +108,18 @@ namespace CalamityMod.Projectiles.Melee bool insideTile = WorldGen.SolidTile(Framing.GetTileSafely((int)Projectile.position.X / 16, (int)Projectile.position.Y / 16)); for (int m = 0; m < 4; m++) { - Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1.5f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1.5f); } for (int n = 0; n < 4; n++) { - int killingPeople = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 0, default, 2.5f); + int killingPeople = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 0, default, 2.5f); Main.dust[killingPeople].noGravity = true; Main.dust[killingPeople].velocity *= 3f; if (insideTile) { Main.dust[killingPeople].noLight = true; } - killingPeople = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1.5f); + killingPeople = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1.5f); Main.dust[killingPeople].velocity *= 2f; Main.dust[killingPeople].noGravity = true; if (insideTile) diff --git a/Projectiles/Melee/GalaxyBlastType3.cs b/Projectiles/Melee/GalaxyBlastType3.cs index 42903a8258..707c0e8973 100644 --- a/Projectiles/Melee/GalaxyBlastType3.cs +++ b/Projectiles/Melee/GalaxyBlastType3.cs @@ -1,9 +1,9 @@ using System; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.tileCollide = false; Projectile.DamageType = DamageClass.Melee; } - + public override void SetStaticDefaults() { Main.projFrames[Projectile.type] = 4; @@ -41,7 +41,7 @@ namespace CalamityMod.Projectiles.Melee return; } bool isInTile = WorldGen.SolidTile(Framing.GetTileSafely((int)Projectile.position.X / 16, (int)Projectile.position.Y / 16)); - Dust blastDust = Main.dust[Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 172, 0f, 0f, 0, default, 1f)]; + Dust blastDust = Main.dust[Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.DungeonWater, 0f, 0f, 0, default, 1f)]; blastDust.position = Projectile.Center; blastDust.velocity = Vector2.Zero; blastDust.noGravity = true; @@ -107,18 +107,18 @@ namespace CalamityMod.Projectiles.Melee bool flag = WorldGen.SolidTile(Framing.GetTileSafely((int)Projectile.position.X / 16, (int)Projectile.position.Y / 16)); for (int m = 0; m < 4; m++) { - Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 172, 0f, 0f, 100, default, 1.5f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.DungeonWater, 0f, 0f, 100, default, 1.5f); } for (int n = 0; n < 4; n++) { - int killingPeople = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 172, 0f, 0f, 0, default, 2.5f); + int killingPeople = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.DungeonWater, 0f, 0f, 0, default, 2.5f); Main.dust[killingPeople].noGravity = true; Main.dust[killingPeople].velocity *= 3f; if (flag) { Main.dust[killingPeople].noLight = true; } - killingPeople = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 172, 0f, 0f, 100, default, 1.5f); + killingPeople = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.DungeonWater, 0f, 0f, 100, default, 1.5f); Main.dust[killingPeople].velocity *= 2f; Main.dust[killingPeople].noGravity = true; if (flag) diff --git a/Projectiles/Melee/GalaxySmasherEcho.cs b/Projectiles/Melee/GalaxySmasherEcho.cs index 98690631bb..2e13294fb6 100644 --- a/Projectiles/Melee/GalaxySmasherEcho.cs +++ b/Projectiles/Melee/GalaxySmasherEcho.cs @@ -1,13 +1,13 @@ using System; using System.IO; +using CalamityMod.Particles; +using CalamityMod.Projectiles.DraedonsArsenal; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using CalamityMod.Particles; -using CalamityMod.Projectiles.DraedonsArsenal; using static Humanizer.In; namespace CalamityMod.Projectiles.Melee @@ -146,7 +146,7 @@ namespace CalamityMod.Projectiles.Melee SpriteEffects spriteEffects = SpriteEffects.None; if (Projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Rectangle sourceRectangle = new Rectangle(0, 0, texture.Width + 12, texture.Height + 12); Vector2 origin = sourceRectangle.Size() / 2f; diff --git a/Projectiles/Melee/GalaxySmasherHammer.cs b/Projectiles/Melee/GalaxySmasherHammer.cs index abe30ffb78..53e5614b03 100644 --- a/Projectiles/Melee/GalaxySmasherHammer.cs +++ b/Projectiles/Melee/GalaxySmasherHammer.cs @@ -1,13 +1,13 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Particles; using Microsoft.Xna.Framework; -using System; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using CalamityMod.Particles; -using Microsoft.Xna.Framework.Graphics; namespace CalamityMod.Projectiles.Melee { @@ -52,7 +52,7 @@ namespace CalamityMod.Projectiles.Melee Player player = Main.player[Projectile.owner]; Projectile.direction = Projectile.spriteDirection = Projectile.velocity.X > 0f ? 1 : -1; Projectile.rotation += MathHelper.ToRadians(rotatehammer) * Projectile.direction; - + if (EmpoweredHammer >= 8) EmpoweredHammer = 0; @@ -242,11 +242,11 @@ namespace CalamityMod.Projectiles.Melee returnhammer = 1; } if (PulseCooldown >= 15) - { + { Particle pulse = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, Color.Violet, new Vector2(0.5f, 0.5f), Main.rand.NextFloat(12f, 25f), 0.2f, 1.4f + (EmpoweredHammer * 0.1f), 14); GeneralParticleHandler.SpawnParticle(pulse); PulseCooldown = 0; - } + } SoundEngine.PlaySound(SoundID.Item14 with { Volume = 0.22f }, Projectile.Center); Projectile.ai[1] = target.whoAmI; } diff --git a/Projectiles/Melee/GalaxySmasherMini.cs b/Projectiles/Melee/GalaxySmasherMini.cs index e3aab5297a..b6da381e62 100644 --- a/Projectiles/Melee/GalaxySmasherMini.cs +++ b/Projectiles/Melee/GalaxySmasherMini.cs @@ -1,9 +1,9 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using CalamityMod.Particles; namespace CalamityMod.Projectiles.Melee { diff --git a/Projectiles/Melee/GalileosMoon.cs b/Projectiles/Melee/GalileosMoon.cs index 2f4332f0bf..f330f94964 100644 --- a/Projectiles/Melee/GalileosMoon.cs +++ b/Projectiles/Melee/GalileosMoon.cs @@ -1,9 +1,9 @@ -using Microsoft.Xna.Framework; -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { diff --git a/Projectiles/Melee/GalileosPlanet.cs b/Projectiles/Melee/GalileosPlanet.cs index fdb5102f85..a51dceec4b 100644 --- a/Projectiles/Melee/GalileosPlanet.cs +++ b/Projectiles/Melee/GalileosPlanet.cs @@ -1,11 +1,11 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; +using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Graphics.Shaders; -using CalamityMod.Buffs.DamageOverTime; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -31,7 +31,7 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; for (float i = -5; i <= 0; i++) { if (Main.rand.NextFloat(1f) < 0.4f) @@ -56,7 +56,7 @@ namespace CalamityMod.Projectiles.Melee Dust dust; // You need to set position depending on what you are doing. You may need to subtract width/2 and height/2 as well to center the spawn rectangle. Vector2 pos2 = Projectile.Center - new Vector2(20, 20); - dust = Main.dust[Dust.NewDust(pos2, 40, 40, 180, 0f, 0f, 0, new Color(255, 255, 255), 1f)]; + dust = Main.dust[Dust.NewDust(pos2, 40, 40, DustID.DungeonSpirit, 0f, 0f, 0, new Color(255, 255, 255), 1f)]; Lighting.AddLight(Projectile.Center, 0.3f, 0.3f, 0.7f); } @@ -85,7 +85,7 @@ namespace CalamityMod.Projectiles.Melee Dust dust; // You need to set position depending on what you are doing. You may need to subtract width/2 and height/2 as well to center the spawn rectangle. Vector2 position = Projectile.Center - new Vector2(30, 30); - dust = Main.dust[Terraria.Dust.NewDust(position, 60, 60, 187, Main.rand.Next(-5, 5), Main.rand.Next(-5, 5), 0, new Color(0, 167, 255), 5f)]; + dust = Main.dust[Terraria.Dust.NewDust(position, 60, 60, DustID.Flare_Blue, Main.rand.Next(-5, 5), Main.rand.Next(-5, 5), 0, new Color(0, 167, 255), 5f)]; dust.noGravity = true; dust.shader = GameShaders.Armor.GetSecondaryShader(47, Main.LocalPlayer); } @@ -97,7 +97,7 @@ namespace CalamityMod.Projectiles.Melee Dust dust; // You need to set position depending on what you are doing. You may need to subtract width/2 and height/2 as well to center the spawn rectangle. Vector2 position = Projectile.position; - dust = Main.dust[Dust.NewDust(position, 94, 94, 180, Main.rand.Next(-5, 5), Main.rand.Next(-5, 5), 0, new Color(255, 255, 255), Main.rand.NextFloat(1.2f, 2.2f))]; + dust = Main.dust[Dust.NewDust(position, 94, 94, DustID.DungeonSpirit, Main.rand.Next(-5, 5), Main.rand.Next(-5, 5), 0, new Color(255, 255, 255), Main.rand.NextFloat(1.2f, 2.2f))]; dust.noGravity = true; } @@ -109,7 +109,7 @@ namespace CalamityMod.Projectiles.Melee Vector2 spinningpoint = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f * 0.5f; spinningpoint = spinningpoint.RotatedBy((double)((float)(i - (dustAmt / 2 - 1)) * 6.28318548f / (float)dustAmt), default(Vector2)) + Projectile.Center; Vector2 vector = spinningpoint - Projectile.Center; - int stratus = Dust.NewDust(spinningpoint + vector, 0, 0, 180, vector.X * 2f, vector.Y * 2f, 0, new Color(255, 255, 255), 1f); + int stratus = Dust.NewDust(spinningpoint + vector, 0, 0, DustID.DungeonSpirit, vector.X * 2f, vector.Y * 2f, 0, new Color(255, 255, 255), 1f); Main.dust[stratus].noGravity = true; Main.dust[stratus].velocity = Vector2.Normalize(vector) * x; } @@ -123,7 +123,7 @@ namespace CalamityMod.Projectiles.Melee Vector2 spinningpoint = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f * 0.5f; spinningpoint = spinningpoint.RotatedBy((double)((float)(i - (dustAmt / 2 - 1)) * 6.28318548f / (float)dustAmt), default(Vector2)) + Projectile.Center; Vector2 vector = spinningpoint - Projectile.Center; - int stratus = Dust.NewDust(spinningpoint + vector, 0, 0, 180, vector.X * 2f, vector.Y * 2f, 0, new Color(255, 255, 255), 1f); + int stratus = Dust.NewDust(spinningpoint + vector, 0, 0, DustID.DungeonSpirit, vector.X * 2f, vector.Y * 2f, 0, new Color(255, 255, 255), 1f); Main.dust[stratus].noGravity = true; Main.dust[stratus].velocity = Vector2.Normalize(vector) * x; Main.dust[stratus].velocity *= 2; diff --git a/Projectiles/Melee/GayBeam.cs b/Projectiles/Melee/GayBeam.cs index 2e05c749d5..243cf93949 100644 --- a/Projectiles/Melee/GayBeam.cs +++ b/Projectiles/Melee/GayBeam.cs @@ -1,38 +1,52 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Graphics.Primitives; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using System; using System.IO; using Terraria; +using Terraria.Audio; +using Terraria.GameContent; +using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using CalamityMod.Buffs.DamageOverTime; namespace CalamityMod.Projectiles.Melee { public class GayBeam : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; - private int alpha = 50; - private bool playedSound = false; + + private const int Alpha = 100; + + private const int TimeLeft = 600; + + private const int TrailLength = 36; + + private const int TotalAfterimages = 12; + + private const int AfterimageOffset = TrailLength / TotalAfterimages; + + private const float MaxVelocity = 24f; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = TrailLength; } public override void SetDefaults() { - Projectile.width = 20; - Projectile.height = 20; + Projectile.width = 16; + Projectile.height = 16; Projectile.friendly = true; Projectile.DamageType = DamageClass.Melee; Projectile.ignoreWater = true; - Projectile.penetrate = 3; + Projectile.penetrate = 1; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 8; - Projectile.timeLeft = 1200; - Projectile.extraUpdates = 3; + Projectile.localNPCHitCooldown = 10; + Projectile.timeLeft = TimeLeft; + Projectile.alpha = Alpha; } public override void SendExtraAI(BinaryWriter writer) @@ -50,89 +64,69 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.ToRadians(45f); - if (!playedSound) - { - SoundEngine.PlaySound(SoundID.Item60, Projectile.Center); - playedSound = true; - } - if (Projectile.localAI[0] == 0f) - { - Projectile.scale -= 0.01f; - Projectile.alpha += 15; - if (Projectile.alpha >= 250) - { - Projectile.alpha = 255; - Projectile.localAI[0] = 1f; - } - } - else if (Projectile.localAI[0] == 1f) - { - Projectile.scale += 0.01f; - Projectile.alpha -= 15; - if (Projectile.alpha <= 0) - { - Projectile.alpha = 0; - Projectile.localAI[0] = 0f; - } - } - Color color = new Color(255, 0, 0, alpha); + if (Projectile.ai[2] == 0f) + SoundEngine.PlaySound(SoundID.Item60, Projectile.Center); + + Color color = GetProjectileColor(); switch ((int)Projectile.ai[0]) { case 0: // Red, normal beam break; case 1: // Orange, curve back to player - color = new Color(255, 128, 0, alpha); - int p = (int)Player.FindClosest(Projectile.Center, 1, 1); + int player = (int)Player.FindClosest(Projectile.Center, 1, 1); Projectile.ai[1] += 1f; - if (Projectile.ai[1] < 220f && Projectile.ai[1] > 60f) + if (Projectile.ai[1] < 360f && Projectile.ai[1] > 60f) { float homeSpeed = Projectile.velocity.Length(); - Vector2 vecToPlayer = Main.player[p].Center - Projectile.Center; - vecToPlayer.Normalize(); + Vector2 vecToPlayer = Main.player[player].Center - Projectile.Center; + vecToPlayer = vecToPlayer.SafeNormalize(Vector2.UnitY); vecToPlayer *= homeSpeed; - Projectile.velocity = (Projectile.velocity * 24f + vecToPlayer) / 25f; - Projectile.velocity.Normalize(); + Projectile.velocity = (Projectile.velocity * 29f + vecToPlayer) / 30f; + Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitY); Projectile.velocity *= homeSpeed; } - if (Projectile.velocity.Length() < 24f) + if (Projectile.velocity.Length() < MaxVelocity) { - Projectile.velocity *= 1.02f; + Projectile.velocity *= 1.01f; + if (Projectile.velocity.Length() > MaxVelocity) + { + Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitY); + Projectile.velocity *= MaxVelocity; + } } break; case 2: // Yellow, split after a certain time - color = new Color(255, 255, 0, alpha); Projectile.localAI[1] += 1f; - if (Projectile.localAI[1] >= 180f) + if (Projectile.localAI[1] >= 45f) { - Projectile.localAI[1] = 0f; int numProj = 2; float rotation = MathHelper.ToRadians(10); if (Projectile.owner == Main.myPlayer) { - for (int i = 0; i < numProj + 1; i++) + for (int i = 0; i < numProj; i++) { - Vector2 perturbedSpeed = Projectile.velocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, perturbedSpeed * 0.5f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack * 0.5f, Projectile.owner, 0f, 0f); + Vector2 perturbedSpeed = Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, perturbedSpeed * MaxVelocity, Projectile.type, (int)(Projectile.damage * 0.5), Projectile.knockBack * 0.5f, Projectile.owner); } } + Projectile.Kill(); } break; case 3: // Lime, home in on player within certain distance - color = new Color(128, 255, 0, alpha); - float inertia = 75f; - float homingSpeed = 7.5f; - float minDist = 80f; + float inertia = 30f; + float homingSpeed = MaxVelocity; + float minDist = 300f; if (Main.player[Projectile.owner].active && !Main.player[Projectile.owner].dead) { if (Projectile.Distance(Main.player[Projectile.owner].Center) > minDist) @@ -144,88 +138,81 @@ namespace CalamityMod.Projectiles.Melee else { if (Projectile.timeLeft > 30) - { Projectile.timeLeft = 30; - } } break; case 4: // Green, home in on enemies - color = new Color(0, 255, 0, alpha); - CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 300f, 6f, 20f); + CalamityUtils.HomeInOnNPC(Projectile, false, 600f, MaxVelocity, 30f); break; case 5: // Turquoise, speed up and don't collide with tiles - color = new Color(0, 255, 128, alpha); Projectile.tileCollide = false; - if (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y) < 28f) + if (Projectile.velocity.Length() < MaxVelocity) { - Projectile.velocity *= 1.035f; + Projectile.velocity *= 1.03f; + if (Projectile.velocity.Length() > MaxVelocity) + { + Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitY); + Projectile.velocity *= MaxVelocity; + } } break; case 6: // Cyan, upon death create several turquoise swords - color = new Color(0, 255, 255, alpha); - break; - case 7: // Light Blue, slow down on hit - color = new Color(0, 128, 255, alpha); - break; - case 8: // Blue, bounce off of tiles and enemies - color = new Color(0, 0, 255, alpha); break; case 9: // Purple, speed up and slow down over and over - color = new Color(128, 0, 255, alpha); - Projectile.localAI[1] += 1f; - if (Projectile.localAI[1] <= 40f) - { + if (Projectile.localAI[1] < 30f) Projectile.velocity *= 0.95f; - } - else if (Projectile.localAI[1] > 40f && Projectile.localAI[1] <= 79f) - { - Projectile.velocity *= 1.05f; - } - else if (Projectile.localAI[1] == 80f) - { - Projectile.localAI[1] = 0f; - } + else if (Projectile.localAI[1] < 60f) + Projectile.velocity *= 1.07f; + else if (Projectile.localAI[1] == 60f) + Projectile.localAI[1] = -1f; + Projectile.localAI[1] += 1f; break; case 10: // Fuschia, start slow then get faster - color = new Color(255, 0, 255, alpha); if (Projectile.localAI[1] == 0f) { Projectile.velocity *= 0.1f; Projectile.localAI[1] += 1f; } - Projectile.velocity *= 1.01f; + + if (Projectile.velocity.Length() < MaxVelocity) + { + Projectile.velocity *= 1.05f; + if (Projectile.velocity.Length() > MaxVelocity) + { + Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitY); + Projectile.velocity *= MaxVelocity; + } + } break; case 11: // Hot Pink, split into fuschia while travelling - color = new Color(255, 0, 128, alpha); if (Projectile.localAI[1] == 0f) + Projectile.velocity *= 0.333f; + + if (Projectile.localAI[1] >= 45f) { - Projectile.velocity *= 0.33f; + Projectile.localAI[1] = 0f; + if (Main.myPlayer == Projectile.owner) + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center + Projectile.oldVelocity, Projectile.velocity, Projectile.type, (int)Math.Round(Projectile.damage * 0.5), Projectile.knockBack * 0.5f, Projectile.owner, 10f, 0f); } Projectile.localAI[1] += 1f; - if (Projectile.localAI[1] >= 181f) - { - Projectile.localAI[1] = 1f; - if (Main.myPlayer == Projectile.owner) - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center + Projectile.velocity, Projectile.velocity, ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack * 0.5f, Projectile.owner, 10f, 0f); - } break; @@ -233,39 +220,69 @@ namespace CalamityMod.Projectiles.Melee break; } - if (Main.rand.NextBool()) + Projectile.ai[2] += MathHelper.Lerp(1f, 2f, Projectile.ai[0] / 11f); + if (Projectile.ai[2] > 7f) { - int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 267, 0f, 0f, alpha, color, 1.5f); - Main.dust[dust].noGravity = true; + Dust rainbow = Main.dust[Dust.NewDust(new Vector2(Projectile.position.X - Projectile.velocity.X + 2f, Projectile.position.Y + 2f - Projectile.velocity.Y), 8, 8, DustID.RainbowMk2, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, Projectile.alpha, default, 1.25f)]; + rainbow.velocity *= -0.25f; + rainbow.color = color; + rainbow.color.A = 100; + rainbow.scale = Main.rand.NextFloat(1f, 1.25f); + rainbow.fadeIn = Main.rand.NextFloat(0.4f, 1f); + rainbow.noGravity = true; + rainbow.noLightEmittence = true; + + rainbow = Main.dust[Dust.NewDust(new Vector2(Projectile.position.X - Projectile.velocity.X + 2f, Projectile.position.Y + 2f - Projectile.velocity.Y), 8, 8, DustID.RainbowMk2, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, Projectile.alpha, default, 1.25f)]; + rainbow.velocity *= -0.25f; + rainbow.color = color; + rainbow.color.A = 100; + rainbow.scale = Main.rand.NextFloat(1f, 1.25f); + rainbow.fadeIn = Main.rand.NextFloat(0.4f, 1f); + rainbow.noGravity = true; + rainbow.position -= Projectile.velocity * 0.5f; + rainbow.noLightEmittence = true; + + if (Projectile.localAI[0] == 0f) + { + Projectile.scale -= 0.02f; + Projectile.alpha += 5; + if (Projectile.alpha >= Alpha - 5) + { + Projectile.alpha = Alpha; + Projectile.localAI[0] = 1f; + } + } + else if (Projectile.localAI[0] == 1f) + { + Projectile.scale += 0.02f; + Projectile.alpha -= 5; + if (Projectile.alpha <= 0) + { + Projectile.alpha = 0; + Projectile.localAI[0] = 0f; + } + } } } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(ModContent.BuffType(), 600); + target.AddBuff(ModContent.BuffType(), 300); if (Projectile.ai[0] == 7f) - { - Projectile.velocity *= 0.25f; - } + Projectile.velocity *= 0.5f; else if (Projectile.ai[0] == 8f) - { Projectile.velocity *= -1f; - } } public override void OnHitPlayer(Player target, Player.HurtInfo info) { - target.AddBuff(ModContent.BuffType(), 600); + target.AddBuff(ModContent.BuffType(), 300); if (Projectile.ai[0] == 7f) - { - Projectile.velocity *= 0.25f; - } + Projectile.velocity *= 0.5f; else if (Projectile.ai[0] == 8f) - { Projectile.velocity *= -1f; - } } public override bool OnTileCollide(Vector2 oldVelocity) @@ -273,153 +290,181 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.ai[0] == 8f) { if (Projectile.velocity.X != oldVelocity.X) - { Projectile.velocity.X = -oldVelocity.X; - } if (Projectile.velocity.Y != oldVelocity.Y) - { Projectile.velocity.Y = -oldVelocity.Y; - } + return false; } + return true; } - public override Color? GetAlpha(Color lightColor) + public Color TrailColor(float completionRatio) { - Color color = new Color(255, 0, 0, alpha); - switch ((int)Projectile.ai[0]) - { - case 0: // Red - break; - case 1: // Orange - color = new Color(255, 128, 0, alpha); - break; - case 2: // Yellow - color = new Color(255, 255, 0, alpha); - break; - case 3: // Lime - color = new Color(128, 255, 0, alpha); - break; - case 4: // Green - color = new Color(0, 255, 0, alpha); - break; - case 5: // Turquoise - color = new Color(0, 255, 128, alpha); - break; - case 6: // Cyan - color = new Color(0, 255, 255, alpha); - break; - case 7: // Light Blue - color = new Color(0, 128, 255, alpha); - break; - case 8: // Blue - color = new Color(0, 0, 255, alpha); - break; - case 9: // Purple - color = new Color(128, 0, 255, alpha); - break; - case 10: // Fuschia - color = new Color(255, 0, 255, alpha); - break; - case 11: // Hot Pink - color = new Color(255, 0, 128, alpha); - break; - default: - break; - } + float hue = (Main.GlobalTimeWrappedHourly * -0.62f + completionRatio * 1.5f) % 1f; + float brightness = MathHelper.SmoothStep(0.5f, 1f, Utils.GetLerpValue(0.3f, 0f, completionRatio, true)); + float opacity = Utils.GetLerpValue(1f, 0.8f, completionRatio, true) * ((255 - Projectile.alpha) / 255f); + Color color = GetProjectileColor() * opacity; + color.A = (byte)(int)(Utils.GetLerpValue(0f, 0.2f, completionRatio) * 128); return color; } + public float TrailWidth(float completionRatio) + { + float widthInterpolant = Utils.GetLerpValue(0f, 0.25f, completionRatio, true) * Utils.GetLerpValue(1.1f, 0.7f, completionRatio, true); + return MathHelper.SmoothStep(0f, 14f, widthInterpolant) * Projectile.scale; + } + + public override Color? GetAlpha(Color lightColor) => GetProjectileColor(); + public override bool PreDraw(ref Color lightColor) { - if (Projectile.timeLeft > 1195) + if (Projectile.timeLeft > TimeLeft - 5) return false; - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + Main.spriteBatch.EnterShaderRegion(); + + GameShaders.Misc["CalamityMod:ArtAttack"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/FabstaffStreak")); + GameShaders.Misc["CalamityMod:ArtAttack"].Apply(); + + PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(TrailWidth, TrailColor, (_) => Projectile.Size * 0.5f, shader: GameShaders.Misc["CalamityMod:ArtAttack"]), TrailLength); + + Main.spriteBatch.ExitShaderRegion(); + + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + int frameHeight = texture.Height / Main.projFrames[Projectile.type]; + int frameY = frameHeight * Projectile.frame; + float scale = Projectile.scale; + Rectangle rectangle = new Rectangle(0, frameY, texture.Width, frameHeight); + Vector2 origin = rectangle.Size() / 2f; + Color alphaColor = Projectile.GetAlpha(lightColor); + + if (CalamityConfig.Instance.Afterimages) + { + Vector2 centerOffset = Projectile.Size / 2f; + int totalAfterimages = TotalAfterimages; + for (int i = 0; i < totalAfterimages; i++) + { + int arrayPos = i * AfterimageOffset; + float afterimageRot = Projectile.oldRot[arrayPos]; + SpriteEffects sfxForThisAfterimage = Projectile.oldSpriteDirection[arrayPos] == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + Vector2 drawPos = Projectile.oldPos[arrayPos] + centerOffset - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); + float colorAndSizeScalar = (float)(totalAfterimages - i) / (float)totalAfterimages; + Color color = alphaColor * colorAndSizeScalar; + float afterimageScale = scale * MathHelper.Lerp(0.5f, 1f, colorAndSizeScalar); + Main.spriteBatch.Draw(texture, drawPos, new Rectangle?(rectangle), color, afterimageRot, origin, afterimageScale, sfxForThisAfterimage, 0f); + } + } + else + { + SpriteEffects spriteEffects = SpriteEffects.None; + if (Projectile.spriteDirection == -1) + spriteEffects = SpriteEffects.FlipHorizontally; + + Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), rectangle, alphaColor, Projectile.rotation, origin, scale, spriteEffects, 0f); + } + return false; } public override void OnKill(int timeLeft) { SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); - Projectile.ExpandHitboxBy(64); - Projectile.maxPenetrate = Projectile.penetrate = -1; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; - Projectile.Damage(); - Color color = new Color(255, 0, 0, alpha); + Color color = GetProjectileColor(); switch ((int)Projectile.ai[0]) { case 0: // Red - break; case 1: // Orange - color = new Color(255, 128, 0, alpha); - break; case 2: // Yellow - color = new Color(255, 255, 0, alpha); - break; case 3: // Lime - color = new Color(128, 255, 0, alpha); - break; case 4: // Green - color = new Color(0, 255, 0, alpha); - break; case 5: // Turquoise - color = new Color(0, 255, 128, alpha); break; case 6: // Cyan - color = new Color(0, 255, 255, alpha); - for (int x = 0; x < 3; x++) + for (int x = 0; x < 2; x++) { - bool fromRight = x == 1; - if (x == 2) - fromRight = Main.rand.NextBool(); if (Projectile.owner == Main.myPlayer) { var source = Projectile.GetSource_FromThis(); - CalamityUtils.ProjectileBarrage(source, Projectile.Center, Projectile.Center, fromRight, 500f, 500f, 0f, 500f, 5f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.2), Projectile.knockBack * 0.2f, Projectile.owner, false, 0f).ai[0] = 5f; + CalamityUtils.ProjectileBarrage(source, Projectile.Center, Projectile.Center, x == 1, 500f, 500f, 0f, 500f, MaxVelocity, Projectile.type, (int)Math.Round(Projectile.damage * 0.5), Projectile.knockBack * 0.5f, Projectile.owner, false, 0f).ai[0] = 5f; } } break; case 7: // Light Blue - color = new Color(0, 128, 255, alpha); - break; case 8: // Blue - color = new Color(0, 0, 255, alpha); - break; case 9: // Purple - color = new Color(128, 0, 255, alpha); - break; case 10: // Fuschia - color = new Color(255, 0, 255, alpha); - break; case 11: // Hot Pink - color = new Color(255, 0, 128, alpha); - break; default: break; } - for (int d = 0; d < 3; d++) + int totalDust = 60; + for (int i = 4; i < totalDust + 1; i++) { - int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 267, 0f, 0f, alpha, color, 1.5f); - Main.dust[dust].noGravity = true; + Vector2 oldVel = Projectile.oldVelocity * (totalDust / (float)i); + Dust rainbow = Main.dust[Dust.NewDust(Projectile.oldPosition - oldVel * 0.5f, 8, 8, DustID.RainbowMk2, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, Projectile.alpha)]; + rainbow.color = color; + rainbow.color.A = 100; + rainbow.scale = Main.rand.NextFloat(2.4f, 3.6f); + rainbow.fadeIn = Main.rand.NextFloat(0.4f, 1f); + rainbow.noGravity = true; + rainbow.velocity *= (Main.rand.NextBool() ? 0.05f : 0.5f); } - for (int d = 0; d < 30; d++) + } + + private Color GetProjectileColor() + { + Color rainbow = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, Alpha); + Color color = Color.White; + switch ((int)Projectile.ai[0]) { - int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 267, 0f, 0f, alpha, color, 2.5f); - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity *= 3f; - dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 267, 0f, 0f, alpha, color, 1.5f); - Main.dust[dust].velocity *= 2f; - Main.dust[dust].noGravity = true; + case 0: // Red + color = new Color(255, 0, 0, Alpha); + break; + case 1: // Orange + color = new Color(255, 128, 0, Alpha); + break; + case 2: // Yellow + color = new Color(255, 255, 0, Alpha); + break; + case 3: // Lime + color = new Color(128, 255, 0, Alpha); + break; + case 4: // Green + color = new Color(0, 255, 0, Alpha); + break; + case 5: // Turquoise + color = new Color(0, 255, 128, Alpha); + break; + case 6: // Cyan + color = new Color(0, 255, 255, Alpha); + break; + case 7: // Light Blue + color = new Color(0, 128, 255, Alpha); + break; + case 8: // Blue + color = new Color(0, 0, 255, Alpha); + break; + case 9: // Purple + color = new Color(128, 0, 255, Alpha); + break; + case 10: // Fuschia + color = new Color(255, 0, 255, Alpha); + break; + case 11: // Hot Pink + color = new Color(255, 0, 128, Alpha); + break; + default: + break; } + return Color.Lerp(rainbow, color, (float)Math.Sqrt((MathF.Cos(Projectile.ai[2] / 90f) + 1f) * 0.5f)); } } } diff --git a/Projectiles/Melee/GelWave.cs b/Projectiles/Melee/GelWave.cs index c6611920ce..a7f1df640e 100644 --- a/Projectiles/Melee/GelWave.cs +++ b/Projectiles/Melee/GelWave.cs @@ -1,9 +1,9 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -27,6 +27,8 @@ namespace CalamityMod.Projectiles.Melee Projectile.alpha = 120; Projectile.timeLeft = 200; Projectile.tileCollide = false; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() @@ -37,11 +39,11 @@ namespace CalamityMod.Projectiles.Melee Projectile.localAI[0] += 1f; } Lighting.AddLight(Projectile.Center, 0f, 0.2f, 0.4f); - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; Projectile.velocity.Y += Projectile.ai[0]; if (Main.rand.NextBool()) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 20, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.PurificationPowder, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } } @@ -63,7 +65,7 @@ namespace CalamityMod.Projectiles.Melee { for (int k = 0; k < 3; k++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 20, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.PurificationPowder, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } diff --git a/Projectiles/Melee/GemTechYellowShard.cs b/Projectiles/Melee/GemTechYellowShard.cs index e8b088e2e5..07091b3d31 100644 --- a/Projectiles/Melee/GemTechYellowShard.cs +++ b/Projectiles/Melee/GemTechYellowShard.cs @@ -1,8 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { diff --git a/Projectiles/Melee/GhastlySoulLarge.cs b/Projectiles/Melee/GhastlySoulLarge.cs index 4d4c4c9f5c..0a148d3a19 100644 --- a/Projectiles/Melee/GhastlySoulLarge.cs +++ b/Projectiles/Melee/GhastlySoulLarge.cs @@ -1,82 +1,96 @@ +using System; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Particles; using Microsoft.Xna.Framework; -using System; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { public class GhastlySoulLarge : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; + + private const int TimeLeft = 660; + private float HomingBuff = 1; + public override void SetStaticDefaults() { Main.projFrames[Projectile.type] = 4; ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; } public override void SetDefaults() { Projectile.width = 30; Projectile.height = 30; - Projectile.scale = 1.2f; Projectile.alpha = 100; Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.DamageType = DamageClass.Melee; - Projectile.extraUpdates = 1; Projectile.penetrate = 1; - Projectile.timeLeft = 600; + Projectile.extraUpdates = 1; + Projectile.timeLeft = TimeLeft; + Projectile.tileCollide = false; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 0; } public override void AI() { + if (HomingBuff > 0) + HomingBuff -= 0.01f; + Projectile.frameCounter++; if (Projectile.frameCounter > 6) { Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame > 3) - { + if (Projectile.frame >= Main.projFrames[Projectile.type]) Projectile.frame = 0; - } - int ghostlyDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 173, 0f, 0f, 0, default, 1f); - Dust dust = Main.dust[ghostlyDust]; - dust.velocity *= 0.1f; - Main.dust[ghostlyDust].scale = 1.3f; - Main.dust[ghostlyDust].noGravity = true; - float projVelocityFactor = 30f * Projectile.ai[1]; //100 - float scaleFactor = 6f * Projectile.ai[1]; //5 - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) - 1.57f; + Lighting.AddLight(Projectile.Center, 0.5f, 0.2f, 0.9f); + + if (Projectile.timeLeft % 2 == 0 && Projectile.timeLeft < TimeLeft - 10) + { + SparkParticle spark = new SparkParticle(Projectile.Center + Main.rand.NextVector2Circular(15, 15) - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 10, -Projectile.velocity * Main.rand.NextFloat(0.5f, 1.5f), false, Main.rand.Next(9, 12 + 1), 0.4f, Color.Plum); + GeneralParticleHandler.SpawnParticle(spark); + } + + float inertia = MathHelper.Lerp(20, 90, HomingBuff) * Projectile.ai[1]; + float velocity = VoidEdge.ShootSpeed * Projectile.ai[1]; if (Main.player[Projectile.owner].active && !Main.player[Projectile.owner].dead) { - if (Projectile.Distance(Main.player[Projectile.owner].Center) > 900f) + float homingDistance = 900f; + NPC target = Projectile.FindTargetWithinRange(homingDistance); + if (Projectile.timeLeft < TimeLeft - VoidEdge.ProjectileSpreadOutTime && target != null) + { + CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, homingDistance, velocity, inertia); + } + else if (Projectile.Distance(Main.player[Projectile.owner].Center) > homingDistance) { Vector2 moveDirection = Projectile.SafeDirectionTo(Main.player[Projectile.owner].Center, Vector2.UnitY); - Projectile.velocity = (Projectile.velocity * (projVelocityFactor - 1f) + moveDirection * scaleFactor) / projVelocityFactor; - return; + Projectile.velocity = (Projectile.velocity * (inertia - 1f) + moveDirection * velocity) / inertia; } - - CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 300f, 12f, 20f); } else { if (Projectile.timeLeft > 30) - { Projectile.timeLeft = 30; - } } + + Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; } public override bool PreDraw(ref Color lightColor) { - if (Projectile.timeLeft > 595) + if (Projectile.timeLeft > TimeLeft - 5) return false; CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); @@ -94,33 +108,38 @@ namespace CalamityMod.Projectiles.Melee return new Color(255, 255, 255, 100); } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { - target.AddBuff(ModContent.BuffType(), 180); + if (Projectile.numHits > 0) + Projectile.damage = (int)(Projectile.damage * 0.88f); + if (Projectile.damage < 1) + Projectile.damage = 1; } public override void OnKill(int timeLeft) { - Projectile.position = Projectile.Center; - Projectile.width = Projectile.height = 112; - Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); - Projectile.maxPenetrate = -1; + Projectile.damage = (int)(Projectile.damage / VoidEdge.TotalProjectilesPerSwing); Projectile.penetrate = -1; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; + Projectile.ExpandHitboxBy(230); Projectile.Damage(); - SoundEngine.PlaySound(SoulEdge.ProjectileDeathSound, Projectile.Center); - int dustAmt = 36; - for (int i = 0; i < dustAmt; i++) + SoundEngine.PlaySound(VoidEdge.ProjectileDeathSound with { Pitch = -0.3f }, Projectile.Center); + + int points = 25; + float radians = MathHelper.TwoPi / points; + Vector2 spinningPoint = Vector2.Normalize(new Vector2(-1f, -1f)); + float rotRando = Main.rand.NextFloat(0.1f, 2.5f); + for (int k = 0; k < points; k++) { - Vector2 rotate = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; - rotate = rotate.RotatedBy((double)((float)(i - (dustAmt / 2 - 1)) * 6.28318548f / (float)dustAmt), default) + Projectile.Center; - Vector2 faceDirection = rotate - Projectile.Center; - int killedDust = Dust.NewDust(rotate + faceDirection, 0, 0, 173, faceDirection.X * 1.5f, faceDirection.Y * 1.5f, 100, default, 2f); - Main.dust[killedDust].noGravity = true; - Main.dust[killedDust].noLight = true; - Main.dust[killedDust].velocity = faceDirection; + Vector2 velocity = spinningPoint.RotatedBy(radians * k).RotatedBy(-0.45f * rotRando); + LineParticle subTrail = new LineParticle(Projectile.Center + velocity * 20.5f, velocity * 15, false, 30, 0.75f, Color.Plum); + GeneralParticleHandler.SpawnParticle(subTrail); + } + for (int k = 0; k < 17; k++) + { + Dust dust2 = Dust.NewDustPerfect(Projectile.Center, 66, new Vector2(14, 14).RotatedByRandom(100) * Main.rand.NextFloat(0.3f, 1.8f)); + dust2.scale = Main.rand.NextFloat(1.15f, 1.45f); + dust2.noGravity = true; + dust2.color = Color.Plum; } } } diff --git a/Projectiles/Melee/GhastlySoulMedium.cs b/Projectiles/Melee/GhastlySoulMedium.cs index 617c424eb9..41e5e9bb77 100644 --- a/Projectiles/Melee/GhastlySoulMedium.cs +++ b/Projectiles/Melee/GhastlySoulMedium.cs @@ -1,82 +1,96 @@ +using System; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Particles; using Microsoft.Xna.Framework; -using System; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { public class GhastlySoulMedium : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; + + private const int TimeLeft = 600; + private float HomingBuff = 1; + public override void SetStaticDefaults() { Main.projFrames[Projectile.type] = 4; ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; } public override void SetDefaults() { Projectile.width = 30; Projectile.height = 30; - Projectile.scale = 1.1f; Projectile.alpha = 100; Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.DamageType = DamageClass.Melee; - Projectile.extraUpdates = 1; Projectile.penetrate = 1; - Projectile.timeLeft = 600; + Projectile.extraUpdates = 1; + Projectile.timeLeft = TimeLeft; + Projectile.tileCollide = false; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 0; } public override void AI() { + if (HomingBuff > 0) + HomingBuff -= 0.01f; + Projectile.frameCounter++; if (Projectile.frameCounter > 6) { Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame > 3) - { + if (Projectile.frame >= Main.projFrames[Projectile.type]) Projectile.frame = 0; - } - int ghostlyDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 173, 0f, 0f, 0, default, 1f); - Dust dust = Main.dust[ghostlyDust]; - dust.velocity *= 0.1f; - Main.dust[ghostlyDust].scale = 1.3f; - Main.dust[ghostlyDust].noGravity = true; - float projVelocityFactor = 35f * Projectile.ai[1]; //100 - float scaleFactor = 7f * Projectile.ai[1]; //5 - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) - 1.57f; + Lighting.AddLight(Projectile.Center, 0.5f, 0.2f, 0.9f); + + if (Projectile.timeLeft % 2 == 0 && Projectile.timeLeft < TimeLeft - 10) + { + SparkParticle spark = new SparkParticle(Projectile.Center + Main.rand.NextVector2Circular(15, 15) - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 10, -Projectile.velocity * Main.rand.NextFloat(0.5f, 1.5f), false, Main.rand.Next(9, 12 + 1), 0.4f, Color.Plum); + GeneralParticleHandler.SpawnParticle(spark); + } + + float inertia = MathHelper.Lerp(20, 90, HomingBuff) * Projectile.ai[1]; + float velocity = VoidEdge.ShootSpeed * VoidEdge.MediumSoulStatMultiplier * Projectile.ai[1]; if (Main.player[Projectile.owner].active && !Main.player[Projectile.owner].dead) { - if (Projectile.Distance(Main.player[Projectile.owner].Center) > 900f) + float homingDistance = 750f; + NPC target = Projectile.FindTargetWithinRange(homingDistance); + if (Projectile.timeLeft < TimeLeft - VoidEdge.ProjectileSpreadOutTime && target != null) + { + CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, homingDistance, velocity, inertia); + } + else if (Projectile.Distance(Main.player[Projectile.owner].Center) > homingDistance) { Vector2 moveDirection = Projectile.SafeDirectionTo(Main.player[Projectile.owner].Center, Vector2.UnitY); - Projectile.velocity = (Projectile.velocity * (projVelocityFactor - 1f) + moveDirection * scaleFactor) / projVelocityFactor; - return; + Projectile.velocity = (Projectile.velocity * (inertia - 1f) + moveDirection * velocity) / inertia; } - - CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 300f, 12f, 20f); } else { if (Projectile.timeLeft > 30) - { Projectile.timeLeft = 30; - } } + + Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; } public override bool PreDraw(ref Color lightColor) { - if (Projectile.timeLeft > 595) + if (Projectile.timeLeft > TimeLeft - 5) return false; CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); @@ -94,33 +108,38 @@ namespace CalamityMod.Projectiles.Melee return new Color(255, 255, 255, 100); } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { - target.AddBuff(ModContent.BuffType(), 120); + if (Projectile.numHits > 0) + Projectile.damage = (int)(Projectile.damage * 0.88f); + if (Projectile.damage < 1) + Projectile.damage = 1; } public override void OnKill(int timeLeft) { - Projectile.position = Projectile.Center; - Projectile.width = Projectile.height = 96; - Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); - Projectile.maxPenetrate = -1; + Projectile.damage = (int)(Projectile.damage / VoidEdge.TotalProjectilesPerSwing); Projectile.penetrate = -1; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; + Projectile.ExpandHitboxBy(140); Projectile.Damage(); - SoundEngine.PlaySound(SoulEdge.ProjectileDeathSound, Projectile.Center); - int dustAmt = 36; - for (int i = 0; i < dustAmt; i++) + SoundEngine.PlaySound(VoidEdge.ProjectileDeathSound, Projectile.Center); + + int points = 20; + float radians = MathHelper.TwoPi / points; + Vector2 spinningPoint = Vector2.Normalize(new Vector2(-1f, -1f)); + float rotRando = Main.rand.NextFloat(0.1f, 2.5f); + for (int k = 0; k < points; k++) { - Vector2 rotate = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; - rotate = rotate.RotatedBy((double)((float)(i - (dustAmt / 2 - 1)) * 6.28318548f / (float)dustAmt), default) + Projectile.Center; - Vector2 faceDirection = rotate - Projectile.Center; - int killedDust = Dust.NewDust(rotate + faceDirection, 0, 0, 173, faceDirection.X * 1.5f, faceDirection.Y * 1.5f, 100, default, 2f); - Main.dust[killedDust].noGravity = true; - Main.dust[killedDust].noLight = true; - Main.dust[killedDust].velocity = faceDirection; + Vector2 velocity = spinningPoint.RotatedBy(radians * k).RotatedBy(-0.45f * rotRando); + LineParticle subTrail = new LineParticle(Projectile.Center + velocity * 15.5f, velocity * 10, false, 25, 0.65f, Color.Plum); + GeneralParticleHandler.SpawnParticle(subTrail); + } + for (int k = 0; k < 12; k++) + { + Dust dust2 = Dust.NewDustPerfect(Projectile.Center, 66, new Vector2(9, 9).RotatedByRandom(100) * Main.rand.NextFloat(0.3f, 1.8f)); + dust2.scale = Main.rand.NextFloat(0.85f, 1.25f); + dust2.noGravity = true; + dust2.color = Color.Plum; } } } diff --git a/Projectiles/Melee/GhastlySoulSmall.cs b/Projectiles/Melee/GhastlySoulSmall.cs index 9b7833bc18..932c6060de 100644 --- a/Projectiles/Melee/GhastlySoulSmall.cs +++ b/Projectiles/Melee/GhastlySoulSmall.cs @@ -1,22 +1,29 @@ +using System; using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Ammo; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Particles; using Microsoft.Xna.Framework; -using System; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { public class GhastlySoulSmall : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; + + private const int TimeLeft = 540; + private float HomingBuff = 1; + public override void SetStaticDefaults() { Main.projFrames[Projectile.type] = 4; ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; } public override void SetDefaults() @@ -27,55 +34,64 @@ namespace CalamityMod.Projectiles.Melee Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.DamageType = DamageClass.Melee; - Projectile.extraUpdates = 1; Projectile.penetrate = 1; - Projectile.timeLeft = 600; + Projectile.extraUpdates = 1; + Projectile.timeLeft = TimeLeft; + Projectile.tileCollide = false; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 0; } public override void AI() { + if (HomingBuff > 0) + HomingBuff -= 0.01f; + Projectile.frameCounter++; if (Projectile.frameCounter > 6) { Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame > 3) - { + if (Projectile.frame >= Main.projFrames[Projectile.type]) Projectile.frame = 0; - } - int ghostlyDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 173, 0f, 0f, 0, default, 1f); - Dust dust = Main.dust[ghostlyDust]; - dust.velocity *= 0.1f; - Main.dust[ghostlyDust].scale = 1.3f; - Main.dust[ghostlyDust].noGravity = true; - float projVelocityFactor = 40f * Projectile.ai[1]; //100 - float scaleFactor = 8f * Projectile.ai[1]; //5 - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) - 1.57f; + Lighting.AddLight(Projectile.Center, 0.5f, 0.2f, 0.9f); + + if (Projectile.timeLeft % 2 == 0 && Projectile.timeLeft < TimeLeft - 10) + { + SparkParticle spark = new SparkParticle(Projectile.Center + Main.rand.NextVector2Circular(15, 15) - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 10, -Projectile.velocity * Main.rand.NextFloat(0.5f, 1.5f), false, Main.rand.Next(9, 12 + 1), 0.4f, Color.Plum); + GeneralParticleHandler.SpawnParticle(spark); + } + + float inertia = MathHelper.Lerp(20, 90, HomingBuff) * Projectile.ai[1]; + float velocity = VoidEdge.ShootSpeed * VoidEdge.SmallSoulStatMultiplier * Projectile.ai[1]; if (Main.player[Projectile.owner].active && !Main.player[Projectile.owner].dead) { - if (Projectile.Distance(Main.player[Projectile.owner].Center) > 900f) + float homingDistance = 600f; + NPC target = Projectile.FindTargetWithinRange(homingDistance); + if (Projectile.timeLeft < TimeLeft - VoidEdge.ProjectileSpreadOutTime && target != null) + { + CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, homingDistance, velocity, inertia); + } + else if (Projectile.Distance(Main.player[Projectile.owner].Center) > homingDistance) { Vector2 moveDirection = Projectile.SafeDirectionTo(Main.player[Projectile.owner].Center, Vector2.UnitY); - Projectile.velocity = (Projectile.velocity * (projVelocityFactor - 1f) + moveDirection * scaleFactor) / projVelocityFactor; - return; + Projectile.velocity = (Projectile.velocity * (inertia - 1f) + moveDirection * velocity) / inertia; } - - CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 300f, 12f, 20f); } else { if (Projectile.timeLeft > 30) - { Projectile.timeLeft = 30; - } } + + Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; } public override bool PreDraw(ref Color lightColor) { - if (Projectile.timeLeft > 595) + if (Projectile.timeLeft > TimeLeft - 5) return false; CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); @@ -93,33 +109,38 @@ namespace CalamityMod.Projectiles.Melee return new Color(255, 255, 255, 100); } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { - target.AddBuff(ModContent.BuffType(), 60); + if (Projectile.numHits > 0) + Projectile.damage = (int)(Projectile.damage * 0.88f); + if (Projectile.damage < 1) + Projectile.damage = 1; } public override void OnKill(int timeLeft) { - Projectile.position = Projectile.Center; - Projectile.width = Projectile.height = 64; - Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); - Projectile.maxPenetrate = -1; + Projectile.damage = (int)(Projectile.damage / VoidEdge.TotalProjectilesPerSwing); Projectile.penetrate = -1; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; + Projectile.ExpandHitboxBy(80); Projectile.Damage(); - SoundEngine.PlaySound(SoulEdge.ProjectileDeathSound, Projectile.Center); - int dustAmt = 36; - for (int i = 0; i < dustAmt; i++) + SoundEngine.PlaySound(VoidEdge.ProjectileDeathSound with { Pitch = 0.3f }, Projectile.Center); + + int points = 15; + float radians = MathHelper.TwoPi / points; + Vector2 spinningPoint = Vector2.Normalize(new Vector2(-1f, -1f)); + float rotRando = Main.rand.NextFloat(0.1f, 2.5f); + for (int k = 0; k < points; k++) { - Vector2 rotate = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; - rotate = rotate.RotatedBy((double)((float)(i - (dustAmt / 2 - 1)) * 6.28318548f / (float)dustAmt), default) + Projectile.Center; - Vector2 faceDirection = rotate - Projectile.Center; - int killedDust = Dust.NewDust(rotate + faceDirection, 0, 0, 173, faceDirection.X * 1.5f, faceDirection.Y * 1.5f, 100, default, 2f); - Main.dust[killedDust].noGravity = true; - Main.dust[killedDust].noLight = true; - Main.dust[killedDust].velocity = faceDirection; + Vector2 velocity = spinningPoint.RotatedBy(radians * k).RotatedBy(-0.45f * rotRando); + LineParticle subTrail = new LineParticle(Projectile.Center + velocity * 10.5f, velocity * 5, false, 20, 0.55f, Color.Plum); + GeneralParticleHandler.SpawnParticle(subTrail); + } + for (int k = 0; k < 7; k++) + { + Dust dust2 = Dust.NewDustPerfect(Projectile.Center, 66, new Vector2(6, 6).RotatedByRandom(100) * Main.rand.NextFloat(0.3f, 1.8f)); + dust2.scale = Main.rand.NextFloat(0.65f, 0.85f); + dust2.noGravity = true; + dust2.color = Color.Plum; } } } diff --git a/Projectiles/Melee/GreenWater.cs b/Projectiles/Melee/GreenWater.cs index 6ea7da0139..ed9b0cd04e 100644 --- a/Projectiles/Melee/GreenWater.cs +++ b/Projectiles/Melee/GreenWater.cs @@ -1,15 +1,18 @@ -using System; +using System; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { public class GreenWater : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; + + private const int TimeLeft = 300; + public override void SetStaticDefaults() { ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; @@ -24,28 +27,45 @@ namespace CalamityMod.Projectiles.Melee Projectile.ignoreWater = true; Projectile.tileCollide = false; Projectile.penetrate = 1; - Projectile.timeLeft = 150; + Projectile.timeLeft = TimeLeft; Projectile.DamageType = DamageClass.Melee; } public override void AI() { - Lighting.AddLight(Projectile.Center, 0f, 0.25f, 0.5f); - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 0.785f; + if (Projectile.ai[1] == 0f) + { + if (Projectile.Center.Y > Projectile.ai[2]) + Projectile.tileCollide = true; + else + Projectile.tileCollide = false; + } + else + { + if (Projectile.Center.Y < Projectile.ai[2]) + Projectile.tileCollide = true; + else + Projectile.tileCollide = false; + } + + Lighting.AddLight(Projectile.Center, 0.5f, 0.25f, 0f); + + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4; + if (Projectile.localAI[0] == 0f) { SoundEngine.PlaySound(SoundID.Item21, Projectile.position); Projectile.localAI[0] += 1f; } - int hitDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 5, 0f, 0f, 100, default, 1f); - Main.dust[hitDust].noGravity = true; - Main.dust[hitDust].velocity *= 0.5f; - Main.dust[hitDust].velocity += Projectile.velocity * 0.1f; + + int blood = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Blood, 0f, 0f, 100, default, Main.rand.NextFloat(1.6f, 2.4f)); + Main.dust[blood].noGravity = true; + Main.dust[blood].velocity *= 0.5f; } public override bool PreDraw(ref Color lightColor) { - if (Projectile.timeLeft > 145) + if (Projectile.timeLeft > TimeLeft - 5) return false; CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); @@ -54,26 +74,22 @@ namespace CalamityMod.Projectiles.Melee public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); - int inc; - for (int i = 4; i < 31; i = inc + 1) + SoundEngine.PlaySound(SoundID.NPCDeath12, Projectile.Center); + + for (int i = 4; i < 31; i++) { float oldXPos = Projectile.oldVelocity.X * (30f / (float)i); float oldYPos = Projectile.oldVelocity.Y * (30f / (float)i); - int killDust = Dust.NewDust(new Vector2(Projectile.oldPosition.X - oldXPos, Projectile.oldPosition.Y - oldYPos), 8, 8, 5, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.8f); + int killDust = Dust.NewDust(new Vector2(Projectile.oldPosition.X - oldXPos, Projectile.oldPosition.Y - oldYPos), 8, 8, DustID.Blood, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.8f); Main.dust[killDust].noGravity = true; Dust dust = Main.dust[killDust]; dust.velocity *= 0.5f; - killDust = Dust.NewDust(new Vector2(Projectile.oldPosition.X - oldXPos, Projectile.oldPosition.Y - oldYPos), 8, 8, 5, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.4f); + killDust = Dust.NewDust(new Vector2(Projectile.oldPosition.X - oldXPos, Projectile.oldPosition.Y - oldYPos), 8, 8, DustID.Blood, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.4f); dust = Main.dust[killDust]; dust.velocity *= 0.05f; - inc = i; } } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(BuffID.Venom, 90); - } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.Venom, 90); } } diff --git a/Projectiles/Melee/HellionSpike.cs b/Projectiles/Melee/HellionSpike.cs index 16cbc5dce5..a847d50f03 100644 --- a/Projectiles/Melee/HellionSpike.cs +++ b/Projectiles/Melee/HellionSpike.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Projectiles.Melee Lighting.AddLight(Projectile.Center, 0f, 0.25f, 0f); if (Main.rand.NextBool(3)) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 44, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.JungleSpore, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } } @@ -41,7 +41,7 @@ namespace CalamityMod.Projectiles.Melee { for (int k = 0; k < 5; k++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 44, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.JungleSpore, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } diff --git a/Projectiles/Melee/HolyColliderHolyFire.cs b/Projectiles/Melee/HolyColliderHolyFire.cs index 8f23dda5c3..381642a43f 100644 --- a/Projectiles/Melee/HolyColliderHolyFire.cs +++ b/Projectiles/Melee/HolyColliderHolyFire.cs @@ -1,10 +1,10 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { public class HolyColliderHolyFire : ModProjectile, ILocalizedModType @@ -56,8 +56,8 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - Texture2D texture2D13 = ModContent.Request(Texture).Value; - int framing = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; + Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + int framing = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; int y6 = framing * Projectile.frame; Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)framing / 2f), Projectile.scale, SpriteEffects.None, 0); return false; @@ -74,7 +74,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int i = 0; i < 5; i++) { - int holy = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); + int holy = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 100, default, 2f); if (Main.rand.NextBool()) { Main.dust[holy].scale = 0.5f; @@ -83,9 +83,9 @@ namespace CalamityMod.Projectiles.Melee } for (int j = 0; j < 10; j++) { - int holy2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 3f); + int holy2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 100, default, 3f); Main.dust[holy2].noGravity = true; - holy2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); + holy2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 100, default, 2f); } } } diff --git a/Projectiles/Melee/HyperBlade.cs b/Projectiles/Melee/HyperBlade.cs deleted file mode 100644 index 448ba1ffa1..0000000000 --- a/Projectiles/Melee/HyperBlade.cs +++ /dev/null @@ -1,64 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class HyperBlade : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Melee"; - public override void SetStaticDefaults() - { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; - } - - public override void SetDefaults() - { - Projectile.width = 50; - Projectile.height = 50; - Projectile.aiStyle = ProjAIStyleID.Sickle; - Projectile.alpha = 100; - Projectile.friendly = true; - Projectile.tileCollide = false; - Projectile.DamageType = DamageClass.Melee; - Projectile.penetrate = 3; - Projectile.ignoreWater = true; - AIType = ProjectileID.DeathSickle; - Projectile.MaxUpdates = 3; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 15 * Projectile.MaxUpdates; - Projectile.timeLeft = 150 * Projectile.MaxUpdates; - } - - public override void AI() - { - Lighting.AddLight(Projectile.Center, 0f, 0.5f, 0f); - - CalamityUtils.HomeInOnNPC(Projectile, true, 350f, 15f, 10f); - } - - public override Color? GetAlpha(Color lightColor) - { - if (Projectile.timeLeft < 85) - { - byte b2 = (byte)(Projectile.timeLeft * 3); - byte a2 = (byte)(100f * ((float)b2 / 255f)); - return new Color((int)b2, (int)b2, (int)b2, (int)a2); - } - return new Color(255, 255, 255, 100); - } - - public override bool PreDraw(ref Color lightColor) - { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); - return false; - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(BuffID.CursedInferno, 180); - } - } -} diff --git a/Projectiles/Melee/HyperBlade.png b/Projectiles/Melee/HyperBlade.png deleted file mode 100644 index bc530bb268..0000000000 Binary files a/Projectiles/Melee/HyperBlade.png and /dev/null differ diff --git a/Projectiles/Melee/IceBombFriendly.cs b/Projectiles/Melee/IceBombFriendly.cs index 260d58f52f..90414812a7 100644 --- a/Projectiles/Melee/IceBombFriendly.cs +++ b/Projectiles/Melee/IceBombFriendly.cs @@ -1,7 +1,7 @@ -using CalamityMod.Buffs.StatDebuffs; +using System; +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -23,6 +23,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.DamageType = DamageClass.Melee; Projectile.penetrate = 1; Projectile.timeLeft = 180; + Projectile.tileCollide = false; } public override bool? CanDamage() => Projectile.ai[0] >= 120f; @@ -59,7 +60,7 @@ namespace CalamityMod.Projectiles.Melee { for (int i = 0; i < 8; i++) { - int icyDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 67, 0f, 0f, 100, default, 2f); + int icyDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.IceRod, 0f, 0f, 100, default, 2f); Main.dust[icyDust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -69,10 +70,10 @@ namespace CalamityMod.Projectiles.Melee } for (int j = 0; j < 14; j++) { - int icyDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 67, 0f, 0f, 100, default, 3f); + int icyDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.IceRod, 0f, 0f, 100, default, 3f); Main.dust[icyDust2].noGravity = true; Main.dust[icyDust2].velocity *= 5f; - icyDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 67, 0f, 0f, 100, default, 2f); + icyDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.IceRod, 0f, 0f, 100, default, 2f); Main.dust[icyDust2].velocity *= 2f; } @@ -117,7 +118,7 @@ namespace CalamityMod.Projectiles.Melee } for (int k = 0; k < 3; k++) - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 67, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.IceRod, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) diff --git a/Projectiles/Melee/IllustriousKnife.cs b/Projectiles/Melee/IllustriousKnife.cs index 9be56b2def..1129424d68 100644 --- a/Projectiles/Melee/IllustriousKnife.cs +++ b/Projectiles/Melee/IllustriousKnife.cs @@ -1,7 +1,8 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Balancing; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Projectiles.Healing; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -45,7 +46,7 @@ namespace CalamityMod.Projectiles.Melee } CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 300f, 12f, 20f); if (Main.rand.NextBool(6)) - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 20, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.PurificationPowder, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } //Give it a custom hitbox shape so it may remain rectangular and elongated @@ -64,7 +65,7 @@ namespace CalamityMod.Projectiles.Melee { for (int i = 0; i < 3; i++) { - int illustrious = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 20, 0f, 0f, 100, default, 0.8f); + int illustrious = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.PurificationPowder, 0f, 0f, 100, default, 0.8f); Main.dust[illustrious].noGravity = true; Main.dust[illustrious].velocity *= 1.2f; Main.dust[illustrious].velocity -= Projectile.oldVelocity * 0.3f; @@ -75,34 +76,28 @@ namespace CalamityMod.Projectiles.Melee { target.AddBuff(ModContent.BuffType(), 180); - float healAmt = hit.Damage * 0.015f; - if ((int)healAmt == 0) + int heal = (int)Math.Round(hit.Damage * 0.015); + if (heal > BalancingConstants.LifeStealCap) + heal = BalancingConstants.LifeStealCap; + + if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) return; - if (Main.player[Main.myPlayer].lifeSteal <= 0f) - return; - - if (healAmt > CalamityMod.lifeStealCap) - healAmt = CalamityMod.lifeStealCap; - - CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], healAmt, ModContent.ProjectileType(), 1200f, 3f); + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ModContent.ProjectileType(), BalancingConstants.LifeStealRange); } public override void OnHitPlayer(Player target, Player.HurtInfo info) { target.AddBuff(ModContent.BuffType(), 180); - float healAmt = info.Damage * 0.015f; - if ((int)healAmt == 0) + int heal = (int)Math.Round(info.Damage * 0.015); + if (heal > BalancingConstants.LifeStealCap) + heal = BalancingConstants.LifeStealCap; + + if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0) return; - if (Main.player[Main.myPlayer].lifeSteal <= 0f) - return; - - if (healAmt > CalamityMod.lifeStealCap) - healAmt = CalamityMod.lifeStealCap; - - CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], healAmt, ModContent.ProjectileType(), 1200f, 3f); + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ModContent.ProjectileType(), BalancingConstants.LifeStealRange); } public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Melee/InsidiousHarpoon.cs b/Projectiles/Melee/InsidiousHarpoon.cs index 78bdfa9373..dc2c3c4ba3 100644 --- a/Projectiles/Melee/InsidiousHarpoon.cs +++ b/Projectiles/Melee/InsidiousHarpoon.cs @@ -1,15 +1,18 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Weapons.Melee; using Microsoft.Xna.Framework; using Terraria; -using Terraria.ID; -using Terraria.ModLoader; using Terraria.Audio; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { public class InsidiousHarpoon : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; + public override LocalizedText DisplayName => CalamityUtils.GetItemName(); public override void SetStaticDefaults() { ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; @@ -23,8 +26,9 @@ namespace CalamityMod.Projectiles.Melee Projectile.friendly = true; Projectile.penetrate = 8; Projectile.alpha = 255; - Projectile.DamageType = DamageClass.Melee; - Projectile.extraUpdates = 2; + Projectile.DamageType = DamageClass.MeleeNoSpeed; + Projectile.scale = 1.3f; + Projectile.extraUpdates = 1; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 20 * Projectile.extraUpdates; Projectile.tileCollide = true; @@ -37,10 +41,24 @@ namespace CalamityMod.Projectiles.Melee Projectile.alpha -= 25; } if (Projectile.alpha < 0) + { Projectile.alpha = 0; + } + if (Projectile.ai[0] == 0f) + { + Projectile.localAI[1] += 1f; + if (Projectile.localAI[1] >= 60f) + { + Projectile.velocity.X *= 0.99f; + Projectile.velocity.Y += 0.3f; + + if (Projectile.velocity.Y > 16f) + Projectile.velocity.Y = 16f; + } + } int dustType = 171; - if (Main.rand.Next(3) == 0) + if (Main.rand.NextBool(3)) { dustType = 46; } @@ -74,7 +92,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnKill(int timeLeft) { int dustType = 171; - if (Main.rand.Next(3) == 0) + if (Main.rand.NextBool(3)) { dustType = 46; } @@ -88,7 +106,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.Damage(); for (int i = 0; i < 15; i++) { - int deathDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 1.2f); + int deathDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 1.2f); Main.dust[deathDust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -98,10 +116,10 @@ namespace CalamityMod.Projectiles.Melee } for (int j = 0; j < 30; j++) { - int deathDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 1.7f); + int deathDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 1.7f); Main.dust[deathDust2].noGravity = true; Main.dust[deathDust2].velocity *= 5f; - deathDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 1f); + deathDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 1f); Main.dust[deathDust2].velocity *= 2f; } } diff --git a/Projectiles/Melee/IridescentExcaliburSlash.cs b/Projectiles/Melee/IridescentExcaliburSlash.cs new file mode 100644 index 0000000000..623ef18e98 --- /dev/null +++ b/Projectiles/Melee/IridescentExcaliburSlash.cs @@ -0,0 +1,254 @@ +using System.Collections.Generic; +using CalamityMod.Graphics.Primitives; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.GameContent; +using Terraria.GameContent.Drawing; +using Terraria.Graphics.Shaders; +using Terraria.ModLoader; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Balancing; +using CalamityMod.Projectiles.Healing; + +namespace CalamityMod.Projectiles.Melee +{ + public class IridescentExcaliburSlash : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + + public override void SetStaticDefaults() + { + Main.projFrames[Projectile.type] = 4; + } + + public override void SetDefaults() + { + Projectile.width = 16; + Projectile.height = 16; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.ownerHitCheck = true; + Projectile.ownerHitCheckDistance = 300f; + Projectile.usesOwnerMeleeHitCD = true; + Projectile.stopsDealingDamageAfterPenetrateHits = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + + public override void AI() + { + Projectile.localAI[0] += 1f; + Player player = Main.player[Projectile.owner]; + float num = Projectile.localAI[0] / Projectile.ai[1]; + float num2 = Projectile.ai[0]; + float num3 = Projectile.velocity.ToRotation(); + float num4 = (float)Math.PI * num2 * num + num3 + num2 * (float)Math.PI + player.fullRotation; + Projectile.rotation = num4; + float num5 = 1f; + float num6 = 1.2f; + + Projectile.Center = player.RotatedRelativePoint(player.MountedCenter) - Projectile.velocity; + Projectile.scale = num6 + num * num5; + + float colorAIScale = Projectile.localAI[0] / Projectile.ai[1]; + float amount = Utils.Remap(colorAIScale, 0f, 0.6f, 0f, 1f) * Utils.Remap(colorAIScale, 0.6f, 1f, 1f, 0f); + Color rainbow = Color.Lerp(new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), new Color(255 - Main.DiscoR, 255 - Main.DiscoG, 255 - Main.DiscoB), amount); + float num8 = Projectile.rotation + Main.rand.NextFloatDirection() * MathHelper.PiOver2 * 0.7f; + Vector2 vector2 = Projectile.Center + num8.ToRotationVector2() * 84f * Projectile.scale; + Vector2 vector3 = (num8 + Projectile.ai[0] * MathHelper.PiOver2).ToRotationVector2(); + if (Main.rand.NextFloat() * 2f < Projectile.Opacity) + { + Dust dust2 = Dust.NewDustPerfect(Projectile.Center + num8.ToRotationVector2() * (Main.rand.NextFloat() * 80f * Projectile.scale + 20f * Projectile.scale), 278, vector3 * 1f, 100, rainbow, 0.4f); + dust2.fadeIn = 0.4f + Main.rand.NextFloat() * 0.15f; + dust2.noGravity = true; + } + + if (Main.rand.NextFloat() * 1.5f < Projectile.Opacity) + Dust.NewDustPerfect(vector2, 43, vector3 * 1f, 100, rainbow * Projectile.Opacity, 1.2f * Projectile.Opacity); + + float num10 = Projectile.rotation + Main.rand.NextFloatDirection() * MathHelper.PiOver2 * 0.7f; + Vector2 vector5 = Projectile.Center + num10.ToRotationVector2() * 84f * Projectile.scale; + Vector2 vector6 = (num10 + Projectile.ai[0] * MathHelper.PiOver2).ToRotationVector2(); + if (Main.rand.NextFloat() < Projectile.Opacity) + { + Dust dust4 = Dust.NewDustPerfect(Projectile.Center + num10.ToRotationVector2() * (Main.rand.NextFloat() * 80f * Projectile.scale + 20f * Projectile.scale), 278, vector6 * 1f, 100, rainbow, 0.4f); + dust4.fadeIn = 0.4f + Main.rand.NextFloat() * 0.15f; + dust4.noGravity = true; + } + + if (Main.rand.NextFloat() * 1.5f < Projectile.Opacity) + Dust.NewDustPerfect(vector5, 43, vector6 * 1f, 100, rainbow * Projectile.Opacity, 1.2f * Projectile.Opacity); + + Projectile.scale *= Projectile.ai[2]; + if (Projectile.localAI[0] >= Projectile.ai[1]) + Projectile.Kill(); + + // Enchantment visual bullshit + Vector2 boxPosition = Projectile.position; + int boxWidth = Projectile.width; + int boxHeight = Projectile.height; + for (float i = -MathHelper.PiOver4; i <= MathHelper.PiOver4; i += MathHelper.PiOver2) + { + Rectangle rect = Utils.CenteredRectangle(Projectile.Center + (Projectile.rotation + i).ToRotationVector2() * 70f * Projectile.scale, new Vector2(60f * Projectile.scale, 60f * Projectile.scale)); + Projectile.EmitEnchantmentVisualsAt(rect.TopLeft(), rect.Width, rect.Height); + } + } + + public override bool PreDraw(ref Color lightColor) + { + Vector2 vector = Projectile.Center - Main.screenPosition; + Texture2D asset = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Rectangle rectangle = asset.Frame(1, 4); + Vector2 origin = rectangle.Size() / 2f; + float num = Projectile.scale * 1.1f; + SpriteEffects effects = ((!(Projectile.ai[0] >= 0f)) ? SpriteEffects.FlipVertically : SpriteEffects.None); + float num2 = Projectile.localAI[0] / Projectile.ai[1]; + float num3 = Utils.Remap(num2, 0f, 0.6f, 0f, 1f) * Utils.Remap(num2, 0.6f, 1f, 1f, 0f); + float num4 = 0.975f; + float amount = num3; + float fromValue = Lighting.GetColor(Projectile.Center.ToTileCoordinates()).ToVector3().Length() / (float)Math.Sqrt(3D); + fromValue = Utils.Remap(fromValue, 0.2f, 1f, 0f, 1f); + Color color = Color.Lerp(new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), new Color(255 - Main.DiscoR, 255 - Main.DiscoG, 255 - Main.DiscoB), amount); + Main.spriteBatch.Draw(asset, vector, rectangle, color * fromValue * num3, Projectile.rotation + Projectile.ai[0] * MathHelper.PiOver4 * -1f * (1f - num2), origin, num, effects, 0f); + Color color2 = Color.Lerp(new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), new Color(255 - Main.DiscoR, 255 - Main.DiscoG, 255 - Main.DiscoB), amount); + Color color3 = Color.Lerp(new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), new Color(255 - Main.DiscoR, 255 - Main.DiscoG, 255 - Main.DiscoB), amount); + Color color4 = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB) * num3 * 0.5f; + Color color5 = color4 * fromValue * 0.5f; + Main.spriteBatch.Draw(asset, vector, rectangle, color5 * 0.15f, Projectile.rotation + Projectile.ai[0] * 0.01f, origin, num, effects, 0f); + Main.spriteBatch.Draw(asset, vector, rectangle, color3 * fromValue * num3 * 0.3f, Projectile.rotation, origin, num, effects, 0f); + Main.spriteBatch.Draw(asset, vector, rectangle, color2 * fromValue * num3 * 0.5f, Projectile.rotation, origin, num * num4, effects, 0f); + Main.spriteBatch.Draw(asset, vector, asset.Frame(1, 4, 0, 3), new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB) * 0.6f * num3, Projectile.rotation + Projectile.ai[0] * 0.01f, origin, num, effects, 0f); + Main.spriteBatch.Draw(asset, vector, asset.Frame(1, 4, 0, 3), new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB) * 0.5f * num3, Projectile.rotation + Projectile.ai[0] * -0.05f, origin, num * 0.8f, effects, 0f); + Main.spriteBatch.Draw(asset, vector, asset.Frame(1, 4, 0, 3), new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB) * 0.4f * num3, Projectile.rotation + Projectile.ai[0] * -0.1f, origin, num * 0.6f, effects, 0f); + float num5 = num * 0.75f; + Texture2D value = TextureAssets.Extra[98].Value; + Color shineColor = color3 * Projectile.Opacity * 0.5f; + Vector2 origin2 = value.Size() / 2f; + float num9 = Utils.GetLerpValue(0f, 0.5f, num2, clamped: true) * Utils.GetLerpValue(1f, 0.5f, num2, clamped: true); + Vector2 vector3 = new Vector2((Vector2.One * num5).X * 0.5f, (new Vector2(0f, Utils.Remap(num2, 0f, 1f, 3f, 0f)) * num5).X) * num9; + Vector2 vector2 = new Vector2((Vector2.One * num5).Y * 0.5f, (new Vector2(0f, Utils.Remap(num2, 0f, 1f, 3f, 0f)) * num5).Y) * num9; + shineColor *= num9; + for (float num6 = 0f; num6 < 12f; num6 += 1f) + { + float num7 = Projectile.rotation + Projectile.ai[0] * num6 * -MathHelper.TwoPi * 0.025f + Utils.Remap(num2, 0f, 0.6f, 0f, 0.95504415f) * Projectile.ai[0]; + Vector2 drawpos = vector + num7.ToRotationVector2() * ((float)asset.Width * 0.5f - 6f) * num; + float num8 = num6 / 12f; + + Color color6 = new Color(255, 255, 255, 0) * num3 * num8 * 0.5f; + color6 *= num9; + Main.EntitySpriteDraw(value, drawpos, null, shineColor, MathHelper.PiOver2 + num7, origin2, vector3, SpriteEffects.None); + Main.EntitySpriteDraw(value, drawpos, null, shineColor, 0f + num7, origin2, vector2, SpriteEffects.None); + Main.EntitySpriteDraw(value, drawpos, null, color6, MathHelper.PiOver2 + num7, origin2, vector3 * 0.6f, SpriteEffects.None); + Main.EntitySpriteDraw(value, drawpos, null, color6, 0f + num7, origin2, vector2 * 0.6f, SpriteEffects.None); + } + + Vector2 drawpos2 = vector + (Projectile.rotation + Utils.Remap(num2, 0f, 0.6f, 0f, 0.95504415f) * Projectile.ai[0]).ToRotationVector2() * ((float)asset.Width * 0.5f - 4f) * num; + Color color7 = new Color(255, 255, 255, 0) * num3 * 0.5f; + color7 *= num9; + Main.EntitySpriteDraw(value, drawpos2, null, shineColor, MathHelper.PiOver2 + Projectile.rotation, origin2, vector3, SpriteEffects.None); + Main.EntitySpriteDraw(value, drawpos2, null, shineColor, 0f + Projectile.rotation, origin2, vector2, SpriteEffects.None); + Main.EntitySpriteDraw(value, drawpos2, null, color7, MathHelper.PiOver2 + Projectile.rotation, origin2, vector3 * 0.6f, SpriteEffects.None); + Main.EntitySpriteDraw(value, drawpos2, null, color7, 0f + Projectile.rotation, origin2, vector2 * 0.6f, SpriteEffects.None); + + return false; + } + + public override void CutTiles() + { + Vector2 startPoint = (Projectile.rotation - MathHelper.PiOver4).ToRotationVector2() * 60f * Projectile.scale; + Vector2 endPoint = (Projectile.rotation + MathHelper.PiOver4).ToRotationVector2() * 60f * Projectile.scale; + float projectileSize = 60f * Projectile.scale; + Utils.PlotTileLine(Projectile.Center + startPoint, Projectile.Center + endPoint, projectileSize, DelegateMethods.CutTiles); + } + + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + modifiers.HitDirectionOverride = (Main.player[Projectile.owner].Center.X < target.Center.X) ? 1 : -1; + + Vector2 positionInWorld = Main.rand.NextVector2FromRectangle(target.Hitbox); + ParticleOrchestraSettings particleOrchestraSettings = default(ParticleOrchestraSettings); + particleOrchestraSettings.PositionInWorld = positionInWorld; + ParticleOrchestraSettings settings = particleOrchestraSettings; + switch (Main.rand.Next(5)) + { + default: + case 0: + ParticleOrchestrator.RequestParticleSpawn(clientOnly: false, ParticleOrchestraType.NightsEdge, settings, Projectile.owner); + break; + + case 1: + ParticleOrchestrator.RequestParticleSpawn(clientOnly: false, ParticleOrchestraType.TrueNightsEdge, settings, Projectile.owner); + break; + + case 2: + settings.MovementVector = Projectile.velocity; + ParticleOrchestrator.RequestParticleSpawn(clientOnly: false, ParticleOrchestraType.TerraBlade, settings, Projectile.owner); + break; + + case 3: + ParticleOrchestrator.RequestParticleSpawn(clientOnly: false, ParticleOrchestraType.Excalibur, settings, Projectile.owner); + break; + + case 4: + ParticleOrchestrator.RequestParticleSpawn(clientOnly: false, ParticleOrchestraType.TrueExcalibur, settings, Projectile.owner); + break; + } + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + float coneLength = 94f * Projectile.scale; + float scale = MathHelper.TwoPi / 25f * Projectile.ai[0]; + float maximumAngle = MathHelper.PiOver4; + float coneRotation = Projectile.rotation + scale; + if (targetHitbox.IntersectsConeSlowMoreAccurate(Projectile.Center, coneLength, coneRotation, maximumAngle)) + return true; + + float rotation = Utils.Remap(Projectile.localAI[0], Projectile.ai[1] * 0.3f, Projectile.ai[1] * 0.5f, 1f, 0f); + if (rotation > 0f) + { + float coneRotation2 = coneRotation - MathHelper.PiOver4 * Projectile.ai[0] * rotation; + if (targetHitbox.IntersectsConeSlowMoreAccurate(Projectile.Center, coneLength, coneRotation2, maximumAngle)) + return true; + } + + return false; + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 600); + target.AddBuff(ModContent.BuffType(), 60); + + int heal = (int)Math.Round(hit.Damage * 0.01); + if (heal > BalancingConstants.LifeStealCap) + heal = BalancingConstants.LifeStealCap; + + if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) + return; + + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ModContent.ProjectileType(), BalancingConstants.LifeStealRange); + } + + public override void OnHitPlayer(Player target, Player.HurtInfo info) + { + target.AddBuff(ModContent.BuffType(), 600); + target.AddBuff(ModContent.BuffType(), 60); + + int heal = (int)Math.Round(info.Damage * 0.01); + if (heal > BalancingConstants.LifeStealCap) + heal = BalancingConstants.LifeStealCap; + + if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0) + return; + + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ModContent.ProjectileType(), BalancingConstants.LifeStealRange); + } + } +} diff --git a/Projectiles/Melee/IridescentExcaliburSlash.png b/Projectiles/Melee/IridescentExcaliburSlash.png new file mode 100644 index 0000000000..9a31d6718a Binary files /dev/null and b/Projectiles/Melee/IridescentExcaliburSlash.png differ diff --git a/Projectiles/Melee/IridescentExcaliburSlash2.cs b/Projectiles/Melee/IridescentExcaliburSlash2.cs new file mode 100644 index 0000000000..fcdacfc7d9 --- /dev/null +++ b/Projectiles/Melee/IridescentExcaliburSlash2.cs @@ -0,0 +1,231 @@ +using System.Collections.Generic; +using CalamityMod.Graphics.Primitives; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.GameContent; +using Terraria.GameContent.Drawing; +using Terraria.Graphics.Shaders; +using Terraria.ModLoader; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; + +namespace CalamityMod.Projectiles.Melee +{ + public class IridescentExcaliburSlash2 : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + public override string Texture => "CalamityMod/Projectiles/Melee/IridescentExcaliburSlash"; + + public override void SetStaticDefaults() + { + Main.projFrames[Projectile.type] = 4; + } + + public override void SetDefaults() + { + Projectile.width = 16; + Projectile.height = 16; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.ownerHitCheck = true; + Projectile.ownerHitCheckDistance = 300f; + Projectile.usesOwnerMeleeHitCD = true; + Projectile.stopsDealingDamageAfterPenetrateHits = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = 3; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + + public override void AI() + { + Projectile.localAI[0] += 1f; + Player player = Main.player[Projectile.owner]; + float num = Projectile.localAI[0] / Projectile.ai[1]; + float num2 = Projectile.ai[0]; + float num3 = Projectile.velocity.ToRotation(); + float num4 = (float)Math.PI * num2 * num + num3 + num2 * (float)Math.PI + player.fullRotation; + Projectile.rotation = num4; + float num5 = 0.8f; + float num6 = 1.1f; + + Projectile.Center = player.RotatedRelativePoint(player.MountedCenter) - Projectile.velocity; + Projectile.scale = num6 + num * num5; + + float colorAIScale = Projectile.localAI[0] / Projectile.ai[1]; + float amount = Utils.Remap(colorAIScale, 0f, 0.6f, 0f, 1f) * Utils.Remap(colorAIScale, 0.6f, 1f, 1f, 0f); + Color rainbow = Color.Lerp(new Color(255 - Main.DiscoR, 255 - Main.DiscoG, 255 - Main.DiscoB), new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), amount); + float num8 = Projectile.rotation + Main.rand.NextFloatDirection() * MathHelper.PiOver2 * 0.7f; + Vector2 vector2 = Projectile.Center + num8.ToRotationVector2() * 84f * Projectile.scale; + Vector2 vector3 = (num8 + Projectile.ai[0] * MathHelper.PiOver2).ToRotationVector2(); + if (Main.rand.NextFloat() * 2f < Projectile.Opacity) + { + Dust dust2 = Dust.NewDustPerfect(Projectile.Center + num8.ToRotationVector2() * (Main.rand.NextFloat() * 80f * Projectile.scale + 20f * Projectile.scale), 278, vector3 * 1f, 100, rainbow, 0.4f); + dust2.fadeIn = 0.4f + Main.rand.NextFloat() * 0.15f; + dust2.noGravity = true; + } + + if (Main.rand.NextFloat() * 1.5f < Projectile.Opacity) + Dust.NewDustPerfect(vector2, 43, vector3 * 1f, 100, rainbow * Projectile.Opacity, 1.2f * Projectile.Opacity); + + float num10 = Projectile.rotation + Main.rand.NextFloatDirection() * MathHelper.PiOver2 * 0.7f; + Vector2 vector5 = Projectile.Center + num10.ToRotationVector2() * 84f * Projectile.scale; + Vector2 vector6 = (num10 + Projectile.ai[0] * MathHelper.PiOver2).ToRotationVector2(); + if (Main.rand.NextFloat() < Projectile.Opacity) + { + Dust dust4 = Dust.NewDustPerfect(Projectile.Center + num10.ToRotationVector2() * (Main.rand.NextFloat() * 80f * Projectile.scale + 20f * Projectile.scale), 278, vector6 * 1f, 100, rainbow, 0.4f); + dust4.fadeIn = 0.4f + Main.rand.NextFloat() * 0.15f; + dust4.noGravity = true; + } + + if (Main.rand.NextFloat() * 1.5f < Projectile.Opacity) + Dust.NewDustPerfect(vector5, 43, vector6 * 1f, 100, rainbow * Projectile.Opacity, 1.2f * Projectile.Opacity); + + Projectile.scale *= Projectile.ai[2]; + if (Projectile.localAI[0] >= Projectile.ai[1]) + Projectile.Kill(); + + // Enchantment visual bullshit + Vector2 boxPosition = Projectile.position; + int boxWidth = Projectile.width; + int boxHeight = Projectile.height; + for (float i = -MathHelper.PiOver4; i <= MathHelper.PiOver4; i += MathHelper.PiOver2) + { + Rectangle rect = Utils.CenteredRectangle(Projectile.Center + (Projectile.rotation + i).ToRotationVector2() * 70f * Projectile.scale, new Vector2(60f * Projectile.scale, 60f * Projectile.scale)); + Projectile.EmitEnchantmentVisualsAt(rect.TopLeft(), rect.Width, rect.Height); + } + } + + public override bool PreDraw(ref Color lightColor) + { + Vector2 vector = Projectile.Center - Main.screenPosition; + Texture2D asset = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Rectangle rectangle = asset.Frame(1, 4); + Vector2 origin = rectangle.Size() / 2f; + float num = Projectile.scale * 1.1f; + SpriteEffects effects = ((!(Projectile.ai[0] >= 0f)) ? SpriteEffects.FlipVertically : SpriteEffects.None); + float num2 = Projectile.localAI[0] / Projectile.ai[1]; + float num3 = Utils.Remap(num2, 0f, 0.6f, 0f, 1f) * Utils.Remap(num2, 0.6f, 1f, 1f, 0f); + float num4 = 0.975f; + float amount = num3; + float fromValue = Lighting.GetColor(Projectile.Center.ToTileCoordinates()).ToVector3().Length() / (float)Math.Sqrt(3D); + fromValue = Utils.Remap(fromValue, 0.2f, 1f, 0f, 1f); + Color color = Color.Lerp(new Color(255 - Main.DiscoR, 255 - Main.DiscoG, 255 - Main.DiscoB), new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), amount); + Main.spriteBatch.Draw(asset, vector, rectangle, color * fromValue * num3, Projectile.rotation + Projectile.ai[0] * MathHelper.PiOver4 * -1f * (1f - num2), origin, num, effects, 0f); + Color color2 = Color.Lerp(new Color(255 - Main.DiscoR, 255 - Main.DiscoG, 255 - Main.DiscoB), new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), amount); + Color color3 = Color.Lerp(new Color(255 - Main.DiscoR, 255 - Main.DiscoG, 255 - Main.DiscoB), new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), amount); + Color color4 = new Color(255 - Main.DiscoR, 255 - Main.DiscoG, 255 - Main.DiscoB) * num3 * 0.5f; + color4.A = (byte)(((float)(int)color4.A * (1f - fromValue)) * 0.5f); + Color color5 = color4 * fromValue * 0.5f; + Main.spriteBatch.Draw(asset, vector, rectangle, color5 * 0.15f, Projectile.rotation + Projectile.ai[0] * 0.01f, origin, num, effects, 0f); + Main.spriteBatch.Draw(asset, vector, rectangle, color3 * fromValue * num3 * 0.3f, Projectile.rotation, origin, num, effects, 0f); + Main.spriteBatch.Draw(asset, vector, rectangle, color2 * fromValue * num3 * 0.5f, Projectile.rotation, origin, num * num4, effects, 0f); + Main.spriteBatch.Draw(asset, vector, asset.Frame(1, 4, 0, 3), new Color(255 - Main.DiscoR, 255 - Main.DiscoG, 255 - Main.DiscoB) * 0.6f * num3, Projectile.rotation + Projectile.ai[0] * 0.01f, origin, num, effects, 0f); + Main.spriteBatch.Draw(asset, vector, asset.Frame(1, 4, 0, 3), new Color(255 - Main.DiscoR, 255 - Main.DiscoG, 255 - Main.DiscoB) * 0.5f * num3, Projectile.rotation + Projectile.ai[0] * -0.05f, origin, num * 0.8f, effects, 0f); + Main.spriteBatch.Draw(asset, vector, asset.Frame(1, 4, 0, 3), new Color(255 - Main.DiscoR, 255 - Main.DiscoG, 255 - Main.DiscoB) * 0.4f * num3, Projectile.rotation + Projectile.ai[0] * -0.1f, origin, num * 0.6f, effects, 0f); + float num5 = num * 0.75f; + Texture2D value = TextureAssets.Extra[98].Value; + Color shineColor = color3 * Projectile.Opacity * 0.5f; + shineColor.A /= 2; + Vector2 origin2 = value.Size() / 2f; + float num9 = Utils.GetLerpValue(0f, 0.5f, num2, clamped: true) * Utils.GetLerpValue(1f, 0.5f, num2, clamped: true); + Vector2 vector3 = new Vector2((Vector2.One * num5).X * 0.5f, (new Vector2(0f, Utils.Remap(num2, 0f, 1f, 3f, 0f)) * num5).X) * num9; + Vector2 vector2 = new Vector2((Vector2.One * num5).Y * 0.5f, (new Vector2(0f, Utils.Remap(num2, 0f, 1f, 3f, 0f)) * num5).Y) * num9; + shineColor *= num9; + for (float num6 = 0f; num6 < 12f; num6 += 1f) + { + float num7 = Projectile.rotation + Projectile.ai[0] * num6 * -MathHelper.TwoPi * 0.025f + Utils.Remap(num2, 0f, 0.6f, 0f, 0.95504415f) * Projectile.ai[0]; + Vector2 drawpos = vector + num7.ToRotationVector2() * ((float)asset.Width * 0.5f - 6f) * num; + float num8 = num6 / 12f; + + Color color6 = new Color(255, 255, 255, 0) * num3 * num8 * 0.5f; + color6 *= num9; + Main.EntitySpriteDraw(value, drawpos, null, shineColor, MathHelper.PiOver2 + num7, origin2, vector3, SpriteEffects.None); + Main.EntitySpriteDraw(value, drawpos, null, shineColor, 0f + num7, origin2, vector2, SpriteEffects.None); + Main.EntitySpriteDraw(value, drawpos, null, color6, MathHelper.PiOver2 + num7, origin2, vector3 * 0.6f, SpriteEffects.None); + Main.EntitySpriteDraw(value, drawpos, null, color6, 0f + num7, origin2, vector2 * 0.6f, SpriteEffects.None); + } + + Vector2 drawpos2 = vector + (Projectile.rotation + Utils.Remap(num2, 0f, 0.6f, 0f, 0.95504415f) * Projectile.ai[0]).ToRotationVector2() * ((float)asset.Width * 0.5f - 4f) * num; + Color color7 = new Color(255, 255, 255, 0) * num3 * 0.5f; + color7 *= num9; + Main.EntitySpriteDraw(value, drawpos2, null, shineColor, MathHelper.PiOver2 + Projectile.rotation, origin2, vector3, SpriteEffects.None); + Main.EntitySpriteDraw(value, drawpos2, null, shineColor, 0f + Projectile.rotation, origin2, vector2, SpriteEffects.None); + Main.EntitySpriteDraw(value, drawpos2, null, color7, MathHelper.PiOver2 + Projectile.rotation, origin2, vector3 * 0.6f, SpriteEffects.None); + Main.EntitySpriteDraw(value, drawpos2, null, color7, 0f + Projectile.rotation, origin2, vector2 * 0.6f, SpriteEffects.None); + + return false; + } + + public override void CutTiles() + { + Vector2 startPoint = (Projectile.rotation - MathHelper.PiOver4).ToRotationVector2() * 60f * Projectile.scale; + Vector2 endPoint = (Projectile.rotation + MathHelper.PiOver4).ToRotationVector2() * 60f * Projectile.scale; + float projectileSize = 60f * Projectile.scale; + Utils.PlotTileLine(Projectile.Center + startPoint, Projectile.Center + endPoint, projectileSize, DelegateMethods.CutTiles); + } + + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + modifiers.HitDirectionOverride = (Main.player[Projectile.owner].Center.X < target.Center.X) ? 1 : -1; + + Vector2 positionInWorld = Main.rand.NextVector2FromRectangle(target.Hitbox); + ParticleOrchestraSettings particleOrchestraSettings = default(ParticleOrchestraSettings); + particleOrchestraSettings.PositionInWorld = positionInWorld; + ParticleOrchestraSettings settings = particleOrchestraSettings; + switch (Main.rand.Next(5)) + { + default: + case 0: + ParticleOrchestrator.RequestParticleSpawn(clientOnly: false, ParticleOrchestraType.NightsEdge, settings, Projectile.owner); + break; + + case 1: + ParticleOrchestrator.RequestParticleSpawn(clientOnly: false, ParticleOrchestraType.TrueNightsEdge, settings, Projectile.owner); + break; + + case 2: + settings.MovementVector = Projectile.velocity; + ParticleOrchestrator.RequestParticleSpawn(clientOnly: false, ParticleOrchestraType.TerraBlade, settings, Projectile.owner); + break; + + case 3: + ParticleOrchestrator.RequestParticleSpawn(clientOnly: false, ParticleOrchestraType.Excalibur, settings, Projectile.owner); + break; + + case 4: + ParticleOrchestrator.RequestParticleSpawn(clientOnly: false, ParticleOrchestraType.TrueExcalibur, settings, Projectile.owner); + break; + } + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + float coneLength = 94f * Projectile.scale; + float scale = MathHelper.TwoPi / 25f * Projectile.ai[0]; + float maximumAngle = MathHelper.PiOver4; + float coneRotation = Projectile.rotation + scale; + if (targetHitbox.IntersectsConeSlowMoreAccurate(Projectile.Center, coneLength, coneRotation, maximumAngle)) + return true; + + float rotation = Utils.Remap(Projectile.localAI[0], Projectile.ai[1] * 0.3f, Projectile.ai[1] * 0.5f, 1f, 0f); + if (rotation > 0f) + { + float coneRotation2 = coneRotation - MathHelper.PiOver4 * Projectile.ai[0] * rotation; + if (targetHitbox.IntersectsConeSlowMoreAccurate(Projectile.Center, coneLength, coneRotation2, maximumAngle)) + return true; + } + + return false; + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 600); + target.AddBuff(ModContent.BuffType(), 60); + } + } +} diff --git a/Projectiles/Melee/IridescentExcaliburSlash3.cs b/Projectiles/Melee/IridescentExcaliburSlash3.cs new file mode 100644 index 0000000000..73ac9b7231 --- /dev/null +++ b/Projectiles/Melee/IridescentExcaliburSlash3.cs @@ -0,0 +1,238 @@ +using System.Collections.Generic; +using CalamityMod.Graphics.Primitives; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.GameContent; +using Terraria.GameContent.Drawing; +using Terraria.Graphics.Shaders; +using Terraria.ModLoader; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; + +namespace CalamityMod.Projectiles.Melee +{ + public class IridescentExcaliburSlash3 : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + public override string Texture => "CalamityMod/Projectiles/Melee/IridescentExcaliburSlash"; + + public override void SetStaticDefaults() + { + Main.projFrames[Projectile.type] = 4; + } + + public override void SetDefaults() + { + Projectile.width = 16; + Projectile.height = 16; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.ownerHitCheck = true; + Projectile.ownerHitCheckDistance = 300f; + Projectile.usesOwnerMeleeHitCD = true; + Projectile.stopsDealingDamageAfterPenetrateHits = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = 3; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + + public override void AI() + { + Projectile.localAI[0] += 1f; + Player player = Main.player[Projectile.owner]; + float num = Projectile.localAI[0] / Projectile.ai[1]; + float num2 = Projectile.ai[0]; + float num3 = Projectile.velocity.ToRotation(); + float num4 = (float)Math.PI * num2 * num + num3 + num2 * (float)Math.PI + player.fullRotation; + Projectile.rotation = num4; + float num5 = 0.6f; + float num6 = 1f; + + Projectile.Center = player.RotatedRelativePoint(player.MountedCenter) - Projectile.velocity; + Projectile.scale = num6 + num * num5; + + float colorAIScale = Projectile.localAI[0] / Projectile.ai[1]; + float amount = Utils.Remap(colorAIScale, 0f, 0.6f, 0f, 1f) * Utils.Remap(colorAIScale, 0.6f, 1f, 1f, 0f); + Color rainbow = Color.Lerp(new Color(255 - (Math.Abs(128 - Main.DiscoR) * 2 - 1), 255 - (Math.Abs(128 - Main.DiscoG) * 2 - 1), 255 - (Math.Abs(128 - Main.DiscoB) * 2 - 1)), + new Color(Math.Abs(128 - Main.DiscoR) * 2 - 1, Math.Abs(128 - Main.DiscoG) * 2 - 1, Math.Abs(128 - Main.DiscoB) * 2 - 1), amount); + + float num8 = Projectile.rotation + Main.rand.NextFloatDirection() * MathHelper.PiOver2 * 0.7f; + Vector2 vector2 = Projectile.Center + num8.ToRotationVector2() * 84f * Projectile.scale; + Vector2 vector3 = (num8 + Projectile.ai[0] * MathHelper.PiOver2).ToRotationVector2(); + if (Main.rand.NextFloat() * 2f < Projectile.Opacity) + { + Dust dust2 = Dust.NewDustPerfect(Projectile.Center + num8.ToRotationVector2() * (Main.rand.NextFloat() * 80f * Projectile.scale + 20f * Projectile.scale), 278, vector3 * 1f, 100, rainbow, 0.4f); + dust2.fadeIn = 0.4f + Main.rand.NextFloat() * 0.15f; + dust2.noGravity = true; + } + + if (Main.rand.NextFloat() * 1.5f < Projectile.Opacity) + Dust.NewDustPerfect(vector2, 43, vector3 * 1f, 100, rainbow * Projectile.Opacity, 1.2f * Projectile.Opacity); + + float num10 = Projectile.rotation + Main.rand.NextFloatDirection() * MathHelper.PiOver2 * 0.7f; + Vector2 vector5 = Projectile.Center + num10.ToRotationVector2() * 84f * Projectile.scale; + Vector2 vector6 = (num10 + Projectile.ai[0] * MathHelper.PiOver2).ToRotationVector2(); + if (Main.rand.NextFloat() < Projectile.Opacity) + { + Dust dust4 = Dust.NewDustPerfect(Projectile.Center + num10.ToRotationVector2() * (Main.rand.NextFloat() * 80f * Projectile.scale + 20f * Projectile.scale), 278, vector6 * 1f, 100, rainbow, 0.4f); + dust4.fadeIn = 0.4f + Main.rand.NextFloat() * 0.15f; + dust4.noGravity = true; + } + + if (Main.rand.NextFloat() * 1.5f < Projectile.Opacity) + Dust.NewDustPerfect(vector5, 43, vector6 * 1f, 100, rainbow * Projectile.Opacity, 1.2f * Projectile.Opacity); + + Projectile.scale *= Projectile.ai[2]; + if (Projectile.localAI[0] >= Projectile.ai[1]) + Projectile.Kill(); + + // Enchantment visual bullshit + Vector2 boxPosition = Projectile.position; + int boxWidth = Projectile.width; + int boxHeight = Projectile.height; + for (float i = -MathHelper.PiOver4; i <= MathHelper.PiOver4; i += MathHelper.PiOver2) + { + Rectangle rect = Utils.CenteredRectangle(Projectile.Center + (Projectile.rotation + i).ToRotationVector2() * 70f * Projectile.scale, new Vector2(60f * Projectile.scale, 60f * Projectile.scale)); + Projectile.EmitEnchantmentVisualsAt(rect.TopLeft(), rect.Width, rect.Height); + } + } + + public override bool PreDraw(ref Color lightColor) + { + Vector2 vector = Projectile.Center - Main.screenPosition; + Texture2D asset = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Rectangle rectangle = asset.Frame(1, 4); + Vector2 origin = rectangle.Size() / 2f; + float num = Projectile.scale * 1.1f; + SpriteEffects effects = ((!(Projectile.ai[0] >= 0f)) ? SpriteEffects.FlipVertically : SpriteEffects.None); + float num2 = Projectile.localAI[0] / Projectile.ai[1]; + float num3 = Utils.Remap(num2, 0f, 0.6f, 0f, 1f) * Utils.Remap(num2, 0.6f, 1f, 1f, 0f); + float num4 = 0.975f; + float amount = num3; + float fromValue = Lighting.GetColor(Projectile.Center.ToTileCoordinates()).ToVector3().Length() / (float)Math.Sqrt(3D); + fromValue = Utils.Remap(fromValue, 0.2f, 1f, 0f, 1f); + + Color color = Color.Lerp(new Color(255 - (Math.Abs(128 - Main.DiscoR) * 2 - 1), 255 - (Math.Abs(128 - Main.DiscoG) * 2 - 1), 255 - (Math.Abs(128 - Main.DiscoB) * 2 - 1)), + new Color(Math.Abs(128 - Main.DiscoR) * 2 - 1, Math.Abs(128 - Main.DiscoG) * 2 - 1, Math.Abs(128 - Main.DiscoB) * 2 - 1), amount); + Main.spriteBatch.Draw(asset, vector, rectangle, color * fromValue * num3, Projectile.rotation + Projectile.ai[0] * MathHelper.PiOver4 * -1f * (1f - num2), origin, num, effects, 0f); + Color color2 = Color.Lerp(new Color(255 - (Math.Abs(128 - Main.DiscoR) * 2 - 1), 255 - (Math.Abs(128 - Main.DiscoG) * 2 - 1), 255 - (Math.Abs(128 - Main.DiscoB) * 2 - 1)), + new Color(Math.Abs(128 - Main.DiscoR) * 2 - 1, Math.Abs(128 - Main.DiscoG) * 2 - 1, Math.Abs(128 - Main.DiscoB) * 2 - 1), amount); + Color color3 = Color.Lerp(new Color(255 - (Math.Abs(128 - Main.DiscoR) * 2 - 1), 255 - (Math.Abs(128 - Main.DiscoG) * 2 - 1), 255 - (Math.Abs(128 - Main.DiscoB) * 2 - 1)), + new Color(Math.Abs(128 - Main.DiscoR) * 2 - 1, Math.Abs(128 - Main.DiscoG) * 2 - 1, Math.Abs(128 - Main.DiscoB) * 2 - 1), amount); + + Color color4 = new Color(Math.Abs(128 - Main.DiscoR) * 2 - 1, Math.Abs(128 - Main.DiscoG) * 2 - 1, Math.Abs(128 - Main.DiscoB) * 2 - 1) * num3 * 0.5f; + color4.A = (byte)((float)(int)color4.A * (1f - fromValue)); + Color color5 = color4 * fromValue * 0.5f; + Main.spriteBatch.Draw(asset, vector, rectangle, color5 * 0.15f, Projectile.rotation + Projectile.ai[0] * 0.01f, origin, num, effects, 0f); + Main.spriteBatch.Draw(asset, vector, rectangle, color3 * fromValue * num3 * 0.3f, Projectile.rotation, origin, num, effects, 0f); + Main.spriteBatch.Draw(asset, vector, rectangle, color2 * fromValue * num3 * 0.5f, Projectile.rotation, origin, num * num4, effects, 0f); + Main.spriteBatch.Draw(asset, vector, asset.Frame(1, 4, 0, 3), new Color(Math.Abs(128 - Main.DiscoR) * 2 - 1, Math.Abs(128 - Main.DiscoG) * 2 - 1, Math.Abs(128 - Main.DiscoB) * 2 - 1) * 0.6f * num3, Projectile.rotation + Projectile.ai[0] * 0.01f, origin, num, effects, 0f); + Main.spriteBatch.Draw(asset, vector, asset.Frame(1, 4, 0, 3), new Color(Math.Abs(128 - Main.DiscoR) * 2 - 1, Math.Abs(128 - Main.DiscoG) * 2 - 1, Math.Abs(128 - Main.DiscoB) * 2 - 1) * 0.5f * num3, Projectile.rotation + Projectile.ai[0] * -0.05f, origin, num * 0.8f, effects, 0f); + Main.spriteBatch.Draw(asset, vector, asset.Frame(1, 4, 0, 3), new Color(Math.Abs(128 - Main.DiscoR) * 2 - 1, Math.Abs(128 - Main.DiscoG) * 2 - 1, Math.Abs(128 - Main.DiscoB) * 2 - 1) * 0.4f * num3, Projectile.rotation + Projectile.ai[0] * -0.1f, origin, num * 0.6f, effects, 0f); + float num5 = num * 0.75f; + Texture2D value = TextureAssets.Extra[98].Value; + Color shineColor = color3 * Projectile.Opacity * 0.5f; + shineColor.A = 0; + Vector2 origin2 = value.Size() / 2f; + float num9 = Utils.GetLerpValue(0f, 0.5f, num2, clamped: true) * Utils.GetLerpValue(1f, 0.5f, num2, clamped: true); + Vector2 vector3 = new Vector2((Vector2.One * num5).X * 0.5f, (new Vector2(0f, Utils.Remap(num2, 0f, 1f, 3f, 0f)) * num5).X) * num9; + Vector2 vector2 = new Vector2((Vector2.One * num5).Y * 0.5f, (new Vector2(0f, Utils.Remap(num2, 0f, 1f, 3f, 0f)) * num5).Y) * num9; + shineColor *= num9; + for (float num6 = 0f; num6 < 12f; num6 += 1f) + { + float num7 = Projectile.rotation + Projectile.ai[0] * num6 * -MathHelper.TwoPi * 0.025f + Utils.Remap(num2, 0f, 0.6f, 0f, 0.95504415f) * Projectile.ai[0]; + Vector2 drawpos = vector + num7.ToRotationVector2() * ((float)asset.Width * 0.5f - 6f) * num; + float num8 = num6 / 12f; + + Color color6 = new Color(255, 255, 255, 0) * num3 * num8 * 0.5f; + color6 *= num9; + Main.EntitySpriteDraw(value, drawpos, null, shineColor, MathHelper.PiOver2 + num7, origin2, vector3, SpriteEffects.None); + Main.EntitySpriteDraw(value, drawpos, null, shineColor, 0f + num7, origin2, vector2, SpriteEffects.None); + Main.EntitySpriteDraw(value, drawpos, null, color6, MathHelper.PiOver2 + num7, origin2, vector3 * 0.6f, SpriteEffects.None); + Main.EntitySpriteDraw(value, drawpos, null, color6, 0f + num7, origin2, vector2 * 0.6f, SpriteEffects.None); + } + + Vector2 drawpos2 = vector + (Projectile.rotation + Utils.Remap(num2, 0f, 0.6f, 0f, 0.95504415f) * Projectile.ai[0]).ToRotationVector2() * ((float)asset.Width * 0.5f - 4f) * num; + Color color7 = new Color(255, 255, 255, 0) * num3 * 0.5f; + color7 *= num9; + Main.EntitySpriteDraw(value, drawpos2, null, shineColor, MathHelper.PiOver2 + Projectile.rotation, origin2, vector3, SpriteEffects.None); + Main.EntitySpriteDraw(value, drawpos2, null, shineColor, 0f + Projectile.rotation, origin2, vector2, SpriteEffects.None); + Main.EntitySpriteDraw(value, drawpos2, null, color7, MathHelper.PiOver2 + Projectile.rotation, origin2, vector3 * 0.6f, SpriteEffects.None); + Main.EntitySpriteDraw(value, drawpos2, null, color7, 0f + Projectile.rotation, origin2, vector2 * 0.6f, SpriteEffects.None); + + return false; + } + + public override void CutTiles() + { + Vector2 startPoint = (Projectile.rotation - MathHelper.PiOver4).ToRotationVector2() * 60f * Projectile.scale; + Vector2 endPoint = (Projectile.rotation + MathHelper.PiOver4).ToRotationVector2() * 60f * Projectile.scale; + float projectileSize = 60f * Projectile.scale; + Utils.PlotTileLine(Projectile.Center + startPoint, Projectile.Center + endPoint, projectileSize, DelegateMethods.CutTiles); + } + + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + modifiers.HitDirectionOverride = (Main.player[Projectile.owner].Center.X < target.Center.X) ? 1 : -1; + + Vector2 positionInWorld = Main.rand.NextVector2FromRectangle(target.Hitbox); + ParticleOrchestraSettings particleOrchestraSettings = default(ParticleOrchestraSettings); + particleOrchestraSettings.PositionInWorld = positionInWorld; + ParticleOrchestraSettings settings = particleOrchestraSettings; + switch (Main.rand.Next(5)) + { + default: + case 0: + ParticleOrchestrator.RequestParticleSpawn(clientOnly: false, ParticleOrchestraType.NightsEdge, settings, Projectile.owner); + break; + + case 1: + ParticleOrchestrator.RequestParticleSpawn(clientOnly: false, ParticleOrchestraType.TrueNightsEdge, settings, Projectile.owner); + break; + + case 2: + settings.MovementVector = Projectile.velocity; + ParticleOrchestrator.RequestParticleSpawn(clientOnly: false, ParticleOrchestraType.TerraBlade, settings, Projectile.owner); + break; + + case 3: + ParticleOrchestrator.RequestParticleSpawn(clientOnly: false, ParticleOrchestraType.Excalibur, settings, Projectile.owner); + break; + + case 4: + ParticleOrchestrator.RequestParticleSpawn(clientOnly: false, ParticleOrchestraType.TrueExcalibur, settings, Projectile.owner); + break; + } + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + float coneLength = 94f * Projectile.scale; + float scale = MathHelper.TwoPi / 25f * Projectile.ai[0]; + float maximumAngle = MathHelper.PiOver4; + float coneRotation = Projectile.rotation + scale; + if (targetHitbox.IntersectsConeSlowMoreAccurate(Projectile.Center, coneLength, coneRotation, maximumAngle)) + return true; + + float rotation = Utils.Remap(Projectile.localAI[0], Projectile.ai[1] * 0.3f, Projectile.ai[1] * 0.5f, 1f, 0f); + if (rotation > 0f) + { + float coneRotation2 = coneRotation - MathHelper.PiOver4 * Projectile.ai[0] * rotation; + if (targetHitbox.IntersectsConeSlowMoreAccurate(Projectile.Center, coneLength, coneRotation2, maximumAngle)) + return true; + } + + return false; + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 600); + target.AddBuff(ModContent.BuffType(), 60); + } + } +} diff --git a/Projectiles/Melee/JudgementProj.cs b/Projectiles/Melee/JudgementProj.cs index b20d1aa80f..49de81f947 100644 --- a/Projectiles/Melee/JudgementProj.cs +++ b/Projectiles/Melee/JudgementProj.cs @@ -1,9 +1,9 @@ +using System; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { public class JudgementProj : ModProjectile, ILocalizedModType @@ -22,6 +22,8 @@ namespace CalamityMod.Projectiles.Melee Projectile.penetrate = -1; Projectile.timeLeft = 60; Projectile.DamageType = DamageClass.Melee; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() @@ -54,7 +56,7 @@ namespace CalamityMod.Projectiles.Melee for (int i = 0; i < 2; i++) { - int shinyDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 91, 0f, 0f, 100, default, 1.25f); + int shinyDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GemDiamond, 0f, 0f, 100, default, 1.25f); Main.dust[shinyDust].noGravity = true; Main.dust[shinyDust].velocity *= 0.5f; Main.dust[shinyDust].velocity += Projectile.velocity * 0.1f; diff --git a/Projectiles/Melee/LifeScythe.cs b/Projectiles/Melee/LifeScythe.cs index 6fb0490f00..369ffaea81 100644 --- a/Projectiles/Melee/LifeScythe.cs +++ b/Projectiles/Melee/LifeScythe.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Projectiles/Melee/LightBeam.cs b/Projectiles/Melee/LightBeam.cs index eb36e4cf2d..7cda4ee00d 100644 --- a/Projectiles/Melee/LightBeam.cs +++ b/Projectiles/Melee/LightBeam.cs @@ -1,5 +1,7 @@ +using CalamityMod.Items.Weapons.Melee; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -8,6 +10,17 @@ namespace CalamityMod.Projectiles.Melee public class LightBeam : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; + + public Player Owner => Main.player[Projectile.owner]; + + private const float MaxVelocity = DarklightGreatsword.ShootSpeed * 12f; + + private const int FadeOutTime = 85; + + private const int TimeLeft = 215 + FadeOutTime; + + private const int Alpha = 100; + public override void SetStaticDefaults() { ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; @@ -16,33 +29,52 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - Projectile.width = 74; - Projectile.height = 74; - Projectile.aiStyle = ProjAIStyleID.Sickle; - AIType = ProjectileID.DeathSickle; + Projectile.width = 36; + Projectile.height = 36; Projectile.friendly = true; + Projectile.ignoreWater = true; Projectile.DamageType = DamageClass.Melee; - Projectile.penetrate = 1; - Projectile.timeLeft = 300; + Projectile.penetrate = -1; // Actually only hits three times, set to infinite so the fade out works still + Projectile.timeLeft = TimeLeft; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 24; + Projectile.alpha = Alpha; } public override void AI() { - Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.6f / 255f, 0f, (255 - Projectile.alpha) * 0.2f / 255f); + float alphaLightScale = Projectile.alpha / (float)Alpha; + Lighting.AddLight(Projectile.Center, 1.2f * alphaLightScale, 0f, 0.4f * alphaLightScale); - if (Projectile.velocity.Length() < 18f) - Projectile.velocity *= 1.1f; + if (Projectile.timeLeft > FadeOutTime) + { + if (Projectile.velocity.Length() < MaxVelocity) + Projectile.velocity *= 1.055f; + } + else + Projectile.velocity *= 0.925f; + + if (Projectile.velocity.X < 0f) + Projectile.spriteDirection = -1; + + Projectile.rotation += Projectile.direction * 0.05f; + if (Projectile.timeLeft > FadeOutTime) + Projectile.rotation += Projectile.direction * 0.5f; + else + Projectile.rotation += Projectile.direction * 0.5f * (Projectile.timeLeft / (float)FadeOutTime); } public override Color? GetAlpha(Color lightColor) { - if (Projectile.timeLeft < 85) + if (Projectile.timeLeft < FadeOutTime) { byte b2 = (byte)(Projectile.timeLeft * 3); - byte a2 = (byte)(100f * (b2 / 255f)); - return new Color(b2, b2, b2, a2); + byte a2 = (byte)(Alpha * ((float)b2 / byte.MaxValue)); + Projectile.alpha = a2; + return new Color(b2, b2, b2, Projectile.alpha); } - return new Color(255, 255, 255, 100); + Projectile.alpha = Alpha; + return new Color(byte.MaxValue, byte.MaxValue, byte.MaxValue, Projectile.alpha); } public override bool PreDraw(ref Color lightColor) @@ -51,27 +83,36 @@ namespace CalamityMod.Projectiles.Melee return false; } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + public override bool OnTileCollide(Vector2 oldVelocity) { - target.AddBuff(BuffID.OnFire, 240); + if (Projectile.timeLeft > FadeOutTime) + { + Projectile.velocity = Projectile.oldVelocity; + Projectile.tileCollide = false; + Projectile.timeLeft = FadeOutTime; + } + + return false; } - public override void OnKill(int timeLeft) + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - for (int i = 0; i < 20; i++) + target.AddBuff(BuffID.OnFire3, 120); + if (Projectile.numHits >= 2) // Fades out after the third hit + Projectile.timeLeft = FadeOutTime; + + int slashCreatorID = ModContent.ProjectileType(); + int damage = (int)(Projectile.damage * DarklightGreatsword.SlashProjectileDamageMultiplier); + float knockback = Projectile.knockBack * DarklightGreatsword.SlashProjectileDamageMultiplier; + if (Owner.ownedProjectileCounts[slashCreatorID] < DarklightGreatsword.SlashProjectileLimit) { - int pinkish = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 73, 0f, 0f, 0, default, 1f); - Main.dust[pinkish].noGravity = true; - Main.dust[pinkish].velocity += Projectile.velocity * 0.1f; - } - if (Projectile.owner == Main.myPlayer) - { - for (int k = 0; k < 3; k++) - { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, Main.rand.Next(-35, 36) * 0.2f, Main.rand.Next(-35, 36) * 0.2f, ModContent.ProjectileType(), - (int)(Projectile.damage * 0.5), Projectile.knockBack * 0.15f, Main.myPlayer, 1f, 0f); - } + Projectile.NewProjectile(Projectile.GetSource_FromThis(), target.Center, Vector2.Zero, slashCreatorID, damage, knockback, Projectile.owner, target.whoAmI, Projectile.rotation, 1f); + Owner.ownedProjectileCounts[slashCreatorID]++; } } + + public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(BuffID.OnFire3, 120); + + public override bool? CanDamage() => Projectile.timeLeft < FadeOutTime ? false : null; } } diff --git a/Projectiles/Melee/LightningThing.cs b/Projectiles/Melee/LightningThing.cs index a8449ef96d..0ae379ba4a 100644 --- a/Projectiles/Melee/LightningThing.cs +++ b/Projectiles/Melee/LightningThing.cs @@ -1,8 +1,8 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Items.Weapons.Melee; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Items.Weapons.Melee; namespace CalamityMod.Projectiles.Melee { public class LightningThing : ModProjectile, ILocalizedModType diff --git a/Projectiles/Melee/LuxorsGiftMelee.cs b/Projectiles/Melee/LuxorsGiftMelee.cs index 3068ea8f1a..6e7647375e 100644 --- a/Projectiles/Melee/LuxorsGiftMelee.cs +++ b/Projectiles/Melee/LuxorsGiftMelee.cs @@ -1,9 +1,9 @@ -using CalamityMod.Dusts; +using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { diff --git a/Projectiles/Melee/LuxorsGiftMelee.png b/Projectiles/Melee/LuxorsGiftMelee.png index ebc25190b1..7fc8375ae3 100644 Binary files a/Projectiles/Melee/LuxorsGiftMelee.png and b/Projectiles/Melee/LuxorsGiftMelee.png differ diff --git a/Projectiles/Melee/MarniteDeconstructorProj.cs b/Projectiles/Melee/MarniteDeconstructorProj.cs index 8f5a251276..31c639c24e 100644 --- a/Projectiles/Melee/MarniteDeconstructorProj.cs +++ b/Projectiles/Melee/MarniteDeconstructorProj.cs @@ -1,13 +1,11 @@ -using CalamityMod.Items.Tools; +using System; +using CalamityMod.Items.Tools; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; -using System; using Terraria; using Terraria.Audio; using Terraria.GameContent; -using Terraria.Graphics.Shaders; -using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -63,10 +61,10 @@ namespace CalamityMod.Projectiles.Melee Lighting.AddLight(Projectile.Center, Color.Blue.ToVector3() * 0.7f); } - if (MoveInIntervals > 0f) - MoveInIntervals -= 1f; + if (MoveInIntervals > 0f) + MoveInIntervals -= 1f; - if (!Owner.channel || Owner.noItems || Owner.CCed) + if (Owner.CantUseHoldout()) Projectile.Kill(); else if (MoveInIntervals <= 0f) @@ -169,7 +167,7 @@ namespace CalamityMod.Projectiles.Melee Vector2 normalizedVelocity = Projectile.velocity.SafeNormalize(Vector2.Zero); //Draw the holdout. - Texture2D tex = TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Vector2 origin = new Vector2(9f, tex.Height / 2f); SpriteEffects effect = SpriteEffects.None; if (Owner.direction * Owner.gravDir < 0) @@ -203,7 +201,7 @@ namespace CalamityMod.Projectiles.Melee { Main.EntitySpriteDraw(selectionTex, Projectile.Center + offset - Main.screenPosition, null, bloomColor.MultiplyRGB(colorMod), 0f, selectionTex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); }); - + //Draw laser beams going around the selection Texture2D beamTex = ModContent.Request("CalamityMod/ExtraTextures/GreyscaleGradients/SimpleGradient").Value; diff --git a/Projectiles/Melee/MarniteObliteratorProj.cs b/Projectiles/Melee/MarniteObliteratorProj.cs index bf20de65ad..d3f9272e13 100644 --- a/Projectiles/Melee/MarniteObliteratorProj.cs +++ b/Projectiles/Melee/MarniteObliteratorProj.cs @@ -1,9 +1,9 @@ -using CalamityMod.Graphics.Primitives; +using System; +using CalamityMod.Graphics.Primitives; using CalamityMod.Items.Tools; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; -using System; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -66,7 +66,7 @@ namespace CalamityMod.Projectiles.Melee if (MoveInIntervals > 0f) MoveInIntervals -= 1f; - if (!Owner.channel || Owner.noItems || Owner.CCed) + if (Owner.CantUseHoldout()) Projectile.Kill(); else if (MoveInIntervals <= 0f) @@ -179,7 +179,7 @@ namespace CalamityMod.Projectiles.Melee Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); - Texture2D tex = TextureAssets.Projectile[Projectile.type].Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Vector2 origin = new Vector2(9f, tex.Height / 2f); SpriteEffects effect = SpriteEffects.None; if (Owner.direction * Owner.gravDir < 0) diff --git a/Projectiles/Melee/MendedBiomeBlade_BitingEmbraceMist.cs b/Projectiles/Melee/MendedBiomeBlade_BitingEmbraceMist.cs index 4fa9da7769..9aeed727b0 100644 --- a/Projectiles/Melee/MendedBiomeBlade_BitingEmbraceMist.cs +++ b/Projectiles/Melee/MendedBiomeBlade_BitingEmbraceMist.cs @@ -25,6 +25,8 @@ namespace CalamityMod.Projectiles.Melee Projectile.friendly = true; Projectile.penetrate = 2; Projectile.timeLeft = 300; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) @@ -39,7 +41,7 @@ namespace CalamityMod.Projectiles.Melee if (variant == -1) variant = Main.rand.Next(3); - if (Main.rand.Next(15) == 0 && Projectile.alpha <= 140) //only try to spawn your particles if you're not close to dying + if (Main.rand.NextBool(15)&& Projectile.alpha <= 140) //only try to spawn your particles if you're not close to dying { Vector2 particlePosition = Projectile.Center + Main.rand.NextVector2Circular(Projectile.width * Projectile.scale * 0.5f, Projectile.height * Projectile.scale * 0.5f); Particle snowflake = new SnowflakeSparkle(particlePosition, Vector2.Zero, Color.White, new Color(75, 177, 250), Main.rand.NextFloat(0.3f, 1.5f), 40, 0.5f); diff --git a/Projectiles/Melee/MendedBiomeBlade_DecaysRetortDash.cs b/Projectiles/Melee/MendedBiomeBlade_DecaysRetortDash.cs index a30220cefa..56c512c9e4 100644 --- a/Projectiles/Melee/MendedBiomeBlade_DecaysRetortDash.cs +++ b/Projectiles/Melee/MendedBiomeBlade_DecaysRetortDash.cs @@ -1,7 +1,7 @@ -using CalamityMod.Particles; +using System; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; diff --git a/Projectiles/Melee/MendedBiomeBlade_ExtantAbhorrence.cs b/Projectiles/Melee/MendedBiomeBlade_ExtantAbhorrence.cs index 1c704c6301..54251e3ace 100644 --- a/Projectiles/Melee/MendedBiomeBlade_ExtantAbhorrence.cs +++ b/Projectiles/Melee/MendedBiomeBlade_ExtantAbhorrence.cs @@ -1,18 +1,18 @@ -using CalamityMod.Particles; -using CalamityMod.Items.Weapons.Melee; -using Terraria.Graphics.Shaders; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; +using System; using System.IO; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using static Terraria.ModLoader.ModContent; -using static CalamityMod.CalamityUtils; -using Terraria.Audio; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Particles; using CalamityMod.Projectiles.Boss; using CalamityMod.Tiles.Astral; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; +using static CalamityMod.CalamityUtils; +using static Terraria.ModLoader.ModContent; namespace CalamityMod.Projectiles.Melee { @@ -28,15 +28,11 @@ namespace CalamityMod.Projectiles.Melee public ref float CurrentIndicator => ref Projectile.localAI[0]; //What "indicator" stage are you on. public ref float OverCharge => ref Projectile.localAI[1]; - private bool OwnerCanShoot => Owner.channel && !Owner.noItems && !Owner.CCed; const float MaxCharge = 500; public Vector2 lastDisplacement; public float dashDuration; - public override void SetStaticDefaults() - { - } public override void SetDefaults() { Projectile.DamageType = DamageClass.Melee; @@ -80,7 +76,7 @@ namespace CalamityMod.Projectiles.Melee initialized = true; } - if (!OwnerCanShoot) + if (Owner.CantUseHoldout()) { if (State == 0f) { @@ -171,7 +167,7 @@ namespace CalamityMod.Projectiles.Melee if (Owner.direction != 1) { - Owner.itemRotation -= 3.14f; + Owner.itemRotation -= MathHelper.Pi; } Owner.itemRotation = MathHelper.WrapAngle(Owner.itemRotation); @@ -239,7 +235,9 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - Owner.GiveIFrames(TrueBiomeBlade.AstralAttunement_DashHitIFrames); + // 17APR2024: Ozzatron: Biome Blade's astral slam gives iframes when striking enemies in a similar manner to a ram dash. + // This is a fixed and intentionally very low number of iframes, and is not boosted by Cross Necklace. + Owner.GiveUniversalIFrames(TrueBiomeBlade.AstralAttunement_DashHitIFrames); } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) diff --git a/Projectiles/Melee/MendedBiomeBlade_ExtantAbhorrenceMonolith.cs b/Projectiles/Melee/MendedBiomeBlade_ExtantAbhorrenceMonolith.cs index e69d4b0d2e..03e90f0a94 100644 --- a/Projectiles/Melee/MendedBiomeBlade_ExtantAbhorrenceMonolith.cs +++ b/Projectiles/Melee/MendedBiomeBlade_ExtantAbhorrenceMonolith.cs @@ -1,15 +1,15 @@ -using CalamityMod.Particles; +using System.Collections.Generic; +using System.IO; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System.Collections.Generic; -using System.IO; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using static Terraria.ModLoader.ModContent; using static CalamityMod.CalamityUtils; -using Terraria.Audio; +using static Terraria.ModLoader.ModContent; namespace CalamityMod.Projectiles.Melee { diff --git a/Projectiles/Melee/MendedBiomeBlade_GestureForTheDrowned.cs b/Projectiles/Melee/MendedBiomeBlade_GestureForTheDrowned.cs index 3cfc38c2de..1f8259d861 100644 --- a/Projectiles/Melee/MendedBiomeBlade_GestureForTheDrowned.cs +++ b/Projectiles/Melee/MendedBiomeBlade_GestureForTheDrowned.cs @@ -1,12 +1,12 @@ -using CalamityMod.Particles; +using System; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { diff --git a/Projectiles/Melee/MendedBiomeBlade_GestureForTheDrownedOrb.cs b/Projectiles/Melee/MendedBiomeBlade_GestureForTheDrownedOrb.cs index c0fbec5765..fee1077dee 100644 --- a/Projectiles/Melee/MendedBiomeBlade_GestureForTheDrownedOrb.cs +++ b/Projectiles/Melee/MendedBiomeBlade_GestureForTheDrownedOrb.cs @@ -1,15 +1,15 @@ -using CalamityMod.Particles; -using CalamityMod.Items.Weapons.Melee; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; +using System; using System.Collections.Generic; using System.IO; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -98,11 +98,11 @@ namespace CalamityMod.Projectiles.Melee for (int i = 0; i <= 4; i++) { - Dust waterTrail = Main.dust[Dust.NewDust(Projectile.Center + Main.rand.NextVector2Circular(10f, 10f), 23, 0, 33, -3.7f * Math.Sign(Projectile.velocity.X), -6f, 0, new Color(255, 255, 255), Main.rand.NextFloat(1f, 3f))]; + Dust waterTrail = Main.dust[Dust.NewDust(Projectile.Center + Main.rand.NextVector2Circular(10f, 10f), 23, 0, DustID.Water, -3.7f * Math.Sign(Projectile.velocity.X), -6f, 0, new Color(255, 255, 255), Main.rand.NextFloat(1f, 3f))]; waterTrail.fadeIn = 3f; } - Dust foamDust = Main.dust[Dust.NewDust(Projectile.Center + Main.rand.NextVector2Circular(10f, 10f), 9, 0, 16, 2.7f * Math.Sign(Projectile.velocity.X), -3f, 0, new Color(255, 255, 255), 1.4f)]; + Dust foamDust = Main.dust[Dust.NewDust(Projectile.Center + Main.rand.NextVector2Circular(10f, 10f), 9, 0, DustID.Cloud, 2.7f * Math.Sign(Projectile.velocity.X), -3f, 0, new Color(255, 255, 255), 1.4f)]; foamDust.noGravity = true; if (Main.rand.NextBool()) @@ -141,15 +141,15 @@ namespace CalamityMod.Projectiles.Melee if (TimeSinceLanding > 10) { //Trailing water!! Dust spam!!! - Dust waterTrail = Main.dust[Dust.NewDust(Projectile.Top + Vector2.UnitY * groundOffset, 23, 0, 33, -3.7f * Math.Sign(Projectile.velocity.X), -6f, 0, new Color(255, 255, 255), Main.rand.NextFloat(1f, 3f))]; + Dust waterTrail = Main.dust[Dust.NewDust(Projectile.Top + Vector2.UnitY * groundOffset, 23, 0, DustID.Water, -3.7f * Math.Sign(Projectile.velocity.X), -6f, 0, new Color(255, 255, 255), Main.rand.NextFloat(1f, 3f))]; waterTrail.fadeIn = 3f; - waterTrail = Main.dust[Dust.NewDust(Projectile.TopRight + Vector2.UnitY * groundOffset + Main.rand.NextVector2Circular(16f, 16f) + Vector2.UnitX * Projectile.velocity.X * 4f, 23, 0, 33, -3.7f * Math.Sign(Projectile.velocity.X), -6f, 0, new Color(255, 255, 255), Main.rand.NextFloat(1f, 3f))]; + waterTrail = Main.dust[Dust.NewDust(Projectile.TopRight + Vector2.UnitY * groundOffset + Main.rand.NextVector2Circular(16f, 16f) + Vector2.UnitX * Projectile.velocity.X * 4f, 23, 0, DustID.Water, -3.7f * Math.Sign(Projectile.velocity.X), -6f, 0, new Color(255, 255, 255), Main.rand.NextFloat(1f, 3f))]; waterTrail.fadeIn = 3f; - waterTrail = Main.dust[Dust.NewDust(Projectile.TopLeft + Vector2.UnitY * groundOffset + Main.rand.NextVector2Circular(16f, 16f) + Vector2.UnitX * Projectile.velocity.X * 4f, 23, 0, 33, -3.7f * Math.Sign(Projectile.velocity.X), -6f, 0, new Color(255, 255, 255), Main.rand.NextFloat(1f, 3f))]; + waterTrail = Main.dust[Dust.NewDust(Projectile.TopLeft + Vector2.UnitY * groundOffset + Main.rand.NextVector2Circular(16f, 16f) + Vector2.UnitX * Projectile.velocity.X * 4f, 23, 0, DustID.Water, -3.7f * Math.Sign(Projectile.velocity.X), -6f, 0, new Color(255, 255, 255), Main.rand.NextFloat(1f, 3f))]; waterTrail.fadeIn = 3f; - Dust foamDust = Main.dust[Dust.NewDust(Projectile.Top + Vector2.UnitY * groundOffset + Vector2.UnitX * 16 * Math.Sign(Projectile.velocity.X), 9, 0, 16, 2.7f * Math.Sign(Projectile.velocity.X), -3f, 0, new Color(255, 255, 255), 1.4f)]; + Dust foamDust = Main.dust[Dust.NewDust(Projectile.Top + Vector2.UnitY * groundOffset + Vector2.UnitX * 16 * Math.Sign(Projectile.velocity.X), 9, 0, DustID.Cloud, 2.7f * Math.Sign(Projectile.velocity.X), -3f, 0, new Color(255, 255, 255), 1.4f)]; foamDust.noGravity = true; //Foam @@ -158,7 +158,7 @@ namespace CalamityMod.Projectiles.Melee Particle foamSmall = new FakeGlowDust(origin, Projectile.velocity / 2f, Color.LightSlateGray, Main.rand.NextFloat(1f, 2f), 25, 0.1f, bigSize: true, gravity: (-Projectile.velocity + Vector2.UnitY) * 0.1f); GeneralParticleHandler.SpawnParticle(foamSmall); - if (Main.rand.Next(5) == 0) + if (Main.rand.NextBool(5)) { Particle foamLarge = new MediumMistParticle(origin, Projectile.velocity / 2f, Color.LightSlateGray, Color.LightBlue, Main.rand.NextFloat(1f, 2f), 245 - Main.rand.Next(50), 0.1f); GeneralParticleHandler.SpawnParticle(foamLarge); @@ -209,7 +209,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Splash with { PitchVariance = 2f}, Projectile.Center); + SoundEngine.PlaySound(SoundID.Splash with { PitchVariance = 2f }, Projectile.Center); for (int i = 0; i < 4; i++) { diff --git a/Projectiles/Melee/MendedBiomeBlade_GrovetendersEntanglingVines.cs b/Projectiles/Melee/MendedBiomeBlade_GrovetendersEntanglingVines.cs index 95f35cff22..640a10685d 100644 --- a/Projectiles/Melee/MendedBiomeBlade_GrovetendersEntanglingVines.cs +++ b/Projectiles/Melee/MendedBiomeBlade_GrovetendersEntanglingVines.cs @@ -1,6 +1,6 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; diff --git a/Projectiles/Melee/MendedBiomeBlade_HeavensMight.cs b/Projectiles/Melee/MendedBiomeBlade_HeavensMight.cs index e72bf5ead3..10dbf2ddde 100644 --- a/Projectiles/Melee/MendedBiomeBlade_HeavensMight.cs +++ b/Projectiles/Melee/MendedBiomeBlade_HeavensMight.cs @@ -1,16 +1,16 @@ -using CalamityMod.Particles; +using System; +using System.IO; using CalamityMod.Items.Weapons.Melee; -using Terraria.Graphics.Shaders; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; using Terraria; +using Terraria.Audio; +using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; -using static Terraria.ModLoader.ModContent; using static CalamityMod.CalamityUtils; -using Terraria.Audio; +using static Terraria.ModLoader.ModContent; namespace CalamityMod.Projectiles.Melee { @@ -20,10 +20,9 @@ namespace CalamityMod.Projectiles.Melee public override string Texture => "CalamityMod/Projectiles/Melee/MendedBiomeBlade_HeavensMight"; private bool initialized = false; Vector2 direction = Vector2.Zero; - Vector2 oldDirection = Vector2.Zero; + Vector2 oldDirection; public ref float CurrentState => ref Projectile.ai[0]; public Player Owner => Main.player[Projectile.owner]; - private bool OwnerCanShoot => Owner.channel && !Owner.noItems && !Owner.CCed; public const float throwOutTime = 90f; public const float throwOutDistance = 440f; @@ -85,7 +84,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.rotation = direction.ToRotation(); //Only done for afterimages - if (!OwnerCanShoot) + if (Owner.CantUseHoldout()) { if (CurrentState == 2f || (CurrentState == 0f && Empowerment / maxEmpowerment < 0.5)) { @@ -183,7 +182,7 @@ namespace CalamityMod.Projectiles.Melee Owner.itemRotation = direction.ToRotation(); if (Owner.direction != 1) { - Owner.itemRotation -= 3.14f; + Owner.itemRotation -= MathHelper.Pi; } Owner.itemRotation = MathHelper.WrapAngle(Owner.itemRotation); Owner.itemTime = 2; diff --git a/Projectiles/Melee/MendedBiomeBlade_PurityProjectionSigil.cs b/Projectiles/Melee/MendedBiomeBlade_PurityProjectionSigil.cs index e6f3d68341..7fd0b3059e 100644 --- a/Projectiles/Melee/MendedBiomeBlade_PurityProjectionSigil.cs +++ b/Projectiles/Melee/MendedBiomeBlade_PurityProjectionSigil.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { Lighting.AddLight(Projectile.Center, 0.75f, 1f, 0.24f); - int dustParticle = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 75, 0f, 0f, 100, default, 0.9f); + int dustParticle = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CursedTorch, 0f, 0f, 100, default, 0.9f); Main.dust[dustParticle].noGravity = true; Main.dust[dustParticle].velocity *= 0.5f; diff --git a/Projectiles/Melee/MendedBiomeBlade_TrueAridGrandeur.cs b/Projectiles/Melee/MendedBiomeBlade_TrueAridGrandeur.cs index 838e3b442a..f5e092058f 100644 --- a/Projectiles/Melee/MendedBiomeBlade_TrueAridGrandeur.cs +++ b/Projectiles/Melee/MendedBiomeBlade_TrueAridGrandeur.cs @@ -1,14 +1,14 @@ -using CalamityMod.Particles; +using System; +using System.IO; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -25,7 +25,6 @@ namespace CalamityMod.Projectiles.Melee public ref float ChargeSoundCooldown => ref Projectile.localAI[1]; public Player Owner => Main.player[Projectile.owner]; public bool CanPogo => Owner.velocity.Y != 0 && PogoCooldown <= 0; //Only pogo when in the air and if the cooldown is zero - private bool OwnerCanShoot => Owner.channel && !Owner.noItems && !Owner.CCed; public const float pogoStrenght = 16f; //How much the player gets pogoed up public const float maxShred = 500; //How much shred you get @@ -104,7 +103,7 @@ namespace CalamityMod.Projectiles.Melee initialized = true; } - if (!OwnerCanShoot) + if (Owner.CantUseHoldout()) { Projectile.Kill(); return; @@ -141,7 +140,7 @@ namespace CalamityMod.Projectiles.Melee Owner.itemRotation = direction.ToRotation(); if (Owner.direction != 1) { - Owner.itemRotation -= 3.14f; + Owner.itemRotation -= MathHelper.Pi; } Owner.itemRotation = MathHelper.WrapAngle(Owner.itemRotation); Owner.itemTime = 2; @@ -203,7 +202,10 @@ namespace CalamityMod.Projectiles.Melee Shred += 62; //Augment the shredspeed if (Owner.velocity.Y > 0) Owner.velocity.Y = -2f; //Get "stuck" into the enemy partly - Owner.GiveIFrames(TrueBiomeBlade.HotAttunement_ShredIFrames); // i framez. Do 5 iframes even matter? idk but you get a lot of em so lol... + + // 17APR2024: Ozzatron: Biome Blade's pogo gives iframes when striking enemies in a similar manner to a bonk dash. + // This is a fixed and intentionally very low number of iframes, and is not boosted by Cross Necklace. + Owner.GiveUniversalIFrames(TrueBiomeBlade.HotAttunement_ShredIFrames); PogoCooldown = 20; } } diff --git a/Projectiles/Melee/MendedBiomeBlade_TrueAridGrandeurShot.cs b/Projectiles/Melee/MendedBiomeBlade_TrueAridGrandeurShot.cs index fe6e9b4cfb..30ed91b977 100644 --- a/Projectiles/Melee/MendedBiomeBlade_TrueAridGrandeurShot.cs +++ b/Projectiles/Melee/MendedBiomeBlade_TrueAridGrandeurShot.cs @@ -1,12 +1,12 @@ -using CalamityMod.Particles; +using System; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { diff --git a/Projectiles/Melee/MendedBiomeBlade_TrueBitingEmbrace.cs b/Projectiles/Melee/MendedBiomeBlade_TrueBitingEmbrace.cs index 57368f1322..17f21ef9ae 100644 --- a/Projectiles/Melee/MendedBiomeBlade_TrueBitingEmbrace.cs +++ b/Projectiles/Melee/MendedBiomeBlade_TrueBitingEmbrace.cs @@ -1,16 +1,16 @@ -using CalamityMod.Buffs.StatDebuffs; -using CalamityMod.Particles; +using System; +using System.IO; +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using static Terraria.ModLoader.ModContent; using static CalamityMod.CalamityUtils; -using Terraria.Audio; +using static Terraria.ModLoader.ModContent; namespace CalamityMod.Projectiles.Melee { @@ -116,7 +116,6 @@ namespace CalamityMod.Projectiles.Melee Projectile.width = Projectile.height = 100; Projectile.width = Projectile.height = 100; SoundEngine.PlaySound(SoundID.DD2_OgreSpit, Projectile.Center); - Projectile.damage = (int)(Projectile.damage * TrueBiomeBlade.ColdAttunement_SecondSwingBoost); break; case 2: Projectile.width = Projectile.height = 170; @@ -179,7 +178,7 @@ namespace CalamityMod.Projectiles.Melee Owner.itemRotation = rotation; if (Owner.direction != 1) { - Owner.itemRotation -= 3.14f; + Owner.itemRotation -= MathHelper.Pi; } Owner.itemRotation = MathHelper.WrapAngle(Owner.itemRotation); } diff --git a/Projectiles/Melee/MendedBiomeBlade_TrueDecaysRetort.cs b/Projectiles/Melee/MendedBiomeBlade_TrueDecaysRetort.cs index c0013c4aee..43accf8d45 100644 --- a/Projectiles/Melee/MendedBiomeBlade_TrueDecaysRetort.cs +++ b/Projectiles/Melee/MendedBiomeBlade_TrueDecaysRetort.cs @@ -1,14 +1,14 @@ -using CalamityMod.Items.Weapons.Melee; +using System; +using System.IO; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Sounds; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; -using Terraria.Audio; -using CalamityMod.Sounds; namespace CalamityMod.Projectiles.Melee { @@ -48,7 +48,7 @@ namespace CalamityMod.Projectiles.Melee { float collisionPoint = 0f; float bladeLength = 140f * Projectile.scale; - Vector2 displace = direction * ((float)Math.Sin(Timer / MaxTime * 3.14f) * 60); + Vector2 displace = direction * ((float)Math.Sin(Timer / MaxTime * MathHelper.Pi) * 60); return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center + displace, Owner.Center + displace + (direction * bladeLength), 24, ref collisionPoint); } @@ -115,7 +115,7 @@ namespace CalamityMod.Projectiles.Melee Owner.itemRotation = direction.ToRotation(); if (Owner.direction != 1) { - Owner.itemRotation -= 3.14f; + Owner.itemRotation -= MathHelper.Pi; } Owner.itemRotation = MathHelper.WrapAngle(Owner.itemRotation); } @@ -132,10 +132,13 @@ namespace CalamityMod.Projectiles.Melee Owner.Calamity().LungingDown = true; PowerLungeStart = Owner.Center; dashTimer = 1f; - Owner.GiveIFrames(TrueBiomeBlade.EvilAttunement_SlashIFrames); + + // 17APR2024: Ozzatron: Biome Blade's lunge gives iframes when striking enemies in a similar manner to a ram dash. + // This is a fixed and intentionally very low number of iframes, and is not boosted by Cross Necklace. + Owner.GiveUniversalIFrames(TrueBiomeBlade.EvilAttunement_SlashIFrames); } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => OnHitEffects(!target.canGhostHeal || Main.player[Projectile.owner].moonLeech); + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => OnHitEffects(Main.player[Projectile.owner].moonLeech); public override void OnHitPlayer(Player target, Player.HurtInfo info) => OnHitEffects(Main.player[Projectile.owner].moonLeech); private void OnHitEffects(bool cannotLifesteal) @@ -160,7 +163,11 @@ namespace CalamityMod.Projectiles.Melee bounceStrength *= Owner.velocity.Y == 0 ? 0.2f : 1f; //Reduce the bounce if the player is on the ground Owner.velocity = -direction.SafeNormalize(Vector2.Zero) * MathHelper.Clamp(bounceStrength, 0f, 22f); CanBounce = 0f; - Owner.GiveIFrames(TrueBiomeBlade.EvilAttunement_BounceIFrames); // i frames for free! + + // 17APR2024: Ozzatron: Biome Blade's bounce gives iframes when striking enemies in a similar manner to a bonk dash. + // This is a fixed and intentionally very low number of iframes, and is not boosted by Cross Necklace. + Owner.GiveUniversalIFrames(TrueBiomeBlade.EvilAttunement_BounceIFrames); + if (Owner.whoAmI == Main.myPlayer) { if (Owner.HeldItem.ModItem is TrueBiomeBlade sword) @@ -180,7 +187,7 @@ namespace CalamityMod.Projectiles.Melee float drawAngle = direction.ToRotation(); float drawRotation = drawAngle + MathHelper.PiOver4; - Vector2 displace = direction * ((float)Math.Sin(Timer / MaxTime * 3.14f) * 60); + Vector2 displace = direction * ((float)Math.Sin(Timer / MaxTime * MathHelper.Pi) * 60); Vector2 drawOrigin = new Vector2(0f, handle.Height); Vector2 drawOffset = Owner.Center + direction * 10f - Main.screenPosition; diff --git a/Projectiles/Melee/MendedBiomeBlade_TrueGrovetendersTouch.cs b/Projectiles/Melee/MendedBiomeBlade_TrueGrovetendersTouch.cs index fe00ddb07e..6a70c0a862 100644 --- a/Projectiles/Melee/MendedBiomeBlade_TrueGrovetendersTouch.cs +++ b/Projectiles/Melee/MendedBiomeBlade_TrueGrovetendersTouch.cs @@ -1,16 +1,16 @@ -using CalamityMod.DataStructures; -using CalamityMod.Particles; -using CalamityMod.Items.Weapons.Melee; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; +using System; using System.IO; using System.Linq; +using CalamityMod.DataStructures; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { diff --git a/Projectiles/Melee/MendedBiomeBlade_TruePurityProjection.cs b/Projectiles/Melee/MendedBiomeBlade_TruePurityProjection.cs index d259745696..1545f4d734 100644 --- a/Projectiles/Melee/MendedBiomeBlade_TruePurityProjection.cs +++ b/Projectiles/Melee/MendedBiomeBlade_TruePurityProjection.cs @@ -1,12 +1,12 @@ -using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Weapons.Melee; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using static Terraria.ModLoader.ModContent; using static CalamityMod.CalamityUtils; -using Terraria.Audio; +using static Terraria.ModLoader.ModContent; namespace CalamityMod.Projectiles.Melee { @@ -63,7 +63,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.tileCollide = true; Lighting.AddLight(Projectile.Center, 0.75f, 1f, 0.24f); - int dustParticle = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 75, 0f, 0f, 100, default, 0.9f); + int dustParticle = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CursedTorch, 0f, 0f, 100, default, 0.9f); Main.dust[dustParticle].noGravity = true; Main.dust[dustParticle].velocity *= 0.5f; Main.dust[dustParticle].velocity += Projectile.velocity * 0.1f; @@ -84,7 +84,7 @@ namespace CalamityMod.Projectiles.Melee for (int i = 0; i <= 15; i++) { Vector2 displace = (Projectile.rotation - MathHelper.PiOver4).ToRotationVector2() * (-0.5f + (i / 15f)) * 88f; - int dustParticle = Dust.NewDust(Projectile.Center + displace, Projectile.width, Projectile.height, 75, 0f, 0f, 100, default, 2f); + int dustParticle = Dust.NewDust(Projectile.Center + displace, Projectile.width, Projectile.height, DustID.CursedTorch, 0f, 0f, 100, default, 2f); Main.dust[dustParticle].noGravity = true; Main.dust[dustParticle].velocity = Projectile.oldVelocity; } diff --git a/Projectiles/Melee/MicrowaveAura.cs b/Projectiles/Melee/MicrowaveAura.cs index f0249d327c..3a35f35f65 100644 --- a/Projectiles/Melee/MicrowaveAura.cs +++ b/Projectiles/Melee/MicrowaveAura.cs @@ -1,10 +1,10 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Weapons.Melee; using CalamityMod.Projectiles.Melee.Yoyos; using Microsoft.Xna.Framework; using Terraria; -using Terraria.ModLoader; using Terraria.Audio; -using CalamityMod.Items.Weapons.Melee; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.ignoreWater = true; Projectile.timeLeft = 300; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; + Projectile.localNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Melee/MirrorBlast.cs b/Projectiles/Melee/MirrorBlast.cs index 78194da957..5b768e9693 100644 --- a/Projectiles/Melee/MirrorBlast.cs +++ b/Projectiles/Melee/MirrorBlast.cs @@ -1,5 +1,5 @@ +using System; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -46,7 +46,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.velocity *= 1.02f; } - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; Lighting.AddLight(Projectile.Center, 0f, 0.35f, 0.35f); } diff --git a/Projectiles/Melee/MonstrousKnife.cs b/Projectiles/Melee/MonstrousKnife.cs index 8531c87aa7..729f668ea6 100644 --- a/Projectiles/Melee/MonstrousKnife.cs +++ b/Projectiles/Melee/MonstrousKnife.cs @@ -1,5 +1,6 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using CalamityMod.Balancing; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -31,14 +32,14 @@ namespace CalamityMod.Projectiles.Melee Projectile.Kill(); } if (Projectile.ai[0] < 30f) - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + MathHelper.PiOver2; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; } public override void OnKill(int timeLeft) { for (int dustIndex = 0; dustIndex < 3; ++dustIndex) { - int redDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 182, 0f, 0f, 100, new Color(), 0.8f); + int redDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.TheDestroyer, 0f, 0f, 100, new Color(), 0.8f); Dust dust = Main.dust[redDust]; dust.noGravity = true; dust.velocity *= 1.2f; @@ -48,46 +49,26 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - if (Main.myPlayer != Projectile.owner) + int heal = (int)Math.Round(hit.Damage * Main.rand.NextFloat(0.05f, 0.1f)); + if (heal > BalancingConstants.LifeStealCap) + heal = BalancingConstants.LifeStealCap; + + if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) return; - if (target.lifeMax <= 5 || Main.player[Projectile.owner].moonLeech) - return; - - if (Main.player[Projectile.owner].lifeSteal <= 0f) - return; - - float healAmt = hit.Damage * Main.rand.NextFloat(0.075f, 0.9f); - if (healAmt < 1f) - healAmt = 1f; - - if (healAmt > CalamityMod.lifeStealCap) - healAmt = CalamityMod.lifeStealCap; - - if (Main.rand.NextBool(3)) - CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], healAmt, ProjectileID.VampireHeal, 1200f, 3f); + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); } public override void OnHitPlayer(Player target, Player.HurtInfo info) { - if (Main.myPlayer != Projectile.owner) + int heal = (int)Math.Round(info.Damage * Main.rand.NextFloat(0.05f, 0.1f)); + if (heal > BalancingConstants.LifeStealCap) + heal = BalancingConstants.LifeStealCap; + + if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0) return; - if (Main.player[Projectile.owner].moonLeech) - return; - - if (Main.player[Projectile.owner].lifeSteal <= 0f) - return; - - float healAmt = info.Damage * Main.rand.NextFloat(0.075f, 0.9f); - if (healAmt < 1f) - healAmt = 1f; - - if (healAmt > CalamityMod.lifeStealCap) - healAmt = CalamityMod.lifeStealCap; - - if (Main.rand.NextBool(3)) - CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], healAmt, ProjectileID.VampireHeal, 1200f, 3f); + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); } } } diff --git a/Projectiles/Melee/MourningSkull.cs b/Projectiles/Melee/MourningSkull.cs index 6f056934c1..d3c6622512 100644 --- a/Projectiles/Melee/MourningSkull.cs +++ b/Projectiles/Melee/MourningSkull.cs @@ -1,9 +1,9 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -53,7 +53,7 @@ namespace CalamityMod.Projectiles.Melee else { Projectile.spriteDirection = 1; - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X); + Projectile.rotation = Projectile.velocity.ToRotation(); } if (Projectile.ai[0] >= 0f && Projectile.ai[0] < 200f) @@ -61,7 +61,7 @@ namespace CalamityMod.Projectiles.Melee int npcTracker = (int)Projectile.ai[0]; if (Main.npc[npcTracker].active) { - Vector2 projPos = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); + Vector2 projPos = Projectile.Center; float npcXDist = Main.npc[npcTracker].position.X - projPos.X; float npcYDist = Main.npc[npcTracker].position.Y - projPos.Y; float npcDistance = (float)Math.Sqrt((double)(npcXDist * npcXDist + npcYDist * npcYDist)); @@ -100,7 +100,7 @@ namespace CalamityMod.Projectiles.Melee else { Projectile.spriteDirection = 1; - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X); + Projectile.rotation = Projectile.velocity.ToRotation(); } int eightConst = 8; @@ -134,7 +134,7 @@ namespace CalamityMod.Projectiles.Melee SoundEngine.PlaySound(SoundID.Item10, Projectile.position); for (int i = 0; i < 5; i++) { - int bloody = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 5, 0f, 0f, 100, default, 2f); + int bloody = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Blood, 0f, 0f, 100, default, 2f); Main.dust[bloody].velocity *= 3f; if (Main.rand.NextBool()) { @@ -144,10 +144,10 @@ namespace CalamityMod.Projectiles.Melee } for (int j = 0; j < 10; j++) { - int fiery = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 3f); + int fiery = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 3f); Main.dust[fiery].noGravity = true; Main.dust[fiery].velocity *= 5f; - fiery = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 2f); + fiery = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 2f); Main.dust[fiery].velocity *= 2f; } } @@ -159,7 +159,7 @@ namespace CalamityMod.Projectiles.Melee { for (int k = 0; k < 2; k++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 174, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.InfernoFork, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.position.X, Projectile.position.Y, Main.rand.Next(-35, 36) * 0.2f, Main.rand.Next(-35, 36) * 0.2f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.35), Projectile.knockBack * 0.35f, Main.myPlayer, 0f, 0f); } diff --git a/Projectiles/Melee/MurasamaSlash.cs b/Projectiles/Melee/MurasamaSlash.cs index 02c1dc1fd3..e3e500149c 100644 --- a/Projectiles/Melee/MurasamaSlash.cs +++ b/Projectiles/Melee/MurasamaSlash.cs @@ -1,10 +1,10 @@ -using CalamityMod.Dusts; +using System; +using CalamityMod.Dusts; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Particles; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -47,8 +47,8 @@ namespace CalamityMod.Projectiles.Melee { if (Projectile.frameCounter <= 1) return false; - Texture2D texture = ModContent.Request(Texture).Value; - Rectangle frame = texture.Frame(verticalFrames: Main.projFrames[Type], frameY:Projectile.frame); + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Rectangle frame = texture.Frame(verticalFrames: Main.projFrames[Type], frameY: Projectile.frame); Vector2 origin = frame.Size() * 0.5f; SpriteEffects spriteEffects = Projectile.direction == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition + (Projectile.velocity * 0.3f) + new Vector2(0, -32).RotatedBy(Projectile.rotation), frame, Color.White, Projectile.rotation, origin, Projectile.scale, spriteEffects, 0); @@ -115,7 +115,7 @@ namespace CalamityMod.Projectiles.Melee Vector2 playerRotatedPoint = player.RotatedRelativePoint(player.MountedCenter, true); if (Main.myPlayer == Projectile.owner) { - if (player.channel && !player.noItems && !player.CCed) + if (!player.CantUseHoldout()) HandleChannelMovement(player, playerRotatedPoint); else { diff --git a/Projectiles/Melee/Nebudust.cs b/Projectiles/Melee/Nebudust.cs index 7371c95e26..4d74002b3b 100644 --- a/Projectiles/Melee/Nebudust.cs +++ b/Projectiles/Melee/Nebudust.cs @@ -1,9 +1,9 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -54,7 +54,7 @@ namespace CalamityMod.Projectiles.Melee randoAdjuster = rando5 / randoAdjuster; rando1 *= randoAdjuster; rando2 *= randoAdjuster; - int astra = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 269, 0f, 0f, 100, default, 1f); + int astra = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Sandnado, 0f, 0f, 100, default, 1f); Main.dust[astra].noGravity = true; Main.dust[astra].position.X = Projectile.Center.X; Main.dust[astra].position.Y = Projectile.Center.Y; diff --git a/Projectiles/Melee/NebulaShot.cs b/Projectiles/Melee/NebulaShot.cs index 0d1af76fbf..9fa8905553 100644 --- a/Projectiles/Melee/NebulaShot.cs +++ b/Projectiles/Melee/NebulaShot.cs @@ -1,9 +1,9 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using CalamityMod.Buffs.DamageOverTime; namespace CalamityMod.Projectiles.Melee { diff --git a/Projectiles/Melee/NeptuneOrb.cs b/Projectiles/Melee/NeptuneOrb.cs deleted file mode 100644 index bd0cb4164d..0000000000 --- a/Projectiles/Melee/NeptuneOrb.cs +++ /dev/null @@ -1,96 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Audio; - -namespace CalamityMod.Projectiles.Melee -{ - public class NeptuneOrb : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Melee"; - public override string Texture => "CalamityMod/Projectiles/Melee/DepthOrb"; - - public override void SetDefaults() - { - Projectile.width = 20; - Projectile.height = 20; - Projectile.aiStyle = ProjAIStyleID.Beam; - Projectile.friendly = true; - Projectile.DamageType = DamageClass.Melee; - Projectile.penetrate = -1; - Projectile.timeLeft = 300; - Projectile.ignoreWater = true; - } - - public override void AI() - { - Lighting.AddLight(Projectile.Center, 0f, 0f, 1f); - if (Projectile.timeLeft % 20 == 19 && Projectile.owner == Main.myPlayer) - { - int splitDamage = Projectile.damage / 2; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, 0f, 15f, ModContent.ProjectileType(), splitDamage, Projectile.knockBack, Projectile.owner, 0f, 0f); - } - int waterDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 0.4f); - Main.dust[waterDust].noGravity = true; - Main.dust[waterDust].velocity *= 0.5f; - Main.dust[waterDust].velocity += Projectile.velocity * 0.1f; - } - - public override bool PreDraw(ref Color lightColor) - { - if (Projectile.timeLeft > 295) - return false; - - Texture2D tex = ModContent.Request(Texture).Value; - Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); - return false; - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(50, 50, 255, Projectile.alpha); - } - - public override void OnKill(int timeLeft) - { - SoundEngine.PlaySound(SoundID.Item10, Projectile.position); - Projectile.position = Projectile.Center; - Projectile.width = Projectile.height = 64; - Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); - for (int dustIndex = 0; dustIndex <= 30; dustIndex++) - { - float rando1 = (float)Main.rand.Next(-10, 11); - float rando2 = (float)Main.rand.Next(-10, 11); - float rando3 = (float)Main.rand.Next(3, 9); - float randoAdjuster = (float)Math.Sqrt((double)(rando1 * rando1 + rando2 * rando2)); - randoAdjuster = rando3 / randoAdjuster; - rando1 *= randoAdjuster; - rando2 *= randoAdjuster; - int killWatery = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 1.2f); - Dust dust = Main.dust[killWatery]; - dust.noGravity = true; - dust.position.X = Projectile.Center.X; - dust.position.Y = Projectile.Center.Y; - dust.position.X += (float)Main.rand.Next(-10, 11); - dust.position.Y += (float)Main.rand.Next(-10, 11); - dust.velocity.X = rando1; - dust.velocity.Y = rando2; - } - Projectile.maxPenetrate = -1; - Projectile.penetrate = -1; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; - Projectile.Damage(); - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 180); - } - } -} diff --git a/Projectiles/Melee/NeptunesBountyProjectile.cs b/Projectiles/Melee/NeptunesBountyProjectile.cs new file mode 100644 index 0000000000..726be61311 --- /dev/null +++ b/Projectiles/Melee/NeptunesBountyProjectile.cs @@ -0,0 +1,309 @@ +using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatBuffs; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Utilities; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; +using static CalamityMod.CalamityUtils; + +namespace CalamityMod.Projectiles.Melee +{ + public class NeptunesBountyProjectile : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + public override string Texture => "CalamityMod/Items/Weapons/Melee/NeptunesBounty"; + + public int Time = 0; + public int ChargeupTime = 25; + public int Lifetime = 300; + public int startDamage; + public bool setDamage = false; + public int dustType1 = 103; + public int dustType2 = 172; + public bool spinMode = false; // Initial spinning + public bool spinMode2 = false; // After falling happens spin effect + public Vector2 NPCDestination = new Vector2(0, 0); + public float OverallProgress => 1 - Projectile.timeLeft / (float)Lifetime; + public float ThrowProgress => 1 - Projectile.timeLeft / (float)(Lifetime); + public float ChargeProgress => 1 - (Projectile.timeLeft - Lifetime) / (float)(ChargeupTime); + + public Player Owner => Main.player[Projectile.owner]; + public SlotId SpinSoundSlot; + + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 20; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + } + + public override void SetDefaults() + { + Projectile.width = 135; + Projectile.height = 135; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = Lifetime + ChargeupTime; + Projectile.DamageType = DamageClass.Melee; + Projectile.ignoreWater = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + } + + public override bool ShouldUpdatePosition() + { + return ChargeProgress >= 1; + } + + public override bool? CanDamage() + { + //We don't want the anticipation to deal damage. + if (ChargeProgress < 1) + return false; + + return base.CanDamage(); + } + + //Swing animation keys + public CurveSegment pullback = new CurveSegment(EasingType.PolyOut, 0f, 0f, MathHelper.PiOver4 * -1.2f, 2); + public CurveSegment throwout = new CurveSegment(EasingType.PolyOut, 0.7f, MathHelper.PiOver4 * -1.2f, MathHelper.PiOver4 * 1.2f + MathHelper.PiOver2, 3); + internal float ArmAnticipationMovement() => PiecewiseAnimation(ChargeProgress, new CurveSegment[] { pullback, throwout }); + + public override void AI() + { + if (SoundEngine.TryGetActiveSound(SpinSoundSlot, out var SpinSound) && SpinSound.IsPlaying) + SpinSound.Position = Projectile.Center; + + float playerDist = Vector2.Distance(Owner.Center, Projectile.Center); + + Time++; + Projectile.spriteDirection = Projectile.direction; + Vector3 Light = spinMode2 ? new Vector3(0.200f, 0.200f, 0.255f) : new Vector3(0.070f, 0.070f, 0.250f); + Lighting.AddLight(Projectile.Center, Light * 4); + + //Anticipation animation. Make the player look like theyre holding the depth crusher + if (ChargeProgress < 1) + { + Owner.ChangeDir(MathF.Sign(Main.MouseWorld.X - Owner.Center.X)); + + float armRotation = ArmAnticipationMovement() * Owner.direction; + + Owner.heldProj = Projectile.whoAmI; + Projectile.spriteDirection = Owner.direction; + Projectile.direction = Owner.direction; + + Projectile.Center = Owner.MountedCenter + Vector2.UnitY.RotatedBy(armRotation * Owner.gravDir) * -90f * Owner.gravDir + new Vector2(Owner.direction == 1 ? 10 : 3, 0); + Projectile.rotation = (-MathHelper.PiOver4 * Projectile.direction + armRotation) * Owner.gravDir; + + Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, MathHelper.Pi + armRotation); + + return; + } + + //Play the throw sound when the throw ACTUALLY BEGINS. + //Additionally, make the projectile collide and set its speed and velocity + if (Projectile.timeLeft == Lifetime) + { + Projectile.netUpdate = true; + SoundEngine.PlaySound(SoundID.Item1, Projectile.Center); + Projectile.Center = Owner.MountedCenter + Projectile.velocity * 12f; + Projectile.velocity = (Main.MouseWorld - Owner.Center).SafeNormalize(Vector2.UnitX * Owner.direction) * 28; + startDamage = Projectile.damage; + Projectile.spriteDirection = Projectile.direction; + SpinSoundSlot = SoundEngine.PlaySound(NeptunesBounty.SpinSound, Projectile.Center); + Time = 0; + spinMode = true; + } + + if (Projectile.velocity.X > 0) + Projectile.direction = 1; + else + Projectile.direction = -1; + + if (Time >= 75 && !spinMode2 && Projectile.velocity.Y >= 22) + { + Projectile.extraUpdates = 3; + + SoundEngine.PlaySound(new("CalamityMod/Sounds/Item/VividClarityBeamAppear") { Volume = 0.65f, PitchVariance = 0.3f }, Projectile.Center); + SoundEngine.PlaySound(SoundID.ShimmerWeak1 with { Pitch = 0.15f }, Projectile.Center); + + Particle pulse = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, Color.Aqua, new Vector2(2f, 2f), Main.rand.NextFloat(12f, 25f), 0.01f, 0.9f, 22); + GeneralParticleHandler.SpawnParticle(pulse); + Particle pulse2 = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, Color.DodgerBlue, new Vector2(2f, 2f), Main.rand.NextFloat(12f, 25f), 0.01f, 0.83f, 15); + GeneralParticleHandler.SpawnParticle(pulse2); + + Projectile.damage = (int)(startDamage * 2); // Deals 200% damage after launching + Time = 0; + + bool foundTarget = false; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].CanBeChasedBy(Projectile.GetSource_FromThis(), false)) + NPCDestination = Main.npc[i].Center + Main.npc[i].velocity * 5f; + + if (NPCDestination == new Vector2(0, 0)) + foundTarget = false; + else + foundTarget = true; + } + + if (!foundTarget) + { + Projectile.velocity = (-Projectile.velocity).SafeNormalize(Vector2.UnitX * Projectile.direction) * 25; + } + else + { + Projectile.velocity = (NPCDestination - Projectile.Center).SafeNormalize(Vector2.UnitX * Projectile.direction) * 25; + } + + SpinSound?.Stop(); + + spinMode2 = true; + } + + if (spinMode) + { + if (!spinMode2) + { + if (Projectile.velocity.Y < 22) + Projectile.velocity.Y += 0.42f; + + if (Projectile.velocity.Y > 0) + Projectile.velocity.X *= 0.975f; + + Vector2 particlePosition = Projectile.Center + new Vector2(13.5f * Projectile.direction, 0) + Projectile.velocity * 0.5f; + if (Time % 3 == 0) + { + Particle Smear = new CircularSmearVFX(particlePosition, Color.DeepSkyBlue * Main.rand.NextFloat(0.78f, 0.85f), Main.rand.NextFloat(-8, 8), Main.rand.NextFloat(1.2f, 1.3f)); + GeneralParticleHandler.SpawnParticle(Smear); + } + + if (playerDist < 1400f) + { + for (int i = 0; i < 2; i++) + { + Vector2 linePos = Projectile.Center + (i * MathHelper.Pi + Projectile.rotation + MathHelper.PiOver2).ToRotationVector2() * 75f; + SparkleParticle spark = new SparkleParticle(linePos, (i * MathHelper.Pi + Projectile.rotation * Math.Sign(Projectile.velocity.X)).ToRotationVector2() * Main.rand.NextFloat(5f, 12f), Color.DodgerBlue * 0.35f, Color.DarkBlue * 0.75f, Main.rand.NextFloat(0.15f, 0.4f), Main.rand.Next(7, 16), Main.rand.NextFloat(-8, 8), 0.2f, false); + GeneralParticleHandler.SpawnParticle(spark); + } + } + + if (Time % 7 == 0) + { + Vector2 velDirection = new Vector2(80, 80).RotatedByRandom(100); + Vector2 location = Projectile.Center + velDirection; + Vector2 velocity; + bool foundTarget = false; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].CanBeChasedBy(Projectile.GetSource_FromThis(), false)) + NPCDestination = Main.npc[i].Center + Main.npc[i].velocity * 5f; + + if (NPCDestination == new Vector2(0, 0)) + foundTarget = false; + else + foundTarget = true; + } + + if (!foundTarget) + { + velocity = velDirection.SafeNormalize(Vector2.UnitX * Projectile.direction) * 25; + } + else + { + velocity = (NPCDestination - location).SafeNormalize(Vector2.UnitX * Projectile.direction) * 25; + } + + Projectile.NewProjectile(Projectile.GetSource_FromThis(), location, velocity, ModContent.ProjectileType(), startDamage / 6, Projectile.knockBack / 4, Projectile.owner); + } + + } + else + { + if (Time == 1) + SpinSoundSlot = SoundEngine.PlaySound(NeptunesBounty.SpinSound with { Pitch = 0.2f }, Projectile.Center); + + Vector2 particlePosition2 = Projectile.Center + new Vector2(13.5f * Projectile.direction, 0) + Projectile.velocity * 0.5f; + if (Time % 2 == 0) + { + Particle Smear2 = new CircularSmearVFX(particlePosition2, Color.Aqua * Main.rand.NextFloat(0.78f, 0.85f), Main.rand.NextFloat(-8, 8), Main.rand.NextFloat(1.2f, 1.3f)); + GeneralParticleHandler.SpawnParticle(Smear2); + } + + if (playerDist < 1400f) + { + for (int i = 0; i < 2; i++) + { + Vector2 linePos = Projectile.Center + (i * MathHelper.Pi + Projectile.rotation + MathHelper.PiOver2).ToRotationVector2() * 75f; + SparkleParticle spark = new SparkleParticle(linePos, (i * MathHelper.Pi + Projectile.rotation * Math.Sign(Projectile.velocity.X)).ToRotationVector2() * Main.rand.NextFloat(5f, 12f), Color.Aqua * 0.35f, Color.DodgerBlue * 0.75f, Main.rand.NextFloat(0.15f, 0.4f), Main.rand.Next(7, 16), Main.rand.NextFloat(-8, 8), 0.2f, false); + GeneralParticleHandler.SpawnParticle(spark); + } + } + } + + Projectile.spriteDirection = Projectile.direction; + + Projectile.rotation += (0.9f * (MathF.Abs(Projectile.velocity.Y) * 0.03f + 0.85f)) * Projectile.direction; + } + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 300); + + SoundStyle HitSound = new("CalamityMod/Sounds/Item/SarosDiskThrow", 3) { Volume = 0.55f, Pitch = -0.8f }; + if (spinMode2) + { + for (int i = 0; i < 4; i++) + { + AltSparkParticle spark = new AltSparkParticle(target.Center, (Projectile.velocity * 0.1f) * (i + 1), false, 15, 4f - i * 0.35f, Color.Aqua * 0.25f); + GeneralParticleHandler.SpawnParticle(spark); + } + for (int i = 0; i < 4; i++) + { + AltSparkParticle spark = new AltSparkParticle(target.Center, (-Projectile.velocity * 0.15f) * (i + 1), false, 15, 4f - i * 0.6f, Color.Aqua * 0.25f); + GeneralParticleHandler.SpawnParticle(spark); + } + for (int i = 0; i <= 20; i++) + { + Dust dust = Dust.NewDustPerfect(target.Center + Main.rand.NextVector2Circular(9, 9), Main.rand.NextBool() ? 307 : 180, Projectile.velocity * Main.rand.NextFloat(0.1f, 1.2f), 0, default, Main.rand.NextFloat(0.9f, 1.45f)); + dust.noGravity = true; + Dust dust2 = Dust.NewDustPerfect(target.Center + Main.rand.NextVector2Circular(9, 9), Main.rand.NextBool() ? 307 : 180, -Projectile.velocity * Main.rand.NextFloat(0.1f, 1.2f), 0, default, Main.rand.NextFloat(0.9f, 1.45f)); + dust2.noGravity = true; + } + SoundEngine.PlaySound(HitSound, Projectile.Center); + SoundEngine.PlaySound(new("CalamityMod/Sounds/Custom/SwiftSlice") { Volume = 0.65f, Pitch = -0.5f }, Projectile.Center); + } + } + + public override void OnKill(int timeLeft) + { + if (SoundEngine.TryGetActiveSound(SpinSoundSlot, out var SpinSound)) + SpinSound?.Stop(); + + for (int i = 0; i < 40; i++) + { + float dustMulti = Main.rand.NextFloat(0.3f, 1.5f); + Vector2 dustPos = Projectile.Center; + Dust dust = Dust.NewDustPerfect(dustPos, Main.rand.NextBool(3) ? dustType1 : dustType2); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(1.6f, 2.5f) - dustMulti; + dust.velocity = new Vector2(5, 5).RotatedByRandom(100) * Main.rand.NextFloat(0.3f, 1f) * dustMulti; + } + } + public override bool PreDraw(ref Color lightColor) + { + if (spinMode2) + { + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], Color.Aqua * 0.6f, 1); + } + return true; + } + } +} diff --git a/Projectiles/Melee/NeptunesBountySplitProjectile.cs b/Projectiles/Melee/NeptunesBountySplitProjectile.cs new file mode 100644 index 0000000000..38ca92cfbe --- /dev/null +++ b/Projectiles/Melee/NeptunesBountySplitProjectile.cs @@ -0,0 +1,84 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.NPCs.SupremeCalamitas; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Healing; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Audio; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Melee +{ + public class NeptunesBountySplitProjectile : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public int Time = 0; + public int randTimer; + public int dustType1 = 80; + public int dustType2 = 172; + public int spreadDust = 0; + public Color WaterColor = Main.rand.NextBool() ? Color.DodgerBlue : Color.DeepSkyBlue; + public Player Owner => Main.player[Projectile.owner]; + public override void SetDefaults() + { + Projectile.width = 20; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 110; + Projectile.ignoreWater = true; + Projectile.extraUpdates = 2; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + + public override void AI() + { + float playerDist = Vector2.Distance(Owner.Center, Projectile.Center); + + Time++; + Projectile.velocity *= 0.988f; + + if (Projectile.timeLeft % 2 == 0 && Time > 3f && playerDist < 1400f) + { + Color smokeColor = Color.RoyalBlue; + Particle smoke = new HeavySmokeParticle(Projectile.Center - Projectile.velocity, Projectile.velocity * Main.rand.NextFloat(-0.2f, -0.6f), smokeColor * 0.65f, 15, Main.rand.NextFloat(0.4f, 0.55f), 0.3f, Main.rand.NextFloat(-0.2f, 0.2f), false, required: true); + GeneralParticleHandler.SpawnParticle(smoke); + } + + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(3 + spreadDust, 3 + spreadDust), Main.rand.NextBool(3) ? dustType1 : dustType2, -Projectile.velocity * Main.rand.NextFloat(0.05f, 0.65f), 0, default, Main.rand.NextFloat(0.4f, 1.2f) + Time * 0.009f); + dust.noGravity = true; + if (dust.type == dustType1) + dust.alpha = 180; + + if (Projectile.timeLeft == 20) + { + WaterFlavoredParticle spark = new WaterFlavoredParticle(Projectile.Center, -Projectile.velocity * 0.05f, false, 25, 0.85f + Time * 0.013f, WaterColor * 0.35f); + GeneralParticleHandler.SpawnParticle(spark); + } + else if (Projectile.timeLeft > 20) + { + WaterFlavoredParticle spark = new WaterFlavoredParticle(Projectile.Center, -Projectile.velocity * 0.05f, false, 2, 0.85f + Time * 0.013f, WaterColor * 0.35f); + GeneralParticleHandler.SpawnParticle(spark); + } + if (Projectile.timeLeft < 20) + { + Time -= 5; + spreadDust += 2; + } + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 240); + + SoundEngine.PlaySound(SoundID.ShimmerWeak1 with { Pitch = 0.35f }, Projectile.Center); + } + } +} diff --git a/Projectiles/Melee/Oathblade.cs b/Projectiles/Melee/Oathblade.cs index 0284e16f42..0a1075fe71 100644 --- a/Projectiles/Melee/Oathblade.cs +++ b/Projectiles/Melee/Oathblade.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -32,7 +32,7 @@ namespace CalamityMod.Projectiles.Melee Lighting.AddLight(Projectile.Center, 0.35f, 0f, 0.35f); if (Main.rand.NextBool(3)) - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 173, Projectile.velocity.X * 0.25f, Projectile.velocity.Y * 0.25f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, Projectile.velocity.X * 0.25f, Projectile.velocity.Y * 0.25f); } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) diff --git a/Projectiles/Melee/OathswordFlame.cs b/Projectiles/Melee/OathswordFlame.cs index f5e02d6ae2..edbcd60800 100644 --- a/Projectiles/Melee/OathswordFlame.cs +++ b/Projectiles/Melee/OathswordFlame.cs @@ -1,8 +1,8 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.ExpandHitboxBy(100); for (int k = 0; k < 10; k++) - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 73, Projectile.oldVelocity.X * 2.5f, Projectile.oldVelocity.Y * 2.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.PinkFairy, Projectile.oldVelocity.X * 2.5f, Projectile.oldVelocity.Y * 2.5f); } } } diff --git a/Projectiles/Melee/OldLordClaymoreProj.cs b/Projectiles/Melee/OldLordClaymoreProj.cs index f3fee039c9..e28a4fe8d1 100644 --- a/Projectiles/Melee/OldLordClaymoreProj.cs +++ b/Projectiles/Melee/OldLordClaymoreProj.cs @@ -1,9 +1,9 @@ -using CalamityMod.Items.Weapons.Melee; +using System; +using System.IO; +using CalamityMod.Items.Weapons.Melee; using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; using Terraria; using Terraria.Audio; using Terraria.Graphics.Shaders; @@ -125,11 +125,6 @@ namespace CalamityMod.Projectiles.Melee baseRotation = MathHelper.WrapAngle(swingCompletion * Direction * MathHelper.Pi * -3f); Owner.fullRotation = baseRotation; Owner.fullRotationOrigin = Owner.Center - Owner.position; - Owner.immuneNoBlink = true; - Owner.immune = true; - Owner.immuneTime = 5; - for (int k = 0; k < Owner.hurtCooldowns.Length; k++) - Owner.hurtCooldowns[k] = Owner.immuneTime; // Emit fire dust. for (int i = 0; i < 4; i++) @@ -313,11 +308,26 @@ namespace CalamityMod.Projectiles.Melee return false; } + public override void ModifyDamageHitbox(ref Rectangle hitbox) + { + if (CurrentState == SwingState.Spinning) + hitbox = new Rectangle((int)Owner.position.X - 35, (int)Owner.position.Y - 35, 102, 118); + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { ItemLoader.OnHitNPC(Owner.ActiveItem(), Owner, target, hit, damageDone); NPCLoader.OnHitByItem(target, Owner, Owner.ActiveItem(), hit, damageDone); PlayerLoader.OnHitNPC(Owner, target, hit, damageDone); + + if (CurrentState == SwingState.Spinning) + { + Owner.immuneNoBlink = true; + Owner.immune = true; + Owner.immuneTime = 12; + for (int k = 0; k < Owner.hurtCooldowns.Length; k++) + Owner.hurtCooldowns[k] = Owner.immuneTime; + } } public override void OnKill(int timeLeft) => Owner.fullRotation = 0f; diff --git a/Projectiles/Melee/OmnibladeSwing.cs b/Projectiles/Melee/OmnibladeSwing.cs index b31748f23a..396202ab0b 100644 --- a/Projectiles/Melee/OmnibladeSwing.cs +++ b/Projectiles/Melee/OmnibladeSwing.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Melee Vector2 playerRotatedPoint = Owner.RotatedRelativePoint(Owner.MountedCenter, true); if (Main.myPlayer == Projectile.owner) { - if (Owner.channel && !Owner.noItems && !Owner.CCed) + if (!Owner.CantUseHoldout()) HandleChannelMovement(playerRotatedPoint); else Projectile.Kill(); @@ -54,9 +54,9 @@ namespace CalamityMod.Projectiles.Melee // Sprite and player directioning. Projectile.spriteDirection = -Projectile.direction; if (Projectile.direction == 1) - Projectile.Left = Owner.Center; + Projectile.Left = Owner.MountedCenter; else - Projectile.Right = Owner.Center; + Projectile.Right = Owner.MountedCenter; Projectile.position.X += Projectile.spriteDirection == -1 ? -116f : 88f; Projectile.position.Y -= Projectile.scale * 66f; Owner.ChangeDir(Projectile.direction); diff --git a/Projectiles/Melee/Orbacle.cs b/Projectiles/Melee/Orbacle.cs index afb422575d..57effaed39 100644 --- a/Projectiles/Melee/Orbacle.cs +++ b/Projectiles/Melee/Orbacle.cs @@ -1,7 +1,7 @@ -using Terraria; -using Terraria.ModLoader; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { public class Orbacle : ModProjectile, ILocalizedModType @@ -32,7 +32,7 @@ namespace CalamityMod.Projectiles.Melee { Main.spriteBatch.SetBlendState(BlendState.Additive); - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Vector2 drawPosition = Projectile.Center - Main.screenPosition; Vector2 origin = texture.Size() * 0.5f; Color color = new Color(83, 137, 230); // Auric Blue but slightly more blue. (#5389e6) diff --git a/Projectiles/Melee/OrderbringerBeam.cs b/Projectiles/Melee/OrderbringerBeam.cs index a8a03a1073..72feafc6e6 100644 --- a/Projectiles/Melee/OrderbringerBeam.cs +++ b/Projectiles/Melee/OrderbringerBeam.cs @@ -1,9 +1,9 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -32,7 +32,7 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 0.785f; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4; if (Projectile.ai[1] == 0f) { @@ -83,7 +83,7 @@ namespace CalamityMod.Projectiles.Melee whiteLightTimer = 5; } - int rainbow = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 0.6f); + int rainbow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RainbowTorch, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 0.6f); Main.dust[rainbow].noGravity = true; Main.dust[rainbow].velocity *= 0.5f; Main.dust[rainbow].velocity += Projectile.velocity * 0.1f; @@ -110,15 +110,15 @@ namespace CalamityMod.Projectiles.Melee SoundEngine.PlaySound(SoundID.Item122, Projectile.Center); for (int i = 0; i < 2; i++) { - int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.5f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RainbowTorch, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.5f); Main.dust[dust].noGravity = true; } for (int j = 0; j < 20; j++) { - int deathRainbow = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 2.5f); + int deathRainbow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RainbowTorch, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 2.5f); Main.dust[deathRainbow].noGravity = true; Main.dust[deathRainbow].velocity *= 3f; - deathRainbow = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.5f); + deathRainbow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RainbowTorch, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.5f); Main.dust[deathRainbow].velocity *= 2f; Main.dust[deathRainbow].noGravity = true; } diff --git a/Projectiles/Melee/OrderbringerRain.cs b/Projectiles/Melee/OrderbringerRain.cs index 8bdedf01ad..690b46cd4b 100644 --- a/Projectiles/Melee/OrderbringerRain.cs +++ b/Projectiles/Melee/OrderbringerRain.cs @@ -1,8 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -36,7 +36,7 @@ namespace CalamityMod.Projectiles.Melee for (int i = 0; i < 2; i++) { - int rainbow = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + int rainbow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RainbowTorch, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); Main.dust[rainbow].noGravity = true; Main.dust[rainbow].velocity *= 0.5f; Main.dust[rainbow].velocity += Projectile.velocity * 0.1f; diff --git a/Projectiles/Melee/OrderbringerWhiteOrb.cs b/Projectiles/Melee/OrderbringerWhiteOrb.cs index cd05a3c73d..10f687be16 100644 --- a/Projectiles/Melee/OrderbringerWhiteOrb.cs +++ b/Projectiles/Melee/OrderbringerWhiteOrb.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee @@ -26,7 +27,7 @@ namespace CalamityMod.Projectiles.Melee Lighting.AddLight((int)Projectile.Center.X / 16, (int)Projectile.Center.Y / 16, (float)Main.DiscoR / 200f, (float)Main.DiscoG / 200f, (float)Main.DiscoB / 200f); for (int i = 0; i < 2; i++) { - int rainbow = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + int rainbow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RainbowTorch, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); Main.dust[rainbow].noGravity = true; Main.dust[rainbow].velocity *= 0.5f; Main.dust[rainbow].velocity += Projectile.velocity * 0.1f; diff --git a/Projectiles/Melee/PhosphorescentGauntletPunches.cs b/Projectiles/Melee/PhosphorescentGauntletPunches.cs index f3d37f56f8..2c02f06d22 100644 --- a/Projectiles/Melee/PhosphorescentGauntletPunches.cs +++ b/Projectiles/Melee/PhosphorescentGauntletPunches.cs @@ -73,7 +73,9 @@ namespace CalamityMod.Projectiles.Melee internal void ReelBack() { - Owner.GiveIFrames(PhosphorescentGauntlet.OnHitIFrames); + // 17APR2024: Ozzatron: Phosphorescent Gauntlet gives iframes when striking enemies in a similar manner to a bonk dash. + // This is a fixed and intentionally very low number of iframes, and is not boosted by Cross Necklace. + Owner.GiveUniversalIFrames(PhosphorescentGauntlet.OnHitIFrames); // Create some visual effects. if (!Main.dedServ) @@ -83,7 +85,7 @@ namespace CalamityMod.Projectiles.Melee Vector2 topRight = Projectile.Center + Projectile.velocity.RotatedBy(MathHelper.PiOver2) * 40f; foreach (Vector2 spawnPosition in new BezierCurve(topLeft, top, topRight).GetPoints(50)) { - Dust sulphurousAcid = Dust.NewDustPerfect(spawnPosition + Projectile.velocity * 16f, (int)CalamityDusts.SulfurousSeaAcid); + Dust sulphurousAcid = Dust.NewDustPerfect(spawnPosition + Projectile.velocity * 16f, (int)CalamityDusts.SulphurousSeaAcid); sulphurousAcid.velocity = Projectile.velocity * 4f; sulphurousAcid.noGravity = true; sulphurousAcid.scale = 1.2f; @@ -115,7 +117,7 @@ namespace CalamityMod.Projectiles.Melee Vector2 rotatedHandPosition = player.RotatedRelativePoint(player.position + handOffset, true); for (int i = 0; i < 4; i++) { - Dust dust = Dust.NewDustDirect(player.Center, 0, 0, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 150, default, 1.3f); + Dust dust = Dust.NewDustDirect(player.Center, 0, 0, (int)CalamityDusts.SulphurousSeaAcid, 0f, 0f, 150, default, 1.3f); dust.position = rotatedHandPosition; dust.velocity = Vector2.Zero; dust.noGravity = true; @@ -156,7 +158,7 @@ namespace CalamityMod.Projectiles.Melee // Manual drawing is used to correct the origin of the projectile when drawn. public override bool PreDraw(ref Color lightColor) { - Texture2D punchTexture = ModContent.Request(Texture).Value; + Texture2D punchTexture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Rectangle frame = punchTexture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); Vector2 origin = frame.Size() * 0.5f; SpriteEffects directionEffect = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; diff --git a/Projectiles/Melee/PhotonRipperProjectile.cs b/Projectiles/Melee/PhotonRipperProjectile.cs index 437469c640..f083ed9117 100644 --- a/Projectiles/Melee/PhotonRipperProjectile.cs +++ b/Projectiles/Melee/PhotonRipperProjectile.cs @@ -1,10 +1,10 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -41,7 +41,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Texture2D glowmaskTexture = ModContent.Request("CalamityMod/Projectiles/Melee/PhotonRipperGlowmask").Value; Rectangle glowmaskRectangle = glowmaskTexture.Frame(1, 6, 0, Projectile.frame); Vector2 origin = texture.Size() * 0.5f; @@ -68,7 +68,7 @@ namespace CalamityMod.Projectiles.Melee Vector2 playerRotatedPosition = Owner.RotatedRelativePoint(Owner.MountedCenter); if (Main.myPlayer == Projectile.owner) { - if (Owner.channel && !Owner.noItems && !Owner.CCed) + if ((!Owner.CantUseHoldout() && Projectile.ai[2] == 1) || (Projectile.ai[2] == 0 && Owner.Calamity().mouseRight && Owner.active && !Owner.dead)) HandleChannelMovement(playerRotatedPosition); else Projectile.Kill(); @@ -226,9 +226,9 @@ namespace CalamityMod.Projectiles.Melee shootReach = distanceFromMouse + 32f; else shootReach = 72f; - } + } - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Owner.Center, Projectile.velocity, ModContent.ProjectileType(), (int)ToothDamage, 0f, Projectile.owner, shootReach, Projectile.whoAmI); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Owner.Center, Projectile.velocity, ModContent.ProjectileType(), (int)ToothDamage, 0f, Projectile.owner, shootReach, Projectile.whoAmI, Projectile.ai[2]); } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) diff --git a/Projectiles/Melee/PlagueSeeker.cs b/Projectiles/Melee/PlagueSeeker.cs index c3ecf585ce..11487d15cc 100644 --- a/Projectiles/Melee/PlagueSeeker.cs +++ b/Projectiles/Melee/PlagueSeeker.cs @@ -1,7 +1,9 @@ using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Melee { public class PlagueSeeker : ModProjectile, ILocalizedModType @@ -39,7 +41,7 @@ namespace CalamityMod.Projectiles.Melee { for (int i = 0; i < 3; i++) { - int plagued = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, default, 0.75f); + int plagued = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.TerraBlade, 0f, 0f, 100, default, 0.75f); Main.dust[plagued].noGravity = true; Main.dust[plagued].velocity *= 0f; } diff --git a/Projectiles/Melee/PrismRay.cs b/Projectiles/Melee/PrismRay.cs index b1866ab80a..82014e4644 100644 --- a/Projectiles/Melee/PrismRay.cs +++ b/Projectiles/Melee/PrismRay.cs @@ -55,7 +55,7 @@ namespace CalamityMod.Projectiles.Melee { if (Main.rand.NextBool(10)) { - Dust verticalMagic = Dust.NewDustDirect(Projectile.Center, 0, 0, 267, 0f, 0f, 225, RayColor, 1.5f); + Dust verticalMagic = Dust.NewDustDirect(Projectile.Center, 0, 0, DustID.RainbowMk2, 0f, 0f, 225, RayColor, 1.5f); verticalMagic.noGravity = true; verticalMagic.noLight = true; verticalMagic.scale = Projectile.Opacity; @@ -76,7 +76,7 @@ namespace CalamityMod.Projectiles.Melee if (canSpawnDust) { - Dust risingMagic = Dust.NewDustDirect(dustSpawnPosition, 0, 0, 267, 0f, 0f, 127, RayColor, 1f); + Dust risingMagic = Dust.NewDustDirect(dustSpawnPosition, 0, 0, DustID.RainbowMk2, 0f, 0f, 127, RayColor, 1f); risingMagic.noGravity = true; risingMagic.position = dustSpawnPosition; risingMagic.velocity = -Vector2.UnitY * Main.rand.NextFloat(1.6f, 7.5f); @@ -107,7 +107,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { Vector2 baseDrawPosition = Projectile.Center + Vector2.UnitY * Projectile.gfxOffY - Main.screenPosition; - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Rectangle frame = texture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); Vector2 origin = frame.Size() / 2f; Color fadedRayColor = Projectile.GetAlpha(lightColor); @@ -176,7 +176,7 @@ namespace CalamityMod.Projectiles.Melee for (float i = 0f; i < dustCount; i++) { - Dust explosionDust = Dust.NewDustDirect(Projectile.Center, 0, 0, 267, 0f, 0f, 0, brightenedRayColor, 1f); + Dust explosionDust = Dust.NewDustDirect(Projectile.Center, 0, 0, DustID.RainbowMk2, 0f, 0f, 0, brightenedRayColor, 1f); explosionDust.position = Projectile.Center; explosionDust.velocity = baseExplosionDirection.RotatedBy(MathHelper.TwoPi * i / dustCount) * outwardFireSpeedFactor * Main.rand.NextFloat(0.8f, 1.2f); explosionDust.noGravity = true; @@ -190,7 +190,7 @@ namespace CalamityMod.Projectiles.Melee } for (float i = 0f; i < dustCount; i++) { - Dust explosionDust = Dust.NewDustDirect(Projectile.Center, 0, 0, 267, 0f, 0f, 0, brightenedRayColor, 1f); + Dust explosionDust = Dust.NewDustDirect(Projectile.Center, 0, 0, DustID.RainbowMk2, 0f, 0f, 0, brightenedRayColor, 1f); explosionDust.position = Projectile.Center; explosionDust.velocity = baseExplosionDirection.RotatedBy(MathHelper.TwoPi * i / dustCount) * outwardFireSpeedFactor * Main.rand.NextFloat(0.8f, 1.2f); explosionDust.velocity *= Main.rand.NextFloat() * 0.8f; diff --git a/Projectiles/Melee/PrismTooth.cs b/Projectiles/Melee/PrismTooth.cs index 0974f059dd..d7a1981016 100644 --- a/Projectiles/Melee/PrismTooth.cs +++ b/Projectiles/Melee/PrismTooth.cs @@ -1,8 +1,8 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Graphics.Primitives; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.GameContent.Achievements; using Terraria.Graphics.Shaders; @@ -18,6 +18,7 @@ namespace CalamityMod.Projectiles.Melee public Player Owner => Main.player[Projectile.owner]; public ref float ShootReach => ref Projectile.ai[0]; public ref float Time => ref Projectile.ai[1]; + public ref float CanBreakTrees => ref Projectile.ai[2]; public override void SetStaticDefaults() { ProjectileID.Sets.TrailingMode[Projectile.type] = 2; @@ -65,10 +66,13 @@ namespace CalamityMod.Projectiles.Melee Projectile.Opacity = Utils.GetLerpValue(0f, 12f, Time, true) * Utils.GetLerpValue(Lifetime, Lifetime - 12f, Lifetime - Projectile.timeLeft, true); // Destroy trees within the range of the past 20 oldPos positions. - for (int i = 0; i < 20; i++) + if (CanBreakTrees == 1) { - Point pointToCheck = (Projectile.oldPos[i] + Projectile.Size * 0.5f).ToTileCoordinates(); - AbsolutelyFuckingAnnihilateTrees(pointToCheck.X, pointToCheck.Y); + for (int i = 0; i < 20; i++) + { + Point pointToCheck = (Projectile.oldPos[i] + Projectile.Size * 0.5f).ToTileCoordinates(); + AbsolutelyFuckingAnnihilateTrees(pointToCheck.X, pointToCheck.Y); + } } // Emit light. @@ -121,14 +125,6 @@ namespace CalamityMod.Projectiles.Melee Vector2 generalOffset = Projectile.rotation.ToRotationVector2().RotatedBy(MathHelper.PiOver2) * 15f; generalOffset += Projectile.rotation.ToRotationVector2() * -5f * (float)Math.Sin(Projectile.rotation); - // Mess with the oldPos array so that the trail always points towards the crystal. - Vector2 oldPosition = Projectile.oldPos[1]; - Projectile.oldPos[1] = Projectile.oldPos[0] - Projectile.rotation.ToRotationVector2() * Vector2.Distance(Projectile.oldPos[0], Projectile.oldPos[1]); - - // Revert back if the above calculations caused any NaNs. - if (Projectile.oldPos[1].HasNaNs()) - Projectile.oldPos[1] = oldPosition; - Main.spriteBatch.EnterShaderRegion(); GameShaders.Misc["CalamityMod:PrismaticStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/ScarletDevilStreak")); diff --git a/Projectiles/Melee/PrismaticBeam.cs b/Projectiles/Melee/PrismaticBeam.cs index 712cd1c434..e043fec076 100644 --- a/Projectiles/Melee/PrismaticBeam.cs +++ b/Projectiles/Melee/PrismaticBeam.cs @@ -2,12 +2,12 @@ using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; +using Terraria.Audio; using Terraria.Enums; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using ReLogic.Content; namespace CalamityMod.Projectiles.Melee { @@ -115,7 +115,7 @@ namespace CalamityMod.Projectiles.Melee Vector2 spawnPos = Projectile.Center; for (int k = 0; k < dustCount + 1; k++) { - Dust dust = Dust.NewDustDirect(spawnPos, 1, 1, 267, Projectile.velocity.X / 2f, Projectile.velocity.Y / 2f); + Dust dust = Dust.NewDustDirect(spawnPos, 1, 1, DustID.RainbowMk2, Projectile.velocity.X / 2f, Projectile.velocity.Y / 2f); dust.position += Main.rand.NextVector2Square(-10f, 10f); dust.velocity = Main.rand.NextVector2Unit() * (10f - dustCount * 2f) / 10f; dust.color = Main.rand.Next(Colors); diff --git a/Projectiles/Melee/PrismaticWave.cs b/Projectiles/Melee/PrismaticWave.cs index f09006004c..582a55ff9b 100644 --- a/Projectiles/Melee/PrismaticWave.cs +++ b/Projectiles/Melee/PrismaticWave.cs @@ -1,8 +1,8 @@ -using CalamityMod.Buffs.DamageOverTime; -using Microsoft.Xna.Framework; -using System; +using System; using System.Collections.Generic; using System.IO; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -92,10 +92,10 @@ namespace CalamityMod.Projectiles.Melee } } Lighting.AddLight(Projectile.Center, Main.DiscoR * 0.5f / 255f, Main.DiscoG * 0.5f / 255f, Main.DiscoB * 0.5f / 255f); - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X); + Projectile.rotation = Projectile.velocity.ToRotation(); if (Main.rand.NextBool()) { - int rainbow = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 267, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, alpha, Main.rand.Next(colors)); + int rainbow = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.RainbowMk2, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, alpha, Main.rand.Next(colors)); Main.dust[rainbow].noGravity = true; } } @@ -121,7 +121,7 @@ namespace CalamityMod.Projectiles.Melee { for (int k = 0; k < 3; k++) { - int rainbow = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 267, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f, alpha, Main.rand.Next(colors)); + int rainbow = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.RainbowMk2, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f, alpha, Main.rand.Next(colors)); Main.dust[rainbow].noGravity = true; } } diff --git a/Projectiles/Melee/PwnagehammerEcho.cs b/Projectiles/Melee/PwnagehammerEcho.cs index da61efd72c..d35c179c89 100644 --- a/Projectiles/Melee/PwnagehammerEcho.cs +++ b/Projectiles/Melee/PwnagehammerEcho.cs @@ -77,7 +77,7 @@ namespace CalamityMod.Projectiles.Melee { Vector2 offset = new Vector2(7, 0).RotatedByRandom(MathHelper.ToRadians(360f)); Vector2 velOffset = new Vector2(3, 0).RotatedBy(offset.ToRotation()); - Dust dust = Dust.NewDustPerfect(new Vector2(Projectile.position.X, Projectile.position.Y) + offset, DustID.GoldFlame, new Vector2(Projectile.velocity.X * 0.2f + velOffset.X, Projectile.velocity.Y * 0.2f + velOffset.Y), 100, new Color(255, 245, 198), 2f); + Dust dust = Dust.NewDustPerfect(Projectile.position + offset, DustID.GoldFlame, new Vector2(Projectile.velocity.X * 0.2f + velOffset.X, Projectile.velocity.Y * 0.2f + velOffset.Y), 100, new Color(255, 245, 198), 2f); dust.noGravity = true; } @@ -85,7 +85,7 @@ namespace CalamityMod.Projectiles.Melee { Vector2 offset = new Vector2(7, 0).RotatedByRandom(MathHelper.ToRadians(360f)); Vector2 velOffset = new Vector2(3, 0).RotatedBy(offset.ToRotation()); - Dust dust = Dust.NewDustPerfect(new Vector2(Projectile.position.X, Projectile.position.Y) + offset, DustID.GoldFlame, new Vector2(Projectile.velocity.X * 0.2f + velOffset.X, Projectile.velocity.Y * 0.2f + velOffset.Y), 100, new Color(255, 245, 198), 2f); + Dust dust = Dust.NewDustPerfect(Projectile.position + offset, DustID.GoldFlame, new Vector2(Projectile.velocity.X * 0.2f + velOffset.X, Projectile.velocity.Y * 0.2f + velOffset.Y), 100, new Color(255, 245, 198), 2f); dust.noGravity = true; } } @@ -115,7 +115,7 @@ namespace CalamityMod.Projectiles.Melee float rot = MathHelper.ToRadians(i * rotFactor); Vector2 offset = new Vector2(15f, 0).RotatedBy(rot); Vector2 velOffset = new Vector2(12.5f, 0).RotatedBy(rot); - int dust = Dust.NewDust(Projectile.position + offset, Projectile.width, Projectile.height, 269, velOffset.X, velOffset.Y); + int dust = Dust.NewDust(Projectile.position + offset, Projectile.width, Projectile.height, DustID.Sandnado, velOffset.X, velOffset.Y); Main.dust[dust].noGravity = true; Main.dust[dust].velocity = velOffset; Main.dust[dust].scale = 3f; @@ -137,7 +137,7 @@ namespace CalamityMod.Projectiles.Melee SpriteEffects spriteEffects = SpriteEffects.None; if (Projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Rectangle sourceRectangle = new Rectangle(0, 0, texture.Width, texture.Height); Vector2 origin = sourceRectangle.Size() / 2f; diff --git a/Projectiles/Melee/PwnagehammerProj.cs b/Projectiles/Melee/PwnagehammerProj.cs index fe143e4435..241777b227 100644 --- a/Projectiles/Melee/PwnagehammerProj.cs +++ b/Projectiles/Melee/PwnagehammerProj.cs @@ -1,10 +1,10 @@ -using Microsoft.Xna.Framework; -using System; +using System; using System.IO; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -87,10 +87,10 @@ namespace CalamityMod.Projectiles.Melee SoundEngine.PlaySound(UseSoundFunny with { Pitch = EmpoweredHammer * 0.1f - 0.2f }, Projectile.Center); else if (HighBong == 1) - { - SoundEngine.PlaySound(UseSound with { Pitch = 4 * 0.1f - 0.2f }, Projectile.Center); - HighBong = 0; - } + { + SoundEngine.PlaySound(UseSound with { Pitch = 4 * 0.1f - 0.2f }, Projectile.Center); + HighBong = 0; + } else SoundEngine.PlaySound(UseSound with { Pitch = EmpoweredHammer * 0.1f - 0.2f }, Projectile.Center); diff --git a/Projectiles/Melee/RSSolarFlare.cs b/Projectiles/Melee/RSSolarFlare.cs index ca34f204d8..d22072560b 100644 --- a/Projectiles/Melee/RSSolarFlare.cs +++ b/Projectiles/Melee/RSSolarFlare.cs @@ -24,6 +24,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.friendly = true; Projectile.tileCollide = false; Projectile.penetrate = 1; + Projectile.extraUpdates = 1; Projectile.alpha = 150; Projectile.DamageType = DamageClass.Melee; Projectile.timeLeft = 120; @@ -72,8 +73,8 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - Texture2D texture2D13 = ModContent.Request(Texture).Value; - int framing = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; + Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + int framing = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; int y6 = framing * Projectile.frame; Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)framing / 2f), Projectile.scale, SpriteEffects.None, 0); return false; @@ -103,7 +104,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int j = 0; j < 20; j++) { - int shiny = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 159, 0f, 0f, 100, default, 0.5f); + int shiny = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Teleporter, 0f, 0f, 100, default, 0.5f); Main.dust[shiny].velocity *= 3f; if (Main.rand.NextBool()) { @@ -113,10 +114,10 @@ namespace CalamityMod.Projectiles.Melee } for (int k = 0; k < 35; k++) { - int shiny2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 32, 0f, 0f, 100, default, 1f); + int shiny2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Sand, 0f, 0f, 100, default, 1f); Main.dust[shiny2].noGravity = true; Main.dust[shiny2].velocity *= 5f; - shiny2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 159, 0f, 0f, 100, default, 0.5f); + shiny2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Teleporter, 0f, 0f, 100, default, 0.5f); Main.dust[shiny2].velocity *= 2f; } } diff --git a/Projectiles/Melee/RainBolt.cs b/Projectiles/Melee/RainBolt.cs index 5eb537263b..86a38e025f 100644 --- a/Projectiles/Melee/RainBolt.cs +++ b/Projectiles/Melee/RainBolt.cs @@ -1,15 +1,21 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; + namespace CalamityMod.Projectiles.Melee { public class RainBolt : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + private const int TimeLeft = 180; + + private const int HomingTime = TimeLeft - 30; + public override void SetDefaults() { Projectile.width = 10; @@ -17,10 +23,10 @@ namespace CalamityMod.Projectiles.Melee Projectile.friendly = true; Projectile.DamageType = DamageClass.Melee; Projectile.penetrate = 1; - Projectile.timeLeft = 180; + Projectile.timeLeft = TimeLeft; } - public override bool? CanHitNPC(NPC target) => Projectile.timeLeft < 150 && target.CanBeChasedBy(Projectile); + public override bool? CanHitNPC(NPC target) => Projectile.timeLeft < HomingTime && target.CanBeChasedBy(Projectile); public override void AI() { @@ -30,11 +36,11 @@ namespace CalamityMod.Projectiles.Melee Projectile.localAI[0] += 1f; } - int rainbow = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 2f); + int rainbow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RainbowTorch, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 2f); Main.dust[rainbow].noGravity = true; Main.dust[rainbow].velocity *= 0f; - if (Projectile.timeLeft < 150) + if (Projectile.timeLeft < HomingTime) CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 600f, 12f, 20f); else Projectile.velocity *= 0.95f; @@ -45,9 +51,8 @@ namespace CalamityMod.Projectiles.Melee SoundEngine.PlaySound(SoundID.Item60, Projectile.Center); for (int k = 0; k < 5; k++) { - int rain = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB)); + int rain = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.RainbowTorch, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB)); Main.dust[rain].noGravity = true; - Main.dust[rain].velocity *= 4f; } } } diff --git a/Projectiles/Melee/RainbowBoom.cs b/Projectiles/Melee/RainbowBoom.cs index 4ea9633a44..504a9b0f49 100644 --- a/Projectiles/Melee/RainbowBoom.cs +++ b/Projectiles/Melee/RainbowBoom.cs @@ -1,12 +1,15 @@ +using System; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Melee { public class RainbowBoom : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; public override void SetDefaults() @@ -25,38 +28,16 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - bool xflag = false; - bool yflag = false; - if (Projectile.velocity.X < 0f && Projectile.position.X < Projectile.ai[0]) - { - xflag = true; - } - if (Projectile.velocity.X > 0f && Projectile.position.X > Projectile.ai[0]) - { - xflag = true; - } - if (Projectile.velocity.Y < 0f && Projectile.position.Y < Projectile.ai[1]) - { - yflag = true; - } - if (Projectile.velocity.Y > 0f && Projectile.position.Y > Projectile.ai[1]) - { - yflag = true; - } - if (xflag && yflag) - { - Projectile.Kill(); - } float projTimer = 25f; if (Projectile.ai[0] > 180f) - { projTimer -= (Projectile.ai[0] - 180f) / 2f; - } + if (projTimer <= 0f) { projTimer = 0f; Projectile.Kill(); } + projTimer *= 0.7f; Projectile.ai[0] += 4f; int timerCounter = 0; @@ -69,23 +50,16 @@ namespace CalamityMod.Projectiles.Melee randoAdjuster = rando3 / randoAdjuster; rando1 *= randoAdjuster; rando2 *= randoAdjuster; - int rainbow = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + int rainbow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RainbowTorch, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); Main.dust[rainbow].noGravity = true; Main.dust[rainbow].position.X = Projectile.Center.X; Main.dust[rainbow].position.Y = Projectile.Center.Y; - Dust expr_149DF_cp_0 = Main.dust[rainbow]; - expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); - Dust expr_14A09_cp_0 = Main.dust[rainbow]; - expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); + Main.dust[rainbow].position.X += (float)Main.rand.Next(-10, 11); + Main.dust[rainbow].position.Y += (float)Main.rand.Next(-10, 11); Main.dust[rainbow].velocity.X = rando1; Main.dust[rainbow].velocity.Y = rando2; timerCounter++; } } - - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) - { - Projectile.damage = (int)(Projectile.damage * 0.9); - } } } diff --git a/Projectiles/Melee/Razorwind.cs b/Projectiles/Melee/Razorwind.cs index 91f164ec01..afd0ea82a5 100644 --- a/Projectiles/Melee/Razorwind.cs +++ b/Projectiles/Melee/Razorwind.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -46,7 +46,7 @@ namespace CalamityMod.Projectiles.Melee { for (int i = 0; i < 3; i++) { - int blueDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 187, 0f, 0f, 100, new Color(53, Main.DiscoG, 255), 2f); + int blueDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Flare_Blue, 0f, 0f, 100, new Color(53, Main.DiscoG, 255), 2f); Main.dust[blueDust].noGravity = true; Main.dust[blueDust].velocity *= 0f; } @@ -61,7 +61,7 @@ namespace CalamityMod.Projectiles.Melee { for (int k = 0; k < 10; k++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 187, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 100, new Color(53, Main.DiscoG, 255)); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Flare_Blue, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 100, new Color(53, Main.DiscoG, 255)); } } diff --git a/Projectiles/Melee/RedtideWhirlpool.cs b/Projectiles/Melee/RedtideWhirlpool.cs index d6bf68e6bd..319032448d 100644 --- a/Projectiles/Melee/RedtideWhirlpool.cs +++ b/Projectiles/Melee/RedtideWhirlpool.cs @@ -23,6 +23,8 @@ namespace CalamityMod.Projectiles.Melee Projectile.tileCollide = false; Projectile.penetrate = -1; Projectile.timeLeft = 40; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() @@ -43,9 +45,9 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - SpriteEffects flip = Math.Sign(Projectile.velocity.X) < 0? SpriteEffects.None : SpriteEffects.FlipHorizontally; + SpriteEffects flip = Math.Sign(Projectile.velocity.X) < 0 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, null, lightColor * 0.3f, Projectile.rotation * 1.2f, texture.Size() / 2f, 1.5f, flip, 0); Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, null, lightColor * 0.4f, Projectile.rotation, texture.Size() / 2f, 2f, flip, 0); diff --git a/Projectiles/Melee/RemsRevengeProj.cs b/Projectiles/Melee/RemsRevengeProj.cs index fbbcaeec64..4adb4f9c7b 100644 --- a/Projectiles/Melee/RemsRevengeProj.cs +++ b/Projectiles/Melee/RemsRevengeProj.cs @@ -1,7 +1,7 @@ -using CalamityMod.Buffs.StatDebuffs; +using System; +using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Projectiles/Melee/RendingNeedle.cs b/Projectiles/Melee/RendingNeedle.cs index 1123b48b69..6d609a9ec7 100644 --- a/Projectiles/Melee/RendingNeedle.cs +++ b/Projectiles/Melee/RendingNeedle.cs @@ -1,14 +1,14 @@ -using CalamityMod.Particles; -using Terraria.Graphics.Shaders; +using System; +using CalamityMod.Graphics.Primitives; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; +using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; -using Terraria.Audio; -using CalamityMod.Graphics.Primitives; namespace CalamityMod.Projectiles.Melee diff --git a/Projectiles/Melee/Rox1.cs b/Projectiles/Melee/Rox1.cs index 11f40a627c..0359c0a78d 100644 --- a/Projectiles/Melee/Rox1.cs +++ b/Projectiles/Melee/Rox1.cs @@ -1,9 +1,9 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; -using Terraria.ModLoader; -using Terraria.ID; using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { @@ -33,7 +33,7 @@ namespace CalamityMod.Projectiles.Melee //Dust trail if (Main.rand.NextBool(10)) { - Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 191, Projectile.velocity.X * 0.4f, Projectile.velocity.Y * 0.4f, 160, default, 0.7f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.SpookyWood, Projectile.velocity.X * 0.4f, Projectile.velocity.Y * 0.4f, 160, default, 0.7f); } } @@ -59,7 +59,7 @@ namespace CalamityMod.Projectiles.Melee { for (int i = 0; i < 8; i++) { - Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 191, -Projectile.velocity.X * 0.4f, -Projectile.velocity.Y * 0.4f, 120, default, 1.2f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.SpookyWood, -Projectile.velocity.X * 0.4f, -Projectile.velocity.Y * 0.4f, 120, default, 1.2f); } SoundEngine.PlaySound(SoundID.Dig, Projectile.position); Projectile.Kill(); diff --git a/Projectiles/Melee/RoxcaliburProj.cs b/Projectiles/Melee/RoxcaliburProj.cs index db3223618f..e970f4b362 100644 --- a/Projectiles/Melee/RoxcaliburProj.cs +++ b/Projectiles/Melee/RoxcaliburProj.cs @@ -1,17 +1,17 @@ -using Microsoft.Xna.Framework.Graphics; +using System; +using CalamityMod.Items.Weapons.Melee; using Microsoft.Xna.Framework; -using System; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Items.Weapons.Melee; namespace CalamityMod.Projectiles.Melee { public class RoxcaliburProj : ModProjectile, ILocalizedModType { - public string LocalizationCategory => "Projectiles.Melee"; + public new string LocalizationCategory => "Projectiles.Melee"; public override string Texture => "CalamityMod/Items/Weapons/Melee/Roxcalibur"; @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.DamageType = DamageClass.Melee; Projectile.friendly = true; Projectile.tileCollide = false; - Projectile.scale = 1.3f; + Projectile.scale = 1.3f; Projectile.timeLeft = 3600; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 150; @@ -50,24 +50,24 @@ namespace CalamityMod.Projectiles.Melee Vector2 HitboxCenter = Projectile.Center + RockOffset(); hitbox = new Rectangle((int)(HitboxCenter.X - HitboxSize.X / 2f), (int)(HitboxCenter.Y - HitboxSize.Y / 2f), (int)HitboxSize.X, (int)HitboxSize.Y); } - + } //more precise hitbox. makes the weapon harder to use but looks visually better: use it if you want. -/* - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) - { - if (HitTimer <= 0) - { - float size = Projectile.Size.Length(); - Vector2 hiltPos = Projectile.Center - Projectile.velocity * size / 2; - Vector2 endPos = Projectile.Center + Projectile.velocity * size / 2; - float useless = 0f; - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), hiltPos, endPos, size / 2, ref useless); - } - return base.Colliding(projHitbox, targetHitbox); - } -*/ + /* + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + if (HitTimer <= 0) + { + float size = Projectile.Size.Length(); + Vector2 hiltPos = Projectile.Center - Projectile.velocity * size / 2; + Vector2 endPos = Projectile.Center + Projectile.velocity * size / 2; + float useless = 0f; + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), hiltPos, endPos, size / 2, ref useless); + } + return base.Colliding(projHitbox, targetHitbox); + } + */ public override void AI() { @@ -105,9 +105,9 @@ namespace CalamityMod.Projectiles.Melee if (Animation == Plunging) { Projectile.timeLeft = 60 * 2; //maximum 2 second plunge time - chargeModifier = ChargeLevel * 3.5f; + chargeModifier = ChargeLevel * 3.5f; } - + Projectile.damage = (int)(Projectile.damage * (1 + chargeModifier)); Projectile.netUpdate = true; SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/LoudSwingWoosh") with { Pitch = -0.5f }, Projectile.Center); @@ -127,7 +127,7 @@ namespace CalamityMod.Projectiles.Melee rotation = Utils.SmoothStep(-MathHelper.PiOver2 / 4, MathHelper.PiOver2 / 1.5f, rotModifier); rotation *= direction; Projectile.timeLeft = (int)origAnimMax; - + if (ChargeLevel >= 1 && player.whoAmI == Main.myPlayer && PlayedChargeSound == 0) { @@ -268,8 +268,8 @@ namespace CalamityMod.Projectiles.Melee } public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; - Rectangle rectangle = texture.Bounds; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Rectangle rectangle = texture.Bounds; Vector2 origin2 = rectangle.Size() / 2f; SpriteEffects effects = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; diff --git a/Projectiles/Melee/SHIV.cs b/Projectiles/Melee/SHIV.cs index 2c476da55d..5fc14d89be 100644 --- a/Projectiles/Melee/SHIV.cs +++ b/Projectiles/Melee/SHIV.cs @@ -27,17 +27,17 @@ namespace CalamityMod.Projectiles.Melee } public override void AI() - { - CalamityUtils.HomeInOnNPC(Projectile, true, 300f, 12f, 20f); - - int rainbow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 66, (float)(Projectile.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.3f); + { + CalamityUtils.HomeInOnNPC(Projectile, true, 300f, 12f, 20f); + + int rainbow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RainbowTorch, (float)(Projectile.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.3f); Main.dust[rainbow].noGravity = true; Main.dust[rainbow].velocity = Vector2.Zero; } public override void OnKill(int timeLeft) { - int rainbow = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 66, (float)(Projectile.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + int rainbow = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.RainbowTorch, (float)(Projectile.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); Main.dust[rainbow].noGravity = true; } diff --git a/Projectiles/Melee/SaharaSlicersBolt.cs b/Projectiles/Melee/SaharaSlicersBolt.cs index 577a22f9fc..0150b4757a 100644 --- a/Projectiles/Melee/SaharaSlicersBolt.cs +++ b/Projectiles/Melee/SaharaSlicersBolt.cs @@ -1,10 +1,10 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using CalamityMod.Particles; namespace CalamityMod.Projectiles.Melee { @@ -65,7 +65,7 @@ namespace CalamityMod.Projectiles.Melee // Setting the bolt's position on the player's back Projectile.rotation = (21.8f - (Projectile.ai[1] * 0.1f)) * -Owner.direction; Vector2 BoltPos = Owner.MountedCenter + new Vector2((10 + Projectile.ai[1] * 2.5f) * -Owner.direction, 3f - Projectile.ai[1]); - + Projectile.Center = BoltPos; } } diff --git a/Projectiles/Melee/SandBlade.cs b/Projectiles/Melee/SandBlade.cs index 72307b0b46..daf43041df 100644 --- a/Projectiles/Melee/SandBlade.cs +++ b/Projectiles/Melee/SandBlade.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -54,7 +54,7 @@ namespace CalamityMod.Projectiles.Melee { for (int k = 0; k < 5; k++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 159, 0f, 0f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Teleporter, 0f, 0f); } } } diff --git a/Projectiles/Melee/SandFire.cs b/Projectiles/Melee/SandFire.cs index cc3ae55ea2..d55c2732c0 100644 --- a/Projectiles/Melee/SandFire.cs +++ b/Projectiles/Melee/SandFire.cs @@ -1,7 +1,9 @@ -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Melee { public class SandFire : ModProjectile, ILocalizedModType @@ -15,9 +17,10 @@ namespace CalamityMod.Projectiles.Melee Projectile.height = 6; Projectile.friendly = true; Projectile.penetrate = 1; + Projectile.extraUpdates = 2; Projectile.tileCollide = false; Projectile.DamageType = DamageClass.Melee; - Projectile.timeLeft = 60; + Projectile.timeLeft = 200; } public override void AI() @@ -29,20 +32,20 @@ namespace CalamityMod.Projectiles.Melee { for (int i = 0; i < 5; i++) { - int shiny = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 159, 0f, 0f, 100, default, 0.5f); + int shiny = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Teleporter, 0f, 0f, 100, default, 0.5f); Main.dust[shiny].noGravity = true; Main.dust[shiny].velocity *= 0f; } } - CalamityUtils.HomeInOnNPC(Projectile, true, 200f, 12f, 20f); + CalamityUtils.HomeInOnNPC(Projectile, true, 2000f, 10f, 20f); } public override void OnKill(int timeLeft) { for (int k = 0; k < 5; k++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 159, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Teleporter, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } diff --git a/Projectiles/Melee/ScourgeoftheCosmosMini.cs b/Projectiles/Melee/ScourgeoftheCosmosMini.cs index c7c74e0569..3660315b2e 100644 --- a/Projectiles/Melee/ScourgeoftheCosmosMini.cs +++ b/Projectiles/Melee/ScourgeoftheCosmosMini.cs @@ -1,6 +1,6 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ModLoader; @@ -147,8 +147,8 @@ namespace CalamityMod.Projectiles.Melee public override void PostDraw(Color lightColor) { - Texture2D texture2D13 = ModContent.Request(Texture).Value; - int framing = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; + Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + int framing = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; int y6 = framing * Projectile.frame; Vector2 origin = new Vector2(9f, 10f); Main.EntitySpriteDraw(ModContent.Request("CalamityMod/Projectiles/Melee/ScourgeoftheCosmosMiniGlow").Value, Projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, framing)), Color.White, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0); diff --git a/Projectiles/Melee/ScourgeoftheCosmosProj.cs b/Projectiles/Melee/ScourgeoftheCosmosProj.cs index 5fa7b6724f..bb5bb91e57 100644 --- a/Projectiles/Melee/ScourgeoftheCosmosProj.cs +++ b/Projectiles/Melee/ScourgeoftheCosmosProj.cs @@ -1,9 +1,9 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -51,7 +51,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.alpha -= 50; if (Projectile.alpha < 0) Projectile.alpha = 0; - Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + 0.785f; + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver4; Projectile.ai[0] += 1f; if (Projectile.ai[0] >= 180f) { @@ -107,7 +107,7 @@ namespace CalamityMod.Projectiles.Melee for (int i = 0; i < 10; i = inc + 1) { int dustType = Main.rand.NextBool(3) ? 56 : 242; - int killedDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 0, default, 1f); + int killedDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 0, default, 1f); Dust dust = Main.dust[killedDust]; dust.scale *= 1.1f; Main.dust[killedDust].noGravity = true; @@ -116,7 +116,7 @@ namespace CalamityMod.Projectiles.Melee for (int j = 0; j < 15; j = inc + 1) { int dustType = Main.rand.NextBool(3) ? 56 : 242; - int killedDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 0, default, 1f); + int killedDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 0, default, 1f); Dust dust = Main.dust[killedDust2]; dust.velocity *= 2.5f; dust = Main.dust[killedDust2]; diff --git a/Projectiles/Melee/SeashineSwordProj.cs b/Projectiles/Melee/SeashineSwordProj.cs index 1204a9392d..91b63de8bb 100644 --- a/Projectiles/Melee/SeashineSwordProj.cs +++ b/Projectiles/Melee/SeashineSwordProj.cs @@ -1,45 +1,117 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { public class SeashineSwordProj : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; + + private const int TimeLeft = 600; + + private const int MaxAlpha = 255; + + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + } + public override void SetDefaults() { - Projectile.width = 20; - Projectile.height = 20; - Projectile.aiStyle = ProjAIStyleID.Beam; + Projectile.width = 16; + Projectile.height = 16; Projectile.friendly = true; Projectile.penetrate = 1; Projectile.tileCollide = true; Projectile.DamageType = DamageClass.Melee; - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(127, 255, 253); + Projectile.timeLeft = TimeLeft; + Projectile.alpha = MaxAlpha; } public override void AI() { - Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.25f / 255f, (255 - Projectile.alpha) * 0.25f / 255f); - if (Main.rand.NextBool()) + Lighting.AddLight(Projectile.Center, 0f, (byte.MaxValue - Projectile.alpha) * 0.5f / byte.MaxValue, (byte.MaxValue - Projectile.alpha) * 0.5f / byte.MaxValue); + + if (Projectile.localAI[1] < 7f) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 187, Projectile.velocity.X * 0.25f, Projectile.velocity.Y * 0.25f, 0, new Color(255, 255, 255), 1.2f); + Projectile.localAI[1] += 1f; } + else + { + float dustScale = 1.8f * Projectile.scale; + int dust = Dust.NewDust(new Vector2(Projectile.position.X - Projectile.velocity.X + 2f, Projectile.position.Y + 2f - Projectile.velocity.Y), 8, 8, DustID.Flare_Blue, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, Projectile.alpha, default, dustScale); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= -0.25f; + + dust = Dust.NewDust(new Vector2(Projectile.position.X - Projectile.velocity.X + 2f, Projectile.position.Y + 2f - Projectile.velocity.Y), 8, 8, DustID.Flare_Blue, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, Projectile.alpha, default, dustScale); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= -0.25f; + Main.dust[dust].position -= Projectile.velocity * 0.5f; + + if (Projectile.localAI[0] == 0f) + { + Projectile.scale -= 0.02f; + Projectile.alpha += 10; + if (Projectile.alpha >= MaxAlpha - 5) + { + Projectile.alpha = MaxAlpha; + Projectile.localAI[0] = 1f; + } + } + else if (Projectile.localAI[0] == 1f) + { + Projectile.scale += 0.02f; + Projectile.alpha -= 10; + if (Projectile.alpha <= 0) + { + Projectile.alpha = 0; + Projectile.localAI[0] = 0f; + } + } + } + + if (Projectile.ai[1] == 0f) + { + Projectile.ai[1] = 1f; + SoundEngine.PlaySound(SoundID.Item8, Projectile.Center); + } + + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver4; } + public override bool PreDraw(ref Color lightColor) + { + if (Projectile.timeLeft > TimeLeft - 5) + return false; + + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); + return false; + } + + public override Color? GetAlpha(Color lightColor) => new Color(128, byte.MaxValue, byte.MaxValue); + public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item10, Projectile.position); - for (int k = 0; k < 5; k++) + SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); + + for (int i = 4; i < 31; i++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 187, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 0, new Color(255, 255, 255), 1.5f); + float oldXVel = Projectile.oldVelocity.X * (30f / (float)i); + float oldYVel = Projectile.oldVelocity.Y * (30f / (float)i); + + float dustScale = 3.6f * Projectile.scale; + int dust = Dust.NewDust(new Vector2(Projectile.oldPosition.X - oldXVel * 0.5f, Projectile.oldPosition.Y - oldYVel * 0.5f), 8, 8, DustID.Flare_Blue, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, Projectile.alpha, default, dustScale); + Main.dust[dust].noGravity = true; + + dustScale = 3f * Projectile.scale; + dust = Dust.NewDust(new Vector2(Projectile.oldPosition.X - oldXVel * 0.5f, Projectile.oldPosition.Y - oldYVel * 0.5f), 8, 8, DustID.Flare_Blue, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, Projectile.alpha, default, dustScale); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0.1f; } } } diff --git a/Projectiles/Melee/Shortswords/CosmicShivProj.cs b/Projectiles/Melee/Shortswords/CosmicShivProj.cs index a22c6cb94b..15a8518531 100644 --- a/Projectiles/Melee/Shortswords/CosmicShivProj.cs +++ b/Projectiles/Melee/Shortswords/CosmicShivProj.cs @@ -1,10 +1,10 @@ +using System; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.GameContent; using Terraria.Graphics; @@ -61,7 +61,9 @@ namespace CalamityMod.Projectiles.Melee.Shortswords { OnHitEffect(); - if (NumHits < 3) { // Just to avoid insanity from stacking so many super dummies or hitting many worm segments at once + if (NumHits < 3) + { + // Just to avoid insanity from stacking so many super dummies or hitting many worm segments at once // 2x bonus for true melee hits (spawns an additional aura plus the one aura from the cosmic shiv ball) Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.position, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, target.whoAmI); NumHits++; @@ -91,7 +93,7 @@ namespace CalamityMod.Projectiles.Melee.Shortswords float scale = Main.rand.NextFloat(1.5f, 1.9f); float randomWhitingValue = Main.rand.NextFloat(0.0f, 0.2f); Color color = Color.Lerp(CosmicShivTrail.DustColors[Main.rand.Next(0, CosmicShivTrail.DustColors.Count)], Color.White, randomWhitingValue); // Just for even more variety in colors idk - Vector2 velocity = StarPolarEquation(petalCount, k, rand2PI) * speed * 2; + Vector2 velocity = StarPolarEquation(petalCount, k, rand2PI) * speed * 2f; Dust dust = Dust.NewDustPerfect(Projectile.Center, DustID.FireworksRGB, velocity, 0, color, scale); dust.noGravity = true; dust.fadeIn = -1f; // I don't know if this does anything but it looks like the dust fades out faster with this diff --git a/Projectiles/Melee/Shortswords/ElementalShivProj.cs b/Projectiles/Melee/Shortswords/ElementalShivProj.cs index 02f4186d60..7be4025f5c 100644 --- a/Projectiles/Melee/Shortswords/ElementalShivProj.cs +++ b/Projectiles/Melee/Shortswords/ElementalShivProj.cs @@ -1,8 +1,8 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.Localization; @@ -10,7 +10,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee.Shortswords { - public class ElementalShivProj: BaseShortswordProjectile + public class ElementalShivProj : BaseShortswordProjectile { public override LocalizedText DisplayName => CalamityUtils.GetItemName(); public override string Texture => "CalamityMod/Items/Weapons/Melee/ElementalShiv"; @@ -54,7 +54,7 @@ namespace CalamityMod.Projectiles.Melee.Shortswords { if (Main.rand.NextBool(5)) { - int rainbowDust = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 66, (float)(Projectile.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.3f); + int rainbowDust = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.RainbowTorch, (float)(Projectile.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.3f); Main.dust[rainbowDust].velocity *= 0.2f; Main.dust[rainbowDust].noGravity = true; } diff --git a/Projectiles/Melee/Shortswords/GalileoGladiusProj.cs b/Projectiles/Melee/Shortswords/GalileoGladiusProj.cs index c57f33da20..bf94ea1dc1 100644 --- a/Projectiles/Melee/Shortswords/GalileoGladiusProj.cs +++ b/Projectiles/Melee/Shortswords/GalileoGladiusProj.cs @@ -1,8 +1,8 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.Localization; diff --git a/Projectiles/Melee/Shortswords/LucreciaProj.cs b/Projectiles/Melee/Shortswords/LucreciaProj.cs index 10b8d63316..2517332b34 100644 --- a/Projectiles/Melee/Shortswords/LucreciaProj.cs +++ b/Projectiles/Melee/Shortswords/LucreciaProj.cs @@ -1,7 +1,7 @@ -using CalamityMod.Items.Weapons.Melee; +using System; +using CalamityMod.Items.Weapons.Melee; using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.Localization; @@ -9,9 +9,8 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee.Shortswords { - public class LucreciaProj: BaseShortswordProjectile + public class LucreciaProj : BaseShortswordProjectile { - public const int OnHitIFrames = 5; public override LocalizedText DisplayName => CalamityUtils.GetItemName(); public override string Texture => "CalamityMod/Items/Weapons/Melee/Lucrecia"; @@ -32,7 +31,7 @@ namespace CalamityMod.Projectiles.Melee.Shortswords public override Action EffectBeforePullback => (proj) => { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity * 12f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity * 10f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); }; @@ -54,25 +53,5 @@ namespace CalamityMod.Projectiles.Melee.Shortswords if (Main.rand.NextBool(5)) Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.BoneTorch); } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - Main.player[Projectile.owner].GiveIFrames(OnHitIFrames, false); - } - - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - Player player = Main.player[Projectile.owner]; - bool isImmune = false; - for (int j = 0; j < player.hurtCooldowns.Length; j++) - { - if (player.hurtCooldowns[j] > 0) - isImmune = true; - } - if (!isImmune) - { - Owner.GiveIFrames(OnHitIFrames, true); - } - } } } diff --git a/Projectiles/Melee/Shortswords/SaharaSlicersBlade.cs b/Projectiles/Melee/Shortswords/SaharaSlicersBlade.cs index ce100b8ac6..21b5e40527 100644 --- a/Projectiles/Melee/Shortswords/SaharaSlicersBlade.cs +++ b/Projectiles/Melee/Shortswords/SaharaSlicersBlade.cs @@ -1,7 +1,7 @@ -using CalamityMod.Items.Weapons.Melee; +using System; +using CalamityMod.Items.Weapons.Melee; using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.Localization; @@ -9,7 +9,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee.Shortswords { - public class SaharaSlicersBlade: BaseShortswordProjectile + public class SaharaSlicersBlade : BaseShortswordProjectile { public override LocalizedText DisplayName => CalamityUtils.GetItemName(); public override string Texture => "CalamityMod/Projectiles/Melee/SaharaSlicersBlade"; diff --git a/Projectiles/Melee/Shortswords/SaharaSlicersBladeAlt.cs b/Projectiles/Melee/Shortswords/SaharaSlicersBladeAlt.cs index f0b332d2fe..2b361ba73d 100644 --- a/Projectiles/Melee/Shortswords/SaharaSlicersBladeAlt.cs +++ b/Projectiles/Melee/Shortswords/SaharaSlicersBladeAlt.cs @@ -1,8 +1,8 @@ -using CalamityMod.Items.Weapons.Melee; +using System; +using CalamityMod.Items.Weapons.Melee; using CalamityMod.Projectiles.BaseProjectiles; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.Localization; @@ -11,7 +11,7 @@ using static Humanizer.In; namespace CalamityMod.Projectiles.Melee.Shortswords { - public class SaharaSlicersBladeAlt: BaseShortswordProjectile + public class SaharaSlicersBladeAlt : BaseShortswordProjectile { public override LocalizedText DisplayName => CalamityUtils.GetItemName(); public override string Texture => "CalamityMod/Projectiles/Melee/SaharaSlicersBladeAlt"; diff --git a/Projectiles/Melee/Shortswords/SubmarineShockerProj.cs b/Projectiles/Melee/Shortswords/SubmarineShockerProj.cs index 4c385d792f..d14369a186 100644 --- a/Projectiles/Melee/Shortswords/SubmarineShockerProj.cs +++ b/Projectiles/Melee/Shortswords/SubmarineShockerProj.cs @@ -8,7 +8,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee.Shortswords { - public class SubmarineShockerProj: BaseShortswordProjectile + public class SubmarineShockerProj : BaseShortswordProjectile { public override LocalizedText DisplayName => CalamityUtils.GetItemName(); public override string Texture => "CalamityMod/Items/Weapons/Melee/SubmarineShocker"; @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Melee.Shortswords Projectile.hide = true; Projectile.ownerHitCheck = true; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 8; + Projectile.localNPCHitCooldown = -1; } public override void SetVisualOffsets() @@ -48,11 +48,6 @@ namespace CalamityMod.Projectiles.Melee.Shortswords Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Electric); } - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) - { - modifiers.CritDamage *= 0.5f; - } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { var source = Projectile.GetSource_FromThis(); diff --git a/Projectiles/Melee/SolarNeedle.cs b/Projectiles/Melee/SolarNeedle.cs index e31dda80f9..a2cb9c4f29 100644 --- a/Projectiles/Melee/SolarNeedle.cs +++ b/Projectiles/Melee/SolarNeedle.cs @@ -1,15 +1,15 @@ -using CalamityMod.Particles; -using Terraria.Graphics.Shaders; +using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; +using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; -using static Terraria.ModLoader.ModContent; using static CalamityMod.CalamityUtils; -using Terraria.Audio; -using CalamityMod.Buffs.DamageOverTime; +using static Terraria.ModLoader.ModContent; namespace CalamityMod.Projectiles.Melee @@ -57,7 +57,7 @@ namespace CalamityMod.Projectiles.Melee if (Main.rand.NextBool(3)) { - int dustTrail = Dust.NewDust(Projectile.Center, 14, 14, 66, Projectile.velocity.X * 0.05f, Projectile.velocity.Y * 0.05f, 150, new Color(Main.DiscoR, 100, 255), 1.2f); + int dustTrail = Dust.NewDust(Projectile.Center, 14, 14, DustID.RainbowTorch, Projectile.velocity.X * 0.05f, Projectile.velocity.Y * 0.05f, 150, new Color(Main.DiscoR, 100, 255), 1.2f); Main.dust[dustTrail].noGravity = true; } @@ -114,7 +114,7 @@ namespace CalamityMod.Projectiles.Melee Vector2 sparkCenter = Projectile.Center - Utils.SafeNormalize(Projectile.velocity, Vector2.Zero) * 30.5f - Main.screenPosition; - Main.EntitySpriteDraw(bloomTexture, sparkCenter, null, color* 0.5f, 0, bloomTexture.Size() / 2f, 4 * properBloomSize, SpriteEffects.None, 0); + Main.EntitySpriteDraw(bloomTexture, sparkCenter, null, color * 0.5f, 0, bloomTexture.Size() / 2f, 4 * properBloomSize, SpriteEffects.None, 0); Main.EntitySpriteDraw(starTexture, sparkCenter, null, color * 0.5f, rotation + MathHelper.PiOver4, starTexture.Size() / 2f, 2 * 0.75f, SpriteEffects.None, 0); Main.EntitySpriteDraw(starTexture, sparkCenter, null, Color.White, rotation, starTexture.Size() / 2f, 2, SpriteEffects.None, 0); diff --git a/Projectiles/Melee/SolsticeBeam.cs b/Projectiles/Melee/SolsticeBeam.cs index bd8ee4572f..909c591cff 100644 --- a/Projectiles/Melee/SolsticeBeam.cs +++ b/Projectiles/Melee/SolsticeBeam.cs @@ -1,11 +1,11 @@ +using System; using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { public class SolsticeBeam : ModProjectile, ILocalizedModType @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { Lighting.AddLight(Projectile.Center, 0.5f, 0.5f, 0.5f); - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 0.785f; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4; if (Projectile.ai[1] == 0f) { Projectile.ai[1] = 1f; @@ -130,7 +130,7 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.timeLeft > 595) return false; - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } diff --git a/Projectiles/Melee/SoulScythe.cs b/Projectiles/Melee/SoulScythe.cs index 9e2dea1ba9..8e22c60646 100644 --- a/Projectiles/Melee/SoulScythe.cs +++ b/Projectiles/Melee/SoulScythe.cs @@ -1,9 +1,9 @@ -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { diff --git a/Projectiles/Melee/SoulScytheExplosion.cs b/Projectiles/Melee/SoulScytheExplosion.cs index 5b3fc595f6..4e59925bfe 100644 --- a/Projectiles/Melee/SoulScytheExplosion.cs +++ b/Projectiles/Melee/SoulScytheExplosion.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Projectiles.Melee { for (int i = 0; i < 30; i++) { - int soulDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 89, 0f, 0f, 100, default, 2f); + int soulDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GemEmerald, 0f, 0f, 100, default, 2f); Main.dust[soulDust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -41,10 +41,10 @@ namespace CalamityMod.Projectiles.Melee } for (int j = 0; j < 50; j++) { - int soulDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 89, 0f, 0f, 100, default, 3f); + int soulDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GemEmerald, 0f, 0f, 100, default, 3f); Main.dust[soulDust2].noGravity = true; Main.dust[soulDust2].velocity *= 5f; - soulDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 89, 0f, 0f, 100, default, 2f); + soulDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GemEmerald, 0f, 0f, 100, default, 2f); Main.dust[soulDust2].velocity *= 2f; } } diff --git a/Projectiles/Melee/Spark.cs b/Projectiles/Melee/Spark.cs index 31483c64cc..a9d5e316f1 100644 --- a/Projectiles/Melee/Spark.cs +++ b/Projectiles/Melee/Spark.cs @@ -1,6 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Melee { public class Spark : ModProjectile, ILocalizedModType @@ -50,7 +52,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.velocity.Y = Projectile.velocity.Y + 0.2f; } Projectile.rotation += Projectile.velocity.X * 0.1f; - int sparky = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 206, 0f, 0f, 100, default, 1f); + int sparky = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.UnusedWhiteBluePurple, 0f, 0f, 100, default, 1f); Dust expr_8976_cp_0 = Main.dust[sparky]; expr_8976_cp_0.position.X -= 2f; Dust expr_8994_cp_0 = Main.dust[sparky]; @@ -61,7 +63,7 @@ namespace CalamityMod.Projectiles.Melee expr_89E7_cp_0.velocity.Y -= 2f; if (Main.rand.NextBool()) { - int sparkier = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 206, 0f, 0f, 100, default, 1f); + int sparkier = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.UnusedWhiteBluePurple, 0f, 0f, 100, default, 1f); Dust expr_8A4E_cp_0 = Main.dust[sparkier]; expr_8A4E_cp_0.position.X -= 2f; Dust expr_8A6C_cp_0 = Main.dust[sparkier]; diff --git a/Projectiles/Melee/SpatialSpear.cs b/Projectiles/Melee/SpatialSpear.cs index 082eeec0c0..8d06a0e6d5 100644 --- a/Projectiles/Melee/SpatialSpear.cs +++ b/Projectiles/Melee/SpatialSpear.cs @@ -1,45 +1,59 @@ -using Microsoft.Xna.Framework; +using System; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using CalamityMod.Buffs.DamageOverTime; namespace CalamityMod.Projectiles.Melee { public class SpatialSpear : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; + + private const int TimeLeft = 180; + + private const int TimeToFall = TimeLeft / 2; + + private const int TotalSplits = 6; + + private const int SplitTime = TimeLeft / TotalSplits; + + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + } + public override void SetDefaults() { - Projectile.width = 10; - Projectile.height = 10; + Projectile.width = 16; + Projectile.height = 16; Projectile.friendly = true; Projectile.DamageType = DamageClass.Melee; - Projectile.tileCollide = false; Projectile.penetrate = -1; - Projectile.timeLeft = 90; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 6; + Projectile.timeLeft = TimeLeft; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() { Lighting.AddLight(Projectile.Center, 0.05f, 1f, 0.05f); + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver4; - Projectile.ai[0] += 1f; - if (Projectile.ai[0] > 30f) + + if (Projectile.timeLeft < TimeToFall) { - Projectile.ai[0] = 30f; - Projectile.velocity.Y += 0.1f; + Projectile.velocity.Y += 0.16f; if (Projectile.velocity.Y > 16f) - { Projectile.velocity.Y = 16f; - } - Projectile.velocity.X *= 0.98f; + + Projectile.velocity.X *= 0.995f; } + if (Projectile.localAI[1] == 0f) { Projectile.scale -= 0.01f; @@ -60,54 +74,61 @@ namespace CalamityMod.Projectiles.Melee Projectile.localAI[1] = 0f; } } - if (Main.rand.NextBool(8)) - { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 107, Projectile.velocity.X * 0.1f, Projectile.velocity.Y * 0.1f); - } + + int dust = Dust.NewDust(Projectile.oldPosition + Projectile.oldVelocity, Projectile.width, Projectile.height, DustID.TerraBlade, 0f, 0f, 100, default, 1.25f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0f; + Main.dust[dust].noLightEmittence = true; + Projectile.localAI[0] += 1f; - if (Projectile.localAI[0] >= 30f) + if (Projectile.localAI[0] >= SplitTime) { Projectile.localAI[0] = 0f; int numProj = 2; - float rotation = MathHelper.ToRadians(10); + float rotation = MathHelper.ToRadians(5); + float velocity = 16f; if (Projectile.owner == Main.myPlayer) { - for (int i = 0; i < numProj + 1; i++) + for (int i = 0; i < numProj; i++) { - Vector2 perturbedSpeed = Projectile.velocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, perturbedSpeed, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack * 0.5f, Projectile.owner, 0f, 0f); + Vector2 perturbedSpeed = Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, perturbedSpeed * velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.8), Projectile.knockBack * 0.5f, Projectile.owner); } } } } + public override Color? GetAlpha(Color lightColor) => new Color(128, byte.MaxValue, 128); + public override bool PreDraw(ref Color lightColor) { - if (Projectile.timeLeft > 85) + if (Projectile.timeLeft > TimeLeft - 5) return false; - Texture2D tex = ModContent.Request(Texture).Value; - Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); return false; } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(ModContent.BuffType(), 30); } + public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item10, Projectile.position); - for (int i = 4; i < 12; i++) + SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); + for (int i = 4; i < 31; i++) { float projOldX = Projectile.oldVelocity.X * (30f / i); float projOldY = Projectile.oldVelocity.Y * (30f / i); - int spatial = Dust.NewDust(new Vector2(Projectile.oldPosition.X - projOldX, Projectile.oldPosition.Y - projOldY), 8, 8, 107, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.8f); - Main.dust[spatial].noGravity = true; - Dust dust = Main.dust[spatial]; - dust.velocity *= 0.5f; - spatial = Dust.NewDust(new Vector2(Projectile.oldPosition.X - projOldX, Projectile.oldPosition.Y - projOldY), 8, 8, 107, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.4f); - dust = Main.dust[spatial]; - dust.velocity *= 0.05f; + int dust = Dust.NewDust(new Vector2(Projectile.oldPosition.X - projOldX, Projectile.oldPosition.Y - projOldY), 8, 8, DustID.TerraBlade, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.8f); + Main.dust[dust].noGravity = true; + Main.dust[dust].noLightEmittence = true; + + dust = Dust.NewDust(new Vector2(Projectile.oldPosition.X - projOldX, Projectile.oldPosition.Y - projOldY), 8, 8, DustID.TerraBlade, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.4f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0.1f; + Main.dust[dust].noLightEmittence = true; } } } diff --git a/Projectiles/Melee/SpatialSpear2.cs b/Projectiles/Melee/SpatialSpear2.cs index 7deac57c88..bcf1a5c36b 100644 --- a/Projectiles/Melee/SpatialSpear2.cs +++ b/Projectiles/Melee/SpatialSpear2.cs @@ -1,32 +1,59 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Melee { public class SpatialSpear2 : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; + + private const int TimeLeft = 100; + + private const int TimeToFall = TimeLeft / 2; + + private const int TotalSplits = 3; + + private const int SplitTime = TimeLeft / TotalSplits; + + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + } + public override void SetDefaults() { - Projectile.width = 10; - Projectile.height = 10; + Projectile.width = 16; + Projectile.height = 16; Projectile.friendly = true; Projectile.DamageType = DamageClass.Melee; - Projectile.tileCollide = false; - Projectile.penetrate = 2; - Projectile.timeLeft = 60; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 6; + Projectile.penetrate = 3; + Projectile.timeLeft = TimeLeft; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() { Lighting.AddLight(Projectile.Center, 0.05f, 0.05f, 1f); + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver4; + + if (Projectile.timeLeft < TimeToFall) + { + Projectile.velocity.Y += 0.16f; + if (Projectile.velocity.Y > 16f) + Projectile.velocity.Y = 16f; + + Projectile.velocity.X *= 0.995f; + } + if (Projectile.localAI[1] == 0f) { Projectile.scale -= 0.01f; @@ -47,53 +74,61 @@ namespace CalamityMod.Projectiles.Melee Projectile.localAI[1] = 0f; } } - if (Main.rand.NextBool(8)) - { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 56, Projectile.velocity.X * 0.1f, Projectile.velocity.Y * 0.1f); - } + + int dust = Dust.NewDust(Projectile.oldPosition + Projectile.oldVelocity, Projectile.width, Projectile.height, DustID.BlueFairy, 0f, 0f, 100, default, 1.25f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0f; + Main.dust[dust].noLightEmittence = true; + Projectile.localAI[0] += 1f; - if (Projectile.localAI[0] >= 30f) + if (Projectile.localAI[0] >= SplitTime) { Projectile.localAI[0] = 0f; int numProj = 2; float rotation = MathHelper.ToRadians(10); + float velocity = 16f; if (Projectile.owner == Main.myPlayer) { - for (int i = 0; i < numProj + 1; i++) + for (int i = 0; i < numProj; i++) { - Vector2 perturbedSpeed = Projectile.velocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, perturbedSpeed, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack * 0.5f, Projectile.owner, 0f, 0f); + Vector2 perturbedSpeed = Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, perturbedSpeed * velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.8), Projectile.knockBack * 0.5f, Projectile.owner); } } } } + public override Color? GetAlpha(Color lightColor) => new Color(128, 128, byte.MaxValue); + public override bool PreDraw(ref Color lightColor) { - if (Projectile.timeLeft > 55) + if (Projectile.timeLeft > TimeLeft - 5) return false; - Texture2D tex = ModContent.Request(Texture).Value; - Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); return false; } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(ModContent.BuffType(), 30); } + public override void OnKill(int timeLeft) { - for (int i = 4; i < 12; i++) + SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); + for (int i = 4; i < 31; i++) { float projOldX = Projectile.oldVelocity.X * (30f / i); float projOldY = Projectile.oldVelocity.Y * (30f / i); - int spatial = Dust.NewDust(new Vector2(Projectile.oldPosition.X - projOldX, Projectile.oldPosition.Y - projOldY), 8, 8, 56, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.8f); - Main.dust[spatial].noGravity = true; - Dust dust = Main.dust[spatial]; - dust.velocity *= 0.5f; - spatial = Dust.NewDust(new Vector2(Projectile.oldPosition.X - projOldX, Projectile.oldPosition.Y - projOldY), 8, 8, 56, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.4f); - dust = Main.dust[spatial]; - dust.velocity *= 0.05f; + int dust = Dust.NewDust(new Vector2(Projectile.oldPosition.X - projOldX, Projectile.oldPosition.Y - projOldY), 8, 8, DustID.BlueFairy, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.8f); + Main.dust[dust].noGravity = true; + Main.dust[dust].noLightEmittence = true; + + dust = Dust.NewDust(new Vector2(Projectile.oldPosition.X - projOldX, Projectile.oldPosition.Y - projOldY), 8, 8, DustID.BlueFairy, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.4f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0.1f; + Main.dust[dust].noLightEmittence = true; } } } diff --git a/Projectiles/Melee/SpatialSpear3.cs b/Projectiles/Melee/SpatialSpear3.cs index 00b8011745..db84085d23 100644 --- a/Projectiles/Melee/SpatialSpear3.cs +++ b/Projectiles/Melee/SpatialSpear3.cs @@ -1,30 +1,59 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Melee { public class SpatialSpear3 : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; + + private const int TimeLeft = 75; + + private const int TimeToFall = TimeLeft / 2; + + private const int TotalSplits = 2; + + private const int SplitTime = TimeLeft / TotalSplits; + + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + } + public override void SetDefaults() { - Projectile.width = 10; - Projectile.height = 10; + Projectile.width = 16; + Projectile.height = 16; Projectile.friendly = true; Projectile.DamageType = DamageClass.Melee; - Projectile.tileCollide = false; - Projectile.penetrate = 1; - Projectile.timeLeft = 40; + Projectile.penetrate = 2; + Projectile.timeLeft = TimeLeft; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() { Lighting.AddLight(Projectile.Center, 1f, 0.05f, 0.05f); + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver4; + + if (Projectile.timeLeft < TimeToFall) + { + Projectile.velocity.Y += 0.16f; + if (Projectile.velocity.Y > 16f) + Projectile.velocity.Y = 16f; + + Projectile.velocity.X *= 0.995f; + } + if (Projectile.localAI[1] == 0f) { Projectile.scale -= 0.01f; @@ -45,53 +74,60 @@ namespace CalamityMod.Projectiles.Melee Projectile.localAI[1] = 0f; } } - if (Main.rand.NextBool(8)) - { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 73, Projectile.velocity.X * 0.1f, Projectile.velocity.Y * 0.1f); - } + + int dust = Dust.NewDust(Projectile.oldPosition + Projectile.oldVelocity, Projectile.width, Projectile.height, DustID.PinkFairy, 0f, 0f, 100, default, 1.25f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0f; + Main.dust[dust].noLightEmittence = true; + Projectile.localAI[0] += 1f; - if (Projectile.localAI[0] >= 30f) + if (Projectile.localAI[0] >= SplitTime) { Projectile.localAI[0] = 0f; int numProj = 2; float rotation = MathHelper.ToRadians(20); + float velocity = 16f; if (Projectile.owner == Main.myPlayer) { - for (int i = 0; i < numProj + 1; i++) + for (int i = 0; i < numProj; i++) { - Vector2 perturbedSpeed = Projectile.velocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, perturbedSpeed, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack * 0.5f, Projectile.owner, 0f, 0f); + Vector2 perturbedSpeed = Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, perturbedSpeed * velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.8), Projectile.knockBack * 0.5f, Projectile.owner); } } } } + public override Color? GetAlpha(Color lightColor) => new Color(byte.MaxValue, 128, 128); + public override bool PreDraw(ref Color lightColor) { - if (Projectile.timeLeft > 35) + if (Projectile.timeLeft > TimeLeft - 5) return false; - Texture2D tex = ModContent.Request(Texture).Value; - Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); return false; } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(ModContent.BuffType(), 30); } + public override void OnKill(int timeLeft) { - for (int i = 4; i < 12; i++) + for (int i = 4; i < 31; i++) { float projOldX = Projectile.oldVelocity.X * (30f / i); float projOldY = Projectile.oldVelocity.Y * (30f / i); - int spatial = Dust.NewDust(new Vector2(Projectile.oldPosition.X - projOldX, Projectile.oldPosition.Y - projOldY), 8, 8, 73, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.8f); - Main.dust[spatial].noGravity = true; - Dust dust = Main.dust[spatial]; - dust.velocity *= 0.5f; - spatial = Dust.NewDust(new Vector2(Projectile.oldPosition.X - projOldX, Projectile.oldPosition.Y - projOldY), 8, 8, 73, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.4f); - dust = Main.dust[spatial]; - dust.velocity *= 0.05f; + int dust = Dust.NewDust(new Vector2(Projectile.oldPosition.X - projOldX, Projectile.oldPosition.Y - projOldY), 8, 8, DustID.PinkFairy, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.8f); + Main.dust[dust].noGravity = true; + Main.dust[dust].noLightEmittence = true; + + dust = Dust.NewDust(new Vector2(Projectile.oldPosition.X - projOldX, Projectile.oldPosition.Y - projOldY), 8, 8, DustID.PinkFairy, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.4f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0.1f; + Main.dust[dust].noLightEmittence = true; } } } diff --git a/Projectiles/Melee/SpatialSpear4.cs b/Projectiles/Melee/SpatialSpear4.cs index 89f1712f64..85754074fa 100644 --- a/Projectiles/Melee/SpatialSpear4.cs +++ b/Projectiles/Melee/SpatialSpear4.cs @@ -1,30 +1,54 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Melee { public class SpatialSpear4 : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; + + private const int TimeLeft = 60; + + private const int TimeToFall = TimeLeft / 2; + + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + } + public override void SetDefaults() { - Projectile.width = 10; - Projectile.height = 10; + Projectile.width = 16; + Projectile.height = 16; Projectile.friendly = true; Projectile.DamageType = DamageClass.Melee; - Projectile.tileCollide = false; - Projectile.penetrate = 1; - Projectile.timeLeft = 25; + Projectile.timeLeft = TimeLeft; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() { Lighting.AddLight(Projectile.Center, 0.5f, 0.5f, 0.05f); + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver4; + + if (Projectile.timeLeft < TimeToFall) + { + Projectile.velocity.Y += 0.16f; + if (Projectile.velocity.Y > 16f) + Projectile.velocity.Y = 16f; + + Projectile.velocity.X *= 0.995f; + } + if (Projectile.localAI[1] == 0f) { Projectile.scale -= 0.01f; @@ -45,38 +69,43 @@ namespace CalamityMod.Projectiles.Melee Projectile.localAI[1] = 0f; } } - if (Main.rand.NextBool(8)) - { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 244, Projectile.velocity.X * 0.1f, Projectile.velocity.Y * 0.1f); - } + + int dust = Dust.NewDust(Projectile.oldPosition + Projectile.oldVelocity, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 100, default, 1.25f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0f; + Main.dust[dust].noLightEmittence = true; } + public override Color? GetAlpha(Color lightColor) => new Color(byte.MaxValue, byte.MaxValue, 128); + public override bool PreDraw(ref Color lightColor) { - if (Projectile.timeLeft > 20) + if (Projectile.timeLeft > TimeLeft - 5) return false; - Texture2D tex = ModContent.Request(Texture).Value; - Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); return false; } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(ModContent.BuffType(), 30); } + public override void OnKill(int timeLeft) { - for (int i = 4; i < 12; i++) + for (int i = 4; i < 31; i++) { float projOldX = Projectile.oldVelocity.X * (30f / i); float projOldY = Projectile.oldVelocity.Y * (30f / i); - int spatial = Dust.NewDust(new Vector2(Projectile.oldPosition.X - projOldX, Projectile.oldPosition.Y - projOldY), 8, 8, 244, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.8f); - Main.dust[spatial].noGravity = true; - Dust dust = Main.dust[spatial]; - dust.velocity *= 0.5f; - spatial = Dust.NewDust(new Vector2(Projectile.oldPosition.X - projOldX, Projectile.oldPosition.Y - projOldY), 8, 8, 244, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.4f); - dust = Main.dust[spatial]; - dust.velocity *= 0.05f; + int dust = Dust.NewDust(new Vector2(Projectile.oldPosition.X - projOldX, Projectile.oldPosition.Y - projOldY), 8, 8, DustID.CopperCoin, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.8f); + Main.dust[dust].noGravity = true; + Main.dust[dust].noLightEmittence = true; + + dust = Dust.NewDust(new Vector2(Projectile.oldPosition.X - projOldX, Projectile.oldPosition.Y - projOldY), 8, 8, DustID.CopperCoin, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.4f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0.1f; + Main.dust[dust].noLightEmittence = true; } } } diff --git a/Projectiles/Melee/Spears/AmidiasTridentProj.cs b/Projectiles/Melee/Spears/AmidiasTridentProj.cs index cfa1afb8fd..1581375c55 100644 --- a/Projectiles/Melee/Spears/AmidiasTridentProj.cs +++ b/Projectiles/Melee/Spears/AmidiasTridentProj.cs @@ -1,6 +1,6 @@ -using CalamityMod.Items.Weapons.Melee; +using System; +using CalamityMod.Items.Weapons.Melee; using CalamityMod.Projectiles.BaseProjectiles; -using System; using Terraria; using Terraria.ID; using Terraria.Localization; diff --git a/Projectiles/Melee/Spears/AstralPikeProj.cs b/Projectiles/Melee/Spears/AstralPikeProj.cs index 0b1c511d4d..2c1f92d4d1 100644 --- a/Projectiles/Melee/Spears/AstralPikeProj.cs +++ b/Projectiles/Melee/Spears/AstralPikeProj.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Projectiles.Melee.Spears public override float InitialSpeed => 3f; public override float ReelbackSpeed => 2.4f; - public override float ForwardSpeed => 0.95f; + public override float ForwardSpeed => 0.8f; public override void ExtraBehavior() { if (Main.rand.NextBool(5)) @@ -40,21 +40,18 @@ namespace CalamityMod.Projectiles.Melee.Spears public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(ModContent.BuffType(), 300); - if (hit.Crit) + var source = Projectile.GetSource_FromThis(); + for (int i = 0; i < 3; i++) { - var source = Projectile.GetSource_FromThis(); - for (int i = 0; i < 3; i++) - { - if (Projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) + { + Projectile star = CalamityUtils.ProjectileBarrage(source, Projectile.Center, target.Center, Main.rand.NextBool(), 800f, 800f, 800f, 800f, 10f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.33), 1f, Projectile.owner, true); + if (star.whoAmI.WithinBounds(Main.maxProjectiles)) { - Projectile star = CalamityUtils.ProjectileBarrage(source, Projectile.Center, target.Center, Main.rand.NextBool(), 800f, 800f, 800f, 800f, 10f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.4), 1f, Projectile.owner, true); - if (star.whoAmI.WithinBounds(Main.maxProjectiles)) - { - star.DamageType = DamageClass.Melee; - star.ai[0] = 3f; - } + star.DamageType = DamageClass.Melee; + star.ai[0] = 3f; } - } + } } } } diff --git a/Projectiles/Melee/Spears/BansheeHookProj.cs b/Projectiles/Melee/Spears/BansheeHookProj.cs index 20f1af3a11..d78dc5d844 100644 --- a/Projectiles/Melee/Spears/BansheeHookProj.cs +++ b/Projectiles/Melee/Spears/BansheeHookProj.cs @@ -1,9 +1,10 @@ -using CalamityMod.Items.Weapons.Melee; +using System; +using CalamityMod.Items.Weapons.Melee; using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -34,7 +35,7 @@ namespace CalamityMod.Projectiles.Melee.Spears public override float TravelSpeed => 22f; public override Action EffectBeforeReelback => (proj) => { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), + 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); @@ -65,7 +66,7 @@ namespace CalamityMod.Projectiles.Melee.Spears int i = 0; while (i < dustCount) { - Dust dust = Dust.NewDustDirect(Projectile.Center, 14, 14, 60, 0f, 0f, 110, default, 1f); + Dust dust = Dust.NewDustDirect(Projectile.Center, 14, 14, DustID.RedTorch, 0f, 0f, 110, default, 1f); dust.velocity = player.SafeDirectionTo(dust.position) * 2f; dust.position = Projectile.Center + initalVelocity.RotatedBy(completionAsAngle * 2f + i / dustCount * MathHelper.TwoPi) * 10f; @@ -76,7 +77,7 @@ namespace CalamityMod.Projectiles.Melee.Spears } if (Main.rand.NextBool(3)) { - Dust dust = Dust.NewDustDirect(Projectile.Center, 20, 20, 60, 0f, 0f, 110, default, 1f); + Dust dust = Dust.NewDustDirect(Projectile.Center, 20, 20, DustID.RedTorch, 0f, 0f, 110, default, 1f); dust.velocity = player.SafeDirectionTo(dust.position) * 2f; dust.position = Projectile.Center + directionTowardsEnd * -110f; dust.scale = 0.45f + Main.rand.NextFloat(0.4f); @@ -89,7 +90,7 @@ namespace CalamityMod.Projectiles.Melee.Spears public override bool PreDraw(ref Color lightColor) { Vector2 drawPosition = Projectile.position + new Vector2(Projectile.width, Projectile.height) / 2f + Vector2.UnitY * Projectile.gfxOffY - Main.screenPosition; - Texture2D alternateHookTexture = Projectile.spriteDirection == -1 ? ModContent.Request("CalamityMod/Projectiles/Melee/Spears/BansheeHookAlt").Value : ModContent.Request(Texture).Value; + Texture2D alternateHookTexture = Projectile.spriteDirection == -1 ? ModContent.Request("CalamityMod/Projectiles/Melee/Spears/BansheeHookAlt").Value : Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Vector2 origin = new Vector2(Projectile.spriteDirection == 1 ? alternateHookTexture.Width + 8f : -8f, -8f); Main.EntitySpriteDraw(alternateHookTexture, drawPosition, null, new Color(255, 255, 255, 127), Projectile.rotation, @@ -124,7 +125,7 @@ namespace CalamityMod.Projectiles.Melee.Spears { if (Projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), + 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); diff --git a/Projectiles/Melee/Spears/TerraLanceProjectile.cs b/Projectiles/Melee/Spears/BotanicPiercerProjectile.cs similarity index 67% rename from Projectiles/Melee/Spears/TerraLanceProjectile.cs rename to Projectiles/Melee/Spears/BotanicPiercerProjectile.cs index 9a160a22d2..6c829928f4 100644 --- a/Projectiles/Melee/Spears/TerraLanceProjectile.cs +++ b/Projectiles/Melee/Spears/BotanicPiercerProjectile.cs @@ -1,15 +1,16 @@ -using CalamityMod.Items.Weapons.Melee; +using System; +using CalamityMod.Items.Weapons.Melee; using CalamityMod.Projectiles.BaseProjectiles; -using System; using Terraria; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Melee.Spears { - public class TerraLanceProjectile : BaseSpearProjectile + public class BotanicPiercerProjectile : BaseSpearProjectile { - public override LocalizedText DisplayName => CalamityUtils.GetItemName(); + public override LocalizedText DisplayName => CalamityUtils.GetItemName(); public override void SetDefaults() { Projectile.width = Projectile.height = 40; @@ -27,16 +28,17 @@ namespace CalamityMod.Projectiles.Melee.Spears public override float InitialSpeed => 3f; public override float ReelbackSpeed => 2.4f; - public override float ForwardSpeed => 0.95f; + public override float ForwardSpeed => 0.8f; public override Action EffectBeforeReelback => (proj) => { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X + Projectile.velocity.X, Projectile.Center.Y + Projectile.velocity.Y, - Projectile.velocity.X * 1.4f, Projectile.velocity.Y * 1.4f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.7), Projectile.knockBack * 0.7f, Projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center - Projectile.velocity * 4f, Projectile.velocity * 1.4f, + ModContent.ProjectileType(), (int)(Projectile.damage * 0.7), Projectile.knockBack * 0.7f, Projectile.owner); }; + public override void ExtraBehavior() { if (Main.rand.NextBool(5)) - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 107, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.TerraBlade, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } } } diff --git a/Projectiles/Melee/Spears/BotanicPiercerProjectile.png b/Projectiles/Melee/Spears/BotanicPiercerProjectile.png new file mode 100644 index 0000000000..09fd646880 Binary files /dev/null and b/Projectiles/Melee/Spears/BotanicPiercerProjectile.png differ diff --git a/Projectiles/Melee/Spears/BrimlanceProj.cs b/Projectiles/Melee/Spears/BrimlanceProj.cs index 07d0b2f5d9..0dc86176b8 100644 --- a/Projectiles/Melee/Spears/BrimlanceProj.cs +++ b/Projectiles/Melee/Spears/BrimlanceProj.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Projectiles.Melee.Spears public override float InitialSpeed => 3f; public override float ReelbackSpeed => 2.4f; - public override float ForwardSpeed => 0.95f; + public override float ForwardSpeed => 0.7f; public override void ExtraBehavior() { if (Main.rand.NextBool(4)) diff --git a/Projectiles/Melee/Spears/DiseasedPikeSpear.cs b/Projectiles/Melee/Spears/DiseasedPikeSpear.cs index 4e1dd8bf3c..6446641068 100644 --- a/Projectiles/Melee/Spears/DiseasedPikeSpear.cs +++ b/Projectiles/Melee/Spears/DiseasedPikeSpear.cs @@ -28,11 +28,11 @@ namespace CalamityMod.Projectiles.Melee.Spears public override float InitialSpeed => 3f; public override float ReelbackSpeed => 2.4f; - public override float ForwardSpeed => 0.95f; + public override float ForwardSpeed => 0.8f; public override void ExtraBehavior() { if (Main.rand.NextBool(4)) - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 107, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.TerraBlade, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) diff --git a/Projectiles/Melee/Spears/EarthenPikeSpear.cs b/Projectiles/Melee/Spears/EarthenPikeSpear.cs index 0f0dbaba38..54416b823f 100644 --- a/Projectiles/Melee/Spears/EarthenPikeSpear.cs +++ b/Projectiles/Melee/Spears/EarthenPikeSpear.cs @@ -2,6 +2,7 @@ using CalamityMod.Items.Weapons.Melee; using CalamityMod.Projectiles.BaseProjectiles; using CalamityMod.Projectiles.Ranged; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.Localization; @@ -29,12 +30,9 @@ namespace CalamityMod.Projectiles.Melee.Spears public override float InitialSpeed => 3f; public override float ReelbackSpeed => 2.4f; - public override float ForwardSpeed => 0.95f; + public override float ForwardSpeed => 0.4f; public override void ExtraBehavior() { - if (Main.rand.NextBool(4)) - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 32, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); - Projectile.localAI[0] += 1f; if (Projectile.localAI[0] >= 6f) { @@ -44,8 +42,8 @@ namespace CalamityMod.Projectiles.Melee.Spears float velocityY = Projectile.velocity.Y * 1.25f; if (velocityY < 0.1f) velocityY = 0.1f; - int proj = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X + Projectile.velocity.X, Projectile.Center.Y + Projectile.velocity.Y, - Projectile.velocity.X * 1.25f, velocityY, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), 0f, Projectile.owner, 0f, 0f); + int proj = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, new Vector2(Projectile.velocity.X * 1.25f, velocityY), + ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack * 0.2f, Projectile.owner); if (proj.WithinBounds(Main.maxProjectiles)) Main.projectile[proj].DamageType = DamageClass.Melee; } diff --git a/Projectiles/Melee/Spears/ElementalLanceProjectile.cs b/Projectiles/Melee/Spears/ElementalLanceProjectile.cs index 1e307d5728..ddba5e6980 100644 --- a/Projectiles/Melee/Spears/ElementalLanceProjectile.cs +++ b/Projectiles/Melee/Spears/ElementalLanceProjectile.cs @@ -1,21 +1,23 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Melee.Spears { public class ElementalLanceProjectile : BaseSpearProjectile { public override LocalizedText DisplayName => CalamityUtils.GetItemName(); + public override void SetDefaults() { Projectile.width = Projectile.height = 40; - Projectile.DamageType = DamageClass.Melee; //Dictates whether this is a melee-class weapon. + Projectile.DamageType = DamageClass.Melee; Projectile.timeLeft = 90; Projectile.friendly = true; Projectile.hostile = false; @@ -24,24 +26,26 @@ namespace CalamityMod.Projectiles.Melee.Spears Projectile.penetrate = -1; Projectile.ownerHitCheck = true; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 7; + Projectile.localNPCHitCooldown = 6; } public override float InitialSpeed => 3f; public override float ReelbackSpeed => 1.1f; - public override float ForwardSpeed => 0.6f; + public override float ForwardSpeed => 0.5f; public override Action EffectBeforeReelback => (proj) => { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center + Projectile.velocity, Projectile.velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity.SafeNormalize(Vector2.UnitY) * 16f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); }; + public override void ExtraBehavior() { if (Main.rand.NextBool(5)) { - int idx = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 66, Projectile.direction * 2, 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + int idx = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.RainbowTorch, Projectile.direction * 2, 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); Main.dust[idx].noGravity = true; } } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(ModContent.BuffType(), 60); diff --git a/Projectiles/Melee/Spears/GildedProboscisProj.cs b/Projectiles/Melee/Spears/GildedProboscisProj.cs index 90265cc36b..3650ecb000 100644 --- a/Projectiles/Melee/Spears/GildedProboscisProj.cs +++ b/Projectiles/Melee/Spears/GildedProboscisProj.cs @@ -1,4 +1,6 @@ -using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Balancing; +using System; +using CalamityMod.Items.Weapons.Melee; using CalamityMod.Projectiles.BaseProjectiles; using Terraria; using Terraria.ID; @@ -28,24 +30,26 @@ namespace CalamityMod.Projectiles.Melee.Spears // These numbers sure are common, huh? yeah, they are public override float InitialSpeed => 3f; public override float ReelbackSpeed => 2.4f; - public override float ForwardSpeed => 0.95f; + public override float ForwardSpeed => 0.8f; public override void ExtraBehavior() { if (Main.rand.NextBool(4)) { - int dust = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 60, Projectile.direction * 2, 0f, 150, default, 1f); + int dust = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.RedTorch, Projectile.direction * 2, 0f, 150, default, 1f); Main.dust[dust].noGravity = true; } } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - if (!target.canGhostHeal || Main.player[Projectile.owner].moonLeech) + int heal = (int)Math.Round(hit.Damage * 0.01); + if (heal > BalancingConstants.LifeStealCap) + heal = BalancingConstants.LifeStealCap; + + if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) return; - Player player = Main.player[Projectile.owner]; - player.statLife += 1; - player.HealEffect(1); + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); } } } diff --git a/Projectiles/Melee/Spears/GoldplumeSpearProjectile.cs b/Projectiles/Melee/Spears/GoldplumeSpearProjectile.cs index 86197b6f92..781422fe62 100644 --- a/Projectiles/Melee/Spears/GoldplumeSpearProjectile.cs +++ b/Projectiles/Melee/Spears/GoldplumeSpearProjectile.cs @@ -4,11 +4,13 @@ using Terraria; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Melee.Spears { public class GoldplumeSpearProjectile : BaseSpearProjectile { public override LocalizedText DisplayName => CalamityUtils.GetItemName(); + public override void SetDefaults() { Projectile.width = Projectile.height = 40; @@ -26,17 +28,18 @@ namespace CalamityMod.Projectiles.Melee.Spears public override float InitialSpeed => 3f; public override float ReelbackSpeed => 1.1f; - public override float ForwardSpeed => 0.95f; + public override float ForwardSpeed => 0.4f; public override void ExtraBehavior() { if (Main.rand.NextBool(5)) - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 59, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.BlueTorch, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + Projectile.localAI[0] += 1f; if (Projectile.localAI[0] >= 6f) { Projectile.localAI[0] = 0f; if (Main.myPlayer == Projectile.owner) - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center + Projectile.velocity, Projectile.velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.4), 0f, Projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center - Projectile.velocity * 4f, Projectile.velocity * 2f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), 0f, Projectile.owner); } } } diff --git a/Projectiles/Melee/Spears/HellionFlowerSpearProjectile.cs b/Projectiles/Melee/Spears/HellionFlowerSpearProjectile.cs index 956a348a75..88f394f1cc 100644 --- a/Projectiles/Melee/Spears/HellionFlowerSpearProjectile.cs +++ b/Projectiles/Melee/Spears/HellionFlowerSpearProjectile.cs @@ -1,7 +1,7 @@ -using CalamityMod.Items.Weapons.Melee; +using System; +using CalamityMod.Items.Weapons.Melee; using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.Localization; @@ -29,10 +29,10 @@ namespace CalamityMod.Projectiles.Melee.Spears public override float InitialSpeed => 3f; public override float ReelbackSpeed => 2.4f; - public override float ForwardSpeed => 0.95f; + public override float ForwardSpeed => 0.8f; public override Action EffectBeforeReelback => (proj) => { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity * 2.4f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.65), Projectile.knockBack * 0.85f, Projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity * 2.4f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.65), Projectile.knockBack * 0.85f, Projectile.owner); }; public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) diff --git a/Projectiles/Melee/Spears/InsidiousImpalerProj.cs b/Projectiles/Melee/Spears/InsidiousImpalerProj.cs deleted file mode 100644 index dee02f12c6..0000000000 --- a/Projectiles/Melee/Spears/InsidiousImpalerProj.cs +++ /dev/null @@ -1,43 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Items.Weapons.Melee; -using CalamityMod.Projectiles.BaseProjectiles; -using System; -using Terraria; -using Terraria.ID; -using Terraria.Localization; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Melee.Spears -{ - public class InsidiousImpalerProj : BaseSpearProjectile - { - public override LocalizedText DisplayName => CalamityUtils.GetItemName(); - public override void SetDefaults() - { - Projectile.width = Projectile.height = 40; - Projectile.DamageType = DamageClass.Melee; - Projectile.timeLeft = 90; - Projectile.friendly = true; - Projectile.hostile = false; - Projectile.tileCollide = false; - Projectile.ignoreWater = true; - Projectile.penetrate = -1; - Projectile.ownerHitCheck = true; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 5; - } - - public override float InitialSpeed => 3f; - public override float ReelbackSpeed => 1.1f; - public override float ForwardSpeed => 0.95f; - public override Action EffectBeforeReelback => (proj) => - { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center + Projectile.velocity, Projectile.velocity * 3.5f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack * 0.85f, Projectile.owner); - }; - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 180); - target.AddBuff(BuffID.Venom, 180); - } - } -} diff --git a/Projectiles/Melee/Spears/InsidiousImpalerProj.png b/Projectiles/Melee/Spears/InsidiousImpalerProj.png deleted file mode 100644 index ccdd5a9b9d..0000000000 Binary files a/Projectiles/Melee/Spears/InsidiousImpalerProj.png and /dev/null differ diff --git a/Projectiles/Melee/Spears/NadirSpear.cs b/Projectiles/Melee/Spears/NadirSpear.cs index 139ae87daa..51c1f30f62 100644 --- a/Projectiles/Melee/Spears/NadirSpear.cs +++ b/Projectiles/Melee/Spears/NadirSpear.cs @@ -1,7 +1,7 @@ -using CalamityMod.Items.Weapons.Melee; +using System; +using CalamityMod.Items.Weapons.Melee; using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Melee.Spears public override float InitialSpeed => 5.5f; public override float ReelbackSpeed => 2.1f; - public override float ForwardSpeed => 1.1f; + public override float ForwardSpeed => 1f; public override Action EffectBeforeReelback => (proj) => { int damage = (int)(Projectile.damage * 0.5f); diff --git a/Projectiles/Melee/Spears/RedtideSpearProjectile.cs b/Projectiles/Melee/Spears/RedtideSpearProjectile.cs index e1852bf8bb..bd510bc616 100644 --- a/Projectiles/Melee/Spears/RedtideSpearProjectile.cs +++ b/Projectiles/Melee/Spears/RedtideSpearProjectile.cs @@ -1,8 +1,8 @@ -using CalamityMod.Items.Weapons.Melee; +using System; +using CalamityMod.Items.Weapons.Melee; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Utilities; -using System; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -84,13 +84,13 @@ namespace CalamityMod.Projectiles.Melee.Spears //Mirror the angle if facing left. return MathHelper.Pi - rotation - MathHelper.TwoPi; - } + } } //Properly wrap the angle. Indeed, the angles on the left suddenly go from Pi to -Pi public float ProjectileRotationButWrappedForTransition { - get + get { if (ChargeDirection < 0 && Projectile.rotation > 0) return Projectile.rotation - MathHelper.TwoPi; @@ -307,9 +307,13 @@ namespace CalamityMod.Projectiles.Melee.Spears target.AddBuff(BuffID.Poisoned, 180); - //Give a sliver of iframes to the player so its safer to ram into hordes (which is fun and should be encouraged) if (CurrentAttackState == AttackState.RunAttack) - Owner.GiveIFrames(5); + { + // 17APR2024: Ozzatron: Redtide Spear's charge gives iframes when striking enemies in a similar manner to a ram dash. + // This is a fixed and intentionally very low number of iframes, and is not boosted by Cross Necklace. + int redtideRamIFrames = 5; + Owner.GiveUniversalIFrames(redtideRamIFrames); + } } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) @@ -321,7 +325,7 @@ namespace CalamityMod.Projectiles.Melee.Spears public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, null, lightColor, AppropriateRotation + MathHelper.PiOver2 * 1.5f - MathHelper.ToRadians(12), texture.Size() / 2f, Projectile.scale, 0, 0); return false; diff --git a/Projectiles/Melee/Spears/SausageMakerSpear.cs b/Projectiles/Melee/Spears/SausageMakerSpear.cs index d78c2ca20b..57703977df 100644 --- a/Projectiles/Melee/Spears/SausageMakerSpear.cs +++ b/Projectiles/Melee/Spears/SausageMakerSpear.cs @@ -26,11 +26,11 @@ namespace CalamityMod.Projectiles.Melee.Spears public override float InitialSpeed => 3f; public override float ReelbackSpeed => 1.1f; - public override float ForwardSpeed => 0.95f; + public override float ForwardSpeed => 0.8f; public override void ExtraBehavior() { if (Main.rand.NextBool(5)) - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 5, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Blood, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { diff --git a/Projectiles/Melee/Spears/StarnightLanceProjectile.cs b/Projectiles/Melee/Spears/StarnightLanceProjectile.cs index a8de288692..8c49023cac 100644 --- a/Projectiles/Melee/Spears/StarnightLanceProjectile.cs +++ b/Projectiles/Melee/Spears/StarnightLanceProjectile.cs @@ -1,6 +1,6 @@ -using CalamityMod.Items.Weapons.Melee; +using System; +using CalamityMod.Items.Weapons.Melee; using CalamityMod.Projectiles.BaseProjectiles; -using System; using Terraria; using Terraria.ID; using Terraria.Localization; @@ -28,16 +28,17 @@ namespace CalamityMod.Projectiles.Melee.Spears public override float InitialSpeed => 3f; public override float ReelbackSpeed => 2.4f; - public override float ForwardSpeed => 0.95f; + public override float ForwardSpeed => 0.7f; public override Action EffectBeforeReelback => (proj) => { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X + Projectile.velocity.X, Projectile.Center.Y + Projectile.velocity.Y, - Projectile.velocity.X * 2.4f, Projectile.velocity.Y * 2.4f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.8), Projectile.knockBack * 0.85f, Projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center - Projectile.velocity * 4f, Projectile.velocity * 2.4f, + ModContent.ProjectileType(), (int)(Projectile.damage * 0.8), Projectile.knockBack * 0.85f, Projectile.owner); }; + public override void ExtraBehavior() { if (Main.rand.NextBool(5)) - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 29, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.WaterCandle, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.Frostburn2, 120); diff --git a/Projectiles/Melee/Spears/StreamGougeProj.cs b/Projectiles/Melee/Spears/StreamGougeProj.cs index 44a50069ab..1f7d7b90fa 100644 --- a/Projectiles/Melee/Spears/StreamGougeProj.cs +++ b/Projectiles/Melee/Spears/StreamGougeProj.cs @@ -1,10 +1,10 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using System.IO; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Sounds; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; using Terraria; using Terraria.Audio; using Terraria.Graphics.Shaders; @@ -91,7 +91,6 @@ namespace CalamityMod.Projectiles.Melee.Spears public void DeterminePlayerVariables() { - bool spearStillInUse = Owner.channel && !Owner.noItems && !Owner.CCed; Owner.ChangeDir((Math.Cos(Projectile.rotation - MathHelper.Pi + MathHelper.PiOver4) > 0f).ToDirectionInt()); Owner.heldProj = Projectile.whoAmI; Owner.itemTime = Owner.itemAnimation = 2; @@ -99,7 +98,7 @@ namespace CalamityMod.Projectiles.Melee.Spears Projectile.Center = Owner.Center; // Die if the spear is no longer in use. - if (!spearStillInUse) + if (Owner.CantUseHoldout()) Projectile.Kill(); } @@ -153,7 +152,7 @@ namespace CalamityMod.Projectiles.Melee.Spears bool portalIsInteractable = portalOpacity >= 1f; Vector2 portalDrawPosition = Owner.Center + InitialDirection.ToRotationVector2() * 130f - Main.screenPosition; - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; if (portalIsInteractable) { Main.spriteBatch.EnterShaderRegion(); diff --git a/Projectiles/Melee/Spears/TenebreusTidesProjectile.cs b/Projectiles/Melee/Spears/TenebreusTidesProjectile.cs index 9d240acb20..5bec1dd0cb 100644 --- a/Projectiles/Melee/Spears/TenebreusTidesProjectile.cs +++ b/Projectiles/Melee/Spears/TenebreusTidesProjectile.cs @@ -1,8 +1,8 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.Localization; @@ -30,16 +30,16 @@ namespace CalamityMod.Projectiles.Melee.Spears public override float InitialSpeed => 3f; public override float ReelbackSpeed => 2.4f; - public override float ForwardSpeed => 0.95f; + public override float ForwardSpeed => 0.8f; public override Action EffectBeforeReelback => (proj) => { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X + Projectile.velocity.X, Projectile.Center.Y + Projectile.velocity.Y, Projectile.velocity.X * 2.4f, Projectile.velocity.Y * 2.4f, + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X + Projectile.velocity.X, Projectile.Center.Y + Projectile.velocity.Y, Projectile.velocity.X * 2.4f, Projectile.velocity.Y * 2.4f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.75), Projectile.knockBack * 0.85f, Projectile.owner, 0f, 0f); }; public override void ExtraBehavior() { if (Main.rand.NextBool(5)) - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 33, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Water, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) diff --git a/Projectiles/Melee/Spears/TerraLanceProjectile.png b/Projectiles/Melee/Spears/TerraLanceProjectile.png deleted file mode 100644 index e828311256..0000000000 Binary files a/Projectiles/Melee/Spears/TerraLanceProjectile.png and /dev/null differ diff --git a/Projectiles/Melee/Spears/VulcaniteLanceProj.cs b/Projectiles/Melee/Spears/VulcaniteLanceProj.cs index a10ef27f09..014132bc87 100644 --- a/Projectiles/Melee/Spears/VulcaniteLanceProj.cs +++ b/Projectiles/Melee/Spears/VulcaniteLanceProj.cs @@ -12,6 +12,7 @@ namespace CalamityMod.Projectiles.Melee.Spears public class VulcaniteLanceProj : BaseSpearProjectile { public override LocalizedText DisplayName => CalamityUtils.GetItemName(); + public override void SetDefaults() { Projectile.width = Projectile.height = 44; @@ -26,9 +27,10 @@ namespace CalamityMod.Projectiles.Melee.Spears Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 12; } + public override float InitialSpeed => 3f; public override float ReelbackSpeed => 2.4f; - public override float ForwardSpeed => 0.95f; + public override float ForwardSpeed => 0.8f; public override void ExtraBehavior() { if (Main.rand.NextBool(5)) diff --git a/Projectiles/Melee/Spears/YateveoBloomSpear.cs b/Projectiles/Melee/Spears/YateveoBloomSpear.cs index b676cdd924..5acc6d3ecc 100644 --- a/Projectiles/Melee/Spears/YateveoBloomSpear.cs +++ b/Projectiles/Melee/Spears/YateveoBloomSpear.cs @@ -10,6 +10,7 @@ namespace CalamityMod.Projectiles.Melee.Spears public class YateveoBloomSpear : BaseSpearProjectile { public override LocalizedText DisplayName => CalamityUtils.GetItemName(); + public override void SetDefaults() { Projectile.width = Projectile.height = 40; @@ -25,7 +26,7 @@ namespace CalamityMod.Projectiles.Melee.Spears public override float InitialSpeed => 3f; public override float ReelbackSpeed => 2.4f; - public override float ForwardSpeed => 0.95f; + public override float ForwardSpeed => 0.8f; public override void ExtraBehavior() { if (Main.rand.NextBool(3)) diff --git a/Projectiles/Melee/SpineOfThanatosProjectile.cs b/Projectiles/Melee/SpineOfThanatosProjectile.cs index 291a7730c5..03b6fb9bc1 100644 --- a/Projectiles/Melee/SpineOfThanatosProjectile.cs +++ b/Projectiles/Melee/SpineOfThanatosProjectile.cs @@ -1,12 +1,12 @@ -using CalamityMod.DataStructures; +using System; +using System.Collections.Generic; +using CalamityMod.DataStructures; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.Collections.Generic; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -86,7 +86,7 @@ namespace CalamityMod.Projectiles.Melee Vector2 playerRotatedPosition = Owner.RotatedRelativePoint(Owner.MountedCenter); if (Main.myPlayer == Projectile.owner) { - if (!Owner.noItems && !Owner.CCed) + if (!Owner.CantUseHoldout()) HandleChannelMovement(playerRotatedPosition); else Projectile.Kill(); @@ -110,7 +110,7 @@ namespace CalamityMod.Projectiles.Melee float attackCompletionRatio = Utils.GetLerpValue(Lifetime, FlyBackTime, Projectile.timeLeft, true); // Normally swing from a "cone" to a collision area that causes both whips to collide. - float baseSwingAngle = MathHelper.Lerp(-1.1f, 1.57f, 1f - attackCompletionRatio); + float baseSwingAngle = MathHelper.Lerp(-1.1f, MathHelper.PiOver2, 1f - attackCompletionRatio); Vector2 swingDirection = (SwingDirection * baseSwingAngle + MathHelper.PiOver2).ToRotationVector2(); swingDirection = swingDirection.RotatedBy(InitialDirectionRotation); diff --git a/Projectiles/Melee/StarnightBeam.cs b/Projectiles/Melee/StarnightBeam.cs index 1fff404fd7..305f72a60a 100644 --- a/Projectiles/Melee/StarnightBeam.cs +++ b/Projectiles/Melee/StarnightBeam.cs @@ -1,8 +1,8 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -17,14 +17,16 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - Projectile.width = 14; - Projectile.height = 14; + Projectile.width = 16; + Projectile.height = 16; Projectile.aiStyle = ProjAIStyleID.Beam; Projectile.friendly = true; Projectile.DamageType = DamageClass.Melee; Projectile.penetrate = 3; Projectile.timeLeft = 600; AIType = ProjectileID.LightBeam; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() @@ -34,7 +36,7 @@ namespace CalamityMod.Projectiles.Melee public override Color? GetAlpha(Color lightColor) { - return new Color(200, 200, 200, Projectile.alpha); + return new Color(byte.MaxValue, 50, 128, Projectile.alpha); } public override bool PreDraw(ref Color lightColor) @@ -49,18 +51,16 @@ namespace CalamityMod.Projectiles.Melee public override void OnKill(int timeLeft) { SoundEngine.PlaySound(SoundID.Item10, Projectile.position); - int inc; - for (int i = 4; i < 31; i = inc + 1) + for (int i = 4; i < 31; i++) { float projOldX = Projectile.oldVelocity.X * (30f / (float)i); float projOldY = Projectile.oldVelocity.Y * (30f / (float)i); - int starnight = Dust.NewDust(new Vector2(Projectile.oldPosition.X - projOldX, Projectile.oldPosition.Y - projOldY), 8, 8, 73, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.8f); + int starnight = Dust.NewDust(new Vector2(Projectile.oldPosition.X - projOldX, Projectile.oldPosition.Y - projOldY), 8, 8, DustID.PinkFairy, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.8f); Dust dust = Main.dust[starnight]; dust.noGravity = true; - dust.velocity *= 0.5f; - starnight = Dust.NewDust(new Vector2(Projectile.oldPosition.X - projOldX, Projectile.oldPosition.Y - projOldY), 8, 8, 73, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.4f); - dust.velocity *= 0.05f; - inc = i; + dust.velocity *= 0.1f; + starnight = Dust.NewDust(new Vector2(Projectile.oldPosition.X - projOldX, Projectile.oldPosition.Y - projOldY), 8, 8, DustID.PinkFairy, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.4f); + dust.velocity *= 0.01f; } } diff --git a/Projectiles/Melee/StellarContemptEcho.cs b/Projectiles/Melee/StellarContemptEcho.cs index 239a386e4e..8532df4598 100644 --- a/Projectiles/Melee/StellarContemptEcho.cs +++ b/Projectiles/Melee/StellarContemptEcho.cs @@ -3,9 +3,9 @@ using System.IO; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -80,7 +80,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.rotation += MathHelper.ToRadians(48f) * Projectile.localAI[0]; } } - + if (Main.rand.NextBool()) { @@ -135,7 +135,7 @@ namespace CalamityMod.Projectiles.Melee float rot = MathHelper.ToRadians(i * rotFactor); Vector2 offset = new Vector2(30f, 5.8f).RotatedBy(rot); Vector2 velOffset = new Vector2(20.8f, 10.5f).RotatedBy(rot); - int dust = Dust.NewDust(Projectile.position + offset, Projectile.width, Projectile.height, 229, velOffset.X, velOffset.Y); + int dust = Dust.NewDust(Projectile.position + offset, Projectile.width, Projectile.height, DustID.Vortex, velOffset.X, velOffset.Y); Main.dust[dust].noGravity = true; Main.dust[dust].velocity = velOffset; Main.dust[dust].scale = 3.8f; @@ -186,7 +186,7 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Rectangle sourceRectangle = new Rectangle(0, 0, texture.Width + 12, texture.Height + 12); Vector2 origin = sourceRectangle.Size() / 2f; diff --git a/Projectiles/Melee/StellarContemptHammer.cs b/Projectiles/Melee/StellarContemptHammer.cs index 56522501b2..a75123933b 100644 --- a/Projectiles/Melee/StellarContemptHammer.cs +++ b/Projectiles/Melee/StellarContemptHammer.cs @@ -1,12 +1,12 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Particles; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using CalamityMod.Particles; namespace CalamityMod.Projectiles.Melee { @@ -15,11 +15,11 @@ namespace CalamityMod.Projectiles.Melee public new string LocalizationCategory => "Projectiles.Melee"; public override string Texture => "CalamityMod/Items/Weapons/Melee/StellarContempt"; - public static readonly SoundStyle UseSound = new("CalamityMod/Sounds/Item/PwnagehammerSound") { Volume = 0.35f}; + public static readonly SoundStyle UseSound = new("CalamityMod/Sounds/Item/PwnagehammerSound") { Volume = 0.35f }; public static readonly SoundStyle RedHamSound = new("CalamityMod/Sounds/Item/StellarContemptClone") { Volume = 0.6f }; - public static readonly SoundStyle UseSoundFunny = new("CalamityMod/Sounds/Item/CalamityBell") { Volume = 1.5f}; + public static readonly SoundStyle UseSoundFunny = new("CalamityMod/Sounds/Item/CalamityBell") { Volume = 1.5f }; - public ref int EmpoweredHammer => ref Main.player[Projectile.owner].Calamity().StellarHammer; + public ref int EmpoweredHammer => ref Main.player[Projectile.owner].Calamity().StellarHammer; public int returnhammer = 0; public int DustOnce = 1; public float rotatehammer = 8f; @@ -319,7 +319,7 @@ namespace CalamityMod.Projectiles.Melee } } } - + public override bool PreDraw(ref Color lightColor) { CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 3); @@ -327,4 +327,4 @@ namespace CalamityMod.Projectiles.Melee } } } - + diff --git a/Projectiles/Melee/StormBeam.cs b/Projectiles/Melee/StormBeam.cs index 23d6885c96..5ec35d486f 100644 --- a/Projectiles/Melee/StormBeam.cs +++ b/Projectiles/Melee/StormBeam.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -36,7 +36,7 @@ namespace CalamityMod.Projectiles.Melee { for (int k = 0; k < 5; k++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 187, Projectile.oldVelocity.X, Projectile.oldVelocity.Y); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Flare_Blue, Projectile.oldVelocity.X, Projectile.oldVelocity.Y); } } diff --git a/Projectiles/Melee/StormMark.cs b/Projectiles/Melee/StormMark.cs index 163effed93..c2ce3af1f8 100644 --- a/Projectiles/Melee/StormMark.cs +++ b/Projectiles/Melee/StormMark.cs @@ -1,9 +1,9 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { public class StormMark : ModProjectile, ILocalizedModType @@ -46,7 +46,7 @@ namespace CalamityMod.Projectiles.Melee dustMovement.X *= -1f; Vector2 dustMovement2 = new Vector2(2f, 10f); Vector2 position4 = Projectile.Center + new Vector2(60f, 200f) * dustMovement * 0.5f + dustMovement2; - Dust stormy = Main.dust[Dust.NewDust(position4, 0, 0, 187, 0f, 0f, 0, default, 0.5f)]; + Dust stormy = Main.dust[Dust.NewDust(position4, 0, 0, DustID.Flare_Blue, 0f, 0f, 0, default, 0.5f)]; stormy.position = position4; stormy.customData = Projectile.Center + dustMovement2; stormy.fadeIn = 1f; @@ -97,7 +97,7 @@ namespace CalamityMod.Projectiles.Melee if (Main.rand.NextBool(10)) { Vector2 dustVel = Vector2.UnitY.RotatedBy((double)((float)j * 3.14159274f), default).RotatedBy((double)Projectile.rotation, default); - Dust stormDust = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, 187, 0f, 0f, 225, newColor3, 1f)]; + Dust stormDust = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, DustID.Flare_Blue, 0f, 0f, 225, newColor3, 1f)]; stormDust.noGravity = true; stormDust.noLight = true; stormDust.scale = Projectile.Opacity * Projectile.localAI[0]; @@ -110,7 +110,7 @@ namespace CalamityMod.Projectiles.Melee if (Main.rand.NextBool(10)) { Vector2 dustVel2 = Vector2.UnitY.RotatedBy((double)((float)num1136 * 3.14159274f), default); - Dust stormDust2 = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, 187, 0f, 0f, 225, newColor3, 1.5f)]; + Dust stormDust2 = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, DustID.Flare_Blue, 0f, 0f, 225, newColor3, 1.5f)]; stormDust2.noGravity = true; stormDust2.noLight = true; stormDust2.scale = Projectile.Opacity * Projectile.localAI[0]; @@ -138,7 +138,7 @@ namespace CalamityMod.Projectiles.Melee { Color originalColor = Lighting.GetColor((int)((double)Projectile.position.X + (double)Projectile.width * 0.5) / 16, (int)(((double)Projectile.position.Y + (double)Projectile.height * 0.5) / 16.0)); Vector2 drawPos = Projectile.position + new Vector2((float)Projectile.width, (float)Projectile.height) / 2f + Vector2.UnitY * Projectile.gfxOffY - Main.screenPosition; - Texture2D texture2D27 = ModContent.Request(Texture).Value; + Texture2D texture2D27 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Rectangle rectangl = texture2D27.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); Color alphaColor = Projectile.GetAlpha(originalColor); Vector2 halfRect = rectangl.Size() / 2f; diff --git a/Projectiles/Melee/StormRulerProj.cs b/Projectiles/Melee/StormRulerProj.cs index 4b48581350..307aca13a6 100644 --- a/Projectiles/Melee/StormRulerProj.cs +++ b/Projectiles/Melee/StormRulerProj.cs @@ -1,5 +1,5 @@ +using System; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Projectiles/Melee/StreamGougePortal.cs b/Projectiles/Melee/StreamGougePortal.cs index b7b02a5d1c..eaccceee17 100644 --- a/Projectiles/Melee/StreamGougePortal.cs +++ b/Projectiles/Melee/StreamGougePortal.cs @@ -1,13 +1,13 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Graphics.Metaballs; using CalamityMod.Items.Weapons.Melee; 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.Audio; -using CalamityMod.Graphics.Metaballs; namespace CalamityMod.Projectiles.Melee { diff --git a/Projectiles/Melee/StygianShieldAttack.cs b/Projectiles/Melee/StygianShieldAttack.cs index 57cdbaf87d..775bbf5d0c 100644 --- a/Projectiles/Melee/StygianShieldAttack.cs +++ b/Projectiles/Melee/StygianShieldAttack.cs @@ -1,9 +1,9 @@ -using CalamityMod.Graphics.Primitives; +using System; +using CalamityMod.Graphics.Primitives; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.Audio; using Terraria.Graphics.Effects; @@ -20,21 +20,17 @@ namespace CalamityMod.Projectiles.Melee // Bull Rush stats public const float MinChargeTime = 15f; - public const float MaxChargeTime = 60f; - public const float MaxChargeDistance = 800f; // 50 blocks - public const float MaxChargeDamageMult = 4f; + public const float MaxChargeTime = 45f; + public const float MaxChargeDistance = 720f; // 45 blocks + public const float MaxChargeDamageMult = 6f; public const float PiercingDamageMult = 0.6f; public const float DashDuration = 21f; - public const float IFrameRatio = 0.35f; // Amount given = Ratio * Charge, rounded down public Player Owner => Main.player[Projectile.owner]; public ref float Charge => ref Projectile.ai[0]; public ref float DashTime => ref Projectile.ai[1]; public Vector2 DashDestination = Vector2.Zero; - // Rawest placeholder sound - public static readonly SoundStyle DashSound = new("CalamityMod/Sounds/Custom/ExoMechs/ApolloMissileLaunch") { Volume = 0.6f }; - public override void SetStaticDefaults() { ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; @@ -60,7 +56,8 @@ namespace CalamityMod.Projectiles.Melee Owner.heldProj = Projectile.whoAmI; - // TODO -- Windup sound (definitely requires a custom looping sound) + if (Charge == 0f) + SoundEngine.PlaySound(StygianShield.DashChargeSound, Owner.Center); // Dashing behavior Projectile.Opacity = Utils.GetLerpValue(0f, DashDuration * 0.7f, DashTime, true); @@ -105,7 +102,7 @@ namespace CalamityMod.Projectiles.Melee } // Attack upon releasing the button - if (!Owner.channel || Owner.noItems || Owner.CCed) + if (Owner.CantUseHoldout()) Attack(); } @@ -120,12 +117,12 @@ namespace CalamityMod.Projectiles.Melee // Has to be within world bounds if (intendedDestination.X >= 660f && intendedDestination.Y >= 660f && intendedDestination.X <= Main.maxTilesX * 16f - 680f && intendedDestination.Y <= Main.maxTilesY * 16f - 680f) { - SoundEngine.PlaySound(DashSound, Owner.Center); + SoundEngine.PlaySound(StygianShield.DashSound, Owner.Center); // Give immunity frames Owner.immune = true; Owner.immuneNoBlink = true; - Owner.immuneTime = (int)(IFrameRatio * Charge); + Owner.immuneTime = (int)DashDuration; for (int k = 0; k < Owner.hurtCooldowns.Length; k++) Owner.hurtCooldowns[k] = Owner.immuneTime; @@ -174,6 +171,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { Projectile.damage = (int)(Projectile.damage * PiercingDamageMult); + SoundEngine.PlaySound(StygianShield.DashHitSound, Owner.Center); // Spawn a violent slash through the target that is hit float rotation = Projectile.velocity.ToRotation() - MathHelper.Pi; @@ -192,7 +190,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { // Textures and general use stuff - Texture2D mainTex = ModContent.Request(Texture).Value; + Texture2D mainTex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Texture2D bloomTex = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; Texture2D flatTex = ModContent.Request("CalamityMod/Particles/FlatShape").Value; Texture2D shieldTex = ModContent.Request("CalamityMod/Projectiles/Melee/StygianShieldBloom").Value; diff --git a/Projectiles/Melee/StygianShieldThrown.cs b/Projectiles/Melee/StygianShieldThrown.cs index bea6327383..48aa964265 100644 --- a/Projectiles/Melee/StygianShieldThrown.cs +++ b/Projectiles/Melee/StygianShieldThrown.cs @@ -1,7 +1,8 @@ -using CalamityMod.Particles; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Particles; using CalamityMod.Sounds; using Microsoft.Xna.Framework; -using System; +using ReLogic.Utilities; using System.Collections.Generic; using Terraria; using Terraria.Audio; @@ -23,10 +24,9 @@ namespace CalamityMod.Projectiles.Melee private List PreviousNPCs = new List() { -1 }; public Player Owner => Main.player[Projectile.owner]; public ref float AirTime => ref Projectile.ai[0]; + SlotId LoopSoundSlot; public const float TotalTrailLength = 35f; - public static readonly SoundStyle ThrowSound = CommonCalamitySounds.LouderSwingWoosh; - public static readonly SoundStyle CollisionSound = CommonCalamitySounds.ExoHitSound; public override void SetStaticDefaults() { @@ -49,7 +49,12 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { if (AirTime == 0f) - SoundEngine.PlaySound(ThrowSound, Projectile.Center); + SoundEngine.PlaySound(StygianShield.ShieldThrowSound, Projectile.Center); + if ((AirTime + 40) % 60 == 0) + LoopSoundSlot = SoundEngine.PlaySound(StygianShield.ThrowLoopSound, Projectile.Center); + if (SoundEngine.TryGetActiveSound(LoopSoundSlot, out var LoopSound) && LoopSound.IsPlaying) + LoopSound.Position = Projectile.Center; + // Boomerang rotation Projectile.rotation += Projectile.direction * 0.4f; @@ -65,7 +70,7 @@ namespace CalamityMod.Projectiles.Melee Color blackGradient = Color.Lerp(new Color(40, 40, 40), Color.Black, lengthRatio); float rotMotion = Projectile.timeLeft * MathHelper.TwoPi / 60f; float trueRot = Projectile.oldRot[i] + rotMotion; - Vector2 squishFactor = new Vector2 (0.8f, 1f); + Vector2 squishFactor = new Vector2(0.8f, 1f); Particle redSmear = new SemiCircularSmearVFX(truePos, redGradient, trueRot, 0.3f, squishFactor); GeneralParticleHandler.SpawnParticle(redSmear); @@ -82,11 +87,11 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - SoundEngine.PlaySound(CollisionSound, Projectile.Center); + SoundEngine.PlaySound(StygianShield.ShieldThrowHitSound, Projectile.Center); // Disallow the NPC to be targeted again PreviousNPCs.Add(target.whoAmI); - if(SeekNPC() == -1) + if (SeekNPC() == -1) ReturnToOwner(); // Return hits have diminishing damage @@ -96,9 +101,9 @@ namespace CalamityMod.Projectiles.Melee public override bool OnTileCollide(Vector2 oldVelocity) { - SoundEngine.PlaySound(CollisionSound, Projectile.Center); + SoundEngine.PlaySound(StygianShield.ShieldThrowHitSound, Projectile.Center); - if(SeekNPC() == -1) + if (SeekNPC() == -1) ReturnToOwner(); // Counts as "hitting" something @@ -146,13 +151,18 @@ namespace CalamityMod.Projectiles.Melee Projectile.tileCollide = false; // Swiftly move back towards the player - Projectile.velocity = Projectile.SafeDirectionTo(Owner.Center) * 15f; + Projectile.velocity = Projectile.SafeDirectionTo(Owner.Center) * 20f; // Delete the projectile if it touches its owner or too far away. if (Projectile.Hitbox.Intersects(Owner.Hitbox) || Vector2.Distance(Projectile.Center, Owner.Center) >= 3000f) + { + SoundEngine.PlaySound(StygianShield.ShieldCatchSound, Owner.Center); + if (SoundEngine.TryGetActiveSound(LoopSoundSlot, out var LoopSound)) + LoopSound?.Stop(); Projectile.Kill(); + } } - + // Preventing unintended collisions with the floor public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough, ref Vector2 hitboxCenterFrac) { diff --git a/Projectiles/Melee/SulphurousGrabberBubble.cs b/Projectiles/Melee/SulphurousGrabberBubble.cs index 1898eba9e7..8b135cca3b 100644 --- a/Projectiles/Melee/SulphurousGrabberBubble.cs +++ b/Projectiles/Melee/SulphurousGrabberBubble.cs @@ -1,9 +1,9 @@ using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { public class SulphurousGrabberBubble : ModProjectile, ILocalizedModType @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.velocity.X *= 0.9f; Projectile.velocity.Y *= 0.9f; if (Main.rand.NextBool(5)) - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, (int)CalamityDusts.SulfurousSeaAcid, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, (int)CalamityDusts.SulphurousSeaAcid, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } public override void OnKill(int timeLeft) @@ -35,7 +35,7 @@ namespace CalamityMod.Projectiles.Melee int randAmt = Main.rand.Next(5, 9); for (int i = 0; i < randAmt; i++) { - int toxicDust = Dust.NewDust(Projectile.Center, 0, 0, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default, 1.4f); + int toxicDust = Dust.NewDust(Projectile.Center, 0, 0, (int)CalamityDusts.SulphurousSeaAcid, 0f, 0f, 100, default, 1.4f); Main.dust[toxicDust].velocity *= 0.8f; Main.dust[toxicDust].position = Vector2.Lerp(Main.dust[toxicDust].position, Projectile.Center, 0.5f); Main.dust[toxicDust].noGravity = true; diff --git a/Projectiles/Melee/SulphurousGrabberBubble2.cs b/Projectiles/Melee/SulphurousGrabberBubble2.cs index b16fdbf074..c739167958 100644 --- a/Projectiles/Melee/SulphurousGrabberBubble2.cs +++ b/Projectiles/Melee/SulphurousGrabberBubble2.cs @@ -1,9 +1,9 @@ using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { public class SulphurousGrabberBubble2 : ModProjectile, ILocalizedModType @@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.velocity.X *= 0.9f; Projectile.velocity.Y *= 0.9f; if (Main.rand.NextBool(5)) - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, (int)CalamityDusts.SulfurousSeaAcid, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, (int)CalamityDusts.SulphurousSeaAcid, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } public override void OnKill(int timeLeft) @@ -36,7 +36,7 @@ namespace CalamityMod.Projectiles.Melee int randAmt = Main.rand.Next(5, 9); for (int i = 0; i < randAmt; i++) { - int toxicDust = Dust.NewDust(Projectile.Center, 0, 0, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default, 1.4f); + int toxicDust = Dust.NewDust(Projectile.Center, 0, 0, (int)CalamityDusts.SulphurousSeaAcid, 0f, 0f, 100, default, 1.4f); Main.dust[toxicDust].velocity *= 0.8f; Main.dust[toxicDust].position = Vector2.Lerp(Main.dust[toxicDust].position, Projectile.Center, 0.5f); Main.dust[toxicDust].noGravity = true; diff --git a/Projectiles/Melee/SunlightBlade.cs b/Projectiles/Melee/SunlightBlade.cs deleted file mode 100644 index e416eef8b9..0000000000 --- a/Projectiles/Melee/SunlightBlade.cs +++ /dev/null @@ -1,62 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Melee -{ - public class SunlightBlade : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Melee"; - public override void SetStaticDefaults() - { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; - } - - public override void SetDefaults() - { - Projectile.width = 50; - Projectile.height = 50; - Projectile.aiStyle = ProjAIStyleID.Sickle; - Projectile.alpha = 100; - Projectile.friendly = true; - Projectile.tileCollide = false; - Projectile.DamageType = DamageClass.Melee; - Projectile.penetrate = 6; - Projectile.ignoreWater = true; - AIType = ProjectileID.DeathSickle; - Projectile.MaxUpdates = 2; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10 * Projectile.MaxUpdates; - Projectile.timeLeft = 150 * Projectile.MaxUpdates; - } - - public override void AI() - { - Lighting.AddLight(Projectile.Center, 0.25f, 0.25f, 0f); - } - - public override Color? GetAlpha(Color lightColor) - { - if (Projectile.timeLeft < 85) - { - byte b2 = (byte)(Projectile.timeLeft * 3); - byte a2 = (byte)(100f * ((float)b2 / 255f)); - return new Color((int)b2, (int)b2, (int)b2, (int)a2); - } - return new Color(255, 255, 255, 100); - } - - public override bool PreDraw(ref Color lightColor) - { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); - return false; - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 180); - } - } -} diff --git a/Projectiles/Melee/SunlightBlade.png b/Projectiles/Melee/SunlightBlade.png deleted file mode 100644 index 6b995980e5..0000000000 Binary files a/Projectiles/Melee/SunlightBlade.png and /dev/null differ diff --git a/Projectiles/Melee/SwordsplosionBlue.cs b/Projectiles/Melee/SwordsplosionBlue.cs index ea04cb0b27..a914389a7b 100644 --- a/Projectiles/Melee/SwordsplosionBlue.cs +++ b/Projectiles/Melee/SwordsplosionBlue.cs @@ -1,6 +1,6 @@ +using System; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -29,7 +29,7 @@ namespace CalamityMod.Projectiles.Melee Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.3f / 255f, (255 - Projectile.alpha) * 0.4f / 255f, (255 - Projectile.alpha) * 1f / 255f); if (Projectile.localAI[1] > 7f) { - int blueBoi = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 66, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, new Color(Main.DiscoR, 203, 103), 1.2f); + int blueBoi = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RainbowTorch, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, new Color(Main.DiscoR, 203, 103), 1.2f); Main.dust[blueBoi].velocity *= 0.1f; Main.dust[blueBoi].noGravity = true; } @@ -46,7 +46,7 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.timeLeft > 195) return false; - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } @@ -55,7 +55,7 @@ namespace CalamityMod.Projectiles.Melee { for (int k = 0; k < 7; k++) { - int blueBoi = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 66, 0f, 0f, 150, new Color(Main.DiscoR, 203, 103), 1.2f); + int blueBoi = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RainbowTorch, 0f, 0f, 150, new Color(Main.DiscoR, 203, 103), 1.2f); Main.dust[blueBoi].noGravity = true; } } diff --git a/Projectiles/Melee/SwordsplosionGreen.cs b/Projectiles/Melee/SwordsplosionGreen.cs index 8643a98643..c92125967f 100644 --- a/Projectiles/Melee/SwordsplosionGreen.cs +++ b/Projectiles/Melee/SwordsplosionGreen.cs @@ -1,6 +1,6 @@ +using System; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Melee Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.3f / 255f, (255 - Projectile.alpha) * 0.4f / 255f, (255 - Projectile.alpha) * 1f / 255f); if (Projectile.localAI[1] > 7f) { - int greenBoi = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 66, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, new Color(53, Main.DiscoG, 255), 1.2f); + int greenBoi = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RainbowTorch, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, new Color(53, Main.DiscoG, 255), 1.2f); Main.dust[greenBoi].velocity *= 0.1f; Main.dust[greenBoi].noGravity = true; } @@ -45,7 +45,7 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.timeLeft > 295) return false; - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } @@ -54,7 +54,7 @@ namespace CalamityMod.Projectiles.Melee { for (int k = 0; k < 7; k++) { - int greenBoi = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 66, 0f, 0f, 150, new Color(53, Main.DiscoG, 255), 1.2f); + int greenBoi = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RainbowTorch, 0f, 0f, 150, new Color(53, Main.DiscoG, 255), 1.2f); Main.dust[greenBoi].noGravity = true; } } diff --git a/Projectiles/Melee/SwordsplosionPurple.cs b/Projectiles/Melee/SwordsplosionPurple.cs index 8dd5acffab..3763256b22 100644 --- a/Projectiles/Melee/SwordsplosionPurple.cs +++ b/Projectiles/Melee/SwordsplosionPurple.cs @@ -1,6 +1,6 @@ +using System; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -29,7 +29,7 @@ namespace CalamityMod.Projectiles.Melee Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.3f / 255f, (255 - Projectile.alpha) * 0.4f / 255f, (255 - Projectile.alpha) * 1f / 255f); if (Projectile.localAI[1] > 7f) { - int purpleBoi = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 66, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, new Color(Main.DiscoR, 100, 255), 1.2f); + int purpleBoi = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RainbowTorch, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, new Color(Main.DiscoR, 100, 255), 1.2f); Main.dust[purpleBoi].velocity *= 0.1f; Main.dust[purpleBoi].noGravity = true; } @@ -46,7 +46,7 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.timeLeft > 295) return false; - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } @@ -55,7 +55,7 @@ namespace CalamityMod.Projectiles.Melee { for (int k = 0; k < 7; k++) { - int purpleBoi = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 66, 0f, 0f, 150, new Color(Main.DiscoR, 100, 255), 1.2f); + int purpleBoi = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RainbowTorch, 0f, 0f, 150, new Color(Main.DiscoR, 100, 255), 1.2f); Main.dust[purpleBoi].noGravity = true; } } diff --git a/Projectiles/Melee/SwordsplosionRed.cs b/Projectiles/Melee/SwordsplosionRed.cs index eb591be3bc..1b5a77cb25 100644 --- a/Projectiles/Melee/SwordsplosionRed.cs +++ b/Projectiles/Melee/SwordsplosionRed.cs @@ -1,6 +1,6 @@ +using System; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -29,7 +29,7 @@ namespace CalamityMod.Projectiles.Melee Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.3f / 255f, (255 - Projectile.alpha) * 0.4f / 255f, (255 - Projectile.alpha) * 1f / 255f); if (Projectile.localAI[1] > 7f) { - int redBoi = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 66, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, new Color(255, Main.DiscoG, 53), 1.2f); + int redBoi = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RainbowTorch, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, new Color(255, Main.DiscoG, 53), 1.2f); Main.dust[redBoi].velocity *= 0.1f; Main.dust[redBoi].noGravity = true; } @@ -46,7 +46,7 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.timeLeft > 195) return false; - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } @@ -55,7 +55,7 @@ namespace CalamityMod.Projectiles.Melee { for (int k = 0; k < 7; k++) { - int redBoi = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 66, 0f, 0f, 150, new Color(255, Main.DiscoG, 53), 1.2f); + int redBoi = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RainbowTorch, 0f, 0f, 150, new Color(255, Main.DiscoG, 53), 1.2f); Main.dust[redBoi].noGravity = true; } } diff --git a/Projectiles/Melee/TaintedBladeSlasher.cs b/Projectiles/Melee/TaintedBladeSlasher.cs index ee548fb87e..4bc31dba95 100644 --- a/Projectiles/Melee/TaintedBladeSlasher.cs +++ b/Projectiles/Melee/TaintedBladeSlasher.cs @@ -1,15 +1,15 @@ -using CalamityMod.CalPlayer; +using System; +using System.IO; +using CalamityMod.CalPlayer; +using CalamityMod.Graphics.Primitives; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; using Terraria; +using Terraria.Audio; +using Terraria.GameContent; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using Terraria.GameContent; -using CalamityMod.Graphics.Primitives; namespace CalamityMod.Projectiles.Melee { diff --git a/Projectiles/Melee/TenebreusTidesWaterProjectile.cs b/Projectiles/Melee/TenebreusTidesWaterProjectile.cs index ea37d33a7c..e9f30041da 100644 --- a/Projectiles/Melee/TenebreusTidesWaterProjectile.cs +++ b/Projectiles/Melee/TenebreusTidesWaterProjectile.cs @@ -1,9 +1,9 @@ using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { public class TenebreusTidesWaterProjectile : ModProjectile, ILocalizedModType @@ -34,7 +34,7 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { Lighting.AddLight((int)Projectile.Center.X / 16, (int)Projectile.Center.Y / 16, 0f, 0f, (255 - Projectile.alpha) * 1f / 255f); - int water = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 0.4f); + int water = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Water, 0f, 0f, 100, default, 0.4f); Main.dust[water].noGravity = true; Main.dust[water].velocity *= 0.5f; Main.dust[water].velocity += Projectile.velocity * 0.1f; @@ -67,7 +67,7 @@ namespace CalamityMod.Projectiles.Melee dist = dustSpeed / dist; dustVel.X *= dist; dustVel.Y *= dist; - int water = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 1.2f); + int water = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Water, 0f, 0f, 100, default, 1.2f); Dust dust = Main.dust[water]; dust.noGravity = true; dust.position.X = Projectile.Center.X; diff --git a/Projectiles/Melee/TenebreusTidesWaterSpear.cs b/Projectiles/Melee/TenebreusTidesWaterSpear.cs index 05a3840fc4..22fb1371eb 100644 --- a/Projectiles/Melee/TenebreusTidesWaterSpear.cs +++ b/Projectiles/Melee/TenebreusTidesWaterSpear.cs @@ -1,10 +1,12 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using System.IO; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Melee { public class TenebreusTidesWaterSpear : ModProjectile, ILocalizedModType @@ -59,7 +61,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.frame = 0; } - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X); + Projectile.rotation = Projectile.velocity.ToRotation(); // If projectile hasn't hit anything yet if (Projectile.ai[0] == 0f) @@ -67,7 +69,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.localAI[0] += 1f; if (Projectile.localAI[0] > 7f) { - int water = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 0.4f); + int water = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Water, 0f, 0f, 100, default, 0.4f); Main.dust[water].noGravity = true; Main.dust[water].velocity *= 0.5f; Main.dust[water].velocity += Projectile.velocity * 0.1f; @@ -150,7 +152,7 @@ namespace CalamityMod.Projectiles.Melee if (Main.rand.NextBool(3)) { - int water = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 0.4f); + int water = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Water, 0f, 0f, 100, default, 0.4f); Main.dust[water].noGravity = true; Main.dust[water].velocity *= 0.5f; Main.dust[water].velocity += Projectile.velocity * 0.1f; @@ -182,7 +184,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.localAI[0] += 1f; - int water = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 0.4f); + int water = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 0.4f); Main.dust[water].noGravity = true; Main.dust[water].velocity *= 0.5f; Main.dust[water].velocity += Projectile.velocity * 0.1f; @@ -204,7 +206,7 @@ namespace CalamityMod.Projectiles.Melee { if (dontDraw) return false; - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; int height = texture.Height / Main.projFrames[Projectile.type]; int frameHeight = height * Projectile.frame; Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, frameHeight, texture.Width, height)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture.Width / 2f, (float)height / 2f), Projectile.scale, SpriteEffects.None, 0); diff --git a/Projectiles/Melee/TenebreusTidesWaterSword.cs b/Projectiles/Melee/TenebreusTidesWaterSword.cs index f4b305e391..bcec9f85c8 100644 --- a/Projectiles/Melee/TenebreusTidesWaterSword.cs +++ b/Projectiles/Melee/TenebreusTidesWaterSword.cs @@ -1,10 +1,12 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using System.IO; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Melee { public class TenebreusTidesWaterSword : ModProjectile, ILocalizedModType @@ -41,7 +43,7 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + MathHelper.ToRadians(45f); + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.ToRadians(45f); // If projectile hasn't hit anything yet if (Projectile.ai[0] == 0f) @@ -49,7 +51,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.localAI[0] += 1f; if (Projectile.localAI[0] > 7f) { - int water = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 0.4f); + int water = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Water, 0f, 0f, 100, default, 0.4f); Main.dust[water].noGravity = true; Main.dust[water].velocity *= 0.5f; Main.dust[water].velocity += Projectile.velocity * 0.1f; @@ -132,7 +134,7 @@ namespace CalamityMod.Projectiles.Melee if (Main.rand.NextBool(3)) { - int water = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 0.4f); + int water = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Water, 0f, 0f, 100, default, 0.4f); Main.dust[water].noGravity = true; Main.dust[water].velocity *= 0.5f; Main.dust[water].velocity += Projectile.velocity * 0.1f; @@ -164,7 +166,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.localAI[0] += 1f; - int water = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 0.4f); + int water = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 0.4f); Main.dust[water].noGravity = true; Main.dust[water].velocity *= 0.5f; Main.dust[water].velocity += Projectile.velocity * 0.1f; @@ -186,7 +188,7 @@ namespace CalamityMod.Projectiles.Melee { if (dontDraw) return false; - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, 0, texture.Width, texture.Height)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture.Width / 2f, (float)texture.Height / 2f), Projectile.scale, SpriteEffects.None, 0); return false; } diff --git a/Projectiles/Melee/TerraSpear.cs b/Projectiles/Melee/TerraSpear.cs deleted file mode 100644 index 90e863d103..0000000000 --- a/Projectiles/Melee/TerraSpear.cs +++ /dev/null @@ -1,86 +0,0 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Audio; - -namespace CalamityMod.Projectiles.Melee -{ - public class TerraSpear : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Melee"; - public override void SetDefaults() - { - Projectile.width = 10; - Projectile.height = 10; - Projectile.friendly = true; - Projectile.DamageType = DamageClass.Melee; - Projectile.tileCollide = false; - Projectile.penetrate = -1; - Projectile.timeLeft = 180; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; - } - - public override void AI() - { - Lighting.AddLight(Projectile.Center, 0f, (255 - Projectile.alpha) * 1f / 255f, 0f); - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 0.785f; - if (Projectile.localAI[1] == 0f) - { - Projectile.scale -= 0.01f; - Projectile.alpha += 15; - if (Projectile.alpha >= 125) - { - Projectile.alpha = 130; - Projectile.localAI[1] = 1f; - } - } - else if (Projectile.localAI[1] == 1f) - { - Projectile.scale += 0.01f; - Projectile.alpha -= 15; - if (Projectile.alpha <= 0) - { - Projectile.alpha = 0; - Projectile.localAI[1] = 0f; - } - } - if (Main.rand.NextBool(3)) - { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 107, Projectile.velocity.X * 0.1f, Projectile.velocity.Y * 0.1f); - } - } - - public override void OnKill(int timeLeft) - { - SoundEngine.PlaySound(SoundID.Item10, Projectile.position); - int inc; - for (int i = 4; i < 31; i = inc + 1) - { - float projOldX = Projectile.oldVelocity.X * (30f / (float)i); - float projOldY = Projectile.oldVelocity.Y * (30f / (float)i); - int terraDust = Dust.NewDust(new Vector2(Projectile.oldPosition.X - projOldX, Projectile.oldPosition.Y - projOldY), 8, 8, 107, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.8f); - Main.dust[terraDust].noGravity = true; - Dust dust = Main.dust[terraDust]; - dust.velocity *= 0.5f; - terraDust = Dust.NewDust(new Vector2(Projectile.oldPosition.X - projOldX, Projectile.oldPosition.Y - projOldY), 8, 8, 107, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.4f); - dust = Main.dust[terraDust]; - dust.velocity *= 0.05f; - inc = i; - } - } - - public override bool PreDraw(ref Color lightColor) - { - if (Projectile.timeLeft > 175) - return false; - - Texture2D tex = ModContent.Request(Texture).Value; - Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); - return false; - } - } -} diff --git a/Projectiles/Melee/TerratomereBeam.cs b/Projectiles/Melee/TerratomereBeam.cs index 98e28883c2..e25ce01dd4 100644 --- a/Projectiles/Melee/TerratomereBeam.cs +++ b/Projectiles/Melee/TerratomereBeam.cs @@ -1,10 +1,10 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; -using Terraria.Graphics.Shaders; -using Microsoft.Xna.Framework.Graphics; -using System.Collections.Generic; +using System.Collections.Generic; using CalamityMod.Graphics.Primitives; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Graphics.Shaders; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { diff --git a/Projectiles/Melee/TerratomereBigSlash.cs b/Projectiles/Melee/TerratomereBigSlash.cs index 7f1ccc9d30..0e339a35e8 100644 --- a/Projectiles/Melee/TerratomereBigSlash.cs +++ b/Projectiles/Melee/TerratomereBigSlash.cs @@ -1,11 +1,11 @@ -using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Graphics.Primitives; +using CalamityMod.Items.Weapons.Melee; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; -using Terraria.ModLoader; -using Terraria.ID; using Terraria.Graphics.Shaders; -using CalamityMod.Graphics.Primitives; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { @@ -34,9 +34,14 @@ namespace CalamityMod.Projectiles.Melee Projectile.DamageType = DamageClass.Melee; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = -1; + Projectile.extraUpdates = 1; } - public override void AI() => Projectile.scale = Utils.GetLerpValue(0f, 8f, Projectile.timeLeft, true); + public override void AI() + { + CalamityUtils.HomeInOnNPC(Projectile, true, 600f, 24f, 20f); + Projectile.scale = Utils.GetLerpValue(0f, 8f, Projectile.timeLeft, true); + } public float SlashWidthFunction(float _) => Projectile.width * Projectile.scale * Utils.GetLerpValue(0f, 0.1f, _, true); @@ -45,7 +50,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { TargetIndex = target.whoAmI; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), target.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), target.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5f), Projectile.knockBack, Projectile.owner); if (Projectile.timeLeft > 12) Projectile.timeLeft = 12; @@ -69,6 +74,7 @@ namespace CalamityMod.Projectiles.Melee for (int i = 0; i < 4; i++) PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(SlashWidthFunction, SlashColorFunction, (_) => Projectile.Size * 0.5f, shader: GameShaders.Misc["CalamityMod:ExobladePierce"]), 30); + return false; } diff --git a/Projectiles/Melee/TerratomereExplosion.cs b/Projectiles/Melee/TerratomereExplosion.cs index 1d5bd85e62..ecb1d3d4f6 100644 --- a/Projectiles/Melee/TerratomereExplosion.cs +++ b/Projectiles/Melee/TerratomereExplosion.cs @@ -42,11 +42,11 @@ namespace CalamityMod.Projectiles.Melee // Determine frames. Once the maximum frame is reached the projectile dies. Projectile.frameCounter++; - if (Projectile.frameCounter % 8 == 7) + if (Projectile.frameCounter % 5 == 4) Projectile.frame++; if (Projectile.frame >= 18) Projectile.Kill(); - + // Exponentially accelerate. Projectile.scale *= Terratomere.ExplosionExpandFactor; Projectile.Opacity = Utils.GetLerpValue(5f, 36f, Projectile.timeLeft, true); @@ -54,7 +54,7 @@ namespace CalamityMod.Projectiles.Melee public void AdditiveDraw(SpriteBatch spriteBatch) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Texture2D lightTexture = ModContent.Request("CalamityMod/Skies/XerocLight").Value; Rectangle frame = texture.Frame(3, 6, Projectile.frame / 6, Projectile.frame % 6); Vector2 drawPosition = Projectile.Center - Main.screenPosition; diff --git a/Projectiles/Melee/TerratomereHoldoutProj.cs b/Projectiles/Melee/TerratomereHoldoutProj.cs index 5dee9fcaec..9861f0ab15 100644 --- a/Projectiles/Melee/TerratomereHoldoutProj.cs +++ b/Projectiles/Melee/TerratomereHoldoutProj.cs @@ -1,17 +1,19 @@ -using CalamityMod.Buffs.StatDebuffs; +using System; +using System.Collections.Generic; +using System.Linq; +using CalamityMod.Balancing; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Graphics.Primitives; using CalamityMod.Items.Weapons.Melee; -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; +using CalamityMod.Projectiles.Healing; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.Collections.Generic; -using Terraria.Graphics.Shaders; +using Terraria; using Terraria.Audio; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; using static CalamityMod.CalamityUtils; -using System.Linq; -using CalamityMod.Graphics.Primitives; namespace CalamityMod.Projectiles.Melee { @@ -153,17 +155,25 @@ namespace CalamityMod.Projectiles.Melee // Create the slash. if (Time == (int)(Terratomere.SwingTime * (SwingCompletionRatio + 0.15f))) SoundEngine.PlaySound(Terratomere.SwingSound, Projectile.Center); - + + // Create 4 beams. + bool createBeams = Time == (int)(Terratomere.SwingTime * RecoveryCompletionRatio) + 5f; if (Main.myPlayer == Projectile.owner && Time == (int)(Terratomere.SwingTime * (SwingCompletionRatio + 0.34f))) { - Vector2 bigSlashVelocity = Projectile.SafeDirectionTo(Main.MouseWorld) * Owner.ActiveItem().shootSpeed; + Vector2 bigSlashVelocity = Projectile.SafeDirectionTo(Main.MouseWorld) * Owner.ActiveItem().shootSpeed / 2f; if (bigSlashVelocity.AngleBetween(InitialRotation.ToRotationVector2()) > 1.456f) bigSlashVelocity = InitialRotation.ToRotationVector2() * bigSlashVelocity.Length(); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center - bigSlashVelocity * 0.4f, bigSlashVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + int totalBeams = 4; + float randomVelocityLimit = bigSlashVelocity.Length() * 0.2f; + for (int i = 0; i < totalBeams; i++) + { + Vector2 randomVelocity = Main.rand.NextVector2CircularEdge(randomVelocityLimit, randomVelocityLimit); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center - bigSlashVelocity * 0.4f, bigSlashVelocity + randomVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + } } - // Create a terra blade-like beam when the slash terminates. + // This is a slash, not a beam. if (Main.myPlayer == Projectile.owner && Time == (int)(Terratomere.SwingTime * RecoveryCompletionRatio) + 5f) { Vector2 bigSlashVelocity = InitialRotation.ToRotationVector2() * Owner.ActiveItem().shootSpeed / 6f; @@ -244,7 +254,7 @@ namespace CalamityMod.Projectiles.Melee public void DrawBlade(Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Vector2 drawPosition = Projectile.Center - Main.screenPosition; Vector2 origin = texture.Size() * Vector2.UnitY; if (Projectile.spriteDirection == -1) @@ -267,27 +277,31 @@ namespace CalamityMod.Projectiles.Melee #region Hit Effects and Collision - public void OnHitHealEffect() + public void OnHitHealEffect(int damage) { - if (Owner.moonLeech) + int heal = (int)Math.Round(damage * 0.025); + if (heal > BalancingConstants.LifeStealCap) + heal = BalancingConstants.LifeStealCap; + + if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0) return; - - Owner.statLife += Terratomere.TrueMeleeHitHeal; - Owner.HealEffect(Terratomere.TrueMeleeHitHeal); + + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ModContent.ProjectileType(), BalancingConstants.LifeStealRange); } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { - float _ = 0f; + float point = 0f; Vector2 direction = (InitialRotation + GetSwingOffsetAngle(SwingCompletion)).ToRotationVector2() * new Vector2(Projectile.spriteDirection, 1f); - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + direction * Projectile.height * Projectile.scale, Projectile.width * 0.25f, ref _); + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + direction * Projectile.height * Projectile.scale, Projectile.width * 0.25f, ref point); } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(ModContent.BuffType(), Terratomere.TrueMeleeGlacialStateTime); - if (target.canGhostHeal) - OnHitHealEffect(); + + if (target.lifeMax > 5) + OnHitHealEffect(hit.Damage); // Create a slash creator on top of the hit target. int slashCreatorID = ModContent.ProjectileType(); @@ -301,7 +315,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitPlayer(Player target, Player.HurtInfo info) { target.AddBuff(ModContent.BuffType(), Terratomere.TrueMeleeGlacialStateTime); - OnHitHealEffect(); + OnHitHealEffect(info.Damage); } #endregion Hit Effects and Collision } diff --git a/Projectiles/Melee/TerratomereSlash.cs b/Projectiles/Melee/TerratomereSlash.cs index 4a2f658275..eb7bdb2e23 100644 --- a/Projectiles/Melee/TerratomereSlash.cs +++ b/Projectiles/Melee/TerratomereSlash.cs @@ -1,8 +1,8 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ModLoader; -using System; namespace CalamityMod.Projectiles.Melee { @@ -53,13 +53,13 @@ namespace CalamityMod.Projectiles.Melee float progress = (33f - Projectile.timeLeft) / 33f; - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Texture2D bloomTexture = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; Vector2 drawPosition = Projectile.Center - Main.screenPosition; Vector2 origin = texture.Size() * 0.5f; Vector2 scale = new Vector2(MathHelper.Lerp(0.8f, 1.25f, (float)Math.Pow(progress, 0.45)), MathHelper.Lerp(0.6f, 0.24f, (float)Math.Pow(progress, 0.4))) * Projectile.scale; - + // Draw an inner bloom circle to signify power at the center of the strike along with two thinner lines. Vector2 bloomScale = Projectile.Size / bloomTexture.Size() * new Vector2(1f, 2f); Vector2 bloomOrigin = bloomTexture.Size() * 0.5f; diff --git a/Projectiles/Melee/TerratomereSlashCreator.cs b/Projectiles/Melee/TerratomereSlashCreator.cs index e31ac0cd61..f5750cb653 100644 --- a/Projectiles/Melee/TerratomereSlashCreator.cs +++ b/Projectiles/Melee/TerratomereSlashCreator.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Projectiles.Melee { public new string LocalizationCategory => "Projectiles.Melee"; public NPC Target => Main.npc[(int)Projectile.ai[0]]; - + public float SlashDirection { get @@ -31,7 +31,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.ignoreWater = false; Projectile.tileCollide = false; Projectile.penetrate = -1; - Projectile.timeLeft = 45; + Projectile.timeLeft = 36; Projectile.MaxUpdates = 2; Projectile.noEnchantmentVisuals = true; } diff --git a/Projectiles/Melee/TerrorBeam.cs b/Projectiles/Melee/TerrorBeam.cs index a4dd1be9e0..3dadc5c1ea 100644 --- a/Projectiles/Melee/TerrorBeam.cs +++ b/Projectiles/Melee/TerrorBeam.cs @@ -1,10 +1,10 @@ +using System; using CalamityMod.Items.Weapons.Melee; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -19,8 +19,8 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - Projectile.width = 16; - Projectile.height = 16; + Projectile.width = 32; + Projectile.height = 32; Projectile.friendly = true; Projectile.DamageType = DamageClass.Melee; Projectile.penetrate = 4; @@ -84,12 +84,7 @@ namespace CalamityMod.Projectiles.Melee { Projectile.alpha = 0; } - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 0.785f; - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(255, 0, 0, Projectile.alpha); + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4; } public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Melee/TerrorBeam.png b/Projectiles/Melee/TerrorBeam.png index 6033712f0c..000fe3428e 100644 Binary files a/Projectiles/Melee/TerrorBeam.png and b/Projectiles/Melee/TerrorBeam.png differ diff --git a/Projectiles/Melee/TerrorBlast.cs b/Projectiles/Melee/TerrorBlast.cs index cf21a58e37..2352264195 100644 --- a/Projectiles/Melee/TerrorBlast.cs +++ b/Projectiles/Melee/TerrorBlast.cs @@ -1,8 +1,8 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { public class TerrorBlast : ModProjectile, ILocalizedModType @@ -38,14 +38,14 @@ namespace CalamityMod.Projectiles.Melee Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int i = 0; i < 6; i++) - Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 100, default, 1.5f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RedTorch, 0f, 0f, 100, default, 1.5f); for (int i = 0; i < 60; i++) { - int scaryDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 0, default, 2.5f); + int scaryDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RedTorch, 0f, 0f, 0, default, 2.5f); Main.dust[scaryDust].noGravity = true; Main.dust[scaryDust].velocity *= 3f; - scaryDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 100, default, 1.5f); + scaryDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RedTorch, 0f, 0f, 100, default, 1.5f); Main.dust[scaryDust].velocity *= 2f; Main.dust[scaryDust].noGravity = true; } diff --git a/Projectiles/Melee/ThornBase.cs b/Projectiles/Melee/ThornBase.cs index 716a8de3cf..637585167f 100644 --- a/Projectiles/Melee/ThornBase.cs +++ b/Projectiles/Melee/ThornBase.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; @@ -20,6 +20,9 @@ namespace CalamityMod.Projectiles.Melee Projectile.tileCollide = false; Projectile.ignoreWater = true; Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = 2; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 8; } public override void AI() @@ -57,9 +60,9 @@ namespace CalamityMod.Projectiles.Melee { for (int i = 0; i < 3; i++) { - Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 18, Projectile.velocity.X * 0.025f, Projectile.velocity.Y * 0.025f, 170, new Color(), 1.2f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CorruptGibs, Projectile.velocity.X * 0.025f, Projectile.velocity.Y * 0.025f, 170, new Color(), 1.2f); } - Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 14, 0f, 0f, 170, new Color(), 1.1f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Demonite, 0f, 0f, 170, new Color(), 1.1f); } if (Projectile.alpha >= 255) @@ -73,7 +76,7 @@ namespace CalamityMod.Projectiles.Melee // Draw the tip for the final thorn public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; if (Projectile.ai[0] == TotalSegments) texture = ModContent.Request("CalamityMod/Projectiles/Melee/ThornTip").Value; diff --git a/Projectiles/Melee/TinyCrystal.cs b/Projectiles/Melee/TinyCrystal.cs deleted file mode 100644 index 2aa5998eff..0000000000 --- a/Projectiles/Melee/TinyCrystal.cs +++ /dev/null @@ -1,73 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Audio; - -namespace CalamityMod.Projectiles.Melee -{ - public class TinyCrystal : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Melee"; - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public override void SetDefaults() - { - Projectile.width = 8; - Projectile.height = 8; - Projectile.friendly = true; - Projectile.DamageType = DamageClass.Melee; - Projectile.penetrate = 1; - Projectile.alpha = 255; - Projectile.timeLeft = 90; - } - - public override bool? CanHitNPC(NPC target) => Projectile.timeLeft < 75 && target.CanBeChasedBy(Projectile); - - public override void AI() - { - int dustType = Projectile.ai[0] == 0f ? 56 : 73; - for (int i = 0; i < 2; i++) - { - float shortXVel = Projectile.velocity.X / 3f * (float)i; - float shortYVel = Projectile.velocity.Y / 3f * (float)i; - int dustPosModifier = 4; - int crystalDust = Dust.NewDust(new Vector2(Projectile.position.X + (float)dustPosModifier, Projectile.position.Y + (float)dustPosModifier), Projectile.width - dustPosModifier * 2, Projectile.height - dustPosModifier * 2, dustType, 0f, 0f, 100, default, 1.2f); - Main.dust[crystalDust].noGravity = true; - Main.dust[crystalDust].velocity *= 0.1f; - Main.dust[crystalDust].velocity += Projectile.velocity * 0.1f; - Dust expr_47FA_cp_0 = Main.dust[crystalDust]; - expr_47FA_cp_0.position.X -= shortXVel; - Dust expr_4815_cp_0 = Main.dust[crystalDust]; - expr_4815_cp_0.position.Y -= shortYVel; - } - - if (Main.rand.NextBool(10)) - { - int dustPosModifierAgain = 4; - int extraCrystalDust = Dust.NewDust(new Vector2(Projectile.position.X + (float)dustPosModifierAgain, Projectile.position.Y + (float)dustPosModifierAgain), Projectile.width - dustPosModifierAgain * 2, Projectile.height - dustPosModifierAgain * 2, dustType, 0f, 0f, 100, default, 0.6f); - Main.dust[extraCrystalDust].velocity *= 0.25f; - Main.dust[extraCrystalDust].velocity += Projectile.velocity * 0.5f; - } - - if (Projectile.timeLeft < 75) - CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 450f, 9f, 20f); - } - - public override void OnKill(int timeLeft) - { - int dustType = Projectile.ai[0] == 0f ? 56 : 73; - for (int k = 0; k < 5; k++) - { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, dustType, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); - } - SoundEngine.PlaySound(SoundID.Item10, Projectile.position); - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - int buffType = Projectile.ai[0] == 0f ? BuffID.Frostburn2 : BuffID.OnFire; - target.AddBuff(buffType, 90); - } - } -} diff --git a/Projectiles/Melee/TinyFlare.cs b/Projectiles/Melee/TinyFlare.cs index ef6cb08da4..325ec784cf 100644 --- a/Projectiles/Melee/TinyFlare.cs +++ b/Projectiles/Melee/TinyFlare.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Melee { for (int i = 0; i < 3; i++) { - int fiery = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 174, 0f, 0f, 100, default, 0.75f); + int fiery = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.InfernoFork, 0f, 0f, 100, default, Main.rand.NextFloat(1.5f, 2.5f)); Main.dust[fiery].noGravity = true; Main.dust[fiery].velocity *= 0f; } diff --git a/Projectiles/Melee/Tornado.cs b/Projectiles/Melee/Tornado.cs index 8a0fe3f3eb..035dbd64cf 100644 --- a/Projectiles/Melee/Tornado.cs +++ b/Projectiles/Melee/Tornado.cs @@ -1,11 +1,11 @@ -using CalamityMod.CalPlayer; +using System; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { public class Tornado : ModProjectile, ILocalizedModType @@ -173,7 +173,7 @@ namespace CalamityMod.Projectiles.Melee Vector2 sizeModdingPos = new Vector2(0f, sizeModdingVector2.Y - sizeModdingVector.Y); sizeModdingPos.X = sizeModdingPos.Y * vectorMult; new Vector2(sizeModdingVector.X - sizeModdingPos.X / 2f, sizeModdingVector.Y); - Texture2D texture2D23 = ModContent.Request(Texture).Value; + Texture2D texture2D23 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Rectangle drawRectangle = texture2D23.Frame(1, 1, 0, 0); Vector2 smallRect = drawRectangle.Size() / 2f; float aiTrackMult = -0.06283186f * aiTracker; diff --git a/Projectiles/Melee/TriactisHammerProj.cs b/Projectiles/Melee/TriactisHammerProj.cs index f1595d901b..37c79c6c07 100644 --- a/Projectiles/Melee/TriactisHammerProj.cs +++ b/Projectiles/Melee/TriactisHammerProj.cs @@ -1,10 +1,10 @@ -using CalamityMod.Projectiles.Typeless; +using System; +using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -29,6 +29,8 @@ namespace CalamityMod.Projectiles.Melee Projectile.penetrate = -1; Projectile.extraUpdates = 3; Projectile.DamageType = DamageClass.MeleeNoSpeed; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() @@ -109,7 +111,7 @@ namespace CalamityMod.Projectiles.Melee SoundEngine.PlaySound(SoundID.Item14, Projectile.position); for (int i = 0; i < 40; i++) { - int triactisDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, Main.rand.NextBool() ? 89 : 229, 0f, 0f, 100, default, 2f); + int triactisDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, Main.rand.NextBool() ? 89 : 229, 0f, 0f, 100, default, 2f); Main.dust[triactisDust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -119,10 +121,10 @@ namespace CalamityMod.Projectiles.Melee } for (int j = 0; j < 70; j++) { - int triactisDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, Main.rand.NextBool() ? 89 : 229, 0f, 0f, 100, default, 3f); + int triactisDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, Main.rand.NextBool() ? 89 : 229, 0f, 0f, 100, default, 3f); Main.dust[triactisDust2].noGravity = true; Main.dust[triactisDust2].velocity *= 5f; - triactisDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, Main.rand.NextBool() ? 89 : 229, 0f, 0f, 100, default, 2f); + triactisDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, Main.rand.NextBool() ? 89 : 229, 0f, 0f, 100, default, 2f); Main.dust[triactisDust2].velocity *= 2f; } } @@ -134,7 +136,7 @@ namespace CalamityMod.Projectiles.Melee SoundEngine.PlaySound(SoundID.Item14, Projectile.position); for (int i = 0; i < 40; i++) { - int triactisDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, Main.rand.NextBool() ? 89 : 229, 0f, 0f, 100, default, 2f); + int triactisDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, Main.rand.NextBool() ? 89 : 229, 0f, 0f, 100, default, 2f); Main.dust[triactisDust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -144,10 +146,10 @@ namespace CalamityMod.Projectiles.Melee } for (int j = 0; j < 70; j++) { - int triactisDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, Main.rand.NextBool() ? 89 : 229, 0f, 0f, 100, default, 3f); + int triactisDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, Main.rand.NextBool() ? 89 : 229, 0f, 0f, 100, default, 3f); Main.dust[triactisDust2].noGravity = true; Main.dust[triactisDust2].velocity *= 5f; - triactisDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, Main.rand.NextBool() ? 89 : 229, 0f, 0f, 100, default, 2f); + triactisDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, Main.rand.NextBool() ? 89 : 229, 0f, 0f, 100, default, 2f); Main.dust[triactisDust2].velocity *= 2f; } } diff --git a/Projectiles/Melee/TrueAncientBeam.cs b/Projectiles/Melee/TrueAncientBeam.cs index 3f6e75808a..ac70351edc 100644 --- a/Projectiles/Melee/TrueAncientBeam.cs +++ b/Projectiles/Melee/TrueAncientBeam.cs @@ -1,13 +1,13 @@ -using CalamityMod.Particles; +using System; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using static Terraria.ModLoader.ModContent; using static CalamityMod.CalamityUtils; -using Terraria.Audio; +using static Terraria.ModLoader.ModContent; namespace CalamityMod.Projectiles.Melee @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Melee ProjectileID.Sets.TrailingMode[Projectile.type] = 2; } - const float MaxTime = 40; + const float MaxTime = 75; public float Timer => MaxTime - Projectile.timeLeft; public override void SetDefaults() @@ -59,7 +59,7 @@ namespace CalamityMod.Projectiles.Melee if (Main.rand.NextBool(3)) { - int dustTrail = Dust.NewDust(Projectile.Center, 14, 14, 66, Projectile.velocity.X * 0.05f, Projectile.velocity.Y * 0.05f, 150, new Color(Main.DiscoR, 100, 255), 1.2f); + int dustTrail = Dust.NewDust(Projectile.Center, 14, 14, DustID.RainbowTorch, Projectile.velocity.X * 0.05f, Projectile.velocity.Y * 0.05f, 150, new Color(Main.DiscoR, 100, 255), 1.2f); Main.dust[dustTrail].noGravity = true; } @@ -79,7 +79,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - if (Projectile.timeLeft > 35) + if (Projectile.timeLeft > 70) return false; DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); @@ -89,7 +89,7 @@ namespace CalamityMod.Projectiles.Melee Texture2D starTexture = Request("CalamityMod/Particles/Sparkle").Value; Texture2D bloomTexture = Request("CalamityMod/Particles/BloomCircle").Value; - //Ajust the bloom's texture to be the same size as the star's + //Adjust the bloom's texture to be the same size as the star's float properBloomSize = (float)starTexture.Height / (float)bloomTexture.Height; Color color = Main.hslToRgb((Main.GlobalTimeWrappedHourly * 0.6f) % 1, 1, 0.85f); @@ -97,7 +97,7 @@ namespace CalamityMod.Projectiles.Melee Vector2 sparkCenter = Projectile.Center - Utils.SafeNormalize(Projectile.velocity, Vector2.Zero) * 30.5f - Main.screenPosition; - Main.EntitySpriteDraw(bloomTexture, sparkCenter, null, color* 0.5f, 0, bloomTexture.Size() / 2f, 4 * properBloomSize, SpriteEffects.None, 0); + Main.EntitySpriteDraw(bloomTexture, sparkCenter, null, color * 0.5f, 0, bloomTexture.Size() / 2f, 4 * properBloomSize, SpriteEffects.None, 0); Main.EntitySpriteDraw(starTexture, sparkCenter, null, color * 0.5f, rotation + MathHelper.PiOver4, starTexture.Size() / 2f, 2 * 0.75f, SpriteEffects.None, 0); Main.EntitySpriteDraw(starTexture, sparkCenter, null, Color.White, rotation, starTexture.Size() / 2f, 2, SpriteEffects.None, 0); diff --git a/Projectiles/Melee/TrueAncientBlast.cs b/Projectiles/Melee/TrueAncientBlast.cs index 014a8669f3..d5e29ed281 100644 --- a/Projectiles/Melee/TrueAncientBlast.cs +++ b/Projectiles/Melee/TrueAncientBlast.cs @@ -1,13 +1,13 @@ -using CalamityMod.Particles; +using System; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee diff --git a/Projectiles/Melee/TrueArkOfTheAncients_ParryHoldout.cs b/Projectiles/Melee/TrueArkOfTheAncients_ParryHoldout.cs index 002ee38331..1bd5336742 100644 --- a/Projectiles/Melee/TrueArkOfTheAncients_ParryHoldout.cs +++ b/Projectiles/Melee/TrueArkOfTheAncients_ParryHoldout.cs @@ -1,14 +1,14 @@ -using CalamityMod.Particles; +using System; +using System.IO; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee @@ -65,9 +65,13 @@ namespace CalamityMod.Projectiles.Melee GeneralParryEffects(); - //only get iframes if the enemy has contact damage :) + // 17APR2024: Ozzatron: True Ark of the Ancients is a parry. It uses vanilla parry iframes and benefits from Cross Necklace. + // However, iframes are only granted if the target has contact damage. This means it won't work on Providence. Too bad. I have no sympathy for you if you are using this weapon line. if (target.damage > 0) - Owner.GiveIFrames(35); + { + int arkParryIFrames = Owner.ComputeParryIFrames(); + Owner.GiveUniversalIFrames(arkParryIFrames, false); + } Vector2 particleOrigin = target.Hitbox.Size().Length() < 140 ? target.Center : Projectile.Center + Projectile.rotation.ToRotationVector2() * 60f; Particle spark = new GenericSparkle(particleOrigin, Vector2.Zero, Color.White, Color.HotPink, 1.2f, 35, 0.1f, 2); @@ -98,7 +102,7 @@ namespace CalamityMod.Projectiles.Melee } //Manage position and rotation - Projectile.Center = Owner.Center + DistanceFromPlayer ; + Projectile.Center = Owner.Center + DistanceFromPlayer; Projectile.scale = 1.4f + ((float)Math.Sin(Timer / 160 * MathHelper.Pi) * 0.6f); //SWAGGER if (Timer > ParryTime) diff --git a/Projectiles/Melee/TrueArkOfTheAncients_SwungBlade.cs b/Projectiles/Melee/TrueArkOfTheAncients_SwungBlade.cs index d1e64faccc..e3b784cf55 100644 --- a/Projectiles/Melee/TrueArkOfTheAncients_SwungBlade.cs +++ b/Projectiles/Melee/TrueArkOfTheAncients_SwungBlade.cs @@ -1,16 +1,16 @@ -using CalamityMod.Particles; +using System; +using System.IO; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Particles; +using CalamityMod.Sounds; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using static Terraria.ModLoader.ModContent; using static CalamityMod.CalamityUtils; -using Terraria.Audio; -using CalamityMod.Sounds; +using static Terraria.ModLoader.ModContent; namespace CalamityMod.Projectiles.Melee { @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Melee public ref float Charge => ref Projectile.ai[1]; public ref float HasFired => ref Projectile.localAI[0]; - const float MaxTime = 35; + const float MaxTime = 40; private float SwingWidth = MathHelper.PiOver2 * 1.5f; public Vector2 DistanceFromPlayer => direction * 30; public float Timer => MaxTime - Projectile.timeLeft; @@ -90,11 +90,11 @@ namespace CalamityMod.Projectiles.Melee Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.Lerp(SwingWidth / 2 * SwingDirection, -SwingWidth / 2 * SwingDirection, SwingRatio()); - Projectile.scale = 1.4f + ((float)Math.Sin(SwingRatio() * MathHelper.Pi) * 0.6f) + (Charge / 10f) * 0.6f; + Projectile.scale = 1.6f + ((float)Math.Sin(SwingRatio() * MathHelper.Pi) * 0.65f) + (Charge > 0 ? 0.6f : 0f); if (Owner.whoAmI == Main.myPlayer && SwingRatio() > 0.5f && HasFired == 0f && Charge > 0) { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Owner.Center + direction * 30f, Projectile.velocity * 2f, ProjectileType(), (int)(Projectile.damage * TrueArkoftheAncients.beamDamageMultiplier), 2f, Owner.whoAmI) ; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Owner.Center + direction * 30f, Projectile.velocity * 2f, ProjectileType(), (int)(Projectile.damage * TrueArkoftheAncients.beamDamageMultiplier), 2f, Owner.whoAmI); HasFired = 1f; } @@ -109,7 +109,7 @@ namespace CalamityMod.Projectiles.Melee } Owner.itemRotation = MathHelper.WrapAngle(Owner.itemRotation); - if (Charge > 0 && Main.rand.Next(2) == 0) + if (Charge > 0 && Main.rand.NextBool(2)) { Vector2 particleOrigin = Projectile.Center + Projectile.rotation.ToRotationVector2() * 85 * Projectile.scale; Vector2 particleSpeed = Projectile.rotation.ToRotationVector2().RotatedByRandom(MathHelper.PiOver4) * Main.rand.NextFloat(1.2f, 2f); @@ -130,7 +130,7 @@ namespace CalamityMod.Projectiles.Melee float drawAngle = Projectile.rotation; float drawRotation = Projectile.rotation + MathHelper.PiOver4 + extraAngle; - Vector2 drawOrigin = new Vector2(Owner.direction < 0 ? sword.Width : 0f , sword.Height); + Vector2 drawOrigin = new Vector2(Owner.direction < 0 ? sword.Width : 0f, sword.Height); Vector2 drawOffset = Owner.Center + drawAngle.ToRotationVector2() * 10f - Main.screenPosition; if (CalamityConfig.Instance.Afterimages && Timer > ProjectileID.Sets.TrailCacheLength[Projectile.type]) @@ -155,9 +155,9 @@ namespace CalamityMod.Projectiles.Melee float opacity = (float)Math.Sin(Timer / MaxTime * MathHelper.Pi); float rotation = (-MathHelper.PiOver4 * 0.5f + MathHelper.PiOver4 * 0.5f * Timer / MaxTime) * SwingDirection; - Color smearColor = Main.hslToRgb(((Timer - MaxTime * 0.5f ) / (MaxTime * 0.5f)) * 0.7f, 1, 0.6f); + Color smearColor = Main.hslToRgb(((Timer - MaxTime * 0.5f) / (MaxTime * 0.5f)) * 0.7f, 1, 0.6f); - Main.EntitySpriteDraw(smear, Owner.Center - Main.screenPosition, null, smearColor * 0.5f * opacity, Projectile.velocity.ToRotation() + MathHelper.Pi + rotation, smear.Size() / 2f, Projectile.scale * 1.4f, SpriteEffects.None, 0); + Main.EntitySpriteDraw(smear, Owner.Center - Main.screenPosition, null, smearColor * 0.5f * opacity, Projectile.velocity.ToRotation() + MathHelper.Pi + rotation, smear.Size() / 2f, Projectile.scale * 1.5f, SpriteEffects.None, 0); Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); diff --git a/Projectiles/Melee/TrueBiomeBladeHoldout.cs b/Projectiles/Melee/TrueBiomeBladeHoldout.cs index 2e1df47b79..672b2c4a28 100644 --- a/Projectiles/Melee/TrueBiomeBladeHoldout.cs +++ b/Projectiles/Melee/TrueBiomeBladeHoldout.cs @@ -1,16 +1,16 @@ -using CalamityMod.DataStructures; +using System; +using CalamityMod.DataStructures; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Particles; +using CalamityMod.Sounds; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; using static CalamityMod.CalamityUtils; using static Terraria.ModLoader.ModContent; -using Terraria.Audio; -using CalamityMod.Sounds; namespace CalamityMod.Projectiles.Melee { @@ -190,7 +190,7 @@ namespace CalamityMod.Projectiles.Melee if (ChanneledState == 0f && ChannelTimer > 10f) { - Texture2D tex = Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, lightColor, Projectile.rotation, tex.Size() / 2, 1, 0, 0); return false; @@ -198,7 +198,7 @@ namespace CalamityMod.Projectiles.Melee } else if (ChanneledState == 1f) { - Texture2D tex = Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Vector2 squishyScale = new Vector2(Math.Abs((float)Math.Sin(MathHelper.Pi + MathHelper.TwoPi * Projectile.timeLeft / 30f)), 1f); SpriteEffects flip = (float)Math.Sin(MathHelper.Pi + MathHelper.TwoPi * Projectile.timeLeft / 30f) > 0 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; Main.EntitySpriteDraw(tex, Projectile.position - Main.screenPosition, null, lightColor * (Projectile.timeLeft / 60f), 0, tex.Size() / 2, squishyScale * (2f - (Projectile.timeLeft / 60f)), flip, 0); diff --git a/Projectiles/Melee/TrueBiomeBlade_ChainedMeatHook.cs b/Projectiles/Melee/TrueBiomeBlade_ChainedMeatHook.cs index e3ae572d4e..c8b196c76c 100644 --- a/Projectiles/Melee/TrueBiomeBlade_ChainedMeatHook.cs +++ b/Projectiles/Melee/TrueBiomeBlade_ChainedMeatHook.cs @@ -1,15 +1,15 @@ -using Microsoft.Xna.Framework; +using System; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.DataStructures; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; -using CalamityMod.Particles; -using CalamityMod.Buffs.StatDebuffs; -using CalamityMod.Items.Weapons.Melee; -using CalamityMod.DataStructures; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { diff --git a/Projectiles/Melee/TrueBiomeBlade_GhastlyChain.cs b/Projectiles/Melee/TrueBiomeBlade_GhastlyChain.cs index d5fb15726f..7c61988cce 100644 --- a/Projectiles/Melee/TrueBiomeBlade_GhastlyChain.cs +++ b/Projectiles/Melee/TrueBiomeBlade_GhastlyChain.cs @@ -1,8 +1,8 @@ -using CalamityMod.DataStructures; +using System; +using CalamityMod.DataStructures; using CalamityMod.Items.Weapons.Melee; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; diff --git a/Projectiles/Melee/TrueBiomeBlade_LamentationsOfTheChained.cs b/Projectiles/Melee/TrueBiomeBlade_LamentationsOfTheChained.cs index 34e6c90b6f..e01060d597 100644 --- a/Projectiles/Melee/TrueBiomeBlade_LamentationsOfTheChained.cs +++ b/Projectiles/Melee/TrueBiomeBlade_LamentationsOfTheChained.cs @@ -1,17 +1,17 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; +using System; using System.IO; using System.Linq; +using CalamityMod.DataStructures; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Particles; +using CalamityMod.Sounds; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; -using CalamityMod.Particles; -using CalamityMod.DataStructures; -using CalamityMod.Items.Weapons.Melee; -using Terraria.Audio; -using CalamityMod.Sounds; namespace CalamityMod.Projectiles.Melee { @@ -24,7 +24,6 @@ namespace CalamityMod.Projectiles.Melee public Player Owner => Main.player[Projectile.owner]; public ref float ChainSwapTimer => ref Projectile.ai[0]; public ref float SnapCoyoteTime => ref Projectile.ai[1]; - private bool OwnerCanShoot => Owner.channel && !Owner.noItems && !Owner.CCed; const float MaxTangleReach = 400f; //How long can tangling vines from crits be @@ -36,9 +35,6 @@ namespace CalamityMod.Projectiles.Melee public Particle smear; public Particle smear2; - public override void SetStaticDefaults() - { - } public override void SetDefaults() { Projectile.DamageType = DamageClass.Melee; @@ -162,7 +158,7 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - if (!OwnerCanShoot) + if (Owner.CantUseHoldout()) { Projectile.Kill(); return; @@ -179,7 +175,7 @@ namespace CalamityMod.Projectiles.Melee Owner.itemRotation = Projectile.rotation; if (Owner.direction != 1) { - Owner.itemRotation -= 3.14f; + Owner.itemRotation -= MathHelper.Pi; } Owner.itemRotation = MathHelper.WrapAngle(Owner.itemRotation); Owner.itemTime = 2; @@ -412,7 +408,7 @@ namespace CalamityMod.Projectiles.Melee Vector2 origin = new(guardFrame.Width / 2, guardFrame.Height); //Draw from center bottom of texture Main.EntitySpriteDraw(tex, chainPositions[i] - Main.screenPosition, guardFrame, chainLightColor, rotation, origin, 1, SpriteEffects.None, 0); - if ((ChainSwapTimer % OmegaBiomeBlade.FlailBladeAttunement_FlailTime) == 1 && Main.rand.Next(3) == 0f) + if ((ChainSwapTimer % OmegaBiomeBlade.FlailBladeAttunement_FlailTime) == 1 && Main.rand.NextBool(3)) { Particle Flake = new SnowflakeSparkle(chainPositions[i], Vector2.Zero, Color.PaleTurquoise, Color.MediumTurquoise, 1f + Main.rand.NextFloat(0, 1f), 30, 0.4f, 0.2f); GeneralParticleHandler.SpawnParticle(Flake); diff --git a/Projectiles/Melee/TrueBiomeBlade_MercurialTides.cs b/Projectiles/Melee/TrueBiomeBlade_MercurialTides.cs index d11f6cbaef..a0183dbc9b 100644 --- a/Projectiles/Melee/TrueBiomeBlade_MercurialTides.cs +++ b/Projectiles/Melee/TrueBiomeBlade_MercurialTides.cs @@ -1,18 +1,18 @@ -using Terraria.Graphics.Shaders; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; +using System; using System.IO; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using static Terraria.ModLoader.ModContent; -using static CalamityMod.CalamityUtils; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Particles; -using Terraria.Audio; using CalamityMod.Projectiles.Boss; using CalamityMod.Tiles.Astral; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; +using static CalamityMod.CalamityUtils; +using static Terraria.ModLoader.ModContent; namespace CalamityMod.Projectiles.Melee { @@ -28,15 +28,11 @@ namespace CalamityMod.Projectiles.Melee public ref float CurrentIndicator => ref Projectile.localAI[0]; //What "indicator" stage are you on. public ref float OverCharge => ref Projectile.localAI[1]; - private bool OwnerCanShoot => Owner.channel && !Owner.noItems && !Owner.CCed; const float MaxCharge = 500; public Vector2 lastDisplacement; public float dashDuration; - public override void SetStaticDefaults() - { - } public override void SetDefaults() { Projectile.DamageType = DamageClass.Melee; @@ -80,7 +76,7 @@ namespace CalamityMod.Projectiles.Melee initialized = true; } - if (!OwnerCanShoot) + if (Owner.CantUseHoldout()) { if (State == 0f) { @@ -173,7 +169,7 @@ namespace CalamityMod.Projectiles.Melee if (Owner.direction != 1) { - Owner.itemRotation -= 3.14f; + Owner.itemRotation -= MathHelper.Pi; } Owner.itemRotation = MathHelper.WrapAngle(Owner.itemRotation); @@ -238,7 +234,9 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - Owner.GiveIFrames(OmegaBiomeBlade.ShockwaveAttunement_DashHitIFrames); + // 17APR2024: Ozzatron: True Biome Blade's shockwave slam gives iframes when striking enemies in a similar manner to a ram dash. + // This is a fixed and intentionally very low number of iframes, and is not boosted by Cross Necklace. + Owner.GiveUniversalIFrames(OmegaBiomeBlade.ShockwaveAttunement_DashHitIFrames); } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) diff --git a/Projectiles/Melee/TrueBiomeBlade_MercurialTidesMonolith.cs b/Projectiles/Melee/TrueBiomeBlade_MercurialTidesMonolith.cs index da01e2f3e3..6d758d21ed 100644 --- a/Projectiles/Melee/TrueBiomeBlade_MercurialTidesMonolith.cs +++ b/Projectiles/Melee/TrueBiomeBlade_MercurialTidesMonolith.cs @@ -1,16 +1,16 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; +using System; using System.Collections.Generic; using System.IO; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using static Terraria.ModLoader.ModContent; using static CalamityMod.CalamityUtils; -using CalamityMod.Particles; -using CalamityMod.Items.Weapons.Melee; -using Terraria.Audio; +using static Terraria.ModLoader.ModContent; namespace CalamityMod.Projectiles.Melee { diff --git a/Projectiles/Melee/TrueBiomeBlade_MercurialTidesShockwave.cs b/Projectiles/Melee/TrueBiomeBlade_MercurialTidesShockwave.cs index 270a42b7a8..cafa9fde02 100644 --- a/Projectiles/Melee/TrueBiomeBlade_MercurialTidesShockwave.cs +++ b/Projectiles/Melee/TrueBiomeBlade_MercurialTidesShockwave.cs @@ -1,13 +1,13 @@ -using CalamityMod.Particles; +using System; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { diff --git a/Projectiles/Melee/TrueBiomeBlade_SanguineFury.cs b/Projectiles/Melee/TrueBiomeBlade_SanguineFury.cs index ced8054f2d..e7b182dc10 100644 --- a/Projectiles/Melee/TrueBiomeBlade_SanguineFury.cs +++ b/Projectiles/Melee/TrueBiomeBlade_SanguineFury.cs @@ -1,16 +1,16 @@ -using Terraria.Graphics.Shaders; +using System; +using System.IO; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Particles; +using CalamityMod.Sounds; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; using Terraria; +using Terraria.Audio; +using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; -using CalamityMod.Items.Weapons.Melee; -using CalamityMod.Particles; -using Terraria.Audio; -using CalamityMod.Sounds; namespace CalamityMod.Projectiles.Melee { @@ -27,7 +27,6 @@ namespace CalamityMod.Projectiles.Melee public ref float ChargeSoundCooldown => ref Projectile.localAI[1]; public Player Owner => Main.player[Projectile.owner]; public bool CanPogo => Owner.velocity.Y != 0 && PogoCooldown <= 0; //Only pogo when in the air and if the cooldown is zero - private bool OwnerCanShoot => Owner.channel && !Owner.noItems && !Owner.CCed; public const float pogoStrenght = 16f; //How much the player gets pogoed up public const float maxShred = 500; //How much shred you get @@ -36,10 +35,6 @@ namespace CalamityMod.Projectiles.Melee public bool Dashing; public Vector2 DashStart; - - public override void SetStaticDefaults() - { - } public override void SetDefaults() { Projectile.DamageType = DamageClass.Melee; @@ -121,13 +116,17 @@ namespace CalamityMod.Projectiles.Melee Dashing = true; DashStart = Owner.Center; Wheel.timeLeft = 60; - Owner.GiveIFrames(OmegaBiomeBlade.SuperPogoAttunement_SlashIFrames); + + // 17APR2024: Ozzatron: True Biome Blade's pogo gives iframes when striking enemies in a similar manner to a bonk dash. + // This is a fixed and intentionally very low number of iframes, and is not boosted by Cross Necklace. + Owner.GiveUniversalIFrames(OmegaBiomeBlade.SuperPogoAttunement_SlashIFrames); + break; } } } - if (!OwnerCanShoot) + if (Owner.CantUseHoldout()) { Projectile.Kill(); return; @@ -194,7 +193,7 @@ namespace CalamityMod.Projectiles.Melee Owner.itemRotation = direction.ToRotation(); if (Owner.direction != 1) { - Owner.itemRotation -= 3.14f; + Owner.itemRotation -= MathHelper.Pi; } Owner.itemRotation = MathHelper.WrapAngle(Owner.itemRotation); Owner.itemTime = 2; @@ -261,7 +260,11 @@ namespace CalamityMod.Projectiles.Melee Shred += 62; //Augment the shredspeed if (Owner.velocity.Y > 0) Owner.velocity.Y = -2f; //Get "stuck" into the enemy partly - Owner.GiveIFrames(OmegaBiomeBlade.SuperPogoAttunement_ShredIFrames); // i framez. + + // 17APR2024: Ozzatron: True Biome Blade's shred pogo gives iframes when striking enemies in a similar manner to a bonk dash. + // This is a fixed and intentionally very low number of iframes, and is not boosted by Cross Necklace. + Owner.GiveUniversalIFrames(OmegaBiomeBlade.SuperPogoAttunement_ShredIFrames); + PogoCooldown = 20; } } diff --git a/Projectiles/Melee/TrueBiomeBlade_SanguineFuryDash.cs b/Projectiles/Melee/TrueBiomeBlade_SanguineFuryDash.cs index 94125f5ca5..0d2290995c 100644 --- a/Projectiles/Melee/TrueBiomeBlade_SanguineFuryDash.cs +++ b/Projectiles/Melee/TrueBiomeBlade_SanguineFuryDash.cs @@ -1,11 +1,11 @@ -using Microsoft.Xna.Framework; +using System; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; -using CalamityMod.Items.Weapons.Melee; -using CalamityMod.Particles; namespace CalamityMod.Projectiles.Melee { @@ -56,7 +56,7 @@ namespace CalamityMod.Projectiles.Melee GeneralParticleHandler.SpawnParticle(Spark); } - if (!target.canGhostHeal || Owner.moonLeech) + if (Owner.moonLeech) return; Owner.statLife += OmegaBiomeBlade.SuperPogoAttunementSlashLifesteal; diff --git a/Projectiles/Melee/TrueBiomeBlade_SanguineFuryWheel.cs b/Projectiles/Melee/TrueBiomeBlade_SanguineFuryWheel.cs index 1d10e29ef6..034fc7c9a3 100644 --- a/Projectiles/Melee/TrueBiomeBlade_SanguineFuryWheel.cs +++ b/Projectiles/Melee/TrueBiomeBlade_SanguineFuryWheel.cs @@ -1,12 +1,12 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; -using CalamityMod.Items.Weapons.Melee; -using CalamityMod.Particles; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { diff --git a/Projectiles/Melee/TrueBiomeBlade_SwordsmithsPride.cs b/Projectiles/Melee/TrueBiomeBlade_SwordsmithsPride.cs index ddce8634b1..8c8351f8f7 100644 --- a/Projectiles/Melee/TrueBiomeBlade_SwordsmithsPride.cs +++ b/Projectiles/Melee/TrueBiomeBlade_SwordsmithsPride.cs @@ -1,16 +1,16 @@ -using CalamityMod.Particles; +using System; +using System.IO; using CalamityMod.Items.Weapons.Melee; -using Terraria.Graphics.Shaders; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; using Terraria; +using Terraria.Audio; +using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; -using static Terraria.ModLoader.ModContent; using static CalamityMod.CalamityUtils; -using Terraria.Audio; +using static Terraria.ModLoader.ModContent; namespace CalamityMod.Projectiles.Melee { @@ -22,7 +22,6 @@ namespace CalamityMod.Projectiles.Melee Vector2 direction = Vector2.Zero; public ref float CurrentState => ref Projectile.ai[0]; public Player Owner => Main.player[Projectile.owner]; - private bool OwnerCanShoot => Owner.channel && !Owner.noItems && !Owner.CCed; public const float throwOutTime = 90f; public const float throwOutDistance = 440f; @@ -89,7 +88,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.rotation = direction.ToRotation(); //Only done for afterimages - if (!OwnerCanShoot) + if (Owner.CantUseHoldout()) { if (CurrentState == 2f || (CurrentState == 0f && Empowerment / maxEmpowerment < 0.5)) { @@ -243,7 +242,7 @@ namespace CalamityMod.Projectiles.Melee Owner.itemRotation = direction.ToRotation(); if (Owner.direction != 1) { - Owner.itemRotation -= 3.14f; + Owner.itemRotation -= MathHelper.Pi; } Owner.itemRotation = MathHelper.WrapAngle(Owner.itemRotation); Owner.itemTime = 2; diff --git a/Projectiles/Melee/TrueBiomeBlade_SwordsmithsPrideBeam.cs b/Projectiles/Melee/TrueBiomeBlade_SwordsmithsPrideBeam.cs index b15a5334f6..68efc899ff 100644 --- a/Projectiles/Melee/TrueBiomeBlade_SwordsmithsPrideBeam.cs +++ b/Projectiles/Melee/TrueBiomeBlade_SwordsmithsPrideBeam.cs @@ -1,14 +1,14 @@ -using Microsoft.Xna.Framework; +using System; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Items.Weapons.Melee; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using static Terraria.ModLoader.ModContent; using static CalamityMod.CalamityUtils; -using CalamityMod.Items.Weapons.Melee; -using CalamityMod.Buffs.StatDebuffs; -using Terraria.Audio; +using static Terraria.ModLoader.ModContent; namespace CalamityMod.Projectiles.Melee { @@ -63,7 +63,7 @@ namespace CalamityMod.Projectiles.Melee } Lighting.AddLight(Projectile.Center, 0.75f, 1f, 0.24f); - int dustParticle = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 75, 0f, 0f, 100, default, 0.9f); + int dustParticle = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CursedTorch, 0f, 0f, 100, default, 0.9f); Main.dust[dustParticle].noGravity = true; Main.dust[dustParticle].velocity *= 0.5f; Main.dust[dustParticle].velocity += Projectile.velocity * 0.1f; @@ -79,7 +79,7 @@ namespace CalamityMod.Projectiles.Melee Main.spriteBatch.End(); //Haha sup babe what if i restarted the spritebatch way too many times haha /blushes Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Color.Lerp(Color.HotPink, Color.GreenYellow, (float)Math.Sin(Main.GlobalTimeWrappedHourly * 2f)), Projectile.rotation, tex.Size() * 0.5f, 1f, 0f, 0); @@ -95,7 +95,7 @@ namespace CalamityMod.Projectiles.Melee for (int i = 0; i <= 15; i++) { Vector2 displace = (Projectile.rotation - MathHelper.PiOver4).ToRotationVector2() * (-0.5f + (i / 15f)) * 88f; - int dustParticle = Dust.NewDust(Projectile.Center + displace, Projectile.width, Projectile.height, 75, 0f, 0f, 100, default, 2f); + int dustParticle = Dust.NewDust(Projectile.Center + displace, Projectile.width, Projectile.height, DustID.CursedTorch, 0f, 0f, 100, default, 2f); Main.dust[dustParticle].noGravity = true; Main.dust[dustParticle].velocity = Projectile.oldVelocity; } diff --git a/Projectiles/Melee/TrueCausticEdgeProjectile.cs b/Projectiles/Melee/TrueCausticEdgeProjectile.cs deleted file mode 100644 index dc9b04bf46..0000000000 --- a/Projectiles/Melee/TrueCausticEdgeProjectile.cs +++ /dev/null @@ -1,93 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Audio; - -namespace CalamityMod.Projectiles.Melee -{ - public class TrueCausticEdgeProjectile : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Melee"; - public override void SetStaticDefaults() - { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; - } - - public override void SetDefaults() - { - Projectile.width = 20; - Projectile.height = 20; - Projectile.aiStyle = ProjAIStyleID.Beam; - Projectile.friendly = true; - Projectile.DamageType = DamageClass.Melee; - Projectile.penetrate = 3; - Projectile.timeLeft = 600; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; - } - - public override void AI() - { - Lighting.AddLight(Projectile.Center, 0f, 0.35f, 0f); - } - - public override bool PreDraw(ref Color lightColor) - { - if (Projectile.timeLeft > 595) - return false; - - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); - return false; - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(0, 100, 0, 0); - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - 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; - } - SoundEngine.PlaySound(SoundID.Item10, Projectile.position); - } - return false; - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.Venom, 90); - - public override void OnKill(int timeLeft) - { - SoundEngine.PlaySound(SoundID.Item10, Projectile.position); - int inc; - for (int i = 4; i < 31; i = inc + 1) - { - float oldXVel = Projectile.oldVelocity.X * (30f / (float)i); - float oldYVel = Projectile.oldVelocity.Y * (30f / (float)i); - int causticDust = Dust.NewDust(new Vector2(Projectile.oldPosition.X - oldXVel, Projectile.oldPosition.Y - oldYVel), 8, 8, 44, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.8f); - Main.dust[causticDust].noGravity = true; - Dust dust = Main.dust[causticDust]; - dust.velocity *= 0.5f; - causticDust = Dust.NewDust(new Vector2(Projectile.oldPosition.X - oldXVel, Projectile.oldPosition.Y - oldYVel), 8, 8, 44, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.4f); - dust = Main.dust[causticDust]; - dust.velocity *= 0.05f; - inc = i; - } - } - } -} diff --git a/Projectiles/Melee/TumbleweedFlail.cs b/Projectiles/Melee/TumbleweedFlail.cs index 784bb98e58..b3b204545f 100644 --- a/Projectiles/Melee/TumbleweedFlail.cs +++ b/Projectiles/Melee/TumbleweedFlail.cs @@ -1,10 +1,10 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { public class TumbleweedFlail : ModProjectile, ILocalizedModType @@ -98,7 +98,7 @@ namespace CalamityMod.Projectiles.Melee Vector2 origin = new Vector2((float)texture2D2.Width * 0.5f, (float)texture2D2.Height * 0.5f); float projHeight = (float)texture2D2.Height; Vector2 actualCenter = mountedCenter - projCenter; - float projRotation = (float)Math.Atan2((double)actualCenter.Y, (double)actualCenter.X) - 1.57f; + float projRotation = (float)Math.Atan2((double)actualCenter.Y, (double)actualCenter.X) - MathHelper.PiOver2; bool isActive = true; if (float.IsNaN(projCenter.X) && float.IsNaN(projCenter.Y)) { @@ -132,7 +132,7 @@ namespace CalamityMod.Projectiles.Melee SoundEngine.PlaySound(SoundID.NPCDeath15, Projectile.position); for (int i = 0; i < 20; i++) { - int tumbleDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 32, 0f, 0f, 100, default, 1.2f); + int tumbleDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Sand, 0f, 0f, 100, default, 1.2f); Main.dust[tumbleDust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -142,10 +142,10 @@ namespace CalamityMod.Projectiles.Melee } for (int j = 0; j < 30; j++) { - int tumbleDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 85, 0f, 0f, 100, default, 1.7f); + int tumbleDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.UnusedBrown, 0f, 0f, 100, default, 1.7f); Main.dust[tumbleDust2].noGravity = true; Main.dust[tumbleDust2].velocity *= 5f; - tumbleDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 85, 0f, 0f, 100, default, 1f); + tumbleDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.UnusedBrown, 0f, 0f, 100, default, 1f); Main.dust[tumbleDust2].velocity *= 2f; } if (Projectile.owner == Main.myPlayer) diff --git a/Projectiles/Melee/TumbleweedRolling.cs b/Projectiles/Melee/TumbleweedRolling.cs index 95bfd673e6..1427231e09 100644 --- a/Projectiles/Melee/TumbleweedRolling.cs +++ b/Projectiles/Melee/TumbleweedRolling.cs @@ -1,8 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { public class TumbleweedRolling : ModProjectile, ILocalizedModType @@ -19,6 +19,8 @@ namespace CalamityMod.Projectiles.Melee Projectile.penetrate = 8; Projectile.timeLeft = 300; Projectile.DamageType = DamageClass.MeleeNoSpeed; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 5; } public override void AI() @@ -40,18 +42,12 @@ namespace CalamityMod.Projectiles.Melee Projectile.rotation += Projectile.velocity.X * 0.05f; } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - // TODO -- Make this use proper i-frame variables. - target.immune[Projectile.owner] = 5; - } - public override void OnKill(int timeLeft) { SoundEngine.PlaySound(SoundID.NPCDeath15, Projectile.position); for (int i = 0; i < 20; i++) { - int tumbleDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 32, 0f, 0f, 100, default, 1.2f); + int tumbleDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Sand, 0f, 0f, 100, default, 1.2f); Main.dust[tumbleDust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -61,10 +57,10 @@ namespace CalamityMod.Projectiles.Melee } for (int j = 0; j < 30; j++) { - int tumbleDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 85, 0f, 0f, 100, default, 1.7f); + int tumbleDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.UnusedBrown, 0f, 0f, 100, default, 1.7f); Main.dust[tumbleDust2].noGravity = true; Main.dust[tumbleDust2].velocity *= 5f; - tumbleDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 85, 0f, 0f, 100, default, 1f); + tumbleDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.UnusedBrown, 0f, 0f, 100, default, 1f); Main.dust[tumbleDust2].velocity *= 2f; } } diff --git a/Projectiles/Melee/TyphonsGreedBubble.cs b/Projectiles/Melee/TyphonsGreedBubble.cs index 4acb8280bb..06fc319d0c 100644 --- a/Projectiles/Melee/TyphonsGreedBubble.cs +++ b/Projectiles/Melee/TyphonsGreedBubble.cs @@ -1,11 +1,11 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { public class TyphonsGreedBubble : ModProjectile, ILocalizedModType @@ -75,8 +75,8 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - Texture2D texture2D13 = ModContent.Request(Texture).Value; - int framing = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; + Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + int framing = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; int y6 = framing * Projectile.frame; Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), @@ -99,14 +99,14 @@ namespace CalamityMod.Projectiles.Melee Projectile.position.Y -= (float)(Projectile.height / 2); for (int i = 0; i < 2; i++) { - Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 33, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Water, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); } for (int j = 0; j < 6; j++) { - int bubblyDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 186, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); + int bubblyDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RedsWingsRun, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); Main.dust[bubblyDust].noGravity = true; Main.dust[bubblyDust].velocity *= 3f; - bubblyDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 186, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + bubblyDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RedsWingsRun, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); Main.dust[bubblyDust].velocity *= 2f; Main.dust[bubblyDust].noGravity = true; } diff --git a/Projectiles/Melee/TyphonsGreedStaff.cs b/Projectiles/Melee/TyphonsGreedStaff.cs index 63b61ec4ce..851b4a2cd1 100644 --- a/Projectiles/Melee/TyphonsGreedStaff.cs +++ b/Projectiles/Melee/TyphonsGreedStaff.cs @@ -4,6 +4,7 @@ using CalamityMod.Items.Weapons.Melee; using Microsoft.Xna.Framework; using Terraria; using Terraria.Enums; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -87,7 +88,7 @@ namespace CalamityMod.Projectiles.Melee Vector2 tipDustDirection = staffTipDirection.RotatedBy((double)(1.57079637f * (float)Projectile.spriteDirection), default); if (Main.rand.NextBool()) { - Dust staffDust = Dust.NewDustDirect(dustSpawn - new Vector2(5f), 10, 10, 33, player.velocity.X, player.velocity.Y, 150, default, 1f); + Dust staffDust = Dust.NewDustDirect(dustSpawn - new Vector2(5f), 10, 10, DustID.Water, player.velocity.X, player.velocity.Y, 150, default, 1f); staffDust.velocity = Projectile.SafeDirectionTo(staffDust.position) * 0.1f + staffDust.velocity * 0.1f; } for (int j = 0; j < 4; j++) @@ -108,9 +109,9 @@ namespace CalamityMod.Projectiles.Melee scaleFactor2 = 0.5f; break; } - if (Main.rand.Next(6) != 0) + if (!Main.rand.NextBool(6)) { - Dust staffTipDust = Dust.NewDustDirect(Projectile.position, 0, 0, 186, 0f, 0f, 100, default, 1f); + Dust staffTipDust = Dust.NewDustDirect(Projectile.position, 0, 0, DustID.RedsWingsRun, 0f, 0f, 100, default, 1f); staffTipDust.position = Projectile.Center + staffTipDirection * (60f + Main.rand.NextFloat() * 20f) * scaleFactor3; staffTipDust.velocity = tipDustDirection * (4f + 4f * Main.rand.NextFloat()) * scaleFactor3 * scaleFactor2; staffTipDust.noGravity = true; diff --git a/Projectiles/Melee/UltimusCleaverDust.cs b/Projectiles/Melee/UltimusCleaverDust.cs index 0b2f2a3f12..7d99b67136 100644 --- a/Projectiles/Melee/UltimusCleaverDust.cs +++ b/Projectiles/Melee/UltimusCleaverDust.cs @@ -1,6 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; -using Terraria.ID; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { @@ -56,7 +56,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.rotation += Projectile.velocity.X * 0.1f; - int coldFire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 135, 0f, 0f, 100, default, 1f); + int coldFire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.IceTorch, 0f, 0f, 100, default, 1f); Dust expr_8976_cp_0 = Main.dust[coldFire]; expr_8976_cp_0.position.X -= 2f; Dust expr_8994_cp_0 = Main.dust[coldFire]; @@ -68,7 +68,7 @@ namespace CalamityMod.Projectiles.Melee if (Main.rand.NextBool()) { - int coldFiery = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 135, 0f, 0f, 100, default, 1f); + int coldFiery = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.IceTorch, 0f, 0f, 100, default, 1f); Dust expr_8A4E_cp_0 = Main.dust[coldFiery]; expr_8A4E_cp_0.position.X -= 2f; Dust expr_8A6C_cp_0 = Main.dust[coldFiery]; diff --git a/Projectiles/Melee/UrchinBall.cs b/Projectiles/Melee/UrchinBall.cs index 81215289ed..439efbe746 100644 --- a/Projectiles/Melee/UrchinBall.cs +++ b/Projectiles/Melee/UrchinBall.cs @@ -1,10 +1,10 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -30,7 +30,7 @@ namespace CalamityMod.Projectiles.Melee { Player player = Main.player[Projectile.owner]; Vector2 projDirection = player.Center - Projectile.Center; - Projectile.rotation = projDirection.ToRotation() - 1.57f; + Projectile.rotation = projDirection.ToRotation() - MathHelper.PiOver2; if (player.dead) { Projectile.Kill(); @@ -110,7 +110,7 @@ namespace CalamityMod.Projectiles.Melee Vector2 origin = new Vector2((float)texture2D2.Width * 0.5f, (float)texture2D2.Height * 0.5f); float projHeight = (float)texture2D2.Height; Vector2 actualCenter = mountedCenter - projCenter; - float projRotation = (float)Math.Atan2((double)actualCenter.Y, (double)actualCenter.X) - 1.57f; + float projRotation = (float)Math.Atan2((double)actualCenter.Y, (double)actualCenter.X) - MathHelper.PiOver2; bool isActive = true; if (float.IsNaN(projCenter.X) && float.IsNaN(projCenter.Y)) { diff --git a/Projectiles/Melee/UrchinBallSpike.cs b/Projectiles/Melee/UrchinBallSpike.cs index 238fee7564..43487f17d5 100644 --- a/Projectiles/Melee/UrchinBallSpike.cs +++ b/Projectiles/Melee/UrchinBallSpike.cs @@ -1,8 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -56,7 +56,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int i = 0; i < 20; i++) { - int urchin = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 14, 0f, 0f, 0, new Color(0, 255, 255), 1f); + int urchin = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Demonite, 0f, 0f, 0, new Color(0, 255, 255), 1f); Main.dust[urchin].noGravity = true; Main.dust[urchin].velocity *= 2f; } diff --git a/Projectiles/Melee/UrchinMaceProjectile.cs b/Projectiles/Melee/UrchinMaceProjectile.cs index 0870e05a11..57a93c8b70 100644 --- a/Projectiles/Melee/UrchinMaceProjectile.cs +++ b/Projectiles/Melee/UrchinMaceProjectile.cs @@ -135,7 +135,7 @@ namespace CalamityMod.Projectiles.Melee { // This would knock enemies away consistently, but i'm choosing to go with the other option //hitDirection = Math.Sign(target.Center.X - Owner.Center.X); - + //Doing it this way lets the player choose if they want to knockback enemies towards them by pointing away from them modifiers.HitDirectionOverride = Owner.direction; } @@ -144,7 +144,7 @@ namespace CalamityMod.Projectiles.Melee { Owner.ChangeDir(Math.Sign(Owner.Calamity().mouseWorld.X - Owner.position.X)); - Texture2D maceTexture = ModContent.Request(Texture).Value; + Texture2D maceTexture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Texture2D whirlpoolTexture = ModContent.Request("CalamityMod/Projectiles/Melee/RedtideWhirlpool").Value; float whirlpoolScale = MathHelper.Clamp(WindupProgress * 3f - 0.4f, 0f, 1f) * 2f; diff --git a/Projectiles/Melee/UrchinSpikeFugu.cs b/Projectiles/Melee/UrchinSpikeFugu.cs index 32fa5908ae..aa1e315677 100644 --- a/Projectiles/Melee/UrchinSpikeFugu.cs +++ b/Projectiles/Melee/UrchinSpikeFugu.cs @@ -1,5 +1,5 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -24,10 +24,10 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; if (Projectile.ai[0] == 0f) { - float maxRange = 100f; + float maxRange = Projectile.ai[1] == 1f ? 256f : 100f; // Increased homing range for Lionfish int npcIndex = -1; for (int i = 0; i < Main.maxNPCs; i++) { diff --git a/Projectiles/Melee/ViolenceSlashProjectile.cs b/Projectiles/Melee/ViolenceSlashProjectile.cs index 9158e821fd..7d888bd361 100644 --- a/Projectiles/Melee/ViolenceSlashProjectile.cs +++ b/Projectiles/Melee/ViolenceSlashProjectile.cs @@ -1,10 +1,10 @@ -using CalamityMod.Graphics.Primitives; +using System; +using System.Collections.Generic; +using System.Linq; +using CalamityMod.Graphics.Primitives; using CalamityMod.Items.Weapons.Melee; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.Collections.Generic; -using System.Linq; using Terraria; using Terraria.Graphics.Shaders; using Terraria.ID; @@ -100,7 +100,7 @@ namespace CalamityMod.Projectiles.Melee { GameShaders.Misc["CalamityMod:PhaseslayerRipEffect"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/SwordSlashTexture")); - Texture2D spearProjectile = ModContent.Request(Texture).Value; + Texture2D spearProjectile = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Player player = Main.player[Projectile.owner]; List positions = new List(); diff --git a/Projectiles/Melee/ViolenceThrownProjectile.cs b/Projectiles/Melee/ViolenceThrownProjectile.cs index 8900e7f882..345883e0f8 100644 --- a/Projectiles/Melee/ViolenceThrownProjectile.cs +++ b/Projectiles/Melee/ViolenceThrownProjectile.cs @@ -1,9 +1,9 @@ -using CalamityMod.Graphics.Primitives; +using System; +using CalamityMod.Graphics.Primitives; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.Audio; using Terraria.Graphics.Shaders; @@ -199,7 +199,7 @@ namespace CalamityMod.Projectiles.Melee { GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/FabstaffStreak")); - Texture2D spearProjectile = ModContent.Request(Texture).Value; + Texture2D spearProjectile = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; // Not cloning the points causes the below operations to be applied to the original oldPos value by reference // and thus causes it to be consistently added over and over, which is not intended behavior. diff --git a/Projectiles/Melee/VirulentBeeWave.cs b/Projectiles/Melee/VirulentBeeWave.cs index 88f7151f7e..a10ab8d612 100644 --- a/Projectiles/Melee/VirulentBeeWave.cs +++ b/Projectiles/Melee/VirulentBeeWave.cs @@ -1,8 +1,8 @@ using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { @@ -30,6 +30,8 @@ namespace CalamityMod.Projectiles.Melee Projectile.extraUpdates = 3; Projectile.timeLeft = 150; Projectile.alpha = 100; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 8; } public override void AI() @@ -118,11 +120,7 @@ namespace CalamityMod.Projectiles.Melee } } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.immune[Projectile.owner] = 8; - target.AddBuff(ModContent.BuffType(), 180); - } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 180); public override bool PreDraw(ref Color lightColor) { diff --git a/Projectiles/Melee/VirulentWave.cs b/Projectiles/Melee/VirulentWave.cs index 1771f4e595..4f8ce857f1 100644 --- a/Projectiles/Melee/VirulentWave.cs +++ b/Projectiles/Melee/VirulentWave.cs @@ -27,6 +27,8 @@ namespace CalamityMod.Projectiles.Melee Projectile.extraUpdates = 3; Projectile.timeLeft = 150; Projectile.alpha = 100; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 5; } public override void AI() @@ -102,12 +104,7 @@ namespace CalamityMod.Projectiles.Melee } } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - // TODO -- Why are there so many incorrectly programmed i-frame sets - target.immune[Projectile.owner] = 5; - target.AddBuff(ModContent.BuffType(), 120); - } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 120); public override bool PreDraw(ref Color lightColor) { diff --git a/Projectiles/Melee/VoidTentacle.cs b/Projectiles/Melee/VoidTentacle.cs index d4e8e7d15f..c5957b4e34 100644 --- a/Projectiles/Melee/VoidTentacle.cs +++ b/Projectiles/Melee/VoidTentacle.cs @@ -1,5 +1,5 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee @@ -76,7 +76,7 @@ namespace CalamityMod.Projectiles.Melee while (i < Projectile.scale * 4f) { int dustID = Main.rand.NextBool(5) ? 199 : 175; - int idx = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustID, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 1.1f); + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustID, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 1.1f); Main.dust[idx].position = (Main.dust[idx].position + Projectile.Center) / 2f; Main.dust[idx].noGravity = true; Main.dust[idx].velocity *= 0.1f; diff --git a/Projectiles/Melee/VolcanicFireball.cs b/Projectiles/Melee/VolcanicFireball.cs index 1d3a7398f6..6386cef05d 100644 --- a/Projectiles/Melee/VolcanicFireball.cs +++ b/Projectiles/Melee/VolcanicFireball.cs @@ -51,7 +51,7 @@ namespace CalamityMod.Projectiles.Melee { for (int k = 0; k < 5; k++) { - int volcano = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 174, 0f, 0f); + int volcano = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.InfernoFork, 0f, 0f); Main.dust[volcano].noGravity = true; Main.dust[volcano].velocity *= 0f; } diff --git a/Projectiles/Melee/VolcanicFireballLarge.cs b/Projectiles/Melee/VolcanicFireballLarge.cs index 9aed240398..c031cf1664 100644 --- a/Projectiles/Melee/VolcanicFireballLarge.cs +++ b/Projectiles/Melee/VolcanicFireballLarge.cs @@ -1,5 +1,5 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -38,7 +38,7 @@ namespace CalamityMod.Projectiles.Melee { Projectile.frame = 0; } - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X); + Projectile.rotation = Projectile.velocity.ToRotation(); Lighting.AddLight(Projectile.Center, 0.4f, 0f, 0f); if (Main.rand.NextBool(4)) { @@ -52,7 +52,7 @@ namespace CalamityMod.Projectiles.Melee { for (int k = 0; k < 5; k++) { - int volcano = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 174, 0f, 0f); + int volcano = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.InfernoFork, 0f, 0f); Main.dust[volcano].noGravity = true; Main.dust[volcano].velocity *= 0f; } diff --git a/Projectiles/Melee/Waterfall.cs b/Projectiles/Melee/Waterfall.cs index 183b47508a..e83c412f64 100644 --- a/Projectiles/Melee/Waterfall.cs +++ b/Projectiles/Melee/Waterfall.cs @@ -1,8 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -33,7 +33,7 @@ namespace CalamityMod.Projectiles.Melee float shortXVel = Projectile.velocity.X / 3f * (float)i; float shortYVel = Projectile.velocity.Y / 3f * (float)i; int fourConst = 4; - int watery = Dust.NewDust(new Vector2(Projectile.position.X + (float)fourConst, Projectile.position.Y + (float)fourConst), Projectile.width - fourConst * 2, Projectile.height - fourConst * 2, 56, 0f, 0f, 100, default, 1.2f); + int watery = Dust.NewDust(new Vector2(Projectile.position.X + (float)fourConst, Projectile.position.Y + (float)fourConst), Projectile.width - fourConst * 2, Projectile.height - fourConst * 2, DustID.BlueFairy, 0f, 0f, 100, default, 1.2f); Main.dust[watery].noGravity = true; Main.dust[watery].velocity *= 0.25f; Main.dust[watery].velocity += Projectile.velocity * 0.1f; @@ -47,7 +47,7 @@ namespace CalamityMod.Projectiles.Melee float shortXVel2 = Projectile.velocity.X / 3f * (float)j; float shortYVel2 = Projectile.velocity.Y / 3f * (float)j; int otherFourConst = 4; - int superWet = Dust.NewDust(new Vector2(Projectile.position.X + (float)otherFourConst, Projectile.position.Y + (float)otherFourConst), Projectile.width - otherFourConst * 2, Projectile.height - otherFourConst * 2, 245, 0f, 0f, 100, default, 1.2f); + int superWet = Dust.NewDust(new Vector2(Projectile.position.X + (float)otherFourConst, Projectile.position.Y + (float)otherFourConst), Projectile.width - otherFourConst * 2, Projectile.height - otherFourConst * 2, DustID.SilverCoin, 0f, 0f, 100, default, 1.2f); Main.dust[superWet].noGravity = true; Main.dust[superWet].velocity *= 0.1f; Main.dust[superWet].velocity += Projectile.velocity * 0.25f; @@ -89,8 +89,8 @@ namespace CalamityMod.Projectiles.Melee SoundEngine.PlaySound(SoundID.Item27, Projectile.Center); for (int k = 0; k < 3; k++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 56, Projectile.oldVelocity.X * 0.25f, Projectile.oldVelocity.Y * 0.25f); - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 245, Projectile.oldVelocity.X * 0.25f, Projectile.oldVelocity.Y * 0.25f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.BlueFairy, Projectile.oldVelocity.X * 0.25f, Projectile.oldVelocity.Y * 0.25f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.SilverCoin, Projectile.oldVelocity.X * 0.25f, Projectile.oldVelocity.Y * 0.25f); } } } diff --git a/Projectiles/Melee/WhiteBoltAura.cs b/Projectiles/Melee/WhiteBoltAura.cs index 195648c6bc..042342de1d 100644 --- a/Projectiles/Melee/WhiteBoltAura.cs +++ b/Projectiles/Melee/WhiteBoltAura.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { diff --git a/Projectiles/Melee/WhiteOrb.cs b/Projectiles/Melee/WhiteOrb.cs index 0b70581667..84ae9ebcf4 100644 --- a/Projectiles/Melee/WhiteOrb.cs +++ b/Projectiles/Melee/WhiteOrb.cs @@ -1,6 +1,8 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Melee { public class WhiteOrb : ModProjectile, ILocalizedModType @@ -25,7 +27,7 @@ namespace CalamityMod.Projectiles.Melee Lighting.AddLight(Projectile.Center, 0.2f, 0.2f, 0.2f); for (int i = 0; i < 2; i++) { - int shiny = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 91, 0f, 0f, 100, default, 1.25f); + 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 9f6c09a1fe..6e7978918c 100644 --- a/Projectiles/Melee/Whiterain.cs +++ b/Projectiles/Melee/Whiterain.cs @@ -1,8 +1,8 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { public class Whiterain : ModProjectile, ILocalizedModType @@ -35,7 +35,7 @@ namespace CalamityMod.Projectiles.Melee for (int i = 0; i < 2; i++) { - int shiny = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 91, 0f, 0f, 100, default, 1.25f); + 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/WulfrumScrew.cs b/Projectiles/Melee/WulfrumScrew.cs index 4487c854a8..263a358bd3 100644 --- a/Projectiles/Melee/WulfrumScrew.cs +++ b/Projectiles/Melee/WulfrumScrew.cs @@ -88,7 +88,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { SoundEngine.PlaySound(WulfrumKnife.TileHitSound, Projectile.Center); - + bool screwRegained = false; @@ -151,12 +151,12 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; - + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + float distanceFromAim = Projectile.Center.ShortestDistanceToLine(Owner.MountedCenter, Main.MouseWorld); float distanceFromPlayerAcrossSightLine = (Owner.MountedCenter - Projectile.Center.ClosestPointOnLine(Owner.MountedCenter, Main.MouseWorld)).Length(); - float opacity = MathHelper.Clamp(1f - distanceFromAim / 90f, 0f, 1f) * (1f - Math.Clamp((float)Math.Pow(distanceFromPlayerAcrossSightLine / 300f, 9f) , 0f, 1f)); + float opacity = MathHelper.Clamp(1f - distanceFromAim / 90f, 0f, 1f) * (1f - Math.Clamp((float)Math.Pow(distanceFromPlayerAcrossSightLine / 300f, 9f), 0f, 1f)); //Draw a sightline before the player hits it. if (Owner.whoAmI == Main.myPlayer && BazingaTime == 0 && opacity > 0) @@ -168,7 +168,7 @@ namespace CalamityMod.Projectiles.Melee laserScopeEffect.Parameters["sampleTexture2"].SetValue(ModContent.Request("CalamityMod/ExtraTextures/GreyscaleGradients/CertifiedCrustyNoise").Value); laserScopeEffect.Parameters["noiseOffset"].SetValue(Main.GameUpdateCount * -0.003f); - laserScopeEffect.Parameters["mainOpacity"].SetValue((float)Math.Pow(opacity , 0.5f)); //Opacity increases as the screw gets close to the cursor + laserScopeEffect.Parameters["mainOpacity"].SetValue((float)Math.Pow(opacity, 0.5f)); //Opacity increases as the screw gets close to the cursor laserScopeEffect.Parameters["Resolution"].SetValue(new Vector2(700f * 0.2f)); laserScopeEffect.Parameters["laserAngle"].SetValue((Main.MouseWorld - Owner.MountedCenter).ToRotation() * -1); diff --git a/Projectiles/Melee/WulfrumScrewdriverProj.cs b/Projectiles/Melee/WulfrumScrewdriverProj.cs index 055f9e5eaf..a87015759d 100644 --- a/Projectiles/Melee/WulfrumScrewdriverProj.cs +++ b/Projectiles/Melee/WulfrumScrewdriverProj.cs @@ -1,10 +1,10 @@ -using CalamityMod.Items.Weapons.Melee; +using System; +using System.IO; +using CalamityMod.Items.Weapons.Melee; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; -using System; -using System.IO; using Terraria; using Terraria.Audio; using Terraria.Graphics.Effects; @@ -53,7 +53,7 @@ namespace CalamityMod.Projectiles.Melee public CurveSegment HoldSegment = new CurveSegment(SineBumpEasing, 0.2f, 1f, 0.2f); public CurveSegment RetractSegment = new CurveSegment(PolyOutEasing, 0.76f, 1f, -0.8f, 3); public CurveSegment BumpSegment = new CurveSegment(SineBumpEasing, 0.9f, 0.2f, 0.15f); - internal float DistanceFromPlayer => PiecewiseAnimation(LifetimeCompletion, new CurveSegment[] { ThrustSegment, HoldSegment, RetractSegment, BumpSegment }); + internal float DistanceFromPlayer => PiecewiseAnimation(LifetimeCompletion, new CurveSegment[] { ThrustSegment, HoldSegment, RetractSegment, BumpSegment }); public Vector2 OffsetFromPlayer => Projectile.velocity * DistanceFromPlayer * 12f; @@ -76,7 +76,7 @@ namespace CalamityMod.Projectiles.Melee } //Manage position and rotation - Projectile.Center = Owner.MountedCenter + OffsetFromPlayer ; + Projectile.Center = Owner.MountedCenter + OffsetFromPlayer; Projectile.scale = 1f + (float)Math.Sin(LifetimeCompletion * MathHelper.Pi) * 0.2f; //SWAGGER //Make the owner look like theyre holding the sword bla bla @@ -114,7 +114,7 @@ namespace CalamityMod.Projectiles.Melee if (screw.AlreadyBazinged > 2) SoundEngine.PlaySound(WulfrumScrewdriver.FunnyUltrablingSound, Projectile.Center); - + if (Main.myPlayer == proj.owner) { @@ -215,7 +215,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; if (SmearTex == null) SmearTex = ModContent.Request("CalamityMod/Particles/MediumLongThrust"); diff --git a/Projectiles/Melee/YateveoBloomProj.cs b/Projectiles/Melee/YateveoBloomProj.cs index 0e0aee2827..1e4dcf6113 100644 --- a/Projectiles/Melee/YateveoBloomProj.cs +++ b/Projectiles/Melee/YateveoBloomProj.cs @@ -1,10 +1,10 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { Vector2 projDirection = Main.player[Projectile.owner].MountedCenter - Projectile.Center; - Projectile.rotation = projDirection.ToRotation() - 1.57f; + Projectile.rotation = projDirection.ToRotation() - MathHelper.PiOver2; float distance = projDirection.Length(); if (Main.player[Projectile.owner].dead) @@ -187,7 +187,7 @@ namespace CalamityMod.Projectiles.Melee Vector2 origin = new Vector2((float)texture2D2.Width * 0.5f, (float)texture2D2.Height * 0.5f); float projHeight = (float)texture2D2.Height; Vector2 actualCenter = mountedCenter - projCenter; - float projRotation = (float)Math.Atan2((double)actualCenter.Y, (double)actualCenter.X) - 1.57f; + float projRotation = (float)Math.Atan2((double)actualCenter.Y, (double)actualCenter.X) - MathHelper.PiOver2; bool isActive = true; if (float.IsNaN(projCenter.X) && float.IsNaN(projCenter.Y)) { diff --git a/Projectiles/Melee/Yoyos/AzathothYoyo.cs b/Projectiles/Melee/Yoyos/AzathothYoyo.cs index 2f448de9ae..2f99f79c09 100644 --- a/Projectiles/Melee/Yoyos/AzathothYoyo.cs +++ b/Projectiles/Melee/Yoyos/AzathothYoyo.cs @@ -36,10 +36,10 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override void AI() { - if (Main.rand.NextBool(2 * MaxUpdates)) + if (Main.rand.NextBool(MaxUpdates)) { if (Projectile.owner == Main.myPlayer) - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity * 0.35f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity.RotatedByRandom(0.4f) * Main.rand.NextFloat(0.2f, 0.55f), ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack, Projectile.owner, 0f, 0f); } if ((Projectile.position - Main.player[Projectile.owner].position).Length() > 3200f) //200 blocks Projectile.Kill(); diff --git a/Projectiles/Melee/Yoyos/SolarFlareYoyo.cs b/Projectiles/Melee/Yoyos/BurningRevelationYoyo.cs similarity index 91% rename from Projectiles/Melee/Yoyos/SolarFlareYoyo.cs rename to Projectiles/Melee/Yoyos/BurningRevelationYoyo.cs index 3a3ed86a93..c1b176f8e6 100644 --- a/Projectiles/Melee/Yoyos/SolarFlareYoyo.cs +++ b/Projectiles/Melee/Yoyos/BurningRevelationYoyo.cs @@ -9,9 +9,9 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee.Yoyos { - public class SolarFlareYoyo : ModProjectile + public class BurningRevelationYoyo : ModProjectile { - public override LocalizedText DisplayName => CalamityUtils.GetItemName(); + public override LocalizedText DisplayName => CalamityUtils.GetItemName(); public const int MaxUpdates = 3; public override void SetStaticDefaults() @@ -39,7 +39,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override void AI() { if (Main.rand.NextBool(5)) - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 244, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.CopperCoin, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); if ((Projectile.position - Main.player[Projectile.owner].position).Length() > 3200f) //200 blocks Projectile.Kill(); } diff --git a/Projectiles/Melee/Yoyos/SolarFlareYoyo.png b/Projectiles/Melee/Yoyos/BurningRevelationYoyo.png similarity index 100% rename from Projectiles/Melee/Yoyos/SolarFlareYoyo.png rename to Projectiles/Melee/Yoyos/BurningRevelationYoyo.png diff --git a/Projectiles/Melee/Yoyos/GodsGambitYoyo.cs b/Projectiles/Melee/Yoyos/GodsGambitYoyo.cs index 45f05b93e3..b9815f76d2 100644 --- a/Projectiles/Melee/Yoyos/GodsGambitYoyo.cs +++ b/Projectiles/Melee/Yoyos/GodsGambitYoyo.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } diff --git a/Projectiles/Melee/Yoyos/LaceratorYoyo.cs b/Projectiles/Melee/Yoyos/LaceratorYoyo.cs index e605cf946d..e68a6592f6 100644 --- a/Projectiles/Melee/Yoyos/LaceratorYoyo.cs +++ b/Projectiles/Melee/Yoyos/LaceratorYoyo.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - if (!target.canGhostHeal || Main.player[Projectile.owner].moonLeech) + if (Main.player[Projectile.owner].moonLeech) return; Player player = Main.player[Projectile.owner]; diff --git a/Projectiles/Melee/Yoyos/MicrowaveYoyo.cs b/Projectiles/Melee/Yoyos/MicrowaveYoyo.cs index 96233556d7..d77d1ab63c 100644 --- a/Projectiles/Melee/Yoyos/MicrowaveYoyo.cs +++ b/Projectiles/Melee/Yoyos/MicrowaveYoyo.cs @@ -1,10 +1,10 @@ -using CalamityMod.Buffs.DamageOverTime; +using System.IO; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Items.Weapons.Melee; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Utilities; -using System.IO; using Terraria; using Terraria.Audio; using Terraria.ID; diff --git a/Projectiles/Melee/Yoyos/ObliteratorYoyo.cs b/Projectiles/Melee/Yoyos/ObliteratorYoyo.cs index d630b7e18f..e95a5817f1 100644 --- a/Projectiles/Melee/Yoyos/ObliteratorYoyo.cs +++ b/Projectiles/Melee/Yoyos/ObliteratorYoyo.cs @@ -1,9 +1,12 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using System.Collections.Generic; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Weapons.Melee; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System.Collections.Generic; +using ReLogic.Utilities; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -14,6 +17,9 @@ namespace CalamityMod.Projectiles.Melee.Yoyos { public override LocalizedText DisplayName => CalamityUtils.GetItemName(); private const int FramesPerShot = 5; + public SlotId GFB; + public int GFBCounter = 0; + public int time = 0; // Ensures that the main AI only runs once per frame, despite the projectile's multiple updates private int extraUpdateCounter = 0; @@ -46,6 +52,30 @@ namespace CalamityMod.Projectiles.Melee.Yoyos // localAI[1] counts up to 19 (4 x 5 - 1), then resets back to 0 for a 20-frame cycle. public override void AI() { + time++; + if (Main.zenithWorld) + { + if (time == 1) + { + GFB = SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/BoomBoomKawaii") with { IsLooped = true }); + GFBCounter++; + } + if (time % 30 == 0 && GFBCounter > 0) + GFBCounter--; + for (int i = 0; i < 13; i++) + { + Vector2 dustPos = Projectile.Center + (i * MathHelper.Pi + Projectile.rotation + MathHelper.PiOver2).ToRotationVector2() * 2f; + Dust dust = Dust.NewDustPerfect(dustPos, Main.rand.Next(130, 134 + 1), (i * MathHelper.Pi + Projectile.rotation * Math.Sign(Projectile.velocity.X)).ToRotationVector2() * Main.rand.NextFloat(1f, 90f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.1f, 1.7f); + } + if (SoundEngine.TryGetActiveSound(GFB, out var RumblePitch) && RumblePitch.IsPlaying) + { + RumblePitch.Pitch = MathHelper.Lerp(0f, 1f, MathHelper.Clamp(GFBCounter * 0.1f, 0, 1)); + RumblePitch.Volume = MathHelper.Lerp(1f, 1.5f, GFBCounter * 0.1f); + } + } + if ((Projectile.position - Main.player[Projectile.owner].position).Length() > 3200f) //200 blocks Projectile.Kill(); @@ -61,7 +91,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos Projectile.localAI[1] = 0f; // Attempt to fire a laser every 5 frames - if(Projectile.localAI[1] % FramesPerShot == 0f) + if (Projectile.localAI[1] % FramesPerShot == 0f) { List targets = new List(); float laserRange = 300f; @@ -120,7 +150,17 @@ namespace CalamityMod.Projectiles.Melee.Yoyos Vector2 origin = new Vector2(10f, 10f); Main.EntitySpriteDraw(ModContent.Request("CalamityMod/Projectiles/Melee/Yoyos/ObliteratorYoyoGlow").Value, Projectile.Center - Main.screenPosition, null, Color.White, Projectile.rotation, origin, 2f, SpriteEffects.None, 0); } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 180); + public override void OnKill(int timeLeft) + { + if (Main.zenithWorld && SoundEngine.TryGetActiveSound(GFB, out var RumblePlaying) && RumblePlaying.IsPlaying) + { + RumblePlaying?.Stop(); + } + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + GFBCounter = 15; + target.AddBuff(ModContent.BuffType(), 180); + } } } diff --git a/Projectiles/Melee/Yoyos/OracleYoyo.cs b/Projectiles/Melee/Yoyos/OracleYoyo.cs index 7c0b87a262..39ec79b67f 100644 --- a/Projectiles/Melee/Yoyos/OracleYoyo.cs +++ b/Projectiles/Melee/Yoyos/OracleYoyo.cs @@ -1,7 +1,7 @@ -using CalamityMod.Items.Weapons.Melee; +using System.IO; +using CalamityMod.Items.Weapons.Melee; using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; -using System.IO; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -12,7 +12,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos { public class OracleYoyo : ModProjectile { - public override LocalizedText DisplayName => CalamityUtils.GetItemName(); + public override LocalizedText DisplayName => CalamityUtils.GetItemName(); public int AuraFrame; // projectile.localAI[1] is the Aura Charge of the red lightning aura @@ -29,8 +29,9 @@ namespace CalamityMod.Projectiles.Melee.Yoyos private const float MinDischargeRate = 0.05f; private const float MaxDischargeRate = 0.53f; private const float DischargeRateScaleFactor = 0.003f; - private const float ChargePerHit = 4f; - private const int HitsPerOrbVolley = 3; + private const float ChargePerHit = 6f; + private const int HitsPerOrbVolley = 2; + private int OrbCooldown = 0; // The aura hits once per this many frames. private const int AuraLocalIFrames = 12; @@ -68,12 +69,23 @@ namespace CalamityMod.Projectiles.Melee.Yoyos Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.penetrate = -1; Projectile.MaxUpdates = UpdatesPerFrame; + Projectile.tileCollide = false; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 6 * UpdatesPerFrame; + Projectile.localNPCHitCooldown = 8 * UpdatesPerFrame; } public override void AI() { + if (OrbCooldown > 0) + OrbCooldown--; + + if (AuraCharge <= SuperchargeThreshold) + { + Vector2 vel = new Vector2(45, 45).RotatedByRandom(100); + Dust dust = Dust.NewDustPerfect(Projectile.Center + vel, 213, Vector2.Zero, 0, default, Main.rand.NextFloat(2.2f, 2.4f)); + dust.noGravity = true; + } + if ((Projectile.position - Main.player[Projectile.owner].position).Length() > 3200f) //200 blocks Projectile.Kill(); @@ -123,7 +135,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos { // The aura's direct damage scales with its charge and with melee stats. float chargeRatio = AuraCharge / MaxCharge; - int auraDamage = Oracle.AuraBaseDamage + (int)(chargeRatio * (Oracle.AuraMaxDamage - Oracle.AuraBaseDamage)); + int auraDamage = TheOracle.AuraBaseDamage + (int)(chargeRatio * (TheOracle.AuraMaxDamage - TheOracle.AuraBaseDamage)); DealAuraDamage(auraRadius, auraDamage); } } @@ -149,8 +161,11 @@ namespace CalamityMod.Projectiles.Melee.Yoyos AuraCharge += ChargePerHit; // Fire Auric orbs every few hits while supercharged. - if (AuraCharge > SuperchargeThreshold && Projectile.numHits % HitsPerOrbVolley == 0) + if (AuraCharge > SuperchargeThreshold && Projectile.numHits % HitsPerOrbVolley == 0 && OrbCooldown == 0) + { + OrbCooldown = 30; FireAuricOrbs(); + } } // Uses dust type 260, which lives for an extremely short amount of time @@ -182,7 +197,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos } // Rarely, draw some "arcs" which are lines of dust to the edge - if (Main.rand.NextBool(30)) + if (Main.rand.NextBool(15)) { int numArcs = 3; float arcDustDensity = 0.6f; @@ -211,7 +226,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos } // Make extra sound when these arcs happen - SoundEngine.PlaySound(SoundID.NPCHit53, Projectile.Center); + SoundEngine.PlaySound(SoundID.NPCHit53 with { Volume = 0.2f }, Projectile.Center); } } @@ -252,7 +267,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos private void FireAuricOrbs() { // Play a sound when orbs are fired - SoundEngine.PlaySound(SoundID.Item92, Projectile.Center); + SoundEngine.PlaySound(SoundID.Item92 with { Volume = 0.3f }, Projectile.Center); int numOrbs = 3; int orbID = ModContent.ProjectileType(); @@ -272,5 +287,6 @@ namespace CalamityMod.Projectiles.Melee.Yoyos Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center + posVec, velocity, orbID, orbDamage, orbKB, Main.myPlayer, 0.0f, 0.0f); } } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 60, targetHitbox); } } diff --git a/Projectiles/Melee/Yoyos/PandemicYoyo.cs b/Projectiles/Melee/Yoyos/PandemicYoyo.cs index d71f8f9b09..bb0ac459d2 100644 --- a/Projectiles/Melee/Yoyos/PandemicYoyo.cs +++ b/Projectiles/Melee/Yoyos/PandemicYoyo.cs @@ -46,7 +46,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } diff --git a/Projectiles/Melee/Yoyos/QuagmireYoyo.cs b/Projectiles/Melee/Yoyos/QuagmireYoyo.cs index f25d212b50..281c95a226 100644 --- a/Projectiles/Melee/Yoyos/QuagmireYoyo.cs +++ b/Projectiles/Melee/Yoyos/QuagmireYoyo.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos if ((Projectile.position - Main.player[Projectile.owner].position).Length() > 3200f) //200 blocks Projectile.Kill(); if (Main.rand.NextBool(5 * MaxUpdates)) - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 44, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.JungleSpore, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); if (Projectile.owner == Main.myPlayer) { if (Main.rand.NextBool(10 * MaxUpdates)) @@ -54,7 +54,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } diff --git a/Projectiles/Melee/Yoyos/RiptideYoyo.cs b/Projectiles/Melee/Yoyos/RiptideYoyo.cs index d05397e151..464e265922 100644 --- a/Projectiles/Melee/Yoyos/RiptideYoyo.cs +++ b/Projectiles/Melee/Yoyos/RiptideYoyo.cs @@ -1,6 +1,6 @@ -using CalamityMod.Items.Weapons.Melee; +using System.IO; +using CalamityMod.Items.Weapons.Melee; using Microsoft.Xna.Framework; -using System.IO; using Terraria; using Terraria.Audio; using Terraria.ID; diff --git a/Projectiles/Melee/Yoyos/ShimmersparkYoyo.cs b/Projectiles/Melee/Yoyos/ShimmersparkYoyo.cs index 541c7fb65e..b597edc8b5 100644 --- a/Projectiles/Melee/Yoyos/ShimmersparkYoyo.cs +++ b/Projectiles/Melee/Yoyos/ShimmersparkYoyo.cs @@ -41,7 +41,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } diff --git a/Projectiles/Melee/Yoyos/SmokingCometYoyo.cs b/Projectiles/Melee/Yoyos/SmokingCometYoyo.cs index 21111f7f14..11fbb9e90f 100644 --- a/Projectiles/Melee/Yoyos/SmokingCometYoyo.cs +++ b/Projectiles/Melee/Yoyos/SmokingCometYoyo.cs @@ -1,8 +1,8 @@ -using CalamityMod.Items.Weapons.Melee; +using System; +using System.IO; +using CalamityMod.Items.Weapons.Melee; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; using Terraria; using Terraria.ID; using Terraria.Localization; @@ -16,9 +16,9 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override void SetStaticDefaults() { - ProjectileID.Sets.YoyosLifeTimeMultiplier[Projectile.type] = 15f; - ProjectileID.Sets.YoyosMaximumRange[Projectile.type] = 240f; - ProjectileID.Sets.YoyosTopSpeed[Projectile.type] = 14f; + ProjectileID.Sets.YoyosLifeTimeMultiplier[Projectile.type] = 21f; + ProjectileID.Sets.YoyosMaximumRange[Projectile.type] = 320f; + ProjectileID.Sets.YoyosTopSpeed[Projectile.type] = 20f; ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; ProjectileID.Sets.TrailingMode[Projectile.type] = 1; @@ -32,7 +32,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.penetrate = -1; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 20; + Projectile.localNPCHitCooldown = 15; } public override void SendExtraAI(BinaryWriter writer) @@ -56,7 +56,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos // Rain Starfury stars every 30 frames Projectile.localAI[1]++; - float starRainGateValue = 30f; + float starRainGateValue = 27f; if (Projectile.localAI[1] % starRainGateValue == 0f) { Vector2 starSpawnLocation = Projectile.Center + new Vector2(Main.rand.Next(-200, 201), -600f); @@ -67,10 +67,10 @@ namespace CalamityMod.Projectiles.Melee.Yoyos } if (Main.rand.NextBool(5)) - Dust.NewDust(Projectile.Center + new Vector2(-25f, -25f), 50, 50, 58, 0f, 0f, 150, default(Color), 1.2f); + Dust.NewDust(Projectile.Center + new Vector2(-25f, -25f), 50, 50, DustID.Enchanted_Pink, 0f, 0f, 150, default(Color), 1.2f); if (Main.rand.NextBool(10)) - Gore.NewGore(Projectile.GetSource_FromAI(), new Vector2(Projectile.position.X, Projectile.position.Y), default(Vector2), Main.rand.Next(16, 18)); + Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.position, default(Vector2), Main.rand.Next(16, 18)); } // Hitbox is larger than normal while trying to hit NPCs diff --git a/Projectiles/Melee/Yoyos/SulphurousGrabberYoyo.cs b/Projectiles/Melee/Yoyos/SulphurousGrabberYoyo.cs index cd27228e10..851525836a 100644 --- a/Projectiles/Melee/Yoyos/SulphurousGrabberYoyo.cs +++ b/Projectiles/Melee/Yoyos/SulphurousGrabberYoyo.cs @@ -1,8 +1,8 @@ -using CalamityMod.Buffs.StatDebuffs; +using System; +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Weapons.Melee; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ID; using Terraria.Localization; @@ -98,7 +98,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); if (bubbleStronk) { diff --git a/Projectiles/Melee/Yoyos/YinYoyo.cs b/Projectiles/Melee/Yoyos/YinYoyo.cs index 32e2d07504..0dae90d883 100644 --- a/Projectiles/Melee/Yoyos/YinYoyo.cs +++ b/Projectiles/Melee/Yoyos/YinYoyo.cs @@ -41,7 +41,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } diff --git a/Projectiles/Pets/Akato.cs b/Projectiles/Pets/Akato.cs index e4a639f2b0..a7e6431f73 100644 --- a/Projectiles/Pets/Akato.cs +++ b/Projectiles/Pets/Akato.cs @@ -1,6 +1,8 @@ -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Pets { public class Akato : ModProjectile, ILocalizedModType @@ -10,6 +12,9 @@ namespace CalamityMod.Projectiles.Pets { Main.projFrames[Projectile.type] = 6; Main.projPet[Projectile.type] = true; + + ProjectileID.Sets.CharacterPreviewAnimations[Projectile.type] = ProjectileID.Sets.SimpleLoop(0, Main.projFrames[Projectile.type], 6) + .WithOffset(-38f, 0f).WithSpriteDirection(1).WhenNotSelected(0, 0); } public override void SetDefaults() diff --git a/Projectiles/Pets/Astrophage.cs b/Projectiles/Pets/Astrophage.cs index 92606b0c88..b44752567f 100644 --- a/Projectiles/Pets/Astrophage.cs +++ b/Projectiles/Pets/Astrophage.cs @@ -1,7 +1,9 @@ using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Pets { public class Astrophage : ModProjectile, ILocalizedModType @@ -13,6 +15,9 @@ namespace CalamityMod.Projectiles.Pets { Main.projFrames[Projectile.type] = 5; Main.projPet[Projectile.type] = true; + + ProjectileID.Sets.CharacterPreviewAnimations[Projectile.type] = ProjectileID.Sets.SimpleLoop(0, Main.projFrames[Projectile.type], 6) + .WithOffset(-10f, 0f).WithSpriteDirection(-1).WhenNotSelected(0, 0); } public override void SetDefaults() diff --git a/Projectiles/Pets/BabyGhostBell.cs b/Projectiles/Pets/BabyGhostBell.cs index 9693c64375..9af28bf336 100644 --- a/Projectiles/Pets/BabyGhostBell.cs +++ b/Projectiles/Pets/BabyGhostBell.cs @@ -1,4 +1,4 @@ -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Projectiles/Pets/Bear.cs b/Projectiles/Pets/Bear.cs index 5577af726f..b07928bc79 100644 --- a/Projectiles/Pets/Bear.cs +++ b/Projectiles/Pets/Bear.cs @@ -1,8 +1,10 @@ -using CalamityMod.CalPlayer; +using System; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Pets { public class Bear : ModProjectile, ILocalizedModType @@ -18,6 +20,9 @@ namespace CalamityMod.Projectiles.Pets { Main.projFrames[Projectile.type] = 22; Main.projPet[Projectile.type] = true; + + ProjectileID.Sets.CharacterPreviewAnimations[Projectile.type] = ProjectileID.Sets.SimpleLoop(0, 13, 6) + .WithOffset(-20f, 0f).WithSpriteDirection(-1).WhenNotSelected(0, 0); } public override void SetDefaults() @@ -235,7 +240,7 @@ namespace CalamityMod.Projectiles.Pets { float flyingSpeed = 0.3f; Projectile.tileCollide = false; - Vector2 flyDirection = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); + Vector2 flyDirection = Projectile.Center; float horiPos = Main.player[Projectile.owner].position.X + (float)(Main.player[Projectile.owner].width / 2) - flyDirection.X; float vertiPos = Main.player[Projectile.owner].position.Y + (float)(Main.player[Projectile.owner].height / 2) - flyDirection.Y; vertiPos += (float)Main.rand.Next(-10, 21); diff --git a/Projectiles/Pets/BendyPet.cs b/Projectiles/Pets/BendyPet.cs index 12566e64e2..5d5d505804 100644 --- a/Projectiles/Pets/BendyPet.cs +++ b/Projectiles/Pets/BendyPet.cs @@ -1,7 +1,7 @@ -using CalamityMod.CalPlayer; +using System; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -223,7 +223,7 @@ namespace CalamityMod.Projectiles.Pets public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; int height = texture.Height / Main.projFrames[Projectile.type]; int frameHeight = height * Projectile.frame; SpriteEffects spriteEffects = SpriteEffects.None; diff --git a/Projectiles/Pets/BrimlingPet.cs b/Projectiles/Pets/BrimlingPet.cs index 039b854234..fd95edd8ed 100644 --- a/Projectiles/Pets/BrimlingPet.cs +++ b/Projectiles/Pets/BrimlingPet.cs @@ -1,9 +1,11 @@ -using CalamityMod.CalPlayer; +using System; +using CalamityMod.CalPlayer; using CalamityMod.Dusts; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Pets { public class BrimlingPet : ModProjectile, ILocalizedModType @@ -13,6 +15,9 @@ namespace CalamityMod.Projectiles.Pets { Main.projFrames[Projectile.type] = 8; Main.projPet[Projectile.type] = true; + + ProjectileID.Sets.CharacterPreviewAnimations[Projectile.type] = ProjectileID.Sets.SimpleLoop(0, 4, 5) + .WithOffset(-25f, 0f).WithSpriteDirection(-1).WhenNotSelected(0, 0); } public override void SetDefaults() @@ -44,7 +49,7 @@ namespace CalamityMod.Projectiles.Pets } float flySpeed = 0.5f; Projectile.tileCollide = false; - Vector2 flyDirection = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); + Vector2 flyDirection = Projectile.Center; float horiPos = Main.player[Projectile.owner].position.X + (float)(Main.player[Projectile.owner].width / 2) - flyDirection.X; float vertPos = Main.player[Projectile.owner].position.Y + (float)(Main.player[Projectile.owner].height / 2) - flyDirection.Y; vertPos += (float)Main.rand.Next(-10, 21); diff --git a/Projectiles/Pets/ChibiiDoggo.cs b/Projectiles/Pets/ChibiiDoggo.cs index 74c7662fbf..9954324dac 100644 --- a/Projectiles/Pets/ChibiiDoggo.cs +++ b/Projectiles/Pets/ChibiiDoggo.cs @@ -24,6 +24,9 @@ namespace CalamityMod.Projectiles.Pets Main.projPet[Projectile.type] = true; ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + + ProjectileID.Sets.CharacterPreviewAnimations[Projectile.type] = ProjectileID.Sets.SimpleLoop(0, Main.projFrames[Projectile.type], 6) + .WithOffset(-7f, 0f).WithSpriteDirection(-1).WhenNotSelected(0, 0); } public override void SetDefaults() @@ -50,7 +53,7 @@ namespace CalamityMod.Projectiles.Pets spriteEffects = SpriteEffects.FlipHorizontally; Color colorArea = Lighting.GetColor((int)(Projectile.Center.X / 16), (int)(Projectile.Center.Y / 16)); Texture2D texture2D3 = ModContent.Request("CalamityMod/Projectiles/Pets/ChibiiDoggoMonochrome").Value; - int textureArea = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; + int textureArea = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; int y3 = textureArea * Projectile.frame; Rectangle rectangle = new Rectangle(0, y3, texture2D3.Width, textureArea); Vector2 halfRect = rectangle.Size() / 2f; @@ -63,10 +66,10 @@ namespace CalamityMod.Projectiles.Pets Color colorAlpha = colorArea; colorAlpha = Projectile.GetAlpha(colorAlpha); goto IL_6899; - IL_6881: +IL_6881: counter += twoConst; continue; - IL_6899: +IL_6899: float trailColorChange = (float)(eightCompare - counter); if (twoConst < 0) { @@ -79,7 +82,7 @@ namespace CalamityMod.Projectiles.Pets Main.spriteBatch.Draw(texture2D3, oldDrawPos + Projectile.Size / 2f - Main.screenPosition + new Vector2(0, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), colorAlpha, projRotate + Projectile.rotation * 0f * (float)(counter - 1) * Projectile.spriteDirection, halfRect, Projectile.scale, effects, 0f); goto IL_6881; } - Main.spriteBatch.Draw(ModContent.Request(Texture).Value, Projectile.position + Projectile.Size / 2f - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), lightColor, Projectile.rotation, halfRect, Projectile.scale, spriteEffects, 0); + Main.spriteBatch.Draw(Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value, Projectile.position + Projectile.Size / 2f - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), lightColor, Projectile.rotation, halfRect, Projectile.scale, spriteEffects, 0); return false; } @@ -126,7 +129,7 @@ namespace CalamityMod.Projectiles.Pets for (int i = 0; i < 77; i++) //loop to make lots of dust { - int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 182, Projectile.velocity.X * 0.7f, Projectile.velocity.Y * 0.7f, 100, default, 2.5f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.TheDestroyer, Projectile.velocity.X * 0.7f, Projectile.velocity.Y * 0.7f, 100, default, 2.5f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 1.5f; @@ -198,11 +201,11 @@ namespace CalamityMod.Projectiles.Pets { if (Main.rand.NextBool()) { - SoundEngine.PlaySound(SoundID.Meowmere with { Volume = SoundID.Meowmere.Volume * 4f}, Projectile.position); //nya + SoundEngine.PlaySound(SoundID.Meowmere with { Volume = SoundID.Meowmere.Volume * 4f }, Projectile.position); //nya } else { - SoundEngine.PlaySound(SoundID.ScaryScream with { Volume = SoundID.ScaryScream.Volume * 2f}, player.position); //REEEEEEE + SoundEngine.PlaySound(SoundID.ScaryScream with { Volume = SoundID.ScaryScream.Volume * 2f }, player.position); //REEEEEEE } notlocalai1 = -600f; } diff --git a/Projectiles/Pets/ChibiiDoggoFly.cs b/Projectiles/Pets/ChibiiDoggoFly.cs index c46dd04893..b726b1f09f 100644 --- a/Projectiles/Pets/ChibiiDoggoFly.cs +++ b/Projectiles/Pets/ChibiiDoggoFly.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Projectiles.Pets spriteEffects = SpriteEffects.FlipHorizontally; Color colorArea = Lighting.GetColor((int)(Projectile.Center.X / 16), (int)(Projectile.Center.Y / 16)); Texture2D texture2D3 = ModContent.Request("CalamityMod/Projectiles/Pets/ChibiiDoggoFlyMonochrome").Value; - int textureArea = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; + int textureArea = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; int y3 = textureArea * Projectile.frame; Rectangle rectangle = new Rectangle(0, y3, texture2D3.Width, textureArea); Vector2 origin2 = rectangle.Size() / 2f; @@ -49,10 +49,10 @@ namespace CalamityMod.Projectiles.Pets Color colorAlpha = colorArea; colorAlpha = Projectile.GetAlpha(colorAlpha); goto IL_6899; - IL_6881: +IL_6881: counter += twoConst; continue; - IL_6899: +IL_6899: float trailColorChange = (float)(twelveCompare - counter); if (twoConst < 0) { @@ -65,7 +65,7 @@ namespace CalamityMod.Projectiles.Pets Main.spriteBatch.Draw(texture2D3, oldDrawPos + Projectile.Size / 2f - Main.screenPosition + new Vector2(0, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), colorAlpha, projRotate + Projectile.rotation * 0f * (float)(counter - 1) * Projectile.spriteDirection, origin2, Projectile.scale, effects, 0f); goto IL_6881; } - Main.spriteBatch.Draw(ModContent.Request(Texture).Value, Projectile.position + Projectile.Size / 2f - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), lightColor, Projectile.rotation, origin2, Projectile.scale, spriteEffects, 0); + Main.spriteBatch.Draw(Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value, Projectile.position + Projectile.Size / 2f - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), lightColor, Projectile.rotation, origin2, Projectile.scale, spriteEffects, 0); return false; } diff --git a/Projectiles/Pets/DaawnlightSpiritOriginMinion.cs b/Projectiles/Pets/DaawnlightSpiritOriginMinion.cs index 89d2674b57..a07e9ce4fc 100644 --- a/Projectiles/Pets/DaawnlightSpiritOriginMinion.cs +++ b/Projectiles/Pets/DaawnlightSpiritOriginMinion.cs @@ -1,4 +1,4 @@ -using CalamityMod.Buffs.Pets; +using CalamityMod.Buffs.Pets; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; diff --git a/Projectiles/Pets/DannyDevitoPet.cs b/Projectiles/Pets/DannyDevitoPet.cs index caf6efc850..43b6b5f3f1 100644 --- a/Projectiles/Pets/DannyDevitoPet.cs +++ b/Projectiles/Pets/DannyDevitoPet.cs @@ -1,8 +1,10 @@ -using CalamityMod.CalPlayer; +using System; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Pets { public class DannyDevitoPet : ModProjectile, ILocalizedModType @@ -15,6 +17,9 @@ namespace CalamityMod.Projectiles.Pets { Main.projFrames[Projectile.type] = 8; Main.projPet[Projectile.type] = true; + + ProjectileID.Sets.CharacterPreviewAnimations[Projectile.type] = ProjectileID.Sets.SimpleLoop(2, 5, 5) + .WithOffset(-12f, 2f).WithSpriteDirection(-1).WhenNotSelected(0, 0); } public override void SetDefaults() @@ -146,7 +151,7 @@ namespace CalamityMod.Projectiles.Pets { float flySpeed = 0.3f; Projectile.tileCollide = false; - Vector2 flyDirection = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); + Vector2 flyDirection = Projectile.Center; float horiPos = Main.player[Projectile.owner].position.X + (float)(Main.player[Projectile.owner].width / 2) - flyDirection.X; float vertiPos = Main.player[Projectile.owner].position.Y + (float)(Main.player[Projectile.owner].height / 2) - flyDirection.Y; vertiPos += (float)Main.rand.Next(-10, 21); diff --git a/Projectiles/Pets/DesertScourgeBabyBody.png b/Projectiles/Pets/DesertScourgeBabyBody.png new file mode 100644 index 0000000000..a79304c9bf Binary files /dev/null and b/Projectiles/Pets/DesertScourgeBabyBody.png differ diff --git a/Projectiles/Pets/DesertScourgeBabyBody2.png b/Projectiles/Pets/DesertScourgeBabyBody2.png new file mode 100644 index 0000000000..ad1ed7cc10 Binary files /dev/null and b/Projectiles/Pets/DesertScourgeBabyBody2.png differ diff --git a/Projectiles/Pets/DesertScourgeBabyBody3.png b/Projectiles/Pets/DesertScourgeBabyBody3.png new file mode 100644 index 0000000000..308ac4e880 Binary files /dev/null and b/Projectiles/Pets/DesertScourgeBabyBody3.png differ diff --git a/Projectiles/Pets/DesertScourgeBabyHead.png b/Projectiles/Pets/DesertScourgeBabyHead.png new file mode 100644 index 0000000000..b9d4646498 Binary files /dev/null and b/Projectiles/Pets/DesertScourgeBabyHead.png differ diff --git a/Projectiles/Pets/DesertScourgeBabyTail.png b/Projectiles/Pets/DesertScourgeBabyTail.png new file mode 100644 index 0000000000..55d51f6c73 Binary files /dev/null and b/Projectiles/Pets/DesertScourgeBabyTail.png differ diff --git a/Projectiles/Pets/EidolonSnail.cs b/Projectiles/Pets/EidolonSnail.cs index 1cb931d241..5e1e05f16b 100644 --- a/Projectiles/Pets/EidolonSnail.cs +++ b/Projectiles/Pets/EidolonSnail.cs @@ -1,9 +1,10 @@ +using System; using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.ID; using Terraria.ModLoader; -using System; namespace CalamityMod.Projectiles.Pets { @@ -11,12 +12,16 @@ namespace CalamityMod.Projectiles.Pets { public new string LocalizationCategory => "Projectiles.Pets"; private int playerStill = 0; + private bool idleAnimation = false; private bool fly = false; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 8; + Main.projFrames[Projectile.type] = 12; Main.projPet[Projectile.type] = true; + + ProjectileID.Sets.CharacterPreviewAnimations[Projectile.type] = ProjectileID.Sets.SimpleLoop(0, 4, 5) + .WithOffset(-18f, 0f).WithSpriteDirection(1).WhenNotSelected(0, 0); } public override void SetDefaults() @@ -39,8 +44,8 @@ namespace CalamityMod.Projectiles.Pets int frameHeight = height * Projectile.frame; SpriteEffects spriteEffects = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY + 2), - new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, frameHeight, texture.Width, height)), lightColor, + Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY + 2), + new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, frameHeight, texture.Width, height)), lightColor, Projectile.rotation, new Vector2(texture.Width / 2f, height / 2f), Projectile.scale, spriteEffects, 0); return false; @@ -54,8 +59,8 @@ namespace CalamityMod.Projectiles.Pets int frameHeight = height * Projectile.frame; SpriteEffects spriteEffects = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY + 2), - new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, frameHeight, texture.Width, height)), Color.White, + Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY + 2), + new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, frameHeight, texture.Width, height)), Color.White, Projectile.rotation, new Vector2(texture.Width / 2f, height / 2f), Projectile.scale, spriteEffects, 0); } @@ -77,6 +82,7 @@ namespace CalamityMod.Projectiles.Pets Projectile.active = false; return; } + CalamityPlayer modPlayer = player.Calamity(); if (player.dead) { @@ -154,27 +160,54 @@ namespace CalamityMod.Projectiles.Pets //set frames when idle if (Projectile.position.X == Projectile.oldPosition.X && Projectile.position.Y == Projectile.oldPosition.Y && Projectile.velocity.X == 0) { - Projectile.frame = 0; - Projectile.frameCounter = 0; + if (Main.rand.NextBool(200) && !idleAnimation) + { + idleAnimation = true; + } + + if (idleAnimation) + { + Projectile.frameCounter++; + if (Projectile.frameCounter > 8) + { + Projectile.frame++; + Projectile.frameCounter = 0; + } + if (Projectile.frame > 4) + { + Projectile.frame = 0; + idleAnimation = false; + } + } + else + { + Projectile.frame = 0; + Projectile.frameCounter = 0; + } } //falling frame else if (Projectile.velocity.Y > 0.3f && Projectile.position.Y != Projectile.oldPosition.Y) { - Projectile.frame = 4; + Projectile.frame = 3; Projectile.frameCounter = 0; } else if (Projectile.velocity.X != 0) { + if (Projectile.frame < 4) + { + Projectile.frame = 4; + } + //moving animation Projectile.frameCounter++; - if (Projectile.frameCounter > 2) + if (Projectile.frameCounter > 7 - (Projectile.velocity.X > 0 ? Projectile.velocity.X : -Projectile.velocity.X)) { Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame > 4) + if (Projectile.frame > 8) { - Projectile.frame = 1; + Projectile.frame = 4; } } @@ -191,7 +224,7 @@ namespace CalamityMod.Projectiles.Pets { float flySpeed = 0.5f; Projectile.tileCollide = false; - Vector2 flyDirection = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); + Vector2 flyDirection = Projectile.Center; float horiPos = Main.player[Projectile.owner].position.X + (float)(Main.player[Projectile.owner].width / 2) - flyDirection.X; float vertiPos = Main.player[Projectile.owner].position.Y + (float)(Main.player[Projectile.owner].height / 2) - flyDirection.Y; vertiPos += (float)Main.rand.Next(-10, 21); @@ -291,14 +324,14 @@ namespace CalamityMod.Projectiles.Pets //funny flying animation Projectile.frameCounter++; - if (Projectile.frameCounter > 3) + if (Projectile.frameCounter > 4) { Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame > 7) + if (Projectile.frame > 11) { - Projectile.frame = 5; + Projectile.frame = 9; } } } @@ -325,4 +358,4 @@ namespace CalamityMod.Projectiles.Pets return true; } } -} \ No newline at end of file +} diff --git a/Projectiles/Pets/EidolonSnail.png b/Projectiles/Pets/EidolonSnail.png index 6618499211..fbc4874883 100644 Binary files a/Projectiles/Pets/EidolonSnail.png and b/Projectiles/Pets/EidolonSnail.png differ diff --git a/Projectiles/Pets/EidolonSnailGlow.png b/Projectiles/Pets/EidolonSnailGlow.png index 2097448bf6..0e9057803c 100644 Binary files a/Projectiles/Pets/EidolonSnailGlow.png and b/Projectiles/Pets/EidolonSnailGlow.png differ diff --git a/Projectiles/Pets/FlakPet.cs b/Projectiles/Pets/FlakPet.cs index ae63ae54d8..2f60ed8740 100644 --- a/Projectiles/Pets/FlakPet.cs +++ b/Projectiles/Pets/FlakPet.cs @@ -1,8 +1,10 @@ -using CalamityMod.CalPlayer; +using System; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Pets { public class FlakPet : ModProjectile, ILocalizedModType @@ -17,6 +19,9 @@ namespace CalamityMod.Projectiles.Pets { Main.projFrames[Projectile.type] = 7; Main.projPet[Projectile.type] = true; + + ProjectileID.Sets.CharacterPreviewAnimations[Projectile.type] = ProjectileID.Sets.SimpleLoop(2, 4, 6) + .WithOffset(-7f, 0f).WithSpriteDirection(-1).WhenNotSelected(0, 0); } public override void SetDefaults() @@ -168,7 +173,7 @@ namespace CalamityMod.Projectiles.Pets { float flySpeed = 0.3f; Projectile.tileCollide = false; - Vector2 flyDirection = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); + Vector2 flyDirection = Projectile.Center; float horiPos = Main.player[Projectile.owner].position.X + (float)(Main.player[Projectile.owner].width / 2) - flyDirection.X; float vertiPos = Main.player[Projectile.owner].position.Y + (float)(Main.player[Projectile.owner].height / 2) - flyDirection.Y; vertiPos += (float)Main.rand.Next(-10, 21); diff --git a/Projectiles/Pets/FoxPet.cs b/Projectiles/Pets/FoxPet.cs index fba24a1948..3dafc5d4bd 100644 --- a/Projectiles/Pets/FoxPet.cs +++ b/Projectiles/Pets/FoxPet.cs @@ -2,6 +2,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Pets { public class FoxPet : ModProjectile, ILocalizedModType @@ -11,6 +12,9 @@ namespace CalamityMod.Projectiles.Pets { Main.projFrames[Projectile.type] = 11; Main.projPet[Projectile.type] = true; + + ProjectileID.Sets.CharacterPreviewAnimations[Projectile.type] = ProjectileID.Sets.SimpleLoop(0, 7, 6) + .WithOffset(-35f, 0f).WithSpriteDirection(1).WhenNotSelected(0, 0); } public override void SetDefaults() diff --git a/Projectiles/Pets/GoldiePet.cs b/Projectiles/Pets/GoldiePet.cs index 3a43f3ad91..1479dff3f8 100644 --- a/Projectiles/Pets/GoldiePet.cs +++ b/Projectiles/Pets/GoldiePet.cs @@ -1,6 +1,6 @@ +using System; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -39,7 +39,7 @@ namespace CalamityMod.Projectiles.Pets { if (OwnerCheck()) return; - + Projectile.frameCounter++; Projectile.frame = Projectile.frameCounter / 5 % Main.projFrames[Projectile.type]; Lighting.AddLight(Projectile.Center, GoldColor.ToVector3() * (0.9f + 0.45f * SparkleTimer / MaxSparkleTime)); @@ -61,7 +61,7 @@ namespace CalamityMod.Projectiles.Pets for (int itemIndex = 0; itemIndex < Main.maxItems; itemIndex++) { Item item = Main.item[itemIndex]; - if (item.active && ItemID.Sets.CommonCoin[item.type] && item.noGrabDelay == 0 && item.playerIndexTheItemIsReservedFor == Projectile.owner && + if (item.active && ItemID.Sets.CommonCoin[item.type] && item.noGrabDelay == 0 && item.playerIndexTheItemIsReservedFor == Projectile.owner && ItemLoader.CanPickup(item, Main.player[item.playerIndexTheItemIsReservedFor]) && Main.player[item.playerIndexTheItemIsReservedFor].ItemSpace(item).CanTakeItemToPersonalInventory) { float itemDist = Vector2.Distance(item.Center, Projectile.Center); @@ -69,7 +69,7 @@ namespace CalamityMod.Projectiles.Pets if (itemDist > range) continue; - + //Magnetize the items if close enough if (itemDist <= magnetRange) item.velocity = item.SafeDirectionTo(Projectile.Center) * 6f; @@ -111,7 +111,7 @@ namespace CalamityMod.Projectiles.Pets Vector2 restingSpot = Owner.Center + Vector2.UnitY * -80f; Projectile.velocity = (restingSpot - Projectile.Center) / 15f; Projectile.rotation = Projectile.velocity.X * 0.05f; - + //Start spinning again when rested if (Vector2.Distance(restingSpot, Projectile.Center) <= 2f) RotationTimer++; @@ -152,7 +152,7 @@ namespace CalamityMod.Projectiles.Pets Texture2D shineTex = ModContent.Request("CalamityMod/Particles/Sparkle").Value; float shinePercent = Utils.SmoothStep(MaxBloomTime, MaxSparkleTime, SparkleTimer); float shineScale = (float)Math.Log10(shinePercent + 0.01) + 2f; - + Texture2D bloomTex = ModContent.Request("CalamityMod/Particles/Light").Value; float bloomPercent = Math.Clamp(SparkleTimer / MaxBloomTime, 0f, 5f); //Max of 500% when collecting coins float bloomScale = Math.Clamp(bloomPercent, 0f, 2.5f); @@ -160,7 +160,7 @@ namespace CalamityMod.Projectiles.Pets if (bloomPercent > 0f) { Main.spriteBatch.EnterShaderRegion(BlendState.Additive); - + Main.EntitySpriteDraw(bloomTex, Projectile.Center - Main.screenPosition, null, GoldColor * bloomPercent * 0.2f, Projectile.rotation, bloomTex.Size() / 2f, bloomPercent * Projectile.scale * 0.3f, SpriteEffects.None); Main.EntitySpriteDraw(shineTex, Projectile.Center - Main.screenPosition, null, GoldColor * shinePercent, Projectile.rotation, shineTex.Size() / 2f, shineScale * Projectile.scale, SpriteEffects.None); diff --git a/Projectiles/Pets/KendraPet.cs b/Projectiles/Pets/KendraPet.cs index 2dfbb656b9..c05c9a6eeb 100644 --- a/Projectiles/Pets/KendraPet.cs +++ b/Projectiles/Pets/KendraPet.cs @@ -1,10 +1,12 @@ -using CalamityMod.CalPlayer; +using System; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; -using Terraria.ModLoader; using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Pets { public class KendraPet : ModProjectile, ILocalizedModType @@ -22,6 +24,9 @@ namespace CalamityMod.Projectiles.Pets { Main.projFrames[Projectile.type] = 31; Main.projPet[Projectile.type] = true; + + ProjectileID.Sets.CharacterPreviewAnimations[Projectile.type] = ProjectileID.Sets.SimpleLoop(0, 13, 6) + .WithOffset(-30f, 0f).WithSpriteDirection(-1).WhenNotSelected(0, 0); } public override void SetDefaults() @@ -235,7 +240,7 @@ namespace CalamityMod.Projectiles.Pets { float flySpeed = 0.3f; Projectile.tileCollide = false; - Vector2 flyDirection = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); + Vector2 flyDirection = Projectile.Center; float horiPos = Main.player[Projectile.owner].position.X + (float)(Main.player[Projectile.owner].width / 2) - flyDirection.X; float vertiPos = Main.player[Projectile.owner].position.Y + (float)(Main.player[Projectile.owner].height / 2) - flyDirection.Y; vertiPos += (float)Main.rand.Next(-10, 21); @@ -349,8 +354,8 @@ namespace CalamityMod.Projectiles.Pets public override bool PreDraw(ref Color lightColor) { SpriteEffects spriteEffects = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Texture2D texture2D13 = ModContent.Request(Texture).Value; - int framing = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; + Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + int framing = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; int y6 = framing * Projectile.frame; Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)framing / 2f), Projectile.scale, spriteEffects, 0); return false; diff --git a/Projectiles/Pets/LadShark.cs b/Projectiles/Pets/LadShark.cs index 773fa8c408..dceeda70ad 100644 --- a/Projectiles/Pets/LadShark.cs +++ b/Projectiles/Pets/LadShark.cs @@ -1,10 +1,10 @@ -using CalamityMod.CalPlayer; +using System; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Pets { @@ -14,6 +14,9 @@ namespace CalamityMod.Projectiles.Pets public override void SetStaticDefaults() { Main.projPet[Projectile.type] = true; + + ProjectileID.Sets.CharacterPreviewAnimations[Projectile.type] = ProjectileID.Sets.SimpleLoop(0, 0, 1) + .WithOffset(-12f, -12f).WithSpriteDirection(-1); } public override void SetDefaults() diff --git a/Projectiles/Pets/LeviPet.cs b/Projectiles/Pets/LeviPet.cs index 9d15ecd996..d7505a1750 100644 --- a/Projectiles/Pets/LeviPet.cs +++ b/Projectiles/Pets/LeviPet.cs @@ -1,6 +1,8 @@ -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Pets { public class LeviPet : ModProjectile, ILocalizedModType @@ -10,6 +12,9 @@ namespace CalamityMod.Projectiles.Pets { Main.projFrames[Projectile.type] = 5; Main.projPet[Projectile.type] = true; + + ProjectileID.Sets.CharacterPreviewAnimations[Projectile.type] = ProjectileID.Sets.SimpleLoop(0, Main.projFrames[Projectile.type], 6) + .WithOffset(-18f, -12f).WithSpriteDirection(-1).WhenNotSelected(0, 0); } public override void SetDefaults() diff --git a/Projectiles/Pets/LittleLightProj.cs b/Projectiles/Pets/LittleLightProj.cs index bb0134d387..670adb081a 100644 --- a/Projectiles/Pets/LittleLightProj.cs +++ b/Projectiles/Pets/LittleLightProj.cs @@ -1,5 +1,5 @@ +using System; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Projectiles/Pets/LordePet.cs b/Projectiles/Pets/LordePet.cs index 047131313d..d44b91473b 100644 --- a/Projectiles/Pets/LordePet.cs +++ b/Projectiles/Pets/LordePet.cs @@ -1,11 +1,11 @@ using CalamityMod.CalPlayer; using CalamityMod.NPCs.Other; -using Terraria; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Pets { @@ -61,7 +61,7 @@ namespace CalamityMod.Projectiles.Pets SpriteEffects spriteEffects = SpriteEffects.None; if (Projectile.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Rectangle frameUsed = texture.Frame(2, 7, 0, 1); Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), frameUsed, drawColor, Projectile.rotation, new Vector2(texture.Width / 4f, texture.Height / 14f), Projectile.scale, spriteEffects, 0); diff --git a/Projectiles/Pets/MiniHiveMind.cs b/Projectiles/Pets/MiniHiveMind.cs index e039784ddd..46508b2fe8 100644 --- a/Projectiles/Pets/MiniHiveMind.cs +++ b/Projectiles/Pets/MiniHiveMind.cs @@ -3,9 +3,9 @@ using CalamityMod.CalPlayer; using CalamityMod.NPCs.HiveMind; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Pets { @@ -21,6 +21,9 @@ namespace CalamityMod.Projectiles.Pets Main.projPet[Projectile.type] = true; ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + + ProjectileID.Sets.CharacterPreviewAnimations[Projectile.type] = ProjectileID.Sets.SimpleLoop(0, Main.projFrames[Projectile.type], 6) + .WithOffset(-12f, 0f).WithSpriteDirection(-1).WhenNotSelected(0, 0); } public override void SetDefaults() diff --git a/Projectiles/Pets/OceanSpirit.cs b/Projectiles/Pets/OceanSpirit.cs index 13d5fa276c..64e4cb27e1 100644 --- a/Projectiles/Pets/OceanSpirit.cs +++ b/Projectiles/Pets/OceanSpirit.cs @@ -1,4 +1,4 @@ -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; diff --git a/Projectiles/Pets/PerforaMini.cs b/Projectiles/Pets/PerforaMini.cs index 2668ffe77b..64659ece26 100644 --- a/Projectiles/Pets/PerforaMini.cs +++ b/Projectiles/Pets/PerforaMini.cs @@ -1,8 +1,10 @@ -using CalamityMod.Buffs.Pets; +using CalamityMod.Buffs.Pets; using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Pets { public class PerforaMini : ModProjectile, ILocalizedModType @@ -12,6 +14,9 @@ namespace CalamityMod.Projectiles.Pets { Main.projFrames[Projectile.type] = 8; Main.projPet[Projectile.type] = true; + + ProjectileID.Sets.CharacterPreviewAnimations[Projectile.type] = ProjectileID.Sets.SimpleLoop(0, Main.projFrames[Projectile.type], 6) + .WithOffset(-8f, -20f).WithSpriteDirection(1).WhenNotSelected(0, 0); } public override void SetDefaults() @@ -58,8 +63,8 @@ namespace CalamityMod.Projectiles.Pets //Dust if (Main.rand.NextBool(50)) { - int d1 = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, 5, 0f, 0f, 100, default, 1.5f); - int d2 = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, 170, 0f, 0f, 170, default, 0.5f); + int d1 = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, DustID.Blood, 0f, 0f, 100, default, 1.5f); + int d2 = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, DustID.Ichor, 0f, 0f, 170, default, 0.5f); Main.dust[d2].noLight = true; Main.dust[d1].position = Projectile.Center; Main.dust[d2].position = Projectile.Center; diff --git a/Projectiles/Pets/PineapplePetProj.cs b/Projectiles/Pets/PineapplePetProj.cs index b4ca791833..4ab4afddce 100644 --- a/Projectiles/Pets/PineapplePetProj.cs +++ b/Projectiles/Pets/PineapplePetProj.cs @@ -1,7 +1,9 @@ -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Pets { public class PineapplePetProj : ModProjectile, ILocalizedModType @@ -11,6 +13,9 @@ namespace CalamityMod.Projectiles.Pets { Main.projFrames[Projectile.type] = 5; Main.projPet[Projectile.type] = true; + + ProjectileID.Sets.CharacterPreviewAnimations[Projectile.type] = ProjectileID.Sets.SimpleLoop(0, Main.projFrames[Projectile.type], 6) + .WithOffset(-2f, -20f).WithSpriteDirection(-1).WhenNotSelected(0, 0); } public override void SetDefaults() diff --git a/Projectiles/Pets/PlaguebringerBab.cs b/Projectiles/Pets/PlaguebringerBab.cs index 6e31efdff9..5bcc934fc0 100644 --- a/Projectiles/Pets/PlaguebringerBab.cs +++ b/Projectiles/Pets/PlaguebringerBab.cs @@ -1,6 +1,8 @@ -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Pets { public class PlaguebringerBab : ModProjectile, ILocalizedModType @@ -10,6 +12,9 @@ namespace CalamityMod.Projectiles.Pets { Main.projFrames[Projectile.type] = 6; Main.projPet[Projectile.type] = true; + + ProjectileID.Sets.CharacterPreviewAnimations[Projectile.type] = ProjectileID.Sets.SimpleLoop(0, 4, 6) + .WithOffset(-25f, -20f).WithSpriteDirection(-1).WhenNotSelected(0, 0); } public override void SetDefaults() diff --git a/Projectiles/Pets/PrimroseKeepsakeDisplay.cs b/Projectiles/Pets/PrimroseKeepsakeDisplay.cs new file mode 100644 index 0000000000..6fca15e509 --- /dev/null +++ b/Projectiles/Pets/PrimroseKeepsakeDisplay.cs @@ -0,0 +1,33 @@ +using CalamityMod.CalPlayer; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Pets +{ + public class PrimroseKeepsakeDisplay : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Pets"; + public override void SetStaticDefaults() + { + Main.projPet[Projectile.type] = true; + + ProjectileID.Sets.CharacterPreviewAnimations[Projectile.type] = ProjectileID.Sets.SimpleLoop(0, 0, 1) + .WithOffset(-22f, 0f).WithSpriteDirection(-1).WhenNotSelected(0, 0); + } + + public override void SetDefaults() + { + Projectile.width = 54; + Projectile.height = 38; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 1; + } + + public override void AI() + { + Projectile.Kill(); + } + } +} diff --git a/Projectiles/Pets/PrimroseKeepsakeDisplay.png b/Projectiles/Pets/PrimroseKeepsakeDisplay.png new file mode 100644 index 0000000000..fbdf7607e5 Binary files /dev/null and b/Projectiles/Pets/PrimroseKeepsakeDisplay.png differ diff --git a/Projectiles/Pets/RotomPet.cs b/Projectiles/Pets/RotomPet.cs index 1303017c7b..b58699ab21 100644 --- a/Projectiles/Pets/RotomPet.cs +++ b/Projectiles/Pets/RotomPet.cs @@ -1,8 +1,10 @@ -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Pets { public class RotomPet : ModProjectile, ILocalizedModType @@ -16,16 +18,19 @@ namespace CalamityMod.Projectiles.Pets Normal, Dex, Wash, - Heat, - Frost, - Mow, - Fan + Heat, + Frost, + Mow, + Fan } public override void SetStaticDefaults() { Main.projFrames[Projectile.type] = 4; Main.projPet[Projectile.type] = true; + + ProjectileID.Sets.CharacterPreviewAnimations[Projectile.type] = ProjectileID.Sets.SimpleLoop(0, Main.projFrames[Projectile.type], 6) + .WithOffset(-10f, 0f).WithSpriteDirection(1).WhenNotSelected(0, 0); } public override void SetDefaults() @@ -91,7 +96,7 @@ namespace CalamityMod.Projectiles.Pets int dustAmt = 25; for (int i = 0; i < dustAmt; i++) { - int electric = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y + 16f), Projectile.width, Projectile.height - 16, 132, 0f, 0f, 0, default, 1f); + int electric = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y + 16f), Projectile.width, Projectile.height - 16, DustID.Firework_Blue, 0f, 0f, 0, default, 1f); Main.dust[electric].velocity *= 2f; Main.dust[electric].scale *= 1.15f; } @@ -114,7 +119,7 @@ namespace CalamityMod.Projectiles.Pets public override bool PreDraw(ref Color lightColor) { Drawing(lightColor, - ModContent.Request(Texture).Value, + Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value, ModContent.Request("CalamityMod/Projectiles/Pets/RotomDex").Value, ModContent.Request("CalamityMod/Projectiles/Pets/RotomWash").Value, ModContent.Request("CalamityMod/Projectiles/Pets/RotomHeat").Value, diff --git a/Projectiles/Pets/SCalPet.cs b/Projectiles/Pets/SCalPet.cs index e08ac134df..9ae7ed1612 100644 --- a/Projectiles/Pets/SCalPet.cs +++ b/Projectiles/Pets/SCalPet.cs @@ -1,7 +1,9 @@ -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Pets { public class SCalPet : ModProjectile, ILocalizedModType @@ -11,6 +13,9 @@ namespace CalamityMod.Projectiles.Pets { Main.projFrames[Projectile.type] = 6; Main.projPet[Projectile.type] = true; + + ProjectileID.Sets.CharacterPreviewAnimations[Projectile.type] = ProjectileID.Sets.SimpleLoop(0, Main.projFrames[Projectile.type], 6) + .WithOffset(-12f, -18).WithSpriteDirection(-1).WhenNotSelected(0, 0); } public override void SetDefaults() diff --git a/Projectiles/Pets/Sparks.cs b/Projectiles/Pets/Sparks.cs index 0de8b7de5c..036204101e 100644 --- a/Projectiles/Pets/Sparks.cs +++ b/Projectiles/Pets/Sparks.cs @@ -1,11 +1,11 @@ -using CalamityMod.CalPlayer; -using System; +using System; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Pets { @@ -34,7 +34,6 @@ namespace CalamityMod.Projectiles.Pets private void Pickup() { - int defaultItemGrabRange = 38; Player player = Main.player[Projectile.owner]; for (int itemIndex = 0; itemIndex < Main.maxItems; itemIndex++) @@ -170,7 +169,7 @@ namespace CalamityMod.Projectiles.Pets } float flySpeed = 0.5f; Projectile.tileCollide = false; - Vector2 flyDirection = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); + Vector2 flyDirection = Projectile.Center; float xDist = player.position.X + (float)(player.width / 2) - flyDirection.X; float yDist = player.position.Y + (float)(player.height / 2) - flyDirection.Y; yDist += (float)Main.rand.Next(-10, 21); @@ -360,7 +359,7 @@ namespace CalamityMod.Projectiles.Pets for (int itemIndex = 0; itemIndex < Main.maxItems; itemIndex++) { Item item = Main.item[itemIndex]; - if (item.active && item.noGrabDelay == 0 && item.playerIndexTheItemIsReservedFor == Projectile.owner && + if (item.active && item.noGrabDelay == 0 && item.playerIndexTheItemIsReservedFor == Projectile.owner && ItemLoader.CanPickup(item, Main.player[item.playerIndexTheItemIsReservedFor]) && Main.player[item.playerIndexTheItemIsReservedFor].ItemSpace(item).CanTakeItemToPersonalInventory) { if (ItemID.Sets.NebulaPickup[item.type]) @@ -462,7 +461,7 @@ namespace CalamityMod.Projectiles.Pets public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; if (color == 1) texture = ModContent.Request("CalamityMod/Projectiles/Pets/SparksBlue").Value; if (color == 2) diff --git a/Projectiles/Pets/ThirdSage.cs b/Projectiles/Pets/ThirdSage.cs index 442a6d659b..8aa69533f3 100644 --- a/Projectiles/Pets/ThirdSage.cs +++ b/Projectiles/Pets/ThirdSage.cs @@ -1,8 +1,8 @@ using CalamityMod.CalPlayer; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Pets { @@ -13,6 +13,9 @@ namespace CalamityMod.Projectiles.Pets { Main.projPet[Projectile.type] = true; Main.projFrames[Projectile.type] = 7; + + ProjectileID.Sets.CharacterPreviewAnimations[Projectile.type] = ProjectileID.Sets.SimpleLoop(0, 4, 6) + .WithOffset(-15f, -5f).WithSpriteDirection(1).WhenNotSelected(0, 0); } public override void SetDefaults() diff --git a/Projectiles/Pets/YharonSonPet.cs b/Projectiles/Pets/YharonSonPet.cs index 06e4ed3992..0992ce81da 100644 --- a/Projectiles/Pets/YharonSonPet.cs +++ b/Projectiles/Pets/YharonSonPet.cs @@ -2,7 +2,9 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Pets { public class YharonSonPet : ModProjectile, ILocalizedModType @@ -28,6 +30,11 @@ namespace CalamityMod.Projectiles.Pets public override void SetStaticDefaults() { Main.projPet[Projectile.type] = true; + + //i cannot be bothered to figure out why it keeps flickering everytime it repeats the animation + //as a "solution" i have set the frame counter to an obnoxiously high number so it probably wont be noticed by players + ProjectileID.Sets.CharacterPreviewAnimations[Projectile.type] = ProjectileID.Sets.SimpleLoop(1, 1, int.MaxValue) + .WithOffset(-55f, 2f).WithSpriteDirection(-1).WhenNotSelected(0, 0); } public override void SetDefaults() @@ -43,7 +50,7 @@ namespace CalamityMod.Projectiles.Pets { if (Projectile.frameCounter <= 1) return false; - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Vector2 origin = texture.Size() / new Vector2((float)xFrameAmt, (float)yFrameAmt) * 0.5f; Rectangle frame = texture.Frame(xFrameAmt, yFrameAmt, frameX, frameY); SpriteEffects spriteEffects = Projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; diff --git a/Projectiles/Ranged/AMRShot.cs b/Projectiles/Ranged/AMRShot.cs index 335f608c0c..d1c7e80d46 100644 --- a/Projectiles/Ranged/AMRShot.cs +++ b/Projectiles/Ranged/AMRShot.cs @@ -1,10 +1,10 @@ -using CalamityMod.Buffs.StatDebuffs; +using System; +using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -49,7 +49,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool OnTileCollide(Vector2 oldVelocity) { Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); - SoundEngine.PlaySound(SoundID.Dig, Projectile.position); + SoundEngine.PlaySound(SoundID.Dig, Projectile.Center); return true; } diff --git a/Projectiles/Ranged/AccelerationRoundProj.cs b/Projectiles/Ranged/AccelerationRoundProj.cs deleted file mode 100644 index 6e16edb5d8..0000000000 --- a/Projectiles/Ranged/AccelerationRoundProj.cs +++ /dev/null @@ -1,77 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Audio; - -namespace CalamityMod.Projectiles.Ranged -{ - public class AccelerationRoundProj : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Ranged"; - public override void SetStaticDefaults() - { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; - } - - public override void SetDefaults() - { - Projectile.width = 4; - Projectile.height = 4; - Projectile.aiStyle = ProjAIStyleID.Arrow; - Projectile.friendly = true; - Projectile.DamageType = DamageClass.Ranged; - Projectile.penetrate = 1; - Projectile.timeLeft = 600; - Projectile.extraUpdates = 3; - AIType = ProjectileID.Bullet; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; - } - - public override void AI() - { - Projectile.velocity *= 1.01f; - if (Projectile.velocity.Length() >= 12f) - { - Projectile.velocity *= 0.5f; - Projectile.extraUpdates++; - Projectile.netUpdate = true; - } - - Projectile.localAI[0] += 1f; - if (Projectile.localAI[0] > 4f) - { - if (Main.rand.NextBool(3)) - { - int num137 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), 1, 1, 91, 0f, 0f, 0, default, 0.5f); - Main.dust[num137].alpha = Projectile.alpha; - Main.dust[num137].velocity *= 0f; - Main.dust[num137].noGravity = true; - } - } - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); - SoundEngine.PlaySound(SoundID.Dig, Projectile.position); - return true; - } - - public override bool PreDraw(ref Color lightColor) - { - CalamityUtils.DrawAfterimagesFromEdge(Projectile, 0, lightColor); - return false; - } - - public override void OnKill(int timeLeft) - { - SoundEngine.PlaySound(SoundID.Item10, Projectile.position); - for (int k = 0; k < 5; k++) - { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 91, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); - } - } - } -} diff --git a/Projectiles/Ranged/AccelerationRoundProj.png b/Projectiles/Ranged/AccelerationRoundProj.png deleted file mode 100644 index 646dd6b505..0000000000 Binary files a/Projectiles/Ranged/AccelerationRoundProj.png and /dev/null differ diff --git a/Projectiles/Ranged/AdamAcceleratorBeam.cs b/Projectiles/Ranged/AdamAcceleratorBeam.cs index 559004528f..bd50ea7155 100644 --- a/Projectiles/Ranged/AdamAcceleratorBeam.cs +++ b/Projectiles/Ranged/AdamAcceleratorBeam.cs @@ -1,14 +1,14 @@ -using CalamityMod.Items.Weapons.Ranged; +using System; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.Enums; using Terraria.GameContent.Shaders; using Terraria.Graphics.Effects; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Particles; namespace CalamityMod.Projectiles.Ranged { @@ -143,7 +143,7 @@ namespace CalamityMod.Projectiles.Ranged target.PolarityNPC().applyPolarity(polarity, target); //applies a positive or negative polarity on the target for 120 frames } - + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { // Ensure that the hit direction is correct when hitting enemies. @@ -181,7 +181,7 @@ namespace CalamityMod.Projectiles.Ranged if (beamVector == Vector2.Zero || Projectile.velocity != Vector2.Zero) return false; - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; float beamLength = Projectile.ai[0]; Vector2 centerFloored = Projectile.Center.Floor() + beamVector * Projectile.scale * BeamRenderTileOffset; Vector2 scaleVec = new Vector2(Projectile.scale); diff --git a/Projectiles/Ranged/AdamantiteAcceleratorHoldout.cs b/Projectiles/Ranged/AdamantiteAcceleratorHoldout.cs index b08de65afc..57f572b000 100644 --- a/Projectiles/Ranged/AdamantiteAcceleratorHoldout.cs +++ b/Projectiles/Ranged/AdamantiteAcceleratorHoldout.cs @@ -1,9 +1,9 @@ -using CalamityMod.Items.Weapons.Ranged; +using System; +using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Utilities; -using System; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Ranged else if (SoundEngine.TryGetActiveSound(ChargeupSoundSlot, out var soundOut) && soundOut.IsPlaying) { - soundOut.Sound.Pitch = ChargeTimer * 2f ; + soundOut.Sound.Pitch = ChargeTimer * 2f; soundOut.Position = Projectile.Center; } @@ -128,7 +128,7 @@ namespace CalamityMod.Projectiles.Ranged { // Place the projectile directly into the player's hand at all times Projectile.Center = rrp; - + // The gun is a holdout projectile, so change the player's variables to reflect that player.ChangeDir(Math.Sign(Projectile.rotation.ToRotationVector2().X)); player.heldProj = Projectile.whoAmI; @@ -136,7 +136,7 @@ namespace CalamityMod.Projectiles.Ranged player.itemAnimation = 2; player.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, Projectile.rotation - MathHelper.PiOver2); - + } private void FiringEffects(Color color) @@ -149,7 +149,7 @@ namespace CalamityMod.Projectiles.Ranged if (Owner == Main.LocalPlayer && Owner.Calamity().GeneralScreenShakePower < 5) { - Main.LocalPlayer.Calamity().GeneralScreenShakePower = 1; + Main.LocalPlayer.Calamity().GeneralScreenShakePower = 1; } BounceBackPower = 1f; diff --git a/Projectiles/Ranged/AngelicBeam.cs b/Projectiles/Ranged/AngelicBeam.cs index 4047066e57..a63d849af3 100644 --- a/Projectiles/Ranged/AngelicBeam.cs +++ b/Projectiles/Ranged/AngelicBeam.cs @@ -1,4 +1,4 @@ -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.DamageOverTime; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged diff --git a/Projectiles/Ranged/AnimosityBullet.cs b/Projectiles/Ranged/AnimosityBullet.cs new file mode 100644 index 0000000000..427d0ab0a4 --- /dev/null +++ b/Projectiles/Ranged/AnimosityBullet.cs @@ -0,0 +1,129 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Dusts; +using CalamityMod.Particles; +using CalamityMod.Systems; +using Microsoft.CodeAnalysis; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + internal class AnimosityBullet : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Ranged"; + + public ref float Time => ref Projectile.ai[0]; + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 15; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + } + public override void SetDefaults() + { + Projectile.width = 18; + Projectile.height = 12; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = Main.zenithWorld ? 3 : 1; + Projectile.extraUpdates = 2; + Projectile.timeLeft = 300; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; + } + public override void AI() + { + Projectile.scale = Main.zenithWorld ? 2f : 1.4f; + Projectile.rotation = Projectile.velocity.ToRotation(); + Time++; + + // Lighting + Lighting.AddLight(Projectile.Center, 0.9f, 0f, 0.15f); + + // Visuals + if (Time > 3f) + { + SparkParticle spark = new SparkParticle(Projectile.Center - Projectile.velocity * 1.8f, -Projectile.velocity * 0.01f, false, 11, 1.6f, (Main.zenithWorld ? Color.MediumPurple : Color.Red) * 0.65f); + GeneralParticleHandler.SpawnParticle(spark); + } + + for (int i = 0; i <= 2; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center + Projectile.velocity * Main.rand.NextFloat(-0.5f, 0.5f), Main.rand.NextBool(3) ? 90 : 60, -Projectile.velocity.RotatedBy(-0.5) * Main.rand.NextFloat(0.05f, 0.2f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.5f, 1.1f); + Dust dust2 = Dust.NewDustPerfect(Projectile.Center + Projectile.velocity * Main.rand.NextFloat(-0.5f, 0.5f), Main.rand.NextBool(3) ? 90 : 60, -Projectile.velocity.RotatedBy(0.5) * Main.rand.NextFloat(0.05f, 0.2f)); + dust2.noGravity = true; + dust2.scale = Main.rand.NextFloat(0.5f, 1.1f); + } + } + public override void Kill(int timeLeft) + { + SoundEngine.PlaySound(SoundID.NPCDeath55 with { Pitch = -0.7f }, Projectile.Center); + //DesertProwelerSkullParticle was a placeholder, but honestly it fits too well + for (int i = 0; i <= 11; i++) + { + Particle skull = new DesertProwlerSkullParticle(Projectile.Center, new Vector2(2.5f, 2.5f).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1f), Main.rand.NextBool() ? Color.Crimson : Color.DarkRed, Color.Red, Main.rand.NextFloat(0.2f, 0.9f), 175); + GeneralParticleHandler.SpawnParticle(skull); + } + for (int i = 0; i <= 25; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(3) ? 90 : 60, new Vector2(0, -5).RotatedByRandom(MathHelper.ToRadians(35f)) * Main.rand.NextFloat(0.1f, 1.9f)); + dust.noGravity = false; + dust.scale = Main.rand.NextFloat(0.9f, 1.5f); + Dust dust2 = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(3) ? 90 : 60, new Vector2(0, -2).RotatedByRandom(MathHelper.ToRadians(35f)) * Main.rand.NextFloat(0.1f, 1.9f)); + dust2.noGravity = false; + dust2.scale = Main.rand.NextFloat(0.9f, 1.5f); + } + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 300); + target.AddBuff(ModContent.BuffType(), 120); + + // Music easter egg in GFB, and more! + if (Main.zenithWorld) + { + target.AddBuff(ModContent.BuffType(), 60); + target.AddBuff(BuffID.ShadowFlame, 120); + GungeonMusicSystem.GUN(); + + //There's no chickens, so I'm using bunnies instead + if (target.life <= 0 && target.type != NPCID.Bunny && target.type != NPCID.ExplosiveBunny && target.type != NPCID.GoldBunny) + { + SoundEngine.PlaySound(SoundID.NPCDeath7 with { Pitch = -0.7f }, Projectile.Center); + NPC.NewNPC(target.GetSource_Death(), (int)Projectile.Center.X, (int)Projectile.Center.Y, NPCID.Bunny); + } + } + + } + + public override void OnHitPlayer(Player target, Player.HurtInfo info) + { + target.AddBuff(ModContent.BuffType(), 120); + + if (Main.zenithWorld) + { + target.AddBuff(BuffID.ShadowFlame, 120); + GungeonMusicSystem.GUN(); + + //You can turn your friends into bunnies too! + if (target.statLife <= 0) + { + SoundEngine.PlaySound(SoundID.NPCDeath7 with { Pitch = -0.7f }, Projectile.Center); + NPC.NewNPC(target.GetSource_Death(), (int)Projectile.Center.X, (int)Projectile.Center.Y, NPCID.Bunny); + } + } + } + + public override bool PreDraw(ref Color lightColor) + { + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], Color.Crimson * 0.45f, 1); + return true; + } + } +} diff --git a/Projectiles/Ranged/AnimosityBullet.png b/Projectiles/Ranged/AnimosityBullet.png new file mode 100644 index 0000000000..98a9c1619b Binary files /dev/null and b/Projectiles/Ranged/AnimosityBullet.png differ diff --git a/Projectiles/Ranged/AquaBlast.cs b/Projectiles/Ranged/AquaBlast.cs index 3121ce368d..0397ad3904 100644 --- a/Projectiles/Ranged/AquaBlast.cs +++ b/Projectiles/Ranged/AquaBlast.cs @@ -1,6 +1,8 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Ranged { public class AquaBlast : ModProjectile, ILocalizedModType @@ -47,7 +49,7 @@ namespace CalamityMod.Projectiles.Ranged for (int i = 0; i < 2; i++) { Vector2 dspeed = -Projectile.velocity * Main.rand.NextFloat(0.5f * 0.8f); - int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 1f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Water, 0f, 0f, 100, default, 1f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity = dspeed; } @@ -57,7 +59,7 @@ namespace CalamityMod.Projectiles.Ranged { for (int lol = 0; lol < 10; lol++) { - Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 1f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Water, 0f, 0f, 100, default, 1f); } } } diff --git a/Projectiles/Ranged/AquaBlastToxic.cs b/Projectiles/Ranged/AquaBlastToxic.cs index 02c421e595..963152fa75 100644 --- a/Projectiles/Ranged/AquaBlastToxic.cs +++ b/Projectiles/Ranged/AquaBlastToxic.cs @@ -48,7 +48,7 @@ namespace CalamityMod.Projectiles.Ranged for (int i = 0; i < 2; i++) { Vector2 dspeed = -Projectile.velocity * Main.rand.NextFloat(0.5f * 0.8f); - int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 89, 0f, 0f, 100, default, 1f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GemEmerald, 0f, 0f, 100, default, 1f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity = dspeed; } @@ -58,7 +58,7 @@ namespace CalamityMod.Projectiles.Ranged { for (int lol = 0; lol < 10; lol++) { - Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 89, 0f, 0f, 100, default, 1f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GemEmerald, 0f, 0f, 100, default, 1f); } } diff --git a/Projectiles/Ranged/Aquashard.cs b/Projectiles/Ranged/Aquashard.cs index 9e24d2bff5..4194e268b6 100644 --- a/Projectiles/Ranged/Aquashard.cs +++ b/Projectiles/Ranged/Aquashard.cs @@ -1,8 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; -using Terraria.ModLoader; -using Terraria.ID; using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { @@ -45,7 +45,7 @@ namespace CalamityMod.Projectiles.Ranged SoundEngine.PlaySound(SoundID.Item27, Projectile.position); for (int k = 0; k < 5; k++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 154, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Rain, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } } diff --git a/Projectiles/Ranged/AquashardSplit.cs b/Projectiles/Ranged/AquashardSplit.cs index eb3c05cc06..f044a6e80b 100644 --- a/Projectiles/Ranged/AquashardSplit.cs +++ b/Projectiles/Ranged/AquashardSplit.cs @@ -1,7 +1,7 @@ -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; +using Terraria; using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { @@ -29,7 +29,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.velocity.Y += 0.01f; if (Projectile.timeLeft < 150) - CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 450f, 6f, 20f); + CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 450f, Projectile.ai[1] == 1f ? 8f : 6f, 20f); } public override void OnKill(int timeLeft) @@ -37,7 +37,7 @@ namespace CalamityMod.Projectiles.Ranged SoundEngine.PlaySound(SoundID.Item27, Projectile.position); for (int k = 0; k < 5; k++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 154, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Rain, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } } diff --git a/Projectiles/Ranged/ArcNovaDiffuserHoldout.cs b/Projectiles/Ranged/ArcNovaDiffuserHoldout.cs index 61d070848e..bc886a28f8 100644 --- a/Projectiles/Ranged/ArcNovaDiffuserHoldout.cs +++ b/Projectiles/Ranged/ArcNovaDiffuserHoldout.cs @@ -1,27 +1,27 @@ using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Particles; +using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using ReLogic.Utilities; -using System; using Terraria; using Terraria.Audio; -using Terraria.Localization; +using Terraria.GameContent; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { - public class ArcNovaDiffuserHoldout : ModProjectile + public class ArcNovaDiffuserHoldout : BaseGunHoldoutProjectile { - // Take the name and texture from the weapon - public override LocalizedText DisplayName => CalamityUtils.GetItemName(); - public override string Texture => "CalamityMod/Items/Weapons/Ranged/ArcNovaDiffuser"; + public override int AssociatedItemID => ModContent.ItemType(); + public override float MaxOffsetLengthFromArm => 24f; + public override float OffsetXUpwards => -5f; + public override float BaseOffsetY => -5f; + public override float OffsetYDownwards => 5f; public static int FramesPerLoad = 13; public static int MaxLoadableShots = 15; public static float BulletSpeed = 12f; - public int Time = 0; - - private Player Owner => Main.player[Projectile.owner]; public SlotId NovaChargeSlot; private ref float CurrentChargingFrames => ref Projectile.ai[0]; @@ -30,41 +30,25 @@ namespace CalamityMod.Projectiles.Ranged private bool ChargeLV1 => CurrentChargingFrames >= ArcNovaDiffuser.Charge1Frames; private bool ChargeLV2 => CurrentChargingFrames >= ArcNovaDiffuser.Charge2Frames; - private bool OwnerCanShoot => Owner.channel && !Owner.noItems && !Owner.CCed; - - public override void SetDefaults() + public override void KillHoldoutLogic() { - Projectile.width = 72; - Projectile.height = 38; - Projectile.friendly = true; - Projectile.tileCollide = false; - Projectile.DamageType = DamageClass.Ranged; - Projectile.ignoreWater = true; - } - - public override void AI() - { - Time++; - if (Time == 1) - Projectile.alpha = 255; - else - Projectile.alpha = 0; - - if (Owner.dead) // destroy the holdout if the player dies + if (HeldItem.type != Owner.ActiveItem().type || Owner is null || !Owner.active || Owner.CCed || Owner.dead || Owner.noItems) { Projectile.Kill(); - return; + Projectile.netUpdate = true; } + } - Vector2 armPosition = Owner.RotatedRelativePoint(Owner.MountedCenter, true); - Vector2 tipPosition = armPosition + Projectile.velocity * Projectile.width * 0.95f; - + public override void HoldoutAI() + { if (SoundEngine.TryGetActiveSound(NovaChargeSlot, out var ChargeSound) && ChargeSound.IsPlaying) ChargeSound.Position = Projectile.Center; // Fire if the owner stops channeling or otherwise cannot use the weapon. - if (!OwnerCanShoot) + if (Owner.CantUseHoldout()) { + KeepRefreshingLifetime = false; + // Big Shot mode if (ChargeLV2) { @@ -79,16 +63,17 @@ namespace CalamityMod.Projectiles.Ranged Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * BulletSpeed; int charge2Damage = Projectile.damage * 20; float charge2KB = Projectile.knockBack * 3f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), tipPosition, shootVelocity, ModContent.ProjectileType(), charge2Damage, charge2KB, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity, ModContent.ProjectileType(), charge2Damage, charge2KB, Projectile.owner); Owner.Calamity().GeneralScreenShakePower = 6.5f; for (int i = 0; i <= 25; i++) { - Dust dust = Dust.NewDustPerfect(tipPosition - Projectile.velocity * 15, 107, shootVelocity.RotatedByRandom(MathHelper.ToRadians(15f)) * Main.rand.NextFloat(0.2f, 1.2f), 0, default, Main.rand.NextFloat(1f, 2.3f)); + Dust dust = Dust.NewDustPerfect(GunTipPosition - Projectile.velocity * 15, 107, shootVelocity.RotatedByRandom(MathHelper.ToRadians(15f)) * Main.rand.NextFloat(0.2f, 1.2f), 0, default, Main.rand.NextFloat(1f, 2.3f)); dust.noGravity = true; } ShotsLoaded = 0; ShootRecoilTimer = 24f; + OffsetLengthFromArm -= 25f; Projectile.netSpam = 0; Projectile.netUpdate = true; } @@ -112,18 +97,19 @@ namespace CalamityMod.Projectiles.Ranged Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * BulletSpeed; Vector2 fireVec = shootVelocity.RotatedByRandom(MathHelper.ToRadians(2f)); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), tipPosition, fireVec, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, fireVec, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); for (int i = 0; i <= 4; i++) { - Dust dust = Dust.NewDustPerfect(tipPosition - Projectile.velocity * 15, 107, shootVelocity.RotatedByRandom(MathHelper.ToRadians(15f)) * Main.rand.NextFloat(0.9f, 1.2f), 0, default, Main.rand.NextFloat(0.8f, 1.8f)); + Dust dust = Dust.NewDustPerfect(GunTipPosition - Projectile.velocity * 15, 107, shootVelocity.RotatedByRandom(MathHelper.ToRadians(15f)) * Main.rand.NextFloat(0.9f, 1.2f), 0, default, Main.rand.NextFloat(0.8f, 1.8f)); dust.noGravity = true; } ShotsLoaded--; ShootRecoilTimer = 16f; + OffsetLengthFromArm -= 5f; Projectile.netSpam = 0; Projectile.netUpdate = true; - } + } } // Retracting any remaining recoil else if (ShootRecoilTimer > 0) @@ -134,7 +120,7 @@ namespace CalamityMod.Projectiles.Ranged { for (int i = 0; i < 6; i++) { - SparkParticle spark2 = new SparkParticle((tipPosition - Projectile.velocity * 3) + Main.rand.NextVector2Circular(10, 10), -Projectile.velocity * Main.rand.NextFloat(9.1f, 17.8f), false, Main.rand.Next(9, 12), Main.rand.NextFloat(0.2f, 0.3f), Main.rand.NextBool(4) ? Color.Chartreuse : Color.Lime); + SparkParticle spark2 = new SparkParticle((GunTipPosition - Projectile.velocity * 3) + Main.rand.NextVector2Circular(10, 10), -Projectile.velocity * Main.rand.NextFloat(9.1f, 17.8f), false, Main.rand.Next(9, 12), Main.rand.NextFloat(0.2f, 0.3f), Main.rand.NextBool(4) ? Color.Chartreuse : Color.Lime); GeneralParticleHandler.SpawnParticle(spark2); } ShotsLoaded--; @@ -142,9 +128,6 @@ namespace CalamityMod.Projectiles.Ranged } else { - // While channeled, keep refreshing the projectile lifespan - Projectile.timeLeft = 2; - // Loads shots until maxed out if (ShotsLoaded < MaxLoadableShots && CurrentChargingFrames % FramesPerLoad == 0) ShotsLoaded++; @@ -178,17 +161,17 @@ namespace CalamityMod.Projectiles.Ranged float particleScale = MathHelper.Clamp(CurrentChargingFrames, 0f, ArcNovaDiffuser.Charge2Frames); for (int i = 0; i < (ChargeLV2 ? 4 : ChargeLV1 ? 3 : 2); i++) { - SparkParticle spark2 = new SparkParticle((tipPosition -Projectile.velocity * 4) + Main.rand.NextVector2Circular(12, 12), -Projectile.velocity * Main.rand.NextFloat(16.1f, 30.8f), false, Main.rand.Next(2, 7), Main.rand.NextFloat(particleScale / 350f, particleScale / 270f), Main.rand.NextBool(4) ? Color.Chartreuse : Color.Lime); + SparkParticle spark2 = new SparkParticle((GunTipPosition - Projectile.velocity * 4) + Main.rand.NextVector2Circular(12, 12), -Projectile.velocity * Main.rand.NextFloat(16.1f, 30.8f), false, Main.rand.Next(2, 7), Main.rand.NextFloat(particleScale / 350f, particleScale / 270f), Main.rand.NextBool(4) ? Color.Chartreuse : Color.Lime); GeneralParticleHandler.SpawnParticle(spark2); } - Particle orb = new GenericBloom(tipPosition, Projectile.velocity, Color.Lime, particleScale / 270f, 2, false); + Particle orb = new GenericBloom(GunTipPosition, Projectile.velocity, Color.Lime, particleScale / 270f, 2, false); GeneralParticleHandler.SpawnParticle(orb); - Particle orb2 = new GenericBloom(tipPosition, Projectile.velocity, Color.White, particleScale / 400f, 2, false); + Particle orb2 = new GenericBloom(GunTipPosition, Projectile.velocity, Color.White, particleScale / 400f, 2, false); GeneralParticleHandler.SpawnParticle(orb2); float strength = particleScale / 45f; Vector3 DustLight = new Vector3(0.000f, 0.255f, 0.000f); - Lighting.AddLight(tipPosition, DustLight * strength); + Lighting.AddLight(GunTipPosition, DustLight * strength); } // Full charge dusts @@ -196,7 +179,7 @@ namespace CalamityMod.Projectiles.Ranged { for (int i = 0; i < 36; i++) { - Dust chargefull = Dust.NewDustPerfect(tipPosition, 107); + Dust chargefull = Dust.NewDustPerfect(GunTipPosition, 107); chargefull.velocity = (MathHelper.TwoPi * i / 36f).ToRotationVector2() * 8f + Owner.velocity; chargefull.scale = Main.rand.NextFloat(1f, 1.3f); chargefull.noGravity = true; @@ -206,55 +189,38 @@ namespace CalamityMod.Projectiles.Ranged { for (int i = 0; i < 45; i++) { - Dust chargefull = Dust.NewDustPerfect(tipPosition, 107); + Dust chargefull = Dust.NewDustPerfect(GunTipPosition, 107); chargefull.velocity = (MathHelper.TwoPi * i / 36f).ToRotationVector2() * 12f + Owner.velocity; chargefull.scale = Main.rand.NextFloat(1.2f, 1.4f); chargefull.noGravity = true; } } } - UpdateProjectileHeldVariables(armPosition); - ManipulatePlayerVariables(); } - private void UpdateProjectileHeldVariables(Vector2 armPosition) - { - if (Main.myPlayer == Projectile.owner) - { - float interpolant = Utils.GetLerpValue(5f, 40f, Projectile.Distance(Main.MouseWorld), true); - Vector2 oldVelocity = Projectile.velocity; - Projectile.velocity = Vector2.Lerp(Projectile.velocity, Projectile.SafeDirectionTo(Main.MouseWorld), interpolant); - if (Projectile.velocity != oldVelocity) - { - Projectile.netSpam = 0; - Projectile.netUpdate = true; - } - } - Vector2 shootOffset = Projectile.velocity * MathHelper.Clamp(30f - ShootRecoilTimer, 0f, 30f) + new Vector2(0, 7); - Projectile.Center = armPosition + shootOffset; - Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f); - Projectile.spriteDirection = Projectile.direction; - - // Rumble (only while channeling) - float rumble = MathHelper.Clamp(CurrentChargingFrames, 0f, ArcNovaDiffuser.Charge2Frames); - if (OwnerCanShoot) - Projectile.position += Main.rand.NextVector2Circular(rumble / 70f, rumble / 70f); - } - - private void ManipulatePlayerVariables() - { - Owner.ChangeDir(Projectile.direction); - Owner.heldProj = Projectile.whoAmI; - Owner.itemTime = 2; - Owner.itemAnimation = 2; - Owner.itemRotation = (Projectile.velocity * Projectile.direction).ToRotation(); - } public override void OnKill(int timeLeft) { if (SoundEngine.TryGetActiveSound(NovaChargeSlot, out var ChargeSound)) ChargeSound?.Stop(); } - public override bool? CanDamage() => false; + public override bool PreDraw(ref Color lightColor) + { + Texture2D texture = TextureAssets.Projectile[Type].Value; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f); + Vector2 rotationPoint = texture.Size() * 0.5f; + SpriteEffects flipSprite = (Projectile.spriteDirection * Owner.gravDir == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + + if (!Owner.CantUseHoldout()) + { + float rumble = MathHelper.Clamp(CurrentChargingFrames, 0f, ArcNovaDiffuser.Charge2Frames); + drawPosition += Main.rand.NextVector2Circular(rumble / 70f, rumble / 70f); + } + + Main.EntitySpriteDraw(texture, drawPosition, null, Projectile.GetAlpha(lightColor), drawRotation, rotationPoint, Projectile.scale * Owner.gravDir, flipSprite); + + return false; + } } } diff --git a/Projectiles/Ranged/ArcherfishRing.cs b/Projectiles/Ranged/ArcherfishRing.cs index 113380a68f..5db6f1dd27 100644 --- a/Projectiles/Ranged/ArcherfishRing.cs +++ b/Projectiles/Ranged/ArcherfishRing.cs @@ -1,10 +1,10 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -58,7 +58,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; } - + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { //Audio feedback for hitting the ring @@ -69,7 +69,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Vector2 ringScale = Projectile.Size / tex.Size() * Projectile.scale; Color ringColor = Color.Lerp(Color.DodgerBlue, Color.Blue, Projectile.Opacity) * Projectile.Opacity * 1.2f; diff --git a/Projectiles/Ranged/ArcherfishShot.cs b/Projectiles/Ranged/ArcherfishShot.cs index 195078a5eb..7b82e11a0f 100644 --- a/Projectiles/Ranged/ArcherfishShot.cs +++ b/Projectiles/Ranged/ArcherfishShot.cs @@ -41,7 +41,7 @@ namespace CalamityMod.Projectiles.Ranged // Water trail for (int i = 0; i < 6; i++) { - Dust water = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, 211, 0f, 0f, 100); + Dust water = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.Wet, 0f, 0f, 100); water.noGravity = true; water.velocity = Projectile.velocity * 0.5f; } diff --git a/Projectiles/Ranged/ArcticArrowProj.cs b/Projectiles/Ranged/ArcticArrowProj.cs deleted file mode 100644 index 4b97875411..0000000000 --- a/Projectiles/Ranged/ArcticArrowProj.cs +++ /dev/null @@ -1,71 +0,0 @@ -using CalamityMod.Buffs.StatDebuffs; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Audio; - -namespace CalamityMod.Projectiles.Ranged -{ - public class ArcticArrowProj : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Ranged"; - public override string Texture => "CalamityMod/Items/Ammo/ArcticArrow"; - - public override void SetDefaults() - { - Projectile.width = 10; - Projectile.height = 10; - Projectile.friendly = true; - Projectile.DamageType = DamageClass.Ranged; - Projectile.arrow = true; - Projectile.penetrate = 1; - Projectile.timeLeft = 600; - Projectile.aiStyle = ProjAIStyleID.Arrow; - Projectile.coldDamage = true; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; - } - - public override void AI() - { - Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; - if (Main.rand.NextBool(5)) - { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 67, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); - } - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); - SoundEngine.PlaySound(SoundID.Dig, Projectile.position); - return true; - } - - public override void OnKill(int timeLeft) - { - SoundEngine.PlaySound(SoundID.Item27, Projectile.position); - Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); - Projectile.width = 20; - Projectile.height = 20; - Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); - for (int i = 0; i < 10; i++) - { - int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 67, 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 + (float)Main.rand.Next(10) * 0.1f; - } - } - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 30); - } - } -} diff --git a/Projectiles/Ranged/AstralCannonProjectile.cs b/Projectiles/Ranged/AstralCannonProjectile.cs index 78acadcba9..2be0ef7466 100644 --- a/Projectiles/Ranged/AstralCannonProjectile.cs +++ b/Projectiles/Ranged/AstralCannonProjectile.cs @@ -1,11 +1,11 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -63,7 +63,7 @@ namespace CalamityMod.Projectiles.Ranged else { Projectile.spriteDirection = 1; - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X); + Projectile.rotation = Projectile.velocity.ToRotation(); } Lighting.AddLight(Projectile.Center, 0.3f, 0.5f, 0.1f); Projectile.velocity *= 1.075f; @@ -94,14 +94,14 @@ namespace CalamityMod.Projectiles.Ranged SoundEngine.PlaySound(SoundID.Zombie103, Projectile.Center); for (int i = 0; i < 2; i++) { - Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 50, default, 1f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 50, default, 1f); } for (int j = 0; j < 20; j++) { - int orangeDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 0, default, 1.5f); + int orangeDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 0, default, 1.5f); Main.dust[orangeDust].noGravity = true; Main.dust[orangeDust].velocity *= 3f; - orangeDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 50, default, 1f); + orangeDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 50, default, 1f); Main.dust[orangeDust].velocity *= 2f; Main.dust[orangeDust].noGravity = true; } diff --git a/Projectiles/Ranged/AstralRound.cs b/Projectiles/Ranged/AstralRound.cs index 086e3cebcf..6844252aed 100644 --- a/Projectiles/Ranged/AstralRound.cs +++ b/Projectiles/Ranged/AstralRound.cs @@ -2,9 +2,9 @@ using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { public class AstralRound : ModProjectile, ILocalizedModType diff --git a/Projectiles/Ranged/AstralSandgun.cs b/Projectiles/Ranged/AstralSandgun.cs index 1558ce263d..dd09fb1abf 100644 --- a/Projectiles/Ranged/AstralSandgun.cs +++ b/Projectiles/Ranged/AstralSandgun.cs @@ -1,6 +1,5 @@ -using CalamityMod.Tiles.AstralDesert; -using System; - +using System; +using CalamityMod.Tiles.AstralDesert; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -44,7 +43,7 @@ namespace CalamityMod.Projectiles.Ranged { if (Main.rand.NextBool()) { - int i = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 108, 0f, Projectile.velocity.Y * 0.5f); + int i = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RainCloud, 0f, Projectile.velocity.Y * 0.5f); Main.dust[i].velocity.X *= 0.2f; } Projectile.velocity.Y += 0.2f; diff --git a/Projectiles/Ranged/AstrealArrow.cs b/Projectiles/Ranged/AstrealArrow.cs index b576598227..0fe493e714 100644 --- a/Projectiles/Ranged/AstrealArrow.cs +++ b/Projectiles/Ranged/AstrealArrow.cs @@ -1,5 +1,5 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -32,7 +32,7 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; if (Projectile.localAI[0] == 0f) { @@ -79,7 +79,7 @@ namespace CalamityMod.Projectiles.Ranged } if (Main.rand.NextBool(5)) - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 173, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); Projectile.ai[1] += Main.rand.Next(2) + 1; if (Projectile.ai[1] >= 135f) @@ -103,7 +103,7 @@ namespace CalamityMod.Projectiles.Ranged { for (int k = 0; k < 5; k++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 173, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } diff --git a/Projectiles/Ranged/AstrealFlame.cs b/Projectiles/Ranged/AstrealFlame.cs index e51c266659..6f2f999565 100644 --- a/Projectiles/Ranged/AstrealFlame.cs +++ b/Projectiles/Ranged/AstrealFlame.cs @@ -1,8 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; -using Terraria.ModLoader; -using Terraria.ID; using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { @@ -55,7 +55,7 @@ namespace CalamityMod.Projectiles.Ranged SoundEngine.PlaySound(SoundID.Item74, Projectile.Center); for (int i = 0; i < 10; i++) { - int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 2f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, 0f, 0f, 100, default, 2f); Main.dust[dust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -65,10 +65,10 @@ namespace CalamityMod.Projectiles.Ranged } for (int j = 0; j < 15; j++) { - int dust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 3f); + int dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, 0f, 0f, 100, default, 3f); Main.dust[dust2].noGravity = true; Main.dust[dust2].velocity *= 5f; - dust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 2f); + dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, 0f, 0f, 100, default, 2f); Main.dust[dust2].velocity *= 2f; } } diff --git a/Projectiles/Ranged/AuralisBullet.cs b/Projectiles/Ranged/AuralisBullet.cs index c988aff258..9de76738f3 100644 --- a/Projectiles/Ranged/AuralisBullet.cs +++ b/Projectiles/Ranged/AuralisBullet.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Projectiles.Ranged { for (int d = 0; d < 5; d++) { - Dust dust = Main.dust[Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 229, Projectile.velocity.X, Projectile.velocity.Y, 100, CalamityUtils.ColorSwap(Auralis.blueColor, Auralis.greenColor, 1f), 1f)]; + Dust dust = Main.dust[Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Vortex, Projectile.velocity.X, Projectile.velocity.Y, 100, CalamityUtils.ColorSwap(Auralis.blueColor, Auralis.greenColor, 1f), 1f)]; dust.velocity = Vector2.Zero; dust.position -= Projectile.velocity / 5f * d; dust.noGravity = true; diff --git a/Projectiles/Ranged/AuricBullet.cs b/Projectiles/Ranged/AuricBullet.cs index d7244c4a6c..c67e285ea7 100644 --- a/Projectiles/Ranged/AuricBullet.cs +++ b/Projectiles/Ranged/AuricBullet.cs @@ -1,5 +1,5 @@ -using CalamityMod.Particles; -using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -76,7 +76,7 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(BuffID.Electrified, 300); - SoundEngine.PlaySound(HitSound with { PitchVariance = 0.15f}, Projectile.Center); + SoundEngine.PlaySound(HitSound with { PitchVariance = 0.15f }, Projectile.Center); GenericSparkle sparker = new GenericSparkle(Projectile.Center, Vector2.Zero, Color.Gold, Color.Cyan, Main.rand.NextFloat(1.8f, 2.5f), 5, Main.rand.NextFloat(-0.01f, 0.01f), 1.68f); GeneralParticleHandler.SpawnParticle(sparker); diff --git a/Projectiles/Ranged/AuroraFire.cs b/Projectiles/Ranged/AuroraFire.cs index 03b7dec8d9..a27d9a4205 100644 --- a/Projectiles/Ranged/AuroraFire.cs +++ b/Projectiles/Ranged/AuroraFire.cs @@ -14,8 +14,8 @@ namespace CalamityMod.Projectiles.Ranged public new string LocalizationCategory => "Projectiles.Ranged"; public override string Texture => "CalamityMod/Projectiles/Magic/RancorFog"; - public static int Lifetime => 450; - public static int Fadetime => 420; + public static int Lifetime => 480; + public static int Fadetime => 450; public ref float Time => ref Projectile.ai[0]; public ref float LightPower => ref Projectile.ai[1]; @@ -35,10 +35,10 @@ namespace CalamityMod.Projectiles.Ranged Projectile.tileCollide = false; Projectile.DamageType = DamageClass.Ranged; Projectile.penetrate = -1; - Projectile.MaxUpdates = 3; + Projectile.MaxUpdates = 4; Projectile.timeLeft = Lifetime; Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 7; + Projectile.idStaticNPCHitCooldown = 8; } public override void AI() @@ -113,7 +113,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { Main.spriteBatch.SetBlendState(BlendState.Additive); - Texture2D fog = ModContent.Request(Texture).Value; + Texture2D fog = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Vector2 drawPosition = Projectile.Center - Main.screenPosition; float opacity = Utils.GetLerpValue(0f, 0.08f, LightPower, true) * Projectile.Opacity * 0.3f; Main.EntitySpriteDraw(fog, drawPosition, null, OrangeFogColor * opacity, Projectile.rotation + OrangeFogRot, fog.Size() * 0.5f, Projectile.scale * OrangeFogScale, SpriteEffects.None); diff --git a/Projectiles/Ranged/BallistaGreatArrow.cs b/Projectiles/Ranged/BallistaGreatArrow.cs index 8569eb8227..1f11dc004b 100644 --- a/Projectiles/Ranged/BallistaGreatArrow.cs +++ b/Projectiles/Ranged/BallistaGreatArrow.cs @@ -1,10 +1,10 @@ -using CalamityMod.Buffs.StatDebuffs; +using System; +using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { public class BallistaGreatArrow : ModProjectile, ILocalizedModType diff --git a/Projectiles/Ranged/BarinadeArrow.cs b/Projectiles/Ranged/BarinadeArrow.cs index 6a02e9a23d..3b663a244f 100644 --- a/Projectiles/Ranged/BarinadeArrow.cs +++ b/Projectiles/Ranged/BarinadeArrow.cs @@ -1,10 +1,10 @@ -using Microsoft.Xna.Framework; -using System; -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; -using Terraria.Audio; +using System; using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { @@ -36,7 +36,7 @@ namespace CalamityMod.Projectiles.Ranged Vector3 DustLight = new Vector3(0.171f, 0.124f, 0.086f); Lighting.AddLight(Projectile.Center, DustLight * 3); - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; if (Projectile.timeLeft == 300) { diff --git a/Projectiles/Ranged/BeeRPG.cs b/Projectiles/Ranged/BeeRPG.cs index 19fa84d005..29c5cde66e 100644 --- a/Projectiles/Ranged/BeeRPG.cs +++ b/Projectiles/Ranged/BeeRPG.cs @@ -1,11 +1,11 @@ -using CalamityMod.Buffs.DamageOverTime; -using Microsoft.Xna.Framework; -using System; +using System; using System.Collections.Generic; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using Terraria; -using Terraria.ModLoader; -using Terraria.ID; using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { @@ -37,11 +37,11 @@ namespace CalamityMod.Projectiles.Ranged halfX = Projectile.velocity.X * 0.5f; halfY = Projectile.velocity.Y * 0.5f; } - int dusty = Dust.NewDust(new Vector2(Projectile.position.X + 3f + halfX, Projectile.position.Y + 3f + halfY) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 6, 0f, 0f, 100, default, 1f); + int dusty = Dust.NewDust(new Vector2(Projectile.position.X + 3f + halfX, Projectile.position.Y + 3f + halfY) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, DustID.Torch, 0f, 0f, 100, default, 1f); Main.dust[dusty].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; Main.dust[dusty].velocity *= 0.2f; Main.dust[dusty].noGravity = true; - dusty = Dust.NewDust(new Vector2(Projectile.position.X + 3f + halfX, Projectile.position.Y + 3f + halfY) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 31, 0f, 0f, 100, default, 0.5f); + dusty = Dust.NewDust(new Vector2(Projectile.position.X + 3f + halfX, Projectile.position.Y + 3f + halfY) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, DustID.Smoke, 0f, 0f, 100, default, 0.5f); Main.dust[dusty].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; Main.dust[dusty].velocity *= 0.05f; } @@ -52,13 +52,13 @@ namespace CalamityMod.Projectiles.Ranged } else if (Main.rand.NextBool()) { - int dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 31, 0f, 0f, 100, default, 1f); + int dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Smoke, 0f, 0f, 100, default, 1f); Main.dust[dust2].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f; Main.dust[dust2].fadeIn = 1.5f + (float)Main.rand.Next(5) * 0.1f; Main.dust[dust2].noGravity = true; Main.dust[dust2].position = Projectile.Center + new Vector2(0f, (float)(-(float)Projectile.height / 2)).RotatedBy((double)Projectile.rotation, default) * 1.1f; Main.rand.Next(2); - dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 1f); + dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 1f); Main.dust[dust2].scale = 1f + (float)Main.rand.Next(5) * 0.1f; Main.dust[dust2].noGravity = true; Main.dust[dust2].position = Projectile.Center + new Vector2(0f, (float)(-(float)Projectile.height / 2 - 6)).RotatedBy((double)Projectile.rotation, default) * 1.1f; @@ -117,7 +117,7 @@ namespace CalamityMod.Projectiles.Ranged SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); for (int i = 0; i < 5; i++) { - int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 31, 0f, 0f, 100, default, 2f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Smoke, 0f, 0f, 100, default, 2f); Main.dust[dust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -127,10 +127,10 @@ namespace CalamityMod.Projectiles.Ranged } for (int j = 0; j < 10; j++) { - int dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 3f); + int dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 3f); Main.dust[dust2].noGravity = true; Main.dust[dust2].velocity *= 5f; - dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 2f); + dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 2f); Main.dust[dust2].velocity *= 2f; } diff --git a/Projectiles/Ranged/BigCoral.cs b/Projectiles/Ranged/BigCoral.cs index e9594f0189..0971849fd6 100644 --- a/Projectiles/Ranged/BigCoral.cs +++ b/Projectiles/Ranged/BigCoral.cs @@ -1,9 +1,9 @@ -using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using Terraria; -using Terraria.ModLoader; -using Terraria.ID; using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { @@ -41,7 +41,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int i = 0; i < 10; i++) { - int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 51, Projectile.oldVelocity.X / 4, Projectile.oldVelocity.Y / 4, 0, new Color(234, 183, 100), 1.5f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.SnowBlock, Projectile.oldVelocity.X / 4, Projectile.oldVelocity.Y / 4, 0, new Color(234, 183, 100), 1.5f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 3f; } diff --git a/Projectiles/Ranged/BigNuke.cs b/Projectiles/Ranged/BigNuke.cs deleted file mode 100644 index fc35291fbd..0000000000 --- a/Projectiles/Ranged/BigNuke.cs +++ /dev/null @@ -1,191 +0,0 @@ -using Microsoft.Xna.Framework; -using System.Collections.Generic; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Audio; - -namespace CalamityMod.Projectiles.Ranged -{ - public class BigNuke : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Ranged"; - private ref float RocketType => ref Projectile.ai[0]; - - public override void SetStaticDefaults() - { - Main.projFrames[Projectile.type] = 4; - } - - public override void SetDefaults() - { - Projectile.width = Projectile.height = 16; - Projectile.friendly = true; - Projectile.penetrate = 1; - Projectile.timeLeft = 95; - Projectile.DamageType = DamageClass.Ranged; - } - - public override void AI() - { - Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.ToRadians(90); - - //Animation - Projectile.frameCounter++; - if (Projectile.frameCounter > 7) - { - Projectile.frame++; - Projectile.frameCounter = 0; - } - if (Projectile.frame >= Main.projFrames[Projectile.type]) - { - Projectile.frame = 0; - } - - if (Projectile.velocity.Length() >= 8f) - { - for (int i = 0; i < 2; i++) - { - float halfX = 0f; - float halfY = 0f; - if (i == 1) - { - halfX = Projectile.velocity.X * 0.5f; - halfY = Projectile.velocity.Y * 0.5f; - } - int dusty = Dust.NewDust(new Vector2(Projectile.position.X + 3f + halfX, Projectile.position.Y + 3f + halfY) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 6, 0f, 0f, 100, default, 1f); - Main.dust[dusty].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; - Main.dust[dusty].velocity *= 0.2f; - Main.dust[dusty].noGravity = true; - dusty = Dust.NewDust(new Vector2(Projectile.position.X + 3f + halfX, Projectile.position.Y + 3f + halfY) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 31, 0f, 0f, 100, default, 0.5f); - Main.dust[dusty].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[dusty].velocity *= 0.05f; - } - } - CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 200f, 12f, 20f); - - if (RocketType == ItemID.DryRocket || RocketType == ItemID.WetRocket || RocketType == ItemID.LavaRocket || RocketType == ItemID.HoneyRocket) - { - if (Projectile.wet) - Projectile.timeLeft = 1; - } - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); - SoundEngine.PlaySound(SoundID.Dig, Projectile.position); - return true; - } - - public override void OnKill(int timeLeft) - { - Projectile.ExpandHitboxBy(720); - Projectile.maxPenetrate = -1; - Projectile.penetrate = -1; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; - Projectile.Damage(); - SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); - for (int i = 0; i < 90; i++) - { - int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 31, 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 + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int j = 0; j < 180; j++) - { - int dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 3f); - Main.dust[dust2].noGravity = true; - Main.dust[dust2].velocity *= 5f; - dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 2f); - Main.dust[dust2].velocity *= 2f; - } - - if (Main.netMode != NetmodeID.Server) - { - Vector2 goreSource = Projectile.Center; - int goreAmt = 9; - Vector2 source = new Vector2(goreSource.X - 24f, goreSource.Y - 24f); - for (int goreIndex = 0; goreIndex < goreAmt; goreIndex++) - { - float velocityMult = 0.33f; - if (goreIndex < (goreAmt / 3)) - { - velocityMult = 0.66f; - } - if (goreIndex >= (2 * goreAmt / 3)) - { - velocityMult = 1f; - } - Mod mod = ModContent.GetInstance(); - int type = Main.rand.Next(61, 64); - int smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); - Gore gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X += 1f; - gore.velocity.Y += 1f; - type = Main.rand.Next(61, 64); - smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); - gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X -= 1f; - gore.velocity.Y += 1f; - type = Main.rand.Next(61, 64); - smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); - gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X += 1f; - gore.velocity.Y -= 1f; - type = Main.rand.Next(61, 64); - smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); - gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X -= 1f; - gore.velocity.Y -= 1f; - } - } - - // Only do rocket effects for the owner client side - if (Projectile.owner != Main.myPlayer) - return; - - int blastRadius = 0; - if (RocketType == ItemID.RocketII) - blastRadius = 17; - else if (RocketType == ItemID.RocketIV) - blastRadius = 20; - else if (RocketType == ItemID.MiniNukeII) - blastRadius = 23; - Projectile.ExpandHitboxBy(16); - - if (blastRadius > 0) - Projectile.ExplodeTiles(blastRadius); - - Point center = Projectile.Center.ToTileCoordinates(); - DelegateMethods.v2_1 = center.ToVector2(); - DelegateMethods.f_1 = 5f; - if (RocketType == ItemID.DryRocket) - { - DelegateMethods.f_1 = 5.5f; - Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadDry); - } - else if (RocketType == ItemID.WetRocket) - { - Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadWater); - } - else if (RocketType == ItemID.LavaRocket) - { - Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadLava); - } - else if (RocketType == ItemID.HoneyRocket) - { - Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadHoney); - } - } - } -} diff --git a/Projectiles/Ranged/BlightFlames.cs b/Projectiles/Ranged/BlightFlames.cs index 09eab2ce60..d56935e430 100644 --- a/Projectiles/Ranged/BlightFlames.cs +++ b/Projectiles/Ranged/BlightFlames.cs @@ -164,7 +164,7 @@ namespace CalamityMod.Projectiles.Ranged { Main.spriteBatch.SetBlendState(BlendState.Additive); - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Vector2 drawPosition = Projectile.Center - Main.screenPosition; float opacity = Utils.GetLerpValue(0f, 0.08f, LightPower, true) * Projectile.Opacity * 0.65f; Color drawColor = FogColor * opacity; diff --git a/Projectiles/Ranged/BlissfulBombardierDustProjectile.cs b/Projectiles/Ranged/BlissfulBombardierDustProjectile.cs index bb7d5149be..c153a7acbc 100644 --- a/Projectiles/Ranged/BlissfulBombardierDustProjectile.cs +++ b/Projectiles/Ranged/BlissfulBombardierDustProjectile.cs @@ -1,8 +1,10 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Typeless { public class BlissfulBombardierDustProjectile : ModProjectile, ILocalizedModType @@ -19,6 +21,8 @@ namespace CalamityMod.Projectiles.Typeless Projectile.ignoreWater = true; Projectile.tileCollide = false; Projectile.penetrate = -1; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 15; } public override void AI() @@ -56,8 +60,7 @@ namespace CalamityMod.Projectiles.Typeless projTimer = 0f; Projectile.Kill(); } - projTimer *= 0.7f; - Projectile.ai[0] += 4f; + Projectile.ai[0] += (2f + Projectile.ai[1]); // Explosions spawned on hit last shorter int timerCounter = 0; while ((float)timerCounter < projTimer) { @@ -68,7 +71,7 @@ namespace CalamityMod.Projectiles.Typeless randAdjust = rand3 / randAdjust; rand1 *= randAdjust; rand2 *= randAdjust; - int dusty = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 1.5f); + int dusty = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 100, default, 1.5f); Dust dust = Main.dust[dusty]; dust.noGravity = true; dust.position.X = Projectile.Center.X; @@ -81,15 +84,8 @@ namespace CalamityMod.Projectiles.Typeless } } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.immune[Projectile.owner] = 0; - target.AddBuff(ModContent.BuffType(), 120); - } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 120); - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - target.AddBuff(ModContent.BuffType(), 120); - } + public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 120); } } diff --git a/Projectiles/Ranged/BloodBoilerFire.cs b/Projectiles/Ranged/BloodBoilerFire.cs index 0092de9a4b..52af9cd48f 100644 --- a/Projectiles/Ranged/BloodBoilerFire.cs +++ b/Projectiles/Ranged/BloodBoilerFire.cs @@ -22,6 +22,7 @@ namespace CalamityMod.Projectiles.Ranged public bool improvedHeal = false; public bool setHomingVelocity = false; public float HomingVelocity = 0.18f; + public override void SetDefaults() { Projectile.width = 43; @@ -36,6 +37,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.localNPCHitCooldown = -1; Projectile.timeLeft = 300; } + public override void AI() { if (Projectile.timeLeft > 220) // Main visual size changes @@ -52,10 +54,11 @@ namespace CalamityMod.Projectiles.Ranged Color bloodColor = Main.rand.NextBool() ? Color.Firebrick : Color.Red; float randomSpeedMultiplier = Main.rand.NextFloat(0.8f, 1.55f); - Vector2 bloodVelocity = Projectile.velocity.RotatedByRandom(0.5) * randomSpeedMultiplier + new Vector2 (0, -3); + Vector2 bloodVelocity = Projectile.velocity.RotatedByRandom(0.5) * randomSpeedMultiplier + new Vector2(0, -3); BloodParticle blood = new BloodParticle(Projectile.Center, bloodVelocity, bloodLifetime, bloodScale, bloodColor); GeneralParticleHandler.SpawnParticle(blood); } + if (Projectile.timeLeft < 296) // The main visual of the projectile and the blood mist it produces before turning around { BloodBoilerMetaball2.SpawnParticle(Projectile.Center, particleSize * 2.3f); @@ -71,7 +74,7 @@ namespace CalamityMod.Projectiles.Ranged GeneralParticleHandler.SpawnParticle(smoke); } } - + if (Projectile.ai[1] == 0f) // Blood pulses on the projectile before it turns around { if (Main.rand.NextBool(9)) @@ -80,6 +83,7 @@ namespace CalamityMod.Projectiles.Ranged GeneralParticleHandler.SpawnParticle(pulse); } } + if (!playedSound) { SoundEngine.PlaySound(SoundID.Item34, Projectile.position); @@ -91,8 +95,10 @@ namespace CalamityMod.Projectiles.Ranged // A bunch of small things mostly for visuals when the projectile starts turning around before it homes on the player if (Projectile.timeLeft == 235) bloodCloudReturn = Projectile.velocity; + if (Projectile.timeLeft <= 235 && Projectile.ai[1] == 0f) Projectile.velocity *= 0.98f; + if (Projectile.timeLeft == 220) { Projectile.velocity = -bloodCloudReturn.RotatedBy(Projectile.ai[2] == 5 ? -0.7f : 0.7f) * 1.2f; @@ -106,6 +112,7 @@ namespace CalamityMod.Projectiles.Ranged dust2.scale = Main.rand.NextFloat(1.2f, 2f); } } + if (Projectile.timeLeft == 209) // Begin returning to player { Projectile.ai[1] = 1f; @@ -118,6 +125,7 @@ namespace CalamityMod.Projectiles.Ranged HomingVelocity = Main.rand.NextFloat(0.29f, 0.32f); setHomingVelocity = true; } + Projectile.extraUpdates = 5; bool dustEffect = Main.rand.NextBool(3) ? false : true; int dustColor = dustEffect ? 296 : 60; @@ -167,19 +175,33 @@ namespace CalamityMod.Projectiles.Ranged if (Projectile.velocity.Y > 0f && yDist < 0f) Projectile.velocity.Y -= HomingVelocity; } + if (Projectile.timeLeft == 5) // Absolutely make sure the player gets the chance to heal Projectile.Center = playerCenter; + // Delete the projectile if it touches its owner. Has a chance to heal the player again if (Main.myPlayer == Projectile.owner) { if (Projectile.Hitbox.Intersects(player.Hitbox)) { - if (Main.rand.NextBool(4) && !Main.player[Projectile.owner].moonLeech) + if (!Main.player[Projectile.owner].moonLeech) { - int bonusHeal = Main.rand.NextBool(3) ? 3 : 2; - player.statLife += improvedHeal ? bonusHeal : 1; - player.HealEffect(improvedHeal ? bonusHeal : 1); + int bonusHeal = Main.rand.NextBool(3) ? 6 : 4; + int heal = improvedHeal ? bonusHeal : 2; + + if (Main.player[Main.myPlayer].lifeSteal <= 0f) + { + Projectile.Kill(); + return; + } + + Main.player[Main.myPlayer].lifeSteal -= heal; + player.statLife += heal; + player.HealEffect(heal); + if (Main.player[Projectile.owner].statLife > Main.player[Projectile.owner].statLifeMax2) + Main.player[Projectile.owner].statLife = Main.player[Projectile.owner].statLifeMax2; } + Projectile.Kill(); } } @@ -191,6 +213,7 @@ namespace CalamityMod.Projectiles.Ranged target.AddBuff(ModContent.BuffType(), 600); improvedHeal = true; } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { if (Projectile.numHits > 0) diff --git a/Projectiles/Ranged/BloodClotFriendly.cs b/Projectiles/Ranged/BloodClotFriendly.cs index dea29f8651..82c8855ae5 100644 --- a/Projectiles/Ranged/BloodClotFriendly.cs +++ b/Projectiles/Ranged/BloodClotFriendly.cs @@ -1,9 +1,9 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using CalamityMod.Buffs.DamageOverTime; namespace CalamityMod.Projectiles.Ranged { @@ -37,7 +37,7 @@ namespace CalamityMod.Projectiles.Ranged for (int i = 0; i < 2; i++) { Vector2 dspeed = -Projectile.velocity * 0.7f; - int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 5, dspeed.X, dspeed.Y, 100, default, 2f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Blood, dspeed.X, dspeed.Y, 100, default, 2f); Main.dust[dust].noGravity = true; } } diff --git a/Projectiles/Ranged/BloodfireArrowProj.cs b/Projectiles/Ranged/BloodfireArrowProj.cs index 75e2311ff5..822774e748 100644 --- a/Projectiles/Ranged/BloodfireArrowProj.cs +++ b/Projectiles/Ranged/BloodfireArrowProj.cs @@ -1,10 +1,13 @@ using System; +using CalamityMod.Balancing; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -13,6 +16,7 @@ namespace CalamityMod.Projectiles.Ranged public class BloodfireArrowProj : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Ranged"; + public override string Texture => "CalamityMod/Items/Ammo/BloodfireArrow"; public override void SetStaticDefaults() @@ -23,80 +27,94 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - Projectile.width = 10; - Projectile.height = 10; + Projectile.width = 20; + Projectile.height = 20; Projectile.friendly = true; Projectile.DamageType = DamageClass.Ranged; Projectile.arrow = true; Projectile.penetrate = 1; - Projectile.timeLeft = 300; + Projectile.extraUpdates = 6; + Projectile.timeLeft = 1200; Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } - public override bool OnTileCollide(Vector2 oldVelocity) - { - Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); - SoundEngine.PlaySound(SoundID.Dig, Projectile.position); - return true; - } - public override void AI() { - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) - MathHelper.ToRadians(90); + Player player = Main.player[Projectile.owner]; + Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; + Projectile.spriteDirection = Projectile.direction; - if (Projectile.timeLeft % 15 == 0) + if (Projectile.localAI[0] == 0) { - for (int l = 0; l < 12; l++) + player.statLife -= Main.player[Main.myPlayer].lifeSteal <= 0f ? 0 : 1; + if (player.statLife <= 0) { - Vector2 rotate = Vector2.UnitX * (float)-(float)Projectile.width / 2f; - rotate += -Vector2.UnitY.RotatedBy((double)((float)l * 3.14159274f / 6f), default) * new Vector2(8f, 16f); - rotate = rotate.RotatedBy((double)(Projectile.rotation - 1.57079637f), default); - int bloodDust = Dust.NewDust(Projectile.Center, 0, 0, (int)CalamityDusts.Brimstone, 0f, 0f, 160, default, 1f); - Main.dust[bloodDust].scale = 1.1f; - Main.dust[bloodDust].noGravity = true; - Main.dust[bloodDust].position = Projectile.Center + rotate; - Main.dust[bloodDust].velocity = Projectile.velocity * 0.1f; - Main.dust[bloodDust].velocity = Vector2.Normalize(Projectile.Center - Projectile.velocity * 3f - Main.dust[bloodDust].position) * 1.25f; + PlayerDeathReason pdr = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.BloodFireArrow" + Main.rand.Next(1, 2 + 1)).Format(player.name)); + player.KillMe(pdr, 1000.0, 0, false); } + Projectile.velocity *= 0.4f; + } + + Player Owner = Main.player[Projectile.owner]; + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); + + // Lighting + Lighting.AddLight(Projectile.Center, Color.Red.ToVector3() * 0.7f); + + // Dust + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 6f && targetDist < 1400f) + { + if (Main.rand.NextBool()) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(3) ? 130 : 60, -Projectile.velocity.RotatedByRandom(0.5f) * Main.rand.NextFloat(0.2f, 0.6f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.3f, 0.7f); + if (dust.type == 130) + dust.scale = Main.rand.NextFloat(0.25f, 0.45f); + } + PointParticle spark = new PointParticle(Projectile.Center - Projectile.velocity, -Projectile.velocity * 0.01f, false, 2, 1.2f, Color.Firebrick); + GeneralParticleHandler.SpawnParticle(spark); } } public override void OnKill(int timeLeft) { - Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); - Projectile.width = 20; - Projectile.height = 20; - Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); - for (int i = 0; i < 5; i++) + for (int b = 0; b < 9; b++) { - int brimDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); - Main.dust[brimDust].velocity *= 0.5f; - if (Main.rand.NextBool()) - { - Main.dust[brimDust].scale = 0.5f; - Main.dust[brimDust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } + int dustType = Main.rand.NextBool() ? 303 : 90; + float velMulti = Main.rand.NextFloat(0.1f, 0.75f); + Dust dust = Dust.NewDustPerfect(Projectile.Center, dustType, new Vector2(4, 4).RotatedByRandom(100) * velMulti); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.75f, 1.35f); + if (dust.type == 303) + dust.color = Color.Firebrick; } } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - if (!target.canGhostHeal || Main.player[Projectile.owner].moonLeech) + Player player = Main.player[Projectile.owner]; + player.lifeRegenTime += 2; + + if (player.moonLeech) return; - Player player = Main.player[Projectile.owner]; + if (Main.player[Main.myPlayer].lifeSteal <= 0f || target.lifeMax <= 5) + return; - int chance = 3; - if (player.ActiveItem().type == ModContent.ItemType()) - chance = 6; + float lifeRatio = (float)player.statLife / player.statLifeMax2; + float averageHealAmount = MathHelper.Lerp(4.0f, 0.5f, lifeRatio); // Average heal increases from 1/2 to 4 HP based on missing health + int guaranteedHeal = (int)averageHealAmount; - if (Main.rand.NextBool(chance)) - { - player.statLife += 1; - player.HealEffect(1); - } + float chanceOfOneMoreHP = averageHealAmount - guaranteedHeal; + bool bonusHeal = Main.rand.NextFloat() < chanceOfOneMoreHP; + int finalHeal = guaranteedHeal + (bonusHeal ? 1 : 0); + if (finalHeal > BalancingConstants.LifeStealCap) + finalHeal = BalancingConstants.LifeStealCap; + + if (finalHeal > 0) + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], finalHeal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); } public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Ranged/BloodfireBulletProj.cs b/Projectiles/Ranged/BloodfireBulletProj.cs index 78e7229a52..e4373bbc82 100644 --- a/Projectiles/Ranged/BloodfireBulletProj.cs +++ b/Projectiles/Ranged/BloodfireBulletProj.cs @@ -1,64 +1,79 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { public class BloodfireBulletProj : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Ranged"; - private const int Lifetime = 600; + private const int Lifetime = 1200; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; } public override void SetDefaults() { - Projectile.width = 4; - Projectile.height = 4; + Projectile.width = 6; + Projectile.height = 6; Projectile.friendly = true; Projectile.DamageType = DamageClass.Ranged; - Projectile.extraUpdates = 4; + Projectile.extraUpdates = 12; Projectile.timeLeft = Lifetime; Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; + Projectile.tileCollide = false; } public override void AI() { + Projectile.scale = 0.75f; Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; Projectile.spriteDirection = Projectile.direction; + if (Projectile.localAI[0] == 0) + { + Projectile.velocity *= 0.7f; + } + Player Owner = Main.player[Projectile.owner]; + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); // Lighting - Lighting.AddLight(Projectile.Center, 0.9f, 0f, 0.15f); + Lighting.AddLight(Projectile.Center, Color.Red.ToVector3() * 0.5f); // Dust Projectile.localAI[0] += 1f; - if (Projectile.localAI[0] > 4f) + if (Projectile.localAI[0] > 6f) { - int dustID = 90; - float scale = Main.rand.NextFloat(0.6f, 0.9f); - Dust d = Dust.NewDustDirect(Projectile.Center, 0, 0, dustID); - Vector2 posOffset = Projectile.velocity.SafeNormalize(Vector2.Zero) * 12f; - d.position += posOffset - 2f * Vector2.UnitY; - d.noGravity = true; - d.velocity *= 0.6f; - d.velocity += Projectile.velocity * 0.15f; - d.scale = scale; + if (Main.rand.NextBool(3)) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(3) ? 130 : 60, -Projectile.velocity.RotatedByRandom(0.1f) * Main.rand.NextFloat(0.01f, 0.3f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.5f, 0.9f); + if (dust.type == 130) + dust.scale = Main.rand.NextFloat(0.35f, 0.55f); + } + if (targetDist < 1400f) + { + SparkParticle spark = new SparkParticle(Projectile.Center - Projectile.velocity, -Projectile.velocity * 0.01f, false, 4, 0.4f, Color.Firebrick); + GeneralParticleHandler.SpawnParticle(spark); + } } } // These bullets glow in the dark. - public override Color? GetAlpha(Color lightColor) => new Color(255, 255, 255, 140); + public override Color? GetAlpha(Color lightColor) => new Color(255, 255, 255, 100); public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesFromEdge(Projectile, 0, lightColor); - return false; + if (Projectile.localAI[0] > 6f) + { + CalamityUtils.DrawAfterimagesFromEdge(Projectile, 0, Color.Red); + } + return true; } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) => modifiers.SourceDamage.Flat += OnHitEffect(Main.player[Projectile.owner]); @@ -69,31 +84,47 @@ namespace CalamityMod.Projectiles.Ranged // Adds 2 frames to lifeRegenTime on every hit. This increased value is used for the damage calculation. owner.lifeRegenTime += 2; - // Deals (1.00 + (0.05 * current lifeRegen))% of current lifeRegenTime as flat bonus damage on hit. + // Deals (1.00 + (0.1 * current lifeRegen))% of current lifeRegenTime as flat bonus damage on hit. // For example, at 0 life regen, you get 1% of lifeRegenTime as bonus damage. // At 10 life regen, you get 2%. At 20 life regen, you get 3%. // Negative life regen does not decrease damage. int regenForCalc = owner.lifeRegen > 0 ? owner.lifeRegen : 0; - float regenDamageRatio = 0.01f + 0.0005f * regenForCalc; + float regenDamageRatio = (1f + 0.1f * regenForCalc) / 100f; - // For the sake of bonus damage, life regen time caps at 3600, aka 60 seconds. This is its natural cap in vanilla. - int regenTimeForCalc = (int)MathHelper.Clamp(owner.lifeRegenTime, 0f, 3600f); - return (int)(regenDamageRatio * regenTimeForCalc); + // For the sake of bonus damage, life regen time caps at 3600, aka 60 seconds. This is its natural cap in vanilla. This then gets divided by 2 for computing final damage. + int regenTimeForCalc = (int)MathHelper.Clamp(owner.lifeRegenTime, 0f, 3600f) / 2; + + int finalDamageBoost = (int)(regenDamageRatio * regenTimeForCalc); + // Damage boost has a cap of 25 to prevent it from getting too crazy. + if (finalDamageBoost > 25) + finalDamageBoost = 25; + + if (finalDamageBoost == 25) // Special hit visual if youre at max bonus damage + { + for (int k = 0; k < 3; k++) + { + BloodParticle blood = new BloodParticle(Projectile.Center, new Vector2(6.5f, 6.5f).RotatedByRandom(100) * Main.rand.NextFloat(0.8f, 1.2f), Main.rand.Next(8, 10 + 1), Main.rand.NextFloat(0.7f, 0.9f), Color.Red); + GeneralParticleHandler.SpawnParticle(blood); + } + } + return finalDamageBoost; } public override void OnKill(int timeLeft) { - int dustID = 90; - int dustCount = 3; - for (int i = 0; i < dustCount; ++i) - Dust.NewDust(Projectile.Center, 0, 0, dustID, Scale: 1.2f); - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); - SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); - return true; + for (int k = 0; k < 3; k++) + { + SparkParticle spark = new SparkParticle(Projectile.Center, -Projectile.velocity.RotatedByRandom(0.5) * Main.rand.NextFloat(1f, 3f), false, Main.rand.Next(5, 7 + 1), Main.rand.NextFloat(0.4f, 0.6f), Color.Red); + GeneralParticleHandler.SpawnParticle(spark); + } + for (int k = 0; k < 8; k++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(3) ? 130 : 60, new Vector2(3, 3).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1.5f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.5f, 0.9f); + if (dust.type == 130) + dust.scale = Main.rand.NextFloat(0.35f, 0.55f); + } } } } diff --git a/Projectiles/Ranged/BloodflareSoul.cs b/Projectiles/Ranged/BloodflareSoul.cs index 4d4bf282de..14cabced7a 100644 --- a/Projectiles/Ranged/BloodflareSoul.cs +++ b/Projectiles/Ranged/BloodflareSoul.cs @@ -1,9 +1,9 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.Ranged { Projectile.frame = 0; } - int redDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 60, 0f, 0f, 0, default, 1f); + int redDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RedTorch, 0f, 0f, 0, default, 1f); Dust dust = Main.dust[redDust]; dust.velocity *= 0.1f; Main.dust[redDust].scale = 1.3f; @@ -101,7 +101,7 @@ namespace CalamityMod.Projectiles.Ranged Vector2 rotate = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; rotate = rotate.RotatedBy((double)((float)(i - (constant / 2 - 1)) * 6.28318548f / (float)constant), default) + Projectile.Center; Vector2 faceDirection = rotate - Projectile.Center; - int dust = Dust.NewDust(rotate + faceDirection, 0, 0, 60, faceDirection.X * 1.5f, faceDirection.Y * 1.5f, 100, default, 2f); + int dust = Dust.NewDust(rotate + faceDirection, 0, 0, DustID.RedTorch, faceDirection.X * 1.5f, faceDirection.Y * 1.5f, 100, default, 2f); Main.dust[dust].noGravity = true; Main.dust[dust].noLight = true; Main.dust[dust].velocity = faceDirection; diff --git a/Projectiles/Ranged/Bolt.cs b/Projectiles/Ranged/Bolt.cs index e228920f58..97bff2bfa2 100644 --- a/Projectiles/Ranged/Bolt.cs +++ b/Projectiles/Ranged/Bolt.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -38,7 +38,7 @@ namespace CalamityMod.Projectiles.Ranged Vector2 rotate = Vector2.UnitX * (float)-(float)Projectile.width / 2f; rotate += -Vector2.UnitY.RotatedBy((double)((float)l * 3.14159274f / 6f), default) * new Vector2(8f, 16f); rotate = rotate.RotatedBy((double)(Projectile.rotation - 1.57079637f), default); - int blueDust = Dust.NewDust(Projectile.Center, 0, 0, 221, 0f, 0f, 160, default, 1f); + int blueDust = Dust.NewDust(Projectile.Center, 0, 0, DustID.FireworkFountain_Blue, 0f, 0f, 160, default, 1f); Main.dust[blueDust].scale = 1.1f; Main.dust[blueDust].noGravity = true; Main.dust[blueDust].position = Projectile.Center + rotate; @@ -79,7 +79,7 @@ namespace CalamityMod.Projectiles.Ranged int rando = Main.rand.Next(4, 8); for (int i = 0; i < rando; i++) { - int dust = Dust.NewDust(Projectile.Center - Projectile.velocity / 2f, 0, 0, 135, 0f, 0f, 100, default, 2f); + int dust = Dust.NewDust(Projectile.Center - Projectile.velocity / 2f, 0, 0, DustID.IceTorch, 0f, 0f, 100, default, 2f); Main.dust[dust].velocity *= 2f; Main.dust[dust].noGravity = true; } diff --git a/Projectiles/Ranged/BoltArrow.cs b/Projectiles/Ranged/BoltArrow.cs index a9c313d4d6..69ea77610f 100644 --- a/Projectiles/Ranged/BoltArrow.cs +++ b/Projectiles/Ranged/BoltArrow.cs @@ -1,9 +1,9 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; -using Terraria.ModLoader; -using Terraria.ID; using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; Projectile.localAI[0] += 1f; if (Projectile.localAI[0] == 15f) { @@ -36,7 +36,7 @@ namespace CalamityMod.Projectiles.Ranged Vector2 rotate = Vector2.UnitX * (float)-(float)Projectile.width / 2f; rotate += -Vector2.UnitY.RotatedBy((double)((float)l * 3.14159274f / 6f), default) * new Vector2(8f, 16f); rotate = rotate.RotatedBy((double)(Projectile.rotation - 1.57079637f), default); - int blueDust = Dust.NewDust(Projectile.Center, 0, 0, 221, 0f, 0f, 160, default, 1f); + int blueDust = Dust.NewDust(Projectile.Center, 0, 0, DustID.FireworkFountain_Blue, 0f, 0f, 160, default, 1f); Main.dust[blueDust].scale = 1.1f; Main.dust[blueDust].noGravity = true; Main.dust[blueDust].position = Projectile.Center + rotate; @@ -69,7 +69,7 @@ namespace CalamityMod.Projectiles.Ranged int rando = Main.rand.Next(10, 20); for (int i = 0; i < rando; i++) { - int dust = Dust.NewDust(Projectile.Center - Projectile.velocity / 2f, 0, 0, 135, 0f, 0f, 100, default, 2f); + int dust = Dust.NewDust(Projectile.Center - Projectile.velocity / 2f, 0, 0, DustID.IceTorch, 0f, 0f, 100, default, 2f); Main.dust[dust].velocity *= 2f; Main.dust[dust].noGravity = true; } diff --git a/Projectiles/Ranged/BouncingShotgunPellet.cs b/Projectiles/Ranged/BouncingShotgunPellet.cs index dcb1caa35e..eb59268856 100644 --- a/Projectiles/Ranged/BouncingShotgunPellet.cs +++ b/Projectiles/Ranged/BouncingShotgunPellet.cs @@ -1,8 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { public class BouncingShotgunPellet : ModProjectile, ILocalizedModType @@ -54,10 +54,10 @@ namespace CalamityMod.Projectiles.Ranged } for (int d = 0; d < 20; d++) { - int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 0, default, 2.5f); + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 0, default, 2.5f); Main.dust[idx].noGravity = true; Main.dust[idx].velocity *= 3f; - idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 1.5f); + idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 1.5f); Main.dust[idx].velocity *= 2f; Main.dust[idx].noGravity = true; } diff --git a/Projectiles/Ranged/BrimstoneBolt.cs b/Projectiles/Ranged/BrimstoneBolt.cs index 83e6d99bff..70666e710f 100644 --- a/Projectiles/Ranged/BrimstoneBolt.cs +++ b/Projectiles/Ranged/BrimstoneBolt.cs @@ -2,9 +2,9 @@ using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Terraria; -using Terraria.ModLoader; -using Terraria.ID; using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { diff --git a/Projectiles/Ranged/BrimstoneFireFriendly.cs b/Projectiles/Ranged/BrimstoneFireFriendly.cs index 8271e32a81..60828b0eef 100644 --- a/Projectiles/Ranged/BrimstoneFireFriendly.cs +++ b/Projectiles/Ranged/BrimstoneFireFriendly.cs @@ -1,9 +1,9 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ModLoader; @@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool OnTileCollide(Vector2 oldVelocity) { Projectile.velocity = oldVelocity * 0.95f; - Projectile.position -= Projectile.velocity; + Projectile.position -= Projectile.velocity; Time++; Projectile.timeLeft--; return false; @@ -98,7 +98,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - Texture2D fire = ModContent.Request(Texture).Value; + Texture2D fire = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Texture2D mist = ModContent.Request("CalamityMod/Particles/MediumMist").Value; // The conga line of colors to sift through diff --git a/Projectiles/Ranged/BubonicRoundProj.cs b/Projectiles/Ranged/BubonicRoundProj.cs index ee35e71365..5c9a9c260d 100644 --- a/Projectiles/Ranged/BubonicRoundProj.cs +++ b/Projectiles/Ranged/BubonicRoundProj.cs @@ -1,9 +1,9 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -39,18 +39,20 @@ namespace CalamityMod.Projectiles.Ranged { if (Main.rand.NextBool()) { - int greenDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), 1, 1, 107, 0f, 0f, 0, default, 0.5f); - Main.dust[greenDust].alpha = Projectile.alpha; - Main.dust[greenDust].velocity *= 0f; - Main.dust[greenDust].noGravity = true; + Dust dust = Dust.NewDustPerfect(Projectile.Center, 303, -Projectile.velocity.RotatedByRandom(0.3f) * Main.rand.NextFloat(0.01f, 0.15f)); + dust.scale = Main.rand.NextFloat(0.7f, 0.85f); + dust.noGravity = true; + if (Main.rand.NextBool(3)) + dust.color = Color.LimeGreen; + else + dust.color = Color.Lime; } } } public override bool OnTileCollide(Vector2 oldVelocity) { - Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); - SoundEngine.PlaySound(SoundID.Dig, Projectile.position); + //Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); return true; } @@ -66,18 +68,27 @@ namespace CalamityMod.Projectiles.Ranged return new Color(1f, 1f, 1f, 0f); } - // Ignores 25% of armor - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) => modifiers.ScalingArmorPenetration += 0.25f; - public override void ModifyHitPlayer(Player target, ref Player.HurtModifiers modifiers) => modifiers.ScalingArmorPenetration += 0.25f; + // Ignores 10% of armor + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) => modifiers.ScalingArmorPenetration += 0.1f; + public override void ModifyHitPlayer(Player target, ref Player.HurtModifiers modifiers) => modifiers.ScalingArmorPenetration += 0.1f; - // Inflicts Plague for 3 seconds - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 180); + // Inflicts Plague for 0.75 seconds + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 60); public override void OnKill(int timeLeft) { - for (int k = 0; k < 5; k++) + for (int k = 0; k < 2; k++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 107, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); + float pulseScale = Main.rand.NextFloat(0.3f, 0.4f); + DirectionalPulseRing pulse = new DirectionalPulseRing(Projectile.Center + Main.rand.NextVector2Circular(12, 12), new Vector2(2, 2).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1.1f), (Main.rand.NextBool(3) ? Color.LimeGreen : Color.Green) * 0.8f, new Vector2(1, 1), pulseScale - 0.25f, pulseScale, 0f, 15); + GeneralParticleHandler.SpawnParticle(pulse); + } + for (int b = 0; b < 6; b++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, 107, new Vector2(3, 3).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1.5f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.5f, 1.1f); + dust.alpha = 200; } } } diff --git a/Projectiles/Ranged/ButcherGun.cs b/Projectiles/Ranged/ButcherGun.cs index f6282c1b7d..ea90fbc25e 100644 --- a/Projectiles/Ranged/ButcherGun.cs +++ b/Projectiles/Ranged/ButcherGun.cs @@ -1,6 +1,6 @@ -using CalamityMod.Items.Weapons.Ranged; +using System; +using CalamityMod.Items.Weapons.Ranged; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -80,7 +80,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.ai[1] = (float)(shootDelayBase - incrementMult * incrementAmt); willShoot = true; } - bool canShoot = player.channel && player.HasAmmo(player.ActiveItem()) && !player.noItems && !player.CCed; + bool canShoot = !player.CantUseHoldout() && player.HasAmmo(player.ActiveItem()); if (Projectile.localAI[0] > 0f) { Projectile.localAI[0] -= 1f; diff --git a/Projectiles/Ranged/CardClub.cs b/Projectiles/Ranged/CardClub.cs index 8bda06015e..91aaec67ac 100644 --- a/Projectiles/Ranged/CardClub.cs +++ b/Projectiles/Ranged/CardClub.cs @@ -1,9 +1,9 @@ using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { public class CardClub : ModProjectile, ILocalizedModType @@ -36,7 +36,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.spriteDirection = Projectile.direction; if (Main.rand.NextBool()) { - int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), 1, 1, 30, 0f, 0f, 0, default, 0.5f); + int dust = Dust.NewDust(Projectile.position, 1, 1, DustID.Web, 0f, 0f, 0, default, 0.5f); Main.dust[dust].velocity *= 0f; Main.dust[dust].noGravity = true; } diff --git a/Projectiles/Ranged/CardClubSplit.cs b/Projectiles/Ranged/CardClubSplit.cs index 7d840945f6..928c15967d 100644 --- a/Projectiles/Ranged/CardClubSplit.cs +++ b/Projectiles/Ranged/CardClubSplit.cs @@ -1,9 +1,9 @@ using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { public class CardClubSplit : ModProjectile, ILocalizedModType @@ -36,7 +36,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.spriteDirection = Projectile.direction; if (Main.rand.NextBool()) { - int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), 1, 1, 30, 0f, 0f, 0, default, 0.5f); + int dust = Dust.NewDust(Projectile.position, 1, 1, DustID.Web, 0f, 0f, 0, default, 0.5f); Main.dust[dust].velocity *= 0f; Main.dust[dust].noGravity = true; } @@ -58,7 +58,7 @@ namespace CalamityMod.Projectiles.Ranged { for (int k = 0; k < 2; k++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 30, Projectile.oldVelocity.X * 0.15f, Projectile.oldVelocity.Y * 0.15f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Web, Projectile.oldVelocity.X * 0.15f, Projectile.oldVelocity.Y * 0.15f); } } diff --git a/Projectiles/Ranged/CardDiamond.cs b/Projectiles/Ranged/CardDiamond.cs index 74c85383fe..8bb7a7706c 100644 --- a/Projectiles/Ranged/CardDiamond.cs +++ b/Projectiles/Ranged/CardDiamond.cs @@ -1,9 +1,9 @@ using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { public class CardDiamond : ModProjectile, ILocalizedModType @@ -36,7 +36,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.spriteDirection = Projectile.direction; if (Main.rand.NextBool()) { - int dust = Dust.NewDust(Projectile.position, 1, 1, 30, 0f, 0f, 0, default, 0.5f); + int dust = Dust.NewDust(Projectile.position, 1, 1, DustID.Web, 0f, 0f, 0, default, 0.5f); Main.dust[dust].velocity *= 0f; Main.dust[dust].noGravity = true; } @@ -61,7 +61,7 @@ namespace CalamityMod.Projectiles.Ranged SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); for (int d = 0; d < 10; d++) { - int paper = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 30, 0f, 0f, 100, default, 2f); + int paper = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Web, 0f, 0f, 100, default, 2f); Main.dust[paper].velocity *= 3f; if (Main.rand.NextBool()) { @@ -71,10 +71,10 @@ namespace CalamityMod.Projectiles.Ranged } for (int d = 0; d < 15; d++) { - int paper = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 30, 0f, 0f, 100, default, 3f); + int paper = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Web, 0f, 0f, 100, default, 3f); Main.dust[paper].noGravity = true; Main.dust[paper].velocity *= 5f; - paper = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 30, 0f, 0f, 100, default, 2f); + paper = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Web, 0f, 0f, 100, default, 2f); Main.dust[paper].velocity *= 2f; } diff --git a/Projectiles/Ranged/CardHeart.cs b/Projectiles/Ranged/CardHeart.cs index b0fcd02d3e..da83907400 100644 --- a/Projectiles/Ranged/CardHeart.cs +++ b/Projectiles/Ranged/CardHeart.cs @@ -1,9 +1,11 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Balancing; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { public class CardHeart : ModProjectile, ILocalizedModType @@ -36,7 +38,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.spriteDirection = Projectile.direction; if (Main.rand.NextBool()) { - int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), 1, 1, 30, 0f, 0f, 0, default, 0.5f); + int dust = Dust.NewDust(Projectile.position, 1, 1, DustID.Web, 0f, 0f, 0, default, 0.5f); Main.dust[dust].velocity *= 0f; Main.dust[dust].noGravity = true; } @@ -53,18 +55,20 @@ namespace CalamityMod.Projectiles.Ranged { for (int k = 0; k < 2; k++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 30, Projectile.oldVelocity.X * 0.15f, Projectile.oldVelocity.Y * 0.15f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Web, Projectile.oldVelocity.X * 0.15f, Projectile.oldVelocity.Y * 0.15f); } } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - Player player = Main.player[Projectile.owner]; - if (player.moonLeech) + int heal = (int)Math.Round(hit.Damage * 0.01); + if (heal > BalancingConstants.LifeStealCap) + heal = BalancingConstants.LifeStealCap; + + if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) return; - player.statLife += 1; - player.HealEffect(1); + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); } public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Ranged/CardSpade.cs b/Projectiles/Ranged/CardSpade.cs index d3599f3ee4..4e9861bb9d 100644 --- a/Projectiles/Ranged/CardSpade.cs +++ b/Projectiles/Ranged/CardSpade.cs @@ -1,9 +1,9 @@ using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { public class CardSpade : ModProjectile, ILocalizedModType @@ -38,7 +38,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.spriteDirection = Projectile.direction; if (Main.rand.NextBool()) { - int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), 1, 1, 30, 0f, 0f, 0, default, 0.5f); + int dust = Dust.NewDust(Projectile.position, 1, 1, DustID.Web, 0f, 0f, 0, default, 0.5f); Main.dust[dust].velocity *= 0f; Main.dust[dust].noGravity = true; } @@ -55,7 +55,7 @@ namespace CalamityMod.Projectiles.Ranged { for (int k = 0; k < 2; k++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 30, Projectile.oldVelocity.X * 0.15f, Projectile.oldVelocity.Y * 0.15f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Web, Projectile.oldVelocity.X * 0.15f, Projectile.oldVelocity.Y * 0.15f); } } diff --git a/Projectiles/Ranged/ChargedBlast.cs b/Projectiles/Ranged/ChargedBlast.cs index 9bff684f73..caacfc330d 100644 --- a/Projectiles/Ranged/ChargedBlast.cs +++ b/Projectiles/Ranged/ChargedBlast.cs @@ -1,8 +1,9 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; + namespace CalamityMod.Projectiles.Ranged { public class ChargedBlast : ModProjectile, ILocalizedModType @@ -17,59 +18,42 @@ namespace CalamityMod.Projectiles.Ranged Projectile.friendly = true; Projectile.DamageType = DamageClass.Ranged; Projectile.penetrate = 1; - Projectile.extraUpdates = 3; + Projectile.MaxUpdates = 2; Projectile.alpha = 255; - Projectile.timeLeft = 600; + 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; - } - Lighting.AddLight((int)Projectile.Center.X / 16, (int)Projectile.Center.Y / 16, 0f, 0.3f, 0.7f); - float num55 = 100f; - float num56 = 3f; - if (Projectile.ai[1] == 0f) - { - Projectile.localAI[0] += num56; - if (Projectile.localAI[0] > num55) - { - Projectile.localAI[0] = num55; - } - } - else - { - Projectile.localAI[0] -= num56; - if (Projectile.localAI[0] <= 0f) - { - Projectile.Kill(); - return; - } - } + + float lightScale = 1f - Projectile.alpha / 255f; + Projectile.ai[2] = lightScale; + Lighting.AddLight(Projectile.Center, 0f, 0.3f * lightScale, 0.7f * lightScale); + + 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); + 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 = Main.rand.Next(2, 5); + int projectiles = 2; if (Projectile.owner == Main.myPlayer) { for (int k = 0; k < projectiles; k++) - { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.position.X, Projectile.position.Y, (float)Main.rand.Next(-10, 11) * 2f, (float)Main.rand.Next(-10, 11) * 2f, ModContent.ProjectileType(), - (int)((double)Projectile.damage * 0.85), (float)(int)((double)Projectile.knockBack * 0.5), Main.myPlayer, 0f, 0f); - } + 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); } } } diff --git a/Projectiles/Ranged/ChargedBlast2.cs b/Projectiles/Ranged/ChargedBlast2.cs index 4ba6bf958b..89318cc187 100644 --- a/Projectiles/Ranged/ChargedBlast2.cs +++ b/Projectiles/Ranged/ChargedBlast2.cs @@ -1,8 +1,9 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; + namespace CalamityMod.Projectiles.Ranged { public class ChargedBlast2 : ModProjectile, ILocalizedModType @@ -17,50 +18,48 @@ namespace CalamityMod.Projectiles.Ranged Projectile.friendly = true; Projectile.DamageType = DamageClass.Ranged; Projectile.penetrate = 3; - Projectile.extraUpdates = 2; + Projectile.MaxUpdates = 2; Projectile.alpha = 255; - Projectile.timeLeft = 200; + Projectile.timeLeft = 180; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; } public override void AI() { - if (Projectile.alpha > 0) + if (Projectile.timeLeft < 60) { - Projectile.alpha -= 25; - } - if (Projectile.alpha < 0) - { - Projectile.alpha = 0; - } - Lighting.AddLight((int)Projectile.Center.X / 16, (int)Projectile.Center.Y / 16, 0f, 0.3f, 0.7f); - float thirty = 30f; - float inc = 1f; - if (Projectile.ai[1] == 0f) - { - Projectile.localAI[0] += inc; - if (Projectile.localAI[0] > thirty) - { - Projectile.localAI[0] = thirty; - } + Projectile.alpha += 5; + if (Projectile.alpha >= 255) + Projectile.Kill(); } else { - Projectile.localAI[0] -= inc; - if (Projectile.localAI[0] <= 0f) - { - Projectile.Kill(); - return; - } + 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); + 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) { @@ -69,25 +68,12 @@ namespace CalamityMod.Projectiles.Ranged 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; } - - public override void OnKill(int timeLeft) - { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 160, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.immune[Projectile.owner] = 3; - } } } diff --git a/Projectiles/Ranged/ChickenCannonHeld.cs b/Projectiles/Ranged/ChickenCannonHeld.cs index 229af447f4..f1e2ebb30e 100644 --- a/Projectiles/Ranged/ChickenCannonHeld.cs +++ b/Projectiles/Ranged/ChickenCannonHeld.cs @@ -1,6 +1,6 @@ -using CalamityMod.Items.Weapons.Ranged; +using System; +using CalamityMod.Items.Weapons.Ranged; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -55,7 +55,7 @@ namespace CalamityMod.Projectiles.Ranged FramesTillNextShot = FireRate; shouldShoot = true; } - bool canShoot = player.channel && (player.HasAmmo(player.ActiveItem()) || FreeShotLoaded > 0) && !player.noItems && !player.CCed; + bool canShoot = !player.CantUseHoldout() && (player.HasAmmo(player.ActiveItem()) || FreeShotLoaded > 0); if (Projectile.soundDelay <= 0 && canShoot) { Projectile.soundDelay = (int)FireRate; diff --git a/Projectiles/Ranged/ChickenExplosion.cs b/Projectiles/Ranged/ChickenExplosion.cs index 867b5281ac..0db0ed946a 100644 --- a/Projectiles/Ranged/ChickenExplosion.cs +++ b/Projectiles/Ranged/ChickenExplosion.cs @@ -1,10 +1,10 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using CalamityMod.Buffs.DamageOverTime; namespace CalamityMod.Projectiles.Ranged { diff --git a/Projectiles/Ranged/ChickenRocket.cs b/Projectiles/Ranged/ChickenRocket.cs index 20fad0e06c..60ac94fae2 100644 --- a/Projectiles/Ranged/ChickenRocket.cs +++ b/Projectiles/Ranged/ChickenRocket.cs @@ -1,9 +1,9 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -32,11 +32,11 @@ namespace CalamityMod.Projectiles.Ranged { float dx = i == 1 ? Projectile.velocity.X * 0.5f : 0f; float dy = i == 1 ? Projectile.velocity.Y * 0.5f : 0f; - int d = Dust.NewDust(new Vector2(Projectile.position.X + 3f + dx, Projectile.position.Y + 3f + dy) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 6, 0f, 0f, 100, default, 1f); + int d = Dust.NewDust(new Vector2(Projectile.position.X + 3f + dx, Projectile.position.Y + 3f + dy) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, DustID.Torch, 0f, 0f, 100, default, 1f); Main.dust[d].scale *= 2f + Main.rand.NextFloat(); Main.dust[d].velocity *= 0.2f; Main.dust[d].noGravity = true; - d = Dust.NewDust(new Vector2(Projectile.position.X + 3f + dx, Projectile.position.Y + 3f + dy) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 244, 0f, 0f, 100, default, 0.5f); + d = Dust.NewDust(new Vector2(Projectile.position.X + 3f + dx, Projectile.position.Y + 3f + dy) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, DustID.CopperCoin, 0f, 0f, 100, default, 0.5f); Main.dust[d].fadeIn = 1f + Main.rand.NextFloat(0.5f); Main.dust[d].velocity *= 0.05f; } @@ -48,13 +48,13 @@ namespace CalamityMod.Projectiles.Ranged // When going at very high speed, emit even more dust. else if (Main.rand.NextBool()) { - int d = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 1f); + int d = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 100, default, 1f); Main.dust[d].scale = 0.1f + Main.rand.NextFloat(0.5f); Main.dust[d].fadeIn = 1.5f + Main.rand.NextFloat(0.5f); Main.dust[d].noGravity = true; Main.dust[d].position = Projectile.Center + new Vector2(0f, (float)(-(float)Projectile.height / 2)).RotatedBy(Projectile.rotation) * 1.1f; Main.rand.Next(2); - d = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 1f); + d = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 1f); Main.dust[d].scale = 1f + Main.rand.NextFloat(0.5f); Main.dust[d].noGravity = true; Main.dust[d].position = Projectile.Center + new Vector2(0f, (float)(-(float)Projectile.height / 2 - 6)).RotatedBy(Projectile.rotation) * 1.1f; @@ -96,7 +96,7 @@ namespace CalamityMod.Projectiles.Ranged SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); for (int i = 0; i < 40; i++) { - int d = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 31, 0f, 0f, 100, default, 2f); + int d = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Smoke, 0f, 0f, 100, default, 2f); Main.dust[d].velocity *= 3f; if (Main.rand.NextBool()) { @@ -106,10 +106,10 @@ namespace CalamityMod.Projectiles.Ranged } for (int i = 0; i < 70; i++) { - int d = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 3f); + int d = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 3f); Main.dust[d].noGravity = true; Main.dust[d].velocity *= 5f; - d = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 2f); + d = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 2f); Main.dust[d].velocity *= 2f; } } diff --git a/Projectiles/Ranged/CinderArrowProj.cs b/Projectiles/Ranged/CinderArrowProj.cs new file mode 100644 index 0000000000..e4bef88e38 --- /dev/null +++ b/Projectiles/Ranged/CinderArrowProj.cs @@ -0,0 +1,138 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class CinderArrowProj : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Ranged"; + public override string Texture => "CalamityMod/Items/Ammo/CinderArrow"; + public bool isShrapnel = false; + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 15; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + } + public override void SetDefaults() + { + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.arrow = true; + Projectile.penetrate = 1; + Projectile.extraUpdates = 1; + Projectile.timeLeft = 600; + Projectile.aiStyle = ProjAIStyleID.Arrow; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + + public override void AI() + { + if (Projectile.ai[1] == 0) + { + isShrapnel = Projectile.ai[2] == 1; + if (isShrapnel) + { + Projectile.velocity *= 0.5f; + Projectile.timeLeft = 300; + } + } + Projectile.ai[1]++; + Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; + if (isShrapnel) + { + Projectile.arrow = false; + Projectile.extraUpdates = 3; + + if (Main.rand.NextBool(4)) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center + Projectile.velocity * 2, 90, -Projectile.velocity * Main.rand.NextFloat(0.1f, 0.55f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.65f, 0.85f); + } + } + else + { + Lighting.AddLight(Projectile.Center, Color.Red.ToVector3() * 0.3f); + if (Projectile.ai[1] > 4 && Main.rand.NextBool(3)) + { + float velMulti = Main.rand.NextFloat(0.1f, 0.75f); + Dust dust = Dust.NewDustPerfect(Projectile.Center + Projectile.velocity * 2, 90, -Projectile.velocity.RotatedBy(0.45) * velMulti); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.45f, 0.75f); + dust.noLight = true; + dust.noLightEmittence = true; + Dust dust2 = Dust.NewDustPerfect(Projectile.Center + Projectile.velocity * 2, 90, -Projectile.velocity.RotatedBy(-0.45) * velMulti); + dust2.noGravity = true; + dust2.scale = Main.rand.NextFloat(0.45f, 0.75f); + dust2.noLight = true; + dust2.noLightEmittence = true; + } + } + } + + public override void OnKill(int timeLeft) + { + if (!isShrapnel) + { + int Dusts = 9; + float radians = MathHelper.TwoPi / Dusts; + Vector2 spinningPoint = Vector2.Normalize(new Vector2(-1f, -1f)); + for (int i = 0; i < Dusts; i++) + { + Vector2 dustVelocity = spinningPoint.RotatedBy(radians * i).RotatedBy(0.5f) * 6.5f; + Particle smoke = new HeavySmokeParticle(Projectile.Center, dustVelocity * Main.rand.NextFloat(1f, 2.6f),Color.Crimson, 18, Main.rand.NextFloat(0.9f, 1.6f), 0.35f, Main.rand.NextFloat(-1, 1), true); + GeneralParticleHandler.SpawnParticle(smoke); + } + SoundEngine.PlaySound(SoundID.Item69 with { Volume = 0.35f, Pitch = 1f, PitchVariance = 0.15f }, Projectile.Center); + + for (int b = 0; b < 3; b++) + { + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, new Vector2(0, -10).RotatedByRandom(0.8f) * Main.rand.NextFloat(0.9f, 1.1f), ModContent.ProjectileType(), (int)(Projectile.damage * 0.1f), 0f, Projectile.owner, 0f, 0f, 1f); + } + + if (Projectile.owner == Main.myPlayer) + { + Projectile.damage = (int)(Projectile.damage * 0.5f); + Projectile.penetrate = -1; + Projectile.ExpandHitboxBy(110); + Projectile.Damage(); + } + } + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + if (isShrapnel) + { + target.AddBuff(ModContent.BuffType(), 180); + } + } + public override bool PreDraw(ref Color lightColor) + { + if (isShrapnel) + { + Texture2D texture = ModContent.Request("CalamityMod/Particles/DrainLine").Value; + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], Color.Crimson * 0.35f, 1, texture); + return false; + } + else + { + Texture2D texture = ModContent.Request("CalamityMod/Projectiles/Ranged/BloodfireBulletProj").Value; + if (Projectile.ai[1] > 6) + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], Color.White * 0.3f, 1, texture); + return true; + } + } + + public override bool? CanDamage() => isShrapnel && Projectile.ai[1] < 20 ? false : null; + } +} diff --git a/Projectiles/Ranged/ClamorRifleProj.cs b/Projectiles/Ranged/ClamorRifleProj.cs index d584a075d5..c3c7a5ef6c 100644 --- a/Projectiles/Ranged/ClamorRifleProj.cs +++ b/Projectiles/Ranged/ClamorRifleProj.cs @@ -1,10 +1,10 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; namespace CalamityMod.Projectiles.Ranged { @@ -31,7 +31,7 @@ namespace CalamityMod.Projectiles.Ranged Lighting.AddLight(Projectile.Center, new Vector3(44, 191, 232) * (1.3f / 255)); for (int i = 0; i < 2; i++) { - int blueDust = Dust.NewDust(new Vector2(Projectile.Center.X, Projectile.Center.Y), Projectile.width - 28, Projectile.height - 28, 68, 0f, 0f, 100, default, 1f); + int blueDust = Dust.NewDust(new Vector2(Projectile.Center.X, Projectile.Center.Y), Projectile.width - 28, Projectile.height - 28, DustID.BlueCrystalShard, 0f, 0f, 100, default, 1f); Main.dust[blueDust].noGravity = true; Main.dust[blueDust].velocity *= 0.1f; Main.dust[blueDust].velocity += Projectile.velocity * 0.5f; diff --git a/Projectiles/Ranged/ClamorRifleProjSplit.cs b/Projectiles/Ranged/ClamorRifleProjSplit.cs index 28c36bb2d7..c4809556b2 100644 --- a/Projectiles/Ranged/ClamorRifleProjSplit.cs +++ b/Projectiles/Ranged/ClamorRifleProjSplit.cs @@ -1,6 +1,8 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Ranged { public class ClamorRifleProjSplit : ModProjectile, ILocalizedModType @@ -26,11 +28,11 @@ namespace CalamityMod.Projectiles.Ranged { Projectile.rotation += 0.15f; - Lighting.AddLight(Projectile.Center, new Vector3(44, 191, 232) * (1.3f/255)); + Lighting.AddLight(Projectile.Center, new Vector3(44, 191, 232) * (1.3f / 255)); for (int num151 = 0; num151 < 2; num151++) { - int blueDust = Dust.NewDust(new Vector2(Projectile.Center.X, Projectile.Center.Y), Projectile.width - 28, Projectile.height - 28, 68, 0f, 0f, 100, default, 1f); + int blueDust = Dust.NewDust(new Vector2(Projectile.Center.X, Projectile.Center.Y), Projectile.width - 28, Projectile.height - 28, DustID.BlueCrystalShard, 0f, 0f, 100, default, 1f); Main.dust[blueDust].noGravity = true; Main.dust[blueDust].velocity *= 0.1f; Main.dust[blueDust].velocity += Projectile.velocity * 0.5f; diff --git a/Projectiles/Ranged/ClaretCannonProj.cs b/Projectiles/Ranged/ClaretCannonProj.cs index 4f6a30bb4d..22c833a8d0 100644 --- a/Projectiles/Ranged/ClaretCannonProj.cs +++ b/Projectiles/Ranged/ClaretCannonProj.cs @@ -1,10 +1,12 @@ -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Balancing; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -54,15 +56,14 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - if (!target.canGhostHeal || Main.player[Projectile.owner].moonLeech) + int heal = (int)Math.Round(hit.Damage * 0.02); + if (heal > BalancingConstants.LifeStealCap) + heal = BalancingConstants.LifeStealCap; + + if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) return; - Player player = Main.player[Projectile.owner]; - if (Main.rand.NextBool()) - { - player.statLife += 1; - player.HealEffect(1); - } + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); } public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Ranged/ClockworkBowHoldout.cs b/Projectiles/Ranged/ClockworkBowHoldout.cs index da0aaa1734..3e4f123dde 100644 --- a/Projectiles/Ranged/ClockworkBowHoldout.cs +++ b/Projectiles/Ranged/ClockworkBowHoldout.cs @@ -1,7 +1,7 @@ -using CalamityMod.Items.Weapons.Ranged; +using System; +using CalamityMod.Items.Weapons.Ranged; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.Audio; using Terraria.Graphics.Shaders; @@ -20,9 +20,7 @@ namespace CalamityMod.Projectiles.Ranged private ref float CurrentChargingFrames => ref Projectile.ai[0]; private ref float LoadedBolts => ref Projectile.ai[1]; private ref float FramesToLoadBolt => ref Projectile.localAI[0]; - private ref float LastDirection => ref Projectile.localAI[1]; - - private bool OwnerCanShoot => Owner.channel && !Owner.noItems && !Owner.CCed; + private float storedVelocity = 1f; private float angularSpread = MathHelper.ToRadians(16); @@ -46,7 +44,7 @@ namespace CalamityMod.Projectiles.Ranged Vector2 tipPosition = armPosition + Projectile.velocity * Projectile.width * 0.5f; // If the player releases left click, shoot out the arrows - if (!OwnerCanShoot) + if (Owner.CantUseHoldout()) { if (LoadedBolts <= 0f) //If theres no arrows to shoot diff --git a/Projectiles/Ranged/CondemnationArrow.cs b/Projectiles/Ranged/CondemnationArrow.cs index 91ab4153ce..1807a79a2b 100644 --- a/Projectiles/Ranged/CondemnationArrow.cs +++ b/Projectiles/Ranged/CondemnationArrow.cs @@ -1,9 +1,9 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { diff --git a/Projectiles/Ranged/CondemnationArrowHoming.cs b/Projectiles/Ranged/CondemnationArrowHoming.cs index 4075e1b45e..85dfd6b539 100644 --- a/Projectiles/Ranged/CondemnationArrowHoming.cs +++ b/Projectiles/Ranged/CondemnationArrowHoming.cs @@ -1,5 +1,5 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Projectiles/Ranged/CondemnationHoldout.cs b/Projectiles/Ranged/CondemnationHoldout.cs index cc7056d048..04693f2c48 100644 --- a/Projectiles/Ranged/CondemnationHoldout.cs +++ b/Projectiles/Ranged/CondemnationHoldout.cs @@ -18,7 +18,6 @@ namespace CalamityMod.Projectiles.Ranged private ref float ArrowsLoaded => ref Projectile.ai[1]; private ref float FramesToLoadNextArrow => ref Projectile.localAI[0]; - private bool OwnerCanShoot => Owner.channel && !Owner.noItems && !Owner.CCed; private float storedVelocity = 1f; public const float velocityMultiplier = 1.2f; public bool homing = false; @@ -42,7 +41,7 @@ namespace CalamityMod.Projectiles.Ranged Vector2 tipPosition = armPosition + Projectile.velocity * Projectile.width * 0.5f; // Fire arrows if the owner stops channeling or otherwise cannot use the weapon. - if (!OwnerCanShoot) + if (Owner.CantUseHoldout()) { // No arrows left to shoot? The bow disappears. if (ArrowsLoaded <= 0f) @@ -114,7 +113,7 @@ namespace CalamityMod.Projectiles.Ranged { if (Main.dedServ) return; - + //Special visuals for the final loaded arrow if (ArrowsLoaded >= Condemnation.MaxLoadedArrows - 1f) { diff --git a/Projectiles/Ranged/ContagionArrow.cs b/Projectiles/Ranged/ContagionArrow.cs index 11801758d6..04e8f7b438 100644 --- a/Projectiles/Ranged/ContagionArrow.cs +++ b/Projectiles/Ranged/ContagionArrow.cs @@ -1,10 +1,10 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { public class ContagionArrow : ModProjectile, ILocalizedModType @@ -33,7 +33,7 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; addBallTimer--; if (addBallTimer <= 0) { diff --git a/Projectiles/Ranged/ContagionBall.cs b/Projectiles/Ranged/ContagionBall.cs index 243f195079..7b8798c7be 100644 --- a/Projectiles/Ranged/ContagionBall.cs +++ b/Projectiles/Ranged/ContagionBall.cs @@ -1,9 +1,9 @@ using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { public class ContagionBall : ModProjectile, ILocalizedModType @@ -31,7 +31,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.localNPCHitCooldown = 10; Projectile.Damage(); SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); - int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 44, 0f, 0f, 100, default, 0.15f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.JungleSpore, 0f, 0f, 100, default, 0.15f); Main.dust[dust].velocity *= 1.2f; if (Main.rand.NextBool()) { diff --git a/Projectiles/Ranged/ContagionBow.cs b/Projectiles/Ranged/ContagionBow.cs index 9f3338c2ef..ec199c5071 100644 --- a/Projectiles/Ranged/ContagionBow.cs +++ b/Projectiles/Ranged/ContagionBow.cs @@ -1,6 +1,6 @@ -using CalamityMod.Items.Weapons.Ranged; +using System; +using CalamityMod.Items.Weapons.Ranged; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -79,7 +79,7 @@ namespace CalamityMod.Projectiles.Ranged Vector2 value = Projectile.Center + rotate; for (int i = 0; i < 2; i++) { - int dust = Dust.NewDust(value - Vector2.One * 8f, 16, 16, 44, Projectile.velocity.X / 2f, Projectile.velocity.Y / 2f, 100, default, 0.25f); + int dust = Dust.NewDust(value - Vector2.One * 8f, 16, 16, DustID.JungleSpore, Projectile.velocity.X / 2f, Projectile.velocity.Y / 2f, 100, default, 0.25f); Main.dust[dust].velocity *= 0.66f; Main.dust[dust].noGravity = true; Main.dust[dust].scale = 1.4f; @@ -87,8 +87,7 @@ namespace CalamityMod.Projectiles.Ranged } if (fullSpeed && Main.myPlayer == Projectile.owner) { - bool canUseItem = player.channel && !player.noItems && !player.CCed; - if (canUseItem) + if (!player.CantUseHoldout()) { float speed = player.ActiveItem().shootSpeed * Projectile.scale; Vector2 spawnPos = vector; diff --git a/Projectiles/Ranged/CorrodedShell.cs b/Projectiles/Ranged/CorrodedShell.cs index eed2ad9611..d70b68fad7 100644 --- a/Projectiles/Ranged/CorrodedShell.cs +++ b/Projectiles/Ranged/CorrodedShell.cs @@ -4,9 +4,9 @@ using CalamityMod.Dusts; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { public class CorrodedShell : ModProjectile, ILocalizedModType @@ -59,7 +59,7 @@ namespace CalamityMod.Projectiles.Ranged int count = Main.rand.Next(6, 15); for (int i = 0; i < count; i++) { - int idx = Dust.NewDust(Projectile.Center - Projectile.velocity / 2f, 0, 0, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default, 2f); + int idx = Dust.NewDust(Projectile.Center - Projectile.velocity / 2f, 0, 0, (int)CalamityDusts.SulphurousSeaAcid, 0f, 0f, 100, default, 2f); Main.dust[idx].velocity *= 2f; Main.dust[idx].noGravity = true; } diff --git a/Projectiles/Ranged/CosmicFire.cs b/Projectiles/Ranged/CosmicFire.cs index e5274abfb1..83feeccb0f 100644 --- a/Projectiles/Ranged/CosmicFire.cs +++ b/Projectiles/Ranged/CosmicFire.cs @@ -1,11 +1,11 @@ using CalamityMod.Buffs.DamageOverTime; -using Terraria; -using Terraria.ModLoader; -using CalamityMod.Particles; -using Microsoft.Xna.Framework; -using Terraria.Audio; using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Particles; using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { @@ -46,7 +46,7 @@ namespace CalamityMod.Projectiles.Ranged Particle orb = new GenericBloom(Projectile.Center + Main.rand.NextVector2Circular(10, 10), Projectile.velocity * Main.rand.NextFloat(0.05f, 0.5f), Color.Black, Main.rand.NextFloat(0.2f, 0.45f), Main.rand.Next(9, 12), true, false); GeneralParticleHandler.SpawnParticle(orb); } - + if (Projectile.timeLeft % 3 == 0 && Time > 12f && targetDist < 1400f) { LineParticle spark2 = new LineParticle(Projectile.Center, -Projectile.velocity * 0.05f, false, 17, 1.7f, InnerColor); @@ -57,7 +57,7 @@ namespace CalamityMod.Projectiles.Ranged Particle orb2 = new GenericBloom(Projectile.Center + Main.rand.NextVector2Circular(5, 5), Projectile.velocity * Main.rand.NextFloat(0.05f, 0.5f), InnerColor, Main.rand.NextFloat(0.05f, 0.3f), Main.rand.Next(9, 12), true); GeneralParticleHandler.SpawnParticle(orb2); } - + if (Time == 7f) { for (int i = 0; i <= 18; i++) diff --git a/Projectiles/Ranged/DWArrow.cs b/Projectiles/Ranged/DWArrow.cs index 6889561097..74f4fb6f83 100644 --- a/Projectiles/Ranged/DWArrow.cs +++ b/Projectiles/Ranged/DWArrow.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Projectiles.Ranged { //Rotation Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); - Projectile.rotation = (Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi)) + MathHelper.ToRadians(90) *Projectile.direction; + Projectile.rotation = (Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi)) + MathHelper.ToRadians(90) * Projectile.direction; if (Projectile.ai[1] == 0f) { diff --git a/Projectiles/Ranged/DaemonsFlameArrow.cs b/Projectiles/Ranged/DaemonsFlameArrow.cs index 29ee506641..2d03ecc83d 100644 --- a/Projectiles/Ranged/DaemonsFlameArrow.cs +++ b/Projectiles/Ranged/DaemonsFlameArrow.cs @@ -1,9 +1,9 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { public class DaemonsFlameArrow : ModProjectile, ILocalizedModType @@ -36,14 +36,14 @@ namespace CalamityMod.Projectiles.Ranged } for (int i = 0; i < 2; i++) { - int dusty = Dust.NewDust(new Vector2(Projectile.Center.X, Projectile.Center.Y), Projectile.width - 28, Projectile.height - 28, 60, 0f, 0f, 100, default, 1.6f); + int dusty = Dust.NewDust(new Vector2(Projectile.Center.X, Projectile.Center.Y), Projectile.width - 28, Projectile.height - 28, DustID.RedTorch, 0f, 0f, 100, default, 1.6f); Main.dust[dusty].noGravity = true; Main.dust[dusty].velocity *= 0.1f; Main.dust[dusty].velocity += Projectile.velocity * 0.5f; } if (Main.rand.NextBool(13)) { - int dusty2 = Dust.NewDust(new Vector2(Projectile.Center.X, Projectile.Center.Y), Projectile.width - 32, Projectile.height - 32, 60, 0f, 0f, 100, default, 1f); + int dusty2 = Dust.NewDust(new Vector2(Projectile.Center.X, Projectile.Center.Y), Projectile.width - 32, Projectile.height - 32, DustID.RedTorch, 0f, 0f, 100, default, 1f); Main.dust[dusty2].velocity *= 0.25f; Main.dust[dusty2].velocity += Projectile.velocity * 0.5f; } @@ -69,7 +69,7 @@ namespace CalamityMod.Projectiles.Ranged for (int i = 0; i < 10; i++) { - int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 100, default, 1.2f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RedTorch, 0f, 0f, 100, default, 1.2f); Main.dust[dust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -79,10 +79,10 @@ namespace CalamityMod.Projectiles.Ranged } for (int j = 0; j < 20; j++) { - int dust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 100, default, 1.7f); + int dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RedTorch, 0f, 0f, 100, default, 1.7f); Main.dust[dust2].noGravity = true; Main.dust[dust2].velocity *= 5f; - dust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 100, default, 1f); + dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RedTorch, 0f, 0f, 100, default, 1f); Main.dust[dust2].velocity *= 2f; } } diff --git a/Projectiles/Ranged/DaemonsFlameBow.cs b/Projectiles/Ranged/DaemonsFlameBow.cs index 1a2fd7c368..907806df64 100644 --- a/Projectiles/Ranged/DaemonsFlameBow.cs +++ b/Projectiles/Ranged/DaemonsFlameBow.cs @@ -77,7 +77,7 @@ namespace CalamityMod.Projectiles.Ranged fullSpeed = true; int arg_1EF4_0 = (int)Projectile.ai[0] / (delayCompare - fireSpeedCompare * fireSpeed); } - bool canUseItem = player.channel && player.HasAmmo(player.ActiveItem()) && !player.noItems && !player.CCed; + bool canUseItem = !player.CantUseHoldout() && player.HasAmmo(player.ActiveItem()); if (Projectile.localAI[0] > 0f) { Projectile.localAI[0] -= 1f; @@ -156,8 +156,8 @@ namespace CalamityMod.Projectiles.Ranged public override void PostDraw(Color lightColor) { - Texture2D texture2D13 = ModContent.Request(Texture).Value; - int framing = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; + Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + int framing = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; int y6 = framing * Projectile.frame; Vector2 origin = new Vector2(27f, 58f); SpriteEffects spriteEffects = SpriteEffects.None; diff --git a/Projectiles/Ranged/DeadSunExplosion.cs b/Projectiles/Ranged/DeadSunExplosion.cs index 9b8f99b9ea..b970fa388b 100644 --- a/Projectiles/Ranged/DeadSunExplosion.cs +++ b/Projectiles/Ranged/DeadSunExplosion.cs @@ -51,7 +51,7 @@ namespace CalamityMod.Projectiles.Ranged Vector2 offset = (Vector2.UnitX * Main.rand.NextFloat(ExplosionRadius * 0.2f, 3.1f)).RotatedBy(rot * Main.rand.NextFloat(1.1f, 9.1f)); Vector2 velOffset = (Vector2.UnitX * Main.rand.NextFloat(ExplosionRadius * 0.2f, 3.1f)).RotatedBy(rot * Main.rand.NextFloat(1.1f, 9.1f)); Dust dust = Dust.NewDustPerfect(Projectile.Center + offset, Main.rand.NextBool(4) ? 263 : Projectile.ai[1] == 5 ? 278 : 66, velOffset); - dust.noGravity = dust.type == 278? false : true; + dust.noGravity = dust.type == 278 ? false : true; dust.color = color1; dust.velocity = velOffset; dust.scale = dust.type == 278 ? Main.rand.NextFloat(0.7f, 1.3f) : Main.rand.NextFloat(1.6f, 2.2f); diff --git a/Projectiles/Ranged/DragonsBreathFlames.cs b/Projectiles/Ranged/DragonsBreathFlames.cs index 430e8d8285..134da61522 100644 --- a/Projectiles/Ranged/DragonsBreathFlames.cs +++ b/Projectiles/Ranged/DragonsBreathFlames.cs @@ -55,7 +55,7 @@ namespace CalamityMod.Projectiles.Ranged Time++; if (Projectile.ai[0] == 0) //Fireball Mode { - if (Time == 16) + if (Time == 20) { for (int i = 0; i <= 7; i++) { @@ -120,12 +120,12 @@ namespace CalamityMod.Projectiles.Ranged for (int i = 0; i <= 4; i++) { Vector2 sparkVelocity = Projectile.velocity * 6; - + float sparkScale1 = Main.rand.NextFloat(0.3f, 0.8f); Vector2 sparkvelocity1 = sparkVelocity.RotatedByRandom(0.45f) * Main.rand.NextFloat(0.4f, 0.95f); SparkParticle spark1 = new SparkParticle(Projectile.Center, sparkvelocity1, false, 6, sparkScale1, Main.rand.NextBool() ? Color.DarkOrange : Color.OrangeRed); GeneralParticleHandler.SpawnParticle(spark1); - + float sparkScale2 = Main.rand.NextFloat(0.4f, 1f); Vector2 sparkvelocity2 = sparkVelocity.RotatedByRandom(0.2f) * Main.rand.NextFloat(1.1f, 3.1f); SparkParticle spark2 = new SparkParticle(Projectile.Center, sparkvelocity2, false, 6, sparkScale2, Main.rand.NextBool() ? Color.DarkOrange : Color.OrangeRed); diff --git a/Projectiles/Ranged/DrataliornusBow.cs b/Projectiles/Ranged/DrataliornusBow.cs index 1f636193d9..04839e8617 100644 --- a/Projectiles/Ranged/DrataliornusBow.cs +++ b/Projectiles/Ranged/DrataliornusBow.cs @@ -1,6 +1,6 @@ -using CalamityMod.Items.Weapons.Ranged; +using System; +using CalamityMod.Items.Weapons.Ranged; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Ranged Vector2 rotate = Vector2.Normalize(Projectile.velocity) * 9f; rotate = rotate.RotatedBy((i - (constant / 2 - 1)) * 6.28318548f / constant, default) + player.Center; Vector2 faceDirection = rotate - player.Center; - int dust = Dust.NewDust(rotate + faceDirection, 0, 0, 127, 0f, 0f, 0, default, 4f); + int dust = Dust.NewDust(rotate + faceDirection, 0, 0, DustID.Flare, 0f, 0f, 0, default, 4f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity = faceDirection; } @@ -77,7 +77,7 @@ namespace CalamityMod.Projectiles.Ranged timeToFire = true; } - bool canFire = player.channel && player.HasAmmo(player.ActiveItem()) && !player.noItems && !player.CCed; + bool canFire = !player.CantUseHoldout() && player.HasAmmo(player.ActiveItem()); if (Projectile.soundDelay <= 0 && canFire) { diff --git a/Projectiles/Ranged/DrataliornusFlame.cs b/Projectiles/Ranged/DrataliornusFlame.cs index c80e073847..dd09b0470e 100644 --- a/Projectiles/Ranged/DrataliornusFlame.cs +++ b/Projectiles/Ranged/DrataliornusFlame.cs @@ -1,12 +1,12 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { public class DrataliornusFlame : ModProjectile, ILocalizedModType @@ -132,7 +132,7 @@ namespace CalamityMod.Projectiles.Ranged } } - int d = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 127, Projectile.velocity.X, Projectile.velocity.Y, 0, default, 1.5f + Main.rand.NextFloat()); + int d = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Flare, Projectile.velocity.X, Projectile.velocity.Y, 0, default, 1.5f + Main.rand.NextFloat()); Main.dust[d].noGravity = true; Lighting.AddLight(Projectile.Center, 255f / 255f, 154f / 255f, 58f / 255f); @@ -145,7 +145,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - Texture2D texture2D13 = ModContent.Request(Texture).Value; + Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, 0, texture2D13.Width, texture2D13.Height)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)texture2D13.Height / 2f), Projectile.scale, SpriteEffects.None, 0); return false; } @@ -180,21 +180,21 @@ namespace CalamityMod.Projectiles.Ranged Vector2 rotate = Vector2.Normalize(Projectile.velocity) * modifier; rotate = rotate.RotatedBy((i - (constant / 2 - 1)) * 6.28318548f / constant, default) + Projectile.Center; Vector2 faceDirection = rotate - Projectile.Center; - int dust = Dust.NewDust(rotate + faceDirection, 0, 0, 174, 0f, 0f, 45, default, 2f); + int dust = Dust.NewDust(rotate + faceDirection, 0, 0, DustID.InfernoFork, 0f, 0f, 45, default, 2f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity = faceDirection; } for (int j = 0; j < 4; j++) { - Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 174, 0f, 0f, 50, default, 1.5f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.InfernoFork, 0f, 0f, 50, default, 1.5f); - int fieryDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 174, 0f, 0f, 50, default, 1f); + int fieryDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.InfernoFork, 0f, 0f, 50, default, 1f); Main.dust[fieryDust].noGravity = true; Main.dust[fieryDust].velocity *= 2f; } for (int k = 0; k < 12; k++) { - int fieryDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 127, 0f, 0f, 0, default, 3f); + int fieryDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Flare, 0f, 0f, 0, default, 3f); Main.dust[fieryDust].noGravity = true; Main.dust[fieryDust].velocity *= 3f; } @@ -234,8 +234,6 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.immune[Projectile.owner] = 0; - target.AddBuff(ModContent.BuffType(), 240); if (Projectile.ai[0] != 0f && Projectile.owner == Main.myPlayer) //if empowered diff --git a/Projectiles/Ranged/DrizzlefishFire.cs b/Projectiles/Ranged/DrizzlefishFire.cs index f86cce2045..7d1dd34af7 100644 --- a/Projectiles/Ranged/DrizzlefishFire.cs +++ b/Projectiles/Ranged/DrizzlefishFire.cs @@ -132,7 +132,7 @@ namespace CalamityMod.Projectiles.Ranged if (splitTimer <= 0) { int numProj = 2; - float rotation = MathHelper.ToRadians(Main.rand.Next(15,26)); + float rotation = MathHelper.ToRadians(Main.rand.Next(15, 26)); if (Projectile.owner == Main.myPlayer) { if (Projectile.ai[1] == 1f) diff --git a/Projectiles/Ranged/TerraBulletMain.cs b/Projectiles/Ranged/DryadsTearMain.cs similarity index 54% rename from Projectiles/Ranged/TerraBulletMain.cs rename to Projectiles/Ranged/DryadsTearMain.cs index 66e849c424..5676aded04 100644 --- a/Projectiles/Ranged/TerraBulletMain.cs +++ b/Projectiles/Ranged/DryadsTearMain.cs @@ -1,18 +1,19 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { - public class TerraBulletMain : ModProjectile, ILocalizedModType + public class DryadsTearMain : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Ranged"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; } public override void SetDefaults() @@ -25,30 +26,24 @@ namespace CalamityMod.Projectiles.Ranged Projectile.DamageType = DamageClass.Ranged; Projectile.penetrate = 1; Projectile.timeLeft = 600; - Projectile.alpha = 255; - Projectile.extraUpdates = 3; + Projectile.extraUpdates = 5; Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } public override void AI() { - Lighting.AddLight(Projectile.Center, 0f, 0.4f, 0f); + Lighting.AddLight(Projectile.Center, Color.LimeGreen.ToVector3() * 0.25f); - // localAI is used as an invisibility counter. The bullet fades into existence after 15 startup frames. Projectile.localAI[0] += 1f; if (Projectile.localAI[0] > 4f) { - // After 15 frames, the alpha will be exactly 0 - if (Projectile.alpha > 0) - Projectile.alpha -= 17; - - // Dust type 74, scale 0.8, no gravity, no light, no velocity - Vector2 pos = Projectile.Center - Projectile.velocity * 0.1f; - Dust d = Dust.NewDustDirect(pos, 0, 0, 74, Scale: 0.8f); - d.position = pos; - d.velocity = Vector2.Zero; - d.noGravity = true; - d.noLight = true; + Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(5) ? 131 : 294, -Projectile.velocity * Main.rand.NextFloat(0.05f, 0.3f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.45f, 0.65f); + if (dust.type == 131) + dust.scale = Main.rand.NextFloat(0.35f, 0.55f); + else + dust.fadeIn = 0.5f; } } @@ -65,10 +60,16 @@ namespace CalamityMod.Projectiles.Ranged for (int b = 0; b < 2; b++) { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.3), 0f, Projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.3), 0f, Projectile.owner, 0f, 0f); + } + for (int i = 0; i < 3; i++) + { + Vector2 velocity = new Vector2(4, 4).RotatedByRandom(100); + LineParticle spark2 = new LineParticle(Projectile.Center + velocity, velocity * Main.rand.NextFloat(0.5f, 1f), false, 11, 0.65f, Main.rand.NextBool(3) ? Color.MediumAquamarine : Color.Lime); + GeneralParticleHandler.SpawnParticle(spark2); } } - SoundEngine.PlaySound(SoundID.Item118, Projectile.position); + SoundEngine.PlaySound(SoundID.Item118 with { Pitch = 0.5f }, Projectile.Center); } } } diff --git a/Projectiles/Ranged/TerraBulletMain.png b/Projectiles/Ranged/DryadsTearMain.png similarity index 100% rename from Projectiles/Ranged/TerraBulletMain.png rename to Projectiles/Ranged/DryadsTearMain.png diff --git a/Projectiles/Ranged/TerraBulletSplit.cs b/Projectiles/Ranged/DryadsTearSplit.cs similarity index 52% rename from Projectiles/Ranged/TerraBulletSplit.cs rename to Projectiles/Ranged/DryadsTearSplit.cs index 6689e6440e..92d247019b 100644 --- a/Projectiles/Ranged/TerraBulletSplit.cs +++ b/Projectiles/Ranged/DryadsTearSplit.cs @@ -1,12 +1,12 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { - public class TerraBulletSplit : ModProjectile, ILocalizedModType + public class DryadsTearSplit : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Ranged"; private float speed = 0f; @@ -24,13 +24,13 @@ namespace CalamityMod.Projectiles.Ranged Projectile.friendly = true; Projectile.DamageType = DamageClass.Ranged; Projectile.penetrate = 1; - Projectile.alpha = 255; - Projectile.timeLeft = 120; + Projectile.timeLeft = 210; Projectile.extraUpdates = 1; + Projectile.tileCollide = false; AIType = ProjectileID.Bullet; } - public override bool? CanHitNPC(NPC target) => Projectile.timeLeft < 90 && target.CanBeChasedBy(Projectile); + public override bool? CanHitNPC(NPC target) => Projectile.ai[2] >= 30 && target.CanBeChasedBy(Projectile); public override bool PreDraw(ref Color lightColor) { @@ -40,25 +40,20 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; - if (Projectile.alpha > 0) - { - Projectile.alpha -= 85; - } - float x2 = Projectile.position.X - Projectile.velocity.X / 10f; - float y2 = Projectile.position.Y - Projectile.velocity.Y / 10f; - int terraDust = Dust.NewDust(new Vector2(x2, y2), 1, 1, 74, 0f, 0f, 0, default, 0.8f); - Main.dust[terraDust].alpha = Projectile.alpha; - Main.dust[terraDust].position.X = x2; - Main.dust[terraDust].position.Y = y2; - Main.dust[terraDust].velocity *= 0f; - Main.dust[terraDust].noGravity = true; + Projectile.ai[2]++; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + + Dust dust = Dust.NewDustPerfect(Projectile.Center, 264, -Projectile.velocity * Main.rand.NextFloat(0.05f, 0.6f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.5f, 0.8f); + dust.color = Main.rand.NextBool(3) ? Color.MediumAquamarine : Color.Lime; if (speed == 0f) speed = Projectile.velocity.Length(); - if (Projectile.timeLeft < 90) { - CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 450f, speed, 12f); + if (Projectile.ai[2] >= 30) + { + CalamityUtils.HomeInOnNPC(Projectile, true, 500f, speed, 12f); } } } diff --git a/Projectiles/Ranged/TerraBulletSplit.png b/Projectiles/Ranged/DryadsTearSplit.png similarity index 100% rename from Projectiles/Ranged/TerraBulletSplit.png rename to Projectiles/Ranged/DryadsTearSplit.png diff --git a/Projectiles/Ranged/ElementalEruptionHouldout.cs b/Projectiles/Ranged/ElementalEruptionHouldout.cs index d3e8ed59cc..e3c445aa01 100644 --- a/Projectiles/Ranged/ElementalEruptionHouldout.cs +++ b/Projectiles/Ranged/ElementalEruptionHouldout.cs @@ -1,153 +1,95 @@ using CalamityMod.Items.Weapons.Ranged; -using CalamityMod.Particles; -using log4net.Core; +using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; -using Mono.Cecil; -using ReLogic.Utilities; -using System; using Terraria; using Terraria.Audio; +using Terraria.DataStructures; using Terraria.ID; -using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { - public class ElementalEruptionHoldout : ModProjectile + public class ElementalEruptionHoldout : BaseGunHoldoutProjectile { - // Take the name and texture from the weapon - public override LocalizedText DisplayName => CalamityUtils.GetItemName(); - public override string Texture => "CalamityMod/Items/Weapons/Ranged/ElementalEruption"; - private Player Owner => Main.player[Projectile.owner]; + public override int AssociatedItemID => ModContent.ItemType(); + public override float MaxOffsetLengthFromArm => 15f; + public override float OffsetXUpwards => -10f; + public override float BaseOffsetY => -5f; + public override float OffsetYDownwards => 10f; + + private ref float ShotCooldown => ref Projectile.ai[0]; private ref float ShotsFired => ref Projectile.ai[1]; private ref float ShootTimer => ref Projectile.ai[2]; - private ref int ShotDelay => ref Owner.ActiveItem().useTime; // 6 - public int ShotCooldown; public int FireBlobs = 0; - public int Time = 0; - private bool OwnerCanShoot => Owner.channel && !Owner.noItems && !Owner.CCed; - public override void SetDefaults() + public override void KillHoldoutLogic() { - Projectile.width = 64; - Projectile.height = 34; - Projectile.friendly = true; - Projectile.tileCollide = false; - Projectile.DamageType = DamageClass.Ranged; - Projectile.ignoreWater = true; + base.KillHoldoutLogic(); + if (ShotsFired >= 24) + { + Projectile.Kill(); + Projectile.netUpdate = true; + } } - public override void AI() + public override void HoldoutAI() { - Time++; - if (Time == 1) - Projectile.alpha = 255; - else - Projectile.alpha = 0; - - if (Owner.dead || ShotsFired >= 24) // destroy the holdout if the player dies or is out of shots + var effectcolor = Main.rand.Next(4) switch { - Projectile.Kill(); - return; - } + 0 => Color.DeepSkyBlue, + 1 => Color.MediumSpringGreen, + 2 => Color.DarkOrange, + _ => Color.Violet, + }; - Vector2 armPosition = Owner.RotatedRelativePoint(Owner.MountedCenter, true); - Vector2 tipPosition = armPosition + Projectile.velocity * Projectile.width * 0.8f; - - // Kill if the owner stops channeling or otherwise cannot use the weapon. - if (!OwnerCanShoot) + ShootTimer++; + if (ShootTimer >= 60) { - Projectile.Kill(); - } - else - { - var effectcolor = Main.rand.Next(4) switch + if (ShotCooldown == 0) { - 0 => Color.DeepSkyBlue, - 1 => Color.MediumSpringGreen, - 2 => Color.DarkOrange, - _ => Color.Violet, - }; - - // While channeled, keep refreshing the projectile lifespan - Projectile.timeLeft = 2; - - ShootTimer++; - if (ShootTimer >= 60) - { - if (ShotCooldown == 0) - { - SoundEngine.PlaySound(SoundID.Item34, Projectile.Center); - Owner.PickAmmo(Owner.ActiveItem(), out _, out float shootSpeed, out int damage, out float knockback, out _, Main.rand.NextFloat() < 0.70f); - for (int i = 0; i < 2; i++) - { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), tipPosition, (Projectile.velocity * 10).RotatedByRandom(0.12f), ModContent.ProjectileType(), damage, knockback, Projectile.owner); - } - ShotsFired++; - ShotCooldown = ShotDelay; - if (FireBlobs == 0) - { - Vector2 newVel = (Projectile.velocity * 9); - Vector2 newPos = tipPosition + Projectile.velocity.SafeNormalize(Vector2.UnitX) * 36f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), newPos, newVel, ModContent.ProjectileType(), damage, knockback, Projectile.owner, newVel.Length(), -1f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), newPos, newVel, ModContent.ProjectileType(), damage, knockback, Projectile.owner, newVel.Length(), 1f); - FireBlobs = 3; - } - else - FireBlobs--; - } - else - ShotCooldown--; - } - else - { - if (ShootTimer == 1) - SoundEngine.PlaySound(SoundID.Item73 with { Volume = 0.7f}, Projectile.Center); - ShotsFired = 0; + SoundEngine.PlaySound(SoundID.Item34, Projectile.Center); + Owner.PickAmmo(Owner.ActiveItem(), out _, out float shootSpeed, out int damage, out float knockback, out _, Main.rand.NextFloat() < 0.70f); for (int i = 0; i < 2; i++) { - int dustType = Main.rand.NextBool() ? 66 : 247; - float rotMulti = Main.rand.NextFloat(0.3f, 1f); - Dust dust = Dust.NewDustPerfect(tipPosition, dustType); - dust.scale = Main.rand.NextFloat(1.2f, 1.8f) * (ShootTimer * 0.025f) - rotMulti * 0.1f; - dust.noGravity = true; - dust.velocity = new Vector2(0, -2).RotatedByRandom(rotMulti * 0.3f) * (Main.rand.NextFloat(1f, 3.2f) - rotMulti) * (ShootTimer * 0.025f); - dust.alpha = Main.rand.Next(90, 150); - dust.color = effectcolor; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, (Projectile.velocity * 10).RotatedByRandom(0.12f), ModContent.ProjectileType(), damage, knockback, Projectile.owner); } + ShotsFired++; + ShotCooldown = HeldItem.useTime; + if (FireBlobs == 0) + { + Vector2 newVel = (Projectile.velocity * 9); + Vector2 newPos = GunTipPosition + Projectile.velocity.SafeNormalize(Vector2.UnitX) * 36f; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), newPos, newVel, ModContent.ProjectileType(), damage, knockback, Projectile.owner, newVel.Length(), -1f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), newPos, newVel, ModContent.ProjectileType(), damage, knockback, Projectile.owner, newVel.Length(), 1f); + FireBlobs = 3; + } + else + FireBlobs--; } - + else + ShotCooldown--; } - UpdateProjectileHeldVariables(armPosition); - ManipulatePlayerVariables(); - } - - private void UpdateProjectileHeldVariables(Vector2 armPosition) - { - if (Main.myPlayer == Projectile.owner) + else { - float interpolant = Utils.GetLerpValue(5f, 35f, Projectile.Distance(Main.MouseWorld), true); - Vector2 oldVelocity = Projectile.velocity; - Projectile.velocity = Vector2.Lerp(Projectile.velocity, Projectile.SafeDirectionTo(Main.MouseWorld), interpolant); - if (Projectile.velocity != oldVelocity) + ShotsFired = 0; + for (int i = 0; i < 2; i++) { - Projectile.netSpam = 0; - Projectile.netUpdate = true; + int dustType = Main.rand.NextBool() ? 66 : 247; + float rotMulti = Main.rand.NextFloat(0.3f, 1f); + Dust dust = Dust.NewDustPerfect(GunTipPosition, dustType); + dust.scale = Main.rand.NextFloat(1.2f, 1.8f) * (ShootTimer * 0.025f) - rotMulti * 0.1f; + dust.noGravity = true; + dust.velocity = new Vector2(0, -2).RotatedByRandom(rotMulti * 0.3f) * (Main.rand.NextFloat(1f, 3.2f) - rotMulti) * (ShootTimer * 0.025f); + dust.alpha = Main.rand.Next(90, 150); + dust.color = effectcolor; } } - Projectile.Center = armPosition + Projectile.velocity * 20; - Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f); - Projectile.spriteDirection = Projectile.direction; } - private void ManipulatePlayerVariables() + public override void OnSpawn(IEntitySource source) { - Owner.ChangeDir(Projectile.direction); - Owner.heldProj = Projectile.whoAmI; - Owner.itemTime = 2; - Owner.itemAnimation = 2; - Owner.itemRotation = (Projectile.velocity * Projectile.direction).ToRotation(); + base.OnSpawn(source); + SoundEngine.PlaySound(SoundID.Item73 with { Volume = 0.7f }, Projectile.Center); } - public override bool? CanDamage() => false; } } diff --git a/Projectiles/Ranged/ElementalFire.cs b/Projectiles/Ranged/ElementalFire.cs index 3e99af8777..9f1b355c28 100644 --- a/Projectiles/Ranged/ElementalFire.cs +++ b/Projectiles/Ranged/ElementalFire.cs @@ -1,7 +1,7 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Particles; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -48,7 +48,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.scale = 1.8f * Utils.GetLerpValue(5f, 30f, Time, true); else return; // Helps position it at the tip - + if (Time == 1) { for (int i = 0; i < 12; i++) diff --git a/Projectiles/Ranged/ElementalFlare.cs b/Projectiles/Ranged/ElementalFlare.cs index f77c689562..c92fe7d148 100644 --- a/Projectiles/Ranged/ElementalFlare.cs +++ b/Projectiles/Ranged/ElementalFlare.cs @@ -1,9 +1,9 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using System.IO; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -92,7 +92,7 @@ namespace CalamityMod.Projectiles.Ranged public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { if (StickToEnemies) - Projectile.ModifyHitNPCSticky(MaxStick); + Projectile.ModifyHitNPCSticky(MaxStick); } public override bool OnTileCollide(Vector2 oldVelocity) @@ -100,7 +100,7 @@ namespace CalamityMod.Projectiles.Ranged if (StickToTiles || StickToEnemies) { Projectile.velocity = oldVelocity * 0.95f; - Projectile.position -= Projectile.velocity; + Projectile.position -= Projectile.velocity; // No more enemy sticking + reset duration if (StickToEnemies) @@ -127,7 +127,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - Texture2D lightTexture = ModContent.Request(Texture).Value; + Texture2D lightTexture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; for (int i = 0; i < Projectile.oldPos.Length; i++) { float hue = 0.5f + 0.5f * i / (float)Projectile.oldPos.Length * MathF.Sin(Main.GlobalTimeWrappedHourly * 5f); diff --git a/Projectiles/Ranged/ElysianArrowProj.cs b/Projectiles/Ranged/ElysianArrowProj.cs index f62deb3def..57b5a81cfd 100644 --- a/Projectiles/Ranged/ElysianArrowProj.cs +++ b/Projectiles/Ranged/ElysianArrowProj.cs @@ -1,11 +1,9 @@ using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -14,12 +12,6 @@ namespace CalamityMod.Projectiles.Ranged public new string LocalizationCategory => "Projectiles.Ranged"; public override string Texture => "CalamityMod/Items/Ammo/ElysianArrow"; - public override void SetStaticDefaults() - { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; - } - public override void SetDefaults() { Projectile.width = 10; @@ -28,107 +20,87 @@ namespace CalamityMod.Projectiles.Ranged Projectile.DamageType = DamageClass.Ranged; Projectile.arrow = true; Projectile.penetrate = 1; - Projectile.timeLeft = 600; + Projectile.timeLeft = 1200; + Projectile.extraUpdates = 2; Projectile.aiStyle = ProjAIStyleID.Arrow; Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } public override void AI() { + Projectile.localAI[0] += 1f; + + Player Owner = Main.player[Projectile.owner]; + + if (Projectile.localAI[0] > 5) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool() ? 262 : 87, -Projectile.velocity * Main.rand.NextFloat(0.1f, 0.7f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.4f, 1.1f); + dust.alpha = 235; + } + Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); - SoundEngine.PlaySound(SoundID.Dig, Projectile.position); - return true; - } - public override void OnKill(int timeLeft) { - Projectile.position = Projectile.Center; - Projectile.width = Projectile.height = 32; - Projectile.position.X = Projectile.position.X - (Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y - (Projectile.height / 2); - SoundEngine.PlaySound(SoundID.Item14, Projectile.position); - for (int i = 0; i < 2; i++) + Player Owner = Main.player[Projectile.owner]; + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); + + NPC target = Projectile.Center.ClosestNPCAt(2000); + Vector2 targetPosition = target == null ? Projectile.Center : target.Center; + Vector2 spawnSpot = (target == null ? Projectile.Center : target.Center) + new Vector2(Main.rand.NextFloat(-450, 450), Main.rand.NextFloat(-750, -950)); + + Vector2 velocity; + if (target == null) + velocity = (targetPosition - spawnSpot).SafeNormalize(Vector2.UnitX) * 20; + else + velocity = CalamityUtils.CalculatePredictiveAimToTargetMaxUpdates(spawnSpot, target, 20f, ElysianArrowRain.MaxUpdate); + + if (targetDist < 1400f) { - int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); - Main.dust[dust].velocity *= 3f; - if (Main.rand.NextBool()) + int Dusts = 8; + float radians = MathHelper.TwoPi / Dusts; + Vector2 spinningPoint = Vector2.Normalize(new Vector2(-1f, -1f)); + for (int i = 0; i < Dusts; i++) { - Main.dust[dust].scale = 0.5f; - Main.dust[dust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + Vector2 dustVelocity = spinningPoint.RotatedBy(radians * i) * 3.5f; + Dust dust = Dust.NewDustPerfect(spawnSpot, Main.rand.NextBool() ? 262 : 87, dustVelocity, 0, default, 0.9f); + dust.noGravity = true; + + Dust dust2 = Dust.NewDustPerfect(spawnSpot, Main.rand.NextBool() ? 262 : 87, dustVelocity * 0.6f, 0, default, 1.2f); + dust2.noGravity = true; } } - for (int j = 0; j < 6; j++) - { - int dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 3f); - Main.dust[dust2].noGravity = true; - Main.dust[dust2].velocity *= 5f; - dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); - Main.dust[dust2].velocity *= 2f; - } + + Projectile.NewProjectile(Projectile.GetSource_FromThis(), spawnSpot, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.4f), 0f, Projectile.owner, 0f, 0f); + + SoundStyle onKill = new("CalamityMod/Sounds/Custom/Providence/ProvidenceHolyBlastShoot"); + SoundEngine.PlaySound(onKill with { Volume = 0.4f, Pitch = 0.4f }, Projectile.position); if (Main.netMode != NetmodeID.Server) { - Vector2 goreSource = Projectile.Center; - int goreAmt = 3; - Vector2 source = new Vector2(goreSource.X - 24f, goreSource.Y - 24f); - for (int goreIndex = 0; goreIndex < goreAmt; goreIndex++) + for (int k = 0; k < 7; k++) { - float velocityMult = 0.33f; - if (goreIndex < (goreAmt / 3)) + Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool() ? 262 : 87, Projectile.velocity.RotatedByRandom(0.4) * Main.rand.NextFloat(0.5f, 1.5f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.7f, 1.25f); + dust.alpha = 235; + if (Main.rand.NextBool()) { - velocityMult = 0.66f; + Dust dust2 = Dust.NewDustPerfect(Projectile.Center, 303, new Vector2(3, 3).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1.5f)); + dust2.noGravity = true; + dust2.scale = Main.rand.NextFloat(0.8f, 1.5f); + dust2.alpha = 70; } - if (goreIndex >= (2 * goreAmt / 3)) - { - velocityMult = 1f; - } - Mod mod = ModContent.GetInstance(); - int type = Main.rand.Next(61, 64); - int smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); - Gore gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X += 1f; - gore.velocity.Y += 1f; - type = Main.rand.Next(61, 64); - smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); - gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X -= 1f; - gore.velocity.Y += 1f; - type = Main.rand.Next(61, 64); - smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); - gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X += 1f; - gore.velocity.Y -= 1f; - type = Main.rand.Next(61, 64); - smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); - gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X -= 1f; - gore.velocity.Y -= 1f; } - } - - float x = Projectile.position.X + Main.rand.Next(-400, 400); - float y = Projectile.position.Y - Main.rand.Next(500, 800); - Vector2 landSpot = new Vector2(x, y); - float meteorSpawnX = Projectile.position.X + (Projectile.width / 2) - landSpot.X; - float meteorSpawnY = Projectile.position.Y + (Projectile.height / 2) - landSpot.Y; - meteorSpawnX += Main.rand.Next(-100, 101); - float meteorSpawnAdjust = (float)Math.Sqrt(meteorSpawnX * meteorSpawnX + meteorSpawnY * meteorSpawnY); - meteorSpawnAdjust = 25 / meteorSpawnAdjust; - meteorSpawnX *= meteorSpawnAdjust; - meteorSpawnY *= meteorSpawnAdjust; - if (Projectile.owner == Main.myPlayer) - { - int meteor = Projectile.NewProjectile(Projectile.GetSource_FromThis(), x, y, meteorSpawnX, meteorSpawnY, ModContent.ProjectileType(), Projectile.damage / 2, 5f, Projectile.owner, 0f, 0f); - Main.projectile[meteor].ai[1] = Projectile.position.Y; + for (int k = 0; k < 2; k++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, 278, Projectile.velocity.RotatedByRandom(0.4) * Main.rand.NextFloat(0.5f, 1.5f)); + dust.noGravity = false; + dust.scale = Main.rand.NextFloat(0.85f, 1f); + dust.color = Main.rand.NextBool() ? Color.Orange : Color.Khaki; + } } } @@ -136,11 +108,5 @@ namespace CalamityMod.Projectiles.Ranged { target.AddBuff(ModContent.BuffType(), 180); } - - public override bool PreDraw(ref Color lightColor) - { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); - return false; - } } } diff --git a/Projectiles/Ranged/ElysianArrowRain.cs b/Projectiles/Ranged/ElysianArrowRain.cs new file mode 100644 index 0000000000..3053e14814 --- /dev/null +++ b/Projectiles/Ranged/ElysianArrowRain.cs @@ -0,0 +1,160 @@ +using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Graphics.Primitives; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class ElysianArrowRain : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Ranged"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public static int MaxUpdate = 7; + private int Lifetime = 110; + private static Color ShaderColorOne = Color.Khaki; + private static Color ShaderColorTwo = Color.White; + private static Color ShaderEndColor = Color.Orange; + private Vector2 altSpawn; + + public override void SetStaticDefaults() + { + // While this projectile doesn't have afterimages, it keeps track of old positions for its primitive drawcode. + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 21; + } + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 24; + Projectile.arrow = true; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = Lifetime; + Projectile.MaxUpdates = MaxUpdate; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + + public override bool? CanDamage() => Projectile.numHits >= 1 ? false : null; + + public override void AI() + { + Projectile.ai[0]++; + if (Projectile.ai[0] == 45) + altSpawn = Projectile.Center; + if (Projectile.timeLeft <= 5) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(9, 9) - Projectile.velocity * 5, Main.rand.NextBool() ? 262 : 87, (Projectile.velocity * 30) * Main.rand.NextFloat(0.1f, 0.95f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.9f, 1.45f); + dust.alpha = 235; + } + if (Projectile.timeLeft <= 80) + Projectile.velocity *= 0.96f; + } + public override void OnHitPlayer(Player target, Player.HurtInfo info) + { + target.AddBuff(ModContent.BuffType(), 90); + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + + if (Projectile.damage > 1 && Projectile.numHits < 1) + Projectile.damage = (int)(Projectile.damage * 0.8f); + + + target.AddBuff(ModContent.BuffType(), 90); + Projectile.timeLeft = 80; + } + + private float PrimitiveWidthFunction(float completionRatio) + { + float arrowheadCutoff = 0.36f; + float width = 24f; + float minHeadWidth = 0.03f; + float maxHeadWidth = width; + if (completionRatio <= arrowheadCutoff) + width = MathHelper.Lerp(minHeadWidth, maxHeadWidth, Utils.GetLerpValue(0f, arrowheadCutoff, completionRatio, true)); + return width; + } + + private Color PrimitiveColorFunction(float completionRatio) + { + float endFadeRatio = 0.41f; + + float completionRatioFactor = 2.7f; + float globalTimeFactor = 5.3f; + float endFadeFactor = 3.2f; + float endFadeTerm = Utils.GetLerpValue(0f, endFadeRatio * 0.5f, completionRatio, true) * endFadeFactor; + float cosArgument = completionRatio * completionRatioFactor - Main.GlobalTimeWrappedHourly * globalTimeFactor + endFadeTerm; + float startingInterpolant = (float)Math.Cos(cosArgument) * 0.5f + 0.5f; + + float colorLerpFactor = 0.6f; + // Color 1, Color 2 + Color startingColor = Color.Lerp(ShaderColorOne, ShaderColorTwo, startingInterpolant * colorLerpFactor); + // End Color + return Color.Lerp(startingColor, ShaderEndColor, MathHelper.SmoothStep(0f, 1f, Utils.GetLerpValue(0f, endFadeRatio, completionRatio, true))); + } + + public override bool PreDraw(ref Color lightColor) + { + GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/FabstaffStreak")); + Vector2 overallOffset = Projectile.Size * 0.5f; + overallOffset += Projectile.velocity * 1.4f; + int numPoints = 46; + PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(PrimitiveWidthFunction, PrimitiveColorFunction, (_) => overallOffset, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), numPoints); + return false; + } + + public override void OnKill(int timeLeft) + { + if (Projectile.ai[1] == 0) + { + Player Owner = Main.player[Projectile.owner]; + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); + + NPC target = Projectile.Center.ClosestNPCAt(2000); + Vector2 targetPosition = Projectile.numHits == 1 ? (target == null ? Projectile.Center : target.Center) : altSpawn; + Vector2 spawnSpot = (Projectile.numHits == 1 ? (target == null ? Projectile.Center : target.Center) : altSpawn) + new Vector2(Main.rand.NextFloat(-450, 450), Main.rand.NextFloat(750, 950)); + + Vector2 velocity; + if (target == null) + velocity = (targetPosition - spawnSpot).SafeNormalize(Vector2.UnitX) * 20; + else + velocity = CalamityUtils.CalculatePredictiveAimToTargetMaxUpdates(spawnSpot, target, 20f, MaxUpdate); + + if (targetDist < 1400f) + { + int Dusts = 8; + float radians = MathHelper.TwoPi / Dusts; + Vector2 spinningPoint = Vector2.Normalize(new Vector2(-1f, -1f)); + for (int i = 0; i < Dusts; i++) + { + Vector2 dustVelocity = spinningPoint.RotatedBy(radians * i) * 3.5f; + Dust dust = Dust.NewDustPerfect(spawnSpot, Main.rand.NextBool() ? 262 : 87, dustVelocity, 0, default, 0.9f); + dust.noGravity = true; + + Dust dust2 = Dust.NewDustPerfect(spawnSpot, Main.rand.NextBool() ? 262 : 87, dustVelocity * 0.6f, 0, default, 1.2f); + dust2.noGravity = true; + } + } + + Projectile.NewProjectile(Projectile.GetSource_FromThis(), spawnSpot, velocity, ModContent.ProjectileType(), Projectile.damage, 0f, Projectile.owner, 0f, 1f); + + } + + //SoundStyle onKill = new("CalamityMod/Sounds/Custom/ProfanedGuardians/GuardianDash"); + //SoundEngine.PlaySound(onKill with { Volume = 0.4f, Pitch = 0.4f }, Projectile.position); + } + } +} diff --git a/Projectiles/Ranged/EmesisGore.cs b/Projectiles/Ranged/EmesisGore.cs index 1aa8cbf50b..94fdf0e318 100644 --- a/Projectiles/Ranged/EmesisGore.cs +++ b/Projectiles/Ranged/EmesisGore.cs @@ -1,8 +1,9 @@ -using Microsoft.Xna.Framework; -using System.IO; -using Terraria; -using Terraria.ModLoader; +using System.IO; using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { @@ -54,7 +55,7 @@ namespace CalamityMod.Projectiles.Ranged { for (int i = 0; i < (Projectile.ai[0] == 1f ? 3 : 1); i++) { - Dust dust = Dust.NewDustDirect(Projectile.position, 10, 10, 27); + Dust dust = Dust.NewDustDirect(Projectile.position, 10, 10, DustID.Shadowflame); dust.velocity = Vector2.One.RotatedByRandom(MathHelper.TwoPi); dust.noGravity = true; } diff --git a/Projectiles/Ranged/EnhancedNanoRoundProj.cs b/Projectiles/Ranged/EnhancedNanoRoundProj.cs deleted file mode 100644 index 6b4ba1b81a..0000000000 --- a/Projectiles/Ranged/EnhancedNanoRoundProj.cs +++ /dev/null @@ -1,90 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class EnhancedNanoRoundProj : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Ranged"; - public override void SetStaticDefaults() - { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; - - } - - public override void SetDefaults() - { - Projectile.width = 4; - Projectile.height = 4; - Projectile.aiStyle = ProjAIStyleID.Arrow; - Projectile.friendly = true; - Projectile.DamageType = DamageClass.Ranged; - Projectile.penetrate = 1; - Projectile.timeLeft = 600; - Projectile.extraUpdates = 3; - AIType = ProjectileID.Bullet; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; - } - - public override void AI() - { - Lighting.AddLight(Projectile.Center, 0f, 0.25f, 0.25f); - - Projectile.localAI[0] += 1f; - if (Projectile.localAI[0] > 4f) - { - if (Main.rand.NextBool(3)) - { - int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), 1, 1, 229, 0f, 0f, 0, default, 0.5f); - Main.dust[dust].alpha = Projectile.alpha; - Main.dust[dust].velocity *= 0f; - Main.dust[dust].noGravity = true; - } - } - } - - public override bool PreDraw(ref Color lightColor) - { - CalamityUtils.DrawAfterimagesFromEdge(Projectile, 0, lightColor); - return false; - } - - // This projectile is always fullbright. - public override Color? GetAlpha(Color lightColor) - { - return new Color(1f, 1f, 1f, 0f); - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(BuffID.Confused, 300); - if (target.life <= 0) - { - if (Projectile.owner == Main.myPlayer) - { - for (int i = 0; i < 2; i++) - { - Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.3), 0f, Projectile.owner, 0f, 0f); - } - } - } - } - - public override void OnKill(int timeLeft) - { - SoundEngine.PlaySound(SoundID.Item93, Projectile.position); - int rando = Main.rand.Next(5, 10); - for (int i = 0; i < rando; i++) - { - int dusty = Dust.NewDust(Projectile.Center - Projectile.velocity / 2f, 0, 0, 229, 0f, 0f, 100, default, 2f); - Main.dust[dusty].velocity *= 2f; - Main.dust[dusty].noGravity = true; - } - } - } -} diff --git a/Projectiles/Ranged/EnhancedNanoRoundProj.png b/Projectiles/Ranged/EnhancedNanoRoundProj.png deleted file mode 100644 index 6ada3c8f23..0000000000 Binary files a/Projectiles/Ranged/EnhancedNanoRoundProj.png and /dev/null differ diff --git a/Projectiles/Ranged/EssenceFire.cs b/Projectiles/Ranged/EssenceFire.cs index 21f345afd3..9c475b2799 100644 --- a/Projectiles/Ranged/EssenceFire.cs +++ b/Projectiles/Ranged/EssenceFire.cs @@ -1,9 +1,10 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged @@ -46,7 +47,7 @@ namespace CalamityMod.Projectiles.Ranged { if (Main.rand.NextBool(16)) { - Dust dust = Dust.NewDustDirect(Projectile.Center + Main.rand.NextVector2Circular(60f, 60f) * Utils.Remap(Time, 0f, Fadetime, 0.5f, 1f), 4, 4, 295, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 100); + Dust dust = Dust.NewDustDirect(Projectile.Center + Main.rand.NextVector2Circular(60f, 60f) * Utils.Remap(Time, 0f, Fadetime, 0.5f, 1f), 4, 4, DustID.CorruptTorch, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 100); if (Main.rand.NextBool(5)) { dust.noGravity = true; @@ -95,7 +96,7 @@ namespace CalamityMod.Projectiles.Ranged } public override bool PreDraw(ref Color lightColor) { - Texture2D fire = ModContent.Request(Texture).Value; + Texture2D fire = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Texture2D mist = ModContent.Request("CalamityMod/Particles/MediumMist").Value; // The conga line of colors to sift through diff --git a/Projectiles/Ranged/ExoCrystalArrow.cs b/Projectiles/Ranged/ExoCrystalArrow.cs index 790353c8c0..d8c08be6b7 100644 --- a/Projectiles/Ranged/ExoCrystalArrow.cs +++ b/Projectiles/Ranged/ExoCrystalArrow.cs @@ -1,16 +1,16 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Graphics.Primitives; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Particles; +using CalamityMod.Sounds; +using Microsoft.CodeAnalysis; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; +using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using CalamityMod.Sounds; -using CalamityMod.Particles; -using Terraria.Graphics.Shaders; -using Microsoft.Xna.Framework.Graphics; -using CalamityMod.Items.Weapons.Ranged; -using CalamityMod.Graphics.Primitives; -using Microsoft.CodeAnalysis; namespace CalamityMod.Projectiles.Ranged { @@ -92,7 +92,7 @@ namespace CalamityMod.Projectiles.Ranged GameShaders.Misc["CalamityMod:HeavenlyGaleTrail"].UseSecondaryColor(secondaryColor); GameShaders.Misc["CalamityMod:HeavenlyGaleTrail"].Apply(); PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(PrimitiveWidthFunction, PrimitiveColorFunction, (_) => trailOffset, shader: GameShaders.Misc["CalamityMod:HeavenlyGaleTrail"]), 53); - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Vector2 origin = tex.Size() * 0.5f; Vector2 drawPosition = Projectile.Center - Main.screenPosition; Main.spriteBatch.Draw(tex, drawPosition, null, Projectile.GetAlpha(Color.White), Projectile.rotation, origin, Projectile.scale, 0, 0f); diff --git a/Projectiles/Ranged/ExoFire.cs b/Projectiles/Ranged/ExoFire.cs index fcfb45d239..bee146a793 100644 --- a/Projectiles/Ranged/ExoFire.cs +++ b/Projectiles/Ranged/ExoFire.cs @@ -1,10 +1,10 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Graphics.Metaballs; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.Audio; using Terraria.ModLoader; @@ -59,7 +59,7 @@ namespace CalamityMod.Projectiles.Ranged PhotoMetaball4.SpawnParticle(Projectile.Center + Owner.velocity, (37 - Time * (PhotoTimer == 0 ? 0.165f : 0.088f)) - PhotoTimer * 0.2f + (PhotoTimer == 1 ? 20 : 0)); } - if ( Main.rand.NextBool(35) && targetDist < 1400f && Time > 5) + if (Main.rand.NextBool(35) && targetDist < 1400f && Time > 5) { Dust dust = Dust.NewDustPerfect(Projectile.Center, 263, new Vector2(0, -5).RotatedByRandom(0.05f) * Main.rand.NextFloat(0.3f, 1.6f)); dust.noGravity = true; diff --git a/Projectiles/Ranged/ExoLight.cs b/Projectiles/Ranged/ExoLight.cs index 25dc0f5244..d905834c7f 100644 --- a/Projectiles/Ranged/ExoLight.cs +++ b/Projectiles/Ranged/ExoLight.cs @@ -66,7 +66,7 @@ namespace CalamityMod.Projectiles.Ranged 2 => Color.Orange, _ => Color.LawnGreen, }; - + Lighting.AddLight(Projectile.Center, Color.DarkSlateGray.ToVector3()); Projectile.scale = MathHelper.Lerp(0.001f, 1f, Utils.GetLerpValue(0f, 25f, Time, true)); if (Projectile.localAI[0] == 0f) @@ -115,7 +115,7 @@ namespace CalamityMod.Projectiles.Ranged public override void OnKill(int timeLeft) { float scaleBonus = Time >= 120f ? Main.rand.NextFloat(3.4f, 4.2f) : Main.rand.NextFloat(0.8f, 1.6f); - SoundEngine.PlaySound(DeadSunsWind.Explosion with { Volume = 0.7f}, Projectile.Center); + SoundEngine.PlaySound(DeadSunsWind.Explosion with { Volume = 0.7f }, Projectile.Center); float numberOfDusts = Time >= 120f ? 30 : 20; float rotFactor = 360f / numberOfDusts; for (int i = 0; i < numberOfDusts; i++) diff --git a/Projectiles/Ranged/ExoLightningBolt.cs b/Projectiles/Ranged/ExoLightningBolt.cs index 4d1bc1e6f0..1a3338f0af 100644 --- a/Projectiles/Ranged/ExoLightningBolt.cs +++ b/Projectiles/Ranged/ExoLightningBolt.cs @@ -1,11 +1,11 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Graphics.Primitives; -using CalamityMod.Items.Weapons.Ranged; -using Microsoft.Xna.Framework; -using System; +using System; using System.Collections.Generic; using System.IO; using System.Linq; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Graphics.Primitives; +using CalamityMod.Items.Weapons.Ranged; +using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; using Terraria.Graphics.Shaders; @@ -86,6 +86,10 @@ namespace CalamityMod.Projectiles.Ranged HasPlayedSound = true; } + // This projectile is forced to critically strike. + // This technically is a nerf, as it makes DSO's crits deal less damage. + Projectile.Calamity().forcedCrit = true; + Lighting.AddLight(Projectile.Center, Color.White.ToVector3()); if (Projectile.frameCounter >= Projectile.extraUpdates * 2) { diff --git a/Projectiles/Ranged/FeatherLarge.cs b/Projectiles/Ranged/FeatherLarge.cs index 0adfc6a767..f516e7080f 100644 --- a/Projectiles/Ranged/FeatherLarge.cs +++ b/Projectiles/Ranged/FeatherLarge.cs @@ -1,9 +1,9 @@ +using System; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -29,7 +29,7 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; } public override bool OnTileCollide(Vector2 oldVelocity) @@ -50,7 +50,7 @@ namespace CalamityMod.Projectiles.Ranged int inc; for (int i = 0; i < 10; i = inc + 1) { - Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 42, Projectile.velocity.X * 0.1f, Projectile.velocity.Y * 0.1f, 0, default, 1f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Harpy, Projectile.velocity.X * 0.1f, Projectile.velocity.Y * 0.1f, 0, default, 1f); inc = i; } } diff --git a/Projectiles/Ranged/FishronRPG.cs b/Projectiles/Ranged/FishronRPG.cs index 9efdf73da1..257becbc69 100644 --- a/Projectiles/Ranged/FishronRPG.cs +++ b/Projectiles/Ranged/FishronRPG.cs @@ -1,9 +1,9 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { public class FishronRPG : ModProjectile, ILocalizedModType @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Ranged { for (int i = 0; i < 5; i++) { - int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 2f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Water, 0f, 0f, 100, default, 2f); Main.dust[dust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -36,7 +36,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.ai[1] = 1f; SoundEngine.PlaySound(SoundID.Item92, Projectile.position); } - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; if (Projectile.owner == Main.myPlayer && Projectile.timeLeft <= 3) { Projectile.tileCollide = false; @@ -63,11 +63,11 @@ namespace CalamityMod.Projectiles.Ranged halfX = Projectile.velocity.X * 0.5f; halfY = Projectile.velocity.Y * 0.5f; } - int fishDust = Dust.NewDust(new Vector2(Projectile.position.X + 3f + halfX, Projectile.position.Y + 3f + halfY) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 33, 0f, 0f, 100, default, 1f); + int fishDust = Dust.NewDust(new Vector2(Projectile.position.X + 3f + halfX, Projectile.position.Y + 3f + halfY) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, DustID.Water, 0f, 0f, 100, default, 1f); Main.dust[fishDust].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; Main.dust[fishDust].velocity *= 0.2f; Main.dust[fishDust].noGravity = true; - fishDust = Dust.NewDust(new Vector2(Projectile.position.X + 3f + halfX, Projectile.position.Y + 3f + halfY) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 33, 0f, 0f, 100, default, 0.5f); + fishDust = Dust.NewDust(new Vector2(Projectile.position.X + 3f + halfX, Projectile.position.Y + 3f + halfY) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, DustID.Water, 0f, 0f, 100, default, 0.5f); Main.dust[fishDust].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; Main.dust[fishDust].velocity *= 0.05f; } @@ -97,7 +97,7 @@ namespace CalamityMod.Projectiles.Ranged SoundEngine.PlaySound(SoundID.Item92, Projectile.position); for (int i = 0; i < 10; i++) { - int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 2f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Water, 0f, 0f, 100, default, 2f); Main.dust[dust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -107,10 +107,10 @@ namespace CalamityMod.Projectiles.Ranged } for (int i = 0; i < 20; i++) { - int dusty = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 3f); + int dusty = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Water, 0f, 0f, 100, default, 3f); Main.dust[dusty].noGravity = true; Main.dust[dusty].velocity *= 5f; - dusty = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 2f); + dusty = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Water, 0f, 0f, 100, default, 2f); Main.dust[dusty].velocity *= 2f; } } diff --git a/Projectiles/Ranged/FlakKrakenGun.cs b/Projectiles/Ranged/FlakKrakenGun.cs deleted file mode 100644 index 88c4b779db..0000000000 --- a/Projectiles/Ranged/FlakKrakenGun.cs +++ /dev/null @@ -1,131 +0,0 @@ -using System; -using CalamityMod.Items.Weapons.Ranged; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.Localization; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class FlakKrakenGun : ModProjectile - { - public override LocalizedText DisplayName => CalamityUtils.GetItemName(); - public override string Texture => "CalamityMod/Items/Weapons/Ranged/FlakKraken"; - - public override void SetDefaults() - { - Projectile.width = 152; - Projectile.height = 58; - Projectile.friendly = true; - Projectile.penetrate = -1; - Projectile.tileCollide = false; - Projectile.DamageType = DamageClass.Ranged; - Projectile.ignoreWater = true; - } - - public override void AI() - { - Player player = Main.player[Projectile.owner]; - float pi = 0f; - Vector2 playerRotation = player.RotatedRelativePoint(player.MountedCenter, true); - if (Projectile.spriteDirection == -1) - { - pi = 3.14159274f; - } - float hitRate = 30f; - if (Projectile.ai[0] > 90f) - { - hitRate = 15f; - } - if (Projectile.ai[0] > 120f) - { - hitRate = 5f; - } - Projectile.damage = player.ActiveItem() is null ? 0 : player.GetWeaponDamage(player.ActiveItem()); - Projectile.ai[0] += 1f; - Projectile.ai[1] += 1f; - bool isUsing = false; - if (Projectile.ai[0] % hitRate == 0f) - { - isUsing = true; - } - if (Projectile.ai[1] >= 1f) - { - Projectile.ai[1] = 0f; - isUsing = true; - if (Main.myPlayer == Projectile.owner) - { - float scaleFactor5 = player.ActiveItem().shootSpeed * Projectile.scale; - Vector2 shootDirection = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - playerRotation; - if (player.gravDir == -1f) - { - shootDirection.Y = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - playerRotation.Y; - } - Vector2 normalizeShoot = Vector2.Normalize(shootDirection); - if (float.IsNaN(normalizeShoot.X) || float.IsNaN(normalizeShoot.Y)) - { - normalizeShoot = -Vector2.UnitY; - } - normalizeShoot = Vector2.Normalize(Vector2.Lerp(normalizeShoot, Vector2.Normalize(Projectile.velocity), 0.92f)); //0.92 - normalizeShoot *= scaleFactor5; - if (normalizeShoot.X != Projectile.velocity.X || normalizeShoot.Y != Projectile.velocity.Y) - { - Projectile.netUpdate = true; - } - Projectile.velocity = normalizeShoot; - } - } - if (Projectile.soundDelay <= 0) - { - Projectile.soundDelay = 10; - Projectile.soundDelay *= 2; - if (Projectile.ai[0] != 1f && Projectile.ai[0] <= 500f) - { - SoundEngine.PlaySound(SoundID.Item15, Projectile.position); - } - } - if (isUsing && Main.myPlayer == Projectile.owner) - { - bool canUseItem = player.channel && !player.noItems && !player.CCed; - if (canUseItem) - { - if (Projectile.ai[0] == 1f) - { - Vector2 projPos = player.RotatedRelativePoint(player.MountedCenter, true); - float projX = (float)Main.mouseX + Main.screenPosition.X - projPos.X; - float projY = (float)Main.mouseY + Main.screenPosition.Y - projPos.Y; - if (player.gravDir == -1f) - { - projY = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - projPos.Y; - } - if ((float.IsNaN(projX) && float.IsNaN(projY)) || (projX == 0f && projY == 0f)) - { - projX = (float)player.direction; - projY = 0f; - } - projPos += new Vector2(projX, projY); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), projPos.X, projPos.Y, 0f, 0f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, (float)Projectile.whoAmI); - Projectile.netUpdate = true; - } - } - else - { - Projectile.Kill(); - } - } - Projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - Projectile.Size / 2f; - Projectile.rotation = Projectile.velocity.ToRotation() + pi; - 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)); - } - - public override bool? CanDamage() => false; - } -} diff --git a/Projectiles/Ranged/FlakKrakenHoldout.cs b/Projectiles/Ranged/FlakKrakenHoldout.cs new file mode 100644 index 0000000000..2eaeff6f2a --- /dev/null +++ b/Projectiles/Ranged/FlakKrakenHoldout.cs @@ -0,0 +1,166 @@ +using System; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Particles; +using CalamityMod.Projectiles.BaseProjectiles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.ID; +using static CalamityMod.Items.Weapons.Ranged.FlakKraken; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Projectiles.Ranged +{ + public class FlakKrakenHoldout : BaseGunHoldoutProjectile + { + public override int AssociatedItemID => ItemType(); + public override float RecoilResolveSpeed => 0.05f; + public override float MaxOffsetLengthFromArm => 30f; + public override float OffsetXUpwards => -18f; + public override float OffsetXDownwards => 15f; + public override float BaseOffsetY => -20f; + public override float OffsetYUpwards => 20f; + public override float OffsetYDownwards => 10f; + + public ref float ShootingTimer => ref Projectile.ai[0]; + public ref float TimerBetweenBursts => ref Projectile.ai[1]; + + // The type of dust used in the effects and the color of the particles that it'll use depending on the type of rocket used. + // It'll carry over to the projectiles that it shoots. + public static int DustEffectsID { get; set; } + public static Color EffectsColor { get; set; } + + public override void HoldoutAI() + { + // The vector between the player and the mouse. + Vector2 ownerToMouse = Owner.Calamity().mouseWorld - Owner.MountedCenter; + + // If the timer reaches Item.useTime, it'll shoot. + // It'll shoot once immediately as the timer reaches. + if (ShootingTimer >= HeldItem.useAnimation) + { + float adaptiveTimeBetweenShots = MathF.Floor(TimeBetweenShots * HeldItem.useAnimation / OriginalUseTime); + // Every X frames it'll shoot a projectile. + if (ShootingTimer % adaptiveTimeBetweenShots == 0f) + { + // We use the velocity of this projectile as its direction vector. + Vector2 direction = Projectile.velocity.SafeNormalize(Vector2.Zero); + + // Every time we shoot we use ammo. + // With this method we also use the item's stats, like the shoot speed, or the type of ammo it was used. + Owner.PickAmmo(Owner.ActiveItem(), out _, out float itemShootSpeed, out int itemDamage, out float itemKnockback, out int rocketTypeShot); + + // Decides the color of the effects depending on the type of rocket used. + switch (rocketTypeShot) + { + case ItemID.WetRocket: + DustEffectsID = 45; + EffectsColor = Color.RoyalBlue; + break; + case ItemID.LavaRocket: + DustEffectsID = DustID.Torch; + EffectsColor = Color.Red; + break; + case ItemID.HoneyRocket: + DustEffectsID = DustID.Honey; + EffectsColor = Color.Yellow; + break; + default: + DustEffectsID = 109; + EffectsColor = Color.Black; + break; + } + + // Spawns the projectile. + Projectile.NewProjectileDirect( + Projectile.GetSource_FromThis(), + GunTipPosition, + direction * itemShootSpeed, + ProjectileType(), + itemDamage, + itemKnockback, + Projectile.owner, + rocketTypeShot, + ownerToMouse.Length()); + + // Applies the knockback to the player. + Owner.velocity += ownerToMouse.SafeNormalize(Vector2.UnitY) * -OwnerKnockbackStrength; + + // Inside here go all the things that dedicated servers shouldn't spend resources on. + // Like visuals and sounds. + if (!Main.dedServ) + { + // By decreasing the offset length of the gun from the arms, we give an effect of recoil. + OffsetLengthFromArm = 10f; + + Owner.Calamity().GeneralScreenShakePower = 3.5f; + + Particle shootPulse = new DirectionalPulseRing(GunTipPosition, + Vector2.Zero, + Color.Gray * 0.7f, + new Vector2(0.5f, 1f), + Projectile.rotation, + 0.1f, + 0.4f, + 20); + GeneralParticleHandler.SpawnParticle(shootPulse); + + int smokeAmount = Main.rand.Next(12, 16 + 1); + for (int i = 0; i < smokeAmount; i++) + { + Particle smoke = new HeavySmokeParticle( + GunTipPosition, + direction.RotatedByRandom(MathHelper.ToRadians(25f)) * Main.rand.NextFloat(2f, 30f), + EffectsColor * 0.1f, + Main.rand.Next(45, 61), + Main.rand.NextFloat(.6f, 1.3f), + Main.rand.NextFloat(0.2f, 0.35f)); + GeneralParticleHandler.SpawnParticle(smoke); + } + + int dustAmount = Main.rand.Next(15, 20 + 1); + for (int i = 0; i < dustAmount; i++) + { + Dust shootDust = Dust.NewDustPerfect( + GunTipPosition, + DustEffectsID, + direction.RotatedByRandom(MathHelper.PiOver4 * 0.5f) * Main.rand.NextFloat(2f, 12f), + Scale: Main.rand.NextFloat(0.8f, 1f)); + shootDust.fadeIn = 100f; + shootDust.noLight = false; + shootDust.noLightEmittence = false; + } + + SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/FlakKrakenShoot") { Volume = 0.6f }, GunTipPosition); + } + + NetUpdate(); + } + + // When it has shot all the projectiles in the burst, reset all the variables and back to shooting. + if (ShootingTimer >= HeldItem.useAnimation + adaptiveTimeBetweenShots * (ProjectilesPerBurst - 1)) + { + ShootingTimer = 0f; + TimerBetweenBursts = 0f; + NetUpdate(); + } + } + + ShootingTimer++; + } + + public override void OnSpawn(IEntitySource source) + { + base.OnSpawn(source); + FrontArmStretch = Player.CompositeArmStretchAmount.ThreeQuarters; + } + + public void NetUpdate() + { + Projectile.netUpdate = true; + if (Projectile.netSpam >= 10) + Projectile.netSpam = 9; + } + } +} diff --git a/Projectiles/Ranged/FlakKrakenProj.cs b/Projectiles/Ranged/FlakKrakenProj.cs deleted file mode 100644 index f2e3b7084b..0000000000 --- a/Projectiles/Ranged/FlakKrakenProj.cs +++ /dev/null @@ -1,155 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using Microsoft.Xna.Framework; -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class FlakKrakenProj : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Ranged"; - public override void SetStaticDefaults() - { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; - } - - public override void SetDefaults() - { - Projectile.width = 54; - Projectile.height = 54; - Projectile.friendly = true; - Projectile.penetrate = -1; - Projectile.tileCollide = false; - Projectile.scale = 0.002f; - Projectile.timeLeft = 36000; - Projectile.DamageType = DamageClass.Ranged; - Projectile.ignoreWater = true; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; - } - - public override void AI() - { - if (Projectile.type != ModContent.ProjectileType() || - !Main.projectile[(int)Projectile.ai[1]].active || - Main.projectile[(int)Projectile.ai[1]].type != ModContent.ProjectileType()) - { - Projectile.Kill(); - return; - } - - // This code uses player-specific fields (such as the mouse), and does not need to be run for anyone - // other than its owner. - if (Main.myPlayer != Projectile.owner) - return; - - // This needs to happen retroactively due to Deadshot Brooch and other potential items boosting updates - Projectile.localNPCHitCooldown = 10 * Projectile.MaxUpdates; - - Projectile.rotation += 0.2f; - if (Projectile.localAI[0] < 1f) - { - Projectile.localAI[0] += 0.002f; - Projectile.scale += 0.002f; - Projectile.width = Projectile.height = (int)(50f * Projectile.scale); - } - else - { - Projectile.width = Projectile.height = 50; - } - Player player = Main.player[Projectile.owner]; - Vector2 projPos = player.RotatedRelativePoint(player.MountedCenter, true); - float projX = (float)Main.mouseX + Main.screenPosition.X - projPos.X; - float projY = (float)Main.mouseY + Main.screenPosition.Y - projPos.Y; - if (player.gravDir == -1f) - { - projY = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - projPos.Y; - } - if ((float.IsNaN(projX) && float.IsNaN(projY)) || (projX == 0f && projY == 0f)) - { - projX = (float)player.direction; - projY = 0f; - } - projPos += new Vector2(projX, projY); - float speed = 30f; - float speedScale = 3f; - Vector2 vectorPos = Projectile.Center; - if (Vector2.Distance(projPos, vectorPos) < 90f) - { - speed = 10f; - speedScale = 1f; - } - if (Vector2.Distance(projPos, vectorPos) < 30f) - { - speed = 3f; - speedScale = 0.3f; - } - if (Vector2.Distance(projPos, vectorPos) < 10f) - { - speed = 1f; - speedScale = 0.1f; - } - float projectileX = projPos.X - vectorPos.X; - float projectileY = projPos.Y - vectorPos.Y; - float projectileAdjust = (float)Math.Sqrt((double)(projectileX * projectileX + projectileY * projectileY)); - projectileAdjust = speed / projectileAdjust; - projectileX *= projectileAdjust; - projectileY *= projectileAdjust; - if (Projectile.velocity.X < projectileX) - { - Projectile.velocity.X = Projectile.velocity.X + speedScale; - if (Projectile.velocity.X < 0f && projectileX > 0f) - { - Projectile.velocity.X = Projectile.velocity.X + speedScale; - } - } - else if (Projectile.velocity.X > projectileX) - { - Projectile.velocity.X = Projectile.velocity.X - speedScale; - if (Projectile.velocity.X > 0f && projectileX < 0f) - { - Projectile.velocity.X = Projectile.velocity.X - speedScale; - } - } - if (Projectile.velocity.Y < projectileY) - { - Projectile.velocity.Y = Projectile.velocity.Y + speedScale; - if (Projectile.velocity.Y < 0f && projectileY > 0f) - { - Projectile.velocity.Y = Projectile.velocity.Y + speedScale; - } - } - else if (Projectile.velocity.Y > projectileY) - { - Projectile.velocity.Y = Projectile.velocity.Y - speedScale; - if (Projectile.velocity.Y > 0f && projectileY < 0f) - { - Projectile.velocity.Y = Projectile.velocity.Y - speedScale; - } - } - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 180); - - public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 180); - - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) - { - modifiers.SourceDamage *= Projectile.localAI[0]; - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(255, 200, 50, Projectile.alpha); - } - - public override bool PreDraw(ref Color lightColor) - { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); - return false; - } - } -} diff --git a/Projectiles/Ranged/FlakKrakenProjectile.cs b/Projectiles/Ranged/FlakKrakenProjectile.cs new file mode 100644 index 0000000000..962a9ba3c5 --- /dev/null +++ b/Projectiles/Ranged/FlakKrakenProjectile.cs @@ -0,0 +1,270 @@ +using System.IO; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using static CalamityMod.Items.Weapons.Ranged.FlakKraken; +using static CalamityMod.Projectiles.Ranged.FlakKrakenHoldout; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Projectiles.Ranged +{ + public class FlakKrakenProjectile : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Ranged"; + public override string Texture => "CalamityMod/Projectiles/Summon/CalamarisLamentProjectile"; + + public ref float RocketID => ref Projectile.ai[0]; + public ref float DistanceOwnerMouse => ref Projectile.ai[1]; + public bool IsShrapnel + { + get => Projectile.ai[2] == 1f; + set => Projectile.ai[2] = value == true ? 1f : 0f; + } + public bool HasHitEnemyWithInitialShot; + + public Player Owner { get; set; } + + public override void SetStaticDefaults() + { + Main.projFrames[Type] = 5; + ProjectileID.Sets.TrailingMode[Type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 12; + } + + public override void SetDefaults() + { + Projectile.DamageType = DamageClass.Ranged; + Projectile.extraUpdates = 1; + Projectile.width = Projectile.height = 28; + Projectile.timeLeft = 600; + Projectile.localNPCHitCooldown = -1; + + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.usesLocalNPCImmunity = true; + } + + // Syncs other variables that can't fit into the Projectile.ai[] array. + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(HasHitEnemyWithInitialShot); + } + public override void ReceiveExtraAI(BinaryReader reader) + { + HasHitEnemyWithInitialShot = reader.ReadBoolean(); + } + + public override void AI() + { + // Enforces the gravity. + if (IsShrapnel) + { + if (Projectile.velocity.Y < 25f) + Projectile.velocity.Y += ProjectileGravityStrength; + } + // Scale for non Shrapnel + if (!IsShrapnel) + { + Projectile.scale = 1.5f; + Projectile.extraUpdates = 3; + } + + // Rotates towards its velocity. + Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; + + Projectile.frameCounter++; + if (Projectile.frameCounter >= 4) + { + Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Type]; + Projectile.frameCounter = 0; + } + + // If it's the initial shot and the shot has gone past the distance of the player and the mouse when shooting, + // split into shrapnel. + if (!IsShrapnel && !Projectile.WithinRange(Owner.MountedCenter, DistanceOwnerMouse)) + Projectile.Kill(); + + // Below here go all the things that dedicated servers shouldn't spend resources on. + // Like visuals and sounds. + if (Main.dedServ) + return; + + // The projectile will fade away as its time alive is ending. + Projectile.alpha = (int)Utils.Remap(Projectile.timeLeft, 30f, 0f, 0f, 255f); + + // Shrapnel trail + if (IsShrapnel) + { + if (Projectile.timeLeft % 2 == 0 && Projectile.timeLeft <= 590) + { + AltSparkParticle spark = new AltSparkParticle(Projectile.Center - Projectile.velocity * 1.5f, Projectile.velocity * 0.01f, false, 8, 1.3f, EffectsColor * 0.135f); + GeneralParticleHandler.SpawnParticle(spark); + } + } + else + { + Vector2 dustPos = Projectile.Center - Projectile.velocity * 3 + Main.rand.NextVector2Circular(12, 12); + Dust dust = Dust.NewDustPerfect(dustPos, Main.rand.NextBool(4) ? 191 : DustEffectsID); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(1.4f, 1.65f); + dust.velocity = -Projectile.velocity * Main.rand.NextFloat(0.1f, 0.7f); + } + + Dust trailDust = Dust.NewDustDirect(Projectile.position, + Projectile.width, + Projectile.height, + DustEffectsID, + Scale: Main.rand.NextFloat(0.5f, 0.8f), + Alpha: 127); + trailDust.noGravity = true; + trailDust.noLight = true; + trailDust.alpha = (int)Utils.Remap(Projectile.timeLeft, 30f, 0f, 127f, 0f); + + Lighting.AddLight(Projectile.Center, Color.White.ToVector3() * (IsShrapnel ? 0.3f : 1f)); + } + + public override void OnSpawn(IEntitySource source) + { + Owner = Main.player[Projectile.owner]; + Projectile.scale = 1.5f; + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(BuffType(), 180); + if (!IsShrapnel) + HasHitEnemyWithInitialShot = true; + } + + public override void OnHitPlayer(Player target, Player.HurtInfo info) + { + target.AddBuff(BuffType(), 180); + if (!IsShrapnel) + HasHitEnemyWithInitialShot = true; + } + + // The initial shot deals less damage. + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) => modifiers.SourceDamage *= IsShrapnel ? 1f : InitialShotDamageMultiplier; + public override void ModifyHitPlayer(Player target, ref Player.HurtModifiers modifiers) => modifiers.SourceDamage *= IsShrapnel ? 1f : InitialShotDamageMultiplier; + + public override void OnKill(int timeLeft) + { + var info = new CalamityUtils.RocketBehaviorInfo((int)RocketID) + { + // Since we use our own spawning method for the cluster rockets, we don't need them to shoot anything, + // we'll do it ourselves. + clusterProjectileID = ProjectileID.None, + destructiveClusterProjectileID = ProjectileID.None, + }; + int blastRadius = Projectile.RocketBehavior(info); + Projectile.ExpandHitboxBy((float)blastRadius); + Projectile.Damage(); + + if (!IsShrapnel) + { + bool usedClusterRockets = RocketID == ItemID.ClusterRocketI || RocketID == ItemID.ClusterRocketII; + int flakAmount = usedClusterRockets ? ClusterShrapnelAmount : ShrapnelAmount; + for (int i = 0; i < flakAmount; i++) + { + Projectile shrapnel = Projectile.NewProjectileDirect( + Projectile.GetSource_FromThis(), + Projectile.Center, + Projectile.velocity.SafeNormalize(-Vector2.UnitY).RotatedByRandom(usedClusterRockets ? ClusterShrapnelAngleOffset : ShrapnelAngleOffset) * ProjectileShootSpeed * Main.rand.NextFloat(0.45f, 0.85f), + ProjectileType(), + (int)(Projectile.damage * (HasHitEnemyWithInitialShot ? InitialShotHitShrapnelDamageMultiplier : .6f)), + Projectile.knockBack, + Projectile.owner, + RocketID, + ai2: 1f); + + // Since the shrapnel and the initial shot are the same projectile, + // and we want to apply the damage penalty for hitting with the initial shot, + // all shrapnel will have this bool on and we'll apply the penalty here. + if (HasHitEnemyWithInitialShot) + shrapnel.ModProjectile().HasHitEnemyWithInitialShot = true; + } + } + + // Since we do our own spread for the cluster rockets, it won't explode tiles. + // So we do it manually here. + if (RocketID == ItemID.ClusterRocketII) + Projectile.ExplodeTiles(blastRadius, info.respectStandardBlastImmunity, info.tilesToCheck, info.wallsToCheck); + + // Inside here go all the things that dedicated servers shouldn't spend resources on. + // Like visuals and sounds. + if (Main.dedServ) + return; + + // These effects will only run if the initial shot is splitting, + // or the shrapnel doesn't have the damage pentalty, so we don't have effect overload. + if (!IsShrapnel || (IsShrapnel && !HasHitEnemyWithInitialShot)) + { + int dustAmount = Main.rand.Next(20, 30 + 1); + for (int i = 0; i < dustAmount; i++) + { + Dust boomDust = Dust.NewDustPerfect(Projectile.Center, + DustEffectsID, + Main.rand.NextVector2Circular(5f, 5f), + newColor: EffectsColor, + Scale: Main.rand.NextFloat(.8f, 1.2f)); + boomDust.noLight = true; + boomDust.noLightEmittence = true; + } + + Particle boomRing = new DirectionalPulseRing(Projectile.Center, + Vector2.Zero, + Color.White * 0.3f, + Vector2.One, + 0f, + Projectile.width / 1560f, + Projectile.width / 156f, + 20); + GeneralParticleHandler.SpawnParticle(boomRing); + + int blobAmount = Main.rand.Next(4, 6 + 1); + for (int i = 0; i < blobAmount; i++) + { + Particle blob = new WaterGlobParticle(Projectile.Center, + Main.rand.NextVector2Circular(5f, 5f), + Main.rand.NextFloat(0.8f, 1.2f)); + blob.Color = EffectsColor; + GeneralParticleHandler.SpawnParticle(blob); + } + + int mistAmount = Main.rand.Next(3, 5 + 1); + for (int mistIndex = 0; mistIndex < mistAmount; mistIndex++) + { + float angle = MathHelper.TwoPi / mistAmount * mistIndex; + Vector2 velocity = angle.ToRotationVector2() * Main.rand.NextFloat(2f, 7f); + Particle boomMist = new HeavySmokeParticle(Projectile.Center, + velocity, + EffectsColor * Main.rand.NextFloat(0.15f, 0.25f), + Main.rand.Next(45, 61), + Main.rand.NextFloat(.4f, 1.1f), + Main.rand.NextFloat(0.2f, 0.35f)); + GeneralParticleHandler.SpawnParticle(boomMist); + } + } + } + + public override bool PreDraw(ref Color lightColor) + { + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + Rectangle frame = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); + Color drawColor = IsShrapnel ? Projectile.GetAlpha(lightColor) : Color.Black; + Vector2 origin = frame.Size() * 0.5f; + + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor * 0.3f); + + Main.EntitySpriteDraw(texture, drawPosition, frame, drawColor, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None); + + return false; + } + } +} diff --git a/Projectiles/Ranged/FlakToxicannonHoldout.cs b/Projectiles/Ranged/FlakToxicannonHoldout.cs new file mode 100644 index 0000000000..05b47dfeeb --- /dev/null +++ b/Projectiles/Ranged/FlakToxicannonHoldout.cs @@ -0,0 +1,144 @@ +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Particles; +using CalamityMod.Projectiles.BaseProjectiles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using static CalamityMod.Items.Weapons.Ranged.FlakToxicannon; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Projectiles.Ranged +{ + public class FlakToxicannonHoldout : BaseGunHoldoutProjectile + { + public override int AssociatedItemID => ItemType(); + public override float MaxOffsetLengthFromArm => 38f; + public override float RecoilResolveSpeed => 0.1f; + public override float OffsetXUpwards => -10f; + public override float OffsetXDownwards => 2f; + public override float BaseOffsetY => -10f; + public override float OffsetYUpwards => 10f; + public override float OffsetYDownwards => 5f; + + public ref float ShootingTimer => ref Projectile.ai[0]; + public ref float TimerBetweenBursts => ref Projectile.ai[1]; + + // The type of dust used in the effects and the color of the particles that it'll use depending on the type of rocket used. + // It'll carry over to the projectiles that it shoots. + public static int DustEffectsID { get; set; } + public static Color EffectsColor { get; set; } + + public override void HoldoutAI() + { + // The center of the player, taking into account if they have a mount or not. + Vector2 mountedCenter = Owner.MountedCenter; + + // The vector between the player and the mouse. + Vector2 ownerToMouse = Owner.Calamity().mouseWorld - mountedCenter; + + // If the timer reaches Item.useTime, it'll shoot. + // It'll shoot once immediately as the timer reaches. + if (ShootingTimer >= HeldItem.useAnimation) + { + // We use the velocity of this projectile as its direction vector. + Vector2 direction = Projectile.velocity.SafeNormalize(Vector2.Zero); + + // Every time we shoot we use ammo. + // With this method we also use the item's stats, like the shoot speed, or the type of ammo it was used. + Owner.PickAmmo(Owner.ActiveItem(), out _, out float itemShootSpeed, out int itemDamage, out float itemKnockback, out int rocketTypeShot); + + // Decides the color of the effects depending on the type of rocket used. + switch (rocketTypeShot) + { + case ItemID.WetRocket: + DustEffectsID = 45; + EffectsColor = Color.RoyalBlue; + break; + case ItemID.LavaRocket: + DustEffectsID = DustID.Torch; + EffectsColor = Color.Red; + break; + case ItemID.HoneyRocket: + DustEffectsID = DustID.Honey; + EffectsColor = Color.Yellow; + break; + default: + DustEffectsID = 298; + EffectsColor = Color.GreenYellow; + break; + } + + // Spawns the projectile. + Projectile.NewProjectileDirect( + Projectile.GetSource_FromThis(), + GunTipPosition, + direction * itemShootSpeed, + ProjectileType(), + itemDamage, + itemKnockback, + Projectile.owner, + rocketTypeShot, + ownerToMouse.Length()); + + // Applies the knockback to the player. + Owner.velocity += ownerToMouse.SafeNormalize(Vector2.UnitY) * -OwnerKnockbackStrength; + + // Inside here go all the things that dedicated servers shouldn't spend resources on. + // Like visuals and sounds. + if (!Main.dedServ) + { + // By decreasing the offset length of the gun from the arms, we give an effect of recoil. + OffsetLengthFromArm = 25f; + + Owner.Calamity().GeneralScreenShakePower = 2f; + + Particle shootPulse = new DirectionalPulseRing(GunTipPosition, + Vector2.Zero, + Color.Gray * 0.7f, + new Vector2(0.5f, 1f), + Projectile.rotation, + 0.1f, + 0.4f, + 20); + GeneralParticleHandler.SpawnParticle(shootPulse); + + int smokeAmount = Main.rand.Next(8, 12 + 1); + for (int i = 0; i < smokeAmount; i++) + { + Particle smoke = new HeavySmokeParticle( + GunTipPosition, + direction.RotatedByRandom(MathHelper.ToRadians(25f)) * Main.rand.NextFloat(2f, 30f), + EffectsColor * 0.4f, + Main.rand.Next(45, 61), + Main.rand.NextFloat(.6f, 1.3f), + Main.rand.NextFloat(0.2f, 0.35f), + 0, + true); + GeneralParticleHandler.SpawnParticle(smoke); + } + + int dustAmount = Main.rand.Next(10, 15 + 1); + for (int i = 0; i < dustAmount; i++) + { + Dust shootDust = Dust.NewDustPerfect( + GunTipPosition, + DustEffectsID, + direction.RotatedByRandom(MathHelper.PiOver4 * 0.5f) * Main.rand.NextFloat(2f, 12f), + Scale: Main.rand.NextFloat(0.8f, 1f)); + shootDust.fadeIn = 100f; + shootDust.noLight = false; + shootDust.noLightEmittence = false; + } + + SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/FlakKrakenShoot") { Pitch = 0.65f, Volume = 0.5f }, GunTipPosition); + } + + ShootingTimer = 0f; + Projectile.netUpdate = true; + } + + ShootingTimer++; + } + } +} diff --git a/Projectiles/Ranged/FlakToxicannonProjectile.cs b/Projectiles/Ranged/FlakToxicannonProjectile.cs new file mode 100644 index 0000000000..01b0f9336b --- /dev/null +++ b/Projectiles/Ranged/FlakToxicannonProjectile.cs @@ -0,0 +1,265 @@ +using System.IO; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using static CalamityMod.Items.Weapons.Ranged.FlakToxicannon; +using static CalamityMod.Projectiles.Ranged.FlakToxicannonHoldout; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Projectiles.Ranged +{ + public class FlakToxicannonProjectile : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Ranged"; + public override string Texture => "CalamityMod/Projectiles/Enemy/FlakAcid"; + public ref float RocketID => ref Projectile.ai[0]; + public ref float DistanceOwnerMouse => ref Projectile.ai[1]; + public bool IsShrapnel + { + get => Projectile.ai[2] == 1f; + set => Projectile.ai[2] = value == true ? 1f : 0f; + } + public bool HasHitEnemyWithInitialShot; + + public Player Owner { get; set; } + + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailingMode[Type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 12; + } + + public override void SetDefaults() + { + Projectile.DamageType = DamageClass.Ranged; + Projectile.extraUpdates = 1; + Projectile.width = Projectile.height = 23; + Projectile.timeLeft = 600; + Projectile.localNPCHitCooldown = -1; + + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.usesLocalNPCImmunity = true; + } + + // Syncs other variables that can't fit into the Projectile.ai[] array. + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(HasHitEnemyWithInitialShot); + } + public override void ReceiveExtraAI(BinaryReader reader) + { + HasHitEnemyWithInitialShot = reader.ReadBoolean(); + } + + public override void AI() + { + // Enforces the gravity. + if (IsShrapnel) + { + if (Projectile.velocity.Y < 25f) + Projectile.velocity.Y += ProjectileGravityStrength; + } + // Scale for non Shrapnel + if (!IsShrapnel) + { + Projectile.scale = 1.3f; + Projectile.extraUpdates = 2; + } + + // Rotates towards its velocity. + Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; + + // If it's the initial shot and the shot has gone past the distance of the player and the mouse when shooting, + // split into shrapnel. + if (!IsShrapnel && !Projectile.WithinRange(Owner.MountedCenter, DistanceOwnerMouse)) + Projectile.Kill(); + + // Below here go all the things that dedicated servers shouldn't spend resources on. + // Like visuals and sounds. + if (Main.dedServ) + return; + + // The projectile will fade away as its time alive is ending. + Projectile.alpha = (int)Utils.Remap(Projectile.timeLeft, 30f, 0f, 0f, 255f); + + // Shrapnel trail + if (IsShrapnel) + { + if (Projectile.timeLeft % 2 == 0 && Projectile.timeLeft <= 590) + { + AltSparkParticle spark = new AltSparkParticle(Projectile.Center - Projectile.velocity * 1.5f, Projectile.velocity * 0.01f, false, 8, 1.3f, EffectsColor * 0.135f); + GeneralParticleHandler.SpawnParticle(spark); + } + } + else + { + Vector2 dustPos = Projectile.Center - Projectile.velocity * 3 + Main.rand.NextVector2Circular(12, 12); + Dust dust = Dust.NewDustPerfect(dustPos, Main.rand.NextBool(3) ? 299 : DustEffectsID); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(1.4f, 1.65f); + dust.velocity = -Projectile.velocity * Main.rand.NextFloat(0.1f, 0.7f); + } + + Dust trailDust = Dust.NewDustDirect(Projectile.position, + Projectile.width, + Projectile.height, + Main.rand.NextBool(3) ? 299 : DustEffectsID, + Scale: Main.rand.NextFloat(0.5f, 0.8f), + Alpha: 127); + trailDust.noGravity = true; + trailDust.noLight = true; + trailDust.alpha = (int)Utils.Remap(Projectile.timeLeft, 30f, 0f, 127f, 0f); + + Lighting.AddLight(Projectile.Center, Color.GreenYellow.ToVector3() * (IsShrapnel ? 1.5f : 2.5f)); + } + + public override void OnSpawn(IEntitySource source) + { + Owner = Main.player[Projectile.owner]; + Projectile.scale = 1.5f; + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(BuffType(), 180); + if (!IsShrapnel) + HasHitEnemyWithInitialShot = true; + } + + public override void OnHitPlayer(Player target, Player.HurtInfo info) + { + target.AddBuff(BuffType(), 180); + if (!IsShrapnel) + HasHitEnemyWithInitialShot = true; + } + + // The initial shot deals less damage. + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) => modifiers.SourceDamage *= IsShrapnel ? 1f : InitialShotDamageMultiplier; + public override void ModifyHitPlayer(Player target, ref Player.HurtModifiers modifiers) => modifiers.SourceDamage *= IsShrapnel ? 1f : InitialShotDamageMultiplier; + + public override void OnKill(int timeLeft) + { + var info = new CalamityUtils.RocketBehaviorInfo((int)RocketID) + { + // Since we use our own spawning method for the cluster rockets, we don't need them to shoot anything, + // we'll do it ourselves. + clusterProjectileID = ProjectileID.None, + destructiveClusterProjectileID = ProjectileID.None, + }; + int blastRadius = Projectile.RocketBehavior(info); + Projectile.ExpandHitboxBy((float)blastRadius); + Projectile.Damage(); + + if (!IsShrapnel) + { + bool usedClusterRockets = RocketID == ItemID.ClusterRocketI || RocketID == ItemID.ClusterRocketII; + int flakAmount = usedClusterRockets ? ClusterShrapnelAmount : ShrapnelAmount; + for (int i = 0; i < flakAmount; i++) + { + Projectile shrapnel = Projectile.NewProjectileDirect( + Projectile.GetSource_FromThis(), + Projectile.Center, + Projectile.velocity.SafeNormalize(-Vector2.UnitY).RotatedByRandom(usedClusterRockets ? ClusterShrapnelAngleOffset : ShrapnelAngleOffset) * ProjectileShootSpeed * Main.rand.NextFloat(0.45f, 0.85f), + ProjectileType(), + (int)(Projectile.damage * (HasHitEnemyWithInitialShot ? InitialShotHitShrapnelDamageMultiplier : .6f)), + Projectile.knockBack, + Projectile.owner, + RocketID, + ai2: 1f); + + // Since the shrapnel and the initial shot are the same projectile, + // and we want to apply the damage penalty for hitting with the initial shot, + // all shrapnel will have this bool on and we'll apply the penalty here. + if (HasHitEnemyWithInitialShot) + shrapnel.ModProjectile().HasHitEnemyWithInitialShot = true; + } + } + + // Since we do our own spread for the cluster rockets, it won't explode tiles. + // So we do it manually here. + if (RocketID == ItemID.ClusterRocketII) + Projectile.ExplodeTiles(blastRadius, info.respectStandardBlastImmunity, info.tilesToCheck, info.wallsToCheck); + + // Inside here go all the things that dedicated servers shouldn't spend resources on. + // Like visuals and sounds. + if (Main.dedServ) + return; + + for (int i = 0; i < (IsShrapnel ? 4 : 12); ++i) + { + int sprayLifetime = Main.rand.Next(15, 20 + 1); + float sprayScale = Main.rand.NextFloat(0.6f, 0.8f); + Color sprayColor = Main.rand.NextBool(3) ? Color.Chartreuse : EffectsColor; + + if (Main.rand.NextBool(14)) + sprayScale *= 2f; + + float randomSpeedMultiplier = Main.rand.NextFloat(1.25f, 2.25f); + Vector2 sprayVelocity = Main.rand.NextVector2Unit() * 5 * randomSpeedMultiplier; + sprayVelocity.Y -= 5f; + BloodParticle spray = new BloodParticle(Projectile.Center, sprayVelocity, sprayLifetime, sprayScale, sprayColor); + GeneralParticleHandler.SpawnParticle(spray); + } + + // These effects will only run if the initial shot is splitting, + // or the shrapnel doesn't have the damage pentalty, so we don't have effect overload. + if (!IsShrapnel || (IsShrapnel && !HasHitEnemyWithInitialShot)) + { + int dustAmount = Main.rand.Next(14, 23 + 1); + for (int i = 0; i < dustAmount; i++) + { + Dust boomDust = Dust.NewDustPerfect(Projectile.Center, + Main.rand.NextBool(4) ? 299 : DustEffectsID, + Main.rand.NextVector2Circular(5f, 5f), + newColor: EffectsColor, + Scale: Main.rand.NextFloat(.8f, 1.2f)); + boomDust.noLight = true; + boomDust.noLightEmittence = true; + } + + Particle boomRing = new DirectionalPulseRing(Projectile.Center, + Vector2.Zero, + Color.White * 0.3f, + Vector2.One, + 0f, + Projectile.width / 1560f, + Projectile.width / 156f, + 20); + GeneralParticleHandler.SpawnParticle(boomRing); + + int mistAmount = Main.rand.Next(3, 5 + 1); + for (int mistIndex = 0; mistIndex < mistAmount; mistIndex++) + { + float angle = MathHelper.TwoPi / mistAmount * mistIndex; + Vector2 velocity = angle.ToRotationVector2() * Main.rand.NextFloat(2f, 7f); + Particle boomMist = new HeavySmokeParticle(Projectile.Center, + velocity, + EffectsColor * Main.rand.NextFloat(0.35f, 0.55f), + Main.rand.Next(45, 61), + Main.rand.NextFloat(.4f, 1.1f), + Main.rand.NextFloat(0.2f, 0.35f), + 0, + true); + + GeneralParticleHandler.SpawnParticle(boomMist); + } + } + } + + public override bool PreDraw(ref Color lightColor) + { + Texture2D texture = IsShrapnel ? Request("CalamityMod/Projectiles/Environment/AcidDrop").Value : Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + + Color drawColor = Projectile.GetAlpha(lightColor); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], drawColor * 0.35f, 1, texture); + + return false; + } + } +} diff --git a/Projectiles/Ranged/FlareBat.cs b/Projectiles/Ranged/FlareBat.cs index 60fea41a64..9912900d23 100644 --- a/Projectiles/Ranged/FlareBat.cs +++ b/Projectiles/Ranged/FlareBat.cs @@ -48,7 +48,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.velocity *= 1.02f; } } - int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 0, default, 1f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 0, default, 1f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 0.2f; Main.dust[dust].position = (Main.dust[dust].position + Projectile.Center) / 2f; @@ -67,7 +67,7 @@ namespace CalamityMod.Projectiles.Ranged if (Projectile.localAI[0] > 0f) Projectile.localAI[0]--; - + // Makes the bat home onto enemies after piercing once if (Projectile.penetrate == 1 && Projectile.localAI[0] <= 0f) CalamityUtils.HomeInOnNPC(Projectile, false, 550f, 12f, 20f); @@ -89,7 +89,7 @@ namespace CalamityMod.Projectiles.Ranged { for (int k = 0; k < 10; k++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 6, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Torch, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } } diff --git a/Projectiles/Ranged/Flash.cs b/Projectiles/Ranged/Flash.cs index 923c04e53a..1c2fca754b 100644 --- a/Projectiles/Ranged/Flash.cs +++ b/Projectiles/Ranged/Flash.cs @@ -1,6 +1,6 @@ +using System; using CalamityMod.Items.Weapons.Rogue; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -72,7 +72,7 @@ namespace CalamityMod.Projectiles.Ranged randAdjust = rand3 / randAdjust; rand1 *= randAdjust; rand2 *= randAdjust; - int flashDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 264, 0f, 0f, 100, dustColor, 2f); + int flashDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.PortalBoltTrail, 0f, 0f, 100, dustColor, 2f); Dust dust = Main.dust[flashDust]; dust.noGravity = true; dust.position.X = Projectile.Center.X; diff --git a/Projectiles/Ranged/FlashRoundProj.cs b/Projectiles/Ranged/FlashRoundProj.cs index 970e73351d..9d44f9e9f9 100644 --- a/Projectiles/Ranged/FlashRoundProj.cs +++ b/Projectiles/Ranged/FlashRoundProj.cs @@ -1,17 +1,19 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { public class FlashRoundProj : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Ranged"; + public bool Exploding = false; + public float ExplosionPower = 1.5f; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 15; ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } @@ -19,49 +21,96 @@ namespace CalamityMod.Projectiles.Ranged { Projectile.width = 4; Projectile.height = 4; - Projectile.aiStyle = ProjAIStyleID.Arrow; Projectile.friendly = true; Projectile.DamageType = DamageClass.Ranged; - Projectile.penetrate = 1; + Projectile.penetrate = -1; Projectile.timeLeft = 600; - Projectile.extraUpdates = 3; + Projectile.extraUpdates = 2; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 20; + Projectile.aiStyle = ProjAIStyleID.Arrow; AIType = ProjectileID.Bullet; Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } public override void AI() { - Lighting.AddLight(Projectile.Center, 0.1f, 0.1f, 0.1f); + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + Projectile.spriteDirection = Projectile.direction; + Lighting.AddLight(Projectile.Center, Color.White.ToVector3() * (Exploding ? 1.5f : 0.2f)); Projectile.localAI[0] += 1f; - if (Projectile.localAI[0] > 4f) + + if (Exploding) { - if (Main.rand.NextBool(3)) + if (Projectile.timeLeft == 59) { - int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), 1, 1, 264, 0f, 0f, 0, default, 0.5f); - Main.dust[dust].alpha = Projectile.alpha; - Main.dust[dust].velocity *= 0f; - Main.dust[dust].noGravity = true; + SoundEngine.PlaySound(SoundID.Item93 with { Pitch = 0.55f, Volume = 0.4f }, Projectile.Center); + } + Projectile.velocity = Vector2.Zero; + + Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(4) ? 91 : 264, (new Vector2(4, 4).RotatedByRandom(100) * Main.rand.NextFloat(0.9f, 1.2f)) * ExplosionPower); + dust.scale = Main.rand.NextFloat(0.75f, 0.9f) * ExplosionPower; + dust.noGravity = true; + + if (Projectile.timeLeft <= 50 && ExplosionPower > 0.5f) + ExplosionPower -= 0.015f; + } + else + { + if (Projectile.localAI[0] > 4f) + { + if (Main.rand.NextBool()) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, 63, -Projectile.velocity * Main.rand.NextFloat(0.9f, 1.1f)); + dust.scale = Main.rand.NextFloat(0.7f, 0.85f); + dust.noGravity = true; + } } } } public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesFromEdge(Projectile, 0, lightColor); + if (Projectile.localAI[0] > 6f && !Exploding) + CalamityUtils.DrawAfterimagesFromEdge(Projectile, 0, Color.White); + return false; + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + if (!Exploding) + { + Projectile.timeLeft = 60; + Exploding = true; + Projectile.damage = (int)(Projectile.damage * 0.15f); + Projectile.ExpandHitboxBy(100); + Projectile.alpha = 255; + } + target.AddBuff(BuffID.Confused, 300); + } + public override bool OnTileCollide(Vector2 oldVelocity) + { + if (!Exploding) + { + Projectile.timeLeft = 60; + Exploding = true; + Projectile.damage = (int)(Projectile.damage * 0.15f); + Projectile.ExpandHitboxBy(100); + Projectile.alpha = 255; + Projectile.tileCollide = false; + } return false; } - public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item93, Projectile.position); - if (Projectile.owner == Main.myPlayer) + if (!Exploding) { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.25), 0f, Projectile.owner, 0f, 0f); - } - for (int k = 0; k < 5; k++) - { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 264, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); + for (int k = 0; k < 9; k++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, 63, new Vector2(3, 3).RotatedByRandom(100) * Main.rand.NextFloat(0.9f, 1.1f)); + dust.scale = Main.rand.NextFloat(0.6f, 0.75f); + dust.noGravity = true; + } } } } diff --git a/Projectiles/Ranged/FlurrystormCannonShooting.cs b/Projectiles/Ranged/FlurrystormCannonShooting.cs index 56c42706c7..3e0da96543 100644 --- a/Projectiles/Ranged/FlurrystormCannonShooting.cs +++ b/Projectiles/Ranged/FlurrystormCannonShooting.cs @@ -1,6 +1,6 @@ -using CalamityMod.Items.Weapons.Ranged; +using System; +using CalamityMod.Items.Weapons.Ranged; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -64,20 +64,12 @@ namespace CalamityMod.Projectiles.Ranged { fireRate++; } - if (Projectile.ai[0] >= 360f) + if (Projectile.ai[0] >= 360f) // Full speed after 6 seconds { fireRate++; } - if (Projectile.ai[0] >= 420f) - { - fireRate++; - } - if (Projectile.ai[0] >= 480f) //full speed after 8 seconds - { - fireRate++; - } - int initialRate = 24; - int fireRateMult = 2; + int initialRate = 26; + int fireRateMult = 3; Projectile.ai[1] -= 1f; bool shouldShoot = false; if (Projectile.ai[1] <= 0f) @@ -85,7 +77,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.ai[1] = (float)(initialRate - fireRateMult * fireRate); shouldShoot = true; } - bool canShoot = player.channel && player.HasAmmo(player.ActiveItem()) && !player.noItems && !player.CCed; + bool canShoot = !player.CantUseHoldout() && player.HasAmmo(player.ActiveItem()); if (Projectile.localAI[0] > 0f) { Projectile.localAI[0] -= 1f; @@ -134,14 +126,14 @@ namespace CalamityMod.Projectiles.Ranged snowballVel = -Vector2.UnitY; } Vector2 sourceS = source + Utils.RandomVector2(Main.rand, -5f, 5f); - snowballVel.X += Main.rand.NextFloat(-2.25f, 2.25f); - snowballVel.Y += Main.rand.NextFloat(-2.25f, 2.25f); + snowballVel.X += Main.rand.NextFloat(-2f, 2f); + snowballVel.Y += Main.rand.NextFloat(-2f, 2f); int snowball = Projectile.NewProjectile(Projectile.GetSource_FromThis(), sourceS, snowballVel, projType, dmg, kBack, Projectile.owner); if (snowball.WithinBounds(Main.maxProjectiles)) { Main.projectile[snowball].noDropItem = true; Main.projectile[snowball].DamageType = DamageClass.Ranged; - Main.projectile[snowball].extraUpdates += Main.rand.Next(0,2); + Main.projectile[snowball].extraUpdates += Main.rand.Next(0, 2); } if (Main.rand.NextBool(5)) //ice chunk diff --git a/Projectiles/Ranged/FlurrystormIceChunk.cs b/Projectiles/Ranged/FlurrystormIceChunk.cs index 58cc0c9083..33f031585d 100644 --- a/Projectiles/Ranged/FlurrystormIceChunk.cs +++ b/Projectiles/Ranged/FlurrystormIceChunk.cs @@ -1,8 +1,8 @@ -using Terraria; +using CalamityMod.Buffs.StatDebuffs; +using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Buffs.StatDebuffs; -using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Ranged //icicle dust if (Main.rand.NextBool()) { - int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 68, Projectile.velocity.X, Projectile.velocity.Y, 0, default, 1.1f); + int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.BlueCrystalShard, Projectile.velocity.X, Projectile.velocity.Y, 0, default, 1.1f); Main.dust[index2].noGravity = true; } } @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Ranged SoundEngine.PlaySound(SoundID.Item27, Projectile.position); for (int index1 = 0; index1 < 5; ++index1) { - int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 68, 0f, 0f, 0, default, 1f); + int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.BlueCrystalShard, 0f, 0f, 0, default, 1f); Main.dust[index2].noGravity = true; Main.dust[index2].velocity *= 1.5f; Main.dust[index2].scale *= 0.9f; diff --git a/Projectiles/Ranged/FlurrystormIceShard.cs b/Projectiles/Ranged/FlurrystormIceShard.cs index d6e3535fd5..343a0ebc35 100644 --- a/Projectiles/Ranged/FlurrystormIceShard.cs +++ b/Projectiles/Ranged/FlurrystormIceShard.cs @@ -1,8 +1,8 @@ +using CalamityMod.Buffs.StatDebuffs; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Buffs.StatDebuffs; -using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.Ranged int splash = 0; while (splash < 4) { - Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 68, -Projectile.velocity.X * 0.15f, -Projectile.velocity.Y * 0.10f, 150, default, 0.9f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.BlueCrystalShard, -Projectile.velocity.X * 0.15f, -Projectile.velocity.Y * 0.10f, 150, default, 0.9f); splash += 1; } } diff --git a/Projectiles/Ranged/FossilShard.cs b/Projectiles/Ranged/FossilShard.cs index ce132afeee..8f03888039 100644 --- a/Projectiles/Ranged/FossilShard.cs +++ b/Projectiles/Ranged/FossilShard.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Projectiles.Ranged { for (int i = 0; i <= 2; i++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 32, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Sand, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } } diff --git a/Projectiles/Ranged/FreedomStarBeam.cs b/Projectiles/Ranged/FreedomStarBeam.cs index faa02c3111..859e5d49d5 100644 --- a/Projectiles/Ranged/FreedomStarBeam.cs +++ b/Projectiles/Ranged/FreedomStarBeam.cs @@ -1,7 +1,7 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; +using System; using System.IO; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; using Terraria.Enums; @@ -203,7 +203,7 @@ namespace CalamityMod.Projectiles.Ranged if (Projectile.velocity == Vector2.Zero) return false; - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; float beamLength = Projectile.ai[0]; Vector2 centerFloored = Projectile.Center.Floor() + Projectile.velocity * Projectile.scale * BeamRenderTileOffset; Vector2 scaleVec = new Vector2(Projectile.scale); diff --git a/Projectiles/Ranged/FreedomStarHoldout.cs b/Projectiles/Ranged/FreedomStarHoldout.cs index c742913a0e..cc5ea44a41 100644 --- a/Projectiles/Ranged/FreedomStarHoldout.cs +++ b/Projectiles/Ranged/FreedomStarHoldout.cs @@ -1,7 +1,7 @@ -using CalamityMod.Items; +using System; +using CalamityMod.Items; using CalamityMod.Items.Weapons.Ranged; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -102,7 +102,7 @@ namespace CalamityMod.Projectiles.Ranged dustScale = 0.65f; Vector2 randDustSpawn = dustSpawn + ((float)Main.rand.NextDouble() * ((float)Math.PI * 2f)).ToRotationVector2() * (12f - chargeAmt * 2); - int electricDust = Dust.NewDust(randDustSpawn - Vector2.One * 8f, 16, 16, 226, Projectile.velocity.X / 2f, Projectile.velocity.Y / 2f); + int electricDust = Dust.NewDust(randDustSpawn - Vector2.One * 8f, 16, 16, DustID.Electric, Projectile.velocity.X / 2f, Projectile.velocity.Y / 2f); Main.dust[electricDust].velocity = Vector2.Normalize(dustSpawn - randDustSpawn) * 1.5f * (10f - chargeAmt * 2f) / 10f; Main.dust[electricDust].noGravity = true; Main.dust[electricDust].scale = dustScale; @@ -126,7 +126,7 @@ namespace CalamityMod.Projectiles.Ranged float randFloat = Main.rand.NextFloatDirection(); Vector2 randDustSpawnLaser = dustSpawnLaser + (Projectile.rotation + (Projectile.spriteDirection == -1 ? -MathHelper.PiOver2 : MathHelper.PiOver2) + randFloat * ((float)Math.PI / 4f) * 0.8f - (float)Math.PI / 2f).ToRotationVector2() * 6f; - int electric2 = Dust.NewDust(randDustSpawnLaser - Vector2.One * 12, 24, 24, 226, Projectile.velocity.X / 2f, Projectile.velocity.Y / 2f); + int electric2 = Dust.NewDust(randDustSpawnLaser - Vector2.One * 12, 24, 24, DustID.Electric, Projectile.velocity.X / 2f, Projectile.velocity.Y / 2f); Main.dust[electric2].velocity = (randDustSpawnLaser - dustSpawnLaser).SafeNormalize(Vector2.Zero) * MathHelper.Lerp(1.5f, 9f, Utils.GetLerpValue(1f, 0f, Math.Abs(randFloat), clamped: true)); Main.dust[electric2].noGravity = true; Main.dust[electric2].scale = dustScale; @@ -143,7 +143,7 @@ namespace CalamityMod.Projectiles.Ranged // This grabs the weapon's current damage, taking current charge level into account. int currentDamage = player.GetWeaponDamage(freedomStar); - bool stillInUse = player.channel && !player.noItems && !player.CCed; + bool stillInUse = !player.CantUseHoldout(); // Checks if the Freedom Star has sufficient charge to fire. If this is false, it stops functioning. CalamityGlobalItem modItem = freedomStar.Calamity(); diff --git a/Projectiles/Ranged/FungiOrb.cs b/Projectiles/Ranged/FungiOrb.cs index 0f5fdf1a72..b0917fb7a7 100644 --- a/Projectiles/Ranged/FungiOrb.cs +++ b/Projectiles/Ranged/FungiOrb.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Projectiles.Ranged if (Projectile.localAI[0] > 4f) { Vector2 dspeed = -Projectile.velocity * 0.5f; - int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 56, 0f, 0f, 100, default, 1f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.BlueFairy, 0f, 0f, 100, default, 1f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity = dspeed; @@ -46,14 +46,14 @@ namespace CalamityMod.Projectiles.Ranged { for (int f = 0; f < 3; f++) { - Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); + Vector2 velocity = CalamityUtils.RandomVelocity(100f, 60f, 85f); Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.4), 0f, Projectile.owner); } } SoundEngine.PlaySound(SoundID.NPCDeath1, Projectile.position); for (int k = 0; k < 5; k++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 56, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.BlueFairy, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } } diff --git a/Projectiles/Ranged/FungiOrb2.cs b/Projectiles/Ranged/FungiOrb2.cs index 3a0ee56cec..d98d3f1271 100644 --- a/Projectiles/Ranged/FungiOrb2.cs +++ b/Projectiles/Ranged/FungiOrb2.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -17,7 +17,6 @@ namespace CalamityMod.Projectiles.Ranged Projectile.friendly = true; Projectile.DamageType = DamageClass.Ranged; Projectile.penetrate = 1; - Projectile.aiStyle = ProjAIStyleID.Arrow; Projectile.timeLeft = 180; } @@ -31,25 +30,27 @@ namespace CalamityMod.Projectiles.Ranged Lighting.AddLight(Projectile.Center, new Vector3(0, 244, 252) * (1.2f / 255)); - Projectile.velocity.Y += 0.1f; - Projectile.velocity.X *= 0.95f; - Projectile.localAI[0] += 1f; if (Projectile.localAI[0] > 4f) { Vector2 dspeed = -Projectile.velocity * 0.5f; - int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 56, 0f, 0f, 100, default, 1f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.BlueFairy, 0f, 0f, 100, default, 1f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity = dspeed; } - + bool isHoming = false; if (Projectile.timeLeft < 150) - CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 450f, 6f, 20f); + { + isHoming = true; + CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 450f, 6.5f, 20f); + } + if (!isHoming) + Projectile.velocity.Y += 0.14f; } public override void OnKill(int timeLeft) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 56, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.BlueFairy, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } } diff --git a/Projectiles/Ranged/GemTechGreenFlechette.cs b/Projectiles/Ranged/GemTechGreenFlechette.cs index 51042a0e5c..2f2410091a 100644 --- a/Projectiles/Ranged/GemTechGreenFlechette.cs +++ b/Projectiles/Ranged/GemTechGreenFlechette.cs @@ -1,9 +1,9 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -70,7 +70,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { int afterimageCount = ProjectileID.Sets.TrailCacheLength[Projectile.type]; - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Vector2 drawPosition = Projectile.Center - Main.screenPosition; Vector2 origin = texture.Size() * 0.5f; for (int i = 0; i < afterimageCount; i++) diff --git a/Projectiles/Ranged/GodSlayerSlugProj.cs b/Projectiles/Ranged/GodSlayerSlugProj.cs index cfe31df26a..cc839fb9b4 100644 --- a/Projectiles/Ranged/GodSlayerSlugProj.cs +++ b/Projectiles/Ranged/GodSlayerSlugProj.cs @@ -1,12 +1,12 @@ -using CalamityMod.Dusts; +using System.IO; +using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; -using System.IO; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { diff --git a/Projectiles/Ranged/GoliathRocket.cs b/Projectiles/Ranged/GoliathRocket.cs index 3d6b96b187..169275f1e6 100644 --- a/Projectiles/Ranged/GoliathRocket.cs +++ b/Projectiles/Ranged/GoliathRocket.cs @@ -36,11 +36,11 @@ namespace CalamityMod.Projectiles.Ranged halfX = Projectile.velocity.X * 0.5f; halfY = Projectile.velocity.Y * 0.5f; } - int dust = Dust.NewDust(new Vector2(Projectile.position.X + 3f + halfX, Projectile.position.Y + 3f + halfY) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 6, 0f, 0f, 100, default, 1f); + int dust = Dust.NewDust(new Vector2(Projectile.position.X + 3f + halfX, Projectile.position.Y + 3f + halfY) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, DustID.Torch, 0f, 0f, 100, default, 1f); Main.dust[dust].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; Main.dust[dust].velocity *= 0.2f; Main.dust[dust].noGravity = true; - dust = Dust.NewDust(new Vector2(Projectile.position.X + 3f + halfX, Projectile.position.Y + 3f + halfY) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 31, 0f, 0f, 100, default, 0.5f); + dust = Dust.NewDust(new Vector2(Projectile.position.X + 3f + halfX, Projectile.position.Y + 3f + halfY) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, DustID.Smoke, 0f, 0f, 100, default, 0.5f); Main.dust[dust].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; Main.dust[dust].velocity *= 0.05f; } @@ -51,13 +51,13 @@ namespace CalamityMod.Projectiles.Ranged } else if (Main.rand.NextBool()) { - int dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 31, 0f, 0f, 100, default, 1f); + int dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Smoke, 0f, 0f, 100, default, 1f); Main.dust[dust2].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f; Main.dust[dust2].fadeIn = 1.5f + (float)Main.rand.Next(5) * 0.1f; Main.dust[dust2].noGravity = true; Main.dust[dust2].position = Projectile.Center + new Vector2(0f, (float)(-(float)Projectile.height / 2)).RotatedBy((double)Projectile.rotation, default) * 1.1f; Main.rand.Next(2); - dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 1f); + dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 1f); Main.dust[dust2].scale = 1f + (float)Main.rand.Next(5) * 0.1f; Main.dust[dust2].noGravity = true; Main.dust[dust2].position = Projectile.Center + new Vector2(0f, (float)(-(float)Projectile.height / 2 - 6)).RotatedBy((double)Projectile.rotation, default) * 1.1f; @@ -73,7 +73,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } @@ -119,7 +119,7 @@ namespace CalamityMod.Projectiles.Ranged { for (int i = 0; i < 20; i++) { - Dust dusty = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, 31, Alpha: 100, Scale: 2f); + Dust dusty = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.Smoke, Alpha: 100, Scale: 2f); dusty.velocity *= 3f; if (Main.rand.NextBool()) { @@ -130,11 +130,11 @@ namespace CalamityMod.Projectiles.Ranged for (int j = 0; j < 30; j++) { - Dust flameDust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, 6, Alpha: 100, Scale: 3f); + Dust flameDust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, Alpha: 100, Scale: 3f); flameDust.noGravity = true; flameDust.velocity *= 5f; - flameDust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, 6, Alpha: 100, Scale: 2f); + flameDust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, Alpha: 100, Scale: 2f); flameDust.velocity *= 2f; } diff --git a/Projectiles/Ranged/HailstormBulletProj.cs b/Projectiles/Ranged/HailstormBulletProj.cs new file mode 100644 index 0000000000..29712945f8 --- /dev/null +++ b/Projectiles/Ranged/HailstormBulletProj.cs @@ -0,0 +1,131 @@ +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class HailstormBulletProj : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Ranged"; + public float rotIncrease = 0; + public bool rotDirection = false; + public Vector2 startVelocity; + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 18; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + } + + public override void SetDefaults() + { + Projectile.width = 4; + Projectile.height = 4; + Projectile.aiStyle = ProjAIStyleID.Arrow; + AIType = ProjectileID.Bullet; + Projectile.timeLeft = 400; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.coldDamage = true; + Projectile.penetrate = 2; + Projectile.extraUpdates = 15; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.coldDamage = true; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; + } + + public override void AI() + { + if (Projectile.localAI[0] == 0f) + { + startVelocity = Projectile.velocity; + rotDirection = Main.rand.NextBool(); + Projectile.velocity *= Main.rand.NextFloat(0.97f, 1.03f); + } + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 150f && Projectile.localAI[0] % 15 == 0) + { + SparkParticle tip = new SparkParticle(Projectile.Center + Projectile.velocity * 18.5f, Projectile.velocity, false, 15, MathHelper.Clamp(-5 + (Projectile.localAI[0] * 0.03f), 0, 0.53f), Color.SkyBlue); + GeneralParticleHandler.SpawnParticle(tip); + } + + Dust dust = Dust.NewDustPerfect(Projectile.Center + Projectile.velocity * 5.5f, Main.rand.NextBool(3) ? 135 : 279, (-Projectile.velocity * 0.4f).RotatedBy(rotIncrease)); + dust.scale = 0.75f; + dust.noGravity = true; + + rotIncrease += 0.1f * (rotDirection ? -1 : 1); + + Projectile.velocity *= 0.982f; + + if (Projectile.localAI[0] > 100f && Projectile.localAI[0] < 300 && Projectile.localAI[0] % 9 == 0) + { + LineParticle subTrail = new LineParticle(Projectile.Center, Projectile.velocity * 0.01f, false, 17, 0.6f, Color.SkyBlue); + GeneralParticleHandler.SpawnParticle(subTrail); + } + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + Player Owner = Main.player[Projectile.owner]; + target.AddBuff(BuffID.Frostburn, 120); + if (hit.Crit) + { + SoundStyle crit = new("CalamityMod/Sounds/NPCHit/CryogenPhaseTransitionCrack"); + SoundEngine.PlaySound(crit with { Volume = 0.35f, Pitch = 1f }, Projectile.Center); + target.AddBuff(BuffID.Frostburn2, 300); + int points = 6; + float radians = MathHelper.TwoPi / points; + Vector2 spinningPoint = Vector2.Normalize(new Vector2(-1f, -1f)); + Vector2 addedPlacement = startVelocity; + float rotRando = Main.rand.NextFloat(0.1f, 2.5f); + for (int k = 0; k < points; k++) + { + Vector2 velocity = spinningPoint.RotatedBy(radians * k).RotatedBy(-0.45f * rotRando); + WaterFlavoredParticle subTrail = new WaterFlavoredParticle(Projectile.Center + velocity * 4.5f + addedPlacement, velocity * 7, false, 6, 0.65f, Color.SkyBlue); + GeneralParticleHandler.SpawnParticle(subTrail); + } + int onHitDamage = Owner.CalcIntDamage(0.48f * Projectile.damage); + Owner.ApplyDamageToNPC(target, onHitDamage, 0f, 0, false); + } + } + + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + if (Projectile.numHits > 0) + Projectile.damage = (int)(Projectile.damage * 0.5f); + if (Projectile.damage < 1) + Projectile.damage = 1; + } + + public override bool PreDraw(ref Color lightColor) + { + if (Projectile.localAI[0] > 15f) + CalamityUtils.DrawAfterimagesFromEdge(Projectile, 0, lightColor); + return false; + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(200, 200, 200, Projectile.alpha); + } + + public override void OnKill(int timeLeft) + { + if (Projectile.localAI[0] < 399) + { + SoundEngine.PlaySound(SoundID.Item27 with { Volume = 0.3f, Pitch = 0.8f }, Projectile.Center); + + for (int k = 0; k < 11; k++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(3) ? 135 : 279, new Vector2(4, 4).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 1.2f)); + dust.scale = Main.rand.NextFloat(0.9f, 1.5f); + dust.noGravity = true; + } + } + } + } +} diff --git a/Projectiles/Ranged/IcyBulletProj.png b/Projectiles/Ranged/HailstormBulletProj.png similarity index 100% rename from Projectiles/Ranged/IcyBulletProj.png rename to Projectiles/Ranged/HailstormBulletProj.png diff --git a/Projectiles/Ranged/HalleysComet.cs b/Projectiles/Ranged/HalleysComet.cs index 59a8e105f5..55536073df 100644 --- a/Projectiles/Ranged/HalleysComet.cs +++ b/Projectiles/Ranged/HalleysComet.cs @@ -1,10 +1,10 @@ using CalamityMod.Buffs.DamageOverTime; -using Terraria; -using Terraria.ModLoader; +using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Particles; using Microsoft.Xna.Framework; +using Terraria; using Terraria.Audio; -using CalamityMod.Items.Weapons.Ranged; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { diff --git a/Projectiles/Ranged/IlluminatedBullet.cs b/Projectiles/Ranged/HallowPointRoundProj.cs similarity index 66% rename from Projectiles/Ranged/IlluminatedBullet.cs rename to Projectiles/Ranged/HallowPointRoundProj.cs index 88f82c52c2..38bc347b06 100644 --- a/Projectiles/Ranged/IlluminatedBullet.cs +++ b/Projectiles/Ranged/HallowPointRoundProj.cs @@ -1,13 +1,14 @@ -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Ammo; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { - public class IlluminatedBullet : ModProjectile, ILocalizedModType + public class HallowPointRoundProj : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Ranged"; public override void SetStaticDefaults() @@ -25,7 +26,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.tileCollide = true; Projectile.penetrate = 1; Projectile.timeLeft = 300; - Projectile.extraUpdates = 3; + Projectile.MaxUpdates = 5; // Invisible for the first few frames Projectile.alpha = 255; @@ -35,7 +36,7 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - Lighting.AddLight(Projectile.Center, 1f, 0.7f, 0f); + Lighting.AddLight(Projectile.Center, 0.7f, 0.5f, 0.3f); // Projectile becomes visible after a few frames if (Projectile.timeLeft == 298) @@ -44,7 +45,7 @@ namespace CalamityMod.Projectiles.Ranged // Once projectile is visible, spawn trailing sparkles if (Projectile.timeLeft <= 298 && Main.rand.NextBool(5)) { - int idx = Dust.NewDust(Projectile.Center, 1, 1, 228, 0f, 0f); + int idx = Dust.NewDust(Projectile.Center, 1, 1, DustID.GoldFlame, 0f, 0f); Main.dust[idx].noGravity = true; Main.dust[idx].noLight = true; Main.dust[idx].position = Projectile.Center; @@ -54,20 +55,28 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesFromEdge(Projectile, 0, lightColor); + CalamityUtils.DrawAfterimagesFromEdge(Projectile, 0, Color.White); return false; } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + // Deal bonus flat damage on hit. + // This is a flat addition to the source damage of the hit, meaning the following: + // - The bonus damage is pre-mitigation + // - The bonus damage transfers to on-hit effects, if any + // - It is applied in a different way than whip tag bonus damage, preventing interference + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { - target.AddBuff(ModContent.BuffType(), 120); + modifiers.SourceDamage.Flat += HallowPointRound.BonusDamageOnHit; } - // On impact, make impact dust and play a sound. + // On impact, make impact sparkle and play a sound. public override void OnKill(int timeLeft) { Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); SoundEngine.PlaySound(SoundID.Item10, Projectile.position); + + GenericSparkle impactParticle = new GenericSparkle(Projectile.Center, Vector2.Zero, Color.Goldenrod, Color.White, Main.rand.NextFloat(0.7f, 1.2f), 12); + GeneralParticleHandler.SpawnParticle(impactParticle); } } } diff --git a/Projectiles/Ranged/IlluminatedBullet.png b/Projectiles/Ranged/HallowPointRoundProj.png similarity index 100% rename from Projectiles/Ranged/IlluminatedBullet.png rename to Projectiles/Ranged/HallowPointRoundProj.png diff --git a/Projectiles/Ranged/HandheldTankShell.cs b/Projectiles/Ranged/HandheldTankShell.cs index 3736224c7b..fe337bc681 100644 --- a/Projectiles/Ranged/HandheldTankShell.cs +++ b/Projectiles/Ranged/HandheldTankShell.cs @@ -1,8 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -34,7 +34,7 @@ namespace CalamityMod.Projectiles.Ranged for (int i = 0; i < 5; ++i) { pos -= Projectile.velocity * ((float)i * 0.25f); - int idx = Dust.NewDust(pos, 1, 1, 158, 0f, 0f, 0, default, 1f); + int idx = Dust.NewDust(pos, 1, 1, DustID.OrangeTorch, 0f, 0f, 0, default, 1f); Main.dust[idx].noGravity = true; Main.dust[idx].position = pos; Main.dust[idx].scale = (float)Main.rand.Next(70, 110) * 0.013f; diff --git a/Projectiles/Ranged/HeavenlyGaleProj.cs b/Projectiles/Ranged/HeavenlyGaleProj.cs index 39abac9f76..09e5b1616b 100644 --- a/Projectiles/Ranged/HeavenlyGaleProj.cs +++ b/Projectiles/Ranged/HeavenlyGaleProj.cs @@ -1,14 +1,14 @@ -using CalamityMod.Items.Weapons.Ranged; +using System; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Particles; +using CalamityMod.Projectiles.BaseProjectiles; +using CalamityMod.Sounds; using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; using Microsoft.Xna.Framework.Graphics; -using System; +using Terraria; using Terraria.Audio; using Terraria.ID; -using CalamityMod.Sounds; -using CalamityMod.Projectiles.BaseProjectiles; -using CalamityMod.Particles; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { @@ -196,7 +196,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Texture2D textureGlow = ModContent.Request("CalamityMod/Projectiles/Ranged/HeavenlyGaleProjGlow").Value; Vector2 origin = texture.Size() * 0.5f; Vector2 drawPosition = Projectile.Center - Main.screenPosition; diff --git a/Projectiles/Ranged/HighExplosivePeanutShell.cs b/Projectiles/Ranged/HighExplosivePeanutShell.cs index 8c3d4d5cd1..10fdaa11e0 100644 --- a/Projectiles/Ranged/HighExplosivePeanutShell.cs +++ b/Projectiles/Ranged/HighExplosivePeanutShell.cs @@ -1,8 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { diff --git a/Projectiles/Ranged/HiveBomb.cs b/Projectiles/Ranged/HiveBomb.cs deleted file mode 100644 index bf257aca05..0000000000 --- a/Projectiles/Ranged/HiveBomb.cs +++ /dev/null @@ -1,191 +0,0 @@ -using System; -using CalamityMod.Buffs.DamageOverTime; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Ranged -{ - public class HiveBomb : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Ranged"; - private ref float RocketType => ref Projectile.ai[0]; - - public override void SetDefaults() - { - Projectile.width = 14; - Projectile.height = 14; - Projectile.friendly = true; - Projectile.penetrate = 1; - Projectile.timeLeft = 95; - Projectile.DamageType = DamageClass.Ranged; - } - - public override void AI() - { - if (Math.Abs(Projectile.velocity.X) >= 8f || Math.Abs(Projectile.velocity.Y) >= 8f) - { - for (int i = 0; i < 2; i++) - { - float halfX = 0f; - float halfY = 0f; - if (i == 1) - { - halfX = Projectile.velocity.X * 0.5f; - halfY = Projectile.velocity.Y * 0.5f; - } - int dust = Dust.NewDust(new Vector2(Projectile.position.X + 3f + halfX, Projectile.position.Y + 3f + halfY) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 6, 0f, 0f, 100, default, 1f); - Main.dust[dust].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; - Main.dust[dust].velocity *= 0.2f; - Main.dust[dust].noGravity = true; - dust = Dust.NewDust(new Vector2(Projectile.position.X + 3f + halfX, Projectile.position.Y + 3f + halfY) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 31, 0f, 0f, 100, default, 0.5f); - Main.dust[dust].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[dust].velocity *= 0.05f; - } - } - if (Math.Abs(Projectile.velocity.X) < 15f && Math.Abs(Projectile.velocity.Y) < 15f) - { - Projectile.velocity *= 1.1f; - } - else if (Main.rand.NextBool()) - { - int dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 31, 0f, 0f, 100, default, 1f); - Main.dust[dust2].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[dust2].fadeIn = 1.5f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[dust2].noGravity = true; - Main.dust[dust2].position = Projectile.Center + new Vector2(0f, (float)(-(float)Projectile.height / 2)).RotatedBy((double)Projectile.rotation, default) * 1.1f; - Main.rand.Next(2); - dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 1f); - Main.dust[dust2].scale = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[dust2].noGravity = true; - Main.dust[dust2].position = Projectile.Center + new Vector2(0f, (float)(-(float)Projectile.height / 2 - 6)).RotatedBy((double)Projectile.rotation, default) * 1.1f; - } - Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.ToRadians(90); - - if (RocketType == ItemID.DryRocket || RocketType == ItemID.WetRocket || RocketType == ItemID.LavaRocket || RocketType == ItemID.HoneyRocket) - { - if (Projectile.wet) - Projectile.timeLeft = 1; - } - } - - public override bool PreDraw(ref Color lightColor) - { - Texture2D tex = ModContent.Request(Texture).Value; - Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); - return false; - } - - public override void OnKill(int timeLeft) - { - var info = new CalamityUtils.RocketBehaviorInfo((int)RocketType) - { - smallRadius = 4, - mediumRadius = 7, - largeRadius = 10 - }; - int blastRadius = Projectile.RocketBehavior(info); - Projectile.ExpandHitboxBy(64); - Projectile.Damage(); - - if (Projectile.owner == Main.myPlayer) - { - for (int j = 0; j < 6; j++) - { - if (j % 2 != 1 || Main.rand.NextBool(3)) - { - Vector2 projPos = Projectile.position; - Vector2 projVel = Projectile.oldVelocity; - projVel.Normalize(); - projVel *= 8f; - float beeVelX = (float)Main.rand.Next(-35, 36) * 0.01f; - float beeVelY = (float)Main.rand.Next(-35, 36) * 0.01f; - projPos -= projVel * (float)j; - beeVelX += Projectile.oldVelocity.X / 6f; - beeVelY += Projectile.oldVelocity.Y / 6f; - int bee = Projectile.NewProjectile(Projectile.GetSource_FromThis(), projPos.X, projPos.Y, beeVelX, beeVelY, Main.player[Projectile.owner].beeType(), Main.player[Projectile.owner].beeDamage(Projectile.damage / 3), Main.player[Projectile.owner].beeKB(0f), Main.myPlayer); - if (bee.WithinBounds(Main.maxProjectiles)) - { - Main.projectile[bee].penetrate = 2; - Main.projectile[bee].DamageType = DamageClass.Ranged; - } - } - } - } - - if (Main.dedServ) - return; - - SoundEngine.PlaySound(SoundID.Item14, Projectile.position); - for (int i = 0; i < 20; i++) - { - int dusty = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 89, 0f, 0f, 100, default, 2f); - Main.dust[dusty].velocity *= 3f; - if (Main.rand.NextBool()) - { - Main.dust[dusty].scale = 0.5f; - Main.dust[dusty].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int j = 0; j < 30; j++) - { - int dusty2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 89, 0f, 0f, 100, default, 3f); - Main.dust[dusty2].noGravity = true; - Main.dust[dusty2].velocity *= 5f; - dusty2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 89, 0f, 0f, 100, default, 2f); - Main.dust[dusty2].velocity *= 2f; - } - - if (Main.netMode != NetmodeID.Server) - { - Vector2 goreSource = Projectile.Center; - int goreAmt = 3; - Vector2 source = new Vector2(goreSource.X - 24f, goreSource.Y - 24f); - for (int goreIndex = 0; goreIndex < goreAmt; goreIndex++) - { - float velocityMult = 0.33f; - if (goreIndex < (goreAmt / 3)) - { - velocityMult = 0.66f; - } - if (goreIndex >= (2 * goreAmt / 3)) - { - velocityMult = 1f; - } - Mod mod = ModContent.GetInstance(); - int type = Main.rand.Next(61, 64); - int smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); - Gore gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X += 1f; - gore.velocity.Y += 1f; - type = Main.rand.Next(61, 64); - smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); - gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X -= 1f; - gore.velocity.Y += 1f; - type = Main.rand.Next(61, 64); - smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); - gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X += 1f; - gore.velocity.Y -= 1f; - type = Main.rand.Next(61, 64); - smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); - gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X -= 1f; - gore.velocity.Y -= 1f; - } - } - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 180); - } - } -} diff --git a/Projectiles/Ranged/HiveMissile.cs b/Projectiles/Ranged/HiveMissile.cs index 0d987f93e3..21fba14125 100644 --- a/Projectiles/Ranged/HiveMissile.cs +++ b/Projectiles/Ranged/HiveMissile.cs @@ -1,184 +1,171 @@ using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; +using static CalamityMod.Projectiles.Ranged.TheHiveHoldout; namespace CalamityMod.Projectiles.Ranged { public class HiveMissile : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Ranged"; - private ref float RocketType => ref Projectile.ai[0]; + public ref float RocketID => ref Projectile.ai[0]; + public ref float ProjectileSpeed => ref Projectile.ai[1]; + public ref float Time => ref Projectile.ai[2]; + public bool HasHit = false; public override void SetDefaults() { - Projectile.width = 14; - Projectile.height = 14; - Projectile.scale = 0.75f; + Projectile.width = 25; + Projectile.height = 25; Projectile.friendly = true; Projectile.penetrate = 1; - Projectile.timeLeft = 95; + Projectile.timeLeft = 100; Projectile.DamageType = DamageClass.Ranged; + Projectile.extraUpdates = 2; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; } public override void AI() { - if (Math.Abs(Projectile.velocity.X) >= 8f || Math.Abs(Projectile.velocity.Y) >= 8f) + // Rotates towards its velocity. + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + + if (Projectile.wet && RocketID == ItemID.DryRocket && RocketID == ItemID.WetRocket && RocketID == ItemID.LavaRocket && RocketID == ItemID.HoneyRocket) { - for (int i = 0; i < 2; i++) + HasHit = true; + Projectile.Kill(); + } + + Time++; + + if (Projectile.timeLeft <= 50) + { + Projectile.velocity *= 0.965f; + if (Time % 5 == 0) { - float halfX = 0f; - float halfY = 0f; - if (i == 1) - { - halfX = Projectile.velocity.X * 0.5f; - halfY = Projectile.velocity.Y * 0.5f; - } - int dust = Dust.NewDust(new Vector2(Projectile.position.X + 3f + halfX, Projectile.position.Y + 3f + halfY) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 6, 0f, 0f, 100, default, 1f); - Main.dust[dust].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; - Main.dust[dust].velocity *= 0.2f; - Main.dust[dust].noGravity = true; - dust = Dust.NewDust(new Vector2(Projectile.position.X + 3f + halfX, Projectile.position.Y + 3f + halfY) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 31, 0f, 0f, 100, default, 0.5f); - Main.dust[dust].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[dust].velocity *= 0.05f; - } - } - if (Math.Abs(Projectile.velocity.X) < 15f && Math.Abs(Projectile.velocity.Y) < 15f) - { - Projectile.velocity *= 1.5f; - } - else if (Main.rand.NextBool()) - { - int dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 31, 0f, 0f, 100, default, 1f); - Main.dust[dust2].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[dust2].fadeIn = 1.5f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[dust2].noGravity = true; - Main.dust[dust2].position = Projectile.Center + new Vector2(0f, (float)(-(float)Projectile.height / 2)).RotatedBy((double)Projectile.rotation, default) * 1.1f; - Main.rand.Next(2); - dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 1f); - Main.dust[dust2].scale = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[dust2].noGravity = true; - Main.dust[dust2].position = Projectile.Center + new Vector2(0f, (float)(-(float)Projectile.height / 2 - 6)).RotatedBy((double)Projectile.rotation, default) * 1.1f; - } - Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.ToRadians(90); - - if (RocketType == ItemID.DryRocket || RocketType == ItemID.WetRocket || RocketType == ItemID.LavaRocket || RocketType == ItemID.HoneyRocket) - { - if (Projectile.wet) - Projectile.timeLeft = 1; - } - } - - public override bool PreDraw(ref Color lightColor) - { - Texture2D tex = ModContent.Request(Texture).Value; - Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); - return false; - } - - public override void OnKill(int timeLeft) - { - var info = new CalamityUtils.RocketBehaviorInfo((int)RocketType) - { - smallRadius = 5, - mediumRadius = 8, - largeRadius = 11 - }; - int blastRadius = Projectile.RocketBehavior(info); - Projectile.ExpandHitboxBy(80); - Projectile.Damage(); - - if (Projectile.owner == Main.myPlayer) - { - for (int j = 0; j < 3; j++) - { - if (j % 2 != 1 || Main.rand.NextBool(3)) - { - Vector2 projPos = Projectile.position; - Vector2 projVel = Projectile.oldVelocity; - projVel.Normalize(); - projVel *= 8f; - float beeVelX = (float)Main.rand.Next(-35, 36) * 0.01f; - float beeVelY = (float)Main.rand.Next(-35, 36) * 0.01f; - projPos -= projVel * (float)j; - beeVelX += Projectile.oldVelocity.X / 6f; - beeVelY += Projectile.oldVelocity.Y / 6f; - int bee = Projectile.NewProjectile(Projectile.GetSource_FromThis(), projPos.X, projPos.Y, beeVelX, beeVelY, Main.player[Projectile.owner].beeType(), Main.player[Projectile.owner].beeDamage(Projectile.damage / 2), Main.player[Projectile.owner].beeKB(0f), Main.myPlayer); - if (bee.WithinBounds(Main.maxProjectiles)) - { - Main.projectile[bee].penetrate = 2; - Main.projectile[bee].DamageType = DamageClass.Ranged; - } - } + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(10, 10) - Projectile.velocity * 3.5f, Main.rand.NextBool(3) ? DustEffectsID : 303, Projectile.velocity.RotatedByRandom(0.3f) * Main.rand.NextFloat(0.4f, 0.9f), 0, default, Main.rand.NextFloat(0.5f, 0.9f)); + dust.noGravity = false; + if (dust.type != DustEffectsID) + dust.color = Main.rand.NextBool(3) ? EffectsColor : StaticEffectsColor; } } if (Main.dedServ) return; - SoundEngine.PlaySound(SoundID.Item14, Projectile.position); - for (int i = 0; i < 20; i++) + // The projectile will fade away as its time alive is ending. + Projectile.alpha = (int)Utils.Remap(Projectile.timeLeft, 40f, 0f, 0f, 255f); + + if (Time % 3 == 0) { - int dusty = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 90, 0f, 0f, 100, default, 2f); - Main.dust[dusty].velocity *= 3f; + Dust trailDust = Dust.NewDustDirect(Projectile.Center, Projectile.width, Projectile.height, Main.rand.NextBool() ? 303 : DustEffectsID, Scale: Main.rand.NextFloat(0.3f, 0.6f)); + trailDust.noGravity = true; + trailDust.noLight = true; + trailDust.noLightEmittence = true; + trailDust.velocity = -Projectile.velocity * Main.rand.NextFloat(0.2f, 0.8f); + if (trailDust.type != DustEffectsID) + trailDust.color = Main.rand.NextBool(3) ? EffectsColor : StaticEffectsColor; + } + if (Time > 5f) + { + float sizeBonus = Projectile.timeLeft < 30 ? Time * 0.003f : 0; + Color smokeColor = Color.Lerp(Color.Black, Color.Lime, 0.25f); + Particle smoke = new HeavySmokeParticle(Projectile.Center - Projectile.velocity * 2, -Projectile.velocity.RotatedByRandom(sizeBonus) * Main.rand.NextFloat(0.2f, 0.6f), smokeColor * 0.65f, 6, Main.rand.NextFloat(0.3f, 0.45f) + sizeBonus, 0.23f - (sizeBonus * 0.3f), Main.rand.NextFloat(-0.2f, 0.2f), false); + GeneralParticleHandler.SpawnParticle(smoke); + if (Main.rand.NextBool()) { - Main.dust[dusty].scale = 0.5f; - Main.dust[dusty].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(10, 10) - Projectile.velocity * 2.5f, 303, -Projectile.velocity.RotatedByRandom(0.05f) * Main.rand.NextFloat(0.05f, 0.4f), 0, default, Main.rand.NextFloat(0.8f, 1.4f)); + dust.noGravity = false; + dust.color = Color.Black; + dust.alpha = Main.rand.Next(90, 220 + 1); } } - for (int j = 0; j < 30; j++) - { - int dusty2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 90, 0f, 0f, 100, default, 3f); - Main.dust[dusty2].noGravity = true; - Main.dust[dusty2].velocity *= 5f; - dusty2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 90, 0f, 0f, 100, default, 2f); - Main.dust[dusty2].velocity *= 2f; - } - if (Main.netMode != NetmodeID.Server) + Lighting.AddLight(Projectile.Center, StaticEffectsColor.ToVector3() * 0.7f); + } + + public override bool PreDraw(ref Color lightColor) + { + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); + return false; + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + HasHit = true; + target.AddBuff(ModContent.BuffType(), 90); + } + public override bool OnTileCollide(Vector2 oldVelocity) + { + HasHit = true; + return true; + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + if (Projectile.numHits > 1) + Projectile.damage = (int)(Projectile.damage * 0.6f); + if (Projectile.damage < 1) + Projectile.damage = 1; + } + public override void OnKill(int timeLeft) + { + if (HasHit == true) { - Vector2 goreSource = Projectile.Center; - int goreAmt = 3; - Vector2 source = new Vector2(goreSource.X - 24f, goreSource.Y - 24f); - for (int goreIndex = 0; goreIndex < goreAmt; goreIndex++) + var info = new CalamityUtils.RocketBehaviorInfo((int)RocketID) { - float velocityMult = 0.33f; - if (goreIndex < (goreAmt / 3)) + // Since we use our own spawning method for the cluster rockets, we don't need them to shoot anything, + // we'll do it ourselves. + clusterProjectileID = ProjectileID.None, + destructiveClusterProjectileID = ProjectileID.None, + }; + + bool isClusterRocket = (RocketID == ItemID.ClusterRocketI || RocketID == ItemID.ClusterRocketII); + SoundStyle fire = new("CalamityMod/Sounds/Custom/PlagueSounds/PlagueBoom", 4); + SoundEngine.PlaySound(fire with { Volume = 0.5f, Pitch = -0.3f }, Projectile.Center); + + int blastRadius = (int)(Projectile.RocketBehavior(info) * 0.7f); + Projectile.ExpandHitboxBy((float)blastRadius); + Projectile.damage = (int)(Projectile.damage * 0.5f); + Projectile.penetrate = -1; + Projectile.Damage(); + + Particle blastRing = new CustomPulse( + Projectile.Center, + Vector2.Zero, + StaticEffectsColor * 0.8f, + "CalamityMod/Particles/FlameExplosion", + Vector2.One, + Main.rand.NextFloat(-10, 10), + Projectile.width / 22815f, + Projectile.width / 2275f, + 10); + GeneralParticleHandler.SpawnParticle(blastRing); + + for (int k = 0; k < 15; k++) + { + Dust dust2 = Dust.NewDustPerfect(Projectile.Center, 303, new Vector2(8, 8).RotatedByRandom(100) * Main.rand.NextFloat(0.05f, 0.8f)); + dust2.scale = Main.rand.NextFloat(0.75f, 0.95f); + dust2.noGravity = true; + dust2.color = Main.rand.NextBool(3) ? EffectsColor : StaticEffectsColor; + } + + for (int k = 0; k < (isClusterRocket ? 3f : 2f); k++) + { + int BEES = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, new Vector2(4, 10).RotatedByRandom(4) * Main.rand.NextFloat(0.2f, 0.8f), ModContent.ProjectileType(), (int)(Projectile.damage * (isClusterRocket ? 0.2f : 0.3f)), 0f, Projectile.owner, 0f, 0f, isClusterRocket ? 2f : 1f); + if (BEES.WithinBounds(Main.maxProjectiles)) { - velocityMult = 0.66f; + Main.projectile[BEES].penetrate = 1; + Main.projectile[BEES].DamageType = DamageClass.Ranged; } - if (goreIndex >= (2 * goreAmt / 3)) - { - velocityMult = 1f; - } - Mod mod = ModContent.GetInstance(); - int type = Main.rand.Next(61, 64); - int smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); - Gore gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X += 1f; - gore.velocity.Y += 1f; - type = Main.rand.Next(61, 64); - smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); - gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X -= 1f; - gore.velocity.Y += 1f; - type = Main.rand.Next(61, 64); - smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); - gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X += 1f; - gore.velocity.Y -= 1f; - type = Main.rand.Next(61, 64); - smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); - gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X -= 1f; - gore.velocity.Y -= 1f; } } } diff --git a/Projectiles/Ranged/HiveNuke.cs b/Projectiles/Ranged/HiveNuke.cs new file mode 100644 index 0000000000..d4167d5e5c --- /dev/null +++ b/Projectiles/Ranged/HiveNuke.cs @@ -0,0 +1,266 @@ +using System; +using System.Net.Sockets; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; +using static CalamityMod.Projectiles.Ranged.TheHiveHoldout; +namespace CalamityMod.Projectiles.Ranged +{ + public class HiveNuke : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Ranged"; + public ref float RocketID => ref Projectile.ai[0]; + public ref float ProjectileSpeed => ref Projectile.ai[1]; + public bool HasHit = false; + public float Time = 0; + public bool BonusEffectMode; + public bool SetLifetime = false; + private Player Owner => Main.player[Projectile.owner]; + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 20; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + } + public override void SetDefaults() + { + Projectile.width = 25; + Projectile.height = 25; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 1500; + Projectile.DamageType = DamageClass.Ranged; + Projectile.extraUpdates = 15; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + + public override void AI() + { + BonusEffectMode = Projectile.ai[2] == 2; + if (BonusEffectMode) + { + if (RocketID == ItemID.RocketII || RocketID == ItemID.RocketIV || RocketID == ItemID.MiniNukeII) + { + if (!SetLifetime) + { + Projectile.timeLeft = 60; + Projectile.extraUpdates = 0; + Projectile.damage = 0; + Projectile.alpha = 255; + SetLifetime = true; + } + + var info = new CalamityUtils.RocketBehaviorInfo((int)RocketID); + int blastRadius = (int)(Projectile.RocketBehavior(info) * 5f); + if (Time % 5 == 0) + { + Projectile.ExplodeTiles((int)(blastRadius * Utils.Remap(Time, 60f, 1f, 1f, 0f, true)), info.respectStandardBlastImmunity, info.tilesToCheck, info.wallsToCheck); + } + } + else + { + Point center = Projectile.Center.ToTileCoordinates(); + if (RocketID == ItemID.DryRocket) + { + DelegateMethods.f_1 = 10.5f * Utils.Remap(Time, 60f, 1f, 1f, 0f, true); + if (Time == 0) + { + Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadDry); + } + } + if (RocketID == ItemID.WetRocket) + { + DelegateMethods.f_1 = 10.5f * Utils.Remap(Time, 60f, 1f, 1f, 0f, true); + if (Time == 0) + { + Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadWater); + } + } + if (RocketID == ItemID.LavaRocket) + { + DelegateMethods.f_1 = 10.5f * Utils.Remap(Time, 60f, 1f, 1f, 0f, true); + if (Time == 0) + { + Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadLava); + } + } + if (RocketID == ItemID.HoneyRocket) + { + DelegateMethods.f_1 = 10.5f * Utils.Remap(Time, 60f, 1f, 1f, 0f, true); + if (Time == 0) + { + Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadHoney); + } + } + } + Time++; + } + else + { + // Rotates towards its velocity. + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + + if (Projectile.wet && RocketID == ItemID.DryRocket && RocketID == ItemID.WetRocket && RocketID == ItemID.LavaRocket && RocketID == ItemID.HoneyRocket) + Projectile.Kill(); + + Time++; + + if (Projectile.timeLeft <= 30) + Projectile.velocity *= 0.95f; + + if (Main.dedServ) + return; + + // The projectile will fade away as its time alive is ending. + Projectile.alpha = (int)Utils.Remap(Projectile.timeLeft, 10f, 0f, 0f, 255f); + + if (Time % 3 == 0) + { + Dust trailDust = Dust.NewDustDirect(Projectile.Center, Projectile.width, Projectile.height, Main.rand.NextBool() ? 303 : DustEffectsID, Scale: Main.rand.NextFloat(0.3f, 0.6f)); + trailDust.noGravity = true; + trailDust.noLight = true; + trailDust.noLightEmittence = true; + trailDust.velocity = -Projectile.velocity.RotatedByRandom(0.5) * Main.rand.NextFloat(0.2f, 0.8f); + if (trailDust.type != DustEffectsID) + trailDust.color = Main.rand.NextBool(3) ? EffectsColor : StaticEffectsColor; + } + if (Time > 5f) + { + Color smokeColor = Color.Lerp(Color.Black, Color.Lime, 0.25f); + Particle smoke = new HeavySmokeParticle(Projectile.Center - Projectile.velocity * 2, -Projectile.velocity * Main.rand.NextFloat(0.2f, 0.6f), smokeColor * 0.65f, 9, Main.rand.NextFloat(0.45f, 0.6f), 0.23f, Main.rand.NextFloat(-0.2f, 0.2f), false); + GeneralParticleHandler.SpawnParticle(smoke); + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(10, 10) - Projectile.velocity * 2.5f, 303, -Projectile.velocity.RotatedByRandom(0.05f) * Main.rand.NextFloat(0.2f, 0.9f), 0, default, Main.rand.NextFloat(0.9f, 1.6f)); + dust.noGravity = false; + dust.color = Color.Black; + dust.alpha = Main.rand.Next(90, 220 + 1); + } + + Lighting.AddLight(Projectile.Center, StaticEffectsColor.ToVector3() * 0.7f); + } + + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.width * 0.4f, targetHitbox); + + public override bool PreDraw(ref Color lightColor) + { + if (BonusEffectMode) { return false; } + Texture2D texture = ModContent.Request("CalamityMod/Projectiles/StarProj").Value; + if (Time > 6) + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], EffectsColor * 0.4f, 1, texture); + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); + return false; + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + HasHit = true; + target.AddBuff(ModContent.BuffType(), 60); + } + public override bool OnTileCollide(Vector2 oldVelocity) + { + HasHit = true; + return true; + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + if (Projectile.numHits > 1) + Projectile.damage = (int)(Projectile.damage * 0.7f); + if (Projectile.damage < 1) + Projectile.damage = 1; + } + public override void OnKill(int timeLeft) + { + bool isClusterRocket = (RocketID == ItemID.ClusterRocketI || RocketID == ItemID.ClusterRocketII); + if (HasHit == true && !BonusEffectMode) + { + if (Main.zenithWorld) + { + SoundStyle bees = new("CalamityMod/Sounds/Custom/BEES/bees", 11); + SoundEngine.PlaySound(bees with { Volume = 1.5f }, Projectile.Center); + SoundStyle fire = new("CalamityMod/Sounds/Item/TheHiveNuke"); + SoundEngine.PlaySound(fire with { Volume = 0.35f }, Projectile.Center); + } + else + { + SoundStyle fire = new("CalamityMod/Sounds/Item/TheHiveNuke"); + SoundEngine.PlaySound(fire with { Volume = 0.9f }, Projectile.Center); + } + + Owner.Calamity().GeneralScreenShakePower = 9.5f; + + var info = new CalamityUtils.RocketBehaviorInfo((int)RocketID) + { + // Since we use our own spawning method for the cluster rockets, we don't need them to shoot anything, + // we'll do it ourselves. + clusterProjectileID = ProjectileID.None, + destructiveClusterProjectileID = ProjectileID.None, + }; + + int blastRadius = (int)(Projectile.RocketBehavior(info) * 5f); + Projectile.ExpandHitboxBy((float)blastRadius); + if (RocketID == ItemID.RocketII || RocketID == ItemID.RocketIV || RocketID == ItemID.MiniNukeII || RocketID == ItemID.DryRocket || RocketID == ItemID.WetRocket || RocketID == ItemID.LavaRocket || RocketID == ItemID.HoneyRocket) + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, Projectile.owner, RocketID, 0f, 2f); + Projectile.damage = (int)(Projectile.damage * 0.7f); + Projectile.penetrate = -1; + Projectile.Damage(); + + for (int k = 0; k < 3; k++) + { + Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, StaticEffectsColor * 0.8f, "CalamityMod/Particles/FlameExplosion", Vector2.One, Main.rand.NextFloat(-10, 10), Projectile.width / 22815f, Projectile.width / (2275f + 520 * k), 20 + 4 * k); + GeneralParticleHandler.SpawnParticle(blastRing); + } + + for (int k = 0; k < 30; k++) + { + GlowOrbParticle orb = new GlowOrbParticle(Projectile.Center, new Vector2(30, 30).RotatedByRandom(100) * Main.rand.NextFloat(0.05f, 0.8f), false, 60, Main.rand.NextFloat(0.8f, 1.4f), StaticEffectsColor, true, true); + GeneralParticleHandler.SpawnParticle(orb); + } + + for (int k = 0; k < 45; k++) + { + if (Main.rand.NextBool(5)) + { + Dust dust2 = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(3) ? DustEffectsID : 303, new Vector2(30, 30).RotatedByRandom(100) * Main.rand.NextFloat(0.05f, 0.8f)); + dust2.scale = Main.rand.NextFloat(0.85f, 1.25f); + dust2.noGravity = true; + if (dust2.type != DustEffectsID) + dust2.color = Main.rand.NextBool(3) ? EffectsColor : StaticEffectsColor; + } + else + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, 303, new Vector2(35, 35).RotatedByRandom(100) * Main.rand.NextFloat(0.05f, 0.8f), 0, default, Main.rand.NextFloat(0.9f, 1.7f)); + dust.noGravity = false; + dust.color = Color.Black; + dust.alpha = Main.rand.Next(90, 220 + 1); + } + } + for (int k = 0; k < (int)((Main.zenithWorld ? 100 : 20) * (isClusterRocket ? 1.5f : 1)); k++) + { + int BEES = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, new Vector2(10, 10).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 0.8f), ModContent.ProjectileType(), (int)(Projectile.damage * (isClusterRocket ? 0.03f : 0.04f)), 0f, Projectile.owner, 0f, 0f, isClusterRocket ? 2f : 1f); + if (BEES.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[BEES].penetrate = 1; + Main.projectile[BEES].DamageType = DamageClass.Ranged; + } + } + } + else if (!BonusEffectMode) + { + for (int i = 0; i <= 15; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(10, 10) - Projectile.velocity * 3.5f, Main.rand.NextBool(3) ? DustEffectsID : 303, Projectile.velocity.RotatedByRandom(0.3f) * Main.rand.NextFloat(0.4f, 0.9f), 0, default, Main.rand.NextFloat(0.5f, 0.9f)); + dust.noGravity = false; + if (dust.type != DustEffectsID) + dust.color = Main.rand.NextBool(3) ? EffectsColor : StaticEffectsColor; + } + } + } + } +} diff --git a/Projectiles/Ranged/HiveBomb.png b/Projectiles/Ranged/HiveNuke.png similarity index 100% rename from Projectiles/Ranged/HiveBomb.png rename to Projectiles/Ranged/HiveNuke.png diff --git a/Projectiles/Ranged/HolyFireBulletProj.cs b/Projectiles/Ranged/HolyFireBulletProj.cs index 4870a06d98..97da541fc2 100644 --- a/Projectiles/Ranged/HolyFireBulletProj.cs +++ b/Projectiles/Ranged/HolyFireBulletProj.cs @@ -1,8 +1,10 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Ammo; +using CalamityMod.Particles; using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -13,11 +15,14 @@ namespace CalamityMod.Projectiles.Ranged public new string LocalizationCategory => "Projectiles.Ranged"; private const int Lifetime = 600; private static readonly Color Alpha = new Color(1f, 1f, 1f, 0f); + private bool ColorStyle = false; + private float SizeVariance; + private float SizeBonus = 2; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; } public override void SetDefaults() @@ -33,24 +38,35 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { + if (Projectile.localAI[0] == 0) + { + SizeVariance = Main.rand.NextFloat(0.95f, 1.05f); + ColorStyle = Main.rand.NextBool(); + Projectile.velocity *= 0.7f; + } Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.ToRadians(90f); Projectile.spriteDirection = Projectile.direction; - + if (Projectile.localAI[0] >= 30 && SizeBonus > 1) + { + SizeBonus -= 0.02f; + } // Flaking dust Projectile.localAI[0] += 1f; if (Projectile.localAI[0] > 4f) { - if (Main.rand.NextBool()) + if (Main.rand.NextBool(3)) { - float scale = Main.rand.NextFloat(0.6f, 1.6f); - int dustID = Dust.NewDust(Projectile.Center, 1, 1, 244); - Main.dust[dustID].position = Projectile.Center; - Main.dust[dustID].noGravity = true; - Main.dust[dustID].scale = scale; - float angleDeviation = 0.17f; - float angle = Main.rand.NextFloat(-angleDeviation, angleDeviation); - Vector2 sprayVelocity = Projectile.velocity.RotatedBy(angle) * 0.6f; - Main.dust[dustID].velocity = sprayVelocity; + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(5, 5), Main.rand.NextBool() ? 262 : 87, -Projectile.velocity.RotatedByRandom(0.05f) * Main.rand.NextFloat(0.01f, 0.1f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.5f, 0.85f); + dust.alpha = 235; + } + if (Main.rand.NextBool(15)) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, 278, -Projectile.velocity.RotatedByRandom(0.6f) * Main.rand.NextFloat(0.2f, 0.4f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.4f, 0.7f); + dust.color = ColorStyle ? Color.Orange : Color.Khaki; } } } @@ -59,8 +75,8 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesFromEdge(Projectile, 0, lightColor); - return false; + CalamityUtils.DrawAfterimagesFromEdge(Projectile, 0, ColorStyle ? Color.OrangeRed * 8 : Color.Khaki * 8); + return true; } public override void OnKill(int timeLeft) @@ -68,27 +84,41 @@ namespace CalamityMod.Projectiles.Ranged // Spawn an on-hit explosion which deals 75% of the projectile's damage. if (Projectile.owner == Main.myPlayer) { - int blastDamage = (int)(Projectile.damage * HolyFireBullet.ExplosionMultiplier); - float scale = 0.85f + Main.rand.NextFloat() * 1.15f; - int boom = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), blastDamage, Projectile.knockBack, Projectile.owner, 0f, scale); - - // Explosions match the bullet's damage type (e.g. ranged or summon) - if (boom.WithinBounds(Main.maxProjectiles)) - Main.projectile[boom].DamageType = Projectile.DamageType; + Projectile.damage = (int)(Projectile.damage * HolyFireBullet.ExplosionMultiplier); + Projectile.penetrate = -1; + Projectile.ExpandHitboxBy((25 * SizeVariance) * SizeBonus); + Projectile.Damage(); } + SoundEngine.PlaySound(HolyFireBullet.Explosion with { Pitch = -0.15f, Volume = 0.3f }, Projectile.Center); - // Spawn four shrapnel dust. This deals no damage. - for (int k = 0; k < 4; k++) + Vector2 Offset = Main.rand.NextVector2Circular(15, 15); + + Particle explosion = new DetailedExplosion(Projectile.Center + Offset, Vector2.Zero, (ColorStyle ? Color.Orange : Color.Khaki) * 0.9f, Vector2.One, Main.rand.NextFloat(-5, 5), 0f, (0.28f * SizeVariance) * SizeBonus, 10); + GeneralParticleHandler.SpawnParticle(explosion); + + SparkleParticle impactParticle = new SparkleParticle(Projectile.Center + Offset, Vector2.Zero, Color.White, ColorStyle ? Color.Orange : Color.OrangeRed, 2.5f * (SizeBonus * 0.3f), 7, 0f, 2f); + GeneralParticleHandler.SpawnParticle(impactParticle); + + for (int k = 0; k < 9; k++) { - float scale = Main.rand.NextFloat(1.4f, 1.8f); - int dustID = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244); - Main.dust[dustID].noGravity = false; - Main.dust[dustID].scale = scale; - float angleDeviation = 0.25f; - float angle = Main.rand.NextFloat(-angleDeviation, angleDeviation); - float velMult = Main.rand.NextFloat(0.08f, 0.14f); - Vector2 shrapnelVelocity = Projectile.oldVelocity.RotatedBy(angle) * velMult; - Main.dust[dustID].velocity = shrapnelVelocity; + Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool() ? 262 : 87, new Vector2(4, 4).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1.5f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.7f, 1.25f); + dust.alpha = 235; + if (Main.rand.NextBool()) + { + Dust dust2 = Dust.NewDustPerfect(Projectile.Center, 303, new Vector2(3, 3).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1.5f)); + dust2.noGravity = true; + dust2.scale = Main.rand.NextFloat(0.8f, 1.5f); + dust2.alpha = 70; + } + } + for (int k = 0; k < 3; k++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, 278, new Vector2(4, 4).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1.5f) + new Vector2(0, -3)); + dust.noGravity = false; + dust.scale = Main.rand.NextFloat(0.85f, 1f); + dust.color = ColorStyle ? Color.Orange : Color.Khaki; } } diff --git a/Projectiles/Ranged/HydraHead.cs b/Projectiles/Ranged/HydraHead.cs index 39bb0686cc..f4a93d2ee6 100644 --- a/Projectiles/Ranged/HydraHead.cs +++ b/Projectiles/Ranged/HydraHead.cs @@ -1,11 +1,11 @@ -using CalamityMod.DataStructures; -using CalamityMod.Items.Weapons.Ranged; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; +using System; using System.Collections.Generic; using System.IO; using System.Linq; +using CalamityMod.DataStructures; +using CalamityMod.Items.Weapons.Ranged; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ModLoader; @@ -137,7 +137,7 @@ namespace CalamityMod.Projectiles.Ranged public void PerformAttacks(Vector2 aimDestination) { Item heldItem = Owner.ActiveItem(); - + Vector2 shootDirection = Projectile.SafeDirectionTo(aimDestination); //Normal shot @@ -229,7 +229,7 @@ namespace CalamityMod.Projectiles.Ranged } bool shouldFlip = Math.Abs(Projectile.rotation) > MathHelper.PiOver2; - Texture2D headTexture = ModContent.Request(Texture).Value; + Texture2D headTexture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(headTexture, Projectile.Center - Main.screenPosition + Vector2.UnitY * Projectile.gfxOffY, null, @@ -245,4 +245,4 @@ namespace CalamityMod.Projectiles.Ranged public override bool? CanDamage() => false; } -} \ No newline at end of file +} diff --git a/Projectiles/Ranged/HydraHeadLaunch.cs b/Projectiles/Ranged/HydraHeadLaunch.cs index a75cc27c10..96026b9f59 100644 --- a/Projectiles/Ranged/HydraHeadLaunch.cs +++ b/Projectiles/Ranged/HydraHeadLaunch.cs @@ -2,8 +2,8 @@ using CalamityMod.Sounds; using Microsoft.Xna.Framework; using Terraria; -using Terraria.ModLoader; using Terraria.Audio; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { @@ -64,4 +64,4 @@ namespace CalamityMod.Projectiles.Ranged SoundEngine.PlaySound(CommonCalamitySounds.LargeWeaponFireSound, Projectile.Center); } } -} \ No newline at end of file +} diff --git a/Projectiles/Ranged/HydrasBlood.cs b/Projectiles/Ranged/HydrasBlood.cs index c33ca28831..0ba74cfb66 100644 --- a/Projectiles/Ranged/HydrasBlood.cs +++ b/Projectiles/Ranged/HydrasBlood.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -35,7 +35,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; if (Projectile.timeLeft < 85 && Main.rand.NextBool(3)) { - Dust dust = Dust.NewDustDirect(Projectile.Center, 1, 1, 171); + Dust dust = Dust.NewDustDirect(Projectile.Center, 1, 1, DustID.Venom); dust.velocity = Projectile.velocity.RotatedByRandom(MathHelper.ToRadians(5f)) * -0.5f; dust.scale = Main.rand.NextFloat(0.3f, 1.6f); dust.noGravity = true; @@ -46,7 +46,7 @@ namespace CalamityMod.Projectiles.Ranged { for (int i = 0; i < 14; i++) { - Dust dust = Dust.NewDustDirect(Projectile.position, 14, 14, 171); + Dust dust = Dust.NewDustDirect(Projectile.position, 14, 14, DustID.Venom); dust.scale = Main.rand.NextFloat(0.3f, 1.6f); dust.noGravity = true; } diff --git a/Projectiles/Ranged/HyperiusBulletProj.cs b/Projectiles/Ranged/HyperiusBulletProj.cs index 437376db11..8a5405821b 100644 --- a/Projectiles/Ranged/HyperiusBulletProj.cs +++ b/Projectiles/Ranged/HyperiusBulletProj.cs @@ -1,4 +1,6 @@ -using Microsoft.Xna.Framework; +using System; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,55 +11,79 @@ namespace CalamityMod.Projectiles.Ranged { public new string LocalizationCategory => "Projectiles.Ranged"; private Color currentColor = Color.Black; - + public float dustAngle = 0f; + public bool growing = false; + public bool dustWave = false; + public float variance; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - Projectile.width = 4; - Projectile.height = 4; + Projectile.width = 6; + Projectile.height = 6; Projectile.aiStyle = ProjAIStyleID.Arrow; Projectile.friendly = true; Projectile.DamageType = DamageClass.Ranged; Projectile.penetrate = 1; - Projectile.timeLeft = 600; - Projectile.extraUpdates = 3; + Projectile.timeLeft = 1200; + Projectile.extraUpdates = 7; AIType = ProjectileID.Bullet; + Projectile.ignoreWater = true; Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } public override void AI() { + Player Owner = Main.player[Projectile.owner]; + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); + + variance = Main.rand.NextFloat(0.3f, 1.7f); if (currentColor == Color.Black) { - int startPoint = Main.rand.Next(6); - Projectile.localAI[0] = startPoint; - currentColor = GetStartingColor(startPoint); + dustWave = Main.rand.NextBool(); + Projectile.scale = 1.5f; + Projectile.velocity *= 0.3f; + switch (Main.rand.Next(0, 4 +1)) + { + case 4: // Yellow shot + currentColor = Color.Yellow * 0.65f; + break; + case 3: // Magenta shot + currentColor = Color.Magenta * 0.65f; + break; + case 2: // Red shot + currentColor = Color.Red * 0.65f; + break; + case 1: // Blue shot + currentColor = Color.Cyan * 0.65f; + break; + default: // Green shot + currentColor = Color.Lime * 0.65f; + break; + } } - Visuals(Projectile, ref currentColor); - } - - internal static void Visuals(Projectile projectile, ref Color c) - { - CalamityUtils.IterateDisco(ref c, ref projectile.localAI[0], 15); - Vector3 compositeColor = 0.1f * Color.White.ToVector3() + 0.05f * c.ToVector3(); - Lighting.AddLight(projectile.Center, compositeColor); - } - - internal static Color GetStartingColor(int startPoint = 0) - { - switch (startPoint) + if (dustAngle <= -0.5f) { - default: return new Color(1f, 0f, 0f, 0f); // Color.Red - case 1: return new Color(1f, 1f, 0f, 0f); // Color.Yellow - case 2: return new Color(0f, 1f, 0f, 0f); // Color.Green - case 3: return new Color(0f, 1f, 1f, 0f); // Color.Turquoise - case 4: return new Color(0f, 0f, 1f, 0f); // Color.Blue - case 5: return new Color(1f, 0f, 1f, 0f); // Color.Violet + growing = true; + } + if (dustAngle >= 0.5f) + { + growing = false; + } + dustAngle += (growing ? 0.07f * variance : -0.07f * variance); + + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 12f && targetDist < 1200f) + { + GlowOrbParticle orb = new GlowOrbParticle((Projectile.Center + Projectile.velocity.RotatedBy((dustWave ? 1 : -1) * dustAngle) * 4.5f) - Projectile.velocity * 5, Vector2.Zero, false, 5, 0.55f + MathF.Abs(dustAngle * 0.5f), currentColor, true, true); + GeneralParticleHandler.SpawnParticle(orb); + + PointParticle spark = new PointParticle(Projectile.Center + Projectile.velocity * 3.5f, Projectile.velocity, false, 2, 0.6f, currentColor); + GeneralParticleHandler.SpawnParticle(spark); } } @@ -69,10 +95,24 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesFromEdge(Projectile, 0, lightColor); + if (Projectile.localAI[0] > 25f) + { + CalamityUtils.DrawAfterimagesFromEdge(Projectile, 0, lightColor); + } return false; } + public override bool OnTileCollide(Vector2 oldVelocity) + { + if (Projectile.owner == Main.myPlayer) + { + for (int b = 0; b < 3; b++) + { + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, -oldVelocity.RotatedByRandom(0.5f) * 0.7f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.35), 0f, Projectile.owner, 0f, 0f, Main.rand.Next(0, 4 + 1)); + } + } + return true; + } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { OnHitEffects(target.Center); @@ -87,24 +127,23 @@ namespace CalamityMod.Projectiles.Ranged { if (Projectile.owner == Main.myPlayer) { - var source = Projectile.GetSource_FromThis(); - CalamityUtils.ProjectileBarrage(source, Projectile.Center, targetPos, Main.rand.NextBool(), 800f, 800f, 0f, 800f, 10f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.6), 1f, Projectile.owner, true); + for (int b = 0; b < 3; b++) + { + Vector2 velocity = Projectile.velocity.RotatedByRandom(0.5f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity * 0.7f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.15), Projectile.knockBack * 2f, Projectile.owner, 0f, 0f, Main.rand.Next(0, 4 + 1)); + } } } public override void OnKill(int timeLeft) { - const int killDust = 3; - int[] dustTypes = new int[] { 60, 61, 59 }; - for (int i = 0; i < killDust; ++i) + for (int b = 0; b < 4; b++) { - int dustType = dustTypes[Main.rand.Next(3)]; - float scale = Main.rand.NextFloat(0.4f, 0.9f); - float velScale = Main.rand.NextFloat(3f, 5.5f); - int dustID = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType); - Main.dust[dustID].noGravity = true; - Main.dust[dustID].scale = scale; - Main.dust[dustID].velocity *= velScale; + Dust dust = Dust.NewDustPerfect(Projectile.Center, 66, new Vector2(4, 4).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1.5f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.7f, 1.4f); + dust.color = currentColor; + dust.fadeIn = 0; } } } diff --git a/Projectiles/Ranged/HyperiusBulletProj.png b/Projectiles/Ranged/HyperiusBulletProj.png index 796dc78281..0c47186788 100644 Binary files a/Projectiles/Ranged/HyperiusBulletProj.png and b/Projectiles/Ranged/HyperiusBulletProj.png differ diff --git a/Projectiles/Ranged/HyperiusSplit.cs b/Projectiles/Ranged/HyperiusSplit.cs index 92285230c9..8bff3cfed8 100644 --- a/Projectiles/Ranged/HyperiusSplit.cs +++ b/Projectiles/Ranged/HyperiusSplit.cs @@ -1,4 +1,7 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Items.Ammo; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,69 +11,106 @@ namespace CalamityMod.Projectiles.Ranged public class HyperiusSplit : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Ranged"; - public override string Texture => "CalamityMod/Projectiles/Ranged/HyperiusBulletProj"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; private Color currentColor = Color.Black; - + private int rotDirection = 1; + private float rotIntensity; + private bool rotPhase2 = false; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 20; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; } - public override void SetDefaults() { - // Intentionally large bullet hitbox to make Hyperius swarm more forgiving with hits - Projectile.width = 8; - Projectile.height = 8; + Projectile.width = 12; + Projectile.height = 12; Projectile.aiStyle = ProjAIStyleID.Arrow; Projectile.friendly = true; Projectile.DamageType = DamageClass.Ranged; Projectile.tileCollide = false; - Projectile.penetrate = 1; - Projectile.timeLeft = 360; - Projectile.extraUpdates = 1; + Projectile.penetrate = 2; + Projectile.timeLeft = 500; + Projectile.extraUpdates = 4; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10 * Projectile.extraUpdates; + Projectile.alpha = 255; + Projectile.ignoreWater = true; AIType = ProjectileID.Bullet; } public override void AI() { + Projectile.localAI[0]++; if (currentColor == Color.Black) { - int startPoint = Main.rand.Next(6); - Projectile.localAI[0] = startPoint; - currentColor = HyperiusBulletProj.GetStartingColor(startPoint); + Projectile.scale = 0.025f; + Projectile.alpha = 255; + rotDirection = Main.rand.NextBool() ? 1 : -1; + rotIntensity = Main.rand.NextFloat(0.5f, 1.5f); + Projectile.timeLeft = Main.rand.Next(250, 300 + 1); + switch (Projectile.ai[2]) + { + case 4: // Yellow shot + currentColor = Color.Yellow * 0.65f; + break; + case 3: // Magenta shot + currentColor = Color.Magenta * 0.65f; + break; + case 2: // Red shot + currentColor = Color.Red * 0.65f; + break; + case 1: // Blue shot + currentColor = Color.Cyan * 0.65f; + break; + default: // Green shot + currentColor = Color.Lime * 0.65f; + break; + } } - HyperiusBulletProj.Visuals(Projectile, ref currentColor); - } - // This projectile is always fullbright. - public override Color? GetAlpha(Color lightColor) - { - return currentColor; - } + if (Projectile.timeLeft == 180) + rotPhase2 = true; - public override bool PreDraw(ref Color lightColor) - { - if (Projectile.timeLeft == 360) - return false; - CalamityUtils.DrawAfterimagesFromEdge(Projectile, 0, lightColor); - return false; + if (rotPhase2) + { + rotIntensity *= 1.001f; + Projectile.velocity *= 0.997f; + Projectile.velocity = Projectile.velocity.RotatedBy(-0.025f * rotIntensity * rotDirection); + } + else + { + Projectile.velocity = Projectile.velocity.RotatedBy(0.015f * rotIntensity * rotDirection); + } } - public override void OnKill(int timeLeft) { - const int killDust = 3; - int[] dustTypes = new int[] { 60, 61, 59 }; - for (int i = 0; i < killDust; ++i) + for (int b = 0; b < 2; b++) { - int dustType = dustTypes[Main.rand.Next(3)]; - float scale = Main.rand.NextFloat(0.4f, 0.9f); - float velScale = Main.rand.NextFloat(3f, 5.5f); - int dustID = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType); - Main.dust[dustID].noGravity = true; - Main.dust[dustID].scale = scale; - Main.dust[dustID].velocity *= velScale; + /* + Dust dust = Dust.NewDustPerfect(Projectile.Center, 66, new Vector2(2, 2).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1.5f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.5f, 1.1f); + dust.color = currentColor; + dust.fadeIn = 0; + */ + GlowOrbParticle orb = new GlowOrbParticle(Projectile.Center, new Vector2(2, 2).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1.5f), false, 5, Main.rand.NextFloat(0.35f, 0.45f), currentColor, true, true); + GeneralParticleHandler.SpawnParticle(orb); } } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 12, targetHitbox); + public override bool PreDraw(ref Color lightColor) + { + Texture2D texture = ModContent.Request("CalamityMod/Particles/LargeBloom").Value; + Texture2D texture2 = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; + + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], Color.Lerp(currentColor, Color.White, 0.15f), 1, texture); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], Color.White with { A = 0 }, 1, texture2); + //Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition, null, Color.White, 0, texture.Size() * 0.5f, Projectile.scale * 1.5f, 0, 0f); + return false; + } + public override bool? CanDamage() => Projectile.localAI[0] < 20 ? false : null; + + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) => modifiers.SourceDamage.Flat += HyperiusBullet.SplitBulletBonusDamage; } } diff --git a/Projectiles/Ranged/IcicleArrowProj.cs b/Projectiles/Ranged/IcicleArrowProj.cs index dd266ed22b..45dc5b612d 100644 --- a/Projectiles/Ranged/IcicleArrowProj.cs +++ b/Projectiles/Ranged/IcicleArrowProj.cs @@ -1,8 +1,9 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -10,57 +11,149 @@ namespace CalamityMod.Projectiles.Ranged { public new string LocalizationCategory => "Projectiles.Ranged"; public override string Texture => "CalamityMod/Items/Ammo/IcicleArrow"; + public bool falling = false; + public Vector2 startVelocity; + public bool setFallingStats = false; public override void SetDefaults() { Projectile.width = 10; Projectile.height = 10; - Projectile.aiStyle = ProjAIStyleID.Arrow; Projectile.friendly = true; Projectile.DamageType = DamageClass.Ranged; Projectile.arrow = true; Projectile.coldDamage = true; - Projectile.penetrate = 1; - Projectile.extraUpdates = 1; - Projectile.coldDamage = true; + Projectile.penetrate = -1; + Projectile.extraUpdates = 6; + Projectile.timeLeft = 1000; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 15 * Projectile.extraUpdates; Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } public override void AI() { - //icicle dust - if (Main.rand.NextBool()) + Player Owner = Main.player[Projectile.owner]; + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); + + if (Projectile.localAI[0] == 0f) { - int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 68, Projectile.velocity.X, Projectile.velocity.Y, 0, default, 1.1f); - Main.dust[index2].noGravity = true; + startVelocity = Projectile.velocity; } + Projectile.localAI[0] += 1f; Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; + + if (!falling) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center - Projectile.velocity * 2, Main.rand.NextBool(3) ? 135 : 279, -Projectile.velocity.RotatedByRandom(0.5f) * Main.rand.NextFloat(0.05f, 0.4f) - new Vector2(0, 1)); + dust.scale = Main.rand.NextFloat(0.35f, 0.6f); + dust.noGravity = false; + + Projectile.velocity *= 0.99f; + Projectile.alpha += 1; + if (Projectile.localAI[0] == 200) + { + for (int k = 0; k < 10; k++) + { + Dust dust2 = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(3) ? 135 : 279, new Vector2(3, 3).RotatedByRandom(100) * Main.rand.NextFloat(0.05f, 0.8f)); + dust2.scale = Main.rand.NextFloat(1.2f, 2.2f); + dust2.noGravity = true; + } + Projectile.alpha = 255; + Projectile.velocity = new Vector2(0, 0.3f); + + falling = true; + } + } + else + { + if (!setFallingStats) + { + Projectile.tileCollide = false; + Projectile.penetrate = 2; + Projectile.numHits = 1; + Projectile.ExpandHitboxBy(50); + setFallingStats = true; + } + if (Projectile.Calamity().allProjectilesHome) + Projectile.Calamity().allProjectilesHome = false; // Prevent the icicle effect from breaking with Arterial Assault + + if (targetDist < 1400f) + { + SparkParticle Visual = new SparkParticle(Projectile.Center, Projectile.velocity * 0.1f, false, 2, 1.2f, Color.SkyBlue); + GeneralParticleHandler.SpawnParticle(Visual); + if (Projectile.localAI[0] % 3 == 0) + { + LineParticle subTrail = new LineParticle(Projectile.Center, Projectile.velocity * 0.01f, false, 4, 1.1f, Color.SkyBlue); + GeneralParticleHandler.SpawnParticle(subTrail); + } + } + + if (Projectile.localAI[0] < 320) + Projectile.velocity *= 1.033f; + else + Projectile.tileCollide = true; + } + + } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(BuffID.Frostburn2, 180); - } - - public override void OnKill(int timeLeft) - { - SoundEngine.PlaySound(SoundID.Item27, Projectile.position); - for (int index1 = 0; index1 < 5; ++index1) + if (Projectile.Calamity().allProjectilesHome) + Projectile.Calamity().allProjectilesHome = false; // Prevent the icicle effect from breaking with Arterial Assault + if (!falling) { - int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 68, 0f, 0f, 0, new Color(), 1f); - Main.dust[index2].noGravity = true; - Main.dust[index2].velocity *= 1.5f; - Main.dust[index2].scale *= 0.9f; - } - if (Projectile.owner == Main.myPlayer) - { - for (int index = 0; index < 3; ++index) + Projectile.localAI[0] = 100; + SoundEngine.PlaySound(SoundID.Item50 with { Volume = 0.35f, Pitch = -0.2f, PitchVariance = 0.2f }, Projectile.Center); + Projectile.velocity = new Vector2(0, -6.5f).RotatedByRandom(0.25f) * Main.rand.NextFloat(0.75f, 1.1f); + for (int k = 0; k < 2; k++) { - float SpeedX = -Projectile.velocity.X * Main.rand.Next(40, 70) * 0.01f + Main.rand.Next(-20, 21) * 0.4f; - float SpeedY = -Projectile.velocity.Y * Main.rand.Next(40, 70) * 0.01f + Main.rand.Next(-20, 21) * 0.4f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X + SpeedX, Projectile.Center.Y + SpeedY, SpeedX, SpeedY, ProjectileID.CrystalShard, Projectile.damage / 3, 0f, Projectile.owner); + Vector2 velocity = startVelocity.RotatedByRandom(0.4f) * Main.rand.NextFloat(0.3f, 0.85f); + WaterFlavoredParticle burst = new WaterFlavoredParticle(Projectile.Center + velocity * 3f, velocity * 0.5f, false, 8, 0.65f, Color.SkyBlue); + GeneralParticleHandler.SpawnParticle(burst); } } } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + if (falling) + modifiers.SourceDamage *= 1.35f; + + if (Projectile.numHits > 1 && falling) + Projectile.damage = (int)(Projectile.damage * 0.6f); + if (Projectile.damage < 1) + Projectile.damage = 1; + } + public override void OnKill(int timeLeft) + { + SoundEngine.PlaySound(SoundID.Item27 with { Volume = 0.3f, Pitch = 0.8f }, Projectile.Center); + for (int k = 0; k < 12; k++) + { + Dust dust2 = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(3) ? 135 : 279, new Vector2(3, 3).RotatedByRandom(100) * Main.rand.NextFloat(0.05f, 0.8f)); + dust2.scale = Main.rand.NextFloat(0.65f, 0.85f); + dust2.noGravity = false; + } + } + public override bool OnTileCollide(Vector2 oldVelocity) + { + if (!falling) + { + Projectile.localAI[0] = 100; + SoundEngine.PlaySound(SoundID.Item50 with { Volume = 0.35f, Pitch = -0.2f, PitchVariance = 0.2f }, Projectile.Center); + for (int k = 0; k < 7; k++) + { + Dust dust2 = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(3) ? 135 : 279, new Vector2(3, 3).RotatedByRandom(100) * Main.rand.NextFloat(0.05f, 0.8f)); + dust2.scale = Main.rand.NextFloat(0.75f, 0.95f); + dust2.noGravity = false; + } + Projectile.velocity = new Vector2(0, -6.5f).RotatedByRandom(0.25f) * Main.rand.NextFloat(0.75f, 1.1f); + return false; + } + else + return true; + } + public override bool? CanDamage() => !falling && Projectile.numHits >= 1 ? false : null; } } diff --git a/Projectiles/Ranged/IcyBulletProj.cs b/Projectiles/Ranged/IcyBulletProj.cs deleted file mode 100644 index f5a7a045d5..0000000000 --- a/Projectiles/Ranged/IcyBulletProj.cs +++ /dev/null @@ -1,86 +0,0 @@ -using CalamityMod.Buffs.StatDebuffs; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Audio; - -namespace CalamityMod.Projectiles.Ranged -{ - public class IcyBulletProj : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Ranged"; - public override void SetStaticDefaults() - { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 3; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; - } - - public override void SetDefaults() - { - Projectile.width = 4; - Projectile.height = 4; - Projectile.aiStyle = ProjAIStyleID.Arrow; - AIType = ProjectileID.Bullet; - Projectile.timeLeft = 600; - Projectile.friendly = true; - Projectile.DamageType = DamageClass.Ranged; - Projectile.coldDamage = true; - Projectile.penetrate = 3; - Projectile.extraUpdates = 3; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = -1; // changed from 20 to prevent multi-hit madness on fat targets - Projectile.coldDamage = true; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; - } - - public override void AI() - { - Projectile.localAI[0] += 1f; - if (Projectile.localAI[0] > 4f) - { - if (Main.rand.NextBool(3)) - { - int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 88, Projectile.velocity.X, Projectile.velocity.Y, 0, default, 1f); - Main.dust[index2].noGravity = true; - } - } - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(BuffID.Frostburn2, 180); - } - - public override bool PreDraw(ref Color lightColor) - { - CalamityUtils.DrawAfterimagesFromEdge(Projectile, 0, lightColor); - return false; - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(200, 200, 200, Projectile.alpha); - } - - public override void OnKill(int timeLeft) - { - SoundEngine.PlaySound(SoundID.Item27, Projectile.position); - for (int index1 = 0; index1 < 5; ++index1) - { - int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 88, 0f, 0f, 0, new Color(), 0.9f); - Main.dust[index2].noGravity = true; - Main.dust[index2].velocity *= 1.5f; - } - if (Projectile.owner == Main.myPlayer) - { - for (int index = 0; index < 2; ++index) - { - float SpeedX = -Projectile.velocity.X * Main.rand.Next(40, 70) * 0.01f + Main.rand.Next(-20, 21) * 0.4f; - float SpeedY = -Projectile.velocity.Y * Main.rand.Next(40, 70) * 0.01f + Main.rand.Next(-20, 21) * 0.4f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X + SpeedX, Projectile.Center.Y + SpeedY, SpeedX, SpeedY, ProjectileID.CrystalShard, Projectile.damage / 2, 0f, Projectile.owner); - } - } - } - } -} diff --git a/Projectiles/Ranged/ImpactRound.cs b/Projectiles/Ranged/ImpactRound.cs index 48be577a9d..ca6d4982e1 100644 --- a/Projectiles/Ranged/ImpactRound.cs +++ b/Projectiles/Ranged/ImpactRound.cs @@ -1,9 +1,9 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Sounds; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using CalamityMod.Sounds; namespace CalamityMod.Projectiles.Ranged { @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Ranged if (Main.netMode != NetmodeID.Server) { - SoundEngine.PlaySound(CommonCalamitySounds.LargeWeaponFireSound with { Volume = CommonCalamitySounds.LargeWeaponFireSound.Volume * 0.45f}, Projectile.Center); + SoundEngine.PlaySound(CommonCalamitySounds.LargeWeaponFireSound with { Volume = CommonCalamitySounds.LargeWeaponFireSound.Volume * 0.45f }, Projectile.Center); } } } diff --git a/Projectiles/Ranged/KarasawaShot.cs b/Projectiles/Ranged/KarasawaShot.cs index d3e9248584..68a689ae84 100644 --- a/Projectiles/Ranged/KarasawaShot.cs +++ b/Projectiles/Ranged/KarasawaShot.cs @@ -1,10 +1,10 @@ -using CalamityMod.Buffs.StatDebuffs; +using System; +using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { public class KarasawaShot : ModProjectile, ILocalizedModType @@ -89,14 +89,14 @@ namespace CalamityMod.Projectiles.Ranged dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); int randomDustType = Main.rand.NextBool() ? dust1 : dust2; - int newDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 200, default, 1.7f); + int newDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 200, default, 1.7f); Dust dust = Main.dust[newDust]; dust.position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; dust.noGravity = true; dust.velocity *= randomDustType == dust2 ? 2f : 4f; - newDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 100, default, 0.8f); + newDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 100, default, 0.8f); dust.position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; dust.velocity *= randomDustType == dust2 ? 1.33f : 2.66f; @@ -113,7 +113,7 @@ namespace CalamityMod.Projectiles.Ranged dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); int randomDustType = Main.rand.NextBool() ? dust1 : dust2; - int newDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 0, default, 2f); + int newDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 0, default, 2f); Dust dust = Main.dust[newDust2]; dust.position = Projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)Projectile.velocity.ToRotation(), default) * (float)Projectile.width / 3f; dust.noGravity = true; diff --git a/Projectiles/Ranged/KingsbaneHoldout.cs b/Projectiles/Ranged/KingsbaneHoldout.cs index f51f3a7772..9ac5958b2b 100644 --- a/Projectiles/Ranged/KingsbaneHoldout.cs +++ b/Projectiles/Ranged/KingsbaneHoldout.cs @@ -1,8 +1,5 @@ using CalamityMod.Items.Weapons.Ranged; -using CalamityMod.Particles; using Microsoft.Xna.Framework; -using ReLogic.Utilities; -using System; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -15,7 +12,6 @@ namespace CalamityMod.Projectiles.Ranged { // Take the name and texture from the weapon public override LocalizedText DisplayName => CalamityUtils.GetItemName(); - private bool OwnerCanShoot => Owner.channel && !Owner.noItems && !Owner.CCed; public override string Texture => "CalamityMod/Projectiles/Ranged/KingsbaneWindUp"; private Player Owner => Main.player[Projectile.owner]; @@ -47,7 +43,7 @@ namespace CalamityMod.Projectiles.Ranged soundTimer++; Projectile.frameCounter++; - if (Projectile.frameCounter > windupAnim && OwnerCanShoot) + if (Projectile.frameCounter > windupAnim && !Owner.CantUseHoldout()) { if (Projectile.frame == 1 && Time < 85) { @@ -59,7 +55,7 @@ namespace CalamityMod.Projectiles.Ranged windupAnim--; Projectile.frameCounter = 0; } - else if (!OwnerCanShoot) + else if (Owner.CantUseHoldout()) { Projectile.frame++; } @@ -74,14 +70,14 @@ namespace CalamityMod.Projectiles.Ranged } Vector2 armPosition = Owner.RotatedRelativePoint(Owner.MountedCenter, true); - Vector2 tipPosition = armPosition + Projectile.velocity * Projectile.width * 0.85f + new Vector2 (0, 3.8f); + Vector2 tipPosition = armPosition + Projectile.velocity * Projectile.width * 0.85f + new Vector2(0, 3.8f); Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * 15; int bulletAMMO = ProjectileID.Bullet; Owner.PickAmmo(Owner.ActiveItem(), out bulletAMMO, out float SpeedNoUse, out int bulletDamage, out float kBackNoUse, out int _); // Fire Auric Bullets if the owner stops channeling or otherwise cannot use the weapon. - if (!OwnerCanShoot) + if (Owner.CantUseHoldout()) { if (fullRev && fullRevShots > 0) { @@ -125,13 +121,13 @@ 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); + SoundEngine.PlaySound(SoundID.Item41 with { Volume = 0.75f }, Projectile.Center); framesBetweenShots = 3; } if (framesBetweenShots > 0) framesBetweenShots--; } - + } UpdateProjectileHeldVariables(armPosition); ManipulatePlayerVariables(); @@ -150,12 +146,12 @@ namespace CalamityMod.Projectiles.Ranged Projectile.netUpdate = true; } } - Projectile.Center = armPosition + Projectile.velocity * MathHelper.Clamp(47f - (framesBetweenShots * 2), 0f, 47f) + new Vector2 (0, 5); + Projectile.Center = armPosition + Projectile.velocity * MathHelper.Clamp(47f - (framesBetweenShots * 2), 0f, 47f) + new Vector2(0, 5); Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f); Projectile.spriteDirection = Projectile.direction; // Rumble - if (!OwnerCanShoot) + if (Owner.CantUseHoldout()) { Projectile.position += Main.rand.NextVector2Circular(4.5f, 4.5f); } diff --git a/Projectiles/Ranged/LeafArrow.cs b/Projectiles/Ranged/LeafArrow.cs index 9208340d8e..495a5168e8 100644 --- a/Projectiles/Ranged/LeafArrow.cs +++ b/Projectiles/Ranged/LeafArrow.cs @@ -1,9 +1,9 @@ +using System; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -50,7 +50,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.localAI[0] = 0f; } } - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 3.14f; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.Pi; if (Projectile.localAI[1] <= 30f) { Projectile.localAI[1] += 1f; @@ -86,7 +86,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.localAI[1] += 1f; for (int i = 0; i < 5; i++) { - int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 157, 0f, 0f, 0, new Color(Main.DiscoR, 203, 103), 1f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.ChlorophyteWeapon, 0f, 0f, 0, new Color(Main.DiscoR, 203, 103), 1f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 3f; Main.dust[dust].scale = 1.5f; diff --git a/Projectiles/Ranged/LunarBolt.cs b/Projectiles/Ranged/LunarBolt.cs index 2a55c1afe1..b7fa456499 100644 --- a/Projectiles/Ranged/LunarBolt.cs +++ b/Projectiles/Ranged/LunarBolt.cs @@ -1,8 +1,8 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { public class LunarBolt : ModProjectile, ILocalizedModType @@ -32,7 +32,7 @@ namespace CalamityMod.Projectiles.Ranged for (int d = 0; d < 5; d++) { Vector2 dspeed = -Projectile.velocity * 0.5f; - int index = Dust.NewDust(Projectile.Center, 1, 1, 206, 0f, 0f, 0, default, 1.2f); + int index = Dust.NewDust(Projectile.Center, 1, 1, DustID.UnusedWhiteBluePurple, 0f, 0f, 0, default, 1.2f); Main.dust[index].alpha = Projectile.alpha; Main.dust[index].velocity = dspeed; Main.dust[index].noGravity = true; @@ -40,7 +40,7 @@ namespace CalamityMod.Projectiles.Ranged for (int d = 0; d < 5; d++) { Vector2 dspeed2 = -Projectile.velocity * 0.5f; - int index = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 107, 0f, 0f, 0, default, 0.7f); + int index = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.TerraBlade, 0f, 0f, 0, default, 0.7f); Main.dust[index].alpha = Projectile.alpha; Main.dust[index].velocity = dspeed2; Main.dust[index].noGravity = true; diff --git a/Projectiles/Ranged/LuxorsGiftRanged.cs b/Projectiles/Ranged/LuxorsGiftRanged.cs index d478ffc0b1..70ab922648 100644 --- a/Projectiles/Ranged/LuxorsGiftRanged.cs +++ b/Projectiles/Ranged/LuxorsGiftRanged.cs @@ -1,8 +1,8 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -68,7 +68,7 @@ namespace CalamityMod.Projectiles.Ranged Vector2 offset = Vector2.UnitX * (float)-(float)Projectile.width / 2f; offset += -Vector2.UnitY.RotatedBy((double)(l * MathHelper.Pi / 6f), default) * new Vector2(8f, 16f); offset = offset.RotatedBy((double)(Projectile.rotation - MathHelper.PiOver2), default); - int electric = Dust.NewDust(Projectile.Center, 0, 0, 135, 0f, 0f, 160, default, 1f); + int electric = Dust.NewDust(Projectile.Center, 0, 0, DustID.IceTorch, 0f, 0f, 160, default, 1f); Main.dust[electric].scale = 1.1f; Main.dust[electric].noGravity = true; Main.dust[electric].position = Projectile.Center + offset; @@ -89,7 +89,7 @@ namespace CalamityMod.Projectiles.Ranged int dustAmt = Main.rand.Next(10, 20); for (int d = 0; d < dustAmt; d++) { - int electric = Dust.NewDust(Projectile.Center - Projectile.velocity / 2f, 0, 0, 135, 0f, 0f, 100, default, 2f); + int electric = Dust.NewDust(Projectile.Center - Projectile.velocity / 2f, 0, 0, DustID.IceTorch, 0f, 0f, 100, default, 2f); Main.dust[electric].velocity *= 2f; Main.dust[electric].noGravity = true; } diff --git a/Projectiles/Ranged/LuxorsGiftRanged.png b/Projectiles/Ranged/LuxorsGiftRanged.png index e05c83cbe4..21c519768f 100644 Binary files a/Projectiles/Ranged/LuxorsGiftRanged.png and b/Projectiles/Ranged/LuxorsGiftRanged.png differ diff --git a/Projectiles/Ranged/MaelstromHoldout.cs b/Projectiles/Ranged/MaelstromHoldout.cs index 07797ac2f3..b67a1b6cdb 100644 --- a/Projectiles/Ranged/MaelstromHoldout.cs +++ b/Projectiles/Ranged/MaelstromHoldout.cs @@ -13,9 +13,7 @@ namespace CalamityMod.Projectiles.Ranged { public override LocalizedText DisplayName => CalamityUtils.GetItemName(); private Player Owner => Main.player[Projectile.owner]; - private bool OwnerCanShoot => Owner.channel && Owner.HasAmmo(Owner.ActiveItem()) && !Owner.noItems && !Owner.CCed; private ref float CurrentChargingFrames => ref Projectile.ai[0]; - private ref float ArrowsLoaded => ref Projectile.ai[1]; private ref float FramesToLoadNextArrow => ref Projectile.localAI[0]; public override string Texture => "CalamityMod/Items/Weapons/Ranged/TheMaelstrom"; @@ -37,7 +35,7 @@ namespace CalamityMod.Projectiles.Ranged Vector2 shootPosition = armPosition + Projectile.velocity * Projectile.width * 0.5f; // Destroy the holdout projectile if the owner is no longer eligible to hold it. - if (!OwnerCanShoot) + if (Owner.CantUseHoldout() || !Owner.HasAmmo(Owner.ActiveItem())) { Projectile.Kill(); return; @@ -93,7 +91,6 @@ namespace CalamityMod.Projectiles.Ranged float shootSpeed = heldItem.shootSpeed; float knockback = heldItem.knockBack; - bool uselessFuckYou = OwnerCanShoot; int projectileType = 0; Owner.PickAmmo(heldItem, out projectileType, out shootSpeed, out arrowDamage, out knockback, out _); projectileType = ModContent.ProjectileType(); diff --git a/Projectiles/Ranged/MagnaCannonHoldout.cs b/Projectiles/Ranged/MagnaCannonHoldout.cs index 47ddf75246..46cd0b8502 100644 --- a/Projectiles/Ranged/MagnaCannonHoldout.cs +++ b/Projectiles/Ranged/MagnaCannonHoldout.cs @@ -1,8 +1,8 @@ -using CalamityMod.Items.Weapons.Ranged; +using System; +using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Particles; using Microsoft.Xna.Framework; using ReLogic.Utilities; -using System; using Terraria; using Terraria.Audio; using Terraria.Localization; @@ -29,8 +29,6 @@ namespace CalamityMod.Projectiles.Ranged private bool FullyCharged => CurrentChargingFrames >= MagnaCannon.FullChargeFrames; public int Time = 0; - private bool OwnerCanShoot => Owner.channel && !Owner.noItems && !Owner.CCed; - public override void SetDefaults() { Projectile.width = 58; @@ -62,7 +60,7 @@ namespace CalamityMod.Projectiles.Ranged ChargeSound.Position = Projectile.Center; // Fire if the owner stops channeling or otherwise cannot use the weapon. - if (!OwnerCanShoot) + if (Owner.CantUseHoldout()) { if (ShotsLoaded > 0) { @@ -70,7 +68,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.timeLeft = MagnaCannon.AftershotCooldownFrames; ShootTimer--; } - + if (ShootTimer <= 0f) { ChargeSound?.Stop(); @@ -158,7 +156,7 @@ namespace CalamityMod.Projectiles.Ranged // Rumble (only while channeling) float rumble = MathHelper.Clamp(CurrentChargingFrames, 0f, MagnaCannon.FullChargeFrames); - if (OwnerCanShoot) + if (!Owner.CantUseHoldout()) Projectile.position += Main.rand.NextVector2Circular(rumble / 43f, rumble / 43f); } diff --git a/Projectiles/Ranged/MagnomalyAura.cs b/Projectiles/Ranged/MagnomalyAura.cs index 7b2ba4cdc3..0d3807eddf 100644 --- a/Projectiles/Ranged/MagnomalyAura.cs +++ b/Projectiles/Ranged/MagnomalyAura.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; diff --git a/Projectiles/Ranged/MagnomalyRocket.cs b/Projectiles/Ranged/MagnomalyRocket.cs index 8011c7761d..3f2f51beb3 100644 --- a/Projectiles/Ranged/MagnomalyRocket.cs +++ b/Projectiles/Ranged/MagnomalyRocket.cs @@ -1,10 +1,10 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { public class MagnomalyRocket : ModProjectile, ILocalizedModType diff --git a/Projectiles/Ranged/MeowCreature.cs b/Projectiles/Ranged/MeowCreature.cs index c86d636e43..1186139e71 100644 --- a/Projectiles/Ranged/MeowCreature.cs +++ b/Projectiles/Ranged/MeowCreature.cs @@ -1,9 +1,9 @@ -using CalamityMod.Graphics.Primitives; +using System; +using System.Linq; +using CalamityMod.Graphics.Primitives; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.Linq; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -63,7 +63,7 @@ namespace CalamityMod.Projectiles.Ranged public override void PostDraw(Color lightColor) { PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(WidthFunction, ColorFunction, (_) => Projectile.Size * 0.5f), 30); - Texture2D glow = ModContent.Request(Texture).Value; + Texture2D glow = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(glow, Projectile.Center - Main.screenPosition, null, Color.White, Projectile.rotation, glow.Size() * 0.5f, Projectile.scale, SpriteEffects.None); } } diff --git a/Projectiles/Ranged/MeowFire.cs b/Projectiles/Ranged/MeowFire.cs index aaa65e9600..9fe5429ec1 100644 --- a/Projectiles/Ranged/MeowFire.cs +++ b/Projectiles/Ranged/MeowFire.cs @@ -1,6 +1,6 @@ -using CalamityMod.Particles; +using System; +using CalamityMod.Particles; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -39,7 +39,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.scale = 1.5f * Utils.GetLerpValue(6f, 30f, Time, true); else return; // Helps position it at the tip - + // Main smokes composing of blue or pink float smokeRot = MathHelper.ToRadians(3f); // *Rate of rotation per frame, not a constant rotation Color smokeColor = Color.Lerp(PinkFire ? Color.DeepPink : Color.DodgerBlue, PinkFire ? Color.Pink : Color.PowderBlue, 0.5f + 0.3f * MathF.Sin(Main.GlobalTimeWrappedHourly * 5f)); diff --git a/Projectiles/Ranged/MineralMortarHoldout.cs b/Projectiles/Ranged/MineralMortarHoldout.cs index 6b0d1999db..72ced92643 100644 --- a/Projectiles/Ranged/MineralMortarHoldout.cs +++ b/Projectiles/Ranged/MineralMortarHoldout.cs @@ -1,53 +1,37 @@ -using System; -using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Particles; +using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; -using Terraria.DataStructures; using Terraria.ID; -using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { - public class MineralMortarHoldout : ModProjectile, ILocalizedModType + public class MineralMortarHoldout : BaseGunHoldoutProjectile { - public override LocalizedText DisplayName => CalamityUtils.GetItemName(); - public override string Texture => "CalamityMod/Items/Weapons/Ranged/MineralMortar"; + public override int AssociatedItemID => ModContent.ItemType(); + public override float MaxOffsetLengthFromArm => 15f; + public override float OffsetXUpwards => -10f; + public override float BaseOffsetY => -10f; + public override float OffsetYDownwards => 5f; - public Player Owner { get; set; } public ref float Time => ref Projectile.ai[0]; - public ref float OffsetLength => ref Projectile.localAI[0]; - public override void SetDefaults() + public override void HoldoutAI() { - Projectile.width = Projectile.height = 68; - Projectile.tileCollide = false; - Projectile.ignoreWater = true; - Projectile.netImportant = true; - } - - public override void AI() - { - bool cantUse = Owner == null || !Owner.active || Owner.dead || !Owner.channel || Owner.CCed || Owner.noItems; - if (cantUse) - Projectile.Kill(); - Vector2 mouse = Owner.Calamity().mouseWorld; Time++; // If the time reaches Item.useTime, it'll shoot the projectile, consume ammo and reset the timer. - if (Time >= Owner.itemTimeMax) + if (Time >= Owner.itemTimeMax && Main.myPlayer == Projectile.owner) { Owner.PickAmmo(Owner.ActiveItem(), out _, out float speed, out int damage, out float knockback, out int usedItemAmmoId); - Vector2 position = Projectile.Center + Vector2.UnitX.RotatedBy(Projectile.rotation) * Projectile.Size.Length() * 0.5f; - - if (Main.myPlayer == Projectile.owner) - Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), position, Owner.SafeDirectionTo(mouse) * speed, ModContent.ProjectileType(), damage, knockback, Projectile.owner, usedItemAmmoId); + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), GunTipPosition, Projectile.velocity.SafeNormalize(Vector2.UnitX) * speed, ModContent.ProjectileType(), damage, knockback, Projectile.owner, usedItemAmmoId); // Doesn't sync this to the server, it's just effects. if (!Main.dedServ) @@ -55,7 +39,7 @@ namespace CalamityMod.Projectiles.Ranged for (int i = 0; i < 20; i++) { Vector2 randomDirectionToMouse = Owner.SafeDirectionTo(mouse).RotatedByRandom(MathHelper.PiOver2) * Main.rand.NextFloat(8f, 10f); - Dust shootDust = Dust.NewDustPerfect(position, DustID.Torch, randomDirectionToMouse, Scale: Main.rand.NextFloat(1.5f, 2.5f)); + Dust shootDust = Dust.NewDustPerfect(GunTipPosition, DustID.Torch, randomDirectionToMouse, Scale: Main.rand.NextFloat(1.5f, 2.5f)); shootDust.noGravity = true; shootDust.noLight = true; shootDust.noLightEmittence = true; @@ -64,14 +48,14 @@ namespace CalamityMod.Projectiles.Ranged for (int i = 0; i < 8; i++) { Vector2 randomDirectionToMouse = Owner.SafeDirectionTo(mouse).RotatedByRandom(MathHelper.PiOver2) * Main.rand.NextFloat(8f, 10f); - Particle shootMist = new MediumMistParticle(position, randomDirectionToMouse, new Color(255, 100, 0), Color.Transparent, Main.rand.NextFloat(.3f, 1f), Main.rand.NextFloat(200f, 400f)); + Particle shootMist = new MediumMistParticle(GunTipPosition, randomDirectionToMouse, new Color(255, 100, 0), Color.Transparent, Main.rand.NextFloat(.3f, 1f), Main.rand.NextFloat(200f, 400f)); GeneralParticleHandler.SpawnParticle(shootMist); } for (int i = 0; i < 6; i++) { Vector2 randomDirectionToMouse = Owner.SafeDirectionTo(mouse).RotatedByRandom(MathHelper.PiOver2) * Main.rand.NextFloat(2f, 6f); - Particle shootDebri = new StoneDebrisParticle(position, randomDirectionToMouse, Color.Lerp(Color.White, Color.LightGray, Main.rand.NextFloat()), Main.rand.NextFloat(.6f, .8f), Main.rand.Next(30, 45 + 1)); + Particle shootDebri = new StoneDebrisParticle(GunTipPosition, randomDirectionToMouse, Color.Lerp(Color.White, Color.LightGray, Main.rand.NextFloat()), Main.rand.NextFloat(.6f, .8f), Main.rand.Next(30, 45 + 1)); GeneralParticleHandler.SpawnParticle(shootDebri); } @@ -79,67 +63,23 @@ namespace CalamityMod.Projectiles.Ranged } // Makes the distance between the projectile and the player 0, this gives a recoil effect. - OffsetLength = 0f; - + OffsetLengthFromArm = 0f; Time = 0f; } - - // If the recoil happened, reset smoothly to default position. - if (OffsetLength != 15f) - OffsetLength = MathHelper.SmoothStep(OffsetLength, 15f, .2f); - - Vector2 armPosition = Owner.RotatedRelativePoint(Owner.MountedCenter, true); - Vector2 offset = Projectile.rotation.ToRotationVector2() * OffsetLength; - Vector2 armOffset = -Vector2.UnitY.RotatedBy(Projectile.rotation) * Utils.Remap(Vector2.Dot(Projectile.rotation.ToRotationVector2(), -Vector2.UnitY), 0f, -1f, 10f, 3f) * Projectile.direction; - Projectile.Center = armPosition + offset + armOffset; - - Projectile.velocity = Vector2.SmoothStep(Projectile.velocity, (mouse - Owner.MountedCenter).SafeNormalize(Vector2.Zero) * Projectile.Size.Length(), .4f); - Projectile.rotation = Projectile.velocity.ToRotation(); - Projectile.timeLeft = 2; - - Owner.heldProj = Projectile.whoAmI; - Owner.itemTime = Owner.itemAnimation = 2; - Owner.itemRotation = (Projectile.velocity * Projectile.direction).ToRotation(); - - int direction = MathF.Sign(mouse.X - Owner.MountedCenter.X); - Projectile.spriteDirection = Projectile.direction = direction; - Owner.ChangeDir(direction); - - float armRotation = Projectile.rotation - MathHelper.PiOver2; - Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, armRotation); - Owner.SetCompositeArmBack(true, Player.CompositeArmStretchAmount.Full, armRotation); - - // Multiplayer syncing every second. - if (Time % 60 == 0) - { - Projectile.netUpdate = true; - if (Projectile.netSpam >= 10) - Projectile.netSpam = 9; - } } - public override void OnSpawn(IEntitySource source) - { - Owner = Main.player[Projectile.owner]; - OffsetLength = 15f; - } - - public override bool ShouldUpdatePosition() => false; - - public override bool? CanDamage() => false; - public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Vector2 position = Projectile.Center - Main.screenPosition; float rotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f); Vector2 origin = texture.Size() * 0.5f; - SpriteEffects effects = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + SpriteEffects effects = (Projectile.spriteDirection * Owner.gravDir == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None; float shake = Utils.Remap(Time, Owner.itemTimeMax * 0.33f, Owner.itemTimeMax, 0f, 3f); position += Main.rand.NextVector2Circular(shake, shake); - Main.EntitySpriteDraw(texture, position, null, Projectile.GetAlpha(lightColor), rotation, origin, Projectile.scale, effects); + Main.EntitySpriteDraw(texture, position, null, Projectile.GetAlpha(lightColor), rotation, origin, Projectile.scale * Owner.gravDir, effects); return false; } diff --git a/Projectiles/Ranged/MineralMortarProjectile.cs b/Projectiles/Ranged/MineralMortarProjectile.cs index 6d9d685dfd..bbda255676 100644 --- a/Projectiles/Ranged/MineralMortarProjectile.cs +++ b/Projectiles/Ranged/MineralMortarProjectile.cs @@ -172,7 +172,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Vector2 position = Projectile.Center - Main.screenPosition; float rotation = Projectile.rotation + MathHelper.PiOver2; Vector2 origin = texture.Size() * 0.5f; diff --git a/Projectiles/Ranged/MiniRocket.cs b/Projectiles/Ranged/MiniRocket.cs deleted file mode 100644 index 6e31d88847..0000000000 --- a/Projectiles/Ranged/MiniRocket.cs +++ /dev/null @@ -1,184 +0,0 @@ -using Microsoft.Xna.Framework; -using System.Collections.Generic; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Audio; -namespace CalamityMod.Projectiles.Ranged -{ - public class MiniRocket : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Ranged"; - private ref float RocketType => ref Projectile.ai[0]; - - public override void SetStaticDefaults() - { - Main.projFrames[Projectile.type] = 4; - } - - public override void SetDefaults() - { - Projectile.width = 14; - Projectile.height = 14; - Projectile.friendly = true; - Projectile.penetrate = 1; - Projectile.timeLeft = 95; - Projectile.DamageType = DamageClass.Ranged; - } - - public override void AI() - { - Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.ToRadians(90); - - //Animation - Projectile.frameCounter++; - if (Projectile.frameCounter > 7) - { - Projectile.frame++; - Projectile.frameCounter = 0; - } - if (Projectile.frame >= Main.projFrames[Projectile.type]) - { - Projectile.frame = 0; - } - - if (Projectile.velocity.Length() >= 8f) - { - for (int i = 0; i < 2; i++) - { - float halfX = 0f; - float halfY = 0f; - if (i == 1) - { - halfX = Projectile.velocity.X * 0.5f; - halfY = Projectile.velocity.Y * 0.5f; - } - int dusty = Dust.NewDust(new Vector2(Projectile.position.X + 3f + halfX, Projectile.position.Y + 3f + halfY) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 6, 0f, 0f, 100, default, 1f); - Main.dust[dusty].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; - Main.dust[dusty].velocity *= 0.2f; - Main.dust[dusty].noGravity = true; - dusty = Dust.NewDust(new Vector2(Projectile.position.X + 3f + halfX, Projectile.position.Y + 3f + halfY) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 31, 0f, 0f, 100, default, 0.5f); - Main.dust[dusty].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[dusty].velocity *= 0.05f; - } - } - CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 200f, 12f, 20f); - - if (RocketType == ItemID.DryRocket || RocketType == ItemID.WetRocket || RocketType == ItemID.LavaRocket || RocketType == ItemID.HoneyRocket) - { - if (Projectile.wet) - Projectile.timeLeft = 1; - } - } - - public override void OnKill(int timeLeft) - { - Projectile.ExpandHitboxBy(32); - Projectile.maxPenetrate = -1; - Projectile.penetrate = -1; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; - Projectile.Damage(); - SoundEngine.PlaySound(SoundID.Item14, Projectile.position); - for (int j = 0; j < 20; j++) - { - int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 31, 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 + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int k = 0; k < 30; k++) - { - int dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 3f); - Main.dust[dust2].noGravity = true; - Main.dust[dust2].velocity *= 5f; - dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 2f); - Main.dust[dust2].velocity *= 2f; - } - - if (Main.netMode != NetmodeID.Server) - { - Vector2 goreSource = Projectile.Center; - int goreAmt = 3; - Vector2 source = new Vector2(goreSource.X - 24f, goreSource.Y - 24f); - for (int goreIndex = 0; goreIndex < goreAmt; goreIndex++) - { - float velocityMult = 0.33f; - if (goreIndex < (goreAmt / 3)) - { - velocityMult = 0.66f; - } - if (goreIndex >= (2 * goreAmt / 3)) - { - velocityMult = 1f; - } - Mod mod = ModContent.GetInstance(); - int type = Main.rand.Next(61, 64); - int smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); - Gore gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X += 1f; - gore.velocity.Y += 1f; - type = Main.rand.Next(61, 64); - smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); - gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X -= 1f; - gore.velocity.Y += 1f; - type = Main.rand.Next(61, 64); - smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); - gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X += 1f; - gore.velocity.Y -= 1f; - type = Main.rand.Next(61, 64); - smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); - gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X -= 1f; - gore.velocity.Y -= 1f; - } - } - - // Only do rocket effects for the owner client side - if (Projectile.owner != Main.myPlayer) - return; - - int blastRadius = 0; - if (RocketType == ItemID.RocketII) - blastRadius = 3; - else if (RocketType == ItemID.RocketIV) - blastRadius = 6; - else if (RocketType == ItemID.MiniNukeII) - blastRadius = 9; - Projectile.ExpandHitboxBy(14); - - if (blastRadius > 0) - Projectile.ExplodeTiles(blastRadius); - - Point center = Projectile.Center.ToTileCoordinates(); - DelegateMethods.v2_1 = center.ToVector2(); - DelegateMethods.f_1 = 3f; - if (RocketType == ItemID.DryRocket) - { - DelegateMethods.f_1 = 3.5f; - Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadDry); - } - else if (RocketType == ItemID.WetRocket) - { - Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadWater); - } - else if (RocketType == ItemID.LavaRocket) - { - Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadLava); - } - else if (RocketType == ItemID.HoneyRocket) - { - Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadHoney); - } - } - } -} diff --git a/Projectiles/Ranged/MiniSharkron.cs b/Projectiles/Ranged/MiniSharkron.cs index e0f5dec3f4..f0e32544b6 100644 --- a/Projectiles/Ranged/MiniSharkron.cs +++ b/Projectiles/Ranged/MiniSharkron.cs @@ -29,9 +29,9 @@ namespace CalamityMod.Projectiles.Ranged { for (int d = 0; d < 15; ++d) { - int idx = Dust.NewDust(Projectile.Center - Vector2.One * 10f, 50, 50, DustID.Blood, 0f, -2f, 0, default, 1f); - Dust dust = Main.dust[idx]; - dust.velocity /= 2f; + int idx = Dust.NewDust(Projectile.Center - Vector2.One * 10f, 50, 50, DustID.Blood, 0f, -2f, 0, default, 1f); + Dust dust = Main.dust[idx]; + dust.velocity /= 2f; } if (Main.netMode != NetmodeID.Server) { diff --git a/Projectiles/Ranged/MiniatureFolly.cs b/Projectiles/Ranged/MiniatureFolly.cs index 535130f395..de31a813ef 100644 --- a/Projectiles/Ranged/MiniatureFolly.cs +++ b/Projectiles/Ranged/MiniatureFolly.cs @@ -1,8 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -19,7 +19,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.width = 24; Projectile.height = 8; Projectile.friendly = true; - Projectile.DamageType = DamageClass.Ranged; + Projectile.DamageType = DamageClass.Generic; Projectile.penetrate = 1; Projectile.timeLeft = 600; Projectile.light = 0.25f; @@ -50,9 +50,9 @@ namespace CalamityMod.Projectiles.Ranged { Projectile.frame = 0; } - if (Main.rand.Next(5) == 0) + if (Main.rand.NextBool(5)) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 244, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.CopperCoin, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? MathHelper.Pi : 0f); diff --git a/Projectiles/Ranged/MistArrow.cs b/Projectiles/Ranged/MistArrow.cs index 27a6539751..50b745512a 100644 --- a/Projectiles/Ranged/MistArrow.cs +++ b/Projectiles/Ranged/MistArrow.cs @@ -57,7 +57,7 @@ namespace CalamityMod.Projectiles.Ranged if (Projectile.localAI[0] > 4f) { Vector2 dspeed = -Projectile.velocity * Main.rand.NextFloat(0.3f, 0.6f); - int whiteDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 31, 0f, 0f, 100, new Color(237, 242, 242, 200), 1.2f); + int whiteDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Smoke, 0f, 0f, 100, new Color(237, 242, 242, 200), 1.2f); Main.dust[whiteDust].noGravity = true; Main.dust[whiteDust].velocity = dspeed; } @@ -67,14 +67,24 @@ namespace CalamityMod.Projectiles.Ranged { for (int k = 0; k < 5; k++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 31, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f, 100, new Color(237, 242, 242, 200), 1f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Smoke, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f, 100, new Color(237, 242, 242, 200), 1f); + } + + int mistAmt = 2; + for (int m = 0; m < mistAmt; m++) + { + if (Main.myPlayer == Projectile.owner) + { + int frostMist = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, new Vector2(Main.rand.NextFloat(-4f, 4f), Main.rand.NextFloat(-4f, 4f)), ModContent.ProjectileType(), (int)(Projectile.damage * 0.35f), (int)(Projectile.knockBack * 0.5f), Main.myPlayer, Main.rand.Next(3)); + Main.projectile[frostMist].rotation = Main.rand.NextFloat(-MathHelper.Pi, MathHelper.Pi); + } } } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(BuffID.Frostburn2, 180); - target.AddBuff(ModContent.BuffType(), 30); + target.AddBuff(ModContent.BuffType(), 60); } } } diff --git a/Projectiles/Ranged/MistArrowFrostMist.cs b/Projectiles/Ranged/MistArrowFrostMist.cs new file mode 100644 index 0000000000..64f4f7d36d --- /dev/null +++ b/Projectiles/Ranged/MistArrowFrostMist.cs @@ -0,0 +1,73 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class MistArrowFrostMist : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Ranged"; + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 24; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = -1; + Projectile.timeLeft = 60; + Projectile.alpha = 96; + Projectile.tileCollide = false; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.coldDamage = true; + } + + public override void AI() + { + if (Projectile.timeLeft < 20) + { + Projectile.alpha += 8; + if (Projectile.alpha >= 255) + { + Projectile.alpha = 255; + Projectile.Kill(); + } + } + + Projectile.velocity *= 0.975f; + + for (int i = 0; i < 2; i++) + { + Vector2 dustPosition = new Vector2(Projectile.position.X + Main.rand.NextFloat(0f, Projectile.width), Projectile.position.Y + Main.rand.NextFloat(0f, Projectile.height)); + Dust frostDust = Dust.NewDustPerfect(dustPosition, 16, Vector2.Zero, 0, default, 0.45f); + frostDust.noGravity = true; + } + Lighting.AddLight(Projectile.Center, 0.4f, 0.4f, 0.4f); + } + + public override bool PreDraw(ref Color lightColor) + { + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + switch (Projectile.ai[0]) + { + case 0: + break; + case 1: + texture = ModContent.Request("CalamityMod/Projectiles/Ranged/MistArrowFrostMist2").Value; + break; + case 2: + texture = ModContent.Request("CalamityMod/Projectiles/Ranged/MistArrowFrostMist3").Value; + break; + default: + break; + } + Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, texture.Size() / 2, 1f, SpriteEffects.None); + return false; + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.Frostburn2, 45); + } +} diff --git a/Projectiles/Ranged/MistArrowFrostMist.png b/Projectiles/Ranged/MistArrowFrostMist.png new file mode 100644 index 0000000000..ad379318cf Binary files /dev/null and b/Projectiles/Ranged/MistArrowFrostMist.png differ diff --git a/Projectiles/Ranged/MistArrowFrostMist2.png b/Projectiles/Ranged/MistArrowFrostMist2.png new file mode 100644 index 0000000000..547436de59 Binary files /dev/null and b/Projectiles/Ranged/MistArrowFrostMist2.png differ diff --git a/Projectiles/Ranged/MistArrowFrostMist3.png b/Projectiles/Ranged/MistArrowFrostMist3.png new file mode 100644 index 0000000000..f73594760f Binary files /dev/null and b/Projectiles/Ranged/MistArrowFrostMist3.png differ diff --git a/Projectiles/Ranged/MortarRoundProj.cs b/Projectiles/Ranged/MortarRoundProj.cs index 686aaf62c3..07ac04dbda 100644 --- a/Projectiles/Ranged/MortarRoundProj.cs +++ b/Projectiles/Ranged/MortarRoundProj.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Projectiles.Ranged xOffset = Projectile.velocity.X * 0.5f; yOffset = Projectile.velocity.Y * 0.5f; } - int fire = Dust.NewDust(new Vector2(Projectile.position.X + 3f + xOffset, Projectile.position.Y + 3f + yOffset) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 6, 0f, 0f, 100, default, 1f); + int fire = Dust.NewDust(new Vector2(Projectile.position.X + 3f + xOffset, Projectile.position.Y + 3f + yOffset) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, DustID.Torch, 0f, 0f, 100, default, 1f); Main.dust[fire].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; Main.dust[fire].velocity *= 0.2f; Main.dust[fire].noGravity = true; @@ -52,7 +52,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } @@ -97,10 +97,10 @@ namespace CalamityMod.Projectiles.Ranged } for (int d = 0; d < 70; d++) { - int fire = Dust.NewDust(p.position, p.width, p.height, 6, 0f, 0f, 100, default, 3f); + int fire = Dust.NewDust(p.position, p.width, p.height, DustID.Torch, 0f, 0f, 100, default, 3f); Main.dust[fire].noGravity = true; Main.dust[fire].velocity *= 5f; - fire = Dust.NewDust(p.position, p.width, p.height, 6, 0f, 0f, 100, default, 2f); + fire = Dust.NewDust(p.position, p.width, p.height, DustID.Torch, 0f, 0f, 100, default, 2f); Main.dust[fire].velocity *= 2f; } } diff --git a/Projectiles/Ranged/Nanomachine.cs b/Projectiles/Ranged/Nanomachine.cs deleted file mode 100644 index 75f9d5c6a7..0000000000 --- a/Projectiles/Ranged/Nanomachine.cs +++ /dev/null @@ -1,154 +0,0 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class Nanomachine : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Ranged"; - public override void SetStaticDefaults() - { - Main.projFrames[Projectile.type] = 3; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 3; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; - } - - public override void SetDefaults() - { - Projectile.width = 16; - Projectile.height = 16; - Projectile.aiStyle = ProjAIStyleID.Arrow; - Projectile.friendly = true; - Projectile.DamageType = DamageClass.Ranged; - Projectile.penetrate = 1; - Projectile.timeLeft = 120; - Projectile.extraUpdates = 1; - AIType = ProjectileID.Bullet; - } - - public override bool PreDraw(ref Color lightColor) - { - if (Projectile.localAI[1] == 0) - Projectile.localAI[1] = Main.rand.Next(1, 3); - Texture2D texture = ModContent.Request("CalamityMod/Projectiles/Ranged/Nanomachine").Value; - if (Projectile.localAI[1] == 2) - texture = ModContent.Request("CalamityMod/Projectiles/Ranged/Nanomachine2").Value; - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1, texture); - return false; - } - - public override void AI() - { - //Animation - Projectile.frameCounter++; - if (Projectile.frameCounter > 4) - { - Projectile.frame++; - Projectile.frameCounter = 0; - } - if (Projectile.frame > 2) - { - Projectile.frame = 0; - } - - //Rotation - Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); - Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi) + MathHelper.ToRadians(90) * Projectile.direction; - - - Vector2 dspeed = -Projectile.velocity * Main.rand.NextFloat(0.5f, 0.8f); - float x2 = Projectile.Center.X - Projectile.velocity.X / 10f; - float y2 = Projectile.Center.Y - Projectile.velocity.Y / 10f; - int nanoDust = Dust.NewDust(new Vector2(x2, y2), 1, 1, 229, 0f, 0f, 0, default, 0.8f); - Main.dust[nanoDust].alpha = Projectile.alpha; - Main.dust[nanoDust].position.X = x2; - Main.dust[nanoDust].position.Y = y2; - Main.dust[nanoDust].velocity = dspeed; - Main.dust[nanoDust].noGravity = true; - - float velocityAdjust = (float)Math.Sqrt((double)(Projectile.velocity.X * Projectile.velocity.X + Projectile.velocity.Y * Projectile.velocity.Y)); - float aiTracker = Projectile.localAI[0]; - if (aiTracker == 0f) - { - Projectile.localAI[0] = velocityAdjust; - aiTracker = velocityAdjust; - } - float projX = Projectile.position.X; - float projY = Projectile.position.Y; - float constant = 800f; - bool canHit = false; - int targetID = 0; - if (Projectile.ai[1] == 0f) - { - for (int i = 0; i < Main.maxNPCs; i++) - { - if (Main.npc[i].CanBeChasedBy(Projectile, false) && (Projectile.ai[1] == 0f || Projectile.ai[1] == (float)(i + 1))) - { - float targetX = Main.npc[i].position.X + (float)(Main.npc[i].width / 2); - float targetY = Main.npc[i].position.Y + (float)(Main.npc[i].height / 2); - float targetDist = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - targetX) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - targetY); - if (targetDist < constant && Collision.CanHit(new Vector2(Projectile.position.X + (float)(Projectile.width / 2), Projectile.position.Y + (float)(Projectile.height / 2)), 1, 1, Main.npc[i].position, Main.npc[i].width, Main.npc[i].height)) - { - constant = targetDist; - projX = targetX; - projY = targetY; - canHit = true; - targetID = i; - } - } - } - if (canHit) - { - Projectile.ai[1] = (float)(targetID + 1); - } - canHit = false; - } - if (Projectile.ai[1] > 0f) - { - int secondTargetID = (int)(Projectile.ai[1] - 1f); - if (Main.npc[secondTargetID].active && Main.npc[secondTargetID].CanBeChasedBy(Projectile, true) && !Main.npc[secondTargetID].dontTakeDamage) - { - float secondTargetX = Main.npc[secondTargetID].position.X + (float)(Main.npc[secondTargetID].width / 2); - float secondTargetY = Main.npc[secondTargetID].position.Y + (float)(Main.npc[secondTargetID].height / 2); - float secondTargetDist = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - secondTargetX) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - secondTargetY); - if (secondTargetDist < 1000f) - { - canHit = true; - projX = Main.npc[secondTargetID].position.X + (float)(Main.npc[secondTargetID].width / 2); - projY = Main.npc[secondTargetID].position.Y + (float)(Main.npc[secondTargetID].height / 2); - } - } - else - { - Projectile.ai[1] = 0f; - } - } - if (!Projectile.friendly) - { - canHit = false; - } - if (canHit) - { - Vector2 projPos = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); - float projXSpeed = projX - projPos.X; - float projYSpeed = projY - projPos.Y; - float projSpeedAdjust = (float)Math.Sqrt((double)(projXSpeed * projXSpeed + projYSpeed * projYSpeed)); - projSpeedAdjust = aiTracker / projSpeedAdjust; - projXSpeed *= projSpeedAdjust; - projYSpeed *= projSpeedAdjust; - int projVelAdjust = 12; - Projectile.velocity.X = (Projectile.velocity.X * (float)(projVelAdjust - 1) + projXSpeed) / (float)projVelAdjust; - Projectile.velocity.Y = (Projectile.velocity.Y * (float)(projVelAdjust - 1) + projYSpeed) / (float)projVelAdjust; - } - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(BuffID.Confused, 180); - } - } -} diff --git a/Projectiles/Ranged/Nanomachine.png b/Projectiles/Ranged/Nanomachine.png deleted file mode 100644 index 24d790cc9c..0000000000 Binary files a/Projectiles/Ranged/Nanomachine.png and /dev/null differ diff --git a/Projectiles/Ranged/Nanomachine2.png b/Projectiles/Ranged/Nanomachine2.png deleted file mode 100644 index 68c762e36c..0000000000 Binary files a/Projectiles/Ranged/Nanomachine2.png and /dev/null differ diff --git a/Projectiles/Ranged/NapalmArrowProj.cs b/Projectiles/Ranged/NapalmArrowProj.cs deleted file mode 100644 index 75e639e51f..0000000000 --- a/Projectiles/Ranged/NapalmArrowProj.cs +++ /dev/null @@ -1,121 +0,0 @@ -using CalamityMod.Projectiles.Rogue; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Audio; -namespace CalamityMod.Projectiles.Ranged -{ - public class NapalmArrowProj : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Ranged"; - public override string Texture => "CalamityMod/Items/Ammo/NapalmArrow"; - - public override void SetDefaults() - { - Projectile.width = 10; - Projectile.height = 10; - Projectile.friendly = true; - Projectile.DamageType = DamageClass.Ranged; - Projectile.arrow = true; - Projectile.penetrate = 1; - Projectile.timeLeft = 600; - Projectile.aiStyle = ProjAIStyleID.Arrow; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; - } - - public override void AI() - { - Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; - if (Main.rand.NextBool(5)) - { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 6, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); - } - } - - public override void OnKill(int timeLeft) - { - Projectile.ExpandHitboxBy(32); - SoundEngine.PlaySound(SoundID.Item14, Projectile.position); - for (int j = 0; j < 5; j++) - { - int fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 2f); - Main.dust[fire].velocity *= 3f; - if (Main.rand.NextBool()) - { - Main.dust[fire].scale = 0.5f; - Main.dust[fire].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int k = 0; k < 10; k++) - { - int fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 3f); - Main.dust[fire].noGravity = true; - Main.dust[fire].velocity *= 5f; - fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 2f); - Main.dust[fire].velocity *= 2f; - } - - if (Main.netMode != NetmodeID.Server) - { - Vector2 goreSource = Projectile.Center; - int goreAmt = 3; - Vector2 source = new Vector2(goreSource.X - 24f, goreSource.Y - 24f); - for (int goreIndex = 0; goreIndex < goreAmt; goreIndex++) - { - float velocityMult = 0.33f; - if (goreIndex < (goreAmt / 3)) - { - velocityMult = 0.66f; - } - if (goreIndex >= (2 * goreAmt / 3)) - { - velocityMult = 1f; - } - Mod mod = ModContent.GetInstance(); - int type = Main.rand.Next(61, 64); - int smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); - Gore gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X += 1f; - gore.velocity.Y += 1f; - type = Main.rand.Next(61, 64); - smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); - gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X -= 1f; - gore.velocity.Y += 1f; - type = Main.rand.Next(61, 64); - smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); - gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X += 1f; - gore.velocity.Y -= 1f; - type = Main.rand.Next(61, 64); - smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); - gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X -= 1f; - gore.velocity.Y -= 1f; - } - } - - if (Projectile.owner == Main.myPlayer) - { - for (int i = 0; i < 3; i++) - { - Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f, 0.1f); - int flames = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.3), 0f, Projectile.owner); - if (flames.WithinBounds(Main.maxProjectiles)) - { - Main.projectile[flames].DamageType = DamageClass.Ranged; - Main.projectile[flames].penetrate = 3; - Main.projectile[flames].usesLocalNPCImmunity = false; - Main.projectile[flames].usesIDStaticNPCImmunity = true; - Main.projectile[flames].idStaticNPCHitCooldown = 10; - } - } - } - } - } -} diff --git a/Projectiles/Ranged/NeedlerProj.cs b/Projectiles/Ranged/NeedlerProj.cs index d01ef19e08..1df82ad3bb 100644 --- a/Projectiles/Ranged/NeedlerProj.cs +++ b/Projectiles/Ranged/NeedlerProj.cs @@ -15,8 +15,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.alpha = 255; Projectile.friendly = true; Projectile.ignoreWater = true; - Projectile.penetrate = 3; - Projectile.alpha = 255; + Projectile.penetrate = -1; Projectile.DamageType = DamageClass.Ranged; Projectile.extraUpdates = 2; Projectile.aiStyle = ProjAIStyleID.Nail; @@ -33,20 +32,29 @@ namespace CalamityMod.Projectiles.Ranged Projectile.alpha = 0; } Projectile.localAI[1] += 1f; - if (Projectile.localAI[1] > 4f) + if (Projectile.localAI[1] > 6f && Projectile.numHits < 1) { - for (int i = 0; i < 2; i++) + Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(3) ? 207 : 256, -Projectile.velocity * Main.rand.NextFloat(0.2f, 0.8f)); + dust.scale = Main.rand.NextFloat(0.6f, 0.9f); + dust.noGravity = true; + } + if (Projectile.localAI[1] == 4f) + { + for (int i = 0; i <= 8; i++) { - int dusty = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 46, 0f, 0f, 100, default, 0.75f); - Main.dust[dusty].noGravity = true; - Main.dust[dusty].velocity *= 0f; + Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(3) ? 40 : 207, (Projectile.velocity * Main.rand.NextFloat(0.1f, 0.65f)).RotatedByRandom(0.4f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.9f, 1.6f); } } } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.Venom, 180); + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(BuffID.Venom, 90); + } - public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(BuffID.Venom, 180); + public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(BuffID.Venom, 90); public override void OnKill(int timeLeft) { @@ -54,23 +62,20 @@ namespace CalamityMod.Projectiles.Ranged Projectile.width = Projectile.height = 48; Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); - for (int j = 0; j < 3; j++) + for (int j = 0; j < 4; j++) { - int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 46, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.2f); - Main.dust[dust].velocity *= 3f; + Dust dust = Dust.NewDustPerfect(Projectile.Center, 46, new Vector2(3, 3).RotatedByRandom(100) * Main.rand.NextFloat(0.3f, 1.3f)); + dust.noGravity = false; + dust.scale = Main.rand.NextFloat(0.8f, 1.8f); if (Main.rand.NextBool()) - { - Main.dust[dust].scale = 0.5f; - Main.dust[dust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } + dust.fadeIn = 0.5f; } - for (int k = 0; k < 5; k++) + for (int k = 0; k < 9; k++) { - int dust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 39, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.7f); - Main.dust[dust2].noGravity = true; - Main.dust[dust2].velocity *= 5f; - dust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 44, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f); - Main.dust[dust2].velocity *= 2f; + Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(6) ? 44 : 39, new Vector2(3, 3).RotatedByRandom(100) * Main.rand.NextFloat(0.3f, 1.3f)); + dust.noGravity = false; + dust.scale = Main.rand.NextFloat(0.8f, 1.8f); + dust.fadeIn = 0.5f; } } } diff --git a/Projectiles/Ranged/NitroShot.cs b/Projectiles/Ranged/NitroShot.cs new file mode 100644 index 0000000000..1efd86ee4b --- /dev/null +++ b/Projectiles/Ranged/NitroShot.cs @@ -0,0 +1,86 @@ +using System; +using CalamityMod.Buffs.StatDebuffs; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using CalamityMod.Particles; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class NitroShot : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Ranged"; + public override string Texture => "CalamityMod/Projectiles/Ranged/AMRShot"; + public override void SetDefaults() + { + Projectile.width = 4; + Projectile.height = 4; + Projectile.light = 0.5f; + Projectile.alpha = 255; + Projectile.extraUpdates = 10; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.ignoreWater = true; + Projectile.penetrate = 5; + Projectile.timeLeft = 600; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; + } + + public override void AI() + { + float num107 = (float)Math.Sqrt(Projectile.velocity.X * Projectile.velocity.X + Projectile.velocity.Y * Projectile.velocity.Y); + if (Projectile.alpha > 0) + Projectile.alpha -= (byte)(num107 * 0.9); + if (Projectile.alpha < 0) + Projectile.alpha = 0; + + if (Projectile.timeLeft == 597) + { + for (int i = 0; i <= 15; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.position, 87, (Projectile.velocity).RotatedByRandom(MathHelper.ToRadians(30f)) * Main.rand.NextFloat(0.1f, 0.8f), 0, default, Main.rand.NextFloat(0.6f, 1.1f)); + dust.noGravity = true; + } + } + Projectile.scale = 1.38f; + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver2; + + if (Projectile.timeLeft < 597 && Projectile.timeLeft > 450) + { + AltSparkParticle spark = new AltSparkParticle(Projectile.Center, -Projectile.velocity * 0.05f, false, 15, 1f, Color.Gold * 0.1f); + GeneralParticleHandler.SpawnParticle(spark); + } + } + + public override Color? GetAlpha(Color lightColor) + { + if (Projectile.alpha < 140) + return new Color(255, 255, 255, 100); + + return Color.Transparent; + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + Collision.HitTiles(Projectile.Center, Projectile.velocity, Projectile.width, Projectile.height); + SoundEngine.PlaySound(SoundID.Dig, Projectile.Center); + return true; + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + + for (int i = 0; i <= 10; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.position, 87, (Projectile.velocity).RotatedByRandom(MathHelper.ToRadians(15f)) * Main.rand.NextFloat(0.1f, 0.8f), 0, default, Main.rand.NextFloat(0.6f, 1.1f)); + dust.noGravity = true; + } + + if (Projectile.numHits > 0) + Projectile.damage = (int)(Projectile.damage * 0.88f); + if (Projectile.damage < 1) + Projectile.damage = 1; + } + } +} diff --git a/Projectiles/Ranged/NorfleetCannon.cs b/Projectiles/Ranged/NorfleetCannon.cs index 8ff16789e3..8035830c5c 100644 --- a/Projectiles/Ranged/NorfleetCannon.cs +++ b/Projectiles/Ranged/NorfleetCannon.cs @@ -1,8 +1,15 @@ -using CalamityMod.Items.Weapons.Ranged; +using System; +using System.Runtime.Intrinsics.X86; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Particles; +using Humanizer; using Microsoft.Xna.Framework; -using System; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Utilities; using Terraria; using Terraria.Audio; +using Terraria.DataStructures; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -14,116 +21,362 @@ namespace CalamityMod.Projectiles.Ranged public override LocalizedText DisplayName => CalamityUtils.GetItemName(); public override string Texture => "CalamityMod/Items/Weapons/Ranged/Norfleet"; + public Color StaticEffectsColor = Color.Gray; + private ref float ShootingTimer => ref Projectile.ai[0]; + private float PostFireCooldown = 0; + private bool HasLetGo = false; + private SlotId NorfleetRecharge; + + private ref float OffsetLength => ref Projectile.localAI[0]; + private ref float loadedShots => ref Projectile.ai[2]; + + private Player Owner; + + private float MaxOffsetLength = 5f; + private const float MaxCharge = 237f; + public bool recharging = false; + public Color variedColor = Color.White; + public Color mainColor = Color.White; + public Color randomColor = Color.White; + public int colorTimer = 0; + public bool hasFired = false; + public bool PUNISHMENTMODE = false; + public override void SetDefaults() { - Projectile.width = 140; - Projectile.height = 42; - Projectile.friendly = true; - Projectile.penetrate = -1; + Projectile.width = Projectile.height = 142; Projectile.tileCollide = false; - Projectile.DamageType = DamageClass.Ranged; Projectile.ignoreWater = true; + Projectile.netImportant = true; } public override void AI() { - Player player = Main.player[Projectile.owner]; - Projectile.ai[1]--; - if (Projectile.ai[0] >= 0f) + Item heldItem = Owner.ActiveItem(); + + if (Owner.dead || Owner is null) + Projectile.Kill(); + + randomColor = Main.rand.Next(3) switch { - Projectile.ai[0] += 1f; - switch ((int)Projectile.ai[0]) + 0 => Color.OrangeRed, + 1 => Color.Aqua, + _ => Color.GreenYellow, + }; + if (mainColor == Color.White) + { + mainColor = randomColor; + if (Projectile.ai[1] == 1000) + PUNISHMENTMODE = true; + } + + if (ShootingTimer % 15 == 0) + { + variedColor = colorTimer switch { - case 90: - case 180: - case 270: - case 360: - case 450: - Projectile.localAI[0] += 1f; - break; - case 540: - Projectile.localAI[0] += 1f; - Projectile.ai[0] = -1f; - SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); - int dustAmt = 36; - for (int d = 0; d < dustAmt; d++) - { - Vector2 source = Vector2.Normalize(Projectile.velocity) * 9f; - source = source.RotatedBy((d - (dustAmt / 2 - 1)) * MathHelper.TwoPi / dustAmt, default) + player.Center; - Vector2 dustVel = source - player.Center; - int index = Dust.NewDust(source + dustVel, 0, 0, Main.rand.NextBool() ? 221 : 244, 0f, 0f, 0, default, 4f); - Main.dust[index].noGravity = true; - Main.dust[index].velocity = dustVel; - } - break; + 0 => Color.OrangeRed, + 1 => Color.Aqua, + _ => Color.GreenYellow, + }; + colorTimer++; + if (colorTimer >= 3) + colorTimer = 0; + } + + mainColor = Color.Lerp(mainColor, variedColor, (PostFireCooldown <= 20 || recharging) ? 0.07f : 0); + + // If there's no player, or the player is the server, or the owner's stunned, there'll be no holdout. + if (Owner.CantUseHoldout() && !HasLetGo) + { + if (SoundEngine.TryGetActiveSound(NorfleetRecharge, out var hum) && hum.IsPlaying) + { + hum?.Stop(); } - } - int baseUseTime = 75; //Ranges from 75 to 63 use time - int modifier = 2; - bool timeToFire = false; - if (Projectile.ai[1] <= 0f) - { - Projectile.ai[1] = baseUseTime - modifier * Projectile.localAI[0]; - timeToFire = true; - } - bool canFire = player.channel && player.HasAmmo(player.ActiveItem()) && !player.noItems && !player.CCed; - if (Projectile.soundDelay <= 0 && canFire) - { - Projectile.soundDelay = baseUseTime - modifier * (int)Projectile.localAI[0]; - if (Projectile.ai[0] != 1f) - SoundEngine.PlaySound(SoundID.Item92, Projectile.Center); - } - if (timeToFire && Main.myPlayer == Projectile.owner) - { - if (canFire) + if (loadedShots > 1) { - int type = ProjectileID.FallingStar; //Gets changed below anyways - float shootSpeed = 30f; - int damage = player.GetWeaponDamage(player.ActiveItem()); - float knockBack = player.ActiveItem().knockBack; - for (int i = 0; i < 5; i++) - { - player.PickAmmo(player.ActiveItem(), out type, out shootSpeed, out damage, out knockBack, out _); - knockBack = player.GetWeaponKnockback(player.ActiveItem(), knockBack); - Vector2 playerPosition = player.RotatedRelativePoint(player.MountedCenter, true); - Projectile.velocity = Main.screenPosition - playerPosition; - Projectile.velocity.X += Main.mouseX; - Projectile.velocity.Y += Main.mouseY; - if (player.gravDir == -1f) - Projectile.velocity.Y = Main.screenHeight - Main.mouseY + Main.screenPosition.Y - playerPosition.Y; - Projectile.velocity.Normalize(); - float variation = (1f + Projectile.localAI[0]) * 3f; - Vector2 position = playerPosition + Utils.RandomVector2(Main.rand, -variation, variation); - Vector2 speed = Projectile.velocity * shootSpeed * Main.rand.NextFloat(0.6f, 1.2f); - type = ModContent.ProjectileType(); - speed.X += Main.rand.NextFloat(-1.5f, 1.5f); - speed.Y += Main.rand.NextFloat(-1.5f, 1.5f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), position, speed, type, damage, knockBack, Projectile.owner); - speed.X += Main.rand.NextFloat(-1.5f, 1.5f); - speed.Y += Main.rand.NextFloat(-1.5f, 1.5f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), position, speed, type, damage, knockBack, Projectile.owner); - Projectile.netUpdate = true; - } + ShootRocket(heldItem); + PostFireCooldown = PUNISHMENTMODE ? 1000 : 55; + ShootingTimer = 1; + mainColor = PUNISHMENTMODE ? Color.Red : Color.MediumOrchid; } else { - Projectile.Kill(); + ShootRocket(heldItem); + PostFireCooldown = PUNISHMENTMODE ? 1000 : 262; + ShootingTimer = 1; + mainColor = PUNISHMENTMODE ? Color.Red : Color.MediumOrchid; } + + + NetUpdate(); + HasLetGo = true; } - Projectile.rotation = Projectile.velocity.ToRotation(); - Vector2 displayOffset = new Vector2(0f, -10f * Projectile.direction).RotatedBy(Projectile.rotation); - Projectile.Center = player.RotatedRelativePoint(player.MountedCenter, true) + displayOffset; - if (Projectile.spriteDirection == -1) - Projectile.rotation += MathHelper.Pi; - 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(Projectile.velocity.Y * Projectile.direction, Projectile.velocity.X * Projectile.direction); + if (HasLetGo) + { + PostFiringCooldown(); + } + + // The center of the player, taking into account if they have a mount or not. + Vector2 ownerPosition = Owner.MountedCenter; + + // The vector between the player and the mouse. + Vector2 ownerToMouse = Owner.Calamity().mouseWorld - ownerPosition; + + // Deals with the holdout's rotation and direction, the owner's arms, etc. + ManageHoldout(ownerPosition, ownerToMouse); + + // When we change the distance of the gun from the arms for the recoil, + // recover to the original position smoothly. + if (OffsetLength != MaxOffsetLength) + OffsetLength = MathHelper.Lerp(OffsetLength, MaxOffsetLength, 0.1f); + + ShootingTimer++; + + // Inside here go all the things that dedicated servers shouldn't spend resources on. + // Like visuals and sounds. + if (Main.dedServ) + return; + + Vector2 shootDirection = Projectile.velocity.SafeNormalize(Vector2.Zero) * 20; } + private void ManageHoldout(Vector2 mountedCenter, Vector2 ownerToMouse) + { + Vector2 rotationVector = Projectile.rotation.ToRotationVector2(); + float velocityRotation = Projectile.velocity.ToRotation(); + float proximityLookingUpwards = Vector2.Dot(ownerToMouse.SafeNormalize(Vector2.Zero), -Vector2.UnitY); + int direction = MathF.Sign(ownerToMouse.X); + + Vector2 armPosition = Owner.RotatedRelativePoint(mountedCenter, true); + Vector2 lengthOffset = rotationVector * OffsetLength; + Vector2 armOffset = new Vector2(Utils.Remap(proximityLookingUpwards, -1f, 1f, 0f, -12f) * direction, -10f + Utils.Remap(MathF.Abs(proximityLookingUpwards), 0f, 1f, 0f, proximityLookingUpwards > 0f ? 15f : 0f)); + Projectile.Center = armPosition + lengthOffset + armOffset; + Projectile.velocity = velocityRotation.AngleTowards(ownerToMouse.ToRotation(), 0.2f).ToRotationVector2(); + Projectile.rotation = velocityRotation; + Projectile.timeLeft = 2; + + Owner.heldProj = Projectile.whoAmI; + Owner.itemTime = Owner.itemAnimation = 2; + Owner.itemRotation = (Projectile.velocity * Projectile.direction).ToRotation(); + + Projectile.spriteDirection = Projectile.direction = direction; + Owner.ChangeDir(direction); + + float armRotation = Projectile.rotation - MathHelper.PiOver2; // -Pi/2 because the arms rotation starts with arms pointing down. + Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Quarter, armRotation); + Owner.SetCompositeArmBack(true, Player.CompositeArmStretchAmount.Full, armRotation + MathHelper.ToRadians(15f) * direction); + + // Rumble (only while channeling) + float rumble = 1f; + if (!Owner.CantUseHoldout()) + Projectile.Center += Main.rand.NextVector2Circular(rumble, rumble); + if (PostFireCooldown < 297 && PostFireCooldown > 15 && recharging) + { + rumble = 5f * Utils.GetLerpValue(297, 0, PostFireCooldown, true); + Projectile.Center += Main.rand.NextVector2Circular(rumble, rumble); + } + } + + private void ShootRocket(Item item) + { + if (hasFired == false) + { + // We use the velocity of this projectile as its direction vector. + Vector2 shootDirection = Projectile.velocity.SafeNormalize(Vector2.Zero); + + // The position of the tip of the gun. + Vector2 tipPosition = Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.Zero).RotatedBy(-0.05f * Projectile.direction) * 73f; + + // Spawns the projectile. + SoundStyle fire = new("CalamityMod/Sounds/Item/NorfleetFire"); + SoundEngine.PlaySound(fire with { Volume = 0.9f, PitchVariance = 0.25f }, Projectile.Center); + + for (int i = 0; i < 3; i++) + { + Vector2 firingVelocity = shootDirection.RotatedByRandom((0.2f * i) + 0.02f) * 5f * Main.rand.NextFloat(0.7f, 1.3f); + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), tipPosition, firingVelocity, ModContent.ProjectileType(), Projectile.damage / 3, Projectile.knockBack, Projectile.owner, 0, i, PUNISHMENTMODE ? 1 : 0); + } + + NetUpdate(); + + // Inside here go all the things that dedicated servers shouldn't spend resources on. + // Like visuals and sounds. + if (Main.dedServ) + return; + + for (int k = 0; k < 30; k++) + { + Vector2 shootVel = (shootDirection * 10).RotatedByRandom(0.5f) * Main.rand.NextFloat(0.1f, 1.8f); + + Dust dust2 = Dust.NewDustPerfect(tipPosition, Main.rand.NextBool(4) ? 264 : 66, shootVel); + dust2.scale = Main.rand.NextFloat(1.15f, 1.45f); + dust2.noGravity = true; + if (dust2.type == 66) + dust2.color = Main.rand.NextBool() ? Color.DarkViolet : Color.MediumOrchid; + else + dust2.color = Color.White; + } + for (int k = 0; k < 15; k++) + { + Particle pulse = new GlowSparkParticle((tipPosition - shootDirection * 14) + Main.rand.NextVector2Circular(12, 12), shootDirection * 17 * Main.rand.NextFloat(0.35f, 1.35f), false, Main.rand.Next(7, 11 + 1), 0.025f * Main.rand.NextFloat(0.45f, 1.25f), Color.MediumOrchid, new Vector2(1.5f, 0.9f), true); + GeneralParticleHandler.SpawnParticle(pulse); + } + + // By decreasing the offset length of the gun from the arms, we give an effect of recoil. + OffsetLength -= 34f; + hasFired = true; + } + else + { + if (Owner.Calamity().NorfleetCounter >= 1000) + Owner.Calamity().NorfleetCounter = 3; + else + Owner.Calamity().NorfleetCounter = 1000; + + Projectile.Kill(); + } + } + private void PostFiringCooldown() + { + Vector2 tipPosition = Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.Zero).RotatedBy(-0.05f * Projectile.direction) * 73f; + + if (PUNISHMENTMODE) + { + PostFireCooldown = 1000; + Owner.AddBuff(ModContent.BuffType(), 900); + Owner.AddBuff(ModContent.BuffType(), 900); + if (Owner.statLife > 1) + Owner.statLife = (int)(Owner.statLife * 0.99f); + } + + if (PostFireCooldown == 207) + { + OffsetLength -= 24f; + SoundStyle charge = new("CalamityMod/Sounds/Item/NorfleetRecharge"); + NorfleetRecharge = SoundEngine.PlaySound(charge with { Volume = 1f }, Projectile.Center); + recharging = true; + } + if (PostFireCooldown > 0 && !recharging) + { + Vector2 smokeVel = new Vector2(0, -8) * Main.rand.NextFloat(0.1f, 1.1f); + Particle smoke = new HeavySmokeParticle(tipPosition, smokeVel, PUNISHMENTMODE ? Color.Red : StaticEffectsColor, Main.rand.Next(40, 60 + 1), Main.rand.NextFloat(0.3f, 0.6f), 0.5f, Main.rand.NextFloat(-0.2f, 0.2f), Main.rand.NextBool(), required: true); + GeneralParticleHandler.SpawnParticle(smoke); + + Dust dust = Dust.NewDustPerfect(tipPosition, 303, smokeVel.RotatedByRandom(0.1f), 80, default, Main.rand.NextFloat(0.4f, 1.3f)); + dust.noGravity = false; + dust.color = PUNISHMENTMODE ? Color.Red : Color.White; + } + else if (!recharging) + { + if (SoundEngine.TryGetActiveSound(NorfleetRecharge, out var hum) && hum.IsPlaying) + { + hum?.Stop(); + } + Projectile.Kill(); + NetUpdate(); + } + else + { + if (PostFireCooldown == 297) + { + OffsetLength -= 18f; + } + if (PostFireCooldown == 15) + { + OffsetLength -= 11f; + + int points = 3; + float radians = MathHelper.TwoPi / points; + float randRot = Main.rand.NextFloat(-5, 5); + Vector2 spinningPoint = Vector2.Normalize(new Vector2(-1f, -1f).RotatedBy(randRot)); + for (int k = 0; k < points; k++) + { + Color glowColor = k == 0 ? Color.OrangeRed : k == 1 ? Color.Aqua : Color.GreenYellow; + Vector2 velocity = spinningPoint.RotatedBy(radians * k).RotatedBy(-0.45f); + Particle pulse = new GlowSparkParticle(tipPosition, velocity, false, 10, 0.065f, glowColor, new Vector2(1.3f, 0.2f), true); + GeneralParticleHandler.SpawnParticle(pulse); + } + + SoundStyle click = new("CalamityMod/Sounds/Item/DudFire"); + SoundEngine.PlaySound(click with { Volume = 1f, Pitch = 0.7f }, Projectile.Center); + Owner.Calamity().NorfleetCounter = 0; + } + if (PostFireCooldown > 15) + { + Vector2 dustVel = Projectile.velocity.RotatedByRandom(100) * Main.rand.NextFloat(5.1f, 25.8f); + Dust dust = Dust.NewDustPerfect(tipPosition + dustVel * 5, 267, -dustVel * 0.5f, 0, default, Main.rand.NextFloat(0.5f, 1f)); + dust.noGravity = true; + dust.color = mainColor; + } + + if (PostFireCooldown <= 0) + recharging = false; + } + PostFireCooldown--; + + if (SoundEngine.TryGetActiveSound(NorfleetRecharge, out var hum2) && hum2.IsPlaying) + { + hum2.Position = Projectile.Center; + } + } + + private void NetUpdate() + { + Projectile.netUpdate = true; + if (Projectile.netSpam >= 10) + Projectile.netSpam = 9; + } + + public override void OnSpawn(IEntitySource source) + { + Owner = Main.player[Projectile.owner]; + OffsetLength = MaxOffsetLength; + } + + // Because we use the velocity as a direction, we don't need it to change its position. + public override bool ShouldUpdatePosition() => false; + public override bool? CanDamage() => false; + + public override bool PreDraw(ref Color lightColor) + { + if (ShootingTimer <= 0) + return false; + + Vector2 tipPosition = Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.Zero).RotatedBy(-0.05f * Projectile.direction) * 73f; + + Texture2D glowTexture = ModContent.Request("CalamityMod/Projectiles/Ranged/NorfleetGhostGlowmask").Value; + Texture2D texture = ModContent.Request("CalamityMod/Items/Weapons/Ranged/Norfleet").Value; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + Color drawColor = Projectile.GetAlpha(lightColor); + float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f); + Vector2 rotationPoint = texture.Size() * 0.5f; + SpriteEffects flipSprite = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + + if (recharging) + { + for (int i = 0; i < 3; i++) + { + Color auraColor = mainColor * 0.25f; + Texture2D centerTexture = ModContent.Request("CalamityMod/Projectiles/Ranged/NorfleetGhost").Value; + Vector2 rotationalDrawOffset = (MathHelper.TwoPi * i / 7f + Main.GlobalTimeWrappedHourly * 50f).ToRotationVector2(); + rotationalDrawOffset *= MathHelper.Lerp(3f, 5.25f, (float)Math.Cos(Main.GlobalTimeWrappedHourly * 4f) * 0.5f + 0.5f); + Main.EntitySpriteDraw(centerTexture, Projectile.Center - Main.screenPosition + rotationalDrawOffset, null, auraColor, drawRotation, centerTexture.Size() * 0.5f, Projectile.scale * MathHelper.Clamp(1.35f * Utils.GetLerpValue(-200, 297, PostFireCooldown, true), 1, 1.35f), flipSprite, 0f); + } + } + + Texture2D rechargeTexture = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; + + Main.EntitySpriteDraw(texture, drawPosition, null, drawColor, drawRotation, rotationPoint, Projectile.scale, flipSprite); + Main.EntitySpriteDraw(glowTexture, drawPosition, null, PUNISHMENTMODE ? Color.Red : mainColor, drawRotation, rotationPoint, Projectile.scale, flipSprite); + if (PostFireCooldown > 15 && recharging) + { + float randSize = Main.rand.NextFloat(0.8f, 1.2f); + Main.EntitySpriteDraw(rechargeTexture, tipPosition - Main.screenPosition, null, mainColor with { A = 0 }, Projectile.rotation, rechargeTexture.Size() * 0.5f, 0.55f * Utils.GetLerpValue(-100, 297, PostFireCooldown, true) * randSize, SpriteEffects.None, 0); + Main.EntitySpriteDraw(rechargeTexture, tipPosition - Main.screenPosition, null, Color.White with { A = 0 }, Projectile.rotation, rechargeTexture.Size() * 0.5f, 0.35f * Utils.GetLerpValue(-100, 297, PostFireCooldown, true) * randSize, SpriteEffects.None, 0); + } + return false; + } + } } diff --git a/Projectiles/Ranged/NorfleetComet.cs b/Projectiles/Ranged/NorfleetComet.cs index 6319e44572..e10696a580 100644 --- a/Projectiles/Ranged/NorfleetComet.cs +++ b/Projectiles/Ranged/NorfleetComet.cs @@ -1,129 +1,193 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; +using CalamityMod.Particles; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; +using Microsoft.Xna.Framework.Graphics; +using SteelSeries.GameSense; namespace CalamityMod.Projectiles.Ranged { public class NorfleetComet : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Ranged"; - public override string Texture => "CalamityMod/Projectiles/Melee/GalacticaComet"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; private int noTileHitCounter = 120; + public int time = 0; public override void SetStaticDefaults() { ProjectileID.Sets.TrailCacheLength[Projectile.type] = 15; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; } public override void SetDefaults() { Projectile.width = 34; Projectile.height = 34; - Projectile.alpha = 255; Projectile.friendly = true; Projectile.DamageType = DamageClass.Ranged; Projectile.tileCollide = false; Projectile.penetrate = 1; - Projectile.timeLeft = 600; + Projectile.extraUpdates = 5; + Projectile.timeLeft = 1200; Projectile.ignoreWater = true; } public override void AI() { - int randomToSubtract = Main.rand.Next(1, 4); - noTileHitCounter -= randomToSubtract; - if (noTileHitCounter == 0) + Player player = Main.player[Projectile.owner]; + float rotationRando = Main.rand.NextFloat(-0.02f, 0.02f); + Projectile.velocity = Projectile.velocity.RotatedBy(rotationRando); + Projectile.rotation += 0.05f; + if (Projectile.ai[2] == 1) { - Projectile.tileCollide = true; - } - if (Projectile.soundDelay == 0) - { - Projectile.soundDelay = 20 + Main.rand.Next(40); - if (Main.rand.NextBool(5)) + Projectile.friendly = false; + if (time >= 75) { - SoundEngine.PlaySound(SoundID.Item9, Projectile.position); - } - } - Projectile.localAI[0] += 1f; - if (Projectile.localAI[0] == 18f) - { - Projectile.localAI[0] = 0f; - for (int l = 0; l < 12; l++) - { - Vector2 dustOffset = Vector2.UnitX * (float)-(float)Projectile.width / 2f; - dustOffset += -Vector2.UnitY.RotatedBy((double)((float)l * MathHelper.Pi / 6f), default) * new Vector2(8f, 16f); - dustOffset = dustOffset.RotatedBy((double)(Projectile.rotation - MathHelper.PiOver2), default); - int idx = Dust.NewDust(Projectile.Center, 0, 0, Main.rand.NextBool() ? 221 : 244, 0f, 0f, 160, default, 1f); - Main.dust[idx].scale = 1.1f; - Main.dust[idx].noGravity = true; - Main.dust[idx].position = Projectile.Center + dustOffset; - Main.dust[idx].velocity = Projectile.velocity * 0.1f; - Main.dust[idx].velocity = Vector2.Normalize(Projectile.Center - Projectile.velocity * 3f - Main.dust[idx].position) * 1.25f; - } - } - Projectile.alpha -= 15; - int alphaLimit = 150; - if (Projectile.alpha < alphaLimit) - { - Projectile.alpha = alphaLimit; - } - Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; - if (Main.rand.NextBool(16)) - { - Vector2 dustOffset = Vector2.UnitX.RotatedByRandom(Math.PI * 0.5).RotatedBy((double)Projectile.velocity.ToRotation(), default); - int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, Main.rand.NextBool() ? 221 : 244, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1.2f); - Main.dust[idx].velocity = dustOffset * 0.66f; - Main.dust[idx].position = Projectile.Center + dustOffset * 12f; - } - if (Projectile.ai[1] == 1f) - { - Projectile.light = 0.5f; - if (Main.rand.NextBool(10)) - { - Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, Main.rand.NextBool() ? 221 : 244, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1.2f); - } - } - } + Projectile.hostile = true; - public override Color? GetAlpha(Color lightColor) + float distanceFromPlayer = Projectile.Distance(player.Center); + + // This is done instead of a Normalize or DirectionTo call because the variables needed are already present and calculating the square root again would be unnecessary. + Vector2 idealVelocity = (player.Center - Projectile.Center) / distanceFromPlayer * 8f; + + Projectile.velocity.X += Math.Sign(idealVelocity.X - Projectile.velocity.X) * (0.0005f * time); + Projectile.velocity.Y += Math.Sign(idealVelocity.Y - Projectile.velocity.Y) * (0.0005f * time); + + if (Projectile.Hitbox.Intersects(player.Hitbox)) + Projectile.Kill(); + + Projectile.timeLeft = 5; + } + } + if (time > 25) + { + for (int i = 0; i < 2; i++) + { + Vector2 dustPos = Projectile.Center + (i * MathHelper.Pi + Projectile.rotation + MathHelper.PiOver2).ToRotationVector2() * 30f; + Dust dust = Dust.NewDustPerfect(dustPos, (Projectile.ai[2] == 1 ? 219 : Main.rand.NextBool(3) ? 272 : 86), (i * MathHelper.Pi + Projectile.rotation * Math.Sign(Projectile.velocity.X)).ToRotationVector2() * 3f); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.6f, 0.9f); + } + } + + // Projectile ai 1 decides the type, 0 is fire, 1 is electricity, and 2 is poison + + time++; + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { - return new Color(Main.DiscoR, 100, 255, Projectile.alpha); + Player Owner = Main.player[Projectile.owner]; + Owner.Calamity().GeneralScreenShakePower = 7.5f; + SoundStyle fire = new("CalamityMod/Sounds/Item/ScorpioNukeHit"); + SoundEngine.PlaySound(fire with { Volume = 0.75f, Pitch = 0.6f, PitchVariance = 0.2f }, Projectile.Center); } public override void OnKill(int timeLeft) { - if (Projectile.owner == Main.myPlayer) + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack, Projectile.owner, 0, Projectile.ai[1], Projectile.ai[2] == 1 ? 1 : 0); + + if (Projectile.ai[1] == 0) { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.3), Projectile.knockBack * 0.1f, Projectile.owner); + Color partColor = Color.OrangeRed; + int partLifetime = 10; + float scale = 0.1f; + Vector2 spawnPos = Projectile.Center; + Particle blastRing = new CustomPulse(spawnPos, Vector2.Zero, partColor, "CalamityMod/Particles/FlameExplosion", Vector2.One, Main.rand.NextFloat(-10, 10), 0.07f, scale, partLifetime); + GeneralParticleHandler.SpawnParticle(blastRing); + Particle blastRing2 = new CustomPulse(spawnPos, Vector2.Zero, partColor * 0.4f, "CalamityMod/Particles/HighResHollowCircleHardEdge", Vector2.One, Main.rand.NextFloat(-10, 10), 0.07f, scale * 4, partLifetime); + GeneralParticleHandler.SpawnParticle(blastRing2); + for (int k = 0; k < 15; k++) + { + Vector2 velocity = new Vector2(15, 15).RotatedByRandom(100) * Main.rand.NextFloat(0.3f, 1.2f); + Particle spark = new SparkParticle(Projectile.Center + velocity, velocity, false, 45, Main.rand.NextFloat(0.95f, 1.35f), partColor); + GeneralParticleHandler.SpawnParticle(spark); + } + for (int k = 0; k < 30; k++) + { + Vector2 velocity = new Vector2(10, 10).RotatedByRandom(100) * Main.rand.NextFloat(0.3f, 1.2f); + Dust dust2 = Dust.NewDustPerfect(Projectile.Center + velocity, 259, velocity); + dust2.scale = Main.rand.NextFloat(1.15f, 1.45f); + dust2.noGravity = true; + } } - SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); - Projectile.ExpandHitboxBy(144); - for (int d = 0; d < 4; d++) + if (Projectile.ai[1] == 1) { - Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, Main.rand.NextBool() ? 221 : 244, 0f, 0f, 50, default, 1.5f); + Color partColor = Color.Cyan; + int partLifetime = 10; + float scale = 0.1f; + Vector2 spawnPos = Projectile.Center; + Particle blastRing = new CustomPulse(spawnPos, Vector2.Zero, partColor, "CalamityMod/Particles/PlasmaExplosion", Vector2.One, Main.rand.NextFloat(-10, 10), 0.07f, scale, partLifetime); + GeneralParticleHandler.SpawnParticle(blastRing); + Particle blastRing2 = new CustomPulse(spawnPos, Vector2.Zero, partColor * 0.4f, "CalamityMod/Particles/HighResHollowCircleHardEdge", Vector2.One, Main.rand.NextFloat(-10, 10), 0.07f, scale * 4, partLifetime); + GeneralParticleHandler.SpawnParticle(blastRing2); + for (int k = 0; k < 15; k++) + { + Vector2 velocity = new Vector2(15, 15).RotatedByRandom(100) * Main.rand.NextFloat(0.3f, 1.2f); + Particle spark = new CritSpark(Projectile.Center + velocity, velocity, Color.White, partColor, Main.rand.NextFloat(0.45f, 0.65f), 45, Main.rand.NextFloat(-2, 2), 2); + GeneralParticleHandler.SpawnParticle(spark); + } + for (int k = 0; k < 30; k++) + { + Vector2 velocity = new Vector2(10, 10).RotatedByRandom(100) * Main.rand.NextFloat(0.3f, 1.2f); + Dust dust2 = Dust.NewDustPerfect(Projectile.Center + velocity, 226, velocity); + dust2.scale = Main.rand.NextFloat(1.15f, 1.45f); + dust2.noGravity = false; + } } - for (int d = 0; d < 20; d++) + if (Projectile.ai[1] == 2) { - int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, Main.rand.NextBool() ? 221 : 244, 0f, 0f, 0, default, 2.5f); - Main.dust[idx].noGravity = true; - Main.dust[idx].velocity *= 3f; - idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, Main.rand.NextBool() ? 221 : 244, 0f, 0f, 50, default, 1.5f); - Main.dust[idx].velocity *= 2f; - Main.dust[idx].noGravity = true; + Color partColor = Color.GreenYellow; + int partLifetime = 10; + float scale = 0.1f; + Vector2 spawnPos = Projectile.Center; + Particle blastRing = new CustomPulse(spawnPos, Vector2.Zero, partColor, "CalamityMod/Particles/DustyCircleHardEdge", Vector2.One, Main.rand.NextFloat(-10, 10), 0.07f, scale, partLifetime); + GeneralParticleHandler.SpawnParticle(blastRing); + Particle blastRing2 = new CustomPulse(spawnPos, Vector2.Zero, partColor * 0.4f, "CalamityMod/Particles/HighResHollowCircleHardEdge", Vector2.One, Main.rand.NextFloat(-10, 10), 0.07f, scale * 4, partLifetime); + GeneralParticleHandler.SpawnParticle(blastRing2); + for (int k = 0; k < 15; k++) + { + Vector2 velocity = new Vector2(15, 15).RotatedByRandom(100) * Main.rand.NextFloat(0.3f, 1.2f); + Particle smoke = new HeavySmokeParticle(Projectile.Center + velocity, velocity, partColor, 45, Main.rand.NextFloat(0.9f, 2.3f), 0.7f); + GeneralParticleHandler.SpawnParticle(smoke); + } + for (int k = 0; k < 30; k++) + { + Vector2 velocity = new Vector2(10, 10).RotatedByRandom(100) * Main.rand.NextFloat(0.3f, 1.2f); + Dust dust2 = Dust.NewDustPerfect(Projectile.Center + velocity, Main.rand.NextBool() ? 39 : 298, velocity); + dust2.scale = Main.rand.NextFloat(1.15f, 1.45f); + dust2.noGravity = true; + } } } public override bool PreDraw(ref Color lightColor) { - if (Projectile.timeLeft >= 600) - return false; - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + Texture2D vortexTexture = ModContent.Request("CalamityMod/ExtraTextures/SoulVortex").Value; + for (int i = 0; i < 4; i++) + { + float angle = MathHelper.TwoPi * i / 3f + Main.GlobalTimeWrappedHourly * MathHelper.TwoPi; + Color outerColor = Color.Lerp(Color.Purple, Color.MediumOrchid, i * 0.2f); + Color drawColor = outerColor; + drawColor.A = 0; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + + Main.EntitySpriteDraw(vortexTexture, drawPosition, null, drawColor * Projectile.Opacity, -angle + MathHelper.PiOver2, vortexTexture.Size() * 0.5f, ((Projectile.scale * (1 - i * 0.07f)) * 0.18f) * Utils.GetLerpValue(0, 25, time, true), SpriteEffects.None, 0); + } + + Texture2D rechargeTexture = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; + float randSize = Main.rand.NextFloat(0.8f, 1.2f); + Color drawColor2 = Projectile.ai[1] == 0 ? Color.OrangeRed : Projectile.ai[1] == 1 ? Color.Cyan : Color.GreenYellow; + Main.EntitySpriteDraw(rechargeTexture, Projectile.Center - Main.screenPosition, null, drawColor2 with { A = 0 }, Projectile.rotation, rechargeTexture.Size() * 0.5f, 0.25f * Utils.GetLerpValue(0, 25, time, true) * randSize, SpriteEffects.None, 0); + Main.EntitySpriteDraw(rechargeTexture, Projectile.Center - Main.screenPosition, null, Color.White with { A = 0 }, Projectile.rotation, rechargeTexture.Size() * 0.5f, 0.1f * Utils.GetLerpValue(0, 25, time, true) * randSize, SpriteEffects.None, 0); + + //CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 75, targetHitbox); } } diff --git a/Projectiles/Ranged/NorfleetExplosion.cs b/Projectiles/Ranged/NorfleetExplosion.cs index 04d4ab5def..66a58bd95a 100644 --- a/Projectiles/Ranged/NorfleetExplosion.cs +++ b/Projectiles/Ranged/NorfleetExplosion.cs @@ -1,5 +1,9 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { @@ -16,24 +20,39 @@ namespace CalamityMod.Projectiles.Ranged Projectile.ignoreWater = false; Projectile.tileCollide = false; Projectile.penetrate = -1; - Projectile.timeLeft = 30; + Projectile.timeLeft = 2; Projectile.DamageType = DamageClass.Ranged; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; + Projectile.localNPCHitCooldown = -1; + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + if (Projectile.ai[1] == 0) + target.AddBuff(BuffID.Daybreak, 300); + if (Projectile.ai[1] == 1) + target.AddBuff(BuffID.Electrified, 300); + if (Projectile.ai[1] == 2) + target.AddBuff(ModContent.BuffType(), 300); + + if (Projectile.numHits > 0) + Projectile.damage = (int)(Projectile.damage * 0.8f); + if (Projectile.damage < 1) + Projectile.damage = 1; } public override void AI() { - Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.75f / 255f, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0.01f / 255f); - Vector2 dustVel = CalamityUtils.RandomVelocity(120f, 36f, 108f, 1f); - int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, Main.rand.NextBool() ? 221 : 244, 0f, 0f, 100, default, 2f); - Dust dust = Main.dust[idx]; - dust.noGravity = true; - dust.position.X = Projectile.Center.X; - dust.position.Y = Projectile.Center.Y; - dust.position.X += Main.rand.NextFloat(-10f, 10f); - dust.position.Y += Main.rand.NextFloat(-10f, 10f); - dust.velocity = dustVel; + if (Projectile.ai[2] == 1) + { + Projectile.friendly = false; + Projectile.hostile = true; + } } + + public override bool PreDraw(ref Color lightColor) + { + return false; + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 400, targetHitbox); } } diff --git a/Projectiles/Ranged/NorfleetGhost.png b/Projectiles/Ranged/NorfleetGhost.png new file mode 100644 index 0000000000..7c5729e630 Binary files /dev/null and b/Projectiles/Ranged/NorfleetGhost.png differ diff --git a/Projectiles/Ranged/NorfleetGhostGlowmask.png b/Projectiles/Ranged/NorfleetGhostGlowmask.png new file mode 100644 index 0000000000..bced156557 Binary files /dev/null and b/Projectiles/Ranged/NorfleetGhostGlowmask.png differ diff --git a/Projectiles/Ranged/NovaChargedShot.cs b/Projectiles/Ranged/NovaChargedShot.cs index 9c031426af..7571a40057 100644 --- a/Projectiles/Ranged/NovaChargedShot.cs +++ b/Projectiles/Ranged/NovaChargedShot.cs @@ -50,7 +50,7 @@ namespace CalamityMod.Projectiles.Ranged GeneralParticleHandler.SpawnParticle(Trail); } } - + } public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Ranged/Nuke.cs b/Projectiles/Ranged/Nuke.cs index a9a12d7939..255fa30cd0 100644 --- a/Projectiles/Ranged/Nuke.cs +++ b/Projectiles/Ranged/Nuke.cs @@ -1,12 +1,12 @@ -using CalamityMod.Projectiles.Typeless; -using Microsoft.Xna.Framework; -using System; +using System; using System.Collections.Generic; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using CalamityMod.Buffs.DamageOverTime; namespace CalamityMod.Projectiles.Ranged { @@ -57,20 +57,20 @@ namespace CalamityMod.Projectiles.Ranged { if (Projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack, Projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.75), Projectile.knockBack, Projectile.owner, 0f, 0f); } - flarePowderTimer = 12; + flarePowderTimer = 6; } if (Math.Abs(Projectile.velocity.X) >= 8f || Math.Abs(Projectile.velocity.Y) >= 8f) { float halfX = Projectile.velocity.X * 0.5f; float halfY = Projectile.velocity.Y * 0.5f; - int dust = Dust.NewDust(new Vector2(Projectile.position.X + 3f + halfX, Projectile.position.Y + 3f + halfY) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 244, 0f, 0f, 100, default, 1f); + int dust = Dust.NewDust(new Vector2(Projectile.position.X + 3f + halfX, Projectile.position.Y + 3f + halfY) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, DustID.CopperCoin, 0f, 0f, 100, default, 1f); Main.dust[dust].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; Main.dust[dust].velocity *= 0.2f; Main.dust[dust].noGravity = true; - dust = Dust.NewDust(new Vector2(Projectile.position.X + 3f + halfX, Projectile.position.Y + 3f + halfY) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 244, 0f, 0f, 100, default, 0.5f); + dust = Dust.NewDust(new Vector2(Projectile.position.X + 3f + halfX, Projectile.position.Y + 3f + halfY) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, DustID.CopperCoin, 0f, 0f, 100, default, 0.5f); Main.dust[dust].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; Main.dust[dust].velocity *= 0.05f; } @@ -86,11 +86,13 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(ModContent.BuffType(), 300); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.33), Projectile.knockBack, Projectile.owner, 0f, 2f); } public override void OnHitPlayer(Player target, Player.HurtInfo info) { target.AddBuff(ModContent.BuffType(), 300); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.33), Projectile.knockBack, Projectile.owner, 0f, 2f); } public override void OnKill(int timeLeft) @@ -104,7 +106,7 @@ namespace CalamityMod.Projectiles.Ranged SoundEngine.PlaySound(SoundID.Item14, Projectile.position); for (int i = 0; i < 40; i++) { - int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 100, default, 2f); Main.dust[idx].velocity *= 3f; if (Main.rand.NextBool()) { @@ -114,10 +116,10 @@ namespace CalamityMod.Projectiles.Ranged } for (int i = 0; i < 60; i++) { - int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 3f); + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 100, default, 3f); Main.dust[idx].noGravity = true; Main.dust[idx].velocity *= 5f; - idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); + idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 100, default, 2f); Main.dust[idx].velocity *= 2f; } diff --git a/Projectiles/Ranged/NullShot.cs b/Projectiles/Ranged/NullShot.cs index 13a6960350..b0b6881f10 100644 --- a/Projectiles/Ranged/NullShot.cs +++ b/Projectiles/Ranged/NullShot.cs @@ -1,4 +1,4 @@ -using CalamityMod.NPCs.NormalNPCs; +using CalamityMod.NPCs.NormalNPCs; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -31,7 +31,7 @@ namespace CalamityMod.Projectiles.Ranged { float x = Projectile.position.X - Projectile.velocity.X / 10f * (float)num134; float y = Projectile.position.Y - Projectile.velocity.Y / 10f * (float)num134; - int dust = Dust.NewDust(new Vector2(x, y), 1, 1, 160, 0f, 0f, 0, default, 2f); + int dust = Dust.NewDust(new Vector2(x, y), 1, 1, DustID.MagnetSphere, 0f, 0f, 0, default, 2f); Main.dust[dust].alpha = Projectile.alpha; Main.dust[dust].position.X = x; Main.dust[dust].position.Y = y; diff --git a/Projectiles/Ranged/NullShot2.cs b/Projectiles/Ranged/NullShot2.cs index caad64455d..7342465df3 100644 --- a/Projectiles/Ranged/NullShot2.cs +++ b/Projectiles/Ranged/NullShot2.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Projectiles.Ranged { float x = Projectile.position.X - Projectile.velocity.X / 10f * (float)num134; float y = Projectile.position.Y - Projectile.velocity.Y / 10f * (float)num134; - int dust = Dust.NewDust(new Vector2(x, y), 1, 1, 66, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + int dust = Dust.NewDust(new Vector2(x, y), 1, 1, DustID.RainbowTorch, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); Main.dust[dust].alpha = Projectile.alpha; Main.dust[dust].position.X = x; Main.dust[dust].position.Y = y; diff --git a/Projectiles/Ranged/OpalChargedStrike.cs b/Projectiles/Ranged/OpalChargedStrike.cs index 3276acb60c..6abb6efd69 100644 --- a/Projectiles/Ranged/OpalChargedStrike.cs +++ b/Projectiles/Ranged/OpalChargedStrike.cs @@ -28,10 +28,14 @@ namespace CalamityMod.Projectiles.Ranged Projectile.extraUpdates = 3; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 50; + Projectile.tileCollide = false; // Custom tile collision since the hitbox is large } public override void AI() { + if (Collision.SolidCollision(Projectile.Center, 5, 5)) + Projectile.Kill(); + if (Main.rand.NextBool(3)) { Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(7, 7), 162); diff --git a/Projectiles/Ranged/OpalStrike.cs b/Projectiles/Ranged/OpalStrike.cs index 1a82b1d261..e4fa59607f 100644 --- a/Projectiles/Ranged/OpalStrike.cs +++ b/Projectiles/Ranged/OpalStrike.cs @@ -28,10 +28,14 @@ namespace CalamityMod.Projectiles.Ranged Projectile.extraUpdates = 2; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 50; + Projectile.tileCollide = false; // Custom tile collision since the hitbox is large } public override void AI() { + if (Collision.SolidCollision(Projectile.Center, 5, 5)) + Projectile.Kill(); + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; Dust.NewDustPerfect(Projectile.Center, 162); } diff --git a/Projectiles/Ranged/OpalStrikerHoldout.cs b/Projectiles/Ranged/OpalStrikerHoldout.cs index c43141bd89..afc3cb7b6d 100644 --- a/Projectiles/Ranged/OpalStrikerHoldout.cs +++ b/Projectiles/Ranged/OpalStrikerHoldout.cs @@ -1,8 +1,8 @@ -using CalamityMod.Items.Weapons.Ranged; +using System; +using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Particles; using Microsoft.Xna.Framework; using ReLogic.Utilities; -using System; using Terraria; using Terraria.Audio; using Terraria.Localization; @@ -16,7 +16,7 @@ namespace CalamityMod.Projectiles.Ranged public override LocalizedText DisplayName => CalamityUtils.GetItemName(); public override string Texture => "CalamityMod/Items/Weapons/Ranged/OpalStriker"; - public static float ChargedDamageMult = 4.3f; + public static float ChargedDamageMult = 5f; public static float ChargedKBMult = 3f; public static float BulletSpeed = 12f; @@ -26,7 +26,6 @@ namespace CalamityMod.Projectiles.Ranged private ref float CurrentChargingFrames => ref Projectile.ai[0]; private bool FullyCharged => CurrentChargingFrames >= OpalStriker.FullChargeFrames; public int Time = 0; - private bool OwnerCanShoot => Owner.channel && !Owner.noItems && !Owner.CCed; public override void SetDefaults() { @@ -59,7 +58,7 @@ namespace CalamityMod.Projectiles.Ranged ChargeSound.Position = Projectile.Center; // Fire if the owner stops channeling or otherwise cannot use the weapon. - if (!OwnerCanShoot) + if (Owner.CantUseHoldout()) { if (Projectile.ai[1] != 1f) { @@ -146,7 +145,7 @@ namespace CalamityMod.Projectiles.Ranged // Rumble (only while channeling) float rumble = MathHelper.Clamp(CurrentChargingFrames, 0f, OpalStriker.FullChargeFrames); - if (OwnerCanShoot) + if (!Owner.CantUseHoldout()) Projectile.position += Main.rand.NextVector2Circular(rumble / 30f, rumble / 30f); } diff --git a/Projectiles/Ranged/P90Round.cs b/Projectiles/Ranged/P90Round.cs index 9c29e5bb1f..1fb3cf5ea8 100644 --- a/Projectiles/Ranged/P90Round.cs +++ b/Projectiles/Ranged/P90Round.cs @@ -1,5 +1,5 @@ -using CalamityMod.Particles; -using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -24,11 +24,14 @@ namespace CalamityMod.Projectiles.Ranged Projectile.timeLeft = 600; Projectile.extraUpdates = 5; Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; - Projectile.tileCollide = true; - Projectile.ArmorPenetration = 15; + Projectile.tileCollide = false; // Custom tile collision since the hitbox is large + Projectile.ArmorPenetration = 30; } public override void AI() { + if (Collision.SolidCollision(Projectile.Center, 5, 5)) + Projectile.Kill(); + if (Projectile.timeLeft == 598) { for (int i = 0; i <= 3; i++) diff --git a/Projectiles/Ranged/PhangasmBow.cs b/Projectiles/Ranged/PhangasmBow.cs index 22be884ad1..cf9d398386 100644 --- a/Projectiles/Ranged/PhangasmBow.cs +++ b/Projectiles/Ranged/PhangasmBow.cs @@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Ranged fullSpeed = true; int arg_1EF4_0 = (int)Projectile.ai[0] / (delayCompare - fireSpeedCompare * fireSpeed); } - bool canUseItem = player.channel && player.HasAmmo(player.ActiveItem()) && !player.noItems && !player.CCed; + bool canUseItem = !player.CantUseHoldout() && player.HasAmmo(player.ActiveItem()); if (Projectile.localAI[0] > 0f) { Projectile.localAI[0] -= 1f; diff --git a/Projectiles/Ranged/PhotovisceratorHoldout.cs b/Projectiles/Ranged/PhotovisceratorHoldout.cs index d26bea597d..2b5d81ed2c 100644 --- a/Projectiles/Ranged/PhotovisceratorHoldout.cs +++ b/Projectiles/Ranged/PhotovisceratorHoldout.cs @@ -2,6 +2,7 @@ using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Particles; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using ReLogic.Utilities; using Terraria; using Terraria.Audio; @@ -139,7 +140,7 @@ namespace CalamityMod.Projectiles.Ranged var source = Projectile.GetSource_FromThis(); Vector2 position = armPosition + Projectile.velocity * 55f - verticalOffset * 10f; Vector2 velocity = Projectile.velocity * shootSpeed; - + if (PhotoTimer == 1) { for (int i = 0; i < 30; i++) @@ -154,7 +155,7 @@ namespace CalamityMod.Projectiles.Ranged SquishyLightParticle exoEnergy = new(position, (Projectile.velocity * 3).RotatedByRandom(0.4f) * Main.rand.NextFloat(0.3f, 1.6f), 0.9f, sparkColor, 60); GeneralParticleHandler.SpawnParticle(exoEnergy); } - SoundEngine.PlaySound(DeadSunsWind.Shoot with { Volume = 1.9f}, Owner.MountedCenter); + SoundEngine.PlaySound(DeadSunsWind.ShootSound with { Volume = 1.9f }, Owner.MountedCenter); } Dust dust = Dust.NewDustPerfect(position, 263, (Projectile.velocity * 10).RotatedByRandom(0.6f) * Main.rand.NextFloat(0.3f, 1.6f)); @@ -223,9 +224,9 @@ namespace CalamityMod.Projectiles.Ranged dust.scale = Main.rand.NextFloat(1.3f, 1.8f); dust.color = sparkColor; } - SoundEngine.PlaySound(HalleysInferno.Shoot with { Volume = 0.4f } , Owner.MountedCenter); + SoundEngine.PlaySound(HalleysInferno.ShootSound with { Volume = 0.4f }, Owner.MountedCenter); - int rightClickDamage = (int)(0.5f * damage); + int rightClickDamage = (int)(0.70f * damage); Projectile.NewProjectile(source, position, velocity, ProjectileType(), rightClickDamage, knockback, Projectile.owner); } @@ -269,5 +270,16 @@ namespace CalamityMod.Projectiles.Ranged Sound?.Stop(); PhotoTimer = 90; } + + public override void PostDraw(Color lightColor) + { + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Vector2 origin = new Vector2(85f, 33f); + SpriteEffects spriteEffects = SpriteEffects.None; + if (Projectile.spriteDirection == -1) + spriteEffects = SpriteEffects.FlipHorizontally; + + Main.EntitySpriteDraw(ModContent.Request("CalamityMod/Projectiles/Ranged/PhotovisceratorHoldoutGlow").Value, Projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, 0, texture.Width, texture.Height)), Color.White, Projectile.rotation, origin, Projectile.scale, spriteEffects, 0); + } } } diff --git a/Projectiles/Ranged/PhotovisceratorHoldoutGlow.png b/Projectiles/Ranged/PhotovisceratorHoldoutGlow.png new file mode 100644 index 0000000000..5ad78c0e7e Binary files /dev/null and b/Projectiles/Ranged/PhotovisceratorHoldoutGlow.png differ diff --git a/Projectiles/Ranged/PiercingBullet.cs b/Projectiles/Ranged/PiercingBullet.cs index 24ed7d84ba..650721a4f8 100644 --- a/Projectiles/Ranged/PiercingBullet.cs +++ b/Projectiles/Ranged/PiercingBullet.cs @@ -1,10 +1,10 @@ -using CalamityMod.Buffs.StatDebuffs; +using System; +using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { public class PiercingBullet : ModProjectile, ILocalizedModType diff --git a/Projectiles/Ranged/PlagueArrow.cs b/Projectiles/Ranged/PlagueArrow.cs index b9dfbbeb65..6a40f1bd25 100644 --- a/Projectiles/Ranged/PlagueArrow.cs +++ b/Projectiles/Ranged/PlagueArrow.cs @@ -1,8 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { diff --git a/Projectiles/Ranged/PlagueExplosionFriendly.cs b/Projectiles/Ranged/PlagueExplosionFriendly.cs index 90976dae42..51358b057d 100644 --- a/Projectiles/Ranged/PlagueExplosionFriendly.cs +++ b/Projectiles/Ranged/PlagueExplosionFriendly.cs @@ -1,8 +1,10 @@ +using System; using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Ranged { public class PlagueExplosionFriendly : ModProjectile, ILocalizedModType @@ -69,7 +71,7 @@ namespace CalamityMod.Projectiles.Ranged randAdjust = rand3 / randAdjust; rand1 *= randAdjust; rand2 *= randAdjust; - int greenDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 89, 0f, 0f, 100, default, 0.5f); + int greenDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GemEmerald, 0f, 0f, 100, default, 0.5f); Dust dust = Main.dust[greenDust]; dust.noGravity = true; dust.position.X = Projectile.Center.X; diff --git a/Projectiles/Ranged/PlagueTaintedDrone.cs b/Projectiles/Ranged/PlagueTaintedDrone.cs index 5e48467eee..132aaf1c82 100644 --- a/Projectiles/Ranged/PlagueTaintedDrone.cs +++ b/Projectiles/Ranged/PlagueTaintedDrone.cs @@ -1,12 +1,12 @@ -using Microsoft.Xna.Framework; -using System.Collections.Generic; +using System.Collections.Generic; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using CalamityMod.Dusts; -using CalamityMod.Buffs.DamageOverTime; -using Microsoft.Xna.Framework.Graphics; namespace CalamityMod.Projectiles.Ranged { @@ -90,7 +90,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; int height = texture.Height / Main.projFrames[Projectile.type]; int drawStart = height * Projectile.frame; Vector2 origin = Projectile.Size / 2; @@ -100,7 +100,7 @@ namespace CalamityMod.Projectiles.Ranged public override void PostDraw(Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; int height = texture.Height / Main.projFrames[Projectile.type]; int drawStart = height * Projectile.frame; Vector2 origin = Projectile.Size / 2; @@ -120,7 +120,8 @@ namespace CalamityMod.Projectiles.Ranged public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { - if (target.Calamity().pFlames > 0) { + if (target.Calamity().pFlames > 0) + { if (Projectile.ai[1] == 1) return; else if (Main.rand.Next(4) < 3) @@ -140,7 +141,7 @@ namespace CalamityMod.Projectiles.Ranged SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); for (int i = 0; i < 20; i++) { - int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 89, 0f, 0f, 100, default, 2f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GemEmerald, 0f, 0f, 100, default, 2f); Main.dust[dust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -150,10 +151,10 @@ namespace CalamityMod.Projectiles.Ranged } for (int j = 0; j < 40; j++) { - int dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 3f); + int dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 3f); Main.dust[dust2].noGravity = true; Main.dust[dust2].velocity *= 5f; - dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 2f); + dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 2f); Main.dust[dust2].velocity *= 2f; } diff --git a/Projectiles/Ranged/PlagueTaintedProjectile.cs b/Projectiles/Ranged/PlagueTaintedProjectile.cs index 1b2f1b2d3c..93191a077a 100644 --- a/Projectiles/Ranged/PlagueTaintedProjectile.cs +++ b/Projectiles/Ranged/PlagueTaintedProjectile.cs @@ -1,10 +1,10 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Dusts; namespace CalamityMod.Projectiles.Ranged { @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Ranged { if (Main.rand.NextBool(3)) { - int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 89, 0f, 0f, 0, default, 0.8f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GemEmerald, 0f, 0f, 0, default, 0.8f); Main.dust[dust].alpha = Projectile.alpha; Main.dust[dust].velocity *= 0f; Main.dust[dust].noGravity = true; @@ -122,7 +122,7 @@ namespace CalamityMod.Projectiles.Ranged { SoundEngine.PlaySound(SoundID.Item10, Projectile.position); for (int k = 0; k < 5; k++) - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 89, Projectile.oldVelocity.X * 0.2f, Projectile.oldVelocity.Y * 0.2f, 0, default, 0.6f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.GemEmerald, Projectile.oldVelocity.X * 0.2f, Projectile.oldVelocity.Y * 0.2f, 0, default, 0.6f); } } } diff --git a/Projectiles/Ranged/PlanarRipperBolt.cs b/Projectiles/Ranged/PlanarRipperBolt.cs index 0b09ff859b..5a78feabf5 100644 --- a/Projectiles/Ranged/PlanarRipperBolt.cs +++ b/Projectiles/Ranged/PlanarRipperBolt.cs @@ -1,9 +1,9 @@ using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -106,17 +106,17 @@ namespace CalamityMod.Projectiles.Ranged Projectile.Damage(); SoundStyle sound = Main.rand.NextBool() ? SoundID.Item93 : SoundID.Item92; - SoundEngine.PlaySound(sound with { Volume = sound.Volume * 0.5f}, Projectile.position); + SoundEngine.PlaySound(sound with { Volume = sound.Volume * 0.5f }, Projectile.position); for (int i = 0; i < 5; i++) { - int dust = Dust.NewDust(Projectile.Center, 1, 1, 132, Projectile.velocity.X, Projectile.velocity.Y, 0, default, 0.5f); + int dust = Dust.NewDust(Projectile.Center, 1, 1, DustID.Firework_Blue, Projectile.velocity.X, Projectile.velocity.Y, 0, default, 0.5f); Main.dust[dust].noGravity = true; } int rando = Main.rand.Next(10, 20); for (int i = 0; i < rando; i++) { - int dusty = Dust.NewDust(Projectile.Center - Projectile.velocity / 2f, 0, 0, 135, 0f, 0f, 100, default, 2f); + int dusty = Dust.NewDust(Projectile.Center - Projectile.velocity / 2f, 0, 0, DustID.IceTorch, 0f, 0f, 100, default, 2f); Main.dust[dusty].velocity *= 2f; Main.dust[dusty].noGravity = true; } diff --git a/Projectiles/Ranged/PlanarRipperExplosion.cs b/Projectiles/Ranged/PlanarRipperExplosion.cs index bec0f941ad..683b641017 100644 --- a/Projectiles/Ranged/PlanarRipperExplosion.cs +++ b/Projectiles/Ranged/PlanarRipperExplosion.cs @@ -49,7 +49,7 @@ namespace CalamityMod.Projectiles.Ranged randAdjust = rand3 / randAdjust; rand1 *= randAdjust; rand2 *= randAdjust; - int boomDustID = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 132, 0f, 0f, 100, default, 0.5f); + int boomDustID = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Firework_Blue, 0f, 0f, 100, default, 0.5f); Dust dust = Main.dust[boomDustID]; dust.noGravity = true; dust.position.X = Projectile.Center.X; diff --git a/Projectiles/Ranged/PlanetaryAnnihilationProj.cs b/Projectiles/Ranged/PlanetaryAnnihilationProj.cs index 67bb1e6dd9..16afcdb0b1 100644 --- a/Projectiles/Ranged/PlanetaryAnnihilationProj.cs +++ b/Projectiles/Ranged/PlanetaryAnnihilationProj.cs @@ -53,7 +53,7 @@ namespace CalamityMod.Projectiles.Ranged dustType = 57; break; } - int addedDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2.2f); + int addedDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2.2f); Main.dust[addedDust].noGravity = true; Main.dust[addedDust].velocity *= 0f; @@ -81,14 +81,14 @@ namespace CalamityMod.Projectiles.Ranged int inc; for (int i = 0; i < 20; i = inc + 1) { - int dustID = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 200, default, 2.1f); + int dustID = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 200, default, 2.1f); Main.dust[dustID].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; Main.dust[dustID].noGravity = true; Dust dust = Main.dust[dustID]; dust.velocity *= 3f; dust = Main.dust[dustID]; dust.velocity += dustVel * Main.rand.NextFloat(); - dustID = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 1.1f); + dustID = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 1.1f); Main.dust[dustID].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; dust = Main.dust[dustID]; dust.velocity *= 2f; @@ -100,7 +100,7 @@ namespace CalamityMod.Projectiles.Ranged } for (int j = 0; j < 10; j = inc + 1) { - int dustID = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 0, default, 2.5f); + int dustID = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 0, default, 2.5f); Main.dust[dustID].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)Projectile.velocity.ToRotation(), default) * (float)Projectile.width / 3f; Main.dust[dustID].noGravity = true; Dust dust = Main.dust[dustID]; diff --git a/Projectiles/Ranged/PlasmaBlast.cs b/Projectiles/Ranged/PlasmaBlast.cs index 555c142e65..93548a466e 100644 --- a/Projectiles/Ranged/PlasmaBlast.cs +++ b/Projectiles/Ranged/PlasmaBlast.cs @@ -1,8 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -45,7 +45,7 @@ namespace CalamityMod.Projectiles.Ranged Vector2 dustVel = Vector2.UnitX * (float)-(float)Projectile.width / 2f; dustVel += -Vector2.UnitY.RotatedBy((double)((float)l * MathHelper.Pi / 6f), default) * new Vector2(8f, 16f); dustVel = dustVel.RotatedBy((double)(Projectile.rotation - MathHelper.PiOver2), default); - int dust = Dust.NewDust(Projectile.Center, 0, 0, 221, 0f, 0f, 160, default, 1f); + int dust = Dust.NewDust(Projectile.Center, 0, 0, DustID.FireworkFountain_Blue, 0f, 0f, 160, default, 1f); Main.dust[dust].noGravity = true; Main.dust[dust].position = Projectile.Center + dustVel; Main.dust[dust].velocity = Projectile.velocity * 0.1f; @@ -65,7 +65,7 @@ namespace CalamityMod.Projectiles.Ranged if (Main.rand.NextBool(16)) { Vector2 extraDustVel = Vector2.UnitX.RotatedByRandom(MathHelper.PiOver2).RotatedBy((double)Projectile.velocity.ToRotation(), default); - int extraDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 221, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1f); + int extraDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.FireworkFountain_Blue, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1f); Main.dust[extraDust].velocity = extraDustVel * 0.66f; Main.dust[extraDust].position = Projectile.Center + extraDustVel * 12f; } @@ -81,7 +81,7 @@ namespace CalamityMod.Projectiles.Ranged { Projectile.light = 0.9f; if (Main.rand.NextBool(10)) - Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 221, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.FireworkFountain_Blue, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1f); if (Main.rand.NextBool(20) && Main.netMode != NetmodeID.Server) Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.position, new Vector2(Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f), Main.rand.Next(16, 18), 1f); } diff --git a/Projectiles/Ranged/PlasmaExplosion.cs b/Projectiles/Ranged/PlasmaExplosion.cs index 13b04f4e6a..47b172c2d7 100644 --- a/Projectiles/Ranged/PlasmaExplosion.cs +++ b/Projectiles/Ranged/PlasmaExplosion.cs @@ -78,7 +78,7 @@ namespace CalamityMod.Projectiles.Ranged randAdjust = rand3 / randAdjust; rand1 *= randAdjust; rand2 *= randAdjust; - int dustID = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, Projectile.ai[1] == 1f ? 173 : 221, 0f, 0f, 100, default, 2f); + int dustID = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, Projectile.ai[1] == 1f ? 173 : 221, 0f, 0f, 100, default, 2f); Dust dust = Main.dust[dustID]; dust.noGravity = true; dust.position.X = Projectile.Center.X; diff --git a/Projectiles/Ranged/PolarStar.cs b/Projectiles/Ranged/PolarStar.cs index 7de53d1c2e..bdc4de08d8 100644 --- a/Projectiles/Ranged/PolarStar.cs +++ b/Projectiles/Ranged/PolarStar.cs @@ -1,201 +1,169 @@ -using CalamityMod.Buffs.StatBuffs; +using System; +using System.IO; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatBuffs; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Boss; using Microsoft.Xna.Framework; -using System; +using Microsoft.Xna.Framework.Graphics; using Terraria; -using Terraria.ModLoader; -using Terraria.ID; using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using static CalamityMod.Items.Weapons.Ranged.PolarisParrotfish; +using static Terraria.ModLoader.ModContent; namespace CalamityMod.Projectiles.Ranged { public class PolarStar : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Ranged"; - public override string Texture => "CalamityMod/Projectiles/LaserProj"; + public override string Texture => "CalamityMod/Projectiles/Ranged/PolarStar"; - private int dust1 = 86; - private int dust2 = 91; + public ref float Time => ref Projectile.ai[0]; + private static float HitboxSize = 30f; + + public int dustTypeWhite = 91; + public int tileBounces = 0; + public float DustScaleMultiplier = 1; // Rocket type dust has to be smaller to look good with the others + public bool DoSlowdown = true; // On hit projectiles exist for a few extra frames to prevent projectile spam from far away + public Vector2 StartVelocity; + public Color EffectsColor; + public int DustEffectsID; public override void SetDefaults() { - Projectile.width = 10; - Projectile.height = 10; + Projectile.width = 18; // Projectile size is higher than normal because hitting constantly is important for this weapon + Projectile.height = 26; Projectile.friendly = true; - Projectile.alpha = 255; - Projectile.penetrate = 1; - Projectile.extraUpdates = 1; - Projectile.timeLeft = 300; + Projectile.penetrate = -1; // Only hits once, "pierces" so that it can last a bit after hitting + Projectile.extraUpdates = 2; + Projectile.timeLeft = 50; Projectile.DamageType = DamageClass.Ranged; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; } public override void AI() { - //Looking pretty at boost two or three - if (Projectile.ai[1] == 2f || Projectile.ai[1] == 1f) + Time++; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + + if (Time == 1) // Start of the shot visuals and other things that happen when it spawns { - Vector2 value7 = new Vector2(5f, 10f); - Lighting.AddLight(Projectile.Center, 0.25f, 0f, 0.25f); - Projectile.localAI[0] += 1f; - if (Projectile.localAI[0] == 48f) + StartVelocity = Projectile.velocity; + switch (Projectile.ai[1]) { - Projectile.localAI[0] = 0f; + case 2: // Orange shot + DustEffectsID = ModContent.DustType(); + EffectsColor = Color.Coral; + DustScaleMultiplier = 1; + break; + case 1: // Blue shot + DustEffectsID = ModContent.DustType(); + EffectsColor = Color.Turquoise; + DustScaleMultiplier = 1; + break; + default: // Pink shot + DustEffectsID = 223; + EffectsColor = Color.Violet; + DustScaleMultiplier = 0.4f; + break; } - else + + for (int i = 0; i <= 10; i++) { - for (int d = 0; d < 2; d++) - { - int dustType = d == 0 ? dust1 : dust2; - Vector2 dustVel = Vector2.UnitX * -12f; - dustVel = -Vector2.UnitY.RotatedBy((double)(Projectile.localAI[0] * 0.1308997f + (float)d * MathHelper.Pi), default) * value7; - int typeDust = Dust.NewDust(Projectile.Center, 0, 0, dustType, 0f, 0f, 160, default, 1f); - Main.dust[typeDust].scale = dustType == dust1 ? 1.5f : 1f; - Main.dust[typeDust].noGravity = true; - Main.dust[typeDust].position = Projectile.Center + dustVel; - Main.dust[typeDust].velocity = Projectile.velocity; - int extraDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 0.8f); - Main.dust[extraDust].noGravity = true; - Main.dust[extraDust].velocity *= 0f; - } + Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(5) ? dustTypeWhite : DustEffectsID, Projectile.velocity.RotatedByRandom(0.5f) * Main.rand.NextFloat(0.1f, 0.3f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.85f, 1.4f) * DustScaleMultiplier; + } + for (int i = 0; i <= 2; i++) + { + SquishyLightParticle energy = new(Projectile.Center, Projectile.velocity.RotatedByRandom(0.5f) * Main.rand.NextFloat(0.1f, 0.4f), Main.rand.NextFloat(0.2f, 0.6f), EffectsColor, Main.rand.Next(40, 50 + 1), 0.25f, 2f); + GeneralParticleHandler.SpawnParticle(energy); } } - if (Projectile.ai[1] == 2f) //Boost three + + if (Time % 3 == 0) { - CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 200f, 12f, 20f); + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(15, 15), Main.rand.NextBool(5) ? dustTypeWhite : DustEffectsID); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.5f, 1.2f) * DustScaleMultiplier; + dust.velocity = -Projectile.velocity * Main.rand.NextFloat(0.01f, 0.045f); } - else if (Projectile.ai[1] == 1f) //Boost two + + if (Projectile.timeLeft % 2 == 0 && Time > 4 && DoSlowdown) // Particle trail { - if (Projectile.alpha > 0) - { - Projectile.alpha -= 25; - } - if (Projectile.alpha < 0) - { - Projectile.alpha = 0; - } - float boostLevel = 30f; - float inc = 1f; - if (Projectile.ai[1] == 1f) - { - Projectile.localAI[0] += inc; - if (Projectile.localAI[0] > boostLevel) - { - Projectile.localAI[0] = boostLevel; - } - } - else - { - Projectile.localAI[0] -= inc; - if (Projectile.localAI[0] <= 0f) - { - Projectile.Kill(); - } - } + PointParticle spark = new PointParticle(Projectile.Center - Projectile.velocity * 1f, -Projectile.velocity * 0.01f, false, 7, 2f, EffectsColor * 0.6f); + GeneralParticleHandler.SpawnParticle(spark); } - else //No boosts + + if (Projectile.timeLeft <= 2 && DoSlowdown) { - if (Projectile.alpha > 0) - { - Projectile.alpha -= 25; - } - if (Projectile.alpha < 0) - { - Projectile.alpha = 0; - } - float boostLevel = 40f; - float inc = 1.5f; - if (Projectile.ai[1] == 0f) - { - Projectile.localAI[0] += inc; - if (Projectile.localAI[0] > boostLevel) - { - Projectile.localAI[0] = boostLevel; - } - } - else - { - Projectile.localAI[0] -= inc; - if (Projectile.localAI[0] <= 0f) - { - Projectile.Kill(); - } - } + Projectile.timeLeft = Main.zenithWorld ? 3 : 7; // Adds extra projectile time on hit so that you can only fire faster if you're quite close + Projectile.velocity = Vector2.Zero; + DoSlowdown = false; } + + if (!DoSlowdown) + { + Projectile.extraUpdates = 0; + Projectile.alpha = 255; + } + + Lighting.AddLight(Projectile.Center, EffectsColor.ToVector3() * 1f); } - - public override Color? GetAlpha(Color lightColor) => new Color(255, 255, 255, Projectile.alpha); - - public override bool PreDraw(ref Color lightColor) => Projectile.DrawBeam(40f, 1.5f, lightColor); - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - Player player = Main.player[Projectile.owner]; - if (Projectile.owner == Main.myPlayer && target.IsAnEnemy(false)) + if (DoSlowdown) { - player.AddBuff(ModContent.BuffType(), 480); + Projectile.timeLeft = Main.zenithWorld ? 3 : 7; // Adds extra projectile time on hit so that you can only fire faster if you're quite close + Projectile.velocity = Vector2.Zero; + DoSlowdown = false; } } - public override bool OnTileCollide(Vector2 oldVelocity) { - Collision.HitTiles(Projectile.position + Projectile.velocity, Projectile.velocity, Projectile.width, Projectile.height); - SoundEngine.PlaySound(SoundID.Dig, Projectile.position); - return true; - } + Time = 2; + if (tileBounces >= 2) + Projectile.Kill(); + else + tileBounces++; + + for (int i = 0; i <= 5; i++) + { + SquishyLightParticle energy = new(Projectile.Center, Projectile.velocity.RotatedByRandom(100) * Main.rand.NextFloat(0.08f, 0.15f), Main.rand.NextFloat(0.4f, 0.7f), EffectsColor, Main.rand.Next(40, 50 + 1), 0.25f, 2f); + GeneralParticleHandler.SpawnParticle(energy); + } + if (Projectile.velocity.X != oldVelocity.X) + { + Projectile.velocity.X = -oldVelocity.X; + } + if (Projectile.velocity.Y != oldVelocity.Y) + { + Projectile.velocity.Y = -oldVelocity.Y; + } + return false; + } public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item62 with { Volume = SoundID.Item62.Volume * 0.5f}, Projectile.position); - if (Projectile.ai[1] == 1f) //Boost two + int points = 5; + float radians = MathHelper.TwoPi / points; + Vector2 spinningPoint = Vector2.Normalize(new Vector2(-1f, -1f)); + Vector2 addedPlacement = StartVelocity * Main.rand.NextFloat(0.1f, 1.5f); + for (int k = 0; k < points; k++) { - int projectiles = Main.rand.Next(2, 5); - if (Projectile.owner == Main.myPlayer) - { - for (int k = 0; k < projectiles; k++) - { - int split = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.position.X, Projectile.position.Y, (float)Main.rand.Next(-10, 11) * 2f, (float)Main.rand.Next(-10, 11) * 2f, ModContent.ProjectileType(), - (int)((double)Projectile.damage * 0.85), (float)(int)((double)Projectile.knockBack * 0.5), Main.myPlayer, 0f, 0f); - } - } - } - if (Projectile.ai[1] == 2f) //Boost three - { - Projectile.ExpandHitboxBy(150); - Projectile.maxPenetrate = -1; - Projectile.penetrate = -1; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; - Projectile.damage /= 2; - Projectile.Damage(); - - int dustAmt = 36; - for (int d = 0; d < dustAmt; d++) // 108 dusts - { - Vector2 source = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.3f; - source = source.RotatedBy((double)((float)(d - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + Projectile.Center; - Vector2 dustVel = source - Projectile.Center; - - int i = Dust.NewDust(source + dustVel, 0, 0, Main.rand.NextBool() ? dust1 : dust2, dustVel.X * 0.3f, dustVel.Y * 0.3f, 100, default, 2f); - Main.dust[i].noGravity = true; - - int j = Dust.NewDust(source + dustVel, 0, 0, Main.rand.NextBool() ? dust1 : dust2, dustVel.X * 0.2f, dustVel.Y * 0.2f, 100, default, 2f); - Main.dust[j].noGravity = true; - - int k = Dust.NewDust(source + dustVel, 0, 0, Main.rand.NextBool() ? dust1 : dust2, dustVel.X * 0.1f, dustVel.Y * 0.1f, 100, default, 2f); - Main.dust[k].noGravity = true; - } - - bool random = Main.rand.NextBool(); - float angleStart = Main.rand.NextFloat(0f, MathHelper.TwoPi); - for (float angle = 0f; angle < MathHelper.TwoPi; angle += 0.05f) // 125 dusts - { - random = !random; - Vector2 velocity = angle.ToRotationVector2() * (2f + (float)(Math.Sin(angleStart + angle * 3f) + 1) * 2.5f) * Main.rand.NextFloat(0.95f, 1.05f); - Dust d = Dust.NewDustPerfect(Projectile.Center, random ? dust1 : dust2, velocity); - d.noGravity = true; - d.customData = 0.025f; - d.scale = 2f; - } + Vector2 velocity = spinningPoint.RotatedBy(radians * k).RotatedBy(-0.45f); + PointParticle spark = new PointParticle((Projectile.Center + velocity * 7.5f) + addedPlacement, velocity * 2.5f, false, 13, 1.2f, EffectsColor); + GeneralParticleHandler.SpawnParticle(spark); } } + public override bool? CanDamage() => Projectile.numHits > 1 ? false : null; + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, HitboxSize, targetHitbox); } } diff --git a/Projectiles/Ranged/PolarStar.png b/Projectiles/Ranged/PolarStar.png new file mode 100644 index 0000000000..a914c11d29 Binary files /dev/null and b/Projectiles/Ranged/PolarStar.png differ diff --git a/Projectiles/Ranged/PrecisionBolt.cs b/Projectiles/Ranged/PrecisionBolt.cs index c7d6fc5cd5..bea7d232e5 100644 --- a/Projectiles/Ranged/PrecisionBolt.cs +++ b/Projectiles/Ranged/PrecisionBolt.cs @@ -1,9 +1,9 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { diff --git a/Projectiles/Ranged/PressurizedBubbleStream.cs b/Projectiles/Ranged/PressurizedBubbleStream.cs index 8f410a8cf6..54b78cc3e1 100644 --- a/Projectiles/Ranged/PressurizedBubbleStream.cs +++ b/Projectiles/Ranged/PressurizedBubbleStream.cs @@ -62,7 +62,7 @@ namespace CalamityMod.Projectiles.Ranged { chargeBubble = new GenericBubbleParticle(bubblePosition, Vector2.Zero, 0.4f, Owner.itemRotation, ChargeupTime / Projectile.extraUpdates); GeneralParticleHandler.SpawnParticle(chargeBubble); - } + } else { chargeBubble.Position = bubblePosition; @@ -105,7 +105,7 @@ namespace CalamityMod.Projectiles.Ranged for (int i = 0; i < numDust; i++) { - Vector2 ringSpeed = new Vector2((float)Math.Cos(i / (float)numDust * MathHelper.TwoPi), (float)Math.Sin(i / (float)numDust * MathHelper.TwoPi) * 0.5f).RotatedBy(Projectile.velocity.ToRotation() + MathHelper.PiOver2) * (3.5f * (1 - Progress) + 3f) ; + Vector2 ringSpeed = new Vector2((float)Math.Cos(i / (float)numDust * MathHelper.TwoPi), (float)Math.Sin(i / (float)numDust * MathHelper.TwoPi) * 0.5f).RotatedBy(Projectile.velocity.ToRotation() + MathHelper.PiOver2) * (3.5f * (1 - Progress) + 3f); Dust ringDust = Dust.NewDustPerfect(Projectile.position, 211, ringSpeed, 100, default, 1.25f); ringDust.noGravity = true; @@ -124,7 +124,7 @@ namespace CalamityMod.Projectiles.Ranged //Water trail for (int i = 0; i < 6; i++) { - Dust waterDust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 0.9f); + Dust waterDust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.Water, 0f, 0f, 100, default, 0.9f); waterDust.noGravity = true; waterDust.velocity *= 0.5f; waterDust.velocity -= Projectile.velocity * 0.1f; diff --git a/Projectiles/Ranged/PrismComet.cs b/Projectiles/Ranged/PrismComet.cs index 512ebf5cff..585c57f481 100644 --- a/Projectiles/Ranged/PrismComet.cs +++ b/Projectiles/Ranged/PrismComet.cs @@ -1,8 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -62,11 +62,11 @@ namespace CalamityMod.Projectiles.Ranged if (Main.dedServ) return; - Dust prismEnergy = Dust.NewDustDirect(Projectile.position - Projectile.velocity * 4f, 8, 8, 107, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, new Color(0, 255, 255), 0.5f); + Dust prismEnergy = Dust.NewDustDirect(Projectile.position - Projectile.velocity * 4f, 8, 8, DustID.TerraBlade, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, new Color(0, 255, 255), 0.5f); prismEnergy.velocity *= -0.25f; prismEnergy.velocity -= Projectile.velocity * 0.3f; - prismEnergy = Dust.NewDustDirect(Projectile.position - Projectile.velocity * 4f, 8, 8, 107, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, new Color(0, 255, 255), 0.5f); + prismEnergy = Dust.NewDustDirect(Projectile.position - Projectile.velocity * 4f, 8, 8, DustID.TerraBlade, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, new Color(0, 255, 255), 0.5f); prismEnergy.velocity *= -0.25f; prismEnergy.position -= Projectile.velocity * 0.5f; prismEnergy.velocity -= Projectile.velocity * 0.3f; diff --git a/Projectiles/Ranged/PrismEnergyBullet.cs b/Projectiles/Ranged/PrismEnergyBullet.cs index 486010d235..e28af7dd0d 100644 --- a/Projectiles/Ranged/PrismEnergyBullet.cs +++ b/Projectiles/Ranged/PrismEnergyBullet.cs @@ -1,10 +1,10 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -53,7 +53,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Vector2 origin = texture.Size() * 0.5f; Vector2 currentDirection = Projectile.velocity.SafeNormalize(Vector2.Zero); for (int i = 0; i < CurrentLaserLength; i++) diff --git a/Projectiles/Ranged/PrismExplosionLarge.cs b/Projectiles/Ranged/PrismExplosionLarge.cs index 8ec9898e33..9279a24993 100644 --- a/Projectiles/Ranged/PrismExplosionLarge.cs +++ b/Projectiles/Ranged/PrismExplosionLarge.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Texture2D lightTexture = ModContent.Request("CalamityMod/ExtraTextures/SmallGreyscaleCircle").Value; Rectangle frame = texture.Frame(3, 6, Projectile.frame / 6, Projectile.frame % 6); Vector2 drawPosition = Projectile.Center - Main.screenPosition; diff --git a/Projectiles/Ranged/PrismExplosionSmall.cs b/Projectiles/Ranged/PrismExplosionSmall.cs index 777066c5fe..1a7fff1cfc 100644 --- a/Projectiles/Ranged/PrismExplosionSmall.cs +++ b/Projectiles/Ranged/PrismExplosionSmall.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Texture2D lightTexture = ModContent.Request("CalamityMod/ExtraTextures/SmallGreyscaleCircle").Value; Rectangle frame = texture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); Vector2 drawPosition = Projectile.Center - Main.screenPosition; diff --git a/Projectiles/Ranged/PrismMine.cs b/Projectiles/Ranged/PrismMine.cs index e37bcf7ee2..363878009d 100644 --- a/Projectiles/Ranged/PrismMine.cs +++ b/Projectiles/Ranged/PrismMine.cs @@ -1,7 +1,7 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; +using System; using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ModLoader; @@ -84,7 +84,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - Texture2D baseTexture = ModContent.Request(Texture).Value; + Texture2D baseTexture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Texture2D glowTexture = ModContent.Request($"{Texture}Glowmask").Value; Texture2D laserTexture = ModContent.Request($"CalamityMod/Projectiles/Ranged/PrismMineArc").Value; diff --git a/Projectiles/Ranged/PristineFire.cs b/Projectiles/Ranged/PristineFire.cs index e2e3d4705d..00bf2f3f8a 100644 --- a/Projectiles/Ranged/PristineFire.cs +++ b/Projectiles/Ranged/PristineFire.cs @@ -1,11 +1,11 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using System.Collections.Generic; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Graphics.Primitives; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Projectiles/Ranged/PristineSecondary.cs b/Projectiles/Ranged/PristineSecondary.cs index e6dc9bab85..ef5744f2d4 100644 --- a/Projectiles/Ranged/PristineSecondary.cs +++ b/Projectiles/Ranged/PristineSecondary.cs @@ -66,7 +66,7 @@ namespace CalamityMod.Projectiles.Ranged { Main.spriteBatch.SetBlendState(BlendState.Additive); - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Vector2 drawPosition = Projectile.Center - Main.screenPosition; float opacity = Utils.GetLerpValue(0f, 0.08f, LightPower, true) * Projectile.Opacity * 0.5f; Color drawColor = FogColor * opacity; diff --git a/Projectiles/Ranged/PumplerGrenade.cs b/Projectiles/Ranged/PumplerGrenade.cs index 88012cb7fe..04ff44cbea 100644 --- a/Projectiles/Ranged/PumplerGrenade.cs +++ b/Projectiles/Ranged/PumplerGrenade.cs @@ -1,10 +1,10 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; -using Terraria.Audio; +using System; using CalamityMod.Particles; -using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { @@ -35,7 +35,7 @@ namespace CalamityMod.Projectiles.Ranged { SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); - int size = NPCHit ? 50 : 70; //Bigger explosion if no npc is hit + int size = NPCHit ? 60 : 90; //Bigger explosion if no npc is hit Projectile.scale = (size / (float)Projectile.height) * Projectile.scale; Projectile.position -= Vector2.One * (size - Projectile.width) * 0.5f; diff --git a/Projectiles/Ranged/PumplerHoldout.cs b/Projectiles/Ranged/PumplerHoldout.cs index 2209c5cc97..93522b1934 100644 --- a/Projectiles/Ranged/PumplerHoldout.cs +++ b/Projectiles/Ranged/PumplerHoldout.cs @@ -1,8 +1,8 @@ -using CalamityMod.Items.Weapons.Ranged; +using System.IO; +using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System.IO; using Terraria; using Terraria.Audio; using Terraria.Graphics.Shaders; @@ -26,7 +26,6 @@ namespace CalamityMod.Projectiles.Ranged private Player Owner => Main.player[Projectile.owner]; - private bool OwnerCanShoot => Owner.channel && !Owner.noItems && !Owner.CCed; private ref float CurrentChargingFrames => ref Projectile.ai[0]; private ref float PumpkinsCharge => ref Projectile.ai[1]; private ref float FramesToLoadNextPumpkin => ref Projectile.localAI[0]; @@ -50,7 +49,7 @@ namespace CalamityMod.Projectiles.Ranged Vector2 tipPosition = armPosition + Projectile.velocity * Projectile.width * 0.5f; // Unloads all pumpkins if you can't shoot/stop holding out the projectile or if the gun is overfilled - if (!OwnerCanShoot || Overfilled == 1f) + if (Owner.CantUseHoldout() || Overfilled == 1f) { if (PumpkinsCharge <= 0f && Overfilled == 0f) //If the projectile isnt playing its animation and if there arent any pumpkins loaded, kill it @@ -216,7 +215,7 @@ namespace CalamityMod.Projectiles.Ranged Main.spriteBatch.EnterShaderRegion(); if (PumpkinsCharge > 0 && Overfilled == 0f) { - GameShaders.Misc["CalamityMod:BasicTint"].UseOpacity(MathHelper.Clamp(1f - 0.20f * CurrentChargingFrames - 0.1f*(5f-PumpkinsCharge) , 0f, 1f)); + GameShaders.Misc["CalamityMod:BasicTint"].UseOpacity(MathHelper.Clamp(1f - 0.20f * CurrentChargingFrames - 0.1f * (5f - PumpkinsCharge), 0f, 1f)); //tint effect is visible if its charging. The more pumpkins are loaded, the more opacity } else @@ -227,8 +226,8 @@ namespace CalamityMod.Projectiles.Ranged GameShaders.Misc["CalamityMod:BasicTint"].Apply(); Vector2 drawPosition = Projectile.Center - Main.screenPosition; - Rectangle frameRectangle = ModContent.Request(Texture).Value.Frame(1, 9, 0, Projectile.frame); - Main.EntitySpriteDraw(ModContent.Request(Texture).Value, drawPosition, frameRectangle, lightColor, Projectile.rotation, frameRectangle.Size() * 0.5f, 1f, Projectile.direction == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); + Rectangle frameRectangle = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Frame(1, 9, 0, Projectile.frame); + Main.EntitySpriteDraw(Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value, drawPosition, frameRectangle, lightColor, Projectile.rotation, frameRectangle.Size() * 0.5f, 1f, Projectile.direction == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); Main.spriteBatch.ExitShaderRegion(); diff --git a/Projectiles/Ranged/RainbowBlast.cs b/Projectiles/Ranged/RainbowBlast.cs index 7891a7d5cf..4fe0111b80 100644 --- a/Projectiles/Ranged/RainbowBlast.cs +++ b/Projectiles/Ranged/RainbowBlast.cs @@ -33,11 +33,11 @@ namespace CalamityMod.Projectiles.Ranged Lighting.AddLight(Projectile.Center, new Vector3(Main.DiscoR, Main.DiscoG, Main.DiscoB) * (1.5f / 255)); - Projectile.localAI[0] ++; + Projectile.localAI[0]++; if (Projectile.localAI[0] > 5f) { Vector2 dspeed = -Projectile.velocity * 0.5f; - int rainbowDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 66, dspeed.X, dspeed.Y, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.1f); + int rainbowDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RainbowTorch, dspeed.X, dspeed.Y, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.1f); Main.dust[rainbowDust].noGravity = true; Main.dust[rainbowDust].velocity = dspeed; } diff --git a/Projectiles/Ranged/RainbowFront.cs b/Projectiles/Ranged/RainbowFront.cs index 66c383c5ff..b8154deb06 100644 --- a/Projectiles/Ranged/RainbowFront.cs +++ b/Projectiles/Ranged/RainbowFront.cs @@ -1,5 +1,5 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged @@ -16,6 +16,8 @@ namespace CalamityMod.Projectiles.Ranged Projectile.alpha = 255; Projectile.ignoreWater = true; Projectile.scale = 1.25f; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() @@ -54,7 +56,7 @@ namespace CalamityMod.Projectiles.Ranged float yVel = y * velocityMult; Projectile.velocity.X = xVel; Projectile.velocity.Y = yVel; - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) - MathHelper.PiOver2; + Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; } public override Color? GetAlpha(Color lightColor) => Color.Transparent; diff --git a/Projectiles/Ranged/RainbowTrail.cs b/Projectiles/Ranged/RainbowTrail.cs index 72ee3099a8..20abe41bb0 100644 --- a/Projectiles/Ranged/RainbowTrail.cs +++ b/Projectiles/Ranged/RainbowTrail.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged @@ -21,6 +21,8 @@ namespace CalamityMod.Projectiles.Ranged Projectile.tileCollide = false; Projectile.ignoreWater = true; Projectile.scale = 1.25f; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override Color? GetAlpha(Color lightColor) => new Color(255 - Projectile.alpha, 255 - Projectile.alpha, 255 - Projectile.alpha, 0); diff --git a/Projectiles/Ranged/RealmRavagerBullet.cs b/Projectiles/Ranged/RealmRavagerBullet.cs index 013026bc09..f0dc66f4ef 100644 --- a/Projectiles/Ranged/RealmRavagerBullet.cs +++ b/Projectiles/Ranged/RealmRavagerBullet.cs @@ -1,8 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -48,10 +48,10 @@ namespace CalamityMod.Projectiles.Ranged } for (int d = 0; d < 20; d++) { - int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 0, default, 2.5f); + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 0, default, 2.5f); Main.dust[idx].noGravity = true; Main.dust[idx].velocity *= 3f; - idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 1.5f); + idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 1.5f); Main.dust[idx].velocity *= 2f; Main.dust[idx].noGravity = true; } diff --git a/Projectiles/Ranged/RicoshotCoin.cs b/Projectiles/Ranged/RicoshotCoin.cs index e5f0e988df..1d62162a82 100644 --- a/Projectiles/Ranged/RicoshotCoin.cs +++ b/Projectiles/Ranged/RicoshotCoin.cs @@ -252,7 +252,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; int numFrames = Main.projFrames[Projectile.type]; Rectangle frame = new Rectangle( /* X */ (int)CoinType * tex.Width / 3, @@ -269,8 +269,8 @@ namespace CalamityMod.Projectiles.Ranged // https://www.desmos.com/calculator/ngfg5fc9ds int numUpdatesPassed = CoinLifetime - Projectile.timeLeft; float x = Math.Clamp((float)numUpdatesPassed / CritDelayTime, 0f, 2f); // interpolant for the crit delay sheen - float sheenFunction = Math.Min(MathF.Pow(x + 0.1f, 6f), MathF.Pow(x - 2.1f, 6f)); - float sheenOpacity = Math.Clamp(sheenFunction, 0f, 1f); + float sheenFunction = Math.Min(MathF.Pow(x + 0.1f, 10f), MathF.Pow(x - 2.1f, 10f)); + float sheenOpacity = Math.Clamp(sheenFunction, 0f, 2f); // oh BOY another end begin boy if (sheenOpacity > 0f) @@ -293,7 +293,7 @@ namespace CalamityMod.Projectiles.Ranged }; Main.EntitySpriteDraw(bloomTex, Projectile.Center - Main.screenPosition, null, shineColor * sheenOpacity * 0.3f, MathHelper.PiOver2, bloomTex.Size() / 2f, shineScale * Projectile.scale, SpriteEffects.None, 0); - Main.EntitySpriteDraw(shineTex, Projectile.Center - Main.screenPosition, null, shineColor * sheenOpacity * 0.7f, MathHelper.PiOver2, shineTex.Size() / 2f, shineScale * Projectile.scale, SpriteEffects.None, 0); + Main.EntitySpriteDraw(shineTex, Projectile.Center - Main.screenPosition, null, shineColor * sheenOpacity, MathHelper.PiOver2, shineTex.Size() / 2f, shineScale * Projectile.scale, SpriteEffects.None, 0); Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); diff --git a/Projectiles/Ranged/RocketFire.cs b/Projectiles/Ranged/RocketFire.cs index 1f420a3b45..47a34a1452 100644 --- a/Projectiles/Ranged/RocketFire.cs +++ b/Projectiles/Ranged/RocketFire.cs @@ -101,7 +101,7 @@ namespace CalamityMod.Projectiles.Ranged //dust if (Main.rand.NextBool(4)) { - int fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 1f); + int fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 1f); Dust dust = Main.dust[fire]; dust.position.X -= 2f; dust.position.Y += 2f; @@ -111,7 +111,7 @@ namespace CalamityMod.Projectiles.Ranged } if (Main.rand.NextBool(10)) { - int fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 1f); + int fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 1f); Dust dust = Main.dust[fire]; dust.position.X -= 2f; dust.position.Y += 2f; diff --git a/Projectiles/Ranged/RubberMortarRoundProj.cs b/Projectiles/Ranged/RubberMortarRoundProj.cs index cf92e098f3..8355606f88 100644 --- a/Projectiles/Ranged/RubberMortarRoundProj.cs +++ b/Projectiles/Ranged/RubberMortarRoundProj.cs @@ -41,7 +41,7 @@ namespace CalamityMod.Projectiles.Ranged xOffset = Projectile.velocity.X * 0.5f; yOffset = Projectile.velocity.Y * 0.5f; } - int fire = Dust.NewDust(new Vector2(Projectile.position.X + 3f + xOffset, Projectile.position.Y + 3f + yOffset) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 6, 0f, 0f, 100, default, 1f); + int fire = Dust.NewDust(new Vector2(Projectile.position.X + 3f + xOffset, Projectile.position.Y + 3f + yOffset) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, DustID.Torch, 0f, 0f, 100, default, 1f); Main.dust[fire].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; Main.dust[fire].velocity *= 0.2f; Main.dust[fire].noGravity = true; @@ -54,7 +54,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } diff --git a/Projectiles/Ranged/SandstormBullet.cs b/Projectiles/Ranged/SandstormBullet.cs index 76664ec6b3..c2763f0659 100644 --- a/Projectiles/Ranged/SandstormBullet.cs +++ b/Projectiles/Ranged/SandstormBullet.cs @@ -1,9 +1,9 @@ +using System; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -34,7 +34,7 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; Projectile.localAI[0] += 1f; if (Projectile.localAI[0] > 4f) { @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.Ranged { Projectile.alpha = 0; } - int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 85, 0f, 0f, 100, default, 1f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.UnusedBrown, 0f, 0f, 100, default, 1f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 0f; } @@ -62,7 +62,7 @@ namespace CalamityMod.Projectiles.Ranged Vector2 rotate = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; rotate = rotate.RotatedBy((double)((float)(i - (constant / 2 - 1)) * 6.28318548f / (float)constant), default) + Projectile.Center; Vector2 faceDirection = rotate - Projectile.Center; - int dusty = Dust.NewDust(rotate + faceDirection, 0, 0, 85, faceDirection.X * 1.5f, faceDirection.Y * 1.5f, 100, default, 1.2f); + int dusty = Dust.NewDust(rotate + faceDirection, 0, 0, DustID.UnusedBrown, faceDirection.X * 1.5f, faceDirection.Y * 1.5f, 100, default, 1.2f); Main.dust[dusty].noGravity = true; Main.dust[dusty].noLight = true; Main.dust[dusty].velocity = faceDirection; diff --git a/Projectiles/Ranged/ScorchedEarthBlast.cs b/Projectiles/Ranged/ScorchedEarthBlast.cs index fa1897f933..7673ef7306 100644 --- a/Projectiles/Ranged/ScorchedEarthBlast.cs +++ b/Projectiles/Ranged/ScorchedEarthBlast.cs @@ -1,5 +1,5 @@ +using System; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Projectiles/Ranged/ScorchedEarthClusterBomb.cs b/Projectiles/Ranged/ScorchedEarthClusterBomb.cs index 66806e35bd..2127a50d88 100644 --- a/Projectiles/Ranged/ScorchedEarthClusterBomb.cs +++ b/Projectiles/Ranged/ScorchedEarthClusterBomb.cs @@ -1,8 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { public class ScorchedEarthClusterBomb : ModProjectile, ILocalizedModType @@ -34,7 +34,7 @@ namespace CalamityMod.Projectiles.Ranged SoundEngine.PlaySound(SoundID.Item14, Projectile.position); for (int i = 0; i < 10; i++) { - Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 0, default, 1f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 0, default, 1f); } int projAmt = Main.rand.Next(2, 4); if (Projectile.owner == Main.myPlayer) diff --git a/Projectiles/Ranged/ScorchedEarthRocket.cs b/Projectiles/Ranged/ScorchedEarthRocket.cs index 2e36ef319b..f3381143da 100644 --- a/Projectiles/Ranged/ScorchedEarthRocket.cs +++ b/Projectiles/Ranged/ScorchedEarthRocket.cs @@ -1,8 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { public class ScorchedEarthRocket : ModProjectile, ILocalizedModType @@ -52,11 +52,11 @@ namespace CalamityMod.Projectiles.Ranged float xVel = Projectile.velocity.X * 0.5f; float yVel = Projectile.velocity.Y * 0.5f; - int d = Dust.NewDust(new Vector2(Projectile.position.X + 3f + xVel, Projectile.position.Y + 3f + yVel) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 244, 0f, 0f, 100, default, 1f); + int d = Dust.NewDust(new Vector2(Projectile.position.X + 3f + xVel, Projectile.position.Y + 3f + yVel) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, DustID.CopperCoin, 0f, 0f, 100, default, 1f); Main.dust[d].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; Main.dust[d].velocity *= 0.2f; Main.dust[d].noGravity = true; - d = Dust.NewDust(new Vector2(Projectile.position.X + 3f + xVel, Projectile.position.Y + 3f + yVel) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 244, 0f, 0f, 100, default, 0.5f); + d = Dust.NewDust(new Vector2(Projectile.position.X + 3f + xVel, Projectile.position.Y + 3f + yVel) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, DustID.CopperCoin, 0f, 0f, 100, default, 0.5f); Main.dust[d].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; Main.dust[d].velocity *= 0.05f; } diff --git a/Projectiles/Ranged/ScorpioHoldout.cs b/Projectiles/Ranged/ScorpioHoldout.cs new file mode 100644 index 0000000000..c18f942a5d --- /dev/null +++ b/Projectiles/Ranged/ScorpioHoldout.cs @@ -0,0 +1,221 @@ +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Particles; +using CalamityMod.Projectiles.BaseProjectiles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using static CalamityMod.Items.Weapons.Ranged.Scorpio; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Projectiles.Ranged +{ + public class ScorpioHoldout : BaseGunHoldoutProjectile + { + public override int AssociatedItemID => ItemType(); + public override Vector2 GunTipPosition => base.GunTipPosition - Vector2.UnitY.RotatedBy(Projectile.rotation) * 10f * Projectile.spriteDirection * Owner.gravDir; + public override float RecoilResolveSpeed => 0.1f; + public override float MaxOffsetLengthFromArm => 15f; + public override float OffsetXUpwards => -12f; + public override float BaseOffsetY => -10f; + public override float OffsetYDownwards => 10f; + + public ref float ShootingTimer => ref Projectile.ai[0]; + public ref float TimerBetweenBursts => ref Projectile.ai[1]; + public ref float ChargeLV => ref Projectile.ai[2]; + + // The type of dust used in the effects and the color of the particles that it'll use depending on the type of rocket used. + // It'll carry over to the projectiles that it shoots. + public static int DustEffectsID { get; set; } + public static Color EffectsColor { get; set; } + public static Color StaticEffectsColor = Color.Turquoise; + + public override void HoldoutAI() + { + // If the player's pressing RMB, it'll shoot the big rocket. + if (Owner.Calamity().mouseRight && ChargeLV >= 3) + { + ShootRocket(HeldItem, true); + ShootingTimer = HeldItem.useAnimation; // If you time your nukes well, you can reset the burst rocket cooldown + ChargeLV = -1; + } + + if (ShootingTimer >= HeldItem.useAnimation) + { + if (ShootingTimer == HeldItem.useAnimation && ChargeLV < 3) + ChargeLV++; + + // Shooting the burst of small rockets. + // The time is adapted to the speed modifier from the reforge. + int adaptedTimeBetweenBursts = TimeBetweenBursts * HeldItem.useAnimation / OriginalUseTime; + + if (ShootingTimer % adaptedTimeBetweenBursts == 0f) + ShootRocket(HeldItem, false); + + // Resets the timers when everything has been shot. + if (ShootingTimer >= HeldItem.useAnimation + adaptedTimeBetweenBursts * (ProjectilesPerBurst - 1)) + { + ShootingTimer = 0f; + TimerBetweenBursts = 0f; + NetUpdate(); + } + } + + ShootingTimer++; + + if (Main.dedServ) + return; + + // Charge level visuals here + if (ChargeLV == 1 && ShootingTimer % 3 == 0) + { + Vector2 position = GunTipPosition - Projectile.velocity * 95; + Vector2 velocity = (-Projectile.velocity * 5).RotatedByRandom(0.3f) * Main.rand.NextFloat(0.6f, 1.4f); + SquishyLightParticle energy = new(position, velocity, Main.rand.NextFloat(0.12f, 0.14f), StaticEffectsColor, Main.rand.Next(3, 5 + 1), 1, 1.5f); + GeneralParticleHandler.SpawnParticle(energy); + Dust dust = Dust.NewDustPerfect(position, DustEffectsID, velocity, 0, default, Main.rand.NextFloat(1.2f, 1.7f)); + dust.noGravity = true; + } + if (ChargeLV == 2 & ShootingTimer % 2 == 0) + { + Vector2 position = GunTipPosition - Projectile.velocity * 95; + Vector2 velocity = (-Projectile.velocity * 5).RotatedByRandom(0.5f) * Main.rand.NextFloat(0.9f, 1.9f); + SquishyLightParticle energy = new(position, velocity, Main.rand.NextFloat(0.18f, 0.22f), StaticEffectsColor, Main.rand.Next(3, 5 + 1), 1, 1.5f); + GeneralParticleHandler.SpawnParticle(energy); + Dust dust = Dust.NewDustPerfect(position, DustEffectsID, velocity, 0, default, Main.rand.NextFloat(1.2f, 1.7f)); + dust.noGravity = true; + } + if (ChargeLV >= 3) + { + Vector2 position = GunTipPosition - Projectile.velocity * 95; + Vector2 velocity = (-Projectile.velocity * 5).RotatedByRandom(0.75f) * Main.rand.NextFloat(1.2f, 2.3f); + SquishyLightParticle energy = new(position, velocity, Main.rand.NextFloat(0.24f, 0.34f), StaticEffectsColor, Main.rand.Next(3, 5 + 1), 1, 1.5f); + GeneralParticleHandler.SpawnParticle(energy); + for (int i = 0; i < 2; i++) + { + Dust dust = Dust.NewDustPerfect(position, DustEffectsID, velocity, 0, default, Main.rand.NextFloat(1.6f, 2.1f)); + dust.noGravity = true; + } + } + if (ChargeLV == 0 && ShootingTimer % 3 == 0) + { + Vector2 position = GunTipPosition - Projectile.velocity * 95; + Vector2 velocity = (-Projectile.velocity * 4).RotatedByRandom(0.5f) * Main.rand.NextFloat(0.9f, 2f); + Particle smoke = new HeavySmokeParticle(position, velocity, Color.SlateGray, Main.rand.Next(40, 60 + 1), Main.rand.NextFloat(0.3f, 0.6f), 0.5f, Main.rand.NextFloat(-0.2f, 0.2f), true, required: true); + GeneralParticleHandler.SpawnParticle(smoke); + + for (int i = 0; i < 2; i++) + { + Dust dust = Dust.NewDustPerfect(position, 303, velocity * 0.5f, 200, default, Main.rand.NextFloat(0.9f, 1.3f)); + dust.noGravity = false; + } + } + } + + public void ShootRocket(Item item, bool isRMB) + { + // We use the velocity of this projectile as its direction vector. + Vector2 projectileVelocity = Projectile.velocity.SafeNormalize(Vector2.Zero); + + // Every time we shoot we use ammo. + // With this method we also use the item's stats, like the shoot speed, or the type of ammo it was used. + Owner.PickAmmo(item, out _, out float projSpeed, out int damage, out float knockback, out int rocketType, Main.rand.Next(100) > 70); // 70% ammo conservation + + // Decides the color of the effects depending on the type of rocket used. + switch (rocketType) + { + case ItemID.WetRocket: + DustEffectsID = 45; + EffectsColor = Color.RoyalBlue; + break; + case ItemID.LavaRocket: + DustEffectsID = DustID.Torch; + EffectsColor = Color.Red; + break; + case ItemID.HoneyRocket: + DustEffectsID = DustID.Honey; + EffectsColor = Color.Yellow; + break; + default: + DustEffectsID = 302; + EffectsColor = Color.Aquamarine; + break; + } + + // Spawns the projectile. + Projectile.NewProjectileDirect( + Projectile.GetSource_FromThis(), + GunTipPosition, + projectileVelocity.RotatedByRandom(isRMB ? 0f : MathHelper.PiOver4) * projSpeed * (isRMB ? 1f : Main.rand.NextFloat(0.8f, 1f)), + isRMB ? ProjectileType() : ProjectileType(), + damage, + knockback, + Projectile.owner, + rocketType, + projSpeed); + + NetUpdate(); + + // Inside here go all the things that dedicated servers shouldn't spend resources on. + // Like visuals and sounds. + if (Main.dedServ) + return; + + SoundStyle RightClickSound = new("CalamityMod/Sounds/Item/RealityRuptureStealth") { Volume = 0.45f }; + if (isRMB) + SoundEngine.PlaySound(RightClickSound with { Pitch = -0.1f }, Projectile.Center); + else + SoundEngine.PlaySound(RocketShoot with { Pitch = ChargeLV * 0.055f }, Projectile.Center); + + // By decreasing the offset length of the gun from the arms, we give an effect of recoil. + OffsetLengthFromArm -= isRMB ? 30f : 5f; + + int dustAmount = Main.rand.Next(10, 15 + 1); + for (int i = 0; i < dustAmount; i++) + { + Dust shootDust = Dust.NewDustPerfect( + GunTipPosition, + DustEffectsID, + projectileVelocity.RotatedByRandom(MathHelper.PiOver2 - MathHelper.ToRadians(15f)) * Main.rand.NextFloat(6f, 10f)); + shootDust.noGravity = true; + shootDust.noLight = true; + shootDust.noLightEmittence = true; + } + + Particle shootPulse = new DirectionalPulseRing( + GunTipPosition, + Vector2.Zero, + Color.Gray * 0.7f, + new Vector2(0.5f, 1f), + Projectile.rotation, + 0.1f, + 0.4f, + 20); + GeneralParticleHandler.SpawnParticle(shootPulse); + } + + public void NetUpdate() + { + Projectile.netUpdate = true; + if (Projectile.netSpam >= 10) + Projectile.netSpam = 9; + } + + public override bool PreDraw(ref Color lightColor) + { + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D glowTexture = Request(GlowTexture).Value; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + Color drawColor = Projectile.GetAlpha(lightColor); + float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f); + Vector2 rotationPoint = texture.Size() * 0.5f; + SpriteEffects flipSprite = (Projectile.spriteDirection * Owner.gravDir == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + + Main.EntitySpriteDraw(texture, drawPosition, null, drawColor, drawRotation, rotationPoint, Projectile.scale * Owner.gravDir, flipSprite); + Main.EntitySpriteDraw(glowTexture, drawPosition, null, Color.White, drawRotation, rotationPoint, Projectile.scale * Owner.gravDir, flipSprite); + + return false; + } + } +} diff --git a/Projectiles/Ranged/ScorpioHoldout_Glow.png b/Projectiles/Ranged/ScorpioHoldout_Glow.png new file mode 100644 index 0000000000..ad4c620482 Binary files /dev/null and b/Projectiles/Ranged/ScorpioHoldout_Glow.png differ diff --git a/Projectiles/Ranged/ScorpioLargeRocket.cs b/Projectiles/Ranged/ScorpioLargeRocket.cs new file mode 100644 index 0000000000..f4382f2726 --- /dev/null +++ b/Projectiles/Ranged/ScorpioLargeRocket.cs @@ -0,0 +1,230 @@ +using CalamityMod.Graphics.Primitives; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; +using static CalamityMod.Items.Weapons.Ranged.Scorpio; +using static CalamityMod.Projectiles.Ranged.ScorpioHoldout; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Projectiles.Ranged +{ + public class ScorpioLargeRocket : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Ranged"; + + public ref float RocketID => ref Projectile.ai[0]; + public ref float ProjectileSpeed => ref Projectile.ai[1]; + + public static int Lifetime = 600; + + public override void SetStaticDefaults() + { + Main.projFrames[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 8; + } + + public override void SetDefaults() + { + Projectile.DamageType = DamageClass.Ranged; + Projectile.MaxUpdates = 3; + Projectile.width = Projectile.height = 15; + Projectile.timeLeft = Lifetime; + Projectile.localNPCHitCooldown = -1; + + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.usesLocalNPCImmunity = true; + } + + public override void AI() + { + NPC target = Projectile.Center.ClosestNPCAt(NukeEnemyDistanceDetection); + if (target is not null) + { + Vector2 targetDirection = Projectile.SafeDirectionTo(target.Center); + + // If the projectile is aligned a certain amount to the direction to the target, it gets small homing. + float trackingSpeed = Vector2.Dot(targetDirection, Projectile.rotation.ToRotationVector2()) > NukeRequiredRotationProximity ? NukeTrackingSpeed : 0f; + + Projectile.velocity = Projectile.velocity.ToRotation().AngleTowards(targetDirection.ToRotation(), trackingSpeed).ToRotationVector2() * ProjectileSpeed; + } + + Projectile.velocity *= 1.032f; + + if (Projectile.wet && RocketID == ItemID.DryRocket && RocketID == ItemID.WetRocket && RocketID == ItemID.LavaRocket && RocketID == ItemID.HoneyRocket) + Projectile.Kill(); + + // Every X frames it changes the projectile to its next animation frame. + Projectile.frameCounter++; + if (Projectile.frameCounter >= 4) + { + // Cycles through the 4 frames of the animation. + Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Type]; + Projectile.frameCounter = 0; + } + + // Rotates towards its velocity. + Projectile.rotation = Projectile.velocity.ToRotation(); + + // Inside here go all the things that dedicated servers shouldn't spend resources on. + // Like visuals and sounds. + if (Main.dedServ) + return; + + // The projectile will fade away as its time alive is ending. + Projectile.alpha = (int)Utils.Remap(Projectile.timeLeft, 30f, 0f, 0f, 255f); + + Dust trailDust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustEffectsID, Scale: Main.rand.NextFloat(0.8f, 1f)); + trailDust.noGravity = true; + trailDust.noLight = true; + trailDust.noLightEmittence = true; + + if (Projectile.timeLeft < Lifetime - 5) + { + SparkParticle spark = new SparkParticle(Projectile.Center - Projectile.velocity * 2f, Projectile.velocity * 0.01f, false, 8, 1.3f, StaticEffectsColor); + GeneralParticleHandler.SpawnParticle(spark); + } + + if (Projectile.timeLeft % 3 == 0) + { + Particle nanoDust = new NanoParticle(Projectile.Center, -Projectile.velocity.RotatedBy(Main.rand.NextFloat(-0.2f, 0.2f)), Main.rand.NextBool(3) ? EffectsColor : StaticEffectsColor, Main.rand.NextFloat(0.65f, 0.9f), Main.rand.Next(15, 20 + 1), Main.rand.NextBool(), true); + GeneralParticleHandler.SpawnParticle(nanoDust); + } + + Particle blastRing = new DirectionalPulseRing( + Projectile.Center + Projectile.velocity * 1.5f, + Vector2.Zero, + StaticEffectsColor * 2, + Vector2.One, + 0f, + 0.25f, + 0.25f, + 2); + GeneralParticleHandler.SpawnParticle(blastRing); + } + + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + modifiers.SourceDamage *= 15f; + if (Projectile.numHits == 1) + Projectile.damage = (int)(Projectile.damage * .89f); // Reduction in damage if the hits are more than one, mostly for Deus + if (Projectile.numHits > 1) + Projectile.damage = (int)(Projectile.damage * 0.92f); // 8% penalty on explosion hits + if (Projectile.damage < 1) + Projectile.damage = 1; + } + public override void ModifyHitPlayer(Player target, ref Player.HurtModifiers modifiers) => modifiers.SourceDamage *= 1.8f; + + public override void OnKill(int timeLeft) + { + var info = new CalamityUtils.RocketBehaviorInfo((int)RocketID) + { + smallRadius = 13, + mediumRadius = 26, + largeRadius = 40 + }; + int blastRadius = Projectile.RocketBehavior(info); + Projectile.ExpandHitboxBy(blastRadius); + Projectile.Damage(); + + // Inside here go all the things that dedicated servers shouldn't spend resources on. + // Like visuals and sounds. + if (Main.dedServ) + return; + + int dustAmount = Main.rand.Next(30, 35 + 1); + for (int i = 0; i < dustAmount; i++) + { + Dust boomDust = Dust.NewDustPerfect(Projectile.Center, DustEffectsID, (MathHelper.TwoPi / dustAmount * i).ToRotationVector2() * Main.rand.NextFloat(4f, 10f), Scale: Main.rand.NextFloat(1.2f, 1.75f)); + boomDust.noGravity = true; + boomDust.noLight = true; + boomDust.noLightEmittence = true; + } + + for (int i = 0; i < 40; i++) + { + float blastVel = Projectile.width / 33f; + Vector2 velocity = new Vector2(blastVel, blastVel).RotatedByRandom(100) * Main.rand.NextFloat(0.3f, 1.7f); + Particle nanoDust = new NanoParticle(Projectile.Center, velocity, Main.rand.NextBool(3) ? EffectsColor : StaticEffectsColor, Main.rand.NextFloat(2f, 3f), 45, Main.rand.NextBool(), true); + GeneralParticleHandler.SpawnParticle(nanoDust); + } + + Particle smallBlastRing = new DirectionalPulseRing( + Projectile.Center, + Vector2.Zero, + StaticEffectsColor, + Vector2.One, + 0f, + Projectile.width / 2180f, + Projectile.width / 312f, + 40); + GeneralParticleHandler.SpawnParticle(smallBlastRing); + + Particle blastRing = new DirectionalPulseRing( + Projectile.Center, + Vector2.Zero, + EffectsColor * 0.6f, + Vector2.One, + 0f, + Projectile.width / 1755f, + Projectile.width / 175f, + 20); + GeneralParticleHandler.SpawnParticle(blastRing); + + Vector2 BurstFXDirection = new Vector2(15, 0); + for (int i = 0; i < 4; i++) + { + SparkParticle spark = new SparkParticle(Projectile.Center, (BurstFXDirection) * (i + 1), false, 11, 5f - i * 0.6f, StaticEffectsColor * 0.8f); + GeneralParticleHandler.SpawnParticle(spark); + } + for (int i = 0; i < 4; i++) + { + SparkParticle spark = new SparkParticle(Projectile.Center, (-BurstFXDirection) * (i + 1), false, 11, 5f - i * 0.6f, StaticEffectsColor * 0.8f); + GeneralParticleHandler.SpawnParticle(spark); + } + + Particle orb = new GenericBloom(Projectile.Center, Vector2.Zero, StaticEffectsColor, 2, 13, false); + GeneralParticleHandler.SpawnParticle(orb); + Particle orb2 = new GenericBloom(Projectile.Center, Vector2.Zero, Color.White, 1.5f, 12, false); + GeneralParticleHandler.SpawnParticle(orb2); + + SoundEngine.PlaySound(RocketHit, Projectile.Center); + SoundEngine.PlaySound(NukeHit, Projectile.Center); + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + if (Projectile.numHits < 1) + Main.player[Projectile.owner].Calamity().GeneralScreenShakePower = 6f; + } + + public float TrailWidthFunction(float completionRatio) => Utils.Remap(completionRatio, 0f, 0.8f, 15f, 0f); + public Color TrailColorFunction(float completionRatio) => Color.Lerp(EffectsColor, EffectsColor * 0.3f, Utils.GetLerpValue(0f, 0.8f, completionRatio)) * Utils.GetLerpValue(255f, 0f, Projectile.alpha); + + public override bool PreDraw(ref Color lightColor) + { + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D glowTexture = Request("CalamityMod/Projectiles/Ranged/ScorpioLargeRocket_Glow").Value; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + Rectangle frame = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); + Color drawColor = Projectile.GetAlpha(lightColor); + float drawRotation = Projectile.rotation + MathHelper.PiOver2; + Vector2 rotationPoint = frame.Size() * 0.5f; + + // 29FEB2024: Ozzatron: hopefully ported this correctly to the new prim system by Toasty + GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(Request("CalamityMod/ExtraTextures/Trails/FabstaffStreak")); + PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(TrailWidthFunction, TrailColorFunction, (_) => Projectile.Size * 0.5f, smoothen: false, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 25); + + Main.EntitySpriteDraw(texture, drawPosition, frame, drawColor, drawRotation, rotationPoint, Projectile.scale, SpriteEffects.None); + Main.EntitySpriteDraw(glowTexture, drawPosition, frame, Color.White, drawRotation, rotationPoint, Projectile.scale, SpriteEffects.None); + + return false; + } + } +} diff --git a/Projectiles/Ranged/BigNuke.png b/Projectiles/Ranged/ScorpioLargeRocket.png similarity index 100% rename from Projectiles/Ranged/BigNuke.png rename to Projectiles/Ranged/ScorpioLargeRocket.png diff --git a/Projectiles/Ranged/ScorpioLargeRocket_Glow.png b/Projectiles/Ranged/ScorpioLargeRocket_Glow.png new file mode 100644 index 0000000000..c2eb703948 Binary files /dev/null and b/Projectiles/Ranged/ScorpioLargeRocket_Glow.png differ diff --git a/Projectiles/Ranged/ScorpioRocket.cs b/Projectiles/Ranged/ScorpioRocket.cs new file mode 100644 index 0000000000..309634c16a --- /dev/null +++ b/Projectiles/Ranged/ScorpioRocket.cs @@ -0,0 +1,182 @@ +using CalamityMod.Graphics.Primitives; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; +using static CalamityMod.Items.Weapons.Ranged.Scorpio; +using static CalamityMod.Projectiles.Ranged.ScorpioHoldout; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Projectiles.Ranged +{ + public class ScorpioRocket : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Ranged"; + + public ref float RocketID => ref Projectile.ai[0]; + public ref float ProjectileSpeed => ref Projectile.ai[1]; + public ref float Time => ref Projectile.ai[2]; + + public static float TimeToLaunch = 15f; + public static float TimeForFullPropulsion = 10f; + + public override void SetStaticDefaults() + { + Main.projFrames[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 8; + } + + public override void SetDefaults() + { + Projectile.DamageType = DamageClass.Ranged; + Projectile.width = Projectile.height = 34; + Projectile.timeLeft = 600; + Projectile.localNPCHitCooldown = -1; + Projectile.friendly = true; + Projectile.usesLocalNPCImmunity = true; + } + + public override void AI() + { + // Don't target the enemy immediately, the rocket will slow down as it's being shot, to give it more flavor. + if (Time >= TimeToLaunch) + { + NPC target = Projectile.Center.ClosestNPCAt(EnemyDetectionDistance); + float projectileSpeed = Utils.Remap(Time, TimeToLaunch, TimeToLaunch + TimeForFullPropulsion, 1f, ProjectileSpeed); + if (target is not null) + { + float targetDirectionRotation = Projectile.SafeDirectionTo(target.Center).ToRotation(); + float turningRate = Utils.Remap(Time, TimeToLaunch, TimeToLaunch + TimeForFullPropulsion, 0.01f, TrackingSpeed); + Projectile.velocity = Projectile.velocity.ToRotation().AngleTowards(targetDirectionRotation, turningRate).ToRotationVector2() * projectileSpeed; + } + else + Projectile.velocity = Projectile.rotation.ToRotationVector2() * projectileSpeed; + + // Inside here go all the things that dedicated servers shouldn't spend resources on. + // Like visuals and sounds. + if (Main.dedServ) + return; + + // The projectile will fade away as its time alive is ending. + Projectile.alpha = (int)Utils.Remap(Projectile.timeLeft, 30f, 0f, 0f, 255f); + + Dust trailDust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustEffectsID, Scale: Main.rand.NextFloat(0.8f, 1f)); + trailDust.noGravity = true; + trailDust.noLight = true; + trailDust.noLightEmittence = true; + } + else + Projectile.velocity *= 0.9f; + + if (Projectile.wet && RocketID == ItemID.DryRocket && RocketID == ItemID.WetRocket && RocketID == ItemID.LavaRocket && RocketID == ItemID.HoneyRocket) + Projectile.Kill(); + + // Rotates towards its velocity. + Projectile.rotation = Projectile.velocity.ToRotation(); + + Projectile.frameCounter++; + if (Projectile.frameCounter >= 4) + { + Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Type]; + Projectile.frameCounter = 0; + } + + Time++; + } + + public override void OnKill(int timeLeft) + { + var info = new CalamityUtils.RocketBehaviorInfo((int)RocketID); + int blastRadius = Projectile.RocketBehavior(info); + Projectile.ExpandHitboxBy((float)blastRadius); + Projectile.Damage(); + + // Inside here go all the things that dedicated servers shouldn't spend resources on. + // Like visuals and sounds. + if (Main.dedServ) + return; + + int dustAmount = Main.rand.Next(25, 30 + 1); + for (int i = 0; i < dustAmount; i++) + { + Dust boomDust = Dust.NewDustPerfect(Projectile.Center, DustEffectsID, (MathHelper.TwoPi / dustAmount * i).ToRotationVector2() * Main.rand.NextFloat(4f, 10f), Scale: Main.rand.NextFloat(1f, 1.45f)); + boomDust.noGravity = true; + boomDust.noLight = true; + boomDust.noLightEmittence = true; + } + + for (int i = 0; i < 7; i++) + { + float blastVel = Projectile.width / 35f; + Vector2 velocity = new Vector2(blastVel, blastVel).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1.5f); + Particle nanoDust = new NanoParticle(Projectile.Center, velocity, Main.rand.NextBool(3) ? EffectsColor : StaticEffectsColor, Main.rand.NextFloat(1f, 1.5f), 40, Main.rand.NextBool(), true); + GeneralParticleHandler.SpawnParticle(nanoDust); + } + + Particle smallBlastRing = new DirectionalPulseRing( + Projectile.Center, + Vector2.Zero, + StaticEffectsColor, + Vector2.One, + 0f, + Projectile.width / 2180f, + Projectile.width / 312f, + 40); + GeneralParticleHandler.SpawnParticle(smallBlastRing); + + Particle blastRing = new DirectionalPulseRing( + Projectile.Center, + Vector2.Zero, + EffectsColor * 0.6f, + Vector2.One, + 0f, + Projectile.width / 1755f, + Projectile.width / 175f, + 20); + GeneralParticleHandler.SpawnParticle(blastRing); + + SoundEngine.PlaySound(RocketHit, Projectile.Center); + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + modifiers.SourceDamage *= 1f; + if (Projectile.numHits > 1) + Projectile.damage = (int)(Projectile.damage * 0.2f); + if (Projectile.damage < 1) + Projectile.damage = 1; + } + + public override bool? CanDamage() => Time >= TimeToLaunch ? null : false; + + public float TrailWidthFunction(float completionRatio) => Utils.Remap(completionRatio, 0f, 0.8f, 6f, 0f); + public Color TrailColorFunction(float completionRatio) => Color.Lerp(EffectsColor, StaticEffectsColor * 0.75f, Utils.GetLerpValue(0f, 0.5f, completionRatio)) * Utils.GetLerpValue(255f, 0f, Projectile.alpha); + + public override bool PreDraw(ref Color lightColor) + { + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D glowTexture = Request("CalamityMod/Projectiles/Ranged/ScorpioRocket_Glow").Value; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + Rectangle frame = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); + Color drawColor = Projectile.GetAlpha(lightColor); + float drawRotation = Projectile.rotation + MathHelper.PiOver2; + Vector2 rotationPoint = frame.Size() * 0.5f; + + if (Time >= TimeToLaunch) + { + // 29FEB2024: Ozzatron: hopefully ported this correctly to the new prim system by Toasty + GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(Request("CalamityMod/ExtraTextures/Trails/FabstaffStreak")); + PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(TrailWidthFunction, TrailColorFunction, (_) => Projectile.Size * 0.5f, smoothen: false, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 25); + } + + Main.EntitySpriteDraw(texture, drawPosition, frame, drawColor, drawRotation, rotationPoint, Projectile.scale, SpriteEffects.None); + Main.EntitySpriteDraw(glowTexture, drawPosition, frame, Color.White, drawRotation, rotationPoint, Projectile.scale, SpriteEffects.None); + + return false; + } + } +} diff --git a/Projectiles/Ranged/MiniRocket.png b/Projectiles/Ranged/ScorpioRocket.png similarity index 100% rename from Projectiles/Ranged/MiniRocket.png rename to Projectiles/Ranged/ScorpioRocket.png diff --git a/Projectiles/Ranged/ScorpioRocket_Glow.png b/Projectiles/Ranged/ScorpioRocket_Glow.png new file mode 100644 index 0000000000..43795c3b9e Binary files /dev/null and b/Projectiles/Ranged/ScorpioRocket_Glow.png differ diff --git a/Projectiles/Ranged/SeaDragonMuzzleBlast.cs b/Projectiles/Ranged/SeaDragonMuzzleBlast.cs index 8166d3a063..245b8e92fe 100644 --- a/Projectiles/Ranged/SeaDragonMuzzleBlast.cs +++ b/Projectiles/Ranged/SeaDragonMuzzleBlast.cs @@ -1,11 +1,11 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; -using Terraria.ID; -using Terraria.DataStructures; -using Terraria.ModLoader; using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged diff --git a/Projectiles/Ranged/SeaDragonRocket.cs b/Projectiles/Ranged/SeaDragonRocket.cs index df62ddf822..ee4feaeb26 100644 --- a/Projectiles/Ranged/SeaDragonRocket.cs +++ b/Projectiles/Ranged/SeaDragonRocket.cs @@ -1,9 +1,9 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { public class SeaDragonRocket : ModProjectile, ILocalizedModType @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Ranged { for (int i = 0; i < 5; i++) { - int fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 2f); + int fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 2f); Main.dust[fire].velocity *= 3f; if (Main.rand.NextBool()) { @@ -62,11 +62,11 @@ namespace CalamityMod.Projectiles.Ranged halfX = Projectile.velocity.X * 0.5f; halfY = Projectile.velocity.Y * 0.5f; } - int explosion = Dust.NewDust(new Vector2(Projectile.position.X + 3f + halfX, Projectile.position.Y + 3f + halfY) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 6, 0f, 0f, 100, default, 1f); + int explosion = Dust.NewDust(new Vector2(Projectile.position.X + 3f + halfX, Projectile.position.Y + 3f + halfY) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, DustID.Torch, 0f, 0f, 100, default, 1f); Main.dust[explosion].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; Main.dust[explosion].velocity *= 0.2f; Main.dust[explosion].noGravity = true; - explosion = Dust.NewDust(new Vector2(Projectile.position.X + 3f + halfX, Projectile.position.Y + 3f + halfY) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 33, 0f, 0f, 100, default, 0.5f); + explosion = Dust.NewDust(new Vector2(Projectile.position.X + 3f + halfX, Projectile.position.Y + 3f + halfY) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, DustID.Water, 0f, 0f, 100, default, 0.5f); Main.dust[explosion].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; Main.dust[explosion].velocity *= 0.05f; } @@ -86,7 +86,7 @@ namespace CalamityMod.Projectiles.Ranged SoundEngine.PlaySound(SoundID.Item110, Projectile.position); for (int i = 0; i < 15; i++) { - int smoke = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 2f); + int smoke = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Water, 0f, 0f, 100, default, 2f); Main.dust[smoke].velocity *= 3f; if (Main.rand.NextBool()) { @@ -96,10 +96,10 @@ namespace CalamityMod.Projectiles.Ranged } for (int j = 0; j < 25; j++) { - int fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 3f); + int fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 3f); Main.dust[fire].noGravity = true; Main.dust[fire].velocity *= 5f; - fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 2f); + fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 2f); Main.dust[fire].velocity *= 2f; } int projAmt = Main.rand.Next(2, 4); diff --git a/Projectiles/Ranged/SeasSearingBubble.cs b/Projectiles/Ranged/SeasSearingBubble.cs index b70e45ecf5..a9a0fa85c7 100644 --- a/Projectiles/Ranged/SeasSearingBubble.cs +++ b/Projectiles/Ranged/SeasSearingBubble.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.Ranged float dustVelX = Projectile.velocity.X / 3f * (float)i; float dustVelY = Projectile.velocity.Y / 3f * (float)i; int four = 4; - int dustID = Dust.NewDust(new Vector2(Projectile.position.X + (float)four, Projectile.position.Y + (float)four), Projectile.width - four * 2, Projectile.height - four * 2, 202, 0f, 0f, 150, new Color(60, Main.DiscoG, 190), 1.2f); + int dustID = Dust.NewDust(new Vector2(Projectile.position.X + (float)four, Projectile.position.Y + (float)four), Projectile.width - four * 2, Projectile.height - four * 2, DustID.GlowingSnail, 0f, 0f, 150, new Color(60, Main.DiscoG, 190), 1.2f); Dust dust = Main.dust[dustID]; dust.noGravity = true; dust.velocity *= 0.1f; @@ -54,7 +54,7 @@ namespace CalamityMod.Projectiles.Ranged if (Main.rand.NextBool(10)) { int otherFour = 4; - int otherDust = Dust.NewDust(new Vector2(Projectile.position.X + (float)otherFour, Projectile.position.Y + (float)otherFour), Projectile.width - otherFour * 2, Projectile.height - otherFour * 2, 202, 0f, 0f, 150, new Color(60, Main.DiscoG, 190), 0.6f); + int otherDust = Dust.NewDust(new Vector2(Projectile.position.X + (float)otherFour, Projectile.position.Y + (float)otherFour), Projectile.width - otherFour * 2, Projectile.height - otherFour * 2, DustID.GlowingSnail, 0f, 0f, 150, new Color(60, Main.DiscoG, 190), 0.6f); Main.dust[otherDust].velocity *= 0.25f; Main.dust[otherDust].velocity += Projectile.velocity * 0.5f; } @@ -77,7 +77,7 @@ namespace CalamityMod.Projectiles.Ranged SoundEngine.PlaySound(SoundID.Item96, Projectile.position); for (int k = 0; k < 5; k++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 202, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f, 0, new Color(60, Main.DiscoG, 190)); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.GlowingSnail, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f, 0, new Color(60, Main.DiscoG, 190)); } } diff --git a/Projectiles/Ranged/SeasSearingSecondary.cs b/Projectiles/Ranged/SeasSearingSecondary.cs index dfe4fc6006..2ef11249e6 100644 --- a/Projectiles/Ranged/SeasSearingSecondary.cs +++ b/Projectiles/Ranged/SeasSearingSecondary.cs @@ -1,5 +1,5 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -28,16 +28,16 @@ namespace CalamityMod.Projectiles.Ranged Projectile.width = (int)(16f * Projectile.scale); Projectile.height = (int)(32f * Projectile.scale); } - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; Projectile.localAI[0] += 1f; if (Projectile.localAI[0] > 4f) { for (int i = 0; i < 3; i++) { - int aquaDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 217, 0f, 0f, 100, new Color(60, Main.DiscoG, 190), Projectile.scale); + int aquaDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.FishronWings, 0f, 0f, 100, new Color(60, Main.DiscoG, 190), Projectile.scale); Main.dust[aquaDust].noGravity = true; Main.dust[aquaDust].velocity *= 0f; - int waterDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 202, 0f, 0f, 100, new Color(60, Main.DiscoG, 190), Projectile.scale); + int waterDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GlowingSnail, 0f, 0f, 100, new Color(60, Main.DiscoG, 190), Projectile.scale); Main.dust[waterDust].noGravity = true; Main.dust[waterDust].velocity *= 0f; } diff --git a/Projectiles/Ranged/SeasSearingSpout.cs b/Projectiles/Ranged/SeasSearingSpout.cs index 8e2d8310d5..1a0f8a08e4 100644 --- a/Projectiles/Ranged/SeasSearingSpout.cs +++ b/Projectiles/Ranged/SeasSearingSpout.cs @@ -1,6 +1,6 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -101,7 +101,7 @@ namespace CalamityMod.Projectiles.Ranged } if (Projectile.ai[0] <= 0f) { - float swaySize = 0.104719758f; + float swaySize = MathHelper.Pi / 30f; float smolWidth = (float)Projectile.width / 5f; float projXChange = (float)(Math.Cos((double)(swaySize * -(double)Projectile.ai[0])) - 0.5) * smolWidth; Projectile.position.X = Projectile.position.X - projXChange * (float)-(float)Projectile.direction; @@ -118,8 +118,8 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - Texture2D texture2D13 = ModContent.Request(Texture).Value; - int framing = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; + Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + int framing = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; int y6 = framing * Projectile.frame; Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)framing / 2f), Projectile.scale, SpriteEffects.None, 0); return false; diff --git a/Projectiles/Ranged/SepticSkewerBacteria.cs b/Projectiles/Ranged/SepticSkewerBacteria.cs index 4986e8367c..b6e487b778 100644 --- a/Projectiles/Ranged/SepticSkewerBacteria.cs +++ b/Projectiles/Ranged/SepticSkewerBacteria.cs @@ -27,11 +27,11 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { int dustType = 171; - if (Main.rand.Next(3) == 0) + if (Main.rand.NextBool(3)) { dustType = 46; } - int toxicDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); + int toxicDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); Main.dust[toxicDust].noGravity = true; float scaleAlpha = 1f - (float)Projectile.alpha / 255f; scaleAlpha *= Projectile.scale; @@ -169,7 +169,7 @@ namespace CalamityMod.Projectiles.Ranged Vector2 rotate = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; rotate = rotate.RotatedBy((double)((float)(i - (constant / 2 - 1)) * 6.28318548f / (float)constant), default) + Projectile.Center; Vector2 faceDirection = rotate - Projectile.Center; - int dust = Dust.NewDust(rotate + faceDirection, 0, 0, 171, faceDirection.X, faceDirection.Y, 100, default, 0.5f); + int dust = Dust.NewDust(rotate + faceDirection, 0, 0, DustID.Venom, faceDirection.X, faceDirection.Y, 100, default, 0.5f); Main.dust[dust].noGravity = true; Main.dust[dust].noLight = true; Main.dust[dust].velocity = faceDirection; diff --git a/Projectiles/Ranged/SepticSkewerHarpoon.cs b/Projectiles/Ranged/SepticSkewerHarpoon.cs index 26a209a962..5e4628a6e4 100644 --- a/Projectiles/Ranged/SepticSkewerHarpoon.cs +++ b/Projectiles/Ranged/SepticSkewerHarpoon.cs @@ -2,6 +2,7 @@ using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged @@ -30,7 +31,7 @@ namespace CalamityMod.Projectiles.Ranged Player player = Main.player[Projectile.owner]; if (Main.rand.NextBool(5)) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 171, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Venom, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } Vector2 playerDist = player.Center - Projectile.Center; Projectile.ai[1] += 1f; @@ -70,7 +71,7 @@ namespace CalamityMod.Projectiles.Ranged { Projectile.extraUpdates = 3; } - Vector2 halfDist = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); + Vector2 halfDist = Projectile.Center; float xDist = player.position.X + (float)(player.width / 2) - halfDist.X; float yDist = player.position.Y + (float)(player.height / 2) - halfDist.Y; float playerDistance = (float)Math.Sqrt((double)(xDist * xDist + yDist * yDist)); @@ -80,7 +81,7 @@ namespace CalamityMod.Projectiles.Ranged { Projectile.ai[0] = 1f; } - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; Projectile.ai[1] += 1f; if (Projectile.ai[1] > 5f) { @@ -99,7 +100,7 @@ namespace CalamityMod.Projectiles.Ranged else if (Projectile.ai[0] == 1f) { Projectile.tileCollide = false; - Projectile.rotation = (float)Math.Atan2((double)yDist, (double)xDist) - 1.57f; + Projectile.rotation = (float)Math.Atan2((double)yDist, (double)xDist) - MathHelper.PiOver2; float returnSpeed = 20f; if (playerDistance < 50f) { diff --git a/Projectiles/Ranged/SevensStrikerBrick.cs b/Projectiles/Ranged/SevensStrikerBrick.cs index bdd61e84c8..404bd7a937 100644 --- a/Projectiles/Ranged/SevensStrikerBrick.cs +++ b/Projectiles/Ranged/SevensStrikerBrick.cs @@ -1,7 +1,7 @@ using Terraria; -using Terraria.ModLoader; -using Terraria.ID; using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { @@ -31,7 +31,7 @@ namespace CalamityMod.Projectiles.Ranged //Dust trail if (Main.rand.NextBool(13)) { - Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 22, Projectile.velocity.X * 0.25f, Projectile.velocity.Y * 0.25f, 150, default, 0.9f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Pot, Projectile.velocity.X * 0.25f, Projectile.velocity.Y * 0.25f, 150, default, 0.9f); } } @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Ranged int dust_splash = 0; while (dust_splash < 9) { - Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 9, -Projectile.velocity.X * 0.15f, -Projectile.velocity.Y * 0.15f, 120, default, 1.5f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Copper, -Projectile.velocity.X * 0.15f, -Projectile.velocity.Y * 0.15f, 120, default, 1.5f); dust_splash += 1; } } diff --git a/Projectiles/Ranged/SevensStrikerCherry.cs b/Projectiles/Ranged/SevensStrikerCherry.cs index ca6218d69f..5bc834bd1d 100644 --- a/Projectiles/Ranged/SevensStrikerCherry.cs +++ b/Projectiles/Ranged/SevensStrikerCherry.cs @@ -1,9 +1,9 @@ using CalamityMod.Items.Weapons.Ranged; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { diff --git a/Projectiles/Ranged/SevensStrikerHoldout.cs b/Projectiles/Ranged/SevensStrikerHoldout.cs index 5996cb2eb8..47b6b88a0f 100644 --- a/Projectiles/Ranged/SevensStrikerHoldout.cs +++ b/Projectiles/Ranged/SevensStrikerHoldout.cs @@ -1,9 +1,9 @@ -using CalamityMod.Items.Weapons.Ranged; +using System; +using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Sounds; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Utilities; -using System; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -44,7 +44,7 @@ namespace CalamityMod.Projectiles.Ranged { Player player = Main.player[Projectile.owner]; Vector2 playerpos = player.RotatedRelativePoint(player.MountedCenter, true); - bool shouldBeHeld = player.channel && !player.noItems && !player.CCed; + bool shouldBeHeld = !player.CantUseHoldout(); int shot; float scaleFactor = 14f; @@ -223,7 +223,7 @@ namespace CalamityMod.Projectiles.Ranged } // Holdout stuff - Projectile.position = (player.RotatedRelativePoint(player.MountedCenter, true) - Projectile.Size / 2f ) + Projectile.velocity * 95; + Projectile.position = (player.RotatedRelativePoint(player.MountedCenter, true) - Projectile.Size / 2f) + Projectile.velocity * 95; Projectile.rotation = Projectile.velocity.ToRotation(); Projectile.spriteDirection = Projectile.direction; Projectile.timeLeft = 2; diff --git a/Projectiles/Ranged/ShadeFire.cs b/Projectiles/Ranged/ShadeFire.cs index 027b90d925..0bb282dd6b 100644 --- a/Projectiles/Ranged/ShadeFire.cs +++ b/Projectiles/Ranged/ShadeFire.cs @@ -1,7 +1,7 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Particles; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -22,11 +22,11 @@ namespace CalamityMod.Projectiles.Ranged Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.DamageType = DamageClass.Ranged; - Projectile.penetrate = -1; + Projectile.penetrate = 3; Projectile.MaxUpdates = 3; Projectile.timeLeft = Lifetime; // 20 effectively Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 10; + Projectile.idStaticNPCHitCooldown = 15; } public override void AI() @@ -57,6 +57,6 @@ namespace CalamityMod.Projectiles.Ranged // Circular hitbox adjusted for the size of the smoke particles (which is 52 here) public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 52 * Projectile.scale * 0.5f, targetHitbox); - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 300); + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 240); } } diff --git a/Projectiles/Ranged/Shell.cs b/Projectiles/Ranged/Shell.cs index bafa88139a..df5f7620f1 100644 --- a/Projectiles/Ranged/Shell.cs +++ b/Projectiles/Ranged/Shell.cs @@ -1,8 +1,8 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { public class Shell : ModProjectile, ILocalizedModType @@ -20,6 +20,8 @@ namespace CalamityMod.Projectiles.Ranged Projectile.arrow = true; Projectile.timeLeft = 600; Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() @@ -38,7 +40,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int i = 0; i < 10; i++) { - int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 14, Projectile.oldVelocity.X / 4, Projectile.oldVelocity.Y / 4, 0, new Color(0, 255, 255), 1.5f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Demonite, Projectile.oldVelocity.X / 4, Projectile.oldVelocity.Y / 4, 0, new Color(0, 255, 255), 1.5f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 3f; } diff --git a/Projectiles/Ranged/Shockblast.cs b/Projectiles/Ranged/Shockblast.cs index 1650910281..4abaaa0f57 100644 --- a/Projectiles/Ranged/Shockblast.cs +++ b/Projectiles/Ranged/Shockblast.cs @@ -1,7 +1,9 @@ +using System; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Ranged { public class Shockblast : ModProjectile, ILocalizedModType @@ -49,7 +51,7 @@ namespace CalamityMod.Projectiles.Ranged randAdjust = rand3 / randAdjust; rand1 *= randAdjust; rand2 *= randAdjust; - int shockDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 185); + int shockDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.FrostHydra); Dust dust = Main.dust[shockDust]; dust.scale = sizeMultiplier; dust.noGravity = true; diff --git a/Projectiles/Ranged/ShockblastRound.cs b/Projectiles/Ranged/ShockblastRound.cs index 53c778ac36..fab6292353 100644 --- a/Projectiles/Ranged/ShockblastRound.cs +++ b/Projectiles/Ranged/ShockblastRound.cs @@ -1,4 +1,6 @@ -using CalamityMod.Projectiles.Healing; +using System; +using CalamityMod.Balancing; +using CalamityMod.Projectiles.Healing; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -60,7 +62,7 @@ namespace CalamityMod.Projectiles.Ranged Vector2 dspeed = -Projectile.velocity * Main.rand.NextFloat(0.5f, 0.7f); float x2 = Projectile.Center.X - Projectile.velocity.X / 10f * i; float y2 = Projectile.Center.Y - Projectile.velocity.Y / 10f * i; - int dust = Dust.NewDust(new Vector2(x2, y2), 1, 1, 185, 0f, 0f, 0, default, 1f); + int dust = Dust.NewDust(new Vector2(x2, y2), 1, 1, DustID.FrostHydra, 0f, 0f, 0, default, 1f); Main.dust[dust].alpha = Projectile.alpha; Main.dust[dust].position.X = x2; Main.dust[dust].position.Y = y2; @@ -80,20 +82,14 @@ namespace CalamityMod.Projectiles.Ranged Main.projectile[proj].scale = (Projectile.ai[1] * 0.5f) + 1f; } - if (Main.player[Projectile.owner].moonLeech) + int heal = (int)Math.Round(hit.Damage * 0.05); + if (heal > BalancingConstants.LifeStealCap) + heal = BalancingConstants.LifeStealCap; + + if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) return; - float healAmt = hit.Damage * 0.05f; - if ((int)healAmt == 0) - return; - - if (Main.player[Main.myPlayer].lifeSteal <= 0f) - return; - - if (healAmt > CalamityMod.lifeStealCap) - healAmt = CalamityMod.lifeStealCap; - - CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], healAmt, ModContent.ProjectileType(), 1200f, 3f); + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ModContent.ProjectileType(), BalancingConstants.LifeStealRange); } } } diff --git a/Projectiles/Ranged/Sickness.cs b/Projectiles/Ranged/Sickness.cs index a0ef406d36..9507691805 100644 --- a/Projectiles/Ranged/Sickness.cs +++ b/Projectiles/Ranged/Sickness.cs @@ -2,6 +2,7 @@ using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged @@ -72,7 +73,7 @@ namespace CalamityMod.Projectiles.Ranged randAdjust = rand3 / randAdjust; rand1 *= randAdjust; rand2 *= randAdjust; - int dustID = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, default, 0.5f); + int dustID = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.TerraBlade, 0f, 0f, 100, default, 0.5f); Dust dust = Main.dust[dustID]; dust.noGravity = true; dust.position.X = Projectile.Center.X; diff --git a/Projectiles/Ranged/SicknessRound.cs b/Projectiles/Ranged/SicknessRound.cs index db2e6c3e55..0140d85c0a 100644 --- a/Projectiles/Ranged/SicknessRound.cs +++ b/Projectiles/Ranged/SicknessRound.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.Ranged Vector2 dspeed = -Projectile.velocity * 0.5f; float x2 = Projectile.Center.X - Projectile.velocity.X / 10f; float y2 = Projectile.Center.Y - Projectile.velocity.Y / 10f; - int dust = Dust.NewDust(new Vector2(x2, y2), 1, 1, 107, dspeed.X, dspeed.Y, 0, default, 1f); + int dust = Dust.NewDust(new Vector2(x2, y2), 1, 1, DustID.TerraBlade, dspeed.X, dspeed.Y, 0, default, 1f); Main.dust[dust].alpha = Projectile.alpha; Main.dust[dust].position.X = x2; Main.dust[dust].position.Y = y2; @@ -70,9 +70,9 @@ namespace CalamityMod.Projectiles.Ranged Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); for (int k = 0; k < 3; k++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 107, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.TerraBlade, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, Main.rand.Next(-35, 36) * 0.2f, Main.rand.Next(-35, 36) * 0.2f, ModContent.ProjectileType(), - (int)(Projectile.damage * 0.5), Projectile.knockBack * 0.5f, Main.myPlayer); + (int)(Projectile.damage * 0.66), Projectile.knockBack * 0.5f, Main.myPlayer); } } } diff --git a/Projectiles/Ranged/SicknessRound2.cs b/Projectiles/Ranged/SicknessRound2.cs index a37f5e7ca3..a9334a32eb 100644 --- a/Projectiles/Ranged/SicknessRound2.cs +++ b/Projectiles/Ranged/SicknessRound2.cs @@ -23,6 +23,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.DamageType = DamageClass.Ranged; Projectile.penetrate = 1; Projectile.timeLeft = 180; + Projectile.tileCollide = false; Projectile.light = 0.15f; Projectile.extraUpdates = 1; AIType = ProjectileID.WoodenArrowFriendly; @@ -41,7 +42,7 @@ namespace CalamityMod.Projectiles.Ranged Vector2 dspeed = -Projectile.velocity * 0.5f; float x2 = Projectile.Center.X - Projectile.velocity.X / 10f; float y2 = Projectile.Center.Y - Projectile.velocity.Y / 10f; - int dust = Dust.NewDust(new Vector2(x2, y2), 1, 1, 107, 0f, 0f, 0, default, 1f); + int dust = Dust.NewDust(new Vector2(x2, y2), 1, 1, DustID.TerraBlade, 0f, 0f, 0, default, 1f); Main.dust[dust].alpha = Projectile.alpha; Main.dust[dust].position.X = x2; Main.dust[dust].position.Y = y2; @@ -62,11 +63,5 @@ namespace CalamityMod.Projectiles.Ranged { target.AddBuff(ModContent.BuffType(), 120); } - - public override void OnKill(int timeLeft) - { - if (Projectile.owner == Main.myPlayer) - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); - } } } diff --git a/Projectiles/Ranged/SlagRound.cs b/Projectiles/Ranged/SlagRound.cs index 692159f391..919494bf8b 100644 --- a/Projectiles/Ranged/SlagRound.cs +++ b/Projectiles/Ranged/SlagRound.cs @@ -1,6 +1,6 @@ -using CalamityMod.Buffs.StatDebuffs; +using System; +using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -35,7 +35,7 @@ namespace CalamityMod.Projectiles.Ranged if (Projectile.localAI[0] > 4f) { Vector2 dspeed = -Projectile.velocity * 0.7f; - int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 32, 0f, 0f, 100, default, 1f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Sand, 0f, 0f, 100, default, 1f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity = dspeed; } @@ -56,7 +56,7 @@ namespace CalamityMod.Projectiles.Ranged { for (int k = 0; k < 5; k++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 32, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Sand, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } float spread = 180f * 0.0174f; double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2; diff --git a/Projectiles/Ranged/SlimeBolt.cs b/Projectiles/Ranged/SlimeBolt.cs index 6066a4ac7a..efe0d6612b 100644 --- a/Projectiles/Ranged/SlimeBolt.cs +++ b/Projectiles/Ranged/SlimeBolt.cs @@ -1,4 +1,6 @@ -using CalamityMod.Particles; +using System; +using System.Collections.Generic; +using CalamityMod.Particles; using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -16,7 +18,8 @@ namespace CalamityMod.Projectiles.Ranged public static int Lifetime => 270; public static float Fadetime => 225f; public static float EmpowerTime => 135f; - public static Color SlimeColor => new Color (133, 133, 224); + public static float DamageFalloff => 0.85f; + public static Color SlimeColor => new Color(133, 133, 224); public ref float Time => ref Projectile.ai[0]; public bool Empowered => Projectile.ai[0] >= EmpowerTime; @@ -47,7 +50,7 @@ namespace CalamityMod.Projectiles.Ranged if (Time == EmpowerTime) { Projectile.penetrate = 1; - Projectile.damage = (int)(Projectile.damage * 1.75f); // 7/4 + Projectile.damage = (int)((Projectile.damage / Math.Pow(DamageFalloff, Projectile.numHits)) * 1.6f); // 7/4 Projectile.velocity *= 0f; Projectile.rotation = Main.rand.NextFloat(0f, MathHelper.TwoPi); @@ -89,11 +92,11 @@ namespace CalamityMod.Projectiles.Ranged { if (Projectile.velocity.X != oldVelocity.X) { - Projectile.velocity.X = -oldVelocity.X * (Bounced ? 1f : Utils.Remap(Time, 0f, EmpowerTime, 1.5f, 4f)); + Projectile.velocity.X = -oldVelocity.X * (Bounced ? (1f / Projectile.ai[2]) : Utils.Remap(Time, 0f, EmpowerTime, 1.5f, 3f)); } if (Projectile.velocity.Y != oldVelocity.Y) { - Projectile.velocity.Y = -oldVelocity.Y * (Bounced ? 1f : Utils.Remap(Time, 0f, EmpowerTime, 1.5f, 4f)); + Projectile.velocity.Y = -oldVelocity.Y * (Bounced ? (1f / Projectile.ai[2]) : Utils.Remap(Time, 0f, EmpowerTime, 1.5f, 3f)); } Projectile.ai[2]++; return false; @@ -128,11 +131,19 @@ namespace CalamityMod.Projectiles.Ranged } } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + if (Projectile.numHits > 0 && !Empowered) + Projectile.damage = (int)(Projectile.damage * DamageFalloff); + if (Projectile.damage < 1) + Projectile.damage = 1; + } + public override bool PreDraw(ref Color lightColor) { Main.spriteBatch.SetBlendState(BlendState.Additive); - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Vector2 drawPosition = Projectile.Center - Main.screenPosition; Main.EntitySpriteDraw(texture, drawPosition, null, SlimeColor, Projectile.rotation, texture.Size() * 0.5f, Projectile.scale, SpriteEffects.None, 0); diff --git a/Projectiles/Ranged/SmallCoral.cs b/Projectiles/Ranged/SmallCoral.cs index 9d41b75d69..40f6c0292c 100644 --- a/Projectiles/Ranged/SmallCoral.cs +++ b/Projectiles/Ranged/SmallCoral.cs @@ -1,8 +1,8 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { public class SmallCoral : ModProjectile, ILocalizedModType @@ -39,7 +39,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int i = 0; i < 5; i++) { - int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 51, Projectile.oldVelocity.X / 4, Projectile.oldVelocity.Y / 4, 0, new Color(234, 183, 100), 1f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.SnowBlock, Projectile.oldVelocity.X / 4, Projectile.oldVelocity.Y / 4, 0, new Color(234, 183, 100), 1f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 2f; } diff --git a/Projectiles/Ranged/SpeedBlasterShot.cs b/Projectiles/Ranged/SpeedBlasterShot.cs index 92f322dfa0..d5258593dc 100644 --- a/Projectiles/Ranged/SpeedBlasterShot.cs +++ b/Projectiles/Ranged/SpeedBlasterShot.cs @@ -1,8 +1,8 @@ -using CalamityMod.Graphics.Metaballs; +using System.Linq; +using CalamityMod.Graphics.Metaballs; using CalamityMod.Graphics.Primitives; using CalamityMod.Particles; using Microsoft.Xna.Framework; -using System.Linq; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -16,6 +16,8 @@ namespace CalamityMod.Projectiles.Ranged public bool DashShot => Projectile.ai[1] == 3f; // the big shot public bool PostDashShot => Projectile.ai[1] == 2f; // the higher velocity post dash shots + public Color MainColor; + public bool PostHit = false; public static readonly SoundStyle ShotImpact = new("CalamityMod/Sounds/Item/SplatshotImpact") { PitchVariance = 0.3f, Volume = 2.5f }; public static readonly SoundStyle ShotImpactBig = new("CalamityMod/Sounds/Item/SplatshotBigImpact") { PitchVariance = 0.3f, Volume = 4f }; @@ -30,25 +32,52 @@ namespace CalamityMod.Projectiles.Ranged { Projectile.width = Projectile.height = 14; Projectile.friendly = true; - Projectile.penetrate = 1; + Projectile.penetrate = -1; Projectile.MaxUpdates = 2; Projectile.timeLeft = 150 * Projectile.MaxUpdates; Projectile.DamageType = DamageClass.Ranged; Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; } public override void AI() { + if (PostHit) + { + Projectile.velocity = Projectile.velocity * 0.01f; + Projectile.scale *= 0.95f; + Projectile.tileCollide = false; + } + switch (Projectile.ai[0]) + { + case 0: + default: + MainColor = Color.Cyan; + break; + case 1: + MainColor = Color.Blue; + break; + case 2: + MainColor = Color.Magenta; + break; + case 3: + MainColor = Color.Lime; + break; + case 4: + MainColor = Color.Yellow; + break; + } + if (Projectile.ai[2] != 1f) { if (DashShot) { Projectile.scale = 2f; Projectile.penetrate = 4; - Projectile.MaxUpdates = 30; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = -1; - Projectile.timeLeft = 60 * Projectile.MaxUpdates; + Projectile.extraUpdates = 90; + Projectile.timeLeft = 120 * Projectile.extraUpdates; + Projectile.velocity *= 0.3f; } else if (PostDashShot) Projectile.MaxUpdates = 3; @@ -57,11 +86,14 @@ namespace CalamityMod.Projectiles.Ranged } Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - Projectile.velocity *= (DashShot ? 1f : PostDashShot ? 0.985f : 0.97f); - Projectile.velocity.Y += (DashShot ? 0f : PostDashShot ? 0.15f : 0.25f); + if (!PostHit) + { + Projectile.velocity *= (DashShot ? 1f : PostDashShot ? 0.985f : 0.97f); + Projectile.velocity.Y += (DashShot ? 0f : PostDashShot ? 0.15f : 0.25f); + } Color ColorUsed = GetColor(Projectile.ai[0]); - if (Main.rand.NextBool(20) && !DashShot) + if (Main.rand.NextBool(20) && !DashShot && !PostHit) { Dust dust = Dust.NewDustPerfect(Projectile.Center, 192); dust.noLight = true; @@ -73,24 +105,26 @@ namespace CalamityMod.Projectiles.Ranged } if (DashShot) { - Dust dust2 = Dust.NewDustPerfect(Projectile.Center + new Vector2(Main.rand.Next(-5, 5), Main.rand.Next(-5, 5)), 279); - dust2.noLightEmittence = true; - dust2.noGravity = true; - dust2.scale = Main.rand.NextFloat(2.5f, 3.8f); - dust2.velocity = Vector2.Zero; - dust2.color = ColorUsed; - dust2.alpha = 15; - - for (int i = 0; i <= 2; i++) + Player Owner = Main.player[Projectile.owner]; + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); + if (targetDist < 1400f) { - Dust dust = Dust.NewDustPerfect(Projectile.Center, 192); - dust.noLight = true; - dust.noGravity = false; - dust.scale = Main.rand.NextFloat(1.3f, 1.5f); - dust.velocity = new Vector2(Main.rand.Next(-1, 1), Main.rand.Next(0, 8)).RotatedByRandom(MathHelper.ToRadians(10f)) * Main.rand.NextFloat(0.05f, 0.3f); - dust.color = ColorUsed; - dust.alpha = Main.rand.Next(145, 240); + GlowOrbParticle spark = new GlowOrbParticle(Projectile.Center, -Projectile.velocity * Main.rand.NextFloat(-0.01f, 0.01f), false, 15, 1.35f, MainColor, true, false, false); + GeneralParticleHandler.SpawnParticle(spark); } + if (targetDist < 1400f && Main.rand.NextBool()) + { + GlowOrbParticle spark = new GlowOrbParticle(Projectile.Center + Projectile.velocity * Main.rand.NextFloat(-2f, 2f), -Projectile.velocity * Main.rand.NextFloat(-0.01f, 0.01f), false, 15, 1.35f, MainColor, true, false, false); + GeneralParticleHandler.SpawnParticle(spark); + } + + Dust dust = Dust.NewDustPerfect(Projectile.Center, 192); + dust.noLight = true; + dust.noGravity = false; + dust.scale = Main.rand.NextFloat(1.3f, 1.5f); + dust.velocity = new Vector2(Main.rand.Next(-1, 1), Main.rand.Next(0, 8)).RotatedByRandom(MathHelper.ToRadians(10f)) * Main.rand.NextFloat(0.05f, 0.3f); + dust.color = ColorUsed; + dust.alpha = Main.rand.Next(145, 240); } if (Projectile.timeLeft == 300 && DashShot) { @@ -118,6 +152,7 @@ namespace CalamityMod.Projectiles.Ranged } } + public override bool? CanHitNPC(NPC target) => !PostHit ? null : false; public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { Color ColorUsed = GetColor(Projectile.ai[0]); @@ -126,31 +161,43 @@ namespace CalamityMod.Projectiles.Ranged if (Projectile.numHits == 0) SoundEngine.PlaySound(ShotImpactBig, Projectile.position); + Vector2 BurstFXDirection = new Vector2(5, 0).RotatedByRandom(100); for (int i = 0; i < 2; i++) { - CritSpark spark = new CritSpark(Projectile.Center, Vector2.Zero, Color.White, ColorUsed, 5.5f, 7, 10f, 4.5f); + SparkParticle spark = new SparkParticle(Projectile.Center, (BurstFXDirection) * (i + 1), false, 7, 1.5f - i * 0.6f, MainColor * 0.8f); GeneralParticleHandler.SpawnParticle(spark); } + for (int i = 0; i < 2; i++) + { + SparkParticle spark = new SparkParticle(Projectile.Center, (-BurstFXDirection) * (i + 1), false, 7, 1.5f - i * 0.6f, MainColor * 0.8f); + GeneralParticleHandler.SpawnParticle(spark); + } + + Particle orb = new GenericBloom(Projectile.Center, Vector2.Zero, MainColor, 0.6f, 13, false); + GeneralParticleHandler.SpawnParticle(orb); + Particle orb2 = new GenericBloom(Projectile.Center, Vector2.Zero, Color.White, 0.5f, 12, false); + GeneralParticleHandler.SpawnParticle(orb2); + } + else + { + for (int i = 0; i <= 8; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(7, 7), 192, Projectile.velocity.RotatedByRandom(MathHelper.ToRadians(20f)) * Main.rand.NextFloat(0.05f, 0.45f), 0, default, Main.rand.NextFloat(0.6f, 1.2f)); + dust.noLight = true; + dust.noGravity = false; + dust.color = GetColor(Projectile.ai[0]); + dust.alpha = 75; + } + Projectile.timeLeft = 15; + PostHit = true; } } - public override void OnKill(int timeLeft) + public override bool OnTileCollide(Vector2 oldVelocity) { - if (!DashShot) - SoundEngine.PlaySound(ShotImpact, Projectile.position); - - for (int i = 0; i <= 8; i++) - { - Dust dust = Dust.NewDustPerfect(Projectile.position, 192, Projectile.velocity.RotatedByRandom(MathHelper.ToRadians(20f)) * Main.rand.NextFloat(0.05f, 0.3f), 0, default, Main.rand.NextFloat(0.6f, 1.2f)); - dust.noLight = true; - dust.noGravity = false; - dust.color = GetColor(Projectile.ai[0]); - dust.alpha = 75; - } - for (int i = 0; i < 3; i++) { Vector2 paintPos = Projectile.Center + Main.rand.NextVector2Circular(12f, 12f) + (Projectile.velocity.SafeNormalize(Vector2.UnitY)).RotatedByRandom(MathHelper.ToRadians(30f)) * Main.rand.NextFloat(4f, 20f); - float paintSize = Main.rand.NextFloat(60f, 100f); + float paintSize = Main.rand.NextFloat(40f, 70f); switch (Projectile.ai[0]) { case 0: @@ -171,6 +218,14 @@ namespace CalamityMod.Projectiles.Ranged break; } } + Projectile.timeLeft = 15; + PostHit = true; + return false; + } + public override void OnKill(int timeLeft) + { + if (!DashShot) + SoundEngine.PlaySound(ShotImpact, Projectile.position); } public static Color GetColor(float type) => type == 0 ? Color.Aqua : type == 1 ? Color.Blue : type == 2 ? Color.Fuchsia : type == 3 ? Color.Lime : Color.Yellow; diff --git a/Projectiles/Ranged/SporeBomb.cs b/Projectiles/Ranged/SporeBomb.cs index 7d73830764..8bf8a13126 100644 --- a/Projectiles/Ranged/SporeBomb.cs +++ b/Projectiles/Ranged/SporeBomb.cs @@ -1,8 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -74,7 +74,7 @@ namespace CalamityMod.Projectiles.Ranged SoundEngine.PlaySound(SoundID.Item14, Projectile.position); for (int d = 0; d < 25; d++) { - int index = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 157, 0f, 0f, 0, new Color(Main.DiscoR, 203, 103), 1f); + int index = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.ChlorophyteWeapon, 0f, 0f, 0, new Color(Main.DiscoR, 203, 103), 1f); Main.dust[index].noGravity = true; Main.dust[index].velocity *= 1.5f; Main.dust[index].scale = 1.5f; diff --git a/Projectiles/Ranged/SproutingArrowMain.cs b/Projectiles/Ranged/SproutingArrowMain.cs new file mode 100644 index 0000000000..93fbb6180f --- /dev/null +++ b/Projectiles/Ranged/SproutingArrowMain.cs @@ -0,0 +1,90 @@ +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class SproutingArrowMain : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Ranged"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + private bool hitDirect = false; + public override void SetDefaults() + { + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.arrow = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 35; + Projectile.extraUpdates = 8; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; + Projectile.ArmorPenetration = 8; + Projectile.tileCollide = false; + } + + public override void AI() + { + if (Projectile.ai[0] == 0) + { + Projectile.damage = (int)(Projectile.damage * 0.18f); + Projectile.velocity *= 0.25f; + LineParticle spark = new LineParticle(Projectile.Center + Projectile.velocity * 4, Projectile.velocity * 4.95f, false, 9, 2.4f, Color.LimeGreen); + GeneralParticleHandler.SpawnParticle(spark); + } + Projectile.ai[0]++; + + Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; + } + + public override void OnKill(int timeLeft) + { + if (Projectile.owner == Main.myPlayer) + { + Vector2 vel1 = (Projectile.velocity * 0.4f).RotatedBy(Main.rand.NextFloat(0.015f, 0.04f)); + Vector2 vel2 = (Projectile.velocity * 0.4f).RotatedBy(Main.rand.NextFloat(-0.015f, -0.04f)); + + int split1 = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, vel1 * Main.rand.NextFloat(0.95f, 1.05f), ModContent.ProjectileType(), (int)(Projectile.damage * 3), 0f, Projectile.owner, 0f, hitDirect ? 1f : 0f); + int split2 = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, vel2 * Main.rand.NextFloat(0.95f, 1.05f), ModContent.ProjectileType(), (int)(Projectile.damage * 3), 0f, Projectile.owner, 0f, hitDirect ? 1f : 0f); + if (Projectile.Calamity().allProjectilesHome) // Allows the split arrows to home when using Arterial Assault as well + { + Main.projectile[split1].Calamity().allProjectilesHome = true; + Main.projectile[split2].Calamity().allProjectilesHome = true; + } + + PointParticle spark = new PointParticle(Projectile.Center - Projectile.velocity + Projectile.velocity.RotatedBy(2.3f), Projectile.velocity.RotatedBy(2.3f) * 0.5f, false, 5, 1.1f, Color.LimeGreen); + GeneralParticleHandler.SpawnParticle(spark); + PointParticle spark2 = new PointParticle(Projectile.Center - Projectile.velocity + Projectile.velocity.RotatedBy(-2.3f), Projectile.velocity.RotatedBy(-2.3f) * 0.5f, false, 5, 1.1f, Color.LimeGreen); + GeneralParticleHandler.SpawnParticle(spark2); + } + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + if (Projectile.timeLeft <= 4) + { + hitDirect = true; + SoundEngine.PlaySound(SoundID.Item53 with { Pitch = 0.9f, Volume = 0.4f }, Projectile.Center); + int Dusts = 8; + float radians = MathHelper.TwoPi / Dusts; + Vector2 spinningPoint = Vector2.Normalize(new Vector2(-1f, -1f)); + float rotRando = Main.rand.NextFloat(0.1f, 2.5f); + for (int i = 0; i < Dusts; i++) + { + Vector2 dustVelocity = spinningPoint.RotatedBy(radians * i).RotatedBy(0.5f * rotRando) * 6f; + Dust dust2 = Dust.NewDustPerfect(Projectile.Center, 264, dustVelocity); + dust2.noGravity = true; + dust2.scale = Main.rand.NextFloat(0.85f, 1.35f); + dust2.color = Main.rand.NextBool(3) ? Color.MediumAquamarine : Color.Lime; + } + Projectile.Kill(); + } + } + } +} diff --git a/Projectiles/Ranged/SproutingArrowSplit.cs b/Projectiles/Ranged/SproutingArrowSplit.cs new file mode 100644 index 0000000000..94009910e9 --- /dev/null +++ b/Projectiles/Ranged/SproutingArrowSplit.cs @@ -0,0 +1,73 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class SproutingArrowSplit : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Ranged"; + public override string Texture => "CalamityMod/Items/Ammo/SproutingArrow"; + + public override void SetDefaults() + { + Projectile.width = 12; + Projectile.height = 12; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.arrow = true; + Projectile.penetrate = 1; + Projectile.extraUpdates = 2; + Projectile.alpha = 255; + Projectile.timeLeft = 450; + Projectile.ArmorPenetration = 8; + } + public override void AI() + { + // If you get the direct arrowhead hit, make sure those arrows hit by making them large + if (Projectile.ai[1] == 1) + { + Projectile.ExpandHitboxBy(60); + Projectile.ai[1] = 0; + } + Lighting.AddLight(Projectile.Center, Color.LimeGreen.ToVector3() * 0.25f); + if (Projectile.alpha > 0) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, 264, Projectile.velocity.RotatedByRandom(0.4) * Main.rand.NextFloat(0.05f, 0.3f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.8f, 1.3f); + dust.color = Main.rand.NextBool(3) ? Color.MediumAquamarine : Color.Lime; + Projectile.alpha -= 20; + Projectile.velocity *= 1.09f; + } + else if (Main.rand.NextBool()) + { + Dust dust2 = Dust.NewDustPerfect(Projectile.Center, 264, -Projectile.velocity * Main.rand.NextFloat(0.05f, 0.3f)); + dust2.noGravity = true; + dust2.scale = Main.rand.NextFloat(0.35f, 0.65f); + dust2.color = Main.rand.NextBool(3) ? Color.MediumAquamarine : Color.Lime; + } + + Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; + } + + public override void OnKill(int timeLeft) + { + int Dusts = 6; + float radians = MathHelper.TwoPi / Dusts; + Vector2 spinningPoint = Vector2.Normalize(new Vector2(-1f, -1f)); + float rotRando = Main.rand.NextFloat(0.1f, 2.5f); + for (int i = 0; i < Dusts; i++) + { + Vector2 dustVelocity = spinningPoint.RotatedBy(radians * i).RotatedBy(0.5f * rotRando) * 3f; + Dust dust2 = Dust.NewDustPerfect(Projectile.Center, 264, dustVelocity); + dust2.noGravity = true; + dust2.scale = Main.rand.NextFloat(0.65f, 0.95f); + dust2.color = Main.rand.NextBool(3) ? Color.MediumAquamarine : Color.Lime; + } + SoundEngine.PlaySound(SoundID.Item118 with { Pitch = 0.5f }, Projectile.Center); + } + } +} diff --git a/Projectiles/Ranged/SputterComet.cs b/Projectiles/Ranged/SputterComet.cs index 079b157173..8a519534ad 100644 --- a/Projectiles/Ranged/SputterComet.cs +++ b/Projectiles/Ranged/SputterComet.cs @@ -1,10 +1,10 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Dusts; -using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -35,7 +35,7 @@ namespace CalamityMod.Projectiles.Ranged Lighting.AddLight(Projectile.Center, 0.1f, 0.3f, 0.8f); if (Main.rand.NextBool(3)) { - int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), 1, 1, ModContent.DustType(), 0f, 0f, 0, default, 0.5f); + int dust = Dust.NewDust(Projectile.position, 1, 1, ModContent.DustType(), 0f, 0f, 0, default, 0.5f); Main.dust[dust].alpha = Projectile.alpha; Main.dust[dust].velocity *= 0f; Main.dust[dust].noGravity = true; diff --git a/Projectiles/Ranged/SputterCometBig.cs b/Projectiles/Ranged/SputterCometBig.cs index 6a6b18f70c..306e29e01d 100644 --- a/Projectiles/Ranged/SputterCometBig.cs +++ b/Projectiles/Ranged/SputterCometBig.cs @@ -1,10 +1,10 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Dusts; -using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -35,7 +35,7 @@ namespace CalamityMod.Projectiles.Ranged Lighting.AddLight(Projectile.Center, 0.3f, 0.5f, 0.1f); if (Main.rand.NextBool(3)) { - int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), 1, 1, ModContent.DustType(), 0f, 0f, 0, default, 0.5f); + int dust = Dust.NewDust(Projectile.position, 1, 1, ModContent.DustType(), 0f, 0f, 0, default, 0.5f); Main.dust[dust].alpha = Projectile.alpha; Main.dust[dust].velocity *= 0f; Main.dust[dust].noGravity = true; diff --git a/Projectiles/Ranged/SpykerProj.cs b/Projectiles/Ranged/SpykerProj.cs index 4e9c7f5c90..34ccd4eba6 100644 --- a/Projectiles/Ranged/SpykerProj.cs +++ b/Projectiles/Ranged/SpykerProj.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Projectiles.Ranged { for (int i = 0; i < 2; i++) { - int poisonDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 46, 0f, 0f, 100, default, 0.75f); + int poisonDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Poisoned, 0f, 0f, 100, default, 0.75f); Main.dust[poisonDust].noGravity = true; Main.dust[poisonDust].velocity *= 0f; } @@ -77,7 +77,7 @@ namespace CalamityMod.Projectiles.Ranged } for (int j = 0; j < 3; j++) { - int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 46, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.2f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Poisoned, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.2f); Main.dust[dust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -87,10 +87,10 @@ namespace CalamityMod.Projectiles.Ranged } for (int k = 0; k < 5; k++) { - int dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 39, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.7f); + int dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.JungleGrass, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.7f); Main.dust[dust2].noGravity = true; Main.dust[dust2].velocity *= 5f; - dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 44, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f); + dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.JungleSpore, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f); Main.dust[dust2].velocity *= 2f; } } diff --git a/Projectiles/Ranged/StarfleetMK2Gun.cs b/Projectiles/Ranged/StarfleetMK2Gun.cs index 02b6de6ec7..9b872555ba 100644 --- a/Projectiles/Ranged/StarfleetMK2Gun.cs +++ b/Projectiles/Ranged/StarfleetMK2Gun.cs @@ -1,8 +1,8 @@ -using CalamityMod.Items.Weapons.Ranged; +using System; +using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Projectiles.Melee; using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -54,7 +54,7 @@ namespace CalamityMod.Projectiles.Ranged Vector2 source = Vector2.Normalize(Projectile.velocity) * 9f; source = source.RotatedBy((d - (dustAmt / 2 - 1)) * MathHelper.TwoPi / dustAmt, default) + player.Center; Vector2 dustVel = source - player.Center; - int index = Dust.NewDust(source + dustVel, 0, 0, 221, 0f, 0f, 0, default, 4f); + int index = Dust.NewDust(source + dustVel, 0, 0, DustID.FireworkFountain_Blue, 0f, 0f, 0, default, 4f); Main.dust[index].noGravity = true; Main.dust[index].velocity = dustVel; } @@ -69,7 +69,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.ai[1] = baseUseTime - modifier * Projectile.localAI[0]; timeToFire = true; } - bool canFire = player.channel && player.HasAmmo(player.ActiveItem()) && !player.noItems && !player.CCed; + bool canFire = !player.CantUseHoldout() && player.HasAmmo(player.ActiveItem()); if (Projectile.soundDelay <= 0 && canFire) { Projectile.soundDelay = baseUseTime - modifier * (int)Projectile.localAI[0]; diff --git a/Projectiles/Ranged/StarmageddonBinaryStarCenter.cs b/Projectiles/Ranged/StarmageddonBinaryStarCenter.cs index ad559d9775..045c84200e 100644 --- a/Projectiles/Ranged/StarmageddonBinaryStarCenter.cs +++ b/Projectiles/Ranged/StarmageddonBinaryStarCenter.cs @@ -1,13 +1,13 @@ using System; -using Microsoft.Xna.Framework; +using System.IO; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.NPCs.CalClone; using CalamityMod.Projectiles.Magic; +using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using System.IO; namespace CalamityMod.Projectiles.Ranged { diff --git a/Projectiles/Ranged/StarmageddonHeld.cs b/Projectiles/Ranged/StarmageddonHeld.cs index 8d65941729..b19eea0f43 100644 --- a/Projectiles/Ranged/StarmageddonHeld.cs +++ b/Projectiles/Ranged/StarmageddonHeld.cs @@ -1,10 +1,10 @@ -using CalamityMod.Items.Weapons.Ranged; +using System; +using System.IO; +using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Projectiles.Melee; using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -71,14 +71,13 @@ namespace CalamityMod.Projectiles.Ranged Projectile.frame = 7; bool timeToFire = noStars && Projectile.frame == 7; - bool canFire = player.channel && !player.noItems && !player.CCed; - if (!canFire) + if (player.CantUseHoldout()) Projectile.Kill(); Vector2 playerPosition = player.RotatedRelativePoint(player.MountedCenter, true); if (timeToFire && Main.myPlayer == Projectile.owner) { - if (canFire) + if (!player.CantUseHoldout()) { SoundEngine.PlaySound(SoundID.Item92, Projectile.Center); @@ -156,7 +155,7 @@ namespace CalamityMod.Projectiles.Ranged public override void PostDraw(Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; int height = texture.Height / Main.projFrames[Projectile.type]; int drawStart = height * Projectile.frame; Vector2 origin = Projectile.Size / 2; diff --git a/Projectiles/Ranged/StarmageddonStar.cs b/Projectiles/Ranged/StarmageddonStar.cs index def82187f8..9891b14303 100644 --- a/Projectiles/Ranged/StarmageddonStar.cs +++ b/Projectiles/Ranged/StarmageddonStar.cs @@ -1,17 +1,17 @@ -using Microsoft.Xna.Framework; +using System; using System.Collections.Generic; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Audio; -using CalamityMod.Dusts; -using System; -using CalamityMod.NPCs.TownNPCs; -using Microsoft.Xna.Framework.Graphics; -using CalamityMod.Particles; using System.IO; +using CalamityMod.Dusts; +using CalamityMod.NPCs.TownNPCs; +using CalamityMod.Particles; using CalamityMod.Projectiles.Melee; using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { @@ -126,7 +126,7 @@ namespace CalamityMod.Projectiles.Ranged Vector2 dustVel = Vector2.UnitX * (float)-(float)Projectile.width / 2f; dustVel += -Vector2.UnitY.RotatedBy((double)((float)l * MathHelper.Pi / 6f), default) * new Vector2(8f, 16f); dustVel = dustVel.RotatedBy((double)(speed.ToRotation()), default); - int starDust = Dust.NewDust(position, 0, 0, 221, 0f, 0f, 0, default, 1f); + int starDust = Dust.NewDust(position, 0, 0, DustID.FireworkFountain_Blue, 0f, 0f, 0, default, 1f); Main.dust[starDust].noGravity = true; Main.dust[starDust].position = position + dustVel; Main.dust[starDust].velocity = speed * 0.1f; @@ -163,7 +163,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; int height = texture.Height / Main.projFrames[Projectile.type]; int drawStart = height * Projectile.frame; Vector2 origin = Projectile.Size / 2; @@ -183,18 +183,18 @@ namespace CalamityMod.Projectiles.Ranged for (int i = 0; i < 4; i++) { - int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 6, 0f, 0f, 100, default(Color), 1.5f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default(Color), 1.5f); Main.dust[dust].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; } for (int i = 0; i < 30; i++) { - int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 6, 0f, 0f, 200, default(Color), 3.7f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 200, default(Color), 3.7f); Main.dust[dust].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; Main.dust[dust].noGravity = true; Dust dust2 = Main.dust[dust]; dust2.velocity *= 3f; - dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 6, 0f, 0f, 100, default(Color), 1.5f); + dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default(Color), 1.5f); Main.dust[dust].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; dust2 = Main.dust[dust]; dust2.velocity *= 2f; @@ -204,7 +204,7 @@ namespace CalamityMod.Projectiles.Ranged for (int i = 0; i < 10; i++) { - int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 6, 0f, 0f, 0, default(Color), 2.7f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 0, default(Color), 2.7f); Main.dust[dust].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(MathHelper.Pi).RotatedBy(Projectile.velocity.ToRotation()) * Projectile.width / 2f; Main.dust[dust].noGravity = true; Dust dust2 = Main.dust[dust]; @@ -213,7 +213,7 @@ namespace CalamityMod.Projectiles.Ranged for (int i = 0; i < 10; i++) { - int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 303, 0f, 0f, 0, default(Color), 1.5f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.SteampunkSteam, 0f, 0f, 0, default(Color), 1.5f); Main.dust[dust].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(MathHelper.Pi).RotatedBy(Projectile.velocity.ToRotation()) * Projectile.width / 2f; Main.dust[dust].noGravity = true; Dust dust2 = Main.dust[dust]; diff --git a/Projectiles/Ranged/StarmageddonStar2.cs b/Projectiles/Ranged/StarmageddonStar2.cs index 67713d636b..1ed3100ebc 100644 --- a/Projectiles/Ranged/StarmageddonStar2.cs +++ b/Projectiles/Ranged/StarmageddonStar2.cs @@ -1,17 +1,17 @@ -using Microsoft.Xna.Framework; +using System; using System.Collections.Generic; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Audio; -using CalamityMod.Dusts; -using System; -using CalamityMod.NPCs.TownNPCs; -using Microsoft.Xna.Framework.Graphics; -using CalamityMod.Particles; using System.IO; +using CalamityMod.Dusts; +using CalamityMod.NPCs.TownNPCs; +using CalamityMod.Particles; using CalamityMod.Projectiles.Melee; using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { @@ -126,7 +126,7 @@ namespace CalamityMod.Projectiles.Ranged Vector2 dustVel = Vector2.UnitX * (float)-(float)Projectile.width / 2f; dustVel += -Vector2.UnitY.RotatedBy((double)((float)l * MathHelper.Pi / 6f), default) * new Vector2(8f, 16f); dustVel = dustVel.RotatedBy((double)(speed.ToRotation()), default); - int starDust = Dust.NewDust(position, 0, 0, 221, 0f, 0f, 0, default, 1f); + int starDust = Dust.NewDust(position, 0, 0, DustID.FireworkFountain_Blue, 0f, 0f, 0, default, 1f); Main.dust[starDust].noGravity = true; Main.dust[starDust].position = position + dustVel; Main.dust[starDust].velocity = speed * 0.1f; @@ -163,7 +163,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; int height = texture.Height / Main.projFrames[Projectile.type]; int drawStart = height * Projectile.frame; Vector2 origin = Projectile.Size / 2; @@ -183,18 +183,18 @@ namespace CalamityMod.Projectiles.Ranged for (int i = 0; i < 4; i++) { - int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 135, 0f, 0f, 100, default(Color), 1.5f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.IceTorch, 0f, 0f, 100, default(Color), 1.5f); Main.dust[dust].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; } for (int i = 0; i < 30; i++) { - int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 135, 0f, 0f, 200, default(Color), 3.7f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.IceTorch, 0f, 0f, 200, default(Color), 3.7f); Main.dust[dust].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; Main.dust[dust].noGravity = true; Dust dust2 = Main.dust[dust]; dust2.velocity *= 3f; - dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 135, 0f, 0f, 100, default(Color), 1.5f); + dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.IceTorch, 0f, 0f, 100, default(Color), 1.5f); Main.dust[dust].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; dust2 = Main.dust[dust]; dust2.velocity *= 2f; @@ -204,7 +204,7 @@ namespace CalamityMod.Projectiles.Ranged for (int i = 0; i < 10; i++) { - int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 135, 0f, 0f, 0, default(Color), 2.7f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.IceTorch, 0f, 0f, 0, default(Color), 2.7f); Main.dust[dust].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(MathHelper.Pi).RotatedBy(Projectile.velocity.ToRotation()) * Projectile.width / 2f; Main.dust[dust].noGravity = true; Dust dust2 = Main.dust[dust]; @@ -213,7 +213,7 @@ namespace CalamityMod.Projectiles.Ranged for (int i = 0; i < 10; i++) { - int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 303, 0f, 0f, 0, default(Color), 1.5f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.SteampunkSteam, 0f, 0f, 0, default(Color), 1.5f); Main.dust[dust].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(MathHelper.Pi).RotatedBy(Projectile.velocity.ToRotation()) * Projectile.width / 2f; Main.dust[dust].noGravity = true; Dust dust2 = Main.dust[dust]; diff --git a/Projectiles/Ranged/StormSurgeTornado.cs b/Projectiles/Ranged/StormSurgeTornado.cs index 5fb3d959db..a66d24cc72 100644 --- a/Projectiles/Ranged/StormSurgeTornado.cs +++ b/Projectiles/Ranged/StormSurgeTornado.cs @@ -1,6 +1,6 @@ +using System; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged @@ -23,6 +23,8 @@ namespace CalamityMod.Projectiles.Ranged Projectile.tileCollide = false; Projectile.penetrate = 2; Projectile.DamageType = DamageClass.Ranged; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() @@ -46,13 +48,13 @@ namespace CalamityMod.Projectiles.Ranged { Projectile.frame = 0; } - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; } public override bool PreDraw(ref Color lightColor) { - Texture2D texture2D13 = ModContent.Request(Texture).Value; - int framing = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; + Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + int framing = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; int y6 = framing * Projectile.frame; Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)framing / 2f), Projectile.scale, SpriteEffects.None, 0); return false; diff --git a/Projectiles/Ranged/SulphuricBlast.cs b/Projectiles/Ranged/SulphuricBlast.cs index b6a6ef14ab..5e0e660b4a 100644 --- a/Projectiles/Ranged/SulphuricBlast.cs +++ b/Projectiles/Ranged/SulphuricBlast.cs @@ -79,8 +79,8 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - Texture2D texture2D13 = ModContent.Request(Texture).Value; - int projFrame = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; + Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + int projFrame = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; int y6 = projFrame * Projectile.frame; Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, projFrame)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)projFrame / 2f), Projectile.scale, SpriteEffects.None, 0); return false; diff --git a/Projectiles/Ranged/SuperballBulletProj.cs b/Projectiles/Ranged/SuperballBulletProj.cs deleted file mode 100644 index c64b5b19d4..0000000000 --- a/Projectiles/Ranged/SuperballBulletProj.cs +++ /dev/null @@ -1,84 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Audio; - -namespace CalamityMod.Projectiles.Ranged -{ - public class SuperballBulletProj : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Ranged"; - public override void SetStaticDefaults() - { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; - } - - public override void SetDefaults() - { - Projectile.width = 4; - Projectile.height = 4; - Projectile.aiStyle = ProjAIStyleID.Arrow; - Projectile.friendly = true; - Projectile.DamageType = DamageClass.Ranged; - Projectile.penetrate = 5; - Projectile.timeLeft = 600; - Projectile.extraUpdates = 1; - AIType = ProjectileID.Bullet; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; - } - - public override void AI() - { - Projectile.localAI[0] += 1f; - if (Projectile.localAI[0] > 4f) - { - if (Main.rand.NextBool(3)) - { - int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), 1, 1, 87, 0f, 0f, 0, default, 0.5f); - Main.dust[dust].alpha = Projectile.alpha; - Main.dust[dust].velocity *= 0f; - Main.dust[dust].noGravity = true; - } - } - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - 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; - - if (Projectile.extraUpdates < 5) - Projectile.extraUpdates++; - - SoundEngine.PlaySound(SoundID.Item10, Projectile.position); - } - return false; - } - - public override bool PreDraw(ref Color lightColor) - { - CalamityUtils.DrawAfterimagesFromEdge(Projectile, 0, lightColor); - return false; - } - - public override void OnKill(int timeLeft) - { - SoundEngine.PlaySound(SoundID.Item10, Projectile.position); - for (int k = 0; k < 5; k++) - { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 87, Projectile.oldVelocity.X * 0.05f, Projectile.oldVelocity.Y * 0.05f); - } - } - } -} diff --git a/Projectiles/Ranged/SuperballBulletProj.png b/Projectiles/Ranged/SuperballBulletProj.png deleted file mode 100644 index b198b5ea66..0000000000 Binary files a/Projectiles/Ranged/SuperballBulletProj.png and /dev/null differ diff --git a/Projectiles/Ranged/SurgeDriverHoldout.cs b/Projectiles/Ranged/SurgeDriverHoldout.cs index 8950c735c4..b0542bac73 100644 --- a/Projectiles/Ranged/SurgeDriverHoldout.cs +++ b/Projectiles/Ranged/SurgeDriverHoldout.cs @@ -12,7 +12,6 @@ namespace CalamityMod.Projectiles.Ranged { public override LocalizedText DisplayName => CalamityUtils.GetItemName(); public Player Owner => Main.player[Projectile.owner]; - public bool OwnerCanShoot => Owner.channel && !Owner.noItems && !Owner.CCed; public ref float ShootCountdown => ref Projectile.ai[0]; public override void SetDefaults() @@ -35,12 +34,10 @@ namespace CalamityMod.Projectiles.Ranged UpdateProjectileHeldVariables(armPosition); ManipulatePlayerVariables(); - if (!OwnerCanShoot) - { - // Prevent spam clicking by letting the animation run if the player just stops holding - if (Owner.noItems || Owner.CCed || Owner.dead || ShootCountdown < 0f) - Projectile.Kill(); - } + // Prevent spam clicking by letting the animation run if the player just stops holding + if (Owner.CantUseHoldout() && ShootCountdown < 0f) + Projectile.Kill(); + // Can't shoot on frame 1 as it can't use ammo yet else if (ShootCountdown < 0f && Owner.HasAmmo(Owner.ActiveItem())) { diff --git a/Projectiles/Ranged/TelluricGlareArrow.cs b/Projectiles/Ranged/TelluricGlareArrow.cs index cdb20f40e5..5cfd0ef4b3 100644 --- a/Projectiles/Ranged/TelluricGlareArrow.cs +++ b/Projectiles/Ranged/TelluricGlareArrow.cs @@ -1,14 +1,14 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; +using CalamityMod.Graphics.Primitives; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using CalamityMod.Graphics.Primitives; namespace CalamityMod.Projectiles.Ranged { @@ -103,7 +103,8 @@ namespace CalamityMod.Projectiles.Ranged GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/FabstaffStreak")); Vector2 overallOffset = Projectile.Size * 0.5f; overallOffset += Projectile.velocity * 1.4f; - PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(PrimitiveWidthFunction, PrimitiveColorFunction, (_) => overallOffset, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 92); + int numPoints = 92; + PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(PrimitiveWidthFunction, PrimitiveColorFunction, (_) => overallOffset, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), numPoints); return false; } diff --git a/Projectiles/Ranged/TerraArrowMain.cs b/Projectiles/Ranged/TerraArrowMain.cs deleted file mode 100644 index 7aa96e5f10..0000000000 --- a/Projectiles/Ranged/TerraArrowMain.cs +++ /dev/null @@ -1,69 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Audio; -namespace CalamityMod.Projectiles.Ranged -{ - public class TerraArrowMain : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Ranged"; - public override string Texture => "CalamityMod/Items/Ammo/TerraArrow"; - - private bool initialized = false; - public override void SetDefaults() - { - Projectile.width = 10; - Projectile.height = 10; - Projectile.friendly = true; - Projectile.DamageType = DamageClass.Ranged; - Projectile.arrow = true; - Projectile.penetrate = 1; - Projectile.timeLeft = 600; - Projectile.extraUpdates = 1; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; - } - - public override void AI() - { - if (!initialized) - { - Projectile.velocity *= 0.5f; - initialized = true; - } - if (Projectile.FinalExtraUpdate() && initialized) - { - Projectile.velocity *= 1.003f; - if (Projectile.velocity.Length() >= 22f) - { - Projectile.Kill(); - } - } - Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; - } - - public override void OnKill(int timeLeft) - { - Projectile.ExpandHitboxBy(32); - SoundEngine.PlaySound(SoundID.Item60, Projectile.Center); - for (int d = 0; d < 3; d++) - { - int terra = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 107, 0f, 0f, 100, default, 2f); - Main.dust[terra].velocity *= 1.2f; - if (Main.rand.NextBool()) - { - Main.dust[terra].scale = 0.5f; - Main.dust[terra].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - if (Projectile.owner == Main.myPlayer) - { - for (int a = 0; a < 2; a++) - { - Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.25), 0f, Projectile.owner, 0f, 0f); - } - } - } - } -} diff --git a/Projectiles/Ranged/TerraArrowSplit.cs b/Projectiles/Ranged/TerraArrowSplit.cs deleted file mode 100644 index 4da11f3e45..0000000000 --- a/Projectiles/Ranged/TerraArrowSplit.cs +++ /dev/null @@ -1,58 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Audio; -namespace CalamityMod.Projectiles.Ranged -{ - public class TerraArrowSplit : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Ranged"; - public override string Texture => "CalamityMod/Items/Ammo/TerraArrow"; - - public override void SetDefaults() - { - Projectile.width = 10; - Projectile.height = 10; - Projectile.friendly = true; - Projectile.DamageType = DamageClass.Ranged; - Projectile.arrow = true; - Projectile.penetrate = 1; - Projectile.alpha = 255; - Projectile.timeLeft = 120; - Projectile.aiStyle = ProjAIStyleID.Arrow; - } - - public override bool? CanHitNPC(NPC target) => Projectile.timeLeft < 90 && target.CanBeChasedBy(Projectile); - - public override void AI() - { - Projectile.alpha -= 5; - Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; - - if (Projectile.timeLeft < 90) { - CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 450f, 12f, 20f); - } - } - - public override void OnKill(int timeLeft) - { - SoundEngine.PlaySound(SoundID.Item60, Projectile.position); - Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); - Projectile.width = 30; - Projectile.height = 30; - Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); - for (int i = 0; i < 2; i++) - { - int terraDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, default, 2f); - if (Main.rand.NextBool()) - { - Main.dust[terraDust].scale = 0.5f; - Main.dust[terraDust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - } - } -} diff --git a/Projectiles/Ranged/TerraFlamebursterHouldout.cs b/Projectiles/Ranged/TerraFlamebursterHouldout.cs deleted file mode 100644 index 9481b8c9ea..0000000000 --- a/Projectiles/Ranged/TerraFlamebursterHouldout.cs +++ /dev/null @@ -1,135 +0,0 @@ -using CalamityMod.Items.Weapons.Ranged; -using CalamityMod.Particles; -using log4net.Core; -using Microsoft.Xna.Framework; -using Mono.Cecil; -using ReLogic.Utilities; -using System; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.Localization; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class TerraFlamebursterHoldout : ModProjectile - { - // Take the name and texture from the weapon - public override LocalizedText DisplayName => CalamityUtils.GetItemName(); - public override string Texture => "CalamityMod/Items/Weapons/Ranged/TerraFlameburster"; - private Player Owner => Main.player[Projectile.owner]; - private ref float ShotsFired => ref Projectile.ai[1]; - private ref float ShootTimer => ref Projectile.ai[2]; - private ref int ShotDelay => ref Owner.ActiveItem().useTime; // 8 - public int ShotCooldown; - public int FireBlobs = 0; - public int Time = 0; - private bool OwnerCanShoot => Owner.channel && !Owner.noItems && !Owner.CCed; - - public override void SetDefaults() - { - Projectile.width = 68; - Projectile.height = 26; - Projectile.friendly = true; - Projectile.tileCollide = false; - Projectile.DamageType = DamageClass.Ranged; - Projectile.ignoreWater = true; - } - - public override void AI() - { - Time++; - if (Time == 1) - Projectile.alpha = 255; - else - Projectile.alpha = 0; - - if (Owner.dead || ShotsFired >= 16) // destroy the holdout if the player dies or is out of shots - { - Projectile.Kill(); - return; - } - - Vector2 armPosition = Owner.RotatedRelativePoint(Owner.MountedCenter, true); - Vector2 tipPosition = armPosition + Projectile.velocity * Projectile.width * 0.8f; - - // Kill if the owner stops channeling or otherwise cannot use the weapon. - if (!OwnerCanShoot) - { - Projectile.Kill(); - } - else - { - // While channeled, keep refreshing the projectile lifespan - Projectile.timeLeft = 2; - - ShootTimer++; - if (ShootTimer >= 60) - { - if (ShotCooldown == 0) - { - SoundEngine.PlaySound(SoundID.Item34, Projectile.Center); - Owner.PickAmmo(Owner.ActiveItem(), out _, out float shootSpeed, out int damage, out float knockback, out _, Main.rand.NextBool(2) ? true : false); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), tipPosition, (Projectile.velocity * 9).RotatedByRandom(0.08f), ModContent.ProjectileType(), damage, knockback, Projectile.owner); - ShotsFired++; - ShotCooldown = ShotDelay; - if (FireBlobs == 0) - { - float randAngle = Main.rand.NextFloat(8f, 15f); - Vector2 newVel = (Projectile.velocity * 9).RotatedBy(MathHelper.ToRadians(randAngle)) * 2f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), tipPosition, newVel, ModContent.ProjectileType(), damage, knockback, Projectile.owner); - newVel = (Projectile.velocity * 9).RotatedBy(MathHelper.ToRadians(-randAngle)) * 2f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), tipPosition, newVel, ModContent.ProjectileType(), damage, knockback, Projectile.owner); - FireBlobs = 3; - } - else - FireBlobs--; - } - else - ShotCooldown--; - } - else - { - if (ShootTimer == 1) - SoundEngine.PlaySound(SoundID.Item73 with { Volume = 0.7f}, Projectile.Center); - ShotsFired = 0; - for (int i = 0; i < 2; i++) - { - float rotMulti = Main.rand.NextFloat(0.3f, 1f); - Dust dust2 = Dust.NewDustPerfect(tipPosition, Main.rand.NextBool(5) ? 135 : 107); - dust2.noGravity = true; - dust2.velocity = new Vector2(0, -2).RotatedByRandom(rotMulti * 0.3f) * (Main.rand.NextFloat(1f, 2.9f) - rotMulti); - dust2.scale = Main.rand.NextFloat(1.2f, 1.8f) * (ShootTimer * 0.015f); - } - } - - } - UpdateProjectileHeldVariables(armPosition); - ManipulatePlayerVariables(); - } - - private void UpdateProjectileHeldVariables(Vector2 armPosition) - { - if (Main.myPlayer == Projectile.owner) - { - float interpolant = Utils.GetLerpValue(5f, 40f, Projectile.Distance(Main.MouseWorld), true); - Vector2 oldVelocity = Projectile.velocity; - Projectile.velocity = Vector2.Lerp(Projectile.velocity, Projectile.SafeDirectionTo(Main.MouseWorld), interpolant); - } - Projectile.Center = armPosition + Projectile.velocity * 20; - Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f); - Projectile.spriteDirection = Projectile.direction; - } - - private void ManipulatePlayerVariables() - { - Owner.ChangeDir(Projectile.direction); - Owner.heldProj = Projectile.whoAmI; - Owner.itemTime = 2; - Owner.itemAnimation = 2; - Owner.itemRotation = (Projectile.velocity * Projectile.direction).ToRotation(); - } - public override bool? CanDamage() => false; - } -} diff --git a/Projectiles/Ranged/TheHiveHoldout.cs b/Projectiles/Ranged/TheHiveHoldout.cs new file mode 100644 index 0000000000..80d1f8a77f --- /dev/null +++ b/Projectiles/Ranged/TheHiveHoldout.cs @@ -0,0 +1,278 @@ +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Particles; +using CalamityMod.Projectiles.BaseProjectiles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Utilities; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.ID; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Projectiles.Ranged +{ + public class TheHiveHoldout : BaseGunHoldoutProjectile + { + public override int AssociatedItemID => ItemType(); + public override float RecoilResolveSpeed => 0.1f; + public override float MaxOffsetLengthFromArm => 15f; + public override float OffsetXUpwards => -12f; + public override float BaseOffsetY => -10f; + public override float OffsetYUpwards => 15f; + + // The type of dust used in the effects and the color of the particles that it'll use depending on the type of rocket used. + // It'll carry over to the projectiles that it shoots. + public static int DustEffectsID { get; set; } + public static Color EffectsColor { get; set; } + public static Color StaticEffectsColor = Color.Lime; + + private ref float ShootingTimer => ref Projectile.ai[0]; + private bool FireNuke; + private float PostFireCooldown = 0; + private bool HasLetGo = false; + private SlotId HiveHum; + private const float MaxCharge = 90f; + + public override void KillHoldoutLogic() + { + if (HasLetGo) + PostFiringCooldown(); + } + + public override void HoldoutAI() + { + + FireNuke = ShootingTimer > MaxCharge; + + // If there's no player, or the player is the server, or the owner's stunned, there'll be no holdout. + if (Owner.CantUseHoldout() && !HasLetGo) + { + if (SoundEngine.TryGetActiveSound(HiveHum, out var hum) && hum.IsPlaying) + { + hum?.Stop(); + } + if (HeldItem.type == ItemType()) + ShootRocket(); + NetUpdate(); + HasLetGo = true; + } + + if (!HasLetGo) + { + ShootingTimer++; + if (SoundEngine.TryGetActiveSound(HiveHum, out var hum) && hum.IsPlaying) + { + hum.Position = Projectile.Center; + hum.Pitch = MathHelper.Lerp(0f, 0.8f, Utils.GetLerpValue(0f, MaxCharge, ShootingTimer, true)); + } + } + + // Inside here go all the things that dedicated servers shouldn't spend resources on. + // Like visuals and sounds. + if (Main.dedServ) + return; + + Vector2 shootDirection = Projectile.velocity.SafeNormalize(Vector2.Zero) * 20; + if (ShootingTimer >= MaxCharge && !HasLetGo) + { + for (int k = 0; k < 2; k++) + { + GlowOrbParticle spark = new GlowOrbParticle(GunTipPosition + Projectile.velocity * 1.5f, Vector2.Zero, false, 2, Main.rand.NextFloat(0.5f, 1.1f), Color.Red); + GeneralParticleHandler.SpawnParticle(spark); + } + for (int e = 0; e < 2; e++) + { + Dust dust2 = Dust.NewDustPerfect(GunTipPosition + Projectile.velocity * 1.5f, 90, shootDirection * Main.rand.NextFloat(0.01f, 0.8f)); + dust2.scale = Main.rand.NextFloat(0.45f, 0.75f); + dust2.noGravity = true; + } + } + + if (ShootingTimer == MaxCharge && !HasLetGo) + { + SoundStyle fullCharge = new("CalamityMod/Sounds/Custom/PlagueSounds/PBGAttackSwitchShort"); + SoundEngine.PlaySound(fullCharge with { Volume = 0.9f }, Projectile.Center); + for (int k = 0; k < 15; k++) + { + Dust dust2 = Dust.NewDustPerfect(GunTipPosition, 90, new Vector2(4, 4).RotatedByRandom(100) * Main.rand.NextFloat(0.05f, 0.8f)); + dust2.scale = Main.rand.NextFloat(0.85f, 1.15f); + dust2.noGravity = true; + } + } + } + + private void ShootRocket() + { + // We use the velocity of this projectile as its direction vector. + Vector2 shootDirection = Projectile.velocity.SafeNormalize(Vector2.Zero); + float VelocityMultiplier = MathHelper.Lerp(0.5f, 1.5f, Utils.GetLerpValue(0f, MaxCharge, ShootingTimer, true)); + + // Every time we shoot we use ammo. + // With this method we also use the item's stats, like the shoot speed, or the type of ammo it was used. + Owner.PickAmmo(HeldItem, out _, out float projSpeed, out int damage, out float knockback, out int rocketType); + + // Decides the color of the effects depending on the type of rocket used. + switch (rocketType) + { + case ItemID.WetRocket: + DustEffectsID = 45; + EffectsColor = Color.RoyalBlue; + break; + case ItemID.LavaRocket: + DustEffectsID = DustID.Torch; + EffectsColor = Color.Red; + break; + case ItemID.HoneyRocket: + DustEffectsID = DustID.Honey; + EffectsColor = Color.Yellow; + break; + default: + DustEffectsID = 131; + EffectsColor = Color.LawnGreen; + break; + } + + // Spawns the projectile. + if (FireNuke) + { + SoundStyle fire = new("CalamityMod/Sounds/Custom/PlagueSounds/PBGBarrageLaunch"); + SoundEngine.PlaySound(fire with { Volume = 0.5f, Pitch = 0.1f }, Projectile.Center); + + Projectile.NewProjectileDirect( + Projectile.GetSource_FromThis(), + GunTipPosition, + shootDirection * projSpeed * 0.3f, + ProjectileType(), + damage * 10, + knockback, + Projectile.owner, + rocketType); + PostFireCooldown = 75; + } + else + { + SoundStyle fire = new("CalamityMod/Sounds/Custom/PlagueSounds/PBGBarrageLaunch"); + SoundEngine.PlaySound(fire with { Volume = 0.4f, Pitch = 0.7f }, Projectile.Center); + + int numProj = 4; + float rotation = MathHelper.ToRadians(MathHelper.Clamp(35 - VelocityMultiplier * 26, 2, 25)); + for (int i = 0; i < numProj; i++) + { + Vector2 perturbedSpeed = (shootDirection).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); + Projectile.NewProjectileDirect( + Projectile.GetSource_FromThis(), + GunTipPosition, + perturbedSpeed * projSpeed * VelocityMultiplier, + ProjectileType(), + damage, + knockback, + Projectile.owner, + rocketType); + } + PostFireCooldown = 30; + } + + NetUpdate(); + + // Inside here go all the things that dedicated servers shouldn't spend resources on. + // Like visuals and sounds. + if (Main.dedServ) + return; + + if (FireNuke) + { + for (int k = 0; k < 10; k++) + { + float pulseScale = Main.rand.NextFloat(0.35f, 0.55f); + DirectionalPulseRing pulse = new DirectionalPulseRing(GunTipPosition, (shootDirection * 25).RotatedByRandom(0.5f) * Main.rand.NextFloat(0.5f, 1.2f), (Main.rand.NextBool(3) ? EffectsColor : StaticEffectsColor) * 0.8f, new Vector2(1, 1), pulseScale - 0.25f, pulseScale, 0f, 20); + GeneralParticleHandler.SpawnParticle(pulse); + } + for (int i = 0; i <= 15; i++) + { + Dust dust = Dust.NewDustPerfect(GunTipPosition, Main.rand.NextBool(3) ? DustEffectsID : 303, (shootDirection * 20).RotatedByRandom(0.3f) * Main.rand.NextFloat(0.5f, 1.2f), 0, default, Main.rand.NextFloat(0.5f, 0.9f)); + dust.noGravity = false; + if (dust.type != DustEffectsID) + dust.color = Main.rand.NextBool(3) ? EffectsColor : StaticEffectsColor; + } + } + else + { + for (int k = 0; k < 6; k++) + { + float pulseScale = Main.rand.NextFloat(0.2f, 0.4f); + DirectionalPulseRing pulse = new DirectionalPulseRing(GunTipPosition, (shootDirection * 20).RotatedByRandom(0.25f) * Main.rand.NextFloat(0.5f, 1.2f), (Main.rand.NextBool(3) ? EffectsColor : StaticEffectsColor) * 0.8f, new Vector2(1, 1), pulseScale - 0.25f, pulseScale, 0f, 20); + GeneralParticleHandler.SpawnParticle(pulse); + } + } + + // By decreasing the offset length of the gun from the arms, we give an effect of recoil. + OffsetLengthFromArm -= FireNuke ? 16f : 6f; + } + + private void PostFiringCooldown() + { + if (PostFireCooldown > 0) + { + PostFireCooldown--; + Vector2 smokeVel = new Vector2(0, -8) * Main.rand.NextFloat(0.1f, 1.1f); + Particle smoke = new HeavySmokeParticle(GunTipPosition, smokeVel, StaticEffectsColor, Main.rand.Next(40, 60 + 1), Main.rand.NextFloat(0.3f, 0.6f), 0.5f, Main.rand.NextFloat(-0.2f, 0.2f), Main.rand.NextBool(), required: true); + GeneralParticleHandler.SpawnParticle(smoke); + + Dust dust = Dust.NewDustPerfect(GunTipPosition, 303, smokeVel.RotatedByRandom(0.1f), 80, default, Main.rand.NextFloat(0.4f, 1.3f)); + dust.noGravity = false; + dust.color = StaticEffectsColor; + } + else + { + if (SoundEngine.TryGetActiveSound(HiveHum, out var hum) && hum.IsPlaying) + { + hum?.Stop(); + } + Projectile.Kill(); + NetUpdate(); + } + } + + private void NetUpdate() + { + Projectile.netUpdate = true; + if (Projectile.netSpam >= 10) + Projectile.netSpam = 9; + } + + public override void OnSpawn(IEntitySource source) + { + base.OnSpawn(source); + SoundStyle charge = new("CalamityMod/Sounds/Item/LowHum"); + FrontArmStretch = Player.CompositeArmStretchAmount.Quarter; + ExtraBackArmRotation = MathHelper.ToRadians(15f); + HiveHum = SoundEngine.PlaySound(charge with { Volume = 1.6f, IsLooped = true }, Projectile.Center); + } + + public override bool PreDraw(ref Color lightColor) + { + if (ShootingTimer <= 0) + return false; + + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D glowTexture = Request(GlowTexture).Value; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + Color drawColor = Projectile.GetAlpha(lightColor); + float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f); + Vector2 rotationPoint = texture.Size() * 0.5f; + SpriteEffects flipSprite = (Projectile.spriteDirection * Owner.gravDir == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + + if (!Owner.CantUseHoldout()) + { + float rumble = Utils.GetLerpValue(0f, MaxCharge, ShootingTimer, true) * ShootingTimer >= MaxCharge ? 2 : 0.8f; + drawPosition += Main.rand.NextVector2Circular(rumble, rumble); + } + + Main.EntitySpriteDraw(texture, drawPosition, null, drawColor, drawRotation, rotationPoint, Projectile.scale * Owner.gravDir, flipSprite); + Main.EntitySpriteDraw(glowTexture, drawPosition, null, Color.White, drawRotation, rotationPoint, Projectile.scale * Owner.gravDir, flipSprite); + + return false; + } + } +} diff --git a/Projectiles/Ranged/TheMaelstromExplosion.cs b/Projectiles/Ranged/TheMaelstromExplosion.cs index a55b68bdd5..77bc361ffb 100644 --- a/Projectiles/Ranged/TheMaelstromExplosion.cs +++ b/Projectiles/Ranged/TheMaelstromExplosion.cs @@ -67,7 +67,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Vector2 origin = texture.Size() * 0.5f; float scale = Projectile.scale * Projectile.width / texture.Width; diff --git a/Projectiles/Ranged/TheMaelstromShark.cs b/Projectiles/Ranged/TheMaelstromShark.cs index d560c6a9c5..2af536ec39 100644 --- a/Projectiles/Ranged/TheMaelstromShark.cs +++ b/Projectiles/Ranged/TheMaelstromShark.cs @@ -1,12 +1,12 @@ -using Microsoft.Xna.Framework; +using System; +using CalamityMod.Graphics.Primitives; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using CalamityMod.Graphics.Primitives; namespace CalamityMod.Projectiles.Ranged { @@ -91,7 +91,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Rectangle frame = texture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); Vector2 origin = frame.Size() * 0.5f; Vector2 drawPosition = Projectile.Center - Main.screenPosition; diff --git a/Projectiles/Ranged/ThePackMinissile.cs b/Projectiles/Ranged/ThePackMinissile.cs index b4a5346673..57f02cb569 100644 --- a/Projectiles/Ranged/ThePackMinissile.cs +++ b/Projectiles/Ranged/ThePackMinissile.cs @@ -1,9 +1,9 @@ +using System; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { public class ThePackMinissile : ModProjectile, ILocalizedModType @@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X); + Projectile.rotation = Projectile.velocity.ToRotation(); CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 300f, 12f, 15f); Projectile.frameCounter++; if (Projectile.frameCounter > 3) @@ -46,7 +46,7 @@ namespace CalamityMod.Projectiles.Ranged SoundEngine.PlaySound(SoundID.Item14, Projectile.position); for (int i = 0; i < 10; i++) { - int DUST = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 255, 0f, 0f, 0, default, 1f); + int DUST = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CrystalPulse2, 0f, 0f, 0, default, 1f); } } diff --git a/Projectiles/Ranged/ThePackMissile.cs b/Projectiles/Ranged/ThePackMissile.cs index 4275d0a5f7..3ae4347197 100644 --- a/Projectiles/Ranged/ThePackMissile.cs +++ b/Projectiles/Ranged/ThePackMissile.cs @@ -1,9 +1,9 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { public class ThePackMissile : ModProjectile, ILocalizedModType @@ -32,7 +32,7 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X); + Projectile.rotation = Projectile.velocity.ToRotation(); Vector2 targetCenter = Projectile.Center; float minTargetDistance = 2500f; bool homeIn = false; @@ -91,7 +91,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int i = 0; i < 40; i++) { - int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 255, 0f, 0f, 0, default, 1.5f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CrystalPulse2, 0f, 0f, 0, default, 1.5f); Main.dust[dust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -101,10 +101,10 @@ namespace CalamityMod.Projectiles.Ranged } for (int j = 0; j < 60; j++) { - int dust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 255, 0f, 0f, 0, default, 2f); + int dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CrystalPulse2, 0f, 0f, 0, default, 2f); Main.dust[dust2].noGravity = true; Main.dust[dust2].velocity *= 5f; - dust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 255, 0f, 0f, 0, default, 1.5f); + dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CrystalPulse2, 0f, 0f, 0, default, 1.5f); Main.dust[dust2].velocity *= 2f; } Projectile.Damage(); diff --git a/Projectiles/Ranged/TitaniumRailgunScope.cs b/Projectiles/Ranged/TitaniumRailgunScope.cs index ca386ce464..9d79448e35 100644 --- a/Projectiles/Ranged/TitaniumRailgunScope.cs +++ b/Projectiles/Ranged/TitaniumRailgunScope.cs @@ -1,13 +1,13 @@ -using Terraria.DataStructures; +using System; +using CalamityMod.Particles; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.Graphics.Effects; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using Microsoft.Xna.Framework.Graphics; -using CalamityMod.Particles; -using Terraria.Graphics.Effects; -using System; namespace CalamityMod.Projectiles.Ranged { @@ -73,7 +73,7 @@ namespace CalamityMod.Projectiles.Ranged // Play a sound to let the player know they're at max charge if (Charge == MaxChargeOrTargetRotation) SoundEngine.PlaySound(SoundID.Item82 with { Volume = SoundID.Item82.Volume * 0.7f }, Owner.MountedCenter); - + // Idly emit particles every other frame while at max charge if (ChargePercent == 1f && Charge % 2 == 0) { @@ -151,7 +151,7 @@ namespace CalamityMod.Projectiles.Ranged float newRotation = UpdateAimPostShotRecoil(MaxChargeOrTargetRotation.ToRotationVector2()); Owner.heldProj = Projectile.whoAmI; Owner.itemRotation = newRotation; - } + } } // Gently adjusts the aim vector of the cannon to point towards the mouse. @@ -169,7 +169,7 @@ namespace CalamityMod.Projectiles.Ranged // Converge the sights float spread = (1f - ChargePercent) * MaxSightAngle; float halfAngle = spread / 2f; - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Color sightsColor = Color.Lerp(Color.LightBlue, Color.Crimson, ChargePercent); diff --git a/Projectiles/Ranged/TitaniumRailgunShot.cs b/Projectiles/Ranged/TitaniumRailgunShot.cs index 2d7a270d35..d36d0017ea 100644 --- a/Projectiles/Ranged/TitaniumRailgunShot.cs +++ b/Projectiles/Ranged/TitaniumRailgunShot.cs @@ -1,11 +1,11 @@ -using CalamityMod.Projectiles.BaseProjectiles; +using CalamityMod.Particles; +using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; using Terraria; using Terraria.Enums; using Terraria.ModLoader; -using CalamityMod.Particles; namespace CalamityMod.Projectiles.Ranged { @@ -47,7 +47,7 @@ namespace CalamityMod.Projectiles.Ranged { if (Projectile.timeLeft == 15) { - + Vector2 beamVector = Projectile.velocity; float beamLength = DetermineLaserLength_CollideWithTiles(12); diff --git a/Projectiles/Ranged/TorrentialArrow.cs b/Projectiles/Ranged/TorrentialArrow.cs index 5dcced44bc..885533921d 100644 --- a/Projectiles/Ranged/TorrentialArrow.cs +++ b/Projectiles/Ranged/TorrentialArrow.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged diff --git a/Projectiles/Ranged/ToxicArrow.cs b/Projectiles/Ranged/ToxicArrow.cs index eb09f0f3f0..e010f3eb95 100644 --- a/Projectiles/Ranged/ToxicArrow.cs +++ b/Projectiles/Ranged/ToxicArrow.cs @@ -2,9 +2,9 @@ using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { public class ToxicArrow : ModProjectile, ILocalizedModType @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Ranged int count = Main.rand.Next(6, 15); for (int i = 0; i < count; i++) { - int idx = Dust.NewDust(Projectile.Center - Projectile.velocity / 2f, 0, 0, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default, 2f); + int idx = Dust.NewDust(Projectile.Center - Projectile.velocity / 2f, 0, 0, (int)CalamityDusts.SulphurousSeaAcid, 0f, 0f, 100, default, 2f); Main.dust[idx].velocity *= 2f; Main.dust[idx].noGravity = true; } diff --git a/Projectiles/Ranged/ToxicannonDrop.cs b/Projectiles/Ranged/ToxicannonDrop.cs deleted file mode 100644 index c556ecd097..0000000000 --- a/Projectiles/Ranged/ToxicannonDrop.cs +++ /dev/null @@ -1,76 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Buffs.StatDebuffs; - -namespace CalamityMod.Projectiles.Ranged -{ - public class ToxicannonDrop : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Ranged"; - public override string Texture => "CalamityMod/Projectiles/Environment/AcidDrop"; - - public override void SetStaticDefaults() - { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; - } - - public override void SetDefaults() - { - Projectile.width = 14; - Projectile.height = 20; - Projectile.friendly = true; - Projectile.tileCollide = true; - Projectile.ignoreWater = false; - Projectile.timeLeft = 300; - Projectile.DamageType = DamageClass.Ranged; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 17; - } - - public override void AI() - { - NPC potentialTarget = Projectile.Center.ClosestNPCAt(600f, !Projectile.tileCollide); - if (potentialTarget is not null) - { - float flySpeed = Projectile.velocity.Length(); - if (flySpeed < 5f) - flySpeed = 5f; - - Projectile.velocity = Vector2.Lerp(Projectile.velocity, Projectile.SafeDirectionTo(potentialTarget.Center) * flySpeed, 0.085f); - } - - Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; - Projectile.tileCollide = Projectile.timeLeft <= 300; - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - // Water drip - for (int i = 0; i < 4; i++) - { - int idx = Dust.NewDust(Projectile.position - Projectile.velocity, 2, 2, 154, 0f, 0f, 0, new Color(112, 150, 42, 127), 1f); - Dust dust = Main.dust[idx]; - dust.position.X -= 2f; - Main.dust[idx].alpha = 38; - Main.dust[idx].velocity *= 0.1f; - Main.dust[idx].velocity -= Projectile.velocity * 0.025f; - Main.dust[idx].scale = 2f; - } - return true; - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 180); - } - - public override bool PreDraw(ref Color lightColor) - { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], new Color(255, 255, 255, 127), 2); - return false; - } - } -} diff --git a/Projectiles/Ranged/ToxicannonShot.cs b/Projectiles/Ranged/ToxicannonShot.cs deleted file mode 100644 index a62f58ed16..0000000000 --- a/Projectiles/Ranged/ToxicannonShot.cs +++ /dev/null @@ -1,90 +0,0 @@ -using CalamityMod.Buffs.StatDebuffs; -using CalamityMod.Dusts; -using Microsoft.Xna.Framework; -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Ranged -{ - public class ToxicannonShot : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Ranged"; - public override string Texture => "CalamityMod/Projectiles/Enemy/FlakAcid"; - - public override void SetStaticDefaults() - { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 3; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; - } - - public override void SetDefaults() - { - Projectile.width = 30; - Projectile.height = 50; - Projectile.friendly = true; - Projectile.timeLeft = 480; - Projectile.DamageType = DamageClass.Ranged; - Projectile.tileCollide = true; - Projectile.ignoreWater = false; - } - - public override void AI() - { - if (Projectile.ai[0]++ <= 30f) - { - Projectile.alpha = (int)MathHelper.Lerp(255f, 0f, Projectile.ai[0] / 30f); - } - if (Projectile.velocity.Y < 20f) - Projectile.velocity.Y += 0.3f; - Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - - if (Math.Sign(Projectile.velocity.Y) != Math.Sign(Projectile.oldVelocity.Y) && Projectile.ai[0] >= 5f) - { - Projectile.Kill(); - } - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 240); - } - - public override void OnKill(int timeLeft) - { - Projectile.ExpandHitboxBy(180); - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; - Projectile.damage /= 2; - Projectile.Damage(); - for (int i = 0; i <= 40; i++) - { - int idx = Dust.NewDust(Projectile.position, 230, 230, (int)CalamityDusts.SulfurousSeaAcid, 0, 0, 0, default, 0.75f); - Main.dust[idx].noGravity = true; - Main.dust[idx].velocity = Vector2.One.RotatedByRandom(MathHelper.TwoPi) * (Main.dust[idx].position - Projectile.Center).Length() / 25f; - Main.dust[idx].scale = 2.5f; - } - for (int i = 0; i <= 90; i++) - { - int idx = Dust.NewDust(Projectile.Center, 0, 0, (int)CalamityDusts.SulfurousSeaAcid); - Main.dust[idx].velocity = Vector2.One.RotatedByRandom(MathHelper.TwoPi) * 12f; - Main.dust[idx].scale = 3f; - Main.dust[idx].noGravity = true; - } - float count = Main.rand.Next(1, 2 + 1); - for (int i = 0; i < count; i++) - { - float angle = MathHelper.TwoPi * i / count; - angle += Main.rand.NextFloat(0.1f, 0.35f) * Main.rand.NextBool().ToDirectionInt(); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, angle.ToRotationVector2() * Main.rand.NextFloat(4f, 16f), - ModContent.ProjectileType(), Projectile.damage, 2.5f, Projectile.owner); - } - } - - public override bool PreDraw(ref Color lightColor) - { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); - return false; - } - } -} diff --git a/Projectiles/Ranged/TyphoonBubble.cs b/Projectiles/Ranged/TyphoonBubble.cs index 9eda039def..85307684f9 100644 --- a/Projectiles/Ranged/TyphoonBubble.cs +++ b/Projectiles/Ranged/TyphoonBubble.cs @@ -1,9 +1,9 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { public class TyphoonBubble : ModProjectile, ILocalizedModType @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.Ranged Vector2 rotate = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; rotate = rotate.RotatedBy((double)(i - (six / 2 - 1)) * 3.1415926535897931 / (double)(float)six, default) + Projectile.Center; Vector2 dustPos = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); - int typhoonDust = Dust.NewDust(rotate + dustPos, 0, 0, 172, dustPos.X * 2f, dustPos.Y * 2f, 100, default, 1.4f); + int typhoonDust = Dust.NewDust(rotate + dustPos, 0, 0, DustID.DungeonWater, dustPos.X * 2f, dustPos.Y * 2f, 100, default, 1.4f); Main.dust[typhoonDust].noGravity = true; Main.dust[typhoonDust].noLight = true; Main.dust[typhoonDust].velocity /= 4f; @@ -104,7 +104,7 @@ namespace CalamityMod.Projectiles.Ranged Vector2 rotate = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; rotate = rotate.RotatedBy((double)((float)(j - (constant / 2 - 1)) * 6.28318548f / (float)constant), default) + Projectile.Center; Vector2 faceDirection = rotate - Projectile.Center; - int waterDust = Dust.NewDust(rotate + faceDirection, 0, 0, 172, faceDirection.X * 2f, faceDirection.Y * 2f, 100, default, 1.4f); + int waterDust = Dust.NewDust(rotate + faceDirection, 0, 0, DustID.DungeonWater, faceDirection.X * 2f, faceDirection.Y * 2f, 100, default, 1.4f); Main.dust[waterDust].noGravity = true; Main.dust[waterDust].noLight = true; Main.dust[waterDust].velocity = faceDirection; diff --git a/Projectiles/Ranged/UltimaBolt.cs b/Projectiles/Ranged/UltimaBolt.cs index 437bd66ad1..588d3b154c 100644 --- a/Projectiles/Ranged/UltimaBolt.cs +++ b/Projectiles/Ranged/UltimaBolt.cs @@ -1,6 +1,6 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -81,7 +81,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; for (int i = 0; i < Projectile.oldPos.Length; i++) { if (i > 0) diff --git a/Projectiles/Ranged/UltimaBowProjectile.cs b/Projectiles/Ranged/UltimaBowProjectile.cs index 01a3f2459e..4a7d7e186b 100644 --- a/Projectiles/Ranged/UltimaBowProjectile.cs +++ b/Projectiles/Ranged/UltimaBowProjectile.cs @@ -1,6 +1,6 @@ -using CalamityMod.Items.Weapons.Ranged; +using System; +using CalamityMod.Items.Weapons.Ranged; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -43,8 +43,7 @@ namespace CalamityMod.Projectiles.Ranged public void AttemptToFireProjectiles(Player player) { - bool canFire = player.channel && player.HasAmmo(player.ActiveItem()) && !player.noItems && !player.CCed; - if (!canFire) + if (player.CantUseHoldout() || !player.HasAmmo(player.ActiveItem())) { Projectile.Kill(); return; diff --git a/Projectiles/Ranged/UltimaRay.cs b/Projectiles/Ranged/UltimaRay.cs index 36350595b8..49de139eae 100644 --- a/Projectiles/Ranged/UltimaRay.cs +++ b/Projectiles/Ranged/UltimaRay.cs @@ -1,8 +1,9 @@ -using CalamityMod.Projectiles.BaseProjectiles; +using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; -using System; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged @@ -49,6 +50,10 @@ namespace CalamityMod.Projectiles.Ranged return true; } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 240); + } public override bool ShouldUpdatePosition() => false; } } diff --git a/Projectiles/Ranged/UltimaSpark.cs b/Projectiles/Ranged/UltimaSpark.cs index 8abd2a8cae..1bf45cc6f3 100644 --- a/Projectiles/Ranged/UltimaSpark.cs +++ b/Projectiles/Ranged/UltimaSpark.cs @@ -1,5 +1,5 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged diff --git a/Projectiles/Ranged/UniversalGenesisStar.cs b/Projectiles/Ranged/UniversalGenesisStar.cs index 166c73246b..5f3a7af876 100644 --- a/Projectiles/Ranged/UniversalGenesisStar.cs +++ b/Projectiles/Ranged/UniversalGenesisStar.cs @@ -1,11 +1,11 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -51,7 +51,7 @@ namespace CalamityMod.Projectiles.Ranged } if (Main.rand.NextBool(10)) { - Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 173, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1.2f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1.2f); } if (Main.rand.NextBool(20) && Main.netMode != NetmodeID.Server) { @@ -79,7 +79,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.position -= Projectile.Size; for (int i = 0; i < 5; i++) { - int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 16, 0f, 0f, 100, default, 1.2f); + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Cloud, 0f, 0f, 100, default, 1.2f); Main.dust[idx].velocity *= 3f; if (Main.rand.NextBool()) { diff --git a/Projectiles/Ranged/UniversalGenesisStarcaller.cs b/Projectiles/Ranged/UniversalGenesisStarcaller.cs index 8fedbd47d4..0f32060983 100644 --- a/Projectiles/Ranged/UniversalGenesisStarcaller.cs +++ b/Projectiles/Ranged/UniversalGenesisStarcaller.cs @@ -1,8 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -38,7 +38,7 @@ namespace CalamityMod.Projectiles.Ranged { if (Main.rand.NextBool()) { - int idx = Dust.NewDust(Projectile.position, 1, 1, 173, 0f, 0f, 0, default, 0.5f); + int idx = Dust.NewDust(Projectile.position, 1, 1, DustID.ShadowbeamStaff, 0f, 0f, 0, default, 0.5f); Main.dust[idx].alpha = Projectile.alpha; Main.dust[idx].velocity *= 0f; Main.dust[idx].noGravity = true; @@ -62,7 +62,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool OnTileCollide(Vector2 oldVelocity) { Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); - SoundEngine.PlaySound(SoundID.Item11 with { PitchVariance = 0.05f } , Projectile.Center); + SoundEngine.PlaySound(SoundID.Item11 with { PitchVariance = 0.05f }, Projectile.Center); return true; } @@ -119,7 +119,7 @@ namespace CalamityMod.Projectiles.Ranged { for (int k = 0; k < 5; k++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 173, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } if (Main.netMode != NetmodeID.Server) { diff --git a/Projectiles/Ranged/VanquisherArrowMain.cs b/Projectiles/Ranged/VanquisherArrowMain.cs deleted file mode 100644 index 34a818aada..0000000000 --- a/Projectiles/Ranged/VanquisherArrowMain.cs +++ /dev/null @@ -1,67 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Projectiles.Typeless; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Ranged -{ - public class VanquisherArrowMain : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Ranged"; - public override string Texture => "CalamityMod/Items/Ammo/VanquisherArrow"; - - public override void SetDefaults() - { - Projectile.width = 22; - Projectile.height = 22; - Projectile.friendly = true; - Projectile.DamageType = DamageClass.Ranged; - Projectile.tileCollide = false; - Projectile.arrow = true; - Projectile.penetrate = 1; - Projectile.timeLeft = 90; - Projectile.extraUpdates = 1; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; - } - - public override void AI() - { - Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; - if (Projectile.timeLeft % 45 == 0) - { - if (Projectile.owner == Main.myPlayer && Main.player[Projectile.owner].ownedProjectileCounts[ModContent.ProjectileType()] < 6) - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity * 0.25f, ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack, Projectile.owner); - } - } - - public override void PostDraw(Color lightColor) - { - Color color = Color.White; - if (Projectile.timeLeft < 85) - { - byte b2 = (byte)(Projectile.timeLeft * 3); - byte a2 = (byte)(100f * (b2 / 255f)); - color = new Color(b2, b2, b2, a2); - } - Rectangle frame = new Rectangle(0, 0, ModContent.Request(Texture).Value.Width, ModContent.Request(Texture).Value.Height); - Main.EntitySpriteDraw(ModContent.Request("CalamityMod/Items/Ammo/VanquisherArrowGlow").Value, Projectile.Center - Main.screenPosition, frame, color, Projectile.rotation, Projectile.Size / 2, 1f, SpriteEffects.None, 0); - } - - public override Color? GetAlpha(Color lightColor) - { - if (Projectile.timeLeft < 85) - { - byte b2 = (byte)(Projectile.timeLeft * 3); - byte a2 = (byte)(100f * (b2 / 255f)); - return new Color(b2, b2, b2, a2); - } - return new Color(255, 255, 255, 100); - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 180); - } - } -} diff --git a/Projectiles/Ranged/VanquisherArrowProj.cs b/Projectiles/Ranged/VanquisherArrowProj.cs new file mode 100644 index 0000000000..d2f4555ac3 --- /dev/null +++ b/Projectiles/Ranged/VanquisherArrowProj.cs @@ -0,0 +1,124 @@ +using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Ammo; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Typeless; +using Humanizer; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Ranged +{ + public class VanquisherArrowProj : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Ranged"; + public override string Texture => "CalamityMod/Items/Ammo/VanquisherArrow"; + public ref float Time => ref Projectile.ai[0]; + public ref float ProjectileSpeed => ref Projectile.ai[1]; + public bool Phase2 = false; + public float HomingTime = 0; + public Color MainColor; + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 20; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + } + public override void SetDefaults() + { + Projectile.width = 22; + Projectile.height = 22; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.tileCollide = false; + Projectile.arrow = true; + Projectile.penetrate = 2; + Projectile.timeLeft = 1200; + Projectile.extraUpdates = 8; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 15 * Projectile.extraUpdates; + } + + public override void AI() + { + if (Time == 0) + { + Projectile.velocity *= 0.4f; + ProjectileSpeed = 30; + MainColor = Main.rand.NextBool() ? Color.Cyan : Color.Magenta; + } + Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; + + if (Time > 4f && Main.rand.NextBool(4)) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(3) ? 226 : 272, -Projectile.velocity * Main.rand.NextFloat(0.3f, 0.8f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.15f, 0.35f); + } + + + NPC target = Projectile.Center.ClosestNPCAt(65); + + if (target != null) + { + //Projectile.velocity = Projectile.velocity.RotatedByRandom(0.1f); + Phase2 = true; + HomingTime = 1; + } + + if (HomingTime == 1) + CalamityUtils.HomeInOnNPC(Projectile, true, 2000f, 12, 200f); + + Time++; + } + + public override void PostDraw(Color lightColor) + { + Color color = Color.White; + Rectangle frame = new Rectangle(0, 0, Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Width, Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height); + Main.EntitySpriteDraw(ModContent.Request("CalamityMod/Items/Ammo/VanquisherArrowGlow").Value, Projectile.Center - Main.screenPosition, frame, color, Projectile.rotation, Projectile.Size / 2, 1f, SpriteEffects.None, 0); + } + + public override Color? GetAlpha(Color lightColor) + { + return lightColor; + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 180); + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + // First hit is 0.85% damage + if (Projectile.numHits < 1) + Projectile.damage = (int)(Projectile.damage * .85f); + // Second hit is 100% base damage, it is the "Slash Hit" + else + Projectile.damage = (int)(Projectile.damage * (1f / 0.85f)); + + if (Projectile.damage < 1) + Projectile.damage = 1; + } + public override void OnKill(int timeLeft) + { + VoidSparkParticle spark2 = new VoidSparkParticle(Projectile.Center, new Vector2(0.1f, 0.1f).RotatedByRandom(100), false, 9, Main.rand.NextFloat(0.15f, 0.25f), Main.rand.NextBool() ? Color.Magenta : Color.Cyan); + GeneralParticleHandler.SpawnParticle(spark2); + + SoundStyle onKill = new("CalamityMod/Sounds/Item/ScorpioHit"); + SoundEngine.PlaySound(onKill with { Volume = 0.25f, Pitch = 0.1f, PitchVariance = 0.3f }, Projectile.Center); + SoundEngine.PlaySound(SoundID.DD2_FlameburstTowerShot with { Volume = 0.8f, Pitch = -0.5f, PitchVariance = 0.3f }, Projectile.Center); + + } + public override bool PreDraw(ref Color lightColor) + { + Texture2D texture = ModContent.Request("CalamityMod/Projectiles/StarProj").Value; + if (Time > 6) + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], MainColor * 0.3f, 1, texture); + return true; + } + } +} diff --git a/Projectiles/Ranged/VeriumBoltProj.cs b/Projectiles/Ranged/VeriumBoltProj.cs new file mode 100644 index 0000000000..cfe3975f58 --- /dev/null +++ b/Projectiles/Ranged/VeriumBoltProj.cs @@ -0,0 +1,80 @@ +using CalamityMod.NPCs; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class VeriumBoltProj : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Ranged"; + + public override string Texture => "CalamityMod/Items/Ammo/VeriumBolt"; + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 12; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + } + + public override void SetDefaults() + { + Projectile.width = 10; + Projectile.height = 10; + Projectile.aiStyle = ProjAIStyleID.Arrow; + Projectile.arrow = true; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = 1; + Projectile.timeLeft = 600; + Projectile.extraUpdates = 1; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; + } + + public override bool PreDraw(ref Color lightColor) + { + CalamityUtils.DrawAfterimagesCentered(Projectile, 0, Color.Plum); + return true; + } + + public override void AI() + { + Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; + + Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(4) ? 223 : 252, new Vector2(Projectile.velocity.X * Main.rand.NextFloat(-0.1f, 0.1f), Projectile.velocity.Y * Main.rand.NextFloat(-0.1f, 0.1f))); + dust.noGravity = true; + if (dust.type == 223) + dust.scale = Main.rand.NextFloat(0.4f, 0.66f); + else + dust.scale = Main.rand.NextFloat(0.65f, 0.9f); + } + // This projectile is always fullbright. + public override Color? GetAlpha(Color lightColor) + { + return Color.LightSkyBlue; + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + // Handles giving the NPC the doom effect + CalamityGlobalNPC modNPC = target.Calamity(); + if (!modNPC.veriumDoomMarked) + { + modNPC.veriumDoomMarked = true; + modNPC.veriumDoomTimer = CalamityGlobalNPC.veriumDoomTime; + } + modNPC.veriumDoomStacks++; + } + + public override void OnKill(int timeLeft) + { + for (int k = 0; k < 4; k++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, 223, Projectile.velocity.RotatedByRandom(0.5) * Main.rand.NextFloat(0.1f, 0.9f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.5f, 0.7f); + } + } + } +} diff --git a/Projectiles/Ranged/VeriumBulletProj.cs b/Projectiles/Ranged/VeriumBulletProj.cs deleted file mode 100644 index c88c124d7d..0000000000 --- a/Projectiles/Ranged/VeriumBulletProj.cs +++ /dev/null @@ -1,141 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class VeriumBulletProj : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Ranged"; - private float speed = 0f; - public override void SetStaticDefaults() - { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; - } - - public override void SetDefaults() - { - Projectile.width = 4; - Projectile.height = 4; - Projectile.aiStyle = ProjAIStyleID.Arrow; - Projectile.friendly = true; - Projectile.DamageType = DamageClass.Ranged; - Projectile.penetrate = 2; - Projectile.timeLeft = 600; - Projectile.extraUpdates = 1; - AIType = ProjectileID.Bullet; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; - } - - public override bool PreDraw(ref Color lightColor) - { - CalamityUtils.DrawAfterimagesFromEdge(Projectile, 0, lightColor); - return false; - } - - public override bool PreAI() - { - Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.ToRadians(90f); - Projectile.spriteDirection = Projectile.direction; - - Projectile.localAI[0] += 1f; - if (Projectile.localAI[0] > 4f) - { - if (Main.rand.NextBool()) - { - int purple = Dust.NewDust(Projectile.position, 1, 1, 70, 0f, 0f, 0, default, 0.5f); - Main.dust[purple].alpha = Projectile.alpha; - Main.dust[purple].velocity *= 0f; - Main.dust[purple].noGravity = true; - } - } - - if (Projectile.ai[0] > 0f) - Projectile.ai[0]--; - if (speed == 0f) - speed = Projectile.velocity.Length(); - if (Projectile.penetrate == 1 && Projectile.ai[0] <= 0f) - { - float inertia = 15f; - Vector2 center = Projectile.Center; - float maxDistance = 300f; - bool homeIn = false; - - int targetIndex = (int)Projectile.ai[1]; - NPC target = Main.npc[targetIndex]; - if (target.CanBeChasedBy(Projectile, false)) - { - float extraDistance = (target.width / 2) + (target.height / 2); - - bool canHit = true; - if (extraDistance < maxDistance) - canHit = Collision.CanHit(Projectile.Center, 1, 1, target.Center, 1, 1); - - if (Vector2.Distance(target.Center, Projectile.Center) < (maxDistance + extraDistance) && canHit) - { - center = target.Center; - homeIn = true; - } - } - - if (!homeIn) - { - for (int i = 0; i < Main.maxNPCs; i++) - { - NPC npc = Main.npc[i]; - if (npc.CanBeChasedBy(Projectile, false)) - { - float extraDistance = (npc.width / 2) + (npc.height / 2); - - bool canHit = true; - if (extraDistance < maxDistance) - canHit = Collision.CanHit(Projectile.Center, 1, 1, npc.Center, 1, 1); - - if (Vector2.Distance(npc.Center, Projectile.Center) < (maxDistance + extraDistance) && canHit) - { - center = npc.Center; - homeIn = true; - break; - } - } - } - } - - if (!Projectile.friendly) - { - homeIn = false; - } - - if (homeIn) - { - Vector2 moveDirection = Projectile.SafeDirectionTo(center, Vector2.UnitY); - Projectile.velocity = (Projectile.velocity * inertia + moveDirection * speed) / (inertia + 1f); - } - return false; - } - return true; - } - - public override bool? CanHitNPC(NPC target) => Projectile.ai[0] <= 0f && target.CanBeChasedBy(Projectile); - - public override bool CanHitPvp(Player target) => Projectile.ai[0] <= 0f; - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - Projectile.ai[0] = 10f; - Projectile.damage /= 2; - if (target.life > 0) - Projectile.ai[1] = target.whoAmI; - } - - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - Projectile.ai[0] = 10f; - Projectile.damage /= 2; - } - } -} diff --git a/Projectiles/Ranged/VeriumBulletProj.png b/Projectiles/Ranged/VeriumBulletProj.png deleted file mode 100644 index de510ceb92..0000000000 Binary files a/Projectiles/Ranged/VeriumBulletProj.png and /dev/null differ diff --git a/Projectiles/Ranged/LunarBolt2.cs b/Projectiles/Ranged/VernalBolt.cs similarity index 91% rename from Projectiles/Ranged/LunarBolt2.cs rename to Projectiles/Ranged/VernalBolt.cs index 7433843df2..f548e85826 100644 --- a/Projectiles/Ranged/LunarBolt2.cs +++ b/Projectiles/Ranged/VernalBolt.cs @@ -1,11 +1,11 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { - public class LunarBolt2 : ModProjectile, ILocalizedModType + public class VernalBolt : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Ranged"; public override string Texture => "CalamityMod/Projectiles/Ranged/LunarBolt"; @@ -34,7 +34,7 @@ namespace CalamityMod.Projectiles.Ranged for (int d = 0; d < 5; d++) { Vector2 dspeed = -Projectile.velocity * 0.5f; - int index = Dust.NewDust(Projectile.Center, 1, 1, 206, 0f, 0f, 0, default, 1.2f); + int index = Dust.NewDust(Projectile.Center, 1, 1, DustID.UnusedWhiteBluePurple, 0f, 0f, 0, default, 1.2f); Main.dust[index].alpha = Projectile.alpha; Main.dust[index].velocity = dspeed; Main.dust[index].noGravity = true; @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Ranged for (int d = 0; d < 5; d++) { Vector2 dspeed2 = -Projectile.velocity * 0.5f; - int index = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 107, 0f, 0f, 0, default, 0.7f); + int index = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.TerraBlade, 0f, 0f, 0, default, 0.7f); Main.dust[index].alpha = Projectile.alpha; Main.dust[index].velocity = dspeed2; Main.dust[index].noGravity = true; diff --git a/Projectiles/Ranged/Voidragon.cs b/Projectiles/Ranged/Voidragon.cs index 9deeeba52c..690d4b33da 100644 --- a/Projectiles/Ranged/Voidragon.cs +++ b/Projectiles/Ranged/Voidragon.cs @@ -1,8 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -44,7 +44,7 @@ namespace CalamityMod.Projectiles.Ranged Vector2 dustVel = Vector2.UnitX * (float)-(float)Projectile.width / 2f; dustVel += -Vector2.UnitY.RotatedBy((double)((float)l * 3.14159274f / 6f), default) * new Vector2(8f, 16f); dustVel = dustVel.RotatedBy((double)(Projectile.rotation - 1.57079637f), default); - int shadowDust = Dust.NewDust(Projectile.Center, 0, 0, 173, 0f, 0f, 160, default, 1f); + int shadowDust = Dust.NewDust(Projectile.Center, 0, 0, DustID.ShadowbeamStaff, 0f, 0f, 160, default, 1f); Main.dust[shadowDust].scale = 1.1f; Main.dust[shadowDust].noGravity = true; Main.dust[shadowDust].position = Projectile.Center + dustVel; @@ -66,7 +66,7 @@ namespace CalamityMod.Projectiles.Ranged if (Main.rand.NextBool(16)) { Vector2 value3 = Vector2.UnitX.RotatedByRandom(1.5707963705062866).RotatedBy((double)Projectile.velocity.ToRotation(), default); - int extraDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 173, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1.2f); + int extraDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1.2f); Main.dust[extraDust].velocity = value3 * 0.66f; Main.dust[extraDust].position = Projectile.Center + value3 * 12f; } @@ -81,7 +81,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.light = 0.9f; if (Main.rand.NextBool(10)) { - Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 173, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1.2f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1.2f); } if (Main.rand.NextBool(20) && Main.netMode != NetmodeID.Server) { @@ -106,7 +106,7 @@ namespace CalamityMod.Projectiles.Ranged SoundEngine.PlaySound(SoundID.Item10, Projectile.position); for (int k = 0; k < 5; k++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 173, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } } } diff --git a/Projectiles/Ranged/VoidragonTentacle.cs b/Projectiles/Ranged/VoidragonTentacle.cs index e40a858799..cf7887c1db 100644 --- a/Projectiles/Ranged/VoidragonTentacle.cs +++ b/Projectiles/Ranged/VoidragonTentacle.cs @@ -1,7 +1,8 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged @@ -83,7 +84,7 @@ namespace CalamityMod.Projectiles.Ranged int dustAmount = 0; while ((float)dustAmount < Projectile.scale * 10f) { - int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 62, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 1.3f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.PurpleTorch, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 1.3f); Main.dust[dust].position = (Main.dust[dust].position + Projectile.Center) / 2f; Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 0.1f; diff --git a/Projectiles/Ranged/WaterSpout.cs b/Projectiles/Ranged/WaterSpout.cs index 64606cf8f3..fd74bc6e11 100644 --- a/Projectiles/Ranged/WaterSpout.cs +++ b/Projectiles/Ranged/WaterSpout.cs @@ -1,6 +1,6 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged @@ -100,7 +100,7 @@ namespace CalamityMod.Projectiles.Ranged } if (Projectile.ai[0] <= 0f) { - float swaySize = 0.104719758f; + float swaySize = MathHelper.Pi / 30f; float smolWidth = (float)Projectile.width / 5f; float projXChange = (float)(Math.Cos((double)(swaySize * -(double)Projectile.ai[0])) - 0.5) * smolWidth; Projectile.position.X = Projectile.position.X - projXChange * (float)-(float)Projectile.direction; @@ -112,8 +112,8 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - Texture2D texture2D13 = ModContent.Request(Texture).Value; - int framing = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; + Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + int framing = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; int y6 = framing * Projectile.frame; Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)framing / 2f), Projectile.scale, SpriteEffects.None, 0); return false; diff --git a/Projectiles/Ranged/TerraFire.cs b/Projectiles/Ranged/WildfireBloomFire.cs similarity index 97% rename from Projectiles/Ranged/TerraFire.cs rename to Projectiles/Ranged/WildfireBloomFire.cs index ea49e162a7..5902dbc88c 100644 --- a/Projectiles/Ranged/TerraFire.cs +++ b/Projectiles/Ranged/WildfireBloomFire.cs @@ -1,13 +1,13 @@ -using CalamityMod.Particles; +using System; +using CalamityMod.Particles; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { - public class TerraFire : ModProjectile, ILocalizedModType + public class WildfireBloomFire : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Ranged"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; @@ -52,14 +52,14 @@ namespace CalamityMod.Projectiles.Ranged Projectile.scale = 1.8f * Utils.GetLerpValue(6f, 30f, Time, true); else return; // Helps position it at the tip - + // Main smokes shifting between green to green-blue and back float smokeRot = MathHelper.ToRadians(3f); // *Rate of rotation per frame, not a constant rotation float colorValue = CalamityUtils.Convert01To010(Utils.GetLerpValue(30f, Lifetime, Time, true)); Color smokeColor = Color.Lerp(Color.Lime, Color.Turquoise, colorValue); Particle smoke = new HeavySmokeParticle(Projectile.Center, Projectile.velocity * 0.5f, smokeColor, 18, Projectile.scale * Main.rand.NextFloat(0.6f, 1.2f), 0.4f, smokeRot, true, required: true); GeneralParticleHandler.SpawnParticle(smoke); - + if (Time > 4) { for (int i = 0; i < 2; i++) diff --git a/Projectiles/Ranged/TerraFlare.cs b/Projectiles/Ranged/WildfireBloomFlare.cs similarity index 93% rename from Projectiles/Ranged/TerraFlare.cs rename to Projectiles/Ranged/WildfireBloomFlare.cs index 9bbfe20c28..d0a4586228 100644 --- a/Projectiles/Ranged/TerraFlare.cs +++ b/Projectiles/Ranged/WildfireBloomFlare.cs @@ -1,15 +1,15 @@ -using CalamityMod.Particles; +using System; +using System.IO; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { - public class TerraFlare : ModProjectile, ILocalizedModType + public class WildfireBloomFlare : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Ranged"; public override string Texture => "CalamityMod/ExtraTextures/SmallGreyscaleCircle"; @@ -48,7 +48,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - Texture2D lightTexture = ModContent.Request(Texture).Value; + Texture2D lightTexture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; for (int i = 0; i < Projectile.oldPos.Length; i++) { float colorInterpolation = MathF.Cos(Projectile.timeLeft / 16f + Main.GlobalTimeWrappedHourly / 20f + i / (float)Projectile.oldPos.Length * MathHelper.Pi) * 0.5f + 0.5f; diff --git a/Projectiles/Ranged/WildfireBloomHoldout.cs b/Projectiles/Ranged/WildfireBloomHoldout.cs new file mode 100644 index 0000000000..6144e97939 --- /dev/null +++ b/Projectiles/Ranged/WildfireBloomHoldout.cs @@ -0,0 +1,87 @@ +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Projectiles.BaseProjectiles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class WildfireBloomHoldout : BaseGunHoldoutProjectile + { + public override int AssociatedItemID => ModContent.ItemType(); + public override string Texture => "CalamityMod/Projectiles/Ranged/WildfireBloomHoldout"; + public override Vector2 GunTipPosition => base.GunTipPosition - Vector2.UnitX.RotatedBy(Projectile.rotation) * 17f - (Vector2.UnitY.RotatedBy(Projectile.rotation) * 7f * Projectile.spriteDirection * Owner.gravDir); + public override float MaxOffsetLengthFromArm => 20f; + public override float OffsetXUpwards => -5f; + public override float BaseOffsetY => -5f; + public override float OffsetYDownwards => 5f; + + private ref float ShotCooldown => ref Projectile.ai[0]; + private ref float ShotsFired => ref Projectile.ai[1]; + private ref float ShootTimer => ref Projectile.ai[2]; + public int FireBlobs = 0; + + public override void KillHoldoutLogic() + { + base.KillHoldoutLogic(); + if (ShotsFired >= 16) + { + Projectile.Kill(); + Projectile.netUpdate = true; + } + } + + public override void HoldoutAI() + { + ShootTimer++; + if (ShootTimer >= 60) + { + if (ShotCooldown == 0) + { + SoundEngine.PlaySound(SoundID.Item34, Projectile.Center); + Owner.PickAmmo(Owner.ActiveItem(), out _, out float shootSpeed, out int damage, out float knockback, out _, Main.rand.NextBool(2)); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, (Projectile.velocity * 9).RotatedByRandom(0.08f), ModContent.ProjectileType(), damage, knockback, Projectile.owner); + ShotsFired++; + ShotCooldown = HeldItem.useTime; + if (FireBlobs == 0) + { + float randAngle = Main.rand.NextFloat(8f, 15f); + Vector2 newVel = (Projectile.velocity * 9).RotatedBy(MathHelper.ToRadians(randAngle)) * 2f; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, newVel, ModContent.ProjectileType(), damage, knockback, Projectile.owner); + newVel = (Projectile.velocity * 9).RotatedBy(MathHelper.ToRadians(-randAngle)) * 2f; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, newVel, ModContent.ProjectileType(), damage, knockback, Projectile.owner); + FireBlobs = 3; + } + else + FireBlobs--; + } + else + ShotCooldown--; + } + else + { + ShotsFired = 0; + for (int i = 0; i < 2; i++) + { + float rotMulti = Main.rand.NextFloat(0.3f, 1f); + Dust dust2 = Dust.NewDustPerfect(GunTipPosition, Main.rand.NextBool(5) ? 135 : 107); + dust2.noGravity = true; + dust2.velocity = new Vector2(0, -2).RotatedByRandom(rotMulti * 0.3f) * (Main.rand.NextFloat(1f, 2.9f) - rotMulti); + dust2.scale = Main.rand.NextFloat(1.2f, 1.8f) * (ShootTimer * 0.015f); + } + } + } + + public override void OnSpawn(IEntitySource source) + { + base.OnSpawn(source); + SoundEngine.PlaySound(SoundID.Item73 with { Volume = 0.7f }, Projectile.Center); + } + } +} diff --git a/Projectiles/Ranged/WildfireBloomHoldout.png b/Projectiles/Ranged/WildfireBloomHoldout.png new file mode 100644 index 0000000000..73d499359f Binary files /dev/null and b/Projectiles/Ranged/WildfireBloomHoldout.png differ diff --git a/Projectiles/Rogue/AcidBarrelDrop.cs b/Projectiles/Rogue/AcidBarrelDrop.cs index df1f6646eb..0591f2951a 100644 --- a/Projectiles/Rogue/AcidBarrelDrop.cs +++ b/Projectiles/Rogue/AcidBarrelDrop.cs @@ -1,8 +1,8 @@ +using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Buffs.StatDebuffs; namespace CalamityMod.Projectiles.Rogue { @@ -24,30 +24,46 @@ namespace CalamityMod.Projectiles.Rogue Projectile.friendly = true; Projectile.tileCollide = true; Projectile.ignoreWater = false; - Projectile.timeLeft = 420; + Projectile.timeLeft = 840; + Projectile.extraUpdates = 2; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; Projectile.DamageType = RogueDamageClass.Instance; } public override void AI() { - Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; - if (Projectile.velocity.Y <= 8f) + if (Main.rand.NextBool()) { - Projectile.velocity.Y += 0.15f; + Dust dust = Dust.NewDustPerfect(Projectile.Center, DustID.JungleTorch); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.65f, 0.8f); + dust.velocity = -Projectile.velocity * 0.4f; + } + + if (Projectile.ai[0] < 3) + { + if (Projectile.timeLeft == 839) + Projectile.velocity *= 0.5f; + Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; + if (Projectile.velocity.Y <= 12f) + { + Projectile.velocity.Y += 0.15f; + } + Projectile.tileCollide = Projectile.timeLeft <= 300; } - Projectile.tileCollide = Projectile.timeLeft <= 300; } public override bool OnTileCollide(Vector2 oldVelocity) { // Water drip for (int i = 0; i < 4; i++) { - int idx = Dust.NewDust(Projectile.position - Projectile.velocity, 2, 2, 154, 0f, 0f, 0, new Color(112, 150, 42, 127), 1f); + int idx = Dust.NewDust(Projectile.position - Projectile.velocity, 2, 2, DustID.JungleTorch, 0f, 0f, 0, new Color(112, 150, 42, 127), 1f); Dust dust = Main.dust[idx]; dust.position.X -= 2f; Main.dust[idx].alpha = 38; - Main.dust[idx].velocity *= 0.1f; + Main.dust[idx].velocity *= Projectile.velocity.RotatedByRandom(0.3f) * 0.4f; Main.dust[idx].velocity -= Projectile.velocity * 0.025f; - Main.dust[idx].scale = 0.75f; + Main.dust[idx].scale = 0.85f; } return true; } diff --git a/Projectiles/Rogue/AcidShrapnel.cs b/Projectiles/Rogue/AcidShrapnel.cs index f2a0a0e37e..4feb1b9207 100644 --- a/Projectiles/Rogue/AcidShrapnel.cs +++ b/Projectiles/Rogue/AcidShrapnel.cs @@ -1,7 +1,7 @@ +using System; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ModLoader; @@ -61,7 +61,7 @@ namespace CalamityMod.Projectiles.Rogue { for (int i = 0; i < 15; i++) { - Dust dust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.SulfurousSeaAcid); + Dust dust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.SulphurousSeaAcid); dust.velocity = Vector2.UnitY.RotatedBy(i / 15f * MathHelper.TwoPi) * 3f * (float)Math.Cos(i / 15f * MathHelper.TwoPi); dust.scale = 2.5f; dust.noGravity = true; diff --git a/Projectiles/Rogue/AdamantiteThrowingAxeProjectile.cs b/Projectiles/Rogue/AdamantiteThrowingAxeProjectile.cs index fd719dc7e1..39a07ff343 100644 --- a/Projectiles/Rogue/AdamantiteThrowingAxeProjectile.cs +++ b/Projectiles/Rogue/AdamantiteThrowingAxeProjectile.cs @@ -1,7 +1,10 @@ -using CalamityMod.Items.Weapons.Rogue; +using System; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Sounds; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue @@ -16,29 +19,59 @@ namespace CalamityMod.Projectiles.Rogue Projectile.width = 30; Projectile.height = 30; Projectile.friendly = true; - Projectile.penetrate = 4; - Projectile.aiStyle = ProjAIStyleID.ThrownProjectile; + Projectile.penetrate = 3; Projectile.timeLeft = 600; - AIType = ProjectileID.Shuriken; Projectile.DamageType = RogueDamageClass.Instance; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; + Projectile.localNPCHitCooldown = 30; + } + + public override void AI() + { + float rotation = (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.025f; + Projectile.rotation += rotation * Projectile.direction; + + if (Projectile.Calamity().stealthStrike && Main.rand.NextBool(3)) + { + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Electric, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + } + + if (Projectile.timeLeft < 570 && !Projectile.Calamity().stealthStrike) + { + Projectile.velocity.X *= 0.96f; + Projectile.velocity.Y += 0.35f; + if (Projectile.velocity.Y > 16f) + Projectile.velocity.Y = 16f; + } + return; } public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { + if (Projectile.numHits > 0) + Projectile.damage = (int)(Projectile.damage * 0.75f); + if (Projectile.damage < 1) + { + Projectile.damage = 1; + } OnHitEffects(); } public override void OnHitPlayer(Player target, Player.HurtInfo info) { + if (Projectile.numHits > 0) + Projectile.damage = (int)(Projectile.damage * 0.75f); + if (Projectile.damage < 1) + { + Projectile.damage = 1; + } OnHitEffects(); } @@ -46,11 +79,25 @@ namespace CalamityMod.Projectiles.Rogue { if (Projectile.Calamity().stealthStrike && Main.myPlayer == Projectile.owner) { + // Stolen from Twisting Thunder, the old "lightning" effect was so puny -CIT + SoundEngine.PlaySound(CommonCalamitySounds.LightningSound, Projectile.position); var source = Projectile.GetSource_FromThis(); - for (int n = 0; n < 3; n++) + for (int n = 0; n < 4; n++) { - Projectile lightning = CalamityUtils.ProjectileRain(source, Projectile.Center, 400f, 100f, -800f, -500f, 8f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); - lightning.ai[0] = Main.rand.Next(2); + Vector2 spawnPoint = new Vector2(Projectile.Center.X + (float)Main.rand.Next(-20, 21), Projectile.Center.Y - (float)Main.rand.Next(700, 801)); + float randomVelocity = Main.rand.NextFloat() - 0.5f; + Vector2 fireTo = new Vector2(spawnPoint.X + 20f * randomVelocity, spawnPoint.Y + 900); + Vector2 ai0 = fireTo - spawnPoint; + float ai = (float)Main.rand.Next(100); + Vector2 velocity = Vector2.Normalize(ai0.RotatedByRandom(0.31415)) * 9f; + int proj = Projectile.NewProjectile(source, spawnPoint.X, spawnPoint.Y, velocity.X, velocity.Y, ProjectileID.CultistBossLightningOrbArc, Projectile.damage, Projectile.knockBack, Projectile.owner, ai0.ToRotation(), ai); + Main.projectile[proj].extraUpdates += 14; + Main.projectile[proj].friendly = true; + Main.projectile[proj].hostile = false; + Main.projectile[proj].tileCollide = false; + Main.projectile[proj].penetrate = 3; + Main.projectile[proj].usesLocalNPCImmunity = true; + Main.projectile[proj].localNPCHitCooldown = -1; } } } diff --git a/Projectiles/Rogue/AlphaSeeker.cs b/Projectiles/Rogue/AlphaSeeker.cs index 2363a0251d..40721f2fb7 100644 --- a/Projectiles/Rogue/AlphaSeeker.cs +++ b/Projectiles/Rogue/AlphaSeeker.cs @@ -1,6 +1,6 @@ +using System; using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -98,7 +98,7 @@ namespace CalamityMod.Projectiles.Rogue HomingAI(); } - int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 89, 0f, 0f, 100, default, 2f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GemEmerald, 0f, 0f, 100, default, 2f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity.Y = -0.15f; } diff --git a/Projectiles/Rogue/AlphaVirusProjectile.cs b/Projectiles/Rogue/AlphaVirusProjectile.cs index 29cbc7323e..37249a4dc7 100644 --- a/Projectiles/Rogue/AlphaVirusProjectile.cs +++ b/Projectiles/Rogue/AlphaVirusProjectile.cs @@ -1,11 +1,11 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.NPCs.StormWeaver; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using CalamityMod.NPCs.StormWeaver; using Terraria; -using Terraria.ModLoader; -using Terraria.ID; using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { @@ -165,13 +165,13 @@ namespace CalamityMod.Projectiles.Rogue Vector2 velocity = -pos * 0.02f; pos += Projectile.Center; - int dust = Dust.NewDust(pos, 1, 1, 89, 0f, 0f, 100, default, 1f); + int dust = Dust.NewDust(pos, 1, 1, DustID.GemEmerald, 0f, 0f, 100, default, 1f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity = velocity + Projectile.velocity; } // Main sprite - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } @@ -206,7 +206,7 @@ namespace CalamityMod.Projectiles.Rogue velocity = velocity.RotatedByRandom(MathHelper.TwoPi); velocity *= 0.1f; - int dust = Dust.NewDust(Projectile.Center, 1, 1, 89, 0f, 0f, 100, default, 1f); + int dust = Dust.NewDust(Projectile.Center, 1, 1, DustID.GemEmerald, 0f, 0f, 100, default, 1f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity = velocity + Projectile.velocity; } diff --git a/Projectiles/Rogue/AntumbraShardProjectile.cs b/Projectiles/Rogue/AntumbraShardProjectile.cs index e7230604a2..d40e05db3a 100644 --- a/Projectiles/Rogue/AntumbraShardProjectile.cs +++ b/Projectiles/Rogue/AntumbraShardProjectile.cs @@ -38,11 +38,11 @@ namespace CalamityMod.Projectiles.Rogue Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.ToRadians(45f); if (Projectile.spriteDirection == -1) { - Projectile.rotation -= 1.57f; + Projectile.rotation -= MathHelper.PiOver2; } if (Main.rand.NextBool(3)) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 62, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.PurpleTorch, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } if (Projectile.timeLeft % 12 == 0) { diff --git a/Projectiles/Rogue/ApoctolithProj.cs b/Projectiles/Rogue/ApoctolithProj.cs index 23db67d6f4..3a69866f9e 100644 --- a/Projectiles/Rogue/ApoctolithProj.cs +++ b/Projectiles/Rogue/ApoctolithProj.cs @@ -1,12 +1,12 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; -using Terraria.ModLoader; -using Terraria.ID; using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { @@ -36,7 +36,7 @@ namespace CalamityMod.Projectiles.Rogue //Dust trail if (Main.rand.NextBool(13)) { - Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 180, Projectile.velocity.X * 0.25f, Projectile.velocity.Y * 0.25f, 150, default, 0.9f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.DungeonSpirit, Projectile.velocity.X * 0.25f, Projectile.velocity.Y * 0.25f, 150, default, 0.9f); } } @@ -67,7 +67,7 @@ namespace CalamityMod.Projectiles.Rogue int dust_splash = 0; while (dust_splash < 9) { - Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 180, -Projectile.velocity.X * 0.15f, -Projectile.velocity.Y * 0.15f, 120, default, 1.5f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.DungeonSpirit, -Projectile.velocity.X * 0.15f, -Projectile.velocity.Y * 0.15f, 120, default, 1.5f); dust_splash += 1; } // This only triggers if stealth is full @@ -99,7 +99,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Vector2 origin = new Vector2(32f, 33f); Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0); return false; diff --git a/Projectiles/Rogue/ApoctolithShard.cs b/Projectiles/Rogue/ApoctolithShard.cs index c4e0162d59..fe4943e690 100644 --- a/Projectiles/Rogue/ApoctolithShard.cs +++ b/Projectiles/Rogue/ApoctolithShard.cs @@ -1,8 +1,8 @@ -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.DamageOverTime; using Terraria; -using Terraria.ModLoader; -using Terraria.ID; using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { @@ -41,7 +41,7 @@ namespace CalamityMod.Projectiles.Rogue int splash = 0; while (splash < 4) { - Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 67, -Projectile.velocity.X * 0.15f, -Projectile.velocity.Y * 0.10f, 150, default, 0.9f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.IceRod, -Projectile.velocity.X * 0.15f, -Projectile.velocity.Y * 0.10f, 150, default, 0.9f); splash += 1; } } diff --git a/Projectiles/Rogue/AshenStalactiteDebris.cs b/Projectiles/Rogue/AshenStalactiteDebris.cs index ba0be04785..2d3f21e080 100644 --- a/Projectiles/Rogue/AshenStalactiteDebris.cs +++ b/Projectiles/Rogue/AshenStalactiteDebris.cs @@ -1,10 +1,10 @@ - + using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; -using Terraria.ModLoader; -using Terraria.ID; using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { @@ -41,7 +41,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } @@ -50,7 +50,7 @@ namespace CalamityMod.Projectiles.Rogue { for (int i = 0; i < 3; i++) { - Dust.NewDust(Projectile.Center, 1, 1, 1, Projectile.velocity.X, Projectile.velocity.Y); + Dust.NewDust(Projectile.Center, 1, 1, DustID.Stone, Projectile.velocity.X, Projectile.velocity.Y); } } } diff --git a/Projectiles/Rogue/AshenStalactiteProj.cs b/Projectiles/Rogue/AshenStalactiteProj.cs index 8bb6ed6809..b0baa5e4f5 100644 --- a/Projectiles/Rogue/AshenStalactiteProj.cs +++ b/Projectiles/Rogue/AshenStalactiteProj.cs @@ -1,10 +1,10 @@ +using System; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; -using Terraria.ModLoader; -using Terraria.ID; using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + MathHelper.ToRadians(45f); + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.ToRadians(45f); Projectile.velocity.Y += 0.1f; if (Projectile.velocity.Y > 16f) @@ -36,7 +36,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } @@ -53,7 +53,7 @@ namespace CalamityMod.Projectiles.Rogue { for (int i = 0; i < 10; i++) { - Dust.NewDust(Projectile.Center, 1, 1, 1, Projectile.velocity.X, Projectile.velocity.Y); + Dust.NewDust(Projectile.Center, 1, 1, DustID.Stone, Projectile.velocity.X, Projectile.velocity.Y); } } } diff --git a/Projectiles/Rogue/AshenStalagmiteProj.cs b/Projectiles/Rogue/AshenStalagmiteProj.cs index 8b8523aef5..2802db70f0 100644 --- a/Projectiles/Rogue/AshenStalagmiteProj.cs +++ b/Projectiles/Rogue/AshenStalagmiteProj.cs @@ -1,11 +1,11 @@  +using System; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; -using Terraria.ModLoader; -using Terraria.ID; using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { @@ -20,11 +20,13 @@ namespace CalamityMod.Projectiles.Rogue Projectile.penetrate = 2; Projectile.timeLeft = 100; Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() { - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 2.355f; + Projectile.rotation = Projectile.velocity.ToRotation() + 2.355f; Projectile.velocity.Y += 0.075f; if (Projectile.velocity.Y > 16f) @@ -43,7 +45,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } @@ -52,7 +54,7 @@ namespace CalamityMod.Projectiles.Rogue { for (int i = 0; i < 6; i++) { - int dustIndex = Dust.NewDust(Projectile.Center, 1, 1, 1, Projectile.velocity.X, Projectile.velocity.Y); + int dustIndex = Dust.NewDust(Projectile.Center, 1, 1, DustID.Stone, Projectile.velocity.X, Projectile.velocity.Y); Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Main.dust[dustIndex].velocity, ModContent.ProjectileType(), Projectile.damage / 2, 0, Projectile.owner, 0, 0); } } diff --git a/Projectiles/Rogue/AuroradicalSplitter.cs b/Projectiles/Rogue/AuroradicalSplitter.cs index c7ce86aa34..40d0ea5715 100644 --- a/Projectiles/Rogue/AuroradicalSplitter.cs +++ b/Projectiles/Rogue/AuroradicalSplitter.cs @@ -1,11 +1,11 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { public class AuroradicalSplitter : ModProjectile, ILocalizedModType @@ -115,7 +115,7 @@ namespace CalamityMod.Projectiles.Rogue int astral = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, Main.rand.Next(dustTypes), 0f, 0f, 0, default, 1.5f); Main.dust[astral].noGravity = true; Main.dust[astral].velocity *= 3f; - astral = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 173, 0f, 0f, 50, default, 1f); + astral = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, 0f, 0f, 50, default, 1f); Main.dust[astral].velocity *= 2f; Main.dust[astral].noGravity = true; } diff --git a/Projectiles/Rogue/AuroradicalStar.cs b/Projectiles/Rogue/AuroradicalStar.cs index 30c8ad5c1c..e577cdd132 100644 --- a/Projectiles/Rogue/AuroradicalStar.cs +++ b/Projectiles/Rogue/AuroradicalStar.cs @@ -1,12 +1,12 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { public class AuroradicalStar : ModProjectile, ILocalizedModType @@ -154,7 +154,7 @@ namespace CalamityMod.Projectiles.Rogue int astral = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, Main.rand.Next(dustTypes), 0f, 0f, 0, default, 1.5f); Main.dust[astral].noGravity = true; Main.dust[astral].velocity *= 3f; - astral = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 173, 0f, 0f, 50, default, 1f); + astral = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, 0f, 0f, 50, default, 1f); Main.dust[astral].velocity *= 2f; Main.dust[astral].noGravity = true; } diff --git a/Projectiles/Rogue/BallisticPoisonBombProj.cs b/Projectiles/Rogue/BallisticPoisonBombProj.cs index 146e849c21..1085f9f558 100644 --- a/Projectiles/Rogue/BallisticPoisonBombProj.cs +++ b/Projectiles/Rogue/BallisticPoisonBombProj.cs @@ -1,10 +1,9 @@ -using CalamityMod.Projectiles.Typeless; +using System; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -27,7 +26,7 @@ namespace CalamityMod.Projectiles.Rogue { if (Main.rand.NextBool(6)) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 14, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Demonite, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } Projectile.StickToTiles(true, false); if (Projectile.owner == Main.myPlayer && Projectile.timeLeft <= 3) @@ -59,24 +58,24 @@ namespace CalamityMod.Projectiles.Rogue { Projectile.ExpandHitboxBy(128); SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); - int projAmt = Main.rand.Next(3, 5); + int spikeAmt = Main.rand.Next(3, 4+1); if (Projectile.owner == Main.myPlayer) { - for (int s = 0; s < projAmt; s++) + for (int s = 0; s < spikeAmt; s++) { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage, 0f, Projectile.owner); } - int cloudAmt = Main.rand.Next(8, 13); + int cloudAmt = Projectile.Calamity().stealthStrike ? Main.rand.Next(8, 12+1) : Main.rand.Next(3, 5+1); for (int c = 0; c < cloudAmt; c++) { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 10f, 200f, 0.01f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), 0f, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.75), 0f, Projectile.owner, 0f, Projectile.Calamity().stealthStrike ? 1f : 0f); } } for (int d = 0; d < 5; d++) { - int boom = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 14, 0f, 0f, 100, default, 2f); + int boom = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Demonite, 0f, 0f, 100, default, 2f); Main.dust[boom].velocity *= 3f; if (Main.rand.NextBool()) { @@ -86,10 +85,10 @@ namespace CalamityMod.Projectiles.Rogue } for (int d = 0; d < 9; d++) { - int fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 3f); + int fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 3f); Main.dust[fire].noGravity = true; Main.dust[fire].velocity *= 5f; - fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 2f); + fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 2f); Main.dust[fire].velocity *= 2f; } diff --git a/Projectiles/Rogue/BallisticPoisonBombSpike.cs b/Projectiles/Rogue/BallisticPoisonBombSpike.cs index cf4b7624e4..00753344c8 100644 --- a/Projectiles/Rogue/BallisticPoisonBombSpike.cs +++ b/Projectiles/Rogue/BallisticPoisonBombSpike.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.localAI[1] += 1f; if (Projectile.localAI[1] > 4f) { - int dustt = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 14, 0f, 0f, 100, default, 0.75f); + int dustt = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Demonite, 0f, 0f, 100, default, 0.75f); Main.dust[dustt].noGravity = true; Main.dust[dustt].velocity *= 0f; } @@ -58,7 +58,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int i = 0; i < 2; i++) { - int smoke = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 14, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.2f); + int smoke = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Demonite, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.2f); Main.dust[smoke].velocity *= 3f; if (Main.rand.NextBool()) { @@ -68,10 +68,10 @@ namespace CalamityMod.Projectiles.Rogue } for (int j = 0; j < 2; j++) { - int fire = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 6, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.7f); + int fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.7f); Main.dust[fire].noGravity = true; Main.dust[fire].velocity *= 5f; - fire = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 6, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f); + fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f); Main.dust[fire].velocity *= 2f; } } diff --git a/Projectiles/Typeless/BallisticPoisonCloud.cs b/Projectiles/Rogue/BallisticPoisonCloud.cs similarity index 90% rename from Projectiles/Typeless/BallisticPoisonCloud.cs rename to Projectiles/Rogue/BallisticPoisonCloud.cs index c2b0ffd143..47f612c1ef 100644 --- a/Projectiles/Typeless/BallisticPoisonCloud.cs +++ b/Projectiles/Rogue/BallisticPoisonCloud.cs @@ -1,9 +1,9 @@ -using System; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Typeless +namespace CalamityMod.Projectiles.Rogue { public class BallisticPoisonCloud : ModProjectile, ILocalizedModType { @@ -62,8 +62,8 @@ namespace CalamityMod.Projectiles.Typeless } } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.Venom, 120); + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.Venom, Projectile.ai[1] == 1f ? 240 : 120); - public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(BuffID.Venom, 120); + public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(BuffID.Venom, Projectile.ai[1] == 1f ? 240 : 120); } } diff --git a/Projectiles/Typeless/BallisticPoisonCloud.png b/Projectiles/Rogue/BallisticPoisonCloud.png similarity index 100% rename from Projectiles/Typeless/BallisticPoisonCloud.png rename to Projectiles/Rogue/BallisticPoisonCloud.png diff --git a/Projectiles/Rogue/BettyExplosion.cs b/Projectiles/Rogue/BettyExplosion.cs index 6f0ccdfe74..7371583539 100644 --- a/Projectiles/Rogue/BettyExplosion.cs +++ b/Projectiles/Rogue/BettyExplosion.cs @@ -1,7 +1,7 @@ -using Terraria; +using Microsoft.Xna.Framework; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using Microsoft.Xna.Framework; namespace CalamityMod.Projectiles.Rogue { @@ -36,7 +36,7 @@ namespace CalamityMod.Projectiles.Rogue Vector2 corner = Projectile.position; for (int i = 0; i < 15; i++) { - int idx = Dust.NewDust(corner, Projectile.width, Projectile.height, 31, 0f, 0f, 100, default, 2f); + int idx = Dust.NewDust(corner, Projectile.width, Projectile.height, DustID.Smoke, 0f, 0f, 100, default, 2f); Main.dust[idx].velocity *= 3f; if (Main.rand.NextBool()) { @@ -46,10 +46,10 @@ namespace CalamityMod.Projectiles.Rogue } for (int i = 0; i < 25; i++) { - int idx = Dust.NewDust(corner, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 3f); + int idx = Dust.NewDust(corner, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 3f); Main.dust[idx].noGravity = true; Main.dust[idx].velocity *= 5f; - idx = Dust.NewDust(corner, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 2f); + idx = Dust.NewDust(corner, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 2f); Main.dust[idx].velocity *= 2f; } diff --git a/Projectiles/Rogue/BileExplosion.cs b/Projectiles/Rogue/BileExplosion.cs index 58379bb5ff..ac90bd0cd3 100644 --- a/Projectiles/Rogue/BileExplosion.cs +++ b/Projectiles/Rogue/BileExplosion.cs @@ -1,5 +1,5 @@ -using CalamityMod.Dusts; -using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; @@ -19,6 +19,8 @@ namespace CalamityMod.Projectiles.Rogue Projectile.penetrate = -1; Projectile.timeLeft = 60; Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 9; } public override void AI() @@ -35,24 +37,15 @@ namespace CalamityMod.Projectiles.Rogue for (int i = 0; i < 15; i++) { - Dust dust = Dust.NewDustPerfect(Projectile.Center, (int)CalamityDusts.SulfurousSeaAcid); + Dust dust = Dust.NewDustPerfect(Projectile.Center, (int)CalamityDusts.SulphurousSeaAcid); dust.velocity = Projectile.width / 33.333f * Vector2.One.RotatedByRandom(MathHelper.TwoPi); dust.scale = Projectile.width == 120 ? 3.1f : 2.2f; dust.noGravity = true; } } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - if (Projectile.ai[0] != 1f) - target.immune[Projectile.owner] = 9; + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 480); - target.AddBuff(ModContent.BuffType(), 480); - } - - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - target.AddBuff(ModContent.BuffType(), 480); - } + public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 480); } } diff --git a/Projectiles/Rogue/BlastBarrelProjectile.cs b/Projectiles/Rogue/BlastBarrelProjectile.cs index 1c98e21f11..390b2f5ba3 100644 --- a/Projectiles/Rogue/BlastBarrelProjectile.cs +++ b/Projectiles/Rogue/BlastBarrelProjectile.cs @@ -1,9 +1,9 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { diff --git a/Projectiles/Rogue/BlazingStarProj.cs b/Projectiles/Rogue/BlazingStarProj.cs index c3bc6eaade..acbeb72bc4 100644 --- a/Projectiles/Rogue/BlazingStarProj.cs +++ b/Projectiles/Rogue/BlazingStarProj.cs @@ -1,11 +1,11 @@ -using CalamityMod.Items.Weapons.Rogue; +using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Weapons.Rogue; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using CalamityMod.Buffs.DamageOverTime; -using System; namespace CalamityMod.Projectiles.Rogue { diff --git a/Projectiles/Rogue/BloodsoakedCrashax.cs b/Projectiles/Rogue/BloodsoakedCrashax.cs index 377d4ce7fe..7396b758ff 100644 --- a/Projectiles/Rogue/BloodsoakedCrashax.cs +++ b/Projectiles/Rogue/BloodsoakedCrashax.cs @@ -1,4 +1,6 @@ -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Balancing; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; using Terraria; @@ -85,15 +87,16 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - OnHitEffects(!target.canGhostHeal || Main.player[Projectile.owner].moonLeech); + if (target.lifeMax > 5) + OnHitEffects(hit.Damage); } public override void OnHitPlayer(Player target, Player.HurtInfo info) { - OnHitEffects(Main.player[Projectile.owner].moonLeech); + OnHitEffects(info.Damage); } - private void OnHitEffects(bool cannotLifesteal) + private void OnHitEffects(int damage) { grind += 5; //THE GRIND NEVER STOPS if (grind > 15) @@ -112,12 +115,14 @@ namespace CalamityMod.Projectiles.Rogue } } - if (cannotLifesteal || Main.rand.NextBool()) //canGhostHeal be like lol + int heal = (int)Math.Round(damage * 0.01); + if (heal > BalancingConstants.LifeStealCap) + heal = BalancingConstants.LifeStealCap; + + if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0) return; - Player player = Main.player[Projectile.owner]; - player.statLife += 1; - player.HealEffect(1); + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); } public override bool PreDraw(ref Color lightColor) //afterimages diff --git a/Projectiles/Rogue/BlueFlamePillar.cs b/Projectiles/Rogue/BlueFlamePillar.cs index a9a1f8bc99..4f97fc008e 100644 --- a/Projectiles/Rogue/BlueFlamePillar.cs +++ b/Projectiles/Rogue/BlueFlamePillar.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ModLoader; @@ -48,7 +48,7 @@ namespace CalamityMod.Projectiles.Rogue } public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Rectangle frame = new Rectangle(frameX * 80, frameY * 322, 80, 322); Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, frame, Color.White, Projectile.rotation, Projectile.Size / 2, 1f, SpriteEffects.None, 0); return false; diff --git a/Projectiles/Rogue/BlunderBoosterLightning.cs b/Projectiles/Rogue/BlunderBoosterLightning.cs index a6c2dfa5ae..dd935e3195 100644 --- a/Projectiles/Rogue/BlunderBoosterLightning.cs +++ b/Projectiles/Rogue/BlunderBoosterLightning.cs @@ -1,10 +1,10 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -45,7 +45,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.frame = 0; } - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; if (Projectile.timeLeft < 55 && Projectile.ai[1] != 1f) { diff --git a/Projectiles/Rogue/BouncingEyeballProjectile.cs b/Projectiles/Rogue/BouncingEyeballProjectile.cs index 33a1d609c0..22eaba59ad 100644 --- a/Projectiles/Rogue/BouncingEyeballProjectile.cs +++ b/Projectiles/Rogue/BouncingEyeballProjectile.cs @@ -1,9 +1,9 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; using static System.Math; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -28,10 +28,12 @@ namespace CalamityMod.Projectiles.Rogue Projectile.timeLeft = 300; Projectile.penetrate = 2; Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override bool OnTileCollide(Vector2 oldVelocity) { - SoundEngine.PlaySound(SoundID.NPCHit19 with { Volume = SoundID.NPCHit19.Volume * 0.7f}, Projectile.Center); + SoundEngine.PlaySound(SoundID.NPCHit19 with { Volume = SoundID.NPCHit19.Volume * 0.7f }, Projectile.Center); Bounces--; if (Bounces <= 0) { @@ -58,7 +60,7 @@ namespace CalamityMod.Projectiles.Rogue } public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.NPCHit19 with { Volume = SoundID.NPCHit19.Volume * 0.7f}, Projectile.Center); + SoundEngine.PlaySound(SoundID.NPCHit19 with { Volume = SoundID.NPCHit19.Volume * 0.7f }, Projectile.Center); int dustCount = Main.rand.Next(8, 16); for (int index = 0; index < dustCount; index++) { diff --git a/Projectiles/Rogue/BouncingEyeballProjectileStealthStrike.cs b/Projectiles/Rogue/BouncingEyeballProjectileStealthStrike.cs index 90b1ba8d9e..c8bd1fc82f 100644 --- a/Projectiles/Rogue/BouncingEyeballProjectileStealthStrike.cs +++ b/Projectiles/Rogue/BouncingEyeballProjectileStealthStrike.cs @@ -1,9 +1,9 @@ +using System; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -27,6 +27,8 @@ namespace CalamityMod.Projectiles.Rogue Projectile.timeLeft = 280; Projectile.penetrate = -1; Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() @@ -47,13 +49,13 @@ namespace CalamityMod.Projectiles.Rogue { Projectile.velocity = Main.rand.NextFloat(-1.15f, -0.85f) * oldVelocity * Bounciness; } - SoundEngine.PlaySound(SoundID.NPCHit19 with { Volume = SoundID.NPCHit19.Volume * 0.7f}, Projectile.Center); + SoundEngine.PlaySound(SoundID.NPCHit19 with { Volume = SoundID.NPCHit19.Volume * 0.7f }, Projectile.Center); return false; } public override void OnKill(int timeLeft) { // Explode into a large display of blood. - SoundEngine.PlaySound(SoundID.NPCHit19 with { Volume = SoundID.NPCHit19.Volume * 0.7f}, Projectile.Center); + SoundEngine.PlaySound(SoundID.NPCHit19 with { Volume = SoundID.NPCHit19.Volume * 0.7f }, Projectile.Center); int dustCount = Main.rand.Next(15, 26); for (int index = 0; index < dustCount; index++) { diff --git a/Projectiles/Rogue/BouncyBol.cs b/Projectiles/Rogue/BouncyBol.cs index 0d312c0f8d..5c62b6b6ef 100644 --- a/Projectiles/Rogue/BouncyBol.cs +++ b/Projectiles/Rogue/BouncyBol.cs @@ -1,5 +1,5 @@ +using System.Collections.Generic; using Microsoft.Xna.Framework; -using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Projectiles/Rogue/BrackishFlaskProj.cs b/Projectiles/Rogue/BrackishFlaskProj.cs index 009d3af467..f51c3460b9 100644 --- a/Projectiles/Rogue/BrackishFlaskProj.cs +++ b/Projectiles/Rogue/BrackishFlaskProj.cs @@ -1,9 +1,9 @@ using System; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { diff --git a/Projectiles/Rogue/BrackishSpear.cs b/Projectiles/Rogue/BrackishSpear.cs index 67c0fec4a6..00bc4c3b88 100644 --- a/Projectiles/Rogue/BrackishSpear.cs +++ b/Projectiles/Rogue/BrackishSpear.cs @@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Rogue { for (int i = 0; i < 8; i++) { - Dust blue = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, 206, Projectile.velocity.X * 0.005f, Projectile.velocity.Y * 0.005f, 200, default, 1f); + Dust blue = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.UnusedWhiteBluePurple, Projectile.velocity.X * 0.005f, Projectile.velocity.Y * 0.005f, 200, default, 1f); blue.noGravity = true; blue.velocity *= 0.5f; } @@ -70,7 +70,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.Kill(); } if (Main.rand.NextBool(4)) - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 206, Projectile.velocity.X * 0.005f, Projectile.velocity.Y * 0.005f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.UnusedWhiteBluePurple, Projectile.velocity.X * 0.005f, Projectile.velocity.Y * 0.005f); } // This is essential for Vilethorn-type projectiles, as velocity is a stored parameter and isn't supposed to actually move the projectile @@ -86,7 +86,7 @@ namespace CalamityMod.Projectiles.Rogue { for (int k = 0; k < 3; k++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 206, Projectile.oldVelocity.X * 0.005f, Projectile.oldVelocity.Y * 0.005f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.UnusedWhiteBluePurple, Projectile.oldVelocity.X * 0.005f, Projectile.oldVelocity.Y * 0.005f); } // Prevent recursion: the segments that are being spawned here will deliberately be set higher than total segments diff --git a/Projectiles/Rogue/BrackishWater.cs b/Projectiles/Rogue/BrackishWater.cs index d532d741a7..0a2ef3f6a7 100644 --- a/Projectiles/Rogue/BrackishWater.cs +++ b/Projectiles/Rogue/BrackishWater.cs @@ -1,8 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -35,7 +35,7 @@ namespace CalamityMod.Projectiles.Rogue 33, 89 }); - int water = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDust, 0f, 0f, 100, default, 1.2f); + int water = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, randomDust, 0f, 0f, 100, default, 1.2f); Main.dust[water].noGravity = true; Main.dust[water].velocity *= 0.5f; Main.dust[water].velocity += Projectile.velocity * 0.1f; diff --git a/Projectiles/Rogue/BrackishWaterBlast.cs b/Projectiles/Rogue/BrackishWaterBlast.cs index 7ffe7c14ff..e575a3f54a 100644 --- a/Projectiles/Rogue/BrackishWaterBlast.cs +++ b/Projectiles/Rogue/BrackishWaterBlast.cs @@ -1,9 +1,9 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -22,6 +22,8 @@ namespace CalamityMod.Projectiles.Rogue Projectile.penetrate = -1; Projectile.timeLeft = 60; Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 6; } public override void AI() @@ -81,7 +83,7 @@ namespace CalamityMod.Projectiles.Rogue randomAdjust = random3 / randomAdjust; random1 *= randomAdjust; random2 *= randomAdjust; - int water = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDust, 0f, 0f, 100, default, 0.5f); + int water = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, randomDust, 0f, 0f, 100, default, 0.5f); Dust dust = Main.dust[water]; dust.noGravity = true; dust.position.X = Projectile.Center.X; @@ -94,15 +96,8 @@ namespace CalamityMod.Projectiles.Rogue } } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.immune[Projectile.owner] = 6; - target.AddBuff(BuffID.Venom, 90); - } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.Venom, 90); - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - target.AddBuff(BuffID.Venom, 90); - } + public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(BuffID.Venom, 90); } } diff --git a/Projectiles/Rogue/Brick.cs b/Projectiles/Rogue/Brick.cs index 0520b3a573..5406504bad 100644 --- a/Projectiles/Rogue/Brick.cs +++ b/Projectiles/Rogue/Brick.cs @@ -1,8 +1,8 @@ -using Terraria; -using Terraria.ModLoader; -using CalamityMod.Items.Weapons.Rogue; -using Terraria.ID; +using CalamityMod.Items.Weapons.Rogue; +using Terraria; using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { @@ -31,7 +31,7 @@ namespace CalamityMod.Projectiles.Rogue //Dust trail if (Main.rand.NextBool(13)) { - Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 22, Projectile.velocity.X * 0.25f, Projectile.velocity.Y * 0.25f, 150, default, 0.9f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Pot, Projectile.velocity.X * 0.25f, Projectile.velocity.Y * 0.25f, 150, default, 0.9f); } } @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Rogue int dust_splash = 0; while (dust_splash < 9) { - Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 9, -Projectile.velocity.X * 0.15f, -Projectile.velocity.Y * 0.15f, 120, default, 1.5f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Copper, -Projectile.velocity.X * 0.15f, -Projectile.velocity.Y * 0.15f, 120, default, 1.5f); dust_splash += 1; } // This only triggers if stealth is full diff --git a/Projectiles/Rogue/BrickFragment.cs b/Projectiles/Rogue/BrickFragment.cs index b07492c592..47b929df0f 100644 --- a/Projectiles/Rogue/BrickFragment.cs +++ b/Projectiles/Rogue/BrickFragment.cs @@ -1,7 +1,7 @@ -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; +using Terraria; using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { @@ -36,7 +36,7 @@ namespace CalamityMod.Projectiles.Rogue int splash = 0; while (splash < 4) { - Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 9, -Projectile.velocity.X * 0.15f, -Projectile.velocity.Y * 0.10f, 150, default, 0.9f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Copper, -Projectile.velocity.X * 0.15f, -Projectile.velocity.Y * 0.10f, 150, default, 0.9f); splash += 1; } } diff --git a/Projectiles/Rogue/BurningStrifeProj.cs b/Projectiles/Rogue/BurningStrifeProj.cs index 8e504692ad..916024baa0 100644 --- a/Projectiles/Rogue/BurningStrifeProj.cs +++ b/Projectiles/Rogue/BurningStrifeProj.cs @@ -1,9 +1,9 @@ using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -80,7 +80,7 @@ namespace CalamityMod.Projectiles.Rogue { int proj; SoundEngine.PlaySound(SoundID.Item103, Projectile.Center); - if(Projectile.Calamity().stealthStrike) + if (Projectile.Calamity().stealthStrike) proj = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.33), Projectile.knockBack, Projectile.owner); else proj = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.33), Projectile.knockBack, Projectile.owner); diff --git a/Projectiles/Rogue/ButcherKnife.cs b/Projectiles/Rogue/ButcherKnife.cs index 0d8431d581..3cf2ecce4f 100644 --- a/Projectiles/Rogue/ButcherKnife.cs +++ b/Projectiles/Rogue/ButcherKnife.cs @@ -1,5 +1,5 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -37,7 +37,7 @@ namespace CalamityMod.Projectiles.Rogue { if (Main.rand.NextBool()) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 5, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Blood, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } DrawOffsetX = -11; DrawOriginOffsetY = -10; diff --git a/Projectiles/Rogue/CarvingFork.cs b/Projectiles/Rogue/CarvingFork.cs index b43b00e7a6..6a4d2fb686 100644 --- a/Projectiles/Rogue/CarvingFork.cs +++ b/Projectiles/Rogue/CarvingFork.cs @@ -32,9 +32,9 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { - if (Main.rand.Next(5) == 0) + if (Main.rand.NextBool(5)) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 5, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Blood, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); diff --git a/Projectiles/Rogue/CelestialReaperAfterimage.cs b/Projectiles/Rogue/CelestialReaperAfterimage.cs index ded445855d..28d2198142 100644 --- a/Projectiles/Rogue/CelestialReaperAfterimage.cs +++ b/Projectiles/Rogue/CelestialReaperAfterimage.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.tileCollide = false; Projectile.DamageType = RogueDamageClass.Instance; Projectile.timeLeft = 180; - Projectile.Calamity().CannotProc=true; + Projectile.Calamity().CannotProc = true; } public override bool? CanHitNPC(NPC target) => Projectile.timeLeft < 150 && target.CanBeChasedBy(Projectile); diff --git a/Projectiles/Rogue/CelestialReaperProjectile.cs b/Projectiles/Rogue/CelestialReaperProjectile.cs index 3bbcea2ba9..a75bd9ccdc 100644 --- a/Projectiles/Rogue/CelestialReaperProjectile.cs +++ b/Projectiles/Rogue/CelestialReaperProjectile.cs @@ -1,5 +1,5 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; diff --git a/Projectiles/Rogue/CelestusProj.cs b/Projectiles/Rogue/CelestusProj.cs index f9b37067cd..4b226f24f5 100644 --- a/Projectiles/Rogue/CelestusProj.cs +++ b/Projectiles/Rogue/CelestusProj.cs @@ -1,11 +1,11 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; -using System; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using Microsoft.Xna.Framework.Graphics; namespace CalamityMod.Projectiles.Rogue { diff --git a/Projectiles/Rogue/CinquedeaProj.cs b/Projectiles/Rogue/CinquedeaProj.cs index b6d77b36fc..7bd04a0b07 100644 --- a/Projectiles/Rogue/CinquedeaProj.cs +++ b/Projectiles/Rogue/CinquedeaProj.cs @@ -1,8 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -28,6 +28,8 @@ namespace CalamityMod.Projectiles.Rogue Projectile.tileCollide = false; Projectile.extraUpdates = 1; Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() @@ -89,7 +91,6 @@ namespace CalamityMod.Projectiles.Rogue } } } - public override bool OnTileCollide(Vector2 oldVelocity) { Collision.HitTiles(Projectile.position + Projectile.velocity, Projectile.velocity, Projectile.width, Projectile.height); diff --git a/Projectiles/Rogue/CircletMark.cs b/Projectiles/Rogue/CircletMark.cs index 8e5e9bbaa9..d3d27dd67c 100644 --- a/Projectiles/Rogue/CircletMark.cs +++ b/Projectiles/Rogue/CircletMark.cs @@ -47,7 +47,7 @@ namespace CalamityMod.Projectiles.Rogue dustMovement.X *= -1f; Vector2 dustMovement2 = new Vector2(2f, 10f); Vector2 position4 = Projectile.Center + new Vector2(60f, 200f) * dustMovement * 0.5f + dustMovement2; - Dust dust = Main.dust[Dust.NewDust(position4, 0, 0, 269, 0f, 0f, 0, default, 0.5f)]; + Dust dust = Main.dust[Dust.NewDust(position4, 0, 0, DustID.Sandnado, 0f, 0f, 0, default, 0.5f)]; dust.position = position4; dust.customData = Projectile.Center + dustMovement2; dust.fadeIn = 1f; @@ -98,7 +98,7 @@ namespace CalamityMod.Projectiles.Rogue if (Main.rand.NextBool(10)) { Vector2 dustVel = Vector2.UnitY.RotatedBy((double)((float)j * 3.14159274f), default).RotatedBy((double)Projectile.rotation, default); - Dust dusty = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, 269, 0f, 0f, 225, newColor3, 1f)]; + Dust dusty = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, DustID.Sandnado, 0f, 0f, 225, newColor3, 1f)]; dusty.noGravity = true; dusty.noLight = true; dusty.scale = Projectile.Opacity * Projectile.localAI[0]; @@ -111,7 +111,7 @@ namespace CalamityMod.Projectiles.Rogue if (Main.rand.NextBool(10)) { Vector2 dustVel2 = Vector2.UnitY.RotatedBy((double)((float)k * 3.14159274f), default); - Dust dustier = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, 269, 0f, 0f, 225, newColor3, 1.5f)]; + Dust dustier = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, DustID.Sandnado, 0f, 0f, 225, newColor3, 1.5f)]; dustier.noGravity = true; dustier.noLight = true; dustier.scale = Projectile.Opacity * Projectile.localAI[0]; @@ -145,7 +145,7 @@ namespace CalamityMod.Projectiles.Rogue spriteEffects = SpriteEffects.FlipHorizontally; } Vector2 drawPos = Projectile.position + new Vector2((float)Projectile.width, (float)Projectile.height) / 2f + Vector2.UnitY * Projectile.gfxOffY - Main.screenPosition; - Texture2D texture2D27 = ModContent.Request(Texture).Value; + Texture2D texture2D27 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Rectangle rectangle = texture2D27.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); Color alphaColor = Projectile.GetAlpha(originalColor); Vector2 origin7 = rectangle.Size() / 2f; diff --git a/Projectiles/Rogue/CircletTornado.cs b/Projectiles/Rogue/CircletTornado.cs index b094a596d1..083ef42cd3 100644 --- a/Projectiles/Rogue/CircletTornado.cs +++ b/Projectiles/Rogue/CircletTornado.cs @@ -140,7 +140,7 @@ namespace CalamityMod.Projectiles.Rogue Vector2 sizeModdingPos = new Vector2(0f, sizeModdingVector2.Y - sizeModdingVector.Y); sizeModdingPos.X = sizeModdingPos.Y * vectorMult; new Vector2(sizeModdingVector.X - sizeModdingPos.X / 2f, sizeModdingVector.Y); - Texture2D texture2D23 = ModContent.Request(Texture).Value; + Texture2D texture2D23 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Rectangle drawRectangle = texture2D23.Frame(1, 1, 0, 0); Vector2 smallRect = drawRectangle.Size() / 2f; float aiTrackMult = -0.06283186f * aiTracker; diff --git a/Projectiles/Rogue/CobaltEnergy.cs b/Projectiles/Rogue/CobaltEnergy.cs index 69d3ed5d4e..0d43432bde 100644 --- a/Projectiles/Rogue/CobaltEnergy.cs +++ b/Projectiles/Rogue/CobaltEnergy.cs @@ -1,10 +1,10 @@ -using Microsoft.Xna.Framework; +using System.Collections.Generic; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System.Collections.Generic; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -33,7 +33,7 @@ namespace CalamityMod.Projectiles.Rogue { for (int index = 0; index < 2; ++index) { - int ruby = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 88, Projectile.velocity.X, Projectile.velocity.Y, 90, new Color(), 1.2f); + int ruby = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GemSapphire, Projectile.velocity.X, Projectile.velocity.Y, 90, new Color(), 1.2f); Dust dust = Main.dust[ruby]; dust.noGravity = true; dust.velocity *= 0.3f; @@ -41,7 +41,7 @@ namespace CalamityMod.Projectiles.Rogue if (!hasHitEnemy && Projectile.timeLeft < 575) { - CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 200f, 12f, 20f); + CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 288f, 12f, 20f); } else if (hasHitEnemy) { @@ -108,7 +108,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } @@ -118,7 +118,7 @@ namespace CalamityMod.Projectiles.Rogue SoundEngine.PlaySound(SoundID.Dig, Projectile.position); for (int index1 = 0; index1 < 15; ++index1) { - int ruby = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 88, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 50, new Color(), 1.2f); + int ruby = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GemSapphire, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 50, new Color(), 1.2f); Dust dust = Main.dust[ruby]; dust.noGravity = true; dust.scale *= 1.25f; diff --git a/Projectiles/Rogue/CobaltKunaiProjectile.cs b/Projectiles/Rogue/CobaltKunaiProjectile.cs index b587d77613..6113862dfa 100644 --- a/Projectiles/Rogue/CobaltKunaiProjectile.cs +++ b/Projectiles/Rogue/CobaltKunaiProjectile.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.timeLeft = Lifetime; Projectile.DamageType = RogueDamageClass.Instance; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; + Projectile.localNPCHitCooldown = 30; } //Throwing Knive code sucks, so doing it manually so I can increase its range @@ -57,7 +57,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } diff --git a/Projectiles/Rogue/ConsecratedWaterProjectile.cs b/Projectiles/Rogue/ConsecratedWaterProjectile.cs index f3af5bc17e..872a0e4f48 100644 --- a/Projectiles/Rogue/ConsecratedWaterProjectile.cs +++ b/Projectiles/Rogue/ConsecratedWaterProjectile.cs @@ -1,9 +1,9 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; using Terraria.WorldBuilding; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -40,7 +40,7 @@ namespace CalamityMod.Projectiles.Rogue public override void OnKill(int timeLeft) { //Dust - for (int i = 0; i< 30;i++) + for (int i = 0; i < 30; i++) { Vector2 dspeed = new Vector2(Main.rand.NextFloat(-4f, 4f), Main.rand.NextFloat(-4f, 4f)); Dust.NewDust(Projectile.Center, 1, 1, DustID.BlueCrystalShard, dspeed.X, dspeed.Y, 0, default, 1.1f); diff --git a/Projectiles/Rogue/ContaminatedBileFlask.cs b/Projectiles/Rogue/ContaminatedBileFlask.cs index 3889a8c529..93140dc3f7 100644 --- a/Projectiles/Rogue/ContaminatedBileFlask.cs +++ b/Projectiles/Rogue/ContaminatedBileFlask.cs @@ -1,8 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { diff --git a/Projectiles/Rogue/CorpusAvertorClone.cs b/Projectiles/Rogue/CorpusAvertorClone.cs index 7250fd4dba..01589210b9 100644 --- a/Projectiles/Rogue/CorpusAvertorClone.cs +++ b/Projectiles/Rogue/CorpusAvertorClone.cs @@ -1,5 +1,6 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using CalamityMod.Balancing; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -70,32 +71,26 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - float heal = hit.Damage * 0.05f; - if ((int)heal == 0) + int heal = (int)Math.Round(hit.Damage * 0.05); + if (heal > BalancingConstants.LifeStealCap) + heal = BalancingConstants.LifeStealCap; + + if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) return; - if (Main.player[Main.myPlayer].lifeSteal <= 0f) - return; - - if (heal > CalamityMod.lifeStealCap) - heal = CalamityMod.lifeStealCap; - - CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, 1200f, 3f); + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); } public override void OnHitPlayer(Player target, Player.HurtInfo info) { - float heal = info.Damage * 0.05f; - if ((int)heal == 0) + int heal = (int)Math.Round(info.Damage * 0.05); + if (heal > BalancingConstants.LifeStealCap) + heal = BalancingConstants.LifeStealCap; + + if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0) return; - if (Main.player[Main.myPlayer].lifeSteal <= 0f) - return; - - if (heal > CalamityMod.lifeStealCap) - heal = CalamityMod.lifeStealCap; - - CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, 1200f, 3f); + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); } } } diff --git a/Projectiles/Rogue/CorpusAvertorProj.cs b/Projectiles/Rogue/CorpusAvertorProj.cs index 199fa3d986..f0411b6978 100644 --- a/Projectiles/Rogue/CorpusAvertorProj.cs +++ b/Projectiles/Rogue/CorpusAvertorProj.cs @@ -1,5 +1,6 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using CalamityMod.Balancing; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -53,7 +54,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.velocity.Y *= 1.01f; int scale = (int)((Projectile.ai[0] - 60f) * 4.25f); - int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 5, 0f, 0f, 100, new Color(scale, 0, 0, 50), 2f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Blood, 0f, 0f, 100, new Color(scale, 0, 0, 50), 2f); Main.dust[dust].velocity *= 0f; Main.dust[dust].noGravity = true; } @@ -77,32 +78,26 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - float heal = hit.Damage * 0.05f; - if ((int)heal == 0) + int heal = (int)Math.Round(hit.Damage * 0.05); + if (heal > BalancingConstants.LifeStealCap) + heal = BalancingConstants.LifeStealCap; + + if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) return; - if (Main.player[Main.myPlayer].lifeSteal <= 0f) - return; - - if (heal > CalamityMod.lifeStealCap) - heal = CalamityMod.lifeStealCap; - - CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, 1200f, 3f); + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); } public override void OnHitPlayer(Player target, Player.HurtInfo info) { - float heal = info.Damage * 0.05f; - if ((int)heal == 0) + int heal = ((int)Math.Round(info.Damage * 0.05)); + if (heal > BalancingConstants.LifeStealCap) + heal = BalancingConstants.LifeStealCap; + + if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0) return; - if (Main.player[Main.myPlayer].lifeSteal <= 0f) - return; - - if (heal > CalamityMod.lifeStealCap) - heal = CalamityMod.lifeStealCap; - - CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, 1200f, 3f); + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); } } } diff --git a/Projectiles/Rogue/CorpusAvertorStealth.cs b/Projectiles/Rogue/CorpusAvertorStealth.cs index cce0fc74e3..57c49b9897 100644 --- a/Projectiles/Rogue/CorpusAvertorStealth.cs +++ b/Projectiles/Rogue/CorpusAvertorStealth.cs @@ -1,6 +1,7 @@ -using CalamityMod.Buffs.StatBuffs; +using System; +using CalamityMod.Balancing; +using CalamityMod.Buffs.StatBuffs; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -40,7 +41,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.velocity.Y *= 1.01f; int scale = (int)((Projectile.ai[0] - 60f) * 4.25f); - int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 5, 0f, 0f, 100, new Color(scale, 0, 0, 50), 2f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Blood, 0f, 0f, 100, new Color(scale, 0, 0, 50), 2f); Main.dust[dust].velocity *= 0f; Main.dust[dust].noGravity = true; } @@ -55,7 +56,8 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - OnHitEffects(hit.Damage); + if (target.lifeMax > 5) + OnHitEffects(hit.Damage); } public override void OnHitPlayer(Player target, Player.HurtInfo info) @@ -80,17 +82,14 @@ namespace CalamityMod.Projectiles.Rogue Main.LocalPlayer.AddBuff(ModContent.BuffType(), CalamityUtils.SecondsToFrames(20f), true); player.AddBuff(ModContent.BuffType(), CalamityUtils.SecondsToFrames(20f), true); - float heal = damage * 0.025f; - if ((int)heal == 0) + int heal = (int)Math.Round(damage * 0.025); + if (heal > BalancingConstants.LifeStealCap) + heal = BalancingConstants.LifeStealCap; + + if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0) return; - if (Main.player[Main.myPlayer].lifeSteal <= 0f) - return; - - if (heal > CalamityMod.lifeStealCap) - heal = CalamityMod.lifeStealCap; - - CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, player, heal, ProjectileID.VampireHeal, 1200f, 3f); + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, player, heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); } } } diff --git a/Projectiles/Rogue/Corrocloud1.cs b/Projectiles/Rogue/Corrocloud1.cs index 7a9ef4c2cf..206005a920 100644 --- a/Projectiles/Rogue/Corrocloud1.cs +++ b/Projectiles/Rogue/Corrocloud1.cs @@ -1,6 +1,7 @@ -using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue @@ -39,19 +40,19 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(BuffID.Poisoned, 120); } public override void OnHitPlayer(Player target, Player.HurtInfo info) { - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(BuffID.Poisoned, 120); } public override void OnKill(int timeLeft) { for (int i = 0; i < 8; i++) { - Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.SulfurousSeaAcid); + Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.SulphurousSeaAcid); } } } diff --git a/Projectiles/Rogue/Corrocloud2.cs b/Projectiles/Rogue/Corrocloud2.cs index fde0006e69..67711f3448 100644 --- a/Projectiles/Rogue/Corrocloud2.cs +++ b/Projectiles/Rogue/Corrocloud2.cs @@ -1,6 +1,7 @@ -using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue @@ -39,19 +40,19 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(BuffID.Poisoned, 120); } public override void OnHitPlayer(Player target, Player.HurtInfo info) { - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(BuffID.Poisoned, 120); } public override void OnKill(int timeLeft) { for (int i = 0; i < 8; i++) { - Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.SulfurousSeaAcid); + Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.SulphurousSeaAcid); } } } diff --git a/Projectiles/Rogue/Corrocloud3.cs b/Projectiles/Rogue/Corrocloud3.cs index e3000a8913..720440764a 100644 --- a/Projectiles/Rogue/Corrocloud3.cs +++ b/Projectiles/Rogue/Corrocloud3.cs @@ -1,6 +1,7 @@ -using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue @@ -39,19 +40,19 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(BuffID.Poisoned, 120); } public override void OnHitPlayer(Player target, Player.HurtInfo info) { - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(BuffID.Poisoned, 120); } public override void OnKill(int timeLeft) { for (int i = 0; i < 8; i++) { - Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.SulfurousSeaAcid); + Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.SulphurousSeaAcid); } } } diff --git a/Projectiles/Rogue/CosmicKunaiProj.cs b/Projectiles/Rogue/CosmicKunaiProj.cs index 74f6023bd9..ce32ce7a81 100644 --- a/Projectiles/Rogue/CosmicKunaiProj.cs +++ b/Projectiles/Rogue/CosmicKunaiProj.cs @@ -1,4 +1,4 @@ -using System; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue @@ -17,12 +17,14 @@ namespace CalamityMod.Projectiles.Rogue Projectile.ignoreWater = true; Projectile.penetrate = 1; Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; } public override void AI() { - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; - Projectile.alpha += 17; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + Projectile.alpha += (Projectile.Calamity().stealthStrike ? 11 : 17); if (Projectile.alpha >= 255) { Projectile.Kill(); diff --git a/Projectiles/Rogue/CosmicScythe.cs b/Projectiles/Rogue/CosmicScythe.cs index dc06778580..41d1a8092b 100644 --- a/Projectiles/Rogue/CosmicScythe.cs +++ b/Projectiles/Rogue/CosmicScythe.cs @@ -1,9 +1,9 @@ using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -32,12 +32,14 @@ namespace CalamityMod.Projectiles.Rogue Projectile.penetrate = 5; Projectile.DamageType = RogueDamageClass.Instance; Projectile.extraUpdates = 1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; } public override void AI() { Projectile.rotation += 0.5f * (float)Projectile.direction; - int shadow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 1f); + int shadow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, 0f, 0f, 100, default, 1f); Main.dust[shadow].noGravity = true; Main.dust[shadow].velocity *= 0f; Projectile.velocity *= 0.95f; @@ -72,7 +74,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.ExpandHitboxBy(50); for (int d = 0; d < 4; d++) { - int shadow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 27, 0f, 0f, 100, default, 2f); + int shadow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Shadowflame, 0f, 0f, 100, default, 2f); Main.dust[shadow].velocity *= 3f; if (Main.rand.NextBool()) { @@ -82,10 +84,10 @@ namespace CalamityMod.Projectiles.Rogue } for (int d = 0; d < 12; d++) { - int shadow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 27, 0f, 0f, 100, default, 3f); + int shadow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Shadowflame, 0f, 0f, 100, default, 3f); Main.dust[shadow].noGravity = true; Main.dust[shadow].velocity *= 5f; - shadow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 27, 0f, 0f, 100, default, 2f); + shadow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Shadowflame, 0f, 0f, 100, default, 2f); Main.dust[shadow].velocity *= 2f; } } diff --git a/Projectiles/Rogue/CraniumSMASH.cs b/Projectiles/Rogue/CraniumSMASH.cs index da28ef4f0f..ed0d560383 100644 --- a/Projectiles/Rogue/CraniumSMASH.cs +++ b/Projectiles/Rogue/CraniumSMASH.cs @@ -1,8 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; -using Terraria.ModLoader; -using Terraria.ID; using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { @@ -83,7 +83,7 @@ namespace CalamityMod.Projectiles.Rogue for (int i = 0; i < 25; i++) { - int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 135, 0f, 0f, 100, default, 2f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.IceTorch, 0f, 0f, 100, default, 2f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 0f; } diff --git a/Projectiles/Rogue/CraniumSmasherExplosive.cs b/Projectiles/Rogue/CraniumSmasherExplosive.cs index 674eda9595..81c22a57e6 100644 --- a/Projectiles/Rogue/CraniumSmasherExplosive.cs +++ b/Projectiles/Rogue/CraniumSmasherExplosive.cs @@ -1,8 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -93,7 +93,7 @@ namespace CalamityMod.Projectiles.Rogue for (int i = 0; i < 25; i++) { - int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 135, 0f, 0f, 100, default, 2f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.IceTorch, 0f, 0f, 100, default, 2f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 0f; } diff --git a/Projectiles/Rogue/CraniumSmasherProj.cs b/Projectiles/Rogue/CraniumSmasherProj.cs index 88b169088d..ed8559ee80 100644 --- a/Projectiles/Rogue/CraniumSmasherProj.cs +++ b/Projectiles/Rogue/CraniumSmasherProj.cs @@ -1,6 +1,8 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Rogue { public class CraniumSmasherProj : ModProjectile, ILocalizedModType @@ -38,8 +40,8 @@ namespace CalamityMod.Projectiles.Rogue { for (int i = 0; i < 5; i++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 5, Projectile.oldVelocity.X / 2, Projectile.oldVelocity.Y / 2, 0, default, 2f); - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 6, Projectile.oldVelocity.X / 2, Projectile.oldVelocity.Y / 2, 0, default, 1f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Blood, Projectile.oldVelocity.X / 2, Projectile.oldVelocity.Y / 2, 0, default, 2f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Torch, Projectile.oldVelocity.X / 2, Projectile.oldVelocity.Y / 2, 0, default, 1f); } } diff --git a/Projectiles/Rogue/CraniumSmasherStealth.cs b/Projectiles/Rogue/CraniumSmasherStealth.cs index 1eedabc6b5..08b9cf9f6f 100644 --- a/Projectiles/Rogue/CraniumSmasherStealth.cs +++ b/Projectiles/Rogue/CraniumSmasherStealth.cs @@ -1,9 +1,9 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; -using Terraria.ModLoader; -using Terraria.ID; using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { @@ -115,7 +115,7 @@ namespace CalamityMod.Projectiles.Rogue for (int i = 0; i < 25; i++) { - int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 135, 0f, 0f, 100, default, 2f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.IceTorch, 0f, 0f, 100, default, 2f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 0f; } diff --git a/Projectiles/Rogue/Crushax.cs b/Projectiles/Rogue/Crushax.cs index 45d14a7759..e4faf91f2e 100644 --- a/Projectiles/Rogue/Crushax.cs +++ b/Projectiles/Rogue/Crushax.cs @@ -22,6 +22,8 @@ namespace CalamityMod.Projectiles.Rogue Projectile.localNPCHitCooldown = 12; AIType = ProjectileID.ThrowingKnife; Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 7; } public override void AI() @@ -52,20 +54,13 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.immune[Projectile.owner] = 7; - target.AddBuff(ModContent.BuffType(), 180); - } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 180); - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - target.AddBuff(ModContent.BuffType(), 180); - } + public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 180); } } diff --git a/Projectiles/Rogue/CrystalPiercerProjectile.cs b/Projectiles/Rogue/CrystalPiercerProjectile.cs index c18d4d5719..0e52f58ddb 100644 --- a/Projectiles/Rogue/CrystalPiercerProjectile.cs +++ b/Projectiles/Rogue/CrystalPiercerProjectile.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Projectiles.Rogue { if (Main.rand.NextBool(3)) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 173, Projectile.velocity.X * 0.1f, Projectile.velocity.Y * 0.1f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, Projectile.velocity.X * 0.1f, Projectile.velocity.Y * 0.1f); } Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); @@ -70,7 +70,7 @@ namespace CalamityMod.Projectiles.Rogue { for (int k = 0; k < 5; k++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 173, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } diff --git a/Projectiles/Rogue/CrystalPiercerShard.cs b/Projectiles/Rogue/CrystalPiercerShard.cs index c381ac9763..2fe39d5f99 100644 --- a/Projectiles/Rogue/CrystalPiercerShard.cs +++ b/Projectiles/Rogue/CrystalPiercerShard.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; diff --git a/Projectiles/Rogue/Crystalline2.cs b/Projectiles/Rogue/Crystalline2.cs index 23dbe71921..b01506837b 100644 --- a/Projectiles/Rogue/Crystalline2.cs +++ b/Projectiles/Rogue/Crystalline2.cs @@ -46,7 +46,7 @@ namespace CalamityMod.Projectiles.Rogue { if (Projectile.timeLeft == (Projectile.ai[1] == 2f ? 20 : 30)) return false; - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } @@ -55,7 +55,7 @@ namespace CalamityMod.Projectiles.Rogue { for (int k = 0; k < 5; k++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 154, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Rain, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } if (Projectile.ai[1] >= 1f) { diff --git a/Projectiles/Rogue/CrystallineProj.cs b/Projectiles/Rogue/CrystallineProj.cs index dc79f1bd15..fff8a5a9d5 100644 --- a/Projectiles/Rogue/CrystallineProj.cs +++ b/Projectiles/Rogue/CrystallineProj.cs @@ -1,9 +1,9 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { public class CrystallineProj : ModProjectile, ILocalizedModType @@ -45,7 +45,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } @@ -55,7 +55,7 @@ namespace CalamityMod.Projectiles.Rogue SoundEngine.PlaySound(SoundID.Item27, Projectile.position); for (int k = 0; k < 5; k++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 154, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Rain, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } } diff --git a/Projectiles/Rogue/CursedDaggerBlastHitbox.cs b/Projectiles/Rogue/CursedDaggerBlastHitbox.cs index 4e75f956fd..2c2f129f03 100644 --- a/Projectiles/Rogue/CursedDaggerBlastHitbox.cs +++ b/Projectiles/Rogue/CursedDaggerBlastHitbox.cs @@ -1,15 +1,15 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using System.Reflection.Metadata; +using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; using Terraria.Utilities; -using CalamityMod.Items.Weapons.Rogue; using static Humanizer.In; -using CalamityMod.Dusts; -using CalamityMod.Particles; -using System.Reflection.Metadata; namespace CalamityMod.Projectiles.Rogue { diff --git a/Projectiles/Rogue/CursedDaggerProj.cs b/Projectiles/Rogue/CursedDaggerProj.cs index 7c03608f65..90127ca24c 100644 --- a/Projectiles/Rogue/CursedDaggerProj.cs +++ b/Projectiles/Rogue/CursedDaggerProj.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Projectiles.Rogue { if (Main.rand.NextBool(Projectile.Calamity().stealthStrike ? 3 : 7)) { - Dust dust = Main.dust[Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, (int)CalamityDusts.SulfurousSeaAcid, Projectile.velocity.X * -3f, Projectile.velocity.Y * -3f, 0, default, Projectile.Calamity().stealthStrike ? Main.rand.NextFloat(2.5f, 3.2f) : 1.5f)]; + Dust dust = Main.dust[Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, (int)CalamityDusts.SulphurousSeaAcid, Projectile.velocity.X * -3f, Projectile.velocity.Y * -3f, 0, default, Projectile.Calamity().stealthStrike ? Main.rand.NextFloat(2.5f, 3.2f) : 1.5f)]; dust.noGravity = true; } @@ -61,7 +61,7 @@ namespace CalamityMod.Projectiles.Rogue int numberofdusts = Projectile.Calamity().stealthStrike ? 14 : 5; for (int i = 0; i <= numberofdusts; i++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, (int)CalamityDusts.SulfurousSeaAcid, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, (int)CalamityDusts.SulphurousSeaAcid, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } if (Projectile.Calamity().stealthStrike) { @@ -72,7 +72,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } diff --git a/Projectiles/Rogue/DeepSeaDumbbell1.cs b/Projectiles/Rogue/DeepSeaDumbbell1.cs index d90453c278..7c58cfb78b 100644 --- a/Projectiles/Rogue/DeepSeaDumbbell1.cs +++ b/Projectiles/Rogue/DeepSeaDumbbell1.cs @@ -1,10 +1,10 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; -using System; using Terraria; -using Terraria.ModLoader; -using Terraria.ID; using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { diff --git a/Projectiles/Rogue/DeepSeaDumbbell2.cs b/Projectiles/Rogue/DeepSeaDumbbell2.cs index 9922b73806..6a1671bc6e 100644 --- a/Projectiles/Rogue/DeepSeaDumbbell2.cs +++ b/Projectiles/Rogue/DeepSeaDumbbell2.cs @@ -1,10 +1,10 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; -using System; using Terraria; -using Terraria.ModLoader; -using Terraria.ID; using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { diff --git a/Projectiles/Rogue/DeepSeaDumbbell3.cs b/Projectiles/Rogue/DeepSeaDumbbell3.cs index 35e4a9e04f..f1f25a14da 100644 --- a/Projectiles/Rogue/DeepSeaDumbbell3.cs +++ b/Projectiles/Rogue/DeepSeaDumbbell3.cs @@ -1,10 +1,10 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; -using System; using Terraria; -using Terraria.ModLoader; -using Terraria.ID; using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { diff --git a/Projectiles/Rogue/DeepSeaDumbbellWeight.cs b/Projectiles/Rogue/DeepSeaDumbbellWeight.cs index 3e872c44db..c5953a8397 100644 --- a/Projectiles/Rogue/DeepSeaDumbbellWeight.cs +++ b/Projectiles/Rogue/DeepSeaDumbbellWeight.cs @@ -1,10 +1,10 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; -using System; using Terraria; -using Terraria.ModLoader; -using Terraria.ID; using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { @@ -47,7 +47,7 @@ namespace CalamityMod.Projectiles.Rogue Vector2 weightVel = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.25f; weightVel = weightVel.RotatedBy((double)((float)(i - (constant / 2 - 1)) * 6.28318548f / (float)constant), default) + Projectile.Center; Vector2 dustVel = weightVel - Projectile.Center; - int dusty = Dust.NewDust(weightVel + dustVel, 0, 0, 33, dustVel.X, dustVel.Y, 100, default, 1f); + int dusty = Dust.NewDust(weightVel + dustVel, 0, 0, DustID.Water, dustVel.X, dustVel.Y, 100, default, 1f); Main.dust[dusty].noGravity = true; Main.dust[dusty].velocity = dustVel; } diff --git a/Projectiles/Rogue/DeepWounderProjectile.cs b/Projectiles/Rogue/DeepWounderProjectile.cs index 292745e84a..3cbadfac87 100644 --- a/Projectiles/Rogue/DeepWounderProjectile.cs +++ b/Projectiles/Rogue/DeepWounderProjectile.cs @@ -1,11 +1,11 @@ -using CalamityMod.Buffs.StatDebuffs; -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; -using Terraria.ModLoader; -using Terraria.ID; using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { @@ -20,7 +20,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.height = 20; Projectile.friendly = true; Projectile.ignoreWater = true; - Projectile.penetrate = -1; + Projectile.penetrate = 3; Projectile.timeLeft = 600; Projectile.DamageType = RogueDamageClass.Instance; Projectile.usesLocalNPCImmunity = true; @@ -39,7 +39,7 @@ namespace CalamityMod.Projectiles.Rogue for (int i = 0; i < 30; i++) { - int dust = Dust.NewDust(spriteCenter, spriteWidth, spriteHeight, 33, Projectile.velocity.X * 0.1f, Projectile.velocity.Y * 0.1f, 0, default, 1f); + int dust = Dust.NewDust(spriteCenter, spriteWidth, spriteHeight, DustID.Water, Projectile.velocity.X * 0.1f, Projectile.velocity.Y * 0.1f, 0, default, 1f); Main.dust[dust].noGravity = true; } @@ -48,7 +48,7 @@ namespace CalamityMod.Projectiles.Rogue Vector2 waterVelocity = new Vector2(Main.rand.NextFloat(-1, 1), Main.rand.NextFloat(-1, 1)); waterVelocity.Normalize(); waterVelocity *= 3; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), spriteCenter, waterVelocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.1f), 1, Projectile.owner, 0, 0); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), spriteCenter, waterVelocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.05f), 1, Projectile.owner, 0, 0); } } } @@ -75,7 +75,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; if (Projectile.direction > 0) { Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); diff --git a/Projectiles/Rogue/DeepWounderWater.cs b/Projectiles/Rogue/DeepWounderWater.cs index 3ef1fa7cdb..e9cf620e03 100644 --- a/Projectiles/Rogue/DeepWounderWater.cs +++ b/Projectiles/Rogue/DeepWounderWater.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue @@ -26,7 +27,7 @@ namespace CalamityMod.Projectiles.Rogue { for (int i = 0; i < 5; i++) { - int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 33, Projectile.velocity.X, Projectile.velocity.Y); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Water, Projectile.velocity.X, Projectile.velocity.Y); Main.dust[dust].noGravity = true; } @@ -48,7 +49,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } diff --git a/Projectiles/Rogue/DesecratedBubble.cs b/Projectiles/Rogue/DesecratedBubble.cs index aebcc9749a..6fc7447c9a 100644 --- a/Projectiles/Rogue/DesecratedBubble.cs +++ b/Projectiles/Rogue/DesecratedBubble.cs @@ -1,8 +1,8 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { public class DesecratedBubble : ModProjectile, ILocalizedModType @@ -54,7 +54,7 @@ namespace CalamityMod.Projectiles.Rogue int rando = Main.rand.Next(5, 9); for (int i = 0; i < rando; i++) { - int dust = Dust.NewDust(Projectile.Center, 0, 0, 179, 0f, 0f, 100, default, 1.4f); + int dust = Dust.NewDust(Projectile.Center, 0, 0, DustID.BubbleBurst_Purple, 0f, 0f, 100, default, 1.4f); Main.dust[dust].velocity *= 0.8f; Main.dust[dust].position = Vector2.Lerp(Main.dust[dust].position, Projectile.Center, 0.5f); Main.dust[dust].noGravity = true; diff --git a/Projectiles/Rogue/DesecratedWaterProj.cs b/Projectiles/Rogue/DesecratedWaterProj.cs index 31449c64a8..f38e07224b 100644 --- a/Projectiles/Rogue/DesecratedWaterProj.cs +++ b/Projectiles/Rogue/DesecratedWaterProj.cs @@ -1,9 +1,9 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { public class DesecratedWaterProj : ModProjectile, ILocalizedModType @@ -29,14 +29,14 @@ namespace CalamityMod.Projectiles.Rogue SoundEngine.PlaySound(SoundID.Shatter, Projectile.position); Vector2 vector2 = new Vector2(20f, 20f); for (int index = 0; index < 10; ++index) - Dust.NewDust(Projectile.Center - vector2 / 2f, (int) vector2.X, (int) vector2.Y, 191, 0.0f, 0.0f); + Dust.NewDust(Projectile.Center - vector2 / 2f, (int)vector2.X, (int)vector2.Y, DustID.SpookyWood, 0.0f, 0.0f); for (int index1 = 0; index1 < 20; ++index1) { - int index2 = Dust.NewDust(Projectile.Center - vector2 / 2f, (int) vector2.X, (int) vector2.Y, 179, 0.0f, 0.0f, 100, new Color(), 2.5f); + int index2 = Dust.NewDust(Projectile.Center - vector2 / 2f, (int)vector2.X, (int)vector2.Y, DustID.BubbleBurst_Purple, 0.0f, 0.0f, 100, new Color(), 2.5f); Main.dust[index2].noGravity = true; Dust dust1 = Main.dust[index2]; dust1.velocity = dust1.velocity * 5f; - int index3 = Dust.NewDust(Projectile.Center - vector2 / 2f, (int) vector2.X, (int) vector2.Y, 179, 0.0f, 0.0f, 100, new Color(), 1.5f); + int index3 = Dust.NewDust(Projectile.Center - vector2 / 2f, (int)vector2.X, (int)vector2.Y, DustID.BubbleBurst_Purple, 0.0f, 0.0f, 100, new Color(), 1.5f); Dust dust2 = Main.dust[index3]; dust2.velocity = dust2.velocity * 3f; } @@ -55,7 +55,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } diff --git a/Projectiles/Rogue/DestructionBolt.cs b/Projectiles/Rogue/DestructionBolt.cs index d7dad8bd93..71daf97bbe 100644 --- a/Projectiles/Rogue/DestructionBolt.cs +++ b/Projectiles/Rogue/DestructionBolt.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { - if (Main.rand.Next(8) == 0) + if (Main.rand.NextBool(8)) { Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, dustType, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } @@ -148,7 +148,7 @@ namespace CalamityMod.Projectiles.Rogue SoundEngine.PlaySound(SoundID.Item14, Projectile.position); for (int j = 0; j < 20; j++) { - int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 31, 0f, 0f, 100, default, 2f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Smoke, 0f, 0f, 100, default, 2f); Main.dust[dust].velocity *= 3f; if (Main.rand.NextBool()) { diff --git a/Projectiles/Rogue/DestructionStar.cs b/Projectiles/Rogue/DestructionStar.cs index 3a6c1b746b..a757048966 100644 --- a/Projectiles/Rogue/DestructionStar.cs +++ b/Projectiles/Rogue/DestructionStar.cs @@ -1,10 +1,10 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -34,7 +34,7 @@ namespace CalamityMod.Projectiles.Rogue { if (Main.rand.NextBool(8)) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 191, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.SpookyWood, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } Projectile.rotation += Math.Sign(Projectile.velocity.X) * MathHelper.ToRadians(8f); if (Projectile.Calamity().stealthStrike || hitCount > 16) @@ -53,7 +53,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } @@ -66,14 +66,14 @@ namespace CalamityMod.Projectiles.Rogue Vector2 vector2 = new Vector2(20f, 20f); for (int index1 = 0; index1 < 10; ++index1) { - int index2 = Dust.NewDust(Projectile.Center - vector2 / 2f, (int) vector2.X, (int) vector2.Y, 31, 0.0f, 0.0f, 100, new Color(), 1.5f); + int index2 = Dust.NewDust(Projectile.Center - vector2 / 2f, (int)vector2.X, (int)vector2.Y, DustID.Smoke, 0.0f, 0.0f, 100, new Color(), 1.5f); Dust dust = Main.dust[index2]; dust.velocity = dust.velocity * 1.4f; } if (Projectile.owner == Main.myPlayer) { - if (hitCount < 4) - hitCount = 4; + if (hitCount < 4) + hitCount = 4; for (int i = 0; i < hitCount; i++) { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); diff --git a/Projectiles/Rogue/DragonScalesInfernado.cs b/Projectiles/Rogue/DragonScalesInfernado.cs index 4c81ac6148..a2d7cfb451 100644 --- a/Projectiles/Rogue/DragonScalesInfernado.cs +++ b/Projectiles/Rogue/DragonScalesInfernado.cs @@ -1,10 +1,12 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Rogue { public class DragonScalesInfernado : ModProjectile, ILocalizedModType @@ -46,7 +48,7 @@ namespace CalamityMod.Projectiles.Rogue if (Main.rand.NextBool(25)) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 244, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.CopperCoin, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } if (Projectile.velocity.X != 0f) { @@ -116,7 +118,7 @@ namespace CalamityMod.Projectiles.Rogue } if (Projectile.ai[0] <= 0f) { - float constant = 0.104719758f; + float constant = MathHelper.Pi / 30f; float smallWidth = (float)Projectile.width / 5f; smallWidth *= 2f; float xFluctuation = (float)(Math.Cos((double)(constant * -(double)Projectile.ai[0])) - 0.5) * smallWidth; @@ -144,8 +146,8 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D texture2D13 = ModContent.Request(Texture).Value; - int frameDraw = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; + Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + int frameDraw = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; int y6 = frameDraw * Projectile.frame; Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, frameDraw)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)frameDraw / 2f), Projectile.scale, SpriteEffects.None, 0); return false; diff --git a/Projectiles/Rogue/DragonShit.cs b/Projectiles/Rogue/DragonShit.cs index 9b19fe325c..2f0cbb809e 100644 --- a/Projectiles/Rogue/DragonShit.cs +++ b/Projectiles/Rogue/DragonShit.cs @@ -1,11 +1,11 @@ -using Microsoft.Xna.Framework; +using System; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using CalamityMod.Buffs.DamageOverTime; namespace CalamityMod.Projectiles.Rogue { @@ -82,8 +82,8 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D projectileTexture = ModContent.Request(Texture).Value; - int frameHeight = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; + Texture2D projectileTexture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + int frameHeight = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; int frameY = frameHeight * Projectile.frame; Main.spriteBatch.Draw(projectileTexture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, frameY, projectileTexture.Width, frameHeight)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)projectileTexture.Width / 2f, (float)frameHeight / 2f), Projectile.scale, SpriteEffects.None, 0); return false; @@ -100,7 +100,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.ExpandHitboxBy(80); for (int d = 0; d < 5; d++) { - int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 1f); + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 100, default, 1f); Main.dust[idx].velocity *= 3f; if (Main.rand.NextBool()) { @@ -110,10 +110,10 @@ namespace CalamityMod.Projectiles.Rogue } for (int d = 0; d < 8; d++) { - int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 100, default, 2f); Main.dust[idx].noGravity = true; Main.dust[idx].velocity *= 5f; - idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 1f); + idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 100, default, 1f); Main.dust[idx].velocity *= 2f; } diff --git a/Projectiles/Rogue/DukesDecapitatorBubble.cs b/Projectiles/Rogue/DukesDecapitatorBubble.cs index 936f2a1067..f7906da554 100644 --- a/Projectiles/Rogue/DukesDecapitatorBubble.cs +++ b/Projectiles/Rogue/DukesDecapitatorBubble.cs @@ -1,8 +1,8 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -69,7 +69,7 @@ namespace CalamityMod.Projectiles.Rogue int rando = Main.rand.Next(5, 9); for (int i = 0; i < rando; i++) { - int dust = Dust.NewDust(Projectile.Center, 0, 0, 206, 0f, 0f, 100, default, 1.4f); + int dust = Dust.NewDust(Projectile.Center, 0, 0, DustID.UnusedWhiteBluePurple, 0f, 0f, 100, default, 1.4f); Main.dust[dust].velocity *= 0.8f; Main.dust[dust].position = Vector2.Lerp(Main.dust[dust].position, Projectile.Center, 0.5f); Main.dust[dust].noGravity = true; diff --git a/Projectiles/Rogue/DukesDecapitatorProj.cs b/Projectiles/Rogue/DukesDecapitatorProj.cs index 5693c86573..f6684198f6 100644 --- a/Projectiles/Rogue/DukesDecapitatorProj.cs +++ b/Projectiles/Rogue/DukesDecapitatorProj.cs @@ -1,8 +1,8 @@ -using Microsoft.Xna.Framework; +using CalamityMod.CalPlayer; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Projectiles.Rogue { @@ -68,7 +68,7 @@ namespace CalamityMod.Projectiles.Rogue { for (int i = 0; i < 20; i++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 49, Projectile.velocity.X * 0.25f, Projectile.velocity.Y * 0.25f, 0, new Color(255, 255, 255), 0.75f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Mythril, Projectile.velocity.X * 0.25f, Projectile.velocity.Y * 0.25f, 0, new Color(255, 255, 255), 0.75f); } } diff --git a/Projectiles/Rogue/DuststormCloudHitbox.cs b/Projectiles/Rogue/DuststormCloudHitbox.cs index aa4d4d3597..9629e274f1 100644 --- a/Projectiles/Rogue/DuststormCloudHitbox.cs +++ b/Projectiles/Rogue/DuststormCloudHitbox.cs @@ -1,11 +1,11 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using CalamityMod.Items.Weapons.Rogue; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; using Terraria.Utilities; -using CalamityMod.Items.Weapons.Rogue; namespace CalamityMod.Projectiles.Rogue { @@ -30,10 +30,10 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { - if (Projectile.scale < (Projectile.ai[1]==1 ? DuststormInABottle.MaxSizeStealth : DuststormInABottle.MaxSize)) + if (Projectile.scale < (Projectile.ai[1] == 1 ? DuststormInABottle.MaxSizeStealth : DuststormInABottle.MaxSize)) { Projectile.scale += (Projectile.ai[1] == 1 ? DuststormInABottle.StealthGrowhRate : DuststormInABottle.GrowthRate); - Projectile.ExpandHitboxBy(1+ (Projectile.ai[1] == 1 ? DuststormInABottle.StealthGrowhRate : DuststormInABottle.GrowthRate)); + Projectile.ExpandHitboxBy(1 + (Projectile.ai[1] == 1 ? DuststormInABottle.StealthGrowhRate : DuststormInABottle.GrowthRate)); } } diff --git a/Projectiles/Rogue/DuststormInABottleProj.cs b/Projectiles/Rogue/DuststormInABottleProj.cs index b6f4e6a354..7a012612b4 100644 --- a/Projectiles/Rogue/DuststormInABottleProj.cs +++ b/Projectiles/Rogue/DuststormInABottleProj.cs @@ -1,11 +1,11 @@ -using Microsoft.Xna.Framework; -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Audio; +using System; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { public class DuststormInABottleProj : ModProjectile, ILocalizedModType @@ -36,9 +36,9 @@ namespace CalamityMod.Projectiles.Rogue //DUST STORM for (int dustexplode = 0; dustexplode < 180; dustexplode++) { - Vector2 dustd = new Vector2(DuststormInABottle.DustRadius, DuststormInABottle.DustRadius).RotatedBy(MathHelper.ToRadians(dustexplode*2)); + Vector2 dustd = new Vector2(DuststormInABottle.DustRadius, DuststormInABottle.DustRadius).RotatedBy(MathHelper.ToRadians(dustexplode * 2)); - Particle dust = new SandyDustParticle(Projectile.Center, dustd*Main.rand.NextFloat(0.25f, 1f), Color.Beige, Main.rand.NextFloat(0.7f, 1.2f), Main.rand.Next(30, 50)); + Particle dust = new SandyDustParticle(Projectile.Center, dustd * Main.rand.NextFloat(0.25f, 1f), Color.Beige, Main.rand.NextFloat(0.7f, 1.2f), Main.rand.Next(30, 50)); GeneralParticleHandler.SpawnParticle(dust); int d = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, Main.rand.NextBool(5) ? 32 : 85, dustd.X, dustd.Y, 50, default, 2f); @@ -48,7 +48,8 @@ namespace CalamityMod.Projectiles.Rogue } cloudAmt *= 2.75; cloudAmt = Math.Round(cloudAmt); - } else + } + else { //DUST STORM but smaller for (int dustexplode = 0; dustexplode < 120; dustexplode++) @@ -64,7 +65,7 @@ namespace CalamityMod.Projectiles.Rogue for (int index = 0; index < cloudAmt; index++) { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 10f, 200f, 0.01f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, stealth ? velocity*1.2f : velocity, ModContent.ProjectileType(), 0, 0, Projectile.owner, stealth ? 1f : 0f, (float)Main.rand.Next(-45, 1)); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, stealth ? velocity * 1.2f : velocity, ModContent.ProjectileType(), 0, 0, Projectile.owner, stealth ? 1f : 0f, (float)Main.rand.Next(-45, 1)); } int hitbox = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack * 0.5f, Projectile.owner); if (hitbox.WithinBounds(Main.maxProjectiles) && Projectile.Calamity().stealthStrike) //Inherit stealth flag and less iframes diff --git a/Projectiles/Rogue/DynamicPursuerElectricity.cs b/Projectiles/Rogue/DynamicPursuerElectricity.cs index c684cf4d79..1e79b95400 100644 --- a/Projectiles/Rogue/DynamicPursuerElectricity.cs +++ b/Projectiles/Rogue/DynamicPursuerElectricity.cs @@ -1,6 +1,6 @@ -using CalamityMod.Graphics.Primitives; +using System; +using CalamityMod.Graphics.Primitives; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Projectiles/Rogue/DynamicPursuerLaser.cs b/Projectiles/Rogue/DynamicPursuerLaser.cs index 96506948c0..c63a868015 100644 --- a/Projectiles/Rogue/DynamicPursuerLaser.cs +++ b/Projectiles/Rogue/DynamicPursuerLaser.cs @@ -1,4 +1,5 @@ using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue @@ -30,7 +31,7 @@ namespace CalamityMod.Projectiles.Rogue Lighting.AddLight(Projectile.Center, 0.2f, 0.1f, 0f); for (int i = 0; i < 2; i++) { - Dust dust = Dust.NewDustDirect(Projectile.Center, 0, 0, 182, 0f, 0f, 160, default, 2f); + Dust dust = Dust.NewDustDirect(Projectile.Center, 0, 0, DustID.TheDestroyer, 0f, 0f, 160, default, 2f); dust.position = Projectile.Center; dust.velocity = Projectile.velocity; dust.scale = Projectile.scale; diff --git a/Projectiles/Rogue/DynamicPursuerProjectile.cs b/Projectiles/Rogue/DynamicPursuerProjectile.cs index 8272ab76b5..f0b630c69a 100644 --- a/Projectiles/Rogue/DynamicPursuerProjectile.cs +++ b/Projectiles/Rogue/DynamicPursuerProjectile.cs @@ -1,16 +1,16 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; +using System; +using System.CodeDom; using System.Collections.Generic; using System.Linq; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Audio; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Projectiles.DraedonsArsenal; using CalamityMod.Sounds; -using System.CodeDom; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { @@ -211,7 +211,7 @@ namespace CalamityMod.Projectiles.Rogue { if (Main.myPlayer == Projectile.owner) //TODO: Change explosion color somehow - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage * 3/4, Projectile.knockBack * 2f, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage * 3 / 4, Projectile.knockBack * 2f, Projectile.owner); { for (int i = 0; i < 220; i++) @@ -259,7 +259,7 @@ namespace CalamityMod.Projectiles.Rogue } } } - + if (newTarget == null) { float potentialNewDistance = (Projectile.Center - Main.npc[target.whoAmI].Center).Length(); @@ -290,13 +290,13 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, ProjectileID.Sets.TrailCacheLength[Projectile.type]); - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Texture2D glowmaskTexture = ModContent.Request("CalamityMod/Projectiles/Rogue/DynamicPursuerProjectileGlowmask").Value; Rectangle glowmaskRectangle = glowmaskTexture.Frame(1, 9, 0, glowmaskFrame); - Vector2 origin = glowmaskRectangle.Size()/2f; + Vector2 origin = glowmaskRectangle.Size() / 2f; Vector2 drawPosition = Projectile.Center - Main.screenPosition; SpriteEffects direction = SpriteEffects.None; - + Main.EntitySpriteDraw(texture, drawPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, direction, 0); Main.EntitySpriteDraw(glowmaskTexture, drawPosition, glowmaskRectangle, Color.White, Projectile.rotation, origin, Projectile.scale, direction, 0); diff --git a/Projectiles/Rogue/EGloveSpark.cs b/Projectiles/Rogue/EGloveSpark.cs index 6ab6183572..5f578b7c00 100644 --- a/Projectiles/Rogue/EGloveSpark.cs +++ b/Projectiles/Rogue/EGloveSpark.cs @@ -1,6 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Rogue { public class EGloveSpark : ModProjectile, ILocalizedModType @@ -50,7 +52,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.velocity.Y = Projectile.velocity.Y + 0.2f; } Projectile.rotation += Projectile.velocity.X * 0.1f; - int sparky = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 206, 0f, 0f, 100, new Color(Main.rand.Next(20, 100), 204, 250), 1f); + int sparky = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.UnusedWhiteBluePurple, 0f, 0f, 100, new Color(Main.rand.Next(20, 100), 204, 250), 1f); Dust expr_8976_cp_0 = Main.dust[sparky]; expr_8976_cp_0.position.X -= 2f; Dust expr_8994_cp_0 = Main.dust[sparky]; @@ -61,7 +63,7 @@ namespace CalamityMod.Projectiles.Rogue expr_89E7_cp_0.velocity.Y -= 2f; if (Main.rand.NextBool()) { - int sparky2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 206, 0f, 0f, 100, new Color(Main.rand.Next(20, 100), 204, 250), 1f); + int sparky2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.UnusedWhiteBluePurple, 0f, 0f, 100, new Color(Main.rand.Next(20, 100), 204, 250), 1f); Dust expr_8A4E_cp_0 = Main.dust[sparky2]; expr_8A4E_cp_0.position.X -= 2f; Dust expr_8A6C_cp_0 = Main.dust[sparky2]; diff --git a/Projectiles/Rogue/EclipseMirrorBurst.cs b/Projectiles/Rogue/EclipseMirrorBurst.cs index 0a2e254afa..9076e35af0 100644 --- a/Projectiles/Rogue/EclipseMirrorBurst.cs +++ b/Projectiles/Rogue/EclipseMirrorBurst.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ModLoader; @@ -47,7 +47,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.spriteBatch.Draw ( texture, diff --git a/Projectiles/Rogue/EclipsesFallMain.cs b/Projectiles/Rogue/EclipsesFallMain.cs index f311e5090e..3448ed80af 100644 --- a/Projectiles/Rogue/EclipsesFallMain.cs +++ b/Projectiles/Rogue/EclipsesFallMain.cs @@ -58,7 +58,8 @@ namespace CalamityMod.Projectiles.Rogue int spearAmt = Main.rand.Next(3, 4 + 1); // 3 or 4 spears var source = Projectile.GetSource_FromThis(); for (int n = 0; n < spearAmt; n++) - {; + { + ; CalamityUtils.ProjectileRain(source, targetPos, 400f, 100f, 500f, 800f, 29f, ModContent.ProjectileType(), (int)(Projectile.damage * RainDamageMult), Projectile.knockBack * RainDamageMult, Projectile.owner); } } diff --git a/Projectiles/Rogue/EclipsesSmol.cs b/Projectiles/Rogue/EclipsesSmol.cs index 0e5261b383..62e45e3ebe 100644 --- a/Projectiles/Rogue/EclipsesSmol.cs +++ b/Projectiles/Rogue/EclipsesSmol.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() * 0.5f, Projectile.scale, SpriteEffects.None); return false; } diff --git a/Projectiles/Rogue/EclipsesStealth.cs b/Projectiles/Rogue/EclipsesStealth.cs index 8b241c5afe..2ea50cc720 100644 --- a/Projectiles/Rogue/EclipsesStealth.cs +++ b/Projectiles/Rogue/EclipsesStealth.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.width = Projectile.height = 40; Projectile.friendly = true; Projectile.ignoreWater = true; - Projectile.tileCollide = false; + Projectile.tileCollide = false; Projectile.DamageType = RogueDamageClass.Instance; Projectile.MaxUpdates = 2; Projectile.penetrate = -1; diff --git a/Projectiles/Rogue/ElementalDiskProj.cs b/Projectiles/Rogue/ElementalDiskProj.cs index 8f2c0c7268..a262f8d9b0 100644 --- a/Projectiles/Rogue/ElementalDiskProj.cs +++ b/Projectiles/Rogue/ElementalDiskProj.cs @@ -1,11 +1,11 @@ -using Microsoft.Xna.Framework; -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Audio; +using System; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Weapons.Rogue; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { @@ -168,7 +168,7 @@ namespace CalamityMod.Projectiles.Rogue { if (Main.rand.NextBool(3)) { - int rainbow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 66, Projectile.direction * 2, 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.3f); + int rainbow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RainbowTorch, Projectile.direction * 2, 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.3f); Main.dust[rainbow].noGravity = true; Main.dust[rainbow].velocity *= 0f; } diff --git a/Projectiles/Rogue/ElementalDiskSplit.cs b/Projectiles/Rogue/ElementalDiskSplit.cs index 6a7a074017..6cc5c92660 100644 --- a/Projectiles/Rogue/ElementalDiskSplit.cs +++ b/Projectiles/Rogue/ElementalDiskSplit.cs @@ -31,13 +31,15 @@ namespace CalamityMod.Projectiles.Rogue AIType = ProjectileID.WoodenBoomerang; Projectile.DamageType = RogueDamageClass.Instance; Projectile.Calamity().CannotProc = true; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() { if (Main.rand.NextBool(10)) { - int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 66, Projectile.direction * 2, 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 0.5f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RainbowTorch, Projectile.direction * 2, 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 0.5f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 0f; } diff --git a/Projectiles/Rogue/EnchantedAxe2.cs b/Projectiles/Rogue/EnchantedAxe2.cs index 1a8fa6263d..7d9ade368b 100644 --- a/Projectiles/Rogue/EnchantedAxe2.cs +++ b/Projectiles/Rogue/EnchantedAxe2.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ModLoader; @@ -30,8 +30,8 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; - Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, new Color(255, 255, 255, 128), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, new Color(192, 192, 255, 128), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } } diff --git a/Projectiles/Rogue/EnchantedAxeProj.cs b/Projectiles/Rogue/EnchantedAxeProj.cs index e983fd061d..ab8ce605d0 100644 --- a/Projectiles/Rogue/EnchantedAxeProj.cs +++ b/Projectiles/Rogue/EnchantedAxeProj.cs @@ -1,9 +1,9 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -128,7 +128,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; diff --git a/Projectiles/Rogue/EpidemicShredderProjectile.cs b/Projectiles/Rogue/EpidemicShredderProjectile.cs index 546b1aed58..d7612d5955 100644 --- a/Projectiles/Rogue/EpidemicShredderProjectile.cs +++ b/Projectiles/Rogue/EpidemicShredderProjectile.cs @@ -1,9 +1,9 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Projectiles.Melee; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; -using CalamityMod.Projectiles.Melee; -using CalamityMod.Buffs.DamageOverTime; namespace CalamityMod.Projectiles.Rogue { diff --git a/Projectiles/Rogue/EquanimityDarkShard.cs b/Projectiles/Rogue/EquanimityDarkShard.cs index 46fcc5ab9f..42da8f6630 100644 --- a/Projectiles/Rogue/EquanimityDarkShard.cs +++ b/Projectiles/Rogue/EquanimityDarkShard.cs @@ -1,8 +1,8 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; -using Terraria.ModLoader; -using Terraria.ID; using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { diff --git a/Projectiles/Rogue/EquanimityLightShard.cs b/Projectiles/Rogue/EquanimityLightShard.cs index 1350de667f..1969d188fa 100644 --- a/Projectiles/Rogue/EquanimityLightShard.cs +++ b/Projectiles/Rogue/EquanimityLightShard.cs @@ -1,8 +1,8 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; -using Terraria.ModLoader; -using Terraria.ID; using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { @@ -20,6 +20,8 @@ namespace CalamityMod.Projectiles.Rogue Projectile.tileCollide = true; Projectile.timeLeft = 120; Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() @@ -33,18 +35,6 @@ namespace CalamityMod.Projectiles.Rogue } } - public override bool? CanHitNPC(NPC target) - { - if (Projectile.timeLeft < 130) - { - return null; - } - else - { - return false; - } - } - public override bool OnTileCollide(Vector2 oldVelocity) { Collision.HitTiles(Projectile.position + Projectile.velocity, Projectile.velocity, Projectile.width, Projectile.height); diff --git a/Projectiles/Rogue/EquanimityProj.cs b/Projectiles/Rogue/EquanimityProj.cs index 85c0b93b24..903bd27b27 100644 --- a/Projectiles/Rogue/EquanimityProj.cs +++ b/Projectiles/Rogue/EquanimityProj.cs @@ -1,8 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -83,10 +83,10 @@ namespace CalamityMod.Projectiles.Rogue Vector2 shardVelocity = new Vector2(Main.rand.NextFloat(-1f, 1f), Main.rand.NextFloat(-1f, 1f)); shardVelocity.Normalize(); shardVelocity *= 5f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, shardVelocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.8f), 0f, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, shardVelocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.8f), 0f, Projectile.owner); if (Projectile.Calamity().stealthStrike) { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, -shardVelocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.8f), 0f, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, -shardVelocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.8f), 0f, Projectile.owner); } } } @@ -104,10 +104,10 @@ namespace CalamityMod.Projectiles.Rogue Vector2 shardVelocity = new Vector2(Main.rand.NextFloat(-1f, 1f), Main.rand.NextFloat(-1f, 1f)); shardVelocity.Normalize(); shardVelocity *= 5f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, shardVelocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.8f), 0f, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, shardVelocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.8f), 0f, Projectile.owner); if (Projectile.Calamity().stealthStrike) { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, -shardVelocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.8f), 0f, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, -shardVelocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.8f), 0f, Projectile.owner); } } } diff --git a/Projectiles/Rogue/EradicatorProjectile.cs b/Projectiles/Rogue/EradicatorProjectile.cs index 7fb2693bb0..a6963895c4 100644 --- a/Projectiles/Rogue/EradicatorProjectile.cs +++ b/Projectiles/Rogue/EradicatorProjectile.cs @@ -1,10 +1,10 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Particles; using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Projectiles/Rogue/ExecutionersBladeProj.cs b/Projectiles/Rogue/ExecutionersBladeProj.cs index 70185db87a..b52e8d2ad2 100644 --- a/Projectiles/Rogue/ExecutionersBladeProj.cs +++ b/Projectiles/Rogue/ExecutionersBladeProj.cs @@ -2,9 +2,9 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -50,7 +50,7 @@ namespace CalamityMod.Projectiles.Rogue Lighting.AddLight(Projectile.Center, 0.5f, 0f, 0.65f); if (Main.rand.NextBool(5)) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 173, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } CalamityUtils.HomeInOnNPC(Projectile, true, 250f, 12f, 20f); } @@ -85,7 +85,7 @@ namespace CalamityMod.Projectiles.Rogue SoundEngine.PlaySound(SoundID.Item74, Projectile.position); for (int i = 0; i < 3; i++) { - int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 2f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, 0f, 0f, 100, default, 2f); Main.dust[dust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -95,10 +95,10 @@ namespace CalamityMod.Projectiles.Rogue } for (int j = 0; j < 5; j++) { - int dust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 3f); + int dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, 0f, 0f, 100, default, 3f); Main.dust[dust2].noGravity = true; Main.dust[dust2].velocity *= 5f; - dust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 2f); + dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, 0f, 0f, 100, default, 2f); Main.dust[dust2].velocity *= 2f; } } diff --git a/Projectiles/Rogue/ExecutionersBladeStealthProj.cs b/Projectiles/Rogue/ExecutionersBladeStealthProj.cs index edaf5de4df..40b244acc3 100644 --- a/Projectiles/Rogue/ExecutionersBladeStealthProj.cs +++ b/Projectiles/Rogue/ExecutionersBladeStealthProj.cs @@ -2,9 +2,9 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -36,7 +36,7 @@ namespace CalamityMod.Projectiles.Rogue if (Projectile.timeLeft >= 150 && Projectile.FinalExtraUpdate()) Projectile.velocity.Y *= 1.3f; Projectile.rotation += 0.5f * (float)Projectile.direction; - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 173, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } public override void PostDraw(Color lightColor) @@ -55,7 +55,7 @@ namespace CalamityMod.Projectiles.Rogue SoundEngine.PlaySound(SoundID.Item74, Projectile.position); for (int i = 0; i < 3; i++) { - int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 2f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, 0f, 0f, 100, default, 2f); Main.dust[dust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -65,10 +65,10 @@ namespace CalamityMod.Projectiles.Rogue } for (int j = 0; j < 5; j++) { - int dust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 3f); + int dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, 0f, 0f, 100, default, 3f); Main.dust[dust2].noGravity = true; Main.dust[dust2].velocity *= 5f; - dust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 2f); + dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, 0f, 0f, 100, default, 2f); Main.dust[dust2].velocity *= 2f; } } diff --git a/Projectiles/Rogue/ExorcismProj.cs b/Projectiles/Rogue/ExorcismProj.cs index 69484d0c19..ff5246efc9 100644 --- a/Projectiles/Rogue/ExorcismProj.cs +++ b/Projectiles/Rogue/ExorcismProj.cs @@ -1,9 +1,9 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -31,18 +31,6 @@ namespace CalamityMod.Projectiles.Rogue Projectile.velocity.Y += 0.1f; Projectile.rotation += 0.05f * Projectile.direction; - // Damage Scaling - if (Projectile.velocity.Y > 0 && Projectile.ai[0] < 2f) - { - Projectile.ai[0] += 0.015f; - } - if (Projectile.ai[0] > 2f) - { - Projectile.ai[0] = 2f; - } - - Projectile.damage = (int)(Projectile.ai[1] * Projectile.ai[0]); - // Dust Effects Vector2 dustLeft = (new Vector2(-1, 0)).RotatedBy(Projectile.rotation); Vector2 dustRight = (new Vector2(1, 0)).RotatedBy(Projectile.rotation); @@ -55,7 +43,7 @@ namespace CalamityMod.Projectiles.Rogue float maxScale = 1.4f; int dustType = 175; - int dustCount = (int)(5 * (Projectile.ai[0] - 1f)); + int dustCount = (int)(5 * (Projectile.ai[0])); for (int i = 0; i < dustCount; i++) { @@ -87,7 +75,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } @@ -105,17 +93,19 @@ namespace CalamityMod.Projectiles.Rogue //Crystal smash sound SoundEngine.PlaySound(SoundID.Item27, Projectile.Center); // Light burst - int p = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, 0, Projectile.owner, Projectile.ai[0] - 1f, 0); + int p = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.8f), 0, Projectile.owner, Projectile.ai[0], 0); Main.projectile[p].rotation = Projectile.rotation; + if (Projectile.Calamity().stealthStrike) + Main.projectile[p].Calamity().stealthStrike = true; // Stars if (Projectile.Calamity().stealthStrike) { - for (int i = 0; i < 9; i++) + for (int i = 0; i < 6; i++) { Vector2 pos = new Vector2(Projectile.Center.X + (float)Projectile.width * 0.5f + (float)Main.rand.Next(-201, 201), Main.screenPosition.Y - 600f - Main.rand.Next(50)); float speedX = (Projectile.Center.X - pos.X) / 20f; float speedY = (Projectile.Center.Y - pos.Y) / 20f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), pos.X, pos.Y, speedX, speedY, ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack * 0.5f, Projectile.owner, Main.rand.NextFloat(-3f, 3f), 0f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), pos.X, pos.Y, speedX, speedY, ModContent.ProjectileType(), (int)(Projectile.damage * 0.75f), Projectile.knockBack * 0.5f, Projectile.owner, Main.rand.NextFloat(-3f, 3f), 0f); } } } diff --git a/Projectiles/Rogue/ExorcismShockwave.cs b/Projectiles/Rogue/ExorcismShockwave.cs index 0b254cd7f0..03b4e58e09 100644 --- a/Projectiles/Rogue/ExorcismShockwave.cs +++ b/Projectiles/Rogue/ExorcismShockwave.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; @@ -9,12 +9,13 @@ namespace CalamityMod.Projectiles.Rogue public new string LocalizationCategory => "Projectiles.Rogue"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - public static float radius = 100; + public static float Radius = 100; + public static float RadiusStealth = 200; public override void SetDefaults() { - Projectile.width = (int)radius * 2; - Projectile.height = (int)radius * 2; + Projectile.width = (int)(Projectile.Calamity().stealthStrike ? RadiusStealth * 2 : Radius * 2); + Projectile.height = (int)(Projectile.Calamity().stealthStrike ? RadiusStealth * 2 : Radius * 2); Projectile.friendly = true; Projectile.penetrate = -1; Projectile.tileCollide = false; @@ -31,7 +32,7 @@ namespace CalamityMod.Projectiles.Rogue { Projectile.alpha = (int)((1 - Projectile.ai[0]) * 255f); - // Blast wave should be brighter the higher the charge of the projectile when it is killed + // Blast wave should be brighter on stealth strikes int numDust = (int)(40 * Projectile.ai[0]) + 10; for (int i = 0; i < numDust; i++) @@ -55,7 +56,7 @@ namespace CalamityMod.Projectiles.Rogue // Shockwave Vector2 circleVelocity = new Vector2(Main.rand.NextFloat(-1, 1), Main.rand.NextFloat(-1, 1)); circleVelocity.Normalize(); - circleVelocity *= radius / 10f; + circleVelocity *= (Projectile.Calamity().stealthStrike ? RadiusStealth : Radius) / 10f; int circle = Dust.NewDust(Projectile.Center, 1, 1, dustType, circleVelocity.X, circleVelocity.Y, 0, default, 1.5f); Main.dust[circle].noGravity = true; @@ -117,26 +118,6 @@ namespace CalamityMod.Projectiles.Rogue } } - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) - { - float dist1 = Vector2.Distance(Projectile.Center, target.Hitbox.TopLeft()); - float dist2 = Vector2.Distance(Projectile.Center, target.Hitbox.TopRight()); - float dist3 = Vector2.Distance(Projectile.Center, target.Hitbox.BottomLeft()); - float dist4 = Vector2.Distance(Projectile.Center, target.Hitbox.BottomRight()); - - float damageScale = dist1; - if (dist2 < damageScale) - damageScale = dist2; - if (dist3 < damageScale) - damageScale = dist3; - if (dist4 < damageScale) - damageScale = dist4; - damageScale /= radius; - damageScale = 1f - damageScale; - - modifiers.SourceDamage *= damageScale; - } - - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, radius, targetHitbox); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, (Projectile.Calamity().stealthStrike ? RadiusStealth : Radius), targetHitbox); } } diff --git a/Projectiles/Rogue/ExorcismStar.cs b/Projectiles/Rogue/ExorcismStar.cs index 4e4ea10eb8..1205f4d2c5 100644 --- a/Projectiles/Rogue/ExorcismStar.cs +++ b/Projectiles/Rogue/ExorcismStar.cs @@ -1,11 +1,11 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -28,6 +28,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.tileCollide = false; Projectile.ignoreWater = true; Projectile.timeLeft = 300; + Projectile.extraUpdates = 3; Projectile.DamageType = RogueDamageClass.Instance; } @@ -42,9 +43,9 @@ namespace CalamityMod.Projectiles.Rogue } } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 180); + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 60); - public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 180); + public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 60); public override Color? GetAlpha(Color lightColor) => new Color(250, 200, 45, Projectile.alpha); diff --git a/Projectiles/Rogue/ExplosiveSun.cs b/Projectiles/Rogue/ExplosiveSun.cs index d68d4e7ae8..ca0e3f46ed 100644 --- a/Projectiles/Rogue/ExplosiveSun.cs +++ b/Projectiles/Rogue/ExplosiveSun.cs @@ -2,9 +2,9 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -69,11 +69,11 @@ namespace CalamityMod.Projectiles.Rogue Projectile.Damage(); if (Main.rand.NextBool(3)) { - SoundEngine.PlaySound(SoundID.Item14 with { Volume = SoundID.Item14.Volume * 0.5f}, Projectile.Center); + SoundEngine.PlaySound(SoundID.Item14 with { Volume = SoundID.Item14.Volume * 0.5f }, Projectile.Center); } for (int i = 0; i < 5; i++) { - int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 100, default, 2f); Main.dust[dust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -83,10 +83,10 @@ namespace CalamityMod.Projectiles.Rogue } for (int j = 0; j < 10; j++) { - int dust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 3f); + int dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 100, default, 3f); Main.dust[dust2].noGravity = true; Main.dust[dust2].velocity *= 5f; - dust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); + dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 100, default, 2f); Main.dust[dust2].velocity *= 2f; } } diff --git a/Projectiles/Rogue/FantasyTalismanProj.cs b/Projectiles/Rogue/FantasyTalismanProj.cs index 6809d28912..f9c734ca63 100644 --- a/Projectiles/Rogue/FantasyTalismanProj.cs +++ b/Projectiles/Rogue/FantasyTalismanProj.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); if (Main.rand.NextBool(3)) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 175, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.SpectreStaff, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } Projectile.StickyProjAI(4); if (Projectile.ai[0] == 1f) diff --git a/Projectiles/Rogue/FantasyTalismanStealth.cs b/Projectiles/Rogue/FantasyTalismanStealth.cs index 08fe1454b4..25d6cbf1f7 100644 --- a/Projectiles/Rogue/FantasyTalismanStealth.cs +++ b/Projectiles/Rogue/FantasyTalismanStealth.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); if (Main.rand.NextBool(3)) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 175, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.SpectreStaff, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } if (Projectile.ai[0] != 1f) { diff --git a/Projectiles/Rogue/FeatherKnifeProjectile.cs b/Projectiles/Rogue/FeatherKnifeProjectile.cs index 5373a8b427..28e19aaf56 100644 --- a/Projectiles/Rogue/FeatherKnifeProjectile.cs +++ b/Projectiles/Rogue/FeatherKnifeProjectile.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } diff --git a/Projectiles/Rogue/FinalDawnFireSlash.cs b/Projectiles/Rogue/FinalDawnFireSlash.cs index fc47069d5e..77e2e24401 100644 --- a/Projectiles/Rogue/FinalDawnFireSlash.cs +++ b/Projectiles/Rogue/FinalDawnFireSlash.cs @@ -4,8 +4,8 @@ using CalamityMod.Items.Weapons.Rogue; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; -using Terraria.ID; using Terraria.Audio; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue @@ -45,14 +45,14 @@ namespace CalamityMod.Projectiles.Rogue AdjustPlayerPositionValues(player); Projectile.ai[0]++; - if(Projectile.ai[0] >= 4) + if (Projectile.ai[0] >= 4) { Projectile.ai[1]++; Projectile.ai[0] = 0; if (Projectile.ai[1] == 5) { Projectile.friendly = true; - SoundEngine.PlaySound(FinalDawn.UseSound, Projectile.Center); + SoundEngine.PlaySound(TheFinalDawn.UseSound, Projectile.Center); } } if (Projectile.ai[1] >= 11) @@ -110,7 +110,7 @@ namespace CalamityMod.Projectiles.Rogue Vector2 drawCenter = Projectile.Center; Rectangle frameRectangle = new Rectangle(Projectile.frame / 5 * width, Projectile.frame % 5 * height, width, height); - Texture2D scytheTexture = ModContent.Request(Texture).Value; + Texture2D scytheTexture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Texture2D glowTexture = ModContent.Request("CalamityMod/Projectiles/Rogue/FinalDawnFireSlash_Glow").Value; Main.spriteBatch.Draw(scytheTexture, diff --git a/Projectiles/Rogue/FinalDawnFireball.cs b/Projectiles/Rogue/FinalDawnFireball.cs index ac8f0131e6..cb25e37003 100644 --- a/Projectiles/Rogue/FinalDawnFireball.cs +++ b/Projectiles/Rogue/FinalDawnFireball.cs @@ -32,10 +32,10 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { NPC chargeAt = Main.npc[(int)Projectile.ai[1]]; - if(!chargeAt.active) + if (!chargeAt.active) Projectile.Kill(); - int idx = Dust.NewDust(Projectile.position, Projectile.width , Projectile.height, ModContent.DustType(), 0f, 0f, 0, default, 1.0f); + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 0, default, 1.0f); Main.dust[idx].velocity = Projectile.velocity * 0.5f; Main.dust[idx].noGravity = true; Main.dust[idx].noLight = true; @@ -47,7 +47,7 @@ namespace CalamityMod.Projectiles.Rogue NPC npc = Main.npc[(int)Projectile.ai[1]]; Vector2 desiredVelocity = Projectile.SafeDirectionTo(npc.Center) * DesiredSpeed; Projectile.velocity = Vector2.Lerp(Projectile.velocity, desiredVelocity, 1f / InterpolationTime); - if(!npc.active) + if (!npc.active) Projectile.Kill(); } @@ -69,8 +69,8 @@ namespace CalamityMod.Projectiles.Rogue } public override bool PreDraw(ref Color lightColor) { - Texture2D glowmask = ModContent.Request(Texture).Value; - int height = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; + Texture2D glowmask = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + int height = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; int yStart = height * Projectile.frame; Main.spriteBatch.Draw(glowmask, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), diff --git a/Projectiles/Rogue/FinalDawnFlame.cs b/Projectiles/Rogue/FinalDawnFlame.cs index 5a574e5f7d..60789f2f1f 100644 --- a/Projectiles/Rogue/FinalDawnFlame.cs +++ b/Projectiles/Rogue/FinalDawnFlame.cs @@ -59,8 +59,8 @@ namespace CalamityMod.Projectiles.Rogue } public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; - int frameHeight = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + int frameHeight = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; if (Flames.Length > 0) diff --git a/Projectiles/Rogue/FinalDawnHorizontalSlash.cs b/Projectiles/Rogue/FinalDawnHorizontalSlash.cs index d35540007c..e41cb19294 100644 --- a/Projectiles/Rogue/FinalDawnHorizontalSlash.cs +++ b/Projectiles/Rogue/FinalDawnHorizontalSlash.cs @@ -48,7 +48,7 @@ namespace CalamityMod.Projectiles.Rogue if (Projectile.ai[1] == 3) { Projectile.friendly = true; - SoundEngine.PlaySound(FinalDawn.UseSound, Projectile.position); + SoundEngine.PlaySound(TheFinalDawn.UseSound, Projectile.position); if (Projectile.owner == Main.myPlayer) { @@ -72,9 +72,9 @@ namespace CalamityMod.Projectiles.Rogue } public override bool PreDraw(ref Color lightColor) { - Texture2D scytheTexture = ModContent.Request(Texture).Value; + Texture2D scytheTexture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Texture2D scytheGlowTexture = ModContent.Request("CalamityMod/Projectiles/Rogue/FinalDawnHorizontalSlash_Glow").Value; - int height = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; + int height = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; int yStart = height * Projectile.frame; Main.spriteBatch.Draw(scytheTexture, Projectile.Center - Main.screenPosition + Projectile.gfxOffY * Vector2.UnitY, diff --git a/Projectiles/Rogue/FinalDawnProjectile.cs b/Projectiles/Rogue/FinalDawnProjectile.cs index 6f97f45932..d6c0d2e372 100644 --- a/Projectiles/Rogue/FinalDawnProjectile.cs +++ b/Projectiles/Rogue/FinalDawnProjectile.cs @@ -80,7 +80,7 @@ namespace CalamityMod.Projectiles.Rogue if (Main.myPlayer == Projectile.owner) { - if (!player.channel || player.noItems || player.CCed) + if (player.CantUseHoldout()) { AttemptExecuteAttacks(player); Projectile.Kill(); @@ -156,9 +156,9 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D scytheTexture = ModContent.Request(Texture).Value; + Texture2D scytheTexture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Texture2D glowmask = ModContent.Request("CalamityMod/Projectiles/Rogue/FinalDawnProjectile_Glow").Value; - int height = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; + int height = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; int yStart = height * Projectile.frame; Main.spriteBatch.Draw(scytheTexture, Projectile.Center - Main.screenPosition + Vector2.UnitY * Projectile.gfxOffY, diff --git a/Projectiles/Rogue/FinalDawnReticle.cs b/Projectiles/Rogue/FinalDawnReticle.cs index 7727e532ff..19001e5563 100644 --- a/Projectiles/Rogue/FinalDawnReticle.cs +++ b/Projectiles/Rogue/FinalDawnReticle.cs @@ -50,12 +50,12 @@ namespace CalamityMod.Projectiles.Rogue Projectile.alpha += 8; Projectile.scale *= 0.98f; Projectile.ai[1] *= 1.01f; - if(Projectile.alpha >= 255) + if (Projectile.alpha >= 255) Projectile.Kill(); } public override bool PreDraw(ref Color lightColor) { - Texture2D ring = ModContent.Request(Texture).Value; + Texture2D ring = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Texture2D symbol = ModContent.Request("CalamityMod/Projectiles/Rogue/FinalDawnReticleSymbol").Value; Main.EntitySpriteDraw(symbol, Projectile.Center - Main.screenPosition, diff --git a/Projectiles/Rogue/FinalDawnThrow.cs b/Projectiles/Rogue/FinalDawnThrow.cs index 6337ef2894..273f8d58d7 100644 --- a/Projectiles/Rogue/FinalDawnThrow.cs +++ b/Projectiles/Rogue/FinalDawnThrow.cs @@ -4,9 +4,9 @@ using CalamityMod.Items.Weapons.Rogue; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.Rogue if (Projectile.localAI[0] == 0) { - SoundEngine.PlaySound(FinalDawn.UseSound, Projectile.Center); + SoundEngine.PlaySound(TheFinalDawn.UseSound, Projectile.Center); Projectile.localAI[0] = 1; } @@ -61,7 +61,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.Kill(); } - int idx = Dust.NewDust(Projectile.position, Projectile.width , Projectile.height, ModContent.DustType(), 0f, 0f, 0, default, 0.5f); + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 0, default, 0.5f); Main.dust[idx].velocity *= 0.5f; Main.dust[idx].velocity += Projectile.velocity * 0.5f; Main.dust[idx].noGravity = true; @@ -70,9 +70,9 @@ namespace CalamityMod.Projectiles.Rogue } public override bool PreDraw(ref Color lightColor) { - Texture2D scytheTexture = ModContent.Request(Texture).Value; + Texture2D scytheTexture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Texture2D scytheGlowTexture = ModContent.Request("CalamityMod/Projectiles/Rogue/FinalDawnThrow_Glow").Value; - int height = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; + int height = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; int yStart = height * Projectile.frame; Main.spriteBatch.Draw(scytheTexture, Projectile.Center - Main.screenPosition + Vector2.UnitY * Projectile.gfxOffY, diff --git a/Projectiles/Rogue/FinalDawnThrow2.cs b/Projectiles/Rogue/FinalDawnThrow2.cs index cfd96f4688..9109382a0a 100644 --- a/Projectiles/Rogue/FinalDawnThrow2.cs +++ b/Projectiles/Rogue/FinalDawnThrow2.cs @@ -3,9 +3,9 @@ using CalamityMod.Items.Weapons.Rogue; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -44,9 +44,9 @@ namespace CalamityMod.Projectiles.Rogue Player player = Main.player[Projectile.owner]; //Give iframes to the player if (player.immuneTime <= 30) - { - player.immuneNoBlink = true; - player.immuneTime = 30; + { + player.immuneNoBlink = true; + player.immuneTime = 30; } // Spawn homing flames that chase the HIT enemy only. This is also limited to one burst @@ -72,7 +72,7 @@ namespace CalamityMod.Projectiles.Rogue if (Projectile.localAI[0] == 0) { - SoundEngine.PlaySound(FinalDawn.UseSound, Projectile.position); + SoundEngine.PlaySound(TheFinalDawn.UseSound, Projectile.position); Projectile.localAI[0] = 1; } @@ -102,12 +102,12 @@ namespace CalamityMod.Projectiles.Rogue bool worldEdge = Projectile.Center.X < 1000 || Projectile.Center.Y < 1000 || Projectile.Center.X > Main.maxTilesX * 16 - 1000 || Projectile.Center.Y > Main.maxTilesY * 16 - 1000; Projectile.ai[0]++; - if(Projectile.ai[0] >= 60 || worldEdge) + if (Projectile.ai[0] >= 60 || worldEdge) { Projectile.Kill(); } - int idx = Dust.NewDust(Projectile.position, Projectile.width , Projectile.height, ModContent.DustType(), 0f, 0f, 0, default, 2.5f); + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 0, default, 2.5f); Main.dust[idx].velocity = Projectile.velocity * -0.5f; Main.dust[idx].noGravity = true; Main.dust[idx].noLight = false; @@ -117,9 +117,9 @@ namespace CalamityMod.Projectiles.Rogue Player player = Main.player[Projectile.owner]; float scytheRotation = player.fullRotation; - Texture2D scytheTexture = ModContent.Request(Texture).Value; + Texture2D scytheTexture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Texture2D glowScytheTexture = ModContent.Request("CalamityMod/Projectiles/Rogue/FinalDawnThrow2_Glow").Value; - int num214 = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; + int num214 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; int y6 = num214 * Projectile.frame; Vector2 origin = new Vector2(scytheTexture.Width / 2f + 40f * player.direction, num214 * 1.1f); diff --git a/Projectiles/Rogue/FishboneBoomerangProjectile.cs b/Projectiles/Rogue/FishboneBoomerangProjectile.cs index b49727d24e..905b5409b5 100644 --- a/Projectiles/Rogue/FishboneBoomerangProjectile.cs +++ b/Projectiles/Rogue/FishboneBoomerangProjectile.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Projectiles.Rogue public new string LocalizationCategory => "Projectiles.Rogue"; public override string Texture => "CalamityMod/Items/Weapons/Rogue/FishboneBoomerang"; - public static int ChargeupTime = 20; + public static int ChargeupTime = 10; public static int Lifetime = 240; public float OverallProgress => 1 - Projectile.timeLeft / (float)Lifetime; public float ThrowProgress => 1 - Projectile.timeLeft / (float)(Lifetime); @@ -102,12 +102,12 @@ namespace CalamityMod.Projectiles.Rogue Projectile.numHits = 0; } - if (Returning == 0f && Bouncing == 0f && Projectile.velocity.Length() > 2f) + if (Returning == 0f && Bouncing == 0f && Projectile.velocity.Length() > 2f && Projectile.timeLeft < (205 + ChargeupTime)) { - Projectile.velocity *= 0.97f; + Projectile.velocity *= 0.88f; } - if (Returning == 1f && Projectile.velocity.Length() < 17f) + if (Returning == 1f && Projectile.velocity.Length() < 20f) { Projectile.velocity *= 1.1f; } diff --git a/Projectiles/Rogue/Fork.cs b/Projectiles/Rogue/Fork.cs index 15b1713e04..3a621e5fa9 100644 --- a/Projectiles/Rogue/Fork.cs +++ b/Projectiles/Rogue/Fork.cs @@ -30,9 +30,9 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { - if (Main.rand.Next(5) == 0) + if (Main.rand.NextBool(5)) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 5, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Blood, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); diff --git a/Projectiles/Rogue/FossilShardThrown.cs b/Projectiles/Rogue/FossilShardThrown.cs index ad86468f43..dc34689d70 100644 --- a/Projectiles/Rogue/FossilShardThrown.cs +++ b/Projectiles/Rogue/FossilShardThrown.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Projectiles.Rogue public override void OnKill(int timeLeft) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 32, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Sand, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } } diff --git a/Projectiles/Rogue/FrostShardFriendly.cs b/Projectiles/Rogue/FrostShardFriendly.cs index 8ddec62e3c..5f166e6d70 100644 --- a/Projectiles/Rogue/FrostShardFriendly.cs +++ b/Projectiles/Rogue/FrostShardFriendly.cs @@ -1,8 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -76,7 +76,7 @@ namespace CalamityMod.Projectiles.Rogue { for (int index1 = 0; index1 < 3; ++index1) { - int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 76); + int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Snow); Main.dust[index2].noGravity = true; Main.dust[index2].noLight = true; Main.dust[index2].scale = 0.7f; diff --git a/Projectiles/Rogue/FrostyFlareProj.cs b/Projectiles/Rogue/FrostyFlareProj.cs index 6a15281be3..8b8ea4711f 100644 --- a/Projectiles/Rogue/FrostyFlareProj.cs +++ b/Projectiles/Rogue/FrostyFlareProj.cs @@ -51,7 +51,7 @@ namespace CalamityMod.Projectiles.Rogue Main.projectile[shard].alpha = Projectile.alpha; } - int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 172); + int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.DungeonWater); Main.dust[index2].noGravity = true; } else @@ -86,7 +86,6 @@ namespace CalamityMod.Projectiles.Rogue { target.AddBuff(BuffID.Frostburn2, 180); target.AddBuff(ModContent.BuffType(), 30); - target.immune[Projectile.owner] = 0; Projectile.ai[0] = 1f; Projectile.ai[1] = target.whoAmI; Projectile.velocity = target.Center - Projectile.Center; diff --git a/Projectiles/Rogue/FrostyFlareStealth.cs b/Projectiles/Rogue/FrostyFlareStealth.cs index d955ef43a1..3bda873ea7 100644 --- a/Projectiles/Rogue/FrostyFlareStealth.cs +++ b/Projectiles/Rogue/FrostyFlareStealth.cs @@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Rogue } } - int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 172); + int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.DungeonWater); Main.dust[index2].noGravity = true; } else @@ -95,7 +95,6 @@ namespace CalamityMod.Projectiles.Rogue { target.AddBuff(BuffID.Frostburn2, 180); target.AddBuff(ModContent.BuffType(), 30); - target.immune[Projectile.owner] = 0; Projectile.ai[0] = 1f; Projectile.ai[1] = target.whoAmI; Projectile.velocity = target.Center - Projectile.Center; diff --git a/Projectiles/Rogue/GelDartProjectile.cs b/Projectiles/Rogue/GelDartProjectile.cs index ad99161a0f..2a7639c289 100644 --- a/Projectiles/Rogue/GelDartProjectile.cs +++ b/Projectiles/Rogue/GelDartProjectile.cs @@ -1,12 +1,12 @@ -using CalamityMod.Items.Weapons.Rogue; +using System; +using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { public class GelDartProjectile : ModProjectile, ILocalizedModType @@ -77,7 +77,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } diff --git a/Projectiles/Rogue/GildedDaggerProj.cs b/Projectiles/Rogue/GildedDaggerProj.cs index 56a0f11ac7..19b51fd850 100644 --- a/Projectiles/Rogue/GildedDaggerProj.cs +++ b/Projectiles/Rogue/GildedDaggerProj.cs @@ -1,10 +1,10 @@ +using System.Collections.Generic; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System.Collections.Generic; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -123,7 +123,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } @@ -132,7 +132,7 @@ namespace CalamityMod.Projectiles.Rogue { for (int num621 = 0; num621 < 8; num621++) { - int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, DustID.GoldCoin, 0f, 0f, 100, default, 1f); + int num622 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GoldCoin, 0f, 0f, 100, default, 1f); Main.dust[num622].velocity *= 1f; } } diff --git a/Projectiles/Rogue/GlaiveProj.cs b/Projectiles/Rogue/GlaiveProj.cs index 3864eb16e6..ef3c88a0a6 100644 --- a/Projectiles/Rogue/GlaiveProj.cs +++ b/Projectiles/Rogue/GlaiveProj.cs @@ -1,10 +1,10 @@ -using CalamityMod.Items.Weapons.Rogue; +using System; +using CalamityMod.Items.Weapons.Rogue; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -32,6 +32,8 @@ namespace CalamityMod.Projectiles.Rogue Projectile.timeLeft = Lifetime; DrawOffsetX = -10; Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Rogue/GleamingDaggerProj.cs b/Projectiles/Rogue/GleamingDaggerProj.cs index ad36a49670..14913d4f07 100644 --- a/Projectiles/Rogue/GleamingDaggerProj.cs +++ b/Projectiles/Rogue/GleamingDaggerProj.cs @@ -1,10 +1,10 @@ +using System.Collections.Generic; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System.Collections.Generic; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -123,7 +123,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } @@ -132,7 +132,7 @@ namespace CalamityMod.Projectiles.Rogue { for (int num621 = 0; num621 < 8; num621++) { - int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, DustID.PlatinumCoin, 0f, 0f, 100, default, 1f); + int num622 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.PlatinumCoin, 0f, 0f, 100, default, 1f); Main.dust[num622].velocity *= 1f; } } diff --git a/Projectiles/Rogue/GodsParanoiaProj.cs b/Projectiles/Rogue/GodsParanoiaProj.cs index 0363ed658a..235c6ada4c 100644 --- a/Projectiles/Rogue/GodsParanoiaProj.cs +++ b/Projectiles/Rogue/GodsParanoiaProj.cs @@ -1,7 +1,7 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -51,7 +51,7 @@ namespace CalamityMod.Projectiles.Rogue if (Projectile.ai[0] == 1f) { kunaiStabbing++; - if (kunaiStabbing >= 30 || (Projectile.Calamity().stealthStrike && kunaiStabbing >=20)) + if (kunaiStabbing >= 30 || (Projectile.Calamity().stealthStrike && kunaiStabbing >= 20)) { kunaiStabbing = 0; float startOffsetX = Main.rand.NextFloat(100f, 200f) * (Main.rand.NextBool() ? -1f : 1f); diff --git a/Projectiles/Rogue/GraveGrimreaverProjectile.cs b/Projectiles/Rogue/GraveGrimreaverProjectile.cs index 08df69e65f..bc0b984642 100644 --- a/Projectiles/Rogue/GraveGrimreaverProjectile.cs +++ b/Projectiles/Rogue/GraveGrimreaverProjectile.cs @@ -1,9 +1,9 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -105,7 +105,7 @@ namespace CalamityMod.Projectiles.Rogue randomAdjust = random3 / randomAdjust; random1 *= randomAdjust; random2 *= randomAdjust; - int d = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, 75, 0, 0, 0, default, size); + int d = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, DustID.CursedTorch, 0, 0, 0, default, size); Dust dust = Main.dust[d]; dust.noGravity = true; dust.position.X = Projectile.Center.X; diff --git a/Projectiles/Rogue/GreenDonkeyKongReference.cs b/Projectiles/Rogue/GreenDonkeyKongReference.cs index 38670115c7..1b8e63e9dd 100644 --- a/Projectiles/Rogue/GreenDonkeyKongReference.cs +++ b/Projectiles/Rogue/GreenDonkeyKongReference.cs @@ -1,9 +1,9 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { diff --git a/Projectiles/Rogue/GrimreaverBat.cs b/Projectiles/Rogue/GrimreaverBat.cs index dbb741bd29..2577bb628c 100644 --- a/Projectiles/Rogue/GrimreaverBat.cs +++ b/Projectiles/Rogue/GrimreaverBat.cs @@ -1,5 +1,5 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; diff --git a/Projectiles/Rogue/HeavenfallenEnergy.cs b/Projectiles/Rogue/HeavenfallenEnergy.cs index 34e373a990..970d99845b 100644 --- a/Projectiles/Rogue/HeavenfallenEnergy.cs +++ b/Projectiles/Rogue/HeavenfallenEnergy.cs @@ -1,4 +1,4 @@ -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Terraria; @@ -32,11 +32,11 @@ namespace CalamityMod.Projectiles.Rogue { if (Projectile.ai[0] % 4 == 0) { - coolDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width - constant * 2, Projectile.height - constant * 2, ModContent.DustType(), 0f, 0f, 100, default, 1.5f); + coolDust = Dust.NewDust(Projectile.position, Projectile.width - constant * 2, Projectile.height - constant * 2, ModContent.DustType(), 0f, 0f, 100, default, 1.5f); } else { - coolDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width - constant * 2, Projectile.height - constant * 2, ModContent.DustType(), 0f, 0f, 100, default, 1.5f); + coolDust = Dust.NewDust(Projectile.position, Projectile.width - constant * 2, Projectile.height - constant * 2, ModContent.DustType(), 0f, 0f, 100, default, 1.5f); } Main.dust[coolDust].noGravity = true; Main.dust[coolDust].velocity *= 0.1f; @@ -50,9 +50,9 @@ namespace CalamityMod.Projectiles.Rogue } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 180); - + public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 180); - + public override bool? CanDamage() => Projectile.ai[0] >= 15f || raining; } } diff --git a/Projectiles/Rogue/HeavenfallenStardiskBoomerang.cs b/Projectiles/Rogue/HeavenfallenStardiskBoomerang.cs index b4eefeb60e..2916cc6b65 100644 --- a/Projectiles/Rogue/HeavenfallenStardiskBoomerang.cs +++ b/Projectiles/Rogue/HeavenfallenStardiskBoomerang.cs @@ -1,11 +1,11 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -30,14 +30,14 @@ namespace CalamityMod.Projectiles.Rogue Projectile.ignoreWater = true; Projectile.netImportant = true; Projectile.penetrate = 1; - Projectile.timeLeft = 300; + Projectile.timeLeft = 150; Projectile.DamageType = RogueDamageClass.Instance; } public override void AI() { - if (Projectile.Calamity().stealthStrike && Projectile.timeLeft % 5f == 4f) // every 5 frames - CalamityUtils.ProjectileRain(Projectile.GetSource_FromThis(), Projectile.Center, 400f, 100f, 500f, 800f, 29f, ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack * 0.5f, Projectile.owner); + if (Projectile.Calamity().stealthStrike && Projectile.timeLeft % 20f == 4f) // every 5 frames + CalamityUtils.ProjectileRain(Projectile.GetSource_FromThis(), Projectile.Center, 400f, 100f, 500f, 800f, 29f, ModContent.ProjectileType(), Projectile.damage / 6, Projectile.knockBack * 0.5f, Projectile.owner); if (Projectile.alpha > 0) { @@ -50,22 +50,19 @@ namespace CalamityMod.Projectiles.Rogue for (int i = 0; i < 2; i++) { - int blueDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 1f); + int blueDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 1f); Main.dust[blueDust].noGravity = true; Main.dust[blueDust].velocity *= 0f; } for (int i = 0; i < 2; i++) { - int orangeDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 1f); + int orangeDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 1f); Main.dust[orangeDust].noGravity = true; Main.dust[orangeDust].velocity *= 0f; } Projectile.rotation += 0.5f; - if (Owner.position.Y != Owner.oldPosition.Y && Projectile.ai[0] == 0f) - Projectile.ai[1]++; - Projectile.ai[0]++; if (Main.myPlayer == Projectile.owner && Projectile.ai[0] == 20f) @@ -147,23 +144,23 @@ namespace CalamityMod.Projectiles.Rogue SoundEngine.PlaySound(SoundID.Item10, Projectile.position); for (int i = 0; i < 10; i++) { - int dusty = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 1.5f); + int dusty = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 1.5f); Main.dust[dusty].noGravity = true; Main.dust[dusty].velocity *= 0f; } for (int i = 0; i < 10; i++) { - int dusty = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 1.5f); + int dusty = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 1.5f); Main.dust[dusty].noGravity = true; Main.dust[dusty].velocity *= 0f; } - - if (Projectile.owner == Main.myPlayer && Projectile.ai[1] > 0) + + if (Projectile.owner == Main.myPlayer) { for (int i = 0; i < 5; i++) { Vector2 velocity = ((MathHelper.TwoPi * i / 5f) - MathHelper.PiOver2).ToRotationVector2() * 4f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack * 0.5f, Projectile.owner, 0f, 1f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage / 4, Projectile.knockBack * 0.5f, Projectile.owner, 0f, 1f); } } } diff --git a/Projectiles/Rogue/HellsSunProj.cs b/Projectiles/Rogue/HellsSunProj.cs index 55c2c81d91..b160d689a3 100644 --- a/Projectiles/Rogue/HellsSunProj.cs +++ b/Projectiles/Rogue/HellsSunProj.cs @@ -1,8 +1,8 @@ -using Terraria; -using Microsoft.Xna.Framework; -using Terraria.ModLoader; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.CalPlayer; -using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { @@ -40,10 +40,10 @@ namespace CalamityMod.Projectiles.Rogue if (Projectile.localAI[1] >= 30f) { Vector2 velocity = Projectile.velocity; - Vector2 vector2_1 = new Vector2((float) Main.rand.Next(-100, 101), (float) Main.rand.Next(-100, 101)); + Vector2 vector2_1 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); vector2_1.Normalize(); - Vector2 vector2_2 = vector2_1 * ((float) Main.rand.Next(10, 41) * 0.1f); - if (Main.rand.Next(3) == 0) + Vector2 vector2_2 = vector2_1 * ((float)Main.rand.Next(10, 41) * 0.1f); + if (Main.rand.NextBool(3)) vector2_2 *= 2f; Vector2 vector2_3 = velocity * 0.25f + vector2_2; Vector2 vector2_5 = vector2_3 * 0.8f; @@ -56,10 +56,10 @@ namespace CalamityMod.Projectiles.Rogue if (Projectile.localAI[1] >= 60f) { Vector2 velocity = Projectile.velocity; - Vector2 vector2_1 = new Vector2((float) Main.rand.Next(-100, 101), (float) Main.rand.Next(-100, 101)); + Vector2 vector2_1 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); vector2_1.Normalize(); - Vector2 vector2_2 = vector2_1 * ((float) Main.rand.Next(10, 41) * 0.1f); - if (Main.rand.Next(3) == 0) + Vector2 vector2_2 = vector2_1 * ((float)Main.rand.Next(10, 41) * 0.1f); + if (Main.rand.NextBool(3)) vector2_2 *= 2f; Vector2 vector2_3 = velocity * 0.25f + vector2_2; Vector2 vector2_5 = vector2_3 * 0.8f; diff --git a/Projectiles/Rogue/Honeycomb.cs b/Projectiles/Rogue/Honeycomb.cs index 105989553d..9b67402379 100644 --- a/Projectiles/Rogue/Honeycomb.cs +++ b/Projectiles/Rogue/Honeycomb.cs @@ -1,10 +1,10 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Items.Weapons.Rogue; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Items.Weapons.Rogue; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -27,79 +27,48 @@ namespace CalamityMod.Projectiles.Rogue Projectile.DamageType = RogueDamageClass.Instance; } - public override void AI() - { - Player player = Main.player[Main.myPlayer]; - Vector2 posDiff = player.Center - Projectile.Center; - if (posDiff.Length() <= radius) - { - player.AddBuff(BuffID.Honey, 300); - } - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - SpawnFragments(); - 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; - } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - SpawnFragments(); - Projectile.velocity.X = -Projectile.velocity.X; - Projectile.velocity.Y = -Projectile.velocity.Y; + Player player = Main.player[Main.myPlayer]; + if (Projectile.Calamity().stealthStrike) + player.AddBuff(BuffID.Honey, 600); + SpawnProjectiles(); } public override void OnHitPlayer(Player target, Player.HurtInfo info) { - SpawnFragments(); - Projectile.velocity.X = -Projectile.velocity.X; - Projectile.velocity.Y = -Projectile.velocity.Y; + Player player = Main.player[Main.myPlayer]; + if (Projectile.Calamity().stealthStrike) + player.AddBuff(BuffID.Honey, 600); + SpawnProjectiles(); } - public void SpawnFragments() + public void SpawnProjectiles() { - int split = 0; - while (split < 2) + Player player = Main.player[Main.myPlayer]; + int fragAmt = 2; + for (int i = 0; i < fragAmt; i++) { //Calculate the velocity of the projectile - float shardspeedX = -Projectile.velocity.X * Main.rand.NextFloat(.5f, .7f) + Main.rand.NextFloat(-3f, 3f); - float shardspeedY = -Projectile.velocity.Y * Main.rand.Next(50, 70) * 0.01f + Main.rand.Next(-8, 9) * 0.2f; - //Prevents the projectile speed from being too low - if (shardspeedX < 2f && shardspeedX > -2f) - { - shardspeedX += -Projectile.velocity.X; - } - if (shardspeedY > 2f && shardspeedY < 2f) - { - shardspeedY += -Projectile.velocity.Y; - } + Vector2 shardVelocity = CalamityUtils.RandomVelocity(100f, 35f, 55f); //Spawn the projectile - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.position.X + shardspeedX, Projectile.position.Y + shardspeedY, shardspeedX, shardspeedY, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, Main.rand.Next(3), 0f); - split += 1; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, shardVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, Main.rand.Next(3), 0f); + } + if (Projectile.Calamity().stealthStrike) + { + int beeAmt = 4; + for (int j = 0; j < beeAmt; j++) + { + Vector2 beeVelocity = CalamityUtils.RandomVelocity(100f, 35f, 55f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, beeVelocity, player.beeType(), player.beeDamage(Projectile.damage), player.beeKB(0.25f), player.whoAmI); + } } } public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } @@ -111,7 +80,7 @@ namespace CalamityMod.Projectiles.Rogue int dust_splash = 0; while (dust_splash < 9) { - Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 9, -Projectile.velocity.X * 0.15f, -Projectile.velocity.Y * 0.15f, 159, default, 1.5f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Copper, -Projectile.velocity.X * 0.15f, -Projectile.velocity.Y * 0.15f, 159, default, 1.5f); dust_splash += 1; } } diff --git a/Projectiles/Rogue/HoneycombFragment.cs b/Projectiles/Rogue/HoneycombFragment.cs index 628b27b057..4e0ee12e20 100644 --- a/Projectiles/Rogue/HoneycombFragment.cs +++ b/Projectiles/Rogue/HoneycombFragment.cs @@ -1,7 +1,8 @@ -using Terraria; -using Terraria.ModLoader; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { @@ -51,7 +52,7 @@ namespace CalamityMod.Projectiles.Rogue int splash = 0; while (splash < 4) { - Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 9, -Projectile.velocity.X * 0.15f, -Projectile.velocity.Y * 0.10f, 159, default, 0.9f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Copper, -Projectile.velocity.X * 0.15f, -Projectile.velocity.Y * 0.10f, 159, default, 0.9f); splash += 1; } } diff --git a/Projectiles/Rogue/HypothermiaChunk.cs b/Projectiles/Rogue/HypothermiaChunk.cs index 6ad3bc7bfa..278b40b93e 100644 --- a/Projectiles/Rogue/HypothermiaChunk.cs +++ b/Projectiles/Rogue/HypothermiaChunk.cs @@ -1,8 +1,8 @@ -using Terraria; +using CalamityMod.Buffs.StatDebuffs; +using Microsoft.Xna.Framework; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using Microsoft.Xna.Framework; -using CalamityMod.Buffs.StatDebuffs; namespace CalamityMod.Projectiles.Rogue { diff --git a/Projectiles/Rogue/HypothermiaShard.cs b/Projectiles/Rogue/HypothermiaShard.cs index 2664df3b17..75a7cede89 100644 --- a/Projectiles/Rogue/HypothermiaShard.cs +++ b/Projectiles/Rogue/HypothermiaShard.cs @@ -72,12 +72,12 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.Frostburn2, 120); - public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(BuffID.Frostburn2, 120); + public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(BuffID.Frostburn2, 120); public override bool PreDraw(ref Color lightColor) { //Changes the texture of the projectile - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; if (Projectile.ai[0] == 1f) { texture = ModContent.Request("CalamityMod/Projectiles/Rogue/HypothermiaShard2").Value; diff --git a/Projectiles/Rogue/IceStarProjectile.cs b/Projectiles/Rogue/IceStarProjectile.cs index 1756a355ab..30320b7672 100644 --- a/Projectiles/Rogue/IceStarProjectile.cs +++ b/Projectiles/Rogue/IceStarProjectile.cs @@ -1,9 +1,9 @@ using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { public class IceStarProjectile : ModProjectile, ILocalizedModType @@ -45,33 +45,9 @@ namespace CalamityMod.Projectiles.Rogue if (Main.rand.NextBool(3)) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 67, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.IceRod, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } - Vector2 center = Projectile.Center; - float maxDistance = Projectile.Calamity().stealthStrike ? 800f : 400f; - bool homeIn = false; - - for (int i = 0; i < Main.maxNPCs; i++) - { - if (Main.npc[i].CanBeChasedBy(Projectile, false)) - { - float extraDistance = (float)(Main.npc[i].width / 2) + (float)(Main.npc[i].height / 2); - - if (Vector2.Distance(Main.npc[i].Center, Projectile.Center) < (maxDistance + extraDistance) && Collision.CanHit(Projectile.Center, 1, 1, Main.npc[i].Center, 1, 1)) - { - center = Main.npc[i].Center; - homeIn = true; - break; - } - } - } - - if (homeIn) - { - Vector2 moveDirection = Projectile.SafeDirectionTo(center, Vector2.UnitY); - Projectile.velocity = (Projectile.velocity * 20f + moveDirection * 14f) / 21f; - } - Projectile.velocity = initStealth && !homeIn ? initialVelocity : Projectile.velocity; + CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, Projectile.Calamity().stealthStrike ? 800f : 400f, 14f, 20f); } public override void OnKill(int timeLeft) @@ -79,18 +55,18 @@ namespace CalamityMod.Projectiles.Rogue SoundEngine.PlaySound(SoundID.Item27, Projectile.position); for (int k = 0; k < 5; k++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 67, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.IceRod, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => OnHitEffects(); - + public override void OnHitPlayer(Player target, Player.HurtInfo info) => OnHitEffects(); public void OnHitEffects() { if (initStealth && Projectile.owner == Main.myPlayer && Projectile.numHits < 1) - { + { for (int i = 0; i < 8; i++) { Vector2 velocity = (MathHelper.TwoPi * i / 8f).ToRotationVector2() * 4f; diff --git a/Projectiles/Rogue/IcebreakerHammer.cs b/Projectiles/Rogue/IcebreakerHammer.cs index 958cbf080c..ff7f603d8d 100644 --- a/Projectiles/Rogue/IcebreakerHammer.cs +++ b/Projectiles/Rogue/IcebreakerHammer.cs @@ -34,13 +34,13 @@ namespace CalamityMod.Projectiles.Rogue { if (Main.rand.NextBool(3)) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 67, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.IceRod, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } } public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } @@ -97,7 +97,7 @@ namespace CalamityMod.Projectiles.Rogue { Player owner = Main.player[Projectile.owner]; Player player = Main.player[i]; - if ((owner.team != player.team || player.team == 0) && player.hostile && owner.hostile && !player.dead && !player.buffImmune[buffType] && Vector2.Distance(Projectile.Center, player.Center) <= radius) + if ((owner.team != player.team || player.team == 0) && player.hostile && owner.hostile && !player.dead && !player.buffImmune[buffType] && Vector2.Distance(Projectile.Center, player.Center) <= radius) { if (player.FindBuffIndex(buffType) == -1) player.AddBuff(buffType, 60, false); diff --git a/Projectiles/Rogue/IchorSpearProj.cs b/Projectiles/Rogue/IchorSpearProj.cs index ffb818d70c..c61396d01c 100644 --- a/Projectiles/Rogue/IchorSpearProj.cs +++ b/Projectiles/Rogue/IchorSpearProj.cs @@ -1,10 +1,10 @@ -using CalamityMod.Particles; +using System; +using System.Reflection.Metadata; +using CalamityMod.Particles; using CalamityMod.Projectiles.Pets; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Mono.Cecil; -using System; -using System.Reflection.Metadata; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -85,7 +85,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } diff --git a/Projectiles/Rogue/InfernalKrisCinder.cs b/Projectiles/Rogue/InfernalKrisCinder.cs index 3f3c2edace..237bfae602 100644 --- a/Projectiles/Rogue/InfernalKrisCinder.cs +++ b/Projectiles/Rogue/InfernalKrisCinder.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; @@ -37,7 +37,7 @@ namespace CalamityMod.Projectiles.Rogue int numDust = 2; for (int i = 0; i < numDust; i++) { - Dust.NewDust(Projectile.position, 4, 4, 6, Projectile.velocity.X, Projectile.velocity.Y, 0, default, Main.rand.NextFloat(minScale, maxScale)); + Dust.NewDust(Projectile.position, 4, 4, DustID.Torch, Projectile.velocity.X, Projectile.velocity.Y, 0, default, Main.rand.NextFloat(minScale, maxScale)); } Projectile.Kill(); @@ -52,7 +52,7 @@ namespace CalamityMod.Projectiles.Rogue { // If this is a stealth strike, make the blade glow orange Color glowColour = new Color(255, 215, 100, 100); - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, glowColour, Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); float minScale = 1.9f; @@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Rogue int numDust = 2; for (int i = 0; i < numDust; i++) { - int dust = Dust.NewDust(Projectile.position, 4, 4, 6, 0f, -2f, 0, default, Main.rand.NextFloat(minScale, maxScale)); + int dust = Dust.NewDust(Projectile.position, 4, 4, DustID.Torch, 0f, -2f, 0, default, Main.rand.NextFloat(minScale, maxScale)); Main.dust[dust].noGravity = true; } return false; diff --git a/Projectiles/Rogue/InfernalKrisExplosion.cs b/Projectiles/Rogue/InfernalKrisExplosion.cs index 14ec641a10..1ec31cc839 100644 --- a/Projectiles/Rogue/InfernalKrisExplosion.cs +++ b/Projectiles/Rogue/InfernalKrisExplosion.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Projectiles/Rogue/InfernalKrisProjectile.cs b/Projectiles/Rogue/InfernalKrisProjectile.cs index 4d75d0aaa2..66c7e17204 100644 --- a/Projectiles/Rogue/InfernalKrisProjectile.cs +++ b/Projectiles/Rogue/InfernalKrisProjectile.cs @@ -1,10 +1,10 @@ -using CalamityMod.Items.Weapons.Rogue; +using System; +using CalamityMod.Items.Weapons.Rogue; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -39,12 +39,12 @@ namespace CalamityMod.Projectiles.Rogue float minScale = 1.9f; float maxScale = 2.5f; - int dust = Dust.NewDust(Projectile.position - new Vector2(10, 10), 30, 30, 6, Projectile.velocity.X, Projectile.velocity.Y, 0, default, Main.rand.NextFloat(minScale, maxScale)); + int dust = Dust.NewDust(Projectile.position - new Vector2(10, 10), 30, 30, DustID.Torch, Projectile.velocity.X, Projectile.velocity.Y, 0, default, Main.rand.NextFloat(minScale, maxScale)); Main.dust[dust].noGravity = true; } else { - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 0.785f; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4; } Projectile.velocity.Y += 0.01f; @@ -64,7 +64,7 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - int debuffTime = 60 * (Projectile.Calamity().stealthStrike ? Main.rand.Next(4,8) : Main.rand.Next(3,6)); + int debuffTime = 60 * (Projectile.Calamity().stealthStrike ? Main.rand.Next(4, 8) : Main.rand.Next(3, 6)); target.AddBuff(BuffID.OnFire, debuffTime); if (Projectile.Calamity().stealthStrike) @@ -87,7 +87,7 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitPlayer(Player target, Player.HurtInfo info) { - int debuffTime = 60 * (Projectile.Calamity().stealthStrike ? Main.rand.Next(4,8) : Main.rand.Next(3,6)); + int debuffTime = 60 * (Projectile.Calamity().stealthStrike ? Main.rand.Next(4, 8) : Main.rand.Next(3, 6)); target.AddBuff(BuffID.OnFire, debuffTime); if (Projectile.Calamity().stealthStrike) @@ -118,7 +118,7 @@ namespace CalamityMod.Projectiles.Rogue float minScale = 1.9f; float maxScale = 2.5f; - int dust = Dust.NewDust(Projectile.position, 10, 10, 6, Projectile.velocity.X, Projectile.velocity.Y, 0, default, Main.rand.NextFloat(minScale, maxScale)); + int dust = Dust.NewDust(Projectile.position, 10, 10, DustID.Torch, Projectile.velocity.X, Projectile.velocity.Y, 0, default, Main.rand.NextFloat(minScale, maxScale)); Main.dust[dust].noGravity = true; } else diff --git a/Projectiles/Rogue/InfestedClawmerangProj.cs b/Projectiles/Rogue/InfestedClawmerangProj.cs index 07244e9291..13a9af0825 100644 --- a/Projectiles/Rogue/InfestedClawmerangProj.cs +++ b/Projectiles/Rogue/InfestedClawmerangProj.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Projectiles.Rogue Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.35f / 255f, (255 - Projectile.alpha) * 0.5f / 255f); if (Main.rand.NextBool(5)) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 56, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.BlueFairy, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } if (Projectile.Calamity().stealthStrike) { @@ -47,7 +47,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } diff --git a/Projectiles/Rogue/InkBombProjectile.cs b/Projectiles/Rogue/InkBombProjectile.cs index d4ee134514..42621db550 100644 --- a/Projectiles/Rogue/InkBombProjectile.cs +++ b/Projectiles/Rogue/InkBombProjectile.cs @@ -1,9 +1,9 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Items.Potions.Alcohol; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using CalamityMod.Items.Potions.Alcohol; namespace CalamityMod.Projectiles.Rogue { diff --git a/Projectiles/Rogue/InkCloud.cs b/Projectiles/Rogue/InkCloud.cs index 37716db7e8..f4df29dad5 100644 --- a/Projectiles/Rogue/InkCloud.cs +++ b/Projectiles/Rogue/InkCloud.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Projectiles/Rogue/InkCloud2.cs b/Projectiles/Rogue/InkCloud2.cs index bcf9078159..4a7d9e8a1d 100644 --- a/Projectiles/Rogue/InkCloud2.cs +++ b/Projectiles/Rogue/InkCloud2.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Projectiles/Rogue/InkCloud3.cs b/Projectiles/Rogue/InkCloud3.cs index 51eb2eac2a..d3e149c735 100644 --- a/Projectiles/Rogue/InkCloud3.cs +++ b/Projectiles/Rogue/InkCloud3.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Projectiles/Rogue/IronFranciscaProj.cs b/Projectiles/Rogue/IronFranciscaProj.cs index 5d80f06dc8..92520b56eb 100644 --- a/Projectiles/Rogue/IronFranciscaProj.cs +++ b/Projectiles/Rogue/IronFranciscaProj.cs @@ -1,11 +1,11 @@ -using CalamityMod.Items.Weapons.Rogue; +using System; +using CalamityMod.Items.Weapons.Rogue; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -59,7 +59,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } diff --git a/Projectiles/Rogue/JawsProjectile.cs b/Projectiles/Rogue/JawsProjectile.cs index 0e5e1d3b2e..73a0ad5587 100644 --- a/Projectiles/Rogue/JawsProjectile.cs +++ b/Projectiles/Rogue/JawsProjectile.cs @@ -1,11 +1,11 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -35,7 +35,7 @@ namespace CalamityMod.Projectiles.Rogue { if (Projectile.ai[0] == 0f) { - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; if (Projectile.Calamity().stealthStrike) { int dustType = Utils.SelectRandom(Main.rand, new int[] diff --git a/Projectiles/Rogue/JawsShockwave.cs b/Projectiles/Rogue/JawsShockwave.cs index e485d1d03b..41437e9836 100644 --- a/Projectiles/Rogue/JawsShockwave.cs +++ b/Projectiles/Rogue/JawsShockwave.cs @@ -1,4 +1,4 @@ -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; diff --git a/Projectiles/Rogue/KelvinCatalystBoomerang.cs b/Projectiles/Rogue/KelvinCatalystBoomerang.cs index 61978dcdf2..6a2f3827e0 100644 --- a/Projectiles/Rogue/KelvinCatalystBoomerang.cs +++ b/Projectiles/Rogue/KelvinCatalystBoomerang.cs @@ -1,11 +1,11 @@ -using CalamityMod.Projectiles.Typeless; -using Microsoft.Xna.Framework; -using System; +using System; using System.IO; +using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -134,7 +134,7 @@ namespace CalamityMod.Projectiles.Rogue SoundEngine.PlaySound(SoundID.Item7, Projectile.Center); } - int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 67, 0f, 0f, 100, default, 1f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.IceRod, 0f, 0f, 100, default, 1f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 0f; @@ -176,7 +176,7 @@ namespace CalamityMod.Projectiles.Rogue { int maxSpawns = Projectile.Calamity().stealthStrike ? 3 : 1; if (Projectile.owner == Main.myPlayer && Projectile.numHits < maxSpawns) - { + { for (int i = 0; i < 5; i++) { Vector2 velocity = (MathHelper.TwoPi * i / 5f).ToRotationVector2() * 4f; diff --git a/Projectiles/Rogue/Knife.cs b/Projectiles/Rogue/Knife.cs index 7abc5344b8..32e6c36e8d 100644 --- a/Projectiles/Rogue/Knife.cs +++ b/Projectiles/Rogue/Knife.cs @@ -30,9 +30,9 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { - if (Main.rand.Next(5) == 0) + if (Main.rand.NextBool(5)) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 5, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Blood, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); diff --git a/Projectiles/Rogue/KylieBoomerang.cs b/Projectiles/Rogue/KylieBoomerang.cs index 6d42e7bbf9..12d1648a1c 100644 --- a/Projectiles/Rogue/KylieBoomerang.cs +++ b/Projectiles/Rogue/KylieBoomerang.cs @@ -1,10 +1,10 @@ -using CalamityMod.Items.Weapons.Rogue; +using System; +using CalamityMod.Items.Weapons.Rogue; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -38,9 +38,9 @@ namespace CalamityMod.Projectiles.Rogue timer++; //Dust trail - if (Main.rand.Next(15) == 0) + if (Main.rand.NextBool(15)) { - int d = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 7, Projectile.velocity.X * 0.25f, Projectile.velocity.Y * 0.25f, 100, default, 0f); + int d = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.WoodFurniture, Projectile.velocity.X * 0.25f, Projectile.velocity.Y * 0.25f, 100, default, 0f); Main.dust[d].position = Projectile.Center; } //Constant sound effects diff --git a/Projectiles/Rogue/LanceofDestiny.cs b/Projectiles/Rogue/LanceofDestiny.cs index 20b150e0e5..49ec34f37a 100644 --- a/Projectiles/Rogue/LanceofDestiny.cs +++ b/Projectiles/Rogue/LanceofDestiny.cs @@ -1,10 +1,10 @@ -using CalamityMod.Particles; +using System; +using System.Reflection.Metadata; +using CalamityMod.Particles; using CalamityMod.Projectiles.Pets; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Mono.Cecil; -using System; -using System.Reflection.Metadata; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -14,7 +14,7 @@ namespace CalamityMod.Projectiles.Rogue { public class LanceofDestiny : ModProjectile, ILocalizedModType { - public static readonly SoundStyle Hitsound = new("CalamityMod/Sounds/NPCKilled/DevourerSegmentBreak2") { Volume = 0.6f, PitchVariance = 0.3f}; + public static readonly SoundStyle Hitsound = new("CalamityMod/Sounds/NPCKilled/DevourerSegmentBreak2") { Volume = 0.6f, PitchVariance = 0.3f }; public new string LocalizationCategory => "Projectiles.Rogue"; public override string Texture => "CalamityMod/Projectiles/Rogue/LanceofDestiny"; public bool posthit = false; @@ -74,7 +74,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } diff --git a/Projectiles/Rogue/LeadTomahawkProj.cs b/Projectiles/Rogue/LeadTomahawkProj.cs index 3c4a417675..d2a961382c 100644 --- a/Projectiles/Rogue/LeadTomahawkProj.cs +++ b/Projectiles/Rogue/LeadTomahawkProj.cs @@ -1,11 +1,11 @@ -using CalamityMod.Items.Weapons.Rogue; +using System; +using CalamityMod.Items.Weapons.Rogue; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -59,7 +59,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } diff --git a/Projectiles/Rogue/LeonidCometBig.cs b/Projectiles/Rogue/LeonidCometBig.cs index e8f772e6ee..d797ae04f1 100644 --- a/Projectiles/Rogue/LeonidCometBig.cs +++ b/Projectiles/Rogue/LeonidCometBig.cs @@ -3,9 +3,9 @@ using CalamityMod.Items.Weapons.Rogue; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { public class LeonidCometBig : ModProjectile, ILocalizedModType @@ -56,14 +56,14 @@ namespace CalamityMod.Projectiles.Rogue Projectile.position.X -= (float)(Projectile.width / 2); Projectile.position.Y -= (float)(Projectile.height / 2); for (int index = 0; index < 8; ++index) - Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 31, 0.0f, 0.0f, 100, CalamityUtils.ColorSwap(LeonidProgenitor.blueColor, LeonidProgenitor.purpleColor, 1f), 1.5f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Smoke, 0.0f, 0.0f, 100, CalamityUtils.ColorSwap(LeonidProgenitor.blueColor, LeonidProgenitor.purpleColor, 1f), 1.5f); for (int index1 = 0; index1 < 32; ++index1) { - int index2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 6, 0f, 0f, 100, CalamityUtils.ColorSwap(LeonidProgenitor.blueColor, LeonidProgenitor.purpleColor, 1f), 2.5f); + int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, CalamityUtils.ColorSwap(LeonidProgenitor.blueColor, LeonidProgenitor.purpleColor, 1f), 2.5f); Dust dust1 = Main.dust[index2]; dust1.noGravity = true; dust1.velocity *= 3f; - int index3 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 6, 0f, 0f, 100, CalamityUtils.ColorSwap(LeonidProgenitor.blueColor, LeonidProgenitor.purpleColor, 1f), 1.5f); + int index3 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, CalamityUtils.ColorSwap(LeonidProgenitor.blueColor, LeonidProgenitor.purpleColor, 1f), 1.5f); Dust dust2 = Main.dust[index3]; dust2.velocity *= 2f; dust2.noGravity = true; @@ -89,7 +89,7 @@ namespace CalamityMod.Projectiles.Rogue } for (int index1 = 0; index1 < 5; ++index1) { - int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, Utils.SelectRandom(Main.rand, new int[3]{ 6, 259, 158 }), 2.5f * (float) Projectile.direction, -2.5f, 0, CalamityUtils.ColorSwap(LeonidProgenitor.blueColor, LeonidProgenitor.purpleColor, 1f), 1f); + int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, Utils.SelectRandom(Main.rand, new int[3] { 6, 259, 158 }), 2.5f * (float)Projectile.direction, -2.5f, 0, CalamityUtils.ColorSwap(LeonidProgenitor.blueColor, LeonidProgenitor.purpleColor, 1f), 1f); Dust dust1 = Main.dust[index2]; dust1.alpha = 200; dust1.velocity *= 2.4f; diff --git a/Projectiles/Rogue/LeonidCometSmall.cs b/Projectiles/Rogue/LeonidCometSmall.cs index a45e48a762..9714deddb6 100644 --- a/Projectiles/Rogue/LeonidCometSmall.cs +++ b/Projectiles/Rogue/LeonidCometSmall.cs @@ -1,13 +1,13 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Items.Weapons.Rogue; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { public class LeonidCometSmall : ModProjectile, ILocalizedModType @@ -30,7 +30,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, CalamityUtils.ColorSwap(LeonidProgenitor.blueColor, LeonidProgenitor.purpleColor, 1f), Projectile.rotation, tex.Size() / 2, Projectile.scale, SpriteEffects.None, 0); return false; } @@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Rogue } if (Main.rand.NextBool()) { - int index = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 31, 0f, 0f, 100, CalamityUtils.ColorSwap(LeonidProgenitor.blueColor, LeonidProgenitor.purpleColor, 1f), 1.6f); + int index = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Smoke, 0f, 0f, 100, CalamityUtils.ColorSwap(LeonidProgenitor.blueColor, LeonidProgenitor.purpleColor, 1f), 1.6f); Main.dust[index].noGravity = true; } int index1 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, randomDust, 0f, 0f, 100, CalamityUtils.ColorSwap(LeonidProgenitor.blueColor, LeonidProgenitor.purpleColor, 1f), 1.2f); @@ -97,7 +97,7 @@ namespace CalamityMod.Projectiles.Rogue SoundEngine.PlaySound(SoundID.Item89, Projectile.position); for (int index1 = 0; index1 < 2; ++index1) { - int index2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 31, 0f, 0f, 100, CalamityUtils.ColorSwap(LeonidProgenitor.blueColor, LeonidProgenitor.purpleColor, 1f), 1.5f); + int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Smoke, 0f, 0f, 100, CalamityUtils.ColorSwap(LeonidProgenitor.blueColor, LeonidProgenitor.purpleColor, 1f), 1.5f); Dust dust = Main.dust[index2]; dust.position = Projectile.Center + Vector2.UnitY.RotatedByRandom(Math.PI) * Main.rand.NextFloat() * Projectile.width / 2f; } @@ -108,7 +108,7 @@ namespace CalamityMod.Projectiles.Rogue ModContent.DustType(), ModContent.DustType() }); - int index2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDust, 0f, 0f, 0, CalamityUtils.ColorSwap(LeonidProgenitor.blueColor, LeonidProgenitor.purpleColor, 1f), 2.5f); + int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, randomDust, 0f, 0f, 0, CalamityUtils.ColorSwap(LeonidProgenitor.blueColor, LeonidProgenitor.purpleColor, 1f), 2.5f); Dust dust = Main.dust[index2]; dust.position = Projectile.Center + Vector2.UnitY.RotatedByRandom(Math.PI) * Main.rand.NextFloat() * Projectile.width / 2f; dust.noGravity = true; @@ -116,7 +116,7 @@ namespace CalamityMod.Projectiles.Rogue } for (int index1 = 0; index1 < 5; ++index1) { - int index2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 31, 0f, 0f, 0, CalamityUtils.ColorSwap(LeonidProgenitor.blueColor, LeonidProgenitor.purpleColor, 1f), 1.5f); + int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Smoke, 0f, 0f, 0, CalamityUtils.ColorSwap(LeonidProgenitor.blueColor, LeonidProgenitor.purpleColor, 1f), 1.5f); Dust dust = Main.dust[index2]; dust.position = Projectile.Center + Vector2.UnitX.RotatedByRandom(Math.PI).RotatedBy((double)Projectile.velocity.ToRotation(), new Vector2()) * Projectile.width / 2f; dust.noGravity = true; diff --git a/Projectiles/Rogue/LeonidProgenitorBombshell.cs b/Projectiles/Rogue/LeonidProgenitorBombshell.cs index 49ef7bcfe8..1eedb2ca47 100644 --- a/Projectiles/Rogue/LeonidProgenitorBombshell.cs +++ b/Projectiles/Rogue/LeonidProgenitorBombshell.cs @@ -1,13 +1,13 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; -using CalamityMod.Projectiles.Ranged; using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -34,7 +34,7 @@ namespace CalamityMod.Projectiles.Rogue ModContent.DustType(), ModContent.DustType() }); - int astral = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDust, 0f, 0f, 100, CalamityUtils.ColorSwap(LeonidProgenitor.blueColor, LeonidProgenitor.purpleColor, 1f), 0.8f); + int astral = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, randomDust, 0f, 0f, 100, CalamityUtils.ColorSwap(LeonidProgenitor.blueColor, LeonidProgenitor.purpleColor, 1f), 0.8f); Main.dust[astral].noGravity = true; Main.dust[astral].velocity *= 0f; @@ -58,7 +58,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, lightColor, Projectile.rotation, tex.Size() / 2, Projectile.scale, SpriteEffects.None, 0); return false; } diff --git a/Projectiles/Rogue/LeonidStar.cs b/Projectiles/Rogue/LeonidStar.cs index a01282c4dc..fddf210ab3 100644 --- a/Projectiles/Rogue/LeonidStar.cs +++ b/Projectiles/Rogue/LeonidStar.cs @@ -3,9 +3,9 @@ using CalamityMod.Dusts; using CalamityMod.Items.Weapons.Rogue; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { diff --git a/Projectiles/Rogue/LeviathanTooth.cs b/Projectiles/Rogue/LeviathanTooth.cs index de345a2ac4..8785e9f73e 100644 --- a/Projectiles/Rogue/LeviathanTooth.cs +++ b/Projectiles/Rogue/LeviathanTooth.cs @@ -1,10 +1,10 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -34,7 +34,7 @@ namespace CalamityMod.Projectiles.Rogue { if (Projectile.ai[0] == 0f) { - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; if (Projectile.timeLeft < 575 && !Projectile.Calamity().stealthStrike) { Projectile.velocity.Y += 0.5f; @@ -51,13 +51,33 @@ namespace CalamityMod.Projectiles.Rogue public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) => Projectile.ModifyHitNPCSticky(6); public override bool? CanDamage() => Projectile.ai[0] == 1f ? false : base.CanDamage(); - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.Venom, 180); + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(BuffID.Venom, 180); + if (Projectile.Calamity().stealthStrike) + { + int toothBlast = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.6f), Projectile.knockBack, Projectile.owner, 0f, 0f); + Main.projectile[toothBlast].usesLocalNPCImmunity = true; + Main.projectile[toothBlast].usesIDStaticNPCImmunity = false; + Main.projectile[toothBlast].localNPCHitCooldown = -1; + } + } - public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(BuffID.Venom, 180); + public override void OnHitPlayer(Player target, Player.HurtInfo info) + { + target.AddBuff(BuffID.Venom, 180); + if (Projectile.Calamity().stealthStrike) + { + int toothBlast = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.6f), Projectile.knockBack, Projectile.owner, 0f, 0f); + Main.projectile[toothBlast].usesLocalNPCImmunity = true; + Main.projectile[toothBlast].usesIDStaticNPCImmunity = false; + Main.projectile[toothBlast].localNPCHitCooldown = -1; + } + } public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; if (Projectile.Calamity().lineColor == 1) tex = ModContent.Request("CalamityMod/Projectiles/Rogue/LeviathanTooth2").Value; if (Projectile.Calamity().lineColor == 2) @@ -83,7 +103,7 @@ namespace CalamityMod.Projectiles.Rogue { for (int i = 0; i < 5; i++) { - int dust = Dust.NewDust(Projectile.Center, 1, 1, 33, 0, 0, 0, default, 1.5f); + int dust = Dust.NewDust(Projectile.Center, 1, 1, DustID.Water, 0, 0, 0, default, 1.5f); Main.dust[dust].noGravity = true; } } diff --git a/Projectiles/Rogue/LionfishProj.cs b/Projectiles/Rogue/LionfishProj.cs index b610aca756..d83ea2dff3 100644 --- a/Projectiles/Rogue/LionfishProj.cs +++ b/Projectiles/Rogue/LionfishProj.cs @@ -1,11 +1,11 @@ -using CalamityMod.Projectiles.Melee; +using System; +using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -50,12 +50,12 @@ namespace CalamityMod.Projectiles.Rogue } if (Projectile.Calamity().stealthStrike) { - if (Projectile.timeLeft % 8 == 0 && Projectile.owner == Main.myPlayer) + if (Projectile.timeLeft % 7 == 0 && Projectile.owner == Main.myPlayer) { Vector2 velocity = Projectile.DirectionFrom(Main.player[Projectile.owner].Center); velocity *= Main.rand.NextFloat(4.5f, 6.5f); velocity = velocity.RotatedBy((Main.rand.NextDouble() - 0.5) * Math.PI * 0.5, default); - int spike = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack * 0.5f, Projectile.owner, -10f, 0f); + int spike = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack * 0.5f, Projectile.owner, -10f, 1f); if (spike.WithinBounds(Main.maxProjectiles)) Main.projectile[spike].DamageType = RogueDamageClass.Instance; } @@ -65,7 +65,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.StickyProjAI(15); } - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) => Projectile.ModifyHitNPCSticky(6); + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) => Projectile.ModifyHitNPCSticky(3); public override bool? CanDamage() => Projectile.ai[0] == 1f ? false : base.CanDamage(); public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) @@ -79,7 +79,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; SpriteEffects spriteEffects = SpriteEffects.None; if (Projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally; @@ -93,14 +93,14 @@ namespace CalamityMod.Projectiles.Rogue Projectile.ExpandHitboxBy(72); for (int d = 0; d < 3; d++) { - Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 14, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Demonite, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); } for (int d = 0; d < 30; d++) { - int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 14, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Demonite, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); Main.dust[idx].noGravity = true; Main.dust[idx].velocity *= 3f; - idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 14, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Demonite, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); Main.dust[idx].velocity *= 2f; Main.dust[idx].noGravity = true; } diff --git a/Projectiles/Rogue/LostSoulFriendly.cs b/Projectiles/Rogue/LostSoulFriendly.cs index 02556394c4..8641d91ad2 100644 --- a/Projectiles/Rogue/LostSoulFriendly.cs +++ b/Projectiles/Rogue/LostSoulFriendly.cs @@ -65,7 +65,7 @@ namespace CalamityMod.Projectiles.Rogue { for (int j = 0; j <= 10; j++) { - Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 175, 0f, 0f, 100, default, 1f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.SpectreStaff, 0f, 0f, 100, default, 1f); } } diff --git a/Projectiles/Rogue/LunarKunaiProj.cs b/Projectiles/Rogue/LunarKunaiProj.cs index 5f94249321..ae1f678100 100644 --- a/Projectiles/Rogue/LunarKunaiProj.cs +++ b/Projectiles/Rogue/LunarKunaiProj.cs @@ -1,10 +1,10 @@ using System; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -35,7 +35,7 @@ namespace CalamityMod.Projectiles.Rogue { CalamityPlayer modPlayer = Main.player[Projectile.owner].Calamity(); Projectile.ai[0] += 1f; - if(Projectile.ai[0] == 1f && modPlayer.StealthStrikeAvailable()) + if (Projectile.ai[0] == 1f && modPlayer.StealthStrikeAvailable()) lunarEnhance = true; else if (Projectile.ai[0] >= 50f) lunarEnhance = true; @@ -45,10 +45,10 @@ namespace CalamityMod.Projectiles.Rogue else Projectile.frame = 0; - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, lunarEnhance ? 300f : 150f, lunarEnhance ? 12f : 8f, 20f); - if (Main.rand.Next(6) == 0 && lunarEnhance) - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 229, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + if (Main.rand.NextBool(6)&& lunarEnhance) + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Vortex, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } public override void OnKill(int timeLeft) @@ -65,10 +65,10 @@ namespace CalamityMod.Projectiles.Rogue Projectile.localNPCHitCooldown = 10; for (int i = 0; i < 10; i++) { - int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 229, 0f, 0f, 0, default, 1.5f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Vortex, 0f, 0f, 0, default, 1.5f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 3f; - dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 229, 0f, 0f, 100, default, 1f); + dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Vortex, 0f, 0f, 100, default, 1f); Main.dust[dust].velocity *= 2f; Main.dust[dust].noGravity = true; } @@ -78,7 +78,7 @@ namespace CalamityMod.Projectiles.Rogue { for (int j = 0; j < 5; j++) { - int dusty = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 265, 0f, 0f, 100, default, 1f); + int dusty = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.LunarOre, 0f, 0f, 100, default, 1f); Main.dust[dusty].noGravity = true; Main.dust[dusty].velocity *= 1.2f; Main.dust[dusty].velocity -= Projectile.oldVelocity * 0.3f; diff --git a/Projectiles/Rogue/LuxorsGiftRogue.cs b/Projectiles/Rogue/LuxorsGiftRogue.cs index af4becd623..c970824e1c 100644 --- a/Projectiles/Rogue/LuxorsGiftRogue.cs +++ b/Projectiles/Rogue/LuxorsGiftRogue.cs @@ -1,5 +1,5 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -32,7 +32,7 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; if (Projectile.localAI[0] == 0f) { Projectile.scale -= 0.01f; @@ -61,7 +61,7 @@ namespace CalamityMod.Projectiles.Rogue Vector2 rotation = Vector2.UnitX * (float)-(float)Projectile.width / 2f; rotation += -Vector2.UnitY.RotatedBy((double)((float)l * 3.14159274f / 6f), default) * new Vector2(8f, 16f); rotation = rotation.RotatedBy((double)(Projectile.rotation - 1.57079637f), default); - int dusty = Dust.NewDust(Projectile.Center, 0, 0, 173, 0f, 0f, 160, default, 1f); + int dusty = Dust.NewDust(Projectile.Center, 0, 0, DustID.ShadowbeamStaff, 0f, 0f, 160, default, 1f); Main.dust[dusty].scale = 1.1f; Main.dust[dusty].noGravity = true; Main.dust[dusty].position = Projectile.Center + rotation; diff --git a/Projectiles/Rogue/LuxorsGiftRogue.png b/Projectiles/Rogue/LuxorsGiftRogue.png index ebc2f0e189..2ffc26c9c7 100644 Binary files a/Projectiles/Rogue/LuxorsGiftRogue.png and b/Projectiles/Rogue/LuxorsGiftRogue.png differ diff --git a/Projectiles/Rogue/MalachiteBolt.cs b/Projectiles/Rogue/MalachiteBolt.cs index 4b2421657b..bfcae585c3 100644 --- a/Projectiles/Rogue/MalachiteBolt.cs +++ b/Projectiles/Rogue/MalachiteBolt.cs @@ -1,5 +1,6 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -34,7 +35,7 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + MathHelper.PiOver2; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; Projectile.alpha -= 3; if (Projectile.alpha < 100) { @@ -45,7 +46,7 @@ namespace CalamityMod.Projectiles.Rogue { for (int i = 0; i < 3; i++) { - int dusty = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 0.75f); + int dusty = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.TerraBlade, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 0.75f); Main.dust[dusty].noGravity = true; Main.dust[dusty].velocity *= 0f; } @@ -62,6 +63,7 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { + target.AddBuff(ModContent.BuffType(), 120); if (Projectile.penetrate <= 1) { Projectile.position = Projectile.Center; @@ -73,7 +75,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.Damage(); for (int j = 0; j < 70; j++) { - int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.2f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.TerraBlade, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.2f); Main.dust[dust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -83,10 +85,10 @@ namespace CalamityMod.Projectiles.Rogue } for (int k = 0; k < 40; k++) { - int dust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.7f); + int dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.TerraBlade, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.7f); Main.dust[dust2].noGravity = true; Main.dust[dust2].velocity *= 5f; - dust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f); + dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.TerraBlade, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f); Main.dust[dust2].velocity *= 2f; } } @@ -105,7 +107,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.Damage(); for (int j = 0; j < 70; j++) { - int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.2f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.TerraBlade, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.2f); Main.dust[dust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -115,10 +117,10 @@ namespace CalamityMod.Projectiles.Rogue } for (int k = 0; k < 40; k++) { - int dust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.7f); + int dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.TerraBlade, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.7f); Main.dust[dust2].noGravity = true; Main.dust[dust2].velocity *= 5f; - dust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f); + dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.TerraBlade, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f); Main.dust[dust2].velocity *= 2f; } } @@ -132,7 +134,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int j = 0; j < 7; j++) { - int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.2f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.TerraBlade, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.2f); Main.dust[dust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -142,10 +144,10 @@ namespace CalamityMod.Projectiles.Rogue } for (int k = 0; k < 3; k++) { - int dust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.7f); + int dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.TerraBlade, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.7f); Main.dust[dust2].noGravity = true; Main.dust[dust2].velocity *= 5f; - dust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f); + dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.TerraBlade, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f); Main.dust[dust2].velocity *= 2f; } } diff --git a/Projectiles/Rogue/MalachiteProj.cs b/Projectiles/Rogue/MalachiteProj.cs index d1d092ed6e..f5653839f9 100644 --- a/Projectiles/Rogue/MalachiteProj.cs +++ b/Projectiles/Rogue/MalachiteProj.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -43,7 +44,7 @@ namespace CalamityMod.Projectiles.Rogue { for (int k = 0; k < 3; k++) { - int dusty = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 0.75f); + int dusty = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.TerraBlade, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 0.75f); Main.dust[dusty].noGravity = true; Main.dust[dusty].velocity *= 0f; } @@ -58,6 +59,8 @@ namespace CalamityMod.Projectiles.Rogue public override Color? GetAlpha(Color lightColor) => new Color(Main.DiscoR, 203, 103, Projectile.alpha); + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 120); + public override void OnKill(int timeLeft) { Projectile.position = Projectile.Center; @@ -66,7 +69,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int i = 0; i < 7; i++) { - int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.2f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.TerraBlade, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.2f); Main.dust[dust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -76,10 +79,10 @@ namespace CalamityMod.Projectiles.Rogue } for (int j = 0; j < 15; j++) { - int dust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.7f); + int dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.TerraBlade, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.7f); Main.dust[dust2].noGravity = true; Main.dust[dust2].velocity *= 5f; - dust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f); + dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.TerraBlade, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f); Main.dust[dust2].velocity *= 2f; } } diff --git a/Projectiles/Rogue/MalachiteStealth.cs b/Projectiles/Rogue/MalachiteStealth.cs index 871fb68e9a..2f6451498f 100644 --- a/Projectiles/Rogue/MalachiteStealth.cs +++ b/Projectiles/Rogue/MalachiteStealth.cs @@ -1,15 +1,16 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { public class MalachiteStealth : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; - private const int lifeSpan = 300; + private const int lifeSpan = 240; public override string Texture => "CalamityMod/Items/Weapons/Rogue/Malachite"; public override void SetStaticDefaults() @@ -31,6 +32,8 @@ namespace CalamityMod.Projectiles.Rogue Projectile.tileCollide = false; Projectile.timeLeft = lifeSpan; Projectile.extraUpdates = 2; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 60; } public override void AI() @@ -44,7 +47,7 @@ namespace CalamityMod.Projectiles.Rogue { for (int k = 0; k < 3; k++) { - int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 0.75f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.TerraBlade, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 0.75f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 0f; } @@ -86,7 +89,7 @@ namespace CalamityMod.Projectiles.Rogue SoundEngine.PlaySound(SoundID.Item14, Projectile.position); for (int i = 0; i < 7; i++) { - int dusty = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.2f); + int dusty = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.TerraBlade, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.2f); Main.dust[dusty].velocity *= 3f; if (Main.rand.NextBool()) { @@ -96,28 +99,31 @@ namespace CalamityMod.Projectiles.Rogue } for (int j = 0; j < 15; j++) { - int green = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.7f); + int green = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.TerraBlade, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.7f); Main.dust[green].noGravity = true; Main.dust[green].velocity *= 5f; - green = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f); + green = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.TerraBlade, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f); Main.dust[green].velocity *= 2f; } - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; Projectile.Damage(); } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.immune[Projectile.owner] = 0; + target.AddBuff(ModContent.BuffType(), 240); Projectile.extraUpdates = 0; - Projectile.ai[0] = 1f; - Projectile.ai[1] = target.whoAmI; - Projectile.velocity = target.Center - Projectile.Center; - Projectile.velocity *= 0.75f; - Projectile.netUpdate = true; + if (Projectile.ai[0] == 0f) + { + Projectile.ai[0] = 1f; + Projectile.ai[1] = target.whoAmI; + Projectile.velocity = target.Center - Projectile.Center; + Projectile.velocity *= 0.75f; + Projectile.netUpdate = true; + } + if (Projectile.localAI[0] < 3f) + Projectile.localAI[0] += 1f; - const int maxKunai = 3; + const int maxKunai = 6; int kunaiFound = 0; int oldestKunai = -1; int oldestKunaiTimeLeft = lifeSpan; @@ -141,6 +147,6 @@ namespace CalamityMod.Projectiles.Rogue } } - public override bool? CanDamage() => Projectile.ai[0] != 1f ? null : false; + public override bool? CanDamage() => (Projectile.localAI[0] < 3f || Projectile.ai[0] == 2f) ? null : false; } } diff --git a/Projectiles/Rogue/MangroveChakramFlower.cs b/Projectiles/Rogue/MangroveChakramFlower.cs index 83e23b0b53..7f65d13acc 100644 --- a/Projectiles/Rogue/MangroveChakramFlower.cs +++ b/Projectiles/Rogue/MangroveChakramFlower.cs @@ -1,8 +1,8 @@ -using System; +using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { public class MangroveChakramFlower : ModProjectile, ILocalizedModType diff --git a/Projectiles/Rogue/MangroveChakramProjectile.cs b/Projectiles/Rogue/MangroveChakramProjectile.cs index 9d155ed035..6bd879b46b 100644 --- a/Projectiles/Rogue/MangroveChakramProjectile.cs +++ b/Projectiles/Rogue/MangroveChakramProjectile.cs @@ -22,6 +22,8 @@ namespace CalamityMod.Projectiles.Rogue Projectile.timeLeft = 600; AIType = ProjectileID.WoodenBoomerang; Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 6; } public override void AI() @@ -29,7 +31,7 @@ namespace CalamityMod.Projectiles.Rogue Lighting.AddLight(Projectile.Center, 0f, 0.25f, 0f); if (Main.rand.NextBool(5)) - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 44, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.JungleSpore, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); if (Projectile.Calamity().stealthStrike) { @@ -37,7 +39,7 @@ namespace CalamityMod.Projectiles.Rogue if (Projectile.timeLeft < 240) Projectile.Kill(); - Projectile.localAI[0] += Main.rand.Next(0,3); + Projectile.localAI[0] += Main.rand.Next(0, 3); if (Projectile.localAI[0] >= 10f) { Projectile.localAI[0] = 0f; @@ -50,16 +52,12 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.immune[Projectile.owner] = 6; - target.AddBuff(BuffID.Venom, 120); - } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.Venom, 120); public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(BuffID.Venom, 120); } diff --git a/Projectiles/Rogue/MetalChunk.cs b/Projectiles/Rogue/MetalChunk.cs index 82b954581d..b779646437 100644 --- a/Projectiles/Rogue/MetalChunk.cs +++ b/Projectiles/Rogue/MetalChunk.cs @@ -1,8 +1,8 @@ -using Terraria; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Microsoft.Xna.Framework; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { diff --git a/Projectiles/Rogue/MetalShard.cs b/Projectiles/Rogue/MetalShard.cs index b617d7aa0b..83ae2a801f 100644 --- a/Projectiles/Rogue/MetalShard.cs +++ b/Projectiles/Rogue/MetalShard.cs @@ -1,10 +1,10 @@  -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using Terraria; using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { @@ -55,12 +55,15 @@ namespace CalamityMod.Projectiles.Rogue switch (Projectile.localAI[1]) { - case 2f: texture = ModContent.Request("CalamityMod/Projectiles/Rogue/MetalShard2").Value; - break; - case 3f: texture = ModContent.Request("CalamityMod/Projectiles/Rogue/MetalShard3").Value; - break; - default: texture = ModContent.Request("CalamityMod/Projectiles/Rogue/MetalShard").Value; - break; + case 2f: + texture = ModContent.Request("CalamityMod/Projectiles/Rogue/MetalShard2").Value; + break; + case 3f: + texture = ModContent.Request("CalamityMod/Projectiles/Rogue/MetalShard3").Value; + break; + default: + texture = ModContent.Request("CalamityMod/Projectiles/Rogue/MetalShard").Value; + break; } Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition, new Rectangle?(new Rectangle(0, 0, texture.Width, texture.Height)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, texture.Height / 2f), Projectile.scale, SpriteEffects.None, 0); return false; diff --git a/Projectiles/Rogue/MeteorFistProj.cs b/Projectiles/Rogue/MeteorFistProj.cs index a6afa5c9e5..009cbfeda3 100644 --- a/Projectiles/Rogue/MeteorFistProj.cs +++ b/Projectiles/Rogue/MeteorFistProj.cs @@ -1,10 +1,10 @@ -using CalamityMod.Projectiles.Typeless; +using System; +using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -35,7 +35,7 @@ namespace CalamityMod.Projectiles.Rogue dustyX = Projectile.velocity.X * 0.5f; dustyY = Projectile.velocity.Y * 0.5f; } - int meteorDust = Dust.NewDust(new Vector2(Projectile.position.X + 3f + dustyX, Projectile.position.Y + 3f + dustyY) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 6, 0f, 0f, 100, default, 0.5f); + int meteorDust = Dust.NewDust(new Vector2(Projectile.position.X + 3f + dustyX, Projectile.position.Y + 3f + dustyY) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, DustID.Torch, 0f, 0f, 100, default, 0.5f); Main.dust[meteorDust].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; Main.dust[meteorDust].velocity *= 0.2f; Main.dust[meteorDust].noGravity = true; @@ -49,13 +49,13 @@ namespace CalamityMod.Projectiles.Rogue } else if (Main.rand.NextBool()) { - int fieryDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 0.5f); + int fieryDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 0.5f); Main.dust[fieryDust].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f; Main.dust[fieryDust].fadeIn = 1.5f + (float)Main.rand.Next(5) * 0.1f; Main.dust[fieryDust].noGravity = true; Main.dust[fieryDust].position = Projectile.Center + new Vector2(0f, (float)(-(float)Projectile.height / 2)).RotatedBy((double)Projectile.rotation, default) * 1.1f; Main.rand.Next(2); - fieryDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 0.5f); + fieryDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 0.5f); Main.dust[fieryDust].scale = 1f + (float)Main.rand.Next(5) * 0.1f; Main.dust[fieryDust].noGravity = true; Main.dust[fieryDust].position = Projectile.Center + new Vector2(0f, (float)(-(float)Projectile.height / 2 - 6)).RotatedBy((double)Projectile.rotation, default) * 1.1f; @@ -84,7 +84,7 @@ namespace CalamityMod.Projectiles.Rogue SoundEngine.PlaySound(SoundID.Item14, Projectile.position); for (int j = 0; j < 40; j++) { - int boomDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 1f); + int boomDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 1f); Main.dust[boomDust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -94,10 +94,10 @@ namespace CalamityMod.Projectiles.Rogue } for (int k = 0; k < 70; k++) { - int boomDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 2f); + int boomDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 2f); Main.dust[boomDust2].noGravity = true; Main.dust[boomDust2].velocity *= 5f; - boomDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 1f); + boomDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 1f); Main.dust[boomDust2].velocity *= 2f; } diff --git a/Projectiles/Rogue/MeteorFistStealth.cs b/Projectiles/Rogue/MeteorFistStealth.cs index 8abb17f4d8..d7e386cc7f 100644 --- a/Projectiles/Rogue/MeteorFistStealth.cs +++ b/Projectiles/Rogue/MeteorFistStealth.cs @@ -1,11 +1,11 @@ -using CalamityMod.Projectiles.Typeless; -using Microsoft.Xna.Framework; -using System; +using System; using System.Collections.Generic; +using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -37,7 +37,7 @@ namespace CalamityMod.Projectiles.Rogue dustyX = Projectile.velocity.X * 0.5f; dustyY = Projectile.velocity.Y * 0.5f; } - int meteorDust = Dust.NewDust(new Vector2(Projectile.position.X + 3f + dustyX, Projectile.position.Y + 3f + dustyY) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 6, 0f, 0f, 100, default, 0.5f); + int meteorDust = Dust.NewDust(new Vector2(Projectile.position.X + 3f + dustyX, Projectile.position.Y + 3f + dustyY) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, DustID.Torch, 0f, 0f, 100, default, 0.5f); Main.dust[meteorDust].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; Main.dust[meteorDust].velocity *= 0.2f; Main.dust[meteorDust].noGravity = true; @@ -51,13 +51,13 @@ namespace CalamityMod.Projectiles.Rogue } else if (Main.rand.NextBool()) { - int fieryDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 0.5f); + int fieryDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 0.5f); Main.dust[fieryDust].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f; Main.dust[fieryDust].fadeIn = 1.5f + (float)Main.rand.Next(5) * 0.1f; Main.dust[fieryDust].noGravity = true; Main.dust[fieryDust].position = Projectile.Center + new Vector2(0f, (float)(-(float)Projectile.height / 2)).RotatedBy((double)Projectile.rotation, default) * 1.1f; Main.rand.Next(2); - fieryDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 0.5f); + fieryDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 0.5f); Main.dust[fieryDust].scale = 1f + (float)Main.rand.Next(5) * 0.1f; Main.dust[fieryDust].noGravity = true; Main.dust[fieryDust].position = Projectile.Center + new Vector2(0f, (float)(-(float)Projectile.height / 2 - 6)).RotatedBy((double)Projectile.rotation, default) * 1.1f; @@ -85,7 +85,7 @@ namespace CalamityMod.Projectiles.Rogue SoundEngine.PlaySound(SoundID.Item14, Projectile.position); for (int j = 0; j < 40; j++) { - int boomDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 1f); + int boomDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 1f); Main.dust[boomDust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -95,10 +95,10 @@ namespace CalamityMod.Projectiles.Rogue } for (int k = 0; k < 70; k++) { - int boomDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 2f); + int boomDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 2f); Main.dust[boomDust2].noGravity = true; Main.dust[boomDust2].velocity *= 5f; - boomDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 1f); + boomDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 1f); Main.dust[boomDust2].velocity *= 2f; } @@ -151,7 +151,7 @@ namespace CalamityMod.Projectiles.Rogue { target.AddBuff(BuffID.OnFire, 120); int boom = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); - Projectile.damage /= 2; + Projectile.damage = (int)(Projectile.damage * 0.6666); float minDist = 999f; int index = 0; // Get the closest enemy to the fist diff --git a/Projectiles/Rogue/MoltenAmputatorProj.cs b/Projectiles/Rogue/MoltenAmputatorProj.cs index e79d99b6c4..4abfdf3453 100644 --- a/Projectiles/Rogue/MoltenAmputatorProj.cs +++ b/Projectiles/Rogue/MoltenAmputatorProj.cs @@ -1,10 +1,10 @@ -using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Weapons.Rogue; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using CalamityMod.Buffs.DamageOverTime; namespace CalamityMod.Projectiles.Rogue { @@ -175,7 +175,7 @@ namespace CalamityMod.Projectiles.Rogue SoundEngine.PlaySound(SoundID.Item20, Projectile.position); for (int k = 0; k < 10; k++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 244, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.CopperCoin, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } @@ -190,7 +190,7 @@ namespace CalamityMod.Projectiles.Rogue SoundEngine.PlaySound(SoundID.Item20, Projectile.position); for (int k = 0; k < 10; k++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 244, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.CopperCoin, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } } diff --git a/Projectiles/Rogue/MoltenBlobThrown.cs b/Projectiles/Rogue/MoltenBlobThrown.cs index 4759c6708d..ae0d6d85fb 100644 --- a/Projectiles/Rogue/MoltenBlobThrown.cs +++ b/Projectiles/Rogue/MoltenBlobThrown.cs @@ -1,9 +1,9 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using CalamityMod.Buffs.DamageOverTime; namespace CalamityMod.Projectiles.Rogue { @@ -82,7 +82,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int i = 0; i < 3; i++) { - int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 100, default, 2f); if (Main.rand.NextBool()) { Main.dust[dust].scale = 0.5f; @@ -91,9 +91,9 @@ namespace CalamityMod.Projectiles.Rogue } for (int j = 0; j < 5; j++) { - int dust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 3f); + int dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 100, default, 3f); Main.dust[dust2].noGravity = true; - dust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); + dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 100, default, 2f); } } } diff --git a/Projectiles/Rogue/MonkeyDart.cs b/Projectiles/Rogue/MonkeyDart.cs index 56e8f2713f..7d120c08aa 100644 --- a/Projectiles/Rogue/MonkeyDart.cs +++ b/Projectiles/Rogue/MonkeyDart.cs @@ -1,9 +1,9 @@ using CalamityMod.Items.Weapons.Rogue; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -43,9 +43,9 @@ namespace CalamityMod.Projectiles.Rogue Projectile.velocity.Y = 16f; } //Dust trail - if (Main.rand.Next(25) == 0) + if (Main.rand.NextBool(25)) { - int d = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 21, Projectile.velocity.X * 0.25f, Projectile.velocity.Y * 0.25f, 150, default, 0.9f); + int d = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.VilePowder, Projectile.velocity.X * 0.25f, Projectile.velocity.Y * 0.25f, 150, default, 0.9f); Main.dust[d].position = Projectile.Center; Main.dust[d].noLight = true; } @@ -58,7 +58,7 @@ namespace CalamityMod.Projectiles.Rogue int dustsplash = 0; while (dustsplash < 4) { - int d = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 1, Projectile.velocity.X * 0.25f, Projectile.velocity.Y * 0.25f, 100, default, 0.9f); + int d = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Stone, Projectile.velocity.X * 0.25f, Projectile.velocity.Y * 0.25f, 100, default, 0.9f); Main.dust[d].position = Projectile.Center; dustsplash += 1; } diff --git a/Projectiles/Rogue/MoonSigil.cs b/Projectiles/Rogue/MoonSigil.cs index 8503ff7d43..ac6d594ff2 100644 --- a/Projectiles/Rogue/MoonSigil.cs +++ b/Projectiles/Rogue/MoonSigil.cs @@ -1,7 +1,9 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Rogue { public class MoonSigil : ModProjectile, ILocalizedModType @@ -55,7 +57,7 @@ namespace CalamityMod.Projectiles.Rogue for (int j = 0; j < 5; j++) { Vector2 dustspeed = new Vector2(dustSp, dustSp).RotatedBy(MathHelper.ToRadians(dustD)); - int d = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, 31, dustspeed.X, dustspeed.Y, 200, new Color(213, 242, 232, 200), 1f); + int d = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, DustID.Smoke, dustspeed.X, dustspeed.Y, 200, new Color(213, 242, 232, 200), 1f); Main.dust[d].noGravity = true; Main.dust[d].position = Projectile.Center; Main.dust[d].velocity = dustspeed; diff --git a/Projectiles/Rogue/MycorootProj.cs b/Projectiles/Rogue/MycorootProj.cs index 671c070b63..3fe48a9a8c 100644 --- a/Projectiles/Rogue/MycorootProj.cs +++ b/Projectiles/Rogue/MycorootProj.cs @@ -1,6 +1,6 @@ +using System; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -25,9 +25,9 @@ namespace CalamityMod.Projectiles.Rogue { if (Main.rand.NextBool(4)) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 56, 0f, 0f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.BlueFairy, 0f, 0f); } - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 0.785f; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4; Projectile.alpha += 20; if (Projectile.alpha >= 255) { @@ -39,18 +39,18 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { if (Projectile.Calamity().stealthStrike) - SoundEngine.PlaySound(SoundID.NPCHit45, Projectile.position); + SoundEngine.PlaySound(SoundID.NPCHit45, Projectile.position); } public override void OnHitPlayer(Player target, Player.HurtInfo info) { if (Projectile.Calamity().stealthStrike) - SoundEngine.PlaySound(SoundID.NPCHit45, Projectile.position); + SoundEngine.PlaySound(SoundID.NPCHit45, Projectile.position); } public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } diff --git a/Projectiles/Rogue/MythrilKnifeProjectile.cs b/Projectiles/Rogue/MythrilKnifeProjectile.cs index ebddcaa69c..57eaf29f2b 100644 --- a/Projectiles/Rogue/MythrilKnifeProjectile.cs +++ b/Projectiles/Rogue/MythrilKnifeProjectile.cs @@ -30,14 +30,14 @@ namespace CalamityMod.Projectiles.Rogue { if (Main.rand.NextBool(7)) { - int index = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 171, 0.0f, 0.0f, 100, new Color(), 1f); + int index = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Venom, 0.0f, 0.0f, 100, new Color(), 1f); Main.dust[index].noGravity = true; Main.dust[index].fadeIn = 1.5f; Main.dust[index].velocity *= 0.25f; } if (Main.rand.NextBool(5)) { - int index = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 46, 0.0f, 0.0f, 100, new Color(), 1f); + int index = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Poisoned, 0.0f, 0.0f, 100, new Color(), 1f); Main.dust[index].noGravity = true; Main.dust[index].fadeIn = 1.5f; Main.dust[index].velocity *= 0.25f; @@ -68,7 +68,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } diff --git a/Projectiles/Rogue/NanoblackMain.cs b/Projectiles/Rogue/NanoblackMain.cs index 189f6258f7..829a6f0a22 100644 --- a/Projectiles/Rogue/NanoblackMain.cs +++ b/Projectiles/Rogue/NanoblackMain.cs @@ -1,6 +1,6 @@ -using CalamityMod.Items.Weapons.Rogue; +using System; +using CalamityMod.Items.Weapons.Rogue; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Projectiles/Rogue/NanoblackSplit.cs b/Projectiles/Rogue/NanoblackSplit.cs index 02acd5659f..03d77819c7 100644 --- a/Projectiles/Rogue/NanoblackSplit.cs +++ b/Projectiles/Rogue/NanoblackSplit.cs @@ -1,6 +1,6 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Projectiles/Rogue/NanoblackStealthSplit.cs b/Projectiles/Rogue/NanoblackStealthSplit.cs index f47d6f7550..a9dc579fb6 100644 --- a/Projectiles/Rogue/NanoblackStealthSplit.cs +++ b/Projectiles/Rogue/NanoblackStealthSplit.cs @@ -1,5 +1,5 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Projectiles/Rogue/NastyChollaBol.cs b/Projectiles/Rogue/NastyChollaBol.cs index 5ee49f3fe2..0ce92f488b 100644 --- a/Projectiles/Rogue/NastyChollaBol.cs +++ b/Projectiles/Rogue/NastyChollaBol.cs @@ -1,7 +1,8 @@ -using CalamityMod.Items.Weapons.Rogue; +using System; +using CalamityMod.Items.Weapons.Rogue; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue @@ -28,7 +29,7 @@ namespace CalamityMod.Projectiles.Rogue { if (Main.rand.NextBool(12)) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 157, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.ChlorophyteWeapon, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } //Sticky Behaviour Projectile.StickyProjAI(15); diff --git a/Projectiles/Rogue/NastyChollaNeedle.cs b/Projectiles/Rogue/NastyChollaNeedle.cs index c8e38f5f63..41340217ce 100644 --- a/Projectiles/Rogue/NastyChollaNeedle.cs +++ b/Projectiles/Rogue/NastyChollaNeedle.cs @@ -1,7 +1,7 @@ +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using Microsoft.Xna.Framework; namespace CalamityMod.Projectiles.Rogue { diff --git a/Projectiles/Rogue/NiceCock.cs b/Projectiles/Rogue/NiceCock.cs index 4de3eb4d09..11bc1ff1ca 100644 --- a/Projectiles/Rogue/NiceCock.cs +++ b/Projectiles/Rogue/NiceCock.cs @@ -1,10 +1,10 @@ -using CalamityMod.CalPlayer; +using System.IO; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; -using System.IO; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { // The file name is a specific request from the patron @@ -98,7 +98,7 @@ namespace CalamityMod.Projectiles.Rogue // Decrement the timer. This should last a second as stealth strikes will initialize this at 61. if (Timer > 1) - Timer --; + Timer--; if (Timer == 1) homing = true; @@ -131,7 +131,7 @@ namespace CalamityMod.Projectiles.Rogue // Create into some rainbow-colored dust when dead for (int d = 0; d < 5; d++) { - int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 267, 0f, 0f, 150, Main.rand.Next(colors), 2f); + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RainbowMk2, 0f, 0f, 150, Main.rand.Next(colors), 2f); Main.dust[idx].velocity *= 3f; Main.dust[idx].noGravity = true; if (Main.rand.NextBool()) @@ -142,10 +142,10 @@ namespace CalamityMod.Projectiles.Rogue } for (int d = 0; d < 8; d++) { - int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 267, 0f, 0f, 150, Main.rand.Next(colors), 3f); + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RainbowMk2, 0f, 0f, 150, Main.rand.Next(colors), 3f); Main.dust[idx].noGravity = true; Main.dust[idx].velocity *= 5f; - idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 267, 0f, 0f, 150, Main.rand.Next(colors), 2f); + idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RainbowMk2, 0f, 0f, 150, Main.rand.Next(colors), 2f); Main.dust[idx].velocity *= 2f; Main.dust[idx].noGravity = true; } diff --git a/Projectiles/Rogue/NightsGazeProjectile.cs b/Projectiles/Rogue/NightsGazeProjectile.cs index 362272d037..ea2a217ec1 100644 --- a/Projectiles/Rogue/NightsGazeProjectile.cs +++ b/Projectiles/Rogue/NightsGazeProjectile.cs @@ -1,11 +1,11 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -83,9 +83,9 @@ namespace CalamityMod.Projectiles.Rogue Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity * speed, projID, projectileDamage, kb, Projectile.owner, 0f, moveDuration); } - SoundEngine.PlaySound(SoundID.Item62 with { Volume = SoundID.Item62.Volume * 0.6f}, Projectile.position); - SoundEngine.PlaySound(SoundID.Item68 with { Volume = SoundID.Item68.Volume * 0.2f}, Projectile.position); - SoundEngine.PlaySound(SoundID.Item122 with { Volume = SoundID.Item122.Volume * 0.4f}, Projectile.position); + SoundEngine.PlaySound(SoundID.Item62 with { Volume = SoundID.Item62.Volume * 0.6f }, Projectile.position); + SoundEngine.PlaySound(SoundID.Item68 with { Volume = SoundID.Item68.Volume * 0.2f }, Projectile.position); + SoundEngine.PlaySound(SoundID.Item122 with { Volume = SoundID.Item122.Volume * 0.4f }, Projectile.position); } public override bool OnTileCollide(Vector2 oldVelocity) diff --git a/Projectiles/Rogue/NightsGazeSpark.cs b/Projectiles/Rogue/NightsGazeSpark.cs index 370a366e0a..6d51909b88 100644 --- a/Projectiles/Rogue/NightsGazeSpark.cs +++ b/Projectiles/Rogue/NightsGazeSpark.cs @@ -1,4 +1,4 @@ - + using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; diff --git a/Projectiles/Rogue/NightsGazeStar.cs b/Projectiles/Rogue/NightsGazeStar.cs index b44f27a51d..bcf4b231a2 100644 --- a/Projectiles/Rogue/NightsGazeStar.cs +++ b/Projectiles/Rogue/NightsGazeStar.cs @@ -1,10 +1,10 @@ - + using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { diff --git a/Projectiles/Rogue/NychthemeronOrb.cs b/Projectiles/Rogue/NychthemeronOrb.cs index 367c0c5c4e..9a16edbac9 100644 --- a/Projectiles/Rogue/NychthemeronOrb.cs +++ b/Projectiles/Rogue/NychthemeronOrb.cs @@ -100,7 +100,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D texLight = ModContent.Request(Texture).Value; + Texture2D texLight = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Texture2D texDark = ModContent.Request("CalamityMod/Projectiles/Rogue/NychthemeronOrb2").Value; if (Projectile.ai[0] == 0f) { diff --git a/Projectiles/Rogue/NychthemeronProjectile.cs b/Projectiles/Rogue/NychthemeronProjectile.cs index 3febb96b55..8810f57ab2 100644 --- a/Projectiles/Rogue/NychthemeronProjectile.cs +++ b/Projectiles/Rogue/NychthemeronProjectile.cs @@ -1,9 +1,9 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; -using Terraria.ModLoader; -using Terraria.ID; using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { @@ -62,7 +62,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } @@ -77,8 +77,8 @@ namespace CalamityMod.Projectiles.Rogue int numDust = 2; for (int i = 0; i < numDust; i++) { - Dust.NewDust(Projectile.position, 4, 4, 236, Projectile.velocity.X, Projectile.velocity.Y, 0, default, Main.rand.NextFloat(minScale, maxScale)); - Dust.NewDust(Projectile.position, 4, 4, 240, Projectile.velocity.X, Projectile.velocity.Y, 0, default, Main.rand.NextFloat(minScale, maxScale)); + Dust.NewDust(Projectile.position, 4, 4, DustID.Marble, Projectile.velocity.X, Projectile.velocity.Y, 0, default, Main.rand.NextFloat(minScale, maxScale)); + Dust.NewDust(Projectile.position, 4, 4, DustID.Granite, Projectile.velocity.X, Projectile.velocity.Y, 0, default, Main.rand.NextFloat(minScale, maxScale)); } Projectile.Kill(); @@ -94,8 +94,8 @@ namespace CalamityMod.Projectiles.Rogue int numDust = 2; for (int i = 0; i < numDust; i++) { - Dust.NewDust(Projectile.position, 4, 4, 236, Projectile.velocity.X, Projectile.velocity.Y, 0, default, Main.rand.NextFloat(minScale, maxScale)); - Dust.NewDust(Projectile.position, 4, 4, 240, Projectile.velocity.X, Projectile.velocity.Y, 0, default, Main.rand.NextFloat(minScale, maxScale)); + Dust.NewDust(Projectile.position, 4, 4, DustID.Marble, Projectile.velocity.X, Projectile.velocity.Y, 0, default, Main.rand.NextFloat(minScale, maxScale)); + Dust.NewDust(Projectile.position, 4, 4, DustID.Granite, Projectile.velocity.X, Projectile.velocity.Y, 0, default, Main.rand.NextFloat(minScale, maxScale)); } } } diff --git a/Projectiles/Rogue/OrichalcumSpikedGemstoneProjectile.cs b/Projectiles/Rogue/OrichalcumSpikedGemstoneProjectile.cs index ac502552ba..1bdd516980 100644 --- a/Projectiles/Rogue/OrichalcumSpikedGemstoneProjectile.cs +++ b/Projectiles/Rogue/OrichalcumSpikedGemstoneProjectile.cs @@ -1,9 +1,9 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { public class OrichalcumSpikedGemstoneProjectile : ModProjectile, ILocalizedModType @@ -46,7 +46,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } diff --git a/Projectiles/Rogue/PalladiumJavelinProjectile.cs b/Projectiles/Rogue/PalladiumJavelinProjectile.cs index f4d971c7d8..2b5a7562de 100644 --- a/Projectiles/Rogue/PalladiumJavelinProjectile.cs +++ b/Projectiles/Rogue/PalladiumJavelinProjectile.cs @@ -1,7 +1,7 @@ -using CalamityMod.Items.Weapons.Rogue; +using System; +using CalamityMod.Items.Weapons.Rogue; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -17,39 +17,40 @@ namespace CalamityMod.Projectiles.Rogue Projectile.width = 12; Projectile.height = 12; Projectile.friendly = true; - Projectile.penetrate = -1; + Projectile.penetrate = 3; Projectile.aiStyle = ProjAIStyleID.StickProjectile; Projectile.timeLeft = 600; + Projectile.MaxUpdates = 2; AIType = ProjectileID.BoneJavelin; Projectile.DamageType = RogueDamageClass.Instance; - Projectile.localNPCHitCooldown = 10; + Projectile.localNPCHitCooldown = 15 * Projectile.MaxUpdates; Projectile.usesLocalNPCImmunity = true; } public override void AI() { - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 0.785f; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4; //Stealth strike behavior if (!Projectile.Calamity().stealthStrike || Projectile.owner != Main.myPlayer || Projectile.Calamity().lineColor >= 2) return; Projectile.localAI[0]++; - if (Projectile.localAI[0] >= 15f) + if (Projectile.localAI[0] >= 12f) { Vector2 vector2 = new Vector2(20f, 20f); for (int index1 = 0; index1 < 10; ++index1) { - int index2 = Dust.NewDust(Projectile.Center - vector2 / 2f, (int) vector2.X, (int) vector2.Y, 87, 0f, 0f, 100, new Color(), 1.5f); + int index2 = Dust.NewDust(Projectile.Center - vector2 / 2f, (int)vector2.X, (int)vector2.Y, DustID.GemTopaz, 0f, 0f, 100, new Color(), 1.5f); Dust dust = Main.dust[index2]; dust.velocity *= 1.4f; } for (int index1 = 0; index1 < 5; ++index1) { - Dust.NewDust(Projectile.Center - vector2 / 2f, (int) vector2.X, (int) vector2.Y, 144, 0f, 0f, 0, default, 1f); + Dust.NewDust(Projectile.Center - vector2 / 2f, (int)vector2.X, (int)vector2.Y, DustID.Palladium, 0f, 0f, 0, default, 1f); } - int javelin = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity.RotatedBy(MathHelper.ToRadians(5f)), Projectile.type, Projectile.damage, Projectile.knockBack, Projectile.owner); - int javelin2 = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity.RotatedBy(MathHelper.ToRadians(-5f)), Projectile.type, Projectile.damage, Projectile.knockBack, Projectile.owner); + int javelin = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity.RotatedBy(MathHelper.ToRadians(3f)), Projectile.type, Projectile.damage, Projectile.knockBack, Projectile.owner); + int javelin2 = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity.RotatedBy(MathHelper.ToRadians(-3f)), Projectile.type, Projectile.damage, Projectile.knockBack, Projectile.owner); if (javelin.WithinBounds(Main.maxProjectiles)) { Main.projectile[javelin].Calamity().lineColor = Projectile.Calamity().lineColor + 1; @@ -66,7 +67,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } diff --git a/Projectiles/Rogue/PanSpark.cs b/Projectiles/Rogue/PanSpark.cs index 6d92c83d5d..9fcf5404d8 100644 --- a/Projectiles/Rogue/PanSpark.cs +++ b/Projectiles/Rogue/PanSpark.cs @@ -100,7 +100,7 @@ namespace CalamityMod.Projectiles.Rogue //dust if (Main.rand.NextBool(4)) { - int fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 1f); + int fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 1f); Dust dust = Main.dust[fire]; dust.position.X -= 2f; dust.position.Y += 2f; @@ -110,7 +110,7 @@ namespace CalamityMod.Projectiles.Rogue } if (Main.rand.NextBool(10)) { - int fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 1f); + int fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 1f); Dust dust = Main.dust[fire]; dust.position.X -= 2f; dust.position.Y += 2f; diff --git a/Projectiles/Rogue/PartisanExplosion.cs b/Projectiles/Rogue/PartisanExplosion.cs index f2ab8d1255..8467d883cc 100644 --- a/Projectiles/Rogue/PartisanExplosion.cs +++ b/Projectiles/Rogue/PartisanExplosion.cs @@ -1,7 +1,8 @@ -using Terraria; -using Terraria.ModLoader; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; -using CalamityMod.Buffs.DamageOverTime; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { @@ -35,7 +36,7 @@ namespace CalamityMod.Projectiles.Rogue { float speedx = Main.rand.NextFloat(-0.9f, 0.9f); float speedy = Main.rand.NextFloat(-0.9f, 0.9f); - int d = Dust.NewDust(Projectile.position, 33, 33, 244, speedx, speedy, 120, default(Color), 2.6f); + int d = Dust.NewDust(Projectile.position, 33, 33, DustID.CopperCoin, speedx, speedy, 120, default(Color), 2.6f); Main.dust[d].position = Projectile.Center; } } diff --git a/Projectiles/Rogue/PenumbraBomb.cs b/Projectiles/Rogue/PenumbraBomb.cs index 98bd195729..adff0d85fb 100644 --- a/Projectiles/Rogue/PenumbraBomb.cs +++ b/Projectiles/Rogue/PenumbraBomb.cs @@ -1,10 +1,10 @@ -using Terraria; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Microsoft.Xna.Framework; -using Terraria.Audio; -using CalamityMod.Buffs.StatDebuffs; -using CalamityMod.Buffs.DamageOverTime; namespace CalamityMod.Projectiles.Rogue { @@ -54,19 +54,19 @@ namespace CalamityMod.Projectiles.Rogue Projectile.alpha = 10; //Rotation Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); - Projectile.rotation = (Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi)) + (MathHelper.ToRadians(180)*Projectile.direction); + Projectile.rotation = (Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi)) + (MathHelper.ToRadians(180) * Projectile.direction); //Dust - float dfreq = Projectile.Calamity().stealthStrike ? 4f : 2f; + float dfreq = Projectile.Calamity().stealthStrike ? 8f : 4f; if (Projectile.ai[0] == dfreq) { - Vector2 dustspeed = Projectile.velocity * Main.rand.NextFloat(0.5f,0.8f); - int d = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Shadowflame, dustspeed.X, dustspeed.Y, 0, new Color(38, 30, 43), 1.4f); + Vector2 dustspeed = Projectile.velocity * Main.rand.NextFloat(0.5f, 0.8f); + int d = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Wraith, dustspeed.X, dustspeed.Y, 0, new Color(38, 30, 43), 1.4f); Main.dust[d].velocity = dustspeed; if (Projectile.Calamity().stealthStrike) { - Vector2 dustspeed2 = new Vector2 (Main.rand.NextFloat(-3f,3f),Main.rand.NextFloat(-3f,3f)); - int d2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Shadowflame, dustspeed2.X, dustspeed2.Y, 0, new Color(38, 30, 43), 1.3f); + Vector2 dustspeed2 = new Vector2(Main.rand.NextFloat(-3f, 3f), Main.rand.NextFloat(-3f, 3f)); + int d2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Wraith, dustspeed2.X, dustspeed2.Y, 0, new Color(38, 30, 43), 1.3f); Main.dust[d2].velocity = dustspeed2; } Projectile.ai[0] = 0f; @@ -84,7 +84,7 @@ namespace CalamityMod.Projectiles.Rogue //Dark soul projectiles int ad = Projectile.Calamity().stealthStrike ? 40 : 60; float dmgMult = Projectile.Calamity().stealthStrike ? 0.08f : 0.15f; - int randrot = Main.rand.Next(-30,31); + int randrot = Main.rand.Next(-30, 31); for (int i = 0; i < 360; i += ad) { Vector2 SoulSpeed = new Vector2(13f, 13f).RotatedBy(MathHelper.ToRadians(i + randrot)); @@ -95,7 +95,7 @@ namespace CalamityMod.Projectiles.Rogue for (int i = 0; i < maxDust; i++) { Vector2 dustspeed = new Vector2(Main.rand.NextFloat(-6f, 6f), Main.rand.NextFloat(-6f, 6f)); - int d = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Shadowflame, dustspeed.X, dustspeed.Y, 0, new Color(38, 30, 43), 1.6f); + int d = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Wraith, dustspeed.X, dustspeed.Y, 0, new Color(38, 30, 43), 1.6f); } SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); Projectile.width = 110; diff --git a/Projectiles/Rogue/PenumbraSoul.cs b/Projectiles/Rogue/PenumbraSoul.cs index 587493a868..c070de5b1c 100644 --- a/Projectiles/Rogue/PenumbraSoul.cs +++ b/Projectiles/Rogue/PenumbraSoul.cs @@ -42,9 +42,9 @@ namespace CalamityMod.Projectiles.Rogue int trailDust = 1; for (int i = 0; i < trailDust; ++i) { - int dustID = DustID.Shadowflame; + int dustID = 54; //Used by Wraiths and other shadowy stuff - int idx = Dust.NewDust(Projectile.position - Projectile.velocity, Projectile.width, Projectile.height, dustID,0f,0f, 0, new Color(38, 30, 43)); + int idx = Dust.NewDust(Projectile.position - Projectile.velocity, Projectile.width, Projectile.height, dustID, 0f, 0f, 0, new Color(38, 30, 43)); Main.dust[idx].noGravity = true; Main.dust[idx].velocity += Projectile.velocity * 0.8f; } @@ -84,8 +84,8 @@ namespace CalamityMod.Projectiles.Rogue int onHitDust = Main.rand.Next(6, 11); for (int i = 0; i < onHitDust; ++i) { - int dustID = DustID.Shadowflame; - int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustID, 0f, 0f,0, new Color(38, 30, 43)); + int dustID = 54; + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustID, 0f, 0f, 0, new Color(38, 30, 43)); Main.dust[idx].noGravity = true; float speed = Main.rand.NextFloat(1.4f, 2.6f); @@ -101,7 +101,7 @@ namespace CalamityMod.Projectiles.Rogue int killDust = Main.rand.Next(30, 41); for (int i = 0; i < killDust; ++i) { - int dustID = DustID.Shadowflame; + int dustID = 54; int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustID, 0f, 0f, 0, new Color(38, 30, 43)); Main.dust[idx].noGravity = true; diff --git a/Projectiles/Rogue/PhantasmalRuinProj.cs b/Projectiles/Rogue/PhantasmalRuinProj.cs index b6d6c5e2d0..28c391a7cc 100644 --- a/Projectiles/Rogue/PhantasmalRuinProj.cs +++ b/Projectiles/Rogue/PhantasmalRuinProj.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Projectiles.Rogue { public new string LocalizationCategory => "Projectiles.Rogue"; public override string Texture => "CalamityMod/Items/Weapons/Rogue/PhantasmalRuin"; - public static readonly SoundStyle HitSound = new("CalamityMod/Sounds/Item/WulfrumKnifeThrowSingle") { Volume = 0.8f}; + public static readonly SoundStyle HitSound = new("CalamityMod/Sounds/Item/WulfrumKnifeThrowSingle") { Volume = 0.8f }; private const int Lifetime = 600; public override void SetStaticDefaults() @@ -68,15 +68,24 @@ namespace CalamityMod.Projectiles.Rogue return; SoundEngine.PlaySound(HitSound with { PitchVariance = 0.4f }, Projectile.position); - if (Projectile.Calamity().stealthStrike) { - for (int i = 0; i < 5; i += 2) + if (Projectile.penetrate >= 3) { - int soulDamage = (int)(Projectile.damage * 0.3f); - Vector2 velocity = new Vector2(0f, -15f); - velocity = velocity.RotatedByRandom(0.5f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center + new Vector2(0, 600f), velocity, ModContent.ProjectileType(), soulDamage, 0f, Projectile.owner, 0f); + for (int i = 0; i < 3; i++) + { + int soulDamage = (int)(Projectile.damage * 0.3f); + Vector2 velocity = new Vector2(0f, -15f); + velocity = velocity.RotatedByRandom(0.5f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center + new Vector2(0, 600f), velocity, ModContent.ProjectileType(), soulDamage, 0f, Projectile.owner, 0f); + } + for (int j = 0; j < 3; j++) + { + int soulDamage = (int)(Projectile.damage * 0.3f); + Vector2 velocity = new Vector2(0f, -24f); + velocity = velocity.RotatedByRandom(0.25f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center + new Vector2(0, 1300f), velocity, ModContent.ProjectileType(), soulDamage, 0f, Projectile.owner, 0f); + } } } else diff --git a/Projectiles/Rogue/PhantasmalSoul.cs b/Projectiles/Rogue/PhantasmalSoul.cs index a0958ed266..263c73a0dd 100644 --- a/Projectiles/Rogue/PhantasmalSoul.cs +++ b/Projectiles/Rogue/PhantasmalSoul.cs @@ -1,9 +1,9 @@ using CalamityMod.Items.Weapons.Melee; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -131,7 +131,7 @@ namespace CalamityMod.Projectiles.Rogue } // Special quieter version of this noise used by Soul Edge and similar - SoundEngine.PlaySound(SoulEdge.ProjectileDeathSound, Projectile.Center); + SoundEngine.PlaySound(VoidEdge.ProjectileDeathSound, Projectile.Center); } // Cannot deal damage for the first several frames of existence. diff --git a/Projectiles/Rogue/PhantasmalSoulBlue.cs b/Projectiles/Rogue/PhantasmalSoulBlue.cs index 627053816d..f3c196a970 100644 --- a/Projectiles/Rogue/PhantasmalSoulBlue.cs +++ b/Projectiles/Rogue/PhantasmalSoulBlue.cs @@ -1,9 +1,9 @@ using CalamityMod.Items.Weapons.Melee; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { diff --git a/Projectiles/Rogue/PlaguedFuelPackCloud.cs b/Projectiles/Rogue/PlaguedFuelPackCloud.cs index 6b8f8b5693..a543c97c8b 100644 --- a/Projectiles/Rogue/PlaguedFuelPackCloud.cs +++ b/Projectiles/Rogue/PlaguedFuelPackCloud.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue @@ -32,7 +33,7 @@ namespace CalamityMod.Projectiles.Rogue if (Main.rand.NextBool(150)) { - int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 89, Projectile.velocity.X * 0.4f, Projectile.velocity.Y * 0.4f, 100, default, 2f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GemEmerald, Projectile.velocity.X * 0.4f, Projectile.velocity.Y * 0.4f, 100, default, 2f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 1.2f; Main.dust[dust].velocity.Y -= 0.15f; @@ -49,7 +50,7 @@ namespace CalamityMod.Projectiles.Rogue { for (int i = 0; i < 5; i++) { - int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 89, Projectile.velocity.X * 0.4f, Projectile.velocity.Y * 0.4f, 100, default, 3.5f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GemEmerald, Projectile.velocity.X * 0.4f, Projectile.velocity.Y * 0.4f, 100, default, 3.5f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 1.2f; Main.dust[dust].velocity.Y -= 0.15f; diff --git a/Projectiles/Rogue/PlaguenadeBee.cs b/Projectiles/Rogue/PlaguenadeBee.cs index 63d2a8c12c..e32a981df4 100644 --- a/Projectiles/Rogue/PlaguenadeBee.cs +++ b/Projectiles/Rogue/PlaguenadeBee.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue @@ -23,6 +24,8 @@ namespace CalamityMod.Projectiles.Rogue Projectile.timeLeft = 240; Projectile.ignoreWater = true; Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() @@ -133,7 +136,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; int frameHeight = texture.Height / Main.projFrames[Projectile.type]; int drawStart = frameHeight * Projectile.frame; SpriteEffects spriteEffects = SpriteEffects.None; @@ -147,7 +150,7 @@ namespace CalamityMod.Projectiles.Rogue { for (int i = 0; i < 2; i++) { - int plague = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 89, Projectile.velocity.X, Projectile.velocity.Y, 50, default, 1f); + int plague = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GemEmerald, Projectile.velocity.X, Projectile.velocity.Y, 50, default, 1f); Main.dust[plague].noGravity = true; } } diff --git a/Projectiles/Rogue/PlaguenadeProj.cs b/Projectiles/Rogue/PlaguenadeProj.cs index 294eb311d5..4efa0328c3 100644 --- a/Projectiles/Rogue/PlaguenadeProj.cs +++ b/Projectiles/Rogue/PlaguenadeProj.cs @@ -2,9 +2,9 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { public class PlaguenadeProj : ModProjectile, ILocalizedModType @@ -62,7 +62,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } @@ -94,7 +94,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.Damage(); for (int i = 0; i < 10; i++) { - int smoke = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 31, 0f, 0f, 100, default, 2f); + int smoke = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Smoke, 0f, 0f, 100, default, 2f); Main.dust[smoke].velocity *= 3f; if (Main.rand.NextBool()) { @@ -104,10 +104,10 @@ namespace CalamityMod.Projectiles.Rogue } for (int j = 0; j < 15; j++) { - int plague = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 89, 0f, 0f, 100, default, 3f); + int plague = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GemEmerald, 0f, 0f, 100, default, 3f); Main.dust[plague].noGravity = true; Main.dust[plague].velocity *= 5f; - int fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 2f); + int fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 2f); Main.dust[fire].velocity *= 2f; } diff --git a/Projectiles/Rogue/PoisonBol.cs b/Projectiles/Rogue/PoisonBol.cs index f3110f5639..61f1448c2e 100644 --- a/Projectiles/Rogue/PoisonBol.cs +++ b/Projectiles/Rogue/PoisonBol.cs @@ -1,8 +1,8 @@ -using Microsoft.Xna.Framework; +using CalamityMod.CalPlayer; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.Projectiles.Rogue { @@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Rogue { if (Main.rand.NextBool(20)) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 44, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.JungleSpore, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } if (Projectile.timeLeft < 20) @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.Rogue velocity *= 2f; velocity += Projectile.velocity * 0.25f; velocity *= 0.8f; - int proj = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center - velocity, velocity, Main.rand.Next(569,572), (int)(Projectile.damage * 0.75), Projectile.knockBack, Projectile.owner); + int proj = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center - velocity, velocity, Main.rand.Next(569, 572), (int)(Projectile.damage * 0.75), Projectile.knockBack, Projectile.owner); if (proj.WithinBounds(Main.maxProjectiles)) { Main.projectile[proj].DamageType = RogueDamageClass.Instance; diff --git a/Projectiles/Rogue/PrismRocket.cs b/Projectiles/Rogue/PrismRocket.cs index 362bdd33c6..ad17ba775c 100644 --- a/Projectiles/Rogue/PrismRocket.cs +++ b/Projectiles/Rogue/PrismRocket.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Projectiles/Rogue/PrismShurikenBlade.cs b/Projectiles/Rogue/PrismShurikenBlade.cs index 0b6a21a3d6..e993e01731 100644 --- a/Projectiles/Rogue/PrismShurikenBlade.cs +++ b/Projectiles/Rogue/PrismShurikenBlade.cs @@ -1,7 +1,7 @@ -using Terraria; -using Terraria.ModLoader; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using Terraria; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { diff --git a/Projectiles/Rogue/Prismalline2.cs b/Projectiles/Rogue/Prismalline2.cs index 7307f389d2..84c7e8de2f 100644 --- a/Projectiles/Rogue/Prismalline2.cs +++ b/Projectiles/Rogue/Prismalline2.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } @@ -39,7 +39,7 @@ namespace CalamityMod.Projectiles.Rogue { for (int k = 0; k < 5; k++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 154, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Rain, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } } diff --git a/Projectiles/Rogue/Prismalline3.cs b/Projectiles/Rogue/Prismalline3.cs index c4ad925f7b..9032060ee5 100644 --- a/Projectiles/Rogue/Prismalline3.cs +++ b/Projectiles/Rogue/Prismalline3.cs @@ -1,8 +1,10 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Projectiles.Ranged; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Projectiles.Ranged; + namespace CalamityMod.Projectiles.Rogue { public class Prismalline3 : ModProjectile, ILocalizedModType @@ -33,7 +35,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } @@ -42,15 +44,15 @@ namespace CalamityMod.Projectiles.Rogue { for (int k = 0; k < 5; k++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 154, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Rain, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } if (Projectile.ai[0] == 1f) { - int shardCount = Main.rand.Next(1,4); + int shardCount = Main.rand.Next(1, 2 + 1); for (int s = 0; s < shardCount; s++) { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); - int shard = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage / 3, 0f, Projectile.owner); + int shard = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage / 3, 0f, Projectile.owner, 0f, 1f); if (shard.WithinBounds(Main.maxProjectiles)) { Main.projectile[shard].DamageType = RogueDamageClass.Instance; diff --git a/Projectiles/Rogue/PrismallineProj.cs b/Projectiles/Rogue/PrismallineProj.cs index e5f898961f..c47deff442 100644 --- a/Projectiles/Rogue/PrismallineProj.cs +++ b/Projectiles/Rogue/PrismallineProj.cs @@ -3,9 +3,9 @@ using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { public class PrismallineProj : ModProjectile, ILocalizedModType @@ -21,9 +21,9 @@ namespace CalamityMod.Projectiles.Rogue Projectile.height = 20; Projectile.friendly = true; Projectile.ignoreWater = true; - Projectile.penetrate = 2; + Projectile.penetrate = -1; Projectile.aiStyle = ProjAIStyleID.StickProjectile; - Projectile.timeLeft = 180; + Projectile.timeLeft = 60; AIType = ProjectileID.BoneJavelin; Projectile.DamageType = RogueDamageClass.Instance; Projectile.usesLocalNPCImmunity = true; @@ -36,17 +36,18 @@ namespace CalamityMod.Projectiles.Rogue Projectile.ai[1] += 1f; if (Projectile.ai[1] == 40f) { - int numProj = 4; + int numProj = 3; int numSpecProj = 0; + int numStealthProj = 5; float rotation = MathHelper.ToRadians(50); if (Projectile.owner == Main.myPlayer) { if (!Projectile.Calamity().stealthStrike) { - for (int i = 0; i < numProj + 1; i++) + for (int i = 0; i < numProj; i++) { Vector2 velocity = CalamityUtils.RandomVelocity(50f, 30f, 60f, 0.2f); - if (numSpecProj < 2 && !hitEnemy) + if (numSpecProj < 1 && !hitEnemy) { Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); ++numSpecProj; @@ -59,10 +60,10 @@ namespace CalamityMod.Projectiles.Rogue } else //stealth strike { - for (int j = 0; j < 5; j++) + for (int j = 0; j < 4; j++) { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); - int shard = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage / 2, 0f, Projectile.owner); + int shard = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage / 2, 0f, Projectile.owner, 0f, 1f); if (shard.WithinBounds(Main.maxProjectiles)) { Main.projectile[shard].DamageType = RogueDamageClass.Instance; @@ -70,7 +71,7 @@ namespace CalamityMod.Projectiles.Rogue Main.projectile[shard].localNPCHitCooldown = 10; } } - for (int i = 0; i < numProj + 1; i++) + for (int i = 0; i < numStealthProj + 1; i++) { Vector2 velocity = CalamityUtils.RandomVelocity(50f, 30f, 60f, 0.2f); Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 1f, 0f); @@ -82,7 +83,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } @@ -92,7 +93,7 @@ namespace CalamityMod.Projectiles.Rogue SoundEngine.PlaySound(SoundID.Item27, Projectile.position); for (int k = 0; k < 5; k++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 154, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Rain, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } if (Projectile.Calamity().stealthStrike) { diff --git a/Projectiles/Rogue/ProfanedPartisanProj.cs b/Projectiles/Rogue/ProfanedPartisanProj.cs index d373ddc574..edb349683d 100644 --- a/Projectiles/Rogue/ProfanedPartisanProj.cs +++ b/Projectiles/Rogue/ProfanedPartisanProj.cs @@ -2,9 +2,9 @@ using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { diff --git a/Projectiles/Rogue/ProfanedPartisanSpear.cs b/Projectiles/Rogue/ProfanedPartisanSpear.cs index 5966a46338..789a2576f9 100644 --- a/Projectiles/Rogue/ProfanedPartisanSpear.cs +++ b/Projectiles/Rogue/ProfanedPartisanSpear.cs @@ -1,8 +1,8 @@ -using Terraria; -using Terraria.ModLoader; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using CalamityMod.Buffs.DamageOverTime; +using Terraria; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { @@ -88,7 +88,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } diff --git a/Projectiles/Rogue/RadiantExplosion.cs b/Projectiles/Rogue/RadiantExplosion.cs index eb5a206d36..ed8f447e7d 100644 --- a/Projectiles/Rogue/RadiantExplosion.cs +++ b/Projectiles/Rogue/RadiantExplosion.cs @@ -1,10 +1,10 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.CalPlayer; using CalamityMod.Dusts; using CalamityMod.Projectiles.Ranged; using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -44,13 +44,13 @@ namespace CalamityMod.Projectiles.Rogue { for (int i = 0; i < 5; i++) { - int dusty = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 1.5f); + int dusty = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 1.5f); Main.dust[dusty].noGravity = true; Main.dust[dusty].velocity *= 0f; } for (int i = 0; i < 5; i++) { - int dusty = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 1.5f); + int dusty = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 1.5f); Main.dust[dusty].noGravity = true; Main.dust[dusty].velocity *= 0f; } diff --git a/Projectiles/Rogue/RadiantStar2.cs b/Projectiles/Rogue/RadiantStar2.cs index 91ef243b35..44e60111e5 100644 --- a/Projectiles/Rogue/RadiantStar2.cs +++ b/Projectiles/Rogue/RadiantStar2.cs @@ -1,8 +1,8 @@ +using System; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.CalPlayer; using CalamityMod.Dusts; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Projectiles/Rogue/RadiantStarKnife.cs b/Projectiles/Rogue/RadiantStarKnife.cs index 2486e3c7eb..1c9a51d6d7 100644 --- a/Projectiles/Rogue/RadiantStarKnife.cs +++ b/Projectiles/Rogue/RadiantStarKnife.cs @@ -1,11 +1,11 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { diff --git a/Projectiles/Rogue/RealityRuptureLance.cs b/Projectiles/Rogue/RealityRuptureLance.cs index 980e0135fb..3fe8595e45 100644 --- a/Projectiles/Rogue/RealityRuptureLance.cs +++ b/Projectiles/Rogue/RealityRuptureLance.cs @@ -54,7 +54,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; int frameHeight = texture.Height / Main.projFrames[Projectile.type]; int frameY = frameHeight * Projectile.frame; @@ -89,7 +89,7 @@ namespace CalamityMod.Projectiles.Rogue { for (int i = 0; i <= 9; i++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 272, Projectile.oldVelocity.X * 0.3f, Projectile.oldVelocity.Y * 0.3f, 0, default, Main.rand.NextFloat(1.2f, 1.6f)); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.WitherLightning, Projectile.oldVelocity.X * 0.3f, Projectile.oldVelocity.Y * 0.3f, 0, default, Main.rand.NextFloat(1.2f, 1.6f)); } } } diff --git a/Projectiles/Rogue/RealityRuptureMini.cs b/Projectiles/Rogue/RealityRuptureMini.cs index 3e7ae26d62..9a5a53d134 100644 --- a/Projectiles/Rogue/RealityRuptureMini.cs +++ b/Projectiles/Rogue/RealityRuptureMini.cs @@ -82,7 +82,7 @@ namespace CalamityMod.Projectiles.Rogue { for (int i = 0; i <= 2; i++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 272, Projectile.oldVelocity.X * Main.rand.NextFloat(1.1f, 1.3f), Projectile.oldVelocity.Y * Main.rand.NextFloat(1.1f, 1.3f)); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.WitherLightning, Projectile.oldVelocity.X * Main.rand.NextFloat(1.1f, 1.3f), Projectile.oldVelocity.Y * Main.rand.NextFloat(1.1f, 1.3f)); } } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) diff --git a/Projectiles/Rogue/RealityRuptureStealth.cs b/Projectiles/Rogue/RealityRuptureStealth.cs index 7ba28144a7..ce21f21560 100644 --- a/Projectiles/Rogue/RealityRuptureStealth.cs +++ b/Projectiles/Rogue/RealityRuptureStealth.cs @@ -1,11 +1,11 @@ -using CalamityMod.Particles; +using System; +using System.Reflection.Metadata; +using CalamityMod.Particles; using CalamityMod.Projectiles.Melee; using CalamityMod.Projectiles.Pets; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Mono.Cecil; -using System; -using System.Reflection.Metadata; using Terraria; using Terraria.Audio; using Terraria.Graphics.Shaders; @@ -16,7 +16,7 @@ namespace CalamityMod.Projectiles.Rogue { public class RealityRuptureStealth : ModProjectile, ILocalizedModType { - public static readonly SoundStyle Hitsound = new("CalamityMod/Sounds/Item/RealityRuptureStealthHit") { Volume = 1.2f, PitchVariance = 0.3f}; + public static readonly SoundStyle Hitsound = new("CalamityMod/Sounds/Item/RealityRuptureStealthHit") { Volume = 1.2f, PitchVariance = 0.3f }; public new string LocalizationCategory => "Projectiles.Rogue"; public override string Texture => "CalamityMod/Items/Weapons/Rogue/RealityRupture"; public bool posthit = false; @@ -77,7 +77,7 @@ namespace CalamityMod.Projectiles.Rogue } public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; int frameHeight = texture.Height / Main.projFrames[Projectile.type]; int frameY = frameHeight * Projectile.frame; @@ -96,7 +96,7 @@ namespace CalamityMod.Projectiles.Rogue Vector2 sparkVelocity = Projectile.velocity.RotatedByRandom(0.4f) * Main.rand.NextFloat(0.6f, 1.5f); Dust dust = Dust.NewDustPerfect(Projectile.Center + Projectile.velocity, 272, sparkVelocity.RotatedByRandom(0.1f), 0, default, Main.rand.NextFloat(1.2f, 1.5f)); dust.noGravity = true; - + int sparkLifetime = Main.rand.Next(43, 48); float sparkScale = Main.rand.NextFloat(2.2f, 3f); Color sparkColor = Color.Plum * 0.8f; diff --git a/Projectiles/Rogue/ReaperProjectile.cs b/Projectiles/Rogue/ReaperProjectile.cs index f716ff8824..fd8bfe5e4e 100644 --- a/Projectiles/Rogue/ReaperProjectile.cs +++ b/Projectiles/Rogue/ReaperProjectile.cs @@ -1,15 +1,15 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Dusts; +using CalamityMod.Particles; +using Microsoft.CodeAnalysis; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; +using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using CalamityMod.Buffs.StatDebuffs; -using CalamityMod.Particles; -using Terraria.Graphics.Shaders; -using Microsoft.Xna.Framework.Graphics; -using CalamityMod.Dusts; -using Microsoft.CodeAnalysis; namespace CalamityMod.Projectiles.Rogue { @@ -180,7 +180,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int i = 0; i < 5; i++) { - int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default, 2f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.SulphurousSeaAcid, 0f, 0f, 100, default, 2f); Main.dust[dust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -190,10 +190,10 @@ namespace CalamityMod.Projectiles.Rogue } for (int j = 0; j < 8; j++) { - int dust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default, 3f); + int dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.SulphurousSeaAcid, 0f, 0f, 100, default, 3f); Main.dust[dust2].noGravity = true; Main.dust[dust2].velocity *= 5f; - dust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default, 2f); + dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.SulphurousSeaAcid, 0f, 0f, 100, default, 2f); Main.dust[dust2].velocity *= 2f; } } diff --git a/Projectiles/Rogue/RefractionRotorProjectile.cs b/Projectiles/Rogue/RefractionRotorProjectile.cs index cbb5fa4973..dfc1f380ca 100644 --- a/Projectiles/Rogue/RefractionRotorProjectile.cs +++ b/Projectiles/Rogue/RefractionRotorProjectile.cs @@ -1,6 +1,6 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Projectiles/Rogue/RegulusEnergy.cs b/Projectiles/Rogue/RegulusEnergy.cs index abfca67bbe..e7a56a394b 100644 --- a/Projectiles/Rogue/RegulusEnergy.cs +++ b/Projectiles/Rogue/RegulusEnergy.cs @@ -1,8 +1,8 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; -using CalamityMod.Dusts; -using CalamityMod.Buffs.DamageOverTime; namespace CalamityMod.Projectiles.Rogue { @@ -31,11 +31,11 @@ namespace CalamityMod.Projectiles.Rogue { if (Projectile.ai[0] % 4 == 0) { - coolDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width - constant * 2, Projectile.height - constant * 2, ModContent.DustType(), 0f, 0f, 100, default, 1.5f); + coolDust = Dust.NewDust(Projectile.position, Projectile.width - constant * 2, Projectile.height - constant * 2, ModContent.DustType(), 0f, 0f, 100, default, 1.5f); } else { - coolDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width - constant * 2, Projectile.height - constant * 2, ModContent.DustType(), 0f, 0f, 100, default, 1.5f); + coolDust = Dust.NewDust(Projectile.position, Projectile.width - constant * 2, Projectile.height - constant * 2, ModContent.DustType(), 0f, 0f, 100, default, 1.5f); } Main.dust[coolDust].noGravity = true; Main.dust[coolDust].velocity *= 0.1f; diff --git a/Projectiles/Rogue/RegulusRiotProj.cs b/Projectiles/Rogue/RegulusRiotProj.cs index ad27a546d4..34857952a4 100644 --- a/Projectiles/Rogue/RegulusRiotProj.cs +++ b/Projectiles/Rogue/RegulusRiotProj.cs @@ -1,11 +1,11 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Dusts; -using CalamityMod.Buffs.DamageOverTime; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -61,7 +61,7 @@ namespace CalamityMod.Projectiles.Rogue } if (behaviorInt == 0) { - Projectile.rotation -= 0.104719758f; + Projectile.rotation -= MathHelper.Pi / 30f; if (Projectile.ai[0] >= 30f) { @@ -79,7 +79,7 @@ namespace CalamityMod.Projectiles.Rogue } else if (behaviorInt == 1) { - Projectile.rotation -= 0.104719758f; + Projectile.rotation -= MathHelper.Pi / 30f; Vector2 targetCenter = Projectile.Center; float homingRange = 300f; bool homeIn = false; @@ -130,7 +130,7 @@ namespace CalamityMod.Projectiles.Rogue { float homeSpeed = 24f; float turnMult = 10f; - Vector2 projCenter = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); + Vector2 projCenter = Projectile.Center; float xDist = targetCenter.X - projCenter.X; float yDist = targetCenter.Y - projCenter.Y; float totalDist = (float)Math.Sqrt((double)(xDist * xDist + yDist * yDist)); diff --git a/Projectiles/Rogue/RotBallProjectile.cs b/Projectiles/Rogue/RotBallProjectile.cs index 6099cc455e..b3dc35cd40 100644 --- a/Projectiles/Rogue/RotBallProjectile.cs +++ b/Projectiles/Rogue/RotBallProjectile.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } diff --git a/Projectiles/Rogue/SacrificeProjectile.cs b/Projectiles/Rogue/SacrificeProjectile.cs index af977d31af..2c946b43b3 100644 --- a/Projectiles/Rogue/SacrificeProjectile.cs +++ b/Projectiles/Rogue/SacrificeProjectile.cs @@ -1,5 +1,5 @@ -using Microsoft.Xna.Framework; -using System.IO; +using System.IO; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -55,10 +55,17 @@ namespace CalamityMod.Projectiles.Rogue { if (!Owner.moonLeech && AbleToHealOwner) { - int healAmount = Projectile.Calamity().stealthStrike ? 40 : 3; + int heal = Projectile.Calamity().stealthStrike ? 40 : 3; - Owner.HealEffect(healAmount); - Owner.statLife += healAmount; + if (Main.player[Main.myPlayer].lifeSteal <= 0f) + { + Projectile.Kill(); + return; + } + + Main.player[Main.myPlayer].lifeSteal -= heal; + Owner.HealEffect(heal); + Owner.statLife += heal; if (Owner.statLife > Owner.statLifeMax2) Owner.statLife = Owner.statLifeMax2; } @@ -87,7 +94,7 @@ namespace CalamityMod.Projectiles.Rogue else if (Projectile.timeLeft > 180 && Projectile.Calamity().stealthStrike) Projectile.timeLeft = 180; } - Projectile.StickyProjAI(50); + Projectile.StickyProjAI(50); } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) @@ -106,7 +113,7 @@ namespace CalamityMod.Projectiles.Rogue { for (int i = 0; i < 5; i++) { - Dust blood = Dust.NewDustDirect(Projectile.Center, 1, 1, 5, 0, 0, 0, default, 1.5f); + Dust blood = Dust.NewDustDirect(Projectile.Center, 1, 1, DustID.Blood, 0, 0, 0, default, 1.5f); blood.position += Projectile.velocity.SafeNormalize(Vector2.Zero) * Projectile.scale * 42f; blood.noGravity = true; } diff --git a/Projectiles/Rogue/TerraDiskProjectile.cs b/Projectiles/Rogue/SamsaraSlicerProjectile.cs similarity index 92% rename from Projectiles/Rogue/TerraDiskProjectile.cs rename to Projectiles/Rogue/SamsaraSlicerProjectile.cs index e68019dd05..e0bfbd6a17 100644 --- a/Projectiles/Rogue/TerraDiskProjectile.cs +++ b/Projectiles/Rogue/SamsaraSlicerProjectile.cs @@ -1,16 +1,16 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { - public class TerraDiskProjectile : ModProjectile, ILocalizedModType + public class SamsaraSlicerProjectile : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; - public override string Texture => "CalamityMod/Items/Weapons/Rogue/TerraDisk"; + public override string Texture => "CalamityMod/Items/Weapons/Rogue/SamsaraSlicer"; private bool initialized = false; private int Lifetime = 180; @@ -129,7 +129,7 @@ namespace CalamityMod.Projectiles.Rogue if (Projectile.timeLeft % 8f == 0f && Main.myPlayer == Projectile.owner) { - int disk = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage / 4, Projectile.knockBack / 4f, Projectile.owner, Projectile.identity, Main.rand.NextFloat(0.02f, 0.1f)); + int disk = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage / 4, Projectile.knockBack / 4f, Projectile.owner, Projectile.identity, Main.rand.NextFloat(0.02f, 0.1f)); Main.projectile[disk].timeLeft *= 2; Main.projectile[disk].aiStyle = -1; } @@ -166,7 +166,7 @@ namespace CalamityMod.Projectiles.Rogue { if (Main.player[Projectile.owner].miscCounter % 50 == 0) { - int splitProj = ModContent.ProjectileType(); + int splitProj = ModContent.ProjectileType(); if (Projectile.owner == Main.myPlayer) { float spread = 60f * 0.0174f; @@ -175,7 +175,7 @@ namespace CalamityMod.Projectiles.Rogue for (int i = 0; i < 6; i++) { Vector2 velocity = ((MathHelper.TwoPi * i / 6f) - MathHelper.PiOver2).ToRotationVector2() * 6f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack * 0.5f, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack * 0.5f, Projectile.owner); } } } @@ -187,7 +187,7 @@ namespace CalamityMod.Projectiles.Rogue Lighting.AddLight(Projectile.Center, 0f, 0.75f, 0f); if (!Main.rand.NextBool(5)) return; - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 107, Projectile.velocity.X, Projectile.velocity.Y); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.TerraBlade, Projectile.velocity.X, Projectile.velocity.Y); } public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Rogue/TerraDiskProjectile2.cs b/Projectiles/Rogue/SamsaraSlicerSmallDisk.cs similarity index 92% rename from Projectiles/Rogue/TerraDiskProjectile2.cs rename to Projectiles/Rogue/SamsaraSlicerSmallDisk.cs index 9ef33c60a2..220b381b0d 100644 --- a/Projectiles/Rogue/TerraDiskProjectile2.cs +++ b/Projectiles/Rogue/SamsaraSlicerSmallDisk.cs @@ -5,7 +5,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { - public class TerraDiskProjectile2 : ModProjectile, ILocalizedModType + public class SamsaraSlicerSmallDisk : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; private double rotation = 0; @@ -50,7 +50,7 @@ namespace CalamityMod.Projectiles.Rogue for (int i = 0; i < Main.maxProjectiles; i++) { Projectile p = Main.projectile[i]; - if (p.identity == Projectile.ai[0] && p.active && p.type == ModContent.ProjectileType()) + if (p.identity == Projectile.ai[0] && p.active && p.type == ModContent.ProjectileType()) { parent = p; active = true; @@ -86,7 +86,7 @@ namespace CalamityMod.Projectiles.Rogue Lighting.AddLight(Projectile.Center, 0f, 0.75f, 0f); if (!Main.rand.NextBool(5)) return; - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 107, Projectile.velocity.X, Projectile.velocity.Y); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.TerraBlade, Projectile.velocity.X, Projectile.velocity.Y); } public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Rogue/TerraDiskProjectile2.png b/Projectiles/Rogue/SamsaraSlicerSmallDisk.png similarity index 100% rename from Projectiles/Rogue/TerraDiskProjectile2.png rename to Projectiles/Rogue/SamsaraSlicerSmallDisk.png diff --git a/Projectiles/Rogue/SandslasherProj.cs b/Projectiles/Rogue/SandslasherProj.cs index 67083bb61e..804f778f39 100644 --- a/Projectiles/Rogue/SandslasherProj.cs +++ b/Projectiles/Rogue/SandslasherProj.cs @@ -35,20 +35,20 @@ namespace CalamityMod.Projectiles.Rogue Projectile.ai[1] += 1f; if (Projectile.ai[0] == 3f) Projectile.tileCollide = true; - if(Projectile.velocity.X < 0f) + if (Projectile.velocity.X < 0f) { Projectile.velocity.X -= 0.07f; if ((Projectile.ai[0] %= 30f) == 0f) Projectile.damage -= (int)(Projectile.velocity.X * 2f); } - else if(Projectile.velocity.X > 0f) + else if (Projectile.velocity.X > 0f) { Projectile.velocity.X += 0.07f; if ((Projectile.ai[0] %= 30f) == 0f) Projectile.damage += (int)(Projectile.velocity.X * 2f); } - Projectile.rotation += 0.1f * Projectile.direction + (Projectile.velocity.X /85); - if(Projectile.Calamity().stealthStrike && Projectile.ai[1] >= 5f) + Projectile.rotation += 0.1f * Projectile.direction + (Projectile.velocity.X / 85); + if (Projectile.Calamity().stealthStrike && Projectile.ai[1] >= 5f) { Vector2 speed = new Vector2(Main.rand.NextFloat(-2f, 2f), Main.rand.NextFloat(-2f, 2f)); Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.position, speed, ModContent.ProjectileType(), (int)(Projectile.damage * 0.4), 0f, Projectile.owner); @@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Rogue { for (int i = 0; i < 15; i++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 85, Projectile.velocity.X * 0.25f, Projectile.velocity.Y * 0.25f, 0, default, 1f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.UnusedBrown, Projectile.velocity.X * 0.25f, Projectile.velocity.Y * 0.25f, 0, default, 1f); } } diff --git a/Projectiles/Rogue/ScarletBlast.cs b/Projectiles/Rogue/ScarletBlast.cs index f6d8265aef..5a8782ef8c 100644 --- a/Projectiles/Rogue/ScarletBlast.cs +++ b/Projectiles/Rogue/ScarletBlast.cs @@ -1,9 +1,9 @@ +using System; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { public class ScarletBlast : ModProjectile, ILocalizedModType @@ -77,7 +77,7 @@ namespace CalamityMod.Projectiles.Rogue randomAdjust = random3 / randomAdjust; random1 *= randomAdjust; random2 *= randomAdjust; - int redDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 130, 0f, 0f, 100, default, 1.25f); + int redDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Firework_Red, 0f, 0f, 100, default, 1.25f); Dust dust = Main.dust[redDust]; dust.noGravity = true; dust.position.X = Projectile.Center.X; diff --git a/Projectiles/Rogue/ScarletDevilProjectile.cs b/Projectiles/Rogue/ScarletDevilProjectile.cs index 6f47f1ddfd..07873133be 100644 --- a/Projectiles/Rogue/ScarletDevilProjectile.cs +++ b/Projectiles/Rogue/ScarletDevilProjectile.cs @@ -1,12 +1,13 @@ -using Microsoft.Xna.Framework; +using System; +using CalamityMod.Balancing; +using CalamityMod.Graphics.Primitives; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using CalamityMod.Graphics.Primitives; namespace CalamityMod.Projectiles.Rogue { @@ -126,15 +127,18 @@ namespace CalamityMod.Projectiles.Rogue if (!Projectile.Calamity().stealthStrike) return; - if (!Main.player[Projectile.owner].moonLeech) - { - // Give on-heal effects from stealth strikes. - Main.player[Projectile.owner].statLife += 90; - Main.player[Projectile.owner].HealEffect(90); - } - - // And spawn a bloom of bullets. + // Spawn a bloom of bullets. SpawnOnStealthStrikeBullets(); + + // Give on-heal effects from stealth strikes. + int heal = (int)Math.Round(hit.Damage * 0.01); + if (heal > BalancingConstants.LifeStealCap) + heal = BalancingConstants.LifeStealCap; + + if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) + return; + + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); } public override void OnHitPlayer(Player target, Player.HurtInfo info) @@ -144,12 +148,18 @@ namespace CalamityMod.Projectiles.Rogue if (!Projectile.Calamity().stealthStrike) return; - // Give on-heal effects from stealth strikes. - Main.player[Projectile.owner].statLife += 120; - Main.player[Projectile.owner].HealEffect(120); - - // And spawn a bloom of bullets. + // Spawn a bloom of bullets. SpawnOnStealthStrikeBullets(); + + // Give on-heal effects from stealth strikes. + int heal = (int)Math.Round(info.Damage * 0.01); + if (heal > BalancingConstants.LifeStealCap) + heal = BalancingConstants.LifeStealCap; + + if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0) + return; + + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); } internal float WidthFunction(float completionRatio) @@ -161,8 +171,11 @@ namespace CalamityMod.Projectiles.Rogue internal Color ColorFunction(float completionRatio) { + float colorIncrement = (float)Math.Pow(completionRatio, 1f / 2f); + if (colorIncrement is float.NaN) + return Color.DarkRed; float colorFade = 1f - Utils.GetLerpValue(0.6f, 0.98f, completionRatio, true); - Color baseColor = CalamityUtils.MulticolorLerp((float)Math.Pow(completionRatio, 1D / 2D), Color.White, Color.DarkRed, Color.Wheat, Color.IndianRed) * MathHelper.Lerp(0f, 1.4f, colorFade); + Color baseColor = CalamityUtils.MulticolorLerp(colorIncrement, Color.White, Color.DarkRed, Color.Wheat, Color.IndianRed) * MathHelper.Lerp(0f, 1.4f, colorFade); return Color.Lerp(baseColor, Color.DarkRed, (float)Math.Pow(completionRatio, 3D)); } @@ -179,7 +192,7 @@ namespace CalamityMod.Projectiles.Rogue PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(WidthFunction, ColorFunction, (_) => Projectile.Size * 0.5f + Projectile.velocity.SafeNormalize(Vector2.Zero) * 86f, false, shader: GameShaders.Misc["CalamityMod:OverpoweredTouhouSpearShader"]), 60); - Texture2D spearTexture = ModContent.Request(Texture).Value; + Texture2D spearTexture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; for (int i = 0; i < 7; i++) { diff --git a/Projectiles/Rogue/ScourgeVenomCloud.cs b/Projectiles/Rogue/ScourgeVenomCloud.cs index bd99aeeeb7..1ea306b316 100644 --- a/Projectiles/Rogue/ScourgeVenomCloud.cs +++ b/Projectiles/Rogue/ScourgeVenomCloud.cs @@ -1,5 +1,5 @@ -using CalamityMod.Buffs.DamageOverTime; -using System; +using System; +using CalamityMod.Buffs.StatDebuffs; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -66,19 +66,19 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(BuffID.Venom, 120); + target.AddBuff(ModContent.BuffType(), Projectile.Calamity().stealthStrike ? 120 : 60); if (Projectile.ai[1] == 1f && Projectile.owner == Main.myPlayer) //stealth strike attack { - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(BuffID.Venom, 120); } } public override void OnHitPlayer(Player target, Player.HurtInfo info) { - target.AddBuff(BuffID.Venom, 120); + target.AddBuff(ModContent.BuffType(), Projectile.Calamity().stealthStrike ? 120 : 60); if (Projectile.ai[1] == 1f && Projectile.owner == Main.myPlayer) //stealth strike attack { - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(BuffID.Venom, 120); } } } diff --git a/Projectiles/Rogue/ScourgeoftheDesertProj.cs b/Projectiles/Rogue/ScourgeoftheDesertProj.cs index 1f708cbb8c..186ae20d14 100644 --- a/Projectiles/Rogue/ScourgeoftheDesertProj.cs +++ b/Projectiles/Rogue/ScourgeoftheDesertProj.cs @@ -1,11 +1,11 @@ -using CalamityMod.Items.Weapons.Melee; +using System; +using CalamityMod.Items.Weapons.Melee; using CalamityMod.NPCs.DesertScourge; using CalamityMod.NPCs.Ravager; using CalamityMod.Particles; using CalamityMod.Projectiles.Magic; using Microsoft.CodeAnalysis; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -67,7 +67,7 @@ namespace CalamityMod.Projectiles.Rogue dust.noGravity = true; dust.velocity = -Projectile.velocity * 0.5f; } - + if (!InitialTileHit && Time > 45) { if (Projectile.velocity.Y < 0) @@ -164,7 +164,7 @@ namespace CalamityMod.Projectiles.Rogue dust.noGravity = true; } Projectile.velocity = oldVelocity * 0.7f; - SoundEngine.PlaySound(SoundID.WormDig with { Volume = 1.5f, Pitch = 1.1f}, Projectile.Center); + SoundEngine.PlaySound(SoundID.WormDig with { Volume = 1.5f, Pitch = 1.1f }, Projectile.Center); InitialTileHit = true; } return false; diff --git a/Projectiles/Rogue/ScourgeoftheSeasProjectile.cs b/Projectiles/Rogue/ScourgeoftheSeasProjectile.cs index 9196243517..e3a34b3310 100644 --- a/Projectiles/Rogue/ScourgeoftheSeasProjectile.cs +++ b/Projectiles/Rogue/ScourgeoftheSeasProjectile.cs @@ -1,10 +1,10 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using CalamityMod.Buffs.StatDebuffs; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Buffs.DamageOverTime; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -37,13 +37,13 @@ namespace CalamityMod.Projectiles.Rogue { if (Main.rand.NextBool(5)) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 85, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.UnusedBrown, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); if (Projectile.Calamity().stealthStrike) //stealth strike attack { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 116, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Skyware, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } } - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 0.785f; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4; Projectile.velocity.X *= 1.015f; Projectile.velocity.Y *= 1.015f; Projectile.velocity.X = Math.Min(16f, Projectile.velocity.X); @@ -52,19 +52,19 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(BuffID.Venom, 180); + target.AddBuff(ModContent.BuffType(), Projectile.Calamity().stealthStrike ? 180 : 90); if (Projectile.Calamity().stealthStrike) //stealth strike attack { - target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(BuffID.Venom, 180); } } public override void OnHitPlayer(Player target, Player.HurtInfo info) { - target.AddBuff(BuffID.Venom, 180); + target.AddBuff(ModContent.BuffType(), Projectile.Calamity().stealthStrike ? 180 : 90); if (Projectile.Calamity().stealthStrike) //stealth strike attack { - target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(BuffID.Venom, 180); } } @@ -73,7 +73,7 @@ namespace CalamityMod.Projectiles.Rogue SoundEngine.PlaySound(SoundID.Item14, Projectile.position); for (int dustIndex = 0; dustIndex < 8; dustIndex++) { - int dusty = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 85, 0f, 0f, 100, default, 1f); + int dusty = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.UnusedBrown, 0f, 0f, 100, default, 1f); Main.dust[dusty].velocity *= 1f; } if (Projectile.owner == Main.myPlayer) diff --git a/Projectiles/Rogue/SeafoamBombProj.cs b/Projectiles/Rogue/SeafoamBombProj.cs index 22fc14be58..aef6b80960 100644 --- a/Projectiles/Rogue/SeafoamBombProj.cs +++ b/Projectiles/Rogue/SeafoamBombProj.cs @@ -1,8 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { public class SeafoamBombProj : ModProjectile, ILocalizedModType @@ -24,7 +24,11 @@ namespace CalamityMod.Projectiles.Rogue Projectile.velocity.Y = Projectile.velocity.Y + 0.15f; Projectile.velocity.X = Projectile.velocity.X * 0.99f; } - + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + if (Main.zenithWorld) + modifiers.SourceDamage *= 12; + } public override void OnKill(int timeLeft) { Projectile.position = Projectile.Center; diff --git a/Projectiles/Rogue/SeafoamBubble.cs b/Projectiles/Rogue/SeafoamBubble.cs index 926194bd0f..d33e0aa2b0 100644 --- a/Projectiles/Rogue/SeafoamBubble.cs +++ b/Projectiles/Rogue/SeafoamBubble.cs @@ -1,8 +1,8 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -53,7 +53,7 @@ namespace CalamityMod.Projectiles.Rogue int inc; for (int i = 0; i < 25; i = inc + 1) { - int waterDust = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, 154, 0f, 0f, 0, default, 1f); + int waterDust = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, DustID.Rain, 0f, 0f, 0, default, 1f); Main.dust[waterDust].position = (Main.dust[waterDust].position + Projectile.position) / 2f; Main.dust[waterDust].velocity = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); Main.dust[waterDust].velocity.Normalize(); diff --git a/Projectiles/Rogue/SealedSingularityBlackhole.cs b/Projectiles/Rogue/SealedSingularityBlackhole.cs index 7a9fd289bd..2450b07510 100644 --- a/Projectiles/Rogue/SealedSingularityBlackhole.cs +++ b/Projectiles/Rogue/SealedSingularityBlackhole.cs @@ -1,4 +1,4 @@ -using CalamityMod.NPCs; +using CalamityMod.NPCs; using CalamityMod.NPCs.NormalNPCs; using Microsoft.Xna.Framework; using Terraria; diff --git a/Projectiles/Rogue/SealedSingularityGore.cs b/Projectiles/Rogue/SealedSingularityGore.cs index 5c173a99b0..4a8db4cc51 100644 --- a/Projectiles/Rogue/SealedSingularityGore.cs +++ b/Projectiles/Rogue/SealedSingularityGore.cs @@ -1,9 +1,9 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; -using Terraria.ModLoader; -using Terraria.ID; using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { @@ -36,7 +36,7 @@ namespace CalamityMod.Projectiles.Rogue int splash = 0; while (splash < 4) { - Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 31, -Projectile.velocity.X * 0.15f, -Projectile.velocity.Y * 0.10f, 150, default, 0.9f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Smoke, -Projectile.velocity.X * 0.15f, -Projectile.velocity.Y * 0.10f, 150, default, 0.9f); splash += 1; } } @@ -46,12 +46,15 @@ namespace CalamityMod.Projectiles.Rogue Texture2D texture; switch (Projectile.ai[0]) { - case 1f: texture = ModContent.Request("CalamityMod/Projectiles/Rogue/SealedSingularityGore2").Value; - break; - case 2f: texture = ModContent.Request("CalamityMod/Projectiles/Rogue/SealedSingularityGore3").Value; - break; - default: texture = ModContent.Request(Texture).Value; - break; + case 1f: + texture = ModContent.Request("CalamityMod/Projectiles/Rogue/SealedSingularityGore2").Value; + break; + case 2f: + texture = ModContent.Request("CalamityMod/Projectiles/Rogue/SealedSingularityGore3").Value; + break; + default: + texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + break; } Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition, new Rectangle?(new Rectangle(0, 0, texture.Width, texture.Height)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, texture.Height / 2f), Projectile.scale, SpriteEffects.None, 0); return false; diff --git a/Projectiles/Rogue/SealedSingularityProj.cs b/Projectiles/Rogue/SealedSingularityProj.cs index d948e3ade7..559f9d3a3f 100644 --- a/Projectiles/Rogue/SealedSingularityProj.cs +++ b/Projectiles/Rogue/SealedSingularityProj.cs @@ -1,8 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -35,7 +35,7 @@ namespace CalamityMod.Projectiles.Rogue } } - public override void OnKill (int timeLeft) + public override void OnKill(int timeLeft) { if (Projectile.owner != Main.myPlayer) return; diff --git a/Projectiles/Rogue/SearedPanProjectile.cs b/Projectiles/Rogue/SearedPanProjectile.cs index 28d7ba76c3..174bc44bc7 100644 --- a/Projectiles/Rogue/SearedPanProjectile.cs +++ b/Projectiles/Rogue/SearedPanProjectile.cs @@ -1,12 +1,12 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.CalPlayer; +using CalamityMod.Items.Weapons.Rogue; using CalamityMod.NPCs.NormalNPCs; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using CalamityMod.Items.Weapons.Rogue; namespace CalamityMod.Projectiles.Rogue { @@ -47,7 +47,7 @@ namespace CalamityMod.Projectiles.Rogue { if (Main.rand.NextBool(5)) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 5, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Blood, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); @@ -56,7 +56,7 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { // Don't increment the Seared Pan counter when hitting dummies - //&& target.type != ModContent.NPCType() this is here just in case its needed again + //&& target.type != ModContent.NPCType() this is here just in case its needed again bool dummy = target.type != NPCID.TargetDummy; OnHitEffects(target.whoAmI, target.life, dummy); } diff --git a/Projectiles/Rogue/SeraphimAngelicLight.cs b/Projectiles/Rogue/SeraphimAngelicLight.cs index 7d77e8f642..3519a18273 100644 --- a/Projectiles/Rogue/SeraphimAngelicLight.cs +++ b/Projectiles/Rogue/SeraphimAngelicLight.cs @@ -1,5 +1,5 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; diff --git a/Projectiles/Rogue/SeraphimAngelicLight2.cs b/Projectiles/Rogue/SeraphimAngelicLight2.cs index 5dc70394a4..bae53092ef 100644 --- a/Projectiles/Rogue/SeraphimAngelicLight2.cs +++ b/Projectiles/Rogue/SeraphimAngelicLight2.cs @@ -1,5 +1,5 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; diff --git a/Projectiles/Rogue/SeraphimBeamLarge.cs b/Projectiles/Rogue/SeraphimBeamLarge.cs index bd8f12c236..f0940f0ab8 100644 --- a/Projectiles/Rogue/SeraphimBeamLarge.cs +++ b/Projectiles/Rogue/SeraphimBeamLarge.cs @@ -1,11 +1,11 @@ -using CalamityMod.Sounds; +using System; +using System.IO; +using System.Linq; using CalamityMod.Projectiles.BaseProjectiles; +using CalamityMod.Sounds; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; -using System; -using System.IO; -using System.Linq; using Terraria; using Terraria.Audio; using Terraria.ID; diff --git a/Projectiles/Rogue/SeraphimDagger.cs b/Projectiles/Rogue/SeraphimDagger.cs index bf916824f8..3f1ad68265 100644 --- a/Projectiles/Rogue/SeraphimDagger.cs +++ b/Projectiles/Rogue/SeraphimDagger.cs @@ -1,6 +1,6 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -86,7 +86,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Vector2 origin = texture.Size() * 0.5f; Vector2 baseDrawPosition = Projectile.Center - Main.screenPosition; diff --git a/Projectiles/Rogue/SeraphimProjectile.cs b/Projectiles/Rogue/SeraphimProjectile.cs index 669a22db7f..2e27bbe5bd 100644 --- a/Projectiles/Rogue/SeraphimProjectile.cs +++ b/Projectiles/Rogue/SeraphimProjectile.cs @@ -1,7 +1,7 @@ -using CalamityMod.Items.Weapons.Rogue; +using System; +using CalamityMod.Items.Weapons.Rogue; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ModLoader; @@ -91,7 +91,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Vector2 origin = texture.Size() * 0.5f; Vector2 baseDrawPosition = Projectile.Center - Main.screenPosition; diff --git a/Projectiles/Rogue/ShatteredExplosion.cs b/Projectiles/Rogue/ShatteredExplosion.cs index ea0a9efc86..f5ffc3e384 100644 --- a/Projectiles/Rogue/ShatteredExplosion.cs +++ b/Projectiles/Rogue/ShatteredExplosion.cs @@ -1,7 +1,9 @@ -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Rogue { public class ShatteredExplosion : ModProjectile, ILocalizedModType @@ -37,7 +39,7 @@ namespace CalamityMod.Projectiles.Rogue { for (int i = 0; i < 5; i++) { - int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 246, 0f, 0f, 100, default, 1.5f); + int num469 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GoldCoin, 0f, 0f, 100, default, 1.5f); Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; } diff --git a/Projectiles/Rogue/ShatteredSunKnife.cs b/Projectiles/Rogue/ShatteredSunKnife.cs index e27b3b368d..1c6ecfe6de 100644 --- a/Projectiles/Rogue/ShatteredSunKnife.cs +++ b/Projectiles/Rogue/ShatteredSunKnife.cs @@ -1,10 +1,10 @@ -using CalamityMod.CalPlayer; +using System; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -68,7 +68,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.active = false; for (int j = 0; j < 8; j++) { - int dusty = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 127, 0f, 0f, 100, default, 2f); + int dusty = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Flare, 0f, 0f, 100, default, 2f); Main.dust[dusty].velocity *= 3f; if (Main.rand.NextBool()) { @@ -77,10 +77,10 @@ namespace CalamityMod.Projectiles.Rogue } for (int k = 0; k < 16; k++) { - int dusty2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 127, 0f, 0f, 100, default, 3f); + int dusty2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Flare, 0f, 0f, 100, default, 3f); Main.dust[dusty2].noGravity = true; Main.dust[dusty2].velocity *= 5f; - dusty2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 127, 0f, 0f, 100, default, 2f); + dusty2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Flare, 0f, 0f, 100, default, 2f); Main.dust[dusty2].velocity *= 2f; } } @@ -151,7 +151,7 @@ namespace CalamityMod.Projectiles.Rogue SoundEngine.PlaySound(SoundID.Item27, Projectile.position); for (int k = 0; k < 5; k++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 246, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f, 0, default, 1f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.GoldCoin, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f, 0, default, 1f); } } } diff --git a/Projectiles/Rogue/ShatteredSunScorchedBlade.cs b/Projectiles/Rogue/ShatteredSunScorchedBlade.cs index 36deeca44d..de1bbed1c3 100644 --- a/Projectiles/Rogue/ShatteredSunScorchedBlade.cs +++ b/Projectiles/Rogue/ShatteredSunScorchedBlade.cs @@ -1,11 +1,11 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -40,7 +40,7 @@ namespace CalamityMod.Projectiles.Rogue if (counter == 1) { stealthOrigin = Projectile.ai[0] == 1f; - Projectile.alpha += (int) Projectile.ai[1]; + Projectile.alpha += (int)Projectile.ai[1]; Projectile.ai[0] = 0f; } if (counter == 20 && !Projectile.Calamity().stealthStrike && !stealthOrigin) @@ -58,13 +58,13 @@ namespace CalamityMod.Projectiles.Rogue } if (counter % 9 == 0 || (counter % 5 == 0 && Projectile.Calamity().stealthStrike)) { - int timesToSpawnDust = Projectile.Calamity().stealthStrike ? 2 : 1; + int timesToSpawnDust = Projectile.Calamity().stealthStrike ? 2 : 1; for (int i = 0; i < timesToSpawnDust; i++) { - int dusty = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 127, 0f, 0f, 100, default, Projectile.Calamity().stealthStrike ? 1.8f : 1.3f); + int dusty = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Flare, 0f, 0f, 100, default, Projectile.Calamity().stealthStrike ? 1.8f : 1.3f); Main.dust[dusty].noGravity = true; Main.dust[dusty].velocity *= 5f; - dusty = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 127, 0f, 0f, 100, default, Projectile.Calamity().stealthStrike ? 1.8f : 1.3f); + dusty = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Flare, 0f, 0f, 100, default, Projectile.Calamity().stealthStrike ? 1.8f : 1.3f); Main.dust[dusty].velocity *= 2f; } } @@ -213,7 +213,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int i = 0; i < 4; i++) { - int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 100, default, 2f); Main.dust[dust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -223,10 +223,10 @@ namespace CalamityMod.Projectiles.Rogue } for (int j = 0; j < 12; j++) { - int dusty = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 3f); + int dusty = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 100, default, 3f); Main.dust[dusty].noGravity = true; Main.dust[dusty].velocity *= 5f; - dusty = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); + dusty = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 100, default, 2f); Main.dust[dusty].velocity *= 2f; } diff --git a/Projectiles/Rogue/ShinobiBladeProjectile.cs b/Projectiles/Rogue/ShinobiBladeProjectile.cs index 85cde0fe24..2b457f6bdb 100644 --- a/Projectiles/Rogue/ShinobiBladeProjectile.cs +++ b/Projectiles/Rogue/ShinobiBladeProjectile.cs @@ -1,3 +1,4 @@ +using CalamityMod.Balancing; using CalamityMod.Projectiles.Healing; using Microsoft.Xna.Framework; using Terraria; @@ -34,7 +35,7 @@ namespace CalamityMod.Projectiles.Rogue if (Main.rand.NextBool(5)) { - int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 15); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.MagicMirror); Main.dust[dust].noGravity = true; } } @@ -46,28 +47,28 @@ namespace CalamityMod.Projectiles.Rogue } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { + { NPC firstTarget = Main.npc[(int)Projectile.ai[0]]; - + // 7 hits total if (Projectile.Calamity().stealthStrike && Projectile.ai[1] <= 7f && (Projectile.ai[1] == 0f || firstTarget != null)) - { - Vector2 targetPos = Projectile.ai[1] == 0f ? target.Center : firstTarget.Center; - Vector2 offset = Vector2.UnitX.RotatedByRandom(MathHelper.TwoPi) * Main.rand.NextFloat(80f, 120f); + { + Vector2 targetPos = Projectile.ai[1] == 0f ? target.Center : firstTarget.Center; + Vector2 offset = Vector2.UnitX.RotatedByRandom(MathHelper.TwoPi) * Main.rand.NextFloat(80f, 120f); Vector2 eVelocity = Vector2.UnitX.RotatedBy(offset.ToRotation() + MathHelper.Pi) * 4f; int realTarget = Projectile.ai[1] == 0f ? target.whoAmI : firstTarget.whoAmI; - Projectile echo = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), targetPos + offset, eVelocity, Projectile.type, Projectile.damage, Projectile.knockBack, Projectile.owner, realTarget, Projectile.ai[1] + 1); - echo.Calamity().stealthStrike = true; - } + Projectile echo = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), targetPos + offset, eVelocity, Projectile.type, Projectile.damage, Projectile.knockBack, Projectile.owner, realTarget, Projectile.ai[1] + 1); + echo.Calamity().stealthStrike = true; + } - if (target.life <= 0) - CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], 10, ModContent.ProjectileType(), 1200f, 0f); + if (target.life <= 0 && target.lifeMax > 5) + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], 10, ModContent.ProjectileType(), BalancingConstants.LifeStealRange, 0f); } public override void OnHitPlayer(Player target, Player.HurtInfo info) { if (target.statLife <= 0) - CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], 10, ModContent.ProjectileType(), 1200f, 0f); + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], 10, ModContent.ProjectileType(), BalancingConstants.LifeStealRange, 0f); } public override void OnKill(int timeLeft) diff --git a/Projectiles/Rogue/ShockGrenadeBolt.cs b/Projectiles/Rogue/ShockGrenadeBolt.cs index 6433576e54..e9b685a881 100644 --- a/Projectiles/Rogue/ShockGrenadeBolt.cs +++ b/Projectiles/Rogue/ShockGrenadeBolt.cs @@ -1,10 +1,10 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -28,6 +28,8 @@ namespace CalamityMod.Projectiles.Rogue Projectile.penetrate = 3; Projectile.timeLeft = 120; Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() @@ -43,7 +45,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.frame = 0; } - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; if (Projectile.timeLeft < 55) { diff --git a/Projectiles/Rogue/ShockGrenadeExplosion.cs b/Projectiles/Rogue/ShockGrenadeExplosion.cs index 00499c003c..0c39e224ee 100644 --- a/Projectiles/Rogue/ShockGrenadeExplosion.cs +++ b/Projectiles/Rogue/ShockGrenadeExplosion.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Projectiles/Rogue/ShockGrenadeProjectile.cs b/Projectiles/Rogue/ShockGrenadeProjectile.cs index 895e901126..16ec5fcfd3 100644 --- a/Projectiles/Rogue/ShockGrenadeProjectile.cs +++ b/Projectiles/Rogue/ShockGrenadeProjectile.cs @@ -1,9 +1,9 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -71,7 +71,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } diff --git a/Projectiles/Rogue/ShockTeslaAura.cs b/Projectiles/Rogue/ShockTeslaAura.cs index 17d693ca9f..edb5baa131 100644 --- a/Projectiles/Rogue/ShockTeslaAura.cs +++ b/Projectiles/Rogue/ShockTeslaAura.cs @@ -52,7 +52,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D sprite = ModContent.Request(Texture).Value; + Texture2D sprite = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Color drawColour = Color.White; Rectangle sourceRect = new Rectangle(Projectile.width * (int)Projectile.localAI[1], Projectile.height * (int)Projectile.localAI[0], Projectile.width, Projectile.height); diff --git a/Projectiles/Rogue/ShroomerangSpore.cs b/Projectiles/Rogue/ShroomerangSpore.cs index d60932129d..eb99c20e8e 100644 --- a/Projectiles/Rogue/ShroomerangSpore.cs +++ b/Projectiles/Rogue/ShroomerangSpore.cs @@ -1,6 +1,7 @@ -using CalamityMod.Projectiles.BaseProjectiles; +using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue @@ -45,7 +46,7 @@ namespace CalamityMod.Projectiles.Rogue Vector2 rotate = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; rotate = rotate.RotatedBy((double)((float)(i - (constant / 2 - 1)) * 6.28318548f / (float)constant), default) + Projectile.Center; Vector2 facingDirection = rotate - Projectile.Center; - int dust = Dust.NewDust(rotate + facingDirection, 0, 0, 56, facingDirection.X, facingDirection.Y, 100, default, 0.5f); + int dust = Dust.NewDust(rotate + facingDirection, 0, 0, DustID.BlueFairy, facingDirection.X, facingDirection.Y, 100, default, 0.5f); Main.dust[dust].noGravity = true; Main.dust[dust].noLight = true; Main.dust[dust].velocity = facingDirection; diff --git a/Projectiles/Rogue/SkyBomberGas.cs b/Projectiles/Rogue/SkyBomberGas.cs index 51fbf6d734..34045975de 100644 --- a/Projectiles/Rogue/SkyBomberGas.cs +++ b/Projectiles/Rogue/SkyBomberGas.cs @@ -1,7 +1,7 @@ +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Dusts; using Terraria; using Terraria.ModLoader; -using CalamityMod.Dusts; -using CalamityMod.Buffs.StatDebuffs; namespace CalamityMod.Projectiles.Rogue { @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Rogue { for (int i = 0; i < 8; i++) { - Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.SulfurousSeaAcid); + Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.SulphurousSeaAcid); } } } diff --git a/Projectiles/Rogue/SkyStabberProj.cs b/Projectiles/Rogue/SkyStabberProj.cs index 88e76ee31b..c9cab426cb 100644 --- a/Projectiles/Rogue/SkyStabberProj.cs +++ b/Projectiles/Rogue/SkyStabberProj.cs @@ -1,8 +1,8 @@ -using Terraria; -using Microsoft.Xna.Framework; -using Terraria.ModLoader; +using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Typeless; -using CalamityMod.CalPlayer; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { @@ -11,8 +11,6 @@ namespace CalamityMod.Projectiles.Rogue public new string LocalizationCategory => "Projectiles.Rogue"; public override string Texture => "CalamityMod/Items/Weapons/Rogue/SkyStabber"; - private static int Lifetime = 1200; - public override void SetDefaults() { Projectile.width = 15; @@ -20,8 +18,8 @@ namespace CalamityMod.Projectiles.Rogue Projectile.friendly = true; Projectile.DamageType = RogueDamageClass.Instance; Projectile.tileCollide = true; - Projectile.penetrate = 20; - Projectile.timeLeft = Lifetime; + Projectile.penetrate = 10; + Projectile.timeLeft = 1000; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 30; diff --git a/Projectiles/Rogue/SkyfinNuke.cs b/Projectiles/Rogue/SkyfinNuke.cs index c9f3e337de..bc464c0284 100644 --- a/Projectiles/Rogue/SkyfinNuke.cs +++ b/Projectiles/Rogue/SkyfinNuke.cs @@ -2,9 +2,9 @@ using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -65,10 +65,10 @@ namespace CalamityMod.Projectiles.Rogue { Projectile.extraUpdates = 0; //Dust - for (int i = 0; i < 30;i++) + for (int i = 0; i < 30; i++) { Vector2 dspeed = new Vector2(Main.rand.NextFloat(-4f, 4f), Main.rand.NextFloat(-4f, 4f)); - Dust.NewDust(Projectile.Center, 1, 1, (int)CalamityDusts.SulfurousSeaAcid, dspeed.X, dspeed.Y, 0, default, 1.1f); + Dust.NewDust(Projectile.Center, 1, 1, (int)CalamityDusts.SulphurousSeaAcid, dspeed.X, dspeed.Y, 0, default, 1.1f); } Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 10; @@ -86,6 +86,7 @@ namespace CalamityMod.Projectiles.Rogue { int explode = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.4), Projectile.knockBack * 0.4f, Projectile.owner, 1f); Main.projectile[explode].usesLocalNPCImmunity = true; + Main.projectile[explode].usesIDStaticNPCImmunity = false; Main.projectile[explode].localNPCHitCooldown = 30; } } diff --git a/Projectiles/Rogue/SlickCaneProjectile.cs b/Projectiles/Rogue/SlickCaneProjectile.cs index 185c06913a..4c1acff6de 100644 --- a/Projectiles/Rogue/SlickCaneProjectile.cs +++ b/Projectiles/Rogue/SlickCaneProjectile.cs @@ -1,8 +1,8 @@ -using CalamityMod.Items.Weapons.Rogue; +using System; +using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ID; using Terraria.Localization; @@ -50,7 +50,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { Vector2 drawPosition = Projectile.position + new Vector2(Projectile.width, Projectile.height) / 2f + Vector2.UnitY * Projectile.gfxOffY - Main.screenPosition; - Texture2D alternateHookTexture = Projectile.spriteDirection == -1 ? ModContent.Request("CalamityMod/Projectiles/Rogue/SlickCaneProjectileAlt").Value : ModContent.Request(Texture).Value; + Texture2D alternateHookTexture = Projectile.spriteDirection == -1 ? ModContent.Request("CalamityMod/Projectiles/Rogue/SlickCaneProjectileAlt").Value : Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Vector2 origin = new Vector2(Projectile.spriteDirection == 1 ? alternateHookTexture.Width + 8f : -8f, -8f); Main.EntitySpriteDraw(alternateHookTexture, drawPosition, null, lightColor, Projectile.rotation, @@ -88,11 +88,11 @@ namespace CalamityMod.Projectiles.Rogue while (moneyValueToDrop > 10000f) { int modifiedMoneyValue = (int)(moneyValueToDrop / 10000f); - if (modifiedMoneyValue > 50 && Main.rand.Next(5) == 0) + if (modifiedMoneyValue > 50 && Main.rand.NextBool(5)) { modifiedMoneyValue /= Main.rand.Next(3) + 1; } - if (Main.rand.Next(5) == 0) + if (Main.rand.NextBool(5)) { modifiedMoneyValue /= Main.rand.Next(3) + 1; } @@ -102,11 +102,11 @@ namespace CalamityMod.Projectiles.Rogue while (moneyValueToDrop > 100f) { int modifiedMoneyValue = (int)(moneyValueToDrop / 100f); - if (modifiedMoneyValue > 50 && Main.rand.Next(5) == 0) + if (modifiedMoneyValue > 50 && Main.rand.NextBool(5)) { modifiedMoneyValue /= Main.rand.Next(3) + 1; } - if (Main.rand.Next(5) == 0) + if (Main.rand.NextBool(5)) { modifiedMoneyValue /= Main.rand.Next(3) + 1; } @@ -116,11 +116,11 @@ namespace CalamityMod.Projectiles.Rogue while (moneyValueToDrop > 0f) { int modifiedMoneyValue = (int)moneyValueToDrop; - if (modifiedMoneyValue > 50 && Main.rand.Next(5) == 0) + if (modifiedMoneyValue > 50 && Main.rand.NextBool(5)) { modifiedMoneyValue /= Main.rand.Next(3) + 1; } - if (Main.rand.Next(5) == 0) + if (Main.rand.NextBool(5)) { modifiedMoneyValue /= Main.rand.Next(4) + 1; } diff --git a/Projectiles/Rogue/SludgeSplotchProj1.cs b/Projectiles/Rogue/SludgeSplotchProj1.cs index 0c092943dc..baefc1c52e 100644 --- a/Projectiles/Rogue/SludgeSplotchProj1.cs +++ b/Projectiles/Rogue/SludgeSplotchProj1.cs @@ -1,8 +1,8 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { diff --git a/Projectiles/Rogue/SludgeSplotchProj2.cs b/Projectiles/Rogue/SludgeSplotchProj2.cs index 012ba755e6..db7798497c 100644 --- a/Projectiles/Rogue/SludgeSplotchProj2.cs +++ b/Projectiles/Rogue/SludgeSplotchProj2.cs @@ -1,9 +1,9 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -32,7 +32,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); - int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 191, 0f, 0f, 225, new Color(255, 255, 255), 2); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.SpookyWood, 0f, 0f, 225, new Color(255, 255, 255), 2); Main.dust[dust].noGravity = true; Main.dust[dust].noLight = true; Main.dust[dust].velocity = Main.dust[dust].velocity * 0.25f; @@ -49,7 +49,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } diff --git a/Projectiles/Rogue/SnapClamProj.cs b/Projectiles/Rogue/SnapClamProj.cs index 237511ddad..f9dfd6d0da 100644 --- a/Projectiles/Rogue/SnapClamProj.cs +++ b/Projectiles/Rogue/SnapClamProj.cs @@ -1,9 +1,9 @@ -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { public class SnapClamProj : ModProjectile, ILocalizedModType @@ -82,7 +82,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int i = 0; i < 20; i++) { - int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 14, 0f, 0f, 0, new Color(115, 124, 124), 1f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Demonite, 0f, 0f, 0, new Color(115, 124, 124), 1f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 2f; } diff --git a/Projectiles/Rogue/SnapClamStealth.cs b/Projectiles/Rogue/SnapClamStealth.cs index e7c64a5ca1..7e8c16117d 100644 --- a/Projectiles/Rogue/SnapClamStealth.cs +++ b/Projectiles/Rogue/SnapClamStealth.cs @@ -1,9 +1,9 @@ -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { public class SnapClamStealth : ModProjectile, ILocalizedModType @@ -84,7 +84,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int i = 0; i < 20; i++) { - int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 14, 0f, 0f, 0, new Color(115, 124, 124), 1f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Demonite, 0f, 0f, 0, new Color(115, 124, 124), 1f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 2f; } diff --git a/Projectiles/Rogue/SpearofDestinyProjectile.cs b/Projectiles/Rogue/SpearofDestinyProjectile.cs index ff055dbf9b..27f75dbf83 100644 --- a/Projectiles/Rogue/SpearofDestinyProjectile.cs +++ b/Projectiles/Rogue/SpearofDestinyProjectile.cs @@ -92,7 +92,7 @@ namespace CalamityMod.Projectiles.Rogue { for (int i = 0; i <= 2; i++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 133, Projectile.oldVelocity.X * Main.rand.NextFloat(1.1f, 1.3f), Projectile.oldVelocity.Y * Main.rand.NextFloat(1.1f, 1.3f)); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Firework_Yellow, Projectile.oldVelocity.X * Main.rand.NextFloat(1.1f, 1.3f), Projectile.oldVelocity.Y * Main.rand.NextFloat(1.1f, 1.3f)); } } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) @@ -108,7 +108,7 @@ namespace CalamityMod.Projectiles.Rogue } public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; int frameHeight = texture.Height / Main.projFrames[Projectile.type]; int frameY = frameHeight * Projectile.frame; diff --git a/Projectiles/Rogue/SpearofDestinyStealth.cs b/Projectiles/Rogue/SpearofDestinyStealth.cs index e0a45320eb..9e68d646a7 100644 --- a/Projectiles/Rogue/SpearofDestinyStealth.cs +++ b/Projectiles/Rogue/SpearofDestinyStealth.cs @@ -1,11 +1,11 @@ -using CalamityMod.Particles; +using System; +using System.Reflection.Metadata; +using CalamityMod.Particles; using CalamityMod.Projectiles.Melee; using CalamityMod.Projectiles.Pets; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Mono.Cecil; -using System; -using System.Reflection.Metadata; using Terraria; using Terraria.Audio; using Terraria.Graphics.Shaders; @@ -16,7 +16,7 @@ namespace CalamityMod.Projectiles.Rogue { public class SpearofDestinyStealth : ModProjectile, ILocalizedModType { - public static readonly SoundStyle Hitsound = new("CalamityMod/Sounds/Item/BlazingCoreParry") { Volume = 0.7f, PitchVariance = 0.3f}; + public static readonly SoundStyle Hitsound = new("CalamityMod/Sounds/Item/BlazingCoreParry") { Volume = 0.7f, PitchVariance = 0.3f }; public new string LocalizationCategory => "Projectiles.Rogue"; public override string Texture => "CalamityMod/Projectiles/Rogue/LanceofDestiny"; public bool posthit = false; @@ -74,12 +74,12 @@ namespace CalamityMod.Projectiles.Rogue float rot = MathHelper.ToRadians(i * rotFactor); Vector2 offset = new Vector2(18f, 0).RotatedBy(rot); Vector2 velOffset = new Vector2(9f, 0).RotatedBy(rot); - SparkParticle spark = new SparkParticle(Projectile.position + offset, new Vector2(velOffset.X, velOffset.Y) * Main.rand.NextFloat( 1.5f, 2.3f), false, Main.rand.Next(23, 28), 1.9f, Main.rand.NextBool(5) ? Color.Gold : Color.PaleGoldenrod); + SparkParticle spark = new SparkParticle(Projectile.position + offset, new Vector2(velOffset.X, velOffset.Y) * Main.rand.NextFloat(1.5f, 2.3f), false, Main.rand.Next(23, 28), 1.9f, Main.rand.NextBool(5) ? Color.Gold : Color.PaleGoldenrod); GeneralParticleHandler.SpawnParticle(spark); } for (int i = 0; i <= 17; i++) { - Dust dust2 = Main.dust[Dust.NewDust(target.position, Projectile.width, Projectile.height, 130, 0, 0, 0, default, 1.5f)]; + Dust dust2 = Main.dust[Dust.NewDust(target.position, Projectile.width, Projectile.height, DustID.Firework_Red, 0, 0, 0, default, 1.5f)]; dust2.velocity.Y -= Main.rand.NextFloat(2.5f, 10.5f); dust2.velocity.X += Main.rand.NextFloat(-3f, 3f); } @@ -87,7 +87,7 @@ namespace CalamityMod.Projectiles.Rogue } public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; int frameHeight = texture.Height / Main.projFrames[Projectile.type]; int frameY = frameHeight * Projectile.frame; diff --git a/Projectiles/Rogue/SpearofPaleolithProj.cs b/Projectiles/Rogue/SpearofPaleolithProj.cs index 7e26b74b7f..d8ba7f1c6a 100644 --- a/Projectiles/Rogue/SpearofPaleolithProj.cs +++ b/Projectiles/Rogue/SpearofPaleolithProj.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.Rogue if (Main.rand.NextBool(4)) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 159, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Teleporter, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.ToRadians(45f); if (Projectile.timeLeft % 3 == 0) @@ -65,7 +65,7 @@ namespace CalamityMod.Projectiles.Rogue { for (int i = 0; i <= 10; i++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 159, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Teleporter, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } diff --git a/Projectiles/Rogue/SpentFuelContainerProjectile.cs b/Projectiles/Rogue/SpentFuelContainerProjectile.cs index dc6e8d35a2..b1f3821328 100644 --- a/Projectiles/Rogue/SpentFuelContainerProjectile.cs +++ b/Projectiles/Rogue/SpentFuelContainerProjectile.cs @@ -1,10 +1,10 @@ using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; using Terraria.WorldBuilding; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -19,37 +19,27 @@ namespace CalamityMod.Projectiles.Rogue Projectile.height = 34; Projectile.friendly = true; Projectile.penetrate = 1; + Projectile.aiStyle = ProjAIStyleID.ThrownProjectile; Projectile.timeLeft = 200; Projectile.tileCollide = true; Projectile.alpha = 0; + AIType = ProjectileID.ThrowingKnife; Projectile.DamageType = RogueDamageClass.Instance; } - public override void AI() - { - Projectile.ai[0] += 1f; //arbitrary timer - if (Projectile.ai[0] > 75f) - { - if (Projectile.velocity.Y < 10f) - { - Projectile.velocity.Y += 0.15f; - } - } - Projectile.rotation += MathHelper.ToRadians(Projectile.velocity.Length()); - } public override void OnKill(int timeLeft) { //Dust for (int i = 0; i < 30; i++) { Vector2 dspeed = new Vector2(Main.rand.NextFloat(-4f, 4f), Main.rand.NextFloat(-4f, 4f)); - Dust.NewDust(Projectile.Center, 1, 1, (int)CalamityDusts.SulfurousSeaAcid, dspeed.X, dspeed.Y, 0, default, 1.1f); + Dust.NewDust(Projectile.Center, 1, 1, (int)CalamityDusts.SulphurousSeaAcid, dspeed.X, dspeed.Y, 0, default, 1.1f); } SoundEngine.PlaySound(SoundID.Item107, Projectile.Bottom); Point result; if (WorldUtils.Find(Projectile.Top.ToTileCoordinates(), Searches.Chain((GenSearch)new Searches.Down(80), (GenCondition)new Conditions.IsSolid()), out result)) { - int proj = Projectile.NewProjectile(Projectile.GetSource_FromThis(), result.ToVector2() * 16f, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, 2f, Projectile.owner); + int proj = Projectile.NewProjectile(Projectile.GetSource_FromThis(), result.ToVector2() * 16f, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * .5f), 2f, Projectile.owner); if (proj.WithinBounds(Main.maxProjectiles)) Main.projectile[proj].Calamity().stealthStrike = Projectile.Calamity().stealthStrike; } diff --git a/Projectiles/Rogue/SphereBladed.cs b/Projectiles/Rogue/SphereBladed.cs index 586c82452a..ba66d6bdc2 100644 --- a/Projectiles/Rogue/SphereBladed.cs +++ b/Projectiles/Rogue/SphereBladed.cs @@ -1,9 +1,9 @@ +using System; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { public class SphereBladed : ModProjectile, ILocalizedModType @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.extraUpdates = 1; Projectile.DamageType = RogueDamageClass.Instance; Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 10; + Projectile.idStaticNPCHitCooldown = 15; Projectile.timeLeft = 300; Projectile.tileCollide = false; } @@ -36,7 +36,7 @@ namespace CalamityMod.Projectiles.Rogue Lighting.AddLight(Projectile.Center, 1f, 0f, 0f); if (Main.rand.NextBool(5)) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 229, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 100); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Vortex, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 100); } if (Projectile.soundDelay == 0) { @@ -46,7 +46,7 @@ namespace CalamityMod.Projectiles.Rogue if (Projectile.ai[0] == 0f) { Projectile.ai[1] += 1f; - if (Projectile.ai[1] >= 25f) + if (Projectile.ai[1] >= 30f) { Projectile.ai[0] = 1f; Projectile.ai[1] = 0f; @@ -56,7 +56,7 @@ namespace CalamityMod.Projectiles.Rogue else { float acceleration = 3.2f; - Vector2 vector2 = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); + Vector2 vector2 = Projectile.Center; float xdistance = Main.player[Projectile.owner].position.X + (float)(Main.player[Projectile.owner].width / 2) - vector2.X; float ydistance = Main.player[Projectile.owner].position.Y + (float)(Main.player[Projectile.owner].height / 2) - vector2.Y; float totalDist = (float)Math.Sqrt((double)(xdistance * xdistance + ydistance * ydistance)); diff --git a/Projectiles/Rogue/SphereBlue.cs b/Projectiles/Rogue/SphereBlue.cs index d2b3baab45..ebc771fa14 100644 --- a/Projectiles/Rogue/SphereBlue.cs +++ b/Projectiles/Rogue/SphereBlue.cs @@ -1,8 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { public class SphereBlue : ModProjectile, ILocalizedModType @@ -32,7 +32,7 @@ namespace CalamityMod.Projectiles.Rogue Lighting.AddLight(Projectile.Center, 0f, 0f, 1f); if (Main.rand.NextBool(5)) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 229, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 100); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Vortex, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 100); } Projectile.ai[0] += 1f; if (Projectile.ai[0] >= 5f) @@ -55,6 +55,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.penetrate = -1; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 10; + Projectile.damage /= 2; Projectile.Damage(); SoundEngine.PlaySound(SoundID.NPCDeath37, Projectile.position); if (Main.netMode != NetmodeID.Server) @@ -82,7 +83,7 @@ namespace CalamityMod.Projectiles.Rogue 226, 229 }); - int dusty = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 1f); + int dusty = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 1f); Main.dust[dusty].noGravity = true; Main.dust[dusty].velocity *= 0f; } diff --git a/Projectiles/Rogue/SphereSpiked.cs b/Projectiles/Rogue/SphereSpiked.cs index a93b6d0875..443ccef165 100644 --- a/Projectiles/Rogue/SphereSpiked.cs +++ b/Projectiles/Rogue/SphereSpiked.cs @@ -1,8 +1,8 @@ -using Terraria; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Microsoft.Xna.Framework; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { public class SphereSpiked : ModProjectile, ILocalizedModType @@ -34,7 +34,7 @@ namespace CalamityMod.Projectiles.Rogue Lighting.AddLight(Projectile.Center, 1f, 0f, 0f); if (Main.rand.NextBool(5)) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 229, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 100); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Vortex, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 100); } if (Projectile.ai[0] == 1f) { @@ -45,12 +45,10 @@ namespace CalamityMod.Projectiles.Rogue public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { modifiers.SourceDamage *= 1.2f; - if (Main.rand.NextBool(10)) - modifiers.SetCrit(); } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { + { SoundEngine.PlaySound(SoundID.NPCHit34, Projectile.position); } diff --git a/Projectiles/Rogue/SphereYellow.cs b/Projectiles/Rogue/SphereYellow.cs index 73b0356cc7..77c6e434de 100644 --- a/Projectiles/Rogue/SphereYellow.cs +++ b/Projectiles/Rogue/SphereYellow.cs @@ -1,8 +1,8 @@ -using Terraria; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Microsoft.Xna.Framework; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { public class SphereYellow : ModProjectile, ILocalizedModType @@ -32,7 +32,7 @@ namespace CalamityMod.Projectiles.Rogue Lighting.AddLight(Projectile.Center, 1f, 1f, 0f); if (Main.rand.NextBool(5)) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 229, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 100); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Vortex, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 100); } if (Projectile.ai[0] == 1f) { diff --git a/Projectiles/Rogue/StealthNimbus.cs b/Projectiles/Rogue/StealthNimbus.cs index 1674c2f1f2..54881e760a 100644 --- a/Projectiles/Rogue/StealthNimbus.cs +++ b/Projectiles/Rogue/StealthNimbus.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; if (Projectile.ai[0] == 1f) texture = ModContent.Request("CalamityMod/Projectiles/Rogue/StealthNimbus2").Value; int height = texture.Height / Main.projFrames[Projectile.type]; diff --git a/Projectiles/Rogue/StealthNimbusCloud.cs b/Projectiles/Rogue/StealthNimbusCloud.cs index dfca4dca34..d1e3eab024 100644 --- a/Projectiles/Rogue/StealthNimbusCloud.cs +++ b/Projectiles/Rogue/StealthNimbusCloud.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; if (Projectile.ai[0] == 1f) texture = ModContent.Request("CalamityMod/Projectiles/Rogue/StealthNimbusCloud2").Value; int height = texture.Height / Main.projFrames[Projectile.type]; diff --git a/Projectiles/Rogue/StellarKnifeProj.cs b/Projectiles/Rogue/StellarKnifeProj.cs index e9a8c194d0..62c1b8abf3 100644 --- a/Projectiles/Rogue/StellarKnifeProj.cs +++ b/Projectiles/Rogue/StellarKnifeProj.cs @@ -1,7 +1,7 @@ +using System.IO; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using Microsoft.Xna.Framework; -using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Projectiles/Rogue/StickyBol.cs b/Projectiles/Rogue/StickyBol.cs index b8387d8c92..bfa90c3367 100644 --- a/Projectiles/Rogue/StickyBol.cs +++ b/Projectiles/Rogue/StickyBol.cs @@ -1,5 +1,5 @@ +using System; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -29,7 +29,7 @@ namespace CalamityMod.Projectiles.Rogue Color color = new Color(0, 80, 255, 100); if (Main.rand.NextBool(12)) { - Dust.NewDust(Projectile.position + Vector2.One * 6f, Projectile.width - 12, Projectile.height - 12, 4, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 175, color, 1.2f); + Dust.NewDust(Projectile.position + Vector2.One * 6f, Projectile.width - 12, Projectile.height - 12, DustID.TintableDust, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 175, color, 1.2f); } //Sticky Behaviour Projectile.StickyProjAI(10); diff --git a/Projectiles/Rogue/StormfrontLightning.cs b/Projectiles/Rogue/StormfrontLightning.cs index 6c1b3236d3..4325f21435 100644 --- a/Projectiles/Rogue/StormfrontLightning.cs +++ b/Projectiles/Rogue/StormfrontLightning.cs @@ -1,13 +1,13 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Graphics.Primitives; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Projectiles.Rogue; using CalamityMod.Sounds; using Microsoft.Xna.Framework; -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; using Terraria; using Terraria.Audio; using Terraria.Graphics.Shaders; diff --git a/Projectiles/Rogue/StormfrontRazorProjectile.cs b/Projectiles/Rogue/StormfrontRazorProjectile.cs index 61c85c48da..ccd38d4eef 100644 --- a/Projectiles/Rogue/StormfrontRazorProjectile.cs +++ b/Projectiles/Rogue/StormfrontRazorProjectile.cs @@ -1,9 +1,9 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Items.Weapons.Rogue; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using CalamityMod.Items.Weapons.Rogue; using Terraria.Utilities; namespace CalamityMod.Projectiles.Rogue @@ -36,7 +36,7 @@ namespace CalamityMod.Projectiles.Rogue { if (Main.rand.NextBool(10)) { - int d = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, 226, 0f, 0f, 100, new Color(Main.rand.Next(20, 100), 204, 250), 1f); + int d = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, DustID.Electric, 0f, 0f, 100, new Color(Main.rand.Next(20, 100), 204, 250), 1f); Main.dust[d].scale += (float)Main.rand.Next(50) * 0.01f; Main.dust[d].noGravity = true; Main.dust[d].position = Projectile.Center; @@ -57,7 +57,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); Projectile.rotation += Projectile.spriteDirection * MathHelper.ToRadians(45f); - + } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) @@ -65,7 +65,7 @@ namespace CalamityMod.Projectiles.Rogue target.AddBuff(BuffID.Electrified, 45); if (Main.rand.NextBool(10)) { - int d = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, 226, 0f, 0f, 100, new Color(Main.rand.Next(20, 100), 204, 250), 1f); + int d = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, DustID.Electric, 0f, 0f, 100, new Color(Main.rand.Next(20, 100), 204, 250), 1f); Main.dust[d].scale += (float)Main.rand.Next(50) * 0.01f; Main.dust[d].noGravity = true; Main.dust[d].position = Projectile.Center; @@ -97,7 +97,7 @@ namespace CalamityMod.Projectiles.Rogue target.AddBuff(BuffID.Electrified, 45); if (Main.rand.NextBool(10)) { - int d = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, 226, 0f, 0f, 100, new Color(Main.rand.Next(20, 100), 204, 250), 1f); + int d = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, DustID.Electric, 0f, 0f, 100, new Color(Main.rand.Next(20, 100), 204, 250), 1f); Main.dust[d].scale += (float)Main.rand.Next(50) * 0.01f; Main.dust[d].noGravity = true; Main.dust[d].position = Projectile.Center; @@ -128,7 +128,7 @@ namespace CalamityMod.Projectiles.Rogue { if (Main.rand.NextBool(10)) { - int d = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, 226, 0f, 0f, 100, new Color(Main.rand.Next(20,100), 204, 250), 1f); + int d = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, DustID.Electric, 0f, 0f, 100, new Color(Main.rand.Next(20, 100), 204, 250), 1f); Main.dust[d].scale += (float)Main.rand.Next(50) * 0.01f; Main.dust[d].noGravity = true; Main.dust[d].position = Projectile.Center; diff --git a/Projectiles/Rogue/Stormfrontspark.cs b/Projectiles/Rogue/Stormfrontspark.cs index 7ff2737dba..cfe40b7287 100644 --- a/Projectiles/Rogue/Stormfrontspark.cs +++ b/Projectiles/Rogue/Stormfrontspark.cs @@ -1,6 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Rogue { public class Stormfrontspark : ModProjectile, ILocalizedModType @@ -21,7 +23,7 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { Projectile.rotation += Projectile.velocity.X * 0.1f; - int dusty = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 226, 0f, 0f, 100, new Color(Main.rand.Next(20, 100), 204, 250), 1f); + int dusty = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Electric, 0f, 0f, 100, new Color(Main.rand.Next(20, 100), 204, 250), 1f); Dust dust = Main.dust[dusty]; dust.position.X -= 1f; dust.position.Y -= 1f; @@ -30,7 +32,7 @@ namespace CalamityMod.Projectiles.Rogue dust.velocity.Y += 1f; if (Main.rand.NextBool()) { - int dusty2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 226, 0f, 0f, 100, new Color(Main.rand.Next(20, 100), 204, 250), 1f); + int dusty2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Electric, 0f, 0f, 100, new Color(Main.rand.Next(20, 100), 204, 250), 1f); Dust dust2 = Main.dust[dusty2]; dust2.position.X += 1f; dust2.position.Y -= 1f; diff --git a/Projectiles/Rogue/SubductionFlameburst.cs b/Projectiles/Rogue/SubductionFlameburst.cs index f079f74046..bbcb328bf8 100644 --- a/Projectiles/Rogue/SubductionFlameburst.cs +++ b/Projectiles/Rogue/SubductionFlameburst.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.alpha = 255; Projectile.DamageType = RogueDamageClass.Instance; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; + Projectile.localNPCHitCooldown = 15; } public override void AI() @@ -51,7 +51,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Rectangle frame = new Rectangle(frameX * Projectile.width, frameY * Projectile.height, Projectile.width, Projectile.height); Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, frame, Color.White, Projectile.rotation, Projectile.Size / 2, 1f, SpriteEffects.None, 0); return false; @@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(BuffID.OnFire3, 240); - target.AddBuff(BuffID.Daybreak, 420); + target.AddBuff(BuffID.Daybreak, 240); } public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(BuffID.OnFire3, 300); diff --git a/Projectiles/Rogue/SubductionSlicerProj.cs b/Projectiles/Rogue/SubductionSlicerProj.cs index db21d0ec09..e1a0b88425 100644 --- a/Projectiles/Rogue/SubductionSlicerProj.cs +++ b/Projectiles/Rogue/SubductionSlicerProj.cs @@ -19,13 +19,15 @@ namespace CalamityMod.Projectiles.Rogue Projectile.height = 30; Projectile.friendly = true; Projectile.ignoreWater = true; - Projectile.penetrate = -1; + Projectile.penetrate = 5; Projectile.aiStyle = ProjAIStyleID.Boomerang; Projectile.extraUpdates = 1; - Projectile.timeLeft = 600; + Projectile.timeLeft = 360; Projectile.alpha = 55; AIType = ProjectileID.WoodenBoomerang; Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 15; } public override void AI() @@ -45,14 +47,13 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.immune[Projectile.owner] = 6; target.AddBuff(BuffID.OnFire3, 240); OnHitEffects(target.Center); } @@ -67,17 +68,14 @@ namespace CalamityMod.Projectiles.Rogue { if (Projectile.owner == Main.myPlayer) { - int proj = Projectile.NewProjectile(Projectile.GetSource_FromThis(), position, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); + int proj = Projectile.NewProjectile(Projectile.GetSource_FromThis(), position, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.8f), Projectile.knockBack, Projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); if (proj.WithinBounds(Main.maxProjectiles)) Main.projectile[proj].DamageType = RogueDamageClass.Instance; if (Projectile.Calamity().stealthStrike && Projectile.localAI[0] <= 0f) { - Point result; - if (WorldUtils.Find(Projectile.Top.ToTileCoordinates(), Searches.Chain((GenSearch)new Searches.Down(80), (GenCondition)new Conditions.IsSolid()), out result)) - { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), result.ToVector2() * 16f, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 1.5f), 2f, Projectile.owner, 1f); - Projectile.localAI[0] = 30f; - } + Vector2 spawnPos = new Vector2(position.X, position.Y + 30); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), spawnPos, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 1.2f), 2f, Projectile.owner, 1f); + Projectile.localAI[0] = 300f; // DO NOT. } } } diff --git a/Projectiles/Rogue/SulphuricNukesplosion.cs b/Projectiles/Rogue/SulphuricNukesplosion.cs index ecb5153b83..4631f6a1ca 100644 --- a/Projectiles/Rogue/SulphuricNukesplosion.cs +++ b/Projectiles/Rogue/SulphuricNukesplosion.cs @@ -1,10 +1,10 @@ -using CalamityMod.Buffs.StatDebuffs; +using System; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ModLoader; -using System; -using CalamityMod.Dusts; namespace CalamityMod.Projectiles.Rogue { @@ -31,7 +31,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.alpha = 255; Projectile.DamageType = RogueDamageClass.Instance; Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 11; + Projectile.idStaticNPCHitCooldown = 15; } public override bool PreAI() @@ -62,7 +62,7 @@ namespace CalamityMod.Projectiles.Rogue dustloop += Main.rand.Next(1, 3); for (int i = 0; i < dustloop; ++i) { - int dustType = (int)CalamityDusts.SulfurousSeaAcid; + int dustType = (int)CalamityDusts.SulphurousSeaAcid; float scale = Main.rand.NextFloat(0.5f, 1.5f); float randX = Main.rand.NextFloat(-30f, 30f); float randY = Main.rand.NextFloat(-30f, 30f); diff --git a/Projectiles/Rogue/SupernovaBomb.cs b/Projectiles/Rogue/SupernovaBomb.cs index 8c8905ade3..8798841e8b 100644 --- a/Projectiles/Rogue/SupernovaBomb.cs +++ b/Projectiles/Rogue/SupernovaBomb.cs @@ -1,11 +1,15 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Items.Weapons.Summon; +using CalamityMod.Particles; using Microsoft.Xna.Framework; -using System; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -13,7 +17,13 @@ namespace CalamityMod.Projectiles.Rogue { public new string LocalizationCategory => "Projectiles.Rogue"; public override string Texture => "CalamityMod/Items/Weapons/Rogue/Supernova"; - + public Color variedColor = Color.White; + public Color mainColor = Color.LawnGreen; + public Color randomColor = Color.White; + public int colorTimer = 0; + public int time = 0; + public bool homing = false; + public bool returning = false; public override void SetStaticDefaults() { ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; @@ -22,163 +32,283 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - Projectile.width = 34; - Projectile.height = 34; + Projectile.width = 106; + Projectile.height = 112; Projectile.friendly = true; - Projectile.penetrate = 1; - Projectile.timeLeft = 200; - Projectile.tileCollide = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 600; + Projectile.extraUpdates = 1; + Projectile.tileCollide = false; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; Projectile.DamageType = RogueDamageClass.Instance; } public override void AI() { - //dust and lighting - int dustType = Main.rand.NextBool() ? 107 : 234; - if (Main.rand.NextBool(4)) + randomColor = Main.rand.Next(4) switch { - dustType = 269; - } - if (Main.rand.NextBool(6)) + 0 => Color.Red, + 1 => Color.MediumTurquoise, + 2 => Color.Orange, + _ => Color.LawnGreen, + }; + if (time == 0) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, dustType, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + mainColor = randomColor; } - Lighting.AddLight(Projectile.Center, Main.DiscoR * 0.5f / 255f, Main.DiscoG * 0.5f / 255f, Main.DiscoB * 0.5f / 255f); - //velocity - Projectile.ai[0] += 1f; - if (Projectile.ai[0] > 10f) + + if (time % 20 == 0) { - Projectile.ai[0] = 10f; - if (Projectile.velocity.Y == 0f && Projectile.velocity.X != 0f) + variedColor = colorTimer switch { - Projectile.velocity.X *= 0.97f; - if (Math.Abs(Projectile.velocity.X) < 0.01f) + 0 => Color.Red, + 1 => Color.MediumTurquoise, + 2 => Color.Orange, + _ => Color.LawnGreen, + }; + colorTimer++; + if (colorTimer >= 4) + colorTimer = 0; + } + + Vector2 visualDirection = new Vector2(17, -17).RotatedBy(Projectile.rotation); + Vector2 rotatedVisualDirection = new Vector2(17, -17).RotatedByRandom(0.5).RotatedBy(Projectile.rotation); + PointParticle orb = new PointParticle(Projectile.Center + visualDirection, visualDirection * Main.rand.NextFloat(0.01f, 0.3f), false, 5, Main.rand.NextFloat(0.8f, 1f), Color.White * 0.7f * Utils.GetLerpValue(10, 45, time, true)); + GeneralParticleHandler.SpawnParticle(orb); + if (Main.rand.NextBool()) + { + GlowOrbParticle orb2 = new GlowOrbParticle(Projectile.Center + rotatedVisualDirection * 0.7f, rotatedVisualDirection * Main.rand.NextFloat(0.01f, 0.15f), false, 13, Main.rand.NextFloat(0.55f, 0.9f), randomColor * Utils.GetLerpValue(10, 45, time, true)); + GeneralParticleHandler.SpawnParticle(orb2); + + SparkParticle orb3 = new SparkParticle(Projectile.Center + rotatedVisualDirection * 0.7f, rotatedVisualDirection * Main.rand.NextFloat(0.01f, 0.5f), false, 17, Main.rand.NextFloat(0.2f, 0.6f), Color.Lerp(Color.White, randomColor, 0.5f) * Utils.GetLerpValue(10, 45, time, true)); + GeneralParticleHandler.SpawnParticle(orb3); + } + + mainColor = Color.Lerp(mainColor, variedColor, 0.07f); + + Projectile.scale = 0.4f; + + //dust and lighting + + Lighting.AddLight(Projectile.Center, Color.Lerp(Color.White, randomColor, 0.5f).ToVector3()); + + if (!homing && !returning) + Projectile.velocity *= 0.95f; + else + { + Projectile.rotation = Projectile.rotation.AngleLerp(Projectile.velocity.ToRotation() - MathHelper.PiOver4 * 3, 0.2f); + if (homing) + CalamityUtils.HomeInOnNPC(Projectile, true, 2000f, MathHelper.Clamp(5 + time * 0.1f, 10, 17), 5); + if (Main.rand.NextBool(3)) + { + SparkParticle orb3 = new SparkParticle(Projectile.Center + Main.rand.NextVector2Circular(9, 9) - Projectile.velocity.SafeNormalize(Vector2.UnitY) * 12, visualDirection * Main.rand.NextFloat(0.2f, 0.8f), false, 20, 1.5f, Color.Lerp(Color.White, randomColor, 0.5f) * Utils.GetLerpValue(100, 170, time, true)); + GeneralParticleHandler.SpawnParticle(orb3); + } + for (int i = 0; i < 2; i++) + { + Dust dust2 = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(12, 12) - Projectile.velocity.SafeNormalize(Vector2.UnitY) * 12, 303, visualDirection * Main.rand.NextFloat(0.05f, 0.7f)); + dust2.scale = Main.rand.NextFloat(0.75f, 2.25f); + dust2.noGravity = true; + dust2.color = Main.rand.NextBool() ? Color.White : Color.Lerp(Color.White, randomColor, 0.1f); + dust2.alpha = 170; + } + } + + if (time >= 60 && !homing && !returning) + { + NPC target = Projectile.Center.ClosestNPCAt(2000); + + if (target == null) + { + returning = true; + SoundStyle lockon = new("CalamityMod/Sounds/Custom/ExoMechs/ApolloArtemisTargetSelection"); + SoundEngine.PlaySound(lockon with { Pitch = -0.7f }, Projectile.Center); + return; + } + + if (time >= 60 && time < 75 && Projectile.Calamity().stealthStrike) + { + SoundStyle lockon = new("CalamityMod/Sounds/Custom/ExoMechs/ApolloArtemisTargetSelection"); + if (time == 60) { - Projectile.velocity.X = 0f; - Projectile.netUpdate = true; + SoundEngine.PlaySound(lockon with { Pitch = -0.6f }, Projectile.Center); + + Particle pulse = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White * 0.7f, "CalamityMod/Particles/BloomRing", new Vector2(1f, 1f), 0f, 0.95f, 0.2f, 10); + GeneralParticleHandler.SpawnParticle(pulse); + + Particle pulse2 = new CustomPulse(Projectile.Center, Vector2.Zero, randomColor * 0.7f, "CalamityMod/Particles/BloomRing", new Vector2(1f, 1f), 0f, 0.8f, 0.2f, 10); + GeneralParticleHandler.SpawnParticle(pulse2); + } + if (time == 67) + { + SoundEngine.PlaySound(lockon with { Pitch = -0.4f }, Projectile.Center); + + Particle pulse = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White * 0.7f, "CalamityMod/Particles/BloomRing", new Vector2(1f, 1f), 0f, 0.75f, 0.2f, 10); + GeneralParticleHandler.SpawnParticle(pulse); + + Particle pulse2 = new CustomPulse(Projectile.Center, Vector2.Zero, randomColor * 0.7f, "CalamityMod/Particles/BloomRing", new Vector2(1f, 1f), 0f, 0.6f, 0.2f, 10); + GeneralParticleHandler.SpawnParticle(pulse2); + } + if (time == 74) + { + SoundEngine.PlaySound(lockon with { Pitch = -0.1f }, Projectile.Center); + + Particle pulse = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White * 0.7f, "CalamityMod/Particles/BloomRing", new Vector2(1f, 1f), 0f, 0.65f, 0.2f, 10); + GeneralParticleHandler.SpawnParticle(pulse); + + Particle pulse2 = new CustomPulse(Projectile.Center, Vector2.Zero, randomColor * 0.7f, "CalamityMod/Particles/BloomRing", new Vector2(1f, 1f), 0f, 0.5f, 0.2f, 10); + GeneralParticleHandler.SpawnParticle(pulse2); } } - Projectile.velocity.Y += 0.2f; + if (time == 60) + { + if (!Projectile.Calamity().stealthStrike) + { + SoundStyle lockon = new("CalamityMod/Sounds/Custom/ExoMechs/ApolloArtemisTargetSelection"); + SoundEngine.PlaySound(lockon with { Pitch = -0.3f }, Projectile.Center); + + Particle pulse = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White * 0.7f, "CalamityMod/Particles/BloomRing", new Vector2(1f, 1f), 0f, 0.75f, 0.2f, 10); + GeneralParticleHandler.SpawnParticle(pulse); + + Particle pulse2 = new CustomPulse(Projectile.Center, Vector2.Zero, randomColor * 0.7f, "CalamityMod/Particles/BloomRing", new Vector2(1f, 1f), 0f, 0.6f, 0.2f, 10); + GeneralParticleHandler.SpawnParticle(pulse2); + } + } + if (time > (Projectile.Calamity().stealthStrike ? 75 : 62)) + { + Projectile.penetrate = 1; + homing = true; + Projectile.extraUpdates = 3; + } } - //rotation - Projectile.rotation += Projectile.velocity.X * 0.1f; + if (returning) + { + Projectile.penetrate = -1; + float returnSpeed = MathHelper.Clamp(3 + time * 0.15f, 7, 28); + float acceleration = 1.1f; + Player owner = Main.player[Projectile.owner]; + Vector2 playerCenter = owner.Center; + float xDist = playerCenter.X - Projectile.Center.X; + float yDist = playerCenter.Y - Projectile.Center.Y; + float dist = (float)Math.Sqrt(xDist * xDist + yDist * yDist); + dist = returnSpeed / dist; + xDist *= dist; + yDist *= dist; - //stealth strike - if (Projectile.Calamity().stealthStrike && Projectile.timeLeft % 8 == 0 && Projectile.owner == Main.myPlayer) - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.UnitY * 2f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.48), Projectile.knockBack, Projectile.owner, 0f, 0f); + if (Projectile.velocity.X < xDist) + { + Projectile.velocity.X = Projectile.velocity.X + acceleration; + if (Projectile.velocity.X < 0f && xDist > 0f) + Projectile.velocity.X += acceleration; + } + else if (Projectile.velocity.X > xDist) + { + Projectile.velocity.X = Projectile.velocity.X - acceleration; + if (Projectile.velocity.X > 0f && xDist < 0f) + Projectile.velocity.X -= acceleration; + } + if (Projectile.velocity.Y < yDist) + { + Projectile.velocity.Y = Projectile.velocity.Y + acceleration; + if (Projectile.velocity.Y < 0f && yDist > 0f) + Projectile.velocity.Y += acceleration; + } + else if (Projectile.velocity.Y > yDist) + { + Projectile.velocity.Y = Projectile.velocity.Y - acceleration; + if (Projectile.velocity.Y > 0f && yDist < 0f) + Projectile.velocity.Y -= acceleration; + } + + if (Projectile.Hitbox.Intersects(owner.Hitbox)) + { + Projectile.Kill(); + } + } + + time++; } public override void OnKill(int timeLeft) { - Projectile.position = Projectile.Center; - Projectile.width = Projectile.height = 128; - Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); - SoundEngine.PlaySound(Supernova.ExplosionSound, Projectile.Center); + if (!returning) + { + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 128; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); - //spawn projectiles - int projAmt = Main.rand.Next(3, 5); - if (Projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); - for (int i = 0; i < projAmt; i++) + //spawn explosion + if (Projectile.owner == Main.myPlayer) { - Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.6), 0f, Projectile.owner, 0f, 0f); - } - float spread = MathHelper.Pi / 3f; - double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2; - double deltaAngle = spread / 6f; - double offsetAngle; - for (int i = 0; i < 3; i++) - { - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 2f), (float)(Math.Cos(offsetAngle) * 2f), ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack, Projectile.owner, 0f, 0f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 2f), (float)(-Math.Cos(offsetAngle) * 2f), ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack, Projectile.owner, 0f, 0f); - } - } - - //dust effects - int dustType = Main.rand.NextBool() ? 107 : 234; - if (Main.rand.NextBool(4)) - { - dustType = 269; - } - for (int d = 0; d < 5; d++) - { - int exo = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); - Main.dust[exo].velocity *= 3f; - if (Main.rand.NextBool()) - { - Main.dust[exo].scale = 0.5f; - Main.dust[exo].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int d = 0; d < 9; d++) - { - int fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 3f); - Main.dust[fire].noGravity = true; - Main.dust[fire].velocity *= 5f; - fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 2f); - Main.dust[fire].velocity *= 2f; - } - - //gore cloud effects - if (Main.netMode != NetmodeID.Server) - { - Vector2 goreSource = Projectile.Center; - int goreAmt = 3; - Vector2 source = new Vector2(goreSource.X - 24f, goreSource.Y - 24f); - for (int goreIndex = 0; goreIndex < goreAmt; goreIndex++) - { - float velocityMult = 0.33f; - if (goreIndex < (goreAmt / 3)) + if (Projectile.Calamity().stealthStrike) { - velocityMult = 0.66f; + float pitchRange = Main.rand.NextFloat(-0.1f, 0.1f); + SoundEngine.PlaySound(Supernova.StealthChargeSound with { Pitch = pitchRange }, Projectile.Center); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, 0, Projectile.owner, 0f, 0f, pitchRange); } - if (goreIndex >= (2 * goreAmt / 3)) + else { - velocityMult = 1f; + SoundEngine.PlaySound(Supernova.ExplosionSound, Projectile.Center); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, 0, Projectile.owner, 0f, 0f, 0f); } - Mod mod = ModContent.GetInstance(); - int type = Main.rand.Next(61, 64); - int smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); - Gore gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X += 1f; - gore.velocity.Y += 1f; - type = Main.rand.Next(61, 64); - smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); - gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X -= 1f; - gore.velocity.Y += 1f; - type = Main.rand.Next(61, 64); - smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); - gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X += 1f; - gore.velocity.Y -= 1f; - type = Main.rand.Next(61, 64); - smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); - gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X -= 1f; - gore.velocity.Y -= 1f; + } + } + else + { + for (int i = 0; i < 15; i++) + { + randomColor = Main.rand.Next(4) switch + { + 0 => Color.Red, + 1 => Color.MediumTurquoise, + 2 => Color.Orange, + _ => Color.LawnGreen, + }; + Vector2 vel = Projectile.velocity.SafeNormalize(Vector2.UnitY) * 14 * Main.rand.NextFloat(0.05f, 1.2f); + Dust dust2 = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(20, 20), 278, vel); + dust2.scale = Main.rand.NextFloat(0.45f, 1.15f); + dust2.noGravity = true; + dust2.color = Color.Lerp(Color.White, randomColor, 0.3f); } } } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 300); + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 60); + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) // Add to regular plz + { + if (!homing) + modifiers.SourceDamage *= 0.01f; + else + modifiers.SourceDamage *= 0.05f; + + if (Projectile.damage < 1) + Projectile.damage = 1; + } public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 300); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 5, targetHitbox); public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); - return false; + Color auraColor = Projectile.GetAlpha(Color.Lerp(Color.White, randomColor, 0.3f)) * 0.25f; + for (int i = 0; i < 7; i++) + { + Texture2D centerTexture = ModContent.Request("CalamityMod/Items/Weapons/Rogue/Supernova").Value; + Vector2 rotationalDrawOffset = (MathHelper.TwoPi * i / 7f + Main.GlobalTimeWrappedHourly * 8f).ToRotationVector2(); + rotationalDrawOffset *= MathHelper.Lerp(3f, 5.25f, (float)Math.Cos(Main.GlobalTimeWrappedHourly * 4f) * 0.5f + 0.5f); + Main.EntitySpriteDraw(centerTexture, Projectile.Center - Main.screenPosition + rotationalDrawOffset, null, auraColor, Projectile.rotation, centerTexture.Size() * 0.5f, Projectile.scale * 1.1f, SpriteEffects.None, 0f); + } + + if (!homing) + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], Color.Lerp(Color.White, randomColor, 0.3f), 1); + return true; } } } diff --git a/Projectiles/Rogue/SupernovaBoom.cs b/Projectiles/Rogue/SupernovaBoom.cs index d35f92e11c..843a0c0e48 100644 --- a/Projectiles/Rogue/SupernovaBoom.cs +++ b/Projectiles/Rogue/SupernovaBoom.cs @@ -1,8 +1,15 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.CalPlayer; +using CalamityMod.NPCs.Crags; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; +using Terraria.ID; using Terraria.ModLoader; +using static Humanizer.In; + namespace CalamityMod.Projectiles.Rogue { public class SupernovaBoom : ModProjectile, ILocalizedModType @@ -12,28 +19,68 @@ namespace CalamityMod.Projectiles.Rogue public int frameY = 0; private const int horizontalFrames = 5; private const int verticalFrames = 4; - private const int frameLength = 4; - private const float radius = 204.5f; + private const int frameLength = 2; + private const float radius = 300f; + public bool damageFrame = false; + + public Color variedColor = Color.White; + public Color mainColor = Color.LawnGreen; + public Color randomColor = Color.White; + public int colorTimer = 0; + public int time = 0; + public int currentFrame = 1; + + private Player Owner => Main.player[Projectile.owner]; public override void SetDefaults() { Projectile.width = 408; Projectile.height = 410; - Projectile.scale = 2f; + Projectile.scale = 1f; Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.tileCollide = false; Projectile.DamageType = RogueDamageClass.Instance; Projectile.penetrate = -1; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = frameLength * horizontalFrames * verticalFrames / 5; + Projectile.localNPCHitCooldown = -1; } public override void AI() { + randomColor = Main.rand.Next(4) switch + { + 0 => Color.Red, + 1 => Color.MediumTurquoise, + 2 => Color.Orange, + _ => Color.LawnGreen, + }; + if (time == 0) + mainColor = randomColor; + + if (time % 20 == 0) + { + variedColor = colorTimer switch + { + 0 => Color.Red, + 1 => Color.MediumTurquoise, + 2 => Color.Orange, + _ => Color.LawnGreen, + }; + colorTimer++; + if (colorTimer >= 4) + colorTimer = 0; + } + + mainColor = Color.Lerp(mainColor, variedColor, 0.07f); + + Lighting.AddLight(Projectile.Center, mainColor.ToVector3() * 3); + Projectile.frameCounter++; if (Projectile.frameCounter % frameLength == frameLength - 1) { + currentFrame++; + frameY++; if (frameY >= verticalFrames) { @@ -45,42 +92,158 @@ namespace CalamityMod.Projectiles.Rogue Projectile.Kill(); } } + if (currentFrame == 13) + damageFrame = true; + else + damageFrame = false; - Lighting.AddLight(Projectile.Center, Main.DiscoR * 0.5f / 255f, Main.DiscoG * 0.5f / 255f, Main.DiscoB * 0.5f / 255f); - - /*float dustSpeed = (float)Main.rand.Next(12, 36); - Vector2 dustVel = CalamityUtils.RandomVelocity(40f, dustSpeed, dustSpeed, 1f); - int dustType = Utils.SelectRandom(Main.rand, new int[] + if (currentFrame == 4) { - 107, - 234, - 269 - }); - int rainbow = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, 0f, 0f, 100, default, 2f); - Dust dust = Main.dust[rainbow]; - dust.noGravity = true; - dust.position = projectile.Center; - dust.position.X += (float)Main.rand.Next(-10, 11); - dust.position.Y += (float)Main.rand.Next(-10, 11); - dust.velocity = dustVel;*/ + float numberOfDusts = 20f; + float rotFactor = 360f / numberOfDusts; + for (int i = 0; i < numberOfDusts; i++) + { + randomColor = Main.rand.Next(4) switch + { + 0 => Color.Red, + 1 => Color.MediumTurquoise, + 2 => Color.Orange, + _ => Color.LawnGreen, + }; + + float rot = MathHelper.ToRadians(i * rotFactor); + Vector2 velOffset = CalamityUtils.RandomVelocity(100f, 70f, 150f, 0.04f); + velOffset *= Main.rand.NextFloat(25, 45); + SquishyLightParticle exoEnergy = new(Projectile.Center + velOffset * 2.5f, -velOffset * Main.rand.NextFloat(0.08f, 0.12f), Main.rand.NextFloat(0.1f, 0.2f), randomColor, 9); + GeneralParticleHandler.SpawnParticle(exoEnergy); + } + } + if (currentFrame == 13) + { + if (Main.zenithWorld) + { + if (Vector2.Distance(Owner.Center, Projectile.Center) < radius) + { + Vector2 velToApply = Owner.Center.DirectionFrom(Projectile.Center).SafeNormalize(Vector2.UnitX) * 30; + Owner.velocity = velToApply + (velToApply.Y <= 0 ? new Vector2(0, -15) : Vector2.Zero); + } + } + + Projectile.velocity = Vector2.Zero; + Owner.Calamity().GeneralScreenShakePower = 5f; + + int points = 5; + float radians = MathHelper.TwoPi / points; + Vector2 spinningPoint = Vector2.Normalize(new Vector2(-1f, -1f)); + float rotRando = Main.rand.NextFloat(0.1f, 2.5f); + for (int k = 0; k < points; k++) + { + Vector2 velocity = spinningPoint.RotatedBy(radians * k).RotatedBy(-0.45f * rotRando); + SparkParticle subTrail = new(Projectile.Center + velocity * 7.5f, velocity, false, 4, 1.65f, Color.White); + GeneralParticleHandler.SpawnParticle(subTrail); + } + + for (int i = 0; i < 30; i++) + { + Vector2 randVel = new Vector2(15, 15).RotatedByRandom(100) * Main.rand.NextFloat(0.8f, 1.6f); + Particle smoke = new HeavySmokeParticle(Projectile.Center + randVel, randVel, new Color(57, 46, 115) * 0.9f, Main.rand.Next(25, 35 + 1), Main.rand.NextFloat(0.9f, 2.3f), 0.4f); + GeneralParticleHandler.SpawnParticle(smoke); + } + + float numberOflines = 45; + float rotFactorlines = 360f / numberOflines; + for (int e = 0; e < numberOflines; e++) + { + randomColor = Main.rand.Next(4) switch + { + 0 => Color.Red, + 1 => Color.MediumTurquoise, + 2 => Color.Orange, + _ => Color.LawnGreen, + }; + + float rot = MathHelper.ToRadians(e * rotFactorlines); + Vector2 offset = (Vector2.UnitX * Main.rand.NextFloat(0.2f, 3.1f)).RotatedBy(rot + Main.rand.NextFloat(0.1f, 5.1f)); + Vector2 velOffset = (Vector2.UnitX * Main.rand.NextFloat(0.2f, 3.1f)).RotatedBy(rot + Main.rand.NextFloat(0.1f, 5.1f)); + SparkParticle spark = new SparkParticle(Projectile.Center + offset, velOffset * Main.rand.NextFloat(15.5f, 25.5f), true, 95, Main.rand.NextFloat(0.3f, 1.1f), Color.Lerp(Color.White, randomColor, 0.3f)); + GeneralParticleHandler.SpawnParticle(spark); + } + + } + if (currentFrame < 13) + { + if (Main.zenithWorld) + { + if (Vector2.Distance(Owner.Center, Projectile.Center) > 40 && Vector2.Distance(Owner.Center, Projectile.Center) < 600) + Owner.Center += Owner.Center.DirectionTo(Projectile.Center).SafeNormalize(Vector2.UnitX) * 22; + } + for (int i = 0; i < Main.maxNPCs; i++) + { + NPC target = Main.npc[i]; + 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)) + { + if (Vector2.Distance(target.Center, Projectile.Center) > 40 && Vector2.Distance(target.Center, Projectile.Center) < 600) + target.Center += target.Center.DirectionTo(Projectile.Center).SafeNormalize(Vector2.UnitX) * 22; + } + else if (target != null && CalamityPlayer.areThereAnyDamnBosses) + { + target = Projectile.Center.ClosestNPCAt(600); + if (target != null) + { + if (Vector2.Distance(target.Center, Projectile.Center) > 5) + { + if (Vector2.Distance(target.Center, Projectile.Center) < 600) + { + Projectile.velocity = Projectile.Center.DirectionTo(target.Center).SafeNormalize(Vector2.UnitX) * 30; + } + } + else + { + Projectile.velocity = Vector2.Zero; + Projectile.Center = target.Center; + } + } + } + } + } + + time++; } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, radius, targetHitbox); public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; int length = texture.Width / horizontalFrames; int height = texture.Height / verticalFrames; Vector2 drawPos = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); Rectangle frame = new Rectangle(frameX * length, frameY * height, length, height); Vector2 origin = new Vector2(length / 2f, height / 2f); - Main.EntitySpriteDraw(texture, drawPos, frame, Color.White, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0); + Main.EntitySpriteDraw(texture, drawPos, frame, Color.White with { A = 0 }, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0); return false; } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 300); + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + if (!target.boss && target.IsAnEnemy(true, true) && !CalamityPlayer.areThereAnyDamnBosses && target.CanBeChasedBy(Projectile, false) && target != null) + { + Vector2 velToApply = target.Center.DirectionFrom(Projectile.Center).SafeNormalize(Vector2.UnitX) * 30; + target.velocity = velToApply + (velToApply.Y <= 0 ? new Vector2(0, -5) : Vector2.Zero); + } + target.AddBuff(ModContent.BuffType(), 90); + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + if (Projectile.numHits > 0) + Projectile.damage = (int)(Projectile.damage * 0.95f); + if (Projectile.damage < 1) + Projectile.damage = 1; + } public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 300); + + public override bool? CanDamage() => damageFrame ? null : false; } } diff --git a/Projectiles/Rogue/SupernovaBoom.png b/Projectiles/Rogue/SupernovaBoom.png index b40cfe0484..aac92dbaed 100644 Binary files a/Projectiles/Rogue/SupernovaBoom.png and b/Projectiles/Rogue/SupernovaBoom.png differ diff --git a/Projectiles/Rogue/SupernovaHoming.cs b/Projectiles/Rogue/SupernovaHoming.cs deleted file mode 100644 index a9793a17b9..0000000000 --- a/Projectiles/Rogue/SupernovaHoming.cs +++ /dev/null @@ -1,103 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class SupernovaHoming : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Rogue"; - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public override void SetDefaults() - { - Projectile.width = 8; - Projectile.height = 8; - Projectile.friendly = true; - Projectile.penetrate = 1; - Projectile.tileCollide = false; - Projectile.DamageType = RogueDamageClass.Instance; - } - - public override void AI() - { - int dustType = Main.rand.NextBool() ? 107 : 234; - if (Main.rand.NextBool(4)) - { - dustType = 269; - } - Projectile.ai[0] += 1; - if (Projectile.ai[0] % 2 == 0) - { - int coolDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width - 28, Projectile.height - 28, dustType, 0f, 0f, 100, default, 1.5f); - Main.dust[coolDust].noGravity = true; - Main.dust[coolDust].velocity *= 0.1f; - Main.dust[coolDust].velocity += Projectile.velocity * 0.5f; - } - if (Projectile.ai[0] < 90) - { - Projectile.velocity *= 0.98f; - } - else - { - Projectile.extraUpdates = 1; - - Vector2 center = Projectile.Center; - float maxDistance = 500f; - bool homeIn = false; - - for (int i = 0; i < Main.maxNPCs; i++) - { - if (Main.npc[i].CanBeChasedBy(Projectile, false)) - { - float extraDistance = (float)(Main.npc[i].width / 2) + (float)(Main.npc[i].height / 2); - - if (Vector2.Distance(Main.npc[i].Center, Projectile.Center) < (maxDistance + extraDistance) && Collision.CanHit(Projectile.Center, 1, 1, Main.npc[i].Center, 1, 1)) - { - center = Main.npc[i].Center; - homeIn = true; - break; - } - } - } - - if (homeIn) - { - Vector2 moveDirection = Projectile.SafeDirectionTo(center, Vector2.UnitY); - Projectile.velocity = (Projectile.velocity * 20f + moveDirection * 12f) / (21f); - } - else - Projectile.Kill(); - } - - Projectile.rotation += 0.25f; - } - - public override bool? CanDamage() - { - return Projectile.ai[0] >= 90 ? null : false; - } - - public override void OnKill(int timeLeft) - { - Projectile.position = Projectile.Center; - Projectile.width = Projectile.height = 24; - Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); - int constant = 36; - for (int i = 0; i < constant; i++) - { - Vector2 rotate = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; - rotate = rotate.RotatedBy((double)((float)(i - (constant / 2 - 1)) * 6.28318548f / (float)constant), default) + Projectile.Center; - Vector2 faceDirection = rotate - Projectile.Center; - int dust = Dust.NewDust(rotate + faceDirection, 0, 0, 234, faceDirection.X * 0.5f, faceDirection.Y * 0.5f, 100, default, 0.75f); - Main.dust[dust].noGravity = true; - } - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 180); - - public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 180); - } -} diff --git a/Projectiles/Rogue/SupernovaSpike.cs b/Projectiles/Rogue/SupernovaSpike.cs deleted file mode 100644 index d9c403468d..0000000000 --- a/Projectiles/Rogue/SupernovaSpike.cs +++ /dev/null @@ -1,122 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class SupernovaSpike : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Rogue"; - public override string Texture => "CalamityMod/Projectiles/Rogue/BallisticPoisonBombSpike"; - - private Color currentColor = Color.Black; - - public override void SetDefaults() - { - Projectile.width = 10; - Projectile.height = 10; - Projectile.alpha = 255; - Projectile.friendly = true; - Projectile.ignoreWater = true; - Projectile.penetrate = 3; - Projectile.alpha = 255; - Projectile.extraUpdates = 2; - Projectile.aiStyle = ProjAIStyleID.Nail; - AIType = ProjectileID.NailFriendly; - Projectile.DamageType = RogueDamageClass.Instance; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 5; - } - - public override void AI() - { - Projectile.alpha -= 10; - if (Projectile.alpha < 0) - { - Projectile.alpha = 0; - } - int dustType = Main.rand.NextBool() ? 107 : 234; - if (Main.rand.NextBool(4)) - { - dustType = 269; - } - Projectile.localAI[1] += 1f; - if (Projectile.localAI[1] > 4f) - { - int theDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 0.75f); - Main.dust[theDust].noGravity = true; - Main.dust[theDust].velocity *= 0f; - } - if (currentColor == Color.Black) - { - int startPoint = Main.rand.Next(6); - Projectile.localAI[0] = startPoint; - currentColor = GetStartingColor(startPoint); - } - Visuals(Projectile, ref currentColor); - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 180); - - public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 180); - - internal static void Visuals(Projectile projectile, ref Color c) - { - CalamityUtils.IterateDisco(ref c, ref projectile.localAI[0], 15); - Vector3 compositeColor = 0.1f * Color.White.ToVector3() + 0.05f * c.ToVector3(); - Lighting.AddLight(projectile.Center, compositeColor); - } - - internal static Color GetStartingColor(int startPoint = 0) - { - switch (startPoint) - { - default: return new Color(1f, 0f, 0f, 0f); // Color.Red - case 1: return new Color(1f, 1f, 0f, 0f); // Color.Yellow - case 2: return new Color(0f, 1f, 0f, 0f); // Color.Green - case 3: return new Color(0f, 1f, 1f, 0f); // Color.Turquoise - case 4: return new Color(0f, 0f, 1f, 0f); // Color.Blue - case 5: return new Color(1f, 0f, 1f, 0f); // Color.Violet - } - } - - // This projectile is always fullbright. - public override Color? GetAlpha(Color lightColor) - { - return currentColor; - } - - public override void OnKill(int timeLeft) - { - Projectile.position = Projectile.Center; - Projectile.width = Projectile.height = 32; - Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); - int dustType = Main.rand.NextBool() ? 107 : 234; - if (Main.rand.NextBool(4)) - { - dustType = 269; - } - for (int i = 0; i < 2; i++) - { - int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 1.2f); - Main.dust[dust].velocity *= 3f; - if (Main.rand.NextBool()) - { - Main.dust[dust].scale = 0.5f; - Main.dust[dust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int j = 0; j < 2; j++) - { - int dust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 6, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.7f); - Main.dust[dust2].noGravity = true; - Main.dust[dust2].velocity *= 5f; - dust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 6, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f); - Main.dust[dust2].velocity *= 2f; - } - } - } -} diff --git a/Projectiles/Rogue/SupernovaStealthBoom.cs b/Projectiles/Rogue/SupernovaStealthBoom.cs new file mode 100644 index 0000000000..aaa399a2cc --- /dev/null +++ b/Projectiles/Rogue/SupernovaStealthBoom.cs @@ -0,0 +1,387 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.CalPlayer; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Melee; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; +using static Humanizer.In; + +namespace CalamityMod.Projectiles.Rogue +{ + public class SupernovaStealthBoom : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Rogue"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + private float radius = 90f; + public bool damageFrame = false; + public bool doDamage = true; + + public Color variedColor = Color.White; + public Color mainColor = Color.LawnGreen; + public Color randomColor = Color.White; + public int colorTimer = 0; + public int time = 0; + + private Player Owner => Main.player[Projectile.owner]; + + public override void SetDefaults() + { + Projectile.width = 408; + Projectile.height = 410; + Projectile.scale = 1f; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.DamageType = RogueDamageClass.Instance; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 5; + } + + public override void AI() + { + randomColor = Main.rand.Next(4) switch + { + 0 => Color.Red, + 1 => Color.MediumTurquoise, + 2 => Color.Orange, + _ => Color.LawnGreen, + }; + if (time == 0) + { + mainColor = randomColor; + } + + if (time % 20 == 0) + { + variedColor = colorTimer switch + { + 0 => Color.Red, + 1 => Color.MediumTurquoise, + 2 => Color.Orange, + _ => Color.LawnGreen, + }; + colorTimer++; + if (colorTimer >= 4) + colorTimer = 0; + } + + mainColor = Color.Lerp(mainColor, variedColor, 0.07f); + + Lighting.AddLight(Projectile.Center, mainColor.ToVector3() * 4); + + if (time <= 72) + { + float orbScale = MathHelper.Clamp(Utils.GetLerpValue(85, 0, time), 0, 1); + Particle orb = new CustomPulse(Projectile.Center, Vector2.Zero, mainColor, "CalamityMod/Particles/LargeBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 2.5f * orbScale, 2.5f * orbScale, 4); + GeneralParticleHandler.SpawnParticle(orb); + Particle orb2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/LargeBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 2f * orbScale, 2f * orbScale, 4); + GeneralParticleHandler.SpawnParticle(orb2); + + radius = 90 * orbScale; + + + float numberOfDusts = 2f; + float rotFactor = 360f / numberOfDusts; + for (int i = 0; i < numberOfDusts; i++) + { + randomColor = Main.rand.Next(4) switch + { + 0 => Color.Red, + 1 => Color.MediumTurquoise, + 2 => Color.Orange, + _ => Color.LawnGreen, + }; + + float rot = MathHelper.ToRadians(i * rotFactor); + Vector2 velOffset = CalamityUtils.RandomVelocity(100f, 70f, 150f, 0.04f); + velOffset *= Main.rand.NextFloat(25, 45) * orbScale; + SquishyLightParticle exoEnergy = new(Projectile.Center + velOffset * 2.5f, -velOffset * Main.rand.NextFloat(0.08f, 0.12f), Main.rand.NextFloat(0.3f, 0.5f) * orbScale, randomColor, 9); + GeneralParticleHandler.SpawnParticle(exoEnergy); + } + } + if (time == 40) + { + Particle pulse2 = new StaticPulseRing(Projectile.Center, Vector2.Zero, randomColor * 0.4f, new Vector2(1f, 1f), 0f, 5f, 0f, 40); + GeneralParticleHandler.SpawnParticle(pulse2); + } + if (time == 50) + { + Particle pulse2 = new StaticPulseRing(Projectile.Center, Vector2.Zero, randomColor * 0.4f, new Vector2(1f, 1f), 0f, 5f, 0f, 30); + GeneralParticleHandler.SpawnParticle(pulse2); + } + if (time == 60) + { + Particle pulse2 = new StaticPulseRing(Projectile.Center, Vector2.Zero, randomColor * 0.4f, new Vector2(1f, 1f), 0f, 5f, 0f, 20); + GeneralParticleHandler.SpawnParticle(pulse2); + } + if (time == 70) + { + doDamage = false; + float rotation = Main.rand.NextBool() ? 2.5f : -2.5f; + Particle sparkle = new GenericSparkle(Projectile.Center, Vector2.Zero, Color.White, randomColor, 3f, 9, rotation, 2); + GeneralParticleHandler.SpawnParticle(sparkle); + Particle sparkle2 = new GenericSparkle(Projectile.Center, Vector2.Zero, Color.White, randomColor, 3.5f, 9, rotation, 2); + GeneralParticleHandler.SpawnParticle(sparkle2); + } + if (time == 80) + { + radius = 2500; + if (Main.zenithWorld) + { + Projectile.hostile = true; + Projectile.friendly = true; + Projectile.damage *= 100; + } + + SoundEngine.PlaySound(Supernova.StealthExplosionSound with { Pitch = Projectile.ai[2] }, Projectile.Center); + Projectile.numHits = 0; + damageFrame = true; + doDamage = true; + Owner.Calamity().GeneralScreenShakePower = 14.5f; + + for (int i = 0; i < 55; i++) + { + Vector2 randVel = new Vector2(35, 35).RotatedByRandom(100) * Main.rand.NextFloat(0.05f, (Main.rand.NextBool(3) ? 1f : 0.5f)); + Particle smoke = new HeavySmokeParticle(Projectile.Center + randVel, randVel, new Color(57, 46, 115) * 0.9f, Main.rand.Next(25, 35 + 1), Main.rand.NextFloat(0.9f, 2.3f), 0.5f); + GeneralParticleHandler.SpawnParticle(smoke); + } + for (int i = 0; i < 150; i++) + { + Vector2 randVel = new Vector2(15, 15).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 1.6f); + Dust dust2 = Dust.NewDustPerfect(Projectile.Center + randVel, 303, randVel); + dust2.scale = Main.rand.NextFloat(1.75f, 2.5f); + dust2.noGravity = true; + dust2.color = new Color(57, 46, 115); + dust2.alpha = Main.rand.Next(40, 100 + 1); + } + + Particle orb = new CustomPulse(Projectile.Center, Vector2.Zero, mainColor, "CalamityMod/Particles/LargeBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 4.5f, 3.5f, 20); + GeneralParticleHandler.SpawnParticle(orb); + Particle orb2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/LargeBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 4f, 3f, 20); + GeneralParticleHandler.SpawnParticle(orb2); + + Vector2 BurstFXDirection = new Vector2(0, 5); + for (int i = 0; i < 8; i++) + { + randomColor = Main.rand.Next(4) switch + { + 0 => Color.Red, + 1 => Color.MediumTurquoise, + 2 => Color.Orange, + _ => Color.LawnGreen, + }; + + GlowSparkParticle spark = new GlowSparkParticle(Projectile.Center, (BurstFXDirection) * (i + 1f), false, 12, (0.25f - i * 0.02f) * 1.5f, randomColor, new Vector2(2.7f, 1.3f), true); + GeneralParticleHandler.SpawnParticle(spark); + } + for (int k = 0; k < 25; k++) + { + randomColor = Main.rand.Next(4) switch + { + 0 => Color.Red, + 1 => Color.MediumTurquoise, + 2 => Color.Orange, + _ => Color.LawnGreen, + }; + + GlowSparkParticle spark2 = new GlowSparkParticle(Projectile.Center + Main.rand.NextVector2Circular(30, 30), BurstFXDirection * Main.rand.NextFloat(1f, 20.5f), false, Main.rand.Next(40, 50 + 1), Main.rand.NextFloat(0.04f, 0.095f), randomColor, new Vector2(0.3f, 1.6f)); + GeneralParticleHandler.SpawnParticle(spark2); + } + for (int i = 0; i < 8; i++) + { + randomColor = Main.rand.Next(4) switch + { + 0 => Color.Red, + 1 => Color.MediumTurquoise, + 2 => Color.Orange, + _ => Color.LawnGreen, + }; + + GlowSparkParticle spark = new GlowSparkParticle(Projectile.Center, (-BurstFXDirection) * (i + 1f), false, 12, (0.25f - i * 0.02f) * 1.5f, randomColor, new Vector2(2.7f, 1.3f), true); + GeneralParticleHandler.SpawnParticle(spark); + } + for (int k = 0; k < 25; k++) + { + randomColor = Main.rand.Next(4) switch + { + 0 => Color.Red, + 1 => Color.MediumTurquoise, + 2 => Color.Orange, + _ => Color.LawnGreen, + }; + + GlowSparkParticle spark2 = new GlowSparkParticle(Projectile.Center + Main.rand.NextVector2Circular(30, 30), -BurstFXDirection * Main.rand.NextFloat(1f, 20.5f), false, Main.rand.Next(40, 50 + 1), Main.rand.NextFloat(0.04f, 0.095f), randomColor, new Vector2(0.3f, 1.6f)); + GeneralParticleHandler.SpawnParticle(spark2); + } + Vector2 BurstFXDirection2 = new Vector2(5, 0); + for (int i = 0; i < 8; i++) + { + randomColor = Main.rand.Next(4) switch + { + 0 => Color.Red, + 1 => Color.MediumTurquoise, + 2 => Color.Orange, + _ => Color.LawnGreen, + }; + + GlowSparkParticle spark = new GlowSparkParticle(Projectile.Center, (BurstFXDirection2) * (i + 1f), false, 12, (0.25f - i * 0.02f) * 1.5f, randomColor, new Vector2(2.7f, 1.3f), true); + GeneralParticleHandler.SpawnParticle(spark); + } + for (int k = 0; k < 25; k++) + { + randomColor = Main.rand.Next(4) switch + { + 0 => Color.Red, + 1 => Color.MediumTurquoise, + 2 => Color.Orange, + _ => Color.LawnGreen, + }; + + GlowSparkParticle spark2 = new GlowSparkParticle(Projectile.Center + Main.rand.NextVector2Circular(30, 30), BurstFXDirection2 * Main.rand.NextFloat(1f, 20.5f), false, Main.rand.Next(40, 50 + 1), Main.rand.NextFloat(0.04f, 0.095f), randomColor, new Vector2(0.3f, 1.6f)); + GeneralParticleHandler.SpawnParticle(spark2); + } + for (int i = 0; i < 8; i++) + { + randomColor = Main.rand.Next(4) switch + { + 0 => Color.Red, + 1 => Color.MediumTurquoise, + 2 => Color.Orange, + _ => Color.LawnGreen, + }; + + GlowSparkParticle spark = new GlowSparkParticle(Projectile.Center, (-BurstFXDirection2) * (i + 1f), false, 12, (0.25f - i * 0.02f) * 1.5f, randomColor, new Vector2(2.7f, 1.3f), true); + GeneralParticleHandler.SpawnParticle(spark); + } + for (int k = 0; k < 25; k++) + { + randomColor = Main.rand.Next(4) switch + { + 0 => Color.Red, + 1 => Color.MediumTurquoise, + 2 => Color.Orange, + _ => Color.LawnGreen, + }; + + GlowSparkParticle spark2 = new GlowSparkParticle(Projectile.Center + Main.rand.NextVector2Circular(30, 30), -BurstFXDirection2 * Main.rand.NextFloat(1f, 20.5f), false, Main.rand.Next(40, 50 + 1), Main.rand.NextFloat(0.04f, 0.095f), randomColor, new Vector2(0.3f, 1.6f)); + GeneralParticleHandler.SpawnParticle(spark2); + } + + for (int i = 0; i < 10; i++) + { + randomColor = Main.rand.Next(4) switch + { + 0 => Color.Red, + 1 => Color.MediumTurquoise, + 2 => Color.Orange, + _ => Color.LawnGreen, + }; + + Particle pulse2 = new CustomPulse(Projectile.Center, Vector2.Zero, randomColor * 0.7f, "CalamityMod/Particles/FlameExplosion", new Vector2(1f, 1f), Main.rand.NextFloat(-20, 20), 0f, 4f - i * 0.28f, 50); + GeneralParticleHandler.SpawnParticle(pulse2); + } + + + /* + for (int i = 0; i < 45; i++) + { + Vector2 randVel = new Vector2(15, 15).RotatedByRandom(100) * Main.rand.NextFloat(0.8f, 1.6f); + Particle smoke = new HeavySmokeParticle(Projectile.Center + randVel, randVel, new Color(57, 46, 115) * 0.9f, Main.rand.Next(25, 35 + 1), Main.rand.NextFloat(0.9f, 2.3f), 0.4f); + GeneralParticleHandler.SpawnParticle(smoke); + } + */ + + } + if (time < 80) + { + for (int i = 0; i < Main.maxNPCs; i++) + { + NPC target = Main.npc[i]; + 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) && target.CanBeChasedBy(Projectile, false)) + { + if (target != null && !CalamityPlayer.areThereAnyDamnBosses) + { + if (Vector2.Distance(target.Center, Projectile.Center) > 40 && Vector2.Distance(target.Center, Projectile.Center) < 2000) + target.Center += target.Center.DirectionTo(Projectile.Center).SafeNormalize(Vector2.UnitX) * 38; + } + } + } + } + + time++; + if (time >= 82) + { + Projectile.Kill(); + } + } + + public Color RandomizeColor(Color randomColor) + { + randomColor = Main.rand.Next(4) switch + { + 0 => Color.Red, + 1 => Color.MediumTurquoise, + 2 => Color.Orange, + _ => Color.LawnGreen, + }; + + return randomColor; + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, radius, targetHitbox); + + public override bool PreDraw(ref Color lightColor) + { + + return false; + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + if (damageFrame) + { + target.AddBuff(ModContent.BuffType(), 90); + for (int i = 0; i <= MathHelper.Clamp(9 - Projectile.numHits, 3, 9); i++) + { + randomColor = Main.rand.Next(4) switch + { + 0 => Color.Red, + 1 => Color.MediumTurquoise, + 2 => Color.Orange, + _ => Color.LawnGreen, + }; + Vector2 vel = target.Center.DirectionFrom(Projectile.Center).SafeNormalize(Vector2.UnitX) * 20 * Main.rand.NextFloat(0.05f, 1.2f); + Dust dust2 = Dust.NewDustPerfect(target.Center + Main.rand.NextVector2Circular(target.width * 0.5f, target.height * 0.5f), 66, vel); + dust2.scale = Main.rand.NextFloat(1.15f, 2f); + dust2.noGravity = true; + dust2.color = Color.Lerp(Color.White, randomColor, 0.9f); + } + + if (!target.boss && target.IsAnEnemy(true, true) && !CalamityPlayer.areThereAnyDamnBosses && target.CanBeChasedBy(Projectile, false) && target != null) + { + Vector2 velToApply = target.Center.DirectionFrom(Projectile.Center).SafeNormalize(Vector2.UnitX) * 40; + target.velocity = velToApply + (velToApply.Y <= 0 ? new Vector2(0, -5) : Vector2.Zero); + } + } + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) // Add to regular plz + { + if (!damageFrame) + modifiers.SourceDamage *= 0.0025f; + if (Projectile.damage < 1) + Projectile.damage = 1; + } + + public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 300); + + public override bool? CanDamage() => doDamage ? null : false; + } +} diff --git a/Projectiles/Rogue/TalonLargeProj.cs b/Projectiles/Rogue/TalonLargeProj.cs index 7e2e407962..f5ed435467 100644 --- a/Projectiles/Rogue/TalonLargeProj.cs +++ b/Projectiles/Rogue/TalonLargeProj.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -31,13 +31,13 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { - if (Main.rand.Next(5) == 0) + if (Main.rand.NextBool(5)) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 85, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.UnusedBrown, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } - if (Main.rand.Next(10) == 0) + if (Main.rand.NextBool(10)) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 111, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Clentaminator_Cyan, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } Projectile.ai[0]++; if (Projectile.ai[0] > 2f) @@ -52,7 +52,7 @@ namespace CalamityMod.Projectiles.Rogue { for (int i = 0; i <= 10; i++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 85, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.UnusedBrown, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } diff --git a/Projectiles/Rogue/TalonSmallProj.cs b/Projectiles/Rogue/TalonSmallProj.cs index ec23b708a5..da51fad4f5 100644 --- a/Projectiles/Rogue/TalonSmallProj.cs +++ b/Projectiles/Rogue/TalonSmallProj.cs @@ -1,6 +1,7 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue @@ -52,9 +53,9 @@ namespace CalamityMod.Projectiles.Rogue Projectile.velocity *= maxSpeed / currentSpeed; // spawn dust - if (Main.rand.Next(5) == 0) + if (Main.rand.NextBool(5)) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 85, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.UnusedBrown, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } // freely spins instead of facing forwards @@ -73,13 +74,13 @@ namespace CalamityMod.Projectiles.Rogue { for (int i = 0; i <= 5; i++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 85, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.UnusedBrown, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } diff --git a/Projectiles/Rogue/TarraThornRight.cs b/Projectiles/Rogue/TarraThornRight.cs index 14c36d2367..7560dbac9e 100644 --- a/Projectiles/Rogue/TarraThornRight.cs +++ b/Projectiles/Rogue/TarraThornRight.cs @@ -61,7 +61,7 @@ namespace CalamityMod.Projectiles.Rogue { for (int i = 0; i < 8; i++) { - Dust thorn = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, 7, Projectile.velocity.X * 0.025f, Projectile.velocity.Y * 0.025f, 200, default, 1.3f); + Dust thorn = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.WoodFurniture, Projectile.velocity.X * 0.025f, Projectile.velocity.Y * 0.025f, 200, default, 1.3f); thorn.noGravity = true; thorn.velocity *= 0.5f; } @@ -78,7 +78,7 @@ namespace CalamityMod.Projectiles.Rogue // Draw the tip for the final thorn public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; if (Projectile.ai[0] == TotalSegments) texture = ModContent.Request("CalamityMod/Projectiles/Magic/NettleTip").Value; diff --git a/Projectiles/Rogue/TarragonThrowingDartProjectile.cs b/Projectiles/Rogue/TarragonThrowingDartProjectile.cs index 7ea943b90e..3989f2219e 100644 --- a/Projectiles/Rogue/TarragonThrowingDartProjectile.cs +++ b/Projectiles/Rogue/TarragonThrowingDartProjectile.cs @@ -1,8 +1,8 @@ -using CalamityMod.Dusts; +using System; +using CalamityMod.Dusts; using CalamityMod.Items.Weapons.Rogue; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -34,13 +34,13 @@ namespace CalamityMod.Projectiles.Rogue Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.ToRadians(45f); if (Main.rand.NextBool(3)) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, (int)CalamityDusts.SulfurousSeaAcid, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, (int)CalamityDusts.SulphurousSeaAcid, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } } public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } diff --git a/Projectiles/Rogue/TheAtomSplitterProjectile.cs b/Projectiles/Rogue/TheAtomSplitterProjectile.cs index da274b40d5..d96fee817c 100644 --- a/Projectiles/Rogue/TheAtomSplitterProjectile.cs +++ b/Projectiles/Rogue/TheAtomSplitterProjectile.cs @@ -1,7 +1,8 @@ -using Microsoft.Xna.Framework; -using System; +using System; using System.IO; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue @@ -11,8 +12,8 @@ namespace CalamityMod.Projectiles.Rogue public new string LocalizationCategory => "Projectiles.Rogue"; // Atom splitting is cool and all, but actual thermonuclear meltdown levels of DPS is unacceptable. // DO NOT increase this unless you are ABSOLUTELY SURE you know what will happen. - private const float NormalSplitMultiplier = 0.7f; - private const float StealthSplitMultiplier = 0.144f; + public static float NormalSplitMultiplier = 0.7f; + public static float StealthSplitMultiplier = 0.23f; public ref float HitTargetIndex => ref Projectile.ai[0]; public ref float Time => ref Projectile.ai[1]; @@ -138,7 +139,7 @@ namespace CalamityMod.Projectiles.Rogue for (float i = 0f; i < dustCount; i++) { Color dustColor = CalamityUtils.MulticolorLerp(Main.rand.NextFloat(), CalamityUtils.ExoPalette); - Dust explosionDust = Dust.NewDustDirect(spawnPosition, 0, 0, 267, 0f, 0f, 0, dustColor, 1f); + Dust explosionDust = Dust.NewDustDirect(spawnPosition, 0, 0, DustID.RainbowMk2, 0f, 0f, 0, dustColor, 1f); explosionDust.position = spawnPosition; explosionDust.velocity = baseDustVelocity.RotatedBy(MathHelper.TwoPi * i / dustCount) * outwardFireSpeedFactor * Main.rand.NextFloat(0.8f, 1.2f); explosionDust.velocity += Projectile.velocity * Main.rand.NextFloat(0.6f, 0.85f); diff --git a/Projectiles/Rogue/TheSyringeCinder.cs b/Projectiles/Rogue/TheSyringeCinder.cs index 08cddc9908..7a16399617 100644 --- a/Projectiles/Rogue/TheSyringeCinder.cs +++ b/Projectiles/Rogue/TheSyringeCinder.cs @@ -1,8 +1,9 @@ -using Microsoft.Xna.Framework; -using System; -using Terraria; -using Terraria.ModLoader; +using System; using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { @@ -37,7 +38,7 @@ namespace CalamityMod.Projectiles.Rogue } else { - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + ((3 * MathHelper.Pi) / 2); + Projectile.rotation = Projectile.velocity.ToRotation() + ((3 * MathHelper.Pi) / 2); Projectile.spriteDirection = ((Projectile.velocity.X > 0f) ? -1 : 1); } @@ -83,7 +84,7 @@ namespace CalamityMod.Projectiles.Rogue } if (Main.rand.NextBool(4)) { - int num199 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 89, 0f, 0f, 100, default, 1f); + int num199 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GemEmerald, 0f, 0f, 100, default, 1f); Dust dust = Main.dust[num199]; dust.position.X -= 2f; dust.position.Y += 2f; @@ -93,7 +94,7 @@ namespace CalamityMod.Projectiles.Rogue } if (Main.rand.NextBool(10)) { - int num200 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 89, 0f, 0f, 100, default, 1f); + int num200 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GemEmerald, 0f, 0f, 100, default, 1f); Dust dust = Main.dust[num200]; dust.position.X -= 2f; dust.position.Y += 2f; diff --git a/Projectiles/Rogue/TheSyringeProj.cs b/Projectiles/Rogue/TheSyringeProj.cs index b7bfc8e5fe..583442bdf8 100644 --- a/Projectiles/Rogue/TheSyringeProj.cs +++ b/Projectiles/Rogue/TheSyringeProj.cs @@ -1,9 +1,9 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Buffs.DamageOverTime; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -36,7 +36,7 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { if (Main.rand.NextBool(8)) - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, Main.rand.Next(2) == 1 ? 107 : 89, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, Main.rand.NextBool(2)? 107 : 89, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); // TODO -- This will almost never work due to the base damage being too low, and will round down. Projectile.damage += Projectile.originalDamage / 200; @@ -63,7 +63,7 @@ namespace CalamityMod.Projectiles.Rogue SoundEngine.PlaySound(SoundID.Item107, Projectile.position); for (int k = 0; k < 7; k++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 89, Projectile.oldVelocity.X, Projectile.oldVelocity.Y); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.GemEmerald, Projectile.oldVelocity.X, Projectile.oldVelocity.Y); } int fireAmt = Main.rand.Next(1, 3); if (Projectile.owner == Main.myPlayer) diff --git a/Projectiles/Rogue/TimeBoltKnife.cs b/Projectiles/Rogue/TimeBoltKnife.cs index 6f82034099..e60f1d8767 100644 --- a/Projectiles/Rogue/TimeBoltKnife.cs +++ b/Projectiles/Rogue/TimeBoltKnife.cs @@ -1,11 +1,11 @@ -using CalamityMod.Buffs.StatDebuffs; -using Microsoft.Xna.Framework; -using System; +using System; using System.IO; +using CalamityMod.Buffs.StatDebuffs; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { public class TimeBoltKnife : ModProjectile, ILocalizedModType @@ -79,7 +79,7 @@ namespace CalamityMod.Projectiles.Rogue int dust = Dust.NewDust(center + fourVector + Vector2.One * -4f, 8, 8, dustType, 0f, 0f, 100, default, 1f); Dust dust2 = Main.dust[dust]; dust2.velocity *= 0.1f; - if (Main.rand.Next(6) != 0) + if (!Main.rand.NextBool(6)) dust2.noGravity = true; } float scalar = 0.01f; @@ -295,7 +295,7 @@ namespace CalamityMod.Projectiles.Rogue }); int dust = Dust.NewDust(Projectile.Center, 1, 1, dustType); Main.dust[dust].position = Projectile.Center + dustOffset; - if (Main.rand.Next(6) != 0) + if (!Main.rand.NextBool(6)) Main.dust[dust].noGravity = true; Main.dust[dust].fadeIn = 1f; Main.dust[dust].velocity *= 0f; diff --git a/Projectiles/Rogue/TitaniumShurikenProjectile.cs b/Projectiles/Rogue/TitaniumShurikenProjectile.cs index b9f83f6878..286c01ae26 100644 --- a/Projectiles/Rogue/TitaniumShurikenProjectile.cs +++ b/Projectiles/Rogue/TitaniumShurikenProjectile.cs @@ -1,7 +1,7 @@ -using CalamityMod.Items.Weapons.Rogue; +using System; +using CalamityMod.Items.Weapons.Rogue; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -26,13 +26,13 @@ namespace CalamityMod.Projectiles.Rogue Projectile.width = 34; Projectile.height = 34; Projectile.friendly = true; - Projectile.penetrate = -1; + Projectile.penetrate = 3; Projectile.aiStyle = ProjAIStyleID.ThrownProjectile; Projectile.timeLeft = 600; AIType = ProjectileID.ThrowingKnife; Projectile.DamageType = RogueDamageClass.Instance; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 20; + Projectile.localNPCHitCooldown = 30; } public override void AI() @@ -133,7 +133,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; if (Projectile.Calamity().stealthStrike) { CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); diff --git a/Projectiles/Rogue/ToothBallProjectile.cs b/Projectiles/Rogue/ToothBallProjectile.cs index 7fc38adfac..574e4fb755 100644 --- a/Projectiles/Rogue/ToothBallProjectile.cs +++ b/Projectiles/Rogue/ToothBallProjectile.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } diff --git a/Projectiles/Rogue/TotalityFire.cs b/Projectiles/Rogue/TotalityFire.cs index f6d273af2c..3202ed7114 100644 --- a/Projectiles/Rogue/TotalityFire.cs +++ b/Projectiles/Rogue/TotalityFire.cs @@ -100,7 +100,7 @@ namespace CalamityMod.Projectiles.Rogue //dust if (Main.rand.NextBool(4)) { - int fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 1f); + int fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 1f); Dust dust = Main.dust[fire]; dust.position.X -= 2f; dust.position.Y += 2f; @@ -110,7 +110,7 @@ namespace CalamityMod.Projectiles.Rogue } if (Main.rand.NextBool(10)) { - int fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 1f); + int fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 1f); Dust dust = Main.dust[fire]; dust.position.X -= 2f; dust.position.Y += 2f; diff --git a/Projectiles/Rogue/TotalityFlask.cs b/Projectiles/Rogue/TotalityFlask.cs index bca7e8a5bb..545f479c5b 100644 --- a/Projectiles/Rogue/TotalityFlask.cs +++ b/Projectiles/Rogue/TotalityFlask.cs @@ -1,8 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -41,7 +41,7 @@ namespace CalamityMod.Projectiles.Rogue Vector2 vector2 = spinningpoint.RotatedBy((double)rotation, new Vector2()); for (int index1 = 0; index1 < 1; ++index1) { - int index2 = Dust.NewDust(Projectile.Center + vector2 - Vector2.One * 5f, 4, 4, 6, 0.0f, 0.0f, 0, new Color(), 1f); + int index2 = Dust.NewDust(Projectile.Center + vector2 - Vector2.One * 5f, 4, 4, DustID.Torch, 0.0f, 0.0f, 0, new Color(), 1f); Main.dust[index2].scale = 1.5f; Main.dust[index2].noGravity = true; Main.dust[index2].velocity = Main.dust[index2].velocity * 0.25f + Vector2.Normalize(vector2) * 1f; @@ -62,20 +62,20 @@ namespace CalamityMod.Projectiles.Rogue Vector2 vector2 = new Vector2(20f, 20f); for (int d = 0; d < 5; ++d) - Dust.NewDust(Projectile.Center - vector2 / 2f, (int) vector2.X, (int) vector2.Y, 191, 0.0f, 0.0f, 0, Color.Red, 1f); + Dust.NewDust(Projectile.Center - vector2 / 2f, (int)vector2.X, (int)vector2.Y, DustID.SpookyWood, 0.0f, 0.0f, 0, Color.Red, 1f); for (int d = 0; d < 10; ++d) { - int index2 = Dust.NewDust(Projectile.Center - vector2 / 2f, (int) vector2.X, (int) vector2.Y, 31, 0.0f, 0.0f, 100, new Color(), 1.5f); + int index2 = Dust.NewDust(Projectile.Center - vector2 / 2f, (int)vector2.X, (int)vector2.Y, DustID.Smoke, 0.0f, 0.0f, 100, new Color(), 1.5f); Dust dust = Main.dust[index2]; dust.velocity *= 1.4f; } for (int d = 0; d < 20; ++d) { - int index2 = Dust.NewDust(Projectile.Center - vector2 / 2f, (int) vector2.X, (int) vector2.Y, 6, 0.0f, 0.0f, 100, new Color(), 2.5f); + int index2 = Dust.NewDust(Projectile.Center - vector2 / 2f, (int)vector2.X, (int)vector2.Y, DustID.Torch, 0.0f, 0.0f, 100, new Color(), 2.5f); Dust dust1 = Main.dust[index2]; dust1.noGravity = true; dust1.velocity *= 5f; - int index3 = Dust.NewDust(Projectile.Center - vector2 / 2f, (int) vector2.X, (int) vector2.Y, 6, 0.0f, 0.0f, 100, new Color(), 1.5f); + int index3 = Dust.NewDust(Projectile.Center - vector2 / 2f, (int)vector2.X, (int)vector2.Y, DustID.Torch, 0.0f, 0.0f, 100, new Color(), 1.5f); Dust dust2 = Main.dust[index3]; dust2.velocity *= 3f; } diff --git a/Projectiles/Rogue/TotalityTar.cs b/Projectiles/Rogue/TotalityTar.cs index ebda556ccd..98d51d5ec5 100644 --- a/Projectiles/Rogue/TotalityTar.cs +++ b/Projectiles/Rogue/TotalityTar.cs @@ -1,9 +1,9 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -80,20 +80,20 @@ namespace CalamityMod.Projectiles.Rogue SoundEngine.PlaySound(SoundID.Item74, Projectile.position); Vector2 vector2 = new Vector2(20f, 20f); for (int index = 0; index < 3; ++index) - Dust.NewDust(Projectile.Center - vector2 / 2f, (int) vector2.X, (int) vector2.Y, 191, 0.0f, 0.0f, 0, Color.Red, 1f); + Dust.NewDust(Projectile.Center - vector2 / 2f, (int)vector2.X, (int)vector2.Y, DustID.SpookyWood, 0.0f, 0.0f, 0, Color.Red, 1f); for (int index1 = 0; index1 < 5; ++index1) { - int index2 = Dust.NewDust(Projectile.Center - vector2 / 2f, (int) vector2.X, (int) vector2.Y, 31, 0.0f, 0.0f, 100, new Color(), 1.5f); + int index2 = Dust.NewDust(Projectile.Center - vector2 / 2f, (int)vector2.X, (int)vector2.Y, DustID.Smoke, 0.0f, 0.0f, 100, new Color(), 1.5f); Dust dust = Main.dust[index2]; dust.velocity *= 1.4f; } for (int index1 = 0; index1 < 10; ++index1) { - int index2 = Dust.NewDust(Projectile.Center - vector2 / 2f, (int) vector2.X, (int) vector2.Y, 6, 0.0f, 0.0f, 100, new Color(), 2.5f); + int index2 = Dust.NewDust(Projectile.Center - vector2 / 2f, (int)vector2.X, (int)vector2.Y, DustID.Torch, 0.0f, 0.0f, 100, new Color(), 2.5f); Dust dust1 = Main.dust[index2]; dust1.noGravity = true; dust1.velocity *= 5f; - int index3 = Dust.NewDust(Projectile.Center - vector2 / 2f, (int) vector2.X, (int) vector2.Y, 6, 0.0f, 0.0f, 100, new Color(), 1.5f); + int index3 = Dust.NewDust(Projectile.Center - vector2 / 2f, (int)vector2.X, (int)vector2.Y, DustID.Torch, 0.0f, 0.0f, 100, new Color(), 1.5f); Dust dust2 = Main.dust[index3]; dust2.velocity *= 3f; } diff --git a/Projectiles/Rogue/ToxicantTwisterDust.cs b/Projectiles/Rogue/ToxicantTwisterDust.cs index 69ecfe64da..e7c66ff3e9 100644 --- a/Projectiles/Rogue/ToxicantTwisterDust.cs +++ b/Projectiles/Rogue/ToxicantTwisterDust.cs @@ -1,6 +1,7 @@ +using CalamityMod.Buffs.DamageOverTime; using Terraria; +using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Buffs.DamageOverTime; namespace CalamityMod.Projectiles.Rogue { @@ -23,7 +24,7 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { - int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 85, 0f, 0f, 100, default, 1f); + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.UnusedBrown, 0f, 0f, 100, default, 1f); Main.dust[idx].noGravity = true; Main.dust[idx].velocity *= 0f; } diff --git a/Projectiles/Rogue/ToxicantTwisterTwoPointZero.cs b/Projectiles/Rogue/ToxicantTwisterTwoPointZero.cs index 130de6ab78..66788be39e 100644 --- a/Projectiles/Rogue/ToxicantTwisterTwoPointZero.cs +++ b/Projectiles/Rogue/ToxicantTwisterTwoPointZero.cs @@ -2,9 +2,9 @@ using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -136,7 +136,7 @@ namespace CalamityMod.Projectiles.Rogue target.AddBuff(ModContent.BuffType(), 180); SoundEngine.PlaySound(SoundID.Item20, Projectile.position); for (int k = 0; k < 10; k++) - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, (int)CalamityDusts.SulfurousSeaAcid, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, (int)CalamityDusts.SulphurousSeaAcid, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } public override void OnHitPlayer(Player target, Player.HurtInfo info) @@ -145,7 +145,7 @@ namespace CalamityMod.Projectiles.Rogue target.AddBuff(ModContent.BuffType(), 180); SoundEngine.PlaySound(SoundID.Item20, Projectile.position); for (int k = 0; k < 10; k++) - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, (int)CalamityDusts.SulfurousSeaAcid, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, (int)CalamityDusts.SulphurousSeaAcid, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } } diff --git a/Projectiles/Rogue/TurbulanceProjectile.cs b/Projectiles/Rogue/TurbulanceProjectile.cs index e5ba363ca7..8b7b64c99b 100644 --- a/Projectiles/Rogue/TurbulanceProjectile.cs +++ b/Projectiles/Rogue/TurbulanceProjectile.cs @@ -1,7 +1,7 @@ -using Terraria; +using Microsoft.Xna.Framework; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using Microsoft.Xna.Framework; namespace CalamityMod.Projectiles.Rogue { @@ -36,11 +36,11 @@ namespace CalamityMod.Projectiles.Rogue if (Main.rand.NextBool(5)) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 187, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 100, new Color(53, Main.DiscoG, 255)); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Flare_Blue, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 100, new Color(53, Main.DiscoG, 255)); } if (Main.rand.NextBool(5)) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 16, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Cloud, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } if (Projectile.Calamity().stealthStrike) //Stealth strike @@ -56,7 +56,7 @@ namespace CalamityMod.Projectiles.Rogue { for (int i = 0; i <= 10; i++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 187, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f, 50, new Color(53, Main.DiscoG, 255)); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Flare_Blue, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f, 50, new Color(53, Main.DiscoG, 255)); } } diff --git a/Projectiles/Rogue/TurbulanceWindSlash.cs b/Projectiles/Rogue/TurbulanceWindSlash.cs index 8804d3b7e1..b3a9087d3e 100644 --- a/Projectiles/Rogue/TurbulanceWindSlash.cs +++ b/Projectiles/Rogue/TurbulanceWindSlash.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -74,7 +74,7 @@ namespace CalamityMod.Projectiles.Rogue { for (int k = 0; k < 10; k++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 187, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 100, new Color(53, Main.DiscoG, 255)); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Flare_Blue, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 100, new Color(53, Main.DiscoG, 255)); } } } diff --git a/Projectiles/Rogue/TwistingThunderProj.cs b/Projectiles/Rogue/TwistingThunderProj.cs index 203938dc98..38e242db93 100644 --- a/Projectiles/Rogue/TwistingThunderProj.cs +++ b/Projectiles/Rogue/TwistingThunderProj.cs @@ -1,9 +1,9 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Sounds; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using CalamityMod.Sounds; namespace CalamityMod.Projectiles.Rogue { @@ -51,7 +51,7 @@ namespace CalamityMod.Projectiles.Rogue } if (Main.rand.NextBool(8)) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 132, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Firework_Blue, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); @@ -71,7 +71,7 @@ namespace CalamityMod.Projectiles.Rogue { for (int i = 0; i <= 10; i++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 132, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Firework_Blue, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } if (Main.myPlayer == Projectile.owner) diff --git a/Projectiles/Rogue/UrchinStingerProj.cs b/Projectiles/Rogue/UrchinStingerProj.cs index f8a847cd48..51847ff991 100644 --- a/Projectiles/Rogue/UrchinStingerProj.cs +++ b/Projectiles/Rogue/UrchinStingerProj.cs @@ -82,7 +82,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } diff --git a/Projectiles/Rogue/ValariBoomerang.cs b/Projectiles/Rogue/ValariBoomerang.cs index b24787b4ab..a5fb0b0005 100644 --- a/Projectiles/Rogue/ValariBoomerang.cs +++ b/Projectiles/Rogue/ValariBoomerang.cs @@ -1,12 +1,12 @@ -using CalamityMod.Items.Weapons.Rogue; +using System; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Items.Weapons.Rogue; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -37,9 +37,9 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { //Dust trail - if (Main.rand.Next(5) == 0) + if (Main.rand.NextBool(5)) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 67, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.IceRod, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } //Constant rotation @@ -132,15 +132,15 @@ namespace CalamityMod.Projectiles.Rogue Projectile.ai[0] = 1; - int icicleAmt = Main.rand.Next(2, 4); - if (Projectile.owner == Main.myPlayer) + int icicleAmt = Main.rand.Next(2, 4); + if (Projectile.owner == Main.myPlayer) + { + for (int i = 0; i < icicleAmt; i++) { - for (int i = 0; i < icicleAmt; i++) - { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); int shard = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, Main.rand.NextBool() ? ModContent.ProjectileType() : ModContent.ProjectileType(), Projectile.damage / 3, 0f, Projectile.owner); - } } + } } diff --git a/Projectiles/Rogue/Valaricicle.cs b/Projectiles/Rogue/Valaricicle.cs index 0752b92a65..a6100f7335 100644 --- a/Projectiles/Rogue/Valaricicle.cs +++ b/Projectiles/Rogue/Valaricicle.cs @@ -1,7 +1,7 @@ using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -36,7 +36,7 @@ namespace CalamityMod.Projectiles.Rogue SoundEngine.PlaySound(SoundID.Item27, Projectile.position); for (int k = 0; k < 5; k++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 67, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.IceRod, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } } diff --git a/Projectiles/Rogue/Valaricicle2.cs b/Projectiles/Rogue/Valaricicle2.cs index cd6b94a5ff..1ccddf4d15 100644 --- a/Projectiles/Rogue/Valaricicle2.cs +++ b/Projectiles/Rogue/Valaricicle2.cs @@ -1,7 +1,7 @@ using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -36,7 +36,7 @@ namespace CalamityMod.Projectiles.Rogue SoundEngine.PlaySound(SoundID.Item27, Projectile.position); for (int k = 0; k < 5; k++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 67, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.IceRod, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } } diff --git a/Projectiles/Rogue/ValedictionBoomerang.cs b/Projectiles/Rogue/ValedictionBoomerang.cs index aec879eda4..095665bff9 100644 --- a/Projectiles/Rogue/ValedictionBoomerang.cs +++ b/Projectiles/Rogue/ValedictionBoomerang.cs @@ -2,9 +2,9 @@ using CalamityMod.Projectiles.Magic; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -161,7 +161,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.Center = Projectile.position; for (int d = 0; d < 5; d++) { - int water = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 2f); + int water = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Water, 0f, 0f, 100, default, 2f); Main.dust[water].velocity *= 3f; if (Main.rand.NextBool()) { @@ -171,10 +171,10 @@ namespace CalamityMod.Projectiles.Rogue } for (int d = 0; d < 8; d++) { - int water = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 3f); + int water = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Water, 0f, 0f, 100, default, 3f); Main.dust[water].noGravity = true; Main.dust[water].velocity *= 5f; - water = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 2f); + water = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Water, 0f, 0f, 100, default, 2f); Main.dust[water].velocity *= 2f; } } diff --git a/Projectiles/Rogue/VeneratedKnife.cs b/Projectiles/Rogue/VeneratedKnife.cs index 1e98831f53..93830c3b28 100644 --- a/Projectiles/Rogue/VeneratedKnife.cs +++ b/Projectiles/Rogue/VeneratedKnife.cs @@ -72,7 +72,7 @@ namespace CalamityMod.Projectiles.Rogue if (Projectile.ai[0] == 0f) { - Texture2D knife1 = ModContent.Request(Texture).Value; + Texture2D knife1 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 3, knife1); } else if (Projectile.ai[0] == 1f) diff --git a/Projectiles/Rogue/WebBallBol.cs b/Projectiles/Rogue/WebBallBol.cs index badaf0889a..14840d8a11 100644 --- a/Projectiles/Rogue/WebBallBol.cs +++ b/Projectiles/Rogue/WebBallBol.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Rogue { if (Main.rand.NextBool(12)) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 30, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Web, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } } diff --git a/Projectiles/Rogue/WrathwingCinder.cs b/Projectiles/Rogue/WrathwingCinder.cs index 880995151a..accba2f53e 100644 --- a/Projectiles/Rogue/WrathwingCinder.cs +++ b/Projectiles/Rogue/WrathwingCinder.cs @@ -1,9 +1,9 @@ +using System.IO; using Microsoft.Xna.Framework; -using System.IO; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -97,7 +97,7 @@ namespace CalamityMod.Projectiles.Rogue } if (Main.rand.NextBool(16)) { - Dust dust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, 55, 0f, 0f, 200, default, 1f); + Dust dust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.Pixie, 0f, 0f, 200, default, 1f); dust.scale *= 0.7f; dust.velocity += Projectile.velocity * 0.25f; } @@ -117,14 +117,14 @@ namespace CalamityMod.Projectiles.Rogue Projectile.ExpandHitboxBy(144); for (int d = 0; d < 2; d++) { - Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 55, 0f, 0f, 100, default, 1.5f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Pixie, 0f, 0f, 100, default, 1.5f); } for (int d = 0; d < 20; d++) { - int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 55, 0f, 0f, 0, default, 2.5f); + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Pixie, 0f, 0f, 0, default, 2.5f); Main.dust[idx].noGravity = true; Main.dust[idx].velocity *= 3f; - idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 55, 0f, 0f, 100, default, 1.5f); + idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Pixie, 0f, 0f, 100, default, 1.5f); Main.dust[idx].velocity *= 2f; Main.dust[idx].noGravity = true; } diff --git a/Projectiles/Rogue/WrathwingFireball.cs b/Projectiles/Rogue/WrathwingFireball.cs index c67f1011cc..ea87dc0f35 100644 --- a/Projectiles/Rogue/WrathwingFireball.cs +++ b/Projectiles/Rogue/WrathwingFireball.cs @@ -26,14 +26,14 @@ namespace CalamityMod.Projectiles.Rogue Projectile.penetrate = 1; Projectile.timeLeft = 180; Projectile.aiStyle = ProjAIStyleID.Arrow; - AIType = ProjectileID.DD2BetsyFireball; Projectile.DamageType = RogueDamageClass.Instance; } public override void AI() { // Cancel out the first ten frames of Betsy fireball gravity, and half of all gravity thereafter - Projectile.velocity.Y -= 0.1f; + Projectile.velocity.Y += 0.2f; + Projectile.velocity.X *= 0.99f; // Animation Projectile.frameCounter++; @@ -53,7 +53,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; int frameHeight = texture.Height / Main.projFrames[Projectile.type]; int frameY = frameHeight * Projectile.frame; Rectangle rectangle = new Rectangle(0, frameY, texture.Width, frameHeight); @@ -87,14 +87,14 @@ namespace CalamityMod.Projectiles.Rogue Projectile.Damage(); for (int i = 0; i < 2; i++) - Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 55, 0f, 0f, 50, default, 1.5f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Pixie, 0f, 0f, 50, default, 1.5f); for (int i = 0; i < 20; i++) { - int d = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 55, 0f, 0f, 0, default, 2.5f); + int d = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Pixie, 0f, 0f, 0, default, 2.5f); Main.dust[d].noGravity = true; Main.dust[d].velocity *= 3f; - d = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 55, 0f, 0f, 50, default, 1.5f); + d = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Pixie, 0f, 0f, 50, default, 1.5f); Main.dust[d].velocity *= 2f; Main.dust[d].noGravity = true; } diff --git a/Projectiles/Rogue/WrathwingSpear.cs b/Projectiles/Rogue/WrathwingSpear.cs index 83b5a1614f..0549e21f39 100644 --- a/Projectiles/Rogue/WrathwingSpear.cs +++ b/Projectiles/Rogue/WrathwingSpear.cs @@ -1,8 +1,9 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Buffs.DamageOverTime; namespace CalamityMod.Projectiles.Rogue { @@ -37,6 +38,7 @@ namespace CalamityMod.Projectiles.Rogue { Projectile.ai[0] = 20f; + SoundEngine.PlaySound(SoundID.DD2_BetsyFireballShot with { Volume = 0.5f, MaxInstances = -1 }, Projectile.Center); int fireballID = ModContent.ProjectileType(); int damage = (int)(Projectile.damage * 0.7f); float angleDiff = Main.rand.NextFloat(-FireballAngleVariance, FireballAngleVariance); diff --git a/Projectiles/Rogue/WulfrumKnifeProj.cs b/Projectiles/Rogue/WulfrumKnifeProj.cs index 205b90da10..a233eb1fa8 100644 --- a/Projectiles/Rogue/WulfrumKnifeProj.cs +++ b/Projectiles/Rogue/WulfrumKnifeProj.cs @@ -1,15 +1,15 @@ using System; +using CalamityMod.Graphics.Primitives; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; -using Terraria.Audio; -using CalamityMod.Graphics.Primitives; namespace CalamityMod.Projectiles.Rogue { @@ -119,7 +119,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; float opacitey = StealthEffectOpacity; if (Projectile.Calamity().stealthStrike) diff --git a/Projectiles/Summon/AndromedaDeathRay.cs b/Projectiles/Summon/AndromedaDeathRay.cs index 414c359525..c9e0b2819f 100644 --- a/Projectiles/Summon/AndromedaDeathRay.cs +++ b/Projectiles/Summon/AndromedaDeathRay.cs @@ -1,12 +1,12 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; +using System; using System.IO; -using Terraria; -using Terraria.ID; -using Terraria.Enums; -using Terraria.ModLoader; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; +using Terraria; +using Terraria.Enums; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Summon { diff --git a/Projectiles/Summon/AndromedaRegislash.cs b/Projectiles/Summon/AndromedaRegislash.cs index eb8a3e0e8c..cef379f099 100644 --- a/Projectiles/Summon/AndromedaRegislash.cs +++ b/Projectiles/Summon/AndromedaRegislash.cs @@ -1,10 +1,10 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { public class AndromedaRegislash : ModProjectile, ILocalizedModType @@ -66,7 +66,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Vector2 startPos = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); int frameHeight = texture.Height / Main.projFrames[Projectile.type]; int frameY = frameHeight * Projectile.frame; diff --git a/Projectiles/Summon/AndromedaUI/AndromedaUI_Background.cs b/Projectiles/Summon/AndromedaUI/AndromedaUI_Background.cs index e1212942fa..5546744709 100644 --- a/Projectiles/Summon/AndromedaUI/AndromedaUI_Background.cs +++ b/Projectiles/Summon/AndromedaUI/AndromedaUI_Background.cs @@ -1,11 +1,11 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System.IO; -using Terraria; -using Terraria.ModLoader; -using Terraria.Audio; +using System.IO; using CalamityMod.Items.Weapons.DraedonsArsenal; using CalamityMod.Items.Weapons.Summon; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Summon.AndromedaUI { @@ -135,7 +135,7 @@ namespace CalamityMod.Projectiles.Summon.AndromedaUI Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.Default, Main.Rasterizer, null, perspective); // Draw the background UI - Main.spriteBatch.Draw(ModContent.Request(Texture).Value, + Main.spriteBatch.Draw(Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value, Projectile.Center - Main.screenPosition, null, Color.White * Projectile.Opacity, diff --git a/Projectiles/Summon/AngelicAllianceArchangel.cs b/Projectiles/Summon/AngelicAllianceArchangel.cs index 2207912569..9f13089822 100644 --- a/Projectiles/Summon/AngelicAllianceArchangel.cs +++ b/Projectiles/Summon/AngelicAllianceArchangel.cs @@ -1,9 +1,9 @@ -using CalamityMod.CalPlayer; +using System; +using System.IO; +using CalamityMod.CalPlayer; using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -147,7 +147,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { SpriteEffects spriteEffects = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; int frameHeight = texture.Height / Main.projFrames[Projectile.type]; int frameY = frameHeight * Projectile.frame; Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, frameY, texture.Width, frameHeight)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture.Width / 2f, (float)frameHeight / 2f), Projectile.scale, SpriteEffects.None, 0); diff --git a/Projectiles/Summon/ApexShark.cs b/Projectiles/Summon/ApexShark.cs index 583c47f688..7bba64724b 100644 --- a/Projectiles/Summon/ApexShark.cs +++ b/Projectiles/Summon/ApexShark.cs @@ -1,12 +1,12 @@ -using CalamityMod.Buffs.Summon; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Buffs.Summon; using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using CalamityMod.Buffs.StatDebuffs; namespace CalamityMod.Projectiles.Summon { @@ -53,7 +53,7 @@ namespace CalamityMod.Projectiles.Summon Vector2 rotate = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; rotate = rotate.RotatedBy((double)((float)(i - (constant / 2 - 1)) * 6.28318548f / (float)constant), default) + Projectile.Center; Vector2 faceDirection = rotate - Projectile.Center; - int ancientDust = Dust.NewDust(rotate + faceDirection, 0, 0, 85, faceDirection.X * 1.75f, faceDirection.Y * 1.75f, 100, default, 1.1f); + int ancientDust = Dust.NewDust(rotate + faceDirection, 0, 0, DustID.UnusedBrown, faceDirection.X * 1.75f, faceDirection.Y * 1.75f, 100, default, 1.1f); Main.dust[ancientDust].noGravity = true; Main.dust[ancientDust].velocity = faceDirection; } @@ -244,7 +244,7 @@ namespace CalamityMod.Projectiles.Summon if (Main.rand.NextBool(3)) target.AddBuff(ModContent.BuffType(), 90); - SoundEngine.PlaySound(SoundID.Item70 with { Volume = SoundID.Item70.Volume * 0.5f}, Projectile.Center); + SoundEngine.PlaySound(SoundID.Item70 with { Volume = SoundID.Item70.Volume * 0.5f }, Projectile.Center); Projectile.velocity = new Vector2(0f, 5f).RotatedBy(Projectile.velocity.ToRotation() + 1.5f); int sand = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.7f), (int)(Projectile.knockBack * 0.7f), Projectile.owner, 0f, 0f); Main.projectile[sand].Center = Projectile.Center; diff --git a/Projectiles/Summon/AquasScepterCloud.cs b/Projectiles/Summon/AquasScepterCloud.cs index 29558b9a37..1d8af26757 100644 --- a/Projectiles/Summon/AquasScepterCloud.cs +++ b/Projectiles/Summon/AquasScepterCloud.cs @@ -80,7 +80,7 @@ namespace CalamityMod.Projectiles.Summon if (distanceFromTarget < 300) { if (LightningTimer >= 60f) //Every 60 AI cycles, plays the lightning sound and spawns 2 projectiles: the tesla aura for dealing damage in an aoe, and the cloud flash to simulate the brightness of the main cloud changing. - { + { SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/LightningAura"), Projectile.Center); Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Bottom.Y, 0f, 0f, ModContent.ProjectileType(), (int)(Projectile.damage * 7.2f), 16, Projectile.owner); LightningTimer = 0f; @@ -107,7 +107,7 @@ namespace CalamityMod.Projectiles.Summon Vector2 glowPos = Projectile.position - Main.screenPosition + (glowTex.Size() * 0.5f); Main.EntitySpriteDraw(glowTex, glowPos, null, dd.color, 0f, glowTex.Size() * 0.5f, 1f, SpriteEffects.None); Main.spriteBatch.End(); - Main.spriteBatch.Begin(); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); if (Main.rand.NextBool(240)) { @@ -115,9 +115,9 @@ namespace CalamityMod.Projectiles.Summon if (DrawFlashTimer > 27) DrawFlashTimer = 27; } - + if (DrawFlashTimer > 0) - { + { float opacity = 1f - ((27 - DrawFlashTimer) / 27f); Vector2 drawPosition = Projectile.position - Main.screenPosition + (flashTex.Size() * 0.5f); Main.EntitySpriteDraw(flashTex, drawPosition, null, Color.White * opacity, 0f, flashTex.Size() * 0.5f, 1f, SpriteEffects.None); diff --git a/Projectiles/Summon/AquasScepterRaindrop.cs b/Projectiles/Summon/AquasScepterRaindrop.cs index f7f43b029a..876910da3f 100644 --- a/Projectiles/Summon/AquasScepterRaindrop.cs +++ b/Projectiles/Summon/AquasScepterRaindrop.cs @@ -3,34 +3,37 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Summon { - public class AquasScepterRaindrop : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Summon"; - public override void SetStaticDefaults() { - // Sets the amount of frames this minion has on its spritesheet - Main.projFrames[Projectile.type] = 1; + public class AquasScepterRaindrop : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Summon"; + public override void SetStaticDefaults() + { + // Sets the amount of frames this minion has on its spritesheet + Main.projFrames[Projectile.type] = 1; } - public sealed override void SetDefaults() //If you want to change the damage of this projectile, just change the base damage of AquasScepter, the item. Note that this will affect the damage of AquasScepterTeslaAura as well, because the damage of said projectile is set as a multiple of the base damage at the bottom of AquasScepterCloud.cs + public sealed override void SetDefaults() //If you want to change the damage of this projectile, just change the base damage of AquasScepter, the item. Note that this will affect the damage of AquasScepterTeslaAura as well, because the damage of said projectile is set as a multiple of the base damage at the bottom of AquasScepterCloud.cs { - Projectile.width = 20; //The sprite for the raindrop deliberately has invisible pixels added on each side of it to increase the width of the hitbox easily - Projectile.height = 48; - Projectile.tileCollide = false; - Projectile.ignoreWater = true; - Projectile.friendly = true; - Projectile.DamageType = DamageClass.Summon; - Projectile.penetrate = 2; - Projectile.timeLeft = 120; + Projectile.width = 20; //The sprite for the raindrop deliberately has invisible pixels added on each side of it to increase the width of the hitbox easily + Projectile.height = 48; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Summon; + Projectile.penetrate = 2; + Projectile.timeLeft = 120; Projectile.usesIDStaticNPCImmunity = true; Projectile.idStaticNPCHitCooldown = 8; - } + } - public override bool? CanCutTiles() { - return false; - } - public override bool MinionContactDamage() { - return true; - } + public override bool? CanCutTiles() + { + return false; + } + public override bool MinionContactDamage() + { + return true; + } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { Projectile.damage = (int)(Projectile.damage * 0.6f); diff --git a/Projectiles/Summon/AquasScepterTeslaAura.cs b/Projectiles/Summon/AquasScepterTeslaAura.cs index 5892dc33aa..d3d8c6d728 100644 --- a/Projectiles/Summon/AquasScepterTeslaAura.cs +++ b/Projectiles/Summon/AquasScepterTeslaAura.cs @@ -1,36 +1,37 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Summon { - public class AquasScepterTeslaAura : ModProjectile, ILocalizedModType - { + public class AquasScepterTeslaAura : ModProjectile, ILocalizedModType + { public new string LocalizationCategory => "Projectiles.Summon"; static float TeslaAuraScale = 3f; //Changing this float will change the radius of the hitbox and scale of the sprite at the same time, making the visual match the hitbox no matter what size is chosen. public bool ableToHit = true; // bool that controls the state of CanDamage() - public override void SetStaticDefaults() { - // Sets the amount of frames this minion has on its spritesheet - Main.projFrames[Projectile.type] = 5; - } - - public sealed override void SetDefaults() //If you want to change the damage of this projectile, look near the bottom of AquasScepterCloud.cs because this projectile's damage is set in Projectile.NewProjectile as a multiple of the AquasScepterCloud damage value + public override void SetStaticDefaults() { - Projectile.width = 216; - Projectile.height = 216; - Projectile.tileCollide = false; - Projectile.ignoreWater = true; + // Sets the amount of frames this minion has on its spritesheet + Main.projFrames[Projectile.type] = 5; + } + + public sealed override void SetDefaults() //If you want to change the damage of this projectile, look near the bottom of AquasScepterCloud.cs because this projectile's damage is set in Projectile.NewProjectile as a multiple of the AquasScepterCloud damage value + { + Projectile.width = 216; + Projectile.height = 216; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; Projectile.friendly = true; Projectile.DamageType = DamageClass.Summon; - Projectile.penetrate = -1; - Projectile.timeLeft = 27; + Projectile.penetrate = -1; + Projectile.timeLeft = 27; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 28; Projectile.alpha = 0; Projectile.spriteDirection = Main.rand.NextBool() ? -1 : 1; - } + } public override bool? CanDamage() => ableToHit ? (bool?)null : false; public override Color? GetAlpha(Color lightColor) => Color.White * (1 - (Projectile.alpha / 255f)); @@ -42,9 +43,10 @@ namespace CalamityMod.Projectiles.Summon Projectile.damage = (int)(Projectile.damage * 0.6f); } - public override void AI() { - Projectile.scale = TeslaAuraScale; - Projectile.alpha += 11; + public override void AI() + { + Projectile.scale = TeslaAuraScale; + Projectile.alpha += 11; Projectile.ai[0]++; Projectile.frameCounter++; @@ -55,5 +57,5 @@ namespace CalamityMod.Projectiles.Summon ableToHit = false; } } - } + } } diff --git a/Projectiles/Summon/AquaticStarMinion.cs b/Projectiles/Summon/AquaticStarMinion.cs index 23cd31729b..74c039a521 100644 --- a/Projectiles/Summon/AquaticStarMinion.cs +++ b/Projectiles/Summon/AquaticStarMinion.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Projectiles.Summon public CalamityPlayer moddedOwner => Owner.Calamity(); public ref float CheckForSpawning => ref Projectile.localAI[0]; - + public override void SetStaticDefaults() { ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; diff --git a/Projectiles/Summon/AstrageldonLaser.cs b/Projectiles/Summon/AstrageldonLaser.cs index 1056706bcc..2ed1ac7556 100644 --- a/Projectiles/Summon/AstrageldonLaser.cs +++ b/Projectiles/Summon/AstrageldonLaser.cs @@ -1,9 +1,9 @@ using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { public class AstrageldonLaser : ModProjectile, ILocalizedModType diff --git a/Projectiles/Summon/AstrageldonSummon.cs b/Projectiles/Summon/AstrageldonSummon.cs index 5bb58587ae..675c375416 100644 --- a/Projectiles/Summon/AstrageldonSummon.cs +++ b/Projectiles/Summon/AstrageldonSummon.cs @@ -1,10 +1,10 @@ -using CalamityMod.Buffs.Summon; +using System; using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Dusts; +using CalamityMod.Buffs.Summon; using CalamityMod.CalPlayer; +using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -54,7 +54,7 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { - Player player = Main.player[Projectile.owner];; + Player player = Main.player[Projectile.owner]; ; CalamityPlayer modPlayer = player.Calamity(); CalamityGlobalProjectile modProj = Projectile.Calamity(); @@ -166,7 +166,7 @@ namespace CalamityMod.Projectiles.Summon randAdjust = rand3 / randAdjust; rand1 *= randAdjust; rand2 *= randAdjust; - int astralDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); + int astralDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); Dust dust = Main.dust[astralDust]; dust.noGravity = true; dust.position.X = Projectile.Center.X; @@ -219,7 +219,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; int height = texture.Height / Main.projFrames[Projectile.type]; int y6 = height * Projectile.frame; Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, height)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture.Width / 2f, (float)height / 2f), Projectile.scale, SpriteEffects.None, 0); diff --git a/Projectiles/Summon/AstralProbeRound.cs b/Projectiles/Summon/AstralProbeRound.cs index 1b0672bca8..6f44db1d80 100644 --- a/Projectiles/Summon/AstralProbeRound.cs +++ b/Projectiles/Summon/AstralProbeRound.cs @@ -1,11 +1,11 @@ using CalamityMod.Buffs.DamageOverTime; -using Microsoft.Xna.Framework; using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using Microsoft.Xna.Framework.Graphics; namespace CalamityMod.Projectiles.Summon { @@ -50,9 +50,9 @@ namespace CalamityMod.Projectiles.Summon public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 120); - public override bool PreDraw(ref Color lightColor) + public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Rectangle frame = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); Vector2 origin = frame.Size() * 0.5f; SpriteEffects direction = Projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; diff --git a/Projectiles/Summon/AstralProbeSummon.cs b/Projectiles/Summon/AstralProbeSummon.cs index b5168e2711..c8e16422cd 100644 --- a/Projectiles/Summon/AstralProbeSummon.cs +++ b/Projectiles/Summon/AstralProbeSummon.cs @@ -1,11 +1,11 @@ -using CalamityMod.CalPlayer; +using CalamityMod.Buffs.Summon; +using CalamityMod.CalPlayer; using CalamityMod.Dusts; -using CalamityMod.Buffs.Summon; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { @@ -63,7 +63,7 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { NPC target = Projectile.Center.MinionHoming(2500f, Owner); // Detects a target at a certain distance. - + Vector2 idleDestination = Owner.Center + ProbePositionAngle.ToRotationVector2() * 150f; Projectile.Center = Vector2.Lerp(Projectile.Center, idleDestination, 0.15f); AITimer++; @@ -136,15 +136,15 @@ namespace CalamityMod.Projectiles.Summon if (TimerForShooting == 80f) { Vector2 velocity = CalamityUtils.CalculatePredictiveAimToTarget(Projectile.Center, target, 35f); - + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); SoundEngine.PlaySound(SoundID.Item12 with { Volume = SoundID.Item12.Volume * 0.5f, PitchVariance = 1f }, Projectile.position); - TimerForShooting = 0f; + TimerForShooting = 0f; Projectile.netUpdate = true; } - + if (TimerForShooting < 80f) TimerForShooting++; } diff --git a/Projectiles/Summon/AtlasMunitionsAutocannon.cs b/Projectiles/Summon/AtlasMunitionsAutocannon.cs index 87dcd21d35..d01046351f 100644 --- a/Projectiles/Summon/AtlasMunitionsAutocannon.cs +++ b/Projectiles/Summon/AtlasMunitionsAutocannon.cs @@ -1,14 +1,14 @@ -using Microsoft.Xna.Framework; +using System; +using System.IO; +using CalamityMod.Items.Weapons.Summon; +using CalamityMod.Particles; +using CalamityMod.Sounds; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Microsoft.Xna.Framework.Graphics; -using System; -using CalamityMod.Items.Weapons.Summon; -using Terraria.Audio; -using CalamityMod.Sounds; -using System.IO; -using CalamityMod.Particles; namespace CalamityMod.Projectiles.Summon { @@ -32,7 +32,6 @@ namespace CalamityMod.Projectiles.Summon } public ref float CannonFrame => ref Projectile.localAI[0]; - public ref float HeatInterpolant => ref Projectile.localAI[1]; public ref float CannonDirection => ref Projectile.ai[0]; @@ -42,8 +41,6 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { Main.projFrames[Projectile.type] = 5; - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() @@ -53,11 +50,10 @@ namespace CalamityMod.Projectiles.Summon Projectile.ignoreWater = true; Projectile.tileCollide = true; Projectile.netImportant = true; - Projectile.sentry = true; - Projectile.penetrate = -1; - Projectile.timeLeft = 90000; + Projectile.timeLeft = Projectile.SentryLifeTime; Projectile.DamageType = DamageClass.Summon; Projectile.Opacity = 0f; + Projectile.ContinuouslyUpdateDamageStats = true; } public override void SendExtraAI(BinaryWriter writer) @@ -166,7 +162,7 @@ namespace CalamityMod.Projectiles.Summon int laserShootRate = 3; if (wrappedAttackTimer == 1f) SoundEngine.PlaySound(CommonCalamitySounds.LaserCannonSound with { Volume = 0.25f }, CannonCenter); - + if (wrappedAttackTimer < laserCount * laserShootRate && wrappedAttackTimer % laserShootRate == 1f) { if (Main.myPlayer == Projectile.owner) @@ -193,7 +189,8 @@ namespace CalamityMod.Projectiles.Summon Projectile heldCannon = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Main.LocalPlayer.Center, Vector2.UnitX, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Main.myPlayer); heldCannon.ModProjectile().HeatInterpolant = HeatInterpolant * 0.65f; heldCannon.originalDamage = Projectile.originalDamage; - + heldCannon.ai[2] = Projectile.ai[2]; + CannonIsMounted = false; Projectile.netUpdate = true; return; @@ -225,17 +222,20 @@ namespace CalamityMod.Projectiles.Summon // If a cannon is not mounted, die if the owner goes very, very far away. else if (!Projectile.WithinRange(Owner.Center, 7200f)) { - int podID = ModContent.ProjectileType(); - int podUpperID = ModContent.ProjectileType(); for (int i = 0; i < Main.maxProjectiles; i++) { - bool validID = Main.projectile[i].type == podID || Main.projectile[i].type == podUpperID; + bool validID = Main.projectile[i].type == ModContent.ProjectileType(); if (Main.projectile[i].active && validID && Main.projectile[i].owner == Projectile.owner) Main.projectile[i].Kill(); } Projectile.Kill(); } + + // Destroy the cannon if the pod (base sentry) got replaced by other sentries + Projectile parent = Main.projectile[(int)Projectile.ai[2]]; + if (parent.type != ModContent.ProjectileType() || !parent.active) + Projectile.Kill(); } public void FireLaserAtTarget(NPC target, float laserOffsetInterpolant) @@ -313,7 +313,7 @@ namespace CalamityMod.Projectiles.Summon // Don't die on tile collision. public override bool OnTileCollide(Vector2 oldVelocity) => false; - + public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough, ref Vector2 hitboxCenterFrac) { fallThrough = false; diff --git a/Projectiles/Summon/AtlasMunitionsAutocannonHeld.cs b/Projectiles/Summon/AtlasMunitionsAutocannonHeld.cs index 64bafe200f..64a475442a 100644 --- a/Projectiles/Summon/AtlasMunitionsAutocannonHeld.cs +++ b/Projectiles/Summon/AtlasMunitionsAutocannonHeld.cs @@ -77,11 +77,10 @@ namespace CalamityMod.Projectiles.Summon Projectile.ignoreWater = true; Projectile.tileCollide = false; Projectile.netImportant = true; - Projectile.sentry = true; - Projectile.penetrate = -1; - Projectile.timeLeft = 90000; + Projectile.timeLeft = Projectile.SentryLifeTime; Projectile.DamageType = DamageClass.Summon; Projectile.Opacity = 1f; + Projectile.ContinuouslyUpdateDamageStats = true; } public override void SendExtraAI(BinaryWriter writer) @@ -126,7 +125,7 @@ namespace CalamityMod.Projectiles.Summon return; } - + // Reset opacity and the dropped timer. This is done to undo any potential fadeout effects from the dropped state. CannonDroppedTimer = 0f; Projectile.Opacity = 1f; @@ -193,6 +192,11 @@ namespace CalamityMod.Projectiles.Summon Projectile.owner = Main.myPlayer; Projectile.netUpdate = true; } + + // Destroy the cannon if the pod (base sentry) got replaced by other sentries + Projectile parent = Main.projectile[(int)Projectile.ai[2]]; + if (parent.type != ModContent.ProjectileType() || !parent.active) + Projectile.Kill(); } public void DetermineFrames() @@ -329,6 +333,12 @@ namespace CalamityMod.Projectiles.Summon // The cannon does not get destroyed by tile collisions. This only applies when in the dropped state. public override bool OnTileCollide(Vector2 oldVelocity) => false; + public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough, ref Vector2 hitboxCenterFrac) + { + fallThrough = false; + return true; + } + // The cannon itself does not do damage, but it does store damage for the lasers that it fires. public override bool? CanDamage() => false; } diff --git a/Projectiles/Summon/AtlasMunitionsDropPod.cs b/Projectiles/Summon/AtlasMunitionsDropPod.cs index 03a00d2f79..63355a6e0e 100644 --- a/Projectiles/Summon/AtlasMunitionsDropPod.cs +++ b/Projectiles/Summon/AtlasMunitionsDropPod.cs @@ -1,13 +1,13 @@ -using CalamityMod.Buffs.Summon; +using System.Collections.Generic; +using CalamityMod.Buffs.Summon; using CalamityMod.CalPlayer; +using CalamityMod.NPCs.ExoMechs.Thanatos; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using CalamityMod.NPCs.ExoMechs.Thanatos; -using System.Collections.Generic; namespace CalamityMod.Projectiles.Summon { @@ -32,8 +32,9 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; Main.projFrames[Projectile.type] = 14; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() @@ -43,11 +44,10 @@ namespace CalamityMod.Projectiles.Summon Projectile.netImportant = true; Projectile.friendly = true; Projectile.ignoreWater = true; - Projectile.timeLeft = 90000; - Projectile.penetrate = -1; + Projectile.timeLeft = Projectile.SentryLifeTime; Projectile.tileCollide = true; - Projectile.hide = true; Projectile.DamageType = DamageClass.Summon; + Projectile.sentry = true; } public override void AI() @@ -70,7 +70,7 @@ namespace CalamityMod.Projectiles.Summon // Calculate frames. Projectile.frameCounter++; - if (!HasCollidedWithGround) + if (!HasCollidedWithGround) Projectile.frame = Projectile.frameCounter / 6 % 5; else { @@ -89,6 +89,7 @@ namespace CalamityMod.Projectiles.Summon { Projectile cannon = Projectile.NewProjectileDirect(Projectile.GetSource_FromAI(), Projectile.Center + Vector2.UnitY * 10f, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, 0f, Projectile.owner); cannon.originalDamage = Projectile.originalDamage; + cannon.ai[2] = Projectile.whoAmI; Projectile.NewProjectile(Projectile.GetSource_FromAI(), Projectile.Top + Vector2.UnitY * 72f, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, Projectile.owner); } } @@ -147,7 +148,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Texture2D glowmask = ModContent.Request("CalamityMod/Projectiles/Summon/AtlasMunitionsDropPodGlow").Value; Rectangle frame = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); Vector2 drawPosition = Projectile.Center - Main.screenPosition; diff --git a/Projectiles/Summon/AtlasMunitionsDropPodUpper.cs b/Projectiles/Summon/AtlasMunitionsDropPodUpper.cs index 2c323a17cd..8688a7dc16 100644 --- a/Projectiles/Summon/AtlasMunitionsDropPodUpper.cs +++ b/Projectiles/Summon/AtlasMunitionsDropPodUpper.cs @@ -6,6 +6,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Summon { + // Purely visual -- spawns when the cannon drops public class AtlasMunitionsDropPodUpper : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Summon"; @@ -13,8 +14,6 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; Main.projFrames[Projectile.type] = 4; } @@ -25,7 +24,6 @@ namespace CalamityMod.Projectiles.Summon Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.timeLeft = 240; - Projectile.penetrate = -1; Projectile.tileCollide = false; Projectile.DamageType = DamageClass.Summon; } diff --git a/Projectiles/Summon/AtlasMunitionsLaser.cs b/Projectiles/Summon/AtlasMunitionsLaser.cs index a11373914b..ac2e8bb612 100644 --- a/Projectiles/Summon/AtlasMunitionsLaser.cs +++ b/Projectiles/Summon/AtlasMunitionsLaser.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Projectiles.Summon { Lighting.AddLight(Projectile.Center, Color.Cyan.ToVector3() * Projectile.Opacity * 0.67f); - Projectile.Opacity = Utils.GetLerpValue(240f, 235f, Projectile.timeLeft, true); + Projectile.Opacity = Utils.GetLerpValue(240f, 235f, Projectile.timeLeft, true); Projectile.rotation = Projectile.velocity.ToRotation(); Projectile.frameCounter++; if (Projectile.frameCounter >= 5) diff --git a/Projectiles/Summon/AtlasMunitionsLaserOverdrive.cs b/Projectiles/Summon/AtlasMunitionsLaserOverdrive.cs index e29c13bcbf..cd9a767bb5 100644 --- a/Projectiles/Summon/AtlasMunitionsLaserOverdrive.cs +++ b/Projectiles/Summon/AtlasMunitionsLaserOverdrive.cs @@ -76,7 +76,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Rectangle frame = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); Vector2 drawPosition = Projectile.Center - Main.screenPosition; Main.EntitySpriteDraw(texture, drawPosition, frame, Projectile.GetAlpha(Color.White), Projectile.rotation, frame.Size() * 0.5f, Projectile.scale, 0, 0); diff --git a/Projectiles/Summon/AureusBomber.cs b/Projectiles/Summon/AureusBomber.cs index 81efca5f8b..74e448eb29 100644 --- a/Projectiles/Summon/AureusBomber.cs +++ b/Projectiles/Summon/AureusBomber.cs @@ -1,11 +1,11 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { @@ -113,7 +113,7 @@ namespace CalamityMod.Projectiles.Summon if (targetedNPC != null && targetedNPC.CanBeChasedBy(Projectile, false)) { float distToEnemy = Vector2.Distance(targetedNPC.Center, Projectile.Center); - if (((double) Vector2.Distance(Projectile.Center, objectivePos) > (double) distToEnemy && (double) distToEnemy < (double) minDist || !enemyFound) && Collision.CanHitLine(Projectile.position, Projectile.width, Projectile.height, targetedNPC.position, targetedNPC.width, targetedNPC.height)) + if (((double)Vector2.Distance(Projectile.Center, objectivePos) > (double)distToEnemy && (double)distToEnemy < (double)minDist || !enemyFound) && Collision.CanHitLine(Projectile.position, Projectile.width, Projectile.height, targetedNPC.position, targetedNPC.width, targetedNPC.height)) { minDist = distToEnemy; objectivePos = targetedNPC.Center; @@ -128,7 +128,7 @@ namespace CalamityMod.Projectiles.Summon if (npc.CanBeChasedBy(Projectile, false)) { float distToEnemy = Vector2.Distance(npc.Center, Projectile.Center); - if (((double) Vector2.Distance(Projectile.Center, objectivePos) > (double) distToEnemy && (double) distToEnemy < (double) minDist || !enemyFound) && Collision.CanHitLine(Projectile.position, Projectile.width, Projectile.height, npc.position, npc.width, npc.height)) + if (((double)Vector2.Distance(Projectile.Center, objectivePos) > (double)distToEnemy && (double)distToEnemy < (double)minDist || !enemyFound) && Collision.CanHitLine(Projectile.position, Projectile.width, Projectile.height, npc.position, npc.width, npc.height)) { minDist = distToEnemy; objectivePos = npc.Center; diff --git a/Projectiles/Summon/BabyBloodCrawler.cs b/Projectiles/Summon/BabyBloodCrawler.cs index 93babecfea..9ea82a99b5 100644 --- a/Projectiles/Summon/BabyBloodCrawler.cs +++ b/Projectiles/Summon/BabyBloodCrawler.cs @@ -9,9 +9,8 @@ namespace CalamityMod.Projectiles.Summon public class BabyBloodCrawler : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Summon"; + public static int bloodCooldown = 0; public float dust = 0f; - public int spiderCount = 0; - public bool countedAlready = false; public override void SetStaticDefaults() { @@ -35,6 +34,9 @@ namespace CalamityMod.Projectiles.Summon Projectile.tileCollide = false; AIType = ProjectileID.VenomSpider; Projectile.DamageType = DamageClass.Summon; + Projectile.MaxUpdates = 2; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 33 * Projectile.MaxUpdates; } public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough, ref Vector2 hitboxCenterFrac) @@ -45,6 +47,9 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { + if (bloodCooldown > 0) + bloodCooldown--; + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); @@ -56,12 +61,11 @@ namespace CalamityMod.Projectiles.Summon continue; if (proj.type == Projectile.type) { - spiderCount += (int)proj.minionSlots; - proj.Calamity().lineColor = 2; + proj.Calamity().lineColor = 2; } } - if (Projectile.Calamity().lineColor == 0) - Projectile.Calamity().lineColor = 1; + if (Projectile.Calamity().lineColor == 0) + Projectile.Calamity().lineColor = 1; if (dust == 0f) { @@ -71,7 +75,7 @@ namespace CalamityMod.Projectiles.Summon Vector2 rotate = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; rotate = rotate.RotatedBy((double)((float)(i - (constant / 2 - 1)) * 6.28318548f / (float)constant), default) + Projectile.Center; Vector2 faceDirection = rotate - Projectile.Center; - int bloody = Dust.NewDust(rotate + faceDirection, 0, 0, 5, faceDirection.X * 1f, faceDirection.Y * 1f, 100, default, 1.1f); + int bloody = Dust.NewDust(rotate + faceDirection, 0, 0, DustID.Blood, faceDirection.X * 1f, faceDirection.Y * 1f, 100, default, 1.1f); Main.dust[bloody].noGravity = true; Main.dust[bloody].noLight = true; Main.dust[bloody].velocity = faceDirection; @@ -95,29 +99,20 @@ namespace CalamityMod.Projectiles.Summon public override bool OnTileCollide(Vector2 oldVelocity) => false; - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - //1 spider = 15 frames, 5 spiders, 10 frames - int immuneTime = 16 - spiderCount; - if (immuneTime < 5) - immuneTime = 5; //cap to prevent potential insanity - target.immune[Projectile.owner] = immuneTime; - - OnHitEffects(target.Center); - } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => OnHitEffects(target.Center); public override void OnHitPlayer(Player target, Player.HurtInfo info) => OnHitEffects(target.Center); private void OnHitEffects(Vector2 targetPos) { - if (Main.rand.NextBool()) + if (bloodCooldown == 0) { - int projAmt = Main.rand.Next(1, 3); + bloodCooldown = 17; + int projAmt = 2; var source = Projectile.GetSource_FromThis(); for (int n = 0; n < projAmt; n++) { - float damageFactor = Main.rand.NextFloat(0.7f, 1f); - CalamityUtils.ProjectileRain(source, targetPos, 400f, 100f, 500f, 800f, 29f, ModContent.ProjectileType(), (int)(Projectile.damage * damageFactor), Projectile.knockBack * Main.rand.NextFloat(0.7f, 1f), Projectile.owner); + CalamityUtils.ProjectileRain(source, targetPos, 400f, 100f, 400f, 700f, 29f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack * Main.rand.NextFloat(0.7f, 1f), Projectile.owner); } } } diff --git a/Projectiles/Summon/BabyPlaguebringer.cs b/Projectiles/Summon/BabyPlaguebringer.cs index c2e73d0f19..62cd29c934 100644 --- a/Projectiles/Summon/BabyPlaguebringer.cs +++ b/Projectiles/Summon/BabyPlaguebringer.cs @@ -1,11 +1,11 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { public class BabyPlaguebringer : ModProjectile, ILocalizedModType @@ -228,7 +228,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { SpriteEffects spriteEffects = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; int framing = texture.Height / Main.projFrames[Projectile.type]; int y6 = framing * Projectile.frame; Vector2 origin = new Vector2(texture.Width / 2f, framing / 2f); diff --git a/Projectiles/Summon/BelladonnaSpirit.cs b/Projectiles/Summon/BelladonnaSpirit.cs index ef34e10b5d..81183ea2ce 100644 --- a/Projectiles/Summon/BelladonnaSpirit.cs +++ b/Projectiles/Summon/BelladonnaSpirit.cs @@ -112,7 +112,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Vector2 position = Projectile.Center - Main.screenPosition; Rectangle sourceRectangle = texture.Frame(verticalFrames: AnimationFrames, frameY: Projectile.frame); Vector2 origin = sourceRectangle.Size() * 0.5f; diff --git a/Projectiles/Summon/BetterHornetStinger.cs b/Projectiles/Summon/BetterHornetStinger.cs index 5bfcc24c13..a390bb3802 100644 --- a/Projectiles/Summon/BetterHornetStinger.cs +++ b/Projectiles/Summon/BetterHornetStinger.cs @@ -41,7 +41,7 @@ namespace CalamityMod.Projectiles.Summon public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(BuffID.PotionSickness, 180); + target.AddBuff(BuffID.Poisoned, 180); if (!Main.dedServ) { @@ -61,7 +61,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Vector2 drawPosition = Projectile.Center - Main.screenPosition; Rectangle frame = texture.Frame(); Vector2 origin = frame.Size() * 0.5f; diff --git a/Projectiles/Summon/BlackDragonBody.cs b/Projectiles/Summon/BlackDragonBody.cs index 5640b97608..9b945dff76 100644 --- a/Projectiles/Summon/BlackDragonBody.cs +++ b/Projectiles/Summon/BlackDragonBody.cs @@ -25,8 +25,8 @@ namespace CalamityMod.Projectiles.Summon Projectile.friendly = true; Projectile.penetrate = -1; Projectile.timeLeft = 180; - Projectile.idStaticNPCHitCooldown = 4; Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 8; Projectile.tileCollide = false; Projectile.extraUpdates = 0; Projectile.aiStyle = -1; @@ -85,7 +85,7 @@ namespace CalamityMod.Projectiles.Summon } } if (!live) Projectile.Kill(); - Vector2 destinationOffset = nextSegment.Center+nextSegment.velocity - Projectile.Center; + Vector2 destinationOffset = nextSegment.Center + nextSegment.velocity - Projectile.Center; if (nextSegment.rotation != Projectile.rotation) { float angle = MathHelper.WrapAngle(nextSegment.rotation - Projectile.rotation); @@ -95,7 +95,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.rotation = destinationOffset.ToRotation(); if (destinationOffset != Vector2.Zero) { - Projectile.Center = nextSegment.Center+nextSegment.velocity - destinationOffset.SafeNormalize(Vector2.Zero) * 20f; + Projectile.Center = nextSegment.Center + nextSegment.velocity - destinationOffset.SafeNormalize(Vector2.Zero) * 20f; } } diff --git a/Projectiles/Summon/BlackDragonHead.cs b/Projectiles/Summon/BlackDragonHead.cs index 6b8a7ea608..db0b8331bc 100644 --- a/Projectiles/Summon/BlackDragonHead.cs +++ b/Projectiles/Summon/BlackDragonHead.cs @@ -1,9 +1,9 @@ -using CalamityMod.Buffs.Summon; +using System; +using System.Collections.Generic; +using CalamityMod.Buffs.Summon; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; -using System; -using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -117,7 +117,7 @@ namespace CalamityMod.Projectiles.Summon if (i < segments.Count) { if (segments.ContainsKey(i)) - segments[i].ModProjectile().SegmentMove(); + segments[i].ModProjectile().SegmentMove(); } else { @@ -135,7 +135,7 @@ namespace CalamityMod.Projectiles.Summon float distanceFromDestination = Projectile.Distance(destination); // Get a swerve effect if somewhat far from the target. - if (Projectile.Distance(destination) > 425f) + if (Projectile.Distance(destination) > 400f) { Projectile.ai[2] = 0; destination += (Projectile.ai[0] % 30f / 30f * MathHelper.TwoPi).ToRotationVector2() * 145f; @@ -185,7 +185,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Texture2D texBody = ModContent.Request("CalamityMod/Projectiles/Summon/BlackDragonBody").Value; Texture2D texBody2 = ModContent.Request("CalamityMod/Projectiles/Summon/BlackDragonBody2").Value; Texture2D texTail = ModContent.Request("CalamityMod/Projectiles/Summon/BlackDragonTail").Value; diff --git a/Projectiles/Summon/BlackHawkSummon.cs b/Projectiles/Summon/BlackHawkSummon.cs index 0637fce633..44502c4b9f 100644 --- a/Projectiles/Summon/BlackHawkSummon.cs +++ b/Projectiles/Summon/BlackHawkSummon.cs @@ -5,9 +5,9 @@ using CalamityMod.Items.Weapons.Summon; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { public class BlackHawkSummon : ModProjectile, ILocalizedModType @@ -75,7 +75,7 @@ namespace CalamityMod.Projectiles.Summon Vector2 direction = Vector2.Normalize(Projectile.velocity) * new Vector2(Projectile.width / 2f, Projectile.height) * 0.75f; direction = direction.RotatedBy((double)((dustIndex - (dustAmt / 2f - 1f)) * MathHelper.TwoPi / dustAmt), default) + Projectile.Center; Vector2 dustVel = direction - Projectile.Center; - int fire = Dust.NewDust(direction + dustVel, 0, 0, 258, dustVel.X * 1.75f, dustVel.Y * 1.75f, 100, default, 1.1f); + int fire = Dust.NewDust(direction + dustVel, 0, 0, DustID.LavaMoss, dustVel.X * 1.75f, dustVel.Y * 1.75f, 100, default, 1.1f); Main.dust[fire].noGravity = true; Main.dust[fire].velocity = dustVel; } @@ -304,7 +304,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Rectangle frame = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); SpriteEffects spriteEffects = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; diff --git a/Projectiles/Summon/BloodBreath.cs b/Projectiles/Summon/BloodBreath.cs index ca1626dfeb..ee0bc8e2e3 100644 --- a/Projectiles/Summon/BloodBreath.cs +++ b/Projectiles/Summon/BloodBreath.cs @@ -57,7 +57,7 @@ namespace CalamityMod.Projectiles.Summon Time++; if (Main.rand.NextBool()) { - Dust dust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, 5, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 100); + Dust dust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.Blood, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 100); if (Main.rand.NextBool(3)) { dust.noGravity = true; diff --git a/Projectiles/Summon/BloodRain.cs b/Projectiles/Summon/BloodRain.cs index 603939efbd..c54f31062a 100644 --- a/Projectiles/Summon/BloodRain.cs +++ b/Projectiles/Summon/BloodRain.cs @@ -22,14 +22,16 @@ namespace CalamityMod.Projectiles.Summon Projectile.tileCollide = false; Projectile.timeLeft = 300; Projectile.alpha = 255; + Projectile.penetrate = 2; Projectile.scale = 1.1f; AIType = ProjectileID.RainFriendly; + Projectile.extraUpdates = 1; Projectile.DamageType = DamageClass.Summon; } public override void AI() { - int blood = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 5, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 1f); + int blood = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Blood, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 1f); Dust dust = Main.dust[blood]; dust.velocity = Vector2.Zero; dust.position -= Projectile.velocity / 5f; diff --git a/Projectiles/Summon/BloodSpit.cs b/Projectiles/Summon/BloodSpit.cs index e5ccc1b773..ba286dd60e 100644 --- a/Projectiles/Summon/BloodSpit.cs +++ b/Projectiles/Summon/BloodSpit.cs @@ -1,13 +1,15 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Balancing; +using System; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Summon { public class BloodSpit : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Summon"; - public const int OnDeathHealValue = 1; public Player Owner => Main.player[Projectile.owner]; @@ -39,19 +41,23 @@ namespace CalamityMod.Projectiles.Summon } } - public override void OnKill(int timeLeft) + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { for (int i = 0; i < 15; i++) { - Dust blood = Dust.NewDustDirect(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 5, Projectile.velocity.X * 0.1f, Projectile.velocity.Y * 0.1f); + Dust blood = Dust.NewDustDirect(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Blood, Projectile.velocity.X * 0.1f, Projectile.velocity.Y * 0.1f); blood.velocity = Main.rand.NextVector2Circular(1f, 2f); blood.noGravity = true; } - Owner.HealEffect(OnDeathHealValue, false); - Owner.statLife += OnDeathHealValue; - if (Owner.statLife > Owner.statLifeMax2) - Owner.statLife = Owner.statLifeMax2; + int heal = (int)Math.Round(hit.Damage * 0.01); + if (heal > BalancingConstants.LifeStealCap) + heal = BalancingConstants.LifeStealCap; + + if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) + return; + + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); } } } diff --git a/Projectiles/Summon/BrimstoneElementalMinion.cs b/Projectiles/Summon/BrimstoneElementalMinion.cs index 26c28e707c..7d4a7de5dc 100644 --- a/Projectiles/Summon/BrimstoneElementalMinion.cs +++ b/Projectiles/Summon/BrimstoneElementalMinion.cs @@ -1,7 +1,7 @@ -using CalamityMod.CalPlayer; +using System; +using CalamityMod.CalPlayer; using CalamityMod.Dusts; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Projectiles/Summon/BrimstoneExplosionMinion.cs b/Projectiles/Summon/BrimstoneExplosionMinion.cs index cd75afbbeb..c9c5c3e6cc 100644 --- a/Projectiles/Summon/BrimstoneExplosionMinion.cs +++ b/Projectiles/Summon/BrimstoneExplosionMinion.cs @@ -1,11 +1,11 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { public class BrimstoneExplosionMinion : ModProjectile, ILocalizedModType @@ -62,7 +62,7 @@ namespace CalamityMod.Projectiles.Summon randAdjust = rand3 / randAdjust; rand1 *= randAdjust; rand2 *= randAdjust; - int brimDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1.5f); + int brimDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1.5f); Dust dust = Main.dust[brimDust]; dust.noGravity = true; dust.position.X = Projectile.Center.X; diff --git a/Projectiles/Summon/BrimstoneFireSummon.cs b/Projectiles/Summon/BrimstoneFireSummon.cs index f9353b9175..166873d105 100644 --- a/Projectiles/Summon/BrimstoneFireSummon.cs +++ b/Projectiles/Summon/BrimstoneFireSummon.cs @@ -51,7 +51,7 @@ namespace CalamityMod.Projectiles.Summon int dustType = (int)CalamityDusts.Brimstone; if (Main.rand.NextBool()) { - int brim = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 100, default, 1f); + int brim = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 100, default, 1f); Dust dust = Main.dust[brim]; if (Main.rand.NextBool(3)) { diff --git a/Projectiles/Summon/BrimstoneFireballMinion.cs b/Projectiles/Summon/BrimstoneFireballMinion.cs index 02cdb7dca2..b547525944 100644 --- a/Projectiles/Summon/BrimstoneFireballMinion.cs +++ b/Projectiles/Summon/BrimstoneFireballMinion.cs @@ -2,9 +2,9 @@ using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { public class BrimstoneFireballMinion : ModProjectile, ILocalizedModType @@ -58,7 +58,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi) - MathHelper.ToRadians(90) * Projectile.direction; - int brimDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 170, default, 1.1f); + int brimDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 170, default, 1.1f); Main.dust[brimDust].noGravity = true; Main.dust[brimDust].velocity *= 0.5f; Main.dust[brimDust].velocity += Projectile.velocity * 0.1f; @@ -73,10 +73,10 @@ namespace CalamityMod.Projectiles.Summon //public override void OnKill(int timeLeft) //{ - //if (Projectile.owner == Main.myPlayer) - //{ - //Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); - //} + //if (Projectile.owner == Main.myPlayer) + //{ + //Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + //} //} public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) diff --git a/Projectiles/Summon/BrittleStarMinion.cs b/Projectiles/Summon/BrittleStarMinion.cs index 52cfae8e3e..1e2568e1ea 100644 --- a/Projectiles/Summon/BrittleStarMinion.cs +++ b/Projectiles/Summon/BrittleStarMinion.cs @@ -45,7 +45,7 @@ namespace CalamityMod.Projectiles.Summon if (starCount <= 1f) starCount = 1f; - return MathHelper.TwoPi * StarIndex / starCount + AITimer * 0.018f; + return MathHelper.TwoPi * StarIndex / starCount + AITimer * 0.025f; // "MathHelper.TwoPi / ProbeIndex * probeCount"s the position itself. // "AITimer * [Modifier]"s how fast it spins. } @@ -120,11 +120,11 @@ namespace CalamityMod.Projectiles.Summon Projectile.alpha = 0; HitCounter = 0; Projectile.velocity = Vector2.Zero; - Vector2 idleDestination = Owner.Center + StarPositionAngle.ToRotationVector2() * (75f * MoveWidth); + Vector2 idleDestination = Owner.Center + StarPositionAngle.ToRotationVector2() * (90f * MoveWidth); Projectile.Center = Vector2.Lerp(Projectile.Center, idleDestination, 0.15f); AITimer++; - Owner.statDefense += 3; + Owner.statDefense += 5; Projectile.rotation += MoveWidth * 0.2f; } if (!MinionBuffMode && !Reforming) // Minion when ramming diff --git a/Projectiles/Summon/CalamarisLamentMinion.cs b/Projectiles/Summon/CalamarisLamentMinion.cs index 5ace23037d..a52f6bf1ef 100644 --- a/Projectiles/Summon/CalamarisLamentMinion.cs +++ b/Projectiles/Summon/CalamarisLamentMinion.cs @@ -216,7 +216,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Vector2 drawPosition = Projectile.Center - Main.screenPosition; Rectangle frame = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); Vector2 origin = frame.Size() * 0.5f; diff --git a/Projectiles/Summon/CalamarisLamentProjectile.cs b/Projectiles/Summon/CalamarisLamentProjectile.cs index 6cc0bf0326..b7c6c9e762 100644 --- a/Projectiles/Summon/CalamarisLamentProjectile.cs +++ b/Projectiles/Summon/CalamarisLamentProjectile.cs @@ -54,7 +54,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; Projectile.alpha = (int)Utils.Remap(Projectile.timeLeft, 30f, 0f, 0f, 255f); - Dust trailDust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, 109, Scale: Main.rand.NextFloat(0.5f, 0.8f), Alpha: 127); + Dust trailDust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.Asphalt, Scale: Main.rand.NextFloat(0.5f, 0.8f), Alpha: 127); trailDust.noGravity = true; trailDust.noLight = true; trailDust.alpha = (int)Utils.Remap(Projectile.timeLeft, 30f, 0f, 127f, 0f); @@ -85,7 +85,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Vector2 drawPosition = Projectile.Center - Main.screenPosition; Rectangle frame = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); Vector2 origin = frame.Size() * 0.5f; diff --git a/Projectiles/Summon/Calamitamini.cs b/Projectiles/Summon/Calamitamini.cs index a29cd508cb..7c2f5709c4 100644 --- a/Projectiles/Summon/Calamitamini.cs +++ b/Projectiles/Summon/Calamitamini.cs @@ -1,6 +1,6 @@ using CalamityMod.Buffs.Summon; -using CalamityMod.Dusts; using CalamityMod.CalPlayer; +using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -238,7 +238,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { SpriteEffects spriteEffects = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; int frameHeight = texture.Height / Main.projFrames[Projectile.type]; int yStart = frameHeight * Projectile.frame; Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, yStart, texture.Width, frameHeight)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, frameHeight / 2f), Projectile.scale, SpriteEffects.None, 0); diff --git a/Projectiles/Summon/Cataclymini.cs b/Projectiles/Summon/Cataclymini.cs index cab3e7cdc7..6b31ab97db 100644 --- a/Projectiles/Summon/Cataclymini.cs +++ b/Projectiles/Summon/Cataclymini.cs @@ -232,7 +232,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { SpriteEffects spriteEffects = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; int frameHeight = texture.Height / Main.projFrames[Projectile.type]; int yStart = frameHeight * Projectile.frame; Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, yStart, texture.Width, frameHeight)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, frameHeight / 2f), Projectile.scale, SpriteEffects.None, 0); diff --git a/Projectiles/Summon/CataclysmSummon.cs b/Projectiles/Summon/CataclysmSummon.cs index 0e671f3081..2a6fcb532d 100644 --- a/Projectiles/Summon/CataclysmSummon.cs +++ b/Projectiles/Summon/CataclysmSummon.cs @@ -1,11 +1,11 @@ -using Microsoft.Xna.Framework; +using System; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using CalamityMod.Buffs.DamageOverTime; namespace CalamityMod.Projectiles.Summon { @@ -107,7 +107,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Rectangle frame = texture.Frame(3, 9, Projectile.frame / 9, Projectile.frame % 9); Vector2 origin = frame.Size() * 0.5f; for (int i = 0; i < Projectile.oldPos.Length; i++) diff --git a/Projectiles/Summon/Catastromini.cs b/Projectiles/Summon/Catastromini.cs index 0653abf196..7f7d256486 100644 --- a/Projectiles/Summon/Catastromini.cs +++ b/Projectiles/Summon/Catastromini.cs @@ -84,7 +84,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { SpriteEffects spriteEffects = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; int frameHeight = texture.Height / Main.projFrames[Projectile.type]; int yStart = frameHeight * Projectile.frame; Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, yStart, texture.Width, frameHeight)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, frameHeight / 2f), Projectile.scale, SpriteEffects.None, 0); diff --git a/Projectiles/Summon/CatastropheSummon.cs b/Projectiles/Summon/CatastropheSummon.cs index ecf91cf4d7..48198377b8 100644 --- a/Projectiles/Summon/CatastropheSummon.cs +++ b/Projectiles/Summon/CatastropheSummon.cs @@ -1,7 +1,7 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -55,7 +55,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Rectangle frame = texture.Frame(2, 8, Projectile.frame / 8, Projectile.frame % 8); Vector2 origin = frame.Size() * 0.5f; for (int i = 0; i < Projectile.oldPos.Length; i++) diff --git a/Projectiles/Summon/CausticStaffProjectile.cs b/Projectiles/Summon/CausticStaffProjectile.cs index a6b4b724c7..b7f2697bdb 100644 --- a/Projectiles/Summon/CausticStaffProjectile.cs +++ b/Projectiles/Summon/CausticStaffProjectile.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Summon } public override void AI() { - int fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 0, default, 0.5f); + int fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 0, default, 0.5f); Dust dust = Main.dust[fire]; dust.velocity *= 0.1f; dust.scale = 1.3f; diff --git a/Projectiles/Summon/CausticStaffSummon.cs b/Projectiles/Summon/CausticStaffSummon.cs index 1824738482..41f4126702 100644 --- a/Projectiles/Summon/CausticStaffSummon.cs +++ b/Projectiles/Summon/CausticStaffSummon.cs @@ -48,7 +48,7 @@ namespace CalamityMod.Projectiles.Summon Vector2 rotate = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; rotate = rotate.RotatedBy((double)((float)(dustIndex - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + Projectile.Center; Vector2 faceDirection = rotate - Projectile.Center; - int dusty = Dust.NewDust(rotate + faceDirection, 0, 0, 6, faceDirection.X * 1f, faceDirection.Y * 1f, 100, default, 1.1f); + int dusty = Dust.NewDust(rotate + faceDirection, 0, 0, DustID.Torch, faceDirection.X * 1f, faceDirection.Y * 1f, 100, default, 1.1f); Main.dust[dusty].noGravity = true; Main.dust[dusty].noLight = true; Main.dust[dusty].velocity = faceDirection; @@ -228,7 +228,7 @@ namespace CalamityMod.Projectiles.Summon //Occasionally spawn fiery dust if (Main.rand.NextBool(6)) { - int fire = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 6, 0f, 0f, 100, new Color(), 2f); + int fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, new Color(), 2f); Main.dust[fire].velocity *= 0.3f; Main.dust[fire].noGravity = true; Main.dust[fire].noLight = true; @@ -243,7 +243,7 @@ namespace CalamityMod.Projectiles.Summon //Increment firing cooldown if (Projectile.ai[1] > 0f) { - Projectile.ai[1] += Main.rand.Next(1,4); + Projectile.ai[1] += Main.rand.Next(1, 4); if (Main.rand.NextBool(3)) ++Projectile.ai[1]; } diff --git a/Projectiles/Summon/Cinder.cs b/Projectiles/Summon/Cinder.cs index 55f1bc2a53..4ed48a74b7 100644 --- a/Projectiles/Summon/Cinder.cs +++ b/Projectiles/Summon/Cinder.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Projectiles.Summon { public new string LocalizationCategory => "Projectiles.Summon"; public Player Owner => Main.player[Projectile.owner]; - + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; public override void SetStaticDefaults() diff --git a/Projectiles/Summon/CloudElementalMinion.cs b/Projectiles/Summon/CloudElementalMinion.cs index d576d3b4b5..bb4b1eacb7 100644 --- a/Projectiles/Summon/CloudElementalMinion.cs +++ b/Projectiles/Summon/CloudElementalMinion.cs @@ -1,6 +1,6 @@ -using CalamityMod.CalPlayer; +using System; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -64,7 +64,7 @@ namespace CalamityMod.Projectiles.Summon int dustAmt = 50; for (int d = 0; d < dustAmt; d++) { - int index = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y + 16f), Projectile.width, Projectile.height - 16, 16, 0f, 0f, 0, default, 1f); + int index = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y + 16f), Projectile.width, Projectile.height - 16, DustID.Cloud, 0f, 0f, 0, default, 1f); Main.dust[index].velocity *= 2f; Main.dust[index].scale *= 1.15f; } diff --git a/Projectiles/Summon/CnidarianJellyfishOnTheString.cs b/Projectiles/Summon/CnidarianJellyfishOnTheString.cs index 362bf33118..06d4813b08 100644 --- a/Projectiles/Summon/CnidarianJellyfishOnTheString.cs +++ b/Projectiles/Summon/CnidarianJellyfishOnTheString.cs @@ -1,9 +1,10 @@ -using CalamityMod.DataStructures; -using CalamityMod.Particles; -using System; +using System; using System.Collections.Generic; using System.IO; using System.Linq; +using CalamityMod.DataStructures; +using CalamityMod.Graphics.Primitives; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -135,9 +136,9 @@ namespace CalamityMod.Projectiles.Summon int maxDust = 2 + Main.rand.Next(3); for (int i = 0; i < maxDust; i++) { - Dust.NewDustDirect(Projectile.Center, 0, 0, 226, -3f + Main.rand.NextFloat(0, 6f), -5f, Scale: Main.rand.NextFloat(0.2f, 1f)); + Dust.NewDustDirect(Projectile.Center, 0, 0, DustID.Electric, -3f + Main.rand.NextFloat(0, 6f), -5f, Scale: Main.rand.NextFloat(0.2f, 1f)); - Dust.NewDustDirect(CnidarianPos, 0, 0, 226, -4f + Main.rand.NextFloat(0, 8f), -3f, Scale: Main.rand.NextFloat(0.2f, 1f)); + Dust.NewDustDirect(CnidarianPos, 0, 0, DustID.Electric, -4f + Main.rand.NextFloat(0, 8f), -3f, Scale: Main.rand.NextFloat(0.2f, 1f)); } int[] targetArray = new int[maxTargets]; @@ -166,11 +167,11 @@ namespace CalamityMod.Projectiles.Summon for (int i = 0; i < targetsAquired; i++) { velocity = (Main.npc[targetArray[i]].Center - CnidarianPos).SafeNormalize(Vector2.Zero) * 10f; - + for (int j = 0; j < 3; j++) { Color bloomColor = Main.rand.NextBool() ? (Main.rand.NextBool() ? Color.Gold : Color.Cyan) : Color.SpringGreen; - ElectricSpark spark = new ElectricSpark(CnidarianPos, velocity.RotatedByRandom(MathHelper.PiOver2) * Main.rand.NextFloat(0.2f, 1.3f), Color.Gold, bloomColor, 0.5f + Main.rand.NextFloat(0.5f), 30, bloomScale: 2) ; + ElectricSpark spark = new ElectricSpark(CnidarianPos, velocity.RotatedByRandom(MathHelper.PiOver2) * Main.rand.NextFloat(0.2f, 1.3f), Color.Gold, bloomColor, 0.5f + Main.rand.NextFloat(0.5f), 30, bloomScale: 2); GeneralParticleHandler.SpawnParticle(spark); } @@ -227,7 +228,7 @@ namespace CalamityMod.Projectiles.Summon public Color PrimColorFunction(float completionRatio) { - float timeAfterZap = MathHelper.Clamp( 20 - (Timer - 5 - completionRatio * 12f) % ElectrifyTimer, 0, 20); + float timeAfterZap = MathHelper.Clamp(20 - (Timer - 5 - completionRatio * 12f) % ElectrifyTimer, 0, 20); float postZapTime = 1 - timeAfterZap / 20f; Color startingColor = Color.Lerp(Color.Cyan, Color.Maroon, (float)Math.Pow(postZapTime, 2f)) * (Projectile.timeLeft / (float)FadeoutTime); @@ -241,7 +242,7 @@ namespace CalamityMod.Projectiles.Summon PrimitiveRenderer.RenderTrail(segmentPositions, new(PrimWidthFunction, PrimColorFunction), 66); - Texture2D tex = Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Vector2 squish = new Vector2(2 - StretchRatio(), StretchRatio()); @@ -286,7 +287,8 @@ namespace CalamityMod.Projectiles.Summon { Segments[SegmentCount - 1].position = sentPos; } - catch (Exception) { + catch (Exception) + { CalamityMod.Instance.Logger.Warn("IbanPlay Victide Cnidarian Position Netcode failed safely"); } } diff --git a/Projectiles/Summon/CorroslimeMinion.cs b/Projectiles/Summon/CorroslimeMinion.cs index 42ed83d21c..fde825cff4 100644 --- a/Projectiles/Summon/CorroslimeMinion.cs +++ b/Projectiles/Summon/CorroslimeMinion.cs @@ -58,7 +58,7 @@ namespace CalamityMod.Projectiles.Summon Vector2 rotate = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; rotate = rotate.RotatedBy((double)((float)(i - (constant / 2 - 1)) * 6.28318548f / (float)constant), default) + Projectile.Center; Vector2 faceDirection = rotate - Projectile.Center; - int dust = Dust.NewDust(rotate + faceDirection, 0, 0, 14, faceDirection.X * 1f, faceDirection.Y * 1f, 100, default, 1.1f); + int dust = Dust.NewDust(rotate + faceDirection, 0, 0, DustID.Demonite, faceDirection.X * 1f, faceDirection.Y * 1f, 100, default, 1.1f); Main.dust[dust].noGravity = true; Main.dust[dust].noLight = true; Main.dust[dust].velocity = faceDirection; @@ -82,8 +82,8 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - Texture2D texture2D13 = ModContent.Request(Texture).Value; - int framing = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; + Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + int framing = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; int y6 = framing * Projectile.frame; Main.EntitySpriteDraw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)framing / 2f), Projectile.scale, SpriteEffects.None, 0); return false; diff --git a/Projectiles/Summon/CorruptionSlimeGodMinion.cs b/Projectiles/Summon/CorruptionSlimeGodMinion.cs index 53d0b49efc..7127930079 100644 --- a/Projectiles/Summon/CorruptionSlimeGodMinion.cs +++ b/Projectiles/Summon/CorruptionSlimeGodMinion.cs @@ -56,7 +56,7 @@ namespace CalamityMod.Projectiles.Summon Vector2 rotate = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; rotate = rotate.RotatedBy((double)((float)(i - (constant / 2 - 1)) * 6.28318548f / (float)constant), default) + Projectile.Center; Vector2 faceDirection = rotate - Projectile.Center; - int dust = Dust.NewDust(rotate + faceDirection, 0, 0, 173, faceDirection.X * 1f, faceDirection.Y * 1f, 100, default, 1.1f); + int dust = Dust.NewDust(rotate + faceDirection, 0, 0, DustID.ShadowbeamStaff, faceDirection.X * 1f, faceDirection.Y * 1f, 100, default, 1.1f); Main.dust[dust].noGravity = true; Main.dust[dust].noLight = true; Main.dust[dust].velocity = faceDirection; diff --git a/Projectiles/Summon/CosmicBlast.cs b/Projectiles/Summon/CosmicBlast.cs index 4360f4fe61..1c2884860e 100644 --- a/Projectiles/Summon/CosmicBlast.cs +++ b/Projectiles/Summon/CosmicBlast.cs @@ -2,9 +2,9 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { @@ -44,7 +44,7 @@ namespace CalamityMod.Projectiles.Summon if (Main.rand.NextBool(8)) { Vector2 value3 = Vector2.UnitX.RotatedByRandom(1.5707963705062866).RotatedBy((double)Projectile.velocity.ToRotation(), default); - int rainbowDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 66, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.2f); + int rainbowDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RainbowTorch, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.2f); Main.dust[rainbowDust].noGravity = true; Main.dust[rainbowDust].velocity = value3 * 0.66f; Main.dust[rainbowDust].position = Projectile.Center + value3 * 12f; @@ -65,8 +65,8 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - Texture2D texture2D13 = ModContent.Request(Texture).Value; - int framing = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; + Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + int framing = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; int y6 = framing * Projectile.frame; Main.EntitySpriteDraw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)framing / 2f), Projectile.scale, SpriteEffects.None, 0); return false; @@ -86,15 +86,15 @@ namespace CalamityMod.Projectiles.Summon SoundEngine.PlaySound(SoundID.Zombie103, Projectile.Center); for (int i = 0; i < 3; i++) { - int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.5f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RainbowTorch, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.5f); Main.dust[dust].noGravity = true; } for (int j = 0; j < 30; j++) { - int rainbowDusty = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 66, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 2.5f); + int rainbowDusty = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RainbowTorch, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 2.5f); Main.dust[rainbowDusty].noGravity = true; Main.dust[rainbowDusty].velocity *= 3f; - rainbowDusty = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.5f); + rainbowDusty = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RainbowTorch, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.5f); Main.dust[rainbowDusty].velocity *= 2f; Main.dust[rainbowDusty].noGravity = true; } diff --git a/Projectiles/Summon/CosmicBlastBig.cs b/Projectiles/Summon/CosmicBlastBig.cs index 1b8d36f8e8..46cafc7536 100644 --- a/Projectiles/Summon/CosmicBlastBig.cs +++ b/Projectiles/Summon/CosmicBlastBig.cs @@ -1,10 +1,10 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using CalamityMod.Buffs.DamageOverTime; namespace CalamityMod.Projectiles.Summon { @@ -41,7 +41,7 @@ namespace CalamityMod.Projectiles.Summon if (Main.rand.NextBool(8)) { Vector2 value3 = Vector2.UnitX.RotatedByRandom(1.5707963705062866).RotatedBy((double)Projectile.velocity.ToRotation(), default); - int rainbowDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 66, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.2f); + int rainbowDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RainbowTorch, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.2f); Main.dust[rainbowDust].noGravity = true; Main.dust[rainbowDust].velocity = value3 * 0.66f; Main.dust[rainbowDust].position = Projectile.Center + value3 * 12f; @@ -56,7 +56,7 @@ namespace CalamityMod.Projectiles.Summon { if (Main.rand.NextBool(5)) { - int rainbowDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 66, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.2f); + int rainbowDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RainbowTorch, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.2f); Main.dust[rainbowDust].noGravity = true; } if (Main.rand.NextBool(10) && Main.netMode != NetmodeID.Server) @@ -92,15 +92,15 @@ namespace CalamityMod.Projectiles.Summon SoundEngine.PlaySound(SoundID.Zombie103, Projectile.Center); for (int i = 0; i < 3; i++) { - int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.5f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RainbowTorch, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.5f); Main.dust[dust].noGravity = true; } for (int j = 0; j < 30; j++) { - int rainbowDusty = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 66, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 2.5f); + int rainbowDusty = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RainbowTorch, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 2.5f); Main.dust[rainbowDusty].noGravity = true; Main.dust[rainbowDusty].velocity *= 3f; - rainbowDusty = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.5f); + rainbowDusty = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RainbowTorch, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.5f); Main.dust[rainbowDusty].velocity *= 2f; Main.dust[rainbowDusty].noGravity = true; } diff --git a/Projectiles/Summon/CosmicEnergySpiral.cs b/Projectiles/Summon/CosmicEnergySpiral.cs index c62e9bcf6b..d7e0585150 100644 --- a/Projectiles/Summon/CosmicEnergySpiral.cs +++ b/Projectiles/Summon/CosmicEnergySpiral.cs @@ -1,11 +1,11 @@ -using CalamityMod.Buffs.Summon; +using System; +using CalamityMod.Buffs.Summon; using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { public class CosmicEnergySpiral : ModProjectile, ILocalizedModType diff --git a/Projectiles/Summon/CosmicViperConcussionMissile.cs b/Projectiles/Summon/CosmicViperConcussionMissile.cs index 19f338a353..2766a26437 100644 --- a/Projectiles/Summon/CosmicViperConcussionMissile.cs +++ b/Projectiles/Summon/CosmicViperConcussionMissile.cs @@ -1,9 +1,9 @@ using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { public class CosmicViperConcussionMissile : ModProjectile, ILocalizedModType @@ -64,7 +64,7 @@ namespace CalamityMod.Projectiles.Summon public override void OnKill(int timeLeft) { SoundEngine.PlaySound(SoundID.Item14, Projectile.position); - Projectile.ExpandHitboxBy(50); + Projectile.ExpandHitboxBy(50); for (int i = 0; i < 3; i++) { int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, Main.rand.NextBool(3) ? 56 : 242, 0f, 0f, 100, default, 2f); diff --git a/Projectiles/Summon/CosmicViperHomingRocket.cs b/Projectiles/Summon/CosmicViperHomingRocket.cs index fb259bdc3e..9f0cb319ed 100644 --- a/Projectiles/Summon/CosmicViperHomingRocket.cs +++ b/Projectiles/Summon/CosmicViperHomingRocket.cs @@ -1,9 +1,9 @@ using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { public class CosmicViperHomingRocket : ModProjectile, ILocalizedModType @@ -125,7 +125,7 @@ namespace CalamityMod.Projectiles.Summon public override void OnKill(int timeLeft) { SoundEngine.PlaySound(SoundID.Item14, Projectile.position); - Projectile.ExpandHitboxBy(50); + Projectile.ExpandHitboxBy(50); for (int num621 = 0; num621 < 3; num621++) { int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, Main.rand.NextBool(3) ? 56 : 242, 0f, 0f, 100, default, 2f); diff --git a/Projectiles/Summon/CosmicViperSplittingRocket.cs b/Projectiles/Summon/CosmicViperSplittingRocket.cs index 1bb293ed1e..f439605e5f 100644 --- a/Projectiles/Summon/CosmicViperSplittingRocket.cs +++ b/Projectiles/Summon/CosmicViperSplittingRocket.cs @@ -1,9 +1,9 @@ using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { public class CosmicViperSplittingRocket : ModProjectile, ILocalizedModType @@ -171,7 +171,7 @@ namespace CalamityMod.Projectiles.Summon public override void OnKill(int timeLeft) { - Projectile.ExpandHitboxBy(50); + Projectile.ExpandHitboxBy(50); for (int i = 0; i < 3; i++) { int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, Main.rand.NextBool(3) ? 56 : 242, 0f, 0f, 100, default, 2f); diff --git a/Projectiles/Summon/CosmicViperSummon.cs b/Projectiles/Summon/CosmicViperSummon.cs index 84bf3e4ab2..8f62806777 100644 --- a/Projectiles/Summon/CosmicViperSummon.cs +++ b/Projectiles/Summon/CosmicViperSummon.cs @@ -5,9 +5,9 @@ using CalamityMod.Items.Weapons.Summon; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { public class CosmicViperSummon : ModProjectile, ILocalizedModType @@ -311,7 +311,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; int frameHeight = texture.Height / Main.projFrames[Projectile.type]; int y6 = frameHeight * Projectile.frame; SpriteEffects spriteEffects = SpriteEffects.None; diff --git a/Projectiles/Summon/CosmilampBeam.cs b/Projectiles/Summon/CosmilampBeam.cs index 87ad061d9c..8bc3f2f2bb 100644 --- a/Projectiles/Summon/CosmilampBeam.cs +++ b/Projectiles/Summon/CosmilampBeam.cs @@ -1,8 +1,8 @@ -using CalamityMod.Graphics.Primitives; +using System; +using CalamityMod.Graphics.Primitives; using CalamityMod.Items.Weapons.Summon; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.Graphics.Shaders; using Terraria.ID; diff --git a/Projectiles/Summon/CosmilampMinion.cs b/Projectiles/Summon/CosmilampMinion.cs index 478d91280f..598b85622b 100644 --- a/Projectiles/Summon/CosmilampMinion.cs +++ b/Projectiles/Summon/CosmilampMinion.cs @@ -1,8 +1,8 @@ -using CalamityMod.Buffs.Summon; +using System; +using CalamityMod.Buffs.Summon; using CalamityMod.Items.Weapons.Summon; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -121,7 +121,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Rectangle frame = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); Vector2 origin = frame.Size() * 0.5f; Vector2 drawPosition = Projectile.Center - Main.screenPosition; diff --git a/Projectiles/Summon/CrimslimeMinion.cs b/Projectiles/Summon/CrimslimeMinion.cs index da2f4469f8..f4239eba8b 100644 --- a/Projectiles/Summon/CrimslimeMinion.cs +++ b/Projectiles/Summon/CrimslimeMinion.cs @@ -58,7 +58,7 @@ namespace CalamityMod.Projectiles.Summon Vector2 rotate = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; rotate = rotate.RotatedBy((double)((float)(i - (constant / 2 - 1)) * 6.28318548f / (float)constant), default) + Projectile.Center; Vector2 faceDirection = rotate - Projectile.Center; - int dust = Dust.NewDust(rotate + faceDirection, 0, 0, 5, faceDirection.X * 1f, faceDirection.Y * 1f, 100, default, 1.1f); + int dust = Dust.NewDust(rotate + faceDirection, 0, 0, DustID.Blood, faceDirection.X * 1f, faceDirection.Y * 1f, 100, default, 1.1f); Main.dust[dust].noGravity = true; Main.dust[dust].noLight = true; Main.dust[dust].velocity = faceDirection; @@ -82,7 +82,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - Texture2D texture2D13 = ModContent.Request(Texture).Value; + Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; int framing = texture2D13.Height / Main.projFrames[Projectile.type]; int y6 = framing * Projectile.frame; Main.EntitySpriteDraw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)framing / 2f), Projectile.scale, SpriteEffects.None, 0); diff --git a/Projectiles/Summon/CrimsonSlimeGodMinion.cs b/Projectiles/Summon/CrimsonSlimeGodMinion.cs index 0df9749d66..de7c9f436c 100644 --- a/Projectiles/Summon/CrimsonSlimeGodMinion.cs +++ b/Projectiles/Summon/CrimsonSlimeGodMinion.cs @@ -56,7 +56,7 @@ namespace CalamityMod.Projectiles.Summon Vector2 rotate = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; rotate = rotate.RotatedBy((double)((float)(i - (constant / 2 - 1)) * 6.28318548f / (float)constant), default) + Projectile.Center; Vector2 faceDirection = rotate - Projectile.Center; - int dust = Dust.NewDust(rotate + faceDirection, 0, 0, 5, faceDirection.X * 1f, faceDirection.Y * 1f, 100, default, 1.1f); + int dust = Dust.NewDust(rotate + faceDirection, 0, 0, DustID.Blood, faceDirection.X * 1f, faceDirection.Y * 1f, 100, default, 1.1f); Main.dust[dust].noGravity = true; Main.dust[dust].noLight = true; Main.dust[dust].velocity = faceDirection; diff --git a/Projectiles/Summon/DaedalusCrystal.cs b/Projectiles/Summon/DaedalusCrystal.cs index 7e43adef7d..68aeab7cef 100644 --- a/Projectiles/Summon/DaedalusCrystal.cs +++ b/Projectiles/Summon/DaedalusCrystal.cs @@ -1,6 +1,6 @@ -using CalamityMod.CalPlayer; +using System; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -61,7 +61,7 @@ namespace CalamityMod.Projectiles.Summon int constant = 50; for (int i = 0; i < constant; i++) { - int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y + 16f), Projectile.width, Projectile.height - 16, 173, 0f, 0f, 0, default, 1f); + int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y + 16f), Projectile.width, Projectile.height - 16, DustID.ShadowbeamStaff, 0f, 0f, 0, default, 1f); Main.dust[dust].velocity *= 2f; Main.dust[dust].scale *= 1.15f; } @@ -136,7 +136,7 @@ namespace CalamityMod.Projectiles.Summon projY -= Projectile.Center.Y; int projectileType = ModContent.ProjectileType(); float randSpeed = Main.rand.Next(10, 15); //modify the speed the projectile are shot. Lower number = slower projectile. - Vector2 firingDirection = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); + Vector2 firingDirection = Projectile.Center; float projXDirection = projXStore - firingDirection.X; float projYDirection = projYStore - firingDirection.Y; float projSpeed = (float)Math.Sqrt((double)(projXDirection * projXDirection + projYDirection * projYDirection)); diff --git a/Projectiles/Summon/DaedalusCrystalShot.cs b/Projectiles/Summon/DaedalusCrystalShot.cs index a0b655e073..10f72febfa 100644 --- a/Projectiles/Summon/DaedalusCrystalShot.cs +++ b/Projectiles/Summon/DaedalusCrystalShot.cs @@ -1,8 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { @@ -34,7 +34,7 @@ namespace CalamityMod.Projectiles.Summon } for (int num457 = 0; num457 < 5; num457++) { - int daeDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 1.2f); + int daeDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, 0f, 0f, 100, default, 1.2f); Main.dust[daeDust].noGravity = true; Main.dust[daeDust].velocity *= 0.5f; Main.dust[daeDust].velocity += Projectile.velocity * 0.1f; @@ -46,7 +46,7 @@ namespace CalamityMod.Projectiles.Summon SoundEngine.PlaySound(SoundID.Item74, Projectile.position); for (int i = 0; i < 5; i++) { - int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 1.2f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, 0f, 0f, 100, default, 1.2f); Main.dust[dust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -56,10 +56,10 @@ namespace CalamityMod.Projectiles.Summon } for (int j = 0; j < 10; j++) { - int dust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 1.7f); + int dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, 0f, 0f, 100, default, 1.7f); Main.dust[dust2].noGravity = true; Main.dust[dust2].velocity *= 5f; - dust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 1f); + dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, 0f, 0f, 100, default, 1f); Main.dust[dust2].velocity *= 2f; } } diff --git a/Projectiles/Summon/DaedalusGolem.cs b/Projectiles/Summon/DaedalusGolem.cs index 7b663641c3..2febf13996 100644 --- a/Projectiles/Summon/DaedalusGolem.cs +++ b/Projectiles/Summon/DaedalusGolem.cs @@ -1,12 +1,12 @@ -using CalamityMod.Buffs.Summon; -using Microsoft.Xna.Framework; -using System; +using System; using System.IO; +using CalamityMod.Buffs.Summon; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; using Terraria.WorldBuilding; -using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { diff --git a/Projectiles/Summon/DaedalusLightning.cs b/Projectiles/Summon/DaedalusLightning.cs index 42fbd834b3..4d6959f07d 100644 --- a/Projectiles/Summon/DaedalusLightning.cs +++ b/Projectiles/Summon/DaedalusLightning.cs @@ -1,8 +1,8 @@ -using CalamityMod.Graphics.Primitives; -using Microsoft.Xna.Framework; -using System; +using System; using System.IO; using System.Linq; +using CalamityMod.Graphics.Primitives; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Projectiles/Summon/DaedalusPellet.cs b/Projectiles/Summon/DaedalusPellet.cs index 2f7a2248fd..91e0c7647c 100644 --- a/Projectiles/Summon/DaedalusPellet.cs +++ b/Projectiles/Summon/DaedalusPellet.cs @@ -1,8 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { public class DaedalusPellet : ModProjectile, ILocalizedModType diff --git a/Projectiles/Summon/DankCreeperMinion.cs b/Projectiles/Summon/DankCreeperMinion.cs index 07c506c085..2eca566982 100644 --- a/Projectiles/Summon/DankCreeperMinion.cs +++ b/Projectiles/Summon/DankCreeperMinion.cs @@ -1,9 +1,9 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.Summon; using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -49,7 +49,7 @@ namespace CalamityMod.Projectiles.Summon Vector2 rotate = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; rotate = rotate.RotatedBy((double)((float)(i - (constant / 2 - 1)) * 6.28318548f / (float)constant), default) + Projectile.Center; Vector2 faceDirection = rotate - Projectile.Center; - int dust = Dust.NewDust(rotate + faceDirection, 0, 0, 14, faceDirection.X * 1.5f, faceDirection.Y * 1.5f, 100, default, 1.4f); + int dust = Dust.NewDust(rotate + faceDirection, 0, 0, DustID.Demonite, faceDirection.X * 1.5f, faceDirection.Y * 1.5f, 100, default, 1.4f); Main.dust[dust].noGravity = true; Main.dust[dust].noLight = true; Main.dust[dust].velocity = faceDirection; @@ -128,7 +128,7 @@ namespace CalamityMod.Projectiles.Summon { returnSpeed = 12f; } - Vector2 playerDirection = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); + Vector2 playerDirection = Projectile.Center; float playerXDist = player.Center.X - playerDirection.X; float playerYDist = player.Center.Y - playerDirection.Y - 60f; float playerDist = (float)Math.Sqrt((double)(playerXDist * playerXDist + playerYDist * playerYDist)); @@ -178,7 +178,7 @@ namespace CalamityMod.Projectiles.Summon if (Projectile.ai[1] == 0f) { float hoverSpeed = 8f; //12 - Vector2 playerDirectionAgain = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); + Vector2 playerDirectionAgain = Projectile.Center; float playerXDistAgain = projX - playerDirectionAgain.X; float playerYDistAgain = projY - playerDirectionAgain.Y; float playerDistAgain = (float)Math.Sqrt((double)(playerXDistAgain * playerXDistAgain + playerYDistAgain * playerYDistAgain)); @@ -221,7 +221,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } diff --git a/Projectiles/Summon/DeathstareBeam.cs b/Projectiles/Summon/DeathstareBeam.cs index 95e51450b5..38b884dadb 100644 --- a/Projectiles/Summon/DeathstareBeam.cs +++ b/Projectiles/Summon/DeathstareBeam.cs @@ -1,6 +1,6 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -40,7 +40,7 @@ namespace CalamityMod.Projectiles.Summon } public override bool PreDraw(ref Color lightColor) { - Texture2D beamTexture = ModContent.Request(Texture).Value; + Texture2D beamTexture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Vector2 drawPosition = Projectile.Center + Vector2.UnitY * Projectile.gfxOffY - Main.screenPosition; Vector2 drawScale = new Vector2(0.55f, Projectile.velocity.Length() / beamTexture.Height * 20f); Color color = Color.White * 2.1f * Projectile.Opacity; diff --git a/Projectiles/Summon/DeathstareEyeball.cs b/Projectiles/Summon/DeathstareEyeball.cs index 93b07c395e..fa43a54fce 100644 --- a/Projectiles/Summon/DeathstareEyeball.cs +++ b/Projectiles/Summon/DeathstareEyeball.cs @@ -1,8 +1,8 @@ -using CalamityMod.Buffs.Summon; +using System; +using CalamityMod.Buffs.Summon; using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -77,7 +77,7 @@ namespace CalamityMod.Projectiles.Summon Initialize(Owner); Projectile.ai[0] = 1f; } - + if (Target is null) DoHoveringAI(); else @@ -157,7 +157,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - Texture2D eyeTexture = ModContent.Request(Texture).Value; + Texture2D eyeTexture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Rectangle frame = eyeTexture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); SpriteEffects spriteEffects = Owner.gravDir == 1 ? SpriteEffects.None : SpriteEffects.FlipVertically; Main.EntitySpriteDraw(eyeTexture, Projectile.Center - Main.screenPosition, frame, Projectile.GetAlpha(lightColor), Projectile.rotation, frame.Size() * 0.5f, Projectile.scale, SpriteEffects.None); diff --git a/Projectiles/Summon/DormantBrimseekerAura.cs b/Projectiles/Summon/DormantBrimseekerAura.cs index 95a7453c4e..95d4cff152 100644 --- a/Projectiles/Summon/DormantBrimseekerAura.cs +++ b/Projectiles/Summon/DormantBrimseekerAura.cs @@ -1,10 +1,10 @@ -using CalamityMod.Dusts; +using System; +using CalamityMod.Dusts; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { public class DormantBrimseekerAura : ModProjectile, ILocalizedModType diff --git a/Projectiles/Summon/DormantBrimseekerBab.cs b/Projectiles/Summon/DormantBrimseekerBab.cs index 8b0e1ec13f..cfa29fec4b 100644 --- a/Projectiles/Summon/DormantBrimseekerBab.cs +++ b/Projectiles/Summon/DormantBrimseekerBab.cs @@ -1,13 +1,13 @@ -using CalamityMod.Buffs.Summon; +using System; +using CalamityMod.Buffs.Summon; using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; -using Terraria.ID; -using Terraria.ModLoader; using Terraria.Audio; using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Summon { @@ -157,7 +157,7 @@ namespace CalamityMod.Projectiles.Summon { if ((Projectile.ai[0] > 0f && Projectile.ai[0] <= MaxChargeTime && Projectile.velocity.Length() >= 8f) || SeekingTarget) { - Texture2D projectileTexture = ModContent.Request(Texture).Value; + Texture2D projectileTexture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Texture2D flameTexture = TextureAssets.Extra[ExtrasID.MeteorHeadFlame].Value; SpriteEffects spriteEffects = SpriteEffects.None; if (Projectile.spriteDirection == -1) @@ -167,7 +167,7 @@ namespace CalamityMod.Projectiles.Summon if (Projectile.ai[0] > 30f) completionRatio = 1f - (30f - Projectile.ai[0]) / 30f; - Vector2 modifiedProjectileTexture = new Vector2(projectileTexture.Width / 2,projectileTexture.Height / Main.projFrames[Projectile.type] / 2); + Vector2 modifiedProjectileTexture = new Vector2(projectileTexture.Width / 2, projectileTexture.Height / Main.projFrames[Projectile.type] / 2); for (int oldPositionDrawIndex = 6; oldPositionDrawIndex >= 0; oldPositionDrawIndex--) { Color drawColor = Color.Lerp(Color.LightGoldenrodYellow, new Color(142, 24, 67), completionRatio); diff --git a/Projectiles/Summon/DormantBrimseekerSummoner.cs b/Projectiles/Summon/DormantBrimseekerSummoner.cs index 38d5809a43..e9371d0064 100644 --- a/Projectiles/Summon/DormantBrimseekerSummoner.cs +++ b/Projectiles/Summon/DormantBrimseekerSummoner.cs @@ -1,9 +1,9 @@ using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { public class DormantBrimseekerSummoner : ModProjectile, ILocalizedModType diff --git a/Projectiles/Summon/Dreadmine.cs b/Projectiles/Summon/Dreadmine.cs index 51b9079b8c..3230ecfc43 100644 --- a/Projectiles/Summon/Dreadmine.cs +++ b/Projectiles/Summon/Dreadmine.cs @@ -1,9 +1,9 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { public class Dreadmine : ModProjectile, ILocalizedModType @@ -184,7 +184,7 @@ namespace CalamityMod.Projectiles.Summon SoundEngine.PlaySound(SoundID.Item14, Projectile.position); for (int j = 0; j < 20; j++) { - int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 31, 0f, 0f, 100, default, 2f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Smoke, 0f, 0f, 100, default, 2f); Main.dust[dust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -194,10 +194,10 @@ namespace CalamityMod.Projectiles.Summon } for (int k = 0; k < 30; k++) { - int dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 3f); + int dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 3f); Main.dust[dust2].noGravity = true; Main.dust[dust2].velocity *= 5f; - dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 2f); + dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 2f); Main.dust[dust2].velocity *= 2f; } diff --git a/Projectiles/Summon/DreadmineTurret.cs b/Projectiles/Summon/DreadmineTurret.cs index 9bcb120628..ea90f19aa5 100644 --- a/Projectiles/Summon/DreadmineTurret.cs +++ b/Projectiles/Summon/DreadmineTurret.cs @@ -1,5 +1,5 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Projectiles/Summon/EXPLODINGFROG.cs b/Projectiles/Summon/EXPLODINGFROG.cs index 3237d606ab..a52bc47d1c 100644 --- a/Projectiles/Summon/EXPLODINGFROG.cs +++ b/Projectiles/Summon/EXPLODINGFROG.cs @@ -1,10 +1,10 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; namespace CalamityMod.Projectiles.Summon { @@ -86,13 +86,17 @@ namespace CalamityMod.Projectiles.Summon { Projectile.velocity.Y = 10f; } - - Projectile.StickToTiles(false, false); } public override bool? CanDamage() => false; // Don't die on tile collision public override bool OnTileCollide(Vector2 oldVelocity) => false; + + public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough, ref Vector2 hitboxCenterFrac) + { + fallThrough = false; + return true; + } } } diff --git a/Projectiles/Summon/ElementalAxeMinion.cs b/Projectiles/Summon/ElementalAxeMinion.cs index 3151f632df..18421a635d 100644 --- a/Projectiles/Summon/ElementalAxeMinion.cs +++ b/Projectiles/Summon/ElementalAxeMinion.cs @@ -66,7 +66,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } diff --git a/Projectiles/Summon/EndoBeam.cs b/Projectiles/Summon/EndoBeam.cs index 0b585c5ecc..c2e96a448f 100644 --- a/Projectiles/Summon/EndoBeam.cs +++ b/Projectiles/Summon/EndoBeam.cs @@ -1,8 +1,8 @@ -using Microsoft.Xna.Framework; +using System; +using System.IO; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; -using System; -using System.IO; using Terraria; using Terraria.Enums; using Terraria.ID; diff --git a/Projectiles/Summon/EndoCooperBody.cs b/Projectiles/Summon/EndoCooperBody.cs index 259fe2c373..33109677d6 100644 --- a/Projectiles/Summon/EndoCooperBody.cs +++ b/Projectiles/Summon/EndoCooperBody.cs @@ -4,9 +4,9 @@ using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { @@ -54,7 +54,7 @@ namespace CalamityMod.Projectiles.Summon { dusttype = 80; } - int dust = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, dusttype , Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 50, default, 0.6f); + int dust = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, dusttype, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 50, default, 0.6f); Main.dust[dust].noGravity = true; } @@ -110,22 +110,26 @@ namespace CalamityMod.Projectiles.Summon switch (AttackMode) { - case 0: chasespeed1 = 29f; - chasespeed2 = 16f; - firerate = 60f; - break; - case 1: chasespeed1 = 24f; - chasespeed2 = 12f; - firerate = 200f; + case 0: + chasespeed1 = 29f; + chasespeed2 = 16f; + firerate = 60f; + break; + case 1: + chasespeed1 = 24f; + chasespeed2 = 12f; + firerate = 200f; - break; - case 2: chasespeed1 = 32f; - chasespeed2 = 20f; - firerate = 30f; - break; - case 3: chasespeed1 = 34f; - chasespeed2 = 21f; - firerate = 30f; + break; + case 2: + chasespeed1 = 32f; + chasespeed2 = 20f; + firerate = 30f; + break; + case 3: + chasespeed1 = 34f; + chasespeed2 = 21f; + firerate = 30f; break; } @@ -281,39 +285,41 @@ namespace CalamityMod.Projectiles.Summon switch (AttackMode) { case 0: - SoundEngine.PlaySound(SoundID.Item15, Projectile.position); - Vector2 aimlaser = objectivepos - Projectile.Center; - aimlaser.Normalize(); - aimlaser = aimlaser.RotatedBy(MathHelper.ToRadians(30 * -laserdirection)); - float angularChange = (MathHelper.Pi / 180f) * 1.1f * laserdirection; - //aimlaser *= 12f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, aimlaser, ModContent.ProjectileType(), Projectile.damage, 0f, Projectile.owner, angularChange, (float)Projectile.whoAmI); - laserdirection *= -1; - break; + SoundEngine.PlaySound(SoundID.Item15, Projectile.position); + Vector2 aimlaser = objectivepos - Projectile.Center; + aimlaser.Normalize(); + aimlaser = aimlaser.RotatedBy(MathHelper.ToRadians(30 * -laserdirection)); + float angularChange = (MathHelper.Pi / 180f) * 1.1f * laserdirection; + //aimlaser *= 12f; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, aimlaser, ModContent.ProjectileType(), Projectile.damage, 0f, Projectile.owner, angularChange, (float)Projectile.whoAmI); + laserdirection *= -1; + break; case 1: //Kill limbs - if (limbs.ai[0] == 0f) - { - limbs.ai[0] = 1f; - } - //Respawn limbs - else if (limbs.ai[0] == 2f) - { - limbs.ai[0] = 3f; - } - Projectile.netUpdate = true; - break; + if (limbs.ai[0] == 0f) + { + limbs.ai[0] = 1f; + } + //Respawn limbs + else if (limbs.ai[0] == 2f) + { + limbs.ai[0] = 3f; + } + Projectile.netUpdate = true; + break; - case 2: Projectile.ai[0] = 2f; - Vector2 aimtoenemy = objectivepos - Projectile.Center; - aimtoenemy.Normalize(); - Projectile.velocity = aimtoenemy * 18f; - Projectile.netUpdate = true; - break; - case 3: limbs.ai[0] = 4f; - Projectile.netUpdate = true; - break; - default:break; + case 2: + Projectile.ai[0] = 2f; + Vector2 aimtoenemy = objectivepos - Projectile.Center; + aimtoenemy.Normalize(); + Projectile.velocity = aimtoenemy * 18f; + Projectile.netUpdate = true; + break; + case 3: + limbs.ai[0] = 4f; + Projectile.netUpdate = true; + break; + default: break; } } } diff --git a/Projectiles/Summon/EndoCooperLimbs.cs b/Projectiles/Summon/EndoCooperLimbs.cs index da0a05859b..4d5a6f3be0 100644 --- a/Projectiles/Summon/EndoCooperLimbs.cs +++ b/Projectiles/Summon/EndoCooperLimbs.cs @@ -1,13 +1,13 @@ -using CalamityMod.Buffs.StatDebuffs; +using System; +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Buffs.Summon; using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { @@ -133,7 +133,7 @@ namespace CalamityMod.Projectiles.Summon } public override void PostDraw(Color lightColor) - { + { if (Projectile.ai[0] == 2f) return; diff --git a/Projectiles/Summon/EndoFire.cs b/Projectiles/Summon/EndoFire.cs index ffb48ae5bd..f57a0f69e3 100644 --- a/Projectiles/Summon/EndoFire.cs +++ b/Projectiles/Summon/EndoFire.cs @@ -25,10 +25,10 @@ namespace CalamityMod.Projectiles.Summon Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.penetrate = -1; - Projectile.extraUpdates = 10; + Projectile.extraUpdates = 15; Projectile.usesIDStaticNPCImmunity = true; Projectile.idStaticNPCHitCooldown = 5; - Projectile.timeLeft = 300; + Projectile.timeLeft = 450; Projectile.tileCollide = false; Projectile.coldDamage = true; Projectile.DamageType = DamageClass.Summon; @@ -74,7 +74,7 @@ namespace CalamityMod.Projectiles.Summon if (Main.rand.NextBool()) { - int endoDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 100, default, 0.8f); + int endoDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 100, default, 0.8f); Dust dust = Main.dust[endoDust]; if (Main.rand.NextBool(3)) { diff --git a/Projectiles/Summon/EndoHydraBody.cs b/Projectiles/Summon/EndoHydraBody.cs index 2e2e50ca7d..6d74607809 100644 --- a/Projectiles/Summon/EndoHydraBody.cs +++ b/Projectiles/Summon/EndoHydraBody.cs @@ -2,9 +2,9 @@ using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { diff --git a/Projectiles/Summon/EndoHydraHead.cs b/Projectiles/Summon/EndoHydraHead.cs index d611f61446..660a10c5a6 100644 --- a/Projectiles/Summon/EndoHydraHead.cs +++ b/Projectiles/Summon/EndoHydraHead.cs @@ -1,10 +1,10 @@ -using CalamityMod.DataStructures; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; +using System; using System.Collections.Generic; using System.IO; using System.Linq; +using CalamityMod.DataStructures; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -173,7 +173,7 @@ namespace CalamityMod.Projectiles.Summon { for (int i = 0; i < 10; i++) { - Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 67); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.IceRod); } } public override bool PreDraw(ref Color lightColor) @@ -229,7 +229,7 @@ namespace CalamityMod.Projectiles.Summon // PreDraw is used instead of PostDraw because of draw order. Drawing the chains after the head // would cause them to be drawn on top of the head, which we do not want. - Texture2D headTexture = ModContent.Request(Texture).Value; + Texture2D headTexture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(headTexture, Projectile.Center - Main.screenPosition + Vector2.UnitY * Projectile.gfxOffY, headTexture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame), diff --git a/Projectiles/Summon/EndoIceShard.cs b/Projectiles/Summon/EndoIceShard.cs index 968df25c26..90acd42f3a 100644 --- a/Projectiles/Summon/EndoIceShard.cs +++ b/Projectiles/Summon/EndoIceShard.cs @@ -1,9 +1,9 @@ using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { @@ -38,8 +38,8 @@ namespace CalamityMod.Projectiles.Summon Projectile.ai[1]++; if (Projectile.ai[0] >= 30f) { - Vector2 dspeed = Projectile.velocity * Main.rand.NextFloat(0.3f,0.6f); - int dust = Dust.NewDust(Projectile.Center, 1, 1, 67, dspeed.X, dspeed.Y, 50, default, 1.2f); + Vector2 dspeed = Projectile.velocity * Main.rand.NextFloat(0.3f, 0.6f); + int dust = Dust.NewDust(Projectile.Center, 1, 1, DustID.IceRod, dspeed.X, dspeed.Y, 50, default, 1.2f); Main.dust[dust].noGravity = true; Projectile.ai[0] = 0f; } @@ -115,7 +115,7 @@ namespace CalamityMod.Projectiles.Summon for (int i = 0; i < 10; i++) { Vector2 dspeed = new Vector2(Main.rand.NextFloat(-7f, 7f), Main.rand.NextFloat(-7f, 7f)); - int dust = Dust.NewDust(Projectile.Center, 1, 1, 67, dspeed.X, dspeed.Y, 50, default, 1.2f); + int dust = Dust.NewDust(Projectile.Center, 1, 1, DustID.IceRod, dspeed.X, dspeed.Y, 50, default, 1.2f); Main.dust[dust].noGravity = true; } } diff --git a/Projectiles/Summon/EndoRay.cs b/Projectiles/Summon/EndoRay.cs index 7d153038f0..7373b166b2 100644 --- a/Projectiles/Summon/EndoRay.cs +++ b/Projectiles/Summon/EndoRay.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -37,7 +37,7 @@ namespace CalamityMod.Projectiles.Summon { Vector2 spawnPosition = Projectile.position; spawnPosition -= Projectile.velocity * i * 0.25f; - int idx = Dust.NewDust(spawnPosition, 1, 1, 113, 0f, 0f, 0, default, 1.25f); + int idx = Dust.NewDust(spawnPosition, 1, 1, DustID.Clentaminator_Blue, 0f, 0f, 0, default, 1.25f); Main.dust[idx].position = spawnPosition; Main.dust[idx].scale = Main.rand.NextFloat(0.71f, 0.93f); Main.dust[idx].velocity *= 0.1f; diff --git a/Projectiles/Summon/EnergyOrb.cs b/Projectiles/Summon/EnergyOrb.cs index 114eb15353..f31dba1688 100644 --- a/Projectiles/Summon/EnergyOrb.cs +++ b/Projectiles/Summon/EnergyOrb.cs @@ -26,8 +26,8 @@ namespace CalamityMod.Projectiles.Summon Projectile.localAI[0] += 1f; if (Projectile.localAI[0] > 4f) { - int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 132, 0f, 0f, 100, default, 1f); - if (Main.rand.Next(6) != 0) + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Firework_Blue, 0f, 0f, 100, default, 1f); + if (!Main.rand.NextBool(6)) Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 0f; } diff --git a/Projectiles/Summon/EyeOfNightCell.cs b/Projectiles/Summon/EyeOfNightCell.cs index 18e3fa1f5d..fb4319e683 100644 --- a/Projectiles/Summon/EyeOfNightCell.cs +++ b/Projectiles/Summon/EyeOfNightCell.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { if (!Main.dedServ && Projectile.velocity.Length() > 5f) - Dust.NewDustPerfect(Projectile.Center, (int)CalamityDusts.SulfurousSeaAcid).noGravity = true; + Dust.NewDustPerfect(Projectile.Center, (int)CalamityDusts.SulphurousSeaAcid).noGravity = true; Projectile.StickyProjAI(3); } @@ -39,7 +39,7 @@ namespace CalamityMod.Projectiles.Summon if (!Main.dedServ) { for (int i = 0; i < 10; i++) - Dust.NewDustDirect(Projectile.position, 36, 36, (int)CalamityDusts.SulfurousSeaAcid).noGravity = true; + Dust.NewDustDirect(Projectile.position, 36, 36, (int)CalamityDusts.SulphurousSeaAcid).noGravity = true; } } diff --git a/Projectiles/Summon/EyeOfNightSummon.cs b/Projectiles/Summon/EyeOfNightSummon.cs index 72a2ba68c9..25b0e139ac 100644 --- a/Projectiles/Summon/EyeOfNightSummon.cs +++ b/Projectiles/Summon/EyeOfNightSummon.cs @@ -1,7 +1,7 @@ -using CalamityMod.Buffs.Summon; +using System; +using CalamityMod.Buffs.Summon; using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Projectiles/Summon/FieryDraconid.cs b/Projectiles/Summon/FieryDraconid.cs index 366d0f51f8..dcd0a2b075 100644 --- a/Projectiles/Summon/FieryDraconid.cs +++ b/Projectiles/Summon/FieryDraconid.cs @@ -1,13 +1,13 @@ -using CalamityMod.Buffs.Summon; +using System.IO; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.Summon; using CalamityMod.Items.Weapons.Summon; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System.IO; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using CalamityMod.Buffs.DamageOverTime; namespace CalamityMod.Projectiles.Summon { @@ -202,7 +202,7 @@ namespace CalamityMod.Projectiles.Summon public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(ModContent.BuffType(), 180); - + // Create an explosion and rebound on hitting an NPC if a ram is happening. if (RamCountdown > 0f) { @@ -239,8 +239,8 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { SpriteEffects spriteEffects = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Texture2D texture2D13 = ModContent.Request(Texture).Value; - int framing = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; + Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + int framing = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; int y6 = framing * Projectile.frame; Main.EntitySpriteDraw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Rectangle(0, y6, texture2D13.Width, framing), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture2D13.Width / 2f, framing / 2f), Projectile.scale, spriteEffects, 0); return false; diff --git a/Projectiles/Summon/FlameBlast.cs b/Projectiles/Summon/FlameBlast.cs index e94c7641d6..aed0a92082 100644 --- a/Projectiles/Summon/FlameBlast.cs +++ b/Projectiles/Summon/FlameBlast.cs @@ -1,9 +1,9 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using CalamityMod.Buffs.DamageOverTime; namespace CalamityMod.Projectiles.Summon { @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int i = 0; i < 10; i++) { - int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 100, default, 2f); Main.dust[dust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -52,10 +52,10 @@ namespace CalamityMod.Projectiles.Summon } for (int j = 0; j < 20; j++) { - int dust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 246, 0f, 0f, 100, default, 3f); + int dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GoldCoin, 0f, 0f, 100, default, 3f); Main.dust[dust2].noGravity = true; Main.dust[dust2].velocity *= 5f; - dust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 246, 0f, 0f, 100, default, 2f); + dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GoldCoin, 0f, 0f, 100, default, 2f); Main.dust[dust2].velocity *= 2f; } count += 1f; @@ -65,7 +65,7 @@ namespace CalamityMod.Projectiles.Summon { for (int k = 0; k < 5; k++) { - int otherDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 0.75f); + int otherDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 100, default, 0.75f); Main.dust[otherDust].velocity *= 0f; } } @@ -80,7 +80,7 @@ namespace CalamityMod.Projectiles.Summon { for (int k = 0; k < 5; k++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 244, Projectile.oldVelocity.X * 0f, Projectile.oldVelocity.Y * 0f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.CopperCoin, Projectile.oldVelocity.X * 0f, Projectile.oldVelocity.Y * 0f); } } } diff --git a/Projectiles/Summon/FlameBurst.cs b/Projectiles/Summon/FlameBurst.cs index 6a02840309..3ddb9ff483 100644 --- a/Projectiles/Summon/FlameBurst.cs +++ b/Projectiles/Summon/FlameBurst.cs @@ -1,9 +1,9 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using CalamityMod.Buffs.DamageOverTime; namespace CalamityMod.Projectiles.Summon { @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int i = 0; i < 10; i++) { - int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 100, default, 2f); Main.dust[dust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -52,10 +52,10 @@ namespace CalamityMod.Projectiles.Summon } for (int j = 0; j < 20; j++) { - int dust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 246, 0f, 0f, 100, default, 3f); + int dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GoldCoin, 0f, 0f, 100, default, 3f); Main.dust[dust2].noGravity = true; Main.dust[dust2].velocity *= 5f; - dust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 246, 0f, 0f, 100, default, 2f); + dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GoldCoin, 0f, 0f, 100, default, 2f); Main.dust[dust2].velocity *= 2f; } count += 1f; @@ -65,7 +65,7 @@ namespace CalamityMod.Projectiles.Summon { for (int k = 0; k < 5; k++) { - int otherDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 246, 0f, 0f, 100, default, 0.75f); + int otherDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GoldCoin, 0f, 0f, 100, default, 0.75f); Main.dust[otherDust].velocity *= 0f; } } @@ -80,7 +80,7 @@ namespace CalamityMod.Projectiles.Summon { for (int k = 0; k < 5; k++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 246, Projectile.oldVelocity.X * 0f, Projectile.oldVelocity.Y * 0f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.GoldCoin, Projectile.oldVelocity.X * 0f, Projectile.oldVelocity.Y * 0f); } } } diff --git a/Projectiles/Summon/FleshBlood.cs b/Projectiles/Summon/FleshBlood.cs index e0a70c1d0e..1a850a0e03 100644 --- a/Projectiles/Summon/FleshBlood.cs +++ b/Projectiles/Summon/FleshBlood.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Summon diff --git a/Projectiles/Summon/FlowersOfMortalityPetal.cs b/Projectiles/Summon/FlowersOfMortalityPetal.cs index c5e3c22aa3..5f4b0f4b04 100644 --- a/Projectiles/Summon/FlowersOfMortalityPetal.cs +++ b/Projectiles/Summon/FlowersOfMortalityPetal.cs @@ -1,9 +1,9 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.Summon; using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -83,7 +83,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - Texture2D petalTexture = ModContent.Request(Texture).Value; + Texture2D petalTexture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Texture2D coreTexture = ModContent.Request("CalamityMod/Projectiles/Summon/FlowersOfMortalityCore").Value; Color drawColor = Main.hslToRgb(Hue, 0.95f, 0.5f) * 2.3f; diff --git a/Projectiles/Summon/FlyingOrthocera.cs b/Projectiles/Summon/FlyingOrthocera.cs index d5b37883f8..457566b0c8 100644 --- a/Projectiles/Summon/FlyingOrthocera.cs +++ b/Projectiles/Summon/FlyingOrthocera.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Projectiles.Summon for (int i = 0; i < 56; i++) { float angle = MathHelper.TwoPi / 56f * i; - Dust dust = Dust.NewDustPerfect(Projectile.Center, (int)CalamityDusts.SulfurousSeaAcid); + Dust dust = Dust.NewDustPerfect(Projectile.Center, (int)CalamityDusts.SulphurousSeaAcid); dust.scale = 1.5f; dust.velocity = angle.ToRotationVector2() * 7f; dust.noGravity = true; diff --git a/Projectiles/Summon/FlyingOrthoceraStream.cs b/Projectiles/Summon/FlyingOrthoceraStream.cs index 8cb2f202bc..7304b46fb2 100644 --- a/Projectiles/Summon/FlyingOrthoceraStream.cs +++ b/Projectiles/Summon/FlyingOrthoceraStream.cs @@ -51,7 +51,7 @@ namespace CalamityMod.Projectiles.Summon { Vector2 positionDelta = Projectile.velocity / 3f * i; int spawnDelta = 14; - int dustIdx = Dust.NewDust(new Vector2(Projectile.position.X + spawnDelta, Projectile.position.Y + spawnDelta), Projectile.width - spawnDelta * 2, Projectile.height - spawnDelta * 2, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default, 1f); + int dustIdx = Dust.NewDust(new Vector2(Projectile.position.X + spawnDelta, Projectile.position.Y + spawnDelta), Projectile.width - spawnDelta * 2, Projectile.height - spawnDelta * 2, (int)CalamityDusts.SulphurousSeaAcid, 0f, 0f, 100, default, 1f); Dust dust = Main.dust[dustIdx]; dust.noGravity = true; dust.velocity *= 0.1f; @@ -61,12 +61,12 @@ namespace CalamityMod.Projectiles.Summon if (Main.rand.NextBool(8)) { int spawnDelta = 16; - int dustIdx = Dust.NewDust(new Vector2(Projectile.position.X + spawnDelta, Projectile.position.Y + spawnDelta), Projectile.width - spawnDelta * 2, Projectile.height - spawnDelta * 2, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default, 0.5f); + int dustIdx = Dust.NewDust(new Vector2(Projectile.position.X + spawnDelta, Projectile.position.Y + spawnDelta), Projectile.width - spawnDelta * 2, Projectile.height - spawnDelta * 2, (int)CalamityDusts.SulphurousSeaAcid, 0f, 0f, 100, default, 0.5f); Main.dust[dustIdx].velocity *= 0.25f; Main.dust[dustIdx].velocity += Projectile.velocity * 0.5f; } } - + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(BuffID.Venom, 180); diff --git a/Projectiles/Summon/ForbiddenCircletEater.cs b/Projectiles/Summon/ForbiddenCircletEater.cs index 6263c0dca4..c7789a909f 100644 --- a/Projectiles/Summon/ForbiddenCircletEater.cs +++ b/Projectiles/Summon/ForbiddenCircletEater.cs @@ -62,7 +62,7 @@ namespace CalamityMod.Projectiles.Summon dust.velocity *= 0f; dust.scale = 0.5f; - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + MathHelper.PiOver2; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; float projX = Projectile.position.X; float projY = Projectile.position.Y; float attackDistance = 100000f; @@ -114,7 +114,7 @@ namespace CalamityMod.Projectiles.Summon projY = Projectile.position.Y + (float)(Projectile.height / 2) + Projectile.velocity.Y * 100f; } float projVel = 0.16f; - Vector2 playerDirection = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); + Vector2 playerDirection = Projectile.Center; float playerX = projX - playerDirection.X; float playerY = projY - playerDirection.Y; float playerDist = (float)Math.Sqrt((double)(playerX * playerX + playerY * playerY)); diff --git a/Projectiles/Summon/FrogGore1.cs b/Projectiles/Summon/FrogGore1.cs index 81f4c7a1bc..ebb7d39b47 100644 --- a/Projectiles/Summon/FrogGore1.cs +++ b/Projectiles/Summon/FrogGore1.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.Summon for (int i = 0; i < Main.rand.Next(4, 8 + 1); i++) { Dust.NewDustPerfect(Projectile.Center + Utils.NextVector2Unit(Main.rand) * Main.rand.NextFloat(10f), - (int)CalamityDusts.SulfurousSeaAcid, + (int)CalamityDusts.SulphurousSeaAcid, Main.rand.NextVector2Unit() * Main.rand.NextFloat(1f, 4f)); } } diff --git a/Projectiles/Summon/FrogGore2.cs b/Projectiles/Summon/FrogGore2.cs index 933ccd11ef..4fa8ad1efd 100644 --- a/Projectiles/Summon/FrogGore2.cs +++ b/Projectiles/Summon/FrogGore2.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.Summon for (int i = 0; i < Main.rand.Next(4, 8 + 1); i++) { Dust.NewDustPerfect(Projectile.Center + Utils.NextVector2Unit(Main.rand) * Main.rand.NextFloat(10f), - (int)CalamityDusts.SulfurousSeaAcid, + (int)CalamityDusts.SulphurousSeaAcid, Utils.NextVector2Unit(Main.rand) * Main.rand.NextFloat(1f, 4f)); } } diff --git a/Projectiles/Summon/FrogGore3.cs b/Projectiles/Summon/FrogGore3.cs index 974868c126..a2ff4f7b71 100644 --- a/Projectiles/Summon/FrogGore3.cs +++ b/Projectiles/Summon/FrogGore3.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.Summon for (int i = 0; i < Main.rand.Next(4, 8 + 1); i++) { Dust.NewDustPerfect(Projectile.Center + Utils.NextVector2Unit(Main.rand) * Main.rand.NextFloat(10f), - (int)CalamityDusts.SulfurousSeaAcid, + (int)CalamityDusts.SulphurousSeaAcid, Utils.NextVector2Unit(Main.rand) * Main.rand.NextFloat(1f, 4f)); } } diff --git a/Projectiles/Summon/FrogGore4.cs b/Projectiles/Summon/FrogGore4.cs index 2d0879d911..826b8a7745 100644 --- a/Projectiles/Summon/FrogGore4.cs +++ b/Projectiles/Summon/FrogGore4.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.Summon for (int i = 0; i < Main.rand.Next(4, 8 + 1); i++) { Dust.NewDustPerfect(Projectile.Center + Utils.NextVector2Unit(Main.rand) * Main.rand.NextFloat(10f), - (int)CalamityDusts.SulfurousSeaAcid, + (int)CalamityDusts.SulphurousSeaAcid, Utils.NextVector2Unit(Main.rand) * Main.rand.NextFloat(1f, 4f)); } } diff --git a/Projectiles/Summon/FrogGore5.cs b/Projectiles/Summon/FrogGore5.cs index 947c52c704..6dfaba3b8b 100644 --- a/Projectiles/Summon/FrogGore5.cs +++ b/Projectiles/Summon/FrogGore5.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.Summon for (int i = 0; i < Main.rand.Next(4, 8 + 1); i++) { Dust.NewDustPerfect(Projectile.Center + Utils.NextVector2Unit(Main.rand) * Main.rand.NextFloat(10f), - (int)CalamityDusts.SulfurousSeaAcid, + (int)CalamityDusts.SulphurousSeaAcid, Utils.NextVector2Unit(Main.rand) * Main.rand.NextFloat(1f, 4f)); } } diff --git a/Projectiles/Summon/FrostBeam.cs b/Projectiles/Summon/FrostBeam.cs index 65933c7084..4bea79a3f7 100644 --- a/Projectiles/Summon/FrostBeam.cs +++ b/Projectiles/Summon/FrostBeam.cs @@ -1,5 +1,5 @@ +using System; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -34,7 +34,7 @@ namespace CalamityMod.Projectiles.Summon { Vector2 spawnPosition = Projectile.position; spawnPosition -= Projectile.velocity * i * 0.25f; - int idx = Dust.NewDust(spawnPosition, 1, 1, 113, 0f, 0f, 0, default, 1.25f); + int idx = Dust.NewDust(spawnPosition, 1, 1, DustID.Clentaminator_Blue, 0f, 0f, 0, default, 1.25f); Main.dust[idx].position = spawnPosition; Main.dust[idx].scale = Main.rand.NextFloat(0.75f, 0.85f); Main.dust[idx].velocity *= 0.1f; diff --git a/Projectiles/Summon/FrostBlossom.cs b/Projectiles/Summon/FrostBlossom.cs index 9b586efb4d..3c203d287c 100644 --- a/Projectiles/Summon/FrostBlossom.cs +++ b/Projectiles/Summon/FrostBlossom.cs @@ -1,7 +1,7 @@ -using CalamityMod.Buffs.Summon; +using System; +using CalamityMod.Buffs.Summon; using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Projectiles/Summon/FrostMistFriendly.cs b/Projectiles/Summon/FrostMistFriendly.cs index 3c117c9f9e..35076dce8d 100644 --- a/Projectiles/Summon/FrostMistFriendly.cs +++ b/Projectiles/Summon/FrostMistFriendly.cs @@ -1,9 +1,9 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { public class FrostMistFriendly : ModProjectile, ILocalizedModType @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Summon { for (int i = 0; i < 5; i++) { - int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 187, 0f, 0f, 100, default, 2f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Flare_Blue, 0f, 0f, 100, default, 2f); Main.dust[dust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -98,7 +98,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - Texture2D texture2D13 = ModContent.Request(Texture).Value; + Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; int framing = texture2D13.Height / Main.projFrames[Projectile.type]; int y6 = framing * Projectile.frame; Main.EntitySpriteDraw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)framing / 2f), Projectile.scale, SpriteEffects.None, 0); diff --git a/Projectiles/Summon/GammaHead.cs b/Projectiles/Summon/GammaHead.cs index 2fe5231581..62059832a9 100644 --- a/Projectiles/Summon/GammaHead.cs +++ b/Projectiles/Summon/GammaHead.cs @@ -1,11 +1,11 @@ -using CalamityMod.Buffs.Summon; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using CalamityMod.Buffs.Summon; using CalamityMod.DataStructures; using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System.Collections.Generic; -using System.IO; -using System.Linq; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -107,7 +107,7 @@ namespace CalamityMod.Projectiles.Summon // Release a circle of sulphuric dust. for (int i = 0; i < 18; i++) { - Dust dust = Dust.NewDustPerfect(Projectile.Center, (int)CalamityDusts.SulfurousSeaAcid); + Dust dust = Dust.NewDustPerfect(Projectile.Center, (int)CalamityDusts.SulphurousSeaAcid); dust.velocity = new Vector2(0f, -5f).RotatedBy(i / 18f * MathHelper.TwoPi); dust.noGravity = true; dust.scale = 1.35f; @@ -205,7 +205,7 @@ namespace CalamityMod.Projectiles.Summon return; for (int i = 0; i < 10; i++) - Dust.NewDustPerfect(Projectile.Center, (int)CalamityDusts.SulfurousSeaAcid, Main.rand.NextVector2CircularEdge(4f, 4f)).noGravity = true; + Dust.NewDustPerfect(Projectile.Center, (int)CalamityDusts.SulphurousSeaAcid, Main.rand.NextVector2CircularEdge(4f, 4f)).noGravity = true; } public override bool PreDraw(ref Color lightColor) @@ -251,7 +251,7 @@ namespace CalamityMod.Projectiles.Summon 0); } - Texture2D headTexture = ModContent.Request(Texture).Value; + Texture2D headTexture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(headTexture, Projectile.Center - Main.screenPosition + Vector2.UnitY * Projectile.gfxOffY, headTexture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame), diff --git a/Projectiles/Summon/GastricBelcher.cs b/Projectiles/Summon/GastricBelcher.cs index 13094e746a..3be0bd40f2 100644 --- a/Projectiles/Summon/GastricBelcher.cs +++ b/Projectiles/Summon/GastricBelcher.cs @@ -3,9 +3,9 @@ using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { @@ -303,7 +303,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; int frameHeight = texture.Height / Main.projFrames[Projectile.type]; int y6 = frameHeight * Projectile.frame; SpriteEffects spriteEffects = SpriteEffects.None; diff --git a/Projectiles/Summon/GastricBelcherBubble.cs b/Projectiles/Summon/GastricBelcherBubble.cs index c488b5b94d..d071f10363 100644 --- a/Projectiles/Summon/GastricBelcherBubble.cs +++ b/Projectiles/Summon/GastricBelcherBubble.cs @@ -1,8 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { public class GastricBelcherBubble : ModProjectile, ILocalizedModType @@ -29,7 +29,7 @@ namespace CalamityMod.Projectiles.Summon for (int dustIndex = 0; dustIndex < 10; ++dustIndex) { int scalar = (int)(10 * Projectile.ai[1]); - int bubble = Dust.NewDust(Projectile.Center - Vector2.One * scalar, scalar * 2, scalar * 2, 212, 0.0f, 0.0f, 0, new Color(), 1f); + int bubble = Dust.NewDust(Projectile.Center - Vector2.One * scalar, scalar * 2, scalar * 2, DustID.BubbleBurst_White, 0.0f, 0.0f, 0, new Color(), 1f); Dust dust = Main.dust[bubble]; Vector2 dustVec = Vector2.Normalize(dust.position - Projectile.Center); dust.position = Projectile.Center + dustVec * scalar * Projectile.scale; diff --git a/Projectiles/Summon/GastricBelcherVomit.cs b/Projectiles/Summon/GastricBelcherVomit.cs index b5400015d3..91a23b1890 100644 --- a/Projectiles/Summon/GastricBelcherVomit.cs +++ b/Projectiles/Summon/GastricBelcherVomit.cs @@ -1,10 +1,10 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.StatDebuffs; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using CalamityMod.Buffs.StatDebuffs; namespace CalamityMod.Projectiles.Summon { @@ -47,7 +47,7 @@ namespace CalamityMod.Projectiles.Summon int splash = 0; while (splash < 4) { - Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 233, -Projectile.velocity.X * 0.15f, -Projectile.velocity.Y * 0.10f, 150, default, 0.9f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GoldCritter_LessOutline, -Projectile.velocity.X * 0.15f, -Projectile.velocity.Y * 0.10f, 150, default, 0.9f); splash += 1; } } @@ -57,11 +57,14 @@ namespace CalamityMod.Projectiles.Summon Texture2D texture; switch (Projectile.ai[0]) { - case 1f: texture = ModContent.Request("CalamityMod/Projectiles/Summon/GastricBelcherVomit2").Value; + case 1f: + texture = ModContent.Request("CalamityMod/Projectiles/Summon/GastricBelcherVomit2").Value; break; - case 2f: texture = ModContent.Request("CalamityMod/Projectiles/Summon/GastricBelcherVomit3").Value; + case 2f: + texture = ModContent.Request("CalamityMod/Projectiles/Summon/GastricBelcherVomit3").Value; break; - default: texture = ModContent.Request(Texture).Value; + default: + texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; break; } Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, new Rectangle?(new Rectangle(0, 0, texture.Width, texture.Height)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, texture.Height / 2f), Projectile.scale, SpriteEffects.None, 0); diff --git a/Projectiles/Summon/GhostFire.cs b/Projectiles/Summon/GhostFire.cs index 0fa13c51e1..79aa43ef9b 100644 --- a/Projectiles/Summon/GhostFire.cs +++ b/Projectiles/Summon/GhostFire.cs @@ -1,7 +1,7 @@ -using CalamityMod.CalPlayer; +using System; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -100,7 +100,7 @@ namespace CalamityMod.Projectiles.Summon } public void KillTheThing(NPC npc) { - Projectile.velocity = Projectile.SuperhomeTowardsTarget(npc, 50f/(Projectile.extraUpdates+1), 60f / (Projectile.extraUpdates + 1), 1f / (Projectile.extraUpdates + 1)); //predictionStrength is lessened to account for extra updates, otherwise the projectile tends to copy fast NPC movement 1:1. Not Cool. + Projectile.velocity = Projectile.SuperhomeTowardsTarget(npc, 50f / (Projectile.extraUpdates + 1), 60f / (Projectile.extraUpdates + 1), 1f / (Projectile.extraUpdates + 1)); //predictionStrength is lessened to account for extra updates, otherwise the projectile tends to copy fast NPC movement 1:1. Not Cool. } public override bool PreDraw(ref Color lightColor) //photoviscerator ball drawcode, slightly edited { @@ -110,7 +110,7 @@ namespace CalamityMod.Projectiles.Summon float colorInterpolation = (float)Math.Cos(Projectile.timeLeft / 32f + Main.GlobalTimeWrappedHourly / 20f + i / (float)Projectile.oldPos.Length * MathHelper.Pi) * 0.5f + 0.5f; Color color = Color.Lerp(Color.Cyan, Color.LightBlue, colorInterpolation) * 0.4f; color.A = 0; - Vector2 drawPosition = Projectile.oldPos[i] + lightTexture.Size() * 0.5f - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY) + new Vector2 (-28f, -28f); //Last vector is to offset the circle so that it is displayed where the hitbox actually is, instead of a bit down and to the right. + Vector2 drawPosition = Projectile.oldPos[i] + lightTexture.Size() * 0.5f - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY) + new Vector2(-28f, -28f); //Last vector is to offset the circle so that it is displayed where the hitbox actually is, instead of a bit down and to the right. Color outerColor = color; Color innerColor = color * 0.5f; float intensity = 0.9f + 0.15f * (float)Math.Cos(Main.GlobalTimeWrappedHourly % 60f * MathHelper.TwoPi); diff --git a/Projectiles/Summon/GhostlyMine.cs b/Projectiles/Summon/GhostlyMine.cs index 274acd6d97..bf0743ead8 100644 --- a/Projectiles/Summon/GhostlyMine.cs +++ b/Projectiles/Summon/GhostlyMine.cs @@ -1,9 +1,9 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { @@ -47,7 +47,7 @@ namespace CalamityMod.Projectiles.Summon { for (int i = 0; i < 10; i++) { - int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 180, 0f, 0f, 100, default, 2f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.DungeonSpirit, 0f, 0f, 100, default, 2f); Main.dust[dust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -57,10 +57,10 @@ namespace CalamityMod.Projectiles.Summon } for (int j = 0; j < 15; j++) { - int dust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 180, 0f, 0f, 100, default, 3f); + int dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.DungeonSpirit, 0f, 0f, 100, default, 3f); Main.dust[dust2].noGravity = true; Main.dust[dust2].velocity *= 5f; - dust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 180, 0f, 0f, 100, default, 2f); + dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.DungeonSpirit, 0f, 0f, 100, default, 2f); Main.dust[dust2].velocity *= 2f; } spawnDust = false; @@ -87,7 +87,7 @@ namespace CalamityMod.Projectiles.Summon SoundEngine.PlaySound(SoundID.Item14, Projectile.position); for (int i = 0; i < 30; i++) { - int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 180, 0f, 0f, 100, default, 1.2f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.DungeonSpirit, 0f, 0f, 100, default, 1.2f); Main.dust[dust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -97,10 +97,10 @@ namespace CalamityMod.Projectiles.Summon } for (int j = 0; j < 60; j++) { - int dust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 180, 0f, 0f, 100, default, 1.7f); + int dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.DungeonSpirit, 0f, 0f, 100, default, 1.7f); Main.dust[dust2].noGravity = true; Main.dust[dust2].velocity *= 5f; - dust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 180, 0f, 0f, 100, default, 1f); + dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.DungeonSpirit, 0f, 0f, 100, default, 1f); Main.dust[dust2].velocity *= 2f; } } diff --git a/Projectiles/Summon/GiantIbanRobotOfDoom.cs b/Projectiles/Summon/GiantIbanRobotOfDoom.cs index b99c8babf8..ddb1374ee2 100644 --- a/Projectiles/Summon/GiantIbanRobotOfDoom.cs +++ b/Projectiles/Summon/GiantIbanRobotOfDoom.cs @@ -1,13 +1,13 @@ -using CalamityMod.Buffs.Mounts; +using System; +using CalamityMod.Buffs.Mounts; using CalamityMod.Items; +using CalamityMod.Items.Weapons.DraedonsArsenal; using CalamityMod.Projectiles.Summon.AndromedaUI; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using System; -using Terraria.Audio; -using CalamityMod.Items.Weapons.DraedonsArsenal; namespace CalamityMod.Projectiles.Summon { @@ -114,13 +114,13 @@ namespace CalamityMod.Projectiles.Summon Vector2 center = player.Center + new Vector2(6f, -2f).RotatedBy(player.velocity.ToRotation()); - int idx = Dust.NewDust(center, 0, 0, 226, 0f, 0f, 100, default, 0.5f); + int idx = Dust.NewDust(center, 0, 0, DustID.Electric, 0f, 0f, 100, default, 0.5f); Main.dust[idx].noGravity = true; Main.dust[idx].position = center + spinningPoint; Main.dust[idx].velocity = Vector2.Zero; spinningPoint *= -1f; - idx = Dust.NewDust(center, 0, 0, 226, 0f, 0f, 100, default, 0.5f); + idx = Dust.NewDust(center, 0, 0, DustID.Electric, 0f, 0f, 100, default, 0.5f); Main.dust[idx].noGravity = true; Main.dust[idx].position = center + spinningPoint; Main.dust[idx].velocity = Vector2.Zero; @@ -171,7 +171,7 @@ namespace CalamityMod.Projectiles.Summon { if (Main.myPlayer == player.whoAmI) { - Projectile ui = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), + Projectile ui = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Main.MouseWorld, Vector2.Zero, ModContent.ProjectileType(), diff --git a/Projectiles/Summon/GlacialEmbracePointyThing.cs b/Projectiles/Summon/GlacialEmbracePointyThing.cs index c91831d4a8..287b3c2479 100644 --- a/Projectiles/Summon/GlacialEmbracePointyThing.cs +++ b/Projectiles/Summon/GlacialEmbracePointyThing.cs @@ -1,11 +1,11 @@ -using CalamityMod.CalPlayer; -using Microsoft.Xna.Framework; -using System; +using System; using System.IO; +using CalamityMod.CalPlayer; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { @@ -33,7 +33,7 @@ namespace CalamityMod.Projectiles.Summon if (target != null) //target found { float projVel = 40f; - Vector2 targetDirection = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); + Vector2 targetDirection = Projectile.Center; float targetX = target.Center.X - targetDirection.X; float targetY = target.Center.Y - targetDirection.Y; float targetDist = (float)Math.Sqrt((double)(targetX * targetX + targetY * targetY)); @@ -195,7 +195,7 @@ namespace CalamityMod.Projectiles.Summon } if (circlingPlayer) { - float math = recharging == 0 ? 90f :(300 - recharging) / 3; + float math = recharging == 0 ? 90f : (300 - recharging) / 3; float regularDistance = math > 90f ? 90f : math; Projectile.Center = player.Center + Projectile.ai[0].ToRotationVector2() * regularDistance; Projectile.rotation = Projectile.ai[0] + (float)Math.Atan(90); diff --git a/Projectiles/Summon/HallowedStarSummon.cs b/Projectiles/Summon/HallowedStarSummon.cs index 8eb019ffd6..c87acbafe7 100644 --- a/Projectiles/Summon/HallowedStarSummon.cs +++ b/Projectiles/Summon/HallowedStarSummon.cs @@ -1,11 +1,11 @@ -using CalamityMod.Dusts; +using System; +using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { @@ -94,7 +94,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.position -= Projectile.Size; for (int i = 0; i < 5; i++) { - int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 16, 0f, 0f, 100, default, 1.2f); + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Cloud, 0f, 0f, 100, default, 1.2f); Main.dust[idx].velocity *= 3f; if (Main.rand.NextBool()) { diff --git a/Projectiles/Summon/HarvestStaffMinion.cs b/Projectiles/Summon/HarvestStaffMinion.cs new file mode 100644 index 0000000000..c00e7bf69b --- /dev/null +++ b/Projectiles/Summon/HarvestStaffMinion.cs @@ -0,0 +1,624 @@ +using System; +using System.IO; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.GameContent.Events; +using Terraria.ID; +using Terraria.ModLoader; +using static CalamityMod.Items.Weapons.Summon.HarvestStaff; + +namespace CalamityMod.Projectiles.Summon +{ + public class HarvestStaffMinion : ModProjectile, ILocalizedModType + { + #region Members and Enums + + public new string LocalizationCategory => "Projectiles.Summon"; + + /// + /// The size of the pumpkin. + /// + public ref float Variant => ref Projectile.ai[0]; + + /// + /// The states of behaviour of this pumpkin. + /// + public enum AIState { Still, Idle, Attack } + + /// + /// The current state of behaviour of this pumpkin. + /// + public AIState State + { + get => (AIState)Projectile.ai[1]; + set + { + Projectile.ai[1] = (float)value; + + if (value == AIState.Attack) + { + Animation = AnimationState.Run; + SoundEngine.PlaySound(_screamSound, Projectile.Center); + } + else if (value == AIState.Idle) + Animation = AnimationState.Idle; + + NetUpdate(); + } + } + + /// + /// The maximum time that the pumpkin will walk on its idle state.
+ /// It's set to a random amount at a random moment. + ///
+ public int IdleWalkingTime { get; set; } + + /// + /// The timer on which the pumpkin is while walking.
+ /// When the timer reaches 0, the pumpkin will stop walking. + ///
+ public int IdleWalkingTimer { get; set; } + + /// + /// The direction in which the pumpkin walks while idle.
+ /// If the pumpkin is within a certain range from the sentry (Or if it doesn't exist), it'll go to a random direction.
+ /// Otherwise, it'll try to always be nearby the sentry. + ///
+ public int IdleWalkingDirection { get; set; } + + /// + /// Keeps track of the amount of jumps that the pumpkin has done when the owner is nearby.
+ /// When it reaches a certain amount, the minion will go on a cooldown before jumping again. + ///
+ public int IdleJumpCount { get; set; } + + /// + /// The cooldown of the pumpkin for jumping again.
+ /// When it reaches 0, the pumpkin will stop walking. + ///
+ public int IdleJumpCooldown { get; set; } + + /// + /// The states of the animation that the pumpkin has.
+ /// Their indeces are used when selecting which spritesheet it uses. + ///
+ public enum AnimationState { None = -1, Grow, Rise, Idle, Run, Jump } + + /// + /// The current state of animation of the pumpkin. + /// + public AnimationState Animation + { + get => (AnimationState)Projectile.ai[2]; + set + { + if (value != Animation) + { + Projectile.frame = 0; + Projectile.frameCounter = 0; + } + + Projectile.ai[2] = (float)value; + + switch (value) + { + case AnimationState.Grow: + AnimationFrames = Variant == 0 ? 6 : 4; + FramesUntilNextAnimationFrame = 6; + break; + + case AnimationState.Rise: + AnimationFrames = 10; + FramesUntilNextAnimationFrame = 5; + break; + + case AnimationState.Idle: + case AnimationState.Jump: + AnimationFrames = 1; + FramesUntilNextAnimationFrame = 0; + break; + + case AnimationState.Run: + AnimationFrames = 6; + FramesUntilNextAnimationFrame = 5; + break; + } + + NetUpdate(); + } + } + + /// + /// The amount of frames that the current animation's spritesheet has. + /// + public int AnimationFrames { get; set; } + + /// + /// The amount of time, in frames, that it'll take to go to the next frame of animation. + /// + public int FramesUntilNextAnimationFrame { get; set; } + + /// + /// A convienent bool for when the animation has been completed.
+ /// Ends at - 1 because starts at 0. + ///
+ public bool CompletedAnimation => Projectile.frame >= AnimationFrames - 1; + + /// + /// A convient way to set the direction of the sprite without typing it out the long way. + /// + public int Direction + { + get => Projectile.spriteDirection; + set => Projectile.spriteDirection = Projectile.direction = value; + } + + private SoundStyle _growSound = new("CalamityMod/Sounds/Custom/PumpkinEmerge", 3); + + private SoundStyle _idleSound = new("CalamityMod/Sounds/Custom/PumpkinIdle", 4); + + private SoundStyle _idleRareSound = new("CalamityMod/Sounds/Custom/PumpkinRareIdle") { Volume = 0.2f }; + + private SoundStyle _screamSound = new("CalamityMod/Sounds/Custom/PumpkinScream", 2) { Volume = 0.5f }; + + private SoundStyle _jumpSound = new("CalamityMod/Sounds/Custom/PumpkinJump"); + + private SoundStyle _boomSound = new("CalamityMod/Sounds/Custom/PumpkinExplode", 2) { Volume = 0.6f }; + + private SoundStyle _boomSoundGFB = new("CalamityMod/Sounds/Custom/PumpkinExplodeGFB", 2); + + /// + /// The owner of this minion. + /// + public Player Owner { get; set; } + + public Player AnyPlayer + { + get + { + for (int i = 0; i < Main.maxPlayers; i++) + { + Player p = Main.player[i]; + if (p == null || !p.active || p.dead || !Projectile.Center.WithinRange(p.Center, 64f)) + continue; + return p; + } + return null; + } + } + + /// + /// The target of this minion. + /// + public NPC Target { get; set; } + + /// + /// The sentry of this minion. + /// + public Projectile MySentry + { + get + { + for (int i = 0; i < Main.maxProjectiles; i++) + { + Projectile proj = Main.projectile[i]; + if (proj == null || !proj.active || proj.owner != Projectile.owner || proj.type != ModContent.ProjectileType()) + continue; + return proj; + } + return null; + } + } + + public int NetUpdateTimer { get; set; } + + #endregion + + #region AI and Collisions + + public override void AI() + { + if (Animation == AnimationState.Grow && (MySentry is null || Projectile.Distance(MySentry.Center) > 600f)) + { + Projectile.Kill(); + NetUpdate(); + } + + Target = Projectile.Center.MinionHoming(State == AIState.Still ? PlantedEnemyDistanceDetection : NormalEnemyDistanceDetection, Owner, false); + + switch (State) + { + case AIState.Still: + StillState(); + break; + case AIState.Idle: + IdleState(); + break; + case AIState.Attack: + AttackState(); + break; + } + + if (IdleJumpCooldown > 0) + IdleJumpCooldown--; + + Projectile.timeLeft = 2; + DoGravity(); + DoAnimation(); + + NetUpdateTimer++; + if (NetUpdateTimer > 60) + { + NetUpdateTimer = 0; + NetUpdate(); + } + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + // When the pumpkin touches the ground after spawning, start the growing animation. + if (Animation == AnimationState.None) + Animation = AnimationState.Grow; + + if (State == AIState.Idle && Projectile.velocity.Y == 0f) + { + // While the pumpkin's idle and standing still on the ground, when the player gets close it'll jump. + if (AnyPlayer is not null && Projectile.WithinRange(AnyPlayer.Center, 64f) && IdleJumpCooldown == 0) + NearOwnerJump(); + else + Animation = IdleWalkingTimer == 0f ? AnimationState.Idle : AnimationState.Run; + } + + // If the minion's standing still at a certain distance from the target: jump. + if (Target is not null && State == AIState.Attack && Projectile.velocity.Y == 0f) + { + if (MathF.Abs(Target.Center.X - Projectile.Center.X) < 160f && Target.Top.Y < Projectile.Bottom.Y) + { + if (PlatformBetweenMinionAndTarget(out Vector2 platformPosition)) + JumpTowards(platformPosition - Vector2.UnitY * 32f); + else + JumpTowards(Target.Top); + } + else + Animation = AnimationState.Run; + } + + return false; + } + + public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough, ref Vector2 hitboxCenterFrac) + { + fallThrough = Target is not null && Projectile.Bottom.Y < Target.Top.Y; + return true; + } + + public override void OnKill(int timeLeft) + { + if (State != AIState.Attack) + return; + + Projectile.ExpandHitboxBy(4f); + Projectile.Damage(); + + for (int i = 0; i < (int)Utils.Remap(Variant, 0f, 2f, 4f, 2f); i++) + { + float angle = MathHelper.TwoPi / 4 * i; + Vector2 velocity = angle.ToRotationVector2() * Main.rand.NextFloat(3f, 5f); + Gore gore = Gore.NewGoreDirect(Projectile.GetSource_Death(), Projectile.Center, velocity, Mod.Find($"PumpkinGore{Main.rand.Next(6) + 1}").Type, Utils.Remap(Variant, 0f, 2f, 1f, 0.5f)); + gore.timeLeft = 15; + } + + NetUpdate(); + + if (Main.dedServ) + return; + + for (int i = 0; i < 20; i++) + { + if (BirthdayParty.PartyIsUp) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.Next(139, 143), (new Vector2(2, 2).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1.5f)) + new Vector2(0, -0.75f)); + dust.scale = 0.8f; + } + else + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(4) ? 278 : 51, (new Vector2(2, 2).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1.5f)) + new Vector2(0, -0.75f)); + dust.noGravity = false; + dust.scale = Main.rand.NextFloat(0.8f, 1.4f); + dust.color = Color.Chocolate; + } + } + + if (Main.zenithWorld) + SoundEngine.PlaySound(_boomSoundGFB, Projectile.Center); + else + SoundEngine.PlaySound(_boomSound, Projectile.Center); + } + + /// + /// The behaviour of this summon while it is planted on the ground. + /// + public void StillState() + { + // When the pumpkin has done its growing animation and there's a target nearby or the owner's on top of it, + // it'll do the jump out animation. + if ((Target is not null || (AnyPlayer is not null && Projectile.getRect().Intersects(AnyPlayer.getRect()))) && Animation == AnimationState.Grow && CompletedAnimation) + { + Animation = AnimationState.Rise; + SoundEngine.PlaySound(_growSound, Projectile.Center); + } + + // And when they have completed their jumping out animation, they idle until they find a target. + else if (Animation == AnimationState.Rise && CompletedAnimation) + State = AIState.Idle; + } + + /// + /// The behaviour of this usmmon while it's idle. + /// + public void IdleState() + { + // If a target has been detected, go to the attack state. + if (Target is not null) + { + State = AIState.Attack; + return; + } + + // If the pumpkin's not already walking, at a random chance it'll decide to walk. + if (IdleWalkingTimer == 0f && Main.rand.NextBool(400)) + { + IdleWalkingTime = IdleWalkingTimer = Main.rand.Next(60, 180); + IdleWalkingDirection = MySentry == null || Projectile.WithinRange(MySentry.Center, 960f) ? (Main.rand.NextBool() ? -1 : 1) : MathF.Sign(MySentry.Center.X - Projectile.Center.X); + NetUpdate(); + } + + else if (IdleWalkingTimer != 0f) + { + // The pumpkin will accelerate when starting to walk and deaccelerate when it's about to end. + Projectile.velocity.X = MathHelper.Lerp(0f, 3f, CalamityUtils.Convert01To010(Utils.GetLerpValue(0f, IdleWalkingTime, IdleWalkingTimer))) * IdleWalkingDirection; + + Direction = MathF.Sign(Projectile.velocity.X); + + IdleWalkingTimer--; + if (IdleWalkingTimer == 0f) + { + Projectile.velocity.X = 0f; + Animation = AnimationState.Idle; + } + } + + // When the pumpkin encounters a 1-tile-height obstacle, it'll climb it, like the player. + Collision.StepUp(ref Projectile.position, ref Projectile.velocity, Projectile.width, Projectile.height, ref Projectile.stepSpeed, ref Projectile.gfxOffY); + + if (Main.rand.NextBool(700)) + SoundEngine.PlaySound(Main.rand.NextBool(20) ? _idleRareSound : _idleSound, Projectile.Center); + } + + /// + /// The behaviour of this summon in its attack state. + /// + public void AttackState() + { + if (Target is not null) + { + MoveToTarget(); + Direction = MathF.Sign(Projectile.velocity.X); + + // When the pumpkin encounters a 1-tile-height obstacle, it'll climb it, like the player. + Collision.StepUp(ref Projectile.position, ref Projectile.velocity, Projectile.width, Projectile.height, ref Projectile.stepSpeed, ref Projectile.gfxOffY); + + // Pumpkins relase a bit of fire from their heads when running after enemies + if (!Main.dedServ) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center + new Vector2(0, -Projectile.height * 0.5f), 6, new Vector2(0, -4).RotatedBy(0.7f * -Projectile.direction) * Main.rand.NextFloat(0.1f, 0.8f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.4f, 0.95f); + } + } + else + { + Projectile.velocity.X = 0f; + State = AIState.Idle; + } + } + + /// + /// The minion does a small jump, to give it some flavor and cuteness. + /// + public void NearOwnerJump() + { + // Actually jumps. + Projectile.velocity.Y = -8f; + + // After 2 hops the summon goes on a cooldown before jumping again. + IdleJumpCount++; + if (IdleJumpCount == 2) + { + IdleJumpCount = 0; + IdleJumpCooldown = 30; + } + + Direction = MathF.Sign(AnyPlayer.Center.X - Projectile.Center.X); + Animation = AnimationState.Jump; + + SoundEngine.PlaySound(_jumpSound with { Pitch = Utils.Remap(Variant, 0f, 2f, -0.3f, 0.3f) }, Projectile.Center); + + NetUpdate(); + } + + /// + /// The minion will start moving to the target with acceleration. + /// + public void MoveToTarget() + { + // If the variant's smaller (Variant 2 is the smallest), it has a faster acceleration and a higher max velocity. + float maxVelocity = Utils.Remap(Variant, 0f, 2f, 5f, 8f); + float acceleration = Utils.Remap(Variant, 0f, 2f, 0.1f, 0.3f); + float accelerationDirection = MathF.Sign(Target.Center.X - Projectile.Center.X); + + Projectile.velocity.X += acceleration * accelerationDirection; + if (MathF.Abs(Projectile.velocity.X) > maxVelocity) + Projectile.velocity.X = maxVelocity * accelerationDirection; + } + + /// + /// The minion will jump towards a destination in the Y-axis. + /// + /// The Y position at which the minion will jump towards + public void JumpTowards(Vector2 destination) + { + // Equation of a free fall independent of time: v = sqrt(2 * gravity * distance). + // Because we want it to go up and now down, we need to negate the constant: v = sqrt(-2 * gravity * distance). + // And now we need to negate the velocity to get it on Terraria's coordinate system: v = -sqrt(-2 * gravity * distance). + Projectile.velocity.Y = -MathF.Sqrt(-2f * PumpkinGravityStrength * (destination.Y - Projectile.Bottom.Y)); + Animation = AnimationState.Jump; + SoundEngine.PlaySound(_jumpSound with { Pitch = Utils.Remap(Variant, 0f, 2f, -0.3f, 0.3f) }, Projectile.Center); + NetUpdate(); + } + + /// + /// Detects a platform between the minion and the target. + /// + /// The position of said platform as a . + /// Whether there's a platform or not. + public bool PlatformBetweenMinionAndTarget(out Vector2 tilePosition) + { + Point minionPosition = Projectile.Center.ToSafeTileCoordinates(); + Point targetPosition = Target.Center.ToSafeTileCoordinates(); + for (int coordY = minionPosition.Y; coordY > targetPosition.Y; coordY--) + { + if (Main.tile[targetPosition.X, coordY].IsTileSolidGround()) + { + tilePosition = new Vector2(targetPosition.X, coordY) * 16f; + return true; + } + } + + tilePosition = Vector2.Zero; + return false; + } + + /// + /// Applies gravity to the minion. + /// + public void DoGravity() + { + float speed = Projectile.velocity.Y; + if (speed < PumpkinMaxGravity) + speed = MathF.Min(speed + PumpkinGravityStrength, PumpkinMaxGravity); + Projectile.velocity.Y = speed; + } + + /// + /// Does the animation of the minion. + /// + public void DoAnimation() + { + // If the state of the animation's spritsheet is only 1 frame, no need to animate. + if (Animation == AnimationState.None || Animation == AnimationState.Idle || Animation == AnimationState.Jump) + return; + + Projectile.frameCounter++; + if (Projectile.frameCounter % FramesUntilNextAnimationFrame == 0) + { + Projectile.frame = Math.Min(Projectile.frame + 1, AnimationFrames - 1); + + // If it's the run animation, loop it. + if (Animation == AnimationState.Run && CompletedAnimation) + Projectile.frame = 0; + } + } + + /// + /// A covenient way to do a while also handling . + /// + public void NetUpdate() + { + Projectile.netUpdate = true; + if (Projectile.netSpam >= 10) + Projectile.netSpam = 9; + } + + #endregion + + #region Other Overrides + + public override void SetStaticDefaults() + { + Main.projFrames[Type] = 68; + ProjectileID.Sets.MinionShot[Type] = true; + } + + public override void SetDefaults() + { + Projectile.DamageType = DamageClass.Summon; + Projectile.localNPCHitCooldown = 30; + Projectile.friendly = true; + Projectile.tileCollide = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.netImportant = true; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(IdleWalkingTime); + writer.Write(IdleWalkingTimer); + writer.Write(IdleJumpCount); + writer.Write(IdleJumpCooldown); + writer.Write(IdleWalkingDirection); + writer.Write(NetUpdateTimer); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + IdleWalkingTime = reader.ReadInt32(); + IdleWalkingTimer = reader.ReadInt32(); + IdleJumpCount = reader.ReadInt32(); + IdleJumpCooldown = reader.ReadInt32(); + IdleWalkingDirection = reader.ReadInt32(); + NetUpdateTimer = reader.ReadInt32(); + } + + public override bool? CanDamage() => State == AIState.Attack ? null : false; + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => NetUpdate(); + + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) => modifiers.SourceDamage *= Utils.Remap(Variant, 0f, 2f, 1.5f, 0.5f); + + public override void OnSpawn(IEntitySource source) + { + Owner = Main.player[Projectile.owner]; + Projectile.width = Projectile.height = Variant == 0 ? 28 : (Variant == 1 ? 22 : 20); + Direction = Main.rand.NextBool() ? -1 : 1; + Animation = AnimationState.None; + } + + #endregion + + #region Drawing + + public override bool PreDraw(ref Color lightColor) + { + if (Animation == AnimationState.None) + return false; + + Asset texture = ModContent.Request(Texture); + Vector2 drawPosition = Projectile.Bottom - Vector2.UnitY * (24f + Projectile.gfxOffY) - Main.screenPosition; + Rectangle frame = texture.Frame(15, 10, (int)Variant * 5 + (int)Animation, Projectile.frame); + Color drawColor = Projectile.GetAlpha(lightColor); + Vector2 rotationPoint = frame.Size() * 0.5f; + SpriteEffects flip = Direction == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + + Main.EntitySpriteDraw(texture.Value, drawPosition, frame, drawColor, Projectile.rotation, rotationPoint, Projectile.scale, flip); + + return false; + } + + #endregion + } +} diff --git a/Projectiles/Summon/HarvestStaffMinion.png b/Projectiles/Summon/HarvestStaffMinion.png new file mode 100644 index 0000000000..6d8ad1ab73 Binary files /dev/null and b/Projectiles/Summon/HarvestStaffMinion.png differ diff --git a/Projectiles/Summon/HarvestStaffSentry.cs b/Projectiles/Summon/HarvestStaffSentry.cs new file mode 100644 index 0000000000..58fab16163 --- /dev/null +++ b/Projectiles/Summon/HarvestStaffSentry.cs @@ -0,0 +1,152 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; +using static CalamityMod.Items.Weapons.Summon.HarvestStaff; + +namespace CalamityMod.Projectiles.Summon +{ + public class HarvestStaffSentry : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Summon"; + + public ref float Timer => ref Projectile.ai[0]; + public static float Gravity = 0.8f; + public static float MaxGravity = 20f; + + public override void SetStaticDefaults() => Main.projFrames[Type] = 4; + + public override void SetDefaults() + { + Projectile.sentry = true; + Projectile.timeLeft = Projectile.SentryLifeTime; + Projectile.tileCollide = true; + Projectile.width = 68; + Projectile.height = 32; + } + + public override void AI() + { + if (PumpkinAmount() < PumpkinsPerSentry * SentryAmount()) + Timer++; + + if (Timer > TimePerPumpkin) + { + float randomOffset = 160f; + Vector2 spawnPosition = Projectile.Center + new Vector2(Main.rand.NextFloat(-randomOffset, randomOffset), -80f); + MakeSpawnValid(ref spawnPosition); + + Projectile.NewProjectileDirect( + Projectile.GetSource_FromThis(), + spawnPosition, + Vector2.Zero, + ModContent.ProjectileType(), + Projectile.damage, + Projectile.knockBack, + Projectile.owner, + Main.rand.Next(3)); + + Timer = 0f; + + Projectile.netUpdate = true; + } + + float speed = Projectile.velocity.Y; + if (speed < MaxGravity) + speed = MathF.Min(speed + Gravity, MaxGravity); + Projectile.velocity.Y = speed; + + Projectile.frameCounter++; + if (Projectile.frameCounter > 10) + { + Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Type]; + Projectile.frameCounter = 0; + } + } + + #region AI Methods + + public int PumpkinAmount() + { + int amount = 0; + for (int i = 0; i < Main.maxProjectiles; i++) + { + Projectile proj = Main.projectile[i]; + if (proj == null || !proj.active || proj.type != ModContent.ProjectileType() || proj.owner != Projectile.owner) + continue; + amount++; + } + + return amount; + } + + public int SentryAmount() + { + int amount = 0; + for (int i = 0; i < Main.maxProjectiles; i++) + { + Projectile proj = Main.projectile[i]; + if (proj == null || !proj.active || proj.type != ModContent.ProjectileType() || proj.owner != Projectile.owner) + continue; + amount++; + } + + return amount; + } + + public void MakeSpawnValid(ref Vector2 spawnpoint) + { + Point spawnpointTileCoords = spawnpoint.ToSafeTileCoordinates(); + Point sentryTileCoords = Projectile.Top.ToSafeTileCoordinates(); + + if (!Main.tile[spawnpointTileCoords].IsTileSolid()) + return; + else + { + while (Main.tile[spawnpoint.ToSafeTileCoordinates()].IsTileSolid()) + { + for (int coordY = spawnpointTileCoords.Y; coordY < sentryTileCoords.Y; coordY++) + { + Point tileCoords = new Point(spawnpointTileCoords.X, coordY); + if (!Main.tile[tileCoords].IsTileSolid()) + { + spawnpoint = tileCoords.ToVector2(); + break; + } + } + + spawnpoint.X += Main.rand.NextFloat(-160f, 160f); + } + } + } + + #endregion + + public override bool OnTileCollide(Vector2 oldVelocity) => false; + + public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough, ref Vector2 hitboxCenterFrac) + { + fallThrough = false; + return true; + } + + public override bool? CanDamage() => false; + + public override bool PreDraw(ref Color lightColor) + { + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Vector2 drawPosition = Projectile.Center - Main.screenPosition + Vector2.UnitY * Projectile.gfxOffY; + Rectangle frame = texture.Frame(verticalFrames: Main.projFrames[Type], frameY: Projectile.frame); + Color drawColor = Projectile.GetAlpha(lightColor); + Vector2 rotationPoint = frame.Size() * 0.5f; + + Main.EntitySpriteDraw(texture, drawPosition, frame, drawColor, Projectile.rotation, rotationPoint, Projectile.scale, SpriteEffects.None); + + return false; + } + + public override void DrawBehind(int index, List behindNPCsAndTiles, List behindNPCs, List behindProjectiles, List overPlayers, List overWiresUI) => behindProjectiles.Add(index); + } +} diff --git a/Projectiles/Summon/HarvestStaffSentry.png b/Projectiles/Summon/HarvestStaffSentry.png new file mode 100644 index 0000000000..2668e29a4f Binary files /dev/null and b/Projectiles/Summon/HarvestStaffSentry.png differ diff --git a/Projectiles/Summon/HauntedDishes.cs b/Projectiles/Summon/HauntedDishes.cs index 8660460405..3e06fb2e60 100644 --- a/Projectiles/Summon/HauntedDishes.cs +++ b/Projectiles/Summon/HauntedDishes.cs @@ -1,7 +1,7 @@ -using CalamityMod.Buffs.Summon; +using System; +using CalamityMod.Buffs.Summon; using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -49,7 +49,7 @@ namespace CalamityMod.Projectiles.Summon Vector2 rotate = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; rotate = rotate.RotatedBy((double)((float)(i - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + Projectile.Center; Vector2 faceDirection = rotate - Projectile.Center; - int dusty = Dust.NewDust(rotate + faceDirection, 0, 0, 7, faceDirection.X * 1.1f, faceDirection.Y * 1.1f, 100, default, 1.4f); + int dusty = Dust.NewDust(rotate + faceDirection, 0, 0, DustID.WoodFurniture, faceDirection.X * 1.1f, faceDirection.Y * 1.1f, 100, default, 1.4f); Main.dust[dusty].noGravity = true; Main.dust[dusty].noLight = true; Main.dust[dusty].velocity = faceDirection; @@ -79,9 +79,9 @@ namespace CalamityMod.Projectiles.Summon Projectile.ai[1] = 0f; } int idlePos = 40 * (Projectile.minionPos + 1) * player.direction; - if (player.position.X + (float) (player.width / 2) < Projectile.position.X + (float) (Projectile.width / 2) - 10f + (float) idlePos) + if (player.position.X + (float)(player.width / 2) < Projectile.position.X + (float)(Projectile.width / 2) - 10f + (float)idlePos) minionMovingLeft = true; - else if (player.position.X + (float) (player.width / 2) > Projectile.position.X + (float) (Projectile.width / 2) + 10f + (float) idlePos) + else if (player.position.X + (float)(player.width / 2) > Projectile.position.X + (float)(Projectile.width / 2) + 10f + (float)idlePos) minionMovingRight = true; if (Projectile.ai[1] == 0f) @@ -90,9 +90,9 @@ namespace CalamityMod.Projectiles.Summon conflict1 += 40 * Projectile.minionPos; if (Projectile.localAI[0] > 0f) conflict1 += 500; - Vector2 idleMinionPos = new Vector2(Projectile.position.X + (float) Projectile.width * 0.5f, Projectile.position.Y + (float) Projectile.height * 0.5f); - float playerX = player.position.X + (float) (player.width / 2) - idleMinionPos.X; - float playerY = player.position.Y + (float) (player.height / 2) - idleMinionPos.Y; + Vector2 idleMinionPos = Projectile.Center; + float playerX = player.position.X + (float)(player.width / 2) - idleMinionPos.X; + float playerY = player.position.Y + (float)(player.height / 2) - idleMinionPos.Y; float playerDist = (float)Math.Sqrt(playerX * playerX + playerY * playerY); if (playerDist > 1500f) { @@ -100,8 +100,8 @@ namespace CalamityMod.Projectiles.Summon } if (playerDist > 2000f) //teleport to player if too far { - Projectile.position.X = player.position.X + (float) (player.width / 2) - (float) (Projectile.width / 2); - Projectile.position.Y = player.position.Y + (float) (player.height / 2) - (float) (Projectile.height / 2); + Projectile.position.X = player.position.X + (float)(player.width / 2) - (float)(Projectile.width / 2); + Projectile.position.Y = player.position.Y + (float)(player.height / 2) - (float)(Projectile.height / 2); } } if (Projectile.ai[0] != 0f) //flying back to the player @@ -113,11 +113,11 @@ namespace CalamityMod.Projectiles.Summon for (int index = 0; index < Main.maxNPCs; ++index) { NPC npc2 = Main.npc[index]; - if (npc2.CanBeChasedBy((object) Projectile, false)) + if (npc2.CanBeChasedBy((object)Projectile, false)) { - float npcX = npc2.position.X + (float) (npc2.width / 2); - float npcY = npc2.position.Y + (float) (npc2.height / 2); - float npcDist = (float) Math.Abs(player.position.X + (float) (player.width / 2) - npcX) + (float) Math.Abs(player.position.Y + (float) (player.height / 2) - npcY); + float npcX = npc2.position.X + (float)(npc2.width / 2); + float npcY = npc2.position.Y + (float)(npc2.height / 2); + float npcDist = (float)Math.Abs(player.position.X + (float)(player.width / 2) - npcX) + (float)Math.Abs(player.position.Y + (float)(player.height / 2) - npcY); if (npcDist < npcDetectRange) { if (Collision.CanHit(Projectile.position, Projectile.width, Projectile.height, npc2.position, npc2.width, npc2.height)) @@ -132,14 +132,14 @@ namespace CalamityMod.Projectiles.Summon if (npcFound && targetIndex >= 0) Projectile.ai[0] = 0f; - Vector2 returningMinionPos = new Vector2(Projectile.position.X + (float) Projectile.width * 0.5f, Projectile.position.Y + (float) Projectile.height * 0.5f); - float xDist = player.position.X + (float) (player.width / 2) - returningMinionPos.X; - xDist -= (float) (40 * player.direction); + Vector2 returningMinionPos = Projectile.Center; + float xDist = player.position.X + (float)(player.width / 2) - returningMinionPos.X; + xDist -= (float)(40 * player.direction); if (!npcFound) - xDist -= (float) (40 * Projectile.minionPos * player.direction); - float yDist = player.position.Y + (float) (player.height / 2) - returningMinionPos.Y; + xDist -= (float)(40 * Projectile.minionPos * player.direction); + float yDist = player.position.Y + (float)(player.height / 2) - returningMinionPos.Y; yDist -= 60f; - float playerDist2 = (float) Math.Sqrt(xDist * xDist + yDist * yDist); + float playerDist2 = (float)Math.Sqrt(xDist * xDist + yDist * yDist); float currentReturnSpeed = 12f; float minionReturnSpeed = playerDist2; float minionReturnAccel = 0.4f; @@ -147,7 +147,7 @@ namespace CalamityMod.Projectiles.Summon currentReturnSpeed = Math.Abs(player.velocity.X) + Math.Abs(player.velocity.Y); //if close enough to the player and has tile to stand on, return to normal - if (playerDist2 < 100f && player.velocity.Y == 0f && (Projectile.position.Y + (float) Projectile.height <= player.position.Y + (float) player.height && !Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height))) + if (playerDist2 < 100f && player.velocity.Y == 0f && (Projectile.position.Y + (float)Projectile.height <= player.position.Y + (float)player.height && !Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height))) { Projectile.ai[0] = 0f; if (Projectile.velocity.Y < -6f) @@ -200,7 +200,7 @@ namespace CalamityMod.Projectiles.Summon if (Projectile.velocity.Y < yDist) { Projectile.velocity.Y = Projectile.velocity.Y + minionReturnAccel; - if (minionReturnAccel> 0.05f && Projectile.velocity.Y < 0f) + if (minionReturnAccel > 0.05f && Projectile.velocity.Y < 0f) { Projectile.velocity.Y = Projectile.velocity.Y + minionReturnAccel * 2f; } @@ -234,11 +234,11 @@ namespace CalamityMod.Projectiles.Summon Projectile.spriteDirection = 1; else if (Projectile.velocity.X < -0.5f) Projectile.spriteDirection = -1; - Projectile.rotation = Projectile.spriteDirection != 1 ? (float) Math.Atan2((double) Projectile.velocity.Y, (double) Projectile.velocity.X) + 3.14f : (float) Math.Atan2((double) Projectile.velocity.Y, (double) Projectile.velocity.X); + Projectile.rotation = Projectile.spriteDirection != 1 ? Projectile.velocity.ToRotation() + MathHelper.Pi : Projectile.velocity.ToRotation(); } else { - float exaggeratedMinionPos = (float) (40 * Projectile.minionPos); + float exaggeratedMinionPos = (float)(40 * Projectile.minionPos); float attackCooldown = 30f; --Projectile.localAI[0]; if (Projectile.localAI[0] < 0f) @@ -255,11 +255,11 @@ namespace CalamityMod.Projectiles.Summon float minionAttackDistance = minionAttackMaxDist; int minionAttackIndex = -1; NPC minionAttackTargetNpc = Projectile.OwnerMinionAttackTargetNPC; - if (minionAttackTargetNpc != null && minionAttackTargetNpc.CanBeChasedBy((object) Projectile, false)) + if (minionAttackTargetNpc != null && minionAttackTargetNpc.CanBeChasedBy((object)Projectile, false)) { - float minionTargetXDist = minionAttackTargetNpc.position.X + (float) (minionAttackTargetNpc.width / 2); - float minionTargetYDist = minionAttackTargetNpc.position.Y + (float) (minionAttackTargetNpc.height / 2); - float minionTargetDist = Math.Abs(Projectile.position.X + (float) (Projectile.width / 2) - minionTargetXDist) + Math.Abs(Projectile.position.Y + (float) (Projectile.height / 2) - minionTargetYDist); + float minionTargetXDist = minionAttackTargetNpc.position.X + (float)(minionAttackTargetNpc.width / 2); + float minionTargetYDist = minionAttackTargetNpc.position.Y + (float)(minionAttackTargetNpc.height / 2); + float minionTargetDist = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - minionTargetXDist) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - minionTargetYDist); if (minionTargetDist < minionAttackMaxDist) { if (minionAttackIndex == -1 && minionTargetDist <= minionAttackDistance) @@ -281,11 +281,11 @@ namespace CalamityMod.Projectiles.Summon { for (int index = 0; index < Main.maxNPCs; ++index) { - if (Main.npc[index].CanBeChasedBy((object) Projectile, false)) + if (Main.npc[index].CanBeChasedBy((object)Projectile, false)) { - float minionTargetXDist = Main.npc[index].position.X + (float) (Main.npc[index].width / 2); - float minionTargetYDist = Main.npc[index].position.Y + (float) (Main.npc[index].height / 2); - float minionTargetDist = Math.Abs(Projectile.position.X + (float) (Projectile.width / 2) - minionTargetXDist) + Math.Abs(Projectile.position.Y + (float) (Projectile.height / 2) - minionTargetYDist); + float minionTargetXDist = Main.npc[index].position.X + (float)(Main.npc[index].width / 2); + float minionTargetYDist = Main.npc[index].position.Y + (float)(Main.npc[index].height / 2); + float minionTargetDist = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - minionTargetXDist) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - minionTargetYDist); if (minionTargetDist < minionAttackMaxDist) { if (minionAttackIndex == -1 && minionTargetDist <= minionAttackDistance) @@ -308,11 +308,11 @@ namespace CalamityMod.Projectiles.Summon if (minionAttackIndex == -1 && minionAttackDistance < minionAttackMaxDist) minionAttackMaxDist = minionAttackDistance; float yDependentTargeting = 400f; - if ((double) Projectile.position.Y > Main.worldSurface * 16.0) + if ((double)Projectile.position.Y > Main.worldSurface * 16.0) yDependentTargeting = 200f; if (minionAttackMaxDist < yDependentTargeting + exaggeratedMinionPos && minionAttackIndex == -1) { - float minionTargetXDist = minionXTarget - (Projectile.position.X + (float) (Projectile.width / 2)); + float minionTargetXDist = minionXTarget - (Projectile.position.X + (float)(Projectile.width / 2)); if (minionTargetXDist < -5f) { minionMovingLeft = true; @@ -327,7 +327,7 @@ namespace CalamityMod.Projectiles.Summon else if (minionAttackIndex >= 0 && minionAttackMaxDist < 800f + exaggeratedMinionPos) { Projectile.localAI[0] = 60f; - float minionTargetXDist = minionXTarget - (Projectile.position.X + (float) (Projectile.width / 2)); + float minionTargetXDist = minionXTarget - (Projectile.position.X + (float)(Projectile.width / 2)); if (minionTargetXDist > 300f || minionTargetXDist < -300f) { if (minionTargetXDist < -50f) @@ -347,10 +347,10 @@ namespace CalamityMod.Projectiles.Summon double plateSpeed = 12.0; Vector2 projMinionPos = new Vector2(Projectile.Center.X, Projectile.Center.Y - 8f); float plateTargetX = minionXTarget - projMinionPos.X + Main.rand.NextFloat(-6f, 6f); - float randomPlateYOffset = (float) ((double) (Math.Abs(plateTargetX) * 0.1f) * (double) Main.rand.Next(0, 100) * (1.0 / 1000.0)); + float randomPlateYOffset = (float)((double)(Math.Abs(plateTargetX) * 0.1f) * (double)Main.rand.Next(0, 100) * (1.0 / 1000.0)); float plateTargetY = minionYTarget - projMinionPos.Y + Main.rand.NextFloat(-6f, 6f) - randomPlateYOffset; - double plateTargetDist = Math.Sqrt((double) plateTargetX * (double) plateTargetX + (double) plateTargetY * (double) plateTargetY); - float plateVelocity = (float) (plateSpeed / plateTargetDist); + double plateTargetDist = Math.Sqrt((double)plateTargetX * (double)plateTargetX + (double)plateTargetY * (double)plateTargetY); + float plateVelocity = (float)(plateSpeed / plateTargetDist); float SpeedX = plateTargetX * plateVelocity; float SpeedY = plateTargetY * plateVelocity; int damage = Projectile.damage; @@ -404,13 +404,13 @@ namespace CalamityMod.Projectiles.Summon } if (minionMovingLeft | minionMovingRight) { - int minionTileX = (int) ((double) Projectile.position.X + (double) (Projectile.width / 2)) / 16; - int j = (int) ((double) Projectile.position.Y + (double) (Projectile.height / 2)) / 16; + int minionTileX = (int)((double)Projectile.position.X + (double)(Projectile.width / 2)) / 16; + int j = (int)((double)Projectile.position.Y + (double)(Projectile.height / 2)) / 16; if (minionMovingLeft) --minionTileX; if (minionMovingRight) ++minionTileX; - if (WorldGen.SolidTile(minionTileX + (int) Projectile.velocity.X, j)) + if (WorldGen.SolidTile(minionTileX + (int)Projectile.velocity.X, j)) minionShouldJump = true; } if (player.position.Y + player.height - 8f > Projectile.position.Y + Projectile.height) @@ -418,10 +418,10 @@ namespace CalamityMod.Projectiles.Summon Collision.StepUp(ref Projectile.position, ref Projectile.velocity, Projectile.width, Projectile.height, ref Projectile.stepSpeed, ref Projectile.gfxOffY, 1, false, 0); if (Projectile.velocity.Y == 0f) { - if (!minionBelowPlayer && ((double) Projectile.velocity.X < 0.0 || (double) Projectile.velocity.X > 0.0)) + if (!minionBelowPlayer && ((double)Projectile.velocity.X < 0.0 || (double)Projectile.velocity.X > 0.0)) { - int i = (int) ((double) Projectile.position.X + (double) (Projectile.width / 2)) / 16; - int j = (int) ((double) Projectile.position.Y + (double) (Projectile.height / 2)) / 16 + 1; + int i = (int)((double)Projectile.position.X + (double)(Projectile.width / 2)) / 16; + int j = (int)((double)Projectile.position.Y + (double)(Projectile.height / 2)) / 16 + 1; if (minionMovingLeft) --i; if (minionMovingRight) @@ -430,9 +430,9 @@ namespace CalamityMod.Projectiles.Summon } if (minionShouldJump) { - int i1 = (int) ((double) Projectile.position.X + (double) (Projectile.width / 2)) / 16; - int j = (int) ((double) Projectile.position.Y + (double) Projectile.height) / 16 + 1; - if (WorldGen.SolidTile(i1, j) || Main.tile[i1, j].IsHalfBlock || ((int) Main.tile[i1, j].Slope > 0 || Projectile.type == 200)) + int i1 = (int)((double)Projectile.position.X + (double)(Projectile.width / 2)) / 16; + int j = (int)((double)Projectile.position.Y + (double)Projectile.height) / 16 + 1; + if (WorldGen.SolidTile(i1, j) || Main.tile[i1, j].IsHalfBlock || ((int)Main.tile[i1, j].Slope > 0 || Projectile.type == 200)) { if (Projectile.type == 200) { @@ -442,13 +442,13 @@ namespace CalamityMod.Projectiles.Summon { try { - int minionJumpTileX = (int) ((double) Projectile.position.X + (double) (Projectile.width / 2)) / 16; - int minionJumpTileY = (int) ((double) Projectile.position.Y + (double) (Projectile.height / 2)) / 16; + int minionJumpTileX = (int)((double)Projectile.position.X + (double)(Projectile.width / 2)) / 16; + int minionJumpTileY = (int)((double)Projectile.position.Y + (double)(Projectile.height / 2)) / 16; if (minionMovingLeft) --minionJumpTileX; if (minionMovingRight) ++minionJumpTileX; - int i2 = minionJumpTileX + (int) Projectile.velocity.X; + int i2 = minionJumpTileX + (int)Projectile.velocity.X; if (!WorldGen.SolidTile(i2, minionJumpTileY - 1) && !WorldGen.SolidTile(i2, minionJumpTileY - 2)) Projectile.velocity.Y = -5.1f; else if (!WorldGen.SolidTile(i2, minionJumpTileY - 2)) @@ -523,7 +523,7 @@ namespace CalamityMod.Projectiles.Summon } else if (Projectile.velocity.X < -0.8f || Projectile.velocity.X > 0.8f) { - Projectile.frameCounter = Projectile.frameCounter + (int) Math.Abs(Projectile.velocity.X); + Projectile.frameCounter = Projectile.frameCounter + (int)Math.Abs(Projectile.velocity.X); Projectile.frameCounter++; if (Projectile.frameCounter > 20) { diff --git a/Projectiles/Summon/HermitCrabMinion.cs b/Projectiles/Summon/HermitCrabMinion.cs index dff0a079d2..176c6e52b6 100644 --- a/Projectiles/Summon/HermitCrabMinion.cs +++ b/Projectiles/Summon/HermitCrabMinion.cs @@ -50,7 +50,7 @@ namespace CalamityMod.Projectiles.Summon { for (int i = 0; i < 20; i++) { - int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y + 16f), Projectile.width, Projectile.height - 16, 33, 0f, 0f, 0, default, 1f); + int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y + 16f), Projectile.width, Projectile.height - 16, DustID.Water, 0f, 0f, 0, default, 1f); Main.dust[dust].velocity *= 2f; Main.dust[dust].scale *= 1.15f; } diff --git a/Projectiles/Summon/HerringAI.cs b/Projectiles/Summon/HerringAI.cs index 3cc0184d31..9e2f1e0400 100644 --- a/Projectiles/Summon/HerringAI.cs +++ b/Projectiles/Summon/HerringAI.cs @@ -52,7 +52,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.netUpdate = true; } - + public void CheckMinionExistance() { Owner.AddBuff(ModContent.BuffType(), 1); diff --git a/Projectiles/Summon/HerringMinion.cs b/Projectiles/Summon/HerringMinion.cs index 446722f8a9..838e71f4ec 100644 --- a/Projectiles/Summon/HerringMinion.cs +++ b/Projectiles/Summon/HerringMinion.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Projectiles.Summon TargetPosition(minionAI); // The minions position themselves near the invisible minion to seem like they're ramming all together. else FollowOrigin(minionAI); // Vibes around their respective invisible minion. - + CheckMinionExistance(); // Checks if the decorative herring can still exist, if the invisible minion despawns, so do these ones. DoAnimation(); // Does the animation of the minion. PointInRightDirection(minionAI, target); // Points in the correct direction. diff --git a/Projectiles/Summon/Hive.cs b/Projectiles/Summon/Hive.cs index 609038c0ef..500cdee637 100644 --- a/Projectiles/Summon/Hive.cs +++ b/Projectiles/Summon/Hive.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetDefaults() { Projectile.width = 38; - Projectile.height = 62; + Projectile.height = 60; Projectile.ignoreWater = true; Projectile.tileCollide = true; Projectile.sentry = true; @@ -47,8 +47,6 @@ namespace CalamityMod.Projectiles.Summon Projectile.velocity.Y = 10f; } - Projectile.StickToTiles(false, false); - int target = 0; float attackDist = 800f; Vector2 projPos = Projectile.position; @@ -106,6 +104,12 @@ namespace CalamityMod.Projectiles.Summon public override bool OnTileCollide(Vector2 oldVelocity) => false; + public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough, ref Vector2 hitboxCenterFrac) + { + fallThrough = false; + return true; + } + public override bool? CanDamage() => false; } } diff --git a/Projectiles/Summon/HomingGammaBullet.cs b/Projectiles/Summon/HomingGammaBullet.cs index 5c6c107585..63313ddecd 100644 --- a/Projectiles/Summon/HomingGammaBullet.cs +++ b/Projectiles/Summon/HomingGammaBullet.cs @@ -1,7 +1,7 @@ -using CalamityMod.Buffs.DamageOverTime; +using System.Collections.Generic; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using Microsoft.Xna.Framework; -using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -92,7 +92,7 @@ namespace CalamityMod.Projectiles.Summon } } } - hasHitNPC = false; + hasHitNPC = false; if (!foundTarget) { for (int k = 0; k < Main.maxNPCs; k++) @@ -126,7 +126,7 @@ namespace CalamityMod.Projectiles.Summon for (int i = 0; i < 3; i++) { - Dust sulphuricAcid = Dust.NewDustDirect(Projectile.position, 8, 8, (int)CalamityDusts.SulfurousSeaAcid, 0, 0, 0, default, 0.75f); + Dust sulphuricAcid = Dust.NewDustDirect(Projectile.position, 8, 8, (int)CalamityDusts.SulphurousSeaAcid, 0, 0, 0, default, 0.75f); sulphuricAcid.noGravity = true; sulphuricAcid.velocity *= 1.8f; diff --git a/Projectiles/Summon/HowlsHeartFireball.cs b/Projectiles/Summon/HowlsHeartFireball.cs index 1d30b2da43..1d4932627f 100644 --- a/Projectiles/Summon/HowlsHeartFireball.cs +++ b/Projectiles/Summon/HowlsHeartFireball.cs @@ -1,8 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { @@ -109,7 +109,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.velocity = (Projectile.velocity * 20f + moveDirection * 21f) / (21f); } - int blueT = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 59, 0f, 0f, 100, default, 0.6f); + int blueT = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.BlueTorch, 0f, 0f, 100, default, 0.6f); Main.dust[blueT].noGravity = true; Main.dust[blueT].velocity *= 0.5f; Main.dust[blueT].velocity += Projectile.velocity * 0.1f; @@ -118,16 +118,16 @@ namespace CalamityMod.Projectiles.Summon public override void OnKill(int timeLeft) { SoundEngine.PlaySound(SoundID.Item45, Projectile.position); - int blue = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 59, 0f, 0f, 100, default, 1f); + int blue = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.BlueTorch, 0f, 0f, 100, default, 1f); Main.dust[blue].velocity *= 0.5f; if (Main.rand.NextBool()) { Main.dust[blue].scale = 0.5f; Main.dust[blue].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } - int torch = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 59, 0f, 0f, 100, default, 1.4f); + int torch = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.BlueTorch, 0f, 0f, 100, default, 1.4f); Main.dust[torch].noGravity = true; - Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 59, 0f, 0f, 100, default, 0.8f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.BlueTorch, 0f, 0f, 100, default, 0.8f); } } } diff --git a/Projectiles/Summon/HowlsHeartHowl.cs b/Projectiles/Summon/HowlsHeartHowl.cs index 42ca33b782..c2d346f8e8 100644 --- a/Projectiles/Summon/HowlsHeartHowl.cs +++ b/Projectiles/Summon/HowlsHeartHowl.cs @@ -1,9 +1,9 @@ using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { public class HowlsHeartHowl : ModProjectile, ILocalizedModType @@ -47,7 +47,7 @@ namespace CalamityMod.Projectiles.Summon Vector2 rotate = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; rotate = rotate.RotatedBy((double)((float)(dustIndex - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + Projectile.Center; Vector2 faceDirection = rotate - Projectile.Center; - int dusty = Dust.NewDust(rotate + faceDirection, 0, 0, 191, faceDirection.X * 1f, faceDirection.Y * 1f, 100, default, 1.1f); + int dusty = Dust.NewDust(rotate + faceDirection, 0, 0, DustID.SpookyWood, faceDirection.X * 1f, faceDirection.Y * 1f, 100, default, 1.1f); Main.dust[dusty].noGravity = true; Main.dust[dusty].noLight = true; Main.dust[dusty].velocity = faceDirection; @@ -231,7 +231,7 @@ namespace CalamityMod.Projectiles.Summon //Increment firing cooldown if (Projectile.ai[1] > 0f) { - Projectile.ai[1] += Main.rand.Next(1,4); + Projectile.ai[1] += Main.rand.Next(1, 4); if (Main.rand.NextBool(3)) ++Projectile.ai[1]; } diff --git a/Projectiles/Summon/HowlsHeartTurnipHead.cs b/Projectiles/Summon/HowlsHeartTurnipHead.cs index 913e93df54..73dc75e9a5 100644 --- a/Projectiles/Summon/HowlsHeartTurnipHead.cs +++ b/Projectiles/Summon/HowlsHeartTurnipHead.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Projectiles.Summon } public override void AI() - { + { Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); diff --git a/Projectiles/Summon/HydrothermicVent.cs b/Projectiles/Summon/HydrothermicVent.cs index 5cedf175e8..fb4e86f626 100644 --- a/Projectiles/Summon/HydrothermicVent.cs +++ b/Projectiles/Summon/HydrothermicVent.cs @@ -1,9 +1,9 @@ using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { diff --git a/Projectiles/Summon/IceClasperMinion.cs b/Projectiles/Summon/IceClasperMinion.cs index bc18a45de9..94aca8ef17 100644 --- a/Projectiles/Summon/IceClasperMinion.cs +++ b/Projectiles/Summon/IceClasperMinion.cs @@ -77,17 +77,17 @@ namespace CalamityMod.Projectiles.Summon public void FollowState() { - // If the minion starts to get far, force the minion to go to you. - if (!Projectile.WithinRange(Owner.Center, AncientIceChunk.MaxDistanceFromOwner)) + // Teleport to the owner if sufficiently far away. + if (!Projectile.WithinRange(Owner.Center, 1200f)) { - Projectile.velocity = (Projectile.velocity + Projectile.SafeDirectionTo(Owner.Center)) * 0.9f; + Projectile.Center = Owner.Center; SyncVariables(); } - // Teleport to the owner if sufficiently far away. - else if (!Projectile.WithinRange(Owner.Center, 1200f)) + // If the minion starts to get far, force the minion to go to you. + else if (!Projectile.WithinRange(Owner.Center, AncientIceChunk.MaxDistanceFromOwner)) { - Projectile.Center = Owner.Center; + Projectile.velocity = (Projectile.velocity + Projectile.SafeDirectionTo(Owner.Center)) * 0.9f; SyncVariables(); } @@ -189,7 +189,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Vector2 drawPosition = Projectile.Center - Main.screenPosition; Rectangle frame = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); Vector2 origin = frame.Size() * 0.5f; diff --git a/Projectiles/Summon/IceClasperSummonProjectile.cs b/Projectiles/Summon/IceClasperSummonProjectile.cs index 799def4e6d..ac27f9a246 100644 --- a/Projectiles/Summon/IceClasperSummonProjectile.cs +++ b/Projectiles/Summon/IceClasperSummonProjectile.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Projectiles.Summon if (!Main.dedServ) { - Dust trailDust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, 172, Projectile.velocity.X, Projectile.velocity.Y, 0, default, 1.5f); + Dust trailDust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.DungeonWater, Projectile.velocity.X, Projectile.velocity.Y, 0, default, 1.5f); trailDust.noGravity = true; } } diff --git a/Projectiles/Summon/IceSentryFrostBolt.cs b/Projectiles/Summon/IceSentryFrostBolt.cs index 09e1850807..6dee2bd3a4 100644 --- a/Projectiles/Summon/IceSentryFrostBolt.cs +++ b/Projectiles/Summon/IceSentryFrostBolt.cs @@ -1,8 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { @@ -27,6 +27,8 @@ namespace CalamityMod.Projectiles.Summon Projectile.timeLeft = 480; Projectile.coldDamage = true; Projectile.DamageType = DamageClass.Summon; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() @@ -43,7 +45,7 @@ namespace CalamityMod.Projectiles.Summon float slowVelX = Projectile.velocity.X / 3f * (float)i; float slowVelY = Projectile.velocity.Y / 3f * (float)i; int four = 4; - int dusty = Dust.NewDust(new Vector2(Projectile.position.X + (float)four, Projectile.position.Y + (float)four), Projectile.width - four * 2, Projectile.height - four * 2, 92, 0f, 0f, 100, default, 1.2f); + int dusty = Dust.NewDust(new Vector2(Projectile.position.X + (float)four, Projectile.position.Y + (float)four), Projectile.width - four * 2, Projectile.height - four * 2, DustID.Frost, 0f, 0f, 100, default, 1.2f); Dust dust = Main.dust[dusty]; dust.noGravity = true; dust.velocity *= 0.1f; @@ -54,7 +56,7 @@ namespace CalamityMod.Projectiles.Summon if (Main.rand.NextBool(10)) { int otherFour = 4; - int dustier = Dust.NewDust(new Vector2(Projectile.position.X + (float)otherFour, Projectile.position.Y + (float)otherFour), Projectile.width - otherFour * 2, Projectile.height - otherFour * 2, 92, 0f, 0f, 100, default, 0.6f); + int dustier = Dust.NewDust(new Vector2(Projectile.position.X + (float)otherFour, Projectile.position.Y + (float)otherFour), Projectile.width - otherFour * 2, Projectile.height - otherFour * 2, DustID.Frost, 0f, 0f, 100, default, 0.6f); Main.dust[dustier].velocity *= 0.25f; Main.dust[dustier].velocity += Projectile.velocity * 0.5f; } @@ -94,7 +96,7 @@ namespace CalamityMod.Projectiles.Summon SoundEngine.PlaySound(SoundID.Item27, Projectile.position); for (int k = 0; k < 5; k++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 92, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Frost, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } diff --git a/Projectiles/Summon/IceSentryShard.cs b/Projectiles/Summon/IceSentryShard.cs index c910ea9e99..05734d51ff 100644 --- a/Projectiles/Summon/IceSentryShard.cs +++ b/Projectiles/Summon/IceSentryShard.cs @@ -1,8 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { @@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Summon SoundEngine.PlaySound(SoundID.Item27, Projectile.position); for (int index1 = 0; index1 < 3; ++index1) { - int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 76); + int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Snow); Main.dust[index2].noGravity = true; Main.dust[index2].noLight = true; Main.dust[index2].scale = 0.7f; diff --git a/Projectiles/Summon/IgneousBlade.cs b/Projectiles/Summon/IgneousBlade.cs index c5b9c97939..d0623e72a9 100644 --- a/Projectiles/Summon/IgneousBlade.cs +++ b/Projectiles/Summon/IgneousBlade.cs @@ -1,8 +1,8 @@ -using CalamityMod.Buffs.Summon; +using System.IO; +using CalamityMod.Buffs.Summon; using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -119,7 +119,7 @@ namespace CalamityMod.Projectiles.Summon { for (int j = 0; j < 40; j++) { - Dust dust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, 6); + Dust dust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.Torch); dust.velocity = Vector2.UnitY * Main.rand.NextFloat(3f, 5.5f) * Main.rand.NextBool().ToDirectionInt(); dust.noGravity = true; } diff --git a/Projectiles/Summon/IgneousBladeStrike.cs b/Projectiles/Summon/IgneousBladeStrike.cs index c2db95b90f..aa3ec7daa4 100644 --- a/Projectiles/Summon/IgneousBladeStrike.cs +++ b/Projectiles/Summon/IgneousBladeStrike.cs @@ -1,8 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { public class IgneousBladeStrike : ModProjectile, ILocalizedModType diff --git a/Projectiles/Summon/IrradiatedAura.cs b/Projectiles/Summon/IrradiatedAura.cs index 82d8d3248f..65ca1a55ed 100644 --- a/Projectiles/Summon/IrradiatedAura.cs +++ b/Projectiles/Summon/IrradiatedAura.cs @@ -1,8 +1,8 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; -using CalamityMod.Buffs.StatDebuffs; -using CalamityMod.Dusts; namespace CalamityMod.Projectiles.Summon { @@ -35,7 +35,7 @@ namespace CalamityMod.Projectiles.Summon } else if (randomDust == 2) { - randomDust = (int)CalamityDusts.SulfurousSeaAcid; + randomDust = (int)CalamityDusts.SulphurousSeaAcid; } else { @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.Summon } for (int i = 0; i < (Main.rand.NextBool() ? 1 : 2); i++) { - int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDust, 0f, 0f, 100, default, 1f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, randomDust, 0f, 0f, 100, default, 1f); if (randomDust == 89) { Main.dust[dust].scale *= 0.35f; diff --git a/Projectiles/Summon/LanternFlame.cs b/Projectiles/Summon/LanternFlame.cs index 4b6c5d4ce1..2086d4398e 100644 --- a/Projectiles/Summon/LanternFlame.cs +++ b/Projectiles/Summon/LanternFlame.cs @@ -1,9 +1,9 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Buffs.DamageOverTime; -using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { public class LanternFlame : ModProjectile, ILocalizedModType @@ -66,7 +66,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.Damage(); for (int i = 0; i < 10; i++) { - int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 127, 0f, 0f, 100, default, 2f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Flare, 0f, 0f, 100, default, 2f); Main.dust[dust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -76,10 +76,10 @@ namespace CalamityMod.Projectiles.Summon } for (int j = 0; j < 15; j++) { - int dust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 127, 0f, 0f, 100, default, 3f); + int dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Flare, 0f, 0f, 100, default, 3f); Main.dust[dust2].noGravity = true; Main.dust[dust2].velocity *= 5f; - dust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 127, 0f, 0f, 100, default, 2f); + dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Flare, 0f, 0f, 100, default, 2f); Main.dust[dust2].velocity *= 2f; } } diff --git a/Projectiles/Summon/LanternSoul.cs b/Projectiles/Summon/LanternSoul.cs index bc29b7a921..f0f4202a2a 100644 --- a/Projectiles/Summon/LanternSoul.cs +++ b/Projectiles/Summon/LanternSoul.cs @@ -1,6 +1,6 @@ -using CalamityMod.Items.Weapons.Summon; +using System; +using CalamityMod.Items.Weapons.Summon; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Projectiles/Summon/LiliesOfEternityBullet.cs b/Projectiles/Summon/LiliesOfEternityBullet.cs new file mode 100644 index 0000000000..5cbe15d4d7 --- /dev/null +++ b/Projectiles/Summon/LiliesOfEternityBullet.cs @@ -0,0 +1,69 @@ +using CalamityMod.Graphics.Primitives; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class LiliesOfEternityBullet : ModProjectile, ILocalizedModType, IPixelatedPrimitiveRenderer + { + public new string LocalizationCategory => "Projectiles.Summon"; + + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override void SetStaticDefaults() + { + ProjectileID.Sets.MinionShot[Type] = true; + ProjectileID.Sets.TrailingMode[Type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 8; + } + + public override void SetDefaults() + { + Projectile.DamageType = DamageClass.Summon; + Projectile.width = Projectile.height = 16; + Projectile.timeLeft = 300; + Projectile.penetrate = -1; + Projectile.localNPCHitCooldown = -1; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.usesLocalNPCImmunity = true; + } + + public override void AI() + { + if (Main.dedServ) + return; + + Dust trailDust = Dust.NewDustPerfect( + Projectile.Center + Main.rand.NextVector2Circular(8f, 8f), + 64, + Projectile.velocity * Main.rand.NextFloat(0.01f, 0.05f), + Scale: Main.rand.NextFloat(1f, 1.2f)); + trailDust.noGravity = true; + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + Projectile.velocity = Vector2.Zero; + Projectile.timeLeft = 10; + } + + private float PrimitiveWidthFunction(float completionRatio) + { + float trailPoint = 0.1f; + return completionRatio > trailPoint ? Utils.Remap(completionRatio, trailPoint, 1f, 12f, 0f) : Utils.Remap(completionRatio, trailPoint, 0f, 12f, 0f); + } + + private Color PrimitiveColorFunction(float completionRatio) => Color.Lerp(Color.DarkGoldenrod, Color.LightGoldenrodYellow, completionRatio); + + public void RenderPixelatedPrimitives(SpriteBatch spriteBatch) + { + GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/FabstaffStreak")); + PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(PrimitiveWidthFunction, PrimitiveColorFunction, (_) => Projectile.Size * 0.5f, pixelate: true, shader: GameShaders.Misc["CalamityMod:TrailStreak"])); + } + } +} diff --git a/Projectiles/Summon/LiliesOfFinalityAoE.cs b/Projectiles/Summon/LiliesOfFinalityAoE.cs new file mode 100644 index 0000000000..8ea6e54e24 --- /dev/null +++ b/Projectiles/Summon/LiliesOfFinalityAoE.cs @@ -0,0 +1,107 @@ +using System; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ModLoader; +using static CalamityMod.Items.Weapons.Summon.LiliesOfFinality; + +namespace CalamityMod.Projectiles.Summon +{ + public class LiliesOfFinalityAoE : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Summon"; + + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + private ref float ArianeID => ref Projectile.ai[0]; + + private ref float Timer => ref Projectile.ai[1]; + + private Projectile Ariane; + + private const int TimeToFullScale = 120; + + public override void SetDefaults() + { + Projectile.DamageType = DamageClass.Summon; + Projectile.width = Projectile.height = Ariane_AoESize; + Projectile.localNPCHitCooldown = 30; + Projectile.penetrate = -1; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.usesLocalNPCImmunity = true; + Projectile.netImportant = true; + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.width / 2f, targetHitbox); + + public override void AI() + { + if (Ariane != null && Ariane.active && Ariane.owner == Projectile.owner && Ariane.type == ModContent.ProjectileType() && Ariane.ModProjectile().State == LiliesOfFinalityAriane.AIState.Attack) + Projectile.timeLeft = 2; + + Projectile.Center = Ariane.Center; + + // If on a dedicated server, don't bother running the visuals and sounds to save resources. + if (!Main.dedServ) + { + float currentScale = Utils.Remap(Timer, 0f, TimeToFullScale, 0f, Projectile.width / 2f); + + int circleDustAmount = (int)Utils.Remap(Timer, 0f, TimeToFullScale, 5f, 40f) + Main.rand.Next(20); + for (int i = 0; i < circleDustAmount; i++) + { + if (Main.rand.NextBool(20)) + { + float angle = MathHelper.TwoPi / circleDustAmount * i; + Vector2 position = angle.ToRotationVector2() * (currentScale + Main.rand.NextFloat(10f)); + + Particle fakeDust = new ArianeFakeDust( + Projectile, + position + Main.rand.NextVector2Circular(15f, 15f), + Vector2.Zero, + Color.Red, + Main.rand.NextFloat(1.5f, 2.5f), + 120); + GeneralParticleHandler.SpawnParticle(fakeDust); + } + } + + int eyeDustAmount = (int)Utils.Remap(Timer, 0f, TimeToFullScale, 0f, 20f); + for (int i = 0; i < eyeDustAmount; i++) + { + if (Main.rand.NextBool(15)) + { + float interpolator = Main.rand.NextFloat(); + float maxOffsetX = Utils.Remap(Timer, 0f, TimeToFullScale, 0f, 450f); + float maxOffsetY = Utils.Remap(Timer, 0f, TimeToFullScale, 0f, 200f); + Vector2 xPosition = Vector2.UnitX * MathHelper.Lerp(-maxOffsetX, maxOffsetX, interpolator); + Vector2 yPosition = Vector2.UnitY * MathHelper.Lerp(0f, maxOffsetY, MathF.Pow(CalamityUtils.Convert01To010(interpolator), 0.7f)) * Main.rand.NextBool().ToDirectionInt(); + + Particle fakeDust = new ArianeFakeDust( + Projectile, + xPosition + yPosition + Main.rand.NextVector2Circular(15f, 15f), + Vector2.Zero, + Color.Crimson * 0.8f, + Main.rand.NextFloat(2f, 2.5f), + 120); + GeneralParticleHandler.SpawnParticle(fakeDust); + } + } + + Dust insideDust = Dust.NewDustPerfect( + Projectile.Center + Main.rand.NextVector2Circular(currentScale, currentScale), + CommonDustID, + Main.rand.NextVector2Circular(3f, 3f), + Scale: Main.rand.NextFloat(0.8f, 1.2f)); + insideDust.noGravity = true; + } + + Timer++; + } + + public override void OnSpawn(IEntitySource source) => Ariane = Main.projectile[(int)ArianeID]; + + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) => modifiers.SourceDamage *= Ariane_AoEDMGMultiplier; + } +} diff --git a/Projectiles/Summon/LiliesOfFinalityAriane.cs b/Projectiles/Summon/LiliesOfFinalityAriane.cs new file mode 100644 index 0000000000..1da87b762c --- /dev/null +++ b/Projectiles/Summon/LiliesOfFinalityAriane.cs @@ -0,0 +1,486 @@ +using System.IO; +using CalamityMod.Buffs.Summon; +using CalamityMod.Particles; +using CalamityMod.Projectiles.BaseProjectiles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; +using static System.MathF; +using static CalamityMod.Items.Weapons.Summon.LiliesOfFinality; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Projectiles.Summon +{ + public class LiliesOfFinalityAriane : BaseMinionProjectile + { + #region Members + + private enum EyeFrame + { + EyeOpen, + EyeHalfClosed, + EyeClosed + } + + private enum EyeState + { + NormalBlinking, + InStorm + } + + private EyeState state; + private int timeInState; + + public int EyeFrameToShow { get; private set; } + + public enum AIState { Idle, ReturnToOwner, Attack } + public AIState State + { + get => (AIState)Projectile.ai[0]; + set + { + Projectile.ai[0] = (float)value; + + // The minion'll be able to walk on tiles when they're not in a flying state. + Projectile.tileCollide = value == AIState.Idle; + + // Because some states mess with the rotation, we reset it so it doesn't cause visual issues on the states that don't deal with rotation. + Projectile.rotation = 0f; + + // When the minion goes into its attack state, it spawns a lingering AoE. + if (value == AIState.Attack && Main.myPlayer == Projectile.owner) + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ProjectileType(), Projectile.damage, 0f, Projectile.owner, Projectile.whoAmI); + + Timer = 0f; + + NetUpdate(); + } + } + + public enum AnimationState { Still, Walk, Fly } + public AnimationState Animation + { + get => (AnimationState)Projectile.ai[1]; + set + { + Projectile.ai[1] = (float)value; + + switch (value) + { + case AnimationState.Still: + Projectile.width = 32; + FrameAmount = 1; + break; + + case AnimationState.Walk: + Projectile.width = 32; + FrameAmount = 9; + break; + + case AnimationState.Fly: + Projectile.width = 56; + FrameAmount = 8; + break; + } + + // If the animation state is being set to the same thing every frame, don't reset the animation. + // Or if the current frame of animation is outside the amount of frames that the next animation will have, reset it. + if (Animation != value || Projectile.frame + 1 > FrameAmount) + { + Projectile.frame = 0; + Projectile.frameCounter = 0; + } + } + } + + private ref float Timer => ref Projectile.ai[2]; + + /// + /// The amount of animation frames there is in the current animation. + /// + private int FrameAmount = 1; + + private Projectile Elster; + + #endregion + + #region Overridden Members + + public override int AssociatedProjectileTypeID => ProjectileType(); + public override int AssociatedBuffTypeID => BuffType(); + public override ref bool AssociatedMinionBool => ref ModdedOwner.LiliesOfFinalityBool; + public override float EnemyDistanceDetection => MaxEnemyDistanceDetection; + public override int AnimationFrames => 18; + public override bool Grounded => true; + + public override void SetDefaults() + { + Projectile.width = 32; + Projectile.height = 66; + base.SetDefaults(); + } + + public override void CheckMinionExistence() + { + Projectile.timeLeft = 2; + if (Elster is null || !Elster.active || Elster.owner != Projectile.owner || Elster.type != ProjectileType()) + Projectile.Kill(); + } + + public override void OnSpawn(IEntitySource source) + { + for (int i = 0; i < Main.maxProjectiles; i++) + { + Projectile p = Main.projectile[i]; + if (p == null || !p.active || p.owner != Projectile.owner || p.type != ProjectileType()) + continue; + Elster = p; + break; + } + } + + public override bool OnTileCollide(Vector2 oldVelocity) => false; + + public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough, ref Vector2 hitboxCenterFrac) + { + // If the projectile's above the player, it can fall through platforms to reach the player. + if (State == AIState.Idle) + fallThrough = Projectile.Bottom.Y < Owner.Top.Y; + return true; + } + + public override bool? CanDamage() => false; + + #endregion + + #region AI + + public override void MinionAI() + { + SetStateByPlayerInfo(Owner); + UpdateEyeFrameToShow(Owner); + timeInState++; + + switch (State) + { + case AIState.Idle: + IdleState(); + break; + case AIState.ReturnToOwner: + ReturnToOwnerState(); + break; + case AIState.Attack: + AttackState(); + break; + } + + Timer++; + + // If on a dedicated server, don't bother running the visuals and sounds to save resources. + if (Main.dedServ) + return; + + if (Elster.ModProjectile().State == LiliesOfFinalityElster.AIState.ReturnToOwner || Elster.ModProjectile().State == LiliesOfFinalityElster.AIState.AttackFlying) + { + Dust connectionArianeElster = Dust.NewDustPerfect( + Vector2.Lerp(Projectile.Center, Elster.Center, Main.rand.NextFloat()) + Main.rand.NextVector2Circular(5f, 5f), + CommonDustID, + Vector2.Zero, + Scale: Main.rand.NextFloat(0.8f, 1f)); + connectionArianeElster.noGravity = true; + } + } + + private void IdleState() + { + if (Timer > 15f) + { + if (Target is not null) + { + State = AIState.Attack; + return; + } + + if (IsTileBetweenOwnerAndMinionVertically() || !Collision.CanHitLine(Projectile.Center, 1, 1, Owner.Center, 1, 1) || !Projectile.WithinRange(Owner.Center, 960f)) + { + State = AIState.ReturnToOwner; + return; + } + + if (!Projectile.getRect().Intersects(Elster.getRect())) + { + int walkDirection = Sign(Elster.Center.X - Projectile.Center.X); + float maxSpeed = Utils.Remap(Abs(Elster.Center.X - Projectile.Center.X), 160f, 0f, 8f, 0f); + Projectile.velocity.X += 0.08f * walkDirection; + if (Abs(Projectile.velocity.X) > maxSpeed) + Projectile.velocity.X = maxSpeed * walkDirection; + } + else + { + Projectile.velocity.X *= 0.8f; + Projectile.spriteDirection = Sign(Elster.Center.X - Projectile.Center.X); + Elster.spriteDirection = Sign(Projectile.Center.X - Elster.Center.X); + + if (!Main.dedServ && Main.rand.NextBool(100)) + { + Vector2 emoteDirection = -Vector2.UnitY.RotatedByRandom(MathHelper.PiOver2 * 0.7f); + Particle heart = new LiliesOfFinalityHeartParticle((Main.rand.NextBool() ? Projectile.Center : Elster.Center) + emoteDirection * 15f, emoteDirection * Main.rand.NextFloat(1f, 2f), Main.rand.Next(30, 45), Main.rand.NextFloat(0.6f, 1f)); + GeneralParticleHandler.SpawnParticle(heart); + } + } + } + + DoGravity(); + Collision.StepUp(ref Projectile.position, ref Projectile.velocity, Projectile.width, Projectile.height, ref Projectile.stepSpeed, ref Projectile.gfxOffY); + Projectile.spriteDirection = Sign(Projectile.velocity.X); + Animation = Abs(Projectile.velocity.X) < 0.04f || IsMinionFacingTile() ? AnimationState.Still : AnimationState.Walk; + } + + private void ReturnToOwnerState() + { + if (Target is not null) + { + State = AIState.Attack; + return; + } + + if (!IsTileBetweenOwnerAndMinionVertically() && Collision.CanHitLine(Projectile.Center, 1, 1, Owner.Center, 1, 1) && Projectile.WithinRange(Owner.Center, 960f)) + { + State = AIState.Idle; + Projectile.velocity.Y = 5f * Sign(Projectile.velocity.Y); + return; + } + + FlyTowardsPlace(Owner.velocity.Length() + 8f, Owner.Center, Sign(Projectile.velocity.X)); + Animation = AnimationState.Fly; + } + + private void AttackState() + { + if (Target is not null) + { + Vector2 targetSpot = Elster.Center + new Vector2(-100f * Projectile.spriteDirection, -60f); + if (!Projectile.WithinRange(targetSpot, 8f)) + FlyTowardsPlace(Ariane_TargettingFlySpeed, targetSpot, Sign(Target.Center.X - Projectile.Center.X)); + else + Projectile.velocity *= 0.8f; + + if (Timer >= Ariane_BoltFireRate) + ShootBolt(); + + Animation = AnimationState.Fly; + } + else + State = AIState.Idle; + } + + private void ShootBolt() + { + if (Main.myPlayer != Projectile.owner) + return; + + Vector2 shootDirection = Projectile.SafeDirectionTo(Target.Center).RotatedByRandom(MathHelper.PiOver4); + + Projectile.NewProjectileDirect( + Projectile.GetSource_FromThis(), + Projectile.Center, + shootDirection * Ariane_BoltProjectileSpeed, + ProjectileType(), + Projectile.damage, + Projectile.knockBack, + Projectile.owner); + + Timer = 0f; + NetUpdate(); + + // If on a dedicated server, don't bother running the visuals and sounds to save resources. + if (Main.dedServ) + return; + + Vector2 visualBoltSpawn = Projectile.Center + shootDirection * Projectile.Size.Length() / 2f; + + for (int i = 0; i < 10; i++) + { + Dust shootDust = Dust.NewDustPerfect( + visualBoltSpawn + (Vector2.UnitY * MathHelper.Lerp(-8f, 8f, Main.rand.NextFloat())).RotatedBy(visualBoltSpawn.ToRotation()), + CommonDustID, + shootDirection * Main.rand.NextFloat(3f, 6f), + Scale: Main.rand.NextFloat(0.6f, 0.8f)); + shootDust.noGravity = true; + } + + Particle outerRing = new DirectionalPulseRing( + visualBoltSpawn, + Vector2.Zero, + Color.Red, + new Vector2(0.4f, 1f), + shootDirection.ToRotation(), + 0.05f, + 0.3f, + 20); + + Particle innerRing = new DirectionalPulseRing( + visualBoltSpawn, + Vector2.Zero, + Color.Fuchsia, + new Vector2(0.5f, 1f), + shootDirection.ToRotation(), + 0.05f, + 0.15f, + 20); + + GeneralParticleHandler.SpawnParticle(outerRing); + GeneralParticleHandler.SpawnParticle(innerRing); + + SoundEngine.PlaySound(new("CalamityMod/Sounds/Custom/SCalSounds/BrimstoneHellblastSound") { Pitch = 0.4f }, Projectile.Center); + } + + private void FlyTowardsPlace(float speed, Vector2 place, int spriteDirection) + { + Projectile.velocity = (Projectile.velocity * 20f + Projectile.SafeDirectionTo(place) * speed) / 21f; + Projectile.spriteDirection = spriteDirection; + } + + private void NetUpdate() + { + Projectile.netUpdate = true; + if (Projectile.netSpam >= 10) + Projectile.netSpam = 9; + } + + #endregion + + #region Syncing + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(FrameAmount); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + FrameAmount = reader.ReadInt32(); + } + + #endregion + + #region Drawing & Animation + + public override void DoAnimation() + { + if (Animation == AnimationState.Still) + return; + + FramesUntilNextAnimationFrame = Animation == AnimationState.Walk ? (int)Utils.Remap(Abs(Projectile.velocity.X), 0f, 6f, 8f, 4f) : 5; + + Projectile.frameCounter++; + if (Projectile.frameCounter >= FramesUntilNextAnimationFrame) + { + Projectile.frameCounter = 0; + Projectile.frame = (Projectile.frame + 1) % FrameAmount; + } + } + + public override bool PreDraw(ref Color lightColor) + { + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D glowTexture = Request(GlowTexture).Value; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + Rectangle frame = texture.Frame(3, 9, (int)Animation, Projectile.frame); + Vector2 origin = frame.Size() * 0.5f; + SpriteEffects flipSprite = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + + Main.EntitySpriteDraw(texture, drawPosition, frame, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, flipSprite); + Main.EntitySpriteDraw(glowTexture, drawPosition, frame, Color.White, Projectile.rotation, origin, Projectile.scale, flipSprite); + + if (Animation == AnimationState.Still || Animation == AnimationState.Walk) + { + float yOffset = 12f; + if (Animation == AnimationState.Walk) + { + switch (Projectile.frame) + { + default: + break; + + case 1: + case 2: + case 5: + case 6: + case 7: + yOffset = 14f; + break; + } + } + + Texture2D blinkTexture_FirstEye = ModContent.Request("CalamityMod/ExtraTextures/ArianeAndElsterBlink_FirstEye", AssetRequestMode.ImmediateLoad).Value; + Texture2D blinkTexture_SecondEye = ModContent.Request("CalamityMod/ExtraTextures/ArianeAndElsterBlink_SecondEye", AssetRequestMode.ImmediateLoad).Value; + + Rectangle blinkFrame = blinkTexture_FirstEye.Frame(1, 3, 0, EyeFrameToShow); + drawPosition += new Vector2(Projectile.spriteDirection == -1 ? 7f : 11f, yOffset); + Vector2 blinkDrawPos = new Vector2(drawPosition.X, drawPosition.Y); + Color skinColor = new Color(186, 144, 113, 255); + Main.EntitySpriteDraw(Projectile.spriteDirection == -1 ? blinkTexture_SecondEye : blinkTexture_FirstEye, blinkDrawPos, blinkFrame, skinColor, Projectile.rotation, origin, Projectile.scale, flipSprite); + + blinkFrame = blinkTexture_SecondEye.Frame(1, 3, 0, EyeFrameToShow); + blinkDrawPos = new Vector2(drawPosition.X + 8f, drawPosition.Y); + Main.EntitySpriteDraw(Projectile.spriteDirection == -1 ? blinkTexture_FirstEye : blinkTexture_SecondEye, blinkDrawPos, blinkFrame, skinColor, Projectile.rotation, origin, Projectile.scale, flipSprite); + } + + return false; + } + + private void UpdateEyeFrameToShow(Player player) + { + EyeFrame eyeFrameToShow = EyeFrame.EyeOpen; + switch (state) + { + case EyeState.NormalBlinking: + { + int eyeFrameChoiceBasedOnTime = timeInState % 240 - 234; + eyeFrameToShow = ((eyeFrameChoiceBasedOnTime >= 4) ? EyeFrame.EyeHalfClosed : ((eyeFrameChoiceBasedOnTime < 2) ? ((eyeFrameChoiceBasedOnTime >= 0) ? EyeFrame.EyeHalfClosed : EyeFrame.EyeOpen) : EyeFrame.EyeClosed)); + break; + } + + case EyeState.InStorm: + eyeFrameToShow = ((timeInState % 120 - 114 < 0) ? EyeFrame.EyeHalfClosed : EyeFrame.EyeClosed); + break; + } + + EyeFrameToShow = (int)eyeFrameToShow; + } + + private void SetStateByPlayerInfo(Player player) + { + bool storming = player.ZoneSandstorm || (player.ZoneSnow && Main.IsItRaining); + bool behindBackWall = false; + Tile tileSafely = Framing.GetTileSafely(Projectile.Center); + if (tileSafely != null) + behindBackWall = tileSafely.WallType > 0; + if (behindBackWall) + storming = false; + + if (storming) + SwitchToState(EyeState.InStorm); + else + SwitchToState(EyeState.NormalBlinking); + } + + private void SwitchToState(EyeState newState, bool resetStateTimerEvenIfAlreadyInState = false) + { + if (state != newState || resetStateTimerEvenIfAlreadyInState) + { + state = newState; + timeInState = 0; + } + } + + #endregion + } +} diff --git a/Projectiles/Summon/LiliesOfFinalityAriane.png b/Projectiles/Summon/LiliesOfFinalityAriane.png new file mode 100644 index 0000000000..e2e57bc143 Binary files /dev/null and b/Projectiles/Summon/LiliesOfFinalityAriane.png differ diff --git a/Projectiles/Summon/LiliesOfFinalityAriane_Glow.png b/Projectiles/Summon/LiliesOfFinalityAriane_Glow.png new file mode 100644 index 0000000000..888890cdc0 Binary files /dev/null and b/Projectiles/Summon/LiliesOfFinalityAriane_Glow.png differ diff --git a/Projectiles/Summon/LiliesOfFinalityBolt.cs b/Projectiles/Summon/LiliesOfFinalityBolt.cs new file mode 100644 index 0000000000..a51698a541 --- /dev/null +++ b/Projectiles/Summon/LiliesOfFinalityBolt.cs @@ -0,0 +1,134 @@ +using System; +using CalamityMod.Graphics.Primitives; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Utilities; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; +using static CalamityMod.Items.Weapons.Summon.LiliesOfFinality; + +namespace CalamityMod.Projectiles.Summon +{ + public class LiliesOfFinalityBolt : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Summon"; + + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + private ref float RandomColorOffset => ref Projectile.localAI[0]; + + private const int TimeBeforeHoming = 10; + private const int TimeDying = 15; + + private SlotId LoopingSound; + + public override void SetStaticDefaults() + { + ProjectileID.Sets.MinionShot[Type] = true; + ProjectileID.Sets.TrailingMode[Type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 6; + } + + public override void SetDefaults() + { + Projectile.DamageType = DamageClass.Summon; + Projectile.width = Projectile.height = 16; + Projectile.timeLeft = TimeBeforeHoming + Ariane_BoltTimeHoming + TimeDying; + Projectile.localNPCHitCooldown = -1; + Projectile.penetrate = -1; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.usesLocalNPCImmunity = true; + } + + public override void AI() + { + NPC target = Projectile.Center.MinionHoming(MaxEnemyDistanceDetection, Main.player[Projectile.owner]); + if (target is not null && Projectile.timeLeft > TimeDying && Projectile.timeLeft < Ariane_BoltTimeHoming) + { + float turnRate = Utils.Remap(Projectile.timeLeft, Ariane_BoltTimeHoming, TimeDying, Ariane_MinTurnRate, Ariane_MaxTurnRate); + Projectile.velocity = Projectile.velocity.ToRotation().AngleTowards(Projectile.SafeDirectionTo(target.Center).ToRotation(), turnRate).ToRotationVector2() * Ariane_BoltProjectileSpeed; + } + + // When the projectile's abut to die, it'll stop in place and spawn some dust to cover the shader suddenly cutting off. + if (Projectile.timeLeft < TimeDying - 1) + { + Projectile.velocity = Vector2.Zero; + + // If on a dedicated server, don't bother running the visuals and sounds to save resources. + if (!Main.dedServ) + { + for (int i = 0; i < 2; i++) + { + Dust fadingDust = Dust.NewDustDirect( + Projectile.position, + Projectile.width, + Projectile.height, + CommonDustID, + Scale: Main.rand.NextFloat(0.8f, 1.2f)); + fadingDust.noGravity = true; + } + } + } + + Projectile.rotation = Projectile.velocity.ToRotation(); + + // If on a dedicated server, don't bother running the visuals and sounds to save resources. + if (Main.dedServ) + return; + + if (Main.rand.NextBool()) + { + Dust trailDust = Dust.NewDustPerfect( + Projectile.Center + Main.rand.NextVector2Circular(10f, 10f), + CommonDustID, + Projectile.velocity * Main.rand.NextFloat(0.01f, 0.05f), + Scale: Main.rand.NextFloat(0.4f, 0.6f)); + trailDust.noGravity = true; + } + + if (SoundEngine.TryGetActiveSound(LoopingSound, out var sound) && sound.IsPlaying) + sound.Position = Projectile.Center; + } + + public override void OnSpawn(IEntitySource source) + { + // Since we don't want all the projectiles on screen to cycle through the same colors at the same time, we set an initial offset to the color. + RandomColorOffset = Main.rand.NextFloat(100f); + + LoopingSound = SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/ArianeShot") with { Volume = 0.2f }, Projectile.Center); + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + // Since we don't want the trail to instantly disappear on hit, we'll make reduce its time alive to near death. + Projectile.timeLeft = TimeDying; + + SoundEngine.PlaySound(SoundID.Item70 with { Volume = 0.5f, Pitch = 0.4f }, Projectile.Center); + if (SoundEngine.TryGetActiveSound(LoopingSound, out var sound)) + sound.Stop(); + } + + private float WidthFunction(float completionRatio) => MathHelper.Lerp(0f, 32f, MathF.Pow(completionRatio, 1f / 2.5f)); + + private Color ColorFunction(float completionRatio) + { + float offsetTime = Main.GlobalTimeWrappedHourly + RandomColorOffset; + float fadeToEnd = MathHelper.Lerp(0.65f, 1f, (float)Math.Cos(-offsetTime * 3f) * 0.5f + 0.5f); + float fadeOpacity = Utils.GetLerpValue(1f, 0.64f, completionRatio, true) * Projectile.Opacity; + Color endColor = Color.Lerp(Color.Fuchsia, Color.Red, (float)Math.Sin(completionRatio * MathHelper.Pi * 1.6f - offsetTime * 4f) * 0.5f + 0.5f); + return Color.Lerp(Color.White, endColor, fadeToEnd) * fadeOpacity; + } + + public override bool PreDraw(ref Color lightColor) + { + GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/ScarletDevilStreak")); + PrimitiveRenderer.RenderTrail(Projectile.oldPos, new PrimitiveSettings(WidthFunction, ColorFunction, (_) => Projectile.Size * 0.5f, pixelate: false, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 32); + return false; + } + } +} diff --git a/Projectiles/Summon/LiliesOfFinalityBullet.cs b/Projectiles/Summon/LiliesOfFinalityBullet.cs new file mode 100644 index 0000000000..7dd9798613 --- /dev/null +++ b/Projectiles/Summon/LiliesOfFinalityBullet.cs @@ -0,0 +1,73 @@ +using CalamityMod.Graphics.Primitives; +using CalamityMod.Items.Weapons.Summon; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class LiliesOfFinalityBullet : ModProjectile, ILocalizedModType, IPixelatedPrimitiveRenderer + { + public new string LocalizationCategory => "Projectiles.Summon"; + + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override void SetStaticDefaults() + { + ProjectileID.Sets.MinionShot[Type] = true; + ProjectileID.Sets.TrailingMode[Type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 8; + } + + public override void SetDefaults() + { + Projectile.DamageType = DamageClass.Summon; + Projectile.width = Projectile.height = 16; + Projectile.timeLeft = 300; + Projectile.localNPCHitCooldown = -1; + Projectile.penetrate = -1; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.MaxUpdates = LiliesOfFinality.Elster_BulletMaxUpdates; + Projectile.usesLocalNPCImmunity = true; + } + + public override void AI() + { + // If on a dedicated server, don't bother running the visuals and sounds to save resources. + if (Main.dedServ) + return; + + Dust trailDust = Dust.NewDustPerfect( + Projectile.Center + Main.rand.NextVector2Circular(8f, 8f), + 64, + Projectile.velocity * Main.rand.NextFloat(0.01f, 0.05f), + Scale: Main.rand.NextFloat(1f, 1.2f)); + trailDust.noGravity = true; + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + // Since we don't want the trail to instantly disappear on hit, we'll make it stop and reduce its time alive to near death. + Projectile.velocity = Vector2.Zero; + Projectile.timeLeft = 10; + } + + private float PrimitiveWidthFunction(float completionRatio) + { + float trailPoint = 0.1f; + return completionRatio > trailPoint ? Utils.Remap(completionRatio, trailPoint, 1f, 16f, 0f) : Utils.Remap(completionRatio, trailPoint, 0f, 16f, 0f); + } + + private Color PrimitiveColorFunction(float completionRatio) => Color.Lerp(Color.DarkGoldenrod, Color.LightGoldenrodYellow, completionRatio); + + public void RenderPixelatedPrimitives(SpriteBatch spriteBatch) + { + GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/FabstaffStreak")); + PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(PrimitiveWidthFunction, PrimitiveColorFunction, (_) => Projectile.Size * 0.5f, pixelate: true, shader: GameShaders.Misc["CalamityMod:TrailStreak"])); + } + } +} diff --git a/Projectiles/Summon/LiliesOfFinalityElster.cs b/Projectiles/Summon/LiliesOfFinalityElster.cs new file mode 100644 index 0000000000..a34bfd5172 --- /dev/null +++ b/Projectiles/Summon/LiliesOfFinalityElster.cs @@ -0,0 +1,508 @@ +using System.IO; +using CalamityMod.Buffs.Summon; +using CalamityMod.Particles; +using CalamityMod.Projectiles.BaseProjectiles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.Audio; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; +using static System.MathF; +using static CalamityMod.Items.Weapons.Summon.LiliesOfFinality; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Projectiles.Summon +{ + public class LiliesOfFinalityElster : BaseMinionProjectile + { + #region Members + + private enum EyeFrame + { + EyeOpen, + EyeHalfClosed, + EyeClosed + } + + private enum EyeState + { + NormalBlinking, + InStorm + } + + private EyeState state; + private int timeInState; + + public int EyeFrameToShow { get; private set; } + + public enum AIState { Idle, ReturnToOwner, AttackOnGround, AttackFlying } + public AIState State + { + get => (AIState)Projectile.ai[0]; + set + { + Projectile.ai[0] = (float)value; + + // Just in case it doesn't reset properly. + HasShotOnce = false; + + // The minion'll be able to walk on tiles when they're not in a flying state. + Projectile.tileCollide = value == AIState.Idle || value == AIState.AttackOnGround; + + // Because some states mess with the rotation, we reset it so it doesn't cause visual issues on the states that don't deal with rotation. + Projectile.rotation = 0f; + + NetUpdate(); + } + } + + public enum AnimationState { Still, Walk, Fly, Shoot, FlyShoot } + public AnimationState Animation + { + get => (AnimationState)Projectile.ai[1]; + set + { + Projectile.ai[1] = (float)value; + + switch (value) + { + case AnimationState.Still: + Projectile.width = 32; + Projectile.frame = 0; + FrameAmount = 1; + break; + + case AnimationState.Walk: + Projectile.width = 32; + FrameAmount = 9; + break; + + case AnimationState.Fly: + Projectile.width = 36; + FrameAmount = 4; + break; + + case AnimationState.Shoot: + case AnimationState.FlyShoot: + Projectile.width = 56; + FrameAmount = 7; + break; + } + + // If the animation state is being set to the same thing every frame, don't reset the animation. + // Or if the current frame of animation is outside the amount of frames that the next animation will have, reset it. + if (Animation != value || Projectile.frame + 1 > FrameAmount) + { + Projectile.frame = 0; + Projectile.frameCounter = 0; + } + } + } + + private ref float Timer => ref Projectile.ai[2]; + + /// + /// Because the fire rate is animation frame dependent, it can stay on the same animation for multiple ticks.
+ /// We use this bool to only fire once in that span of time. + ///
+ private bool HasShotOnce; + + /// + /// The amount of animation frames there is in the current animation. + /// + private int FrameAmount = 1; + + #endregion + + #region Overridden Members + + public override int AssociatedProjectileTypeID => ProjectileType(); + public override int AssociatedBuffTypeID => BuffType(); + public override ref bool AssociatedMinionBool => ref ModdedOwner.LiliesOfFinalityBool; + public override float EnemyDistanceDetection => MaxEnemyDistanceDetection; + public override int AnimationFrames => 28; + public override bool Grounded => true; + + public override void SetDefaults() + { + Projectile.width = 32; + Projectile.height = 56; + base.SetDefaults(); + } + + public override void CheckMinionExistence() + { + base.CheckMinionExistence(); + if (Timer > 10f && Main.player[Projectile.owner].ownedProjectileCounts[ProjectileType()] == 0) + Projectile.Kill(); + } + + public override bool OnTileCollide(Vector2 oldVelocity) => false; + + public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough, ref Vector2 hitboxCenterFrac) + { + // If the projectile's above the player, it can fall through platforms to reach the player. + if (State == AIState.Idle) + fallThrough = Projectile.Bottom.Y < Owner.Top.Y; + return true; + } + + public override bool? CanDamage() => false; + + #endregion + + #region AI + + public override void MinionAI() + { + SetStateByPlayerInfo(Owner); + UpdateEyeFrameToShow(Owner); + timeInState++; + + switch (State) + { + case AIState.Idle: + IdleState(); + break; + case AIState.ReturnToOwner: + ReturnToOwnerState(); + break; + case AIState.AttackOnGround: + AttackOnGroundState(); + break; + case AIState.AttackFlying: + AttackFlyingState(); + break; + } + + Timer++; + } + + private void IdleState() + { + if (Timer > 15f) + { + if (Target is not null) + { + State = AIState.AttackOnGround; + return; + } + + if (IsTileBetweenOwnerAndMinionVertically() || !Collision.CanHitLine(Projectile.Center, 1, 1, Owner.Center, 1, 1) || !Projectile.WithinRange(Owner.Center, 960f)) + { + State = AIState.ReturnToOwner; + return; + } + + Vector2 idlePosition = Owner.Center - Vector2.UnitX * 60f * Owner.direction; + if (!Projectile.WithinRange(idlePosition, 8f)) + { + int walkDirection = Sign(idlePosition.X - Projectile.Center.X); + float maxSpeed = Utils.Remap(Abs(idlePosition.X - Projectile.Center.X), 160f, 0f, 8f, 0f); + Projectile.velocity.X += 0.08f * walkDirection; + if (Abs(Projectile.velocity.X) > maxSpeed) + Projectile.velocity.X = maxSpeed * walkDirection; + } + else + Projectile.velocity.X = 0f; + } + + DoGravity(); + Collision.StepUp(ref Projectile.position, ref Projectile.velocity, Projectile.width, Projectile.height, ref Projectile.stepSpeed, ref Projectile.gfxOffY); + Projectile.spriteDirection = Sign(Projectile.velocity.X); + Animation = Abs(Projectile.velocity.X) < 0.04f || IsMinionFacingTile() ? AnimationState.Still : AnimationState.Walk; + } + + private void ReturnToOwnerState() + { + if (Target is not null) + { + State = AIState.AttackOnGround; + return; + } + + if (!IsTileBetweenOwnerAndMinionVertically() && Collision.CanHitLine(Projectile.Center, 1, 1, Owner.Center, 1, 1) && Projectile.WithinRange(Owner.Center, 960f)) + { + State = AIState.Idle; + + // Does a little hop to confirm the minion reaches the desired height. + Projectile.velocity.Y = 5f * Sign(Projectile.velocity.Y); + + return; + } + + FlyTowardsPlace(Owner.velocity.Length() + 8f, Owner.Center, Sign(Projectile.velocity.X), AnimationState.Fly); + Projectile.rotation = MathHelper.ToRadians(Projectile.velocity.Length()) * Sign(Projectile.velocity.X); + ElevationDust(false); + } + + private void AttackOnGroundState() + { + if (Target is not null) + { + if (Projectile.Center.Y > Target.Bottom.Y || Projectile.Center.Y < Target.Top.Y) + { + State = AIState.AttackFlying; + return; + } + + // If the frame of the animation is the shooting one (and hasn't shot once yet): shoot. + if (Projectile.frame == 2 && !HasShotOnce) + ShootBullet(); + + // Reset the bool for the next shot. + if (Projectile.frame != 2 && HasShotOnce) + HasShotOnce = false; + + DoGravity(); + Projectile.velocity.X = 0f; + Projectile.spriteDirection = Sign(Target.Center.X - Projectile.Center.X); + Animation = AnimationState.Shoot; + } + else + State = AIState.Idle; + } + + private void AttackFlyingState() + { + if (Target is not null) + { + Vector2 targetSpot = Target.Center - Vector2.UnitX * (Elster_DistanceFromTarget + Target.width / 2f) * Sign(Target.Center.X - Projectile.Center.X); + if (!Projectile.WithinRange(targetSpot, 5f)) + FlyTowardsPlace(Elster_TargettingFlySpeed, targetSpot, Sign(Target.Center.X - Projectile.Center.X), AnimationState.FlyShoot); + else + Projectile.velocity *= 0.8f; + + // If the frame of the animation is the shooting one (and hasn't shot once yet): shoot. + if (Projectile.frame == 2 && !HasShotOnce) + ShootBullet(); + + // Reset the bool for the next shot. + if (Projectile.frame != 2 && HasShotOnce) + HasShotOnce = false; + + ElevationDust(true); + } + else + State = AIState.Idle; + } + + private void FlyTowardsPlace(float speed, Vector2 place, int spriteDirection, AnimationState spriteAnimation) + { + Projectile.velocity = (Projectile.velocity * 20f + Projectile.SafeDirectionTo(place) * speed) / 21f; + Projectile.spriteDirection = spriteDirection; + Animation = spriteAnimation; + } + + private void ShootBullet() + { + if (Main.myPlayer != Projectile.owner) + return; + + Vector2 bulletSpawnPosition = Projectile.Center - Vector2.UnitX * 15f * Projectile.spriteDirection; + Vector2 bulletVelocity = CalamityUtils.CalculatePredictiveAimToTargetMaxUpdates(bulletSpawnPosition, Target, Elster_BulletProjectileSpeed, Elster_BulletMaxUpdates); + + Projectile.NewProjectileDirect( + Projectile.GetSource_FromThis(), + bulletSpawnPosition, + //Vector2.UnitX * Elster_BulletProjectileSpeed * Projectile.spriteDirection, + bulletVelocity, + ProjectileType(), + (int)(Projectile.damage * 1.2f), + Projectile.knockBack, + Projectile.owner); + + HasShotOnce = true; + NetUpdate(); + + // If on a dedicated server, don't bother running the visuals and sounds to save resources. + if (Main.dedServ) + return; + + Particle shootRing = new DirectionalPulseRing( + Projectile.Center + Vector2.UnitX * Projectile.width / 2f * Projectile.spriteDirection, + Vector2.Zero, + Color.Goldenrod, + new Vector2(0.5f, 1f), + 0f, + 0.05f, + 0.25f, + 7); + GeneralParticleHandler.SpawnParticle(shootRing); + + SoundEngine.PlaySound(new("CalamityMod/Sounds/Custom/ElsterShot", 4) { Volume = 0.3f }, Projectile.Center); + } + + private void ElevationDust(bool shootingState) + { + // If on a dedicated server, don't bother running the visuals and sounds to save resources. + if (Main.dedServ) + return; + + Vector2 leftLeg = shootingState ? Projectile.BottomLeft + Vector2.UnitX * (Projectile.spriteDirection == -1 ? 28f : 10f) : Projectile.BottomLeft; + Vector2 rightLeg = shootingState ? Projectile.BottomRight - Vector2.UnitX * (Projectile.spriteDirection == -1 ? 10f : 28f) : Projectile.BottomRight; + + if (Main.rand.NextBool()) + { + float interpolant = Main.rand.NextFloat(); + Dust elevationDust = Dust.NewDustPerfect( + Vector2.Lerp(leftLeg, rightLeg, interpolant), + CommonDustID, + Vector2.UnitY.RotatedByRandom(MathHelper.Lerp(-MathHelper.ToRadians(15f), MathHelper.ToRadians(15f), interpolant) * Main.rand.NextFloat(8f, 12f)), + Scale: Main.rand.NextFloat(1f, 1.2f)); + elevationDust.noGravity = true; + } + + if (Main.rand.NextBool(4)) + { + float interpolant = Main.rand.NextFloat(); + Dust elevationDust = Dust.NewDustPerfect( + Vector2.Lerp(leftLeg, rightLeg, interpolant), + CommonDustID, + -Vector2.UnitY * Main.rand.NextFloat(3f, 6f), + Scale: Main.rand.NextFloat(1f, 1.2f)); + elevationDust.noGravity = true; + } + } + + private void NetUpdate() + { + Projectile.netUpdate = true; + if (Projectile.netSpam >= 10) + Projectile.netSpam = 9; + } + + #endregion + + #region Syncing + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(HasShotOnce); + writer.Write(FrameAmount); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + HasShotOnce = reader.ReadBoolean(); + FrameAmount = reader.ReadInt32(); + } + + #endregion + + #region Drawing & Animation + + public override void DoAnimation() + { + if (Animation == AnimationState.Still) + return; + + FramesUntilNextAnimationFrame = Animation == AnimationState.Walk ? (int)Utils.Remap(Abs(Projectile.velocity.X), 0f, 6f, 8f, 4f) : 5; + + Projectile.frameCounter++; + if (Projectile.frameCounter >= FramesUntilNextAnimationFrame) + { + Projectile.frameCounter = 0; + Projectile.frame = (Projectile.frame + 1) % FrameAmount; + } + } + + public override bool PreDraw(ref Color lightColor) + { + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + Rectangle frame = texture.Frame(5, 9, (int)Animation, Projectile.frame); + Vector2 origin = frame.Size() * 0.5f; + SpriteEffects flipSprite = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + Main.EntitySpriteDraw(texture, drawPosition, frame, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, flipSprite); + + if (Animation == AnimationState.Still || Animation == AnimationState.Walk) + { + float yOffset = -2f; + if (Animation == AnimationState.Walk) + { + switch (Projectile.frame) + { + default: + break; + + case 0: + case 1: + yOffset = 0f; + break; + + case 6: + case 7: + yOffset = -4f; + break; + } + } + + Texture2D blinkTexture_FirstEye = ModContent.Request("CalamityMod/ExtraTextures/ArianeAndElsterBlink_FirstEye", AssetRequestMode.ImmediateLoad).Value; + Texture2D blinkTexture_SecondEye = ModContent.Request("CalamityMod/ExtraTextures/ArianeAndElsterBlink_SecondEye", AssetRequestMode.ImmediateLoad).Value; + + Rectangle blinkFrame = blinkTexture_FirstEye.Frame(1, 3, 0, EyeFrameToShow); + drawPosition += new Vector2(Projectile.spriteDirection == -1 ? 2f : 6f, yOffset); + Vector2 blinkDrawPos = new Vector2(drawPosition.X, drawPosition.Y); + Color skinColor = new Color(186, 144, 113, 255); + Main.EntitySpriteDraw(Projectile.spriteDirection == -1 ? blinkTexture_SecondEye : blinkTexture_FirstEye, blinkDrawPos, blinkFrame, skinColor, Projectile.rotation, origin, Projectile.scale, flipSprite); + + blinkFrame = blinkTexture_SecondEye.Frame(1, 3, 0, EyeFrameToShow); + blinkDrawPos = new Vector2(drawPosition.X + 8f, drawPosition.Y); + Main.EntitySpriteDraw(Projectile.spriteDirection == -1 ? blinkTexture_FirstEye : blinkTexture_SecondEye, blinkDrawPos, blinkFrame, skinColor, Projectile.rotation, origin, Projectile.scale, flipSprite); + } + + return false; + } + + private void UpdateEyeFrameToShow(Player player) + { + EyeFrame eyeFrameToShow = EyeFrame.EyeOpen; + switch (state) + { + case EyeState.NormalBlinking: + { + int eyeFrameChoiceBasedOnTime = timeInState % 300 - 294; + eyeFrameToShow = ((eyeFrameChoiceBasedOnTime >= 4) ? EyeFrame.EyeHalfClosed : ((eyeFrameChoiceBasedOnTime < 2) ? ((eyeFrameChoiceBasedOnTime >= 0) ? EyeFrame.EyeHalfClosed : EyeFrame.EyeOpen) : EyeFrame.EyeClosed)); + break; + } + + case EyeState.InStorm: + eyeFrameToShow = ((timeInState % 150 - 144 < 0) ? EyeFrame.EyeHalfClosed : EyeFrame.EyeClosed); + break; + } + + EyeFrameToShow = (int)eyeFrameToShow; + } + + private void SetStateByPlayerInfo(Player player) + { + bool storming = player.ZoneSandstorm || (player.ZoneSnow && Main.IsItRaining); + bool behindBackWall = false; + Tile tileSafely = Framing.GetTileSafely(Projectile.Center); + if (tileSafely != null) + behindBackWall = tileSafely.WallType > 0; + if (behindBackWall) + storming = false; + + if (storming) + SwitchToState(EyeState.InStorm); + else + SwitchToState(EyeState.NormalBlinking); + } + + private void SwitchToState(EyeState newState, bool resetStateTimerEvenIfAlreadyInState = false) + { + if (state != newState || resetStateTimerEvenIfAlreadyInState) + { + state = newState; + timeInState = 0; + } + } + + #endregion + } +} diff --git a/Projectiles/Summon/LiliesOfFinalityElster.png b/Projectiles/Summon/LiliesOfFinalityElster.png new file mode 100644 index 0000000000..b3548630c0 Binary files /dev/null and b/Projectiles/Summon/LiliesOfFinalityElster.png differ diff --git a/Projectiles/Summon/LostSoulGiant.cs b/Projectiles/Summon/LostSoulGiant.cs index 6f930ad5e6..0db6da9464 100644 --- a/Projectiles/Summon/LostSoulGiant.cs +++ b/Projectiles/Summon/LostSoulGiant.cs @@ -1,10 +1,10 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { @@ -72,7 +72,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { SpriteEffects direction = Projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Rectangle frame = texture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); for (int i = 0; i < 4; i++) { diff --git a/Projectiles/Summon/LostSoulGold.cs b/Projectiles/Summon/LostSoulGold.cs index 8950a88872..e21c967adb 100644 --- a/Projectiles/Summon/LostSoulGold.cs +++ b/Projectiles/Summon/LostSoulGold.cs @@ -1,10 +1,10 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { SpriteEffects direction = Projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Rectangle frame = texture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); for (int i = 0; i < 4; i++) { diff --git a/Projectiles/Summon/LostSoulLarge.cs b/Projectiles/Summon/LostSoulLarge.cs index 12ea38a547..91540b2511 100644 --- a/Projectiles/Summon/LostSoulLarge.cs +++ b/Projectiles/Summon/LostSoulLarge.cs @@ -1,10 +1,10 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { @@ -44,7 +44,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { SpriteEffects direction = Projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Rectangle frame = texture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); for (int i = 0; i < 4; i++) { diff --git a/Projectiles/Summon/LostSoulSmall.cs b/Projectiles/Summon/LostSoulSmall.cs index de007314d7..df8a619ad4 100644 --- a/Projectiles/Summon/LostSoulSmall.cs +++ b/Projectiles/Summon/LostSoulSmall.cs @@ -1,10 +1,10 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { SpriteEffects direction = Projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Rectangle frame = texture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); for (int i = 0; i < 4; i++) { diff --git a/Projectiles/Summon/LuxorsGiftSummon.cs b/Projectiles/Summon/LuxorsGiftSummon.cs index de2b181995..044636fc24 100644 --- a/Projectiles/Summon/LuxorsGiftSummon.cs +++ b/Projectiles/Summon/LuxorsGiftSummon.cs @@ -48,7 +48,7 @@ namespace CalamityMod.Projectiles.Summon Vector2 rotate = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; rotate = rotate.RotatedBy((double)((float)(i - (dustAmt / 2 - 1)) * 6.28318548f / (float)dustAmt), default) + Projectile.Center; Vector2 faceDirection = rotate - Projectile.Center; - int dust = Dust.NewDust(rotate + faceDirection, 0, 0, 107, faceDirection.X * 1.75f, faceDirection.Y * 1.75f, 100, default, 1.1f); + int dust = Dust.NewDust(rotate + faceDirection, 0, 0, DustID.TerraBlade, faceDirection.X * 1.75f, faceDirection.Y * 1.75f, 100, default, 1.1f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity = faceDirection; } diff --git a/Projectiles/Summon/MK2FlaskSummon.cs b/Projectiles/Summon/MK2FlaskSummon.cs index 4b04ec3c16..23f918e7e3 100644 --- a/Projectiles/Summon/MK2FlaskSummon.cs +++ b/Projectiles/Summon/MK2FlaskSummon.cs @@ -1,9 +1,9 @@ using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { public class MK2FlaskSummon : ModProjectile, ILocalizedModType diff --git a/Projectiles/Summon/MK2RocketHoming.cs b/Projectiles/Summon/MK2RocketHoming.cs index b69fb96da3..0d1e44946f 100644 --- a/Projectiles/Summon/MK2RocketHoming.cs +++ b/Projectiles/Summon/MK2RocketHoming.cs @@ -1,9 +1,9 @@ using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { public class MK2RocketHoming : ModProjectile, ILocalizedModType diff --git a/Projectiles/Summon/MK2RocketNormal.cs b/Projectiles/Summon/MK2RocketNormal.cs index 818b71f7d8..0e785f7f96 100644 --- a/Projectiles/Summon/MK2RocketNormal.cs +++ b/Projectiles/Summon/MK2RocketNormal.cs @@ -1,9 +1,9 @@ using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { public class MK2RocketNormal : ModProjectile, ILocalizedModType diff --git a/Projectiles/Summon/MechwormBody.cs b/Projectiles/Summon/MechwormBody.cs index 74715086f7..70e74c2a7e 100644 --- a/Projectiles/Summon/MechwormBody.cs +++ b/Projectiles/Summon/MechwormBody.cs @@ -1,9 +1,9 @@ -using CalamityMod.Buffs.DamageOverTime; +using System.Collections.Generic; +using System.Linq; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System.Collections.Generic; -using System.Linq; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -193,7 +193,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Vector2 drawPosition = Projectile.Center - Main.screenPosition; Main.EntitySpriteDraw(tex, drawPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; diff --git a/Projectiles/Summon/MechwormHead.cs b/Projectiles/Summon/MechwormHead.cs index db5c081c62..4e7ba8024c 100644 --- a/Projectiles/Summon/MechwormHead.cs +++ b/Projectiles/Summon/MechwormHead.cs @@ -1,16 +1,16 @@ -using CalamityMod.Buffs.Summon; +using System; +using System.Collections.Generic; +using System.IO; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.Summon; using CalamityMod.CalPlayer; using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.Collections.Generic; -using System.IO; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using CalamityMod.Buffs.DamageOverTime; namespace CalamityMod.Projectiles.Summon { @@ -114,7 +114,7 @@ namespace CalamityMod.Projectiles.Summon { for (int i = 0; i < 50; i++) { - Dust purpleElectricity = Dust.NewDustDirect(Projectile.position + Vector2.UnitY * 16f, Projectile.width, Projectile.height - 16, 234, 0f, 0f, 0, default, 1f); + Dust purpleElectricity = Dust.NewDustDirect(Projectile.position + Vector2.UnitY * 16f, Projectile.width, Projectile.height - 16, DustID.BoneTorch, 0f, 0f, 0, default, 1f); purpleElectricity.velocity *= 2f; purpleElectricity.scale *= 1.15f; } @@ -398,7 +398,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } diff --git a/Projectiles/Summon/MechwormLaser.cs b/Projectiles/Summon/MechwormLaser.cs index 1089b0eeec..2790acbd81 100644 --- a/Projectiles/Summon/MechwormLaser.cs +++ b/Projectiles/Summon/MechwormLaser.cs @@ -1,6 +1,6 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -64,7 +64,7 @@ namespace CalamityMod.Projectiles.Summon int dustAmt = Main.rand.Next(3, 7); for (int d = 0; d < dustAmt; d++) { - int rainbow = Dust.NewDust(Projectile.Center - Projectile.velocity / 2f, 0, 0, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 2.1f); + int rainbow = Dust.NewDust(Projectile.Center - Projectile.velocity / 2f, 0, 0, DustID.RainbowTorch, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 2.1f); Main.dust[rainbow].velocity *= 2f; Main.dust[rainbow].noGravity = true; } diff --git a/Projectiles/Summon/MechwormTail.cs b/Projectiles/Summon/MechwormTail.cs index 9322547cf7..703902e240 100644 --- a/Projectiles/Summon/MechwormTail.cs +++ b/Projectiles/Summon/MechwormTail.cs @@ -1,7 +1,7 @@ -using CalamityMod.Buffs.DamageOverTime; +using System.Collections.Generic; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Vector2 drawPosition = Projectile.Center - Main.screenPosition; Main.EntitySpriteDraw(tex, drawPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; diff --git a/Projectiles/Summon/MechwormTeleportRift.cs b/Projectiles/Summon/MechwormTeleportRift.cs index 6854dcc33b..97406ecd5d 100644 --- a/Projectiles/Summon/MechwormTeleportRift.cs +++ b/Projectiles/Summon/MechwormTeleportRift.cs @@ -1,6 +1,6 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Summon if (Projectile.Opacity == 1f && Main.rand.NextBool(15)) { - Dust dust = Dust.NewDustDirect(Projectile.Center, 0, 0, 267, 0f, 0f, 100, new Color(150, 100, 255, 255), 1f); + Dust dust = Dust.NewDustDirect(Projectile.Center, 0, 0, DustID.RainbowMk2, 0f, 0f, 100, new Color(150, 100, 255, 255), 1f); dust.velocity.X = 0f; dust.noGravity = true; dust.position = Projectile.Center + Main.rand.NextVector2Unit() * Main.rand.NextFloat(4f, 20f); @@ -56,7 +56,7 @@ namespace CalamityMod.Projectiles.Summon float currentFade = Utils.GetLerpValue(0f, 5f, Projectile.timeLeft, true) * Utils.GetLerpValue(Projectile.ai[0], Projectile.ai[0] - 5f, Projectile.timeLeft, true); currentFade *= (1f + 0.2f * (float)Math.Cos(Main.GlobalTimeWrappedHourly % 30f * MathHelper.Pi * 3f)) * 0.8f; - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Vector2 drawPos = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); Color baseColor = new Color(150, 100, 255, 255) * Projectile.Opacity; baseColor *= 0.5f; diff --git a/Projectiles/Summon/MidnightSunBeaconProj.cs b/Projectiles/Summon/MidnightSunBeaconProj.cs index 540d2965f7..23e4f18854 100644 --- a/Projectiles/Summon/MidnightSunBeaconProj.cs +++ b/Projectiles/Summon/MidnightSunBeaconProj.cs @@ -1,5 +1,5 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Projectiles/Summon/MidnightSunBeam.cs b/Projectiles/Summon/MidnightSunBeam.cs index 7b0017a4f1..51ec173a6b 100644 --- a/Projectiles/Summon/MidnightSunBeam.cs +++ b/Projectiles/Summon/MidnightSunBeam.cs @@ -1,12 +1,12 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; +using System; using System.IO; -using Terraria; -using Terraria.ID; -using Terraria.Enums; -using Terraria.ModLoader; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; +using Terraria; +using Terraria.Enums; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Summon { diff --git a/Projectiles/Summon/MidnightSunUFO.cs b/Projectiles/Summon/MidnightSunUFO.cs index 0dff71e507..a7ba26a3cc 100644 --- a/Projectiles/Summon/MidnightSunUFO.cs +++ b/Projectiles/Summon/MidnightSunUFO.cs @@ -1,12 +1,12 @@ -using CalamityMod.Buffs.Summon; +using System; +using CalamityMod.Buffs.Summon; using CalamityMod.CalPlayer; using CalamityMod.Items.Weapons.Summon; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { diff --git a/Projectiles/Summon/MiniGuardianAttack.cs b/Projectiles/Summon/MiniGuardianAttack.cs index 04a1022e36..26db5b6ad2 100644 --- a/Projectiles/Summon/MiniGuardianAttack.cs +++ b/Projectiles/Summon/MiniGuardianAttack.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Projectiles.Summon } private int attackDelay = 0; - + public enum MiniOffenseAIState { Vanity, @@ -39,8 +39,8 @@ namespace CalamityMod.Projectiles.Summon Fireballs } - public MiniOffenseAIState getAiState => SpawnedFromPSC ? - (MiniOffenseAIState)Math.Clamp(Projectile.ai[2], (int)MiniOffenseAIState.Spears, (int)MiniOffenseAIState.Fireballs) : + public MiniOffenseAIState getAiState => SpawnedFromPSC ? + (MiniOffenseAIState)Math.Clamp(Projectile.ai[2], (int)MiniOffenseAIState.Spears, (int)MiniOffenseAIState.Fireballs) : MiniOffenseAIState.Psa; public MiniOffenseAIState updateAiState(Player player, MiniOffenseAIState currentAIState) @@ -58,7 +58,7 @@ namespace CalamityMod.Projectiles.Summon } int currentPhase = (int)currentAIState; - + if (phaseTimer <= 0) { currentPhase++; @@ -76,11 +76,11 @@ namespace CalamityMod.Projectiles.Summon result = (MiniOffenseAIState)currentPhase; phaseTimer--; } - + Projectile.ai[2] = (int)result; return (MiniOffenseAIState)result; } - + public bool ForcedVanity => SpawnedFromPSC && !Owner.Calamity().profanedCrystalBuffs; public override void SetStaticDefaults() @@ -146,7 +146,7 @@ namespace CalamityMod.Projectiles.Summon { if (playerDist < 100f) acceleration = 0.1f; - + if (playerDist > 300f) acceleration = 1f; @@ -180,14 +180,14 @@ namespace CalamityMod.Projectiles.Summon if (acceleration > 0.05f && Projectile.velocity.Y > 0f) Projectile.velocity.Y -= acceleration * 2f; } - + } } public void AdvancedAI(NPC potentialTarget, Player owner, MiniOffenseAIState aiState) { bool buffedAi = owner.HasBuff(); - + Vector2 targetDestination = potentialTarget.Center - Projectile.Center; if (attackDelay > 0) attackDelay--; @@ -210,7 +210,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.rotation = (float)(Math.Atan(0)); float targetDist = targetDestination.Length(); - + float baseSpeed = (targetDist < 100f ? 28f : 24f) * 2f; float inertia = 20f; @@ -257,7 +257,7 @@ namespace CalamityMod.Projectiles.Summon { //fire spear SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); - + bool shouldShotGun = attackDelay == 0; if (shouldShotGun) { @@ -316,7 +316,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.velocity = Projectile.SuperhomeTowardsTarget(potentialTarget, 35f, 1f); Projectile.velocity *= 1.369f; } - + } if (attackDelay <= 0) attackDelay = buffedAi ? 20 : 25; @@ -350,13 +350,13 @@ namespace CalamityMod.Projectiles.Summon Projectile.active = false; return; } - + var psc = owner.Calamity().profanedCrystal; if (psc && !SpawnedFromPSC || !psc && SpawnedFromPSC) { Projectile.active = false; } - + // Dynamically update stats here, originalDamage can be found in MiscEffects Projectile.damage = (int)Owner.GetTotalDamage().ApplyTo(Projectile.originalDamage); Projectile.damage = Owner.ApplyArmorAccDamageBonusesTo(Projectile.damage); @@ -366,7 +366,7 @@ namespace CalamityMod.Projectiles.Summon if (owner.Calamity().profanedCrystalAnim != -1) currentAIState = MiniOffenseAIState.Vanity; - + var newAIState = updateAiState(owner, currentAIState); if (newAIState != currentAIState) diff --git a/Projectiles/Summon/MiniGuardianDefense.cs b/Projectiles/Summon/MiniGuardianDefense.cs index 613ba59a0a..7f05149aa0 100644 --- a/Projectiles/Summon/MiniGuardianDefense.cs +++ b/Projectiles/Summon/MiniGuardianDefense.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Summon public bool shieldActive => !ForcedVanity && Owner.Calamity().pSoulShieldDurability > 0; public bool shieldActiveBefore = false; - + public MiniDefenderAIState AIState => ForcedVanity ? MiniDefenderAIState.Vanity : (shieldActive ? MiniDefenderAIState.ShieldActive : MiniDefenderAIState.ShieldInactive); @@ -56,7 +56,7 @@ namespace CalamityMod.Projectiles.Summon //spawn rocks bool psc = Owner.Calamity().profanedCrystalBuffs; int rockCount = psc ? 10 : 5; - int[] validRockTypes = psc ? new int[]{ 1, 3, 4, 5, 6 } : new int[]{ 3, 5, 6 }; //1 and 4 are chonkier and psc pushes shield so it looks less weirdge + int[] validRockTypes = psc ? new int[] { 1, 3, 4, 5, 6 } : new int[] { 3, 5, 6 }; //1 and 4 are chonkier and psc pushes shield so it looks less weirdge float angleVariance = MathHelper.TwoPi / rockCount; float angle = 0f; for (int i = 0; i < rockCount; i++) @@ -112,13 +112,13 @@ namespace CalamityMod.Projectiles.Summon } var shieldIsActive = shieldActive; //avoid checkiing cooldowns multiple times per frame - + bool shouldSpawnRocks = !shieldActiveBefore && shieldIsActive; bool shouldYeetRocks = shieldActiveBefore && !shieldIsActive; - HandleRocks(shouldSpawnRocks, shouldYeetRocks); - - bool shouldDust = shouldSpawnRocks || shouldYeetRocks; - + HandleRocks(shouldSpawnRocks, shouldYeetRocks); + + bool shouldDust = shouldSpawnRocks || shouldYeetRocks; + if (shouldDust) { for (int i = 0; i < 20; i++) @@ -131,8 +131,8 @@ namespace CalamityMod.Projectiles.Summon dust.noGravity = true; } } - - + + // Doesn't deal damage directly, damage used for rocks NPC potentialTarget = Projectile.Center.MinionHoming(1500f, Owner); Vector2 playerDestination = Owner.Center - Projectile.Center; @@ -165,7 +165,7 @@ namespace CalamityMod.Projectiles.Summon else { playerDestination.X += Main.rand.NextFloat(-10f, 10f) + (75f * (shieldIsActive ? Owner.direction : -Owner.direction)); - playerDestination.Y += Main.rand.NextFloat(-10f, 10f); + playerDestination.Y += Main.rand.NextFloat(-10f, 10f); } break; case MiniDefenderAIState.Vanity: @@ -180,7 +180,7 @@ namespace CalamityMod.Projectiles.Summon float num543 = playerDestination.X; float num544 = playerDestination.Y; float num550 = 40f; - Vector2 vector43 = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); + Vector2 vector43 = Projectile.Center; float num551 = num543 - vector43.X; float num552 = num544 - vector43.Y; float num553 = (float)Math.Sqrt((double)(num551 * num551 + num552 * num552)); @@ -197,7 +197,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.velocity *= dist > 10 ? 0.9f : 0.3f; Projectile.spriteDirection = Projectile.DirectionTo(potentialTarget.Center).X > 0 ? 1 : -1; } - else + else { float playerDist = playerDestination.Length(); float acceleration = 0.5f; @@ -220,7 +220,7 @@ namespace CalamityMod.Projectiles.Summon { if (playerDist < 100f) acceleration = 0.1f; - + if (playerDist > 300f) acceleration = 1f; @@ -255,16 +255,16 @@ namespace CalamityMod.Projectiles.Summon Projectile.velocity.Y -= acceleration * 2f; } } - + // Direction if (Math.Abs(Projectile.velocity.X) > 0.2f) Projectile.direction = Projectile.spriteDirection = Math.Sign(Projectile.velocity.X); } - + Projectile.netUpdate = Projectile.netUpdate || (shieldIsActive != shieldActiveBefore); shieldActiveBefore = shieldIsActive; } - + public override bool? CanDamage() => false; public override void SendExtraAI(BinaryWriter writer) diff --git a/Projectiles/Summon/MiniGuardianHealer.cs b/Projectiles/Summon/MiniGuardianHealer.cs index 5aaca6ca4f..bd791dc12e 100644 --- a/Projectiles/Summon/MiniGuardianHealer.cs +++ b/Projectiles/Summon/MiniGuardianHealer.cs @@ -1,15 +1,15 @@ -using CalamityMod.CalPlayer; -using Microsoft.Xna.Framework; -using System; +using System; using System.IO; using CalamityMod.Buffs.Summon.Whips; +using CalamityMod.CalPlayer; using CalamityMod.Items.Accessories; using CalamityMod.NPCs.Providence; -using static CalamityMod.Items.Accessories.ProfanedSoulCrystal; +using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; +using static CalamityMod.Items.Accessories.ProfanedSoulCrystal; namespace CalamityMod.Projectiles.Summon { @@ -19,12 +19,12 @@ namespace CalamityMod.Projectiles.Summon internal const int starTimer = 180; internal const int laserTimer = 1200; private bool hasSetTimers; - + public Player Owner => Main.player[Projectile.owner]; public bool SpawnedFromPSC => Projectile.ai[0] == 1f; public bool ForcedVanity => SpawnedFromPSC && !Owner.Calamity().profanedCrystalBuffs; - + public override void SetStaticDefaults() { Main.projFrames[Projectile.type] = 4; @@ -63,7 +63,7 @@ namespace CalamityMod.Projectiles.Summon { Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - + if (modPlayer.pSoulGuardians) { Projectile.timeLeft = 2; @@ -82,19 +82,19 @@ namespace CalamityMod.Projectiles.Summon hasSetTimers = true; Projectile.netUpdate = true; } - + Projectile.MinionAntiClump(); Player owner = Owner; - + var psc = owner.Calamity().profanedCrystal; if (psc && !SpawnedFromPSC || !psc && SpawnedFromPSC) { Projectile.active = false; } - + Vector2 playerDestination = owner.Center - Projectile.Center; - bool empowered = isEmpowered; - + bool empowered = isEmpowered; + Projectile.frameCounter++; if (Projectile.frameCounter > 5) @@ -143,7 +143,7 @@ namespace CalamityMod.Projectiles.Summon int maxDust = 3; for (int k = 0; k < maxDust; k++) { - int dust = Dust.NewDust(Projectile.Center, 0, 0, 267, 0f, 0f, 0, dustColor, 1f); + int dust = Dust.NewDust(Projectile.Center, 0, 0, DustID.RainbowMk2, 0f, 0f, 0, dustColor, 1f); Main.dust[dust].position = Projectile.Center; Main.dust[dust].velocity = vector2 * starVelocity * (k * 0.5f + 1f); Main.dust[dust].noGravity = true; @@ -162,7 +162,7 @@ namespace CalamityMod.Projectiles.Summon } bool canDoLaser = player.HasBuff(); - + if (canDoLaser && Projectile.ai[2] <= 0) { SoundEngine.PlaySound(Providence.HolyRaySound, player.Center); @@ -181,28 +181,28 @@ namespace CalamityMod.Projectiles.Summon if (Main.projectile.IndexInRange(projectile)) Main.projectile[projectile].originalDamage = holyLaserDamage; - + // -60 degrees offset projectile = Projectile.NewProjectile(Projectile.GetSource_FromThis(), player.Center.X, player.Center.Y, -velocity.X, -velocity.Y, ModContent.ProjectileType(), holyLaserDamage, 0f, Main.myPlayer, -beamDirection * MathHelper.TwoPi / rotation, player.whoAmI); - + if (Main.projectile.IndexInRange(projectile)) Main.projectile[projectile].originalDamage = holyLaserDamage; - + Projectile.ai[2] = laserTimer; } Projectile.ai[1]--; - if (canDoLaser) + if (canDoLaser) Projectile.ai[2]--; } } - + if (target == null) { playerDestination.X += Main.rand.NextFloat(-5f, 5f); - playerDestination.Y += Main.rand.NextFloat(-10f, 10f); - + playerDestination.Y += Main.rand.NextFloat(-10f, 10f); + float playerDist = playerDestination.Length(); float acceleration = 0.5f; float returnSpeed = 28f; @@ -222,10 +222,10 @@ namespace CalamityMod.Projectiles.Summon } else { - + if (playerDist < 100f) acceleration = 0.1f; - + if (playerDist > 300f) acceleration = 1f; @@ -260,7 +260,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.velocity.Y -= acceleration * 2f; } } - + // Direction if (Math.Abs(Projectile.velocity.X) > 0.2f) Projectile.direction = Projectile.spriteDirection = Math.Sign(Projectile.velocity.X); @@ -277,14 +277,14 @@ namespace CalamityMod.Projectiles.Summon { playerDestination = target.Center; playerDestination.X += Main.rand.NextFloat(-5f, 5f); - playerDestination.Y += Main.rand.NextFloat(-155f, -160f); + playerDestination.Y += Main.rand.NextFloat(-155f, -160f); } - + float dist = Projectile.Center.Distance(playerDestination); float num543 = playerDestination.X; float num544 = playerDestination.Y; float num550 = 40f; - Vector2 vector43 = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); + Vector2 vector43 = Projectile.Center; float num551 = num543 - vector43.X; float num552 = num544 - vector43.Y; float num553 = (float)Math.Sqrt((double)(num551 * num551 + num552 * num552)); @@ -297,10 +297,10 @@ namespace CalamityMod.Projectiles.Summon num552 *= num553; Projectile.velocity.X = (Projectile.velocity.X * 14f + num551) / 13.5f; Projectile.velocity.Y = (Projectile.velocity.Y * 14f + num552) / 13.5f; - + if (Projectile.ai[2] <= 120f) Projectile.velocity *= dist > 10 ? MathHelper.SmoothStep(0.65f, 0.95f, 120f - Utils.GetLerpValue(120, Projectile.ai[2], 60)) : 0.1f; - else + else Projectile.velocity *= dist > 10 ? 0.9f : 0.3f; } @@ -313,9 +313,9 @@ namespace CalamityMod.Projectiles.Summon { Vector2 spawnPosition = player.Center + Main.rand.NextVector2Unit() * outwardness * Main.rand.NextFloat(0.75f, 1.1f); Vector2 dustVelocity = (player.Center - spawnPosition) * 0.085f + owner.velocity; - + int pscState = (int)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night); - + Dust dust = Dust.NewDustPerfect(spawnPosition, ProvUtils.GetDustID(pscState)); dust.velocity = dustVelocity; dust.scale = dustScale * Main.rand.NextFloat(0.75f, 1.15f); @@ -325,7 +325,7 @@ namespace CalamityMod.Projectiles.Summon } } } - + public override bool PreDraw(ref Color lightColor) { // Has afterimages if maximum empowerment diff --git a/Projectiles/Summon/MiniGuardianHolyRay.cs b/Projectiles/Summon/MiniGuardianHolyRay.cs index 3e0f18d03c..c2fa1521ab 100644 --- a/Projectiles/Summon/MiniGuardianHolyRay.cs +++ b/Projectiles/Summon/MiniGuardianHolyRay.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.tileCollide = false; Projectile.timeLeft = 600; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 3; + Projectile.localNPCHitCooldown = 3; } public override void SendExtraAI(BinaryWriter writer) @@ -49,14 +49,14 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { - + Vector2? vector78 = null; if (Projectile.velocity.HasNaNs() || Projectile.velocity == Vector2.Zero) Projectile.velocity = -Vector2.UnitY; Player owner = Main.player[Projectile.owner]; - + if (owner.active && !owner.dead) { Vector2 fireFrom = new Vector2(owner.Center.X, owner.Center.Y); @@ -66,8 +66,8 @@ namespace CalamityMod.Projectiles.Summon } else Projectile.Kill(); - - + + if (Projectile.velocity.HasNaNs() || Projectile.velocity == Vector2.Zero) Projectile.velocity = -Vector2.UnitY; @@ -141,11 +141,11 @@ namespace CalamityMod.Projectiles.Summon return false; bool dayTime = Main.dayTime; - Texture2D texture2D19 = dayTime ? ModContent.Request(Texture, AssetRequestMode.ImmediateLoad).Value : + Texture2D texture2D19 = dayTime ? ModContent.Request(Texture, AssetRequestMode.ImmediateLoad).Value : ModContent.Request("CalamityMod/Projectiles/Boss/ProvidenceHolyRayNight", AssetRequestMode.ImmediateLoad).Value; - Texture2D texture2D20 = dayTime ? ModContent.Request("CalamityMod/ExtraTextures/Lasers/ProvidenceHolyRayMid", AssetRequestMode.ImmediateLoad).Value : + Texture2D texture2D20 = dayTime ? ModContent.Request("CalamityMod/ExtraTextures/Lasers/ProvidenceHolyRayMid", AssetRequestMode.ImmediateLoad).Value : ModContent.Request("CalamityMod/ExtraTextures/Lasers/ProvidenceHolyRayMidNight", AssetRequestMode.ImmediateLoad).Value; - Texture2D texture2D21 = dayTime ? ModContent.Request("CalamityMod/ExtraTextures/Lasers/ProvidenceHolyRayEnd", AssetRequestMode.ImmediateLoad).Value : + Texture2D texture2D21 = dayTime ? ModContent.Request("CalamityMod/ExtraTextures/Lasers/ProvidenceHolyRayEnd", AssetRequestMode.ImmediateLoad).Value : ModContent.Request("CalamityMod/ExtraTextures/Lasers/ProvidenceHolyRayEndNight", AssetRequestMode.ImmediateLoad).Value; float num223 = Projectile.localAI[1]; //length of laser diff --git a/Projectiles/Summon/MiniGuardianRock.cs b/Projectiles/Summon/MiniGuardianRock.cs index 6e5299604a..5f7c775d22 100644 --- a/Projectiles/Summon/MiniGuardianRock.cs +++ b/Projectiles/Summon/MiniGuardianRock.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.usesIDStaticNPCImmunity = true; Projectile.idStaticNPCHitCooldown = 1; } - + public override void AI() { @@ -55,11 +55,10 @@ namespace CalamityMod.Projectiles.Summon Projectile.active = false; return; } - + if (Projectile.ai[0] == 0f) //regular expected behaviour of floaty rocks { // Rotation velocity - float minRotationVelocity = 0.5f; float rotationVelocityIncrease = 0.2f; rotationVelocityIncrease += rotationVelocityIncrease * (Projectile.ai[1] * 0.5f); @@ -98,23 +97,31 @@ namespace CalamityMod.Projectiles.Summon if (i == 0 || Projectile.timeLeft > 285) Dust.NewDust(Projectile.position, Projectile.width / 2, Projectile.height / 2, (int)CalamityDusts.ProfanedFire, 0f, -1f, 0, default, 1f); } - + } } - + public override bool? CanDamage() => Projectile.ai[0] >= 1f ? null : false; public override bool PreDraw(ref Color lightColor) { bool psc = Owner.Calamity().profanedCrystalBuffs; - int rockType = (int)MathHelper.Clamp(Projectile.ai[2], 1f, 6f);; + int rockType = (int)MathHelper.Clamp(Projectile.ai[2], 1f, 6f); ; Texture2D texture = ModContent.Request("CalamityMod/NPCs/ProfanedGuardians/ProfanedRocks" + rockType.ToString()).Value; - + Vector2 drawOrigin = new Vector2(texture.Width / 2, texture.Height / 2); Vector2 drawPos = Projectile.Center - Main.screenPosition; drawPos -= new Vector2(texture.Width, texture.Height) * Projectile.scale / 2f; drawPos += drawOrigin * Projectile.scale + new Vector2(0f, Projectile.gfxOffY); Rectangle frame = new Rectangle(0, 0, texture.Width, texture.Height); + float ownerDist = Projectile.Center.Distance(Owner.Center); + float lerpVal = Utils.GetLerpValue(psc ? 72 : 42, psc ? 87 : 57, ownerDist, true); + float mult = MathHelper.Lerp(0.35f, 0.42f, lerpVal); + if ((psc && ownerDist > 87f) || (!psc && ownerDist > 57f)) + { + lerpVal = Utils.GetLerpValue(psc ? 87 : 57, psc ? 150 : 120, ownerDist, true); + mult = MathHelper.Lerp(0.42f, 1f, lerpVal); + } if (CalamityConfig.Instance.Afterimages && Projectile.ai[0] >= 1f) //handle afterimages manually since the utility broke it and didn't render correctly { for (int i = 0; i < Projectile.oldPos.Length; ++i) @@ -122,12 +129,12 @@ namespace CalamityMod.Projectiles.Summon drawPos = Projectile.oldPos[i] + (Projectile.Size / 2f) - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); // DO NOT REMOVE THESE "UNNECESSARY" FLOAT CASTS. THIS WILL BREAK THE AFTERIMAGES. Color color = Projectile.GetAlpha(lightColor) * ((float)(Projectile.oldPos.Length - i) / (float)Projectile.oldPos.Length); - Main.spriteBatch.Draw(texture, drawPos, frame, color, Projectile.rotation, drawOrigin, Projectile.scale, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(texture, drawPos, frame, color * mult, Projectile.rotation, drawOrigin, Projectile.scale, SpriteEffects.None, 0f); } } else { - Main.spriteBatch.Draw(texture, drawPos, frame, Color.White, Projectile.rotation, drawOrigin, Projectile.scale, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(texture, drawPos, frame, Color.White * mult, Projectile.rotation, drawOrigin, Projectile.scale, SpriteEffects.None, 0f); } return false; diff --git a/Projectiles/Summon/MiniGuardianStars.cs b/Projectiles/Summon/MiniGuardianStars.cs index 9730b86be7..2d2092bd96 100644 --- a/Projectiles/Summon/MiniGuardianStars.cs +++ b/Projectiles/Summon/MiniGuardianStars.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Projectiles.Summon Player owner = Main.player[Projectile.owner]; Projectile.damage = (int)owner.GetTotalDamage().ApplyTo(Projectile.originalDamage); Projectile.damage = owner.ApplyArmorAccDamageBonusesTo(Projectile.damage); - + if (Projectile.ai[0] < 240f) { Projectile.ai[0] += 1f; @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Summon if (Projectile.timeLeft < 160) Projectile.timeLeft = 160; } - + if (Projectile.velocity.Length() < 16f) Projectile.velocity *= 1.01f; } @@ -51,7 +51,7 @@ namespace CalamityMod.Projectiles.Summon { float lerpMult = Utils.GetLerpValue(15f, 30f, Projectile.timeLeft, clamped: true) * Utils.GetLerpValue(240f, 200f, Projectile.timeLeft, clamped: true) * (1f + 0.2f * (float)Math.Cos(Main.GlobalTimeWrappedHourly % 30f / 0.5f * (MathHelper.Pi * 2f) * 3f)) * 0.8f; - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Vector2 drawPos = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); Color baseColor = ProfanedSoulCrystal.GetColorForPsc(Main.player[Projectile.owner].Calamity().pscState, Main.dayTime); baseColor *= 0.5f; @@ -120,7 +120,7 @@ namespace CalamityMod.Projectiles.Summon { if ((info.Damage <= 0 && Projectile.maxPenetrate < (int)Providence.BossMode.Red) || target.creativeGodMode) return; - + Projectile.Kill(); } } diff --git a/Projectiles/Summon/MiniSandShark.cs b/Projectiles/Summon/MiniSandShark.cs index 20355af939..e3d59bb319 100644 --- a/Projectiles/Summon/MiniSandShark.cs +++ b/Projectiles/Summon/MiniSandShark.cs @@ -1,7 +1,7 @@ using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { public class MiniSandShark : ModProjectile, ILocalizedModType @@ -29,7 +29,7 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { Projectile.rotation = Projectile.velocity.ToRotation(); // The projectile looks towards where it's going. - + Projectile.netUpdate = true; } @@ -41,7 +41,7 @@ namespace CalamityMod.Projectiles.Summon Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, - 85, + DustID.UnusedBrown, Projectile.velocity.X / 2f, Projectile.velocity.Y / 2f); } diff --git a/Projectiles/Summon/MirrorofKalandraMinions/AtzirisDisfavor.cs b/Projectiles/Summon/MirrorofKalandraMinions/AtzirisDisfavor.cs index c484237325..062b95b202 100644 --- a/Projectiles/Summon/MirrorofKalandraMinions/AtzirisDisfavor.cs +++ b/Projectiles/Summon/MirrorofKalandraMinions/AtzirisDisfavor.cs @@ -53,10 +53,10 @@ namespace CalamityMod.Projectiles.Summon.MirrorofKalandraMinions // Flavor visual dust effect. if (Main.rand.NextBool(3)) { - int flavorDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 228, 0, 0, 0, default, 1.2f); + int flavorDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GoldFlame, 0, 0, 0, default, 1.2f); Main.dust[flavorDust].noGravity = true; } - + if (Target is not null) { // The distance to the target plus a small number so it's not 0, it'd break calculations. @@ -119,7 +119,7 @@ namespace CalamityMod.Projectiles.Summon.MirrorofKalandraMinions public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Vector2 drawPosition = Projectile.Center - Main.screenPosition; Rectangle frame = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); Vector2 origin = frame.Size() * 0.5f; diff --git a/Projectiles/Summon/MirrorofKalandraMinions/HopeShredder.cs b/Projectiles/Summon/MirrorofKalandraMinions/HopeShredder.cs index 12ee3423c4..240bb95b91 100644 --- a/Projectiles/Summon/MirrorofKalandraMinions/HopeShredder.cs +++ b/Projectiles/Summon/MirrorofKalandraMinions/HopeShredder.cs @@ -51,7 +51,7 @@ namespace CalamityMod.Projectiles.Summon.MirrorofKalandraMinions DoAnimation(); ShootTarget(); - Projectile.rotation = Projectile.rotation.AngleTowards(CalamityUtils.CalculatePredictiveAimToTarget(Projectile.Center, Target, MirrorofKalandra.Vile_ArrowSpeed).ToRotation(), .2f); + Projectile.rotation = Projectile.rotation.AngleTowards(CalamityUtils.CalculatePredictiveAimToTargetMaxUpdates(Projectile.Center, Target, MirrorofKalandra.Vile_ArrowSpeed, MirrorofKalandra.Vile_ArrowSpeedMult).ToRotation(), .2f); } else { @@ -75,7 +75,7 @@ namespace CalamityMod.Projectiles.Summon.MirrorofKalandraMinions Vector2 spawnPosition = Projectile.Center + Projectile.rotation.ToRotationVector2() * (Projectile.width / 2); int arrow = Projectile.NewProjectile(Projectile.GetSource_FromThis(), spawnPosition, - CalamityUtils.CalculatePredictiveAimToTarget(spawnPosition, Target, MirrorofKalandra.Vile_ArrowSpeed), + CalamityUtils.CalculatePredictiveAimToTargetMaxUpdates(spawnPosition, Target, MirrorofKalandra.Vile_ArrowSpeed, MirrorofKalandra.Vile_ArrowSpeedMult), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, @@ -106,7 +106,7 @@ namespace CalamityMod.Projectiles.Summon.MirrorofKalandraMinions public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Vector2 drawPosition = Projectile.Center - Main.screenPosition; Rectangle frame = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); Vector2 origin = frame.Size() * 0.5f; @@ -116,7 +116,7 @@ namespace CalamityMod.Projectiles.Summon.MirrorofKalandraMinions Main.EntitySpriteDraw(texture, drawPosition + Projectile.rotation.ToRotationVector2() * 5f, frame, Color.DarkBlue with { A = 100 }, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0); Main.EntitySpriteDraw(texture, drawPosition, frame, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0); - + return false; } diff --git a/Projectiles/Summon/MirrorofKalandraMinions/HopeShredderArrow.cs b/Projectiles/Summon/MirrorofKalandraMinions/HopeShredderArrow.cs index 5b19b7eefd..5e064d63a7 100644 --- a/Projectiles/Summon/MirrorofKalandraMinions/HopeShredderArrow.cs +++ b/Projectiles/Summon/MirrorofKalandraMinions/HopeShredderArrow.cs @@ -29,6 +29,7 @@ namespace CalamityMod.Projectiles.Summon.MirrorofKalandraMinions Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.tileCollide = false; + Projectile.MaxUpdates = MirrorofKalandra.Vile_ArrowSpeedMult; } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => Projectile.RotatingHitboxCollision(targetHitbox.TopLeft(), targetHitbox.Size()); @@ -59,7 +60,7 @@ namespace CalamityMod.Projectiles.Summon.MirrorofKalandraMinions public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Vector2 drawPosition = Projectile.Center - Main.screenPosition; Rectangle frame = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); Vector2 origin = frame.Size() * 0.5f; diff --git a/Projectiles/Summon/MirrorofKalandraMinions/HopeShredderArrowSplit.cs b/Projectiles/Summon/MirrorofKalandraMinions/HopeShredderArrowSplit.cs index cccdcb5c00..17f60bf3c2 100644 --- a/Projectiles/Summon/MirrorofKalandraMinions/HopeShredderArrowSplit.cs +++ b/Projectiles/Summon/MirrorofKalandraMinions/HopeShredderArrowSplit.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Projectiles.Summon.MirrorofKalandraMinions Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = MirrorofKalandra.Vile_SplitIFrames; Projectile.penetrate = 3; - + Projectile.DamageType = DamageClass.Summon; Projectile.width = Projectile.height = 18; Projectile.usesLocalNPCImmunity = true; diff --git a/Projectiles/Summon/MirrorofKalandraMinions/Paradoxica.cs b/Projectiles/Summon/MirrorofKalandraMinions/Paradoxica.cs index c45801babd..2ac39278e4 100644 --- a/Projectiles/Summon/MirrorofKalandraMinions/Paradoxica.cs +++ b/Projectiles/Summon/MirrorofKalandraMinions/Paradoxica.cs @@ -99,7 +99,7 @@ namespace CalamityMod.Projectiles.Summon.MirrorofKalandraMinions // Code from Virid Vanguard @ DoBehaviour_RegularPierceSlashes(). // - int attackCycleTime = ViridVanguard.PierceChargeAttackCycleTime; + int attackCycleTime = 66; // 1.5x as long as Virid Vanguard. float upwardRiseTimeRatio = 0.4f; float pierceTimeRatio = 0.14f; @@ -184,7 +184,7 @@ namespace CalamityMod.Projectiles.Summon.MirrorofKalandraMinions public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Vector2 drawPosition = Projectile.Center - Main.screenPosition; Rectangle frame = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); Vector2 origin = frame.Size() * 0.5f; diff --git a/Projectiles/Summon/MirrorofKalandraMinions/Starforge.cs b/Projectiles/Summon/MirrorofKalandraMinions/Starforge.cs index af89fcd51f..2ddb451933 100644 --- a/Projectiles/Summon/MirrorofKalandraMinions/Starforge.cs +++ b/Projectiles/Summon/MirrorofKalandraMinions/Starforge.cs @@ -61,7 +61,7 @@ namespace CalamityMod.Projectiles.Summon.MirrorofKalandraMinions Main.rand.NextFloat(140f, 150f)); GeneralParticleHandler.SpawnParticle(mist); - int flavorDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 272, 0, 0, 0, default, .6f); + int flavorDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.WitherLightning, 0, 0, 0, default, .6f); Main.dust[flavorDust].noGravity = true; } @@ -131,7 +131,7 @@ namespace CalamityMod.Projectiles.Summon.MirrorofKalandraMinions public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Vector2 drawPosition = Projectile.Center - Main.screenPosition; Rectangle frame = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); Vector2 origin = frame.Size() * 0.5f; diff --git a/Projectiles/Summon/MirrorofKalandraMinions/StarforgeBlast.cs b/Projectiles/Summon/MirrorofKalandraMinions/StarforgeBlast.cs index bd4376eb25..6488c79e8f 100644 --- a/Projectiles/Summon/MirrorofKalandraMinions/StarforgeBlast.cs +++ b/Projectiles/Summon/MirrorofKalandraMinions/StarforgeBlast.cs @@ -1,11 +1,11 @@ -using CalamityMod.Items.Weapons.Summon; +using System; +using CalamityMod.Items.Weapons.Summon; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using System; namespace CalamityMod.Projectiles.Summon.MirrorofKalandraMinions { diff --git a/Projectiles/Summon/MirrorofKalandraMinions/WindRipper.cs b/Projectiles/Summon/MirrorofKalandraMinions/WindRipper.cs index 365e969f95..9495ba6c3a 100644 --- a/Projectiles/Summon/MirrorofKalandraMinions/WindRipper.cs +++ b/Projectiles/Summon/MirrorofKalandraMinions/WindRipper.cs @@ -51,7 +51,7 @@ namespace CalamityMod.Projectiles.Summon.MirrorofKalandraMinions DoAnimation(); ShootTarget(); - Projectile.rotation = Projectile.rotation.AngleTowards(CalamityUtils.CalculatePredictiveAimToTarget(Projectile.Center, Target, MirrorofKalandra.Wind_ArrowSpeed).ToRotation(), .2f); + Projectile.rotation = Projectile.rotation.AngleTowards(CalamityUtils.CalculatePredictiveAimToTargetMaxUpdates(Projectile.Center, Target, MirrorofKalandra.Wind_ArrowSpeed, MirrorofKalandra.Wind_ArrowSpeedMult).ToRotation(), .2f); } else { @@ -75,7 +75,7 @@ namespace CalamityMod.Projectiles.Summon.MirrorofKalandraMinions Vector2 spawnPosition = Projectile.Center + Projectile.rotation.ToRotationVector2() * (Projectile.width / 2); int arrow = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, - CalamityUtils.CalculatePredictiveAimToTarget(Projectile.Center, Target, MirrorofKalandra.Wind_ArrowSpeed), + CalamityUtils.CalculatePredictiveAimToTargetMaxUpdates(Projectile.Center, Target, MirrorofKalandra.Wind_ArrowSpeed, MirrorofKalandra.Wind_ArrowSpeedMult), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, @@ -106,7 +106,7 @@ namespace CalamityMod.Projectiles.Summon.MirrorofKalandraMinions public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Vector2 drawPosition = Projectile.Center - Main.screenPosition; Rectangle frame = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); Vector2 origin = frame.Size() * 0.5f; diff --git a/Projectiles/Summon/MirrorofKalandraMinions/WindRipperArrow.cs b/Projectiles/Summon/MirrorofKalandraMinions/WindRipperArrow.cs index a012aca1e6..e972745785 100644 --- a/Projectiles/Summon/MirrorofKalandraMinions/WindRipperArrow.cs +++ b/Projectiles/Summon/MirrorofKalandraMinions/WindRipperArrow.cs @@ -28,6 +28,7 @@ namespace CalamityMod.Projectiles.Summon.MirrorofKalandraMinions Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.tileCollide = false; + Projectile.MaxUpdates = MirrorofKalandra.Wind_ArrowSpeedMult; } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => Projectile.RotatingHitboxCollision(targetHitbox.TopLeft(), targetHitbox.Size()); @@ -50,7 +51,7 @@ namespace CalamityMod.Projectiles.Summon.MirrorofKalandraMinions public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Vector2 drawPosition = Projectile.Center - Main.screenPosition; Rectangle frame = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); Vector2 origin = frame.Size() * 0.5f; diff --git a/Projectiles/Summon/MoonFist.cs b/Projectiles/Summon/MoonFist.cs index a525b3238d..75f720a819 100644 --- a/Projectiles/Summon/MoonFist.cs +++ b/Projectiles/Summon/MoonFist.cs @@ -1,15 +1,15 @@ -using Microsoft.Xna.Framework; +using System; +using System.IO; +using CalamityMod.Buffs.Summon; +using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.Summon; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; +using Terraria.GameContent.Drawing; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using CalamityMod.Items.Weapons.Summon; -using CalamityMod.Buffs.Summon; -using System.IO; -using Terraria.GameContent.Drawing; -using CalamityMod.Dusts; namespace CalamityMod.Projectiles.Summon { @@ -239,7 +239,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Rectangle frame = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); Vector2 origin = frame.Size() * 0.5f; Vector2 drawPosition = Projectile.Center - Main.screenPosition; diff --git a/Projectiles/Summon/MoonFistTeleportVisual.cs b/Projectiles/Summon/MoonFistTeleportVisual.cs index 3412fdf0e5..7b8a3fe0df 100644 --- a/Projectiles/Summon/MoonFistTeleportVisual.cs +++ b/Projectiles/Summon/MoonFistTeleportVisual.cs @@ -1,6 +1,6 @@ -using Microsoft.Xna.Framework; +using System.Collections.Generic; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System.Collections.Generic; using Terraria; using Terraria.GameContent; using Terraria.ModLoader; @@ -29,7 +29,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - Texture2D telegraphTexture = TextureAssets.Projectile[Projectile.type].Value; + Texture2D telegraphTexture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Color telegraphColor = Color.White * Projectile.Opacity * 0.2f; telegraphColor.A = 0; diff --git a/Projectiles/Summon/MortalityBeam.cs b/Projectiles/Summon/MortalityBeam.cs index df5b7a67a6..ea0b0a81bd 100644 --- a/Projectiles/Summon/MortalityBeam.cs +++ b/Projectiles/Summon/MortalityBeam.cs @@ -1,6 +1,6 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Projectiles/Summon/MortalityBolt.cs b/Projectiles/Summon/MortalityBolt.cs index 1fc3aeca2a..26a6c2fcc0 100644 --- a/Projectiles/Summon/MortalityBolt.cs +++ b/Projectiles/Summon/MortalityBolt.cs @@ -46,7 +46,7 @@ namespace CalamityMod.Projectiles.Summon { for (int i = 0; i < 15; i++) { - Dust rainbowDust = Dust.NewDustDirect(Projectile.Center + Main.rand.NextVector2Circular(5f, 5f), 40, 40, 261); + Dust rainbowDust = Dust.NewDustDirect(Projectile.Center + Main.rand.NextVector2Circular(5f, 5f), 40, 40, DustID.AncientLight); rainbowDust.color = ProjectileColor; rainbowDust.noGravity = true; } diff --git a/Projectiles/Summon/MutatedTruffleMinion.cs b/Projectiles/Summon/MutatedTruffleMinion.cs index 6b7a38f393..6a4e05edb0 100644 --- a/Projectiles/Summon/MutatedTruffleMinion.cs +++ b/Projectiles/Summon/MutatedTruffleMinion.cs @@ -6,6 +6,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; @@ -260,7 +261,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = TextureAssets.Projectile[Projectile.type].Value; Vector2 drawPosition = Projectile.Center - Main.screenPosition; Rectangle frame = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); Vector2 origin = frame.Size() * 0.5f; diff --git a/Projectiles/Summon/MutatedTruffleToothball.cs b/Projectiles/Summon/MutatedTruffleToothball.cs index ec6d2e915a..e9e60f2538 100644 --- a/Projectiles/Summon/MutatedTruffleToothball.cs +++ b/Projectiles/Summon/MutatedTruffleToothball.cs @@ -57,7 +57,7 @@ namespace CalamityMod.Projectiles.Summon Vector2 velocity = angle.ToRotationVector2() * Main.rand.NextFloat(1f, 3f); Dust.NewDustPerfect(Projectile.Center, 7, velocity); - Dust deathDust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, 7); + Dust deathDust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.WoodFurniture); deathDust.noGravity = true; } diff --git a/Projectiles/Summon/MutatedTruffleVortex.cs b/Projectiles/Summon/MutatedTruffleVortex.cs index 01e2907748..26d1d065ce 100644 --- a/Projectiles/Summon/MutatedTruffleVortex.cs +++ b/Projectiles/Summon/MutatedTruffleVortex.cs @@ -51,7 +51,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.alpha = (int)Utils.Remap(Projectile.timeLeft, FadeoutTime, 0f, 0f, 255f); float dustDistance = Projectile.width * Projectile.scale + 25f; - Dust vortexDust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2CircularEdge(dustDistance, dustDistance), (int)CalamityDusts.SulfurousSeaAcid, Scale: 2f); + Dust vortexDust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2CircularEdge(dustDistance, dustDistance), (int)CalamityDusts.SulphurousSeaAcid, Scale: 2f); vortexDust.velocity = vortexDust.position.DirectionTo(Projectile.Center) * 10f; vortexDust.noGravity = true; diff --git a/Projectiles/Summon/OldDukeHeadCorpse.cs b/Projectiles/Summon/OldDukeHeadCorpse.cs index e6282dd4ac..e546d39384 100644 --- a/Projectiles/Summon/OldDukeHeadCorpse.cs +++ b/Projectiles/Summon/OldDukeHeadCorpse.cs @@ -1,5 +1,5 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -17,7 +17,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetDefaults() { Projectile.width = 64; - Projectile.height = 60; + Projectile.height = 58; Projectile.ignoreWater = true; Projectile.tileCollide = true; Projectile.sentry = true; @@ -59,12 +59,16 @@ namespace CalamityMod.Projectiles.Summon { Projectile.velocity.Y = 10f; } - - Projectile.StickToTiles(false, false); } public override bool? CanDamage() => false; // Don't die on tile collision public override bool OnTileCollide(Vector2 oldVelocity) => false; + + public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough, ref Vector2 hitboxCenterFrac) + { + fallThrough = false; + return true; + } } } diff --git a/Projectiles/Summon/OldDukeSharkVomit.cs b/Projectiles/Summon/OldDukeSharkVomit.cs index ac6ea79da9..5a3afae25e 100644 --- a/Projectiles/Summon/OldDukeSharkVomit.cs +++ b/Projectiles/Summon/OldDukeSharkVomit.cs @@ -1,9 +1,9 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -44,7 +44,7 @@ namespace CalamityMod.Projectiles.Summon else { Projectile.spriteDirection = 1; - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X); + Projectile.rotation = Projectile.velocity.ToRotation(); } //Homing if (Projectile.ai[0] > 20f) @@ -107,7 +107,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { SpriteEffects spriteEffects = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, 0, texture.Width, texture.Height)), Projectile.GetAlpha(lightColor), Projectile.rotation, texture.Size() / 2f, Projectile.scale, spriteEffects, 0); return false; } @@ -117,7 +117,7 @@ namespace CalamityMod.Projectiles.Summon for (int i = 0; i < Main.rand.Next(28, 41); i++) { Dust.NewDustPerfect(Projectile.Center + Utils.NextVector2Unit(Main.rand) * Main.rand.NextFloat(10f), - (int)CalamityDusts.SulfurousSeaAcid, + (int)CalamityDusts.SulphurousSeaAcid, Utils.NextVector2Unit(Main.rand) * Main.rand.NextFloat(1f, 4f)); } } diff --git a/Projectiles/Summon/PhantomGuy.cs b/Projectiles/Summon/PhantomGuy.cs index bedbe64fb8..472e64dc8a 100644 --- a/Projectiles/Summon/PhantomGuy.cs +++ b/Projectiles/Summon/PhantomGuy.cs @@ -2,9 +2,9 @@ using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { @@ -51,7 +51,7 @@ namespace CalamityMod.Projectiles.Summon Vector2 rotate = Vector2.Normalize(Projectile.velocity) * new Vector2(Projectile.width / 2f, Projectile.height) * 0.75f; rotate = rotate.RotatedBy((i - (dustAmt / 2 - 1)) * MathHelper.TwoPi / dustAmt) + Projectile.Center; Vector2 faceDirection = rotate - Projectile.Center; - int dust = Dust.NewDust(rotate + faceDirection, 0, 0, 180, faceDirection.X * 1.75f, faceDirection.Y * 1.75f, 100, default, 1.1f); + int dust = Dust.NewDust(rotate + faceDirection, 0, 0, DustID.DungeonSpirit, faceDirection.X * 1.75f, faceDirection.Y * 1.75f, 100, default, 1.1f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity = faceDirection; } @@ -206,23 +206,23 @@ namespace CalamityMod.Projectiles.Summon if (canShoot) { shootTimeCounter++; - + if (shootTimeCounter % 20 == 0 && shootTimeCounter <= 60) { SoundEngine.PlaySound(SoundID.Item20, Projectile.position); float randomRadius = Main.rand.Next(10, 14); Vector2 randomVelocity = Main.rand.NextVector2CircularEdge(randomRadius, randomRadius); - Projectile.velocity -= randomVelocity*0.22f; //funny recoil + Projectile.velocity -= randomVelocity * 0.22f; //funny recoil Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, randomVelocity.X, randomVelocity.Y, ModContent.ProjectileType(), Projectile.damage, 0f, Main.myPlayer, 0f, 0f); Projectile.netUpdate = true; - } + } if (shootTimeCounter > 200) { canShoot = false; shootTimeCounter = 0; Projectile.netUpdate = true; } - + } } diff --git a/Projectiles/Summon/PhantomicDagger.cs b/Projectiles/Summon/PhantomicDagger.cs index cabc85e146..7ffcd03e5a 100644 --- a/Projectiles/Summon/PhantomicDagger.cs +++ b/Projectiles/Summon/PhantomicDagger.cs @@ -1,6 +1,6 @@ -using Microsoft.Xna.Framework; -using System; +using System; using System.IO; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -70,7 +70,7 @@ namespace CalamityMod.Projectiles.Summon { for (int d = 0; d < 4; d++) { - int shadow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 27, 0f, 0f, 100, new Color(0, 0, 0), 2f); + int shadow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Shadowflame, 0f, 0f, 100, new Color(0, 0, 0), 2f); Main.dust[shadow].velocity *= 3f; if (Main.rand.NextBool()) { @@ -80,10 +80,10 @@ namespace CalamityMod.Projectiles.Summon } for (int d = 0; d < 12; d++) { - int shadow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 27, 0f, 0f, 100, new Color(0, 0, 0), 3f); + int shadow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Shadowflame, 0f, 0f, 100, new Color(0, 0, 0), 3f); Main.dust[shadow].noGravity = true; Main.dust[shadow].velocity *= 5f; - shadow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 27, 0f, 0f, 100, new Color(0, 0, 0), 2f); + shadow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Shadowflame, 0f, 0f, 100, new Color(0, 0, 0), 2f); Main.dust[shadow].velocity *= 2f; } @@ -104,7 +104,7 @@ namespace CalamityMod.Projectiles.Summon { for (int i = 0; i < 3; i++) { - int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 27, 0f, 0f, 100, new Color(0, 0, 0), 3f); //new Color(99, 54, 84) + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Shadowflame, 0f, 0f, 100, new Color(0, 0, 0), 3f); //new Color(99, 54, 84) Main.dust[dust].noGravity = true; } } @@ -127,7 +127,7 @@ namespace CalamityMod.Projectiles.Summon if (target != null) { float projVel = 40f; - Vector2 projDirection = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); + Vector2 projDirection = Projectile.Center; float targetXDist = target.Center.X - projDirection.X; float targetYDist = target.Center.Y - projDirection.Y; float targetDist = (float)Math.Sqrt((double)(targetXDist * targetXDist + targetYDist * targetYDist)); diff --git a/Projectiles/Summon/PhantomicShield.cs b/Projectiles/Summon/PhantomicShield.cs index 985fee3219..52bcfcef30 100644 --- a/Projectiles/Summon/PhantomicShield.cs +++ b/Projectiles/Summon/PhantomicShield.cs @@ -1,6 +1,7 @@ -using Microsoft.Xna.Framework; -using System.IO; +using System.IO; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Summon @@ -47,7 +48,7 @@ namespace CalamityMod.Projectiles.Summon { for (int d = 0; d < 6; d++) { - int shadow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 27, 0f, 0f, 100, new Color(0, 0, 0), 2f); + int shadow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Shadowflame, 0f, 0f, 100, new Color(0, 0, 0), 2f); Main.dust[shadow].velocity *= 3f; if (Main.rand.NextBool()) { @@ -57,7 +58,7 @@ namespace CalamityMod.Projectiles.Summon } for (int d = 0; d < 18; d++) { - int shadow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 27, 0f, 0f, 100, new Color(0, 0, 0), 3f); + int shadow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Shadowflame, 0f, 0f, 100, new Color(0, 0, 0), 3f); Main.dust[shadow].noGravity = true; Main.dust[shadow].velocity *= 5f; shadow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 27, 0f, 0f, 100, new Color(0, 0, 0), 2f); diff --git a/Projectiles/Summon/PinkButterfly.cs b/Projectiles/Summon/PinkButterfly.cs index 4fcfccd7bd..bdb465766b 100644 --- a/Projectiles/Summon/PinkButterfly.cs +++ b/Projectiles/Summon/PinkButterfly.cs @@ -1,12 +1,12 @@ -using CalamityMod.Buffs.Summon; +using System; +using CalamityMod.Buffs.Summon; using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { public class PinkButterfly : ModProjectile, ILocalizedModType @@ -46,7 +46,7 @@ namespace CalamityMod.Projectiles.Summon Vector2 rotate = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.5f; rotate = rotate.RotatedBy((double)((float)(i - (dustAmt / 2 - 1)) * 6.28318548f / (float)dustAmt), default) + Projectile.Center; Vector2 faceDirection = rotate - Projectile.Center; - int dust = Dust.NewDust(rotate + faceDirection, 0, 0, 73, faceDirection.X, faceDirection.Y, 100, default, 1.1f); + int dust = Dust.NewDust(rotate + faceDirection, 0, 0, DustID.PinkFairy, faceDirection.X, faceDirection.Y, 100, default, 1.1f); Main.dust[dust].noGravity = true; } Projectile.localAI[0] += 1f; @@ -194,10 +194,10 @@ namespace CalamityMod.Projectiles.Summon // Projectile fire timer if (Projectile.ai[1] > 0f) - Projectile.ai[1] += (float)Main.rand.Next(1, 3); + Projectile.ai[1] += (float)Main.rand.Next(1, 2 + 1); // Reset timer - if (Projectile.ai[1] > 300f) + if (Projectile.ai[1] > 240f) { Projectile.ai[1] = 0f; Projectile.netUpdate = true; @@ -210,7 +210,7 @@ namespace CalamityMod.Projectiles.Summon // Fire projectiles if (Projectile.ai[0] == 0f) { - float velocity = 8f; + float velocity = 10f; int projectileType = ModContent.ProjectileType(); if (canAttack && Projectile.ai[1] == 0f && Projectile.localAI[0] >= 120f) { @@ -223,10 +223,10 @@ namespace CalamityMod.Projectiles.Summon projDirectionAgain *= velocity; int numProj = 2; float rotation = MathHelper.ToRadians(4); - for (int i = 0; i < numProj + 1; i++) + for (int i = 0; i < numProj; i++) { Vector2 perturbedSpeed = projDirectionAgain.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, perturbedSpeed, projectileType, Projectile.damage / 2, Projectile.knockBack * 0.5f, Projectile.owner, targetIndex, 0f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, perturbedSpeed, projectileType, (int)(Projectile.damage * 0.85f), Projectile.knockBack * 0.5f, Projectile.owner, targetIndex, 0f); } Projectile.netUpdate = true; } @@ -237,8 +237,8 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { SpriteEffects spriteEffects = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Texture2D texture2D13 = ModContent.Request(Texture).Value; - int framing = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; + Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + int framing = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; int y6 = framing * Projectile.frame; Main.EntitySpriteDraw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)framing / 2f), Projectile.scale, spriteEffects, 0); return false; diff --git a/Projectiles/Summon/PlagueBeeSmall.cs b/Projectiles/Summon/PlagueBeeSmall.cs index 9cc11c806b..7a163764d3 100644 --- a/Projectiles/Summon/PlagueBeeSmall.cs +++ b/Projectiles/Summon/PlagueBeeSmall.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Summon @@ -156,7 +157,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; int frameHeight = texture.Height / Main.projFrames[Projectile.type]; int drawStart = frameHeight * Projectile.frame; SpriteEffects spriteEffects = SpriteEffects.None; @@ -170,7 +171,7 @@ namespace CalamityMod.Projectiles.Summon { for (int i = 0; i < 2; i++) { - int plague = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 89, Projectile.velocity.X, Projectile.velocity.Y, 50, default, 1f); + int plague = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GemEmerald, Projectile.velocity.X, Projectile.velocity.Y, 50, default, 1f); Main.dust[plague].noGravity = true; } } diff --git a/Projectiles/Summon/PlaguePrincess.cs b/Projectiles/Summon/PlaguePrincess.cs index 80e1acf742..d605fc559e 100644 --- a/Projectiles/Summon/PlaguePrincess.cs +++ b/Projectiles/Summon/PlaguePrincess.cs @@ -1,17 +1,17 @@ -using CalamityMod.CalPlayer; +using System; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.Summon; +using CalamityMod.CalPlayer; +using CalamityMod.Items.Weapons.Summon; +using CalamityMod.NPCs.PlaguebringerGoliath; +using CalamityMod.Particles; +using CalamityMod.Sounds; using Microsoft.Xna.Framework; -using System; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Items.Weapons.Summon; -using Microsoft.Xna.Framework.Graphics; -using Terraria.Audio; -using CalamityMod.Sounds; -using CalamityMod.Particles; -using CalamityMod.NPCs.PlaguebringerGoliath; namespace CalamityMod.Projectiles.Summon { @@ -236,7 +236,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.MaxUpdates = InfectedRemote.MaxUpdatesWhenCharging; float wrappedAttackTimer = AITimer % (hoverTime + chargeTime); - + // Hover into position, to the top left/right of the target. if (wrappedAttackTimer < hoverTime) { @@ -378,7 +378,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Rectangle frame = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); Vector2 origin = frame.Size() * 0.5f; Vector2 drawPosition = Projectile.Center - Main.screenPosition; diff --git a/Projectiles/Summon/PlaguebringerSummon.cs b/Projectiles/Summon/PlaguebringerSummon.cs index 0638710da8..359b783e52 100644 --- a/Projectiles/Summon/PlaguebringerSummon.cs +++ b/Projectiles/Summon/PlaguebringerSummon.cs @@ -1,9 +1,9 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.Summon; using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -78,7 +78,7 @@ namespace CalamityMod.Projectiles.Summon for (int i = 0; i < beeCount; i++) { int beeType = Main.rand.NextBool(4) ? ModContent.ProjectileType() : Owner.beeType(); // 25% chance for plague bee, otherwise depends if Hive Pack or not - Projectile bee = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Main.rand.NextVector2Circular(0.25f, 0.25f), beeType, Projectile.damage, Owner.beeKB(0f), Projectile.owner); + Projectile bee = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Main.rand.NextVector2Circular(0.25f, 0.25f), beeType, Owner.beeDamage(Projectile.damage), Owner.beeKB(0f), Projectile.owner); bee.usesLocalNPCImmunity = true; bee.localNPCHitCooldown = 10; bee.penetrate = 2; diff --git a/Projectiles/Summon/PlantationStaffSeed.cs b/Projectiles/Summon/PlantationStaffSeed.cs index 1073e5d10a..86f09239fc 100644 --- a/Projectiles/Summon/PlantationStaffSeed.cs +++ b/Projectiles/Summon/PlantationStaffSeed.cs @@ -54,7 +54,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - Texture2D texture = (RandomTexture == 0f) ? ModContent.Request(Texture).Value : ModContent.Request("CalamityMod/Projectiles/Summon/PlantationStaffSeed2").Value; + Texture2D texture = (RandomTexture == 0f) ? Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value : ModContent.Request("CalamityMod/Projectiles/Summon/PlantationStaffSeed2").Value; Vector2 drawPosition = Projectile.Center - Main.screenPosition; Rectangle frame = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); Vector2 origin = frame.Size() * 0.5f; diff --git a/Projectiles/Summon/PlantationStaffSporeCloud.cs b/Projectiles/Summon/PlantationStaffSporeCloud.cs index f8406ef3dd..d483f5e8d6 100644 --- a/Projectiles/Summon/PlantationStaffSporeCloud.cs +++ b/Projectiles/Summon/PlantationStaffSporeCloud.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.Summon Particle smoke = new SmallSmokeParticle(Projectile.Center + Main.rand.NextVector2Circular(Projectile.width / 2, Projectile.height / 2), Main.rand.NextVector2Circular(1f, 1f), Color.Green, Color.DarkGreen, Utils.Remap(Projectile.timeLeft, 180f, 0f, 1.2f, 0.2f), Utils.Remap(Projectile.timeLeft, 180f, 0f, 150f, 0f)); GeneralParticleHandler.SpawnParticle(smoke); - Dust sporeDust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, 46); + Dust sporeDust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.Poisoned); sporeDust.noGravity = true; sporeDust.velocity = Vector2.Zero; sporeDust.alpha = (int)Utils.Remap(Projectile.timeLeft, 180f, 0f, 0f, 255f); @@ -52,7 +52,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; if (RandomTexture == 1f) tex = ModContent.Request("CalamityMod/Projectiles/Summon/PlantationStaffSporeCloud2").Value; if (RandomTexture == 2f) diff --git a/Projectiles/Summon/PlantationStaffSummon.cs b/Projectiles/Summon/PlantationStaffSummon.cs index 0082fdc829..8e0f6380f5 100644 --- a/Projectiles/Summon/PlantationStaffSummon.cs +++ b/Projectiles/Summon/PlantationStaffSummon.cs @@ -336,7 +336,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Vector2 drawPosition = Projectile.Center - Main.screenPosition; Rectangle frame = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); Vector2 origin = frame.Size() * 0.5f; diff --git a/Projectiles/Summon/PlantationStaffTentacle.cs b/Projectiles/Summon/PlantationStaffTentacle.cs index e39fc24de4..ee8898e20b 100644 --- a/Projectiles/Summon/PlantationStaffTentacle.cs +++ b/Projectiles/Summon/PlantationStaffTentacle.cs @@ -114,7 +114,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.penetrate = 1; for (int dustIndex = 0; dustIndex < 20; dustIndex++) - Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, 40); + Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.JunglePlants); SoundEngine.PlaySound(SoundID.NPCDeath1, Projectile.Center); @@ -184,7 +184,7 @@ namespace CalamityMod.Projectiles.Summon public override void OnKill(int timeLeft) { for (int i = 0; i < 10; i++) - Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, 40); + Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.JunglePlants); } public override bool PreDraw(ref Color lightColor) @@ -251,7 +251,7 @@ namespace CalamityMod.Projectiles.Summon if (Projectile.type != ModContent.ProjectileType() || !MainMinion.active || MainMinion.type != ModContent.ProjectileType()) return; - Texture2D texture = TextureAssets.Projectile[MainMinion.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[MainMinion.type].Value; int height = texture.Height / Main.projFrames[MainMinion.type]; int frameHeight = height * MainMinion.frame; SpriteEffects spriteEffects = SpriteEffects.None; diff --git a/Projectiles/Summon/PlantationStaffThornball.cs b/Projectiles/Summon/PlantationStaffThornball.cs index 29a204ddab..3ced054594 100644 --- a/Projectiles/Summon/PlantationStaffThornball.cs +++ b/Projectiles/Summon/PlantationStaffThornball.cs @@ -74,7 +74,7 @@ namespace CalamityMod.Projectiles.Summon public override void OnKill(int timeLeft) { for (int dustIndex = 0; dustIndex < 10; dustIndex++) - Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, 40, newColor: Color.Pink); + Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.JunglePlants, newColor: Color.Pink); } } } diff --git a/Projectiles/Summon/PlateProjectile.cs b/Projectiles/Summon/PlateProjectile.cs index 6551f61575..951280b1a6 100644 --- a/Projectiles/Summon/PlateProjectile.cs +++ b/Projectiles/Summon/PlateProjectile.cs @@ -1,8 +1,8 @@ -using Terraria; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Microsoft.Xna.Framework; -using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { public class PlateProjectile : ModProjectile, ILocalizedModType diff --git a/Projectiles/Summon/PolypLauncherProjectile.cs b/Projectiles/Summon/PolypLauncherProjectile.cs index fb1d885b7b..d82595cdee 100644 --- a/Projectiles/Summon/PolypLauncherProjectile.cs +++ b/Projectiles/Summon/PolypLauncherProjectile.cs @@ -1,9 +1,9 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { @@ -48,11 +48,11 @@ namespace CalamityMod.Projectiles.Summon int dust_splash = 0; while (dust_splash < 9) { - Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 225, -Projectile.velocity.X * 0.15f, -Projectile.velocity.Y * 0.15f, 120, default, 1f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Coralstone, -Projectile.velocity.X * 0.15f, -Projectile.velocity.Y * 0.15f, 120, default, 1f); dust_splash += 1; } int split = 0; - int shardAmt = Main.rand.Next(1,5); + int shardAmt = Main.rand.Next(1, 5); while (split < shardAmt) { //Calculate the velocity of the projectile diff --git a/Projectiles/Summon/PolypLauncherSentry.cs b/Projectiles/Summon/PolypLauncherSentry.cs index f882cc9573..74214ad952 100644 --- a/Projectiles/Summon/PolypLauncherSentry.cs +++ b/Projectiles/Summon/PolypLauncherSentry.cs @@ -1,5 +1,5 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -47,14 +47,12 @@ namespace CalamityMod.Projectiles.Summon Projectile.velocity.Y = 10f; } - Projectile.StickToTiles(false, false); - if (Projectile.ai[0] > 0f) { Projectile.ai[0] -= 1f; return; } - Projectile.ai[1] += Main.rand.Next(1,3); + Projectile.ai[1] += Main.rand.Next(1, 3); NPC potentialTarget = Projectile.Center.MinionHoming(800f, player, false); @@ -81,6 +79,12 @@ namespace CalamityMod.Projectiles.Summon public override bool OnTileCollide(Vector2 oldVelocity) => false; + public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough, ref Vector2 hitboxCenterFrac) + { + fallThrough = false; + return true; + } + public override bool? CanDamage() => false; } } diff --git a/Projectiles/Summon/PolypLauncherShrapnel.cs b/Projectiles/Summon/PolypLauncherShrapnel.cs index 21a6bf9894..77b3440b76 100644 --- a/Projectiles/Summon/PolypLauncherShrapnel.cs +++ b/Projectiles/Summon/PolypLauncherShrapnel.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Projectiles.Summon int splash = 0; while (splash < 4) { - Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 225, -Projectile.velocity.X * 0.15f, -Projectile.velocity.Y * 0.10f, 150, default, 0.7f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Coralstone, -Projectile.velocity.X * 0.15f, -Projectile.velocity.Y * 0.10f, 150, default, 0.7f); splash += 1; } } @@ -47,7 +47,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { //Changes the texture of the projectile - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; if (Projectile.ai[0] == 1f) { texture = ModContent.Request("CalamityMod/Projectiles/Summon/PolypLauncherShrapnel2").Value; diff --git a/Projectiles/Summon/PowerfulRaven.cs b/Projectiles/Summon/PowerfulRaven.cs index d92269734d..3a0113fe1d 100644 --- a/Projectiles/Summon/PowerfulRaven.cs +++ b/Projectiles/Summon/PowerfulRaven.cs @@ -1,7 +1,7 @@ -using CalamityMod.Buffs.Summon; +using System; +using CalamityMod.Buffs.Summon; using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Projectiles/Summon/ProfanedEnergy.cs b/Projectiles/Summon/ProfanedEnergy.cs index 723a7e324f..9dbe380c6a 100644 --- a/Projectiles/Summon/ProfanedEnergy.cs +++ b/Projectiles/Summon/ProfanedEnergy.cs @@ -1,10 +1,10 @@ -using CalamityMod.Dusts; +using System; +using CalamityMod.Dusts; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { @@ -61,11 +61,11 @@ namespace CalamityMod.Projectiles.Summon } for (int j = 0; j < 10; j++) { - int fire = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, 246, 0f, 0f, 100, default, 3f); + int fire = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, DustID.GoldCoin, 0f, 0f, 100, default, 3f); Main.dust[fire].noGravity = true; Main.dust[fire].velocity *= 5f; Main.dust[fire].position = Projectile.Center; - fire = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, 246, 0f, 0f, 100, default, 2f); + fire = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, DustID.GoldCoin, 0f, 0f, 100, default, 2f); Main.dust[fire].velocity *= 2f; Main.dust[fire].position = Projectile.Center; } @@ -140,7 +140,7 @@ namespace CalamityMod.Projectiles.Summon ModContent.ProjectileType() }); float speed = 25f; - Vector2 fireDirection = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); + Vector2 fireDirection = Projectile.Center; float fireXVel = projXStore - fireDirection.X; float fireYVel = projYStore - fireDirection.Y; float fireVelocity = (float)Math.Sqrt((double)(fireXVel * fireXVel + fireYVel * fireYVel)); diff --git a/Projectiles/Summon/ProfanedSoulCrystalProjectiles.cs b/Projectiles/Summon/ProfanedSoulCrystalProjectiles.cs index 71cc0dd126..5b17d39ef2 100644 --- a/Projectiles/Summon/ProfanedSoulCrystalProjectiles.cs +++ b/Projectiles/Summon/ProfanedSoulCrystalProjectiles.cs @@ -1,22 +1,22 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using CalamityMod.NPCs.SupremeCalamitas; -using System; +using System; using System.Collections.Generic; using System.IO; using CalamityMod.Buffs.Summon.Whips; using CalamityMod.Items.Potions.Alcohol; -using static CalamityMod.Items.Accessories.ProfanedSoulCrystal; using CalamityMod.NPCs.Providence; +using CalamityMod.NPCs.SupremeCalamitas; using CalamityMod.Particles; using CalamityMod.Projectiles.Boss; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; -using Terraria.ID; -using Terraria.ModLoader; using Terraria.Audio; using Terraria.GameContent; -using Vector2 = Microsoft.Xna.Framework.Vector2; +using Terraria.ID; +using Terraria.ModLoader; +using static CalamityMod.Items.Accessories.ProfanedSoulCrystal; using static Humanizer.In; +using Vector2 = Microsoft.Xna.Framework.Vector2; namespace CalamityMod.Projectiles.Summon { @@ -119,18 +119,7 @@ namespace CalamityMod.Projectiles.Summon { Projectile.Kill(); } - if ((double)Math.Abs(Projectile.velocity.X) > 0.2) - { - Projectile.rotation = Projectile.direction; - } - if (Projectile.velocity.X < 0f) - { - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X); - } - else - { - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X); - } + Projectile.rotation = Projectile.velocity.ToRotation(); return false; } @@ -145,7 +134,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.damage = (int)Owner.GetTotalDamage().ApplyTo(Projectile.originalDamage); Projectile.damage = Owner.ApplyArmorAccDamageBonusesTo(Projectile.damage); } - + public override Color? GetAlpha(Color lightColor) { int pscState = (int)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night); @@ -154,7 +143,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Main.dayTime ? ModContent.Request(Texture).Value : ModContent.Request("CalamityMod/Projectiles/Boss/HolyBlastNight").Value; + Texture2D texture = Main.dayTime ? Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value : ModContent.Request("CalamityMod/Projectiles/Boss/HolyBlastNight").Value; int num214 = texture.Height / Main.projFrames[Projectile.type]; int y6 = num214 * Projectile.frame; int pscState = (int)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night); @@ -195,14 +184,14 @@ namespace CalamityMod.Projectiles.Summon int dustID = ProvUtils.GetDustID(pscState); for (int num193 = 0; num193 < 6; num193++) { - Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustID, 0f, 0f, 50, default, 1.5f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustID, 0f, 0f, 50, default, 1.5f); } for (int num194 = 0; num194 < 60; num194++) { - int num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustID, 0f, 0f, 0, default, 2.5f); + int num195 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustID, 0f, 0f, 0, default, 2.5f); Main.dust[num195].noGravity = true; Main.dust[num195].velocity *= 3f; - num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustID, 0f, 0f, 50, default, 1.5f); + num195 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustID, 0f, 0f, 50, default, 1.5f); Main.dust[num195].velocity *= 2f; Main.dust[num195].noGravity = true; } @@ -320,7 +309,7 @@ namespace CalamityMod.Projectiles.Summon if (Projectile.ai[1] == 0f) { float num550 = 24f; //12 - Vector2 vector43 = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); + Vector2 vector43 = Projectile.Center; float num551 = num535 - vector43.X; float num552 = num536 - vector43.Y; float num553 = (float)Math.Sqrt((double)(num551 * num551 + num552 * num552)); @@ -337,7 +326,7 @@ namespace CalamityMod.Projectiles.Summon } } } - + public override Color? GetAlpha(Color lightColor) { int pscState = (int)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night); @@ -347,7 +336,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { int pscState = (int)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night); - Texture2D texture = Main.dayTime ? ModContent.Request(Texture).Value : ModContent.Request("CalamityMod/Projectiles/Boss/HolyFire2Night").Value; + Texture2D texture = Main.dayTime ? Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value : ModContent.Request("CalamityMod/Projectiles/Boss/HolyFire2Night").Value; int num214 = texture.Height / Main.projFrames[Projectile.type]; int y6 = num214 * Projectile.frame; Projectile.DrawBackglow(ProvUtils.GetProjectileColor(pscState, Projectile.alpha, true), 4f, texture); @@ -375,7 +364,7 @@ namespace CalamityMod.Projectiles.Summon hits++; if (hits >= 25) Projectile.Kill(); - + } return false; } @@ -395,7 +384,7 @@ namespace CalamityMod.Projectiles.Summon int dust = ProvUtils.GetDustID(pscState); for (int num621 = 0; num621 < 4; num621++) { - int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dust, 0f, 0f, 100, default, Main.dayTime ? 2f : 0.5f); + int num622 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dust, 0f, 0f, 100, default, Main.dayTime ? 2f : 0.5f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool()) { @@ -405,10 +394,10 @@ namespace CalamityMod.Projectiles.Summon } for (int num623 = 0; num623 < 12; num623++) { - int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dust, 0f, 0f, 100, default, Main.dayTime ? 3f : 0.75f); + int num624 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dust, 0f, 0f, 100, default, Main.dayTime ? 3f : 0.75f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dust, 0f, 0f, 100, default, Main.dayTime ? 2f : 0.5f); + num624 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dust, 0f, 0f, 100, default, Main.dayTime ? 2f : 0.5f); Main.dust[num624].velocity *= 2f; } @@ -519,7 +508,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { int pscState = (int)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night); - Projectile.DrawBackglow(ProvUtils.GetProjectileColor(pscState, Projectile.alpha, true), 4f, ModContent.Request(Texture).Value); + Projectile.DrawBackglow(ProvUtils.GetProjectileColor(pscState, Projectile.alpha, true), 4f, Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value); CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], ProvUtils.GetProjectileColor(pscState, Projectile.alpha), 1); return false; } @@ -539,7 +528,7 @@ namespace CalamityMod.Projectiles.Summon int dust = ProvUtils.GetDustID(pscState); for (int num621 = 0; num621 < 4; num621++) { - int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dust, 0f, 0f, 100, default, Main.dayTime ? 2f : 0.5f); + int num622 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dust, 0f, 0f, 100, default, Main.dayTime ? 2f : 0.5f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool()) { @@ -549,10 +538,10 @@ namespace CalamityMod.Projectiles.Summon } for (int num623 = 0; num623 < 12; num623++) { - int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dust, 0f, 0f, 100, default, Main.dayTime ? 3f : 0.75f); + int num624 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dust, 0f, 0f, 100, default, Main.dayTime ? 3f : 0.75f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dust, 0f, 0f, 100, default, Main.dayTime ? 2f : 0.5f); + num624 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dust, 0f, 0f, 100, default, Main.dayTime ? 2f : 0.5f); Main.dust[num624].velocity *= 2f; } @@ -632,7 +621,7 @@ namespace CalamityMod.Projectiles.Summon } float num550 = 40f; - Vector2 vector43 = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); + Vector2 vector43 = Projectile.Center; float num551 = num535 - vector43.X; float num552 = num536 - vector43.Y; float num553 = (float)Math.Sqrt((double)(num551 * num551 + num552 * num552)); @@ -725,7 +714,7 @@ namespace CalamityMod.Projectiles.Summon { if (Projectile.timeLeft == 175 && Projectile.scale == 1.5f) SoundEngine.PlaySound(SoundID.DD2_BetsyFireballShot, Projectile.Center); - + var Owner = Main.player[Projectile.owner]; Projectile.damage = (int)Owner.GetTotalDamage().ApplyTo(Projectile.originalDamage); Projectile.damage = Owner.ApplyArmorAccDamageBonusesTo(Projectile.damage); @@ -744,7 +733,7 @@ namespace CalamityMod.Projectiles.Summon { Projectile.tileCollide = true; } - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; Projectile.velocity *= boomerSwarm ? 1.03f : 1.02f; int pscState = (int)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night); @@ -764,7 +753,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Main.dayTime ? ModContent.Request(Texture).Value : ModContent.Request("CalamityMod/Projectiles/Summon/ProfanedCrystalRangedHugesNight").Value; + Texture2D texture = Main.dayTime ? Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value : ModContent.Request("CalamityMod/Projectiles/Summon/ProfanedCrystalRangedHugesNight").Value; int num214 = texture.Height / Main.projFrames[Projectile.type]; int y6 = num214 * Projectile.frame; int pscState = (int)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night); @@ -807,7 +796,7 @@ namespace CalamityMod.Projectiles.Summon int dust = ProvUtils.GetDustID(pscState); for (int num621 = 0; num621 < 4; num621++) { - int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dust, 0f, 0f, 100, default, Main.dayTime ? 2f : 0.5f); + int num622 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dust, 0f, 0f, 100, default, Main.dayTime ? 2f : 0.5f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool()) { @@ -817,10 +806,10 @@ namespace CalamityMod.Projectiles.Summon } for (int num623 = 0; num623 < 12; num623++) { - int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dust, 0f, 0f, 100, default, Main.dayTime ? 3f : 0.75f); + int num624 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dust, 0f, 0f, 100, default, Main.dayTime ? 3f : 0.75f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dust, 0f, 0f, 100, default, Main.dayTime ? 2f : 0.5f); + num624 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dust, 0f, 0f, 100, default, Main.dayTime ? 2f : 0.5f); Main.dust[num624].velocity *= 2f; } @@ -906,7 +895,8 @@ namespace CalamityMod.Projectiles.Summon { Projectile.frame = 0; } - if (Projectile.ai[0] == 0f) { + if (Projectile.ai[0] == 0f) + { } Projectile.velocity.X *= 1.01f; Projectile.velocity.Y *= 1.01f; @@ -936,7 +926,7 @@ namespace CalamityMod.Projectiles.Summon int dust = ProvUtils.GetDustID(pscState); for (int num621 = 0; num621 < 10; num621++) { - int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dust, 0f, 0f, 100, default, Main.dayTime ? 2f : 0.5f); + int num622 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dust, 0f, 0f, 100, default, Main.dayTime ? 2f : 0.5f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool()) { @@ -946,10 +936,10 @@ namespace CalamityMod.Projectiles.Summon } for (int num623 = 0; num623 < 15; num623++) { - int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dust, 0f, 0f, 100, default, Main.dayTime ? 3f : 0.75f); + int num624 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dust, 0f, 0f, 100, default, Main.dayTime ? 3f : 0.75f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dust, 0f, 0f, 100, default, Main.dayTime ? 2f : 0.5f); + num624 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dust, 0f, 0f, 100, default, Main.dayTime ? 2f : 0.5f); Main.dust[num624].velocity *= 2f; } } @@ -963,7 +953,7 @@ namespace CalamityMod.Projectiles.Summon { Main.player[Projectile.owner].Calamity().rollBabSpears(50, true); } - + public override Color? GetAlpha(Color lightColor) { int pscState = (int)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night); @@ -971,7 +961,7 @@ namespace CalamityMod.Projectiles.Summon } public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; int num214 = texture.Height / Main.projFrames[Projectile.type]; int y6 = num214 * Projectile.frame; int pscState = (int)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night); @@ -990,7 +980,7 @@ namespace CalamityMod.Projectiles.Summon public class ProfanedCrystalRogueShard : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Summon"; - + public override void SetStaticDefaults() { ProjectileID.Sets.SummonTagDamageMultiplier[Type] = 0.25f; @@ -1026,12 +1016,12 @@ namespace CalamityMod.Projectiles.Summon } else { - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 2.355f; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.ToRadians(135f); if (Projectile.spriteDirection == -1) { - Projectile.rotation -= 1.57f; + Projectile.rotation -= MathHelper.PiOver2; } - + float num535 = Projectile.position.X; float num536 = Projectile.position.Y; float num537 = 2000f; @@ -1077,7 +1067,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.timeLeft++; Projectile.tileCollide = false; float num550 = 40f; - Vector2 vector43 = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); + Vector2 vector43 = Projectile.Center; float num551 = num535 - vector43.X; float num552 = num536 - vector43.Y; float num553 = (float)Math.Sqrt((double)(num551 * num551 + num552 * num552)); @@ -1134,14 +1124,14 @@ namespace CalamityMod.Projectiles.Summon { Lighting.AddLight(Projectile.Center, newColor2.ToVector3() * 0.5f); } - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) - 1.57f; + Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; int num3; for (int num979 = 0; num979 < 2; num979 = num3 + 1) { if (Main.rand.NextBool(10)) { Vector2 value55 = Vector2.UnitY.RotatedBy((double)((float)num979 * 3.14159274f), default).RotatedBy((double)Projectile.rotation, default); - Dust dust24 = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, 267, 0f, 0f, 225, newColor2, 1f)]; + Dust dust24 = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, DustID.RainbowMk2, 0f, 0f, 225, newColor2, 1f)]; dust24.noGravity = true; dust24.noLight = true; dust24.scale = Projectile.Opacity * Projectile.localAI[0]; @@ -1155,7 +1145,7 @@ namespace CalamityMod.Projectiles.Summon if (Main.rand.NextBool(10)) { Vector2 value56 = Vector2.UnitY.RotatedBy((double)((float)num980 * 3.14159274f), default); - Dust dust25 = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, 267, 0f, 0f, 225, newColor2, 1f)]; + Dust dust25 = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, DustID.RainbowMk2, 0f, 0f, 225, newColor2, 1f)]; dust25.noGravity = true; dust25.noLight = true; dust25.scale = Projectile.Opacity * Projectile.localAI[0]; @@ -1188,7 +1178,7 @@ namespace CalamityMod.Projectiles.Summon } if (flag52) { - Dust dust26 = Main.dust[Dust.NewDust(vector137, 0, 0, 267, 0f, 0f, 127, newColor2, 1f)]; + Dust dust26 = Main.dust[Dust.NewDust(vector137, 0, 0, DustID.RainbowMk2, 0f, 0f, 127, newColor2, 1f)]; dust26.noGravity = true; dust26.position = vector137; dust26.velocity = -Vector2.UnitY * scaleFactor13 * (Main.rand.NextFloat() * 0.9f + 1.6f); @@ -1235,7 +1225,7 @@ namespace CalamityMod.Projectiles.Summon float num72; for (float num70 = 0f; num70 < num69; num70 = num72 + 1f) { - int num71 = Dust.NewDust(Projectile.Center, 0, 0, 267, 0f, 0f, 0, newColor, 1f); + int num71 = Dust.NewDust(Projectile.Center, 0, 0, DustID.RainbowMk2, 0f, 0f, 0, newColor, 1f); Main.dust[num71].position = Projectile.Center; Main.dust[num71].velocity = spinningpoint.RotatedBy((double)(6.28318548f * num70 / num69), default) * value5 * (0.8f + Main.rand.NextFloat() * 0.4f); Main.dust[num71].noGravity = true; @@ -1251,7 +1241,7 @@ namespace CalamityMod.Projectiles.Summon } for (float num73 = 0f; num73 < num69; num73 = num72 + 1f) { - int num74 = Dust.NewDust(Projectile.Center, 0, 0, 267, 0f, 0f, 0, newColor, 1f); + int num74 = Dust.NewDust(Projectile.Center, 0, 0, DustID.RainbowMk2, 0f, 0f, 0, newColor, 1f); Main.dust[num74].position = Projectile.Center; Main.dust[num74].velocity = spinningpoint.RotatedBy((double)(6.28318548f * num73 / num69), default) * value5 * (0.8f + Main.rand.NextFloat() * 0.4f); Dust dust = Main.dust[num74]; @@ -1275,7 +1265,7 @@ namespace CalamityMod.Projectiles.Summon } #endregion - + #region Whip public class ProfanedCrystalWhip : ModProjectile, ILocalizedModType @@ -1284,7 +1274,8 @@ namespace CalamityMod.Projectiles.Summon private Color specialColor = Color.Orange; public Color SpecialDrawColor => specialColor; - public override void SetStaticDefaults() { + public override void SetStaticDefaults() + { ProjectileID.Sets.IsAWhip[Type] = true; } @@ -1306,8 +1297,9 @@ namespace CalamityMod.Projectiles.Summon var player = Main.player[Projectile.owner]; specialColor = GetColorForPsc(Main.dayTime ? (int)ProfanedSoulCrystalState.Vanity : player.Calamity().pscState, Main.dayTime); } - - private float Timer { + + private float Timer + { get => Projectile.ai[0]; set => Projectile.ai[0] = value; } @@ -1331,20 +1323,23 @@ namespace CalamityMod.Projectiles.Summon Projectile.spriteDirection = Projectile.velocity.X >= 0f ? 1 : -1; float swingTime = owner.itemAnimationMax * Projectile.MaxUpdates; - if (Timer >= swingTime) { + if (Timer >= swingTime) + { Projectile.Kill(); return; } owner.heldProj = Projectile.whoAmI; - if (Timer == swingTime / 2) { + if (Timer == swingTime / 2) + { List points = Projectile.WhipPointsForCollision; Projectile.FillWhipControlPoints(Projectile, points); SoundEngine.PlaySound(SoundID.Item153, points[points.Count - 1]); } - + float swingProgress = Timer / swingTime; - if (Utils.GetLerpValue(0.1f, 0.7f, swingProgress, clamped: true) * Utils.GetLerpValue(0.9f, 0.7f, swingProgress, clamped: true) > 0.5f && !Main.rand.NextBool(3)) { + if (Utils.GetLerpValue(0.1f, 0.7f, swingProgress, clamped: true) * Utils.GetLerpValue(0.9f, 0.7f, swingProgress, clamped: true) > 0.5f && !Main.rand.NextBool(3)) + { List points = Projectile.WhipPointsForCollision; points.Clear(); Projectile.FillWhipControlPoints(Projectile, points); @@ -1365,14 +1360,16 @@ namespace CalamityMod.Projectiles.Summon } } } - - private void DrawLine(List list) { + + private void DrawLine(List list) + { Texture2D texture = TextureAssets.FishingLine.Value; Rectangle frame = texture.Frame(); Vector2 origin = new Vector2(frame.Width / 2, 0); Vector2 pos = list[0]; - for (int i = 0; i < list.Count - 2; i++) { + for (int i = 0; i < list.Count - 2; i++) + { Vector2 element = list[i]; Vector2 diff = list[i + 1] - element; @@ -1384,7 +1381,8 @@ namespace CalamityMod.Projectiles.Summon pos += diff; } } - public override bool PreDraw(ref Color lightColor) { + public override bool PreDraw(ref Color lightColor) + { List list = new List(); Projectile.FillWhipControlPoints(Projectile, list); @@ -1393,34 +1391,39 @@ namespace CalamityMod.Projectiles.Summon SpriteEffects flip = SpriteEffects.FlipHorizontally; Main.instance.LoadProjectile(Type); - Texture2D texture = TextureAssets.Projectile[Type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; Vector2 pos = list[0]; - for (int i = 0; i < list.Count - 1; i++) { + for (int i = 0; i < list.Count - 1; i++) + { Rectangle frame = new Rectangle(0, 0, 16, 22); // The size of the Handle (measured in pixels) Vector2 origin = new Vector2(5, 8); // Offset for where the player's hand will start measured from the top left of the image. float scale = 1; - - if (i == list.Count - 2) { + + if (i == list.Count - 2) + { frame.Y = 126; // Distance from the top of the sprite to the start of the frame. frame.Height = 34; // Height of the frame. - + Projectile.GetWhipSettings(Projectile, out float timeToFlyOut, out int _, out float _); float t = Timer / timeToFlyOut; scale = MathHelper.Lerp(0.5f, 1.5f, Utils.GetLerpValue(0.1f, 0.7f, t, true) * Utils.GetLerpValue(0.9f, 0.7f, t, true)); } - else if (i > 6) { + else if (i > 6) + { // Third segment frame.Y = 102; frame.Height = 18; } - else if (i > 3) { + else if (i > 3) + { // Second Segment frame.Y = 70; frame.Height = 18; } - else if (i > 0) { + else if (i > 0) + { // First Segment frame.Y = 38; frame.Height = 18; @@ -1441,17 +1444,17 @@ namespace CalamityMod.Projectiles.Summon public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { int buffTime = CalamityUtils.SecondsToFrames(30); //30 second debuff to allow for time to swap and use other weapons - target.AddBuff(ModContent.BuffType(), buffTime); + target.AddBuff(ModContent.BuffType(), buffTime); Main.player[Projectile.owner].AddBuff(ModContent.BuffType(), buffTime); Main.player[Projectile.owner].MinionAttackTargetNPC = target.whoAmI; Projectile.damage = (int)(Projectile.damage * 0.7f); // multihit penalty } } - + #endregion - + #region Animation Projectiles - + public class PscTransformAnimation : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Typeless"; @@ -1480,7 +1483,7 @@ namespace CalamityMod.Projectiles.Summon var owner = Main.player[Projectile.owner]; owner.Calamity().profanedCrystalAnim = Projectile.timeLeft; - + Projectile.Center = owner.Center; if (!owner.Calamity().profanedCrystal) @@ -1490,7 +1493,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.active = false; return; } - + if (Projectile.timeLeft > 1) { int dustCount = (int)Math.Round(MathHelper.SmoothStep(1f, 3f, ((float)maxPscAnimTime - (float)owner.Calamity().profanedCrystalAnim) / (float)maxPscAnimTime)); @@ -1503,9 +1506,9 @@ namespace CalamityMod.Projectiles.Summon { Vector2 spawnPosition = Projectile.Center + Main.rand.NextVector2Unit() * outwardness * Main.rand.NextFloat(0.75f, 1.1f); Vector2 dustVelocity = (Projectile.Center - spawnPosition) * 0.085f + owner.velocity; - + int pscState = (int)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night); - + Dust dust = Dust.NewDustPerfect(spawnPosition, ProvUtils.GetDustID(pscState)); dust.velocity = dustVelocity; dust.scale = dustScale * Main.rand.NextFloat(0.75f, 1.15f); @@ -1544,7 +1547,7 @@ namespace CalamityMod.Projectiles.Summon DetermineTransformationEligibility(owner); if (!Main.dedServ) { - var color = GetColorForPsc(owner.Calamity().pscState, Main.dayTime) with {A = 255}; //WHY THE FUCK IS THE ALPHA INVERTED FOR THIS + var color = GetColorForPsc(owner.Calamity().pscState, Main.dayTime) with { A = 255 }; //WHY THE FUCK IS THE ALPHA INVERTED FOR THIS Particle wtfIsAParticle = new DirectionalPulseRing(owner.Center, Vector2.Zero, color, Vector2.One, 0f, 0f, 2.5f, 75); GeneralParticleHandler.SpawnParticle(wtfIsAParticle); } @@ -1553,7 +1556,7 @@ namespace CalamityMod.Projectiles.Summon } public override bool? CanDamage() => false; - + public override void OnKill(int timeLeft) { @@ -1572,7 +1575,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.active = false; } } - + public class PscTransformRocks : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Typeless"; @@ -1616,7 +1619,7 @@ namespace CalamityMod.Projectiles.Summon //scale up the proj if (Projectile.scale < 1.25f) Projectile.scale += 0.1f; - + //if it's not allowed to stick around, fade into oblivion if ((Projectile.velocity.Length() <= 3f && Projectile.ai[0] == 0f) || Projectile.timeLeft <= 25) Projectile.alpha += Projectile.ai[0] == 0f ? 20 : 10; @@ -1624,11 +1627,11 @@ namespace CalamityMod.Projectiles.Summon //if the anim has finished, fade, regardless of where the projectile is if (owner.Calamity().profanedCrystalAnim == -1) Projectile.alpha += 15; - + //kill any projectiles that are fully faded if (Projectile.alpha >= 255) Projectile.active = false; - + //slow down upon reaching the player if (Projectile.Hitbox.Intersects(owner.Hitbox)) Projectile.velocity *= 0.1f; @@ -1647,7 +1650,7 @@ namespace CalamityMod.Projectiles.Summon { int rockType = (int)MathHelper.Clamp(Projectile.ai[1], 1f, 6f); Texture2D texture = ModContent.Request(Texture[..^1] + rockType.ToString()).Value; - + Vector2 drawOrigin = new Vector2(texture.Width / 2, texture.Height / 2); Vector2 drawPos = Projectile.Center - Main.screenPosition; drawPos -= new Vector2(texture.Width, texture.Height) * Projectile.scale / 2f; @@ -1670,8 +1673,8 @@ namespace CalamityMod.Projectiles.Summon return false; } } - - + + #endregion #region Bab Projectiles @@ -1765,7 +1768,7 @@ namespace CalamityMod.Projectiles.Summon if (Projectile.ai[1] == 0f) { float num550 = 24f; //12 - Vector2 vector43 = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); + Vector2 vector43 = Projectile.Center; float num551 = num535 - vector43.X; float num552 = num536 - vector43.Y; float num553 = (float)Math.Sqrt((double)(num551 * num551 + num552 * num552)); @@ -1793,7 +1796,7 @@ namespace CalamityMod.Projectiles.Summon //Ensure that psa's spears are not coloured by night var psc = Projectile.ai[0] > 0f; int pscState = (int)((!Main.dayTime && psc) ? Providence.BossMode.Night : Providence.BossMode.Day); - int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, ProvUtils.GetDustID(pscState), 0f, 0f, 100, default, !Main.dayTime && psc ? 0.5f : 1f); + int num469 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ProvUtils.GetDustID(pscState), 0f, 0f, 100, default, !Main.dayTime && psc ? 0.5f : 1f); Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; handleAI(psc && Projectile.ai[1] > 0f); @@ -1811,7 +1814,7 @@ namespace CalamityMod.Projectiles.Summon { var psc = Projectile.ai[0] > 0f; int pscState = (int)((!Main.dayTime && psc) ? Providence.BossMode.Night : Providence.BossMode.Day); - Projectile.DrawBackglow(ProvUtils.GetProjectileColor(pscState, Projectile.alpha, true), 4f, ModContent.Request(Texture).Value); + Projectile.DrawBackglow(ProvUtils.GetProjectileColor(pscState, Projectile.alpha, true), 4f, Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value); CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], ProvUtils.GetProjectileColor(pscState, Projectile.alpha), 1); return false; } @@ -1832,7 +1835,7 @@ namespace CalamityMod.Projectiles.Summon int dustID = ProvUtils.GetDustID(pscState); for (int num621 = 0; num621 < 4; num621++) { - int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustID, 0f, 0f, 100, default, !Main.dayTime && psc ? 0.5f : 2f); + int num622 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustID, 0f, 0f, 100, default, !Main.dayTime && psc ? 0.5f : 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool()) { @@ -1842,11 +1845,11 @@ namespace CalamityMod.Projectiles.Summon } for (int num623 = 0; num623 < (shouldAdjust ? 8 : 12); num623++) { - int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustID, 0f, 0f, 100, default, !Main.dayTime && psc ? 1.25f : 3f); + int num624 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustID, 0f, 0f, 100, default, !Main.dayTime && psc ? 1.25f : 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; Main.dust[num624].fadeIn = shouldAdjust ? 0.9f : Main.dust[num624].fadeIn; - num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustID, 0f, 0f, 100, default, !Main.dayTime && psc ? 1f : 2f); + num624 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustID, 0f, 0f, 100, default, !Main.dayTime && psc ? 1f : 2f); Main.dust[num624].velocity *= 2f; Main.dust[num624].fadeIn = shouldAdjust ? 0.9f : Main.dust[num624].fadeIn; } @@ -1914,18 +1917,7 @@ namespace CalamityMod.Projectiles.Summon { Projectile.tileCollide = true; } - if ((double)Math.Abs(Projectile.velocity.X) > 0.2) - { - Projectile.rotation = Projectile.direction; - } - if (Projectile.velocity.X < 0f) - { - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X); - } - else - { - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X); - } + Projectile.rotation = Projectile.velocity.ToRotation(); return false; } @@ -1940,7 +1932,7 @@ namespace CalamityMod.Projectiles.Summon Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; } - + public override Color? GetAlpha(Color lightColor) { int pscState = (int)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night); @@ -1949,7 +1941,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Main.dayTime ? ModContent.Request(Texture).Value : ModContent.Request("CalamityMod/Projectiles/Boss/HolyBlastNight").Value; + Texture2D texture = Main.dayTime ? Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value : ModContent.Request("CalamityMod/Projectiles/Boss/HolyBlastNight").Value; int num214 = texture.Height / Main.projFrames[Projectile.type]; int y6 = num214 * Projectile.frame; int pscState = (int)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night); @@ -1992,25 +1984,25 @@ namespace CalamityMod.Projectiles.Summon int dustID = ProvUtils.GetDustID(pscState); for (int num193 = 0; num193 < 6; num193++) { - Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustID, 0f, 0f, 50, default, Main.dayTime ? 1.5f : 0.5f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustID, 0f, 0f, 50, default, Main.dayTime ? 1.5f : 0.5f); } for (int num194 = 0; num194 < 60; num194++) { - int num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustID, 0f, 0f, 0, default, Main.dayTime ? 2.5f : 0.5f); + int num195 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustID, 0f, 0f, 0, default, Main.dayTime ? 2.5f : 0.5f); Main.dust[num195].noGravity = true; Main.dust[num195].velocity *= 3f; - num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustID, 0f, 0f, 50, default, Main.dayTime ? 1.5f : 0.5f); + num195 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustID, 0f, 0f, 50, default, Main.dayTime ? 1.5f : 0.5f); Main.dust[num195].velocity *= 2f; Main.dust[num195].noGravity = true; } } } - + #endregion #region Bab Fireball Split - - + + public class MiniGuardianFireballSplit : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Summon"; @@ -2049,7 +2041,7 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { Lighting.AddLight(Projectile.Center, 0.3f, 0.225f, 0f); - + var Owner = Main.player[Projectile.owner]; Projectile.damage = (int)Owner.GetTotalDamage().ApplyTo(Projectile.originalDamage); Projectile.damage = Owner.ApplyArmorAccDamageBonusesTo(Projectile.damage); @@ -2067,7 +2059,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.velocity.X *= 1.05f; NPC target = Projectile.Center.MinionHoming(2000f, Main.player[Projectile.owner], true); - + if (target != null) { float scaleFactor2 = Projectile.velocity.Length(); @@ -2082,7 +2074,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.rotation = Projectile.velocity.X * 0.025f; } - + public override Color? GetAlpha(Color lightColor) { int pscState = (int)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night); @@ -2092,7 +2084,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { int pscState = (int)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night); - Texture2D texture = Main.dayTime ? ModContent.Request(Texture).Value : ModContent.Request("CalamityMod/Projectiles/Boss/HolyFire2Night").Value; + Texture2D texture = Main.dayTime ? Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value : ModContent.Request("CalamityMod/Projectiles/Boss/HolyFire2Night").Value; int num214 = texture.Height / Main.projFrames[Projectile.type]; int y6 = num214 * Projectile.frame; Projectile.DrawBackglow(ProvUtils.GetProjectileColor(pscState, Projectile.alpha, true), 4f, texture); @@ -2109,13 +2101,13 @@ namespace CalamityMod.Projectiles.Summon Projectile.width = Projectile.height = 200; Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); - + int pscState = (int)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night); int dust = ProvUtils.GetDustID(pscState); - + for (int num621 = 0; num621 < 4; num621++) { - int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dust, 0f, 0f, 100, default, Main.dayTime ? 2f : 0.5f); + int num622 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dust, 0f, 0f, 100, default, Main.dayTime ? 2f : 0.5f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool()) { @@ -2125,17 +2117,17 @@ namespace CalamityMod.Projectiles.Summon } for (int num623 = 0; num623 < 12; num623++) { - int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dust, 0f, 0f, 100, default, Main.dayTime ? 3f : 0.5f); + int num624 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dust, 0f, 0f, 100, default, Main.dayTime ? 3f : 0.5f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dust, 0f, 0f, 100, default, Main.dayTime ? 2f : 0.5f); + num624 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dust, 0f, 0f, 100, default, Main.dayTime ? 2f : 0.5f); Main.dust[num624].velocity *= 2f; } } } - + #endregion - + #endregion } diff --git a/Projectiles/Summon/PuffCloud.cs b/Projectiles/Summon/PuffCloud.cs index 84f45d098d..a273d0d622 100644 --- a/Projectiles/Summon/PuffCloud.cs +++ b/Projectiles/Summon/PuffCloud.cs @@ -24,8 +24,8 @@ namespace CalamityMod.Projectiles.Summon Projectile.DamageType = DamageClass.Summon; } - public override void AI() - { + public override void AI() + { Lighting.AddLight(Projectile.Center, Color.Cyan.ToVector3()); Projectile.velocity *= 0.97f; Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; @@ -37,6 +37,6 @@ namespace CalamityMod.Projectiles.Summon if (Projectile.frame >= Main.projFrames[Projectile.type]) Projectile.Kill(); } - } + } } } diff --git a/Projectiles/Summon/PuffWarrior.cs b/Projectiles/Summon/PuffWarrior.cs index 5ee862078e..3ca4803c5e 100644 --- a/Projectiles/Summon/PuffWarrior.cs +++ b/Projectiles/Summon/PuffWarrior.cs @@ -1,6 +1,6 @@ -using CalamityMod.Buffs.Summon; +using System; +using CalamityMod.Buffs.Summon; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -11,21 +11,21 @@ namespace CalamityMod.Projectiles.Summon public class PuffWarrior : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Summon"; - public Player Owner => Main.player[Projectile.owner]; + public Player Owner => Main.player[Projectile.owner]; - public Tile GroundTile => CalamityUtils.ParanoidTileRetrieval((int)Projectile.Bottom.X / 16, (int)Projectile.Bottom.Y / 16); + public Tile GroundTile => CalamityUtils.ParanoidTileRetrieval((int)Projectile.Bottom.X / 16, (int)Projectile.Bottom.Y / 16); - public bool Jumping => !GroundTile.IsTileSolidGround() || Math.Abs(Projectile.velocity.Y) > 5f; + public bool Jumping => !GroundTile.IsTileSolidGround() || Math.Abs(Projectile.velocity.Y) > 5f; - public ref float JumpCountdown => ref Projectile.localAI[1]; + public ref float JumpCountdown => ref Projectile.localAI[1]; - public ref float JumpCounter => ref Projectile.ai[1]; + public ref float JumpCounter => ref Projectile.ai[1]; - public ref float EnemyFailureCounter => ref Projectile.ai[0]; + public ref float EnemyFailureCounter => ref Projectile.ai[0]; - public ref float EnemyFailureCooldown => ref Projectile.localAI[0]; + public ref float EnemyFailureCooldown => ref Projectile.localAI[0]; - public const float Gravity = 0.425f; + public const float Gravity = 0.425f; public override void SetStaticDefaults() { @@ -46,177 +46,177 @@ namespace CalamityMod.Projectiles.Summon Projectile.minion = true; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 18; - Projectile.tileCollide = true; + Projectile.tileCollide = true; Projectile.DamageType = DamageClass.Summon; } public override void AI() { - ProvidePlayerMinionBuffs(); - DetermineFrames(); + ProvidePlayerMinionBuffs(); + DetermineFrames(); - NPC potentialTarget = Projectile.Center.MinionHoming(660f, Owner); - if (potentialTarget is null) - { - HopToOwner(out Vector2 guardSpot); - TeleportToFarOffDestination(guardSpot); - } - else - HopToTarget(potentialTarget); + NPC potentialTarget = Projectile.Center.MinionHoming(660f, Owner); + if (potentialTarget is null) + { + HopToOwner(out Vector2 guardSpot); + TeleportToFarOffDestination(guardSpot); + } + else + HopToTarget(potentialTarget); - if (EnemyFailureCooldown > 0f) - EnemyFailureCooldown--; + if (EnemyFailureCooldown > 0f) + EnemyFailureCooldown--; - if (JumpCounter > 120 && Jumping) - { - HopToOwner(out Vector2 guardSpot, true); - TeleportToFarOffDestination(guardSpot); - } + if (JumpCounter > 120 && Jumping) + { + HopToOwner(out Vector2 guardSpot, true); + TeleportToFarOffDestination(guardSpot); + } - if (Jumping) - JumpCounter++; - else - JumpCounter = 0; + if (Jumping) + JumpCounter++; + else + JumpCounter = 0; if (Math.Abs(Projectile.velocity.X) > 0.02f) Projectile.spriteDirection = -Projectile.direction; - Projectile.rotation = Jumping ? Projectile.rotation + MathHelper.Pi / 10f * Projectile.spriteDirection : 0f; + Projectile.rotation = Jumping ? Projectile.rotation + MathHelper.Pi / 10f * Projectile.spriteDirection : 0f; - while (Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height)) - Projectile.position.Y -= 10f; + while (Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height)) + Projectile.position.Y -= 10f; - // Enforce gravity. - if (Projectile.velocity.Y < 16f) - Projectile.velocity.Y += Gravity; - } + // Enforce gravity. + if (Projectile.velocity.Y < 16f) + Projectile.velocity.Y += Gravity; + } - internal void ProvidePlayerMinionBuffs() - { - Owner.AddBuff(ModContent.BuffType(), 3600); + internal void ProvidePlayerMinionBuffs() + { + Owner.AddBuff(ModContent.BuffType(), 3600); - // Verify player/minion state integrity. The minion cannot stay alive if the - // owner is dead or if the caller of the AI is invalid. - if (Projectile.type != ModContent.ProjectileType()) - return; + // Verify player/minion state integrity. The minion cannot stay alive if the + // owner is dead or if the caller of the AI is invalid. + if (Projectile.type != ModContent.ProjectileType()) + return; - if (Owner.dead) - Owner.Calamity().puffWarrior = false; - if (Owner.Calamity().puffWarrior) - Projectile.timeLeft = 2; - } + if (Owner.dead) + Owner.Calamity().puffWarrior = false; + if (Owner.Calamity().puffWarrior) + Projectile.timeLeft = 2; + } - internal void DetermineFrames() - { - int startingFrame = Jumping ? Main.projFrames[Projectile.type] - 3 : 0; - int endingFrame = Jumping ? Main.projFrames[Projectile.type] - 4 : Main.projFrames[Projectile.type] - 4; + internal void DetermineFrames() + { + int startingFrame = Jumping ? Main.projFrames[Projectile.type] - 3 : 0; + int endingFrame = Jumping ? Main.projFrames[Projectile.type] - 4 : Main.projFrames[Projectile.type] - 4; - if (Jumping) - JumpCountdown = 12f; - else if (Math.Abs(Projectile.velocity.Y) <= Gravity && JumpCountdown > 0) - { - startingFrame = Main.projFrames[Projectile.type] - 1; - endingFrame = Main.projFrames[Projectile.type] - 1; - JumpCountdown--; - } + if (Jumping) + JumpCountdown = 12f; + else if (Math.Abs(Projectile.velocity.Y) <= Gravity && JumpCountdown > 0) + { + startingFrame = Main.projFrames[Projectile.type] - 1; + endingFrame = Main.projFrames[Projectile.type] - 1; + JumpCountdown--; + } - if (Projectile.frame < startingFrame) - Projectile.frame = startingFrame; + if (Projectile.frame < startingFrame) + Projectile.frame = startingFrame; - Projectile.frameCounter++; - if (Projectile.frameCounter % 6 == 5) - Projectile.frame++; + Projectile.frameCounter++; + if (Projectile.frameCounter % 6 == 5) + Projectile.frame++; - if (Projectile.frame >= endingFrame) - Projectile.frame = startingFrame; - } + if (Projectile.frame >= endingFrame) + Projectile.frame = startingFrame; + } - internal void TeleportToFarOffDestination(Vector2 guardSpot) - { - bool obstructionBetweenSpot = Collision.CanHitLine(Projectile.position, Projectile.width, Projectile.height, guardSpot, 4, 4); - bool outOfRangeOfSpot = !Projectile.WithinRange(guardSpot, obstructionBetweenSpot ? 700f : 1900f); - if (Main.myPlayer == Projectile.owner && outOfRangeOfSpot) - { - Projectile.Center = guardSpot; - Projectile.netUpdate = true; - } - } - - internal void HopToOwner(out Vector2 guardSpot, bool ignoreJumping = false) - { - EnemyFailureCounter = 0f; - guardSpot = Owner.Center; - guardSpot.X += Owner.direction * 40f * (Projectile.identity % 14f + Projectile.identity / 14 * 0.2f); - - Vector2 searchPoint = guardSpot - Vector2.UnitY * 420f; - - // Ensure that the search point is not outside of the world (which would result in index problems in the search). - searchPoint.Y = MathHelper.Clamp(searchPoint.Y, 32f, Main.maxTilesY * 16f - 32f); - - // Adjust the destination to be at the lowest point. - WorldUtils.Find(searchPoint.ToTileCoordinates(), Searches.Chain(new Searches.Down(Main.maxTilesY + 2), new Conditions.IsSolid()), out Point guardPoint); - guardSpot = guardPoint.ToWorldCoordinates(8f, 16f); - - if ((!Jumping || ignoreJumping) && MathHelper.Distance(guardSpot.X, Projectile.Center.X) > 10f) - { - Projectile.velocity = CalamityUtils.GetProjectilePhysicsFiringVelocity(Projectile.Center, guardSpot, Gravity, 12f); - JumpCounter = 0; + internal void TeleportToFarOffDestination(Vector2 guardSpot) + { + bool obstructionBetweenSpot = Collision.CanHitLine(Projectile.position, Projectile.width, Projectile.height, guardSpot, 4, 4); + bool outOfRangeOfSpot = !Projectile.WithinRange(guardSpot, obstructionBetweenSpot ? 700f : 1900f); + if (Main.myPlayer == Projectile.owner && outOfRangeOfSpot) + { + Projectile.Center = guardSpot; Projectile.netUpdate = true; - } - } + } + } - internal void HopToTarget(NPC target) - { - Vector2 attackPosition = target.Center; - float attackPositionOffsetDirection = (target.velocity.X > 0).ToDirectionInt() * Math.Sign(Projectile.Center.X - target.Center.X); - attackPosition.X += attackPositionOffsetDirection * 22f * (Projectile.identity % 14f + Projectile.identity / 14 * 0.2f); + internal void HopToOwner(out Vector2 guardSpot, bool ignoreJumping = false) + { + EnemyFailureCounter = 0f; + guardSpot = Owner.Center; + guardSpot.X += Owner.direction * 40f * (Projectile.identity % 14f + Projectile.identity / 14 * 0.2f); - Vector2 searchPoint = attackPosition - Vector2.UnitY * 360f; + Vector2 searchPoint = guardSpot - Vector2.UnitY * 420f; - // Ensure that the search point is not outside of the world (which would result in index problems in the search). - searchPoint.Y = MathHelper.Clamp(searchPoint.Y, 32f, Main.maxTilesY * 16f - 32f); + // Ensure that the search point is not outside of the world (which would result in index problems in the search). + searchPoint.Y = MathHelper.Clamp(searchPoint.Y, 32f, Main.maxTilesY * 16f - 32f); - // Adjust the destination to be at the lowest point. - WorldUtils.Find(searchPoint.ToTileCoordinates(), Searches.Chain(new Searches.Down(Main.maxTilesY + 2), new Conditions.IsSolid()), out Point guardPoint); - attackPosition = guardPoint.ToWorldCoordinates(); + // Adjust the destination to be at the lowest point. + WorldUtils.Find(searchPoint.ToTileCoordinates(), Searches.Chain(new Searches.Down(Main.maxTilesY + 2), new Conditions.IsSolid()), out Point guardPoint); + guardSpot = guardPoint.ToWorldCoordinates(8f, 16f); - if (!Jumping) - { - Projectile.position += new Vector2(Projectile.spriteDirection * 4f, -4f); - Projectile.velocity = CalamityUtils.GetProjectilePhysicsFiringVelocity(Projectile.Center, attackPosition, Gravity, 17f + EnemyFailureCounter); - EnemyFailureCounter += 1f; - if (Main.myPlayer == Projectile.owner && Projectile.WithinRange(attackPosition, 360f)) - { - for (int i = 0; i < 3; i++) - { - Vector2 shootPosition = Projectile.Top + Vector2.UnitY * (8f + i * 3f); - Vector2 shootVelocity = (target.Center - shootPosition).SafeNormalize(Vector2.UnitY) * 14f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), shootPosition, shootVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); - } - } - JumpCounter = 0; - Projectile.netUpdate = true; - } - } + if ((!Jumping || ignoreJumping) && MathHelper.Distance(guardSpot.X, Projectile.Center.X) > 10f) + { + Projectile.velocity = CalamityUtils.GetProjectilePhysicsFiringVelocity(Projectile.Center, guardSpot, Gravity, 12f); + JumpCounter = 0; + Projectile.netUpdate = true; + } + } + + internal void HopToTarget(NPC target) + { + Vector2 attackPosition = target.Center; + float attackPositionOffsetDirection = (target.velocity.X > 0).ToDirectionInt() * Math.Sign(Projectile.Center.X - target.Center.X); + attackPosition.X += attackPositionOffsetDirection * 22f * (Projectile.identity % 14f + Projectile.identity / 14 * 0.2f); + + Vector2 searchPoint = attackPosition - Vector2.UnitY * 360f; + + // Ensure that the search point is not outside of the world (which would result in index problems in the search). + searchPoint.Y = MathHelper.Clamp(searchPoint.Y, 32f, Main.maxTilesY * 16f - 32f); + + // Adjust the destination to be at the lowest point. + WorldUtils.Find(searchPoint.ToTileCoordinates(), Searches.Chain(new Searches.Down(Main.maxTilesY + 2), new Conditions.IsSolid()), out Point guardPoint); + attackPosition = guardPoint.ToWorldCoordinates(); + + if (!Jumping) + { + Projectile.position += new Vector2(Projectile.spriteDirection * 4f, -4f); + Projectile.velocity = CalamityUtils.GetProjectilePhysicsFiringVelocity(Projectile.Center, attackPosition, Gravity, 17f + EnemyFailureCounter); + EnemyFailureCounter += 1f; + if (Main.myPlayer == Projectile.owner && Projectile.WithinRange(attackPosition, 360f)) + { + for (int i = 0; i < 3; i++) + { + Vector2 shootPosition = Projectile.Top + Vector2.UnitY * (8f + i * 3f); + Vector2 shootVelocity = (target.Center - shootPosition).SafeNormalize(Vector2.UnitY) * 14f; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), shootPosition, shootVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + } + } + JumpCounter = 0; + Projectile.netUpdate = true; + } + } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - if (EnemyFailureCooldown > 0) - return; + if (EnemyFailureCooldown > 0) + return; - EnemyFailureCounter -= 1f; - if (EnemyFailureCounter < 0f) - EnemyFailureCounter = 0f; - EnemyFailureCooldown = 60f; + EnemyFailureCounter -= 1f; + if (EnemyFailureCounter < 0f) + EnemyFailureCounter = 0f; + EnemyFailureCooldown = 60f; } - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (Projectile.oldVelocity.Length() > 6f) - Projectile.velocity = oldVelocity * 0.5f; - else - Projectile.velocity.X = 0f; - return false; - } - } + public override bool OnTileCollide(Vector2 oldVelocity) + { + if (Projectile.oldVelocity.Length() > 6f) + Projectile.velocity = oldVelocity * 0.5f; + else + Projectile.velocity.X = 0f; + return false; + } + } } diff --git a/Projectiles/Summon/PurpleButterfly.cs b/Projectiles/Summon/PurpleButterfly.cs index fccd2d79a0..6255caab7f 100644 --- a/Projectiles/Summon/PurpleButterfly.cs +++ b/Projectiles/Summon/PurpleButterfly.cs @@ -1,8 +1,8 @@ -using CalamityMod.Buffs.Summon; +using System; +using CalamityMod.Buffs.Summon; using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -34,6 +34,8 @@ namespace CalamityMod.Projectiles.Summon Projectile.timeLeft *= 5; Projectile.minion = true; Projectile.DamageType = DamageClass.Summon; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 8; } public override void AI() @@ -48,7 +50,7 @@ namespace CalamityMod.Projectiles.Summon Vector2 rotate = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.5f; rotate = rotate.RotatedBy((double)((float)(i - (dustAmt / 2 - 1)) * 6.28318548f / (float)dustAmt), default) + Projectile.Center; Vector2 faceDirection = rotate - Projectile.Center; - int dust = Dust.NewDust(rotate + faceDirection, 0, 0, 173, faceDirection.X, faceDirection.Y, 100, default, 1.8f); + int dust = Dust.NewDust(rotate + faceDirection, 0, 0, DustID.ShadowbeamStaff, faceDirection.X, faceDirection.Y, 100, default, 1.8f); Main.dust[dust].noGravity = true; } dust--; @@ -69,7 +71,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.frame = 0; } Lighting.AddLight(Projectile.Center, 0.3f, 0f, 0.5f); - Projectile.ChargingMinionAI(1200f, 1500f, 2400f, 150f, 0, 30f, 18f, 9f, new Vector2(0f, -60f), 30f, 12f, true, true); + Projectile.ChargingMinionAI(1200f, 1500f, 2400f, 150f, 0, 25f, 20f, 9f, new Vector2(0f, -60f), 30f, 15f, true, true); bool isMinion = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); if (isMinion) @@ -88,16 +90,11 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { SpriteEffects spriteEffects = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Texture2D texture2D13 = ModContent.Request(Texture).Value; - int framing = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; + Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + int framing = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; int y6 = framing * Projectile.frame; Main.EntitySpriteDraw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)framing / 2f), Projectile.scale, spriteEffects, 0); return false; } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.immune[Projectile.owner] = 8; - } } } diff --git a/Projectiles/Summon/RustyBeaconPulse.cs b/Projectiles/Summon/RustyBeaconPulse.cs index 02e65ed8f8..b562ab9a46 100644 --- a/Projectiles/Summon/RustyBeaconPulse.cs +++ b/Projectiles/Summon/RustyBeaconPulse.cs @@ -1,8 +1,8 @@ -using CalamityMod.Buffs.StatDebuffs; +using System; +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Weapons.Summon; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -51,7 +51,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Color drawColor = Projectile.GetAlpha(lightColor) * 0.33f; for (int i = 0; i < 8; i++) { @@ -71,7 +71,6 @@ namespace CalamityMod.Projectiles.Summon public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(ModContent.BuffType(), RustyBeaconPrototype.IrradiatedDebuffTime); - target.AddBuff(BuffID.Poisoned, RustyBeaconPrototype.PoisonedDebuffTime); } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) diff --git a/Projectiles/Summon/RustyDrone.cs b/Projectiles/Summon/RustyDrone.cs index 929945dfd8..be4f3b428f 100644 --- a/Projectiles/Summon/RustyDrone.cs +++ b/Projectiles/Summon/RustyDrone.cs @@ -41,7 +41,7 @@ namespace CalamityMod.Projectiles.Summon // Hover in place. Projectile.velocity = -Vector2.UnitY * (float)Math.Sin(MathHelper.TwoPi * Projectile.timeLeft / 96f) * 3f; - + // Look at nearby enemies. NPC potentialTarget = Projectile.Center.MinionHoming(1000f, Owner); if (potentialTarget is not null) diff --git a/Projectiles/Summon/SageNeedle.cs b/Projectiles/Summon/SageNeedle.cs index 0a892ab19a..d015b5019f 100644 --- a/Projectiles/Summon/SageNeedle.cs +++ b/Projectiles/Summon/SageNeedle.cs @@ -1,6 +1,6 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Projectiles/Summon/SageSpirit.cs b/Projectiles/Summon/SageSpirit.cs index 4a6a815670..467ab93077 100644 --- a/Projectiles/Summon/SageSpirit.cs +++ b/Projectiles/Summon/SageSpirit.cs @@ -1,7 +1,7 @@ -using CalamityMod.Buffs.Summon; -using Microsoft.Xna.Framework; -using System; +using System; using System.IO; +using CalamityMod.Buffs.Summon; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Projectiles/Summon/SakuraBullet.cs b/Projectiles/Summon/SakuraBullet.cs index f6b29e3023..485334b7dd 100644 --- a/Projectiles/Summon/SakuraBullet.cs +++ b/Projectiles/Summon/SakuraBullet.cs @@ -1,9 +1,9 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { @@ -20,7 +20,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.width = Projectile.height = 20; Projectile.friendly = true; Projectile.netImportant = true; - Projectile.timeLeft = 150; + Projectile.timeLeft = 210; Projectile.extraUpdates = 1; Projectile.tileCollide = false; Projectile.DamageType = DamageClass.Summon; @@ -88,7 +88,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.velocity = (Projectile.velocity * 20f + moveDirection * 11f) / (21f); } - int pinkDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 73, 0f, 0f, 100, default, 0.6f); + int pinkDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.PinkFairy, 0f, 0f, 100, default, 0.6f); Main.dust[pinkDust].noGravity = true; Main.dust[pinkDust].velocity *= 0.5f; Main.dust[pinkDust].velocity += Projectile.velocity * 0.1f; @@ -97,16 +97,16 @@ namespace CalamityMod.Projectiles.Summon public override void OnKill(int timeLeft) { SoundEngine.PlaySound(SoundID.Item25, Projectile.position); - int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 73, 0f, 0f, 100, default, 1f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.PinkFairy, 0f, 0f, 100, default, 1f); Main.dust[dust].velocity *= 0.5f; if (Main.rand.NextBool()) { Main.dust[dust].scale = 0.5f; Main.dust[dust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } - int dust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 73, 0f, 0f, 100, default, 1.4f); + int dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.PinkFairy, 0f, 0f, 100, default, 1.4f); Main.dust[dust2].noGravity = true; - dust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 73, 0f, 0f, 100, default, 0.8f); + dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.PinkFairy, 0f, 0f, 100, default, 0.8f); } } } diff --git a/Projectiles/Summon/SandBolt.cs b/Projectiles/Summon/SandBolt.cs index 5b7eb6d725..1a29b4cb0c 100644 --- a/Projectiles/Summon/SandBolt.cs +++ b/Projectiles/Summon/SandBolt.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 32, Projectile.velocity.X * 0.1f, Projectile.velocity.Y * 0.1f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Sand, Projectile.velocity.X * 0.1f, Projectile.velocity.Y * 0.1f); } public override void OnKill(int timeLeft) diff --git a/Projectiles/Summon/SandElementalHealer.cs b/Projectiles/Summon/SandElementalHealer.cs index 465bb66ab0..f1f2029331 100644 --- a/Projectiles/Summon/SandElementalHealer.cs +++ b/Projectiles/Summon/SandElementalHealer.cs @@ -1,11 +1,11 @@ -using CalamityMod.CalPlayer; +using System; +using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Healing; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { @@ -69,7 +69,7 @@ namespace CalamityMod.Projectiles.Summon int dustAmt = 50; for (int d = 0; d < dustAmt; d++) { - int sand = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y + 16f), Projectile.width, Projectile.height - 16, 32, 0f, 0f, 0, default, 1f); + int sand = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y + 16f), Projectile.width, Projectile.height - 16, DustID.Sand, 0f, 0f, 0, default, 1f); Main.dust[sand].velocity *= 2f; Main.dust[sand].scale *= 1.15f; } @@ -175,7 +175,7 @@ namespace CalamityMod.Projectiles.Summon Vector2 source = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; source = source.RotatedBy((double)((float)(d - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + Projectile.Center; Vector2 dustVel = source - Projectile.Center; - int green = Dust.NewDust(source + dustVel, 0, 0, 107, dustVel.X * 1.5f, dustVel.Y * 1.5f, 100, new Color(0, 200, 0), 1f); + int green = Dust.NewDust(source + dustVel, 0, 0, DustID.TerraBlade, dustVel.X * 1.5f, dustVel.Y * 1.5f, 100, new Color(0, 200, 0), 1f); Main.dust[green].noGravity = true; Main.dust[green].noLight = true; Main.dust[green].velocity = dustVel; diff --git a/Projectiles/Summon/SandElementalMinion.cs b/Projectiles/Summon/SandElementalMinion.cs index d8a45cdf7c..073149b87b 100644 --- a/Projectiles/Summon/SandElementalMinion.cs +++ b/Projectiles/Summon/SandElementalMinion.cs @@ -1,6 +1,6 @@ -using CalamityMod.CalPlayer; +using System; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -63,7 +63,7 @@ namespace CalamityMod.Projectiles.Summon { for (int i = 0; i < 50; i++) { - int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y + 16f), Projectile.width, Projectile.height - 16, 32, 0f, 0f, 0, default, 1f); + int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y + 16f), Projectile.width, Projectile.height - 16, DustID.Sand, 0f, 0f, 0, default, 1f); Main.dust[dust].velocity *= 2f; Main.dust[dust].scale *= 1.15f; } diff --git a/Projectiles/Summon/SandMark.cs b/Projectiles/Summon/SandMark.cs index e366f64e60..e48e12b4ff 100644 --- a/Projectiles/Summon/SandMark.cs +++ b/Projectiles/Summon/SandMark.cs @@ -1,9 +1,9 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { public class SandMark : ModProjectile, ILocalizedModType @@ -50,7 +50,7 @@ namespace CalamityMod.Projectiles.Summon dustMovement.X *= -1f; Vector2 dustMovement2 = new Vector2(2f, 10f); Vector2 position4 = Projectile.Center + new Vector2(60f, 200f) * dustMovement * 0.5f + dustMovement2; - Dust dust = Main.dust[Dust.NewDust(position4, 0, 0, 269, 0f, 0f, 0, default, 0.5f)]; + Dust dust = Main.dust[Dust.NewDust(position4, 0, 0, DustID.Sandnado, 0f, 0f, 0, default, 0.5f)]; dust.position = position4; dust.customData = Projectile.Center + dustMovement2; dust.fadeIn = 1f; @@ -101,7 +101,7 @@ namespace CalamityMod.Projectiles.Summon if (Main.rand.NextBool(10)) { Vector2 dustVel = Vector2.UnitY.RotatedBy((double)((float)j * 3.14159274f), default).RotatedBy((double)Projectile.rotation, default); - Dust dusty = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, 269, 0f, 0f, 225, newColor3, 1f)]; + Dust dusty = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, DustID.Sandnado, 0f, 0f, 225, newColor3, 1f)]; dusty.noGravity = true; dusty.noLight = true; dusty.scale = Projectile.Opacity * Projectile.localAI[0]; @@ -114,7 +114,7 @@ namespace CalamityMod.Projectiles.Summon if (Main.rand.NextBool(10)) { Vector2 dustVel2 = Vector2.UnitY.RotatedBy((double)((float)k * 3.14159274f), default); - Dust dustier = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, 269, 0f, 0f, 225, newColor3, 1.5f)]; + Dust dustier = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, DustID.Sandnado, 0f, 0f, 225, newColor3, 1.5f)]; dustier.noGravity = true; dustier.noLight = true; dustier.scale = Projectile.Opacity * Projectile.localAI[0]; @@ -140,10 +140,10 @@ namespace CalamityMod.Projectiles.Summon } public override bool PreDraw(ref Color lightColor) - { + { Color originalColor = Lighting.GetColor((int)((double)Projectile.position.X + (double)Projectile.width * 0.5) / 16, (int)(((double)Projectile.position.Y + (double)Projectile.height * 0.5) / 16.0)); Vector2 drawPos = Projectile.position + new Vector2((float)Projectile.width, (float)Projectile.height) / 2f + Vector2.UnitY * Projectile.gfxOffY - Main.screenPosition; - Texture2D texture2D27 = ModContent.Request(Texture).Value; + Texture2D texture2D27 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Rectangle rectangle = texture2D27.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); Color alphaColor = Projectile.GetAlpha(originalColor); Vector2 origin7 = rectangle.Size() / 2f; diff --git a/Projectiles/Summon/SandTornado.cs b/Projectiles/Summon/SandTornado.cs index 8aaa6d1339..0b5b84344e 100644 --- a/Projectiles/Summon/SandTornado.cs +++ b/Projectiles/Summon/SandTornado.cs @@ -1,9 +1,9 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { public class SandTornado : ModProjectile, ILocalizedModType @@ -113,7 +113,7 @@ namespace CalamityMod.Projectiles.Summon Vector2 sizeModdingPos = new Vector2(0f, sizeModdingVector2.Y - sizeModdingVector.Y); sizeModdingPos.X = sizeModdingPos.Y * vectorMult; new Vector2(sizeModdingVector.X - sizeModdingPos.X / 2f, sizeModdingVector.Y); - Texture2D texture2D23 = ModContent.Request(Texture).Value; + Texture2D texture2D23 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Rectangle drawRectangle = texture2D23.Frame(1, 1, 0, 0); Vector2 smallRect = drawRectangle.Size() / 2f; float aiTrackMult = -0.06283186f * aiTracker; diff --git a/Projectiles/Summon/SandnadoMinion.cs b/Projectiles/Summon/SandnadoMinion.cs index cee3116f5f..6beba7d3f1 100644 --- a/Projectiles/Summon/SandnadoMinion.cs +++ b/Projectiles/Summon/SandnadoMinion.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Projectiles.Summon public ref float TimerForShooting => ref Projectile.ai[0]; public bool CheckForSpawning = false; - + public override void SetStaticDefaults() { Main.projFrames[Projectile.type] = 6; @@ -157,10 +157,10 @@ namespace CalamityMod.Projectiles.Summon Projectile.damage, Projectile.knockBack, Projectile.owner); - + TimerForShooting = 0f; } - + if (TimerForShooting < SandSharknadoStaff.FireSpeed) TimerForShooting++; } diff --git a/Projectiles/Summon/SarosMicrosun.cs b/Projectiles/Summon/SarosMicrosun.cs index dc8491f7d7..eba68327a0 100644 --- a/Projectiles/Summon/SarosMicrosun.cs +++ b/Projectiles/Summon/SarosMicrosun.cs @@ -58,7 +58,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) // Makes the afterimages of the disk. { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Rectangle frame = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); Vector2 origin = frame.Size() * 0.5f; SpriteEffects direction = Projectile.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; diff --git a/Projectiles/Summon/SarosSunfire.cs b/Projectiles/Summon/SarosSunfire.cs index ea474657fb..4e2cc361ea 100644 --- a/Projectiles/Summon/SarosSunfire.cs +++ b/Projectiles/Summon/SarosSunfire.cs @@ -1,9 +1,9 @@ using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { @@ -11,7 +11,7 @@ namespace CalamityMod.Projectiles.Summon { public new string LocalizationCategory => "Projectiles.Summon"; public Player Owner => Main.player[Projectile.owner]; - + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; public override void SetStaticDefaults() diff --git a/Projectiles/Summon/SeekerSummonProj.cs b/Projectiles/Summon/SeekerSummonProj.cs index 56d49731cc..bb5f4a1e55 100644 --- a/Projectiles/Summon/SeekerSummonProj.cs +++ b/Projectiles/Summon/SeekerSummonProj.cs @@ -1,9 +1,9 @@ using CalamityMod.Buffs.Summon; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { @@ -100,7 +100,7 @@ namespace CalamityMod.Projectiles.Summon { // Make an imp laugh sound every so often if you're the first seeker in the projectile array. if (Main.rand.NextBool(1600)) - { + { for (int i = 0; i < Main.maxProjectiles; i++) { Projectile seeker = Main.projectile[i]; @@ -111,7 +111,7 @@ namespace CalamityMod.Projectiles.Summon break; } } - } + } Vector2 destination = Owner.Center + (MathHelper.TwoPi * CircleAngleRatio / Owner.ownedProjectileCounts[Type] - MathHelper.PiOver2).ToRotationVector2() * 310f; Projectile.Center = Vector2.Lerp(Projectile.Center, destination, 0.03f); diff --git a/Projectiles/Summon/SepulcherMinion.cs b/Projectiles/Summon/SepulcherMinion.cs index 131c073214..38197aa588 100644 --- a/Projectiles/Summon/SepulcherMinion.cs +++ b/Projectiles/Summon/SepulcherMinion.cs @@ -1,15 +1,15 @@ -using CalamityMod.Buffs.Summon; -using CalamityMod.NPCs.Other; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; +using System; using System.Collections.Generic; using System.IO; using System.Linq; +using CalamityMod.Buffs.Summon; +using CalamityMod.NPCs.Other; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { diff --git a/Projectiles/Summon/Shellfish.cs b/Projectiles/Summon/Shellfish.cs index 3d6fcc2fa3..0417c1e67a 100644 --- a/Projectiles/Summon/Shellfish.cs +++ b/Projectiles/Summon/Shellfish.cs @@ -1,8 +1,8 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.Summon; using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -54,7 +54,7 @@ namespace CalamityMod.Projectiles.Summon int dustAmt = 20; for (int d = 0; d < dustAmt; d++) { - int water = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y + 16f), Projectile.width, Projectile.height - 16, 33, 0f, 0f, 0, default, 1f); + int water = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y + 16f), Projectile.width, Projectile.height - 16, DustID.Water, 0f, 0f, 0, default, 1f); Main.dust[water].velocity *= 2f; Main.dust[water].scale *= 1.15f; } diff --git a/Projectiles/Summon/SilvaCrystal.cs b/Projectiles/Summon/SilvaCrystal.cs index 2df2ba0adb..134940397a 100644 --- a/Projectiles/Summon/SilvaCrystal.cs +++ b/Projectiles/Summon/SilvaCrystal.cs @@ -1,7 +1,7 @@ -using CalamityMod.CalPlayer; +using System; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -79,7 +79,7 @@ namespace CalamityMod.Projectiles.Summon } if (Projectile.alpha == 0 && Main.rand.NextBool(15)) { - Dust silvaDust = Main.dust[Dust.NewDust(Projectile.Top, 0, 0, 267, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f)]; + Dust silvaDust = Main.dust[Dust.NewDust(Projectile.Top, 0, 0, DustID.RainbowMk2, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f)]; silvaDust.velocity.X = 0f; silvaDust.noGravity = true; silvaDust.fadeIn = 1f; @@ -185,7 +185,7 @@ namespace CalamityMod.Projectiles.Summon { Color colorArea = Lighting.GetColor((int)((double)Projectile.position.X + (double)Projectile.width * 0.5) / 16, (int)(((double)Projectile.position.Y + (double)Projectile.height * 0.5) / 16.0)); Vector2 projPos = Projectile.position + new Vector2((float)Projectile.width, (float)Projectile.height) / 2f + Vector2.UnitY * Projectile.gfxOffY - Main.screenPosition; - Texture2D texture2D34 = ModContent.Request(Texture).Value; + Texture2D texture2D34 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Rectangle rectangular = texture2D34.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); Color colorAlpha = Projectile.GetAlpha(colorArea); Vector2 halfRectangle = rectangular.Size() / 2f; diff --git a/Projectiles/Summon/SilvaCrystalExplosion.cs b/Projectiles/Summon/SilvaCrystalExplosion.cs index 07d00b3d43..75143d5646 100644 --- a/Projectiles/Summon/SilvaCrystalExplosion.cs +++ b/Projectiles/Summon/SilvaCrystalExplosion.cs @@ -63,7 +63,7 @@ namespace CalamityMod.Projectiles.Summon if (Main.rand.NextBool(10)) { Vector2 silvaDustVel = Vector2.UnitY.RotatedBy((double)((float)i * 3.14159274f), default).RotatedBy((double)Projectile.rotation, default); - Dust silvaDust = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, 267, 0f, 0f, 225, newColor2, 1.5f)]; + Dust silvaDust = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, DustID.RainbowMk2, 0f, 0f, 225, newColor2, 1.5f)]; silvaDust.noGravity = true; silvaDust.noLight = true; silvaDust.scale = Projectile.Opacity * Projectile.localAI[0]; @@ -77,7 +77,7 @@ namespace CalamityMod.Projectiles.Summon if (Main.rand.NextBool(10)) { Vector2 silvaDustVel2 = Vector2.UnitY.RotatedBy((double)((float)j * 3.14159274f), default); - Dust silvaDust2 = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, 267, 0f, 0f, 225, newColor2, 1.5f)]; + Dust silvaDust2 = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, DustID.RainbowMk2, 0f, 0f, 225, newColor2, 1.5f)]; silvaDust2.noGravity = true; silvaDust2.noLight = true; silvaDust2.scale = Projectile.Opacity * Projectile.localAI[0]; @@ -110,7 +110,7 @@ namespace CalamityMod.Projectiles.Summon } if (shouldSpawnDust) { - Dust rainbowDust = Main.dust[Dust.NewDust(dustPos, 0, 0, 267, 0f, 0f, 127, newColor2, 1f)]; + Dust rainbowDust = Main.dust[Dust.NewDust(dustPos, 0, 0, DustID.RainbowMk2, 0f, 0f, 127, newColor2, 1f)]; rainbowDust.noGravity = true; rainbowDust.position = dustPos; rainbowDust.velocity = -Vector2.UnitY * dustVelMod * (Main.rand.NextFloat() * 0.9f + 1.6f); @@ -138,7 +138,7 @@ namespace CalamityMod.Projectiles.Summon { Color colorArea = Lighting.GetColor((int)((double)Projectile.position.X + (double)Projectile.width * 0.5) / 16, (int)(((double)Projectile.position.Y + (double)Projectile.height * 0.5) / 16.0)); Vector2 projPos = Projectile.position + new Vector2((float)Projectile.width, (float)Projectile.height) / 2f + Vector2.UnitY * Projectile.gfxOffY - Main.screenPosition; - Texture2D texture2D34 = ModContent.Request(Texture).Value; + Texture2D texture2D34 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Rectangle rectangular = texture2D34.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); Color colorAlpha = Projectile.GetAlpha(colorArea); Vector2 halfRectangle = rectangular.Size() / 2f; @@ -171,7 +171,7 @@ namespace CalamityMod.Projectiles.Summon float dustCount; for (float i = 0f; i < rando; i = dustCount + 1f) { - int dustID = Dust.NewDust(Projectile.Center, 0, 0, 267, 0f, 0f, 0, newColor, 1f); + int dustID = Dust.NewDust(Projectile.Center, 0, 0, DustID.RainbowMk2, 0f, 0f, 0, newColor, 1f); Main.dust[dustID].position = Projectile.Center; Main.dust[dustID].velocity = spinningpoint.RotatedBy((double)(6.28318548f * i / rando), default) * dustVel * (0.8f + Main.rand.NextFloat() * 0.4f); Main.dust[dustID].noGravity = true; @@ -187,7 +187,7 @@ namespace CalamityMod.Projectiles.Summon } for (float j = 0f; j < rando; j = dustCount + 1f) { - int dustID = Dust.NewDust(Projectile.Center, 0, 0, 267, 0f, 0f, 0, newColor, 1f); + int dustID = Dust.NewDust(Projectile.Center, 0, 0, DustID.RainbowMk2, 0f, 0f, 0, newColor, 1f); Main.dust[dustID].position = Projectile.Center; Main.dust[dustID].velocity = spinningpoint.RotatedBy((double)(6.28318548f * j / rando), default) * dustVel * (0.8f + Main.rand.NextFloat() * 0.4f); Dust dust = Main.dust[dustID]; diff --git a/Projectiles/Summon/SiriusBeam.cs b/Projectiles/Summon/SiriusBeam.cs index a8e1925172..52185dadfc 100644 --- a/Projectiles/Summon/SiriusBeam.cs +++ b/Projectiles/Summon/SiriusBeam.cs @@ -1,8 +1,8 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Buffs.DamageOverTime; namespace CalamityMod.Projectiles.Summon { @@ -38,7 +38,7 @@ namespace CalamityMod.Projectiles.Summon Vector2 projPos = Projectile.position; projPos -= Projectile.velocity * (d * 0.25f); Projectile.alpha = 255; - int trailDust = Dust.NewDust(projPos, 1, 1, 20, 0f, 0f, 0, default, 1f); + int trailDust = Dust.NewDust(projPos, 1, 1, DustID.PurificationPowder, 0f, 0f, 0, default, 1f); Main.dust[trailDust].position = projPos; Main.dust[trailDust].scale = Main.rand.Next(70, 110) * 0.013f; Main.dust[trailDust].velocity *= 0.2f; diff --git a/Projectiles/Summon/SiriusExplosion.cs b/Projectiles/Summon/SiriusExplosion.cs index 368594ac2a..d4ea45da2a 100644 --- a/Projectiles/Summon/SiriusExplosion.cs +++ b/Projectiles/Summon/SiriusExplosion.cs @@ -1,9 +1,9 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Buffs.DamageOverTime; namespace CalamityMod.Projectiles.Summon { public class SiriusExplosion : ModProjectile, ILocalizedModType @@ -63,7 +63,7 @@ namespace CalamityMod.Projectiles.Summon if (Main.rand.NextBool(10)) { Vector2 siriusDustVel = Vector2.UnitY.RotatedBy((double)((float)i * 3.14159274f), default).RotatedBy((double)Projectile.rotation, default); - Dust siriusDust = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, 267, 0f, 0f, 225, newColor2, 1.5f)]; + Dust siriusDust = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, DustID.RainbowMk2, 0f, 0f, 225, newColor2, 1.5f)]; siriusDust.noGravity = true; siriusDust.noLight = true; siriusDust.scale = Projectile.Opacity * Projectile.localAI[0]; @@ -77,7 +77,7 @@ namespace CalamityMod.Projectiles.Summon if (Main.rand.NextBool(10)) { Vector2 siriusDustVel2 = Vector2.UnitY.RotatedBy((double)((float)j * 3.14159274f), default); - Dust siriusDust2 = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, 267, 0f, 0f, 225, newColor2, 1.5f)]; + Dust siriusDust2 = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, DustID.RainbowMk2, 0f, 0f, 225, newColor2, 1.5f)]; siriusDust2.noGravity = true; siriusDust2.noLight = true; siriusDust2.scale = Projectile.Opacity * Projectile.localAI[0]; @@ -110,7 +110,7 @@ namespace CalamityMod.Projectiles.Summon } if (shouldSpawnDust) { - Dust starDust = Main.dust[Dust.NewDust(dustPos, 0, 0, 267, 0f, 0f, 127, newColor2, 1f)]; + Dust starDust = Main.dust[Dust.NewDust(dustPos, 0, 0, DustID.RainbowMk2, 0f, 0f, 127, newColor2, 1f)]; starDust.noGravity = true; starDust.position = dustPos; starDust.velocity = -Vector2.UnitY * dustVelMod * (Main.rand.NextFloat() * 0.9f + 1.6f); @@ -139,7 +139,7 @@ namespace CalamityMod.Projectiles.Summon { Color colorArea = Lighting.GetColor((int)((double)Projectile.position.X + (double)Projectile.width * 0.5) / 16, (int)(((double)Projectile.position.Y + (double)Projectile.height * 0.5) / 16.0)); Vector2 projPos = Projectile.position + new Vector2((float)Projectile.width, (float)Projectile.height) / 2f + Vector2.UnitY * Projectile.gfxOffY - Main.screenPosition; - Texture2D texture2D34 = ModContent.Request(Texture).Value; + Texture2D texture2D34 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Rectangle rectangular = texture2D34.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); Color colorAlpha = Projectile.GetAlpha(colorArea); Vector2 halfRectangle = rectangular.Size() / 2f; @@ -172,7 +172,7 @@ namespace CalamityMod.Projectiles.Summon float dustCount; for (float i = 0f; i < rando; i = dustCount + 1f) { - int dusty = Dust.NewDust(Projectile.Center, 0, 0, 267, 0f, 0f, 0, newColor, 1f); + int dusty = Dust.NewDust(Projectile.Center, 0, 0, DustID.RainbowMk2, 0f, 0f, 0, newColor, 1f); Main.dust[dusty].position = Projectile.Center; Main.dust[dusty].velocity = spinningpoint.RotatedBy((double)(6.28318548f * i / rando), default) * dustVel * (0.8f + Main.rand.NextFloat() * 0.4f); Main.dust[dusty].noGravity = true; @@ -188,7 +188,7 @@ namespace CalamityMod.Projectiles.Summon } for (float j = 0f; j < rando; j = dustCount + 1f) { - int dusty2 = Dust.NewDust(Projectile.Center, 0, 0, 267, 0f, 0f, 0, newColor, 1f); + int dusty2 = Dust.NewDust(Projectile.Center, 0, 0, DustID.RainbowMk2, 0f, 0f, 0, newColor, 1f); Main.dust[dusty2].position = Projectile.Center; Main.dust[dusty2].velocity = spinningpoint.RotatedBy((double)(6.28318548f * j / rando), default) * dustVel * (0.8f + Main.rand.NextFloat() * 0.4f); Dust dust = Main.dust[dusty2]; diff --git a/Projectiles/Summon/SiriusMinion.cs b/Projectiles/Summon/SiriusMinion.cs index ad23206ff3..1b40d31d96 100644 --- a/Projectiles/Summon/SiriusMinion.cs +++ b/Projectiles/Summon/SiriusMinion.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Projectiles.Summon public ref float TimerForShooting => ref Projectile.ai[0]; public bool CheckForSpawning = false; - + public override void SetStaticDefaults() { ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; @@ -95,7 +95,7 @@ namespace CalamityMod.Projectiles.Summon } public void ShootTarget(NPC target) - { + { if (target is not null) { if (TimerForShooting >= 60f && Projectile.owner == Main.myPlayer) diff --git a/Projectiles/Summon/SkeletalDragonChild.cs b/Projectiles/Summon/SkeletalDragonChild.cs index 68e1d25fbf..ec95b09ac2 100644 --- a/Projectiles/Summon/SkeletalDragonChild.cs +++ b/Projectiles/Summon/SkeletalDragonChild.cs @@ -1,5 +1,5 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Projectiles/Summon/SlimePuppet.cs b/Projectiles/Summon/SlimePuppet.cs index 7c1565b2d6..2b602008f7 100644 --- a/Projectiles/Summon/SlimePuppet.cs +++ b/Projectiles/Summon/SlimePuppet.cs @@ -1,10 +1,10 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using CalamityMod.Buffs.DamageOverTime; namespace CalamityMod.Projectiles.Summon { diff --git a/Projectiles/Summon/SmallAresArms/CannonLaserbeam.cs b/Projectiles/Summon/SmallAresArms/CannonLaserbeam.cs index 495e65d701..4307be1609 100644 --- a/Projectiles/Summon/SmallAresArms/CannonLaserbeam.cs +++ b/Projectiles/Summon/SmallAresArms/CannonLaserbeam.cs @@ -1,10 +1,10 @@ -using CalamityMod.Projectiles.BaseProjectiles; +using System; +using System.Collections.Generic; +using System.Linq; +using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; -using System; -using System.Collections.Generic; -using System.Linq; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -48,7 +48,7 @@ namespace CalamityMod.Projectiles.Summon.SmallAresArms Projectile.DamageType = DamageClass.Summon; Projectile.Calamity().UpdatePriority = 1f; } - + public override float DetermineLaserLength() { float[] samples = new float[4]; diff --git a/Projectiles/Summon/SmallAresArms/ExoskeletonCannon.cs b/Projectiles/Summon/SmallAresArms/ExoskeletonCannon.cs index 00b1d5bad6..8518677727 100644 --- a/Projectiles/Summon/SmallAresArms/ExoskeletonCannon.cs +++ b/Projectiles/Summon/SmallAresArms/ExoskeletonCannon.cs @@ -1,12 +1,12 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; -using CalamityMod.Items.Weapons.Summon; -using CalamityMod.InverseKinematics; -using Microsoft.Xna.Framework.Graphics; -using System; +using System; using System.IO; using CalamityMod.Buffs.Summon; +using CalamityMod.InverseKinematics; +using CalamityMod.Items.Weapons.Summon; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Summon.SmallAresArms { @@ -146,7 +146,7 @@ namespace CalamityMod.Projectiles.Summon.SmallAresArms public void DefaultDrawCannon(Texture2D glowmask) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Rectangle frame = texture.Frame(2, Main.projFrames[Type], TargetingSomething.ToInt(), Projectile.frame); Vector2 origin = frame.Size() * 0.5f; Vector2 drawPosition = Projectile.Center - Main.screenPosition; diff --git a/Projectiles/Summon/SmallAresArms/ExoskeletonGaussNukeCannon.cs b/Projectiles/Summon/SmallAresArms/ExoskeletonGaussNukeCannon.cs index 482afac35e..9364b9f124 100644 --- a/Projectiles/Summon/SmallAresArms/ExoskeletonGaussNukeCannon.cs +++ b/Projectiles/Summon/SmallAresArms/ExoskeletonGaussNukeCannon.cs @@ -1,11 +1,11 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; -using Terraria.Audio; -using Microsoft.Xna.Framework.Graphics; -using CalamityMod.Sounds; +using System; using CalamityMod.Items.Weapons.Summon; -using System; +using CalamityMod.Sounds; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Summon.SmallAresArms { @@ -65,7 +65,7 @@ namespace CalamityMod.Projectiles.Summon.SmallAresArms public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Texture2D glowmask = ModContent.Request("CalamityMod/Projectiles/Summon/SmallAresArms/ExoskeletonGaussNukeCannonGlowmask").Value; // The two stabilizers have two different shades of lighting, thus necessitating two different textures. diff --git a/Projectiles/Summon/SmallAresArms/ExoskeletonLaserCannon.cs b/Projectiles/Summon/SmallAresArms/ExoskeletonLaserCannon.cs index e68db756b4..99ee5880ee 100644 --- a/Projectiles/Summon/SmallAresArms/ExoskeletonLaserCannon.cs +++ b/Projectiles/Summon/SmallAresArms/ExoskeletonLaserCannon.cs @@ -1,11 +1,11 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; -using Terraria.Audio; -using Microsoft.Xna.Framework.Graphics; -using CalamityMod.Sounds; +using System.IO; using CalamityMod.Items.Weapons.Summon; -using System.IO; +using CalamityMod.Sounds; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Summon.SmallAresArms { @@ -15,7 +15,7 @@ namespace CalamityMod.Projectiles.Summon.SmallAresArms // This is how many small, regular lasers will happen before the laser will charge up and prepare a laserbeam. public const int NormalLasersBeforeBeam = 6; - + public override int ShootRate => ShootCounter % NormalLasersBeforeBeam == 0f ? 150 : AresExoskeleton.LaserCannonNormalShootRate; public override float ShootSpeed => 19f; diff --git a/Projectiles/Summon/SmallAresArms/ExoskeletonPanel.cs b/Projectiles/Summon/SmallAresArms/ExoskeletonPanel.cs index f570f49734..5fc5c0e894 100644 --- a/Projectiles/Summon/SmallAresArms/ExoskeletonPanel.cs +++ b/Projectiles/Summon/SmallAresArms/ExoskeletonPanel.cs @@ -1,14 +1,14 @@ -using Microsoft.Xna.Framework; +using System; +using System.Collections.Generic; +using System.Linq; +using CalamityMod.Items.Weapons.Summon; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; -using Terraria.ModLoader; -using Terraria.ID; -using CalamityMod.Items.Weapons.Summon; -using Terraria.GameContent; using Terraria.Audio; -using System.Linq; -using System; -using System.Collections.Generic; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Summon.SmallAresArms { @@ -121,7 +121,7 @@ namespace CalamityMod.Projectiles.Summon.SmallAresArms public ref float Time => ref Projectile.ai[1]; public static Rectangle MouseRectangle => new((int)Main.MouseScreen.X, (int)Main.MouseScreen.Y, 2, 2); - + public override void SetStaticDefaults() { ProjectileID.Sets.DrawScreenCheckFluff[Type] = 9999999; @@ -152,7 +152,7 @@ namespace CalamityMod.Projectiles.Summon.SmallAresArms laserCannonID, gaussNukeID, }; - + // Initialize things. if (PlayerOffset == Vector2.Zero) PlayerOffset = Main.MouseWorld - Main.LocalPlayer.Center; @@ -219,7 +219,7 @@ namespace CalamityMod.Projectiles.Summon.SmallAresArms { if (!arms.Contains(Main.projectile[i].type) || Main.projectile[i].owner != Projectile.owner || !Main.projectile[i].active || Main.projectile[i].ai[0] != ArmIndex) continue; - + Main.projectile[i].Kill(); } } @@ -235,7 +235,7 @@ namespace CalamityMod.Projectiles.Summon.SmallAresArms if (Main.myPlayer != Projectile.owner) return false; - Texture2D panelTexture = ModContent.Request(Texture).Value; + Texture2D panelTexture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Texture2D plasmaTexture = ModContent.Request("CalamityMod/Projectiles/Summon/SmallAresArms/ExoskeletonPanelPlasma").Value; Texture2D arrowTexture = ModContent.Request("CalamityMod/Projectiles/Summon/SmallAresArms/Arrow").Value; Vector2 area = plasmaTexture.Frame(1, 7, 0, 0).Size(); diff --git a/Projectiles/Summon/SmallAresArms/ExoskeletonPlasmaCannon.cs b/Projectiles/Summon/SmallAresArms/ExoskeletonPlasmaCannon.cs index 4e07ee7667..2620fa4b84 100644 --- a/Projectiles/Summon/SmallAresArms/ExoskeletonPlasmaCannon.cs +++ b/Projectiles/Summon/SmallAresArms/ExoskeletonPlasmaCannon.cs @@ -1,10 +1,10 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; -using Terraria.Audio; -using Microsoft.Xna.Framework.Graphics; -using CalamityMod.Items.Weapons.DraedonsArsenal; +using CalamityMod.Items.Weapons.DraedonsArsenal; using CalamityMod.Items.Weapons.Summon; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Summon.SmallAresArms { @@ -37,7 +37,7 @@ namespace CalamityMod.Projectiles.Summon.SmallAresArms // Create a burst of dust. for (int i = 0; i < 40; i++) { - float dustSpeed = Main.rand.NextFloat(1.8f, 3f); + float dustSpeed = Main.rand.NextFloat(1.8f, 3f); Vector2 dustVel = shootDirection * dustSpeed; dustVel = dustVel.RotatedBy(-0.35f); dustVel = dustVel.RotatedByRandom(2.0f * 0.35f); diff --git a/Projectiles/Summon/SmallAresArms/ExoskeletonTeslaCannon.cs b/Projectiles/Summon/SmallAresArms/ExoskeletonTeslaCannon.cs index 261ae494d7..1bf2c8cf02 100644 --- a/Projectiles/Summon/SmallAresArms/ExoskeletonTeslaCannon.cs +++ b/Projectiles/Summon/SmallAresArms/ExoskeletonTeslaCannon.cs @@ -1,11 +1,11 @@ -using CalamityMod.Sounds; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; -using Terraria.Audio; -using Microsoft.Xna.Framework.Graphics; +using System.IO; using CalamityMod.Items.Weapons.Summon; -using System.IO; +using CalamityMod.Sounds; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Summon.SmallAresArms { @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Summon.SmallAresArms { // Play the plasma bolt fire sound. SoundEngine.PlaySound(CommonCalamitySounds.PlasmaBoltSound with { Volume = 0.4f }, Projectile.Center); - + // Shoot the tesla orb. This only happens for the owner client. if (Main.myPlayer != Projectile.owner) return; diff --git a/Projectiles/Summon/SmallAresArms/MinionLaserBurst.cs b/Projectiles/Summon/SmallAresArms/MinionLaserBurst.cs index 27b486a7b9..6cec678d28 100644 --- a/Projectiles/Summon/SmallAresArms/MinionLaserBurst.cs +++ b/Projectiles/Summon/SmallAresArms/MinionLaserBurst.cs @@ -1,7 +1,7 @@ using Microsoft.Xna.Framework; using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Summon.SmallAresArms { @@ -47,7 +47,7 @@ namespace CalamityMod.Projectiles.Summon.SmallAresArms Projectile.frame = Projectile.frameCounter / 5 % Main.projFrames[Projectile.type]; Projectile.rotation = Projectile.velocity.ToRotation(); } - + public override bool PreDraw(ref Color lightColor) { lightColor.R = (byte)(255 * Projectile.Opacity); diff --git a/Projectiles/Summon/SmallAresArms/MinionPlasmaBlast.cs b/Projectiles/Summon/SmallAresArms/MinionPlasmaBlast.cs index 35e3fd7f20..c5f1955ef0 100644 --- a/Projectiles/Summon/SmallAresArms/MinionPlasmaBlast.cs +++ b/Projectiles/Summon/SmallAresArms/MinionPlasmaBlast.cs @@ -1,8 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; -using Terraria.ModLoader; using Terraria.Audio; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Summon.SmallAresArms { diff --git a/Projectiles/Summon/SmallAresArms/MinionPlasmaGas.cs b/Projectiles/Summon/SmallAresArms/MinionPlasmaGas.cs index 7c29973d8d..a2aa2e83ad 100644 --- a/Projectiles/Summon/SmallAresArms/MinionPlasmaGas.cs +++ b/Projectiles/Summon/SmallAresArms/MinionPlasmaGas.cs @@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Summon.SmallAresArms public void AdditiveDraw(SpriteBatch spriteBatch) { - Texture2D texture = TextureAssets.Projectile[Projectile.type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Vector2 origin = texture.Size() * 0.5f; Vector2 drawPosition = Projectile.Center - Main.screenPosition; float opacity = Utils.GetLerpValue(0f, 0.08f, LightPower, true) * Projectile.Opacity * 0.3f; diff --git a/Projectiles/Summon/SmallAresArms/MinionTeslaOrb.cs b/Projectiles/Summon/SmallAresArms/MinionTeslaOrb.cs index 566685e222..bbcee7b814 100644 --- a/Projectiles/Summon/SmallAresArms/MinionTeslaOrb.cs +++ b/Projectiles/Summon/SmallAresArms/MinionTeslaOrb.cs @@ -1,10 +1,10 @@ -using CalamityMod.Graphics.Primitives; +using System; +using System.Collections.Generic; +using System.IO; +using CalamityMod.Graphics.Primitives; using CalamityMod.Items.Weapons.Summon; using CalamityMod.Projectiles.Boss; using Microsoft.Xna.Framework; -using System; -using System.Collections.Generic; -using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Projectiles/Summon/SmallSkeletonMinion.cs b/Projectiles/Summon/SmallSkeletonMinion.cs index e473948858..a0ace7991c 100644 --- a/Projectiles/Summon/SmallSkeletonMinion.cs +++ b/Projectiles/Summon/SmallSkeletonMinion.cs @@ -1,9 +1,9 @@ -using CalamityMod.Buffs.Summon; +using System; +using System.IO; +using CalamityMod.Buffs.Summon; using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -175,7 +175,7 @@ namespace CalamityMod.Projectiles.Summon { Rectangle frame = new Rectangle(Variant * Projectile.width, Projectile.frame * Projectile.height, Projectile.width, Projectile.height); SpriteEffects spriteEffects = (Projectile.spriteDirection == 1) ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - Main.EntitySpriteDraw(ModContent.Request(Texture).Value, Projectile.Center - Main.screenPosition, frame, Color.White, Projectile.rotation, Projectile.Size / 2f, 1f, spriteEffects, 0); + Main.EntitySpriteDraw(Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value, Projectile.Center - Main.screenPosition, frame, Color.White, Projectile.rotation, Projectile.Size / 2f, 1f, spriteEffects, 0); return false; } diff --git a/Projectiles/Summon/SolarBeam.cs b/Projectiles/Summon/SolarBeam.cs index 96d9be1691..2cf5edbfa2 100644 --- a/Projectiles/Summon/SolarBeam.cs +++ b/Projectiles/Summon/SolarBeam.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Projectiles.Summon Vector2 dustPos = Projectile.position; dustPos -= Projectile.velocity * ((float)i * 0.25f); Projectile.alpha = 255; - int dust = Dust.NewDust(dustPos, 1, 1, 246, 0f, 0f, 0, default, 1f); + int dust = Dust.NewDust(dustPos, 1, 1, DustID.GoldCoin, 0f, 0f, 0, default, 1f); Main.dust[dust].position = dustPos; Main.dust[dust].scale = (float)Main.rand.Next(70, 110) * 0.013f; Main.dust[dust].velocity *= 0.2f; diff --git a/Projectiles/Summon/SolarGod.cs b/Projectiles/Summon/SolarGod.cs index e6564dbf6f..9ca80b96e9 100644 --- a/Projectiles/Summon/SolarGod.cs +++ b/Projectiles/Summon/SolarGod.cs @@ -69,7 +69,7 @@ namespace CalamityMod.Projectiles.Summon int dustAmt = 50; for (int d = 0; d < dustAmt; d++) { - int fire = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y + 16f), Projectile.width, Projectile.height - 16, 244, 0f, 0f, 0, default, 1f); + int fire = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y + 16f), Projectile.width, Projectile.height - 16, DustID.CopperCoin, 0f, 0f, 0, default, 1f); Main.dust[fire].velocity *= 2f; Main.dust[fire].scale *= 1.15f; } diff --git a/Projectiles/Summon/SolarPixie.cs b/Projectiles/Summon/SolarPixie.cs index 2f85317f15..cd909e789c 100644 --- a/Projectiles/Summon/SolarPixie.cs +++ b/Projectiles/Summon/SolarPixie.cs @@ -69,7 +69,7 @@ namespace CalamityMod.Projectiles.Summon int dustAmt = 25; for (int d = 0; d < dustAmt; d++) { - int fire = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y + 16f), Projectile.width, Projectile.height - 16, 244, 0f, 0f, 0, default, 1f); + int fire = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y + 16f), Projectile.width, Projectile.height - 16, DustID.CopperCoin, 0f, 0f, 0, default, 1f); Main.dust[fire].velocity *= 2f; Main.dust[fire].scale *= 1.15f; } diff --git a/Projectiles/Summon/Spikecrag.cs b/Projectiles/Summon/Spikecrag.cs index 1390798a71..4700e18d10 100644 --- a/Projectiles/Summon/Spikecrag.cs +++ b/Projectiles/Summon/Spikecrag.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetDefaults() { Projectile.width = 70; - Projectile.height = 42; + Projectile.height = 40; Projectile.ignoreWater = true; Projectile.tileCollide = true; Projectile.sentry = true; @@ -47,8 +47,6 @@ namespace CalamityMod.Projectiles.Summon Projectile.velocity.Y = 10f; } - Projectile.StickToTiles(false, false); - if (Projectile.ai[0] > 0f) { Projectile.ai[0] -= 1f; @@ -94,6 +92,12 @@ namespace CalamityMod.Projectiles.Summon public override bool OnTileCollide(Vector2 oldVelocity) => false; + public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough, ref Vector2 hitboxCenterFrac) + { + fallThrough = false; + return true; + } + public override bool? CanDamage() => false; } } diff --git a/Projectiles/Summon/SpikecragSpike.cs b/Projectiles/Summon/SpikecragSpike.cs index 44df50e890..6431b5561c 100644 --- a/Projectiles/Summon/SpikecragSpike.cs +++ b/Projectiles/Summon/SpikecragSpike.cs @@ -1,8 +1,8 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Buffs.DamageOverTime; namespace CalamityMod.Projectiles.Summon { diff --git a/Projectiles/Summon/SquirrelSquireAcorn.cs b/Projectiles/Summon/SquirrelSquireAcorn.cs index e6af68d147..b5456cd62e 100644 --- a/Projectiles/Summon/SquirrelSquireAcorn.cs +++ b/Projectiles/Summon/SquirrelSquireAcorn.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Projectiles.Summon public override void OnKill(int timeLeft) { for (int k = 0; k < 5; k++) - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 7, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.WoodFurniture, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } } diff --git a/Projectiles/Summon/SquirrelSquireMinion.cs b/Projectiles/Summon/SquirrelSquireMinion.cs index dddf7d4607..561b59c262 100644 --- a/Projectiles/Summon/SquirrelSquireMinion.cs +++ b/Projectiles/Summon/SquirrelSquireMinion.cs @@ -100,7 +100,6 @@ namespace CalamityMod.Projectiles.Summon Projectile.rotation = 0f; Projectile.tileCollide = true; - Projectile.StickToTiles(false, false); } public void DoInitializationEffects() @@ -108,7 +107,8 @@ namespace CalamityMod.Projectiles.Summon int dustQuantity = 36; for (int d = 0; d < dustQuantity; d++) { - Dust dust = Dust.NewDustPerfect(Projectile.Center, 7); + // The ground squirrel is very slightly off-center + Dust dust = Dust.NewDustPerfect(Projectile.Center + Vector2.UnitY * 16f, 7); dust.scale = 1.4f; dust.velocity = (MathHelper.TwoPi * d / dustQuantity).ToRotationVector2() * 4f; dust.noGravity = true; @@ -146,6 +146,12 @@ namespace CalamityMod.Projectiles.Summon public override bool OnTileCollide(Vector2 oldVelocity) => false; + public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough, ref Vector2 hitboxCenterFrac) + { + fallThrough = false; + return true; + } + public override void OnKill(int timeLeft) { if (Main.netMode != NetmodeID.Server) diff --git a/Projectiles/Summon/StellarTorusSummon.cs b/Projectiles/Summon/StellarTorusSummon.cs index 9e09b113d1..f3d67efc07 100644 --- a/Projectiles/Summon/StellarTorusSummon.cs +++ b/Projectiles/Summon/StellarTorusSummon.cs @@ -101,7 +101,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.velocity, Color.Cyan with { A = 10 }, Utils.Remap(TimerToShoot, StellarTorusStaff.TimeBeforeCharging, StellarTorusStaff.TimeBeforeCharging + StellarTorusStaff.TimeCharging, relativeScale * 2f, relativeScale / 2f), - (int)StellarTorusStaff .TimeCharging); + (int)StellarTorusStaff.TimeCharging); GeneralParticleHandler.SpawnParticle(bloomCharge); Vector2 chargeDustSpawn = Projectile.Center + Main.rand.NextVector2Circular(scale * 1.2f, scale * 1.2f); @@ -244,7 +244,7 @@ namespace CalamityMod.Projectiles.Summon if (Main.projectile.IndexInRange(laser)) Main.projectile[laser].originalDamage = Projectile.originalDamage; - + HasShotLaser = true; Projectile.netUpdate = true; } @@ -263,7 +263,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Vector2 drawPosition = Projectile.Center - Main.screenPosition; Rectangle frame = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); Vector2 origin = frame.Size() * 0.5f; diff --git a/Projectiles/Summon/StormjawBaby.cs b/Projectiles/Summon/StormjawBaby.cs index 2f8b3a1654..28a737829d 100644 --- a/Projectiles/Summon/StormjawBaby.cs +++ b/Projectiles/Summon/StormjawBaby.cs @@ -1,7 +1,7 @@ -using CalamityMod.Buffs.Summon; +using System; +using CalamityMod.Buffs.Summon; using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -67,7 +67,7 @@ namespace CalamityMod.Projectiles.Summon Vector2 source = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; source = source.RotatedBy((double)((float)(d - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + Projectile.Center; Vector2 dustVel = source - Projectile.Center; - int spark = Dust.NewDust(source + dustVel, 0, 0, 132, dustVel.X * 1.1f, dustVel.Y * 1.1f, 100, default, 1.4f); + int spark = Dust.NewDust(source + dustVel, 0, 0, DustID.Firework_Blue, dustVel.X * 1.1f, dustVel.Y * 1.1f, 100, default, 1.4f); Main.dust[spark].noGravity = true; Main.dust[spark].noLight = true; Main.dust[spark].velocity = dustVel; @@ -134,8 +134,8 @@ namespace CalamityMod.Projectiles.Summon { Projectile.tileCollide = false; Vector2 returnPos = player.Center - Projectile.Center; - returnPos.X -= (float) (40 * player.direction); - returnPos.X -= (float) (40 * Projectile.minionPos * player.direction); + returnPos.X -= (float)(40 * player.direction); + returnPos.X -= (float)(40 * Projectile.minionPos * player.direction); returnPos.Y -= 60f; float playerDist = returnPos.Length(); float returnSpeed = 12f; @@ -273,25 +273,15 @@ namespace CalamityMod.Projectiles.Summon if (Projectile.velocity.Y > 10f) Projectile.velocity.Y = 10f; - sparkCounter += Main.rand.Next(1,4); + sparkCounter += Main.rand.Next(1, 4); if (sparkCounter >= 20) { if (Main.myPlayer == Projectile.owner) { - for (int i = 0; i < Main.rand.Next(1,4); i++) + for (int i = 0; i < Main.rand.Next(1, 4); i++) { Vector2 sparkS = new Vector2(Main.rand.NextFloat(-5f, 5f), Main.rand.NextFloat(-5f, 5f)); - int spark = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, sparkS, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); - if (spark.WithinBounds(Main.maxProjectiles)) - { - Main.projectile[spark].DamageType = DamageClass.Summon; - Main.projectile[spark].originalDamage = Projectile.originalDamage; - Main.projectile[spark].timeLeft = 120; - Main.projectile[spark].penetrate = 3; - Main.projectile[spark].usesIDStaticNPCImmunity = true; - Main.projectile[spark].idStaticNPCHitCooldown = 10; - Main.projectile[spark].usesLocalNPCImmunity = false; - } + int spark = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, sparkS, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); } sparkCounter = 0; } @@ -317,12 +307,12 @@ namespace CalamityMod.Projectiles.Summon Rectangle rect = npc.getRect(); if (rectangle.Intersects(rect) && (npc.noTileCollide || player.CanHit(npc))) { - sparkCounter += Main.rand.Next(1,3); + sparkCounter += Main.rand.Next(1, 3); if (sparkCounter >= 20) { if (Main.myPlayer == Projectile.owner) { - for (int j = 0; j < Main.rand.Next(1,4); j++) + for (int j = 0; j < Main.rand.Next(1, 4); j++) { Vector2 sparkS = new Vector2(Main.rand.NextFloat(-5f, 5f), Main.rand.NextFloat(-5f, 5f)); int spark = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, sparkS, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); @@ -462,7 +452,7 @@ namespace CalamityMod.Projectiles.Summon { int xPos = (int)Projectile.Center.X / 16; int yPos = (int)Projectile.position.Y / 16; - int x = xPos + direction + (int) Projectile.velocity.X; + int x = xPos + direction + (int)Projectile.velocity.X; for (int y = yPos; y < yPos + Projectile.height / 16 + 1; ++y) { if (WorldGen.InWorld(x, y) && WorldGen.SolidTile(x, y)) @@ -558,7 +548,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.velocity.Y += 0.4f; if (Projectile.velocity.Y > 10f) Projectile.velocity.Y = 10f; - } + } } public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough, ref Vector2 hitboxCenterFrac) diff --git a/Projectiles/Summon/StormjawSpark.cs b/Projectiles/Summon/StormjawSpark.cs new file mode 100644 index 0000000000..0758cf42e9 --- /dev/null +++ b/Projectiles/Summon/StormjawSpark.cs @@ -0,0 +1,90 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Summon +{ + public class StormjawSpark : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Summon"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + //literally had to make another projectile cuz whips exist + public override void SetStaticDefaults() => ProjectileID.Sets.MinionShot[Projectile.type] = true; + + public override void SetDefaults() + { + Projectile.width = 6; + Projectile.height = 12; + Projectile.friendly = true; + Projectile.penetrate = 3; + Projectile.timeLeft = 60; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; + Projectile.DamageType = DamageClass.Summon; + } + + public override void AI() + { + if (Projectile.velocity.X != Projectile.velocity.X) + { + Projectile.velocity.X = Projectile.velocity.X * -0.1f; + } + if (Projectile.velocity.X != Projectile.velocity.X) + { + Projectile.velocity.X = Projectile.velocity.X * -0.5f; + } + if (Projectile.velocity.Y != Projectile.velocity.Y && Projectile.velocity.Y > 1f) + { + Projectile.velocity.Y = Projectile.velocity.Y * -0.5f; + } + Projectile.ai[0] += 1f; + if (Projectile.ai[0] > 5f) + { + Projectile.ai[0] = 5f; + if (Projectile.velocity.Y == 0f && Projectile.velocity.X != 0f) + { + Projectile.velocity.X = Projectile.velocity.X * 0.97f; + if ((double)Projectile.velocity.X > -0.01 && (double)Projectile.velocity.X < 0.01) + { + Projectile.velocity.X = 0f; + Projectile.netUpdate = true; + } + } + Projectile.velocity.Y = Projectile.velocity.Y + 0.2f; + } + Projectile.rotation += Projectile.velocity.X * 0.1f; + int sparky = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.UnusedWhiteBluePurple, 0f, 0f, 100, default, 1f); + Dust expr_8976_cp_0 = Main.dust[sparky]; + expr_8976_cp_0.position.X -= 2f; + Dust expr_8994_cp_0 = Main.dust[sparky]; + expr_8994_cp_0.position.Y += 2f; + Main.dust[sparky].scale += (float)Main.rand.Next(50) * 0.01f; + Main.dust[sparky].noGravity = true; + Dust expr_89E7_cp_0 = Main.dust[sparky]; + expr_89E7_cp_0.velocity.Y -= 2f; + if (Main.rand.NextBool()) + { + int sparkier = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.UnusedWhiteBluePurple, 0f, 0f, 100, default, 1f); + Dust expr_8A4E_cp_0 = Main.dust[sparkier]; + expr_8A4E_cp_0.position.X -= 2f; + Dust expr_8A6C_cp_0 = Main.dust[sparkier]; + expr_8A6C_cp_0.position.Y += 2f; + Main.dust[sparkier].scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; + Main.dust[sparkier].noGravity = true; + Main.dust[sparkier].velocity *= 0.1f; + } + if ((double)Projectile.velocity.Y < 0.25 && (double)Projectile.velocity.Y > 0.15) + { + Projectile.velocity.X = Projectile.velocity.X * 0.8f; + } + Projectile.rotation = -Projectile.velocity.X * 0.05f; + if (Projectile.velocity.Y > 16f) + { + Projectile.velocity.Y = 16f; + } + } + + public override bool OnTileCollide(Vector2 oldVelocity) => false; + } +} diff --git a/Projectiles/Summon/SummonAstralExplosion.cs b/Projectiles/Summon/SummonAstralExplosion.cs index d4a652b390..eb4e8d567e 100644 --- a/Projectiles/Summon/SummonAstralExplosion.cs +++ b/Projectiles/Summon/SummonAstralExplosion.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Summon diff --git a/Projectiles/Summon/SummonBrimstoneExplosionSmall.cs b/Projectiles/Summon/SummonBrimstoneExplosionSmall.cs index ff22e4352e..f827f85f65 100644 --- a/Projectiles/Summon/SummonBrimstoneExplosionSmall.cs +++ b/Projectiles/Summon/SummonBrimstoneExplosionSmall.cs @@ -1,4 +1,4 @@ -using CalamityMod.Dusts; +using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; diff --git a/Projectiles/Summon/TacticalPlagueJet.cs b/Projectiles/Summon/TacticalPlagueJet.cs index 524d00e059..1a98dfb84c 100644 --- a/Projectiles/Summon/TacticalPlagueJet.cs +++ b/Projectiles/Summon/TacticalPlagueJet.cs @@ -1,10 +1,10 @@ -using CalamityMod.Buffs.Summon; +using System; +using CalamityMod.Buffs.Summon; using CalamityMod.CalPlayer; using CalamityMod.Dusts; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Summon; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Projectiles/Summon/TundraFlameBlossom.cs b/Projectiles/Summon/TundraFlameBlossom.cs index 8c31e07e69..2b34cb6953 100644 --- a/Projectiles/Summon/TundraFlameBlossom.cs +++ b/Projectiles/Summon/TundraFlameBlossom.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Projectiles.Summon public ref float FlowerShootTimer => ref Projectile.ai[0]; public ref float RotationMovement => ref Projectile.ai[1]; - + public override void SetStaticDefaults() { ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; diff --git a/Projectiles/Summon/TundraFlameBlossomsOrb.cs b/Projectiles/Summon/TundraFlameBlossomsOrb.cs index 522b81b457..5c2a2bf967 100644 --- a/Projectiles/Summon/TundraFlameBlossomsOrb.cs +++ b/Projectiles/Summon/TundraFlameBlossomsOrb.cs @@ -1,9 +1,9 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using System; namespace CalamityMod.Projectiles.Summon { @@ -15,7 +15,7 @@ namespace CalamityMod.Projectiles.Summon public ref float TimerForCharging => ref Projectile.ai[0]; public ref float TypeOfFlowerOrb => ref Projectile.ai[1]; - + public override void SetStaticDefaults() { ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; @@ -82,9 +82,9 @@ namespace CalamityMod.Projectiles.Summon TimerForCharging += 0.001f; TimerForCharging = (TimerForCharging > 1f) ? 1f : TimerForCharging; } - Projectile.netUpdate= true; + Projectile.netUpdate = true; } - + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { DustFlowerOnHit(); // Makes a dust effect that looks like a flower. @@ -94,8 +94,8 @@ namespace CalamityMod.Projectiles.Summon } public void DustFlowerOnHit() - // Copied code from Frost Beam, from the Frost Blossom Staff. - // Modified to have a different color correspondent on the type of flower. + // Copied code from Frost Beam, from the Frost Blossom Staff. + // Modified to have a different color correspondent on the type of flower. { int flowerPetalCount = Main.rand.Next(3, 5 + 1); float thetaDelta = Projectile.velocity.ToRotation(); diff --git a/Projectiles/Summon/Umbrella/MagicArrow.cs b/Projectiles/Summon/Umbrella/MagicArrow.cs index 2d7c7cd4be..e0dbdf0aea 100644 --- a/Projectiles/Summon/Umbrella/MagicArrow.cs +++ b/Projectiles/Summon/Umbrella/MagicArrow.cs @@ -1,7 +1,7 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; +using System; using System.IO; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Graphics; using Terraria.Graphics.Shaders; @@ -14,7 +14,7 @@ namespace CalamityMod.Projectiles.Summon.Umbrella { public new string LocalizationCategory => "Projectiles.Summon"; public float Behavior = 0f; - private const float drawOffset = -MathHelper.PiOver4 + MathHelper.Pi; + private const float drawOffset = -MathHelper.PiOver4 + MathHelper.Pi; public VertexStrip TrailDrawer; public float GetOffsetAngle @@ -51,14 +51,14 @@ namespace CalamityMod.Projectiles.Summon.Umbrella public override void AI() { - Player player = Main.player[Projectile.owner]; + Player player = Main.player[Projectile.owner]; Projectile.alpha -= 50; - // Set the timeLeft if the player has the hat - if (player.Calamity().magicHat) - { - Projectile.timeLeft = 2; - } + // Set the timeLeft if the player has the hat + if (player.Calamity().magicHat) + { + Projectile.timeLeft = 2; + } float homingRange = MagicHat.Range; int targetIndex = -1; @@ -97,57 +97,57 @@ namespace CalamityMod.Projectiles.Summon.Umbrella } } - if (targetIndex == -1) - { - IdleAI(); - } - else - { - AttackEnemy(targetIndex); - } + if (targetIndex == -1) + { + IdleAI(); + } + else + { + AttackEnemy(targetIndex); + } } - private void AttackEnemy(int targetIndex) - { - NPC npc = Main.npc[targetIndex]; - Behavior = 0f; + private void AttackEnemy(int targetIndex) + { + NPC npc = Main.npc[targetIndex]; + Behavior = 0f; // Go to the target - Projectile.velocity = (Projectile.velocity * 5f + Projectile.SafeDirectionTo(npc.Center) * 40f) / 6f; - Projectile.rotation = Projectile.AngleTo(npc.Center) + drawOffset; - } + Projectile.velocity = (Projectile.velocity * 5f + Projectile.SafeDirectionTo(npc.Center) * 40f) / 6f; + Projectile.rotation = Projectile.AngleTo(npc.Center) + drawOffset; + } - private void IdleAI() - { - Player player = Main.player[Projectile.owner]; + private void IdleAI() + { + Player player = Main.player[Projectile.owner]; - Vector2 returnPos = player.Center + GetOffsetAngle.ToRotationVector2() * 180f; + Vector2 returnPos = player.Center + GetOffsetAngle.ToRotationVector2() * 180f; - // Player distance calculations - Vector2 playerVec = returnPos - Projectile.Center; - float playerDist = playerVec.Length(); + // Player distance calculations + Vector2 playerVec = returnPos - Projectile.Center; + float playerDist = playerVec.Length(); - float playerHomeSpeed = 40f; - // Teleport to the player if abnormally far - if (playerDist > 2000f) - { - Projectile.Center = returnPos; - Projectile.netUpdate = true; - } - // If more than 60 pixels away, move toward the player - if (playerDist > 60f) - { - playerVec.Normalize(); - playerVec *= playerHomeSpeed; - Projectile.velocity = (Projectile.velocity * 10f + playerVec) / 11f; - Projectile.rotation = Projectile.velocity.ToRotation() + drawOffset; - } - else - { - Projectile.Center = returnPos; - Projectile.rotation = GetOffsetAngle + drawOffset; - Behavior = 1f; - } - } + float playerHomeSpeed = 40f; + // Teleport to the player if abnormally far + if (playerDist > 2000f) + { + Projectile.Center = returnPos; + Projectile.netUpdate = true; + } + // If more than 60 pixels away, move toward the player + if (playerDist > 60f) + { + playerVec.Normalize(); + playerVec *= playerHomeSpeed; + Projectile.velocity = (Projectile.velocity * 10f + playerVec) / 11f; + Projectile.rotation = Projectile.velocity.ToRotation() + drawOffset; + } + else + { + Projectile.Center = returnPos; + Projectile.rotation = GetOffsetAngle + drawOffset; + Behavior = 1f; + } + } public override Color? GetAlpha(Color lightColor) => Color.White; @@ -161,26 +161,26 @@ namespace CalamityMod.Projectiles.Summon.Umbrella public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; - Rectangle frame = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); - Vector2 origin = frame.Size() * 0.5f; - Vector2 drawPosition = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); - SpriteEffects direction = Projectile.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Rectangle frame = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); + Vector2 origin = frame.Size() * 0.5f; + Vector2 drawPosition = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); + SpriteEffects direction = Projectile.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - bool shouldDrawTrail = Behavior != 1f; - if (shouldDrawTrail) - { - // Draw the afterimage trail. - TrailDrawer ??= new(); - GameShaders.Misc["EmpressBlade"].UseShaderSpecificData(new Vector4(1f, 0f, 0f, 0.6f)); - GameShaders.Misc["EmpressBlade"].Apply(null); - TrailDrawer.PrepareStrip(Projectile.oldPos, Projectile.oldRot, TrailColorFunction, TrailWidthFunction, Projectile.Size * 0.5f - Main.screenPosition, Projectile.oldPos.Length, true); - TrailDrawer.DrawTrail(); - Main.pixelShader.CurrentTechnique.Passes[0].Apply(); - } + bool shouldDrawTrail = Behavior != 1f; + if (shouldDrawTrail) + { + // Draw the afterimage trail. + TrailDrawer ??= new(); + GameShaders.Misc["EmpressBlade"].UseShaderSpecificData(new Vector4(1f, 0f, 0f, 0.6f)); + GameShaders.Misc["EmpressBlade"].Apply(null); + TrailDrawer.PrepareStrip(Projectile.oldPos, Projectile.oldRot, TrailColorFunction, TrailWidthFunction, Projectile.Size * 0.5f - Main.screenPosition, Projectile.oldPos.Length, true); + TrailDrawer.DrawTrail(); + Main.pixelShader.CurrentTechnique.Passes[0].Apply(); + } // Draw the bat. - Main.spriteBatch.Draw(texture, drawPosition, frame, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, direction, 0); + Main.spriteBatch.Draw(texture, drawPosition, frame, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, direction, 0); return false; } @@ -189,7 +189,7 @@ namespace CalamityMod.Projectiles.Summon.Umbrella for (int i = 0; i < 10; i++) { Vector2 dspeed = new Vector2(Main.rand.NextFloat(-7f, 7f), Main.rand.NextFloat(-7f, 7f)); - int dust = Dust.NewDust(Projectile.Center, 1, 1, 67, dspeed.X, dspeed.Y, 50, default, 1.2f); + int dust = Dust.NewDust(Projectile.Center, 1, 1, DustID.IceRod, dspeed.X, dspeed.Y, 50, default, 1.2f); Main.dust[dust].noGravity = true; } } @@ -199,24 +199,24 @@ namespace CalamityMod.Projectiles.Summon.Umbrella public override void OnHitPlayer(Player target, Player.HurtInfo info) => OnHitEffect(); private void OnHitEffect() - { - if (Behavior == 1f) - return; + { + if (Behavior == 1f) + return; for (int i = 0; i < 10; i++) { Vector2 dspeed = new Vector2(Main.rand.NextFloat(-7f, 7f), Main.rand.NextFloat(-7f, 7f)); - int dust = Dust.NewDust(Projectile.Center, 1, 1, 67, dspeed.X, dspeed.Y, 50, default, 1.2f); + int dust = Dust.NewDust(Projectile.Center, 1, 1, DustID.IceRod, dspeed.X, dspeed.Y, 50, default, 1.2f); Main.dust[dust].noGravity = true; } - Vector2 returnPos = Main.player[Projectile.owner].Center + GetOffsetAngle.ToRotationVector2() * 180f; - Projectile.Center = returnPos; + Vector2 returnPos = Main.player[Projectile.owner].Center + GetOffsetAngle.ToRotationVector2() * 180f; + Projectile.Center = returnPos; for (int i = 0; i < 10; i++) { Vector2 dspeed = new Vector2(Main.rand.NextFloat(-7f, 7f), Main.rand.NextFloat(-7f, 7f)); - int dust = Dust.NewDust(Projectile.Center, 1, 1, 67, dspeed.X, dspeed.Y, 50, default, 1.2f); + int dust = Dust.NewDust(Projectile.Center, 1, 1, DustID.IceRod, dspeed.X, dspeed.Y, 50, default, 1.2f); Main.dust[dust].noGravity = true; } - } + } } } diff --git a/Projectiles/Summon/Umbrella/MagicAxe.cs b/Projectiles/Summon/Umbrella/MagicAxe.cs index 7a9c77aa94..c283fd7383 100644 --- a/Projectiles/Summon/Umbrella/MagicAxe.cs +++ b/Projectiles/Summon/Umbrella/MagicAxe.cs @@ -1,8 +1,8 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using System.IO; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; using Terraria; using Terraria.Graphics; using Terraria.Graphics.Shaders; @@ -15,10 +15,10 @@ namespace CalamityMod.Projectiles.Summon.Umbrella { public new string LocalizationCategory => "Projectiles.Summon"; public float Behavior = 0f; - public ref float ChargeCooldown => ref Projectile.ai[1]; - public ref float TreeCounter => ref Projectile.localAI[0]; - public ref float TreeReset => ref Projectile.localAI[1]; - private const float drawOffset = -MathHelper.PiOver4 + MathHelper.Pi; + public ref float ChargeCooldown => ref Projectile.ai[1]; + public ref float TreeCounter => ref Projectile.localAI[0]; + public ref float TreeReset => ref Projectile.localAI[1]; + private const float drawOffset = -MathHelper.PiOver4 + MathHelper.Pi; public VertexStrip TrailDrawer; public float GetOffsetAngle @@ -61,14 +61,14 @@ namespace CalamityMod.Projectiles.Summon.Umbrella public override void AI() { - Player player = Main.player[Projectile.owner]; + Player player = Main.player[Projectile.owner]; Projectile.alpha -= 50; - // Set the timeLeft if the player has the hat - if (player.Calamity().magicHat) - { - Projectile.timeLeft = 2; - } + // Set the timeLeft if the player has the hat + if (player.Calamity().magicHat) + { + Projectile.timeLeft = 2; + } float homingRange = MagicHat.Range; int targetIndex = -1; @@ -107,26 +107,26 @@ namespace CalamityMod.Projectiles.Summon.Umbrella } } - if (targetIndex == -1) - { - CooldownReset(false); - IdleAI(); - } - else - { - Projectile.rotation += 0.15f; - if (!CooldownReset(true)) - return; - AttackEnemy(targetIndex); - } + if (targetIndex == -1) + { + CooldownReset(false); + IdleAI(); + } + else + { + Projectile.rotation += 0.15f; + if (!CooldownReset(true)) + return; + AttackEnemy(targetIndex); + } } - private bool CooldownReset(bool offense) - { + private bool CooldownReset(bool offense) + { // Breather time between charges as like a reset if (Behavior == 2f) { - TreeReset = 0f; + TreeReset = 0f; ChargeCooldown += 1f; if (ChargeCooldown > 15f) { @@ -139,14 +139,14 @@ namespace CalamityMod.Projectiles.Summon.Umbrella return false; } } - if (offense && Behavior == 4f) - Behavior = 0f; - return true; - } + if (offense && Behavior == 4f) + Behavior = 0f; + return true; + } - private void AttackEnemy(int targetIndex) - { - NPC npc = Main.npc[targetIndex]; + private void AttackEnemy(int targetIndex) + { + NPC npc = Main.npc[targetIndex]; // Go to the target if (Behavior == 0f) { @@ -183,8 +183,8 @@ namespace CalamityMod.Projectiles.Summon.Umbrella // Charge at an enemy if not on cooldown if (Behavior == 0f) { - Vector2 targetVec = npc.Center - Projectile.Center; - float targetDist = targetVec.Length(); + Vector2 targetVec = npc.Center - Projectile.Center; + float targetDist = targetVec.Length(); if (ChargeCooldown == 0f && targetDist < 500f) { ChargeCooldown += 1f; @@ -197,42 +197,42 @@ namespace CalamityMod.Projectiles.Summon.Umbrella } } } - } + } - private void IdleAI() - { - Player player = Main.player[Projectile.owner]; + private void IdleAI() + { + Player player = Main.player[Projectile.owner]; - Vector2 returnPos = player.Center + GetOffsetAngle.ToRotationVector2() * 180f; + Vector2 returnPos = player.Center + GetOffsetAngle.ToRotationVector2() * 180f; - // Player distance calculations - Vector2 playerVec = returnPos - Projectile.Center; - float playerDist = playerVec.Length(); + // Player distance calculations + Vector2 playerVec = returnPos - Projectile.Center; + float playerDist = playerVec.Length(); - float playerHomeSpeed = 40f; - // Teleport to the player if abnormally far - if (playerDist > 2000f) - { - Projectile.Center = returnPos; - Projectile.netUpdate = true; - } - // If more than 60 pixels away, move toward the player - if (playerDist > 60f) - { - playerVec.Normalize(); - playerVec *= playerHomeSpeed; - Projectile.velocity = (Projectile.velocity * 10f + playerVec) / 11f; - Projectile.rotation = Projectile.velocity.ToRotation() + drawOffset; - } - else - { - Projectile.Center = returnPos; - Projectile.rotation = GetOffsetAngle + drawOffset; - Behavior = 4f; - } - TreeCounter = 0f; - TreeReset = 0f; - } + float playerHomeSpeed = 40f; + // Teleport to the player if abnormally far + if (playerDist > 2000f) + { + Projectile.Center = returnPos; + Projectile.netUpdate = true; + } + // If more than 60 pixels away, move toward the player + if (playerDist > 60f) + { + playerVec.Normalize(); + playerVec *= playerHomeSpeed; + Projectile.velocity = (Projectile.velocity * 10f + playerVec) / 11f; + Projectile.rotation = Projectile.velocity.ToRotation() + drawOffset; + } + else + { + Projectile.Center = returnPos; + Projectile.rotation = GetOffsetAngle + drawOffset; + Behavior = 4f; + } + TreeCounter = 0f; + TreeReset = 0f; + } public override Color? GetAlpha(Color lightColor) => Color.White; @@ -246,26 +246,26 @@ namespace CalamityMod.Projectiles.Summon.Umbrella public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; - Rectangle frame = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); - Vector2 origin = frame.Size() * 0.5f; - Vector2 drawPosition = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); - SpriteEffects direction = Projectile.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Rectangle frame = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); + Vector2 origin = frame.Size() * 0.5f; + Vector2 drawPosition = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); + SpriteEffects direction = Projectile.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - bool shouldDrawTrail = Behavior != 4f; - if (shouldDrawTrail) - { - // Draw the afterimage trail. - TrailDrawer ??= new(); - GameShaders.Misc["EmpressBlade"].UseShaderSpecificData(new Vector4(1f, 0f, 0f, 0.6f)); - GameShaders.Misc["EmpressBlade"].Apply(null); - TrailDrawer.PrepareStrip(Projectile.oldPos, Projectile.oldRot, TrailColorFunction, TrailWidthFunction, Projectile.Size * 0.5f - Main.screenPosition, Projectile.oldPos.Length, true); - TrailDrawer.DrawTrail(); - Main.pixelShader.CurrentTechnique.Passes[0].Apply(); - } + bool shouldDrawTrail = Behavior != 4f; + if (shouldDrawTrail) + { + // Draw the afterimage trail. + TrailDrawer ??= new(); + GameShaders.Misc["EmpressBlade"].UseShaderSpecificData(new Vector4(1f, 0f, 0f, 0.6f)); + GameShaders.Misc["EmpressBlade"].Apply(null); + TrailDrawer.PrepareStrip(Projectile.oldPos, Projectile.oldRot, TrailColorFunction, TrailWidthFunction, Projectile.Size * 0.5f - Main.screenPosition, Projectile.oldPos.Length, true); + TrailDrawer.DrawTrail(); + Main.pixelShader.CurrentTechnique.Passes[0].Apply(); + } // Draw the axe. - Main.spriteBatch.Draw(texture, drawPosition, frame, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, direction, 0); + Main.spriteBatch.Draw(texture, drawPosition, frame, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, direction, 0); return false; } @@ -274,7 +274,7 @@ namespace CalamityMod.Projectiles.Summon.Umbrella for (int i = 0; i < 10; i++) { Vector2 dspeed = new Vector2(Main.rand.NextFloat(-7f, 7f), Main.rand.NextFloat(-7f, 7f)); - int dust = Dust.NewDust(Projectile.Center, 1, 1, 66, dspeed.X, dspeed.Y, 160, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 0.75f); + int dust = Dust.NewDust(Projectile.Center, 1, 1, DustID.RainbowTorch, dspeed.X, dspeed.Y, 160, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 0.75f); Main.dust[dust].noGravity = true; } } @@ -284,20 +284,20 @@ namespace CalamityMod.Projectiles.Summon.Umbrella public override void OnHitPlayer(Player target, Player.HurtInfo info) => OnHitEffect(target.Center, target.whoAmI); private void OnHitEffect(Vector2 targetPos, int whoAmI) - { - // Every 20 hits, spawn a tree - // Only 1 hit per charge increments this - if (TreeReset == 0f) - { - TreeCounter++; - TreeReset = 1f; - } + { + // Every 20 hits, spawn a tree + // Only 1 hit per charge increments this + if (TreeReset == 0f) + { + TreeCounter++; + TreeReset = 1f; + } - if (TreeCounter >= 20f) - { - TreeCounter = 0; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), targetPos + new Vector2(0f, -600f), Vector2.Zero, ModContent.ProjectileType(), Projectile.damage * 10, Projectile.knockBack * 3f, Projectile.owner, whoAmI); - } - } + if (TreeCounter >= 20f) + { + TreeCounter = 0; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), targetPos + new Vector2(0f, -600f), Vector2.Zero, ModContent.ProjectileType(), Projectile.damage * 10, Projectile.knockBack * 3f, Projectile.owner, whoAmI); + } + } } } diff --git a/Projectiles/Summon/Umbrella/MagicBird.cs b/Projectiles/Summon/Umbrella/MagicBird.cs index 84ee27ffa4..efe57b47a0 100644 --- a/Projectiles/Summon/Umbrella/MagicBird.cs +++ b/Projectiles/Summon/Umbrella/MagicBird.cs @@ -46,8 +46,8 @@ namespace CalamityMod.Projectiles.Summon.Umbrella if (Projectile.ai[0]++ % 20f == 0f) { - Vector2 dspeed = Projectile.velocity * Main.rand.NextFloat(0.3f,0.6f); - int dust = Dust.NewDust(Projectile.Center, 1, 1, 67, dspeed.X, dspeed.Y, 50, default, 1.2f); + Vector2 dspeed = Projectile.velocity * Main.rand.NextFloat(0.3f, 0.6f); + int dust = Dust.NewDust(Projectile.Center, 1, 1, DustID.IceRod, dspeed.X, dspeed.Y, 50, default, 1.2f); Main.dust[dust].noGravity = true; } @@ -122,7 +122,7 @@ namespace CalamityMod.Projectiles.Summon.Umbrella for (int i = 0; i < 10; i++) { Vector2 dspeed = new Vector2(Main.rand.NextFloat(-7f, 7f), Main.rand.NextFloat(-7f, 7f)); - int dust = Dust.NewDust(Projectile.Center, 1, 1, 67, dspeed.X, dspeed.Y, 50, default, 1.2f); + int dust = Dust.NewDust(Projectile.Center, 1, 1, DustID.IceRod, dspeed.X, dspeed.Y, 50, default, 1.2f); Main.dust[dust].noGravity = true; } } diff --git a/Projectiles/Summon/Umbrella/MagicBullet.cs b/Projectiles/Summon/Umbrella/MagicBullet.cs index 2ec96236d9..10938fe054 100644 --- a/Projectiles/Summon/Umbrella/MagicBullet.cs +++ b/Projectiles/Summon/Umbrella/MagicBullet.cs @@ -1,7 +1,7 @@ -using CalamityMod.Buffs.StatDebuffs; +using System; +using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.Graphics; using Terraria.Graphics.Shaders; @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Summon.Umbrella { Projectile.width = 6; Projectile.height = 6; - Projectile.extraUpdates = 7; + Projectile.extraUpdates = 7; Projectile.light = 0.5f; Projectile.scale = 1.18f; Projectile.friendly = true; @@ -33,15 +33,15 @@ namespace CalamityMod.Projectiles.Summon.Umbrella Projectile.timeLeft = 600; Projectile.tileCollide = false; Projectile.DamageType = DamageClass.Summon; - Projectile.alpha = 255; + Projectile.alpha = 255; } - public override void AI() - { - Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - if (Projectile.ai[0]++ > 2f) - Projectile.alpha = 0; - } + public override void AI() + { + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + if (Projectile.ai[0]++ > 2f) + Projectile.alpha = 0; + } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { @@ -65,23 +65,23 @@ namespace CalamityMod.Projectiles.Summon.Umbrella target.AddBuff(ModContent.BuffType(), 180); } - public override Color? GetAlpha(Color lightColor) => Color.White; + public override Color? GetAlpha(Color lightColor) => Color.White; public override bool PreDraw(ref Color lightColor) { - if (Projectile.alpha != 0) - return false; + if (Projectile.alpha != 0) + return false; - Texture2D texture = ModContent.Request(Texture).Value; - Rectangle frame = texture.Frame(1, 1, 0, 0); - Vector2 origin = frame.Size() * 0.5f; - Vector2 drawPosition = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Rectangle frame = texture.Frame(1, 1, 0, 0); + Vector2 origin = frame.Size() * 0.5f; + Vector2 drawPosition = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); // Draw the bullet. - Main.spriteBatch.Draw(texture, drawPosition, frame, Color.White, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0); + Main.spriteBatch.Draw(texture, drawPosition, frame, Color.White, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0); - // Draw Afterimages - CalamityUtils.DrawAfterimagesFromEdge(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor); + // Draw Afterimages + CalamityUtils.DrawAfterimagesFromEdge(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor); return false; } } diff --git a/Projectiles/Summon/Umbrella/MagicBulletBig.cs b/Projectiles/Summon/Umbrella/MagicBulletBig.cs index 7de0956317..5a0b5c307c 100644 --- a/Projectiles/Summon/Umbrella/MagicBulletBig.cs +++ b/Projectiles/Summon/Umbrella/MagicBulletBig.cs @@ -1,7 +1,7 @@ -using CalamityMod.Buffs.StatDebuffs; +using System; +using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.Graphics; using Terraria.Graphics.Shaders; @@ -25,28 +25,28 @@ namespace CalamityMod.Projectiles.Summon.Umbrella { Projectile.width = 6; Projectile.height = 6; - Projectile.extraUpdates = 12; + Projectile.extraUpdates = 12; Projectile.light = 0.5f; Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.timeLeft = 600; Projectile.tileCollide = false; Projectile.DamageType = DamageClass.Summon; - Projectile.alpha = 255; + Projectile.alpha = 255; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = -1; Projectile.penetrate = 4; } - public override void AI() - { - Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - if (Projectile.FinalExtraUpdate()) - { - if (Projectile.ai[0]++ > 1f) - Projectile.alpha = 0; - } - } + public override void AI() + { + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + if (Projectile.FinalExtraUpdate()) + { + if (Projectile.ai[0]++ > 1f) + Projectile.alpha = 0; + } + } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { @@ -70,23 +70,23 @@ namespace CalamityMod.Projectiles.Summon.Umbrella target.AddBuff(ModContent.BuffType(), 180); } - public override Color? GetAlpha(Color lightColor) => Color.White; + public override Color? GetAlpha(Color lightColor) => Color.White; public override bool PreDraw(ref Color lightColor) { - if (Projectile.alpha != 0) - return false; + if (Projectile.alpha != 0) + return false; - Texture2D texture = ModContent.Request(Texture).Value; - Rectangle frame = texture.Frame(1, 1, 0, 0); - Vector2 origin = frame.Size() * 0.5f; - Vector2 drawPosition = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Rectangle frame = texture.Frame(1, 1, 0, 0); + Vector2 origin = frame.Size() * 0.5f; + Vector2 drawPosition = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); // Draw the bullet. - Main.spriteBatch.Draw(texture, drawPosition, frame, Color.White, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0); + Main.spriteBatch.Draw(texture, drawPosition, frame, Color.White, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0); - // Draw Afterimages - CalamityUtils.DrawAfterimagesFromEdge(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor); + // Draw Afterimages + CalamityUtils.DrawAfterimagesFromEdge(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor); return false; } } diff --git a/Projectiles/Summon/Umbrella/MagicBunny.cs b/Projectiles/Summon/Umbrella/MagicBunny.cs index 41dfa9c16a..c2bb997aa2 100644 --- a/Projectiles/Summon/Umbrella/MagicBunny.cs +++ b/Projectiles/Summon/Umbrella/MagicBunny.cs @@ -1,5 +1,5 @@ +using System; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -29,28 +29,28 @@ namespace CalamityMod.Projectiles.Summon.Umbrella public override void AI() { - if (Projectile.soundDelay == 0) - { - Projectile.soundDelay = 3000; - SoundEngine.PlaySound(SoundID.Item14, Projectile.position); - } + if (Projectile.soundDelay == 0) + { + Projectile.soundDelay = 3000; + SoundEngine.PlaySound(SoundID.Item14, Projectile.position); + } - if (Projectile.velocity.X > 0f) - Projectile.direction = 1; - else if (Projectile.velocity.X < 0f) - Projectile.direction = -1; + if (Projectile.velocity.X > 0f) + Projectile.direction = 1; + else if (Projectile.velocity.X < 0f) + Projectile.direction = -1; - Projectile.spriteDirection = Projectile.direction; - Projectile.ai[0] += 1f; - Projectile.rotation += Projectile.velocity.X * 0.05f + (float)Projectile.direction * 0.05f; - if (Projectile.ai[0] >= 18f) - { - Projectile.velocity.Y += 0.28f; - Projectile.velocity.X *= 0.99f; - } + Projectile.spriteDirection = Projectile.direction; + Projectile.ai[0] += 1f; + Projectile.rotation += Projectile.velocity.X * 0.05f + (float)Projectile.direction * 0.05f; + if (Projectile.ai[0] >= 18f) + { + Projectile.velocity.Y += 0.28f; + Projectile.velocity.X *= 0.99f; + } - if (Projectile.velocity.Y > 15.9f) - Projectile.velocity.Y = 15.9f; + if (Projectile.velocity.Y > 15.9f) + Projectile.velocity.Y = 15.9f; //Fade in if (Projectile.alpha > 0) @@ -62,68 +62,68 @@ namespace CalamityMod.Projectiles.Summon.Umbrella Projectile.alpha = 0; } - if (Math.Abs(Projectile.velocity.X) < 0.2f && Math.Abs(Projectile.velocity.Y) < 0.2f) - Projectile.Kill(); + if (Math.Abs(Projectile.velocity.X) < 0.2f && Math.Abs(Projectile.velocity.Y) < 0.2f) + Projectile.Kill(); } public override bool OnTileCollide(Vector2 oldVelocity) { - if (Projectile.velocity.X != oldVelocity.X) - Projectile.velocity.X = -oldVelocity.X * 0.5f; + if (Projectile.velocity.X != oldVelocity.X) + Projectile.velocity.X = -oldVelocity.X * 0.5f; - if (Projectile.velocity.Y != oldVelocity.Y) - Projectile.velocity.Y = -oldVelocity.Y * 0.5f; + if (Projectile.velocity.Y != oldVelocity.Y) + Projectile.velocity.Y = -oldVelocity.Y * 0.5f; return false; } public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.NPCDeath1, Projectile.position); - int idx = Gore.NewGore(Projectile.GetSource_FromThis(), Projectile.position, new Vector2(Main.rand.NextFloat(-4f, 4f), Main.rand.NextFloat(-4f, 4f)), 76); - Gore gore = Main.gore[idx]; - gore.velocity -= Projectile.velocity * 0.5f; - idx = Gore.NewGore(Projectile.GetSource_FromThis(), Projectile.position, new Vector2(Main.rand.NextFloat(-4f, 4f), Main.rand.NextFloat(-4f, 4f)), 77); - gore.velocity -= Projectile.velocity * 0.5f; - SoundEngine.PlaySound(SoundID.Item14, Projectile.position); + SoundEngine.PlaySound(SoundID.NPCDeath1, Projectile.position); + int idx = Gore.NewGore(Projectile.GetSource_FromThis(), Projectile.position, new Vector2(Main.rand.NextFloat(-4f, 4f), Main.rand.NextFloat(-4f, 4f)), 76); + Gore gore = Main.gore[idx]; + gore.velocity -= Projectile.velocity * 0.5f; + idx = Gore.NewGore(Projectile.GetSource_FromThis(), Projectile.position, new Vector2(Main.rand.NextFloat(-4f, 4f), Main.rand.NextFloat(-4f, 4f)), 77); + gore.velocity -= Projectile.velocity * 0.5f; + SoundEngine.PlaySound(SoundID.Item14, Projectile.position); - for (int i = 0; i < 20; i++) - { - int index = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 31, 0f, 0f, 100, default, 1.5f); - Dust dust = Main.dust[index]; - dust.velocity *= 1.4f; - } + for (int i = 0; i < 20; i++) + { + int index = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Smoke, 0f, 0f, 100, default, 1.5f); + Dust dust = Main.dust[index]; + dust.velocity *= 1.4f; + } - for (int i = 0; i < 10; i++) - { - int index = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 2.5f); - Dust dust = Main.dust[index]; - dust.noGravity = true; - dust.velocity *= 5f; - index = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 1.5f); - dust.velocity *= 3f; - } + for (int i = 0; i < 10; i++) + { + int index = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 2.5f); + Dust dust = Main.dust[index]; + dust.noGravity = true; + dust.velocity *= 5f; + index = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 1.5f); + dust.velocity *= 3f; + } - idx = Gore.NewGore(Projectile.GetSource_FromThis(), Projectile.position, default(Vector2), Main.rand.Next(61, 64)); - gore.velocity *= 0.4f; - gore.velocity.X += 1f; - gore.velocity.Y += 1f; - idx = Gore.NewGore(Projectile.GetSource_FromThis(), Projectile.position, default(Vector2), Main.rand.Next(61, 64)); - gore.velocity *= 0.4f; - gore.velocity.X -= 1f; - gore.velocity.Y += 1f; - idx = Gore.NewGore(Projectile.GetSource_FromThis(), Projectile.position, default(Vector2), Main.rand.Next(61, 64)); - gore.velocity *= 0.4f; - gore.velocity.X += 1f; - gore.velocity.Y -= 1f; - idx = Gore.NewGore(Projectile.GetSource_FromThis(), Projectile.position, default(Vector2), Main.rand.Next(61, 64)); - gore.velocity *= 0.4f; - gore.velocity.X -= 1f; - gore.velocity.Y -= 1f; + idx = Gore.NewGore(Projectile.GetSource_FromThis(), Projectile.position, default(Vector2), Main.rand.Next(61, 64)); + gore.velocity *= 0.4f; + gore.velocity.X += 1f; + gore.velocity.Y += 1f; + idx = Gore.NewGore(Projectile.GetSource_FromThis(), Projectile.position, default(Vector2), Main.rand.Next(61, 64)); + gore.velocity *= 0.4f; + gore.velocity.X -= 1f; + gore.velocity.Y += 1f; + idx = Gore.NewGore(Projectile.GetSource_FromThis(), Projectile.position, default(Vector2), Main.rand.Next(61, 64)); + gore.velocity *= 0.4f; + gore.velocity.X += 1f; + gore.velocity.Y -= 1f; + idx = Gore.NewGore(Projectile.GetSource_FromThis(), Projectile.position, default(Vector2), Main.rand.Next(61, 64)); + gore.velocity *= 0.4f; + gore.velocity.X -= 1f; + gore.velocity.Y -= 1f; - Projectile.ExpandHitboxBy(128); - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; - Projectile.Damage(); + Projectile.ExpandHitboxBy(128); + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Damage(); } public override Color? GetAlpha(Color lightColor) => Color.White; // new Color(255, 239, 0, Projectile.alpha); diff --git a/Projectiles/Summon/Umbrella/MagicHammer.cs b/Projectiles/Summon/Umbrella/MagicHammer.cs index 5d41502c59..a5fc677445 100644 --- a/Projectiles/Summon/Umbrella/MagicHammer.cs +++ b/Projectiles/Summon/Umbrella/MagicHammer.cs @@ -1,7 +1,7 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; +using System; using System.IO; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; using Terraria.Graphics; @@ -15,11 +15,11 @@ namespace CalamityMod.Projectiles.Summon.Umbrella { public new string LocalizationCategory => "Projectiles.Summon"; public float Behavior = 0f; - public float PivotPointX = 0f; - public float PivotPointY = 0f; - private int counter = 0; - private const int projSize = 60; - private const float drawOffset = -MathHelper.PiOver4 + MathHelper.Pi; + public float PivotPointX = 0f; + public float PivotPointY = 0f; + private int counter = 0; + private const int projSize = 60; + private const float drawOffset = -MathHelper.PiOver4 + MathHelper.Pi; public static readonly SoundStyle StylishSound = new("CalamityMod/Sounds/Custom/Stylish"); public VertexStrip TrailDrawer; @@ -67,14 +67,14 @@ namespace CalamityMod.Projectiles.Summon.Umbrella public override void AI() { - Player player = Main.player[Projectile.owner]; + Player player = Main.player[Projectile.owner]; Projectile.alpha -= 50; - // Set the timeLeft if the player has the hat - if (player.Calamity().magicHat) - { - Projectile.timeLeft = 2; - } + // Set the timeLeft if the player has the hat + if (player.Calamity().magicHat) + { + Projectile.timeLeft = 2; + } float homingRange = MagicHat.Range; int targetIndex = -1; @@ -113,179 +113,179 @@ namespace CalamityMod.Projectiles.Summon.Umbrella } } - if (targetIndex == -1) - { - Behavior = 0f; - IdleAI(); - } - else - { - MoveToEnemy(targetIndex); - } + if (targetIndex == -1) + { + Behavior = 0f; + IdleAI(); + } + else + { + MoveToEnemy(targetIndex); + } } - private void IdleAI() - { - Player player = Main.player[Projectile.owner]; + private void IdleAI() + { + Player player = Main.player[Projectile.owner]; - Vector2 returnPos = player.Center + GetOffsetAngle.ToRotationVector2() * 180f; + Vector2 returnPos = player.Center + GetOffsetAngle.ToRotationVector2() * 180f; - // Player distance calculations - Vector2 playerVec = returnPos - Projectile.Center; - float playerDist = playerVec.Length(); + // Player distance calculations + Vector2 playerVec = returnPos - Projectile.Center; + float playerDist = playerVec.Length(); - float playerHomeSpeed = 40f; - // Teleport to the player if abnormally far - if (playerDist > 2000f) - { - Projectile.Center = returnPos; - Projectile.netUpdate = true; - } - // If more than 60 pixels away, move toward the player - if (playerDist > 60f) - { - playerVec.Normalize(); - playerVec *= playerHomeSpeed; - Projectile.velocity = (Projectile.velocity * 10f + playerVec) / 11f; - Projectile.rotation = Projectile.velocity.ToRotation() + drawOffset; - } - else - { - Projectile.Center = returnPos; - Projectile.rotation = GetOffsetAngle + drawOffset; - } - // Return to normal size - if (Projectile.scale != 1f) - { - Projectile.scale = 1f; - Projectile.ExpandHitboxBy((int)(projSize * Projectile.scale)); - } - } + float playerHomeSpeed = 40f; + // Teleport to the player if abnormally far + if (playerDist > 2000f) + { + Projectile.Center = returnPos; + Projectile.netUpdate = true; + } + // If more than 60 pixels away, move toward the player + if (playerDist > 60f) + { + playerVec.Normalize(); + playerVec *= playerHomeSpeed; + Projectile.velocity = (Projectile.velocity * 10f + playerVec) / 11f; + Projectile.rotation = Projectile.velocity.ToRotation() + drawOffset; + } + else + { + Projectile.Center = returnPos; + Projectile.rotation = GetOffsetAngle + drawOffset; + } + // Return to normal size + if (Projectile.scale != 1f) + { + Projectile.scale = 1f; + Projectile.ExpandHitboxBy((int)(projSize * Projectile.scale)); + } + } - private void MoveToEnemy(int targetIndex) - { - if (Behavior == 0f) - Behavior = 1f; + private void MoveToEnemy(int targetIndex) + { + if (Behavior == 0f) + Behavior = 1f; - // Target distance calculations - NPC npc = Main.npc[targetIndex]; - Vector2 targetVec = npc.Center - Projectile.Center; - float targetDist = targetVec.Length(); + // Target distance calculations + NPC npc = Main.npc[targetIndex]; + Vector2 targetVec = npc.Center - Projectile.Center; + float targetDist = targetVec.Length(); - float moveSpeed = 40f; - // If more than 60 pixels away, move toward the target - if (targetDist > 60f && Behavior == 1f) - { - targetVec.Normalize(); - targetVec *= moveSpeed; - Projectile.velocity = (Projectile.velocity * 1f + targetVec) / 2f; - Projectile.rotation = Projectile.velocity.ToRotation() + drawOffset; - } - else - { - // Get bigger and prepare the pivot position - if (Behavior == 1f) - { - if (Projectile.scale == 1f) - { - Projectile.scale = 3f; - Projectile.ExpandHitboxBy(Projectile.scale); - } - Projectile.rotation = drawOffset + MathHelper.ToRadians(20f) * (targetVec.X > 0 ? 3f : -3f); - Projectile.ai[1] = drawOffset + MathHelper.ToRadians(20f) * (targetVec.X > 0 ? 3f : -3f); - PivotPointX = Projectile.Bottom.X; - PivotPointY = Projectile.Bottom.Y; - Behavior = 2f; - } - // Decide which way to swing - if (Behavior == 2f) - { - Behavior = targetVec.X > 0 ? 3f : 4f; - } - // Big Bonk Energy - if (Behavior == 3f || Behavior == 4f) - { - float swingTime = 20f; - Projectile.ai[1] += MathHelper.ToRadians(200f / swingTime) * (Behavior == 3f ? 1f : -1f); - counter++; - float outwardPosition = 50f; - Vector2 pivot = new Vector2(PivotPointX, PivotPointY); - Projectile.Center = pivot + Projectile.ai[1].ToRotationVector2() * outwardPosition; - Projectile.rotation = Projectile.ai[1] + drawOffset; - if (counter > swingTime) - { - Projectile.ai[1] = MathHelper.PiOver4; - counter = 0; - Behavior = 5f; - } - } - // Head back to the player as a reset between bonks - if (Behavior == 5f) - MoveBackToPlayer(); - } - } + float moveSpeed = 40f; + // If more than 60 pixels away, move toward the target + if (targetDist > 60f && Behavior == 1f) + { + targetVec.Normalize(); + targetVec *= moveSpeed; + Projectile.velocity = (Projectile.velocity * 1f + targetVec) / 2f; + Projectile.rotation = Projectile.velocity.ToRotation() + drawOffset; + } + else + { + // Get bigger and prepare the pivot position + if (Behavior == 1f) + { + if (Projectile.scale == 1f) + { + Projectile.scale = 3f; + Projectile.ExpandHitboxBy(Projectile.scale); + } + Projectile.rotation = drawOffset + MathHelper.ToRadians(20f) * (targetVec.X > 0 ? 3f : -3f); + Projectile.ai[1] = drawOffset + MathHelper.ToRadians(20f) * (targetVec.X > 0 ? 3f : -3f); + PivotPointX = Projectile.Bottom.X; + PivotPointY = Projectile.Bottom.Y; + Behavior = 2f; + } + // Decide which way to swing + if (Behavior == 2f) + { + Behavior = targetVec.X > 0 ? 3f : 4f; + } + // Big Bonk Energy + if (Behavior == 3f || Behavior == 4f) + { + float swingTime = 20f; + Projectile.ai[1] += MathHelper.ToRadians(200f / swingTime) * (Behavior == 3f ? 1f : -1f); + counter++; + float outwardPosition = 50f; + Vector2 pivot = new Vector2(PivotPointX, PivotPointY); + Projectile.Center = pivot + Projectile.ai[1].ToRotationVector2() * outwardPosition; + Projectile.rotation = Projectile.ai[1] + drawOffset; + if (counter > swingTime) + { + Projectile.ai[1] = MathHelper.PiOver4; + counter = 0; + Behavior = 5f; + } + } + // Head back to the player as a reset between bonks + if (Behavior == 5f) + MoveBackToPlayer(); + } + } - private void MoveBackToPlayer() - { - Player player = Main.player[Projectile.owner]; + private void MoveBackToPlayer() + { + Player player = Main.player[Projectile.owner]; - const float outwardPosition = 180f; - Vector2 returnPos = player.Center + GetOffsetAngle.ToRotationVector2() * outwardPosition; + const float outwardPosition = 180f; + Vector2 returnPos = player.Center + GetOffsetAngle.ToRotationVector2() * outwardPosition; - // Player distance calculations - Vector2 playerVec = returnPos - Projectile.Center; - float playerDist = playerVec.Length(); + // Player distance calculations + Vector2 playerVec = returnPos - Projectile.Center; + float playerDist = playerVec.Length(); - float playerHomeSpeed = 40f; - // If more than 60 pixels away, move toward the player - if (playerDist > 60f) - { - playerVec.Normalize(); - playerVec *= playerHomeSpeed; - Projectile.velocity = (Projectile.velocity * 1f + playerVec) / 2f; - Projectile.rotation = Projectile.velocity.ToRotation() + drawOffset; - } - else - { - Behavior = 0f; - } - // Return to normal size - if (Projectile.scale != 1f) - { - Projectile.scale = 1f; - Projectile.ExpandHitboxBy(projSize); - } - } + float playerHomeSpeed = 40f; + // If more than 60 pixels away, move toward the player + if (playerDist > 60f) + { + playerVec.Normalize(); + playerVec *= playerHomeSpeed; + Projectile.velocity = (Projectile.velocity * 1f + playerVec) / 2f; + Projectile.rotation = Projectile.velocity.ToRotation() + drawOffset; + } + else + { + Behavior = 0f; + } + // Return to normal size + if (Projectile.scale != 1f) + { + Projectile.scale = 1f; + Projectile.ExpandHitboxBy(projSize); + } + } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - // On bonk, there is a small chance for confetti and Stylish energy + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + // On bonk, there is a small chance for confetti and Stylish energy if ((Behavior == 3f || Behavior == 4f) && Main.rand.NextBool(20) && Projectile.soundDelay <= 0) - { + { Rectangle location = new Rectangle((int)target.position.X, (int)target.position.Y, target.width, target.height); CombatText.NewText(location, new Color(239, 113, 152), CalamityUtils.GetTextValue("Misc.StylishHammerHit"), true); - SoundEngine.PlaySound(StylishSound with { Volume = 0.35f }, target.Center); + SoundEngine.PlaySound(StylishSound with { Volume = 0.35f }, target.Center); Projectile.soundDelay = 60; - for (int i = 0; i < 5; i++) - { - int confettiDust = Main.rand.Next(139, 143); - int confetti = Dust.NewDust(target.Center, target.width, target.height, confettiDust, target.velocity.X, target.velocity.Y, 0, new Color(), 1.2f); - Main.dust[confetti].velocity.X *= Main.rand.NextFloat(0.5f, 1.5f); - Main.dust[confetti].velocity.Y *= Main.rand.NextFloat(0.5f, 1.5f); - Main.dust[confetti].velocity.X += Main.rand.NextFloat(-2.5f, 2.5f); - Main.dust[confetti].velocity.Y += Main.rand.NextFloat(-2.5f, 2.5f); - Main.dust[confetti].scale *= Main.rand.NextFloat(0.7f, 1.3f); - if (Main.netMode != NetmodeID.Server && Main.rand.NextBool()) - { - int confettiGore = Main.rand.Next(276, 283); - int idx = Gore.NewGore(Projectile.GetSource_FromThis(), target.Center, target.velocity, confettiGore, 1f); - Main.gore[idx].velocity.X *= Main.rand.NextFloat(0.5f, 1.5f); - Main.gore[idx].velocity.Y *= Main.rand.NextFloat(0.5f, 1.5f); - Main.gore[idx].velocity.X += Main.rand.NextFloat(-2.5f, 2.5f); - Main.gore[idx].velocity.Y += Main.rand.NextFloat(-2.5f, 2.5f); - Main.gore[idx].scale *= Main.rand.NextFloat(0.8f, 1.2f); - } - } + for (int i = 0; i < 5; i++) + { + int confettiDust = Main.rand.Next(139, 143); + int confetti = Dust.NewDust(target.Center, target.width, target.height, confettiDust, target.velocity.X, target.velocity.Y, 0, new Color(), 1.2f); + Main.dust[confetti].velocity.X *= Main.rand.NextFloat(0.5f, 1.5f); + Main.dust[confetti].velocity.Y *= Main.rand.NextFloat(0.5f, 1.5f); + Main.dust[confetti].velocity.X += Main.rand.NextFloat(-2.5f, 2.5f); + Main.dust[confetti].velocity.Y += Main.rand.NextFloat(-2.5f, 2.5f); + Main.dust[confetti].scale *= Main.rand.NextFloat(0.7f, 1.3f); + if (Main.netMode != NetmodeID.Server && Main.rand.NextBool()) + { + int confettiGore = Main.rand.Next(276, 283); + int idx = Gore.NewGore(Projectile.GetSource_FromThis(), target.Center, target.velocity, confettiGore, 1f); + Main.gore[idx].velocity.X *= Main.rand.NextFloat(0.5f, 1.5f); + Main.gore[idx].velocity.Y *= Main.rand.NextFloat(0.5f, 1.5f); + Main.gore[idx].velocity.X += Main.rand.NextFloat(-2.5f, 2.5f); + Main.gore[idx].velocity.Y += Main.rand.NextFloat(-2.5f, 2.5f); + Main.gore[idx].scale *= Main.rand.NextFloat(0.8f, 1.2f); + } + } } } @@ -296,7 +296,7 @@ namespace CalamityMod.Projectiles.Summon.Umbrella for (int i = 0; i < 10; i++) { Vector2 dspeed = new Vector2(Main.rand.NextFloat(-7f, 7f), Main.rand.NextFloat(-7f, 7f)); - int dust = Dust.NewDust(Projectile.Center, 1, 1, 67, dspeed.X, dspeed.Y, 50, default, 1.2f); + int dust = Dust.NewDust(Projectile.Center, 1, 1, DustID.IceRod, dspeed.X, dspeed.Y, 50, default, 1.2f); Main.dust[dust].noGravity = true; } } @@ -311,26 +311,26 @@ namespace CalamityMod.Projectiles.Summon.Umbrella public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; - Rectangle frame = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); - Vector2 origin = frame.Size() * 0.5f; - Vector2 drawPosition = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); - SpriteEffects direction = Projectile.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Rectangle frame = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); + Vector2 origin = frame.Size() * 0.5f; + Vector2 drawPosition = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); + SpriteEffects direction = Projectile.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - bool shouldDrawTrail = Behavior != 0f; - if (shouldDrawTrail) - { - // Draw the afterimage trail. - TrailDrawer ??= new(); - GameShaders.Misc["EmpressBlade"].UseShaderSpecificData(new Vector4(1f, 0f, 0f, 0.6f)); - GameShaders.Misc["EmpressBlade"].Apply(null); - TrailDrawer.PrepareStrip(Projectile.oldPos, Projectile.oldRot, TrailColorFunction, TrailWidthFunction, Projectile.Size * 0.5f - Main.screenPosition, Projectile.oldPos.Length, true); - TrailDrawer.DrawTrail(); - Main.pixelShader.CurrentTechnique.Passes[0].Apply(); - } + bool shouldDrawTrail = Behavior != 0f; + if (shouldDrawTrail) + { + // Draw the afterimage trail. + TrailDrawer ??= new(); + GameShaders.Misc["EmpressBlade"].UseShaderSpecificData(new Vector4(1f, 0f, 0f, 0.6f)); + GameShaders.Misc["EmpressBlade"].Apply(null); + TrailDrawer.PrepareStrip(Projectile.oldPos, Projectile.oldRot, TrailColorFunction, TrailWidthFunction, Projectile.Size * 0.5f - Main.screenPosition, Projectile.oldPos.Length, true); + TrailDrawer.DrawTrail(); + Main.pixelShader.CurrentTechnique.Passes[0].Apply(); + } // Draw the hammer. - Main.spriteBatch.Draw(texture, drawPosition, frame, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, direction, 0); + Main.spriteBatch.Draw(texture, drawPosition, frame, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, direction, 0); return false; } } diff --git a/Projectiles/Summon/Umbrella/MagicHat.cs b/Projectiles/Summon/Umbrella/MagicHat.cs index 5e927bf8c7..663c9df9e3 100644 --- a/Projectiles/Summon/Umbrella/MagicHat.cs +++ b/Projectiles/Summon/Umbrella/MagicHat.cs @@ -1,10 +1,11 @@ -using CalamityMod.Buffs.Summon; +using System; +using System.Collections.Generic; +using CalamityMod.Buffs.Summon; using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.Collections.Generic; using Terraria; +using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; @@ -58,25 +59,25 @@ namespace CalamityMod.Projectiles.Summon.Umbrella } // On frame 2, spawn the tools - if (Projectile.ai[0] == 1f) - { - List> Projectiles = new List>() - { - new Tuple(ModContent.ProjectileType(), 2f), - new Tuple(ModContent.ProjectileType(), 3f), - new Tuple(ModContent.ProjectileType(), 1f), - new Tuple(ModContent.ProjectileType(), 1f), - new Tuple(ModContent.ProjectileType(), 1f), - }; - for (int i = 0; i < Projectiles.Count; i++) - { - int p = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, Projectiles[i].Item1,(int)(Projectile.damage * Projectiles[i].Item2), - Projectile.knockBack * Projectiles[i].Item2, Projectile.owner, Projectile.whoAmI); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = (int)(Projectile.originalDamage * Projectiles[i].Item2); - } - } - Projectile.ai[0]++; + if (Projectile.ai[0] == 1f) + { + List> Projectiles = new List>() + { + new Tuple(ModContent.ProjectileType(), 2f), + new Tuple(ModContent.ProjectileType(), 3f), + new Tuple(ModContent.ProjectileType(), 1f), + new Tuple(ModContent.ProjectileType(), 1f), + new Tuple(ModContent.ProjectileType(), 1f), + }; + for (int i = 0; i < Projectiles.Count; i++) + { + int p = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, Projectiles[i].Item1, (int)(Projectile.damage * Projectiles[i].Item2), + Projectile.knockBack * Projectiles[i].Item2, Projectile.owner, Projectile.whoAmI); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = (int)(Projectile.originalDamage * Projectiles[i].Item2); + } + } + Projectile.ai[0]++; // Stick to the player's head, account for shifts in gravity Projectile.Center = player.MountedCenter + Vector2.UnitY * (player.gfxOffY - 30f); @@ -103,7 +104,7 @@ namespace CalamityMod.Projectiles.Summon.Umbrella int dustAmt = 50; for (int dustIndex = 0; dustIndex < dustAmt; dustIndex++) { - int dustEffects = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height - 16, 234, 0f, 0f, 0, default, 1f); + int dustEffects = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height - 16, DustID.BoneTorch, 0f, 0f, 0, default, 1f); Main.dust[dustEffects].velocity *= 2f; Main.dust[dustEffects].scale *= 1.15f; } @@ -117,27 +118,41 @@ namespace CalamityMod.Projectiles.Summon.Umbrella // No contact damage public override bool? CanDamage() => false; - // Draw over players + // Draw over players public override void DrawBehind(int index, List behindNPCsAndTiles, List behindNPCs, List behindProjectiles, List overPlayers, List overWiresUI) => overPlayers.Add(index); public override bool PreDraw(ref Color lightColor) { - Player player = Main.player[Projectile.owner]; + Player player = Main.player[Projectile.owner]; - // Use a different texture if the player is invisible or has at least 50% stealth - Texture2D texture = ModContent.Request(Texture).Value; - float stealthPercent = player.Calamity().rogueStealthMax != 0 ? (player.Calamity().rogueStealth / player.Calamity().rogueStealthMax) : 0f; //0 to 1 + // Use a different texture if the player is invisible or has at least 50% stealth + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + float stealthPercent = player.Calamity().rogueStealthMax != 0 ? (player.Calamity().rogueStealth / player.Calamity().rogueStealthMax) : 0f; //0 to 1 bool hasStealth = player.Calamity().rogueStealth > 0f && stealthPercent > 0.5f && player.townNPCs < 3f && CalamityConfig.Instance.StealthInvisibility; - if (player.ShouldNotDraw || hasStealth) - texture = ModContent.Request("CalamityMod/Projectiles/Summon/Umbrella/MagicHatInvis").Value; + if (player.ShouldNotDraw || hasStealth) + texture = ModContent.Request("CalamityMod/Projectiles/Summon/Umbrella/MagicHatInvis").Value; - Rectangle frame = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); - Vector2 origin = frame.Size() * 0.5f; - Vector2 drawPosition = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); - SpriteEffects direction = Projectile.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + Rectangle frame = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); + Vector2 origin = frame.Size() * 0.5f; + Vector2 drawPosition = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); + SpriteEffects direction = Projectile.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; // Draw the hat. - Main.spriteBatch.Draw(texture, drawPosition, frame, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, direction, 0); + if (player.dye[0].dye > 0) + { + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.Default, RasterizerState.CullNone, null, Main.GameViewMatrix.ZoomMatrix); + var dyeShader = GameShaders.Armor.GetShaderFromItemId(player.dye[0].type); + dyeShader.Apply(); + Main.spriteBatch.Draw(texture, drawPosition, frame, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, direction, 0); + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.Transform); + } + else + { + Main.spriteBatch.Draw(texture, drawPosition, frame, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, direction, 0); + } + return false; } } diff --git a/Projectiles/Summon/Umbrella/MagicRifle.cs b/Projectiles/Summon/Umbrella/MagicRifle.cs index dcc519aef5..5b5e977842 100644 --- a/Projectiles/Summon/Umbrella/MagicRifle.cs +++ b/Projectiles/Summon/Umbrella/MagicRifle.cs @@ -1,7 +1,7 @@ -using CalamityMod.Sounds; +using System; +using CalamityMod.Sounds; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.Audio; using Terraria.Graphics; @@ -15,13 +15,13 @@ namespace CalamityMod.Projectiles.Summon.Umbrella { public new string LocalizationCategory => "Projectiles.Summon"; public VertexStrip TrailDrawer; - public bool drawTrail = false; - public bool leftSide = false; - public int swapCooldown = 0; - public float sineCounter = 0f; - public ref float SwapSides => ref Projectile.localAI[0]; - public ref float SpinCounter => ref Projectile.localAI[1]; - public ref float ShootCooldown => ref Projectile.ai[1]; + public bool drawTrail = false; + public bool leftSide = false; + public int swapCooldown = 0; + public float sineCounter = 0f; + public ref float SwapSides => ref Projectile.localAI[0]; + public ref float SpinCounter => ref Projectile.localAI[1]; + public ref float ShootCooldown => ref Projectile.ai[1]; public float GetOffsetAngle { @@ -54,18 +54,18 @@ namespace CalamityMod.Projectiles.Summon.Umbrella // Set player namespace Player player = Main.player[Projectile.owner]; - // Set timeLeft if the hat exists - if (player.Calamity().magicHat) - { - Projectile.timeLeft = 2; - } + // Set timeLeft if the hat exists + if (player.Calamity().magicHat) + { + Projectile.timeLeft = 2; + } - // Increment counters for swap cooldown and sine counter - if (swapCooldown > 0) - swapCooldown--; - if (swapCooldown == 1) - leftSide = !leftSide; - sineCounter++; + // Increment counters for swap cooldown and sine counter + if (swapCooldown > 0) + swapCooldown--; + if (swapCooldown == 1) + leftSide = !leftSide; + sineCounter++; float homingRange = MagicHat.Range; Vector2 targetVec = Projectile.position; @@ -101,7 +101,7 @@ namespace CalamityMod.Projectiles.Summon.Umbrella { homingRange = targetDist; targetVec = npc.Center; - targetIndex = npc.whoAmI; + targetIndex = npc.whoAmI; } } } @@ -109,12 +109,12 @@ namespace CalamityMod.Projectiles.Summon.Umbrella if (targetIndex == -1) { - IdleAI(); + IdleAI(); + } + else + { + AttackMovement(targetIndex); } - else - { - AttackMovement(targetIndex); - } // Return if on swap cooldown if (swapCooldown != 0f) @@ -136,32 +136,32 @@ namespace CalamityMod.Projectiles.Summon.Umbrella if (ShootCooldown != 0f || targetIndex == -1) return; - // Do a little spin before firing a big shot - if (SwapSides > 5f) - { - SpinCounter += MathHelper.ToRadians(60f) * Projectile.spriteDirection; - if (Math.Abs(SpinCounter) > MathHelper.ToRadians(720f)) - { - SpinCounter = 0f; - SwapSides = -1f; - } - return; - } + // Do a little spin before firing a big shot + if (SwapSides > 5f) + { + SpinCounter += MathHelper.ToRadians(60f) * Projectile.spriteDirection; + if (Math.Abs(SpinCounter) > MathHelper.ToRadians(720f)) + { + SpinCounter = 0f; + SwapSides = -1f; + } + return; + } // Shoot a bullet if (Main.myPlayer == Projectile.owner) { float projSpeed = 6f; int projType = ModContent.ProjectileType(); - int damage = Projectile.damage; - float kback = 0f; - if (SwapSides == -1f) - { - projType = ModContent.ProjectileType(); - damage *= 2; - swapCooldown = 30; - kback = Projectile.knockBack; - } + int damage = Projectile.damage; + float kback = 0f; + if (SwapSides == -1f) + { + projType = ModContent.ProjectileType(); + damage *= 2; + swapCooldown = 30; + kback = Projectile.knockBack; + } ShootCooldown += 1f; if (Main.myPlayer == Projectile.owner) { @@ -172,89 +172,89 @@ namespace CalamityMod.Projectiles.Summon.Umbrella SoundEngine.PlaySound(SwapSides == -1f ? CommonCalamitySounds.LargeWeaponFireSound : SoundID.Item40, Projectile.position); int bullet = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, projType, damage, kback, Projectile.owner); - // For unknown reasons, the bullet does not spawn at the desired position, so let's set that manually - // I don't think this works regardless - if (Main.projectile.IndexInRange(bullet)) - Main.projectile[bullet].Center = Projectile.Center; + // For unknown reasons, the bullet does not spawn at the desired position, so let's set that manually + // I don't think this works regardless + if (Main.projectile.IndexInRange(bullet)) + Main.projectile[bullet].Center = Projectile.Center; Projectile.netUpdate = true; } SwapSides += 1f; } } - private void AttackMovement(int targetIndex) - { - Player player = Main.player[Projectile.owner]; - NPC target = Main.npc[targetIndex]; + private void AttackMovement(int targetIndex) + { + Player player = Main.player[Projectile.owner]; + NPC target = Main.npc[targetIndex]; - Vector2 returnPos = Vector2.Zero; - Vector2 returnPos1 = target.Right + new Vector2(300f, 0f); - Vector2 returnPos2 = target.Left - new Vector2(300f, 0f); + Vector2 returnPos = Vector2.Zero; + Vector2 returnPos1 = target.Right + new Vector2(300f, 0f); + Vector2 returnPos2 = target.Left - new Vector2(300f, 0f); - // Swap sides after shooting a big bullet - returnPos = !leftSide ? returnPos1 : returnPos2; - if (player.Center.X - target.Center.X < 0) - returnPos = !leftSide ? returnPos2 : returnPos1; + // Swap sides after shooting a big bullet + returnPos = !leftSide ? returnPos1 : returnPos2; + if (player.Center.X - target.Center.X < 0) + returnPos = !leftSide ? returnPos2 : returnPos1; - // Target distance calculations - Vector2 targetVec = returnPos - Projectile.Center; - float targetDist = targetVec.Length(); + // Target distance calculations + Vector2 targetVec = returnPos - Projectile.Center; + float targetDist = targetVec.Length(); - float targetHomeSpeed = 60f; - // If more than 100 pixels away, move toward the target - if (targetDist > 100f) - { - targetVec.Normalize(); - targetVec *= targetHomeSpeed; - Projectile.velocity = (Projectile.velocity * 10f + targetVec) / 11f; + float targetHomeSpeed = 60f; + // If more than 100 pixels away, move toward the target + if (targetDist > 100f) + { + targetVec.Normalize(); + targetVec *= targetHomeSpeed; + Projectile.velocity = (Projectile.velocity * 10f + targetVec) / 11f; Projectile.spriteDirection = Projectile.direction = ((returnPos.X - Projectile.Center.X) > 0).ToDirectionInt(); - Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? MathHelper.ToRadians(-135f) : MathHelper.ToRadians(-45f)); - ShootCooldown = 40f; - } - else - { + Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? MathHelper.ToRadians(-135f) : MathHelper.ToRadians(-45f)); + ShootCooldown = 40f; + } + else + { Projectile.spriteDirection = Projectile.direction = ((target.Center.X - Projectile.Center.X) > 0).ToDirectionInt(); - float angle = Projectile.AngleTo(target.Center) + (Projectile.spriteDirection == 1 ? MathHelper.ToRadians(-135f) : MathHelper.ToRadians(-45f)); + float angle = Projectile.AngleTo(target.Center) + (Projectile.spriteDirection == 1 ? MathHelper.ToRadians(-135f) : MathHelper.ToRadians(-45f)); Projectile.rotation = (SpinCounter != 0f ? angle + SpinCounter : Projectile.rotation.AngleTowards(angle, 0.3f)); - Projectile.Center = returnPos + new Vector2(0f, ((float)Math.Sin(MathHelper.TwoPi * 0.5f + sineCounter / 50f) * 0.5f + 0.5f) * 40f); - } - drawTrail = true; - } + Projectile.Center = returnPos + new Vector2(0f, ((float)Math.Sin(MathHelper.TwoPi * 0.5f + sineCounter / 50f) * 0.5f + 0.5f) * 40f); + } + drawTrail = true; + } - private void IdleAI() - { - Player player = Main.player[Projectile.owner]; + private void IdleAI() + { + Player player = Main.player[Projectile.owner]; - Vector2 returnPos = player.Center + GetOffsetAngle.ToRotationVector2() * 180f; + Vector2 returnPos = player.Center + GetOffsetAngle.ToRotationVector2() * 180f; - // Player distance calculations - Vector2 playerVec = returnPos - Projectile.Center; - float playerDist = playerVec.Length(); + // Player distance calculations + Vector2 playerVec = returnPos - Projectile.Center; + float playerDist = playerVec.Length(); - float playerHomeSpeed = 40f; - // Teleport to the player if abnormally far - if (playerDist > 2000f) - { - Projectile.Center = returnPos; - Projectile.netUpdate = true; - } - // If more than 60 pixels away, move toward the player - if (playerDist > 60f) - { - playerVec.Normalize(); - playerVec *= playerHomeSpeed; - Projectile.velocity = (Projectile.velocity * 10f + playerVec) / 11f; - Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? MathHelper.ToRadians(-135f) : MathHelper.ToRadians(-45f)); - } - else - { - Projectile.spriteDirection = Projectile.direction = 0; - Projectile.rotation = GetOffsetAngle + MathHelper.PiOver4; - drawTrail = false; - Projectile.Center = returnPos; - } - SwapSides = 0f; - } + float playerHomeSpeed = 40f; + // Teleport to the player if abnormally far + if (playerDist > 2000f) + { + Projectile.Center = returnPos; + Projectile.netUpdate = true; + } + // If more than 60 pixels away, move toward the player + if (playerDist > 60f) + { + playerVec.Normalize(); + playerVec *= playerHomeSpeed; + Projectile.velocity = (Projectile.velocity * 10f + playerVec) / 11f; + Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? MathHelper.ToRadians(-135f) : MathHelper.ToRadians(-45f)); + } + else + { + Projectile.spriteDirection = Projectile.direction = 0; + Projectile.rotation = GetOffsetAngle + MathHelper.PiOver4; + drawTrail = false; + Projectile.Center = returnPos; + } + SwapSides = 0f; + } public override bool? CanDamage() => false; @@ -263,7 +263,7 @@ namespace CalamityMod.Projectiles.Summon.Umbrella for (int i = 0; i < 10; i++) { Vector2 dspeed = new Vector2(Main.rand.NextFloat(-7f, 7f), Main.rand.NextFloat(-7f, 7f)); - int dust = Dust.NewDust(Projectile.Center, 1, 1, 66, dspeed.X, dspeed.Y, 160, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 0.75f); + int dust = Dust.NewDust(Projectile.Center, 1, 1, DustID.RainbowTorch, dspeed.X, dspeed.Y, 160, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 0.75f); Main.dust[dust].noGravity = true; } } @@ -280,27 +280,27 @@ namespace CalamityMod.Projectiles.Summon.Umbrella public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; - Rectangle frame = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); - Vector2 origin = frame.Size() * 0.5f; - Vector2 drawPosition = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); - SpriteEffects direction = Projectile.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Rectangle frame = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); + Vector2 origin = frame.Size() * 0.5f; + Vector2 drawPosition = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); + SpriteEffects direction = Projectile.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - if (drawTrail) - { - // Draw the afterimage trail. - TrailDrawer ??= new(); - GameShaders.Misc["EmpressBlade"].UseShaderSpecificData(new Vector4(1f, 0f, 0f, 0.6f)); - GameShaders.Misc["EmpressBlade"].Apply(null); - TrailDrawer.PrepareStrip(Projectile.oldPos, Projectile.oldRot, TrailColorFunction, TrailWidthFunction, Projectile.Size * 0.5f - Main.screenPosition, Projectile.oldPos.Length, true); - TrailDrawer.DrawTrail(); - Main.pixelShader.CurrentTechnique.Passes[0].Apply(); + if (drawTrail) + { + // Draw the afterimage trail. + TrailDrawer ??= new(); + GameShaders.Misc["EmpressBlade"].UseShaderSpecificData(new Vector4(1f, 0f, 0f, 0.6f)); + GameShaders.Misc["EmpressBlade"].Apply(null); + TrailDrawer.PrepareStrip(Projectile.oldPos, Projectile.oldRot, TrailColorFunction, TrailWidthFunction, Projectile.Size * 0.5f - Main.screenPosition, Projectile.oldPos.Length, true); + TrailDrawer.DrawTrail(); + Main.pixelShader.CurrentTechnique.Passes[0].Apply(); - direction |= SpriteEffects.FlipVertically; - } + direction |= SpriteEffects.FlipVertically; + } // Draw the rifle. - Main.spriteBatch.Draw(texture, drawPosition, frame, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, direction, 0); + Main.spriteBatch.Draw(texture, drawPosition, frame, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, direction, 0); return false; } } diff --git a/Projectiles/Summon/Umbrella/MagicTree.cs b/Projectiles/Summon/Umbrella/MagicTree.cs index 107bac81d0..a02cfacb31 100644 --- a/Projectiles/Summon/Umbrella/MagicTree.cs +++ b/Projectiles/Summon/Umbrella/MagicTree.cs @@ -1,7 +1,7 @@ +using System; using CalamityMod.Gores.Trees; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -17,14 +17,14 @@ namespace CalamityMod.Projectiles.Summon.Umbrella private enum Tree { Astral, - Corruption, - Crimson, - Forest, - Hallow, - Jungle, - Ocean, - Snow, - SulphurousSea + Corruption, + Crimson, + Forest, + Hallow, + Jungle, + Ocean, + Snow, + SulphurousSea } public static readonly SoundStyle TreeCrashSound = new("CalamityMod/Sounds/Custom/TreeFalling"); @@ -51,121 +51,121 @@ namespace CalamityMod.Projectiles.Summon.Umbrella { Projectile.velocity.Y = 16f; } - if (Projectile.ai[1] == 0f) - { - Array values = Enum.GetValues(typeof(Tree)); - Random random = new Random(); - TreeType = (Tree)values.GetValue(random.Next(values.Length)); - Projectile.ai[1]++; - } + if (Projectile.ai[1] == 0f) + { + Array values = Enum.GetValues(typeof(Tree)); + Random random = new Random(); + TreeType = (Tree)values.GetValue(random.Next(values.Length)); + Projectile.ai[1]++; + } } public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(TreeCrashSound with { Volume = 0.5f }, Projectile.Center); + SoundEngine.PlaySound(TreeCrashSound with { Volume = 0.5f }, Projectile.Center); int creatureAmt = 3; for (int t = 0; t < creatureAmt; t++) { - int projType = Utils.SelectRandom(Main.rand, new int[] - { - ModContent.ProjectileType(), - ModContent.ProjectileType() - }); - Vector2 velocity = Vector2.Zero; - if (Main.projectile.IndexInRange((int)Projectile.ai[0])) - { - velocity = CalamityUtils.GetProjectilePhysicsFiringVelocity(Projectile.Center, Main.npc[(int)Projectile.ai[0]].Center, 0.28f, 12f); - velocity.X += Main.rand.NextFloat(-3f, 3f); - } - else - { - velocity.X = Main.rand.NextFloat(-10f, 10f); - velocity.Y = Main.rand.NextFloat(-15f, -8f); - } + int projType = Utils.SelectRandom(Main.rand, new int[] + { + ModContent.ProjectileType(), + ModContent.ProjectileType() + }); + Vector2 velocity = Vector2.Zero; + if (Main.projectile.IndexInRange((int)Projectile.ai[0])) + { + velocity = CalamityUtils.GetProjectilePhysicsFiringVelocity(Projectile.Center, Main.npc[(int)Projectile.ai[0]].Center, 0.28f, 12f); + velocity.X += Main.rand.NextFloat(-3f, 3f); + } + else + { + velocity.X = Main.rand.NextFloat(-10f, 10f); + velocity.Y = Main.rand.NextFloat(-15f, -8f); + } Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, projType, (int)(Projectile.damage * 0.05f), 0f, Projectile.owner); } - int treeGore = GoreID.TreeLeaf_Normal; - string TreeTop = "TreeForestTop"; - string TreeBottom = "TreeForestBottom"; + int treeGore = GoreID.TreeLeaf_Normal; + string TreeTop = "TreeForestTop"; + string TreeBottom = "TreeForestBottom"; switch (TreeType) { case Tree.Astral: treeGore = ModContent.GoreType(); - TreeTop = "TreeAstralTop"; - TreeBottom = "TreeAstralBottom"; + TreeTop = "TreeAstralTop"; + TreeBottom = "TreeAstralBottom"; break; case Tree.Corruption: treeGore = GoreID.TreeLeaf_Corruption; - TreeTop = "TreeCorruptionTop"; - TreeBottom = "TreeCorruptionBottom"; + TreeTop = "TreeCorruptionTop"; + TreeBottom = "TreeCorruptionBottom"; break; case Tree.Crimson: treeGore = GoreID.TreeLeaf_Crimson; - TreeTop = "TreeCrimsonTop"; - TreeBottom = "TreeCrimsonBottom"; + TreeTop = "TreeCrimsonTop"; + TreeBottom = "TreeCrimsonBottom"; break; case Tree.Forest: treeGore = GoreID.TreeLeaf_Normal; - TreeTop = "TreeForestTop"; - TreeBottom = "TreeForestBottom"; + TreeTop = "TreeForestTop"; + TreeBottom = "TreeForestBottom"; break; case Tree.Hallow: treeGore = GoreID.TreeLeaf_Hallow; - TreeTop = "TreeHallowTop"; - TreeBottom = "TreeHallowBottom"; + TreeTop = "TreeHallowTop"; + TreeBottom = "TreeHallowBottom"; break; case Tree.Jungle: treeGore = GoreID.TreeLeaf_Jungle; - TreeTop = "TreeJungleTop"; - TreeBottom = "TreeJungleBottom"; + TreeTop = "TreeJungleTop"; + TreeBottom = "TreeJungleBottom"; break; case Tree.Ocean: treeGore = GoreID.TreeLeaf_Palm; - TreeTop = "TreeOceanTop"; - TreeBottom = "TreeOceanBottom"; + TreeTop = "TreeOceanTop"; + TreeBottom = "TreeOceanBottom"; break; case Tree.Snow: treeGore = GoreID.TreeLeaf_Boreal; - TreeTop = "TreeSnowTop"; - TreeBottom = "TreeSnowBottom"; + TreeTop = "TreeSnowTop"; + TreeBottom = "TreeSnowBottom"; break; case Tree.SulphurousSea: treeGore = ModContent.GoreType(); - TreeTop = "TreeSulphurousSeaTop"; - TreeBottom = "TreeSulphurousSeaBottom"; + TreeTop = "TreeSulphurousSeaTop"; + TreeBottom = "TreeSulphurousSeaBottom"; break; default: break; } - if (Main.netMode != NetmodeID.Server) - { - for (int i = 0; i < 20; i++) - { - Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); - Vector2 spawnSource = Projectile.Center; - spawnSource.X += Main.rand.Next(-Projectile.width / 2, Projectile.width / 2 + 1); - spawnSource.Y += Main.rand.Next(-Projectile.height / 2, Projectile.height / 2 + 1); - int idx = Gore.NewGore(Projectile.GetSource_FromThis(), spawnSource, velocity, treeGore, 1f); - Main.gore[idx].velocity.X *= Main.rand.NextFloat(0.5f, 5f); - Main.gore[idx].velocity.Y *= Main.rand.NextFloat(0.5f, 5f); - Main.gore[idx].velocity.X += Main.rand.NextFloat(-5f, 5f); - Main.gore[idx].velocity.Y += Main.rand.NextFloat(-5f, 5f); - Main.gore[idx].scale *= Main.rand.NextFloat(0.8f, 1.2f); - } - Gore.NewGore(Projectile.GetSource_FromThis(), Projectile.Center, CalamityUtils.RandomVelocity(100f, 70f, 100f) * Main.rand.NextFloat(), Mod.Find(TreeTop).Type, Projectile.scale); - Gore.NewGore(Projectile.GetSource_FromThis(), Projectile.Center, CalamityUtils.RandomVelocity(100f, 70f, 100f) * Main.rand.NextFloat(), Mod.Find(TreeBottom).Type, Projectile.scale); + if (Main.netMode != NetmodeID.Server) + { + for (int i = 0; i < 20; i++) + { + Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); + Vector2 spawnSource = Projectile.Center; + spawnSource.X += Main.rand.Next(-Projectile.width / 2, Projectile.width / 2 + 1); + spawnSource.Y += Main.rand.Next(-Projectile.height / 2, Projectile.height / 2 + 1); + int idx = Gore.NewGore(Projectile.GetSource_FromThis(), spawnSource, velocity, treeGore, 1f); + Main.gore[idx].velocity.X *= Main.rand.NextFloat(0.5f, 5f); + Main.gore[idx].velocity.Y *= Main.rand.NextFloat(0.5f, 5f); + Main.gore[idx].velocity.X += Main.rand.NextFloat(-5f, 5f); + Main.gore[idx].velocity.Y += Main.rand.NextFloat(-5f, 5f); + Main.gore[idx].scale *= Main.rand.NextFloat(0.8f, 1.2f); + } + Gore.NewGore(Projectile.GetSource_FromThis(), Projectile.Center, CalamityUtils.RandomVelocity(100f, 70f, 100f) * Main.rand.NextFloat(), Mod.Find(TreeTop).Type, Projectile.scale); + Gore.NewGore(Projectile.GetSource_FromThis(), Projectile.Center, CalamityUtils.RandomVelocity(100f, 70f, 100f) * Main.rand.NextFloat(), Mod.Find(TreeBottom).Type, Projectile.scale); } } public override bool PreDraw(ref Color lightColor) { - if (Projectile.ai[1] == 0f) - return false; + if (Projectile.ai[1] == 0f) + return false; - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; switch (TreeType) { case Tree.Astral: @@ -199,13 +199,13 @@ namespace CalamityMod.Projectiles.Summon.Umbrella break; } - Rectangle frame = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); - Vector2 origin = frame.Size() * 0.5f; - Vector2 drawPosition = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); - SpriteEffects direction = Projectile.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + Rectangle frame = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); + Vector2 origin = frame.Size() * 0.5f; + Vector2 drawPosition = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); + SpriteEffects direction = Projectile.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; // Draw the tree. - Main.spriteBatch.Draw(texture, drawPosition, frame, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, direction, 0); + Main.spriteBatch.Draw(texture, drawPosition, frame, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, direction, 0); return false; } diff --git a/Projectiles/Summon/Umbrella/MagicUmbrella.cs b/Projectiles/Summon/Umbrella/MagicUmbrella.cs index 718cd70589..5dd12a0966 100644 --- a/Projectiles/Summon/Umbrella/MagicUmbrella.cs +++ b/Projectiles/Summon/Umbrella/MagicUmbrella.cs @@ -1,8 +1,8 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; +using System; using System.Collections.Generic; using System.IO; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Graphics; using Terraria.Graphics.Shaders; @@ -15,7 +15,7 @@ namespace CalamityMod.Projectiles.Summon.Umbrella { public new string LocalizationCategory => "Projectiles.Summon"; public float Behavior = 0f; - private const float drawOffset = -MathHelper.PiOver4 + MathHelper.Pi; + private const float drawOffset = -MathHelper.PiOver4 + MathHelper.Pi; public VertexStrip TrailDrawer; public float GetOffsetAngle @@ -27,13 +27,13 @@ namespace CalamityMod.Projectiles.Summon.Umbrella } public override void SetStaticDefaults() - { + { ProjectileID.Sets.TrailCacheLength[Projectile.type] = 40; ProjectileID.Sets.TrailingMode[Projectile.type] = 4; } public override void SetDefaults() - { + { Projectile.width = Projectile.height = 14; Projectile.netImportant = true; Projectile.friendly = true; @@ -57,269 +57,269 @@ namespace CalamityMod.Projectiles.Summon.Umbrella } public override void AI() - { + { Projectile.alpha -= 50; - // Set timeLeft if the player has the hat - if (Main.player[Projectile.owner].Calamity().magicHat) - { - Projectile.timeLeft = 2; - } + // Set timeLeft if the player has the hat + if (Main.player[Projectile.owner].Calamity().magicHat) + { + Projectile.timeLeft = 2; + } - // Not sure what this is for, a lot of the code is taken from Terraprisma - List blackListedTargets = new List {}; + // Not sure what this is for, a lot of the code is taken from Terraprisma + List blackListedTargets = new List { }; - DelegateMethods.v3_1 = Color.Transparent.ToVector3(); - Point point = Projectile.Center.ToTileCoordinates(); - DelegateMethods.CastLightOpen(point.X, point.Y); + DelegateMethods.v3_1 = Color.Transparent.ToVector3(); + Point point = Projectile.Center.ToTileCoordinates(); + DelegateMethods.CastLightOpen(point.X, point.Y); - blackListedTargets.Clear(); - DecideWhatToDo(blackListedTargets); + blackListedTargets.Clear(); + DecideWhatToDo(blackListedTargets); } - private void DecideWhatToDo(List blacklist) - { - int num = 40; - int num2 = num - 1; - int num3 = num + 40; - int num4 = num3 - 1; - int num5 = num + 1; + private void DecideWhatToDo(List blacklist) + { + int num = 40; + int num2 = num - 1; + int num3 = num + 40; + int num4 = num3 - 1; + int num5 = num + 1; - Player player = Main.player[Projectile.owner]; + Player player = Main.player[Projectile.owner]; - // Idle AI when too far away from the player - if (player.active && Vector2.Distance(player.Center, Projectile.Center) > 2000f) - { - Behavior = 0f; - Projectile.ai[1] = 0f; - Projectile.netUpdate = true; - } + // Idle AI when too far away from the player + if (player.active && Vector2.Distance(player.Center, Projectile.Center) > 2000f) + { + Behavior = 0f; + Projectile.ai[1] = 0f; + Projectile.netUpdate = true; + } - // Idle AI when Behavior is -1 - if (Behavior == -1f) - { - IdleAI(); - return; - } + // Idle AI when Behavior is -1 + if (Behavior == -1f) + { + IdleAI(); + return; + } - // Idle AI when Behavior is 0 - if (Behavior == 0f) - { - IdleAI(); - // Look for a target - int targetIdx = FindATarget(blacklist); - if (targetIdx != -1) - { - Behavior = Main.rand.NextFromList(num, num3); - Behavior = num3; - Projectile.ai[1] = targetIdx; - Projectile.netUpdate = true; - } - return; - } + // Idle AI when Behavior is 0 + if (Behavior == 0f) + { + IdleAI(); + // Look for a target + int targetIdx = FindATarget(blacklist); + if (targetIdx != -1) + { + Behavior = Main.rand.NextFromList(num, num3); + Behavior = num3; + Projectile.ai[1] = targetIdx; + Projectile.netUpdate = true; + } + return; + } - int num13 = 0; - int num14 = num2; - int num15 = 0; - if (Behavior >= (float)num5) - { - num13 = 1; - num14 = num4; - num15 = num5; - } + int num13 = 0; + int num14 = num2; + int num15 = 0; + if (Behavior >= (float)num5) + { + num13 = 1; + num14 = num4; + num15 = num5; + } - int currentTarget = (int)Projectile.ai[1]; - if (!Main.npc.IndexInRange(currentTarget)) - { - int targetIdx = FindATarget(blacklist); - if (targetIdx != -1) - { - Behavior = Main.rand.NextFromList(num, num3); - Projectile.ai[1] = targetIdx; - Projectile.netUpdate = true; - } - else - { - Behavior = -1f; - Projectile.ai[1] = 0f; - Projectile.netUpdate = true; - } + int currentTarget = (int)Projectile.ai[1]; + if (!Main.npc.IndexInRange(currentTarget)) + { + int targetIdx = FindATarget(blacklist); + if (targetIdx != -1) + { + Behavior = Main.rand.NextFromList(num, num3); + Projectile.ai[1] = targetIdx; + Projectile.netUpdate = true; + } + else + { + Behavior = -1f; + Projectile.ai[1] = 0f; + Projectile.netUpdate = true; + } - return; - } + return; + } - NPC npc = Main.npc[currentTarget]; - if (!npc.CanBeChasedBy(this)) - { - int targetIdx = FindATarget(blacklist); - if (targetIdx != -1) - { - Behavior = Main.rand.NextFromList(num, num3); - Projectile.ai[1] = targetIdx; - Projectile.netUpdate = true; - } - else - { - Behavior = -1f; - Projectile.ai[1] = 0f; - Projectile.netUpdate = true; - } + NPC npc = Main.npc[currentTarget]; + if (!npc.CanBeChasedBy(this)) + { + int targetIdx = FindATarget(blacklist); + if (targetIdx != -1) + { + Behavior = Main.rand.NextFromList(num, num3); + Projectile.ai[1] = targetIdx; + Projectile.netUpdate = true; + } + else + { + Behavior = -1f; + Projectile.ai[1] = 0f; + Projectile.netUpdate = true; + } - return; - } + return; + } - Behavior -= 1f; - if (Behavior >= (float)num14) - { - Projectile.direction = ((Projectile.Center.X < npc.Center.X) ? 1 : (-1)); - if (Behavior == (float)num14) - { - Projectile.localAI[0] = Projectile.Center.X; - Projectile.localAI[1] = Projectile.Center.Y; - } - } + Behavior -= 1f; + if (Behavior >= (float)num14) + { + Projectile.direction = ((Projectile.Center.X < npc.Center.X) ? 1 : (-1)); + if (Behavior == (float)num14) + { + Projectile.localAI[0] = Projectile.Center.X; + Projectile.localAI[1] = Projectile.Center.Y; + } + } - float lerpValue2 = Utils.GetLerpValue(num14, num15, Behavior, clamped: true); - if (num13 == 0) - { - Vector2 vector6 = new Vector2(Projectile.localAI[0], Projectile.localAI[1]); - if (lerpValue2 >= 0.5f) - vector6 = Vector2.Lerp(npc.Center, Main.player[Projectile.owner].Center, 0.5f); + float lerpValue2 = Utils.GetLerpValue(num14, num15, Behavior, clamped: true); + if (num13 == 0) + { + Vector2 vector6 = new Vector2(Projectile.localAI[0], Projectile.localAI[1]); + if (lerpValue2 >= 0.5f) + vector6 = Vector2.Lerp(npc.Center, Main.player[Projectile.owner].Center, 0.5f); - Vector2 center2 = npc.Center; - float num19 = (center2 - vector6).ToRotation(); - float num20 = (Projectile.direction == 1) ? (-(float)Math.PI) : ((float)Math.PI); - float num21 = num20 + (0f - num20) * lerpValue2 * 2f; - Vector2 vector7 = num21.ToRotationVector2(); - vector7.Y *= 0.5f; - vector7.Y *= 0.8f + (float)Math.Sin((float)Projectile.identity * 2.3f) * 0.2f; - vector7 = vector7.RotatedBy(num19); - float scaleFactor2 = (center2 - vector6).Length() / 2f; - Vector2 vector9 = Projectile.Center = Vector2.Lerp(vector6, center2, 0.5f) + vector7 * scaleFactor2; - float num22 = MathHelper.WrapAngle(num19 + num21); - Projectile.rotation = num22 + drawOffset; - Vector2 vector10 = Projectile.velocity = num22.ToRotationVector2() * 10f; - Projectile.position -= Projectile.velocity; - } + Vector2 center2 = npc.Center; + float num19 = (center2 - vector6).ToRotation(); + float num20 = (Projectile.direction == 1) ? (-(float)Math.PI) : ((float)Math.PI); + float num21 = num20 + (0f - num20) * lerpValue2 * 2f; + Vector2 vector7 = num21.ToRotationVector2(); + vector7.Y *= 0.5f; + vector7.Y *= 0.8f + (float)Math.Sin((float)Projectile.identity * 2.3f) * 0.2f; + vector7 = vector7.RotatedBy(num19); + float scaleFactor2 = (center2 - vector6).Length() / 2f; + Vector2 vector9 = Projectile.Center = Vector2.Lerp(vector6, center2, 0.5f) + vector7 * scaleFactor2; + float num22 = MathHelper.WrapAngle(num19 + num21); + Projectile.rotation = num22 + drawOffset; + Vector2 vector10 = Projectile.velocity = num22.ToRotationVector2() * 10f; + Projectile.position -= Projectile.velocity; + } - if (num13 == 1) - { - Vector2 vector11 = new Vector2(Projectile.localAI[0], Projectile.localAI[1]); - vector11 += new Vector2(0f, Utils.GetLerpValue(0f, 0.4f, lerpValue2, clamped: true) * -100f); - Vector2 v = npc.Center - vector11; - Vector2 value = v.SafeNormalize(Vector2.Zero) * MathHelper.Clamp(v.Length(), 60f, 150f); - Vector2 value2 = npc.Center + value; - float lerpValue3 = Utils.GetLerpValue(0.4f, 0.6f, lerpValue2, clamped: true); - float lerpValue4 = Utils.GetLerpValue(0.6f, 1f, lerpValue2, clamped: true); - float targetAngle = v.SafeNormalize(Vector2.Zero).ToRotation() + drawOffset; - Projectile.rotation = Projectile.rotation.AngleTowards(targetAngle, (float)Math.PI / 5f + drawOffset); - Projectile.Center = Vector2.Lerp(vector11, npc.Center, lerpValue3); - if (lerpValue4 > 0f) - Projectile.Center = Vector2.Lerp(npc.Center, value2, lerpValue4); - } + if (num13 == 1) + { + Vector2 vector11 = new Vector2(Projectile.localAI[0], Projectile.localAI[1]); + vector11 += new Vector2(0f, Utils.GetLerpValue(0f, 0.4f, lerpValue2, clamped: true) * -100f); + Vector2 v = npc.Center - vector11; + Vector2 value = v.SafeNormalize(Vector2.Zero) * MathHelper.Clamp(v.Length(), 60f, 150f); + Vector2 value2 = npc.Center + value; + float lerpValue3 = Utils.GetLerpValue(0.4f, 0.6f, lerpValue2, clamped: true); + float lerpValue4 = Utils.GetLerpValue(0.6f, 1f, lerpValue2, clamped: true); + float targetAngle = v.SafeNormalize(Vector2.Zero).ToRotation() + drawOffset; + Projectile.rotation = Projectile.rotation.AngleTowards(targetAngle, (float)Math.PI / 5f + drawOffset); + Projectile.Center = Vector2.Lerp(vector11, npc.Center, lerpValue3); + if (lerpValue4 > 0f) + Projectile.Center = Vector2.Lerp(npc.Center, value2, lerpValue4); + } - if (Behavior == (float)num15) - { - int targetIdx = FindATarget(blacklist); - if (targetIdx != -1) - { - Behavior = Main.rand.NextFromList(num, num3); - Projectile.ai[1] = targetIdx; - Projectile.netUpdate = true; - } - else - { - Behavior = -1f; - Projectile.ai[1] = 0f; - Projectile.netUpdate = true; - } - } - } + if (Behavior == (float)num15) + { + int targetIdx = FindATarget(blacklist); + if (targetIdx != -1) + { + Behavior = Main.rand.NextFromList(num, num3); + Projectile.ai[1] = targetIdx; + Projectile.netUpdate = true; + } + else + { + Behavior = -1f; + Projectile.ai[1] = 0f; + Projectile.netUpdate = true; + } + } + } - private int FindATarget(List blackListedTargets) - { - Vector2 center = Main.player[Projectile.owner].Center; - int target = -1; - float closestDist = -1f; - NPC selectedTarget = Projectile.OwnerMinionAttackTargetNPC; - if (selectedTarget != null && selectedTarget.CanBeChasedBy(this)) - { - bool flag = true; - if (!selectedTarget.boss && blackListedTargets.Contains(selectedTarget.whoAmI)) - flag = false; + private int FindATarget(List blackListedTargets) + { + Vector2 center = Main.player[Projectile.owner].Center; + int target = -1; + float closestDist = -1f; + NPC selectedTarget = Projectile.OwnerMinionAttackTargetNPC; + if (selectedTarget != null && selectedTarget.CanBeChasedBy(this)) + { + bool flag = true; + if (!selectedTarget.boss && blackListedTargets.Contains(selectedTarget.whoAmI)) + flag = false; - if (selectedTarget.Distance(center) > MagicHat.Range) - flag = false; + if (selectedTarget.Distance(center) > MagicHat.Range) + flag = false; - if (flag) - return selectedTarget.whoAmI; - } + if (flag) + return selectedTarget.whoAmI; + } - for (int i = 0; i < Main.maxNPCs; i++) - { - NPC npc = Main.npc[i]; - if (npc.CanBeChasedBy(this) && (npc.boss || !blackListedTargets.Contains(i))) - { - float npcDist = npc.Distance(center); - if (npcDist <= MagicHat.Range && (npcDist <= closestDist || closestDist == -1f)) - { - closestDist = npcDist; - target = i; - } - } - } + for (int i = 0; i < Main.maxNPCs; i++) + { + NPC npc = Main.npc[i]; + if (npc.CanBeChasedBy(this) && (npc.boss || !blackListedTargets.Contains(i))) + { + float npcDist = npc.Distance(center); + if (npcDist <= MagicHat.Range && (npcDist <= closestDist || closestDist == -1f)) + { + closestDist = npcDist; + target = i; + } + } + } - return target; - } + return target; + } - private void IdleAI() - { - Player player = Main.player[Projectile.owner]; + private void IdleAI() + { + Player player = Main.player[Projectile.owner]; - Vector2 returnPos = player.Center + GetOffsetAngle.ToRotationVector2() * 180f; + Vector2 returnPos = player.Center + GetOffsetAngle.ToRotationVector2() * 180f; - bool returningToPlayer = Behavior == -1f; + bool returningToPlayer = Behavior == -1f; - // Player distance calculations - Vector2 playerVec = returnPos - Projectile.Center; - float playerDist = playerVec.Length(); + // Player distance calculations + Vector2 playerVec = returnPos - Projectile.Center; + float playerDist = playerVec.Length(); - float playerHomeSpeed = 40f; - //Return to normal if close enough to the player - if (playerDist < 150f && returningToPlayer && !Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height)) - { - Behavior = 0f; - Projectile.netUpdate = true; - } - // Teleport to the player if abnormally far - if (playerDist > 2000f) - { - Projectile.Center = returnPos; - Projectile.netUpdate = true; - } - // If more than 60 pixels away, move toward the player - if (playerDist > 60f) - { - playerVec.Normalize(); - playerVec *= playerHomeSpeed; - Projectile.velocity = (Projectile.velocity * 10f + playerVec) / 11f; - Projectile.rotation = Projectile.velocity.ToRotation() + drawOffset; - } - else - { - Projectile.Center = returnPos; - Projectile.rotation = GetOffsetAngle + drawOffset; - } - } + float playerHomeSpeed = 40f; + //Return to normal if close enough to the player + if (playerDist < 150f && returningToPlayer && !Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height)) + { + Behavior = 0f; + Projectile.netUpdate = true; + } + // Teleport to the player if abnormally far + if (playerDist > 2000f) + { + Projectile.Center = returnPos; + Projectile.netUpdate = true; + } + // If more than 60 pixels away, move toward the player + if (playerDist > 60f) + { + playerVec.Normalize(); + playerVec *= playerHomeSpeed; + Projectile.velocity = (Projectile.velocity * 10f + playerVec) / 11f; + Projectile.rotation = Projectile.velocity.ToRotation() + drawOffset; + } + else + { + Projectile.Center = returnPos; + Projectile.rotation = GetOffsetAngle + drawOffset; + } + } public override Color? GetAlpha(Color lightColor) => new Color(255, 255, 255, Projectile.alpha); public override void OnKill(int timeLeft) - { + { for (int i = 0; i < 10; i++) - { + { Vector2 dspeed = new Vector2(Main.rand.NextFloat(-7f, 7f), Main.rand.NextFloat(-7f, 7f)); - int dust = Dust.NewDust(Projectile.Center, 1, 1, 66, dspeed.X, dspeed.Y, 160, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 0.75f); + int dust = Dust.NewDust(Projectile.Center, 1, 1, DustID.RainbowTorch, dspeed.X, dspeed.Y, 160, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 0.75f); Main.dust[dust].noGravity = true; } } @@ -334,26 +334,26 @@ namespace CalamityMod.Projectiles.Summon.Umbrella public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Rectangle frame = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); Vector2 origin = frame.Size() * 0.5f; Vector2 drawPosition = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); SpriteEffects direction = Projectile.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - bool shouldDrawTrail = Behavior > 0f; - if (shouldDrawTrail) - { - // Draw the afterimage trail. - TrailDrawer ??= new(); - GameShaders.Misc["EmpressBlade"].UseShaderSpecificData(new Vector4(1f, 0f, 0f, 0.6f)); - GameShaders.Misc["EmpressBlade"].Apply(null); - TrailDrawer.PrepareStrip(Projectile.oldPos, Projectile.oldRot, TrailColorFunction, TrailWidthFunction, Projectile.Size * 0.5f - Main.screenPosition, Projectile.oldPos.Length, true); - TrailDrawer.DrawTrail(); - Main.pixelShader.CurrentTechnique.Passes[0].Apply(); - } + bool shouldDrawTrail = Behavior > 0f; + if (shouldDrawTrail) + { + // Draw the afterimage trail. + TrailDrawer ??= new(); + GameShaders.Misc["EmpressBlade"].UseShaderSpecificData(new Vector4(1f, 0f, 0f, 0.6f)); + GameShaders.Misc["EmpressBlade"].Apply(null); + TrailDrawer.PrepareStrip(Projectile.oldPos, Projectile.oldRot, TrailColorFunction, TrailWidthFunction, Projectile.Size * 0.5f - Main.screenPosition, Projectile.oldPos.Length, true); + TrailDrawer.DrawTrail(); + Main.pixelShader.CurrentTechnique.Passes[0].Apply(); + } // Draw the umbrella. - Main.spriteBatch.Draw(texture, drawPosition, frame, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, direction, 0); + Main.spriteBatch.Draw(texture, drawPosition, frame, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, direction, 0); return false; } } diff --git a/Projectiles/Summon/UniverseSplitterField.cs b/Projectiles/Summon/UniverseSplitterField.cs index e7e56dfec2..f9a4cf3856 100644 --- a/Projectiles/Summon/UniverseSplitterField.cs +++ b/Projectiles/Summon/UniverseSplitterField.cs @@ -1,11 +1,11 @@ -using Microsoft.Xna.Framework; -using System; +using System; using System.IO; +using CalamityMod.Sounds; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using CalamityMod.Sounds; namespace CalamityMod.Projectiles.Summon { @@ -131,7 +131,7 @@ namespace CalamityMod.Projectiles.Summon if (Main.myPlayer == Projectile.owner) { Vector2 offset = new(Main.rand.NextFloat(-800f, 800f), -1460f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center + offset, -Vector2.Normalize(offset), ModContent.ProjectileType(), @@ -145,7 +145,7 @@ namespace CalamityMod.Projectiles.Summon if (Timer == TimeLeft - UniverseSplitterHugeBeam.TimeLeft && Main.myPlayer == Projectile.owner) { SoundEngine.PlaySound(SoundID.Zombie104, Projectile.Center); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center + Vector2.UnitY * -UniverseSplitterHugeBeam.MaximumLength / 2f, Vector2.UnitY, ModContent.ProjectileType(), diff --git a/Projectiles/Summon/UniverseSplitterHugeBeam.cs b/Projectiles/Summon/UniverseSplitterHugeBeam.cs index c01835ab41..ee2d47c20a 100644 --- a/Projectiles/Summon/UniverseSplitterHugeBeam.cs +++ b/Projectiles/Summon/UniverseSplitterHugeBeam.cs @@ -1,15 +1,15 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System.IO; -using Terraria; -using Terraria.ID; -using Terraria.Enums; -using Terraria.ModLoader; +using System.IO; using CalamityMod.Buffs.DamageOverTime; -using Terraria.GameContent.Events; -using Terraria.Audio; -using ReLogic.Content; using CalamityMod.Items.Weapons.DraedonsArsenal; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.Audio; +using Terraria.Enums; +using Terraria.GameContent.Events; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Summon { diff --git a/Projectiles/Summon/UniverseSplitterSmallBeam.cs b/Projectiles/Summon/UniverseSplitterSmallBeam.cs index f128724981..16edc6ca77 100644 --- a/Projectiles/Summon/UniverseSplitterSmallBeam.cs +++ b/Projectiles/Summon/UniverseSplitterSmallBeam.cs @@ -1,12 +1,12 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; +using System; using System.IO; -using Terraria; -using Terraria.ID; -using Terraria.Enums; -using Terraria.ModLoader; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; +using Terraria; +using Terraria.Enums; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Summon { diff --git a/Projectiles/Summon/Valkyrie.cs b/Projectiles/Summon/Valkyrie.cs index a26695514e..82120f71b2 100644 --- a/Projectiles/Summon/Valkyrie.cs +++ b/Projectiles/Summon/Valkyrie.cs @@ -1,7 +1,7 @@ -using CalamityMod.CalPlayer; +using System; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -61,7 +61,7 @@ namespace CalamityMod.Projectiles.Summon { for (int i = 0; i < 30; i++) { - int spawnDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y + 16f), Projectile.width, Projectile.height - 16, 59, 0f, 0f, 0, default, 1f); + int spawnDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y + 16f), Projectile.width, Projectile.height - 16, DustID.BlueTorch, 0f, 0f, 0, default, 1f); Main.dust[spawnDust].velocity *= 2f; Main.dust[spawnDust].scale *= 1.15f; } @@ -97,8 +97,8 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { SpriteEffects spriteEffects = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Texture2D texture2D13 = ModContent.Request(Texture).Value; - int framing = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; + Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + int framing = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; int y6 = framing * Projectile.frame; Main.EntitySpriteDraw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)framing / 2f), Projectile.scale, spriteEffects, 0); return false; diff --git a/Projectiles/Summon/VictideSeaSnail.cs b/Projectiles/Summon/VictideSeaSnail.cs index 235ee2837f..2d90f53ec7 100644 --- a/Projectiles/Summon/VictideSeaSnail.cs +++ b/Projectiles/Summon/VictideSeaSnail.cs @@ -1,11 +1,11 @@ -using CalamityMod.CalPlayer; +using System; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using System; -using Microsoft.Xna.Framework.Graphics; namespace CalamityMod.Projectiles.Summon { @@ -52,7 +52,7 @@ namespace CalamityMod.Projectiles.Summon { for (int d = 0; d < 45; d++) { - Dust dust = Dust.NewDustDirect(new Vector2(Projectile.position.X, Projectile.position.Y + 16f), Projectile.width, Projectile.height - 16, 179, 0f, 0f, 0, default, 1f); + Dust dust = Dust.NewDustDirect(new Vector2(Projectile.position.X, Projectile.position.Y + 16f), Projectile.width, Projectile.height - 16, DustID.BubbleBurst_Purple, 0f, 0f, 0, default, 1f); dust.velocity *= 2f; dust.scale *= 1.15f; } @@ -73,7 +73,7 @@ namespace CalamityMod.Projectiles.Summon int dustAmount = Main.rand.Next(40, 50); for (int d = 0; d < dustAmount; d++) { - Dust dust = Dust.NewDustDirect(new Vector2(Projectile.position.X, Projectile.position.Y + 16f), Projectile.width, Projectile.height - 16, 179, 0f, 0f, 0, default, 1f); + Dust dust = Dust.NewDustDirect(new Vector2(Projectile.position.X, Projectile.position.Y + 16f), Projectile.width, Projectile.height - 16, DustID.BubbleBurst_Purple, 0f, 0f, 0, default, 1f); dust.velocity *= 2f; dust.scale *= 1.15f; } @@ -83,7 +83,7 @@ namespace CalamityMod.Projectiles.Summon { PlayerStandStillTimer++; //pop out the shell - if (PlayerStandStillTimer == timeToStandStillBeforePeekOut ) + if (PlayerStandStillTimer == timeToStandStillBeforePeekOut) { DustTimer = 0; float direction = Main.rand.NextBool() ? 1f : -1f; @@ -148,7 +148,7 @@ namespace CalamityMod.Projectiles.Summon { if (FireCooldown > 0f) { - FireCooldown --; + FireCooldown--; return; } @@ -197,7 +197,7 @@ namespace CalamityMod.Projectiles.Summon { for (int d = 0; d < 45; d++) { - Dust dust = Dust.NewDustDirect(new Vector2(Projectile.position.X, Projectile.position.Y + 16f), Projectile.width, Projectile.height - 16, 179, 0f, 0f, 0, default, 1f); + Dust dust = Dust.NewDustDirect(new Vector2(Projectile.position.X, Projectile.position.Y + 16f), Projectile.width, Projectile.height - 16, DustID.BubbleBurst_Purple, 0f, 0f, 0, default, 1f); dust.velocity *= 2f; dust.scale *= 1.15f; } @@ -217,7 +217,7 @@ namespace CalamityMod.Projectiles.Summon { Player owner = Main.player[Projectile.owner]; - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Rectangle frame = new Rectangle(0, 36 * Projectile.frame, 38, 34); Vector2 origin = !CanComePeekOut ? new Vector2(15, 23) : frame.Size() / 2f; diff --git a/Projectiles/Summon/VileFeederProjectile.cs b/Projectiles/Summon/VileFeederProjectile.cs index bc93e881e2..83e73f76d5 100644 --- a/Projectiles/Summon/VileFeederProjectile.cs +++ b/Projectiles/Summon/VileFeederProjectile.cs @@ -1,5 +1,5 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -63,7 +63,7 @@ namespace CalamityMod.Projectiles.Summon dust.velocity *= 0f; dust.scale = 0.5f; } - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) - MathHelper.PiOver2; + Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; float projX = Projectile.position.X; float projY = Projectile.position.Y; float attackDistance = 100000f; @@ -116,7 +116,7 @@ namespace CalamityMod.Projectiles.Summon } float projSpeed = 10f; float XSpeedMod = 0.16f; - Vector2 fireDirection = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); + Vector2 fireDirection = Projectile.Center; float fireXVel = projX - fireDirection.X; float fireYVel = projY - fireDirection.Y; float fireVelocity = (float)Math.Sqrt((double)(fireXVel * fireXVel + fireYVel * fireYVel)); diff --git a/Projectiles/Summon/VileFeederSummon.cs b/Projectiles/Summon/VileFeederSummon.cs index 92b93bf355..e3ee0abc14 100644 --- a/Projectiles/Summon/VileFeederSummon.cs +++ b/Projectiles/Summon/VileFeederSummon.cs @@ -17,14 +17,14 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 4; + Main.projFrames[Projectile.type] = 3; ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - Projectile.width = Projectile.height = 30; + Projectile.width = Projectile.height = 32; Projectile.netImportant = true; Projectile.friendly = true; Projectile.ignoreWater = true; @@ -63,7 +63,7 @@ namespace CalamityMod.Projectiles.Summon Vector2 source = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; source = source.RotatedBy((double)((float)(d - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + Projectile.Center; Vector2 dustVel = source - Projectile.Center; - int dusty = Dust.NewDust(source + dustVel, 0, 0, 7, dustVel.X * 1.75f, dustVel.Y * 1.75f, 100, default, 1.1f); + int dusty = Dust.NewDust(source + dustVel, 0, 0, DustID.WoodFurniture, dustVel.X * 1.75f, dustVel.Y * 1.75f, 100, default, 1.1f); Main.dust[dusty].noGravity = true; Main.dust[dusty].velocity = dustVel; } @@ -93,12 +93,12 @@ namespace CalamityMod.Projectiles.Summon eaterCooldown--; Projectile.ChargingMinionAI(640f, 1100f, 2400f, 150f, 0, 40f, 8f, 4f, new Vector2(0f, -60f), 40f, 8f, false, false); Projectile.frameCounter++; - if (Projectile.frameCounter > 3) + if (Projectile.frameCounter > 4) { Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame >= 4) + if (Projectile.frame >= 3) { Projectile.frame = 0; } @@ -146,11 +146,11 @@ namespace CalamityMod.Projectiles.Summon if (Projectile.owner == Main.myPlayer) { if (eaterCooldown > 0) - eaterCooldown -= Main.rand.Next(1,3); + eaterCooldown -= Main.rand.Next(1, 3); if (eaterCooldown <= 0) { - int projNumber = Main.rand.Next(1,3); + int projNumber = Main.rand.Next(1, 3); for (int index2 = 0; index2 < projNumber; index2++) { float xVector = (float)Main.rand.Next(-35, 36) * 0.02f; @@ -261,7 +261,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; int framing = texture.Height / Main.projFrames[Projectile.type]; int y6 = framing * Projectile.frame; Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture.Width / 2f, (float)framing / 2f), Projectile.scale, SpriteEffects.None, 0); diff --git a/Projectiles/Summon/VileFeederSummon.png b/Projectiles/Summon/VileFeederSummon.png index e036795029..60e3a27d98 100644 Binary files a/Projectiles/Summon/VileFeederSummon.png and b/Projectiles/Summon/VileFeederSummon.png differ diff --git a/Projectiles/Summon/ViridVanguardBlade.cs b/Projectiles/Summon/ViridVanguardBlade.cs index a1b268d00e..260d3e8e78 100644 --- a/Projectiles/Summon/ViridVanguardBlade.cs +++ b/Projectiles/Summon/ViridVanguardBlade.cs @@ -330,7 +330,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.netUpdate = true; } } - + public void ReturnToIdleState() { AITimer = 0f; @@ -361,7 +361,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Rectangle frame = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); Vector2 origin = frame.Size() * 0.5f; Vector2 drawPosition = Projectile.Center - Main.screenPosition; diff --git a/Projectiles/Summon/VoidConcentrationAura.cs b/Projectiles/Summon/VoidConcentrationAura.cs index 42fe9936b2..371dc5272b 100644 --- a/Projectiles/Summon/VoidConcentrationAura.cs +++ b/Projectiles/Summon/VoidConcentrationAura.cs @@ -1,6 +1,6 @@ -using CalamityMod.CalPlayer; +using System.IO; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; -using System.IO; using Terraria; using Terraria.ModLoader; diff --git a/Projectiles/Summon/VoidConcentrationBlackhole.cs b/Projectiles/Summon/VoidConcentrationBlackhole.cs index 058c45b90f..6e0fc0f7d6 100644 --- a/Projectiles/Summon/VoidConcentrationBlackhole.cs +++ b/Projectiles/Summon/VoidConcentrationBlackhole.cs @@ -55,7 +55,7 @@ namespace CalamityMod.Projectiles.Summon velocity *= 2f; velocity.SafeNormalize(Vector2.Zero); float projSpeed = 5f * Projectile.scale; - Vector2 fireDirection = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + Vector2 fireDirection = npc.Center; float fireXVel = Projectile.Center.X - fireDirection.X; float fireYVel = Projectile.Center.Y - fireDirection.Y; float fireVelocity = (float)Math.Sqrt((double)(fireXVel * fireXVel + fireYVel * fireYVel)); @@ -94,7 +94,7 @@ namespace CalamityMod.Projectiles.Summon { for (int d = 0; d < 6; d++) { - int shadow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 27, 0f, 0f, 100, new Color(0, 0, 0), 4f); + int shadow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Shadowflame, 0f, 0f, 100, new Color(0, 0, 0), 4f); Main.dust[shadow].velocity *= 3f; if (Main.rand.NextBool()) { @@ -104,10 +104,10 @@ namespace CalamityMod.Projectiles.Summon } for (int d = 0; d < 18; d++) { - int shadow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 27, 0f, 0f, 100, new Color(0, 0, 0), 4f); + int shadow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Shadowflame, 0f, 0f, 100, new Color(0, 0, 0), 4f); Main.dust[shadow].noGravity = true; Main.dust[shadow].velocity *= 5f; - shadow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 27, 0f, 0f, 100, new Color(0, 0, 0), 3f); + shadow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Shadowflame, 0f, 0f, 100, new Color(0, 0, 0), 3f); Main.dust[shadow].velocity *= 2f; } } @@ -125,7 +125,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Vector2 drawPos = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); int height = texture.Height / Main.projFrames[Projectile.type]; int frameHeight = height * Projectile.frame; @@ -166,14 +166,14 @@ namespace CalamityMod.Projectiles.Summon } Projectile.frameCounter++; - for (int i = 0; i < Main.npc.Length; i++) + for (int i = 0; i < Main.npc.Length; i++) + { + if (Main.npc[i].active && !Main.npc[i].friendly && CalamityGlobalNPC.ShouldAffectNPC(Main.npc[i])) { - if (Main.npc[i].active && !Main.npc[i].friendly && CalamityGlobalNPC.ShouldAffectNPC(Main.npc[i])) - { - if (Vector2.Distance(Projectile.Center, Main.npc[i].Center) <= radius) - ApplySucc(Main.npc[i]); - } + if (Vector2.Distance(Projectile.Center, Main.npc[i].Center) <= radius) + ApplySucc(Main.npc[i]); } + } if (Projectile.scale >= 2.5f) //it's boom o' clock diff --git a/Projectiles/Summon/VoidConcentrationOrb.cs b/Projectiles/Summon/VoidConcentrationOrb.cs index 6d0e1a5a03..f1f31a7547 100644 --- a/Projectiles/Summon/VoidConcentrationOrb.cs +++ b/Projectiles/Summon/VoidConcentrationOrb.cs @@ -1,5 +1,5 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Summon { for (int d = 0; d < 6; d++) { - int shadow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 27, 0f, 0f, 100, new Color(0, 0, 0), 2f); + int shadow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Shadowflame, 0f, 0f, 100, new Color(0, 0, 0), 2f); Main.dust[shadow].velocity *= 3f; if (Main.rand.NextBool()) { @@ -52,10 +52,10 @@ namespace CalamityMod.Projectiles.Summon } for (int d = 0; d < 10; d++) { - int shadow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 27, 0f, 0f, 100, new Color(0, 0, 0), 3f); + int shadow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Shadowflame, 0f, 0f, 100, new Color(0, 0, 0), 3f); Main.dust[shadow].noGravity = true; Main.dust[shadow].velocity *= 5f; - shadow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 27, 0f, 0f, 100, new Color(0, 0, 0), 2f); + shadow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Shadowflame, 0f, 0f, 100, new Color(0, 0, 0), 2f); Main.dust[shadow].velocity *= 2f; } } @@ -70,7 +70,7 @@ namespace CalamityMod.Projectiles.Summon if (target != null) { float projSpeed = 40f; - Vector2 fireDirection = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); + Vector2 fireDirection = Projectile.Center; float fireXVel = target.Center.X - fireDirection.X; float fireYVel = target.Center.Y - fireDirection.Y; float fireVelocity = (float)Math.Sqrt((double)(fireXVel * fireXVel + fireYVel * fireYVel)); diff --git a/Projectiles/Summon/WaterElementalMinion.cs b/Projectiles/Summon/WaterElementalMinion.cs index 1e3faffa33..5acfa868b6 100644 --- a/Projectiles/Summon/WaterElementalMinion.cs +++ b/Projectiles/Summon/WaterElementalMinion.cs @@ -1,6 +1,6 @@ -using CalamityMod.CalPlayer; +using System; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Summon { for (int i = 0; i < 50; i++) { - int spawnDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y + 16f), Projectile.width, Projectile.height - 16, 33, 0f, 0f, 0, default, 1f); + int spawnDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y + 16f), Projectile.width, Projectile.height - 16, DustID.Water, 0f, 0f, 0, default, 1f); Main.dust[spawnDust].velocity *= 2f; Main.dust[spawnDust].scale *= 1.15f; } @@ -166,7 +166,7 @@ namespace CalamityMod.Projectiles.Summon projectileType = ModContent.ProjectileType(); } float projVel = Main.rand.Next(12, 20); - Vector2 fireDirection = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); + Vector2 fireDirection = Projectile.Center; float fireXVel = projXStore - fireDirection.X; float fireYVel = projYStore - fireDirection.Y; float fireVelocity = (float)Math.Sqrt((double)(fireXVel * fireXVel + fireYVel * fireYVel)); diff --git a/Projectiles/Summon/WaterElementalSong.cs b/Projectiles/Summon/WaterElementalSong.cs index 8b164f92ee..b5725388d7 100644 --- a/Projectiles/Summon/WaterElementalSong.cs +++ b/Projectiles/Summon/WaterElementalSong.cs @@ -1,8 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { diff --git a/Projectiles/Summon/WaterSpearFriendly.cs b/Projectiles/Summon/WaterSpearFriendly.cs index 36e0cda993..c13ae788a4 100644 --- a/Projectiles/Summon/WaterSpearFriendly.cs +++ b/Projectiles/Summon/WaterSpearFriendly.cs @@ -1,9 +1,9 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { public class WaterSpearFriendly : ModProjectile, ILocalizedModType @@ -32,7 +32,7 @@ namespace CalamityMod.Projectiles.Summon { for (int i = 0; i < 5; i++) { - int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 2f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Water, 0f, 0f, 100, default, 2f); Main.dust[dust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -69,7 +69,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } @@ -83,7 +83,7 @@ namespace CalamityMod.Projectiles.Summon { for (int k = 0; k < 3; k++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 33, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Water, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } } diff --git a/Projectiles/Summon/WhiteDragonBody.cs b/Projectiles/Summon/WhiteDragonBody.cs index 0e27f7d625..954983e8b7 100644 --- a/Projectiles/Summon/WhiteDragonBody.cs +++ b/Projectiles/Summon/WhiteDragonBody.cs @@ -14,7 +14,8 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - Main.projPet[Projectile.type] = true; + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; } public override void SetDefaults() @@ -25,8 +26,8 @@ namespace CalamityMod.Projectiles.Summon Projectile.friendly = true; Projectile.penetrate = -1; Projectile.timeLeft = 180; - Projectile.idStaticNPCHitCooldown = 4; Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 8; Projectile.tileCollide = false; Projectile.extraUpdates = 0; Projectile.aiStyle = -1; @@ -83,7 +84,7 @@ namespace CalamityMod.Projectiles.Summon } } if (!live) Projectile.Kill(); - Vector2 destinationOffset = nextSegment.Center+nextSegment.velocity - Projectile.Center; + Vector2 destinationOffset = nextSegment.Center + nextSegment.velocity - Projectile.Center; if (nextSegment.rotation != Projectile.rotation) { float angle = MathHelper.WrapAngle(nextSegment.rotation - Projectile.rotation); @@ -93,7 +94,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.rotation = destinationOffset.ToRotation(); if (destinationOffset != Vector2.Zero) { - Projectile.Center = nextSegment.Center+nextSegment.velocity - destinationOffset.SafeNormalize(Vector2.Zero) * 20f; + Projectile.Center = nextSegment.Center + nextSegment.velocity - destinationOffset.SafeNormalize(Vector2.Zero) * 20f; } } diff --git a/Projectiles/Summon/WhiteDragonHead.cs b/Projectiles/Summon/WhiteDragonHead.cs index b9ef8df47b..0915f26c63 100644 --- a/Projectiles/Summon/WhiteDragonHead.cs +++ b/Projectiles/Summon/WhiteDragonHead.cs @@ -1,9 +1,9 @@ -using CalamityMod.Buffs.Summon; +using System; +using System.Collections.Generic; +using CalamityMod.Buffs.Summon; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; -using System; -using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -117,7 +117,7 @@ namespace CalamityMod.Projectiles.Summon if (i < segments.Count) { if (segments.ContainsKey(i)) - segments[i].ModProjectile().SegmentMove(); + segments[i].ModProjectile().SegmentMove(); } else { @@ -134,7 +134,7 @@ namespace CalamityMod.Projectiles.Summon float distanceFromDestination = Projectile.Distance(destination); // Get a swerve effect if somewhat far from the target. - if (Projectile.Distance(destination) > 425f) + if (Projectile.Distance(destination) > 400f) { Projectile.ai[2] = 0; destination += (Projectile.ai[0] % 30f / 30f * MathHelper.TwoPi).ToRotationVector2() * 145f; @@ -184,7 +184,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Texture2D texBody = ModContent.Request("CalamityMod/Projectiles/Summon/WhiteDragonBody").Value; Texture2D texBody2 = ModContent.Request("CalamityMod/Projectiles/Summon/WhiteDragonBody2").Value; Texture2D texTail = ModContent.Request("CalamityMod/Projectiles/Summon/WhiteDragonTail").Value; diff --git a/Projectiles/Summon/WitherBolt.cs b/Projectiles/Summon/WitherBolt.cs index df09372785..cbbafe4024 100644 --- a/Projectiles/Summon/WitherBolt.cs +++ b/Projectiles/Summon/WitherBolt.cs @@ -53,7 +53,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - Texture2D boltTexture = ModContent.Request(Texture).Value; + Texture2D boltTexture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; for (int i = 0; i < Projectile.oldPos.Length; i++) { float completionRatio = i / (float)Projectile.oldPos.Length; @@ -75,7 +75,7 @@ namespace CalamityMod.Projectiles.Summon { for (int j = 0; j < 2; j++) { - Dust plague = Dust.NewDustDirect(Projectile.oldPos[i], Projectile.width / 2, Projectile.height / 2, 107); + Dust plague = Dust.NewDustDirect(Projectile.oldPos[i], Projectile.width / 2, Projectile.height / 2, DustID.TerraBlade); plague.velocity = (Projectile.oldRot[i] - MathHelper.PiOver2).ToRotationVector2() * 4.5f + Main.rand.NextVector2Circular(2f, 2f); plague.color = Color.Olive; plague.noGravity = true; diff --git a/Projectiles/Summon/WulfrumDroid.cs b/Projectiles/Summon/WulfrumDroid.cs index b603524057..74fa359aa1 100644 --- a/Projectiles/Summon/WulfrumDroid.cs +++ b/Projectiles/Summon/WulfrumDroid.cs @@ -1,21 +1,21 @@ -using CalamityMod.Buffs.Summon; +using System; +using System.IO; +using CalamityMod.Buffs.Summon; using CalamityMod.CalPlayer; +using CalamityMod.Graphics.Primitives; +using CalamityMod.Items.Accessories; +using CalamityMod.Items.Weapons.Summon; +using CalamityMod.Particles; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; +using Terraria.Audio; +using Terraria.Graphics.Effects; +using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; -using System; -using Terraria.Audio; -using CalamityMod.Particles; -using CalamityMod.Items.Weapons.Summon; -using CalamityMod.Items.Accessories; -using Microsoft.Xna.Framework.Graphics; -using Terraria.Graphics.Shaders; -using Terraria.Graphics.Effects; using static Terraria.ModLoader.ModContent; -using ReLogic.Content; -using System.IO; -using CalamityMod.Graphics.Primitives; namespace CalamityMod.Projectiles.Summon { diff --git a/Projectiles/Summon/WulfrumEnergyBurst.cs b/Projectiles/Summon/WulfrumEnergyBurst.cs index 3a042342ef..687a48141d 100644 --- a/Projectiles/Summon/WulfrumEnergyBurst.cs +++ b/Projectiles/Summon/WulfrumEnergyBurst.cs @@ -1,16 +1,16 @@ -using Microsoft.Xna.Framework; +using System; +using CalamityMod.Graphics.Primitives; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; +using Terraria.Graphics.Effects; +using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; -using System; -using CalamityMod.Particles; using static CalamityMod.CalamityUtils; using static Terraria.ModLoader.ModContent; -using Terraria.Graphics.Shaders; -using Terraria.Graphics.Effects; -using ReLogic.Content; -using CalamityMod.Graphics.Primitives; namespace CalamityMod.Projectiles.Summon { @@ -191,7 +191,7 @@ namespace CalamityMod.Projectiles.Summon Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; float stretchy = MathHelper.Clamp((Projectile.velocity.Length() - 6f) / 16f, 0f, 1f); Vector2 scale = new Vector2(1f + stretchy * -0.2f, stretchy * 0.5f + 1f); Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation + MathHelper.PiOver2, tex.Size() / 2f, Projectile.scale * scale, SpriteEffects.None, 0); diff --git a/Projectiles/Summon/WulfrumFusionBolt.cs b/Projectiles/Summon/WulfrumFusionBolt.cs index 1208dce2db..a32b4ef95a 100644 --- a/Projectiles/Summon/WulfrumFusionBolt.cs +++ b/Projectiles/Summon/WulfrumFusionBolt.cs @@ -1,5 +1,7 @@ using System; +using CalamityMod.Graphics.Primitives; using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -8,8 +10,6 @@ using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; -using CalamityMod.Particles; -using CalamityMod.Graphics.Primitives; namespace CalamityMod.Projectiles.Summon { diff --git a/Projectiles/Summon/YharonMinionFireball.cs b/Projectiles/Summon/YharonMinionFireball.cs index 001e75c59b..61c54b2438 100644 --- a/Projectiles/Summon/YharonMinionFireball.cs +++ b/Projectiles/Summon/YharonMinionFireball.cs @@ -1,10 +1,10 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using CalamityMod.Buffs.DamageOverTime; namespace CalamityMod.Projectiles.Summon { @@ -58,7 +58,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Rectangle frame = texture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); SpriteEffects direction = SpriteEffects.None; if (Projectile.spriteDirection == -1) @@ -85,15 +85,15 @@ namespace CalamityMod.Projectiles.Summon SoundEngine.PlaySound(SoundID.Item74, Projectile.Center); for (int d = 0; d < 2; d++) - Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 55, 0f, 0f, 50, default, 1.5f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Pixie, 0f, 0f, 50, default, 1.5f); for (int d = 0; d < 20; d++) { - Dust fire = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 0, default, 2.2f); + Dust fire = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 0, default, 2.2f); fire.noGravity = true; fire.velocity *= 4f; - fire = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 50, default, 1.5f); + fire = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 50, default, 1.5f); fire.velocity *= 5f; fire.noGravity = true; } diff --git a/Projectiles/Turret/DraedonLaser.cs b/Projectiles/Turret/DraedonLaser.cs index abfab01fc9..029a148ac1 100644 --- a/Projectiles/Turret/DraedonLaser.cs +++ b/Projectiles/Turret/DraedonLaser.cs @@ -1,9 +1,9 @@ -using Microsoft.Xna.Framework; -using System; -using Terraria; -using Terraria.ModLoader; -using Terraria.Audio; +using System; using CalamityMod.Sounds; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Turret { @@ -46,7 +46,7 @@ namespace CalamityMod.Projectiles.Turret if (Projectile.localAI[0] == 0f) { // play a sound frame 1. changed this from space gun sound because that sound was way too annoying - var sound = SoundEngine.PlaySound(CommonCalamitySounds.LaserCannonSound with { Volume = CommonCalamitySounds.LaserCannonSound.Volume * 0.23f}, Projectile.Center); + var sound = SoundEngine.PlaySound(CommonCalamitySounds.LaserCannonSound with { Volume = CommonCalamitySounds.LaserCannonSound.Volume * 0.23f }, Projectile.Center); Projectile.localAI[0] = 1f; } diff --git a/Projectiles/Turret/FireShot.cs b/Projectiles/Turret/FireShot.cs index 75907b7b4c..563e0b7c6c 100644 --- a/Projectiles/Turret/FireShot.cs +++ b/Projectiles/Turret/FireShot.cs @@ -1,10 +1,10 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using System; namespace CalamityMod.Projectiles.Turret { diff --git a/Projectiles/Turret/IceExplosion.cs b/Projectiles/Turret/IceExplosion.cs index 2594dba987..f26d9ac54b 100644 --- a/Projectiles/Turret/IceExplosion.cs +++ b/Projectiles/Turret/IceExplosion.cs @@ -1,11 +1,11 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.DataStructures; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; -using Terraria.ID; using Terraria.GameContent; +using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Buffs.StatDebuffs; -using CalamityMod.DataStructures; namespace CalamityMod.Projectiles.Turret { @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.Turret public override void AI() { Projectile.localAI[0]++; - Projectile.scale = 0.5f + (Projectile.localAI[0] * 0.01f) ; + Projectile.scale = 0.5f + (Projectile.localAI[0] * 0.01f); if (Projectile.timeLeft < 30) // Remove hitbox once the projectile is barely visible anymore ableToHit = false; } @@ -69,8 +69,8 @@ namespace CalamityMod.Projectiles.Turret if (Projectile.localAI[0] == 0f) return; - - Texture2D texture = TextureAssets.Projectile[Projectile.type].Value; + + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Vector2 origin = texture.Size() * 0.5f; Vector2 drawPosition = Projectile.Center - Main.screenPosition; float opacity = 0.9f; diff --git a/Projectiles/Turret/IceShot.cs b/Projectiles/Turret/IceShot.cs index 3e2370adbd..cbe9c9193d 100644 --- a/Projectiles/Turret/IceShot.cs +++ b/Projectiles/Turret/IceShot.cs @@ -1,10 +1,10 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Particles; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using CalamityMod.Buffs.StatDebuffs; namespace CalamityMod.Projectiles.Turret { @@ -70,7 +70,7 @@ namespace CalamityMod.Projectiles.Turret { Projectile.velocity.Y = -0.6f * Projectile.oldVelocity.Y; Projectile.velocity.X *= 0.975f; //ground friction - } + } else if (Projectile.velocity.X == 0f) //bounce off walls { Projectile.velocity.X = -0.6f * Projectile.oldVelocity.X; @@ -107,7 +107,7 @@ namespace CalamityMod.Projectiles.Turret if (Main.netMode != NetmodeID.MultiplayerClient) { Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity * 0f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.25f), Projectile.knockBack, Main.myPlayer); - } + } } } } diff --git a/Projectiles/Turret/LaserShot.cs b/Projectiles/Turret/LaserShot.cs index e150483dd6..72a11e960f 100644 --- a/Projectiles/Turret/LaserShot.cs +++ b/Projectiles/Turret/LaserShot.cs @@ -1,11 +1,11 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using CalamityMod.Projectiles.BaseProjectiles; -using Terraria; -using Terraria.ModLoader; -using Terraria.Audio; -using ReLogic.Content; +using CalamityMod.Projectiles.BaseProjectiles; using CalamityMod.Sounds; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.Audio; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Turret { diff --git a/Projectiles/Turret/LaserShotBuffer.cs b/Projectiles/Turret/LaserShotBuffer.cs index e5d08ef016..a3b6f124d0 100644 --- a/Projectiles/Turret/LaserShotBuffer.cs +++ b/Projectiles/Turret/LaserShotBuffer.cs @@ -1,7 +1,7 @@ -using Terraria; +using Microsoft.Xna.Framework; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using Microsoft.Xna.Framework; namespace CalamityMod.Projectiles.Turret { diff --git a/Projectiles/Turret/OnyxShot.cs b/Projectiles/Turret/OnyxShot.cs index f32def0b4a..ecbfb2d06f 100644 --- a/Projectiles/Turret/OnyxShot.cs +++ b/Projectiles/Turret/OnyxShot.cs @@ -1,8 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Turret { diff --git a/Projectiles/Turret/OnyxShotBuffer.cs b/Projectiles/Turret/OnyxShotBuffer.cs index f750e64e25..9635370dde 100644 --- a/Projectiles/Turret/OnyxShotBuffer.cs +++ b/Projectiles/Turret/OnyxShotBuffer.cs @@ -1,8 +1,8 @@ -using Terraria; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Microsoft.Xna.Framework; -using Terraria.Audio; namespace CalamityMod.Projectiles.Turret { diff --git a/Projectiles/Turret/PlagueExplosionGas.cs b/Projectiles/Turret/PlagueExplosionGas.cs index 6394f081bc..fa76879a54 100644 --- a/Projectiles/Turret/PlagueExplosionGas.cs +++ b/Projectiles/Turret/PlagueExplosionGas.cs @@ -1,11 +1,11 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.DataStructures; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; -using Terraria.ID; using Terraria.GameContent; +using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.DataStructures; namespace CalamityMod.Projectiles.Turret { @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Turret public override void AI() { Projectile.localAI[0]++; - Projectile.scale = 0.5f + (Projectile.localAI[0] * 0.01f) ; + Projectile.scale = 0.5f + (Projectile.localAI[0] * 0.01f); Projectile.velocity *= 0.98f; if (Projectile.timeLeft < 40) // Remove hitbox once the projectile is barely visible anymore ableToHit = false; @@ -64,8 +64,8 @@ namespace CalamityMod.Projectiles.Turret if (Projectile.localAI[0] == 0f) return; - - Texture2D texture = TextureAssets.Projectile[Projectile.type].Value; + + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Vector2 origin = texture.Size() * 0.5f; Vector2 drawPosition = Projectile.Center - Main.screenPosition; float opacity = 1f; diff --git a/Projectiles/Turret/PlagueShot.cs b/Projectiles/Turret/PlagueShot.cs index cc71e4ba9a..f6a3b833a9 100644 --- a/Projectiles/Turret/PlagueShot.cs +++ b/Projectiles/Turret/PlagueShot.cs @@ -1,11 +1,11 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Weapons.DraedonsArsenal; using CalamityMod.Particles; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Items.Weapons.DraedonsArsenal; namespace CalamityMod.Projectiles.Turret { @@ -47,7 +47,7 @@ namespace CalamityMod.Projectiles.Turret Projectile.localAI[0]++; if (Projectile.friendly) CalamityUtils.HomeInOnNPC(Projectile, false, 180f, 12f, 0f); - Projectile.velocity = ((Projectile.oldVelocity*7f) + Projectile.velocity) / 8; //inertia + Projectile.velocity = ((Projectile.oldVelocity * 7f) + Projectile.velocity) / 8; //inertia DrawParticles(); } diff --git a/Projectiles/Turret/WaterShot.cs b/Projectiles/Turret/WaterShot.cs index 84afa00157..bf3555dee9 100644 --- a/Projectiles/Turret/WaterShot.cs +++ b/Projectiles/Turret/WaterShot.cs @@ -1,9 +1,9 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Turret { @@ -61,9 +61,9 @@ namespace CalamityMod.Projectiles.Turret Projectile.velocity.Y = fallSpeedCap; Projectile.velocity.X *= 0.995f; } - + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.Wet, 240); - + public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(BuffID.Wet, 240); public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Turret/WaterShotBuffer.cs b/Projectiles/Turret/WaterShotBuffer.cs index 4310090f82..c26d65be2d 100644 --- a/Projectiles/Turret/WaterShotBuffer.cs +++ b/Projectiles/Turret/WaterShotBuffer.cs @@ -1,8 +1,8 @@ -using Terraria; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using Microsoft.Xna.Framework; -using Terraria.DataStructures; namespace CalamityMod.Projectiles.Turret { diff --git a/Projectiles/Typeless/AeroExplosive.cs b/Projectiles/Typeless/AeroExplosive.cs index accbe6929b..b2526a6fd6 100644 --- a/Projectiles/Typeless/AeroExplosive.cs +++ b/Projectiles/Typeless/AeroExplosive.cs @@ -40,11 +40,11 @@ namespace CalamityMod.Projectiles.Typeless if (Main.rand.NextBool(5)) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 187, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 100, new Color(53, Main.DiscoG, 255)); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Flare_Blue, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 100, new Color(53, Main.DiscoG, 255)); } if (Main.rand.NextBool(5)) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 16, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Cloud, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } if (Main.rand.NextBool()) @@ -54,7 +54,7 @@ namespace CalamityMod.Projectiles.Typeless Main.dust[smoke].fadeIn = 1.5f + Main.rand.NextFloat(0f, 0.5f); Main.dust[smoke].noGravity = true; Main.dust[smoke].position = Projectile.Center + new Vector2(0f, -Projectile.height / 2f).RotatedBy(Projectile.rotation, default) * 1.1f; - int fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 1f); + int fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 1f); Main.dust[fire].scale = 1f + Main.rand.NextFloat(0f, 0.5f); Main.dust[fire].noGravity = true; Main.dust[fire].position = Projectile.Center + new Vector2(0f, -Projectile.height / 2f).RotatedBy(Projectile.rotation, default) * 1.1f; @@ -97,10 +97,10 @@ namespace CalamityMod.Projectiles.Typeless } for (int d = 0; d < 70; d++) { - int fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 3f); + int fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 3f); Main.dust[fire].noGravity = true; Main.dust[fire].velocity *= 5f; - fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 2f); + fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 2f); Main.dust[fire].velocity *= 2f; } diff --git a/Projectiles/Typeless/ArcZap.cs b/Projectiles/Typeless/ArcZap.cs index c4ab772f86..4a66e6b033 100644 --- a/Projectiles/Typeless/ArcZap.cs +++ b/Projectiles/Typeless/ArcZap.cs @@ -1,10 +1,10 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Typeless { public class ArcZap : ModProjectile, ILocalizedModType @@ -82,12 +82,12 @@ namespace CalamityMod.Projectiles.Typeless target = npcIndex; } } - - if (target > 0) + + if (target > 0) { selectedTarget = Main.npc[target]; selectedTarget.Calamity().arcZapCooldown = 18; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), new Vector2(Projectile.position.X, Projectile.position.Y - 10f), new Vector2(0f, -2f), ModContent.ProjectileType(), Projectile.damage, 0f, Projectile.owner, target, Projectile.ai[1] - 1f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), new Vector2(Projectile.position.X, Projectile.position.Y - 10f), new Vector2(0f, -2f), ModContent.ProjectileType(), Projectile.damage, 0f, Projectile.owner, target, Projectile.ai[1] - 1f); } } diff --git a/Projectiles/Typeless/ArtifactOfResilienceShards.cs b/Projectiles/Typeless/ArtifactOfResilienceShards.cs index 01a4adbd88..7b769f1616 100644 --- a/Projectiles/Typeless/ArtifactOfResilienceShards.cs +++ b/Projectiles/Typeless/ArtifactOfResilienceShards.cs @@ -1,8 +1,8 @@ -using CalamityMod.Buffs.StatDebuffs; +using System.IO; +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; using CalamityMod.Projectiles.Damageable; using Microsoft.Xna.Framework; -using System.IO; using Terraria; using Terraria.ModLoader; diff --git a/Projectiles/Typeless/AstralSpray.cs b/Projectiles/Typeless/AstralSpray.cs index 455c9b35ab..d2354f3dd6 100644 --- a/Projectiles/Typeless/AstralSpray.cs +++ b/Projectiles/Typeless/AstralSpray.cs @@ -1,6 +1,8 @@ using CalamityMod.World; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Typeless { public class AstralSpray : ModProjectile, ILocalizedModType @@ -58,7 +60,7 @@ namespace CalamityMod.Projectiles.Typeless Projectile.ai[0]++; for (int i = 0; i < 1; i++) { - int d = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 118, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 100); + int d = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Ice_Purple, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 100); Main.dust[d].noGravity = true; Main.dust[d].scale *= 1.75f * scalar; Main.dust[d].velocity.X *= 2f; diff --git a/Projectiles/Typeless/AstralStar.cs b/Projectiles/Typeless/AstralStar.cs index 0e415f6579..fed26b266e 100644 --- a/Projectiles/Typeless/AstralStar.cs +++ b/Projectiles/Typeless/AstralStar.cs @@ -1,12 +1,12 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Typeless { @@ -113,7 +113,7 @@ namespace CalamityMod.Projectiles.Typeless Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int i = 0; i < 5; i++) { - int starryDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 1.2f); + int starryDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 1.2f); Main.dust[starryDust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -123,10 +123,10 @@ namespace CalamityMod.Projectiles.Typeless } for (int j = 0; j < 5; j++) { - int starryDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 1.7f); + int starryDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 1.7f); Main.dust[starryDust2].noGravity = true; Main.dust[starryDust2].velocity *= 5f; - starryDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 1f); + starryDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 1f); Main.dust[starryDust2].velocity *= 2f; } if (Main.netMode != NetmodeID.Server) diff --git a/Projectiles/Typeless/BasicPlagueBee.cs b/Projectiles/Typeless/BasicPlagueBee.cs new file mode 100644 index 0000000000..a3ea930c7b --- /dev/null +++ b/Projectiles/Typeless/BasicPlagueBee.cs @@ -0,0 +1,211 @@ +using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class BasicPlagueBee : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Typeless"; + public override string Texture => "CalamityMod/Projectiles/Rogue/PlaguenadeBee"; + + public int time = 0; + public float projRotValue; + public NPC npc; + public int tileCollisions = 0; + public override void SetStaticDefaults() + { + Main.projFrames[Projectile.type] = 4; + } + + public override void SetDefaults() + { + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.penetrate = 2; + Projectile.timeLeft = 300; + Projectile.ignoreWater = true; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 5; + } + + public override void AI() + { + Color trailColor = Color.Lime; + if (time == 0) + trailColor = Main.rand.NextBool() ? Color.LawnGreen : Color.Lime; + time++; + + // If you would like the bees to home in sooner or later than normal, change Projectile.ai[0]! You can set it to anything above 30 to make them home in and damage immediately. + // If you set Projectile.ai[0] to a negative number, it will take longer before they begin homing. + + // You can set Projectile.ai[1] when spawning these bees to determine how long they inflict the plague debuff, default is 90 frames. + if (Projectile.ai[1] <= 0) + Projectile.ai[1] = 90; + + // You can set Projectile.ai[2] to change how detailed the bee's particle trail is. Higher is less detailed, default is 2. + // If you are spawning a lot of bees, consider raising the value to 3 or 4. + if (Projectile.ai[2] <= 0) + Projectile.ai[2] = 2; + + Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); + Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); + Projectile.rotation += Projectile.spriteDirection * MathHelper.ToRadians(45f); + + Projectile.frameCounter++; + if (Projectile.frameCounter >= 3) + { + Projectile.frame++; + Projectile.frameCounter = 0; + } + if (Projectile.frame >= Main.projFrames[Projectile.type]) + { + Projectile.frame = 0; + } + + // If a bee bounces around a fuckload (probably got stuck in a tile) stop it from doing visuals and kill it, that bee is doomed anyways. + if (tileCollisions < 7) + { + if (time % Projectile.ai[2] == 0) + { + PointParticle orb = new PointParticle(Projectile.Center, -Projectile.velocity * 0.05f, false, 7, 0.35f, trailColor * 0.45f); + GeneralParticleHandler.SpawnParticle(orb); + + 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.noGravity = true; + dust.color = Color.Black; + dust.alpha = Main.rand.Next(90, 220 + 1); + } + } + } + else + Projectile.Kill(); + + Vector2 center = Projectile.Center; + float maxDistance = 800f; + bool homeIn = false; + Projectile.ai[0] += 1f; + if (Projectile.ai[0] > 30f) + { + for (int npcIndex = 0; npcIndex < Main.maxNPCs; npcIndex++) + { + if (time % 10 == 0 && npc == null) + npc = Projectile.Center.ClosestNPCAt(1000, false); + if (npc == null || !npc.CanBeChasedBy(Projectile, false)) + return; + if (npc.CanBeChasedBy(Projectile, false)) + { + float extraDistance = (npc.width / 2) + (npc.height / 2); + + bool canHit = true; + if (extraDistance < maxDistance) + canHit = Collision.CanHit(Projectile.Center, 1, 1, npc.Center, 1, 1); + + if (Vector2.Distance(npc.Center, Projectile.Center) < (maxDistance + extraDistance) && canHit) + { + center = npc.Center; + homeIn = true; + break; + } + } + } + } + if (!homeIn) + { + center.X = Projectile.Center.X + Projectile.velocity.X * 100f; + center.Y = Projectile.Center.Y + Projectile.velocity.Y * 100f; + } + float speed = 10f; + float velocityTweak = 0.30f; + Vector2 projPos = Projectile.Center; + Vector2 velocity = center - projPos; + float targetDist = velocity.Length(); + targetDist = speed / targetDist; + velocity.X *= targetDist; + velocity.Y *= targetDist; + if (Projectile.velocity.X < velocity.X) + { + Projectile.velocity.X += velocityTweak; + if (Projectile.velocity.X < 0f && velocity.X > 0f) + { + Projectile.velocity.X += velocityTweak * 2f; + } + } + else if (Projectile.velocity.X > velocity.X) + { + Projectile.velocity.X -= velocityTweak; + if (Projectile.velocity.X > 0f && velocity.X < 0f) + { + Projectile.velocity.X -= velocityTweak * 2f; + } + } + if (Projectile.velocity.Y < velocity.Y) + { + Projectile.velocity.Y += velocityTweak; + if (Projectile.velocity.Y < 0f && velocity.Y > 0f) + { + Projectile.velocity.Y += velocityTweak * 2f; + } + } + else if (Projectile.velocity.Y > velocity.Y) + { + Projectile.velocity.Y -= velocityTweak; + if (Projectile.velocity.Y > 0f && velocity.Y < 0f) + { + Projectile.velocity.Y -= velocityTweak * 2f; + } + } + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + if (Projectile.velocity.X != oldVelocity.X) + { + Projectile.velocity.X = -oldVelocity.X; + } + if (Projectile.velocity.Y != oldVelocity.Y) + { + Projectile.velocity.Y = -oldVelocity.Y; + } + tileCollisions++; + return false; + } + + public override bool PreDraw(ref Color lightColor) + { + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + int frameHeight = texture.Height / Main.projFrames[Projectile.type]; + int drawStart = frameHeight * Projectile.frame; + SpriteEffects spriteEffects = SpriteEffects.None; + if (Projectile.spriteDirection == -1) + spriteEffects = SpriteEffects.FlipHorizontally; + Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, drawStart, texture.Width, frameHeight)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture.Width / 2f, (float)frameHeight / 2f), Projectile.scale, spriteEffects, 0); + return false; + } + + public override void OnKill(int timeLeft) + { + for (int i = 0; i <= 5; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, 89, Projectile.velocity.RotatedByRandom(0.3f) * Main.rand.NextFloat(0.1f, 0.8f), 0, default, Main.rand.NextFloat(0.7f, 0.85f)); + dust.noGravity = true; + } + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), (int)(Projectile.ai[1])); + + public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), (int)(Projectile.ai[1])); + + public override bool? CanDamage() => Projectile.ai[0] <= 30f ? false : null; + } +} diff --git a/Projectiles/Typeless/BlazingStarHeal.cs b/Projectiles/Typeless/BlazingStarHeal.cs index c80b4406dd..4509aaf731 100644 --- a/Projectiles/Typeless/BlazingStarHeal.cs +++ b/Projectiles/Typeless/BlazingStarHeal.cs @@ -11,6 +11,7 @@ namespace CalamityMod.Projectiles.Typeless public class BlazingStarHeal : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Typeless"; + public override string Texture => "CalamityMod/Projectiles/StarProj"; public override void SetDefaults() @@ -35,7 +36,7 @@ namespace CalamityMod.Projectiles.Typeless Projectile.velocity *= 0.99f; if (Projectile.timeLeft <= 160) Projectile.velocity = Vector2.Zero; - + int index = Player.FindClosest(Projectile.position, Projectile.width, Projectile.height); Player player = Main.player[index]; if (Projectile.timeLeft > 190 || player is null || Main.player[Projectile.owner].team != player.team) @@ -48,17 +49,17 @@ namespace CalamityMod.Projectiles.Typeless player.HealEffect(healAmt, false); player.statLife += healAmt; if (player.statLife > player.statLifeMax2) - { player.statLife = player.statLifeMax2; - } + NetMessage.SendData(MessageID.SpiritHeal, -1, -1, null, index, healAmt); + Projectile.Kill(); } } public override bool PreDraw(ref Color lightColor) { - Texture2D starTexture = ModContent.Request(Texture).Value; + Texture2D starTexture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Color healGreen = new Color(54, 209, 54, 0); Vector2 projPos = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); Color healGreenDraw = healGreen; @@ -100,7 +101,7 @@ namespace CalamityMod.Projectiles.Typeless Projectile.position.Y = Projectile.position.Y - (Projectile.height / 2); for (int i = 0; i < 5; i++) { - int duster = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 246, 0f, 0f, 100, default, 2f); + int duster = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GoldCoin, 0f, 0f, 100, default, 2f); Main.dust[duster].velocity *= 3f; Main.dust[duster].noGravity = true; if (Main.rand.NextBool()) @@ -111,10 +112,10 @@ namespace CalamityMod.Projectiles.Typeless } for (int j = 0; j < 8; j++) { - int duster2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 247, 0f, 0f, 100, default, 3f); + int duster2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.PlatinumCoin, 0f, 0f, 100, default, 3f); Main.dust[duster2].noGravity = true; Main.dust[duster2].velocity *= 5f; - duster2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 246, 0f, 0f, 100, default, 2f); + duster2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GoldCoin, 0f, 0f, 100, default, 2f); Main.dust[duster2].velocity *= 2f; Main.dust[duster2].noGravity = true; } diff --git a/Projectiles/Typeless/BlazingStarThatDoesNotHeal.cs b/Projectiles/Typeless/BlazingStarThatDoesNotHeal.cs index 033db0ffbf..1498b0c95f 100644 --- a/Projectiles/Typeless/BlazingStarThatDoesNotHeal.cs +++ b/Projectiles/Typeless/BlazingStarThatDoesNotHeal.cs @@ -1,13 +1,13 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; using CalamityMod.NPCs.Providence; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using CalamityMod.Dusts; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Typeless { @@ -39,7 +39,7 @@ namespace CalamityMod.Projectiles.Typeless if (Projectile.timeLeft < 160) Projectile.timeLeft = 160; } - + if (Projectile.velocity.Length() < 16f) Projectile.velocity *= 1.01f; } @@ -48,7 +48,7 @@ namespace CalamityMod.Projectiles.Typeless { float lerpMult = Utils.GetLerpValue(15f, 30f, Projectile.timeLeft, clamped: true) * Utils.GetLerpValue(240f, 200f, Projectile.timeLeft, clamped: true) * (1f + 0.2f * (float)Math.Cos(Main.GlobalTimeWrappedHourly % 30f / 0.5f * (MathHelper.Pi * 2f) * 3f)) * 0.8f; - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Vector2 drawPos = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); Color baseColor = new Color(250, 100, 100, 255); baseColor *= 0.5f; diff --git a/Projectiles/Typeless/BlazingSun.cs b/Projectiles/Typeless/BlazingSun.cs index 1ae3999748..71cc430630 100644 --- a/Projectiles/Typeless/BlazingSun.cs +++ b/Projectiles/Typeless/BlazingSun.cs @@ -1,6 +1,6 @@ -using Terraria; +using Microsoft.Xna.Framework; +using Terraria; using Terraria.ModLoader; -using Microsoft.Xna.Framework; namespace CalamityMod.Projectiles.Typeless { diff --git a/Projectiles/Typeless/BlazingSun2.cs b/Projectiles/Typeless/BlazingSun2.cs index 7d8a80db94..e505a2abb4 100644 --- a/Projectiles/Typeless/BlazingSun2.cs +++ b/Projectiles/Typeless/BlazingSun2.cs @@ -1,4 +1,4 @@ -using Terraria.ModLoader; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Typeless { diff --git a/Projectiles/Typeless/BloodBomb.cs b/Projectiles/Typeless/BloodBomb.cs index 67d697676d..a1b97fc5f4 100644 --- a/Projectiles/Typeless/BloodBomb.cs +++ b/Projectiles/Typeless/BloodBomb.cs @@ -1,8 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; -using Terraria.ModLoader; -using Terraria.ID; using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Typeless { @@ -31,7 +31,7 @@ namespace CalamityMod.Projectiles.Typeless } for (int j = 0; j < 3; j++) { - int bloody = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 5, 0f, 0f, 100, default, 1.2f); + int bloody = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Blood, 0f, 0f, 100, default, 1.2f); Main.dust[bloody].noGravity = true; Main.dust[bloody].velocity *= 0.5f; Main.dust[bloody].velocity += Projectile.velocity * 0.1f; diff --git a/Projectiles/Typeless/BloodBombExplosion.cs b/Projectiles/Typeless/BloodBombExplosion.cs index b2183ade06..164a92cc3f 100644 --- a/Projectiles/Typeless/BloodBombExplosion.cs +++ b/Projectiles/Typeless/BloodBombExplosion.cs @@ -1,9 +1,9 @@ +using System; using Microsoft.Xna.Framework; -using System; using Terraria; -using Terraria.ModLoader; -using Terraria.ID; using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Typeless { @@ -77,7 +77,7 @@ namespace CalamityMod.Projectiles.Typeless randAdjust = rand3 / randAdjust; rand1 *= randAdjust; rand2 *= randAdjust; - int bloody = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 5, 0f, 0f, 100, default, 1.8f); + int bloody = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Blood, 0f, 0f, 100, default, 1.8f); Dust dust = Main.dust[bloody]; dust.noGravity = true; dust.position.X = Projectile.Center.X; diff --git a/Projectiles/Typeless/BlunderBoosterAura.cs b/Projectiles/Typeless/BlunderBoosterAura.cs index 85ba2e2077..bea43f6362 100644 --- a/Projectiles/Typeless/BlunderBoosterAura.cs +++ b/Projectiles/Typeless/BlunderBoosterAura.cs @@ -85,7 +85,7 @@ namespace CalamityMod.Projectiles.Typeless public override bool PreDraw(ref Color lightColor) { - Texture2D sprite = ModContent.Request(Texture).Value; + Texture2D sprite = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Color drawColour = Color.White; Rectangle sourceRect = new Rectangle(Projectile.width * (int)Projectile.localAI[1], Projectile.height * (int)Projectile.localAI[0], Projectile.width, Projectile.height); diff --git a/Projectiles/Typeless/BossRushEndEffectThing.cs b/Projectiles/Typeless/BossRushEndEffectThing.cs index fdb981ba22..b45a3230c2 100644 --- a/Projectiles/Typeless/BossRushEndEffectThing.cs +++ b/Projectiles/Typeless/BossRushEndEffectThing.cs @@ -1,10 +1,11 @@ using CalamityMod.Events; using CalamityMod.Items; +using CalamityMod.Systems; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; -using Terraria.ID; using Terraria.GameContent.Events; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Typeless @@ -35,10 +36,16 @@ namespace CalamityMod.Projectiles.Typeless BossRushEvent.SyncEndTimer((int)Time); float currentShakePower = MathHelper.Lerp(1f, 20f, Utils.GetLerpValue(140f, 180f, Time, true) * Utils.GetLerpValue(10f, 40f, Projectile.timeLeft, true)); - Main.LocalPlayer.Calamity().GeneralScreenShakePower = currentShakePower; + if (Projectile.timeLeft > 5) + Main.LocalPlayer.Calamity().GeneralScreenShakePower = currentShakePower; MoonlordDeathDrama.RequestLight(Utils.GetLerpValue(220f, 265f, Time, true) * Utils.GetLerpValue(10f, 30f, Projectile.timeLeft, true), Main.LocalPlayer.Center); + // Bit of an ugly solution, but this code prevents the end effect projectile from despawning while the end dialogue is playing. + // This fixes a bug where the first-time end dialogue did not play as intended. + if (Projectile.timeLeft < 5 && BossRushDialogueSystem.CurrentDialogueDelay != 0) + Projectile.timeLeft = 5; + Time++; } diff --git a/Projectiles/Typeless/BossRushFailureEffectThing.cs b/Projectiles/Typeless/BossRushFailureEffectThing.cs index 2e95232cc7..23fc2ef1b2 100644 --- a/Projectiles/Typeless/BossRushFailureEffectThing.cs +++ b/Projectiles/Typeless/BossRushFailureEffectThing.cs @@ -1,9 +1,9 @@ using CalamityMod.Events; using Terraria; +using Terraria.Audio; using Terraria.GameContent.Events; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Typeless { diff --git a/Projectiles/Typeless/BossRushTierAnimation.cs b/Projectiles/Typeless/BossRushTierAnimation.cs index 14c97e4770..6ff92afbb9 100644 --- a/Projectiles/Typeless/BossRushTierAnimation.cs +++ b/Projectiles/Typeless/BossRushTierAnimation.cs @@ -1,8 +1,8 @@ -using Terraria; -using Terraria.ModLoader; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using Terraria; using Terraria.Audio; +using Terraria.ModLoader; using static CalamityMod.Events.BossRushEvent; namespace CalamityMod.Projectiles.Typeless @@ -13,13 +13,13 @@ namespace CalamityMod.Projectiles.Typeless public int Tier => (int)Projectile.ai[0]; public Player Owner => Main.player[Projectile.owner]; - + public const int FrameChangeRate = 4; public const int TotalFrames = 56; public override string Texture => "CalamityMod/Projectiles/Typeless/BossRushTier2Animation"; - + public override void SetDefaults() { Projectile.width = 76; diff --git a/Projectiles/Typeless/BrimstoneHellfireballFriendly2.cs b/Projectiles/Typeless/BrimstoneHellfireballFriendly2.cs index 11f8c94957..a5154c74ec 100644 --- a/Projectiles/Typeless/BrimstoneHellfireballFriendly2.cs +++ b/Projectiles/Typeless/BrimstoneHellfireballFriendly2.cs @@ -2,9 +2,9 @@ using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Terraria; -using Terraria.ModLoader; -using Terraria.ID; using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Typeless { @@ -36,7 +36,7 @@ namespace CalamityMod.Projectiles.Typeless } for (int i = 0; i < 5; i++) { - int brimDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 0.6f); + int brimDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 0.6f); Main.dust[brimDust].noGravity = true; Main.dust[brimDust].velocity *= 0.5f; Main.dust[brimDust].velocity += Projectile.velocity * 0.1f; diff --git a/Projectiles/Typeless/ChaoticGeyser.cs b/Projectiles/Typeless/ChaoticGeyser.cs index 066954385f..b3eabf5aef 100644 --- a/Projectiles/Typeless/ChaoticGeyser.cs +++ b/Projectiles/Typeless/ChaoticGeyser.cs @@ -1,8 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Typeless { @@ -66,7 +66,7 @@ namespace CalamityMod.Projectiles.Typeless SoundEngine.PlaySound(SoundID.Item20, Projectile.position); } Projectile.rotation += Projectile.velocity.X * 0.1f; - int flareDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 127, 0f, 0f, 100, default, 1f); + int flareDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Flare, 0f, 0f, 100, default, 1f); Dust dust = Main.dust[flareDust]; dust.position.X -= 2f; dust.position.Y += 2f; @@ -75,7 +75,7 @@ namespace CalamityMod.Projectiles.Typeless dust.velocity.Y -= 16f; if (Main.rand.NextBool()) { - int flareDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 127, 0f, 0f, 100, default, 1f); + int flareDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Flare, 0f, 0f, 100, default, 1f); Dust dust2 = Main.dust[flareDust2]; dust2.position.X -= 2f; dust2.position.Y += 2f; diff --git a/Projectiles/Typeless/ChlorophyteLifePulse.cs b/Projectiles/Typeless/ChlorophyteLifePulse.cs index 11cf0adf34..c76a6f1bc5 100644 --- a/Projectiles/Typeless/ChlorophyteLifePulse.cs +++ b/Projectiles/Typeless/ChlorophyteLifePulse.cs @@ -1,10 +1,10 @@ -using CalamityMod.Items.VanillaArmorChanges; +using System; +using System.Collections.Generic; +using System.Linq; +using CalamityMod.Items.VanillaArmorChanges; using CalamityMod.Projectiles.VanillaProjectileOverrides; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.Collections.Generic; -using System.Linq; using Terraria; using Terraria.ModLoader; @@ -13,8 +13,11 @@ namespace CalamityMod.Projectiles.Typeless public class ChlorophyteLifePulse : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Typeless"; + public const int Lifetime = 60; + public float LifetimeCompletion => 1f - Projectile.timeLeft / (float)Lifetime; + public override void SetDefaults() { Projectile.width = 96; @@ -29,6 +32,7 @@ namespace CalamityMod.Projectiles.Typeless } public override bool? CanHitNPC(NPC target) => !target.CountsAsACritter && !target.friendly && target.chaseable; + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => Projectile.damage = (int)(Projectile.damage * 0.8f); public override void AI() @@ -69,7 +73,7 @@ namespace CalamityMod.Projectiles.Typeless public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Color drawColor = Projectile.GetAlpha(lightColor) * 0.4f; for (int i = 0; i < 8; i++) { @@ -80,10 +84,7 @@ namespace CalamityMod.Projectiles.Typeless return false; } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) - { - return CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.scale * 48f, targetHitbox); - } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.scale * 48f, targetHitbox); public override bool OnTileCollide(Vector2 oldVelocity) => false; } diff --git a/Projectiles/Typeless/ChronoClock.cs b/Projectiles/Typeless/ChronoClock.cs new file mode 100644 index 0000000000..565a8ed14a --- /dev/null +++ b/Projectiles/Typeless/ChronoClock.cs @@ -0,0 +1,104 @@ +using System.IO; +using CalamityMod.Buffs.StatBuffs; +using CalamityMod.CalPlayer; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class ChronoClock : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Typeless"; + + public override void SetStaticDefaults() + { + Main.projFrames[Projectile.type] = 8; + + } + + public override void SetDefaults() + { + Projectile.width = 28; + Projectile.height = 42; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 600; + Projectile.tileCollide = false; + } + + public override void AI() + { + Projectile.velocity *= 0.98f; + Player player = Main.player[Projectile.owner]; + // if the player touches a clock, they get the Haste buff and their haste level increases to a maximum of 3 + // this kills the clock + if (player.getRect().Intersects(Projectile.getRect())) + { + if (player.whoAmI == Main.myPlayer) + { + player.AddBuff(ModContent.BuffType(), 60); + if (player.Calamity().hasteLevel < 3) + { + player.Calamity().hasteLevel++; + player.Calamity().hasteCounter = 0; // reset the haste countdown + SoundEngine.PlaySound(SoundID.DD2_DarkMageHealImpact with { Volume = 2 }, Projectile.Center); + for (int i = 0; i < 20; i++) + { + Particle sparkle = new SnowflakeSparkle(Projectile.Center, (Main.rand.NextVector2CircularEdge(100, 100)).SafeNormalize(Vector2.Zero) * 4, Color.LightBlue, Color.LightSkyBlue, Main.rand.NextFloat(0.1f, 0.6f), 60); + GeneralParticleHandler.SpawnParticle(sparkle); + } + } + else + { + // reset the haste countdown if haste level is maxed out + player.Calamity().hasteCounter = 0; + SoundEngine.PlaySound(SoundID.DD2_DarkMageHealImpact with { Volume = 0.2f, Pitch = 1.4f }, Projectile.Center); + for (int i = 0; i < 20; i++) + { + Particle sparkle = new SnowflakeSparkle(Projectile.Center, (Main.rand.NextVector2CircularEdge(100, 100)).SafeNormalize(Vector2.Zero) * 2, Color.LightBlue, Color.LightSkyBlue, Main.rand.NextFloat(0.04f, 0.3f), 30); + GeneralParticleHandler.SpawnParticle(sparkle); + } + } + Projectile.Kill(); + } + } + Projectile.frameCounter++; + if (Projectile.frameCounter > 5) + { + Projectile.frame++; + Projectile.frameCounter = 0; + if (Projectile.frame % 2 == 0) + Projectile.netUpdate = true; + } + if (Projectile.frame > 7) + { + Projectile.frame = 0; + } + if (Main.rand.NextBool(5)) + { + int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Snow); + Main.dust[index2].noGravity = true; + Main.dust[index2].noLight = true; + Main.dust[index2].scale = 0.7f; + } + } + public override void OnKill(int timeLeft) + { + for (int index1 = 0; index1 < 3; ++index1) + { + int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Snow); + Main.dust[index2].noGravity = true; + Main.dust[index2].noLight = true; + Main.dust[index2].scale = 0.7f; + } + } + public override bool? CanHitNPC(NPC target) + { + return false; + } + } +} diff --git a/Projectiles/Typeless/ChronoClock.png b/Projectiles/Typeless/ChronoClock.png new file mode 100644 index 0000000000..1eded5eaf8 Binary files /dev/null and b/Projectiles/Typeless/ChronoClock.png differ diff --git a/Projectiles/Typeless/CoralBubble.cs b/Projectiles/Typeless/CoralBubble.cs index acbb4f7280..35ffc0fa32 100644 --- a/Projectiles/Typeless/CoralBubble.cs +++ b/Projectiles/Typeless/CoralBubble.cs @@ -1,9 +1,9 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Typeless { @@ -67,7 +67,7 @@ namespace CalamityMod.Projectiles.Typeless for (int i = 0; i < 10; i++) { int size = 12; - int dustIndex = Dust.NewDust(Projectile.Center - Vector2.One * size, size * 2, size * 2, 212); + int dustIndex = Dust.NewDust(Projectile.Center - Vector2.One * size, size * 2, size * 2, DustID.BubbleBurst_White); Dust dust = Main.dust[dustIndex]; Vector2 value14 = Vector2.Normalize(dust.position - Projectile.Center); dust.position = Projectile.Center + value14 * size; diff --git a/Projectiles/Typeless/CoralBubbleSmall.cs b/Projectiles/Typeless/CoralBubbleSmall.cs index bf008315bc..9732d39497 100644 --- a/Projectiles/Typeless/CoralBubbleSmall.cs +++ b/Projectiles/Typeless/CoralBubbleSmall.cs @@ -1,9 +1,9 @@ using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using Microsoft.Xna.Framework.Graphics; namespace CalamityMod.Projectiles.Typeless { @@ -70,7 +70,7 @@ namespace CalamityMod.Projectiles.Typeless for (int i = 0; i < 10; i++) { int size = 6; - int dustIndex = Dust.NewDust(Projectile.Center - Vector2.One * size, size * 2, size * 2, 212); + int dustIndex = Dust.NewDust(Projectile.Center - Vector2.One * size, size * 2, size * 2, DustID.BubbleBurst_White); Dust dust = Main.dust[dustIndex]; Vector2 value14 = Vector2.Normalize(dust.position - Projectile.Center); dust.position = Projectile.Center + value14 * size; diff --git a/Projectiles/Typeless/CosmicDashExplosion.cs b/Projectiles/Typeless/CosmicDashExplosion.cs index e7d6fd240d..d92fe0dfd8 100644 --- a/Projectiles/Typeless/CosmicDashExplosion.cs +++ b/Projectiles/Typeless/CosmicDashExplosion.cs @@ -1,10 +1,10 @@ -using Microsoft.Xna.Framework; +using Microsoft.CodeAnalysis.CSharp.Syntax; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; +using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using Microsoft.CodeAnalysis.CSharp.Syntax; -using Terraria.Graphics.Shaders; namespace CalamityMod.Projectiles.Typeless { diff --git a/Projectiles/Typeless/CryonicShield.cs b/Projectiles/Typeless/CryonicShield.cs index b24447514c..cf4f131080 100644 --- a/Projectiles/Typeless/CryonicShield.cs +++ b/Projectiles/Typeless/CryonicShield.cs @@ -1,7 +1,7 @@ -using CalamityMod.CalPlayer; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.CalPlayer; using CalamityMod.NPCs; using CalamityMod.NPCs.AcidRain; -using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; diff --git a/Projectiles/Typeless/CursorProj.cs b/Projectiles/Typeless/CursorProj.cs index 059f41d89a..c27d89b830 100644 --- a/Projectiles/Typeless/CursorProj.cs +++ b/Projectiles/Typeless/CursorProj.cs @@ -2,9 +2,9 @@ using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Typeless { public class CursorProj : ModProjectile, ILocalizedModType @@ -32,7 +32,7 @@ namespace CalamityMod.Projectiles.Typeless if (Projectile.alpha > 0) Projectile.alpha -= 15; - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; if (Projectile.timeLeft > 285) return; @@ -133,7 +133,7 @@ namespace CalamityMod.Projectiles.Typeless if (Main.rand.NextBool(18)) { Vector2 rotateSecondDust = -Vector2.UnitX.RotatedByRandom(0.39269909262657166).RotatedBy((double)Projectile.velocity.ToRotation(), default); - int greenDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 107, 0f, 0f, 155, default, 0.8f); + int greenDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.TerraBlade, 0f, 0f, 155, default, 0.8f); Main.dust[greenDust].velocity *= 0.3f; Main.dust[greenDust].position = Projectile.Center + rotateSecondDust * (float)Projectile.width / 2f; if (Main.rand.NextBool()) @@ -164,13 +164,13 @@ namespace CalamityMod.Projectiles.Typeless Main.dust[crystalDust2].noGravity = true; } Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.2f / 255f, (255 - Projectile.alpha) * 0.2f / 255f, (255 - Projectile.alpha) * 0.2f / 255f); - int paleDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width - 28, Projectile.height - 28, 234, 0f, 0f, 100, default, 0.8f); + int paleDust = Dust.NewDust(Projectile.position, Projectile.width - 28, Projectile.height - 28, DustID.BoneTorch, 0f, 0f, 100, default, 0.8f); Main.dust[paleDust].velocity *= 0.1f; Main.dust[paleDust].velocity += Projectile.velocity * 0.5f; Main.dust[paleDust].noGravity = true; if (Main.rand.NextBool(12)) { - int shinyDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width - 32, Projectile.height - 32, 159, 0f, 0f, 100, default, 1f); + int shinyDust = Dust.NewDust(Projectile.position, Projectile.width - 32, Projectile.height - 32, DustID.Teleporter, 0f, 0f, 100, default, 1f); Main.dust[shinyDust].velocity *= 0.25f; Main.dust[shinyDust].velocity += Projectile.velocity * 0.5f; } diff --git a/Projectiles/Typeless/CursorProjSplit.cs b/Projectiles/Typeless/CursorProjSplit.cs index f107778b0b..3271984fc2 100644 --- a/Projectiles/Typeless/CursorProjSplit.cs +++ b/Projectiles/Typeless/CursorProjSplit.cs @@ -2,9 +2,9 @@ using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Typeless { public class CursorProjSplit : ModProjectile, ILocalizedModType @@ -34,7 +34,7 @@ namespace CalamityMod.Projectiles.Typeless if (Projectile.alpha > 0) Projectile.alpha -= 3; - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; float aiTrack = 5f; float scaleFactor = 6f; @@ -135,7 +135,7 @@ namespace CalamityMod.Projectiles.Typeless if (Main.rand.NextBool(18)) { Vector2 rotateSecondDust = -Vector2.UnitX.RotatedByRandom(0.39269909262657166).RotatedBy((double)Projectile.velocity.ToRotation(), default); - int greenDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 107, 0f, 0f, 155, default, 0.8f); + int greenDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.TerraBlade, 0f, 0f, 155, default, 0.8f); Main.dust[greenDust].velocity *= 0.3f; Main.dust[greenDust].position = Projectile.Center + rotateSecondDust * (float)Projectile.width / 2f; if (Main.rand.NextBool()) @@ -166,13 +166,13 @@ namespace CalamityMod.Projectiles.Typeless Main.dust[crystalDust2].noGravity = true; } Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.2f / 255f, (255 - Projectile.alpha) * 0.2f / 255f, (255 - Projectile.alpha) * 0.2f / 255f); - int paleDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width - 28, Projectile.height - 28, 234, 0f, 0f, 100, default, 0.8f); + int paleDust = Dust.NewDust(Projectile.position, Projectile.width - 28, Projectile.height - 28, DustID.BoneTorch, 0f, 0f, 100, default, 0.8f); Main.dust[paleDust].velocity *= 0.1f; Main.dust[paleDust].velocity += Projectile.velocity * 0.5f; Main.dust[paleDust].noGravity = true; if (Main.rand.NextBool(12)) { - int shinyDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width - 32, Projectile.height - 32, 159, 0f, 0f, 100, default, 1f); + int shinyDust = Dust.NewDust(Projectile.position, Projectile.width - 32, Projectile.height - 32, DustID.Teleporter, 0f, 0f, 100, default, 1f); Main.dust[shinyDust].velocity *= 0.25f; Main.dust[shinyDust].velocity += Projectile.velocity * 0.5f; } @@ -221,14 +221,14 @@ namespace CalamityMod.Projectiles.Typeless int dustCount; for (int j = 0; j < 20; j = dustCount + 1) { - int superRandomDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, otherDustType, 0f, 0f, 200, default, crystalDust2); + int superRandomDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, otherDustType, 0f, 0f, 200, default, crystalDust2); Dust dust = Main.dust[superRandomDust]; dust.position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; dust.noGravity = true; dust.velocity.Y -= 6f; dust.velocity *= 3f; dust.velocity += dustVel * Main.rand.NextFloat(); - superRandomDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDust, 0f, 0f, 100, default, 0.6f); + superRandomDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, randomDust, 0f, 0f, 100, default, 0.6f); dust.position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; dust.velocity.Y -= 6f; dust.velocity *= 2f; @@ -241,7 +241,7 @@ namespace CalamityMod.Projectiles.Typeless for (int k = 0; k < 10; k = dustCount + 1) { - int palestDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 234, 0f, 0f, 0, default, 1.5f); + int palestDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.BoneTorch, 0f, 0f, 0, default, 1.5f); Main.dust[palestDust].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)Projectile.velocity.ToRotation(), default) * (float)Projectile.width / 3f; Dust dust = Main.dust[palestDust]; dust.noGravity = true; diff --git a/Projectiles/Typeless/CyanLabSeeker.cs b/Projectiles/Typeless/CyanLabSeeker.cs index a7a56edae2..f876fb8975 100644 --- a/Projectiles/Typeless/CyanLabSeeker.cs +++ b/Projectiles/Typeless/CyanLabSeeker.cs @@ -48,7 +48,7 @@ namespace CalamityMod.Projectiles.Typeless public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; if (Time > 80f && Projectile.ai[1] == 0f) { for (int i = 0; i < 24; i += 2) diff --git a/Projectiles/Typeless/DarkIce.cs b/Projectiles/Typeless/DarkIce.cs index e74fc84d3c..bc65e2df07 100644 --- a/Projectiles/Typeless/DarkIce.cs +++ b/Projectiles/Typeless/DarkIce.cs @@ -1,10 +1,10 @@ -using CalamityMod.Buffs.StatDebuffs; +using System; +using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Typeless { @@ -41,7 +41,7 @@ namespace CalamityMod.Projectiles.Typeless } //make pretty dust - int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 172, Projectile.velocity.X, Projectile.velocity.Y, 0, default, 1.25f); + int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.DungeonWater, Projectile.velocity.X, Projectile.velocity.Y, 0, default, 1.25f); Main.dust[index2].noGravity = true; } @@ -61,7 +61,7 @@ namespace CalamityMod.Projectiles.Typeless SoundEngine.PlaySound(SoundID.Item27, Projectile.position); for (int i = 0; i < 30; i++) { - int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 172, 0f, 0f, 0, default, Main.rand.NextFloat(1f, 2f)); + int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.DungeonWater, 0f, 0f, 0, default, Main.rand.NextFloat(1f, 2f)); Main.dust[index2].noGravity = true; Main.dust[index2].velocity *= 4f; } diff --git a/Projectiles/Typeless/DeepseaBlaze.cs b/Projectiles/Typeless/DeepseaBlaze.cs index afffc48e1a..d23c7925f4 100644 --- a/Projectiles/Typeless/DeepseaBlaze.cs +++ b/Projectiles/Typeless/DeepseaBlaze.cs @@ -1,5 +1,5 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -75,7 +75,7 @@ namespace CalamityMod.Projectiles.Typeless randAdjust = rand3 / randAdjust; rand1 *= randAdjust; rand2 *= randAdjust; - int fiery = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 127, 0f, 0f, 100, default, 1.5f); + int fiery = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Flare, 0f, 0f, 100, default, 1.5f); Dust dust = Main.dust[fiery]; dust.noGravity = true; dust.position.X = Projectile.Center.X; diff --git a/Projectiles/Typeless/DemonshadeRedDevil.cs b/Projectiles/Typeless/DemonshadeRedDevil.cs index 8d2b584ef3..5a1b926bbd 100644 --- a/Projectiles/Typeless/DemonshadeRedDevil.cs +++ b/Projectiles/Typeless/DemonshadeRedDevil.cs @@ -1,8 +1,8 @@ -using CalamityMod.CalPlayer; +using System; +using CalamityMod.CalPlayer; using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -255,8 +255,8 @@ namespace CalamityMod.Projectiles.Typeless public override bool PreDraw(ref Color lightColor) { SpriteEffects spriteEffects = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Texture2D texture2D13 = ModContent.Request(Texture).Value; - int framing = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; + Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + int framing = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; int y6 = framing * Projectile.frame; Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)framing / 2f), Projectile.scale, spriteEffects, 0); return false; diff --git a/Projectiles/Typeless/DevourerofCodsBobber.cs b/Projectiles/Typeless/DevourerofCodsBobber.cs index 820ce41b7c..d982a7b5df 100644 --- a/Projectiles/Typeless/DevourerofCodsBobber.cs +++ b/Projectiles/Typeless/DevourerofCodsBobber.cs @@ -1,5 +1,4 @@ -using CalamityMod.Items.Fishing.FishingRods; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; @@ -10,13 +9,6 @@ namespace CalamityMod.Projectiles.Typeless public class DevourerofCodsBobber : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Typeless"; - private bool initialized = false; - private Color fishingLineColor; - public Color[] PossibleLineColors = new Color[] - { - new Color(252, 109, 202, 100), //a pink color - new Color(39, 151, 171, 100) // a blue color - }; public override void SetDefaults() { @@ -24,18 +16,6 @@ namespace CalamityMod.Projectiles.Typeless Projectile.height = 14; Projectile.aiStyle = ProjAIStyleID.Bobber; Projectile.bobber = true; - Projectile.penetrate = -1; - } - - //What if we want to randomize the line color - public override void AI() - { - if (!initialized) - { - //Decide color of the pole by randomizing the array - fishingLineColor = Main.rand.Next(PossibleLineColors); - initialized = true; - } } //fuck glowmasks btw @@ -60,7 +40,7 @@ namespace CalamityMod.Projectiles.Typeless public override bool PreDrawExtras() { Lighting.AddLight(Projectile.Center, 0.35f, 0f, 0.25f); - return Projectile.DrawFishingLine(ModContent.ItemType(), fishingLineColor); + return true; } } } diff --git a/Projectiles/Typeless/DirectStrike.cs b/Projectiles/Typeless/DirectStrike.cs index 90e1de3c2f..00e5e29391 100644 --- a/Projectiles/Typeless/DirectStrike.cs +++ b/Projectiles/Typeless/DirectStrike.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Typeless diff --git a/Projectiles/Typeless/DragonDust.cs b/Projectiles/Typeless/DragonDust.cs index 11c1c056ad..9bb257a7d1 100644 --- a/Projectiles/Typeless/DragonDust.cs +++ b/Projectiles/Typeless/DragonDust.cs @@ -1,8 +1,10 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Typeless { public class DragonDust : ModProjectile, ILocalizedModType @@ -18,6 +20,8 @@ namespace CalamityMod.Projectiles.Typeless Projectile.ignoreWater = true; Projectile.tileCollide = false; Projectile.penetrate = -1; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 3; } public override void AI() @@ -67,7 +71,7 @@ namespace CalamityMod.Projectiles.Typeless randAdjust = rand3 / randAdjust; rand1 *= randAdjust; rand2 *= randAdjust; - int dragonDuster = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 1.5f); + int dragonDuster = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 100, default, 1.5f); Dust dust = Main.dust[dragonDuster]; dust.noGravity = true; dust.position.X = Projectile.Center.X; @@ -80,11 +84,7 @@ namespace CalamityMod.Projectiles.Typeless } } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.immune[Projectile.owner] = 0; - target.AddBuff(ModContent.BuffType(), 120); - } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 120); public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 120); } diff --git a/Projectiles/Typeless/EarlyBloomBobber.cs b/Projectiles/Typeless/EarlyBloomBobber.cs index a5e1bd6b25..742e557260 100644 --- a/Projectiles/Typeless/EarlyBloomBobber.cs +++ b/Projectiles/Typeless/EarlyBloomBobber.cs @@ -1,6 +1,4 @@ -using CalamityMod.Items.Fishing.FishingRods; -using Microsoft.Xna.Framework; -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Typeless @@ -14,13 +12,12 @@ namespace CalamityMod.Projectiles.Typeless Projectile.height = 14; Projectile.aiStyle = ProjAIStyleID.Bobber; Projectile.bobber = true; - Projectile.penetrate = -1; } public override bool PreDrawExtras() { Lighting.AddLight(Projectile.Center, 0.1f, 0.5f, 0.15f); - return Projectile.DrawFishingLine(ModContent.ItemType(), new Color(190, 140, 69, 100)); + return true; } } } diff --git a/Projectiles/Typeless/EmpyreanBlast.cs b/Projectiles/Typeless/EmpyreanBlast.cs index a2ef4103a7..16329b871a 100644 --- a/Projectiles/Typeless/EmpyreanBlast.cs +++ b/Projectiles/Typeless/EmpyreanBlast.cs @@ -1,6 +1,7 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Typeless @@ -68,7 +69,7 @@ namespace CalamityMod.Projectiles.Typeless randAdjust = rand3 / randAdjust; rand1 *= randAdjust; rand2 *= randAdjust; - int ourpleDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 62, 0f, 0f, 100, default, 1f); + int ourpleDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.PurpleTorch, 0f, 0f, 100, default, 1f); Dust dust = Main.dust[ourpleDust]; dust.noGravity = true; dust.position.X = Projectile.Center.X; diff --git a/Projectiles/Typeless/EmpyreanEmber.cs b/Projectiles/Typeless/EmpyreanEmber.cs index db48cb33a7..38c29652f3 100644 --- a/Projectiles/Typeless/EmpyreanEmber.cs +++ b/Projectiles/Typeless/EmpyreanEmber.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Typeless @@ -48,7 +49,7 @@ namespace CalamityMod.Projectiles.Typeless Projectile.rotation += Projectile.velocity.X * 0.1f; if (Main.rand.NextBool(3)) { - int ourpleDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 62, 0f, 0f, 100, default, 0.75f); + int ourpleDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.PurpleTorch, 0f, 0f, 100, default, 0.75f); Dust dust2 = Main.dust[ourpleDust]; dust2.position.X -= 2f; dust2.position.Y += 2f; @@ -58,7 +59,7 @@ namespace CalamityMod.Projectiles.Typeless } else { - int ourpleDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 62, 0f, 0f, 100, default, 0.75f); + int ourpleDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.PurpleTorch, 0f, 0f, 100, default, 0.75f); Dust dust = Main.dust[ourpleDust2]; dust.position.X -= 2f; dust.position.Y += 2f; diff --git a/Projectiles/Typeless/EmpyreanGlob.cs b/Projectiles/Typeless/EmpyreanGlob.cs index 0e8e864e0f..e37baee7dd 100644 --- a/Projectiles/Typeless/EmpyreanGlob.cs +++ b/Projectiles/Typeless/EmpyreanGlob.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Typeless @@ -23,7 +24,7 @@ namespace CalamityMod.Projectiles.Typeless Projectile.localAI[0] += 1f; if (Projectile.localAI[0] > 4f) { - int ourpleDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 62, 0f, 0f, 100, default, 1f); + int ourpleDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.PurpleTorch, 0f, 0f, 100, default, 1f); Main.dust[ourpleDust].noGravity = true; Main.dust[ourpleDust].velocity *= 0f; } diff --git a/Projectiles/Typeless/EmpyreanMarble.cs b/Projectiles/Typeless/EmpyreanMarble.cs index 704be03a85..1b778ace31 100644 --- a/Projectiles/Typeless/EmpyreanMarble.cs +++ b/Projectiles/Typeless/EmpyreanMarble.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Typeless @@ -21,7 +22,7 @@ namespace CalamityMod.Projectiles.Typeless public override void AI() { - int ourpleDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 62, 0f, 0f, 100, default, 2f); + int ourpleDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.PurpleTorch, 0f, 0f, 100, default, 2f); Main.dust[ourpleDust].noGravity = true; Main.dust[ourpleDust].velocity *= 0f; CalamityUtils.HomeInOnNPC(Projectile, true, 200f, 7f, 20f); diff --git a/Projectiles/Typeless/EmpyreanStellarDetritus.cs b/Projectiles/Typeless/EmpyreanStellarDetritus.cs index ff3a085054..3a758b25e4 100644 --- a/Projectiles/Typeless/EmpyreanStellarDetritus.cs +++ b/Projectiles/Typeless/EmpyreanStellarDetritus.cs @@ -1,6 +1,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Typeless @@ -26,7 +27,7 @@ namespace CalamityMod.Projectiles.Typeless Projectile.localAI[0] += 1f; if (Projectile.localAI[0] > 4f) { - int ourpleDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 62, 0f, 0f, 100, default, 2f); + int ourpleDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.PurpleTorch, 0f, 0f, 100, default, 2f); Main.dust[ourpleDust].noGravity = true; Main.dust[ourpleDust].velocity *= 0f; } @@ -35,7 +36,7 @@ namespace CalamityMod.Projectiles.Typeless public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } diff --git a/Projectiles/Typeless/EnergyShell.cs b/Projectiles/Typeless/EnergyShell.cs index 058df6f2b1..291cd761a3 100644 --- a/Projectiles/Typeless/EnergyShell.cs +++ b/Projectiles/Typeless/EnergyShell.cs @@ -1,9 +1,9 @@ using CalamityMod.Cooldowns; using CalamityMod.Items.Weapons.Melee; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Typeless { diff --git a/Projectiles/Typeless/FeralDoubleBobber.cs b/Projectiles/Typeless/FeralDoubleBobber.cs index a88f13c31f..018c65693a 100644 --- a/Projectiles/Typeless/FeralDoubleBobber.cs +++ b/Projectiles/Typeless/FeralDoubleBobber.cs @@ -1,6 +1,4 @@ -using CalamityMod.Items.Fishing.FishingRods; -using Microsoft.Xna.Framework; -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Typeless @@ -14,13 +12,12 @@ namespace CalamityMod.Projectiles.Typeless Projectile.height = 14; Projectile.aiStyle = ProjAIStyleID.Bobber; Projectile.bobber = true; - Projectile.penetrate = -1; } public override bool PreDrawExtras() { Lighting.AddLight(Projectile.Center, 0f, 0.25f, 0f); - return Projectile.DrawFishingLine(ModContent.ItemType(), new Color(220, 20, 60, 100)); + return true; } } } diff --git a/Projectiles/Typeless/FlameLickedBarrage.cs b/Projectiles/Typeless/FlameLickedBarrage.cs index e2caebd368..9cf48e17df 100644 --- a/Projectiles/Typeless/FlameLickedBarrage.cs +++ b/Projectiles/Typeless/FlameLickedBarrage.cs @@ -6,7 +6,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Typeless { -public class FlameLickedBarrage : ModProjectile, ILocalizedModType + public class FlameLickedBarrage : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Typeless"; public override string Texture => "CalamityMod/Projectiles/Boss/BrimstoneBarrage"; @@ -48,7 +48,7 @@ public class FlameLickedBarrage : ModProjectile, ILocalizedModType if (Projectile.timeLeft < 60) Projectile.Opacity = MathHelper.Clamp(Projectile.timeLeft / 60f, 0f, 1f); - + Lighting.AddLight(Projectile.Center, 0.75f * Projectile.Opacity, 0f, 0f); } diff --git a/Projectiles/Typeless/FlameLickedHellblast.cs b/Projectiles/Typeless/FlameLickedHellblast.cs index 5b11ec89ce..b9e0ee19ff 100644 --- a/Projectiles/Typeless/FlameLickedHellblast.cs +++ b/Projectiles/Typeless/FlameLickedHellblast.cs @@ -9,7 +9,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Typeless { - public class FlameLickedHellblast : ModProjectile, ILocalizedModType + public class FlameLickedHellblast : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Typeless"; public override string Texture => "CalamityMod/Projectiles/Boss/BrimstoneHellblast"; diff --git a/Projectiles/Typeless/FuckYou.cs b/Projectiles/Typeless/FuckYou.cs index d1e83f41d9..67aef36b36 100644 --- a/Projectiles/Typeless/FuckYou.cs +++ b/Projectiles/Typeless/FuckYou.cs @@ -1,9 +1,9 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Typeless { @@ -65,18 +65,18 @@ namespace CalamityMod.Projectiles.Typeless SoundEngine.PlaySound(SoundID.Item14, Projectile.position); for (int dustIndexA = 0; dustIndexA < 4; dustIndexA = incrementer + 1) { - int smoky = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 31, 0f, 0f, 100, default, 1.5f); + int smoky = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Smoke, 0f, 0f, 100, default, 1.5f); Main.dust[smoky].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(Math.PI) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; incrementer = dustIndexA; } for (int dustIndexB = 0; dustIndexB < 10; dustIndexB = incrementer + 1) { - int fireDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 200, default, 2.7f); + int fireDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 200, default, 2.7f); Dust dust = Main.dust[fireDust]; dust.position = Projectile.Center + Vector2.UnitY.RotatedByRandom(Math.PI) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; dust.noGravity = true; dust.velocity *= 3f; - fireDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 1.5f); + fireDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 1.5f); dust.position = Projectile.Center + Vector2.UnitY.RotatedByRandom(Math.PI) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; dust.velocity *= 2f; dust.noGravity = true; @@ -85,7 +85,7 @@ namespace CalamityMod.Projectiles.Typeless } for (int dustIndexC = 0; dustIndexC < 5; dustIndexC = incrementer + 1) { - int fireDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 0, default, 2.7f); + int fireDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 0, default, 2.7f); Dust dust = Main.dust[fireDust2]; dust.position = Projectile.Center + Vector2.UnitX.RotatedByRandom(Math.PI).RotatedBy((double)Projectile.velocity.ToRotation(), default) * (float)Projectile.width / 2f; dust.noGravity = true; @@ -94,7 +94,7 @@ namespace CalamityMod.Projectiles.Typeless } for (int dustIndexD = 0; dustIndexD < 10; dustIndexD = incrementer + 1) { - int smokier = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 31, 0f, 0f, 0, default, 1.5f); + int smokier = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Smoke, 0f, 0f, 0, default, 1.5f); Dust dust = Main.dust[smokier]; dust.position = Projectile.Center + Vector2.UnitX.RotatedByRandom(Math.PI).RotatedBy((double)Projectile.velocity.ToRotation(), default) * (float)Projectile.width / 2f; dust.noGravity = true; diff --git a/Projectiles/Typeless/FungalClumpMinion.cs b/Projectiles/Typeless/FungalClumpMinion.cs index bfde5b0f40..4b5c5923b8 100644 --- a/Projectiles/Typeless/FungalClumpMinion.cs +++ b/Projectiles/Typeless/FungalClumpMinion.cs @@ -1,7 +1,8 @@ -using CalamityMod.CalPlayer; +using System; +using CalamityMod.Balancing; +using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Healing; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -57,7 +58,7 @@ namespace CalamityMod.Projectiles.Typeless } } - Projectile.damage = (int)player.GetBestClassDamage().ApplyTo(Projectile.originalDamage); + Projectile.damage = (int)player.GetBestClassDamage().ApplyTo(Projectile.originalDamage); //Animation Projectile.frameCounter++; @@ -80,7 +81,7 @@ namespace CalamityMod.Projectiles.Typeless Vector2 spawnPos = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; spawnPos = spawnPos.RotatedBy((double)((float)(i - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + Projectile.Center; Vector2 velocity = spawnPos - Projectile.Center; - int idx = Dust.NewDust(spawnPos + velocity, 0, 0, 56, velocity.X * 1.5f, velocity.Y * 1.5f, 100, default, 1.4f); + int idx = Dust.NewDust(spawnPos + velocity, 0, 0, DustID.BlueFairy, velocity.X * 1.5f, velocity.Y * 1.5f, 100, default, 1.4f); Main.dust[idx].noGravity = true; Main.dust[idx].noLight = true; Main.dust[idx].velocity = velocity; @@ -91,7 +92,7 @@ namespace CalamityMod.Projectiles.Typeless //Periodically create dust if (Main.rand.NextBool(16) && !modPlayer.fungalClumpVanity) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 56, Projectile.velocity.X * 0.05f, Projectile.velocity.Y * 0.05f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.BlueFairy, Projectile.velocity.X * 0.05f, Projectile.velocity.Y * 0.05f); } //Anti-sticky movement failsafe @@ -230,20 +231,17 @@ namespace CalamityMod.Projectiles.Typeless public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - if (!target.canGhostHeal) + if (Main.player[Projectile.owner].moonLeech) return; - float healAmt = damageDone * 0.25f; - if ((int)healAmt == 0) + int heal = (int)Math.Round(damageDone * 0.25); + if (heal > BalancingConstants.LifeStealCap) + heal = BalancingConstants.LifeStealCap; + + if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) return; - if (Main.player[Main.myPlayer].lifeSteal <= 0f) - return; - - if (healAmt > CalamityMod.lifeStealCap) - healAmt = CalamityMod.lifeStealCap; - - CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], healAmt, ModContent.ProjectileType(), 1200f, 3f); + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ModContent.ProjectileType(), BalancingConstants.LifeStealRange, BalancingConstants.LifeStealAccessoryCooldownMultiplier); } public override bool OnTileCollide(Vector2 oldVelocity) => false; diff --git a/Projectiles/Typeless/GemTechArmorGem.cs b/Projectiles/Typeless/GemTechArmorGem.cs index 28d9652699..21dc514a86 100644 --- a/Projectiles/Typeless/GemTechArmorGem.cs +++ b/Projectiles/Typeless/GemTechArmorGem.cs @@ -1,12 +1,12 @@ using CalamityMod.DataStructures; +using CalamityMod.Graphics.Primitives; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using CalamityMod.Graphics.Primitives; namespace CalamityMod.Projectiles.Typeless { @@ -147,7 +147,7 @@ namespace CalamityMod.Projectiles.Typeless { case (int)GemTechArmorGemType.Melee: default: - texture = ModContent.Request(Texture).Value; + texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; break; case (int)GemTechArmorGemType.Ranged: texture = ModContent.Request("CalamityMod/Projectiles/Typeless/GemTechGreenGem").Value; @@ -178,7 +178,6 @@ namespace CalamityMod.Projectiles.Typeless public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { - Projectile.damage = 0; Projectile.velocity = Vector2.Zero; Projectile.timeLeft = ProjectileID.Sets.TrailCacheLength[Projectile.type]; Projectile.netUpdate = true; diff --git a/Projectiles/Typeless/GhostlyBolt.cs b/Projectiles/Typeless/GhostlyBolt.cs index 236e2a67cb..78889af8fa 100644 --- a/Projectiles/Typeless/GhostlyBolt.cs +++ b/Projectiles/Typeless/GhostlyBolt.cs @@ -1,8 +1,8 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Typeless { @@ -33,7 +33,7 @@ namespace CalamityMod.Projectiles.Typeless SoundEngine.PlaySound(SoundID.Item8, Projectile.position); for (int i = 0; i < 40; i++) { - int cursedDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 181, 0f, 0f, 100, default, 1f); + int cursedDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GiantCursedSkullBolt, 0f, 0f, 100, default, 1f); Main.dust[cursedDust].velocity *= 3f; Main.dust[cursedDust].velocity += Projectile.velocity * 0.75f; Main.dust[cursedDust].scale *= 1.2f; @@ -45,7 +45,7 @@ namespace CalamityMod.Projectiles.Typeless { for (int j = 0; j < 3; j++) { - int cursedDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 181, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 100, default, 1f); + int cursedDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GiantCursedSkullBolt, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 100, default, 1f); Main.dust[cursedDust2].velocity *= 0.6f; Main.dust[cursedDust2].scale *= 1.4f; Main.dust[cursedDust2].noGravity = true; diff --git a/Projectiles/Typeless/GodKiller.cs b/Projectiles/Typeless/GodKiller.cs index 561ef29f1b..d353152be2 100644 --- a/Projectiles/Typeless/GodKiller.cs +++ b/Projectiles/Typeless/GodKiller.cs @@ -1,11 +1,11 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Typeless { public class GodKiller : ModProjectile, ILocalizedModType @@ -34,7 +34,7 @@ namespace CalamityMod.Projectiles.Typeless if (Projectile.alpha > 0) Projectile.alpha -= 5; - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; if (Projectile.owner == Main.myPlayer && Projectile.timeLeft <= 3) { Projectile.tileCollide = false; @@ -61,11 +61,11 @@ namespace CalamityMod.Projectiles.Typeless shortXVel = Projectile.velocity.X * 0.5f; shortYVel = Projectile.velocity.Y * 0.5f; } - int dusting = Dust.NewDust(new Vector2(Projectile.position.X + 3f + shortXVel, Projectile.position.Y + 3f + shortYVel) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 173, 0f, 0f, 100, default, 1f); + int dusting = Dust.NewDust(new Vector2(Projectile.position.X + 3f + shortXVel, Projectile.position.Y + 3f + shortYVel) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, DustID.ShadowbeamStaff, 0f, 0f, 100, default, 1f); Main.dust[dusting].scale *= 1f + (float)Main.rand.Next(5) * 0.1f; Main.dust[dusting].velocity *= 0.2f; Main.dust[dusting].noGravity = true; - dusting = Dust.NewDust(new Vector2(Projectile.position.X + 3f + shortXVel, Projectile.position.Y + 3f + shortYVel) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 199, 0f, 0f, 100, default, 0.1f); + dusting = Dust.NewDust(new Vector2(Projectile.position.X + 3f + shortXVel, Projectile.position.Y + 3f + shortYVel) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, DustID.Butterfly, 0f, 0f, 100, default, 0.1f); Main.dust[dusting].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; Main.dust[dusting].velocity *= 0.05f; } @@ -85,7 +85,7 @@ namespace CalamityMod.Projectiles.Typeless SoundEngine.PlaySound(SoundID.Item89, Projectile.position); for (int j = 0; j < 5; j++) { - int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 199, 0f, 0f, 100, default, 1.5f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Butterfly, 0f, 0f, 100, default, 1.5f); Main.dust[dust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -95,10 +95,10 @@ namespace CalamityMod.Projectiles.Typeless } for (int k = 0; k < 10; k++) { - int dust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 2f); + int dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, 0f, 0f, 100, default, 2f); Main.dust[dust2].noGravity = true; Main.dust[dust2].velocity *= 5f; - dust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 1.5f); + dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, 0f, 0f, 100, default, 1.5f); Main.dust[dust2].velocity *= 2f; } } diff --git a/Projectiles/Typeless/GodSlayerShrapnel.cs b/Projectiles/Typeless/GodSlayerShrapnel.cs index ca5cc26b24..e539904fcb 100644 --- a/Projectiles/Typeless/GodSlayerShrapnel.cs +++ b/Projectiles/Typeless/GodSlayerShrapnel.cs @@ -1,8 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Typeless { public class GodSlayerShrapnel : ModProjectile, ILocalizedModType @@ -54,7 +54,7 @@ namespace CalamityMod.Projectiles.Typeless Projectile.ai[1] = 1f; SoundEngine.PlaySound(SoundID.Item13, Projectile.position); } - int godDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 0.5f); + int godDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, 0f, 0f, 100, default, 0.5f); Dust dust = Main.dust[godDust]; dust.position.X -= 2f; dust.position.Y += 2f; @@ -63,7 +63,7 @@ namespace CalamityMod.Projectiles.Typeless dust.velocity.Y -= 2f; if (Main.rand.NextBool()) { - int godDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 0.5f); + int godDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, 0f, 0f, 100, default, 0.5f); Dust dust2 = Main.dust[godDust2]; dust2.position.X -= 2f; dust2.position.Y += 2f; diff --git a/Projectiles/Typeless/GodSlayerShrapnelRound.cs b/Projectiles/Typeless/GodSlayerShrapnelRound.cs index 5e8841308e..a02c75a2de 100644 --- a/Projectiles/Typeless/GodSlayerShrapnelRound.cs +++ b/Projectiles/Typeless/GodSlayerShrapnelRound.cs @@ -1,8 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Typeless { public class GodSlayerShrapnelRound : ModProjectile, ILocalizedModType @@ -29,7 +29,7 @@ namespace CalamityMod.Projectiles.Typeless } for (int d = 0; d < 3; d++) { - int cosmilite = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 1.2f); + int cosmilite = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, 0f, 0f, 100, default, 1.2f); Main.dust[cosmilite].noGravity = true; Main.dust[cosmilite].velocity *= 0.5f; Main.dust[cosmilite].velocity += Projectile.velocity * 0.1f; diff --git a/Projectiles/Typeless/GoldenGunProj.cs b/Projectiles/Typeless/GoldenGunProj.cs deleted file mode 100644 index 8f80048492..0000000000 --- a/Projectiles/Typeless/GoldenGunProj.cs +++ /dev/null @@ -1,117 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Typeless -{ - public class GoldenGunProj : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Typeless"; - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public override void SetDefaults() - { - Projectile.width = 8; - Projectile.height = 8; - Projectile.friendly = true; - Projectile.ignoreWater = true; - Projectile.penetrate = 1; - Projectile.alpha = 255; - Projectile.timeLeft = 300; - Projectile.extraUpdates = 2; - } - - public override void AI() - { - if (Projectile.localAI[0] < 5f) - { - Projectile.localAI[0] += 1f; - return; - } - int inc; - for (int i = 0; i < 1; i = inc + 1) - { - for (int j = 0; j < 6; j = inc + 1) - { - float dustX = Projectile.velocity.X / 6f * (float)j; - float dustY = Projectile.velocity.Y / 6f * (float)j; - int dustPosMod = 6; - int goldenDust = Dust.NewDust(new Vector2(Projectile.position.X + (float)dustPosMod, Projectile.position.Y + (float)dustPosMod), Projectile.width - dustPosMod * 2, Projectile.height - dustPosMod * 2, 170, 0f, 0f, 75, default, 1.2f); - Dust dust = Main.dust[goldenDust]; - if (Main.rand.NextBool()) - { - dust.alpha += 25; - } - if (Main.rand.NextBool()) - { - dust.alpha += 25; - } - if (Main.rand.NextBool()) - { - dust.alpha += 25; - } - dust.noGravity = true; - dust.velocity *= 0.3f; - dust.velocity += Projectile.velocity * 0.5f; - dust.position = Projectile.Center; - dust.position.X -= dustX; - dust.position.Y -= dustY; - dust.velocity *= 0.2f; - inc = j; - } - if (Main.rand.NextBool(4)) - { - int dustPosMod2 = 6; - int moreGoldenDust = Dust.NewDust(new Vector2(Projectile.position.X + (float)dustPosMod2, Projectile.position.Y + (float)dustPosMod2), Projectile.width - dustPosMod2 * 2, Projectile.height - dustPosMod2 * 2, 170, 0f, 0f, 75, default, 0.65f); - Dust dust = Main.dust[moreGoldenDust]; - dust.velocity *= 0.5f; - dust.velocity += Projectile.velocity * 0.5f; - } - inc = i; - } - } - - public override void OnKill(int timeLeft) - { - Projectile.velocity = Projectile.oldVelocity * 0.2f; - int inc; - for (int k = 0; k < 100; k = inc + 1) - { - int deathGoldenDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 170, 0f, 0f, 75, default, 1.2f); - Dust dust = Main.dust[deathGoldenDust]; - if (Main.rand.NextBool()) - { - dust.alpha += 25; - } - if (Main.rand.NextBool()) - { - dust.alpha += 25; - } - if (Main.rand.NextBool()) - { - dust.alpha += 25; - } - if (Main.rand.NextBool()) - { - dust.scale = 0.6f; - } - else - { - dust.noGravity = true; - } - dust.velocity *= 0.3f; - dust.velocity += Projectile.velocity; - dust.velocity *= 1f + (float)Main.rand.Next(-100, 101) * 0.01f; - dust.velocity.X += (float)Main.rand.Next(-50, 51) * 0.015f; - dust.velocity.Y += (float)Main.rand.Next(-50, 51) * 0.015f; - dust.position = Projectile.Center; - inc = k; - } - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.Ichor, 480); - - public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(BuffID.Ichor, 480); - } -} diff --git a/Projectiles/Typeless/GreenLabSeeker.cs b/Projectiles/Typeless/GreenLabSeeker.cs index 892ef65504..f9cadeddd6 100644 --- a/Projectiles/Typeless/GreenLabSeeker.cs +++ b/Projectiles/Typeless/GreenLabSeeker.cs @@ -49,7 +49,7 @@ namespace CalamityMod.Projectiles.Typeless public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; if (Time > 80f && Projectile.ai[1] == 0f) { for (int i = 0; i < 24; i += 2) diff --git a/Projectiles/Typeless/HellfireExplosionFriendly2.cs b/Projectiles/Typeless/HellfireExplosionFriendly2.cs index 52ecb09a68..0a824dae70 100644 --- a/Projectiles/Typeless/HellfireExplosionFriendly2.cs +++ b/Projectiles/Typeless/HellfireExplosionFriendly2.cs @@ -1,11 +1,11 @@ +using System; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Typeless { public class HellfireExplosionFriendly2 : ModProjectile, ILocalizedModType @@ -56,7 +56,7 @@ namespace CalamityMod.Projectiles.Typeless randAdjust = rand3 / randAdjust; rand1 *= randAdjust; rand2 *= randAdjust; - int brimDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 0.75f); + int brimDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 0.75f); Dust dust = Main.dust[brimDust]; dust.noGravity = true; dust.position.X = Projectile.Center.X; diff --git a/Projectiles/Typeless/HeronBobber.cs b/Projectiles/Typeless/HeronBobber.cs index fb4b2e8dd6..60e1227d04 100644 --- a/Projectiles/Typeless/HeronBobber.cs +++ b/Projectiles/Typeless/HeronBobber.cs @@ -1,6 +1,4 @@ -using CalamityMod.Items.Fishing.FishingRods; -using Microsoft.Xna.Framework; -using Terraria.ID; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Typeless { @@ -13,12 +11,6 @@ namespace CalamityMod.Projectiles.Typeless Projectile.height = 14; Projectile.aiStyle = ProjAIStyleID.Bobber; Projectile.bobber = true; - Projectile.penetrate = -1; - } - - public override bool PreDrawExtras() - { - return Projectile.DrawFishingLine(ModContent.ItemType(), new Color(101, 149, 154, 100)); } } } diff --git a/Projectiles/Typeless/GodSlayerBlaze.cs b/Projectiles/Typeless/HideOfAstrumDeusExplosion.cs similarity index 79% rename from Projectiles/Typeless/GodSlayerBlaze.cs rename to Projectiles/Typeless/HideOfAstrumDeusExplosion.cs index 0a85c77b34..c0612f7f8d 100644 --- a/Projectiles/Typeless/GodSlayerBlaze.cs +++ b/Projectiles/Typeless/HideOfAstrumDeusExplosion.cs @@ -1,12 +1,12 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Typeless { - public class GodSlayerBlaze : ModProjectile, ILocalizedModType + public class HideOfAstrumDeusExplosion : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Typeless"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; @@ -56,7 +56,7 @@ namespace CalamityMod.Projectiles.Typeless randAdjust = rand3 / randAdjust; rand1 *= randAdjust; rand2 *= randAdjust; - int dusty = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, scale); + int dusty = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, scale); Dust dust = Main.dust[dusty]; if (dustType != 173) dust.color = new Color(255, 255, 255, 0); @@ -73,18 +73,12 @@ namespace CalamityMod.Projectiles.Typeless public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - if (Projectile.ai[1] == 1f) - target.AddBuff(ModContent.BuffType(), 300); - else - target.AddBuff(ModContent.BuffType(), 300); + target.AddBuff(ModContent.BuffType(), 300); } public override void OnHitPlayer(Player target, Player.HurtInfo info) { - if (Projectile.ai[1] == 1f) - target.AddBuff(ModContent.BuffType(), 300); - else - target.AddBuff(ModContent.BuffType(), 300); + target.AddBuff(ModContent.BuffType(), 300); } } } diff --git a/Projectiles/Typeless/HolyExplosion.cs b/Projectiles/Typeless/HolyExplosion.cs index 4fc213896c..d06747a0b7 100644 --- a/Projectiles/Typeless/HolyExplosion.cs +++ b/Projectiles/Typeless/HolyExplosion.cs @@ -1,8 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Typeless { public class HolyExplosion : ModProjectile, ILocalizedModType @@ -34,7 +34,7 @@ namespace CalamityMod.Projectiles.Typeless Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int i = 0; i < 20; i++) { - int holyDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 246, 0f, 0f, 100, default, 2f); + int holyDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GoldCoin, 0f, 0f, 100, default, 2f); Main.dust[holyDust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -44,10 +44,10 @@ namespace CalamityMod.Projectiles.Typeless } for (int j = 0; j < 40; j++) { - int holyDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 246, 0f, 0f, 100, default, 3f); + int holyDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GoldCoin, 0f, 0f, 100, default, 3f); Main.dust[holyDust2].noGravity = true; Main.dust[holyDust2].velocity *= 5f; - holyDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 246, 0f, 0f, 100, default, 2f); + holyDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GoldCoin, 0f, 0f, 100, default, 2f); Main.dust[holyDust2].velocity *= 2f; } } diff --git a/Projectiles/Typeless/HolyExplosionSupreme.cs b/Projectiles/Typeless/HolyExplosionSupreme.cs index fcd51060d5..07be3430a7 100644 --- a/Projectiles/Typeless/HolyExplosionSupreme.cs +++ b/Projectiles/Typeless/HolyExplosionSupreme.cs @@ -1,10 +1,10 @@ -using Microsoft.Xna.Framework; +using Microsoft.CodeAnalysis.CSharp.Syntax; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; +using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using Microsoft.CodeAnalysis.CSharp.Syntax; -using Terraria.Graphics.Shaders; namespace CalamityMod.Projectiles.Typeless { diff --git a/Projectiles/Typeless/HydrothermalSmoke.cs b/Projectiles/Typeless/HydrothermalSmoke.cs index dc762df3e9..7278015b26 100644 --- a/Projectiles/Typeless/HydrothermalSmoke.cs +++ b/Projectiles/Typeless/HydrothermalSmoke.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Projectiles.Typeless } if (Main.rand.NextBool(4)) { - int fieryDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDust, 0f, 0f, 100, default, 1f); + int fieryDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, randomDust, 0f, 0f, 100, default, 1f); if (Main.rand.NextBool(4)) { Main.dust[fieryDust].scale *= 0.35f; @@ -45,7 +45,7 @@ namespace CalamityMod.Projectiles.Typeless Main.dust[fieryDust].velocity *= 0f; } - Vector2 goreVec = new Vector2(Projectile.position.X, Projectile.position.Y); + Vector2 goreVec = Projectile.position; if (Main.rand.NextBool(8) && Main.netMode != NetmodeID.Server) { int smoke = Gore.NewGore(Projectile.GetSource_FromAI(), goreVec, default, Main.rand.Next(375, 378), 0.75f); diff --git a/Projectiles/Typeless/HydrothermicFlare.cs b/Projectiles/Typeless/HydrothermicFlare.cs index e2f12343aa..ecbcaa7ab9 100644 --- a/Projectiles/Typeless/HydrothermicFlare.cs +++ b/Projectiles/Typeless/HydrothermicFlare.cs @@ -1,8 +1,8 @@ using CalamityMod.Buffs.DamageOverTime; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Typeless { public class HydrothermicFlare : ModProjectile, ILocalizedModType @@ -35,7 +35,7 @@ namespace CalamityMod.Projectiles.Typeless for (int i = 0; i < 6; i++) { - int d = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 127, 0f, 0f, 100, default, 1.2f); + int d = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Flare, 0f, 0f, 100, default, 1.2f); Main.dust[d].noGravity = true; Main.dust[d].velocity *= 0.5f; Main.dust[d].velocity += Projectile.velocity * 0.1f; diff --git a/Projectiles/Typeless/HydrothermicFlareRogue.cs b/Projectiles/Typeless/HydrothermicFlareRogue.cs index dd4742380a..cc97baf05e 100644 --- a/Projectiles/Typeless/HydrothermicFlareRogue.cs +++ b/Projectiles/Typeless/HydrothermicFlareRogue.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Typeless { Lighting.AddLight(Projectile.Center, 0.5f, 0.25f, 0f); - int d = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 127, 0f, 0f, 100, default, 2f); + int d = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Flare, 0f, 0f, 100, default, 2f); Main.dust[d].noGravity = true; Main.dust[d].velocity *= 0.5f; Main.dust[d].velocity += Projectile.velocity * 0.1f; diff --git a/Projectiles/Typeless/HydrothermicSphere.cs b/Projectiles/Typeless/HydrothermicSphere.cs index 43b49a9f8f..4973fa9b50 100644 --- a/Projectiles/Typeless/HydrothermicSphere.cs +++ b/Projectiles/Typeless/HydrothermicSphere.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Typeless public override void AI() { - Dust fire = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, 127, 0f, 0f, 100, default, 2f); + Dust fire = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.Flare, 0f, 0f, 100, default, 2f); fire.noGravity = true; fire.velocity = Vector2.Zero; diff --git a/Projectiles/Typeless/JewelSpike.cs b/Projectiles/Typeless/JewelSpike.cs index 8c39b1b58e..ae5ea54418 100644 --- a/Projectiles/Typeless/JewelSpike.cs +++ b/Projectiles/Typeless/JewelSpike.cs @@ -6,8 +6,8 @@ namespace CalamityMod.Projectiles.Typeless public class JewelSpike : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Typeless"; - public ref float RealPenetrate => ref Projectile.ai[0]; - public const int MaxPenetrate = 2; + public ref float RealPenetrate => ref Projectile.ai[0]; + public const int MaxPenetrate = 2; public override void SetStaticDefaults() { @@ -33,7 +33,7 @@ namespace CalamityMod.Projectiles.Typeless if (Main.rand.NextBool(5) && Projectile.frame < 3) { - int crystalDust = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 87, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + int crystalDust = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.GemTopaz, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); Main.dust[crystalDust].noGravity = true; } diff --git a/Projectiles/Typeless/KelvinCatalystStar.cs b/Projectiles/Typeless/KelvinCatalystStar.cs index 7945edcc91..184570c27d 100644 --- a/Projectiles/Typeless/KelvinCatalystStar.cs +++ b/Projectiles/Typeless/KelvinCatalystStar.cs @@ -1,8 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Typeless { @@ -35,41 +35,14 @@ namespace CalamityMod.Projectiles.Typeless } else { - Projectile.extraUpdates = 1; - - Vector2 center = Projectile.Center; - float maxDistance = 500f; - bool homeIn = false; - - for (int i = 0; i < Main.maxNPCs; i++) - { - if (Main.npc[i].CanBeChasedBy(Projectile, false)) - { - float extraDistance = (float)(Main.npc[i].width / 2) + (float)(Main.npc[i].height / 2); - - if (Vector2.Distance(Main.npc[i].Center, Projectile.Center) < (maxDistance + extraDistance) && Collision.CanHit(Projectile.Center, 1, 1, Main.npc[i].Center, 1, 1)) - { - center = Main.npc[i].Center; - homeIn = true; - break; - } - } - } - - if (homeIn) - { - Vector2 moveDirection = Projectile.SafeDirectionTo(center, Vector2.UnitY); - Projectile.velocity = (Projectile.velocity * 20f + moveDirection * 12f) / (21f); - } - else - Projectile.Kill(); + CalamityUtils.HomeInOnNPC(Projectile, true, 500f, 12f, 20f); } Lighting.AddLight(Projectile.Center, Main.DiscoR * 0.075f / 255f, Main.DiscoR * 0.1f / 255f, Main.DiscoR * 0.125f / 255f); if (Main.rand.NextBool(6)) { - int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 67, 0f, 0f, 100, default, 0.4f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.IceRod, 0f, 0f, 100, default, 0.4f); Main.dust[dust].velocity *= 0.3f; Main.dust[dust].noGravity = true; } @@ -98,7 +71,7 @@ namespace CalamityMod.Projectiles.Typeless Vector2 rotate = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; rotate = rotate.RotatedBy((double)((float)(j - (dustAmt / 2 - 1)) * 6.28318548f / (float)dustAmt), default) + Projectile.Center; Vector2 faceDirection = rotate - Projectile.Center; - int icyDust = Dust.NewDust(rotate + faceDirection, 0, 0, 67, faceDirection.X * 0.5f, faceDirection.Y * 0.5f, 100, default, 0.75f); + int icyDust = Dust.NewDust(rotate + faceDirection, 0, 0, DustID.IceRod, faceDirection.X * 0.5f, faceDirection.Y * 0.5f, 100, default, 0.75f); Main.dust[icyDust].noGravity = true; } } diff --git a/Projectiles/Typeless/LeviAmberDash.cs b/Projectiles/Typeless/LeviAmberDash.cs index af40656994..7e9848ebc4 100644 --- a/Projectiles/Typeless/LeviAmberDash.cs +++ b/Projectiles/Typeless/LeviAmberDash.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Projectiles.Typeless public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; public Player Owner => Main.player[Projectile.owner]; private static float ExplosionRadius = 85f; - public static readonly SoundStyle Slap = new("CalamityMod/Sounds/Custom/WetSlap", 4) { Volume = 0.8f, PitchVariance = 0.3f}; + public static readonly SoundStyle Slap = new("CalamityMod/Sounds/Custom/WetSlap", 4) { Volume = 0.8f, PitchVariance = 0.3f }; public override void SetDefaults() { diff --git a/Projectiles/Typeless/LunicBeam.cs b/Projectiles/Typeless/LunicBeam.cs index cdcbcd0404..ffdce3a0c2 100644 --- a/Projectiles/Typeless/LunicBeam.cs +++ b/Projectiles/Typeless/LunicBeam.cs @@ -2,9 +2,9 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Typeless { public class LunicBeam : ModProjectile, ILocalizedModType @@ -129,7 +129,7 @@ namespace CalamityMod.Projectiles.Typeless for (int k = 0; k < 1; k++) { Vector2 rotateSecondDust = -Vector2.UnitX.RotatedByRandom(0.19634954631328583).RotatedBy((double)Projectile.velocity.ToRotation(), default); - int smokyDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 31, 0f, 0f, 100, default, 1f); + int smokyDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Smoke, 0f, 0f, 100, default, 1f); Main.dust[smokyDust].velocity *= 0.1f; Main.dust[smokyDust].position = Projectile.Center + rotateSecondDust * (float)Projectile.width / 2f + Projectile.velocity * 2f; Main.dust[smokyDust].fadeIn = 0.9f; @@ -140,7 +140,7 @@ namespace CalamityMod.Projectiles.Typeless for (int l = 0; l < 1; l++) { Vector2 rotateThirdDust = -Vector2.UnitX.RotatedByRandom(0.39269909262657166).RotatedBy((double)Projectile.velocity.ToRotation(), default); - int smokyDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 31, 0f, 0f, 155, default, 0.8f); + int smokyDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Smoke, 0f, 0f, 155, default, 0.8f); Main.dust[smokyDust2].velocity *= 0.3f; Main.dust[smokyDust2].position = Projectile.Center + rotateThirdDust * (float)Projectile.width / 2f; if (Main.rand.NextBool()) @@ -177,14 +177,14 @@ namespace CalamityMod.Projectiles.Typeless Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.25f / 255f, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.25f / 255f); for (int r = 0; r < 3; r++) { - int moreSolarDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width - 28, Projectile.height - 28, 259, 0f, 0f, 100, default, 1.35f); + int moreSolarDust = Dust.NewDust(Projectile.position, Projectile.width - 28, Projectile.height - 28, DustID.SolarFlare, 0f, 0f, 100, default, 1.35f); Main.dust[moreSolarDust].noGravity = true; Main.dust[moreSolarDust].velocity *= 0.1f; Main.dust[moreSolarDust].velocity += Projectile.velocity * 0.5f; } if (Main.rand.NextBool(8)) { - int mostSolarDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width - 32, Projectile.height - 32, 259, 0f, 0f, 100, default, 1f); + int mostSolarDust = Dust.NewDust(Projectile.position, Projectile.width - 32, Projectile.height - 32, DustID.SolarFlare, 0f, 0f, 100, default, 1f); Main.dust[mostSolarDust].velocity *= 0.25f; Main.dust[mostSolarDust].noGravity = true; Main.dust[mostSolarDust].velocity += Projectile.velocity * 0.5f; @@ -193,7 +193,7 @@ namespace CalamityMod.Projectiles.Typeless public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } @@ -237,13 +237,13 @@ namespace CalamityMod.Projectiles.Typeless 262, 247 }); - int orangeDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, m, 0f, 0f, 200, default, solarDust2); + int orangeDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, m, 0f, 0f, 200, default, solarDust2); Dust dust = Main.dust[orangeDust]; dust.position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; dust.noGravity = true; dust.velocity *= 3f; dust.velocity += dustVel * Main.rand.NextFloat(); - orangeDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDust, 0f, 0f, 100, default, 0.8f); + orangeDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, randomDust, 0f, 0f, 100, default, 0.8f); dust.position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; dust.velocity *= 2f; dust.noGravity = true; @@ -254,7 +254,7 @@ namespace CalamityMod.Projectiles.Typeless } for (int k = 0; k < 20; k = inc + 1) { - int deathSolar = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 259, 0f, 0f, 0, default, 2f); + int deathSolar = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.SolarFlare, 0f, 0f, 0, default, 2f); Dust dust = Main.dust[deathSolar]; dust.position = Projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)Projectile.velocity.ToRotation(), default) * (float)Projectile.width / 3f; dust.noGravity = true; diff --git a/Projectiles/Typeless/MagnusBeam.cs b/Projectiles/Typeless/MagnusBeam.cs index 5c1004dc87..0b17ba7cc9 100644 --- a/Projectiles/Typeless/MagnusBeam.cs +++ b/Projectiles/Typeless/MagnusBeam.cs @@ -1,7 +1,9 @@ -using CalamityMod.Buffs.StatDebuffs; +using System; +using CalamityMod.Balancing; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Projectiles.Healing; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -129,7 +131,7 @@ namespace CalamityMod.Projectiles.Typeless if (Main.rand.NextBool(12)) { Vector2 offset = -Vector2.UnitX.RotatedByRandom(0.2).RotatedBy((double)Projectile.velocity.ToRotation(), default); - int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 234, 0f, 0f, 100, default, 1f); + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.BoneTorch, 0f, 0f, 100, default, 1f); Main.dust[idx].velocity *= 0.1f; Main.dust[idx].position = Projectile.Center + offset * (float)Projectile.width / 2f + Projectile.velocity * 2f; Main.dust[idx].fadeIn = 0.9f; @@ -137,7 +139,7 @@ namespace CalamityMod.Projectiles.Typeless if (Main.rand.NextBool(64)) { Vector2 offset = -Vector2.UnitX.RotatedByRandom(0.4).RotatedBy((double)Projectile.velocity.ToRotation(), default); - int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 234, 0f, 0f, 155, default, 0.8f); + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.BoneTorch, 0f, 0f, 155, default, 0.8f); Main.dust[idx].velocity *= 0.3f; Main.dust[idx].position = Projectile.Center + offset * (float)Projectile.width / 2f; if (Main.rand.NextBool()) @@ -174,7 +176,7 @@ namespace CalamityMod.Projectiles.Typeless for (int i = 0; i < 2; i++) { int sizeFactor = 14; - int idx = Dust.NewDust(Projectile.position, Projectile.width - sizeFactor * 2, Projectile.height - sizeFactor * 2, 263, 0f, 0f, 100, default, 1.35f); + int idx = Dust.NewDust(Projectile.position, Projectile.width - sizeFactor * 2, Projectile.height - sizeFactor * 2, DustID.PortalBolt, 0f, 0f, 100, default, 1.35f); Main.dust[idx].noGravity = true; Main.dust[idx].velocity *= 0.1f; Main.dust[idx].velocity += Projectile.velocity * 0.5f; @@ -182,7 +184,7 @@ namespace CalamityMod.Projectiles.Typeless if (Main.rand.NextBool(8)) { int sizeFactor = 16; - int idx = Dust.NewDust(Projectile.position, Projectile.width - sizeFactor * 2, Projectile.height - sizeFactor * 2, 263, 0f, 0f, 100, default, 1f); + int idx = Dust.NewDust(Projectile.position, Projectile.width - sizeFactor * 2, Projectile.height - sizeFactor * 2, DustID.PortalBolt, 0f, 0f, 100, default, 1f); Main.dust[idx].velocity *= 0.25f; Main.dust[idx].noGravity = true; Main.dust[idx].velocity += Projectile.velocity * 0.5f; @@ -191,7 +193,7 @@ namespace CalamityMod.Projectiles.Typeless public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } @@ -200,14 +202,18 @@ namespace CalamityMod.Projectiles.Typeless { target.AddBuff(ModContent.BuffType(), 480); - if (!target.canGhostHeal || Main.player[Projectile.owner].moonLeech) + Player player = Main.player[Projectile.owner]; + player.statMana += 25; + player.ManaEffect(25); + + int heal = (int)Math.Round(hit.Damage * 0.1); + if (heal > BalancingConstants.LifeStealCap) + heal = BalancingConstants.LifeStealCap; + + if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) return; - Player player = Main.player[Projectile.owner]; - player.statLife += 1; - player.statMana += 25; - player.HealEffect(1); - player.ManaEffect(25); + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ModContent.ProjectileType(), BalancingConstants.LifeStealRange); } public override void OnKill(int timeLeft) @@ -221,7 +227,7 @@ namespace CalamityMod.Projectiles.Typeless Vector2 value3 = (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2(); Vector2 velocity = value3 * Projectile.velocity.Length() * (float)Projectile.MaxUpdates; SoundEngine.PlaySound(SoundID.Item14, Projectile.position); - Projectile.ExpandHitboxBy(height); + Projectile.ExpandHitboxBy(height); Projectile.maxPenetrate = -1; Projectile.penetrate = -1; Projectile.usesLocalNPCImmunity = true; diff --git a/Projectiles/Typeless/NanoFlare.cs b/Projectiles/Typeless/NanoFlare.cs index c72ecd05c3..9a7a34cff4 100644 --- a/Projectiles/Typeless/NanoFlare.cs +++ b/Projectiles/Typeless/NanoFlare.cs @@ -1,8 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Typeless { @@ -25,11 +25,11 @@ namespace CalamityMod.Projectiles.Typeless public override void AI() { //Dust - for (int i = 0; i< 3; i++) + for (int i = 0; i < 3; i++) { - int dint = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 107, 0f, 0f, 0, default, 0.75f); + int dint = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.TerraBlade, 0f, 0f, 0, default, 0.75f); Dust dust = Main.dust[dint]; - dust.velocity = Projectile.velocity * Main.rand.NextFloat(-0.3f,0.3f); + dust.velocity = Projectile.velocity * Main.rand.NextFloat(-0.3f, 0.3f); dust.color = Main.hslToRgb((float)(0.40000000596046448 + Main.rand.NextDouble() * 0.20000000298023224), 0.9f, 0.5f); dust.color = Color.Lerp(dust.color, Color.White, 0.3f); } @@ -40,7 +40,7 @@ namespace CalamityMod.Projectiles.Typeless for (int i = 0; i < 20; i++) { Vector2 dspeed = new Vector2(Main.rand.NextFloat(-4f, 4f), Main.rand.NextFloat(-6f, 6f)); - int dint = Dust.NewDust(Projectile.Center, 1, 1, 107, dspeed.X, dspeed.Y, 0, default, 0.7f); + int dint = Dust.NewDust(Projectile.Center, 1, 1, DustID.TerraBlade, dspeed.X, dspeed.Y, 0, default, 0.7f); Dust dust = Main.dust[dint]; dust.color = Main.hslToRgb((float)(0.40000000596046448 + Main.rand.NextDouble() * 0.20000000298023224), 0.9f, 0.5f); dust.color = Color.Lerp(dust.color, Color.White, 0.3f); diff --git a/Projectiles/Typeless/Nanotech.cs b/Projectiles/Typeless/Nanotech.cs index 616927e7de..a5867ff07c 100644 --- a/Projectiles/Typeless/Nanotech.cs +++ b/Projectiles/Typeless/Nanotech.cs @@ -1,5 +1,6 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Typeless @@ -60,7 +61,7 @@ namespace CalamityMod.Projectiles.Typeless for (int i = 0; i < 2; i = inc + 1) { int dustScale = (int)(10f * Projectile.scale); - int greenDust = Dust.NewDust(Projectile.Center - Vector2.One * (float)dustScale, dustScale * 2, dustScale * 2, 107, 0f, 0f, 0, default, 1f); + int greenDust = Dust.NewDust(Projectile.Center - Vector2.One * (float)dustScale, dustScale * 2, dustScale * 2, DustID.TerraBlade, 0f, 0f, 0, default, 1f); Dust nanoDust = Main.dust[greenDust]; Vector2 dustDirection = Vector2.Normalize(nanoDust.position - Projectile.Center); nanoDust.position = Projectile.Center + dustDirection * (float)dustScale * Projectile.scale; diff --git a/Projectiles/Typeless/NavyBobber.cs b/Projectiles/Typeless/NavyBobber.cs index 0da620f8f6..7d45038fbc 100644 --- a/Projectiles/Typeless/NavyBobber.cs +++ b/Projectiles/Typeless/NavyBobber.cs @@ -1,6 +1,4 @@ -using CalamityMod.Items.Fishing.FishingRods; -using Microsoft.Xna.Framework; -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Typeless @@ -14,13 +12,12 @@ namespace CalamityMod.Projectiles.Typeless Projectile.height = 14; Projectile.aiStyle = ProjAIStyleID.Bobber; Projectile.bobber = true; - Projectile.penetrate = -1; } public override bool PreDrawExtras() { - Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.25f / 255f, (255 - Projectile.alpha) * 0.25f / 255f); - return Projectile.DrawFishingLine(ModContent.ItemType(), new Color(36, 61, 111, 100), 55, 33f); + Lighting.AddLight(Projectile.Center, 0f, 0.25f, 0.25f); + return true; } } } diff --git a/Projectiles/Typeless/NebulaDust.cs b/Projectiles/Typeless/NebulaDust.cs index 568d7ff56d..1577d47e52 100644 --- a/Projectiles/Typeless/NebulaDust.cs +++ b/Projectiles/Typeless/NebulaDust.cs @@ -1,6 +1,6 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Projectiles/Typeless/NebulaStar.cs b/Projectiles/Typeless/NebulaStar.cs index aa9064730c..8c988c24e1 100644 --- a/Projectiles/Typeless/NebulaStar.cs +++ b/Projectiles/Typeless/NebulaStar.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Projectiles.Typeless public override void PostDraw(Color lightColor) { - Rectangle frame = new Rectangle(0, 0, ModContent.Request(Texture).Value.Width, ModContent.Request(Texture).Value.Height); + Rectangle frame = new Rectangle(0, 0, Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Width, Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height); Main.EntitySpriteDraw(ModContent.Request("CalamityMod/Projectiles/Typeless/NebulaStarGlow").Value, Projectile.Center - Main.screenPosition, frame, Color.White * ((255 - Projectile.alpha) / 255f), Projectile.rotation, Projectile.Size / 2, 1f, SpriteEffects.None, 0); } } diff --git a/Projectiles/Typeless/NobodyKnows.cs b/Projectiles/Typeless/NobodyKnows.cs index 3a2ed32d17..f244ee23a3 100644 --- a/Projectiles/Typeless/NobodyKnows.cs +++ b/Projectiles/Typeless/NobodyKnows.cs @@ -1,4 +1,4 @@ -using Terraria.ModLoader; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Typeless { public class NobodyKnows : ModProjectile, ILocalizedModType diff --git a/Projectiles/Typeless/OmegaBlueTentacle.cs b/Projectiles/Typeless/OmegaBlueTentacle.cs index 43a84d9e1f..80e2c60add 100644 --- a/Projectiles/Typeless/OmegaBlueTentacle.cs +++ b/Projectiles/Typeless/OmegaBlueTentacle.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Balancing; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; @@ -146,7 +147,7 @@ namespace CalamityMod.Projectiles.Typeless int limit = (int)(tickVel.Length() / factor); if (limit == 0) { - int d = Dust.NewDust(dustPos, 0, 0, 20, 0, 0, 100, Color.Transparent, 0.9f); + int d = Dust.NewDust(dustPos, 0, 0, DustID.PurificationPowder, 0, 0, 100, Color.Transparent, 0.9f); Main.dust[d].noGravity = true; Main.dust[d].noLight = true; Main.dust[d].fadeIn = 1f; @@ -158,7 +159,7 @@ namespace CalamityMod.Projectiles.Typeless tickVel *= factor; for (int i = 0; i <= limit; i++) { - int d = Dust.NewDust(dustPos, 0, 0, 20, 0, 0, 100, Color.Transparent, 0.9f); + int d = Dust.NewDust(dustPos, 0, 0, DustID.PurificationPowder, 0, 0, 100, Color.Transparent, 0.9f); Main.dust[d].noGravity = true; Main.dust[d].noLight = true; Main.dust[d].fadeIn = 1f; @@ -183,9 +184,12 @@ namespace CalamityMod.Projectiles.Typeless public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - if (Projectile.owner == Main.myPlayer && Main.player[Projectile.owner].lifeSteal > 0f && !Main.player[Projectile.owner].moonLeech) + if (Projectile.owner == Main.myPlayer && Main.player[Projectile.owner].lifeSteal > 0f && !Main.player[Projectile.owner].moonLeech && target.lifeMax > 5) { int healAmount = 10 * damageDone / Projectile.damage; //should always be around max, less if enemy has defense/DR + if (healAmount > BalancingConstants.LifeStealCap) + healAmount = BalancingConstants.LifeStealCap; + if (healAmount > 0) { Main.player[Projectile.owner].lifeSteal -= healAmount; @@ -203,13 +207,34 @@ namespace CalamityMod.Projectiles.Typeless Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); GameShaders.Armor.ApplySecondary(Main.player[Projectile.owner].cBody, Main.player[Projectile.owner], new DrawData?()); - Projectile.rotation = (Projectile.Center - segment[5]).ToRotation(); - Texture2D texture2D13 = ModContent.Request(Texture).Value; - Texture2D segmentSprite = ModContent.Request("CalamityMod/Projectiles/Typeless/OmegaBlueTentacleSegment").Value; - for (int i = 0; i < 6; i++) + Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D segmentSprite = ModContent.Request("CalamityMod/Projectiles/Typeless/OmegaBlueTentacleSegment1").Value; + for (int i = 0; i < 5; i++) { - Main.spriteBatch.Draw(segmentSprite, segment[i] - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), segmentSprite.Bounds, Projectile.GetAlpha(lightColor), 0f, segmentSprite.Bounds.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); + Projectile.rotation = (Projectile.Center - segment[i]).ToRotation(); + switch (i) + { + case 0: + break; + case 1: + segmentSprite = ModContent.Request("CalamityMod/Projectiles/Typeless/OmegaBlueTentacleSegment2").Value; + break; + case 2: + segmentSprite = ModContent.Request("CalamityMod/Projectiles/Typeless/OmegaBlueTentacleSegment3").Value; + break; + case 3: + segmentSprite = ModContent.Request("CalamityMod/Projectiles/Typeless/OmegaBlueTentacleSegment4").Value; + break; + case 4: + segmentSprite = ModContent.Request("CalamityMod/Projectiles/Typeless/OmegaBlueTentacleSegment5").Value; + break; + default: + break; + + } + Main.spriteBatch.Draw(segmentSprite, segment[i] - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), segmentSprite.Bounds, Projectile.GetAlpha(lightColor), Projectile.rotation, segmentSprite.Bounds.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); } + Projectile.rotation = (Projectile.Center - segment[5]).ToRotation(); Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), texture2D13.Bounds, Projectile.GetAlpha(lightColor), Projectile.rotation, texture2D13.Bounds.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); Main.spriteBatch.End(); diff --git a/Projectiles/Typeless/OmegaBlueTentacle.png b/Projectiles/Typeless/OmegaBlueTentacle.png index bbc30be482..bb80c74af9 100644 Binary files a/Projectiles/Typeless/OmegaBlueTentacle.png and b/Projectiles/Typeless/OmegaBlueTentacle.png differ diff --git a/Projectiles/Typeless/OmegaBlueTentacleSegment.png b/Projectiles/Typeless/OmegaBlueTentacleSegment.png deleted file mode 100644 index f14dd0415f..0000000000 Binary files a/Projectiles/Typeless/OmegaBlueTentacleSegment.png and /dev/null differ diff --git a/Projectiles/Typeless/OmegaBlueTentacleSegment1.png b/Projectiles/Typeless/OmegaBlueTentacleSegment1.png new file mode 100644 index 0000000000..26671312b5 Binary files /dev/null and b/Projectiles/Typeless/OmegaBlueTentacleSegment1.png differ diff --git a/Projectiles/Typeless/OmegaBlueTentacleSegment2.png b/Projectiles/Typeless/OmegaBlueTentacleSegment2.png new file mode 100644 index 0000000000..c6d2f3fadb Binary files /dev/null and b/Projectiles/Typeless/OmegaBlueTentacleSegment2.png differ diff --git a/Projectiles/Typeless/OmegaBlueTentacleSegment3.png b/Projectiles/Typeless/OmegaBlueTentacleSegment3.png new file mode 100644 index 0000000000..3317140bd1 Binary files /dev/null and b/Projectiles/Typeless/OmegaBlueTentacleSegment3.png differ diff --git a/Projectiles/Typeless/OmegaBlueTentacleSegment4.png b/Projectiles/Typeless/OmegaBlueTentacleSegment4.png new file mode 100644 index 0000000000..d15eb209bc Binary files /dev/null and b/Projectiles/Typeless/OmegaBlueTentacleSegment4.png differ diff --git a/Projectiles/Typeless/OmegaBlueTentacleSegment5.png b/Projectiles/Typeless/OmegaBlueTentacleSegment5.png new file mode 100644 index 0000000000..4aad0df2b1 Binary files /dev/null and b/Projectiles/Typeless/OmegaBlueTentacleSegment5.png differ diff --git a/Projectiles/Typeless/OnyxLabSeeker.cs b/Projectiles/Typeless/OnyxLabSeeker.cs index e245c8a632..a5bc8e7f78 100644 --- a/Projectiles/Typeless/OnyxLabSeeker.cs +++ b/Projectiles/Typeless/OnyxLabSeeker.cs @@ -48,7 +48,7 @@ namespace CalamityMod.Projectiles.Typeless public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; if (Time > 80f && Projectile.ai[1] == 0f) { for (int i = 0; i < 24; i += 2) diff --git a/Projectiles/Typeless/PendantProjectile1.cs b/Projectiles/Typeless/PendantProjectile1.cs index 35ef3774a6..f04ae59970 100644 --- a/Projectiles/Typeless/PendantProjectile1.cs +++ b/Projectiles/Typeless/PendantProjectile1.cs @@ -1,7 +1,9 @@ +using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Buffs.StatDebuffs; + namespace CalamityMod.Projectiles.Typeless { public class PendantProjectile1 : ModProjectile, ILocalizedModType @@ -24,7 +26,7 @@ namespace CalamityMod.Projectiles.Typeless Projectile.rotation += Projectile.velocity.X * 1.25f; for (int i = 0; i < 5; i++) { - int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 187, 0f, 0f, 100, default, 0.6f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Flare_Blue, 0f, 0f, 100, default, 0.6f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 0.5f; Main.dust[dust].velocity += Projectile.velocity * 0.1f; diff --git a/Projectiles/Typeless/PendantProjectile2.cs b/Projectiles/Typeless/PendantProjectile2.cs index 195d600e90..c50d8c358f 100644 --- a/Projectiles/Typeless/PendantProjectile2.cs +++ b/Projectiles/Typeless/PendantProjectile2.cs @@ -1,7 +1,9 @@ +using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Buffs.StatDebuffs; + namespace CalamityMod.Projectiles.Typeless { public class PendantProjectile2 : ModProjectile, ILocalizedModType @@ -24,7 +26,7 @@ namespace CalamityMod.Projectiles.Typeless Projectile.rotation += Projectile.velocity.X * 1.25f; for (int i = 0; i < 5; i++) { - int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 187, 0f, 0f, 100, default, 0.6f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Flare_Blue, 0f, 0f, 100, default, 0.6f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 0.5f; Main.dust[dust].velocity += Projectile.velocity * 0.1f; diff --git a/Projectiles/Typeless/PendantProjectile3.cs b/Projectiles/Typeless/PendantProjectile3.cs index 982005b4d2..cf8165e20d 100644 --- a/Projectiles/Typeless/PendantProjectile3.cs +++ b/Projectiles/Typeless/PendantProjectile3.cs @@ -1,7 +1,9 @@ +using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Buffs.StatDebuffs; + namespace CalamityMod.Projectiles.Typeless { public class PendantProjectile3 : ModProjectile, ILocalizedModType @@ -26,7 +28,7 @@ namespace CalamityMod.Projectiles.Typeless Projectile.rotation += Projectile.velocity.X * 1.25f; for (int i = 0; i < 5; i++) { - int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 187, 0f, 0f, 100, default, 0.6f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Flare_Blue, 0f, 0f, 100, default, 0.6f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 0.5f; Main.dust[dust].velocity += Projectile.velocity * 0.1f; diff --git a/Projectiles/Typeless/PoisonousSeawater.cs b/Projectiles/Typeless/PoisonousSeawater.cs index fe72306c83..62da40e9d6 100644 --- a/Projectiles/Typeless/PoisonousSeawater.cs +++ b/Projectiles/Typeless/PoisonousSeawater.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -38,7 +38,7 @@ namespace CalamityMod.Projectiles.Typeless } for (int i = 0; i < 2; i++) { - int seaDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDust, 0f, 0f, 100, default, 1f); + int seaDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, randomDust, 0f, 0f, 100, default, 1f); if (randomDust == 89) { Main.dust[seaDust].scale *= 0.35f; diff --git a/Projectiles/Typeless/ReaverOrb.cs b/Projectiles/Typeless/ReaverOrb.cs index 3373a0408c..e2557bb25b 100644 --- a/Projectiles/Typeless/ReaverOrb.cs +++ b/Projectiles/Typeless/ReaverOrb.cs @@ -1,6 +1,7 @@ using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Typeless @@ -51,7 +52,7 @@ namespace CalamityMod.Projectiles.Typeless int dustAmt = 50; for (int d = 0; d < dustAmt; d++) { - int idx = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y + 16f), Projectile.width, Projectile.height - 16, 157, 0f, 0f, 0, default, 1f); + int idx = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y + 16f), Projectile.width, Projectile.height - 16, DustID.ChlorophyteWeapon, 0f, 0f, 0, default, 1f); Main.dust[idx].velocity *= 2f; Main.dust[idx].scale *= 1.15f; } diff --git a/Projectiles/Typeless/ReaverThornBase.cs b/Projectiles/Typeless/ReaverThornBase.cs index 3c3f52d62a..afc80dbf28 100644 --- a/Projectiles/Typeless/ReaverThornBase.cs +++ b/Projectiles/Typeless/ReaverThornBase.cs @@ -60,9 +60,9 @@ namespace CalamityMod.Projectiles.Typeless { for (int i = 0; i < 3; i++) { - Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 18, Projectile.velocity.X * 0.025f, Projectile.velocity.Y * 0.025f, 170, new Color(), 1.2f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CorruptGibs, Projectile.velocity.X * 0.025f, Projectile.velocity.Y * 0.025f, 170, new Color(), 1.2f); } - Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 14, 0f, 0f, 170, new Color(), 1.1f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Demonite, 0f, 0f, 170, new Color(), 1.1f); } if (Projectile.alpha >= 255) @@ -76,7 +76,7 @@ namespace CalamityMod.Projectiles.Typeless // Draw the tip for the final thorn public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; if (Projectile.ai[0] == TotalSegments) texture = ModContent.Request("CalamityMod/Projectiles/Melee/ThornTip").Value; diff --git a/Projectiles/Typeless/RedLabSeeker.cs b/Projectiles/Typeless/RedLabSeeker.cs index 18b5891c52..929d83d3d8 100644 --- a/Projectiles/Typeless/RedLabSeeker.cs +++ b/Projectiles/Typeless/RedLabSeeker.cs @@ -1,7 +1,7 @@ -using CalamityMod.World; +using System; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -92,7 +92,7 @@ namespace CalamityMod.Projectiles.Typeless public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; if (Time > 80f && Projectile.ai[1] == 0f) { for (int i = 0; i < 24; i += 2) diff --git a/Projectiles/Typeless/RelicOfConvergenceCrystal.cs b/Projectiles/Typeless/RelicOfConvergenceCrystal.cs index 304e6bad2c..8887c58242 100644 --- a/Projectiles/Typeless/RelicOfConvergenceCrystal.cs +++ b/Projectiles/Typeless/RelicOfConvergenceCrystal.cs @@ -118,7 +118,7 @@ namespace CalamityMod.Projectiles.Typeless if (Projectile.ai[0] >= CrystalsDrawTime) return true; float opacity = Projectile.ai[0] / CrystalsDrawTime; - Texture2D crystalTexture = ModContent.Request(Texture).Value; + Texture2D crystalTexture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; for (int i = 0; i < TotalCrystalsToDraw; i++) { float angle = MathHelper.TwoPi / TotalCrystalsToDraw * i + Projectile.ai[0] / 10f; diff --git a/Projectiles/Typeless/RelicOfDeliveranceSpear.cs b/Projectiles/Typeless/RelicOfDeliveranceSpear.cs index c6d46408fd..d8d5974075 100644 --- a/Projectiles/Typeless/RelicOfDeliveranceSpear.cs +++ b/Projectiles/Typeless/RelicOfDeliveranceSpear.cs @@ -1,9 +1,9 @@ -using CalamityMod.Dusts; -using CalamityMod.Items.Weapons.Typeless; -using Microsoft.Xna.Framework; -using System; +using System; using System.Collections.Generic; using System.IO; +using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.Typeless; +using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; using Terraria.ID; diff --git a/Projectiles/Typeless/RiftReelerBobber.cs b/Projectiles/Typeless/RiftReelerBobber.cs index ad5d55c1a4..f5b3defd39 100644 --- a/Projectiles/Typeless/RiftReelerBobber.cs +++ b/Projectiles/Typeless/RiftReelerBobber.cs @@ -1,6 +1,4 @@ -using CalamityMod.Items.Fishing.FishingRods; -using Microsoft.Xna.Framework; -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Typeless @@ -8,13 +6,6 @@ namespace CalamityMod.Projectiles.Typeless public class RiftReelerBobber : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Typeless"; - private bool initialized = false; - private Color fishingLineColor; - public Color[] PossibleLineColors = new Color[] - { - new Color(255, 165, 0, 100), //an orange color - new Color(0, 206, 209, 100) // a blue color - }; public override void SetDefaults() { @@ -22,27 +13,15 @@ namespace CalamityMod.Projectiles.Typeless Projectile.height = 14; Projectile.aiStyle = ProjAIStyleID.Bobber; Projectile.bobber = true; - Projectile.penetrate = -1; - } - - //What if we want to randomize the line color - public override void AI() - { - if (!initialized) - { - //Decide color of the pole by randomizing the array - fishingLineColor = Main.rand.Next(PossibleLineColors); - initialized = true; - } } public override bool PreDrawExtras() { - if (fishingLineColor == PossibleLineColors[0]) + if (Projectile.ai[2] == 0f) Lighting.AddLight(Projectile.Center, 0.5f, 0.25f, 0f); else Lighting.AddLight(Projectile.Center, 0f, 0.45f, 0.46f); - return Projectile.DrawFishingLine(ModContent.ItemType(), fishingLineColor, 65, 30f); + return true; } } } diff --git a/Projectiles/Typeless/SabatonBoom.cs b/Projectiles/Typeless/SabatonBoom.cs index fe932df801..4a7a7d32bb 100644 --- a/Projectiles/Typeless/SabatonBoom.cs +++ b/Projectiles/Typeless/SabatonBoom.cs @@ -1,6 +1,6 @@ +using CalamityMod.Buffs.DamageOverTime; using Terraria; using Terraria.ModLoader; -using CalamityMod.Buffs.DamageOverTime; namespace CalamityMod.Projectiles.Typeless { public class SabatonBoom : ModProjectile, ILocalizedModType diff --git a/Projectiles/Typeless/SabatonSlam.cs b/Projectiles/Typeless/SabatonSlam.cs index 657a3c1b07..8abe1134e2 100644 --- a/Projectiles/Typeless/SabatonSlam.cs +++ b/Projectiles/Typeless/SabatonSlam.cs @@ -1,13 +1,13 @@ -using CalamityMod.Dusts; +using System; +using CalamityMod.Dusts; +using CalamityMod.Particles; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; +using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using Microsoft.Xna.Framework.Graphics; -using Terraria.Graphics.Shaders; -using System; -using CalamityMod.Particles; namespace CalamityMod.Projectiles.Typeless { @@ -57,15 +57,15 @@ namespace CalamityMod.Projectiles.Typeless Projectile.localAI[0]++; } - - + + } public override bool PreDraw(ref Color lightColor) { Main.spriteBatch.EnterShaderRegion(); Texture2D telegraphBase = ModContent.Request("CalamityMod/Projectiles/InvisibleProj").Value; - GameShaders.Misc["CalamityMod:CircularGradientWithEdge"].UseOpacity(0.75f * Projectile.timeLeft/(float)timeLeft); + GameShaders.Misc["CalamityMod:CircularGradientWithEdge"].UseOpacity(0.75f * Projectile.timeLeft / (float)timeLeft); GameShaders.Misc["CalamityMod:CircularGradientWithEdge"].UseColor(Color.Lerp(Color.Cyan, Color.LightCyan, 0.5f)); GameShaders.Misc["CalamityMod:CircularGradientWithEdge"].UseSecondaryColor(Color.White); GameShaders.Misc["CalamityMod:CircularGradientWithEdge"].UseSaturation(scaleFromFall); @@ -73,7 +73,7 @@ namespace CalamityMod.Projectiles.Typeless GameShaders.Misc["CalamityMod:CircularGradientWithEdge"].Apply(); Vector2 drawPosition = Projectile.Center - Main.screenPosition; - Main.EntitySpriteDraw(telegraphBase, drawPosition, null, lightColor, 0, telegraphBase.Size() / 2f, scaleFromFall*156f, 0, 0); + Main.EntitySpriteDraw(telegraphBase, drawPosition, null, lightColor, 0, telegraphBase.Size() / 2f, scaleFromFall * 156f, 0, 0); Main.spriteBatch.ExitShaderRegion(); return false; diff --git a/Projectiles/Typeless/SandBall.cs b/Projectiles/Typeless/SandBall.cs index bde7a7fa57..b07b7f1ff3 100644 --- a/Projectiles/Typeless/SandBall.cs +++ b/Projectiles/Typeless/SandBall.cs @@ -1,109 +1,118 @@ -using CalamityMod.Tiles.Abyss; +using System; +using CalamityMod.Tiles.Abyss; using CalamityMod.Tiles.AstralDesert; using CalamityMod.Tiles.SunkenSea; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Typeless { - public class AstralSandBallFalling : ModProjectile, ILocalizedModType + public class AstralSandBallFalling : SandBall { - public new string LocalizationCategory => "Projectiles.Typeless"; public override string Texture => "CalamityMod/Projectiles/Typeless/SandBallAstral"; - public override void SetDefaults() => Projectile.FallingSandSetup(false); - public override void AI() => Projectile.FallingSandAI(108, false); - public override void OnKill(int timeLeft) => Projectile.SpawnSand(ModContent.TileType(), ModContent.ItemType()); + public override bool Fired => false; + public override int TileType => ModContent.TileType(); + public override int ItemType => ModContent.ItemType(); + public override int DustType => 108; } - public class AstralSandBallGun : ModProjectile, ILocalizedModType + public class AstralSandBallGun : SandBall { - public new string LocalizationCategory => "Projectiles.Typeless"; public override string Texture => "CalamityMod/Projectiles/Typeless/SandBallAstral"; - public override void SetDefaults() => Projectile.FallingSandSetup(); - public override void AI() => Projectile.FallingSandAI(108); - public override void OnKill(int timeLeft) => Projectile.SpawnSand(ModContent.TileType(), ModContent.ItemType()); + public override int TileType => ModContent.TileType(); + public override int ItemType => ModContent.ItemType(); + public override int DustType => 108; } - public class EutrophicSandBallGun : ModProjectile, ILocalizedModType + public class EutrophicSandBallGun : SandBall { - public new string LocalizationCategory => "Projectiles.Typeless"; public override string Texture => "CalamityMod/Projectiles/Typeless/SandBallEutrophic"; - public override void SetDefaults() => Projectile.FallingSandSetup(); - public override void AI() => Projectile.FallingSandAI(108); // Weirdly same dusts as Astral - public override void OnKill(int timeLeft) => Projectile.SpawnSand(ModContent.TileType(), ModContent.ItemType()); + public override int TileType => ModContent.TileType(); + public override int ItemType => ModContent.ItemType(); + public override int DustType => 108; // Weirdly same dusts as Astral } - public class SulphurousSandBallGun : ModProjectile, ILocalizedModType + public class SulphurousSandBallGun : SandBall { - public new string LocalizationCategory => "Projectiles.Typeless"; public override string Texture => "CalamityMod/Projectiles/Typeless/SandBallSulphurous"; - public override void SetDefaults() => Projectile.FallingSandSetup(); - public override void AI() => Projectile.FallingSandAI(32); - public override void OnKill(int timeLeft) => Projectile.SpawnSand(ModContent.TileType(), ModContent.ItemType()); + public override int TileType => ModContent.TileType(); + public override int ItemType => ModContent.ItemType(); + // Uses normal sand dust } // All the setups go here to prevent mass blocks of copypasting - public static partial class FallingSandUtils + public abstract class SandBall : ModProjectile, ILocalizedModType { - internal static void FallingSandSetup(this Projectile proj, bool fired = true) - { - proj.knockBack = 6f; - proj.width = proj.height = 10; - proj.friendly = true; - proj.penetrate = -1; + public new string LocalizationCategory => "Projectiles.Typeless"; - if (fired) + // Whether or not it is a fired projectile + public virtual bool Fired => true; + // Associated tile type + public virtual int TileType => TileID.Sand; + // Associated item type + public virtual int ItemType => ItemID.SandBlock; + // Associated dust type + public virtual int DustType => DustID.Sand; + + public override void SetDefaults() + { + Projectile.knockBack = 6f; + Projectile.width = Projectile.height = 10; + Projectile.friendly = true; + Projectile.penetrate = -1; + + if (Fired) { - proj.MaxUpdates = 2; - proj.DamageType = DamageClass.Ranged; + Projectile.MaxUpdates = 2; + Projectile.DamageType = DamageClass.Ranged; } else - proj.hostile = true; + Projectile.hostile = true; } - public static void FallingSandAI(this Projectile proj, int DustID, bool fired = true) + // Using clones will not allow for custom dust types sadly + public override void AI() { if (Main.rand.NextBool()) { - int i = Dust.NewDust(proj.position, proj.width, proj.height, DustID); + int i = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustType); Main.dust[i].velocity.X *= 0.4f; - Main.dust[i].velocity.Y += fired ? 0f : proj.velocity.Y * 0.5f; + Main.dust[i].velocity.Y += Fired ? 0f : Projectile.velocity.Y * 0.5f; } - proj.ai[1]++; - proj.rotation += 0.1f; - if (proj.ai[1] >= 60f || !fired) + Projectile.ai[1]++; + Projectile.rotation += 0.1f; + if (Projectile.ai[1] >= 60f || !Fired) { - proj.ai[1] = 60f; - proj.velocity.Y += 0.2f; + Projectile.ai[1] = 60f; + Projectile.velocity.Y += 0.2f; } - if (proj.velocity.Y > 10f) - proj.velocity.Y = 10f; + if (Projectile.velocity.Y > 10f) + Projectile.velocity.Y = 10f; - Point p = proj.Center.ToTileCoordinates(); + Point p = Projectile.Center.ToTileCoordinates(); // Don't check out of bounds if (p.X < 0 || p.X >= Main.maxTilesX || p.Y < 0 || p.Y >= Main.maxTilesY) return; Tile placer = Main.tile[p.X, p.Y + 1]; - if (placer.HasTile && TileID.Sets.Platforms[placer.TileType] && proj.ai[1] >= 60f) - proj.Kill(); + if (placer.HasTile && TileID.Sets.Platforms[placer.TileType] && Projectile.ai[1] >= 60f) + Projectile.Kill(); } - public static void SpawnSand(this Projectile proj, int SandBlockID, int SandItemID) + public override void OnKill(int timeLeft) { - Point p = proj.Center.ToTileCoordinates(); + Point p = Projectile.Center.ToTileCoordinates(); // If the sand is dying outside the world border, cancel placing sand. if (p.X < 0 || p.X >= Main.maxTilesX || p.Y < 0 || p.Y >= Main.maxTilesY) return; Tile placer = Main.tile[p.X, p.Y]; // If the sand hit a half brick, but was mostly going downwards (at a lower than 45 degree angle), then stack atop the half brick. - if (placer.IsHalfBlock && proj.velocity.Y > 0f && Math.Abs(proj.velocity.Y) > Math.Abs(proj.velocity.X)) + if (placer.IsHalfBlock && Projectile.velocity.Y > 0f && Math.Abs(Projectile.velocity.Y) > Math.Abs(Projectile.velocity.X)) placer = Main.tile[p.X, --p.Y]; - + bool ValidTileBelow = true; bool SlopeTileBelow = false; @@ -125,22 +134,22 @@ namespace CalamityMod.Projectiles.Typeless if (ValidTileBelow) { - bool PlacedBlock = WorldGen.PlaceTile(p.X, p.Y, SandBlockID, false, true); + bool PlacedBlock = WorldGen.PlaceTile(p.X, p.Y, TileType, false, true); WorldGen.SquareTileFrame(p.X, p.Y); if (PlacedBlock && SlopeTileBelow) { WorldGen.SlopeTile(p.X, p.Y + 1); - if (Main.netMode != NetmodeID.SinglePlayer) - NetMessage.SendData(MessageID.TileManipulation, -1, -1, null, 14, p.X, p.Y + 1); + if (Main.netMode != NetmodeID.SinglePlayer) + NetMessage.SendData(MessageID.TileManipulation, -1, -1, null, 14, p.X, p.Y + 1); } if (PlacedBlock && Main.netMode != NetmodeID.SinglePlayer) - NetMessage.SendData(MessageID.TileManipulation, -1, -1, null, 1, p.X, p.Y, SandBlockID); + NetMessage.SendData(MessageID.TileManipulation, -1, -1, null, 1, p.X, p.Y, TileType); } } // Give the block back if you literally can't place it else - Item.NewItem(proj.GetSource_DropAsItem(), proj.position, proj.width, proj.height, SandItemID); + Item.NewItem(Projectile.GetSource_DropAsItem(), Projectile.position, Projectile.width, Projectile.height, ItemType); } } } diff --git a/Projectiles/Typeless/SandCloakVeil.cs b/Projectiles/Typeless/SandCloakVeil.cs index 25d26d9fb9..966e7c3f66 100644 --- a/Projectiles/Typeless/SandCloakVeil.cs +++ b/Projectiles/Typeless/SandCloakVeil.cs @@ -1,9 +1,12 @@ using CalamityMod.DataStructures; +using CalamityMod.Items.Accessories; using CalamityMod.NPCs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Typeless { public class SandCloakVeil : ModProjectile, ILocalizedModType @@ -23,7 +26,7 @@ namespace CalamityMod.Projectiles.Typeless Projectile.timeLeft = duration; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 10; - Projectile.scale = 1.2f; + Projectile.scale = 1.2f; } public override void AI() @@ -42,7 +45,7 @@ namespace CalamityMod.Projectiles.Typeless public override bool PreDraw(ref Color lightColor) { // Sprite Circle - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; float scaleStep = 0.03f; float rotationOffset = 0.03f; Color drawCol = Projectile.GetAlpha(lightColor); @@ -69,7 +72,7 @@ namespace CalamityMod.Projectiles.Typeless Vector2 dustPos = dustCircle.RandomPointInCircle(); if ((dustPos - Projectile.Center).Length() > 48) { - int dustIndex = Dust.NewDust(dustPos, 1, 1, 32); + int dustIndex = Dust.NewDust(dustPos, 1, 1, DustID.Sand); Main.dust[dustIndex].noGravity = true; Main.dust[dustIndex].fadeIn = 1f; Vector2 dustVelocity = Projectile.Center - Main.dust[dustIndex].position; @@ -94,7 +97,7 @@ namespace CalamityMod.Projectiles.Typeless // 12AUG2023: Ozzatron: TML was giving NaN knockback, probably due to 0 base knockback. Do not use hit.Knockback if (CalamityGlobalNPC.ShouldAffectNPC(target)) { - float knockbackMultiplier = MathHelper.Clamp(1f - target.knockBackResist, 0f, 1f); + float knockbackMultiplier = SandCloak.KnockbackStrength * MathHelper.Clamp(1f - target.knockBackResist, 0f, 1f); Vector2 trueKnockback = target.Center - Projectile.Center; trueKnockback.Normalize(); target.velocity = trueKnockback * knockbackMultiplier; diff --git a/Projectiles/Typeless/SandExplosion.cs b/Projectiles/Typeless/SandExplosion.cs index 413d47008a..f8b8b64d13 100644 --- a/Projectiles/Typeless/SandExplosion.cs +++ b/Projectiles/Typeless/SandExplosion.cs @@ -1,5 +1,6 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Typeless @@ -28,7 +29,7 @@ namespace CalamityMod.Projectiles.Typeless { Vector2 dustspeed = new Vector2(5f, 5f).RotatedBy(MathHelper.ToRadians(i)); float size = Main.rand.NextFloat(1.1f, 1.6f); - int d = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, 85, dustspeed.X, dustspeed.Y, 0, default, size); + int d = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, DustID.UnusedBrown, dustspeed.X, dustspeed.Y, 0, default, size); Main.dust[d].noGravity = true; Main.dust[d].position = Projectile.Center; } diff --git a/Projectiles/Typeless/SepulcherSoul.cs b/Projectiles/Typeless/SepulcherSoul.cs index a09096636e..8d42f839a1 100644 --- a/Projectiles/Typeless/SepulcherSoul.cs +++ b/Projectiles/Typeless/SepulcherSoul.cs @@ -1,5 +1,5 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; diff --git a/Projectiles/Typeless/ShadowflameExplosion.cs b/Projectiles/Typeless/ShadowflameExplosion.cs index 01bee85184..e4b62a9966 100644 --- a/Projectiles/Typeless/ShadowflameExplosion.cs +++ b/Projectiles/Typeless/ShadowflameExplosion.cs @@ -1,8 +1,8 @@ -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using Microsoft.Xna.Framework; namespace CalamityMod.Projectiles.Typeless { diff --git a/Projectiles/Typeless/ShadowflameExplosionBig.cs b/Projectiles/Typeless/ShadowflameExplosionBig.cs index d66e0851d3..b9fb142420 100644 --- a/Projectiles/Typeless/ShadowflameExplosionBig.cs +++ b/Projectiles/Typeless/ShadowflameExplosionBig.cs @@ -1,8 +1,8 @@ -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using Microsoft.Xna.Framework; namespace CalamityMod.Projectiles.Typeless { diff --git a/Projectiles/Typeless/SkyFlareFriendly.cs b/Projectiles/Typeless/SkyFlareFriendly.cs index 3d69cbc6ff..13d6819e0d 100644 --- a/Projectiles/Typeless/SkyFlareFriendly.cs +++ b/Projectiles/Typeless/SkyFlareFriendly.cs @@ -1,9 +1,9 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Typeless { @@ -40,7 +40,7 @@ namespace CalamityMod.Projectiles.Typeless Projectile.frame = 0; } - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; Lighting.AddLight(Projectile.Center, 0.7f, 0.3f, 0f); } @@ -61,7 +61,7 @@ namespace CalamityMod.Projectiles.Typeless Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int i = 0; i < 4; i++) { - int skyDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); + int skyDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 100, default, 2f); Main.dust[skyDust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -71,10 +71,10 @@ namespace CalamityMod.Projectiles.Typeless } for (int j = 0; j < 12; j++) { - int skyDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 3f); + int skyDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 100, default, 3f); Main.dust[skyDust2].noGravity = true; Main.dust[skyDust2].velocity *= 5f; - skyDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); + skyDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 100, default, 2f); Main.dust[skyDust2].velocity *= 2f; } diff --git a/Projectiles/Typeless/SlimeStream.cs b/Projectiles/Typeless/SlimeStream.cs index 9f86125bd0..6add7fc448 100644 --- a/Projectiles/Typeless/SlimeStream.cs +++ b/Projectiles/Typeless/SlimeStream.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Projectiles/Typeless/SlurperBobber.cs b/Projectiles/Typeless/SlurperBobber.cs index 3b9353d7ef..d40f8d235b 100644 --- a/Projectiles/Typeless/SlurperBobber.cs +++ b/Projectiles/Typeless/SlurperBobber.cs @@ -1,6 +1,4 @@ -using CalamityMod.Items.Fishing.FishingRods; -using Microsoft.Xna.Framework; -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Typeless @@ -14,13 +12,12 @@ namespace CalamityMod.Projectiles.Typeless Projectile.height = 14; Projectile.aiStyle = ProjAIStyleID.Bobber; Projectile.bobber = true; - Projectile.penetrate = -1; } public override bool PreDrawExtras() { Lighting.AddLight(Projectile.Center, 0.25f, 0f, 0f); - return Projectile.DrawFishingLine(ModContent.ItemType(), new Color(227, 79, 79, 100)); + return true; } } } diff --git a/Projectiles/Typeless/SpiritOriginBullseye.cs b/Projectiles/Typeless/SpiritOriginBullseye.cs index c18a8b439f..6239f1dfcf 100644 --- a/Projectiles/Typeless/SpiritOriginBullseye.cs +++ b/Projectiles/Typeless/SpiritOriginBullseye.cs @@ -1,7 +1,7 @@ -using CalamityMod.Items.Accessories; +using System.IO; +using CalamityMod.Items.Accessories; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System.IO; using Terraria; using Terraria.ModLoader; diff --git a/Projectiles/Typeless/StandingFire.cs b/Projectiles/Typeless/StandingFire.cs index b1c3b82708..15aa36b3ff 100644 --- a/Projectiles/Typeless/StandingFire.cs +++ b/Projectiles/Typeless/StandingFire.cs @@ -2,9 +2,9 @@ using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Typeless { public class StandingFire : ModProjectile, ILocalizedModType @@ -89,7 +89,7 @@ namespace CalamityMod.Projectiles.Typeless public override bool OnTileCollide(Vector2 oldVelocity) => false; public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 120); - + public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 120); } } diff --git a/Projectiles/Typeless/StarStruckWaterBottle.cs b/Projectiles/Typeless/StarStruckWaterBottle.cs index eb0739de67..d87214f258 100644 --- a/Projectiles/Typeless/StarStruckWaterBottle.cs +++ b/Projectiles/Typeless/StarStruckWaterBottle.cs @@ -1,9 +1,9 @@ using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Terraria; -using Terraria.ModLoader; -using Terraria.ID; using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Typeless { @@ -37,7 +37,7 @@ namespace CalamityMod.Projectiles.Typeless { SoundEngine.PlaySound(SoundID.Shatter, Projectile.position); for (int index = 0; index < 5; ++index) - Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 13, 0f, 0f, 0, new Color(), 1f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Glass, 0f, 0f, 0, new Color(), 1f); for (int index1 = 0; index1 < 30; ++index1) { int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType(), 0f, -2f, 0, new Color(), 1.1f); diff --git a/Projectiles/Typeless/StickyFeatherAero.cs b/Projectiles/Typeless/StickyFeatherAero.cs index a5092d1b74..ca6585e9d3 100644 --- a/Projectiles/Typeless/StickyFeatherAero.cs +++ b/Projectiles/Typeless/StickyFeatherAero.cs @@ -1,8 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Typeless { public class StickyFeatherAero : ModProjectile, ILocalizedModType @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.Typeless Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int i = 0; i < 15; i++) { - int blueDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 206, 0f, 0f, 100, default, 1.2f); + int blueDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.UnusedWhiteBluePurple, 0f, 0f, 100, default, 1.2f); Main.dust[blueDust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -53,10 +53,10 @@ namespace CalamityMod.Projectiles.Typeless } for (int j = 0; j < 30; j++) { - int blueDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 206, 0f, 0f, 100, default, 1.7f); + int blueDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.UnusedWhiteBluePurple, 0f, 0f, 100, default, 1.7f); Main.dust[blueDust2].noGravity = true; Main.dust[blueDust2].velocity *= 5f; - blueDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 206, 0f, 0f, 100, default, 1f); + blueDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.UnusedWhiteBluePurple, 0f, 0f, 100, default, 1f); Main.dust[blueDust2].velocity *= 2f; } } diff --git a/Projectiles/Typeless/SuicideBomberDemon.cs b/Projectiles/Typeless/SuicideBomberDemon.cs index 909fa94286..fb665cd92b 100644 --- a/Projectiles/Typeless/SuicideBomberDemon.cs +++ b/Projectiles/Typeless/SuicideBomberDemon.cs @@ -1,13 +1,13 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; +using System; using System.IO; +using CalamityMod.Graphics.Primitives; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using CalamityMod.Graphics.Primitives; namespace CalamityMod.Projectiles.Typeless { diff --git a/Projectiles/Typeless/SulphuricAcidBubbleFriendly.cs b/Projectiles/Typeless/SulphuricAcidBubbleFriendly.cs index c636b151e4..39500ded01 100644 --- a/Projectiles/Typeless/SulphuricAcidBubbleFriendly.cs +++ b/Projectiles/Typeless/SulphuricAcidBubbleFriendly.cs @@ -1,4 +1,4 @@ -using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -101,8 +101,8 @@ namespace CalamityMod.Projectiles.Typeless public override bool PreDraw(ref Color lightColor) { - Texture2D texture2D13 = ModContent.Request(Texture).Value; - int framing = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; + Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + int framing = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; int y6 = framing * Projectile.frame; Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)framing / 2f), Projectile.scale, SpriteEffects.None, 0); return false; @@ -138,7 +138,7 @@ namespace CalamityMod.Projectiles.Typeless int inc; for (int i = 0; i < 25; i = inc + 1) { - int toxicDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 31, 0f, 0f, 0, default, 1f); + int toxicDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Smoke, 0f, 0f, 0, default, 1f); Main.dust[toxicDust].position = (Main.dust[toxicDust].position + Projectile.position) / 2f; Main.dust[toxicDust].velocity = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); Main.dust[toxicDust].velocity.Normalize(); diff --git a/Projectiles/Typeless/TarraEnergy.cs b/Projectiles/Typeless/TarraEnergy.cs index dbcbf4179d..35c30797b4 100644 --- a/Projectiles/Typeless/TarraEnergy.cs +++ b/Projectiles/Typeless/TarraEnergy.cs @@ -1,5 +1,6 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Typeless @@ -37,7 +38,7 @@ namespace CalamityMod.Projectiles.Typeless float x2 = Projectile.position.X - Projectile.velocity.X / 10f * (float)i; float y2 = Projectile.position.Y - Projectile.velocity.Y / 10f * (float)i; Vector2 dspeed = Projectile.velocity * Main.rand.NextFloat(0.7f, 0.4f); - int greenDust = Dust.NewDust(new Vector2(x2, y2), 1, 1, 107, 0f, 0f, 0, default, 1f); + int greenDust = Dust.NewDust(new Vector2(x2, y2), 1, 1, DustID.TerraBlade, 0f, 0f, 0, default, 1f); Main.dust[greenDust].alpha = Projectile.alpha; Main.dust[greenDust].position.X = x2; Main.dust[greenDust].position.Y = y2; diff --git a/Projectiles/Typeless/TarragonAura.cs b/Projectiles/Typeless/TarragonAura.cs index ee77732eb7..134c0824d4 100644 --- a/Projectiles/Typeless/TarragonAura.cs +++ b/Projectiles/Typeless/TarragonAura.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Typeless diff --git a/Projectiles/Typeless/TerminusHoldout.cs b/Projectiles/Typeless/TerminusHoldout.cs index ec89caa8ee..5014080271 100644 --- a/Projectiles/Typeless/TerminusHoldout.cs +++ b/Projectiles/Typeless/TerminusHoldout.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Projectiles.Typeless public override void AI() { Time++; - if (!Owner.channel || Owner.noItems || Owner.CCed) + if (Owner.CantUseHoldout()) { // Reset the boss rush timer to what it would normally be if disabling is done prematurely. if (BossRushEvent.BossRushActive || BossRushEvent.StartTimer > 0) @@ -161,7 +161,7 @@ namespace CalamityMod.Projectiles.Typeless public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Main.zenithWorld ? ModContent.Request("CalamityMod/Items/SummonItems/Terminus_GFB").Value : ModContent.Request(Texture).Value; + Texture2D texture = Main.zenithWorld ? ModContent.Request("CalamityMod/Items/SummonItems/Terminus_GFB").Value : Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Vector2 baseDrawPosition = Projectile.Center - Main.screenPosition; Vector2 origin = texture.Size() * 0.5f; Color baseColor = Color.Lerp(Projectile.GetAlpha(lightColor), Color.White, Utils.GetLerpValue(40f, 120f, Time, true)); diff --git a/Projectiles/Typeless/TeslaAura.cs b/Projectiles/Typeless/TeslaAura.cs index 0b9c21cd41..547f4c5a17 100644 --- a/Projectiles/Typeless/TeslaAura.cs +++ b/Projectiles/Typeless/TeslaAura.cs @@ -1,7 +1,7 @@ -using CalamityMod.NPCs; -using CalamityMod.NPCs.AcidRain; +using CalamityMod.Buffs.Potions; using CalamityMod.Buffs.StatDebuffs; -using CalamityMod.Buffs.Potions; +using CalamityMod.NPCs; +using CalamityMod.NPCs.AcidRain; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -93,7 +93,7 @@ namespace CalamityMod.Projectiles.Typeless public override bool PreDraw(ref Color lightColor) { - Texture2D sprite = ModContent.Request(Texture).Value; + Texture2D sprite = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Color drawColour = Color.White; Rectangle sourceRect = new Rectangle(Projectile.width * (int)Projectile.localAI[1], Projectile.height * (int)Projectile.localAI[0], Projectile.width, Projectile.height); diff --git a/Projectiles/Typeless/VanquisherArrowSplit.cs b/Projectiles/Typeless/VanquisherArrowSplit.cs deleted file mode 100644 index 4a88fefe27..0000000000 --- a/Projectiles/Typeless/VanquisherArrowSplit.cs +++ /dev/null @@ -1,63 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Typeless -{ - public class VanquisherArrowSplit : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Typeless"; - public override string Texture => "CalamityMod/Items/Ammo/VanquisherArrow"; - - public override void SetDefaults() - { - Projectile.width = 22; - Projectile.height = 22; - Projectile.friendly = true; - Projectile.arrow = true; - Projectile.timeLeft = 90; - Projectile.penetrate = 1; - Projectile.extraUpdates = 1; - } - - public override void AI() - { - Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; - CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 200f, 12f, 20f); - } - - public override void PostDraw(Color lightColor) - { - if (Projectile.timeLeft < 90) - { - Vector2 origin = new Vector2(0f, 0f); - Color color = Color.White; - if (Projectile.timeLeft < 85) - { - byte b2 = (byte)(Projectile.timeLeft * 3); - byte a2 = (byte)(100f * (b2 / 255f)); - color = new Color(b2, b2, b2, a2); - } - Texture2D baseTexture = ModContent.Request(Texture).Value; - Rectangle frame = new Rectangle(0, 0, baseTexture.Width, baseTexture.Height); - Main.EntitySpriteDraw(ModContent.Request("CalamityMod/Items/Ammo/VanquisherArrowGlow").Value, Projectile.Center - Main.screenPosition, frame, color, Projectile.rotation, Projectile.Size / 2, 1f, SpriteEffects.None, 0); - } - } - - public override Color? GetAlpha(Color lightColor) - { - if (Projectile.timeLeft < 85) - { - byte b2 = (byte)(Projectile.timeLeft * 3); - byte a2 = (byte)(100f * (b2 / 255f)); - return new Color(b2, b2, b2, a2); - } - return new Color(0, 0, 0, 0); - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 120); - - public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 120); - } -} diff --git a/Projectiles/Typeless/VerstaltiteBobber.cs b/Projectiles/Typeless/VerstaltiteBobber.cs index 645e7bca4d..2bf9b3e8cd 100644 --- a/Projectiles/Typeless/VerstaltiteBobber.cs +++ b/Projectiles/Typeless/VerstaltiteBobber.cs @@ -1,6 +1,4 @@ -using CalamityMod.Items.Fishing.FishingRods; -using Microsoft.Xna.Framework; -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Typeless @@ -10,19 +8,16 @@ namespace CalamityMod.Projectiles.Typeless public new string LocalizationCategory => "Projectiles.Typeless"; public override void SetDefaults() { - //projectile.CloneDefaults(360); //Wooden Bobber Projectile.width = 14; Projectile.height = 14; Projectile.aiStyle = ProjAIStyleID.Bobber; Projectile.bobber = true; - Projectile.penetrate = -1; } public override bool PreDrawExtras() { Lighting.AddLight(Projectile.Center, 0.4f, 0f, 0.4f); - CalamityUtils.DrawFishingLine(Projectile, ModContent.ItemType(), new Color(95, 158, 160, 100)); - return false; + return true; } } } diff --git a/Projectiles/Typeless/VoidFieldGenerator.cs b/Projectiles/Typeless/VoidFieldGenerator.cs index caa0c96e8e..b345f5684f 100644 --- a/Projectiles/Typeless/VoidFieldGenerator.cs +++ b/Projectiles/Typeless/VoidFieldGenerator.cs @@ -1,10 +1,10 @@ using CalamityMod.CalPlayer; +using CalamityMod.Graphics.Metaballs; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using CalamityMod.Graphics.Metaballs; namespace CalamityMod.Projectiles.Typeless { @@ -68,7 +68,7 @@ namespace CalamityMod.Projectiles.Typeless Vector2 dustpos = Vector2.UnitX * (float)-(float)proj.width / 2f; dustpos += -Vector2.UnitY.RotatedBy((double)((float)i * 3.14159274f / 6f), default) * new Vector2(8f, 16f); dustpos = dustpos.RotatedBy((double)(proj.rotation - 1.57079637f), default); - int dust = Dust.NewDust(proj.Center, 0, 0, 27, 0f, 0f, 100, Color.HotPink, 1f); + int dust = Dust.NewDust(proj.Center, 0, 0, DustID.Shadowflame, 0f, 0f, 100, Color.HotPink, 1f); Main.dust[dust].scale = 1.1f; Main.dust[dust].noGravity = true; Main.dust[dust].position = proj.Center + dustpos; diff --git a/Projectiles/Typeless/WhiteLabSeeker.cs b/Projectiles/Typeless/WhiteLabSeeker.cs index 41d87e8849..374eae49c3 100644 --- a/Projectiles/Typeless/WhiteLabSeeker.cs +++ b/Projectiles/Typeless/WhiteLabSeeker.cs @@ -48,7 +48,7 @@ namespace CalamityMod.Projectiles.Typeless public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; if (Time > 80f && Projectile.ai[1] == 0f) { for (int i = 0; i < 24; i += 2) diff --git a/Projectiles/Typeless/WulfrumBobber.cs b/Projectiles/Typeless/WulfrumBobber.cs index 0259c37b7c..3202e14bcd 100644 --- a/Projectiles/Typeless/WulfrumBobber.cs +++ b/Projectiles/Typeless/WulfrumBobber.cs @@ -1,6 +1,4 @@ -using CalamityMod.Items.Fishing.FishingRods; -using Microsoft.Xna.Framework; -using Terraria.ID; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Typeless { @@ -13,12 +11,6 @@ namespace CalamityMod.Projectiles.Typeless Projectile.height = 14; Projectile.aiStyle = ProjAIStyleID.Bobber; Projectile.bobber = true; - Projectile.penetrate = -1; - } - - public override bool PreDrawExtras() - { - return Projectile.DrawFishingLine(ModContent.ItemType(), new Color(200, 200, 200, 100), 38, 28f); } } } diff --git a/Projectiles/Typeless/WulfrumDiggingTurtleProjectile.cs b/Projectiles/Typeless/WulfrumDiggingTurtleProjectile.cs index e4bca301dd..46beb0c945 100644 --- a/Projectiles/Typeless/WulfrumDiggingTurtleProjectile.cs +++ b/Projectiles/Typeless/WulfrumDiggingTurtleProjectile.cs @@ -1,15 +1,15 @@ using System; +using CalamityMod.Items.Materials; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Utilities; using Terraria; using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; -using Terraria.GameContent; -using CalamityMod.Items.Materials; -using Terraria.DataStructures; -using ReLogic.Utilities; namespace CalamityMod.Projectiles.Typeless { @@ -91,16 +91,16 @@ namespace CalamityMod.Projectiles.Typeless idleSoundOut.Position = Projectile.Center; } - + //Heavy cutting sound if ((!SoundEngine.TryGetActiveSound(CuttingSoundSlot, out var cuttingSoundOut))) - CuttingSoundSlot = SoundEngine.PlaySound(CuttingSound with { Volume = CuttingSound.Volume }, Projectile.Center); + CuttingSoundSlot = SoundEngine.PlaySound(CuttingSound with { Volume = CuttingSound.Volume }, Projectile.Center); else if (cuttingSoundOut != null) { cuttingSoundOut.Volume = CuttingVolume; cuttingSoundOut.Position = Projectile.Center; } - + if (Diggging) @@ -120,14 +120,14 @@ namespace CalamityMod.Projectiles.Typeless CuttingVolume -= 0.1f; float fallSpeed = Projectile.velocity.Y; - + if (Projectile.timeLeft < 345) Projectile.velocity += Vector2.UnitY * 0.5f * (1 - Math.Clamp((Projectile.timeLeft - 310f) / 35f, 0f, 1f)); Projectile.velocity *= 0.98f; if (Projectile.velocity.Y > 0) - Projectile.velocity.Y = Math.Clamp(Projectile.velocity.Y, 0, Math.Max(18f, fallSpeed)); + Projectile.velocity.Y = Math.Clamp(Projectile.velocity.Y, 0, Math.Max(18f, fallSpeed)); Projectile.rotation = Projectile.velocity.ToRotation(); } @@ -195,7 +195,7 @@ namespace CalamityMod.Projectiles.Typeless if (!tile.HasTile) return; - int pickPower = Math.Min( Owner.GetBestPickPower(), MaxPickPower); + int pickPower = Math.Min(Owner.GetBestPickPower(), MaxPickPower); int pickaxeRequirement = tile.GetRequiredPickPower(x, y); bool true_ = true; @@ -216,7 +216,7 @@ namespace CalamityMod.Projectiles.Typeless public override bool PreDraw(ref Color lightColor) { - Texture2D texture = TextureAssets.Projectile[Type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; GearTexture = ModContent.Request("CalamityMod/Projectiles/Typeless/WulfrumDiggingTurtle_Gear").Value; diff --git a/Projectiles/Typeless/WulfrumDrillProj.cs b/Projectiles/Typeless/WulfrumDrillProj.cs index 12d6ee5f48..05eb75eab1 100644 --- a/Projectiles/Typeless/WulfrumDrillProj.cs +++ b/Projectiles/Typeless/WulfrumDrillProj.cs @@ -1,7 +1,7 @@ -using CalamityMod.Items.Tools; +using System; +using CalamityMod.Items.Tools; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -73,7 +73,7 @@ namespace CalamityMod.Projectiles.Typeless if (Main.rand.NextBool(6)) { - Dust whirrDust = Dust.NewDustDirect(Projectile.position + Projectile.velocity * Main.rand.Next(6, 10) * 0.1f, Projectile.width, Projectile.height, 31, 0f, 0f, 80, Scale: 1.4f) ; + Dust whirrDust = Dust.NewDustDirect(Projectile.position + Projectile.velocity * Main.rand.Next(6, 10) * 0.1f, Projectile.width, Projectile.height, DustID.Smoke, 0f, 0f, 80, Scale: 1.4f); whirrDust.position.X -= 4f; whirrDust.noGravity = true; whirrDust.velocity *= 0.2f; @@ -87,9 +87,9 @@ namespace CalamityMod.Projectiles.Typeless if (!Projectile.active) return false; - Texture2D tex = ModContent.Request(Texture).Value; + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Vector2 origin = new Vector2(9f, tex.Height / 2f); - Vector2 shake = Main.rand.NextVector2Circular(1f, 1f) * ((float)Math.Sin(Main.GlobalTimeWrappedHourly ) * 0.25f + 0.75f); + Vector2 shake = Main.rand.NextVector2Circular(1f, 1f) * ((float)Math.Sin(Main.GlobalTimeWrappedHourly) * 0.25f + 0.75f); SpriteEffects effect = SpriteEffects.None; if (Owner.direction * Owner.gravDir < 0) effect = SpriteEffects.FlipVertically; diff --git a/Projectiles/Typeless/WulfrumHook.cs b/Projectiles/Typeless/WulfrumHook.cs index ec8940faf4..259e955588 100644 --- a/Projectiles/Typeless/WulfrumHook.cs +++ b/Projectiles/Typeless/WulfrumHook.cs @@ -1,19 +1,19 @@ 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.GameContent; -using CalamityMod.Items.Materials; -using Terraria.DataStructures; -using ReLogic.Utilities; -using CalamityMod.Items.Accessories; using System.Collections.Generic; using System.Linq; using CalamityMod.Graphics.Primitives; +using CalamityMod.Items.Accessories; +using CalamityMod.Items.Materials; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Utilities; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Typeless { @@ -237,7 +237,7 @@ namespace CalamityMod.Projectiles.Typeless segmentPositions = Owner.GetModPlayer().Segments.Select(x => x.position).ToArray(); PrimitiveRenderer.RenderTrail(new List(segmentPositions) { Owner.Center }, new(PrimWidthFunction, PrimColorFunction, smoothen: State is HookState.Grappling), 30); - Texture2D texture = TextureAssets.Projectile[Type].Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, null, lightColor, Projectile.rotation, texture.Size() / 2f, Projectile.scale, 0, 0); return false; diff --git a/Projectiles/Typeless/WulfrumLureSignal.cs b/Projectiles/Typeless/WulfrumLureSignal.cs index cdf334d20e..2c78db94ac 100644 --- a/Projectiles/Typeless/WulfrumLureSignal.cs +++ b/Projectiles/Typeless/WulfrumLureSignal.cs @@ -1,16 +1,16 @@ -using CalamityMod.NPCs.AstrumDeus; +using System; +using CalamityMod.Items.Placeables.Furniture; +using CalamityMod.Items.Tools; +using CalamityMod.NPCs.AstrumDeus; +using CalamityMod.NPCs.NormalNPCs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; using Terraria.DataStructures; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using CalamityMod.Items.Placeables.Furniture; -using CalamityMod.NPCs.NormalNPCs; -using CalamityMod.Items.Tools; namespace CalamityMod.Projectiles.Typeless { @@ -77,8 +77,8 @@ namespace CalamityMod.Projectiles.Typeless if (tries < 500) { - int npcToSpawn = Main.rand.NextBool() ? ModContent.NPCType() : Main.rand.NextBool() ? ModContent.NPCType() : ModContent.NPCType() ; - int index = NPC.NewNPC(Projectile.GetSource_FromAI(), (int)spawnPosition.X, (int)spawnPosition.Y, npcToSpawn, Target:player.whoAmI); + int npcToSpawn = Main.rand.NextBool() ? ModContent.NPCType() : Main.rand.NextBool() ? ModContent.NPCType() : ModContent.NPCType(); + int index = NPC.NewNPC(Projectile.GetSource_FromAI(), (int)spawnPosition.X, (int)spawnPosition.Y, npcToSpawn, Target: player.whoAmI); for (int iy = 0; iy < 16; iy++) { @@ -89,7 +89,7 @@ namespace CalamityMod.Projectiles.Typeless } } - if (Time%2 == 0 && CalamityUtils.IntoMorseCode("perimeter breached", Time / WulfrumLureItem.SignalTime)) + if (Time % 2 == 0 && CalamityUtils.IntoMorseCode("perimeter breached", Time / WulfrumLureItem.SignalTime)) { float dustCount = MathHelper.TwoPi * 300 / 8f; for (int i = 0; i < dustCount; i++) diff --git a/Projectiles/Typeless/WulfrumScaffoldKitHoldout.cs b/Projectiles/Typeless/WulfrumScaffoldKitHoldout.cs index 176009713d..610fbe8bad 100644 --- a/Projectiles/Typeless/WulfrumScaffoldKitHoldout.cs +++ b/Projectiles/Typeless/WulfrumScaffoldKitHoldout.cs @@ -140,7 +140,7 @@ namespace CalamityMod.Projectiles.Typeless if (Main.myPlayer != Owner.whoAmI) return false; - Texture2D sprite = ModContent.Request(Texture).Value; + Texture2D sprite = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Effect tileEffect = Filters.Scene["CalamityMod:WulfrumScaffoldSelection"].GetShader().Shader; @@ -191,7 +191,7 @@ namespace CalamityMod.Projectiles.Typeless public override void OnKill(int timeLeft) { if (SelectedTiles.Keys.Count > 0) - SoundEngine.PlaySound(SoundID.Item101 with { Volume = SoundID.Item101.Volume * 0.6f}, Owner.Center); + SoundEngine.PlaySound(SoundID.Item101 with { Volume = SoundID.Item101.Volume * 0.6f }, Owner.Center); if (Main.myPlayer == Owner.whoAmI) { @@ -201,7 +201,7 @@ namespace CalamityMod.Projectiles.Typeless PipeCleanupManager = new WulfrumPipeManager(); TempTilesManagerSystem.AddTemporaryTile(pos, PipeCleanupManager); - WorldGen.PlaceTile(pos.X, pos.Y, WulfrumScaffoldKit.PlacedTileType) ; + WorldGen.PlaceTile(pos.X, pos.Y, WulfrumScaffoldKit.PlacedTileType); NetMessage.SendTileSquare(-1, pos.X, pos.Y, TileChangeType.None); } } diff --git a/Projectiles/Typeless/YanmeisKnifeSlash.cs b/Projectiles/Typeless/YanmeisKnifeSlash.cs index 97f23421b6..87e3fa20ed 100644 --- a/Projectiles/Typeless/YanmeisKnifeSlash.cs +++ b/Projectiles/Typeless/YanmeisKnifeSlash.cs @@ -5,6 +5,7 @@ using CalamityMod.Items.Weapons.Typeless; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Typeless @@ -94,7 +95,7 @@ namespace CalamityMod.Projectiles.Typeless { for (int i = 0; i < 60; i++) { - Dust dust = Dust.NewDustDirect(Main.player[Projectile.owner].position, Main.player[Projectile.owner].width, Main.player[Projectile.owner].height, 267); + Dust dust = Dust.NewDustDirect(Main.player[Projectile.owner].position, Main.player[Projectile.owner].width, Main.player[Projectile.owner].height, DustID.RainbowMk2); dust.position.X += Main.rand.NextFloat(-16f, 16f); dust.color = Main.hslToRgb(Main.rand.NextFloat(0.26f, 0.37f), 1f, 0.75f); dust.velocity = Main.rand.NextVector2Circular(24f, 24f); diff --git a/Projectiles/Typeless/YellowLabSeeker.cs b/Projectiles/Typeless/YellowLabSeeker.cs index bd4d606550..e81976b4dd 100644 --- a/Projectiles/Typeless/YellowLabSeeker.cs +++ b/Projectiles/Typeless/YellowLabSeeker.cs @@ -48,7 +48,7 @@ namespace CalamityMod.Projectiles.Typeless public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; if (Time > 80f && Projectile.ai[1] == 0f) { for (int i = 0; i < 24; i += 2) diff --git a/Projectiles/VanillaProjectileOverrides/ChlorophyteCrystalAI.cs b/Projectiles/VanillaProjectileOverrides/ChlorophyteCrystalAI.cs index 81ace9a24d..fa30a51116 100644 --- a/Projectiles/VanillaProjectileOverrides/ChlorophyteCrystalAI.cs +++ b/Projectiles/VanillaProjectileOverrides/ChlorophyteCrystalAI.cs @@ -1,13 +1,13 @@ -using CalamityMod.Projectiles.Typeless; +using System; +using CalamityMod.Items.VanillaArmorChanges; +using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; -using Terraria.ID; -using Terraria.ModLoader; using Terraria.Audio; using Terraria.GameContent; -using CalamityMod.Items.VanillaArmorChanges; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.VanillaProjectileOverrides { diff --git a/Projectiles/VanillaProjectileOverrides/HornetMinionAI.cs b/Projectiles/VanillaProjectileOverrides/HornetMinionAI.cs index 5783b083e6..6b5890f62a 100644 --- a/Projectiles/VanillaProjectileOverrides/HornetMinionAI.cs +++ b/Projectiles/VanillaProjectileOverrides/HornetMinionAI.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Projectiles.VanillaProjectileOverrides { // Shorter range when the minion has no target yet: 40 tiles private const float MinEnemyDistanceDetection = 640f; - + // Longer range when a target is already acquired: 75 tiles private const float MaxEnemyDistanceDetection = 1200f; @@ -62,7 +62,7 @@ namespace CalamityMod.Projectiles.VanillaProjectileOverrides shootDust.noLight = true; shootDust.noLightEmittence = true; } - + SoundEngine.PlaySound(SoundID.Item17, proj.Center); } diff --git a/Projectiles/VanillaProjectileOverrides/HoundiusShootiusFireballAI.cs b/Projectiles/VanillaProjectileOverrides/HoundiusShootiusFireballAI.cs index d3d4188955..9ae33b8dbc 100644 --- a/Projectiles/VanillaProjectileOverrides/HoundiusShootiusFireballAI.cs +++ b/Projectiles/VanillaProjectileOverrides/HoundiusShootiusFireballAI.cs @@ -1,6 +1,6 @@ +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; -using Microsoft.Xna.Framework; namespace CalamityMod.Projectiles.VanillaProjectileOverrides { @@ -14,14 +14,14 @@ namespace CalamityMod.Projectiles.VanillaProjectileOverrides Player owner = Main.player[projectile.owner]; NPC target = projectile.Center.MinionHoming(enemyDistanceDetection, owner); - + if (target is not null) projectile.velocity = Vector2.Lerp(projectile.velocity, projectile.SafeDirectionTo(target.Center) * projVelocity, rateOfChange); - + // Yes, return true, the projectile will have all it's normal AI. // But will have this piece of homing code on top of it. // So it'll have all it's animation code, dust code and all that with the homing I added. return true; } } -} \ No newline at end of file +} diff --git a/Rarities/CalamityRed.cs b/Rarities/CalamityRed.cs index 97cb162adb..3b47a6ab63 100644 --- a/Rarities/CalamityRed.cs +++ b/Rarities/CalamityRed.cs @@ -3,19 +3,19 @@ using Terraria.ModLoader; namespace CalamityMod.Rarities { - public class CalamityRed : ModRarity - { - // Calamity Red is Rarity 17 - // This rarity should never be assigned to any items. - // It is the equivalent of vanilla's Purple rarity (11): only used for positive reforges on top-rarity items. - public override Color RarityColor => new Color(163, 25, 26); // #A3191A - // (139, 0, 0) is the classic donator item color + public class CalamityRed : ModRarity + { + // Calamity Red is Rarity 17 + // This rarity should never be assigned to any items. + // It is the equivalent of vanilla's Purple rarity (11): only used for positive reforges on top-rarity items. + public override Color RarityColor => new Color(163, 25, 26); // #A3191A + // (139, 0, 0) is the classic donator item color - public override int GetPrefixedRarity(int offset, float valueMult) => offset switch - { - -2 => ModContent.RarityType(), - -1 => ModContent.RarityType(), - _ => Type, - }; - } + public override int GetPrefixedRarity(int offset, float valueMult) => offset switch + { + -2 => ModContent.RarityType(), + -1 => ModContent.RarityType(), + _ => Type, + }; + } } diff --git a/Rarities/DarkBlue.cs b/Rarities/DarkBlue.cs index 24596eec7a..02b431036f 100644 --- a/Rarities/DarkBlue.cs +++ b/Rarities/DarkBlue.cs @@ -3,18 +3,18 @@ using Terraria.ModLoader; namespace CalamityMod.Rarities { - public class DarkBlue : ModRarity - { - // Dark Blue is Rarity 14 - public override Color RarityColor => new Color(43, 96, 222); + public class DarkBlue : ModRarity + { + // Dark Blue is Rarity 14 + public override Color RarityColor => new Color(43, 96, 222); - public override int GetPrefixedRarity(int offset, float valueMult) => offset switch - { - -2 => ModContent.RarityType(), - -1 => ModContent.RarityType(), - 1 => ModContent.RarityType(), - 2 => ModContent.RarityType(), - _ => Type, - }; - } + public override int GetPrefixedRarity(int offset, float valueMult) => offset switch + { + -2 => ModContent.RarityType(), + -1 => ModContent.RarityType(), + 1 => ModContent.RarityType(), + 2 => ModContent.RarityType(), + _ => Type, + }; + } } diff --git a/Rarities/DarkOrange.cs b/Rarities/DarkOrange.cs index e7a2b677a3..30959e183a 100644 --- a/Rarities/DarkOrange.cs +++ b/Rarities/DarkOrange.cs @@ -3,9 +3,9 @@ using Terraria.ModLoader; namespace CalamityMod.Rarities { - // Draedon's Arsenal "Rust" / "Bronze" rarity - public class DarkOrange : ModRarity - { - public override Color RarityColor => new Color(204, 71, 35); - } + // Draedon's Arsenal "Rust" / "Bronze" rarity + public class DarkOrange : ModRarity + { + public override Color RarityColor => new Color(204, 71, 35); + } } diff --git a/Rarities/HotPink.cs b/Rarities/HotPink.cs index 938fdfe59c..28258729a5 100644 --- a/Rarities/HotPink.cs +++ b/Rarities/HotPink.cs @@ -3,18 +3,18 @@ using Terraria.ModLoader; namespace CalamityMod.Rarities { - public class HotPink : ModRarity - { - // Hot Pink is Rarity 16 - public override Color RarityColor => new Color(255, 0, 255); + public class HotPink : ModRarity + { + // Hot Pink is Rarity 16 + public override Color RarityColor => new Color(255, 0, 255); - public override int GetPrefixedRarity(int offset, float valueMult) => offset switch - { - -2 => ModContent.RarityType(), - -1 => ModContent.RarityType(), - 1 => ModContent.RarityType(), - 2 => ModContent.RarityType(), - _ => Type, - }; - } + public override int GetPrefixedRarity(int offset, float valueMult) => offset switch + { + -2 => ModContent.RarityType(), + -1 => ModContent.RarityType(), + 1 => ModContent.RarityType(), + 2 => ModContent.RarityType(), + _ => Type, + }; + } } diff --git a/Rarities/PureGreen.cs b/Rarities/PureGreen.cs index 958ace0025..5b682682a2 100644 --- a/Rarities/PureGreen.cs +++ b/Rarities/PureGreen.cs @@ -4,18 +4,18 @@ using Terraria.ModLoader; namespace CalamityMod.Rarities { - public class PureGreen : ModRarity - { - // Pure Green is Rarity 13 - public override Color RarityColor => new Color(0, 255, 0); + public class PureGreen : ModRarity + { + // Pure Green is Rarity 13 + public override Color RarityColor => new Color(0, 255, 0); - public override int GetPrefixedRarity(int offset, float valueMult) => offset switch - { - -2 => ItemRarityID.Purple, - -1 => ModContent.RarityType(), - 1 => ModContent.RarityType(), - 2 => ModContent.RarityType(), - _ => Type, - }; - } + public override int GetPrefixedRarity(int offset, float valueMult) => offset switch + { + -2 => ItemRarityID.Purple, + -1 => ModContent.RarityType(), + 1 => ModContent.RarityType(), + 2 => ModContent.RarityType(), + _ => Type, + }; + } } diff --git a/Rarities/Rainbow.cs b/Rarities/Rainbow.cs deleted file mode 100644 index af84446b62..0000000000 --- a/Rarities/Rainbow.cs +++ /dev/null @@ -1,14 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Rarities -{ - // Heart of the Elements, The Community and Elemental Excalibur are Rainbow for decoration - // TODO -- this should be changed to be a color override - // it's only used for a few items and is purely decorative - public class Rainbow : ModRarity - { - public override Color RarityColor => new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB); - } -} diff --git a/Rarities/Turquoise.cs b/Rarities/Turquoise.cs index afc59dcb4e..2117b067d9 100644 --- a/Rarities/Turquoise.cs +++ b/Rarities/Turquoise.cs @@ -4,18 +4,18 @@ using Terraria.ModLoader; namespace CalamityMod.Rarities { - public class Turquoise : ModRarity - { - // Turquoise is Rarity 12 - public override Color RarityColor => new Color(0, 255, 200); + public class Turquoise : ModRarity + { + // Turquoise is Rarity 12 + public override Color RarityColor => new Color(0, 255, 200); - public override int GetPrefixedRarity(int offset, float valueMult) => offset switch - { - -2 => ItemRarityID.Red, - -1 => ItemRarityID.Purple, - 1 => ModContent.RarityType(), - 2 => ModContent.RarityType(), - _ => Type, - }; - } + public override int GetPrefixedRarity(int offset, float valueMult) => offset switch + { + -2 => ItemRarityID.Red, + -1 => ItemRarityID.Purple, + 1 => ModContent.RarityType(), + 2 => ModContent.RarityType(), + _ => Type, + }; + } } diff --git a/Rarities/Violet.cs b/Rarities/Violet.cs index 4aeb617b1b..e5b468f021 100644 --- a/Rarities/Violet.cs +++ b/Rarities/Violet.cs @@ -3,18 +3,18 @@ using Terraria.ModLoader; namespace CalamityMod.Rarities { - public class Violet : ModRarity - { - // Violet is Rarity 15 - public override Color RarityColor => new Color(108, 45, 199); + public class Violet : ModRarity + { + // Violet is Rarity 15 + public override Color RarityColor => new Color(108, 45, 199); - public override int GetPrefixedRarity(int offset, float valueMult) => offset switch - { - -2 => ModContent.RarityType(), - -1 => ModContent.RarityType(), - 1 => ModContent.RarityType(), - 2 => ModContent.RarityType(), - _ => Type, - }; - } + public override int GetPrefixedRarity(int offset, float valueMult) => offset switch + { + -2 => ModContent.RarityType(), + -1 => ModContent.RarityType(), + 1 => ModContent.RarityType(), + 2 => ModContent.RarityType(), + _ => Type, + }; + } } diff --git a/Scenes/BossBackgroundScenes/CryogenBackgroundScene.cs b/Scenes/BossBackgroundScenes/CryogenBackgroundScene.cs index 154d7b51a5..816a2bfccc 100644 --- a/Scenes/BossBackgroundScenes/CryogenBackgroundScene.cs +++ b/Scenes/BossBackgroundScenes/CryogenBackgroundScene.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Systems public override bool IsSceneEffectActive(Player player) { CryogenSky.UpdateDrawEligibility(); - bool result = NPC.AnyNPCs(ModContent.NPCType()) || CryogenSky.ShouldDrawRegularly; + bool result = NPC.AnyNPCs(ModContent.NPCType()) || CryogenSky.ShouldDrawRegularly || Main.LocalPlayer.Calamity().monolithCryogenShader > 0; CryogenSky.UpdateDrawEligibility(); return result; } diff --git a/Scenes/BossBackgroundScenes/DrunkCrabBackgroundScene.cs b/Scenes/BossBackgroundScenes/DrunkCrabBackgroundScene.cs index c67ba8504e..5b7ee0d578 100644 --- a/Scenes/BossBackgroundScenes/DrunkCrabBackgroundScene.cs +++ b/Scenes/BossBackgroundScenes/DrunkCrabBackgroundScene.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Systems // Case 1: Zenith Seed Crabulon. if (Main.zenithWorld && NPC.AnyNPCs(ModContent.NPCType())) return true; - + // Case 2: Supreme Cirrus BH5. bool cirrusSpecialAttack = false; diff --git a/Scenes/BossBackgroundScenes/ExoMechBackgroundScene.cs b/Scenes/BossBackgroundScenes/ExoMechBackgroundScene.cs index 75d82e6d47..25a8d10ca0 100644 --- a/Scenes/BossBackgroundScenes/ExoMechBackgroundScene.cs +++ b/Scenes/BossBackgroundScenes/ExoMechBackgroundScene.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Systems { public override SceneEffectPriority Priority => SceneEffectPriority.BossHigh; - public override bool IsSceneEffectActive(Player player) => ExoMechsSky.CanSkyBeActive; + public override bool IsSceneEffectActive(Player player) => ExoMechsSky.CanSkyBeActive || player.Calamity().monolithExoShader > 0; public override void SpecialVisuals(Player player, bool isActive) { diff --git a/Scenes/BossBackgroundScenes/LeviathanBackgroundScene.cs b/Scenes/BossBackgroundScenes/LeviathanBackgroundScene.cs index eb6a2bca2b..b34b8c377c 100644 --- a/Scenes/BossBackgroundScenes/LeviathanBackgroundScene.cs +++ b/Scenes/BossBackgroundScenes/LeviathanBackgroundScene.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Systems { public override SceneEffectPriority Priority => SceneEffectPriority.BossMedium; - public override bool IsSceneEffectActive(Player player) => Main.zenithWorld ? NPC.AnyNPCs(ModContent.NPCType()) : NPC.AnyNPCs(ModContent.NPCType()); + public override bool IsSceneEffectActive(Player player) => (Main.zenithWorld ? NPC.AnyNPCs(ModContent.NPCType()) : NPC.AnyNPCs(ModContent.NPCType())) || Main.LocalPlayer.Calamity().monolithLeviathanShader > 0; public override void SpecialVisuals(Player player, bool isActive) { diff --git a/Scenes/BossBackgroundScenes/PBGBackgroundScene.cs b/Scenes/BossBackgroundScenes/PBGBackgroundScene.cs index a5d3a052d5..67b7e344b9 100644 --- a/Scenes/BossBackgroundScenes/PBGBackgroundScene.cs +++ b/Scenes/BossBackgroundScenes/PBGBackgroundScene.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Systems { public override SceneEffectPriority Priority => SceneEffectPriority.BossMedium; - public override bool IsSceneEffectActive(Player player) => NPC.AnyNPCs(ModContent.NPCType()); + public override bool IsSceneEffectActive(Player player) => NPC.AnyNPCs(ModContent.NPCType()) || Main.LocalPlayer.Calamity().monolithPlagueShader > 0; public override void SpecialVisuals(Player player, bool isActive) { diff --git a/Scenes/BossBackgroundScenes/YharonBackgroundScene.cs b/Scenes/BossBackgroundScenes/YharonBackgroundScene.cs index 35fae70b65..eaef34cd89 100644 --- a/Scenes/BossBackgroundScenes/YharonBackgroundScene.cs +++ b/Scenes/BossBackgroundScenes/YharonBackgroundScene.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Systems { public override SceneEffectPriority Priority => SceneEffectPriority.BossHigh; - public override bool IsSceneEffectActive(Player player) => NPC.AnyNPCs(ModContent.NPCType()); + public override bool IsSceneEffectActive(Player player) => NPC.AnyNPCs(ModContent.NPCType()) || Main.LocalPlayer.Calamity().monolithYharonShader > 0; public override void SpecialVisuals(Player player, bool isActive) { diff --git a/Scenes/MiscScenes/AstralMonolithScene.cs b/Scenes/MiscScenes/AstralMonolithScene.cs new file mode 100644 index 0000000000..f5dd4b4ee3 --- /dev/null +++ b/Scenes/MiscScenes/AstralMonolithScene.cs @@ -0,0 +1,17 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Systems +{ + public class AstralMonolithScene : ModSceneEffect + { + public override SceneEffectPriority Priority => SceneEffectPriority.Environment; + + public override bool IsSceneEffectActive(Player player) => Main.LocalPlayer.Calamity().monolithAstralShader > 0; + + public override void SpecialVisuals(Player player, bool isActive) + { + player.ManageSpecialBiomeVisuals("CalamityMod:Astral", isActive); + } + } +} diff --git a/Scenes/MiscScenes/MonolithAccursedScene.cs b/Scenes/MiscScenes/MonolithAccursedScene.cs index bc6cb839f4..094919db0a 100644 --- a/Scenes/MiscScenes/MonolithAccursedScene.cs +++ b/Scenes/MiscScenes/MonolithAccursedScene.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Systems diff --git a/Scenes/MiscScenes/MonolithDistortionScene.cs b/Scenes/MiscScenes/MonolithDistortionScene.cs new file mode 100644 index 0000000000..9396487fc8 --- /dev/null +++ b/Scenes/MiscScenes/MonolithDistortionScene.cs @@ -0,0 +1,17 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Systems +{ + public class MonolithDistortionScene : ModSceneEffect + { + public override SceneEffectPriority Priority => SceneEffectPriority.Environment; + + public override bool IsSceneEffectActive(Player player) => Main.LocalPlayer.Calamity().monolithDevourerBShader > 0 || Main.LocalPlayer.Calamity().monolithDevourerPShader > 0; + + public override void SpecialVisuals(Player player, bool isActive) + { + player.ManageSpecialBiomeVisuals("CalamityMod:DevourerofGodsHead", isActive); + } + } +} diff --git a/Scenes/MusicScenes/AnahitaMusicScene.cs b/Scenes/MusicScenes/AnahitaMusicScene.cs index fd47c3fcdb..cf305a8a7c 100644 --- a/Scenes/MusicScenes/AnahitaMusicScene.cs +++ b/Scenes/MusicScenes/AnahitaMusicScene.cs @@ -1,4 +1,4 @@ -using CalamityMod.NPCs; +using CalamityMod.NPCs; using CalamityMod.NPCs.Leviathan; using Terraria; using Terraria.ID; diff --git a/Scenes/MusicScenes/AquaticScourgeMusicScene.cs b/Scenes/MusicScenes/AquaticScourgeMusicScene.cs index bb227adf0e..c9689876c6 100644 --- a/Scenes/MusicScenes/AquaticScourgeMusicScene.cs +++ b/Scenes/MusicScenes/AquaticScourgeMusicScene.cs @@ -1,4 +1,4 @@ -using CalamityMod.Events; +using CalamityMod.Events; using CalamityMod.NPCs; using CalamityMod.NPCs.AquaticScourge; using Terraria; @@ -17,10 +17,10 @@ namespace CalamityMod.Systems public override int OtherworldMusic => MusicID.OtherworldlyBoss2; public override bool AdditionalCheck() - { - if (CalamityGlobalNPC.aquaticScourge == -1) - return false; - return Main.npc[CalamityGlobalNPC.aquaticScourge].justHit || Main.npc[CalamityGlobalNPC.aquaticScourge].life <= Main.npc[CalamityGlobalNPC.aquaticScourge].lifeMax * 0.999 || BossRushEvent.BossRushActive || Main.getGoodWorld; - } + { + if (CalamityGlobalNPC.aquaticScourge == -1) + return false; + return Main.npc[CalamityGlobalNPC.aquaticScourge].justHit || Main.npc[CalamityGlobalNPC.aquaticScourge].life <= Main.npc[CalamityGlobalNPC.aquaticScourge].lifeMax * 0.999 || BossRushEvent.BossRushActive || Main.getGoodWorld; + } } } diff --git a/Scenes/MusicScenes/AstrumAureusMusicScene.cs b/Scenes/MusicScenes/AstrumAureusMusicScene.cs index da9be0e2c0..1ef94a62e8 100644 --- a/Scenes/MusicScenes/AstrumAureusMusicScene.cs +++ b/Scenes/MusicScenes/AstrumAureusMusicScene.cs @@ -1,4 +1,4 @@ -using CalamityMod.NPCs.AstrumAureus; +using CalamityMod.NPCs.AstrumAureus; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Scenes/MusicScenes/AstrumDeusMusicScene.cs b/Scenes/MusicScenes/AstrumDeusMusicScene.cs index 340c785036..72ca6ea1f5 100644 --- a/Scenes/MusicScenes/AstrumDeusMusicScene.cs +++ b/Scenes/MusicScenes/AstrumDeusMusicScene.cs @@ -1,4 +1,4 @@ -using CalamityMod.NPCs.AstrumDeus; +using CalamityMod.NPCs.AstrumDeus; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -14,9 +14,9 @@ namespace CalamityMod.Systems public override int VanillaMusic => MusicID.Boss3; public override int OtherworldMusic => MusicID.OtherworldlyBoss2; public override int[] AdditionalNPCs => new int[] - { - ModContent.NPCType(), - ModContent.NPCType() - }; + { + ModContent.NPCType(), + ModContent.NPCType() + }; } } diff --git a/Scenes/MusicScenes/BaseMusicSceneEffect.cs b/Scenes/MusicScenes/BaseMusicSceneEffect.cs index 03b7271f85..79b5f1802c 100644 --- a/Scenes/MusicScenes/BaseMusicSceneEffect.cs +++ b/Scenes/MusicScenes/BaseMusicSceneEffect.cs @@ -7,14 +7,14 @@ namespace CalamityMod.Systems { public abstract class BaseMusicSceneEffect : ModSceneEffect { - // Scene Effect Priorities - // ??? (Anahita Lure): SceneEffectPriority.BossLow - // Most Bosses: SceneEffectPriority.BossMedium - // Major Post-ML Bosses: SceneEffectPriority.BossHigh - // - // BossLow = default for modded bosses but has a bug where Boss 1 is queued for 1 frame - // BossMedium = overrides all vanilla boss music, including events - // BossHigh = overrides even ML's pre-spawning music fadeout + // Scene Effect Priorities + // ??? (Anahita Lure): SceneEffectPriority.BossLow + // Most Bosses: SceneEffectPriority.BossMedium + // Major Post-ML Bosses: SceneEffectPriority.BossHigh + // + // BossLow = default for modded bosses but has a bug where Boss 1 is queued for 1 frame + // BossMedium = overrides all vanilla boss music, including events + // BossHigh = overrides even ML's pre-spawning music fadeout #region Overridable Properties public abstract int NPCType { get; } @@ -25,34 +25,34 @@ namespace CalamityMod.Systems public virtual int[] AdditionalNPCs => new int[] { }; #endregion - #region Overridable Methods + #region Overridable Methods public virtual bool AdditionalCheck() => true; - #endregion + #endregion public virtual int SetMusic() - { - if (MusicModMusic is not null) - return (int)MusicModMusic; + { + if (MusicModMusic is not null) + return (int)MusicModMusic; - return VanillaMusic; + return VanillaMusic; - // You can't even edit music if the game has Otherworld toggle on lol. Have fun with Boss 1 - /* + // You can't even edit music if the game has Otherworld toggle on lol. Have fun with Boss 1 + /* FieldInfo swapMusicField = typeof(Main).GetField("swapMusic", BindingFlags.Static | BindingFlags.NonPublic); bool musicSwapped = (bool)swapMusicField.GetValue(null); bool playingOtherworld = (!Main.drunkWorld && musicSwapped) || (Main.drunkWorld && !musicSwapped); // Main.swapMusic is private. Todo: bug tmod devs to avoid reflection return playingOtherworld ? OtherworldMusic : VanillaMusic; */ - } + } public virtual bool SetSceneEffect(Player player) - { - if (!AdditionalCheck()) - return false; + { + if (!AdditionalCheck()) + return false; - if (MusicModMusic is null && VanillaMusic == -1) - return false; + if (MusicModMusic is null && VanillaMusic == -1) + return false; /* // You can't even edit music if the game has Otherworld toggle on lol. @@ -72,12 +72,12 @@ namespace CalamityMod.Systems Rectangle screenRect = new Rectangle((int)Main.screenPosition.X, (int)Main.screenPosition.Y, Main.screenWidth, Main.screenHeight); int musicDistance = MusicDistance * 2; for (int j = 0; j < Main.maxNPCs; j++) - { - NPC npc = Main.npc[j]; - if (!npc.active) - continue; + { + NPC npc = Main.npc[j]; + if (!npc.active) + continue; - bool inList = false; + bool inList = false; if (npc.type == NPCType) { inList = true; @@ -94,15 +94,15 @@ namespace CalamityMod.Systems } } - if (!inList) - continue; + if (!inList) + continue; - Rectangle npcBox = new Rectangle((int)npc.Center.X - MusicDistance, (int)npc.Center.Y - MusicDistance, musicDistance, musicDistance); - if (screenRect.Intersects(npcBox)) - return true; - } - return false; - } + Rectangle npcBox = new Rectangle((int)npc.Center.X - MusicDistance, (int)npc.Center.Y - MusicDistance, musicDistance, musicDistance); + if (screenRect.Intersects(npcBox)) + return true; + } + return false; + } public override int Music => SetMusic(); diff --git a/Scenes/MusicScenes/BioLabMusicScene.cs b/Scenes/MusicScenes/BioLabMusicScene.cs index 8a28d67293..59ecadbe6a 100644 --- a/Scenes/MusicScenes/BioLabMusicScene.cs +++ b/Scenes/MusicScenes/BioLabMusicScene.cs @@ -1,9 +1,9 @@ -using CalamityMod.Systems; +using System; +using CalamityMod.Systems; using CalamityMod.Walls; using CalamityMod.Walls.DraedonStructures; using CalamityMod.World; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Scenes/MusicScenes/BrimstoneElementalMusicScene.cs b/Scenes/MusicScenes/BrimstoneElementalMusicScene.cs index e08256546a..c310584403 100644 --- a/Scenes/MusicScenes/BrimstoneElementalMusicScene.cs +++ b/Scenes/MusicScenes/BrimstoneElementalMusicScene.cs @@ -1,4 +1,4 @@ -using CalamityMod.NPCs.BrimstoneElemental; +using CalamityMod.NPCs.BrimstoneElemental; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Scenes/MusicScenes/CalamitasCloneMusicScene.cs b/Scenes/MusicScenes/CalamitasCloneMusicScene.cs index 7616609d88..ae9a98ad8a 100644 --- a/Scenes/MusicScenes/CalamitasCloneMusicScene.cs +++ b/Scenes/MusicScenes/CalamitasCloneMusicScene.cs @@ -14,9 +14,9 @@ namespace CalamityMod.Systems public override int VanillaMusic => MusicID.Boss2; public override int OtherworldMusic => MusicID.OtherworldlyBoss2; public override int[] AdditionalNPCs => new int[] - { - ModContent.NPCType(), - ModContent.NPCType() - }; + { + ModContent.NPCType(), + ModContent.NPCType() + }; } } diff --git a/Scenes/MusicScenes/CeaselessVoidMusicScene.cs b/Scenes/MusicScenes/CeaselessVoidMusicScene.cs index 3747c5ae14..2b8aa4568a 100644 --- a/Scenes/MusicScenes/CeaselessVoidMusicScene.cs +++ b/Scenes/MusicScenes/CeaselessVoidMusicScene.cs @@ -1,4 +1,4 @@ -using CalamityMod.NPCs.CeaselessVoid; +using CalamityMod.NPCs.CeaselessVoid; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Scenes/MusicScenes/CrabulonMusicScene.cs b/Scenes/MusicScenes/CrabulonMusicScene.cs index b21c95d1ef..dcb377b438 100644 --- a/Scenes/MusicScenes/CrabulonMusicScene.cs +++ b/Scenes/MusicScenes/CrabulonMusicScene.cs @@ -1,4 +1,4 @@ -using CalamityMod.NPCs.Crabulon; +using CalamityMod.NPCs.Crabulon; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Scenes/MusicScenes/CryogenMusicScene.cs b/Scenes/MusicScenes/CryogenMusicScene.cs index 6aa01cd208..9d4d2dad9e 100644 --- a/Scenes/MusicScenes/CryogenMusicScene.cs +++ b/Scenes/MusicScenes/CryogenMusicScene.cs @@ -1,4 +1,4 @@ -using CalamityMod.NPCs.Cryogen; +using CalamityMod.NPCs.Cryogen; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Scenes/MusicScenes/DesertScourgeMusicScene.cs b/Scenes/MusicScenes/DesertScourgeMusicScene.cs index 58f95ff854..0b123f2be6 100644 --- a/Scenes/MusicScenes/DesertScourgeMusicScene.cs +++ b/Scenes/MusicScenes/DesertScourgeMusicScene.cs @@ -1,4 +1,4 @@ -using CalamityMod.NPCs.DesertScourge; +using CalamityMod.NPCs.DesertScourge; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -14,9 +14,9 @@ namespace CalamityMod.Systems public override int VanillaMusic => MusicID.Boss1; public override int OtherworldMusic => MusicID.OtherworldlyBoss1; public override int[] AdditionalNPCs => new int[] - { - ModContent.NPCType(), - ModContent.NPCType() - }; + { + ModContent.NPCType(), + ModContent.NPCType() + }; } } diff --git a/Scenes/MusicScenes/DevourerofGodsPhase1MusicScene.cs b/Scenes/MusicScenes/DevourerofGodsPhase1MusicScene.cs index 6e7d798678..6e53d9cd4a 100644 --- a/Scenes/MusicScenes/DevourerofGodsPhase1MusicScene.cs +++ b/Scenes/MusicScenes/DevourerofGodsPhase1MusicScene.cs @@ -15,10 +15,10 @@ namespace CalamityMod.Systems public override int VanillaMusic => MusicID.Boss3; public override int OtherworldMusic => MusicID.OtherworldlyBoss2; public override int[] AdditionalNPCs => new int[] - { - ModContent.NPCType(), - ModContent.NPCType() - }; + { + ModContent.NPCType(), + ModContent.NPCType() + }; public override bool AdditionalCheck() => CalamityGlobalNPC.DoGHead != -1 && CalamityGlobalNPC.DoGP2 == -1; } diff --git a/Scenes/MusicScenes/DevourerofGodsPhase2MusicScene.cs b/Scenes/MusicScenes/DevourerofGodsPhase2MusicScene.cs index 83ee46ca49..001b5bbeea 100644 --- a/Scenes/MusicScenes/DevourerofGodsPhase2MusicScene.cs +++ b/Scenes/MusicScenes/DevourerofGodsPhase2MusicScene.cs @@ -15,10 +15,10 @@ namespace CalamityMod.Systems public override int VanillaMusic => MusicID.LunarBoss; public override int OtherworldMusic => MusicID.OtherworldlyLunarBoss; public override int[] AdditionalNPCs => new int[] - { - ModContent.NPCType(), - ModContent.NPCType() - }; + { + ModContent.NPCType(), + ModContent.NPCType() + }; public override bool AdditionalCheck() => CalamityGlobalNPC.DoGP2 != -1; } diff --git a/Scenes/MusicScenes/DraedonCommunicationMusicScene.cs b/Scenes/MusicScenes/DraedonCommunicationMusicScene.cs new file mode 100644 index 0000000000..6a9ebe63a5 --- /dev/null +++ b/Scenes/MusicScenes/DraedonCommunicationMusicScene.cs @@ -0,0 +1,14 @@ +using CalamityMod.UI.DraedonSummoning; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Scenes.MusicScenes +{ + public class DraedonCommunicationMusicScene : ModSceneEffect + { + public override int Music => MusicLoader.GetMusicSlot("CalamityMod/Sounds/Music/DraedonTalk"); + public override SceneEffectPriority Priority => SceneEffectPriority.Environment; + public override float GetWeight(Player player) => 1f; + public override bool IsSceneEffectActive(Player player) => CodebreakerUI.DisplayingCommunicationText; + } +} diff --git a/Scenes/MusicScenes/DraedonsAmbienceMusicScene.cs b/Scenes/MusicScenes/DraedonExoSelectMusicScene.cs similarity index 79% rename from Scenes/MusicScenes/DraedonsAmbienceMusicScene.cs rename to Scenes/MusicScenes/DraedonExoSelectMusicScene.cs index a30ea2477e..7d8315565f 100644 --- a/Scenes/MusicScenes/DraedonsAmbienceMusicScene.cs +++ b/Scenes/MusicScenes/DraedonExoSelectMusicScene.cs @@ -1,17 +1,15 @@ using CalamityMod.NPCs; using CalamityMod.NPCs.ExoMechs; -using Terraria; -using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Systems { - public class DraedonsAmbienceMusicScene : BaseMusicSceneEffect + public class DraedonExoSelectMusicScene : BaseMusicSceneEffect { public override SceneEffectPriority Priority => SceneEffectPriority.BossMedium; public override int NPCType => ModContent.NPCType(); - public override int? MusicModMusic => MusicLoader.GetMusicSlot(Mod, "Sounds/Music/DraedonsAmbience"); + public override int? MusicModMusic => MusicLoader.GetMusicSlot(Mod, "Sounds/Music/DraedonExoSelect"); public override int VanillaMusic => -1; public override int OtherworldMusic => -1; diff --git a/Scenes/MusicScenes/DragonfollyMusicScene.cs b/Scenes/MusicScenes/DragonfollyMusicScene.cs index e18a49bc8f..b005c124a8 100644 --- a/Scenes/MusicScenes/DragonfollyMusicScene.cs +++ b/Scenes/MusicScenes/DragonfollyMusicScene.cs @@ -1,4 +1,4 @@ -using CalamityMod.NPCs.Bumblebirb; +using CalamityMod.NPCs.Bumblebirb; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Scenes/MusicScenes/ExoMechsMusicScene.cs b/Scenes/MusicScenes/ExoMechsMusicScene.cs index 97a9e11e4b..225de8aeef 100644 --- a/Scenes/MusicScenes/ExoMechsMusicScene.cs +++ b/Scenes/MusicScenes/ExoMechsMusicScene.cs @@ -1,4 +1,4 @@ -using CalamityMod.NPCs; +using CalamityMod.NPCs; using CalamityMod.NPCs.ExoMechs; using CalamityMod.NPCs.ExoMechs.Apollo; using CalamityMod.NPCs.ExoMechs.Ares; @@ -19,15 +19,15 @@ namespace CalamityMod.Systems public override int VanillaMusic => MusicID.Boss3; public override int OtherworldMusic => MusicID.OtherworldlyBoss2; public override int[] AdditionalNPCs => new int[] - { - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType() - }; + { + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType() + }; public override bool AdditionalCheck() => CalamityGlobalNPC.draedonAmbience == -1; } diff --git a/Scenes/MusicScenes/HiveMindMusicScene.cs b/Scenes/MusicScenes/HiveMindMusicScene.cs index 00662ace7c..7b8d0b35f0 100644 --- a/Scenes/MusicScenes/HiveMindMusicScene.cs +++ b/Scenes/MusicScenes/HiveMindMusicScene.cs @@ -1,4 +1,4 @@ -using CalamityMod.NPCs.HiveMind; +using CalamityMod.NPCs.HiveMind; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Scenes/MusicScenes/PlaguebringerGoliathMusicScene.cs b/Scenes/MusicScenes/PlaguebringerGoliathMusicScene.cs index 3058ce51e9..31495fc8df 100644 --- a/Scenes/MusicScenes/PlaguebringerGoliathMusicScene.cs +++ b/Scenes/MusicScenes/PlaguebringerGoliathMusicScene.cs @@ -1,4 +1,4 @@ -using CalamityMod.NPCs.PlaguebringerGoliath; +using CalamityMod.NPCs.PlaguebringerGoliath; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Scenes/MusicScenes/PolterghastMusicScene.cs b/Scenes/MusicScenes/PolterghastMusicScene.cs index db656983a9..c5a4e86593 100644 --- a/Scenes/MusicScenes/PolterghastMusicScene.cs +++ b/Scenes/MusicScenes/PolterghastMusicScene.cs @@ -1,4 +1,4 @@ -using CalamityMod.NPCs.Polterghast; +using CalamityMod.NPCs.Polterghast; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Scenes/MusicScenes/PolterghastSilentMusicScene.cs b/Scenes/MusicScenes/PolterghastSilentMusicScene.cs index 239301f862..b769806cc2 100644 --- a/Scenes/MusicScenes/PolterghastSilentMusicScene.cs +++ b/Scenes/MusicScenes/PolterghastSilentMusicScene.cs @@ -1,4 +1,4 @@ -using CalamityMod.NPCs.Polterghast; +using CalamityMod.NPCs.Polterghast; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Scenes/MusicScenes/ProvidenceMusicScene.cs b/Scenes/MusicScenes/ProvidenceMusicScene.cs index 3b94309145..4965e5b757 100644 --- a/Scenes/MusicScenes/ProvidenceMusicScene.cs +++ b/Scenes/MusicScenes/ProvidenceMusicScene.cs @@ -1,4 +1,4 @@ -using CalamityMod.NPCs.Providence; +using CalamityMod.NPCs.Providence; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Scenes/MusicScenes/RavagerMusicScene.cs b/Scenes/MusicScenes/RavagerMusicScene.cs index 8e46296ab4..7dbbb50fa2 100644 --- a/Scenes/MusicScenes/RavagerMusicScene.cs +++ b/Scenes/MusicScenes/RavagerMusicScene.cs @@ -1,4 +1,4 @@ -using CalamityMod.NPCs.Ravager; +using CalamityMod.NPCs.Ravager; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Scenes/MusicScenes/SignusMusicScene.cs b/Scenes/MusicScenes/SignusMusicScene.cs index 8fef7b42f7..5aa9c64edb 100644 --- a/Scenes/MusicScenes/SignusMusicScene.cs +++ b/Scenes/MusicScenes/SignusMusicScene.cs @@ -1,4 +1,4 @@ -using CalamityMod.NPCs.Signus; +using CalamityMod.NPCs.Signus; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Scenes/MusicScenes/SkeletronPrimeMasterMusicScene.cs b/Scenes/MusicScenes/SkeletronPrimeMasterMusicScene.cs new file mode 100644 index 0000000000..77398c4c76 --- /dev/null +++ b/Scenes/MusicScenes/SkeletronPrimeMasterMusicScene.cs @@ -0,0 +1,14 @@ +using CalamityMod.World; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Systems +{ + public class SkeletronPrimeMasterMusicScene : ModSceneEffect + { + public override int Music => MusicID.Boss3; // I spent 20 minutes trying to get this music to play while forgetting to actually override this in the first place _ YuH + public override SceneEffectPriority Priority => SceneEffectPriority.BossLow; + public override bool IsSceneEffectActive(Player player) => Main.masterMode && CalamityWorld.revenge && NPC.AnyNPCs(NPCID.SkeletronPrime) && Main.npc[NPC.FindFirstNPC(NPCID.SkeletronPrime)].Distance(player.Center) <= 525f * 16f; + } +} diff --git a/Scenes/MusicScenes/SlimeGodMusicScene.cs b/Scenes/MusicScenes/SlimeGodMusicScene.cs index 11aeb12d14..0572712bcf 100644 --- a/Scenes/MusicScenes/SlimeGodMusicScene.cs +++ b/Scenes/MusicScenes/SlimeGodMusicScene.cs @@ -1,4 +1,4 @@ -using CalamityMod.NPCs.SlimeGod; +using CalamityMod.NPCs.SlimeGod; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Scenes/MusicScenes/StormWeaverMusicScene.cs b/Scenes/MusicScenes/StormWeaverMusicScene.cs index a37b0b2c08..528cae95a3 100644 --- a/Scenes/MusicScenes/StormWeaverMusicScene.cs +++ b/Scenes/MusicScenes/StormWeaverMusicScene.cs @@ -14,9 +14,9 @@ namespace CalamityMod.Systems public override int VanillaMusic => MusicID.Boss3; public override int OtherworldMusic => MusicID.OtherworldlyBoss2; public override int[] AdditionalNPCs => new int[] - { - ModContent.NPCType(), - ModContent.NPCType() - }; + { + ModContent.NPCType(), + ModContent.NPCType() + }; } } diff --git a/Schematics/CalamitySchematicIO.cs b/Schematics/CalamitySchematicIO.cs index ec33440d5d..8705364156 100644 --- a/Schematics/CalamitySchematicIO.cs +++ b/Schematics/CalamitySchematicIO.cs @@ -276,7 +276,7 @@ namespace CalamityMod.Schematics // WallID.Count from TML 1.4 // In 1.4.4, it's 347, but this can be acquired the normal way. public const ushort TML_14_WallID_Count = 316; - + // A generous buffer of 16 megabytes is the default for schematics. If this somehow isn't big enough, they can get bigger. private const int SchematicBufferStartingSize = 16777216; @@ -556,10 +556,10 @@ namespace CalamityMod.Schematics schematic.areaIndices[x, y] = (ushort)metaTileIndex; } - PostAreaIteration: +PostAreaIteration: - // If there are too many unique tiles, set the size to zero. This will cause the schematic to fail to export. - // Even in a schematic of nothing but air, there is one unique tile: air. +// If there are too many unique tiles, set the size to zero. This will cause the schematic to fail to export. +// Even in a schematic of nothing but air, there is one unique tile: air. if (schematic.uniqueTiles.Count > SchematicData.MaxUniqueTileCount) schematic.uniqueTiles.Clear(); diff --git a/Schematics/SchematicManager.cs b/Schematics/SchematicManager.cs index d79e090402..44eb788302 100644 --- a/Schematics/SchematicManager.cs +++ b/Schematics/SchematicManager.cs @@ -1,8 +1,8 @@ -using CalamityMod.TileEntities; +using System; +using System.Collections.Generic; +using CalamityMod.TileEntities; using CalamityMod.Tiles.DraedonStructures; using Microsoft.Xna.Framework; -using System; -using System.Collections.Generic; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -63,7 +63,7 @@ namespace CalamityMod.Schematics internal const string VernalKey = "Vernal Pass"; internal const string VernalFilename = "Schematics/VernalPass.csch"; - + internal const string MechanicShedKey = "Mechanic Key"; internal const string MechanicShedFilename = "Schematics/MechanicShed.csch"; @@ -90,7 +90,7 @@ namespace CalamityMod.Schematics internal const string CragRuinKey3Filename = "Schematics/CragRuin3.csch"; internal const string CragRuinKey4 = "Crag Ruin 4"; internal const string CragRuinKey4Filename = "Schematics/CragRuin4.csch"; - + internal static Dictionary TileMaps; internal static Dictionary PilePlacementMaps; public delegate void PilePlacementFunction(int x, int y, Rectangle placeInArea); diff --git a/Skies/AstralDesertSurfaceClose.png b/Skies/AstralDesertSurfaceClose.png deleted file mode 100644 index c96ebe2cfd..0000000000 Binary files a/Skies/AstralDesertSurfaceClose.png and /dev/null differ diff --git a/Skies/AstralDesertSurfaceFar.png b/Skies/AstralDesertSurfaceFar.png deleted file mode 100644 index a2337a7d8f..0000000000 Binary files a/Skies/AstralDesertSurfaceFar.png and /dev/null differ diff --git a/Skies/AstralDesertSurfaceMiddle.png b/Skies/AstralDesertSurfaceMiddle.png deleted file mode 100644 index 6b5c33dee8..0000000000 Binary files a/Skies/AstralDesertSurfaceMiddle.png and /dev/null differ diff --git a/Skies/AstralMonolithScreenShaderData.cs b/Skies/AstralMonolithScreenShaderData.cs new file mode 100644 index 0000000000..b497c59694 --- /dev/null +++ b/Skies/AstralMonolithScreenShaderData.cs @@ -0,0 +1,31 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.Graphics.Effects; +using Terraria.Graphics.Shaders; + +namespace CalamityMod.Skies +{ + public class AstralMonolithScreenShaderData : ScreenShaderData + { + public AstralMonolithScreenShaderData(string passName) + : base(passName) + { + } + + public override void Apply() + { + Vector3 vec = Main.ColorOfTheSkies.ToVector3(); + vec *= 0.4f; + base.UseOpacity(Math.Max(vec.X, Math.Max(vec.Y, vec.Z))); + base.Apply(); + } + + public override void Update(GameTime gameTime) + { + if (Main.LocalPlayer.Calamity().monolithAstralShader <= 0) + Filters.Scene["CalamityMod:MonolithAstral"].Deactivate(Array.Empty()); + } + } +} diff --git a/Skies/AstralMonolithSky.cs b/Skies/AstralMonolithSky.cs new file mode 100644 index 0000000000..11135236e0 --- /dev/null +++ b/Skies/AstralMonolithSky.cs @@ -0,0 +1,103 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.GameContent; +using Terraria.Graphics.Effects; +using Terraria.ID; + +namespace CalamityMod.Skies +{ + public class AstralMonolithSky : CustomSky + { + private bool skyActive; + private float opacity; + + public override void Deactivate(params object[] args) => skyActive = false; + + public override void Reset() => skyActive = false; + + public override bool IsActive() => skyActive || opacity > 0f; + + public override void Activate(Vector2 position, params object[] args) => skyActive = true; + + public override void Update(GameTime gameTime) + { + if (Main.LocalPlayer.Calamity().monolithAstralShader < 1) + skyActive = false; + + if (skyActive && opacity < 1f) + opacity += 0.02f; + else if (!skyActive && opacity > 0f) + opacity -= 0.02f; + + Opacity = opacity; + } + + public override void Draw(SpriteBatch spriteBatch, float minDepth, float maxDepth) + { + if (Main.LocalPlayer.Calamity().monolithAstralShader <= 0) + return; + float whateverTheFuckThisVariableIsSupposedToBe = 3.40282347E+38f; + if (maxDepth >= whateverTheFuckThisVariableIsSupposedToBe && minDepth < whateverTheFuckThisVariableIsSupposedToBe) + { + spriteBatch.Draw(CalamityMod.AstralSky, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), Color.White * opacity); + + // Terraria's conditions. + if (Main.netMode != NetmodeID.Server) + { + int bgTop = (int)((-Main.screenPosition.Y) / (Main.worldSurface * 16.0 - 600.0) * 200.0); + float colorMult = 0.952f * opacity; + Color astralcyan = new Color(100, 183, 255); + Color purple = new Color(201, 148, 255); + Color yellow = new Color(255, 146, 73); + float width1 = Main.screenWidth / 500f; + float height1 = Main.screenHeight / 600f; + float width2 = Main.screenWidth / 600f; + float height2 = Main.screenHeight / 800f; + float width3 = Main.screenWidth / 200f; + float height3 = Main.screenHeight / 900f; + float width4 = Main.screenWidth / 1000f; + float height4 = Main.screenHeight / 200f; + for (int i = 0; i < Main.star.Length; i++) + { + Star star = Main.star[i]; + if (star == null) + continue; + + Texture2D t2D = TextureAssets.Star[star.type].Value; + Vector2 origin = new Vector2(t2D.Width * 0.5f, t2D.Height * 0.5f); + float posX = star.position.X * width1; + float posY = star.position.Y * height1; + Vector2 position = new Vector2(posX + origin.X, posY + origin.Y + bgTop); + spriteBatch.Draw(t2D, position, new Rectangle(0, 0, t2D.Width, t2D.Height), astralcyan * star.twinkle * colorMult, star.rotation, origin, (star.scale * star.twinkle) - 0.2f, SpriteEffects.None, 0f); + + origin = new Vector2(t2D.Width * 0.2f, t2D.Height * 0.2f); + posX = star.position.X * width2; + posY = star.position.Y * height2; + position = new Vector2(posX + origin.X, posY + origin.Y + bgTop); + spriteBatch.Draw(t2D, position, new Rectangle(0, 0, t2D.Width, t2D.Height), purple * star.twinkle * colorMult, star.rotation, origin, (star.scale * star.twinkle) + 0.2f, SpriteEffects.None, 0f); + + origin = new Vector2(t2D.Width * 0.8f, t2D.Height * 0.8f); + posX = star.position.X * width3; + posY = star.position.Y * height3; + position = new Vector2(posX + origin.X, posY + origin.Y + bgTop); + spriteBatch.Draw(t2D, position, new Rectangle(0, 0, t2D.Width, t2D.Height), yellow * star.twinkle * colorMult, star.rotation, origin, star.scale * star.twinkle, SpriteEffects.None, 0f); + + origin = new Vector2(t2D.Width * 0.5f, t2D.Height * 0.5f); + posX = star.position.X * width4; + posY = star.position.Y * height4; + position = new Vector2(posX + origin.X, posY + origin.Y + bgTop); + spriteBatch.Draw(t2D, position, new Rectangle(0, 0, t2D.Width, t2D.Height), Color.White * star.twinkle * colorMult, star.rotation, origin, star.scale * star.twinkle, SpriteEffects.None, 0f); + } + } + } + } + + public override Color OnTileColor(Color inColor) + { + return Color.Lerp(inColor, new Color(63, 51, 90, inColor.A), opacity); + } + + public override float GetCloudAlpha() => (1f - opacity) * 0.3f + 0.7f; + } +} diff --git a/Skies/AstralScreenShaderData.cs b/Skies/AstralScreenShaderData.cs index 56a7581868..01d6ea0873 100644 --- a/Skies/AstralScreenShaderData.cs +++ b/Skies/AstralScreenShaderData.cs @@ -1,6 +1,6 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.Graphics.Effects; using Terraria.Graphics.Shaders; @@ -21,7 +21,7 @@ namespace CalamityMod.Skies public override void Update(GameTime gameTime) { - if (!Main.LocalPlayer.Calamity().ZoneAstral || Main.gameMenu) + if ((!Main.LocalPlayer.Calamity().ZoneAstral && Main.LocalPlayer.Calamity().monolithAstralShader <= 0) || Main.gameMenu) Filters.Scene["CalamityMod:Astral"].Deactivate(Array.Empty()); } } diff --git a/Skies/AstralSky.cs b/Skies/AstralSky.cs index accc6752b0..7290303387 100644 --- a/Skies/AstralSky.cs +++ b/Skies/AstralSky.cs @@ -2,10 +2,11 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; -using Terraria.ModLoader; using Terraria.GameContent; using Terraria.Graphics.Effects; using Terraria.ID; +using Terraria.ModLoader; +using System.Reflection; namespace CalamityMod.Skies { @@ -16,7 +17,7 @@ namespace CalamityMod.Skies public override void Deactivate(params object[] args) { - skyActive = Main.LocalPlayer.Calamity().ZoneAstral && !Main.LocalPlayer.ZoneDungeon && BiomeTileCounterSystem.AstralTiles > 950; + skyActive = (Main.LocalPlayer.Calamity().ZoneAstral && !Main.LocalPlayer.ZoneDungeon && BiomeTileCounterSystem.AstralTiles > 950) || Main.LocalPlayer.Calamity().monolithAstralShader > 0; } public override void Reset() @@ -110,13 +111,15 @@ namespace CalamityMod.Skies public override void Update(GameTime gameTime) { - if (!Main.LocalPlayer.Calamity().ZoneAstral || Main.gameMenu) + if ((!Main.LocalPlayer.Calamity().ZoneAstral && Main.LocalPlayer.Calamity().monolithAstralShader <= 0) || Main.gameMenu) skyActive = false; if (skyActive && opacity < 1f) opacity += 0.02f; else if (!skyActive && opacity > 0f) opacity -= 0.02f; + + Opacity = opacity; } public override float GetCloudAlpha() diff --git a/Skies/AstralSkyDesert.cs b/Skies/AstralSkyDesert.cs deleted file mode 100644 index ccad1cda73..0000000000 --- a/Skies/AstralSkyDesert.cs +++ /dev/null @@ -1,137 +0,0 @@ -using CalamityMod.Systems; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ModLoader; -using Terraria.GameContent; -using Terraria.Graphics.Effects; -using Terraria.ID; - -namespace CalamityMod.Skies -{ - public class AstralSkyDesert : CustomSky - { - private bool skyActive; - private float opacity; - - private const float Scale = 2f; - - public override void Deactivate(params object[] args) - { - skyActive = Main.LocalPlayer.Calamity().ZoneAstral && !Main.LocalPlayer.ZoneDungeon && BiomeTileCounterSystem.AstralTiles > 950 && Main.LocalPlayer.ZoneDesert && !Main.LocalPlayer.ZoneSnow; - } - - public override void Reset() - { - skyActive = false; - } - - public override bool IsActive() - { - return skyActive || opacity > 0f; - } - - public override void Activate(Vector2 position, params object[] args) - { - skyActive = true; - } - public override Color OnTileColor(Color inColor) - { - return Color.Lerp(inColor, new Color(63, 51, 90, inColor.A), opacity); - } - - public override void Draw(SpriteBatch spriteBatch, float minDepth, float maxDepth) - { - // Small worlds, default draw height. - int AstralBiomeHeight = (World.AstralBiome.YStart + (int)Main.worldSurface) / 2; - - // Medium worlds. - if (Main.maxTilesX >= 6400 && Main.maxTilesX < 8400) - AstralBiomeHeight = (World.AstralBiome.YStart + (int)Main.worldSurface) / 4; - - // Large worlds (and anything bigger). - if (Main.maxTilesX >= 8400) - AstralBiomeHeight = (World.AstralBiome.YStart + (int)Main.worldSurface) / 140; - - // Background from here starting from the back layer to the front layer. - float width = Main.screenWidth / 2f; - float height = Main.screenHeight / 2f; - Color color = new Color(63, 51, 90, 255) * opacity; - if (maxDepth >= 9f && minDepth < 9f) - { - float screenParralaxMultiplier = 0.16f; - Texture2D texture = CalamityMod.AstralSurfaceHorizon; - int x = (int)(Main.screenPosition.X * screenParralaxMultiplier); - x %= (int)(texture.Width * Scale); - int y = (int)(Main.screenPosition.Y * screenParralaxMultiplier); - y -= 1380; // 1000 - for (int k = -1; k <= 1; k++) - { - var pos = new Vector2(width - x + texture.Width * k * Scale, height - y); - spriteBatch.Draw(texture, pos - texture.Size() / 2f * Scale, null, color, 0f, new Vector2(0f, (float)AstralBiomeHeight), Scale, SpriteEffects.None, 0f); - } - } - - if (maxDepth >= 8f && minDepth < 8f) - { - float screenParralaxMultiplier = 0.4f; - Texture2D texture = CalamityMod.AstralDesertSurfaceFar; - int x = (int)(Main.screenPosition.X * 0.5f * screenParralaxMultiplier); - x %= (int)(texture.Width * Scale); - int y = (int)(Main.screenPosition.Y * 0.45f * screenParralaxMultiplier); - y -= 1520; // 1000 - for (int k = -1; k <= 1; k++) - { - var pos = new Vector2(width - x + texture.Width * k * Scale, height - y); - spriteBatch.Draw(texture, pos - texture.Size() / 2f * Scale, null, color, 0f, new Vector2(0f, (float)AstralBiomeHeight), Scale, SpriteEffects.None, 0f); - } - } - - if (maxDepth >= 7f && minDepth < 7f) - { - float screenParralaxMultiplier = 0.4f; - Texture2D texture = CalamityMod.AstralDesertSurfaceMiddle; - int x = (int)(Main.screenPosition.X * 0.8f * screenParralaxMultiplier); - x %= (int)(texture.Width * Scale); - int y = (int)(Main.screenPosition.Y * 0.5f * screenParralaxMultiplier); - y -= 1900; // 1000 - for (int k = -1; k <= 1; k++) - { - var pos = new Vector2(width - x + texture.Width * k * Scale, height - y); - spriteBatch.Draw(texture, pos - texture.Size() / 2f * Scale, null, color, 0f, new Vector2(0f, (float)AstralBiomeHeight), Scale, SpriteEffects.None, 0f); - } - } - - if (maxDepth >= 6f && minDepth < 6f) - { - float screenParralaxMultiplier = 0.4f; - Texture2D texture = CalamityMod.AstralDesertSurfaceClose; - int x = (int)(Main.screenPosition.X * 1f * screenParralaxMultiplier); - x %= (int)(texture.Width * Scale); - int y = (int)(Main.screenPosition.Y * 0.55f * screenParralaxMultiplier); - y -= 2050; // 1000 - for (int k = -1; k <= 1; k++) - { - var pos = new Vector2(width - x + texture.Width * k * Scale, height - y); - spriteBatch.Draw(texture, pos - texture.Size() / 2f * Scale, null, color, 0f, new Vector2(0f, (float)AstralBiomeHeight), Scale, SpriteEffects.None, 0f); - } - } - } - - public override void Update(GameTime gameTime) - { - if (!Main.LocalPlayer.Calamity().ZoneAstral || Main.gameMenu) - skyActive = false; - - if (skyActive && opacity < 1f) - opacity += 0.02f; - else if (!skyActive && opacity > 0f) - opacity -= 0.02f; - } - - public override float GetCloudAlpha() - { - return (1f - opacity) * 0.97f + 0.03f; - } - } -} diff --git a/Skies/AstralSkySnow.cs b/Skies/AstralSkySnow.cs deleted file mode 100644 index a00b331da4..0000000000 --- a/Skies/AstralSkySnow.cs +++ /dev/null @@ -1,171 +0,0 @@ -using CalamityMod.Systems; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ModLoader; -using Terraria.GameContent; -using Terraria.Graphics.Effects; -using Terraria.ID; - -namespace CalamityMod.Skies -{ - public class AstralSkySnow : CustomSky - { - private bool skyActive; - private float opacity; - - private const float Scale = 2.0f; - private const float ScreenParralaxMultiplier = 0.4f; - - public override void Deactivate(params object[] args) - { - skyActive = Main.LocalPlayer.Calamity().ZoneAstral && !Main.LocalPlayer.ZoneDungeon && BiomeTileCounterSystem.AstralTiles > 950 && Main.LocalPlayer.ZoneSnow && !Main.LocalPlayer.ZoneDesert; - } - - public override void Reset() - { - skyActive = false; - } - - public override bool IsActive() - { - return skyActive || opacity > 0f; - } - - public override void Activate(Vector2 position, params object[] args) - { - skyActive = true; - } - - public override Color OnTileColor(Color inColor) - { - return Color.Lerp(inColor, new Color(63, 51, 90, inColor.A), opacity); - } - - public override void Draw(SpriteBatch spriteBatch, float minDepth, float maxDepth) - { - // Small worlds, default draw height. - int AstralBiomeHeight = (World.AstralBiome.YStart + (int)Main.worldSurface) / 2; - - // Medium worlds. - if (Main.maxTilesX >= 6400 && Main.maxTilesX < 8400) - AstralBiomeHeight = (World.AstralBiome.YStart + (int)Main.worldSurface) / 4; - - // Large worlds (and anything bigger). - if (Main.maxTilesX >= 8400) - AstralBiomeHeight = (World.AstralBiome.YStart + (int)Main.worldSurface) / 140; - - // Background from here starting from the back layer to the front layer. - float width = Main.screenWidth / 2f; - float height = Main.screenHeight / 2f; - Color textureColor = new Color(116, 96, 164, 255) * opacity; - Vector2 origin = new Vector2(0f, AstralBiomeHeight); - if (maxDepth >= 9f && minDepth < 9f) - { - Texture2D texture = CalamityMod.AstralSurfaceHorizon; - int x = (int)(Main.screenPosition.X * 0.4f * ScreenParralaxMultiplier); - x %= (int)(texture.Width * Scale); - int y = (int)(Main.screenPosition.Y * 0.4f * ScreenParralaxMultiplier); - y -= 1380; // 1000 - Vector2 position = texture.Size() / 2f * Scale; - for (int k = -1; k <= 1; k++) - { - var pos = new Vector2(width - x + texture.Width * k * Scale, height - y); - spriteBatch.Draw(texture, pos - position, null, textureColor, 0f, origin, Scale, SpriteEffects.None, 0f); - } - } - - if (maxDepth >= 8f && minDepth < 8f) - { - Texture2D texture = CalamityMod.AstralSurfaceFar; - int x = (int)(Main.screenPosition.X * 0.5f * ScreenParralaxMultiplier); - x %= (int)(texture.Width * Scale); - int y = (int)(Main.screenPosition.Y * 0.45f * ScreenParralaxMultiplier); - y -= 1520; // 1000 - Vector2 position = texture.Size() / 2f * Scale; - for (int k = -1; k <= 1; k++) - { - var pos = new Vector2(width - x + texture.Width * k * Scale, height - y); - spriteBatch.Draw(texture, pos - position, null, textureColor, 0f, origin, Scale, SpriteEffects.None, 0f); - } - } - - if (maxDepth >= 7f && minDepth < 7f) - { - Texture2D texture = CalamityMod.AstralSnowSurfaceMiddle; - int x = (int)(Main.screenPosition.X * 0.8f * ScreenParralaxMultiplier); - x %= (int)(texture.Width * Scale); - int y = (int)(Main.screenPosition.Y * 0.5f * ScreenParralaxMultiplier); - y -= 1900; // 1000 - Vector2 position = texture.Size() / 2f * Scale; - for (int k = -1; k <= 1; k++) - { - var pos = new Vector2(width - x + texture.Width * k * Scale, height - y); - spriteBatch.Draw(texture, pos - position, null, textureColor, 0f, origin, Scale, SpriteEffects.None, 0f); - } - } - - if (maxDepth >= 6f && minDepth < 6f) - { - Texture2D texture = CalamityMod.AstralSurfaceClose; - int x = (int)(Main.screenPosition.X * 0.9f * ScreenParralaxMultiplier); - x %= (int)(texture.Width * Scale); - int y = (int)(Main.screenPosition.Y * 0.55f * ScreenParralaxMultiplier); - y -= 1880; // 1000 - Vector2 position = texture.Size() / 2f * Scale; - for (int k = -1; k <= 1; k++) - { - var pos = new Vector2(width - x + texture.Width * k * Scale, height - y); - spriteBatch.Draw(texture, pos - position, null, textureColor, 0f, origin, Scale, SpriteEffects.None, 0f); - } - - Texture2D textureglow = CalamityMod.AstralSurfaceCloseGlow; - Color textureGlowColor = Color.White * 0.7f * opacity; - for (int k = -1; k <= 1; k++) - { - var pos = new Vector2(width - x + texture.Width * k * Scale, height - y); - spriteBatch.Draw(textureglow, pos - position, null, textureGlowColor, 0f, origin, Scale, SpriteEffects.None, 0f); - } - } - - if (maxDepth >= 5f && minDepth < 5f) - { - Texture2D texture = CalamityMod.AstralSurfaceFront; - int x = (int)(Main.screenPosition.X * 1.1f * ScreenParralaxMultiplier); - x %= (int)(texture.Width * Scale); - int y = (int)(Main.screenPosition.Y * 0.6f * ScreenParralaxMultiplier); - y -= 2100; // 1000 - Vector2 position = texture.Size() / 2f * Scale; - for (int k = -1; k <= 1; k++) - { - var pos = new Vector2(width - x + texture.Width * k * Scale, height - y); - spriteBatch.Draw(texture, pos - position, null, textureColor, 0f, origin, Scale, SpriteEffects.None, 0f); - } - - Texture2D textureglow = CalamityMod.AstralSurfaceFrontGlow; - Color textureGlowColor = Color.White * 0.9f * opacity; - for (int k = -1; k <= 1; k++) - { - var pos = new Vector2(width - x + texture.Width * k * Scale, height - y); - spriteBatch.Draw(textureglow, pos - position, null, textureGlowColor, 0f, origin, Scale, SpriteEffects.None, 0f); - } - } - } - - public override void Update(GameTime gameTime) - { - if (!Main.LocalPlayer.Calamity().ZoneAstral || Main.gameMenu) - skyActive = false; - - if (skyActive && opacity < 1f) - opacity += 0.02f; - else if (!skyActive && opacity > 0f) - opacity -= 0.02f; - } - - public override float GetCloudAlpha() - { - return (1f - opacity) * 0.97f + 0.03f; - } - } -} diff --git a/Skies/AstralSkySurface.cs b/Skies/AstralSkySurface.cs deleted file mode 100644 index bb9af77ebb..0000000000 --- a/Skies/AstralSkySurface.cs +++ /dev/null @@ -1,179 +0,0 @@ -using CalamityMod.Systems; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ModLoader; -using Terraria.GameContent; -using Terraria.Graphics.Effects; -using Terraria.ID; - -namespace CalamityMod.Skies -{ - public class AstralSkySurface : CustomSky - { - private bool skyActive; - private float opacity; - - private const float Scale = 2f; - private const float ScreenParralaxMultiplier = 0.4f; - - public override void Deactivate(params object[] args) - { - skyActive = Main.LocalPlayer.Calamity().ZoneAstral && !Main.LocalPlayer.ZoneDungeon && BiomeTileCounterSystem.AstralTiles > 950 && !Main.LocalPlayer.ZoneDesert && !Main.LocalPlayer.ZoneSnow; - } - - public override void Reset() - { - skyActive = false; - } - - public override bool IsActive() - { - return skyActive || opacity > 0f; - } - - public override void Activate(Vector2 position, params object[] args) - { - skyActive = true; - } - - public override Color OnTileColor(Color inColor) - { - return Color.Lerp(inColor, new Color(63, 51, 90, inColor.A), opacity); - } - - public override void Draw(SpriteBatch spriteBatch, float minDepth, float maxDepth) - { - // Small worlds, default draw height. - int AstralBiomeHeight = (World.AstralBiome.YStart + (int)Main.worldSurface) / 2; - - // Medium worlds. - if (Main.maxTilesX >= 6400 && Main.maxTilesX < 8400) - AstralBiomeHeight = (World.AstralBiome.YStart + (int)Main.worldSurface) / 4; - - // Large worlds (and anything bigger). - if (Main.maxTilesX >= 8400) - AstralBiomeHeight = (World.AstralBiome.YStart + (int)Main.worldSurface) / 140; - - // Background from here starting from the back layer to the front layer. - float width = Main.screenWidth / 2f; - float height = Main.screenHeight / 2f; - Color textureColor = new Color(63, 51, 90, 255) * opacity; - Vector2 origin = new Vector2(0f, AstralBiomeHeight); - if (maxDepth >= 9f && minDepth < 9f) - { - Texture2D texture = CalamityMod.AstralSurfaceHorizon; - int x = (int)(Main.screenPosition.X * 0.4f * ScreenParralaxMultiplier); - x %= (int)(texture.Width * Scale); - int y = (int)(Main.screenPosition.Y * 0.4f * ScreenParralaxMultiplier); - y -= 1380; // 1000 - Vector2 position = texture.Size() / 2f * Scale; - for (int k = -1; k <= 1; k++) - { - var pos = new Vector2(width - x + texture.Width * k * Scale, height - y); - spriteBatch.Draw(texture, pos - position, null, textureColor, 0f, origin, Scale, SpriteEffects.None, 0f); - } - } - - if (maxDepth >= 8f && minDepth < 8f) - { - Texture2D texture = CalamityMod.AstralSurfaceFar; - int x = (int)(Main.screenPosition.X * 0.5f * ScreenParralaxMultiplier); - x %= (int)(texture.Width * Scale); - int y = (int)(Main.screenPosition.Y * 0.45f * ScreenParralaxMultiplier); - y -= 1520; // 1000 - Vector2 position = texture.Size() / 2f * Scale; - for (int k = -1; k <= 1; k++) - { - var pos = new Vector2(width - x + texture.Width * k * Scale, height - y); - spriteBatch.Draw(texture, pos - position, null, textureColor, 0f, origin, Scale, SpriteEffects.None, 0f); - } - } - - if (maxDepth >= 7f && minDepth < 7f) - { - Texture2D texture = CalamityMod.AstralSurfaceMiddle; - int x = (int)(Main.screenPosition.X * 0.8f * ScreenParralaxMultiplier); - x %= (int)(texture.Width * Scale); - int y = (int)(Main.screenPosition.Y * 0.5f * ScreenParralaxMultiplier); - y -= 1900; // 1000 - Vector2 position = texture.Size() / 2f * Scale; - for (int k = -1; k <= 1; k++) - { - var pos = new Vector2(width - x + texture.Width * k * Scale, height - y); - spriteBatch.Draw(texture, pos - position, null, textureColor, 0f, origin, Scale, SpriteEffects.None, 0f); - } - - Texture2D textureglow = CalamityMod.AstralSurfaceMiddleGlow; - Color textureGlowColor = Color.White * 0.5f * opacity; - for (int k = -1; k <= 1; k++) - { - var pos = new Vector2(width - x + texture.Width * k * Scale, height - y); - spriteBatch.Draw(textureglow, pos - position, null, textureGlowColor, 0f, origin, Scale, SpriteEffects.None, 0f); - } - } - - if (maxDepth >= 6f && minDepth < 6f) - { - Texture2D texture = CalamityMod.AstralSurfaceClose; - int x = (int)(Main.screenPosition.X * 0.9f * ScreenParralaxMultiplier); - x %= (int)(texture.Width * Scale); - int y = (int)(Main.screenPosition.Y * 0.55f * ScreenParralaxMultiplier); - y -= 1880; // 1000 - Vector2 position = texture.Size() / 2f * Scale; - for (int k = -1; k <= 1; k++) - { - var pos = new Vector2(width - x + texture.Width * k * Scale, height - y); - spriteBatch.Draw(texture, pos - position, null, textureColor, 0f, origin, Scale, SpriteEffects.None, 0f); - } - - Texture2D textureglow = CalamityMod.AstralSurfaceCloseGlow; - Color textureGlowColor = Color.White * 0.7f * opacity; - for (int k = -1; k <= 1; k++) - { - var pos = new Vector2(width - x + texture.Width * k * Scale, height - y); - spriteBatch.Draw(textureglow, pos - position, null, textureGlowColor, 0f, origin, Scale, SpriteEffects.None, 0f); - } - } - - if (maxDepth >= 5f && minDepth < 5f) - { - Texture2D texture = CalamityMod.AstralSurfaceFront; - int x = (int)(Main.screenPosition.X * 1.1f * ScreenParralaxMultiplier); - x %= (int)(texture.Width * Scale); - int y = (int)(Main.screenPosition.Y * 0.6f * ScreenParralaxMultiplier); - y -= 2100; // 1000 - Vector2 position = texture.Size() / 2f * Scale; - for (int k = -1; k <= 1; k++) - { - var pos = new Vector2(width - x + texture.Width * k * Scale, height - y); - spriteBatch.Draw(texture, pos - position, null, textureColor, 0f, origin, Scale, SpriteEffects.None, 0f); - } - - Texture2D textureglow = CalamityMod.AstralSurfaceFrontGlow; - Color textureGlowColor = Color.White * 0.9f * opacity; - for (int k = -1; k <= 1; k++) - { - var pos = new Vector2(width - x + texture.Width * k * Scale, height - y); - spriteBatch.Draw(textureglow, pos - position, null, textureGlowColor, 0f, origin, Scale, SpriteEffects.None, 0f); - } - } - } - - public override void Update(GameTime gameTime) - { - if (!Main.LocalPlayer.Calamity().ZoneAstral || Main.gameMenu) - skyActive = false; - - if (skyActive && opacity < 1f) - opacity += 0.02f; - else if (!skyActive && opacity > 0f) - opacity -= 0.02f; - } - - public override float GetCloudAlpha() - { - return (1f - opacity) * 0.97f + 0.03f; - } - } -} diff --git a/Skies/AstralSnowSurfaceMiddle.png b/Skies/AstralSnowSurfaceMiddle.png deleted file mode 100644 index ff4e5fc236..0000000000 Binary files a/Skies/AstralSnowSurfaceMiddle.png and /dev/null differ diff --git a/Skies/AstralSurfaceClose.png b/Skies/AstralSurfaceClose.png deleted file mode 100644 index 166e8bc48d..0000000000 Binary files a/Skies/AstralSurfaceClose.png and /dev/null differ diff --git a/Skies/AstralSurfaceFar.png b/Skies/AstralSurfaceFar.png deleted file mode 100644 index de6901e9e4..0000000000 Binary files a/Skies/AstralSurfaceFar.png and /dev/null differ diff --git a/Skies/AstralSurfaceFront.png b/Skies/AstralSurfaceFront.png deleted file mode 100644 index d9db0020e9..0000000000 Binary files a/Skies/AstralSurfaceFront.png and /dev/null differ diff --git a/Skies/AstralSurfaceHorizon.png b/Skies/AstralSurfaceHorizon.png deleted file mode 100644 index 8f448fb3b4..0000000000 Binary files a/Skies/AstralSurfaceHorizon.png and /dev/null differ diff --git a/Skies/AstralSurfaceMiddle.png b/Skies/AstralSurfaceMiddle.png deleted file mode 100644 index d3f984c001..0000000000 Binary files a/Skies/AstralSurfaceMiddle.png and /dev/null differ diff --git a/Skies/BossRushSky.cs b/Skies/BossRushSky.cs index ec6463980b..a0e21abc62 100644 --- a/Skies/BossRushSky.cs +++ b/Skies/BossRushSky.cs @@ -1,7 +1,7 @@ -using CalamityMod.Events; +using System; +using CalamityMod.Events; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.GameContent; using Terraria.Graphics.Effects; @@ -23,7 +23,7 @@ namespace CalamityMod.Skies public static bool DetermineDrawEligibility() { - bool useEffect = ((BossRushEvent.BossRushActive && BossRushEvent.StartTimer > 100) || ShouldDrawRegularly) && !Main.gameMenu; + bool useEffect = ((BossRushEvent.BossRushActive && BossRushEvent.StartTimer > 100) || ShouldDrawRegularly || Main.LocalPlayer?.Calamity()?.monolithBossRushShader > 0) && !Main.gameMenu; if (SkyManager.Instance["CalamityMod:BossRush"] != null && useEffect != SkyManager.Instance["CalamityMod:BossRush"].IsActive()) { @@ -66,7 +66,7 @@ namespace CalamityMod.Skies private float GetIntensity() { - if (ShouldDrawRegularly) + if (ShouldDrawRegularly || Main.LocalPlayer?.Calamity().monolithBossRushShader > 0) return 1f; float fadeRatio = BossRushEvent.StartTimer / (float)BossRushEvent.StartEffectTotalTime; @@ -77,7 +77,7 @@ namespace CalamityMod.Skies public override void Draw(SpriteBatch spriteBatch, float minDepth, float maxDepth) { - if (GetIntensity() == 0f) + if (GetIntensity() == 0f && Main.LocalPlayer?.Calamity()?.monolithBossRushShader <= 0) return; if (maxDepth >= 0 && minDepth < 0 && GetIntensity() > 0f) @@ -103,7 +103,7 @@ namespace CalamityMod.Skies Main.spriteBatch.Begin(); // Draw the Xeroc eye at the back of the sky. - if (maxDepth >= float.MaxValue && minDepth < float.MaxValue && (BossRushEvent.EndTimer < BossRushEvent.EndVisualEffectTime - 40f || ShouldDrawRegularly)) + if (maxDepth >= float.MaxValue && minDepth < float.MaxValue && (BossRushEvent.EndTimer < BossRushEvent.EndVisualEffectTime - 40f || ShouldDrawRegularly || Main.LocalPlayer?.Calamity()?.monolithBossRushShader > 0)) { Vector2 screenCenter = Main.screenPosition + new Vector2(Main.screenWidth, Main.screenHeight) * 0.5f; screenCenter += new Vector2(Main.screenWidth, Main.screenHeight) * (Main.GameViewMatrix.Zoom - Vector2.One) * 0.5f; diff --git a/Skies/BrimstoneCragSky.cs b/Skies/BrimstoneCragSky.cs index b0ab303404..1370a47a1d 100644 --- a/Skies/BrimstoneCragSky.cs +++ b/Skies/BrimstoneCragSky.cs @@ -1,7 +1,7 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; +using System; using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.GameContent; using Terraria.Graphics.Effects; diff --git a/Skies/CryogenSky.cs b/Skies/CryogenSky.cs index 1bbd055d07..e8d05d6677 100644 --- a/Skies/CryogenSky.cs +++ b/Skies/CryogenSky.cs @@ -1,7 +1,7 @@ -using CalamityMod.NPCs.Cryogen; +using System; +using CalamityMod.NPCs.Cryogen; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.GameContent; using Terraria.Graphics.Effects; @@ -30,7 +30,7 @@ namespace CalamityMod.Skies public static void UpdateDrawEligibility() { - bool useEffect = (NPC.AnyNPCs(ModContent.NPCType()) || ShouldDrawRegularly) && !Main.gameMenu; + bool useEffect = (NPC.AnyNPCs(ModContent.NPCType()) || ShouldDrawRegularly || Main.LocalPlayer.Calamity().monolithCryogenShader > 0) && !Main.gameMenu; if (SkyManager.Instance["CalamityMod:Cryogen"] != null && useEffect != SkyManager.Instance["CalamityMod:Cryogen"].IsActive()) { @@ -46,10 +46,17 @@ namespace CalamityMod.Skies public override void Update(GameTime gameTime) { - if (FadeInCountdown > 0) - FadeInCountdown--; + if (!ShouldDrawRegularly && Main.LocalPlayer.Calamity().monolithCryogenShader <= 0) + { + if (FadeInCountdown > 0) + FadeInCountdown--; + } + else + { + FadeInCountdown = 1; + } - if (CryogenIndex == -1 && !ShouldDrawRegularly) + if (CryogenIndex == -1 && !ShouldDrawRegularly && Main.LocalPlayer.Calamity().monolithCryogenShader <= 0) { UpdateCryogenIndex(); if (FadeoutTimer == 0) @@ -89,7 +96,7 @@ namespace CalamityMod.Skies public float CalculateAuroraStrength() { - if (ShouldDrawRegularly) + if (ShouldDrawRegularly || Main.LocalPlayer.Calamity().monolithCryogenShader > 0) return 1f; return 1f - GetCryogenLifeRatio(); @@ -143,7 +150,7 @@ namespace CalamityMod.Skies auroraColor *= fadeInLerp; if (FadeoutTimer > 0f) auroraColor *= fadeOutLerp; - if (Main.dayTime) + if (Main.IsItDay()) auroraColor *= 0.4f; float yBrightness = MathHelper.Lerp(1.5f, 0.5f, 1f - MathHelper.Clamp((Auroras[i].Center.Y + 300f) / 200f, 0f, 1f)) * 1.3f; diff --git a/Skies/ExoMechsScreenShaderData.cs b/Skies/ExoMechsScreenShaderData.cs index 8ec6136bb8..c40ca177c1 100644 --- a/Skies/ExoMechsScreenShaderData.cs +++ b/Skies/ExoMechsScreenShaderData.cs @@ -19,13 +19,15 @@ namespace CalamityMod.Skies { if (CalamityGlobalNPC.draedon != -1 && Draedon.ExoMechIsPresent) UseTargetPosition(Main.npc[CalamityGlobalNPC.draedon].Center); + if (Main.LocalPlayer.Calamity().monolithExoShader > 0) + UseTargetPosition(Main.LocalPlayer.Center); base.Apply(); } public override void Update(GameTime gameTime) { - if (!ExoMechsSky.CanSkyBeActive) + if (!ExoMechsSky.CanSkyBeActive && Main.LocalPlayer.Calamity().monolithExoShader <= 0) Filters.Scene["CalamityMod:ExoMechs"].Deactivate(Array.Empty()); } } diff --git a/Skies/ExoMechsSky.cs b/Skies/ExoMechsSky.cs index 31cdddfc44..ef8f893313 100644 --- a/Skies/ExoMechsSky.cs +++ b/Skies/ExoMechsSky.cs @@ -1,15 +1,15 @@ -using CalamityMod.NPCs; +using System; +using System.Collections.Generic; +using CalamityMod.NPCs; using CalamityMod.NPCs.ExoMechs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.Collections.Generic; using Terraria; +using Terraria.Audio; +using Terraria.GameContent; using Terraria.Graphics.Effects; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using Terraria.GameContent; namespace CalamityMod.Skies { @@ -53,8 +53,10 @@ namespace CalamityMod.Skies if (CalamityGlobalNPC.draedonExoMechWorm != -1 && Main.npc[CalamityGlobalNPC.draedonExoMechWorm].active) combinedLifeRatio += Main.npc[CalamityGlobalNPC.draedonExoMechWorm].life / (float)Main.npc[CalamityGlobalNPC.draedonExoMechWorm].lifeMax; - - return (float)Math.Pow(1f - combinedLifeRatio / 3f, 2D); + if (combinedLifeRatio > 0) + return (float)Math.Pow(1f - combinedLifeRatio / 3f, 2D); + else + return MathHelper.Lerp(1f, 0f, Main.LocalPlayer.Calamity().monolithExoShader / 30); } } @@ -91,7 +93,7 @@ namespace CalamityMod.Skies public override void Update(GameTime gameTime) { - if (!CanSkyBeActive) + if (!CanSkyBeActive && Main.LocalPlayer?.Calamity()?.monolithExoShader <= 0) { LightningIntensity = 0f; BackgroundIntensity = MathHelper.Clamp(BackgroundIntensity - 0.08f, 0f, 1f); @@ -130,7 +132,7 @@ namespace CalamityMod.Skies public override void Draw(SpriteBatch spriteBatch, float minDepth, float maxDepth) { - if (!CanSkyBeActive) + if (!CanSkyBeActive && Main.LocalPlayer?.Calamity()?.monolithExoShader <= 0) return; if (maxDepth >= float.MaxValue) @@ -188,6 +190,9 @@ namespace CalamityMod.Skies public override void Deactivate(params object[] args) { } - public override bool IsActive() => CanSkyBeActive && !Main.gameMenu; + public override bool IsActive() + { + return !Main.gameMenu && (CanSkyBeActive || Main.LocalPlayer?.Calamity()?.monolithExoShader > 0); + } } } diff --git a/Skies/MonolithScreenShaderData.cs b/Skies/MonolithScreenShaderData.cs index 51f3666345..690ee07a41 100644 --- a/Skies/MonolithScreenShaderData.cs +++ b/Skies/MonolithScreenShaderData.cs @@ -1,6 +1,6 @@ +using System; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.Graphics.Effects; using Terraria.Graphics.Shaders; diff --git a/Skies/MonolithSky.cs b/Skies/MonolithSky.cs index 28bf868c5b..aadf6e38e0 100644 --- a/Skies/MonolithSky.cs +++ b/Skies/MonolithSky.cs @@ -1,7 +1,7 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; +using System; using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.GameContent; using Terraria.Graphics.Effects; diff --git a/Skies/SCalScreenShaderData.cs b/Skies/SCalScreenShaderData.cs index c8541d92ea..92f0b5ca3a 100644 --- a/Skies/SCalScreenShaderData.cs +++ b/Skies/SCalScreenShaderData.cs @@ -54,8 +54,6 @@ namespace CalamityMod.Skies if (Main.npc[SCalIndex].ModNPC().cirrus) Filters.Scene["CalamityMod:SupremeCalamitas"].GetShader().UseColor(0.9f, 0.3f, 0.9f); - else - Filters.Scene["CalamityMod:SupremeCalamitas"].GetShader().UseColor(1.1f, 0.3f, 0.3f); } base.Apply(); } diff --git a/Skies/SCalSky.cs b/Skies/SCalSky.cs index dd3e8ed6ae..bb3af0b383 100644 --- a/Skies/SCalSky.cs +++ b/Skies/SCalSky.cs @@ -1,11 +1,11 @@ -using CalamityMod.Events; +using System; +using System.Collections.Generic; +using CalamityMod.Events; using CalamityMod.NPCs; using CalamityMod.NPCs.SupremeCalamitas; using CalamityMod.Projectiles.Boss; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.Collections.Generic; using Terraria; using Terraria.GameContent; using Terraria.Graphics.Effects; @@ -15,6 +15,8 @@ namespace CalamityMod.Skies { public class SCalSky : CustomSky { + public Color cinderColortoBe = Color.Red; + public Color cinderColor = Color.Red; public class Cinder { public int Time; @@ -67,15 +69,23 @@ namespace CalamityMod.Skies if (lifeRatio < 0.1f) { if (lifeRatio <= 0.01f) - return 32; + return 25; return (int)Math.Round(MathHelper.Lerp(2f, 11f, Utils.GetLerpValue(0.03f, 0.1f, lifeRatio, true))); } + // Once the music hits, release more cinders + if (scal.ModNPC().postMusicHit) + return 6; + // Release a good amount of cinders while brothers or Sepulcher-1 are alive. Sepulcher-2 falls into an above case and does not execute this return. if (NPC.AnyNPCs(ModContent.NPCType()) || NPC.AnyNPCs(ModContent.NPCType()) || NPC.AnyNPCs(ModContent.NPCType())) return 10; + // If one brother is alive release more cinders + if ((NPC.AnyNPCs(ModContent.NPCType()) == false && NPC.AnyNPCs(ModContent.NPCType()) == true) || (NPC.AnyNPCs(ModContent.NPCType()) == false && NPC.AnyNPCs(ModContent.NPCType()) == true)) + return 7; + // Release a moderate amount of cinders normally. return 18; } @@ -103,6 +113,8 @@ namespace CalamityMod.Skies if (NPC.AnyNPCs(ModContent.NPCType()) || NPC.AnyNPCs(ModContent.NPCType()) || NPC.AnyNPCs(ModContent.NPCType())) return 7.4f; + if (scal.ModNPC().postMusicHit) + return 25 * MathHelper.Clamp(Utils.GetLerpValue(-60, 0, scal.ModNPC().musicSyncCounter), 0.5f, 1f); // Move moderately quickly usually. return 5.6f; } @@ -130,14 +142,22 @@ namespace CalamityMod.Skies NPC scal = Main.npc[CalamityGlobalNPC.SCal]; bool cirrus = scal.ModNPC().cirrus; float lifeRatio = scal.life / (float)scal.lifeMax; + + if (NPC.AnyNPCs(ModContent.NPCType()) == true && NPC.AnyNPCs(ModContent.NPCType()) == false) + return Color.Lerp(Color.MediumTurquoise, Color.Cyan, Main.rand.NextFloat(0.2f, 0.9f)); + if (NPC.AnyNPCs(ModContent.NPCType()) == true && NPC.AnyNPCs(ModContent.NPCType()) == false) + return Color.Lerp(Color.Magenta, Color.MediumVioletRed, Main.rand.NextFloat(0.2f, 0.9f)); + if (NPC.AnyNPCs(ModContent.NPCType()) == true && NPC.AnyNPCs(ModContent.NPCType()) == true) + return Color.Lerp(Color.Red, Color.IndianRed, Main.rand.NextFloat(0f, 1f)); + if (lifeRatio > 0.5f) - return Color.Lerp(cirrus ? Color.Pink : Color.Red, cirrus ? Color.Violet : Color.Orange, Main.rand.NextFloat(0.8f)); - else if (lifeRatio > 0.3f) - return Color.Lerp(cirrus ? Color.HotPink : Color.DarkRed, Color.Lerp(cirrus ? Color.Cyan : Color.Blue, cirrus ? Color.DarkCyan : Color.DarkBlue, Main.rand.NextFloat() * 0.65f), 0.45f); + return Color.Lerp(cirrus ? Color.Pink : Color.Red, cirrus ? Color.Violet : Color.Crimson, Main.rand.NextFloat(0f, 1f)); + else if (lifeRatio > 0.3f || scal.ModNPC().postMusicHit == false) + return Color.Lerp(cirrus ? Color.Cyan : Color.Red, cirrus ? Color.DarkCyan : Color.Magenta, Main.rand.NextFloat(0f, 0.7f)); else if (lifeRatio > 0.01f) - return Color.Lerp(cirrus ? Color.Pink : Color.Red, cirrus ? Color.Green : Color.Yellow, Main.rand.NextFloat(0.2f, 0.9f)); + return Color.Lerp(cirrus ? Color.Pink : Color.Red, cirrus ? Color.Green : Color.Yellow, Main.rand.NextFloat(0f, 0.88f)); else - return Color.Gray; + return Color.Lerp(Color.Gray, Color.White, Main.rand.NextFloat(0f, 0.65f)); } // Randomly add cinders. @@ -149,11 +169,27 @@ namespace CalamityMod.Skies Vector2 startingVelocity = -Vector2.UnitY.RotatedByRandom(0.91f); Cinders.Add(new Cinder(lifetime, Cinders.Count, depth, selectCinderColor(), startingPosition, startingVelocity)); } + if ((!Main.npc.IndexInRange(CalamityGlobalNPC.SCal) || Main.npc[CalamityGlobalNPC.SCal].type != ModContent.NPCType()) == false) + { + NPC scal = Main.npc[CalamityGlobalNPC.SCal]; + if (scal.ModNPC().musicSyncCounter == 0) + { + for (int i = 0; i < 70; i++) + { + int lifetime = Main.rand.Next(285, 445); + float depth = Main.rand.NextFloat(1.8f, 5f); + Vector2 startingPosition = Main.screenPosition + new Vector2(Main.screenWidth * Main.rand.NextFloat(-0.1f, 1.1f), Main.screenHeight * Main.rand.NextFloat(1.05f, 1.45f)); + Vector2 startingVelocity = -Vector2.UnitY.RotatedByRandom(0.91f) * Main.rand.NextFloat(0.5f, 2.5f); + + Cinders.Add(new Cinder(lifetime, Cinders.Count, depth, selectCinderColor(), startingPosition, startingVelocity)); + } + } + } // Update all cinders. for (int i = 0; i < Cinders.Count; i++) { - Cinders[i].Scale = Utils.GetLerpValue(Cinders[i].Lifetime, Cinders[i].Lifetime / 3, Cinders[i].Time, true); + Cinders[i].Scale = Utils.GetLerpValue(Cinders[i].Lifetime, Cinders[i].Lifetime / 3, Cinders[i].Time, true) * 1.5f; Cinders[i].Scale *= MathHelper.Lerp(0.6f, 0.9f, Cinders[i].IdentityIndex % 6f / 6f); Vector2 idealVelocity = -Vector2.UnitY.RotatedBy(MathHelper.Lerp(-0.94f, 0.94f, (float)Math.Sin(Cinders[i].Time / 36f + Cinders[i].IdentityIndex) * 0.5f + 0.5f)) * CinderSpeed; @@ -182,7 +218,7 @@ namespace CalamityMod.Skies x = Vector2.Distance(Main.player[Main.myPlayer].Center, Main.npc[this.SCalIndex].Center); float intensityFactor = BossRushEvent.BossRushActive ? -0.2f : 1f; - return (1f - Utils.SmoothStep(3000f, 6000f, x)) * intensityFactor; + return (1f - Utils.SmoothStep(4500f, 9000f, x)) * intensityFactor; } return 0f; @@ -217,11 +253,34 @@ namespace CalamityMod.Skies spriteBatch.Draw(TextureAssets.BlackTile.Value, new Rectangle(0, 0, Main.screenWidth * 2, Main.screenHeight * 2), Color.Black * intensity); } - Color cinderColor; if (!Main.npc.IndexInRange(CalamityGlobalNPC.SCal) || Main.npc[CalamityGlobalNPC.SCal].type != ModContent.NPCType()) - cinderColor = Color.Red; + { + cinderColortoBe = Color.Transparent; + cinderColor = Color.Transparent; + return; + } + + NPC scal = Main.npc[CalamityGlobalNPC.SCal]; + bool cirrus = scal.ModNPC().cirrus; + float lifeRatio = scal.life / (float)scal.lifeMax; + + if (lifeRatio > 0.5f) + cinderColortoBe = Color.Lerp(cirrus ? Color.Pink : Color.Red, cirrus ? Color.Violet : Color.Crimson, Main.rand.NextFloat(0f, 1f)); + else if (lifeRatio > 0.3f || scal.ModNPC().postMusicHit == false) + cinderColortoBe = Color.Lerp(cirrus ? Color.Cyan : Color.Red, cirrus ? Color.DarkCyan : Color.Magenta, Main.rand.NextFloat(0f, 0.7f)); + else if (lifeRatio > 0.01f) + cinderColortoBe = Color.Lerp(cirrus ? Color.Pink : Color.Red, cirrus ? Color.Green : Color.Yellow, Main.rand.NextFloat(0f, 0.88f)); else - cinderColor = Main.npc[CalamityGlobalNPC.SCal].ModNPC().cirrus ? Color.Pink : Color.Red; + cinderColortoBe = Color.Lerp(Color.Gray, Color.White, Main.rand.NextFloat(0.8f)); + + if (NPC.AnyNPCs(ModContent.NPCType()) == true && NPC.AnyNPCs(ModContent.NPCType()) == false) + cinderColortoBe = Color.Lerp(Color.MediumTurquoise, Color.Cyan, Main.rand.NextFloat(0.2f, 0.9f)); + if (NPC.AnyNPCs(ModContent.NPCType()) == true && NPC.AnyNPCs(ModContent.NPCType()) == false) + cinderColortoBe = Color.Lerp(Color.Magenta, Color.MediumVioletRed, Main.rand.NextFloat(0.2f, 0.9f)); + if (NPC.AnyNPCs(ModContent.NPCType()) == true && NPC.AnyNPCs(ModContent.NPCType()) == true) + cinderColortoBe = Color.Lerp(Color.Red, Color.IndianRed, Main.rand.NextFloat(0f, 1f)); + + cinderColor = Color.Lerp(cinderColor, cinderColortoBe, 0.0067f); // Draw cinders. Texture2D cinderTexture = ModContent.Request("CalamityMod/Skies/CalamitasCinder").Value; diff --git a/Skies/SulphurSeaSky.cs b/Skies/SulphurSeaSky.cs index 7c5ed3383f..bd8c4f1233 100644 --- a/Skies/SulphurSeaSky.cs +++ b/Skies/SulphurSeaSky.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Skies { if (maxDepth >= 4f && minDepth < 4f) spriteBatch.Draw(CalamityMod.SulphurSeaSky, new Rectangle(0, (int)(-Main.screenPosition.Y / 6f) + 1300, Main.screenWidth, Main.screenHeight), Color.Lerp(Main.ColorOfTheSkies, Color.LightSeaGreen, 0.33f) * 0.2f * opacity); - + // Small worlds, default draw height int sulphurSeaHeight = (World.SulphurousSea.YStart + (int)Main.worldSurface) / 2; diff --git a/Sounds/CommonCalamitySounds.cs b/Sounds/CommonCalamitySounds.cs index d00d8db8a9..817b9a3b8f 100644 --- a/Sounds/CommonCalamitySounds.cs +++ b/Sounds/CommonCalamitySounds.cs @@ -3,7 +3,7 @@ namespace CalamityMod.Sounds { public static class CommonCalamitySounds - { + { public static readonly SoundStyle ExoHitSound = new("CalamityMod/Sounds/NPCHit/ExoHit", 4) { Volume = 0.4f }; public static readonly SoundStyle ExoDeathSound = new("CalamityMod/Sounds/NPCKilled/ExoDeath") { MaxInstances = 1 }; diff --git a/Sounds/Custom/ArianeShot.ogg b/Sounds/Custom/ArianeShot.ogg new file mode 100644 index 0000000000..494d289eb7 Binary files /dev/null and b/Sounds/Custom/ArianeShot.ogg differ diff --git a/Sounds/Custom/AstrumAureus/AureusShoot.ogg b/Sounds/Custom/AstrumAureus/AureusShoot.ogg new file mode 100644 index 0000000000..aacaaa6b9c Binary files /dev/null and b/Sounds/Custom/AstrumAureus/AureusShoot.ogg differ diff --git a/Sounds/Custom/AstrumAureus/AureusShootCrystal.ogg b/Sounds/Custom/AstrumAureus/AureusShootCrystal.ogg new file mode 100644 index 0000000000..ad8f3f496c Binary files /dev/null and b/Sounds/Custom/AstrumAureus/AureusShootCrystal.ogg differ diff --git a/Sounds/Custom/AstrumAureus/AureusTeleport.ogg b/Sounds/Custom/AstrumAureus/AureusTeleport.ogg new file mode 100644 index 0000000000..dc79fc3142 Binary files /dev/null and b/Sounds/Custom/AstrumAureus/AureusTeleport.ogg differ diff --git a/Sounds/Custom/AstrumAureus/LegStomp.ogg b/Sounds/Custom/AstrumAureus/LegStomp.ogg index 63bbe5c2b6..0bf8fdd94a 100644 Binary files a/Sounds/Custom/AstrumAureus/LegStomp.ogg and b/Sounds/Custom/AstrumAureus/LegStomp.ogg differ diff --git a/Sounds/Custom/AstrumDeus/AstrumDeusGodRay.ogg b/Sounds/Custom/AstrumDeus/AstrumDeusGodRay.ogg new file mode 100644 index 0000000000..4da256b2a0 Binary files /dev/null and b/Sounds/Custom/AstrumDeus/AstrumDeusGodRay.ogg differ diff --git a/Sounds/Custom/AstrumDeusLaser.ogg b/Sounds/Custom/AstrumDeus/AstrumDeusLaser.ogg similarity index 100% rename from Sounds/Custom/AstrumDeusLaser.ogg rename to Sounds/Custom/AstrumDeus/AstrumDeusLaser.ogg diff --git a/Sounds/Custom/AstrumDeusMine.ogg b/Sounds/Custom/AstrumDeus/AstrumDeusMine.ogg similarity index 100% rename from Sounds/Custom/AstrumDeusMine.ogg rename to Sounds/Custom/AstrumDeus/AstrumDeusMine.ogg diff --git a/Sounds/Custom/AstrumDeusSpawn.ogg b/Sounds/Custom/AstrumDeus/AstrumDeusSpawn.ogg similarity index 100% rename from Sounds/Custom/AstrumDeusSpawn.ogg rename to Sounds/Custom/AstrumDeus/AstrumDeusSpawn.ogg diff --git a/Sounds/Custom/AstrumDeusSplit.ogg b/Sounds/Custom/AstrumDeus/AstrumDeusSplit.ogg similarity index 100% rename from Sounds/Custom/AstrumDeusSplit.ogg rename to Sounds/Custom/AstrumDeus/AstrumDeusSplit.ogg diff --git a/Sounds/Custom/AstrumDeus/DeusMineExplode.ogg b/Sounds/Custom/AstrumDeus/DeusMineExplode.ogg new file mode 100644 index 0000000000..e3ca1438c6 Binary files /dev/null and b/Sounds/Custom/AstrumDeus/DeusMineExplode.ogg differ diff --git a/Sounds/Custom/BEES/Names.txt b/Sounds/Custom/BEES/Names.txt new file mode 100644 index 0000000000..440c8bb183 --- /dev/null +++ b/Sounds/Custom/BEES/Names.txt @@ -0,0 +1,12 @@ +Names: +1 - Aqua +2 - CIT +3 - Lilac +4 - Metarex +5 - moonburn +6 - Ozzatron +7 - Rebecca +8 - Shayy +9 - StipulatedVenus +10 - Xyk +11 - Shade \ No newline at end of file diff --git a/Sounds/Custom/BEES/bees1.ogg b/Sounds/Custom/BEES/bees1.ogg new file mode 100644 index 0000000000..274f40e28e Binary files /dev/null and b/Sounds/Custom/BEES/bees1.ogg differ diff --git a/Sounds/Custom/BEES/bees10.ogg b/Sounds/Custom/BEES/bees10.ogg new file mode 100644 index 0000000000..0889776deb Binary files /dev/null and b/Sounds/Custom/BEES/bees10.ogg differ diff --git a/Sounds/Custom/BEES/bees11.ogg b/Sounds/Custom/BEES/bees11.ogg new file mode 100644 index 0000000000..e81ebe6c9b Binary files /dev/null and b/Sounds/Custom/BEES/bees11.ogg differ diff --git a/Sounds/Custom/BEES/bees2.ogg b/Sounds/Custom/BEES/bees2.ogg new file mode 100644 index 0000000000..ce687af023 Binary files /dev/null and b/Sounds/Custom/BEES/bees2.ogg differ diff --git a/Sounds/Custom/BEES/bees3.ogg b/Sounds/Custom/BEES/bees3.ogg new file mode 100644 index 0000000000..ab9ebec9bc Binary files /dev/null and b/Sounds/Custom/BEES/bees3.ogg differ diff --git a/Sounds/Custom/BEES/bees4.ogg b/Sounds/Custom/BEES/bees4.ogg new file mode 100644 index 0000000000..739b488905 Binary files /dev/null and b/Sounds/Custom/BEES/bees4.ogg differ diff --git a/Sounds/Custom/BEES/bees5.ogg b/Sounds/Custom/BEES/bees5.ogg new file mode 100644 index 0000000000..89c30e1b0e Binary files /dev/null and b/Sounds/Custom/BEES/bees5.ogg differ diff --git a/Sounds/Custom/BEES/bees6.ogg b/Sounds/Custom/BEES/bees6.ogg new file mode 100644 index 0000000000..4927be0c9d Binary files /dev/null and b/Sounds/Custom/BEES/bees6.ogg differ diff --git a/Sounds/Custom/BEES/bees7.ogg b/Sounds/Custom/BEES/bees7.ogg new file mode 100644 index 0000000000..54d3edf5a2 Binary files /dev/null and b/Sounds/Custom/BEES/bees7.ogg differ diff --git a/Sounds/Custom/BEES/bees8.ogg b/Sounds/Custom/BEES/bees8.ogg new file mode 100644 index 0000000000..677b47fc65 Binary files /dev/null and b/Sounds/Custom/BEES/bees8.ogg differ diff --git a/Sounds/Custom/BEES/bees9.ogg b/Sounds/Custom/BEES/bees9.ogg new file mode 100644 index 0000000000..094a103a5b Binary files /dev/null and b/Sounds/Custom/BEES/bees9.ogg differ diff --git a/Sounds/Custom/BoomBoomKawaii.ogg b/Sounds/Custom/BoomBoomKawaii.ogg new file mode 100644 index 0000000000..da9529eb90 Binary files /dev/null and b/Sounds/Custom/BoomBoomKawaii.ogg differ diff --git a/Sounds/Custom/CeramicImpact1.ogg b/Sounds/Custom/CeramicImpact1.ogg new file mode 100644 index 0000000000..ae987d8567 Binary files /dev/null and b/Sounds/Custom/CeramicImpact1.ogg differ diff --git a/Sounds/Custom/CeramicImpact2.ogg b/Sounds/Custom/CeramicImpact2.ogg new file mode 100644 index 0000000000..6b18fdf64c Binary files /dev/null and b/Sounds/Custom/CeramicImpact2.ogg differ diff --git a/Sounds/Custom/Codebreaker/ArtemisApolloIconHover.ogg b/Sounds/Custom/Codebreaker/ArtemisApolloIconHover.ogg index 8af3763f64..b334f9e6c8 100644 Binary files a/Sounds/Custom/Codebreaker/ArtemisApolloIconHover.ogg and b/Sounds/Custom/Codebreaker/ArtemisApolloIconHover.ogg differ diff --git a/Sounds/Custom/CuteSqueak.ogg b/Sounds/Custom/CuteSqueak.ogg new file mode 100644 index 0000000000..9c28804f2c Binary files /dev/null and b/Sounds/Custom/CuteSqueak.ogg differ diff --git a/Sounds/Custom/ElsterShot1.ogg b/Sounds/Custom/ElsterShot1.ogg new file mode 100644 index 0000000000..941a38a1f8 Binary files /dev/null and b/Sounds/Custom/ElsterShot1.ogg differ diff --git a/Sounds/Custom/ElsterShot2.ogg b/Sounds/Custom/ElsterShot2.ogg new file mode 100644 index 0000000000..a76e5efd3e Binary files /dev/null and b/Sounds/Custom/ElsterShot2.ogg differ diff --git a/Sounds/Custom/ElsterShot3.ogg b/Sounds/Custom/ElsterShot3.ogg new file mode 100644 index 0000000000..c565d66f0c Binary files /dev/null and b/Sounds/Custom/ElsterShot3.ogg differ diff --git a/Sounds/Custom/ElsterShot4.ogg b/Sounds/Custom/ElsterShot4.ogg new file mode 100644 index 0000000000..d56a080ab8 Binary files /dev/null and b/Sounds/Custom/ElsterShot4.ogg differ diff --git a/Sounds/Custom/GungeonCreditMusic.mp3 b/Sounds/Custom/GungeonCreditMusic.mp3 new file mode 100644 index 0000000000..801bdb972e Binary files /dev/null and b/Sounds/Custom/GungeonCreditMusic.mp3 differ diff --git a/Sounds/Custom/Kickball.ogg b/Sounds/Custom/Kickball.ogg new file mode 100644 index 0000000000..f67be1f20b Binary files /dev/null and b/Sounds/Custom/Kickball.ogg differ diff --git a/Sounds/Custom/LiliesOfFinalityTileHitSound.ogg b/Sounds/Custom/LiliesOfFinalityTileHitSound.ogg new file mode 100644 index 0000000000..f3046fe665 Binary files /dev/null and b/Sounds/Custom/LiliesOfFinalityTileHitSound.ogg differ diff --git a/Sounds/Custom/Perforator/PerfHiveIchorShoot.ogg b/Sounds/Custom/Perforator/PerfHiveIchorShoot.ogg new file mode 100644 index 0000000000..efb76a2687 Binary files /dev/null and b/Sounds/Custom/Perforator/PerfHiveIchorShoot.ogg differ diff --git a/Sounds/Custom/Perforator/PerfHiveShoot1.ogg b/Sounds/Custom/Perforator/PerfHiveShoot1.ogg new file mode 100644 index 0000000000..ffbaa95bd6 Binary files /dev/null and b/Sounds/Custom/Perforator/PerfHiveShoot1.ogg differ diff --git a/Sounds/Custom/Perforator/PerfHiveShoot2.ogg b/Sounds/Custom/Perforator/PerfHiveShoot2.ogg new file mode 100644 index 0000000000..797f0e570c Binary files /dev/null and b/Sounds/Custom/Perforator/PerfHiveShoot2.ogg differ diff --git a/Sounds/Custom/Perforator/PerfHiveShoot3.ogg b/Sounds/Custom/Perforator/PerfHiveShoot3.ogg new file mode 100644 index 0000000000..cbfc4ae293 Binary files /dev/null and b/Sounds/Custom/Perforator/PerfHiveShoot3.ogg differ diff --git a/Sounds/Custom/Perforator/PerfHiveSpawn.ogg b/Sounds/Custom/Perforator/PerfHiveSpawn.ogg new file mode 100644 index 0000000000..78b14c622e Binary files /dev/null and b/Sounds/Custom/Perforator/PerfHiveSpawn.ogg differ diff --git a/Sounds/Custom/Perforator/PerfHiveWormSpawn.ogg b/Sounds/Custom/Perforator/PerfHiveWormSpawn.ogg new file mode 100644 index 0000000000..34a43b757c Binary files /dev/null and b/Sounds/Custom/Perforator/PerfHiveWormSpawn.ogg differ diff --git a/Sounds/Custom/PlagueSounds/PBGAttackSwitchShort.ogg b/Sounds/Custom/PlagueSounds/PBGAttackSwitchShort.ogg new file mode 100644 index 0000000000..1e957a38c3 Binary files /dev/null and b/Sounds/Custom/PlagueSounds/PBGAttackSwitchShort.ogg differ diff --git a/Sounds/Custom/PumpkinEmerge1.ogg b/Sounds/Custom/PumpkinEmerge1.ogg new file mode 100644 index 0000000000..a349cfb5f2 Binary files /dev/null and b/Sounds/Custom/PumpkinEmerge1.ogg differ diff --git a/Sounds/Custom/PumpkinEmerge2.ogg b/Sounds/Custom/PumpkinEmerge2.ogg new file mode 100644 index 0000000000..bad9d97937 Binary files /dev/null and b/Sounds/Custom/PumpkinEmerge2.ogg differ diff --git a/Sounds/Custom/PumpkinEmerge3.ogg b/Sounds/Custom/PumpkinEmerge3.ogg new file mode 100644 index 0000000000..ea450c4ebd Binary files /dev/null and b/Sounds/Custom/PumpkinEmerge3.ogg differ diff --git a/Sounds/Custom/PumpkinExplode1.ogg b/Sounds/Custom/PumpkinExplode1.ogg new file mode 100644 index 0000000000..60d7192cec Binary files /dev/null and b/Sounds/Custom/PumpkinExplode1.ogg differ diff --git a/Sounds/Custom/PumpkinExplode2.ogg b/Sounds/Custom/PumpkinExplode2.ogg new file mode 100644 index 0000000000..1c5cb054c9 Binary files /dev/null and b/Sounds/Custom/PumpkinExplode2.ogg differ diff --git a/Sounds/Custom/PumpkinExplodeGFB1.ogg b/Sounds/Custom/PumpkinExplodeGFB1.ogg new file mode 100644 index 0000000000..4ac22589d0 Binary files /dev/null and b/Sounds/Custom/PumpkinExplodeGFB1.ogg differ diff --git a/Sounds/Custom/PumpkinExplodeGFB2.ogg b/Sounds/Custom/PumpkinExplodeGFB2.ogg new file mode 100644 index 0000000000..9e1b31d931 Binary files /dev/null and b/Sounds/Custom/PumpkinExplodeGFB2.ogg differ diff --git a/Sounds/Custom/PumpkinIdle1.ogg b/Sounds/Custom/PumpkinIdle1.ogg new file mode 100644 index 0000000000..47c218f282 Binary files /dev/null and b/Sounds/Custom/PumpkinIdle1.ogg differ diff --git a/Sounds/Custom/PumpkinIdle2.ogg b/Sounds/Custom/PumpkinIdle2.ogg new file mode 100644 index 0000000000..c146037b63 Binary files /dev/null and b/Sounds/Custom/PumpkinIdle2.ogg differ diff --git a/Sounds/Custom/PumpkinIdle3.ogg b/Sounds/Custom/PumpkinIdle3.ogg new file mode 100644 index 0000000000..dca64a2d4d Binary files /dev/null and b/Sounds/Custom/PumpkinIdle3.ogg differ diff --git a/Sounds/Custom/PumpkinIdle4.ogg b/Sounds/Custom/PumpkinIdle4.ogg new file mode 100644 index 0000000000..d399027c10 Binary files /dev/null and b/Sounds/Custom/PumpkinIdle4.ogg differ diff --git a/Sounds/Custom/PumpkinJump.ogg b/Sounds/Custom/PumpkinJump.ogg new file mode 100644 index 0000000000..e85c2cfe02 Binary files /dev/null and b/Sounds/Custom/PumpkinJump.ogg differ diff --git a/Sounds/Custom/PumpkinRareIdle.ogg b/Sounds/Custom/PumpkinRareIdle.ogg new file mode 100644 index 0000000000..e3a5085e00 Binary files /dev/null and b/Sounds/Custom/PumpkinRareIdle.ogg differ diff --git a/Sounds/Custom/PumpkinScream1.ogg b/Sounds/Custom/PumpkinScream1.ogg new file mode 100644 index 0000000000..24de61da1b Binary files /dev/null and b/Sounds/Custom/PumpkinScream1.ogg differ diff --git a/Sounds/Custom/PumpkinScream2.ogg b/Sounds/Custom/PumpkinScream2.ogg new file mode 100644 index 0000000000..f113813a23 Binary files /dev/null and b/Sounds/Custom/PumpkinScream2.ogg differ diff --git a/Sounds/Custom/SCalSounds/BrimstoneMonsterDrone.ogg b/Sounds/Custom/SCalSounds/BrimstoneMonsterDrone.ogg index 4dc6b63415..26afb38c27 100644 Binary files a/Sounds/Custom/SCalSounds/BrimstoneMonsterDrone.ogg and b/Sounds/Custom/SCalSounds/BrimstoneMonsterDrone.ogg differ diff --git a/Sounds/Custom/SCalSounds/BrothersDeath1.ogg b/Sounds/Custom/SCalSounds/BrothersDeath1.ogg new file mode 100644 index 0000000000..87ee3d42b3 Binary files /dev/null and b/Sounds/Custom/SCalSounds/BrothersDeath1.ogg differ diff --git a/Sounds/Custom/SCalSounds/BrothersDeath2.ogg b/Sounds/Custom/SCalSounds/BrothersDeath2.ogg new file mode 100644 index 0000000000..75215c094c Binary files /dev/null and b/Sounds/Custom/SCalSounds/BrothersDeath2.ogg differ diff --git a/Sounds/Custom/SCalSounds/BrothersHurt1.ogg b/Sounds/Custom/SCalSounds/BrothersHurt1.ogg new file mode 100644 index 0000000000..8aa9efd153 Binary files /dev/null and b/Sounds/Custom/SCalSounds/BrothersHurt1.ogg differ diff --git a/Sounds/Custom/SCalSounds/BrothersHurt2.ogg b/Sounds/Custom/SCalSounds/BrothersHurt2.ogg new file mode 100644 index 0000000000..81784fe35e Binary files /dev/null and b/Sounds/Custom/SCalSounds/BrothersHurt2.ogg differ diff --git a/Sounds/Custom/SCalSounds/CatastropheResonanceSlash1.ogg b/Sounds/Custom/SCalSounds/CatastropheResonanceSlash1.ogg new file mode 100644 index 0000000000..db749a15bf Binary files /dev/null and b/Sounds/Custom/SCalSounds/CatastropheResonanceSlash1.ogg differ diff --git a/Sounds/Custom/SCalSounds/GFBDrone.ogg b/Sounds/Custom/SCalSounds/GFBDrone.ogg new file mode 100644 index 0000000000..bfabb1a582 Binary files /dev/null and b/Sounds/Custom/SCalSounds/GFBDrone.ogg differ diff --git a/Sounds/Custom/SCalSounds/SCalEndBH.ogg b/Sounds/Custom/SCalSounds/SCalEndBH.ogg new file mode 100644 index 0000000000..6c5860b3cb Binary files /dev/null and b/Sounds/Custom/SCalSounds/SCalEndBH.ogg differ diff --git a/Sounds/Custom/SCalSounds/SCalRumble.ogg b/Sounds/Custom/SCalSounds/SCalRumble.ogg new file mode 100644 index 0000000000..0ed9a09f26 Binary files /dev/null and b/Sounds/Custom/SCalSounds/SCalRumble.ogg differ diff --git a/Sounds/Custom/SCalSounds/SupremeCalamitasGiveUp.ogg b/Sounds/Custom/SCalSounds/SupremeCalamitasGiveUp.ogg new file mode 100644 index 0000000000..03dcd515f7 Binary files /dev/null and b/Sounds/Custom/SCalSounds/SupremeCalamitasGiveUp.ogg differ diff --git a/Sounds/Custom/StormlionIdle.ogg b/Sounds/Custom/StormlionIdle.ogg new file mode 100644 index 0000000000..b8fc5bfb3f Binary files /dev/null and b/Sounds/Custom/StormlionIdle.ogg differ diff --git a/Sounds/Custom/WeaverArmorShed.ogg b/Sounds/Custom/WeaverArmorShed.ogg new file mode 100644 index 0000000000..da875bed53 Binary files /dev/null and b/Sounds/Custom/WeaverArmorShed.ogg differ diff --git a/Sounds/Item/DragonsBreathStrongStart.ogg b/Sounds/Item/DragonsBreathStrongStart.ogg new file mode 100644 index 0000000000..3757c711f8 Binary files /dev/null and b/Sounds/Item/DragonsBreathStrongStart.ogg differ diff --git a/Sounds/Item/ElectricHit.ogg b/Sounds/Item/ElectricHit.ogg new file mode 100644 index 0000000000..ea0d2659b6 Binary files /dev/null and b/Sounds/Item/ElectricHit.ogg differ diff --git a/Sounds/Item/EnergyRifleFire.ogg b/Sounds/Item/EnergyRifleFire.ogg new file mode 100644 index 0000000000..855a605b46 Binary files /dev/null and b/Sounds/Item/EnergyRifleFire.ogg differ diff --git a/Sounds/Item/FlakKrakenShoot.ogg b/Sounds/Item/FlakKrakenShoot.ogg new file mode 100644 index 0000000000..2b3ab03de5 Binary files /dev/null and b/Sounds/Item/FlakKrakenShoot.ogg differ diff --git a/Sounds/Item/FrigidflashDeath.ogg b/Sounds/Item/FrigidflashDeath.ogg new file mode 100644 index 0000000000..1dbba9857b Binary files /dev/null and b/Sounds/Item/FrigidflashDeath.ogg differ diff --git a/Sounds/Item/FrigidflashUse.ogg b/Sounds/Item/FrigidflashUse.ogg new file mode 100644 index 0000000000..d15ee50ad9 Binary files /dev/null and b/Sounds/Item/FrigidflashUse.ogg differ diff --git a/Sounds/Item/HolyFireBulletExplosion.ogg b/Sounds/Item/HolyFireBulletExplosion.ogg new file mode 100644 index 0000000000..b153edeeaa Binary files /dev/null and b/Sounds/Item/HolyFireBulletExplosion.ogg differ diff --git a/Sounds/Item/LiliesOfFinalitySummonSpawn.ogg b/Sounds/Item/LiliesOfFinalitySummonSpawn.ogg new file mode 100644 index 0000000000..c04a4979ea Binary files /dev/null and b/Sounds/Item/LiliesOfFinalitySummonSpawn.ogg differ diff --git a/Sounds/Item/LowHum.ogg b/Sounds/Item/LowHum.ogg new file mode 100644 index 0000000000..4dc6b63415 Binary files /dev/null and b/Sounds/Item/LowHum.ogg differ diff --git a/Sounds/Item/NitroExpressRifleFire.ogg b/Sounds/Item/NitroExpressRifleFire.ogg new file mode 100644 index 0000000000..da54598b25 Binary files /dev/null and b/Sounds/Item/NitroExpressRifleFire.ogg differ diff --git a/Sounds/Item/NorfleetFire.ogg b/Sounds/Item/NorfleetFire.ogg new file mode 100644 index 0000000000..3fbc3a1589 Binary files /dev/null and b/Sounds/Item/NorfleetFire.ogg differ diff --git a/Sounds/Item/NorfleetRecharge.ogg b/Sounds/Item/NorfleetRecharge.ogg new file mode 100644 index 0000000000..3910343d59 Binary files /dev/null and b/Sounds/Item/NorfleetRecharge.ogg differ diff --git a/Sounds/Item/NuhUhUh.ogg b/Sounds/Item/NuhUhUh.ogg new file mode 100644 index 0000000000..2d9dcf16c5 Binary files /dev/null and b/Sounds/Item/NuhUhUh.ogg differ diff --git a/Sounds/Item/OmicronBeam.ogg b/Sounds/Item/OmicronBeam.ogg new file mode 100644 index 0000000000..605f551f00 Binary files /dev/null and b/Sounds/Item/OmicronBeam.ogg differ diff --git a/Sounds/Item/PolarisShot.ogg b/Sounds/Item/PolarisShot.ogg new file mode 100644 index 0000000000..dcee6b57e2 Binary files /dev/null and b/Sounds/Item/PolarisShot.ogg differ diff --git a/Sounds/Item/PulseRifleFire.ogg b/Sounds/Item/PulseRifleFire.ogg index 855a605b46..3e5ef5cd27 100644 Binary files a/Sounds/Item/PulseRifleFire.ogg and b/Sounds/Item/PulseRifleFire.ogg differ diff --git a/Sounds/Item/PulseSound.ogg b/Sounds/Item/PulseSound.ogg new file mode 100644 index 0000000000..4941b20973 Binary files /dev/null and b/Sounds/Item/PulseSound.ogg differ diff --git a/Sounds/Item/ScorpioHit.ogg b/Sounds/Item/ScorpioHit.ogg new file mode 100644 index 0000000000..2117d112b5 Binary files /dev/null and b/Sounds/Item/ScorpioHit.ogg differ diff --git a/Sounds/Item/ScorpioNukeHit.ogg b/Sounds/Item/ScorpioNukeHit.ogg new file mode 100644 index 0000000000..db0fbe3714 Binary files /dev/null and b/Sounds/Item/ScorpioNukeHit.ogg differ diff --git a/Sounds/Item/ScorpioShot.ogg b/Sounds/Item/ScorpioShot.ogg new file mode 100644 index 0000000000..5113e315d3 Binary files /dev/null and b/Sounds/Item/ScorpioShot.ogg differ diff --git a/Sounds/Item/SpinningWoosh.ogg b/Sounds/Item/SpinningWoosh.ogg new file mode 100644 index 0000000000..95da93e645 Binary files /dev/null and b/Sounds/Item/SpinningWoosh.ogg differ diff --git a/Sounds/Item/StygianBonk1.ogg b/Sounds/Item/StygianBonk1.ogg new file mode 100644 index 0000000000..5b0653b69c Binary files /dev/null and b/Sounds/Item/StygianBonk1.ogg differ diff --git a/Sounds/Item/StygianBonk2.ogg b/Sounds/Item/StygianBonk2.ogg new file mode 100644 index 0000000000..a165ef9428 Binary files /dev/null and b/Sounds/Item/StygianBonk2.ogg differ diff --git a/Sounds/Item/StygianBonk3.ogg b/Sounds/Item/StygianBonk3.ogg new file mode 100644 index 0000000000..0cf933d81e Binary files /dev/null and b/Sounds/Item/StygianBonk3.ogg differ diff --git a/Sounds/Item/StygianCatch.ogg b/Sounds/Item/StygianCatch.ogg new file mode 100644 index 0000000000..1bde0d3709 Binary files /dev/null and b/Sounds/Item/StygianCatch.ogg differ diff --git a/Sounds/Item/StygianDash.ogg b/Sounds/Item/StygianDash.ogg new file mode 100644 index 0000000000..6ec191dcc2 Binary files /dev/null and b/Sounds/Item/StygianDash.ogg differ diff --git a/Sounds/Item/StygianDashCharge.ogg b/Sounds/Item/StygianDashCharge.ogg new file mode 100644 index 0000000000..44e0a00196 Binary files /dev/null and b/Sounds/Item/StygianDashCharge.ogg differ diff --git a/Sounds/Item/StygianThrow.ogg b/Sounds/Item/StygianThrow.ogg new file mode 100644 index 0000000000..b7973fb09a Binary files /dev/null and b/Sounds/Item/StygianThrow.ogg differ diff --git a/Sounds/Item/StygianThrowLoop.ogg b/Sounds/Item/StygianThrowLoop.ogg new file mode 100644 index 0000000000..279ecb75dd Binary files /dev/null and b/Sounds/Item/StygianThrowLoop.ogg differ diff --git a/Sounds/Item/SupernovaBoom.ogg b/Sounds/Item/SupernovaBoom.ogg index 61bff4ea3c..02105d4292 100644 Binary files a/Sounds/Item/SupernovaBoom.ogg and b/Sounds/Item/SupernovaBoom.ogg differ diff --git a/Sounds/Item/SupernovaStealthCharge.ogg b/Sounds/Item/SupernovaStealthCharge.ogg new file mode 100644 index 0000000000..360c0c26d6 Binary files /dev/null and b/Sounds/Item/SupernovaStealthCharge.ogg differ diff --git a/Sounds/Item/SupernovaStealthExplode.ogg b/Sounds/Item/SupernovaStealthExplode.ogg new file mode 100644 index 0000000000..30346dfd3c Binary files /dev/null and b/Sounds/Item/SupernovaStealthExplode.ogg differ diff --git a/Sounds/Item/TearsOfHeavenUse.ogg b/Sounds/Item/TearsOfHeavenUse.ogg new file mode 100644 index 0000000000..0bb3ab97d5 Binary files /dev/null and b/Sounds/Item/TearsOfHeavenUse.ogg differ diff --git a/Sounds/Item/TheHiveNuke.ogg b/Sounds/Item/TheHiveNuke.ogg new file mode 100644 index 0000000000..ffd8ffea1e Binary files /dev/null and b/Sounds/Item/TheHiveNuke.ogg differ diff --git a/Sounds/Music/DraedonExoSelect.ogg b/Sounds/Music/DraedonExoSelect.ogg new file mode 100644 index 0000000000..faa244ff6a Binary files /dev/null and b/Sounds/Music/DraedonExoSelect.ogg differ diff --git a/Sounds/Music/DraedonTalk.ogg b/Sounds/Music/DraedonTalk.ogg new file mode 100644 index 0000000000..9316b575c5 Binary files /dev/null and b/Sounds/Music/DraedonTalk.ogg differ diff --git a/Sounds/Music/DraedonsAmbience.ogg b/Sounds/Music/DraedonsAmbience.ogg deleted file mode 100644 index 6985a18ac9..0000000000 Binary files a/Sounds/Music/DraedonsAmbience.ogg and /dev/null differ diff --git a/Sounds/NPCHit/AnahitaHit1.ogg b/Sounds/NPCHit/AnahitaHit1.ogg new file mode 100644 index 0000000000..de200680f4 Binary files /dev/null and b/Sounds/NPCHit/AnahitaHit1.ogg differ diff --git a/Sounds/NPCHit/AnahitaHit2.ogg b/Sounds/NPCHit/AnahitaHit2.ogg new file mode 100644 index 0000000000..b9609d2848 Binary files /dev/null and b/Sounds/NPCHit/AnahitaHit2.ogg differ diff --git a/Sounds/NPCHit/AnahitaHit3.ogg b/Sounds/NPCHit/AnahitaHit3.ogg new file mode 100644 index 0000000000..b4220eff8f Binary files /dev/null and b/Sounds/NPCHit/AnahitaHit3.ogg differ diff --git a/Sounds/NPCHit/AstrumDeusHit1.ogg b/Sounds/NPCHit/AstrumDeusHit1.ogg new file mode 100644 index 0000000000..9b2950839e Binary files /dev/null and b/Sounds/NPCHit/AstrumDeusHit1.ogg differ diff --git a/Sounds/NPCHit/AstrumDeusHit2.ogg b/Sounds/NPCHit/AstrumDeusHit2.ogg new file mode 100644 index 0000000000..dbd1d9b4de Binary files /dev/null and b/Sounds/NPCHit/AstrumDeusHit2.ogg differ diff --git a/Sounds/NPCHit/PerfHiveHit1.ogg b/Sounds/NPCHit/PerfHiveHit1.ogg new file mode 100644 index 0000000000..a03d401c53 Binary files /dev/null and b/Sounds/NPCHit/PerfHiveHit1.ogg differ diff --git a/Sounds/NPCHit/PerfHiveHit2.ogg b/Sounds/NPCHit/PerfHiveHit2.ogg new file mode 100644 index 0000000000..24e9aa5185 Binary files /dev/null and b/Sounds/NPCHit/PerfHiveHit2.ogg differ diff --git a/Sounds/NPCHit/PerfHiveHit3.ogg b/Sounds/NPCHit/PerfHiveHit3.ogg new file mode 100644 index 0000000000..d3d466af3e Binary files /dev/null and b/Sounds/NPCHit/PerfHiveHit3.ogg differ diff --git a/Sounds/NPCHit/PerfLargeHit1.ogg b/Sounds/NPCHit/PerfLargeHit1.ogg new file mode 100644 index 0000000000..12104e8763 Binary files /dev/null and b/Sounds/NPCHit/PerfLargeHit1.ogg differ diff --git a/Sounds/NPCHit/PerfLargeHit2.ogg b/Sounds/NPCHit/PerfLargeHit2.ogg new file mode 100644 index 0000000000..5af5472b9e Binary files /dev/null and b/Sounds/NPCHit/PerfLargeHit2.ogg differ diff --git a/Sounds/NPCHit/PerfLargeHit3.ogg b/Sounds/NPCHit/PerfLargeHit3.ogg new file mode 100644 index 0000000000..d68dc0de7f Binary files /dev/null and b/Sounds/NPCHit/PerfLargeHit3.ogg differ diff --git a/Sounds/NPCHit/PerfMediumHit1.ogg b/Sounds/NPCHit/PerfMediumHit1.ogg new file mode 100644 index 0000000000..3baabc5961 Binary files /dev/null and b/Sounds/NPCHit/PerfMediumHit1.ogg differ diff --git a/Sounds/NPCHit/PerfMediumHit2.ogg b/Sounds/NPCHit/PerfMediumHit2.ogg new file mode 100644 index 0000000000..ed7ffdeb0c Binary files /dev/null and b/Sounds/NPCHit/PerfMediumHit2.ogg differ diff --git a/Sounds/NPCHit/PerfMediumHit3.ogg b/Sounds/NPCHit/PerfMediumHit3.ogg new file mode 100644 index 0000000000..d5170b8c29 Binary files /dev/null and b/Sounds/NPCHit/PerfMediumHit3.ogg differ diff --git a/Sounds/NPCHit/PerfSmallHit1.ogg b/Sounds/NPCHit/PerfSmallHit1.ogg new file mode 100644 index 0000000000..a0a641154e Binary files /dev/null and b/Sounds/NPCHit/PerfSmallHit1.ogg differ diff --git a/Sounds/NPCHit/PerfSmallHit2.ogg b/Sounds/NPCHit/PerfSmallHit2.ogg new file mode 100644 index 0000000000..36384fd68a Binary files /dev/null and b/Sounds/NPCHit/PerfSmallHit2.ogg differ diff --git a/Sounds/NPCHit/PerfSmallHit3.ogg b/Sounds/NPCHit/PerfSmallHit3.ogg new file mode 100644 index 0000000000..39b76b39cf Binary files /dev/null and b/Sounds/NPCHit/PerfSmallHit3.ogg differ diff --git a/Sounds/NPCHit/StormlionHit.ogg b/Sounds/NPCHit/StormlionHit.ogg new file mode 100644 index 0000000000..c9afa9d613 Binary files /dev/null and b/Sounds/NPCHit/StormlionHit.ogg differ diff --git a/Sounds/NPCKilled/AnahitaDeath.ogg b/Sounds/NPCKilled/AnahitaDeath.ogg new file mode 100644 index 0000000000..021e6b2f93 Binary files /dev/null and b/Sounds/NPCKilled/AnahitaDeath.ogg differ diff --git a/Sounds/NPCKilled/AureusDeath.ogg b/Sounds/NPCKilled/AureusDeath.ogg new file mode 100644 index 0000000000..7ccc868ba7 Binary files /dev/null and b/Sounds/NPCKilled/AureusDeath.ogg differ diff --git a/Sounds/NPCKilled/PerfHiveDeath.ogg b/Sounds/NPCKilled/PerfHiveDeath.ogg new file mode 100644 index 0000000000..189f5bad07 Binary files /dev/null and b/Sounds/NPCKilled/PerfHiveDeath.ogg differ diff --git a/Sounds/NPCKilled/PerfLargeDeath.ogg b/Sounds/NPCKilled/PerfLargeDeath.ogg new file mode 100644 index 0000000000..fc1f013570 Binary files /dev/null and b/Sounds/NPCKilled/PerfLargeDeath.ogg differ diff --git a/Sounds/NPCKilled/PerfMediumDeath.ogg b/Sounds/NPCKilled/PerfMediumDeath.ogg new file mode 100644 index 0000000000..f7073bb8a8 Binary files /dev/null and b/Sounds/NPCKilled/PerfMediumDeath.ogg differ diff --git a/Sounds/NPCKilled/PerfSmallDeath.ogg b/Sounds/NPCKilled/PerfSmallDeath.ogg new file mode 100644 index 0000000000..24b101a330 Binary files /dev/null and b/Sounds/NPCKilled/PerfSmallDeath.ogg differ diff --git a/Sounds/NPCKilled/StormlionDeath.ogg b/Sounds/NPCKilled/StormlionDeath.ogg new file mode 100644 index 0000000000..b0fba67652 Binary files /dev/null and b/Sounds/NPCKilled/StormlionDeath.ogg differ diff --git a/Sounds/NPCKilled/WeaverDeath.ogg b/Sounds/NPCKilled/WeaverDeath.ogg new file mode 100644 index 0000000000..5884f22aed Binary files /dev/null and b/Sounds/NPCKilled/WeaverDeath.ogg differ diff --git a/Systems/BestiaryRegistrySystem.cs b/Systems/BestiaryRegistrySystem.cs index cdd705172e..f14f47f6dc 100644 --- a/Systems/BestiaryRegistrySystem.cs +++ b/Systems/BestiaryRegistrySystem.cs @@ -1,5 +1,6 @@ using CalamityMod.NPCs.Abyss; using CalamityMod.NPCs.Astral; +using CalamityMod.NPCs.NormalNPCs; using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; @@ -13,6 +14,7 @@ namespace CalamityMod.Systems // Manually register variants post-initiailization ContentSamples.NpcBestiaryCreditIdsByNpcNetIds[NPCType()] = ContentSamples.NpcBestiaryCreditIdsByNpcNetIds[NPCType()]; ContentSamples.NpcBestiaryCreditIdsByNpcNetIds[NPCType()] = ContentSamples.NpcBestiaryCreditIdsByNpcNetIds[NPCType()]; + ContentSamples.NpcBestiaryCreditIdsByNpcNetIds[NPCType()] = ContentSamples.NpcBestiaryCreditIdsByNpcNetIds[NPCID.LavaSlime]; } } } diff --git a/Systems/BiomeTileCounterSystem.cs b/Systems/BiomeTileCounterSystem.cs index 887c86e5d2..252b0236de 100644 --- a/Systems/BiomeTileCounterSystem.cs +++ b/Systems/BiomeTileCounterSystem.cs @@ -47,13 +47,13 @@ namespace CalamityMod.Systems SunkenSeaTiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; AbyssTiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; SulphurTiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; - ArsenalLabTiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; + ArsenalLabTiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; Layer1Tiles = tileCounts[ModContent.TileType()]; Layer2Tiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; Layer3Tiles = tileCounts[ModContent.TileType()]; Layer4Tiles = tileCounts[ModContent.TileType()]; - + int astralDesertTiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; int astralSnowTiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; diff --git a/Systems/BossRushDialogueSystem.cs b/Systems/BossRushDialogueSystem.cs index 1023d4b75e..518221d65e 100644 --- a/Systems/BossRushDialogueSystem.cs +++ b/Systems/BossRushDialogueSystem.cs @@ -10,10 +10,10 @@ namespace CalamityMod.Systems { public static bool GottaGoFast = false; public static int GottaGoFastSpeed = 5; - + public static BossRushDialoguePhase Phase = BossRushDialoguePhase.None; private static BossRushDialogueEvent[] currentSequence = null; - private static int currentSequenceIndex = 0; + public static int currentSequenceIndex = 0; public static int CurrentDialogueDelay = 0; @@ -54,85 +54,86 @@ namespace CalamityMod.Systems internal static Dictionary BossRushDialogue; - + public override void Load() { // // Dialogue times were timed by Ozzatron reading them aloud with a stopwatch. + // CIT 11MAY2024: I decided to decrease all of these dialogue delays by 30 frames, in an attempt to cut down on unnecessary waiting around. // - + // Dialogue that occurs the first time you start Boss Rush BossRushDialogueEvent[] startDialogues = new BossRushDialogueEvent[] { - new("Mods.CalamityMod.Events.BossRushStartText_1", 360), - new("Mods.CalamityMod.Events.BossRushStartText_2", 435), - new("Mods.CalamityMod.Events.BossRushStartText_3", 240), - new("Mods.CalamityMod.Events.BossRushStartText_4", 435), - new("Mods.CalamityMod.Events.BossRushStartText_5", 480), - new("Mods.CalamityMod.Events.BossRushStartText_6", 270), - new("Mods.CalamityMod.Events.BossRushStartText_7", 465), - new("Mods.CalamityMod.Events.BossRushStartText_8", 480), - new("Mods.CalamityMod.Events.BossRushStartText_9", 330), - new("Mods.CalamityMod.Events.BossRushStartText_DoG", 180, skipFunc: () => !DownedBossSystem.downedDoG), - new("Mods.CalamityMod.Events.BossRushStartText_Yharon", 240, skipFunc: () => !DownedBossSystem.downedYharon), - new("Mods.CalamityMod.Events.BossRushStartText_DraedonSCal", 315, skipFunc: () => !DownedBossSystem.downedExoMechs || !DownedBossSystem.downedCalamitas), - new("Mods.CalamityMod.Events.BossRushStartText_10", 420), - new("Mods.CalamityMod.Events.BossRushStartText_11", 420), - new("Mods.CalamityMod.Events.BossRushStartText_12", 270), + new("Mods.CalamityMod.Events.BossRushStartText_1", 330), + new("Mods.CalamityMod.Events.BossRushStartText_2", 405), + new("Mods.CalamityMod.Events.BossRushStartText_3", 210), + new("Mods.CalamityMod.Events.BossRushStartText_4", 405), + new("Mods.CalamityMod.Events.BossRushStartText_5", 450), + new("Mods.CalamityMod.Events.BossRushStartText_6", 240), + new("Mods.CalamityMod.Events.BossRushStartText_7", 435), + new("Mods.CalamityMod.Events.BossRushStartText_8", 450), + new("Mods.CalamityMod.Events.BossRushStartText_9", 300), + new("Mods.CalamityMod.Events.BossRushStartText_DoG", 150, skipFunc: () => !DownedBossSystem.downedDoG), + new("Mods.CalamityMod.Events.BossRushStartText_Yharon", 210, skipFunc: () => !DownedBossSystem.downedYharon), + new("Mods.CalamityMod.Events.BossRushStartText_DraedonSCal", 285, skipFunc: () => !DownedBossSystem.downedExoMechs || !DownedBossSystem.downedCalamitas), + new("Mods.CalamityMod.Events.BossRushStartText_10", 390), + new("Mods.CalamityMod.Events.BossRushStartText_11", 390), + new("Mods.CalamityMod.Events.BossRushStartText_12", 240), }; // Dialogue that occurs when starting Boss Rush on repeat attempts BossRushDialogueEvent[] startDialoguesShort = new BossRushDialogueEvent[] { - new("Mods.CalamityMod.Events.BossRushStartText_Repeat", 120), + new("Mods.CalamityMod.Events.BossRushStartText_Repeat", 90), }; // Dialogue that occurs when beating Tier 1 of Boss Rush BossRushDialogueEvent[] tierOneDialogues = new BossRushDialogueEvent[] { - new("Mods.CalamityMod.Events.BossRushTierOneEndText_1", 360), - new("Mods.CalamityMod.Events.BossRushTierOneEndText_2", 255), + new("Mods.CalamityMod.Events.BossRushTierOneEndText_1", 330), + new("Mods.CalamityMod.Events.BossRushTierOneEndText_2", 225), }; // Dialogue that occurs when beating Tier 2 of Boss Rush BossRushDialogueEvent[] tierTwoDialogues = new BossRushDialogueEvent[] { - new("Mods.CalamityMod.Events.BossRushTierTwoEndText_1", 255), - new("Mods.CalamityMod.Events.BossRushTierTwoEndText_2", 300), + new("Mods.CalamityMod.Events.BossRushTierTwoEndText_1", 225), + new("Mods.CalamityMod.Events.BossRushTierTwoEndText_2", 270), }; // Dialogue that occurs when beating Tier 3 of Boss Rush BossRushDialogueEvent[] tierThreeDialogues = new BossRushDialogueEvent[] { - new("Mods.CalamityMod.Events.BossRushTierThreeEndText_1", 465), - new("Mods.CalamityMod.Events.BossRushTierThreeEndText_2", 330), + new("Mods.CalamityMod.Events.BossRushTierThreeEndText_1", 435), + new("Mods.CalamityMod.Events.BossRushTierThreeEndText_2", 300), }; // Dialogue that occurs when beating Tier 4 of Boss Rush BossRushDialogueEvent[] tierFourDialogues = new BossRushDialogueEvent[] { - new("Mods.CalamityMod.Events.BossRushTierFourEndText_1", 165), - new("Mods.CalamityMod.Events.BossRushTierFourEndText_2", 330), - new("Mods.CalamityMod.Events.BossRushTierFourEndText_3", 300), + new("Mods.CalamityMod.Events.BossRushTierFourEndText_1", 135), + new("Mods.CalamityMod.Events.BossRushTierFourEndText_2", 300), + new("Mods.CalamityMod.Events.BossRushTierFourEndText_3", 270), }; // Dialogue that occurs the first time you beat Boss Rush BossRushDialogueEvent[] endDialogues = new BossRushDialogueEvent[] { - new("Mods.CalamityMod.Events.BossRushEndText_1", 540), - new("Mods.CalamityMod.Events.BossRushEndText_2", 465), - new("Mods.CalamityMod.Events.BossRushEndText_3", 360), - new("Mods.CalamityMod.Events.BossRushEndText_4", 285), - new("Mods.CalamityMod.Events.BossRushEndText_5", 420), - new("Mods.CalamityMod.Events.BossRushEndText_6", 420), - new("Mods.CalamityMod.Events.BossRushEndText_7", 225), - new("Mods.CalamityMod.Events.BossRushEndText_8", 135), + new("Mods.CalamityMod.Events.BossRushEndText_1", 510), + new("Mods.CalamityMod.Events.BossRushEndText_2", 435), + new("Mods.CalamityMod.Events.BossRushEndText_3", 330), + new("Mods.CalamityMod.Events.BossRushEndText_4", 255), + new("Mods.CalamityMod.Events.BossRushEndText_5", 390), + new("Mods.CalamityMod.Events.BossRushEndText_6", 390), + new("Mods.CalamityMod.Events.BossRushEndText_7", 195), + new("Mods.CalamityMod.Events.BossRushEndText_8", 105), }; - // Dialogue that occurs the first time you beat Boss Rush + // Dialogue that occurs on subsequent times you beat Boss Rush BossRushDialogueEvent[] endDialoguesShort = new BossRushDialogueEvent[] { - new("Mods.CalamityMod.Events.BossRushEndText_Repeat", 510), + new("Mods.CalamityMod.Events.BossRushEndText_Repeat", 480), }; BossRushDialogue = new Dictionary() @@ -171,7 +172,7 @@ namespace CalamityMod.Systems // If the phase isn't defined properly, don't do anything. if (Phase == BossRushDialoguePhase.None) return; - + if (currentSequenceIndex < currentSequence.Length) { // If it's time to display dialogue, do so. @@ -207,6 +208,10 @@ namespace CalamityMod.Systems if (GottaGoFast && CurrentDialogueDelay > GottaGoFastSpeed) CurrentDialogueDelay = GottaGoFastSpeed; } + else + { + CurrentDialogueDelay = 0; + } // If the end of a sequence has been reached, stay in this state indefinitely. // Allow the boss spawn countdown to hit zero and the next boss to appear without showing any dialogue or causing any delays. @@ -224,7 +229,7 @@ namespace CalamityMod.Systems private static bool GetNextUnskippedDialogue(BossRushDialogueEvent[] sequence, int index, out int newIndex) { int tryIndex = index; - while(tryIndex < sequence.Length) + while (tryIndex < sequence.Length) { BossRushDialogueEvent lineToTry = currentSequence[tryIndex]; if (lineToTry.skipCondition is not null && lineToTry.skipCondition.Invoke()) diff --git a/Systems/DifficultyModeSystem.cs b/Systems/DifficultyModeSystem.cs index b91788d864..514d003dd5 100644 --- a/Systems/DifficultyModeSystem.cs +++ b/Systems/DifficultyModeSystem.cs @@ -1,20 +1,20 @@ -using CalamityMod.World; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ModLoader; -using CalamityMod.CalPlayer; -using CalamityMod.Events; +using System; using System.Collections.Generic; using System.Linq; -using Terraria.Localization; -using static CalamityMod.CalamityUtils; -using System; -using Terraria.ID; -using ReLogic.Content; -using Terraria.Audio; -using Terraria.ModLoader.IO; +using CalamityMod.CalPlayer; +using CalamityMod.Events; using CalamityMod.Items.Armor.Demonshade; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.ModLoader.IO; +using static CalamityMod.CalamityUtils; namespace CalamityMod.Systems { @@ -30,7 +30,7 @@ namespace CalamityMod.Systems { MostAlternateDifficulties = 1; //Initialize base mod difficulties - Difficulties = new List() { new NoDifficulty(), new RevengeanceDifficulty(), new DeathDifficulty()}; + Difficulties = new List() { new NoDifficulty(), new RevengeanceDifficulty(), new DeathDifficulty() }; CalculateDifficultyData(); } @@ -91,7 +91,7 @@ namespace CalamityMod.Systems public override void SaveWorldData(TagCompound tag) { //Apparently this is ran after worldgen so it cant always be set to true - tag["hasCheckedOutTheCoolDifficultyUI"] = _hasCheckedItOutYet; + tag["hasCheckedOutTheCoolDifficultyUI"] = _hasCheckedItOutYet; } public override void OnWorldLoad() @@ -169,17 +169,17 @@ namespace CalamityMod.Systems return _texture; } } - + public NoDifficulty() { DifficultyScale = 0; Name = CalamityUtils.GetText("UI.NoDifficulty"); ShortDescription = CalamityUtils.GetText("UI.NoDifficultyInfo"); - + ActivationTextKey = string.Empty; DeactivationTextKey = string.Empty; - ActivationSound = SoundID.MenuTick with { Volume = 1f}; + ActivationSound = SoundID.MenuTick with { Volume = 1f }; ChatTextColor = Color.White; } @@ -204,7 +204,7 @@ namespace CalamityMod.Systems return _texture; } } - + public override LocalizedText ExpandedDescription { get @@ -249,7 +249,7 @@ namespace CalamityMod.Systems return _texture; } } - + public override LocalizedText ExpandedDescription => CalamityUtils.GetText("UI.DeathExpandedInfo"); public DeathDifficulty() @@ -279,4 +279,4 @@ namespace CalamityMod.Systems return 0; } } -} \ No newline at end of file +} diff --git a/Systems/GungeonMusicSystem.cs b/Systems/GungeonMusicSystem.cs new file mode 100644 index 0000000000..ae20c6dab4 --- /dev/null +++ b/Systems/GungeonMusicSystem.cs @@ -0,0 +1,71 @@ +using Microsoft.Xna.Framework; +using ReLogic.Utilities; +using Terraria.Audio; +using Terraria.ModLoader; + +namespace CalamityMod.Systems +{ + public class GungeonMusicSystem : ModSystem + { + // Copied straight from the ORDER easter egg + + private static readonly SoundStyle GungeonTrack = new("CalamityMod/Sounds/Custom/GungeonCreditMusic", SoundType.Music); + private static SlotId gungeonSoundSlot; + + internal static float DefaultMusicTime = 100f; + internal static float DefaultResetTime = 240f; + + internal static float remainingPlaytime = 0f; + internal static float timeUntilReset = 0f; + + private static bool currentlyPlaying = false; + + public override void UpdateUI(GameTime gameTime) + { + // Decrement timers + if (remainingPlaytime > 0) + --remainingPlaytime; + if (timeUntilReset > 0) + --timeUntilReset; + + if (currentlyPlaying) + { + // If the reset timer has run out, stop the active sound instance entirely. + // The next bullet hit will start the song from the beginning. + if (timeUntilReset <= 0f) + { + currentlyPlaying = false; + if (SoundEngine.TryGetActiveSound(gungeonSoundSlot, out var activeSound)) + activeSound.Stop(); + gungeonSoundSlot = SlotId.Invalid; + } + + // Otherwise, set the volume of the active sound instance appropriately. + else + { + bool foundTheGun = SoundEngine.TryGetActiveSound(gungeonSoundSlot, out var activeSound); + if (!foundTheGun) + { + currentlyPlaying = false; + return; + } + + float newVolume = MathHelper.Clamp(remainingPlaytime / DefaultMusicTime, 0f, 0.8f); + activeSound.Volume = newVolume; + activeSound.Update(); + } + } + } + + // EEEEEEEEEEEEEEEEEEEEEEENTER THE GUNGEON, ENTER THE GUNGEON + public static void GUN() + { + if (!currentlyPlaying) + gungeonSoundSlot = SoundEngine.PlaySound(GungeonTrack); + + currentlyPlaying = true; + remainingPlaytime = DefaultMusicTime + 30; + timeUntilReset = DefaultResetTime; + } + } +} diff --git a/Systems/HellBackgroundSystem.cs b/Systems/HellBackgroundSystem.cs index da2600efed..9d55266ac7 100644 --- a/Systems/HellBackgroundSystem.cs +++ b/Systems/HellBackgroundSystem.cs @@ -236,4 +236,4 @@ namespace CalamityMod.Systems public override Color DrawColor => Color.Gray; //draw color of the bg } } -*/ \ No newline at end of file +*/ diff --git a/Systems/LightingEffectsSystem.cs b/Systems/LightingEffectsSystem.cs index a8401d8d73..679a7137dc 100644 --- a/Systems/LightingEffectsSystem.cs +++ b/Systems/LightingEffectsSystem.cs @@ -97,6 +97,12 @@ namespace CalamityMod.Systems Main.ColorOfTheSkies = Color.Lerp(Main.ColorOfTheSkies, Color.DarkGray, intensity * 0.9f); Main.ColorOfTheSkies = Color.Lerp(Main.ColorOfTheSkies, Color.Black, intensity * 0.65f); } + else if (Main.LocalPlayer?.Calamity()?.monolithAstralShader > 0) + { + float intensity = SkyManager.Instance["CalamityMod:Astral"].Opacity; + backgroundColor = Color.Lerp(backgroundColor, Color.Purple, intensity * 0.4f); + backgroundColor = Color.Lerp(backgroundColor, Color.Black, intensity * 0.75f); + } } } } diff --git a/Systems/MiscWorldStateSystem.cs b/Systems/MiscWorldStateSystem.cs index fdda225ea0..897754c9a7 100644 --- a/Systems/MiscWorldStateSystem.cs +++ b/Systems/MiscWorldStateSystem.cs @@ -64,7 +64,6 @@ namespace CalamityMod dogName = false; bunnyName = false; - onionMode = false; revenge = false; TalkedToDraedon = false; death = false; @@ -80,8 +79,6 @@ namespace CalamityMod public override void SaveWorldData(TagCompound tag) { var downed = new List(); - if (onionMode) - downed.Add("onionMode"); if (TalkedToDraedon) downed.Add("TalkedToDraedon"); if (revenge) @@ -108,7 +105,7 @@ namespace CalamityMod downed.Add("dogName"); if (bunnyName) downed.Add("bunnyName"); - #endregion + #endregion if (AcidRainEvent.HasTriedToSummonOldDuke) downed.Add("spawnedBoomer"); @@ -148,7 +145,6 @@ namespace CalamityMod public override void LoadWorldData(TagCompound tag) { var downed = tag.GetList("downed"); - onionMode = downed.Contains("onionMode"); TalkedToDraedon = downed.Contains("TalkedToDraedon"); revenge = downed.Contains("revenge"); death = downed.Contains("death"); @@ -163,7 +159,7 @@ namespace CalamityMod catName = downed.Contains("catName"); dogName = downed.Contains("dogName"); bunnyName = downed.Contains("bunnyName"); - #endregion + #endregion AcidRainEvent.HasTriedToSummonOldDuke = downed.Contains("spawnedBoomer"); AcidRainEvent.HasStartedAcidicDownpour = downed.Contains("startDownpour"); @@ -236,7 +232,7 @@ namespace CalamityMod flags4[3] = false; flags4[4] = false; flags4[5] = false; - flags4[6] = onionMode; + flags4[6] = false; flags4[7] = revenge; BitsByte flags5 = new BitsByte(); @@ -390,7 +386,7 @@ namespace CalamityMod _ = flags4[3]; _ = flags4[4]; _ = flags4[5]; - onionMode = flags4[6]; + _ = flags4[6]; revenge = flags4[7]; BitsByte flags5 = reader.ReadByte(); diff --git a/Systems/MusicBoxRegistry.cs b/Systems/MusicBoxRegistry.cs index 12fefd7b24..8f13b437b2 100644 --- a/Systems/MusicBoxRegistry.cs +++ b/Systems/MusicBoxRegistry.cs @@ -16,7 +16,9 @@ namespace CalamityMod { if (!Main.dedServ) { - AddMusicBox("Sounds/Music/DraedonsAmbience", ModContent.ItemType(), ModContent.TileType()); + // 24APR2024: Ozzatron: unclear why these two songs are even in main mod, but I don't want to break precedent + AddMusicBox("Sounds/Music/DraedonExoSelect", ModContent.ItemType(), ModContent.TileType()); + AddMusicBox("Sounds/Music/DraedonTalk", ModContent.ItemType(), ModContent.TileType()); } } } diff --git a/Systems/NerfExpertDebuffsSystem.cs b/Systems/NerfExpertDebuffsSystem.cs index 6837336977..49a6da275c 100644 --- a/Systems/NerfExpertDebuffsSystem.cs +++ b/Systems/NerfExpertDebuffsSystem.cs @@ -1,4 +1,4 @@ -using System; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -25,7 +25,7 @@ namespace CalamityMod.Systems Main.GameMode = Main.GameMode; } // If people want to suffer, let them suffer - else + else { var copy = Main.RegisteredGameModes[GameModeID.Expert]; copy.DebuffTimeMultiplier = 2f; diff --git a/Systems/TempTilesManagerSystem.cs b/Systems/TempTilesManagerSystem.cs index fdfa96f88f..181e1d702c 100644 --- a/Systems/TempTilesManagerSystem.cs +++ b/Systems/TempTilesManagerSystem.cs @@ -1,16 +1,16 @@ -using Microsoft.Xna.Framework; -using Terraria.ModLoader; +using System.Collections.Generic; +using System.Linq; +using CalamityMod.Items.Materials; using CalamityMod.Items.Tools; using CalamityMod.Systems; -using Terraria; -using CalamityMod.Items.Materials; -using System.Linq; -using Terraria.ID; -using System.Collections.Generic; -using Microsoft.Xna.Framework.Graphics; -using Terraria.Graphics.Shaders; -using Terraria.Graphics.Effects; using CalamityMod.Tiles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Graphics.Effects; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Systems { diff --git a/Systems/TilePingerSystem.cs b/Systems/TilePingerSystem.cs index 9d6a5aa79e..f28c9cb3b1 100644 --- a/Systems/TilePingerSystem.cs +++ b/Systems/TilePingerSystem.cs @@ -1,15 +1,15 @@ using System; using System.Collections.Generic; +using CalamityMod.Items.Tools; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.DataStructures; using Terraria.Graphics.Effects; -using Terraria.ID; -using Terraria.Audio; -using Terraria.ModLoader; -using CalamityMod.Items.Tools; using Terraria.Graphics.Light; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Systems { @@ -205,7 +205,7 @@ namespace CalamityMod.Systems { public override void DrawEffects(int i, int j, int type, SpriteBatch spriteBatch, ref TileDrawInfo drawData) { - foreach(IPingedTileEffect effect in TilePingerSystem.tileEffects.Values) + foreach (IPingedTileEffect effect in TilePingerSystem.tileEffects.Values) { if (effect.Active && effect.ShouldRegisterTile(i, j)) { diff --git a/Systems/UIManagementSystem.cs b/Systems/UIManagementSystem.cs index e467e32e43..bf003f4504 100644 --- a/Systems/UIManagementSystem.cs +++ b/Systems/UIManagementSystem.cs @@ -89,7 +89,7 @@ namespace CalamityMod.Systems SulphurousWaterMeterUI.Draw(Main.spriteBatch, Main.LocalPlayer); return true; }, InterfaceScaleType.None)); - + //Flight bar layers.Insert(mouseIndex, new LegacyGameInterfaceLayer("Flight UI", () => { diff --git a/Systems/WorldMiscUpdateSystem.cs b/Systems/WorldMiscUpdateSystem.cs index d51e8c69bd..05c4a3c2d5 100644 --- a/Systems/WorldMiscUpdateSystem.cs +++ b/Systems/WorldMiscUpdateSystem.cs @@ -2,13 +2,15 @@ using CalamityMod.CalPlayer; using CalamityMod.Events; using CalamityMod.NPCs; -using CalamityMod.NPCs.PrimordialWyrm; using CalamityMod.NPCs.ExoMechs; using CalamityMod.NPCs.NormalNPCs; +using CalamityMod.NPCs.PrimordialWyrm; using CalamityMod.Projectiles.Boss; using CalamityMod.Tiles; using CalamityMod.Tiles.Abyss; +using CalamityMod.Tiles.Crags; using CalamityMod.Tiles.SunkenSea; +using CalamityMod.Walls; using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; @@ -16,8 +18,9 @@ using Terraria.DataStructures; using Terraria.GameContent.Events; using Terraria.ID; using Terraria.ModLoader; -using static CalamityMod.World.CalamityWorld; using Terraria.WorldBuilding; +using static CalamityMod.World.CalamityWorld; +using static Terraria.ModLoader.ModContent; namespace CalamityMod.Systems { @@ -312,6 +315,78 @@ namespace CalamityMod.Systems } } } + + if (growthTile.LiquidAmount == 0 && y > Main.UnderworldLayer) + { + bool isCragsTile = tileType == TileType() || + tileType == TileType() || + tileType == TileType() || + tileType == TileType() || + tileType == TileType(); + + int wallType = Main.tile[x, y2].WallType; + bool isCragHouseWall = wallType == WallType() || + wallType == WallType() || + wallType == WallType() || + wallType == WallType(); + + if (isCragsTile && isCragHouseWall && Main.tile[x, y2].LiquidAmount == 0) + { + // Lilies of Finality post-Yharon. + if (WorldGen.genRand.NextBool(20) && DownedBossSystem.downedYharon) + { + ushort tileTypeToPlace = (ushort)TileType(); + int tileTypeToPlaceThickness = 3; + bool placeLilies = true; + + // Do not change this number, ever. - Fabsol + int minDistanceFromOtherLilies = 66; + + for (int k = x - minDistanceFromOtherLilies; k < x + minDistanceFromOtherLilies; k += 2) + { + for (int m = y - minDistanceFromOtherLilies; m < y + minDistanceFromOtherLilies; m += 2) + { + if (k > tileTypeToPlaceThickness && k < Main.maxTilesX - tileTypeToPlaceThickness && m > tileTypeToPlaceThickness && m < Main.maxTilesY - tileTypeToPlaceThickness && Main.tile[k, m].HasTile && Main.tile[k, m].TileType == tileTypeToPlace) + { + placeLilies = false; + break; + } + } + } + + if (placeLilies) + { + if (x < tileTypeToPlaceThickness || x > Main.maxTilesX - tileTypeToPlaceThickness || y2 < tileTypeToPlaceThickness || y2 > Main.maxTilesY - tileTypeToPlaceThickness) + return; + + bool placeTile = true; + for (int i2 = x - 1; i2 < x + 2; i2++) + { + for (int j3 = y2 - 2; j3 < y2 + 1; j3++) + { + if (Main.tile[i2, j3] == null) + return; + + if (Main.tile[i2, j3].HasTile) + placeTile = false; + } + + if (Main.tile[i2, y2 + 1] == null) + return; + + if (!WorldGen.SolidTile2(i2, y2 + 1)) + placeTile = false; + } + + if (placeTile) + { + WorldGen.PlaceObject(x, y2, tileTypeToPlace, true); + NetMessage.SendObjectPlacement(-1, x, y2, tileTypeToPlace, 0, 0, -1, -1); + } + } + } + } + } } } l++; @@ -320,7 +395,7 @@ namespace CalamityMod.Systems public static bool CanPlaceBasedOnProximity(int x, int y, int tileType) { - if (tileType == ModContent.TileType() && !DownedBossSystem.downedCalamitasClone) + if (tileType == ModContent.TileType() && !DownedBossSystem.downedLeviathan) return false; int minDistanceFromOtherTiles = 10; diff --git a/Systems/WorldSelectionDifficultySystem.cs b/Systems/WorldSelectionDifficultySystem.cs new file mode 100644 index 0000000000..73621eb404 --- /dev/null +++ b/Systems/WorldSelectionDifficultySystem.cs @@ -0,0 +1,155 @@ +using System; +using System.Collections.Generic; +using System.Reflection; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Terraria.GameContent.UI.Elements; +using Terraria.IO; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.ModLoader.IO; + +namespace CalamityMod.Systems +{ + public class WorldSelectionDifficultySystem : ModSystem + { + public override void PostSetupContent() + { + // Load all of the World Difficulties to the World Difficulty list + // The difficulty the world uses will be the latest applicable one, so these are added in order from easiest to hardest + // These colors are all picked from the wiki's colors for each Difficulty combo + // Calamity's own difficulties aren't added if the Luminance mod is on, as it adds its own world system + if (CalamityMod.Instance.luminance == null) + { + WorldDifficulties.Add(new WorldDifficulty(CalamityUtils.GetTextValue("UI.Revengeance"), GetRevengeance, new(211, 42, 42))); + WorldDifficulties.Add(new WorldDifficulty(CalamityUtils.GetTextValue("UI.Death"), GetDeath, new(192, 64, 219))); + WorldDifficulties.Add(new WorldDifficulty(CalamityUtils.GetTextValue("UI.RevMaster"), GetMasterRevengeance, new(124, 153, 242))); + WorldDifficulties.Add(new WorldDifficulty(CalamityUtils.GetTextValue("UI.DeathMaster"), GetMasterDeath, new(255, 25, 255))); + WorldDifficulties.Add(new WorldDifficulty(CalamityUtils.GetTextValue("UI.RevLegend"), GetLegendRevengeance, new(240, 128, 128))); // Malice color + WorldDifficulties.Add(new WorldDifficulty(CalamityUtils.GetTextValue("UI.DeathLegend"), GetLegendDeath, new(220, 255, 132))); // Defiled color + } + } + + public override void SaveWorldHeader(TagCompound tag) + { + // Since CalamityWorld is static, and therefore invalid for TryGetHeaderData, make copies for Rev and Death + tag["RevengeanceMode"] = CalamityWorld.revenge; + tag["DeathMode"] = CalamityWorld.death; + } + + public record WorldDifficulty(string name, Func function, Color color); + + public static List WorldDifficulties = new List(); + public static bool GetRevengeance(AWorldListItem item) + { + if (item.Data.TryGetHeaderData(out TagCompound tag)) + { + if (tag.ContainsKey("RevengeanceMode") && tag.GetBool("RevengeanceMode")) + { + return true; + } + } + return false; + } + + public static bool GetDeath(AWorldListItem item) + { + if (item.Data.TryGetHeaderData(out TagCompound tag)) + { + if (tag.ContainsKey("DeathMode") && tag.GetBool("DeathMode")) + { + return true; + } + } + return false; + } + + public static bool GetMasterRevengeance(AWorldListItem item) + { + // Grab data from the listed world + FieldInfo worldDataField = typeof(UIWorldListItem).GetField("_data", BindingFlags.NonPublic | BindingFlags.Instance); + WorldFileData worldData = (WorldFileData)worldDataField.GetValue(item); + + int trueGameMode = worldData.GameMode; + if (worldData.ForTheWorthy) + { + trueGameMode++; + } + + if (item.Data.TryGetHeaderData(out TagCompound tag)) + { + if (tag.ContainsKey("RevengeanceMode") && tag.GetBool("RevengeanceMode") && trueGameMode == 2) + { + return true; + } + } + return false; + } + + public static bool GetMasterDeath(AWorldListItem item) + { + // Grab data from the listed world + FieldInfo worldDataField = typeof(UIWorldListItem).GetField("_data", BindingFlags.NonPublic | BindingFlags.Instance); + WorldFileData worldData = (WorldFileData)worldDataField.GetValue(item); + + int trueGameMode = worldData.GameMode; + if (worldData.ForTheWorthy) + { + trueGameMode++; + } + + if (item.Data.TryGetHeaderData(out TagCompound tag)) + { + if (tag.ContainsKey("DeathMode") && tag.GetBool("DeathMode") && trueGameMode == 2) + { + return true; + } + } + return false; + } + + public static bool GetLegendRevengeance(AWorldListItem item) + { + // Grab data from the listed world + FieldInfo worldDataField = typeof(UIWorldListItem).GetField("_data", BindingFlags.NonPublic | BindingFlags.Instance); + WorldFileData worldData = (WorldFileData)worldDataField.GetValue(item); + + int trueGameMode = worldData.GameMode; + if (worldData.ForTheWorthy) + { + trueGameMode++; + } + + if (item.Data.TryGetHeaderData(out TagCompound tag)) + { + if (tag.ContainsKey("RevengeanceMode") && tag.GetBool("RevengeanceMode") && trueGameMode == 3) + { + return true; + } + } + return false; + } + + public static bool GetLegendDeath(AWorldListItem item) + { + // Grab data from the listed world + FieldInfo worldDataField = typeof(UIWorldListItem).GetField("_data", BindingFlags.NonPublic | BindingFlags.Instance); + WorldFileData worldData = (WorldFileData)worldDataField.GetValue(item); + + int trueGameMode = worldData.GameMode; + if (worldData.ForTheWorthy) + { + trueGameMode++; + } + + if (item.Data.TryGetHeaderData(out TagCompound tag)) + { + if (tag.ContainsKey("DeathMode") && tag.GetBool("DeathMode") && trueGameMode == 3) + { + return true; + } + } + return false; + } + } +} diff --git a/Systems/WorldgenManagementSystem.cs b/Systems/WorldgenManagementSystem.cs index 1d7bde379f..822a6dac34 100644 --- a/Systems/WorldgenManagementSystem.cs +++ b/Systems/WorldgenManagementSystem.cs @@ -1,15 +1,15 @@ using System.Collections.Generic; +using CalamityMod.Items.SummonItems; using CalamityMod.World; using CalamityMod.World.Planets; using Microsoft.Xna.Framework; using Terraria; using Terraria.GameContent.Generation; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; using Terraria.WorldBuilding; -using CalamityMod.Items.SummonItems; using static CalamityMod.World.CalamityWorld; -using Terraria.Localization; namespace CalamityMod.Systems { @@ -347,7 +347,7 @@ namespace CalamityMod.Systems bool isGoldChest = isContainer1 && (Main.tile[chest.x, chest.y].TileFrameX == 36 || Main.tile[chest.x, chest.y].TileFrameX == 2 * 36); // Includes Locked Gold Chests bool isMahoganyChest = isContainer1 && Main.tile[chest.x, chest.y].TileFrameX == 8 * 36; bool isIvyChest = isContainer1 && Main.tile[chest.x, chest.y].TileFrameX == 10 * 36; - bool isIceChest = isContainer1 && Main.tile[chest.x, chest.y].TileFrameX == 11 * 36; + bool isIceChest = isContainer1 && Main.tile[chest.x, chest.y].TileFrameX == 11 * 36; bool isMushroomChest = isContainer1 && Main.tile[chest.x, chest.y].TileFrameX == 32 * 36; bool isMarniteChest = isContainer1 && (Main.tile[chest.x, chest.y].TileFrameX == 50 * 36 || Main.tile[chest.x, chest.y].TileFrameX == 51 * 36); diff --git a/TileEntities/TEBaseTurret.cs b/TileEntities/TEBaseTurret.cs index 9a9f50d51a..cc645762f3 100644 --- a/TileEntities/TEBaseTurret.cs +++ b/TileEntities/TEBaseTurret.cs @@ -1,6 +1,6 @@ -using Microsoft.Xna.Framework; -using System; +using System; using System.IO; +using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -114,7 +114,7 @@ namespace CalamityMod.TileEntities } // This function does nothing by default, but turrets can use it for flavor behaviors e.g. emitting sparks or beeping. - protected virtual void PassiveBehavior(Vector2 turretPos) {} + protected virtual void PassiveBehavior(Vector2 turretPos) { } protected virtual void ActiveBehavior(Vector2 turretPos, Vector2 targetPos) { @@ -237,7 +237,8 @@ namespace CalamityMod.TileEntities // Due to the limitations of TML packets, this data must be exactly 16 bytes in size. // The default implementations here write 16 bytes of zeroes and dump all 16 bytes when read. public const int NumExtraBytes = 16; - protected virtual void WriteExtraData(BinaryWriter writer) { + protected virtual void WriteExtraData(BinaryWriter writer) + { writer.Write(0Lu); writer.Write(0Lu); } diff --git a/TileEntities/TECalamityPylon.cs b/TileEntities/TECalamityPylon.cs index c7d419d917..4f9c4fe060 100644 --- a/TileEntities/TECalamityPylon.cs +++ b/TileEntities/TECalamityPylon.cs @@ -8,7 +8,8 @@ namespace CalamityMod.TileEntities /// class, which itself acts nearly identical to vanilla pylon TEs. This inheritance only exists so that modded pylon entities /// will properly have their "Mod" property set, for I/O purposes. Has the sealed modifier since this TE acts identical to its parent. /// - public sealed class TECalamityPylon : TEModdedPylon { - + public sealed class TECalamityPylon : TEModdedPylon + { + } } diff --git a/TileEntities/TEChargingStation.cs b/TileEntities/TEChargingStation.cs index 49027f7f6a..caa483d473 100644 --- a/TileEntities/TEChargingStation.cs +++ b/TileEntities/TEChargingStation.cs @@ -1,10 +1,10 @@ -using CalamityMod.CalPlayer; +using System.IO; +using System.Reflection; +using CalamityMod.CalPlayer; using CalamityMod.Items; using CalamityMod.Items.DraedonMisc; using CalamityMod.Tiles.DraedonStructures; using Microsoft.Xna.Framework; -using System.IO; -using System.Reflection; using Terraria; using Terraria.DataStructures; using Terraria.ID; diff --git a/TileEntities/TECodebreaker.cs b/TileEntities/TECodebreaker.cs index 57f377d346..33daa22b17 100644 --- a/TileEntities/TECodebreaker.cs +++ b/TileEntities/TECodebreaker.cs @@ -1,9 +1,9 @@ -using CalamityMod.CustomRecipes; +using System.IO; +using CalamityMod.CustomRecipes; using CalamityMod.Items.DraedonMisc; using CalamityMod.Items.Materials; using CalamityMod.Tiles.DraedonSummoner; using Microsoft.Xna.Framework; -using System.IO; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -421,7 +421,7 @@ namespace CalamityMod.TileEntities HeldSchematicID = reader.ReadInt32(); DecryptionCountdown = reader.ReadInt32(); InitialCellCountBeforeDecrypting = reader.ReadInt32(); - ContainsBloodSample= reader.ReadBoolean(); + ContainsBloodSample = reader.ReadBoolean(); } } } diff --git a/TileEntities/TEHostileFireTurret.cs b/TileEntities/TEHostileFireTurret.cs index 39f2801005..65171977ee 100644 --- a/TileEntities/TEHostileFireTurret.cs +++ b/TileEntities/TEHostileFireTurret.cs @@ -1,7 +1,7 @@ -using CalamityMod.Projectiles.Turret; +using System.IO; +using CalamityMod.Projectiles.Turret; using CalamityMod.Tiles.DraedonStructures; using Microsoft.Xna.Framework; -using System.IO; using Terraria; using Terraria.ModLoader; diff --git a/TileEntities/TEHostileIceTurret.cs b/TileEntities/TEHostileIceTurret.cs index a86f093a07..7e6ff9c24d 100644 --- a/TileEntities/TEHostileIceTurret.cs +++ b/TileEntities/TEHostileIceTurret.cs @@ -1,7 +1,7 @@ -using CalamityMod.Projectiles.Turret; +using System.IO; +using CalamityMod.Projectiles.Turret; using CalamityMod.Tiles.DraedonStructures; using Microsoft.Xna.Framework; -using System.IO; using Terraria; using Terraria.ModLoader; diff --git a/TileEntities/TEHostileLabTurret.cs b/TileEntities/TEHostileLabTurret.cs index eaec3d3652..22eed5f8b8 100644 --- a/TileEntities/TEHostileLabTurret.cs +++ b/TileEntities/TEHostileLabTurret.cs @@ -1,7 +1,7 @@ -using CalamityMod.Projectiles.Turret; +using System.IO; +using CalamityMod.Projectiles.Turret; using CalamityMod.Tiles.DraedonStructures; using Microsoft.Xna.Framework; -using System.IO; using Terraria; using Terraria.ModLoader; diff --git a/TileEntities/TEHostileLaserTurret.cs b/TileEntities/TEHostileLaserTurret.cs index 139a7fd3c6..694a184e10 100644 --- a/TileEntities/TEHostileLaserTurret.cs +++ b/TileEntities/TEHostileLaserTurret.cs @@ -1,7 +1,7 @@ -using CalamityMod.Projectiles.Turret; +using System.IO; +using CalamityMod.Projectiles.Turret; using CalamityMod.Tiles.DraedonStructures; using Microsoft.Xna.Framework; -using System.IO; using Terraria; using Terraria.ModLoader; diff --git a/TileEntities/TEHostileOnyxTurret.cs b/TileEntities/TEHostileOnyxTurret.cs index 4408656a11..6c800d2ec8 100644 --- a/TileEntities/TEHostileOnyxTurret.cs +++ b/TileEntities/TEHostileOnyxTurret.cs @@ -1,7 +1,7 @@ -using CalamityMod.Projectiles.Turret; +using System.IO; +using CalamityMod.Projectiles.Turret; using CalamityMod.Tiles.DraedonStructures; using Microsoft.Xna.Framework; -using System.IO; using Terraria; using Terraria.ModLoader; diff --git a/TileEntities/TEHostilePlagueTurret.cs b/TileEntities/TEHostilePlagueTurret.cs index f33c756275..1969210cd5 100644 --- a/TileEntities/TEHostilePlagueTurret.cs +++ b/TileEntities/TEHostilePlagueTurret.cs @@ -1,7 +1,7 @@ -using CalamityMod.Projectiles.Turret; +using System.IO; +using CalamityMod.Projectiles.Turret; using CalamityMod.Tiles.DraedonStructures; using Microsoft.Xna.Framework; -using System.IO; using Terraria; using Terraria.ModLoader; diff --git a/TileEntities/TEHostileWaterTurret.cs b/TileEntities/TEHostileWaterTurret.cs index 5e6082e611..edaf987128 100644 --- a/TileEntities/TEHostileWaterTurret.cs +++ b/TileEntities/TEHostileWaterTurret.cs @@ -1,7 +1,7 @@ -using CalamityMod.Projectiles.Turret; +using System.IO; +using CalamityMod.Projectiles.Turret; using CalamityMod.Tiles.DraedonStructures; using Microsoft.Xna.Framework; -using System.IO; using Terraria; using Terraria.ModLoader; diff --git a/TileEntities/TELabHologramProjector.cs b/TileEntities/TELabHologramProjector.cs index b61fc5d077..ea28ff6fbc 100644 --- a/TileEntities/TELabHologramProjector.cs +++ b/TileEntities/TELabHologramProjector.cs @@ -1,8 +1,8 @@ -using CalamityMod.CalPlayer; +using System.IO; +using System.Reflection; +using CalamityMod.CalPlayer; using CalamityMod.Tiles.DraedonStructures; using Microsoft.Xna.Framework; -using System.IO; -using System.Reflection; using Terraria; using Terraria.DataStructures; using Terraria.ID; diff --git a/TileEntities/TEPlayerFireTurret.cs b/TileEntities/TEPlayerFireTurret.cs index ab3c4b4289..de0a344fee 100644 --- a/TileEntities/TEPlayerFireTurret.cs +++ b/TileEntities/TEPlayerFireTurret.cs @@ -1,7 +1,7 @@ -using CalamityMod.Projectiles.Turret; +using System.IO; +using CalamityMod.Projectiles.Turret; using CalamityMod.Tiles.PlayerTurrets; using Microsoft.Xna.Framework; -using System.IO; using Terraria; using Terraria.ModLoader; diff --git a/TileEntities/TEPlayerIceTurret.cs b/TileEntities/TEPlayerIceTurret.cs index 70c2a4695f..3972e8c0c9 100644 --- a/TileEntities/TEPlayerIceTurret.cs +++ b/TileEntities/TEPlayerIceTurret.cs @@ -1,7 +1,7 @@ -using CalamityMod.Projectiles.Turret; +using System.IO; +using CalamityMod.Projectiles.Turret; using CalamityMod.Tiles.PlayerTurrets; using Microsoft.Xna.Framework; -using System.IO; using Terraria; using Terraria.ModLoader; diff --git a/TileEntities/TEPlayerLabTurret.cs b/TileEntities/TEPlayerLabTurret.cs index 3fe6b8dcf0..53fff521c4 100644 --- a/TileEntities/TEPlayerLabTurret.cs +++ b/TileEntities/TEPlayerLabTurret.cs @@ -1,7 +1,7 @@ -using CalamityMod.Projectiles.Turret; +using System.IO; +using CalamityMod.Projectiles.Turret; using CalamityMod.Tiles.PlayerTurrets; using Microsoft.Xna.Framework; -using System.IO; using Terraria; using Terraria.ModLoader; diff --git a/TileEntities/TEPlayerLaserTurret .cs b/TileEntities/TEPlayerLaserTurret .cs index 04da3948c7..543d48156d 100644 --- a/TileEntities/TEPlayerLaserTurret .cs +++ b/TileEntities/TEPlayerLaserTurret .cs @@ -1,7 +1,7 @@ -using CalamityMod.Projectiles.Turret; +using System.IO; +using CalamityMod.Projectiles.Turret; using CalamityMod.Tiles.PlayerTurrets; using Microsoft.Xna.Framework; -using System.IO; using Terraria; using Terraria.ModLoader; diff --git a/TileEntities/TEPlayerOnyxTurret.cs b/TileEntities/TEPlayerOnyxTurret.cs index be4a48643a..249773f018 100644 --- a/TileEntities/TEPlayerOnyxTurret.cs +++ b/TileEntities/TEPlayerOnyxTurret.cs @@ -1,7 +1,7 @@ -using CalamityMod.Projectiles.Turret; +using System.IO; +using CalamityMod.Projectiles.Turret; using CalamityMod.Tiles.PlayerTurrets; using Microsoft.Xna.Framework; -using System.IO; using Terraria; using Terraria.ModLoader; diff --git a/TileEntities/TEPlayerPlagueTurret.cs b/TileEntities/TEPlayerPlagueTurret.cs index 4e32a901c3..eac6772413 100644 --- a/TileEntities/TEPlayerPlagueTurret.cs +++ b/TileEntities/TEPlayerPlagueTurret.cs @@ -1,7 +1,7 @@ -using CalamityMod.Projectiles.Turret; +using System.IO; +using CalamityMod.Projectiles.Turret; using CalamityMod.Tiles.PlayerTurrets; using Microsoft.Xna.Framework; -using System.IO; using Terraria; using Terraria.ModLoader; diff --git a/TileEntities/TEPlayerWaterTurret.cs b/TileEntities/TEPlayerWaterTurret.cs index 25768063d9..50da41de03 100644 --- a/TileEntities/TEPlayerWaterTurret.cs +++ b/TileEntities/TEPlayerWaterTurret.cs @@ -1,7 +1,7 @@ -using CalamityMod.Projectiles.Turret; +using System.IO; +using CalamityMod.Projectiles.Turret; using CalamityMod.Tiles.PlayerTurrets; using Microsoft.Xna.Framework; -using System.IO; using Terraria; using Terraria.ModLoader; diff --git a/TileEntities/TEPowerCellFactory.cs b/TileEntities/TEPowerCellFactory.cs index da86d0bf1c..7b1482be3a 100644 --- a/TileEntities/TEPowerCellFactory.cs +++ b/TileEntities/TEPowerCellFactory.cs @@ -1,14 +1,14 @@ -using CalamityMod.CalPlayer; +using System.IO; +using System.Reflection; +using CalamityMod.CalPlayer; +using CalamityMod.Items.DraedonMisc; using CalamityMod.Tiles.DraedonStructures; using Microsoft.Xna.Framework; -using System.IO; -using System.Reflection; using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.IO; -using CalamityMod.Items.DraedonMisc; namespace CalamityMod.TileEntities { diff --git a/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp1.cs b/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp1.cs index b113d53a7f..97a4ee60a2 100644 --- a/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp1.cs +++ b/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp1.cs @@ -2,9 +2,9 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; -using Terraria.ID; using Terraria.DataStructures; using Terraria.Enums; +using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; @@ -39,7 +39,7 @@ namespace CalamityMod.Tiles.Abyss.AbyssAmbient if (closer && Main.rand.NextBool(100) && j > Main.worldSurface) { Dust dust; - dust = Main.dust[Dust.NewDust(new Vector2(i * 16f, j * 16f), 274, 279, 304, 0.23255825f, 10f, 0, new Color(117, 55, 15), 1.5116279f)]; + dust = Main.dust[Dust.NewDust(new Vector2(i * 16f, j * 16f), 274, 279, DustID.Firefly, 0.23255825f, 10f, 0, new Color(117, 55, 15), 1.5116279f)]; dust.noGravity = true; dust.noLight = true; dust.fadeIn = 2.5813954f; @@ -65,10 +65,10 @@ namespace CalamityMod.Tiles.Abyss.AbyssAmbient public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile tile = Framing.GetTileSafely(i, j); - Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp1Glow").Value; - Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp1Glow").Value; + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); - spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); + spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); } } @@ -78,10 +78,10 @@ namespace CalamityMod.Tiles.Abyss.AbyssAmbient public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile tile = Framing.GetTileSafely(i, j); - Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp2Glow").Value; - Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp2Glow").Value; + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); - spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); + spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); } } } diff --git a/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp3.cs b/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp3.cs index 429e44879c..0178df170f 100644 --- a/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp3.cs +++ b/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp3.cs @@ -2,9 +2,9 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; -using Terraria.ID; using Terraria.DataStructures; using Terraria.Enums; +using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; @@ -50,7 +50,7 @@ namespace CalamityMod.Tiles.Abyss.AbyssAmbient if (closer && Main.rand.NextBool(100) && j > Main.worldSurface) { Dust dust; - dust = Main.dust[Dust.NewDust(new Vector2(i * 16f, j * 16f), 274, 279, 304, 0.23255825f, 10f, 0, new Color(117, 55, 15), 1.5116279f)]; + dust = Main.dust[Dust.NewDust(new Vector2(i * 16f, j * 16f), 274, 279, DustID.Firefly, 0.23255825f, 10f, 0, new Color(117, 55, 15), 1.5116279f)]; dust.noGravity = true; dust.noLight = true; dust.fadeIn = 2.5813954f; @@ -65,10 +65,10 @@ namespace CalamityMod.Tiles.Abyss.AbyssAmbient public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile tile = Framing.GetTileSafely(i, j); - Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp3Glow").Value; - Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp3Glow").Value; + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); - spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); + spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); } } } diff --git a/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp4.cs b/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp4.cs index a751a0a9d2..5d7deca65d 100644 --- a/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp4.cs +++ b/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp4.cs @@ -2,9 +2,9 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; -using Terraria.ID; using Terraria.DataStructures; using Terraria.Enums; +using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; @@ -50,7 +50,7 @@ namespace CalamityMod.Tiles.Abyss.AbyssAmbient if (closer && Main.rand.NextBool(100) && j > Main.worldSurface) { Dust dust; - dust = Main.dust[Dust.NewDust(new Vector2(i * 16f, j * 16f), 274, 279, 304, 0.23255825f, 10f, 0, new Color(117, 55, 15), 1.5116279f)]; + dust = Main.dust[Dust.NewDust(new Vector2(i * 16f, j * 16f), 274, 279, DustID.Firefly, 0.23255825f, 10f, 0, new Color(117, 55, 15), 1.5116279f)]; dust.noGravity = true; dust.noLight = true; dust.fadeIn = 2.5813954f; @@ -65,10 +65,10 @@ namespace CalamityMod.Tiles.Abyss.AbyssAmbient public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile tile = Framing.GetTileSafely(i, j); - Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp4Glow").Value; - Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp4Glow").Value; + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); - spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); + spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); } } } diff --git a/Tiles/Abyss/AbyssAmbient/AbyssKelp.cs b/Tiles/Abyss/AbyssAmbient/AbyssKelp.cs index 12186679f3..780c4f5224 100644 --- a/Tiles/Abyss/AbyssAmbient/AbyssKelp.cs +++ b/Tiles/Abyss/AbyssAmbient/AbyssKelp.cs @@ -1,11 +1,11 @@ -using CalamityMod.Dusts; +using System; +using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; -using System; -using Terraria.ID; using Terraria.DataStructures; using Terraria.GameContent.Metadata; +using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; @@ -23,9 +23,9 @@ namespace CalamityMod.Tiles.Abyss.AbyssAmbient Main.tileLavaDeath[Type] = true; Main.tileWaterDeath[Type] = true; Main.tileFrameImportant[Type] = true; - TileID.Sets.ReplaceTileBreakUp[Type] = true; - TileID.Sets.SwaysInWindBasic[Type] = true; - TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Plant"]); + TileID.Sets.ReplaceTileBreakUp[Type] = true; + TileID.Sets.SwaysInWindBasic[Type] = true; + TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Plant"]); TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2); TileObjectData.addTile(Type); AddMapEntry(new Color(92, 93, 42)); diff --git a/Tiles/Abyss/AbyssAmbient/AbyssVent.cs b/Tiles/Abyss/AbyssAmbient/AbyssVent.cs index deeaaf1bca..96a6f51c6d 100644 --- a/Tiles/Abyss/AbyssAmbient/AbyssVent.cs +++ b/Tiles/Abyss/AbyssAmbient/AbyssVent.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Environment; +using System; +using CalamityMod.Projectiles.Environment; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -7,7 +8,6 @@ using Terraria.Enums; using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; -using System; namespace CalamityMod.Tiles.Abyss.AbyssAmbient { @@ -51,7 +51,7 @@ namespace CalamityMod.Tiles.Abyss.AbyssAmbient { Tile t = CalamityUtils.ParanoidTileRetrieval(i, j); Vector2 spawnPosition = new(i * 16f + 24f, j * 16f - 4f); - + if (!Main.gamePaused && t.TileFrameX % 36 == 0 && t.TileFrameY % 36 == 0 && Collision.CanHitLine(spawnPosition, 1, 1, spawnPosition - Vector2.UnitY * 100f, 1, 1)) { float positionInterpolant = (i + j) * 0.041f % 1f; diff --git a/Tiles/Abyss/AbyssAmbient/BulbTree.cs b/Tiles/Abyss/AbyssAmbient/BulbTree.cs index 7006ece757..b8fcb75a47 100644 --- a/Tiles/Abyss/AbyssAmbient/BulbTree.cs +++ b/Tiles/Abyss/AbyssAmbient/BulbTree.cs @@ -48,10 +48,10 @@ namespace CalamityMod.Tiles.Abyss.AbyssAmbient public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile tile = Framing.GetTileSafely(i, j); - Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/BulbTree1Glow").Value; - Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/BulbTree1Glow").Value; + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); - spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); + spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); } } @@ -60,22 +60,22 @@ namespace CalamityMod.Tiles.Abyss.AbyssAmbient public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile tile = Framing.GetTileSafely(i, j); - Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/BulbTree2Glow").Value; - Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/BulbTree2Glow").Value; + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); - spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); + spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); } } - + public class BulbTree3 : BulbTree1 { public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile tile = Framing.GetTileSafely(i, j); - Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/BulbTree3Glow").Value; - Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/BulbTree3Glow").Value; + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); - spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); + spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); } } } diff --git a/Tiles/Abyss/AbyssAmbient/GravelPile.cs b/Tiles/Abyss/AbyssAmbient/GravelPile.cs index 7ea54e6b5f..845ab3653e 100644 --- a/Tiles/Abyss/AbyssAmbient/GravelPile.cs +++ b/Tiles/Abyss/AbyssAmbient/GravelPile.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Tiles.Abyss.AbyssAmbient public class GravelPile2 : GravelPile1 { } - + public class GravelPile3 : GravelPile1 { } diff --git a/Tiles/Abyss/AbyssAmbient/MassiveRarePearl.cs b/Tiles/Abyss/AbyssAmbient/MassiveRarePearl.cs index 6d4267dfa0..eec910605f 100644 --- a/Tiles/Abyss/AbyssAmbient/MassiveRarePearl.cs +++ b/Tiles/Abyss/AbyssAmbient/MassiveRarePearl.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Tiles.Abyss.AbyssAmbient base.SetStaticDefaults(); } - public override void KillMultiTile(int i, int j, int frameX, int frameY) + public override void KillMultiTile(int i, int j, int frameX, int frameY) { if (Main.rand.NextBool(5)) Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 32, 32, ItemID.PinkPearl); diff --git a/Tiles/Abyss/AbyssAmbient/PhoviamareHalm.cs b/Tiles/Abyss/AbyssAmbient/PhoviamareHalm.cs index 326765a523..df321133ff 100644 --- a/Tiles/Abyss/AbyssAmbient/PhoviamareHalm.cs +++ b/Tiles/Abyss/AbyssAmbient/PhoviamareHalm.cs @@ -1,11 +1,11 @@ -using CalamityMod.Dusts; +using System; +using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; -using System; -using Terraria.ID; using Terraria.DataStructures; using Terraria.GameContent.Metadata; +using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; @@ -23,9 +23,9 @@ namespace CalamityMod.Tiles.Abyss.AbyssAmbient Main.tileLavaDeath[Type] = true; Main.tileWaterDeath[Type] = true; Main.tileFrameImportant[Type] = true; - TileID.Sets.ReplaceTileBreakUp[Type] = true; - TileID.Sets.SwaysInWindBasic[Type] = true; - TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Plant"]); + TileID.Sets.ReplaceTileBreakUp[Type] = true; + TileID.Sets.SwaysInWindBasic[Type] = true; + TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Plant"]); TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2); TileObjectData.addTile(Type); AddMapEntry(new Color(86, 33, 33)); diff --git a/Tiles/Abyss/AbyssAmbient/PirateCrate.cs b/Tiles/Abyss/AbyssAmbient/PirateCrate.cs index 23d9edf593..6d8da9a561 100644 --- a/Tiles/Abyss/AbyssAmbient/PirateCrate.cs +++ b/Tiles/Abyss/AbyssAmbient/PirateCrate.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Tiles.Abyss.AbyssAmbient base.SetStaticDefaults(); } - public override void KillMultiTile(int i, int j, int frameX, int frameY) + public override void KillMultiTile(int i, int j, int frameX, int frameY) { //explode when broken (troll!) //also instakill players in for the worthy @@ -94,11 +94,11 @@ namespace CalamityMod.Tiles.Abyss.AbyssAmbient base.SetStaticDefaults(); } - public override void KillMultiTile(int i, int j, int frameX, int frameY) + public override void KillMultiTile(int i, int j, int frameX, int frameY) { if (Main.rand.NextBool()) Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 32, 32, ItemID.GoldCoin, Main.rand.Next(1, 2)); - + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 32, 32, ItemID.SilverCoin, Main.rand.Next(45, 75)); } diff --git a/Tiles/Abyss/AbyssAmbient/PlantyMushPile.cs b/Tiles/Abyss/AbyssAmbient/PlantyMushPile.cs index 1ec4f65700..87e94672c2 100644 --- a/Tiles/Abyss/AbyssAmbient/PlantyMushPile.cs +++ b/Tiles/Abyss/AbyssAmbient/PlantyMushPile.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Tiles.Abyss.AbyssAmbient public class PlantyMushPile2 : PlantyMushPile1 { } - + public class PlantyMushPile3 : PlantyMushPile1 { } diff --git a/Tiles/Abyss/AbyssAmbient/ShalePile.cs b/Tiles/Abyss/AbyssAmbient/ShalePile.cs index 4e1292cdfa..74bc1d1371 100644 --- a/Tiles/Abyss/AbyssAmbient/ShalePile.cs +++ b/Tiles/Abyss/AbyssAmbient/ShalePile.cs @@ -1,4 +1,4 @@ -using CalamityMod.Dusts; +using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -42,7 +42,7 @@ namespace CalamityMod.Tiles.Abyss.AbyssAmbient public class ShalePile2 : ShalePile1 { } - + public class ShalePile3 : ShalePile1 { } diff --git a/Tiles/Abyss/AbyssAmbient/SpiderCoral.cs b/Tiles/Abyss/AbyssAmbient/SpiderCoral.cs index aee378245a..11f62b915d 100644 --- a/Tiles/Abyss/AbyssAmbient/SpiderCoral.cs +++ b/Tiles/Abyss/AbyssAmbient/SpiderCoral.cs @@ -1,11 +1,11 @@ -using CalamityMod.Dusts; +using System; +using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; -using System; -using Terraria.ID; using Terraria.DataStructures; using Terraria.GameContent.Metadata; +using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; @@ -36,10 +36,10 @@ namespace CalamityMod.Tiles.Abyss.AbyssAmbient public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile tile = Framing.GetTileSafely(i, j); - Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/SpiderCoral1Glow").Value; - Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/SpiderCoral1Glow").Value; + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); - spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); + spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); } } @@ -48,10 +48,10 @@ namespace CalamityMod.Tiles.Abyss.AbyssAmbient public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile tile = Framing.GetTileSafely(i, j); - Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/SpiderCoral2Glow").Value; - Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/SpiderCoral2Glow").Value; + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); - spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); + spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); } } @@ -60,10 +60,10 @@ namespace CalamityMod.Tiles.Abyss.AbyssAmbient public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile tile = Framing.GetTileSafely(i, j); - Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/SpiderCoral3Glow").Value; - Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/SpiderCoral3Glow").Value; + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); - spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); + spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); } } @@ -72,10 +72,10 @@ namespace CalamityMod.Tiles.Abyss.AbyssAmbient public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile tile = Framing.GetTileSafely(i, j); - Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/SpiderCoral4Glow").Value; - Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/SpiderCoral4Glow").Value; + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); - spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); + spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); } } @@ -84,10 +84,10 @@ namespace CalamityMod.Tiles.Abyss.AbyssAmbient public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile tile = Framing.GetTileSafely(i, j); - Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/SpiderCoral5Glow").Value; - Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/SpiderCoral5Glow").Value; + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); - spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); + spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); } } } diff --git a/Tiles/Abyss/AbyssAmbient/SulphurPireCoral.cs b/Tiles/Abyss/AbyssAmbient/SulphurPireCoral.cs index d3ec1fa615..0c5ee30a41 100644 --- a/Tiles/Abyss/AbyssAmbient/SulphurPireCoral.cs +++ b/Tiles/Abyss/AbyssAmbient/SulphurPireCoral.cs @@ -48,10 +48,10 @@ namespace CalamityMod.Tiles.Abyss.AbyssAmbient public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile tile = Framing.GetTileSafely(i, j); - Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/SulphurPireCoral1Glow").Value; - Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/SulphurPireCoral1Glow").Value; + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); - spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); + spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); } } @@ -60,22 +60,22 @@ namespace CalamityMod.Tiles.Abyss.AbyssAmbient public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile tile = Framing.GetTileSafely(i, j); - Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/SulphurPireCoral2Glow").Value; - Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/SulphurPireCoral2Glow").Value; + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); - spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); + spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); } } - + public class SulphurPireCoral3 : SulphurPireCoral1 { public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile tile = Framing.GetTileSafely(i, j); - Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/SulphurPireCoral3Glow").Value; - Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/SulphurPireCoral3Glow").Value; + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); - spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); + spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); } } } diff --git a/Tiles/Abyss/AbyssAmbient/SulphurTentacleCorals.cs b/Tiles/Abyss/AbyssAmbient/SulphurTentacleCorals.cs index 2facd77863..50f56211b8 100644 --- a/Tiles/Abyss/AbyssAmbient/SulphurTentacleCorals.cs +++ b/Tiles/Abyss/AbyssAmbient/SulphurTentacleCorals.cs @@ -1,11 +1,11 @@ -using CalamityMod.Dusts; +using System; +using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; -using System; -using Terraria.ID; using Terraria.DataStructures; using Terraria.GameContent.Metadata; +using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; @@ -23,9 +23,9 @@ namespace CalamityMod.Tiles.Abyss.AbyssAmbient Main.tileLavaDeath[Type] = true; Main.tileWaterDeath[Type] = false; Main.tileFrameImportant[Type] = true; - TileID.Sets.ReplaceTileBreakUp[Type] = true; - TileID.Sets.SwaysInWindBasic[Type] = true; - TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Plant"]); + TileID.Sets.ReplaceTileBreakUp[Type] = true; + TileID.Sets.SwaysInWindBasic[Type] = true; + TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Plant"]); TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2); TileObjectData.addTile(Type); AddMapEntry(new Color(32, 65, 65)); @@ -72,6 +72,6 @@ namespace CalamityMod.Tiles.Abyss.AbyssAmbient g *= brightness; b *= brightness; } - } + } } } diff --git a/Tiles/Abyss/AbyssAmbient/SulphurTubeCoral.cs b/Tiles/Abyss/AbyssAmbient/SulphurTubeCoral.cs index 5d7111671a..1d63d23213 100644 --- a/Tiles/Abyss/AbyssAmbient/SulphurTubeCoral.cs +++ b/Tiles/Abyss/AbyssAmbient/SulphurTubeCoral.cs @@ -1,4 +1,4 @@ -using CalamityMod.Dusts; +using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; diff --git a/Tiles/Abyss/AbyssAmbient/TenebrisRemnant.cs b/Tiles/Abyss/AbyssAmbient/TenebrisRemnant.cs index 3eea418a13..a5a676ba0f 100644 --- a/Tiles/Abyss/AbyssAmbient/TenebrisRemnant.cs +++ b/Tiles/Abyss/AbyssAmbient/TenebrisRemnant.cs @@ -1,11 +1,11 @@ -using CalamityMod.Dusts; +using System; +using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; -using System; -using Terraria.ID; using Terraria.DataStructures; using Terraria.GameContent.Metadata; +using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; @@ -23,9 +23,9 @@ namespace CalamityMod.Tiles.Abyss.AbyssAmbient Main.tileLavaDeath[Type] = true; Main.tileWaterDeath[Type] = true; Main.tileFrameImportant[Type] = true; - TileID.Sets.ReplaceTileBreakUp[Type] = true; - TileID.Sets.SwaysInWindBasic[Type] = true; - TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Plant"]); + TileID.Sets.ReplaceTileBreakUp[Type] = true; + TileID.Sets.SwaysInWindBasic[Type] = true; + TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Plant"]); TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2); TileObjectData.addTile(Type); AddMapEntry(new Color(46, 103, 96)); diff --git a/Tiles/Abyss/AbyssAmbient/ThermalVent.cs b/Tiles/Abyss/AbyssAmbient/ThermalVent.cs index afa51ba99e..a37f2547ef 100644 --- a/Tiles/Abyss/AbyssAmbient/ThermalVent.cs +++ b/Tiles/Abyss/AbyssAmbient/ThermalVent.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Environment; +using System; +using CalamityMod.Projectiles.Environment; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -7,7 +8,6 @@ using Terraria.Enums; using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; -using System; namespace CalamityMod.Tiles.Abyss.AbyssAmbient { @@ -68,7 +68,7 @@ namespace CalamityMod.Tiles.Abyss.AbyssAmbient { Tile t = CalamityUtils.ParanoidTileRetrieval(i, j); Vector2 spawnPosition = new(i * 16f + 24f, j * 16f - 4f); - + if (!Main.gamePaused && t.TileFrameX % 36 == 0 && t.TileFrameY % 36 == 0 && Collision.CanHitLine(spawnPosition, 1, 1, spawnPosition - Vector2.UnitY * 100f, 1, 1)) { float positionInterpolant = (i + j) * 0.041f % 1f; diff --git a/Tiles/Abyss/AbyssFossilTile.png b/Tiles/Abyss/AbyssFossilTile.png index a9ba92d6d7..655ce95bcb 100644 Binary files a/Tiles/Abyss/AbyssFossilTile.png and b/Tiles/Abyss/AbyssFossilTile.png differ diff --git a/Tiles/Abyss/AbyssGravel.cs b/Tiles/Abyss/AbyssGravel.cs index 6ccd8239af..1754b7fc58 100644 --- a/Tiles/Abyss/AbyssGravel.cs +++ b/Tiles/Abyss/AbyssGravel.cs @@ -1,4 +1,5 @@ -using CalamityMod.Tiles.Abyss.AbyssAmbient; +using System.Collections.Generic; +using CalamityMod.Tiles.Abyss.AbyssAmbient; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -8,15 +9,14 @@ using Terraria.ModLoader; namespace CalamityMod.Tiles.Abyss { - public class AbyssGravel : ModTile + public class AbyssGravel : ModTile, IMergeableTile { int animationFrameWidth = 234; - public byte[,] tileAdjacency; - public byte[,] secondTileAdjacency; - public static readonly SoundStyle MineSound = new("CalamityMod/Sounds/Custom/AbyssGravelMine", 3); + List IMergeableTile.TileAdjacencies { get; } = []; + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; @@ -31,8 +31,8 @@ namespace CalamityMod.Tiles.Abyss HitSound = MineSound; DustType = 33; - TileFraming.SetUpUniversalMerge(Type, TileID.Dirt, out tileAdjacency); - TileFraming.SetUpUniversalMerge(Type, TileID.Stone, out secondTileAdjacency); + this.RegisterUniversalMerge(TileID.Dirt, "CalamityMod/Tiles/Merges/DirtMerge"); + this.RegisterUniversalMerge(TileID.Stone, "CalamityMod/Tiles/Merges/StoneMerge"); } public override bool CanExplode(int i, int j) @@ -44,7 +44,7 @@ namespace CalamityMod.Tiles.Abyss { num = fail ? 1 : 3; } - + public override void RandomUpdate(int i, int j) { Tile tile = Main.tile[i, j]; @@ -62,7 +62,7 @@ namespace CalamityMod.Tiles.Abyss up.TileFrameX = (short)(WorldGen.genRand.Next(16) * 18); WorldGen.SquareTileFrame(i, j - 1, true); - if (Main.netMode == NetmodeID.Server) + if (Main.netMode == NetmodeID.Server) NetMessage.SendTileSquare(-1, i, j - 1, 3, TileChangeType.None); } } @@ -157,18 +157,5 @@ namespace CalamityMod.Tiles.Abyss } frameXOffset = uniqueAnimationFrameX * animationFrameWidth; } - - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) - { - TileFraming.DrawUniversalMergeFrames(i, j, secondTileAdjacency, "CalamityMod/Tiles/Merges/StoneMerge"); - TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/DirtMerge"); - } - - public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) - { - TileFraming.GetAdjacencyData(i, j, TileID.Dirt, out tileAdjacency[i, j]); - TileFraming.GetAdjacencyData(i, j, TileID.Stone, out secondTileAdjacency[i, j]); - return true; - } } } diff --git a/Tiles/Abyss/AbyssTreasureChest.cs b/Tiles/Abyss/AbyssTreasureChest.cs index eed55a4907..fe8012ffbb 100644 --- a/Tiles/Abyss/AbyssTreasureChest.cs +++ b/Tiles/Abyss/AbyssTreasureChest.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.Abyss { public class AbyssTreasureChest : ModTile { - public override void SetStaticDefaults() + public override void SetStaticDefaults() { this.SetUpChest(ModContent.ItemType()); AddMapEntry(new Color(71, 49, 41), CalamityUtils.GetItemName(), CalamityUtils.GetMapChestName); @@ -32,16 +32,16 @@ namespace CalamityMod.Tiles.Abyss return World.Abyss.UnlockChests || NPC.downedBoss3; } - public override bool RightClick(int i, int j) + public override bool RightClick(int i, int j) { Tile tile = Main.tile[i, j]; int left = i; int top = j; - if (tile.TileFrameX % 36 != 0) + if (tile.TileFrameX % 36 != 0) left--; - if (tile.TileFrameY != 0) + if (tile.TileFrameY != 0) top--; return CalamityUtils.LockedChestRightClick(IsLockedChest(left, top), left, top, i, j); diff --git a/Tiles/Abyss/AcidWoodTree.cs b/Tiles/Abyss/AcidWoodTree.cs index ac5dfd2373..63a8139aba 100644 --- a/Tiles/Abyss/AcidWoodTree.cs +++ b/Tiles/Abyss/AcidWoodTree.cs @@ -7,8 +7,8 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; using Terraria; -using Terraria.Enums; using Terraria.DataStructures; +using Terraria.Enums; using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; @@ -40,7 +40,7 @@ namespace CalamityMod.Tiles.Abyss public override Asset GetOasisTopTextures() => ModContent.Request("CalamityMod/Tiles/Abyss/AcidWoodTreeOasisTops"); public override int DropWood() => ModContent.ItemType(); - public override int CreateDust() => (int)CalamityDusts.SulfurousSeaAcid; + public override int CreateDust() => (int)CalamityDusts.SulphurousSeaAcid; public override int SaplingGrowthType(ref int style) { @@ -48,73 +48,73 @@ namespace CalamityMod.Tiles.Abyss return ModContent.TileType(); } - public override int TreeLeaf() => ModContent.GoreType(); + public override int TreeLeaf() => ModContent.GoreType(); - // Returning false at the end prevents vanilla behavior as the default is palm tree behavior which can include undesirable stuff like seagulls - public override bool Shake(int x, int y, ref bool createLeaves) - { - int randAmt = Main.rand.Next(1, 3); - - if (Main.getGoodWorld && Main.rand.NextBool(15)) - { - Projectile.NewProjectile(new EntitySource_ShakeTree(x, y), x * 16, y * 16, Main.rand.NextFloat(-100f, 100f) * 0.002f, 0f, ProjectileID.Bomb, 0, 0f, Player.FindClosest(new Vector2(x * 16, y * 16), 16, 16)); - } - else if (Main.rand.NextBool(35) && Main.halloween) - { - createLeaves = true; - Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), x * 16, y * 16, 16, 16, ItemID.RottenEgg, randAmt); - } - else if (Main.rand.NextBool(12)) - { - createLeaves = true; - Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), x * 16, y * 16, 16, 16, DropWood(), Main.rand.Next(1, 4)); - } - else if (Main.rand.NextBool(20)) - { - createLeaves = true; - int coin = ItemID.CopperCoin; - int amount = Main.rand.Next(50, 100); - if (Main.rand.NextBool(30)) - { - coin = ItemID.GoldCoin; - amount = 1; - if (Main.rand.NextBool(5)) - amount++; + // Returning false at the end prevents vanilla behavior as the default is palm tree behavior which can include undesirable stuff like seagulls + public override bool Shake(int x, int y, ref bool createLeaves) + { + int randAmt = Main.rand.Next(1, 3); - if (Main.rand.NextBool(10)) - amount++; - } - else if (Main.rand.NextBool(10)) - { - coin = ItemID.SilverCoin; - amount = Main.rand.Next(1, 21); - if (Main.rand.NextBool(3)) - amount += Main.rand.Next(1, 21); + if (Main.getGoodWorld && Main.rand.NextBool(15)) + { + Projectile.NewProjectile(new EntitySource_ShakeTree(x, y), x * 16, y * 16, Main.rand.NextFloat(-100f, 100f) * 0.002f, 0f, ProjectileID.Bomb, 0, 0f, Player.FindClosest(new Vector2(x * 16, y * 16), 16, 16)); + } + else if (Main.rand.NextBool(35) && Main.halloween) + { + createLeaves = true; + Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), x * 16, y * 16, 16, 16, ItemID.RottenEgg, randAmt); + } + else if (Main.rand.NextBool(12)) + { + createLeaves = true; + Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), x * 16, y * 16, 16, 16, DropWood(), Main.rand.Next(1, 4)); + } + else if (Main.rand.NextBool(20)) + { + createLeaves = true; + int coin = ItemID.CopperCoin; + int amount = Main.rand.Next(50, 100); + if (Main.rand.NextBool(30)) + { + coin = ItemID.GoldCoin; + amount = 1; + if (Main.rand.NextBool(5)) + amount++; - if (Main.rand.NextBool(4)) - amount += Main.rand.Next(1, 21); - } + if (Main.rand.NextBool(10)) + amount++; + } + else if (Main.rand.NextBool(10)) + { + coin = ItemID.SilverCoin; + amount = Main.rand.Next(1, 21); + if (Main.rand.NextBool(3)) + amount += Main.rand.Next(1, 21); - Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), x * 16, y * 16, 16, 16, coin, amount); - } - else if (Main.rand.NextBool(20)) - { - createLeaves = true; - int type = ModContent.NPCType(); - NPC.NewNPC(new EntitySource_ShakeTree(x, y), x * 16, y * 16, type); - } - else if (Main.rand.NextBool(15)) - { - createLeaves = true; - int type = -1; - if (DownedBossSystem.downedEoCAcidRain) - type = ModContent.ItemType(); - if (DownedBossSystem.downedAquaticScourgeAcidRain && Main.rand.NextBool()) - type = ModContent.ItemType(); - if (type != -1) - Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), new Vector2(x, y) * 16, type, randAmt); - } - return false; - } + if (Main.rand.NextBool(4)) + amount += Main.rand.Next(1, 21); + } + + Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), x * 16, y * 16, 16, 16, coin, amount); + } + else if (Main.rand.NextBool(20)) + { + createLeaves = true; + int type = ModContent.NPCType(); + NPC.NewNPC(new EntitySource_ShakeTree(x, y), x * 16, y * 16, type); + } + else if (Main.rand.NextBool(15)) + { + createLeaves = true; + int type = -1; + if (DownedBossSystem.downedEoCAcidRain) + type = ModContent.ItemType(); + if (DownedBossSystem.downedAquaticScourgeAcidRain && Main.rand.NextBool()) + type = ModContent.ItemType(); + if (type != -1) + Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), new Vector2(x, y) * 16, type, randAmt); + } + return false; + } } } diff --git a/Tiles/Abyss/AcidWoodTreeSapling.cs b/Tiles/Abyss/AcidWoodTreeSapling.cs index 857c3ca783..28be3ad585 100644 --- a/Tiles/Abyss/AcidWoodTreeSapling.cs +++ b/Tiles/Abyss/AcidWoodTreeSapling.cs @@ -1,7 +1,7 @@ -using CalamityMod.Dusts; +using System; +using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.DataStructures; using Terraria.Enums; @@ -25,8 +25,8 @@ namespace CalamityMod.Tiles.Abyss Main.tileLavaDeath[Type] = true; TileID.Sets.CommonSapling[Type] = true; TileID.Sets.TreeSapling[Type] = true; - TileID.Sets.SwaysInWindBasic[Type] = true; - TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Plant"]); + TileID.Sets.SwaysInWindBasic[Type] = true; + TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Plant"]); TileObjectData.newTile.Width = 1; TileObjectData.newTile.Height = 2; TileObjectData.newTile.Origin = new Point16(0, 1); @@ -43,7 +43,7 @@ namespace CalamityMod.Tiles.Abyss TileObjectData.newTile.RandomStyleRange = 3; TileObjectData.addTile(Type); AddMapEntry(new Color(113, 90, 71), Language.GetText("MapObject.Sapling")); - DustType = (int)CalamityDusts.SulfurousSeaAcid; + DustType = (int)CalamityDusts.SulphurousSeaAcid; AdjTiles = new int[] { TileID.Saplings }; } @@ -101,7 +101,7 @@ namespace CalamityMod.Tiles.Abyss if (frameY != frameYIdeal) { float heightRatio = k / (float)treeHeight; - bool increaseFrameY = heightRatio >= 0.25f && ((heightRatio < 0.5f && WorldGen.genRand.Next(13) == 0) || (heightRatio < 0.7f && WorldGen.genRand.NextBool(9)) || heightRatio >= 0.95f || WorldGen.genRand.Next(5) != 0 || true); + bool increaseFrameY = heightRatio >= 0.25f && ((heightRatio < 0.5f && WorldGen.genRand.NextBool(13)) || (heightRatio < 0.7f && WorldGen.genRand.NextBool(9)) || heightRatio >= 0.95f || WorldGen.genRand.Next(5) != 0 || true); if (increaseFrameY) frameY += (short)(Math.Sign(frameYIdeal) * 2); } diff --git a/Tiles/Abyss/AcidwoodTile.cs b/Tiles/Abyss/AcidwoodTile.cs index a43e13f96b..eb33744e0a 100644 --- a/Tiles/Abyss/AcidwoodTile.cs +++ b/Tiles/Abyss/AcidwoodTile.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Tiles.Abyss public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 7, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.WoodFurniture, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/Abyss/HardenedSulphurousSandstone.cs b/Tiles/Abyss/HardenedSulphurousSandstone.cs index c8becd91c8..e7f7eeb788 100644 --- a/Tiles/Abyss/HardenedSulphurousSandstone.cs +++ b/Tiles/Abyss/HardenedSulphurousSandstone.cs @@ -1,4 +1,5 @@ -using CalamityMod.World; +using System.Collections.Generic; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -7,11 +8,9 @@ using Terraria.ModLoader; namespace CalamityMod.Tiles.Abyss { - public class HardenedSulphurousSandstone : ModTile + public class HardenedSulphurousSandstone : ModTile, IMergeableTile { - public byte[,] tileAdjacency; - public byte[,] secondTileAdjacency; - public byte[,] thirdTileAdjacency; + List IMergeableTile.TileAdjacencies { get; } = []; public override void SetStaticDefaults() { @@ -24,9 +23,9 @@ namespace CalamityMod.Tiles.Abyss DustType = 32; AddMapEntry(new Color(76, 58, 59)); HitSound = SoundID.Dig; - TileFraming.SetUpUniversalMerge(Type, TileID.Dirt, out tileAdjacency); - TileFraming.SetUpUniversalMerge(Type, TileID.Stone, out secondTileAdjacency); - TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out thirdTileAdjacency); + this.RegisterUniversalMerge(TileID.Dirt, "CalamityMod/Tiles/Merges/DirtMerge"); + this.RegisterUniversalMerge(TileID.Stone, "CalamityMod/Tiles/Merges/StoneMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/SulphurousShaleMerge"); } public override void NumDust(int i, int j, bool fail, ref int num) @@ -43,21 +42,6 @@ namespace CalamityMod.Tiles.Abyss } } - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) - { - TileFraming.DrawUniversalMergeFrames(i, j, thirdTileAdjacency, "CalamityMod/Tiles/Merges/SulphurousShaleMerge"); - TileFraming.DrawUniversalMergeFrames(i, j, secondTileAdjacency, "CalamityMod/Tiles/Merges/StoneMerge"); - TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/DirtMerge"); - } - - public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) - { - TileFraming.GetAdjacencyData(i, j, TileID.Dirt, out tileAdjacency[i, j]); - TileFraming.GetAdjacencyData(i, j, TileID.Stone, out secondTileAdjacency[i, j]); - TileFraming.GetAdjacencyData(i, j, ModContent.TileType(), out thirdTileAdjacency[i, j]); - return true; - } - public override void RandomUpdate(int i, int j) { int vineLength = WorldGen.genRand.Next((int)Main.rockLayer, (int)(Main.rockLayer + (double)Main.maxTilesY * 0.143)); diff --git a/Tiles/Abyss/HydrothermalCrateTile.cs b/Tiles/Abyss/HydrothermalCrateTile.cs new file mode 100644 index 0000000000..adcc4b8153 --- /dev/null +++ b/Tiles/Abyss/HydrothermalCrateTile.cs @@ -0,0 +1,42 @@ +using CalamityMod.Items.Fishing.SulphurCatches; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Abyss +{ + public class HydrothermalCrateTile : ModTile + { + public override void SetStaticDefaults() + { + Main.tileSolidTop[Type] = true; + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileTable[Type] = true; + Main.tileLavaDeath[Type] = true; + Main.tileWaterDeath[Type] = false; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.addTile(Type); + AddMapEntry(new Color(150, 109, 26), CalamityUtils.GetItemName()); + DustType = 127; + } + + public override bool CreateDust(int i, int j, ref int type) + { + if (Main.rand.NextBool()) + type = 44; + else + type = 127; + + return true; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } +} diff --git a/Tiles/Abyss/HydrothermalCrateTile.png b/Tiles/Abyss/HydrothermalCrateTile.png new file mode 100644 index 0000000000..3cadf65ba9 Binary files /dev/null and b/Tiles/Abyss/HydrothermalCrateTile.png differ diff --git a/Tiles/Abyss/LumenylCrystals.cs b/Tiles/Abyss/LumenylCrystals.cs index 2dc171ddb0..1564a8e581 100644 --- a/Tiles/Abyss/LumenylCrystals.cs +++ b/Tiles/Abyss/LumenylCrystals.cs @@ -65,7 +65,7 @@ namespace CalamityMod.Tiles.Abyss Main.tile[i, j].TileFrameY = 36; else if (leftTile.Slope == SlopeType.Solid && !leftTile.IsHalfBlock && leftTile.HasTile && leftTile.IsTileSolid()) Main.tile[i, j].TileFrameY = 54; - + Main.tile[i, j].TileFrameX = (short)(WorldGen.genRand.Next(18) * 18); } } diff --git a/Tiles/Abyss/PlantyMush.cs b/Tiles/Abyss/PlantyMush.cs index ee518f5266..f80d61113a 100644 --- a/Tiles/Abyss/PlantyMush.cs +++ b/Tiles/Abyss/PlantyMush.cs @@ -1,9 +1,11 @@ -using CalamityMod.Tiles.Abyss.AbyssAmbient; +using System.Collections.Generic; +using CalamityMod.Tiles.Abyss.AbyssAmbient; using CalamityMod.Walls; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; +using Terraria.GameContent.Metadata; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -12,19 +14,18 @@ namespace CalamityMod.Tiles.Abyss { // Transforms any and all Tenebris in old worlds into planty mush. [LegacyName("Tenebris")] - public class PlantyMush : ModTile + public class PlantyMush : ModTile, IMergeableTile { public static readonly SoundStyle MineSound = new("CalamityMod/Sounds/Custom/PlantyMushMine", 3); - - public byte[,] tileAdjacency; - public byte[,] secondTileAdjacency; - public byte[,] thirdTileAdjacency; + + List IMergeableTile.TileAdjacencies { get; } = []; public override void SetStaticDefaults() { Main.tileSolid[Type] = true; Main.tileMergeDirt[Type] = true; Main.tileBlockLight[Type] = true; + TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Organic"]); CalamityUtils.MergeWithGeneral(Type); CalamityUtils.MergeWithAbyss(Type); @@ -33,11 +34,11 @@ namespace CalamityMod.Tiles.Abyss AddMapEntry(new Color(84, 102, 39), CalamityUtils.GetItemName()); HitSound = MineSound; - TileFraming.SetUpUniversalMerge(Type, TileID.Dirt, out tileAdjacency); - TileFraming.SetUpUniversalMerge(Type, TileID.Stone, out secondTileAdjacency); - TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out thirdTileAdjacency); + this.RegisterUniversalMerge(TileID.Dirt, "CalamityMod/Tiles/Merges/DirtMerge"); + this.RegisterUniversalMerge(TileID.Stone, "CalamityMod/Tiles/Merges/StoneMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/AbyssGravelMerge"); } - + int animationFrameWidth = 234; public override bool CanExplode(int i, int j) @@ -49,7 +50,7 @@ namespace CalamityMod.Tiles.Abyss { num = fail ? 1 : 3; } - + public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) { int uniqueAnimationFrameX = 0; @@ -148,7 +149,7 @@ namespace CalamityMod.Tiles.Abyss Tile up2 = Main.tile[i, j - 2]; // Place kelp - if (WorldGen.genRand.Next(5) == 0 && !up.HasTile && !up2.HasTile && up.LiquidAmount > 0 && up2.LiquidAmount > 0 && !tile.LeftSlope && !tile.RightSlope && !tile.IsHalfBlock) + if (WorldGen.genRand.NextBool(5)&& !up.HasTile && !up2.HasTile && up.LiquidAmount > 0 && up2.LiquidAmount > 0 && !tile.LeftSlope && !tile.RightSlope && !tile.IsHalfBlock) { up.TileType = (ushort)ModContent.TileType(); up.HasTile = true; @@ -158,7 +159,7 @@ namespace CalamityMod.Tiles.Abyss up.TileFrameX = (short)(WorldGen.genRand.Next(7) * 18); WorldGen.SquareTileFrame(i, j - 1, true); - if (Main.netMode == NetmodeID.Server) + if (Main.netMode == NetmodeID.Server) NetMessage.SendTileSquare(-1, i, j - 1, 3, TileChangeType.None); } @@ -199,20 +200,5 @@ namespace CalamityMod.Tiles.Abyss } } } - - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) - { - TileFraming.DrawUniversalMergeFrames(i, j, thirdTileAdjacency, "CalamityMod/Tiles/Merges/AbyssGravelMerge"); - TileFraming.DrawUniversalMergeFrames(i, j, secondTileAdjacency, "CalamityMod/Tiles/Merges/StoneMerge"); - TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/DirtMerge"); - } - - public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) - { - TileFraming.GetAdjacencyData(i, j, TileID.Dirt, out tileAdjacency[i, j]); - TileFraming.GetAdjacencyData(i, j, TileID.Stone, out secondTileAdjacency[i, j]); - TileFraming.GetAdjacencyData(i, j, ModContent.TileType(), out thirdTileAdjacency[i, j]); - return true; - } } } diff --git a/Tiles/Abyss/PyreMantle.cs b/Tiles/Abyss/PyreMantle.cs index a3df366ac5..12d1cd6f9c 100644 --- a/Tiles/Abyss/PyreMantle.cs +++ b/Tiles/Abyss/PyreMantle.cs @@ -1,22 +1,21 @@ -using CalamityMod.Tiles.Abyss.AbyssAmbient; +using System; +using System.Collections.Generic; +using CalamityMod.Tiles.Abyss.AbyssAmbient; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; -using Terraria.Audio; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.Abyss { - public class PyreMantle : ModTile + public class PyreMantle : ModTile, IMergeableTile { public static readonly SoundStyle MineSound = new("CalamityMod/Sounds/Custom/VoidstoneMine", 3) { Volume = 0.4f }; - public byte[,] tileAdjacency; - public byte[,] secondTileAdjacency; - public byte[,] thirdTileAdjacency; + List IMergeableTile.TileAdjacencies { get; } = []; public override void SetStaticDefaults() { @@ -33,14 +32,14 @@ namespace CalamityMod.Tiles.Abyss MinPick = 180; AddMapEntry(new Color(19, 20, 32)); - TileFraming.SetUpUniversalMerge(Type, TileID.Dirt, out tileAdjacency); - TileFraming.SetUpUniversalMerge(Type, TileID.Stone, out secondTileAdjacency); - TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out thirdTileAdjacency); + this.RegisterUniversalMerge(TileID.Dirt, "CalamityMod/Tiles/Merges/DirtMerge"); + this.RegisterUniversalMerge(TileID.Stone, "CalamityMod/Tiles/Merges/StoneMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/AbyssGravelMerge"); } public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 162, 0f, 0f, 1, new Color(128, 128, 128), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.HeatRay, 0f, 0f, 1, new Color(128, 128, 128), 1f); return false; } @@ -70,20 +69,5 @@ namespace CalamityMod.Tiles.Abyss NetMessage.SendTileSquare(-1, i, j - 1, 3, TileChangeType.None); } } - - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) - { - TileFraming.DrawUniversalMergeFrames(i, j, thirdTileAdjacency, "CalamityMod/Tiles/Merges/AbyssGravelMerge"); - TileFraming.DrawUniversalMergeFrames(i, j, secondTileAdjacency, "CalamityMod/Tiles/Merges/StoneMerge"); - TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/DirtMerge"); - } - - public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) - { - TileFraming.GetAdjacencyData(i, j, TileID.Dirt, out tileAdjacency[i, j]); - TileFraming.GetAdjacencyData(i, j, TileID.Stone, out secondTileAdjacency[i, j]); - TileFraming.GetAdjacencyData(i, j, ModContent.TileType(), out thirdTileAdjacency[i, j]); - return true; - } } } diff --git a/Tiles/Abyss/PyreMantleMolten.cs b/Tiles/Abyss/PyreMantleMolten.cs index 40e3442455..74c659b73f 100644 --- a/Tiles/Abyss/PyreMantleMolten.cs +++ b/Tiles/Abyss/PyreMantleMolten.cs @@ -1,24 +1,22 @@ -using CalamityMod.Tiles.Abyss.AbyssAmbient; +using System; +using System.Collections.Generic; +using CalamityMod.Tiles.Abyss.AbyssAmbient; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; -using Terraria.Audio; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.Abyss { - public class PyreMantleMolten : ModTile + public class PyreMantleMolten : ModTile, IMergeableTile { public static readonly SoundStyle MineSound = new("CalamityMod/Sounds/Custom/VoidstoneMine", 3) { Volume = 0.4f }; internal static Texture2D GlowTexture; - public byte[,] tileAdjacency; - public byte[,] secondTileAdjacency; - public byte[,] thirdTileAdjacency; - public byte[,] fourthTileAdjacency; + List IMergeableTile.TileAdjacencies { get; } = []; public override void SetStaticDefaults() { @@ -39,15 +37,15 @@ namespace CalamityMod.Tiles.Abyss MinPick = 180; AddMapEntry(new Color(113, 49, 16)); - TileFraming.SetUpUniversalMerge(Type, TileID.Dirt, out tileAdjacency); - TileFraming.SetUpUniversalMerge(Type, TileID.Stone, out secondTileAdjacency); - TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out thirdTileAdjacency); - TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out fourthTileAdjacency); + this.RegisterUniversalMerge(TileID.Dirt, "CalamityMod/Tiles/Merges/DirtMerge"); + this.RegisterUniversalMerge(TileID.Stone, "CalamityMod/Tiles/Merges/StoneMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/AbyssGravelMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/PyreMantleMerge"); } public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 162, 0f, 0f, 1, new Color(128, 128, 128), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.HeatRay, 0f, 0f, 1, new Color(128, 128, 128), 1f); return false; } @@ -73,7 +71,7 @@ namespace CalamityMod.Tiles.Abyss up.TileFrameX = (short)(WorldGen.genRand.Next(16) * 18); WorldGen.SquareTileFrame(i, j - 1, true); - if (Main.netMode == NetmodeID.Server) + if (Main.netMode == NetmodeID.Server) NetMessage.SendTileSquare(-1, i, j - 1, 3, TileChangeType.None); } } @@ -97,11 +95,6 @@ namespace CalamityMod.Tiles.Abyss TileFraming.SlopedGlowmask(i, j, 0, GlowTexture, drawOffset, null, GetDrawColour(i, j, drawColour), default); glowbrightness += 0.3f; - - TileFraming.DrawUniversalMergeFrames(i, j, fourthTileAdjacency, "CalamityMod/Tiles/Merges/PyreMantleMerge"); - TileFraming.DrawUniversalMergeFrames(i, j, thirdTileAdjacency, "CalamityMod/Tiles/Merges/AbyssGravelMerge"); - TileFraming.DrawUniversalMergeFrames(i, j, secondTileAdjacency, "CalamityMod/Tiles/Merges/StoneMerge"); - TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/DirtMerge"); } public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) @@ -118,15 +111,6 @@ namespace CalamityMod.Tiles.Abyss b *= brightness; } - public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) - { - TileFraming.GetAdjacencyData(i, j, TileID.Dirt, out tileAdjacency[i, j]); - TileFraming.GetAdjacencyData(i, j, TileID.Stone, out secondTileAdjacency[i, j]); - TileFraming.GetAdjacencyData(i, j, ModContent.TileType(), out thirdTileAdjacency[i, j]); - TileFraming.GetAdjacencyData(i, j, ModContent.TileType(), out fourthTileAdjacency[i, j]); - return true; - } - private Color GetDrawColour(int i, int j, Color colour) { int colType = Main.tile[i, j].TileColor; diff --git a/Tiles/Abyss/RustyChestTile.cs b/Tiles/Abyss/RustyChestTile.cs index 2510e040ce..3e41284181 100644 --- a/Tiles/Abyss/RustyChestTile.cs +++ b/Tiles/Abyss/RustyChestTile.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -17,7 +18,7 @@ namespace CalamityMod.Tiles.Abyss public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 180, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.DungeonSpirit, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; diff --git a/Tiles/Abyss/ShaleColumns.cs b/Tiles/Abyss/ShaleColumns.cs index b10e050b17..ef89091409 100644 --- a/Tiles/Abyss/ShaleColumns.cs +++ b/Tiles/Abyss/ShaleColumns.cs @@ -2,8 +2,8 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; -using Terraria.ID; using Terraria.Enums; +using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; diff --git a/Tiles/Abyss/Stalactite/SulphurousStalacmite1.cs b/Tiles/Abyss/Stalactite/SulphurousStalacmite1.cs index 3e55c6a312..0c4f69d871 100644 --- a/Tiles/Abyss/Stalactite/SulphurousStalacmite1.cs +++ b/Tiles/Abyss/Stalactite/SulphurousStalacmite1.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Tiles.Abyss.Stalactite TileObjectData.newTile.DrawYOffset = 2; TileObjectData.addTile(Type); AddMapEntry(new Color(57, 48, 83), CalamityUtils.GetText("Tiles.Stalagmite")); - DustType = (int)CalamityDusts.SulfurousSeaAcid; + DustType = (int)CalamityDusts.SulphurousSeaAcid; base.SetStaticDefaults(); } diff --git a/Tiles/Abyss/Stalactite/SulphurousStalacmite2.cs b/Tiles/Abyss/Stalactite/SulphurousStalacmite2.cs index 17250ef061..a2a361ac51 100644 --- a/Tiles/Abyss/Stalactite/SulphurousStalacmite2.cs +++ b/Tiles/Abyss/Stalactite/SulphurousStalacmite2.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Tiles.Abyss.Stalactite TileObjectData.newTile.DrawYOffset = 2; TileObjectData.addTile(Type); AddMapEntry(new Color(57, 48, 83), CalamityUtils.GetText("Tiles.Stalagmite")); - DustType = (int)CalamityDusts.SulfurousSeaAcid; + DustType = (int)CalamityDusts.SulphurousSeaAcid; base.SetStaticDefaults(); } diff --git a/Tiles/Abyss/Stalactite/SulphurousStalacmite3.cs b/Tiles/Abyss/Stalactite/SulphurousStalacmite3.cs index 2206c276b6..87addf50b4 100644 --- a/Tiles/Abyss/Stalactite/SulphurousStalacmite3.cs +++ b/Tiles/Abyss/Stalactite/SulphurousStalacmite3.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Tiles.Abyss.Stalactite TileObjectData.newTile.DrawYOffset = 2; TileObjectData.addTile(Type); AddMapEntry(new Color(57, 48, 83), CalamityUtils.GetText("Tiles.Stalagmite")); - DustType = (int)CalamityDusts.SulfurousSeaAcid; + DustType = (int)CalamityDusts.SulphurousSeaAcid; base.SetStaticDefaults(); } diff --git a/Tiles/Abyss/Stalactite/SulphurousStalacmite4.cs b/Tiles/Abyss/Stalactite/SulphurousStalacmite4.cs index 92356a83fc..463c0e2b83 100644 --- a/Tiles/Abyss/Stalactite/SulphurousStalacmite4.cs +++ b/Tiles/Abyss/Stalactite/SulphurousStalacmite4.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Tiles.Abyss.Stalactite TileObjectData.newTile.DrawYOffset = 2; TileObjectData.addTile(Type); AddMapEntry(new Color(57, 48, 83), CalamityUtils.GetText("Tiles.Stalagmite")); - DustType = (int)CalamityDusts.SulfurousSeaAcid; + DustType = (int)CalamityDusts.SulphurousSeaAcid; base.SetStaticDefaults(); } diff --git a/Tiles/Abyss/Stalactite/SulphurousStalacmite5.cs b/Tiles/Abyss/Stalactite/SulphurousStalacmite5.cs index 3e5f0d9d39..ecd1de42a8 100644 --- a/Tiles/Abyss/Stalactite/SulphurousStalacmite5.cs +++ b/Tiles/Abyss/Stalactite/SulphurousStalacmite5.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Tiles.Abyss.Stalactite TileObjectData.newTile.DrawYOffset = 2; TileObjectData.addTile(Type); AddMapEntry(new Color(57, 48, 83), CalamityUtils.GetText("Tiles.Stalagmite")); - DustType = (int)CalamityDusts.SulfurousSeaAcid; + DustType = (int)CalamityDusts.SulphurousSeaAcid; base.SetStaticDefaults(); } diff --git a/Tiles/Abyss/Stalactite/SulphurousStalacmite6.cs b/Tiles/Abyss/Stalactite/SulphurousStalacmite6.cs index d467578e3e..9c38460fb0 100644 --- a/Tiles/Abyss/Stalactite/SulphurousStalacmite6.cs +++ b/Tiles/Abyss/Stalactite/SulphurousStalacmite6.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Tiles.Abyss.Stalactite TileObjectData.newTile.DrawYOffset = 2; TileObjectData.addTile(Type); AddMapEntry(new Color(57, 48, 83), CalamityUtils.GetText("Tiles.Stalagmite")); - DustType = (int)CalamityDusts.SulfurousSeaAcid; + DustType = (int)CalamityDusts.SulphurousSeaAcid; base.SetStaticDefaults(); } diff --git a/Tiles/Abyss/Stalactite/SulphurousStalactite1.cs b/Tiles/Abyss/Stalactite/SulphurousStalactite1.cs index c3246db0b5..8b630e7c01 100644 --- a/Tiles/Abyss/Stalactite/SulphurousStalactite1.cs +++ b/Tiles/Abyss/Stalactite/SulphurousStalactite1.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Tiles.Abyss.Stalactite TileObjectData.newTile.DrawYOffset = -2; TileObjectData.addTile(Type); AddMapEntry(new Color(57, 48, 83), CalamityUtils.GetText("Tiles.Stalactite")); - DustType = (int)CalamityDusts.SulfurousSeaAcid; + DustType = (int)CalamityDusts.SulphurousSeaAcid; base.SetStaticDefaults(); } diff --git a/Tiles/Abyss/Stalactite/SulphurousStalactite2.cs b/Tiles/Abyss/Stalactite/SulphurousStalactite2.cs index 05366878fd..49a6a89b6d 100644 --- a/Tiles/Abyss/Stalactite/SulphurousStalactite2.cs +++ b/Tiles/Abyss/Stalactite/SulphurousStalactite2.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Tiles.Abyss.Stalactite TileObjectData.newTile.DrawYOffset = -2; TileObjectData.addTile(Type); AddMapEntry(new Color(57, 48, 83), CalamityUtils.GetText("Tiles.Stalactite")); - DustType = (int)CalamityDusts.SulfurousSeaAcid; + DustType = (int)CalamityDusts.SulphurousSeaAcid; base.SetStaticDefaults(); } diff --git a/Tiles/Abyss/Stalactite/SulphurousStalactite3.cs b/Tiles/Abyss/Stalactite/SulphurousStalactite3.cs index 06638c61ed..8edf183ac8 100644 --- a/Tiles/Abyss/Stalactite/SulphurousStalactite3.cs +++ b/Tiles/Abyss/Stalactite/SulphurousStalactite3.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Tiles.Abyss.Stalactite TileObjectData.newTile.DrawYOffset = -2; TileObjectData.addTile(Type); AddMapEntry(new Color(57, 48, 83), CalamityUtils.GetText("Tiles.Stalactite")); - DustType = (int)CalamityDusts.SulfurousSeaAcid; + DustType = (int)CalamityDusts.SulphurousSeaAcid; base.SetStaticDefaults(); } diff --git a/Tiles/Abyss/Stalactite/SulphurousStalactite4.cs b/Tiles/Abyss/Stalactite/SulphurousStalactite4.cs index 249abd82dd..b4d01dbf91 100644 --- a/Tiles/Abyss/Stalactite/SulphurousStalactite4.cs +++ b/Tiles/Abyss/Stalactite/SulphurousStalactite4.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Tiles.Abyss.Stalactite TileObjectData.newTile.DrawYOffset = -2; TileObjectData.addTile(Type); AddMapEntry(new Color(57, 48, 83), CalamityUtils.GetText("Tiles.Stalactite")); - DustType = (int)CalamityDusts.SulfurousSeaAcid; + DustType = (int)CalamityDusts.SulphurousSeaAcid; base.SetStaticDefaults(); } diff --git a/Tiles/Abyss/Stalactite/SulphurousStalactite5.cs b/Tiles/Abyss/Stalactite/SulphurousStalactite5.cs index a9429a65d1..d2c8fc9e86 100644 --- a/Tiles/Abyss/Stalactite/SulphurousStalactite5.cs +++ b/Tiles/Abyss/Stalactite/SulphurousStalactite5.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Tiles.Abyss.Stalactite TileObjectData.newTile.DrawYOffset = -2; TileObjectData.addTile(Type); AddMapEntry(new Color(57, 48, 83), CalamityUtils.GetText("Tiles.Stalactite")); - DustType = (int)CalamityDusts.SulfurousSeaAcid; + DustType = (int)CalamityDusts.SulphurousSeaAcid; base.SetStaticDefaults(); } diff --git a/Tiles/Abyss/Stalactite/SulphurousStalactite6.cs b/Tiles/Abyss/Stalactite/SulphurousStalactite6.cs index 5f815d68eb..7d8e5cb4a1 100644 --- a/Tiles/Abyss/Stalactite/SulphurousStalactite6.cs +++ b/Tiles/Abyss/Stalactite/SulphurousStalactite6.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Tiles.Abyss.Stalactite TileObjectData.newTile.DrawYOffset = -2; TileObjectData.addTile(Type); AddMapEntry(new Color(57, 48, 83), CalamityUtils.GetText("Tiles.Stalactite")); - DustType = (int)CalamityDusts.SulfurousSeaAcid; + DustType = (int)CalamityDusts.SulphurousSeaAcid; base.SetStaticDefaults(); } diff --git a/Tiles/Abyss/SteamGeyser.cs b/Tiles/Abyss/SteamGeyser.cs index c745770cd0..7056860026 100644 --- a/Tiles/Abyss/SteamGeyser.cs +++ b/Tiles/Abyss/SteamGeyser.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Tiles.Abyss TileObjectData.newTile.DrawYOffset = 2; TileObjectData.addTile(Type); AddMapEntry(new Color(103, 65, 64), CalamityUtils.GetText($"{LocalizationCategory}.SteamGeyser.MapEntry")); - DustType = (int)CalamityDusts.SulfurousSeaAcid; + DustType = (int)CalamityDusts.SulphurousSeaAcid; base.SetStaticDefaults(); } @@ -51,7 +51,7 @@ namespace CalamityMod.Tiles.Abyss { Tile t = CalamityUtils.ParanoidTileRetrieval(i, j); Vector2 spawnPosition = new(i * 16f + 24f, j * 16f - 4f); - + if (!Main.gamePaused && t.TileFrameX % 36 == 0 && t.TileFrameY % 36 == 0 && Collision.CanHitLine(spawnPosition, 1, 1, spawnPosition - Vector2.UnitY * 100f, 1, 1)) { float positionInterpolant = (i + j) * 0.041f % 1f; diff --git a/Tiles/Abyss/SulphuricFossil1.cs b/Tiles/Abyss/SulphuricFossil1.cs index 8127de7c3e..b6402192ed 100644 --- a/Tiles/Abyss/SulphuricFossil1.cs +++ b/Tiles/Abyss/SulphuricFossil1.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Tiles.Abyss TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); TileObjectData.addTile(Type); AddMapEntry(new Color(113, 90, 71), CalamityUtils.GetText("Tiles.Fossil")); - DustType = (int)CalamityDusts.SulfurousSeaAcid; + DustType = (int)CalamityDusts.SulphurousSeaAcid; } public override void NumDust(int i, int j, bool fail, ref int num) diff --git a/Tiles/Abyss/SulphuricFossil2.cs b/Tiles/Abyss/SulphuricFossil2.cs index cd51ecea70..76fbe34ff3 100644 --- a/Tiles/Abyss/SulphuricFossil2.cs +++ b/Tiles/Abyss/SulphuricFossil2.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Tiles.Abyss TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); TileObjectData.addTile(Type); AddMapEntry(new Color(113, 90, 71), CalamityUtils.GetText("Tiles.Fossil")); - DustType = (int)CalamityDusts.SulfurousSeaAcid; + DustType = (int)CalamityDusts.SulphurousSeaAcid; } public override void NumDust(int i, int j, bool fail, ref int num) diff --git a/Tiles/Abyss/SulphuricFossil3.cs b/Tiles/Abyss/SulphuricFossil3.cs index 60af8739cd..b3d35bcf97 100644 --- a/Tiles/Abyss/SulphuricFossil3.cs +++ b/Tiles/Abyss/SulphuricFossil3.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Tiles.Abyss TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); TileObjectData.addTile(Type); AddMapEntry(new Color(113, 90, 71), CalamityUtils.GetText("Tiles.Fossil")); - DustType = (int)CalamityDusts.SulfurousSeaAcid; + DustType = (int)CalamityDusts.SulphurousSeaAcid; } public override void NumDust(int i, int j, bool fail, ref int num) diff --git a/Tiles/Abyss/SulphurousCactus.cs b/Tiles/Abyss/SulphurousCactus.cs index 98ad27e66f..442781bb5d 100644 --- a/Tiles/Abyss/SulphurousCactus.cs +++ b/Tiles/Abyss/SulphurousCactus.cs @@ -1,6 +1,6 @@ using Microsoft.Xna.Framework.Graphics; -using Terraria.ModLoader; using ReLogic.Content; +using Terraria.ModLoader; namespace CalamityMod.Tiles.Abyss { diff --git a/Tiles/Abyss/SulphurousColumn.cs b/Tiles/Abyss/SulphurousColumn.cs index 91e420d42f..6cd644742d 100644 --- a/Tiles/Abyss/SulphurousColumn.cs +++ b/Tiles/Abyss/SulphurousColumn.cs @@ -2,8 +2,8 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; -using Terraria.ID; using Terraria.Enums; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; @@ -35,7 +35,7 @@ namespace CalamityMod.Tiles.Abyss TileObjectData.newTile.LavaDeath = true; TileObjectData.addTile(Type); AddMapEntry(new Color(150, 100, 50), CalamityUtils.GetText("Tiles.Column")); - DustType = (int)CalamityDusts.SulfurousSeaAcid; + DustType = (int)CalamityDusts.SulphurousSeaAcid; base.SetStaticDefaults(); } diff --git a/Tiles/Abyss/SulphurousPots.cs b/Tiles/Abyss/SulphurousPots.cs index 93ebaf6056..fda78bd4ac 100644 --- a/Tiles/Abyss/SulphurousPots.cs +++ b/Tiles/Abyss/SulphurousPots.cs @@ -1,7 +1,7 @@ -using CalamityMod.Dusts; +using System.Collections.Generic; +using CalamityMod.Dusts; using CalamityMod.Items.TreasureBags.MiscGrabBags; using Microsoft.Xna.Framework; -using System.Collections.Generic; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -27,7 +27,7 @@ namespace CalamityMod.Tiles.Abyss TileObjectData.addTile(Type); AddMapEntry(new Color(226, 205, 101), Language.GetText("MapObject.Pot")); - DustType = (int)CalamityDusts.SulfurousSeaAcid; + DustType = (int)CalamityDusts.SulphurousSeaAcid; HitSound = SoundID.Shatter; } @@ -38,28 +38,28 @@ namespace CalamityMod.Tiles.Abyss if (tileAtPosition.TileFrameX % 36 == 0 && tileAtPosition.TileFrameY % 36 == 0) { if (Main.netMode != NetmodeID.Server) - { - int goreAmt = Main.rand.Next(1, 2 + 1); - for (int k = 0; k < goreAmt; k++) - { - Gore.NewGore(new EntitySource_TileBreak(i, j), new Vector2(i, j) * 16, Main.rand.NextVector2CircularEdge(3f, 3f), Mod.Find("SulphPotGore1").Type); - Gore.NewGore(new EntitySource_TileBreak(i, j), new Vector2(i, j) * 16, Main.rand.NextVector2CircularEdge(3f, 3f), Mod.Find("SulphPotGore2").Type); - } - } + { + int goreAmt = Main.rand.Next(1, 2 + 1); + for (int k = 0; k < goreAmt; k++) + { + Gore.NewGore(new EntitySource_TileBreak(i, j), new Vector2(i, j) * 16, Main.rand.NextVector2CircularEdge(3f, 3f), Mod.Find("SulphPotGore1").Type); + Gore.NewGore(new EntitySource_TileBreak(i, j), new Vector2(i, j) * 16, Main.rand.NextVector2CircularEdge(3f, 3f), Mod.Find("SulphPotGore2").Type); + } + } - // 1 in 400 for a Coin Portal - if (Player.GetClosestRollLuck(i, j, 400) == 0f) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(new EntitySource_TileBreak(i, j), i * 16 + 16, j * 16 + 16, 0f, -12f, ProjectileID.CoinPortal, 0, 0f, Main.myPlayer); - } - // Followed by a 1 in 4 for a bomb in For The Worthy worlds - else if (Main.getGoodWorld && Main.rand.Next(4) == 0) - Projectile.NewProjectile(new EntitySource_TileBreak(i, j), i * 16 + 16, j * 16 + 8, (float)Main.rand.Next(-100, 101) * 0.002f, 0f, ProjectileID.Bomb, 0, 0f, Player.FindClosest(new Vector2(i * 16, j * 16), 16, 16)); - else - yield return new Item(ModContent.ItemType()); - } - } + // 1 in 400 for a Coin Portal + if (Player.GetClosestRollLuck(i, j, 400) == 0f) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + Projectile.NewProjectile(new EntitySource_TileBreak(i, j), i * 16 + 16, j * 16 + 16, 0f, -12f, ProjectileID.CoinPortal, 0, 0f, Main.myPlayer); + } + // Followed by a 1 in 4 for a bomb in For The Worthy worlds + else if (Main.getGoodWorld && Main.rand.NextBool(4)) + Projectile.NewProjectile(new EntitySource_TileBreak(i, j), i * 16 + 16, j * 16 + 8, (float)Main.rand.Next(-100, 101) * 0.002f, 0f, ProjectileID.Bomb, 0, 0f, Player.FindClosest(new Vector2(i * 16, j * 16), 16, 16)); + else + yield return new Item(ModContent.ItemType()); + } + } public override void NumDust(int i, int j, bool fail, ref int num) { diff --git a/Tiles/Abyss/SulphurousRib1.cs b/Tiles/Abyss/SulphurousRib1.cs index 8fdfc16613..edd8db9364 100644 --- a/Tiles/Abyss/SulphurousRib1.cs +++ b/Tiles/Abyss/SulphurousRib1.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Tiles.Abyss TileObjectData.newTile.DrawYOffset = 2; TileObjectData.addTile(Type); AddMapEntry(new Color(57, 48, 83), CalamityUtils.GetText("Tiles.Ribs")); - DustType = (int)CalamityDusts.SulfurousSeaAcid; + DustType = (int)CalamityDusts.SulphurousSeaAcid; base.SetStaticDefaults(); } diff --git a/Tiles/Abyss/SulphurousRib2.cs b/Tiles/Abyss/SulphurousRib2.cs index 04811b275b..018a012236 100644 --- a/Tiles/Abyss/SulphurousRib2.cs +++ b/Tiles/Abyss/SulphurousRib2.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Tiles.Abyss TileObjectData.newTile.DrawYOffset = 2; TileObjectData.addTile(Type); AddMapEntry(new Color(57, 48, 83), CalamityUtils.GetText("Tiles.Ribs")); - DustType = (int)CalamityDusts.SulfurousSeaAcid; + DustType = (int)CalamityDusts.SulphurousSeaAcid; base.SetStaticDefaults(); } diff --git a/Tiles/Abyss/SulphurousRib3.cs b/Tiles/Abyss/SulphurousRib3.cs index f2c20b0322..b99319f307 100644 --- a/Tiles/Abyss/SulphurousRib3.cs +++ b/Tiles/Abyss/SulphurousRib3.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Tiles.Abyss TileObjectData.newTile.DrawYOffset = 2; TileObjectData.addTile(Type); AddMapEntry(new Color(57, 48, 83), CalamityUtils.GetText("Tiles.Ribs")); - DustType = (int)CalamityDusts.SulfurousSeaAcid; + DustType = (int)CalamityDusts.SulphurousSeaAcid; base.SetStaticDefaults(); } diff --git a/Tiles/Abyss/SulphurousRib4.cs b/Tiles/Abyss/SulphurousRib4.cs index fc0fc6d83e..73e9e4ec64 100644 --- a/Tiles/Abyss/SulphurousRib4.cs +++ b/Tiles/Abyss/SulphurousRib4.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Tiles.Abyss TileObjectData.newTile.DrawYOffset = 2; TileObjectData.addTile(Type); AddMapEntry(new Color(57, 48, 83), CalamityUtils.GetText("Tiles.Ribs")); - DustType = (int)CalamityDusts.SulfurousSeaAcid; + DustType = (int)CalamityDusts.SulphurousSeaAcid; base.SetStaticDefaults(); } diff --git a/Tiles/Abyss/SulphurousRib5.cs b/Tiles/Abyss/SulphurousRib5.cs index b2b36ab233..f338ec9c9a 100644 --- a/Tiles/Abyss/SulphurousRib5.cs +++ b/Tiles/Abyss/SulphurousRib5.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Tiles.Abyss TileObjectData.newTile.DrawYOffset = 2; TileObjectData.addTile(Type); AddMapEntry(new Color(57, 48, 83), CalamityUtils.GetText("Tiles.Ribs")); - DustType = (int)CalamityDusts.SulfurousSeaAcid; + DustType = (int)CalamityDusts.SulphurousSeaAcid; base.SetStaticDefaults(); } diff --git a/Tiles/Abyss/SulphurousSand.cs b/Tiles/Abyss/SulphurousSand.cs index 5d35963b13..c0e83d585a 100644 --- a/Tiles/Abyss/SulphurousSand.cs +++ b/Tiles/Abyss/SulphurousSand.cs @@ -1,10 +1,12 @@ -using CalamityMod.CalPlayer; +using System.Collections.Generic; +using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Enemy; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; +using Terraria.GameContent.Metadata; using Terraria.ID; using Terraria.ModLoader; @@ -14,17 +16,15 @@ namespace CalamityMod.Tiles.Abyss // It would create block swap issues with regular sulphurous sand and was rendered obsolete with the removal of this tile's water emission mechanic. // For compatibility reasons (including with schematics), however, that tile is converted into this one. [LegacyName("SulphurousSandNoWater")] - public class SulphurousSand : ModTile + public class SulphurousSand : ModTile, IMergeableTile { - public byte[,] tileAdjacency; - public byte[,] secondTileAdjacency; - public byte[,] thirdTileAdjacency; - public byte[,] fourthTileAdjacency; + List IMergeableTile.TileAdjacencies { get; } = []; public override void SetStaticDefaults() { Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; + TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Sand"]); CalamityUtils.MergeWithGeneral(Type); CalamityUtils.MergeWithAbyss(Type); @@ -35,17 +35,17 @@ namespace CalamityMod.Tiles.Abyss AddMapEntry(new Color(150, 100, 50)); HitSound = SoundID.Dig; - TileFraming.SetUpUniversalMerge(Type, TileID.Dirt, out tileAdjacency); - TileFraming.SetUpUniversalMerge(Type, TileID.Stone, out secondTileAdjacency); - TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out thirdTileAdjacency); - TileFraming.SetUpUniversalMerge(Type, TileID.Sand, out fourthTileAdjacency); + this.RegisterUniversalMerge(TileID.Dirt, "CalamityMod/Tiles/Merges/DirtMerge"); + this.RegisterUniversalMerge(TileID.Stone, "CalamityMod/Tiles/Merges/StoneMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/SulphurousSandstoneMerge"); + this.RegisterUniversalMerge(TileID.Sand, "CalamityMod/Tiles/Merges/SandMerge"); } public override void NumDust(int i, int j, bool fail, ref int num) { num = fail ? 1 : 3; } - + public override void KillTile(int i, int j, ref bool fail, ref bool effectOnly, ref bool noItem) { if (CalamityUtils.ParanoidTileRetrieval(i, j + 1).HasTile && @@ -173,23 +173,5 @@ namespace CalamityMod.Tiles.Abyss } } } - - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) - { - - TileFraming.DrawUniversalMergeFrames(i, j, fourthTileAdjacency, "CalamityMod/Tiles/Merges/SandMerge"); - TileFraming.DrawUniversalMergeFrames(i, j, thirdTileAdjacency, "CalamityMod/Tiles/Merges/SulphurousSandstoneMerge"); - TileFraming.DrawUniversalMergeFrames(i, j, secondTileAdjacency, "CalamityMod/Tiles/Merges/StoneMerge"); - TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/DirtMerge"); - } - - public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) - { - TileFraming.GetAdjacencyData(i, j, TileID.Dirt, out tileAdjacency[i, j]); - TileFraming.GetAdjacencyData(i, j, TileID.Stone, out secondTileAdjacency[i, j]); - TileFraming.GetAdjacencyData(i, j, ModContent.TileType(), out thirdTileAdjacency[i, j]); - TileFraming.GetAdjacencyData(i, j, TileID.Sand, out fourthTileAdjacency[i, j]); - return true; - } } } diff --git a/Tiles/Abyss/SulphurousSandstone.cs b/Tiles/Abyss/SulphurousSandstone.cs index a619209223..5b2c948dfe 100644 --- a/Tiles/Abyss/SulphurousSandstone.cs +++ b/Tiles/Abyss/SulphurousSandstone.cs @@ -1,4 +1,5 @@ -using CalamityMod.World; +using System.Collections.Generic; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -7,11 +8,9 @@ using Terraria.ModLoader; namespace CalamityMod.Tiles.Abyss { - public class SulphurousSandstone : ModTile + public class SulphurousSandstone : ModTile, IMergeableTile { - public byte[,] tileAdjacency; - public byte[,] secondTileAdjacency; - public byte[,] thirdTileAdjacency; + List IMergeableTile.TileAdjacencies { get; } = []; public override void SetStaticDefaults() { @@ -25,9 +24,9 @@ namespace CalamityMod.Tiles.Abyss AddMapEntry(new Color(113, 90, 71)); HitSound = SoundID.Dig; - TileFraming.SetUpUniversalMerge(Type, TileID.Dirt, out tileAdjacency); - TileFraming.SetUpUniversalMerge(Type, TileID.Stone, out secondTileAdjacency); - TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out thirdTileAdjacency); + this.RegisterUniversalMerge(TileID.Dirt, "CalamityMod/Tiles/Merges/DirtMerge"); + this.RegisterUniversalMerge(TileID.Stone, "CalamityMod/Tiles/Merges/StoneMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/HardenedSulphurousSandstoneMerge"); } public override void NumDust(int i, int j, bool fail, ref int num) @@ -44,21 +43,6 @@ namespace CalamityMod.Tiles.Abyss } } - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) - { - TileFraming.DrawUniversalMergeFrames(i, j, thirdTileAdjacency, "CalamityMod/Tiles/Merges/HardenedSulphurousSandstoneMerge"); - TileFraming.DrawUniversalMergeFrames(i, j, secondTileAdjacency, "CalamityMod/Tiles/Merges/StoneMerge"); - TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/DirtMerge"); - } - - public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) - { - TileFraming.GetAdjacencyData(i, j, TileID.Dirt, out tileAdjacency[i, j]); - TileFraming.GetAdjacencyData(i, j, TileID.Stone, out secondTileAdjacency[i, j]); - TileFraming.GetAdjacencyData(i, j, ModContent.TileType(), out thirdTileAdjacency[i, j]); - return true; - } - public override void RandomUpdate(int i, int j) { int vineLength = WorldGen.genRand.Next((int)Main.rockLayer, (int)(Main.rockLayer + (double)Main.maxTilesY * 0.143)); diff --git a/Tiles/Abyss/SulphurousShale.cs b/Tiles/Abyss/SulphurousShale.cs index 87887f78e1..c4652868ac 100644 --- a/Tiles/Abyss/SulphurousShale.cs +++ b/Tiles/Abyss/SulphurousShale.cs @@ -1,10 +1,11 @@ //using CalamityMod.Tiles.Abyss.AbyssAmbient; +using System; +using System.Collections.Generic; using CalamityMod.Tiles.Abyss.AbyssAmbient; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; -using System; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -12,15 +13,14 @@ using Terraria.ModLoader; namespace CalamityMod.Tiles.Abyss { - public class SulphurousShale : ModTile + public class SulphurousShale : ModTile, IMergeableTile { int animationFrameWidth = 234; - public byte[,] tileAdjacency; - public byte[,] secondTileAdjacency; - public byte[,] thirdTileAdjacency; public static readonly SoundStyle MineSound = new("CalamityMod/Sounds/Custom/AbyssGravelMine", 3); - + + List IMergeableTile.TileAdjacencies { get; } = []; + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; @@ -35,9 +35,17 @@ namespace CalamityMod.Tiles.Abyss MinPick = 65; HitSound = MineSound; DustType = 33; - TileFraming.SetUpUniversalMerge(Type, TileID.Dirt, out tileAdjacency); - TileFraming.SetUpUniversalMerge(Type, TileID.Stone, out secondTileAdjacency); - TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out thirdTileAdjacency); + this.RegisterUniversalMerge(TileID.Dirt, "CalamityMod/Tiles/Merges/DirtMerge"); + this.RegisterUniversalMerge(TileID.Stone, "CalamityMod/Tiles/Merges/StoneMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/AbyssGravelMerge"); + } + + public override void NearbyEffects(int i, int j, bool closer) + { + if (Main.LocalPlayer.InModBiome(ModContent.GetInstance())) + { + Main.SceneMetrics.ActiveFountainColor = ModContent.Find("CalamityMod/SulphuricDepthsWater").Slot; + } } public override bool CanExplode(int i, int j) @@ -52,7 +60,7 @@ namespace CalamityMod.Tiles.Abyss public override void RandomUpdate(int i, int j) { - + int vineLength = WorldGen.genRand.Next((int)Main.rockLayer, (int)(Main.rockLayer + (double)Main.maxTilesY * 0.143)); int nearbyVineCount = 0; for (int x = i - 15; x <= i + 15; x++) @@ -112,7 +120,7 @@ namespace CalamityMod.Tiles.Abyss Tile up2 = Main.tile[i, j - 2]; // Place sulphur tentacle corals - if (WorldGen.genRand.Next(10) == 0 && !up.HasTile && !up2.HasTile && up.LiquidAmount > 0 && up2.LiquidAmount > 0 && !tile.LeftSlope && !tile.RightSlope && !tile.IsHalfBlock) + if (WorldGen.genRand.NextBool(10)&& !up.HasTile && !up2.HasTile && up.LiquidAmount > 0 && up2.LiquidAmount > 0 && !tile.LeftSlope && !tile.RightSlope && !tile.IsHalfBlock) { up.TileType = (ushort)ModContent.TileType(); up.HasTile = true; @@ -217,20 +225,5 @@ namespace CalamityMod.Tiles.Abyss } frameXOffset = uniqueAnimationFrameX * animationFrameWidth; } - - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) - { - TileFraming.DrawUniversalMergeFrames(i, j, thirdTileAdjacency, "CalamityMod/Tiles/Merges/AbyssGravelMerge"); - TileFraming.DrawUniversalMergeFrames(i, j, secondTileAdjacency, "CalamityMod/Tiles/Merges/StoneMerge"); - TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/DirtMerge"); - } - - public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) - { - TileFraming.GetAdjacencyData(i, j, TileID.Dirt, out tileAdjacency[i, j]); - TileFraming.GetAdjacencyData(i, j, TileID.Stone, out secondTileAdjacency[i, j]); - TileFraming.GetAdjacencyData(i, j, ModContent.TileType(), out thirdTileAdjacency[i, j]); - return true; - } } } diff --git a/Tiles/Abyss/SulphurousTorch.cs b/Tiles/Abyss/SulphurousTorch.cs index d574cbb682..3ddf59809c 100644 --- a/Tiles/Abyss/SulphurousTorch.cs +++ b/Tiles/Abyss/SulphurousTorch.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.Abyss @@ -12,7 +13,7 @@ namespace CalamityMod.Tiles.Abyss 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(190, 255, 60), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(190, 255, 60), 1f); return false; } @@ -68,10 +69,10 @@ namespace CalamityMod.Tiles.Abyss return true; } - public override float GetTorchLuck(Player player) - { - // Note: Total Torch luck never goes below zero - return player.Calamity().ZoneSulphur ? 1f : -1f; - } + public override float GetTorchLuck(Player player) + { + // Note: Total Torch luck never goes below zero + return player.Calamity().ZoneSulphur ? 1f : -1f; + } } } diff --git a/Tiles/Abyss/SulphurousVines.cs b/Tiles/Abyss/SulphurousVines.cs index 5e80d15f8b..1d49774fce 100644 --- a/Tiles/Abyss/SulphurousVines.cs +++ b/Tiles/Abyss/SulphurousVines.cs @@ -1,5 +1,5 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; using Terraria.GameContent.Metadata; @@ -22,11 +22,11 @@ namespace CalamityMod.Tiles.Abyss AddMapEntry(new Color(0, 50, 0)); HitSound = SoundID.Grass; DustType = 2; - TileID.Sets.IsVine[Type] = true; - TileID.Sets.ReplaceTileBreakDown[Type] = true; - TileID.Sets.VineThreads[Type] = true; - TileID.Sets.DrawFlipMode[Type] = 1; - TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Plant"]); + TileID.Sets.IsVine[Type] = true; + TileID.Sets.ReplaceTileBreakDown[Type] = true; + TileID.Sets.VineThreads[Type] = true; + TileID.Sets.DrawFlipMode[Type] = 1; + TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Plant"]); } public override void NumDust(int i, int j, bool fail, ref int num) @@ -35,17 +35,17 @@ namespace CalamityMod.Tiles.Abyss } public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) - { - Tile tileAbove = Framing.GetTileSafely(i, j - 1); + { + Tile tileAbove = Framing.GetTileSafely(i, j - 1); - if (!tileAbove.HasTile) + if (!tileAbove.HasTile) { WorldGen.KillTile(i, j); - return true; - } + return true; + } - return true; - } + return true; + } public override void KillTile(int i, int j, ref bool fail, ref bool effectOnly, ref bool noItem) { @@ -72,7 +72,7 @@ namespace CalamityMod.Tiles.Abyss if (closer && Main.rand.NextBool(200) && j > Main.worldSurface) { Dust dust; - dust = Main.dust[Dust.NewDust(new Vector2(i * 16f, j * 16f), 274, 279, 304, 0.23255825f, 10f, 0, new Color(22, 255, 0), 1.5116279f)]; + dust = Main.dust[Dust.NewDust(new Vector2(i * 16f, j * 16f), 274, 279, DustID.Firefly, 0.23255825f, 10f, 0, new Color(22, 255, 0), 1.5116279f)]; dust.noGravity = true; dust.noLight = true; dust.fadeIn = 2.5813954f; diff --git a/Tiles/Abyss/ViperVines.cs b/Tiles/Abyss/ViperVines.cs index 3f491fe5fe..3e26bd5505 100644 --- a/Tiles/Abyss/ViperVines.cs +++ b/Tiles/Abyss/ViperVines.cs @@ -1,8 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; +using Terraria.GameContent.Metadata; using Terraria.ID; -using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Tiles.Abyss @@ -15,6 +15,7 @@ namespace CalamityMod.Tiles.Abyss Main.tileBlockLight[Type] = true; Main.tileLavaDeath[Type] = true; Main.tileNoFail[Type] = true; + TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Plant"]); AddMapEntry(new Color(0, 50, 0)); HitSound = SoundID.Grass; DustType = 2; @@ -26,7 +27,7 @@ namespace CalamityMod.Tiles.Abyss } public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) - { + { if (WorldGen.loadSuccess) { Tile tileAbove = Framing.GetTileSafely(i, j - 1); @@ -36,8 +37,8 @@ namespace CalamityMod.Tiles.Abyss return true; } } - return true; - } + return true; + } public override void KillTile(int i, int j, ref bool fail, ref bool effectOnly, ref bool noItem) { diff --git a/Tiles/Abyss/Voidstone.cs b/Tiles/Abyss/Voidstone.cs index c2bbb0b731..45f6f30719 100644 --- a/Tiles/Abyss/Voidstone.cs +++ b/Tiles/Abyss/Voidstone.cs @@ -1,22 +1,22 @@ -using CalamityMod.Tiles.Abyss.AbyssAmbient; +using System; +using System.Collections.Generic; +using CalamityMod.Tiles.Abyss.AbyssAmbient; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; -using Terraria.Audio; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.Abyss { - public class Voidstone : ModTile + public class Voidstone : ModTile, IMergeableTile { public static readonly SoundStyle MineSound = new("CalamityMod/Sounds/Custom/VoidstoneMine", 3) { Volume = 0.4f }; internal static Texture2D GlowTexture; - public byte[,] tileAdjacency; - public byte[,] secondTileAdjacency; - public byte[,] thirdTileAdjacency; + + List IMergeableTile.TileAdjacencies { get; } = []; public override void SetStaticDefaults() { @@ -36,16 +36,16 @@ namespace CalamityMod.Tiles.Abyss MinPick = 180; AddMapEntry(new Color(15, 15, 15)); - TileFraming.SetUpUniversalMerge(Type, TileID.Dirt, out tileAdjacency); - TileFraming.SetUpUniversalMerge(Type, TileID.Stone, out secondTileAdjacency); - TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out thirdTileAdjacency); + this.RegisterUniversalMerge(TileID.Dirt, "CalamityMod/Tiles/Merges/DirtMerge"); + this.RegisterUniversalMerge(TileID.Stone, "CalamityMod/Tiles/Merges/StoneMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/PyreMantleMerge"); } int animationFrameWidth = 234; public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 180, 0f, 0f, 1, new Color(128, 128, 128), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.DungeonSpirit, 0f, 0f, 1, new Color(128, 128, 128), 1f); return false; } @@ -71,7 +71,7 @@ namespace CalamityMod.Tiles.Abyss up.TileFrameX = (short)(WorldGen.genRand.Next(6) * 18); WorldGen.SquareTileFrame(i, j - 1, true); - if (Main.netMode == NetmodeID.Server) + if (Main.netMode == NetmodeID.Server) NetMessage.SendTileSquare(-1, i, j - 1, 3, TileChangeType.None); } } @@ -276,17 +276,6 @@ namespace CalamityMod.Tiles.Abyss drawColour *= brightness; TileFraming.SlopedGlowmask(i, j, 0, GlowTexture, drawOffset, null, GetDrawColour(i, j, drawColour), default); - TileFraming.DrawUniversalMergeFrames(i, j, thirdTileAdjacency, "CalamityMod/Tiles/Merges/PyreMantleMerge"); - TileFraming.DrawUniversalMergeFrames(i, j, secondTileAdjacency, "CalamityMod/Tiles/Merges/StoneMerge"); - TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/DirtMerge"); - } - - public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) - { - TileFraming.GetAdjacencyData(i, j, TileID.Dirt, out tileAdjacency[i, j]); - TileFraming.GetAdjacencyData(i, j, TileID.Stone, out secondTileAdjacency[i, j]); - TileFraming.GetAdjacencyData(i, j, ModContent.TileType(), out thirdTileAdjacency[i, j]); - return true; } private Color GetDrawColour(int i, int j, Color colour) diff --git a/Tiles/AerialiteBarTile.png b/Tiles/AerialiteBarTile.png index cc3dce48f7..e1bf098596 100644 Binary files a/Tiles/AerialiteBarTile.png and b/Tiles/AerialiteBarTile.png differ diff --git a/Tiles/AerialiteBrick.cs b/Tiles/AerialiteBrick.cs index 0b4981d5cf..73a3990d3f 100644 --- a/Tiles/AerialiteBrick.cs +++ b/Tiles/AerialiteBrick.cs @@ -1,15 +1,16 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; +using System.Collections.Generic; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Tiles { - public class AerialiteBrick : ModTile + public class AerialiteBrick : ModTile, IMergeableTile { - public byte[,] tileAdjacency; - public byte[,] secondTileAdjacency; + List IMergeableTile.TileAdjacencies { get; } = []; + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; @@ -17,26 +18,19 @@ namespace CalamityMod.Tiles HitSound = SoundID.Tink; AddMapEntry(new Color(68, 58, 145)); - TileFraming.SetUpUniversalMerge(Type, TileID.Dirt, out tileAdjacency); - TileFraming.SetUpUniversalMerge(Type, TileID.Stone, out secondTileAdjacency); + this.RegisterUniversalMerge(TileID.Dirt, "CalamityMod/Tiles/Merges/DirtMerge"); + this.RegisterUniversalMerge(TileID.Stone, "CalamityMod/Tiles/Merges/StoneMerge"); } - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) - { - TileFraming.DrawUniversalMergeFrames(i, j, secondTileAdjacency, "CalamityMod/Tiles/Merges/StoneMerge"); - TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/DirtMerge"); - } public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { - TileFraming.GetAdjacencyData(i, j, TileID.Dirt, out tileAdjacency[i, j]); - TileFraming.GetAdjacencyData(i, j, TileID.Stone, out secondTileAdjacency[i, j]); return TileFraming.BetterGemsparkFraming(i, j, resetFrame); } 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(119, 102, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 10, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(119, 102, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Gold, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } } diff --git a/Tiles/ArenaTile.cs b/Tiles/ArenaTile.cs index 8dc8b706a7..8e25df1098 100644 --- a/Tiles/ArenaTile.cs +++ b/Tiles/ArenaTile.cs @@ -1,12 +1,12 @@ using CalamityMod.NPCs.CalClone; using CalamityMod.NPCs.SupremeCalamitas; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Localization; -using Terraria.ModLoader; -using Terraria.ID; using CalamityMod.Skies; using CalamityMod.World; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; namespace CalamityMod.Tiles { diff --git a/Tiles/Astral/AstralBeacon.cs b/Tiles/Astral/AstralBeacon.cs index 1a54d29b07..399fc784f8 100644 --- a/Tiles/Astral/AstralBeacon.cs +++ b/Tiles/Astral/AstralBeacon.cs @@ -7,12 +7,12 @@ using CalamityMod.NPCs.AstrumDeus; using CalamityMod.Projectiles.Boss; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.DataStructures; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; -using Terraria.Audio; -using Terraria.ID; namespace CalamityMod.Tiles.Astral { @@ -69,7 +69,7 @@ namespace CalamityMod.Tiles.Astral bool usingStarcore = Main.LocalPlayer.HasItem(ModContent.ItemType()); - if (Main.dayTime) + if (Main.IsItDay()) { CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.Status.Boss.DeusAltarRejectNightText", FailColor); return false; diff --git a/Tiles/Astral/AstralClay.cs b/Tiles/Astral/AstralClay.cs index 4d43e6e647..d5afdd919e 100644 --- a/Tiles/Astral/AstralClay.cs +++ b/Tiles/Astral/AstralClay.cs @@ -1,4 +1,5 @@  +using System.Collections.Generic; using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -8,9 +9,10 @@ using Terraria.ModLoader; namespace CalamityMod.Tiles.Astral { - public class AstralClay : ModTile + public class AstralClay : ModTile, IMergeableTile { - public byte[,] tileAdjacency; + List IMergeableTile.TileAdjacencies { get; } = []; + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; @@ -29,17 +31,7 @@ namespace CalamityMod.Tiles.Astral TileID.Sets.CanBeDugByShovel[Type] = true; - TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out tileAdjacency); - } - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) - { - TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/AstralDirtMerge"); - } - - public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) - { - TileFraming.GetAdjacencyData(i, j, ModContent.TileType(), out tileAdjacency[i, j]); - return true; + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/AstralDirtMerge"); } public override void NumDust(int i, int j, bool fail, ref int num) diff --git a/Tiles/Astral/AstralDirt.cs b/Tiles/Astral/AstralDirt.cs index 6b5601c886..4cd269dab8 100644 --- a/Tiles/Astral/AstralDirt.cs +++ b/Tiles/Astral/AstralDirt.cs @@ -1,4 +1,5 @@ -using CalamityMod.Dusts; +using System.Collections.Generic; +using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -8,15 +9,15 @@ using Terraria.ModLoader; namespace CalamityMod.Tiles.Astral { - public class AstralDirt : ModTile + public class AstralDirt : ModTile, IMergeableTile { - public byte[,] tileAdjacency; - public byte[,] secondTileAdjacency; + List IMergeableTile.TileAdjacencies { get; } = []; + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; - TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Dirt"]); + TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Dirt"]); CalamityUtils.MergeWithGeneral(Type); CalamityUtils.MergeAstralTiles(Type); @@ -35,21 +36,8 @@ namespace CalamityMod.Tiles.Astral TileID.Sets.CanBeClearedDuringOreRunner[Type] = true; - TileFraming.SetUpUniversalMerge(Type, TileID.Dirt, out tileAdjacency); - TileFraming.SetUpUniversalMerge(Type, TileID.Stone, out secondTileAdjacency); - } - - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) - { - TileFraming.DrawUniversalMergeFrames(i, j, secondTileAdjacency, "CalamityMod/Tiles/Merges/StoneMerge"); - TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/DirtMerge"); - } - - public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) - { - TileFraming.GetAdjacencyData(i, j, TileID.Dirt, out tileAdjacency[i, j]); - TileFraming.GetAdjacencyData(i, j, TileID.Stone, out secondTileAdjacency[i, j]); - return true; + this.RegisterUniversalMerge(TileID.Dirt, "CalamityMod/Tiles/Merges/DirtMerge"); + this.RegisterUniversalMerge(TileID.Stone, "CalamityMod/Tiles/Merges/StoneMerge"); } public override void RandomUpdate(int i, int j) diff --git a/Tiles/Astral/AstralGrass.cs b/Tiles/Astral/AstralGrass.cs index ed4b52e790..f5256945c1 100644 --- a/Tiles/Astral/AstralGrass.cs +++ b/Tiles/Astral/AstralGrass.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Tiles.Astral Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; Main.tileBrick[Type] = true; - TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Grass"]); + TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Grass"]); CalamityUtils.SetMerge(Type, ModContent.TileType()); CalamityUtils.SetMerge(Type, TileID.Grass); @@ -47,7 +47,7 @@ namespace CalamityMod.Tiles.Astral Tile up = Main.tile[i, j - 1]; Tile up2 = Main.tile[i, j - 2]; //place Astral Wild Grass - if (WorldGen.genRand.Next(10) == 0 && !up.HasTile && !up2.HasTile && !(up.LiquidAmount > 0 && up2.LiquidAmount > 0) && !tile.LeftSlope && !tile.RightSlope && !tile.IsHalfBlock) + if (WorldGen.genRand.NextBool(10)&& !up.HasTile && !up2.HasTile && !(up.LiquidAmount > 0 && up2.LiquidAmount > 0) && !tile.LeftSlope && !tile.RightSlope && !tile.IsHalfBlock) { up.TileType = (ushort)ModContent.TileType(); up.HasTile = true; @@ -63,7 +63,7 @@ namespace CalamityMod.Tiles.Astral } } //place Astral Short Grass - if (WorldGen.genRand.Next(10) == 0 && !up.HasTile && !up2.HasTile && !(up.LiquidAmount > 0 && up2.LiquidAmount > 0) && !tile.LeftSlope && !tile.RightSlope && !tile.IsHalfBlock) + if (WorldGen.genRand.NextBool(10)&& !up.HasTile && !up2.HasTile && !(up.LiquidAmount > 0 && up2.LiquidAmount > 0) && !tile.LeftSlope && !tile.RightSlope && !tile.IsHalfBlock) { up.TileType = (ushort)ModContent.TileType(); up.HasTile = true; diff --git a/Tiles/Astral/AstralMonolith.cs b/Tiles/Astral/AstralMonolith.cs index 57559d0638..9724660bfb 100644 --- a/Tiles/Astral/AstralMonolith.cs +++ b/Tiles/Astral/AstralMonolith.cs @@ -1,4 +1,5 @@  +using System.Collections.Generic; using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -9,18 +10,18 @@ using Terraria.ModLoader; namespace CalamityMod.Tiles.Astral { - public class AstralMonolith : ModTile + public class AstralMonolith : ModTile, IMergeableTile { private static int sheetWidth = 216; private static int sheetHeight = 72; - public byte[,] tileAdjacency; + List IMergeableTile.TileAdjacencies { get; } = []; public override void SetStaticDefaults() { Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; - TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Wood"]); + TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Wood"]); CalamityUtils.MergeWithGeneral(Type); CalamityUtils.MergeAstralTiles(Type); @@ -31,7 +32,7 @@ namespace CalamityMod.Tiles.Astral AddMapEntry(new Color(45, 36, 63)); - TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out tileAdjacency); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/AstralDirtMerge"); } public override bool CreateDust(int i, int j, ref int type) @@ -86,14 +87,10 @@ namespace CalamityMod.Tiles.Astral { Main.spriteBatch.Draw(glowmask, drawOffset + new Vector2(0f, 8f), new Rectangle?(new Rectangle(xPos, yPos, 18, 8)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } - - TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/AstralDirtMerge"); } public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { - - TileFraming.GetAdjacencyData(i, j, ModContent.TileType(), out tileAdjacency[i, j]); TileFraming.CompactFraming(i, j, resetFrame); return false; } diff --git a/Tiles/Astral/AstralNormalLargePiles.cs b/Tiles/Astral/AstralNormalLargePiles.cs index 514260a871..f3ca9cad32 100644 --- a/Tiles/Astral/AstralNormalLargePiles.cs +++ b/Tiles/Astral/AstralNormalLargePiles.cs @@ -36,17 +36,17 @@ namespace CalamityMod.Tiles.Astral num = fail ? 1 : 4; } - public override void DropCritterChance(int i, int j, ref int wormChance, ref int grassHopperChance, ref int jungleGrubChance) - { - if (NPC.CountNPCS(NPCID.EnchantedNightcrawler) < 5 && Main.rand.NextBool(6)) - { - int worm = NPC.NewNPC(new EntitySource_TileBreak(i, j), i * 16 + 10, j * 16, NPCID.EnchantedNightcrawler); - Main.npc[worm].TargetClosest(); - Main.npc[worm].velocity.Y = Main.rand.NextFloat(-5f, -2.1f); - Main.npc[worm].velocity.X = Main.rand.NextFloat(0f, 2.6f) * (float)(-Main.npc[worm].direction); - Main.npc[worm].direction *= -1; - Main.npc[worm].netUpdate = true; - } + public override void DropCritterChance(int i, int j, ref int wormChance, ref int grassHopperChance, ref int jungleGrubChance) + { + if (NPC.CountNPCS(NPCID.EnchantedNightcrawler) < 5 && Main.rand.NextBool(6)) + { + int worm = NPC.NewNPC(new EntitySource_TileBreak(i, j), i * 16 + 10, j * 16, NPCID.EnchantedNightcrawler); + Main.npc[worm].TargetClosest(); + Main.npc[worm].velocity.Y = Main.rand.NextFloat(-5f, -2.1f); + Main.npc[worm].velocity.X = Main.rand.NextFloat(0f, 2.6f) * (float)(-Main.npc[worm].direction); + Main.npc[worm].direction *= -1; + Main.npc[worm].netUpdate = true; + } } public override bool IsTileBiomeSightable(int i, int j, ref Color sightColor) diff --git a/Tiles/Astral/AstralNormalMediumPiles.cs b/Tiles/Astral/AstralNormalMediumPiles.cs index 8344033cd1..f680dd2919 100644 --- a/Tiles/Astral/AstralNormalMediumPiles.cs +++ b/Tiles/Astral/AstralNormalMediumPiles.cs @@ -36,17 +36,17 @@ namespace CalamityMod.Tiles.Astral num = fail ? 1 : 4; } - public override void DropCritterChance(int i, int j, ref int wormChance, ref int grassHopperChance, ref int jungleGrubChance) - { - if (NPC.CountNPCS(NPCID.EnchantedNightcrawler) < 5 && Main.rand.NextBool(6)) - { - int worm = NPC.NewNPC(new EntitySource_TileBreak(i, j), i * 16 + 10, j * 16, NPCID.EnchantedNightcrawler); - Main.npc[worm].TargetClosest(); - Main.npc[worm].velocity.Y = Main.rand.NextFloat(-5f, -2.1f); - Main.npc[worm].velocity.X = Main.rand.NextFloat(0f, 2.6f) * (float)(-Main.npc[worm].direction); - Main.npc[worm].direction *= -1; - Main.npc[worm].netUpdate = true; - } + public override void DropCritterChance(int i, int j, ref int wormChance, ref int grassHopperChance, ref int jungleGrubChance) + { + if (NPC.CountNPCS(NPCID.EnchantedNightcrawler) < 5 && Main.rand.NextBool(6)) + { + int worm = NPC.NewNPC(new EntitySource_TileBreak(i, j), i * 16 + 10, j * 16, NPCID.EnchantedNightcrawler); + Main.npc[worm].TargetClosest(); + Main.npc[worm].velocity.Y = Main.rand.NextFloat(-5f, -2.1f); + Main.npc[worm].velocity.X = Main.rand.NextFloat(0f, 2.6f) * (float)(-Main.npc[worm].direction); + Main.npc[worm].direction *= -1; + Main.npc[worm].netUpdate = true; + } } public override bool IsTileBiomeSightable(int i, int j, ref Color sightColor) diff --git a/Tiles/Astral/AstralNormalSmallPiles.cs b/Tiles/Astral/AstralNormalSmallPiles.cs index 5ac16fc1d5..ad7786902c 100644 --- a/Tiles/Astral/AstralNormalSmallPiles.cs +++ b/Tiles/Astral/AstralNormalSmallPiles.cs @@ -31,17 +31,17 @@ namespace CalamityMod.Tiles.Astral num = fail ? 1 : 4; } - public override void DropCritterChance(int i, int j, ref int wormChance, ref int grassHopperChance, ref int jungleGrubChance) - { - if (NPC.CountNPCS(NPCID.EnchantedNightcrawler) < 5 && Main.rand.NextBool(6)) - { - int worm = NPC.NewNPC(new EntitySource_TileBreak(i, j), i * 16 + 10, j * 16, NPCID.EnchantedNightcrawler); - Main.npc[worm].TargetClosest(); - Main.npc[worm].velocity.Y = Main.rand.NextFloat(-5f, -2.1f); - Main.npc[worm].velocity.X = Main.rand.NextFloat(0f, 2.6f) * (float)(-Main.npc[worm].direction); - Main.npc[worm].direction *= -1; - Main.npc[worm].netUpdate = true; - } + public override void DropCritterChance(int i, int j, ref int wormChance, ref int grassHopperChance, ref int jungleGrubChance) + { + if (NPC.CountNPCS(NPCID.EnchantedNightcrawler) < 5 && Main.rand.NextBool(6)) + { + int worm = NPC.NewNPC(new EntitySource_TileBreak(i, j), i * 16 + 10, j * 16, NPCID.EnchantedNightcrawler); + Main.npc[worm].TargetClosest(); + Main.npc[worm].velocity.Y = Main.rand.NextFloat(-5f, -2.1f); + Main.npc[worm].velocity.X = Main.rand.NextFloat(0f, 2.6f) * (float)(-Main.npc[worm].direction); + Main.npc[worm].direction *= -1; + Main.npc[worm].netUpdate = true; + } } public override bool IsTileBiomeSightable(int i, int j, ref Color sightColor) diff --git a/Tiles/Astral/AstralShortPlants.cs b/Tiles/Astral/AstralShortPlants.cs index 9bc78c7804..2aa49d66a1 100644 --- a/Tiles/Astral/AstralShortPlants.cs +++ b/Tiles/Astral/AstralShortPlants.cs @@ -1,6 +1,6 @@ -using CalamityMod.Dusts; +using System.Collections.Generic; +using CalamityMod.Dusts; using Microsoft.Xna.Framework; -using System.Collections.Generic; using Terraria; using Terraria.DataStructures; using Terraria.GameContent.Metadata; @@ -20,9 +20,9 @@ namespace CalamityMod.Tiles.Astral Main.tileLavaDeath[Type] = true; Main.tileWaterDeath[Type] = true; Main.tileFrameImportant[Type] = true; - TileID.Sets.ReplaceTileBreakUp[Type] = true; - TileID.Sets.SwaysInWindBasic[Type] = true; - TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Plant"]); + TileID.Sets.ReplaceTileBreakUp[Type] = true; + TileID.Sets.SwaysInWindBasic[Type] = true; + TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Plant"]); DustType = ModContent.DustType(); @@ -38,28 +38,28 @@ namespace CalamityMod.Tiles.Astral offsetY = 2; } - public override void DropCritterChance(int i, int j, ref int wormChance, ref int grassHopperChance, ref int jungleGrubChance) - { - if (NPC.CountNPCS(NPCID.EnchantedNightcrawler) < 5 && Main.rand.NextBool(400)) - { - int worm = NPC.NewNPC(new EntitySource_TileBreak(i, j), i * 16 + 10, j * 16, NPCID.EnchantedNightcrawler); - Main.npc[worm].TargetClosest(); - Main.npc[worm].velocity.Y = Main.rand.NextFloat(-5f, -2.1f); - Main.npc[worm].velocity.X = Main.rand.NextFloat(0f, 2.6f) * (float)(-Main.npc[worm].direction); - Main.npc[worm].direction *= -1; - Main.npc[worm].netUpdate = true; - } - } + public override void DropCritterChance(int i, int j, ref int wormChance, ref int grassHopperChance, ref int jungleGrubChance) + { + if (NPC.CountNPCS(NPCID.EnchantedNightcrawler) < 5 && Main.rand.NextBool(400)) + { + int worm = NPC.NewNPC(new EntitySource_TileBreak(i, j), i * 16 + 10, j * 16, NPCID.EnchantedNightcrawler); + Main.npc[worm].TargetClosest(); + Main.npc[worm].velocity.Y = Main.rand.NextFloat(-5f, -2.1f); + Main.npc[worm].velocity.X = Main.rand.NextFloat(0f, 2.6f) * (float)(-Main.npc[worm].direction); + Main.npc[worm].direction *= -1; + Main.npc[worm].netUpdate = true; + } + } public override IEnumerable GetItemDrops(int i, int j) { Vector2 worldPosition = new Vector2(i, j).ToWorldCoordinates(); Player nearestPlayer = Main.player[Player.FindClosest(worldPosition, 16, 16)]; if (nearestPlayer.active) - { + { if (nearestPlayer.ActiveItem().type == ItemID.Sickle) yield return new Item(ItemID.Hay, Main.rand.Next(1, 2 + 1)); - + if (Main.rand.NextBool(20)) yield return new Item(ModContent.ItemType()); } diff --git a/Tiles/Astral/AstralStone.cs b/Tiles/Astral/AstralStone.cs index 8516bb4c0d..5d4eb9f993 100644 --- a/Tiles/Astral/AstralStone.cs +++ b/Tiles/Astral/AstralStone.cs @@ -1,4 +1,5 @@  +using System.Collections.Generic; using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -8,11 +9,10 @@ using Terraria.ModLoader; namespace CalamityMod.Tiles.Astral { - public class AstralStone : ModTile + public class AstralStone : ModTile, IMergeableTile { - public byte[,] tileAdjacency; - public byte[,] secondTileAdjacency; - public byte[,] thirdTileAdjacency; + List IMergeableTile.TileAdjacencies { get; } = []; + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; @@ -33,24 +33,9 @@ namespace CalamityMod.Tiles.Astral TileID.Sets.Conversion.Stone[Type] = true; TileID.Sets.CanBeClearedDuringOreRunner[Type] = true; - TileFraming.SetUpUniversalMerge(Type, TileID.Dirt, out tileAdjacency); - TileFraming.SetUpUniversalMerge(Type, TileID.Stone, out secondTileAdjacency); - TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out thirdTileAdjacency); - } - - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) - { - TileFraming.DrawUniversalMergeFrames(i, j, thirdTileAdjacency, "CalamityMod/Tiles/Merges/AstralDirtMerge"); - TileFraming.DrawUniversalMergeFrames(i, j, secondTileAdjacency, "CalamityMod/Tiles/Merges/StoneMerge"); - TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/DirtMerge"); - } - - public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) - { - TileFraming.GetAdjacencyData(i, j, TileID.Dirt, out tileAdjacency[i, j]); - TileFraming.GetAdjacencyData(i, j, TileID.Stone, out secondTileAdjacency[i, j]); - TileFraming.GetAdjacencyData(i, j, ModContent.TileType(), out thirdTileAdjacency[i, j]); - return true; + this.RegisterUniversalMerge(TileID.Dirt, "CalamityMod/Tiles/Merges/DirtMerge"); + this.RegisterUniversalMerge(TileID.Stone, "CalamityMod/Tiles/Merges/StoneMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/AstralDirtMerge"); } public override void NumDust(int i, int j, bool fail, ref int num) diff --git a/Tiles/Astral/AstralTallPlants.cs b/Tiles/Astral/AstralTallPlants.cs index 6560e98fe7..f00fc33aa2 100644 --- a/Tiles/Astral/AstralTallPlants.cs +++ b/Tiles/Astral/AstralTallPlants.cs @@ -1,6 +1,6 @@ -using CalamityMod.Dusts; +using System.Collections.Generic; +using CalamityMod.Dusts; using Microsoft.Xna.Framework; -using System.Collections.Generic; using Terraria; using Terraria.DataStructures; using Terraria.GameContent.Metadata; @@ -21,9 +21,9 @@ namespace CalamityMod.Tiles.Astral Main.tileLavaDeath[Type] = true; Main.tileWaterDeath[Type] = true; Main.tileFrameImportant[Type] = true; - TileID.Sets.ReplaceTileBreakUp[Type] = true; - TileID.Sets.SwaysInWindBasic[Type] = true; - TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Plant"]); + TileID.Sets.ReplaceTileBreakUp[Type] = true; + TileID.Sets.SwaysInWindBasic[Type] = true; + TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Plant"]); TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2); TileObjectData.addTile(Type); @@ -37,18 +37,18 @@ namespace CalamityMod.Tiles.Astral base.SetStaticDefaults(); } - public override void DropCritterChance(int i, int j, ref int wormChance, ref int grassHopperChance, ref int jungleGrubChance) - { - if (NPC.CountNPCS(NPCID.EnchantedNightcrawler) < 5 && Main.rand.NextBool(200)) - { - int worm = NPC.NewNPC(new EntitySource_TileBreak(i, j), i * 16 + 10, j * 16, NPCID.EnchantedNightcrawler); - Main.npc[worm].TargetClosest(); - Main.npc[worm].velocity.Y = Main.rand.NextFloat(-5f, -2.1f); - Main.npc[worm].velocity.X = Main.rand.NextFloat(0f, 2.6f) * (float)(-Main.npc[worm].direction); - Main.npc[worm].direction *= -1; - Main.npc[worm].netUpdate = true; - } - } + public override void DropCritterChance(int i, int j, ref int wormChance, ref int grassHopperChance, ref int jungleGrubChance) + { + if (NPC.CountNPCS(NPCID.EnchantedNightcrawler) < 5 && Main.rand.NextBool(200)) + { + int worm = NPC.NewNPC(new EntitySource_TileBreak(i, j), i * 16 + 10, j * 16, NPCID.EnchantedNightcrawler); + Main.npc[worm].TargetClosest(); + Main.npc[worm].velocity.Y = Main.rand.NextFloat(-5f, -2.1f); + Main.npc[worm].velocity.X = Main.rand.NextFloat(0f, 2.6f) * (float)(-Main.npc[worm].direction); + Main.npc[worm].direction *= -1; + Main.npc[worm].netUpdate = true; + } + } public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) { @@ -61,10 +61,10 @@ namespace CalamityMod.Tiles.Astral Vector2 worldPosition = new Vector2(i, j).ToWorldCoordinates(); Player nearestPlayer = Main.player[Player.FindClosest(worldPosition, 16, 16)]; if (nearestPlayer.active) - { + { if (nearestPlayer.ActiveItem().type == ItemID.Sickle) yield return new Item(ItemID.Hay, Main.rand.Next(2, 4 + 1)); - + if (Main.rand.NextBool(20)) yield return new Item(ModContent.ItemType()); } diff --git a/Tiles/Astral/AstralTorch.cs b/Tiles/Astral/AstralTorch.cs index 1828b44163..88c4fd61ea 100644 --- a/Tiles/Astral/AstralTorch.cs +++ b/Tiles/Astral/AstralTorch.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.Astral @@ -13,7 +14,7 @@ namespace CalamityMod.Tiles.Astral 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(255, 95, 48), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(255, 95, 48), 1f); return false; } diff --git a/Tiles/Astral/AstralTree.cs b/Tiles/Astral/AstralTree.cs index 4bab212262..9bc4e6c1d6 100644 --- a/Tiles/Astral/AstralTree.cs +++ b/Tiles/Astral/AstralTree.cs @@ -4,13 +4,13 @@ using CalamityMod.Items.Materials; using CalamityMod.NPCs.Astral; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using Terraria.ModLoader; using ReLogic.Content; using Terraria; using Terraria.DataStructures; using Terraria.Enums; using Terraria.GameContent; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Tiles.Astral { @@ -51,76 +51,76 @@ namespace CalamityMod.Tiles.Astral return ModContent.TileType(); } - public override int TreeLeaf() => ModContent.GoreType(); + public override int TreeLeaf() => ModContent.GoreType(); - // Returning false at the end prevents vanilla behavior as the default is forest tree behavior which can include undesirable stuff like squirrels and butterflies - public override bool Shake(int x, int y, ref bool createLeaves) - { - int randAmt = Main.rand.Next(1, 3); - if (Main.getGoodWorld && Main.rand.NextBool(15)) - { - Projectile.NewProjectile(new EntitySource_ShakeTree(x, y), x * 16, y * 16, Main.rand.NextFloat(-100f, 100f) * 0.002f, 0f, ProjectileID.Bomb, 0, 0f, Player.FindClosest(new Vector2(x * 16, y * 16), 16, 16)); - } - else if (Main.rand.NextBool(7)) - { - createLeaves = true; - Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), x * 16, y * 16, 16, 16, ItemID.Acorn, randAmt); - } - else if (Main.rand.NextBool(35) && Main.halloween) - { - createLeaves = true; - Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), x * 16, y * 16, 16, 16, ItemID.RottenEgg, randAmt); - } - else if (Main.rand.NextBool(12)) - { - createLeaves = true; - Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), x * 16, y * 16, 16, 16, DropWood(), Main.rand.Next(1, 4)); - } - else if (Main.rand.NextBool(20)) - { - createLeaves = true; - int coin = ItemID.CopperCoin; - int amount = Main.rand.Next(50, 100); - if (Main.rand.NextBool(30)) - { - coin = ItemID.GoldCoin; - amount = 1; - if (Main.rand.NextBool(5)) - amount++; + // Returning false at the end prevents vanilla behavior as the default is forest tree behavior which can include undesirable stuff like squirrels and butterflies + public override bool Shake(int x, int y, ref bool createLeaves) + { + int randAmt = Main.rand.Next(1, 3); + if (Main.getGoodWorld && Main.rand.NextBool(15)) + { + Projectile.NewProjectile(new EntitySource_ShakeTree(x, y), x * 16, y * 16, Main.rand.NextFloat(-100f, 100f) * 0.002f, 0f, ProjectileID.Bomb, 0, 0f, Player.FindClosest(new Vector2(x * 16, y * 16), 16, 16)); + } + else if (Main.rand.NextBool(7)) + { + createLeaves = true; + Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), x * 16, y * 16, 16, 16, ItemID.Acorn, randAmt); + } + else if (Main.rand.NextBool(35) && Main.halloween) + { + createLeaves = true; + Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), x * 16, y * 16, 16, 16, ItemID.RottenEgg, randAmt); + } + else if (Main.rand.NextBool(12)) + { + createLeaves = true; + Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), x * 16, y * 16, 16, 16, DropWood(), Main.rand.Next(1, 4)); + } + else if (Main.rand.NextBool(20)) + { + createLeaves = true; + int coin = ItemID.CopperCoin; + int amount = Main.rand.Next(50, 100); + if (Main.rand.NextBool(30)) + { + coin = ItemID.GoldCoin; + amount = 1; + if (Main.rand.NextBool(5)) + amount++; - if (Main.rand.NextBool(10)) - amount++; - } - else if (Main.rand.NextBool(10)) - { - coin = ItemID.SilverCoin; - amount = Main.rand.Next(1, 21); - if (Main.rand.NextBool(3)) - amount += Main.rand.Next(1, 21); + if (Main.rand.NextBool(10)) + amount++; + } + else if (Main.rand.NextBool(10)) + { + coin = ItemID.SilverCoin; + amount = Main.rand.Next(1, 21); + if (Main.rand.NextBool(3)) + amount += Main.rand.Next(1, 21); - if (Main.rand.NextBool(4)) - amount += Main.rand.Next(1, 21); - } + if (Main.rand.NextBool(4)) + amount += Main.rand.Next(1, 21); + } - Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), x * 16, y * 16, 16, 16, coin, amount); - } - else if (Main.rand.NextBool(20)) - { - createLeaves = true; - int type = ModContent.NPCType(); - if (Main.raining) - type = NPCID.EnchantedNightcrawler; - NPC.NewNPC(new EntitySource_ShakeTree(x, y), x * 16, y * 16, type); - } - else if (Main.rand.NextBool(15)) - { - createLeaves = true; - int type = ModContent.ItemType(); - if (!Main.dayTime && Main.rand.NextBool()) - type = ItemID.FallenStar; - Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), new Vector2(x, y) * 16, type, randAmt); - } - return false; - } + Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), x * 16, y * 16, 16, 16, coin, amount); + } + else if (Main.rand.NextBool(20)) + { + createLeaves = true; + int type = ModContent.NPCType(); + if (Main.raining) + type = NPCID.EnchantedNightcrawler; + NPC.NewNPC(new EntitySource_ShakeTree(x, y), x * 16, y * 16, type); + } + else if (Main.rand.NextBool(15)) + { + createLeaves = true; + int type = ModContent.ItemType(); + if (!Main.dayTime && Main.rand.NextBool()) + type = ItemID.FallenStar; + Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), new Vector2(x, y) * 16, type, randAmt); + } + return false; + } } } diff --git a/Tiles/Astral/AstralTreeSapling.cs b/Tiles/Astral/AstralTreeSapling.cs index 4b067d9775..705fb2d3fb 100644 --- a/Tiles/Astral/AstralTreeSapling.cs +++ b/Tiles/Astral/AstralTreeSapling.cs @@ -24,8 +24,8 @@ namespace CalamityMod.Tiles.Astral Main.tileLavaDeath[Type] = true; TileID.Sets.CommonSapling[Type] = true; TileID.Sets.TreeSapling[Type] = true; - TileID.Sets.SwaysInWindBasic[Type] = true; - TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Plant"]); + TileID.Sets.SwaysInWindBasic[Type] = true; + TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Plant"]); TileObjectData.newTile.Width = 1; TileObjectData.newTile.Height = 2; TileObjectData.newTile.Origin = new Point16(0, 1); @@ -53,7 +53,7 @@ namespace CalamityMod.Tiles.Astral public override void RandomUpdate(int i, int j) { - if (WorldGen.genRand.Next(20) == 0) + if (WorldGen.genRand.NextBool(20)) { bool isPlayerNear = WorldGen.PlayerLOS(i, j); bool success = WorldGen.GrowTree(i, j); diff --git a/Tiles/Astral/AstralVines.cs b/Tiles/Astral/AstralVines.cs index 761bad74ab..45c6249fb2 100644 --- a/Tiles/Astral/AstralVines.cs +++ b/Tiles/Astral/AstralVines.cs @@ -19,11 +19,11 @@ namespace CalamityMod.Tiles.Astral Main.tileBlockLight[Type] = true; Main.tileLavaDeath[Type] = true; Main.tileNoFail[Type] = true; - TileID.Sets.IsVine[Type] = true; - TileID.Sets.ReplaceTileBreakDown[Type] = true; + TileID.Sets.IsVine[Type] = true; + TileID.Sets.ReplaceTileBreakDown[Type] = true; TileID.Sets.VineThreads[Type] = true; - TileID.Sets.DrawFlipMode[Type] = 1; - TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Plant"]); + TileID.Sets.DrawFlipMode[Type] = 1; + TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Plant"]); DustType = ModContent.DustType(); diff --git a/Tiles/Astral/MonolithCrateTile.cs b/Tiles/Astral/MonolithCrateTile.cs new file mode 100644 index 0000000000..0041748d77 --- /dev/null +++ b/Tiles/Astral/MonolithCrateTile.cs @@ -0,0 +1,46 @@ +using CalamityMod.Dusts; +using CalamityMod.Items.Fishing.AstralCatches; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Astral +{ + public class MonolithCrateTile : ModTile + { + public override void SetStaticDefaults() + { + Main.tileSolidTop[Type] = true; + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileTable[Type] = true; + Main.tileLavaDeath[Type] = true; + Main.tileWaterDeath[Type] = false; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.addTile(Type); + AddMapEntry(new Color(110, 45, 117), CalamityUtils.GetItemName()); + DustType = ModContent.DustType(); + } + + public override bool CreateDust(int i, int j, ref int type) + { + if (Main.rand.NextBool()) + { + type = ModContent.DustType(); + } + else + { + type = ModContent.DustType(); + } + return true; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } +} diff --git a/Tiles/Astral/MonolithCrateTile.png b/Tiles/Astral/MonolithCrateTile.png new file mode 100644 index 0000000000..a01c24e2fa Binary files /dev/null and b/Tiles/Astral/MonolithCrateTile.png differ diff --git a/Tiles/Astral/NovaeSlag.cs b/Tiles/Astral/NovaeSlag.cs index 01539703e5..60fd932b1d 100644 --- a/Tiles/Astral/NovaeSlag.cs +++ b/Tiles/Astral/NovaeSlag.cs @@ -1,7 +1,9 @@ -using CalamityMod.Dusts; +using System.Collections.Generic; +using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.GameContent.Metadata; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -9,15 +11,15 @@ using Terraria.ModLoader; namespace CalamityMod.Tiles.Astral { [LegacyName("AstralSilt")] - public class NovaeSlag : ModTile + public class NovaeSlag : ModTile, IMergeableTile { - public byte[,] tileAdjacency; - public byte[,] secondTileAdjacency; - public byte[,] thirdTileAdjacency; + List IMergeableTile.TileAdjacencies { get; } = []; + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; + TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Sand"]); CalamityUtils.MergeWithGeneral(Type); CalamityUtils.MergeAstralTiles(Type); @@ -31,9 +33,9 @@ namespace CalamityMod.Tiles.Astral TileID.Sets.CanBeClearedDuringOreRunner[Type] = true; TileID.Sets.CanBeDugByShovel[Type] = true; - TileFraming.SetUpUniversalMerge(Type, TileID.Dirt, out tileAdjacency); - TileFraming.SetUpUniversalMerge(Type, TileID.Stone, out secondTileAdjacency); - TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out thirdTileAdjacency); + this.RegisterUniversalMerge(TileID.Dirt, "CalamityMod/Tiles/Merges/DirtMerge"); + this.RegisterUniversalMerge(TileID.Stone, "CalamityMod/Tiles/Merges/StoneMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/AstralDirtMerge"); } public override bool CreateDust(int i, int j, ref int type) @@ -43,21 +45,6 @@ namespace CalamityMod.Tiles.Astral return false; } - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) - { - TileFraming.DrawUniversalMergeFrames(i, j, thirdTileAdjacency, "CalamityMod/Tiles/Merges/AstralDirtMerge"); - TileFraming.DrawUniversalMergeFrames(i, j, secondTileAdjacency, "CalamityMod/Tiles/Merges/StoneMerge"); - TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/DirtMerge"); - } - - public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) - { - TileFraming.GetAdjacencyData(i, j, TileID.Dirt, out tileAdjacency[i, j]); - TileFraming.GetAdjacencyData(i, j, TileID.Stone, out secondTileAdjacency[i, j]); - TileFraming.GetAdjacencyData(i, j, ModContent.TileType(), out thirdTileAdjacency[i, j]); - return true; - } - public override void NumDust(int i, int j, bool fail, ref int num) { num = fail ? 1 : 3; diff --git a/Tiles/AstralBrick.cs b/Tiles/AstralBrick.cs index 5c2f42bb3f..3af5cfe613 100644 --- a/Tiles/AstralBrick.cs +++ b/Tiles/AstralBrick.cs @@ -1,20 +1,21 @@ -using CalamityMod.Dusts; +using System.Collections.Generic; +using CalamityMod.Dusts; +using CalamityMod.Tiles.Astral; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using CalamityMod.Tiles.Astral; using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Tiles { - public class AstralBrick : ModTile + public class AstralBrick : ModTile, IMergeableTile { private const short subsheetWidth = 324; private const short subsheetHeight = 90; - public byte[,] tileAdjacency; - public byte[,] secondTileAdjacency; + List IMergeableTile.TileAdjacencies { get; } = []; + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; @@ -22,8 +23,8 @@ namespace CalamityMod.Tiles HitSound = SoundID.Tink; AddMapEntry(new Color(128, 128, 158)); - TileFraming.SetUpUniversalMerge(Type, TileID.Dirt, out tileAdjacency); - TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out secondTileAdjacency); + this.RegisterUniversalMerge(TileID.Dirt, "CalamityMod/Tiles/Merges/DirtMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/AstralDirtMerge"); } public override bool CreateDust(int i, int j, ref int type) @@ -34,8 +35,6 @@ namespace CalamityMod.Tiles public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { - TileFraming.GetAdjacencyData(i, j, TileID.Dirt, out tileAdjacency[i, j]); - TileFraming.GetAdjacencyData(i, j, ModContent.TileType(), out secondTileAdjacency[i, j]); return TileFraming.BetterGemsparkFraming(i, j, resetFrame); } @@ -64,9 +63,6 @@ namespace CalamityMod.Tiles Tile trackTile = Main.tile[i, j]; TileFraming.SlopedGlowmask(i, j, 0, glowmask, drawOffset, null, GetDrawColour(i, j, drawColour), default); - - TileFraming.DrawUniversalMergeFrames(i, j, secondTileAdjacency, "CalamityMod/Tiles/Merges/AstralDirtMerge"); - TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/DirtMerge"); } private Color GetDrawColour(int i, int j, Color colour) diff --git a/Tiles/AstralDesert/AstralCactus.cs b/Tiles/AstralDesert/AstralCactus.cs index 037c9f5113..fa99db5039 100644 --- a/Tiles/AstralDesert/AstralCactus.cs +++ b/Tiles/AstralDesert/AstralCactus.cs @@ -1,6 +1,6 @@ using Microsoft.Xna.Framework.Graphics; -using Terraria.ModLoader; using ReLogic.Content; +using Terraria.ModLoader; namespace CalamityMod.Tiles.AstralDesert { diff --git a/Tiles/AstralDesert/AstralPalmSapling.cs b/Tiles/AstralDesert/AstralPalmSapling.cs index 9f68839706..72d44643b0 100644 --- a/Tiles/AstralDesert/AstralPalmSapling.cs +++ b/Tiles/AstralDesert/AstralPalmSapling.cs @@ -24,8 +24,8 @@ namespace CalamityMod.Tiles.AstralDesert Main.tileLavaDeath[Type] = true; TileID.Sets.CommonSapling[Type] = true; TileID.Sets.TreeSapling[Type] = true; - TileID.Sets.SwaysInWindBasic[Type] = true; - TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Plant"]); + TileID.Sets.SwaysInWindBasic[Type] = true; + TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Plant"]); TileObjectData.newTile.Width = 1; TileObjectData.newTile.Height = 2; TileObjectData.newTile.Origin = new Point16(0, 1); @@ -51,10 +51,10 @@ namespace CalamityMod.Tiles.AstralDesert num = fail ? 1 : 3; } - + public override void RandomUpdate(int i, int j) { - if (WorldGen.genRand.Next(20) == 0 || true) + if (WorldGen.genRand.NextBool(20)|| true) { bool isPlayerNear = WorldGen.PlayerLOS(i, j); diff --git a/Tiles/AstralDesert/AstralPalmTree.cs b/Tiles/AstralDesert/AstralPalmTree.cs index cc47e93524..4ccdbe2be0 100644 --- a/Tiles/AstralDesert/AstralPalmTree.cs +++ b/Tiles/AstralDesert/AstralPalmTree.cs @@ -49,64 +49,64 @@ namespace CalamityMod.Tiles.AstralDesert return ModContent.TileType(); } - public override int TreeLeaf() => ModContent.GoreType(); + public override int TreeLeaf() => ModContent.GoreType(); - // Returning false at the end prevents vanilla behavior as the default is palm tree behavior which can include undesirable stuff like seagulls - public override bool Shake(int x, int y, ref bool createLeaves) - { - int randAmt = Main.rand.Next(1, 3); - - if (Main.getGoodWorld && Main.rand.NextBool(15)) - { - Projectile.NewProjectile(new EntitySource_ShakeTree(x, y), x * 16, y * 16, Main.rand.NextFloat(-100f, 100f) * 0.002f, 0f, ProjectileID.Bomb, 0, 0f, Player.FindClosest(new Vector2(x * 16, y * 16), 16, 16)); - } - else if (Main.rand.NextBool(35) && Main.halloween) - { - createLeaves = true; - Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), x * 16, y * 16, 16, 16, ItemID.RottenEgg, randAmt); - } - else if (Main.rand.NextBool(12)) // 1-3 Astral Monolith - { - createLeaves = true; - Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), x * 16, y * 16, 16, 16, DropWood(), Main.rand.Next(1, 4)); - } - else if (Main.rand.NextBool(20)) - { - createLeaves = true; - int coin = ItemID.CopperCoin; - int amount = Main.rand.Next(50, 100); - if (Main.rand.NextBool(30)) - { - coin = ItemID.GoldCoin; - amount = 1; - if (Main.rand.NextBool(5)) - amount++; + // Returning false at the end prevents vanilla behavior as the default is palm tree behavior which can include undesirable stuff like seagulls + public override bool Shake(int x, int y, ref bool createLeaves) + { + int randAmt = Main.rand.Next(1, 3); - if (Main.rand.NextBool(10)) - amount++; - } - else if (Main.rand.NextBool(10)) - { - coin = ItemID.SilverCoin; - amount = Main.rand.Next(1, 21); - if (Main.rand.NextBool(3)) - amount += Main.rand.Next(1, 21); + if (Main.getGoodWorld && Main.rand.NextBool(15)) + { + Projectile.NewProjectile(new EntitySource_ShakeTree(x, y), x * 16, y * 16, Main.rand.NextFloat(-100f, 100f) * 0.002f, 0f, ProjectileID.Bomb, 0, 0f, Player.FindClosest(new Vector2(x * 16, y * 16), 16, 16)); + } + else if (Main.rand.NextBool(35) && Main.halloween) + { + createLeaves = true; + Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), x * 16, y * 16, 16, 16, ItemID.RottenEgg, randAmt); + } + else if (Main.rand.NextBool(12)) // 1-3 Astral Monolith + { + createLeaves = true; + Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), x * 16, y * 16, 16, 16, DropWood(), Main.rand.Next(1, 4)); + } + else if (Main.rand.NextBool(20)) + { + createLeaves = true; + int coin = ItemID.CopperCoin; + int amount = Main.rand.Next(50, 100); + if (Main.rand.NextBool(30)) + { + coin = ItemID.GoldCoin; + amount = 1; + if (Main.rand.NextBool(5)) + amount++; - if (Main.rand.NextBool(4)) - amount += Main.rand.Next(1, 21); - } + if (Main.rand.NextBool(10)) + amount++; + } + else if (Main.rand.NextBool(10)) + { + coin = ItemID.SilverCoin; + amount = Main.rand.Next(1, 21); + if (Main.rand.NextBool(3)) + amount += Main.rand.Next(1, 21); - Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), x * 16, y * 16, 16, 16, coin, amount); - } - else if (Main.rand.NextBool(15)) - { - createLeaves = true; - int type = ModContent.ItemType(); - if (!Main.dayTime && Main.rand.NextBool()) - type = ItemID.FallenStar; - Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), new Vector2(x, y) * 16, type, randAmt); - } - return false; - } + if (Main.rand.NextBool(4)) + amount += Main.rand.Next(1, 21); + } + + Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), x * 16, y * 16, 16, 16, coin, amount); + } + else if (Main.rand.NextBool(15)) + { + createLeaves = true; + int type = ModContent.ItemType(); + if (!Main.dayTime && Main.rand.NextBool()) + type = ItemID.FallenStar; + Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), new Vector2(x, y) * 16, type, randAmt); + } + return false; + } } } diff --git a/Tiles/AstralDesert/AstralSand.cs b/Tiles/AstralDesert/AstralSand.cs index 46c4c4fdb1..b93e3e27db 100644 --- a/Tiles/AstralDesert/AstralSand.cs +++ b/Tiles/AstralDesert/AstralSand.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Typeless; +using System.Collections.Generic; +using CalamityMod.Projectiles.Typeless; using CalamityMod.Tiles.Astral; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -10,19 +11,17 @@ using Terraria.ModLoader; namespace CalamityMod.Tiles.AstralDesert { - public class AstralSand : ModTile + public class AstralSand : ModTile, IMergeableTile { - public byte[,] tileAdjacency; - public byte[,] secondTileAdjacency; - public byte[,] thirdTileAdjacency; - public byte[,] fourthTileAdjacency; + List IMergeableTile.TileAdjacencies { get; } = []; + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; Main.tileSand[Type] = true; Main.tileBrick[Type] = true; - TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Sand"]); + TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Sand"]); CalamityUtils.MergeWithGeneral(Type); CalamityUtils.MergeWithDesert(Type); @@ -37,43 +36,18 @@ namespace CalamityMod.Tiles.AstralDesert TileID.Sets.Conversion.Sand[Type] = true; TileID.Sets.ForAdvancedCollision.ForSandshark[Type] = true; TileID.Sets.Falling[Type] = true; + TileID.Sets.FallingBlockProjectile[Type] = new TileID.Sets.FallingBlockProjectileInfo(ModContent.ProjectileType(), 15); - TileFraming.SetUpUniversalMerge(Type, TileID.Dirt, out tileAdjacency); - TileFraming.SetUpUniversalMerge(Type, TileID.Stone, out secondTileAdjacency); - TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out thirdTileAdjacency); - TileFraming.SetUpUniversalMerge(Type, TileID.Sand, out fourthTileAdjacency); + this.RegisterUniversalMerge(TileID.Dirt, "CalamityMod/Tiles/Merges/DirtMerge"); + this.RegisterUniversalMerge(TileID.Stone, "CalamityMod/Tiles/Merges/StoneMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/AstralDirtMerge"); + this.RegisterUniversalMerge(TileID.Sand, "CalamityMod/Tiles/Merges/SandMerge"); } public override void NumDust(int i, int j, bool fail, ref int num) { num = fail ? 1 : 3; } - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) - { - TileFraming.DrawUniversalMergeFrames(i, j, fourthTileAdjacency, "CalamityMod/Tiles/Merges/SandMerge"); - TileFraming.DrawUniversalMergeFrames(i, j, thirdTileAdjacency, "CalamityMod/Tiles/Merges/AstralDirtMerge"); - TileFraming.DrawUniversalMergeFrames(i, j, secondTileAdjacency, "CalamityMod/Tiles/Merges/StoneMerge"); - TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/DirtMerge"); - } - public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) - { - if (j < Main.maxTilesY) - { - // tile[i, j+1] can still be null if it's on the edge of a chunk - if (!Main.tile[i, j + 1].HasTile) - { - Main.tile[i, j].Get().HasTile = false; - Projectile.NewProjectile(new EntitySource_TileBreak(i, j), new Vector2(i * 16f + 8f, j * 16f + 8f), Vector2.Zero, ModContent.ProjectileType(), 15, 0f); - WorldGen.SquareTileFrame(i, j); - return false; - } - } - TileFraming.GetAdjacencyData(i, j, TileID.Dirt, out tileAdjacency[i, j]); - TileFraming.GetAdjacencyData(i, j, TileID.Stone, out secondTileAdjacency[i, j]); - TileFraming.GetAdjacencyData(i, j, ModContent.TileType(), out thirdTileAdjacency[i, j]); - TileFraming.GetAdjacencyData(i, j, TileID.Sand, out fourthTileAdjacency[i, j]); - return true; - } public override bool HasWalkDust() { diff --git a/Tiles/AstralDesert/AstralSandstone.cs b/Tiles/AstralDesert/AstralSandstone.cs index c64c5bb851..026c0bf2df 100644 --- a/Tiles/AstralDesert/AstralSandstone.cs +++ b/Tiles/AstralDesert/AstralSandstone.cs @@ -1,4 +1,5 @@  +using System.Collections.Generic; using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -8,12 +9,10 @@ using Terraria.ModLoader; namespace CalamityMod.Tiles.AstralDesert { - public class AstralSandstone : ModTile + public class AstralSandstone : ModTile, IMergeableTile { - public byte[,] tileAdjacency; - public byte[,] secondTileAdjacency; - public byte[,] thirdTileAdjacency; - public byte[,] fourthTileAdjacency; + List IMergeableTile.TileAdjacencies { get; } = []; + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; @@ -30,25 +29,10 @@ namespace CalamityMod.Tiles.AstralDesert TileID.Sets.Conversion.Sandstone[Type] = true; TileID.Sets.ForAdvancedCollision.ForSandshark[Type] = true; - TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out tileAdjacency); - TileFraming.SetUpUniversalMerge(Type, TileID.Sandstone, out secondTileAdjacency); - TileFraming.SetUpUniversalMerge(Type, TileID.Sand, out thirdTileAdjacency); - TileFraming.SetUpUniversalMerge(Type, TileID.HardenedSand, out fourthTileAdjacency); - } - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) - { - TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/AstralSandMerge"); - TileFraming.DrawUniversalMergeFrames(i, j, secondTileAdjacency, "CalamityMod/Tiles/Merges/SandstoneMerge"); - TileFraming.DrawUniversalMergeFrames(i, j, thirdTileAdjacency, "CalamityMod/Tiles/Merges/SandMerge"); - TileFraming.DrawUniversalMergeFrames(i, j, fourthTileAdjacency, "CalamityMod/Tiles/Merges/HardenedSandMerge"); - } - public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) - { - TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/AstralSandMerge"); - TileFraming.DrawUniversalMergeFrames(i, j, secondTileAdjacency, "CalamityMod/Tiles/Merges/SandstoneMerge"); - TileFraming.DrawUniversalMergeFrames(i, j, thirdTileAdjacency, "CalamityMod/Tiles/Merges/SandMerge"); - TileFraming.DrawUniversalMergeFrames(i, j, fourthTileAdjacency, "CalamityMod/Tiles/Merges/HardenedSandMerge"); - return true; + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/AstralSandMerge"); + 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) diff --git a/Tiles/AstralDesert/CelestialRemains.cs b/Tiles/AstralDesert/CelestialRemains.cs index 03db9266b1..515e549546 100644 --- a/Tiles/AstralDesert/CelestialRemains.cs +++ b/Tiles/AstralDesert/CelestialRemains.cs @@ -1,4 +1,5 @@ -using CalamityMod.Dusts; +using System.Collections.Generic; +using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -9,10 +10,10 @@ using Terraria.ModLoader; namespace CalamityMod.Tiles.AstralDesert { [LegacyName("AstralFossil")] - public class CelestialRemains : ModTile + public class CelestialRemains : ModTile, IMergeableTile { - public byte[,] tileAdjacency; - public byte[,] secondTileAdjacency; + List IMergeableTile.TileAdjacencies { get; } = []; + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; @@ -28,19 +29,8 @@ namespace CalamityMod.Tiles.AstralDesert TileID.Sets.ForAdvancedCollision.ForSandshark[Type] = true; - TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out tileAdjacency); - TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out secondTileAdjacency); - } - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) - { - TileFraming.DrawUniversalMergeFrames(i, j, secondTileAdjacency, "CalamityMod/Tiles/Merges/AstralSandstoneMerge"); - TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/AstralSandMerge"); - } - public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) - { - TileFraming.GetAdjacencyData(i, j, ModContent.TileType(), out tileAdjacency[i, j]); - TileFraming.GetAdjacencyData(i, j, ModContent.TileType(), out secondTileAdjacency[i, j]); - return true; + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/AstralSandMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/AstralSandstoneMerge"); } public override void NumDust(int i, int j, bool fail, ref int num) diff --git a/Tiles/AstralDesert/HardenedAstralSand.cs b/Tiles/AstralDesert/HardenedAstralSand.cs index 452b866c98..0918cabd0a 100644 --- a/Tiles/AstralDesert/HardenedAstralSand.cs +++ b/Tiles/AstralDesert/HardenedAstralSand.cs @@ -1,4 +1,5 @@  +using System.Collections.Generic; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -7,13 +8,10 @@ using Terraria.ModLoader; namespace CalamityMod.Tiles.AstralDesert { - public class HardenedAstralSand : ModTile + public class HardenedAstralSand : ModTile, IMergeableTile { - public byte[,] tileAdjacency; - public byte[,] secondTileAdjacency; - public byte[,] thirdTileAdjacency; - public byte[,] fourthTileAdjacency; - public byte[,] fifthTileAdjacency; + List IMergeableTile.TileAdjacencies { get; } = []; + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; @@ -31,29 +29,11 @@ namespace CalamityMod.Tiles.AstralDesert TileID.Sets.Conversion.HardenedSand[Type] = true; TileID.Sets.ForAdvancedCollision.ForSandshark[Type] = true; - TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out tileAdjacency); - TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out secondTileAdjacency); - TileFraming.SetUpUniversalMerge(Type, TileID.Sandstone, out thirdTileAdjacency); - TileFraming.SetUpUniversalMerge(Type, TileID.HardenedSand, out fourthTileAdjacency); - TileFraming.SetUpUniversalMerge(Type, TileID.Sand, out fifthTileAdjacency); - } - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) - { - TileFraming.DrawUniversalMergeFrames(i, j, secondTileAdjacency, "CalamityMod/Tiles/Merges/AstralSandstoneMerge"); - TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/AstralSandMerge"); - TileFraming.DrawUniversalMergeFrames(i, j, thirdTileAdjacency, "CalamityMod/Tiles/Merges/SandstoneMerge"); - TileFraming.DrawUniversalMergeFrames(i, j, fourthTileAdjacency, "CalamityMod/Tiles/Merges/HardenedSandMerge"); - TileFraming.DrawUniversalMergeFrames(i, j, fifthTileAdjacency, "CalamityMod/Tiles/Merges/SandMerge"); - } - - public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) - { - TileFraming.GetAdjacencyData(i, j, ModContent.TileType(), out tileAdjacency[i, j]); - TileFraming.GetAdjacencyData(i, j, ModContent.TileType(), out secondTileAdjacency[i, j]); - TileFraming.GetAdjacencyData(i, j, TileID.Sandstone, out thirdTileAdjacency[i, j]); - TileFraming.GetAdjacencyData(i, j, TileID.HardenedSand, out fourthTileAdjacency[i, j]); - TileFraming.GetAdjacencyData(i, j, TileID.Sand, out fifthTileAdjacency[i, j]); - return true; + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/AstralSandMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/AstralSandstoneMerge"); + this.RegisterUniversalMerge(TileID.Sandstone, "CalamityMod/Tiles/Merges/SandstoneMerge"); + this.RegisterUniversalMerge(TileID.HardenedSand, "CalamityMod/Tiles/Merges/HardenedSandMerge"); + this.RegisterUniversalMerge(TileID.Sand, "CalamityMod/Tiles/Merges/SandMerge"); } public override void NumDust(int i, int j, bool fail, ref int num) diff --git a/Tiles/AstralSnow/AstralIce.cs b/Tiles/AstralSnow/AstralIce.cs index 9d3ccb0c09..a339f14e98 100644 --- a/Tiles/AstralSnow/AstralIce.cs +++ b/Tiles/AstralSnow/AstralIce.cs @@ -1,4 +1,5 @@ -using CalamityMod.Tiles.Astral; +using System.Collections.Generic; +using CalamityMod.Tiles.Astral; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -8,16 +9,16 @@ using Terraria.ModLoader; namespace CalamityMod.Tiles.AstralSnow { - public class AstralIce : ModTile + public class AstralIce : ModTile, IMergeableTile { - public byte[,] tileAdjacency; - public byte[,] secondTileAdjacency; + List IMergeableTile.TileAdjacencies { get; } = []; + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; Main.tileBrick[Type] = true; - TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Ice"]); + TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Ice"]); CalamityUtils.MergeWithGeneral(Type); CalamityUtils.MergeWithSnow(Type); @@ -36,8 +37,8 @@ namespace CalamityMod.Tiles.AstralSnow TileID.Sets.Conversion.Ice[Type] = true; TileID.Sets.CanBeClearedDuringOreRunner[Type] = true; - TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out tileAdjacency); - TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out secondTileAdjacency); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/AstralSnowMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/AstralDirtMerge"); } public override void NumDust(int i, int j, bool fail, ref int num) @@ -51,19 +52,6 @@ namespace CalamityMod.Tiles.AstralSnow base.FloorVisuals(player); } - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) - { - TileFraming.DrawUniversalMergeFrames(i, j, secondTileAdjacency, "CalamityMod/Tiles/Merges/AstralDirtMerge"); - TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/AstralSnowMerge"); - } - - public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) - { - TileFraming.GetAdjacencyData(i, j, ModContent.TileType(), out tileAdjacency[i, j]); - TileFraming.GetAdjacencyData(i, j, ModContent.TileType(), out secondTileAdjacency[i, j]); - return true; - } - public override bool IsTileBiomeSightable(int i, int j, ref Color sightColor) { sightColor = Color.Cyan; diff --git a/Tiles/AstralSnow/AstralSnow.cs b/Tiles/AstralSnow/AstralSnow.cs index 2fcbde0bc9..6ab01d8390 100644 --- a/Tiles/AstralSnow/AstralSnow.cs +++ b/Tiles/AstralSnow/AstralSnow.cs @@ -1,4 +1,5 @@ -using CalamityMod.Tiles.Astral; +using System.Collections.Generic; +using CalamityMod.Tiles.Astral; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -8,16 +9,16 @@ using Terraria.ModLoader; namespace CalamityMod.Tiles.AstralSnow { - public class AstralSnow : ModTile + public class AstralSnow : ModTile, IMergeableTile { - public byte[,] tileAdjacency; - public byte[,] secondTileAdjacency; + List IMergeableTile.TileAdjacencies { get; } = []; + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; Main.tileBrick[Type] = true; - TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Snow"]); + TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Snow"]); CalamityUtils.MergeWithGeneral(Type); CalamityUtils.MergeWithSnow(Type); @@ -33,26 +34,14 @@ namespace CalamityMod.Tiles.AstralSnow TileID.Sets.ChecksForMerge[Type] = true; TileID.Sets.CanBeClearedDuringOreRunner[Type] = true; - TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out tileAdjacency); - TileFraming.SetUpUniversalMerge(Type, TileID.SnowBlock, out secondTileAdjacency); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/AstralDirtMerge"); + this.RegisterUniversalMerge(TileID.SnowBlock, "CalamityMod/Tiles/Merges/SnowMerge"); } public override void NumDust(int i, int j, bool fail, ref int num) { num = fail ? 1 : 3; } - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) - { - TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/AstralDirtMerge"); - TileFraming.DrawUniversalMergeFrames(i, j, secondTileAdjacency, "CalamityMod/Tiles/Merges/SnowMerge"); - } - - public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) - { - TileFraming.GetAdjacencyData(i, j, ModContent.TileType(), out tileAdjacency[i, j]); - TileFraming.GetAdjacencyData(i, j, TileID.SnowBlock, out secondTileAdjacency[i, j]); - return true; - } public override bool IsTileBiomeSightable(int i, int j, ref Color sightColor) { diff --git a/Tiles/AstralSnow/AstralSnowTree.cs b/Tiles/AstralSnow/AstralSnowTree.cs index 604c8dc8b1..f36ecac3c4 100644 --- a/Tiles/AstralSnow/AstralSnowTree.cs +++ b/Tiles/AstralSnow/AstralSnowTree.cs @@ -54,75 +54,75 @@ namespace CalamityMod.Tiles.AstralSnow return ModContent.TileType(); } - public override int TreeLeaf() => ModContent.GoreType(); + public override int TreeLeaf() => ModContent.GoreType(); - // Returning false at the end prevents vanilla behavior as the default is forest tree behavior which can include undesirable stuff like squirrels and butterflies - public override bool Shake(int x, int y, ref bool createLeaves) - { - int randAmt = Main.rand.Next(1, 3); - - if (Main.getGoodWorld && Main.rand.NextBool(15)) - { - Projectile.NewProjectile(new EntitySource_ShakeTree(x, y), x * 16, y * 16, Main.rand.NextFloat(-100f, 100f) * 0.002f, 0f, ProjectileID.Bomb, 0, 0f, Player.FindClosest(new Vector2(x * 16, y * 16), 16, 16)); - } - else if (Main.rand.NextBool(7)) - { - createLeaves = true; - Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), x * 16, y * 16, 16, 16, ItemID.Acorn, randAmt); - } - else if (Main.rand.NextBool(35) && Main.halloween) - { - createLeaves = true; - Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), x * 16, y * 16, 16, 16, ItemID.RottenEgg, randAmt); - } - else if (Main.rand.NextBool(12)) - { - createLeaves = true; - Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), x * 16, y * 16, 16, 16, DropWood(), Main.rand.Next(1, 4)); - } - else if (Main.rand.NextBool(20)) - { - createLeaves = true; - int coin = ItemID.CopperCoin; - int amount = Main.rand.Next(50, 100); - if (Main.rand.NextBool(30)) - { - coin = ItemID.GoldCoin; - amount = 1; - if (Main.rand.NextBool(5)) - amount++; + // Returning false at the end prevents vanilla behavior as the default is forest tree behavior which can include undesirable stuff like squirrels and butterflies + public override bool Shake(int x, int y, ref bool createLeaves) + { + int randAmt = Main.rand.Next(1, 3); - if (Main.rand.NextBool(10)) - amount++; - } - else if (Main.rand.NextBool(10)) - { - coin = ItemID.SilverCoin; - amount = Main.rand.Next(1, 21); - if (Main.rand.NextBool(3)) - amount += Main.rand.Next(1, 21); + if (Main.getGoodWorld && Main.rand.NextBool(15)) + { + Projectile.NewProjectile(new EntitySource_ShakeTree(x, y), x * 16, y * 16, Main.rand.NextFloat(-100f, 100f) * 0.002f, 0f, ProjectileID.Bomb, 0, 0f, Player.FindClosest(new Vector2(x * 16, y * 16), 16, 16)); + } + else if (Main.rand.NextBool(7)) + { + createLeaves = true; + Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), x * 16, y * 16, 16, 16, ItemID.Acorn, randAmt); + } + else if (Main.rand.NextBool(35) && Main.halloween) + { + createLeaves = true; + Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), x * 16, y * 16, 16, 16, ItemID.RottenEgg, randAmt); + } + else if (Main.rand.NextBool(12)) + { + createLeaves = true; + Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), x * 16, y * 16, 16, 16, DropWood(), Main.rand.Next(1, 4)); + } + else if (Main.rand.NextBool(20)) + { + createLeaves = true; + int coin = ItemID.CopperCoin; + int amount = Main.rand.Next(50, 100); + if (Main.rand.NextBool(30)) + { + coin = ItemID.GoldCoin; + amount = 1; + if (Main.rand.NextBool(5)) + amount++; - if (Main.rand.NextBool(4)) - amount += Main.rand.Next(1, 21); - } + if (Main.rand.NextBool(10)) + amount++; + } + else if (Main.rand.NextBool(10)) + { + coin = ItemID.SilverCoin; + amount = Main.rand.Next(1, 21); + if (Main.rand.NextBool(3)) + amount += Main.rand.Next(1, 21); - Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), x * 16, y * 16, 16, 16, coin, amount); - } - else if (Main.rand.NextBool(20)) - { - createLeaves = true; - int type = ModContent.NPCType(); - NPC.NewNPC(new EntitySource_ShakeTree(x, y), x * 16, y * 16, type); - } - else if (Main.rand.NextBool(15)) - { - createLeaves = true; - int type = ModContent.ItemType(); - if (!Main.dayTime && Main.rand.NextBool()) - type = ItemID.FallenStar; - Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), new Vector2(x, y) * 16, type, randAmt); - } - return false; - } + if (Main.rand.NextBool(4)) + amount += Main.rand.Next(1, 21); + } + + Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), x * 16, y * 16, 16, 16, coin, amount); + } + else if (Main.rand.NextBool(20)) + { + createLeaves = true; + int type = ModContent.NPCType(); + NPC.NewNPC(new EntitySource_ShakeTree(x, y), x * 16, y * 16, type); + } + else if (Main.rand.NextBool(15)) + { + createLeaves = true; + int type = ModContent.ItemType(); + if (!Main.dayTime && Main.rand.NextBool()) + type = ItemID.FallenStar; + Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), new Vector2(x, y) * 16, type, randAmt); + } + return false; + } } } diff --git a/Tiles/AstralSnow/AstralSnowTreeSapling.cs b/Tiles/AstralSnow/AstralSnowTreeSapling.cs index e578a486bf..f1fdc9cb96 100644 --- a/Tiles/AstralSnow/AstralSnowTreeSapling.cs +++ b/Tiles/AstralSnow/AstralSnowTreeSapling.cs @@ -24,8 +24,8 @@ namespace CalamityMod.Tiles.AstralSnow Main.tileLavaDeath[Type] = true; TileID.Sets.TreeSapling[Type] = true; TileID.Sets.CommonSapling[Type] = true; - TileID.Sets.SwaysInWindBasic[Type] = true; - TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Plant"]); + TileID.Sets.SwaysInWindBasic[Type] = true; + TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Plant"]); TileObjectData.newTile.Width = 1; TileObjectData.newTile.Height = 2; TileObjectData.newTile.Origin = new Point16(0, 1); @@ -53,7 +53,7 @@ namespace CalamityMod.Tiles.AstralSnow public override void RandomUpdate(int i, int j) { - if (WorldGen.genRand.Next(20) == 0) + if (WorldGen.genRand.NextBool(20)) { bool isPlayerNear = WorldGen.PlayerLOS(i, j); bool success = WorldGen.GrowTree(i, j); diff --git a/Tiles/BaseTiles/DoubleDirectionalTile.cs b/Tiles/BaseTiles/DoubleDirectionalTile.cs index 0edcc1b8b3..221df5e496 100644 --- a/Tiles/BaseTiles/DoubleDirectionalTile.cs +++ b/Tiles/BaseTiles/DoubleDirectionalTile.cs @@ -1,6 +1,6 @@ -using Terraria; +using System.Linq; +using Terraria; using Terraria.ModLoader; -using System.Linq; namespace CalamityMod.Tiles.BaseTiles { diff --git a/Tiles/CalamityGlobalTile.cs b/Tiles/CalamityGlobalTile.cs index 66982b5582..d3bdbfd406 100644 --- a/Tiles/CalamityGlobalTile.cs +++ b/Tiles/CalamityGlobalTile.cs @@ -1,4 +1,8 @@ -using CalamityMod.Events; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using CalamityMod.Events; using CalamityMod.Items.Accessories.Vanity; using CalamityMod.Items.VanillaArmorChanges; using CalamityMod.Items.Weapons.Melee; @@ -6,22 +10,18 @@ using CalamityMod.Tiles.Abyss; using CalamityMod.Tiles.Abyss.AbyssAmbient; using CalamityMod.Tiles.Astral; using CalamityMod.Tiles.AstralDesert; +using CalamityMod.Tiles.Crags; using CalamityMod.Tiles.DraedonStructures; using CalamityMod.Tiles.DraedonSummoner; using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.SunkenSea; -using CalamityMod.Tiles.Crags; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; using Terraria; using Terraria.DataStructures; using Terraria.Enums; using Terraria.ID; using Terraria.ModLoader; -using System; namespace CalamityMod.Tiles { @@ -364,10 +364,10 @@ namespace CalamityMod.Tiles player.breath = player.breathMax; } - // Mining set gives a chance for additional ore. This can be abused for infinite ore but it has a cooldown to prevent too much abuse + // Mining set gives a chance for additional ore. This can be abused for infinite ore but it has a cooldown to prevent too much abuse if (player.Calamity().miningSet && player.Calamity().miningSetCooldown <= 0 && !fail && TileID.Sets.Ore[tile.TileType]) { - // 25% chance for additional ore + // 25% chance for additional ore if (!Main.rand.NextBool(MiningArmorSetChange.BonusOreChance)) return; diff --git a/Tiles/Crags/BrimstoneSlab.cs b/Tiles/Crags/BrimstoneSlab.cs index 5d10da71e6..04d2cd4666 100644 --- a/Tiles/Crags/BrimstoneSlab.cs +++ b/Tiles/Crags/BrimstoneSlab.cs @@ -1,20 +1,20 @@ -using CalamityMod.Tiles.Crags; +using System.Collections.Generic; +using CalamityMod.Tiles.Crags; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; -using Terraria.ID; -using Microsoft.Xna.Framework.Graphics; namespace CalamityMod.Tiles.Crags { - public class BrimstoneSlab : ModTile + public class BrimstoneSlab : ModTile, IMergeableTile { private int subsheetWidth = 450; private int subsheetHeight = 198; - public byte[,] tileAdjacency; - public byte[,] secondTileAdjacency; + List IMergeableTile.TileAdjacencies { get; } = []; public override void SetStaticDefaults() { @@ -30,8 +30,8 @@ namespace CalamityMod.Tiles.Crags HitSound = SoundID.Tink; DustType = 235; - TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out tileAdjacency); - TileFraming.SetUpUniversalMerge(Type, TileID.Ash, out secondTileAdjacency); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/BrimstoneSlagMerge"); + this.RegisterUniversalMerge(TileID.Ash, "CalamityMod/Tiles/Merges/AshMerge"); } public override bool CanExplode(int i, int j) @@ -49,15 +49,9 @@ namespace CalamityMod.Tiles.Crags frameXOffset = i % 2 * subsheetWidth; frameYOffset = j % 2 * subsheetHeight; } - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) - { - TileFraming.DrawUniversalMergeFrames(i, j, secondTileAdjacency, "CalamityMod/Tiles/Merges/AshMerge"); - TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/BrimstoneSlagMerge"); - } + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { - TileFraming.GetAdjacencyData(i, j, ModContent.TileType(), out tileAdjacency[i, j]); - TileFraming.GetAdjacencyData(i, j, TileID.Ash, out secondTileAdjacency[i, j]); return TileFraming.BrimstoneFraming(i, j, resetFrame); } } diff --git a/Tiles/Crags/BrimstoneSlag.cs b/Tiles/Crags/BrimstoneSlag.cs index 080d01894f..3a1a485968 100644 --- a/Tiles/Crags/BrimstoneSlag.cs +++ b/Tiles/Crags/BrimstoneSlag.cs @@ -1,17 +1,20 @@ -using CalamityMod.Tiles.Ores; +using System.Collections.Generic; +using CalamityMod.Tiles.Ores; using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Tiles.Crags { - public class BrimstoneSlag : ModTile + public class BrimstoneSlag : ModTile, IMergeableTile { private const short subsheetWidth = 450; private const short subsheetHeight = 198; - public byte[,] TileAdjacency; + + List IMergeableTile.TileAdjacencies { get; } = []; + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; @@ -25,13 +28,13 @@ namespace CalamityMod.Tiles.Crags MineResist = 2f; MinPick = 100; AddMapEntry(new Color(53, 33, 56)); - TileFraming.SetUpUniversalMerge(Type, TileID.Ash, out TileAdjacency); + this.RegisterUniversalMerge(TileID.Ash, "CalamityMod/Tiles/Merges/AshMerge"); } public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 100, 100), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.RedTorch, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 100, 100), 1f); return false; } @@ -45,14 +48,8 @@ namespace CalamityMod.Tiles.Crags frameXOffset = i % 2 * subsheetWidth; frameYOffset = j % 2 * subsheetHeight; } - - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) - { - TileFraming.DrawUniversalMergeFrames(i, j, TileAdjacency, "CalamityMod/Tiles/Merges/AshMerge"); - } public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { - TileFraming.GetAdjacencyData(i, j, TileID.Ash, out TileAdjacency[i, j]); return TileFraming.BrimstoneFraming(i, j, resetFrame); } diff --git a/Tiles/Crags/CinderBlossomTallPlants.cs b/Tiles/Crags/CinderBlossomTallPlants.cs index 8cc68dd2bf..4fb65d3700 100644 --- a/Tiles/Crags/CinderBlossomTallPlants.cs +++ b/Tiles/Crags/CinderBlossomTallPlants.cs @@ -20,9 +20,9 @@ namespace CalamityMod.Tiles.Crags Main.tileLavaDeath[Type] = true; Main.tileWaterDeath[Type] = true; Main.tileFrameImportant[Type] = true; - TileID.Sets.ReplaceTileBreakUp[Type] = true; - TileID.Sets.SwaysInWindBasic[Type] = true; - TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Plant"]); + TileID.Sets.ReplaceTileBreakUp[Type] = true; + TileID.Sets.SwaysInWindBasic[Type] = true; + TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Plant"]); TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2); TileObjectData.addTile(Type); @@ -40,9 +40,9 @@ namespace CalamityMod.Tiles.Crags height = 48; } - public override void KillMultiTile(int i, int j, int frameX, int frameY) + public override void KillMultiTile(int i, int j, int frameX, int frameY) { - if (Main.rand.Next(20) == 0) + if (Main.rand.NextBool(20)) { Item.NewItem(new EntitySource_TileBreak(i, j), new Vector2(i, j) * 16f, ModContent.ItemType()); } diff --git a/Tiles/Crags/GloomTorch.cs b/Tiles/Crags/GloomTorch.cs index 5de2aaa68f..025bc99438 100644 --- a/Tiles/Crags/GloomTorch.cs +++ b/Tiles/Crags/GloomTorch.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.Crags @@ -12,7 +13,7 @@ namespace CalamityMod.Tiles.Crags 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(190, 255, 60), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(190, 255, 60), 1f); return false; } @@ -71,10 +72,10 @@ namespace CalamityMod.Tiles.Crags return true; } - public override float GetTorchLuck(Player player) - { - // Note: Total Torch luck never goes below zero - return player.Calamity().ZoneCalamity ? 1f : -1f; - } + public override float GetTorchLuck(Player player) + { + // Note: Total Torch luck never goes below zero + return player.Calamity().ZoneCalamity ? 1f : -1f; + } } } diff --git a/Tiles/Crags/LavaPistil.cs b/Tiles/Crags/LavaPistil.cs index 1bebbdc4bb..c026fb1293 100644 --- a/Tiles/Crags/LavaPistil.cs +++ b/Tiles/Crags/LavaPistil.cs @@ -23,8 +23,8 @@ namespace CalamityMod.Tiles.Crags Main.tileFrameImportant[Type] = true; Main.tileLighted[Type] = true; TileID.Sets.ReplaceTileBreakUp[Type] = true; - TileID.Sets.SwaysInWindBasic[Type] = false; - TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Plant"]); + TileID.Sets.SwaysInWindBasic[Type] = false; + TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Plant"]); TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2); TileObjectData.addTile(Type); diff --git a/Tiles/Crags/LiliesOfFinalityTile.cs b/Tiles/Crags/LiliesOfFinalityTile.cs new file mode 100644 index 0000000000..ecba022dc7 --- /dev/null +++ b/Tiles/Crags/LiliesOfFinalityTile.cs @@ -0,0 +1,46 @@ +using CalamityMod.Items.Weapons.Summon; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Crags +{ + public class LiliesOfFinalityTile : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileSpelunker[Type] = true; + Main.tileLighted[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + + TileObjectData.addTile(Type); + + AddMapEntry(Color.White, CalamityUtils.GetItemName()); + TileID.Sets.DisableSmartCursor[Type] = true; + RegisterItemDrop(ModContent.ItemType()); + FlexibleTileWand.RubblePlacementLarge.AddVariations(ModContent.ItemType(), Type, 0); + HitSound = new("CalamityMod/Sounds/Custom/LiliesOfFinalityTileHitSound"); + + DustType = DustID.GemDiamond; + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) => r = g = b = 0.5f; + + public override bool CreateDust(int i, int j, ref int type) + { + type = !WorldGen.genRand.NextBool(3) ? DustID.SpectreStaff : DustID.GemDiamond; + return true; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 5 : 50; + } + } +} diff --git a/Tiles/Crags/LiliesOfFinalityTile.png b/Tiles/Crags/LiliesOfFinalityTile.png new file mode 100644 index 0000000000..7c7c13f169 Binary files /dev/null and b/Tiles/Crags/LiliesOfFinalityTile.png differ diff --git a/Tiles/Crags/ScorchedBone.cs b/Tiles/Crags/ScorchedBone.cs index 7f3d8a69e1..9a875a0ff7 100644 --- a/Tiles/Crags/ScorchedBone.cs +++ b/Tiles/Crags/ScorchedBone.cs @@ -1,19 +1,20 @@ -using CalamityMod.Tiles.Ores; +using System.Collections.Generic; +using CalamityMod.Tiles.Ores; using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Tiles.Crags { - public class ScorchedBone : ModTile + public class ScorchedBone : ModTile, IMergeableTile { private int sheetWidth = 450; private int sheetHeight = 198; - public byte[,] tileAdjacency; - public byte[,] secondTileAdjacency; + List IMergeableTile.TileAdjacencies { get; } = []; + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; @@ -28,8 +29,8 @@ namespace CalamityMod.Tiles.Crags MinPick = 100; AddMapEntry(new Color(87, 62, 67)); - TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out tileAdjacency); - TileFraming.SetUpUniversalMerge(Type, TileID.Ash, out secondTileAdjacency); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/BrimstoneSlagMerge"); + this.RegisterUniversalMerge(TileID.Ash, "CalamityMod/Tiles/Merges/AshMerge"); } public override bool CanExplode(int i, int j) @@ -42,15 +43,9 @@ namespace CalamityMod.Tiles.Crags frameXOffset = i % 3 * sheetWidth; frameYOffset = j % 3 * sheetHeight; } - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) - { - TileFraming.DrawUniversalMergeFrames(i, j, secondTileAdjacency, "CalamityMod/Tiles/Merges/AshMerge"); - TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/BrimstoneSlagMerge"); - } + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { - TileFraming.GetAdjacencyData(i, j, ModContent.TileType(), out tileAdjacency[i, j]); - TileFraming.GetAdjacencyData(i, j, TileID.Ash, out secondTileAdjacency[i, j]); return TileFraming.BrimstoneFraming(i, j, resetFrame); } } diff --git a/Tiles/Crags/ScorchedRemains.cs b/Tiles/Crags/ScorchedRemains.cs index 79b29b200e..74f47d6744 100644 --- a/Tiles/Crags/ScorchedRemains.cs +++ b/Tiles/Crags/ScorchedRemains.cs @@ -1,19 +1,20 @@ -using CalamityMod.Tiles.Ores; +using System.Collections.Generic; +using CalamityMod.Tiles.Ores; using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Tiles.Crags { - public class ScorchedRemains : ModTile + public class ScorchedRemains : ModTile, IMergeableTile { private int sheetWidth = 234; private int sheetHeight = 90; - public byte[,] tileAdjacency; - public byte[,] secondTileAdjacency; + List IMergeableTile.TileAdjacencies { get; } = []; + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; @@ -28,8 +29,8 @@ namespace CalamityMod.Tiles.Crags MinPick = 100; AddMapEntry(new Color(57, 52, 72)); - TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out tileAdjacency); - TileFraming.SetUpUniversalMerge(Type, TileID.Ash, out secondTileAdjacency); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/BrimstoneSlagMerge"); + this.RegisterUniversalMerge(TileID.Ash, "CalamityMod/Tiles/Merges/AshMerge"); } public override void RandomUpdate(int i, int j) @@ -38,7 +39,7 @@ namespace CalamityMod.Tiles.Crags Tile left = Main.tile[i - 1, j]; Tile right = Main.tile[i + 1, j]; - if (WorldGen.genRand.Next(3) == 0 && !up.HasTile && (left.TileType == ModContent.TileType() || + if (WorldGen.genRand.NextBool(3)&& !up.HasTile && (left.TileType == ModContent.TileType() || right.TileType == ModContent.TileType())) { Main.tile[i, j].TileType = (ushort)ModContent.TileType(); @@ -47,7 +48,7 @@ namespace CalamityMod.Tiles.Crags 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); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 100, 100), 1f); return false; } @@ -61,16 +62,5 @@ namespace CalamityMod.Tiles.Crags frameXOffset = i % 3 * sheetWidth; frameYOffset = j % 3 * sheetHeight; } - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) - { - TileFraming.DrawUniversalMergeFrames(i, j, secondTileAdjacency, "CalamityMod/Tiles/Merges/AshMerge"); - TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/BrimstoneSlagMerge"); - } - public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) - { - TileFraming.GetAdjacencyData(i, j, ModContent.TileType(), out tileAdjacency[i, j]); - TileFraming.GetAdjacencyData(i, j, TileID.Ash, out secondTileAdjacency[i, j]); - return true; - } } } diff --git a/Tiles/Crags/ScorchedRemainsGrass.cs b/Tiles/Crags/ScorchedRemainsGrass.cs index d03865707b..a83fa18de3 100644 --- a/Tiles/Crags/ScorchedRemainsGrass.cs +++ b/Tiles/Crags/ScorchedRemainsGrass.cs @@ -1,4 +1,5 @@ -using CalamityMod.Dusts; +using System.Collections.Generic; +using CalamityMod.Dusts; using CalamityMod.Tiles.Crags.Lily; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -9,15 +10,14 @@ using Terraria.ModLoader; namespace CalamityMod.Tiles.Crags { - public class ScorchedRemainsGrass : ModTile + public class ScorchedRemainsGrass : ModTile, IMergeableTile { private const short subsheetWidth = 234; private const short subsheetHeight = 90; private int extraFrameHeight = 36; private int extraFrameWidth = 90; - public byte[,] tileAdjacency; - public byte[,] secondTileAdjacency; + List IMergeableTile.TileAdjacencies { get; } = []; public override void SetStaticDefaults() { @@ -34,8 +34,8 @@ namespace CalamityMod.Tiles.Crags RegisterItemDrop(ModContent.ItemType()); AddMapEntry(new Color(212, 82, 227)); - TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out tileAdjacency); - TileFraming.SetUpUniversalMerge(Type, TileID.Ash, out secondTileAdjacency); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/BrimstoneSlagMerge"); + this.RegisterUniversalMerge(TileID.Ash, "CalamityMod/Tiles/Merges/AshMerge"); } public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) @@ -47,7 +47,7 @@ namespace CalamityMod.Tiles.Crags 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); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 100, 100), 1f); return false; } @@ -76,7 +76,7 @@ namespace CalamityMod.Tiles.Crags Main.tile[i, j].TileType = (ushort)ModContent.TileType(); } - if (WorldGen.genRand.Next(5) == 0 && !up.HasTile && !up2.HasTile && up.LiquidAmount == 0) + if (WorldGen.genRand.NextBool(5)&& !up.HasTile && !up2.HasTile && up.LiquidAmount == 0) { up.TileType = (ushort)ModContent.TileType(); up.HasTile = true; @@ -84,7 +84,7 @@ namespace CalamityMod.Tiles.Crags up.TileFrameX = (short)(WorldGen.genRand.Next(20) * 18); WorldGen.SquareTileFrame(i, j - 1, true); - if (Main.netMode == NetmodeID.Server) + if (Main.netMode == NetmodeID.Server) { NetMessage.SendTileSquare(-1, i, j - 1, 3, TileChangeType.None); } @@ -107,7 +107,7 @@ namespace CalamityMod.Tiles.Crags Main.tile[i, j].TileType = (ushort)ModContent.TileType(); } - if (WorldGen.genRand.Next(60) == 0 && !up.HasTile && !up2.HasTile && up.LiquidAmount == 0) + if (WorldGen.genRand.NextBool(60)&& !up.HasTile && !up2.HasTile && up.LiquidAmount == 0) { up.TileType = (ushort)ModContent.TileType(); up.HasTile = true; @@ -129,7 +129,7 @@ namespace CalamityMod.Tiles.Crags if (!Main.gamePaused && Main.instance.IsActive && !Above.HasTile && isPlayerNear) { - if (Main.rand.Next(300) == 0) + if (Main.rand.NextBool(300)) { int newDust = Dust.NewDust(new Vector2((i - 2) * 16, (j - 1) * 16), 5, 5, ModContent.DustType()); Main.dust[newDust].velocity.Y += 0.09f; @@ -158,17 +158,6 @@ namespace CalamityMod.Tiles.Crags DrawExtraWallEnds(i, j, leaves, drawOffset, drawColour); DrawExtraDrapes(i, j, leaves, drawOffset, drawColour); } - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) - { - TileFraming.DrawUniversalMergeFrames(i, j, secondTileAdjacency, "CalamityMod/Tiles/Merges/AshMerge"); - TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/BrimstoneSlagMerge"); - } - public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) - { - TileFraming.GetAdjacencyData(i, j, ModContent.TileType(), out tileAdjacency[i, j]); - TileFraming.GetAdjacencyData(i, j, TileID.Ash, out secondTileAdjacency[i, j]); - return true; - } #region 'Extra Drapes' Drawing private void DrawExtraTop(int i, int j, Texture2D extras, Vector2 drawOffset, Color drawColour) diff --git a/Tiles/Crags/SlagCrateTile.cs b/Tiles/Crags/SlagCrateTile.cs new file mode 100644 index 0000000000..91d81f3e22 --- /dev/null +++ b/Tiles/Crags/SlagCrateTile.cs @@ -0,0 +1,32 @@ +using CalamityMod.Items.Fishing.BrimstoneCragCatches; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Crags +{ + public class SlagCrateTile : ModTile + { + public override void SetStaticDefaults() + { + Main.tileSolidTop[Type] = true; + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileTable[Type] = true; + Main.tileLavaDeath[Type] = true; + Main.tileWaterDeath[Type] = false; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.addTile(Type); + AddMapEntry(new Color(189, 152, 43), CalamityUtils.GetItemName()); + DustType = 60; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } +} diff --git a/Tiles/Crags/SlagCrateTile.png b/Tiles/Crags/SlagCrateTile.png new file mode 100644 index 0000000000..4236282747 Binary files /dev/null and b/Tiles/Crags/SlagCrateTile.png differ diff --git a/Tiles/Crags/Spike/CragStalactiteGiant.cs b/Tiles/Crags/Spike/CragStalactiteGiant.cs index d52cc6bbff..3d4a3e7aff 100644 --- a/Tiles/Crags/Spike/CragStalactiteGiant.cs +++ b/Tiles/Crags/Spike/CragStalactiteGiant.cs @@ -1,42 +1,42 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; -using Terraria.DataStructures; -using Terraria.Enums; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; namespace CalamityMod.Tiles.Crags.Spike { - public class CragStalactiteGiant1 : ModTile - { - public override void SetStaticDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileSolid[Type] = false; - TileObjectData.newTile.Width = 4; - TileObjectData.newTile.Height = 8; - TileObjectData.newTile.Origin = new Point16(2, 1); - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16, 16, 16, 16, 16, 16 }; - TileObjectData.newTile.StyleWrapLimit = 36; - TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); - TileObjectData.newTile.AnchorBottom = default(AnchorData); - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newTile.DrawYOffset = -3; - TileObjectData.addTile(Type); + public class CragStalactiteGiant1 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + TileObjectData.newTile.Width = 4; + TileObjectData.newTile.Height = 8; + TileObjectData.newTile.Origin = new Point16(2, 1); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16, 16, 16, 16, 16, 16 }; + TileObjectData.newTile.StyleWrapLimit = 36; + TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.AnchorBottom = default(AnchorData); + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.DrawYOffset = -3; + TileObjectData.addTile(Type); AddMapEntry(new Color(43, 23, 46)); - DustType = 155; + DustType = 155; HitSound = SoundID.Tink; - } + } } - public class CragStalactiteGiant2 : CragStalactiteGiant1 - { - } + public class CragStalactiteGiant2 : CragStalactiteGiant1 + { + } - public class CragStalactiteGiant3 : CragStalactiteGiant1 - { - } -} \ No newline at end of file + public class CragStalactiteGiant3 : CragStalactiteGiant1 + { + } +} diff --git a/Tiles/Crags/Spike/CragStalactiteLarge2x4.cs b/Tiles/Crags/Spike/CragStalactiteLarge2x4.cs index 91516d13e9..2da8d88ad8 100644 --- a/Tiles/Crags/Spike/CragStalactiteLarge2x4.cs +++ b/Tiles/Crags/Spike/CragStalactiteLarge2x4.cs @@ -1,34 +1,34 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; -using Terraria.DataStructures; -using Terraria.Enums; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; namespace CalamityMod.Tiles.Crags.Spike { - public class CragStalactiteLarge3 : ModTile - { - public override void SetStaticDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileSolid[Type] = false; - TileObjectData.newTile.Width = 2; - TileObjectData.newTile.Height = 4; - TileObjectData.newTile.Origin = new Point16(1, 1); - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16, 16 }; - TileObjectData.newTile.StyleWrapLimit = 36; - TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); - TileObjectData.newTile.AnchorBottom = default(AnchorData); - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newTile.DrawYOffset = -3; - TileObjectData.addTile(Type); + public class CragStalactiteLarge3 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + TileObjectData.newTile.Width = 2; + TileObjectData.newTile.Height = 4; + TileObjectData.newTile.Origin = new Point16(1, 1); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16, 16 }; + TileObjectData.newTile.StyleWrapLimit = 36; + TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.AnchorBottom = default(AnchorData); + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.DrawYOffset = -3; + TileObjectData.addTile(Type); AddMapEntry(new Color(43, 23, 46)); DustType = 155; HitSound = SoundID.Tink; - } + } } -} \ No newline at end of file +} diff --git a/Tiles/Crags/Spike/CragStalactiteLarge2x5.cs b/Tiles/Crags/Spike/CragStalactiteLarge2x5.cs index 43a568b671..c1578763c9 100644 --- a/Tiles/Crags/Spike/CragStalactiteLarge2x5.cs +++ b/Tiles/Crags/Spike/CragStalactiteLarge2x5.cs @@ -1,38 +1,38 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; -using Terraria.DataStructures; -using Terraria.Enums; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; namespace CalamityMod.Tiles.Crags.Spike { - public class CragStalactiteLarge1 : ModTile - { - public override void SetStaticDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileSolid[Type] = false; - TileObjectData.newTile.Width = 2; - TileObjectData.newTile.Height = 5; - TileObjectData.newTile.Origin = new Point16(1, 1); - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16, 16, 16 }; - TileObjectData.newTile.StyleWrapLimit = 36; - TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); - TileObjectData.newTile.AnchorBottom = default(AnchorData); - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newTile.DrawYOffset = -3; - TileObjectData.addTile(Type); + public class CragStalactiteLarge1 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + TileObjectData.newTile.Width = 2; + TileObjectData.newTile.Height = 5; + TileObjectData.newTile.Origin = new Point16(1, 1); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16, 16, 16 }; + TileObjectData.newTile.StyleWrapLimit = 36; + TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.AnchorBottom = default(AnchorData); + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.DrawYOffset = -3; + TileObjectData.addTile(Type); AddMapEntry(new Color(43, 23, 46)); DustType = 155; HitSound = SoundID.Tink; - } + } } - public class CragStalactiteLarge2 : CragStalactiteLarge1 - { - } -} \ No newline at end of file + public class CragStalactiteLarge2 : CragStalactiteLarge1 + { + } +} diff --git a/Tiles/Crags/Spike/CragStalactiteSmall2x2.cs b/Tiles/Crags/Spike/CragStalactiteSmall2x2.cs index b907a41a74..58d6d5eec6 100644 --- a/Tiles/Crags/Spike/CragStalactiteSmall2x2.cs +++ b/Tiles/Crags/Spike/CragStalactiteSmall2x2.cs @@ -1,32 +1,32 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; -using Terraria.DataStructures; -using Terraria.Enums; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; namespace CalamityMod.Tiles.Crags.Spike { - public class CragStalactiteSmall3 : ModTile - { - public override void SetStaticDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileSolid[Type] = false; - TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); - TileObjectData.newTile.Origin = new Point16(1, 1); - TileObjectData.newTile.StyleWrapLimit = 36; - TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); - TileObjectData.newTile.AnchorBottom = default(AnchorData); - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newTile.DrawYOffset = -3; - TileObjectData.addTile(Type); + public class CragStalactiteSmall3 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.newTile.Origin = new Point16(1, 1); + TileObjectData.newTile.StyleWrapLimit = 36; + TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.AnchorBottom = default(AnchorData); + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.DrawYOffset = -3; + TileObjectData.addTile(Type); AddMapEntry(new Color(43, 23, 46)); DustType = 155; HitSound = SoundID.Tink; - } + } } -} \ No newline at end of file +} diff --git a/Tiles/Crags/Spike/CragStalactiteSmall2x3.cs b/Tiles/Crags/Spike/CragStalactiteSmall2x3.cs index aa16d21c4a..9b107621a1 100644 --- a/Tiles/Crags/Spike/CragStalactiteSmall2x3.cs +++ b/Tiles/Crags/Spike/CragStalactiteSmall2x3.cs @@ -1,38 +1,38 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; -using Terraria.DataStructures; -using Terraria.Enums; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; namespace CalamityMod.Tiles.Crags.Spike { - public class CragStalactiteSmall1 : ModTile - { - public override void SetStaticDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileSolid[Type] = false; - TileObjectData.newTile.Width = 2; - TileObjectData.newTile.Height = 3; - TileObjectData.newTile.Origin = new Point16(1, 1); - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; - TileObjectData.newTile.StyleWrapLimit = 36; - TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); - TileObjectData.newTile.AnchorBottom = default(AnchorData); - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newTile.DrawYOffset = -3; - TileObjectData.addTile(Type); + public class CragStalactiteSmall1 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + TileObjectData.newTile.Width = 2; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(1, 1); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.StyleWrapLimit = 36; + TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.AnchorBottom = default(AnchorData); + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.DrawYOffset = -3; + TileObjectData.addTile(Type); AddMapEntry(new Color(43, 23, 46)); DustType = 155; HitSound = SoundID.Tink; - } + } } - public class CragStalactiteSmall2 : CragStalactiteSmall1 - { - } -} \ No newline at end of file + public class CragStalactiteSmall2 : CragStalactiteSmall1 + { + } +} diff --git a/Tiles/Crags/Spike/CragStalagmiteGiant.cs b/Tiles/Crags/Spike/CragStalagmiteGiant.cs index 96c7270acc..794dbedbaa 100644 --- a/Tiles/Crags/Spike/CragStalagmiteGiant.cs +++ b/Tiles/Crags/Spike/CragStalagmiteGiant.cs @@ -1,41 +1,41 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; -using Terraria.DataStructures; -using Terraria.Enums; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; namespace CalamityMod.Tiles.Crags.Spike { - public class CragStalagmiteGiant1 : ModTile - { - public override void SetStaticDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileSolid[Type] = false; - TileObjectData.newTile.Width = 4; - TileObjectData.newTile.Height = 8; - TileObjectData.newTile.Origin = new Point16(2, 7); - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16, 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); + public class CragStalagmiteGiant1 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + TileObjectData.newTile.Width = 4; + TileObjectData.newTile.Height = 8; + TileObjectData.newTile.Origin = new Point16(2, 7); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16, 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(43, 23, 46)); DustType = 155; HitSound = SoundID.Tink; - } - } + } + } - public class CragStalagmiteGiant2 : CragStalagmiteGiant1 - { - } + public class CragStalagmiteGiant2 : CragStalagmiteGiant1 + { + } - public class CragStalagmiteGiant3 : CragStalagmiteGiant1 - { - } -} \ No newline at end of file + public class CragStalagmiteGiant3 : CragStalagmiteGiant1 + { + } +} diff --git a/Tiles/Crags/Spike/CragStalagmiteLarge2x4.cs b/Tiles/Crags/Spike/CragStalagmiteLarge2x4.cs index 2d00e16c06..dc5cb104e6 100644 --- a/Tiles/Crags/Spike/CragStalagmiteLarge2x4.cs +++ b/Tiles/Crags/Spike/CragStalagmiteLarge2x4.cs @@ -1,33 +1,33 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; -using Terraria.DataStructures; -using Terraria.Enums; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; namespace CalamityMod.Tiles.Crags.Spike { - public class CragStalagmiteLarge3 : ModTile - { - public override void SetStaticDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileSolid[Type] = false; - TileObjectData.newTile.Width = 2; - 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); + public class CragStalagmiteLarge3 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + TileObjectData.newTile.Width = 2; + 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(43, 23, 46)); DustType = 155; HitSound = SoundID.Tink; - } - } -} \ No newline at end of file + } + } +} diff --git a/Tiles/Crags/Spike/CragStalagmiteLarge2x5.cs b/Tiles/Crags/Spike/CragStalagmiteLarge2x5.cs index 033f454fcb..1313b33b92 100644 --- a/Tiles/Crags/Spike/CragStalagmiteLarge2x5.cs +++ b/Tiles/Crags/Spike/CragStalagmiteLarge2x5.cs @@ -1,37 +1,37 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; -using Terraria.DataStructures; -using Terraria.Enums; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; namespace CalamityMod.Tiles.Crags.Spike { - public class CragStalagmiteLarge1 : ModTile - { - public override void SetStaticDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileSolid[Type] = false; - TileObjectData.newTile.Width = 2; - TileObjectData.newTile.Height = 5; - TileObjectData.newTile.Origin = new Point16(1, 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); + public class CragStalagmiteLarge1 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + TileObjectData.newTile.Width = 2; + TileObjectData.newTile.Height = 5; + TileObjectData.newTile.Origin = new Point16(1, 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(43, 23, 46)); DustType = 155; HitSound = SoundID.Tink; - } - } + } + } - public class CragStalagmiteLarge2 : CragStalagmiteLarge1 - { - } -} \ No newline at end of file + public class CragStalagmiteLarge2 : CragStalagmiteLarge1 + { + } +} diff --git a/Tiles/Crags/Spike/CragStalagmiteSmall2x2.cs b/Tiles/Crags/Spike/CragStalagmiteSmall2x2.cs index 051fa823a2..a0a6238c50 100644 --- a/Tiles/Crags/Spike/CragStalagmiteSmall2x2.cs +++ b/Tiles/Crags/Spike/CragStalagmiteSmall2x2.cs @@ -1,31 +1,31 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; -using Terraria.DataStructures; -using Terraria.Enums; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; namespace CalamityMod.Tiles.Crags.Spike { - public class CragStalagmiteSmall3 : ModTile - { - public override void SetStaticDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileSolid[Type] = false; - TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); - TileObjectData.newTile.Origin = new Point16(1, 1); - 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); + public class CragStalagmiteSmall3 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.newTile.Origin = new Point16(1, 1); + 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(43, 23, 46)); - DustType = 155; + DustType = 155; HitSound = SoundID.Tink; - } - } -} \ No newline at end of file + } + } +} diff --git a/Tiles/Crags/Spike/CragStalagmiteSmall2x3.cs b/Tiles/Crags/Spike/CragStalagmiteSmall2x3.cs index 0ffa4e555d..5a6b48728f 100644 --- a/Tiles/Crags/Spike/CragStalagmiteSmall2x3.cs +++ b/Tiles/Crags/Spike/CragStalagmiteSmall2x3.cs @@ -1,37 +1,37 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; -using Terraria.DataStructures; -using Terraria.Enums; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; namespace CalamityMod.Tiles.Crags.Spike { - public class CragStalagmiteSmall1 : ModTile - { - public override void SetStaticDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileSolid[Type] = false; - 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); + public class CragStalagmiteSmall1 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + 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(43, 23, 46)); DustType = 155; HitSound = SoundID.Tink; - } - } + } + } - public class CragStalagmiteSmall2 : CragStalagmiteSmall1 - { - } -} \ No newline at end of file + public class CragStalagmiteSmall2 : CragStalagmiteSmall1 + { + } +} diff --git a/Tiles/Crags/Tree/SpineSapling.cs b/Tiles/Crags/Tree/SpineSapling.cs index b2f260a9b2..140f46a145 100644 --- a/Tiles/Crags/Tree/SpineSapling.cs +++ b/Tiles/Crags/Tree/SpineSapling.cs @@ -1,61 +1,61 @@ +using System.Linq; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; -using Terraria.DataStructures; -using Terraria.Enums; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System.Linq; namespace CalamityMod.Tiles.Crags.Tree { - public class SpineSapling : ModTile - { - public override void SetStaticDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileLavaDeath[Type] = true; - TileID.Sets.CommonSapling[Type] = true; - TileObjectData.newTile.Width = 1; - TileObjectData.newTile.Height = 2; - TileObjectData.newTile.Origin = new Point16(0, 1); - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); - TileObjectData.newTile.UsesCustomCanPlace = true; - TileObjectData.newTile.CoordinateHeights = new[] { 16, 16 }; - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newTile.AnchorValidTiles = new[] { ModContent.TileType() }; - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newTile.DrawFlipHorizontal = true; - TileObjectData.newTile.WaterPlacement = LiquidPlacement.NotAllowed; - TileObjectData.newTile.LavaDeath = true; - TileObjectData.newTile.RandomStyleRange = 3; - TileObjectData.newTile.StyleMultiplier = 3; - TileObjectData.addTile(Type); + public class SpineSapling : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileLavaDeath[Type] = true; + TileID.Sets.CommonSapling[Type] = true; + TileObjectData.newTile.Width = 1; + TileObjectData.newTile.Height = 2; + TileObjectData.newTile.Origin = new Point16(0, 1); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.CoordinateHeights = new[] { 16, 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.AnchorValidTiles = new[] { ModContent.TileType() }; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.DrawFlipHorizontal = true; + TileObjectData.newTile.WaterPlacement = LiquidPlacement.NotAllowed; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.newTile.RandomStyleRange = 3; + TileObjectData.newTile.StyleMultiplier = 3; + TileObjectData.addTile(Type); AddMapEntry(new Color(38, 25, 27), CreateMapEntryName()); DustType = DustID.Blood; - AdjTiles = new int[] { TileID.Saplings }; - } + AdjTiles = new int[] { TileID.Saplings }; + } - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } - public override void RandomUpdate(int i, int j) - { - if (WorldGen.genRand.Next(20) == 0) + public override void RandomUpdate(int i, int j) + { + if (WorldGen.genRand.NextBool(20)) { bool isPlayerNear = WorldGen.PlayerLOS(i, j); - if (isPlayerNear && Main.tile[i, j + 1].TileType != ModContent.TileType()) - { - SpineTree.Spawn(i, j + 1, 22, 28, true); - } - } - } - } -} \ No newline at end of file + if (isPlayerNear && Main.tile[i, j + 1].TileType != ModContent.TileType()) + { + SpineTree.Spawn(i, j + 1, 22, 28, true); + } + } + } + } +} diff --git a/Tiles/Crags/Tree/SpineTree.cs b/Tiles/Crags/Tree/SpineTree.cs index 0438c150b2..a5ab31f444 100644 --- a/Tiles/Crags/Tree/SpineTree.cs +++ b/Tiles/Crags/Tree/SpineTree.cs @@ -49,14 +49,14 @@ namespace CalamityMod.Tiles.Crags.Tree return false; } - public static bool SolidTile(int i, int j) + public static bool SolidTile(int i, int j) { return Framing.GetTileSafely(i, j).HasTile && Main.tileSolid[Framing.GetTileSafely(i, j).TileType]; } - public static bool SolidTopTile(int i, int j) + public static bool SolidTopTile(int i, int j) { - return Framing.GetTileSafely(i, j).HasTile && (Main.tileSolidTop[Framing.GetTileSafely(i, j).TileType] || + return Framing.GetTileSafely(i, j).HasTile && (Main.tileSolidTop[Framing.GetTileSafely(i, j).TileType] || Main.tileSolid[Framing.GetTileSafely(i, j).TileType]); } @@ -80,7 +80,7 @@ namespace CalamityMod.Tiles.Crags.Tree } } - if (height < minSize) + if (height < minSize) { return false; } diff --git a/Tiles/CryonicBrick.cs b/Tiles/CryonicBrick.cs index 4b5476937a..96c010298a 100644 --- a/Tiles/CryonicBrick.cs +++ b/Tiles/CryonicBrick.cs @@ -1,18 +1,19 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; +using System.Collections.Generic; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Tiles { - public class CryonicBrick : ModTile + public class CryonicBrick : ModTile, IMergeableTile { int subsheetHeight = 90; int subsheetWidth = 234; - public byte[,] tileAdjacency; - public byte[,] secondTileAdjacency; + List IMergeableTile.TileAdjacencies { get; } = []; + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; @@ -24,23 +25,16 @@ namespace CalamityMod.Tiles HitSound = SoundID.Tink; AddMapEntry(new Color(99, 131, 199)); - TileFraming.SetUpUniversalMerge(Type, TileID.Dirt, out tileAdjacency); - TileFraming.SetUpUniversalMerge(Type, TileID.SnowBlock, out secondTileAdjacency); + this.RegisterUniversalMerge(TileID.Dirt, "CalamityMod/Tiles/Merges/DirtMerge"); + this.RegisterUniversalMerge(TileID.SnowBlock, "CalamityMod/Tiles/Merges/SnowMerge"); } public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 176, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.BubbleBurst_Blue, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } - public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) - { - TileFraming.GetAdjacencyData(i, j, TileID.Dirt, out tileAdjacency[i, j]); - TileFraming.GetAdjacencyData(i, j, TileID.SnowBlock, out secondTileAdjacency[i, j]); - return true; - } - public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) { int xPos = i % 2; @@ -48,11 +42,5 @@ namespace CalamityMod.Tiles frameXOffset = xPos * subsheetWidth; frameYOffset = yPos * subsheetHeight; } - - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) - { - TileFraming.DrawUniversalMergeFrames(i, j, secondTileAdjacency, "CalamityMod/Tiles/Merges/SnowMerge"); - TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/DirtMerge"); - } } } diff --git a/Tiles/DraedonStructures/AgedLaboratoryConsole.cs b/Tiles/DraedonStructures/AgedLaboratoryConsole.cs index 3679842c73..1e9d88b4dc 100644 --- a/Tiles/DraedonStructures/AgedLaboratoryConsole.cs +++ b/Tiles/DraedonStructures/AgedLaboratoryConsole.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; using Terraria.Enums; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; @@ -41,7 +42,7 @@ namespace CalamityMod.Tiles.DraedonStructures public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 182); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.TheDestroyer); return false; } diff --git a/Tiles/DraedonStructures/AgedLaboratoryContainmentBox.cs b/Tiles/DraedonStructures/AgedLaboratoryContainmentBox.cs index bb1b2e5db1..a1747c07e7 100644 --- a/Tiles/DraedonStructures/AgedLaboratoryContainmentBox.cs +++ b/Tiles/DraedonStructures/AgedLaboratoryContainmentBox.cs @@ -1,8 +1,9 @@ -using CalamityMod.Items.Placeables.DraedonStructures; +using CalamityMod.Items.Placeables.DraedonStructures; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; using Terraria.Enums; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; @@ -39,7 +40,7 @@ namespace CalamityMod.Tiles.DraedonStructures public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 182); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.TheDestroyer); return false; } diff --git a/Tiles/DraedonStructures/AgedLaboratoryDisplay.cs b/Tiles/DraedonStructures/AgedLaboratoryDisplay.cs index 3cc99f8cc3..6d596e755e 100644 --- a/Tiles/DraedonStructures/AgedLaboratoryDisplay.cs +++ b/Tiles/DraedonStructures/AgedLaboratoryDisplay.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; using Terraria.Enums; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; @@ -34,7 +35,7 @@ namespace CalamityMod.Tiles.DraedonStructures public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 182); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.TheDestroyer); return false; } diff --git a/Tiles/DraedonStructures/AgedLaboratoryElectricPanel.cs b/Tiles/DraedonStructures/AgedLaboratoryElectricPanel.cs index 443e1b8bfc..c5b808f2f0 100644 --- a/Tiles/DraedonStructures/AgedLaboratoryElectricPanel.cs +++ b/Tiles/DraedonStructures/AgedLaboratoryElectricPanel.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Placeables.DraedonStructures; +using CalamityMod.Items.Placeables.DraedonStructures; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; diff --git a/Tiles/DraedonStructures/AgedLaboratoryServer.cs b/Tiles/DraedonStructures/AgedLaboratoryServer.cs index 813e6a7dea..0edb6b3758 100644 --- a/Tiles/DraedonStructures/AgedLaboratoryServer.cs +++ b/Tiles/DraedonStructures/AgedLaboratoryServer.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; using Terraria.Enums; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; @@ -41,7 +42,7 @@ namespace CalamityMod.Tiles.DraedonStructures public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 182); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.TheDestroyer); return false; } diff --git a/Tiles/DraedonStructures/AgedLaboratoryTerminal.cs b/Tiles/DraedonStructures/AgedLaboratoryTerminal.cs index 377f3770b2..76334fadf8 100644 --- a/Tiles/DraedonStructures/AgedLaboratoryTerminal.cs +++ b/Tiles/DraedonStructures/AgedLaboratoryTerminal.cs @@ -1,8 +1,9 @@ -using CalamityMod.Items.Placeables.DraedonStructures; +using CalamityMod.Items.Placeables.DraedonStructures; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; using Terraria.Enums; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; @@ -43,7 +44,7 @@ namespace CalamityMod.Tiles.DraedonStructures public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 182); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.TheDestroyer); return false; } diff --git a/Tiles/DraedonStructures/AgedReinforcedCrate.cs b/Tiles/DraedonStructures/AgedReinforcedCrate.cs index 5277ace0c9..6ff4190e16 100644 --- a/Tiles/DraedonStructures/AgedReinforcedCrate.cs +++ b/Tiles/DraedonStructures/AgedReinforcedCrate.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; @@ -29,7 +30,7 @@ namespace CalamityMod.Tiles.DraedonStructures public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 182); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.TheDestroyer); return false; } diff --git a/Tiles/DraedonStructures/AgedSecurityChestTile.cs b/Tiles/DraedonStructures/AgedSecurityChestTile.cs index bfcce472d9..1b462f44d9 100644 --- a/Tiles/DraedonStructures/AgedSecurityChestTile.cs +++ b/Tiles/DraedonStructures/AgedSecurityChestTile.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -18,7 +19,7 @@ namespace CalamityMod.Tiles.DraedonStructures public override bool CanExplode(int i, int j) => false; public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 226, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Electric, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; diff --git a/Tiles/DraedonStructures/ChargingStation.cs b/Tiles/DraedonStructures/ChargingStation.cs index d8b0cc92bb..6de7c06905 100644 --- a/Tiles/DraedonStructures/ChargingStation.cs +++ b/Tiles/DraedonStructures/ChargingStation.cs @@ -5,13 +5,13 @@ using CalamityMod.TileEntities; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.DataStructures; using Terraria.GameContent.ObjectInteractions; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; -using Terraria.Audio; namespace CalamityMod.Tiles.DraedonStructures { @@ -50,7 +50,7 @@ namespace CalamityMod.Tiles.DraedonStructures public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 226); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Electric); return false; } diff --git a/Tiles/DraedonStructures/DraedonLabTurret.cs b/Tiles/DraedonStructures/DraedonLabTurret.cs index bb3ed9994e..cc879d63a3 100644 --- a/Tiles/DraedonStructures/DraedonLabTurret.cs +++ b/Tiles/DraedonStructures/DraedonLabTurret.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Materials; +using System.Collections.Generic; +using CalamityMod.Items.Materials; using CalamityMod.TileEntities; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -9,7 +10,6 @@ using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; -using System.Collections.Generic; namespace CalamityMod.Tiles.DraedonStructures { @@ -55,7 +55,7 @@ namespace CalamityMod.Tiles.DraedonStructures public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 226); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Electric); return false; } diff --git a/Tiles/DraedonStructures/HazardChevronPanels.cs b/Tiles/DraedonStructures/HazardChevronPanels.cs index 8c57ab87a5..ca445afff4 100644 --- a/Tiles/DraedonStructures/HazardChevronPanels.cs +++ b/Tiles/DraedonStructures/HazardChevronPanels.cs @@ -1,8 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Tiles.DraedonStructures { diff --git a/Tiles/DraedonStructures/HostileFireTurret .cs b/Tiles/DraedonStructures/HostileFireTurret .cs index 512011f8cd..e9fe453828 100644 --- a/Tiles/DraedonStructures/HostileFireTurret .cs +++ b/Tiles/DraedonStructures/HostileFireTurret .cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Materials; +using System.Collections.Generic; +using CalamityMod.Items.Materials; using CalamityMod.TileEntities; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -9,7 +10,6 @@ using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; -using System.Collections.Generic; namespace CalamityMod.Tiles.DraedonStructures { @@ -50,7 +50,7 @@ namespace CalamityMod.Tiles.DraedonStructures public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 226); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Electric); return false; } @@ -85,7 +85,7 @@ namespace CalamityMod.Tiles.DraedonStructures Vector2 screenOffset = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + screenOffset; drawOffset.Y -= 2f; - drawOffset.X += (drawDirection == -1 ? -10f : 2f) -2f; + drawOffset.X += (drawDirection == -1 ? -10f : 2f) - 2f; SpriteEffects sfx = drawDirection == -1 ? SpriteEffects.FlipVertically : SpriteEffects.None; spriteBatch.Draw(tex, drawOffset, null, drawColor, te.Angle, tex.Size() * 0.5f, 1f, sfx, 0.0f); diff --git a/Tiles/DraedonStructures/HostileIceTurret .cs b/Tiles/DraedonStructures/HostileIceTurret .cs index 302b3abfcd..2b1b476c2b 100644 --- a/Tiles/DraedonStructures/HostileIceTurret .cs +++ b/Tiles/DraedonStructures/HostileIceTurret .cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Materials; +using System.Collections.Generic; +using CalamityMod.Items.Materials; using CalamityMod.TileEntities; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -9,7 +10,6 @@ using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; -using System.Collections.Generic; namespace CalamityMod.Tiles.DraedonStructures { @@ -50,7 +50,7 @@ namespace CalamityMod.Tiles.DraedonStructures public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 226); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Electric); return false; } @@ -85,7 +85,7 @@ namespace CalamityMod.Tiles.DraedonStructures Vector2 screenOffset = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + screenOffset; drawOffset.Y -= 2f; - drawOffset.X += (drawDirection == -1 ? -10f : 2f) -2f; + drawOffset.X += (drawDirection == -1 ? -10f : 2f) - 2f; SpriteEffects sfx = drawDirection == -1 ? SpriteEffects.FlipVertically : SpriteEffects.None; spriteBatch.Draw(tex, drawOffset, null, drawColor, te.Angle, tex.Size() * 0.5f, 1f, sfx, 0.0f); diff --git a/Tiles/DraedonStructures/HostileLaserTurret .cs b/Tiles/DraedonStructures/HostileLaserTurret .cs index 23fae78216..149e0a7410 100644 --- a/Tiles/DraedonStructures/HostileLaserTurret .cs +++ b/Tiles/DraedonStructures/HostileLaserTurret .cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Materials; +using System.Collections.Generic; +using CalamityMod.Items.Materials; using CalamityMod.TileEntities; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -9,7 +10,6 @@ using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; -using System.Collections.Generic; namespace CalamityMod.Tiles.DraedonStructures { @@ -50,7 +50,7 @@ namespace CalamityMod.Tiles.DraedonStructures public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 226); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Electric); return false; } @@ -85,7 +85,7 @@ namespace CalamityMod.Tiles.DraedonStructures Vector2 screenOffset = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + screenOffset; drawOffset.Y -= 2f; - drawOffset.X += (drawDirection == -1 ? -10f : 2f) -2f; + drawOffset.X += (drawDirection == -1 ? -10f : 2f) - 2f; SpriteEffects sfx = drawDirection == -1 ? SpriteEffects.FlipVertically : SpriteEffects.None; spriteBatch.Draw(tex, drawOffset, null, drawColor, te.Angle, tex.Size() * 0.5f, 1f, sfx, 0.0f); diff --git a/Tiles/DraedonStructures/HostileOnyxTurret.cs b/Tiles/DraedonStructures/HostileOnyxTurret.cs index 6f7945c859..48773b95b1 100644 --- a/Tiles/DraedonStructures/HostileOnyxTurret.cs +++ b/Tiles/DraedonStructures/HostileOnyxTurret.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Materials; +using System.Collections.Generic; +using CalamityMod.Items.Materials; using CalamityMod.TileEntities; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -9,7 +10,6 @@ using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; -using System.Collections.Generic; namespace CalamityMod.Tiles.DraedonStructures { @@ -50,7 +50,7 @@ namespace CalamityMod.Tiles.DraedonStructures public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 226); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Electric); return false; } @@ -85,7 +85,7 @@ namespace CalamityMod.Tiles.DraedonStructures Vector2 screenOffset = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + screenOffset; drawOffset.Y -= 2f; - drawOffset.X += (drawDirection == -1 ? -10f : 2f) -2f; + drawOffset.X += (drawDirection == -1 ? -10f : 2f) - 2f; SpriteEffects sfx = drawDirection == -1 ? SpriteEffects.FlipVertically : SpriteEffects.None; spriteBatch.Draw(tex, drawOffset, null, drawColor, te.Angle, tex.Size() * 0.5f, 1f, sfx, 0.0f); diff --git a/Tiles/DraedonStructures/HostilePlagueTurret.cs b/Tiles/DraedonStructures/HostilePlagueTurret.cs index 16fb7a067f..50ac6e3aa3 100644 --- a/Tiles/DraedonStructures/HostilePlagueTurret.cs +++ b/Tiles/DraedonStructures/HostilePlagueTurret.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Materials; +using System.Collections.Generic; +using CalamityMod.Items.Materials; using CalamityMod.TileEntities; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -9,7 +10,6 @@ using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; -using System.Collections.Generic; namespace CalamityMod.Tiles.DraedonStructures { @@ -50,7 +50,7 @@ namespace CalamityMod.Tiles.DraedonStructures public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 226); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Electric); return false; } @@ -85,7 +85,7 @@ namespace CalamityMod.Tiles.DraedonStructures Vector2 screenOffset = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + screenOffset; drawOffset.Y -= 2f; - drawOffset.X += (drawDirection == -1 ? -10f : 2f) -2f; + drawOffset.X += (drawDirection == -1 ? -10f : 2f) - 2f; SpriteEffects sfx = drawDirection == -1 ? SpriteEffects.FlipVertically : SpriteEffects.None; spriteBatch.Draw(tex, drawOffset, null, drawColor, te.Angle, tex.Size() * 0.5f, 1f, sfx, 0.0f); diff --git a/Tiles/DraedonStructures/HostileWaterTurret.cs b/Tiles/DraedonStructures/HostileWaterTurret.cs index 0e12d6dbe2..15231ede6f 100644 --- a/Tiles/DraedonStructures/HostileWaterTurret.cs +++ b/Tiles/DraedonStructures/HostileWaterTurret.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Materials; +using System.Collections.Generic; +using CalamityMod.Items.Materials; using CalamityMod.TileEntities; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -9,7 +10,6 @@ using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; -using System.Collections.Generic; namespace CalamityMod.Tiles.DraedonStructures { @@ -50,7 +50,7 @@ namespace CalamityMod.Tiles.DraedonStructures public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 226); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Electric); return false; } @@ -85,7 +85,7 @@ namespace CalamityMod.Tiles.DraedonStructures Vector2 screenOffset = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + screenOffset; drawOffset.Y -= 2f; - drawOffset.X += (drawDirection == -1 ? -10f : 2f) -2f; + drawOffset.X += (drawDirection == -1 ? -10f : 2f) - 2f; SpriteEffects sfx = drawDirection == -1 ? SpriteEffects.FlipVertically : SpriteEffects.None; spriteBatch.Draw(tex, drawOffset, null, drawColor, te.Angle, tex.Size() * 0.5f, 1f, sfx, 0.0f); diff --git a/Tiles/DraedonStructures/InactivePowerCellFactory.cs b/Tiles/DraedonStructures/InactivePowerCellFactory.cs index effbb3311e..9b452ee533 100644 --- a/Tiles/DraedonStructures/InactivePowerCellFactory.cs +++ b/Tiles/DraedonStructures/InactivePowerCellFactory.cs @@ -2,8 +2,9 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; -using Terraria.GameContent; using Terraria.Enums; +using Terraria.GameContent; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; @@ -43,7 +44,7 @@ namespace CalamityMod.Tiles.DraedonStructures public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 226); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Electric); return false; } diff --git a/Tiles/DraedonStructures/LabHologramProjector.cs b/Tiles/DraedonStructures/LabHologramProjector.cs index fc0f5993be..2e1da5d040 100644 --- a/Tiles/DraedonStructures/LabHologramProjector.cs +++ b/Tiles/DraedonStructures/LabHologramProjector.cs @@ -4,13 +4,13 @@ using CalamityMod.TileEntities; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.DataStructures; using Terraria.Enums; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; -using Terraria.Audio; namespace CalamityMod.Tiles.DraedonStructures { diff --git a/Tiles/DraedonStructures/LaboratoryConsole.cs b/Tiles/DraedonStructures/LaboratoryConsole.cs index 47925fc4c4..832e50ae21 100644 --- a/Tiles/DraedonStructures/LaboratoryConsole.cs +++ b/Tiles/DraedonStructures/LaboratoryConsole.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; using Terraria.Enums; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; @@ -41,7 +42,7 @@ namespace CalamityMod.Tiles.DraedonStructures public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 182); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.TheDestroyer); return false; } diff --git a/Tiles/DraedonStructures/LaboratoryContainmentBox.cs b/Tiles/DraedonStructures/LaboratoryContainmentBox.cs index 5ab22718eb..6bbcd91b6f 100644 --- a/Tiles/DraedonStructures/LaboratoryContainmentBox.cs +++ b/Tiles/DraedonStructures/LaboratoryContainmentBox.cs @@ -1,8 +1,9 @@ -using CalamityMod.Items.Placeables.DraedonStructures; +using CalamityMod.Items.Placeables.DraedonStructures; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; using Terraria.Enums; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; @@ -39,7 +40,7 @@ namespace CalamityMod.Tiles.DraedonStructures public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 182); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.TheDestroyer); return false; } diff --git a/Tiles/DraedonStructures/LaboratoryDisplay.cs b/Tiles/DraedonStructures/LaboratoryDisplay.cs index 6e7cfcd1f9..4df308e759 100644 --- a/Tiles/DraedonStructures/LaboratoryDisplay.cs +++ b/Tiles/DraedonStructures/LaboratoryDisplay.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; using Terraria.Enums; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; @@ -44,7 +45,7 @@ namespace CalamityMod.Tiles.DraedonStructures public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 182); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.TheDestroyer); return false; } diff --git a/Tiles/DraedonStructures/LaboratoryElectricPanel.cs b/Tiles/DraedonStructures/LaboratoryElectricPanel.cs index eb219d0d07..b3498b60cf 100644 --- a/Tiles/DraedonStructures/LaboratoryElectricPanel.cs +++ b/Tiles/DraedonStructures/LaboratoryElectricPanel.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Placeables.DraedonStructures; +using CalamityMod.Items.Placeables.DraedonStructures; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; diff --git a/Tiles/DraedonStructures/LaboratoryPanels.cs b/Tiles/DraedonStructures/LaboratoryPanels.cs index ca640e2e2d..61724a0d54 100644 --- a/Tiles/DraedonStructures/LaboratoryPanels.cs +++ b/Tiles/DraedonStructures/LaboratoryPanels.cs @@ -1,18 +1,19 @@ -using Microsoft.Xna.Framework; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; -using Terraria.ModLoader; using Terraria.ID; -using Microsoft.Xna.Framework.Graphics; +using Terraria.ModLoader; namespace CalamityMod.Tiles.DraedonStructures { - public class LaboratoryPanels : ModTile + public class LaboratoryPanels : ModTile, IMergeableTile { public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); - public byte[,] tileAdjacency; - public byte[,] secondTileAdjacency; + List IMergeableTile.TileAdjacencies { get; } = []; + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; @@ -26,23 +27,10 @@ namespace CalamityMod.Tiles.DraedonStructures MinPick = 30; AddMapEntry(new Color(36, 35, 37)); - TileFraming.SetUpUniversalMerge(Type, TileID.Dirt, out tileAdjacency); - TileFraming.SetUpUniversalMerge(Type, TileID.Stone, out secondTileAdjacency); + this.RegisterUniversalMerge(TileID.Dirt, "CalamityMod/Tiles/Merges/DirtMerge"); + this.RegisterUniversalMerge(TileID.Stone, "CalamityMod/Tiles/Merges/StoneMerge"); } public override bool CanExplode(int i, int j) => false; - - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) - { - TileFraming.DrawUniversalMergeFrames(i, j, secondTileAdjacency, "CalamityMod/Tiles/Merges/StoneMerge"); - TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/DirtMerge"); - } - - public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) - { - TileFraming.GetAdjacencyData(i, j, TileID.Dirt, out tileAdjacency[i, j]); - TileFraming.GetAdjacencyData(i, j, TileID.Stone, out secondTileAdjacency[i, j]); - return true; - } } } diff --git a/Tiles/DraedonStructures/LaboratoryPipePlating.cs b/Tiles/DraedonStructures/LaboratoryPipePlating.cs index 544fc1f5d2..963d4ed162 100644 --- a/Tiles/DraedonStructures/LaboratoryPipePlating.cs +++ b/Tiles/DraedonStructures/LaboratoryPipePlating.cs @@ -1,18 +1,19 @@ -using Microsoft.Xna.Framework; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; -using Terraria.ModLoader; using Terraria.ID; -using Microsoft.Xna.Framework.Graphics; +using Terraria.ModLoader; namespace CalamityMod.Tiles.DraedonStructures { - public class LaboratoryPipePlating : ModTile + public class LaboratoryPipePlating : ModTile, IMergeableTile { public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); - public byte[,] tileAdjacency; - public byte[,] secondTileAdjacency; + List IMergeableTile.TileAdjacencies { get; } = []; + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; @@ -25,22 +26,14 @@ namespace CalamityMod.Tiles.DraedonStructures MinPick = 30; AddMapEntry(new Color(91, 64, 56)); - TileFraming.SetUpUniversalMerge(Type, TileID.Dirt, out tileAdjacency); - TileFraming.SetUpUniversalMerge(Type, TileID.Stone, out secondTileAdjacency); + this.RegisterUniversalMerge(TileID.Dirt, "CalamityMod/Tiles/Merges/DirtMerge"); + this.RegisterUniversalMerge(TileID.Stone, "CalamityMod/Tiles/Merges/StoneMerge"); } public override bool CanExplode(int i, int j) => false; - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) - { - TileFraming.DrawUniversalMergeFrames(i, j, secondTileAdjacency, "CalamityMod/Tiles/Merges/StoneMerge"); - TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/DirtMerge"); - } - public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { - TileFraming.GetAdjacencyData(i, j, TileID.Dirt, out tileAdjacency[i, j]); - TileFraming.GetAdjacencyData(i, j, TileID.Stone, out secondTileAdjacency[i, j]); TileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType(), false, false, false); return false; } diff --git a/Tiles/DraedonStructures/LaboratoryPlating.cs b/Tiles/DraedonStructures/LaboratoryPlating.cs index 81e9ab6f2c..9f6e1c8f72 100644 --- a/Tiles/DraedonStructures/LaboratoryPlating.cs +++ b/Tiles/DraedonStructures/LaboratoryPlating.cs @@ -1,18 +1,19 @@ -using Microsoft.Xna.Framework; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; -using Terraria.ModLoader; using Terraria.ID; -using Microsoft.Xna.Framework.Graphics; +using Terraria.ModLoader; namespace CalamityMod.Tiles.DraedonStructures { - public class LaboratoryPlating : ModTile + public class LaboratoryPlating : ModTile, IMergeableTile { - public byte[,] tileAdjacency; - public byte[,] secondTileAdjacency; - public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); + + List IMergeableTile.TileAdjacencies { get; } = []; + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; @@ -25,22 +26,14 @@ namespace CalamityMod.Tiles.DraedonStructures MinPick = 30; AddMapEntry(new Color(162, 157, 150)); - TileFraming.SetUpUniversalMerge(Type, TileID.Dirt, out tileAdjacency); - TileFraming.SetUpUniversalMerge(Type, TileID.Stone, out secondTileAdjacency); + this.RegisterUniversalMerge(TileID.Dirt, "CalamityMod/Tiles/Merges/DirtMerge"); + this.RegisterUniversalMerge(TileID.Stone, "CalamityMod/Tiles/Merges/StoneMerge"); } public override bool CanExplode(int i, int j) => false; - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) - { - TileFraming.DrawUniversalMergeFrames(i, j, secondTileAdjacency, "CalamityMod/Tiles/Merges/StoneMerge"); - TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/DirtMerge"); - } - public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { - TileFraming.GetAdjacencyData(i, j, TileID.Dirt, out tileAdjacency[i, j]); - TileFraming.GetAdjacencyData(i, j, TileID.Stone, out secondTileAdjacency[i, j]); return TileFraming.BetterGemsparkFraming(i, j, resetFrame); } } diff --git a/Tiles/DraedonStructures/LaboratoryServer.cs b/Tiles/DraedonStructures/LaboratoryServer.cs index c9d239b13d..d10bd2a433 100644 --- a/Tiles/DraedonStructures/LaboratoryServer.cs +++ b/Tiles/DraedonStructures/LaboratoryServer.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; using Terraria.Enums; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; @@ -41,7 +42,7 @@ namespace CalamityMod.Tiles.DraedonStructures public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 182); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.TheDestroyer); return false; } diff --git a/Tiles/DraedonStructures/LaboratoryTerminal.cs b/Tiles/DraedonStructures/LaboratoryTerminal.cs index 4f63e97d19..94ff84121a 100644 --- a/Tiles/DraedonStructures/LaboratoryTerminal.cs +++ b/Tiles/DraedonStructures/LaboratoryTerminal.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; using Terraria.Enums; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; @@ -44,7 +45,7 @@ namespace CalamityMod.Tiles.DraedonStructures public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 182); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.TheDestroyer); return false; } diff --git a/Tiles/DraedonStructures/OnyxExcavatorTile.cs b/Tiles/DraedonStructures/OnyxExcavatorTile.cs index 825f3687be..4ee9b7a467 100644 --- a/Tiles/DraedonStructures/OnyxExcavatorTile.cs +++ b/Tiles/DraedonStructures/OnyxExcavatorTile.cs @@ -1,8 +1,8 @@ using CalamityMod.Items.Mounts; using Microsoft.Xna.Framework; using Terraria; -using Terraria.Enums; using Terraria.DataStructures; +using Terraria.Enums; using Terraria.GameContent; using Terraria.ModLoader; using Terraria.ObjectData; diff --git a/Tiles/DraedonStructures/PowerCellFactory.cs b/Tiles/DraedonStructures/PowerCellFactory.cs index 3a05299eaa..810360ee0b 100644 --- a/Tiles/DraedonStructures/PowerCellFactory.cs +++ b/Tiles/DraedonStructures/PowerCellFactory.cs @@ -5,6 +5,7 @@ using CalamityMod.TileEntities; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.DataStructures; using Terraria.Enums; using Terraria.GameContent.ObjectInteractions; @@ -12,7 +13,6 @@ using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; -using Terraria.Audio; namespace CalamityMod.Tiles.DraedonStructures { @@ -65,7 +65,7 @@ namespace CalamityMod.Tiles.DraedonStructures public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 226); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Electric); return false; } diff --git a/Tiles/DraedonStructures/ReinforcedCrate.cs b/Tiles/DraedonStructures/ReinforcedCrate.cs index e553a9213a..114871a032 100644 --- a/Tiles/DraedonStructures/ReinforcedCrate.cs +++ b/Tiles/DraedonStructures/ReinforcedCrate.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; @@ -29,7 +30,7 @@ namespace CalamityMod.Tiles.DraedonStructures public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 182); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.TheDestroyer); return false; } diff --git a/Tiles/DraedonStructures/RustedPipes.cs b/Tiles/DraedonStructures/RustedPipes.cs index d1ee485b41..ca7d0a0c49 100644 --- a/Tiles/DraedonStructures/RustedPipes.cs +++ b/Tiles/DraedonStructures/RustedPipes.cs @@ -1,8 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; -using Terraria.ModLoader; -using Terraria.ID; using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Tiles.DraedonStructures { @@ -24,7 +24,7 @@ namespace CalamityMod.Tiles.DraedonStructures public override void PlaceInWorld(int i, int j, Item item) { - SoundEngine.PlaySound(SoundID.Item52 with { Volume = SoundID.Item52.Volume * 0.75f, Pitch = SoundID.Item52.Pitch - 0.5f }, new Vector2( i * 16, j * 16 )); + SoundEngine.PlaySound(SoundID.Item52 with { Volume = SoundID.Item52.Volume * 0.75f, Pitch = SoundID.Item52.Pitch - 0.5f }, new Vector2(i * 16, j * 16)); } } } diff --git a/Tiles/DraedonStructures/RustedPlating.cs b/Tiles/DraedonStructures/RustedPlating.cs index 87dcd9bd8c..44eff8e23b 100644 --- a/Tiles/DraedonStructures/RustedPlating.cs +++ b/Tiles/DraedonStructures/RustedPlating.cs @@ -1,18 +1,18 @@ -using Microsoft.Xna.Framework; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; -using Terraria.ModLoader; using Terraria.ID; -using Microsoft.Xna.Framework.Graphics; +using Terraria.ModLoader; namespace CalamityMod.Tiles.DraedonStructures { - public class RustedPlating : ModTile + public class RustedPlating : ModTile, IMergeableTile { public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); - public byte[,] tileAdjacency; - public byte[,] secondTileAdjacency; + List IMergeableTile.TileAdjacencies { get; } = []; public override void SetStaticDefaults() { @@ -26,21 +26,14 @@ namespace CalamityMod.Tiles.DraedonStructures MinPick = 30; AddMapEntry(new Color(128, 90, 77)); - TileFraming.SetUpUniversalMerge(Type, TileID.Dirt, out tileAdjacency); - TileFraming.SetUpUniversalMerge(Type, TileID.Stone, out secondTileAdjacency); - } - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) - { - TileFraming.DrawUniversalMergeFrames(i, j, secondTileAdjacency, "CalamityMod/Tiles/Merges/StoneMerge"); - TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/DirtMerge"); + this.RegisterUniversalMerge(TileID.Dirt, "CalamityMod/Tiles/Merges/DirtMerge"); + this.RegisterUniversalMerge(TileID.Stone, "CalamityMod/Tiles/Merges/StoneMerge"); } public override bool CanExplode(int i, int j) => false; public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { - TileFraming.GetAdjacencyData(i, j, TileID.Dirt, out tileAdjacency[i, j]); - TileFraming.GetAdjacencyData(i, j, TileID.Stone, out secondTileAdjacency[i, j]); return TileFraming.BetterGemsparkFraming(i, j, resetFrame); } } diff --git a/Tiles/DraedonStructures/SecurityChestTile.cs b/Tiles/DraedonStructures/SecurityChestTile.cs index 19dc924cd5..c9c350c9f9 100644 --- a/Tiles/DraedonStructures/SecurityChestTile.cs +++ b/Tiles/DraedonStructures/SecurityChestTile.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -18,7 +19,7 @@ namespace CalamityMod.Tiles.DraedonStructures public override bool CanExplode(int i, int j) => false; public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 226, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Electric, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; diff --git a/Tiles/DraedonSummoner/CodebreakerTile.cs b/Tiles/DraedonSummoner/CodebreakerTile.cs index b716315fae..c8454d49f1 100644 --- a/Tiles/DraedonSummoner/CodebreakerTile.cs +++ b/Tiles/DraedonSummoner/CodebreakerTile.cs @@ -1,9 +1,12 @@ using CalamityMod.Items.DraedonMisc; using CalamityMod.TileEntities; using CalamityMod.UI; +using CalamityMod.UI.DraedonSummoning; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; +using Terraria.Audio; using Terraria.DataStructures; using Terraria.Enums; using Terraria.GameContent.ObjectInteractions; @@ -11,9 +14,6 @@ using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; -using Terraria.Audio; -using ReLogic.Content; -using CalamityMod.UI.DraedonSummoning; namespace CalamityMod.Tiles.DraedonSummoner { @@ -99,7 +99,7 @@ namespace CalamityMod.Tiles.DraedonSummoner public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 182); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.TheDestroyer); return false; } diff --git a/Tiles/Furniture/BabyCannonballJellyfishBowlTile.cs b/Tiles/Furniture/BabyCannonballJellyfishBowlTile.cs index 8cd09a2165..28ecf21af7 100644 --- a/Tiles/Furniture/BabyCannonballJellyfishBowlTile.cs +++ b/Tiles/Furniture/BabyCannonballJellyfishBowlTile.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Tiles.Furniture public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 13, 0f, 0f, 0, new Color(), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Glass, 0f, 0f, 0, new Color(), 1f); return false; } diff --git a/Tiles/Furniture/BabyFlakCrabCageTile.cs b/Tiles/Furniture/BabyFlakCrabCageTile.cs index 58fed36677..2e1ad66170 100644 --- a/Tiles/Furniture/BabyFlakCrabCageTile.cs +++ b/Tiles/Furniture/BabyFlakCrabCageTile.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; @@ -23,7 +24,7 @@ namespace CalamityMod.Tiles.Furniture public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 13, 0f, 0f, 0, new Color(), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Glass, 0f, 0f, 0, new Color(), 1f); return false; } diff --git a/Tiles/Furniture/BabyGhostBellJarTile.cs b/Tiles/Furniture/BabyGhostBellJarTile.cs index b4333b0ff0..a7a504383a 100644 --- a/Tiles/Furniture/BabyGhostBellJarTile.cs +++ b/Tiles/Furniture/BabyGhostBellJarTile.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Tiles.Furniture public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 13, 0f, 0f, 0, new Color(), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Glass, 0f, 0f, 0, new Color(), 1f); return false; } diff --git a/Tiles/Furniture/BossRelics/DesertScourgeRelic.png b/Tiles/Furniture/BossRelics/DesertScourgeRelic.png index 11ca1ba0b5..93f0bf8e60 100644 Binary files a/Tiles/Furniture/BossRelics/DesertScourgeRelic.png and b/Tiles/Furniture/BossRelics/DesertScourgeRelic.png differ diff --git a/Tiles/Furniture/BossRelics/HiveMindRelic.png b/Tiles/Furniture/BossRelics/HiveMindRelic.png index 44968be55d..dfb4176334 100644 Binary files a/Tiles/Furniture/BossRelics/HiveMindRelic.png and b/Tiles/Furniture/BossRelics/HiveMindRelic.png differ diff --git a/Tiles/Furniture/BossRelics/PerforatorsRelic.png b/Tiles/Furniture/BossRelics/PerforatorsRelic.png index 0dfc66b2e6..8f51d70f22 100644 Binary files a/Tiles/Furniture/BossRelics/PerforatorsRelic.png and b/Tiles/Furniture/BossRelics/PerforatorsRelic.png differ diff --git a/Tiles/Furniture/BossTrophies/AnahitaTrophyTile.cs b/Tiles/Furniture/BossTrophies/AnahitaTrophyTile.cs index 6763df718d..7048372e7a 100644 --- a/Tiles/Furniture/BossTrophies/AnahitaTrophyTile.cs +++ b/Tiles/Furniture/BossTrophies/AnahitaTrophyTile.cs @@ -13,4 +13,4 @@ namespace CalamityMod.Tiles.Furniture.BossTrophies { public override void SetStaticDefaults() => this.SetUpTrophy(); } -} \ No newline at end of file +} diff --git a/Tiles/Furniture/BossTrophies/ApolloTrophyTile.cs b/Tiles/Furniture/BossTrophies/ApolloTrophyTile.cs index 92698f2e52..9ccb79a365 100644 --- a/Tiles/Furniture/BossTrophies/ApolloTrophyTile.cs +++ b/Tiles/Furniture/BossTrophies/ApolloTrophyTile.cs @@ -13,4 +13,4 @@ namespace CalamityMod.Tiles.Furniture.BossTrophies { public override void SetStaticDefaults() => this.SetUpTrophy(); } -} \ No newline at end of file +} diff --git a/Tiles/Furniture/BossTrophies/AquaticScourgeTrophyTile.cs b/Tiles/Furniture/BossTrophies/AquaticScourgeTrophyTile.cs index cd84d841ef..9f4125a073 100644 --- a/Tiles/Furniture/BossTrophies/AquaticScourgeTrophyTile.cs +++ b/Tiles/Furniture/BossTrophies/AquaticScourgeTrophyTile.cs @@ -13,4 +13,4 @@ namespace CalamityMod.Tiles.Furniture.BossTrophies { public override void SetStaticDefaults() => this.SetUpTrophy(); } -} \ No newline at end of file +} diff --git a/Tiles/Furniture/BossTrophies/AresTrophyTile.cs b/Tiles/Furniture/BossTrophies/AresTrophyTile.cs index 9d68fdd8c4..63ec38a3e1 100644 --- a/Tiles/Furniture/BossTrophies/AresTrophyTile.cs +++ b/Tiles/Furniture/BossTrophies/AresTrophyTile.cs @@ -13,4 +13,4 @@ namespace CalamityMod.Tiles.Furniture.BossTrophies { public override void SetStaticDefaults() => this.SetUpTrophy(); } -} \ No newline at end of file +} diff --git a/Tiles/Furniture/BossTrophies/ArtemisTrophyTile.cs b/Tiles/Furniture/BossTrophies/ArtemisTrophyTile.cs index 9d9e4bde69..b0dd332051 100644 --- a/Tiles/Furniture/BossTrophies/ArtemisTrophyTile.cs +++ b/Tiles/Furniture/BossTrophies/ArtemisTrophyTile.cs @@ -13,4 +13,4 @@ namespace CalamityMod.Tiles.Furniture.BossTrophies { public override void SetStaticDefaults() => this.SetUpTrophy(); } -} \ No newline at end of file +} diff --git a/Tiles/Furniture/BossTrophies/AstrumAureusTrophyTile.cs b/Tiles/Furniture/BossTrophies/AstrumAureusTrophyTile.cs index 20940f2a55..6a70323c4e 100644 --- a/Tiles/Furniture/BossTrophies/AstrumAureusTrophyTile.cs +++ b/Tiles/Furniture/BossTrophies/AstrumAureusTrophyTile.cs @@ -13,4 +13,4 @@ namespace CalamityMod.Tiles.Furniture.BossTrophies { public override void SetStaticDefaults() => this.SetUpTrophy(); } -} \ No newline at end of file +} diff --git a/Tiles/Furniture/BossTrophies/AstrumDeusTrophyTile.cs b/Tiles/Furniture/BossTrophies/AstrumDeusTrophyTile.cs index 1ff7abd545..bd5dd1ffa8 100644 --- a/Tiles/Furniture/BossTrophies/AstrumDeusTrophyTile.cs +++ b/Tiles/Furniture/BossTrophies/AstrumDeusTrophyTile.cs @@ -13,4 +13,4 @@ namespace CalamityMod.Tiles.Furniture.BossTrophies { public override void SetStaticDefaults() => this.SetUpTrophy(); } -} \ No newline at end of file +} diff --git a/Tiles/Furniture/BossTrophies/BrimstoneElementalTrophyTile.cs b/Tiles/Furniture/BossTrophies/BrimstoneElementalTrophyTile.cs index c3f1549053..579fc2726e 100644 --- a/Tiles/Furniture/BossTrophies/BrimstoneElementalTrophyTile.cs +++ b/Tiles/Furniture/BossTrophies/BrimstoneElementalTrophyTile.cs @@ -13,4 +13,4 @@ namespace CalamityMod.Tiles.Furniture.BossTrophies { public override void SetStaticDefaults() => this.SetUpTrophy(); } -} \ No newline at end of file +} diff --git a/Tiles/Furniture/BossTrophies/CalamitasCloneTrophyTile.cs b/Tiles/Furniture/BossTrophies/CalamitasCloneTrophyTile.cs index c22d014da4..8e57294b18 100644 --- a/Tiles/Furniture/BossTrophies/CalamitasCloneTrophyTile.cs +++ b/Tiles/Furniture/BossTrophies/CalamitasCloneTrophyTile.cs @@ -12,4 +12,4 @@ namespace CalamityMod.Tiles.Furniture.BossTrophies { public override void SetStaticDefaults() => this.SetUpTrophy(); } -} \ No newline at end of file +} diff --git a/Tiles/Furniture/BossTrophies/CataclysmTrophyTile.cs b/Tiles/Furniture/BossTrophies/CataclysmTrophyTile.cs index 59c2430c1c..f66232efd0 100644 --- a/Tiles/Furniture/BossTrophies/CataclysmTrophyTile.cs +++ b/Tiles/Furniture/BossTrophies/CataclysmTrophyTile.cs @@ -13,4 +13,4 @@ namespace CalamityMod.Tiles.Furniture.BossTrophies { public override void SetStaticDefaults() => this.SetUpTrophy(); } -} \ No newline at end of file +} diff --git a/Tiles/Furniture/BossTrophies/CatastropheTrophyTile.cs b/Tiles/Furniture/BossTrophies/CatastropheTrophyTile.cs index 5d7854610a..4f9d7de554 100644 --- a/Tiles/Furniture/BossTrophies/CatastropheTrophyTile.cs +++ b/Tiles/Furniture/BossTrophies/CatastropheTrophyTile.cs @@ -13,4 +13,4 @@ namespace CalamityMod.Tiles.Furniture.BossTrophies { public override void SetStaticDefaults() => this.SetUpTrophy(); } -} \ No newline at end of file +} diff --git a/Tiles/Furniture/BossTrophies/CeaselessVoidTrophyTile.cs b/Tiles/Furniture/BossTrophies/CeaselessVoidTrophyTile.cs index 1ed4112dff..2c57720d9c 100644 --- a/Tiles/Furniture/BossTrophies/CeaselessVoidTrophyTile.cs +++ b/Tiles/Furniture/BossTrophies/CeaselessVoidTrophyTile.cs @@ -13,4 +13,4 @@ namespace CalamityMod.Tiles.Furniture.BossTrophies { public override void SetStaticDefaults() => this.SetUpTrophy(); } -} \ No newline at end of file +} diff --git a/Tiles/Furniture/BossTrophies/CrabulonTrophyTile.cs b/Tiles/Furniture/BossTrophies/CrabulonTrophyTile.cs index eb7e736d64..2df1cd7282 100644 --- a/Tiles/Furniture/BossTrophies/CrabulonTrophyTile.cs +++ b/Tiles/Furniture/BossTrophies/CrabulonTrophyTile.cs @@ -13,4 +13,4 @@ namespace CalamityMod.Tiles.Furniture.BossTrophies { public override void SetStaticDefaults() => this.SetUpTrophy(); } -} \ No newline at end of file +} diff --git a/Tiles/Furniture/BossTrophies/CragmawMireTrophyTile.cs b/Tiles/Furniture/BossTrophies/CragmawMireTrophyTile.cs index fa47da2edf..37a04a3147 100644 --- a/Tiles/Furniture/BossTrophies/CragmawMireTrophyTile.cs +++ b/Tiles/Furniture/BossTrophies/CragmawMireTrophyTile.cs @@ -13,4 +13,4 @@ namespace CalamityMod.Tiles.Furniture.BossTrophies { public override void SetStaticDefaults() => this.SetUpTrophy(); } -} \ No newline at end of file +} diff --git a/Tiles/Furniture/BossTrophies/CryogenTrophyTile.cs b/Tiles/Furniture/BossTrophies/CryogenTrophyTile.cs index a9fdb3303f..85b7281de5 100644 --- a/Tiles/Furniture/BossTrophies/CryogenTrophyTile.cs +++ b/Tiles/Furniture/BossTrophies/CryogenTrophyTile.cs @@ -13,4 +13,4 @@ namespace CalamityMod.Tiles.Furniture.BossTrophies { public override void SetStaticDefaults() => this.SetUpTrophy(); } -} \ No newline at end of file +} diff --git a/Tiles/Furniture/BossTrophies/DesertScourgeTrophyTile.cs b/Tiles/Furniture/BossTrophies/DesertScourgeTrophyTile.cs index 4d3406a3df..276aa97a44 100644 --- a/Tiles/Furniture/BossTrophies/DesertScourgeTrophyTile.cs +++ b/Tiles/Furniture/BossTrophies/DesertScourgeTrophyTile.cs @@ -13,4 +13,4 @@ namespace CalamityMod.Tiles.Furniture.BossTrophies { public override void SetStaticDefaults() => this.SetUpTrophy(); } -} \ No newline at end of file +} diff --git a/Tiles/Furniture/BossTrophies/DesertScourgeTrophyTile.png b/Tiles/Furniture/BossTrophies/DesertScourgeTrophyTile.png index 92d487c939..045dadb742 100644 Binary files a/Tiles/Furniture/BossTrophies/DesertScourgeTrophyTile.png and b/Tiles/Furniture/BossTrophies/DesertScourgeTrophyTile.png differ diff --git a/Tiles/Furniture/BossTrophies/DevourerofGodsTrophyTile.cs b/Tiles/Furniture/BossTrophies/DevourerofGodsTrophyTile.cs index 55a44f5a44..7b68a527e3 100644 --- a/Tiles/Furniture/BossTrophies/DevourerofGodsTrophyTile.cs +++ b/Tiles/Furniture/BossTrophies/DevourerofGodsTrophyTile.cs @@ -13,4 +13,4 @@ namespace CalamityMod.Tiles.Furniture.BossTrophies { public override void SetStaticDefaults() => this.SetUpTrophy(); } -} \ No newline at end of file +} diff --git a/Tiles/Furniture/BossTrophies/DragonfollyTrophyTile.cs b/Tiles/Furniture/BossTrophies/DragonfollyTrophyTile.cs index dc4c03cc8e..4790f3444c 100644 --- a/Tiles/Furniture/BossTrophies/DragonfollyTrophyTile.cs +++ b/Tiles/Furniture/BossTrophies/DragonfollyTrophyTile.cs @@ -13,4 +13,4 @@ namespace CalamityMod.Tiles.Furniture.BossTrophies { public override void SetStaticDefaults() => this.SetUpTrophy(); } -} \ No newline at end of file +} diff --git a/Tiles/Furniture/BossTrophies/GiantClamTrophyTile.cs b/Tiles/Furniture/BossTrophies/GiantClamTrophyTile.cs index c111c4b6bf..87d82f0cdb 100644 --- a/Tiles/Furniture/BossTrophies/GiantClamTrophyTile.cs +++ b/Tiles/Furniture/BossTrophies/GiantClamTrophyTile.cs @@ -13,4 +13,4 @@ namespace CalamityMod.Tiles.Furniture.BossTrophies { public override void SetStaticDefaults() => this.SetUpTrophy(); } -} \ No newline at end of file +} diff --git a/Tiles/Furniture/BossTrophies/GreatSandSharkTrophyTile.cs b/Tiles/Furniture/BossTrophies/GreatSandSharkTrophyTile.cs index 092e6d7ad4..8d5f1494b5 100644 --- a/Tiles/Furniture/BossTrophies/GreatSandSharkTrophyTile.cs +++ b/Tiles/Furniture/BossTrophies/GreatSandSharkTrophyTile.cs @@ -13,4 +13,4 @@ namespace CalamityMod.Tiles.Furniture.BossTrophies { public override void SetStaticDefaults() => this.SetUpTrophy(); } -} \ No newline at end of file +} diff --git a/Tiles/Furniture/BossTrophies/HiveMindTrophyTile.cs b/Tiles/Furniture/BossTrophies/HiveMindTrophyTile.cs index 46a4b3804a..9c12be8207 100644 --- a/Tiles/Furniture/BossTrophies/HiveMindTrophyTile.cs +++ b/Tiles/Furniture/BossTrophies/HiveMindTrophyTile.cs @@ -13,4 +13,4 @@ namespace CalamityMod.Tiles.Furniture.BossTrophies { public override void SetStaticDefaults() => this.SetUpTrophy(); } -} \ No newline at end of file +} diff --git a/Tiles/Furniture/BossTrophies/LeviathanTrophyTile.cs b/Tiles/Furniture/BossTrophies/LeviathanTrophyTile.cs index d0cb654ad0..cb5c2da9cc 100644 --- a/Tiles/Furniture/BossTrophies/LeviathanTrophyTile.cs +++ b/Tiles/Furniture/BossTrophies/LeviathanTrophyTile.cs @@ -13,4 +13,4 @@ namespace CalamityMod.Tiles.Furniture.BossTrophies { public override void SetStaticDefaults() => this.SetUpTrophy(); } -} \ No newline at end of file +} diff --git a/Tiles/Furniture/BossTrophies/MaulerTrophyTile.cs b/Tiles/Furniture/BossTrophies/MaulerTrophyTile.cs index 7f148470fb..b3c1f61f04 100644 --- a/Tiles/Furniture/BossTrophies/MaulerTrophyTile.cs +++ b/Tiles/Furniture/BossTrophies/MaulerTrophyTile.cs @@ -13,4 +13,4 @@ namespace CalamityMod.Tiles.Furniture.BossTrophies { public override void SetStaticDefaults() => this.SetUpTrophy(); } -} \ No newline at end of file +} diff --git a/Tiles/Furniture/BossTrophies/NuclearTerrorTrophyTile.cs b/Tiles/Furniture/BossTrophies/NuclearTerrorTrophyTile.cs index 1f1ad288b3..f2f7c75562 100644 --- a/Tiles/Furniture/BossTrophies/NuclearTerrorTrophyTile.cs +++ b/Tiles/Furniture/BossTrophies/NuclearTerrorTrophyTile.cs @@ -13,4 +13,4 @@ namespace CalamityMod.Tiles.Furniture.BossTrophies { public override void SetStaticDefaults() => this.SetUpTrophy(); } -} \ No newline at end of file +} diff --git a/Tiles/Furniture/BossTrophies/OldDukeTrophyTile.cs b/Tiles/Furniture/BossTrophies/OldDukeTrophyTile.cs index 6fd2213463..f3078dcb67 100644 --- a/Tiles/Furniture/BossTrophies/OldDukeTrophyTile.cs +++ b/Tiles/Furniture/BossTrophies/OldDukeTrophyTile.cs @@ -13,4 +13,4 @@ namespace CalamityMod.Tiles.Furniture.BossTrophies { public override void SetStaticDefaults() => this.SetUpTrophy(); } -} \ No newline at end of file +} diff --git a/Tiles/Furniture/BossTrophies/PerforatorTrophyTile.cs b/Tiles/Furniture/BossTrophies/PerforatorTrophyTile.cs index 02d995d4c8..1e44b53d07 100644 --- a/Tiles/Furniture/BossTrophies/PerforatorTrophyTile.cs +++ b/Tiles/Furniture/BossTrophies/PerforatorTrophyTile.cs @@ -13,4 +13,4 @@ namespace CalamityMod.Tiles.Furniture.BossTrophies { public override void SetStaticDefaults() => this.SetUpTrophy(); } -} \ No newline at end of file +} diff --git a/Tiles/Furniture/BossTrophies/PlaguebringerGoliathTrophyTile.cs b/Tiles/Furniture/BossTrophies/PlaguebringerGoliathTrophyTile.cs index 882883d68f..14f0d3334f 100644 --- a/Tiles/Furniture/BossTrophies/PlaguebringerGoliathTrophyTile.cs +++ b/Tiles/Furniture/BossTrophies/PlaguebringerGoliathTrophyTile.cs @@ -13,4 +13,4 @@ namespace CalamityMod.Tiles.Furniture.BossTrophies { public override void SetStaticDefaults() => this.SetUpTrophy(); } -} \ No newline at end of file +} diff --git a/Tiles/Furniture/BossTrophies/PolterghastTrophyTile.cs b/Tiles/Furniture/BossTrophies/PolterghastTrophyTile.cs index d81fec9aef..de357c9f9e 100644 --- a/Tiles/Furniture/BossTrophies/PolterghastTrophyTile.cs +++ b/Tiles/Furniture/BossTrophies/PolterghastTrophyTile.cs @@ -13,4 +13,4 @@ namespace CalamityMod.Tiles.Furniture.BossTrophies { public override void SetStaticDefaults() => this.SetUpTrophy(); } -} \ No newline at end of file +} diff --git a/Tiles/Furniture/BossTrophies/ProfanedGuardianTrophyTile.cs b/Tiles/Furniture/BossTrophies/ProfanedGuardianTrophyTile.cs index 21647512f9..abdc13ca60 100644 --- a/Tiles/Furniture/BossTrophies/ProfanedGuardianTrophyTile.cs +++ b/Tiles/Furniture/BossTrophies/ProfanedGuardianTrophyTile.cs @@ -13,4 +13,4 @@ namespace CalamityMod.Tiles.Furniture.BossTrophies { public override void SetStaticDefaults() => this.SetUpTrophy(); } -} \ No newline at end of file +} diff --git a/Tiles/Furniture/BossTrophies/ProvidenceTrophyTile.cs b/Tiles/Furniture/BossTrophies/ProvidenceTrophyTile.cs index 4b022de181..d1c028f2be 100644 --- a/Tiles/Furniture/BossTrophies/ProvidenceTrophyTile.cs +++ b/Tiles/Furniture/BossTrophies/ProvidenceTrophyTile.cs @@ -13,4 +13,4 @@ namespace CalamityMod.Tiles.Furniture.BossTrophies { public override void SetStaticDefaults() => this.SetUpTrophy(); } -} \ No newline at end of file +} diff --git a/Tiles/Furniture/BossTrophies/RavagerTrophyTile.cs b/Tiles/Furniture/BossTrophies/RavagerTrophyTile.cs index 2061e4fd02..997fca438b 100644 --- a/Tiles/Furniture/BossTrophies/RavagerTrophyTile.cs +++ b/Tiles/Furniture/BossTrophies/RavagerTrophyTile.cs @@ -13,4 +13,4 @@ namespace CalamityMod.Tiles.Furniture.BossTrophies { public override void SetStaticDefaults() => this.SetUpTrophy(); } -} \ No newline at end of file +} diff --git a/Tiles/Furniture/BossTrophies/SignusTrophyTile.cs b/Tiles/Furniture/BossTrophies/SignusTrophyTile.cs index bfe86b5317..36698b7d99 100644 --- a/Tiles/Furniture/BossTrophies/SignusTrophyTile.cs +++ b/Tiles/Furniture/BossTrophies/SignusTrophyTile.cs @@ -13,4 +13,4 @@ namespace CalamityMod.Tiles.Furniture.BossTrophies { public override void SetStaticDefaults() => this.SetUpTrophy(); } -} \ No newline at end of file +} diff --git a/Tiles/Furniture/BossTrophies/SlimeGodTrophyTile.cs b/Tiles/Furniture/BossTrophies/SlimeGodTrophyTile.cs index c37c411a5b..98b7eedc80 100644 --- a/Tiles/Furniture/BossTrophies/SlimeGodTrophyTile.cs +++ b/Tiles/Furniture/BossTrophies/SlimeGodTrophyTile.cs @@ -13,4 +13,4 @@ namespace CalamityMod.Tiles.Furniture.BossTrophies { public override void SetStaticDefaults() => this.SetUpTrophy(); } -} \ No newline at end of file +} diff --git a/Tiles/Furniture/BossTrophies/StormWeaverTrophyTile.cs b/Tiles/Furniture/BossTrophies/StormWeaverTrophyTile.cs index 71b5e1145d..fa3c4c339f 100644 --- a/Tiles/Furniture/BossTrophies/StormWeaverTrophyTile.cs +++ b/Tiles/Furniture/BossTrophies/StormWeaverTrophyTile.cs @@ -13,4 +13,4 @@ namespace CalamityMod.Tiles.Furniture.BossTrophies { public override void SetStaticDefaults() => this.SetUpTrophy(); } -} \ No newline at end of file +} diff --git a/Tiles/Furniture/BossTrophies/SupremeCalamitasTrophyTile.cs b/Tiles/Furniture/BossTrophies/SupremeCalamitasTrophyTile.cs index d59f5bc291..bd5f8ec461 100644 --- a/Tiles/Furniture/BossTrophies/SupremeCalamitasTrophyTile.cs +++ b/Tiles/Furniture/BossTrophies/SupremeCalamitasTrophyTile.cs @@ -13,4 +13,4 @@ namespace CalamityMod.Tiles.Furniture.BossTrophies { public override void SetStaticDefaults() => this.SetUpTrophy(); } -} \ No newline at end of file +} diff --git a/Tiles/Furniture/BossTrophies/SupremeCataclysmTrophyTile.cs b/Tiles/Furniture/BossTrophies/SupremeCataclysmTrophyTile.cs index 859f855f5c..1f81354efc 100644 --- a/Tiles/Furniture/BossTrophies/SupremeCataclysmTrophyTile.cs +++ b/Tiles/Furniture/BossTrophies/SupremeCataclysmTrophyTile.cs @@ -13,4 +13,4 @@ namespace CalamityMod.Tiles.Furniture.BossTrophies { public override void SetStaticDefaults() => this.SetUpTrophy(); } -} \ No newline at end of file +} diff --git a/Tiles/Furniture/BossTrophies/SupremeCatastropheTrophyTile.cs b/Tiles/Furniture/BossTrophies/SupremeCatastropheTrophyTile.cs index ec7ee4b36c..9da17a1c6b 100644 --- a/Tiles/Furniture/BossTrophies/SupremeCatastropheTrophyTile.cs +++ b/Tiles/Furniture/BossTrophies/SupremeCatastropheTrophyTile.cs @@ -13,4 +13,4 @@ namespace CalamityMod.Tiles.Furniture.BossTrophies { public override void SetStaticDefaults() => this.SetUpTrophy(); } -} \ No newline at end of file +} diff --git a/Tiles/Furniture/BossTrophies/ThanatosTrophyTile.cs b/Tiles/Furniture/BossTrophies/ThanatosTrophyTile.cs index f48f582c08..11b5413c15 100644 --- a/Tiles/Furniture/BossTrophies/ThanatosTrophyTile.cs +++ b/Tiles/Furniture/BossTrophies/ThanatosTrophyTile.cs @@ -13,4 +13,4 @@ namespace CalamityMod.Tiles.Furniture.BossTrophies { public override void SetStaticDefaults() => this.SetUpTrophy(); } -} \ No newline at end of file +} diff --git a/Tiles/Furniture/BossTrophies/YharonTrophyTile.cs b/Tiles/Furniture/BossTrophies/YharonTrophyTile.cs index 3f359a45fa..2d2a71f93f 100644 --- a/Tiles/Furniture/BossTrophies/YharonTrophyTile.cs +++ b/Tiles/Furniture/BossTrophies/YharonTrophyTile.cs @@ -13,4 +13,4 @@ namespace CalamityMod.Tiles.Furniture.BossTrophies { public override void SetStaticDefaults() => this.SetUpTrophy(); } -} \ No newline at end of file +} diff --git a/Tiles/Furniture/CirrusCouch.cs b/Tiles/Furniture/CirrusCouch.cs new file mode 100644 index 0000000000..29551f8bb3 --- /dev/null +++ b/Tiles/Furniture/CirrusCouch.cs @@ -0,0 +1,37 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.GameContent; +using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.Furniture +{ + public class CirrusCouch : ModTile + { + public override void SetStaticDefaults() => this.SetUpSofa(ModContent.ItemType(), true); + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.PinkFairy); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.BenchSitInfo(i, j, ref info); + + public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); + + public override void MouseOver(int i, int j) => CalamityUtils.BenchMouseOver(i, j, ModContent.ItemType()); + + public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) + { + return settings.player.IsWithinSnappngRangeToTile(i, j, PlayerSittingHelper.ChairSittingMaxDistance); + } + } +} diff --git a/Tiles/Furniture/CirrusCouch.png b/Tiles/Furniture/CirrusCouch.png new file mode 100644 index 0000000000..b494def714 Binary files /dev/null and b/Tiles/Furniture/CirrusCouch.png differ diff --git a/Tiles/Furniture/CirrusCouch_Highlight.png b/Tiles/Furniture/CirrusCouch_Highlight.png new file mode 100644 index 0000000000..37368baef2 Binary files /dev/null and b/Tiles/Furniture/CirrusCouch_Highlight.png differ diff --git a/Tiles/Furniture/CraftingStations/AncientAltar.cs b/Tiles/Furniture/CraftingStations/AncientAltar.cs index 193159152e..fb2008520f 100644 --- a/Tiles/Furniture/CraftingStations/AncientAltar.cs +++ b/Tiles/Furniture/CraftingStations/AncientAltar.cs @@ -28,8 +28,8 @@ namespace CalamityMod.Tiles.Furniture.CraftingStations public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 100, 100), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.RedTorch, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 100, 100), 1f); return false; } diff --git a/Tiles/Furniture/CraftingStations/AshenAltar.cs b/Tiles/Furniture/CraftingStations/AshenAltar.cs index 9411db575f..5f9aaf7975 100644 --- a/Tiles/Furniture/CraftingStations/AshenAltar.cs +++ b/Tiles/Furniture/CraftingStations/AshenAltar.cs @@ -28,8 +28,8 @@ namespace CalamityMod.Tiles.Furniture.CraftingStations public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 100, 100), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.RedTorch, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 100, 100), 1f); return false; } diff --git a/Tiles/Furniture/CraftingStations/EutrophicShelf.cs b/Tiles/Furniture/CraftingStations/EutrophicShelf.cs index ea6c0200b9..d4f3fda524 100644 --- a/Tiles/Furniture/CraftingStations/EutrophicShelf.cs +++ b/Tiles/Furniture/CraftingStations/EutrophicShelf.cs @@ -52,7 +52,7 @@ namespace CalamityMod.Tiles.Furniture.CraftingStations public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 51, 0f, 0f, 1, new Color(54, 69, 72), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.SnowBlock, 0f, 0f, 1, new Color(54, 69, 72), 1f); return false; } diff --git a/Tiles/Furniture/CraftingStations/PlagueInfuser.cs b/Tiles/Furniture/CraftingStations/PlagueInfuser.cs index 4cc76b9f2a..84d5afa3be 100644 --- a/Tiles/Furniture/CraftingStations/PlagueInfuser.cs +++ b/Tiles/Furniture/CraftingStations/PlagueInfuser.cs @@ -2,6 +2,7 @@ using Terraria; using Terraria.DataStructures; using Terraria.Enums; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; @@ -33,7 +34,7 @@ namespace CalamityMod.Tiles.Furniture.CraftingStations public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 178, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.BubbleBurst_Green, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/Furniture/CraftingStations/ProfanedCrucible.cs b/Tiles/Furniture/CraftingStations/ProfanedCrucible.cs index 33dca758bd..98677f75b2 100644 --- a/Tiles/Furniture/CraftingStations/ProfanedCrucible.cs +++ b/Tiles/Furniture/CraftingStations/ProfanedCrucible.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Tiles.Furniture.CraftingStations public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 246, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.GoldCoin, 0f, 0f, 1, new Color(255, 255, 255), 1f); Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, ModContent.DustType(), 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/Furniture/CraftingStations/SCalAltar.cs b/Tiles/Furniture/CraftingStations/SCalAltar.cs index 7209664b7d..36ab9cef5e 100644 --- a/Tiles/Furniture/CraftingStations/SCalAltar.cs +++ b/Tiles/Furniture/CraftingStations/SCalAltar.cs @@ -9,13 +9,13 @@ using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.DataStructures; using Terraria.Enums; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; -using Terraria.Audio; namespace CalamityMod.Tiles.Furniture.CraftingStations { @@ -108,7 +108,7 @@ namespace CalamityMod.Tiles.Furniture.CraftingStations bool usingSpecialItem = Main.LocalPlayer.HasItem(ModContent.ItemType()); Vector2 ritualSpawnPosition = new Vector2(left + Width / 2, top).ToWorldCoordinates(); - ritualSpawnPosition += new Vector2(-10f, -24f); + ritualSpawnPosition += new Vector2(0f, -24f); SoundEngine.PlaySound(SummonSound, ritualSpawnPosition); Projectile.NewProjectile(new EntitySource_WorldEvent(), ritualSpawnPosition, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 0, vodka.ToInt()); diff --git a/Tiles/Furniture/CraftingStations/SilvaBasin.cs b/Tiles/Furniture/CraftingStations/SilvaBasin.cs index 1c0236d8c4..a056b5aed6 100644 --- a/Tiles/Furniture/CraftingStations/SilvaBasin.cs +++ b/Tiles/Furniture/CraftingStations/SilvaBasin.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Tiles.Furniture.CraftingStations public override bool CreateDust(int i, int j, ref int type) { Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, ModContent.DustType(), 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 157, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.ChlorophyteWeapon, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/Furniture/CraftingStations/StaticRefiner.cs b/Tiles/Furniture/CraftingStations/StaticRefiner.cs index e91e660546..092060fb68 100644 --- a/Tiles/Furniture/CraftingStations/StaticRefiner.cs +++ b/Tiles/Furniture/CraftingStations/StaticRefiner.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Tiles.Furniture.CraftingStations public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 243, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.PinkSlime, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/Furniture/CraftingStations/VoidCondenser.cs b/Tiles/Furniture/CraftingStations/VoidCondenser.cs index a72163d09c..9f18321f49 100644 --- a/Tiles/Furniture/CraftingStations/VoidCondenser.cs +++ b/Tiles/Furniture/CraftingStations/VoidCondenser.cs @@ -1,6 +1,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; @@ -25,7 +26,7 @@ namespace CalamityMod.Tiles.Furniture.CraftingStations public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 180, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.DungeonSpirit, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/Furniture/CraftingStations/WulfrumLabstation.cs b/Tiles/Furniture/CraftingStations/WulfrumLabstation.cs index bf8867fc1a..8cd29cfa01 100644 --- a/Tiles/Furniture/CraftingStations/WulfrumLabstation.cs +++ b/Tiles/Furniture/CraftingStations/WulfrumLabstation.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; @@ -21,7 +22,7 @@ namespace CalamityMod.Tiles.Furniture.CraftingStations public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 107, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.TerraBlade, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/Furniture/DevPaintings/ThankYouPaintingTile.cs b/Tiles/Furniture/DevPaintings/ThankYouPaintingTile.cs index 91e9ae72b5..16d09fae61 100644 --- a/Tiles/Furniture/DevPaintings/ThankYouPaintingTile.cs +++ b/Tiles/Furniture/DevPaintings/ThankYouPaintingTile.cs @@ -9,26 +9,27 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.Furniture.DevPaintings { - public class ThankYouPaintingTile : ModTile - { + public class ThankYouPaintingTile : ModTile + { public override void SetStaticDefaults() { - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - Main.tileWaterDeath[Type] = false; - TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3Wall); - TileObjectData.newTile.Width = 6; - TileObjectData.newTile.Height = 4; - TileObjectData.newTile.Origin = new Point16(2, 2); - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16, 16 }; - TileObjectData.newTile.LavaDeath = true; - TileObjectData.addTile(Type); + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + Main.tileSpelunker[Type] = true; + Main.tileWaterDeath[Type] = false; + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3Wall); + TileObjectData.newTile.Width = 6; + TileObjectData.newTile.Height = 4; + TileObjectData.newTile.Origin = new Point16(2, 2); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16, 16 }; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.addTile(Type); TileID.Sets.DisableSmartCursor[Type] = true; TileID.Sets.FramesOnKillWall[Type] = true; TileID.Sets.DisableSmartCursor[Type] = true; - DustType = 7; - AddMapEntry(new Color(99, 50, 30), Language.GetText("MapObject.Painting")); - } - } + DustType = 7; + AddMapEntry(new Color(99, 50, 30), Language.GetText("MapObject.Painting")); + } + } } diff --git a/Tiles/Furniture/Fountains/AbyssFountainTile.cs b/Tiles/Furniture/Fountains/AbyssFountainTile.cs index 9c3464b1fd..02fde7f55c 100644 --- a/Tiles/Furniture/Fountains/AbyssFountainTile.cs +++ b/Tiles/Furniture/Fountains/AbyssFountainTile.cs @@ -22,8 +22,8 @@ namespace CalamityMod.Tiles.Furniture.Fountains 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(119, 102, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 33, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(119, 102, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Water, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/Furniture/Fountains/BrimstoneLavaFountainTile.cs b/Tiles/Furniture/Fountains/BrimstoneLavaFountainTile.cs new file mode 100644 index 0000000000..6222f06535 --- /dev/null +++ b/Tiles/Furniture/Fountains/BrimstoneLavaFountainTile.cs @@ -0,0 +1,69 @@ +using CalamityMod.Items.Placeables.Furniture.Fountains; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.Furniture.Fountains +{ + public class BrimstoneLavaFountainTile : ModTile + { + public override void SetStaticDefaults() => this.SetUpFountain(ModContent.ItemType(), new Color(251, 136, 130), true); + + public override void NearbyEffects(int i, int j, bool closer) + { + Player player = Main.LocalPlayer; + if (player is null || Main.dedServ) + return; + + if (Main.tile[i, j].TileFrameX >= 36) + player.Calamity().BrimstoneLavaFountainCounter = 5; + } + + public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(119, 102, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Lava, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void AnimateTile(ref int frame, ref int frameCounter) + { + frameCounter++; + if (frameCounter >= 6) + { + frame = (frame + 1) % 6; + frameCounter = 0; + } + } + + public override void HitWire(int i, int j) + { + CalamityUtils.LightHitWire(Type, i, j, 2, 4); + } + + public override bool RightClick(int i, int j) + { + CalamityUtils.LightHitWire(Type, i, j, 2, 4); + SoundEngine.PlaySound(SoundID.Mech, 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(); + } + } +} diff --git a/Tiles/Furniture/Fountains/BrimstoneLavaFountainTile.png b/Tiles/Furniture/Fountains/BrimstoneLavaFountainTile.png new file mode 100644 index 0000000000..666b7cd742 Binary files /dev/null and b/Tiles/Furniture/Fountains/BrimstoneLavaFountainTile.png differ diff --git a/Tiles/Furniture/Fountains/BrimstoneLavaFountainTile_Highlight.png b/Tiles/Furniture/Fountains/BrimstoneLavaFountainTile_Highlight.png new file mode 100644 index 0000000000..32314cd9c7 Binary files /dev/null and b/Tiles/Furniture/Fountains/BrimstoneLavaFountainTile_Highlight.png differ diff --git a/Tiles/Furniture/Fountains/SulphurousFountainTile.cs b/Tiles/Furniture/Fountains/SulphurousFountainTile.cs index 35f96bd6c4..5c79c78750 100644 --- a/Tiles/Furniture/Fountains/SulphurousFountainTile.cs +++ b/Tiles/Furniture/Fountains/SulphurousFountainTile.cs @@ -23,8 +23,8 @@ namespace CalamityMod.Tiles.Furniture.Fountains 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(119, 102, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 33, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(119, 102, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Water, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/Furniture/Fountains/SunkenSeaFountainTile.cs b/Tiles/Furniture/Fountains/SunkenSeaFountainTile.cs index 01867f0992..9aaf10a2d5 100644 --- a/Tiles/Furniture/Fountains/SunkenSeaFountainTile.cs +++ b/Tiles/Furniture/Fountains/SunkenSeaFountainTile.cs @@ -22,8 +22,8 @@ namespace CalamityMod.Tiles.Furniture.Fountains 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(119, 102, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 33, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(119, 102, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Water, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/Furniture/Monoliths/AstralProjectorTile.cs b/Tiles/Furniture/Monoliths/AstralProjectorTile.cs new file mode 100644 index 0000000000..d44aa7b562 --- /dev/null +++ b/Tiles/Furniture/Monoliths/AstralProjectorTile.cs @@ -0,0 +1,147 @@ +using CalamityMod.Dusts; +using CalamityMod.Items.Placeables.Furniture.Monoliths; +using CalamityMod.NPCs.Yharon; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.GameContent; +using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Furniture.Monoliths +{ + public class AstralProjectorTile : ModTile + { + public static Asset Glow; + public override void SetStaticDefaults() + { + if (!Main.dedServ) + { + Glow = ModContent.Request("CalamityMod/Tiles/Furniture/Monoliths/AstralProjectorTile_Glow", AssetRequestMode.AsyncLoad); + } + RegisterItemDrop(ModContent.ItemType()); + Main.tileFrameImportant[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2xX); + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(0, 2); + TileObjectData.newTile.CoordinateHeights = new[] { 16, 16, 18 }; + TileObjectData.newTile.LavaDeath = false; + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop, 2, 0); + TileObjectData.addTile(Type); + + AddMapEntry(new Color(16, 50, 64)); + + DustType = ModContent.DustType(); + AnimationFrameHeight = 56; + } + + public override void NearbyEffects(int i, int j, bool closer) + { + if (Main.tile[i, j].TileFrameY < 56) + { + return; + } + + Player player = Main.LocalPlayer; + if (player is null) + { + return; + } + + if (player.active) + { + Main.LocalPlayer.Calamity().monolithAstralShader = 30; + } + } + + public override void AnimateTile(ref int frame, ref int frameCounter) + { + frameCounter++; + if (frameCounter >= 7.2) + { + frameCounter = 0; + if (++frame >= 9) + { + frame = 0; + } + } + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.cursorItemIconEnabled = true; + player.cursorItemIconID = ModContent.ItemType(); + } + + public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; + + public override bool RightClick(int i, int j) + { + HitWire(i, j); + SoundEngine.PlaySound(SoundID.Mech, new Vector2(i * 16, j * 16)); + return true; + } + + public override void HitWire(int i, int j) + { + int x = i - Main.tile[i, j].TileFrameX / 18 % 2; + int y = j - Main.tile[i, j].TileFrameY / 18 % 3; + int tileXX18 = 56; + for (int l = x; l < x + 2; l++) + { + for (int m = y; m < y + 3; m++) + { + if (Main.tile[l, m].HasTile && Main.tile[l, m].TileType == Type) + { + if (Main.tile[l, m].TileFrameY < tileXX18) + Main.tile[l, m].TileFrameY += (short)(tileXX18); + else + Main.tile[l, m].TileFrameY -= (short)(tileXX18); + } + } + } + if (Wiring.running) + { + for (int o = 0; o < 2; o++) + { + for (int p = 0; p < 3; p++) + { + Wiring.SkipWire(x + 0, x + p); + } + } + } + NetMessage.SendTileSquare(-1, x, y + 1, 3); + } + + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) + { + Tile tile = Main.tile[i, j]; + Texture2D texture; + texture = TextureAssets.Tile[Type].Value; + Vector2 zero = new(Main.offScreenRange, Main.offScreenRange); + if (Main.drawToScreen) + { + zero = Vector2.Zero; + } + int height = 18; + int animate = 0; + if (tile.TileFrameY >= 56) + { + animate = Main.tileFrame[Type] * 56; + } + Main.spriteBatch.Draw(texture, new Vector2(i * 16 - (int)Main.screenPosition.X, j * 16 - (int)Main.screenPosition.Y) + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY + animate, 16, height), Lighting.GetColor(i, j), 0f, default(Vector2), 1f, SpriteEffects.None, 0f); + if (Glow != null) + Main.spriteBatch.Draw(Glow.Value, new Vector2(i * 16 - (int)Main.screenPosition.X, j * 16 - (int)Main.screenPosition.Y) + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY + animate, 16, height), Color.White, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); + return false; + } + } +} diff --git a/Tiles/Furniture/Monoliths/AstralProjectorTile.png b/Tiles/Furniture/Monoliths/AstralProjectorTile.png new file mode 100644 index 0000000000..4c5220bc9e Binary files /dev/null and b/Tiles/Furniture/Monoliths/AstralProjectorTile.png differ diff --git a/Tiles/Furniture/Monoliths/AstralProjectorTile_Glow.png b/Tiles/Furniture/Monoliths/AstralProjectorTile_Glow.png new file mode 100644 index 0000000000..afb5b23e67 Binary files /dev/null and b/Tiles/Furniture/Monoliths/AstralProjectorTile_Glow.png differ diff --git a/Tiles/Furniture/Monoliths/BlueDistortedMonolithTile.cs b/Tiles/Furniture/Monoliths/BlueDistortedMonolithTile.cs new file mode 100644 index 0000000000..03fa351c0d --- /dev/null +++ b/Tiles/Furniture/Monoliths/BlueDistortedMonolithTile.cs @@ -0,0 +1,140 @@ +using CalamityMod.Dusts; +using CalamityMod.Items.Placeables.Furniture.Monoliths; +using CalamityMod.NPCs.Yharon; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.GameContent; +using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Furniture.Monoliths +{ + public class BlueDistortedMonolithTile : ModTile + { + public override void SetStaticDefaults() + { + RegisterItemDrop(ModContent.ItemType()); + Main.tileFrameImportant[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3); + TileObjectData.newTile.Width = 5; + TileObjectData.newTile.Height = 5; + TileObjectData.newTile.Origin = new Point16(2, 4); + TileObjectData.newTile.CoordinateHeights = new[] { 16, 16, 16, 16, 18 }; + TileObjectData.newTile.LavaDeath = false; + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop, 5, 0); + TileObjectData.addTile(Type); + + AddMapEntry(new Color(50, 127, 209)); + + DustType = (int)CalamityDusts.BlueCosmilite; + AnimationFrameHeight = 92; + } + + public override void NearbyEffects(int i, int j, bool closer) + { + if (Main.tile[i, j].TileFrameY < 90) + { + return; + } + + Player player = Main.LocalPlayer; + if (player is null) + { + return; + } + + if (player.active) + { + Main.LocalPlayer.Calamity().monolithDevourerBShader = 30; + } + } + + public override void AnimateTile(ref int frame, ref int frameCounter) + { + frameCounter++; + if (frameCounter >= 7.2) + { + frameCounter = 0; + if (++frame >= 6) + { + frame = 1; + } + } + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.cursorItemIconEnabled = true; + player.cursorItemIconID = ModContent.ItemType(); + } + + public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; + + public override bool RightClick(int i, int j) + { + HitWire(i, j); + SoundEngine.PlaySound(SoundID.Mech, new Vector2(i * 16, j * 16)); + return true; + } + + public override void HitWire(int i, int j) + { + int x = i - Main.tile[i, j].TileFrameX / 18 % 5; + int y = j - Main.tile[i, j].TileFrameY / 18 % 5; + int tileXX18 = 92; + for (int l = x; l < x + 5; l++) + { + for (int m = y; m < y + 5; m++) + { + if (Main.tile[l, m].HasTile && Main.tile[l, m].TileType == Type) + { + if (Main.tile[l, m].TileFrameY < tileXX18) + Main.tile[l, m].TileFrameY += (short)(tileXX18); + else + Main.tile[l, m].TileFrameY -= (short)(tileXX18); + } + } + } + if (Wiring.running) + { + for (int o = 0; o < 5; o++) + { + for (int p = 0; p < 5; p++) + { + Wiring.SkipWire(x + 0, x + p); + } + } + } + NetMessage.SendTileSquare(-1, x, y + 1, 3); + } + + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) + { + Tile tile = Main.tile[i, j]; + Texture2D texture; + texture = TextureAssets.Tile[Type].Value; + Vector2 zero = new(Main.offScreenRange, Main.offScreenRange); + if (Main.drawToScreen) + { + zero = Vector2.Zero; + } + int height = 18; + int animate = 0; + if (tile.TileFrameY >= 92) + { + animate = Main.tileFrame[Type] * 92; + } + Main.spriteBatch.Draw(texture, new Vector2(i * 16 - (int)Main.screenPosition.X, j * 16 - (int)Main.screenPosition.Y) + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY + animate, 16, height), Lighting.GetColor(i, j), 0f, default(Vector2), 1f, SpriteEffects.None, 0f); + return false; + } + } +} diff --git a/Tiles/Furniture/Monoliths/BlueDistortedMonolithTile.png b/Tiles/Furniture/Monoliths/BlueDistortedMonolithTile.png new file mode 100644 index 0000000000..6d3612ff2e Binary files /dev/null and b/Tiles/Furniture/Monoliths/BlueDistortedMonolithTile.png differ diff --git a/Tiles/Furniture/Monoliths/BossRushMonolithTile.cs b/Tiles/Furniture/Monoliths/BossRushMonolithTile.cs new file mode 100644 index 0000000000..9abede9eaa --- /dev/null +++ b/Tiles/Furniture/Monoliths/BossRushMonolithTile.cs @@ -0,0 +1,147 @@ +using CalamityMod.Dusts; +using CalamityMod.Items.Placeables.Furniture.Monoliths; +using CalamityMod.NPCs.Yharon; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.GameContent; +using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Furniture.Monoliths +{ + public class BossRushMonolithTile : ModTile + { + public static Asset Glow; + public override void SetStaticDefaults() + { + if (!Main.dedServ) + { + Glow = ModContent.Request("CalamityMod/Tiles/Furniture/Monoliths/BossRushMonolithTile_Glow", AssetRequestMode.AsyncLoad); + } + RegisterItemDrop(ModContent.ItemType()); + Main.tileFrameImportant[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x4); + TileObjectData.newTile.Width = 4; + TileObjectData.newTile.Origin = new Point16(2, 3); + TileObjectData.newTile.CoordinateHeights = new[] { 16, 16, 16, 18 }; + TileObjectData.newTile.LavaDeath = false; + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop, 4, 0); + TileObjectData.addTile(Type); + + AddMapEntry(new Color(64, 8, 12)); + + DustType = (int)CalamityDusts.Brimstone; + AnimationFrameHeight = 72; + } + + public override void NearbyEffects(int i, int j, bool closer) + { + if (Main.tile[i, j].TileFrameY < 72) + { + return; + } + + Player player = Main.LocalPlayer; + if (player is null) + { + return; + } + + if (player.active) + { + Main.LocalPlayer.Calamity().monolithBossRushShader = 30; + } + } + + public override void AnimateTile(ref int frame, ref int frameCounter) + { + frameCounter++; + if (frameCounter >= 7.2) + { + frameCounter = 0; + if (++frame >= 3) + { + frame = 0; + } + } + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.cursorItemIconEnabled = true; + player.cursorItemIconID = ModContent.ItemType(); + } + + public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; + + public override bool RightClick(int i, int j) + { + HitWire(i, j); + SoundEngine.PlaySound(SoundID.Mech, new Vector2(i * 16, j * 16)); + return true; + } + + public override void HitWire(int i, int j) + { + int x = i - Main.tile[i, j].TileFrameX / 18 % 4; + int y = j - Main.tile[i, j].TileFrameY / 18 % 4; + int tileXX18 = 18 * 4; + for (int l = x; l < x + 4; l++) + { + for (int m = y; m < y + 4; m++) + { + if (Main.tile[l, m].HasTile && Main.tile[l, m].TileType == Type) + { + if (Main.tile[l, m].TileFrameY < tileXX18) + Main.tile[l, m].TileFrameY += (short)(tileXX18); + else + Main.tile[l, m].TileFrameY -= (short)(tileXX18); + } + } + } + if (Wiring.running) + { + for (int o = 0; o < 4; o++) + { + for (int p = 0; p < 4; p++) + { + Wiring.SkipWire(x + 0, x + p); + } + } + } + NetMessage.SendTileSquare(-1, x, y + 1, 3); + } + + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) + { + Tile tile = Main.tile[i, j]; + Texture2D texture; + texture = TextureAssets.Tile[Type].Value; + Vector2 zero = new(Main.offScreenRange, Main.offScreenRange); + if (Main.drawToScreen) + { + zero = Vector2.Zero; + } + int height = 18; + int animate = 0; + if (tile.TileFrameY >= 72) + { + animate = Main.tileFrame[Type] * AnimationFrameHeight; + } + Main.spriteBatch.Draw(texture, new Vector2(i * 16 - (int)Main.screenPosition.X, j * 16 - (int)Main.screenPosition.Y) + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY + animate, 16, height), Lighting.GetColor(i, j), 0f, default(Vector2), 1f, SpriteEffects.None, 0f); + if (Glow != null) + Main.spriteBatch.Draw(Glow.Value, new Vector2(i * 16 - (int)Main.screenPosition.X, j * 16 - (int)Main.screenPosition.Y) + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY + animate, 16, height), Color.White, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); + return false; + } + } +} diff --git a/Tiles/Furniture/Monoliths/BossRushMonolithTile.png b/Tiles/Furniture/Monoliths/BossRushMonolithTile.png new file mode 100644 index 0000000000..f546e6ec43 Binary files /dev/null and b/Tiles/Furniture/Monoliths/BossRushMonolithTile.png differ diff --git a/Tiles/Furniture/Monoliths/BossRushMonolithTile_Glow.png b/Tiles/Furniture/Monoliths/BossRushMonolithTile_Glow.png new file mode 100644 index 0000000000..6dfbb80d91 Binary files /dev/null and b/Tiles/Furniture/Monoliths/BossRushMonolithTile_Glow.png differ diff --git a/Tiles/Furniture/Monoliths/DeepSeaAnchorTile.cs b/Tiles/Furniture/Monoliths/DeepSeaAnchorTile.cs new file mode 100644 index 0000000000..8d9350c6e9 --- /dev/null +++ b/Tiles/Furniture/Monoliths/DeepSeaAnchorTile.cs @@ -0,0 +1,138 @@ +using CalamityMod.Dusts; +using CalamityMod.Items.Placeables.Furniture.Monoliths; +using CalamityMod.NPCs.Yharon; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.GameContent; +using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Furniture.Monoliths +{ + public class DeepSeaAnchorTile : ModTile + { + public override void SetStaticDefaults() + { + RegisterItemDrop(ModContent.ItemType()); + Main.tileFrameImportant[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x4); + TileObjectData.newTile.Origin = new Point16(0, 3); + TileObjectData.newTile.CoordinateHeights = new[] { 16, 16, 16, 18 }; + TileObjectData.newTile.LavaDeath = false; + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop, 3, 0); + TileObjectData.addTile(Type); + + AddMapEntry(new Color(92, 24, 31)); + + DustType = DustID.Water; + AnimationFrameHeight = 72; + } + + public override void NearbyEffects(int i, int j, bool closer) + { + if (Main.tile[i, j].TileFrameY < 72) + { + return; + } + + Player player = Main.LocalPlayer; + if (player is null) + { + return; + } + + if (player.active) + { + Main.LocalPlayer.Calamity().monolithLeviathanShader = 30; + } + } + + public override void AnimateTile(ref int frame, ref int frameCounter) + { + frameCounter++; + if (frameCounter >= 7.2) + { + frameCounter = 0; + if (++frame >= 6) + { + frame = 0; + } + } + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.cursorItemIconEnabled = true; + player.cursorItemIconID = ModContent.ItemType(); + } + + public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; + + public override bool RightClick(int i, int j) + { + HitWire(i, j); + SoundEngine.PlaySound(SoundID.Mech, new Vector2(i * 16, j * 16)); + return true; + } + + public override void HitWire(int i, int j) + { + int x = i - Main.tile[i, j].TileFrameX / 18 % 3; + int y = j - Main.tile[i, j].TileFrameY / 18 % 4; + int tileXX18 = 18 * 4; + for (int l = x; l < x + 3; l++) + { + for (int m = y; m < y + 4; m++) + { + if (Main.tile[l, m].HasTile && Main.tile[l, m].TileType == Type) + { + if (Main.tile[l, m].TileFrameY < tileXX18) + Main.tile[l, m].TileFrameY += (short)(tileXX18); + else + Main.tile[l, m].TileFrameY -= (short)(tileXX18); + } + } + } + if (Wiring.running) + { + for (int o = 0; o < 3; o++) + { + for (int p = 0; p < 4; p++) + { + Wiring.SkipWire(x + 0, x + p); + } + } + } + NetMessage.SendTileSquare(-1, x, y + 1, 3); + } + + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) + { + Tile tile = Main.tile[i, j]; + Texture2D texture; + texture = TextureAssets.Tile[Type].Value; + Vector2 zero = new(Main.offScreenRange, Main.offScreenRange); + if (Main.drawToScreen) + { + zero = Vector2.Zero; + } + int height = 18; + int animate = 0; + if (tile.TileFrameY >= 72) + { + animate = Main.tileFrame[Type] * AnimationFrameHeight; + } + Main.spriteBatch.Draw(texture, new Vector2(i * 16 - (int)Main.screenPosition.X, j * 16 - (int)Main.screenPosition.Y) + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY + animate, 16, height), Lighting.GetColor(i, j), 0f, default(Vector2), 1f, SpriteEffects.None, 0f); + return false; + } + } +} diff --git a/Tiles/Furniture/Monoliths/DeepSeaAnchorTile.png b/Tiles/Furniture/Monoliths/DeepSeaAnchorTile.png new file mode 100644 index 0000000000..f11b3e66e5 Binary files /dev/null and b/Tiles/Furniture/Monoliths/DeepSeaAnchorTile.png differ diff --git a/Tiles/Furniture/Monoliths/DraconicIncenseTile.cs b/Tiles/Furniture/Monoliths/DraconicIncenseTile.cs new file mode 100644 index 0000000000..d598a4f1bf --- /dev/null +++ b/Tiles/Furniture/Monoliths/DraconicIncenseTile.cs @@ -0,0 +1,145 @@ +using CalamityMod.Items.Placeables.Furniture.Monoliths; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.GameContent; +using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Furniture.Monoliths +{ + public class DraconicIncenseTile : ModTile + { + public static Asset Glow; + public override void SetStaticDefaults() + { + if (!Main.dedServ) + { + Glow = ModContent.Request("CalamityMod/Tiles/Furniture/Monoliths/DraconicIncenseTile_Glow", AssetRequestMode.AsyncLoad); + } + RegisterItemDrop(ModContent.ItemType()); + Main.tileFrameImportant[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2xX); + TileObjectData.newTile.Height = 6; + TileObjectData.newTile.Origin = new Point16(0, 5); + TileObjectData.newTile.CoordinateHeights = new[] { 16, 16, 16, 16, 16, 18 }; + TileObjectData.newTile.LavaDeath = false; + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop, 2, 0); + TileObjectData.addTile(Type); + + AddMapEntry(new Color(143, 106, 41)); + + DustType = DustID.Flare; + AnimationFrameHeight = 110; + } + + public override void NearbyEffects(int i, int j, bool closer) + { + if (Main.tile[i, j].TileFrameY < 110) + { + return; + } + + Player player = Main.LocalPlayer; + if (player is null) + { + return; + } + + if (player.active) + { + Main.LocalPlayer.Calamity().monolithYharonShader = 30; + } + } + + public override void AnimateTile(ref int frame, ref int frameCounter) + { + frameCounter++; + if (frameCounter >= 7.2) + { + frameCounter = 0; + if (++frame >= 6) + { + frame = 0; + } + } + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.cursorItemIconEnabled = true; + player.cursorItemIconID = ModContent.ItemType(); + } + + public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; + + public override bool RightClick(int i, int j) + { + HitWire(i, j); + SoundEngine.PlaySound(SoundID.Mech, new Vector2(i * 16, j * 16)); + return true; + } + + public override void HitWire(int i, int j) + { + int x = i - Main.tile[i, j].TileFrameX / 18 % 2; + int y = j - Main.tile[i, j].TileFrameY / 18 % 6; + int tileXX18 = 110; + for (int l = x; l < x + 2; l++) + { + for (int m = y; m < y + 6; m++) + { + if (Main.tile[l, m].HasTile && Main.tile[l, m].TileType == Type) + { + if (Main.tile[l, m].TileFrameY < tileXX18) + Main.tile[l, m].TileFrameY += (short)(tileXX18); + else + Main.tile[l, m].TileFrameY -= (short)(tileXX18); + } + } + } + if (Wiring.running) + { + for (int o = 0; o < 2; o++) + { + for (int p = 0; p < 6; p++) + { + Wiring.SkipWire(x + 0, x + p); + } + } + } + NetMessage.SendTileSquare(-1, x, y + 1, 3); + } + + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) + { + Tile tile = Main.tile[i, j]; + Texture2D texture; + texture = TextureAssets.Tile[Type].Value; + Vector2 zero = new(Main.offScreenRange, Main.offScreenRange); + if (Main.drawToScreen) + { + zero = Vector2.Zero; + } + int height = 18; + int animate = 0; + if (tile.TileFrameY >= 110) + { + animate = Main.tileFrame[Type] * AnimationFrameHeight; + } + Main.spriteBatch.Draw(texture, new Vector2(i * 16 - (int)Main.screenPosition.X, j * 16 - (int)Main.screenPosition.Y) + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY + animate, 16, height), Lighting.GetColor(i, j), 0f, default(Vector2), 1f, SpriteEffects.None, 0f); + if (Glow != null) + Main.spriteBatch.Draw(Glow.Value, new Vector2(i * 16 - (int)Main.screenPosition.X, j * 16 - (int)Main.screenPosition.Y) + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY + animate, 16, height), Color.White, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); + return false; + } + } +} diff --git a/Tiles/Furniture/Monoliths/DraconicIncenseTile.png b/Tiles/Furniture/Monoliths/DraconicIncenseTile.png new file mode 100644 index 0000000000..f41d683c71 Binary files /dev/null and b/Tiles/Furniture/Monoliths/DraconicIncenseTile.png differ diff --git a/Tiles/Furniture/Monoliths/DraconicIncenseTile_Glow.png b/Tiles/Furniture/Monoliths/DraconicIncenseTile_Glow.png new file mode 100644 index 0000000000..08635f8d22 Binary files /dev/null and b/Tiles/Furniture/Monoliths/DraconicIncenseTile_Glow.png differ diff --git a/Tiles/Furniture/Monoliths/DraconicIncenseTile_Highlight.png b/Tiles/Furniture/Monoliths/DraconicIncenseTile_Highlight.png new file mode 100644 index 0000000000..0c4fd4884c Binary files /dev/null and b/Tiles/Furniture/Monoliths/DraconicIncenseTile_Highlight.png differ diff --git a/Tiles/Furniture/Monoliths/ExoObeliskText.png b/Tiles/Furniture/Monoliths/ExoObeliskText.png new file mode 100644 index 0000000000..374ee1df36 Binary files /dev/null and b/Tiles/Furniture/Monoliths/ExoObeliskText.png differ diff --git a/Tiles/Furniture/Monoliths/ExoObeliskTile.cs b/Tiles/Furniture/Monoliths/ExoObeliskTile.cs new file mode 100644 index 0000000000..9712a5da57 --- /dev/null +++ b/Tiles/Furniture/Monoliths/ExoObeliskTile.cs @@ -0,0 +1,161 @@ +using CalamityMod.Dusts; +using CalamityMod.Items.Dyes; +using CalamityMod.Items.Placeables.Furniture.Monoliths; +using CalamityMod.NPCs.Yharon; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.GameContent; +using Terraria.GameContent.ObjectInteractions; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Furniture.Monoliths +{ + public class ExoObeliskTile : ModTile + { + public static Asset Glow; + public static Asset Numbers; + public override void SetStaticDefaults() + { + if (!Main.dedServ) + { + Glow = ModContent.Request("CalamityMod/Tiles/Furniture/Monoliths/ExoObeliskTile_Glow", AssetRequestMode.AsyncLoad); + Numbers = ModContent.Request("CalamityMod/Tiles/Furniture/Monoliths/ExoObeliskText", AssetRequestMode.AsyncLoad); + } + RegisterItemDrop(ModContent.ItemType()); + Main.tileFrameImportant[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x4); + TileObjectData.newTile.Height = 5; + TileObjectData.newTile.Origin = new Point16(1, 4); + TileObjectData.newTile.CoordinateHeights = new[] { 16, 16, 16, 16, 18 }; + TileObjectData.newTile.LavaDeath = false; + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop, 3, 0); + TileObjectData.addTile(Type); + + AddMapEntry(new Color(54, 54, 54)); + + DustType = DustID.TerraBlade; + AnimationFrameHeight = 90; + } + + public override void NearbyEffects(int i, int j, bool closer) + { + if (Main.tile[i, j].TileFrameY < 90) + { + return; + } + + Player player = Main.LocalPlayer; + if (player is null) + { + return; + } + + if (player.active) + { + Main.LocalPlayer.Calamity().monolithExoShader = 30; + } + } + + public override void AnimateTile(ref int frame, ref int frameCounter) + { + frameCounter++; + if (frameCounter >= 6) + { + frameCounter = 0; + if (++frame >= 13) + { + frame = 0; + } + } + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.cursorItemIconEnabled = true; + player.cursorItemIconID = ModContent.ItemType(); + } + + public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; + + public override bool RightClick(int i, int j) + { + HitWire(i, j); + SoundEngine.PlaySound(SoundID.Mech, new Vector2(i * 16, j * 16)); + return true; + } + + public override void HitWire(int i, int j) + { + int x = i - Main.tile[i, j].TileFrameX / 18 % 3; + int y = j - Main.tile[i, j].TileFrameY / 18 % 5; + int tileXX18 = 92; + for (int l = x; l < x + 3; l++) + { + for (int m = y; m < y + 5; m++) + { + if (Main.tile[l, m].HasTile && Main.tile[l, m].TileType == Type) + { + if (Main.tile[l, m].TileFrameY < tileXX18) + Main.tile[l, m].TileFrameY += (short)(tileXX18); + else + Main.tile[l, m].TileFrameY -= (short)(tileXX18); + } + } + } + if (Wiring.running) + { + for (int o = 0; o < 3; o++) + { + for (int p = 0; p < 5; p++) + { + Wiring.SkipWire(x + 0, x + p); + } + } + } + NetMessage.SendTileSquare(-1, x, y + 1, 3); + } + + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) + { + Tile tile = Main.tile[i, j]; + Texture2D texture; + texture = TextureAssets.Tile[Type].Value; + Vector2 zero = new(Main.offScreenRange, Main.offScreenRange); + if (Main.drawToScreen) + { + zero = Vector2.Zero; + } + int height = 18; + int animate = 0; + if (tile.TileFrameY >= 92) + { + animate = Main.tileFrame[Type] * 92; + } + Main.spriteBatch.Draw(texture, new Vector2(i * 16 - (int)Main.screenPosition.X, j * 16 - (int)Main.screenPosition.Y) + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY + animate, 16, height), Lighting.GetColor(i, j), 0f, default(Vector2), 1f, SpriteEffects.None, 0f); + if (Glow != null) + Main.spriteBatch.Draw(Glow.Value, new Vector2(i * 16 - (int)Main.screenPosition.X, j * 16 - (int)Main.screenPosition.Y) + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY + animate, 16, height), Color.White, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); ; + if (Numbers != null) + { + int colorIndex = (int)(Main.GlobalTimeWrappedHourly / 0.5 % CalamityUtils.ExoPalette.Length); + Color currentColor = CalamityUtils.ExoPalette[colorIndex]; + Color nextColor = CalamityUtils.ExoPalette[(colorIndex + 1) % CalamityUtils.ExoPalette.Length]; + Color exoColors = Color.Lerp(currentColor, nextColor, Main.GlobalTimeWrappedHourly % 0.5f > 1f ? 1f : Main.GlobalTimeWrappedHourly % 1f); + + Main.spriteBatch.Draw(Numbers.Value, new Vector2(i * 16 - (int)Main.screenPosition.X, j * 16 - (int)Main.screenPosition.Y) + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY + animate, 16, height), exoColors, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); + } + + return false; + } + } +} diff --git a/Tiles/Furniture/Monoliths/ExoObeliskTile.png b/Tiles/Furniture/Monoliths/ExoObeliskTile.png new file mode 100644 index 0000000000..53aa22ae4b Binary files /dev/null and b/Tiles/Furniture/Monoliths/ExoObeliskTile.png differ diff --git a/Tiles/Furniture/Monoliths/ExoObeliskTile_Glow.png b/Tiles/Furniture/Monoliths/ExoObeliskTile_Glow.png new file mode 100644 index 0000000000..35b578e203 Binary files /dev/null and b/Tiles/Furniture/Monoliths/ExoObeliskTile_Glow.png differ diff --git a/Tiles/Furniture/Monoliths/FrigidMonolithTile.cs b/Tiles/Furniture/Monoliths/FrigidMonolithTile.cs new file mode 100644 index 0000000000..df8c715d53 --- /dev/null +++ b/Tiles/Furniture/Monoliths/FrigidMonolithTile.cs @@ -0,0 +1,138 @@ +using CalamityMod.Dusts; +using CalamityMod.Items.Placeables.Furniture.Monoliths; +using CalamityMod.NPCs.Yharon; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.GameContent; +using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Furniture.Monoliths +{ + public class FrigidMonolithTile : ModTile + { + public override void SetStaticDefaults() + { + RegisterItemDrop(ModContent.ItemType()); + Main.tileFrameImportant[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x4); + TileObjectData.newTile.Origin = new Point16(0, 2); + TileObjectData.newTile.CoordinateHeights = new[] { 16, 16, 16, 18 }; + TileObjectData.newTile.LavaDeath = false; + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop, 3, 0); + TileObjectData.addTile(Type); + + AddMapEntry(new Color(55, 212, 230)); + + DustType = DustID.Ice; + AnimationFrameHeight = 74; + } + + public override void NearbyEffects(int i, int j, bool closer) + { + if (Main.tile[i, j].TileFrameY < 74) + { + return; + } + + Player player = Main.LocalPlayer; + if (player is null) + { + return; + } + + if (player.active) + { + Main.LocalPlayer.Calamity().monolithCryogenShader = 30; + } + } + + public override void AnimateTile(ref int frame, ref int frameCounter) + { + frameCounter++; + if (frameCounter >= 7.2) + { + frameCounter = 0; + if (++frame >= 6) + { + frame = 0; + } + } + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.cursorItemIconEnabled = true; + player.cursorItemIconID = ModContent.ItemType(); + } + + public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; + + public override bool RightClick(int i, int j) + { + HitWire(i, j); + SoundEngine.PlaySound(SoundID.Mech, new Vector2(i * 16, j * 16)); + return true; + } + + public override void HitWire(int i, int j) + { + int x = i - Main.tile[i, j].TileFrameX / 18 % 3; + int y = j - Main.tile[i, j].TileFrameY / 18 % 4; + int tileXX18 = 74; + for (int l = x; l < x + 3; l++) + { + for (int m = y; m < y + 4; m++) + { + if (Main.tile[l, m].HasTile && Main.tile[l, m].TileType == Type) + { + if (Main.tile[l, m].TileFrameY < tileXX18) + Main.tile[l, m].TileFrameY += (short)(tileXX18); + else + Main.tile[l, m].TileFrameY -= (short)(tileXX18); + } + } + } + if (Wiring.running) + { + for (int o = 0; o < 3; o++) + { + for (int p = 0; p < 4; p++) + { + Wiring.SkipWire(x + 0, x + p); + } + } + } + NetMessage.SendTileSquare(-1, x, y + 1, 3); + } + + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) + { + Tile tile = Main.tile[i, j]; + Texture2D texture; + texture = TextureAssets.Tile[Type].Value; + Vector2 zero = new(Main.offScreenRange, Main.offScreenRange); + if (Main.drawToScreen) + { + zero = Vector2.Zero; + } + int height = 18; + int animate = 0; + if (tile.TileFrameY >= 74) + { + animate = Main.tileFrame[Type] * AnimationFrameHeight; + } + Main.spriteBatch.Draw(texture, new Vector2(i * 16 - (int)Main.screenPosition.X, j * 16 - (int)Main.screenPosition.Y) + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY + animate, 16, height), Lighting.GetColor(i, j), 0f, default(Vector2), 1f, SpriteEffects.None, 0f); + return false; + } + } +} diff --git a/Tiles/Furniture/Monoliths/FrigidMonolithTile.png b/Tiles/Furniture/Monoliths/FrigidMonolithTile.png new file mode 100644 index 0000000000..c77d1a431f Binary files /dev/null and b/Tiles/Furniture/Monoliths/FrigidMonolithTile.png differ diff --git a/Tiles/Furniture/Monoliths/PlagueHumidifierTile.cs b/Tiles/Furniture/Monoliths/PlagueHumidifierTile.cs new file mode 100644 index 0000000000..66e5f708a2 --- /dev/null +++ b/Tiles/Furniture/Monoliths/PlagueHumidifierTile.cs @@ -0,0 +1,149 @@ +using CalamityMod.Dusts; +using CalamityMod.Items.Placeables.Furniture.Monoliths; +using CalamityMod.NPCs.Yharon; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.GameContent; +using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Furniture.Monoliths +{ + public class PlagueHumidifierTile : ModTile + { + public override void SetStaticDefaults() + { + RegisterItemDrop(ModContent.ItemType()); + Main.tileFrameImportant[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2xX); + TileObjectData.newTile.Height = 4; + TileObjectData.newTile.Origin = new Point16(1, 3); + TileObjectData.newTile.CoordinateHeights = new[] { 16, 16, 16, 16 }; + TileObjectData.newTile.LavaDeath = false; + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop, 2, 0); + TileObjectData.addTile(Type); + + AddMapEntry(new Color(44, 150, 54)); + + DustType = (int)CalamityDusts.Plague; + AnimationFrameHeight = 74; + } + + public override void NearbyEffects(int i, int j, bool closer) + { + if (Main.tile[i, j].TileFrameY < 74) + { + return; + } + + Player player = Main.LocalPlayer; + if (player is null) + { + return; + } + + if (player.active) + { + Main.LocalPlayer.Calamity().monolithPlagueShader = 30; + } + + // Spawn mist particles at the bottom tiles + if (Main.tile[i,j +1].TileType != Type) + { + if (Main.rand.NextBool(30)) + { + GeneralParticleHandler.SpawnParticle(new PlagueHumidifierMist(new Vector2(i * 16, j * 16) + new Vector2(Main.rand.NextFloat(0, 16), Main.rand.NextFloat(16)), Main.rand.Next(40, 80), Main.rand.NextFloat(0.8f, 1.2f), Vector2.UnitX * Main.rand.NextFloat(-0.8f, 0.8f))); + } + } + } + + public override void AnimateTile(ref int frame, ref int frameCounter) + { + frameCounter++; + if (frameCounter >= 7.2) + { + frameCounter = 0; + if (++frame >= 4) + { + frame = 0; + } + } + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.cursorItemIconEnabled = true; + player.cursorItemIconID = ModContent.ItemType(); + } + + public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; + + public override bool RightClick(int i, int j) + { + HitWire(i, j); + SoundEngine.PlaySound(SoundID.Mech, new Vector2(i * 16, j * 16)); + return true; + } + + public override void HitWire(int i, int j) + { + int x = i - Main.tile[i, j].TileFrameX / 18 % 2; + int y = j - Main.tile[i, j].TileFrameY / 18 % 4; + int tileXX18 = 74; + for (int l = x; l < x + 2; l++) + { + for (int m = y; m < y + 4; m++) + { + if (Main.tile[l, m].HasTile && Main.tile[l, m].TileType == Type) + { + if (Main.tile[l, m].TileFrameY < tileXX18) + Main.tile[l, m].TileFrameY += (short)(tileXX18); + else + Main.tile[l, m].TileFrameY -= (short)(tileXX18); + } + } + } + if (Wiring.running) + { + for (int o = 0; o < 2; o++) + { + for (int p = 0; p < 4; p++) + { + Wiring.SkipWire(x + 0, x + p); + } + } + } + NetMessage.SendTileSquare(-1, x, y + 1, 3); + } + + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) + { + Tile tile = Main.tile[i, j]; + Texture2D texture; + texture = TextureAssets.Tile[Type].Value; + Vector2 zero = new(Main.offScreenRange, Main.offScreenRange); + if (Main.drawToScreen) + { + zero = Vector2.Zero; + } + int height = 18; + int animate = 0; + if (tile.TileFrameY >= 74) + { + animate = Main.tileFrame[Type] * AnimationFrameHeight; + } + Main.spriteBatch.Draw(texture, new Vector2(i * 16 - (int)Main.screenPosition.X, j * 16 - (int)Main.screenPosition.Y) + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY + animate, 16, height), Lighting.GetColor(i, j), 0f, default(Vector2), 1f, SpriteEffects.None, 0f); + return false; + } + } +} diff --git a/Tiles/Furniture/Monoliths/PlagueHumidifierTile.png b/Tiles/Furniture/Monoliths/PlagueHumidifierTile.png new file mode 100644 index 0000000000..a7e32a3f2d Binary files /dev/null and b/Tiles/Furniture/Monoliths/PlagueHumidifierTile.png differ diff --git a/Tiles/Furniture/Monoliths/PurpleDistortedMonolithTile.cs b/Tiles/Furniture/Monoliths/PurpleDistortedMonolithTile.cs new file mode 100644 index 0000000000..dcc4f4557d --- /dev/null +++ b/Tiles/Furniture/Monoliths/PurpleDistortedMonolithTile.cs @@ -0,0 +1,140 @@ +using CalamityMod.Dusts; +using CalamityMod.Items.Placeables.Furniture.Monoliths; +using CalamityMod.NPCs.Yharon; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.GameContent; +using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Furniture.Monoliths +{ + public class PurpleDistortedMonolithTile : ModTile + { + public override void SetStaticDefaults() + { + RegisterItemDrop(ModContent.ItemType()); + Main.tileFrameImportant[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3); + TileObjectData.newTile.Width = 5; + TileObjectData.newTile.Height = 5; + TileObjectData.newTile.Origin = new Point16(2, 4); + TileObjectData.newTile.CoordinateHeights = new[] { 16, 16, 16, 16, 18 }; + TileObjectData.newTile.LavaDeath = false; + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop, 5, 0); + TileObjectData.addTile(Type); + + AddMapEntry(new Color(50, 127, 209)); + + DustType = (int)CalamityDusts.PurpleCosmilite; + AnimationFrameHeight = 92; + } + + public override void NearbyEffects(int i, int j, bool closer) + { + if (Main.tile[i, j].TileFrameY < 92) + { + return; + } + + Player player = Main.LocalPlayer; + if (player is null) + { + return; + } + + if (player.active) + { + Main.LocalPlayer.Calamity().monolithDevourerPShader = 30; + } + } + + public override void AnimateTile(ref int frame, ref int frameCounter) + { + frameCounter++; + if (frameCounter >= 7.2) + { + frameCounter = 0; + if (++frame >= 6) + { + frame = 1; + } + } + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.cursorItemIconEnabled = true; + player.cursorItemIconID = ModContent.ItemType(); + } + + public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; + + public override bool RightClick(int i, int j) + { + HitWire(i, j); + SoundEngine.PlaySound(SoundID.Mech, new Vector2(i * 16, j * 16)); + return true; + } + + public override void HitWire(int i, int j) + { + int x = i - Main.tile[i, j].TileFrameX / 18 % 5; + int y = j - Main.tile[i, j].TileFrameY / 18 % 5; + int tileXX18 = 92; + for (int l = x; l < x + 5; l++) + { + for (int m = y; m < y + 5; m++) + { + if (Main.tile[l, m].HasTile && Main.tile[l, m].TileType == Type) + { + if (Main.tile[l, m].TileFrameY < tileXX18) + Main.tile[l, m].TileFrameY += (short)(tileXX18); + else + Main.tile[l, m].TileFrameY -= (short)(tileXX18); + } + } + } + if (Wiring.running) + { + for (int o = 0; o < 5; o++) + { + for (int p = 0; p < 5; p++) + { + Wiring.SkipWire(x + 0, x + p); + } + } + } + NetMessage.SendTileSquare(-1, x, y + 1, 3); + } + + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) + { + Tile tile = Main.tile[i, j]; + Texture2D texture; + texture = TextureAssets.Tile[Type].Value; + Vector2 zero = new(Main.offScreenRange, Main.offScreenRange); + if (Main.drawToScreen) + { + zero = Vector2.Zero; + } + int height = 18; + int animate = 0; + if (tile.TileFrameY >= 92) + { + animate = Main.tileFrame[Type] * 92; + } + Main.spriteBatch.Draw(texture, new Vector2(i * 16 - (int)Main.screenPosition.X, j * 16 - (int)Main.screenPosition.Y) + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY + animate, 16, height), Lighting.GetColor(i, j), 0f, default(Vector2), 1f, SpriteEffects.None, 0f); + return false; + } + } +} diff --git a/Tiles/Furniture/Monoliths/PurpleDistortedMonolithTile.png b/Tiles/Furniture/Monoliths/PurpleDistortedMonolithTile.png new file mode 100644 index 0000000000..9c240370c4 Binary files /dev/null and b/Tiles/Furniture/Monoliths/PurpleDistortedMonolithTile.png differ diff --git a/Tiles/Furniture/PiggyCageTile.cs b/Tiles/Furniture/PiggyCageTile.cs index b4c137235d..517372277c 100644 --- a/Tiles/Furniture/PiggyCageTile.cs +++ b/Tiles/Furniture/PiggyCageTile.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; @@ -23,7 +24,7 @@ namespace CalamityMod.Tiles.Furniture public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 13, 0f, 0f, 0, new Color(), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Glass, 0f, 0f, 0, new Color(), 1f); return false; } diff --git a/Tiles/Furniture/SeaMinnowJarTile.cs b/Tiles/Furniture/SeaMinnowJarTile.cs index e386e089e1..d8f90548b8 100644 --- a/Tiles/Furniture/SeaMinnowJarTile.cs +++ b/Tiles/Furniture/SeaMinnowJarTile.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; @@ -23,7 +24,7 @@ namespace CalamityMod.Tiles.Furniture public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 13, 0f, 0f, 0, new Color(), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Glass, 0f, 0f, 0, new Color(), 1f); return false; } diff --git a/Tiles/Furniture/ThaumaticChairTile.cs b/Tiles/Furniture/ThaumaticChairTile.cs index 8465b54dd9..859e31f8bf 100644 --- a/Tiles/Furniture/ThaumaticChairTile.cs +++ b/Tiles/Furniture/ThaumaticChairTile.cs @@ -4,6 +4,7 @@ using Terraria; using Terraria.DataStructures; using Terraria.GameContent; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.Furniture @@ -14,7 +15,7 @@ namespace CalamityMod.Tiles.Furniture public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 7, 0f, 0f, 1, default, 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.WoodFurniture, 0f, 0f, 1, default, 1f); return false; } diff --git a/Tiles/Furniture/TwinklerInABottleTile.cs b/Tiles/Furniture/TwinklerInABottleTile.cs index 8a3a69b9c3..0eaa5947fd 100644 --- a/Tiles/Furniture/TwinklerInABottleTile.cs +++ b/Tiles/Furniture/TwinklerInABottleTile.cs @@ -41,7 +41,7 @@ namespace CalamityMod.Tiles.Furniture public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 13, 0f, 0f, 0, new Color(), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Glass, 0f, 0f, 0, new Color(), 1f); return false; } diff --git a/Tiles/Furniture/WulfrumLure.cs b/Tiles/Furniture/WulfrumLure.cs index 434548d06f..7e7d864482 100644 --- a/Tiles/Furniture/WulfrumLure.cs +++ b/Tiles/Furniture/WulfrumLure.cs @@ -1,23 +1,23 @@ -using CalamityMod.Dusts; +using System.Linq; +using CalamityMod.Dusts; using CalamityMod.Events; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Furniture; using CalamityMod.Items.SummonItems; -using CalamityMod.NPCs.AstrumDeus; using CalamityMod.Items.Tools; +using CalamityMod.NPCs.AstrumDeus; using CalamityMod.Projectiles.Boss; +using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; +using Terraria.Audio; using Terraria.DataStructures; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; -using Terraria.Audio; -using Terraria.ID; -using ReLogic.Content; -using Microsoft.Xna.Framework.Graphics; -using CalamityMod.Projectiles.Typeless; -using System.Linq; namespace CalamityMod.Tiles.Furniture { @@ -74,7 +74,7 @@ namespace CalamityMod.Tiles.Furniture public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref TileDrawInfo drawData) { - if (drawData.tileFrameX % (Width * 18) == 0 && drawData.tileFrameY % (Height * 18 ) == 0) + if (drawData.tileFrameX % (Width * 18) == 0 && drawData.tileFrameY % (Height * 18) == 0) { Main.instance.TilesRenderer.AddSpecialLegacyPoint(i, j); } diff --git a/Tiles/FurnitureAbyss/AbyssBathtub.cs b/Tiles/FurnitureAbyss/AbyssBathtub.cs index 5621e90df9..76aa5f84b2 100644 --- a/Tiles/FurnitureAbyss/AbyssBathtub.cs +++ b/Tiles/FurnitureAbyss/AbyssBathtub.cs @@ -1,6 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Tiles.FurnitureAbyss { public class AbyssBathtub : ModTile @@ -9,7 +11,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss 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, 130, 150), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 130, 150), 1f); return false; } diff --git a/Tiles/FurnitureAbyss/AbyssBed.cs b/Tiles/FurnitureAbyss/AbyssBed.cs index b21e1e3263..8d18164db5 100644 --- a/Tiles/FurnitureAbyss/AbyssBed.cs +++ b/Tiles/FurnitureAbyss/AbyssBed.cs @@ -1,6 +1,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureAbyss @@ -11,7 +12,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss 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, 130, 150), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 130, 150), 1f); return false; } diff --git a/Tiles/FurnitureAbyss/AbyssBookcase.cs b/Tiles/FurnitureAbyss/AbyssBookcase.cs index fa8016302e..478b572120 100644 --- a/Tiles/FurnitureAbyss/AbyssBookcase.cs +++ b/Tiles/FurnitureAbyss/AbyssBookcase.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureAbyss @@ -10,7 +11,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss 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, 130, 150), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 130, 150), 1f); return false; } diff --git a/Tiles/FurnitureAbyss/AbyssCandelabra.cs b/Tiles/FurnitureAbyss/AbyssCandelabra.cs index b60a507160..29ed46a7d3 100644 --- a/Tiles/FurnitureAbyss/AbyssCandelabra.cs +++ b/Tiles/FurnitureAbyss/AbyssCandelabra.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureAbyss @@ -10,7 +11,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss 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, 130, 150), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 130, 150), 1f); return false; } diff --git a/Tiles/FurnitureAbyss/AbyssCandle.cs b/Tiles/FurnitureAbyss/AbyssCandle.cs index 5fe315b73e..1bc70981e5 100644 --- a/Tiles/FurnitureAbyss/AbyssCandle.cs +++ b/Tiles/FurnitureAbyss/AbyssCandle.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureAbyss @@ -10,7 +11,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss 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, 130, 150), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 130, 150), 1f); return false; } diff --git a/Tiles/FurnitureAbyss/AbyssChair.cs b/Tiles/FurnitureAbyss/AbyssChair.cs index ba8ad38e6b..f85356db35 100644 --- a/Tiles/FurnitureAbyss/AbyssChair.cs +++ b/Tiles/FurnitureAbyss/AbyssChair.cs @@ -3,6 +3,7 @@ using Terraria; using Terraria.DataStructures; using Terraria.GameContent; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureAbyss @@ -13,7 +14,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss 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, 130, 150), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 130, 150), 1f); return false; } diff --git a/Tiles/FurnitureAbyss/AbyssChandelier.cs b/Tiles/FurnitureAbyss/AbyssChandelier.cs index 67d48d7040..bc9ca99128 100644 --- a/Tiles/FurnitureAbyss/AbyssChandelier.cs +++ b/Tiles/FurnitureAbyss/AbyssChandelier.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureAbyss @@ -10,7 +11,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss 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, 130, 150), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 130, 150), 1f); return false; } diff --git a/Tiles/FurnitureAbyss/AbyssChest.cs b/Tiles/FurnitureAbyss/AbyssChest.cs index 125d645546..13729c06d6 100644 --- a/Tiles/FurnitureAbyss/AbyssChest.cs +++ b/Tiles/FurnitureAbyss/AbyssChest.cs @@ -1,6 +1,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -16,7 +17,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss 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, 130, 150), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 130, 150), 1f); return false; } public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; diff --git a/Tiles/FurnitureAbyss/AbyssClock.cs b/Tiles/FurnitureAbyss/AbyssClock.cs index 4b81b836b3..d7ee944ebc 100644 --- a/Tiles/FurnitureAbyss/AbyssClock.cs +++ b/Tiles/FurnitureAbyss/AbyssClock.cs @@ -1,6 +1,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureAbyss @@ -17,7 +18,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss 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, 130, 150), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 130, 150), 1f); return false; } diff --git a/Tiles/FurnitureAbyss/AbyssDoorClosed.cs b/Tiles/FurnitureAbyss/AbyssDoorClosed.cs index ce0de49ecb..a9d0bf863a 100644 --- a/Tiles/FurnitureAbyss/AbyssDoorClosed.cs +++ b/Tiles/FurnitureAbyss/AbyssDoorClosed.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss 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, 130, 150), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 130, 150), 1f); return false; } diff --git a/Tiles/FurnitureAbyss/AbyssDoorOpen.cs b/Tiles/FurnitureAbyss/AbyssDoorOpen.cs index 87ed5f017d..ee639a3bd9 100644 --- a/Tiles/FurnitureAbyss/AbyssDoorOpen.cs +++ b/Tiles/FurnitureAbyss/AbyssDoorOpen.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss 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, 130, 150), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 130, 150), 1f); return false; } diff --git a/Tiles/FurnitureAbyss/AbyssDresser.cs b/Tiles/FurnitureAbyss/AbyssDresser.cs index e69c3bdfa1..d4fad0f275 100644 --- a/Tiles/FurnitureAbyss/AbyssDresser.cs +++ b/Tiles/FurnitureAbyss/AbyssDresser.cs @@ -1,6 +1,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -16,7 +17,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss 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, 130, 150), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 130, 150), 1f); return false; } public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; diff --git a/Tiles/FurnitureAbyss/AbyssLamp.cs b/Tiles/FurnitureAbyss/AbyssLamp.cs index 1533833130..9bda2175f1 100644 --- a/Tiles/FurnitureAbyss/AbyssLamp.cs +++ b/Tiles/FurnitureAbyss/AbyssLamp.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureAbyss @@ -10,7 +11,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss 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, 130, 150), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 130, 150), 1f); return false; } diff --git a/Tiles/FurnitureAbyss/AbyssLantern.cs b/Tiles/FurnitureAbyss/AbyssLantern.cs index 458ecc4871..0e175cb6f2 100644 --- a/Tiles/FurnitureAbyss/AbyssLantern.cs +++ b/Tiles/FurnitureAbyss/AbyssLantern.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureAbyss @@ -11,7 +12,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss 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, 130, 150), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 130, 150), 1f); return false; } diff --git a/Tiles/FurnitureAbyss/AbyssSink.cs b/Tiles/FurnitureAbyss/AbyssSink.cs index 809af06676..59a43ec484 100644 --- a/Tiles/FurnitureAbyss/AbyssSink.cs +++ b/Tiles/FurnitureAbyss/AbyssSink.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureAbyss @@ -10,7 +11,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss 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, 130, 150), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 130, 150), 1f); return false; } diff --git a/Tiles/FurnitureAbyss/AbyssSofa.cs b/Tiles/FurnitureAbyss/AbyssSofa.cs index acf6c835cf..e20eea99a0 100644 --- a/Tiles/FurnitureAbyss/AbyssSofa.cs +++ b/Tiles/FurnitureAbyss/AbyssSofa.cs @@ -3,7 +3,9 @@ using Terraria; using Terraria.DataStructures; using Terraria.GameContent; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Tiles.FurnitureAbyss { public class AbyssSofa : ModTile @@ -12,7 +14,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss 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, 130, 150), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 130, 150), 1f); return false; } diff --git a/Tiles/FurnitureAbyss/AbyssSynth.cs b/Tiles/FurnitureAbyss/AbyssSynth.cs index 3313aca024..30b731d2fa 100644 --- a/Tiles/FurnitureAbyss/AbyssSynth.cs +++ b/Tiles/FurnitureAbyss/AbyssSynth.cs @@ -1,6 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Tiles.FurnitureAbyss { [LegacyName("AbyssPiano")] @@ -10,7 +12,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss 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, 130, 150), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 130, 150), 1f); return false; } diff --git a/Tiles/FurnitureAbyss/AbyssTable.cs b/Tiles/FurnitureAbyss/AbyssTable.cs index 73ac70be18..b9ffbe1788 100644 --- a/Tiles/FurnitureAbyss/AbyssTable.cs +++ b/Tiles/FurnitureAbyss/AbyssTable.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureAbyss @@ -10,7 +11,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss 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, 130, 150), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 130, 150), 1f); return false; } diff --git a/Tiles/FurnitureAbyss/AbyssTorch.cs b/Tiles/FurnitureAbyss/AbyssTorch.cs index 5b24722eca..7c0459014e 100644 --- a/Tiles/FurnitureAbyss/AbyssTorch.cs +++ b/Tiles/FurnitureAbyss/AbyssTorch.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureAbyss @@ -12,7 +13,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss 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, 130, 150), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 130, 150), 1f); return false; } @@ -70,10 +71,10 @@ namespace CalamityMod.Tiles.FurnitureAbyss return true; } - public override float GetTorchLuck(Player player) - { - // Note: Total Torch luck never goes below zero - return player.Calamity().ZoneAbyss ? 1f : -1f; // Abyss Torch gives positive luck when in the Abyss, otherwise some negative luck - } + public override float GetTorchLuck(Player player) + { + // Note: Total Torch luck never goes below zero + return player.Calamity().ZoneAbyss ? 1f : -1f; // Abyss Torch gives positive luck when in the Abyss, otherwise some negative luck + } } } diff --git a/Tiles/FurnitureAbyss/AbyssWorkBench.cs b/Tiles/FurnitureAbyss/AbyssWorkBench.cs index 0670332706..7a0aaf6ec1 100644 --- a/Tiles/FurnitureAbyss/AbyssWorkBench.cs +++ b/Tiles/FurnitureAbyss/AbyssWorkBench.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureAbyss @@ -11,7 +12,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss 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, 130, 150), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 130, 150), 1f); return false; } diff --git a/Tiles/FurnitureAbyss/SmoothAbyssGravel.cs b/Tiles/FurnitureAbyss/SmoothAbyssGravel.cs index 6133dd788d..c662dfbde8 100644 --- a/Tiles/FurnitureAbyss/SmoothAbyssGravel.cs +++ b/Tiles/FurnitureAbyss/SmoothAbyssGravel.cs @@ -1,8 +1,8 @@ - + using Microsoft.Xna.Framework; using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureAbyss { @@ -26,7 +26,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss 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, 130, 150), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 130, 150), 1f); return false; } } diff --git a/Tiles/FurnitureAbyss/SmoothAbyssGravelPlatform.cs b/Tiles/FurnitureAbyss/SmoothAbyssGravelPlatform.cs index 531519b6d2..ae86d7a179 100644 --- a/Tiles/FurnitureAbyss/SmoothAbyssGravelPlatform.cs +++ b/Tiles/FurnitureAbyss/SmoothAbyssGravelPlatform.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss 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, 130, 150), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 130, 150), 1f); return false; } diff --git a/Tiles/FurnitureAcidwood/AcidwoodBathTile.cs b/Tiles/FurnitureAcidwood/AcidwoodBathTile.cs index e12625c691..66dec449dd 100644 --- a/Tiles/FurnitureAcidwood/AcidwoodBathTile.cs +++ b/Tiles/FurnitureAcidwood/AcidwoodBathTile.cs @@ -1,7 +1,9 @@ using CalamityMod.Items.Placeables.FurnitureAcidwood; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Tiles.FurnitureAcidwood { public class AcidwoodBathTile : ModTile @@ -10,7 +12,7 @@ namespace CalamityMod.Tiles.FurnitureAcidwood public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 7, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.WoodFurniture, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureAcidwood/AcidwoodBedTile.cs b/Tiles/FurnitureAcidwood/AcidwoodBedTile.cs index 7ff16c442d..73ffbbb9e3 100644 --- a/Tiles/FurnitureAcidwood/AcidwoodBedTile.cs +++ b/Tiles/FurnitureAcidwood/AcidwoodBedTile.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureAcidwood @@ -12,7 +13,7 @@ namespace CalamityMod.Tiles.FurnitureAcidwood public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 7, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.WoodFurniture, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureAcidwood/AcidwoodBenchTile.cs b/Tiles/FurnitureAcidwood/AcidwoodBenchTile.cs index adf40c54f5..9224924124 100644 --- a/Tiles/FurnitureAcidwood/AcidwoodBenchTile.cs +++ b/Tiles/FurnitureAcidwood/AcidwoodBenchTile.cs @@ -4,7 +4,9 @@ using Terraria; using Terraria.DataStructures; using Terraria.GameContent; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Tiles.FurnitureAcidwood { public class AcidwoodBenchTile : ModTile @@ -13,7 +15,7 @@ namespace CalamityMod.Tiles.FurnitureAcidwood public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 7, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.WoodFurniture, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureAcidwood/AcidwoodBookcaseTile.cs b/Tiles/FurnitureAcidwood/AcidwoodBookcaseTile.cs index 789f7d0c90..f02faf8580 100644 --- a/Tiles/FurnitureAcidwood/AcidwoodBookcaseTile.cs +++ b/Tiles/FurnitureAcidwood/AcidwoodBookcaseTile.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Placeables.FurnitureAcidwood; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureAcidwood @@ -11,7 +12,7 @@ namespace CalamityMod.Tiles.FurnitureAcidwood public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 7, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.WoodFurniture, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureAcidwood/AcidwoodCandelabraTile.cs b/Tiles/FurnitureAcidwood/AcidwoodCandelabraTile.cs index 5379ebec93..fef06c039b 100644 --- a/Tiles/FurnitureAcidwood/AcidwoodCandelabraTile.cs +++ b/Tiles/FurnitureAcidwood/AcidwoodCandelabraTile.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureAcidwood @@ -12,7 +13,7 @@ namespace CalamityMod.Tiles.FurnitureAcidwood public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 7, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.WoodFurniture, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureAcidwood/AcidwoodCandleTile.cs b/Tiles/FurnitureAcidwood/AcidwoodCandleTile.cs index e4848a0a14..5362d24dfc 100644 --- a/Tiles/FurnitureAcidwood/AcidwoodCandleTile.cs +++ b/Tiles/FurnitureAcidwood/AcidwoodCandleTile.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureAcidwood @@ -12,7 +13,7 @@ namespace CalamityMod.Tiles.FurnitureAcidwood public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 7, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.WoodFurniture, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureAcidwood/AcidwoodChairTile.cs b/Tiles/FurnitureAcidwood/AcidwoodChairTile.cs index 4fda08cdec..5c931195b2 100644 --- a/Tiles/FurnitureAcidwood/AcidwoodChairTile.cs +++ b/Tiles/FurnitureAcidwood/AcidwoodChairTile.cs @@ -48,7 +48,7 @@ namespace CalamityMod.Tiles.FurnitureAcidwood public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 7, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.WoodFurniture, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureAcidwood/AcidwoodChandelierTile.cs b/Tiles/FurnitureAcidwood/AcidwoodChandelierTile.cs index 5a548f2aa9..0d71135c72 100644 --- a/Tiles/FurnitureAcidwood/AcidwoodChandelierTile.cs +++ b/Tiles/FurnitureAcidwood/AcidwoodChandelierTile.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureAcidwood @@ -12,7 +13,7 @@ namespace CalamityMod.Tiles.FurnitureAcidwood public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 7, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.WoodFurniture, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureAcidwood/AcidwoodChestTile.cs b/Tiles/FurnitureAcidwood/AcidwoodChestTile.cs index f95ac22b9d..357fc07498 100644 --- a/Tiles/FurnitureAcidwood/AcidwoodChestTile.cs +++ b/Tiles/FurnitureAcidwood/AcidwoodChestTile.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -17,7 +18,7 @@ namespace CalamityMod.Tiles.FurnitureAcidwood public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 7, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.WoodFurniture, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; diff --git a/Tiles/FurnitureAcidwood/AcidwoodClockTile.cs b/Tiles/FurnitureAcidwood/AcidwoodClockTile.cs index 99f72b3be3..0e8127a1bd 100644 --- a/Tiles/FurnitureAcidwood/AcidwoodClockTile.cs +++ b/Tiles/FurnitureAcidwood/AcidwoodClockTile.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureAcidwood @@ -14,7 +15,7 @@ namespace CalamityMod.Tiles.FurnitureAcidwood public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 7, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.WoodFurniture, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureAcidwood/AcidwoodDoorClosed.cs b/Tiles/FurnitureAcidwood/AcidwoodDoorClosed.cs index bc8ba4f6dd..4fb879f54d 100644 --- a/Tiles/FurnitureAcidwood/AcidwoodDoorClosed.cs +++ b/Tiles/FurnitureAcidwood/AcidwoodDoorClosed.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Tiles.FurnitureAcidwood public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 7, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.WoodFurniture, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureAcidwood/AcidwoodDoorOpen.cs b/Tiles/FurnitureAcidwood/AcidwoodDoorOpen.cs index 2acac4984f..b8ac950a17 100644 --- a/Tiles/FurnitureAcidwood/AcidwoodDoorOpen.cs +++ b/Tiles/FurnitureAcidwood/AcidwoodDoorOpen.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Tiles.FurnitureAcidwood public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 7, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.WoodFurniture, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureAcidwood/AcidwoodDresserTile.cs b/Tiles/FurnitureAcidwood/AcidwoodDresserTile.cs index 32404fc998..12bd55ff70 100644 --- a/Tiles/FurnitureAcidwood/AcidwoodDresserTile.cs +++ b/Tiles/FurnitureAcidwood/AcidwoodDresserTile.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -17,7 +18,7 @@ namespace CalamityMod.Tiles.FurnitureAcidwood public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 7, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.WoodFurniture, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; diff --git a/Tiles/FurnitureAcidwood/AcidwoodLampTile.cs b/Tiles/FurnitureAcidwood/AcidwoodLampTile.cs index b4926c1e99..70ed8c2eb4 100644 --- a/Tiles/FurnitureAcidwood/AcidwoodLampTile.cs +++ b/Tiles/FurnitureAcidwood/AcidwoodLampTile.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureAcidwood @@ -12,7 +13,7 @@ namespace CalamityMod.Tiles.FurnitureAcidwood public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 7, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.WoodFurniture, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureAcidwood/AcidwoodLanternTile.cs b/Tiles/FurnitureAcidwood/AcidwoodLanternTile.cs index 1b31516425..caa6941efc 100644 --- a/Tiles/FurnitureAcidwood/AcidwoodLanternTile.cs +++ b/Tiles/FurnitureAcidwood/AcidwoodLanternTile.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureAcidwood @@ -15,7 +16,7 @@ namespace CalamityMod.Tiles.FurnitureAcidwood public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 7, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.WoodFurniture, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } @@ -49,13 +50,13 @@ namespace CalamityMod.Tiles.FurnitureAcidwood { CalamityUtils.DrawFlameEffect(ModContent.Request("CalamityMod/Tiles/FurnitureAcidwood/AcidwoodLanternTileFlame").Value, i, j, 0, -8); } - + public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref TileDrawInfo drawData) { Tile tile = Main.tile[i, j]; if (tile.TileFrameY == 0 && tile.TileFrameX < 18) { - CalamityUtils.DrawFlameSparks((int)CalamityDusts.SulfurousSeaAcid, 18, i, j); + CalamityUtils.DrawFlameSparks((int)CalamityDusts.SulphurousSeaAcid, 18, i, j); } } } diff --git a/Tiles/FurnitureAcidwood/AcidwoodPianoTile.cs b/Tiles/FurnitureAcidwood/AcidwoodPianoTile.cs index bfb9a07ae9..46852e0266 100644 --- a/Tiles/FurnitureAcidwood/AcidwoodPianoTile.cs +++ b/Tiles/FurnitureAcidwood/AcidwoodPianoTile.cs @@ -1,7 +1,9 @@ using CalamityMod.Items.Placeables.FurnitureAcidwood; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Tiles.FurnitureAcidwood { public class AcidwoodPianoTile : ModTile @@ -10,7 +12,7 @@ namespace CalamityMod.Tiles.FurnitureAcidwood public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 7, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.WoodFurniture, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureAcidwood/AcidwoodPlatformTile.cs b/Tiles/FurnitureAcidwood/AcidwoodPlatformTile.cs index c359ea0f80..9089af615e 100644 --- a/Tiles/FurnitureAcidwood/AcidwoodPlatformTile.cs +++ b/Tiles/FurnitureAcidwood/AcidwoodPlatformTile.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Placeables.FurnitureAcidwood; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureAcidwood @@ -11,7 +12,7 @@ namespace CalamityMod.Tiles.FurnitureAcidwood public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 7, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.WoodFurniture, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureAcidwood/AcidwoodSinkTile.cs b/Tiles/FurnitureAcidwood/AcidwoodSinkTile.cs index ece01c0cdd..9842e37055 100644 --- a/Tiles/FurnitureAcidwood/AcidwoodSinkTile.cs +++ b/Tiles/FurnitureAcidwood/AcidwoodSinkTile.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Placeables.FurnitureAcidwood; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureAcidwood @@ -11,7 +12,7 @@ namespace CalamityMod.Tiles.FurnitureAcidwood public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 7, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.WoodFurniture, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureAcidwood/AcidwoodTableTile.cs b/Tiles/FurnitureAcidwood/AcidwoodTableTile.cs index c1963c64a4..967382d30a 100644 --- a/Tiles/FurnitureAcidwood/AcidwoodTableTile.cs +++ b/Tiles/FurnitureAcidwood/AcidwoodTableTile.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Placeables.FurnitureAcidwood; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureAcidwood @@ -11,7 +12,7 @@ namespace CalamityMod.Tiles.FurnitureAcidwood public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 7, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.WoodFurniture, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureAcidwood/AcidwoodWorkBenchTile.cs b/Tiles/FurnitureAcidwood/AcidwoodWorkBenchTile.cs index c4bb82a096..0ec0838337 100644 --- a/Tiles/FurnitureAcidwood/AcidwoodWorkBenchTile.cs +++ b/Tiles/FurnitureAcidwood/AcidwoodWorkBenchTile.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Placeables.FurnitureAcidwood; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureAcidwood @@ -12,7 +13,7 @@ namespace CalamityMod.Tiles.FurnitureAcidwood public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 7, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.WoodFurniture, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureAncient/AncientBasin.cs b/Tiles/FurnitureAncient/AncientBasin.cs index 7e88d57d3f..4ef406d4f2 100644 --- a/Tiles/FurnitureAncient/AncientBasin.cs +++ b/Tiles/FurnitureAncient/AncientBasin.cs @@ -28,8 +28,8 @@ namespace CalamityMod.Tiles.FurnitureAncient public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 100, 100), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.RedTorch, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 100, 100), 1f); return false; } diff --git a/Tiles/FurnitureAncient/AncientBathtub.cs b/Tiles/FurnitureAncient/AncientBathtub.cs index b14c47efcc..2ac33890c3 100644 --- a/Tiles/FurnitureAncient/AncientBathtub.cs +++ b/Tiles/FurnitureAncient/AncientBathtub.cs @@ -1,6 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Tiles.FurnitureAncient { public class AncientBathtub : ModTile @@ -9,8 +11,8 @@ namespace CalamityMod.Tiles.FurnitureAncient public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 100, 100), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.RedTorch, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 100, 100), 1f); return false; } diff --git a/Tiles/FurnitureAncient/AncientBed.cs b/Tiles/FurnitureAncient/AncientBed.cs index c1dffbb968..9008ee9dfb 100644 --- a/Tiles/FurnitureAncient/AncientBed.cs +++ b/Tiles/FurnitureAncient/AncientBed.cs @@ -2,6 +2,7 @@ using Terraria; using Terraria.GameContent; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -13,8 +14,8 @@ namespace CalamityMod.Tiles.FurnitureAncient public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 100, 100), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.RedTorch, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 100, 100), 1f); return false; } @@ -28,7 +29,7 @@ namespace CalamityMod.Tiles.FurnitureAncient public override bool RightClick(int i, int j) { Player player = Main.LocalPlayer; - Tile tile = Main.tile[i , j]; + Tile tile = Main.tile[i, j]; int spawnX = i - tile.TileFrameX / 18 + (tile.TileFrameX >= 72 ? 5 : 2); int spawnY = j + 2; if (tile.TileFrameY % 38 != 0) diff --git a/Tiles/FurnitureAncient/AncientBookcase.cs b/Tiles/FurnitureAncient/AncientBookcase.cs index 11a35bb087..7ac3263c41 100644 --- a/Tiles/FurnitureAncient/AncientBookcase.cs +++ b/Tiles/FurnitureAncient/AncientBookcase.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureAncient @@ -10,8 +11,8 @@ namespace CalamityMod.Tiles.FurnitureAncient public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 100, 100), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.RedTorch, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 100, 100), 1f); return false; } diff --git a/Tiles/FurnitureAncient/AncientChair.cs b/Tiles/FurnitureAncient/AncientChair.cs index 49dd61cf15..6d6bb19f2a 100644 --- a/Tiles/FurnitureAncient/AncientChair.cs +++ b/Tiles/FurnitureAncient/AncientChair.cs @@ -3,6 +3,7 @@ using Terraria; using Terraria.DataStructures; using Terraria.GameContent; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureAncient @@ -13,8 +14,8 @@ namespace CalamityMod.Tiles.FurnitureAncient public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 100, 100), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.RedTorch, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 100, 100), 1f); return false; } diff --git a/Tiles/FurnitureAncient/AncientChandelier.cs b/Tiles/FurnitureAncient/AncientChandelier.cs index 169ab0b596..85650a6e48 100644 --- a/Tiles/FurnitureAncient/AncientChandelier.cs +++ b/Tiles/FurnitureAncient/AncientChandelier.cs @@ -2,7 +2,9 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Tiles.FurnitureAncient { public class AncientChandelier : ModTile @@ -11,8 +13,8 @@ namespace CalamityMod.Tiles.FurnitureAncient public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 100, 100), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.RedTorch, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 100, 100), 1f); return false; } diff --git a/Tiles/FurnitureAncient/AncientDoorClosed.cs b/Tiles/FurnitureAncient/AncientDoorClosed.cs index d853791454..2c7ca1500e 100644 --- a/Tiles/FurnitureAncient/AncientDoorClosed.cs +++ b/Tiles/FurnitureAncient/AncientDoorClosed.cs @@ -16,8 +16,8 @@ namespace CalamityMod.Tiles.FurnitureAncient public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 100, 100), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.RedTorch, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 100, 100), 1f); return false; } diff --git a/Tiles/FurnitureAncient/AncientDoorOpen.cs b/Tiles/FurnitureAncient/AncientDoorOpen.cs index 54c9621706..d059411b9b 100644 --- a/Tiles/FurnitureAncient/AncientDoorOpen.cs +++ b/Tiles/FurnitureAncient/AncientDoorOpen.cs @@ -17,8 +17,8 @@ namespace CalamityMod.Tiles.FurnitureAncient public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 100, 100), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.RedTorch, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 100, 100), 1f); return false; } diff --git a/Tiles/FurnitureAncient/AncientDresser.cs b/Tiles/FurnitureAncient/AncientDresser.cs index 6d2f93b035..f6bf544ea9 100644 --- a/Tiles/FurnitureAncient/AncientDresser.cs +++ b/Tiles/FurnitureAncient/AncientDresser.cs @@ -1,6 +1,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -16,8 +17,8 @@ namespace CalamityMod.Tiles.FurnitureAncient public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 100, 100), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.RedTorch, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 100, 100), 1f); return false; } public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; diff --git a/Tiles/FurnitureAncient/AncientLamp.cs b/Tiles/FurnitureAncient/AncientLamp.cs index 02911e0dbd..b112264fd9 100644 --- a/Tiles/FurnitureAncient/AncientLamp.cs +++ b/Tiles/FurnitureAncient/AncientLamp.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureAncient @@ -12,8 +13,8 @@ namespace CalamityMod.Tiles.FurnitureAncient public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 100, 100), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.RedTorch, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 100, 100), 1f); return false; } diff --git a/Tiles/FurnitureAncient/AncientLantern.cs b/Tiles/FurnitureAncient/AncientLantern.cs index 10eb94c4b3..523137a9d2 100644 --- a/Tiles/FurnitureAncient/AncientLantern.cs +++ b/Tiles/FurnitureAncient/AncientLantern.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureAncient @@ -13,8 +14,8 @@ namespace CalamityMod.Tiles.FurnitureAncient public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 100, 100), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.RedTorch, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 100, 100), 1f); return false; } diff --git a/Tiles/FurnitureAncient/AncientMonolith.cs b/Tiles/FurnitureAncient/AncientMonolith.cs index a628da0ee7..57280af8a5 100644 --- a/Tiles/FurnitureAncient/AncientMonolith.cs +++ b/Tiles/FurnitureAncient/AncientMonolith.cs @@ -1,6 +1,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureAncient @@ -14,8 +15,8 @@ namespace CalamityMod.Tiles.FurnitureAncient public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 100, 100), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.RedTorch, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 100, 100), 1f); return false; } diff --git a/Tiles/FurnitureAncient/AncientPipeOrgan.cs b/Tiles/FurnitureAncient/AncientPipeOrgan.cs index 666baac830..9d11e7839d 100644 --- a/Tiles/FurnitureAncient/AncientPipeOrgan.cs +++ b/Tiles/FurnitureAncient/AncientPipeOrgan.cs @@ -1,6 +1,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; @@ -24,8 +25,8 @@ namespace CalamityMod.Tiles.FurnitureAncient public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 100, 100), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.RedTorch, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 100, 100), 1f); return false; } diff --git a/Tiles/FurnitureAncient/AncientSink.cs b/Tiles/FurnitureAncient/AncientSink.cs index 2423dac7fa..25a3a4f8b7 100644 --- a/Tiles/FurnitureAncient/AncientSink.cs +++ b/Tiles/FurnitureAncient/AncientSink.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureAncient @@ -10,8 +11,8 @@ namespace CalamityMod.Tiles.FurnitureAncient public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 100, 100), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.RedTorch, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 100, 100), 1f); return false; } diff --git a/Tiles/FurnitureAncient/AncientSofa.cs b/Tiles/FurnitureAncient/AncientSofa.cs index a5722c5e42..4bb38cc641 100644 --- a/Tiles/FurnitureAncient/AncientSofa.cs +++ b/Tiles/FurnitureAncient/AncientSofa.cs @@ -3,7 +3,9 @@ using Terraria; using Terraria.DataStructures; using Terraria.GameContent; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Tiles.FurnitureAncient { public class AncientSofa : ModTile @@ -12,8 +14,8 @@ namespace CalamityMod.Tiles.FurnitureAncient public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 100, 100), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.RedTorch, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 100, 100), 1f); return false; } diff --git a/Tiles/FurnitureAncient/AncientTable.cs b/Tiles/FurnitureAncient/AncientTable.cs index dd6930a612..b3f81ef610 100644 --- a/Tiles/FurnitureAncient/AncientTable.cs +++ b/Tiles/FurnitureAncient/AncientTable.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureAncient @@ -10,8 +11,8 @@ namespace CalamityMod.Tiles.FurnitureAncient public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 100, 100), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.RedTorch, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 100, 100), 1f); return false; } diff --git a/Tiles/FurnitureAncient/AncientWorkBench.cs b/Tiles/FurnitureAncient/AncientWorkBench.cs index 0e0c9f7b7b..5dd24d4c41 100644 --- a/Tiles/FurnitureAncient/AncientWorkBench.cs +++ b/Tiles/FurnitureAncient/AncientWorkBench.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureAncient @@ -11,8 +12,8 @@ namespace CalamityMod.Tiles.FurnitureAncient public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 100, 100), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.RedTorch, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 100, 100), 1f); return false; } diff --git a/Tiles/FurnitureAshen/AshenAccentSlab.cs b/Tiles/FurnitureAshen/AshenAccentSlab.cs index 3c49bc54f5..8800b68b08 100644 --- a/Tiles/FurnitureAshen/AshenAccentSlab.cs +++ b/Tiles/FurnitureAshen/AshenAccentSlab.cs @@ -1,8 +1,8 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureAshen { @@ -26,8 +26,8 @@ namespace CalamityMod.Tiles.FurnitureAshen public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 100, 100), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.RedTorch, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 100, 100), 1f); return false; } diff --git a/Tiles/FurnitureAshen/AshenBasin.cs b/Tiles/FurnitureAshen/AshenBasin.cs index 978e75abb6..6f22d70bde 100644 --- a/Tiles/FurnitureAshen/AshenBasin.cs +++ b/Tiles/FurnitureAshen/AshenBasin.cs @@ -28,8 +28,8 @@ namespace CalamityMod.Tiles.FurnitureAshen public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 100, 100), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.RedTorch, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 100, 100), 1f); return false; } diff --git a/Tiles/FurnitureAshen/AshenBathtub.cs b/Tiles/FurnitureAshen/AshenBathtub.cs index 2584016bf5..b21295fb9b 100644 --- a/Tiles/FurnitureAshen/AshenBathtub.cs +++ b/Tiles/FurnitureAshen/AshenBathtub.cs @@ -1,6 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Tiles.FurnitureAshen { public class AshenBathtub : ModTile @@ -9,8 +11,8 @@ namespace CalamityMod.Tiles.FurnitureAshen public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 100, 100), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.RedTorch, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 100, 100), 1f); return false; } diff --git a/Tiles/FurnitureAshen/AshenBed.cs b/Tiles/FurnitureAshen/AshenBed.cs index 5856f0e505..9267651c2a 100644 --- a/Tiles/FurnitureAshen/AshenBed.cs +++ b/Tiles/FurnitureAshen/AshenBed.cs @@ -1,6 +1,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureAshen @@ -11,8 +12,8 @@ namespace CalamityMod.Tiles.FurnitureAshen public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 100, 100), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.RedTorch, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 100, 100), 1f); return false; } diff --git a/Tiles/FurnitureAshen/AshenBookcase.cs b/Tiles/FurnitureAshen/AshenBookcase.cs index 1d13dc0632..4cda3ac4a4 100644 --- a/Tiles/FurnitureAshen/AshenBookcase.cs +++ b/Tiles/FurnitureAshen/AshenBookcase.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureAshen @@ -10,8 +11,8 @@ namespace CalamityMod.Tiles.FurnitureAshen public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 100, 100), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.RedTorch, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 100, 100), 1f); return false; } diff --git a/Tiles/FurnitureAshen/AshenCandelabra.cs b/Tiles/FurnitureAshen/AshenCandelabra.cs index 4f28102f0a..1bd754c8cc 100644 --- a/Tiles/FurnitureAshen/AshenCandelabra.cs +++ b/Tiles/FurnitureAshen/AshenCandelabra.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureAshen @@ -18,8 +19,8 @@ namespace CalamityMod.Tiles.FurnitureAshen public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 100, 100), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.RedTorch, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 100, 100), 1f); return false; } diff --git a/Tiles/FurnitureAshen/AshenCandle.cs b/Tiles/FurnitureAshen/AshenCandle.cs index 539da04ecb..019a86ed4e 100644 --- a/Tiles/FurnitureAshen/AshenCandle.cs +++ b/Tiles/FurnitureAshen/AshenCandle.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureAshen @@ -12,8 +13,8 @@ namespace CalamityMod.Tiles.FurnitureAshen public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 100, 100), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.RedTorch, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 100, 100), 1f); return false; } diff --git a/Tiles/FurnitureAshen/AshenChair.cs b/Tiles/FurnitureAshen/AshenChair.cs index ea94410895..86e2829b8e 100644 --- a/Tiles/FurnitureAshen/AshenChair.cs +++ b/Tiles/FurnitureAshen/AshenChair.cs @@ -3,6 +3,7 @@ using Terraria; using Terraria.DataStructures; using Terraria.GameContent; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureAshen @@ -13,8 +14,8 @@ namespace CalamityMod.Tiles.FurnitureAshen public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 100, 100), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.RedTorch, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 100, 100), 1f); return false; } diff --git a/Tiles/FurnitureAshen/AshenChandelier.cs b/Tiles/FurnitureAshen/AshenChandelier.cs index ace53e2205..d924e95579 100644 --- a/Tiles/FurnitureAshen/AshenChandelier.cs +++ b/Tiles/FurnitureAshen/AshenChandelier.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureAshen @@ -18,8 +19,8 @@ namespace CalamityMod.Tiles.FurnitureAshen public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 100, 100), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.RedTorch, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 100, 100), 1f); return false; } diff --git a/Tiles/FurnitureAshen/AshenChest.cs b/Tiles/FurnitureAshen/AshenChest.cs index 9adfd90bcc..af112776a2 100644 --- a/Tiles/FurnitureAshen/AshenChest.cs +++ b/Tiles/FurnitureAshen/AshenChest.cs @@ -1,6 +1,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -10,19 +11,19 @@ namespace CalamityMod.Tiles.FurnitureAshen { public override void SetStaticDefaults() { - this.SetUpChest(ModContent.ItemType< Items.Placeables.FurnitureAshen.AshenChest>(), true); + this.SetUpChest(ModContent.ItemType(), true); AddMapEntry(new Color(191, 142, 111), this.GetLocalization("MapEntry0"), MapChestName); AddMapEntry(new Color(174, 129, 92), this.GetLocalization("MapEntry1"), MapChestName); } public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 100, 100), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.RedTorch, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 100, 100), 1f); return false; } public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; - public override void NumDust(int i, int j, bool fail, ref int num) => num = 1; + public override void NumDust(int i, int j, bool fail, ref int num) => num = 1; public string MapChestName(string name, int i, int j) => CalamityUtils.GetMapChestName(name, i, j); public override ushort GetMapOption(int i, int j) => (ushort)(Main.tile[i, j].TileFrameX / 36); diff --git a/Tiles/FurnitureAshen/AshenDoorClosed.cs b/Tiles/FurnitureAshen/AshenDoorClosed.cs index 5205b182f6..21b2454521 100644 --- a/Tiles/FurnitureAshen/AshenDoorClosed.cs +++ b/Tiles/FurnitureAshen/AshenDoorClosed.cs @@ -17,8 +17,8 @@ namespace CalamityMod.Tiles.FurnitureAshen public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 100, 100), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.RedTorch, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 100, 100), 1f); return false; } diff --git a/Tiles/FurnitureAshen/AshenDoorOpen.cs b/Tiles/FurnitureAshen/AshenDoorOpen.cs index f744061656..d059cc1b06 100644 --- a/Tiles/FurnitureAshen/AshenDoorOpen.cs +++ b/Tiles/FurnitureAshen/AshenDoorOpen.cs @@ -17,8 +17,8 @@ namespace CalamityMod.Tiles.FurnitureAshen public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 100, 100), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.RedTorch, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 100, 100), 1f); return false; } diff --git a/Tiles/FurnitureAshen/AshenDresser.cs b/Tiles/FurnitureAshen/AshenDresser.cs index 7c9616005a..77b3031780 100644 --- a/Tiles/FurnitureAshen/AshenDresser.cs +++ b/Tiles/FurnitureAshen/AshenDresser.cs @@ -1,6 +1,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -16,8 +17,8 @@ namespace CalamityMod.Tiles.FurnitureAshen public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 100, 100), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.RedTorch, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 100, 100), 1f); return false; } public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; diff --git a/Tiles/FurnitureAshen/AshenLamp.cs b/Tiles/FurnitureAshen/AshenLamp.cs index 01f81493ac..5ce0af78f4 100644 --- a/Tiles/FurnitureAshen/AshenLamp.cs +++ b/Tiles/FurnitureAshen/AshenLamp.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureAshen @@ -12,8 +13,8 @@ namespace CalamityMod.Tiles.FurnitureAshen public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 100, 100), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.RedTorch, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 100, 100), 1f); return false; } diff --git a/Tiles/FurnitureAshen/AshenLantern.cs b/Tiles/FurnitureAshen/AshenLantern.cs index 4c31af5d37..3d039ecd85 100644 --- a/Tiles/FurnitureAshen/AshenLantern.cs +++ b/Tiles/FurnitureAshen/AshenLantern.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureAshen @@ -13,8 +14,8 @@ namespace CalamityMod.Tiles.FurnitureAshen public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 100, 100), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.RedTorch, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 100, 100), 1f); return false; } diff --git a/Tiles/FurnitureAshen/AshenMonolith.cs b/Tiles/FurnitureAshen/AshenMonolith.cs index 873aea4392..6e0d5e1ca3 100644 --- a/Tiles/FurnitureAshen/AshenMonolith.cs +++ b/Tiles/FurnitureAshen/AshenMonolith.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureAshen @@ -16,8 +17,8 @@ namespace CalamityMod.Tiles.FurnitureAshen public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 100, 100), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.RedTorch, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 100, 100), 1f); return false; } diff --git a/Tiles/FurnitureAshen/AshenPipeOrgan.cs b/Tiles/FurnitureAshen/AshenPipeOrgan.cs index d2aff60e24..cea4c14b71 100644 --- a/Tiles/FurnitureAshen/AshenPipeOrgan.cs +++ b/Tiles/FurnitureAshen/AshenPipeOrgan.cs @@ -1,6 +1,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; @@ -24,8 +25,8 @@ namespace CalamityMod.Tiles.FurnitureAshen public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 100, 100), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.RedTorch, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 100, 100), 1f); return false; } diff --git a/Tiles/FurnitureAshen/AshenPlatform.cs b/Tiles/FurnitureAshen/AshenPlatform.cs index 33bf133e88..9f3fc9c3e5 100644 --- a/Tiles/FurnitureAshen/AshenPlatform.cs +++ b/Tiles/FurnitureAshen/AshenPlatform.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureAshen @@ -10,8 +11,8 @@ namespace CalamityMod.Tiles.FurnitureAshen public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 100, 100), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.RedTorch, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 100, 100), 1f); return false; } diff --git a/Tiles/FurnitureAshen/AshenSink.cs b/Tiles/FurnitureAshen/AshenSink.cs index f7c4a72919..612fcc3bef 100644 --- a/Tiles/FurnitureAshen/AshenSink.cs +++ b/Tiles/FurnitureAshen/AshenSink.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureAshen @@ -10,8 +11,8 @@ namespace CalamityMod.Tiles.FurnitureAshen public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 100, 100), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.RedTorch, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 100, 100), 1f); return false; } diff --git a/Tiles/FurnitureAshen/AshenSlab.cs b/Tiles/FurnitureAshen/AshenSlab.cs index 21e695cc16..7b6c4cebd3 100644 --- a/Tiles/FurnitureAshen/AshenSlab.cs +++ b/Tiles/FurnitureAshen/AshenSlab.cs @@ -1,9 +1,9 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Tiles.Crags; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; -using Terraria.ModLoader; using Terraria.ID; -using CalamityMod.Tiles.Crags; +using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureAshen { @@ -26,8 +26,8 @@ namespace CalamityMod.Tiles.FurnitureAshen public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 100, 100), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.RedTorch, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 100, 100), 1f); return false; } diff --git a/Tiles/FurnitureAshen/AshenSofa.cs b/Tiles/FurnitureAshen/AshenSofa.cs index 7b0d8dc7bd..6396af054e 100644 --- a/Tiles/FurnitureAshen/AshenSofa.cs +++ b/Tiles/FurnitureAshen/AshenSofa.cs @@ -3,7 +3,9 @@ using Terraria; using Terraria.DataStructures; using Terraria.GameContent; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Tiles.FurnitureAshen { public class AshenSofa : ModTile @@ -12,8 +14,8 @@ namespace CalamityMod.Tiles.FurnitureAshen public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 100, 100), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.RedTorch, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 100, 100), 1f); return false; } diff --git a/Tiles/FurnitureAshen/AshenTable.cs b/Tiles/FurnitureAshen/AshenTable.cs index c9b0b97d02..2f90c120e8 100644 --- a/Tiles/FurnitureAshen/AshenTable.cs +++ b/Tiles/FurnitureAshen/AshenTable.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureAshen @@ -10,8 +11,8 @@ namespace CalamityMod.Tiles.FurnitureAshen public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 100, 100), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.RedTorch, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 100, 100), 1f); return false; } diff --git a/Tiles/FurnitureAshen/AshenWorkBench.cs b/Tiles/FurnitureAshen/AshenWorkBench.cs index 4441c7cee8..17ff6caefe 100644 --- a/Tiles/FurnitureAshen/AshenWorkBench.cs +++ b/Tiles/FurnitureAshen/AshenWorkBench.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureAshen @@ -11,8 +12,8 @@ namespace CalamityMod.Tiles.FurnitureAshen public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 100, 100), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.RedTorch, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 100, 100), 1f); return false; } diff --git a/Tiles/FurnitureAshen/SmoothBrimstoneSlag.cs b/Tiles/FurnitureAshen/SmoothBrimstoneSlag.cs index 3caa5a796a..a76aa52f91 100644 --- a/Tiles/FurnitureAshen/SmoothBrimstoneSlag.cs +++ b/Tiles/FurnitureAshen/SmoothBrimstoneSlag.cs @@ -2,8 +2,8 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureAshen { @@ -27,8 +27,8 @@ namespace CalamityMod.Tiles.FurnitureAshen public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 100, 100), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.RedTorch, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 100, 100), 1f); return false; } diff --git a/Tiles/FurnitureAuric/ActivatedAuricPanelTile.cs b/Tiles/FurnitureAuric/ActivatedAuricPanelTile.cs new file mode 100644 index 0000000000..c3760dc58d --- /dev/null +++ b/Tiles/FurnitureAuric/ActivatedAuricPanelTile.cs @@ -0,0 +1,63 @@ + +using CalamityMod.Tiles.Ores; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureAuric +{ + public class ActivatedAuricPanelTile : ModTile + { + internal static Texture2D GlowTexture; + public override void SetStaticDefaults() + { + if (!Main.dedServ) + GlowTexture = ModContent.Request("CalamityMod/Tiles/FurnitureAuric/ActivatedAuricPanelTile_Glow", AssetRequestMode.ImmediateLoad).Value; + Main.tileSolid[Type] = true; + Main.tileBlockLight[Type] = true; + HitSound = AuricOre.MineSound; + MineResist = 3f; + AddMapEntry(new Color(123, 205, 237)); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Pixie, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Electric, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + int xPos = Main.tile[i, j].TileFrameX; + int yPos = Main.tile[i, j].TileFrameY; + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; + Color drawColour = GetDrawColour(i, j, Color.White); + Tile trackTile = Main.tile[i, j]; + double num6 = Main.time * 0.08; + + TileFraming.SlopedGlowmask(i, j, 0, GlowTexture, drawOffset, null, GetDrawColour(i, j, drawColour), default); + } + + private Color GetDrawColour(int i, int j, Color colour) + { + int colType = Main.tile[i, j].TileColor; + Color paintCol = WorldGen.paintColor(colType); + if (colType >= 13 && colType <= 24) + { + colour.R = (byte)(paintCol.R / 255f * colour.R); + colour.G = (byte)(paintCol.G / 255f * colour.G); + colour.B = (byte)(paintCol.B / 255f * colour.B); + } + return colour; + } + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + return TileFraming.BetterGemsparkFraming(i, j, resetFrame); + } + } +} diff --git a/Tiles/FurnitureAuric/ActivatedAuricPanelTile.png b/Tiles/FurnitureAuric/ActivatedAuricPanelTile.png new file mode 100644 index 0000000000..0f439dd053 Binary files /dev/null and b/Tiles/FurnitureAuric/ActivatedAuricPanelTile.png differ diff --git a/Tiles/FurnitureAuric/ActivatedAuricPanelTile_Glow.png b/Tiles/FurnitureAuric/ActivatedAuricPanelTile_Glow.png new file mode 100644 index 0000000000..47041e9aa6 Binary files /dev/null and b/Tiles/FurnitureAuric/ActivatedAuricPanelTile_Glow.png differ diff --git a/Tiles/FurnitureAuric/AuricAbsorberTile.cs b/Tiles/FurnitureAuric/AuricAbsorberTile.cs new file mode 100644 index 0000000000..ee6815d636 --- /dev/null +++ b/Tiles/FurnitureAuric/AuricAbsorberTile.cs @@ -0,0 +1,54 @@ + +using CalamityMod.Tiles.Ores; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureAuric +{ + public class AuricAbsorberTile : ModTile + { + public override void SetStaticDefaults() + { + Main.tileSolid[Type] = true; + Main.tileBlockLight[Type] = true; + HitSound = SoundID.NPCHit34; + AddMapEntry(new Color(192, 237, 255)); + DustType = DustID.Electric; + } + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + int xPos = Main.tile[i, j].TileFrameX; + int yPos = Main.tile[i, j].TileFrameY; + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; + Color drawColour = GetDrawColour(i, j, Color.White); + Tile trackTile = Main.tile[i, j]; + double num6 = Main.time * 0.08; + + TileFraming.SlopedGlowmask(i, j, 0, TextureAssets.Tile[Type].Value, drawOffset, null, GetDrawColour(i, j, drawColour), default); + } + + private Color GetDrawColour(int i, int j, Color colour) + { + int colType = Main.tile[i, j].TileColor; + Color paintCol = WorldGen.paintColor(colType); + if (colType >= 13 && colType <= 24) + { + colour.R = (byte)(paintCol.R / 255f * colour.R); + colour.G = (byte)(paintCol.G / 255f * colour.G); + colour.B = (byte)(paintCol.B / 255f * colour.B); + } + return colour; + } + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + return TileFraming.BetterGemsparkFraming(i, j, resetFrame); + } + } +} diff --git a/Tiles/FurnitureAuric/AuricAbsorberTile.png b/Tiles/FurnitureAuric/AuricAbsorberTile.png new file mode 100644 index 0000000000..b9d54e1802 Binary files /dev/null and b/Tiles/FurnitureAuric/AuricAbsorberTile.png differ diff --git a/Tiles/FurnitureAuric/AuricConsoleTile.cs b/Tiles/FurnitureAuric/AuricConsoleTile.cs new file mode 100644 index 0000000000..e991ae4be9 --- /dev/null +++ b/Tiles/FurnitureAuric/AuricConsoleTile.cs @@ -0,0 +1,66 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Enums; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.FurnitureAuric +{ + public class AuricConsoleTile : ModTile + { + public override void SetStaticDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileLavaDeath[Type] = false; + Main.tileWaterDeath[Type] = false; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2xX); + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.CoordinateHeights = new[] { 16, 16, 16 }; + TileObjectData.newTile.StyleWrapLimit = 2; + TileObjectData.newTile.StyleMultiplier = 2; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.LavaDeath = false; + + TileObjectData.newTile.Direction = TileObjectDirection.PlaceRight; + + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.addAlternate(1); + + TileObjectData.addTile(Type); + AddMapEntry(new Color(178, 184, 2), CalamityUtils.GetText("Tiles.Console")); + } + + public override bool CanExplode(int i, int j) => false; + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.TheDestroyer); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + int xFrameOffset = Main.tile[i, j].TileFrameX; + int yFrameOffset = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureAuric/AuricConsoleTile_Glow").Value; + Vector2 drawOffest = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 drawPosition = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + drawOffest; + Color drawColour = Color.White; + Tile trackTile = Main.tile[i, j]; + if (!trackTile.IsHalfBlock && trackTile.Slope == 0) + spriteBatch.Draw(glowmask, drawPosition, new Rectangle(xFrameOffset, yFrameOffset, 18, 18), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + else if (trackTile.IsHalfBlock) + spriteBatch.Draw(glowmask, drawPosition + new Vector2(0f, 8f), new Rectangle(xFrameOffset, yFrameOffset, 18, 8), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + } + } +} diff --git a/Tiles/FurnitureAuric/AuricConsoleTile.png b/Tiles/FurnitureAuric/AuricConsoleTile.png new file mode 100644 index 0000000000..4b50439344 Binary files /dev/null and b/Tiles/FurnitureAuric/AuricConsoleTile.png differ diff --git a/Tiles/FurnitureAuric/AuricConsoleTile_Glow.png b/Tiles/FurnitureAuric/AuricConsoleTile_Glow.png new file mode 100644 index 0000000000..9c42b0e00a Binary files /dev/null and b/Tiles/FurnitureAuric/AuricConsoleTile_Glow.png differ diff --git a/Tiles/FurnitureAuric/AuricDisplayTile.cs b/Tiles/FurnitureAuric/AuricDisplayTile.cs new file mode 100644 index 0000000000..857f4a8a8c --- /dev/null +++ b/Tiles/FurnitureAuric/AuricDisplayTile.cs @@ -0,0 +1,70 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.FurnitureAuric +{ + public class AuricDisplayTile : ModTile + { + public override void SetStaticDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileLavaDeath[Type] = false; + Main.tileWaterDeath[Type] = false; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.newTile.Width = 4; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(0, 2); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.StyleWrapLimit = 2; + TileObjectData.newTile.StyleMultiplier = 2; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.LavaDeath = false; + + TileObjectData.newTile.Direction = TileObjectDirection.PlaceRight; + + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.addAlternate(1); + + TileObjectData.addTile(Type); + AddMapEntry(Color.Gold, CalamityUtils.GetText("Tiles.Display")); + } + + public override bool CanExplode(int i, int j) => false; + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.TheDestroyer); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + int xFrameOffset = Main.tile[i, j].TileFrameX; + int yFrameOffset = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureAuric/AuricDisplayTile_Glow").Value; + Vector2 drawOffest = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 drawPosition = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + drawOffest; + Color drawColour = Color.White; + Tile trackTile = Main.tile[i, j]; + if (!trackTile.IsHalfBlock && trackTile.Slope == 0) + spriteBatch.Draw(glowmask, drawPosition, new Rectangle(xFrameOffset, yFrameOffset, 18, 18), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + else if (trackTile.IsHalfBlock) + spriteBatch.Draw(glowmask, drawPosition + new Vector2(0f, 8f), new Rectangle(xFrameOffset, yFrameOffset, 18, 8), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + } + } +} diff --git a/Tiles/FurnitureAuric/AuricDisplayTile.png b/Tiles/FurnitureAuric/AuricDisplayTile.png new file mode 100644 index 0000000000..0e22385e1c Binary files /dev/null and b/Tiles/FurnitureAuric/AuricDisplayTile.png differ diff --git a/Tiles/FurnitureAuric/AuricDisplayTile_Glow.png b/Tiles/FurnitureAuric/AuricDisplayTile_Glow.png new file mode 100644 index 0000000000..c13203902f Binary files /dev/null and b/Tiles/FurnitureAuric/AuricDisplayTile_Glow.png differ diff --git a/Tiles/FurnitureAuric/AuricPanelTile.cs b/Tiles/FurnitureAuric/AuricPanelTile.cs new file mode 100644 index 0000000000..dcf38dc450 --- /dev/null +++ b/Tiles/FurnitureAuric/AuricPanelTile.cs @@ -0,0 +1,27 @@ + +using CalamityMod.Tiles.Ores; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureAuric +{ + public class AuricPanelTile : ModTile + { + public override void SetStaticDefaults() + { + Main.tileSolid[Type] = true; + Main.tileBlockLight[Type] = true; + HitSound = AuricOre.MineSound; + MineResist = 3f; + DustType = 55; + AddMapEntry(new Color(213, 138, 69)); + } + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + return TileFraming.BetterGemsparkFraming(i, j, resetFrame); + } + } +} diff --git a/Tiles/FurnitureAuric/AuricPanelTile.png b/Tiles/FurnitureAuric/AuricPanelTile.png new file mode 100644 index 0000000000..001f78935a Binary files /dev/null and b/Tiles/FurnitureAuric/AuricPanelTile.png differ diff --git a/Tiles/FurnitureAuric/AuricPlatformTile.cs b/Tiles/FurnitureAuric/AuricPlatformTile.cs new file mode 100644 index 0000000000..8e47dbe7b8 --- /dev/null +++ b/Tiles/FurnitureAuric/AuricPlatformTile.cs @@ -0,0 +1,63 @@ +using CalamityMod.Items.Placeables.FurnitureAuric; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureAuric +{ + public class AuricPlatformTile : ModTile + { + internal static Texture2D GlowTexture; + public override void SetStaticDefaults() + { + if (!Main.dedServ) + { + GlowTexture = ModContent.Request("CalamityMod/Tiles/FurnitureAuric/AuricPlatformTile_Glow", AssetRequestMode.ImmediateLoad).Value; + } + this.SetUpPlatform(ModContent.ItemType(), true); + } + + public override bool CanExplode(int i, int j) => false; + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Pixie, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void PostSetDefaults() + { + Main.tileNoSunLight[Type] = false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + // If the cached textures don't exist for some reason, don't bother using them. + if (GlowTexture is null) + return; + + Tile tile = CalamityUtils.ParanoidTileRetrieval(i, j); + int xPos = tile.TileFrameX; + int yPos = tile.TileFrameY; + Vector2 drawOffset = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 drawPosition = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + drawOffset; + + if (!tile.IsHalfBlock) + { + spriteBatch.Draw(GlowTexture, drawPosition, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + } + else if (tile.IsHalfBlock) + { + spriteBatch.Draw(GlowTexture, drawPosition + new Vector2(0f, 8f), new Rectangle?(new Rectangle(xPos, yPos, 18, 8)), Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + } + } + } +} diff --git a/Tiles/FurnitureAuric/AuricPlatformTile.png b/Tiles/FurnitureAuric/AuricPlatformTile.png new file mode 100644 index 0000000000..1919469dd4 Binary files /dev/null and b/Tiles/FurnitureAuric/AuricPlatformTile.png differ diff --git a/Tiles/FurnitureAuric/AuricPlatformTile_Glow.png b/Tiles/FurnitureAuric/AuricPlatformTile_Glow.png new file mode 100644 index 0000000000..0e5e790503 Binary files /dev/null and b/Tiles/FurnitureAuric/AuricPlatformTile_Glow.png differ diff --git a/Tiles/FurnitureAuric/AuricReinforcedCrateTile.cs b/Tiles/FurnitureAuric/AuricReinforcedCrateTile.cs new file mode 100644 index 0000000000..5c8fa7fa53 --- /dev/null +++ b/Tiles/FurnitureAuric/AuricReinforcedCrateTile.cs @@ -0,0 +1,54 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.FurnitureAuric +{ + public class AuricReinforcedCrateTile : ModTile + { + public override void SetStaticDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileLavaDeath[Type] = false; + Main.tileWaterDeath[Type] = false; + Main.tileSolidTop[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.newTile.LavaDeath = false; + TileObjectData.addTile(Type); + AddMapEntry(Color.Goldenrod, CalamityUtils.GetText("Tiles.ReinforcedCrate")); + } + + public override bool CanExplode(int i, int j) => false; + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.TheDestroyer); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + int xFrameOffset = Main.tile[i, j].TileFrameX; + int yFrameOffset = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureAuric/AuricReinforcedCrateTile_Glow").Value; + Vector2 drawOffest = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 drawPosition = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + drawOffest; + Color drawColour = Color.White; + Tile trackTile = Main.tile[i, j]; + if (!trackTile.IsHalfBlock && trackTile.Slope == 0) + spriteBatch.Draw(glowmask, drawPosition, new Rectangle(xFrameOffset, yFrameOffset, 18, 18), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + else if (trackTile.IsHalfBlock) + spriteBatch.Draw(glowmask, drawPosition + new Vector2(0f, 8f), new Rectangle(xFrameOffset, yFrameOffset, 18, 8), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + } + } +} diff --git a/Tiles/FurnitureAuric/AuricReinforcedCrateTile.png b/Tiles/FurnitureAuric/AuricReinforcedCrateTile.png new file mode 100644 index 0000000000..33b69724a7 Binary files /dev/null and b/Tiles/FurnitureAuric/AuricReinforcedCrateTile.png differ diff --git a/Tiles/FurnitureAuric/AuricReinforcedCrateTile_Glow.png b/Tiles/FurnitureAuric/AuricReinforcedCrateTile_Glow.png new file mode 100644 index 0000000000..7984b8b9d4 Binary files /dev/null and b/Tiles/FurnitureAuric/AuricReinforcedCrateTile_Glow.png differ diff --git a/Tiles/FurnitureAuric/AuricRepulserPanelTile.cs b/Tiles/FurnitureAuric/AuricRepulserPanelTile.cs new file mode 100644 index 0000000000..dbb63a3324 --- /dev/null +++ b/Tiles/FurnitureAuric/AuricRepulserPanelTile.cs @@ -0,0 +1,63 @@ + +using CalamityMod.Tiles.Ores; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureAuric +{ + public class AuricRepulserPanelTile : ModTile + { + internal static Texture2D GlowTexture; + public override void SetStaticDefaults() + { + if (!Main.dedServ) + GlowTexture = ModContent.Request("CalamityMod/Tiles/FurnitureAuric/AuricRepulserPanelTile_Glow", AssetRequestMode.ImmediateLoad).Value; + Main.tileSolid[Type] = true; + Main.tileBlockLight[Type] = true; + HitSound = AuricOre.MineSound; + MineResist = 3f; + AddMapEntry(new Color(225, 208, 125)); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Pixie, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Electric, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + int xPos = Main.tile[i, j].TileFrameX; + int yPos = Main.tile[i, j].TileFrameY; + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; + Color drawColour = GetDrawColour(i, j, Color.White); + Tile trackTile = Main.tile[i, j]; + double num6 = Main.time * 0.08; + + TileFraming.SlopedGlowmask(i, j, 0, GlowTexture, drawOffset, null, GetDrawColour(i, j, drawColour), default); + } + + private Color GetDrawColour(int i, int j, Color colour) + { + int colType = Main.tile[i, j].TileColor; + Color paintCol = WorldGen.paintColor(colType); + if (colType >= 13 && colType <= 24) + { + colour.R = (byte)(paintCol.R / 255f * colour.R); + colour.G = (byte)(paintCol.G / 255f * colour.G); + colour.B = (byte)(paintCol.B / 255f * colour.B); + } + return colour; + } + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + return TileFraming.BetterGemsparkFraming(i, j, resetFrame); + } + } +} diff --git a/Tiles/FurnitureAuric/AuricRepulserPanelTile.png b/Tiles/FurnitureAuric/AuricRepulserPanelTile.png new file mode 100644 index 0000000000..2534022b98 Binary files /dev/null and b/Tiles/FurnitureAuric/AuricRepulserPanelTile.png differ diff --git a/Tiles/FurnitureAuric/AuricRepulserPanelTile_Glow.png b/Tiles/FurnitureAuric/AuricRepulserPanelTile_Glow.png new file mode 100644 index 0000000000..9ab03c7e74 Binary files /dev/null and b/Tiles/FurnitureAuric/AuricRepulserPanelTile_Glow.png differ diff --git a/Tiles/FurnitureAuric/AuricScreenTile.cs b/Tiles/FurnitureAuric/AuricScreenTile.cs new file mode 100644 index 0000000000..612876ee9e --- /dev/null +++ b/Tiles/FurnitureAuric/AuricScreenTile.cs @@ -0,0 +1,50 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.FurnitureAuric +{ + public class AuricScreenTile : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = false; + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3Wall); + TileObjectData.newTile.Width = 4; + TileObjectData.newTile.Height = 2; + TileObjectData.newTile.CoordinateHeights = new[] { 16, 16 }; + TileObjectData.newTile.LavaDeath = false; + TileObjectData.addTile(Type); + + AddMapEntry(Color.Goldenrod, CalamityUtils.GetText("Tiles.Screen")); + TileID.Sets.FramesOnKillWall[Type] = true; + DustType = 8; + } + + public override bool CanExplode(int i, int j) => false; + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + int xFrameOffset = Main.tile[i, j].TileFrameX; + int yFrameOffset = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureAuric/AuricScreenTile_Glow").Value; + Vector2 drawOffest = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 drawPosition = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + drawOffest; + Color drawColour = Color.White; + Tile trackTile = Main.tile[i, j]; + if (!trackTile.IsHalfBlock && trackTile.Slope == 0) + spriteBatch.Draw(glowmask, drawPosition, new Rectangle(xFrameOffset, yFrameOffset, 18, 18), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + else if (trackTile.IsHalfBlock) + spriteBatch.Draw(glowmask, drawPosition + new Vector2(0f, 8f), new Rectangle(xFrameOffset, yFrameOffset, 18, 8), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + } + } +} diff --git a/Tiles/FurnitureAuric/AuricScreenTile.png b/Tiles/FurnitureAuric/AuricScreenTile.png new file mode 100644 index 0000000000..8a301fb33b Binary files /dev/null and b/Tiles/FurnitureAuric/AuricScreenTile.png differ diff --git a/Tiles/FurnitureAuric/AuricScreenTile_Glow.png b/Tiles/FurnitureAuric/AuricScreenTile_Glow.png new file mode 100644 index 0000000000..aa90abe5ba Binary files /dev/null and b/Tiles/FurnitureAuric/AuricScreenTile_Glow.png differ diff --git a/Tiles/FurnitureAuric/AuricServerTile.cs b/Tiles/FurnitureAuric/AuricServerTile.cs new file mode 100644 index 0000000000..1574f7ed8c --- /dev/null +++ b/Tiles/FurnitureAuric/AuricServerTile.cs @@ -0,0 +1,69 @@ +using CalamityMod.Items.Placeables.DraedonStructures; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.FurnitureAuric +{ + public class AuricServerTile : ModTile + { + public override void SetStaticDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileLavaDeath[Type] = false; + Main.tileWaterDeath[Type] = false; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2xX); + TileObjectData.newTile.Height = 4; + TileObjectData.newTile.CoordinateHeights = new[] { 16, 16, 16, 16 }; + TileObjectData.newTile.StyleWrapLimit = 2; + TileObjectData.newTile.StyleMultiplier = 2; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.LavaDeath = false; + + TileObjectData.newTile.Direction = TileObjectDirection.PlaceRight; + + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.addAlternate(1); + + TileObjectData.addTile(Type); + AddMapEntry(new Color(178, 184, 2), CalamityUtils.GetText("Tiles.Server")); + } + + public override bool CanExplode(int i, int j) => false; + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.TheDestroyer); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + int xFrameOffset = Main.tile[i, j].TileFrameX; + int yFrameOffset = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureAuric/AuricServerTile_Glow").Value; + Vector2 drawOffest = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 drawPosition = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + drawOffest; + Color drawColour = Color.White; + Tile trackTile = Main.tile[i, j]; + if (!trackTile.IsHalfBlock && trackTile.Slope == 0) + spriteBatch.Draw(glowmask, drawPosition, new Rectangle(xFrameOffset, yFrameOffset, 18, 18), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + else if (trackTile.IsHalfBlock) + spriteBatch.Draw(glowmask, drawPosition + new Vector2(0f, 8f), new Rectangle(xFrameOffset, yFrameOffset, 18, 8), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + } + } +} diff --git a/Tiles/FurnitureAuric/AuricServerTile.png b/Tiles/FurnitureAuric/AuricServerTile.png new file mode 100644 index 0000000000..f71044b1ee Binary files /dev/null and b/Tiles/FurnitureAuric/AuricServerTile.png differ diff --git a/Tiles/FurnitureAuric/AuricServerTile_Glow.png b/Tiles/FurnitureAuric/AuricServerTile_Glow.png new file mode 100644 index 0000000000..5526e8cb9b Binary files /dev/null and b/Tiles/FurnitureAuric/AuricServerTile_Glow.png differ diff --git a/Tiles/FurnitureAuric/AuricTerminalTile.cs b/Tiles/FurnitureAuric/AuricTerminalTile.cs new file mode 100644 index 0000000000..081c67e195 --- /dev/null +++ b/Tiles/FurnitureAuric/AuricTerminalTile.cs @@ -0,0 +1,70 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.FurnitureAuric +{ + public class AuricTerminalTile : ModTile + { + public override void SetStaticDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileLavaDeath[Type] = false; + Main.tileWaterDeath[Type] = false; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.newTile.Width = 4; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(0, 2); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.StyleWrapLimit = 2; + TileObjectData.newTile.StyleMultiplier = 2; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.LavaDeath = false; + + TileObjectData.newTile.Direction = TileObjectDirection.PlaceRight; + + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.addAlternate(1); + + TileObjectData.addTile(Type); + AddMapEntry(Color.Goldenrod, CalamityUtils.GetText("Tiles.Terminal")); + } + + public override bool CanExplode(int i, int j) => false; + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.TheDestroyer); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + int xFrameOffset = Main.tile[i, j].TileFrameX; + int yFrameOffset = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureAuric/AuricTerminalTile_Glow").Value; + Vector2 drawOffest = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 drawPosition = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + drawOffest; + Color drawColour = Color.White; + Tile trackTile = Main.tile[i, j]; + if (!trackTile.IsHalfBlock && trackTile.Slope == 0) + spriteBatch.Draw(glowmask, drawPosition, new Rectangle(xFrameOffset, yFrameOffset, 18, 18), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + else if (trackTile.IsHalfBlock) + spriteBatch.Draw(glowmask, drawPosition + new Vector2(0f, 8f), new Rectangle(xFrameOffset, yFrameOffset, 18, 8), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + } + } +} diff --git a/Tiles/FurnitureAuric/AuricTerminalTile.png b/Tiles/FurnitureAuric/AuricTerminalTile.png new file mode 100644 index 0000000000..195f671948 Binary files /dev/null and b/Tiles/FurnitureAuric/AuricTerminalTile.png differ diff --git a/Tiles/FurnitureAuric/AuricTerminalTile_Glow.png b/Tiles/FurnitureAuric/AuricTerminalTile_Glow.png new file mode 100644 index 0000000000..bc85a7cf7e Binary files /dev/null and b/Tiles/FurnitureAuric/AuricTerminalTile_Glow.png differ diff --git a/Tiles/Furniture/AuricToiletTile.cs b/Tiles/FurnitureAuric/AuricToiletTile.cs similarity index 96% rename from Tiles/Furniture/AuricToiletTile.cs rename to Tiles/FurnitureAuric/AuricToiletTile.cs index de35c50836..ae3b55fbfb 100644 --- a/Tiles/Furniture/AuricToiletTile.cs +++ b/Tiles/FurnitureAuric/AuricToiletTile.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Placeables.Furniture; +using CalamityMod.Items.Placeables.FurnitureAuric; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -8,7 +8,7 @@ using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; -namespace CalamityMod.Tiles.Furniture +namespace CalamityMod.Tiles.FurnitureAuric { public class AuricToiletTile : ModTile { diff --git a/Tiles/Furniture/AuricToiletTile.png b/Tiles/FurnitureAuric/AuricToiletTile.png similarity index 100% rename from Tiles/Furniture/AuricToiletTile.png rename to Tiles/FurnitureAuric/AuricToiletTile.png diff --git a/Tiles/FurnitureAuric/ExoAuricPanelTile.cs b/Tiles/FurnitureAuric/ExoAuricPanelTile.cs new file mode 100644 index 0000000000..d476966b73 --- /dev/null +++ b/Tiles/FurnitureAuric/ExoAuricPanelTile.cs @@ -0,0 +1,63 @@ + +using CalamityMod.Tiles.Ores; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureAuric +{ + public class ExoAuricPanelTile : ModTile + { + internal static Texture2D GlowTexture; + public override void SetStaticDefaults() + { + if (!Main.dedServ) + GlowTexture = ModContent.Request("CalamityMod/Tiles/FurnitureAuric/ExoAuricPanelTile_Glow", AssetRequestMode.ImmediateLoad).Value; + Main.tileSolid[Type] = true; + Main.tileBlockLight[Type] = true; + HitSound = AuricOre.MineSound; + MineResist = 3f; + AddMapEntry(new Color(166, 96, 64)); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Pixie, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.TerraBlade, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + int xPos = Main.tile[i, j].TileFrameX; + int yPos = Main.tile[i, j].TileFrameY; + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; + Color drawColour = GetDrawColour(i, j, Color.White); + Tile trackTile = Main.tile[i, j]; + double num6 = Main.time * 0.08; + + TileFraming.SlopedGlowmask(i, j, 0, GlowTexture, drawOffset, null, GetDrawColour(i, j, drawColour), default); + } + + private Color GetDrawColour(int i, int j, Color colour) + { + int colType = Main.tile[i, j].TileColor; + Color paintCol = WorldGen.paintColor(colType); + if (colType >= 13 && colType <= 24) + { + colour.R = (byte)(paintCol.R / 255f * colour.R); + colour.G = (byte)(paintCol.G / 255f * colour.G); + colour.B = (byte)(paintCol.B / 255f * colour.B); + } + return colour; + } + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + return TileFraming.BetterGemsparkFraming(i, j, resetFrame); + } + } +} diff --git a/Tiles/FurnitureAuric/ExoAuricPanelTile.png b/Tiles/FurnitureAuric/ExoAuricPanelTile.png new file mode 100644 index 0000000000..7ca469feb5 Binary files /dev/null and b/Tiles/FurnitureAuric/ExoAuricPanelTile.png differ diff --git a/Tiles/FurnitureAuric/ExoAuricPanelTile_Glow.png b/Tiles/FurnitureAuric/ExoAuricPanelTile_Glow.png new file mode 100644 index 0000000000..361cf608f6 Binary files /dev/null and b/Tiles/FurnitureAuric/ExoAuricPanelTile_Glow.png differ diff --git a/Tiles/FurnitureCosmilite/CosmiliteBasinTile.cs b/Tiles/FurnitureCosmilite/CosmiliteBasinTile.cs index b272cc35fe..04fd20ab45 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteBasinTile.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteBasinTile.cs @@ -32,8 +32,8 @@ namespace CalamityMod.Tiles.FurnitureCosmilite public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 132, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 134, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Firework_Blue, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Firework_Pink, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureCosmilite/CosmiliteBathtub.cs b/Tiles/FurnitureCosmilite/CosmiliteBathtub.cs index 808c151ac0..1bfa1797c2 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteBathtub.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteBathtub.cs @@ -1,6 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Tiles.FurnitureCosmilite { public class CosmiliteBathtub : ModTile @@ -9,8 +11,8 @@ namespace CalamityMod.Tiles.FurnitureCosmilite public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 132, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 134, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Firework_Blue, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Firework_Pink, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureCosmilite/CosmiliteBed.cs b/Tiles/FurnitureCosmilite/CosmiliteBed.cs index 1b4140d07f..efc2614562 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteBed.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteBed.cs @@ -1,6 +1,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureCosmilite @@ -11,8 +12,8 @@ namespace CalamityMod.Tiles.FurnitureCosmilite public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 132, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 134, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Firework_Blue, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Firework_Pink, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureCosmilite/CosmiliteBookcase.cs b/Tiles/FurnitureCosmilite/CosmiliteBookcase.cs index 2e330dfcea..d255349eb5 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteBookcase.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteBookcase.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureCosmilite @@ -10,8 +11,8 @@ namespace CalamityMod.Tiles.FurnitureCosmilite public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 132, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 134, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Firework_Blue, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Firework_Pink, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureCosmilite/CosmiliteBrick.cs b/Tiles/FurnitureCosmilite/CosmiliteBrick.cs index ee637807cc..ab0dd55000 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteBrick.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteBrick.cs @@ -2,8 +2,8 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureCosmilite { @@ -20,8 +20,8 @@ namespace CalamityMod.Tiles.FurnitureCosmilite public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 132, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 134, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Firework_Blue, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Firework_Pink, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureCosmilite/CosmiliteCandelabra.cs b/Tiles/FurnitureCosmilite/CosmiliteCandelabra.cs index 8dcc0379cb..924cb15c1f 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteCandelabra.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteCandelabra.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureCosmilite @@ -10,8 +11,8 @@ namespace CalamityMod.Tiles.FurnitureCosmilite public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 132, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 134, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Firework_Blue, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Firework_Pink, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureCosmilite/CosmiliteCandle.cs b/Tiles/FurnitureCosmilite/CosmiliteCandle.cs index b686f85754..51b7cd6d25 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteCandle.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteCandle.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureCosmilite @@ -10,8 +11,8 @@ namespace CalamityMod.Tiles.FurnitureCosmilite public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 132, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 134, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Firework_Blue, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Firework_Pink, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureCosmilite/CosmiliteChair.cs b/Tiles/FurnitureCosmilite/CosmiliteChair.cs index 9c75614e24..6bcbb2bbb7 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteChair.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteChair.cs @@ -3,6 +3,7 @@ using Terraria; using Terraria.DataStructures; using Terraria.GameContent; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureCosmilite @@ -13,8 +14,8 @@ namespace CalamityMod.Tiles.FurnitureCosmilite public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 132, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 134, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Firework_Blue, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Firework_Pink, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureCosmilite/CosmiliteChandelier.cs b/Tiles/FurnitureCosmilite/CosmiliteChandelier.cs index 2728488ebd..936a449250 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteChandelier.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteChandelier.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureCosmilite @@ -10,8 +11,8 @@ namespace CalamityMod.Tiles.FurnitureCosmilite public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 132, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 134, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Firework_Blue, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Firework_Pink, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureCosmilite/CosmiliteChest.cs b/Tiles/FurnitureCosmilite/CosmiliteChest.cs index f1d770ceac..53f67928d7 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteChest.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteChest.cs @@ -1,6 +1,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -16,8 +17,8 @@ namespace CalamityMod.Tiles.FurnitureCosmilite public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 132, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 134, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Firework_Blue, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Firework_Pink, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; diff --git a/Tiles/FurnitureCosmilite/CosmiliteClock.cs b/Tiles/FurnitureCosmilite/CosmiliteClock.cs index 3327c24e0c..96c705f6a1 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteClock.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteClock.cs @@ -1,6 +1,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureCosmilite @@ -13,8 +14,8 @@ namespace CalamityMod.Tiles.FurnitureCosmilite public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 132, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 134, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Firework_Blue, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Firework_Pink, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureCosmilite/CosmiliteDoorClosed.cs b/Tiles/FurnitureCosmilite/CosmiliteDoorClosed.cs index 2ffaf8dea9..3e0cca0f06 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteDoorClosed.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteDoorClosed.cs @@ -16,8 +16,8 @@ namespace CalamityMod.Tiles.FurnitureCosmilite public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 132, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 134, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Firework_Blue, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Firework_Pink, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureCosmilite/CosmiliteDoorOpen.cs b/Tiles/FurnitureCosmilite/CosmiliteDoorOpen.cs index ba3f250b3b..5a2cda79f5 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteDoorOpen.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteDoorOpen.cs @@ -17,8 +17,8 @@ namespace CalamityMod.Tiles.FurnitureCosmilite public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 132, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 134, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Firework_Blue, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Firework_Pink, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureCosmilite/CosmiliteDresser.cs b/Tiles/FurnitureCosmilite/CosmiliteDresser.cs index 7e31d243a9..6b86705538 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteDresser.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteDresser.cs @@ -1,6 +1,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -16,8 +17,8 @@ namespace CalamityMod.Tiles.FurnitureCosmilite public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 132, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 134, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Firework_Blue, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Firework_Pink, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; diff --git a/Tiles/FurnitureCosmilite/CosmiliteLamp.cs b/Tiles/FurnitureCosmilite/CosmiliteLamp.cs index c5fe1075e7..1ee78c2f63 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteLamp.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteLamp.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureCosmilite @@ -10,8 +11,8 @@ namespace CalamityMod.Tiles.FurnitureCosmilite public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 132, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 134, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Firework_Blue, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Firework_Pink, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureCosmilite/CosmiliteLantern.cs b/Tiles/FurnitureCosmilite/CosmiliteLantern.cs index 8bb0c90656..de5f0a9f36 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteLantern.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteLantern.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureCosmilite @@ -11,8 +12,8 @@ namespace CalamityMod.Tiles.FurnitureCosmilite public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 132, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 134, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Firework_Blue, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Firework_Pink, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureCosmilite/CosmilitePiano.cs b/Tiles/FurnitureCosmilite/CosmilitePiano.cs index 8ca86a943f..6460fb9eec 100644 --- a/Tiles/FurnitureCosmilite/CosmilitePiano.cs +++ b/Tiles/FurnitureCosmilite/CosmilitePiano.cs @@ -1,6 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Tiles.FurnitureCosmilite { public class CosmilitePiano : ModTile @@ -9,8 +11,8 @@ namespace CalamityMod.Tiles.FurnitureCosmilite public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 132, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 134, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Firework_Blue, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Firework_Pink, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureCosmilite/CosmilitePlatform.cs b/Tiles/FurnitureCosmilite/CosmilitePlatform.cs index 3202a57591..3f0a9786d5 100644 --- a/Tiles/FurnitureCosmilite/CosmilitePlatform.cs +++ b/Tiles/FurnitureCosmilite/CosmilitePlatform.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureCosmilite @@ -10,8 +11,8 @@ namespace CalamityMod.Tiles.FurnitureCosmilite public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 132, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 134, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Firework_Blue, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Firework_Pink, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureCosmilite/CosmiliteSconce.cs b/Tiles/FurnitureCosmilite/CosmiliteSconce.cs index bc6090a3e9..4ccadc8a41 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteSconce.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteSconce.cs @@ -36,8 +36,8 @@ namespace CalamityMod.Tiles.FurnitureCosmilite public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 132, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 134, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Firework_Blue, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Firework_Pink, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureCosmilite/CosmiliteSink.cs b/Tiles/FurnitureCosmilite/CosmiliteSink.cs index 05ba5da4f5..545bcd5aab 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteSink.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteSink.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureCosmilite @@ -10,8 +11,8 @@ namespace CalamityMod.Tiles.FurnitureCosmilite public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 132, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 134, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Firework_Blue, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Firework_Pink, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureCosmilite/CosmiliteSofa.cs b/Tiles/FurnitureCosmilite/CosmiliteSofa.cs index c6eac65f7b..30f363ed8c 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteSofa.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteSofa.cs @@ -3,7 +3,9 @@ using Terraria; using Terraria.DataStructures; using Terraria.GameContent; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Tiles.FurnitureCosmilite { public class CosmiliteSofa : ModTile @@ -12,8 +14,8 @@ namespace CalamityMod.Tiles.FurnitureCosmilite public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 132, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 134, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Firework_Blue, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Firework_Pink, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureCosmilite/CosmiliteTable.cs b/Tiles/FurnitureCosmilite/CosmiliteTable.cs index 7989857b64..9aa4ec254d 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteTable.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteTable.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureCosmilite @@ -10,8 +11,8 @@ namespace CalamityMod.Tiles.FurnitureCosmilite public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 132, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 134, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Firework_Blue, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Firework_Pink, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureCosmilite/CosmiliteWorkBench.cs b/Tiles/FurnitureCosmilite/CosmiliteWorkBench.cs index 14696a6a5e..0edcd8388f 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteWorkBench.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteWorkBench.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureCosmilite @@ -11,8 +12,8 @@ namespace CalamityMod.Tiles.FurnitureCosmilite public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 132, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 134, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Firework_Blue, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Firework_Pink, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureEutrophic/EutrophicBathtub.cs b/Tiles/FurnitureEutrophic/EutrophicBathtub.cs index b612289fe9..85dcf8c046 100644 --- a/Tiles/FurnitureEutrophic/EutrophicBathtub.cs +++ b/Tiles/FurnitureEutrophic/EutrophicBathtub.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureEutrophic @@ -10,7 +11,7 @@ namespace CalamityMod.Tiles.FurnitureEutrophic public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 51, 0f, 0f, 1, new Color(54, 69, 72), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.SnowBlock, 0f, 0f, 1, new Color(54, 69, 72), 1f); return false; } diff --git a/Tiles/FurnitureEutrophic/EutrophicBed.cs b/Tiles/FurnitureEutrophic/EutrophicBed.cs index 9ae4168d5a..5dd7734de4 100644 --- a/Tiles/FurnitureEutrophic/EutrophicBed.cs +++ b/Tiles/FurnitureEutrophic/EutrophicBed.cs @@ -1,6 +1,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureEutrophic @@ -11,7 +12,7 @@ namespace CalamityMod.Tiles.FurnitureEutrophic public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 51, 0f, 0f, 1, new Color(54, 69, 72), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.SnowBlock, 0f, 0f, 1, new Color(54, 69, 72), 1f); return false; } diff --git a/Tiles/FurnitureEutrophic/EutrophicBench.cs b/Tiles/FurnitureEutrophic/EutrophicBench.cs index a5b20d3ba1..876e7ec38c 100644 --- a/Tiles/FurnitureEutrophic/EutrophicBench.cs +++ b/Tiles/FurnitureEutrophic/EutrophicBench.cs @@ -3,7 +3,9 @@ using Terraria; using Terraria.DataStructures; using Terraria.GameContent; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Tiles.FurnitureEutrophic { public class EutrophicBench : ModTile @@ -12,7 +14,7 @@ namespace CalamityMod.Tiles.FurnitureEutrophic public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 51, 0f, 0f, 1, new Color(54, 69, 72), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.SnowBlock, 0f, 0f, 1, new Color(54, 69, 72), 1f); return false; } diff --git a/Tiles/FurnitureEutrophic/EutrophicBookcase.cs b/Tiles/FurnitureEutrophic/EutrophicBookcase.cs index d029baac69..cadb22b791 100644 --- a/Tiles/FurnitureEutrophic/EutrophicBookcase.cs +++ b/Tiles/FurnitureEutrophic/EutrophicBookcase.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureEutrophic @@ -10,7 +11,7 @@ namespace CalamityMod.Tiles.FurnitureEutrophic public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 51, 0f, 0f, 1, new Color(54, 69, 72), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.SnowBlock, 0f, 0f, 1, new Color(54, 69, 72), 1f); return false; } diff --git a/Tiles/FurnitureEutrophic/EutrophicCandelabra.cs b/Tiles/FurnitureEutrophic/EutrophicCandelabra.cs index c63c74f30d..524b5da0cf 100644 --- a/Tiles/FurnitureEutrophic/EutrophicCandelabra.cs +++ b/Tiles/FurnitureEutrophic/EutrophicCandelabra.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureEutrophic @@ -10,7 +11,7 @@ namespace CalamityMod.Tiles.FurnitureEutrophic public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 51, 0f, 0f, 1, new Color(54, 69, 72), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.SnowBlock, 0f, 0f, 1, new Color(54, 69, 72), 1f); return false; } diff --git a/Tiles/FurnitureEutrophic/EutrophicCandle.cs b/Tiles/FurnitureEutrophic/EutrophicCandle.cs index 9b30ef3d69..1b4f0db715 100644 --- a/Tiles/FurnitureEutrophic/EutrophicCandle.cs +++ b/Tiles/FurnitureEutrophic/EutrophicCandle.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureEutrophic @@ -10,7 +11,7 @@ namespace CalamityMod.Tiles.FurnitureEutrophic public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 51, 0f, 0f, 1, new Color(54, 69, 72), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.SnowBlock, 0f, 0f, 1, new Color(54, 69, 72), 1f); return false; } diff --git a/Tiles/FurnitureEutrophic/EutrophicChair.cs b/Tiles/FurnitureEutrophic/EutrophicChair.cs index a230dccb47..2028c2a9c3 100644 --- a/Tiles/FurnitureEutrophic/EutrophicChair.cs +++ b/Tiles/FurnitureEutrophic/EutrophicChair.cs @@ -3,6 +3,7 @@ using Terraria; using Terraria.DataStructures; using Terraria.GameContent; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureEutrophic @@ -13,7 +14,7 @@ namespace CalamityMod.Tiles.FurnitureEutrophic public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 51, 0f, 0f, 1, new Color(54, 69, 72), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.SnowBlock, 0f, 0f, 1, new Color(54, 69, 72), 1f); return false; } diff --git a/Tiles/FurnitureEutrophic/EutrophicChandelier.cs b/Tiles/FurnitureEutrophic/EutrophicChandelier.cs index 15f502146a..74b2bd8f00 100644 --- a/Tiles/FurnitureEutrophic/EutrophicChandelier.cs +++ b/Tiles/FurnitureEutrophic/EutrophicChandelier.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureEutrophic @@ -10,7 +11,7 @@ namespace CalamityMod.Tiles.FurnitureEutrophic public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 51, 0f, 0f, 1, new Color(54, 69, 72), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.SnowBlock, 0f, 0f, 1, new Color(54, 69, 72), 1f); return false; } diff --git a/Tiles/FurnitureEutrophic/EutrophicChest.cs b/Tiles/FurnitureEutrophic/EutrophicChest.cs index 43585af407..21053e81c1 100644 --- a/Tiles/FurnitureEutrophic/EutrophicChest.cs +++ b/Tiles/FurnitureEutrophic/EutrophicChest.cs @@ -1,6 +1,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -16,7 +17,7 @@ namespace CalamityMod.Tiles.FurnitureEutrophic public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 51, 0f, 0f, 1, new Color(54, 69, 72), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.SnowBlock, 0f, 0f, 1, new Color(54, 69, 72), 1f); return false; } public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; diff --git a/Tiles/FurnitureEutrophic/EutrophicClock.cs b/Tiles/FurnitureEutrophic/EutrophicClock.cs index 0c2dbe33a5..c58bfde6cd 100644 --- a/Tiles/FurnitureEutrophic/EutrophicClock.cs +++ b/Tiles/FurnitureEutrophic/EutrophicClock.cs @@ -1,6 +1,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureEutrophic @@ -13,7 +14,7 @@ namespace CalamityMod.Tiles.FurnitureEutrophic public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 51, 0f, 0f, 1, new Color(54, 69, 72), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.SnowBlock, 0f, 0f, 1, new Color(54, 69, 72), 1f); return false; } diff --git a/Tiles/FurnitureEutrophic/EutrophicDoorClosed.cs b/Tiles/FurnitureEutrophic/EutrophicDoorClosed.cs index c49014de77..3fe3f15c77 100644 --- a/Tiles/FurnitureEutrophic/EutrophicDoorClosed.cs +++ b/Tiles/FurnitureEutrophic/EutrophicDoorClosed.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Tiles.FurnitureEutrophic public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 51, 0f, 0f, 1, new Color(54, 69, 72), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.SnowBlock, 0f, 0f, 1, new Color(54, 69, 72), 1f); return false; } diff --git a/Tiles/FurnitureEutrophic/EutrophicDoorOpen.cs b/Tiles/FurnitureEutrophic/EutrophicDoorOpen.cs index 081a3f9014..3a2e51ab7e 100644 --- a/Tiles/FurnitureEutrophic/EutrophicDoorOpen.cs +++ b/Tiles/FurnitureEutrophic/EutrophicDoorOpen.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Tiles.FurnitureEutrophic public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 51, 0f, 0f, 1, new Color(54, 69, 72), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.SnowBlock, 0f, 0f, 1, new Color(54, 69, 72), 1f); return false; } diff --git a/Tiles/FurnitureEutrophic/EutrophicDresser.cs b/Tiles/FurnitureEutrophic/EutrophicDresser.cs index 4773883830..8456bd20f4 100644 --- a/Tiles/FurnitureEutrophic/EutrophicDresser.cs +++ b/Tiles/FurnitureEutrophic/EutrophicDresser.cs @@ -1,6 +1,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -16,7 +17,7 @@ namespace CalamityMod.Tiles.FurnitureEutrophic public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 51, 0f, 0f, 1, new Color(54, 69, 72), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.SnowBlock, 0f, 0f, 1, new Color(54, 69, 72), 1f); return false; } public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; diff --git a/Tiles/FurnitureEutrophic/EutrophicLamp.cs b/Tiles/FurnitureEutrophic/EutrophicLamp.cs index e488373f9d..72a09fd1a8 100644 --- a/Tiles/FurnitureEutrophic/EutrophicLamp.cs +++ b/Tiles/FurnitureEutrophic/EutrophicLamp.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureEutrophic @@ -10,7 +11,7 @@ namespace CalamityMod.Tiles.FurnitureEutrophic public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 51, 0f, 0f, 1, new Color(54, 69, 72), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.SnowBlock, 0f, 0f, 1, new Color(54, 69, 72), 1f); return false; } diff --git a/Tiles/FurnitureEutrophic/EutrophicLantern.cs b/Tiles/FurnitureEutrophic/EutrophicLantern.cs index 6d7f2f9066..4c9d41174f 100644 --- a/Tiles/FurnitureEutrophic/EutrophicLantern.cs +++ b/Tiles/FurnitureEutrophic/EutrophicLantern.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureEutrophic @@ -11,7 +12,7 @@ namespace CalamityMod.Tiles.FurnitureEutrophic public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 51, 0f, 0f, 1, new Color(54, 69, 72), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.SnowBlock, 0f, 0f, 1, new Color(54, 69, 72), 1f); return false; } diff --git a/Tiles/FurnitureEutrophic/EutrophicPiano.cs b/Tiles/FurnitureEutrophic/EutrophicPiano.cs index ddde91f7ee..7a52e16db4 100644 --- a/Tiles/FurnitureEutrophic/EutrophicPiano.cs +++ b/Tiles/FurnitureEutrophic/EutrophicPiano.cs @@ -1,6 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Tiles.FurnitureEutrophic { public class EutrophicPiano : ModTile @@ -9,7 +11,7 @@ namespace CalamityMod.Tiles.FurnitureEutrophic public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 51, 0f, 0f, 1, new Color(54, 69, 72), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.SnowBlock, 0f, 0f, 1, new Color(54, 69, 72), 1f); return false; } diff --git a/Tiles/FurnitureEutrophic/EutrophicPlatform.cs b/Tiles/FurnitureEutrophic/EutrophicPlatform.cs index 1587e616eb..d4162d7113 100644 --- a/Tiles/FurnitureEutrophic/EutrophicPlatform.cs +++ b/Tiles/FurnitureEutrophic/EutrophicPlatform.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureEutrophic @@ -10,7 +11,7 @@ namespace CalamityMod.Tiles.FurnitureEutrophic public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 51, 0f, 0f, 1, new Color(54, 69, 72), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.SnowBlock, 0f, 0f, 1, new Color(54, 69, 72), 1f); return false; } diff --git a/Tiles/FurnitureEutrophic/EutrophicSink.cs b/Tiles/FurnitureEutrophic/EutrophicSink.cs index 423c0a2350..d95b05aef6 100644 --- a/Tiles/FurnitureEutrophic/EutrophicSink.cs +++ b/Tiles/FurnitureEutrophic/EutrophicSink.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureEutrophic @@ -10,7 +11,7 @@ namespace CalamityMod.Tiles.FurnitureEutrophic public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 51, 0f, 0f, 1, new Color(54, 69, 72), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.SnowBlock, 0f, 0f, 1, new Color(54, 69, 72), 1f); return false; } diff --git a/Tiles/FurnitureEutrophic/EutrophicTable.cs b/Tiles/FurnitureEutrophic/EutrophicTable.cs index f5bb4c98ec..e55e216aa7 100644 --- a/Tiles/FurnitureEutrophic/EutrophicTable.cs +++ b/Tiles/FurnitureEutrophic/EutrophicTable.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureEutrophic @@ -10,7 +11,7 @@ namespace CalamityMod.Tiles.FurnitureEutrophic public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 51, 0f, 0f, 1, new Color(54, 69, 72), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.SnowBlock, 0f, 0f, 1, new Color(54, 69, 72), 1f); return false; } diff --git a/Tiles/FurnitureEutrophic/EutrophicWorkBench.cs b/Tiles/FurnitureEutrophic/EutrophicWorkBench.cs index 4198256969..07679537ef 100644 --- a/Tiles/FurnitureEutrophic/EutrophicWorkBench.cs +++ b/Tiles/FurnitureEutrophic/EutrophicWorkBench.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureEutrophic @@ -10,7 +11,7 @@ namespace CalamityMod.Tiles.FurnitureEutrophic public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 51, 0f, 0f, 1, new Color(54, 69, 72), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.SnowBlock, 0f, 0f, 1, new Color(54, 69, 72), 1f); return false; } diff --git a/Tiles/FurnitureEutrophic/SmoothNavystone.cs b/Tiles/FurnitureEutrophic/SmoothNavystone.cs index ce81ef1255..6f71592d07 100644 --- a/Tiles/FurnitureEutrophic/SmoothNavystone.cs +++ b/Tiles/FurnitureEutrophic/SmoothNavystone.cs @@ -1,4 +1,4 @@ - + using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -26,7 +26,7 @@ namespace CalamityMod.Tiles.FurnitureEutrophic public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 51, 0f, 0f, 1, new Color(54, 69, 72), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.SnowBlock, 0f, 0f, 1, new Color(54, 69, 72), 1f); return false; } } diff --git a/Tiles/FurnitureExo/ExoBathtubTile.cs b/Tiles/FurnitureExo/ExoBathtubTile.cs index 4b348d90d4..4253625413 100644 --- a/Tiles/FurnitureExo/ExoBathtubTile.cs +++ b/Tiles/FurnitureExo/ExoBathtubTile.cs @@ -2,7 +2,9 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Tiles.FurnitureExo { public class ExoBathtubTile : ModTile @@ -13,7 +15,7 @@ namespace CalamityMod.Tiles.FurnitureExo public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 107, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.TerraBlade, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureExo/ExoBedTile.cs b/Tiles/FurnitureExo/ExoBedTile.cs index 539b1979a0..59f35b3e58 100644 --- a/Tiles/FurnitureExo/ExoBedTile.cs +++ b/Tiles/FurnitureExo/ExoBedTile.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureExo @@ -15,7 +16,7 @@ namespace CalamityMod.Tiles.FurnitureExo public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 107, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.TerraBlade, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureExo/ExoBookcaseTile.cs b/Tiles/FurnitureExo/ExoBookcaseTile.cs index 12ee3750c4..a5bb51442c 100644 --- a/Tiles/FurnitureExo/ExoBookcaseTile.cs +++ b/Tiles/FurnitureExo/ExoBookcaseTile.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureExo @@ -14,7 +15,7 @@ namespace CalamityMod.Tiles.FurnitureExo public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 107, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.TerraBlade, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureExo/ExoCandelabraTile.cs b/Tiles/FurnitureExo/ExoCandelabraTile.cs index cb72057ce6..efc9f4644d 100644 --- a/Tiles/FurnitureExo/ExoCandelabraTile.cs +++ b/Tiles/FurnitureExo/ExoCandelabraTile.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureExo @@ -14,7 +15,7 @@ namespace CalamityMod.Tiles.FurnitureExo public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 107, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.TerraBlade, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureExo/ExoCandleTile.cs b/Tiles/FurnitureExo/ExoCandleTile.cs index b376d6d852..2bfc0e09b6 100644 --- a/Tiles/FurnitureExo/ExoCandleTile.cs +++ b/Tiles/FurnitureExo/ExoCandleTile.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureExo @@ -14,7 +15,7 @@ namespace CalamityMod.Tiles.FurnitureExo public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 7, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.WoodFurniture, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureExo/ExoChairTile.cs b/Tiles/FurnitureExo/ExoChairTile.cs index bea7383dce..f18d66742a 100644 --- a/Tiles/FurnitureExo/ExoChairTile.cs +++ b/Tiles/FurnitureExo/ExoChairTile.cs @@ -51,7 +51,7 @@ namespace CalamityMod.Tiles.FurnitureExo public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 107, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.TerraBlade, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureExo/ExoChandelierTile.cs b/Tiles/FurnitureExo/ExoChandelierTile.cs index fc733d2374..af8d1ee90e 100644 --- a/Tiles/FurnitureExo/ExoChandelierTile.cs +++ b/Tiles/FurnitureExo/ExoChandelierTile.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureExo @@ -14,7 +15,7 @@ namespace CalamityMod.Tiles.FurnitureExo public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 107, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.TerraBlade, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureExo/ExoChestTile.cs b/Tiles/FurnitureExo/ExoChestTile.cs index 480e73e21b..3c949f4e59 100644 --- a/Tiles/FurnitureExo/ExoChestTile.cs +++ b/Tiles/FurnitureExo/ExoChestTile.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; @@ -20,7 +21,7 @@ namespace CalamityMod.Tiles.FurnitureExo public override bool CanExplode(int i, int j) => false; public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 107, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.TerraBlade, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; diff --git a/Tiles/FurnitureExo/ExoClockTile.cs b/Tiles/FurnitureExo/ExoClockTile.cs index e91311e5fa..f060ed0f9e 100644 --- a/Tiles/FurnitureExo/ExoClockTile.cs +++ b/Tiles/FurnitureExo/ExoClockTile.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureExo @@ -17,7 +18,7 @@ namespace CalamityMod.Tiles.FurnitureExo public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 107, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.TerraBlade, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureExo/ExoConsoleTile.cs b/Tiles/FurnitureExo/ExoConsoleTile.cs index 802254b93b..bc17227112 100644 --- a/Tiles/FurnitureExo/ExoConsoleTile.cs +++ b/Tiles/FurnitureExo/ExoConsoleTile.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; using Terraria.Enums; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; @@ -41,7 +42,7 @@ namespace CalamityMod.Tiles.FurnitureExo public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 107); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.TerraBlade); return false; } diff --git a/Tiles/FurnitureExo/ExoDisplayTile.cs b/Tiles/FurnitureExo/ExoDisplayTile.cs index ba85aff2ff..0e34ea42af 100644 --- a/Tiles/FurnitureExo/ExoDisplayTile.cs +++ b/Tiles/FurnitureExo/ExoDisplayTile.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; using Terraria.Enums; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; @@ -44,7 +45,7 @@ namespace CalamityMod.Tiles.FurnitureExo public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 107); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.TerraBlade); return false; } diff --git a/Tiles/FurnitureExo/ExoDresserTile.cs b/Tiles/FurnitureExo/ExoDresserTile.cs index e8c5d96203..17bd4a2633 100644 --- a/Tiles/FurnitureExo/ExoDresserTile.cs +++ b/Tiles/FurnitureExo/ExoDresserTile.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -19,7 +20,7 @@ namespace CalamityMod.Tiles.FurnitureExo public override bool CanExplode(int i, int j) => false; public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 107, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.TerraBlade, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; diff --git a/Tiles/FurnitureExo/ExoKeyboardTile.cs b/Tiles/FurnitureExo/ExoKeyboardTile.cs index c21294e02c..a58cffd87d 100644 --- a/Tiles/FurnitureExo/ExoKeyboardTile.cs +++ b/Tiles/FurnitureExo/ExoKeyboardTile.cs @@ -2,7 +2,9 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Tiles.FurnitureExo { public class ExoKeyboardTile : ModTile @@ -13,7 +15,7 @@ namespace CalamityMod.Tiles.FurnitureExo public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 107, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.TerraBlade, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureExo/ExoLampTile.cs b/Tiles/FurnitureExo/ExoLampTile.cs index d0184247b7..cd6c6fd522 100644 --- a/Tiles/FurnitureExo/ExoLampTile.cs +++ b/Tiles/FurnitureExo/ExoLampTile.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureExo @@ -14,7 +15,7 @@ namespace CalamityMod.Tiles.FurnitureExo public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 107, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.TerraBlade, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureExo/ExoLanternTile.cs b/Tiles/FurnitureExo/ExoLanternTile.cs index 5820a74ed2..7b3d0660b2 100644 --- a/Tiles/FurnitureExo/ExoLanternTile.cs +++ b/Tiles/FurnitureExo/ExoLanternTile.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureExo @@ -15,7 +16,7 @@ namespace CalamityMod.Tiles.FurnitureExo public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 107, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.TerraBlade, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureExo/ExoPlatformTile.cs b/Tiles/FurnitureExo/ExoPlatformTile.cs index 3027e9ecdf..46372dd4c0 100644 --- a/Tiles/FurnitureExo/ExoPlatformTile.cs +++ b/Tiles/FurnitureExo/ExoPlatformTile.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Placeables.FurnitureExo; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureExo @@ -13,7 +14,7 @@ namespace CalamityMod.Tiles.FurnitureExo public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 107, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.TerraBlade, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureExo/ExoPlatingTile.cs b/Tiles/FurnitureExo/ExoPlatingTile.cs index fbb99c8b66..69cf5c2221 100644 --- a/Tiles/FurnitureExo/ExoPlatingTile.cs +++ b/Tiles/FurnitureExo/ExoPlatingTile.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Tiles.FurnitureExo public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 107, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.TerraBlade, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureExo/ExoPrismPanelTile.cs b/Tiles/FurnitureExo/ExoPrismPanelTile.cs index e79bd9f628..fa22b88f08 100644 --- a/Tiles/FurnitureExo/ExoPrismPanelTile.cs +++ b/Tiles/FurnitureExo/ExoPrismPanelTile.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Tiles.FurnitureExo public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 107, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.TerraBlade, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureExo/ExoPrismPlatformTile.cs b/Tiles/FurnitureExo/ExoPrismPlatformTile.cs index a1c79473d5..b3bbe480e9 100644 --- a/Tiles/FurnitureExo/ExoPrismPlatformTile.cs +++ b/Tiles/FurnitureExo/ExoPrismPlatformTile.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureExo @@ -26,7 +27,7 @@ namespace CalamityMod.Tiles.FurnitureExo public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 107, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.TerraBlade, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureExo/ExoServerTile.cs b/Tiles/FurnitureExo/ExoServerTile.cs index 2950110438..45c3fb4f38 100644 --- a/Tiles/FurnitureExo/ExoServerTile.cs +++ b/Tiles/FurnitureExo/ExoServerTile.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; using Terraria.Enums; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; @@ -41,7 +42,7 @@ namespace CalamityMod.Tiles.FurnitureExo public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 107); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.TerraBlade); return false; } diff --git a/Tiles/FurnitureExo/ExoSinkTile.cs b/Tiles/FurnitureExo/ExoSinkTile.cs index aeca25b675..f20935c0a2 100644 --- a/Tiles/FurnitureExo/ExoSinkTile.cs +++ b/Tiles/FurnitureExo/ExoSinkTile.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureExo @@ -14,7 +15,7 @@ namespace CalamityMod.Tiles.FurnitureExo public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 107, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.TerraBlade, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureExo/ExoSofaTile.cs b/Tiles/FurnitureExo/ExoSofaTile.cs index 7ffc6e860d..5236a75055 100644 --- a/Tiles/FurnitureExo/ExoSofaTile.cs +++ b/Tiles/FurnitureExo/ExoSofaTile.cs @@ -5,7 +5,9 @@ using Terraria; using Terraria.DataStructures; using Terraria.GameContent; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Tiles.FurnitureExo { public class ExoSofaTile : ModTile @@ -16,7 +18,7 @@ namespace CalamityMod.Tiles.FurnitureExo public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 107, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.TerraBlade, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureExo/ExoTableTile.cs b/Tiles/FurnitureExo/ExoTableTile.cs index ab1e57eddb..4b2240b6fe 100644 --- a/Tiles/FurnitureExo/ExoTableTile.cs +++ b/Tiles/FurnitureExo/ExoTableTile.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureExo @@ -14,7 +15,7 @@ namespace CalamityMod.Tiles.FurnitureExo public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 107, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.TerraBlade, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureExo/ExoTerminalTile.cs b/Tiles/FurnitureExo/ExoTerminalTile.cs index 7b0f089305..fa0aa1edd5 100644 --- a/Tiles/FurnitureExo/ExoTerminalTile.cs +++ b/Tiles/FurnitureExo/ExoTerminalTile.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; using Terraria.Enums; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; @@ -44,7 +45,7 @@ namespace CalamityMod.Tiles.FurnitureExo public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 107); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.TerraBlade); return false; } diff --git a/Tiles/FurnitureExo/ExoToiletTile.cs b/Tiles/FurnitureExo/ExoToiletTile.cs index fab4356035..0dc1d46bc5 100644 --- a/Tiles/FurnitureExo/ExoToiletTile.cs +++ b/Tiles/FurnitureExo/ExoToiletTile.cs @@ -52,7 +52,7 @@ namespace CalamityMod.Tiles.FurnitureExo public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 107, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.TerraBlade, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureExo/ExoWorkBenchTile.cs b/Tiles/FurnitureExo/ExoWorkBenchTile.cs index d8e75937f1..09264ba031 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.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureExo @@ -15,7 +16,7 @@ namespace CalamityMod.Tiles.FurnitureExo public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 107, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.TerraBlade, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureMonolith/MonolithChest.cs b/Tiles/FurnitureMonolith/MonolithChest.cs index 4b7460e776..435852091e 100644 --- a/Tiles/FurnitureMonolith/MonolithChest.cs +++ b/Tiles/FurnitureMonolith/MonolithChest.cs @@ -53,7 +53,7 @@ namespace CalamityMod.Tiles.FurnitureMonolith { if (player.chest < 0) { - SoundEngine.PlaySound(SoundID.NPCDeath22 with { Volume = SoundID.NPCDeath22.Volume * 0.5f}); + SoundEngine.PlaySound(SoundID.NPCDeath22 with { Volume = SoundID.NPCDeath22.Volume * 0.5f }); } } } diff --git a/Tiles/FurnitureMonolith/MonolithPiano.cs b/Tiles/FurnitureMonolith/MonolithPiano.cs index 136199a405..d32029c9ba 100644 --- a/Tiles/FurnitureMonolith/MonolithPiano.cs +++ b/Tiles/FurnitureMonolith/MonolithPiano.cs @@ -2,7 +2,9 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Tiles.FurnitureMonolith { public class MonolithPiano : ModTile @@ -11,7 +13,7 @@ namespace CalamityMod.Tiles.FurnitureMonolith 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(125, 94, 128), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(125, 94, 128), 1f); Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, ModContent.DustType(), 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureOtherworldly/OtherworldlyBathtub.cs b/Tiles/FurnitureOtherworldly/OtherworldlyBathtub.cs index b4131d9994..fe4e5256ca 100644 --- a/Tiles/FurnitureOtherworldly/OtherworldlyBathtub.cs +++ b/Tiles/FurnitureOtherworldly/OtherworldlyBathtub.cs @@ -1,7 +1,9 @@ using CalamityMod.Dusts.Furniture; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Tiles.FurnitureOtherworldly { [LegacyName("OccultBathtub")] @@ -11,7 +13,7 @@ namespace CalamityMod.Tiles.FurnitureOtherworldly 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(125, 94, 128), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(125, 94, 128), 1f); Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, ModContent.DustType(), 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureOtherworldly/OtherworldlyBed.cs b/Tiles/FurnitureOtherworldly/OtherworldlyBed.cs index 4d9a7c8ac5..26d5307a60 100644 --- a/Tiles/FurnitureOtherworldly/OtherworldlyBed.cs +++ b/Tiles/FurnitureOtherworldly/OtherworldlyBed.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureOtherworldly @@ -13,7 +14,7 @@ namespace CalamityMod.Tiles.FurnitureOtherworldly 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(125, 94, 128), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(125, 94, 128), 1f); Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, ModContent.DustType(), 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureOtherworldly/OtherworldlyBookcase.cs b/Tiles/FurnitureOtherworldly/OtherworldlyBookcase.cs index e71d3a235d..f721d3c61c 100644 --- a/Tiles/FurnitureOtherworldly/OtherworldlyBookcase.cs +++ b/Tiles/FurnitureOtherworldly/OtherworldlyBookcase.cs @@ -1,6 +1,7 @@ using CalamityMod.Dusts.Furniture; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureOtherworldly @@ -12,7 +13,7 @@ namespace CalamityMod.Tiles.FurnitureOtherworldly 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(125, 94, 128), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(125, 94, 128), 1f); Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, ModContent.DustType(), 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureOtherworldly/OtherworldlyCandelabra.cs b/Tiles/FurnitureOtherworldly/OtherworldlyCandelabra.cs index afe2ee4c8a..b2b86dd2ef 100644 --- a/Tiles/FurnitureOtherworldly/OtherworldlyCandelabra.cs +++ b/Tiles/FurnitureOtherworldly/OtherworldlyCandelabra.cs @@ -1,6 +1,7 @@ using CalamityMod.Dusts.Furniture; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureOtherworldly @@ -12,7 +13,7 @@ namespace CalamityMod.Tiles.FurnitureOtherworldly 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(125, 94, 128), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(125, 94, 128), 1f); Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, ModContent.DustType(), 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureOtherworldly/OtherworldlyCandle.cs b/Tiles/FurnitureOtherworldly/OtherworldlyCandle.cs index 0f1bbcd4c3..b61dec5702 100644 --- a/Tiles/FurnitureOtherworldly/OtherworldlyCandle.cs +++ b/Tiles/FurnitureOtherworldly/OtherworldlyCandle.cs @@ -1,6 +1,7 @@ using CalamityMod.Dusts.Furniture; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureOtherworldly @@ -12,7 +13,7 @@ namespace CalamityMod.Tiles.FurnitureOtherworldly 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(125, 94, 128), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(125, 94, 128), 1f); Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, ModContent.DustType(), 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureOtherworldly/OtherworldlyChair.cs b/Tiles/FurnitureOtherworldly/OtherworldlyChair.cs index 05fe2e6079..28791c6901 100644 --- a/Tiles/FurnitureOtherworldly/OtherworldlyChair.cs +++ b/Tiles/FurnitureOtherworldly/OtherworldlyChair.cs @@ -4,6 +4,7 @@ using Terraria; using Terraria.DataStructures; using Terraria.GameContent; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureOtherworldly @@ -15,7 +16,7 @@ namespace CalamityMod.Tiles.FurnitureOtherworldly 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(125, 94, 128), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(125, 94, 128), 1f); Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, ModContent.DustType(), 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureOtherworldly/OtherworldlyChandelier.cs b/Tiles/FurnitureOtherworldly/OtherworldlyChandelier.cs index 0ae78ba271..aa79b1dacc 100644 --- a/Tiles/FurnitureOtherworldly/OtherworldlyChandelier.cs +++ b/Tiles/FurnitureOtherworldly/OtherworldlyChandelier.cs @@ -1,6 +1,7 @@ using CalamityMod.Dusts.Furniture; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureOtherworldly @@ -12,7 +13,7 @@ namespace CalamityMod.Tiles.FurnitureOtherworldly 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(125, 94, 128), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(125, 94, 128), 1f); Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, ModContent.DustType(), 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureOtherworldly/OtherworldlyChest.cs b/Tiles/FurnitureOtherworldly/OtherworldlyChest.cs index 6a137b3cee..fb1a5c126a 100644 --- a/Tiles/FurnitureOtherworldly/OtherworldlyChest.cs +++ b/Tiles/FurnitureOtherworldly/OtherworldlyChest.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -18,7 +19,7 @@ namespace CalamityMod.Tiles.FurnitureOtherworldly 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(125, 94, 128), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(125, 94, 128), 1f); Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, ModContent.DustType(), 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureOtherworldly/OtherworldlyClock.cs b/Tiles/FurnitureOtherworldly/OtherworldlyClock.cs index 8a6d70b275..ee87aee50c 100644 --- a/Tiles/FurnitureOtherworldly/OtherworldlyClock.cs +++ b/Tiles/FurnitureOtherworldly/OtherworldlyClock.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureOtherworldly @@ -15,7 +16,7 @@ namespace CalamityMod.Tiles.FurnitureOtherworldly 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(125, 94, 128), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(125, 94, 128), 1f); Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, ModContent.DustType(), 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureOtherworldly/OtherworldlyDoorClosed.cs b/Tiles/FurnitureOtherworldly/OtherworldlyDoorClosed.cs index 8aa543cfa3..5bd864367b 100644 --- a/Tiles/FurnitureOtherworldly/OtherworldlyDoorClosed.cs +++ b/Tiles/FurnitureOtherworldly/OtherworldlyDoorClosed.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Tiles.FurnitureOtherworldly 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(125, 94, 128), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(125, 94, 128), 1f); Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, ModContent.DustType(), 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureOtherworldly/OtherworldlyDoorOpen.cs b/Tiles/FurnitureOtherworldly/OtherworldlyDoorOpen.cs index 845811e4aa..bd31e21dc9 100644 --- a/Tiles/FurnitureOtherworldly/OtherworldlyDoorOpen.cs +++ b/Tiles/FurnitureOtherworldly/OtherworldlyDoorOpen.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Tiles.FurnitureOtherworldly 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(125, 94, 128), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(125, 94, 128), 1f); Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, ModContent.DustType(), 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureOtherworldly/OtherworldlyDresser.cs b/Tiles/FurnitureOtherworldly/OtherworldlyDresser.cs index ccd06cf1ce..a090ae75ee 100644 --- a/Tiles/FurnitureOtherworldly/OtherworldlyDresser.cs +++ b/Tiles/FurnitureOtherworldly/OtherworldlyDresser.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -18,7 +19,7 @@ namespace CalamityMod.Tiles.FurnitureOtherworldly 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(125, 94, 128), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(125, 94, 128), 1f); Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, ModContent.DustType(), 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureOtherworldly/OtherworldlyLamp.cs b/Tiles/FurnitureOtherworldly/OtherworldlyLamp.cs index d1d64fca3b..f80627967c 100644 --- a/Tiles/FurnitureOtherworldly/OtherworldlyLamp.cs +++ b/Tiles/FurnitureOtherworldly/OtherworldlyLamp.cs @@ -1,6 +1,7 @@ using CalamityMod.Dusts.Furniture; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureOtherworldly @@ -12,7 +13,7 @@ namespace CalamityMod.Tiles.FurnitureOtherworldly 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(125, 94, 128), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(125, 94, 128), 1f); Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, ModContent.DustType(), 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureOtherworldly/OtherworldlyLantern.cs b/Tiles/FurnitureOtherworldly/OtherworldlyLantern.cs index 4e2caa8128..4b710c4096 100644 --- a/Tiles/FurnitureOtherworldly/OtherworldlyLantern.cs +++ b/Tiles/FurnitureOtherworldly/OtherworldlyLantern.cs @@ -1,6 +1,7 @@ using CalamityMod.Dusts.Furniture; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureOtherworldly @@ -13,7 +14,7 @@ namespace CalamityMod.Tiles.FurnitureOtherworldly 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(125, 94, 128), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(125, 94, 128), 1f); Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, ModContent.DustType(), 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureOtherworldly/OtherworldlyPiano.cs b/Tiles/FurnitureOtherworldly/OtherworldlyPiano.cs index 3b08803323..368229afb8 100644 --- a/Tiles/FurnitureOtherworldly/OtherworldlyPiano.cs +++ b/Tiles/FurnitureOtherworldly/OtherworldlyPiano.cs @@ -1,7 +1,9 @@ using CalamityMod.Dusts.Furniture; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Tiles.FurnitureOtherworldly { [LegacyName("OccultPiano")] @@ -11,7 +13,7 @@ namespace CalamityMod.Tiles.FurnitureOtherworldly 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(125, 94, 128), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(125, 94, 128), 1f); Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, ModContent.DustType(), 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureOtherworldly/OtherworldlyPlatform.cs b/Tiles/FurnitureOtherworldly/OtherworldlyPlatform.cs index 6e64dd442e..4bb27147a7 100644 --- a/Tiles/FurnitureOtherworldly/OtherworldlyPlatform.cs +++ b/Tiles/FurnitureOtherworldly/OtherworldlyPlatform.cs @@ -1,6 +1,7 @@ using CalamityMod.Dusts.Furniture; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureOtherworldly @@ -12,7 +13,7 @@ namespace CalamityMod.Tiles.FurnitureOtherworldly 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(125, 94, 128), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(125, 94, 128), 1f); Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, ModContent.DustType(), 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureOtherworldly/OtherworldlySink.cs b/Tiles/FurnitureOtherworldly/OtherworldlySink.cs index 0adbff6710..1d2fa24181 100644 --- a/Tiles/FurnitureOtherworldly/OtherworldlySink.cs +++ b/Tiles/FurnitureOtherworldly/OtherworldlySink.cs @@ -1,6 +1,7 @@ using CalamityMod.Dusts.Furniture; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureOtherworldly @@ -12,7 +13,7 @@ namespace CalamityMod.Tiles.FurnitureOtherworldly 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(125, 94, 128), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(125, 94, 128), 1f); Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, ModContent.DustType(), 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureOtherworldly/OtherworldlySofa.cs b/Tiles/FurnitureOtherworldly/OtherworldlySofa.cs index 6be1c2e692..76ed16933e 100644 --- a/Tiles/FurnitureOtherworldly/OtherworldlySofa.cs +++ b/Tiles/FurnitureOtherworldly/OtherworldlySofa.cs @@ -4,7 +4,9 @@ using Terraria; using Terraria.DataStructures; using Terraria.GameContent; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Tiles.FurnitureOtherworldly { [LegacyName("OccultSofa")] @@ -14,7 +16,7 @@ namespace CalamityMod.Tiles.FurnitureOtherworldly 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(125, 94, 128), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(125, 94, 128), 1f); Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, ModContent.DustType(), 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureOtherworldly/OtherworldlyStone.cs b/Tiles/FurnitureOtherworldly/OtherworldlyStone.cs index b5b6f8f210..7c3049f1ed 100644 --- a/Tiles/FurnitureOtherworldly/OtherworldlyStone.cs +++ b/Tiles/FurnitureOtherworldly/OtherworldlyStone.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Tiles.FurnitureOtherworldly 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(125, 94, 128), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(125, 94, 128), 1f); Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, ModContent.DustType(), 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } @@ -45,7 +45,7 @@ namespace CalamityMod.Tiles.FurnitureOtherworldly { Main.instance.TilesRenderer.AddSpecialLegacyPoint(i, j); } - catch {} + catch { } } } diff --git a/Tiles/FurnitureOtherworldly/OtherworldlyTable.cs b/Tiles/FurnitureOtherworldly/OtherworldlyTable.cs index a199d84d1f..5c4ef3ce9d 100644 --- a/Tiles/FurnitureOtherworldly/OtherworldlyTable.cs +++ b/Tiles/FurnitureOtherworldly/OtherworldlyTable.cs @@ -1,6 +1,7 @@ using CalamityMod.Dusts.Furniture; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureOtherworldly @@ -12,7 +13,7 @@ namespace CalamityMod.Tiles.FurnitureOtherworldly 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(125, 94, 128), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(125, 94, 128), 1f); Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, ModContent.DustType(), 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureOtherworldly/OtherworldlyWorkBench.cs b/Tiles/FurnitureOtherworldly/OtherworldlyWorkBench.cs index f0378455b5..3bd5c54ea1 100644 --- a/Tiles/FurnitureOtherworldly/OtherworldlyWorkBench.cs +++ b/Tiles/FurnitureOtherworldly/OtherworldlyWorkBench.cs @@ -1,6 +1,7 @@ using CalamityMod.Dusts.Furniture; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureOtherworldly @@ -12,7 +13,7 @@ namespace CalamityMod.Tiles.FurnitureOtherworldly 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(125, 94, 128), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(125, 94, 128), 1f); Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, ModContent.DustType(), 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlate.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlate.cs index 22bb415dbe..54aa0837b5 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlate.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlate.cs @@ -2,8 +2,8 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Tiles.FurniturePlaguedPlate { @@ -20,7 +20,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 178, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.BubbleBurst_Green, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateBasin.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateBasin.cs index 6531501a33..57b83597b1 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateBasin.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateBasin.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 178, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.BubbleBurst_Green, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateBathtub.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateBathtub.cs index c8c6a38e79..ab8ad4a855 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateBathtub.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateBathtub.cs @@ -1,6 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Tiles.FurniturePlaguedPlate { public class PlaguedPlateBathtub : ModTile @@ -9,7 +11,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 178, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.BubbleBurst_Green, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateBed.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateBed.cs index 0c9d322d57..65721061b7 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateBed.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateBed.cs @@ -1,8 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; -using Terraria.ID; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; @@ -28,7 +28,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 178, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.BubbleBurst_Green, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateBookcase.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateBookcase.cs index 3656c78a2a..da145724b7 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateBookcase.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateBookcase.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurniturePlaguedPlate @@ -10,7 +11,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 178, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.BubbleBurst_Green, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateCandelabra.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateCandelabra.cs index b34aac7dd1..4dcfc0650d 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateCandelabra.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateCandelabra.cs @@ -1,8 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; - namespace CalamityMod.Tiles.FurniturePlaguedPlate { public class PlaguedPlateCandelabra : ModTile @@ -11,7 +11,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 178, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.BubbleBurst_Green, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateCandle.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateCandle.cs index 1e523b292f..b73eb77360 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateCandle.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateCandle.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurniturePlaguedPlate @@ -10,7 +11,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 178, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.BubbleBurst_Green, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateChair.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateChair.cs index 5037163ed7..fe7d8ca96d 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateChair.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateChair.cs @@ -3,6 +3,7 @@ using Terraria; using Terraria.DataStructures; using Terraria.GameContent; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurniturePlaguedPlate @@ -13,7 +14,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 178, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.BubbleBurst_Green, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateChandelier.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateChandelier.cs index 5c5f6e8389..469a785fbf 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateChandelier.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateChandelier.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurniturePlaguedPlate @@ -10,7 +11,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 178, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.BubbleBurst_Green, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateChest.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateChest.cs index fa535b411e..1c5b2bcdd5 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateChest.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateChest.cs @@ -1,6 +1,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -16,7 +17,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 178, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.BubbleBurst_Green, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateClock.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateClock.cs index 81683a1158..5893face2d 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateClock.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateClock.cs @@ -1,6 +1,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurniturePlaguedPlate @@ -18,7 +19,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 178, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.BubbleBurst_Green, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateDoorClosed.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateDoorClosed.cs index 03459883d6..cf242c971c 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateDoorClosed.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateDoorClosed.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 178, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.BubbleBurst_Green, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateDoorOpen.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateDoorOpen.cs index c1dfc5cb32..d16d07f344 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateDoorOpen.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateDoorOpen.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 178, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.BubbleBurst_Green, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateDresser.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateDresser.cs index 0385fee858..35a589cd5f 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateDresser.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateDresser.cs @@ -1,6 +1,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -16,7 +17,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 178, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.BubbleBurst_Green, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateLamp.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateLamp.cs index bd4480a6c4..9f3095a522 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateLamp.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateLamp.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurniturePlaguedPlate @@ -10,7 +11,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 178, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.BubbleBurst_Green, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateLantern.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateLantern.cs index 54498835cc..1917926843 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateLantern.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateLantern.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurniturePlaguedPlate @@ -11,7 +12,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 178, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.BubbleBurst_Green, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlatePiano.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlatePiano.cs index e5ee99ea17..3e0c257ec1 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlatePiano.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlatePiano.cs @@ -1,6 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Tiles.FurniturePlaguedPlate { public class PlaguedPlatePiano : ModTile @@ -9,7 +11,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 178, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.BubbleBurst_Green, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlatePlatform.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlatePlatform.cs index 215d52bb15..f4a4649c83 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlatePlatform.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlatePlatform.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurniturePlaguedPlate @@ -10,7 +11,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 178, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.BubbleBurst_Green, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateSink.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateSink.cs index 6560b864e8..471d16ea6d 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateSink.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateSink.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurniturePlaguedPlate @@ -10,7 +11,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 178, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.BubbleBurst_Green, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateSofa.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateSofa.cs index f8393d0d4a..a8687a9fa4 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateSofa.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateSofa.cs @@ -3,7 +3,9 @@ using Terraria; using Terraria.DataStructures; using Terraria.GameContent; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Tiles.FurniturePlaguedPlate { public class PlaguedPlateSofa : ModTile @@ -12,7 +14,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 178, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.BubbleBurst_Green, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateTable.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateTable.cs index 5edf10fe74..8db75f8587 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateTable.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateTable.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurniturePlaguedPlate @@ -10,7 +11,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 178, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.BubbleBurst_Green, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateWorkBenchTile.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateWorkBenchTile.cs index 38f3080924..1d0343dea5 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateWorkBenchTile.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateWorkBenchTile.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurniturePlaguedPlate @@ -11,7 +12,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 178, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.BubbleBurst_Green, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureProfaned/ProfanedBath.cs b/Tiles/FurnitureProfaned/ProfanedBath.cs index ccd1a9d627..02fff9759c 100644 --- a/Tiles/FurnitureProfaned/ProfanedBath.cs +++ b/Tiles/FurnitureProfaned/ProfanedBath.cs @@ -1,7 +1,9 @@ using CalamityMod.Dusts.Furniture; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Tiles.FurnitureProfaned { public class ProfanedBath : ModTile @@ -10,7 +12,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 246, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.GoldCoin, 0f, 0f, 1, new Color(255, 255, 255), 1f); Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, ModContent.DustType(), 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureProfaned/ProfanedBed.cs b/Tiles/FurnitureProfaned/ProfanedBed.cs index 016327c8e0..fde33ba98d 100644 --- a/Tiles/FurnitureProfaned/ProfanedBed.cs +++ b/Tiles/FurnitureProfaned/ProfanedBed.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureProfaned @@ -12,7 +13,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 246, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.GoldCoin, 0f, 0f, 1, new Color(255, 255, 255), 1f); Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, ModContent.DustType(), 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureProfaned/ProfanedBench.cs b/Tiles/FurnitureProfaned/ProfanedBench.cs index 886891211a..e3a6fb359e 100644 --- a/Tiles/FurnitureProfaned/ProfanedBench.cs +++ b/Tiles/FurnitureProfaned/ProfanedBench.cs @@ -4,7 +4,9 @@ using Terraria; using Terraria.DataStructures; using Terraria.GameContent; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Tiles.FurnitureProfaned { public class ProfanedBench : ModTile @@ -13,7 +15,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 246, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.GoldCoin, 0f, 0f, 1, new Color(255, 255, 255), 1f); Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, ModContent.DustType(), 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureProfaned/ProfanedBookcase.cs b/Tiles/FurnitureProfaned/ProfanedBookcase.cs index 289a9cb4fe..e1f7aed6ec 100644 --- a/Tiles/FurnitureProfaned/ProfanedBookcase.cs +++ b/Tiles/FurnitureProfaned/ProfanedBookcase.cs @@ -1,6 +1,7 @@ using CalamityMod.Dusts.Furniture; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureProfaned @@ -11,7 +12,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 246, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.GoldCoin, 0f, 0f, 1, new Color(255, 255, 255), 1f); Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, ModContent.DustType(), 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureProfaned/ProfanedCandelabra.cs b/Tiles/FurnitureProfaned/ProfanedCandelabra.cs index 048d39e1f9..76787f485f 100644 --- a/Tiles/FurnitureProfaned/ProfanedCandelabra.cs +++ b/Tiles/FurnitureProfaned/ProfanedCandelabra.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureProfaned @@ -13,7 +14,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 246, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.GoldCoin, 0f, 0f, 1, new Color(255, 255, 255), 1f); Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, ModContent.DustType(), 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureProfaned/ProfanedCandle.cs b/Tiles/FurnitureProfaned/ProfanedCandle.cs index d47fde3129..3f57a35370 100644 --- a/Tiles/FurnitureProfaned/ProfanedCandle.cs +++ b/Tiles/FurnitureProfaned/ProfanedCandle.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureProfaned @@ -13,7 +14,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 246, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.GoldCoin, 0f, 0f, 1, new Color(255, 255, 255), 1f); Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, ModContent.DustType(), 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureProfaned/ProfanedChair.cs b/Tiles/FurnitureProfaned/ProfanedChair.cs index c09be5e2f1..946987583d 100644 --- a/Tiles/FurnitureProfaned/ProfanedChair.cs +++ b/Tiles/FurnitureProfaned/ProfanedChair.cs @@ -4,6 +4,7 @@ using Terraria; using Terraria.DataStructures; using Terraria.GameContent; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureProfaned @@ -14,7 +15,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 246, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.GoldCoin, 0f, 0f, 1, new Color(255, 255, 255), 1f); Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, ModContent.DustType(), 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureProfaned/ProfanedChandelier.cs b/Tiles/FurnitureProfaned/ProfanedChandelier.cs index 8ebdbd3dca..770ca87660 100644 --- a/Tiles/FurnitureProfaned/ProfanedChandelier.cs +++ b/Tiles/FurnitureProfaned/ProfanedChandelier.cs @@ -1,6 +1,7 @@ using CalamityMod.Dusts.Furniture; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureProfaned @@ -11,7 +12,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 246, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.GoldCoin, 0f, 0f, 1, new Color(255, 255, 255), 1f); Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, ModContent.DustType(), 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureProfaned/ProfanedChest.cs b/Tiles/FurnitureProfaned/ProfanedChest.cs index 219a0cff7e..cd9a2965eb 100644 --- a/Tiles/FurnitureProfaned/ProfanedChest.cs +++ b/Tiles/FurnitureProfaned/ProfanedChest.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -17,7 +18,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 246, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.GoldCoin, 0f, 0f, 1, new Color(255, 255, 255), 1f); Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, ModContent.DustType(), 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureProfaned/ProfanedClock.cs b/Tiles/FurnitureProfaned/ProfanedClock.cs index 29d618f7fb..2501ceee5f 100644 --- a/Tiles/FurnitureProfaned/ProfanedClock.cs +++ b/Tiles/FurnitureProfaned/ProfanedClock.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureProfaned @@ -14,7 +15,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 246, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.GoldCoin, 0f, 0f, 1, new Color(255, 255, 255), 1f); Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, ModContent.DustType(), 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureProfaned/ProfanedCrystal.cs b/Tiles/FurnitureProfaned/ProfanedCrystal.cs index 1c6d3417ce..de954b5741 100644 --- a/Tiles/FurnitureProfaned/ProfanedCrystal.cs +++ b/Tiles/FurnitureProfaned/ProfanedCrystal.cs @@ -1,8 +1,8 @@  using Microsoft.Xna.Framework; using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureProfaned { @@ -32,7 +32,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 205, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.VenomStaff, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureProfaned/ProfanedDoorClosed.cs b/Tiles/FurnitureProfaned/ProfanedDoorClosed.cs index 0550bc592f..bb5fcdd458 100644 --- a/Tiles/FurnitureProfaned/ProfanedDoorClosed.cs +++ b/Tiles/FurnitureProfaned/ProfanedDoorClosed.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 246, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.GoldCoin, 0f, 0f, 1, new Color(255, 255, 255), 1f); Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, ModContent.DustType(), 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureProfaned/ProfanedDoorOpen.cs b/Tiles/FurnitureProfaned/ProfanedDoorOpen.cs index 335882f8cb..54bcbc6f3b 100644 --- a/Tiles/FurnitureProfaned/ProfanedDoorOpen.cs +++ b/Tiles/FurnitureProfaned/ProfanedDoorOpen.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 246, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.GoldCoin, 0f, 0f, 1, new Color(255, 255, 255), 1f); Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, ModContent.DustType(), 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureProfaned/ProfanedDresser.cs b/Tiles/FurnitureProfaned/ProfanedDresser.cs index d5b86ad94b..0b9b45abab 100644 --- a/Tiles/FurnitureProfaned/ProfanedDresser.cs +++ b/Tiles/FurnitureProfaned/ProfanedDresser.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -17,7 +18,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 246, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.GoldCoin, 0f, 0f, 1, new Color(255, 255, 255), 1f); Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, ModContent.DustType(), 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureProfaned/ProfanedLamp.cs b/Tiles/FurnitureProfaned/ProfanedLamp.cs index 6c70d4534c..fc16a0d930 100644 --- a/Tiles/FurnitureProfaned/ProfanedLamp.cs +++ b/Tiles/FurnitureProfaned/ProfanedLamp.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureProfaned @@ -13,7 +14,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 246, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.GoldCoin, 0f, 0f, 1, new Color(255, 255, 255), 1f); Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, ModContent.DustType(), 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureProfaned/ProfanedLantern.cs b/Tiles/FurnitureProfaned/ProfanedLantern.cs index 93797dadf5..229ad1e00d 100644 --- a/Tiles/FurnitureProfaned/ProfanedLantern.cs +++ b/Tiles/FurnitureProfaned/ProfanedLantern.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureProfaned @@ -14,7 +15,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 246, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.GoldCoin, 0f, 0f, 1, new Color(255, 255, 255), 1f); Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, ModContent.DustType(), 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureProfaned/ProfanedPiano.cs b/Tiles/FurnitureProfaned/ProfanedPiano.cs index 6243054fa8..f13dcb2d72 100644 --- a/Tiles/FurnitureProfaned/ProfanedPiano.cs +++ b/Tiles/FurnitureProfaned/ProfanedPiano.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 246, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.GoldCoin, 0f, 0f, 1, new Color(255, 255, 255), 1f); Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, ModContent.DustType(), 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureProfaned/ProfanedPlatform.cs b/Tiles/FurnitureProfaned/ProfanedPlatform.cs index 754e02fb62..53bd90f1af 100644 --- a/Tiles/FurnitureProfaned/ProfanedPlatform.cs +++ b/Tiles/FurnitureProfaned/ProfanedPlatform.cs @@ -1,6 +1,7 @@ using CalamityMod.Dusts.Furniture; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureProfaned @@ -11,7 +12,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 246, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.GoldCoin, 0f, 0f, 1, new Color(255, 255, 255), 1f); Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, ModContent.DustType(), 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureProfaned/ProfanedRock.cs b/Tiles/FurnitureProfaned/ProfanedRock.cs index 5ee5413580..6e814e787c 100644 --- a/Tiles/FurnitureProfaned/ProfanedRock.cs +++ b/Tiles/FurnitureProfaned/ProfanedRock.cs @@ -3,8 +3,8 @@ using CalamityMod.Dusts.Furniture; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureProfaned { @@ -29,7 +29,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 246, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.GoldCoin, 0f, 0f, 1, new Color(255, 255, 255), 1f); Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, ModContent.DustType(), 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureProfaned/ProfanedSink.cs b/Tiles/FurnitureProfaned/ProfanedSink.cs index 53c4d6bfa4..58a6cc5a8c 100644 --- a/Tiles/FurnitureProfaned/ProfanedSink.cs +++ b/Tiles/FurnitureProfaned/ProfanedSink.cs @@ -1,6 +1,7 @@ using CalamityMod.Dusts.Furniture; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureProfaned @@ -11,7 +12,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 246, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.GoldCoin, 0f, 0f, 1, new Color(255, 255, 255), 1f); Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, ModContent.DustType(), 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureProfaned/ProfanedSlab.cs b/Tiles/FurnitureProfaned/ProfanedSlab.cs index 6e54228883..35ec398779 100644 --- a/Tiles/FurnitureProfaned/ProfanedSlab.cs +++ b/Tiles/FurnitureProfaned/ProfanedSlab.cs @@ -2,8 +2,8 @@ using CalamityMod.Dusts.Furniture; using Microsoft.Xna.Framework; using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureProfaned { diff --git a/Tiles/FurnitureProfaned/ProfanedTable.cs b/Tiles/FurnitureProfaned/ProfanedTable.cs index 9a3f30a284..4658d040a5 100644 --- a/Tiles/FurnitureProfaned/ProfanedTable.cs +++ b/Tiles/FurnitureProfaned/ProfanedTable.cs @@ -1,6 +1,7 @@ using CalamityMod.Dusts.Furniture; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureProfaned @@ -11,7 +12,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 246, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.GoldCoin, 0f, 0f, 1, new Color(255, 255, 255), 1f); Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, ModContent.DustType(), 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureProfaned/ProfanedWorkBenchTile.cs b/Tiles/FurnitureProfaned/ProfanedWorkBenchTile.cs index a8d6c86019..ad729891e4 100644 --- a/Tiles/FurnitureProfaned/ProfanedWorkBenchTile.cs +++ b/Tiles/FurnitureProfaned/ProfanedWorkBenchTile.cs @@ -1,6 +1,7 @@ using CalamityMod.Dusts.Furniture; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureProfaned @@ -12,7 +13,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 246, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.GoldCoin, 0f, 0f, 1, new Color(255, 255, 255), 1f); Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, ModContent.DustType(), 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureProfaned/RunicProfanedBrick.cs b/Tiles/FurnitureProfaned/RunicProfanedBrick.cs index c19ece8e26..0f2ba200ba 100644 --- a/Tiles/FurnitureProfaned/RunicProfanedBrick.cs +++ b/Tiles/FurnitureProfaned/RunicProfanedBrick.cs @@ -3,8 +3,8 @@ using CalamityMod.Dusts.Furniture; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureProfaned { @@ -28,7 +28,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 246, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.GoldCoin, 0f, 0f, 1, new Color(255, 255, 255), 1f); Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, ModContent.DustType(), 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureSacrilegious/EyeOfTheAccursedBannerTile.cs b/Tiles/FurnitureSacrilegious/EyeOfTheAccursedBannerTile.cs index a32d2cec6b..dff5f15e7c 100644 --- a/Tiles/FurnitureSacrilegious/EyeOfTheAccursedBannerTile.cs +++ b/Tiles/FurnitureSacrilegious/EyeOfTheAccursedBannerTile.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Placeables.FurnitureSacrilegious; +using CalamityMod.Items.Placeables.FurnitureSacrilegious; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -19,10 +19,10 @@ namespace CalamityMod.Tiles.FurnitureSacrilegious Main.tileNoAttach[Type] = true; Main.tileLavaDeath[Type] = false; - TileObjectData.newTile.CopyFrom(TileObjectData.Style2xX); + TileObjectData.newTile.CopyFrom(TileObjectData.Style2xX); TileObjectData.newTile.LavaDeath = false; - TileObjectData.newTile.Height = 3; - TileObjectData.newTile.Origin = new Point16(0, 0); + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(0, 0); TileObjectData.newTile.AnchorBottom = default(AnchorData); TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide | AnchorType.SolidBottom | AnchorType.PlanterBox, TileObjectData.newTile.Width, 0); TileObjectData.newTile.DrawYOffset = -2; diff --git a/Tiles/FurnitureSacrilegious/LargeRitualCandleTile.cs b/Tiles/FurnitureSacrilegious/LargeRitualCandleTile.cs index 5701082c22..2632347f0f 100644 --- a/Tiles/FurnitureSacrilegious/LargeRitualCandleTile.cs +++ b/Tiles/FurnitureSacrilegious/LargeRitualCandleTile.cs @@ -45,8 +45,8 @@ namespace CalamityMod.Tiles.FurnitureSacrilegious public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 8, 0f, 0f, 1, new Color(100, 100, 100), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.RedTorch, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Iron, 0f, 0f, 1, new Color(100, 100, 100), 1f); return false; } diff --git a/Tiles/FurnitureSacrilegious/MonolithOfTheAccursedTile.cs b/Tiles/FurnitureSacrilegious/MonolithOfTheAccursedTile.cs index 1755fe2a7e..2a52e46a60 100644 --- a/Tiles/FurnitureSacrilegious/MonolithOfTheAccursedTile.cs +++ b/Tiles/FurnitureSacrilegious/MonolithOfTheAccursedTile.cs @@ -1,7 +1,7 @@ -using CalamityMod.Items.Placeables.FurnitureSacrilegious; +using System; +using CalamityMod.Items.Placeables.FurnitureSacrilegious; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.Audio; using Terraria.DataStructures; @@ -17,6 +17,7 @@ namespace CalamityMod.Tiles.FurnitureSacrilegious { public override void SetStaticDefaults() { + RegisterItemDrop(ModContent.ItemType()); Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; Main.tileNoAttach[Type] = true; @@ -27,7 +28,7 @@ namespace CalamityMod.Tiles.FurnitureSacrilegious { 16, 16, - 16 + 16 }; TileObjectData.newTile.Origin = new Point16(0, 1); TileObjectData.newTile.UsesCustomCanPlace = true; @@ -43,8 +44,8 @@ namespace CalamityMod.Tiles.FurnitureSacrilegious public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 8, 0f, 0f, 1, new Color(100, 100, 100), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.RedTorch, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Iron, 0f, 0f, 1, new Color(100, 100, 100), 1f); return false; } @@ -52,9 +53,9 @@ namespace CalamityMod.Tiles.FurnitureSacrilegious { if (Main.tile[i, j].TileFrameX > 36) { - r = 1.2f; - g = 0.2f; - b = 0.2f; + r = 1.2f; + g = 0.2f; + b = 0.2f; } else { @@ -66,8 +67,8 @@ namespace CalamityMod.Tiles.FurnitureSacrilegious private void ToggleMode(int i, int j) { - int tileX = 2; - int tileY = 3; + int tileX = 2; + int tileY = 3; int x = i - Main.tile[i, j].TileFrameX / 18 % tileX; int y = j - Main.tile[i, j].TileFrameY / 18 % tileY; @@ -101,27 +102,27 @@ namespace CalamityMod.Tiles.FurnitureSacrilegious } public override bool RightClick(int i, int j) - { - ToggleMode(i, j); - SoundEngine.PlaySound(SoundID.MenuTick); - return true; - } + { + ToggleMode(i, j); + SoundEngine.PlaySound(SoundID.MenuTick); + return true; + } public override void HitWire(int i, int j) => ToggleMode(i, j); public override void NearbyEffects(int i, int j, bool closer) { if (Main.tile[i, j].TileFrameX < 36) - return; + return; Player player = Main.LocalPlayer; if (player is null) return; if (player.active) - { - int resetAmt = Main.tile[i, j].TileFrameX < 72 ? 20 : 40; + { + int resetAmt = Main.tile[i, j].TileFrameX < 72 ? 20 : 40; player.Calamity().monolithAccursedShader = resetAmt; - } + } } public override void NumDust(int i, int j, bool fail, ref int num) @@ -131,31 +132,31 @@ namespace CalamityMod.Tiles.FurnitureSacrilegious public override void MouseOver(int i, int j) => CalamityUtils.MouseOver(i, j, ModContent.ItemType()); - // For drawing the floating icon + // For drawing the floating icon public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { if (Main.tile[i, j].TileFrameX < 36) - return; + return; - Texture2D texture = ModContent.Request("CalamityMod/Tiles/FurnitureSacrilegious/MonolithOfTheAccursedTile_IconRight").Value; + Texture2D texture = ModContent.Request("CalamityMod/Tiles/FurnitureSacrilegious/MonolithOfTheAccursedTile_IconRight").Value; Tile tile = Main.tile[i, j]; - int xPos = tile.TileFrameX; + int xPos = tile.TileFrameX; int yPos = tile.TileFrameY; Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); - float xOffset = Main.tile[i, j].TileFrameX > 70 ? 52f : 16f; - Vector2 correction = new Vector2(xOffset , -10f); + float xOffset = Main.tile[i, j].TileFrameX > 70 ? 52f : 16f; + Vector2 correction = new Vector2(xOffset, -10f); float yOffset = (float)Math.Sin(Main.GlobalTimeWrappedHourly * MathHelper.TwoPi / 5f) * 2f; Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y + yOffset) + zero + correction; - Rectangle rect = new Rectangle(xPos, yPos, texture.Width, texture.Height); - Color color = new Color(100, 100, 100, 0); + Rectangle rect = new Rectangle(xPos, yPos, texture.Width, texture.Height); + Color color = new Color(100, 100, 100, 0); Vector2 origin = rect.Size() / 2f; for (int c = 0; c < 5; c++) { - spriteBatch.Draw(texture, drawOffset, rect, color, 0f, origin, 1f, SpriteEffects.None, 0f); - } - } + spriteBatch.Draw(texture, drawOffset, rect, color, 0f, origin, 1f, SpriteEffects.None, 0f); + } + } } } diff --git a/Tiles/FurnitureSacrilegious/OccultBrickTile.cs b/Tiles/FurnitureSacrilegious/OccultBrickTile.cs index 3eaa0b359d..f6f44e9d73 100644 --- a/Tiles/FurnitureSacrilegious/OccultBrickTile.cs +++ b/Tiles/FurnitureSacrilegious/OccultBrickTile.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Placeables.FurnitureSacrilegious; +using CalamityMod.Items.Placeables.FurnitureSacrilegious; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; diff --git a/Tiles/FurnitureSacrilegious/OccultLegionnaireBannerTile.cs b/Tiles/FurnitureSacrilegious/OccultLegionnaireBannerTile.cs index e07e0f5435..30ad06d0e1 100644 --- a/Tiles/FurnitureSacrilegious/OccultLegionnaireBannerTile.cs +++ b/Tiles/FurnitureSacrilegious/OccultLegionnaireBannerTile.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Placeables.FurnitureSacrilegious; +using CalamityMod.Items.Placeables.FurnitureSacrilegious; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -21,9 +21,9 @@ namespace CalamityMod.Tiles.FurnitureSacrilegious TileObjectData.newTile.CopyFrom(TileObjectData.Style2xX); TileObjectData.newTile.LavaDeath = false; - TileObjectData.newTile.Height = 3; - TileObjectData.newTile.Origin = new Point16(0, 0); - TileObjectData.newTile.AnchorBottom = default(AnchorData); + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(0, 0); + TileObjectData.newTile.AnchorBottom = default(AnchorData); TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide | AnchorType.SolidBottom | AnchorType.PlanterBox, TileObjectData.newTile.Width, 0); TileObjectData.newTile.DrawYOffset = -2; TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); diff --git a/Tiles/FurnitureSacrilegious/OccultPlatformTile.cs b/Tiles/FurnitureSacrilegious/OccultPlatformTile.cs index ff3bb6aa7d..779d63dad1 100644 --- a/Tiles/FurnitureSacrilegious/OccultPlatformTile.cs +++ b/Tiles/FurnitureSacrilegious/OccultPlatformTile.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Placeables.FurnitureSacrilegious; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureSacrilegious @@ -12,7 +13,7 @@ namespace CalamityMod.Tiles.FurnitureSacrilegious public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 8, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Iron, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureSacrilegious/RitualCandleTile.cs b/Tiles/FurnitureSacrilegious/RitualCandleTile.cs index 51fc8e7a0b..1803f16fbd 100644 --- a/Tiles/FurnitureSacrilegious/RitualCandleTile.cs +++ b/Tiles/FurnitureSacrilegious/RitualCandleTile.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Tiles.FurnitureSacrilegious public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.RedTorch, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureSacrilegious/SacrilegiousBathtubTile.cs b/Tiles/FurnitureSacrilegious/SacrilegiousBathtubTile.cs index e02475b03c..7aaa5d62a1 100644 --- a/Tiles/FurnitureSacrilegious/SacrilegiousBathtubTile.cs +++ b/Tiles/FurnitureSacrilegious/SacrilegiousBathtubTile.cs @@ -1,7 +1,9 @@ using CalamityMod.Items.Placeables.FurnitureSacrilegious; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Tiles.FurnitureSacrilegious { public class SacrilegiousBathtubTile : ModTile @@ -10,7 +12,7 @@ namespace CalamityMod.Tiles.FurnitureSacrilegious public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 8, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Iron, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureSacrilegious/SacrilegiousBedTile.cs b/Tiles/FurnitureSacrilegious/SacrilegiousBedTile.cs index be10b3ed12..ba542aa035 100644 --- a/Tiles/FurnitureSacrilegious/SacrilegiousBedTile.cs +++ b/Tiles/FurnitureSacrilegious/SacrilegiousBedTile.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureSacrilegious @@ -12,7 +13,7 @@ namespace CalamityMod.Tiles.FurnitureSacrilegious public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 8, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Iron, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureSacrilegious/SacrilegiousBenchTile.cs b/Tiles/FurnitureSacrilegious/SacrilegiousBenchTile.cs index db79370a24..61ee2f146f 100644 --- a/Tiles/FurnitureSacrilegious/SacrilegiousBenchTile.cs +++ b/Tiles/FurnitureSacrilegious/SacrilegiousBenchTile.cs @@ -4,7 +4,9 @@ using Terraria; using Terraria.DataStructures; using Terraria.GameContent; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Tiles.FurnitureSacrilegious { public class SacrilegiousBenchTile : ModTile @@ -13,7 +15,7 @@ namespace CalamityMod.Tiles.FurnitureSacrilegious public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 8, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Iron, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureSacrilegious/SacrilegiousBookcaseTile.cs b/Tiles/FurnitureSacrilegious/SacrilegiousBookcaseTile.cs index 487c50662a..94ab7a49de 100644 --- a/Tiles/FurnitureSacrilegious/SacrilegiousBookcaseTile.cs +++ b/Tiles/FurnitureSacrilegious/SacrilegiousBookcaseTile.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Placeables.FurnitureSacrilegious; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureSacrilegious @@ -11,7 +12,7 @@ namespace CalamityMod.Tiles.FurnitureSacrilegious public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 8, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Iron, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureSacrilegious/SacrilegiousCandelabraTile.cs b/Tiles/FurnitureSacrilegious/SacrilegiousCandelabraTile.cs index e570e8bd46..5fe0158dd9 100644 --- a/Tiles/FurnitureSacrilegious/SacrilegiousCandelabraTile.cs +++ b/Tiles/FurnitureSacrilegious/SacrilegiousCandelabraTile.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureSacrilegious @@ -12,7 +13,7 @@ namespace CalamityMod.Tiles.FurnitureSacrilegious public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 8, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Iron, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureSacrilegious/SacrilegiousCandleTile.cs b/Tiles/FurnitureSacrilegious/SacrilegiousCandleTile.cs index ad6f1d32a9..cad5d38d19 100644 --- a/Tiles/FurnitureSacrilegious/SacrilegiousCandleTile.cs +++ b/Tiles/FurnitureSacrilegious/SacrilegiousCandleTile.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureSacrilegious @@ -12,8 +13,8 @@ namespace CalamityMod.Tiles.FurnitureSacrilegious public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 8, 0f, 0f, 1, new Color(100, 100, 100), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.RedTorch, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Iron, 0f, 0f, 1, new Color(100, 100, 100), 1f); return false; } diff --git a/Tiles/FurnitureSacrilegious/SacrilegiousChairTile.cs b/Tiles/FurnitureSacrilegious/SacrilegiousChairTile.cs index cbab884a74..08d0042ceb 100644 --- a/Tiles/FurnitureSacrilegious/SacrilegiousChairTile.cs +++ b/Tiles/FurnitureSacrilegious/SacrilegiousChairTile.cs @@ -4,6 +4,7 @@ using Terraria; using Terraria.DataStructures; using Terraria.GameContent; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureSacrilegious @@ -14,7 +15,7 @@ namespace CalamityMod.Tiles.FurnitureSacrilegious public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 8, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Iron, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureSacrilegious/SacrilegiousChandelierTile.cs b/Tiles/FurnitureSacrilegious/SacrilegiousChandelierTile.cs index 35abe96c40..1c45c5d278 100644 --- a/Tiles/FurnitureSacrilegious/SacrilegiousChandelierTile.cs +++ b/Tiles/FurnitureSacrilegious/SacrilegiousChandelierTile.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureSacrilegious @@ -12,8 +13,8 @@ namespace CalamityMod.Tiles.FurnitureSacrilegious public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 8, 0f, 0f, 1, new Color(100, 100, 100), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.RedTorch, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Iron, 0f, 0f, 1, new Color(100, 100, 100), 1f); return false; } diff --git a/Tiles/FurnitureSacrilegious/SacrilegiousChestTile.cs b/Tiles/FurnitureSacrilegious/SacrilegiousChestTile.cs index c2649de381..ec62598f02 100644 --- a/Tiles/FurnitureSacrilegious/SacrilegiousChestTile.cs +++ b/Tiles/FurnitureSacrilegious/SacrilegiousChestTile.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; @@ -19,7 +20,7 @@ namespace CalamityMod.Tiles.FurnitureSacrilegious public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 8, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Iron, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; @@ -116,7 +117,7 @@ namespace CalamityMod.Tiles.FurnitureSacrilegious } return amt; } - + byte Average(byte a, byte b) => (byte)((a + b) / 2); } } diff --git a/Tiles/FurnitureSacrilegious/SacrilegiousClockTile.cs b/Tiles/FurnitureSacrilegious/SacrilegiousClockTile.cs index 2a91358d1c..94b8795431 100644 --- a/Tiles/FurnitureSacrilegious/SacrilegiousClockTile.cs +++ b/Tiles/FurnitureSacrilegious/SacrilegiousClockTile.cs @@ -24,8 +24,8 @@ namespace CalamityMod.Tiles.FurnitureSacrilegious public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 8, 0f, 0f, 1, new Color(100, 100, 100), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.RedTorch, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Iron, 0f, 0f, 1, new Color(100, 100, 100), 1f); return false; } @@ -63,7 +63,7 @@ namespace CalamityMod.Tiles.FurnitureSacrilegious Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); float yOffset = (float)Math.Sin(Main.GlobalTimeWrappedHourly * MathHelper.TwoPi / 5f) * 2f; - Vector2 correction = new Vector2(16f , -10f); + Vector2 correction = new Vector2(16f, -10f); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y + yOffset) + zero + correction; Rectangle rect = new Rectangle(xPos, yPos, texture.Width, texture.Height); diff --git a/Tiles/FurnitureSacrilegious/SacrilegiousDoorClosed.cs b/Tiles/FurnitureSacrilegious/SacrilegiousDoorClosed.cs index 4298cedfde..08f5173953 100644 --- a/Tiles/FurnitureSacrilegious/SacrilegiousDoorClosed.cs +++ b/Tiles/FurnitureSacrilegious/SacrilegiousDoorClosed.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Tiles.FurnitureSacrilegious public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 8, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Iron, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureSacrilegious/SacrilegiousDoorOpen.cs b/Tiles/FurnitureSacrilegious/SacrilegiousDoorOpen.cs index 7c3b5f5586..14a83aef62 100644 --- a/Tiles/FurnitureSacrilegious/SacrilegiousDoorOpen.cs +++ b/Tiles/FurnitureSacrilegious/SacrilegiousDoorOpen.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Tiles.FurnitureSacrilegious public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 8, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Iron, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureSacrilegious/SacrilegiousDresserTile.cs b/Tiles/FurnitureSacrilegious/SacrilegiousDresserTile.cs index 217a686570..de22f04c1a 100644 --- a/Tiles/FurnitureSacrilegious/SacrilegiousDresserTile.cs +++ b/Tiles/FurnitureSacrilegious/SacrilegiousDresserTile.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -17,7 +18,7 @@ namespace CalamityMod.Tiles.FurnitureSacrilegious public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 8, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Iron, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; diff --git a/Tiles/FurnitureSacrilegious/SacrilegiousLampTile.cs b/Tiles/FurnitureSacrilegious/SacrilegiousLampTile.cs index 61eaca73c9..f6e6aac93a 100644 --- a/Tiles/FurnitureSacrilegious/SacrilegiousLampTile.cs +++ b/Tiles/FurnitureSacrilegious/SacrilegiousLampTile.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureSacrilegious @@ -12,8 +13,8 @@ namespace CalamityMod.Tiles.FurnitureSacrilegious public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 8, 0f, 0f, 1, new Color(100, 100, 100), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.RedTorch, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Iron, 0f, 0f, 1, new Color(100, 100, 100), 1f); return false; } diff --git a/Tiles/FurnitureSacrilegious/SacrilegiousLanternTile.cs b/Tiles/FurnitureSacrilegious/SacrilegiousLanternTile.cs index 1a5883322d..ce4ead0866 100644 --- a/Tiles/FurnitureSacrilegious/SacrilegiousLanternTile.cs +++ b/Tiles/FurnitureSacrilegious/SacrilegiousLanternTile.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureSacrilegious @@ -13,8 +14,8 @@ namespace CalamityMod.Tiles.FurnitureSacrilegious public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 8, 0f, 0f, 1, new Color(100, 100, 100), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.RedTorch, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Iron, 0f, 0f, 1, new Color(100, 100, 100), 1f); return false; } diff --git a/Tiles/FurnitureSacrilegious/SacrilegiousOrganTile.cs b/Tiles/FurnitureSacrilegious/SacrilegiousOrganTile.cs index fd08fc5ed5..40d760b9de 100644 --- a/Tiles/FurnitureSacrilegious/SacrilegiousOrganTile.cs +++ b/Tiles/FurnitureSacrilegious/SacrilegiousOrganTile.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Tiles.FurnitureSacrilegious public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 8, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Iron, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureSacrilegious/SacrilegiousSinkTile.cs b/Tiles/FurnitureSacrilegious/SacrilegiousSinkTile.cs index c99712cbec..eef56171c6 100644 --- a/Tiles/FurnitureSacrilegious/SacrilegiousSinkTile.cs +++ b/Tiles/FurnitureSacrilegious/SacrilegiousSinkTile.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Placeables.FurnitureSacrilegious; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureSacrilegious @@ -11,7 +12,7 @@ namespace CalamityMod.Tiles.FurnitureSacrilegious public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 8, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Iron, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureSacrilegious/SacrilegiousTableTile.cs b/Tiles/FurnitureSacrilegious/SacrilegiousTableTile.cs index c3a3911b99..2162e5dd69 100644 --- a/Tiles/FurnitureSacrilegious/SacrilegiousTableTile.cs +++ b/Tiles/FurnitureSacrilegious/SacrilegiousTableTile.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Placeables.FurnitureSacrilegious; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureSacrilegious @@ -11,7 +12,7 @@ namespace CalamityMod.Tiles.FurnitureSacrilegious public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 8, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Iron, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureSacrilegious/SacrilegiousWorkBenchTile.cs b/Tiles/FurnitureSacrilegious/SacrilegiousWorkBenchTile.cs index 42d12d7929..12896234d1 100644 --- a/Tiles/FurnitureSacrilegious/SacrilegiousWorkBenchTile.cs +++ b/Tiles/FurnitureSacrilegious/SacrilegiousWorkBenchTile.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Placeables.FurnitureSacrilegious; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureSacrilegious @@ -11,7 +12,7 @@ namespace CalamityMod.Tiles.FurnitureSacrilegious public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 8, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Iron, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureSilva/SilvaBathtub.cs b/Tiles/FurnitureSilva/SilvaBathtub.cs index 96d9f59e34..a58cb0f442 100644 --- a/Tiles/FurnitureSilva/SilvaBathtub.cs +++ b/Tiles/FurnitureSilva/SilvaBathtub.cs @@ -1,7 +1,9 @@ using CalamityMod.Dusts.Furniture; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Tiles.FurnitureSilva { public class SilvaBathtub : ModTile @@ -11,7 +13,7 @@ namespace CalamityMod.Tiles.FurnitureSilva public override bool CreateDust(int i, int j, ref int type) { Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, ModContent.DustType(), 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 157, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.ChlorophyteWeapon, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureSilva/SilvaBed.cs b/Tiles/FurnitureSilva/SilvaBed.cs index aace3579f9..4f1ef100c1 100644 --- a/Tiles/FurnitureSilva/SilvaBed.cs +++ b/Tiles/FurnitureSilva/SilvaBed.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureSilva @@ -13,7 +14,7 @@ namespace CalamityMod.Tiles.FurnitureSilva public override bool CreateDust(int i, int j, ref int type) { Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, ModContent.DustType(), 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 157, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.ChlorophyteWeapon, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureSilva/SilvaBench.cs b/Tiles/FurnitureSilva/SilvaBench.cs index 3705e93867..a21558638e 100644 --- a/Tiles/FurnitureSilva/SilvaBench.cs +++ b/Tiles/FurnitureSilva/SilvaBench.cs @@ -4,7 +4,9 @@ using Terraria; using Terraria.DataStructures; using Terraria.GameContent; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Tiles.FurnitureSilva { public class SilvaBench : ModTile @@ -14,7 +16,7 @@ namespace CalamityMod.Tiles.FurnitureSilva public override bool CreateDust(int i, int j, ref int type) { Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, ModContent.DustType(), 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 157, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.ChlorophyteWeapon, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureSilva/SilvaBookcase.cs b/Tiles/FurnitureSilva/SilvaBookcase.cs index b21dd014fd..ae8e7e0a59 100644 --- a/Tiles/FurnitureSilva/SilvaBookcase.cs +++ b/Tiles/FurnitureSilva/SilvaBookcase.cs @@ -1,6 +1,7 @@ using CalamityMod.Dusts.Furniture; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureSilva @@ -12,7 +13,7 @@ namespace CalamityMod.Tiles.FurnitureSilva public override bool CreateDust(int i, int j, ref int type) { Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, ModContent.DustType(), 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 157, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.ChlorophyteWeapon, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureSilva/SilvaCandelabra.cs b/Tiles/FurnitureSilva/SilvaCandelabra.cs index 41315f71b4..747c08e45f 100644 --- a/Tiles/FurnitureSilva/SilvaCandelabra.cs +++ b/Tiles/FurnitureSilva/SilvaCandelabra.cs @@ -1,6 +1,7 @@ using CalamityMod.Dusts.Furniture; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureSilva @@ -12,7 +13,7 @@ namespace CalamityMod.Tiles.FurnitureSilva public override bool CreateDust(int i, int j, ref int type) { Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, ModContent.DustType(), 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 157, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.ChlorophyteWeapon, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureSilva/SilvaCandle.cs b/Tiles/FurnitureSilva/SilvaCandle.cs index 3518b62de2..ae1a7bca85 100644 --- a/Tiles/FurnitureSilva/SilvaCandle.cs +++ b/Tiles/FurnitureSilva/SilvaCandle.cs @@ -1,6 +1,7 @@ using CalamityMod.Dusts.Furniture; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureSilva @@ -12,7 +13,7 @@ namespace CalamityMod.Tiles.FurnitureSilva public override bool CreateDust(int i, int j, ref int type) { Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, ModContent.DustType(), 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 157, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.ChlorophyteWeapon, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureSilva/SilvaChair.cs b/Tiles/FurnitureSilva/SilvaChair.cs index e5f7493fcf..3fd04494d7 100644 --- a/Tiles/FurnitureSilva/SilvaChair.cs +++ b/Tiles/FurnitureSilva/SilvaChair.cs @@ -4,6 +4,7 @@ using Terraria; using Terraria.DataStructures; using Terraria.GameContent; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureSilva @@ -15,7 +16,7 @@ namespace CalamityMod.Tiles.FurnitureSilva public override bool CreateDust(int i, int j, ref int type) { Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, ModContent.DustType(), 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 157, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.ChlorophyteWeapon, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureSilva/SilvaChandelier.cs b/Tiles/FurnitureSilva/SilvaChandelier.cs index 19f179a42e..ad6a0e8867 100644 --- a/Tiles/FurnitureSilva/SilvaChandelier.cs +++ b/Tiles/FurnitureSilva/SilvaChandelier.cs @@ -1,6 +1,7 @@ using CalamityMod.Dusts.Furniture; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureSilva @@ -12,7 +13,7 @@ namespace CalamityMod.Tiles.FurnitureSilva public override bool CreateDust(int i, int j, ref int type) { Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, ModContent.DustType(), 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 157, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.ChlorophyteWeapon, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureSilva/SilvaChest.cs b/Tiles/FurnitureSilva/SilvaChest.cs index 9bf973c3b3..3bf50fecd6 100644 --- a/Tiles/FurnitureSilva/SilvaChest.cs +++ b/Tiles/FurnitureSilva/SilvaChest.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -18,7 +19,7 @@ namespace CalamityMod.Tiles.FurnitureSilva public override bool CreateDust(int i, int j, ref int type) { Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, ModContent.DustType(), 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 157, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.ChlorophyteWeapon, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; diff --git a/Tiles/FurnitureSilva/SilvaClock.cs b/Tiles/FurnitureSilva/SilvaClock.cs index 44d5696f17..22a2c2b55a 100644 --- a/Tiles/FurnitureSilva/SilvaClock.cs +++ b/Tiles/FurnitureSilva/SilvaClock.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureSilva @@ -15,7 +16,7 @@ namespace CalamityMod.Tiles.FurnitureSilva public override bool CreateDust(int i, int j, ref int type) { Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, ModContent.DustType(), 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 157, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.ChlorophyteWeapon, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureSilva/SilvaCrystal.cs b/Tiles/FurnitureSilva/SilvaCrystal.cs index 65c7e86094..eaeed00095 100644 --- a/Tiles/FurnitureSilva/SilvaCrystal.cs +++ b/Tiles/FurnitureSilva/SilvaCrystal.cs @@ -1,9 +1,9 @@ - + using CalamityMod.Dusts.Furniture; using Microsoft.Xna.Framework; using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureSilva { @@ -22,7 +22,7 @@ namespace CalamityMod.Tiles.FurnitureSilva public override bool CreateDust(int i, int j, ref int type) { Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, ModContent.DustType(), 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 157, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.ChlorophyteWeapon, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureSilva/SilvaDoorClosed.cs b/Tiles/FurnitureSilva/SilvaDoorClosed.cs index 34ac4a6bc7..6e02402a04 100644 --- a/Tiles/FurnitureSilva/SilvaDoorClosed.cs +++ b/Tiles/FurnitureSilva/SilvaDoorClosed.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Tiles.FurnitureSilva public override bool CreateDust(int i, int j, ref int type) { Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, ModContent.DustType(), 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 157, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.ChlorophyteWeapon, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureSilva/SilvaDoorOpen.cs b/Tiles/FurnitureSilva/SilvaDoorOpen.cs index 754ca02de0..0e223a84d6 100644 --- a/Tiles/FurnitureSilva/SilvaDoorOpen.cs +++ b/Tiles/FurnitureSilva/SilvaDoorOpen.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Tiles.FurnitureSilva public override bool CreateDust(int i, int j, ref int type) { Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, ModContent.DustType(), 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 157, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.ChlorophyteWeapon, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureSilva/SilvaDresser.cs b/Tiles/FurnitureSilva/SilvaDresser.cs index 4e7d2cc03c..43c30508c9 100644 --- a/Tiles/FurnitureSilva/SilvaDresser.cs +++ b/Tiles/FurnitureSilva/SilvaDresser.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -18,7 +19,7 @@ namespace CalamityMod.Tiles.FurnitureSilva public override bool CreateDust(int i, int j, ref int type) { Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, ModContent.DustType(), 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 157, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.ChlorophyteWeapon, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; diff --git a/Tiles/FurnitureSilva/SilvaLamp.cs b/Tiles/FurnitureSilva/SilvaLamp.cs index 0b72bc57bb..341872b778 100644 --- a/Tiles/FurnitureSilva/SilvaLamp.cs +++ b/Tiles/FurnitureSilva/SilvaLamp.cs @@ -1,6 +1,7 @@ using CalamityMod.Dusts.Furniture; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureSilva @@ -12,7 +13,7 @@ namespace CalamityMod.Tiles.FurnitureSilva public override bool CreateDust(int i, int j, ref int type) { Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, ModContent.DustType(), 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 157, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.ChlorophyteWeapon, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureSilva/SilvaLantern.cs b/Tiles/FurnitureSilva/SilvaLantern.cs index fbc4f618b7..e0b314a458 100644 --- a/Tiles/FurnitureSilva/SilvaLantern.cs +++ b/Tiles/FurnitureSilva/SilvaLantern.cs @@ -1,6 +1,7 @@ using CalamityMod.Dusts.Furniture; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureSilva @@ -13,7 +14,7 @@ namespace CalamityMod.Tiles.FurnitureSilva public override bool CreateDust(int i, int j, ref int type) { Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, ModContent.DustType(), 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 157, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.ChlorophyteWeapon, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureSilva/SilvaPiano.cs b/Tiles/FurnitureSilva/SilvaPiano.cs index 5461f9f0d0..714d562d66 100644 --- a/Tiles/FurnitureSilva/SilvaPiano.cs +++ b/Tiles/FurnitureSilva/SilvaPiano.cs @@ -1,7 +1,9 @@ using CalamityMod.Dusts.Furniture; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Tiles.FurnitureSilva { public class SilvaPiano : ModTile @@ -11,7 +13,7 @@ namespace CalamityMod.Tiles.FurnitureSilva public override bool CreateDust(int i, int j, ref int type) { Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, ModContent.DustType(), 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 157, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.ChlorophyteWeapon, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureSilva/SilvaPlatform.cs b/Tiles/FurnitureSilva/SilvaPlatform.cs index c7f2680439..121d072d7a 100644 --- a/Tiles/FurnitureSilva/SilvaPlatform.cs +++ b/Tiles/FurnitureSilva/SilvaPlatform.cs @@ -1,6 +1,7 @@ using CalamityMod.Dusts.Furniture; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureSilva @@ -12,7 +13,7 @@ namespace CalamityMod.Tiles.FurnitureSilva public override bool CreateDust(int i, int j, ref int type) { Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, ModContent.DustType(), 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 157, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.ChlorophyteWeapon, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureSilva/SilvaSink.cs b/Tiles/FurnitureSilva/SilvaSink.cs index 8b59dd1296..79765312f4 100644 --- a/Tiles/FurnitureSilva/SilvaSink.cs +++ b/Tiles/FurnitureSilva/SilvaSink.cs @@ -1,6 +1,7 @@ using CalamityMod.Dusts.Furniture; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureSilva @@ -12,7 +13,7 @@ namespace CalamityMod.Tiles.FurnitureSilva public override bool CreateDust(int i, int j, ref int type) { Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, ModContent.DustType(), 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 157, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.ChlorophyteWeapon, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureSilva/SilvaTable.cs b/Tiles/FurnitureSilva/SilvaTable.cs index 837ba2ebb8..9623b75a9f 100644 --- a/Tiles/FurnitureSilva/SilvaTable.cs +++ b/Tiles/FurnitureSilva/SilvaTable.cs @@ -1,6 +1,7 @@ using CalamityMod.Dusts.Furniture; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureSilva @@ -12,7 +13,7 @@ namespace CalamityMod.Tiles.FurnitureSilva public override bool CreateDust(int i, int j, ref int type) { Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, ModContent.DustType(), 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 157, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.ChlorophyteWeapon, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureSilva/SilvaWorkBench.cs b/Tiles/FurnitureSilva/SilvaWorkBench.cs index f7bd644af4..87d4ed8aa5 100644 --- a/Tiles/FurnitureSilva/SilvaWorkBench.cs +++ b/Tiles/FurnitureSilva/SilvaWorkBench.cs @@ -1,6 +1,7 @@ using CalamityMod.Dusts.Furniture; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureSilva @@ -12,7 +13,7 @@ namespace CalamityMod.Tiles.FurnitureSilva public override bool CreateDust(int i, int j, ref int type) { Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, ModContent.DustType(), 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 157, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.ChlorophyteWeapon, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureStatigel/StatigelBath.cs b/Tiles/FurnitureStatigel/StatigelBath.cs index 9dba857548..6f772d26d4 100644 --- a/Tiles/FurnitureStatigel/StatigelBath.cs +++ b/Tiles/FurnitureStatigel/StatigelBath.cs @@ -1,6 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Tiles.FurnitureStatigel { public class StatigelBath : ModTile @@ -9,7 +11,7 @@ namespace CalamityMod.Tiles.FurnitureStatigel public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 243, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.PinkSlime, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureStatigel/StatigelBed.cs b/Tiles/FurnitureStatigel/StatigelBed.cs index 82d318aec7..791ea04221 100644 --- a/Tiles/FurnitureStatigel/StatigelBed.cs +++ b/Tiles/FurnitureStatigel/StatigelBed.cs @@ -1,6 +1,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureStatigel @@ -11,7 +12,7 @@ namespace CalamityMod.Tiles.FurnitureStatigel public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 243, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.PinkSlime, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureStatigel/StatigelBlock.cs b/Tiles/FurnitureStatigel/StatigelBlock.cs index 27e66f6467..29b9d1714f 100644 --- a/Tiles/FurnitureStatigel/StatigelBlock.cs +++ b/Tiles/FurnitureStatigel/StatigelBlock.cs @@ -1,7 +1,10 @@ - + using Microsoft.Xna.Framework; using Terraria; +using Terraria.GameContent.Metadata; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Tiles.FurnitureStatigel { public class StatigelBlock : ModTile @@ -11,6 +14,7 @@ namespace CalamityMod.Tiles.FurnitureStatigel Main.tileSolid[Type] = true; Main.tileMergeDirt[Type] = true; Main.tileBlockLight[Type] = true; + TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["PinkSlime"]); CalamityUtils.MergeWithGeneral(Type); CalamityUtils.MergeDecorativeTiles(Type); @@ -21,7 +25,7 @@ namespace CalamityMod.Tiles.FurnitureStatigel public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 243, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.PinkSlime, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } } diff --git a/Tiles/FurnitureStatigel/StatigelBookcase.cs b/Tiles/FurnitureStatigel/StatigelBookcase.cs index a5661492f7..6696dcf17e 100644 --- a/Tiles/FurnitureStatigel/StatigelBookcase.cs +++ b/Tiles/FurnitureStatigel/StatigelBookcase.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureStatigel @@ -10,7 +11,7 @@ namespace CalamityMod.Tiles.FurnitureStatigel public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 243, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.PinkSlime, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureStatigel/StatigelCandelabra.cs b/Tiles/FurnitureStatigel/StatigelCandelabra.cs index 2945a9bfef..5a9d1dbbb2 100644 --- a/Tiles/FurnitureStatigel/StatigelCandelabra.cs +++ b/Tiles/FurnitureStatigel/StatigelCandelabra.cs @@ -1,6 +1,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureStatigel @@ -11,7 +12,7 @@ namespace CalamityMod.Tiles.FurnitureStatigel public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 243, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.PinkSlime, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureStatigel/StatigelCandle.cs b/Tiles/FurnitureStatigel/StatigelCandle.cs index 754ed0aa2c..b9859dae78 100644 --- a/Tiles/FurnitureStatigel/StatigelCandle.cs +++ b/Tiles/FurnitureStatigel/StatigelCandle.cs @@ -1,6 +1,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureStatigel @@ -11,7 +12,7 @@ namespace CalamityMod.Tiles.FurnitureStatigel public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 243, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.PinkSlime, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureStatigel/StatigelChair.cs b/Tiles/FurnitureStatigel/StatigelChair.cs index b515dcda42..9c9cd11fb9 100644 --- a/Tiles/FurnitureStatigel/StatigelChair.cs +++ b/Tiles/FurnitureStatigel/StatigelChair.cs @@ -3,6 +3,7 @@ using Terraria; using Terraria.DataStructures; using Terraria.GameContent; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureStatigel @@ -13,7 +14,7 @@ namespace CalamityMod.Tiles.FurnitureStatigel public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 243, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.PinkSlime, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureStatigel/StatigelChandelier.cs b/Tiles/FurnitureStatigel/StatigelChandelier.cs index 61cc5e67be..06f8b15c1c 100644 --- a/Tiles/FurnitureStatigel/StatigelChandelier.cs +++ b/Tiles/FurnitureStatigel/StatigelChandelier.cs @@ -1,6 +1,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureStatigel @@ -11,7 +12,7 @@ namespace CalamityMod.Tiles.FurnitureStatigel public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 243, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.PinkSlime, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureStatigel/StatigelChest.cs b/Tiles/FurnitureStatigel/StatigelChest.cs index 9be1dcde80..4939e94c8e 100644 --- a/Tiles/FurnitureStatigel/StatigelChest.cs +++ b/Tiles/FurnitureStatigel/StatigelChest.cs @@ -1,6 +1,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -16,7 +17,7 @@ namespace CalamityMod.Tiles.FurnitureStatigel public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 243, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.PinkSlime, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; diff --git a/Tiles/FurnitureStatigel/StatigelClock.cs b/Tiles/FurnitureStatigel/StatigelClock.cs index f59ccfcd20..b237d509b0 100644 --- a/Tiles/FurnitureStatigel/StatigelClock.cs +++ b/Tiles/FurnitureStatigel/StatigelClock.cs @@ -1,6 +1,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureStatigel @@ -13,7 +14,7 @@ namespace CalamityMod.Tiles.FurnitureStatigel public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 243, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.PinkSlime, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureStatigel/StatigelDoorClosed.cs b/Tiles/FurnitureStatigel/StatigelDoorClosed.cs index 1804d15f84..627c028ab9 100644 --- a/Tiles/FurnitureStatigel/StatigelDoorClosed.cs +++ b/Tiles/FurnitureStatigel/StatigelDoorClosed.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Tiles.FurnitureStatigel public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 243, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.PinkSlime, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureStatigel/StatigelDoorOpen.cs b/Tiles/FurnitureStatigel/StatigelDoorOpen.cs index 2084df73d8..30bb94f330 100644 --- a/Tiles/FurnitureStatigel/StatigelDoorOpen.cs +++ b/Tiles/FurnitureStatigel/StatigelDoorOpen.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Tiles.FurnitureStatigel public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 243, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.PinkSlime, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureStatigel/StatigelDresser.cs b/Tiles/FurnitureStatigel/StatigelDresser.cs index b715a422e9..23eef161ea 100644 --- a/Tiles/FurnitureStatigel/StatigelDresser.cs +++ b/Tiles/FurnitureStatigel/StatigelDresser.cs @@ -1,6 +1,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -16,7 +17,7 @@ namespace CalamityMod.Tiles.FurnitureStatigel public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 243, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.PinkSlime, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; diff --git a/Tiles/FurnitureStatigel/StatigelLamp.cs b/Tiles/FurnitureStatigel/StatigelLamp.cs index 0e4d8fbe27..4ac95139a2 100644 --- a/Tiles/FurnitureStatigel/StatigelLamp.cs +++ b/Tiles/FurnitureStatigel/StatigelLamp.cs @@ -1,6 +1,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureStatigel @@ -11,7 +12,7 @@ namespace CalamityMod.Tiles.FurnitureStatigel public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 243, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.PinkSlime, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureStatigel/StatigelLantern.cs b/Tiles/FurnitureStatigel/StatigelLantern.cs index b8a00bd068..7beb0067ee 100644 --- a/Tiles/FurnitureStatigel/StatigelLantern.cs +++ b/Tiles/FurnitureStatigel/StatigelLantern.cs @@ -1,6 +1,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureStatigel @@ -12,7 +13,7 @@ namespace CalamityMod.Tiles.FurnitureStatigel public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 243, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.PinkSlime, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureStatigel/StatigelPiano.cs b/Tiles/FurnitureStatigel/StatigelPiano.cs index 78417b7baf..6bff3ecf0f 100644 --- a/Tiles/FurnitureStatigel/StatigelPiano.cs +++ b/Tiles/FurnitureStatigel/StatigelPiano.cs @@ -1,6 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Tiles.FurnitureStatigel { public class StatigelPiano : ModTile @@ -9,7 +11,7 @@ namespace CalamityMod.Tiles.FurnitureStatigel public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 243, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.PinkSlime, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureStatigel/StatigelPlatform.cs b/Tiles/FurnitureStatigel/StatigelPlatform.cs index 615a93ded4..4d9806129a 100644 --- a/Tiles/FurnitureStatigel/StatigelPlatform.cs +++ b/Tiles/FurnitureStatigel/StatigelPlatform.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureStatigel @@ -10,7 +11,7 @@ namespace CalamityMod.Tiles.FurnitureStatigel public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 243, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.PinkSlime, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureStatigel/StatigelSink.cs b/Tiles/FurnitureStatigel/StatigelSink.cs index 250be89f95..5f6a30d8d3 100644 --- a/Tiles/FurnitureStatigel/StatigelSink.cs +++ b/Tiles/FurnitureStatigel/StatigelSink.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureStatigel @@ -10,7 +11,7 @@ namespace CalamityMod.Tiles.FurnitureStatigel public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 243, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.PinkSlime, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureStatigel/StatigelSofa.cs b/Tiles/FurnitureStatigel/StatigelSofa.cs index dc3cba8bc7..a350b6c350 100644 --- a/Tiles/FurnitureStatigel/StatigelSofa.cs +++ b/Tiles/FurnitureStatigel/StatigelSofa.cs @@ -3,7 +3,9 @@ using Terraria; using Terraria.DataStructures; using Terraria.GameContent; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Tiles.FurnitureStatigel { public class StatigelSofa : ModTile @@ -12,7 +14,7 @@ namespace CalamityMod.Tiles.FurnitureStatigel public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 243, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.PinkSlime, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureStatigel/StatigelTable.cs b/Tiles/FurnitureStatigel/StatigelTable.cs index bf8bee55a8..cca989784b 100644 --- a/Tiles/FurnitureStatigel/StatigelTable.cs +++ b/Tiles/FurnitureStatigel/StatigelTable.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureStatigel @@ -10,7 +11,7 @@ namespace CalamityMod.Tiles.FurnitureStatigel public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 243, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.PinkSlime, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureStatigel/StatigelWorkBenchTile.cs b/Tiles/FurnitureStatigel/StatigelWorkBenchTile.cs index 9705773b03..f92daf8b08 100644 --- a/Tiles/FurnitureStatigel/StatigelWorkBenchTile.cs +++ b/Tiles/FurnitureStatigel/StatigelWorkBenchTile.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureStatigel @@ -11,7 +12,7 @@ namespace CalamityMod.Tiles.FurnitureStatigel public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 243, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.PinkSlime, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureStratus/StratusBathtub.cs b/Tiles/FurnitureStratus/StratusBathtub.cs index 82f2f2848c..322e2655cd 100644 --- a/Tiles/FurnitureStratus/StratusBathtub.cs +++ b/Tiles/FurnitureStratus/StratusBathtub.cs @@ -1,6 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Tiles.FurnitureStratus { public class StratusBathtub : ModTile @@ -9,8 +11,8 @@ namespace CalamityMod.Tiles.FurnitureStratus 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, 130, 150), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 132, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 130, 150), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Firework_Blue, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureStratus/StratusBed.cs b/Tiles/FurnitureStratus/StratusBed.cs index 25ed59fb12..f24834a6a7 100644 --- a/Tiles/FurnitureStratus/StratusBed.cs +++ b/Tiles/FurnitureStratus/StratusBed.cs @@ -1,6 +1,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureStratus @@ -11,8 +12,8 @@ namespace CalamityMod.Tiles.FurnitureStratus 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, 130, 150), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 132, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 130, 150), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Firework_Blue, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureStratus/StratusBookcase.cs b/Tiles/FurnitureStratus/StratusBookcase.cs index 80807cb312..5903faca38 100644 --- a/Tiles/FurnitureStratus/StratusBookcase.cs +++ b/Tiles/FurnitureStratus/StratusBookcase.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureStratus @@ -10,8 +11,8 @@ namespace CalamityMod.Tiles.FurnitureStratus 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, 130, 150), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 132, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 130, 150), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Firework_Blue, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureStratus/StratusBricks.cs b/Tiles/FurnitureStratus/StratusBricks.cs index 93062b4dc7..aa4f2b7b6f 100644 --- a/Tiles/FurnitureStratus/StratusBricks.cs +++ b/Tiles/FurnitureStratus/StratusBricks.cs @@ -24,8 +24,8 @@ namespace CalamityMod.Tiles.FurnitureStratus 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, 130, 150), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 132, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 130, 150), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Firework_Blue, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureStratus/StratusCandelabra.cs b/Tiles/FurnitureStratus/StratusCandelabra.cs index 941f40a08d..eeb75dbea5 100644 --- a/Tiles/FurnitureStratus/StratusCandelabra.cs +++ b/Tiles/FurnitureStratus/StratusCandelabra.cs @@ -14,8 +14,8 @@ namespace CalamityMod.Tiles.FurnitureStratus 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, 130, 150), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 132, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 130, 150), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Firework_Blue, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } @@ -44,12 +44,12 @@ namespace CalamityMod.Tiles.FurnitureStratus { CalamityUtils.LightHitWire(Type, i, j, 2, 2); } - + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { CalamityUtils.DrawFlameEffect(ModContent.Request("CalamityMod/Tiles/FurnitureStratus/StratusCandelabraFlame").Value, i, j); } - + public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref TileDrawInfo drawData) { Tile tile = Main.tile[i, j]; diff --git a/Tiles/FurnitureStratus/StratusCandle.cs b/Tiles/FurnitureStratus/StratusCandle.cs index 9ec5bb593f..bf134d1086 100644 --- a/Tiles/FurnitureStratus/StratusCandle.cs +++ b/Tiles/FurnitureStratus/StratusCandle.cs @@ -1,6 +1,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureStratus @@ -11,8 +12,8 @@ namespace CalamityMod.Tiles.FurnitureStratus 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, 130, 150), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 132, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 130, 150), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Firework_Blue, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureStratus/StratusChair.cs b/Tiles/FurnitureStratus/StratusChair.cs index 1cf285dee3..9b4dccc784 100644 --- a/Tiles/FurnitureStratus/StratusChair.cs +++ b/Tiles/FurnitureStratus/StratusChair.cs @@ -3,6 +3,7 @@ using Terraria; using Terraria.DataStructures; using Terraria.GameContent; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureStratus @@ -13,8 +14,8 @@ namespace CalamityMod.Tiles.FurnitureStratus 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, 130, 150), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 132, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 130, 150), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Firework_Blue, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureStratus/StratusChandelier.cs b/Tiles/FurnitureStratus/StratusChandelier.cs index 219a2c57ae..28a737cc49 100644 --- a/Tiles/FurnitureStratus/StratusChandelier.cs +++ b/Tiles/FurnitureStratus/StratusChandelier.cs @@ -14,8 +14,8 @@ namespace CalamityMod.Tiles.FurnitureStratus 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, 130, 150), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 132, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 130, 150), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Firework_Blue, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } @@ -44,12 +44,12 @@ namespace CalamityMod.Tiles.FurnitureStratus { CalamityUtils.LightHitWire(Type, i, j, 3, 3); } - + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { CalamityUtils.DrawFlameEffect(ModContent.Request("CalamityMod/Tiles/FurnitureStratus/StratusChandelierFlame").Value, i, j, 0); } - + public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref TileDrawInfo drawData) { Tile tile = Main.tile[i, j]; diff --git a/Tiles/FurnitureStratus/StratusChest.cs b/Tiles/FurnitureStratus/StratusChest.cs index 17a1a451a6..21caec6f74 100644 --- a/Tiles/FurnitureStratus/StratusChest.cs +++ b/Tiles/FurnitureStratus/StratusChest.cs @@ -1,6 +1,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -16,8 +17,8 @@ namespace CalamityMod.Tiles.FurnitureStratus 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, 130, 150), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 132, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 130, 150), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Firework_Blue, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; diff --git a/Tiles/FurnitureStratus/StratusClock.cs b/Tiles/FurnitureStratus/StratusClock.cs index 40cb48eaf3..c5a52534f3 100644 --- a/Tiles/FurnitureStratus/StratusClock.cs +++ b/Tiles/FurnitureStratus/StratusClock.cs @@ -1,6 +1,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureStratus @@ -13,8 +14,8 @@ namespace CalamityMod.Tiles.FurnitureStratus 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, 130, 150), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 132, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 130, 150), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Firework_Blue, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureStratus/StratusDoorClosed.cs b/Tiles/FurnitureStratus/StratusDoorClosed.cs index 8e3b6832bc..5b6f7d119c 100644 --- a/Tiles/FurnitureStratus/StratusDoorClosed.cs +++ b/Tiles/FurnitureStratus/StratusDoorClosed.cs @@ -16,8 +16,8 @@ namespace CalamityMod.Tiles.FurnitureStratus 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, 130, 150), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 132, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 130, 150), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Firework_Blue, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureStratus/StratusDoorOpen.cs b/Tiles/FurnitureStratus/StratusDoorOpen.cs index 2a4bbd04e2..3e2dc7b4a2 100644 --- a/Tiles/FurnitureStratus/StratusDoorOpen.cs +++ b/Tiles/FurnitureStratus/StratusDoorOpen.cs @@ -17,8 +17,8 @@ namespace CalamityMod.Tiles.FurnitureStratus 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, 130, 150), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 132, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 130, 150), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Firework_Blue, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureStratus/StratusDresser.cs b/Tiles/FurnitureStratus/StratusDresser.cs index 6efe87fd43..da8e9ec690 100644 --- a/Tiles/FurnitureStratus/StratusDresser.cs +++ b/Tiles/FurnitureStratus/StratusDresser.cs @@ -1,6 +1,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -16,8 +17,8 @@ namespace CalamityMod.Tiles.FurnitureStratus 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, 130, 150), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 132, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 130, 150), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Firework_Blue, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; diff --git a/Tiles/FurnitureStratus/StratusLamp.cs b/Tiles/FurnitureStratus/StratusLamp.cs index 697b6846c7..032dee1385 100644 --- a/Tiles/FurnitureStratus/StratusLamp.cs +++ b/Tiles/FurnitureStratus/StratusLamp.cs @@ -14,8 +14,8 @@ namespace CalamityMod.Tiles.FurnitureStratus 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, 130, 150), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 132, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 130, 150), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Firework_Blue, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } @@ -44,12 +44,12 @@ namespace CalamityMod.Tiles.FurnitureStratus { CalamityUtils.LightHitWire(Type, i, j, 1, 3); } - + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { CalamityUtils.DrawFlameEffect(ModContent.Request("CalamityMod/Tiles/FurnitureStratus/StratusLampFlame").Value, i, j); } - + public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref TileDrawInfo drawData) { Tile tile = Main.tile[i, j]; diff --git a/Tiles/FurnitureStratus/StratusLantern.cs b/Tiles/FurnitureStratus/StratusLantern.cs index 7f217506b3..1d1d371aef 100644 --- a/Tiles/FurnitureStratus/StratusLantern.cs +++ b/Tiles/FurnitureStratus/StratusLantern.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureStratus @@ -11,8 +12,8 @@ namespace CalamityMod.Tiles.FurnitureStratus 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, 130, 150), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 132, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 130, 150), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Firework_Blue, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureStratus/StratusPiano.cs b/Tiles/FurnitureStratus/StratusPiano.cs index c1713622cb..5ee6af9751 100644 --- a/Tiles/FurnitureStratus/StratusPiano.cs +++ b/Tiles/FurnitureStratus/StratusPiano.cs @@ -1,6 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Tiles.FurnitureStratus { public class StratusPiano : ModTile @@ -9,8 +11,8 @@ namespace CalamityMod.Tiles.FurnitureStratus 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, 130, 150), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 132, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 130, 150), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Firework_Blue, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureStratus/StratusPlatform.cs b/Tiles/FurnitureStratus/StratusPlatform.cs index 2312d1eea9..30d7e3c11e 100644 --- a/Tiles/FurnitureStratus/StratusPlatform.cs +++ b/Tiles/FurnitureStratus/StratusPlatform.cs @@ -1,6 +1,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureStratus @@ -11,8 +12,8 @@ namespace CalamityMod.Tiles.FurnitureStratus 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, 130, 150), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 132, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 130, 150), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Firework_Blue, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureStratus/StratusSink.cs b/Tiles/FurnitureStratus/StratusSink.cs index b7f01768aa..739aa0e53e 100644 --- a/Tiles/FurnitureStratus/StratusSink.cs +++ b/Tiles/FurnitureStratus/StratusSink.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureStratus @@ -10,8 +11,8 @@ namespace CalamityMod.Tiles.FurnitureStratus 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, 130, 150), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 132, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 130, 150), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Firework_Blue, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureStratus/StratusSofa.cs b/Tiles/FurnitureStratus/StratusSofa.cs index c5bc2869bb..a0d409ce33 100644 --- a/Tiles/FurnitureStratus/StratusSofa.cs +++ b/Tiles/FurnitureStratus/StratusSofa.cs @@ -3,7 +3,9 @@ using Terraria; using Terraria.DataStructures; using Terraria.GameContent; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Tiles.FurnitureStratus { public class StratusSofa : ModTile @@ -12,8 +14,8 @@ namespace CalamityMod.Tiles.FurnitureStratus 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, 130, 150), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 132, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 130, 150), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Firework_Blue, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureStratus/StratusStarPlatform.cs b/Tiles/FurnitureStratus/StratusStarPlatform.cs index 42d9ce9543..ba79bc569f 100644 --- a/Tiles/FurnitureStratus/StratusStarPlatform.cs +++ b/Tiles/FurnitureStratus/StratusStarPlatform.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureStratus @@ -12,8 +13,8 @@ namespace CalamityMod.Tiles.FurnitureStratus 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, 130, 150), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 132, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 130, 150), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Firework_Blue, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureStratus/StratusTable.cs b/Tiles/FurnitureStratus/StratusTable.cs index cd6af7ff4f..3bb3d37d97 100644 --- a/Tiles/FurnitureStratus/StratusTable.cs +++ b/Tiles/FurnitureStratus/StratusTable.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureStratus @@ -10,8 +11,8 @@ namespace CalamityMod.Tiles.FurnitureStratus 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, 130, 150), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 132, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 130, 150), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Firework_Blue, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureStratus/StratusWorkBenchTile.cs b/Tiles/FurnitureStratus/StratusWorkBenchTile.cs index b231d37244..38a7315199 100644 --- a/Tiles/FurnitureStratus/StratusWorkBenchTile.cs +++ b/Tiles/FurnitureStratus/StratusWorkBenchTile.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureStratus @@ -11,8 +12,8 @@ namespace CalamityMod.Tiles.FurnitureStratus 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, 130, 150), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 132, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 130, 150), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Firework_Blue, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureVoid/SmoothVoidstone.cs b/Tiles/FurnitureVoid/SmoothVoidstone.cs index 0f58958ee4..1ce2806cc1 100644 --- a/Tiles/FurnitureVoid/SmoothVoidstone.cs +++ b/Tiles/FurnitureVoid/SmoothVoidstone.cs @@ -1,10 +1,10 @@  +using System; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureVoid { @@ -29,7 +29,7 @@ namespace CalamityMod.Tiles.FurnitureVoid public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 180, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.DungeonSpirit, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureVoid/SmoothVoidstonePlatform.cs b/Tiles/FurnitureVoid/SmoothVoidstonePlatform.cs index e1bebb17f1..55e4a9dfb3 100644 --- a/Tiles/FurnitureVoid/SmoothVoidstonePlatform.cs +++ b/Tiles/FurnitureVoid/SmoothVoidstonePlatform.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureVoid @@ -10,7 +11,7 @@ namespace CalamityMod.Tiles.FurnitureVoid public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 180, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.DungeonSpirit, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureVoid/VoidBath.cs b/Tiles/FurnitureVoid/VoidBath.cs index a06fc6291f..51c7e90077 100644 --- a/Tiles/FurnitureVoid/VoidBath.cs +++ b/Tiles/FurnitureVoid/VoidBath.cs @@ -1,6 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Tiles.FurnitureVoid { public class VoidBath : ModTile @@ -9,7 +11,7 @@ namespace CalamityMod.Tiles.FurnitureVoid public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 180, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.DungeonSpirit, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureVoid/VoidBed.cs b/Tiles/FurnitureVoid/VoidBed.cs index c832274bf2..bfffd91a3c 100644 --- a/Tiles/FurnitureVoid/VoidBed.cs +++ b/Tiles/FurnitureVoid/VoidBed.cs @@ -1,6 +1,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureVoid @@ -11,7 +12,7 @@ namespace CalamityMod.Tiles.FurnitureVoid public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 180, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.DungeonSpirit, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureVoid/VoidBookcase.cs b/Tiles/FurnitureVoid/VoidBookcase.cs index ec4cb44b36..01bf0037ca 100644 --- a/Tiles/FurnitureVoid/VoidBookcase.cs +++ b/Tiles/FurnitureVoid/VoidBookcase.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureVoid @@ -10,7 +11,7 @@ namespace CalamityMod.Tiles.FurnitureVoid public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 180, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.DungeonSpirit, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureVoid/VoidCandelabra.cs b/Tiles/FurnitureVoid/VoidCandelabra.cs index 737b315f00..9ba1e8ab86 100644 --- a/Tiles/FurnitureVoid/VoidCandelabra.cs +++ b/Tiles/FurnitureVoid/VoidCandelabra.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureVoid @@ -10,7 +11,7 @@ namespace CalamityMod.Tiles.FurnitureVoid public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 180, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.DungeonSpirit, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureVoid/VoidCandle.cs b/Tiles/FurnitureVoid/VoidCandle.cs index f7942cb3ea..c164925c38 100644 --- a/Tiles/FurnitureVoid/VoidCandle.cs +++ b/Tiles/FurnitureVoid/VoidCandle.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureVoid @@ -10,7 +11,7 @@ namespace CalamityMod.Tiles.FurnitureVoid public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 180, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.DungeonSpirit, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureVoid/VoidChair.cs b/Tiles/FurnitureVoid/VoidChair.cs index 1caf1ac6f7..1385d0f42d 100644 --- a/Tiles/FurnitureVoid/VoidChair.cs +++ b/Tiles/FurnitureVoid/VoidChair.cs @@ -3,6 +3,7 @@ using Terraria; using Terraria.DataStructures; using Terraria.GameContent; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureVoid @@ -13,7 +14,7 @@ namespace CalamityMod.Tiles.FurnitureVoid public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 180, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.DungeonSpirit, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureVoid/VoidChandelier.cs b/Tiles/FurnitureVoid/VoidChandelier.cs index 6b0d5a7c7c..46887dfd37 100644 --- a/Tiles/FurnitureVoid/VoidChandelier.cs +++ b/Tiles/FurnitureVoid/VoidChandelier.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureVoid @@ -10,7 +11,7 @@ namespace CalamityMod.Tiles.FurnitureVoid public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 180, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.DungeonSpirit, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureVoid/VoidChest.cs b/Tiles/FurnitureVoid/VoidChest.cs index cb0da28635..108abdaffa 100644 --- a/Tiles/FurnitureVoid/VoidChest.cs +++ b/Tiles/FurnitureVoid/VoidChest.cs @@ -1,6 +1,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -16,7 +17,7 @@ namespace CalamityMod.Tiles.FurnitureVoid public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 180, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.DungeonSpirit, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; diff --git a/Tiles/FurnitureVoid/VoidClock.cs b/Tiles/FurnitureVoid/VoidClock.cs index 055f7aea36..77a32eda66 100644 --- a/Tiles/FurnitureVoid/VoidClock.cs +++ b/Tiles/FurnitureVoid/VoidClock.cs @@ -1,6 +1,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureVoid @@ -17,7 +18,7 @@ namespace CalamityMod.Tiles.FurnitureVoid public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 180, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.DungeonSpirit, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureVoid/VoidDoorClosed.cs b/Tiles/FurnitureVoid/VoidDoorClosed.cs index ac658c54c9..e4beeea246 100644 --- a/Tiles/FurnitureVoid/VoidDoorClosed.cs +++ b/Tiles/FurnitureVoid/VoidDoorClosed.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Tiles.FurnitureVoid public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 180, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.DungeonSpirit, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureVoid/VoidDoorOpen.cs b/Tiles/FurnitureVoid/VoidDoorOpen.cs index 376b92ef33..411cacd1f5 100644 --- a/Tiles/FurnitureVoid/VoidDoorOpen.cs +++ b/Tiles/FurnitureVoid/VoidDoorOpen.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Tiles.FurnitureVoid public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 180, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.DungeonSpirit, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureVoid/VoidDresser.cs b/Tiles/FurnitureVoid/VoidDresser.cs index a4320211b5..594855f047 100644 --- a/Tiles/FurnitureVoid/VoidDresser.cs +++ b/Tiles/FurnitureVoid/VoidDresser.cs @@ -1,6 +1,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -16,7 +17,7 @@ namespace CalamityMod.Tiles.FurnitureVoid public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 180, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.DungeonSpirit, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; diff --git a/Tiles/FurnitureVoid/VoidLamp.cs b/Tiles/FurnitureVoid/VoidLamp.cs index 0ec8a0b46c..b8ab225744 100644 --- a/Tiles/FurnitureVoid/VoidLamp.cs +++ b/Tiles/FurnitureVoid/VoidLamp.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureVoid @@ -10,7 +11,7 @@ namespace CalamityMod.Tiles.FurnitureVoid public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 180, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.DungeonSpirit, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureVoid/VoidLantern.cs b/Tiles/FurnitureVoid/VoidLantern.cs index 75f0dd3f61..0d0c1d666b 100644 --- a/Tiles/FurnitureVoid/VoidLantern.cs +++ b/Tiles/FurnitureVoid/VoidLantern.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureVoid @@ -11,7 +12,7 @@ namespace CalamityMod.Tiles.FurnitureVoid public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 180, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.DungeonSpirit, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureVoid/VoidPiano.cs b/Tiles/FurnitureVoid/VoidPiano.cs index b4462199fe..c0b2489a82 100644 --- a/Tiles/FurnitureVoid/VoidPiano.cs +++ b/Tiles/FurnitureVoid/VoidPiano.cs @@ -1,6 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Tiles.FurnitureVoid { public class VoidPiano : ModTile @@ -9,7 +11,7 @@ namespace CalamityMod.Tiles.FurnitureVoid public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 180, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.DungeonSpirit, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureVoid/VoidSink.cs b/Tiles/FurnitureVoid/VoidSink.cs index 4c71751927..4db840fd36 100644 --- a/Tiles/FurnitureVoid/VoidSink.cs +++ b/Tiles/FurnitureVoid/VoidSink.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureVoid @@ -10,7 +11,7 @@ namespace CalamityMod.Tiles.FurnitureVoid public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 180, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.DungeonSpirit, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureVoid/VoidSofa.cs b/Tiles/FurnitureVoid/VoidSofa.cs index 19cdc31022..ab18c06775 100644 --- a/Tiles/FurnitureVoid/VoidSofa.cs +++ b/Tiles/FurnitureVoid/VoidSofa.cs @@ -3,7 +3,9 @@ using Terraria; using Terraria.DataStructures; using Terraria.GameContent; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Tiles.FurnitureVoid { public class VoidSofa : ModTile @@ -12,7 +14,7 @@ namespace CalamityMod.Tiles.FurnitureVoid public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 180, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.DungeonSpirit, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureVoid/VoidTable.cs b/Tiles/FurnitureVoid/VoidTable.cs index dc239409d1..77e6c64ad5 100644 --- a/Tiles/FurnitureVoid/VoidTable.cs +++ b/Tiles/FurnitureVoid/VoidTable.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureVoid @@ -10,7 +11,7 @@ namespace CalamityMod.Tiles.FurnitureVoid public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 180, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.DungeonSpirit, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureVoid/VoidWorkBenchTile.cs b/Tiles/FurnitureVoid/VoidWorkBenchTile.cs index bc503f9104..d077ba751d 100644 --- a/Tiles/FurnitureVoid/VoidWorkBenchTile.cs +++ b/Tiles/FurnitureVoid/VoidWorkBenchTile.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureVoid @@ -11,7 +12,7 @@ namespace CalamityMod.Tiles.FurnitureVoid public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 180, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.DungeonSpirit, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureVoid/VoidstoneSlab.cs b/Tiles/FurnitureVoid/VoidstoneSlab.cs index a225d5eb71..1acda50480 100644 --- a/Tiles/FurnitureVoid/VoidstoneSlab.cs +++ b/Tiles/FurnitureVoid/VoidstoneSlab.cs @@ -1,8 +1,8 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureVoid { @@ -22,7 +22,7 @@ namespace CalamityMod.Tiles.FurnitureVoid public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 180, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.DungeonSpirit, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureWulfrum/WulfrumBathtub.cs b/Tiles/FurnitureWulfrum/WulfrumBathtub.cs index 5e2523f245..269e53f673 100644 --- a/Tiles/FurnitureWulfrum/WulfrumBathtub.cs +++ b/Tiles/FurnitureWulfrum/WulfrumBathtub.cs @@ -1,7 +1,9 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Tiles.FurnitureWulfrum { public class WulfrumBathtub : ModTile @@ -12,7 +14,7 @@ namespace CalamityMod.Tiles.FurnitureWulfrum public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 107, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.TerraBlade, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureWulfrum/WulfrumBed.cs b/Tiles/FurnitureWulfrum/WulfrumBed.cs index f8200dff21..76db64317d 100644 --- a/Tiles/FurnitureWulfrum/WulfrumBed.cs +++ b/Tiles/FurnitureWulfrum/WulfrumBed.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureWulfrum @@ -14,7 +15,7 @@ namespace CalamityMod.Tiles.FurnitureWulfrum public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 107, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.TerraBlade, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureWulfrum/WulfrumBookcase.cs b/Tiles/FurnitureWulfrum/WulfrumBookcase.cs index 174c87cc43..236092fa3f 100644 --- a/Tiles/FurnitureWulfrum/WulfrumBookcase.cs +++ b/Tiles/FurnitureWulfrum/WulfrumBookcase.cs @@ -1,6 +1,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureWulfrum @@ -13,7 +14,7 @@ namespace CalamityMod.Tiles.FurnitureWulfrum public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 107, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.TerraBlade, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureWulfrum/WulfrumCandelabra.cs b/Tiles/FurnitureWulfrum/WulfrumCandelabra.cs index 51251f28a5..a86d15ef44 100644 --- a/Tiles/FurnitureWulfrum/WulfrumCandelabra.cs +++ b/Tiles/FurnitureWulfrum/WulfrumCandelabra.cs @@ -1,6 +1,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureWulfrum @@ -13,7 +14,7 @@ namespace CalamityMod.Tiles.FurnitureWulfrum public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 107, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.TerraBlade, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureWulfrum/WulfrumCandle.cs b/Tiles/FurnitureWulfrum/WulfrumCandle.cs index 9742d10774..790ae4d325 100644 --- a/Tiles/FurnitureWulfrum/WulfrumCandle.cs +++ b/Tiles/FurnitureWulfrum/WulfrumCandle.cs @@ -1,6 +1,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureWulfrum @@ -13,7 +14,7 @@ namespace CalamityMod.Tiles.FurnitureWulfrum public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 7, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.WoodFurniture, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureWulfrum/WulfrumChair.cs b/Tiles/FurnitureWulfrum/WulfrumChair.cs index 542280676a..a61c5bc2d6 100644 --- a/Tiles/FurnitureWulfrum/WulfrumChair.cs +++ b/Tiles/FurnitureWulfrum/WulfrumChair.cs @@ -50,7 +50,7 @@ namespace CalamityMod.Tiles.FurnitureWulfrum public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 107, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.TerraBlade, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureWulfrum/WulfrumChandelier.cs b/Tiles/FurnitureWulfrum/WulfrumChandelier.cs index 6735470437..b215a6ebce 100644 --- a/Tiles/FurnitureWulfrum/WulfrumChandelier.cs +++ b/Tiles/FurnitureWulfrum/WulfrumChandelier.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Tiles.FurnitureWulfrum public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 107, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.TerraBlade, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureWulfrum/WulfrumClock.cs b/Tiles/FurnitureWulfrum/WulfrumClock.cs index c8a858f37b..208d0620c1 100644 --- a/Tiles/FurnitureWulfrum/WulfrumClock.cs +++ b/Tiles/FurnitureWulfrum/WulfrumClock.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureWulfrum @@ -16,7 +17,7 @@ namespace CalamityMod.Tiles.FurnitureWulfrum public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 107, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.TerraBlade, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureWulfrum/WulfrumDresser.cs b/Tiles/FurnitureWulfrum/WulfrumDresser.cs index e361dc3612..32f7df8139 100644 --- a/Tiles/FurnitureWulfrum/WulfrumDresser.cs +++ b/Tiles/FurnitureWulfrum/WulfrumDresser.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -18,7 +19,7 @@ namespace CalamityMod.Tiles.FurnitureWulfrum public override bool CanExplode(int i, int j) => false; public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 107, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.TerraBlade, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; diff --git a/Tiles/FurnitureWulfrum/WulfrumLamp.cs b/Tiles/FurnitureWulfrum/WulfrumLamp.cs index e909513a45..9fe3af8c38 100644 --- a/Tiles/FurnitureWulfrum/WulfrumLamp.cs +++ b/Tiles/FurnitureWulfrum/WulfrumLamp.cs @@ -1,6 +1,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureWulfrum @@ -13,7 +14,7 @@ namespace CalamityMod.Tiles.FurnitureWulfrum public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 107, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.TerraBlade, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureWulfrum/WulfrumLantern.cs b/Tiles/FurnitureWulfrum/WulfrumLantern.cs index 7519473955..1d01fa6eed 100644 --- a/Tiles/FurnitureWulfrum/WulfrumLantern.cs +++ b/Tiles/FurnitureWulfrum/WulfrumLantern.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Tiles.FurnitureWulfrum public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 107, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.TerraBlade, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureWulfrum/WulfrumPiano.cs b/Tiles/FurnitureWulfrum/WulfrumPiano.cs index 053d1a3643..0cc9b3b7aa 100644 --- a/Tiles/FurnitureWulfrum/WulfrumPiano.cs +++ b/Tiles/FurnitureWulfrum/WulfrumPiano.cs @@ -1,7 +1,9 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Tiles.FurnitureWulfrum { public class WulfrumPiano : ModTile @@ -10,7 +12,7 @@ namespace CalamityMod.Tiles.FurnitureWulfrum public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 107, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.TerraBlade, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureWulfrum/WulfrumPlating.cs b/Tiles/FurnitureWulfrum/WulfrumPlating.cs index 11c00ee7b6..bf9aff3e8f 100644 --- a/Tiles/FurnitureWulfrum/WulfrumPlating.cs +++ b/Tiles/FurnitureWulfrum/WulfrumPlating.cs @@ -1,10 +1,10 @@ using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using Terraria.Audio; using Terraria; -using Terraria.ModLoader; +using Terraria.Audio; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureWulfrum { @@ -27,7 +27,7 @@ namespace CalamityMod.Tiles.FurnitureWulfrum public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 107, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.TerraBlade, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureWulfrum/WulfrumSink.cs b/Tiles/FurnitureWulfrum/WulfrumSink.cs index 32fff45961..fccf48585d 100644 --- a/Tiles/FurnitureWulfrum/WulfrumSink.cs +++ b/Tiles/FurnitureWulfrum/WulfrumSink.cs @@ -1,6 +1,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureWulfrum @@ -13,7 +14,7 @@ namespace CalamityMod.Tiles.FurnitureWulfrum public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 107, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.TerraBlade, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureWulfrum/WulfrumSofa.cs b/Tiles/FurnitureWulfrum/WulfrumSofa.cs index e8a6be8895..fd7f798acb 100644 --- a/Tiles/FurnitureWulfrum/WulfrumSofa.cs +++ b/Tiles/FurnitureWulfrum/WulfrumSofa.cs @@ -4,7 +4,9 @@ using Terraria; using Terraria.DataStructures; using Terraria.GameContent; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Tiles.FurnitureWulfrum { public class WulfrumSofa : ModTile @@ -15,7 +17,7 @@ namespace CalamityMod.Tiles.FurnitureWulfrum public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 107, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.TerraBlade, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureWulfrum/WulfrumTable.cs b/Tiles/FurnitureWulfrum/WulfrumTable.cs index 30f4831e58..cf8885358f 100644 --- a/Tiles/FurnitureWulfrum/WulfrumTable.cs +++ b/Tiles/FurnitureWulfrum/WulfrumTable.cs @@ -1,6 +1,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureWulfrum @@ -13,7 +14,7 @@ namespace CalamityMod.Tiles.FurnitureWulfrum public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 107, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.TerraBlade, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureWulfrum/WulfrumToilet.cs b/Tiles/FurnitureWulfrum/WulfrumToilet.cs index ff00392634..01058b3270 100644 --- a/Tiles/FurnitureWulfrum/WulfrumToilet.cs +++ b/Tiles/FurnitureWulfrum/WulfrumToilet.cs @@ -51,7 +51,7 @@ namespace CalamityMod.Tiles.FurnitureWulfrum public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 107, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.TerraBlade, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/FurnitureWulfrum/WulfrumWorkBenchTile.cs b/Tiles/FurnitureWulfrum/WulfrumWorkBenchTile.cs index 708d5f7550..8a1c0f64e5 100644 --- a/Tiles/FurnitureWulfrum/WulfrumWorkBenchTile.cs +++ b/Tiles/FurnitureWulfrum/WulfrumWorkBenchTile.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Tiles.FurnitureWulfrum public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 107, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.TerraBlade, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Tiles/GiantPlanteraBulb.cs b/Tiles/GiantPlanteraBulb.cs index 171a5f4c0f..f2c9e3c6d7 100644 --- a/Tiles/GiantPlanteraBulb.cs +++ b/Tiles/GiantPlanteraBulb.cs @@ -6,6 +6,7 @@ using Terraria; using Terraria.Audio; using Terraria.DataStructures; using Terraria.Enums; +using Terraria.GameContent.Metadata; using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; @@ -31,6 +32,8 @@ namespace CalamityMod.Tiles Main.tileFrameImportant[Type] = true; + TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Plant"]); + // Various data sets to protect this tile from premature death TileID.Sets.PreventsTileRemovalIfOnTopOfIt[Type] = true; TileID.Sets.PreventsTileReplaceIfOnTopOfIt[Type] = true; @@ -52,8 +55,8 @@ namespace CalamityMod.Tiles TileObjectData.addTile(Type); // Adds two map entries for the bulb, first is for Pre-Hardmode, and the latter is for Hardmode. - AddMapEntry(new Color(107, 125, 33)); - AddMapEntry(new Color(243, 82, 171)); + AddMapEntry(new Color(107, 125, 33), CalamityUtils.GetText("Tiles.GiantBulb")); + AddMapEntry(new Color(243, 82, 171), CalamityUtils.GetText("Tiles.GiantBulb")); AnimationFrameHeight = 90; MineResist = 3f; @@ -192,9 +195,9 @@ namespace CalamityMod.Tiles { if (Main.hardMode) { - r = 243f / 500f; // ~123 - g = 82f / 500f; // ~41 - b = 171f / 500f; // ~87 + r = 0.486f; + g = 0.164f; + b = 0.342f; } } @@ -203,9 +206,9 @@ namespace CalamityMod.Tiles var tile = Main.tile[i, j]; spriteBatch.Draw( - Glow.Value, - new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + CalamityUtils.TileDrawOffset, - new Rectangle(tile.TileFrameX, tile.TileFrameY + AnimationFrameHeight * Main.tileFrame[Type], 16, 16), + Glow.Value, + new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + CalamityUtils.TileDrawOffset, + new Rectangle(tile.TileFrameX, tile.TileFrameY + AnimationFrameHeight * Main.tileFrame[Type], 16, 16), Color.Yellow ); } diff --git a/Tiles/IMergeableTile.cs b/Tiles/IMergeableTile.cs new file mode 100644 index 0000000000..9455c50bcc --- /dev/null +++ b/Tiles/IMergeableTile.cs @@ -0,0 +1,62 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Xna.Framework.Graphics; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles +{ + /// + /// Interface for tiles that specify custom universal merge data. + /// + internal interface IMergeableTile + { + List TileAdjacencies { get; } + } + + internal static class MergeableTile + { + private sealed class MergeableTileGlobalTile : GlobalTile + { + public override void PostDraw(int i, int j, int type, SpriteBatch spriteBatch) + { + if (!TryGetMergeableTile(type, out var mergeableTile)) + return; + + TileFraming.DrawUniversalMergeFrames(i, j, mergeableTile.TileAdjacencies); + } + + public override bool TileFrame(int i, int j, int type, ref bool resetFrame, ref bool noBreak) + { + if (!TryGetMergeableTile(type, out var mergeableTile)) + return base.TileFrame(i, j, type, ref resetFrame, ref noBreak); + + foreach (var adjacency in mergeableTile.TileAdjacencies) + TileFraming.GetAdjacencyData(i, j, adjacency); + + return base.TileFrame(i, j, type, ref resetFrame, ref noBreak); + } + + private static bool TryGetMergeableTile(int type, [NotNullWhen(returnValue: true)] out IMergeableTile mergeableTile) + { + if (TileLoader.GetTile(type) is IMergeableTile theMergeableTile) + { + mergeableTile = theMergeableTile; + return true; + } + + mergeableTile = null; + return false; + } + } + + public static void RegisterUniversalMerge(this IMergeableTile mergeableTile, int tileId, string blendSheetPath) + { + if (mergeableTile is not ModTile tile) + throw new InvalidCastException($"{nameof(IMergeableTile)} is implemented on type {mergeableTile.GetType().FullName}; said type should inherit from {nameof(ModTile)}"); + + TileFraming.SetUpUniversalMerge(tile.Type, tileId, blendSheetPath, out var data); + mergeableTile.TileAdjacencies.Add(data); + } + } +} diff --git a/Tiles/LivingFire/LivingBrimstoneFireBlockTile.cs b/Tiles/LivingFire/LivingBrimstoneFireBlockTile.cs index 16c2600fab..d47571bd64 100644 --- a/Tiles/LivingFire/LivingBrimstoneFireBlockTile.cs +++ b/Tiles/LivingFire/LivingBrimstoneFireBlockTile.cs @@ -1,7 +1,7 @@ -using CalamityMod.Dusts; +using System.Collections.Generic; +using CalamityMod.Dusts; using CalamityMod.Items.Placeables.LivingFire; using Microsoft.Xna.Framework; -using System.Collections.Generic; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -27,7 +27,7 @@ namespace CalamityMod.Tiles.LivingFire TileObjectData.newTile.CoordinateHeights = new int[] { 16 }; TileObjectData.newTile.CoordinateWidth = 16; TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newTile.HookCheckIfCanPlace = new PlacementHook(CanPlaceAlter, -1, 0, true ); + TileObjectData.newTile.HookCheckIfCanPlace = new PlacementHook(CanPlaceAlter, -1, 0, true); TileObjectData.newTile.UsesCustomCanPlace = true; TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(AfterPlacement, -1, 0, false); diff --git a/Tiles/LivingFire/LivingGodSlayerFireBlockTile.cs b/Tiles/LivingFire/LivingGodSlayerFireBlockTile.cs index 5ae7e61dd9..688e1eef69 100644 --- a/Tiles/LivingFire/LivingGodSlayerFireBlockTile.cs +++ b/Tiles/LivingFire/LivingGodSlayerFireBlockTile.cs @@ -1,7 +1,7 @@ -using CalamityMod.Dusts; +using System.Collections.Generic; +using CalamityMod.Dusts; using CalamityMod.Items.Placeables.LivingFire; using Microsoft.Xna.Framework; -using System.Collections.Generic; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -26,7 +26,7 @@ namespace CalamityMod.Tiles.LivingFire TileObjectData.newTile.CoordinateHeights = new int[] { 16 }; TileObjectData.newTile.CoordinateWidth = 16; TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newTile.HookCheckIfCanPlace = new PlacementHook(CanPlaceAlter, -1, 0, true ); + TileObjectData.newTile.HookCheckIfCanPlace = new PlacementHook(CanPlaceAlter, -1, 0, true); TileObjectData.newTile.UsesCustomCanPlace = true; TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(AfterPlacement, -1, 0, false); diff --git a/Tiles/LivingFire/LivingHolyFireBlockTile.cs b/Tiles/LivingFire/LivingHolyFireBlockTile.cs index fa89671233..82a99923db 100644 --- a/Tiles/LivingFire/LivingHolyFireBlockTile.cs +++ b/Tiles/LivingFire/LivingHolyFireBlockTile.cs @@ -1,7 +1,7 @@ -using CalamityMod.Dusts; +using System.Collections.Generic; +using CalamityMod.Dusts; using CalamityMod.Items.Placeables.LivingFire; using Microsoft.Xna.Framework; -using System.Collections.Generic; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -26,7 +26,7 @@ namespace CalamityMod.Tiles.LivingFire TileObjectData.newTile.CoordinateHeights = new int[] { 16 }; TileObjectData.newTile.CoordinateWidth = 16; TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newTile.HookCheckIfCanPlace = new PlacementHook(CanPlaceAlter, -1, 0, true ); + TileObjectData.newTile.HookCheckIfCanPlace = new PlacementHook(CanPlaceAlter, -1, 0, true); TileObjectData.newTile.UsesCustomCanPlace = true; TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(AfterPlacement, -1, 0, false); diff --git a/Tiles/MonsterBanner.cs b/Tiles/MonsterBanner.cs index 661874ac55..a2b3727e1b 100644 --- a/Tiles/MonsterBanner.cs +++ b/Tiles/MonsterBanner.cs @@ -84,6 +84,9 @@ namespace CalamityMod.Tiles case 4: npc = NPCType(); break; + case 5: + npc = NPCType(); + break; case 6: npc = NPCType(); break; diff --git a/Tiles/MonsterBanner.png b/Tiles/MonsterBanner.png index 1ad6b8d5b4..b1a264a1b7 100644 Binary files a/Tiles/MonsterBanner.png and b/Tiles/MonsterBanner.png differ diff --git a/Tiles/MusicBoxes/DraedonsAmbienceMusicBox.cs b/Tiles/MusicBoxes/DraedonExoSelectMusicBox.cs similarity index 92% rename from Tiles/MusicBoxes/DraedonsAmbienceMusicBox.cs rename to Tiles/MusicBoxes/DraedonExoSelectMusicBox.cs index e7e0eb5464..1d0eea0d42 100644 --- a/Tiles/MusicBoxes/DraedonsAmbienceMusicBox.cs +++ b/Tiles/MusicBoxes/DraedonExoSelectMusicBox.cs @@ -3,14 +3,13 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; using Terraria.ID; -using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; namespace CalamityMod.Tiles.MusicBoxes { - [LegacyName("DraedonsAmbienceMusicBoxTile")] - public class DraedonsAmbienceMusicBox : ModTile + [LegacyName("DraedonsAmbienceMusicBoxTile", "DraedonsAmbienceMusicBox")] + public class DraedonExoSelectMusicBox : ModTile { public override void SetStaticDefaults() { @@ -31,7 +30,7 @@ namespace CalamityMod.Tiles.MusicBoxes Player player = Main.LocalPlayer; player.noThrow = 2; player.cursorItemIconEnabled = true; - player.cursorItemIconID = ModContent.ItemType(); + player.cursorItemIconID = ModContent.ItemType(); } public override bool CreateDust(int i, int j, ref int type) diff --git a/Tiles/MusicBoxes/DraedonsAmbienceMusicBox.png b/Tiles/MusicBoxes/DraedonExoSelectMusicBox.png similarity index 100% rename from Tiles/MusicBoxes/DraedonsAmbienceMusicBox.png rename to Tiles/MusicBoxes/DraedonExoSelectMusicBox.png diff --git a/Tiles/MusicBoxes/DraedonTalkMusicBox.cs b/Tiles/MusicBoxes/DraedonTalkMusicBox.cs new file mode 100644 index 0000000000..98c65eac0c --- /dev/null +++ b/Tiles/MusicBoxes/DraedonTalkMusicBox.cs @@ -0,0 +1,62 @@ +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.MusicBoxes +{ + public class DraedonTalkMusicBox : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileObsidianKill[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.newTile.Origin = new Point16(0, 1); + TileObjectData.newTile.LavaDeath = false; + TileObjectData.newTile.DrawYOffset = 2; + TileObjectData.newTile.StyleLineSkip = 2; + TileObjectData.addTile(Type); + TileID.Sets.DisableSmartCursor[Type] = true; + AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName(ItemID.MusicBox)); + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.cursorItemIconEnabled = true; + player.cursorItemIconID = ModContent.ItemType(); + } + + public override bool CreateDust(int i, int j, ref int type) + { + return false; + } + + public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref TileDrawInfo drawData) + { + if (Main.gamePaused || !Main.instance.IsActive || Lighting.UpdateEveryFrame && !Main.rand.NextBool(4)) + return; + + if (Main.tile[i, j].TileFrameX == 36 && Main.tile[i, j].TileFrameY % 36 == 0 && (int)Main.timeForVisualEffects % 7 == 0 && Main.rand.NextBool(3)) + { + int goreType = Main.rand.Next(570, 573); + Vector2 position = new Vector2(i * 16 + 8, j * 16 - 8); + Vector2 velocity = new Vector2(Main.WindForVisuals * 2f, -0.5f); + velocity.X *= 1f + Main.rand.NextFloat(-0.5f, 0.5f); + velocity.Y *= 1f + Main.rand.NextFloat(-0.5f, 0.5f); + if (goreType == 572) + position.X -= 8f; + + if (goreType == 571) + position.X -= 4f; + + Gore.NewGore(new EntitySource_TileUpdate(i, j), position, velocity, goreType, 0.8f); + } + } + } +} diff --git a/Tiles/MusicBoxes/DraedonTalkMusicBox.png b/Tiles/MusicBoxes/DraedonTalkMusicBox.png new file mode 100644 index 0000000000..a7efa72e7c Binary files /dev/null and b/Tiles/MusicBoxes/DraedonTalkMusicBox.png differ diff --git a/Tiles/Ores/AerialiteOre.cs b/Tiles/Ores/AerialiteOre.cs index a8b30af6e9..427c90d2b2 100644 --- a/Tiles/Ores/AerialiteOre.cs +++ b/Tiles/Ores/AerialiteOre.cs @@ -1,24 +1,23 @@  +using System.Collections.Generic; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; -using Terraria.Audio; using Terraria; +using Terraria.Audio; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; -using Terraria.ID; namespace CalamityMod.Tiles.Ores { - public class AerialiteOre : ModTile + public class AerialiteOre : ModTile, IMergeableTile { public static readonly SoundStyle MineSound = new("CalamityMod/Sounds/Custom/MagicalRockMine", 3); internal static Texture2D GlowTexture; - public byte[,] tileAdjacency; - public byte[,] secondTileAdjacency; - public byte[,] thirdTileAdjacency; - public byte[,] fourthTileAdjacency; + List IMergeableTile.TileAdjacencies { get; } = []; + public override void SetStaticDefaults() { if (!Main.dedServ) @@ -47,14 +46,14 @@ namespace CalamityMod.Tiles.Ores HitSound = MineSound; Main.tileSpelunker[Type] = true; - TileFraming.SetUpUniversalMerge(Type, TileID.Cloud, out tileAdjacency); - TileFraming.SetUpUniversalMerge(Type, TileID.RainCloud, out secondTileAdjacency); - TileFraming.SetUpUniversalMerge(Type, TileID.SnowCloud, out thirdTileAdjacency); - TileFraming.SetUpUniversalMerge(Type, TileID.Dirt, out fourthTileAdjacency); + this.RegisterUniversalMerge(TileID.Cloud, "CalamityMod/Tiles/Merges/CloudMerge"); + this.RegisterUniversalMerge(TileID.RainCloud, "CalamityMod/Tiles/Merges/RainCloudMerge"); + this.RegisterUniversalMerge(TileID.SnowCloud, "CalamityMod/Tiles/Merges/SnowCloudMerge"); + this.RegisterUniversalMerge(TileID.Dirt, "CalamityMod/Tiles/Merges/DirtMerge"); } public override void PostSetDefaults() { - Main.tileNoSunLight[Type] = false; + Main.tileNoSunLight[Type] = false; } int animationFrameWidth = 234; @@ -63,14 +62,7 @@ namespace CalamityMod.Tiles.Ores { num = fail ? 1 : 3; } - public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) - { - TileFraming.GetAdjacencyData(i, j, TileID.Cloud, out tileAdjacency[i, j]); - TileFraming.GetAdjacencyData(i, j, TileID.RainCloud, out secondTileAdjacency[i, j]); - TileFraming.GetAdjacencyData(i, j, TileID.SnowCloud, out thirdTileAdjacency[i, j]); - TileFraming.GetAdjacencyData(i, j, TileID.Dirt, out fourthTileAdjacency[i, j]); - return true; - } + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { r = 0.14f; @@ -275,11 +267,6 @@ namespace CalamityMod.Tiles.Ores { Main.spriteBatch.Draw(GlowTexture, drawOffset + new Vector2(0f, 8f), new Rectangle?(new Rectangle(xPos, yPos, 18, 8)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } - - TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/CloudMerge"); - TileFraming.DrawUniversalMergeFrames(i, j, secondTileAdjacency, "CalamityMod/Tiles/Merges/RainCloudMerge"); - TileFraming.DrawUniversalMergeFrames(i, j, thirdTileAdjacency, "CalamityMod/Tiles/Merges/SnowCloudMerge"); - TileFraming.DrawUniversalMergeFrames(i, j, fourthTileAdjacency, "CalamityMod/Tiles/Merges/DirtMerge"); } private Color GetDrawColour(int i, int j, Color colour) { diff --git a/Tiles/Ores/AerialiteOreDisenchanted.cs b/Tiles/Ores/AerialiteOreDisenchanted.cs index e8c281a20b..4780b063e0 100644 --- a/Tiles/Ores/AerialiteOreDisenchanted.cs +++ b/Tiles/Ores/AerialiteOreDisenchanted.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using System.Collections.Generic; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; @@ -6,14 +7,11 @@ using Terraria.ModLoader; namespace CalamityMod.Tiles.Ores { - public class AerialiteOreDisenchanted : ModTile + public class AerialiteOreDisenchanted : ModTile, IMergeableTile { private const int AnimationFrameWidth = 234; - public byte[,] tileAdjacency; - public byte[,] secondTileAdjacency; - public byte[,] thirdTileAdjacency; - public byte[,] fourthTileAdjacency; + List IMergeableTile.TileAdjacencies { get; } = []; public override void SetStaticDefaults() { @@ -41,10 +39,10 @@ namespace CalamityMod.Tiles.Ores HitSound = SoundID.Tink; Main.tileSpelunker[Type] = true; - TileFraming.SetUpUniversalMerge(Type, TileID.Cloud, out tileAdjacency); - TileFraming.SetUpUniversalMerge(Type, TileID.RainCloud, out secondTileAdjacency); - TileFraming.SetUpUniversalMerge(Type, TileID.SnowCloud, out thirdTileAdjacency); - TileFraming.SetUpUniversalMerge(Type, TileID.Dirt, out fourthTileAdjacency); + this.RegisterUniversalMerge(TileID.Cloud, "CalamityMod/Tiles/Merges/CloudMerge"); + this.RegisterUniversalMerge(TileID.RainCloud, "CalamityMod/Tiles/Merges/RainCloudMerge"); + this.RegisterUniversalMerge(TileID.SnowCloud, "CalamityMod/Tiles/Merges/SnowCloudMerge"); + this.RegisterUniversalMerge(TileID.Dirt, "CalamityMod/Tiles/Merges/DirtMerge"); } public override void PostSetDefaults() { @@ -60,15 +58,7 @@ namespace CalamityMod.Tiles.Ores { return false; } - - public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) - { - TileFraming.GetAdjacencyData(i, j, TileID.Cloud, out tileAdjacency[i, j]); - TileFraming.GetAdjacencyData(i, j, TileID.RainCloud, out secondTileAdjacency[i, j]); - TileFraming.GetAdjacencyData(i, j, TileID.SnowCloud, out thirdTileAdjacency[i, j]); - TileFraming.GetAdjacencyData(i, j, TileID.Dirt, out fourthTileAdjacency[i, j]); - return true; - } + public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) { int uniqueAnimationFrameX = 0; @@ -159,12 +149,5 @@ namespace CalamityMod.Tiles.Ores } frameXOffset = uniqueAnimationFrameX * AnimationFrameWidth; } - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) - { - TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/CloudMerge"); - TileFraming.DrawUniversalMergeFrames(i, j, secondTileAdjacency, "CalamityMod/Tiles/Merges/RainCloudMerge"); - TileFraming.DrawUniversalMergeFrames(i, j, thirdTileAdjacency, "CalamityMod/Tiles/Merges/SnowCloudMerge"); - TileFraming.DrawUniversalMergeFrames(i, j, fourthTileAdjacency, "CalamityMod/Tiles/Merges/DirtMerge"); - } } } diff --git a/Tiles/Ores/AstralOre.cs b/Tiles/Ores/AstralOre.cs index a143188930..c2e220d120 100644 --- a/Tiles/Ores/AstralOre.cs +++ b/Tiles/Ores/AstralOre.cs @@ -1,17 +1,19 @@ -using CalamityMod.Dusts; +using System; +using System.Collections.Generic; +using CalamityMod.Dusts; using CalamityMod.Tiles.Astral; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.Ores { - public class AstralOre : ModTile + public class AstralOre : ModTile, IMergeableTile { - public byte[,] TileAdjacency; + List IMergeableTile.TileAdjacencies { get; } = []; + public override void SetStaticDefaults() { Main.tileLighted[Type] = true; @@ -37,7 +39,7 @@ namespace CalamityMod.Tiles.Ores TileID.Sets.ChecksForMerge[Type] = true; TileID.Sets.DoesntGetReplacedWithTileReplacement[Type] = true; - TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out TileAdjacency); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/AstralDirtMerge"); } public override void NearbyEffects(int i, int j, bool closer) { @@ -85,15 +87,5 @@ namespace CalamityMod.Tiles.Ores g *= brightness; b *= brightness; } - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) - { - TileFraming.DrawUniversalMergeFrames(i, j, TileAdjacency, "CalamityMod/Tiles/Merges/AstralDirtMerge"); - } - - public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) - { - TileFraming.GetAdjacencyData(i, j, ModContent.TileType(), out TileAdjacency[i, j]); - return true; - } } } diff --git a/Tiles/Ores/AuricOre.cs b/Tiles/Ores/AuricOre.cs index 503f0098e4..8d5facedb2 100644 --- a/Tiles/Ores/AuricOre.cs +++ b/Tiles/Ores/AuricOre.cs @@ -1,26 +1,27 @@ -using Microsoft.Xna.Framework; +using System.Collections.Generic; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Tiles.Astral; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; -using Terraria.ID; -using ReLogic.Content; using Terraria.ObjectData; -using Microsoft.Xna.Framework.Graphics; -using Terraria.DataStructures; namespace CalamityMod.Tiles.Ores { - public class AuricOre : ModTile + public class AuricOre : ModTile, IMergeableTile { public static readonly SoundStyle MineSound = new("CalamityMod/Sounds/Custom/AuricMine", 3); public static bool Animate; internal static Texture2D GlowTexture; - public byte[,] tileAdjacency; - public byte[,] secondTileAdjacency; + List IMergeableTile.TileAdjacencies { get; } = []; + public override void SetStaticDefaults() { if (!Main.dedServ) @@ -44,9 +45,9 @@ namespace CalamityMod.Tiles.Ores MineResist = 5f; MinPick = 250; HitSound = MineSound; - - TileFraming.SetUpUniversalMerge(Type, TileID.Dirt, out tileAdjacency); - TileFraming.SetUpUniversalMerge(Type, TileID.Stone, out secondTileAdjacency); + + this.RegisterUniversalMerge(TileID.Dirt, "CalamityMod/Tiles/Merges/DirtMerge"); + this.RegisterUniversalMerge(TileID.Stone, "CalamityMod/Tiles/Merges/StoneMerge"); } public override bool CanExplode(int i, int j) @@ -62,7 +63,7 @@ namespace CalamityMod.Tiles.Ores public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { if (!Animate) - {return;} + { return; } r = 0.24f; g = 0.40f; b = 0.47f; @@ -70,8 +71,8 @@ namespace CalamityMod.Tiles.Ores public override void AnimateTile(ref int frame, ref int frameCounter) { if (!Animate) - {return;} - frameCounter++; + { return; } + frameCounter++; if (frameCounter > 4) { frameCounter = 0; @@ -95,16 +96,8 @@ namespace CalamityMod.Tiles.Ores Tile trackTile = Main.tile[i, j]; double num6 = Main.time * 0.08; TileFraming.SlopedGlowmask(i, j, 0, glowmask, drawOffset, null, GetDrawColour(i, j, drawColour), default); + } - TileFraming.DrawUniversalMergeFrames(i, j, secondTileAdjacency, "CalamityMod/Tiles/Merges/StoneMerge"); - TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/DirtMerge"); - } - public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) - { - TileFraming.GetAdjacencyData(i, j, TileID.Dirt, out tileAdjacency[i, j]); - TileFraming.GetAdjacencyData(i, j, TileID.Stone, out secondTileAdjacency[i, j]); - return true; - } private Color GetDrawColour(int i, int j, Color colour) { int colType = Main.tile[i, j].TileColor; diff --git a/Tiles/Ores/ExodiumOre.cs b/Tiles/Ores/ExodiumOre.cs index 651fba3844..41fc92d67f 100644 --- a/Tiles/Ores/ExodiumOre.cs +++ b/Tiles/Ores/ExodiumOre.cs @@ -1,18 +1,19 @@  +using System.Collections.Generic; using CalamityMod.Items.Placeables.Ores; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; -using Terraria.ID; -using Microsoft.Xna.Framework.Graphics; namespace CalamityMod.Tiles.Ores { - public class ExodiumOre : ModTile + public class ExodiumOre : ModTile, IMergeableTile { - public byte[,] tileAdjacency; - public byte[,] secondTileAdjacency; + List IMergeableTile.TileAdjacencies { get; } = []; + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; @@ -35,20 +36,8 @@ namespace CalamityMod.Tiles.Ores TileID.Sets.ChecksForMerge[Type] = true; - TileFraming.SetUpUniversalMerge(Type, TileID.Dirt, out tileAdjacency); - TileFraming.SetUpUniversalMerge(Type, TileID.LunarOre, out secondTileAdjacency); - } - - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) - { - TileFraming.DrawUniversalMergeFrames(i, j, secondTileAdjacency, "CalamityMod/Tiles/Merges/LuminiteMerge"); - TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/DirtMerge"); - } - public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) - { - TileFraming.GetAdjacencyData(i, j, TileID.Dirt, out tileAdjacency[i, j]); - TileFraming.GetAdjacencyData(i, j, TileID.LunarOre, out secondTileAdjacency[i, j]); - return true; + this.RegisterUniversalMerge(TileID.Dirt, "CalamityMod/Tiles/Merges/DirtMerge"); + this.RegisterUniversalMerge(TileID.LunarOre, "CalamityMod/Tiles/Merges/LuminiteMerge"); } public override bool CanExplode(int i, int j) => false; diff --git a/Tiles/Ores/HallowedOre.cs b/Tiles/Ores/HallowedOre.cs index f6c01766fb..049ca594f2 100644 --- a/Tiles/Ores/HallowedOre.cs +++ b/Tiles/Ores/HallowedOre.cs @@ -1,6 +1,7 @@ -using Microsoft.Xna.Framework; +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ID; using Terraria.Localization; @@ -8,9 +9,10 @@ using Terraria.ModLoader; namespace CalamityMod.Tiles.Ores { - public class HallowedOre : ModTile + public class HallowedOre : ModTile, IMergeableTile { - public byte[,] tileAdjacency; + List IMergeableTile.TileAdjacencies { get; } = []; + public override void SetStaticDefaults() { Main.tileLighted[Type] = true; @@ -32,7 +34,7 @@ namespace CalamityMod.Tiles.Ores HitSound = SoundID.Tink; Main.tileSpelunker[Type] = true; - TileFraming.SetUpUniversalMerge(Type, TileID.Pearlstone, out tileAdjacency); + this.RegisterUniversalMerge(TileID.Pearlstone, "CalamityMod/Tiles/Merges/PearlstoneMerge"); } public override bool CanExplode(int i, int j) @@ -44,15 +46,6 @@ namespace CalamityMod.Tiles.Ores { num = fail ? 1 : 3; } - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) - { - TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/PearlstoneMerge"); - } - public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) - { - TileFraming.GetAdjacencyData(i, j, TileID.Pearlstone, out tileAdjacency[i, j]); - return true; - } public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { diff --git a/Tiles/Ores/InfernalSuevite.cs b/Tiles/Ores/InfernalSuevite.cs index 1ae48332c5..4d00e3d10c 100644 --- a/Tiles/Ores/InfernalSuevite.cs +++ b/Tiles/Ores/InfernalSuevite.cs @@ -1,21 +1,21 @@ -using CalamityMod.Tiles.Crags; +using System.Collections.Generic; +using CalamityMod.Tiles.Crags; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; -using Terraria.ID; -using Microsoft.Xna.Framework.Graphics; namespace CalamityMod.Tiles.Ores { [LegacyName("CharredOre")] - public class InfernalSuevite : ModTile + public class InfernalSuevite : ModTile, IMergeableTile { private int sheetWidth = 234; private int sheetHeight = 90; - public byte[,] tileAdjacency; - public byte[,] secondTileAdjacency; + List IMergeableTile.TileAdjacencies { get; } = []; public override void SetStaticDefaults() { @@ -36,8 +36,8 @@ namespace CalamityMod.Tiles.Ores DustType = 235; Main.tileSpelunker[Type] = true; - TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out tileAdjacency); - TileFraming.SetUpUniversalMerge(Type, TileID.Ash, out secondTileAdjacency); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/BrimstoneSlagMerge"); + this.RegisterUniversalMerge(TileID.Ash, "CalamityMod/Tiles/Merges/AshMerge"); } public override bool CanExplode(int i, int j) @@ -62,18 +62,5 @@ namespace CalamityMod.Tiles.Ores g = 0f; b = 0f; } - - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) - { - TileFraming.DrawUniversalMergeFrames(i, j, secondTileAdjacency, "CalamityMod/Tiles/Merges/AshMerge"); - TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/BrimstoneSlagMerge"); - } - - public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) - { - TileFraming.GetAdjacencyData(i, j, ModContent.TileType(), out tileAdjacency[i, j]); - TileFraming.GetAdjacencyData(i, j, TileID.Ash, out secondTileAdjacency[i, j]); - return true; - } } } diff --git a/Tiles/Ores/PerennialOre.cs b/Tiles/Ores/PerennialOre.cs index 7b6f756388..08d732e51e 100644 --- a/Tiles/Ores/PerennialOre.cs +++ b/Tiles/Ores/PerennialOre.cs @@ -1,22 +1,21 @@  +using System; +using System.Collections.Generic; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; using Terraria; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; -using Terraria.ID; -using System; namespace CalamityMod.Tiles.Ores { - public class PerennialOre : ModTile + public class PerennialOre : ModTile, IMergeableTile { internal static Texture2D GlowTexture; - public byte[,] tileAdjacency; - public byte[,] secondTileAdjacency; - public byte[,] thirdTileAdjacency; + List IMergeableTile.TileAdjacencies { get; } = []; public override void SetStaticDefaults() { @@ -41,9 +40,9 @@ namespace CalamityMod.Tiles.Ores HitSound = SoundID.Tink; Main.tileSpelunker[Type] = true; - TileFraming.SetUpUniversalMerge(Type, TileID.Dirt, out tileAdjacency); - TileFraming.SetUpUniversalMerge(Type, TileID.Stone, out secondTileAdjacency); - TileFraming.SetUpUniversalMerge(Type, TileID.Mud, out thirdTileAdjacency); + this.RegisterUniversalMerge(TileID.Dirt, "CalamityMod/Tiles/Merges/DirtMerge"); + this.RegisterUniversalMerge(TileID.Stone, "CalamityMod/Tiles/Merges/StoneMerge"); + this.RegisterUniversalMerge(TileID.Mud, "CalamityMod/Tiles/Merges/MudMerge"); } int animationFrameWidth = 234; @@ -297,18 +296,6 @@ namespace CalamityMod.Tiles.Ores Color drawColour = GetDrawColour(i, j, new Color(175, 175, 175, 175)); Tile trackTile = Main.tile[i, j]; TileFraming.SlopedGlowmask(i, j, 0, GlowTexture, drawOffset, null, GetDrawColour(i, j, drawColour), default); - - TileFraming.DrawUniversalMergeFrames(i, j, thirdTileAdjacency, "CalamityMod/Tiles/Merges/MudMerge"); - TileFraming.DrawUniversalMergeFrames(i, j, secondTileAdjacency, "CalamityMod/Tiles/Merges/StoneMerge"); - TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/DirtMerge"); - } - - public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) - { - TileFraming.GetAdjacencyData(i, j, TileID.Dirt, out tileAdjacency[i, j]); - TileFraming.GetAdjacencyData(i, j, TileID.Stone, out secondTileAdjacency[i, j]); - TileFraming.GetAdjacencyData(i, j, TileID.Mud, out thirdTileAdjacency[i, j]); - return true; } private Color GetDrawColour(int i, int j, Color colour) diff --git a/Tiles/Ores/ScoriaOre.cs b/Tiles/Ores/ScoriaOre.cs index b820972aeb..238f5f1cd4 100644 --- a/Tiles/Ores/ScoriaOre.cs +++ b/Tiles/Ores/ScoriaOre.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Environment; +using System.Collections.Generic; +using CalamityMod.Projectiles.Environment; using CalamityMod.Tiles.Abyss; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -11,10 +12,9 @@ using Terraria.ModLoader; namespace CalamityMod.Tiles.Ores { [LegacyName("ChaoticOre")] - public class ScoriaOre : ModTile + public class ScoriaOre : ModTile, IMergeableTile { - public byte[,] TileAdjacency; - public byte[,] secondTileAdjacency; + List IMergeableTile.TileAdjacencies { get; } = []; public override void SetStaticDefaults() { @@ -34,8 +34,8 @@ namespace CalamityMod.Tiles.Ores MinPick = 210; HitSound = SoundID.Tink; - TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out TileAdjacency); - TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out secondTileAdjacency); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/AbyssGravelMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/PyreMantleMerge"); } public override void NearbyEffects(int i, int j, bool closer) @@ -45,11 +45,11 @@ namespace CalamityMod.Tiles.Ores if (closer && Main.rand.NextBool(30) && !up.HasTile && !up2.HasTile) { Dust dust; - dust = Main.dust[Dust.NewDust(new Vector2(i * 16f, j * 16f), 16, 16, 127, 0f, -10f, 47, new Color(255, 255, 255), 1.0465117f)]; + dust = Main.dust[Dust.NewDust(new Vector2(i * 16f, j * 16f), 16, 16, DustID.Flare, 0f, -10f, 47, new Color(255, 255, 255), 1.0465117f)]; dust.noGravity = true; dust.fadeIn = 1.2209302f; - dust = Main.dust[Dust.NewDust(new Vector2(i * 16f, j * 16f), 16, 16, 31, 0f, -1.9069767f, 195, new Color(255, 255, 255), 1f)]; + dust = Main.dust[Dust.NewDust(new Vector2(i * 16f, j * 16f), 16, 16, DustID.Smoke, 0f, -1.9069767f, 195, new Color(255, 255, 255), 1f)]; dust.noGravity = false; dust.fadeIn = 1.4209302f; @@ -81,22 +81,14 @@ namespace CalamityMod.Tiles.Ores { num = fail ? 1 : 3; } - + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { r = 0.04f; g = 0.00f; b = 0.00f; } - - public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) - { - TileFraming.GetAdjacencyData(i, j, ModContent.TileType(), out TileAdjacency[i, j]); - TileFraming.GetAdjacencyData(i, j, ModContent.TileType(), out secondTileAdjacency[i, j]); - return true; - } - - + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { int xPos = Main.tile[i, j].TileFrameX; @@ -108,11 +100,8 @@ namespace CalamityMod.Tiles.Ores Tile trackTile = Main.tile[i, j]; double num6 = Main.time * 0.08; TileFraming.SlopedGlowmask(i, j, 0, glowmask, drawOffset, null, GetDrawColour(i, j, drawColour), default); - - TileFraming.DrawUniversalMergeFrames(i, j, secondTileAdjacency, "CalamityMod/Tiles/Merges/PyreMantleMerge"); - TileFraming.DrawUniversalMergeFrames(i, j, TileAdjacency, "CalamityMod/Tiles/Merges/AbyssGravelMerge"); } - + private Color GetDrawColour(int i, int j, Color colour) { int colType = Main.tile[i, j].TileColor; diff --git a/Tiles/Ores/UelibloomOre.cs b/Tiles/Ores/UelibloomOre.cs index 71546e0505..14ab406efd 100644 --- a/Tiles/Ores/UelibloomOre.cs +++ b/Tiles/Ores/UelibloomOre.cs @@ -1,4 +1,5 @@  +using System.Collections.Generic; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -8,11 +9,10 @@ using Terraria.ModLoader; namespace CalamityMod.Tiles.Ores { - public class UelibloomOre : ModTile + public class UelibloomOre : ModTile, IMergeableTile { - public byte[,] tileAdjacency; - public byte[,] secondTileAdjacency; - public byte[,] thirdTileAdjacency; + List IMergeableTile.TileAdjacencies { get; } = []; + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; @@ -31,9 +31,9 @@ namespace CalamityMod.Tiles.Ores Main.tileSpelunker[Type] = true; - TileFraming.SetUpUniversalMerge(Type, TileID.Dirt, out tileAdjacency); - TileFraming.SetUpUniversalMerge(Type, TileID.Stone, out secondTileAdjacency); - TileFraming.SetUpUniversalMerge(Type, TileID.Mud, out thirdTileAdjacency); + this.RegisterUniversalMerge(TileID.Dirt, "CalamityMod/Tiles/Merges/DirtMerge"); + this.RegisterUniversalMerge(TileID.Stone, "CalamityMod/Tiles/Merges/StoneMerge"); + this.RegisterUniversalMerge(TileID.Mud, "CalamityMod/Tiles/Merges/MudMerge"); } public override bool CanExplode(int i, int j) @@ -45,19 +45,5 @@ namespace CalamityMod.Tiles.Ores { num = fail ? 1 : 3; } - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) - { - TileFraming.DrawUniversalMergeFrames(i, j, thirdTileAdjacency, "CalamityMod/Tiles/Merges/MudMerge"); - TileFraming.DrawUniversalMergeFrames(i, j, secondTileAdjacency, "CalamityMod/Tiles/Merges/StoneMerge"); - TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/DirtMerge"); - } - - public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) - { - TileFraming.GetAdjacencyData(i, j, TileID.Dirt, out tileAdjacency[i, j]); - TileFraming.GetAdjacencyData(i, j, TileID.Stone, out secondTileAdjacency[i, j]); - TileFraming.GetAdjacencyData(i, j, TileID.Mud, out thirdTileAdjacency[i, j]); - return true; - } } } diff --git a/Tiles/PerennialBrick.cs b/Tiles/PerennialBrick.cs index a666969848..9133c5f6cb 100644 --- a/Tiles/PerennialBrick.cs +++ b/Tiles/PerennialBrick.cs @@ -1,17 +1,17 @@  +using System.Collections.Generic; using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Tiles { - public class PerennialBrick : ModTile + public class PerennialBrick : ModTile, IMergeableTile { - public byte[,] tileAdjacency; - public byte[,] secondTileAdjacency; - public byte[,] thirdTileAdjacency; + List IMergeableTile.TileAdjacencies { get; } = []; + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; @@ -25,30 +25,17 @@ namespace CalamityMod.Tiles AddMapEntry(new Color(17, 133, 46)); AnimationFrameHeight = 90; - TileFraming.SetUpUniversalMerge(Type, TileID.Dirt, out tileAdjacency); - TileFraming.SetUpUniversalMerge(Type, TileID.Stone, out secondTileAdjacency); - TileFraming.SetUpUniversalMerge(Type, TileID.Mud, out thirdTileAdjacency); + this.RegisterUniversalMerge(TileID.Dirt, "CalamityMod/Tiles/Merges/DirtMerge"); + this.RegisterUniversalMerge(TileID.Stone, "CalamityMod/Tiles/Merges/StoneMerge"); + this.RegisterUniversalMerge(TileID.Mud, "CalamityMod/Tiles/Merges/MudMerge"); } public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 128, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Chlorophyte, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.RedTorch, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) - { - TileFraming.DrawUniversalMergeFrames(i, j, thirdTileAdjacency, "CalamityMod/Tiles/Merges/MudMerge"); - TileFraming.DrawUniversalMergeFrames(i, j, secondTileAdjacency, "CalamityMod/Tiles/Merges/StoneMerge"); - TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/DirtMerge"); - } - public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) - { - TileFraming.GetAdjacencyData(i, j, TileID.Dirt, out tileAdjacency[i, j]); - TileFraming.GetAdjacencyData(i, j, TileID.Stone, out secondTileAdjacency[i, j]); - TileFraming.GetAdjacencyData(i, j, TileID.Mud, out thirdTileAdjacency[i, j]); - return true; - } public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) { diff --git a/Tiles/PlacedRock.cs b/Tiles/PlacedRock.cs index 609635039a..568059c2bb 100644 --- a/Tiles/PlacedRock.cs +++ b/Tiles/PlacedRock.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items; +using CalamityMod.Items; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; diff --git a/Tiles/Plates/Cinderplate.cs b/Tiles/Plates/Cinderplate.cs index 4d16db7076..26700e132d 100644 --- a/Tiles/Plates/Cinderplate.cs +++ b/Tiles/Plates/Cinderplate.cs @@ -1,11 +1,11 @@  using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; -using Terraria.ModLoader; using Terraria.ID; -using ReLogic.Content; +using Terraria.ModLoader; namespace CalamityMod.Tiles.Plates { @@ -37,14 +37,14 @@ namespace CalamityMod.Tiles.Plates public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 6, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 100, 100), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Torch, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 100, 100), 1f); return false; } public override void RandomUpdate(int i, int j) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 6, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Torch, 0f, 0f, 1, new Color(255, 255, 255), 1f); } public override void PostDraw(int i, int j, SpriteBatch spriteBatch) diff --git a/Tiles/Plates/Elumplate.cs b/Tiles/Plates/Elumplate.cs index 54049f1318..2e3f4b6bb0 100644 --- a/Tiles/Plates/Elumplate.cs +++ b/Tiles/Plates/Elumplate.cs @@ -1,11 +1,11 @@  using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; -using Terraria.ModLoader; using Terraria.ID; -using ReLogic.Content; +using Terraria.ModLoader; namespace CalamityMod.Tiles.Plates { @@ -37,14 +37,14 @@ namespace CalamityMod.Tiles.Plates public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 247, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 100, 100), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.PlatinumCoin, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 100, 100), 1f); return false; } public override void RandomUpdate(int i, int j) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 247, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.PlatinumCoin, 0f, 0f, 1, new Color(255, 255, 255), 1f); } public override void PostDraw(int i, int j, SpriteBatch spriteBatch) diff --git a/Tiles/Plates/Havocplate.cs b/Tiles/Plates/Havocplate.cs index cb52de7877..05b0f7f3b4 100644 --- a/Tiles/Plates/Havocplate.cs +++ b/Tiles/Plates/Havocplate.cs @@ -1,11 +1,11 @@  using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; -using Terraria.ModLoader; using Terraria.ID; -using ReLogic.Content; +using Terraria.ModLoader; namespace CalamityMod.Tiles.Plates { @@ -39,14 +39,14 @@ namespace CalamityMod.Tiles.Plates public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 100, 100), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.RedTorch, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 100, 100), 1f); return false; } public override void RandomUpdate(int i, int j) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.RedTorch, 0f, 0f, 1, new Color(255, 255, 255), 1f); } public override void PostDraw(int i, int j, SpriteBatch spriteBatch) diff --git a/Tiles/Plates/Navyplate.cs b/Tiles/Plates/Navyplate.cs index 34bfabb783..66ccb9302e 100644 --- a/Tiles/Plates/Navyplate.cs +++ b/Tiles/Plates/Navyplate.cs @@ -1,11 +1,11 @@  using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; -using Terraria.ModLoader; using Terraria.ID; -using ReLogic.Content; +using Terraria.ModLoader; namespace CalamityMod.Tiles.Plates { @@ -37,14 +37,14 @@ namespace CalamityMod.Tiles.Plates public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 187, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 100, 100), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Flare_Blue, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 100, 100), 1f); return false; } public override void RandomUpdate(int i, int j) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 187, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Flare_Blue, 0f, 0f, 1, new Color(255, 255, 255), 1f); } public override void PostDraw(int i, int j, SpriteBatch spriteBatch) diff --git a/Tiles/Plates/Onyxplate.cs b/Tiles/Plates/Onyxplate.cs index 28e68523ef..165f9889fd 100644 --- a/Tiles/Plates/Onyxplate.cs +++ b/Tiles/Plates/Onyxplate.cs @@ -1,10 +1,10 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; -using Terraria.ModLoader; using Terraria.ID; -using ReLogic.Content; +using Terraria.ModLoader; namespace CalamityMod.Tiles.Plates { diff --git a/Tiles/Plates/PlagueContainmentCells.cs b/Tiles/Plates/PlagueContainmentCells.cs index 454cb6484e..e3c4c2e195 100644 --- a/Tiles/Plates/PlagueContainmentCells.cs +++ b/Tiles/Plates/PlagueContainmentCells.cs @@ -1,10 +1,10 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; -using Terraria.ModLoader; using Terraria.ID; -using ReLogic.Content; +using Terraria.ModLoader; namespace CalamityMod.Tiles.Plates { @@ -36,17 +36,17 @@ namespace CalamityMod.Tiles.Plates public override bool CreateDust(int i, int j, ref int type) { - int dust = Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 89, 0f, 0f, 100, default, 2f); + int dust = Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.GemEmerald, 0f, 0f, 100, default, 2f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity.Y = -0.15f; - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 100, 100), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 100, 100), 1f); return false; } public override void RandomUpdate(int i, int j) { - int dust = Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 89, 0f, 0f, 100, default, 2f); + int dust = Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.GemEmerald, 0f, 0f, 100, default, 2f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity.Y = -0.15f; } diff --git a/Tiles/PlayerTurrets/PlayerFireTurret .cs b/Tiles/PlayerTurrets/PlayerFireTurret .cs index f3d73e06f5..96f89dbf1e 100644 --- a/Tiles/PlayerTurrets/PlayerFireTurret .cs +++ b/Tiles/PlayerTurrets/PlayerFireTurret .cs @@ -48,7 +48,7 @@ namespace CalamityMod.Tiles.PlayerTurrets public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 226); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Electric); return false; } @@ -83,7 +83,7 @@ namespace CalamityMod.Tiles.PlayerTurrets Vector2 screenOffset = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + screenOffset; drawOffset.Y -= 2f; - drawOffset.X += (drawDirection == -1 ? -10f : 2f) -2f; + drawOffset.X += (drawDirection == -1 ? -10f : 2f) - 2f; SpriteEffects sfx = drawDirection == -1 ? SpriteEffects.FlipVertically : SpriteEffects.None; spriteBatch.Draw(tex, drawOffset, null, drawColor, te.Angle, tex.Size() * 0.5f, 1f, sfx, 0.0f); diff --git a/Tiles/PlayerTurrets/PlayerIceTurret .cs b/Tiles/PlayerTurrets/PlayerIceTurret .cs index b4462ccfe1..f8923b34cb 100644 --- a/Tiles/PlayerTurrets/PlayerIceTurret .cs +++ b/Tiles/PlayerTurrets/PlayerIceTurret .cs @@ -48,7 +48,7 @@ namespace CalamityMod.Tiles.PlayerTurrets public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 226); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Electric); return false; } @@ -83,7 +83,7 @@ namespace CalamityMod.Tiles.PlayerTurrets Vector2 screenOffset = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + screenOffset; drawOffset.Y -= 2f; - drawOffset.X += (drawDirection == -1 ? -10f : 2f) -2f; + drawOffset.X += (drawDirection == -1 ? -10f : 2f) - 2f; SpriteEffects sfx = drawDirection == -1 ? SpriteEffects.FlipVertically : SpriteEffects.None; spriteBatch.Draw(tex, drawOffset, null, drawColor, te.Angle, tex.Size() * 0.5f, 1f, sfx, 0.0f); diff --git a/Tiles/PlayerTurrets/PlayerLabTurret.cs b/Tiles/PlayerTurrets/PlayerLabTurret.cs index 33dbf35aa4..3948900ebf 100644 --- a/Tiles/PlayerTurrets/PlayerLabTurret.cs +++ b/Tiles/PlayerTurrets/PlayerLabTurret.cs @@ -48,7 +48,7 @@ namespace CalamityMod.Tiles.PlayerTurrets public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 226); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Electric); return false; } @@ -83,7 +83,7 @@ namespace CalamityMod.Tiles.PlayerTurrets Vector2 screenOffset = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + screenOffset; drawOffset.Y -= 2f; - drawOffset.X += (drawDirection == -1 ? -10f : 2f) -2f; + drawOffset.X += (drawDirection == -1 ? -10f : 2f) - 2f; SpriteEffects sfx = drawDirection == -1 ? SpriteEffects.FlipVertically : SpriteEffects.None; spriteBatch.Draw(tex, drawOffset, null, drawColor, te.Angle, tex.Size() * 0.5f, 1f, sfx, 0.0f); diff --git a/Tiles/PlayerTurrets/PlayerLaserTurret .cs b/Tiles/PlayerTurrets/PlayerLaserTurret .cs index 6742c3ada1..314a27c5e1 100644 --- a/Tiles/PlayerTurrets/PlayerLaserTurret .cs +++ b/Tiles/PlayerTurrets/PlayerLaserTurret .cs @@ -48,7 +48,7 @@ namespace CalamityMod.Tiles.PlayerTurrets public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 226); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Electric); return false; } @@ -83,7 +83,7 @@ namespace CalamityMod.Tiles.PlayerTurrets Vector2 screenOffset = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + screenOffset; drawOffset.Y -= 2f; - drawOffset.X += (drawDirection == -1 ? -10f : 2f) -2f; + drawOffset.X += (drawDirection == -1 ? -10f : 2f) - 2f; SpriteEffects sfx = drawDirection == -1 ? SpriteEffects.FlipVertically : SpriteEffects.None; spriteBatch.Draw(tex, drawOffset, null, drawColor, te.Angle, tex.Size() * 0.5f, 1f, sfx, 0.0f); diff --git a/Tiles/PlayerTurrets/PlayerOnyxTurret.cs b/Tiles/PlayerTurrets/PlayerOnyxTurret.cs index 0c0e01a99d..80c5af3026 100644 --- a/Tiles/PlayerTurrets/PlayerOnyxTurret.cs +++ b/Tiles/PlayerTurrets/PlayerOnyxTurret.cs @@ -48,7 +48,7 @@ namespace CalamityMod.Tiles.PlayerTurrets public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 226); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Electric); return false; } @@ -83,7 +83,7 @@ namespace CalamityMod.Tiles.PlayerTurrets Vector2 screenOffset = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + screenOffset; drawOffset.Y -= 2f; - drawOffset.X += (drawDirection == -1 ? -10f : 2f) -2f; + drawOffset.X += (drawDirection == -1 ? -10f : 2f) - 2f; SpriteEffects sfx = drawDirection == -1 ? SpriteEffects.FlipVertically : SpriteEffects.None; spriteBatch.Draw(tex, drawOffset, null, drawColor, te.Angle, tex.Size() * 0.5f, 1f, sfx, 0.0f); diff --git a/Tiles/PlayerTurrets/PlayerPlagueTurret.cs b/Tiles/PlayerTurrets/PlayerPlagueTurret.cs index 7e3ff8d9cb..011130a5ea 100644 --- a/Tiles/PlayerTurrets/PlayerPlagueTurret.cs +++ b/Tiles/PlayerTurrets/PlayerPlagueTurret.cs @@ -48,7 +48,7 @@ namespace CalamityMod.Tiles.PlayerTurrets public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 226); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Electric); return false; } @@ -83,7 +83,7 @@ namespace CalamityMod.Tiles.PlayerTurrets Vector2 screenOffset = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + screenOffset; drawOffset.Y -= 2f; - drawOffset.X += (drawDirection == -1 ? -10f : 2f) -2f; + drawOffset.X += (drawDirection == -1 ? -10f : 2f) - 2f; SpriteEffects sfx = drawDirection == -1 ? SpriteEffects.FlipVertically : SpriteEffects.None; spriteBatch.Draw(tex, drawOffset, null, drawColor, te.Angle, tex.Size() * 0.5f, 1f, sfx, 0.0f); diff --git a/Tiles/PlayerTurrets/PlayerWaterTurret.cs b/Tiles/PlayerTurrets/PlayerWaterTurret.cs index 23366396c8..e9da005ea0 100644 --- a/Tiles/PlayerTurrets/PlayerWaterTurret.cs +++ b/Tiles/PlayerTurrets/PlayerWaterTurret.cs @@ -48,7 +48,7 @@ namespace CalamityMod.Tiles.PlayerTurrets public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 226); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Electric); return false; } @@ -83,7 +83,7 @@ namespace CalamityMod.Tiles.PlayerTurrets Vector2 screenOffset = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + screenOffset; drawOffset.Y -= 2f; - drawOffset.X += (drawDirection == -1 ? -10f : 2f) -2f; + drawOffset.X += (drawDirection == -1 ? -10f : 2f) - 2f; SpriteEffects sfx = drawDirection == -1 ? SpriteEffects.FlipVertically : SpriteEffects.None; spriteBatch.Draw(tex, drawOffset, null, drawColor, te.Angle, tex.Size() * 0.5f, 1f, sfx, 0.0f); diff --git a/Tiles/Rubblemaker/Abyss/AbyssGiantKelp1Echo.cs b/Tiles/Rubblemaker/Abyss/AbyssGiantKelp1Echo.cs index d2de36d10d..ce14798b14 100644 --- a/Tiles/Rubblemaker/Abyss/AbyssGiantKelp1Echo.cs +++ b/Tiles/Rubblemaker/Abyss/AbyssGiantKelp1Echo.cs @@ -2,10 +2,10 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; -using Terraria.GameContent; -using Terraria.ID; using Terraria.DataStructures; using Terraria.Enums; +using Terraria.GameContent; +using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; @@ -44,7 +44,7 @@ namespace CalamityMod.Tiles.Rubblemaker.Abyss if (closer && Main.rand.NextBool(100) && j > Main.worldSurface) { Dust dust; - dust = Main.dust[Dust.NewDust(new Vector2(i * 16f, j * 16f), 274, 279, 304, 0.23255825f, 10f, 0, new Color(117, 55, 15), 1.5116279f)]; + dust = Main.dust[Dust.NewDust(new Vector2(i * 16f, j * 16f), 274, 279, DustID.Firefly, 0.23255825f, 10f, 0, new Color(117, 55, 15), 1.5116279f)]; dust.noGravity = true; dust.noLight = true; dust.fadeIn = 2.5813954f; @@ -70,10 +70,10 @@ namespace CalamityMod.Tiles.Rubblemaker.Abyss public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile tile = Framing.GetTileSafely(i, j); - Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp1Glow").Value; - Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp1Glow").Value; + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); - spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); + spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); } } @@ -84,10 +84,10 @@ namespace CalamityMod.Tiles.Rubblemaker.Abyss public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile tile = Framing.GetTileSafely(i, j); - Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp2Glow").Value; - Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp2Glow").Value; + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); - spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); + spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); } } } diff --git a/Tiles/Rubblemaker/Abyss/AbyssGiantKelp3Echo.cs b/Tiles/Rubblemaker/Abyss/AbyssGiantKelp3Echo.cs index 572e64fdac..89c2eee98d 100644 --- a/Tiles/Rubblemaker/Abyss/AbyssGiantKelp3Echo.cs +++ b/Tiles/Rubblemaker/Abyss/AbyssGiantKelp3Echo.cs @@ -2,10 +2,10 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; -using Terraria.GameContent; -using Terraria.ID; using Terraria.DataStructures; using Terraria.Enums; +using Terraria.GameContent; +using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; @@ -55,7 +55,7 @@ namespace CalamityMod.Tiles.Rubblemaker.Abyss if (closer && Main.rand.NextBool(100) && j > Main.worldSurface) { Dust dust; - dust = Main.dust[Dust.NewDust(new Vector2(i * 16f, j * 16f), 274, 279, 304, 0.23255825f, 10f, 0, new Color(117, 55, 15), 1.5116279f)]; + dust = Main.dust[Dust.NewDust(new Vector2(i * 16f, j * 16f), 274, 279, DustID.Firefly, 0.23255825f, 10f, 0, new Color(117, 55, 15), 1.5116279f)]; dust.noGravity = true; dust.noLight = true; dust.fadeIn = 2.5813954f; @@ -70,10 +70,10 @@ namespace CalamityMod.Tiles.Rubblemaker.Abyss public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile tile = Framing.GetTileSafely(i, j); - Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp3Glow").Value; - Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp3Glow").Value; + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); - spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); + spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); } } } diff --git a/Tiles/Rubblemaker/Abyss/AbyssGiantKelp4Echo.cs b/Tiles/Rubblemaker/Abyss/AbyssGiantKelp4Echo.cs index 8c9e75be7a..3ef26c8964 100644 --- a/Tiles/Rubblemaker/Abyss/AbyssGiantKelp4Echo.cs +++ b/Tiles/Rubblemaker/Abyss/AbyssGiantKelp4Echo.cs @@ -2,10 +2,10 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; -using Terraria.GameContent; -using Terraria.ID; using Terraria.DataStructures; using Terraria.Enums; +using Terraria.GameContent; +using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; @@ -55,7 +55,7 @@ namespace CalamityMod.Tiles.Rubblemaker.Abyss if (closer && Main.rand.NextBool(100) && j > Main.worldSurface) { Dust dust; - dust = Main.dust[Dust.NewDust(new Vector2(i * 16f, j * 16f), 274, 279, 304, 0.23255825f, 10f, 0, new Color(117, 55, 15), 1.5116279f)]; + dust = Main.dust[Dust.NewDust(new Vector2(i * 16f, j * 16f), 274, 279, DustID.Firefly, 0.23255825f, 10f, 0, new Color(117, 55, 15), 1.5116279f)]; dust.noGravity = true; dust.noLight = true; dust.fadeIn = 2.5813954f; @@ -70,10 +70,10 @@ namespace CalamityMod.Tiles.Rubblemaker.Abyss public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile tile = Framing.GetTileSafely(i, j); - Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp4Glow").Value; - Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp4Glow").Value; + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); - spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); + spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); } } } diff --git a/Tiles/Rubblemaker/Abyss/BulbTreeEcho.cs b/Tiles/Rubblemaker/Abyss/BulbTreeEcho.cs index 0d2f24585c..5c15350845 100644 --- a/Tiles/Rubblemaker/Abyss/BulbTreeEcho.cs +++ b/Tiles/Rubblemaker/Abyss/BulbTreeEcho.cs @@ -1,7 +1,7 @@ using CalamityMod.Dusts; +using CalamityMod.Items.Placeables; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using CalamityMod.Items.Placeables; using Terraria; using Terraria.DataStructures; using Terraria.Enums; @@ -41,9 +41,9 @@ namespace CalamityMod.Tiles.Rubblemaker.Abyss public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - r = 49f / 500f; - g = 159f / 500f; - b = 242f / 500f; + r = 0.098f; + g = 0.318f; + b = 0.484f; } public override void NumDust(int i, int j, bool fail, ref int num) @@ -54,10 +54,10 @@ namespace CalamityMod.Tiles.Rubblemaker.Abyss public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile tile = Framing.GetTileSafely(i, j); - Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/BulbTree1Glow").Value; - Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/BulbTree1Glow").Value; + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); - spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); + spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); } } @@ -67,23 +67,23 @@ namespace CalamityMod.Tiles.Rubblemaker.Abyss public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile tile = Framing.GetTileSafely(i, j); - Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/BulbTree2Glow").Value; - Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/BulbTree2Glow").Value; + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); - spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); + spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); } } - + public class BulbTree3Echo : BulbTree1Echo { public override string Texture => "CalamityMod/Tiles/Abyss/AbyssAmbient/BulbTree3"; public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile tile = Framing.GetTileSafely(i, j); - Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/BulbTree3Glow").Value; - Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/BulbTree3Glow").Value; + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); - spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); + spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); } } } diff --git a/Tiles/Rubblemaker/Abyss/GravelPileEcho.cs b/Tiles/Rubblemaker/Abyss/GravelPileEcho.cs index fafd723677..e7fe4bee22 100644 --- a/Tiles/Rubblemaker/Abyss/GravelPileEcho.cs +++ b/Tiles/Rubblemaker/Abyss/GravelPileEcho.cs @@ -47,7 +47,7 @@ namespace CalamityMod.Tiles.Rubblemaker.Abyss { public override string Texture => "CalamityMod/Tiles/Abyss/AbyssAmbient/GravelPile2"; } - + public class GravelPile3Echo : GravelPile1Echo { public override string Texture => "CalamityMod/Tiles/Abyss/AbyssAmbient/GravelPile3"; diff --git a/Tiles/Rubblemaker/Abyss/PlantyMushPileEcho.cs b/Tiles/Rubblemaker/Abyss/PlantyMushPileEcho.cs index 7d3f345a57..59b7e44cfb 100644 --- a/Tiles/Rubblemaker/Abyss/PlantyMushPileEcho.cs +++ b/Tiles/Rubblemaker/Abyss/PlantyMushPileEcho.cs @@ -47,7 +47,7 @@ namespace CalamityMod.Tiles.Rubblemaker.Abyss { public override string Texture => "CalamityMod/Tiles/Abyss/AbyssAmbient/PlantyMushPile2"; } - + public class PlantyMushPile3Echo : PlantyMushPile1Echo { public override string Texture => "CalamityMod/Tiles/Abyss/AbyssAmbient/PlantyMushPile3"; diff --git a/Tiles/Rubblemaker/Abyss/ShaleColumnsEcho.cs b/Tiles/Rubblemaker/Abyss/ShaleColumnsEcho.cs index 1464f4e708..57b86fcbbc 100644 --- a/Tiles/Rubblemaker/Abyss/ShaleColumnsEcho.cs +++ b/Tiles/Rubblemaker/Abyss/ShaleColumnsEcho.cs @@ -2,9 +2,9 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; +using Terraria.Enums; using Terraria.GameContent; using Terraria.ID; -using Terraria.Enums; using Terraria.ModLoader; using Terraria.ObjectData; diff --git a/Tiles/Rubblemaker/Abyss/ShalePileEcho.cs b/Tiles/Rubblemaker/Abyss/ShalePileEcho.cs index 072b8ce622..99a873c1fa 100644 --- a/Tiles/Rubblemaker/Abyss/ShalePileEcho.cs +++ b/Tiles/Rubblemaker/Abyss/ShalePileEcho.cs @@ -47,7 +47,7 @@ namespace CalamityMod.Tiles.Rubblemaker.Abyss { public override string Texture => "CalamityMod/Tiles/Abyss/AbyssAmbient/ShalePile2"; } - + public class ShalePile3Echo : ShalePile1Echo { public override string Texture => "CalamityMod/Tiles/Abyss/AbyssAmbient/ShalePile3"; diff --git a/Tiles/Rubblemaker/Abyss/SpiderCoralEcho.cs b/Tiles/Rubblemaker/Abyss/SpiderCoralEcho.cs index 1a962cf869..af0777adcf 100644 --- a/Tiles/Rubblemaker/Abyss/SpiderCoralEcho.cs +++ b/Tiles/Rubblemaker/Abyss/SpiderCoralEcho.cs @@ -37,10 +37,10 @@ namespace CalamityMod.Tiles.Rubblemaker.Abyss public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile tile = Framing.GetTileSafely(i, j); - Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/SpiderCoral1Glow").Value; - Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/SpiderCoral1Glow").Value; + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); - spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); + spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); } } @@ -50,10 +50,10 @@ namespace CalamityMod.Tiles.Rubblemaker.Abyss public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile tile = Framing.GetTileSafely(i, j); - Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/SpiderCoral2Glow").Value; - Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/SpiderCoral2Glow").Value; + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); - spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); + spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); } } @@ -63,10 +63,10 @@ namespace CalamityMod.Tiles.Rubblemaker.Abyss public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile tile = Framing.GetTileSafely(i, j); - Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/SpiderCoral3Glow").Value; - Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/SpiderCoral3Glow").Value; + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); - spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); + spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); } } @@ -76,10 +76,10 @@ namespace CalamityMod.Tiles.Rubblemaker.Abyss public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile tile = Framing.GetTileSafely(i, j); - Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/SpiderCoral4Glow").Value; - Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/SpiderCoral4Glow").Value; + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); - spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); + spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); } } @@ -89,10 +89,10 @@ namespace CalamityMod.Tiles.Rubblemaker.Abyss public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile tile = Framing.GetTileSafely(i, j); - Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/SpiderCoral5Glow").Value; - Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/SpiderCoral5Glow").Value; + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); - spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); + spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); } } } diff --git a/Tiles/Rubblemaker/Abyss/SulphurPireCoralEcho.cs b/Tiles/Rubblemaker/Abyss/SulphurPireCoralEcho.cs index 97a22a9036..b4ba9566c8 100644 --- a/Tiles/Rubblemaker/Abyss/SulphurPireCoralEcho.cs +++ b/Tiles/Rubblemaker/Abyss/SulphurPireCoralEcho.cs @@ -40,8 +40,8 @@ namespace CalamityMod.Tiles.Rubblemaker.Abyss public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - r = 230f / 500f; - g = 255f / 500f; + r = 0.46f; + g = 0.51f; b = 0f; } @@ -53,10 +53,10 @@ namespace CalamityMod.Tiles.Rubblemaker.Abyss public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile tile = Framing.GetTileSafely(i, j); - Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/SulphurPireCoral1Glow").Value; - Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/SulphurPireCoral1Glow").Value; + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); - spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); + spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); } } @@ -66,23 +66,23 @@ namespace CalamityMod.Tiles.Rubblemaker.Abyss public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile tile = Framing.GetTileSafely(i, j); - Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/SulphurPireCoral2Glow").Value; - Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/SulphurPireCoral2Glow").Value; + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); - spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); + spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); } } - + public class SulphurPireCoral3Echo : SulphurPireCoral1Echo { public override string Texture => "CalamityMod/Tiles/Abyss/AbyssAmbient/SulphurPireCoral3"; public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile tile = Framing.GetTileSafely(i, j); - Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/SulphurPireCoral3Glow").Value; - Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/SulphurPireCoral3Glow").Value; + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); - spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); + spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); } } } diff --git a/Tiles/Rubblemaker/SulphurousSea/SulphuricFossil1Echo.cs b/Tiles/Rubblemaker/SulphurousSea/SulphuricFossil1Echo.cs index fcd1cb4924..d9a764e33e 100644 --- a/Tiles/Rubblemaker/SulphurousSea/SulphuricFossil1Echo.cs +++ b/Tiles/Rubblemaker/SulphurousSea/SulphuricFossil1Echo.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Tiles.Rubblemaker.SulphurousSea TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); TileObjectData.addTile(Type); AddMapEntry(new Color(113, 90, 71), CalamityUtils.GetText("Tiles.Fossil")); - DustType = (int)CalamityDusts.SulfurousSeaAcid; + DustType = (int)CalamityDusts.SulphurousSeaAcid; RegisterItemDrop(ModContent.ItemType()); FlexibleTileWand.RubblePlacementLarge.AddVariations(ModContent.ItemType(), Type, 0); diff --git a/Tiles/Rubblemaker/SulphurousSea/SulphuricFossil2Echo.cs b/Tiles/Rubblemaker/SulphurousSea/SulphuricFossil2Echo.cs index 93ec194f75..b2e60d5b44 100644 --- a/Tiles/Rubblemaker/SulphurousSea/SulphuricFossil2Echo.cs +++ b/Tiles/Rubblemaker/SulphurousSea/SulphuricFossil2Echo.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Tiles.Rubblemaker.SulphurousSea TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); TileObjectData.addTile(Type); AddMapEntry(new Color(113, 90, 71), CalamityUtils.GetText("Tiles.Fossil")); - DustType = (int)CalamityDusts.SulfurousSeaAcid; + DustType = (int)CalamityDusts.SulphurousSeaAcid; RegisterItemDrop(ModContent.ItemType()); FlexibleTileWand.RubblePlacementLarge.AddVariations(ModContent.ItemType(), Type, 0); diff --git a/Tiles/Rubblemaker/SulphurousSea/SulphuricFossil3Echo.cs b/Tiles/Rubblemaker/SulphurousSea/SulphuricFossil3Echo.cs index 6ff28d1b44..f2d7636ece 100644 --- a/Tiles/Rubblemaker/SulphurousSea/SulphuricFossil3Echo.cs +++ b/Tiles/Rubblemaker/SulphurousSea/SulphuricFossil3Echo.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Tiles.Rubblemaker.SulphurousSea TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); TileObjectData.addTile(Type); AddMapEntry(new Color(113, 90, 71), CalamityUtils.GetText("Tiles.Fossil")); - DustType = (int)CalamityDusts.SulfurousSeaAcid; + DustType = (int)CalamityDusts.SulphurousSeaAcid; RegisterItemDrop(ModContent.ItemType()); FlexibleTileWand.RubblePlacementLarge.AddVariations(ModContent.ItemType(), Type, 0); diff --git a/Tiles/Rubblemaker/SulphurousSea/SulphurousColumnEcho.cs b/Tiles/Rubblemaker/SulphurousSea/SulphurousColumnEcho.cs index 686cab301b..013c4246f6 100644 --- a/Tiles/Rubblemaker/SulphurousSea/SulphurousColumnEcho.cs +++ b/Tiles/Rubblemaker/SulphurousSea/SulphurousColumnEcho.cs @@ -3,9 +3,9 @@ using CalamityMod.Items.Placeables; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; -using Terraria.ID; using Terraria.Enums; using Terraria.GameContent; +using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; @@ -37,7 +37,7 @@ namespace CalamityMod.Tiles.Rubblemaker.SulphurousSea TileObjectData.newTile.LavaDeath = true; TileObjectData.addTile(Type); AddMapEntry(new Color(150, 100, 50), CalamityUtils.GetText("Tiles.Column")); - DustType = (int)CalamityDusts.SulfurousSeaAcid; + DustType = (int)CalamityDusts.SulphurousSeaAcid; RegisterItemDrop(ModContent.ItemType()); FlexibleTileWand.RubblePlacementLarge.AddVariations(ModContent.ItemType(), Type, 0); diff --git a/Tiles/Rubblemaker/SulphurousSea/SulphurousRib1Echo.cs b/Tiles/Rubblemaker/SulphurousSea/SulphurousRib1Echo.cs index 51fce1687c..76453c5a21 100644 --- a/Tiles/Rubblemaker/SulphurousSea/SulphurousRib1Echo.cs +++ b/Tiles/Rubblemaker/SulphurousSea/SulphurousRib1Echo.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Tiles.Rubblemaker.SulphurousSea TileObjectData.newTile.DrawYOffset = 2; TileObjectData.addTile(Type); AddMapEntry(new Color(57, 48, 83), CalamityUtils.GetText("Tiles.Ribs")); - DustType = (int)CalamityDusts.SulfurousSeaAcid; + DustType = (int)CalamityDusts.SulphurousSeaAcid; RegisterItemDrop(ModContent.ItemType()); FlexibleTileWand.RubblePlacementLarge.AddVariations(ModContent.ItemType(), Type, 0); diff --git a/Tiles/Rubblemaker/SulphurousSea/SulphurousRib2Echo.cs b/Tiles/Rubblemaker/SulphurousSea/SulphurousRib2Echo.cs index af77be2e72..5b4bb069af 100644 --- a/Tiles/Rubblemaker/SulphurousSea/SulphurousRib2Echo.cs +++ b/Tiles/Rubblemaker/SulphurousSea/SulphurousRib2Echo.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Tiles.Rubblemaker.SulphurousSea TileObjectData.newTile.DrawYOffset = 2; TileObjectData.addTile(Type); AddMapEntry(new Color(57, 48, 83), CalamityUtils.GetText("Tiles.Ribs")); - DustType = (int)CalamityDusts.SulfurousSeaAcid; + DustType = (int)CalamityDusts.SulphurousSeaAcid; RegisterItemDrop(ModContent.ItemType()); FlexibleTileWand.RubblePlacementMedium.AddVariations(ModContent.ItemType(), Type, 0); diff --git a/Tiles/Rubblemaker/SulphurousSea/SulphurousRib3Echo.cs b/Tiles/Rubblemaker/SulphurousSea/SulphurousRib3Echo.cs index 274b4c318d..acf62a14a9 100644 --- a/Tiles/Rubblemaker/SulphurousSea/SulphurousRib3Echo.cs +++ b/Tiles/Rubblemaker/SulphurousSea/SulphurousRib3Echo.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Tiles.Rubblemaker.SulphurousSea TileObjectData.newTile.DrawYOffset = 2; TileObjectData.addTile(Type); AddMapEntry(new Color(57, 48, 83), CalamityUtils.GetText("Tiles.Ribs")); - DustType = (int)CalamityDusts.SulfurousSeaAcid; + DustType = (int)CalamityDusts.SulphurousSeaAcid; RegisterItemDrop(ModContent.ItemType()); FlexibleTileWand.RubblePlacementMedium.AddVariations(ModContent.ItemType(), Type, 0); diff --git a/Tiles/Rubblemaker/SulphurousSea/SulphurousRib4Echo.cs b/Tiles/Rubblemaker/SulphurousSea/SulphurousRib4Echo.cs index 566f2cef24..1c3cf7e17b 100644 --- a/Tiles/Rubblemaker/SulphurousSea/SulphurousRib4Echo.cs +++ b/Tiles/Rubblemaker/SulphurousSea/SulphurousRib4Echo.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Tiles.Rubblemaker.SulphurousSea TileObjectData.newTile.DrawYOffset = 2; TileObjectData.addTile(Type); AddMapEntry(new Color(57, 48, 83), CalamityUtils.GetText("Tiles.Ribs")); - DustType = (int)CalamityDusts.SulfurousSeaAcid; + DustType = (int)CalamityDusts.SulphurousSeaAcid; RegisterItemDrop(ModContent.ItemType()); FlexibleTileWand.RubblePlacementMedium.AddVariations(ModContent.ItemType(), Type, 0); diff --git a/Tiles/Rubblemaker/SulphurousSea/SulphurousRib5Echo.cs b/Tiles/Rubblemaker/SulphurousSea/SulphurousRib5Echo.cs index 8d7b78bc77..7fbbeb3d6b 100644 --- a/Tiles/Rubblemaker/SulphurousSea/SulphurousRib5Echo.cs +++ b/Tiles/Rubblemaker/SulphurousSea/SulphurousRib5Echo.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Tiles.Rubblemaker.SulphurousSea TileObjectData.newTile.DrawYOffset = 2; TileObjectData.addTile(Type); AddMapEntry(new Color(57, 48, 83), CalamityUtils.GetText("Tiles.Ribs")); - DustType = (int)CalamityDusts.SulfurousSeaAcid; + DustType = (int)CalamityDusts.SulphurousSeaAcid; RegisterItemDrop(ModContent.ItemType()); FlexibleTileWand.RubblePlacementSmall.AddVariations(ModContent.ItemType(), Type, 0); diff --git a/Tiles/Rubblemaker/SunkenSea/CoralPileLargeEcho.cs b/Tiles/Rubblemaker/SunkenSea/CoralPileLargeEcho.cs index 5524cb5c04..cbfa9300c9 100644 --- a/Tiles/Rubblemaker/SunkenSea/CoralPileLargeEcho.cs +++ b/Tiles/Rubblemaker/SunkenSea/CoralPileLargeEcho.cs @@ -1,8 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; -using Terraria.GameContent; using Terraria.DataStructures; using Terraria.Enums; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; diff --git a/Tiles/Rubblemaker/SunkenSea/FanCoralEcho.cs b/Tiles/Rubblemaker/SunkenSea/FanCoralEcho.cs index 29797481d3..4ee2a05729 100644 --- a/Tiles/Rubblemaker/SunkenSea/FanCoralEcho.cs +++ b/Tiles/Rubblemaker/SunkenSea/FanCoralEcho.cs @@ -1,8 +1,8 @@ using CalamityMod.Items.Placeables; using Microsoft.Xna.Framework; using Terraria; -using Terraria.GameContent; using Terraria.Enums; +using Terraria.GameContent; using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; diff --git a/Tiles/Rubblemaker/SunkenSea/SmallCoralsEcho.cs b/Tiles/Rubblemaker/SunkenSea/SmallCoralsEcho.cs index 29b34f6cad..65c88d8234 100644 --- a/Tiles/Rubblemaker/SunkenSea/SmallCoralsEcho.cs +++ b/Tiles/Rubblemaker/SunkenSea/SmallCoralsEcho.cs @@ -20,8 +20,8 @@ namespace CalamityMod.Tiles.Rubblemaker.SunkenSea Main.tileLavaDeath[Type] = true; Main.tileWaterDeath[Type] = true; Main.tileFrameImportant[Type] = true; - TileID.Sets.ReplaceTileBreakUp[Type] = true; - TileID.Sets.SwaysInWindBasic[Type] = false; + TileID.Sets.ReplaceTileBreakUp[Type] = true; + TileID.Sets.SwaysInWindBasic[Type] = false; TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2); TileObjectData.addTile(Type); AddMapEntry(new Color(178, 28, 153)); diff --git a/Tiles/ScoriaBrick.cs b/Tiles/ScoriaBrick.cs index 1f6fbab527..800e5d6d57 100644 --- a/Tiles/ScoriaBrick.cs +++ b/Tiles/ScoriaBrick.cs @@ -1,21 +1,22 @@ -using Microsoft.Xna.Framework; +using System.Collections.Generic; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; using Terraria; using Terraria.GameContent.Metadata; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Tiles { [LegacyName("ChaoticBrick")] - public class ScoriaBrick : ModTile + public class ScoriaBrick : ModTile, IMergeableTile { int subsheetHeight = 72; internal static Texture2D GlowTexture; - public byte[,] tileAdjacency; - public byte[,] secondTileAdjacency; + List IMergeableTile.TileAdjacencies { get; } = []; + public override void SetStaticDefaults() { if (!Main.dedServ) @@ -29,8 +30,8 @@ namespace CalamityMod.Tiles AddMapEntry(new Color(85, 87, 101)); HitSound = SoundID.Tink; - TileFraming.SetUpUniversalMerge(Type, TileID.Dirt, out tileAdjacency); - TileFraming.SetUpUniversalMerge(Type, TileID.Stone, out secondTileAdjacency); + this.RegisterUniversalMerge(TileID.Dirt, "CalamityMod/Tiles/Merges/DirtMerge"); + this.RegisterUniversalMerge(TileID.Stone, "CalamityMod/Tiles/Merges/StoneMerge"); } public override void NumDust(int i, int j, bool fail, ref int num) @@ -53,8 +54,6 @@ namespace CalamityMod.Tiles public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { - TileFraming.GetAdjacencyData(i, j, TileID.Dirt, out tileAdjacency[i, j]); - TileFraming.GetAdjacencyData(i, j, TileID.Stone, out secondTileAdjacency[i, j]); TileFraming.CompactFraming(i, j, resetFrame); return false; } @@ -73,8 +72,6 @@ namespace CalamityMod.Tiles Vector2 drawOffset = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawPosition = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + drawOffset; TileFraming.SlopedGlowmask(i, j, 0, GlowTexture, drawPosition + new Vector2(0f, 8f), new Rectangle?(new Rectangle(xPos, yPos, 18, 8)), GetDrawColour(i, j, drawColour), default); - TileFraming.DrawUniversalMergeFrames(i, j, secondTileAdjacency, "CalamityMod/Tiles/Merges/StoneMerge"); - TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/DirtMerge"); } private Color GetDrawColour(int i, int j, Color colour) { diff --git a/Tiles/SunkenSea/AlgalPrismTorch.cs b/Tiles/SunkenSea/AlgalPrismTorch.cs index 85a9e68b8d..10788826b7 100644 --- a/Tiles/SunkenSea/AlgalPrismTorch.cs +++ b/Tiles/SunkenSea/AlgalPrismTorch.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.SunkenSea @@ -12,7 +13,7 @@ namespace CalamityMod.Tiles.SunkenSea 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(150, 255, 190), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(150, 255, 190), 1f); return false; } @@ -68,10 +69,10 @@ namespace CalamityMod.Tiles.SunkenSea return true; } - public override float GetTorchLuck(Player player) - { - // Note: Total Torch luck never goes below zero - return player.Calamity().ZoneSunkenSea ? 1f : -1f; - } + public override float GetTorchLuck(Player player) + { + // Note: Total Torch luck never goes below zero + return player.Calamity().ZoneSunkenSea ? 1f : -1f; + } } } diff --git a/Tiles/SunkenSea/SunkenCrateTile.cs b/Tiles/SunkenSea/EutrophicCrateTile.cs similarity index 87% rename from Tiles/SunkenSea/SunkenCrateTile.cs rename to Tiles/SunkenSea/EutrophicCrateTile.cs index f58da7bf9b..380baf60d4 100644 --- a/Tiles/SunkenSea/SunkenCrateTile.cs +++ b/Tiles/SunkenSea/EutrophicCrateTile.cs @@ -1,14 +1,13 @@ using CalamityMod.Items.Fishing.SunkenSeaCatches; using Microsoft.Xna.Framework; using Terraria; -using Terraria.DataStructures; -using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; namespace CalamityMod.Tiles.SunkenSea { - public class SunkenCrateTile : ModTile + [LegacyName("SunkenCrateTile")] + public class EutrophicCrateTile : ModTile { public override void SetStaticDefaults() { @@ -22,7 +21,7 @@ namespace CalamityMod.Tiles.SunkenSea TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); TileObjectData.addTile(Type); - AddMapEntry(new Color(106, 218, 230), CalamityUtils.GetItemName()); + AddMapEntry(new Color(106, 218, 230), CalamityUtils.GetItemName()); DustType = 253; } diff --git a/Tiles/SunkenSea/EutrophicCrateTile.png b/Tiles/SunkenSea/EutrophicCrateTile.png new file mode 100644 index 0000000000..e1565ea85d Binary files /dev/null and b/Tiles/SunkenSea/EutrophicCrateTile.png differ diff --git a/Tiles/SunkenSea/EutrophicGlass.cs b/Tiles/SunkenSea/EutrophicGlass.cs index 6eb1a3863e..082548bfe4 100644 --- a/Tiles/SunkenSea/EutrophicGlass.cs +++ b/Tiles/SunkenSea/EutrophicGlass.cs @@ -7,7 +7,7 @@ using Terraria.ModLoader; namespace CalamityMod.Tiles.SunkenSea { - + public class EutrophicGlass : ModTile { private static int sheetWidth = 216; diff --git a/Tiles/SunkenSea/EutrophicSand.cs b/Tiles/SunkenSea/EutrophicSand.cs index 0a58e326ce..c9ef48f1f5 100644 --- a/Tiles/SunkenSea/EutrophicSand.cs +++ b/Tiles/SunkenSea/EutrophicSand.cs @@ -1,23 +1,24 @@ -using CalamityMod.Items.Placeables; +using System.Collections.Generic; +using CalamityMod.Items.Placeables; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.GameContent.Metadata; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Tiles.SunkenSea { - public class EutrophicSand : ModTile + public class EutrophicSand : ModTile, IMergeableTile { - public byte[,] tileAdjacency; - public byte[,] secondTileAdjacency; - public byte[,] thirdTileAdjacency; + List IMergeableTile.TileAdjacencies { get; } = []; public override void SetStaticDefaults() { Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; + TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Sand"]); CalamityUtils.MergeWithGeneral(Type); CalamityUtils.MergeWithDesert(Type); // Tile blends with sandstone, which it is set to merge with here @@ -31,9 +32,9 @@ namespace CalamityMod.Tiles.SunkenSea DustType = 108; AddMapEntry(new Color(92, 145, 167)); - TileFraming.SetUpUniversalMerge(Type, TileID.Sandstone, out tileAdjacency); - TileFraming.SetUpUniversalMerge(Type, TileID.Sand, out secondTileAdjacency); - TileFraming.SetUpUniversalMerge(Type, TileID.HardenedSand, out thirdTileAdjacency); + 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 RandomUpdate(int i, int j) @@ -63,18 +64,8 @@ namespace CalamityMod.Tiles.SunkenSea num = fail ? 1 : 3; } - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) - { - TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/SandstoneMerge"); - TileFraming.DrawUniversalMergeFrames(i, j, secondTileAdjacency, "CalamityMod/Tiles/Merges/SandMerge"); - TileFraming.DrawUniversalMergeFrames(i, j, thirdTileAdjacency, "CalamityMod/Tiles/Merges/HardenedSandMerge"); - } - public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { - TileFraming.GetAdjacencyData(i, j, TileID.Sandstone, out tileAdjacency[i, j]); - TileFraming.GetAdjacencyData(i, j, TileID.Sand, out secondTileAdjacency[i, j]); - TileFraming.GetAdjacencyData(i, j, TileID.HardenedSand, out thirdTileAdjacency[i, j]); return TileFraming.BrimstoneFraming(i, j, resetFrame); } } diff --git a/Tiles/SunkenSea/HardenedEutrophicSand.cs b/Tiles/SunkenSea/HardenedEutrophicSand.cs index 575f9bb7c8..209e0a22cd 100644 --- a/Tiles/SunkenSea/HardenedEutrophicSand.cs +++ b/Tiles/SunkenSea/HardenedEutrophicSand.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using System.Collections.Generic; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; @@ -7,13 +8,9 @@ using Terraria.ModLoader; namespace CalamityMod.Tiles.SunkenSea { - public class HardenedEutrophicSand : ModTile + public class HardenedEutrophicSand : ModTile, IMergeableTile { - public byte[,] tileAdjacency; - public byte[,] secondTileAdjacency; - public byte[,] thirdTileAdjacency; - public byte[,] fourthTileAdjacency; - public byte[,] fifthTileAdjacency; + List IMergeableTile.TileAdjacencies { get; } = []; public override void SetStaticDefaults() { @@ -32,11 +29,11 @@ namespace CalamityMod.Tiles.SunkenSea DustType = 108; AddMapEntry(new Color(67, 107, 143)); - TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out tileAdjacency); - TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out secondTileAdjacency); - TileFraming.SetUpUniversalMerge(Type, TileID.Sandstone, out thirdTileAdjacency); - TileFraming.SetUpUniversalMerge(Type, TileID.HardenedSand, out fourthTileAdjacency); - TileFraming.SetUpUniversalMerge(Type, TileID.Sand, out fifthTileAdjacency); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/EutrophicSandMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/NavystoneMerge"); + this.RegisterUniversalMerge(TileID.Sandstone, "CalamityMod/Tiles/Merges/SandstoneMerge"); + this.RegisterUniversalMerge(TileID.HardenedSand, "CalamityMod/Tiles/Merges/HardenedSandMerge"); + this.RegisterUniversalMerge(TileID.Sand, "CalamityMod/Tiles/Merges/SandMerge"); } public override void NumDust(int i, int j, bool fail, ref int num) @@ -44,22 +41,8 @@ namespace CalamityMod.Tiles.SunkenSea num = fail ? 1 : 3; } - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) - { - TileFraming.DrawUniversalMergeFrames(i, j, secondTileAdjacency, "CalamityMod/Tiles/Merges/NavystoneMerge"); - TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/EutrophicSandMerge"); - TileFraming.DrawUniversalMergeFrames(i, j, thirdTileAdjacency, "CalamityMod/Tiles/Merges/SandstoneMerge"); - TileFraming.DrawUniversalMergeFrames(i, j, fourthTileAdjacency, "CalamityMod/Tiles/Merges/HardenedSandMerge"); - TileFraming.DrawUniversalMergeFrames(i, j, fifthTileAdjacency, "CalamityMod/Tiles/Merges/SandMerge"); - } - public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { - TileFraming.GetAdjacencyData(i, j, ModContent.TileType(), out tileAdjacency[i, j]); - TileFraming.GetAdjacencyData(i, j, ModContent.TileType(), out secondTileAdjacency[i, j]); - TileFraming.GetAdjacencyData(i, j, TileID.Sandstone, out thirdTileAdjacency[i, j]); - TileFraming.GetAdjacencyData(i, j, TileID.HardenedSand, out fourthTileAdjacency[i, j]); - TileFraming.GetAdjacencyData(i, j, TileID.Sand, out fifthTileAdjacency[i, j]); return TileFraming.BrimstoneFraming(i, j, resetFrame); } } diff --git a/Tiles/SunkenSea/NavyPrismTorch.cs b/Tiles/SunkenSea/NavyPrismTorch.cs index 5e79331d10..db44eff724 100644 --- a/Tiles/SunkenSea/NavyPrismTorch.cs +++ b/Tiles/SunkenSea/NavyPrismTorch.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Tiles.SunkenSea 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(170, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(170, 255, 255), 1f); return false; } @@ -70,10 +70,10 @@ namespace CalamityMod.Tiles.SunkenSea return true; } - public override float GetTorchLuck(Player player) - { - // Note: Total Torch luck never goes below zero - return player.Calamity().ZoneSunkenSea ? 1f : -1f; - } + public override float GetTorchLuck(Player player) + { + // Note: Total Torch luck never goes below zero + return player.Calamity().ZoneSunkenSea ? 1f : -1f; + } } } diff --git a/Tiles/SunkenSea/Navystone.cs b/Tiles/SunkenSea/Navystone.cs index 74044959e9..8799172e30 100644 --- a/Tiles/SunkenSea/Navystone.cs +++ b/Tiles/SunkenSea/Navystone.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using System.Collections.Generic; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; @@ -7,12 +8,9 @@ using Terraria.ModLoader; namespace CalamityMod.Tiles.SunkenSea { - public class Navystone : ModTile + public class Navystone : ModTile, IMergeableTile { - public byte[,] tileAdjacency; - public byte[,] secondTileAdjacency; - public byte[,] thirdTileAdjacency; - public byte[,] fourthTileAdjacency; + List IMergeableTile.TileAdjacencies { get; } = []; public override void SetStaticDefaults() { @@ -27,10 +25,10 @@ namespace CalamityMod.Tiles.SunkenSea AddMapEntry(new Color(31, 92, 114)); HitSound = SoundID.Tink; - TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out tileAdjacency); - TileFraming.SetUpUniversalMerge(Type, TileID.Sandstone, out secondTileAdjacency); - TileFraming.SetUpUniversalMerge(Type, TileID.Sand, out thirdTileAdjacency); - TileFraming.SetUpUniversalMerge(Type, TileID.HardenedSand, out fourthTileAdjacency); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/EutrophicSandMerge"); + this.RegisterUniversalMerge(TileID.Sandstone, "CalamityMod/Tiles/Merges/SandstoneMerge"); + this.RegisterUniversalMerge(TileID.Sand, "CalamityMod/Tiles/Merges/SandMerge"); + this.RegisterUniversalMerge(TileID.HardenedSand, "CalamityMod/Tiles/Merges/HardenedSandMerge"); } public override void NumDust(int i, int j, bool fail, ref int num) @@ -38,20 +36,8 @@ namespace CalamityMod.Tiles.SunkenSea num = fail ? 1 : 3; } - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) - { - TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/EutrophicSandMerge"); - TileFraming.DrawUniversalMergeFrames(i, j, secondTileAdjacency, "CalamityMod/Tiles/Merges/SandstoneMerge"); - TileFraming.DrawUniversalMergeFrames(i, j, thirdTileAdjacency, "CalamityMod/Tiles/Merges/SandMerge"); - TileFraming.DrawUniversalMergeFrames(i, j, fourthTileAdjacency, "CalamityMod/Tiles/Merges/HardenedSandMerge"); - } - public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { - TileFraming.GetAdjacencyData(i, j, ModContent.TileType(), out tileAdjacency[i, j]); - TileFraming.GetAdjacencyData(i, j, TileID.Sandstone, out secondTileAdjacency[i, j]); - TileFraming.GetAdjacencyData(i, j, TileID.Sand, out thirdTileAdjacency[i, j]); - TileFraming.GetAdjacencyData(i, j, TileID.HardenedSand, out thirdTileAdjacency[i, j]); return TileFraming.BrimstoneFraming(i, j, resetFrame); } } diff --git a/Tiles/SunkenSea/PrismCrateTile.cs b/Tiles/SunkenSea/PrismCrateTile.cs new file mode 100644 index 0000000000..6895b56eaa --- /dev/null +++ b/Tiles/SunkenSea/PrismCrateTile.cs @@ -0,0 +1,32 @@ +using CalamityMod.Items.Fishing.SunkenSeaCatches; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.SunkenSea +{ + public class PrismCrateTile : ModTile + { + public override void SetStaticDefaults() + { + Main.tileSolidTop[Type] = true; + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileTable[Type] = true; + Main.tileLavaDeath[Type] = true; + Main.tileWaterDeath[Type] = false; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.addTile(Type); + AddMapEntry(new Color(145, 240, 255), CalamityUtils.GetItemName()); + DustType = 253; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } +} diff --git a/Tiles/SunkenSea/PrismCrateTile.png b/Tiles/SunkenSea/PrismCrateTile.png new file mode 100644 index 0000000000..509f060b9a Binary files /dev/null and b/Tiles/SunkenSea/PrismCrateTile.png differ diff --git a/Tiles/SunkenSea/RefractivePrismTorch.cs b/Tiles/SunkenSea/RefractivePrismTorch.cs index 84b0e5b078..e0e3d784e4 100644 --- a/Tiles/SunkenSea/RefractivePrismTorch.cs +++ b/Tiles/SunkenSea/RefractivePrismTorch.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.SunkenSea @@ -12,7 +13,7 @@ namespace CalamityMod.Tiles.SunkenSea 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(210, 190, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(210, 190, 255), 1f); return false; } @@ -70,10 +71,10 @@ namespace CalamityMod.Tiles.SunkenSea return true; } - public override float GetTorchLuck(Player player) - { - // Note: Total Torch luck never goes below zero - return player.Calamity().ZoneSunkenSea ? 1f : -1f; - } + public override float GetTorchLuck(Player player) + { + // Note: Total Torch luck never goes below zero + return player.Calamity().ZoneSunkenSea ? 1f : -1f; + } } } diff --git a/Tiles/SunkenSea/SeaPrism.cs b/Tiles/SunkenSea/SeaPrism.cs index 0b027a5498..83d6da7082 100644 --- a/Tiles/SunkenSea/SeaPrism.cs +++ b/Tiles/SunkenSea/SeaPrism.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using System.Collections.Generic; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; @@ -7,13 +8,13 @@ using Terraria.ModLoader; namespace CalamityMod.Tiles.SunkenSea { - public class SeaPrism : ModTile + public class SeaPrism : ModTile, IMergeableTile { - public byte[,] tileAdjacency; - private const short subsheetWidth = 450; - private const short subsheetHeight = 198; - + private const short subsheetHeight = 198; + + List IMergeableTile.TileAdjacencies { get; } = []; + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; @@ -32,7 +33,7 @@ namespace CalamityMod.Tiles.SunkenSea Main.tileSpelunker[Type] = true; MinPick = 55; - TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out tileAdjacency); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/NavystoneMerge"); } public override void NumDust(int i, int j, bool fail, ref int num) @@ -45,15 +46,9 @@ namespace CalamityMod.Tiles.SunkenSea frameXOffset = i % 2 * subsheetWidth; frameYOffset = j % 2 * subsheetHeight; } - - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) - { - TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/NavystoneMerge"); - } - + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { - TileFraming.GetAdjacencyData(i, j, ModContent.TileType(), out tileAdjacency[i, j]); return TileFraming.BrimstoneFraming(i, j, resetFrame); } } diff --git a/Tiles/SunkenSea/SeaPrismBrick.cs b/Tiles/SunkenSea/SeaPrismBrick.cs index da91947374..df756fa58f 100644 --- a/Tiles/SunkenSea/SeaPrismBrick.cs +++ b/Tiles/SunkenSea/SeaPrismBrick.cs @@ -6,7 +6,7 @@ using Terraria.ModLoader; namespace CalamityMod.Tiles.SunkenSea { - + public class SeaPrismBrick : ModTile { private static int sheetWidth = 216; diff --git a/Tiles/SunkenSea/SmallCorals.cs b/Tiles/SunkenSea/SmallCorals.cs index bae8229c57..6848dccbca 100644 --- a/Tiles/SunkenSea/SmallCorals.cs +++ b/Tiles/SunkenSea/SmallCorals.cs @@ -18,8 +18,8 @@ namespace CalamityMod.Tiles.SunkenSea Main.tileLavaDeath[Type] = true; Main.tileWaterDeath[Type] = true; Main.tileFrameImportant[Type] = true; - TileID.Sets.ReplaceTileBreakUp[Type] = true; - TileID.Sets.SwaysInWindBasic[Type] = false; + TileID.Sets.ReplaceTileBreakUp[Type] = true; + TileID.Sets.SwaysInWindBasic[Type] = false; TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2); TileObjectData.addTile(Type); AddMapEntry(new Color(178, 28, 153)); diff --git a/Tiles/SunkenSea/SunkenCrateTile.png b/Tiles/SunkenSea/SunkenCrateTile.png deleted file mode 100644 index 7bff36134e..0000000000 Binary files a/Tiles/SunkenSea/SunkenCrateTile.png and /dev/null differ diff --git a/Tiles/SunkenSea/SunkenStalactite.cs b/Tiles/SunkenSea/SunkenStalactite.cs index de9ab0aea1..da6c615697 100644 --- a/Tiles/SunkenSea/SunkenStalactite.cs +++ b/Tiles/SunkenSea/SunkenStalactite.cs @@ -1,39 +1,39 @@ -using Terraria; +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; -using Terraria.Enums; using Terraria.ObjectData; -using Terraria.DataStructures; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; namespace CalamityMod.Tiles.SunkenSea { - [LegacyName("SunkenStalactites")] - public class SunkenStalactite1 : ModTile - { - public override void SetStaticDefaults() - { - Main.tileFrameImportant[Type] = true; + [LegacyName("SunkenStalactites")] + public class SunkenStalactite1 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; Main.tileNoAttach[Type] = true; TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2); - TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); - TileObjectData.newTile.AnchorBottom = default(AnchorData); + TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.AnchorBottom = default(AnchorData); TileObjectData.addTile(Type); DustType = 253; AddMapEntry(new Color(31, 92, 114)); base.SetStaticDefaults(); - } - } + } + } - public class SunkenStalactite2 : SunkenStalactite1 - { - } + public class SunkenStalactite2 : SunkenStalactite1 + { + } - public class SunkenStalactite3 : SunkenStalactite1 - { - } + public class SunkenStalactite3 : SunkenStalactite1 + { + } } diff --git a/Tiles/SunkenSea/SunkenStalactitesSmall.cs b/Tiles/SunkenSea/SunkenStalactitesSmall.cs index 51c56bbdbc..a8c2b84f4d 100644 --- a/Tiles/SunkenSea/SunkenStalactitesSmall.cs +++ b/Tiles/SunkenSea/SunkenStalactitesSmall.cs @@ -1,30 +1,30 @@ -using Terraria; +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; -using Terraria.Enums; using Terraria.ObjectData; -using Terraria.DataStructures; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; namespace CalamityMod.Tiles.SunkenSea { - public class SunkenStalactitesSmall : ModTile - { - public override void SetStaticDefaults() - { - Main.tileFrameImportant[Type] = true; + public class SunkenStalactitesSmall : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; Main.tileNoAttach[Type] = true; TileObjectData.newTile.CopyFrom(TileObjectData.Style1x1); - TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); - TileObjectData.newTile.AnchorBottom = default(AnchorData); + TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.AnchorBottom = default(AnchorData); TileObjectData.addTile(Type); DustType = 253; AddMapEntry(new Color(31, 92, 114)); base.SetStaticDefaults(); - } - } + } + } } diff --git a/Tiles/SunkenSea/SunkenStalagmite.cs b/Tiles/SunkenSea/SunkenStalagmite.cs index b93ef2c950..9f2f977034 100644 --- a/Tiles/SunkenSea/SunkenStalagmite.cs +++ b/Tiles/SunkenSea/SunkenStalagmite.cs @@ -1,22 +1,22 @@ -using Terraria; +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; -using Terraria.Enums; using Terraria.ObjectData; -using Terraria.DataStructures; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; namespace CalamityMod.Tiles.SunkenSea { [LegacyName("SunkenStalagmites")] - public class SunkenStalagmite1 : ModTile - { - public override void SetStaticDefaults() - { - Main.tileFrameImportant[Type] = true; + public class SunkenStalagmite1 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; Main.tileNoAttach[Type] = true; TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2); TileObjectData.addTile(Type); @@ -24,14 +24,14 @@ namespace CalamityMod.Tiles.SunkenSea AddMapEntry(new Color(31, 92, 114)); base.SetStaticDefaults(); - } - } + } + } public class SunkenStalagmite2 : SunkenStalagmite1 - { - } + { + } - public class SunkenStalagmite3 : SunkenStalagmite1 - { - } + public class SunkenStalagmite3 : SunkenStalagmite1 + { + } } diff --git a/Tiles/SunkenSea/SunkenStalagmitesSmall.cs b/Tiles/SunkenSea/SunkenStalagmitesSmall.cs index 9a40fc2c04..708499454c 100644 --- a/Tiles/SunkenSea/SunkenStalagmitesSmall.cs +++ b/Tiles/SunkenSea/SunkenStalagmitesSmall.cs @@ -1,21 +1,21 @@ -using Terraria; +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; -using Terraria.Enums; using Terraria.ObjectData; -using Terraria.DataStructures; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; namespace CalamityMod.Tiles.SunkenSea { - public class SunkenStalagmitesSmall : ModTile - { - public override void SetStaticDefaults() - { - Main.tileFrameImportant[Type] = true; + public class SunkenStalagmitesSmall : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; Main.tileNoAttach[Type] = true; TileObjectData.newTile.CopyFrom(TileObjectData.Style1x1); TileObjectData.addTile(Type); @@ -23,6 +23,6 @@ namespace CalamityMod.Tiles.SunkenSea AddMapEntry(new Color(31, 92, 114)); base.SetStaticDefaults(); - } - } + } + } } diff --git a/Tiles/UelibloomBrick.cs b/Tiles/UelibloomBrick.cs index 3cb8c50384..ee453b6ab0 100644 --- a/Tiles/UelibloomBrick.cs +++ b/Tiles/UelibloomBrick.cs @@ -1,27 +1,28 @@ -using CalamityMod.Dusts.Furniture; +using System.Collections.Generic; +using CalamityMod.Dusts.Furniture; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; +using Terraria.GameContent.Metadata; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles { - public class UelibloomBrick : ModTile + public class UelibloomBrick : ModTile, IMergeableTile { private int extraFrameHeight = 36; private int extraFrameWidth = 90; - public byte[,] tileAdjacency; - public byte[,] secondTileAdjacency; - public byte[,] thirdTileAdjacency; + List IMergeableTile.TileAdjacencies { get; } = []; public override void SetStaticDefaults() { Main.tileSolid[Type] = true; Main.tileMergeDirt[Type] = false; Main.tileBlockLight[Type] = true; + TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Organic"]); CalamityUtils.MergeWithGeneral(Type); CalamityUtils.MergeDecorativeTiles(Type); @@ -30,9 +31,9 @@ namespace CalamityMod.Tiles HitSound = SoundID.Tink; AddMapEntry(new Color(174, 108, 46)); - TileFraming.SetUpUniversalMerge(Type, TileID.Dirt, out tileAdjacency); - TileFraming.SetUpUniversalMerge(Type, TileID.Stone, out secondTileAdjacency); - TileFraming.SetUpUniversalMerge(Type, TileID.Mud, out thirdTileAdjacency); + this.RegisterUniversalMerge(TileID.Dirt, "CalamityMod/Tiles/Merges/DirtMerge"); + this.RegisterUniversalMerge(TileID.Stone, "CalamityMod/Tiles/Merges/StoneMerge"); + this.RegisterUniversalMerge(TileID.Mud, "CalamityMod/Tiles/Merges/MudMerge"); } public override bool CreateDust(int i, int j, ref int type) @@ -51,7 +52,7 @@ namespace CalamityMod.Tiles { Main.instance.TilesRenderer.AddSpecialLegacyPoint(i, j); } - catch {} + catch { } } } @@ -67,18 +68,8 @@ namespace CalamityMod.Tiles DrawExtraDrapes(i, j, leaves, drawOffset, drawColour); } - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) - { - TileFraming.DrawUniversalMergeFrames(i, j, thirdTileAdjacency, "CalamityMod/Tiles/Merges/MudMerge"); - TileFraming.DrawUniversalMergeFrames(i, j, secondTileAdjacency, "CalamityMod/Tiles/Merges/StoneMerge"); - TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/DirtMerge"); - } - public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { - TileFraming.GetAdjacencyData(i, j, TileID.Dirt, out tileAdjacency[i, j]); - TileFraming.GetAdjacencyData(i, j, TileID.Stone, out secondTileAdjacency[i, j]); - TileFraming.GetAdjacencyData(i, j, TileID.Mud, out thirdTileAdjacency[i, j]); return TileFraming.BrimstoneFraming(i, j, resetFrame); } diff --git a/Tiles/VernalSoil.cs b/Tiles/VernalSoil.cs index 80eceb4814..eb4e766460 100644 --- a/Tiles/VernalSoil.cs +++ b/Tiles/VernalSoil.cs @@ -1,23 +1,25 @@ -using Microsoft.Xna.Framework; +using System.Collections.Generic; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; using Terraria.DataStructures; +using Terraria.GameContent.Metadata; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Tiles { - public class VernalSoil : ModTile + public class VernalSoil : ModTile, IMergeableTile { - public byte[,] tileAdjacency; - public byte[,] secondTileAdjacency; - public byte[,] thirdTileAdjacency; + List IMergeableTile.TileAdjacencies { get; } = []; + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; + TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Organic"]); CalamityUtils.MergeWithGeneral(Type); @@ -27,9 +29,9 @@ namespace CalamityMod.Tiles AddMapEntry(new Color(80, 120, 0)); HitSound = SoundID.Dig; - TileFraming.SetUpUniversalMerge(Type, TileID.Dirt, out tileAdjacency); - TileFraming.SetUpUniversalMerge(Type, TileID.Stone, out secondTileAdjacency); - TileFraming.SetUpUniversalMerge(Type, TileID.Mud, out thirdTileAdjacency); + this.RegisterUniversalMerge(TileID.Dirt, "CalamityMod/Tiles/Merges/DirtMerge"); + this.RegisterUniversalMerge(TileID.Stone, "CalamityMod/Tiles/Merges/StoneMerge"); + this.RegisterUniversalMerge(TileID.Mud, "CalamityMod/Tiles/Merges/MudMerge"); } public override void RandomUpdate(int i, int j) @@ -148,21 +150,6 @@ namespace CalamityMod.Tiles } } - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) - { - TileFraming.DrawUniversalMergeFrames(i, j, thirdTileAdjacency, "CalamityMod/Tiles/Merges/MudMerge"); - TileFraming.DrawUniversalMergeFrames(i, j, secondTileAdjacency, "CalamityMod/Tiles/Merges/StoneMerge"); - TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/DirtMerge"); - } - - public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) - { - TileFraming.GetAdjacencyData(i, j, TileID.Dirt, out tileAdjacency[i, j]); - TileFraming.GetAdjacencyData(i, j, TileID.Stone, out secondTileAdjacency[i, j]); - TileFraming.GetAdjacencyData(i, j, TileID.Mud, out thirdTileAdjacency[i, j]); - return true; - } - public override void NumDust(int i, int j, bool fail, ref int num) { num = fail ? 1 : 3; diff --git a/Tiles/WulfrumPipes.cs b/Tiles/WulfrumPipes.cs index 1c7b8f45ed..d2c6485691 100644 --- a/Tiles/WulfrumPipes.cs +++ b/Tiles/WulfrumPipes.cs @@ -1,14 +1,14 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; -using Terraria.Audio; -using Microsoft.Xna.Framework.Graphics; -using Terraria.DataStructures; -using System; -using CalamityMod.Systems; +using System; using CalamityMod.Items.Tools; +using CalamityMod.Systems; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Tiles { @@ -19,7 +19,7 @@ namespace CalamityMod.Tiles //public float PlaceProgress(Point pos) => Math.Clamp((PlaceTimeStart - Main.GameUpdateCount) / (pos.GetTileRNG() * 5f + 5f), 0, 1); public static Vector2 DisplaceStart(Point pos) => new Vector2(0, -(pos.GetTileRNG() * 10f + 7f)); - public static float RotationStart(Point pos) => - MathHelper.PiOver4 * 0.8f + MathHelper.PiOver4 * 1.6f * pos.GetTileRNG(1); + public static float RotationStart(Point pos) => -MathHelper.PiOver4 * 0.8f + MathHelper.PiOver4 * 1.6f * pos.GetTileRNG(1); public override void SetStaticDefaults() @@ -47,9 +47,9 @@ namespace CalamityMod.Tiles public override void PlaceInWorld(int i, int j, Item item) { - SoundEngine.PlaySound(SoundID.Item52 with { Volume = SoundID.Item52.Volume * 0.75f, Pitch = SoundID.Item52.Pitch - 0.5f }, new Vector2( i * 16, j * 16 )); + SoundEngine.PlaySound(SoundID.Item52 with { Volume = SoundID.Item52.Volume * 0.75f, Pitch = SoundID.Item52.Pitch - 0.5f }, new Vector2(i * 16, j * 16)); } - + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) { return false; diff --git a/UI/BossHealthBarManager.cs b/UI/BossHealthBarManager.cs index 6c8057c280..66a703bbc1 100644 --- a/UI/BossHealthBarManager.cs +++ b/UI/BossHealthBarManager.cs @@ -1,4 +1,7 @@ -using CalamityMod.Events; +using System; +using System.Collections.Generic; +using System.Linq; +using CalamityMod.Events; using CalamityMod.NPCs.AquaticScourge; using CalamityMod.NPCs.AstrumDeus; using CalamityMod.NPCs.CalClone; @@ -24,9 +27,6 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; using ReLogic.Graphics; -using System; -using System.Collections.Generic; -using System.Linq; using Terraria; using Terraria.GameContent; using Terraria.GameContent.Events; @@ -34,7 +34,6 @@ using Terraria.GameContent.UI.BigProgressBar; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; - using static Terraria.ModLoader.ModContent; namespace CalamityMod.UI diff --git a/UI/BossRushUI.cs b/UI/BossRushUI.cs index 57742fa04f..8b3ae93b96 100644 --- a/UI/BossRushUI.cs +++ b/UI/BossRushUI.cs @@ -1,8 +1,8 @@ -using CalamityMod.CalPlayer; +using System.Linq; +using CalamityMod.CalPlayer; using CalamityMod.Events; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System.Linq; using Terraria; using Terraria.ModLoader; diff --git a/UI/CalamitasEnchantments/CalamitasEnchantUI.cs b/UI/CalamitasEnchantments/CalamitasEnchantUI.cs index 448dea1af0..d4aa053294 100644 --- a/UI/CalamitasEnchantments/CalamitasEnchantUI.cs +++ b/UI/CalamitasEnchantments/CalamitasEnchantUI.cs @@ -1,15 +1,15 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; +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 Terraria.UI; using Terraria.UI.Chat; -using Terraria.Audio; -using Terraria.GameContent; namespace CalamityMod.UI.CalamitasEnchants { diff --git a/UI/CalamitasEnchantments/Enchantment.cs b/UI/CalamitasEnchantments/Enchantment.cs index 9bc5deb41d..1ce7588aee 100644 --- a/UI/CalamitasEnchantments/Enchantment.cs +++ b/UI/CalamitasEnchantments/Enchantment.cs @@ -1,4 +1,4 @@ -using System; +using System; using Terraria; using Terraria.Localization; diff --git a/UI/CalamitasEnchantments/EnchantmentManager.cs b/UI/CalamitasEnchantments/EnchantmentManager.cs index 3f76bf1485..8b66952b06 100644 --- a/UI/CalamitasEnchantments/EnchantmentManager.cs +++ b/UI/CalamitasEnchantments/EnchantmentManager.cs @@ -1,4 +1,7 @@ -using CalamityMod.Items.Accessories; +using System; +using System.Collections.Generic; +using System.Linq; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; @@ -6,9 +9,6 @@ using CalamityMod.Items.Weapons.Summon; using CalamityMod.NPCs.Other; using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; -using System; -using System.Collections.Generic; -using System.Linq; using Terraria; using Terraria.ID; using Terraria.Localization; @@ -186,14 +186,14 @@ namespace CalamityMod.UI.CalamitasEnchants "CalamityMod/UI/CalamitasEnchantments/CurseIcon_Resentful", null, player => player.Calamity().farProximityRewardEnchant = true, - item => item.IsEnchantable() && item.damage > 0 && item.shoot > ProjectileID.None && !item.IsTrueMelee() && item.type != ModContent.ItemType()), + item => item.IsEnchantable() && item.damage > 0 && item.shoot > ProjectileID.None && !item.IsTrueMelee() && item.type != ModContent.ItemType()), new Enchantment(CalamityUtils.GetText("UI.Bloodthirsty.DisplayName"), CalamityUtils.GetText("UI.Bloodthirsty.Description"), 500, "CalamityMod/UI/CalamitasEnchantments/CurseIcon_Bloodthirsty", null, player => player.Calamity().closeProximityRewardEnchant = true, - item => item.IsEnchantable() && item.damage > 0 && item.shoot > ProjectileID.None && !item.IsTrueMelee() && item.type != ModContent.ItemType()), + item => item.IsEnchantable() && item.damage > 0 && item.shoot > ProjectileID.None && !item.IsTrueMelee() && item.type != ModContent.ItemType()), new Enchantment(CalamityUtils.GetText("UI.Ephemeral.DisplayName"), CalamityUtils.GetText("UI.Ephemeral.Description"), 600, diff --git a/UI/CooldownRackUI.cs b/UI/CooldownRackUI.cs index 6ab2bf36d5..acd23acbd4 100644 --- a/UI/CooldownRackUI.cs +++ b/UI/CooldownRackUI.cs @@ -1,8 +1,8 @@ -using CalamityMod.Cooldowns; +using System; +using System.Collections.Generic; +using CalamityMod.Cooldowns; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.Collections.Generic; using Terraria; namespace CalamityMod.UI diff --git a/UI/DebuffSystem/BestiaryDebuffInfo.cs b/UI/DebuffSystem/BestiaryDebuffInfo.cs new file mode 100644 index 0000000000..1a08b81c3f --- /dev/null +++ b/UI/DebuffSystem/BestiaryDebuffInfo.cs @@ -0,0 +1,115 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.GameContent.Bestiary; +using Terraria.GameContent.UI.Elements; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.UI; + +namespace CalamityMod.UI.DebuffSystem +{ + public class BestiaryDebuffInfo : IBestiaryInfoElement + { + public string[] elements; + + public BestiaryDebuffInfo(string[] elements) + { + this.elements = elements; + } + + public UIElement ProvideUIElement(BestiaryUICollectionInfo info) + { + // Don't show debuff info until stats are unlocked + if (info.UnlockState < BestiaryEntryUnlockState.CanShowStats_2) + { + return null; + } + // The main background panel + UIPanel backgroundPanel = new UIPanel(Main.Assets.Request("Images/UI/Bestiary/Stat_Panel"), null, 12, 7) + { + Width = new StyleDimension(-11f, 1f), + Height = new StyleDimension(180f, 0f), + BackgroundColor = new Color(43, 56, 101), + BorderColor = Color.Transparent, + Left = new StyleDimension(2.5f, 0f), + PaddingLeft = 4f, + PaddingRight = 4f + }; + + // The title of the panel + UIText titleText = new UIText(CalamityUtils.GetTextValue("UI.DebuffSystem.Title"), 1f) + { + HAlign = 0f, + VAlign = 0f, + Width = StyleDimension.FromPixelsAndPercent(0f, 1f), + Height = StyleDimension.FromPixelsAndPercent(0f, 1f), + IsWrapped = true + }; + + backgroundPanel.Append(titleText); + + // Add all five elements to the panel, each one below the previous + for (int i = 0; i < 5; i++) + { + string path = "CalamityMod/UI/DebuffSystem/"; + switch (i) + { + case 0: + path += "Heat"; + break; + case 1: + path += "Sickness"; + break; + case 2: + path += "Cold"; + break; + case 3: + path += "Electricity"; + break; + case 4: + path += "Water"; + break; + } + path += "DebuffType"; + float topPos = 0.2f + i * 0.175f; + // Icon + UIImage elementImage = new UIImage(ModContent.Request(path)) + { + HAlign = 0f, + VAlign = 0f, + Width = StyleDimension.FromPixelsAndPercent(0f, 1f), + Height = StyleDimension.FromPixelsAndPercent(0f, 1f), + Top = new StyleDimension(0f, topPos - 0.0525f), + Left = new StyleDimension(8f, 0f), + ImageScale = 0.8f, + }; + backgroundPanel.Append(elementImage); + + // Text + UIText elementText = new UIText(Language.GetText(elements[i]), 0.8f) + { + HAlign = 0f, + VAlign = 0f, + Width = StyleDimension.FromPixelsAndPercent(0f, 1f), + Height = StyleDimension.FromPixelsAndPercent(0f, 1f), + Top = new StyleDimension(0f, topPos), + Left = new StyleDimension(0f, 0.05f), + }; + backgroundPanel.Append(elementText); + } + + // Summarize the debuff resistance system when hovering over the panel + backgroundPanel.OnUpdate += ElementDescription; + return backgroundPanel; + } + + public static void ElementDescription(UIElement uelement) + { + if (uelement.IsMouseHovering) + { + Main.instance.MouseText(CalamityUtils.GetTextValue("UI.DebuffSystem.Description"), 0, 0); + } + } + } +} diff --git a/UI/DebuffSystem/ColdDebuffType.png b/UI/DebuffSystem/ColdDebuffType.png new file mode 100644 index 0000000000..eb0a88f11a Binary files /dev/null and b/UI/DebuffSystem/ColdDebuffType.png differ diff --git a/UI/DebuffSystem/ElectricityDebuffType.png b/UI/DebuffSystem/ElectricityDebuffType.png new file mode 100644 index 0000000000..30539636b2 Binary files /dev/null and b/UI/DebuffSystem/ElectricityDebuffType.png differ diff --git a/UI/DebuffSystem/HeatDebuffType.png b/UI/DebuffSystem/HeatDebuffType.png new file mode 100644 index 0000000000..8b25d715bb Binary files /dev/null and b/UI/DebuffSystem/HeatDebuffType.png differ diff --git a/UI/DebuffSystem/SicknessDebuffType.png b/UI/DebuffSystem/SicknessDebuffType.png new file mode 100644 index 0000000000..db56ba8449 Binary files /dev/null and b/UI/DebuffSystem/SicknessDebuffType.png differ diff --git a/UI/DebuffSystem/WaterDebuffType.png b/UI/DebuffSystem/WaterDebuffType.png new file mode 100644 index 0000000000..1e41f4d471 Binary files /dev/null and b/UI/DebuffSystem/WaterDebuffType.png differ diff --git a/UI/DefenseDamageDisplayUI.cs b/UI/DefenseDamageDisplayUI.cs index fd21ef38c2..d2e10fa721 100644 --- a/UI/DefenseDamageDisplayUI.cs +++ b/UI/DefenseDamageDisplayUI.cs @@ -1,10 +1,10 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; -using Terraria.UI.Chat; +using Terraria.GameContent; using Terraria.Localization; using Terraria.ModLoader; -using Terraria.GameContent; +using Terraria.UI.Chat; namespace CalamityMod.UI { diff --git a/UI/DraedonLogs/DraedonsLogGUI.cs b/UI/DraedonLogs/DraedonsLogGUI.cs index e14730ab4f..3f513bf6ea 100644 --- a/UI/DraedonLogs/DraedonsLogGUI.cs +++ b/UI/DraedonLogs/DraedonsLogGUI.cs @@ -1,7 +1,7 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.GameContent; using Terraria.ModLoader; diff --git a/UI/DraedonSummoning/CodebreakerUI.Communication.cs b/UI/DraedonSummoning/CodebreakerUI.Communication.cs index 898817b3a0..bfaa365107 100644 --- a/UI/DraedonSummoning/CodebreakerUI.Communication.cs +++ b/UI/DraedonSummoning/CodebreakerUI.Communication.cs @@ -5,11 +5,13 @@ using CalamityMod.NPCs.ExoMechs; using log4net; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework.Input; using ReLogic.Content; using ReLogic.Graphics; using Terraria; using Terraria.Audio; using Terraria.GameContent; +using Terraria.GameInput; using Terraria.Graphics.Shaders; using Terraria.ModLoader; using Terraria.UI.Chat; @@ -110,6 +112,8 @@ namespace CalamityMod.UI.DraedonSummoning set; } + public static float DialogOffYCache = 0; + /// /// The vertical offset as a result of scrolling for the topic options. /// @@ -170,7 +174,7 @@ namespace CalamityMod.UI.DraedonSummoning get { if (PreviousTextCharacter is '\n') - return 48; + return 80; if (PreviousTextCharacter is '.' or '?') return 9; @@ -182,7 +186,15 @@ namespace CalamityMod.UI.DraedonSummoning /// /// The text Draedon starts off with when you interact with the codebreaker. The first time you see him he says nothing, but in successive calls he asks what your inquiry is. /// - public static string InquiryText => Main.LocalPlayer.Calamity().HasTalkedAtCodebreaker ? "State your inquiry." : "..."; + public static string InquiryText + { + get + { + var mp = Main.LocalPlayer.Calamity(); + string key = mp.HasTalkedAtCodebreaker ? (mp.HasCraftedDraedonsForge ? "UI.CommunicationStartNormal" : "UI.CommunicationStartNoForge") : "UI.CommunicationStartInitial"; + return CalamityUtils.GetTextValue(key); + } + } /// /// The text of the previously hovered topic option. This is used to ensure hover clicking sounds only play if the sound type changes. @@ -297,7 +309,7 @@ namespace CalamityMod.UI.DraedonSummoning DisplayTextSelectionOptions(panelArea, panelScale); DisplayDialogHistory(panelArea, panelScale); if (OptionsTextOpacity > 0f && DraedonScreenStaticInterpolant <= 0f) - DrawExitButton(panelCenter + new Vector2(-16f, 138f) * GeneralScale, OptionsTextOpacity); + DrawExitButton(panelCenter + new Vector2(10f, 150f) * GeneralScale, OptionsTextOpacity); } public static void DisplayDraedonFacePanel(Vector2 panelCenter, Vector2 panelScale) @@ -306,7 +318,7 @@ namespace CalamityMod.UI.DraedonSummoning Texture2D iconTexture = ModContent.Request("CalamityMod/UI/DraedonSummoning/DraedonIconBorder").Value; Texture2D iconTextureInner = ModContent.Request("CalamityMod/UI/DraedonSummoning/DraedonIconBorderInner").Value; float draedonIconDrawInterpolant = Utils.GetLerpValue(0.51f, 0.36f, DraedonScreenStaticInterpolant, true); - Vector2 draedonIconDrawTopRight = panelCenter + new Vector2(-218f, -130f) * panelScale; + Vector2 draedonIconDrawTopRight = panelCenter + new Vector2(-204f, -125f) * panelScale; draedonIconDrawTopRight += new Vector2(24f, 4f) * panelScale; Vector2 draedonIconScale = panelScale * 0.5f; @@ -350,7 +362,7 @@ namespace CalamityMod.UI.DraedonSummoning // Draw the outline for the text selection options. float selectionOptionsDrawInterpolant = Utils.GetLerpValue(0.3f, 0f, DraedonScreenStaticInterpolant, true); Texture2D selectionOutline = ModContent.Request("CalamityMod/UI/DraedonSummoning/DraedonSelectionOutline").Value; - Vector2 selectionCenter = panelArea.BottomLeft() - new Vector2(selectionOutline.Width * -0.5f - 24f, selectionOutline.Height * 0.5f + 24f) * panelScale; + Vector2 selectionCenter = panelArea.BottomLeft() - new Vector2(selectionOutline.Width * -0.5f - 42f, selectionOutline.Height * 0.5f + 13f) * panelScale; Rectangle selectionArea = Utils.CenteredRectangle(selectionCenter, selectionOutline.Size() * panelScale); Main.spriteBatch.Draw(selectionOutline, selectionCenter, null, Color.White * selectionOptionsDrawInterpolant, 0f, selectionOutline.Size() * 0.5f, panelScale, 0, 0f); @@ -373,6 +385,8 @@ namespace CalamityMod.UI.DraedonSummoning float cutoffDistance = OptionsTextHeight / GeneralScale - selectionOutline.Height; if (cutoffDistance > 0f && OptionsTextOpacity > 0f) { + if (MouseScreenArea.Intersects(selectionArea)) + OptionsTextVerticalOffset += PlayerInput.ScrollWheelDeltaForUI * 0.1f; TopicOptionsScroller.PositionYInterpolant = MathHelper.Clamp(OptionsTextVerticalOffset / -cutoffDistance, 0f, 1f); TopicOptionsScroller.Draw(selectionArea.Top + GeneralScale * 62f, selectionArea.Bottom - GeneralScale * 62f, selectionArea.Right - GeneralScale * 12f, GeneralScale * 0.8f, OptionsTextOpacity); OptionsTextVerticalOffset = TopicOptionsScroller.PositionYInterpolant * -cutoffDistance; @@ -394,7 +408,7 @@ namespace CalamityMod.UI.DraedonSummoning { // Skip/isolate the introduction text as needed. string inquiry = dialog.Inquiry; - if (!Main.LocalPlayer.Calamity().HasTalkedAtCodebreaker && !DialogHistory.Any(d => d.Dialog == DialogOptions[0].Response)) + if (!Main.LocalPlayer.Calamity().HasCraftedDraedonsForge) { if (inquiry != DialogOptions[0].Inquiry) continue; @@ -402,7 +416,15 @@ namespace CalamityMod.UI.DraedonSummoning while (DialogHistory.Count < 1) DialogHistory.Add(new(string.Empty, true)); } - else if (inquiry == DialogOptions[0].Inquiry) + else if (!DialogOptions[1].HasBeenSeen) + { + if (inquiry != DialogOptions[1].Inquiry) + continue; + + while (DialogHistory.Count < 1) + DialogHistory.Add(new(string.Empty, true)); + } + else if (inquiry == DialogOptions[0].Inquiry || inquiry == DialogOptions[1].Inquiry) continue; // Draw the text marker. @@ -478,7 +500,7 @@ namespace CalamityMod.UI.DraedonSummoning // Ensure that the player starts at the bottom of the scoller, now that new text is generating there. Texture2D dialogOutline = ModContent.Request("CalamityMod/UI/DraedonSummoning/DraedonDialogOutline").Value; Rectangle dialogArea = Utils.CenteredRectangle(selectionCenter, dialogOutline.Size() * panelScale); - DialogVerticalOffset = dialogArea.Height - DialogHeight * GeneralScale; + DialogVerticalOffset = -DialogHeight * GeneralScale; DialogScroller.PositionYInterpolant = 1f; if (DialogVerticalOffset > 0f) DialogVerticalOffset = 0f; @@ -509,7 +531,7 @@ namespace CalamityMod.UI.DraedonSummoning // Draw the outline for the dialog history. float dialogHistoryDrawInterpolant = Utils.GetLerpValue(0.3f, 0f, DraedonScreenStaticInterpolant, true); Texture2D dialogOutline = ModContent.Request("CalamityMod/UI/DraedonSummoning/DraedonDialogOutline").Value; - Vector2 selectionCenter = panelArea.TopRight() - new Vector2(dialogOutline.Width * 0.5f + 16f, dialogOutline.Height * -0.5f - 6.5f) * panelScale; + Vector2 selectionCenter = panelArea.TopRight() - new Vector2(dialogOutline.Width * 0.5f + 12f, dialogOutline.Height * -0.5f - 12f) * panelScale; Rectangle dialogArea = Utils.CenteredRectangle(selectionCenter, dialogOutline.Size() * panelScale); Main.spriteBatch.Draw(dialogOutline, selectionCenter, null, Color.White * dialogHistoryDrawInterpolant, 0f, dialogOutline.Size() * 0.5f, panelScale, 0, 0f); @@ -547,7 +569,12 @@ namespace CalamityMod.UI.DraedonSummoning // Shift the text downward if it exceeds the current bottom. if (DialogHeight * 1.2f >= textCutoffRegion.Height && !string.IsNullOrEmpty(nextLetter.ToString()) && LatestDialogHeightIncrease > 0f) + { DialogVerticalOffset -= LatestDialogHeightIncrease; + DialogVerticalOffset += DialogOffYCache; + DialogHeight -= DialogOffYCache; + DialogOffYCache = 0; + } // Move to the next index in the dialog history once Draedon is finished speaking. if (WrittenDraedonText.Length >= FullDraedonText.Length) @@ -558,12 +585,19 @@ namespace CalamityMod.UI.DraedonSummoning } // Play a small dialog sound, similar to that of Undertale. - if (DialogSoundDelay <= 0 && nextLetter != ' ' && nextLetter != '\n') + if (DialogSoundDelay <= 0 && nextLetter != ' ') { - SoundStyle playThisSound = Main.rand.Next(DraedonTalks); - SoundEngine.PlaySound(playThisSound with { Volume = 0.4f }, Main.LocalPlayer.Center); + if (nextLetter != '\n') + { + DialogHeight -= DialogOffYCache; + DialogOffYCache = 0; + SoundStyle playThisSound = Main.rand.Next(DraedonTalks); + SoundEngine.PlaySound(playThisSound with { Volume = 0.4f }, Main.LocalPlayer.Center); - DialogSoundDelay = 4; + DialogSoundDelay = 4; + } + else if (WrittenDraedonText.Length < FullDraedonText.Length - 1 && FullDraedonText[WrittenDraedonText.Length] == '\n') + DialogOffYCache += panelScale.Y * 10f; } } @@ -572,6 +606,8 @@ namespace CalamityMod.UI.DraedonSummoning float cutoffDistance = DialogHeight - dialogOutline.Height; if (cutoffDistance > 0f && OptionsTextOpacity > 0f) { + if (MouseScreenArea.Intersects(dialogArea)) + DialogVerticalOffset += PlayerInput.ScrollWheelDeltaForUI * 0.2f; DialogScroller.PositionYInterpolant = MathHelper.Clamp(DialogVerticalOffset / -cutoffDistance, 0f, 1f); DialogScroller.Draw(dialogArea.Top + GeneralScale * 66f, dialogArea.Bottom - GeneralScale * 66f, dialogArea.Right - GeneralScale * 12f, GeneralScale * 0.8f, OptionsTextOpacity); DialogVerticalOffset = DialogScroller.PositionYInterpolant * -cutoffDistance; @@ -596,7 +632,7 @@ namespace CalamityMod.UI.DraedonSummoning foreach (var entry in dialogEntries) { int lineIndex = 0; - foreach (string line in Utils.WordwrapString(entry.Dialog, DialogFont, 336, 100, out _)) + foreach (string line in Utils.WordwrapString(entry.Dialog, DialogFont, 336, 1000, out _)) { if (string.IsNullOrEmpty(line)) continue; diff --git a/UI/DraedonSummoning/CodebreakerUI.cs b/UI/DraedonSummoning/CodebreakerUI.cs index ed5ae65894..5468ec11de 100644 --- a/UI/DraedonSummoning/CodebreakerUI.cs +++ b/UI/DraedonSummoning/CodebreakerUI.cs @@ -82,11 +82,11 @@ namespace CalamityMod.UI.DraedonSummoning // This variable is currently permanently set to false due to being deemed unfinished and not fit for release. // It used to be a local variable but has been moved to a property so that addon mods can easily enable it. - public static bool DraedonTalkFeatureEnabled + /*public static bool DraedonTalkFeatureEnabled { get; set; - } + }*/ public static Vector2 BackgroundCenter => new(500f, Main.screenHeight * 0.5f + 115f); @@ -102,7 +102,7 @@ namespace CalamityMod.UI.DraedonSummoning { // If not viewing the specific tile entity's interface anymore, if the ID is for some reason invalid, or if the player is not equipped to continue viewing the UI // don't do anything other than resetting necessary data. - if (!TileEntity.ByID.ContainsKey(ViewedTileEntityID) || TileEntity.ByID[ViewedTileEntityID] is not TECodebreaker codebreakerTileEntity || !Main.LocalPlayer.WithinRange(codebreakerTileEntity.Center, 270f) || !Main.playerInventory) + if (!TileEntity.ByID.ContainsKey(ViewedTileEntityID) || TileEntity.ByID[ViewedTileEntityID] is not TECodebreaker codebreakerTileEntity || !Main.LocalPlayer.WithinRange(codebreakerTileEntity.Center, 270f) || !Main.playerInventory || Main.LocalPlayer.channel) { VerificationButtonScale = 1f; CancelButtonScale = 0.75f; @@ -117,6 +117,7 @@ namespace CalamityMod.UI.DraedonSummoning DialogScroller.Reset(); TopicOptionsScroller.Reset(); DialogVerticalOffset = 0f; + DialogOffYCache = 0; OptionsTextVerticalOffset = 0f; DialogHeight = 0f; LatestDialogHeightIncrease = 0f; @@ -160,7 +161,7 @@ namespace CalamityMod.UI.DraedonSummoning DialogHistory.Clear(); bool canSummonDraedon = codebreakerTileEntity.ReadyToSummonDraedon && CalamityWorld.AbleToSummonDraedon; - bool canTalkToDraedon = codebreakerTileEntity.ReadyToSummonDraedon && DownedBossSystem.downedExoMechs && DraedonTalkFeatureEnabled; + bool canTalkToDraedon = codebreakerTileEntity.ReadyToSummonDraedon && DownedBossSystem.downedExoMechs; Vector2 backgroundTopLeft = BackgroundCenter - backgroundTexture.Size() * GeneralScale * 0.5f; // Draw the cell payment slot icon. diff --git a/UI/DraedonSummoning/CodebreakerUIScroller.cs b/UI/DraedonSummoning/CodebreakerUIScroller.cs index 3d0533c942..0fb7846df7 100644 --- a/UI/DraedonSummoning/CodebreakerUIScroller.cs +++ b/UI/DraedonSummoning/CodebreakerUIScroller.cs @@ -1,7 +1,7 @@ -using Microsoft.Xna.Framework.Graphics; -using Terraria.ModLoader; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; -using Microsoft.Xna.Framework; +using Terraria.ModLoader; namespace CalamityMod.UI.DraedonSummoning { diff --git a/UI/DraedonSummoning/DraedonContactPanel.png b/UI/DraedonSummoning/DraedonContactPanel.png index 8a5e54519b..7c96b04b5f 100644 Binary files a/UI/DraedonSummoning/DraedonContactPanel.png and b/UI/DraedonSummoning/DraedonContactPanel.png differ diff --git a/UI/DraedonSummoning/DraedonDialogRegistry.cs b/UI/DraedonSummoning/DraedonDialogRegistry.cs index 2cd6134ac9..874e7e8953 100644 --- a/UI/DraedonSummoning/DraedonDialogRegistry.cs +++ b/UI/DraedonSummoning/DraedonDialogRegistry.cs @@ -9,26 +9,64 @@ namespace CalamityMod.UI.DraedonSummoning public static readonly DraedonDialogEntry WhoAreYou = CreateFromKey("WhoAreYou"); - public static readonly DraedonDialogEntry CalamitasBeforeHerDefeat = CreateFromKey("CalamitasBeforeDefeat", () => !DownedBossSystem.downedCalamitas); + public static readonly DraedonDialogEntry WhoAreYouPart2 = CreateFromKey("WhoAreYouPart2"); - public static readonly DraedonDialogEntry CalamitasAfterHerDefeat = CreateFromKey("CalamitasAfterDefeat", () => DownedBossSystem.downedCalamitas); + public static readonly DraedonDialogEntry Origins = CreateFromKey("Origins"); - public static readonly DraedonDialogEntry Plague = CreateFromKey("Plague", () => DownedBossSystem.downedPlaguebringer); + public static readonly DraedonDialogEntry Crusade = CreateFromKey("Crusade"); - public static readonly DraedonDialogEntry SulphurousSea = CreateFromKey("SulphuricSea"); + public static readonly DraedonDialogEntry Goals = CreateFromKey("Goals"); - public static readonly DraedonDialogEntry TheTyrant = CreateFromKey("TheTyrant", () => DownedBossSystem.downedCalamitas); + public static readonly DraedonDialogEntry ExoMechs = CreateFromKey("ExoMechs"); + + public static readonly DraedonDialogEntry Exotech = CreateFromKey("Exotech"); + + public static readonly DraedonDialogEntry MiracleMatter = CreateFromKey("MiracleMatter"); + + public static readonly DraedonDialogEntry Forge = CreateFromKey("Forge"); + + public static readonly DraedonDialogEntry Yharim = CreateFromKey("Yharim"); + + public static readonly DraedonDialogEntry Aerie = CreateFromKey("Aerie"); + + public static readonly DraedonDialogEntry Calamitas = CreateFromKey("Calamitas"); + + public static readonly DraedonDialogEntry Dog = CreateFromKey("Dog"); + + public static readonly DraedonDialogEntry Distortion = CreateFromKey("Distortion"); + + public static readonly DraedonDialogEntry Mechs = CreateFromKey("Mechs"); + + public static readonly DraedonDialogEntry Plague = CreateFromKey("Plague"); + + public static readonly DraedonDialogEntry Astral = CreateFromKey("Astral"); + + public static readonly DraedonDialogEntry Sulphur = CreateFromKey("Sulphur"); internal static List DialogOptions = new() { // The first index is assumed to be the "who are you?" dialog by the UI. All other indices can be freely swapped around, however. WhoAreYou, + WhoAreYouPart2, - CalamitasBeforeHerDefeat, - CalamitasAfterHerDefeat, + Origins, + Crusade, + Goals, + + ExoMechs, + Exotech, + MiracleMatter, + Forge, + Yharim, + Aerie, + Calamitas, + Dog, + Distortion, + + Mechs, Plague, - SulphurousSea, - TheTyrant + Astral, + Sulphur }; internal static DraedonDialogEntry CreateFromKey(string key, Func condition = null) => diff --git a/UI/DraedonSummoning/DraedonSelectionOutline.png b/UI/DraedonSummoning/DraedonSelectionOutline.png index bef2bd16c9..34f56e14b6 100644 Binary files a/UI/DraedonSummoning/DraedonSelectionOutline.png and b/UI/DraedonSummoning/DraedonSelectionOutline.png differ diff --git a/UI/DraedonsArsenal/ChargeMeterUI.cs b/UI/DraedonsArsenal/ChargeMeterUI.cs index 90cc31caa4..709f36a8dd 100644 --- a/UI/DraedonsArsenal/ChargeMeterUI.cs +++ b/UI/DraedonsArsenal/ChargeMeterUI.cs @@ -86,65 +86,65 @@ namespace CalamityMod.UI.DraedonsArsenal return; } - DrawChargeBar(spriteBatch, modItem, screenPos); + DrawChargeBar(spriteBatch, modItem, screenPos); Rectangle mouseHitbox = new Rectangle((int)Main.MouseScreen.X, (int)Main.MouseScreen.Y, 8, 8); Rectangle chargeBar = Utils.CenteredRectangle(screenPos, edgeTexture.Size() * uiScale); - MouseState ms = Mouse.GetState(); - Vector2 mousePos = Main.MouseScreen; + MouseState ms = Mouse.GetState(); + Vector2 mousePos = Main.MouseScreen; if (chargeBar.Intersects(mouseHitbox)) { - if (!CalamityConfig.Instance.MeterPosLock) - Main.LocalPlayer.mouseInterface = true; + if (!CalamityConfig.Instance.MeterPosLock) + Main.LocalPlayer.mouseInterface = true; - // If the mouse is on top of the meter, show the exact numeric charge. + // If the mouse is on top of the meter, show the exact numeric charge. string percentString = (100f * modItem.ChargeRatio).ToString("n2"); // Tooltip only goes to one decimal place, but the meter displays two. This doesn't help the player much at all but hey, it's a thing. Main.instance.MouseText($"{CalamityUtils.GetTextValue("UI.Charge")}: {percentString}%", 0, 0, -1, -1, -1, -1); - Vector2 newScreenRatioPosition = screenRatioPosition; - // Handle mouse dragging - if (!CalamityConfig.Instance.MeterPosLock && ms.LeftButton == ButtonState.Pressed) - { - // If the drag offset doesn't exist yet, create it. - if (!dragOffset.HasValue) - dragOffset = mousePos - screenPos; + Vector2 newScreenRatioPosition = screenRatioPosition; + // Handle mouse dragging + if (!CalamityConfig.Instance.MeterPosLock && ms.LeftButton == ButtonState.Pressed) + { + // If the drag offset doesn't exist yet, create it. + if (!dragOffset.HasValue) + dragOffset = mousePos - screenPos; - // Given the mouse's absolute current position, compute where the corner of the stealth bar should be based on the original drag offset. - Vector2 newCorner = mousePos - dragOffset.GetValueOrDefault(Vector2.Zero); + // Given the mouse's absolute current position, compute where the corner of the stealth bar should be based on the original drag offset. + Vector2 newCorner = mousePos - dragOffset.GetValueOrDefault(Vector2.Zero); - // Convert the new corner position into a screen ratio position. - newScreenRatioPosition.X = (100f * newCorner.X) / Main.screenWidth; - newScreenRatioPosition.Y = (100f * newCorner.Y) / Main.screenHeight; - } + // Convert the new corner position into a screen ratio position. + newScreenRatioPosition.X = (100f * newCorner.X) / Main.screenWidth; + newScreenRatioPosition.Y = (100f * newCorner.Y) / Main.screenHeight; + } - // Compute the change in position. If it is large enough, actually move the meter - Vector2 delta = newScreenRatioPosition - screenRatioPosition; - if (Math.Abs(delta.X) >= MouseDragEpsilon || Math.Abs(delta.Y) >= MouseDragEpsilon) - { - CalamityConfig.Instance.ChargeMeterPosX = newScreenRatioPosition.X; - CalamityConfig.Instance.ChargeMeterPosY = newScreenRatioPosition.Y; - } + // Compute the change in position. If it is large enough, actually move the meter + Vector2 delta = newScreenRatioPosition - screenRatioPosition; + if (Math.Abs(delta.X) >= MouseDragEpsilon || Math.Abs(delta.Y) >= MouseDragEpsilon) + { + CalamityConfig.Instance.ChargeMeterPosX = newScreenRatioPosition.X; + CalamityConfig.Instance.ChargeMeterPosY = newScreenRatioPosition.Y; + } - // When the mouse is released, save the config and destroy the drag offset. - if (ms.LeftButton == ButtonState.Released) - { - dragOffset = null; - CalamityMod.SaveConfig(CalamityConfig.Instance); - } - } + // When the mouse is released, save the config and destroy the drag offset. + if (ms.LeftButton == ButtonState.Released) + { + dragOffset = null; + CalamityMod.SaveConfig(CalamityConfig.Instance); + } + } } private static void DrawChargeBar(SpriteBatch spriteBatch, CalamityGlobalItem modItem, Vector2 screenPos) - { + { float uiScale = Main.UIScale; float offset = (edgeTexture.Width - barTexture.Width) * 0.5f; spriteBatch.Draw(edgeTexture, screenPos, null, Color.White, 0f, edgeTexture.Size() * 0.5f, uiScale, SpriteEffects.None, 0); Rectangle barRectangle = new Rectangle(0, 0, (int)(barTexture.Width * modItem.ChargeRatio), barTexture.Width); spriteBatch.Draw(barTexture, screenPos + new Vector2(offset * uiScale, 0), barRectangle, Color.White, 0f, edgeTexture.Size() * 0.5f, uiScale, SpriteEffects.None, 0); - } + } } } diff --git a/UI/DraedonsArsenal/ChargingStationUI.cs b/UI/DraedonsArsenal/ChargingStationUI.cs index 02cdc24733..f207c629b2 100644 --- a/UI/DraedonsArsenal/ChargingStationUI.cs +++ b/UI/DraedonsArsenal/ChargingStationUI.cs @@ -1,16 +1,16 @@ -using CalamityMod.CalPlayer; +using System; +using CalamityMod.CalPlayer; using CalamityMod.Items.DraedonMisc; using CalamityMod.TileEntities; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; using Terraria.DataStructures; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; using Terraria.UI; -using Terraria.Audio; -using Terraria.GameContent; namespace CalamityMod.UI.DraedonsArsenal { @@ -46,8 +46,8 @@ namespace CalamityMod.UI.DraedonsArsenal return; } - // If the player's inventory isn't open, or they have a chest open, immediately destroy this UI. - if (!Main.playerInventory || p.chest != -1) + // If the player's inventory isn't open, or they have a chest open, OR they are using a channelled item, immediately destroy this UI. + if (!Main.playerInventory || p.chest != -1 || p.channel) { mp.CurrentlyViewedChargerID = -1; return; @@ -126,7 +126,7 @@ namespace CalamityMod.UI.DraedonsArsenal // 1) The player's held item is air and the plugged item is NOT air. // 2) The player's held item is chargeable. // If neither case meets, then nothing happens - else if((playerHandItem.IsAir && !pluggedItem.IsAir) || (!playerHandItem.IsAir && playerHandItem.Calamity().UsesCharge)) + else if ((playerHandItem.IsAir && !pluggedItem.IsAir) || (!playerHandItem.IsAir && playerHandItem.Calamity().UsesCharge)) { Utils.Swap(ref playerHandItem, ref pluggedItem); SoundEngine.PlaySound(SoundID.Grab); diff --git a/UI/DraedonsArsenal/LabHologramProjectorUI.cs b/UI/DraedonsArsenal/LabHologramProjectorUI.cs index a1e3263a62..ecaa722a3a 100644 --- a/UI/DraedonsArsenal/LabHologramProjectorUI.cs +++ b/UI/DraedonsArsenal/LabHologramProjectorUI.cs @@ -1,13 +1,13 @@ -using CalamityMod.CalPlayer; +using System.Collections.Generic; +using CalamityMod.CalPlayer; using CalamityMod.TileEntities; -using Terraria.ID; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System.Collections.Generic; using Terraria; -using Terraria.DataStructures; using Terraria.Audio; +using Terraria.DataStructures; using Terraria.GameContent; +using Terraria.ID; namespace CalamityMod.UI.DraedonsArsenal { diff --git a/UI/DraedonsArsenal/PowerCellFactoryUI.cs b/UI/DraedonsArsenal/PowerCellFactoryUI.cs index 80901a7140..d769d5ff55 100644 --- a/UI/DraedonsArsenal/PowerCellFactoryUI.cs +++ b/UI/DraedonsArsenal/PowerCellFactoryUI.cs @@ -1,14 +1,14 @@ -using CalamityMod.CalPlayer; +using System; +using CalamityMod.CalPlayer; using CalamityMod.Items.DraedonMisc; using CalamityMod.TileEntities; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.UI.DraedonsArsenal { @@ -41,8 +41,8 @@ namespace CalamityMod.UI.DraedonsArsenal return; } - // If the player's inventory isn't open, or they have a chest open, immediately destroy this UI. - if (!Main.playerInventory || p.chest != -1) + // If the player's inventory isn't open, or they have a chest open, OR they are using a channelled item, immediately destroy this UI. + if (!Main.playerInventory || p.chest != -1 || p.channel) { mp.CurrentlyViewedFactoryID = -1; return; diff --git a/UI/FlightBar/FlightBar.cs b/UI/FlightBar/FlightBar.cs index 83957916ba..b78ed67fcd 100644 --- a/UI/FlightBar/FlightBar.cs +++ b/UI/FlightBar/FlightBar.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.Text; using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; @@ -6,6 +7,7 @@ using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Input; using ReLogic.Content; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.UI @@ -19,7 +21,7 @@ namespace CalamityMod.UI private const float MouseDragEpsilon = 0.05f; // 0.05% private const int FlightAnimFrameDelay = 5; private const int FlightAnimFrames = 17; - + private static int FlightAnimFrame = -1; private static int FlightAnimTimer = 0; @@ -29,29 +31,32 @@ namespace CalamityMod.UI private static Texture2D GetApplicableBorder(CalamityPlayer modPlayer) { - if (modPlayer.Player.equippedWings != null && modPlayer.Player.wingTimeMax == 0) + if (modPlayer.Player.equippedWings != null && modPlayer.Player.wingTimeMax == 0 && modPlayer.Player.mount._data.flightTimeMax == 0) return disabledBarTexture; - if (modPlayer.infiniteFlight && completedAnimation) + if ((modPlayer.infiniteFlight || RidingInfiniteFlightMount(modPlayer.Player)) && completedAnimation) return infiniteBarTexture; if (modPlayer.weakPetrification || modPlayer.vHex || modPlayer.icarusFolly || modPlayer.DoGExtremeGravity) return limitedBarTexture; return borderTexture; } - + private static object GetFlightTime(CalamityPlayer modPlayer) { Player player = modPlayer.Player; object result; - if (player.equippedWings != null && player.wingTimeMax == 0) + if (player.equippedWings != null && player.wingTimeMax == 0 && !(player.mount.Active && player.mount._data.flightTimeMax > 0)) result = 0; - if (modPlayer.infiniteFlight && completedAnimation) + if ((modPlayer.infiniteFlight || RidingInfiniteFlightMount(modPlayer.Player)) && completedAnimation) { result = "∞"; //infinite flight } else { - int currentFlight = (int)player.wingTime; - int maxFlight = player.wingTimeMax; + bool ridingLimitedFlightMount = player.mount.Active && player.mount._data.flightTimeMax > 0; + bool ridingCarpet = player.carpet && !player.canCarpet; + + int currentFlight = ridingCarpet ? player.carpetTime : ridingLimitedFlightMount ? player.mount._flyTime + (int)(player.mount._data.fatigueMax - player.mount._fatigue) : (int)player.wingTime; + int maxFlight = ridingCarpet ? 300 : ridingLimitedFlightMount ? player.mount._data.flightTimeMax + (int)player.mount._data.fatigueMax : player.wingTimeMax; return (Math.Min(100f * currentFlight / maxFlight, 100f)).ToString("0.00"); // why the FUCK can wingtime be higher than max wingtime????????? } @@ -81,7 +86,7 @@ namespace CalamityMod.UI private static void Reset() => dragOffset = null; - + public static void Draw(SpriteBatch spriteBatch, Player player) { // Sanity check the planned position before drawing @@ -101,11 +106,11 @@ namespace CalamityMod.UI CalamityPlayer modPlayer = player.Calamity(); // If not drawing the flight bar, save its latest position to config and leave. - if (CalamityConfig.Instance.FlightBar && player.wingsLogic > 0) - { - DrawFlightBar(spriteBatch, modPlayer, screenPos); - } - else + if (CalamityConfig.Instance.FlightBar && (player.wingsLogic > 0 || (player.mount.Active && player.mount._data.flightTimeMax > 0) || player.carpet && !player.canCarpet)) + { + DrawFlightBar(spriteBatch, modPlayer, screenPos); + } + else { bool changed = false; if (CalamityConfig.Instance.FlightBarPosX != screenRatioPosition.X) @@ -125,55 +130,55 @@ namespace CalamityMod.UI } Rectangle mouseHitbox = new Rectangle((int)Main.MouseScreen.X, (int)Main.MouseScreen.Y, 8, 8); - Rectangle flightBar = Utils.CenteredRectangle(screenPos, borderTexture.Size() * uiScale); + Rectangle flightBar = Utils.CenteredRectangle(screenPos, borderTexture.Size() * uiScale); - MouseState ms = Mouse.GetState(); - Vector2 mousePos = Main.MouseScreen; + MouseState ms = Mouse.GetState(); + Vector2 mousePos = Main.MouseScreen; // Handle mouse dragging - if (flightBar.Intersects(mouseHitbox)) - { - if (!CalamityConfig.Instance.MeterPosLock) - Main.LocalPlayer.mouseInterface = true; - - if (modPlayer.Player.equippedWings != null && modPlayer.Player.wingTimeMax > 0) //equipped wings and max wingtime above 0 (so not disabled bar) + if (flightBar.Intersects(mouseHitbox)) + { + if (!CalamityConfig.Instance.MeterPosLock) + Main.LocalPlayer.mouseInterface = true; + + if (modPlayer.Player.equippedWings != null && modPlayer.Player.wingTimeMax > 0 || (player.mount.Active && modPlayer.Player.mount._data.flightTimeMax > 0) || player.carpet && !player.canCarpet) //equipped wings or riding a flying mount and max wingtime/flighttime above 0 (so not disabled bar) { string textToDisplay = CalamityUtils.GetText("UI.Flight").Format((GetFlightTime(modPlayer).ToString() + (modPlayer.infiniteFlight ? "" : "%"))); //the percent is here and not in localisation otherwise it looks like a dick when it's infinite flight Main.instance.MouseText(textToDisplay, 0, 0, -1, -1, -1, -1); } Vector2 newScreenRatioPosition = screenRatioPosition; - // As long as the mouse button is held down, drag the meter along with an offset. + // As long as the mouse button is held down, drag the meter along with an offset. if (!CalamityConfig.Instance.MeterPosLock && ms.LeftButton == ButtonState.Pressed) { - // If the drag offset doesn't exist yet, create it. - if (!dragOffset.HasValue) - dragOffset = mousePos - screenPos; + // If the drag offset doesn't exist yet, create it. + if (!dragOffset.HasValue) + dragOffset = mousePos - screenPos; - // Given the mouse's absolute current position, compute where the corner of the flight bar should be based on the original drag offset. - Vector2 newCorner = mousePos - dragOffset.GetValueOrDefault(Vector2.Zero); + // Given the mouse's absolute current position, compute where the corner of the flight bar should be based on the original drag offset. + Vector2 newCorner = mousePos - dragOffset.GetValueOrDefault(Vector2.Zero); - // Convert the new corner position into a screen ratio position. - newScreenRatioPosition.X = (100f * newCorner.X) / Main.screenWidth; - newScreenRatioPosition.Y = (100f * newCorner.Y) / Main.screenHeight; - } + // Convert the new corner position into a screen ratio position. + newScreenRatioPosition.X = (100f * newCorner.X) / Main.screenWidth; + newScreenRatioPosition.Y = (100f * newCorner.Y) / Main.screenHeight; + } - // Compute the change in position. If it is large enough, actually move the meter - Vector2 delta = newScreenRatioPosition - screenRatioPosition; - if (Math.Abs(delta.X) >= MouseDragEpsilon || Math.Abs(delta.Y) >= MouseDragEpsilon) - { - CalamityConfig.Instance.FlightBarPosX = newScreenRatioPosition.X; - CalamityConfig.Instance.FlightBarPosY = newScreenRatioPosition.Y; - } + // Compute the change in position. If it is large enough, actually move the meter + Vector2 delta = newScreenRatioPosition - screenRatioPosition; + if (Math.Abs(delta.X) >= MouseDragEpsilon || Math.Abs(delta.Y) >= MouseDragEpsilon) + { + CalamityConfig.Instance.FlightBarPosX = newScreenRatioPosition.X; + CalamityConfig.Instance.FlightBarPosY = newScreenRatioPosition.Y; + } - // When the mouse is released, save the config and destroy the drag offset. - if (ms.LeftButton == ButtonState.Released) - { - dragOffset = null; - CalamityMod.SaveConfig(CalamityConfig.Instance); - } + // When the mouse is released, save the config and destroy the drag offset. + if (ms.LeftButton == ButtonState.Released) + { + dragOffset = null; + CalamityMod.SaveConfig(CalamityConfig.Instance); + } } - } + } /** private const int FlightAnimFrameDelay = 5; @@ -186,8 +191,10 @@ namespace CalamityMod.UI { float uiScale = Main.UIScale; Player player = modPlayer.Player; - float flightRatio = Math.Min(player.wingTime / player.wingTimeMax, 1f); // why the FUCK can wingtime be higher than max wingtime????????? - if (!completedAnimation && FlightAnimFrame == -1 && modPlayer.infiniteFlight) + float flightRatio = 1; + if (!modPlayer.infiniteFlight && !RidingInfiniteFlightMount(player)) + flightRatio = player.carpet && !player.canCarpet ? Math.Min((float)player.carpetTime / 300f, 1f) : player.mount.Active && player.mount._data.flightTimeMax > 0 ? Math.Min((float)(player.mount._flyTime + (player.mount._data.fatigueMax - player.mount._fatigue)) / (player.mount._data.flightTimeMax + player.mount._data.fatigueMax), 1f) : Math.Min(player.wingTime / player.wingTimeMax, 1f); // why the FUCK can wingtime be higher than max wingtime????????? + if (!completedAnimation && FlightAnimFrame == -1 && (modPlayer.infiniteFlight || RidingInfiniteFlightMount(modPlayer.Player))) FlightAnimFrame++; if (FlightAnimFrame > -1) //animation started, complete it. { @@ -198,21 +205,21 @@ namespace CalamityMod.UI { FlightAnimFrame = -1; FlightAnimTimer = 0; - completedAnimation = modPlayer.infiniteFlight; //completed animation sets to true if infinite flight still exists + completedAnimation = modPlayer.infiniteFlight || RidingInfiniteFlightMount(modPlayer.Player); //completed animation sets to true if infinite flight still exists } else { FlightAnimTimer = 0; - FlightAnimFrame++; + FlightAnimFrame++; } } } Texture2D correctBorder = GetApplicableBorder(modPlayer); //Fetch texture after animation calculations in case update to infinite flight - + if (completedAnimation && !modPlayer.infiniteFlight && correctBorder != infiniteBarTexture) completedAnimation = false; //reset flight anim once infinite flight expires. - - + + float offset = (correctBorder.Width - barTexture.Width) * 0.5f; spriteBatch.Draw(correctBorder, screenPos, null, Color.White, 0f, correctBorder.Size() * 0.5f, uiScale, SpriteEffects.None, 0); if (correctBorder != disabledBarTexture && correctBorder != infiniteBarTexture) //neither requires an internal bar to be drawn @@ -228,14 +235,25 @@ namespace CalamityMod.UI if (!completedAnimation && FlightAnimFrame >= 0) { Vector2 origin = new Vector2(correctBorder.Width * 0.5f, (correctBorder.Height / FlightAnimFrames) * 0.5f); - float animOffset = 5f; float xOffset = (correctBorder.Width - flightBarAnimTexture.Width) / 2f; int frameHeight = (flightBarAnimTexture.Height / FlightAnimFrames) - 1; - float yOffset = FlightAnimFrame == 0 ? 0 : ((correctBorder.Height / FlightAnimFrame) - frameHeight) / 2f ; + float yOffset = FlightAnimFrame == 0 ? 0 : ((correctBorder.Height / FlightAnimFrame) - frameHeight) / 2f; Vector2 sizeDiffOffset = new Vector2(xOffset, yOffset); Rectangle animCropRect = new Rectangle(0, (frameHeight + 1) * FlightAnimFrame, flightBarAnimTexture.Width, frameHeight); spriteBatch.Draw(flightBarAnimTexture, screenPos + sizeDiffOffset, animCropRect, Color.White, 0f, origin * Main.UIScale, uiScale, SpriteEffects.None, 0); } } + + private static bool RidingInfiniteFlightMount(Player player) + { + if (player.mount.Active && (player.mount._data.fatigueMax >= int.MaxValue - 1 || infiniteFlightMounts.Contains(player.mount.Type))) + return true; + return false; + } + + public static List infiniteFlightMounts = new List + { + MountID.UFO, MountID.Drill, MountID.PirateShip, MountID.WitchBroom, MountID.CuteFishron + }; } } diff --git a/UI/InvasionProgressUIManager.cs b/UI/InvasionProgressUIManager.cs index b673f5b890..4c037c5a74 100644 --- a/UI/InvasionProgressUIManager.cs +++ b/UI/InvasionProgressUIManager.cs @@ -1,7 +1,8 @@ -using Microsoft.Xna.Framework.Graphics; -using System; +using System; using System.Collections.Generic; using System.Linq; +using Microsoft.Xna.Framework.Graphics; +using Terraria.ModLoader.Core; namespace CalamityMod.UI { @@ -25,7 +26,8 @@ namespace CalamityMod.UI public static void LoadGUIs() { // Look through every type in the mod, and check if it's derived from InvasionProgressUI. If it is, create a copy and save it in the static list. - foreach (Type type in typeof(CalamityMod).Assembly.GetTypes()) + Type[] types = AssemblyManager.GetLoadableTypes(CalamityMod.Instance.Code); + foreach (Type type in types) { // Don't load abstract classes since they cannot have instances. if (type.IsAbstract) diff --git a/UI/MiscTextures/StealthMeter.png b/UI/MiscTextures/StealthMeter.png index f538d274b8..1f5a57a73d 100644 Binary files a/UI/MiscTextures/StealthMeter.png and b/UI/MiscTextures/StealthMeter.png differ diff --git a/UI/MiscTextures/StealthMeterBar.png b/UI/MiscTextures/StealthMeterBar.png index d67980a4a2..36d0552574 100644 Binary files a/UI/MiscTextures/StealthMeterBar.png and b/UI/MiscTextures/StealthMeterBar.png differ diff --git a/UI/MiscTextures/StealthMeterBarFull.png b/UI/MiscTextures/StealthMeterBarFull.png index 84ee93fa8d..86048fd097 100644 Binary files a/UI/MiscTextures/StealthMeterBarFull.png and b/UI/MiscTextures/StealthMeterBarFull.png differ diff --git a/UI/MiscTextures/StealthMeterStrikeIndicator.png b/UI/MiscTextures/StealthMeterStrikeIndicator.png index 8e0ef573e6..75c8412fd4 100644 Binary files a/UI/MiscTextures/StealthMeterStrikeIndicator.png and b/UI/MiscTextures/StealthMeterStrikeIndicator.png differ diff --git a/UI/ModeIndicator/ModeIndicatorUI.cs b/UI/ModeIndicator/ModeIndicatorUI.cs index 723f75b573..6c09b3d4c1 100644 --- a/UI/ModeIndicator/ModeIndicatorUI.cs +++ b/UI/ModeIndicator/ModeIndicatorUI.cs @@ -1,24 +1,24 @@ -using CalamityMod.World; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.InteropServices; +using System.Text.RegularExpressions; +using CalamityMod.CalPlayer; +using CalamityMod.Events; +using CalamityMod.Systems; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; -using Terraria.ModLoader; -using CalamityMod.CalPlayer; -using CalamityMod.Events; -using System.Collections.Generic; -using System.Linq; -using Terraria.Localization; -using static CalamityMod.CalamityUtils; -using System; -using Terraria.ID; using Terraria.Audio; -using CalamityMod.Systems; -using static CalamityMod.Systems.DifficultyModeSystem; using Terraria.GameInput; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; using Terraria.UI.Chat; -using System.Text.RegularExpressions; +using static CalamityMod.CalamityUtils; +using static CalamityMod.Systems.DifficultyModeSystem; using static Terraria.GameContent.FontAssets; -using System.Runtime.InteropServices; namespace CalamityMod.UI.ModeIndicator { @@ -193,7 +193,7 @@ namespace CalamityMod.UI.ModeIndicator //It'd be great to be able to add a background to it but i don't think i know how to get the position of the text for that. //Also the "get string size" thing breaks with colored lines so :( Utils.DrawInvBG(spriteBatch, new Rectangle((int)textboxStart.X - 10, (int)textboxStart.Y - 10, (int)regexedBoxSize.X + 20, (int)regexedBoxSize.Y + 16), new Color(50, 20, 35) * 0.925f); - + //Add the hover text. Main.LocalPlayer.mouseInterface = true; Main.instance.MouseText(textToDisplay); diff --git a/UI/PopupGUI.cs b/UI/PopupGUI.cs index 0725cb805e..1704d2d95a 100644 --- a/UI/PopupGUI.cs +++ b/UI/PopupGUI.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; diff --git a/UI/PopupGUIManager.cs b/UI/PopupGUIManager.cs index 61c72bbf6e..0f472693a9 100644 --- a/UI/PopupGUIManager.cs +++ b/UI/PopupGUIManager.cs @@ -1,8 +1,10 @@ -using Microsoft.Xna.Framework.Graphics; -using System; +using System; using System.Collections.Generic; using System.Linq; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.ModLoader; +using Terraria.ModLoader.Core; namespace CalamityMod.UI { @@ -58,13 +60,16 @@ namespace CalamityMod.UI public static void LoadGUIs() { // Look through every type in the mod, and check if it's derived from PopupGUI. If it is, create a copy and save it in the static list. - foreach (Type type in typeof(CalamityMod).Assembly.GetTypes()) + foreach (Mod mod in ModLoader.Mods) { - // Don't load abstract classes since they cannot have instances. - if (type.IsAbstract) - continue; - if (type.IsSubclassOf(typeof(PopupGUI))) - gUIs.Add(Activator.CreateInstance(type) as PopupGUI); + foreach (Type type in AssemblyManager.GetLoadableTypes(mod.Code)) + { + // Don't load abstract classes since they cannot have instances. + if (type.IsAbstract) + continue; + if (type.IsSubclassOf(typeof(PopupGUI))) + gUIs.Add(Activator.CreateInstance(type) as PopupGUI); + } } } public static void UnloadGUIs() => gUIs.Clear(); diff --git a/UI/ResourceSets/CalamityResourceOverlay.cs b/UI/ResourceSets/CalamityResourceOverlay.cs index f8ba46d8fe..e90a77051c 100644 --- a/UI/ResourceSets/CalamityResourceOverlay.cs +++ b/UI/ResourceSets/CalamityResourceOverlay.cs @@ -1,8 +1,8 @@ -using CalamityMod.CalPlayer; +using System.Collections.Generic; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; -using System.Collections.Generic; using Terraria; using Terraria.GameContent; using Terraria.ModLoader; @@ -12,7 +12,7 @@ namespace CalamityMod.UI.ResourceSets public class CalamityResourceOverlay : ModResourceOverlay { // Most of this is taken from ExampleMod. See that for additional explanations. - private Dictionary> vanillaAssetCache = new(); + private Dictionary> vanillaAssetCache = new(); public string baseFolder = "CalamityMod/UI/ResourceSets/"; // Determines which health UI to draw based on player upgrades. @@ -45,9 +45,9 @@ namespace CalamityMod.UI.ResourceSets return string.Empty; } - public override void PostDrawResource(ResourceOverlayDrawContext context) + public override void PostDrawResource(ResourceOverlayDrawContext context) { - Asset asset = context.texture; + Asset asset = context.texture; // Vanilla texture paths string fancyFolder = "Images/UI/PlayerResourceSets/FancyClassic/"; string barsFolder = "Images/UI/PlayerResourceSets/HorizontalBars/"; @@ -69,28 +69,28 @@ namespace CalamityMod.UI.ResourceSets } if (LifeTexturePath() == string.Empty) - return; + return; - // Draw hearts for Classic and Fancy - if (asset == TextureAssets.Heart || asset == TextureAssets.Heart2 || CompareAssets(asset, fancyFolder + "Heart_Fill") || CompareAssets(asset, fancyFolder + "Heart_Fill_B")) - { + // Draw hearts for Classic and Fancy + if (asset == TextureAssets.Heart || asset == TextureAssets.Heart2 || CompareAssets(asset, fancyFolder + "Heart_Fill") || CompareAssets(asset, fancyFolder + "Heart_Fill_B")) + { context.texture = ModContent.Request(LifeTexturePath() + "Heart"); - context.Draw(); + context.Draw(); } // Draw health bars - else if (CompareAssets(asset, barsFolder + "HP_Fill") || CompareAssets(asset, barsFolder + "HP_Fill_Honey")) - { + else if (CompareAssets(asset, barsFolder + "HP_Fill") || CompareAssets(asset, barsFolder + "HP_Fill_Honey")) + { context.texture = ModContent.Request(LifeTexturePath() + "Bar"); - context.Draw(); + context.Draw(); } - } + } - private bool CompareAssets(Asset currentAsset, string compareAssetPath) + private bool CompareAssets(Asset currentAsset, string compareAssetPath) { - if (!vanillaAssetCache.TryGetValue(compareAssetPath, out var asset)) - asset = vanillaAssetCache[compareAssetPath] = Main.Assets.Request(compareAssetPath); + if (!vanillaAssetCache.TryGetValue(compareAssetPath, out var asset)) + asset = vanillaAssetCache[compareAssetPath] = Main.Assets.Request(compareAssetPath); - return currentAsset == asset; - } - } + return currentAsset == asset; + } + } } diff --git a/UI/Rippers/RipperUI.cs b/UI/Rippers/RipperUI.cs index 8199c3d307..6c8a3cde57 100644 --- a/UI/Rippers/RipperUI.cs +++ b/UI/Rippers/RipperUI.cs @@ -293,7 +293,7 @@ namespace CalamityMod.UI.Rippers if (animationActive) { rageAnimTimer++; - if(rageAnimTimer >= RageAnimFrameDelay) + if (rageAnimTimer >= RageAnimFrameDelay) { rageAnimTimer = 0; rageAnimFrame++; // This will eventually increment it to RageAnimFrames, thus stopping the animation. @@ -340,7 +340,7 @@ namespace CalamityMod.UI.Rippers #region Draw Adrenaline Bar private static void DrawAdrenalineBar(SpriteBatch spriteBatch, CalamityPlayer modPlayer, Vector2 screenPos) { - bool draedonHeart = modPlayer.draedonsHeart; + bool draedonHeart = modPlayer.draedonsHeart; bool useFullTexture = modPlayer.adrenaline >= modPlayer.adrenalineMax || modPlayer.adrenalineModeActive; float uiScale = Main.UIScale; @@ -358,18 +358,18 @@ namespace CalamityMod.UI.Rippers adrenBarTimer = 0; adrenBarFrame++; adrenBarFullFrame++; - if (adrenBarFrame == AdrenBarFrames) - adrenBarFrame = 1; - if (adrenBarFullFrame == AdrenBarFullFrames) - adrenBarFullFrame = 1; + if (adrenBarFrame == AdrenBarFrames) + adrenBarFrame = 1; + if (adrenBarFullFrame == AdrenBarFullFrames) + adrenBarFullFrame = 1; } } else - { - adrenBarTimer = 0; - adrenBarFrame = 0; - adrenBarFullFrame = 0; - } + { + adrenBarTimer = 0; + adrenBarFrame = 0; + adrenBarFullFrame = 0; + } // If adrenaline is full this frame and the animation hasn't started yet, start it. float adrenRatio = modPlayer.adrenaline / modPlayer.adrenalineMax; @@ -393,20 +393,20 @@ namespace CalamityMod.UI.Rippers } if (!useFullTexture) - { - int frameHeight = (adrenBorderTex.Height / AdrenBarFrames) - 1; - Rectangle borderRect = new Rectangle(0, (frameHeight + 1) * adrenBarFrame, adrenBorderTex.Width, frameHeight); - // Draw the border of the Adrenaline Bar first - spriteBatch.Draw(adrenBorderTex, screenPos + shakeOffset, borderRect, Color.White, 0f, origin, uiScale, SpriteEffects.None, 0); - } + { + int frameHeight = (adrenBorderTex.Height / AdrenBarFrames) - 1; + Rectangle borderRect = new Rectangle(0, (frameHeight + 1) * adrenBarFrame, adrenBorderTex.Width, frameHeight); + // Draw the border of the Adrenaline Bar first + spriteBatch.Draw(adrenBorderTex, screenPos + shakeOffset, borderRect, Color.White, 0f, origin, uiScale, SpriteEffects.None, 0); + } else - { + { // Use a slightly different texture if Adrenaline is full or active - int frameHeight = (adrenBorderTexFull.Height / AdrenBarFullFrames) - 1; - Rectangle borderRect = new Rectangle(0, (frameHeight + 1) * adrenBarFullFrame, adrenBorderTexFull.Width, frameHeight); + int frameHeight = (adrenBorderTexFull.Height / AdrenBarFullFrames) - 1; + Rectangle borderRect = new Rectangle(0, (frameHeight + 1) * adrenBarFullFrame, adrenBorderTexFull.Width, frameHeight); spriteBatch.Draw(adrenBorderTexFull, screenPos + shakeOffset, borderRect, Color.White, 0f, origin, uiScale, SpriteEffects.None, 0); - } + } // The amount of the bar to draw depends on the player's current Adrenaline level // offset calculates the deadspace that is the border and not the bar. Bar is 24 pixels tall diff --git a/UI/SpeedrunTimerUI.cs b/UI/SpeedrunTimerUI.cs index 0113753e09..6f340be742 100644 --- a/UI/SpeedrunTimerUI.cs +++ b/UI/SpeedrunTimerUI.cs @@ -1,6 +1,5 @@ using System; using CalamityMod.CalPlayer; -using CalamityMod.NPCs.PrimordialWyrm; using CalamityMod.NPCs.AquaticScourge; using CalamityMod.NPCs.AstrumAureus; using CalamityMod.NPCs.AstrumDeus; @@ -17,6 +16,7 @@ using CalamityMod.NPCs.Leviathan; using CalamityMod.NPCs.OldDuke; using CalamityMod.NPCs.Perforator; using CalamityMod.NPCs.PlaguebringerGoliath; +using CalamityMod.NPCs.PrimordialWyrm; using CalamityMod.NPCs.ProfanedGuardians; using CalamityMod.NPCs.Providence; using CalamityMod.NPCs.Ravager; diff --git a/UI/StealthUI.cs b/UI/StealthUI.cs index 121c90d676..4562d8a1fe 100644 --- a/UI/StealthUI.cs +++ b/UI/StealthUI.cs @@ -37,7 +37,7 @@ namespace CalamityMod.UI } private static void Reset() => dragOffset = null; - + public static void Draw(SpriteBatch spriteBatch, Player player) { // Sanity check the planned position before drawing @@ -58,10 +58,10 @@ namespace CalamityMod.UI // If not drawing the stealth meter, save its latest position to config and leave. if (modPlayer.stealthUIAlpha > 0f && CalamityConfig.Instance.StealthMeter && modPlayer.rogueStealthMax > 0f && modPlayer.wearingRogueArmor) - { - DrawStealthBar(spriteBatch, modPlayer, screenPos); - } - else + { + DrawStealthBar(spriteBatch, modPlayer, screenPos); + } + else { bool changed = false; if (CalamityConfig.Instance.StealthMeterPosX != screenRatioPosition.X) @@ -82,70 +82,70 @@ namespace CalamityMod.UI Rectangle mouseHitbox = new Rectangle((int)Main.MouseScreen.X, (int)Main.MouseScreen.Y, 8, 8); Rectangle stealthBar = Utils.CenteredRectangle(screenPos, edgeTexture.Size() * uiScale); - MouseState ms = Mouse.GetState(); - Vector2 mousePos = Main.MouseScreen; + MouseState ms = Mouse.GetState(); + Vector2 mousePos = Main.MouseScreen; // Handle mouse dragging - if (stealthBar.Intersects(mouseHitbox)) - { - if (!CalamityConfig.Instance.MeterPosLock) - Main.LocalPlayer.mouseInterface = true; + if (stealthBar.Intersects(mouseHitbox)) + { + if (!CalamityConfig.Instance.MeterPosLock) + Main.LocalPlayer.mouseInterface = true; - // If the mouse is on top of the meter, show the player's exact numeric stealth. - if (modPlayer.rogueStealthMax > 0f && modPlayer.stealthUIAlpha >= 0.5f) - { - string stealthStr = (100f * modPlayer.rogueStealth).ToString("n2"); - string maxStealthStr = (100f * modPlayer.rogueStealthMax).ToString("n2"); - string textToDisplay = $"{CalamityUtils.GetTextValue("UI.Stealth")}: {stealthStr}/{maxStealthStr}\n"; + // If the mouse is on top of the meter, show the player's exact numeric stealth. + if (modPlayer.rogueStealthMax > 0f && modPlayer.stealthUIAlpha >= 0.5f) + { + string stealthStr = (100f * modPlayer.rogueStealth).ToString("n2"); + string maxStealthStr = (100f * modPlayer.rogueStealthMax).ToString("n2"); + string textToDisplay = $"{CalamityUtils.GetTextValue("UI.Stealth")}: {stealthStr}/{maxStealthStr}\n"; if (!Main.keyState.IsKeyDown(LeftShift)) { - textToDisplay += CalamityUtils.GetTextValue("UI.StealthShiftText"); - } - else - { - textToDisplay += CalamityUtils.GetTextValue("UI.StealthInfoText"); - } + textToDisplay += CalamityUtils.GetTextValue("UI.StealthShiftText"); + } + else + { + textToDisplay += CalamityUtils.GetTextValue("UI.StealthInfoText"); + } - Main.instance.MouseText(textToDisplay, 0, 0, -1, -1, -1, -1); - modPlayer.stealthUIAlpha = MathHelper.Lerp(modPlayer.stealthUIAlpha, 0.25f, 0.035f); - } + Main.instance.MouseText(textToDisplay, 0, 0, -1, -1, -1, -1); + modPlayer.stealthUIAlpha = MathHelper.Lerp(modPlayer.stealthUIAlpha, 0.25f, 0.035f); + } Vector2 newScreenRatioPosition = screenRatioPosition; - // As long as the mouse button is held down, drag the meter along with an offset. + // As long as the mouse button is held down, drag the meter along with an offset. if (!CalamityConfig.Instance.MeterPosLock && ms.LeftButton == ButtonState.Pressed) { - // If the drag offset doesn't exist yet, create it. - if (!dragOffset.HasValue) - dragOffset = mousePos - screenPos; + // If the drag offset doesn't exist yet, create it. + if (!dragOffset.HasValue) + dragOffset = mousePos - screenPos; - // Given the mouse's absolute current position, compute where the corner of the stealth bar should be based on the original drag offset. - Vector2 newCorner = mousePos - dragOffset.GetValueOrDefault(Vector2.Zero); + // Given the mouse's absolute current position, compute where the corner of the stealth bar should be based on the original drag offset. + Vector2 newCorner = mousePos - dragOffset.GetValueOrDefault(Vector2.Zero); - // Convert the new corner position into a screen ratio position. - newScreenRatioPosition.X = (100f * newCorner.X) / Main.screenWidth; - newScreenRatioPosition.Y = (100f * newCorner.Y) / Main.screenHeight; - } + // Convert the new corner position into a screen ratio position. + newScreenRatioPosition.X = (100f * newCorner.X) / Main.screenWidth; + newScreenRatioPosition.Y = (100f * newCorner.Y) / Main.screenHeight; + } - // Compute the change in position. If it is large enough, actually move the meter - Vector2 delta = newScreenRatioPosition - screenRatioPosition; - if (Math.Abs(delta.X) >= MouseDragEpsilon || Math.Abs(delta.Y) >= MouseDragEpsilon) - { - CalamityConfig.Instance.StealthMeterPosX = newScreenRatioPosition.X; - CalamityConfig.Instance.StealthMeterPosY = newScreenRatioPosition.Y; - } + // Compute the change in position. If it is large enough, actually move the meter + Vector2 delta = newScreenRatioPosition - screenRatioPosition; + if (Math.Abs(delta.X) >= MouseDragEpsilon || Math.Abs(delta.Y) >= MouseDragEpsilon) + { + CalamityConfig.Instance.StealthMeterPosX = newScreenRatioPosition.X; + CalamityConfig.Instance.StealthMeterPosY = newScreenRatioPosition.Y; + } - // When the mouse is released, save the config and destroy the drag offset. - if (ms.LeftButton == ButtonState.Released) - { - dragOffset = null; - CalamityMod.SaveConfig(CalamityConfig.Instance); - } + // When the mouse is released, save the config and destroy the drag offset. + if (ms.LeftButton == ButtonState.Released) + { + dragOffset = null; + CalamityMod.SaveConfig(CalamityConfig.Instance); + } } - } + } private static void DrawStealthBar(SpriteBatch spriteBatch, CalamityPlayer modPlayer, Vector2 screenPos) - { + { float uiScale = Main.UIScale; float offset = (edgeTexture.Width - barTexture.Width) * 0.5f; spriteBatch.Draw(edgeTexture, screenPos, null, Color.White * modPlayer.stealthUIAlpha, 0f, edgeTexture.Size() * 0.5f, uiScale, SpriteEffects.None, 0); diff --git a/UI/SulphurousWaterMeter/SulphurousWaterMeterUI.cs b/UI/SulphurousWaterMeter/SulphurousWaterMeterUI.cs index 7df65788bd..a1a4899dab 100644 --- a/UI/SulphurousWaterMeter/SulphurousWaterMeterUI.cs +++ b/UI/SulphurousWaterMeter/SulphurousWaterMeterUI.cs @@ -33,7 +33,7 @@ namespace CalamityMod.UI.SulphurousWaterMeter } private static void Reset() => dragOffset = null; - + public static void Draw(SpriteBatch spriteBatch, Player player) { // Sanity check the planned position before drawing. This is done relative. @@ -135,7 +135,7 @@ namespace CalamityMod.UI.SulphurousWaterMeter float uiScale = Main.UIScale; float offset = (edgeTexture.Width - barTexture.Width) * 0.5f; spriteBatch.Draw(edgeTexture, screenPos, null, Color.White * modPlayer.SulphWaterUIOpacity, 0f, edgeTexture.Size() * 0.5f, uiScale, SpriteEffects.None, 0); - + float completionRatio = MathHelper.Clamp(modPlayer.SulphWaterPoisoningLevel, 0f, 1f); Rectangle barRectangle = new Rectangle(0, 0, (int)(barTexture.Width * completionRatio), barTexture.Width); spriteBatch.Draw(barTexture, screenPos + new Vector2(offset * uiScale, 0), barRectangle, Color.White * modPlayer.SulphWaterUIOpacity, 0f, edgeTexture.Size() * 0.5f, uiScale, SpriteEffects.None, 0); diff --git a/UI/VanillaBossBars/AstrumDeusBossBar.cs b/UI/VanillaBossBars/AstrumDeusBossBar.cs index 6934616d86..24e3b77c0a 100644 --- a/UI/VanillaBossBars/AstrumDeusBossBar.cs +++ b/UI/VanillaBossBars/AstrumDeusBossBar.cs @@ -1,10 +1,10 @@ -using CalamityMod.NPCs.AstrumDeus; +using System; +using System.Collections.Generic; +using CalamityMod.NPCs.AstrumDeus; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; -using System; -using System.Collections.Generic; using Terraria; using Terraria.GameContent; using Terraria.GameContent.UI.BigProgressBar; @@ -21,8 +21,8 @@ namespace CalamityMod.UI.VanillaBossBars public override bool? ModifyInfo(ref BigProgressBarInfo info, ref float life, ref float lifeMax, ref float shield, ref float shieldMax) { NPC target = Main.npc[info.npcIndexToAimAt]; - if (!target.active && !FindMoreWorms(ref info)) - return false; + if (!target.active && !FindMoreWorms(ref info)) + return false; // Reset the health life = 0f; @@ -30,10 +30,10 @@ namespace CalamityMod.UI.VanillaBossBars // Determine the real health by finding more of itself for (int i = 0; i < Main.maxNPCs; i++) - { - NPC worm = Main.npc[i]; - if (worm.active && worm.type == target.type) - { + { + NPC worm = Main.npc[i]; + if (worm.active && worm.type == target.type) + { // In Death Mode, every worm must be killed if (CalamityWorld.death) { @@ -50,23 +50,23 @@ namespace CalamityMod.UI.VanillaBossBars lifeMax = worm.lifeMax; } - } - } + } + } return true; } public bool FindMoreWorms(ref BigProgressBarInfo info) { for (int i = 0; i < Main.maxNPCs; i++) - { - NPC target = Main.npc[i]; - if (target.active && target.type == NPCType()) - { - info.npcIndexToAimAt = i; - return true; - } - } - return false; + { + NPC target = Main.npc[i]; + if (target.active && target.type == NPCType()) + { + info.npcIndexToAimAt = i; + return true; + } + } + return false; } } -} \ No newline at end of file +} diff --git a/UI/VanillaBossBars/CeaselessVoidBossBar.cs b/UI/VanillaBossBars/CeaselessVoidBossBar.cs index 61eb81d341..d472836584 100644 --- a/UI/VanillaBossBars/CeaselessVoidBossBar.cs +++ b/UI/VanillaBossBars/CeaselessVoidBossBar.cs @@ -1,10 +1,10 @@ -using CalamityMod.NPCs.CeaselessVoid; +using System; +using System.Collections.Generic; +using CalamityMod.NPCs.CeaselessVoid; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; -using System; -using System.Collections.Generic; using Terraria; using Terraria.GameContent; using Terraria.GameContent.UI.BigProgressBar; @@ -24,8 +24,8 @@ namespace CalamityMod.UI.VanillaBossBars public override bool? ModifyInfo(ref BigProgressBarInfo info, ref float life, ref float lifeMax, ref float shield, ref float shieldMax) { NPC target = Main.npc[info.npcIndexToAimAt]; - if (!target.active) - return false; + if (!target.active) + return false; // Get the boss health, obviously life = target.life; @@ -33,7 +33,7 @@ namespace CalamityMod.UI.VanillaBossBars // Normal boss health float lifePercent = Utils.Clamp(life / lifeMax, 0f, 1f); - + // Reset the shield shield = 0f; shieldMax = 0f; @@ -50,15 +50,15 @@ namespace CalamityMod.UI.VanillaBossBars FalseNPCSegment.SetDefaults(NPCType(), target.GetMatchingSpawnParams()); shieldMax = (int)(FalseNPCSegment.lifeMax * ExpectedBallsCounter * (1 - RatioToCombust)); shield -= (int)(FalseNPCSegment.lifeMax * ExpectedBallsCounter * RatioToCombust); - + for (int i = 0; i < Main.maxNPCs; i++) - { - NPC part = Main.npc[i]; - if (part.active && part.type == NPCType()) - shield += part.life; - } + { + NPC part = Main.npc[i]; + if (part.active && part.type == NPCType()) + shield += part.life; + } } return true; } } -} \ No newline at end of file +} diff --git a/UI/VanillaBossBars/CryogenBossBar.cs b/UI/VanillaBossBars/CryogenBossBar.cs index e6d5fdda42..5202e40a2b 100644 --- a/UI/VanillaBossBars/CryogenBossBar.cs +++ b/UI/VanillaBossBars/CryogenBossBar.cs @@ -1,10 +1,10 @@ -using CalamityMod.NPCs.Cryogen; +using System; +using System.Collections.Generic; +using CalamityMod.NPCs.Cryogen; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; -using System; -using System.Collections.Generic; using Terraria; using Terraria.GameContent; using Terraria.GameContent.UI.BigProgressBar; @@ -27,28 +27,28 @@ namespace CalamityMod.UI.VanillaBossBars public override bool? ModifyInfo(ref BigProgressBarInfo info, ref float life, ref float lifeMax, ref float shield, ref float shieldMax) { NPC target = Main.npc[info.npcIndexToAimAt]; - if (!target.active) - return false; + if (!target.active) + return false; // Get the boss health, obviously life = target.life; lifeMax = target.lifeMax; - + // Reset the shield shield = 0f; shieldMax = 0f; // Determine the shield health for (int i = 0; i < Main.maxNPCs; i++) - { - NPC part = Main.npc[i]; - if (part.active && part.type == NPCType()) - { - shield += part.life; + { + NPC part = Main.npc[i]; + if (part.active && part.type == NPCType()) + { + shield += part.life; shieldMax += part.lifeMax; - } - } + } + } return true; } } -} \ No newline at end of file +} diff --git a/UI/VanillaBossBars/ExoMechsBossBar.cs b/UI/VanillaBossBars/ExoMechsBossBar.cs index ebaca057f2..f808cc93fa 100644 --- a/UI/VanillaBossBars/ExoMechsBossBar.cs +++ b/UI/VanillaBossBars/ExoMechsBossBar.cs @@ -1,11 +1,11 @@ -using CalamityMod.NPCs.ExoMechs.Ares; +using System; +using System.Collections.Generic; +using CalamityMod.NPCs.ExoMechs.Ares; using CalamityMod.NPCs.ExoMechs.Artemis; using CalamityMod.NPCs.ExoMechs.Thanatos; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; -using System; -using System.Collections.Generic; using Terraria; using Terraria.GameContent; using Terraria.GameContent.UI.BigProgressBar; @@ -51,7 +51,7 @@ namespace CalamityMod.UI.VanillaBossBars ValidateAllMechs(ref info); NPC target = Main.npc[info.npcIndexToAimAt]; - if (!target.active && !FindMechsAgain(ref info)) + if (!target.active && !FindMechsAgain(ref info)) { // Reset the spawning bool for refights AllBossesSpawned = false; @@ -98,8 +98,8 @@ namespace CalamityMod.UI.VanillaBossBars public void ValidateAllMechs(ref BigProgressBarInfo info) { for (int i = 0; i < Main.maxNPCs; i++) - { - NPC target = Main.npc[i]; + { + NPC target = Main.npc[i]; // Find out first whether or not each of the mechs are in hiding if (target.type == NPCType()) HideAres = target.Opacity < 0.5f; @@ -107,7 +107,7 @@ namespace CalamityMod.UI.VanillaBossBars HideArtemis = target.Opacity < 0.5f; if (target.type == NPCType()) HideThanatos = target.Opacity < 0.5f; - } + } // Manually re-hide bosses once they commit die if (!NPC.AnyNPCs(NPCType())) @@ -121,8 +121,8 @@ namespace CalamityMod.UI.VanillaBossBars public bool FindMechsAgain(ref BigProgressBarInfo info) { for (int i = 0; i < Main.maxNPCs; i++) - { - NPC target = Main.npc[i]; + { + NPC target = Main.npc[i]; if (target.active) { // Get the index of the mech that's not hiding @@ -148,8 +148,8 @@ namespace CalamityMod.UI.VanillaBossBars return true; } } - } + } return false; } } -} \ No newline at end of file +} diff --git a/UI/VanillaBossBars/LeviathanAnahitaBossBar.cs b/UI/VanillaBossBars/LeviathanAnahitaBossBar.cs index 06b6d8665a..f0dc0a389c 100644 --- a/UI/VanillaBossBars/LeviathanAnahitaBossBar.cs +++ b/UI/VanillaBossBars/LeviathanAnahitaBossBar.cs @@ -1,9 +1,9 @@ -using CalamityMod.NPCs.Leviathan; +using System; +using System.Collections.Generic; +using CalamityMod.NPCs.Leviathan; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; -using System; -using System.Collections.Generic; using Terraria; using Terraria.GameContent; using Terraria.GameContent.UI.BigProgressBar; @@ -28,8 +28,8 @@ namespace CalamityMod.UI.VanillaBossBars { NPC target = Main.npc[info.npcIndexToAimAt]; - if (!target.active && !FindTheRightFish(ref info)) - return false; + if (!target.active && !FindTheRightFish(ref info)) + return false; // Immediately grab the boss's health, whichever one it is. We will check later. life = target.life; @@ -53,7 +53,7 @@ namespace CalamityMod.UI.VanillaBossBars // Determine Anahita's shield health only if she's solo (she can't just block Leviathan out of existence) if (target.type == NPCType() && !NPC.AnyNPCs(NPCType())) - { + { for (int i = 0; i < Main.maxNPCs; i++) { NPC part = Main.npc[i]; @@ -70,20 +70,20 @@ namespace CalamityMod.UI.VanillaBossBars public bool FindTheRightFish(ref BigProgressBarInfo info) { for (int i = 0; i < Main.maxNPCs; i++) - { - NPC target = Main.npc[i]; - if (target.active && target.type == NPCType()) - { - info.npcIndexToAimAt = i; - return true; - } + { + NPC target = Main.npc[i]; + if (target.active && target.type == NPCType()) + { + info.npcIndexToAimAt = i; + return true; + } else if (target.active && target.type == NPCType()) { info.npcIndexToAimAt = i; return true; } - } - return false; + } + return false; } } } diff --git a/UI/VanillaBossBars/RavagerBossBar.cs b/UI/VanillaBossBars/RavagerBossBar.cs index bc1d6fcaed..39028612e5 100644 --- a/UI/VanillaBossBars/RavagerBossBar.cs +++ b/UI/VanillaBossBars/RavagerBossBar.cs @@ -1,9 +1,9 @@ -using CalamityMod.NPCs.Ravager; +using System; +using System.Collections.Generic; +using CalamityMod.NPCs.Ravager; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; -using System; -using System.Collections.Generic; using Terraria; using Terraria.GameContent; using Terraria.GameContent.UI.BigProgressBar; @@ -31,8 +31,8 @@ namespace CalamityMod.UI.VanillaBossBars public override bool? ModifyInfo(ref BigProgressBarInfo info, ref float life, ref float lifeMax, ref float shield, ref float shieldMax) { NPC target = Main.npc[info.npcIndexToAimAt]; - if (!target.active && !FindRavagerBody(ref info)) - return false; + if (!target.active && !FindRavagerBody(ref info)) + return false; life = target.life; lifeMax = target.lifeMax; @@ -47,28 +47,28 @@ namespace CalamityMod.UI.VanillaBossBars // Determine the current health of the parts for (int i = 0; i < Main.maxNPCs; i++) - { - NPC part = Main.npc[i]; - if (part.active && RavagerParts.Contains(part.type)) - { - life += part.life; - } - } + { + NPC part = Main.npc[i]; + if (part.active && RavagerParts.Contains(part.type)) + { + life += part.life; + } + } return true; } public bool FindRavagerBody(ref BigProgressBarInfo info) { for (int i = 0; i < Main.maxNPCs; i++) - { - NPC target = Main.npc[i]; - if (target.active && target.type == NPCType()) - { - info.npcIndexToAimAt = i; - return true; - } - } - return false; + { + NPC target = Main.npc[i]; + if (target.active && target.type == NPCType()) + { + info.npcIndexToAimAt = i; + return true; + } + } + return false; } } -} \ No newline at end of file +} diff --git a/UI/VanillaBossBars/SlimeGodBossBar.cs b/UI/VanillaBossBars/SlimeGodBossBar.cs index 0d3f8b2cf3..33f8670457 100644 --- a/UI/VanillaBossBars/SlimeGodBossBar.cs +++ b/UI/VanillaBossBars/SlimeGodBossBar.cs @@ -1,9 +1,9 @@ -using CalamityMod.NPCs.SlimeGod; +using System; +using System.Collections.Generic; +using CalamityMod.NPCs.SlimeGod; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; -using System; -using System.Collections.Generic; using Terraria; using Terraria.GameContent; using Terraria.GameContent.UI.BigProgressBar; @@ -30,8 +30,8 @@ namespace CalamityMod.UI.VanillaBossBars public override bool? ModifyInfo(ref BigProgressBarInfo info, ref float life, ref float lifeMax, ref float shield, ref float shieldMax) { NPC target = Main.npc[info.npcIndexToAimAt]; - if (!target.active) - return false; + if (!target.active) + return false; life = 0f; lifeMax = 0f; @@ -45,14 +45,14 @@ namespace CalamityMod.UI.VanillaBossBars // Determine the current health of each slime for (int i = 0; i < Main.maxNPCs; i++) - { - NPC part = Main.npc[i]; - if (part.active && SlimeGodSlimes.Contains(part.type)) - { - life += part.life; - } - } + { + NPC part = Main.npc[i]; + if (part.active && SlimeGodSlimes.Contains(part.type)) + { + life += part.life; + } + } return true; } } -} \ No newline at end of file +} diff --git a/Utilities/CalamityRecipes.cs b/Utilities/CalamityRecipes.cs index 787f5ee4fc..81a27225f2 100644 --- a/Utilities/CalamityRecipes.cs +++ b/Utilities/CalamityRecipes.cs @@ -344,7 +344,7 @@ namespace CalamityMod }); AnyGoodBlock = RecipeGroup.RegisterGroup("AnyGoodBlock", group); } - + private static void AddEquipmentRecipeGroups() { // Wooden Swords for Broken Biome Blade @@ -426,7 +426,7 @@ namespace CalamityMod ItemID.ArcaneFlower, ItemID.MagnetFlower, ItemID.ManaCloak - }); + }); AnyManaFlower = RecipeGroup.RegisterGroup("AnyManaFlower", group); // Magic Quiver+ for Elemental Quiver @@ -519,7 +519,7 @@ namespace CalamityMod public static void AddRecipes() { EditVanillaRecipes(); - + // Leather from Vertebrae Recipe.Create(ItemID.Leather). AddIngredient(ItemID.Vertebrae, 2). @@ -528,7 +528,7 @@ namespace CalamityMod // Fallen Stars from Stardust Recipe.Create(ItemID.FallenStar). - AddIngredient(5). + AddIngredient(5). AddTile(TileID.Anvils). Register() .DisableDecraft(); @@ -545,14 +545,14 @@ namespace CalamityMod AddRecipeGroup("IronBar"). AddIngredient(ItemID.EmptyBullet, 100). AddIngredient(ItemID.ExplosivePowder, 4). - AddTile(TileID.MythrilAnvil). + AddTile(TileID.Anvils). Register(); // and Rocket IIs (requires slightly more explosive powder) Recipe.Create(ItemID.RocketII, 100). AddRecipeGroup("IronBar"). AddIngredient(ItemID.EmptyBullet, 100). AddIngredient(ItemID.ExplosivePowder, 5). - AddTile(TileID.MythrilAnvil). + AddTile(TileID.Anvils). Register(); // Life Crystal @@ -595,6 +595,13 @@ namespace CalamityMod AddTile(TileID.Hellforge). Register(); + // Magic Conch + Recipe.Create(ItemID.MagicConch). + AddIngredient(ItemID.ShellPileBlock, 20). + AddIngredient(ItemID.WhitePearl). + AddTile(TileID.Anvils). + Register(); + // Lava Fishing Hook Recipe.Create(ItemID.LavaFishingHook). AddIngredient(ItemID.Seashell). @@ -761,7 +768,7 @@ namespace CalamityMod internal static void EditVanillaRecipes() { // Disable warnings for unused stuff as they can continue to be used freely - #pragma warning disable CS8321 +#pragma warning disable CS8321 // Predicates for specifying which recipes to edit static Func Vanilla(int itemID) => r => r.Mod is null && r.HasResult(itemID); @@ -805,11 +812,13 @@ namespace CalamityMod return; r.requiredTile[idx] = newTileID; }; - #pragma warning restore CS8321 +#pragma warning restore CS8321 var edits = new Dictionary, Action>(128) { { Vanilla(ItemID.EnchantedBoomerang), Disable }, // Calamity adds its own recipe + { Vanilla(ItemID.MiniNukeI), Disable }, + { Vanilla(ItemID.MiniNukeII), Disable }, // Make various things cheaper (sorted by progression) { Vanilla(ItemID.Leather), ChangeIngredientStack(ItemID.RottenChunk, 2) }, @@ -819,16 +828,18 @@ namespace CalamityMod { Vanilla(ItemID.BloodySpine), BloodySpineRecipeEdit }, { Vanilla(ItemID.GoblinBattleStandard), ChangeIngredientStack(ItemID.TatteredCloth, 5) }, { Vanilla(ItemID.ChlorophyteBar), ChangeIngredientStack(ItemID.ChlorophyteOre, 4) }, - + { Vanilla(ItemID.OrichalcumAnvil), ChangeIngredientStack(ItemID.OrichalcumBar, 10) }, { Vanilla(ItemID.ShroomiteBar), ChangeIngredientStack(ItemID.GlowingMushroom, 5) }, { Vanilla(ItemID.TrueNightsEdge), TrueNightsEdgeRecipeEdit }, { Vanilla(ItemID.TrueExcalibur), ChangeIngredientStack(ItemID.ChlorophyteBar, 12) }, // Tier lock various items to a higher tier (sorted by progression) + { Vanilla(ItemID.Trimarang), AddIngredient(ModContent.ItemType(), 5) }, { Vanilla(ItemID.BundleofBalloons), AddIngredient(ModContent.ItemType(), 3) }, { r => r.HasResult(ItemID.HorseshoeBundle) && !r.HasIngredient(ItemID.BundleofBalloons), AddIngredient(ModContent.ItemType(), 3) }, { Vanilla(ItemID.NightsEdge), AddIngredient(ModContent.ItemType(), 5) }, { Vanilla(ItemID.FairyBoots), AddIngredient(ItemID.SoulofLight, 5) }, + { Vanilla(ItemID.HellfireTreads), AddIngredient(ModContent.ItemType(), 4) }, { Vanilla(ItemID.SpiritFlame), AddGroup(AnyAdamantiteBar, 2) }, { Vanilla(ItemID.TerraBlade), AddIngredient(ModContent.ItemType(), 12) }, { Vanilla(ItemID.FireGauntlet), AddIngredient(ModContent.ItemType(), 5) }, @@ -1267,7 +1278,7 @@ namespace CalamityMod // Shadow Key r = Recipe.Create(ItemID.ShadowKey); r.AddIngredient(ItemID.GoldenKey); - r.AddIngredient(ItemID.Obsidian, 20); + r.AddIngredient(ItemID.Obsidian, 10); r.AddIngredient(ItemID.Bone, 5); r.AddTile(TileID.Anvils); r.Register(); @@ -1284,9 +1295,9 @@ namespace CalamityMod // Ice Machine r = Recipe.Create(ItemID.IceMachine); - r.AddRecipeGroup("AnyIceBlock", 25); - r.AddRecipeGroup("AnySnowBlock", 15); - r.AddRecipeGroup("IronBar", 3); + r.AddRecipeGroup("AnyIceBlock", 10); + r.AddRecipeGroup("AnySnowBlock", 5); + r.AddRecipeGroup("IronBar", 5); r.AddTile(TileID.Anvils); r.Register(); r.DisableDecraft(); @@ -1331,8 +1342,8 @@ namespace CalamityMod // Frost Legion recipe for consistency r = Recipe.Create(ItemID.SnowGlobe); - r.AddRecipeGroup(AnySnowBlock, 50); - r.AddIngredient(ItemID.Glass, 10); + r.AddRecipeGroup(AnySnowBlock, 10); + r.AddIngredient(ItemID.Glass, 5); r.AddIngredient(ItemID.SoulofLight, 3); r.AddIngredient(ItemID.SoulofNight, 3); r.AddTile(TileID.Anvils); @@ -1341,8 +1352,8 @@ namespace CalamityMod // Gelatin Crystal (Queen Slime summon) r = Recipe.Create(ItemID.QueenSlimeCrystal); - r.AddIngredient(ItemID.CrystalShard, 20); - r.AddIngredient(ItemID.PinkGel, 10); + r.AddIngredient(ItemID.CrystalShard, 10); + r.AddIngredient(ItemID.PinkGel, 5); r.AddIngredient(ItemID.SoulofLight, 5); r.AddTile(TileID.Solidifier); r.Register(); @@ -1351,16 +1362,16 @@ namespace CalamityMod // Temple Key r = Recipe.Create(ItemID.TempleKey); r.AddIngredient(ItemID.JungleSpores, 15); - r.AddIngredient(ItemID.RichMahogany, 15); - r.AddIngredient(ItemID.SoulofLight, 15); - r.AddIngredient(ItemID.SoulofNight, 15); + r.AddIngredient(ItemID.RichMahogany, 10); + r.AddIngredient(ItemID.SoulofLight, 5); + r.AddIngredient(ItemID.SoulofNight, 5); r.AddTile(TileID.MythrilAnvil); r.Register(); r.DisableDecraft(); // Lihzahrd Power Cell (NOT Calamity's Old Power Cell) r = Recipe.Create(ItemID.LihzahrdPowerCell); - r.AddIngredient(ItemID.LihzahrdBrick, 15); + r.AddIngredient(ItemID.LihzahrdBrick, 5); r.AddIngredient(ModContent.ItemType()); r.AddTile(TileID.LihzahrdFurnace); r.Register(); @@ -1431,7 +1442,7 @@ namespace CalamityMod // Enchanted Boomerang r = Recipe.Create(ItemID.EnchantedBoomerang); r.AddIngredient(ItemID.WoodenBoomerang); - r.AddIngredient(ModContent.ItemType(), 6); + r.AddIngredient(ItemID.FallenStar, 6); r.AddRecipeGroup(AnyGoldBar, 8); r.AddTile(TileID.Anvils); r.Register(); @@ -1490,7 +1501,7 @@ namespace CalamityMod // Cloud in a Bottle Recipe r = Recipe.Create(ItemID.CloudinaBottle); r.AddIngredient(ItemID.Bottle); - r.AddIngredient(ItemID.Cloud, 25); + r.AddIngredient(ItemID.Cloud, 5); r.AddIngredient(ItemID.Feather, 2); r.AddTile(TileID.Anvils); r.Register(); @@ -1498,7 +1509,7 @@ namespace CalamityMod // Step Stool r = Recipe.Create(ItemID.PortableStool); - r.AddRecipeGroup("Wood", 15); + r.AddRecipeGroup("Wood", 10); r.AddTile(TileID.Sawmill); r.Register(); r.DisableDecraft(); @@ -1514,7 +1525,8 @@ namespace CalamityMod // Blizzard in a Bottle r = Recipe.Create(ItemID.BlizzardinaBottle); r.AddIngredient(ItemID.Bottle); - r.AddRecipeGroup(AnySnowBlock, 50); + r.AddIngredient(ItemID.Cloud, 5); + r.AddRecipeGroup(AnySnowBlock, 5); r.AddIngredient(ItemID.Feather, 3); r.AddTile(TileID.Anvils); r.Register(); @@ -1523,8 +1535,9 @@ namespace CalamityMod // Sandstorm in a Bottle r = Recipe.Create(ItemID.SandstorminaBottle); r.AddIngredient(ItemID.Bottle); - r.AddIngredient(ItemID.SandBlock, 70); - r.AddIngredient(ItemID.AntlionMandible, 5); + r.AddIngredient(ItemID.Cloud, 5); + r.AddIngredient(ItemID.SandBlock, 5); + r.AddIngredient(ItemID.AntlionMandible, 3); r.AddIngredient(ItemID.Feather, 3); r.AddTile(TileID.Anvils); r.Register(); @@ -1537,6 +1550,14 @@ namespace CalamityMod r.Register(); r.DisableDecraft(); + // Fledgling Wings + r = Recipe.Create(ItemID.CreativeWings); + r.AddIngredient(ItemID.Cloud, 5); + r.AddIngredient(ItemID.Feather, 10); + r.AddTile(TileID.Anvils); + r.Register(); + r.DisableDecraft(); + // Flying Carpet r = Recipe.Create(ItemID.FlyingCarpet); r.AddIngredient(ItemID.Silk, 10); @@ -1556,7 +1577,7 @@ namespace CalamityMod // Anklet of the Wind r = Recipe.Create(ItemID.AnkletoftheWind); r.AddIngredient(ItemID.JungleSpores, 15); - r.AddIngredient(ItemID.Cloud, 15); + r.AddIngredient(ItemID.Cloud, 5); r.AddIngredient(ItemID.PinkGel, 5); r.AddTile(TileID.Anvils); r.Register(); @@ -1570,20 +1591,20 @@ namespace CalamityMod r.Register(); r.DisableDecraft(); - // Flame Walker Boots + // Flame Waker Boots r = Recipe.Create(ItemID.FlameWakerBoots); r.AddIngredient(ItemID.Silk, 8); - r.AddIngredient(ItemID.Obsidian, 2); - r.AddTile(TileID.Loom); + r.AddIngredient(ItemID.HellstoneBar, 5); + r.AddIngredient(ItemID.Obsidian, 4); + r.AddTile(TileID.Anvils); r.Register(); r.DisableDecraft(); // Ice Skates r = Recipe.Create(ItemID.IceSkates); - r.AddRecipeGroup(AnyIceBlock, 20); r.AddIngredient(ItemID.Leather, 5); r.AddRecipeGroup("IronBar", 5); - r.AddTile(TileID.IceMachine); + r.AddTile(TileID.Anvils); r.Register(); r.DisableDecraft(); @@ -1597,8 +1618,8 @@ namespace CalamityMod // Shiny Red Balloon r = Recipe.Create(ItemID.ShinyRedBalloon); r.AddIngredient(ItemID.WhiteString); - r.AddIngredient(ItemID.Gel, 60); - r.AddIngredient(ItemID.Cloud, 20); + r.AddIngredient(ItemID.Gel, 15); + r.AddIngredient(ItemID.Cloud, 5); r.AddTile(TileID.Solidifier); r.Register(); r.DisableDecraft(); @@ -1606,7 +1627,7 @@ namespace CalamityMod // Lava Charm r = Recipe.Create(ItemID.LavaCharm); r.AddIngredient(ItemID.LavaBucket, 3); - r.AddIngredient(ItemID.Obsidian, 25); + r.AddIngredient(ItemID.Obsidian, 5); r.AddRecipeGroup(AnyGoldBar, 5); r.AddTile(TileID.Anvils); r.Register(); @@ -1615,8 +1636,8 @@ namespace CalamityMod // Obsidian Rose r = Recipe.Create(ItemID.ObsidianRose); r.AddIngredient(ItemID.JungleRose); - r.AddIngredient(ItemID.Obsidian, 10); - r.AddIngredient(ItemID.Hellstone, 10); + r.AddIngredient(ItemID.Obsidian, 5); + r.AddIngredient(ItemID.Hellstone, 5); r.AddTile(TileID.Anvils); r.Register(); r.DisableDecraft(); @@ -1654,9 +1675,7 @@ namespace CalamityMod // Hand Warmer r = Recipe.Create(ItemID.HandWarmer); - r.AddIngredient(ItemID.Silk, 5); - r.AddIngredient(ItemID.Shiverthorn); - r.AddRecipeGroup(AnySnowBlock, 10); + r.AddIngredient(ItemID.Silk, 10); r.AddTile(TileID.Loom); r.Register(); r.DisableDecraft(); @@ -1681,7 +1700,7 @@ namespace CalamityMod // Shoe Spikes r = Recipe.Create(ItemID.ShoeSpikes); r.AddRecipeGroup("IronBar", 5); - r.AddIngredient(ItemID.Spike, 10); + r.AddIngredient(ItemID.Spike, 5); r.AddTile(TileID.Anvils); r.Register(); r.DisableDecraft(); @@ -1702,24 +1721,21 @@ namespace CalamityMod // Eskimo armor Recipe r = Recipe.Create(ItemID.EskimoHood); r.AddIngredient(ItemID.Silk, 4); - r.AddIngredient(ItemID.Leather); - r.AddIngredient(ItemID.BorealWood, 12); + r.AddIngredient(ItemID.Leather, 2); r.AddTile(TileID.Loom); r.Register(); r.DisableDecraft(); r = Recipe.Create(ItemID.EskimoCoat); r.AddIngredient(ItemID.Silk, 8); - r.AddIngredient(ItemID.Leather); - r.AddIngredient(ItemID.BorealWood, 18); + r.AddIngredient(ItemID.Leather, 4); r.AddTile(TileID.Loom); r.Register(); r.DisableDecraft(); r = Recipe.Create(ItemID.EskimoPants); r.AddIngredient(ItemID.Silk, 6); - r.AddIngredient(ItemID.Leather); - r.AddIngredient(ItemID.BorealWood, 15); + r.AddIngredient(ItemID.Leather, 3); r.AddTile(TileID.Loom); r.Register(); r.DisableDecraft(); @@ -1744,14 +1760,14 @@ namespace CalamityMod { // Cobalt Shield Recipe r = Recipe.Create(ItemID.CobaltShield); - r.AddRecipeGroup(AnyCobaltBar, 10); + r.AddRecipeGroup(AnyCobaltBar, 5); r.AddTile(TileID.Anvils); r.Register(); r.DisableDecraft(); // Armor Polish (broken armor) r = Recipe.Create(ItemID.ArmorPolish); - r.AddIngredient(ItemID.Bone, 50); + r.AddIngredient(ItemID.Bone, 10); r.AddIngredient(ModContent.ItemType(), 3); r.AddTile(TileID.Anvils); r.Register(); @@ -1760,7 +1776,7 @@ namespace CalamityMod // Adhesive Bandage (bleeding) r = Recipe.Create(ItemID.AdhesiveBandage); r.AddIngredient(ItemID.Silk, 10); - r.AddIngredient(ItemID.Gel, 50); + r.AddIngredient(ItemID.Gel, 10); r.AddIngredient(ItemID.HealingPotion); r.AddTile(TileID.Anvils); r.Register(); @@ -1769,14 +1785,14 @@ namespace CalamityMod // Bezoar (poison) r = Recipe.Create(ItemID.Bezoar); r.AddIngredient(ModContent.ItemType(), 3); - r.AddIngredient(ItemID.Stinger, 7); + r.AddIngredient(ItemID.Stinger, 5); r.AddTile(TileID.Anvils); r.Register(); r.DisableDecraft(); // Nazar (curse) r = Recipe.Create(ItemID.Nazar); - r.AddIngredient(ItemID.SoulofNight, 15); + r.AddIngredient(ItemID.SoulofNight, 5); r.AddIngredient(ItemID.Lens, 3); r.AddTile(TileID.Anvils); r.Register(); @@ -1785,25 +1801,25 @@ namespace CalamityMod // Vitamins (weakness) r = Recipe.Create(ItemID.Vitamins); r.AddIngredient(ItemID.BottledWater); - r.AddIngredient(ItemID.Waterleaf, 5); - r.AddIngredient(ItemID.Blinkroot, 5); - r.AddIngredient(ItemID.Daybloom, 5); - r.AddIngredient(ModContent.ItemType(), 10); + r.AddIngredient(ItemID.Waterleaf, 3); + r.AddIngredient(ItemID.Blinkroot, 3); + r.AddIngredient(ItemID.Daybloom, 3); + r.AddIngredient(ModContent.ItemType(), 5); r.AddTile(TileID.AlchemyTable); r.Register(); r.DisableDecraft(); // Blindfold (darkness) r = Recipe.Create(ItemID.Blindfold); - r.AddIngredient(ItemID.Silk, 30); - r.AddIngredient(ItemID.TatteredCloth, 3); + r.AddIngredient(ItemID.Silk, 10); + r.AddIngredient(ItemID.TatteredCloth); r.AddTile(TileID.Anvils); r.Register(); r.DisableDecraft(); // Trifold Map (confusion) r = Recipe.Create(ItemID.TrifoldMap); - r.AddIngredient(ItemID.Silk, 20); + r.AddIngredient(ItemID.Silk, 10); r.AddIngredient(ItemID.SoulofLight, 3); r.AddIngredient(ItemID.SoulofNight, 3); r.AddTile(TileID.Anvils); @@ -1813,7 +1829,7 @@ namespace CalamityMod // Fast Clock (slow) r = Recipe.Create(ItemID.FastClock); r.AddIngredient(ItemID.Timer1Second); - r.AddIngredient(ItemID.PixieDust, 15); + r.AddIngredient(ItemID.PixieDust, 5); r.AddIngredient(ItemID.SoulofLight, 5); r.AddTile(TileID.Anvils); r.Register(); @@ -1821,17 +1837,17 @@ namespace CalamityMod // Megaphone (silence) r = Recipe.Create(ItemID.Megaphone); - r.AddIngredient(ItemID.Wire, 10); - r.AddRecipeGroup(AnyCobaltBar, 5); - r.AddIngredient(ItemID.Ruby, 3); + r.AddIngredient(ItemID.Wire, 5); + r.AddRecipeGroup(AnyCobaltBar, 3); + r.AddIngredient(ItemID.Ruby); r.AddTile(TileID.Anvils); r.Register(); r.DisableDecraft(); // Pocket Mirror (petrification) r = Recipe.Create(ItemID.PocketMirror); - r.AddIngredient(ItemID.Glass, 10); - r.AddRecipeGroup(AnyGoldBar, 4); + r.AddIngredient(ItemID.Glass, 5); + r.AddRecipeGroup(AnyGoldBar, 3); r.AddIngredient(ItemID.CrystalShard, 2); r.AddIngredient(ItemID.SoulofNight, 2); r.AddTile(TileID.Anvils); @@ -1853,28 +1869,28 @@ namespace CalamityMod // Living Wood Wand r = Recipe.Create(ItemID.LivingWoodWand); - r.AddIngredient(ItemID.Wood, 30); + r.AddIngredient(ItemID.Wood, 10); r.AddTile(TileID.LivingLoom); r.Register(); r.DisableDecraft(); // Living Leaf Wand r = Recipe.Create(ItemID.LeafWand); - r.AddIngredient(ItemID.Wood, 30); + r.AddIngredient(ItemID.Wood, 10); r.AddTile(TileID.LivingLoom); r.Register(); r.DisableDecraft(); // Living Mahogany Wand r = Recipe.Create(ItemID.LivingMahoganyWand); - r.AddIngredient(ItemID.RichMahogany, 30); + r.AddIngredient(ItemID.RichMahogany, 10); r.AddTile(TileID.LivingLoom); r.Register(); r.DisableDecraft(); // Living Mahogany Leaf Wand r = Recipe.Create(ItemID.LivingMahoganyLeafWand); - r.AddIngredient(ItemID.RichMahogany, 30); + r.AddIngredient(ItemID.RichMahogany, 10); r.AddTile(TileID.LivingLoom); r.Register(); r.DisableDecraft(); @@ -1894,8 +1910,8 @@ namespace CalamityMod // Frozen Turtle Shell r = Recipe.Create(ItemID.FrozenTurtleShell); - r.AddIngredient(ItemID.TurtleShell, 3); - r.AddIngredient(ModContent.ItemType(), 9); + r.AddIngredient(ItemID.TurtleShell, 2); + r.AddIngredient(ModContent.ItemType(), 4); r.AddTile(TileID.IceMachine); r.Register(); r.DisableDecraft(); @@ -1903,9 +1919,9 @@ namespace CalamityMod // Magic Quiver r = Recipe.Create(ItemID.MagicQuiver); r.AddIngredient(ItemID.EndlessQuiver); - r.AddIngredient(ItemID.PixieDust, 10); - r.AddIngredient(ItemID.Lens, 5); - r.AddIngredient(ItemID.SoulofLight, 8); + r.AddIngredient(ItemID.PixieDust, 5); + r.AddIngredient(ItemID.Lens, 3); + r.AddIngredient(ItemID.SoulofLight, 5); r.AddTile(TileID.CrystalBall); r.Register(); r.DisableDecraft(); @@ -1944,6 +1960,22 @@ namespace CalamityMod r.AddIngredient(ItemID.SoulofSight); r.Register(); r.DisableDecraft(); + + // Tiershift Mini Nuke 1s to post Moon Lord. + r = Recipe.Create(ItemID.MiniNukeI, 333); + r.AddIngredient(ItemID.RocketIII, 333); + r.AddIngredient(ItemID.LunarBar); + r.AddTile(TileID.LunarCraftingStation); + r.Register(); + r.DisableDecraft(); + + // Tiershift Mini Nuke 2s to post Moon Lord. + r = Recipe.Create(ItemID.MiniNukeII, 333); + r.AddIngredient(ItemID.RocketIV, 333); + r.AddIngredient(ItemID.LunarBar); + r.AddTile(TileID.LunarCraftingStation); + r.Register(); + r.DisableDecraft(); } #endregion diff --git a/Utilities/DrawingUtils.cs b/Utilities/DrawingUtils.cs index 7976065c70..0b541aa8ec 100644 --- a/Utilities/DrawingUtils.cs +++ b/Utilities/DrawingUtils.cs @@ -1,13 +1,14 @@ -using CalamityMod.Graphics; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using ReLogic.Content; -using ReLogic.Graphics; -using System; +using System; using System.Collections.Generic; using System.Reflection; using System.Runtime.CompilerServices; using System.Text; +using CalamityMod.Graphics; +using CalamityMod.Items.Weapons.Melee; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using ReLogic.Graphics; using Terraria; using Terraria.DataStructures; using Terraria.GameContent; @@ -397,16 +398,21 @@ namespace CalamityMod public static void DrawItemGlowmaskSingleFrame(this Item item, SpriteBatch spriteBatch, float rotation, Texture2D glowmaskTexture) { - Vector2 origin = new Vector2(glowmaskTexture.Width / 2f, glowmaskTexture.Height / 2f - 2f); - spriteBatch.Draw(glowmaskTexture, item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); + Vector2 origin = new Vector2(glowmaskTexture.Width / 2f, glowmaskTexture.Height / 2f); + + Color color = new Color(250, 250, 250, item.alpha); + if (item.type == ModContent.ItemType()) + color = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, item.alpha); + + spriteBatch.Draw(glowmaskTexture, item.Center - Main.screenPosition, null, color, rotation, origin, 1f, SpriteEffects.None, 0f); } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static Rectangle GetFrame(int itemID, int whoAmI, Texture2D texture = null) { texture ??= TextureAssets.Item[itemID].Value; - return Main.itemAnimations[itemID] == null - ? texture.Frame() + return Main.itemAnimations[itemID] == null + ? texture.Frame() : Main.itemAnimations[itemID].GetFrame(texture, Main.itemFrameCounter[whoAmI]); } [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -418,8 +424,8 @@ namespace CalamityMod public static Rectangle GetFrame(int itemID, Texture2D texture = null) { texture ??= TextureAssets.Item[itemID].Value; - return Main.itemAnimations[itemID] == null - ? texture.Frame() + return Main.itemAnimations[itemID] == null + ? texture.Frame() : Main.itemAnimations[itemID].GetFrame(texture); } [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -440,118 +446,6 @@ namespace CalamityMod return new Rectangle(0, item.height * frame, item.width, item.height); } - public static bool DrawFishingLine(this Projectile projectile, int fishingRodType, Color poleColor, int xPositionAdditive = 45, float yPositionAdditive = 35f) - { - Player player = Main.player[projectile.owner]; - Item item = player.HeldItem; - if (!projectile.bobber || item.holdStyle <= 0) - return false; - - Texture2D fishingLineTexture = TextureAssets.FishingLine.Value; - float originX = player.MountedCenter.X; - float originY = player.MountedCenter.Y; - originY += player.gfxOffY; - //This variable is used to account for Gravitation Potions - float gravity = player.gravDir; - - if (item.type == fishingRodType) - { - originX += (float)(xPositionAdditive * player.direction); - if (player.direction < 0) - { - originX -= 13f; - } - originY -= yPositionAdditive * gravity; - } - - if (gravity == -1f) - { - originY -= 12f; - } - Vector2 mountedCenter = new Vector2(originX, originY); - mountedCenter = player.RotatedRelativePoint(mountedCenter + new Vector2(8f), true) - new Vector2(8f); - Vector2 lineOrigin = projectile.Center - mountedCenter; - bool canDraw = true; - if (lineOrigin.X == 0f && lineOrigin.Y == 0f) - return false; - - float projPosMagnitude = lineOrigin.Length(); - projPosMagnitude = 12f / projPosMagnitude; - lineOrigin.X *= projPosMagnitude; - lineOrigin.Y *= projPosMagnitude; - mountedCenter -= lineOrigin; - lineOrigin = projectile.Center - mountedCenter; - - while (canDraw) - { - float height = 12f; - float positionMagnitude = lineOrigin.Length(); - if (float.IsNaN(positionMagnitude) || float.IsNaN(positionMagnitude)) - break; - - if (positionMagnitude < 20f) - { - height = positionMagnitude - 8f; - canDraw = false; - } - positionMagnitude = 12f / positionMagnitude; - lineOrigin.X *= positionMagnitude; - lineOrigin.Y *= positionMagnitude; - mountedCenter += lineOrigin; - lineOrigin = projectile.Center - mountedCenter; - if (positionMagnitude > 12f) - { - float positionInverseMultiplier = 0.3f; - float absVelocitySum = Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y); - if (absVelocitySum > 16f) - { - absVelocitySum = 16f; - } - absVelocitySum = 1f - absVelocitySum / 16f; - positionInverseMultiplier *= absVelocitySum; - absVelocitySum = positionMagnitude / 80f; - if (absVelocitySum > 1f) - { - absVelocitySum = 1f; - } - positionInverseMultiplier *= absVelocitySum; - if (positionInverseMultiplier < 0f) - { - positionInverseMultiplier = 0f; - } - absVelocitySum = 1f - projectile.localAI[0] / 100f; - positionInverseMultiplier *= absVelocitySum; - if (lineOrigin.Y > 0f) - { - lineOrigin.Y *= 1f + positionInverseMultiplier; - lineOrigin.X *= 1f - positionInverseMultiplier; - } - else - { - absVelocitySum = Math.Abs(projectile.velocity.X) / 3f; - if (absVelocitySum > 1f) - { - absVelocitySum = 1f; - } - absVelocitySum -= 0.5f; - positionInverseMultiplier *= absVelocitySum; - if (positionInverseMultiplier > 0f) - { - positionInverseMultiplier *= 2f; - } - lineOrigin.Y *= 1f + positionInverseMultiplier; - lineOrigin.X *= 1f - positionInverseMultiplier; - } - } - //This color decides the color of the fishing line. - Color lineColor = Lighting.GetColor((int)mountedCenter.X / 16, (int)mountedCenter.Y / 16, poleColor); - float rotation = lineOrigin.ToRotation() - MathHelper.PiOver2; - - Main.spriteBatch.Draw(fishingLineTexture, new Vector2(mountedCenter.X - Main.screenPosition.X + fishingLineTexture.Width * 0.5f, mountedCenter.Y - Main.screenPosition.Y + fishingLineTexture.Height * 0.5f), new Rectangle(0, 0, fishingLineTexture.Width, (int)height), lineColor, rotation, new Vector2(fishingLineTexture.Width * 0.5f, 0f), 1f, SpriteEffects.None, 0f); - } - return false; - } - public static void DrawHook(this Projectile projectile, Texture2D hookTexture, float angleAdditive = 0f) { Player player = Main.player[projectile.owner]; diff --git a/Utilities/DropHelper.cs b/Utilities/DropHelper.cs index ee4fe58292..89244ba914 100644 --- a/Utilities/DropHelper.cs +++ b/Utilities/DropHelper.cs @@ -1,8 +1,8 @@ using System; using System.Collections.Generic; using CalamityMod.Items.Accessories; -using CalamityMod.NPCs.SulphurousSea; using CalamityMod.Items.Potions; +using CalamityMod.NPCs.SulphurousSea; using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; @@ -286,7 +286,8 @@ namespace CalamityMod /// Adds all the common potions for fishing crates, alongside scaling mana and regen potions /// /// The ILoot interface for the loot table. - public static void AddCratePotionRules(this ILoot loot) + /// Whether or not the crate is considered a hardmode crate. + public static void AddCratePotionRules(this ILoot loot, bool hardMode = true) { loot.Add(ItemID.ObsidianSkinPotion, 10, 1, 3); loot.Add(ItemID.SwiftnessPotion, 10, 1, 3); @@ -311,14 +312,23 @@ namespace CalamityMod var lcrRegularPotion = new LeadingConditionRule(If(() => NPC.downedBoss3)); // Actually chain all the LCRs together - lcrSupremePotion.Add(supremePots); - lcrSupremePotion.OnFailedConditions(lcrSuperPotion); - lcrSuperPotion.Add(superPots); - lcrSuperPotion.OnFailedConditions(lcrGreaterPotion); - lcrGreaterPotion.Add(greaterPots); - lcrGreaterPotion.OnFailedConditions(lcrRegularPotion); + // Greater potions upwards are only chained if the crate is marked as Hardmode + if (hardMode) + { + lcrSupremePotion.Add(supremePots); + lcrSupremePotion.OnFailedConditions(lcrSuperPotion); + lcrSuperPotion.Add(superPots); + lcrSuperPotion.OnFailedConditions(lcrGreaterPotion); + lcrGreaterPotion.Add(greaterPots); + lcrGreaterPotion.OnFailedConditions(lcrRegularPotion); + } lcrRegularPotion.Add(regularPots); lcrRegularPotion.OnFailedConditions(lesserPots); + // Add the chain starting from regular potions if marked as a Pre-Hardmode crate + if (!hardMode) + { + loot.Add(lcrRegularPotion); + } } #endregion @@ -1108,7 +1118,7 @@ namespace CalamityMod // You can customize this duration as you see fit. Calamity defaults it to 5 minutes. private const int DefaultDropProtectionTime = 18000; // 5 minutes private int protectionTime; - + public PerPlayerDropRule(int itemID, int denominator, int minQuantity = 1, int maxQuantity = 1, int numerator = 1, int protectFrames = DefaultDropProtectionTime) : base(itemID, denominator, minQuantity, maxQuantity, numerator) { diff --git a/Utilities/EntityUtils.cs b/Utilities/EntityUtils.cs index f694567dfd..96d60c9900 100644 --- a/Utilities/EntityUtils.cs +++ b/Utilities/EntityUtils.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; namespace CalamityMod diff --git a/Utilities/FurnitureSetupUtils.cs b/Utilities/FurnitureSetupUtils.cs index 093fbf5073..78a2fe683f 100644 --- a/Utilities/FurnitureSetupUtils.cs +++ b/Utilities/FurnitureSetupUtils.cs @@ -829,7 +829,7 @@ namespace CalamityMod internal static void SetUpCandelabra(this ModTile mt, int itemDropID, bool lavaImmune = false) { mt.RegisterItemDrop(itemDropID); - + Main.tileLighted[mt.Type] = true; Main.tileFrameImportant[mt.Type] = true; Main.tileLavaDeath[mt.Type] = !lavaImmune; @@ -878,7 +878,7 @@ namespace CalamityMod mt.AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); if (autoMapEntry) mt.AddMapEntry(new Color(253, 221, 3), Language.GetText("ItemName.Candle")); - + mt.AdjTiles = new int[] { TileID.Candles }; } @@ -1179,7 +1179,8 @@ namespace CalamityMod /// The ModTile which is being initialized. /// The ID of the item this tile drops when broken. /// The map color of the tile. - internal static void SetUpFountain(this ModTile mt, int itemDropID, Color mapColor) + /// Whether or not the type of fountain is lava. + internal static void SetUpFountain(this ModTile mt, int itemDropID, Color mapColor, bool lava = false) { mt.RegisterItemDrop(itemDropID); @@ -1203,7 +1204,7 @@ namespace CalamityMod TileObjectData.newTile.StyleLineSkip = 2; TileObjectData.addTile(mt.Type); - mt.AddMapEntry(mapColor, Language.GetText("MapObject.WaterFountain")); + mt.AddMapEntry(mapColor, lava ? CalamityUtils.GetText("Tiles.LavaFountain") : Language.GetText("MapObject.WaterFountain")); mt.AnimationFrameHeight = 72; } @@ -1256,9 +1257,9 @@ namespace CalamityMod TileObjectData.newTile.StyleLineSkip = 2; TileObjectData.newTile.DrawYOffset = -2; TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.Platform, TileObjectData.newTile.Width, 0); - TileObjectData.newAlternate.DrawYOffset = -10; - TileObjectData.addAlternate(0); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.Platform, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.DrawYOffset = -10; + TileObjectData.addAlternate(0); TileObjectData.addTile(mt.Type); // All hanging lanterns count as light sources. @@ -1292,7 +1293,7 @@ namespace CalamityMod internal static void SetUpPiano(this ModTile mt, int itemDropID, bool lavaImmune = false, bool solidTop = true) { mt.RegisterItemDrop(itemDropID); - + Main.tileTable[mt.Type] = solidTop; Main.tileSolidTop[mt.Type] = solidTop; Main.tileLighted[mt.Type] = true; @@ -1319,7 +1320,7 @@ namespace CalamityMod internal static void SetUpPlatform(this ModTile mt, int itemDropID, bool lavaImmune = false) { mt.RegisterItemDrop(itemDropID); - + Main.tileLighted[mt.Type] = true; Main.tileFrameImportant[mt.Type] = true; Main.tileSolidTop[mt.Type] = true; @@ -1528,9 +1529,10 @@ namespace CalamityMod internal static void SetUpTrophy(this ModTile mt) { // TODO -- how to force trophy drops correctly? they all have zero code in them - + Main.tileFrameImportant[mt.Type] = true; Main.tileLavaDeath[mt.Type] = true; + Main.tileSpelunker[mt.Type] = true; TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3Wall); TileObjectData.addTile(mt.Type); TileID.Sets.DisableSmartCursor[mt.Type] = true; @@ -1578,6 +1580,7 @@ namespace CalamityMod { Main.tileFrameImportant[mt.Type] = true; Main.tileLavaDeath[mt.Type] = !lavaImmune; + Main.tileSpelunker[mt.Type] = true; Main.tileWaterDeath[mt.Type] = false; TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3Wall); TileObjectData.newTile.Width = 6; diff --git a/Utilities/GenericAIUtils.cs b/Utilities/GenericAIUtils.cs index fc86528c32..265c83daf3 100644 --- a/Utilities/GenericAIUtils.cs +++ b/Utilities/GenericAIUtils.cs @@ -1,7 +1,7 @@ -using CalamityMod.CalPlayer; +using System; +using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using static Terraria.ModLoader.ModContent; @@ -345,7 +345,7 @@ namespace CalamityMod projectile.rotation = projectile.velocity.X * tiltFloat; } - public static void HealingProjectile(this Projectile projectile, int healing, int playerToHeal, float homingVelocity, float N, bool autoHomes = true, int timeCheck = 120) + public static void HealingProjectile(this Projectile projectile, int healing, int playerToHeal, float homingVelocity, float inertia, bool autoHomes = true, int timeCheck = 120) { int target = playerToHeal; Player player = Main.player[target]; @@ -375,16 +375,16 @@ namespace CalamityMod playerDist = homingSpeed / playerDist; playerVector.X *= playerDist; playerVector.Y *= playerDist; - projectile.velocity.X = (projectile.velocity.X * N + playerVector.X) / (N + 1f); - projectile.velocity.Y = (projectile.velocity.Y * N + playerVector.Y) / (N + 1f); + projectile.velocity.X = (projectile.velocity.X * inertia + playerVector.X) / (inertia + 1f); + projectile.velocity.Y = (projectile.velocity.Y * inertia + playerVector.Y) / (inertia + 1f); } else if (player.lifeMagnet && projectile.timeLeft < timeCheck) { playerDist = homingVelocity / playerDist; playerVector.X *= playerDist; playerVector.Y *= playerDist; - projectile.velocity.X = (projectile.velocity.X * N + playerVector.X) / (N + 1f); - projectile.velocity.Y = (projectile.velocity.Y * N + playerVector.Y) / (N + 1f); + projectile.velocity.X = (projectile.velocity.X * inertia + playerVector.X) / (inertia + 1f); + projectile.velocity.Y = (projectile.velocity.Y * inertia + playerVector.Y) / (inertia + 1f); } } diff --git a/Utilities/ILEditingUtils.cs b/Utilities/ILEditingUtils.cs index 250ac2d8b9..bd0cfa0557 100644 --- a/Utilities/ILEditingUtils.cs +++ b/Utilities/ILEditingUtils.cs @@ -1,4 +1,4 @@ -using MonoMod.Cil; +using MonoMod.Cil; namespace CalamityMod { diff --git a/Utilities/ItemUtils.cs b/Utilities/ItemUtils.cs index bbfb91dcf5..88bb34ef06 100644 --- a/Utilities/ItemUtils.cs +++ b/Utilities/ItemUtils.cs @@ -47,13 +47,13 @@ namespace CalamityMod // This makes sense to be here but also not case -1: if (DownedBossSystem.downedDoG) - return 20; + return 14; else if (NPC.downedMoonlord) - return 16; - else if (Main.hardMode) return 12; + else if (Main.hardMode) + return 10; return 8; - + case PrefixID.Hard: if (DownedBossSystem.downedDoG) return 4; @@ -65,7 +65,7 @@ namespace CalamityMod case PrefixID.Guarding: if (DownedBossSystem.downedDoG) - return 6; + return 5; else if (NPC.downedMoonlord) return 4; else if (Main.hardMode) @@ -74,20 +74,20 @@ namespace CalamityMod case PrefixID.Armored: if (DownedBossSystem.downedDoG) - return 8; - else if (NPC.downedMoonlord) return 6; - else if (Main.hardMode) + else if (NPC.downedMoonlord) return 5; + else if (Main.hardMode) + return 4; return 3; case PrefixID.Warding: if (DownedBossSystem.downedDoG) - return 10; + return 7; else if (NPC.downedMoonlord) - return 8; - else if (Main.hardMode) return 6; + else if (Main.hardMode) + return 5; return 4; } } @@ -147,11 +147,14 @@ namespace CalamityMod }; prefix = IteratePrefix(rand, terrarianReforgeTiers, currentPrefix); } - + // Yoyos, Flails, Spears, etc. // Spears actually work fine with Legendary, but vanilla doesn't give it to them, so we won't either. // Rapiers, whips, and other specific vanilla weapons (ie. Zenith or Excalibur) are specifically excluded from this, so they get broadsword reforges despite not scaling with melee speed. - else if ((item.channel || item.noMelee) && item.useStyle != ItemUseStyleID.Rapier && !item.CountsAsClass() && !PrefixLegacy.ItemSets.SwordsHammersAxesPicks[item.type]) + // + // 18FEB2024: Ozzatron: removed the (item.channel || item.noMelee) because vanilla lets Burning Sky get Legendary + // 12MAY2024: Shade: added item.useStyle != ItemUseStyleID.Shoot because vanilla lets Sahara Slicers and Death's Ascension get Legendary + else if (item.channel && item.useStyle != ItemUseStyleID.Rapier && !item.CountsAsClass() && !PrefixLegacy.ItemSets.SwordsHammersAxesPicks[item.type] && item.useStyle != ItemUseStyleID.Shoot) { int[][] meleeNoSpeedReforgeTiers = new int[][] { @@ -329,7 +332,7 @@ namespace CalamityMod { if (Main.dedServ || mhk is null) return; - + string finalKey = mhk.TooltipHotkeyString(); tooltips.FindAndReplace("[KEY]", finalKey); } @@ -772,29 +775,29 @@ namespace CalamityMod mod.Find("Flimsy").Type, mod.Find("Unbalanced").Type, mod.Find("Atrocious").Type, - PrefixID.Keen, - PrefixID.Superior, - PrefixID.Forceful, - PrefixID.Broken, - PrefixID.Damaged, - PrefixID.Hurtful, - PrefixID.Strong, - PrefixID.Unpleasant, - PrefixID.Weak, - PrefixID.Ruthless, - PrefixID.Godly, - PrefixID.Demonic, - PrefixID.Zealous, - PrefixID.Quick, - PrefixID.Deadly2, - PrefixID.Agile, - PrefixID.Nimble, - PrefixID.Murderous, - PrefixID.Slow, - PrefixID.Sluggish, - PrefixID.Lazy, - PrefixID.Annoying, - PrefixID.Nasty + PrefixID.Keen, + PrefixID.Superior, + PrefixID.Forceful, + PrefixID.Broken, + PrefixID.Damaged, + PrefixID.Hurtful, + PrefixID.Strong, + PrefixID.Unpleasant, + PrefixID.Weak, + PrefixID.Ruthless, + PrefixID.Godly, + PrefixID.Demonic, + PrefixID.Zealous, + PrefixID.Quick, + PrefixID.Deadly2, + PrefixID.Agile, + PrefixID.Nimble, + PrefixID.Murderous, + PrefixID.Slow, + PrefixID.Sluggish, + PrefixID.Lazy, + PrefixID.Annoying, + PrefixID.Nasty }); return roguePrefix; } diff --git a/Utilities/MathematicalUtils.cs b/Utilities/MathematicalUtils.cs index de04c2c4ff..1813494294 100644 --- a/Utilities/MathematicalUtils.cs +++ b/Utilities/MathematicalUtils.cs @@ -1,6 +1,6 @@ -using Microsoft.Xna.Framework; -using System; +using System; using System.Collections.Generic; +using Microsoft.Xna.Framework; using Terraria; namespace CalamityMod @@ -181,7 +181,7 @@ namespace CalamityMod Vector2 perpendicular = (lineEnd - lineStart).RotatedBy(MathHelper.PiOver2).SafeNormalize(Vector2.Zero); float distanceToLine = point.ShortestDistanceToLine(lineStart, lineEnd); - float lineSide = Math.Sign((point.X - lineStart.X) * ( -lineEnd.Y + lineStart.Y) + (point.Y - lineStart.Y) * (lineEnd.X - lineStart.X)); + float lineSide = Math.Sign((point.X - lineStart.X) * (-lineEnd.Y + lineStart.Y) + (point.Y - lineStart.Y) * (lineEnd.X - lineStart.X)); return point + distanceToLine * lineSide * perpendicular; } @@ -257,7 +257,7 @@ namespace CalamityMod CircIn, CircOut, CircInOut } - private static readonly EasingFunction[] EasingTypeToFunction = new EasingFunction[] { LinearEasing, SineInEasing, SineOutEasing, SineInOutEasing, SineBumpEasing, PolyInEasing, PolyOutEasing, PolyInOutEasing, ExpInEasing, ExpOutEasing, ExpInOutEasing, CircInEasing, CircOutEasing, CircInOutEasing}; + private static readonly EasingFunction[] EasingTypeToFunction = new EasingFunction[] { LinearEasing, SineInEasing, SineOutEasing, SineInOutEasing, SineBumpEasing, PolyInEasing, PolyOutEasing, PolyInOutEasing, ExpInEasing, ExpOutEasing, ExpInOutEasing, CircInEasing, CircOutEasing, CircInOutEasing }; /// /// This represents a part of a piecewise function. diff --git a/Utilities/MiscUtils.cs b/Utilities/MiscUtils.cs index 3914365dd7..3654c3679a 100644 --- a/Utilities/MiscUtils.cs +++ b/Utilities/MiscUtils.cs @@ -250,28 +250,28 @@ namespace CalamityMod public static void StartSandstorm() { - // If it's not windy enough, make it windy enough for a sandstorm - // 0.6f is the minimum for vanilla but Calamity changes it to 0.2f - // Windy days occur when wind speed is at least 0.5f (0.4f in vanilla) so this should never cause a windy day - float windSpeed = 0f; - if (Main.windSpeedCurrent == 0f) + // If it's not windy enough, make it windy enough for a sandstorm + // 0.6f is the minimum for vanilla but Calamity changes it to 0.2f + // Windy days occur when wind speed is at least 0.5f (0.4f in vanilla) so this should never cause a windy day + float windSpeed = 0f; + if (Main.windSpeedCurrent < 0.2f && Main.windSpeedCurrent > 0f) + if (Main.windSpeedCurrent == 0f) + { + windSpeed = Main.rand.NextFloat(0.2f, 0.4f) * (Main.rand.Next(0, 2) * 2 - 1); + } + else if (Main.windSpeedCurrent < 0.2f && Main.windSpeedCurrent > 0f) + { + windSpeed = Main.rand.NextFloat(0.2f, 0.4f); + } + else if (Main.windSpeedCurrent > -0.2f && Main.windSpeedCurrent < 0f) + { + windSpeed = Main.rand.NextFloat(-0.4f, -0.2f); + } + if (windSpeed != 0f) { - windSpeed = Main.rand.NextFloat(0.2f, 0.4f) * (Main.rand.Next(0, 2) * 2 - 1); + Main.windSpeedCurrent = windSpeed < 0f ? -0.2f : 0.2f; + Main.windSpeedTarget = windSpeed; } - else if (Main.windSpeedCurrent < 0.2f && Main.windSpeedCurrent > 0f) - { - windSpeed = Main.rand.NextFloat(0.2f, 0.4f); - } - else if (Main.windSpeedCurrent > -0.2f && Main.windSpeedCurrent < 0f) - { - windSpeed = Main.rand.NextFloat(-0.4f, -0.2f); - } - if (windSpeed != 0f) - { - Main.windSpeedCurrent = windSpeed < 0f ? -0.2f : 0.2f; - Main.windSpeedTarget = windSpeed; - } - Sandstorm.StartSandstorm(); } diff --git a/Utilities/NPCDebuffs.cs b/Utilities/NPCDebuffs.cs index d57e7c20de..c66dbc74d2 100644 --- a/Utilities/NPCDebuffs.cs +++ b/Utilities/NPCDebuffs.cs @@ -63,7 +63,7 @@ namespace CalamityMod // // PART 1: General Immunity Status and applying all data contained in EnemyStats.DebuffImmunities // - + // Also, can I just say that I hate Sorted Dictionaries and Tuples and want to make something explode? -Ben // I mean you can but sorted dicts and dicts in general are pre great -Amber // Neither of you are free of sin. In porting, we are all brothers in damnation. -Ozzatron @@ -169,6 +169,8 @@ namespace CalamityMod EnemyStats.DebuffImmunities = new SortedDictionary> { { ModContent.NPCType(), immuneToEverything }, + { ModContent.NPCType(), immuneToEverything }, + { ModContent.NPCType(), immuneToEverything }, { NPCID.Deerclops, ice }, @@ -343,6 +345,7 @@ namespace CalamityMod { ModContent.NPCType(), abyss }, { ModContent.NPCType(), abyss }, { ModContent.NPCType(), abyss }, + { ModContent.NPCType(), abyss }, { ModContent.NPCType(), abyss }, { ModContent.NPCType(), abyss }, { ModContent.NPCType(), abyss }, diff --git a/Utilities/NPCUtils.cs b/Utilities/NPCUtils.cs index 84565bea36..84aa4a19d2 100644 --- a/Utilities/NPCUtils.cs +++ b/Utilities/NPCUtils.cs @@ -55,7 +55,7 @@ namespace CalamityMod /// public static void HideFromBestiary(this ModNPC n) { - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { Hide = true }; @@ -191,6 +191,23 @@ namespace CalamityMod return FindFirstProjectile(ProjectileType()) != -1; } + /// + /// Syncs . This exists to sync the Destroyer's lasers so that the telegraphs and segment colors display properly. + /// + /// + public static void SyncDestroyerLaserColor(this NPC npc) + { + // Don't bother attempting to send packets in singleplayer. + if (Main.netMode == NetmodeID.SinglePlayer) + return; + + ModPacket packet = CalamityMod.Instance.GetPacket(); + packet.Write((byte)CalamityModMessageType.SyncDestroyerLaserColor); + packet.Write((byte)npc.whoAmI); + packet.Write(npc.Calamity().destroyerLaserColor); + packet.Send(); + } + /// /// Syncs . This exists specifically for AIs manipulated in a global context, as has no netUpdate related hooks. /// diff --git a/Utilities/PlayerUtils.cs b/Utilities/PlayerUtils.cs index 578c40e2fa..eab0501756 100644 --- a/Utilities/PlayerUtils.cs +++ b/Utilities/PlayerUtils.cs @@ -1,9 +1,11 @@ using System.Collections.Generic; using System.Linq; +using System.Reflection; using CalamityMod.Balancing; using CalamityMod.CalPlayer; using CalamityMod.Cooldowns; using CalamityMod.Events; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Potions.Alcohol; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -282,7 +284,7 @@ namespace CalamityMod return false; return true; } - + // See also: Player.IsStandingStillForSpecialEffects (Vanilla shiny stone + standing still mana regen) // That is more or less equivalent to this with the default value of 0.05 public static bool StandingStill(this Player player, float velocity = 0.05f) => player.velocity.Length() < velocity; @@ -412,6 +414,103 @@ namespace CalamityMod #endregion #region Immunity Frames + /// + /// Computes the appropriate amount of immunity frames to grant a player when they are struck by an attack.
+ /// Accounts for all Calamity effects, but not effects from other mods. + ///
+ /// The player whose immunity frames are being computed. + /// The amount of immunity frames the player should receive if struck. + public static int ComputeHitIFrames(this Player player, HurtInfo hurtInfo) + { + // Start with vanilla immunity frames. + int iframes = BalancingConstants.VanillaDefaultIFrames + (player.longInvince ? BalancingConstants.CrossNecklaceIFrameBoost : 0); + + // Add on all Calamity effects. + int calBonusIFrames = player.GetExtraHitIFrames(hurtInfo); + + return iframes + calBonusIFrames; + } + + /// + /// Gets the total amount of extra immunity frames from a hit granted by various Calamity effects. + /// + /// The player whose extra immunity frames are being computed. + /// The amount of extra immunity frames to grant. + public static int GetExtraHitIFrames(this Player player, HurtInfo hurtInfo) + { + CalamityPlayer modPlayer = player.Calamity(); + + int extraIFrames = 0; + if (modPlayer.godSlayerThrowing && hurtInfo.Damage > 80) + extraIFrames += 30; + if (modPlayer.statigelSet && hurtInfo.Damage > 100) + extraIFrames += 30; + + // Deific Amulet provides 10 to 40 bonus immunity frames when you get hit which scale with your missing health. + // If you only take 1 damage, you get 5 iframes. + // This effect is inherited by Rampart of Deities. + if (modPlayer.dAmulet) + { + if (hurtInfo.Damage > 1) + { + float lifeRatio = (float)player.statLife / player.statLifeMax2; + float iframeEffectivenessRatio = Utils.GetLerpValue(1.0f, 0.25f, lifeRatio, true); + + extraIFrames += (int)(iframeEffectivenessRatio * DeificAmulet.MaxBonusIFrames); + } + else + extraIFrames += 5; + } + + // Ozzatron 20FEB2024: Moved extra iframes from Seraph Tracers to Rampart of Deities to counteract its loss of Charm of Myths + // This stacks with the above Deific Amulet effect + if (modPlayer.rampartOfDeities && hurtInfo.Damage > 200) + extraIFrames += 30; + + if (modPlayer.fabsolVodka) + { + if (hurtInfo.Damage == 1) + extraIFrames += 5; + else + extraIFrames += 10; + } + + return extraIFrames; + } + + /// + /// Computes the appropriate amount of immunity frames to grant a player when they activate a dodge.
+ /// Accounts for all Calamity effects, but not effects from other mods. + ///
+ /// The player whose immunity frames are being computed. + /// The amount of immunity frames the player should receive upon dodging. + public static int ComputeDodgeIFrames(this Player player) + { + int iframes = BalancingConstants.VanillaDodgeIFrames + (player.longInvince ? BalancingConstants.CrossNecklaceIFrameBoost : 0); + return iframes; + } + + /// + /// Computes the appropriate amount of immunity frames to grant a player when they activate a parry.
+ /// Accounts for all Calamity effects, but not effects from other mods. + ///
+ /// The player whose immunity frames are being computed. + /// The amount of immunity frames the player should receive upon parrying. + public static int ComputeParryIFrames(this Player player) + { + int iframes = BalancingConstants.VanillaParryIFrames + (player.longInvince ? BalancingConstants.CrossNecklaceIFrameBoost_Parry : 0); + return iframes; + } + + // Currently, reflects are functionally equivalent to dodges. + /// + /// Computes the appropriate amount of immunity frames to grant a player when they activate a reflect.
+ /// Accounts for all Calamity effects, but not effects from other mods. + ///
+ /// The player whose immunity frames are being computed. + /// The amount of immunity frames the player should receive upon reflecting an attack. + public static int ComputeReflectIFrames(this Player player) => player.ComputeDodgeIFrames(); + /// /// Checks whether the player has any kind of immunity frames (or "iframes" for short) available. /// @@ -432,13 +531,47 @@ namespace CalamityMod } /// - /// Gives the player the specified number of immunity frames (or "iframes" for short).
If the player already has more iframes than you want to give them, this function does nothing. + /// Gives the player the specified number of immunity frames (or "iframes" for short) to a specific cooldown slot.
+ /// If the player already has more iframes than you want to give them, this function does nothing.
+ ///
+ /// This should be used for effects that need to mock or mimic the iframes that would be granted by getting hit. + ///
+ /// The player who should be given immunity frames. + /// The immunity cooldown slot to use. See TML documentation for which is which. + /// The number of immunity frames to give. + /// Whether or not the player should be blinking during this time. + /// Whether or not any immunity frames were given. + public static bool GiveIFrames(this Player player, int cooldownSlot, int frames, bool blink = false) + { + // Check to see if there is any way for the player to get iframes from this operation. + bool anyIFramesWouldBeGiven = (cooldownSlot < 0) ? player.immuneTime < frames : player.hurtCooldowns[cooldownSlot] < frames; + + // If they would get nothing, don't do it. + if (!anyIFramesWouldBeGiven) + return false; + + // Apply iframes thoroughly. Player.AddImmuneTime is not used because iframes should not exceed the intended amount. + player.immune = true; + player.immuneNoBlink = !blink; + if (cooldownSlot < 0) + player.immuneTime = frames; + else + player.hurtCooldowns[cooldownSlot] = frames; + + return true; + } + + /// + /// Gives the player the specified number of immunity frames (or "iframes" for short) to all cooldown slots.
+ /// If the player already has more iframes than you want to give them, this function does nothing.
+ ///
+ /// This should be used for effects like dodges or true invulnerability that should prevent the player from being hit for a predetermined time. ///
/// The player who should be given immunity frames. /// The number of immunity frames to give. /// Whether or not the player should be blinking during this time. /// Whether or not any immunity frames were given. - public static bool GiveIFrames(this Player player, int frames, bool blink = false) + public static bool GiveUniversalIFrames(this Player player, int frames, bool blink = false) { // Check to see if there is any way for the player to get iframes from this operation. bool anyIFramesWouldBeGiven = false; @@ -450,8 +583,7 @@ namespace CalamityMod if (!anyIFramesWouldBeGiven) return false; - // Apply iframes thoroughly. - // Player.AddImmuneTime does exist, but is equivalent to the below code. + // Apply iframes thoroughly. Player.AddImmuneTime is not used because iframes should not exceed the intended amount. player.immune = true; player.immuneNoBlink = !blink; player.immuneTime = frames; @@ -474,6 +606,20 @@ namespace CalamityMod for (int i = 0; i < player.hurtCooldowns.Length; ++i) player.hurtCooldowns[i] = 0; } + + private static readonly FieldInfo hurtInfoDamageField = typeof(HurtInfo).GetField("_damage", BindingFlags.Instance | BindingFlags.NonPublic); + + /// + /// Lifted from Fargo's. Sets the damage and knockback of an incoming hit to zero, making it not affect the player. + /// + /// The HurtInfo instance to nullify. + public static void NullifyHit(ref this HurtInfo hurtInfo) + { + object unboxedHurtInfo = hurtInfo; + hurtInfoDamageField.SetValue(unboxedHurtInfo, 0); + hurtInfo = (Player.HurtInfo)unboxedHurtInfo; + hurtInfo.Knockback = 0; + } #endregion #region Rage and Adrenaline @@ -520,15 +666,12 @@ namespace CalamityMod /// A reference to the current in-use damage multiplier. This will be increased in-place. public static void ApplyRippersToDamage(CalamityPlayer mp, bool trueMelee, ref float damageMult) { - // Reduce how much true melee benefits from Rage and Adrenaline. - float rageAndAdrenalineTrueMeleeDamageMult = 0.5f; - // Rage and Adrenaline now stack additively with no special cases. if (mp.rageModeActive) - damageMult += trueMelee ? mp.RageDamageBoost * rageAndAdrenalineTrueMeleeDamageMult : mp.RageDamageBoost; + damageMult += trueMelee ? mp.RageDamageBoost * BalancingConstants.TrueMeleeRipperReductionFactor : mp.RageDamageBoost; // Draedon's Heart disables Adrenaline damage. if (mp.adrenalineModeActive && !mp.draedonsHeart) - damageMult += trueMelee ? mp.GetAdrenalineDamage() * rageAndAdrenalineTrueMeleeDamageMult : mp.GetAdrenalineDamage(); + damageMult += trueMelee ? mp.GetAdrenalineDamage() * BalancingConstants.TrueMeleeRipperReductionFactor : mp.GetAdrenalineDamage(); } #endregion @@ -708,12 +851,12 @@ namespace CalamityMod } } - player.itemLocation = finalPosition; + player.itemLocation = finalPosition + new Vector2(spriteSize.X * 0.5f, 0); } #endregion #region Visual Layers - public static void HideAccessories(this Player player, bool hideHeadAccs = true, bool hideBodyAccs = true, bool hideLegAccs = true, bool hideShield = true) + public static void HideAccessories(this Player player, bool hideHeadAccs = true, bool hideBodyAccs = true, bool hideLegAccs = true, bool hideShield = true) { if (hideHeadAccs) player.face = -1; @@ -722,7 +865,7 @@ namespace CalamityMod { player.handon = -1; player.handoff = -1; - + player.back = -1; player.front = -1; player.neck = -1; @@ -739,6 +882,13 @@ namespace CalamityMod } #endregion + /// + /// A shorthand bool to check if the player can continue using the holdout or not. + /// + /// The player using the holdout. + /// Returns if the player CAN'T use the item. + public static bool CantUseHoldout(this Player player) => player == null || !player.active || player.dead || !player.channel || player.CCed || player.noItems; + /// /// Makes the given player send the given packet to all appropriate receivers.
/// If server is false, the packet is sent only to the multiplayer host.
diff --git a/Utilities/ProjectileUtils.cs b/Utilities/ProjectileUtils.cs index a8840f284a..0a34629ef5 100644 --- a/Utilities/ProjectileUtils.cs +++ b/Utilities/ProjectileUtils.cs @@ -93,7 +93,7 @@ namespace CalamityMod public static void ExpandHitboxBy(this Projectile projectile, Vector2 newSize) => projectile.ExpandHitboxBy((int)newSize.X, (int)newSize.Y); public static void ExpandHitboxBy(this Projectile projectile, float expandRatio) => projectile.ExpandHitboxBy((int)(projectile.width * expandRatio), (int)(projectile.height * expandRatio)); - public static void HomeInOnNPC(Projectile projectile, bool ignoreTiles, float distanceRequired, float homingVelocity, float N) + public static void HomeInOnNPC(Projectile projectile, bool ignoreTiles, float distanceRequired, float homingVelocity, float inertia) { if (!projectile.friendly) return; @@ -106,20 +106,28 @@ namespace CalamityMod float maxDistance = distanceRequired; bool locatedTarget = false; - // Find a target. + // Find the closest target. + float npcDistCompare = 25000f; // Initializing the value to a large number so the first entry is basically guaranteed to replace it. + int index = -1; for (int i = 0; i < Main.maxNPCs; i++) { float extraDistance = (Main.npc[i].width / 2) + (Main.npc[i].height / 2); if (!Main.npc[i].CanBeChasedBy(projectile, false) || !projectile.WithinRange(Main.npc[i].Center, maxDistance + extraDistance)) continue; - if (ignoreTiles || Collision.CanHit(projectile.Center, 1, 1, Main.npc[i].Center, 1, 1)) + float currentNPCDist = Vector2.Distance(Main.npc[i].Center, projectile.Center); + if ((currentNPCDist < npcDistCompare) && (ignoreTiles || Collision.CanHit(projectile.Center, 1, 1, Main.npc[i].Center, 1, 1))) { - destination = Main.npc[i].Center; - locatedTarget = true; - break; + npcDistCompare = currentNPCDist; + index = i; } } + // If the index was never changed, don't do anything. Otherwise, tell the projectile where to home. + if (index != -1) + { + destination = Main.npc[index].Center; + locatedTarget = true; + } if (locatedTarget) { @@ -128,7 +136,7 @@ namespace CalamityMod // Home in on the target. Vector2 homeDirection = (destination - projectile.Center).SafeNormalize(Vector2.UnitY); - projectile.velocity = (projectile.velocity * N + homeDirection * homingVelocity) / (N + 1f); + projectile.velocity = (projectile.velocity * inertia + homeDirection * homingVelocity) / (inertia + 1f); } else { @@ -174,6 +182,41 @@ namespace CalamityMod return CalculatePredictiveAimToTarget(startingPosition, target.Center, target.velocity, shootSpeed, iterations); } + /// + /// Calculates a velocity that approximately predicts where some target will be in the future based on Euler's Method. This takes into account the projectile's max updates. + /// + /// The starting position from where the movement is calculated. + /// The position of the target to hit. + /// The velocity of the target to hit. + /// The speed of the predictive velocity. + /// How many extra updates the resulting projectile will have. + /// The number of iterations to perform. The more iterations, the more precise the results are. + public static Vector2 CalculatePredictiveAimToTargetMaxUpdates(Vector2 startingPosition, Vector2 targetPosition, Vector2 targetVelocity, float shootSpeed, int projMaxUpdates, int iterations = 4) + { + float previousTimeToReachDestination = 0f; + Vector2 currentTargetPosition = targetPosition; + for (int i = 0; i < iterations; i++) + { + float timeToReachDestination = Vector2.Distance(startingPosition, currentTargetPosition) / shootSpeed / projMaxUpdates; + currentTargetPosition += targetVelocity * (timeToReachDestination - previousTimeToReachDestination); + previousTimeToReachDestination = timeToReachDestination; + } + return (currentTargetPosition - startingPosition).SafeNormalize(Vector2.UnitY) * shootSpeed; + } + + /// + /// Calculates a velocity that approximately predicts where some target will be in the future based on Euler's Method. This takes into account the projectile's max updates. + /// + /// The starting position from where the movement is calculated. + /// The target to hit. + /// The speed of the predictive velocity. + /// How many extra updates the resulting projectile will have. + /// The number of iterations to perform. The more iterations, the more precise the results are. + public static Vector2 CalculatePredictiveAimToTargetMaxUpdates(Vector2 startingPosition, Entity target, float shootSpeed, int projMaxUpdates, int iterations = 4) + { + return CalculatePredictiveAimToTargetMaxUpdates(startingPosition, target.Center, target.velocity, shootSpeed, projMaxUpdates, iterations); + } + /// /// Makes a projectile home in such a way that it attempts to fractionally move towards a target's expected future position. /// This is based on the results of the method. @@ -393,11 +436,12 @@ namespace CalamityMod public struct RocketBehaviorInfo { internal int rocketItemType; - + // Explosion radii for various rocket ammos. Defaults to the sizes used in vanilla launchers. public int smallRadius = 3; // Rocket I and II public int mediumRadius = 6; // Rocket III and IV - public int largeRadius = 9; // Mini Nuke and Cluster Rockets + public int bigRadius = 7; // Cluster Rockets + public int largeRadius = 9; // Mini Nukes public bool respectStandardBlastImmunity = true; public List tilesToCheck = null; @@ -480,12 +524,12 @@ namespace CalamityMod break; case ItemID.ClusterRocketI: - explosionRadius = info.largeRadius; + explosionRadius = info.bigRadius; SpawnClusterFragments(false); break; case ItemID.ClusterRocketII: - explosionRadius = info.largeRadius; + explosionRadius = info.bigRadius; SpawnClusterFragments(true); break; @@ -831,7 +875,7 @@ namespace CalamityMod { if (blastImmuneTiles.Contains(type) || // Respects standard blast immunities if enabled, so they're covered Main.tileContainer[tile.TileType] || // Chests should never be exploded - // Dungeon tiles and TileLoader CanExplode are considered part of respecting standard blast immunities + // Dungeon tiles and TileLoader CanExplode are considered part of respecting standard blast immunities respectStandardBlastImmunity && (Main.tileDungeon[type] || !TileLoader.CanExplode(tx, ty)) || // TileLoader CanKillTile can block the destruction of a tile regardless of whether it is via an explosion !TileLoader.CanKillTile(tx, ty, tile.TileType, ref refTrue) || !TileLoader.CanKillTile(tx, ty, tile.TileType, ref refFalse)) @@ -884,8 +928,8 @@ namespace CalamityMod } } - // Label to jump to if wall destruction is aborted. - PostWallBlastLoop:; +// Label to jump to if wall destruction is aborted. +PostWallBlastLoop:; } } } @@ -900,7 +944,7 @@ namespace CalamityMod Vector2 corner = projectile.position; for (int i = 0; i < 40; i++) { - int idx = Dust.NewDust(corner, projectile.width, projectile.height, 31, 0f, 0f, 100, default, 2f); + int idx = Dust.NewDust(corner, projectile.width, projectile.height, DustID.Smoke, 0f, 0f, 100, default, 2f); Main.dust[idx].velocity *= 3f; if (Main.rand.NextBool()) { @@ -910,10 +954,10 @@ namespace CalamityMod } for (int i = 0; i < 70; i++) { - int idx = Dust.NewDust(corner, projectile.width, projectile.height, 6, 0f, 0f, 100, default, 3f); + int idx = Dust.NewDust(corner, projectile.width, projectile.height, DustID.Torch, 0f, 0f, 100, default, 3f); Main.dust[idx].noGravity = true; Main.dust[idx].velocity *= 5f; - idx = Dust.NewDust(corner, projectile.width, projectile.height, 6, 0f, 0f, 100, default, 2f); + idx = Dust.NewDust(corner, projectile.width, projectile.height, DustID.Torch, 0f, 0f, 100, default, 2f); Main.dust[idx].velocity *= 2f; } diff --git a/Utilities/RicoshotUtils.cs b/Utilities/RicoshotUtils.cs index 390c58c4c0..f79a060cc9 100644 --- a/Utilities/RicoshotUtils.cs +++ b/Utilities/RicoshotUtils.cs @@ -24,7 +24,7 @@ namespace CalamityMod public bool IsValid => type != RicoshotTargetType.None; } - + public static partial class CalamityUtils { public static int GetActiveRicoshotCoinCount(this Player player) diff --git a/Utilities/TileEntityUtils.cs b/Utilities/TileEntityUtils.cs index 743204b84b..4508e9c84c 100644 --- a/Utilities/TileEntityUtils.cs +++ b/Utilities/TileEntityUtils.cs @@ -3,12 +3,12 @@ using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.DataStructures; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; using Terraria.UI.Chat; -using Terraria.Audio; -using Terraria.GameContent; using static Terraria.ModLoader.ModContent; namespace CalamityMod diff --git a/Utilities/TileFraming.cs b/Utilities/TileFraming.cs index 81a5c9e29e..a657958050 100644 --- a/Utilities/TileFraming.cs +++ b/Utilities/TileFraming.cs @@ -1,4 +1,7 @@ -using CalamityMod.Tiles.Abyss; +using System; +using System.Collections.Generic; +using System.Linq; +using CalamityMod.Tiles.Abyss; using CalamityMod.Tiles.Abyss.AbyssAmbient; using CalamityMod.Tiles.Astral; using CalamityMod.Tiles.AstralDesert; @@ -9,8 +12,7 @@ using CalamityMod.Tiles.Ores; using CalamityMod.Tiles.SunkenSea; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System.Collections.Generic; -using System.Linq; +using ReLogic.Content; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -21,12 +23,42 @@ namespace CalamityMod // OnModLoad is guaranteed to be run after all content has autoloaded. public static class TileFraming { + public sealed class MergeFrameData + { + public byte[,] AdjacencyData { get; } + + public int TileID { get; } + + public int FrameOffsetX { get; } + + public int FrameOffsetY { get; } + + public Asset BlendSheet { get; } + + public MergeFrameData(byte[,] adjacencyData, int tileId, string blendSheetPath, int frameOffsetX = 0, int frameOffsetY = 0) + { + AdjacencyData = adjacencyData; + TileID = tileId; + FrameOffsetX = frameOffsetX; + FrameOffsetY = frameOffsetY; + + if (!cachedBlendSheets.TryGetValue(blendSheetPath, out var blendSheet)) + { + blendSheet = cachedBlendSheets[blendSheetPath] = ModContent.Request(blendSheetPath); + } + + BlendSheet = blendSheet; + } + } + private static int[][] PlantCheckAgainst; private static Dictionary VineToGrass; // CONSIDER -- This is a triangle array, but does it need to be? Main.tileMerge is a triangle array as well public static bool[][] tileMergeTypes; + private static Dictionary> cachedBlendSheets = new(); + #region Similarity Enum private enum Similarity { @@ -302,7 +334,7 @@ namespace CalamityMod return; } } - + // If the tile above is an identical vine, nothing else needs to be done. if (northType == myType) return; @@ -1195,7 +1227,7 @@ namespace CalamityMod #endregion } - internal static void SlopedGlowmask(int i, int j, int type, Texture2D texture, Vector2 position, Rectangle? sourceRectangle, Color drawColor, Vector2 positionOffset, bool overrideTileFrame = false) + internal static void SlopedGlowmask(int i, int j, int type, Texture2D texture, Vector2 position, Rectangle? sourceRectangle, Color drawColor, Vector2 positionOffset, bool overrideTileFrame = false) { Tile tile = Main.tile[i, j]; @@ -1897,7 +1929,7 @@ namespace CalamityMod TileID.Sets.ChecksForMerge[myType] = true; // Properly frame the adjacent tile given this constraint. - CustomMergeFrameExplicit(x + 1, y, east.TileType, myType, out _, out forceSameRight , out _, out _, false, false, false, false, false); + CustomMergeFrameExplicit(x + 1, y, east.TileType, myType, out _, out forceSameRight, out _, out _, false, false, false, false, false); } if (south != null && south.HasTile && tileMergeTypes[myType][south.TileType]) { @@ -1927,23 +1959,37 @@ namespace CalamityMod /// /// Call this in SetStaticDefaults. Used to set up the adjacency data array with the correct dimensions. /// - internal static void SetUpUniversalMerge(int myType, int mergeType, out byte[,] adjacencyData) + internal static void SetUpUniversalMerge(int myType, int mergeType, string blendSheetPath, out MergeFrameData adjacencyData) { CalamityUtils.SetMerge(myType, mergeType, true); - adjacencyData = new byte[Main.tile.Width, Main.tile.Height]; + adjacencyData = new MergeFrameData(new byte[Main.tile.Width, Main.tile.Height], mergeType, blendSheetPath); } /// /// Call this in PostDraw. Uses adjacency data generated by GetAdjacencyData to draw the correct blend state over a given tile, regardless of what tile frame that tile is using /// - internal static void DrawUniversalMergeFrames(int x, int y, byte[,] adjacencyData, string blendSheetPath, int frameOffsetX = 0, int frameOffsetY = 0) + internal static void DrawUniversalMergeFrames(int x, int y, List mergeFrames) { - // 02OCT2023: MishiroUsui: The below code resulted in 30 fps drops in sulph sea, and general performance issues across the board in cal biomes - // DO NOT RE-ENABLE UNTIL THE ISSUE IS RESOLVED AND VERIFIED. - return; - #pragma warning disable CS0162 // Disable unreachable code errors while this code is disabled - - Texture2D blendLayer = ModContent.Request(blendSheetPath).Value; + Color shadingColour = Lighting.GetColor(x, y); + Tile myTile = Main.tile[x, y]; + + foreach (var frame in mergeFrames) + { + // If it hasn't yet been initialized somehow... for some reason. + if (frame is null) + continue; + + DrawUniversalMergeFrames(x, y, frame, shadingColour, myTile); + } + } + + internal static void DrawUniversalMergeFrames(int x, int y, MergeFrameData mergeFrameData, Color shadingColour, Tile myTile) + { + byte[,] adjacencyData = mergeFrameData.AdjacencyData; + var blendLayer = mergeFrameData.BlendSheet.Value; + int frameOffsetX = mergeFrameData.FrameOffsetX; + int frameOffsetY = mergeFrameData.FrameOffsetY; + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(x * 16 - Main.screenPosition.X, y * 16 - Main.screenPosition.Y) + zero; @@ -1951,10 +1997,6 @@ namespace CalamityMod int subFrameX = frameOffsetX * 270; int subFrameY = frameOffsetY * 198; - Color shadingColour = Lighting.GetColor(x, y); - - Tile myTile = Main.tile[x, y]; - byte thisTileData = adjacencyData[x, y]; // Get tile variant number @@ -2301,19 +2343,21 @@ namespace CalamityMod Main.spriteBatch.Draw(blendLayer, drawOffset, new Rectangle?(new Rectangle(18 + randomFrameX36 + subFrameX, 54 + subFrameY, 18, 18)), shadingColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } #endregion - #pragma warning restore CS0162 // Disable unreachable code errors while this code is disabled } /// /// Call this in TileFrame. Used to generate adjacency data used in DrawUniversalMergeFrames. Tiles using this need a 2d byte array /// - internal static void GetAdjacencyData(int x, int y, int blendType, out byte adjacencyData) + internal static void GetAdjacencyData(int x, int y, MergeFrameData data) { + int blendType = data.TileID; + // bit to relative tile pos for reference // 4 0 5 // 3 X 1 // 7 2 6 // 01234567 + ref byte adjacencyData = ref data.AdjacencyData[x, y]; adjacencyData = 0b00000000; if (x < 0 || x >= Main.maxTilesX) diff --git a/Utilities/TileUtils.cs b/Utilities/TileUtils.cs index 981e12cdeb..5b6b1e6d5b 100644 --- a/Utilities/TileUtils.cs +++ b/Utilities/TileUtils.cs @@ -1,4 +1,7 @@ -using CalamityMod.Tiles; +using System; +using System.Collections.Generic; +using System.Linq; +using CalamityMod.Tiles; using CalamityMod.Tiles.Abyss; using CalamityMod.Tiles.Astral; using CalamityMod.Tiles.AstralDesert; @@ -14,14 +17,11 @@ using CalamityMod.Tiles.Ores; using CalamityMod.Tiles.SunkenSea; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; using static Terraria.ModLoader.ModContent; -using System.Linq; -using System.Collections.Generic; namespace CalamityMod { @@ -150,7 +150,7 @@ namespace CalamityMod if (Main.rand.NextBool(rarity)) { int dust = Dust.NewDust(new Vector2(i * 16 + 4, j * 16 + 2), 4, 4, dustType, 0f, 0f, 100, default, 1f); - if (Main.rand.Next(3) != 0) + if (!Main.rand.NextBool(3)) Main.dust[dust].noGravity = true; // Prevent lag. diff --git a/Utilities/WorldgenUtils.cs b/Utilities/WorldgenUtils.cs index ae909a55d1..1c18796fbb 100644 --- a/Utilities/WorldgenUtils.cs +++ b/Utilities/WorldgenUtils.cs @@ -52,7 +52,7 @@ namespace CalamityMod { finished = true; } - + if (numVines <= 1) { finished = true; @@ -85,7 +85,7 @@ namespace CalamityMod double liquidDifferencePercentage = (maxLiquid - Liquid.numLiquid - LiquidBuffer.numLiquidBuffer) / (double)maxLiquid; if (Liquid.numLiquid + LiquidBuffer.numLiquidBuffer > maxLiquid) maxLiquid = Liquid.numLiquid + LiquidBuffer.numLiquidBuffer; - + if (liquidDifferencePercentage > maxLiquidDifferencePercentage) maxLiquidDifferencePercentage = liquidDifferencePercentage; @@ -215,7 +215,7 @@ namespace CalamityMod { continue; } - + ChangeTile(Main.tile[i, j]); } } diff --git a/Walls/AbyssGravelWallSafe.cs b/Walls/AbyssGravelWallSafe.cs index defd4b33b0..10228dad73 100644 --- a/Walls/AbyssGravelWallSafe.cs +++ b/Walls/AbyssGravelWallSafe.cs @@ -1,6 +1,6 @@ -using Terraria; +using Microsoft.Xna.Framework; +using Terraria; using Terraria.ModLoader; -using Microsoft.Xna.Framework; namespace CalamityMod.Walls { diff --git a/Walls/AcidwoodWall.cs b/Walls/AcidwoodWall.cs index ea74fc51a8..9940651a5e 100644 --- a/Walls/AcidwoodWall.cs +++ b/Walls/AcidwoodWall.cs @@ -1,8 +1,8 @@ -using Microsoft.Xna.Framework; -using Terraria.ModLoader; -using CalamityMod.Items.Placeables.Walls; +using CalamityMod.Items.Placeables.Walls; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Walls { @@ -19,7 +19,7 @@ namespace CalamityMod.Walls public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 7, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.WoodFurniture, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } } diff --git a/Walls/AerialiteBrickWall.cs b/Walls/AerialiteBrickWall.cs index ccc05c0621..0636379b20 100644 --- a/Walls/AerialiteBrickWall.cs +++ b/Walls/AerialiteBrickWall.cs @@ -1,5 +1,6 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Walls @@ -14,8 +15,8 @@ namespace CalamityMod.Walls 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(119, 102, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 10, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(119, 102, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Gold, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Walls/AshenSlabWall.cs b/Walls/AshenSlabWall.cs index 7532af85e9..aa4d569161 100644 --- a/Walls/AshenSlabWall.cs +++ b/Walls/AshenSlabWall.cs @@ -1,6 +1,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Walls @@ -15,8 +16,8 @@ namespace CalamityMod.Walls public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 100, 100), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.RedTorch, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 100, 100), 1f); return false; } diff --git a/Walls/AstralBrickWall.cs b/Walls/AstralBrickWall.cs index f352f6aaee..ce9d9bb490 100644 --- a/Walls/AstralBrickWall.cs +++ b/Walls/AstralBrickWall.cs @@ -1,4 +1,4 @@ -using CalamityMod.Dusts; +using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; diff --git a/Walls/AstralGrassWall.cs b/Walls/AstralGrassWall.cs index 4d06218b19..07d8da7393 100644 --- a/Walls/AstralGrassWall.cs +++ b/Walls/AstralGrassWall.cs @@ -1,7 +1,7 @@  +using System; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Walls/AstralIceWallSafe.cs b/Walls/AstralIceWallSafe.cs index 606e9340e4..7edf50c851 100644 --- a/Walls/AstralIceWallSafe.cs +++ b/Walls/AstralIceWallSafe.cs @@ -1,5 +1,5 @@ -using Terraria; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Walls diff --git a/Walls/AstralSandstoneWallSafe.cs b/Walls/AstralSandstoneWallSafe.cs index 4b3f41087d..6c099909dc 100644 --- a/Walls/AstralSandstoneWallSafe.cs +++ b/Walls/AstralSandstoneWallSafe.cs @@ -1,5 +1,5 @@ -using Terraria; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Walls diff --git a/Walls/AstralSnowWallSafe.cs b/Walls/AstralSnowWallSafe.cs index b00600023b..5089358e68 100644 --- a/Walls/AstralSnowWallSafe.cs +++ b/Walls/AstralSnowWallSafe.cs @@ -1,5 +1,5 @@ -using Terraria; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Walls { diff --git a/Walls/AstralStoneWallSafe.cs b/Walls/AstralStoneWallSafe.cs index cf1a77573c..e4a849832d 100644 --- a/Walls/AstralStoneWallSafe.cs +++ b/Walls/AstralStoneWallSafe.cs @@ -1,5 +1,5 @@ -using Terraria; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Walls diff --git a/Walls/BrimstoneSlabWall.cs b/Walls/BrimstoneSlabWall.cs index 986b497836..169c77f725 100644 --- a/Walls/BrimstoneSlabWall.cs +++ b/Walls/BrimstoneSlabWall.cs @@ -1,6 +1,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Walls @@ -15,15 +16,15 @@ namespace CalamityMod.Walls public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 100, 100), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.RedTorch, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 100, 100), 1f); return false; } public override bool CanExplode(int i, int j) - { - return false; - } + { + return false; + } public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; diff --git a/Walls/BrimstoneSlagWall.cs b/Walls/BrimstoneSlagWall.cs index a753eea559..9c899dffdd 100644 --- a/Walls/BrimstoneSlagWall.cs +++ b/Walls/BrimstoneSlagWall.cs @@ -1,6 +1,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Walls @@ -15,8 +16,8 @@ namespace CalamityMod.Walls public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 100, 100), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.RedTorch, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 100, 100), 1f); return false; } diff --git a/Walls/BrimstoneSlagWallUnsafe.cs b/Walls/BrimstoneSlagWallUnsafe.cs index 6d4b2b3bef..7c8d98a4d7 100644 --- a/Walls/BrimstoneSlagWallUnsafe.cs +++ b/Walls/BrimstoneSlagWallUnsafe.cs @@ -1,6 +1,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Walls @@ -14,8 +15,8 @@ namespace CalamityMod.Walls public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 100, 100), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.RedTorch, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 100, 100), 1f); return false; } diff --git a/Walls/CelestialRemainsWall.cs b/Walls/CelestialRemainsWall.cs index 9148806dce..5bd36d265c 100644 --- a/Walls/CelestialRemainsWall.cs +++ b/Walls/CelestialRemainsWall.cs @@ -1,5 +1,5 @@ -using Terraria; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Walls diff --git a/Walls/CinderplateWall.cs b/Walls/CinderplateWall.cs index 00472fb3a4..58d2a9fe37 100644 --- a/Walls/CinderplateWall.cs +++ b/Walls/CinderplateWall.cs @@ -1,5 +1,6 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Walls @@ -15,8 +16,8 @@ namespace CalamityMod.Walls public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 100, 100), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.RedTorch, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 100, 100), 1f); return false; } diff --git a/Walls/CosmiliteBrickWall.cs b/Walls/CosmiliteBrickWall.cs index d5f1551dc7..23da377979 100644 --- a/Walls/CosmiliteBrickWall.cs +++ b/Walls/CosmiliteBrickWall.cs @@ -1,5 +1,6 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Walls @@ -15,8 +16,8 @@ namespace CalamityMod.Walls public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 132, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 134, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Firework_Blue, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Firework_Pink, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Walls/CryonicBrickWall.cs b/Walls/CryonicBrickWall.cs index 72dcb01ee6..41d0bceb49 100644 --- a/Walls/CryonicBrickWall.cs +++ b/Walls/CryonicBrickWall.cs @@ -1,6 +1,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Walls @@ -16,7 +17,7 @@ namespace CalamityMod.Walls public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 176, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.BubbleBurst_Blue, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Walls/DraedonStructures/HazardChevronWall.cs b/Walls/DraedonStructures/HazardChevronWall.cs index 30556c4fec..5e9c66d175 100644 --- a/Walls/DraedonStructures/HazardChevronWall.cs +++ b/Walls/DraedonStructures/HazardChevronWall.cs @@ -1,5 +1,5 @@ -using Terraria; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Walls.DraedonStructures { diff --git a/Walls/DraedonStructures/LaboratoryPanelWall.cs b/Walls/DraedonStructures/LaboratoryPanelWall.cs index 562bb439ed..53c7ce89b0 100644 --- a/Walls/DraedonStructures/LaboratoryPanelWall.cs +++ b/Walls/DraedonStructures/LaboratoryPanelWall.cs @@ -1,5 +1,5 @@ -using Terraria; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Walls.DraedonStructures { diff --git a/Walls/DraedonStructures/LaboratoryPlateBeam.cs b/Walls/DraedonStructures/LaboratoryPlateBeam.cs index 03a2743ac9..6b875643c2 100644 --- a/Walls/DraedonStructures/LaboratoryPlateBeam.cs +++ b/Walls/DraedonStructures/LaboratoryPlateBeam.cs @@ -1,5 +1,5 @@ -using Terraria; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Walls.DraedonStructures { diff --git a/Walls/DraedonStructures/LaboratoryPlatePillar.cs b/Walls/DraedonStructures/LaboratoryPlatePillar.cs index 3fc71af308..f86b52507f 100644 --- a/Walls/DraedonStructures/LaboratoryPlatePillar.cs +++ b/Walls/DraedonStructures/LaboratoryPlatePillar.cs @@ -1,5 +1,5 @@ -using Terraria; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Walls.DraedonStructures { diff --git a/Walls/DraedonStructures/LaboratoryPlatingWall.cs b/Walls/DraedonStructures/LaboratoryPlatingWall.cs index fe06d50234..633e39b345 100644 --- a/Walls/DraedonStructures/LaboratoryPlatingWall.cs +++ b/Walls/DraedonStructures/LaboratoryPlatingWall.cs @@ -1,5 +1,5 @@ -using Terraria; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Walls.DraedonStructures { diff --git a/Walls/DraedonStructures/RustedPlatingWall.cs b/Walls/DraedonStructures/RustedPlatingWall.cs index 46ba7410f3..4d2bb282d8 100644 --- a/Walls/DraedonStructures/RustedPlatingWall.cs +++ b/Walls/DraedonStructures/RustedPlatingWall.cs @@ -1,5 +1,5 @@ -using Terraria; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Walls.DraedonStructures { diff --git a/Walls/ElumplateWall.cs b/Walls/ElumplateWall.cs index 50ab4e337d..0bffac8a8e 100644 --- a/Walls/ElumplateWall.cs +++ b/Walls/ElumplateWall.cs @@ -1,5 +1,6 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Walls @@ -15,8 +16,8 @@ namespace CalamityMod.Walls public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 100, 100), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.RedTorch, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 100, 100), 1f); return false; } diff --git a/Walls/ExoPlatingWall.cs b/Walls/ExoPlatingWall.cs index fbf1403c1e..106cfd2689 100644 --- a/Walls/ExoPlatingWall.cs +++ b/Walls/ExoPlatingWall.cs @@ -1,6 +1,7 @@ -using CalamityMod.Items.Placeables.Walls; +using CalamityMod.Items.Placeables.Walls; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Walls @@ -15,7 +16,7 @@ namespace CalamityMod.Walls public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 107, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.TerraBlade, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Walls/ExoPrismPanelWall.cs b/Walls/ExoPrismPanelWall.cs index 0188d51b9e..fe15711a5e 100644 --- a/Walls/ExoPrismPanelWall.cs +++ b/Walls/ExoPrismPanelWall.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.GameContent; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Walls @@ -17,7 +18,7 @@ namespace CalamityMod.Walls public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 107, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.TerraBlade, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Walls/FloralWall.cs b/Walls/FloralWall.cs index 1385ce979b..b015ce17d2 100644 --- a/Walls/FloralWall.cs +++ b/Walls/FloralWall.cs @@ -1,6 +1,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Walls @@ -16,8 +17,8 @@ namespace CalamityMod.Walls public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 128, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Chlorophyte, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.RedTorch, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Walls/HardenedAstralSandWallSafe.cs b/Walls/HardenedAstralSandWallSafe.cs index a03e34a5d0..9698fd7664 100644 --- a/Walls/HardenedAstralSandWallSafe.cs +++ b/Walls/HardenedAstralSandWallSafe.cs @@ -1,5 +1,5 @@ -using Terraria; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Walls diff --git a/Walls/HavocplateWall.cs b/Walls/HavocplateWall.cs index ef5951b68a..f118a9319f 100644 --- a/Walls/HavocplateWall.cs +++ b/Walls/HavocplateWall.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Walls @@ -16,8 +17,8 @@ namespace CalamityMod.Walls public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 100, 100), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.RedTorch, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 100, 100), 1f); return false; } diff --git a/Walls/IVisibleThroughWater.cs b/Walls/IVisibleThroughWater.cs new file mode 100644 index 0000000000..189038f712 --- /dev/null +++ b/Walls/IVisibleThroughWater.cs @@ -0,0 +1,59 @@ +using System; +using System.Diagnostics; +using Microsoft.Xna.Framework; +using Terraria.Localization; +using Terraria.Map; +using Terraria.ModLoader; + +namespace CalamityMod.Walls +{ + /// + /// Walls that implement this interface may be revealed on the map through + /// water. This allows them to show on the map despite always being + /// submerged. + /// + public interface IVisibleThroughWater : ILoadable + { + int WaterMapEntry { get; set; } + } + + internal static class VisibleThroughWater + { + private sealed class VisibleThroughWaterSystem : ModSystem + { + public override void AddRecipes() + { + InitializeWaterMapEntryLookups(); + } + } + + public const float WaterTransparency = 0.5f; + public static readonly Color WaterColor = new Color(9, 61, 191); + + public static void AddMapEntryWithWaterVisibility(this IVisibleThroughWater visibleThroughWater, Color baseColor, LocalizedText text = null) + { + AssertIsWall(visibleThroughWater, out var wall); + wall.AddMapEntry(baseColor, text); + wall.AddMapEntry(Color.Lerp(baseColor, WaterColor, WaterTransparency), text); + } + + public static void InitializeWaterMapEntryLookups() + { + foreach (var visibleThroughWater in CalamityMod.Instance.GetContent()) + { + AssertIsWall(visibleThroughWater, out var wall); + visibleThroughWater.WaterMapEntry = MapHelper.wallLookup[wall.Type] + 1; + } + } + + [DebuggerStepThrough] + [StackTraceHidden] + private static void AssertIsWall(IVisibleThroughWater visibleThroughWater, out ModWall wall) + { + if (visibleThroughWater is not ModWall theWall) + throw new InvalidCastException($"{nameof(IVisibleThroughWater)} is implemented on type {visibleThroughWater.GetType().FullName}; said type should inherit from {nameof(ModWall)}"); + + wall = theWall; + } + } +} diff --git a/Walls/NavyplateWall.cs b/Walls/NavyplateWall.cs index de1a632e1c..00d87b3b8e 100644 --- a/Walls/NavyplateWall.cs +++ b/Walls/NavyplateWall.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Walls @@ -15,8 +16,8 @@ namespace CalamityMod.Walls public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 100, 100), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.RedTorch, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 100, 100), 1f); return false; } diff --git a/Walls/NavystoneWall.cs b/Walls/NavystoneWall.cs index 80c3b49708..500df762c1 100644 --- a/Walls/NavystoneWall.cs +++ b/Walls/NavystoneWall.cs @@ -2,12 +2,14 @@ using Terraria.ModLoader; namespace CalamityMod.Walls { - public class NavystoneWall : ModWall + public class NavystoneWall : ModWall, IVisibleThroughWater { + int IVisibleThroughWater.WaterMapEntry { get; set; } + public override void SetStaticDefaults() { DustType = 96; - AddMapEntry(new Color(16, 45, 48)); + this.AddMapEntryWithWaterVisibility(new Color(16, 45, 48)); } public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; diff --git a/Walls/NavystoneWallSafe.cs b/Walls/NavystoneWallSafe.cs index 4690d5bddf..ef276c3a45 100644 --- a/Walls/NavystoneWallSafe.cs +++ b/Walls/NavystoneWallSafe.cs @@ -4,13 +4,15 @@ using Terraria.ModLoader; namespace CalamityMod.Walls { - public class NavystoneWallSafe : ModWall + public class NavystoneWallSafe : ModWall, IVisibleThroughWater { + int IVisibleThroughWater.WaterMapEntry { get; set; } + public override void SetStaticDefaults() { Main.wallHouse[Type] = true; DustType = 96; - AddMapEntry(new Color(0, 50, 50)); + this.AddMapEntryWithWaterVisibility(new Color(0, 50, 50)); } public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; diff --git a/Walls/OccultBrickWall.cs b/Walls/OccultBrickWall.cs index 1610c43455..a4820ddb85 100644 --- a/Walls/OccultBrickWall.cs +++ b/Walls/OccultBrickWall.cs @@ -1,8 +1,8 @@ -using Microsoft.Xna.Framework; -using Terraria.ModLoader; -using CalamityMod.Items.Placeables.Walls; +using CalamityMod.Items.Placeables.Walls; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Walls { @@ -19,7 +19,7 @@ namespace CalamityMod.Walls public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 7, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.WoodFurniture, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } } diff --git a/Walls/OnyxplateWall.cs b/Walls/OnyxplateWall.cs index 02d9a0d59c..4003a806f1 100644 --- a/Walls/OnyxplateWall.cs +++ b/Walls/OnyxplateWall.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Walls @@ -15,8 +16,8 @@ namespace CalamityMod.Walls public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 100, 100), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.RedTorch, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 100, 100), 1f); return false; } diff --git a/Walls/OtherworldlyStoneWall.cs b/Walls/OtherworldlyStoneWall.cs index 4e19722116..8f29814eb8 100644 --- a/Walls/OtherworldlyStoneWall.cs +++ b/Walls/OtherworldlyStoneWall.cs @@ -1,5 +1,6 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Walls @@ -17,7 +18,7 @@ namespace CalamityMod.Walls 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(125, 94, 128), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(125, 94, 128), 1f); return false; } } diff --git a/Walls/PerennialBrickWall.cs b/Walls/PerennialBrickWall.cs index e56cd9c3e8..813183c73c 100644 --- a/Walls/PerennialBrickWall.cs +++ b/Walls/PerennialBrickWall.cs @@ -1,6 +1,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Walls @@ -16,8 +17,8 @@ namespace CalamityMod.Walls public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 128, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Chlorophyte, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.RedTorch, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Walls/PlagueContainmentCellsWall.cs b/Walls/PlagueContainmentCellsWall.cs index 2e3c5be3cb..cfe07b970a 100644 --- a/Walls/PlagueContainmentCellsWall.cs +++ b/Walls/PlagueContainmentCellsWall.cs @@ -1,5 +1,6 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Walls @@ -15,8 +16,8 @@ namespace CalamityMod.Walls public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 100, 100), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.RedTorch, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 100, 100), 1f); return false; } diff --git a/Walls/PlaguedPlateWall.cs b/Walls/PlaguedPlateWall.cs index a476eab013..3f54d45122 100644 --- a/Walls/PlaguedPlateWall.cs +++ b/Walls/PlaguedPlateWall.cs @@ -1,5 +1,6 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Walls @@ -17,7 +18,7 @@ namespace CalamityMod.Walls public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 178, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.BubbleBurst_Green, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } } diff --git a/Walls/ProfanedCrystalWall.cs b/Walls/ProfanedCrystalWall.cs index 015456d632..ae43b7ef0a 100644 --- a/Walls/ProfanedCrystalWall.cs +++ b/Walls/ProfanedCrystalWall.cs @@ -1,7 +1,7 @@ using Microsoft.Xna.Framework; using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Walls { @@ -18,7 +18,7 @@ namespace CalamityMod.Walls public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 205, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.VenomStaff, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Walls/ProfanedRockWall.cs b/Walls/ProfanedRockWall.cs index a422e62589..e3121e17c4 100644 --- a/Walls/ProfanedRockWall.cs +++ b/Walls/ProfanedRockWall.cs @@ -1,6 +1,7 @@ using CalamityMod.Dusts.Furniture; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Walls @@ -16,7 +17,7 @@ namespace CalamityMod.Walls public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 246, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.GoldCoin, 0f, 0f, 1, new Color(255, 255, 255), 1f); Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, ModContent.DustType(), 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Walls/RunicProfanedBrickWall.cs b/Walls/RunicProfanedBrickWall.cs index c9c89202ee..61199ab06f 100644 --- a/Walls/RunicProfanedBrickWall.cs +++ b/Walls/RunicProfanedBrickWall.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Walls @@ -17,7 +18,7 @@ namespace CalamityMod.Walls public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 205, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.VenomStaff, 0f, 0f, 1, new Color(255, 255, 255), 1f); Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, ModContent.DustType(), 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Walls/SilvaWall.cs b/Walls/SilvaWall.cs index 45fb506e74..30227e4b52 100644 --- a/Walls/SilvaWall.cs +++ b/Walls/SilvaWall.cs @@ -1,6 +1,7 @@ using CalamityMod.Dusts.Furniture; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Walls @@ -17,7 +18,7 @@ namespace CalamityMod.Walls public override bool CreateDust(int i, int j, ref int type) { Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, ModContent.DustType(), 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 157, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.ChlorophyteWeapon, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Walls/SmoothAbyssGravelWall.cs b/Walls/SmoothAbyssGravelWall.cs index 2224c41707..dc05aef85a 100644 --- a/Walls/SmoothAbyssGravelWall.cs +++ b/Walls/SmoothAbyssGravelWall.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Walls @@ -15,7 +16,7 @@ namespace CalamityMod.Walls 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, 130, 150), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 130, 150), 1f); return false; } diff --git a/Walls/SmoothBrimstoneSlagWall.cs b/Walls/SmoothBrimstoneSlagWall.cs index e52db596d9..c847a1c664 100644 --- a/Walls/SmoothBrimstoneSlagWall.cs +++ b/Walls/SmoothBrimstoneSlagWall.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Walls @@ -15,8 +16,8 @@ namespace CalamityMod.Walls public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 100, 100), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.RedTorch, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 100, 100), 1f); return false; } diff --git a/Walls/SmoothNavystoneWall.cs b/Walls/SmoothNavystoneWall.cs index 9b16bf201c..09dcbd2e6d 100644 --- a/Walls/SmoothNavystoneWall.cs +++ b/Walls/SmoothNavystoneWall.cs @@ -1,21 +1,24 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Walls { - public class SmoothNavystoneWall : ModWall + public class SmoothNavystoneWall : ModWall, IVisibleThroughWater { + int IVisibleThroughWater.WaterMapEntry { get; set; } + public override void SetStaticDefaults() { Main.wallHouse[Type] = true; - AddMapEntry(new Color(27, 35, 36)); + this.AddMapEntryWithWaterVisibility(new Color(27, 35, 36)); } public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 51, 0f, 0f, 1, new Color(54, 69, 72), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.SnowBlock, 0f, 0f, 1, new Color(54, 69, 72), 1f); return false; } diff --git a/Walls/SmoothVoidstoneWall.cs b/Walls/SmoothVoidstoneWall.cs index 9fddd19649..5880f2dcb0 100644 --- a/Walls/SmoothVoidstoneWall.cs +++ b/Walls/SmoothVoidstoneWall.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Walls @@ -15,7 +16,7 @@ namespace CalamityMod.Walls public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 180, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.DungeonSpirit, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Walls/StatigelWall.cs b/Walls/StatigelWall.cs index 641af15f5b..9a85c157f9 100644 --- a/Walls/StatigelWall.cs +++ b/Walls/StatigelWall.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Walls @@ -15,7 +16,7 @@ namespace CalamityMod.Walls public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 243, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.PinkSlime, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Walls/StratusWall.cs b/Walls/StratusWall.cs index 3968b0af44..bb960f71fa 100644 --- a/Walls/StratusWall.cs +++ b/Walls/StratusWall.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Walls @@ -15,8 +16,8 @@ namespace CalamityMod.Walls 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, 130, 150), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 132, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 130, 150), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Firework_Blue, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Walls/SulphurousSandWall.png b/Walls/SulphurousSandWall.png index 8f7a554dc5..e8e9ea87e6 100644 Binary files a/Walls/SulphurousSandWall.png and b/Walls/SulphurousSandWall.png differ diff --git a/Walls/SulphurousSandWallSafe.png b/Walls/SulphurousSandWallSafe.png index 8f7a554dc5..e8e9ea87e6 100644 Binary files a/Walls/SulphurousSandWallSafe.png and b/Walls/SulphurousSandWallSafe.png differ diff --git a/Walls/UelibloomBrickWall.cs b/Walls/UelibloomBrickWall.cs index 73d5bb2d04..92248c856c 100644 --- a/Walls/UelibloomBrickWall.cs +++ b/Walls/UelibloomBrickWall.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Walls @@ -15,8 +16,8 @@ namespace CalamityMod.Walls public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 39, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 10, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.JungleGrass, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Gold, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Walls/VoidstoneSlabWall.cs b/Walls/VoidstoneSlabWall.cs index 4e03129c8b..096d2e209a 100644 --- a/Walls/VoidstoneSlabWall.cs +++ b/Walls/VoidstoneSlabWall.cs @@ -1,6 +1,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Walls @@ -16,7 +17,7 @@ namespace CalamityMod.Walls public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 180, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.DungeonSpirit, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Walls/VoidstoneWall.cs b/Walls/VoidstoneWall.cs index 21170ca508..f4881eb777 100644 --- a/Walls/VoidstoneWall.cs +++ b/Walls/VoidstoneWall.cs @@ -1,10 +1,11 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using Terraria.GameContent; -using Terraria; -using Terraria.ModLoader; using ReLogic.Content; +using Terraria; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Walls { @@ -22,7 +23,7 @@ namespace CalamityMod.Walls public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 180, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.DungeonSpirit, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } diff --git a/Walls/VoidstoneWallUnsafe.cs b/Walls/VoidstoneWallUnsafe.cs index a633899346..5f7348b9ee 100644 --- a/Walls/VoidstoneWallUnsafe.cs +++ b/Walls/VoidstoneWallUnsafe.cs @@ -2,8 +2,8 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; -using Terraria.GameContent; using Terraria; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; diff --git a/Walls/WulfrumPlatingWall.cs b/Walls/WulfrumPlatingWall.cs new file mode 100644 index 0000000000..39fcfcc9cd --- /dev/null +++ b/Walls/WulfrumPlatingWall.cs @@ -0,0 +1,78 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Walls +{ + public class WulfrumPlatingWall : ModWall + { + public override void SetStaticDefaults() + { + Main.wallHouse[Type] = true; + AddMapEntry(new Color(83, 92, 62)); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.TerraBlade, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; + + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) + { + Texture2D sprite = TextureAssets.Wall[Type].Value; + Color lightColor = GetWallColour(i, j); + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + zero -= new Vector2(8, 8); + Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; + int[] sheetOffset = CreatePattern(i, j); + spriteBatch.Draw + ( + sprite, + drawOffset, + new Rectangle(sheetOffset[0] + Main.tile[i, j].WallFrameX, sheetOffset[1] + Main.tile[i, j].WallFrameY, 32, 32), + lightColor, + 0, + new Vector2(0f, 0f), + 1, + SpriteEffects.None, + 0f + ); + return false; + } + + private int[] CreatePattern(int i, int j) + { + int[] sheetOffset = new int[2] { i % 2, j % 2 }; + sheetOffset[0] = sheetOffset[0] * 468; + sheetOffset[1] = sheetOffset[1] * 180; + return sheetOffset; + } + + private Color GetWallColour(int i, int j) + { + int colType = Main.tile[i, j].WallColor; + Color paintCol = WorldGen.paintColor(colType); + if (colType < 13) + { + paintCol.R = (byte)((paintCol.R / 2f) + 128); + paintCol.G = (byte)((paintCol.G / 2f) + 128); + paintCol.B = (byte)((paintCol.B / 2f) + 128); + } + if (colType == 29) + { + paintCol = Color.Black; + } + Color col = Lighting.GetColor(i, j); + col.R = (byte)(paintCol.R / 255f * col.R); + col.G = (byte)(paintCol.G / 255f * col.G); + col.B = (byte)(paintCol.B / 255f * col.B); + return col; + } + } +} diff --git a/Walls/WulfrumPlatingWall.png b/Walls/WulfrumPlatingWall.png new file mode 100644 index 0000000000..fb98b5631b Binary files /dev/null and b/Walls/WulfrumPlatingWall.png differ diff --git a/Waters/AstralWater.cs b/Waters/AstralWater.cs index 4f421f11d0..7064c4fadf 100644 --- a/Waters/AstralWater.cs +++ b/Waters/AstralWater.cs @@ -1,8 +1,8 @@ -using Terraria; -using Terraria.ModLoader; -using ReLogic.Content; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.ModLoader; namespace CalamityMod.Waters { @@ -12,7 +12,7 @@ namespace CalamityMod.Waters public override int GetSplashDust() => 52; //corruption water? public override int GetDropletGore() => ModContent.Find("CalamityMod/AstralWaterDroplet").Type; public override Asset GetRainTexture() => ModContent.Request("CalamityMod/Waters/AstralRain"); - public override byte GetRainVariant() => (byte)Main.rand.Next(3); + public override byte GetRainVariant() => (byte)Main.rand.Next(3); public override Color BiomeHairColor() => Color.MediumPurple; } } diff --git a/Waters/AstralWaterflow.cs b/Waters/AstralWaterflow.cs index 783f53769c..76e3fc81d6 100644 --- a/Waters/AstralWaterflow.cs +++ b/Waters/AstralWaterflow.cs @@ -1,4 +1,4 @@ -using Terraria.ModLoader; +using Terraria.ModLoader; namespace CalamityMod.Waters { public class AstralWaterflow : ModWaterfallStyle diff --git a/Waters/CragsLavaStyle.cs b/Waters/CragsLavaStyle.cs index 86c150e699..6ffe68bed0 100644 --- a/Waters/CragsLavaStyle.cs +++ b/Waters/CragsLavaStyle.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Waters public override string SlopeTexturePath => LavaTexturePath + "_Slope"; - public override bool ChooseLavaStyle() => Main.LocalPlayer.Calamity().ZoneCalamity; + public override bool ChooseLavaStyle() => Main.LocalPlayer.Calamity().ZoneCalamity || Main.LocalPlayer.Calamity().BrimstoneLavaFountainCounter > 0; public override int ChooseWaterfallStyle() => ModContent.Find("CalamityMod/CragsLavaflow").Slot; diff --git a/Waters/CustomLavaManagement.cs b/Waters/CustomLavaManagement.cs index aefe882ece..e4018ddb5d 100644 --- a/Waters/CustomLavaManagement.cs +++ b/Waters/CustomLavaManagement.cs @@ -1,12 +1,13 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using ReLogic.Content; -using System; +using System; using System.Collections.Generic; using System.Linq; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.ModLoader.Core; namespace CalamityMod.Waters { @@ -23,7 +24,8 @@ namespace CalamityMod.Waters { CustomLavaStyles = new List(); - foreach (Type type in typeof(CalamityMod).Assembly.GetTypes()) + Type[] types = AssemblyManager.GetLoadableTypes(CalamityMod.Instance.Code); + foreach (Type type in types) { // Ignore abstract types; they cannot have instances. // Also ignore types which do not derive from CustomLavaStyle. diff --git a/Waters/MiddleAbyssWaterflow.cs b/Waters/MiddleAbyssWaterflow.cs index 6d7deb015d..0105e3024f 100644 --- a/Waters/MiddleAbyssWaterflow.cs +++ b/Waters/MiddleAbyssWaterflow.cs @@ -1,4 +1,4 @@ -using Terraria.ModLoader; +using Terraria.ModLoader; namespace CalamityMod.Waters { public class MiddleAbyssWaterflow : ModWaterfallStyle diff --git a/Waters/PissWaterflow.cs b/Waters/PissWaterflow.cs index df91b07b1b..a5189ea521 100644 --- a/Waters/PissWaterflow.cs +++ b/Waters/PissWaterflow.cs @@ -1,4 +1,4 @@ -using Terraria.ModLoader; +using Terraria.ModLoader; namespace CalamityMod.Waters { public class PissWaterflow : ModWaterfallStyle diff --git a/Waters/SulphuricDepthsWaterflow.cs b/Waters/SulphuricDepthsWaterflow.cs index 0b0e76017e..5cf86274ff 100644 --- a/Waters/SulphuricDepthsWaterflow.cs +++ b/Waters/SulphuricDepthsWaterflow.cs @@ -1,4 +1,4 @@ -using Terraria.ModLoader; +using Terraria.ModLoader; namespace CalamityMod.Waters { public class SulphuricDepthsWaterflow : ModWaterfallStyle diff --git a/Waters/SulphuricWater.cs b/Waters/SulphuricWater.cs index 5ed9e6779d..ef9ce540ea 100644 --- a/Waters/SulphuricWater.cs +++ b/Waters/SulphuricWater.cs @@ -1,8 +1,8 @@ -using Terraria; -using Terraria.ModLoader; -using ReLogic.Content; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.ModLoader; namespace CalamityMod.Waters { @@ -15,9 +15,9 @@ namespace CalamityMod.Waters } public override int ChooseWaterfallStyle() => ModContent.Find("CalamityMod/SulphuricWaterflow").Slot; public override int GetSplashDust() => 101; - public override int GetDropletGore()=> 708; + public override int GetDropletGore() => 708; public override Asset GetRainTexture() => ModContent.Request("CalamityMod/Waters/SulphuricRain"); - public override byte GetRainVariant() => (byte)Main.rand.Next(3); + public override byte GetRainVariant() => (byte)Main.rand.Next(3); public override Color BiomeHairColor() => Color.Turquoise; } } diff --git a/Waters/SulphuricWaterflow.cs b/Waters/SulphuricWaterflow.cs index 8d79e9f58b..f9ed907df3 100644 --- a/Waters/SulphuricWaterflow.cs +++ b/Waters/SulphuricWaterflow.cs @@ -1,4 +1,4 @@ -using Terraria.ModLoader; +using Terraria.ModLoader; namespace CalamityMod.Waters { public class SulphuricWaterflow : ModWaterfallStyle diff --git a/Waters/SunkenSeaWaterflow.cs b/Waters/SunkenSeaWaterflow.cs index 6979811e8e..ae61284b07 100644 --- a/Waters/SunkenSeaWaterflow.cs +++ b/Waters/SunkenSeaWaterflow.cs @@ -1,4 +1,4 @@ -using Terraria.ModLoader; +using Terraria.ModLoader; namespace CalamityMod.Waters { public class SunkenSeaWaterflow : ModWaterfallStyle diff --git a/Waters/UpperAbyssWaterflow.cs b/Waters/UpperAbyssWaterflow.cs index 855d4f319d..e61de17827 100644 --- a/Waters/UpperAbyssWaterflow.cs +++ b/Waters/UpperAbyssWaterflow.cs @@ -1,4 +1,4 @@ -using Terraria.ModLoader; +using Terraria.ModLoader; namespace CalamityMod.Waters { public class UpperAbyssWaterflow : ModWaterfallStyle diff --git a/Waters/VoidWaterflow.cs b/Waters/VoidWaterflow.cs index 3224a16282..bb408bd108 100644 --- a/Waters/VoidWaterflow.cs +++ b/Waters/VoidWaterflow.cs @@ -1,4 +1,4 @@ -using Terraria.ModLoader; +using Terraria.ModLoader; namespace CalamityMod.Waters { public class VoidWaterflow : ModWaterfallStyle diff --git a/World/Abyss.cs b/World/Abyss.cs index a93fc44c13..f70e99299c 100644 --- a/World/Abyss.cs +++ b/World/Abyss.cs @@ -1,4 +1,9 @@ -using CalamityMod.Items.Accessories; +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using CalamityMod.DataStructures; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Pets; using CalamityMod.Items.Tools.ClimateChange; using CalamityMod.Items.Weapons.Magic; @@ -11,19 +16,14 @@ using CalamityMod.Tiles.Abyss.AbyssAmbient; using CalamityMod.Tiles.FurnitureVoid; using CalamityMod.Tiles.Ores; using CalamityMod.Walls; -using CalamityMod.DataStructures; using Microsoft.Xna.Framework; -using System; -using System.Linq; -using System.Collections.Generic; using Terraria; +using Terraria.DataStructures; +using Terraria.GameContent.Generation; using Terraria.ID; using Terraria.IO; using Terraria.ModLoader; -using Terraria.GameContent.Generation; -using Terraria.DataStructures; using Terraria.WorldBuilding; -using System.Diagnostics; namespace CalamityMod.World { @@ -537,8 +537,8 @@ namespace CalamityMod.World Tile tileLeft = Main.tile[abyssIndex - 1, abyssIndex2]; Tile tileRight = Main.tile[abyssIndex + 1, abyssIndex2]; - if (tile.TileType == ModContent.TileType() || tile.TileType == ModContent.TileType() || - tile.TileType == ModContent.TileType() || tile.TileType == ModContent.TileType() || + 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 @@ -569,7 +569,7 @@ namespace CalamityMod.World //ambient tiles and pots for (int abyssIndex = abyssMinX + 5; abyssIndex < abyssMaxX - 5; abyssIndex++) { - for (int abyssIndex2 = 0; abyssIndex2 < (Main.remixWorld ? rockLayer : Main.maxTilesY - 200); abyssIndex2++) + for (int abyssIndex2 = 0; abyssIndex2 < (Main.remixWorld ? rockLayer : Main.UnderworldLayer); abyssIndex2++) { Tile tileToGrowVineOn = Main.tile[abyssIndex, abyssIndex2]; @@ -578,7 +578,7 @@ namespace CalamityMod.World Tile tile = Main.tile[abyssIndex, abyssIndex2 + 1]; //above the 4th layer - if (abyssIndex2 < (Main.remixWorld ? rockLayer : Main.maxTilesY - 200) && WorldGen.SolidTile(abyssIndex, abyssIndex2 + 1)) + if (abyssIndex2 < (Main.remixWorld ? rockLayer : Main.UnderworldLayer) && WorldGen.SolidTile(abyssIndex, abyssIndex2 + 1)) { //sulphur shale stuff if (tile.TileType == ModContent.TileType()) @@ -620,7 +620,7 @@ namespace CalamityMod.World if (WorldGen.genRand.NextBool(12)) { ushort[] Ribs = new ushort[] { (ushort)ModContent.TileType(), - (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(Ribs)); @@ -732,7 +732,7 @@ namespace CalamityMod.World } //pots - if ((tile.TileType == ModContent.TileType() || tile.TileType == ModContent.TileType() || + if ((tile.TileType == ModContent.TileType() || tile.TileType == ModContent.TileType() || tile.TileType == ModContent.TileType()) && abyssIndex2 > (Main.remixWorld ? rockLayer - (int)((y - 200) * 0.8f) : rockLayer)) { if (WorldGen.genRand.NextBool(5)) @@ -743,7 +743,7 @@ namespace CalamityMod.World } //sulphur pots - else if (tile.TileType == ModContent.TileType() && abyssIndex2 < (Main.remixWorld ? Main.maxTilesY - 200 : (int)Main.worldSurface)) + else if (tile.TileType == ModContent.TileType() && abyssIndex2 < (Main.remixWorld ? Main.UnderworldLayer : (int)Main.worldSurface)) { if (WorldGen.genRand.NextBool(3)) { @@ -756,7 +756,7 @@ namespace CalamityMod.World //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 (WorldGen.genRand.Next(2) == 0) + if (WorldGen.genRand.NextBool(2)) { WorldGen.PlaceTile(abyssIndex, abyssIndex2 + 1, (ushort)ModContent.TileType()); } @@ -769,7 +769,7 @@ namespace CalamityMod.World //same as above but for sulphur vines if (tileToGrowVineOn.TileType == ModContent.TileType() && !Main.tile[abyssIndex, abyssIndex2 + 1].HasTile) { - if (WorldGen.genRand.Next(5) == 0) + if (WorldGen.genRand.NextBool(5)) { WorldGen.PlaceTile(abyssIndex, abyssIndex2 + 1, (ushort)ModContent.TileType()); } @@ -931,7 +931,7 @@ namespace CalamityMod.World } } } - + int sizeMinSmall2 = sizeMin2 / 8; int sizeMaxSmall2 = sizeMax2 / 8; islandWidth = WorldGen.genRand.Next(sizeMin2, sizeMax2); @@ -1024,7 +1024,7 @@ namespace CalamityMod.World GenAction blotchMod = new Modifiers.Blotches(2, 0.4); int radius = (int)(WorldGen.genRand.Next(3, 5) * WorldGen.genRand.NextFloat(0.74f, 0.82f)); - + WorldUtils.Gen(new Point(clearX, clearY), new Shapes.Circle(radius), Actions.Chain(new GenAction[] { blotchMod.Output(circle) @@ -1132,7 +1132,7 @@ namespace CalamityMod.World GenAction blotchMod = new Modifiers.Blotches(2, 0.4); int radius = (int)(WorldGen.genRand.Next(3, 5) * WorldGen.genRand.NextFloat(0.74f, 0.82f)); - + WorldUtils.Gen(new Point(clearX, clearY), new Shapes.Circle(radius), Actions.Chain(new GenAction[] { blotchMod.Output(circle) @@ -1184,7 +1184,7 @@ namespace CalamityMod.World } var chestTile = Framing.GetTileSafely(chest.x, chest.y); - if (chestTile.HasTile && chestTile.TileType == ModContent.TileType() && Chest.IsLocked(chest.x, chest.y)) + if (chestTile.HasTile && chestTile.TileType == ModContent.TileType() && Chest.IsLocked(chest.x, chest.y)) { Chest.Unlock(chest.x, chest.y); } diff --git a/World/AerialiteOreGen.cs b/World/AerialiteOreGen.cs index fa45cc4210..497e2d6017 100644 --- a/World/AerialiteOreGen.cs +++ b/World/AerialiteOreGen.cs @@ -1,6 +1,8 @@ using CalamityMod.Tiles.Ores; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; +using Terraria.GameContent.Generation; using Terraria.ID; using Terraria.ModLoader; using Terraria.WorldBuilding; diff --git a/World/AstralBiome.cs b/World/AstralBiome.cs index 68a534ad96..dd83cb6b9d 100644 --- a/World/AstralBiome.cs +++ b/World/AstralBiome.cs @@ -1,4 +1,7 @@ -using CalamityMod.Schematics; +using System; +using System.Collections.Generic; +using System.Linq; +using CalamityMod.Schematics; using CalamityMod.Tiles.Abyss; using CalamityMod.Tiles.Astral; using CalamityMod.Tiles.AstralDesert; @@ -6,9 +9,6 @@ using CalamityMod.Tiles.AstralSnow; using CalamityMod.Tiles.Ores; using CalamityMod.Walls; using Microsoft.Xna.Framework; -using System; -using System.Collections.Generic; -using System.Linq; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -119,7 +119,11 @@ namespace CalamityMod.World "Depthice", }; foreach (string tileName in aaTileNames) - aaTilesToAvoid.Add(ancientsAwakened.Find(tileName).Type); + { + //Defensive coding + if (ancientsAwakened.TryFind(tileName, out ModTile value)) + aaTilesToAvoid.Add(value.Type); + } } while (!meteorDropped) @@ -225,11 +229,23 @@ namespace CalamityMod.World IList MSTilesToAvoid = new List(16); if (magicStorage is not null) { + //yes I added the combined stations and fake altars due to them having tiles (despite no one actually placing em since MS Crafting UI exists) + //also thank fuck MS makes all Storage Units the same tile cuz otherwise the list would be massive + //decrafter may or may not exist by the time I added the new tiles, saw it while snooping around the MS github repo + //Idk what the TE tiles are for and they dont seem to have a tile string[] MSTileNames = new string[] { + "CombinedFurnitureStations1Tile", + "CombinedFurnitureStations2Tile", + "CombinedStations1Tile", + "CombinedStations2Tile", + "CombinedStations3Tile", + "CombinedStations4Tile", "CraftingAccess", "CreativeStorageUnit", + "DecraftingAccess", "EnvironmentAccess", + "EvilAltarTile", "RemoteAccess", "StorageAccess", "StorageComponent", @@ -238,7 +254,11 @@ namespace CalamityMod.World "StorageUnit", }; foreach (string tileName in MSTileNames) - MSTilesToAvoid.Add(magicStorage.Find(tileName).Type); + { + //Defensive coding + if (magicStorage.TryFind(tileName, out ModTile value)) + MSTilesToAvoid.Add(value.Type); + } } UnifiedRandom rand = WorldGen.genRand; @@ -453,9 +473,8 @@ namespace CalamityMod.World y += 5; } - if (Main.tile[x, y].HasTile || Main.tile[x, y].WallType > 0 && (!CalamityUtils.TileActiveAndOfType(x, y, TileID.Torches) || - !CalamityUtils.TileActiveAndOfType(x, y, TileID.Containers) || !CalamityUtils.TileActiveAndOfType(x, y, TileID.Containers2) - || (magicStorage is not null && MSTilesToAvoid.Contains(Main.tile[x, y].TileType)))) //AVOID HOUSES + if (Main.tile[x, y].HasTile || Main.tile[x, y].WallType > 0 && !TileID.Sets.Torch[Main.tile[x, y].TileType] && !TileID.Sets.IsAContainer[Main.tile[x, y].TileType] + && (magicStorage is not null && MSTilesToAvoid.Contains(Main.tile[x, y].TileType))) //AVOID HOUSES { bool place = true; SchematicManager.PlaceSchematic>(SchematicManager.AstralBeaconKey, new Point(x, y - 5), SchematicAnchor.Center, ref place); diff --git a/World/BrimstoneCrag.cs b/World/BrimstoneCrag.cs index e9b63229f4..10573d76b6 100644 --- a/World/BrimstoneCrag.cs +++ b/World/BrimstoneCrag.cs @@ -1,23 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using CalamityMod.Schematics; using CalamityMod.Tiles.Crags; +using CalamityMod.Tiles.Crags.Lily; using CalamityMod.Tiles.Crags.Spike; using CalamityMod.Tiles.Crags.Tree; -using CalamityMod.Tiles.Crags.Lily; using CalamityMod.Tiles.Ores; using CalamityMod.Walls; -using CalamityMod.Schematics; -using static CalamityMod.Schematics.SchematicManager; -using Terraria; -using Terraria.IO; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.DataStructures; -using Terraria.WorldBuilding; -using Terraria.Utilities; -using Terraria.GameContent.Generation; using Microsoft.Xna.Framework; -using System; -using System.Linq; -using System.Collections.Generic; +using Terraria; +using Terraria.DataStructures; +using Terraria.GameContent.Generation; +using Terraria.ID; +using Terraria.IO; +using Terraria.ModLoader; +using Terraria.Utilities; +using Terraria.WorldBuilding; +using static CalamityMod.Schematics.SchematicManager; namespace CalamityMod.World { @@ -43,7 +43,7 @@ namespace CalamityMod.World //clear literally everything in the area the biome will generate in for (int x = biomeStart; x <= biomeEdge; x++) { - for (int y = Main.maxTilesY - 200; y < Main.maxTilesY - 2; y++) + for (int y = Main.UnderworldLayer; y < Main.maxTilesY - 2; y++) { Tile tile = Main.tile[x, y]; tile.ClearEverything(); @@ -72,8 +72,8 @@ namespace CalamityMod.World Tile tileLeft = Main.tile[x - 1, y]; Tile tileRight = Main.tile[x + 1, y]; - if (tile.TileType == ModContent.TileType() && (tileUp.TileType != ModContent.TileType() || - tileDown.TileType != ModContent.TileType() || tileLeft.TileType != ModContent.TileType() || + if (tile.TileType == ModContent.TileType() && (tileUp.TileType != ModContent.TileType() || + tileDown.TileType != ModContent.TileType() || tileLeft.TileType != ModContent.TileType() || tileRight.TileType != ModContent.TileType())) { ShapeData circle = new ShapeData(); @@ -96,9 +96,9 @@ namespace CalamityMod.World //place ceiling of slag across the top of the biome for (int x = biomeStart; x <= biomeEdge; x++) { - for (int y = Main.maxTilesY - 200; y <= Main.maxTilesY - 192; y++) + for (int y = Main.UnderworldLayer; y <= Main.maxTilesY - 192; y++) { - if (WorldGen.genRand.Next(25) == 0) + if (WorldGen.genRand.NextBool(25)) { ShapeData circle = new ShapeData(); GenAction blotchMod = new Modifiers.Blotches(2, 0.4); @@ -186,7 +186,7 @@ namespace CalamityMod.World //do not place lava in the general middle area of the biome because it keeps flooding the crag bridge if (numLavaLakes != 2 && numLavaLakes != 3) { - LavaTileRunner runner = new LavaTileRunner(new Vector2(x, Main.maxTilesY - 165), new Vector2(0, 5), new Point16(-500, 500), + LavaTileRunner runner = new LavaTileRunner(new Vector2(x, Main.maxTilesY - 165), new Vector2(0, 5), new Point16(-500, 500), new Point16(250, 1000), 15f, WorldGen.genRand.Next(300, 1000), 0, true, true); runner.Start(); } @@ -201,7 +201,7 @@ namespace CalamityMod.World { for (int y = Main.maxTilesY - 100; y <= Main.maxTilesY - 20; y++) { - if (WorldGen.genRand.Next(1200) == 0) + if (WorldGen.genRand.NextBool(1200)) { LavaTileRunner runner = new LavaTileRunner(new Vector2(x, y), new Vector2(0, 5), new Point16(0, 5), new Point16(-12, 12), 15f, WorldGen.genRand.Next(-12, 25), 0, true, true); @@ -213,7 +213,7 @@ namespace CalamityMod.World //scorched remains patches for (int x = biomeStart + 30; x <= biomeEdge - 30; x++) { - if (WorldGen.genRand.Next(145) == 0) + if (WorldGen.genRand.NextBool(145)) { ScorchedGrassPatches(new Point(x, Main.maxTilesY - 135)); } @@ -231,10 +231,10 @@ namespace CalamityMod.World Tile tileRight = Main.tile[x + 1, y]; //only place ore nearby lava - if (WorldGen.genRand.Next(180) == 0 && tile.TileType == ModContent.TileType() && (tileUp.LiquidAmount > 0 || + if (WorldGen.genRand.NextBool(180)&& tile.TileType == ModContent.TileType() && (tileUp.LiquidAmount > 0 || tileDown.LiquidAmount > 0 || tileLeft.LiquidAmount > 0 || tileRight.LiquidAmount > 0)) { - WorldGen.TileRunner(x + WorldGen.genRand.Next(-15, 15), y + WorldGen.genRand.Next(-15, 15), + WorldGen.TileRunner(x + WorldGen.genRand.Next(-15, 15), y + WorldGen.genRand.Next(-15, 15), WorldGen.genRand.Next(10, 12), WorldGen.genRand.Next(10, 12), ModContent.TileType(), false, 0f, 0f, false, true); } } @@ -262,7 +262,7 @@ namespace CalamityMod.World PlaceSquareForCragHouses(biomeMiddle + 235 + house3Offset, Main.maxTilesY - 125); SchematicManager.PlaceSchematic>(SchematicManager.CragRuinKey4, new Point(biomeMiddle + 235 + house3Offset, Main.maxTilesY - 125), SchematicAnchor.BottomCenter, ref place); - + int house4Offset = WorldGen.genRand.Next(-55, 0); PlaceSquareForCragHouses(biomeEdge - 150 + house4Offset, Main.maxTilesY - 125); SchematicManager.PlaceSchematic>(SchematicManager.CragRuinKey2, @@ -271,7 +271,7 @@ namespace CalamityMod.World //lava clean up again for (int x = biomeStart; x <= biomeEdge; x++) { - for (int y = Main.maxTilesY - 200; y <= Main.maxTilesY - 5; y++) + for (int y = Main.UnderworldLayer; y <= Main.maxTilesY - 5; y++) { Tile tile = Main.tile[x, y]; Tile tileAbove = Main.tile[x, y - 1]; @@ -317,7 +317,7 @@ namespace CalamityMod.World //spread grass on all scorched remains with no lava above them for (int x = biomeStart; x <= biomeEdge; x++) { - for (int y = Main.maxTilesY - 200; y <= Main.maxTilesY - 110; y++) + for (int y = Main.UnderworldLayer; y <= Main.maxTilesY - 110; y++) { Tile tile = Main.tile[x, y]; Tile tileUp = Main.tile[x, y - 1]; @@ -331,7 +331,7 @@ namespace CalamityMod.World for (int x = biomeStart; x <= biomeEdge; x++) { - for (int y = Main.maxTilesY - 200; y <= Main.maxTilesY - 5; y++) + for (int y = Main.UnderworldLayer; y <= Main.maxTilesY - 5; y++) { Tile tile = Main.tile[x, y]; Tile tileUp = Main.tile[x, y - 1]; @@ -339,7 +339,7 @@ namespace CalamityMod.World Tile tileLeft = Main.tile[x - 1, y]; Tile tileRight = Main.tile[x + 1, y]; - if (tile.TileType == ModContent.TileType() || tile.TileType == ModContent.TileType() || + if (tile.TileType == ModContent.TileType() || tile.TileType == ModContent.TileType() || tile.TileType == ModContent.TileType()) { //slope tiles @@ -364,14 +364,14 @@ namespace CalamityMod.World for (int x = biomeStart; x <= biomeEdge; x++) { - for (int y = Main.maxTilesY - 200; y <= Main.maxTilesY - 5; y++) + for (int y = Main.UnderworldLayer; y <= Main.maxTilesY - 5; y++) { Tile tile = Main.tile[x, y]; //stalactites and stalagmites if (tile.TileType == ModContent.TileType()) { - if (WorldGen.genRand.Next(20) == 0) + if (WorldGen.genRand.NextBool(20)) { ushort[] Stalactites = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; @@ -379,17 +379,17 @@ namespace CalamityMod.World WorldGen.PlaceObject(x, y + 2, WorldGen.genRand.Next(Stalactites)); } - if (WorldGen.genRand.Next(8) == 0) + if (WorldGen.genRand.NextBool(8)) { - ushort[] Stalactites = new ushort[] { (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), + ushort[] Stalactites = new ushort[] { (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; WorldGen.PlaceObject(x, y + 2, WorldGen.genRand.Next(Stalactites)); } - if (WorldGen.genRand.Next(25) == 0) + if (WorldGen.genRand.NextBool(25)) { ushort[] Stalagmites = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; @@ -397,11 +397,11 @@ namespace CalamityMod.World WorldGen.PlaceObject(x, y - 1, WorldGen.genRand.Next(Stalagmites)); } - if (WorldGen.genRand.Next(8) == 0) + if (WorldGen.genRand.NextBool(8)) { - ushort[] Stalagmites = new ushort[] { (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), + ushort[] Stalagmites = new ushort[] { (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; WorldGen.PlaceObject(x, y - 1, WorldGen.genRand.Next(Stalagmites)); @@ -432,7 +432,7 @@ namespace CalamityMod.World if (tile.TileType == ModContent.TileType()) { //grow spine tree - if (WorldGen.genRand.Next(8) == 0 && !tile.LeftSlope && !tile.RightSlope && !tile.IsHalfBlock) + if (WorldGen.genRand.NextBool(8)&& !tile.LeftSlope && !tile.RightSlope && !tile.IsHalfBlock) { PlaceTree(x, y - 1, ModContent.TileType()); } @@ -535,7 +535,7 @@ namespace CalamityMod.World //re-add hellstone bars to the list since removing the first item also removes hellstone bars for some reason contents.Insert(1, new ChestItem(ItemID.HellstoneBar, WorldGen.genRand.Next(2, 5))); } - + for (int i = 0; i < contents.Count; i++) { chest.item[i].SetDefaults(contents[i].Type); @@ -612,4 +612,4 @@ namespace CalamityMod.World GenCragsAmbience(); } } -} \ No newline at end of file +} diff --git a/World/CalamityWorld.cs b/World/CalamityWorld.cs index 72656745f4..ae21089ff5 100644 --- a/World/CalamityWorld.cs +++ b/World/CalamityWorld.cs @@ -1,10 +1,10 @@ -using CalamityMod.NPCs.ExoMechs; +using System.Reflection; +using CalamityMod.NPCs.ExoMechs; using CalamityMod.NPCs.ExoMechs.Apollo; using CalamityMod.NPCs.ExoMechs.Ares; using CalamityMod.NPCs.ExoMechs.Artemis; using CalamityMod.NPCs.ExoMechs.Thanatos; using Microsoft.Xna.Framework; -using System.Reflection; using Terraria; using Terraria.DataStructures; using Terraria.ModLoader; @@ -23,11 +23,10 @@ namespace CalamityMod.World public static ushort[] OreTypes = new ushort[4]; // Modes - public static bool onionMode = false; // Extra accessory from Moon Lord public static bool revenge = false; // Revengeance Mode public static bool death = false; // Death Mode public static bool armageddon = false; // Armageddon Mode - + // Evaluates to whether vanilla's "Legendary Mode" is enabled (Master Mode on For the Worthy) public static bool LegendaryMode => Main.getGoodWorld && ReflectMasterMode(); @@ -35,7 +34,7 @@ namespace CalamityMod.World // Therefore gotta reflect! public static bool ReflectMasterMode() { - FieldInfo findInfo = typeof(Main).GetField("_currentGameModeInfo", BindingFlags.Static | BindingFlags.NonPublic); + FieldInfo findInfo = typeof(Main).GetField("_currentGameModeInfo", BindingFlags.Static | BindingFlags.NonPublic); GameModeData data = (GameModeData)findInfo.GetValue(null); return data.IsMasterMode; } diff --git a/World/CustomShapes.cs b/World/CustomShapes.cs index 41a50f7123..844a2d8d33 100644 --- a/World/CustomShapes.cs +++ b/World/CustomShapes.cs @@ -1,5 +1,5 @@ +using System; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.WorldBuilding; diff --git a/World/CustomTemple.cs b/World/CustomTemple.cs index a8806df368..007f9721cc 100644 --- a/World/CustomTemple.cs +++ b/World/CustomTemple.cs @@ -1,6 +1,6 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using ReLogic.Utilities; -using System; using Terraria; using Terraria.ID; using Terraria.WorldBuilding; diff --git a/World/DraedonStructures.cs b/World/DraedonStructures.cs index 52f5026c70..f26257c70e 100644 --- a/World/DraedonStructures.cs +++ b/World/DraedonStructures.cs @@ -1,19 +1,18 @@ -using CalamityMod.Tiles.SunkenSea; -using CalamityMod.Walls; -using CalamityMod.Items.DraedonMisc; -using CalamityMod.Items.Materials; -using CalamityMod.Items.Weapons.Melee; -using CalamityMod.Items.LabFinders; -using CalamityMod.Schematics; -using Microsoft.Xna.Framework; -using System; +using System; using System.Collections.Generic; using System.Linq; +using CalamityMod.Items.DraedonMisc; +using CalamityMod.Items.LabFinders; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Schematics; +using CalamityMod.Tiles.SunkenSea; +using CalamityMod.Walls; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; using Terraria.WorldBuilding; - using static CalamityMod.Schematics.SchematicManager; namespace CalamityMod.World @@ -73,13 +72,13 @@ namespace CalamityMod.World new ChestItem(potionType, WorldGen.genRand.Next(3, 5 + 1)), }; float rng = WorldGen.genRand.NextFloat(); - + //Adds a Lab Seeking Mechanism at a 50% chance, or any of the 5 Bio Lab Seeking Mechanisms at a 10% chance each - if(rng < 0.5f) + if (rng < 0.5f) contents.Insert(0, new ChestItem(ModContent.ItemType(), 1)); - else if(rng < 0.6f) + else if (rng < 0.6f) contents.Insert(0, new ChestItem(ModContent.ItemType(), 1)); - else if(rng < 0.7f) + else if (rng < 0.7f) contents.Insert(0, new ChestItem(ModContent.ItemType(), 1)); else if (rng < 0.8f) contents.Insert(0, new ChestItem(ModContent.ItemType(), 1)); @@ -101,7 +100,7 @@ namespace CalamityMod.World do { - int underworldTop = Main.maxTilesY - 200; + int underworldTop = Main.UnderworldLayer; int placementPositionX = WorldGen.genRand.Next((int)(Main.maxTilesX * 0.1f), (int)(Main.maxTilesX * 0.9f)); int placementPositionY = WorldGen.genRand.Next(underworldTop - 550, underworldTop - 50); @@ -180,7 +179,7 @@ namespace CalamityMod.World do { - int underworldTop = Main.maxTilesY - 200; + int underworldTop = Main.UnderworldLayer; int placementPositionX = WorldGen.genRand.Next((int)(Main.maxTilesX * 0.15f), (int)(Main.maxTilesX * 0.85f)); int placementPositionY = WorldGen.genRand.Next(underworldTop - 400, underworldTop - 50); @@ -252,10 +251,10 @@ namespace CalamityMod.World string mapKey = HellLabKey; PilePlacementMaps.TryGetValue(mapKey, out PilePlacementFunction pilePlacementFunction); SchematicMetaTile[,] schematic = TileMaps[mapKey]; - + do { - int underworldTop = Main.maxTilesY - 200; + int underworldTop = Main.UnderworldLayer; //gen opposite to the brimstone crags int placementPositionX = (Main.dungeonX > Main.maxTilesX / 2) ? WorldGen.genRand.Next((int)(Main.maxTilesX / 12), (int)(Main.maxTilesX / 9)) : WorldGen.genRand.Next((int)(Main.maxTilesX * 0.82), (int)(Main.maxTilesX * 0.925)); int placementPositionY = WorldGen.genRand.Next(Main.maxTilesY - 150, Main.maxTilesY - 125); @@ -352,9 +351,9 @@ namespace CalamityMod.World int sunkenSeaY = 0; //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.maxTilesY - 200; y >= Main.worldSurface; y--) + for (int y = Main.UnderworldLayer; y >= Main.worldSurface; y--) { - if (Main.tile[placementPositionX, y].WallType == ModContent.WallType() || + if (Main.tile[placementPositionX, y].WallType == ModContent.WallType() || Main.tile[placementPositionX, y].WallType == ModContent.WallType()) { sunkenSeaY = y - 80; //offset so it generates nicely @@ -426,7 +425,7 @@ namespace CalamityMod.World do { - int underworldTop = Main.maxTilesY - 200; + int underworldTop = Main.UnderworldLayer; int placementPositionX = WorldGen.genRand.Next(120, Main.maxTilesX - 120); int placementPositionY = WorldGen.genRand.Next((int)Main.worldSurface + 160, underworldTop - HellVerticalAvoidance); @@ -509,7 +508,7 @@ namespace CalamityMod.World do { - int underworldTop = Main.maxTilesY - 200; + int underworldTop = Main.UnderworldLayer; int placementPositionX = WorldGen.genRand.Next(120, Main.maxTilesX - 120); int placementPositionY = WorldGen.genRand.Next((int)Main.worldSurface + 160, underworldTop - HellVerticalAvoidance); @@ -628,7 +627,7 @@ namespace CalamityMod.World new ChestItem(potionType, WorldGen.genRand.Next(4, 7 + 1)), new ChestItem(ModContent.ItemType(), 1), }; - + for (int i = 0; i < contents.Count; i++) { chest.item[i].SetDefaults(contents[i].Type); diff --git a/World/DungeonArchive.cs b/World/DungeonArchive.cs index e99f11b677..b761b4656f 100644 --- a/World/DungeonArchive.cs +++ b/World/DungeonArchive.cs @@ -1,17 +1,17 @@ -using CalamityMod.Schematics; -using static CalamityMod.Schematics.SchematicManager; -using Terraria; -using Terraria.IO; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.DataStructures; -using Terraria.WorldBuilding; -using Terraria.Utilities; -using Terraria.GameContent.Generation; -using Microsoft.Xna.Framework; -using System; -using System.Linq; +using System; using System.Collections.Generic; +using System.Linq; +using CalamityMod.Schematics; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.GameContent.Generation; +using Terraria.ID; +using Terraria.IO; +using Terraria.ModLoader; +using Terraria.Utilities; +using Terraria.WorldBuilding; +using static CalamityMod.Schematics.SchematicManager; namespace CalamityMod.World { @@ -75,7 +75,7 @@ namespace CalamityMod.World dungeonArchiveColor = 1; else if (tile.TileType == TileID.PinkDungeonBrick) dungeonArchiveColor = 2; - + placedArchive = true; break; @@ -93,12 +93,12 @@ namespace CalamityMod.World } if (dungeonArchiveColor == 1) { - SchematicManager.PlaceSchematic(SchematicManager.GreenArchiveKey, new Point(i, j), SchematicAnchor.TopCenter, + SchematicManager.PlaceSchematic(SchematicManager.GreenArchiveKey, new Point(i, j), SchematicAnchor.TopCenter, ref firstItem, new Action(FillArchiveChests)); } if (dungeonArchiveColor == 2) { - SchematicManager.PlaceSchematic(SchematicManager.PinkArchiveKey, new Point(i, j), SchematicAnchor.TopCenter, + SchematicManager.PlaceSchematic(SchematicManager.PinkArchiveKey, new Point(i, j), SchematicAnchor.TopCenter, ref firstItem, new Action(FillArchiveChests)); } @@ -130,7 +130,7 @@ namespace CalamityMod.World new ChestItem(potionType2, WorldGen.genRand.Next(4, 8)), new ChestItem(ItemID.GoldCoin, WorldGen.genRand.Next(5, 10)), }; - + //this is normally not a good idea with separate items lists, but both lists are the same size so it is fine here for (int i = 0; i < contents1.Count; i++) { diff --git a/World/GiantHive.cs b/World/GiantHive.cs index 57adc27ea4..96b8e31331 100644 --- a/World/GiantHive.cs +++ b/World/GiantHive.cs @@ -1,4 +1,9 @@ -using CalamityMod.Items.Accessories; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using CalamityMod.DataStructures; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using CalamityMod.Items.Potions; using CalamityMod.Items.Weapons.Rogue; @@ -9,21 +14,16 @@ using CalamityMod.Tiles.Crags; using CalamityMod.Tiles.FurnitureAncient; using CalamityMod.Tiles.Ores; using CalamityMod.Walls; -using CalamityMod.DataStructures; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.Linq; -using System.Reflection; -using System.Collections.Generic; using Terraria; +using Terraria.DataStructures; +using Terraria.GameContent.Generation; using Terraria.ID; using Terraria.IO; using Terraria.ModLoader; using Terraria.Utilities; using Terraria.WorldBuilding; -using Terraria.DataStructures; -using Terraria.GameContent.Generation; namespace CalamityMod.World { @@ -38,26 +38,26 @@ namespace CalamityMod.World while (!validHeightFound && attempts++ < 100000) { while (!WorldGen.SolidTile(origin.X, treeHeight)) - { - treeHeight++; - } + { + treeHeight++; + } if (Main.tile[origin.X, treeHeight].HasTile || Main.tile[origin.X, treeHeight].WallType > 0) - { + { validHeightFound = true; - } + } } int extraWidth = 0; - + while (validHeightFound) { //place the roots first so the bottom of the hole doesnt look strange for (int k = 0; k < 6; k++) { double angle = (double)k / 3.0 * 2.0 + 0.57075; - WorldUtils.Gen(new Point(origin.X + 2, origin.Y - 30), new ShapeRoot((int)angle, WorldGen.genRand.Next(80, 120)), - Actions.Chain(new Modifiers.SkipTiles(21, 467, 226, 237), new Modifiers.SkipWalls(87), + WorldUtils.Gen(new Point(origin.X + 2, origin.Y - 30), new ShapeRoot((int)angle, WorldGen.genRand.Next(80, 120)), + Actions.Chain(new Modifiers.SkipTiles(21, 467, 226, 237), new Modifiers.SkipWalls(87), new Actions.SetTile(TileID.LivingMahogany, setSelfFrames: true))); } @@ -75,28 +75,28 @@ namespace CalamityMod.World //create a list of points for the ends of each branch List list = new List(); - WorldUtils.Gen(new Point(origin.X + WorldGen.genRand.Next(-3, 3), y), new ShapeBranch(-0.6853981852531433, - WorldGen.genRand.Next(5, 25)).OutputEndpoints(list), Actions.Chain(new Modifiers.SkipTiles(21, 467, 226, 237), + WorldUtils.Gen(new Point(origin.X + WorldGen.genRand.Next(-3, 3), y), new ShapeBranch(-0.6853981852531433, + WorldGen.genRand.Next(5, 25)).OutputEndpoints(list), Actions.Chain(new Modifiers.SkipTiles(21, 467, 226, 237), new Modifiers.SkipWalls(87), new Actions.SetTile(TileID.LivingMahogany), new Actions.SetFrames(frameNeighbors: true))); - WorldUtils.Gen(new Point(origin.X + WorldGen.genRand.Next(-3, 3), y), new ShapeBranch(-2.45619455575943, - WorldGen.genRand.Next(5, 25)).OutputEndpoints(list), Actions.Chain(new Modifiers.SkipTiles(21, 467, 226, 237), + WorldUtils.Gen(new Point(origin.X + WorldGen.genRand.Next(-3, 3), y), new ShapeBranch(-2.45619455575943, + WorldGen.genRand.Next(5, 25)).OutputEndpoints(list), Actions.Chain(new Modifiers.SkipTiles(21, 467, 226, 237), new Modifiers.SkipWalls(87), new Actions.SetTile(TileID.LivingMahogany), new Actions.SetFrames(frameNeighbors: true))); //place living mahogany leaves at the end of each branch foreach (Point item in list) { - WorldUtils.Gen(item, new Shapes.Circle(WorldGen.genRand.Next(5, 12)), Actions.Chain(new Modifiers.Blotches(WorldGen.genRand.Next(3, 5), WorldGen.genRand.Next(3, 5)), + WorldUtils.Gen(item, new Shapes.Circle(WorldGen.genRand.Next(5, 12)), Actions.Chain(new Modifiers.Blotches(WorldGen.genRand.Next(3, 5), WorldGen.genRand.Next(3, 5)), new Modifiers.SkipTiles(383, 21, 467, 226, 237), new Modifiers.SkipWalls(78, 87), new Actions.SetTile(TileID.LivingMahoganyLeaves), new Actions.SetFrames(frameNeighbors: true))); } } //place the tree itself - WorldUtils.Gen(new Point(origin.X + WorldGen.genRand.Next(-1 - extraWidth, 1), y), new Shapes.Rectangle(6 + extraWidth, 3 + extraWidth), + WorldUtils.Gen(new Point(origin.X + WorldGen.genRand.Next(-1 - extraWidth, 1), y), new Shapes.Rectangle(6 + extraWidth, 3 + extraWidth), Actions.Chain(new Modifiers.SkipTiles(21, 467, 226, 237), new Modifiers.SkipWalls(87), new Actions.RemoveWall(), new Actions.SetTile(TileID.LivingMahogany), new Actions.SetFrames())); - WorldUtils.Gen(new Point(origin.X + WorldGen.genRand.Next(-1, 1), y), new Shapes.Rectangle(6 + extraWidth, 3 + extraWidth), + WorldUtils.Gen(new Point(origin.X + WorldGen.genRand.Next(-1, 1), y), new Shapes.Rectangle(6 + extraWidth, 3 + extraWidth), Actions.Chain(new Modifiers.SkipTiles(21, 467, 226, 237), new Modifiers.SkipWalls(87), new Actions.RemoveWall(), new Actions.SetTile(TileID.LivingMahogany), new Actions.SetFrames())); @@ -124,7 +124,7 @@ namespace CalamityMod.World })); //chance to place blocks inside the tree for randomness - if (WorldGen.genRand.Next(20) == 0) + if (WorldGen.genRand.NextBool(20)) { WorldUtils.Gen(new Point(origin.X + WorldGen.genRand.Next(-2, 2), y), new ModShapes.All(circle), Actions.Chain(new GenAction[] { @@ -145,7 +145,7 @@ namespace CalamityMod.World return false; } - + public static bool CanPlaceGiantHive(Point origin, StructureMap structures) { if (!structures.CanPlace(new Rectangle(origin.X - 50, origin.Y - 50, 100, 100))) @@ -411,7 +411,7 @@ namespace CalamityMod.World if (Main.tile[i, j].WallType == WallID.CrimstoneUnsafe || Main.tile[i, j].WallType == WallID.EbonstoneUnsafe || Main.tile[i, j].WallType == WallID.LihzahrdBrickUnsafe) return true; - if (Main.tile[i,j].LiquidAmount != 0 && Main.tile[i, j].LiquidType == LiquidID.Shimmer) + if (Main.tile[i, j].LiquidAmount != 0 && Main.tile[i, j].LiquidType == LiquidID.Shimmer) return true; } } diff --git a/World/MechanicShed.cs b/World/MechanicShed.cs index 3a8cd8b149..59db3bbe80 100644 --- a/World/MechanicShed.cs +++ b/World/MechanicShed.cs @@ -25,14 +25,14 @@ namespace CalamityMod.World while (!foundValidGround && attempts++ < 100000) { while (!WorldGen.SolidTile(placementPositionX, placementPositionY) && placementPositionY <= Main.worldSurface) - { + { placementPositionY++; - } + } if (Main.tile[placementPositionX, placementPositionY].HasTile || Main.tile[placementPositionX, placementPositionY].WallType > 0) - { + { foundValidGround = true; - } + } } Point placementPoint = new Point(placementPositionX, placementPositionY + 5); @@ -58,7 +58,7 @@ namespace CalamityMod.World new ChestItem(ItemID.BuilderPotion, WorldGen.genRand.Next(1, 3)), new ChestItem(ItemID.GoldCoin, WorldGen.genRand.Next(1, 3)), }; - + for (int i = 0; i < contents.Count; i++) { chest.item[i].SetDefaults(contents[i].Type); diff --git a/World/MiscWorldgenRoutines.cs b/World/MiscWorldgenRoutines.cs index eba1b6ab7e..f413f99e1e 100644 --- a/World/MiscWorldgenRoutines.cs +++ b/World/MiscWorldgenRoutines.cs @@ -1,4 +1,7 @@ -using CalamityMod.Items.Accessories; +using System; +using System.Collections.Generic; +using System.Reflection; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using CalamityMod.Items.Potions; using CalamityMod.Items.Weapons.Rogue; @@ -10,16 +13,13 @@ using CalamityMod.Tiles.FurnitureAncient; using CalamityMod.Tiles.Ores; using CalamityMod.Walls; using Microsoft.Xna.Framework; -using System; -using System.Reflection; -using System.Collections.Generic; using Terraria; +using Terraria.GameContent.Generation; using Terraria.ID; using Terraria.IO; using Terraria.ModLoader; using Terraria.Utilities; using Terraria.WorldBuilding; -using Terraria.GameContent.Generation; namespace CalamityMod.World { @@ -77,7 +77,7 @@ namespace CalamityMod.World // Astral Chest has completely different loot in it if (type == ModContent.TileType()) { - PutItemInChest(ref chest, ModContent.ItemType(), 30, 80); + PutItemInChest(ref chest, ModContent.ItemType(), 30, 80); PutItemInChest(ref chest, ModContent.ItemType(), 10, 14); PutItemInChest(ref chest, ModContent.ItemType(), 8); PutItemInChest(ref chest, ModContent.ItemType(), 3, 5); @@ -217,17 +217,17 @@ namespace CalamityMod.World chasmWidth += WorldGen.genRand.Next(10); chasmWidth -= WorldGen.genRand.Next(10); float smallHoleLimit = 790f; //small - + if (Main.maxTilesY > 1500) - { - smallHoleLimit = 1360f; - - if (Main.maxTilesY > 2100) - { - smallHoleLimit = 1950f; - } + { + smallHoleLimit = 1360f; + + if (Main.maxTilesY > 2100) + { + smallHoleLimit = 1950f; + } } - + if (ocean && maxChasmSize > smallHoleLimit) { if (chasmWidth < 7.0) //min width @@ -427,7 +427,7 @@ namespace CalamityMod.World #region Smart Gem Gen public static void SmartGemGen() { - double oneThirdOfUnderground = (Main.maxTilesY - 200 - Main.worldSurface) / 3D; + double oneThirdOfUnderground = (Main.UnderworldLayer - Main.worldSurface) / 3D; double verticalStartFactor_Layer1 = Main.worldSurface; double verticalStartFactor_Layer2 = verticalStartFactor_Layer1 + oneThirdOfUnderground; double verticalStartFactor_Layer3 = verticalStartFactor_Layer1 + oneThirdOfUnderground * 2D; diff --git a/World/Planets/GrassPlanet.cs b/World/Planets/GrassPlanet.cs index 22e6c53dd0..9272f44e89 100644 --- a/World/Planets/GrassPlanet.cs +++ b/World/Planets/GrassPlanet.cs @@ -1,8 +1,8 @@ -using CalamityMod.DataStructures; +using System; +using System.Collections.Generic; +using CalamityMod.DataStructures; using CalamityMod.Tiles.Ores; using Microsoft.Xna.Framework; -using System; -using System.Collections.Generic; using Terraria; using Terraria.GameContent.Generation; using Terraria.ID; @@ -131,7 +131,7 @@ namespace CalamityMod.World.Planets //Boffin's funtime 2 -- Small shrine #region Boffin's funtime 2 - bool boffsFuntime2 = _random.Next(10) == 0; + bool boffsFuntime2 = _random.NextBool(10); if (boffsFuntime2) { int topLayer = origin.Y - radius - 4; @@ -146,7 +146,7 @@ namespace CalamityMod.World.Planets } } } - TopLayerFound: +TopLayerFound: ushort brickType = TileID.StoneSlab; int shrineDepth = _random.Next(8, 13); diff --git a/World/Planets/LuminitePlanet.cs b/World/Planets/LuminitePlanet.cs index 41ab36fe85..01a92face5 100644 --- a/World/Planets/LuminitePlanet.cs +++ b/World/Planets/LuminitePlanet.cs @@ -27,7 +27,7 @@ namespace CalamityMod.World.Planets { for (int tries = 0; tries < 15000; tries++) { - Point planetoidOrigin = new Point(WorldGen.genRand.Next((int)(Main.maxTilesX*0.15), (int)(Main.maxTilesX*0.85)), WorldGen.genRand.Next(75, 125)); + Point planetoidOrigin = new Point(WorldGen.genRand.Next((int)(Main.maxTilesX * 0.15), (int)(Main.maxTilesX * 0.85)), WorldGen.genRand.Next(75, 125)); if (WorldGen.genRand.NextBool(2)) { if (config.CreateBiome().Place(planetoidOrigin, GenVars.structures)) diff --git a/World/Planets/MainPlanet.cs b/World/Planets/MainPlanet.cs index 9b05d6bf7f..a1bb4cbfe9 100644 --- a/World/Planets/MainPlanet.cs +++ b/World/Planets/MainPlanet.cs @@ -1,9 +1,9 @@ -using CalamityMod.DataStructures; -using CalamityMod.Schematics; -using Microsoft.Xna.Framework; -using System; +using System; using System.Collections.Generic; using System.Linq; +using CalamityMod.DataStructures; +using CalamityMod.Schematics; +using Microsoft.Xna.Framework; using Terraria; using Terraria.GameContent.Generation; using Terraria.ID; diff --git a/World/Planets/Planetoid.cs b/World/Planets/Planetoid.cs index 5e48fd729d..90d5bcd15f 100644 --- a/World/Planets/Planetoid.cs +++ b/World/Planets/Planetoid.cs @@ -1,5 +1,5 @@ -using Microsoft.Xna.Framework; -using System.Collections.Generic; +using System.Collections.Generic; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.IO; diff --git a/World/SulphurousSea.cs b/World/SulphurousSea.cs index addd459849..f020932486 100644 --- a/World/SulphurousSea.cs +++ b/World/SulphurousSea.cs @@ -1,4 +1,7 @@ -using CalamityMod.Items; +using System; +using System.Collections.Generic; +using System.Linq; +using CalamityMod.Items; using CalamityMod.Items.Accessories; using CalamityMod.Items.Placeables.Furniture; using CalamityMod.Items.Weapons.Summon; @@ -8,9 +11,6 @@ using CalamityMod.Tiles.Abyss.AbyssAmbient; using CalamityMod.Tiles.Abyss.Stalactite; using CalamityMod.Walls; using Microsoft.Xna.Framework; -using System; -using System.Collections.Generic; -using System.Linq; using Terraria; using Terraria.GameContent.RGB; using Terraria.ID; @@ -68,7 +68,7 @@ namespace CalamityMod.World }; public const float CheeseCaveMagnification = 0.00237f; - + public static readonly float[] CheeseCaveCarveOutThresholds = new float[] { 0.32f @@ -103,7 +103,7 @@ namespace CalamityMod.World public const float SandstoneEdgeNoiseMagnification = 0.00115f; public const int StalactitePairMinDistance = 6; - + public const int StalactitePairMaxDistance = 44; // Loop variables that are accessed via getter methods should be stored externally in local variables for performance reasons. @@ -130,7 +130,7 @@ namespace CalamityMod.World get { if (Main.remixWorld) - return (int)((Main.maxTilesY - 200) * 0.2f); + return (int)(Main.UnderworldLayer * 0.2f); float depthFactor = Main.maxTilesX switch { @@ -208,7 +208,7 @@ namespace CalamityMod.World if (!Main.remixWorld) LayTreesOnSurface(); } - + public static void SulphurSeaGenerationAfterAbyss() { CreateBeachNearSea(); @@ -235,7 +235,7 @@ namespace CalamityMod.World xCheckPosition += Abyss.AtLeftSideOfWorld.ToDirectionInt(); } while (CalamityUtils.ParanoidTileRetrieval(determinedPoint.X, determinedPoint.Y).TileType == TileID.Ebonstone); - YStart = Main.remixWorld ? (int)((Main.maxTilesY - 200) * 0.8f) : determinedPoint.Y; + YStart = Main.remixWorld ? (int)(Main.UnderworldLayer * 0.8f) : determinedPoint.Y; } public static void GenerateSandBlock() @@ -311,7 +311,7 @@ namespace CalamityMod.World int totalSandTilesBeforeWater = WorldGen.genRand.Next(TotalSandTilesBeforeWaterMin, TotalSandTilesBeforeWaterMax); int width = (int)((BiomeWidth - totalSandTilesBeforeWater) * OpenSeaWidthPercentage); float descentSmoothness = WorldGen.genRand.NextFloat(TopWaterDescentSmoothnessMin, TopWaterDescentSmoothnessMax); - + for (int i = 1; i < width; i++) { int x = GetActualX(i); @@ -326,7 +326,7 @@ namespace CalamityMod.World { if (y >= top + DepthForWater) Main.tile[x, y + WorldGen.genRand.Next(22, 25)].WallType = (ushort)ModContent.WallType(); - Main.tile[x, y].LiquidAmount = byte.MaxValue; + Main.tile[x, y].LiquidAmount = byte.MaxValue; Main.tile[x, y].Get().HasTile = false; } @@ -527,7 +527,7 @@ namespace CalamityMod.World (ushort)ModContent.TileType(), }; ushort wallID = (ushort)ModContent.WallType(); - + void getAttachedPoints(int x, int y, List points) { Tile t = CalamityUtils.ParanoidTileRetrieval(x, y); @@ -641,7 +641,7 @@ namespace CalamityMod.World public static void LayTreesOnSurface() { int width = BiomeWidth; - + for (int i = 0; i < width - 8; i++) { // Only sometimes generate trees. @@ -682,7 +682,7 @@ namespace CalamityMod.World return; Tile tileAtEdge = CalamityUtils.ParanoidTileRetrieval(determinedPoint.X, determinedPoint.Y); - + // Extend outward to encompass some of the desert, if there is one. if (tileAtEdge.TileType is TileID.Sand or TileID.Ebonsand or TileID.Crimsand) beachWidth += 85; @@ -891,7 +891,7 @@ namespace CalamityMod.World // Try again if the distance between the top and bottom is too short. if (MathHelper.Distance(y, top.Y) < MinColumnHeight) tryAgain = true; - + if (tryAgain) { c--; @@ -972,17 +972,17 @@ namespace CalamityMod.World } public static void PlaceAmbience() - { + { for (int i = 0; i < BiomeWidth; i++) { int x = GetActualX(i); - for (int y = YStart - 140; y < (Main.remixWorld ? (Main.maxTilesY - 200) : Main.rockLayer); y++) + for (int y = YStart - 140; y < (Main.remixWorld ? Main.UnderworldLayer : Main.rockLayer); y++) { Tile tile = Main.tile[x, y]; Tile tileUp = Main.tile[x, y - 1]; Tile tileDown = Main.tile[x, y + 1]; - if (tile.TileType == ModContent.TileType() || tile.TileType == ModContent.TileType() || + if (tile.TileType == ModContent.TileType() || tile.TileType == ModContent.TileType() || tile.TileType == ModContent.TileType() || tile.TileType == ModContent.TileType()) { //stalagmites, fossiles, and ribs @@ -1025,7 +1025,7 @@ namespace CalamityMod.World if (WorldGen.genRand.NextBool(18)) { ushort[] Ribs = new ushort[] { (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; WorldGen.PlaceObject(x, y - 1, WorldGen.genRand.Next(Ribs)); @@ -1472,7 +1472,7 @@ namespace CalamityMod.World Main.tile[x, y + dy].Get().HasTile = true; } } - + public static void PlaceStalacmite(int x, int y, int height, ushort type) { for (int dy = height - 1; dy > 0; dy--) diff --git a/World/SunkenSea.cs b/World/SunkenSea.cs index 462f2e3021..20e6d1b40c 100644 --- a/World/SunkenSea.cs +++ b/World/SunkenSea.cs @@ -1,13 +1,13 @@ -using CalamityMod.Tiles.SunkenSea; +using System; +using System.Collections.Generic; +using CalamityMod.Tiles.SunkenSea; using CalamityMod.Walls; using Microsoft.Xna.Framework; -using System; -using System.Collections.Generic; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; using Terraria.WorldBuilding; -using Terraria.DataStructures; namespace CalamityMod.World { @@ -70,7 +70,7 @@ namespace CalamityMod.World int clusterPos = clusterIndexMap[x, y]; if (clusterPos != -1 && clusterPos != index) { - int clusterHeight = (WorldGen.genRand.Next(2) == 0) ? -1 : index; + int clusterHeight = (WorldGen.genRand.NextBool(2)) ? -1 : index; foreach (Point current in pointClusters[clusterPos]) { clusterIndexMap[current.X, current.Y] = clusterHeight; @@ -94,7 +94,7 @@ namespace CalamityMod.World 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.Next(2) == 0; + array[j, i] = WorldGen.genRand.NextBool(2); } } List> list = new List>(); @@ -102,7 +102,7 @@ namespace CalamityMod.World { for (int l = 0; l < array.GetLength(1); l++) { - if (array[k, l] && WorldGen.genRand.Next(2) == 0) + if (array[k, l] && WorldGen.genRand.NextBool(2)) { List list2 = new List(); SearchForCluster(array, list2, k, l, 2); @@ -335,10 +335,10 @@ namespace CalamityMod.World } //place extra caves throughout the biome for variance - if (WorldGen.genRand.Next(1000) == 0 && tile != null && tile.HasTile && + if (WorldGen.genRand.NextBool(1000)&& tile != null && tile.HasTile && (tile.TileType == ModContent.TileType() || tile.TileType == ModContent.TileType())) { - TileRunner runner = new TileRunner(new Vector2(x, y), new Vector2(0, 5), new Point16(-35, 35), + 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(); } @@ -354,7 +354,7 @@ namespace CalamityMod.World } //kill any random clumps of navystone without eutrophic sand around them - if (tile.TileType == ModContent.TileType() && tileUp.TileType != ModContent.TileType() && + if (tile.TileType == ModContent.TileType() && tileUp.TileType != ModContent.TileType() && tileDown.TileType != ModContent.TileType() && tileLeft.TileType != ModContent.TileType() && tileRight.TileType != ModContent.TileType()) { @@ -458,7 +458,7 @@ namespace CalamityMod.World int smallHoleY = WorldGen.genRand.Next(start.Y + 20, sunkenSeaBottom); point = new Point(smallHoleX, smallHoleY); - if (smallHoles < totalHoleCount && WorldGen.genRand.Next(3) == 0 && !rectangle.Contains(point)) + if (smallHoles < totalHoleCount && WorldGen.genRand.NextBool(3)&& !rectangle.Contains(point)) { smallHoles++; int radiusSmall = (int)(((float)WorldGen.genRand.Next(8, 11)) * overallBiomeScale); @@ -538,7 +538,7 @@ namespace CalamityMod.World int num5 = k + start.X; int num6 = l + start.Y; Tile tile = Main.tile[num5, num6]; - if (tile.HasTile && (tile.TileType == ModContent.TileType() || + if (tile.HasTile && (tile.TileType == ModContent.TileType() || tile.TileType == ModContent.TileType() || tile.TileType == ModContent.TileType())) { bool flag = true; @@ -578,7 +578,7 @@ namespace CalamityMod.World } } if (tile.TileType == ModContent.TileType() || ((tile.TileType == ModContent.TileType() || - tile.TileType == ModContent.TileType()) && WorldGen.genRand.Next(8) == 0)) + tile.TileType == ModContent.TileType()) && WorldGen.genRand.NextBool(8))) { if (flag3 ^ flag4) { @@ -620,73 +620,73 @@ namespace CalamityMod.World } if (tile.TileType == ModContent.TileType() || tile.TileType == ModContent.TileType()) { - if (WorldGen.genRand.Next(10) == 0) + if (WorldGen.genRand.NextBool(10)) { WorldGen.PlaceTile(num5, num6 - 1, (ushort)ModContent.TileType(), true, false, -1, 0); } - if (WorldGen.genRand.Next(20) == 0) + if (WorldGen.genRand.NextBool(20)) { WorldGen.PlaceTile(num5, num6 - 1, (ushort)ModContent.TileType(), true, false, -1, 0); } - if (WorldGen.genRand.Next(8) == 0) + if (WorldGen.genRand.NextBool(8)) { WorldGen.PlaceTile(num5, num6 - 1, (ushort)ModContent.TileType(), true, false, -1, 0); } - if (WorldGen.genRand.Next(30) == 0) + if (WorldGen.genRand.NextBool(30)) { WorldGen.PlaceTile(num5, num6 - 1, (ushort)ModContent.TileType(), true, false, -1, 0); } - if (WorldGen.genRand.Next(30) == 0) + if (WorldGen.genRand.NextBool(30)) { WorldGen.PlaceTile(num5, num6 - 1, (ushort)ModContent.TileType(), true, false, -1, 0); } - if (WorldGen.genRand.Next(20) == 0) + if (WorldGen.genRand.NextBool(20)) { WorldGen.PlaceTile(num5, num6 - 1, (ushort)ModContent.TileType(), true, false, -1, 0); } //colorful corals - if (WorldGen.genRand.Next(20) == 0) + if (WorldGen.genRand.NextBool(20)) { WorldGen.PlaceTile(num5, num6 - 1, (ushort)ModContent.TileType(), true, false, -1, 0); } - if (WorldGen.genRand.Next(20) == 0) + if (WorldGen.genRand.NextBool(20)) { WorldGen.PlaceTile(num5, num6 - 1, (ushort)ModContent.TileType(), true, false, -1, 0); } - if (WorldGen.genRand.Next(20) == 0) + if (WorldGen.genRand.NextBool(20)) { WorldGen.PlaceTile(num5, num6 - 1, (ushort)ModContent.TileType(), true, false, -1, 0); } - if (WorldGen.genRand.Next(20) == 0) + if (WorldGen.genRand.NextBool(20)) { WorldGen.PlaceTile(num5, num6 - 1, (ushort)ModContent.TileType(), true, false, -1, 0); } //stalactites - if (WorldGen.genRand.Next(15) == 0) + if (WorldGen.genRand.NextBool(15)) { ushort[] Stalactites = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; WorldGen.PlaceObject(num5, num6 + 2, WorldGen.genRand.Next(Stalactites)); } - if (WorldGen.genRand.Next(15) == 0) + if (WorldGen.genRand.NextBool(15)) { WorldGen.PlaceTile(num5, num6 + 1, (ushort)ModContent.TileType(), true, false, -1, 0); } //stalagmites - if (WorldGen.genRand.Next(10) == 0) + if (WorldGen.genRand.NextBool(10)) { ushort[] Stalagmites = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; WorldGen.PlaceObject(num5, num6 - 2, WorldGen.genRand.Next(Stalagmites)); } - if (WorldGen.genRand.Next(10) == 0) + if (WorldGen.genRand.NextBool(10)) { WorldGen.PlaceTile(num5, num6 - 1, (ushort)ModContent.TileType(), true, false, -1, 0); } @@ -695,7 +695,7 @@ namespace CalamityMod.World { if (tile.TileType == ModContent.TileType() || tile.WallType == ModContent.WallType()) { - if (WorldGen.genRand.Next(10) == 0) + if (WorldGen.genRand.NextBool(10)) { WorldGen.PlaceTile(num5, num6 + 1, (ushort)ModContent.TileType(), true, false, -1, 0); } @@ -704,7 +704,7 @@ namespace CalamityMod.World } } } - + //added this to 100% make sure the sunken sea places where it is supposed to be static bool foundValidPosition = false; diff --git a/World/UndergroundShrines.cs b/World/UndergroundShrines.cs index dd1b3ed3d9..d109e2340b 100644 --- a/World/UndergroundShrines.cs +++ b/World/UndergroundShrines.cs @@ -1,22 +1,21 @@ -using CalamityMod.Items.Accessories; +using System; +using System.Collections.Generic; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Mounts; using CalamityMod.Items.Placeables.Furniture; +using CalamityMod.Items.Potions; +using CalamityMod.Items.Potions.Alcohol; using CalamityMod.Items.SummonItems; +using CalamityMod.Schematics; using CalamityMod.Tiles.DraedonStructures; using CalamityMod.Tiles.SunkenSea; using CalamityMod.Walls; -using CalamityMod.Schematics; using Microsoft.Xna.Framework; -using System; -using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; using Terraria.WorldBuilding; - using static CalamityMod.Schematics.SchematicManager; -using CalamityMod.Items.Potions.Alcohol; -using CalamityMod.Items.Potions; namespace CalamityMod.World { @@ -90,14 +89,14 @@ namespace CalamityMod.World { int tries = 0; string mapKey = CorruptionShrineKey; - + do { int placementPositionX = WorldGen.genRand.Next((int)(Main.maxTilesX * 0.05f), (int)(Main.maxTilesX * 0.95f)); int placementPositionY = WorldGen.genRand.Next((int)(Main.maxTilesY * 0.15f), (int)(Main.maxTilesY * 0.5f)); Point placementPoint = new Point(placementPositionX, placementPositionY); - Vector2 schematicSize = new Vector2(TileMaps[mapKey].GetLength(0)/2, TileMaps[mapKey].GetLength(1)); //Fooling the system into thinking the shrine is smaller than it actually is so it fits into chasms + Vector2 schematicSize = new Vector2(TileMaps[mapKey].GetLength(0) / 2, TileMaps[mapKey].GetLength(1)); //Fooling the system into thinking the shrine is smaller than it actually is so it fits into chasms int corruptStuffInArea = 0; bool canGenerateInLocation = true; bool inYourWalls = false; @@ -117,13 +116,13 @@ namespace CalamityMod.World if (tile.WallType == WallID.EbonstoneUnsafe) inYourWalls = true; - + //Do not cut into the altars if (tile.TileType == TileID.DemonAltar) canGenerateInLocation = false; } } - if (!canGenerateInLocation || corruptStuffInArea < totalTiles*0.9f || !structures.CanPlace(new Rectangle(placementPoint.X, placementPoint.Y, (int)schematicSize.X, (int)schematicSize.Y)) || !inYourWalls) + if (!canGenerateInLocation || corruptStuffInArea < totalTiles * 0.9f || !structures.CanPlace(new Rectangle(placementPoint.X, placementPoint.Y, (int)schematicSize.X, (int)schematicSize.Y)) || !inYourWalls) { tries++; } @@ -181,7 +180,7 @@ namespace CalamityMod.World { int tries = 0; string mapKey = CrimsonShrineKey; - + do { int placementPositionX = WorldGen.genRand.Next((int)(Main.maxTilesX * 0.05f), (int)(Main.maxTilesX * 0.95f)); @@ -203,14 +202,14 @@ namespace CalamityMod.World Tile tile = CalamityUtils.ParanoidTileRetrieval(x, y); if (ShouldAvoidLocation(new Point(x, y))) canGenerateInLocation = false; - + //Crimson does not generate walls in blocks very much, so both walls and tiles are grouped if (tile.TileType == TileID.Crimstone || tile.WallType == WallID.CrimstoneUnsafe) crimsonStuffInArea++; if (tile.WallType == WallID.CrimstoneUnsafe) inYourWalls = true; - + //Do not cut into the altars if (tile.TileType == TileID.DemonAltar) canGenerateInLocation = false; @@ -231,7 +230,7 @@ namespace CalamityMod.World } while (tries <= 60000); } #endregion - + #region Desert Shrine public static void FillDesertShrineChest(Chest chest) { @@ -272,7 +271,7 @@ namespace CalamityMod.World { int tries = 0; string mapKey = DesertShrineKey; - + do { int placementPositionX = WorldGen.genRand.Next(GenVars.UndergroundDesertLocation.Left, GenVars.UndergroundDesertLocation.Right); @@ -294,7 +293,7 @@ namespace CalamityMod.World canGenerateInLocation = false; if (tile.TileType == TileID.DesertFossil || tile.TileType == TileID.Sand || tile.TileType == TileID.HardenedSand || tile.TileType == TileID.Sandstone) - desertTilesInArea++; + desertTilesInArea++; } } if (!canGenerateInLocation || desertTilesInArea < totalTiles * 0.3f || !structures.CanPlace(new Rectangle(placementPoint.X, placementPoint.Y, (int)schematicSize.X, (int)schematicSize.Y))) @@ -341,7 +340,7 @@ namespace CalamityMod.World { int tries = 0; string mapKey = GraniteShrineKey; - + do { int placementPositionX = WorldGen.genRand.Next((int)(Main.maxTilesX * 0.1f), (int)(Main.maxTilesX * 0.9f)); @@ -358,7 +357,7 @@ namespace CalamityMod.World for (int y = placementPoint.Y; y < placementPoint.Y + schematicSize.Y; y++) { Tile tile = CalamityUtils.ParanoidTileRetrieval(x, y); - if (ShouldAvoidLocation(new Point(x, y))) + if (ShouldAvoidLocation(new Point(x, y), false)) canGenerateInLocation = false; //The granite geode is supposed to fully float in free air. No tile replacements @@ -424,7 +423,7 @@ namespace CalamityMod.World { int tries = 0; string mapKey = IceShrineKey; - + do { int placementPositionX = WorldGen.genRand.Next((int)(Main.maxTilesX * 0.25f), (int)(Main.maxTilesX * 0.75f)); @@ -448,7 +447,7 @@ namespace CalamityMod.World canGenerateInLocation = false; if (tile.TileType == TileID.SnowBlock || tile.TileType == TileID.IceBlock) - iceTilesInArea++; + iceTilesInArea++; } } if (!canGenerateInLocation || iceTilesInArea < totalTiles * 0.35f || !structures.CanPlace(new Rectangle(placementPoint.X, placementPoint.Y, (int)schematicSize.X, (int)schematicSize.Y))) @@ -494,7 +493,7 @@ namespace CalamityMod.World { int tries = 0; string mapKey = MarbleShrineKey; - + do { int placementPositionX = WorldGen.genRand.Next((int)(Main.maxTilesX * 0.1f), (int)(Main.maxTilesX * 0.9f)); @@ -521,7 +520,7 @@ namespace CalamityMod.World marbleStuffInArea++; else if ((tile.WallType == WallID.GraniteUnsafe || tile.TileType == TileID.Granite) && Main.zenithWorld) //Generates in granite in gfb marbleStuffInArea++; - + //There should be some space between the pillars so it doesn't make pillars in the middle of nowhere zone float pillarFoundationBound = schematicSize.Y * 0.2f; bool pillarSpace = y <= placementPoint.Y + schematicSize.Y - pillarFoundationBound && y >= placementPoint.Y + pillarFoundationBound; @@ -678,7 +677,7 @@ namespace CalamityMod.World { int tries = 0; string mapKey = SurfaceShrineKey; - + do { int placementPositionX = WorldGen.genRand.Next((int)(Main.maxTilesX * 0.2f), (int)(Main.maxTilesX * 0.8f)); @@ -691,10 +690,10 @@ namespace CalamityMod.World while (placementPositionX > (int)(Main.maxTilesX * 0.4f) && placementPositionX < (int)(Main.maxTilesX * 0.6f)); int numTilesBelowSurface = WorldGen.genRand.Next(25, 50); - + //use Main.worldSurface and not WorldGen.WorldSurface, i believe that is why it was genning on the surface so much int placementPositionY = (int)Main.worldSurface + numTilesBelowSurface; - + if (Main.remixWorld) placementPositionY = WorldGen.genRand.Next((int)(Main.maxTilesY * 0.65f), (int)(Main.maxTilesY * 0.7f)); //above mushroom layer Point placementPoint = new Point(placementPositionX, placementPositionY); @@ -715,10 +714,10 @@ namespace CalamityMod.World if (tile.TileType == TileID.Dirt || tile.TileType == TileID.Stone || tile.TileType == TileID.ClayBlock || tile.TileType == TileID.Sand) normalTilesInArea++; - + if (tile.HasTile) activeTilesInArea++; - + // Avoid the desert due to sand checks. if (tile.WallType == WallID.HardenedSand || tile.WallType == WallID.Sandstone) canGenerateInLocation = false; @@ -773,7 +772,8 @@ namespace CalamityMod.World break; } } - } else + } + else { bool _ = true; PlaceSchematic(mapKey, new Point(placementPoint.X, placementPoint.Y), SchematicAnchor.TopLeft, ref _, new Action(FillSurfaceShrineChest)); diff --git a/World/VernalPass.cs b/World/VernalPass.cs index 6ecbcf2eac..f1c6aa9875 100644 --- a/World/VernalPass.cs +++ b/World/VernalPass.cs @@ -18,13 +18,37 @@ namespace CalamityMod.World var schematic = TileMaps[mapKey]; int placementPositionX = WorldGen.genRand.Next(GenVars.tLeft, GenVars.tRight); - int placementPositionY = GenVars.tTop < Main.rockLayer - 10 ? GenVars.tBottom + 120 : GenVars.tTop - 120; + + //initialPlacementPositionY is the exact same variable as placementPositionY, but it is used to store the original starting position of the vernal pass + //this is to prevent any cases of infinite looping in the loop below when the vernal pass y-position is increased/decreased to move away from the temple and find a valid position + int initialPlacementPositionY = GenVars.tTop < Main.maxTilesY / 2 ? GenVars.tBottom + 150 : GenVars.tTop - 150; + int placementPositionY = GenVars.tTop < Main.maxTilesY / 2 ? GenVars.tBottom + 150 : GenVars.tTop - 150; + + //attempt to find a valid position for the biome to place in + bool foundValidPosition = false; + int attempts = 0; + + //continously place up/down until it is far enough from the temple to not destroy it + while (!foundValidPosition && attempts++ < 100000) + { + while (!NoTempleNearby(placementPositionX, placementPositionY)) + { + //increase the actual y-position the vernal pass will place at based on the starting location, if the jungle temple is too close to the initial starting location + placementPositionY += (initialPlacementPositionY < (Main.maxTilesX / 2) ? -10 : 10); + } + if (NoTempleNearby(placementPositionX, placementPositionY)) + { + foundValidPosition = true; + } + } + Point placementPoint = new Point(placementPositionX, placementPositionY); Vector2 schematicSize = new Vector2(schematic.GetLength(0), schematic.GetLength(1)); SchematicAnchor anchorType = SchematicAnchor.Center; bool firstItem = false; + PlaceSchematic(mapKey, placementPoint, anchorType, ref firstItem, new Action(FillVernalPassChests)); // Add the Vernal Pass as a protected structure. @@ -58,12 +82,29 @@ namespace CalamityMod.World contents.Insert(0, new ChestItem(mainItem, 1)); contents.Insert(1, new ChestItem(bars, WorldGen.genRand.Next(4, 7))); } - + for (int i = 0; i < contents.Count; i++) { chest.item[i].SetDefaults(contents[i].Type); chest.item[i].stack = contents[i].Stack; } } + + //determine if theres no snow blocks nearby so the biome doesnt place in the snow biome + public static bool NoTempleNearby(int X, int Y) + { + for (int i = X - 140; i < X + 140; i++) + { + for (int j = Y - 140; j < Y + 140; j++) + { + if (Main.tile[i, j].HasTile && Main.tile[i, j].TileType == TileID.LihzahrdBrick) + { + return false; + } + } + } + + return true; + } } } diff --git a/World/WorldEvilIsland.cs b/World/WorldEvilIsland.cs index 0c7d961f67..689cb7af47 100644 --- a/World/WorldEvilIsland.cs +++ b/World/WorldEvilIsland.cs @@ -1,8 +1,8 @@ -using CalamityMod.DataStructures; +using System; +using System.Collections.Generic; +using CalamityMod.DataStructures; using CalamityMod.World.Planets; using Microsoft.Xna.Framework; -using System; -using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.WorldBuilding; @@ -284,7 +284,7 @@ namespace CalamityMod.World byte wall = (byte)(genCorruptHouse ? 35 : 174); //wall Vector2 vector = new Vector2((float)i, (float)j); int houseDirection = 1; - if (WorldGen.genRand.Next(2) == 0) + if (WorldGen.genRand.NextBool(2)) { houseDirection = -1; } diff --git a/build.txt b/build.txt index cf7f77ec52..f6d015e792 100644 --- a/build.txt +++ b/build.txt @@ -1,9 +1,10 @@ author = Fabsol and the Dev Team -version = 2.0.3.008 +version = 2.0.4.001 displayName = Calamity Mod +modReferences = CalamityModMusic homepage = https://discord.gg/calamity buildIgnore = .vs\*, Properties\*, *.csproj, *.user, obj\*, bin\*, *.config, .git\*, .github\*, LICENSE, README.md, .editorconfig, .gitignore, .gitattributes, Effects\Compiler\* hideCode = false hideResources = true includeSource = false -includePDB = true +includePDB = true \ No newline at end of file diff --git a/description.txt b/description.txt index 85d9d9d4bc..e72ac9e99c 100644 --- a/description.txt +++ b/description.txt @@ -20,5 +20,5 @@ A more detailed breakdown of the content available in Calamity: - 450+ tweaks and improvements to vanilla items - Cross-mod support for the Thorium Mod -PLEASE NOTE THAT THIS MOD DOES NOT INCLUDE THE CALAMITY SOUNDTRACK. -You need to install the Calamity Music Mod if you want Calamity music. +PLEASE NOTE THAT THIS MOD REQUIRES THE CALAMITY MUSIC MOD. +You will need to install "Calamity Mod Music" from the Mod Browser or the Workshop. diff --git a/description_workshop.txt b/description_workshop.txt index 0c12ea169a..172d508e9c 100644 --- a/description_workshop.txt +++ b/description_workshop.txt @@ -1,5 +1,6 @@ [h1]Calamity Mod[/h1] [url=https://discord.gg/calamity]Discord[/url] [url=https://calamitymod.wiki.gg]Official Wiki[/url] +[b]LIMITED TIME![/b] [url=https://calamitymod.com/plush]Gimme Swag Plushie Campaign[/url] The Calamity Mod is a vast content mod that creates a new and refreshing experience for Terraria! @@ -13,7 +14,7 @@ The mod additionally tweaks tons of vanilla features whilst adding new ones to a [*] Dozens more quality of life and balance changes! [/olist] -[i]Please note that this mod does [b]NOT[/b] include Calamity's soundtrack! You will need to download the music mod for the full intended experience![/i] +[i]Please note that this mod [b]REQUIRES[/b] Calamity's soundtrack! You will need to download the music mod to be able to play![/i] https://steamcommunity.com/sharedfiles/filedetails/?id=2824688266 [b]Be sure to join our Discord server linked above to keep up with the latest news about upcoming updates and features.[/b] diff --git a/icon.png b/icon.png index 88d6a402f6..bcc6cce92b 100644 Binary files a/icon.png and b/icon.png differ diff --git a/icon_workshop.png b/icon_workshop.png index 5ede327664..df0f63ecf2 100644 Binary files a/icon_workshop.png and b/icon_workshop.png differ